From: support Date: Tue, 6 Sep 2022 12:19:58 +0000 (+0000) Subject: Built motion from commit 990fb85c.|2.6.15 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22%7B%7Blicense.mail?a=commitdiff_plain;h=c0e7afde789b0a09b40ef51aeeee3c1435f8cfd2;p=motion2.git Built motion from commit 990fb85c.|2.6.15 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 70cb035..b612810 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-08-29T11:56:41.053Z", + "time": "2022-09-06T12:11:29.129Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 784284f..a9c8163 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-08-29T11:56:41.053Z", + "time": "2022-09-06T12:11:29.129Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/package.json b/package.json index 3ccea66..6d6dbe7 100644 --- a/package.json +++ b/package.json @@ -44,9 +44,7 @@ "prettier:write": "prettier --write './**/*'", "format-all": "npm run js-beautify && npm run prettier:write", "test": "mocha server/test --timeout 5000", - "aux-containers": "docker-compose up -d database cache", - "db-dump": "docker-compose exec -u root database /xmotion_mysql_bk.sh dump", - "db-restore": "docker-compose exec -u root database /xmotion_mysql_bk.sh restore" + "aux-containers": "docker-compose up -d database cache" }, "dependencies": { "@types/express-serve-static-core": "4.17.28", diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 4635609..720658a 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 _0xfe43=['sequelize','VIRTUAL','action','STRING','contactManager','integration','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0x5d8a4b,_0x273e47){var _0x5f38e=function(_0x51e69e){while(--_0x51e69e){_0x5d8a4b['push'](_0x5d8a4b['shift']());}};_0x5f38e(++_0x273e47);}(_0xfe43,0x120));var _0x3fe4=function(_0x46e523,_0xe6fccb){_0x46e523=_0x46e523-0x0;var _0x5da0ee=_0xfe43[_0x46e523];return _0x5da0ee;};'use strict';var Sequelize=require(_0x3fe4('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fe4('0x1')],'get':function(_0x8d4851){return this['getDataValue'](_0x3fe4('0x2'));}},'action':{'type':Sequelize[_0x3fe4('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3fe4('0x4'),_0x3fe4('0x5'),'motionbar',_0x3fe4('0x6'),_0x3fe4('0x7'),'browser',_0x3fe4('0x8'),_0x3fe4('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x3fe4('0xa')},'data1':{'type':Sequelize[_0x3fe4('0x3')](0x1000),'comment':_0x3fe4('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x3fe4('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x3fe4('0xd')},'data4':{'type':Sequelize[_0x3fe4('0x3')](0x1000),'comments':_0x3fe4('0xe')},'data5':{'type':Sequelize[_0x3fe4('0x3')](0x1000),'comments':_0x3fe4('0xf')},'data6':{'type':Sequelize[_0x3fe4('0x3')],'comments':_0x3fe4('0x10')},'data7':{'type':Sequelize[_0x3fe4('0x11')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xa123=['exports','getDataValue','STRING','contactManager','integration','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]'];(function(_0x370a82,_0x1d2de6){var _0x4c4100=function(_0x4c58e1){while(--_0x4c58e1){_0x370a82['push'](_0x370a82['shift']());}};_0x4c4100(++_0x1d2de6);}(_0xa123,0x1c2));var _0x3a12=function(_0x15a05d,_0x5c3a8f){_0x15a05d=_0x15a05d-0x0;var _0x33fe3f=_0xa123[_0x15a05d];return _0x33fe3f;};'use strict';var Sequelize=require('sequelize');module[_0x3a12('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x165f48){return this[_0x3a12('0x1')]('action');}},'action':{'type':Sequelize[_0x3a12('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3a12('0x3'),_0x3a12('0x4'),'motionbar',_0x3a12('0x5'),_0x3a12('0x6'),'browser',_0x3a12('0x7'),_0x3a12('0x8')]],'msg':_0x3a12('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x3a12('0x2')](0x1000),'comment':_0x3a12('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x3a12('0x2')](0x1000),'comments':_0x3a12('0xb')},'data5':{'type':Sequelize[_0x3a12('0x2')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x3a12('0x2')],'comments':_0x3a12('0xc')},'data7':{'type':Sequelize[_0x3a12('0xd')],'comments':_0x3a12('0xe')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index b0fe355..e6c0628 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 _0xdab4=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','limit','offset','count','Content-Range','json','apply','save','update','then','destroy','stack','name','body','Action','find','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4fb167,_0x1b3e51){var _0x2d4b4b=function(_0x3bbe33){while(--_0x3bbe33){_0x4fb167['push'](_0x4fb167['shift']());}};_0x2d4b4b(++_0x1b3e51);}(_0xdab4,0xd4));var _0x4dab=function(_0x511995,_0x5d83a7){_0x511995=_0x511995-0x0;var _0x3f47f3=_0xdab4[_0x511995];return _0x3f47f3;};'use strict';var emlformat=require(_0x4dab('0x0'));var rimraf=require(_0x4dab('0x1'));var zipdir=require(_0x4dab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4dab('0x3'));var moment=require(_0x4dab('0x4'));var BPromise=require(_0x4dab('0x5'));var Mustache=require(_0x4dab('0x6'));var util=require(_0x4dab('0x7'));var path=require(_0x4dab('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4dab('0x9'));var fs=require('fs');var fs_extra=require(_0x4dab('0xa'));var _=require(_0x4dab('0xb'));var squel=require(_0x4dab('0xc'));var crypto=require(_0x4dab('0xd'));var jsforce=require(_0x4dab('0xe'));var deskjs=require(_0x4dab('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4dab('0x10'));var Papa=require(_0x4dab('0x11'));var Redis=require(_0x4dab('0x12'));var authService=require(_0x4dab('0x13'));var qs=require(_0x4dab('0x14'));var as=require(_0x4dab('0x15'));var hardwareService=require(_0x4dab('0x16'));var logger=require(_0x4dab('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4dab('0x18'));var licenseUtil=require(_0x4dab('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37943a,_0x352ddd){_0x352ddd=_0x352ddd||0xcc;return function(_0x520d88){if(_0x520d88){return _0x37943a[_0x4dab('0x1a')](_0x352ddd);}return _0x37943a[_0x4dab('0x1b')](_0x352ddd)[_0x4dab('0x1c')]();};}function respondWithResult(_0x6d90d5,_0x3530f7){_0x3530f7=_0x3530f7||0xc8;return function(_0xa37338){if(_0xa37338){return _0x6d90d5[_0x4dab('0x1b')](_0x3530f7)['json'](_0xa37338);}};}function respondWithFilteredResult(_0x227df9,_0x30fb15){return function(_0x7a5beb){if(_0x7a5beb){var _0x4fa4a2=typeof _0x30fb15['offset']==='undefined'&&typeof _0x30fb15[_0x4dab('0x1d')]==='undefined';var _0x4f1fae=_0x7a5beb['count'];var _0x3322d2=_0x4fa4a2?0x0:_0x30fb15[_0x4dab('0x1e')];var _0x4c760c=_0x4fa4a2?_0x7a5beb[_0x4dab('0x1f')]:_0x30fb15[_0x4dab('0x1e')]+_0x30fb15[_0x4dab('0x1d')];var _0x4cf864;if(_0x4c760c>=_0x4f1fae){_0x4c760c=_0x4f1fae;_0x4cf864=0xc8;}else{_0x4cf864=0xce;}_0x227df9[_0x4dab('0x1b')](_0x4cf864);return _0x227df9['set'](_0x4dab('0x20'),_0x3322d2+'-'+_0x4c760c+'/'+_0x4f1fae)[_0x4dab('0x21')](_0x7a5beb);}return null;};}function patchUpdates(_0x52b885){return function(_0x173cfd){try{jsonpatch[_0x4dab('0x22')](_0x173cfd,_0x52b885,!![]);}catch(_0x1ed8bf){return BPromise['reject'](_0x1ed8bf);}return _0x173cfd[_0x4dab('0x23')]();};}function saveUpdates(_0x27bfce,_0x35c8e9){return function(_0x55f7e8){if(_0x55f7e8){return _0x55f7e8[_0x4dab('0x24')](_0x27bfce)[_0x4dab('0x25')](function(_0x2a8e08){return _0x2a8e08;});}return null;};}function removeEntity(_0x5edc23,_0x23f8be){return function(_0x426202){if(_0x426202){return _0x426202[_0x4dab('0x26')]()[_0x4dab('0x25')](function(){_0x5edc23[_0x4dab('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3911cf,_0x3af25b){return function(_0x58765f){if(!_0x58765f){_0x3911cf[_0x4dab('0x1a')](0x194);}return _0x58765f;};}function handleError(_0x496ae7,_0x31ea7f){_0x31ea7f=_0x31ea7f||0x1f4;return function(_0xb2e5d){logger['error'](_0xb2e5d[_0x4dab('0x27')]);if(_0xb2e5d[_0x4dab('0x28')]){delete _0xb2e5d['name'];}_0x496ae7['status'](_0x31ea7f)['send'](_0xb2e5d);};}exports[_0x4dab('0x24')]=function(_0x5d2f2e,_0x51ca9d){if(_0x5d2f2e[_0x4dab('0x29')]['id']){delete _0x5d2f2e[_0x4dab('0x29')]['id'];}return db[_0x4dab('0x2a')][_0x4dab('0x2b')]({'where':{'id':_0x5d2f2e[_0x4dab('0x2c')]['id']}})['then'](handleEntityNotFound(_0x51ca9d,null))['then'](saveUpdates(_0x5d2f2e[_0x4dab('0x29')],null))['then'](respondWithResult(_0x51ca9d,null))[_0x4dab('0x2d')](handleError(_0x51ca9d,null));};exports[_0x4dab('0x26')]=function(_0x2b5b3a,_0x2d928c){return db['Action'][_0x4dab('0x2b')]({'where':{'id':_0x2b5b3a[_0x4dab('0x2c')]['id']}})[_0x4dab('0x25')](handleEntityNotFound(_0x2d928c,null))[_0x4dab('0x25')](removeEntity(_0x2d928c,null))['catch'](handleError(_0x2d928c,null));}; \ No newline at end of file +var _0x2398=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','find','params','catch','Action','request-promise','moment','bluebird','mustache','util'];(function(_0x459a2d,_0x48d0db){var _0x44a5ba=function(_0x3864ba){while(--_0x3864ba){_0x459a2d['push'](_0x459a2d['shift']());}};_0x44a5ba(++_0x48d0db);}(_0x2398,0x136));var _0x8239=function(_0xe7f722,_0x3aa747){_0xe7f722=_0xe7f722-0x0;var _0x41b750=_0x2398[_0xe7f722];return _0x41b750;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8239('0x0'));var moment=require(_0x8239('0x1'));var BPromise=require(_0x8239('0x2'));var Mustache=require(_0x8239('0x3'));var util=require(_0x8239('0x4'));var path=require(_0x8239('0x5'));var sox=require(_0x8239('0x6'));var csv=require(_0x8239('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8239('0x8'));var _=require(_0x8239('0x9'));var squel=require(_0x8239('0xa'));var crypto=require(_0x8239('0xb'));var jsforce=require(_0x8239('0xc'));var deskjs=require(_0x8239('0xd'));var toCsv=require(_0x8239('0x7'));var querystring=require(_0x8239('0xe'));var Papa=require('papaparse');var Redis=require(_0x8239('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8239('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8239('0x11'))(_0x8239('0x12'));var utils=require(_0x8239('0x13'));var config=require(_0x8239('0x14'));var licenseUtil=require(_0x8239('0x15'));var db=require(_0x8239('0x16'))['db'];function respondWithStatusCode(_0x2b58bc,_0x2ca0c2){_0x2ca0c2=_0x2ca0c2||0xcc;return function(_0x1958b1){if(_0x1958b1){return _0x2b58bc[_0x8239('0x17')](_0x2ca0c2);}return _0x2b58bc[_0x8239('0x18')](_0x2ca0c2)['end']();};}function respondWithResult(_0x92b464,_0x40237f){_0x40237f=_0x40237f||0xc8;return function(_0x3a4cf9){if(_0x3a4cf9){return _0x92b464[_0x8239('0x18')](_0x40237f)['json'](_0x3a4cf9);}};}function respondWithFilteredResult(_0x2f110b,_0x5cd316){return function(_0x7c5f76){if(_0x7c5f76){var _0x461cde=typeof _0x5cd316['offset']===_0x8239('0x19')&&typeof _0x5cd316[_0x8239('0x1a')]===_0x8239('0x19');var _0x3f7a97=_0x7c5f76[_0x8239('0x1b')];var _0xc75a95=_0x461cde?0x0:_0x5cd316[_0x8239('0x1c')];var _0x22a2a7=_0x461cde?_0x7c5f76[_0x8239('0x1b')]:_0x5cd316['offset']+_0x5cd316['limit'];var _0x34bc88;if(_0x22a2a7>=_0x3f7a97){_0x22a2a7=_0x3f7a97;_0x34bc88=0xc8;}else{_0x34bc88=0xce;}_0x2f110b[_0x8239('0x18')](_0x34bc88);return _0x2f110b[_0x8239('0x1d')](_0x8239('0x1e'),_0xc75a95+'-'+_0x22a2a7+'/'+_0x3f7a97)[_0x8239('0x1f')](_0x7c5f76);}return null;};}function patchUpdates(_0x584e1e){return function(_0x594ceb){try{jsonpatch['apply'](_0x594ceb,_0x584e1e,!![]);}catch(_0x22a5dd){return BPromise[_0x8239('0x20')](_0x22a5dd);}return _0x594ceb[_0x8239('0x21')]();};}function saveUpdates(_0x57ec27,_0x228a17){return function(_0x1b2cbd){if(_0x1b2cbd){return _0x1b2cbd[_0x8239('0x22')](_0x57ec27)[_0x8239('0x23')](function(_0x31ffb6){return _0x31ffb6;});}return null;};}function removeEntity(_0x55288c,_0x4d0ade){return function(_0x5210ff){if(_0x5210ff){return _0x5210ff[_0x8239('0x24')]()['then'](function(){_0x55288c['status'](0xcc)[_0x8239('0x25')]();});}};}function handleEntityNotFound(_0x590628,_0x3c1179){return function(_0x4c2aa7){if(!_0x4c2aa7){_0x590628['sendStatus'](0x194);}return _0x4c2aa7;};}function handleError(_0x6a0f7,_0x1da5f8){_0x1da5f8=_0x1da5f8||0x1f4;return function(_0x4ecaf4){logger[_0x8239('0x26')](_0x4ecaf4['stack']);if(_0x4ecaf4[_0x8239('0x27')]){delete _0x4ecaf4[_0x8239('0x27')];}_0x6a0f7[_0x8239('0x18')](_0x1da5f8)[_0x8239('0x28')](_0x4ecaf4);};}exports[_0x8239('0x22')]=function(_0x3aef8c,_0x2776bb){if(_0x3aef8c['body']['id']){delete _0x3aef8c['body']['id'];}return db['Action'][_0x8239('0x29')]({'where':{'id':_0x3aef8c[_0x8239('0x2a')]['id']}})[_0x8239('0x23')](handleEntityNotFound(_0x2776bb,null))[_0x8239('0x23')](saveUpdates(_0x3aef8c['body'],null))['then'](respondWithResult(_0x2776bb,null))[_0x8239('0x2b')](handleError(_0x2776bb,null));};exports[_0x8239('0x24')]=function(_0x202bce,_0x4d3ab0){return db[_0x8239('0x2c')][_0x8239('0x29')]({'where':{'id':_0x202bce[_0x8239('0x2a')]['id']}})[_0x8239('0x23')](handleEntityNotFound(_0x4d3ab0,null))['then'](removeEntity(_0x4d3ab0,null))['catch'](handleError(_0x4d3ab0,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index d6c2b86..51d4d15 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 _0x826b=['moment','request-promise','path','../../config/environment','Action','../../config/logger','api'];(function(_0x545dbb,_0x3f05ff){var _0x1ec731=function(_0x38d28c){while(--_0x38d28c){_0x545dbb['push'](_0x545dbb['shift']());}};_0x1ec731(++_0x3f05ff);}(_0x826b,0x139));var _0xb826=function(_0x3c3069,_0x56c3bc){_0x3c3069=_0x3c3069-0x0;var _0x3e3b0f=_0x826b[_0x3c3069];return _0x3e3b0f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb826('0x0'))(_0xb826('0x1'));var moment=require(_0xb826('0x2'));var BPromise=require('bluebird');var rp=require(_0xb826('0x3'));var fs=require('fs');var path=require(_0xb826('0x4'));var rimraf=require('rimraf');var config=require(_0xb826('0x5'));var attributes=require('./action.attributes');module['exports']=function(_0x12fdec,_0x1a6d93){return _0x12fdec['define'](_0xb826('0x6'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa862=['request-promise','rimraf','./action.attributes','exports','define','Action','lodash','util','api','moment','bluebird'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa862,0x95));var _0x2a86=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xa862[_0x25a42a];return _0x1129b1;};'use strict';var _=require(_0x2a86('0x0'));var util=require(_0x2a86('0x1'));var logger=require('../../config/logger')(_0x2a86('0x2'));var moment=require(_0x2a86('0x3'));var BPromise=require(_0x2a86('0x4'));var rp=require(_0x2a86('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a86('0x6'));var config=require('../../config/environment');var attributes=require(_0x2a86('0x7'));module[_0x2a86('0x8')]=function(_0x3cf4bc,_0x182942){return _0x3cf4bc[_0x2a86('0x9')](_0x2a86('0xa'),attributes,{'tableName':'tools_actions','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 657a157..910822c 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x4ea071,_0x29a80a){var _0x18c5a1=function(_0xb0f20f){while(--_0xb0f20f){_0x4ea071['push'](_0x4ea071['shift']());}};_0x18c5a1(++_0x29a80a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc4aa[_0x50a0c2];return _0x5ebadd;};'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')]('Action,\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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5968a5,_0x1b4179){var _0x10dabc=function(_0x54c04a){while(--_0x54c04a){_0x5968a5['push'](_0x5968a5['shift']());}};_0x10dabc(++_0x1b4179);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x5fc3[_0x3aaf0a];return _0x33e6bc;};'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')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\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']('Action,\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);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 64dde49..ca3e950 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 _0xdfc6=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','put','/:id','isAuthenticated'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xdfc6,0x66));var _0x6dfc=function(_0x355911,_0x163b62){_0x355911=_0x355911-0x0;var _0x2d9d0b=_0xdfc6[_0x355911];return _0x2d9d0b;};'use strict';var multer=require(_0x6dfc('0x0'));var util=require(_0x6dfc('0x1'));var path=require(_0x6dfc('0x2'));var timeout=require(_0x6dfc('0x3'));var express=require('express');var router=express[_0x6dfc('0x4')]();var fs_extra=require(_0x6dfc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6dfc('0x6'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x6dfc('0x7')](_0x6dfc('0x8'),auth[_0x6dfc('0x9')](),controller[_0x6dfc('0xa')]);router[_0x6dfc('0xb')](_0x6dfc('0x8'),auth[_0x6dfc('0x9')](),controller[_0x6dfc('0xc')]);module[_0x6dfc('0xd')]=router; \ No newline at end of file +var _0x1453=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated','delete','destroy','exports'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x1453,0xd0));var _0x3145=function(_0x404715,_0x5b4d86){_0x404715=_0x404715-0x0;var _0x198d48=_0x1453[_0x404715];return _0x198d48;};'use strict';var multer=require(_0x3145('0x0'));var util=require('util');var path=require(_0x3145('0x1'));var timeout=require(_0x3145('0x2'));var express=require('express');var router=express[_0x3145('0x3')]();var fs_extra=require(_0x3145('0x4'));var auth=require(_0x3145('0x5'));var interaction=require(_0x3145('0x6'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x3145('0x7')](_0x3145('0x8'),auth[_0x3145('0x9')](),controller['update']);router[_0x3145('0xa')](_0x3145('0x8'),auth[_0x3145('0x9')](),controller[_0x3145('0xb')]);module[_0x3145('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 89fc679..912e308 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 _0x7da7=['TEXT','sequelize','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7da7,0x10d));var _0x77da=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x7da7[_0x725b8e];return _0x43ac45;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'name':{'type':Sequelize[_0x77da('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x77da('0x2')]},'conditions':{'type':Sequelize[_0x77da('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7217=['sequelize','STRING','TEXT'];(function(_0x58a6e8,_0x4f6603){var _0x35ef3e=function(_0x28e9be){while(--_0x28e9be){_0x58a6e8['push'](_0x58a6e8['shift']());}};_0x35ef3e(++_0x4f6603);}(_0x7217,0x19e));var _0x7721=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7217[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index fbd20d5..04c70ce 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 _0xd3d2=['squel','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','dbH','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','CustomReports','UserProfileResource','stack','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','show','keys','length','find','catch','create','body','get','user','UserProfileSection','userProfileId','error','params','preview','join','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','keyBy','select','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','operator','Please\x20insert\x20at\x20least\x20one\x20field','from','table','metric','output','web','fullPath','%s-%s.%s','randomstring','csv','custom','cdr','endDate','startDate','child_process','../../components/export/','savename','COUNT(*)','QueryTypes','SELECT','runReport','Sequelize','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','ejs','fs-extra','lodash'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0xd3d2,0x96));var _0x2d3d=function(_0x4e15cb,_0x42698e){_0x4e15cb=_0x4e15cb-0x0;var _0x259e49=_0xd3d2[_0x4e15cb];return _0x259e49;};'use strict';var emlformat=require(_0x2d3d('0x0'));var rimraf=require(_0x2d3d('0x1'));var zipdir=require(_0x2d3d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d3d('0x3'));var moment=require('moment');var BPromise=require(_0x2d3d('0x4'));var Mustache=require(_0x2d3d('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2d3d('0x6'));var fs=require('fs');var fs_extra=require(_0x2d3d('0x7'));var _=require(_0x2d3d('0x8'));var squel=require(_0x2d3d('0x9'));var crypto=require('crypto');var jsforce=require(_0x2d3d('0xa'));var deskjs=require(_0x2d3d('0xb'));var toCsv=require(_0x2d3d('0xc'));var querystring=require(_0x2d3d('0xd'));var Papa=require(_0x2d3d('0xe'));var Redis=require(_0x2d3d('0xf'));var authService=require(_0x2d3d('0x10'));var qs=require(_0x2d3d('0x11'));var as=require(_0x2d3d('0x12'));var hardwareService=require(_0x2d3d('0x13'));var logger=require(_0x2d3d('0x14'))(_0x2d3d('0x15'));var utils=require(_0x2d3d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2d3d('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x2d3d('0x18'))[_0x2d3d('0x19')];function respondWithStatusCode(_0x2b8bad,_0x20d2ef){_0x20d2ef=_0x20d2ef||0xcc;return function(_0x522543){if(_0x522543){return _0x2b8bad[_0x2d3d('0x1a')](_0x20d2ef);}return _0x2b8bad['status'](_0x20d2ef)[_0x2d3d('0x1b')]();};}function respondWithResult(_0x2ddb4e,_0x58fee8){_0x58fee8=_0x58fee8||0xc8;return function(_0x449f4a){if(_0x449f4a){return _0x2ddb4e[_0x2d3d('0x1c')](_0x58fee8)[_0x2d3d('0x1d')](_0x449f4a);}};}function respondWithFilteredResult(_0x493b50,_0x741af1){return function(_0x34f6aa){if(_0x34f6aa){var _0x3ebfd9=typeof _0x741af1[_0x2d3d('0x1e')]===_0x2d3d('0x1f')&&typeof _0x741af1[_0x2d3d('0x20')]===_0x2d3d('0x1f');var _0x3918b6=_0x34f6aa[_0x2d3d('0x21')];var _0xcfe9f5=_0x3ebfd9?0x0:_0x741af1[_0x2d3d('0x1e')];var _0x1599b8=_0x3ebfd9?_0x34f6aa[_0x2d3d('0x21')]:_0x741af1[_0x2d3d('0x1e')]+_0x741af1['limit'];var _0x18b7ad;if(_0x1599b8>=_0x3918b6){_0x1599b8=_0x3918b6;_0x18b7ad=0xc8;}else{_0x18b7ad=0xce;}_0x493b50[_0x2d3d('0x1c')](_0x18b7ad);return _0x493b50[_0x2d3d('0x22')]('Content-Range',_0xcfe9f5+'-'+_0x1599b8+'/'+_0x3918b6)[_0x2d3d('0x1d')](_0x34f6aa);}return null;};}function patchUpdates(_0x3ea9b1){return function(_0xd9387d){try{jsonpatch['apply'](_0xd9387d,_0x3ea9b1,!![]);}catch(_0x259006){return BPromise[_0x2d3d('0x23')](_0x259006);}return _0xd9387d[_0x2d3d('0x24')]();};}function saveUpdates(_0x221471,_0x595124){return function(_0x485f36){if(_0x485f36){return _0x485f36[_0x2d3d('0x25')](_0x221471)[_0x2d3d('0x26')](function(_0xb4d89){return _0xb4d89;});}return null;};}function removeEntity(_0x554c0b,_0xe1935e){return function(_0x4e5971){if(_0x4e5971){return _0x4e5971[_0x2d3d('0x27')]()[_0x2d3d('0x26')](function(){var _0x52464d=_0x4e5971['get']({'plain':!![]});var _0x422e38=_0x2d3d('0x28');return db[_0x2d3d('0x29')]['destroy']({'where':{'type':_0x422e38,'resourceId':_0x52464d['id']}})['then'](function(){return _0x4e5971;});})[_0x2d3d('0x26')](function(){_0x554c0b[_0x2d3d('0x1c')](0xcc)[_0x2d3d('0x1b')]();});}};}function handleEntityNotFound(_0x58caa6,_0x39c62c){return function(_0x2882ff){if(!_0x2882ff){_0x58caa6[_0x2d3d('0x1a')](0x194);}return _0x2882ff;};}function handleError(_0x5dd73e,_0x3fc196){_0x3fc196=_0x3fc196||0x1f4;return function(_0x39e192){logger['error'](_0x39e192[_0x2d3d('0x2a')]);if(_0x39e192[_0x2d3d('0x2b')]){delete _0x39e192[_0x2d3d('0x2b')];}_0x5dd73e[_0x2d3d('0x1c')](_0x3fc196)[_0x2d3d('0x2c')](_0x39e192);};}exports[_0x2d3d('0x2d')]=function(_0xb1205e,_0x407c6a){var _0x2217e1={},_0x12ab0c={},_0x46f0f7={'count':0x0,'rows':[]};var _0x24405c=_[_0x2d3d('0x2e')](db['AnalyticCustomReport'][_0x2d3d('0x2f')],function(_0x1ed94b){return{'name':_0x1ed94b['fieldName'],'type':_0x1ed94b[_0x2d3d('0x30')]['key']};});_0x12ab0c[_0x2d3d('0x31')]=_['map'](_0x24405c,_0x2d3d('0x2b'));_0x12ab0c[_0x2d3d('0x32')]=_['keys'](_0xb1205e[_0x2d3d('0x32')]);_0x12ab0c[_0x2d3d('0x33')]=_[_0x2d3d('0x34')](_0x12ab0c[_0x2d3d('0x31')],_0x12ab0c[_0x2d3d('0x32')]);_0x2217e1[_0x2d3d('0x35')]=_['intersection'](_0x12ab0c[_0x2d3d('0x31')],qs[_0x2d3d('0x36')](_0xb1205e[_0x2d3d('0x32')][_0x2d3d('0x36')]));_0x2217e1[_0x2d3d('0x35')]=_0x2217e1[_0x2d3d('0x35')]['length']?_0x2217e1[_0x2d3d('0x35')]:_0x12ab0c['model'];if(!_0xb1205e['query'][_0x2d3d('0x37')](_0x2d3d('0x38'))){_0x2217e1['limit']=qs[_0x2d3d('0x20')](_0xb1205e[_0x2d3d('0x32')][_0x2d3d('0x20')]);_0x2217e1[_0x2d3d('0x1e')]=qs[_0x2d3d('0x1e')](_0xb1205e[_0x2d3d('0x32')][_0x2d3d('0x1e')]);}_0x2217e1[_0x2d3d('0x39')]=qs[_0x2d3d('0x3a')](_0xb1205e[_0x2d3d('0x32')][_0x2d3d('0x3a')]);_0x2217e1[_0x2d3d('0x3b')]=qs['filters'](_[_0x2d3d('0x3c')](_0xb1205e[_0x2d3d('0x32')],_0x12ab0c[_0x2d3d('0x33')]),_0x24405c);if(_0xb1205e[_0x2d3d('0x32')][_0x2d3d('0x3d')]){_0x2217e1[_0x2d3d('0x3b')]=_[_0x2d3d('0x3e')](_0x2217e1['where'],{'$or':_['map'](_0x24405c,function(_0x329801){if(_0x329801[_0x2d3d('0x30')]!==_0x2d3d('0x3f')){var _0x429de6={};_0x429de6[_0x329801[_0x2d3d('0x2b')]]={'$like':'%'+_0xb1205e[_0x2d3d('0x32')][_0x2d3d('0x3d')]+'%'};return _0x429de6;}})});}_0x2217e1=_[_0x2d3d('0x3e')]({},_0x2217e1,_0xb1205e[_0x2d3d('0x40')]);var _0x99466e={'where':_0x2217e1[_0x2d3d('0x3b')]};return db[_0x2d3d('0x41')]['count'](_0x99466e)[_0x2d3d('0x26')](function(_0x471b5c){_0x46f0f7[_0x2d3d('0x21')]=_0x471b5c;if(_0xb1205e[_0x2d3d('0x32')][_0x2d3d('0x42')]){_0x2217e1[_0x2d3d('0x43')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x2d3d('0x44')](_0x2217e1);})[_0x2d3d('0x26')](function(_0x2b689a){_0x46f0f7['rows']=_0x2b689a;return _0x46f0f7;})['then'](respondWithFilteredResult(_0x407c6a,_0x2217e1))['catch'](handleError(_0x407c6a,null));};exports[_0x2d3d('0x45')]=function(_0x3d9a69,_0x442b25){var _0x266473={'raw':![],'where':{'id':_0x3d9a69['params']['id']}},_0x4ac194={};_0x4ac194[_0x2d3d('0x31')]=_['keys'](db[_0x2d3d('0x41')][_0x2d3d('0x2f')]);_0x4ac194[_0x2d3d('0x32')]=_[_0x2d3d('0x46')](_0x3d9a69[_0x2d3d('0x32')]);_0x4ac194[_0x2d3d('0x33')]=_[_0x2d3d('0x34')](_0x4ac194[_0x2d3d('0x31')],_0x4ac194['query']);_0x266473[_0x2d3d('0x35')]=_[_0x2d3d('0x34')](_0x4ac194[_0x2d3d('0x31')],qs[_0x2d3d('0x36')](_0x3d9a69[_0x2d3d('0x32')]['fields']));_0x266473[_0x2d3d('0x35')]=_0x266473[_0x2d3d('0x35')][_0x2d3d('0x47')]?_0x266473[_0x2d3d('0x35')]:_0x4ac194[_0x2d3d('0x31')];if(_0x3d9a69[_0x2d3d('0x32')][_0x2d3d('0x42')]){_0x266473[_0x2d3d('0x43')]=[{'all':!![]}];}_0x266473=_['merge']({},_0x266473,_0x3d9a69['options']);return db['AnalyticCustomReport'][_0x2d3d('0x48')](_0x266473)[_0x2d3d('0x26')](handleEntityNotFound(_0x442b25,null))[_0x2d3d('0x26')](respondWithResult(_0x442b25,null))[_0x2d3d('0x49')](handleError(_0x442b25,null));};exports[_0x2d3d('0x4a')]=function(_0x180148,_0x4f1395){return db[_0x2d3d('0x41')][_0x2d3d('0x4a')](_0x180148[_0x2d3d('0x4b')],{})['then'](function(_0x3a66eb){var _0x2271f0=_0x180148['user'][_0x2d3d('0x4c')]({'plain':!![]});if(!_0x2271f0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2271f0['role']===_0x2d3d('0x4d')){var _0x173227=_0x3a66eb[_0x2d3d('0x4c')]({'plain':!![]});var _0x391fda='Reports';return db[_0x2d3d('0x4e')][_0x2d3d('0x48')]({'where':{'name':_0x391fda,'userProfileId':_0x2271f0[_0x2d3d('0x4f')]},'raw':!![]})[_0x2d3d('0x26')](function(_0x3a2b82){if(_0x3a2b82&&_0x3a2b82['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x173227[_0x2d3d('0x2b')],'resourceId':_0x173227['id'],'type':_0x2d3d('0x28'),'sectionId':_0x3a2b82['id']},{})['then'](function(){return _0x3a66eb;});}else{return _0x3a66eb;}})['catch'](function(_0x4c8c90){logger[_0x2d3d('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c8c90);throw _0x4c8c90;});}return _0x3a66eb;})[_0x2d3d('0x26')](respondWithResult(_0x4f1395,0xc9))[_0x2d3d('0x49')](handleError(_0x4f1395,null));};exports['update']=function(_0x48b150,_0x39bea1){if(_0x48b150[_0x2d3d('0x4b')]['id']){delete _0x48b150['body']['id'];}return db[_0x2d3d('0x41')][_0x2d3d('0x48')]({'where':{'id':_0x48b150['params']['id']}})[_0x2d3d('0x26')](handleEntityNotFound(_0x39bea1,null))['then'](saveUpdates(_0x48b150[_0x2d3d('0x4b')],null))[_0x2d3d('0x26')](respondWithResult(_0x39bea1,null))[_0x2d3d('0x49')](handleError(_0x39bea1,null));};exports[_0x2d3d('0x27')]=function(_0x4d9760,_0xa81bfe){return db[_0x2d3d('0x41')][_0x2d3d('0x48')]({'where':{'id':_0x4d9760[_0x2d3d('0x51')]['id']}})[_0x2d3d('0x26')](handleEntityNotFound(_0xa81bfe,null))['then'](removeEntity(_0xa81bfe,null))[_0x2d3d('0x49')](handleError(_0xa81bfe,null));};exports[_0x2d3d('0x52')]=function(_0x55ffe4,_0x19a2f9){var _0x3b50de=0xa;var _0x1e1ed6=[_0x2d3d('0x53'),_0x2d3d('0x54'),_0x2d3d('0x55'),_0x2d3d('0x56')];var _0x1c73fe={'SUM':'SUM(%s)','COUNT':_0x2d3d('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2d3d('0x58'),'MIN':_0x2d3d('0x59'),'AVG':_0x2d3d('0x5a'),'GROUP_CONCAT':_0x2d3d('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2d3d('0x5c')};var _0x3da661={'SEC_TO_TIME':_0x2d3d('0x5d'),'DATE':_0x2d3d('0x5e'),'HOUR':_0x2d3d('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x443bad=function(_0x53e970){return!_[_0x2d3d('0x60')]([_0x2d3d('0x61'),'IS\x20NOT\x20NULL',_0x2d3d('0x62'),_0x2d3d('0x63')],_0x53e970);};var _0x34de62=function(_0x4b462e){if(!_0x4b462e||!_0x4b462e['rules'][_0x2d3d('0x47')]){return'';}for(var _0x2d7256='(',_0x19c679=0x0;_0x19c679<_0x4b462e['rules'][_0x2d3d('0x47')];_0x19c679+=0x1){_0x19c679>0x0&&(_0x2d7256+='\x20'+_0x4b462e['operator']+'\x20');_0x2d7256+=_0x4b462e['rules'][_0x19c679]['group']?_0x34de62(_0x4b462e[_0x2d3d('0x64')][_0x19c679][_0x2d3d('0x65')]):_0x4b462e[_0x2d3d('0x64')][_0x19c679][_0x2d3d('0x66')]+'\x20'+_0x4b462e[_0x2d3d('0x64')][_0x19c679][_0x2d3d('0x67')]+(_0x443bad(_0x4b462e[_0x2d3d('0x64')][_0x19c679][_0x2d3d('0x67')])?'\x20'+_0x4b462e[_0x2d3d('0x64')][_0x19c679][_0x2d3d('0x68')]:'');}return _0x2d7256+')';};var _0x592b22={'where':{'id':_0x55ffe4['params']['id']}},_0x4a2319,_0x116c4b,_0x5be8ae,_0x57268d,_0x1b19d6;_0x592b22=_[_0x2d3d('0x3e')]({},_0x592b22,_0x55ffe4[_0x2d3d('0x40')]);return db['AnalyticCustomReport'][_0x2d3d('0x48')](_0x592b22)['then'](function(_0x182a34){if(_0x182a34){_0x4a2319=_0x182a34;return _0x182a34[_0x2d3d('0x69')]();}return null;})[_0x2d3d('0x26')](function(_0x12ed67){if(_0x12ed67){if(!_0x12ed67[_0x2d3d('0x47')]){throw new db['Sequelize'][(_0x2d3d('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x116c4b=_0x12ed67;return db[_0x2d3d('0x6b')]['findAll']({'raw':!![]});}return null;})[_0x2d3d('0x26')](function(_0x4abe76){if(_0x4abe76){_0x5be8ae=_[_0x2d3d('0x6c')](_0x4abe76,'id');var _0x321e7f;var _0x46a175=squel[_0x2d3d('0x6d')]();_0x46a175['from'](_0x4a2319['table']);for(var _0x1620b5=0x0;_0x1620b5<_0x116c4b[_0x2d3d('0x47')];_0x1620b5+=0x1){_0x321e7f=_0x116c4b[_0x1620b5][_0x2d3d('0x6e')]?_0x5be8ae[_0x116c4b[_0x1620b5][_0x2d3d('0x6e')]]['metric']:_0x116c4b[_0x1620b5]['field'];_0x321e7f=_0x116c4b[_0x1620b5][_0x2d3d('0x6f')]?_[_0x2d3d('0x70')](_0x1c73fe[_0x116c4b[_0x1620b5][_0x2d3d('0x6f')]],'%s',_0x321e7f):_0x321e7f;_0x321e7f=_0x116c4b[_0x1620b5][_0x2d3d('0x71')]?_[_0x2d3d('0x70')](_0x3da661[_0x116c4b[_0x1620b5][_0x2d3d('0x71')]],'%s',_0x321e7f):_0x321e7f;if(_0x116c4b[_0x1620b5][_0x2d3d('0x72')]){_0x46a175['group'](_0x321e7f);}_0x116c4b[_0x1620b5][_0x2d3d('0x73')]&&_0x46a175[_0x2d3d('0x39')](_0x321e7f,_0x116c4b[_0x1620b5][_0x2d3d('0x73')]===_0x2d3d('0x74')?![]:!![]);_0x46a175[_0x2d3d('0x66')](_0x321e7f,_0x116c4b[_0x1620b5][_0x2d3d('0x75')]||_0x321e7f);}if(_0x4a2319[_0x2d3d('0x76')]){_0x4a2319[_0x2d3d('0x76')]=JSON[_0x2d3d('0x77')](_0x4a2319[_0x2d3d('0x76')]);for(var _0x1ee869=0x0;_0x1ee869<_0x4a2319['joins']['length'];_0x1ee869+=0x1){if(_0x4a2319['joins'][_0x1ee869][_0x2d3d('0x30')]&&_[_0x2d3d('0x60')](_0x1e1ed6,_0x4a2319['joins'][_0x1ee869]['type'])&&_0x4a2319[_0x2d3d('0x76')][_0x1ee869][_0x2d3d('0x78')]&&_0x4a2319['joins'][_0x1ee869][_0x2d3d('0x79')]&&_0x4a2319[_0x2d3d('0x76')][_0x1ee869][_0x2d3d('0x7a')]){_0x46a175[_0x4a2319[_0x2d3d('0x76')][_0x1ee869]['type']](_0x4a2319[_0x2d3d('0x76')][_0x1ee869][_0x2d3d('0x79')],null,util[_0x2d3d('0x71')](_0x2d3d('0x7b'),_0x4a2319['table'],_0x4a2319[_0x2d3d('0x76')][_0x1ee869][_0x2d3d('0x78')],_0x4a2319[_0x2d3d('0x76')][_0x1ee869][_0x2d3d('0x79')],_0x4a2319[_0x2d3d('0x76')][_0x1ee869][_0x2d3d('0x7a')]));}}}if(_0x4a2319[_0x2d3d('0x7c')]){_0x4a2319[_0x2d3d('0x7c')]=JSON[_0x2d3d('0x77')](_0x4a2319[_0x2d3d('0x7c')]);_0x46a175[_0x2d3d('0x3b')](_0x34de62(_0x4a2319[_0x2d3d('0x7c')][_0x2d3d('0x65')]));}_0x1b19d6=_0x46a175[_0x2d3d('0x7d')]();_0x46a175[_0x2d3d('0x20')](_0x3b50de);_0x46a175[_0x2d3d('0x1e')](0x0);logger[_0x2d3d('0x7e')](_0x2d3d('0x7f'),_0x46a175[_0x2d3d('0x80')]());return dbH[_0x2d3d('0x81')][_0x2d3d('0x32')](_0x46a175['toString'](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})[_0x2d3d('0x26')](respondWithResult(_0x19a2f9,null))[_0x2d3d('0x49')](handleError(_0x19a2f9,null));};function runReport(_0x5b1f02,_0x1c13a7,_0x2a460c){var _0x569ea9=_0x1c13a7['name'];var _0x21697e=0xa;var _0x1868e2=[_0x2d3d('0x53'),'left_join',_0x2d3d('0x55'),'cross_join'];var _0x4d365d={'SUM':_0x2d3d('0x82'),'COUNT':_0x2d3d('0x57'),'COUNT DISTINCT':_0x2d3d('0x83'),'MAX':'MAX(%s)','MIN':_0x2d3d('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2d3d('0x5b'),'GROUP_CONCAT ASC':_0x2d3d('0x84'),'GROUP_CONCAT DESC':_0x2d3d('0x5c')};var _0x252fba={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2d3d('0x5e'),'HOUR':_0x2d3d('0x5f'),'ROUND':_0x2d3d('0x85'),'UNIX_TIMESTAMP':_0x2d3d('0x86')};var _0x583e58=function(_0x4be4d4){return!_[_0x2d3d('0x60')]([_0x2d3d('0x61'),_0x2d3d('0x87'),'IS\x20EMPTY',_0x2d3d('0x63')],_0x4be4d4);};var _0x5c2a3d=function(_0x440514){if(!_0x440514||!_0x440514[_0x2d3d('0x64')][_0x2d3d('0x47')]){return'';}for(var _0x3f4ce2='(',_0x53902b=0x0;_0x53902b<_0x440514[_0x2d3d('0x64')]['length'];_0x53902b+=0x1){_0x53902b>0x0&&(_0x3f4ce2+='\x20'+_0x440514[_0x2d3d('0x88')]+'\x20');_0x3f4ce2+=_0x440514[_0x2d3d('0x64')][_0x53902b]['group']?_0x5c2a3d(_0x440514[_0x2d3d('0x64')][_0x53902b][_0x2d3d('0x65')]):_0x440514[_0x2d3d('0x64')][_0x53902b][_0x2d3d('0x66')]+'\x20'+_0x440514['rules'][_0x53902b][_0x2d3d('0x67')]+(_0x583e58(_0x440514[_0x2d3d('0x64')][_0x53902b][_0x2d3d('0x67')])?'\x20'+_0x440514['rules'][_0x53902b]['value']:'');}return _0x3f4ce2+')';};var _0x2a1daf={'where':{'id':_0x5b1f02['id']}},_0x5ec638,_0x3a52f5,_0xc87738,_0x3d3c05,_0x44c89f;_0x2a1daf=_[_0x2d3d('0x3e')]({},_0x2a1daf,_0x2a460c);return db[_0x2d3d('0x41')][_0x2d3d('0x48')](_0x2a1daf)[_0x2d3d('0x26')](function(_0x47cc52){if(_0x47cc52){_0x5ec638=_0x47cc52;return _0x47cc52['getFields']();}return null;})[_0x2d3d('0x26')](function(_0x1cd47f){if(_0x1cd47f){if(!_0x1cd47f[_0x2d3d('0x47')]){throw new db['Sequelize']['ValidationErrorItem'](_0x2d3d('0x89'),0x193);}_0x3a52f5=_0x1cd47f;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x302dfa){if(_0x302dfa){_0xc87738=_[_0x2d3d('0x6c')](_0x302dfa,'id');var _0x4fe206;var _0x46ff71=squel[_0x2d3d('0x6d')]();_0x46ff71[_0x2d3d('0x8a')](_0x5ec638[_0x2d3d('0x8b')]);for(var _0x52d008=0x0;_0x52d008<_0x3a52f5['length'];_0x52d008+=0x1){_0x4fe206=_0x3a52f5[_0x52d008][_0x2d3d('0x6e')]?_0xc87738[_0x3a52f5[_0x52d008][_0x2d3d('0x6e')]][_0x2d3d('0x8c')]:_0x3a52f5[_0x52d008][_0x2d3d('0x66')];_0x4fe206=_0x3a52f5[_0x52d008][_0x2d3d('0x6f')]?_['replace'](_0x4d365d[_0x3a52f5[_0x52d008][_0x2d3d('0x6f')]],'%s',_0x4fe206):_0x4fe206;_0x4fe206=_0x3a52f5[_0x52d008][_0x2d3d('0x71')]?_[_0x2d3d('0x70')](_0x252fba[_0x3a52f5[_0x52d008][_0x2d3d('0x71')]],'%s',_0x4fe206):_0x4fe206;if(_0x3a52f5[_0x52d008][_0x2d3d('0x72')]){_0x46ff71['group'](_0x4fe206);}_0x3a52f5[_0x52d008][_0x2d3d('0x73')]&&_0x46ff71[_0x2d3d('0x39')](_0x4fe206,_0x3a52f5[_0x52d008]['orderBy']===_0x2d3d('0x74')?![]:!![]);_0x46ff71[_0x2d3d('0x66')](_0x4fe206,_0x3a52f5[_0x52d008]['alias']||_0x4fe206);}if(_0x5ec638[_0x2d3d('0x76')]){_0x5ec638['joins']=JSON[_0x2d3d('0x77')](_0x5ec638[_0x2d3d('0x76')]);for(var _0x2ff96f=0x0;_0x2ff96f<_0x5ec638[_0x2d3d('0x76')][_0x2d3d('0x47')];_0x2ff96f+=0x1){if(_0x5ec638['joins'][_0x2ff96f][_0x2d3d('0x30')]&&_[_0x2d3d('0x60')](_0x1868e2,_0x5ec638[_0x2d3d('0x76')][_0x2ff96f][_0x2d3d('0x30')])&&_0x5ec638[_0x2d3d('0x76')][_0x2ff96f][_0x2d3d('0x78')]&&_0x5ec638[_0x2d3d('0x76')][_0x2ff96f][_0x2d3d('0x79')]&&_0x5ec638[_0x2d3d('0x76')][_0x2ff96f]['foreignKey']){_0x46ff71[_0x5ec638['joins'][_0x2ff96f]['type']](_0x5ec638[_0x2d3d('0x76')][_0x2ff96f][_0x2d3d('0x79')],null,util[_0x2d3d('0x71')](_0x2d3d('0x7b'),_0x5ec638[_0x2d3d('0x8b')],_0x5ec638['joins'][_0x2ff96f][_0x2d3d('0x78')],_0x5ec638[_0x2d3d('0x76')][_0x2ff96f]['foreignTable'],_0x5ec638['joins'][_0x2ff96f][_0x2d3d('0x7a')]));}}}if(_0x5ec638[_0x2d3d('0x7c')]){_0x5ec638[_0x2d3d('0x7c')]=JSON[_0x2d3d('0x77')](_0x5ec638[_0x2d3d('0x7c')]);_0x46ff71['where'](_0x5c2a3d(_0x5ec638[_0x2d3d('0x7c')][_0x2d3d('0x65')]));}_0x44c89f=_0x46ff71[_0x2d3d('0x7d')]();_0x46ff71['limit'](_0x21697e);_0x46ff71[_0x2d3d('0x1e')](0x0);return;}})['then'](function(){if(_0x1c13a7[_0x2d3d('0x8d')]===_0x2d3d('0x8e')){return null;}var _0x2e0d08=_[_0x2d3d('0x3e')](_0x1c13a7,{'name':_0x1c13a7[_0x2d3d('0x8f')]||_0x1c13a7['name']||_0x5ec638[_0x2d3d('0x2b')],'basename':_0x569ea9,'savename':util[_0x2d3d('0x71')](_0x2d3d('0x90'),_0x1c13a7[_0x2d3d('0x2b')]||_0x5ec638[_0x2d3d('0x2b')],require(_0x2d3d('0x91'))['generate'](0x4),_0x1c13a7[_0x2d3d('0x8d')]||_0x2d3d('0x92')),'reportId':_0x5ec638['id'],'reportType':_0x2d3d('0x93')});return db['AnalyticExtractedReport'][_0x2d3d('0x4a')](_0x2e0d08,{'raw':!![]});})[_0x2d3d('0x26')](function(_0xe966d){if(_0x5ec638['table']===_0x2d3d('0x94')){_0x44c89f[_0x2d3d('0x3b')](_0x5ec638['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1c13a7['startDate'],_0x1c13a7[_0x2d3d('0x95')]);}else{_0x44c89f[_0x2d3d('0x3b')](_0x5ec638[_0x2d3d('0x8b')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1c13a7[_0x2d3d('0x96')],_0x1c13a7[_0x2d3d('0x95')]);}if(_0xe966d){logger['info']('Run\x20Query:',_0x44c89f[_0x2d3d('0x80')]());require(_0x2d3d('0x97'))['fork'](path[_0x2d3d('0x53')](__dirname,_0x2d3d('0x98'),_0xe966d['output']),[_0xe966d['id'],_0x44c89f[_0x2d3d('0x80')](),path[_0x2d3d('0x53')](__dirname,'../../files/reports',_0xe966d[_0x2d3d('0x99')]),_0x569ea9]);return _0xe966d;}else{var _0x4bbe8a=squel[_0x2d3d('0x6d')]();_0x4bbe8a[_0x2d3d('0x8a')]('('+_0x44c89f['toString']()+')','countTable');_0x4bbe8a[_0x2d3d('0x66')](_0x2d3d('0x9a'),_0x2d3d('0x21'));_0x44c89f[_0x2d3d('0x20')](_0x1c13a7['limit']||_0x21697e);_0x44c89f[_0x2d3d('0x1e')](_0x1c13a7[_0x2d3d('0x1e')]||0x0);return dbH[_0x2d3d('0x81')][_0x2d3d('0x32')](_0x4bbe8a[_0x2d3d('0x80')](),{'type':dbH['sequelize'][_0x2d3d('0x9b')][_0x2d3d('0x9c')]})['then'](function(_0x41a399){if(!_0x41a399[_0x2d3d('0x47')]){_0x3d3c05=0x0;}else{_0x3d3c05=_0x41a399[0x0]['count']||0x0;}return dbH[_0x2d3d('0x81')][_0x2d3d('0x32')](_0x44c89f[_0x2d3d('0x80')](),{'type':dbH[_0x2d3d('0x81')][_0x2d3d('0x9b')]['SELECT']});})['then'](function(_0x4f7965){return{'rows':_0x4f7965||[],'count':_0x3d3c05};});}});}exports['run']=function(_0x8660f0,_0x2e8078){return runReport(_0x8660f0['params'],_0x8660f0['query'],_0x8660f0[_0x2d3d('0x40')])['then'](respondWithResult(_0x2e8078,null))['catch'](handleError(_0x2e8078,null));};exports[_0x2d3d('0x9d')]=runReport;exports[_0x2d3d('0x32')]=function(_0x5cfeb6,_0x31fd56){var _0x2b1fdc=0xa;var _0x124563=[_0x2d3d('0x53'),'left_join',_0x2d3d('0x55'),_0x2d3d('0x56')];var _0x2a3e4b={'SUM':_0x2d3d('0x82'),'COUNT':_0x2d3d('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2d3d('0x58'),'MIN':'MIN(%s)','AVG':_0x2d3d('0x5a'),'GROUP_CONCAT':_0x2d3d('0x5b'),'GROUP_CONCAT ASC':_0x2d3d('0x84'),'GROUP_CONCAT DESC':_0x2d3d('0x5c')};var _0x2b7e12={'SEC_TO_TIME':_0x2d3d('0x5d'),'DATE':_0x2d3d('0x5e'),'HOUR':_0x2d3d('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4019c1=function(_0x244fc5){return!_['includes']([_0x2d3d('0x61'),_0x2d3d('0x87'),'IS\x20EMPTY',_0x2d3d('0x63')],_0x244fc5);};var _0x599093=function(_0x2d5236){if(!_0x2d5236||!_0x2d5236[_0x2d3d('0x64')]['length']){return'';}for(var _0x556378='(',_0x4b59d0=0x0;_0x4b59d0<_0x2d5236['rules'][_0x2d3d('0x47')];_0x4b59d0+=0x1){_0x4b59d0>0x0&&(_0x556378+='\x20'+_0x2d5236['operator']+'\x20');_0x556378+=_0x2d5236['rules'][_0x4b59d0][_0x2d3d('0x65')]?_0x599093(_0x2d5236['rules'][_0x4b59d0]['group']):_0x2d5236[_0x2d3d('0x64')][_0x4b59d0][_0x2d3d('0x66')]+'\x20'+_0x2d5236[_0x2d3d('0x64')][_0x4b59d0][_0x2d3d('0x67')]+(_0x4019c1(_0x2d5236[_0x2d3d('0x64')][_0x4b59d0][_0x2d3d('0x67')])?'\x20'+_0x2d5236['rules'][_0x4b59d0]['value']:'');}return _0x556378+')';};var _0x4ca924={'where':{'id':_0x5cfeb6[_0x2d3d('0x51')]['id']}},_0x108646,_0x2497f4,_0x16be3f,_0x3d7853,_0x3bab4b;_0x4ca924=_[_0x2d3d('0x3e')]({},_0x4ca924,_0x5cfeb6[_0x2d3d('0x40')]);return db[_0x2d3d('0x41')]['find'](_0x4ca924)[_0x2d3d('0x26')](function(_0x3bb903){if(_0x3bb903){_0x108646=_0x3bb903;return _0x3bb903[_0x2d3d('0x69')]();}return null;})[_0x2d3d('0x26')](function(_0x2bb560){if(_0x2bb560){if(!_0x2bb560[_0x2d3d('0x47')]){throw new db[(_0x2d3d('0x9e'))][(_0x2d3d('0x6a'))](_0x2d3d('0x89'),0x193);}_0x2497f4=_0x2bb560;return db[_0x2d3d('0x6b')][_0x2d3d('0x44')]({'raw':!![]});}return null;})[_0x2d3d('0x26')](function(_0x123d80){if(_0x123d80){_0x16be3f=_[_0x2d3d('0x6c')](_0x123d80,'id');var _0x409073;var _0x5686f0=squel[_0x2d3d('0x6d')]();_0x5686f0['from'](_0x108646['table']);for(var _0x54d064=0x0;_0x54d064<_0x2497f4[_0x2d3d('0x47')];_0x54d064+=0x1){_0x409073=_0x2497f4[_0x54d064]['MetricId']?_0x16be3f[_0x2497f4[_0x54d064][_0x2d3d('0x6e')]][_0x2d3d('0x8c')]:_0x2497f4[_0x54d064][_0x2d3d('0x66')];_0x409073=_0x2497f4[_0x54d064][_0x2d3d('0x6f')]?_['replace'](_0x2a3e4b[_0x2497f4[_0x54d064][_0x2d3d('0x6f')]],'%s',_0x409073):_0x409073;_0x409073=_0x2497f4[_0x54d064][_0x2d3d('0x71')]?_['replace'](_0x2b7e12[_0x2497f4[_0x54d064]['format']],'%s',_0x409073):_0x409073;if(_0x2497f4[_0x54d064]['groupBy']){_0x5686f0[_0x2d3d('0x65')](_0x409073);}_0x2497f4[_0x54d064][_0x2d3d('0x73')]&&_0x5686f0[_0x2d3d('0x39')](_0x409073,_0x2497f4[_0x54d064][_0x2d3d('0x73')]==='DESC'?![]:!![]);_0x5686f0[_0x2d3d('0x66')](_0x409073,_0x2497f4[_0x54d064][_0x2d3d('0x75')]||_0x409073);}if(_0x108646[_0x2d3d('0x76')]){_0x108646['joins']=JSON['parse'](_0x108646[_0x2d3d('0x76')]);for(var _0x20dfb2=0x0;_0x20dfb2<_0x108646[_0x2d3d('0x76')][_0x2d3d('0x47')];_0x20dfb2+=0x1){if(_0x108646[_0x2d3d('0x76')][_0x20dfb2][_0x2d3d('0x30')]&&_[_0x2d3d('0x60')](_0x124563,_0x108646[_0x2d3d('0x76')][_0x20dfb2][_0x2d3d('0x30')])&&_0x108646[_0x2d3d('0x76')][_0x20dfb2][_0x2d3d('0x78')]&&_0x108646['joins'][_0x20dfb2][_0x2d3d('0x79')]&&_0x108646[_0x2d3d('0x76')][_0x20dfb2][_0x2d3d('0x7a')]){_0x5686f0[_0x108646[_0x2d3d('0x76')][_0x20dfb2][_0x2d3d('0x30')]](_0x108646['joins'][_0x20dfb2][_0x2d3d('0x79')],null,util[_0x2d3d('0x71')](_0x2d3d('0x7b'),_0x108646[_0x2d3d('0x8b')],_0x108646[_0x2d3d('0x76')][_0x20dfb2][_0x2d3d('0x78')],_0x108646[_0x2d3d('0x76')][_0x20dfb2][_0x2d3d('0x79')],_0x108646[_0x2d3d('0x76')][_0x20dfb2][_0x2d3d('0x7a')]));}}}if(_0x108646[_0x2d3d('0x7c')]){_0x108646[_0x2d3d('0x7c')]=JSON[_0x2d3d('0x77')](_0x108646['conditions']);_0x5686f0[_0x2d3d('0x3b')](_0x599093(_0x108646[_0x2d3d('0x7c')][_0x2d3d('0x65')]));}_0x3bab4b=_0x5686f0['clone']();_0x5686f0['limit'](_0x2b1fdc);_0x5686f0['offset'](0x0);logger[_0x2d3d('0x7e')](_0x2d3d('0x7f'),_0x5686f0[_0x2d3d('0x80')]());return dbH[_0x2d3d('0x81')][_0x2d3d('0x32')](_0x5686f0[_0x2d3d('0x80')](),{'type':dbH[_0x2d3d('0x81')][_0x2d3d('0x9b')]['SELECT']});}})[_0x2d3d('0x26')](function(){return{'sql':_0x3bab4b[_0x2d3d('0x80')]()};})[_0x2d3d('0x26')](respondWithResult(_0x31fd56,null))[_0x2d3d('0x49')](handleError(_0x31fd56,null));}; \ No newline at end of file +var _0x5244=['options','includeAll','include','rows','catch','show','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','body','params','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%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)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','findAll','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MAX(%s)','AVG(%s)','value','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','fork','../../components/export/','savename','countTable','COUNT(*)','run','ROUND(%s)','IS\x20EMPTY','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','error','stack','name','send','map','AnalyticCustomReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x58256e,_0x48f062){var _0xc9e57b=function(_0x32fb7b){while(--_0x32fb7b){_0x58256e['push'](_0x58256e['shift']());}};_0xc9e57b(++_0x48f062);}(_0x5244,0x1a2));var _0x4524=function(_0x2de602,_0x2157a8){_0x2de602=_0x2de602-0x0;var _0x48514a=_0x5244[_0x2de602];return _0x48514a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4524('0x0'));var zipdir=require(_0x4524('0x1'));var jsonpatch=require(_0x4524('0x2'));var rp=require('request-promise');var moment=require(_0x4524('0x3'));var BPromise=require(_0x4524('0x4'));var Mustache=require(_0x4524('0x5'));var util=require(_0x4524('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4524('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4524('0x8'));var _=require(_0x4524('0x9'));var squel=require(_0x4524('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4524('0x7'));var querystring=require(_0x4524('0xb'));var Papa=require(_0x4524('0xc'));var Redis=require(_0x4524('0xd'));var authService=require(_0x4524('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4524('0xf'));var hardwareService=require(_0x4524('0x10'));var logger=require(_0x4524('0x11'))(_0x4524('0x12'));var utils=require(_0x4524('0x13'));var config=require(_0x4524('0x14'));var licenseUtil=require(_0x4524('0x15'));var db=require(_0x4524('0x16'))['db'];var dbH=require('../../mysqldb')[_0x4524('0x17')];function respondWithStatusCode(_0x5220c6,_0x20ed19){_0x20ed19=_0x20ed19||0xcc;return function(_0x15a6dc){if(_0x15a6dc){return _0x5220c6[_0x4524('0x18')](_0x20ed19);}return _0x5220c6[_0x4524('0x19')](_0x20ed19)[_0x4524('0x1a')]();};}function respondWithResult(_0x1d75a7,_0x207c8f){_0x207c8f=_0x207c8f||0xc8;return function(_0x1e0336){if(_0x1e0336){return _0x1d75a7[_0x4524('0x19')](_0x207c8f)[_0x4524('0x1b')](_0x1e0336);}};}function respondWithFilteredResult(_0x327686,_0x26418b){return function(_0x484921){if(_0x484921){var _0x19debe=typeof _0x26418b['offset']===_0x4524('0x1c')&&typeof _0x26418b['limit']===_0x4524('0x1c');var _0xd135dc=_0x484921[_0x4524('0x1d')];var _0x4b7fed=_0x19debe?0x0:_0x26418b['offset'];var _0x748feb=_0x19debe?_0x484921[_0x4524('0x1d')]:_0x26418b[_0x4524('0x1e')]+_0x26418b[_0x4524('0x1f')];var _0xeac76b;if(_0x748feb>=_0xd135dc){_0x748feb=_0xd135dc;_0xeac76b=0xc8;}else{_0xeac76b=0xce;}_0x327686[_0x4524('0x19')](_0xeac76b);return _0x327686['set'](_0x4524('0x20'),_0x4b7fed+'-'+_0x748feb+'/'+_0xd135dc)[_0x4524('0x1b')](_0x484921);}return null;};}function patchUpdates(_0x3450e5){return function(_0xf439e9){try{jsonpatch[_0x4524('0x21')](_0xf439e9,_0x3450e5,!![]);}catch(_0x5bc77d){return BPromise[_0x4524('0x22')](_0x5bc77d);}return _0xf439e9[_0x4524('0x23')]();};}function saveUpdates(_0x3e82b8,_0x2bdcff){return function(_0x1223a2){if(_0x1223a2){return _0x1223a2[_0x4524('0x24')](_0x3e82b8)[_0x4524('0x25')](function(_0x203590){return _0x203590;});}return null;};}function removeEntity(_0x335aac,_0xa75186){return function(_0x54599f){if(_0x54599f){return _0x54599f[_0x4524('0x26')]()['then'](function(){var _0x480571=_0x54599f[_0x4524('0x27')]({'plain':!![]});var _0x524e9b=_0x4524('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x524e9b,'resourceId':_0x480571['id']}})[_0x4524('0x25')](function(){return _0x54599f;});})[_0x4524('0x25')](function(){_0x335aac[_0x4524('0x19')](0xcc)[_0x4524('0x1a')]();});}};}function handleEntityNotFound(_0x2f398f,_0x4429ba){return function(_0x327a0f){if(!_0x327a0f){_0x2f398f[_0x4524('0x18')](0x194);}return _0x327a0f;};}function handleError(_0x288679,_0xb7c194){_0xb7c194=_0xb7c194||0x1f4;return function(_0x395073){logger[_0x4524('0x29')](_0x395073[_0x4524('0x2a')]);if(_0x395073[_0x4524('0x2b')]){delete _0x395073[_0x4524('0x2b')];}_0x288679[_0x4524('0x19')](_0xb7c194)[_0x4524('0x2c')](_0x395073);};}exports['index']=function(_0x57485c,_0x2d77bd){var _0x3fa467={},_0x32439b={},_0x971b4d={'count':0x0,'rows':[]};var _0x463211=_[_0x4524('0x2d')](db[_0x4524('0x2e')]['rawAttributes'],function(_0x4717e3){return{'name':_0x4717e3[_0x4524('0x2f')],'type':_0x4717e3[_0x4524('0x30')][_0x4524('0x31')]};});_0x32439b[_0x4524('0x32')]=_[_0x4524('0x2d')](_0x463211,_0x4524('0x2b'));_0x32439b[_0x4524('0x33')]=_[_0x4524('0x34')](_0x57485c[_0x4524('0x33')]);_0x32439b['filters']=_[_0x4524('0x35')](_0x32439b[_0x4524('0x32')],_0x32439b[_0x4524('0x33')]);_0x3fa467[_0x4524('0x36')]=_['intersection'](_0x32439b[_0x4524('0x32')],qs['fields'](_0x57485c[_0x4524('0x33')][_0x4524('0x37')]));_0x3fa467[_0x4524('0x36')]=_0x3fa467['attributes']['length']?_0x3fa467['attributes']:_0x32439b[_0x4524('0x32')];if(!_0x57485c['query'][_0x4524('0x38')](_0x4524('0x39'))){_0x3fa467[_0x4524('0x1f')]=qs[_0x4524('0x1f')](_0x57485c[_0x4524('0x33')]['limit']);_0x3fa467[_0x4524('0x1e')]=qs['offset'](_0x57485c[_0x4524('0x33')][_0x4524('0x1e')]);}_0x3fa467['order']=qs[_0x4524('0x3a')](_0x57485c[_0x4524('0x33')]['sort']);_0x3fa467[_0x4524('0x3b')]=qs[_0x4524('0x3c')](_[_0x4524('0x3d')](_0x57485c[_0x4524('0x33')],_0x32439b['filters']),_0x463211);if(_0x57485c[_0x4524('0x33')][_0x4524('0x3e')]){_0x3fa467['where']=_[_0x4524('0x3f')](_0x3fa467['where'],{'$or':_['map'](_0x463211,function(_0x29048d){if(_0x29048d[_0x4524('0x30')]!==_0x4524('0x40')){var _0x19ac29={};_0x19ac29[_0x29048d[_0x4524('0x2b')]]={'$like':'%'+_0x57485c['query'][_0x4524('0x3e')]+'%'};return _0x19ac29;}})});}_0x3fa467=_[_0x4524('0x3f')]({},_0x3fa467,_0x57485c[_0x4524('0x41')]);var _0x325da4={'where':_0x3fa467[_0x4524('0x3b')]};return db[_0x4524('0x2e')][_0x4524('0x1d')](_0x325da4)['then'](function(_0x3ca81d){_0x971b4d[_0x4524('0x1d')]=_0x3ca81d;if(_0x57485c[_0x4524('0x33')][_0x4524('0x42')]){_0x3fa467[_0x4524('0x43')]=[{'all':!![]}];}return db[_0x4524('0x2e')]['findAll'](_0x3fa467);})[_0x4524('0x25')](function(_0x210589){_0x971b4d[_0x4524('0x44')]=_0x210589;return _0x971b4d;})['then'](respondWithFilteredResult(_0x2d77bd,_0x3fa467))[_0x4524('0x45')](handleError(_0x2d77bd,null));};exports[_0x4524('0x46')]=function(_0x16de00,_0x47c150){var _0x528594={'raw':![],'where':{'id':_0x16de00['params']['id']}},_0x1b4581={};_0x1b4581['model']=_[_0x4524('0x34')](db[_0x4524('0x2e')]['rawAttributes']);_0x1b4581[_0x4524('0x33')]=_[_0x4524('0x34')](_0x16de00[_0x4524('0x33')]);_0x1b4581[_0x4524('0x3c')]=_[_0x4524('0x35')](_0x1b4581[_0x4524('0x32')],_0x1b4581[_0x4524('0x33')]);_0x528594[_0x4524('0x36')]=_[_0x4524('0x35')](_0x1b4581[_0x4524('0x32')],qs['fields'](_0x16de00[_0x4524('0x33')][_0x4524('0x37')]));_0x528594[_0x4524('0x36')]=_0x528594['attributes'][_0x4524('0x47')]?_0x528594[_0x4524('0x36')]:_0x1b4581[_0x4524('0x32')];if(_0x16de00['query']['includeAll']){_0x528594[_0x4524('0x43')]=[{'all':!![]}];}_0x528594=_[_0x4524('0x3f')]({},_0x528594,_0x16de00['options']);return db[_0x4524('0x2e')][_0x4524('0x48')](_0x528594)[_0x4524('0x25')](handleEntityNotFound(_0x47c150,null))[_0x4524('0x25')](respondWithResult(_0x47c150,null))[_0x4524('0x45')](handleError(_0x47c150,null));};exports[_0x4524('0x49')]=function(_0x85150b,_0x1774fa){return db[_0x4524('0x2e')][_0x4524('0x49')](_0x85150b['body'],{})[_0x4524('0x25')](function(_0x3eb4de){var _0x53e008=_0x85150b[_0x4524('0x4a')][_0x4524('0x27')]({'plain':!![]});if(!_0x53e008)throw new Error(_0x4524('0x4b'));if(_0x53e008[_0x4524('0x4c')]===_0x4524('0x4a')){var _0x389623=_0x3eb4de[_0x4524('0x27')]({'plain':!![]});var _0xe65fc2='Reports';return db['UserProfileSection']['find']({'where':{'name':_0xe65fc2,'userProfileId':_0x53e008['userProfileId']},'raw':!![]})[_0x4524('0x25')](function(_0x4868d5){if(_0x4868d5&&_0x4868d5[_0x4524('0x4d')]===0x0){return db['UserProfileResource'][_0x4524('0x49')]({'name':_0x389623[_0x4524('0x2b')],'resourceId':_0x389623['id'],'type':_0x4524('0x28'),'sectionId':_0x4868d5['id']},{})[_0x4524('0x25')](function(){return _0x3eb4de;});}else{return _0x3eb4de;}})[_0x4524('0x45')](function(_0x3bdc1d){logger[_0x4524('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bdc1d);throw _0x3bdc1d;});}return _0x3eb4de;})[_0x4524('0x25')](respondWithResult(_0x1774fa,0xc9))['catch'](handleError(_0x1774fa,null));};exports[_0x4524('0x24')]=function(_0x32e1ba,_0x4d31c1){if(_0x32e1ba['body']['id']){delete _0x32e1ba[_0x4524('0x4e')]['id'];}return db[_0x4524('0x2e')]['find']({'where':{'id':_0x32e1ba['params']['id']}})['then'](handleEntityNotFound(_0x4d31c1,null))[_0x4524('0x25')](saveUpdates(_0x32e1ba['body'],null))['then'](respondWithResult(_0x4d31c1,null))[_0x4524('0x45')](handleError(_0x4d31c1,null));};exports['destroy']=function(_0x16568a,_0x37caf9){return db[_0x4524('0x2e')][_0x4524('0x48')]({'where':{'id':_0x16568a[_0x4524('0x4f')]['id']}})[_0x4524('0x25')](handleEntityNotFound(_0x37caf9,null))[_0x4524('0x25')](removeEntity(_0x37caf9,null))[_0x4524('0x45')](handleError(_0x37caf9,null));};exports['preview']=function(_0x44a82e,_0xc5349e){var _0x4772c1=0xa;var _0x3f4eb9=[_0x4524('0x50'),_0x4524('0x51'),_0x4524('0x52'),_0x4524('0x53')];var _0x28dd72={'SUM':_0x4524('0x54'),'COUNT':_0x4524('0x55'),'COUNT DISTINCT':_0x4524('0x56'),'MAX':'MAX(%s)','MIN':_0x4524('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4524('0x58'),'GROUP_CONCAT ASC':_0x4524('0x59'),'GROUP_CONCAT DESC':_0x4524('0x5a')};var _0x498894={'SEC_TO_TIME':_0x4524('0x5b'),'DATE':_0x4524('0x5c'),'HOUR':_0x4524('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4524('0x5e')};var _0x3f8cc2=function(_0xb52929){return!_[_0x4524('0x5f')]([_0x4524('0x60'),_0x4524('0x61'),'IS\x20EMPTY',_0x4524('0x62')],_0xb52929);};var _0x4eace9=function(_0x50712d){if(!_0x50712d||!_0x50712d[_0x4524('0x63')][_0x4524('0x47')]){return'';}for(var _0x3e5d75='(',_0x50c3ce=0x0;_0x50c3ce<_0x50712d['rules'][_0x4524('0x47')];_0x50c3ce+=0x1){_0x50c3ce>0x0&&(_0x3e5d75+='\x20'+_0x50712d[_0x4524('0x64')]+'\x20');_0x3e5d75+=_0x50712d['rules'][_0x50c3ce][_0x4524('0x65')]?_0x4eace9(_0x50712d[_0x4524('0x63')][_0x50c3ce][_0x4524('0x65')]):_0x50712d[_0x4524('0x63')][_0x50c3ce][_0x4524('0x66')]+'\x20'+_0x50712d[_0x4524('0x63')][_0x50c3ce][_0x4524('0x67')]+(_0x3f8cc2(_0x50712d[_0x4524('0x63')][_0x50c3ce][_0x4524('0x67')])?'\x20'+_0x50712d[_0x4524('0x63')][_0x50c3ce]['value']:'');}return _0x3e5d75+')';};var _0x40170c={'where':{'id':_0x44a82e[_0x4524('0x4f')]['id']}},_0x5bf843,_0x5030e8,_0x3d86ac,_0x449355,_0x1072e6;_0x40170c=_[_0x4524('0x3f')]({},_0x40170c,_0x44a82e[_0x4524('0x41')]);return db[_0x4524('0x2e')][_0x4524('0x48')](_0x40170c)['then'](function(_0x5050bc){if(_0x5050bc){_0x5bf843=_0x5050bc;return _0x5050bc[_0x4524('0x68')]();}return null;})[_0x4524('0x25')](function(_0x59053d){if(_0x59053d){if(!_0x59053d[_0x4524('0x47')]){throw new db[(_0x4524('0x69'))][(_0x4524('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5030e8=_0x59053d;return db[_0x4524('0x6b')][_0x4524('0x6c')]({'raw':!![]});}return null;})['then'](function(_0x23cb23){if(_0x23cb23){_0x3d86ac=_['keyBy'](_0x23cb23,'id');var _0x341156;var _0x302eba=squel['select']();_0x302eba['from'](_0x5bf843[_0x4524('0x6d')]);for(var _0x2c0638=0x0;_0x2c0638<_0x5030e8[_0x4524('0x47')];_0x2c0638+=0x1){_0x341156=_0x5030e8[_0x2c0638][_0x4524('0x6e')]?_0x3d86ac[_0x5030e8[_0x2c0638][_0x4524('0x6e')]][_0x4524('0x6f')]:_0x5030e8[_0x2c0638]['field'];_0x341156=_0x5030e8[_0x2c0638][_0x4524('0x70')]?_[_0x4524('0x71')](_0x28dd72[_0x5030e8[_0x2c0638][_0x4524('0x70')]],'%s',_0x341156):_0x341156;_0x341156=_0x5030e8[_0x2c0638][_0x4524('0x72')]?_[_0x4524('0x71')](_0x498894[_0x5030e8[_0x2c0638]['format']],'%s',_0x341156):_0x341156;if(_0x5030e8[_0x2c0638][_0x4524('0x73')]){_0x302eba[_0x4524('0x65')](_0x341156);}_0x5030e8[_0x2c0638][_0x4524('0x74')]&&_0x302eba[_0x4524('0x75')](_0x341156,_0x5030e8[_0x2c0638][_0x4524('0x74')]===_0x4524('0x76')?![]:!![]);_0x302eba[_0x4524('0x66')](_0x341156,_0x5030e8[_0x2c0638][_0x4524('0x77')]||_0x341156);}if(_0x5bf843[_0x4524('0x78')]){_0x5bf843[_0x4524('0x78')]=JSON[_0x4524('0x79')](_0x5bf843[_0x4524('0x78')]);for(var _0x5611a8=0x0;_0x5611a8<_0x5bf843[_0x4524('0x78')][_0x4524('0x47')];_0x5611a8+=0x1){if(_0x5bf843['joins'][_0x5611a8][_0x4524('0x30')]&&_['includes'](_0x3f4eb9,_0x5bf843[_0x4524('0x78')][_0x5611a8][_0x4524('0x30')])&&_0x5bf843['joins'][_0x5611a8]['parentKey']&&_0x5bf843['joins'][_0x5611a8][_0x4524('0x7a')]&&_0x5bf843[_0x4524('0x78')][_0x5611a8][_0x4524('0x7b')]){_0x302eba[_0x5bf843['joins'][_0x5611a8][_0x4524('0x30')]](_0x5bf843[_0x4524('0x78')][_0x5611a8][_0x4524('0x7a')],null,util[_0x4524('0x72')](_0x4524('0x7c'),_0x5bf843[_0x4524('0x6d')],_0x5bf843['joins'][_0x5611a8][_0x4524('0x7d')],_0x5bf843[_0x4524('0x78')][_0x5611a8]['foreignTable'],_0x5bf843['joins'][_0x5611a8][_0x4524('0x7b')]));}}}if(_0x5bf843['conditions']){_0x5bf843['conditions']=JSON[_0x4524('0x79')](_0x5bf843[_0x4524('0x7e')]);_0x302eba['where'](_0x4eace9(_0x5bf843[_0x4524('0x7e')]['group']));}_0x1072e6=_0x302eba[_0x4524('0x7f')]();_0x302eba[_0x4524('0x1f')](_0x4772c1);_0x302eba[_0x4524('0x1e')](0x0);logger[_0x4524('0x80')](_0x4524('0x81'),_0x302eba[_0x4524('0x82')]());return dbH[_0x4524('0x83')][_0x4524('0x33')](_0x302eba[_0x4524('0x82')](),{'type':dbH[_0x4524('0x83')][_0x4524('0x84')][_0x4524('0x85')]});}})[_0x4524('0x25')](respondWithResult(_0xc5349e,null))[_0x4524('0x45')](handleError(_0xc5349e,null));};function runReport(_0x46f9d1,_0x1af37e,_0x5300e2){var _0x1e3dc1=_0x1af37e[_0x4524('0x2b')];var _0x2783c0=0xa;var _0x20ebf3=[_0x4524('0x50'),_0x4524('0x51'),_0x4524('0x52'),_0x4524('0x53')];var _0x3591f7={'SUM':_0x4524('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4524('0x56'),'MAX':_0x4524('0x86'),'MIN':_0x4524('0x57'),'AVG':_0x4524('0x87'),'GROUP_CONCAT':_0x4524('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4524('0x5a')};var _0x2defad={'SEC_TO_TIME':_0x4524('0x5b'),'DATE':_0x4524('0x5c'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4524('0x5e')};var _0x40516c=function(_0x488fbb){return!_[_0x4524('0x5f')]([_0x4524('0x60'),_0x4524('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x488fbb);};var _0x3c3411=function(_0x41e308){if(!_0x41e308||!_0x41e308[_0x4524('0x63')][_0x4524('0x47')]){return'';}for(var _0x614245='(',_0x18b820=0x0;_0x18b820<_0x41e308[_0x4524('0x63')]['length'];_0x18b820+=0x1){_0x18b820>0x0&&(_0x614245+='\x20'+_0x41e308[_0x4524('0x64')]+'\x20');_0x614245+=_0x41e308[_0x4524('0x63')][_0x18b820][_0x4524('0x65')]?_0x3c3411(_0x41e308[_0x4524('0x63')][_0x18b820]['group']):_0x41e308[_0x4524('0x63')][_0x18b820][_0x4524('0x66')]+'\x20'+_0x41e308[_0x4524('0x63')][_0x18b820]['condition']+(_0x40516c(_0x41e308[_0x4524('0x63')][_0x18b820][_0x4524('0x67')])?'\x20'+_0x41e308[_0x4524('0x63')][_0x18b820][_0x4524('0x88')]:'');}return _0x614245+')';};var _0xa8338a={'where':{'id':_0x46f9d1['id']}},_0x377f50,_0x30bacd,_0x4225a1,_0x291d7a,_0x30f854;_0xa8338a=_['merge']({},_0xa8338a,_0x5300e2);return db[_0x4524('0x2e')][_0x4524('0x48')](_0xa8338a)[_0x4524('0x25')](function(_0x3f9618){if(_0x3f9618){_0x377f50=_0x3f9618;return _0x3f9618[_0x4524('0x68')]();}return null;})['then'](function(_0x3b55bf){if(_0x3b55bf){if(!_0x3b55bf[_0x4524('0x47')]){throw new db[(_0x4524('0x69'))][(_0x4524('0x6a'))](_0x4524('0x89'),0x193);}_0x30bacd=_0x3b55bf;return db[_0x4524('0x6b')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x21c5f8){if(_0x21c5f8){_0x4225a1=_[_0x4524('0x8a')](_0x21c5f8,'id');var _0x8b324e;var _0xae14fe=squel[_0x4524('0x8b')]();_0xae14fe[_0x4524('0x8c')](_0x377f50[_0x4524('0x6d')]);for(var _0x1e6080=0x0;_0x1e6080<_0x30bacd[_0x4524('0x47')];_0x1e6080+=0x1){_0x8b324e=_0x30bacd[_0x1e6080]['MetricId']?_0x4225a1[_0x30bacd[_0x1e6080][_0x4524('0x6e')]][_0x4524('0x6f')]:_0x30bacd[_0x1e6080][_0x4524('0x66')];_0x8b324e=_0x30bacd[_0x1e6080]['function']?_[_0x4524('0x71')](_0x3591f7[_0x30bacd[_0x1e6080][_0x4524('0x70')]],'%s',_0x8b324e):_0x8b324e;_0x8b324e=_0x30bacd[_0x1e6080][_0x4524('0x72')]?_[_0x4524('0x71')](_0x2defad[_0x30bacd[_0x1e6080][_0x4524('0x72')]],'%s',_0x8b324e):_0x8b324e;if(_0x30bacd[_0x1e6080][_0x4524('0x73')]){_0xae14fe[_0x4524('0x65')](_0x8b324e);}_0x30bacd[_0x1e6080][_0x4524('0x74')]&&_0xae14fe[_0x4524('0x75')](_0x8b324e,_0x30bacd[_0x1e6080][_0x4524('0x74')]==='DESC'?![]:!![]);_0xae14fe[_0x4524('0x66')](_0x8b324e,_0x30bacd[_0x1e6080]['alias']||_0x8b324e);}if(_0x377f50[_0x4524('0x78')]){_0x377f50['joins']=JSON[_0x4524('0x79')](_0x377f50[_0x4524('0x78')]);for(var _0x4c5f3c=0x0;_0x4c5f3c<_0x377f50['joins']['length'];_0x4c5f3c+=0x1){if(_0x377f50[_0x4524('0x78')][_0x4c5f3c][_0x4524('0x30')]&&_[_0x4524('0x5f')](_0x20ebf3,_0x377f50[_0x4524('0x78')][_0x4c5f3c][_0x4524('0x30')])&&_0x377f50['joins'][_0x4c5f3c][_0x4524('0x7d')]&&_0x377f50[_0x4524('0x78')][_0x4c5f3c]['foreignTable']&&_0x377f50[_0x4524('0x78')][_0x4c5f3c][_0x4524('0x7b')]){_0xae14fe[_0x377f50[_0x4524('0x78')][_0x4c5f3c][_0x4524('0x30')]](_0x377f50[_0x4524('0x78')][_0x4c5f3c][_0x4524('0x7a')],null,util[_0x4524('0x72')](_0x4524('0x7c'),_0x377f50['table'],_0x377f50['joins'][_0x4c5f3c][_0x4524('0x7d')],_0x377f50[_0x4524('0x78')][_0x4c5f3c]['foreignTable'],_0x377f50['joins'][_0x4c5f3c][_0x4524('0x7b')]));}}}if(_0x377f50[_0x4524('0x7e')]){_0x377f50[_0x4524('0x7e')]=JSON[_0x4524('0x79')](_0x377f50[_0x4524('0x7e')]);_0xae14fe['where'](_0x3c3411(_0x377f50[_0x4524('0x7e')][_0x4524('0x65')]));}_0x30f854=_0xae14fe[_0x4524('0x7f')]();_0xae14fe[_0x4524('0x1f')](_0x2783c0);_0xae14fe[_0x4524('0x1e')](0x0);return;}})[_0x4524('0x25')](function(){if(_0x1af37e[_0x4524('0x8d')]==='web'){return null;}var _0x3f3501=_[_0x4524('0x3f')](_0x1af37e,{'name':_0x1af37e[_0x4524('0x8e')]||_0x1af37e['name']||_0x377f50['name'],'basename':_0x1e3dc1,'savename':util[_0x4524('0x72')](_0x4524('0x8f'),_0x1af37e[_0x4524('0x2b')]||_0x377f50[_0x4524('0x2b')],require(_0x4524('0x90'))[_0x4524('0x91')](0x4),_0x1af37e['output']||_0x4524('0x92')),'reportId':_0x377f50['id'],'reportType':_0x4524('0x93')});return db[_0x4524('0x94')]['create'](_0x3f3501,{'raw':!![]});})['then'](function(_0x4b9ea8){if(_0x377f50[_0x4524('0x6d')]==='cdr'){_0x30f854[_0x4524('0x3b')](_0x377f50['table']+_0x4524('0x95'),_0x1af37e[_0x4524('0x96')],_0x1af37e[_0x4524('0x97')]);}else{_0x30f854['where'](_0x377f50[_0x4524('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1af37e[_0x4524('0x96')],_0x1af37e[_0x4524('0x97')]);}if(_0x4b9ea8){logger['info'](_0x4524('0x98'),_0x30f854[_0x4524('0x82')]());require('child_process')[_0x4524('0x99')](path[_0x4524('0x50')](__dirname,_0x4524('0x9a'),_0x4b9ea8[_0x4524('0x8d')]),[_0x4b9ea8['id'],_0x30f854[_0x4524('0x82')](),path[_0x4524('0x50')](__dirname,'../../files/reports',_0x4b9ea8[_0x4524('0x9b')]),_0x1e3dc1]);return _0x4b9ea8;}else{var _0x29eb37=squel[_0x4524('0x8b')]();_0x29eb37[_0x4524('0x8c')]('('+_0x30f854[_0x4524('0x82')]()+')',_0x4524('0x9c'));_0x29eb37[_0x4524('0x66')](_0x4524('0x9d'),'count');_0x30f854[_0x4524('0x1f')](_0x1af37e[_0x4524('0x1f')]||_0x2783c0);_0x30f854['offset'](_0x1af37e[_0x4524('0x1e')]||0x0);return dbH[_0x4524('0x83')][_0x4524('0x33')](_0x29eb37[_0x4524('0x82')](),{'type':dbH['sequelize'][_0x4524('0x84')][_0x4524('0x85')]})[_0x4524('0x25')](function(_0x3c6b03){if(!_0x3c6b03[_0x4524('0x47')]){_0x291d7a=0x0;}else{_0x291d7a=_0x3c6b03[0x0][_0x4524('0x1d')]||0x0;}return dbH[_0x4524('0x83')][_0x4524('0x33')](_0x30f854[_0x4524('0x82')](),{'type':dbH[_0x4524('0x83')][_0x4524('0x84')][_0x4524('0x85')]});})['then'](function(_0x5020c2){return{'rows':_0x5020c2||[],'count':_0x291d7a};});}});}exports[_0x4524('0x9e')]=function(_0x147a67,_0x26dd7b){return runReport(_0x147a67[_0x4524('0x4f')],_0x147a67[_0x4524('0x33')],_0x147a67['options'])[_0x4524('0x25')](respondWithResult(_0x26dd7b,null))['catch'](handleError(_0x26dd7b,null));};exports['runReport']=runReport;exports[_0x4524('0x33')]=function(_0x1b7bbd,_0x297eea){var _0x5c86c6=0xa;var _0x187dcb=[_0x4524('0x50'),_0x4524('0x51'),_0x4524('0x52'),'cross_join'];var _0x568371={'SUM':_0x4524('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4524('0x86'),'MIN':_0x4524('0x57'),'AVG':_0x4524('0x87'),'GROUP_CONCAT':_0x4524('0x58'),'GROUP_CONCAT ASC':_0x4524('0x59'),'GROUP_CONCAT DESC':_0x4524('0x5a')};var _0x1ba339={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x4524('0x5d'),'ROUND':_0x4524('0x9f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x40bfe7=function(_0x59fd3a){return!_[_0x4524('0x5f')]([_0x4524('0x60'),_0x4524('0x61'),_0x4524('0xa0'),_0x4524('0x62')],_0x59fd3a);};var _0x1ee2f9=function(_0x32d27c){if(!_0x32d27c||!_0x32d27c['rules'][_0x4524('0x47')]){return'';}for(var _0x10aa28='(',_0x1c159a=0x0;_0x1c159a<_0x32d27c['rules'][_0x4524('0x47')];_0x1c159a+=0x1){_0x1c159a>0x0&&(_0x10aa28+='\x20'+_0x32d27c[_0x4524('0x64')]+'\x20');_0x10aa28+=_0x32d27c['rules'][_0x1c159a]['group']?_0x1ee2f9(_0x32d27c[_0x4524('0x63')][_0x1c159a][_0x4524('0x65')]):_0x32d27c['rules'][_0x1c159a][_0x4524('0x66')]+'\x20'+_0x32d27c['rules'][_0x1c159a][_0x4524('0x67')]+(_0x40bfe7(_0x32d27c['rules'][_0x1c159a]['condition'])?'\x20'+_0x32d27c[_0x4524('0x63')][_0x1c159a]['value']:'');}return _0x10aa28+')';};var _0xf8ba19={'where':{'id':_0x1b7bbd['params']['id']}},_0x202da4,_0x4cf84a,_0x15fc71,_0x153106,_0xdf5684;_0xf8ba19=_[_0x4524('0x3f')]({},_0xf8ba19,_0x1b7bbd[_0x4524('0x41')]);return db[_0x4524('0x2e')]['find'](_0xf8ba19)[_0x4524('0x25')](function(_0x564aa6){if(_0x564aa6){_0x202da4=_0x564aa6;return _0x564aa6[_0x4524('0x68')]();}return null;})[_0x4524('0x25')](function(_0x52cdc8){if(_0x52cdc8){if(!_0x52cdc8[_0x4524('0x47')]){throw new db['Sequelize'][(_0x4524('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cf84a=_0x52cdc8;return db['AnalyticMetric'][_0x4524('0x6c')]({'raw':!![]});}return null;})['then'](function(_0xec54b1){if(_0xec54b1){_0x15fc71=_[_0x4524('0x8a')](_0xec54b1,'id');var _0x4af704;var _0x4d76f2=squel[_0x4524('0x8b')]();_0x4d76f2[_0x4524('0x8c')](_0x202da4[_0x4524('0x6d')]);for(var _0x4f6215=0x0;_0x4f6215<_0x4cf84a[_0x4524('0x47')];_0x4f6215+=0x1){_0x4af704=_0x4cf84a[_0x4f6215][_0x4524('0x6e')]?_0x15fc71[_0x4cf84a[_0x4f6215][_0x4524('0x6e')]][_0x4524('0x6f')]:_0x4cf84a[_0x4f6215]['field'];_0x4af704=_0x4cf84a[_0x4f6215][_0x4524('0x70')]?_['replace'](_0x568371[_0x4cf84a[_0x4f6215][_0x4524('0x70')]],'%s',_0x4af704):_0x4af704;_0x4af704=_0x4cf84a[_0x4f6215]['format']?_[_0x4524('0x71')](_0x1ba339[_0x4cf84a[_0x4f6215]['format']],'%s',_0x4af704):_0x4af704;if(_0x4cf84a[_0x4f6215][_0x4524('0x73')]){_0x4d76f2[_0x4524('0x65')](_0x4af704);}_0x4cf84a[_0x4f6215][_0x4524('0x74')]&&_0x4d76f2['order'](_0x4af704,_0x4cf84a[_0x4f6215][_0x4524('0x74')]===_0x4524('0x76')?![]:!![]);_0x4d76f2[_0x4524('0x66')](_0x4af704,_0x4cf84a[_0x4f6215][_0x4524('0x77')]||_0x4af704);}if(_0x202da4[_0x4524('0x78')]){_0x202da4[_0x4524('0x78')]=JSON['parse'](_0x202da4['joins']);for(var _0x5f38b1=0x0;_0x5f38b1<_0x202da4['joins']['length'];_0x5f38b1+=0x1){if(_0x202da4[_0x4524('0x78')][_0x5f38b1][_0x4524('0x30')]&&_[_0x4524('0x5f')](_0x187dcb,_0x202da4[_0x4524('0x78')][_0x5f38b1][_0x4524('0x30')])&&_0x202da4[_0x4524('0x78')][_0x5f38b1][_0x4524('0x7d')]&&_0x202da4[_0x4524('0x78')][_0x5f38b1]['foreignTable']&&_0x202da4[_0x4524('0x78')][_0x5f38b1][_0x4524('0x7b')]){_0x4d76f2[_0x202da4['joins'][_0x5f38b1][_0x4524('0x30')]](_0x202da4[_0x4524('0x78')][_0x5f38b1][_0x4524('0x7a')],null,util[_0x4524('0x72')](_0x4524('0x7c'),_0x202da4[_0x4524('0x6d')],_0x202da4[_0x4524('0x78')][_0x5f38b1]['parentKey'],_0x202da4[_0x4524('0x78')][_0x5f38b1][_0x4524('0x7a')],_0x202da4['joins'][_0x5f38b1][_0x4524('0x7b')]));}}}if(_0x202da4['conditions']){_0x202da4['conditions']=JSON[_0x4524('0x79')](_0x202da4['conditions']);_0x4d76f2[_0x4524('0x3b')](_0x1ee2f9(_0x202da4['conditions'][_0x4524('0x65')]));}_0xdf5684=_0x4d76f2[_0x4524('0x7f')]();_0x4d76f2[_0x4524('0x1f')](_0x5c86c6);_0x4d76f2[_0x4524('0x1e')](0x0);logger[_0x4524('0x80')]('Limited\x20Query:',_0x4d76f2[_0x4524('0x82')]());return dbH[_0x4524('0x83')][_0x4524('0x33')](_0x4d76f2[_0x4524('0x82')](),{'type':dbH[_0x4524('0x83')][_0x4524('0x84')][_0x4524('0x85')]});}})[_0x4524('0x25')](function(){return{'sql':_0xdf5684[_0x4524('0x82')]()};})[_0x4524('0x25')](respondWithResult(_0x297eea,null))[_0x4524('0x45')](handleError(_0x297eea,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a53101f..bb807d7 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 _0x09ff=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./analyticCustomReport.attributes'];(function(_0xed4668,_0x469afc){var _0x5e3fad=function(_0x3c59d8){while(--_0x3c59d8){_0xed4668['push'](_0xed4668['shift']());}};_0x5e3fad(++_0x469afc);}(_0x09ff,0x17a));var _0xf09f=function(_0x5389c5,_0xd4953b){_0x5389c5=_0x5389c5-0x0;var _0x31f328=_0x09ff[_0x5389c5];return _0x31f328;};'use strict';var _=require(_0xf09f('0x0'));var util=require(_0xf09f('0x1'));var logger=require(_0xf09f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf09f('0x3'));var rp=require(_0xf09f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf09f('0x5'));var config=require('../../config/environment');var attributes=require(_0xf09f('0x6'));module[_0xf09f('0x7')]=function(_0x112361,_0x1f5f6b){return _0x112361[_0xf09f('0x8')](_0xf09f('0x9'),attributes,{'tableName':_0xf09f('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x762c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','util'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0x762c,0x167));var _0xc762=function(_0x50963f,_0x97943a){_0x50963f=_0x50963f-0x0;var _0x5667d5=_0x762c[_0x50963f];return _0x5667d5;};'use strict';var _=require('lodash');var util=require(_0xc762('0x0'));var logger=require('../../config/logger')(_0xc762('0x1'));var moment=require(_0xc762('0x2'));var BPromise=require(_0xc762('0x3'));var rp=require(_0xc762('0x4'));var fs=require('fs');var path=require(_0xc762('0x5'));var rimraf=require(_0xc762('0x6'));var config=require(_0xc762('0x7'));var attributes=require(_0xc762('0x8'));module[_0xc762('0x9')]=function(_0x5ca906,_0xa2c089){return _0x5ca906[_0xc762('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0xc762('0xb'),'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 d48b569..119083b 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 _0x2bfd=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x367361,_0x311488){var _0x195d2d=function(_0x2b20a4){while(--_0x2b20a4){_0x367361['push'](_0x367361['shift']());}};_0x195d2d(++_0x311488);}(_0x2bfd,0x70));var _0xd2bf=function(_0x38f737,_0x54f685){_0x38f737=_0x38f737-0x0;var _0x7afda3=_0x2bfd[_0x38f737];return _0x7afda3;};'use strict';var _=require('lodash');var util=require(_0xd2bf('0x0'));var moment=require(_0xd2bf('0x1'));var BPromise=require('bluebird');var rs=require(_0xd2bf('0x2'));var fs=require('fs');var Redis=require(_0xd2bf('0x3'));var db=require(_0xd2bf('0x4'))['db'];var utils=require(_0xd2bf('0x5'));var logger=require('../../config/logger')(_0xd2bf('0x6'));var config=require(_0xd2bf('0x7'));var jayson=require(_0xd2bf('0x8'));var client=jayson[_0xd2bf('0x9')][_0xd2bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c8d10,_0x1e1d7b,_0x573689){return new BPromise(function(_0x15d497,_0x22b02b){return client['request'](_0x2c8d10,_0x573689)[_0xd2bf('0xb')](function(_0x287005){logger['info'](_0xd2bf('0xc'),_0x1e1d7b,_0xd2bf('0xd'));logger[_0xd2bf('0xe')](_0xd2bf('0xf'),_0x1e1d7b,_0xd2bf('0xd'),JSON[_0xd2bf('0x10')](_0x287005));if(_0x287005['error']){if(_0x287005[_0xd2bf('0x11')][_0xd2bf('0x12')]===0x1f4){logger[_0xd2bf('0x11')](_0xd2bf('0xc'),_0x1e1d7b,_0x287005[_0xd2bf('0x11')]['message']);return _0x22b02b(_0x287005['error'][_0xd2bf('0x13')]);}logger[_0xd2bf('0x11')](_0xd2bf('0xc'),_0x1e1d7b,_0x287005[_0xd2bf('0x11')][_0xd2bf('0x13')]);return _0x15d497(_0x287005['error'][_0xd2bf('0x13')]);}else{logger['info'](_0xd2bf('0xc'),_0x1e1d7b,_0xd2bf('0xd'));_0x15d497(_0x287005[_0xd2bf('0x14')][_0xd2bf('0x13')]);}})[_0xd2bf('0x15')](function(_0x2b8231){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x1e1d7b,_0x2b8231);_0x22b02b(_0x2b8231);});});} \ No newline at end of file +var _0xebe5=['randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x3105a9,_0x5f36f1){var _0x5d6e3=function(_0x10d873){while(--_0x10d873){_0x3105a9['push'](_0x3105a9['shift']());}};_0x5d6e3(++_0x5f36f1);}(_0xebe5,0x179));var _0x5ebe=function(_0x35836c,_0x17aedb){_0x35836c=_0x35836c-0x0;var _0x5277b3=_0xebe5[_0x35836c];return _0x5277b3;};'use strict';var _=require(_0x5ebe('0x0'));var util=require(_0x5ebe('0x1'));var moment=require(_0x5ebe('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ebe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5ebe('0x4'));var logger=require('../../config/logger')(_0x5ebe('0x5'));var config=require(_0x5ebe('0x6'));var jayson=require(_0x5ebe('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a1704,_0x1abb80,_0x31742a){return new BPromise(function(_0x1c649c,_0x23d94b){return client[_0x5ebe('0x8')](_0x4a1704,_0x31742a)[_0x5ebe('0x9')](function(_0x2da3e4){logger[_0x5ebe('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1abb80,_0x5ebe('0xb'));logger['debug'](_0x5ebe('0xc'),_0x1abb80,'request\x20sent',JSON[_0x5ebe('0xd')](_0x2da3e4));if(_0x2da3e4[_0x5ebe('0xe')]){if(_0x2da3e4['error'][_0x5ebe('0xf')]===0x1f4){logger[_0x5ebe('0xe')](_0x5ebe('0x10'),_0x1abb80,_0x2da3e4[_0x5ebe('0xe')][_0x5ebe('0x11')]);return _0x23d94b(_0x2da3e4[_0x5ebe('0xe')]['message']);}logger[_0x5ebe('0xe')](_0x5ebe('0x10'),_0x1abb80,_0x2da3e4[_0x5ebe('0xe')][_0x5ebe('0x11')]);return _0x1c649c(_0x2da3e4[_0x5ebe('0xe')][_0x5ebe('0x11')]);}else{logger[_0x5ebe('0xa')](_0x5ebe('0x10'),_0x1abb80,_0x5ebe('0xb'));_0x1c649c(_0x2da3e4[_0x5ebe('0x12')][_0x5ebe('0x11')]);}})['catch'](function(_0x34d9a6){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x1abb80,_0x34d9a6);_0x23d94b(_0x34d9a6);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index be1734f..44b7c14 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 _0x0ffd=['get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','query','create','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x0ffd,0x123));var _0xd0ff=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x0ffd[_0xaa0309];return _0x5de7ce;};'use strict';var multer=require('multer');var util=require(_0xd0ff('0x0'));var path=require(_0xd0ff('0x1'));var timeout=require(_0xd0ff('0x2'));var express=require('express');var router=express[_0xd0ff('0x3')]();var fs_extra=require(_0xd0ff('0x4'));var auth=require(_0xd0ff('0x5'));var interaction=require(_0xd0ff('0x6'));var config=require('../../config/environment');var controller=require(_0xd0ff('0x7'));router[_0xd0ff('0x8')]('/',auth[_0xd0ff('0x9')](),controller[_0xd0ff('0xa')]);router[_0xd0ff('0x8')](_0xd0ff('0xb'),auth[_0xd0ff('0x9')](),controller[_0xd0ff('0xc')]);router[_0xd0ff('0x8')](_0xd0ff('0xd'),auth[_0xd0ff('0x9')](),controller[_0xd0ff('0xe')]);router[_0xd0ff('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0xd0ff('0xf')]);router[_0xd0ff('0x8')](_0xd0ff('0x10'),auth[_0xd0ff('0x9')](),controller[_0xd0ff('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd0ff('0x12')]);router[_0xd0ff('0x13')](_0xd0ff('0xb'),auth[_0xd0ff('0x9')](),controller['update']);router[_0xd0ff('0x14')](_0xd0ff('0xb'),auth['isAuthenticated'](),controller[_0xd0ff('0x15')]);module[_0xd0ff('0x16')]=router; \ No newline at end of file +var _0xb002=['../../config/environment','./analyticCustomReport.controller','isAuthenticated','get','/:id','preview','/:id/run','run','/:id/query','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x3dd34b,_0x4fd418){var _0x44cd78=function(_0x588742){while(--_0x588742){_0x3dd34b['push'](_0x3dd34b['shift']());}};_0x44cd78(++_0x4fd418);}(_0xb002,0x72));var _0x2b00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb002[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2b00('0x0'));var util=require('util');var path=require(_0x2b00('0x1'));var timeout=require(_0x2b00('0x2'));var express=require(_0x2b00('0x3'));var router=express[_0x2b00('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2b00('0x5'));var config=require(_0x2b00('0x6'));var controller=require(_0x2b00('0x7'));router['get']('/',auth[_0x2b00('0x8')](),controller['index']);router[_0x2b00('0x9')](_0x2b00('0xa'),auth[_0x2b00('0x8')](),controller['show']);router[_0x2b00('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0x2b00('0xb')]);router[_0x2b00('0x9')](_0x2b00('0xc'),auth[_0x2b00('0x8')](),controller[_0x2b00('0xd')]);router[_0x2b00('0x9')](_0x2b00('0xe'),auth[_0x2b00('0x8')](),controller['query']);router['post']('/',auth[_0x2b00('0x8')](),controller[_0x2b00('0xf')]);router['put'](_0x2b00('0xa'),auth[_0x2b00('0x8')](),controller[_0x2b00('0x10')]);router[_0x2b00('0x11')](_0x2b00('0xa'),auth[_0x2b00('0x8')](),controller[_0x2b00('0x12')]);module[_0x2b00('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6eeb6b7..f0cf71d 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 _0x814b=['STRING','TEXT','sequelize','exports'];(function(_0x2f0be4,_0x194a40){var _0xefdb9d=function(_0xb2ff86){while(--_0xb2ff86){_0x2f0be4['push'](_0x2f0be4['shift']());}};_0xefdb9d(++_0x194a40);}(_0x814b,0x1a2));var _0xb814=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0x814b[_0x4cd690];return _0x4a74a9;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb814('0x2')]},'parent':{'type':Sequelize[_0xb814('0x2')]},'table':{'type':Sequelize[_0xb814('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb814('0x3')]}}; \ No newline at end of file +var _0x5fab=['exports','STRING','TEXT','sequelize'];(function(_0x405aeb,_0x5ee732){var _0x50e76a=function(_0x2cded1){while(--_0x2cded1){_0x405aeb['push'](_0x405aeb['shift']());}};_0x50e76a(++_0x5ee732);}(_0x5fab,0x177));var _0xb5fa=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x5fab[_0x2085f3];return _0x384e3c;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5fa('0x2')]},'parent':{'type':Sequelize[_0xb5fa('0x2')]},'table':{'type':Sequelize[_0xb5fa('0x2')]},'conditions':{'type':Sequelize[_0xb5fa('0x3')]},'joins':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 293497d..dfbbf56 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 _0x4819=['keyBy','table','metric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','from','countTable','COUNT(*)','SELECT','run','cross_join','COUNT(DISTINCT\x20%s)','debug','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','AnalyticDefaultReport','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','body','preview','join','left_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)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','MetricId','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20NULL','IS\x20EMPTY','operator','condition'];(function(_0x2782b1,_0x1f93f4){var _0x98e50a=function(_0x1c8d04){while(--_0x1c8d04){_0x2782b1['push'](_0x2782b1['shift']());}};_0x98e50a(++_0x1f93f4);}(_0x4819,0xcd));var _0x9481=function(_0x5dcbf0,_0x101d9d){_0x5dcbf0=_0x5dcbf0-0x0;var _0xcf87aa=_0x4819[_0x5dcbf0];return _0xcf87aa;};'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'];var dbH=require(_0x9481('0x19'))['dbH'];function respondWithStatusCode(_0x5aac02,_0xce6fa2){_0xce6fa2=_0xce6fa2||0xcc;return function(_0x150276){if(_0x150276){return _0x5aac02[_0x9481('0x1a')](_0xce6fa2);}return _0x5aac02[_0x9481('0x1b')](_0xce6fa2)[_0x9481('0x1c')]();};}function respondWithResult(_0xc7a0b5,_0x3fb97f){_0x3fb97f=_0x3fb97f||0xc8;return function(_0x495b30){if(_0x495b30){return _0xc7a0b5[_0x9481('0x1b')](_0x3fb97f)[_0x9481('0x1d')](_0x495b30);}};}function respondWithFilteredResult(_0x5b1fe6,_0x2266d5){return function(_0x518150){if(_0x518150){var _0x34108d=typeof _0x2266d5[_0x9481('0x1e')]===_0x9481('0x1f')&&typeof _0x2266d5[_0x9481('0x20')]==='undefined';var _0x5eda66=_0x518150[_0x9481('0x21')];var _0x50a559=_0x34108d?0x0:_0x2266d5['offset'];var _0x26671c=_0x34108d?_0x518150[_0x9481('0x21')]:_0x2266d5[_0x9481('0x1e')]+_0x2266d5[_0x9481('0x20')];var _0x7000e7;if(_0x26671c>=_0x5eda66){_0x26671c=_0x5eda66;_0x7000e7=0xc8;}else{_0x7000e7=0xce;}_0x5b1fe6[_0x9481('0x1b')](_0x7000e7);return _0x5b1fe6['set'](_0x9481('0x22'),_0x50a559+'-'+_0x26671c+'/'+_0x5eda66)[_0x9481('0x1d')](_0x518150);}return null;};}function patchUpdates(_0x45f9df){return function(_0x615e02){try{jsonpatch[_0x9481('0x23')](_0x615e02,_0x45f9df,!![]);}catch(_0x56da97){return BPromise[_0x9481('0x24')](_0x56da97);}return _0x615e02[_0x9481('0x25')]();};}function saveUpdates(_0x572599,_0x2bcf37){return function(_0xd1cd1a){if(_0xd1cd1a){return _0xd1cd1a[_0x9481('0x26')](_0x572599)[_0x9481('0x27')](function(_0x2dc02e){return _0x2dc02e;});}return null;};}function removeEntity(_0x49ecfa,_0x91e3d9){return function(_0x22f0b5){if(_0x22f0b5){return _0x22f0b5['destroy']()['then'](function(){var _0x12b0c3=_0x22f0b5[_0x9481('0x28')]({'plain':!![]});var _0x550fce=_0x9481('0x29');return db[_0x9481('0x2a')][_0x9481('0x2b')]({'where':{'type':_0x550fce,'resourceId':_0x12b0c3['id']}})[_0x9481('0x27')](function(){return _0x22f0b5;});})['then'](function(){_0x49ecfa[_0x9481('0x1b')](0xcc)[_0x9481('0x1c')]();});}};}function handleEntityNotFound(_0x3c2585,_0x587706){return function(_0x1791b2){if(!_0x1791b2){_0x3c2585['sendStatus'](0x194);}return _0x1791b2;};}function handleError(_0x2e1eff,_0xe153ab){_0xe153ab=_0xe153ab||0x1f4;return function(_0x22ab26){logger[_0x9481('0x2c')](_0x22ab26[_0x9481('0x2d')]);if(_0x22ab26['name']){delete _0x22ab26[_0x9481('0x2e')];}_0x2e1eff[_0x9481('0x1b')](_0xe153ab)[_0x9481('0x2f')](_0x22ab26);};}exports['index']=function(_0x56752e,_0x1addc8){var _0x427c25={},_0x42df68={},_0x2b33f8={'count':0x0,'rows':[]};var _0x5d9926=_['map'](db['AnalyticDefaultReport'][_0x9481('0x30')],function(_0x5d6c65){return{'name':_0x5d6c65[_0x9481('0x31')],'type':_0x5d6c65['type'][_0x9481('0x32')]};});_0x42df68[_0x9481('0x33')]=_[_0x9481('0x34')](_0x5d9926,_0x9481('0x2e'));_0x42df68[_0x9481('0x35')]=_['keys'](_0x56752e[_0x9481('0x35')]);_0x42df68[_0x9481('0x36')]=_[_0x9481('0x37')](_0x42df68['model'],_0x42df68[_0x9481('0x35')]);_0x427c25[_0x9481('0x38')]=_[_0x9481('0x37')](_0x42df68[_0x9481('0x33')],qs[_0x9481('0x39')](_0x56752e[_0x9481('0x35')]['fields']));_0x427c25[_0x9481('0x38')]=_0x427c25['attributes'][_0x9481('0x3a')]?_0x427c25[_0x9481('0x38')]:_0x42df68[_0x9481('0x33')];if(!_0x56752e[_0x9481('0x35')][_0x9481('0x3b')](_0x9481('0x3c'))){_0x427c25['limit']=qs[_0x9481('0x20')](_0x56752e[_0x9481('0x35')]['limit']);_0x427c25['offset']=qs[_0x9481('0x1e')](_0x56752e['query'][_0x9481('0x1e')]);}_0x427c25[_0x9481('0x3d')]=qs[_0x9481('0x3e')](_0x56752e[_0x9481('0x35')]['sort']);_0x427c25[_0x9481('0x3f')]=qs['filters'](_[_0x9481('0x40')](_0x56752e['query'],_0x42df68[_0x9481('0x36')]),_0x5d9926);if(_0x56752e['query'][_0x9481('0x41')]){_0x427c25[_0x9481('0x3f')]=_[_0x9481('0x42')](_0x427c25[_0x9481('0x3f')],{'$or':_[_0x9481('0x34')](_0x5d9926,function(_0x3b7998){if(_0x3b7998[_0x9481('0x43')]!=='VIRTUAL'){var _0x464080={};_0x464080[_0x3b7998[_0x9481('0x2e')]]={'$like':'%'+_0x56752e[_0x9481('0x35')][_0x9481('0x41')]+'%'};return _0x464080;}})});}_0x427c25=_[_0x9481('0x42')]({},_0x427c25,_0x56752e[_0x9481('0x44')]);var _0x2e4241={'where':_0x427c25['where']};return db[_0x9481('0x45')][_0x9481('0x21')](_0x2e4241)['then'](function(_0x704e81){_0x2b33f8[_0x9481('0x21')]=_0x704e81;if(_0x56752e[_0x9481('0x35')][_0x9481('0x46')]){_0x427c25[_0x9481('0x47')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x9481('0x48')](_0x427c25);})['then'](function(_0x23811a){_0x2b33f8[_0x9481('0x49')]=_0x23811a;return _0x2b33f8;})['then'](respondWithFilteredResult(_0x1addc8,_0x427c25))['catch'](handleError(_0x1addc8,null));};exports[_0x9481('0x4a')]=function(_0x1d0df0,_0x42b19a){var _0x4c4caf={'raw':!![],'where':{'id':_0x1d0df0[_0x9481('0x4b')]['id']}},_0x4402f6={};_0x4402f6['model']=_['keys'](db[_0x9481('0x45')]['rawAttributes']);_0x4402f6[_0x9481('0x35')]=_[_0x9481('0x4c')](_0x1d0df0[_0x9481('0x35')]);_0x4402f6[_0x9481('0x36')]=_[_0x9481('0x37')](_0x4402f6['model'],_0x4402f6[_0x9481('0x35')]);_0x4c4caf[_0x9481('0x38')]=_['intersection'](_0x4402f6[_0x9481('0x33')],qs[_0x9481('0x39')](_0x1d0df0[_0x9481('0x35')][_0x9481('0x39')]));_0x4c4caf[_0x9481('0x38')]=_0x4c4caf[_0x9481('0x38')][_0x9481('0x3a')]?_0x4c4caf[_0x9481('0x38')]:_0x4402f6[_0x9481('0x33')];if(_0x1d0df0['query'][_0x9481('0x46')]){_0x4c4caf['include']=[{'all':!![]}];}_0x4c4caf=_['merge']({},_0x4c4caf,_0x1d0df0[_0x9481('0x44')]);return db['AnalyticDefaultReport'][_0x9481('0x4d')](_0x4c4caf)[_0x9481('0x27')](handleEntityNotFound(_0x42b19a,null))['then'](respondWithResult(_0x42b19a,null))[_0x9481('0x4e')](handleError(_0x42b19a,null));};exports[_0x9481('0x4f')]=function(_0x2f3413,_0x13b674){return db[_0x9481('0x45')][_0x9481('0x4f')](_0x2f3413['body'],{})['then'](function(_0x424b22){var _0x44d7e0=_0x2f3413[_0x9481('0x50')][_0x9481('0x28')]({'plain':!![]});if(!_0x44d7e0)throw new Error(_0x9481('0x51'));if(_0x44d7e0[_0x9481('0x52')]===_0x9481('0x50')){var _0x3d2250=_0x424b22['get']({'plain':!![]});var _0x3972c1=_0x9481('0x53');return db[_0x9481('0x54')][_0x9481('0x4d')]({'where':{'name':_0x3972c1,'userProfileId':_0x44d7e0[_0x9481('0x55')]},'raw':!![]})['then'](function(_0x4c3048){if(_0x4c3048&&_0x4c3048[_0x9481('0x56')]===0x0){return db[_0x9481('0x2a')][_0x9481('0x4f')]({'name':_0x3d2250['name'],'resourceId':_0x3d2250['id'],'type':'DefaultReports','sectionId':_0x4c3048['id']},{})['then'](function(){return _0x424b22;});}else{return _0x424b22;}})['catch'](function(_0x538507){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x538507);throw _0x538507;});}return _0x424b22;})[_0x9481('0x27')](respondWithResult(_0x13b674,0xc9))[_0x9481('0x4e')](handleError(_0x13b674,null));};exports['update']=function(_0xd8351c,_0x5f210c){if(_0xd8351c[_0x9481('0x57')]['id']){delete _0xd8351c[_0x9481('0x57')]['id'];}return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0xd8351c[_0x9481('0x4b')]['id']}})[_0x9481('0x27')](handleEntityNotFound(_0x5f210c,null))[_0x9481('0x27')](saveUpdates(_0xd8351c['body'],null))[_0x9481('0x27')](respondWithResult(_0x5f210c,null))[_0x9481('0x4e')](handleError(_0x5f210c,null));};exports['destroy']=function(_0x16416a,_0x1240dc){return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0x16416a[_0x9481('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1240dc,null))[_0x9481('0x27')](removeEntity(_0x1240dc,null))[_0x9481('0x4e')](handleError(_0x1240dc,null));};exports[_0x9481('0x58')]=function(_0x3fc0f9,_0x559dd2){var _0x3ac428=0xa;var _0x2927f5=[_0x9481('0x59'),_0x9481('0x5a'),'right_join','cross_join'];var _0x5b4234={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x589b16={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x239676=function(_0x205b96){return!_['includes'](['IS\x20NULL',_0x9481('0x67'),'IS\x20EMPTY',_0x9481('0x68')],_0x205b96);};var _0x59637f=function(_0x9af916){if(!_0x9af916||!_0x9af916[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x492464='(',_0x28d331=0x0;_0x28d331<_0x9af916[_0x9481('0x69')]['length'];_0x28d331+=0x1){_0x28d331>0x0&&(_0x492464+='\x20'+_0x9af916['operator']+'\x20');_0x492464+=_0x9af916['rules'][_0x28d331]['group']?_0x59637f(_0x9af916[_0x9481('0x69')][_0x28d331]['group']):_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6a')]+'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331]['condition']+(_0x239676(_0x9af916[_0x9481('0x69')][_0x28d331]['condition'])?'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6b')]:'');}return _0x492464+')';};var _0x3c267b={'where':{'id':_0x3fc0f9[_0x9481('0x4b')]['id']}},_0x4f157d,_0x2f20b4,_0x40fed2,_0x4ff016,_0x321972;_0x3c267b=_[_0x9481('0x42')]({},_0x3c267b,_0x3fc0f9[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x3c267b)[_0x9481('0x27')](function(_0x32ebde){if(_0x32ebde){_0x4f157d=_0x32ebde;return _0x32ebde[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x237d9b){if(_0x237d9b){if(!_0x237d9b[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x2f20b4=_0x237d9b;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})['then'](function(_0x1e05f8){if(_0x1e05f8){_0x40fed2=_['keyBy'](_0x1e05f8,'id');var _0x47bf37;var _0x1a7892=squel['select']();_0x1a7892['from'](_0x4f157d['table']);for(var _0x1b1967=0x0;_0x1b1967<_0x2f20b4[_0x9481('0x3a')];_0x1b1967+=0x1){_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x71')]?_0x40fed2[_0x2f20b4[_0x1b1967][_0x9481('0x71')]]['metric']:_0x2f20b4[_0x1b1967][_0x9481('0x6a')];_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x72')]?_[_0x9481('0x73')](_0x5b4234[_0x2f20b4[_0x1b1967][_0x9481('0x72')]],'%s',_0x47bf37):_0x47bf37;_0x47bf37=_0x2f20b4[_0x1b1967]['format']?_['replace'](_0x589b16[_0x2f20b4[_0x1b1967][_0x9481('0x74')]],'%s',_0x47bf37):_0x47bf37;if(_0x2f20b4[_0x1b1967][_0x9481('0x75')]){_0x1a7892[_0x9481('0x76')](_0x47bf37);}_0x2f20b4[_0x1b1967][_0x9481('0x77')]&&_0x1a7892[_0x9481('0x3d')](_0x47bf37,_0x2f20b4[_0x1b1967]['orderBy']===_0x9481('0x78')?![]:!![]);_0x1a7892[_0x9481('0x6a')](_0x47bf37,_0x2f20b4[_0x1b1967][_0x9481('0x79')]||_0x47bf37);}if(_0x4f157d[_0x9481('0x7a')]){_0x4f157d[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x4f157d[_0x9481('0x7a')]);for(var _0x42a6d2=0x0;_0x42a6d2<_0x4f157d[_0x9481('0x7a')][_0x9481('0x3a')];_0x42a6d2+=0x1){if(_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2927f5,_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')])&&_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7d')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7e')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7f')]){_0x1a7892[_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]](_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x4f157d['table'],_0x4f157d[_0x9481('0x7a')][_0x42a6d2]['parentKey'],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7f')]));}}}if(_0x4f157d[_0x9481('0x80')]){_0x4f157d[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x4f157d['conditions']);_0x1a7892[_0x9481('0x3f')](_0x59637f(_0x4f157d['conditions'][_0x9481('0x76')]));}_0x321972=_0x1a7892[_0x9481('0x81')]();_0x1a7892[_0x9481('0x20')](_0x3ac428);_0x1a7892['offset'](0x0);logger['debug']('Limited\x20Query:',_0x1a7892[_0x9481('0x82')]());return dbH['sequelize']['query'](_0x1a7892[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')]['SELECT']});}})[_0x9481('0x27')](respondWithResult(_0x559dd2,null))[_0x9481('0x4e')](handleError(_0x559dd2,null));};function runReport(_0x545457,_0x226932,_0x3c8241){var _0x1ea93a=_0x226932[_0x9481('0x2e')];var _0x5f4be2=0xa;var _0x2e585d=['join',_0x9481('0x5a'),_0x9481('0x85'),'cross_join'];var _0x1c82a1={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x9481('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x55b428={'SEC_TO_TIME':_0x9481('0x86'),'DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9481('0x66')};var _0x31e097=function(_0x339a30){return!_[_0x9481('0x7c')]([_0x9481('0x87'),_0x9481('0x67'),_0x9481('0x88'),_0x9481('0x68')],_0x339a30);};var _0x22e787=function(_0x31b70b){if(!_0x31b70b||!_0x31b70b['rules'][_0x9481('0x3a')]){return'';}for(var _0x5c430e='(',_0x4f55b5=0x0;_0x4f55b5<_0x31b70b['rules'][_0x9481('0x3a')];_0x4f55b5+=0x1){_0x4f55b5>0x0&&(_0x5c430e+='\x20'+_0x31b70b[_0x9481('0x89')]+'\x20');_0x5c430e+=_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x76')]?_0x22e787(_0x31b70b[_0x9481('0x69')][_0x4f55b5]['group']):_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6a')]+'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')]+(_0x31e097(_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')])?'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6b')]:'');}return _0x5c430e+')';};var _0x28d924={'where':{'id':_0x545457['id']}},_0x426d56,_0x5808c8,_0x27be69,_0x1d49ba,_0x458a6f;_0x28d924=_[_0x9481('0x42')]({},_0x28d924,_0x3c8241);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x28d924)[_0x9481('0x27')](function(_0x1173e9){if(_0x1173e9){_0x426d56=_0x1173e9;return _0x1173e9[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x5557d7){if(_0x5557d7){if(!_0x5557d7[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x5808c8=_0x5557d7;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x3ae3e2){if(_0x3ae3e2){_0x27be69=_[_0x9481('0x8b')](_0x3ae3e2,'id');var _0x538fe0;var _0x44e2c2=squel['select']();_0x44e2c2['from'](_0x426d56[_0x9481('0x8c')]);for(var _0x382455=0x0;_0x382455<_0x5808c8[_0x9481('0x3a')];_0x382455+=0x1){_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x71')]?_0x27be69[_0x5808c8[_0x382455][_0x9481('0x71')]][_0x9481('0x8d')]:_0x5808c8[_0x382455]['field'];_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x72')]?_['replace'](_0x1c82a1[_0x5808c8[_0x382455][_0x9481('0x72')]],'%s',_0x538fe0):_0x538fe0;_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x74')]?_[_0x9481('0x73')](_0x55b428[_0x5808c8[_0x382455]['format']],'%s',_0x538fe0):_0x538fe0;if(_0x5808c8[_0x382455]['groupBy']){_0x44e2c2[_0x9481('0x76')](_0x538fe0);}_0x5808c8[_0x382455][_0x9481('0x77')]&&_0x44e2c2[_0x9481('0x3d')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x44e2c2[_0x9481('0x6a')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x79')]||_0x538fe0);}if(_0x426d56[_0x9481('0x7a')]){_0x426d56[_0x9481('0x7a')]=JSON['parse'](_0x426d56[_0x9481('0x7a')]);for(var _0xd64114=0x0;_0xd64114<_0x426d56['joins'][_0x9481('0x3a')];_0xd64114+=0x1){if(_0x426d56['joins'][_0xd64114][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2e585d,_0x426d56['joins'][_0xd64114][_0x9481('0x43')])&&_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')]&&_0x426d56['joins'][_0xd64114][_0x9481('0x7e')]&&_0x426d56[_0x9481('0x7a')][_0xd64114]['foreignKey']){_0x44e2c2[_0x426d56[_0x9481('0x7a')][_0xd64114]['type']](_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x426d56['table'],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7f')]));}}}if(_0x426d56['conditions']){_0x426d56[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x426d56[_0x9481('0x80')]);_0x44e2c2[_0x9481('0x3f')](_0x22e787(_0x426d56[_0x9481('0x80')][_0x9481('0x76')]));}_0x458a6f=_0x44e2c2[_0x9481('0x81')]();_0x44e2c2['limit'](_0x5f4be2);_0x44e2c2[_0x9481('0x1e')](0x0);return;}})[_0x9481('0x27')](function(){if(_0x226932[_0x9481('0x8e')]===_0x9481('0x8f')){return null;}var _0x4e5a8d=_[_0x9481('0x42')](_0x226932,{'name':_0x226932[_0x9481('0x90')]||_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],'basename':_0x1ea93a,'savename':util['format'](_0x9481('0x91'),_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],require(_0x9481('0x92'))[_0x9481('0x93')](0x4),_0x226932[_0x9481('0x8e')]||_0x9481('0x94')),'reportId':_0x426d56['id'],'reportType':_0x9481('0x95')});return db[_0x9481('0x96')][_0x9481('0x4f')](_0x4e5a8d,{'raw':!![]});})[_0x9481('0x27')](function(_0x5930d6){if(_0x426d56[_0x9481('0x8c')]==='cdr'){_0x458a6f[_0x9481('0x3f')](_0x426d56[_0x9481('0x8c')]+_0x9481('0x97'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}else{_0x458a6f['where'](_0x426d56[_0x9481('0x8c')]+_0x9481('0x9a'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}if(_0x5930d6){logger[_0x9481('0x9b')](_0x9481('0x9c'),_0x458a6f['toString']());require(_0x9481('0x9d'))[_0x9481('0x9e')](path[_0x9481('0x59')](__dirname,_0x9481('0x9f'),_0x5930d6[_0x9481('0x8e')]),[_0x5930d6['id'],_0x458a6f[_0x9481('0x82')](),path[_0x9481('0x59')](__dirname,_0x9481('0xa0'),_0x5930d6[_0x9481('0xa1')]),_0x1ea93a]);return _0x5930d6;}else{var _0x26a666=squel[_0x9481('0xa2')]();_0x26a666[_0x9481('0xa3')]('('+_0x458a6f['toString']()+')',_0x9481('0xa4'));_0x26a666[_0x9481('0x6a')](_0x9481('0xa5'),_0x9481('0x21'));_0x458a6f[_0x9481('0x20')](_0x226932[_0x9481('0x20')]||_0x5f4be2);_0x458a6f[_0x9481('0x1e')](_0x226932[_0x9481('0x1e')]||0x0);return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x26a666[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]})[_0x9481('0x27')](function(_0xcf83d2){if(!_0xcf83d2[_0x9481('0x3a')]){_0x1d49ba=0x0;}else{_0x1d49ba=_0xcf83d2[0x0][_0x9481('0x21')]||0x0;}return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x458a6f['toString'](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});})[_0x9481('0x27')](function(_0x4553fc){return{'rows':_0x4553fc||[],'count':_0x1d49ba};});}});}exports[_0x9481('0xa7')]=function(_0x55c4ab,_0x57928a){return runReport(_0x55c4ab[_0x9481('0x4b')],_0x55c4ab[_0x9481('0x35')],_0x55c4ab[_0x9481('0x44')])[_0x9481('0x27')](respondWithResult(_0x57928a,null))['catch'](handleError(_0x57928a,null));};exports['runReport']=runReport;exports['query']=function(_0x52b980,_0x5792b1){var _0x3a199b=0xa;var _0x4b779b=[_0x9481('0x59'),_0x9481('0x5a'),_0x9481('0x85'),_0x9481('0xa8')];var _0x55a65f={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':_0x9481('0xa9'),'MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x583490={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':'HOUR(%s)','ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x1e40fe=function(_0x26c87b){return!_[_0x9481('0x7c')](['IS\x20NULL',_0x9481('0x67'),_0x9481('0x88'),'IS\x20NOT\x20EMPTY'],_0x26c87b);};var _0x4ea411=function(_0x1cdca0){if(!_0x1cdca0||!_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x15c53f='(',_0x7ee854=0x0;_0x7ee854<_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')];_0x7ee854+=0x1){_0x7ee854>0x0&&(_0x15c53f+='\x20'+_0x1cdca0[_0x9481('0x89')]+'\x20');_0x15c53f+=_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x76')]?_0x4ea411(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x76')]):_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x6a')]+'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x8a')]+(_0x1e40fe(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x8a')])?'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854]['value']:'');}return _0x15c53f+')';};var _0x49a6db={'where':{'id':_0x52b980['params']['id']}},_0x224b16,_0x83543f,_0x58c043,_0x97a67a,_0xe157e4;_0x49a6db=_[_0x9481('0x42')]({},_0x49a6db,_0x52b980[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x49a6db)['then'](function(_0x1a1058){if(_0x1a1058){_0x224b16=_0x1a1058;return _0x1a1058['getFields']();}return null;})[_0x9481('0x27')](function(_0x206661){if(_0x206661){if(!_0x206661[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x83543f=_0x206661;return db['AnalyticMetric'][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x40cdf9){if(_0x40cdf9){_0x58c043=_['keyBy'](_0x40cdf9,'id');var _0x5467fe;var _0x440d88=squel['select']();_0x440d88[_0x9481('0xa3')](_0x224b16['table']);for(var _0x2a0367=0x0;_0x2a0367<_0x83543f[_0x9481('0x3a')];_0x2a0367+=0x1){_0x5467fe=_0x83543f[_0x2a0367]['MetricId']?_0x58c043[_0x83543f[_0x2a0367][_0x9481('0x71')]][_0x9481('0x8d')]:_0x83543f[_0x2a0367][_0x9481('0x6a')];_0x5467fe=_0x83543f[_0x2a0367]['function']?_[_0x9481('0x73')](_0x55a65f[_0x83543f[_0x2a0367][_0x9481('0x72')]],'%s',_0x5467fe):_0x5467fe;_0x5467fe=_0x83543f[_0x2a0367][_0x9481('0x74')]?_[_0x9481('0x73')](_0x583490[_0x83543f[_0x2a0367][_0x9481('0x74')]],'%s',_0x5467fe):_0x5467fe;if(_0x83543f[_0x2a0367][_0x9481('0x75')]){_0x440d88[_0x9481('0x76')](_0x5467fe);}_0x83543f[_0x2a0367]['orderBy']&&_0x440d88[_0x9481('0x3d')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x440d88[_0x9481('0x6a')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x79')]||_0x5467fe);}if(_0x224b16['joins']){_0x224b16[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x7a')]);for(var _0x527ef6=0x0;_0x527ef6<_0x224b16['joins'][_0x9481('0x3a')];_0x527ef6+=0x1){if(_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x4b779b,_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')])&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7d')]&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')]&&_0x224b16['joins'][_0x527ef6][_0x9481('0x7f')]){_0x440d88[_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]](_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x224b16[_0x9481('0x8c')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['parentKey'],_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['foreignKey']));}}}if(_0x224b16[_0x9481('0x80')]){_0x224b16[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x80')]);_0x440d88['where'](_0x4ea411(_0x224b16[_0x9481('0x80')][_0x9481('0x76')]));}_0xe157e4=_0x440d88[_0x9481('0x81')]();_0x440d88[_0x9481('0x20')](_0x3a199b);_0x440d88['offset'](0x0);logger[_0x9481('0xaa')](_0x9481('0xab'),_0x440d88[_0x9481('0x82')]());return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x440d88[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});}})[_0x9481('0x27')](function(){return{'sql':_0xe157e4['toString']()};})[_0x9481('0x27')](respondWithResult(_0x5792b1,null))[_0x9481('0x4e')](handleError(_0x5792b1,null));}; \ No newline at end of file +var _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','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','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0xcd9ec8,_0x27699f){var _0x5aa31b=function(_0x32f922){while(--_0x32f922){_0xcd9ec8['push'](_0xcd9ec8['shift']());}};_0x5aa31b(++_0x27699f);}(_0x7a54,0x106));var _0x47a5=function(_0x25c99c,_0x5146b3){_0x25c99c=_0x25c99c-0x0;var _0x26e4fa=_0x7a54[_0x25c99c];return _0x26e4fa;};'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'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 845669f..e207f32 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 _0x960a=['exports','define','analytics_default_reports','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x4911ed,_0x476941){var _0x230288=function(_0xcaa9c0){while(--_0xcaa9c0){_0x4911ed['push'](_0x4911ed['shift']());}};_0x230288(++_0x476941);}(_0x960a,0x147));var _0xa960=function(_0x29a619,_0x7da0d6){_0x29a619=_0x29a619-0x0;var _0x114a54=_0x960a[_0x29a619];return _0x114a54;};'use strict';var _=require('lodash');var util=require(_0xa960('0x0'));var logger=require(_0xa960('0x1'))(_0xa960('0x2'));var moment=require(_0xa960('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa960('0x4'));var config=require(_0xa960('0x5'));var attributes=require('./analyticDefaultReport.attributes');module[_0xa960('0x6')]=function(_0x16b1e4,_0x58eec8){return _0x16b1e4[_0xa960('0x7')]('AnalyticDefaultReport',attributes,{'tableName':_0xa960('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec7c=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','analytics_default_reports','lodash'];(function(_0x2bdaf6,_0x5a48fe){var _0x33c743=function(_0x26e380){while(--_0x26e380){_0x2bdaf6['push'](_0x2bdaf6['shift']());}};_0x33c743(++_0x5a48fe);}(_0xec7c,0x1c1));var _0xcec7=function(_0x32d225,_0x459300){_0x32d225=_0x32d225-0x0;var _0x22293b=_0xec7c[_0x32d225];return _0x22293b;};'use strict';var _=require(_0xcec7('0x0'));var util=require('util');var logger=require(_0xcec7('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcec7('0x2'));var rp=require(_0xcec7('0x3'));var fs=require('fs');var path=require(_0xcec7('0x4'));var rimraf=require(_0xcec7('0x5'));var config=require(_0xcec7('0x6'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x2114cc,_0x382308){return _0x2114cc[_0xcec7('0x7')]('AnalyticDefaultReport',attributes,{'tableName':_0xcec7('0x8'),'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 dd4e02a..3318169 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 _0x4e82=['jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x58a6de,_0x44b539){var _0x307315=function(_0x337119){while(--_0x337119){_0x58a6de['push'](_0x58a6de['shift']());}};_0x307315(++_0x44b539);}(_0x4e82,0x1b1));var _0x24e8=function(_0x89b396,_0x17b822){_0x89b396=_0x89b396-0x0;var _0x5e4098=_0x4e82[_0x89b396];return _0x5e4098;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x24e8('0x0'));var BPromise=require('bluebird');var rs=require(_0x24e8('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24e8('0x2'))['db'];var utils=require(_0x24e8('0x3'));var logger=require(_0x24e8('0x4'))(_0x24e8('0x5'));var config=require(_0x24e8('0x6'));var jayson=require(_0x24e8('0x7'));var client=jayson[_0x24e8('0x8')][_0x24e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9d4bd3,_0x3e8e64,_0x47b5bb){return new BPromise(function(_0x20656c,_0x5741a9){return client[_0x24e8('0xa')](_0x9d4bd3,_0x47b5bb)[_0x24e8('0xb')](function(_0x22e111){logger[_0x24e8('0xc')](_0x24e8('0xd'),_0x3e8e64,'request\x20sent');logger[_0x24e8('0xe')](_0x24e8('0xf'),_0x3e8e64,_0x24e8('0x10'),JSON[_0x24e8('0x11')](_0x22e111));if(_0x22e111['error']){if(_0x22e111['error']['code']===0x1f4){logger[_0x24e8('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3e8e64,_0x22e111[_0x24e8('0x12')][_0x24e8('0x13')]);return _0x5741a9(_0x22e111[_0x24e8('0x12')][_0x24e8('0x13')]);}logger[_0x24e8('0x12')](_0x24e8('0xd'),_0x3e8e64,_0x22e111[_0x24e8('0x12')]['message']);return _0x20656c(_0x22e111['error'][_0x24e8('0x13')]);}else{logger[_0x24e8('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3e8e64,_0x24e8('0x10'));_0x20656c(_0x22e111[_0x24e8('0x14')][_0x24e8('0x13')]);}})[_0x24e8('0x15')](function(_0x23057e){logger['error'](_0x24e8('0xd'),_0x3e8e64,_0x23057e);_0x5741a9(_0x23057e);});});} \ No newline at end of file +var _0xe93f=['debug','error','message','AnalyticDefaultReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0xe93f,0xb0));var _0xfe93=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe93f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfe93('0x0'));var util=require(_0xfe93('0x1'));var moment=require(_0xfe93('0x2'));var BPromise=require(_0xfe93('0x3'));var rs=require(_0xfe93('0x4'));var fs=require('fs');var Redis=require(_0xfe93('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe93('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfe93('0x7'));var jayson=require(_0xfe93('0x8'));var client=jayson['client'][_0xfe93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bf420,_0x22bf50,_0x19dea2){return new BPromise(function(_0x259174,_0x16b8c9){return client[_0xfe93('0xa')](_0x4bf420,_0x19dea2)[_0xfe93('0xb')](function(_0x14f334){logger[_0xfe93('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x22bf50,_0xfe93('0xd'));logger[_0xfe93('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x22bf50,'request\x20sent',JSON['stringify'](_0x14f334));if(_0x14f334[_0xfe93('0xf')]){if(_0x14f334[_0xfe93('0xf')]['code']===0x1f4){logger[_0xfe93('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x22bf50,_0x14f334[_0xfe93('0xf')][_0xfe93('0x10')]);return _0x16b8c9(_0x14f334[_0xfe93('0xf')][_0xfe93('0x10')]);}logger[_0xfe93('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x22bf50,_0x14f334[_0xfe93('0xf')][_0xfe93('0x10')]);return _0x259174(_0x14f334['error'][_0xfe93('0x10')]);}else{logger[_0xfe93('0xc')](_0xfe93('0x11'),_0x22bf50,'request\x20sent');_0x259174(_0x14f334[_0xfe93('0x12')][_0xfe93('0x10')]);}})['catch'](function(_0x1f4249){logger[_0xfe93('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x22bf50,_0x1f4249);_0x16b8c9(_0x1f4249);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 3123dfe..f28bfd3 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 _0xc94b=['/:id/preview','isAuthenticated','preview','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','show'];(function(_0x468550,_0x4a650e){var _0x3e9700=function(_0x376ef6){while(--_0x376ef6){_0x468550['push'](_0x468550['shift']());}};_0x3e9700(++_0x4a650e);}(_0xc94b,0x17a));var _0xbc94=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xc94b[_0x24259d];return _0x5a701;};'use strict';var multer=require(_0xbc94('0x0'));var util=require(_0xbc94('0x1'));var path=require(_0xbc94('0x2'));var timeout=require(_0xbc94('0x3'));var express=require(_0xbc94('0x4'));var router=express['Router']();var fs_extra=require(_0xbc94('0x5'));var auth=require(_0xbc94('0x6'));var interaction=require(_0xbc94('0x7'));var config=require(_0xbc94('0x8'));var controller=require(_0xbc94('0x9'));router[_0xbc94('0xa')]('/',auth['isAuthenticated'](),controller[_0xbc94('0xb')]);router[_0xbc94('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xbc94('0xc')]);router['get'](_0xbc94('0xd'),auth[_0xbc94('0xe')](),controller[_0xbc94('0xf')]);router['get']('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0xbc94('0xa')]('/:id/query',auth[_0xbc94('0xe')](),controller['query']);router[_0xbc94('0x10')]('/',auth[_0xbc94('0xe')](),controller[_0xbc94('0x11')]);router[_0xbc94('0x12')](_0xbc94('0x13'),auth[_0xbc94('0xe')](),controller['update']);router[_0xbc94('0x14')]('/:id',auth[_0xbc94('0xe')](),controller[_0xbc94('0x15')]);module[_0xbc94('0x16')]=router; \ No newline at end of file +var _0xe84a=['/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/query','query','post','create','put'];(function(_0x4e6fb2,_0x3cf23e){var _0x2f1636=function(_0x53c7eb){while(--_0x53c7eb){_0x4e6fb2['push'](_0x4e6fb2['shift']());}};_0x2f1636(++_0x3cf23e);}(_0xe84a,0x113));var _0xae84=function(_0x271575,_0x181a21){_0x271575=_0x271575-0x0;var _0x1cd7d2=_0xe84a[_0x271575];return _0x1cd7d2;};'use strict';var multer=require(_0xae84('0x0'));var util=require(_0xae84('0x1'));var path=require(_0xae84('0x2'));var timeout=require(_0xae84('0x3'));var express=require(_0xae84('0x4'));var router=express[_0xae84('0x5')]();var fs_extra=require(_0xae84('0x6'));var auth=require(_0xae84('0x7'));var interaction=require(_0xae84('0x8'));var config=require(_0xae84('0x9'));var controller=require('./analyticDefaultReport.controller');router[_0xae84('0xa')]('/',auth['isAuthenticated'](),controller[_0xae84('0xb')]);router[_0xae84('0xa')]('/:id',auth[_0xae84('0xc')](),controller[_0xae84('0xd')]);router[_0xae84('0xa')]('/:id/preview',auth[_0xae84('0xc')](),controller['preview']);router[_0xae84('0xa')]('/:id/run',auth[_0xae84('0xc')](),controller['run']);router[_0xae84('0xa')](_0xae84('0xe'),auth[_0xae84('0xc')](),controller[_0xae84('0xf')]);router[_0xae84('0x10')]('/',auth[_0xae84('0xc')](),controller[_0xae84('0x11')]);router[_0xae84('0x12')](_0xae84('0x13'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xae84('0x13'),auth[_0xae84('0xc')](),controller[_0xae84('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index a324ab5..2fd36f6 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 _0x0c5e=['ENUM','manual','scheduled','UNSIGNED','moment','exports','STRING','pdf','csv','DATE','Loading'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c5e,0xd5));var _0xe0c5=function(_0x505a7d,_0x25e11f){_0x505a7d=_0x505a7d-0x0;var _0x17d880=_0x0c5e[_0x505a7d];return _0x17d880;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe0c5('0x0'));module[_0xe0c5('0x1')]={'name':{'type':Sequelize[_0xe0c5('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xe0c5('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0xe0c5('0x3'),'xlsx'),'allowNull':![],'defaultValue':_0xe0c5('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xe0c5('0x5')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xe0c5('0x2')],'defaultValue':_0xe0c5('0x6')},'type':{'type':Sequelize[_0xe0c5('0x7')](_0xe0c5('0x8'),_0xe0c5('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xe0c5('0xa')]},'reportType':{'type':Sequelize[_0xe0c5('0x2')]}}; \ No newline at end of file +var _0x38c9=['UNSIGNED','sequelize','csv','pdf','xlsx','STRING','DATE','ENUM','manual','scheduled'];(function(_0x444625,_0x517882){var _0x1730f2=function(_0x271845){while(--_0x271845){_0x444625['push'](_0x444625['shift']());}};_0x1730f2(++_0x517882);}(_0x38c9,0x10f));var _0x938c=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0x38c9[_0x21af3a];return _0x268a49;};'use strict';var Sequelize=require(_0x938c('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x938c('0x1'),_0x938c('0x2'),_0x938c('0x3')),'allowNull':![],'defaultValue':_0x938c('0x1')},'savename':{'type':Sequelize[_0x938c('0x4')],'allowNull':![]},'startDate':{'type':Sequelize[_0x938c('0x5')]},'endDate':{'type':Sequelize[_0x938c('0x5')]},'status':{'type':Sequelize[_0x938c('0x4')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x938c('0x6')](_0x938c('0x7'),_0x938c('0x8')),'allowNull':![],'defaultValue':_0x938c('0x7')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x938c('0x9')]},'reportType':{'type':Sequelize[_0x938c('0x4')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index be64039..9ac279f 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 _0x78bc=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','ExtractedReports','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','where','filter','merge','options','AnalyticExtractedReport','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0x78bc,0x1ef));var _0xc78b=function(_0x19f55e,_0xd4ffc3){_0x19f55e=_0x19f55e-0x0;var _0x44cfee=_0x78bc[_0x19f55e];return _0x44cfee;};'use strict';var emlformat=require(_0xc78b('0x0'));var rimraf=require(_0xc78b('0x1'));var zipdir=require(_0xc78b('0x2'));var jsonpatch=require(_0xc78b('0x3'));var rp=require(_0xc78b('0x4'));var moment=require('moment');var BPromise=require(_0xc78b('0x5'));var Mustache=require(_0xc78b('0x6'));var util=require(_0xc78b('0x7'));var path=require(_0xc78b('0x8'));var sox=require(_0xc78b('0x9'));var csv=require(_0xc78b('0xa'));var ejs=require(_0xc78b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc78b('0xc'));var squel=require(_0xc78b('0xd'));var crypto=require(_0xc78b('0xe'));var jsforce=require(_0xc78b('0xf'));var deskjs=require(_0xc78b('0x10'));var toCsv=require(_0xc78b('0xa'));var querystring=require(_0xc78b('0x11'));var Papa=require(_0xc78b('0x12'));var Redis=require('ioredis');var authService=require(_0xc78b('0x13'));var qs=require(_0xc78b('0x14'));var as=require(_0xc78b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc78b('0x16'))('api');var utils=require(_0xc78b('0x17'));var config=require(_0xc78b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc78b('0x19'))['db'];function respondWithStatusCode(_0x3c2953,_0x54254f){_0x54254f=_0x54254f||0xcc;return function(_0x9e6de0){if(_0x9e6de0){return _0x3c2953[_0xc78b('0x1a')](_0x54254f);}return _0x3c2953[_0xc78b('0x1b')](_0x54254f)[_0xc78b('0x1c')]();};}function respondWithResult(_0x4cde1d,_0x5c9503){_0x5c9503=_0x5c9503||0xc8;return function(_0x41893e){if(_0x41893e){return _0x4cde1d['status'](_0x5c9503)['json'](_0x41893e);}};}function respondWithFilteredResult(_0x1328f3,_0x48ff04){return function(_0x383214){if(_0x383214){var _0x40f7e7=typeof _0x48ff04[_0xc78b('0x1d')]===_0xc78b('0x1e')&&typeof _0x48ff04['limit']===_0xc78b('0x1e');var _0x48228e=_0x383214[_0xc78b('0x1f')];var _0x9ad5fc=_0x40f7e7?0x0:_0x48ff04[_0xc78b('0x1d')];var _0x49fc13=_0x40f7e7?_0x383214['count']:_0x48ff04[_0xc78b('0x1d')]+_0x48ff04[_0xc78b('0x20')];var _0x5e5f77;if(_0x49fc13>=_0x48228e){_0x49fc13=_0x48228e;_0x5e5f77=0xc8;}else{_0x5e5f77=0xce;}_0x1328f3[_0xc78b('0x1b')](_0x5e5f77);return _0x1328f3[_0xc78b('0x21')](_0xc78b('0x22'),_0x9ad5fc+'-'+_0x49fc13+'/'+_0x48228e)[_0xc78b('0x23')](_0x383214);}return null;};}function patchUpdates(_0x53ea6d){return function(_0x59df5f){try{jsonpatch[_0xc78b('0x24')](_0x59df5f,_0x53ea6d,!![]);}catch(_0x522269){return BPromise[_0xc78b('0x25')](_0x522269);}return _0x59df5f[_0xc78b('0x26')]();};}function saveUpdates(_0x44277b,_0x364ee3){return function(_0x160e4f){if(_0x160e4f){return _0x160e4f['update'](_0x44277b)[_0xc78b('0x27')](function(_0x5f1b8f){return _0x5f1b8f;});}return null;};}function removeEntity(_0xf3ab0f,_0x25dad7){return function(_0x199fff){if(_0x199fff){return _0x199fff[_0xc78b('0x28')]()[_0xc78b('0x27')](function(){var _0x2191e4=_0x199fff[_0xc78b('0x29')]({'plain':!![]});var _0x2e039d=_0xc78b('0x2a');return db['UserProfileResource'][_0xc78b('0x28')]({'where':{'type':_0x2e039d,'resourceId':_0x2191e4['id']}})[_0xc78b('0x27')](function(){return _0x199fff;});})[_0xc78b('0x27')](function(){_0xf3ab0f[_0xc78b('0x1b')](0xcc)[_0xc78b('0x1c')]();});}};}function handleEntityNotFound(_0x4756d0,_0xd4c6ff){return function(_0x44f9aa){if(!_0x44f9aa){_0x4756d0[_0xc78b('0x1a')](0x194);}return _0x44f9aa;};}function handleError(_0xa73865,_0x3d283f){_0x3d283f=_0x3d283f||0x1f4;return function(_0x1d93da){logger[_0xc78b('0x2b')](_0x1d93da[_0xc78b('0x2c')]);if(_0x1d93da[_0xc78b('0x2d')]){delete _0x1d93da[_0xc78b('0x2d')];}_0xa73865[_0xc78b('0x1b')](_0x3d283f)[_0xc78b('0x2e')](_0x1d93da);};}exports[_0xc78b('0x2f')]=function(_0x3aee9a,_0x2c07bf){var _0x589990={},_0x25b71f={},_0x3a673e={'count':0x0,'rows':[]};var _0x40d378=_[_0xc78b('0x30')](db['AnalyticExtractedReport'][_0xc78b('0x31')],function(_0x453209){return{'name':_0x453209[_0xc78b('0x32')],'type':_0x453209[_0xc78b('0x33')]['key']};});_0x25b71f[_0xc78b('0x34')]=_[_0xc78b('0x30')](_0x40d378,'name');_0x25b71f[_0xc78b('0x35')]=_[_0xc78b('0x36')](_0x3aee9a['query']);_0x25b71f[_0xc78b('0x37')]=_[_0xc78b('0x38')](_0x25b71f[_0xc78b('0x34')],_0x25b71f[_0xc78b('0x35')]);_0x589990['attributes']=_[_0xc78b('0x38')](_0x25b71f[_0xc78b('0x34')],qs[_0xc78b('0x39')](_0x3aee9a['query'][_0xc78b('0x39')]));_0x589990[_0xc78b('0x3a')]=_0x589990[_0xc78b('0x3a')]['length']?_0x589990[_0xc78b('0x3a')]:_0x25b71f[_0xc78b('0x34')];if(!_0x3aee9a[_0xc78b('0x35')]['hasOwnProperty'](_0xc78b('0x3b'))){_0x589990[_0xc78b('0x20')]=qs[_0xc78b('0x20')](_0x3aee9a['query'][_0xc78b('0x20')]);_0x589990[_0xc78b('0x1d')]=qs['offset'](_0x3aee9a[_0xc78b('0x35')][_0xc78b('0x1d')]);}_0x589990[_0xc78b('0x3c')]=qs['sort'](_0x3aee9a[_0xc78b('0x35')]['sort']);_0x589990[_0xc78b('0x3d')]=qs[_0xc78b('0x37')](_['pick'](_0x3aee9a[_0xc78b('0x35')],_0x25b71f['filters']),_0x40d378);if(_0x3aee9a['query'][_0xc78b('0x3e')]){_0x589990['where']=_[_0xc78b('0x3f')](_0x589990['where'],{'$or':_[_0xc78b('0x30')](_0x40d378,function(_0x1cab17){if(_0x1cab17[_0xc78b('0x33')]!=='VIRTUAL'){var _0x53b82d={};_0x53b82d[_0x1cab17[_0xc78b('0x2d')]]={'$like':'%'+_0x3aee9a[_0xc78b('0x35')][_0xc78b('0x3e')]+'%'};return _0x53b82d;}})});}_0x589990=_[_0xc78b('0x3f')]({},_0x589990,_0x3aee9a[_0xc78b('0x40')]);var _0x350bdd={'where':_0x589990[_0xc78b('0x3d')]};return db[_0xc78b('0x41')][_0xc78b('0x1f')](_0x350bdd)['then'](function(_0x797979){_0x3a673e[_0xc78b('0x1f')]=_0x797979;if(_0x3aee9a[_0xc78b('0x35')][_0xc78b('0x42')]){_0x589990[_0xc78b('0x43')]=[{'all':!![]}];}return db[_0xc78b('0x41')]['findAll'](_0x589990);})[_0xc78b('0x27')](function(_0x47f709){_0x3a673e[_0xc78b('0x44')]=_0x47f709;return _0x3a673e;})[_0xc78b('0x27')](respondWithFilteredResult(_0x2c07bf,_0x589990))[_0xc78b('0x45')](handleError(_0x2c07bf,null));};exports[_0xc78b('0x46')]=function(_0x53aec8,_0x1b145c){var _0x4212b9={'raw':!![],'where':{'id':_0x53aec8[_0xc78b('0x47')]['id']}},_0x17636d={};_0x17636d['model']=_[_0xc78b('0x36')](db[_0xc78b('0x41')][_0xc78b('0x31')]);_0x17636d[_0xc78b('0x35')]=_['keys'](_0x53aec8['query']);_0x17636d[_0xc78b('0x37')]=_[_0xc78b('0x38')](_0x17636d['model'],_0x17636d['query']);_0x4212b9[_0xc78b('0x3a')]=_[_0xc78b('0x38')](_0x17636d[_0xc78b('0x34')],qs[_0xc78b('0x39')](_0x53aec8[_0xc78b('0x35')][_0xc78b('0x39')]));_0x4212b9[_0xc78b('0x3a')]=_0x4212b9[_0xc78b('0x3a')]['length']?_0x4212b9[_0xc78b('0x3a')]:_0x17636d[_0xc78b('0x34')];if(_0x53aec8['query'][_0xc78b('0x42')]){_0x4212b9[_0xc78b('0x43')]=[{'all':!![]}];}_0x4212b9=_[_0xc78b('0x3f')]({},_0x4212b9,_0x53aec8[_0xc78b('0x40')]);return db[_0xc78b('0x41')][_0xc78b('0x48')](_0x4212b9)[_0xc78b('0x27')](handleEntityNotFound(_0x1b145c,null))[_0xc78b('0x27')](respondWithResult(_0x1b145c,null))[_0xc78b('0x45')](handleError(_0x1b145c,null));};exports[_0xc78b('0x49')]=function(_0x25b32c,_0x132a31){return db[_0xc78b('0x41')][_0xc78b('0x49')](_0x25b32c[_0xc78b('0x4a')],{})[_0xc78b('0x27')](function(_0x47dff7){var _0x31b83e=_0x25b32c[_0xc78b('0x4b')][_0xc78b('0x29')]({'plain':!![]});if(!_0x31b83e)throw new Error(_0xc78b('0x4c'));if(_0x31b83e[_0xc78b('0x4d')]===_0xc78b('0x4b')){var _0x27510a=_0x47dff7[_0xc78b('0x29')]({'plain':!![]});var _0x3d1c09='ExtractedReports';return db[_0xc78b('0x4e')][_0xc78b('0x48')]({'where':{'name':_0x3d1c09,'userProfileId':_0x31b83e[_0xc78b('0x4f')]},'raw':!![]})[_0xc78b('0x27')](function(_0x25de67){if(_0x25de67&&_0x25de67[_0xc78b('0x50')]===0x0){return db['UserProfileResource'][_0xc78b('0x49')]({'name':_0x27510a[_0xc78b('0x2d')],'resourceId':_0x27510a['id'],'type':_0x25de67[_0xc78b('0x2d')],'sectionId':_0x25de67['id']},{})['then'](function(){return _0x47dff7;});}else{return _0x47dff7;}})[_0xc78b('0x45')](function(_0x4e197f){logger[_0xc78b('0x2b')](_0xc78b('0x51'),_0x4e197f);throw _0x4e197f;});}return _0x47dff7;})['then'](respondWithResult(_0x132a31,0xc9))['catch'](handleError(_0x132a31,null));};exports[_0xc78b('0x52')]=function(_0x189946,_0x37f930){if(_0x189946['body']['id']){delete _0x189946[_0xc78b('0x4a')]['id'];}return db[_0xc78b('0x41')]['find']({'where':{'id':_0x189946[_0xc78b('0x47')]['id']}})[_0xc78b('0x27')](handleEntityNotFound(_0x37f930,null))[_0xc78b('0x27')](saveUpdates(_0x189946[_0xc78b('0x4a')],null))[_0xc78b('0x27')](respondWithResult(_0x37f930,null))[_0xc78b('0x45')](handleError(_0x37f930,null));};exports['destroy']=function(_0x19a94a,_0x145e64){return db[_0xc78b('0x41')][_0xc78b('0x48')]({'where':{'id':_0x19a94a['params']['id']}})[_0xc78b('0x27')](handleEntityNotFound(_0x145e64,null))[_0xc78b('0x27')](removeEntity(_0x145e64,null))[_0xc78b('0x45')](handleError(_0x145e64,null));};exports[_0xc78b('0x53')]=function(_0xc629a,_0x9f6fd6,_0x2a3a15){return db[_0xc78b('0x41')][_0xc78b('0x48')]({'where':{'id':_0xc629a[_0xc78b('0x47')]['id']},'attributes':[_0xc78b('0x2d'),'basename',_0xc78b('0x54'),_0xc78b('0x55')],'raw':!![]})[_0xc78b('0x27')](handleEntityNotFound(_0x9f6fd6,null))[_0xc78b('0x27')](function(_0x56fab9){if(_0x56fab9){if(!fs[_0xc78b('0x56')](path[_0xc78b('0x57')](config[_0xc78b('0x58')],_0xc78b('0x59'),_0x56fab9['savename']))){throw new db[(_0xc78b('0x5a'))][(_0xc78b('0x5b'))](_0xc78b('0x5c'));}if(_0xc629a['query'][_0xc78b('0x5d')]){return _0x9f6fd6[_0xc78b('0x1a')](0xc8);}return _0x9f6fd6[_0xc78b('0x53')](path['join'](config[_0xc78b('0x58')],_0xc78b('0x59'),_0x56fab9[_0xc78b('0x54')]),util[_0xc78b('0x5e')]('%s.%s',_0x56fab9['basename']||_0x56fab9[_0xc78b('0x2d')],_0x56fab9['output'][_0xc78b('0x5f')]()));}})['catch'](handleError(_0x9f6fd6,null));}; \ No newline at end of file +var _0xa593=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','name','AnalyticExtractedReport','rawAttributes','fieldName','key','model','map','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','filter','merge','options','includeAll','findAll','catch','show','keys','fields','include','find','body','user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x48de6b,_0x336431){var _0x501fcc=function(_0x4aa33b){while(--_0x4aa33b){_0x48de6b['push'](_0x48de6b['shift']());}};_0x501fcc(++_0x336431);}(_0xa593,0x175));var _0x3a59=function(_0x4d8f76,_0x2663fb){_0x4d8f76=_0x4d8f76-0x0;var _0x4a2345=_0xa593[_0x4d8f76];return _0x4a2345;};'use strict';var emlformat=require(_0x3a59('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3a59('0x1'));var rp=require(_0x3a59('0x2'));var moment=require('moment');var BPromise=require(_0x3a59('0x3'));var Mustache=require(_0x3a59('0x4'));var util=require(_0x3a59('0x5'));var path=require(_0x3a59('0x6'));var sox=require('sox');var csv=require(_0x3a59('0x7'));var ejs=require(_0x3a59('0x8'));var fs=require('fs');var fs_extra=require(_0x3a59('0x9'));var _=require(_0x3a59('0xa'));var squel=require(_0x3a59('0xb'));var crypto=require(_0x3a59('0xc'));var jsforce=require(_0x3a59('0xd'));var deskjs=require(_0x3a59('0xe'));var toCsv=require(_0x3a59('0x7'));var querystring=require(_0x3a59('0xf'));var Papa=require('papaparse');var Redis=require(_0x3a59('0x10'));var authService=require(_0x3a59('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3a59('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a59('0x13'))(_0x3a59('0x14'));var utils=require(_0x3a59('0x15'));var config=require(_0x3a59('0x16'));var licenseUtil=require(_0x3a59('0x17'));var db=require(_0x3a59('0x18'))['db'];function respondWithStatusCode(_0x3f3006,_0x3e4ae7){_0x3e4ae7=_0x3e4ae7||0xcc;return function(_0x58d751){if(_0x58d751){return _0x3f3006[_0x3a59('0x19')](_0x3e4ae7);}return _0x3f3006[_0x3a59('0x1a')](_0x3e4ae7)[_0x3a59('0x1b')]();};}function respondWithResult(_0x514b5f,_0x5b21cf){_0x5b21cf=_0x5b21cf||0xc8;return function(_0x11cd01){if(_0x11cd01){return _0x514b5f[_0x3a59('0x1a')](_0x5b21cf)[_0x3a59('0x1c')](_0x11cd01);}};}function respondWithFilteredResult(_0xe5aadf,_0x301aa7){return function(_0x5205f6){if(_0x5205f6){var _0x23d94d=typeof _0x301aa7[_0x3a59('0x1d')]==='undefined'&&typeof _0x301aa7[_0x3a59('0x1e')]===_0x3a59('0x1f');var _0x5ea7af=_0x5205f6[_0x3a59('0x20')];var _0x1ad69b=_0x23d94d?0x0:_0x301aa7[_0x3a59('0x1d')];var _0x3eee23=_0x23d94d?_0x5205f6['count']:_0x301aa7['offset']+_0x301aa7[_0x3a59('0x1e')];var _0x3c27c6;if(_0x3eee23>=_0x5ea7af){_0x3eee23=_0x5ea7af;_0x3c27c6=0xc8;}else{_0x3c27c6=0xce;}_0xe5aadf[_0x3a59('0x1a')](_0x3c27c6);return _0xe5aadf[_0x3a59('0x21')](_0x3a59('0x22'),_0x1ad69b+'-'+_0x3eee23+'/'+_0x5ea7af)[_0x3a59('0x1c')](_0x5205f6);}return null;};}function patchUpdates(_0x19b7df){return function(_0x54c5fe){try{jsonpatch['apply'](_0x54c5fe,_0x19b7df,!![]);}catch(_0x48de4f){return BPromise[_0x3a59('0x23')](_0x48de4f);}return _0x54c5fe[_0x3a59('0x24')]();};}function saveUpdates(_0x56ded0,_0xd83e47){return function(_0x815e2){if(_0x815e2){return _0x815e2[_0x3a59('0x25')](_0x56ded0)[_0x3a59('0x26')](function(_0x41a1dc){return _0x41a1dc;});}return null;};}function removeEntity(_0x285930,_0x3d3168){return function(_0x5cd755){if(_0x5cd755){return _0x5cd755[_0x3a59('0x27')]()['then'](function(){var _0x4a14b2=_0x5cd755[_0x3a59('0x28')]({'plain':!![]});var _0x4723bb=_0x3a59('0x29');return db[_0x3a59('0x2a')][_0x3a59('0x27')]({'where':{'type':_0x4723bb,'resourceId':_0x4a14b2['id']}})[_0x3a59('0x26')](function(){return _0x5cd755;});})[_0x3a59('0x26')](function(){_0x285930[_0x3a59('0x1a')](0xcc)[_0x3a59('0x1b')]();});}};}function handleEntityNotFound(_0x3733bc,_0x5a8beb){return function(_0x45d584){if(!_0x45d584){_0x3733bc[_0x3a59('0x19')](0x194);}return _0x45d584;};}function handleError(_0x2fa478,_0x5c5132){_0x5c5132=_0x5c5132||0x1f4;return function(_0x3a8716){logger[_0x3a59('0x2b')](_0x3a8716['stack']);if(_0x3a8716[_0x3a59('0x2c')]){delete _0x3a8716[_0x3a59('0x2c')];}_0x2fa478[_0x3a59('0x1a')](_0x5c5132)['send'](_0x3a8716);};}exports['index']=function(_0x313047,_0x14d301){var _0x45af77={},_0x493550={},_0x6a6130={'count':0x0,'rows':[]};var _0x1d61d0=_['map'](db[_0x3a59('0x2d')][_0x3a59('0x2e')],function(_0x118e3d){return{'name':_0x118e3d[_0x3a59('0x2f')],'type':_0x118e3d['type'][_0x3a59('0x30')]};});_0x493550[_0x3a59('0x31')]=_[_0x3a59('0x32')](_0x1d61d0,_0x3a59('0x2c'));_0x493550[_0x3a59('0x33')]=_['keys'](_0x313047[_0x3a59('0x33')]);_0x493550['filters']=_[_0x3a59('0x34')](_0x493550[_0x3a59('0x31')],_0x493550[_0x3a59('0x33')]);_0x45af77[_0x3a59('0x35')]=_[_0x3a59('0x34')](_0x493550['model'],qs['fields'](_0x313047[_0x3a59('0x33')]['fields']));_0x45af77[_0x3a59('0x35')]=_0x45af77[_0x3a59('0x35')][_0x3a59('0x36')]?_0x45af77[_0x3a59('0x35')]:_0x493550[_0x3a59('0x31')];if(!_0x313047[_0x3a59('0x33')][_0x3a59('0x37')](_0x3a59('0x38'))){_0x45af77[_0x3a59('0x1e')]=qs['limit'](_0x313047[_0x3a59('0x33')][_0x3a59('0x1e')]);_0x45af77[_0x3a59('0x1d')]=qs['offset'](_0x313047[_0x3a59('0x33')]['offset']);}_0x45af77[_0x3a59('0x39')]=qs[_0x3a59('0x3a')](_0x313047['query']['sort']);_0x45af77[_0x3a59('0x3b')]=qs[_0x3a59('0x3c')](_[_0x3a59('0x3d')](_0x313047[_0x3a59('0x33')],_0x493550[_0x3a59('0x3c')]),_0x1d61d0);if(_0x313047[_0x3a59('0x33')]['filter']){_0x45af77[_0x3a59('0x3b')]=_['merge'](_0x45af77['where'],{'$or':_[_0x3a59('0x32')](_0x1d61d0,function(_0x4a2bf2){if(_0x4a2bf2[_0x3a59('0x3e')]!=='VIRTUAL'){var _0x412172={};_0x412172[_0x4a2bf2['name']]={'$like':'%'+_0x313047[_0x3a59('0x33')][_0x3a59('0x3f')]+'%'};return _0x412172;}})});}_0x45af77=_[_0x3a59('0x40')]({},_0x45af77,_0x313047[_0x3a59('0x41')]);var _0x164756={'where':_0x45af77[_0x3a59('0x3b')]};return db['AnalyticExtractedReport'][_0x3a59('0x20')](_0x164756)[_0x3a59('0x26')](function(_0x12acf7){_0x6a6130[_0x3a59('0x20')]=_0x12acf7;if(_0x313047[_0x3a59('0x33')][_0x3a59('0x42')]){_0x45af77['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x3a59('0x43')](_0x45af77);})[_0x3a59('0x26')](function(_0x4b9494){_0x6a6130['rows']=_0x4b9494;return _0x6a6130;})[_0x3a59('0x26')](respondWithFilteredResult(_0x14d301,_0x45af77))[_0x3a59('0x44')](handleError(_0x14d301,null));};exports[_0x3a59('0x45')]=function(_0x335243,_0x47a32f){var _0x477beb={'raw':!![],'where':{'id':_0x335243['params']['id']}},_0x135c3b={};_0x135c3b[_0x3a59('0x31')]=_[_0x3a59('0x46')](db['AnalyticExtractedReport']['rawAttributes']);_0x135c3b[_0x3a59('0x33')]=_[_0x3a59('0x46')](_0x335243[_0x3a59('0x33')]);_0x135c3b[_0x3a59('0x3c')]=_[_0x3a59('0x34')](_0x135c3b[_0x3a59('0x31')],_0x135c3b['query']);_0x477beb['attributes']=_[_0x3a59('0x34')](_0x135c3b[_0x3a59('0x31')],qs['fields'](_0x335243[_0x3a59('0x33')][_0x3a59('0x47')]));_0x477beb[_0x3a59('0x35')]=_0x477beb[_0x3a59('0x35')][_0x3a59('0x36')]?_0x477beb[_0x3a59('0x35')]:_0x135c3b[_0x3a59('0x31')];if(_0x335243['query']['includeAll']){_0x477beb[_0x3a59('0x48')]=[{'all':!![]}];}_0x477beb=_['merge']({},_0x477beb,_0x335243['options']);return db[_0x3a59('0x2d')][_0x3a59('0x49')](_0x477beb)[_0x3a59('0x26')](handleEntityNotFound(_0x47a32f,null))[_0x3a59('0x26')](respondWithResult(_0x47a32f,null))[_0x3a59('0x44')](handleError(_0x47a32f,null));};exports['create']=function(_0x51f62f,_0x535006){return db['AnalyticExtractedReport']['create'](_0x51f62f[_0x3a59('0x4a')],{})['then'](function(_0x230706){var _0x1e70ae=_0x51f62f[_0x3a59('0x4b')][_0x3a59('0x28')]({'plain':!![]});if(!_0x1e70ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e70ae[_0x3a59('0x4c')]===_0x3a59('0x4b')){var _0x215471=_0x230706[_0x3a59('0x28')]({'plain':!![]});var _0x443930=_0x3a59('0x29');return db[_0x3a59('0x4d')][_0x3a59('0x49')]({'where':{'name':_0x443930,'userProfileId':_0x1e70ae['userProfileId']},'raw':!![]})['then'](function(_0x2a0385){if(_0x2a0385&&_0x2a0385['autoAssociation']===0x0){return db['UserProfileResource'][_0x3a59('0x4e')]({'name':_0x215471['name'],'resourceId':_0x215471['id'],'type':_0x2a0385[_0x3a59('0x2c')],'sectionId':_0x2a0385['id']},{})[_0x3a59('0x26')](function(){return _0x230706;});}else{return _0x230706;}})[_0x3a59('0x44')](function(_0x5ab818){logger[_0x3a59('0x2b')](_0x3a59('0x4f'),_0x5ab818);throw _0x5ab818;});}return _0x230706;})[_0x3a59('0x26')](respondWithResult(_0x535006,0xc9))[_0x3a59('0x44')](handleError(_0x535006,null));};exports[_0x3a59('0x25')]=function(_0x347417,_0x59a03c){if(_0x347417[_0x3a59('0x4a')]['id']){delete _0x347417['body']['id'];}return db[_0x3a59('0x2d')][_0x3a59('0x49')]({'where':{'id':_0x347417[_0x3a59('0x50')]['id']}})['then'](handleEntityNotFound(_0x59a03c,null))[_0x3a59('0x26')](saveUpdates(_0x347417[_0x3a59('0x4a')],null))[_0x3a59('0x26')](respondWithResult(_0x59a03c,null))['catch'](handleError(_0x59a03c,null));};exports['destroy']=function(_0x1e924a,_0x3df7ee){return db[_0x3a59('0x2d')][_0x3a59('0x49')]({'where':{'id':_0x1e924a[_0x3a59('0x50')]['id']}})[_0x3a59('0x26')](handleEntityNotFound(_0x3df7ee,null))[_0x3a59('0x26')](removeEntity(_0x3df7ee,null))[_0x3a59('0x44')](handleError(_0x3df7ee,null));};exports[_0x3a59('0x51')]=function(_0x4bcb85,_0x2c1185,_0x4b9220){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x4bcb85[_0x3a59('0x50')]['id']},'attributes':[_0x3a59('0x2c'),_0x3a59('0x52'),_0x3a59('0x53'),_0x3a59('0x54')],'raw':!![]})[_0x3a59('0x26')](handleEntityNotFound(_0x2c1185,null))[_0x3a59('0x26')](function(_0x491403){if(_0x491403){if(!fs[_0x3a59('0x55')](path[_0x3a59('0x56')](config[_0x3a59('0x57')],_0x3a59('0x58'),_0x491403[_0x3a59('0x53')]))){throw new db[(_0x3a59('0x59'))][(_0x3a59('0x5a'))](_0x3a59('0x5b'));}if(_0x4bcb85['query'][_0x3a59('0x5c')]){return _0x2c1185['sendStatus'](0xc8);}return _0x2c1185[_0x3a59('0x51')](path['join'](config[_0x3a59('0x57')],'server/files/reports',_0x491403[_0x3a59('0x53')]),util['format'](_0x3a59('0x5d'),_0x491403['basename']||_0x491403[_0x3a59('0x2c')],_0x491403[_0x3a59('0x54')][_0x3a59('0x5e')]()));}})['catch'](handleError(_0x2c1185,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 92adae3..1222d71 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 _0x005c=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1bec0d,_0x338db4){var _0x49e3e3=function(_0x372c7a){while(--_0x372c7a){_0x1bec0d['push'](_0x1bec0d['shift']());}};_0x49e3e3(++_0x338db4);}(_0x005c,0xfe));var _0xc005=function(_0x127282,_0x5c6feb){_0x127282=_0x127282-0x0;var _0x1a04fe=_0x005c[_0x127282];return _0x1a04fe;};'use strict';var _=require('lodash');var util=require(_0xc005('0x0'));var logger=require(_0xc005('0x1'))(_0xc005('0x2'));var moment=require('moment');var BPromise=require(_0xc005('0x3'));var rp=require(_0xc005('0x4'));var fs=require('fs');var path=require(_0xc005('0x5'));var rimraf=require(_0xc005('0x6'));var config=require(_0xc005('0x7'));var attributes=require(_0xc005('0x8'));module[_0xc005('0x9')]=function(_0x5519c2,_0x829e88){return _0x5519c2[_0xc005('0xa')](_0xc005('0xb'),attributes,{'tableName':_0xc005('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a15=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','api','moment','bluebird','path'];(function(_0x4eeb93,_0x197bcf){var _0x58a715=function(_0x54491c){while(--_0x54491c){_0x4eeb93['push'](_0x4eeb93['shift']());}};_0x58a715(++_0x197bcf);}(_0x2a15,0x132));var _0x52a1=function(_0x210b5e,_0x13cec9){_0x210b5e=_0x210b5e-0x0;var _0x1bc407=_0x2a15[_0x210b5e];return _0x1bc407;};'use strict';var _=require(_0x52a1('0x0'));var util=require(_0x52a1('0x1'));var logger=require('../../config/logger')(_0x52a1('0x2'));var moment=require(_0x52a1('0x3'));var BPromise=require(_0x52a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52a1('0x5'));var rimraf=require(_0x52a1('0x6'));var config=require(_0x52a1('0x7'));var attributes=require(_0x52a1('0x8'));module[_0x52a1('0x9')]=function(_0x178275,_0x53ca5e){return _0x178275[_0x52a1('0xa')](_0x52a1('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 1ef311c..4dbba91 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 _0xe1aa=['request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0xe1aa,0x156));var _0xae1a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe1aa[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xae1a('0x0'));var moment=require(_0xae1a('0x1'));var BPromise=require(_0xae1a('0x2'));var rs=require(_0xae1a('0x3'));var fs=require('fs');var Redis=require(_0xae1a('0x4'));var db=require(_0xae1a('0x5'))['db'];var utils=require(_0xae1a('0x6'));var logger=require(_0xae1a('0x7'))(_0xae1a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xae1a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46d3f7,_0x40b3b5,_0x516826){return new BPromise(function(_0x2deb85,_0x2706e0){return client[_0xae1a('0xa')](_0x46d3f7,_0x516826)[_0xae1a('0xb')](function(_0x5d7540){logger[_0xae1a('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x40b3b5,_0xae1a('0xd'));logger[_0xae1a('0xe')](_0xae1a('0xf'),_0x40b3b5,'request\x20sent',JSON[_0xae1a('0x10')](_0x5d7540));if(_0x5d7540[_0xae1a('0x11')]){if(_0x5d7540[_0xae1a('0x11')]['code']===0x1f4){logger[_0xae1a('0x11')](_0xae1a('0x12'),_0x40b3b5,_0x5d7540[_0xae1a('0x11')]['message']);return _0x2706e0(_0x5d7540[_0xae1a('0x11')][_0xae1a('0x13')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x40b3b5,_0x5d7540['error'][_0xae1a('0x13')]);return _0x2deb85(_0x5d7540[_0xae1a('0x11')]['message']);}else{logger['info'](_0xae1a('0x12'),_0x40b3b5,_0xae1a('0xd'));_0x2deb85(_0x5d7540[_0xae1a('0x14')][_0xae1a('0x13')]);}})[_0xae1a('0x15')](function(_0x10eaf1){logger[_0xae1a('0x11')](_0xae1a('0x12'),_0x40b3b5,_0x10eaf1);_0x2706e0(_0x10eaf1);});});} \ No newline at end of file +var _0xf7e5=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','catch','util'];(function(_0x2aeb2f,_0x2fbc20){var _0x34ada2=function(_0x1905c2){while(--_0x1905c2){_0x2aeb2f['push'](_0x2aeb2f['shift']());}};_0x34ada2(++_0x2fbc20);}(_0xf7e5,0x7d));var _0x5f7e=function(_0x406c91,_0x5efff1){_0x406c91=_0x406c91-0x0;var _0x4ee6fa=_0xf7e5[_0x406c91];return _0x4ee6fa;};'use strict';var _=require('lodash');var util=require(_0x5f7e('0x0'));var moment=require(_0x5f7e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f7e('0x2'));var db=require(_0x5f7e('0x3'))['db'];var utils=require(_0x5f7e('0x4'));var logger=require(_0x5f7e('0x5'))(_0x5f7e('0x6'));var config=require(_0x5f7e('0x7'));var jayson=require(_0x5f7e('0x8'));var client=jayson[_0x5f7e('0x9')][_0x5f7e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d2751,_0x509fd5,_0x186646){return new BPromise(function(_0xf2902e,_0x4a1ea2){return client['request'](_0x5d2751,_0x186646)[_0x5f7e('0xb')](function(_0xbabec1){logger[_0x5f7e('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x509fd5,_0x5f7e('0xd'));logger[_0x5f7e('0xe')](_0x5f7e('0xf'),_0x509fd5,_0x5f7e('0xd'),JSON[_0x5f7e('0x10')](_0xbabec1));if(_0xbabec1[_0x5f7e('0x11')]){if(_0xbabec1[_0x5f7e('0x11')]['code']===0x1f4){logger[_0x5f7e('0x11')](_0x5f7e('0x12'),_0x509fd5,_0xbabec1[_0x5f7e('0x11')][_0x5f7e('0x13')]);return _0x4a1ea2(_0xbabec1[_0x5f7e('0x11')]['message']);}logger[_0x5f7e('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x509fd5,_0xbabec1['error']['message']);return _0xf2902e(_0xbabec1[_0x5f7e('0x11')][_0x5f7e('0x13')]);}else{logger[_0x5f7e('0xc')](_0x5f7e('0x12'),_0x509fd5,'request\x20sent');_0xf2902e(_0xbabec1['result'][_0x5f7e('0x13')]);}})[_0x5f7e('0x14')](function(_0x2da1cb){logger[_0x5f7e('0x11')](_0x5f7e('0x12'),_0x509fd5,_0x2da1cb);_0x4a1ea2(_0x2da1cb);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d4ffdcb..d834924 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 _0x42c4=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','/:id','isAuthenticated','/:id/download','download','post','put','update','delete'];(function(_0x45bbd9,_0x1ff0ee){var _0x4b535e=function(_0x4d3960){while(--_0x4d3960){_0x45bbd9['push'](_0x45bbd9['shift']());}};_0x4b535e(++_0x1ff0ee);}(_0x42c4,0x1ce));var _0x442c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x42c4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x442c('0x0'));var util=require(_0x442c('0x1'));var path=require('path');var timeout=require(_0x442c('0x2'));var express=require(_0x442c('0x3'));var router=express[_0x442c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x442c('0x5'));var interaction=require(_0x442c('0x6'));var config=require(_0x442c('0x7'));var controller=require(_0x442c('0x8'));router[_0x442c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x442c('0x9')](_0x442c('0xa'),auth[_0x442c('0xb')](),controller['show']);router[_0x442c('0x9')](_0x442c('0xc'),auth['isAuthenticated'](),controller[_0x442c('0xd')]);router[_0x442c('0xe')]('/',auth[_0x442c('0xb')](),controller['create']);router[_0x442c('0xf')]('/:id',auth[_0x442c('0xb')](),controller[_0x442c('0x10')]);router[_0x442c('0x11')](_0x442c('0xa'),auth[_0x442c('0xb')](),controller[_0x442c('0x12')]);module[_0x442c('0x13')]=router; \ No newline at end of file +var _0xc706=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','/:id','/:id/download','download','post','create','put','destroy','exports','multer'];(function(_0x34d38c,_0x4f1295){var _0x4be108=function(_0x263e0f){while(--_0x263e0f){_0x34d38c['push'](_0x34d38c['shift']());}};_0x4be108(++_0x4f1295);}(_0xc706,0xe9));var _0x6c70=function(_0x575c17,_0x58cf05){_0x575c17=_0x575c17-0x0;var _0x4be569=_0xc706[_0x575c17];return _0x4be569;};'use strict';var multer=require(_0x6c70('0x0'));var util=require(_0x6c70('0x1'));var path=require(_0x6c70('0x2'));var timeout=require(_0x6c70('0x3'));var express=require('express');var router=express[_0x6c70('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6c70('0x5'));var interaction=require(_0x6c70('0x6'));var config=require('../../config/environment');var controller=require(_0x6c70('0x7'));router[_0x6c70('0x8')]('/',auth[_0x6c70('0x9')](),controller['index']);router[_0x6c70('0x8')](_0x6c70('0xa'),auth[_0x6c70('0x9')](),controller['show']);router['get'](_0x6c70('0xb'),auth[_0x6c70('0x9')](),controller[_0x6c70('0xc')]);router[_0x6c70('0xd')]('/',auth[_0x6c70('0x9')](),controller[_0x6c70('0xe')]);router[_0x6c70('0xf')](_0x6c70('0xa'),auth[_0x6c70('0x9')](),controller['update']);router['delete'](_0x6c70('0xa'),auth['isAuthenticated'](),controller[_0x6c70('0x10')]);module[_0x6c70('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 893a41b..be421cf 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 _0x46a6=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x34d28b,_0x410e14){var _0x2ab511=function(_0x4f3d87){while(--_0x4f3d87){_0x34d28b['push'](_0x34d28b['shift']());}};_0x2ab511(++_0x410e14);}(_0x46a6,0x107));var _0x646a=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0x46a6[_0x2af29a];return _0x5ef02f;};'use strict';var Sequelize=require(_0x646a('0x0'));module['exports']={'field':{'type':Sequelize[_0x646a('0x1')]},'alias':{'type':Sequelize[_0x646a('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x646a('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x646a('0x2')]},'custom':{'type':Sequelize[_0x646a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0a8a=['exports','TEXT','STRING','BOOLEAN'];(function(_0x36ca1f,_0x469b9e){var _0x2df6e1=function(_0x33db68){while(--_0x33db68){_0x36ca1f['push'](_0x36ca1f['shift']());}};_0x2df6e1(++_0x469b9e);}(_0x0a8a,0x1b8));var _0xa0a8=function(_0x568db3,_0x24395d){_0x568db3=_0x568db3-0x0;var _0x58c38b=_0x0a8a[_0x568db3];return _0x58c38b;};'use strict';var Sequelize=require('sequelize');module[_0xa0a8('0x0')]={'field':{'type':Sequelize[_0xa0a8('0x1')]},'alias':{'type':Sequelize[_0xa0a8('0x2')]},'function':{'type':Sequelize[_0xa0a8('0x2')]},'format':{'type':Sequelize[_0xa0a8('0x2')]},'groupBy':{'type':Sequelize[_0xa0a8('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xa0a8('0x2')]},'custom':{'type':Sequelize[_0xa0a8('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index db0dfc7..44e50b0 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 _0x9681=['../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','set','apply','reject','update','destroy','error','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','then','rows','catch','show','params','options','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4e231f,_0x315a9e){var _0x43a501=function(_0x58bdbb){while(--_0x58bdbb){_0x4e231f['push'](_0x4e231f['shift']());}};_0x43a501(++_0x315a9e);}(_0x9681,0xdc));var _0x1968=function(_0x59dbe9,_0x4fa7ff){_0x59dbe9=_0x59dbe9-0x0;var _0x299742=_0x9681[_0x59dbe9];return _0x299742;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1968('0x0'));var zipdir=require(_0x1968('0x1'));var jsonpatch=require(_0x1968('0x2'));var rp=require(_0x1968('0x3'));var moment=require(_0x1968('0x4'));var BPromise=require(_0x1968('0x5'));var Mustache=require(_0x1968('0x6'));var util=require('util');var path=require(_0x1968('0x7'));var sox=require(_0x1968('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1968('0x9'));var squel=require('squel');var crypto=require(_0x1968('0xa'));var jsforce=require(_0x1968('0xb'));var deskjs=require(_0x1968('0xc'));var toCsv=require(_0x1968('0xd'));var querystring=require(_0x1968('0xe'));var Papa=require(_0x1968('0xf'));var Redis=require(_0x1968('0x10'));var authService=require(_0x1968('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1968('0x12'));var hardwareService=require(_0x1968('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1968('0x14'));var config=require(_0x1968('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x307827,_0x1807de){_0x1807de=_0x1807de||0xcc;return function(_0x260a64){if(_0x260a64){return _0x307827[_0x1968('0x16')](_0x1807de);}return _0x307827[_0x1968('0x17')](_0x1807de)[_0x1968('0x18')]();};}function respondWithResult(_0x4d2021,_0x32a567){_0x32a567=_0x32a567||0xc8;return function(_0x2d97b8){if(_0x2d97b8){return _0x4d2021[_0x1968('0x17')](_0x32a567)[_0x1968('0x19')](_0x2d97b8);}};}function respondWithFilteredResult(_0x7348c1,_0x470d77){return function(_0x1b599d){if(_0x1b599d){var _0x246a1b=typeof _0x470d77[_0x1968('0x1a')]==='undefined'&&typeof _0x470d77[_0x1968('0x1b')]==='undefined';var _0x383e31=_0x1b599d[_0x1968('0x1c')];var _0x57b8b3=_0x246a1b?0x0:_0x470d77[_0x1968('0x1a')];var _0xd09671=_0x246a1b?_0x1b599d['count']:_0x470d77['offset']+_0x470d77[_0x1968('0x1b')];var _0xcb20a;if(_0xd09671>=_0x383e31){_0xd09671=_0x383e31;_0xcb20a=0xc8;}else{_0xcb20a=0xce;}_0x7348c1[_0x1968('0x17')](_0xcb20a);return _0x7348c1[_0x1968('0x1d')]('Content-Range',_0x57b8b3+'-'+_0xd09671+'/'+_0x383e31)['json'](_0x1b599d);}return null;};}function patchUpdates(_0x1277a2){return function(_0x13db42){try{jsonpatch[_0x1968('0x1e')](_0x13db42,_0x1277a2,!![]);}catch(_0x5c2549){return BPromise[_0x1968('0x1f')](_0x5c2549);}return _0x13db42['save']();};}function saveUpdates(_0x1f5fa0,_0x55ed53){return function(_0xd4705c){if(_0xd4705c){return _0xd4705c[_0x1968('0x20')](_0x1f5fa0)['then'](function(_0x4ec8ea){return _0x4ec8ea;});}return null;};}function removeEntity(_0x5b1f55,_0x5a85db){return function(_0x4da3db){if(_0x4da3db){return _0x4da3db[_0x1968('0x21')]()['then'](function(){_0x5b1f55[_0x1968('0x17')](0xcc)[_0x1968('0x18')]();});}};}function handleEntityNotFound(_0x51ad81,_0x31f961){return function(_0x18952b){if(!_0x18952b){_0x51ad81[_0x1968('0x16')](0x194);}return _0x18952b;};}function handleError(_0xef86e8,_0xeeb8df){_0xeeb8df=_0xeeb8df||0x1f4;return function(_0x4649e5){logger[_0x1968('0x22')](_0x4649e5['stack']);if(_0x4649e5[_0x1968('0x23')]){delete _0x4649e5[_0x1968('0x23')];}_0xef86e8[_0x1968('0x17')](_0xeeb8df)[_0x1968('0x24')](_0x4649e5);};}exports[_0x1968('0x25')]=function(_0x366afc,_0x2b5b7e){var _0x169fd0={},_0x455bd6={},_0x1b5fdc={'count':0x0,'rows':[]};var _0x4a395e=_['map'](db[_0x1968('0x26')][_0x1968('0x27')],function(_0x5ba8fe){return{'name':_0x5ba8fe[_0x1968('0x28')],'type':_0x5ba8fe['type'][_0x1968('0x29')]};});_0x455bd6[_0x1968('0x2a')]=_[_0x1968('0x2b')](_0x4a395e,_0x1968('0x23'));_0x455bd6[_0x1968('0x2c')]=_[_0x1968('0x2d')](_0x366afc[_0x1968('0x2c')]);_0x455bd6[_0x1968('0x2e')]=_['intersection'](_0x455bd6[_0x1968('0x2a')],_0x455bd6[_0x1968('0x2c')]);_0x169fd0[_0x1968('0x2f')]=_[_0x1968('0x30')](_0x455bd6[_0x1968('0x2a')],qs['fields'](_0x366afc[_0x1968('0x2c')][_0x1968('0x31')]));_0x169fd0[_0x1968('0x2f')]=_0x169fd0[_0x1968('0x2f')][_0x1968('0x32')]?_0x169fd0[_0x1968('0x2f')]:_0x455bd6[_0x1968('0x2a')];if(!_0x366afc['query']['hasOwnProperty'](_0x1968('0x33'))){_0x169fd0[_0x1968('0x1b')]=qs[_0x1968('0x1b')](_0x366afc[_0x1968('0x2c')][_0x1968('0x1b')]);_0x169fd0[_0x1968('0x1a')]=qs[_0x1968('0x1a')](_0x366afc[_0x1968('0x2c')][_0x1968('0x1a')]);}_0x169fd0[_0x1968('0x34')]=qs[_0x1968('0x35')](_0x366afc['query'][_0x1968('0x35')]);_0x169fd0[_0x1968('0x36')]=qs[_0x1968('0x2e')](_['pick'](_0x366afc['query'],_0x455bd6['filters']),_0x4a395e);if(_0x366afc[_0x1968('0x2c')][_0x1968('0x37')]){_0x169fd0[_0x1968('0x36')]=_[_0x1968('0x38')](_0x169fd0[_0x1968('0x36')],{'$or':_[_0x1968('0x2b')](_0x4a395e,function(_0x35e0b2){if(_0x35e0b2[_0x1968('0x39')]!==_0x1968('0x3a')){var _0x5331ac={};_0x5331ac[_0x35e0b2['name']]={'$like':'%'+_0x366afc[_0x1968('0x2c')][_0x1968('0x37')]+'%'};return _0x5331ac;}})});}_0x169fd0=_[_0x1968('0x38')]({},_0x169fd0,_0x366afc['options']);var _0x11cfaf={'where':_0x169fd0[_0x1968('0x36')]};return db[_0x1968('0x26')][_0x1968('0x1c')](_0x11cfaf)['then'](function(_0x83a274){_0x1b5fdc[_0x1968('0x1c')]=_0x83a274;if(_0x366afc[_0x1968('0x2c')][_0x1968('0x3b')]){_0x169fd0[_0x1968('0x3c')]=[{'all':!![]}];}return db[_0x1968('0x26')][_0x1968('0x3d')](_0x169fd0);})[_0x1968('0x3e')](function(_0x3bf010){_0x1b5fdc[_0x1968('0x3f')]=_0x3bf010;return _0x1b5fdc;})['then'](respondWithFilteredResult(_0x2b5b7e,_0x169fd0))[_0x1968('0x40')](handleError(_0x2b5b7e,null));};exports[_0x1968('0x41')]=function(_0x3a1952,_0x487c79){var _0x21f53c={'raw':![],'where':{'id':_0x3a1952[_0x1968('0x42')]['id']}},_0x48003c={};_0x48003c[_0x1968('0x2a')]=_[_0x1968('0x2d')](db[_0x1968('0x26')][_0x1968('0x27')]);_0x48003c['query']=_[_0x1968('0x2d')](_0x3a1952['query']);_0x48003c[_0x1968('0x2e')]=_[_0x1968('0x30')](_0x48003c[_0x1968('0x2a')],_0x48003c[_0x1968('0x2c')]);_0x21f53c[_0x1968('0x2f')]=_[_0x1968('0x30')](_0x48003c[_0x1968('0x2a')],qs['fields'](_0x3a1952[_0x1968('0x2c')]['fields']));_0x21f53c['attributes']=_0x21f53c[_0x1968('0x2f')][_0x1968('0x32')]?_0x21f53c[_0x1968('0x2f')]:_0x48003c[_0x1968('0x2a')];if(_0x3a1952[_0x1968('0x2c')]['includeAll']){_0x21f53c['include']=[{'all':!![]}];}_0x21f53c=_[_0x1968('0x38')]({},_0x21f53c,_0x3a1952[_0x1968('0x43')]);return db[_0x1968('0x26')][_0x1968('0x44')](_0x21f53c)['then'](handleEntityNotFound(_0x487c79,null))['then'](respondWithResult(_0x487c79,null))[_0x1968('0x40')](handleError(_0x487c79,null));};exports[_0x1968('0x45')]=function(_0x35e74c,_0x3dfc1c){return db[_0x1968('0x26')]['create'](_0x35e74c[_0x1968('0x46')],{})['then'](respondWithResult(_0x3dfc1c,0xc9))[_0x1968('0x40')](handleError(_0x3dfc1c,null));};exports[_0x1968('0x47')]=function(_0x27ca98,_0x4d5801){return db[_0x1968('0x26')]['bulkCreate'](_0x27ca98[_0x1968('0x46')],{'raw':![],'individualHooks':!![]})[_0x1968('0x3e')](respondWithResult(_0x4d5801,0xc9))[_0x1968('0x40')](handleError(_0x4d5801,null));};exports['update']=function(_0x1896e4,_0x201264){if(_0x1896e4[_0x1968('0x46')]['id']){delete _0x1896e4['body']['id'];}return db[_0x1968('0x26')][_0x1968('0x44')]({'where':{'id':_0x1896e4[_0x1968('0x42')]['id']}})[_0x1968('0x3e')](handleEntityNotFound(_0x201264,null))[_0x1968('0x3e')](saveUpdates(_0x1896e4[_0x1968('0x46')],null))[_0x1968('0x3e')](respondWithResult(_0x201264,null))['catch'](handleError(_0x201264,null));};exports[_0x1968('0x21')]=function(_0x5c4403,_0x20c428){return db[_0x1968('0x26')][_0x1968('0x44')]({'where':{'id':_0x5c4403[_0x1968('0x42')]['id']}})[_0x1968('0x3e')](handleEntityNotFound(_0x20c428,null))['then'](removeEntity(_0x20c428,null))[_0x1968('0x40')](handleError(_0x20c428,null));};exports[_0x1968('0x48')]=function(_0x5d9079,_0x5a46ce){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x5d9079['query'][_0x1968('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x1968('0x3e')](respondWithResult(_0x5a46ce,0xcc))[_0x1968('0x40')](handleError(_0x5a46ce,null));};exports[_0x1968('0x4a')]=function(_0x8f5fe2,_0x2ab44f,_0x4891aa){return db[_0x1968('0x4b')][_0x1968('0x4c')]({'where':{'id':_0x8f5fe2[_0x1968('0x42')]['id']}})[_0x1968('0x3e')](handleEntityNotFound(_0x2ab44f,null))['then'](function(_0x47bdab){if(_0x47bdab){return db[_0x1968('0x4d')][_0x1968('0x4e')](function(_0x34ac0b){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x8f5fe2[_0x1968('0x42')]['id']},'transaction':_0x34ac0b})[_0x1968('0x3e')](function(_0x449a21){var _0x395d1a=_[_0x1968('0x2b')](_0x8f5fe2[_0x1968('0x46')],function(_0x37892a){delete _0x37892a['id'];_0x37892a[_0x1968('0x4f')]=_0x8f5fe2[_0x1968('0x42')]['id'];return _0x37892a;});return db['AnalyticFieldReport'][_0x1968('0x47')](_0x395d1a,{'transaction':_0x34ac0b});});})['then'](function(){return db[_0x1968('0x26')][_0x1968('0x3d')]({'where':{'CustomReportId':_0x8f5fe2[_0x1968('0x42')]['id']}});});}})[_0x1968('0x3e')](respondWithResult(_0x2ab44f,null))[_0x1968('0x40')](handleError(_0x2ab44f,null));}; \ No newline at end of file +var _0x2f21=['moment','bluebird','util','path','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','api','../../config/license/util','../../mysqldb','end','json','undefined','limit','offset','count','status','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','catch','show','params','length','find','create','body','bulkCreate','bulkDestroy','destroy','ids','AnalyticCustomReport','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x2f21,0xf2));var _0x12f2=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x2f21[_0x487b0c];return _0x1adbdc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x12f2('0x0'));var zipdir=require(_0x12f2('0x1'));var jsonpatch=require(_0x12f2('0x2'));var rp=require(_0x12f2('0x3'));var moment=require(_0x12f2('0x4'));var BPromise=require(_0x12f2('0x5'));var Mustache=require('mustache');var util=require(_0x12f2('0x6'));var path=require(_0x12f2('0x7'));var sox=require(_0x12f2('0x8'));var csv=require(_0x12f2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x12f2('0xa'));var _=require(_0x12f2('0xb'));var squel=require(_0x12f2('0xc'));var crypto=require(_0x12f2('0xd'));var jsforce=require(_0x12f2('0xe'));var deskjs=require(_0x12f2('0xf'));var toCsv=require(_0x12f2('0x9'));var querystring=require(_0x12f2('0x10'));var Papa=require(_0x12f2('0x11'));var Redis=require(_0x12f2('0x12'));var authService=require(_0x12f2('0x13'));var qs=require(_0x12f2('0x14'));var as=require(_0x12f2('0x15'));var hardwareService=require(_0x12f2('0x16'));var logger=require('../../config/logger')(_0x12f2('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x12f2('0x18'));var db=require(_0x12f2('0x19'))['db'];function respondWithStatusCode(_0x33a358,_0x40695a){_0x40695a=_0x40695a||0xcc;return function(_0x51d2fb){if(_0x51d2fb){return _0x33a358['sendStatus'](_0x40695a);}return _0x33a358['status'](_0x40695a)[_0x12f2('0x1a')]();};}function respondWithResult(_0x1e11cd,_0x8d9942){_0x8d9942=_0x8d9942||0xc8;return function(_0x55d0b8){if(_0x55d0b8){return _0x1e11cd['status'](_0x8d9942)[_0x12f2('0x1b')](_0x55d0b8);}};}function respondWithFilteredResult(_0x161f5b,_0x4834bc){return function(_0x5745f8){if(_0x5745f8){var _0x2dffb5=typeof _0x4834bc['offset']===_0x12f2('0x1c')&&typeof _0x4834bc[_0x12f2('0x1d')]===_0x12f2('0x1c');var _0x492732=_0x5745f8['count'];var _0x5d4e5e=_0x2dffb5?0x0:_0x4834bc[_0x12f2('0x1e')];var _0x36b698=_0x2dffb5?_0x5745f8[_0x12f2('0x1f')]:_0x4834bc[_0x12f2('0x1e')]+_0x4834bc['limit'];var _0x1d0609;if(_0x36b698>=_0x492732){_0x36b698=_0x492732;_0x1d0609=0xc8;}else{_0x1d0609=0xce;}_0x161f5b[_0x12f2('0x20')](_0x1d0609);return _0x161f5b['set']('Content-Range',_0x5d4e5e+'-'+_0x36b698+'/'+_0x492732)[_0x12f2('0x1b')](_0x5745f8);}return null;};}function patchUpdates(_0x42e315){return function(_0x3dc048){try{jsonpatch[_0x12f2('0x21')](_0x3dc048,_0x42e315,!![]);}catch(_0x68672f){return BPromise[_0x12f2('0x22')](_0x68672f);}return _0x3dc048[_0x12f2('0x23')]();};}function saveUpdates(_0x18f2a9,_0x4a6d5d){return function(_0x3a2113){if(_0x3a2113){return _0x3a2113[_0x12f2('0x24')](_0x18f2a9)[_0x12f2('0x25')](function(_0x391f75){return _0x391f75;});}return null;};}function removeEntity(_0x521bff,_0x364def){return function(_0x4adf0c){if(_0x4adf0c){return _0x4adf0c['destroy']()['then'](function(){_0x521bff[_0x12f2('0x20')](0xcc)[_0x12f2('0x1a')]();});}};}function handleEntityNotFound(_0x2a4c61,_0x2223ce){return function(_0x302454){if(!_0x302454){_0x2a4c61[_0x12f2('0x26')](0x194);}return _0x302454;};}function handleError(_0x5a4c8d,_0x1f3cbb){_0x1f3cbb=_0x1f3cbb||0x1f4;return function(_0x53d788){logger[_0x12f2('0x27')](_0x53d788[_0x12f2('0x28')]);if(_0x53d788[_0x12f2('0x29')]){delete _0x53d788[_0x12f2('0x29')];}_0x5a4c8d[_0x12f2('0x20')](_0x1f3cbb)[_0x12f2('0x2a')](_0x53d788);};}exports[_0x12f2('0x2b')]=function(_0x40246e,_0x38b815){var _0x595724={},_0x5c05fb={},_0x5ec16d={'count':0x0,'rows':[]};var _0x53032b=_[_0x12f2('0x2c')](db[_0x12f2('0x2d')][_0x12f2('0x2e')],function(_0x23cdf0){return{'name':_0x23cdf0[_0x12f2('0x2f')],'type':_0x23cdf0[_0x12f2('0x30')][_0x12f2('0x31')]};});_0x5c05fb[_0x12f2('0x32')]=_[_0x12f2('0x2c')](_0x53032b,_0x12f2('0x29'));_0x5c05fb[_0x12f2('0x33')]=_[_0x12f2('0x34')](_0x40246e[_0x12f2('0x33')]);_0x5c05fb[_0x12f2('0x35')]=_[_0x12f2('0x36')](_0x5c05fb[_0x12f2('0x32')],_0x5c05fb[_0x12f2('0x33')]);_0x595724[_0x12f2('0x37')]=_[_0x12f2('0x36')](_0x5c05fb[_0x12f2('0x32')],qs[_0x12f2('0x38')](_0x40246e['query']['fields']));_0x595724[_0x12f2('0x37')]=_0x595724[_0x12f2('0x37')]['length']?_0x595724[_0x12f2('0x37')]:_0x5c05fb['model'];if(!_0x40246e['query'][_0x12f2('0x39')](_0x12f2('0x3a'))){_0x595724[_0x12f2('0x1d')]=qs['limit'](_0x40246e[_0x12f2('0x33')][_0x12f2('0x1d')]);_0x595724[_0x12f2('0x1e')]=qs[_0x12f2('0x1e')](_0x40246e['query'][_0x12f2('0x1e')]);}_0x595724[_0x12f2('0x3b')]=qs[_0x12f2('0x3c')](_0x40246e[_0x12f2('0x33')][_0x12f2('0x3c')]);_0x595724[_0x12f2('0x3d')]=qs[_0x12f2('0x35')](_['pick'](_0x40246e[_0x12f2('0x33')],_0x5c05fb[_0x12f2('0x35')]),_0x53032b);if(_0x40246e[_0x12f2('0x33')]['filter']){_0x595724[_0x12f2('0x3d')]=_[_0x12f2('0x3e')](_0x595724[_0x12f2('0x3d')],{'$or':_[_0x12f2('0x2c')](_0x53032b,function(_0x5dbca1){if(_0x5dbca1[_0x12f2('0x30')]!=='VIRTUAL'){var _0x569eb8={};_0x569eb8[_0x5dbca1[_0x12f2('0x29')]]={'$like':'%'+_0x40246e[_0x12f2('0x33')][_0x12f2('0x3f')]+'%'};return _0x569eb8;}})});}_0x595724=_[_0x12f2('0x3e')]({},_0x595724,_0x40246e[_0x12f2('0x40')]);var _0x5ec01a={'where':_0x595724[_0x12f2('0x3d')]};return db[_0x12f2('0x2d')][_0x12f2('0x1f')](_0x5ec01a)['then'](function(_0x41015b){_0x5ec16d[_0x12f2('0x1f')]=_0x41015b;if(_0x40246e[_0x12f2('0x33')][_0x12f2('0x41')]){_0x595724[_0x12f2('0x42')]=[{'all':!![]}];}return db[_0x12f2('0x2d')][_0x12f2('0x43')](_0x595724);})[_0x12f2('0x25')](function(_0x399fb8){_0x5ec16d['rows']=_0x399fb8;return _0x5ec16d;})[_0x12f2('0x25')](respondWithFilteredResult(_0x38b815,_0x595724))[_0x12f2('0x44')](handleError(_0x38b815,null));};exports[_0x12f2('0x45')]=function(_0x27bb02,_0x3ce16a){var _0x5feab9={'raw':![],'where':{'id':_0x27bb02[_0x12f2('0x46')]['id']}},_0x2c712f={};_0x2c712f[_0x12f2('0x32')]=_[_0x12f2('0x34')](db[_0x12f2('0x2d')][_0x12f2('0x2e')]);_0x2c712f['query']=_[_0x12f2('0x34')](_0x27bb02[_0x12f2('0x33')]);_0x2c712f[_0x12f2('0x35')]=_[_0x12f2('0x36')](_0x2c712f[_0x12f2('0x32')],_0x2c712f[_0x12f2('0x33')]);_0x5feab9[_0x12f2('0x37')]=_[_0x12f2('0x36')](_0x2c712f[_0x12f2('0x32')],qs[_0x12f2('0x38')](_0x27bb02[_0x12f2('0x33')][_0x12f2('0x38')]));_0x5feab9[_0x12f2('0x37')]=_0x5feab9[_0x12f2('0x37')][_0x12f2('0x47')]?_0x5feab9[_0x12f2('0x37')]:_0x2c712f[_0x12f2('0x32')];if(_0x27bb02['query']['includeAll']){_0x5feab9[_0x12f2('0x42')]=[{'all':!![]}];}_0x5feab9=_[_0x12f2('0x3e')]({},_0x5feab9,_0x27bb02[_0x12f2('0x40')]);return db[_0x12f2('0x2d')][_0x12f2('0x48')](_0x5feab9)[_0x12f2('0x25')](handleEntityNotFound(_0x3ce16a,null))['then'](respondWithResult(_0x3ce16a,null))[_0x12f2('0x44')](handleError(_0x3ce16a,null));};exports['create']=function(_0xc9fc66,_0x3b14ff){return db['AnalyticFieldReport'][_0x12f2('0x49')](_0xc9fc66[_0x12f2('0x4a')],{})[_0x12f2('0x25')](respondWithResult(_0x3b14ff,0xc9))[_0x12f2('0x44')](handleError(_0x3b14ff,null));};exports['bulkCreate']=function(_0xef9551,_0x11f681){return db[_0x12f2('0x2d')][_0x12f2('0x4b')](_0xef9551[_0x12f2('0x4a')],{'raw':![],'individualHooks':!![]})[_0x12f2('0x25')](respondWithResult(_0x11f681,0xc9))['catch'](handleError(_0x11f681,null));};exports[_0x12f2('0x24')]=function(_0x562e5b,_0x5f28f7){if(_0x562e5b[_0x12f2('0x4a')]['id']){delete _0x562e5b[_0x12f2('0x4a')]['id'];}return db[_0x12f2('0x2d')][_0x12f2('0x48')]({'where':{'id':_0x562e5b[_0x12f2('0x46')]['id']}})[_0x12f2('0x25')](handleEntityNotFound(_0x5f28f7,null))['then'](saveUpdates(_0x562e5b[_0x12f2('0x4a')],null))[_0x12f2('0x25')](respondWithResult(_0x5f28f7,null))[_0x12f2('0x44')](handleError(_0x5f28f7,null));};exports['destroy']=function(_0x2e5efc,_0x513579){return db[_0x12f2('0x2d')]['find']({'where':{'id':_0x2e5efc['params']['id']}})[_0x12f2('0x25')](handleEntityNotFound(_0x513579,null))[_0x12f2('0x25')](removeEntity(_0x513579,null))[_0x12f2('0x44')](handleError(_0x513579,null));};exports[_0x12f2('0x4c')]=function(_0x5b2560,_0x1fe651){return db[_0x12f2('0x2d')][_0x12f2('0x4d')]({'where':{'id':_0x5b2560['query'][_0x12f2('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0x12f2('0x25')](respondWithResult(_0x1fe651,0xcc))[_0x12f2('0x44')](handleError(_0x1fe651,null));};exports['addFields']=function(_0x51ffac,_0x4a4c80,_0x3f7255){return db[_0x12f2('0x4f')]['findOne']({'where':{'id':_0x51ffac['params']['id']}})[_0x12f2('0x25')](handleEntityNotFound(_0x4a4c80,null))[_0x12f2('0x25')](function(_0x4a6045){if(_0x4a6045){return db['sequelize'][_0x12f2('0x50')](function(_0x26e610){return db[_0x12f2('0x2d')][_0x12f2('0x4d')]({'where':{'CustomReportId':_0x51ffac['params']['id']},'transaction':_0x26e610})[_0x12f2('0x25')](function(_0x54f31d){var _0x1baea1=_[_0x12f2('0x2c')](_0x51ffac[_0x12f2('0x4a')],function(_0xaf1c77){delete _0xaf1c77['id'];_0xaf1c77[_0x12f2('0x51')]=_0x51ffac[_0x12f2('0x46')]['id'];return _0xaf1c77;});return db['AnalyticFieldReport'][_0x12f2('0x4b')](_0x1baea1,{'transaction':_0x26e610});});})[_0x12f2('0x25')](function(){return db['AnalyticFieldReport'][_0x12f2('0x43')]({'where':{'CustomReportId':_0x51ffac[_0x12f2('0x46')]['id']}});});}})[_0x12f2('0x25')](respondWithResult(_0x4a4c80,null))[_0x12f2('0x44')](handleError(_0x4a4c80,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index e1d2913..2adbed9 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 _0xef16=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x5bee86,_0x38468d){var _0x116ca1=function(_0x5c951e){while(--_0x5c951e){_0x5bee86['push'](_0x5bee86['shift']());}};_0x116ca1(++_0x38468d);}(_0xef16,0xac));var _0x6ef1=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xef16[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x6ef1('0x0'));var util=require('util');var logger=require(_0x6ef1('0x1'))('api');var moment=require(_0x6ef1('0x2'));var BPromise=require(_0x6ef1('0x3'));var rp=require(_0x6ef1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ef1('0x5'));var config=require(_0x6ef1('0x6'));var attributes=require(_0x6ef1('0x7'));module[_0x6ef1('0x8')]=function(_0x1112bc,_0x2aad38){return _0x1112bc[_0x6ef1('0x9')](_0x6ef1('0xa'),attributes,{'tableName':_0x6ef1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41da=['rimraf','../../config/environment','./analyticFieldReport.attributes','define','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1e16fe,_0x2ab89d){var _0xb7ac60=function(_0x3704e4){while(--_0x3704e4){_0x1e16fe['push'](_0x1e16fe['shift']());}};_0xb7ac60(++_0x2ab89d);}(_0x41da,0xf5));var _0xa41d=function(_0x4b0a13,_0x9f30e0){_0x4b0a13=_0x4b0a13-0x0;var _0x4d11bf=_0x41da[_0x4b0a13];return _0x4d11bf;};'use strict';var _=require(_0xa41d('0x0'));var util=require(_0xa41d('0x1'));var logger=require(_0xa41d('0x2'))(_0xa41d('0x3'));var moment=require(_0xa41d('0x4'));var BPromise=require(_0xa41d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa41d('0x6'));var rimraf=require(_0xa41d('0x7'));var config=require(_0xa41d('0x8'));var attributes=require(_0xa41d('0x9'));module['exports']=function(_0x3758aa,_0x1b12e8){return _0x3758aa[_0xa41d('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0xa41d('0xb'),'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 3893940..72389b2 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 _0x4715=['jayson/promise','client','http','request','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x4715,0x121));var _0x5471=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x4715[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x5471('0x0'));var util=require(_0x5471('0x1'));var moment=require(_0x5471('0x2'));var BPromise=require(_0x5471('0x3'));var rs=require(_0x5471('0x4'));var fs=require('fs');var Redis=require(_0x5471('0x5'));var db=require(_0x5471('0x6'))['db'];var utils=require(_0x5471('0x7'));var logger=require(_0x5471('0x8'))(_0x5471('0x9'));var config=require(_0x5471('0xa'));var jayson=require(_0x5471('0xb'));var client=jayson[_0x5471('0xc')][_0x5471('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5354f2,_0x305887,_0x34e56d){return new BPromise(function(_0x319460,_0x425759){return client[_0x5471('0xe')](_0x5354f2,_0x34e56d)['then'](function(_0x10bd78){logger['info'](_0x5471('0xf'),_0x305887,_0x5471('0x10'));logger[_0x5471('0x11')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x305887,_0x5471('0x10'),JSON[_0x5471('0x12')](_0x10bd78));if(_0x10bd78[_0x5471('0x13')]){if(_0x10bd78[_0x5471('0x13')][_0x5471('0x14')]===0x1f4){logger[_0x5471('0x13')](_0x5471('0xf'),_0x305887,_0x10bd78[_0x5471('0x13')]['message']);return _0x425759(_0x10bd78[_0x5471('0x13')][_0x5471('0x15')]);}logger[_0x5471('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x305887,_0x10bd78[_0x5471('0x13')]['message']);return _0x319460(_0x10bd78['error'][_0x5471('0x15')]);}else{logger[_0x5471('0x16')]('AnalyticFieldReport,\x20%s,\x20%s',_0x305887,'request\x20sent');_0x319460(_0x10bd78[_0x5471('0x17')]['message']);}})[_0x5471('0x18')](function(_0x57de35){logger[_0x5471('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x305887,_0x57de35);_0x425759(_0x57de35);});});} \ No newline at end of file +var _0xae93=['rpc','../../config/environment','jayson/promise','client','http','then','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xae93,0x188));var _0x3ae9=function(_0x9a3421,_0x479230){_0x9a3421=_0x9a3421-0x0;var _0x575917=_0xae93[_0x9a3421];return _0x575917;};'use strict';var _=require(_0x3ae9('0x0'));var util=require(_0x3ae9('0x1'));var moment=require(_0x3ae9('0x2'));var BPromise=require(_0x3ae9('0x3'));var rs=require(_0x3ae9('0x4'));var fs=require('fs');var Redis=require(_0x3ae9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3ae9('0x6'))(_0x3ae9('0x7'));var config=require(_0x3ae9('0x8'));var jayson=require(_0x3ae9('0x9'));var client=jayson[_0x3ae9('0xa')][_0x3ae9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13a2da,_0x43c27d,_0x1c1fcc){return new BPromise(function(_0x46b1d3,_0x51ab80){return client['request'](_0x13a2da,_0x1c1fcc)[_0x3ae9('0xc')](function(_0x46af80){logger['info'](_0x3ae9('0xd'),_0x43c27d,'request\x20sent');logger['debug'](_0x3ae9('0xe'),_0x43c27d,_0x3ae9('0xf'),JSON['stringify'](_0x46af80));if(_0x46af80[_0x3ae9('0x10')]){if(_0x46af80[_0x3ae9('0x10')][_0x3ae9('0x11')]===0x1f4){logger[_0x3ae9('0x10')](_0x3ae9('0xd'),_0x43c27d,_0x46af80['error'][_0x3ae9('0x12')]);return _0x51ab80(_0x46af80[_0x3ae9('0x10')][_0x3ae9('0x12')]);}logger[_0x3ae9('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x43c27d,_0x46af80[_0x3ae9('0x10')]['message']);return _0x46b1d3(_0x46af80['error'][_0x3ae9('0x12')]);}else{logger[_0x3ae9('0x13')](_0x3ae9('0xd'),_0x43c27d,'request\x20sent');_0x46b1d3(_0x46af80[_0x3ae9('0x14')][_0x3ae9('0x12')]);}})['catch'](function(_0x2193d9){logger[_0x3ae9('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x43c27d,_0x2193d9);_0x51ab80(_0x2193d9);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 3957849..3557032 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(_0x74c70c,_0x691b18){var _0x53af83=function(_0x49ea2b){while(--_0x49ea2b){_0x74c70c['push'](_0x74c70c['shift']());}};_0x53af83(++_0x691b18);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x458188,_0x11abf0){var _0x19d5ce=function(_0x4ec67c){while(--_0x4ec67c){_0x458188['push'](_0x458188['shift']());}};_0x19d5ce(++_0x11abf0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 e72bc4f..a49ffad 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 _0xd10f=['sequelize','exports','STRING','name'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xd10f,0x198));var _0xfd10=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd10f[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xfd10('0x0'));module[_0xfd10('0x1')]={'name':{'type':Sequelize[_0xfd10('0x2')],'allowNull':![],'unique':_0xfd10('0x3')},'table':{'type':Sequelize[_0xfd10('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xfd10('0x2')]}}; \ No newline at end of file +var _0x9a86=['name','STRING','TEXT','sequelize','exports'];(function(_0x4e24d3,_0x37a5bd){var _0x2c1698=function(_0x2a1e00){while(--_0x2a1e00){_0x4e24d3['push'](_0x4e24d3['shift']());}};_0x2c1698(++_0x37a5bd);}(_0x9a86,0x1ed));var _0x69a8=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0x9a86[_0x18b5e8];return _0x25baed;};'use strict';var Sequelize=require(_0x69a8('0x0'));module[_0x69a8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x69a8('0x2')},'table':{'type':Sequelize[_0x69a8('0x3')]},'metric':{'type':Sequelize[_0x69a8('0x4')]},'description':{'type':Sequelize[_0x69a8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 9aae6ee..23d273b 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 _0x9957=['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','Metrics','UserProfileResource','end','error','name','map','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','AnalyticMetric','include','findAll','rawAttributes','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x4c80d7,_0x2bef29){var _0x3c5095=function(_0x1b0e67){while(--_0x1b0e67){_0x4c80d7['push'](_0x4c80d7['shift']());}};_0x3c5095(++_0x2bef29);}(_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(){var _0x472195=_0x563799['get']({'plain':!![]});var _0x39df42=_0x7995('0x28');return db[_0x7995('0x29')][_0x7995('0x27')]({'where':{'type':_0x39df42,'resourceId':_0x472195['id']}})[_0x7995('0x26')](function(){return _0x563799;});})[_0x7995('0x26')](function(){_0x204507['status'](0xcc)[_0x7995('0x2a')]();});}};}function handleEntityNotFound(_0x5911c3,_0x229742){return function(_0x49bc7e){if(!_0x49bc7e){_0x5911c3[_0x7995('0x1b')](0x194);}return _0x49bc7e;};}function handleError(_0x132a42,_0x11c1eb){_0x11c1eb=_0x11c1eb||0x1f4;return function(_0x4b6f99){logger[_0x7995('0x2b')](_0x4b6f99['stack']);if(_0x4b6f99[_0x7995('0x2c')]){delete _0x4b6f99[_0x7995('0x2c')];}_0x132a42[_0x7995('0x1c')](_0x11c1eb)['send'](_0x4b6f99);};}exports['index']=function(_0x48e573,_0x3573be){var _0xe6b0b3={},_0x327a81={},_0x2b874d={'count':0x0,'rows':[]};var _0x2e3493=_[_0x7995('0x2d')](db['AnalyticMetric']['rawAttributes'],function(_0xfa8f15){return{'name':_0xfa8f15['fieldName'],'type':_0xfa8f15[_0x7995('0x2e')][_0x7995('0x2f')]};});_0x327a81[_0x7995('0x30')]=_[_0x7995('0x2d')](_0x2e3493,_0x7995('0x2c'));_0x327a81['query']=_[_0x7995('0x31')](_0x48e573[_0x7995('0x32')]);_0x327a81['filters']=_['intersection'](_0x327a81['model'],_0x327a81[_0x7995('0x32')]);_0xe6b0b3[_0x7995('0x33')]=_['intersection'](_0x327a81[_0x7995('0x30')],qs['fields'](_0x48e573[_0x7995('0x32')][_0x7995('0x34')]));_0xe6b0b3[_0x7995('0x33')]=_0xe6b0b3['attributes']['length']?_0xe6b0b3[_0x7995('0x33')]:_0x327a81['model'];if(!_0x48e573['query'][_0x7995('0x35')](_0x7995('0x36'))){_0xe6b0b3['limit']=qs[_0x7995('0x21')](_0x48e573[_0x7995('0x32')][_0x7995('0x21')]);_0xe6b0b3[_0x7995('0x20')]=qs[_0x7995('0x20')](_0x48e573['query'][_0x7995('0x20')]);}_0xe6b0b3[_0x7995('0x37')]=qs[_0x7995('0x38')](_0x48e573[_0x7995('0x32')]['sort']);_0xe6b0b3[_0x7995('0x39')]=qs[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x48e573[_0x7995('0x32')],_0x327a81[_0x7995('0x3a')]),_0x2e3493);if(_0x48e573[_0x7995('0x32')]['filter']){_0xe6b0b3[_0x7995('0x39')]=_[_0x7995('0x3c')](_0xe6b0b3[_0x7995('0x39')],{'$or':_[_0x7995('0x2d')](_0x2e3493,function(_0x2e04cd){if(_0x2e04cd[_0x7995('0x2e')]!==_0x7995('0x3d')){var _0x270c0e={};_0x270c0e[_0x2e04cd[_0x7995('0x2c')]]={'$like':'%'+_0x48e573[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x270c0e;}})});}_0xe6b0b3=_[_0x7995('0x3c')]({},_0xe6b0b3,_0x48e573[_0x7995('0x3f')]);var _0x53cda2={'where':_0xe6b0b3['where']};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x53cda2)['then'](function(_0x4b0855){_0x2b874d[_0x7995('0x1f')]=_0x4b0855;if(_0x48e573['query']['includeAll']){_0xe6b0b3[_0x7995('0x41')]=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x42')](_0xe6b0b3);})['then'](function(_0x46ac4f){_0x2b874d['rows']=_0x46ac4f;return _0x2b874d;})[_0x7995('0x26')](respondWithFilteredResult(_0x3573be,_0xe6b0b3))['catch'](handleError(_0x3573be,null));};exports['show']=function(_0x39c5b8,_0x403f54){var _0xc04e5={'raw':!![],'where':{'id':_0x39c5b8['params']['id']}},_0x3f1c35={};_0x3f1c35[_0x7995('0x30')]=_[_0x7995('0x31')](db[_0x7995('0x40')][_0x7995('0x43')]);_0x3f1c35['query']=_['keys'](_0x39c5b8[_0x7995('0x32')]);_0x3f1c35['filters']=_[_0x7995('0x44')](_0x3f1c35['model'],_0x3f1c35[_0x7995('0x32')]);_0xc04e5['attributes']=_[_0x7995('0x44')](_0x3f1c35[_0x7995('0x30')],qs['fields'](_0x39c5b8[_0x7995('0x32')][_0x7995('0x34')]));_0xc04e5[_0x7995('0x33')]=_0xc04e5[_0x7995('0x33')]['length']?_0xc04e5[_0x7995('0x33')]:_0x3f1c35[_0x7995('0x30')];if(_0x39c5b8[_0x7995('0x32')]['includeAll']){_0xc04e5[_0x7995('0x41')]=[{'all':!![]}];}_0xc04e5=_[_0x7995('0x3c')]({},_0xc04e5,_0x39c5b8[_0x7995('0x3f')]);return db[_0x7995('0x40')][_0x7995('0x45')](_0xc04e5)['then'](handleEntityNotFound(_0x403f54,null))[_0x7995('0x26')](respondWithResult(_0x403f54,null))[_0x7995('0x46')](handleError(_0x403f54,null));};exports['create']=function(_0x3d1dbb,_0x5843ba){return db[_0x7995('0x40')][_0x7995('0x47')](_0x3d1dbb[_0x7995('0x48')],{})[_0x7995('0x26')](function(_0xddf537){var _0x14b537=_0x3d1dbb[_0x7995('0x49')]['get']({'plain':!![]});if(!_0x14b537)throw new Error(_0x7995('0x4a'));if(_0x14b537[_0x7995('0x4b')]===_0x7995('0x49')){var _0x4ffc8a=_0xddf537[_0x7995('0x4c')]({'plain':!![]});var _0x1fe77e=_0x7995('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x1fe77e,'userProfileId':_0x14b537['userProfileId']},'raw':!![]})[_0x7995('0x26')](function(_0x1fd1ca){if(_0x1fd1ca&&_0x1fd1ca['autoAssociation']===0x0){return db[_0x7995('0x29')][_0x7995('0x47')]({'name':_0x4ffc8a[_0x7995('0x2c')],'resourceId':_0x4ffc8a['id'],'type':_0x1fd1ca[_0x7995('0x2c')],'sectionId':_0x1fd1ca['id']},{})[_0x7995('0x26')](function(){return _0xddf537;});}else{return _0xddf537;}})['catch'](function(_0x29ee32){logger['error'](_0x7995('0x4d'),_0x29ee32);throw _0x29ee32;});}return _0xddf537;})[_0x7995('0x26')](respondWithResult(_0x5843ba,0xc9))[_0x7995('0x46')](handleError(_0x5843ba,null));};exports['update']=function(_0x5e1f34,_0x54e2b1){if(_0x5e1f34['body']['id']){delete _0x5e1f34[_0x7995('0x48')]['id'];}return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0x5e1f34[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x54e2b1,null))[_0x7995('0x26')](saveUpdates(_0x5e1f34[_0x7995('0x48')],null))[_0x7995('0x26')](respondWithResult(_0x54e2b1,null))[_0x7995('0x46')](handleError(_0x54e2b1,null));};exports[_0x7995('0x27')]=function(_0xa7af8c,_0x133c63){return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0xa7af8c[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x133c63,null))[_0x7995('0x26')](removeEntity(_0x133c63,null))[_0x7995('0x46')](handleError(_0x133c63,null));}; \ No newline at end of file +var _0x24ca=['find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x3bea06,_0x38f09a){var _0x20f6f7=function(_0x37ca19){while(--_0x37ca19){_0x3bea06['push'](_0x3bea06['shift']());}};_0x20f6f7(++_0x38f09a);}(_0x24ca,0x1bc));var _0xa24c=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x24ca[_0x58dc25];return _0x21b0a7;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x47e0eb=_0x43a0c0[_0xa24c('0x29')]({'plain':!![]});var _0x5cc9cb=_0xa24c('0x2a');return db[_0xa24c('0x2b')][_0xa24c('0x28')]({'where':{'type':_0x5cc9cb,'resourceId':_0x47e0eb['id']}})['then'](function(){return _0x43a0c0;});})[_0xa24c('0x27')](function(){_0x346ee8[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x314121,_0x11e4e0){return function(_0x3ad0e6){if(!_0x3ad0e6){_0x314121[_0xa24c('0x2c')](0x194);}return _0x3ad0e6;};}function handleError(_0x5b23f4,_0xa0c48e){_0xa0c48e=_0xa0c48e||0x1f4;return function(_0x28675f){logger[_0xa24c('0x2d')](_0x28675f[_0xa24c('0x2e')]);if(_0x28675f['name']){delete _0x28675f[_0xa24c('0x2f')];}_0x5b23f4[_0xa24c('0x1b')](_0xa0c48e)[_0xa24c('0x30')](_0x28675f);};}exports['index']=function(_0x15eaaf,_0x3dcb1b){var _0x253d83={},_0x4ae35c={},_0x245fb2={'count':0x0,'rows':[]};var _0x5e0226=_[_0xa24c('0x31')](db[_0xa24c('0x32')][_0xa24c('0x33')],function(_0x5d025a){return{'name':_0x5d025a[_0xa24c('0x34')],'type':_0x5d025a[_0xa24c('0x35')][_0xa24c('0x36')]};});_0x4ae35c['model']=_[_0xa24c('0x31')](_0x5e0226,'name');_0x4ae35c[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x15eaaf['query']);_0x4ae35c['filters']=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],_0x4ae35c[_0xa24c('0x37')]);_0x253d83[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],qs[_0xa24c('0x3c')](_0x15eaaf['query'][_0xa24c('0x3c')]));_0x253d83[_0xa24c('0x3b')]=_0x253d83[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x253d83[_0xa24c('0x3b')]:_0x4ae35c[_0xa24c('0x3a')];if(!_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x3e')](_0xa24c('0x3f'))){_0x253d83[_0xa24c('0x1e')]=qs['limit'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x1e')]);_0x253d83[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x15eaaf['query']['offset']);}_0x253d83[_0xa24c('0x40')]=qs['sort'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x41')]);_0x253d83[_0xa24c('0x42')]=qs[_0xa24c('0x43')](_[_0xa24c('0x44')](_0x15eaaf['query'],_0x4ae35c['filters']),_0x5e0226);if(_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]){_0x253d83[_0xa24c('0x42')]=_[_0xa24c('0x46')](_0x253d83[_0xa24c('0x42')],{'$or':_[_0xa24c('0x31')](_0x5e0226,function(_0x5080d0){if(_0x5080d0['type']!==_0xa24c('0x47')){var _0x1ce83e={};_0x1ce83e[_0x5080d0[_0xa24c('0x2f')]]={'$like':'%'+_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]+'%'};return _0x1ce83e;}})});}_0x253d83=_['merge']({},_0x253d83,_0x15eaaf[_0xa24c('0x48')]);var _0x7895e={'where':_0x253d83['where']};return db['AnalyticMetric'][_0xa24c('0x20')](_0x7895e)[_0xa24c('0x27')](function(_0x231eea){_0x245fb2['count']=_0x231eea;if(_0x15eaaf['query'][_0xa24c('0x49')]){_0x253d83[_0xa24c('0x4a')]=[{'all':!![]}];}return db[_0xa24c('0x32')][_0xa24c('0x4b')](_0x253d83);})[_0xa24c('0x27')](function(_0x1b7faf){_0x245fb2[_0xa24c('0x4c')]=_0x1b7faf;return _0x245fb2;})[_0xa24c('0x27')](respondWithFilteredResult(_0x3dcb1b,_0x253d83))['catch'](handleError(_0x3dcb1b,null));};exports['show']=function(_0x430ba3,_0x44f7d4){var _0x455256={'raw':!![],'where':{'id':_0x430ba3[_0xa24c('0x4d')]['id']}},_0x5972d7={};_0x5972d7[_0xa24c('0x3a')]=_[_0xa24c('0x38')](db[_0xa24c('0x32')][_0xa24c('0x33')]);_0x5972d7[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x430ba3[_0xa24c('0x37')]);_0x5972d7[_0xa24c('0x43')]=_[_0xa24c('0x39')](_0x5972d7['model'],_0x5972d7[_0xa24c('0x37')]);_0x455256[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x5972d7['model'],qs[_0xa24c('0x3c')](_0x430ba3[_0xa24c('0x37')][_0xa24c('0x3c')]));_0x455256[_0xa24c('0x3b')]=_0x455256[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x455256[_0xa24c('0x3b')]:_0x5972d7[_0xa24c('0x3a')];if(_0x430ba3[_0xa24c('0x37')][_0xa24c('0x49')]){_0x455256[_0xa24c('0x4a')]=[{'all':!![]}];}_0x455256=_['merge']({},_0x455256,_0x430ba3[_0xa24c('0x48')]);return db[_0xa24c('0x32')][_0xa24c('0x4e')](_0x455256)[_0xa24c('0x27')](handleEntityNotFound(_0x44f7d4,null))[_0xa24c('0x27')](respondWithResult(_0x44f7d4,null))[_0xa24c('0x4f')](handleError(_0x44f7d4,null));};exports[_0xa24c('0x50')]=function(_0x2250b9,_0x184179){return db['AnalyticMetric']['create'](_0x2250b9[_0xa24c('0x51')],{})['then'](function(_0xc078ef){var _0x1f436c=_0x2250b9['user'][_0xa24c('0x29')]({'plain':!![]});if(!_0x1f436c)throw new Error(_0xa24c('0x52'));if(_0x1f436c[_0xa24c('0x53')]==='user'){var _0x55978e=_0xc078ef[_0xa24c('0x29')]({'plain':!![]});var _0x5ba726=_0xa24c('0x2a');return db[_0xa24c('0x54')][_0xa24c('0x4e')]({'where':{'name':_0x5ba726,'userProfileId':_0x1f436c[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x1fa739){if(_0x1fa739&&_0x1fa739[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x2b')][_0xa24c('0x50')]({'name':_0x55978e[_0xa24c('0x2f')],'resourceId':_0x55978e['id'],'type':_0x1fa739['name'],'sectionId':_0x1fa739['id']},{})[_0xa24c('0x27')](function(){return _0xc078ef;});}else{return _0xc078ef;}})[_0xa24c('0x4f')](function(_0x233f8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233f8e);throw _0x233f8e;});}return _0xc078ef;})['then'](respondWithResult(_0x184179,0xc9))[_0xa24c('0x4f')](handleError(_0x184179,null));};exports['update']=function(_0x4757ff,_0x21d0fc){if(_0x4757ff['body']['id']){delete _0x4757ff[_0xa24c('0x51')]['id'];}return db[_0xa24c('0x32')][_0xa24c('0x4e')]({'where':{'id':_0x4757ff[_0xa24c('0x4d')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x21d0fc,null))[_0xa24c('0x27')](saveUpdates(_0x4757ff[_0xa24c('0x51')],null))[_0xa24c('0x27')](respondWithResult(_0x21d0fc,null))['catch'](handleError(_0x21d0fc,null));};exports[_0xa24c('0x28')]=function(_0x47af80,_0x5abd45){return db['AnalyticMetric']['find']({'where':{'id':_0x47af80['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x5abd45,null))['then'](removeEntity(_0x5abd45,null))[_0xa24c('0x4f')](handleError(_0x5abd45,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index da0d0cc..5849ff2 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 _0xb39f=['lodash','util','../../config/logger','api','path','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric'];(function(_0x29d1b2,_0x26de60){var _0x156681=function(_0x3ed554){while(--_0x3ed554){_0x29d1b2['push'](_0x29d1b2['shift']());}};_0x156681(++_0x26de60);}(_0xb39f,0x1e6));var _0xfb39=function(_0x8aa34,_0x5e6fb2){_0x8aa34=_0x8aa34-0x0;var _0x21cf64=_0xb39f[_0x8aa34];return _0x21cf64;};'use strict';var _=require(_0xfb39('0x0'));var util=require(_0xfb39('0x1'));var logger=require(_0xfb39('0x2'))(_0xfb39('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb39('0x4'));var rimraf=require('rimraf');var config=require(_0xfb39('0x5'));var attributes=require(_0xfb39('0x6'));module['exports']=function(_0x1619f6,_0x455dbe){return _0x1619f6[_0xfb39('0x7')](_0xfb39('0x8'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc73a=['exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','api','request-promise','path','rimraf','./analyticMetric.attributes'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0xc73a,0x72));var _0xac73=function(_0x415b79,_0x3c813f){_0x415b79=_0x415b79-0x0;var _0x2ef640=_0xc73a[_0x415b79];return _0x2ef640;};'use strict';var _=require('lodash');var util=require(_0xac73('0x0'));var logger=require(_0xac73('0x1'))(_0xac73('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xac73('0x3'));var fs=require('fs');var path=require(_0xac73('0x4'));var rimraf=require(_0xac73('0x5'));var config=require('../../config/environment');var attributes=require(_0xac73('0x6'));module[_0xac73('0x7')]=function(_0x23fa68,_0x57992a){return _0x23fa68[_0xac73('0x8')](_0xac73('0x9'),attributes,{'tableName':_0xac73('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index a6181fd..0f194f7 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 _0x939a=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring'];(function(_0x488684,_0xa14634){var _0x3b8d92=function(_0x195202){while(--_0x195202){_0x488684['push'](_0x488684['shift']());}};_0x3b8d92(++_0xa14634);}(_0x939a,0x178));var _0xa939=function(_0x35acee,_0x9e1d14){_0x35acee=_0x35acee-0x0;var _0x55e9ff=_0x939a[_0x35acee];return _0x55e9ff;};'use strict';var _=require('lodash');var util=require(_0xa939('0x0'));var moment=require(_0xa939('0x1'));var BPromise=require(_0xa939('0x2'));var rs=require(_0xa939('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa939('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa939('0x5'))(_0xa939('0x6'));var config=require(_0xa939('0x7'));var jayson=require(_0xa939('0x8'));var client=jayson[_0xa939('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x413c78,_0x265844,_0x3dd51b){return new BPromise(function(_0x741a73,_0x34381b){return client[_0xa939('0xa')](_0x413c78,_0x3dd51b)[_0xa939('0xb')](function(_0x482b2b){logger['info'](_0xa939('0xc'),_0x265844,'request\x20sent');logger['debug'](_0xa939('0xd'),_0x265844,_0xa939('0xe'),JSON[_0xa939('0xf')](_0x482b2b));if(_0x482b2b[_0xa939('0x10')]){if(_0x482b2b['error'][_0xa939('0x11')]===0x1f4){logger[_0xa939('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x265844,_0x482b2b[_0xa939('0x10')][_0xa939('0x12')]);return _0x34381b(_0x482b2b[_0xa939('0x10')][_0xa939('0x12')]);}logger[_0xa939('0x10')](_0xa939('0xc'),_0x265844,_0x482b2b[_0xa939('0x10')]['message']);return _0x741a73(_0x482b2b['error'][_0xa939('0x12')]);}else{logger['info'](_0xa939('0xc'),_0x265844,_0xa939('0xe'));_0x741a73(_0x482b2b[_0xa939('0x13')]['message']);}})['catch'](function(_0x19b504){logger[_0xa939('0x10')](_0xa939('0xc'),_0x265844,_0x19b504);_0x34381b(_0x19b504);});});} \ No newline at end of file +var _0xd466=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3afcf1,_0x5e12ec){var _0x193c29=function(_0x1bfc2c){while(--_0x1bfc2c){_0x3afcf1['push'](_0x3afcf1['shift']());}};_0x193c29(++_0x5e12ec);}(_0xd466,0xe7));var _0x6d46=function(_0x2637e5,_0x46b19d){_0x2637e5=_0x2637e5-0x0;var _0xc30f8e=_0xd466[_0x2637e5];return _0xc30f8e;};'use strict';var _=require(_0x6d46('0x0'));var util=require(_0x6d46('0x1'));var moment=require(_0x6d46('0x2'));var BPromise=require(_0x6d46('0x3'));var rs=require(_0x6d46('0x4'));var fs=require('fs');var Redis=require(_0x6d46('0x5'));var db=require(_0x6d46('0x6'))['db'];var utils=require(_0x6d46('0x7'));var logger=require(_0x6d46('0x8'))('rpc');var config=require(_0x6d46('0x9'));var jayson=require(_0x6d46('0xa'));var client=jayson[_0x6d46('0xb')][_0x6d46('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dd3a2,_0x21b78d,_0x25bbe7){return new BPromise(function(_0x4a67cf,_0x6609b8){return client[_0x6d46('0xd')](_0x2dd3a2,_0x25bbe7)[_0x6d46('0xe')](function(_0x4ac3f8){logger[_0x6d46('0xf')](_0x6d46('0x10'),_0x21b78d,_0x6d46('0x11'));logger[_0x6d46('0x12')](_0x6d46('0x13'),_0x21b78d,_0x6d46('0x11'),JSON[_0x6d46('0x14')](_0x4ac3f8));if(_0x4ac3f8[_0x6d46('0x15')]){if(_0x4ac3f8[_0x6d46('0x15')]['code']===0x1f4){logger[_0x6d46('0x15')](_0x6d46('0x10'),_0x21b78d,_0x4ac3f8[_0x6d46('0x15')][_0x6d46('0x16')]);return _0x6609b8(_0x4ac3f8[_0x6d46('0x15')][_0x6d46('0x16')]);}logger[_0x6d46('0x15')]('AnalyticMetric,\x20%s,\x20%s',_0x21b78d,_0x4ac3f8['error'][_0x6d46('0x16')]);return _0x4a67cf(_0x4ac3f8[_0x6d46('0x15')][_0x6d46('0x16')]);}else{logger[_0x6d46('0xf')](_0x6d46('0x10'),_0x21b78d,'request\x20sent');_0x4a67cf(_0x4ac3f8[_0x6d46('0x17')]['message']);}})['catch'](function(_0x865b7e){logger[_0x6d46('0x15')](_0x6d46('0x10'),_0x21b78d,_0x865b7e);_0x6609b8(_0x865b7e);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index c341e14..4b22d2d 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 _0x891b=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','index','show','post','isAuthenticated','create','put','/:id','delete','destroy','exports','path'];(function(_0x54e2b3,_0xc5ce45){var _0x9aa063=function(_0x421770){while(--_0x421770){_0x54e2b3['push'](_0x54e2b3['shift']());}};_0x9aa063(++_0xc5ce45);}(_0x891b,0xc5));var _0xb891=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x891b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb891('0x0'));var timeout=require(_0xb891('0x1'));var express=require('express');var router=express[_0xb891('0x2')]();var fs_extra=require(_0xb891('0x3'));var auth=require(_0xb891('0x4'));var interaction=require(_0xb891('0x5'));var config=require('../../config/environment');var controller=require(_0xb891('0x6'));router[_0xb891('0x7')]('/',auth['isAuthenticated'](),controller[_0xb891('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb891('0x9')]);router[_0xb891('0xa')]('/',auth[_0xb891('0xb')](),controller[_0xb891('0xc')]);router[_0xb891('0xd')](_0xb891('0xe'),auth[_0xb891('0xb')](),controller['update']);router[_0xb891('0xf')](_0xb891('0xe'),auth[_0xb891('0xb')](),controller[_0xb891('0x10')]);module[_0xb891('0x11')]=router; \ No newline at end of file +var _0x63b6=['get','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated'];(function(_0x1c3080,_0x59c2b1){var _0x517c07=function(_0x1e851c){while(--_0x1e851c){_0x1c3080['push'](_0x1c3080['shift']());}};_0x517c07(++_0x59c2b1);}(_0x63b6,0x127));var _0x663b=function(_0x23f7c0,_0x1dab5f){_0x23f7c0=_0x23f7c0-0x0;var _0x2dc413=_0x63b6[_0x23f7c0];return _0x2dc413;};'use strict';var multer=require(_0x663b('0x0'));var util=require(_0x663b('0x1'));var path=require(_0x663b('0x2'));var timeout=require('connect-timeout');var express=require(_0x663b('0x3'));var router=express['Router']();var fs_extra=require(_0x663b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x663b('0x5'));var config=require(_0x663b('0x6'));var controller=require(_0x663b('0x7'));router['get']('/',auth[_0x663b('0x8')](),controller['index']);router[_0x663b('0x9')]('/:id',auth[_0x663b('0x8')](),controller[_0x663b('0xa')]);router[_0x663b('0xb')]('/',auth[_0x663b('0x8')](),controller[_0x663b('0xc')]);router[_0x663b('0xd')]('/:id',auth[_0x663b('0x8')](),controller[_0x663b('0xe')]);router[_0x663b('0xf')](_0x663b('0x10'),auth[_0x663b('0x8')](),controller[_0x663b('0x11')]);module[_0x663b('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 185bcbd..6ad6c5d 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 _0x11b4=['sequelize','exports','TEXT'];(function(_0x350a77,_0x404b6c){var _0x3dc5a6=function(_0x355716){while(--_0x355716){_0x350a77['push'](_0x350a77['shift']());}};_0x3dc5a6(++_0x404b6c);}(_0x11b4,0x168));var _0x411b=function(_0x1f5c0e,_0x3eebf3){_0x1f5c0e=_0x1f5c0e-0x0;var _0x25e992=_0x11b4[_0x1f5c0e];return _0x25e992;};'use strict';var Sequelize=require(_0x411b('0x0'));module[_0x411b('0x1')]={'tree':{'type':Sequelize[_0x411b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x515d=['exports','TEXT'];(function(_0x4ec56d,_0x1c3f81){var _0x560fdb=function(_0x12fbc8){while(--_0x12fbc8){_0x4ec56d['push'](_0x4ec56d['shift']());}};_0x560fdb(++_0x1c3f81);}(_0x515d,0x104));var _0xd515=function(_0x4ddc5d,_0x33e649){_0x4ddc5d=_0x4ddc5d-0x0;var _0x231056=_0x515d[_0x4ddc5d];return _0x231056;};'use strict';var Sequelize=require('sequelize');module[_0xd515('0x0')]={'tree':{'type':Sequelize[_0xd515('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 774a8ae..4baaac0 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 _0x6d4f=['index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','catch','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0x240773,_0x446008){var _0x2f1a63=function(_0x195844){while(--_0x195844){_0x240773['push'](_0x240773['shift']());}};_0x2f1a63(++_0x446008);}(_0x6d4f,0x105));var _0xf6d4=function(_0x3eef60,_0x9eb279){_0x3eef60=_0x3eef60-0x0;var _0x569efe=_0x6d4f[_0x3eef60];return _0x569efe;};'use strict';var emlformat=require(_0xf6d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6d4('0x1'));var jsonpatch=require(_0xf6d4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf6d4('0x3'));var Mustache=require(_0xf6d4('0x4'));var util=require(_0xf6d4('0x5'));var path=require(_0xf6d4('0x6'));var sox=require(_0xf6d4('0x7'));var csv=require(_0xf6d4('0x8'));var ejs=require(_0xf6d4('0x9'));var fs=require('fs');var fs_extra=require(_0xf6d4('0xa'));var _=require(_0xf6d4('0xb'));var squel=require(_0xf6d4('0xc'));var crypto=require(_0xf6d4('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6d4('0x8'));var querystring=require(_0xf6d4('0xe'));var Papa=require(_0xf6d4('0xf'));var Redis=require(_0xf6d4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf6d4('0x11'));var as=require(_0xf6d4('0x12'));var hardwareService=require(_0xf6d4('0x13'));var logger=require(_0xf6d4('0x14'))(_0xf6d4('0x15'));var utils=require(_0xf6d4('0x16'));var config=require(_0xf6d4('0x17'));var licenseUtil=require(_0xf6d4('0x18'));var db=require(_0xf6d4('0x19'))['db'];function respondWithStatusCode(_0x2d5744,_0x3383e5){_0x3383e5=_0x3383e5||0xcc;return function(_0x108db4){if(_0x108db4){return _0x2d5744['sendStatus'](_0x3383e5);}return _0x2d5744[_0xf6d4('0x1a')](_0x3383e5)[_0xf6d4('0x1b')]();};}function respondWithResult(_0x53855f,_0xa5ec46){_0xa5ec46=_0xa5ec46||0xc8;return function(_0x1c2401){if(_0x1c2401){return _0x53855f[_0xf6d4('0x1a')](_0xa5ec46)['json'](_0x1c2401);}};}function respondWithFilteredResult(_0x31cf0e,_0x23766b){return function(_0x3b3345){if(_0x3b3345){var _0x3c0ffe=typeof _0x23766b[_0xf6d4('0x1c')]===_0xf6d4('0x1d')&&typeof _0x23766b[_0xf6d4('0x1e')]==='undefined';var _0x334056=_0x3b3345[_0xf6d4('0x1f')];var _0x32dcc0=_0x3c0ffe?0x0:_0x23766b[_0xf6d4('0x1c')];var _0x1dc658=_0x3c0ffe?_0x3b3345[_0xf6d4('0x1f')]:_0x23766b[_0xf6d4('0x1c')]+_0x23766b[_0xf6d4('0x1e')];var _0x2da844;if(_0x1dc658>=_0x334056){_0x1dc658=_0x334056;_0x2da844=0xc8;}else{_0x2da844=0xce;}_0x31cf0e['status'](_0x2da844);return _0x31cf0e[_0xf6d4('0x20')]('Content-Range',_0x32dcc0+'-'+_0x1dc658+'/'+_0x334056)['json'](_0x3b3345);}return null;};}function patchUpdates(_0x1502a0){return function(_0x3d030e){try{jsonpatch[_0xf6d4('0x21')](_0x3d030e,_0x1502a0,!![]);}catch(_0x3eb184){return BPromise['reject'](_0x3eb184);}return _0x3d030e[_0xf6d4('0x22')]();};}function saveUpdates(_0x1b69fa,_0x3b6245){return function(_0x1cbd2e){if(_0x1cbd2e){return _0x1cbd2e[_0xf6d4('0x23')](_0x1b69fa)[_0xf6d4('0x24')](function(_0x1d8637){return _0x1d8637;});}return null;};}function removeEntity(_0x38e5ea,_0x45c3df){return function(_0x3d1dd3){if(_0x3d1dd3){return _0x3d1dd3[_0xf6d4('0x25')]()[_0xf6d4('0x24')](function(){_0x38e5ea['status'](0xcc)[_0xf6d4('0x1b')]();});}};}function handleEntityNotFound(_0x1263dd,_0x3eee76){return function(_0x2d6387){if(!_0x2d6387){_0x1263dd[_0xf6d4('0x26')](0x194);}return _0x2d6387;};}function handleError(_0xc46e5c,_0x38f95e){_0x38f95e=_0x38f95e||0x1f4;return function(_0x82daeb){logger[_0xf6d4('0x27')](_0x82daeb[_0xf6d4('0x28')]);if(_0x82daeb[_0xf6d4('0x29')]){delete _0x82daeb[_0xf6d4('0x29')];}_0xc46e5c['status'](_0x38f95e)[_0xf6d4('0x2a')](_0x82daeb);};}exports[_0xf6d4('0x2b')]=function(_0x14dd3f,_0x9af1e8){var _0xb21f3e={},_0xd79a69={},_0x51adcf={'count':0x0,'rows':[]};var _0x40918b=_[_0xf6d4('0x2c')](db[_0xf6d4('0x2d')][_0xf6d4('0x2e')],function(_0x4cba90){return{'name':_0x4cba90[_0xf6d4('0x2f')],'type':_0x4cba90[_0xf6d4('0x30')][_0xf6d4('0x31')]};});_0xd79a69['model']=_[_0xf6d4('0x2c')](_0x40918b,_0xf6d4('0x29'));_0xd79a69['query']=_[_0xf6d4('0x32')](_0x14dd3f['query']);_0xd79a69['filters']=_[_0xf6d4('0x33')](_0xd79a69[_0xf6d4('0x34')],_0xd79a69[_0xf6d4('0x35')]);_0xb21f3e[_0xf6d4('0x36')]=_[_0xf6d4('0x33')](_0xd79a69[_0xf6d4('0x34')],qs['fields'](_0x14dd3f['query'][_0xf6d4('0x37')]));_0xb21f3e[_0xf6d4('0x36')]=_0xb21f3e[_0xf6d4('0x36')][_0xf6d4('0x38')]?_0xb21f3e['attributes']:_0xd79a69[_0xf6d4('0x34')];if(!_0x14dd3f[_0xf6d4('0x35')][_0xf6d4('0x39')]('nolimit')){_0xb21f3e[_0xf6d4('0x1e')]=qs['limit'](_0x14dd3f[_0xf6d4('0x35')][_0xf6d4('0x1e')]);_0xb21f3e[_0xf6d4('0x1c')]=qs['offset'](_0x14dd3f['query'][_0xf6d4('0x1c')]);}_0xb21f3e[_0xf6d4('0x3a')]=qs[_0xf6d4('0x3b')](_0x14dd3f[_0xf6d4('0x35')][_0xf6d4('0x3b')]);_0xb21f3e[_0xf6d4('0x3c')]=qs[_0xf6d4('0x3d')](_[_0xf6d4('0x3e')](_0x14dd3f[_0xf6d4('0x35')],_0xd79a69[_0xf6d4('0x3d')]),_0x40918b);if(_0x14dd3f['query'][_0xf6d4('0x3f')]){_0xb21f3e['where']=_[_0xf6d4('0x40')](_0xb21f3e[_0xf6d4('0x3c')],{'$or':_[_0xf6d4('0x2c')](_0x40918b,function(_0x633252){if(_0x633252['type']!==_0xf6d4('0x41')){var _0x4f1a44={};_0x4f1a44[_0x633252[_0xf6d4('0x29')]]={'$like':'%'+_0x14dd3f[_0xf6d4('0x35')]['filter']+'%'};return _0x4f1a44;}})});}_0xb21f3e=_[_0xf6d4('0x40')]({},_0xb21f3e,_0x14dd3f[_0xf6d4('0x42')]);var _0x502efd={'where':_0xb21f3e[_0xf6d4('0x3c')]};return db[_0xf6d4('0x2d')][_0xf6d4('0x1f')](_0x502efd)[_0xf6d4('0x24')](function(_0xda4e4b){_0x51adcf['count']=_0xda4e4b;if(_0x14dd3f[_0xf6d4('0x35')][_0xf6d4('0x43')]){_0xb21f3e['include']=[{'all':!![]}];}return db[_0xf6d4('0x2d')][_0xf6d4('0x44')](_0xb21f3e);})[_0xf6d4('0x24')](function(_0x4bfc79){_0x51adcf['rows']=_0x4bfc79;return _0x51adcf;})[_0xf6d4('0x24')](respondWithFilteredResult(_0x9af1e8,_0xb21f3e))['catch'](handleError(_0x9af1e8,null));};exports[_0xf6d4('0x45')]=function(_0x42728b,_0x229c45){var _0x121c4b={'raw':!![],'where':{'id':_0x42728b[_0xf6d4('0x46')]['id']}},_0x3a9231={};_0x3a9231[_0xf6d4('0x34')]=_[_0xf6d4('0x32')](db[_0xf6d4('0x2d')][_0xf6d4('0x2e')]);_0x3a9231[_0xf6d4('0x35')]=_[_0xf6d4('0x32')](_0x42728b[_0xf6d4('0x35')]);_0x3a9231['filters']=_[_0xf6d4('0x33')](_0x3a9231[_0xf6d4('0x34')],_0x3a9231[_0xf6d4('0x35')]);_0x121c4b[_0xf6d4('0x36')]=_[_0xf6d4('0x33')](_0x3a9231[_0xf6d4('0x34')],qs[_0xf6d4('0x37')](_0x42728b[_0xf6d4('0x35')][_0xf6d4('0x37')]));_0x121c4b[_0xf6d4('0x36')]=_0x121c4b[_0xf6d4('0x36')][_0xf6d4('0x38')]?_0x121c4b[_0xf6d4('0x36')]:_0x3a9231[_0xf6d4('0x34')];if(_0x42728b[_0xf6d4('0x35')]['includeAll']){_0x121c4b[_0xf6d4('0x47')]=[{'all':!![]}];}_0x121c4b=_['merge']({},_0x121c4b,_0x42728b[_0xf6d4('0x42')]);return db[_0xf6d4('0x2d')][_0xf6d4('0x48')](_0x121c4b)['then'](handleEntityNotFound(_0x229c45,null))[_0xf6d4('0x24')](respondWithResult(_0x229c45,null))[_0xf6d4('0x49')](handleError(_0x229c45,null));};exports['create']=function(_0x3c0b7e,_0x45ea5c){return db[_0xf6d4('0x2d')][_0xf6d4('0x4a')](_0x3c0b7e[_0xf6d4('0x4b')],{})[_0xf6d4('0x24')](respondWithResult(_0x45ea5c,0xc9))[_0xf6d4('0x49')](handleError(_0x45ea5c,null));};exports[_0xf6d4('0x23')]=function(_0x530d0f,_0x45d856){if(_0x530d0f[_0xf6d4('0x4b')]['id']){delete _0x530d0f[_0xf6d4('0x4b')]['id'];}return db[_0xf6d4('0x2d')][_0xf6d4('0x48')]({'where':{'id':_0x530d0f[_0xf6d4('0x46')]['id']}})['then'](handleEntityNotFound(_0x45d856,null))[_0xf6d4('0x24')](saveUpdates(_0x530d0f[_0xf6d4('0x4b')],null))['then'](respondWithResult(_0x45d856,null))[_0xf6d4('0x49')](handleError(_0x45d856,null));};exports[_0xf6d4('0x25')]=function(_0x36f19e,_0x549cc7){return db[_0xf6d4('0x2d')][_0xf6d4('0x48')]({'where':{'id':_0x36f19e['params']['id']}})[_0xf6d4('0x24')](handleEntityNotFound(_0x549cc7,null))[_0xf6d4('0x24')](removeEntity(_0x549cc7,null))[_0xf6d4('0x49')](handleError(_0x549cc7,null));}; \ No newline at end of file +var _0xe830=['body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','params','find','create'];(function(_0x45510d,_0x235f12){var _0x263399=function(_0x31c6a4){while(--_0x31c6a4){_0x45510d['push'](_0x45510d['shift']());}};_0x263399(++_0x235f12);}(_0xe830,0xe5));var _0x0e83=function(_0x45533a,_0xf6d29a){_0x45533a=_0x45533a-0x0;var _0x35e675=_0xe830[_0x45533a];return _0x35e675;};'use strict';var emlformat=require(_0x0e83('0x0'));var rimraf=require(_0x0e83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e83('0x2'));var rp=require(_0x0e83('0x3'));var moment=require(_0x0e83('0x4'));var BPromise=require(_0x0e83('0x5'));var Mustache=require(_0x0e83('0x6'));var util=require(_0x0e83('0x7'));var path=require(_0x0e83('0x8'));var sox=require(_0x0e83('0x9'));var csv=require(_0x0e83('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e83('0xb'));var squel=require('squel');var crypto=require(_0x0e83('0xc'));var jsforce=require(_0x0e83('0xd'));var deskjs=require(_0x0e83('0xe'));var toCsv=require(_0x0e83('0xa'));var querystring=require(_0x0e83('0xf'));var Papa=require(_0x0e83('0x10'));var Redis=require(_0x0e83('0x11'));var authService=require(_0x0e83('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0e83('0x13'));var hardwareService=require(_0x0e83('0x14'));var logger=require(_0x0e83('0x15'))(_0x0e83('0x16'));var utils=require(_0x0e83('0x17'));var config=require(_0x0e83('0x18'));var licenseUtil=require(_0x0e83('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c6b7e,_0x1d461d){_0x1d461d=_0x1d461d||0xcc;return function(_0x141c45){if(_0x141c45){return _0x4c6b7e['sendStatus'](_0x1d461d);}return _0x4c6b7e[_0x0e83('0x1a')](_0x1d461d)[_0x0e83('0x1b')]();};}function respondWithResult(_0xb25b34,_0x26f5d4){_0x26f5d4=_0x26f5d4||0xc8;return function(_0x2f652f){if(_0x2f652f){return _0xb25b34[_0x0e83('0x1a')](_0x26f5d4)[_0x0e83('0x1c')](_0x2f652f);}};}function respondWithFilteredResult(_0x3fb4e7,_0x20eb82){return function(_0x5d52ea){if(_0x5d52ea){var _0x463a1d=typeof _0x20eb82[_0x0e83('0x1d')]===_0x0e83('0x1e')&&typeof _0x20eb82['limit']===_0x0e83('0x1e');var _0x7032c7=_0x5d52ea[_0x0e83('0x1f')];var _0xa0b29c=_0x463a1d?0x0:_0x20eb82[_0x0e83('0x1d')];var _0x153ddc=_0x463a1d?_0x5d52ea[_0x0e83('0x1f')]:_0x20eb82['offset']+_0x20eb82[_0x0e83('0x20')];var _0x4ac5c2;if(_0x153ddc>=_0x7032c7){_0x153ddc=_0x7032c7;_0x4ac5c2=0xc8;}else{_0x4ac5c2=0xce;}_0x3fb4e7[_0x0e83('0x1a')](_0x4ac5c2);return _0x3fb4e7[_0x0e83('0x21')](_0x0e83('0x22'),_0xa0b29c+'-'+_0x153ddc+'/'+_0x7032c7)['json'](_0x5d52ea);}return null;};}function patchUpdates(_0x4ebc7b){return function(_0x1f8c0b){try{jsonpatch['apply'](_0x1f8c0b,_0x4ebc7b,!![]);}catch(_0x15c10){return BPromise[_0x0e83('0x23')](_0x15c10);}return _0x1f8c0b['save']();};}function saveUpdates(_0x53979d,_0x57ae16){return function(_0x32fd9a){if(_0x32fd9a){return _0x32fd9a[_0x0e83('0x24')](_0x53979d)['then'](function(_0x51bc3c){return _0x51bc3c;});}return null;};}function removeEntity(_0x511e05,_0x261998){return function(_0x3e6fe9){if(_0x3e6fe9){return _0x3e6fe9[_0x0e83('0x25')]()['then'](function(){_0x511e05[_0x0e83('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52e3f9,_0x2ac8c3){return function(_0x4d687e){if(!_0x4d687e){_0x52e3f9[_0x0e83('0x26')](0x194);}return _0x4d687e;};}function handleError(_0x3a0d97,_0x509b77){_0x509b77=_0x509b77||0x1f4;return function(_0x33f99b){logger[_0x0e83('0x27')](_0x33f99b[_0x0e83('0x28')]);if(_0x33f99b[_0x0e83('0x29')]){delete _0x33f99b[_0x0e83('0x29')];}_0x3a0d97[_0x0e83('0x1a')](_0x509b77)[_0x0e83('0x2a')](_0x33f99b);};}exports[_0x0e83('0x2b')]=function(_0x105017,_0x129b55){var _0x21f4ea={},_0x432484={},_0x15c8cc={'count':0x0,'rows':[]};var _0x31c6b5=_[_0x0e83('0x2c')](db[_0x0e83('0x2d')][_0x0e83('0x2e')],function(_0x64a2bd){return{'name':_0x64a2bd[_0x0e83('0x2f')],'type':_0x64a2bd[_0x0e83('0x30')][_0x0e83('0x31')]};});_0x432484['model']=_[_0x0e83('0x2c')](_0x31c6b5,_0x0e83('0x29'));_0x432484[_0x0e83('0x32')]=_[_0x0e83('0x33')](_0x105017['query']);_0x432484['filters']=_[_0x0e83('0x34')](_0x432484[_0x0e83('0x35')],_0x432484[_0x0e83('0x32')]);_0x21f4ea['attributes']=_[_0x0e83('0x34')](_0x432484[_0x0e83('0x35')],qs[_0x0e83('0x36')](_0x105017[_0x0e83('0x32')][_0x0e83('0x36')]));_0x21f4ea[_0x0e83('0x37')]=_0x21f4ea[_0x0e83('0x37')][_0x0e83('0x38')]?_0x21f4ea[_0x0e83('0x37')]:_0x432484[_0x0e83('0x35')];if(!_0x105017[_0x0e83('0x32')]['hasOwnProperty']('nolimit')){_0x21f4ea[_0x0e83('0x20')]=qs[_0x0e83('0x20')](_0x105017[_0x0e83('0x32')][_0x0e83('0x20')]);_0x21f4ea[_0x0e83('0x1d')]=qs[_0x0e83('0x1d')](_0x105017[_0x0e83('0x32')]['offset']);}_0x21f4ea[_0x0e83('0x39')]=qs[_0x0e83('0x3a')](_0x105017[_0x0e83('0x32')][_0x0e83('0x3a')]);_0x21f4ea[_0x0e83('0x3b')]=qs['filters'](_[_0x0e83('0x3c')](_0x105017[_0x0e83('0x32')],_0x432484[_0x0e83('0x3d')]),_0x31c6b5);if(_0x105017[_0x0e83('0x32')][_0x0e83('0x3e')]){_0x21f4ea['where']=_[_0x0e83('0x3f')](_0x21f4ea[_0x0e83('0x3b')],{'$or':_[_0x0e83('0x2c')](_0x31c6b5,function(_0x4e4044){if(_0x4e4044[_0x0e83('0x30')]!==_0x0e83('0x40')){var _0x35e7f5={};_0x35e7f5[_0x4e4044[_0x0e83('0x29')]]={'$like':'%'+_0x105017[_0x0e83('0x32')][_0x0e83('0x3e')]+'%'};return _0x35e7f5;}})});}_0x21f4ea=_['merge']({},_0x21f4ea,_0x105017[_0x0e83('0x41')]);var _0x2b2b99={'where':_0x21f4ea[_0x0e83('0x3b')]};return db['AnalyticTreeReport']['count'](_0x2b2b99)[_0x0e83('0x42')](function(_0xfed616){_0x15c8cc[_0x0e83('0x1f')]=_0xfed616;if(_0x105017[_0x0e83('0x32')][_0x0e83('0x43')]){_0x21f4ea[_0x0e83('0x44')]=[{'all':!![]}];}return db[_0x0e83('0x2d')]['findAll'](_0x21f4ea);})[_0x0e83('0x42')](function(_0x38ecd0){_0x15c8cc[_0x0e83('0x45')]=_0x38ecd0;return _0x15c8cc;})[_0x0e83('0x42')](respondWithFilteredResult(_0x129b55,_0x21f4ea))[_0x0e83('0x46')](handleError(_0x129b55,null));};exports[_0x0e83('0x47')]=function(_0x5552e4,_0x4eb48b){var _0x23dd62={'raw':!![],'where':{'id':_0x5552e4[_0x0e83('0x48')]['id']}},_0x422198={};_0x422198[_0x0e83('0x35')]=_[_0x0e83('0x33')](db[_0x0e83('0x2d')][_0x0e83('0x2e')]);_0x422198[_0x0e83('0x32')]=_[_0x0e83('0x33')](_0x5552e4[_0x0e83('0x32')]);_0x422198[_0x0e83('0x3d')]=_[_0x0e83('0x34')](_0x422198[_0x0e83('0x35')],_0x422198[_0x0e83('0x32')]);_0x23dd62[_0x0e83('0x37')]=_['intersection'](_0x422198['model'],qs[_0x0e83('0x36')](_0x5552e4[_0x0e83('0x32')][_0x0e83('0x36')]));_0x23dd62[_0x0e83('0x37')]=_0x23dd62[_0x0e83('0x37')]['length']?_0x23dd62[_0x0e83('0x37')]:_0x422198[_0x0e83('0x35')];if(_0x5552e4[_0x0e83('0x32')][_0x0e83('0x43')]){_0x23dd62[_0x0e83('0x44')]=[{'all':!![]}];}_0x23dd62=_[_0x0e83('0x3f')]({},_0x23dd62,_0x5552e4[_0x0e83('0x41')]);return db[_0x0e83('0x2d')][_0x0e83('0x49')](_0x23dd62)['then'](handleEntityNotFound(_0x4eb48b,null))[_0x0e83('0x42')](respondWithResult(_0x4eb48b,null))[_0x0e83('0x46')](handleError(_0x4eb48b,null));};exports[_0x0e83('0x4a')]=function(_0x5b41b5,_0x3c6fe3){return db[_0x0e83('0x2d')]['create'](_0x5b41b5[_0x0e83('0x4b')],{})[_0x0e83('0x42')](respondWithResult(_0x3c6fe3,0xc9))[_0x0e83('0x46')](handleError(_0x3c6fe3,null));};exports[_0x0e83('0x24')]=function(_0x498feb,_0x28adeb){if(_0x498feb['body']['id']){delete _0x498feb['body']['id'];}return db[_0x0e83('0x2d')][_0x0e83('0x49')]({'where':{'id':_0x498feb[_0x0e83('0x48')]['id']}})[_0x0e83('0x42')](handleEntityNotFound(_0x28adeb,null))[_0x0e83('0x42')](saveUpdates(_0x498feb[_0x0e83('0x4b')],null))[_0x0e83('0x42')](respondWithResult(_0x28adeb,null))[_0x0e83('0x46')](handleError(_0x28adeb,null));};exports[_0x0e83('0x25')]=function(_0x25e25a,_0x17b9e0){return db[_0x0e83('0x2d')][_0x0e83('0x49')]({'where':{'id':_0x25e25a['params']['id']}})['then'](handleEntityNotFound(_0x17b9e0,null))[_0x0e83('0x42')](removeEntity(_0x17b9e0,null))[_0x0e83('0x46')](handleError(_0x17b9e0,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index c6dfec3..db313ff 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 _0xef02=['path','rimraf','exports','define','AnalyticTreeReport','analytics_report_trees','util','api','bluebird'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xef02,0x9f));var _0x2ef0=function(_0x1a72b8,_0x1e4f4b){_0x1a72b8=_0x1a72b8-0x0;var _0x39f72d=_0xef02[_0x1a72b8];return _0x39f72d;};'use strict';var _=require('lodash');var util=require(_0x2ef0('0x0'));var logger=require('../../config/logger')(_0x2ef0('0x1'));var moment=require('moment');var BPromise=require(_0x2ef0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ef0('0x3'));var rimraf=require(_0x2ef0('0x4'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x2ef0('0x5')]=function(_0x32a740,_0x30d433){return _0x32a740[_0x2ef0('0x6')](_0x2ef0('0x7'),attributes,{'tableName':_0x2ef0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71e6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','analytics_report_trees','util','api'];(function(_0xccecef,_0x52e019){var _0xfba4d3=function(_0xb6b9aa){while(--_0xb6b9aa){_0xccecef['push'](_0xccecef['shift']());}};_0xfba4d3(++_0x52e019);}(_0x71e6,0x1ab));var _0x671e=function(_0x39be73,_0x31a022){_0x39be73=_0x39be73-0x0;var _0x14b572=_0x71e6[_0x39be73];return _0x14b572;};'use strict';var _=require('lodash');var util=require(_0x671e('0x0'));var logger=require('../../config/logger')(_0x671e('0x1'));var moment=require(_0x671e('0x2'));var BPromise=require(_0x671e('0x3'));var rp=require(_0x671e('0x4'));var fs=require('fs');var path=require(_0x671e('0x5'));var rimraf=require(_0x671e('0x6'));var config=require(_0x671e('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x671e('0x8')]=function(_0x5ce6aa,_0x5d80ca){return _0x5ce6aa[_0x671e('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x671e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index de586bb..aa3f137 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(_0x34a47b,_0x109857){var _0x3bd3d7=function(_0x30e79a){while(--_0x30e79a){_0x34a47b['push'](_0x34a47b['shift']());}};_0x3bd3d7(++_0x109857);}(_0x2ef3,0xba));var _0x32ef=function(_0x2b7edf,_0x3cffce){_0x2b7edf=_0x2b7edf-0x0;var _0x59bc17=_0x2ef3[_0x2b7edf];return _0x59bc17;};'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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x450f34,_0x19858b){var _0xa68752=function(_0x4fd64d){while(--_0x4fd64d){_0x450f34['push'](_0x450f34['shift']());}};_0xa68752(++_0x19858b);}(_0xdb28,0x106));var _0x8db2=function(_0x3acb10,_0x37fa4a){_0x3acb10=_0x3acb10-0x0;var _0x3d9d32=_0xdb28[_0x3acb10];return _0x3d9d32;};'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')]('AnalyticTreeReport,\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);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index e793c56..828fd85 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 _0x2f5f=['put','/:id','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x2f5f,0x193));var _0xf2f5=function(_0x1ac62d,_0x223a72){_0x1ac62d=_0x1ac62d-0x0;var _0x4bd6b6=_0x2f5f[_0x1ac62d];return _0x4bd6b6;};'use strict';var multer=require(_0xf2f5('0x0'));var util=require(_0xf2f5('0x1'));var path=require(_0xf2f5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf2f5('0x3')]();var fs_extra=require(_0xf2f5('0x4'));var auth=require(_0xf2f5('0x5'));var interaction=require(_0xf2f5('0x6'));var config=require(_0xf2f5('0x7'));var controller=require(_0xf2f5('0x8'));router[_0xf2f5('0x9')]('/',auth[_0xf2f5('0xa')](),controller[_0xf2f5('0xb')]);router[_0xf2f5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf2f5('0xc')]);router[_0xf2f5('0xd')]('/',auth['isAuthenticated'](),controller[_0xf2f5('0xe')]);router[_0xf2f5('0xf')](_0xf2f5('0x10'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf2f5('0x10'),auth['isAuthenticated'](),controller[_0xf2f5('0x11')]);module[_0xf2f5('0x12')]=router; \ No newline at end of file +var _0x8c82=['create','put','/:id','update','delete','destroy','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','isAuthenticated','show','post'];(function(_0x18cc1c,_0x10f42d){var _0x205f02=function(_0x3e3be4){while(--_0x3e3be4){_0x18cc1c['push'](_0x18cc1c['shift']());}};_0x205f02(++_0x10f42d);}(_0x8c82,0x126));var _0x28c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c82[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x28c8('0x0'));var util=require(_0x28c8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x28c8('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x28c8('0x3'));var interaction=require(_0x28c8('0x4'));var config=require(_0x28c8('0x5'));var controller=require(_0x28c8('0x6'));router[_0x28c8('0x7')]('/',auth['isAuthenticated'](),controller[_0x28c8('0x8')]);router[_0x28c8('0x7')]('/:id',auth[_0x28c8('0x9')](),controller[_0x28c8('0xa')]);router[_0x28c8('0xb')]('/',auth[_0x28c8('0x9')](),controller[_0x28c8('0xc')]);router[_0x28c8('0xd')](_0x28c8('0xe'),auth[_0x28c8('0x9')](),controller[_0x28c8('0xf')]);router[_0x28c8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x28c8('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 6db9962..ae4e812 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 _0xe9e8=['exports','STRING','sequelize'];(function(_0x17403d,_0x37c6f9){var _0x1b130b=function(_0x1992d6){while(--_0x1992d6){_0x17403d['push'](_0x17403d['shift']());}};_0x1b130b(++_0x37c6f9);}(_0xe9e8,0x179));var _0x8e9e=function(_0x562e6c,_0x1d4b7c){_0x562e6c=_0x562e6c-0x0;var _0x17d1ab=_0xe9e8[_0x562e6c];return _0x17d1ab;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'name':{'type':Sequelize[_0x8e9e('0x2')]},'basename':{'type':Sequelize[_0x8e9e('0x2')]},'type':{'type':Sequelize[_0x8e9e('0x2')]}}; \ No newline at end of file +var _0xd382=['sequelize','exports','STRING'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xd382,0x1b6));var _0x2d38=function(_0x37d7e9,_0x5034be){_0x37d7e9=_0x37d7e9-0x0;var _0x53b51c=_0xd382[_0x37d7e9];return _0x53b51c;};'use strict';var Sequelize=require(_0x2d38('0x0'));module[_0x2d38('0x1')]={'name':{'type':Sequelize[_0x2d38('0x2')]},'basename':{'type':Sequelize[_0x2d38('0x2')]},'type':{'type':Sequelize[_0x2d38('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 00e62fd..9c54aa6 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 _0x7a4f=['count','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','get','omit','createdAt','updatedAt','body','create','originalname','filename','file','mimetype','ChatOfflineMessageId','join','root','offline-chat/','basename','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x7a4f,0x141));var _0xf7a4=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0x7a4f[_0x547456];return _0xc1fd7b;};'use strict';var emlformat=require(_0xf7a4('0x0'));var rimraf=require(_0xf7a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7a4('0x2'));var rp=require(_0xf7a4('0x3'));var moment=require(_0xf7a4('0x4'));var BPromise=require(_0xf7a4('0x5'));var Mustache=require(_0xf7a4('0x6'));var util=require(_0xf7a4('0x7'));var path=require(_0xf7a4('0x8'));var sox=require(_0xf7a4('0x9'));var csv=require(_0xf7a4('0xa'));var ejs=require(_0xf7a4('0xb'));var fs=require('fs');var fs_extra=require(_0xf7a4('0xc'));var _=require('lodash');var squel=require(_0xf7a4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf7a4('0xe'));var Papa=require(_0xf7a4('0xf'));var Redis=require(_0xf7a4('0x10'));var authService=require(_0xf7a4('0x11'));var qs=require(_0xf7a4('0x12'));var as=require(_0xf7a4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7a4('0x14'))(_0xf7a4('0x15'));var utils=require('../../config/utils');var config=require(_0xf7a4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf7a4('0x17'))['db'];function respondWithStatusCode(_0x30e184,_0x7f1bfe){_0x7f1bfe=_0x7f1bfe||0xcc;return function(_0x1846a2){if(_0x1846a2){return _0x30e184[_0xf7a4('0x18')](_0x7f1bfe);}return _0x30e184[_0xf7a4('0x19')](_0x7f1bfe)[_0xf7a4('0x1a')]();};}function respondWithResult(_0x4e169a,_0x51f9a1){_0x51f9a1=_0x51f9a1||0xc8;return function(_0x54754f){if(_0x54754f){return _0x4e169a[_0xf7a4('0x19')](_0x51f9a1)[_0xf7a4('0x1b')](_0x54754f);}};}function respondWithFilteredResult(_0x47b19e,_0x520ae2){return function(_0x2431fc){if(_0x2431fc){var _0x2775fd=typeof _0x520ae2[_0xf7a4('0x1c')]===_0xf7a4('0x1d')&&typeof _0x520ae2[_0xf7a4('0x1e')]===_0xf7a4('0x1d');var _0x304672=_0x2431fc[_0xf7a4('0x1f')];var _0x1a0b4a=_0x2775fd?0x0:_0x520ae2['offset'];var _0x548a38=_0x2775fd?_0x2431fc[_0xf7a4('0x1f')]:_0x520ae2[_0xf7a4('0x1c')]+_0x520ae2[_0xf7a4('0x1e')];var _0x3b9cd9;if(_0x548a38>=_0x304672){_0x548a38=_0x304672;_0x3b9cd9=0xc8;}else{_0x3b9cd9=0xce;}_0x47b19e[_0xf7a4('0x19')](_0x3b9cd9);return _0x47b19e[_0xf7a4('0x20')](_0xf7a4('0x21'),_0x1a0b4a+'-'+_0x548a38+'/'+_0x304672)[_0xf7a4('0x1b')](_0x2431fc);}return null;};}function patchUpdates(_0x44927c){return function(_0x1c82ea){try{jsonpatch['apply'](_0x1c82ea,_0x44927c,!![]);}catch(_0x1d2a76){return BPromise[_0xf7a4('0x22')](_0x1d2a76);}return _0x1c82ea[_0xf7a4('0x23')]();};}function saveUpdates(_0x2caed5,_0x2dd34c){return function(_0x3e5afe){if(_0x3e5afe){return _0x3e5afe[_0xf7a4('0x24')](_0x2caed5)[_0xf7a4('0x25')](function(_0x872c4){return _0x872c4;});}return null;};}function removeEntity(_0x2e57ef,_0x2173f7){return function(_0x4e7ebd){if(_0x4e7ebd){return _0x4e7ebd[_0xf7a4('0x26')]()[_0xf7a4('0x25')](function(){_0x2e57ef[_0xf7a4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18217e,_0x134bd2){return function(_0x5977f1){if(!_0x5977f1){_0x18217e['sendStatus'](0x194);}return _0x5977f1;};}function handleError(_0x11c81d,_0x20156f){_0x20156f=_0x20156f||0x1f4;return function(_0x455262){logger[_0xf7a4('0x27')](_0x455262['stack']);if(_0x455262['name']){delete _0x455262[_0xf7a4('0x28')];}_0x11c81d[_0xf7a4('0x19')](_0x20156f)['send'](_0x455262);};}exports[_0xf7a4('0x29')]=function(_0x137b1f,_0x5cf28d){var _0x3e23e2={},_0x181cbd={},_0x1505ba={'count':0x0,'rows':[]};var _0xe3a691=_[_0xf7a4('0x2a')](db[_0xf7a4('0x2b')][_0xf7a4('0x2c')],function(_0x3ff3e4){return{'name':_0x3ff3e4[_0xf7a4('0x2d')],'type':_0x3ff3e4[_0xf7a4('0x2e')][_0xf7a4('0x2f')]};});_0x181cbd[_0xf7a4('0x30')]=_[_0xf7a4('0x2a')](_0xe3a691,'name');_0x181cbd[_0xf7a4('0x31')]=_[_0xf7a4('0x32')](_0x137b1f['query']);_0x181cbd[_0xf7a4('0x33')]=_[_0xf7a4('0x34')](_0x181cbd[_0xf7a4('0x30')],_0x181cbd[_0xf7a4('0x31')]);_0x3e23e2[_0xf7a4('0x35')]=_['intersection'](_0x181cbd['model'],qs[_0xf7a4('0x36')](_0x137b1f[_0xf7a4('0x31')][_0xf7a4('0x36')]));_0x3e23e2['attributes']=_0x3e23e2[_0xf7a4('0x35')][_0xf7a4('0x37')]?_0x3e23e2[_0xf7a4('0x35')]:_0x181cbd[_0xf7a4('0x30')];if(!_0x137b1f['query'][_0xf7a4('0x38')](_0xf7a4('0x39'))){_0x3e23e2[_0xf7a4('0x1e')]=qs['limit'](_0x137b1f[_0xf7a4('0x31')][_0xf7a4('0x1e')]);_0x3e23e2[_0xf7a4('0x1c')]=qs[_0xf7a4('0x1c')](_0x137b1f[_0xf7a4('0x31')]['offset']);}_0x3e23e2['order']=qs[_0xf7a4('0x3a')](_0x137b1f[_0xf7a4('0x31')][_0xf7a4('0x3a')]);_0x3e23e2[_0xf7a4('0x3b')]=qs['filters'](_[_0xf7a4('0x3c')](_0x137b1f[_0xf7a4('0x31')],_0x181cbd[_0xf7a4('0x33')]),_0xe3a691);if(_0x137b1f[_0xf7a4('0x31')][_0xf7a4('0x3d')]){_0x3e23e2['where']=_[_0xf7a4('0x3e')](_0x3e23e2[_0xf7a4('0x3b')],{'$or':_[_0xf7a4('0x2a')](_0xe3a691,function(_0x12256c){if(_0x12256c[_0xf7a4('0x2e')]!==_0xf7a4('0x3f')){var _0x290396={};_0x290396[_0x12256c[_0xf7a4('0x28')]]={'$like':'%'+_0x137b1f[_0xf7a4('0x31')][_0xf7a4('0x3d')]+'%'};return _0x290396;}})});}_0x3e23e2=_['merge']({},_0x3e23e2,_0x137b1f[_0xf7a4('0x40')]);var _0x11e612={'where':_0x3e23e2[_0xf7a4('0x3b')]};return db[_0xf7a4('0x2b')][_0xf7a4('0x1f')](_0x11e612)['then'](function(_0x3e857d){_0x1505ba['count']=_0x3e857d;if(_0x137b1f['query'][_0xf7a4('0x41')]){_0x3e23e2[_0xf7a4('0x42')]=[{'all':!![]}];}return db[_0xf7a4('0x2b')]['findAll'](_0x3e23e2);})[_0xf7a4('0x25')](function(_0x3e924f){_0x1505ba[_0xf7a4('0x43')]=_0x3e924f;return _0x1505ba;})['then'](respondWithFilteredResult(_0x5cf28d,_0x3e23e2))[_0xf7a4('0x44')](handleError(_0x5cf28d,null));};exports[_0xf7a4('0x45')]=function(_0x5afcb9,_0x3219e3){var _0x40b85e={'raw':!![],'where':{'id':_0x5afcb9[_0xf7a4('0x46')]['id']}},_0x4f77a2={};_0x4f77a2[_0xf7a4('0x30')]=_[_0xf7a4('0x32')](db['Attachment'][_0xf7a4('0x2c')]);_0x4f77a2['query']=_[_0xf7a4('0x32')](_0x5afcb9[_0xf7a4('0x31')]);_0x4f77a2['filters']=_[_0xf7a4('0x34')](_0x4f77a2[_0xf7a4('0x30')],_0x4f77a2[_0xf7a4('0x31')]);_0x40b85e['attributes']=_[_0xf7a4('0x34')](_0x4f77a2[_0xf7a4('0x30')],qs[_0xf7a4('0x36')](_0x5afcb9[_0xf7a4('0x31')][_0xf7a4('0x36')]));_0x40b85e[_0xf7a4('0x35')]=_0x40b85e[_0xf7a4('0x35')][_0xf7a4('0x37')]?_0x40b85e[_0xf7a4('0x35')]:_0x4f77a2[_0xf7a4('0x30')];if(_0x5afcb9[_0xf7a4('0x31')][_0xf7a4('0x41')]){_0x40b85e[_0xf7a4('0x42')]=[{'all':!![]}];}_0x40b85e=_[_0xf7a4('0x3e')]({},_0x40b85e,_0x5afcb9[_0xf7a4('0x40')]);return db[_0xf7a4('0x2b')][_0xf7a4('0x47')](_0x40b85e)[_0xf7a4('0x25')](handleEntityNotFound(_0x3219e3,null))[_0xf7a4('0x25')](respondWithResult(_0x3219e3,null))[_0xf7a4('0x44')](handleError(_0x3219e3,null));};exports['clone']=function(_0x5c82c0,_0x5eef6e){var _0x3bc935={'where':{'id':_0x5c82c0['params']['id']}},_0x540376={};_0x540376[_0xf7a4('0x30')]=_[_0xf7a4('0x32')](db[_0xf7a4('0x2b')][_0xf7a4('0x2c')]);_0x3bc935['attributes']=_[_0xf7a4('0x34')](_0x540376[_0xf7a4('0x30')],qs[_0xf7a4('0x36')](_0x5c82c0[_0xf7a4('0x31')][_0xf7a4('0x36')]));_0x3bc935[_0xf7a4('0x35')]=_0x3bc935['attributes'][_0xf7a4('0x37')]?_0x3bc935[_0xf7a4('0x35')]:_0x540376[_0xf7a4('0x30')];if(_0x5c82c0[_0xf7a4('0x31')][_0xf7a4('0x41')]){_0x3bc935[_0xf7a4('0x42')]=[{'all':!![]}];}_0x3bc935=_['merge']({},_0x3bc935,_0x5c82c0[_0xf7a4('0x40')]);return db[_0xf7a4('0x2b')][_0xf7a4('0x47')](_0x3bc935)['then'](handleEntityNotFound(_0x5eef6e,null))[_0xf7a4('0x25')](function(_0x2c3af1){if(_0x2c3af1){var _0x1f94a4=_0x2c3af1[_0xf7a4('0x48')]({'plain':!![]});_0x1f94a4=qs[_0xf7a4('0x49')](_0x1f94a4,['id',_0xf7a4('0x4a'),_0xf7a4('0x4b')]);_0x5c82c0[_0xf7a4('0x4c')]=_[_0xf7a4('0x49')](_0x5c82c0[_0xf7a4('0x4c')],['id','createdAt',_0xf7a4('0x4b')]);return db[_0xf7a4('0x2b')]['create'](_[_0xf7a4('0x3e')](_0x1f94a4,_0x5c82c0[_0xf7a4('0x4c')]),{'include':_0x5c82c0[_0xf7a4('0x31')][_0xf7a4('0x41')]?[{'all':!![]}]:undefined});}})[_0xf7a4('0x25')](respondWithResult(_0x5eef6e,0xc9))[_0xf7a4('0x44')](handleError(_0x5eef6e,null));};exports[_0xf7a4('0x24')]=function(_0x4fe8ad,_0x13f27c){if(_0x4fe8ad[_0xf7a4('0x4c')]['id']){delete _0x4fe8ad[_0xf7a4('0x4c')]['id'];}return db[_0xf7a4('0x2b')][_0xf7a4('0x47')]({'where':{'id':_0x4fe8ad[_0xf7a4('0x46')]['id']}})[_0xf7a4('0x25')](handleEntityNotFound(_0x13f27c,null))[_0xf7a4('0x25')](saveUpdates(_0x4fe8ad[_0xf7a4('0x4c')],null))[_0xf7a4('0x25')](respondWithResult(_0x13f27c,null))[_0xf7a4('0x44')](handleError(_0x13f27c,null));};exports[_0xf7a4('0x26')]=function(_0x3e8c8c,_0x5ec727){return db[_0xf7a4('0x2b')][_0xf7a4('0x47')]({'where':{'id':_0x3e8c8c[_0xf7a4('0x46')]['id']}})[_0xf7a4('0x25')](handleEntityNotFound(_0x5ec727,null))[_0xf7a4('0x25')](removeEntity(_0x5ec727,null))[_0xf7a4('0x44')](handleError(_0x5ec727,null));};exports[_0xf7a4('0x4d')]=function(_0x2d7ff8,_0x5d2bac,_0x571f21){_0x2d7ff8[_0xf7a4('0x4c')][_0xf7a4('0x28')]=_0x2d7ff8['file'][_0xf7a4('0x4e')];_0x2d7ff8[_0xf7a4('0x4c')]['basename']=_0x2d7ff8['file'][_0xf7a4('0x4f')];_0x2d7ff8[_0xf7a4('0x4c')][_0xf7a4('0x2e')]=_0x2d7ff8[_0xf7a4('0x50')][_0xf7a4('0x51')];return db[_0xf7a4('0x2b')][_0xf7a4('0x4d')](_0x2d7ff8[_0xf7a4('0x4c')])['then'](respondWithResult(_0x5d2bac,0xc9))[_0xf7a4('0x44')](handleError(_0x5d2bac,null));};exports['download']=function(_0x359612,_0x1626b4,_0x2d8616){return db[_0xf7a4('0x2b')]['findOne']({'where':{'id':_0x359612[_0xf7a4('0x46')]['id']},'raw':!![]})[_0xf7a4('0x25')](handleEntityNotFound(_0x1626b4,null))[_0xf7a4('0x25')](function(_0x53d4a9){if(_0x53d4a9){var _0x43c3c7=_0x53d4a9[_0xf7a4('0x52')]!==null;var _0x2fbf07=path[_0xf7a4('0x53')](config[_0xf7a4('0x54')],'server/files/attachments/');if(_0x43c3c7){_0x2fbf07=path[_0xf7a4('0x53')](_0x2fbf07,_0xf7a4('0x55'));}var _0x1e4967=path['join'](_0x2fbf07,_0x53d4a9[_0xf7a4('0x56')]);return _0x1626b4[_0xf7a4('0x57')](_0x1e4967);}})['catch'](handleError(_0x1626b4,null));}; \ No newline at end of file +var _0xa92c=['mimetype','download','join','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','ejs','fs-extra','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','json','offset','count','set','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','index','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','Attachment','include','findAll','then','catch','show','rawAttributes','keys','find','clone','params','omit','body','createdAt','updatedAt','create','includeAll','file','originalname','basename','filename'];(function(_0x276683,_0x3bc50){var _0x4edd55=function(_0x7082b4){while(--_0x7082b4){_0x276683['push'](_0x276683['shift']());}};_0x4edd55(++_0x3bc50);}(_0xa92c,0x1b2));var _0xca92=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xa92c[_0x2261ce];return _0x524640;};'use strict';var emlformat=require(_0xca92('0x0'));var rimraf=require(_0xca92('0x1'));var zipdir=require(_0xca92('0x2'));var jsonpatch=require(_0xca92('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xca92('0x4'));var Mustache=require(_0xca92('0x5'));var util=require('util');var path=require(_0xca92('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xca92('0x7'));var fs=require('fs');var fs_extra=require(_0xca92('0x8'));var _=require(_0xca92('0x9'));var squel=require('squel');var crypto=require(_0xca92('0xa'));var jsforce=require(_0xca92('0xb'));var deskjs=require(_0xca92('0xc'));var toCsv=require(_0xca92('0xd'));var querystring=require(_0xca92('0xe'));var Papa=require(_0xca92('0xf'));var Redis=require(_0xca92('0x10'));var authService=require(_0xca92('0x11'));var qs=require(_0xca92('0x12'));var as=require(_0xca92('0x13'));var hardwareService=require(_0xca92('0x14'));var logger=require(_0xca92('0x15'))(_0xca92('0x16'));var utils=require('../../config/utils');var config=require(_0xca92('0x17'));var licenseUtil=require(_0xca92('0x18'));var db=require(_0xca92('0x19'))['db'];function respondWithStatusCode(_0x346f60,_0x547127){_0x547127=_0x547127||0xcc;return function(_0x873b8c){if(_0x873b8c){return _0x346f60['sendStatus'](_0x547127);}return _0x346f60['status'](_0x547127)['end']();};}function respondWithResult(_0x53b8e4,_0x424e45){_0x424e45=_0x424e45||0xc8;return function(_0x2aa01e){if(_0x2aa01e){return _0x53b8e4[_0xca92('0x1a')](_0x424e45)[_0xca92('0x1b')](_0x2aa01e);}};}function respondWithFilteredResult(_0x41f253,_0x1c3bac){return function(_0xf95084){if(_0xf95084){var _0x1a28f4=typeof _0x1c3bac[_0xca92('0x1c')]==='undefined'&&typeof _0x1c3bac['limit']==='undefined';var _0x100948=_0xf95084[_0xca92('0x1d')];var _0x434525=_0x1a28f4?0x0:_0x1c3bac['offset'];var _0x143c4c=_0x1a28f4?_0xf95084[_0xca92('0x1d')]:_0x1c3bac[_0xca92('0x1c')]+_0x1c3bac['limit'];var _0x103193;if(_0x143c4c>=_0x100948){_0x143c4c=_0x100948;_0x103193=0xc8;}else{_0x103193=0xce;}_0x41f253[_0xca92('0x1a')](_0x103193);return _0x41f253[_0xca92('0x1e')]('Content-Range',_0x434525+'-'+_0x143c4c+'/'+_0x100948)[_0xca92('0x1b')](_0xf95084);}return null;};}function patchUpdates(_0x4ceddc){return function(_0x216eb0){try{jsonpatch[_0xca92('0x1f')](_0x216eb0,_0x4ceddc,!![]);}catch(_0x5437cc){return BPromise[_0xca92('0x20')](_0x5437cc);}return _0x216eb0[_0xca92('0x21')]();};}function saveUpdates(_0x1d96e0,_0xf271f5){return function(_0x1f3380){if(_0x1f3380){return _0x1f3380[_0xca92('0x22')](_0x1d96e0)['then'](function(_0xc7d2e){return _0xc7d2e;});}return null;};}function removeEntity(_0x209046,_0x1e68ff){return function(_0x1bc0b0){if(_0x1bc0b0){return _0x1bc0b0[_0xca92('0x23')]()['then'](function(){_0x209046[_0xca92('0x1a')](0xcc)[_0xca92('0x24')]();});}};}function handleEntityNotFound(_0xf774f6,_0xaf0cc9){return function(_0x50affd){if(!_0x50affd){_0xf774f6[_0xca92('0x25')](0x194);}return _0x50affd;};}function handleError(_0x6eade6,_0x2162ff){_0x2162ff=_0x2162ff||0x1f4;return function(_0xa81e14){logger[_0xca92('0x26')](_0xa81e14[_0xca92('0x27')]);if(_0xa81e14[_0xca92('0x28')]){delete _0xa81e14['name'];}_0x6eade6[_0xca92('0x1a')](_0x2162ff)['send'](_0xa81e14);};}exports[_0xca92('0x29')]=function(_0x468288,_0x496e48){var _0x3877c6={},_0x2cad7a={},_0x1b31c1={'count':0x0,'rows':[]};var _0x12fdb5=_['map'](db['Attachment']['rawAttributes'],function(_0x369f92){return{'name':_0x369f92[_0xca92('0x2a')],'type':_0x369f92[_0xca92('0x2b')]['key']};});_0x2cad7a[_0xca92('0x2c')]=_[_0xca92('0x2d')](_0x12fdb5,_0xca92('0x28'));_0x2cad7a[_0xca92('0x2e')]=_['keys'](_0x468288['query']);_0x2cad7a[_0xca92('0x2f')]=_[_0xca92('0x30')](_0x2cad7a[_0xca92('0x2c')],_0x2cad7a['query']);_0x3877c6['attributes']=_[_0xca92('0x30')](_0x2cad7a[_0xca92('0x2c')],qs[_0xca92('0x31')](_0x468288[_0xca92('0x2e')][_0xca92('0x31')]));_0x3877c6['attributes']=_0x3877c6[_0xca92('0x32')][_0xca92('0x33')]?_0x3877c6[_0xca92('0x32')]:_0x2cad7a[_0xca92('0x2c')];if(!_0x468288[_0xca92('0x2e')]['hasOwnProperty'](_0xca92('0x34'))){_0x3877c6['limit']=qs['limit'](_0x468288[_0xca92('0x2e')][_0xca92('0x35')]);_0x3877c6[_0xca92('0x1c')]=qs[_0xca92('0x1c')](_0x468288[_0xca92('0x2e')][_0xca92('0x1c')]);}_0x3877c6[_0xca92('0x36')]=qs[_0xca92('0x37')](_0x468288[_0xca92('0x2e')][_0xca92('0x37')]);_0x3877c6[_0xca92('0x38')]=qs[_0xca92('0x2f')](_['pick'](_0x468288['query'],_0x2cad7a[_0xca92('0x2f')]),_0x12fdb5);if(_0x468288[_0xca92('0x2e')][_0xca92('0x39')]){_0x3877c6[_0xca92('0x38')]=_[_0xca92('0x3a')](_0x3877c6[_0xca92('0x38')],{'$or':_['map'](_0x12fdb5,function(_0x38f6fd){if(_0x38f6fd[_0xca92('0x2b')]!==_0xca92('0x3b')){var _0x27322b={};_0x27322b[_0x38f6fd[_0xca92('0x28')]]={'$like':'%'+_0x468288['query']['filter']+'%'};return _0x27322b;}})});}_0x3877c6=_['merge']({},_0x3877c6,_0x468288[_0xca92('0x3c')]);var _0x8b0cd4={'where':_0x3877c6['where']};return db[_0xca92('0x3d')]['count'](_0x8b0cd4)['then'](function(_0x1468a0){_0x1b31c1['count']=_0x1468a0;if(_0x468288[_0xca92('0x2e')]['includeAll']){_0x3877c6[_0xca92('0x3e')]=[{'all':!![]}];}return db[_0xca92('0x3d')][_0xca92('0x3f')](_0x3877c6);})['then'](function(_0xe186e7){_0x1b31c1['rows']=_0xe186e7;return _0x1b31c1;})[_0xca92('0x40')](respondWithFilteredResult(_0x496e48,_0x3877c6))[_0xca92('0x41')](handleError(_0x496e48,null));};exports[_0xca92('0x42')]=function(_0x5db5e5,_0x350f20){var _0x197f22={'raw':!![],'where':{'id':_0x5db5e5['params']['id']}},_0x2fc807={};_0x2fc807[_0xca92('0x2c')]=_['keys'](db['Attachment'][_0xca92('0x43')]);_0x2fc807['query']=_[_0xca92('0x44')](_0x5db5e5[_0xca92('0x2e')]);_0x2fc807[_0xca92('0x2f')]=_[_0xca92('0x30')](_0x2fc807[_0xca92('0x2c')],_0x2fc807[_0xca92('0x2e')]);_0x197f22[_0xca92('0x32')]=_[_0xca92('0x30')](_0x2fc807['model'],qs[_0xca92('0x31')](_0x5db5e5[_0xca92('0x2e')][_0xca92('0x31')]));_0x197f22[_0xca92('0x32')]=_0x197f22[_0xca92('0x32')][_0xca92('0x33')]?_0x197f22[_0xca92('0x32')]:_0x2fc807[_0xca92('0x2c')];if(_0x5db5e5[_0xca92('0x2e')]['includeAll']){_0x197f22[_0xca92('0x3e')]=[{'all':!![]}];}_0x197f22=_['merge']({},_0x197f22,_0x5db5e5[_0xca92('0x3c')]);return db[_0xca92('0x3d')][_0xca92('0x45')](_0x197f22)[_0xca92('0x40')](handleEntityNotFound(_0x350f20,null))[_0xca92('0x40')](respondWithResult(_0x350f20,null))[_0xca92('0x41')](handleError(_0x350f20,null));};exports[_0xca92('0x46')]=function(_0x4c20ab,_0x317e1e){var _0x45faf3={'where':{'id':_0x4c20ab[_0xca92('0x47')]['id']}},_0x42852f={};_0x42852f['model']=_['keys'](db[_0xca92('0x3d')]['rawAttributes']);_0x45faf3['attributes']=_[_0xca92('0x30')](_0x42852f['model'],qs[_0xca92('0x31')](_0x4c20ab[_0xca92('0x2e')][_0xca92('0x31')]));_0x45faf3[_0xca92('0x32')]=_0x45faf3[_0xca92('0x32')][_0xca92('0x33')]?_0x45faf3[_0xca92('0x32')]:_0x42852f[_0xca92('0x2c')];if(_0x4c20ab['query']['includeAll']){_0x45faf3[_0xca92('0x3e')]=[{'all':!![]}];}_0x45faf3=_['merge']({},_0x45faf3,_0x4c20ab[_0xca92('0x3c')]);return db[_0xca92('0x3d')][_0xca92('0x45')](_0x45faf3)[_0xca92('0x40')](handleEntityNotFound(_0x317e1e,null))[_0xca92('0x40')](function(_0x2c1cb0){if(_0x2c1cb0){var _0x36ab1b=_0x2c1cb0['get']({'plain':!![]});_0x36ab1b=qs['omit'](_0x36ab1b,['id','createdAt','updatedAt']);_0x4c20ab['body']=_[_0xca92('0x48')](_0x4c20ab[_0xca92('0x49')],['id',_0xca92('0x4a'),_0xca92('0x4b')]);return db['Attachment'][_0xca92('0x4c')](_[_0xca92('0x3a')](_0x36ab1b,_0x4c20ab[_0xca92('0x49')]),{'include':_0x4c20ab['query'][_0xca92('0x4d')]?[{'all':!![]}]:undefined});}})[_0xca92('0x40')](respondWithResult(_0x317e1e,0xc9))[_0xca92('0x41')](handleError(_0x317e1e,null));};exports[_0xca92('0x22')]=function(_0x204866,_0x55cea9){if(_0x204866[_0xca92('0x49')]['id']){delete _0x204866[_0xca92('0x49')]['id'];}return db['Attachment']['find']({'where':{'id':_0x204866['params']['id']}})['then'](handleEntityNotFound(_0x55cea9,null))[_0xca92('0x40')](saveUpdates(_0x204866[_0xca92('0x49')],null))['then'](respondWithResult(_0x55cea9,null))[_0xca92('0x41')](handleError(_0x55cea9,null));};exports['destroy']=function(_0x206dfe,_0x52f846){return db[_0xca92('0x3d')][_0xca92('0x45')]({'where':{'id':_0x206dfe[_0xca92('0x47')]['id']}})[_0xca92('0x40')](handleEntityNotFound(_0x52f846,null))[_0xca92('0x40')](removeEntity(_0x52f846,null))[_0xca92('0x41')](handleError(_0x52f846,null));};exports['create']=function(_0x48dd38,_0x153ba7,_0x52b695){_0x48dd38[_0xca92('0x49')][_0xca92('0x28')]=_0x48dd38[_0xca92('0x4e')][_0xca92('0x4f')];_0x48dd38['body'][_0xca92('0x50')]=_0x48dd38[_0xca92('0x4e')][_0xca92('0x51')];_0x48dd38[_0xca92('0x49')][_0xca92('0x2b')]=_0x48dd38[_0xca92('0x4e')][_0xca92('0x52')];return db[_0xca92('0x3d')][_0xca92('0x4c')](_0x48dd38[_0xca92('0x49')])[_0xca92('0x40')](respondWithResult(_0x153ba7,0xc9))[_0xca92('0x41')](handleError(_0x153ba7,null));};exports[_0xca92('0x53')]=function(_0x482161,_0x2f447d,_0x7da97f){return db['Attachment']['findOne']({'where':{'id':_0x482161['params']['id']},'raw':!![]})[_0xca92('0x40')](handleEntityNotFound(_0x2f447d,null))['then'](function(_0xcf009e){if(_0xcf009e){var _0x4daaee=_0xcf009e['ChatOfflineMessageId']!==null;var _0x351d6f=path[_0xca92('0x54')](config['root'],_0xca92('0x55'));if(_0x4daaee){_0x351d6f=path[_0xca92('0x54')](_0x351d6f,'offline-chat/');}var _0x460016=path[_0xca92('0x54')](_0x351d6f,_0xcf009e[_0xca92('0x50')]);return _0x2f447d[_0xca92('0x53')](_0x460016);}})[_0xca92('0x41')](handleError(_0x2f447d,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index e17fdd8..1080fea 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 _0xbfc1=['define','Attachment','attachments','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports'];(function(_0x517d90,_0x52909b){var _0x52f7a3=function(_0x4ef9c7){while(--_0x4ef9c7){_0x517d90['push'](_0x517d90['shift']());}};_0x52f7a3(++_0x52909b);}(_0xbfc1,0x199));var _0x1bfc=function(_0x4c5dd2,_0x257029){_0x4c5dd2=_0x4c5dd2-0x0;var _0x1710c9=_0xbfc1[_0x4c5dd2];return _0x1710c9;};'use strict';var _=require(_0x1bfc('0x0'));var util=require('util');var logger=require(_0x1bfc('0x1'))(_0x1bfc('0x2'));var moment=require(_0x1bfc('0x3'));var BPromise=require(_0x1bfc('0x4'));var rp=require(_0x1bfc('0x5'));var fs=require('fs');var path=require(_0x1bfc('0x6'));var rimraf=require(_0x1bfc('0x7'));var config=require(_0x1bfc('0x8'));var attributes=require(_0x1bfc('0x9'));module[_0x1bfc('0xa')]=function(_0x1dbb4d,_0x19ac78){return _0x1dbb4d[_0x1bfc('0xb')](_0x1bfc('0xc'),attributes,{'tableName':_0x1bfc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d36=['./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x3e9c53,_0x401eb2){var _0x2ffa2f=function(_0xae5b99){while(--_0xae5b99){_0x3e9c53['push'](_0x3e9c53['shift']());}};_0x2ffa2f(++_0x401eb2);}(_0x6d36,0xf7));var _0x66d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6d36[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x66d3('0x0'));var util=require(_0x66d3('0x1'));var logger=require(_0x66d3('0x2'))(_0x66d3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x66d3('0x4'));var fs=require('fs');var path=require(_0x66d3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x66d3('0x6'));module[_0x66d3('0x7')]=function(_0x1736a7,_0x53f7e6){return _0x1736a7[_0x66d3('0x8')](_0x66d3('0x9'),attributes,{'tableName':_0x66d3('0xa'),'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 2fa0178..8091026 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 _0x3140=['CreateAttachment','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','catch','Attachment','create','options','raw','then'];(function(_0x323879,_0x32a9f6){var _0x5886b4=function(_0x21ae9d){while(--_0x21ae9d){_0x323879['push'](_0x323879['shift']());}};_0x5886b4(++_0x32a9f6);}(_0x3140,0xaf));var _0x0314=function(_0x625492,_0x1cd944){_0x625492=_0x625492-0x0;var _0x296b94=_0x3140[_0x625492];return _0x296b94;};'use strict';var _=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var moment=require(_0x0314('0x2'));var BPromise=require(_0x0314('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0314('0x4'))['db'];var utils=require(_0x0314('0x5'));var logger=require(_0x0314('0x6'))(_0x0314('0x7'));var config=require(_0x0314('0x8'));var jayson=require(_0x0314('0x9'));var client=jayson[_0x0314('0xa')][_0x0314('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11ee94,_0x44762d,_0x176944){return new BPromise(function(_0x495b27,_0x26031f){return client[_0x0314('0xc')](_0x11ee94,_0x176944)['then'](function(_0x5e9bca){logger[_0x0314('0xd')]('Attachment,\x20%s,\x20%s',_0x44762d,_0x0314('0xe'));logger[_0x0314('0xf')](_0x0314('0x10'),_0x44762d,_0x0314('0xe'),JSON[_0x0314('0x11')](_0x5e9bca));if(_0x5e9bca[_0x0314('0x12')]){if(_0x5e9bca['error'][_0x0314('0x13')]===0x1f4){logger[_0x0314('0x12')](_0x0314('0x14'),_0x44762d,_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);return _0x26031f(_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);}logger['error'](_0x0314('0x14'),_0x44762d,_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);return _0x495b27(_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);}else{logger[_0x0314('0xd')](_0x0314('0x14'),_0x44762d,_0x0314('0xe'));_0x495b27(_0x5e9bca['result'][_0x0314('0x15')]);}})[_0x0314('0x16')](function(_0x1f23c6){logger['error'](_0x0314('0x14'),_0x44762d,_0x1f23c6);_0x26031f(_0x1f23c6);});});}exports['CreateAttachment']=function(_0x575b68){var _0x39db0b=this;return new Promise(function(_0x329679,_0x583d39){return db[_0x0314('0x17')][_0x0314('0x18')](_0x575b68['body'],{'raw':_0x575b68[_0x0314('0x19')]?_0x575b68['options'][_0x0314('0x1a')]===undefined?!![]:![]:!![]})[_0x0314('0x1b')](function(_0x16d273){logger[_0x0314('0xd')](_0x0314('0x1c'),_0x575b68);logger[_0x0314('0xf')]('CreateAttachment',_0x575b68,JSON['stringify'](_0x16d273));_0x329679(_0x16d273);})[_0x0314('0x16')](function(_0xbd3ad0){logger[_0x0314('0x12')](_0x0314('0x1c'),_0xbd3ad0[_0x0314('0x15')],_0x575b68);_0x583d39(_0x39db0b[_0x0314('0x12')](0x1f4,_0xbd3ad0['message']));});});}; \ No newline at end of file +var _0xdace=['message','info','CreateAttachment','Attachment','create','options','raw','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','Attachment,\x20%s,\x20%s'];(function(_0x156a96,_0xb28bc){var _0x297671=function(_0x302a41){while(--_0x302a41){_0x156a96['push'](_0x156a96['shift']());}};_0x297671(++_0xb28bc);}(_0xdace,0xc5));var _0xedac=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0xdace[_0x7d62cb];return _0x3a6266;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('Attachment,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});}exports[_0xedac('0x15')]=function(_0x4fb540){var _0x4b2563=this;return new Promise(function(_0x2d02d7,_0x2adefa){return db[_0xedac('0x16')][_0xedac('0x17')](_0x4fb540['body'],{'raw':_0x4fb540['options']?_0x4fb540[_0xedac('0x18')][_0xedac('0x19')]===undefined?!![]:![]:!![]})[_0xedac('0xc')](function(_0xcc1605){logger[_0xedac('0x14')](_0xedac('0x15'),_0x4fb540);logger[_0xedac('0xe')](_0xedac('0x15'),_0x4fb540,JSON['stringify'](_0xcc1605));_0x2d02d7(_0xcc1605);})[_0xedac('0x1a')](function(_0x510005){logger[_0xedac('0x10')](_0xedac('0x15'),_0x510005['message'],_0x4fb540);_0x2adefa(_0x4b2563[_0xedac('0x10')](0x1f4,_0x510005[_0xedac('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 8d5ffc6..cf47319 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 _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x2e4e4a,_0x12a58f){var _0x3a28fb=function(_0x4d34f3){while(--_0x4d34f3){_0x2e4e4a['push'](_0x2e4e4a['shift']());}};_0x3a28fb(++_0x12a58f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5af1c8,_0x1b88ee){_0x5af1c8=_0x5af1c8-0x0;var _0x3bca4a=_0x5f2f[_0x5af1c8];return _0x3bca4a;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'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/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 5faf51e..a009d7b 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf628=['activedirectory','baseDN','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','disabled','blockedAt','online','admin','user','agent','then','blockDuration','blocked','minutes','getLicense','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','use','User','passport','passport-local','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api'];(function(_0x16a80e,_0x52554a){var _0x1db251=function(_0x71b1cb){while(--_0x71b1cb){_0x16a80e['push'](_0x16a80e['shift']());}};_0x1db251(++_0x52554a);}(_0xf628,0xcd));var _0x8f62=function(_0x1ee5ed,_0x49e4e8){_0x1ee5ed=_0x1ee5ed-0x0;var _0x5e2a9b=_0xf628[_0x1ee5ed];return _0x5e2a9b;};'use strict';var passport=require(_0x8f62('0x0'));var LocalStrategy=require(_0x8f62('0x1'))['Strategy'];var moment=require(_0x8f62('0x2'));var ActiveDirectory=require(_0x8f62('0x3'));var BPromise=require(_0x8f62('0x4'));var util=require('util');var db=require(_0x8f62('0x5'))['db'];var authService=require(_0x8f62('0x6'));var utils=require(_0x8f62('0x7'));var config=require('../../config/environment');var logger=require(_0x8f62('0x8'))(_0x8f62('0x9'));function isActiveDirectoryConfigured(_0x4124de){var _0xb9470a=![];if(typeof _0x4124de[_0x8f62('0xa')]!=='undefined'){_0xb9470a=_0x4124de[_0x8f62('0xa')][_0x8f62('0xb')]&&_0x4124de[_0x8f62('0xa')]['url']&&_0x4124de[_0x8f62('0xa')]['domain'];}return _0xb9470a;}function adAuthenticate(_0x45bd96,_0x2e7712,_0x4b165e){return new BPromise(function(_0x2cd469,_0x53afae){try{var _0xf798aa=new ActiveDirectory(_0x45bd96);_0xf798aa['authenticate'](_0x2e7712,_0x4b165e,function(_0x5dc1a2,_0x53c7db){if(_0x5dc1a2){logger[_0x8f62('0xc')]('Error\x20authenticate\x20%s:\x20%s',_0x2e7712,util['inspect'](_0x5dc1a2,{'showHidden':![],'depth':null}));_0x53afae(_0x8f62('0xd'));}else if(!_0x53c7db){logger[_0x8f62('0xc')](_0x8f62('0xe'),_0x2e7712);_0x53afae(_0x8f62('0xd'));}else{_0x2cd469(_0x53c7db);}});}catch(_0x1f9b99){_0x53afae(_0x1f9b99);}});}function ActiveDirectoryAuthenticate(_0x232949,_0x3d5510,_0x332488,_0x29f745){var _0x4c9281,_0x9d32c7;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x8f62('0xf'),_0x3d5510);return _0x29f745(null,![],{'message':_0x8f62('0xd')});}return db[_0x8f62('0x10')][_0x8f62('0x11')]({'where':{'id':0x1},'attributes':[_0x8f62('0x12'),'blockDuration'],'raw':!![]})['then'](function(_0x21147b){_0x4c9281=_0x21147b;if(!_0x4c9281['adSsoEnabled']){logger[_0x8f62('0xc')](_0x8f62('0x13'),_0x3d5510);throw new Error(_0x8f62('0xd'));}return _0x232949[_0x8f62('0x11')]({'attributes':['id',_0x8f62('0x14'),_0x8f62('0x15'),'salt','role',_0x8f62('0x16'),'blocked',_0x8f62('0x17'),_0x8f62('0x18')],'where':{'name':_0x3d5510,'role':{'$or':[_0x8f62('0x19'),_0x8f62('0x1a'),_0x8f62('0x1b')]},'adSsoEnabled':!![]}});})[_0x8f62('0x1c')](function(_0x329d73){if(!_0x329d73||_0x329d73&&_0x329d73[_0x8f62('0x14')]!==_0x3d5510){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x9d32c7=_0x329d73;var _0x4a095b=_0x9d32c7[_0x8f62('0x14')]+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0x8f62('0xa')],_0x4a095b,_0x332488);})[_0x8f62('0x1c')](function(_0x359459){if(_0x9d32c7[_0x8f62('0x16')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x4c9281[_0x8f62('0x1d')]>0x0){if(_0x9d32c7[_0x8f62('0x1e')]){if(moment(_0x9d32c7[_0x8f62('0x17')])['add'](_0x4c9281['blockDuration'],_0x8f62('0x1f'))>moment()){throw new Error(_0x8f62('0xd'));}return utils['clearBlockUser'](_0x9d32c7,0x0,![],null)[_0x8f62('0x1c')](function(){return utils['getLicense'](_0x9d32c7);})[_0x8f62('0x1c')](function(){return _0x29f745(null,_0x9d32c7);});}else{return utils['getLicense'](_0x9d32c7)[_0x8f62('0x1c')](function(){return _0x29f745(null,_0x9d32c7);});}}else{return utils[_0x8f62('0x20')](_0x9d32c7)[_0x8f62('0x1c')](function(){return _0x29f745(null,_0x9d32c7);});}})['catch'](function(_0x1da6df){return _0x29f745(null,![],_0x1da6df);});}function handleError(_0x11c3b7,_0x3512e7,_0x2620f6){return _0x11c3b7[_0x8f62('0x21')](_0x3512e7||0x1f4)[_0x8f62('0x22')]({'message':_0x2620f6?_0x2620f6[_0x8f62('0x23')]||_0x2620f6:''});}exports['login']=function(_0x4ce034,_0x2cf64f,_0x9dd647){passport['authenticate'](_0x8f62('0x24'),function(_0x3249fb,_0x3f24eb,_0x10337c){var _0x51f3a=_0x3249fb||_0x10337c;if(_0x51f3a){return handleError(_0x2cf64f,0x191,_0x51f3a);}if(!_0x3f24eb){return handleError(_0x2cf64f,0x194,{'message':_0x8f62('0x25')});}else{var _0x415169={'payload':{'id':_0x3f24eb['id'],'role':_0x3f24eb[_0x8f62('0x26')]},'options':{'expiresIn':0x15180}};return authService[_0x8f62('0x27')](_0x415169)[_0x8f62('0x1c')](function(_0x22aa87){_0x2cf64f[_0x8f62('0x28')]({'id':_0x3f24eb['id'],'token':_0x22aa87,'statusCall':'','isAlreadyLogged':_0x3f24eb[_0x8f62('0x18')]});});}})(_0x4ce034,_0x2cf64f,_0x9dd647);};passport[_0x8f62('0x29')]('ad-login',new LocalStrategy({'usernameField':_0x8f62('0x14'),'passwordField':_0x8f62('0x15')},function(_0x3ba00a,_0x497044,_0x22174d){return ActiveDirectoryAuthenticate(db[_0x8f62('0x2a')],_0x3ba00a,_0x497044,_0x22174d);})); \ No newline at end of file +var _0x46e3=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','password','salt','disabled','blockedAt','online','admin','user','blocked','add','minutes','clearBlockUser','getLicense','catch','status','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','name','User','passport','passport-local','moment','activedirectory2','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x244086,_0x2d3b2d){var _0x57b8ae=function(_0x5f1409){while(--_0x5f1409){_0x244086['push'](_0x244086['shift']());}};_0x57b8ae(++_0x2d3b2d);}(_0x46e3,0x128));var _0x346e=function(_0x399fa9,_0x50bbd1){_0x399fa9=_0x399fa9-0x0;var _0x1a396e=_0x46e3[_0x399fa9];return _0x1a396e;};'use strict';var passport=require(_0x346e('0x0'));var LocalStrategy=require(_0x346e('0x1'))['Strategy'];var moment=require(_0x346e('0x2'));var ActiveDirectory=require(_0x346e('0x3'));var BPromise=require('bluebird');var util=require(_0x346e('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x346e('0x5'));var utils=require(_0x346e('0x6'));var config=require(_0x346e('0x7'));var logger=require(_0x346e('0x8'))('api');function isActiveDirectoryConfigured(_0x4c1a6c){var _0x4f32a0=![];if(typeof _0x4c1a6c[_0x346e('0x9')]!==_0x346e('0xa')){_0x4f32a0=_0x4c1a6c[_0x346e('0x9')][_0x346e('0xb')]&&_0x4c1a6c[_0x346e('0x9')][_0x346e('0xc')]&&_0x4c1a6c[_0x346e('0x9')][_0x346e('0xd')];}return _0x4f32a0;}function adAuthenticate(_0x3e5ec9,_0x3f5f2f,_0xb1fd3c){return new BPromise(function(_0xdb7380,_0x29f863){try{var _0x347c1c=new ActiveDirectory(_0x3e5ec9);_0x347c1c[_0x346e('0xe')](_0x3f5f2f,_0xb1fd3c,function(_0x56740a,_0x5968c6){if(_0x56740a){logger[_0x346e('0xf')](_0x346e('0x10'),_0x3f5f2f,util[_0x346e('0x11')](_0x56740a,{'showHidden':![],'depth':null}));_0x29f863(_0x346e('0x12'));}else if(!_0x5968c6){logger[_0x346e('0xf')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x3f5f2f);_0x29f863('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xdb7380(_0x5968c6);}});}catch(_0x3e3336){_0x29f863(_0x3e3336);}});}function ActiveDirectoryAuthenticate(_0x4f1566,_0x57abc6,_0x2cb8ba,_0xac2d44){var _0xf73052,_0x28258f;if(!isActiveDirectoryConfigured(config)){logger[_0x346e('0xf')](_0x346e('0x13'),_0x57abc6);return _0xac2d44(null,![],{'message':_0x346e('0x12')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x346e('0x14'),_0x346e('0x15')],'raw':!![]})[_0x346e('0x16')](function(_0x53cb12){_0xf73052=_0x53cb12;if(!_0xf73052['adSsoEnabled']){logger[_0x346e('0xf')](_0x346e('0x17'),_0x57abc6);throw new Error(_0x346e('0x12'));}return _0x4f1566[_0x346e('0x18')]({'attributes':['id','name',_0x346e('0x19'),_0x346e('0x1a'),'role',_0x346e('0x1b'),'blocked',_0x346e('0x1c'),_0x346e('0x1d')],'where':{'name':_0x57abc6,'role':{'$or':[_0x346e('0x1e'),_0x346e('0x1f'),'agent']},'adSsoEnabled':!![]}});})[_0x346e('0x16')](function(_0x3c5444){if(!_0x3c5444||_0x3c5444&&_0x3c5444['name']!==_0x57abc6){throw new Error(_0x346e('0x12'));}_0x28258f=_0x3c5444;var _0x3ed3aa=_0x28258f['name']+'@'+config[_0x346e('0x9')][_0x346e('0xd')];return adAuthenticate(config['activedirectory'],_0x3ed3aa,_0x2cb8ba);})[_0x346e('0x16')](function(_0x4483d4){if(_0x28258f[_0x346e('0x1b')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0xf73052[_0x346e('0x15')]>0x0){if(_0x28258f[_0x346e('0x20')]){if(moment(_0x28258f[_0x346e('0x1c')])[_0x346e('0x21')](_0xf73052['blockDuration'],_0x346e('0x22'))>moment()){throw new Error(_0x346e('0x12'));}return utils[_0x346e('0x23')](_0x28258f,0x0,![],null)['then'](function(){return utils[_0x346e('0x24')](_0x28258f);})[_0x346e('0x16')](function(){return _0xac2d44(null,_0x28258f);});}else{return utils[_0x346e('0x24')](_0x28258f)['then'](function(){return _0xac2d44(null,_0x28258f);});}}else{return utils[_0x346e('0x24')](_0x28258f)[_0x346e('0x16')](function(){return _0xac2d44(null,_0x28258f);});}})[_0x346e('0x25')](function(_0x486ae1){return _0xac2d44(null,![],_0x486ae1);});}function handleError(_0x5ee942,_0xcfe8a2,_0x127d0c){return _0x5ee942[_0x346e('0x26')](_0xcfe8a2||0x1f4)['send']({'message':_0x127d0c?_0x127d0c['message']||_0x127d0c:''});}exports[_0x346e('0x27')]=function(_0xa174ca,_0x5edbfe,_0x26adb8){passport[_0x346e('0xe')](_0x346e('0x28'),function(_0x215bf4,_0x575907,_0x3df5eb){var _0x3dfda8=_0x215bf4||_0x3df5eb;if(_0x3dfda8){return handleError(_0x5edbfe,0x191,_0x3dfda8);}if(!_0x575907){return handleError(_0x5edbfe,0x194,{'message':_0x346e('0x29')});}else{var _0x369c96={'payload':{'id':_0x575907['id'],'role':_0x575907['role']},'options':{'expiresIn':0x15180}};return authService[_0x346e('0x2a')](_0x369c96)[_0x346e('0x16')](function(_0x14c1a){_0x5edbfe['json']({'id':_0x575907['id'],'token':_0x14c1a,'statusCall':'','isAlreadyLogged':_0x575907[_0x346e('0x1d')]});});}})(_0xa174ca,_0x5edbfe,_0x26adb8);};passport['use'](_0x346e('0x28'),new LocalStrategy({'usernameField':_0x346e('0x2b'),'passwordField':_0x346e('0x19')},function(_0x34fef5,_0x1325a9,_0x58dbdd){return ActiveDirectoryAuthenticate(db[_0x346e('0x2c')],_0x34fef5,_0x1325a9,_0x58dbdd);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 5c0daed..1fa158d 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b01=['./authActiveDirectory.controller','express','Router'];(function(_0x21c9b6,_0x5af50f){var _0x2c9c5c=function(_0x487c95){while(--_0x487c95){_0x21c9b6['push'](_0x21c9b6['shift']());}};_0x2c9c5c(++_0x5af50f);}(_0x2b01,0xe5));var _0x12b0=function(_0x49546a,_0x195a3f){_0x49546a=_0x49546a-0x0;var _0xca8c10=_0x2b01[_0x49546a];return _0xca8c10;};'use strict';var express=require(_0x12b0('0x0'));var router=express[_0x12b0('0x1')]();var controller=require(_0x12b0('0x2'));router['post']('/',controller['login']);module['exports']=router; \ No newline at end of file +var _0x0f39=['exports','express','./authActiveDirectory.controller','post','login'];(function(_0x333a53,_0xe8f712){var _0x3c2bd3=function(_0x106e4f){while(--_0x106e4f){_0x333a53['push'](_0x333a53['shift']());}};_0x3c2bd3(++_0xe8f712);}(_0x0f39,0xdd));var _0x90f3=function(_0x400f47,_0x112481){_0x400f47=_0x400f47-0x0;var _0x3edac7=_0x0f39[_0x400f47];return _0x3edac7;};'use strict';var express=require(_0x90f3('0x0'));var router=express['Router']();var controller=require(_0x90f3('0x1'));router[_0x90f3('0x2')]('/',controller[_0x90f3('0x3')]);module[_0x90f3('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index c769a55..19ad1f5 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 _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x7a54,0x106));var _0x47a5=function(_0x455fdd,_0x37092b){_0x455fdd=_0x455fdd-0x0;var _0x2c232b=_0x7a54[_0x455fdd];return _0x2c232b;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0xcc4d00,_0x206c59){var _0x3bec1f=function(_0xf4dd00){while(--_0xf4dd00){_0xcc4d00['push'](_0xcc4d00['shift']());}};_0x3bec1f(++_0x206c59);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 42fc0ca..3289086 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 _0xc2e6=['exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','setTokenCookie'];(function(_0x41a31e,_0x3ef74b){var _0x3fccba=function(_0x1ecda3){while(--_0x1ecda3){_0x41a31e['push'](_0x41a31e['shift']());}};_0x3fccba(++_0x3ef74b);}(_0xc2e6,0xdd));var _0x6c2e=function(_0x4b2ecd,_0x3c9f85){_0x4b2ecd=_0x4b2ecd-0x0;var _0x4fcc19=_0xc2e6[_0x4b2ecd];return _0x4fcc19;};'use strict';var express=require(_0x6c2e('0x0'));var passport=require(_0x6c2e('0x1'));var router=express[_0x6c2e('0x2')]();var controller=require(_0x6c2e('0x3'));var userController=require(_0x6c2e('0x4'));var authService=require(_0x6c2e('0x5'));router['get']('/',controller[_0x6c2e('0x6')]);router[_0x6c2e('0x7')](_0x6c2e('0x8'),controller['callback'],authService['isMiddleware'],userController[_0x6c2e('0x6')],authService[_0x6c2e('0x9')]);module[_0x6c2e('0xa')]=router; \ No newline at end of file +var _0x7fc4=['/callback','isMiddleware','setTokenCookie','exports','passport','./authGoogle.controller','../../components/auth/service','login','get'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0x7fc4,0x1cf));var _0x47fc=function(_0xc0e946,_0x5ea564){_0xc0e946=_0xc0e946-0x0;var _0x39efa9=_0x7fc4[_0xc0e946];return _0x39efa9;};'use strict';var express=require('express');var passport=require(_0x47fc('0x0'));var router=express['Router']();var controller=require(_0x47fc('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0x47fc('0x2'));router['get']('/',controller[_0x47fc('0x3')]);router[_0x47fc('0x4')](_0x47fc('0x5'),controller['callback'],authService[_0x47fc('0x6')],userController[_0x47fc('0x3')],authService[_0x47fc('0x7')]);module[_0x47fc('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 64ef31e..6fb1c1f 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 _0x05bc=['client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','send','login','local-login','json','forgot','body','toLowerCase','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','status','Reset\x20Email\x20sent!','reset','User','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','resetPasswordToken','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils'];(function(_0x1415fd,_0x598f8f){var _0x363d59=function(_0x5ab12d){while(--_0x5ab12d){_0x1415fd['push'](_0x1415fd['shift']());}};_0x363d59(++_0x598f8f);}(_0x05bc,0x172));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc05b('0x0'));var passport=require(_0xc05b('0x1'));var LocalStrategy=require(_0xc05b('0x2'))[_0xc05b('0x3')];var jayson=require(_0xc05b('0x4'));var _=require(_0xc05b('0x5'));var rs=require(_0xc05b('0x6'));var moment=require('moment');var db=require(_0xc05b('0x7'))['db'];var authService=require(_0xc05b('0x8'));var utils=require(_0xc05b('0x9'));var client=jayson[_0xc05b('0xa')][_0xc05b('0xb')]({'port':0x232b});function localAuthenticate(_0xa28153,_0x343802,_0x22f891,_0x6d40fe){var _0x56a17b,_0x4ddd61;return db[_0xc05b('0xc')][_0xc05b('0xd')]({'where':{'id':0x1},'attributes':[_0xc05b('0xe'),_0xc05b('0xf')],'raw':!![]})[_0xc05b('0x10')](function(_0x15b7ae){_0x56a17b=_0x15b7ae;return _0xa28153['findOne']({'attributes':['id',_0xc05b('0x11'),_0xc05b('0x12'),_0xc05b('0x13'),_0xc05b('0x14'),_0xc05b('0x15'),_0xc05b('0x16'),_0xc05b('0x17'),'loginAttempts'],'where':{'name':_0x343802,'role':{'$or':[_0xc05b('0x18'),_0xc05b('0x19'),_0xc05b('0x1a')]}}});})[_0xc05b('0x10')](function(_0x43b656){if(!_0x43b656||_0x43b656&&_0x43b656[_0xc05b('0x11')]!==_0x343802){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x4ddd61=_0x43b656;return _0x4ddd61;}})[_0xc05b('0x10')](function(){_0x4ddd61[_0xc05b('0x1b')](_0x22f891,function(_0x2d6475,_0x5b3aab){var _0x173822=_0x4ddd61['loginAttempts']+0x1;if(_0x2d6475){return _0x6d40fe(_0x2d6475);}else if(!_0x5b3aab){if(_0x4ddd61[_0xc05b('0x15')]){return _0x6d40fe(null,![],{'message':_0xc05b('0x1c')});}else if(_0x56a17b[_0xc05b('0xe')]>0x0){if(_0x4ddd61[_0xc05b('0x16')]){if(_0x56a17b[_0xc05b('0xf')]>0x0){if(moment(_0x4ddd61['blockedAt'])[_0xc05b('0x1d')](_0x56a17b[_0xc05b('0xf')],_0xc05b('0x1e'))>moment()){return _0x6d40fe(null,![],{'message':_0xc05b('0x1c')});}else{return utils['clearBlockUser'](_0x4ddd61,_0x173822,![],null)[_0xc05b('0x10')](function(){return _0x6d40fe(null,![],{'message':_0xc05b('0x1c')});});}}else{return _0x6d40fe(null,![],{'message':_0xc05b('0x1c')});}}else{if(_0x173822>=_0x56a17b[_0xc05b('0xe')]){return utils[_0xc05b('0x1f')](_0x4ddd61,0x0,!![],moment())[_0xc05b('0x10')](function(){return _0x6d40fe(null,![],{'message':_0xc05b('0x1c')});});}else{return utils[_0xc05b('0x1f')](_0x4ddd61,_0x173822,![],null)[_0xc05b('0x10')](function(){return _0x6d40fe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x6d40fe(null,![],{'message':_0xc05b('0x1c')});}}else{if(_0x4ddd61[_0xc05b('0x15')]){return _0x6d40fe(null,![],{'message':_0xc05b('0x1c')});}else if(_0x56a17b['allowedLoginAttempts']>0x0){if(_0x4ddd61[_0xc05b('0x16')]){if(_0x56a17b['blockDuration']>0x0){if(moment(_0x4ddd61[_0xc05b('0x17')])[_0xc05b('0x1d')](_0x56a17b[_0xc05b('0xf')],_0xc05b('0x1e'))>moment()){return _0x6d40fe(null,![],{'message':_0xc05b('0x1c')});}else{return utils[_0xc05b('0x1f')](_0x4ddd61,0x0,![],null)[_0xc05b('0x10')](function(){return utils[_0xc05b('0x20')](_0x4ddd61);})[_0xc05b('0x10')](function(){return _0x6d40fe(null,_0x4ddd61);});}}else{return _0x6d40fe(null,![],{'message':_0xc05b('0x1c')});}}else{return utils['clearBlockUser'](_0x4ddd61,0x0,![],null)[_0xc05b('0x10')](function(){return utils[_0xc05b('0x20')](_0x4ddd61);})[_0xc05b('0x10')](function(){return _0x6d40fe(null,_0x4ddd61);})[_0xc05b('0x21')](function(_0x4d3577){return _0x6d40fe(null,![],_0x4d3577);});}}else{if(_0x4ddd61[_0xc05b('0x16')]){return _0x6d40fe(null,![],{'message':_0xc05b('0x1c')});}else{return utils[_0xc05b('0x20')](_0x4ddd61)[_0xc05b('0x10')](function(){return _0x6d40fe(null,_0x4ddd61);});}}}});})['catch'](function(_0x4d1823){return _0x6d40fe(null,![],_0x4d1823);});}function sendServiceMail(_0x1d7753){return db['MailAccount'][_0xc05b('0x22')]({'where':{'service':!![]},'attributes':['id',_0xc05b('0x11'),_0xc05b('0x23')],'include':[{'model':db[_0xc05b('0x24')],'as':_0xc05b('0x25'),'include':[{'model':db[_0xc05b('0x26')],'as':_0xc05b('0x26')}]}]})['then'](function(_0x1c0cb5){if(!_0x1c0cb5){throw new Error(_0xc05b('0x27'));}var _0x1e81bc=_0x1c0cb5[_0xc05b('0x28')]();var _0x3c4420={'account':_0x1e81bc,'message':_[_0xc05b('0x29')]({'from':util[_0xc05b('0x2a')](_0xc05b('0x2b'),_0x1c0cb5['name'],_0x1c0cb5['email']||_0x1c0cb5[_0xc05b('0x25')][_0xc05b('0x19')])},_0x1d7753)};return client[_0xc05b('0x2c')](_0xc05b('0x2d'),_0x3c4420);})[_0xc05b('0x10')](function(_0xd23734){if(_0xd23734['error']){throw new Error(util[_0xc05b('0x2a')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0xd23734[_0xc05b('0x2e')][_0xc05b('0x2f')]||JSON[_0xc05b('0x30')](_0xd23734[_0xc05b('0x2e')])));}return!![];});}function handleError(_0x4bf1ee,_0x1b9d97,_0x253d3a){return _0x4bf1ee['status'](_0x1b9d97||0x1f4)[_0xc05b('0x31')]({'message':_0x253d3a?_0x253d3a[_0xc05b('0x2f')]||_0x253d3a:''});}exports[_0xc05b('0x32')]=function(_0x1f7246,_0x45af46,_0x2d7ccb){passport[_0xc05b('0x1b')](_0xc05b('0x33'),function(_0x2a9268,_0x24691a,_0x2bd800){var _0x88d35c=_0x2a9268||_0x2bd800;if(_0x88d35c){return handleError(_0x45af46,0x191,_0x88d35c);}if(!_0x24691a){return handleError(_0x45af46,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0xca30e5={'payload':{'id':_0x24691a['id'],'role':_0x24691a[_0xc05b('0x14')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0xca30e5)[_0xc05b('0x10')](function(_0x30a81c){_0x45af46[_0xc05b('0x34')]({'id':_0x24691a['id'],'token':_0x30a81c,'statusCall':'','isAlreadyLogged':_0x24691a['online']});});}})(_0x1f7246,_0x45af46,_0x2d7ccb);};exports[_0xc05b('0x35')]=function(_0x4885b5,_0x41c54e){if(!_0x4885b5['body'][_0xc05b('0x23')]){return handleError(_0x41c54e,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x21f562=rs['generate']();_0x4885b5[_0xc05b('0x36')][_0xc05b('0x23')]=_0x4885b5[_0xc05b('0x36')][_0xc05b('0x23')]['trim']()[_0xc05b('0x37')]();var _0x49b681;return db[_0xc05b('0xc')][_0xc05b('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc05b('0xf')],'raw':!![]})[_0xc05b('0x10')](function(_0x4dc554){_0x49b681=_0x4dc554;return db['User'][_0xc05b('0x22')]({'where':{'email':_0x4885b5[_0xc05b('0x36')][_0xc05b('0x23')]}});})['then'](function(_0x304013){if(!_0x304013){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x304013[_0xc05b('0x15')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x304013[_0xc05b('0x16')]){if(moment(_0x304013[_0xc05b('0x17')])['add'](_0x49b681['blockDuration'],_0xc05b('0x1e'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x304013[_0xc05b('0x16')]=![];_0x304013[_0xc05b('0x17')]=null;}}_0x304013['resetPasswordToken']=_0x21f562;_0x304013[_0xc05b('0x38')]=Date[_0xc05b('0x39')]()+0x36ee80;return _0x304013[_0xc05b('0x3a')]();})[_0xc05b('0x10')](function(){return sendServiceMail({'to':_0x4885b5['body']['email'],'subject':_0xc05b('0x3b'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xc05b('0x3c')+_0xc05b('0x3d')+_0x4885b5['headers'][_0xc05b('0x3e')]+_0xc05b('0x3f')+_0x21f562+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xc05b('0x10')](function(){_0x41c54e[_0xc05b('0x40')](0xc8)[_0xc05b('0x31')]({'message':_0xc05b('0x41')});})[_0xc05b('0x21')](function(_0x512370){return handleError(_0x41c54e,0x1f4,_0x512370);});};exports[_0xc05b('0x42')]=function(_0x5043b3,_0x1d1f95){return db[_0xc05b('0x43')]['find']({'where':{'resetPasswordToken':_0x5043b3['params'][_0xc05b('0x44')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x31d59c){if(!_0x31d59c){throw new Error(_0xc05b('0x45'));}return db[_0xc05b('0xc')]['findOne']({'attributes':['id',_0xc05b('0x46'),_0xc05b('0x47'),_0xc05b('0x48')]})[_0xc05b('0x10')](function(_0x1ebbbf){if(_0x1ebbbf[_0xc05b('0x46')])authService['validatePasswordPattern'](_0x5043b3['body'][_0xc05b('0x12')]);if(!_0x1ebbbf[_0xc05b('0x47')]||!_0x31d59c[_0xc05b('0x49')])return _0x31d59c;authService['validatePasswordHistory'](_0x5043b3['body'][_0xc05b('0x12')],_0x31d59c[_0xc05b('0x49')],_0x1ebbbf[_0xc05b('0x48')]);return _0x31d59c;})['then'](function(){_0x31d59c[_0xc05b('0x12')]=_0x5043b3['body'][_0xc05b('0x12')];_0x31d59c[_0xc05b('0x4a')]=null;_0x31d59c['resetPasswordExpires']=null;return _0x31d59c[_0xc05b('0x3a')]();});})[_0xc05b('0x10')](function(){_0x1d1f95['status'](0xc8)['send']({'message':'Password\x20reset!'});})[_0xc05b('0x21')](function(_0x6f9332){return handleError(_0x1d1f95,0x1f4,_0x6f9332);});};passport[_0xc05b('0x4b')](_0xc05b('0x33'),new LocalStrategy({'usernameField':_0xc05b('0x11'),'passwordField':_0xc05b('0x12')},function(_0x59e033,_0x3cab46,_0x7becaf){return localAuthenticate(db[_0xc05b('0x43')],_0x59e033,_0x3cab46,_0x7becaf);})); \ No newline at end of file +var _0x6ebc=['SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','authenticate','local-login','signToken','json','online','forgot','body','trim','toLowerCase','Setting','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','password','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','findOne','blockDuration','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','Smtp','request','SendMail','error'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6ebc,0x78));var _0xc6eb=function(_0x588901,_0x17249f){_0x588901=_0x588901-0x0;var _0x39c89c=_0x6ebc[_0x588901];return _0x39c89c;};'use strict';var util=require(_0xc6eb('0x0'));var passport=require(_0xc6eb('0x1'));var LocalStrategy=require(_0xc6eb('0x2'))[_0xc6eb('0x3')];var jayson=require('jayson/promise');var _=require(_0xc6eb('0x4'));var rs=require(_0xc6eb('0x5'));var moment=require(_0xc6eb('0x6'));var db=require(_0xc6eb('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xc6eb('0x8'));var client=jayson[_0xc6eb('0x9')][_0xc6eb('0xa')]({'port':0x232b});function localAuthenticate(_0x4452b6,_0xe56db1,_0x99e6f3,_0x2c9025){var _0x3de069,_0x18eb36;return db['Setting'][_0xc6eb('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc6eb('0xc')],'raw':!![]})['then'](function(_0x56b9d6){_0x3de069=_0x56b9d6;return _0x4452b6[_0xc6eb('0xb')]({'attributes':['id','name','password','salt','role',_0xc6eb('0xd'),_0xc6eb('0xe'),_0xc6eb('0xf'),_0xc6eb('0x10')],'where':{'name':_0xe56db1,'role':{'$or':[_0xc6eb('0x11'),_0xc6eb('0x12'),_0xc6eb('0x13')]}}});})[_0xc6eb('0x14')](function(_0x4a546a){if(!_0x4a546a||_0x4a546a&&_0x4a546a[_0xc6eb('0x15')]!==_0xe56db1){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x18eb36=_0x4a546a;return _0x18eb36;}})[_0xc6eb('0x14')](function(){_0x18eb36['authenticate'](_0x99e6f3,function(_0x2e13e9,_0x451648){var _0x409824=_0x18eb36[_0xc6eb('0x10')]+0x1;if(_0x2e13e9){return _0x2c9025(_0x2e13e9);}else if(!_0x451648){if(_0x18eb36['disabled']){return _0x2c9025(null,![],{'message':_0xc6eb('0x16')});}else if(_0x3de069[_0xc6eb('0x17')]>0x0){if(_0x18eb36[_0xc6eb('0xe')]){if(_0x3de069[_0xc6eb('0xc')]>0x0){if(moment(_0x18eb36[_0xc6eb('0xf')])[_0xc6eb('0x18')](_0x3de069[_0xc6eb('0xc')],_0xc6eb('0x19'))>moment()){return _0x2c9025(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc6eb('0x1a')](_0x18eb36,_0x409824,![],null)[_0xc6eb('0x14')](function(){return _0x2c9025(null,![],{'message':_0xc6eb('0x16')});});}}else{return _0x2c9025(null,![],{'message':_0xc6eb('0x16')});}}else{if(_0x409824>=_0x3de069[_0xc6eb('0x17')]){return utils['clearBlockUser'](_0x18eb36,0x0,!![],moment())[_0xc6eb('0x14')](function(){return _0x2c9025(null,![],{'message':_0xc6eb('0x16')});});}else{return utils[_0xc6eb('0x1a')](_0x18eb36,_0x409824,![],null)['then'](function(){return _0x2c9025(null,![],{'message':_0xc6eb('0x16')});});}}}else{return _0x2c9025(null,![],{'message':_0xc6eb('0x16')});}}else{if(_0x18eb36['disabled']){return _0x2c9025(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3de069['allowedLoginAttempts']>0x0){if(_0x18eb36[_0xc6eb('0xe')]){if(_0x3de069['blockDuration']>0x0){if(moment(_0x18eb36[_0xc6eb('0xf')])['add'](_0x3de069[_0xc6eb('0xc')],_0xc6eb('0x19'))>moment()){return _0x2c9025(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc6eb('0x1a')](_0x18eb36,0x0,![],null)['then'](function(){return utils['getLicense'](_0x18eb36);})[_0xc6eb('0x14')](function(){return _0x2c9025(null,_0x18eb36);});}}else{return _0x2c9025(null,![],{'message':_0xc6eb('0x16')});}}else{return utils[_0xc6eb('0x1a')](_0x18eb36,0x0,![],null)[_0xc6eb('0x14')](function(){return utils[_0xc6eb('0x1b')](_0x18eb36);})['then'](function(){return _0x2c9025(null,_0x18eb36);})[_0xc6eb('0x1c')](function(_0x4d1709){return _0x2c9025(null,![],_0x4d1709);});}}else{if(_0x18eb36[_0xc6eb('0xe')]){return _0x2c9025(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc6eb('0x1b')](_0x18eb36)[_0xc6eb('0x14')](function(){return _0x2c9025(null,_0x18eb36);});}}}});})[_0xc6eb('0x1c')](function(_0x3f0eee){return _0x2c9025(null,![],_0x3f0eee);});}function sendServiceMail(_0x47376d){return db[_0xc6eb('0x1d')][_0xc6eb('0x1e')]({'where':{'service':!![]},'attributes':['id',_0xc6eb('0x15'),_0xc6eb('0x1f')],'include':[{'model':db[_0xc6eb('0x20')],'as':'Smtp','include':[{'model':db[_0xc6eb('0x21')],'as':_0xc6eb('0x21')}]}]})[_0xc6eb('0x14')](function(_0x48fbd2){if(!_0x48fbd2){throw new Error(_0xc6eb('0x22'));}var _0x299146=_0x48fbd2[_0xc6eb('0x23')]();var _0x38f74c={'account':_0x299146,'message':_[_0xc6eb('0x24')]({'from':util[_0xc6eb('0x25')]('\x22%s\x22\x20<%s>',_0x48fbd2[_0xc6eb('0x15')],_0x48fbd2['email']||_0x48fbd2[_0xc6eb('0x26')][_0xc6eb('0x12')])},_0x47376d)};return client[_0xc6eb('0x27')](_0xc6eb('0x28'),_0x38f74c);})[_0xc6eb('0x14')](function(_0x50730){if(_0x50730[_0xc6eb('0x29')]){throw new Error(util[_0xc6eb('0x25')](_0xc6eb('0x2a'),_0x50730['error'][_0xc6eb('0x2b')]||JSON[_0xc6eb('0x2c')](_0x50730[_0xc6eb('0x29')])));}return!![];});}function handleError(_0x44878f,_0x1662c1,_0x3c64e2){return _0x44878f[_0xc6eb('0x2d')](_0x1662c1||0x1f4)[_0xc6eb('0x2e')]({'message':_0x3c64e2?_0x3c64e2[_0xc6eb('0x2b')]||_0x3c64e2:''});}exports['login']=function(_0x5e14f1,_0x593806,_0x439c43){passport[_0xc6eb('0x2f')](_0xc6eb('0x30'),function(_0x5ab4f7,_0xbf1112,_0x5e3361){var _0x3eb669=_0x5ab4f7||_0x5e3361;if(_0x3eb669){return handleError(_0x593806,0x191,_0x3eb669);}if(!_0xbf1112){return handleError(_0x593806,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x26e70e={'payload':{'id':_0xbf1112['id'],'role':_0xbf1112['role']},'options':{'expiresIn':0x15180}};return authService[_0xc6eb('0x31')](_0x26e70e)['then'](function(_0x34df7c){_0x593806[_0xc6eb('0x32')]({'id':_0xbf1112['id'],'token':_0x34df7c,'statusCall':'','isAlreadyLogged':_0xbf1112[_0xc6eb('0x33')]});});}})(_0x5e14f1,_0x593806,_0x439c43);};exports[_0xc6eb('0x34')]=function(_0x597783,_0x3fdc5f){if(!_0x597783[_0xc6eb('0x35')]['email']){return handleError(_0x3fdc5f,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x46c618=rs['generate']();_0x597783[_0xc6eb('0x35')][_0xc6eb('0x1f')]=_0x597783[_0xc6eb('0x35')][_0xc6eb('0x1f')][_0xc6eb('0x36')]()[_0xc6eb('0x37')]();var _0x273c31;return db[_0xc6eb('0x38')][_0xc6eb('0xb')]({'where':{'id':0x1},'attributes':[_0xc6eb('0x17'),'blockDuration'],'raw':!![]})[_0xc6eb('0x14')](function(_0x40d5d9){_0x273c31=_0x40d5d9;return db['User'][_0xc6eb('0x1e')]({'where':{'email':_0x597783[_0xc6eb('0x35')]['email']}});})[_0xc6eb('0x14')](function(_0x2796cd){if(!_0x2796cd){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x2796cd['disabled']){throw new Error(_0xc6eb('0x39'));}if(_0x2796cd[_0xc6eb('0xe')]){if(moment(_0x2796cd['blockedAt'])[_0xc6eb('0x18')](_0x273c31[_0xc6eb('0xc')],_0xc6eb('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x2796cd['blocked']=![];_0x2796cd['blockedAt']=null;}}_0x2796cd[_0xc6eb('0x3a')]=_0x46c618;_0x2796cd[_0xc6eb('0x3b')]=Date[_0xc6eb('0x3c')]()+0x36ee80;return _0x2796cd[_0xc6eb('0x3d')]();})['then'](function(){return sendServiceMail({'to':_0x597783[_0xc6eb('0x35')][_0xc6eb('0x1f')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xc6eb('0x3e')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xc6eb('0x3f')+_0x597783[_0xc6eb('0x40')][_0xc6eb('0x41')]+_0xc6eb('0x42')+_0x46c618+'\x0a\x0a'+_0xc6eb('0x43')});})[_0xc6eb('0x14')](function(){_0x3fdc5f[_0xc6eb('0x2d')](0xc8)[_0xc6eb('0x2e')]({'message':_0xc6eb('0x44')});})[_0xc6eb('0x1c')](function(_0x30507b){return handleError(_0x3fdc5f,0x1f4,_0x30507b);});};exports[_0xc6eb('0x45')]=function(_0x100e09,_0x462c6c){return db[_0xc6eb('0x46')][_0xc6eb('0x1e')]({'where':{'resetPasswordToken':_0x100e09[_0xc6eb('0x47')]['token'],'resetPasswordExpires':{'$gt':Date[_0xc6eb('0x3c')]()}}})['then'](function(_0x54a8aa){if(!_0x54a8aa){throw new Error(_0xc6eb('0x48'));}return db['Setting'][_0xc6eb('0xb')]({'attributes':['id',_0xc6eb('0x49'),'enforcePasswordHistory',_0xc6eb('0x4a')]})['then'](function(_0x37abd6){if(_0x37abd6[_0xc6eb('0x49')])authService['validatePasswordPattern'](_0x100e09[_0xc6eb('0x35')][_0xc6eb('0x4b')]);if(!_0x37abd6[_0xc6eb('0x4c')]||!_0x54a8aa[_0xc6eb('0x4d')])return _0x54a8aa;authService[_0xc6eb('0x4e')](_0x100e09[_0xc6eb('0x35')][_0xc6eb('0x4b')],_0x54a8aa[_0xc6eb('0x4d')],_0x37abd6[_0xc6eb('0x4a')]);return _0x54a8aa;})[_0xc6eb('0x14')](function(){_0x54a8aa['password']=_0x100e09[_0xc6eb('0x35')][_0xc6eb('0x4b')];_0x54a8aa[_0xc6eb('0x3a')]=null;_0x54a8aa[_0xc6eb('0x3b')]=null;return _0x54a8aa[_0xc6eb('0x3d')]();});})['then'](function(){_0x462c6c['status'](0xc8)['send']({'message':_0xc6eb('0x4f')});})[_0xc6eb('0x1c')](function(_0x59a723){return handleError(_0x462c6c,0x1f4,_0x59a723);});};passport[_0xc6eb('0x50')](_0xc6eb('0x30'),new LocalStrategy({'usernameField':_0xc6eb('0x15'),'passwordField':'password'},function(_0x166990,_0x381af7,_0x513aad){return localAuthenticate(db[_0xc6eb('0x46')],_0x166990,_0x381af7,_0x513aad);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1f0b77b..3718735 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 _0x84fc=['exports','express','Router','./authLocal.controller','post','/forgot','forgot','/reset/:token'];(function(_0x4a77b8,_0xdd710){var _0x509c8c=function(_0x2bf2a5){while(--_0x2bf2a5){_0x4a77b8['push'](_0x4a77b8['shift']());}};_0x509c8c(++_0xdd710);}(_0x84fc,0x171));var _0xc84f=function(_0x41f2f5,_0x14f33c){_0x41f2f5=_0x41f2f5-0x0;var _0x3d49f1=_0x84fc[_0x41f2f5];return _0x3d49f1;};'use strict';var express=require(_0xc84f('0x0'));var router=express[_0xc84f('0x1')]();var controller=require(_0xc84f('0x2'));router[_0xc84f('0x3')]('/',controller['login']);router['post'](_0xc84f('0x4'),controller[_0xc84f('0x5')]);router[_0xc84f('0x3')](_0xc84f('0x6'),controller['reset']);module[_0xc84f('0x7')]=router; \ No newline at end of file +var _0xbddd=['exports','express','Router','./authLocal.controller','post','login','/forgot','/reset/:token'];(function(_0x348310,_0x462221){var _0x5122b6=function(_0xd4b958){while(--_0xd4b958){_0x348310['push'](_0x348310['shift']());}};_0x5122b6(++_0x462221);}(_0xbddd,0x159));var _0xdbdd=function(_0x2f48a6,_0x4d6b5e){_0x2f48a6=_0x2f48a6-0x0;var _0x5788d3=_0xbddd[_0x2f48a6];return _0x5788d3;};'use strict';var express=require(_0xdbdd('0x0'));var router=express[_0xdbdd('0x1')]();var controller=require(_0xdbdd('0x2'));router[_0xdbdd('0x3')]('/',controller[_0xdbdd('0x4')]);router[_0xdbdd('0x3')](_0xdbdd('0x5'),controller['forgot']);router[_0xdbdd('0x3')](_0xdbdd('0x6'),controller['reset']);module[_0xdbdd('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 2cfc69d..4c3e1e2 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 _0xc48c=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x450382,_0x484de1){var _0x3f1f55=function(_0x1db8f6){while(--_0x1db8f6){_0x450382['push'](_0x450382['shift']());}};_0x3f1f55(++_0x484de1);}(_0xc48c,0xfd));var _0xcc48=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xc48c[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0xcc48('0x0'));module[_0xcc48('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xcc48('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xcc48('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xcc48('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x517b=['INTEGER','sequelize','exports','BOOLEAN'];(function(_0x565610,_0x1a4085){var _0x89951f=function(_0x4bdf54){while(--_0x4bdf54){_0x565610['push'](_0x565610['shift']());}};_0x89951f(++_0x1a4085);}(_0x517b,0x129));var _0xb517=function(_0xc0ffd5,_0x5d656a){_0xc0ffd5=_0xc0ffd5-0x0;var _0x46fe2c=_0x517b[_0xc0ffd5];return _0x46fe2c;};'use strict';var Sequelize=require(_0xb517('0x0'));module[_0xb517('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xb517('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xb517('0x3')],'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 fced00a..f80a4de 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 _0x1b64=['intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','show','includeAll','find','create','body','catch','update','params','destroy','Condition','addConditions','omit','ids','getConditions','rawAttributes','Action','addActions','findOne','getActions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','Automation','type','key','model','map','keys','query','filters'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x1b64,0x7b));var _0x41b6=function(_0x5960c5,_0x33109f){_0x5960c5=_0x5960c5-0x0;var _0x4d3c3b=_0x1b64[_0x5960c5];return _0x4d3c3b;};'use strict';var emlformat=require(_0x41b6('0x0'));var rimraf=require(_0x41b6('0x1'));var zipdir=require(_0x41b6('0x2'));var jsonpatch=require(_0x41b6('0x3'));var rp=require(_0x41b6('0x4'));var moment=require(_0x41b6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x41b6('0x6'));var path=require(_0x41b6('0x7'));var sox=require(_0x41b6('0x8'));var csv=require(_0x41b6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x41b6('0xa'));var _=require(_0x41b6('0xb'));var squel=require(_0x41b6('0xc'));var crypto=require(_0x41b6('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x41b6('0x9'));var querystring=require(_0x41b6('0xe'));var Papa=require(_0x41b6('0xf'));var Redis=require('ioredis');var authService=require(_0x41b6('0x10'));var qs=require(_0x41b6('0x11'));var as=require(_0x41b6('0x12'));var hardwareService=require(_0x41b6('0x13'));var logger=require(_0x41b6('0x14'))(_0x41b6('0x15'));var utils=require(_0x41b6('0x16'));var config=require(_0x41b6('0x17'));var licenseUtil=require(_0x41b6('0x18'));var db=require(_0x41b6('0x19'))['db'];function respondWithStatusCode(_0x4acd07,_0x203b5e){_0x203b5e=_0x203b5e||0xcc;return function(_0x214953){if(_0x214953){return _0x4acd07[_0x41b6('0x1a')](_0x203b5e);}return _0x4acd07[_0x41b6('0x1b')](_0x203b5e)[_0x41b6('0x1c')]();};}function respondWithResult(_0x1f858b,_0x347ac8){_0x347ac8=_0x347ac8||0xc8;return function(_0x3ded48){if(_0x3ded48){return _0x1f858b[_0x41b6('0x1b')](_0x347ac8)[_0x41b6('0x1d')](_0x3ded48);}};}function respondWithFilteredResult(_0x4eb2e7,_0x5189ae){return function(_0x258300){if(_0x258300){var _0x48448c=typeof _0x5189ae['offset']===_0x41b6('0x1e')&&typeof _0x5189ae[_0x41b6('0x1f')]==='undefined';var _0x15a6ef=_0x258300[_0x41b6('0x20')];var _0x460e4f=_0x48448c?0x0:_0x5189ae[_0x41b6('0x21')];var _0x437187=_0x48448c?_0x258300['count']:_0x5189ae[_0x41b6('0x21')]+_0x5189ae[_0x41b6('0x1f')];var _0x53c98e;if(_0x437187>=_0x15a6ef){_0x437187=_0x15a6ef;_0x53c98e=0xc8;}else{_0x53c98e=0xce;}_0x4eb2e7[_0x41b6('0x1b')](_0x53c98e);return _0x4eb2e7[_0x41b6('0x22')](_0x41b6('0x23'),_0x460e4f+'-'+_0x437187+'/'+_0x15a6ef)[_0x41b6('0x1d')](_0x258300);}return null;};}function patchUpdates(_0x1aaf9b){return function(_0x4ec03a){try{jsonpatch[_0x41b6('0x24')](_0x4ec03a,_0x1aaf9b,!![]);}catch(_0x4264e9){return BPromise[_0x41b6('0x25')](_0x4264e9);}return _0x4ec03a[_0x41b6('0x26')]();};}function saveUpdates(_0x131cd5,_0x3be7f3){return function(_0x14f1d8){if(_0x14f1d8){return _0x14f1d8['update'](_0x131cd5)[_0x41b6('0x27')](function(_0x17ad1d){return _0x17ad1d;});}return null;};}function removeEntity(_0x22ea6e,_0x569d96){return function(_0x2a838b){if(_0x2a838b){return _0x2a838b['destroy']()[_0x41b6('0x27')](function(){_0x22ea6e[_0x41b6('0x1b')](0xcc)[_0x41b6('0x1c')]();});}};}function handleEntityNotFound(_0x4f7856,_0x132c9a){return function(_0x18e0a1){if(!_0x18e0a1){_0x4f7856[_0x41b6('0x1a')](0x194);}return _0x18e0a1;};}function handleError(_0x528c72,_0x4e3edf){_0x4e3edf=_0x4e3edf||0x1f4;return function(_0x489e2d){logger[_0x41b6('0x28')](_0x489e2d[_0x41b6('0x29')]);if(_0x489e2d[_0x41b6('0x2a')]){delete _0x489e2d[_0x41b6('0x2a')];}_0x528c72[_0x41b6('0x1b')](_0x4e3edf)[_0x41b6('0x2b')](_0x489e2d);};}exports[_0x41b6('0x2c')]=function(_0x1e0e62,_0x43b148){var _0xbb0f41={},_0x1097b3={},_0x42b13e={'count':0x0,'rows':[]};var _0x4be5a7=_['map'](db[_0x41b6('0x2d')]['rawAttributes'],function(_0x34e965){return{'name':_0x34e965['fieldName'],'type':_0x34e965[_0x41b6('0x2e')][_0x41b6('0x2f')]};});_0x1097b3[_0x41b6('0x30')]=_[_0x41b6('0x31')](_0x4be5a7,'name');_0x1097b3['query']=_[_0x41b6('0x32')](_0x1e0e62[_0x41b6('0x33')]);_0x1097b3[_0x41b6('0x34')]=_[_0x41b6('0x35')](_0x1097b3[_0x41b6('0x30')],_0x1097b3[_0x41b6('0x33')]);_0xbb0f41['attributes']=_[_0x41b6('0x35')](_0x1097b3[_0x41b6('0x30')],qs[_0x41b6('0x36')](_0x1e0e62[_0x41b6('0x33')][_0x41b6('0x36')]));_0xbb0f41[_0x41b6('0x37')]=_0xbb0f41[_0x41b6('0x37')][_0x41b6('0x38')]?_0xbb0f41[_0x41b6('0x37')]:_0x1097b3[_0x41b6('0x30')];if(!_0x1e0e62[_0x41b6('0x33')]['hasOwnProperty'](_0x41b6('0x39'))){_0xbb0f41[_0x41b6('0x1f')]=qs['limit'](_0x1e0e62[_0x41b6('0x33')][_0x41b6('0x1f')]);_0xbb0f41[_0x41b6('0x21')]=qs[_0x41b6('0x21')](_0x1e0e62[_0x41b6('0x33')][_0x41b6('0x21')]);}_0xbb0f41[_0x41b6('0x3a')]=qs[_0x41b6('0x3b')](_0x1e0e62['query'][_0x41b6('0x3b')]);_0xbb0f41['where']=qs[_0x41b6('0x34')](_[_0x41b6('0x3c')](_0x1e0e62['query'],_0x1097b3[_0x41b6('0x34')]),_0x4be5a7);if(_0x1e0e62[_0x41b6('0x33')][_0x41b6('0x3d')]){_0xbb0f41[_0x41b6('0x3e')]=_[_0x41b6('0x3f')](_0xbb0f41[_0x41b6('0x3e')],{'$or':_[_0x41b6('0x31')](_0x4be5a7,function(_0x3c50ed){if(_0x3c50ed['type']!=='VIRTUAL'){var _0x238c88={};_0x238c88[_0x3c50ed[_0x41b6('0x2a')]]={'$like':'%'+_0x1e0e62[_0x41b6('0x33')]['filter']+'%'};return _0x238c88;}})});}_0xbb0f41=_['merge']({},_0xbb0f41,_0x1e0e62[_0x41b6('0x40')]);var _0x323638={'where':_0xbb0f41[_0x41b6('0x3e')]};return db[_0x41b6('0x2d')][_0x41b6('0x20')](_0x323638)[_0x41b6('0x27')](function(_0x2b92c6){_0x42b13e[_0x41b6('0x20')]=_0x2b92c6;if(_0x1e0e62[_0x41b6('0x33')]['includeAll']){_0xbb0f41[_0x41b6('0x41')]=[{'all':!![]}];}return db[_0x41b6('0x2d')][_0x41b6('0x42')](_0xbb0f41);})[_0x41b6('0x27')](function(_0x57cd47){_0x42b13e[_0x41b6('0x43')]=_0x57cd47;return _0x42b13e;})[_0x41b6('0x27')](respondWithFilteredResult(_0x43b148,_0xbb0f41))['catch'](handleError(_0x43b148,null));};exports[_0x41b6('0x44')]=function(_0x4abbca,_0x584d61){var _0x3c549d={'raw':![],'where':{'id':_0x4abbca['params']['id']}},_0x3db6d2={};_0x3db6d2[_0x41b6('0x30')]=_[_0x41b6('0x32')](db['Automation']['rawAttributes']);_0x3db6d2[_0x41b6('0x33')]=_[_0x41b6('0x32')](_0x4abbca[_0x41b6('0x33')]);_0x3db6d2[_0x41b6('0x34')]=_[_0x41b6('0x35')](_0x3db6d2[_0x41b6('0x30')],_0x3db6d2[_0x41b6('0x33')]);_0x3c549d['attributes']=_[_0x41b6('0x35')](_0x3db6d2[_0x41b6('0x30')],qs[_0x41b6('0x36')](_0x4abbca[_0x41b6('0x33')][_0x41b6('0x36')]));_0x3c549d[_0x41b6('0x37')]=_0x3c549d[_0x41b6('0x37')]['length']?_0x3c549d[_0x41b6('0x37')]:_0x3db6d2[_0x41b6('0x30')];if(_0x4abbca['query'][_0x41b6('0x45')]){_0x3c549d[_0x41b6('0x41')]=[{'all':!![]}];}_0x3c549d=_[_0x41b6('0x3f')]({},_0x3c549d,_0x4abbca['options']);return db[_0x41b6('0x2d')][_0x41b6('0x46')](_0x3c549d)[_0x41b6('0x27')](handleEntityNotFound(_0x584d61,null))[_0x41b6('0x27')](respondWithResult(_0x584d61,null))['catch'](handleError(_0x584d61,null));};exports[_0x41b6('0x47')]=function(_0x31dfe1,_0x202b40){return db[_0x41b6('0x2d')][_0x41b6('0x47')](_0x31dfe1[_0x41b6('0x48')],{})[_0x41b6('0x27')](respondWithResult(_0x202b40,0xc9))[_0x41b6('0x49')](handleError(_0x202b40,null));};exports[_0x41b6('0x4a')]=function(_0x3047f3,_0x1ec2b7){if(_0x3047f3[_0x41b6('0x48')]['id']){delete _0x3047f3['body']['id'];}return db[_0x41b6('0x2d')]['find']({'where':{'id':_0x3047f3[_0x41b6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1ec2b7,null))['then'](saveUpdates(_0x3047f3[_0x41b6('0x48')],null))[_0x41b6('0x27')](respondWithResult(_0x1ec2b7,null))[_0x41b6('0x49')](handleError(_0x1ec2b7,null));};exports[_0x41b6('0x4c')]=function(_0x2c6446,_0x1824d1){return db[_0x41b6('0x2d')][_0x41b6('0x46')]({'where':{'id':_0x2c6446[_0x41b6('0x4b')]['id']}})[_0x41b6('0x27')](handleEntityNotFound(_0x1824d1,null))[_0x41b6('0x27')](removeEntity(_0x1824d1,null))['catch'](handleError(_0x1824d1,null));};exports['addConditions']=function(_0x36f9e5,_0x5cf46a,_0x1abcdc){return db[_0x41b6('0x4d')][_0x41b6('0x46')]({'where':{'id':_0x36f9e5[_0x41b6('0x4b')]['id']}})[_0x41b6('0x27')](handleEntityNotFound(_0x5cf46a,null))[_0x41b6('0x27')](function(_0x4b21ac){if(_0x4b21ac){return _0x4b21ac[_0x41b6('0x4e')](_0x36f9e5[_0x41b6('0x48')]['ids'],_[_0x41b6('0x4f')](_0x36f9e5[_0x41b6('0x48')],[_0x41b6('0x50'),'id'])||{});}})[_0x41b6('0x27')](respondWithResult(_0x5cf46a,null))[_0x41b6('0x49')](handleError(_0x5cf46a,null));};exports[_0x41b6('0x51')]=function(_0x1f4a2c,_0x10a602,_0x5722c0){var _0x4a90a6={};var _0x16670a={};var _0x543305;var _0x41af87;return db[_0x41b6('0x2d')]['findOne']({'where':{'id':_0x1f4a2c['params']['id']}})[_0x41b6('0x27')](handleEntityNotFound(_0x10a602,null))['then'](function(_0x217754){if(_0x217754){_0x543305=_0x217754;_0x16670a[_0x41b6('0x30')]=_['keys'](db[_0x41b6('0x4d')][_0x41b6('0x52')]);_0x16670a[_0x41b6('0x33')]=_[_0x41b6('0x32')](_0x1f4a2c[_0x41b6('0x33')]);_0x16670a['filters']=_['intersection'](_0x16670a['model'],_0x16670a['query']);_0x4a90a6[_0x41b6('0x37')]=_[_0x41b6('0x35')](_0x16670a[_0x41b6('0x30')],qs[_0x41b6('0x36')](_0x1f4a2c['query'][_0x41b6('0x36')]));_0x4a90a6[_0x41b6('0x37')]=_0x4a90a6[_0x41b6('0x37')][_0x41b6('0x38')]?_0x4a90a6[_0x41b6('0x37')]:_0x16670a[_0x41b6('0x30')];_0x4a90a6[_0x41b6('0x3a')]=qs['sort'](_0x1f4a2c['query'][_0x41b6('0x3b')]);_0x4a90a6[_0x41b6('0x3e')]=qs[_0x41b6('0x34')](_['pick'](_0x1f4a2c[_0x41b6('0x33')],_0x16670a[_0x41b6('0x34')]));if(_0x1f4a2c[_0x41b6('0x33')][_0x41b6('0x3d')]){_0x4a90a6[_0x41b6('0x3e')]=_[_0x41b6('0x3f')](_0x4a90a6[_0x41b6('0x3e')],{'$or':_[_0x41b6('0x31')](_0x4a90a6[_0x41b6('0x37')],function(_0x56648f){var _0x3e0675={};_0x3e0675[_0x56648f]={'$like':'%'+_0x1f4a2c[_0x41b6('0x33')][_0x41b6('0x3d')]+'%'};return _0x3e0675;})});}_0x4a90a6=_[_0x41b6('0x3f')]({},_0x4a90a6,_0x1f4a2c['options']);return _0x543305[_0x41b6('0x51')](_0x4a90a6);}})[_0x41b6('0x27')](function(_0x3c0938){if(_0x3c0938){_0x41af87=_0x3c0938[_0x41b6('0x38')];if(!_0x1f4a2c[_0x41b6('0x33')]['hasOwnProperty'](_0x41b6('0x39'))){_0x4a90a6[_0x41b6('0x1f')]=qs[_0x41b6('0x1f')](_0x1f4a2c[_0x41b6('0x33')][_0x41b6('0x1f')]);_0x4a90a6[_0x41b6('0x21')]=qs['offset'](_0x1f4a2c[_0x41b6('0x33')][_0x41b6('0x21')]);}return _0x543305[_0x41b6('0x51')](_0x4a90a6);}})[_0x41b6('0x27')](function(_0x3a4ff1){if(_0x3a4ff1){return _0x3a4ff1?{'count':_0x41af87,'rows':_0x3a4ff1}:null;}})[_0x41b6('0x27')](respondWithResult(_0x10a602,null))['catch'](handleError(_0x10a602,null));};exports['addActions']=function(_0x45f1cc,_0x564216,_0x775678){return db[_0x41b6('0x53')][_0x41b6('0x46')]({'where':{'id':_0x45f1cc[_0x41b6('0x4b')]['id']}})[_0x41b6('0x27')](handleEntityNotFound(_0x564216,null))[_0x41b6('0x27')](function(_0x42bc93){if(_0x42bc93){return _0x42bc93[_0x41b6('0x54')](_0x45f1cc['body']['ids'],_[_0x41b6('0x4f')](_0x45f1cc[_0x41b6('0x48')],['ids','id'])||{});}})['then'](respondWithResult(_0x564216,null))[_0x41b6('0x49')](handleError(_0x564216,null));};exports['getActions']=function(_0x1d52be,_0x5112c9,_0x17ea13){var _0x3cbb54={};var _0x152e5c={};var _0x4bc1c9;var _0x198952;return db[_0x41b6('0x2d')][_0x41b6('0x55')]({'where':{'id':_0x1d52be['params']['id']}})['then'](handleEntityNotFound(_0x5112c9,null))['then'](function(_0x2a59db){if(_0x2a59db){_0x4bc1c9=_0x2a59db;_0x152e5c[_0x41b6('0x30')]=_[_0x41b6('0x32')](db['Action'][_0x41b6('0x52')]);_0x152e5c['query']=_[_0x41b6('0x32')](_0x1d52be[_0x41b6('0x33')]);_0x152e5c[_0x41b6('0x34')]=_['intersection'](_0x152e5c[_0x41b6('0x30')],_0x152e5c[_0x41b6('0x33')]);_0x3cbb54[_0x41b6('0x37')]=_[_0x41b6('0x35')](_0x152e5c[_0x41b6('0x30')],qs[_0x41b6('0x36')](_0x1d52be['query'][_0x41b6('0x36')]));_0x3cbb54[_0x41b6('0x37')]=_0x3cbb54[_0x41b6('0x37')][_0x41b6('0x38')]?_0x3cbb54[_0x41b6('0x37')]:_0x152e5c[_0x41b6('0x30')];_0x3cbb54['order']=qs[_0x41b6('0x3b')](_0x1d52be[_0x41b6('0x33')]['sort']);_0x3cbb54[_0x41b6('0x3e')]=qs[_0x41b6('0x34')](_['pick'](_0x1d52be[_0x41b6('0x33')],_0x152e5c[_0x41b6('0x34')]));if(_0x1d52be[_0x41b6('0x33')][_0x41b6('0x3d')]){_0x3cbb54[_0x41b6('0x3e')]=_[_0x41b6('0x3f')](_0x3cbb54['where'],{'$or':_[_0x41b6('0x31')](_0x3cbb54['attributes'],function(_0x35eac){var _0x131899={};_0x131899[_0x35eac]={'$like':'%'+_0x1d52be[_0x41b6('0x33')][_0x41b6('0x3d')]+'%'};return _0x131899;})});}_0x3cbb54=_[_0x41b6('0x3f')]({},_0x3cbb54,_0x1d52be[_0x41b6('0x40')]);return _0x4bc1c9[_0x41b6('0x56')](_0x3cbb54);}})['then'](function(_0x8ce15d){if(_0x8ce15d){_0x198952=_0x8ce15d[_0x41b6('0x38')];if(!_0x1d52be[_0x41b6('0x33')][_0x41b6('0x57')](_0x41b6('0x39'))){_0x3cbb54[_0x41b6('0x1f')]=qs[_0x41b6('0x1f')](_0x1d52be[_0x41b6('0x33')][_0x41b6('0x1f')]);_0x3cbb54[_0x41b6('0x21')]=qs[_0x41b6('0x21')](_0x1d52be[_0x41b6('0x33')][_0x41b6('0x21')]);}return _0x4bc1c9[_0x41b6('0x56')](_0x3cbb54);}})[_0x41b6('0x27')](function(_0x152e9c){if(_0x152e9c){return _0x152e9c?{'count':_0x198952,'rows':_0x152e9c}:null;}})[_0x41b6('0x27')](respondWithResult(_0x5112c9,null))[_0x41b6('0x49')](handleError(_0x5112c9,null));}; \ No newline at end of file +var _0x79fb=['count','set','Content-Range','save','update','destroy','then','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','length','includeAll','find','create','body','params','addConditions','ids','getConditions','findOne','addActions','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3be931,_0x3afd25){var _0x3b8a91=function(_0x163c3f){while(--_0x163c3f){_0x3be931['push'](_0x3be931['shift']());}};_0x3b8a91(++_0x3afd25);}(_0x79fb,0xd9));var _0xb79f=function(_0x308056,_0x8d9c69){_0x308056=_0x308056-0x0;var _0xbe9fc6=_0x79fb[_0x308056];return _0xbe9fc6;};'use strict';var emlformat=require(_0xb79f('0x0'));var rimraf=require(_0xb79f('0x1'));var zipdir=require(_0xb79f('0x2'));var jsonpatch=require(_0xb79f('0x3'));var rp=require(_0xb79f('0x4'));var moment=require('moment');var BPromise=require(_0xb79f('0x5'));var Mustache=require(_0xb79f('0x6'));var util=require(_0xb79f('0x7'));var path=require(_0xb79f('0x8'));var sox=require(_0xb79f('0x9'));var csv=require(_0xb79f('0xa'));var ejs=require(_0xb79f('0xb'));var fs=require('fs');var fs_extra=require(_0xb79f('0xc'));var _=require('lodash');var squel=require(_0xb79f('0xd'));var crypto=require(_0xb79f('0xe'));var jsforce=require(_0xb79f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb79f('0xa'));var querystring=require(_0xb79f('0x10'));var Papa=require(_0xb79f('0x11'));var Redis=require('ioredis');var authService=require(_0xb79f('0x12'));var qs=require(_0xb79f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb79f('0x14'));var logger=require(_0xb79f('0x15'))(_0xb79f('0x16'));var utils=require(_0xb79f('0x17'));var config=require(_0xb79f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb79f('0x19'))['db'];function respondWithStatusCode(_0x219a31,_0xdb4ab3){_0xdb4ab3=_0xdb4ab3||0xcc;return function(_0x323787){if(_0x323787){return _0x219a31[_0xb79f('0x1a')](_0xdb4ab3);}return _0x219a31[_0xb79f('0x1b')](_0xdb4ab3)[_0xb79f('0x1c')]();};}function respondWithResult(_0x47d6a4,_0x197d87){_0x197d87=_0x197d87||0xc8;return function(_0x2ac5c8){if(_0x2ac5c8){return _0x47d6a4[_0xb79f('0x1b')](_0x197d87)[_0xb79f('0x1d')](_0x2ac5c8);}};}function respondWithFilteredResult(_0xb53fdd,_0xab22f9){return function(_0xe3bfb3){if(_0xe3bfb3){var _0x495dae=typeof _0xab22f9[_0xb79f('0x1e')]===_0xb79f('0x1f')&&typeof _0xab22f9['limit']===_0xb79f('0x1f');var _0xa52411=_0xe3bfb3['count'];var _0x26cdf8=_0x495dae?0x0:_0xab22f9[_0xb79f('0x1e')];var _0x59226c=_0x495dae?_0xe3bfb3[_0xb79f('0x20')]:_0xab22f9[_0xb79f('0x1e')]+_0xab22f9['limit'];var _0x49374b;if(_0x59226c>=_0xa52411){_0x59226c=_0xa52411;_0x49374b=0xc8;}else{_0x49374b=0xce;}_0xb53fdd['status'](_0x49374b);return _0xb53fdd[_0xb79f('0x21')](_0xb79f('0x22'),_0x26cdf8+'-'+_0x59226c+'/'+_0xa52411)['json'](_0xe3bfb3);}return null;};}function patchUpdates(_0x8621d3){return function(_0x3da063){try{jsonpatch['apply'](_0x3da063,_0x8621d3,!![]);}catch(_0x106bae){return BPromise['reject'](_0x106bae);}return _0x3da063[_0xb79f('0x23')]();};}function saveUpdates(_0x55e97c,_0x246ab6){return function(_0x3d1478){if(_0x3d1478){return _0x3d1478[_0xb79f('0x24')](_0x55e97c)['then'](function(_0x3db1a0){return _0x3db1a0;});}return null;};}function removeEntity(_0x25aa15,_0x2ab119){return function(_0x5eae72){if(_0x5eae72){return _0x5eae72[_0xb79f('0x25')]()[_0xb79f('0x26')](function(){_0x25aa15[_0xb79f('0x1b')](0xcc)[_0xb79f('0x1c')]();});}};}function handleEntityNotFound(_0x470593,_0x293803){return function(_0x5aa319){if(!_0x5aa319){_0x470593[_0xb79f('0x1a')](0x194);}return _0x5aa319;};}function handleError(_0x39d4cc,_0x6bdfe2){_0x6bdfe2=_0x6bdfe2||0x1f4;return function(_0x674f11){logger[_0xb79f('0x27')](_0x674f11[_0xb79f('0x28')]);if(_0x674f11[_0xb79f('0x29')]){delete _0x674f11[_0xb79f('0x29')];}_0x39d4cc['status'](_0x6bdfe2)['send'](_0x674f11);};}exports[_0xb79f('0x2a')]=function(_0x14922d,_0x54bc40){var _0x5badfc={},_0x1d160c={},_0x25b7a1={'count':0x0,'rows':[]};var _0x1c3141=_[_0xb79f('0x2b')](db[_0xb79f('0x2c')][_0xb79f('0x2d')],function(_0x2bb98b){return{'name':_0x2bb98b[_0xb79f('0x2e')],'type':_0x2bb98b[_0xb79f('0x2f')][_0xb79f('0x30')]};});_0x1d160c[_0xb79f('0x31')]=_[_0xb79f('0x2b')](_0x1c3141,_0xb79f('0x29'));_0x1d160c[_0xb79f('0x32')]=_[_0xb79f('0x33')](_0x14922d[_0xb79f('0x32')]);_0x1d160c[_0xb79f('0x34')]=_[_0xb79f('0x35')](_0x1d160c[_0xb79f('0x31')],_0x1d160c[_0xb79f('0x32')]);_0x5badfc[_0xb79f('0x36')]=_[_0xb79f('0x35')](_0x1d160c[_0xb79f('0x31')],qs[_0xb79f('0x37')](_0x14922d['query']['fields']));_0x5badfc[_0xb79f('0x36')]=_0x5badfc[_0xb79f('0x36')]['length']?_0x5badfc[_0xb79f('0x36')]:_0x1d160c[_0xb79f('0x31')];if(!_0x14922d[_0xb79f('0x32')][_0xb79f('0x38')](_0xb79f('0x39'))){_0x5badfc[_0xb79f('0x3a')]=qs['limit'](_0x14922d['query'][_0xb79f('0x3a')]);_0x5badfc[_0xb79f('0x1e')]=qs[_0xb79f('0x1e')](_0x14922d['query'][_0xb79f('0x1e')]);}_0x5badfc[_0xb79f('0x3b')]=qs[_0xb79f('0x3c')](_0x14922d['query']['sort']);_0x5badfc[_0xb79f('0x3d')]=qs['filters'](_[_0xb79f('0x3e')](_0x14922d[_0xb79f('0x32')],_0x1d160c['filters']),_0x1c3141);if(_0x14922d['query'][_0xb79f('0x3f')]){_0x5badfc[_0xb79f('0x3d')]=_[_0xb79f('0x40')](_0x5badfc[_0xb79f('0x3d')],{'$or':_[_0xb79f('0x2b')](_0x1c3141,function(_0x5bdc77){if(_0x5bdc77[_0xb79f('0x2f')]!==_0xb79f('0x41')){var _0x422f80={};_0x422f80[_0x5bdc77[_0xb79f('0x29')]]={'$like':'%'+_0x14922d[_0xb79f('0x32')]['filter']+'%'};return _0x422f80;}})});}_0x5badfc=_['merge']({},_0x5badfc,_0x14922d[_0xb79f('0x42')]);var _0x1407f1={'where':_0x5badfc['where']};return db['Automation'][_0xb79f('0x20')](_0x1407f1)[_0xb79f('0x26')](function(_0x21f57f){_0x25b7a1[_0xb79f('0x20')]=_0x21f57f;if(_0x14922d['query']['includeAll']){_0x5badfc[_0xb79f('0x43')]=[{'all':!![]}];}return db['Automation'][_0xb79f('0x44')](_0x5badfc);})[_0xb79f('0x26')](function(_0x330a41){_0x25b7a1['rows']=_0x330a41;return _0x25b7a1;})[_0xb79f('0x26')](respondWithFilteredResult(_0x54bc40,_0x5badfc))[_0xb79f('0x45')](handleError(_0x54bc40,null));};exports[_0xb79f('0x46')]=function(_0xb6a45c,_0x2aacae){var _0x313b67={'raw':![],'where':{'id':_0xb6a45c['params']['id']}},_0x5859bf={};_0x5859bf['model']=_[_0xb79f('0x33')](db['Automation'][_0xb79f('0x2d')]);_0x5859bf['query']=_[_0xb79f('0x33')](_0xb6a45c[_0xb79f('0x32')]);_0x5859bf[_0xb79f('0x34')]=_[_0xb79f('0x35')](_0x5859bf[_0xb79f('0x31')],_0x5859bf[_0xb79f('0x32')]);_0x313b67[_0xb79f('0x36')]=_[_0xb79f('0x35')](_0x5859bf[_0xb79f('0x31')],qs[_0xb79f('0x37')](_0xb6a45c[_0xb79f('0x32')][_0xb79f('0x37')]));_0x313b67['attributes']=_0x313b67[_0xb79f('0x36')][_0xb79f('0x47')]?_0x313b67[_0xb79f('0x36')]:_0x5859bf[_0xb79f('0x31')];if(_0xb6a45c[_0xb79f('0x32')][_0xb79f('0x48')]){_0x313b67[_0xb79f('0x43')]=[{'all':!![]}];}_0x313b67=_[_0xb79f('0x40')]({},_0x313b67,_0xb6a45c[_0xb79f('0x42')]);return db[_0xb79f('0x2c')][_0xb79f('0x49')](_0x313b67)[_0xb79f('0x26')](handleEntityNotFound(_0x2aacae,null))[_0xb79f('0x26')](respondWithResult(_0x2aacae,null))[_0xb79f('0x45')](handleError(_0x2aacae,null));};exports[_0xb79f('0x4a')]=function(_0x2927f5,_0x24d6f4){return db[_0xb79f('0x2c')][_0xb79f('0x4a')](_0x2927f5[_0xb79f('0x4b')],{})[_0xb79f('0x26')](respondWithResult(_0x24d6f4,0xc9))[_0xb79f('0x45')](handleError(_0x24d6f4,null));};exports['update']=function(_0xf1a588,_0x49218b){if(_0xf1a588['body']['id']){delete _0xf1a588[_0xb79f('0x4b')]['id'];}return db['Automation']['find']({'where':{'id':_0xf1a588[_0xb79f('0x4c')]['id']}})[_0xb79f('0x26')](handleEntityNotFound(_0x49218b,null))[_0xb79f('0x26')](saveUpdates(_0xf1a588[_0xb79f('0x4b')],null))[_0xb79f('0x26')](respondWithResult(_0x49218b,null))[_0xb79f('0x45')](handleError(_0x49218b,null));};exports[_0xb79f('0x25')]=function(_0x970a66,_0x272f9c){return db[_0xb79f('0x2c')][_0xb79f('0x49')]({'where':{'id':_0x970a66[_0xb79f('0x4c')]['id']}})[_0xb79f('0x26')](handleEntityNotFound(_0x272f9c,null))[_0xb79f('0x26')](removeEntity(_0x272f9c,null))[_0xb79f('0x45')](handleError(_0x272f9c,null));};exports[_0xb79f('0x4d')]=function(_0x2e83b8,_0x3cb2b4,_0x228e85){return db['Condition'][_0xb79f('0x49')]({'where':{'id':_0x2e83b8[_0xb79f('0x4c')]['id']}})[_0xb79f('0x26')](handleEntityNotFound(_0x3cb2b4,null))[_0xb79f('0x26')](function(_0x5195c4){if(_0x5195c4){return _0x5195c4['addConditions'](_0x2e83b8[_0xb79f('0x4b')][_0xb79f('0x4e')],_['omit'](_0x2e83b8[_0xb79f('0x4b')],['ids','id'])||{});}})[_0xb79f('0x26')](respondWithResult(_0x3cb2b4,null))[_0xb79f('0x45')](handleError(_0x3cb2b4,null));};exports[_0xb79f('0x4f')]=function(_0x5d1940,_0x1d2e59,_0x5ea90a){var _0x4cca90={};var _0x4d059f={};var _0x582565;var _0x307312;return db['Automation'][_0xb79f('0x50')]({'where':{'id':_0x5d1940[_0xb79f('0x4c')]['id']}})[_0xb79f('0x26')](handleEntityNotFound(_0x1d2e59,null))[_0xb79f('0x26')](function(_0x3a31ab){if(_0x3a31ab){_0x582565=_0x3a31ab;_0x4d059f[_0xb79f('0x31')]=_['keys'](db['Condition'][_0xb79f('0x2d')]);_0x4d059f[_0xb79f('0x32')]=_[_0xb79f('0x33')](_0x5d1940[_0xb79f('0x32')]);_0x4d059f['filters']=_[_0xb79f('0x35')](_0x4d059f[_0xb79f('0x31')],_0x4d059f[_0xb79f('0x32')]);_0x4cca90[_0xb79f('0x36')]=_['intersection'](_0x4d059f[_0xb79f('0x31')],qs['fields'](_0x5d1940[_0xb79f('0x32')]['fields']));_0x4cca90[_0xb79f('0x36')]=_0x4cca90[_0xb79f('0x36')][_0xb79f('0x47')]?_0x4cca90[_0xb79f('0x36')]:_0x4d059f['model'];_0x4cca90['order']=qs['sort'](_0x5d1940[_0xb79f('0x32')]['sort']);_0x4cca90['where']=qs[_0xb79f('0x34')](_[_0xb79f('0x3e')](_0x5d1940['query'],_0x4d059f[_0xb79f('0x34')]));if(_0x5d1940[_0xb79f('0x32')][_0xb79f('0x3f')]){_0x4cca90[_0xb79f('0x3d')]=_['merge'](_0x4cca90[_0xb79f('0x3d')],{'$or':_['map'](_0x4cca90[_0xb79f('0x36')],function(_0x4a8479){var _0x4f9eca={};_0x4f9eca[_0x4a8479]={'$like':'%'+_0x5d1940[_0xb79f('0x32')]['filter']+'%'};return _0x4f9eca;})});}_0x4cca90=_[_0xb79f('0x40')]({},_0x4cca90,_0x5d1940[_0xb79f('0x42')]);return _0x582565[_0xb79f('0x4f')](_0x4cca90);}})['then'](function(_0x1e7ade){if(_0x1e7ade){_0x307312=_0x1e7ade['length'];if(!_0x5d1940[_0xb79f('0x32')][_0xb79f('0x38')]('nolimit')){_0x4cca90[_0xb79f('0x3a')]=qs[_0xb79f('0x3a')](_0x5d1940[_0xb79f('0x32')][_0xb79f('0x3a')]);_0x4cca90['offset']=qs[_0xb79f('0x1e')](_0x5d1940['query'][_0xb79f('0x1e')]);}return _0x582565[_0xb79f('0x4f')](_0x4cca90);}})[_0xb79f('0x26')](function(_0x1e716a){if(_0x1e716a){return _0x1e716a?{'count':_0x307312,'rows':_0x1e716a}:null;}})['then'](respondWithResult(_0x1d2e59,null))[_0xb79f('0x45')](handleError(_0x1d2e59,null));};exports[_0xb79f('0x51')]=function(_0x272f80,_0x5ec7a1,_0x13fe21){return db['Action'][_0xb79f('0x49')]({'where':{'id':_0x272f80['params']['id']}})[_0xb79f('0x26')](handleEntityNotFound(_0x5ec7a1,null))[_0xb79f('0x26')](function(_0x2e14ab){if(_0x2e14ab){return _0x2e14ab['addActions'](_0x272f80[_0xb79f('0x4b')][_0xb79f('0x4e')],_['omit'](_0x272f80[_0xb79f('0x4b')],[_0xb79f('0x4e'),'id'])||{});}})[_0xb79f('0x26')](respondWithResult(_0x5ec7a1,null))['catch'](handleError(_0x5ec7a1,null));};exports[_0xb79f('0x52')]=function(_0x58c21e,_0x4b8a4e,_0x177d31){var _0x2f5f5e={};var _0x250ee6={};var _0x2aa082;var _0x7d6482;return db['Automation'][_0xb79f('0x50')]({'where':{'id':_0x58c21e[_0xb79f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4b8a4e,null))[_0xb79f('0x26')](function(_0x464697){if(_0x464697){_0x2aa082=_0x464697;_0x250ee6['model']=_[_0xb79f('0x33')](db['Action'][_0xb79f('0x2d')]);_0x250ee6[_0xb79f('0x32')]=_['keys'](_0x58c21e['query']);_0x250ee6['filters']=_['intersection'](_0x250ee6[_0xb79f('0x31')],_0x250ee6[_0xb79f('0x32')]);_0x2f5f5e[_0xb79f('0x36')]=_[_0xb79f('0x35')](_0x250ee6[_0xb79f('0x31')],qs[_0xb79f('0x37')](_0x58c21e[_0xb79f('0x32')]['fields']));_0x2f5f5e[_0xb79f('0x36')]=_0x2f5f5e[_0xb79f('0x36')][_0xb79f('0x47')]?_0x2f5f5e[_0xb79f('0x36')]:_0x250ee6['model'];_0x2f5f5e[_0xb79f('0x3b')]=qs[_0xb79f('0x3c')](_0x58c21e[_0xb79f('0x32')][_0xb79f('0x3c')]);_0x2f5f5e['where']=qs[_0xb79f('0x34')](_[_0xb79f('0x3e')](_0x58c21e[_0xb79f('0x32')],_0x250ee6['filters']));if(_0x58c21e[_0xb79f('0x32')][_0xb79f('0x3f')]){_0x2f5f5e['where']=_[_0xb79f('0x40')](_0x2f5f5e[_0xb79f('0x3d')],{'$or':_[_0xb79f('0x2b')](_0x2f5f5e['attributes'],function(_0x43cd0b){var _0x5cf60b={};_0x5cf60b[_0x43cd0b]={'$like':'%'+_0x58c21e[_0xb79f('0x32')][_0xb79f('0x3f')]+'%'};return _0x5cf60b;})});}_0x2f5f5e=_[_0xb79f('0x40')]({},_0x2f5f5e,_0x58c21e[_0xb79f('0x42')]);return _0x2aa082[_0xb79f('0x52')](_0x2f5f5e);}})[_0xb79f('0x26')](function(_0xe55d0d){if(_0xe55d0d){_0x7d6482=_0xe55d0d['length'];if(!_0x58c21e[_0xb79f('0x32')]['hasOwnProperty'](_0xb79f('0x39'))){_0x2f5f5e[_0xb79f('0x3a')]=qs[_0xb79f('0x3a')](_0x58c21e['query'][_0xb79f('0x3a')]);_0x2f5f5e[_0xb79f('0x1e')]=qs[_0xb79f('0x1e')](_0x58c21e[_0xb79f('0x32')][_0xb79f('0x1e')]);}return _0x2aa082[_0xb79f('0x52')](_0x2f5f5e);}})['then'](function(_0x50b45b){if(_0x50b45b){return _0x50b45b?{'count':_0x7d6482,'rows':_0x50b45b}:null;}})[_0xb79f('0x26')](respondWithResult(_0x4b8a4e,null))[_0xb79f('0x45')](handleError(_0x4b8a4e,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 6a40118..f9a958f 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 _0x73ab=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','Automation','tools_automations','lodash','util'];(function(_0x45a8e5,_0x15cb21){var _0x5c3b72=function(_0x5a9a50){while(--_0x5a9a50){_0x45a8e5['push'](_0x45a8e5['shift']());}};_0x5c3b72(++_0x15cb21);}(_0x73ab,0x1b8));var _0xb73a=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x73ab[_0x176329];return _0x31997c;};'use strict';var _=require(_0xb73a('0x0'));var util=require(_0xb73a('0x1'));var logger=require(_0xb73a('0x2'))(_0xb73a('0x3'));var moment=require(_0xb73a('0x4'));var BPromise=require(_0xb73a('0x5'));var rp=require(_0xb73a('0x6'));var fs=require('fs');var path=require(_0xb73a('0x7'));var rimraf=require(_0xb73a('0x8'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0xb73a('0x9')]=function(_0x3bc4aa,_0x5c7b86){return _0x3bc4aa[_0xb73a('0xa')](_0xb73a('0xb'),attributes,{'tableName':_0xb73a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x455e=['tools_automations','../../config/logger','api','request-promise','path','rimraf','./automation.attributes','exports','define','Automation'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x455e,0x169));var _0xe455=function(_0x208d6d,_0x47f7b6){_0x208d6d=_0x208d6d-0x0;var _0x432519=_0x455e[_0x208d6d];return _0x432519;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe455('0x0'))(_0xe455('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe455('0x2'));var fs=require('fs');var path=require(_0xe455('0x3'));var rimraf=require(_0xe455('0x4'));var config=require('../../config/environment');var attributes=require(_0xe455('0x5'));module[_0xe455('0x6')]=function(_0x3f2f08,_0x4ab547){return _0x3f2f08[_0xe455('0x7')](_0xe455('0x8'),attributes,{'tableName':_0xe455('0x9'),'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 4ec3454..dcddc05 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 _0xd945=['debug','request\x20sent','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s'];(function(_0x11dc1a,_0x804361){var _0x5884d3=function(_0x2613c2){while(--_0x2613c2){_0x11dc1a['push'](_0x11dc1a['shift']());}};_0x5884d3(++_0x804361);}(_0xd945,0x84));var _0x5d94=function(_0x587267,_0x3372ee){_0x587267=_0x587267-0x0;var _0x1a4edd=_0xd945[_0x587267];return _0x1a4edd;};'use strict';var _=require(_0x5d94('0x0'));var util=require(_0x5d94('0x1'));var moment=require(_0x5d94('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d94('0x3'));var fs=require('fs');var Redis=require(_0x5d94('0x4'));var db=require(_0x5d94('0x5'))['db'];var utils=require(_0x5d94('0x6'));var logger=require(_0x5d94('0x7'))('rpc');var config=require(_0x5d94('0x8'));var jayson=require(_0x5d94('0x9'));var client=jayson[_0x5d94('0xa')][_0x5d94('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3635a6,_0x54af94,_0x430607){return new BPromise(function(_0x34fa30,_0x1117dc){return client['request'](_0x3635a6,_0x430607)[_0x5d94('0xc')](function(_0x3dd79e){logger[_0x5d94('0xd')](_0x5d94('0xe'),_0x54af94,'request\x20sent');logger[_0x5d94('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x54af94,_0x5d94('0x10'),JSON[_0x5d94('0x11')](_0x3dd79e));if(_0x3dd79e[_0x5d94('0x12')]){if(_0x3dd79e[_0x5d94('0x12')][_0x5d94('0x13')]===0x1f4){logger[_0x5d94('0x12')](_0x5d94('0xe'),_0x54af94,_0x3dd79e[_0x5d94('0x12')][_0x5d94('0x14')]);return _0x1117dc(_0x3dd79e[_0x5d94('0x12')]['message']);}logger[_0x5d94('0x12')](_0x5d94('0xe'),_0x54af94,_0x3dd79e['error'][_0x5d94('0x14')]);return _0x34fa30(_0x3dd79e[_0x5d94('0x12')][_0x5d94('0x14')]);}else{logger[_0x5d94('0xd')](_0x5d94('0xe'),_0x54af94,_0x5d94('0x10'));_0x34fa30(_0x3dd79e['result']['message']);}})['catch'](function(_0x38d3c7){logger[_0x5d94('0x12')](_0x5d94('0xe'),_0x54af94,_0x38d3c7);_0x1117dc(_0x38d3c7);});});} \ No newline at end of file +var _0x505d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','Automation,\x20%s,\x20%s','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3e8082,_0x481707){var _0x58794=function(_0x25fb94){while(--_0x25fb94){_0x3e8082['push'](_0x3e8082['shift']());}};_0x58794(++_0x481707);}(_0x505d,0x93));var _0xd505=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x505d[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd505('0x0'));var BPromise=require(_0xd505('0x1'));var rs=require(_0xd505('0x2'));var fs=require('fs');var Redis=require(_0xd505('0x3'));var db=require(_0xd505('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd505('0x5'))(_0xd505('0x6'));var config=require(_0xd505('0x7'));var jayson=require(_0xd505('0x8'));var client=jayson['client'][_0xd505('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d4f8d,_0x2bc4e7,_0x162ee2){return new BPromise(function(_0x543c42,_0x2abf26){return client[_0xd505('0xa')](_0x5d4f8d,_0x162ee2)['then'](function(_0x47b37a){logger[_0xd505('0xb')]('Automation,\x20%s,\x20%s',_0x2bc4e7,_0xd505('0xc'));logger['debug'](_0xd505('0xd'),_0x2bc4e7,'request\x20sent',JSON[_0xd505('0xe')](_0x47b37a));if(_0x47b37a['error']){if(_0x47b37a['error']['code']===0x1f4){logger[_0xd505('0xf')]('Automation,\x20%s,\x20%s',_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x2abf26(_0x47b37a['error']['message']);}logger[_0xd505('0xf')](_0xd505('0x11'),_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x543c42(_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);}else{logger[_0xd505('0xb')](_0xd505('0x11'),_0x2bc4e7,_0xd505('0xc'));_0x543c42(_0x47b37a['result'][_0xd505('0x10')]);}})[_0xd505('0x12')](function(_0x8013f2){logger['error'](_0xd505('0x11'),_0x2bc4e7,_0x8013f2);_0x2abf26(_0x8013f2);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 0026ff7..78f1c96 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 _0xb661=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','get','isAuthenticated','/:id','show','/:id/conditions','getConditions','getActions','post','create','addConditions','/:id/actions','addActions'];(function(_0x27d12a,_0x490795){var _0x2e6dfc=function(_0xc8e9ab){while(--_0xc8e9ab){_0x27d12a['push'](_0x27d12a['shift']());}};_0x2e6dfc(++_0x490795);}(_0xb661,0x1d0));var _0x1b66=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xb661[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x1b66('0x0'));var util=require(_0x1b66('0x1'));var path=require(_0x1b66('0x2'));var timeout=require(_0x1b66('0x3'));var express=require(_0x1b66('0x4'));var router=express[_0x1b66('0x5')]();var fs_extra=require(_0x1b66('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./automation.controller');router[_0x1b66('0x7')]('/',auth[_0x1b66('0x8')](),controller['index']);router[_0x1b66('0x7')](_0x1b66('0x9'),auth[_0x1b66('0x8')](),controller[_0x1b66('0xa')]);router[_0x1b66('0x7')](_0x1b66('0xb'),auth[_0x1b66('0x8')](),controller[_0x1b66('0xc')]);router[_0x1b66('0x7')]('/:id/actions',auth[_0x1b66('0x8')](),controller[_0x1b66('0xd')]);router[_0x1b66('0xe')]('/',auth[_0x1b66('0x8')](),controller[_0x1b66('0xf')]);router[_0x1b66('0xe')](_0x1b66('0xb'),auth[_0x1b66('0x8')](),controller[_0x1b66('0x10')]);router[_0x1b66('0xe')](_0x1b66('0x11'),auth[_0x1b66('0x8')](),controller[_0x1b66('0x12')]);router[_0x1b66('0x13')](_0x1b66('0x9'),auth[_0x1b66('0x8')](),controller[_0x1b66('0x14')]);router[_0x1b66('0x15')](_0x1b66('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x1b66('0x16')]=router; \ No newline at end of file +var _0x7bbd=['delete','destroy','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','getActions','create','post','put'];(function(_0x4ded50,_0x4a6af3){var _0xa92135=function(_0xe09b41){while(--_0xe09b41){_0x4ded50['push'](_0x4ded50['shift']());}};_0xa92135(++_0x4a6af3);}(_0x7bbd,0x11f));var _0xd7bb=function(_0x550ac7,_0x1b692e){_0x550ac7=_0x550ac7-0x0;var _0x18910b=_0x7bbd[_0x550ac7];return _0x18910b;};'use strict';var multer=require(_0xd7bb('0x0'));var util=require(_0xd7bb('0x1'));var path=require(_0xd7bb('0x2'));var timeout=require(_0xd7bb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd7bb('0x4'));var config=require(_0xd7bb('0x5'));var controller=require('./automation.controller');router[_0xd7bb('0x6')]('/',auth[_0xd7bb('0x7')](),controller[_0xd7bb('0x8')]);router[_0xd7bb('0x6')](_0xd7bb('0x9'),auth[_0xd7bb('0x7')](),controller[_0xd7bb('0xa')]);router[_0xd7bb('0x6')](_0xd7bb('0xb'),auth[_0xd7bb('0x7')](),controller['getConditions']);router[_0xd7bb('0x6')](_0xd7bb('0xc'),auth[_0xd7bb('0x7')](),controller[_0xd7bb('0xd')]);router['post']('/',auth[_0xd7bb('0x7')](),controller[_0xd7bb('0xe')]);router['post']('/:id/conditions',auth[_0xd7bb('0x7')](),controller['addConditions']);router[_0xd7bb('0xf')]('/:id/actions',auth[_0xd7bb('0x7')](),controller['addActions']);router[_0xd7bb('0x10')](_0xd7bb('0x9'),auth[_0xd7bb('0x7')](),controller['update']);router[_0xd7bb('0x11')]('/:id',auth[_0xd7bb('0x7')](),controller[_0xd7bb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 958de5f..2fdc62f 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 _0x69b6=['#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#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','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x23875f,_0x20a31e){var _0x973243=function(_0x3a48d1){while(--_0x3a48d1){_0x23875f['push'](_0x23875f['shift']());}};_0x973243(++_0x20a31e);}(_0x69b6,0xa3));var _0x669b=function(_0x10ff4c,_0x35c7e2){_0x10ff4c=_0x10ff4c-0x0;var _0x28bac8=_0x69b6[_0x10ff4c];return _0x28bac8;};'use strict';var Sequelize=require(_0x669b('0x0'));module[_0x669b('0x1')]={'name':{'type':Sequelize[_0x669b('0x2')],'unique':_0x669b('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x669b('0x4')](_0x669b('0x5')),'allowNull':![],'defaultValue':_0x669b('0x5')},'description':{'type':Sequelize[_0x669b('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x669b('0x6')},'limitCalls':{'type':Sequelize[_0x669b('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x669b('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x669b('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x669b('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x669b('0x7')](0x3)[_0x669b('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x669b('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x669b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x669b('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x669b('0x7')](0x5)[_0x669b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x669b('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x669b('0x7')](0x3)[_0x669b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x669b('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x669b('0x7')](0x5)[_0x669b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x669b('0x9')],'defaultValue':0x3,'comment':_0x669b('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x669b('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x669b('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x669b('0x10')},'dialTimezone':{'type':Sequelize[_0x669b('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x669b('0x2')],'defaultValue':_0x669b('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x669b('0x4')](_0x669b('0x12'),'never','onlyIfOpen'),'defaultValue':_0x669b('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x669b('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x669b('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x669b('0x7')](0x9)[_0x669b('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x669b('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x669b('0x7')](0x9)[_0x669b('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x669b('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x669b('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x669b('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x669b('0x7')](0x9)[_0x669b('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x669b('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x669b('0x7')](0x9)[_0x669b('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x669b('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x669b('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x669b('0x7')](0x5)[_0x669b('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x669b('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x669b('0x7')](0x9)[_0x669b('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x669b('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x669b('0x4')]('DESC',_0x669b('0x1b')),'defaultValue':_0x669b('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x669b('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x669b('0x1d')},'dialCutDigit':{'type':Sequelize[_0x669b('0x7')](0x3)[_0x669b('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x669b('0x7')](0x3)[_0x669b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x669b('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x669b('0x7')](0x5)[_0x669b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x669b('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x669b('0x7')](0x3)[_0x669b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x669b('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x669b('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x669b('0x7')](0x3)[_0x669b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x669b('0x7')](0x5)[_0x669b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x669b('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x669b('0x7')](0x3)[_0x669b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x669b('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x669b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x669b('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x669b('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x669b('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x669b('0x7')](0x5)[_0x669b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x669b('0x26')}}; \ No newline at end of file +var _0x8d87=['exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize'];(function(_0x2e6369,_0x385ab2){var _0x5b70ee=function(_0x4089dd){while(--_0x4089dd){_0x2e6369['push'](_0x2e6369['shift']());}};_0x5b70ee(++_0x385ab2);}(_0x8d87,0x1ac));var _0x78d8=function(_0x332d5c,_0x4a2336){_0x332d5c=_0x332d5c-0x0;var _0x47448d=_0x8d87[_0x332d5c];return _0x47448d;};'use strict';var Sequelize=require(_0x78d8('0x0'));module[_0x78d8('0x1')]={'name':{'type':Sequelize[_0x78d8('0x2')],'unique':_0x78d8('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x78d8('0x4')](_0x78d8('0x5')),'allowNull':![],'defaultValue':_0x78d8('0x5')},'description':{'type':Sequelize[_0x78d8('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x78d8('0x6')},'limitCalls':{'type':Sequelize[_0x78d8('0x7')](0x4)[_0x78d8('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x78d8('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x78d8('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x78d8('0x7')](0x3)[_0x78d8('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x78d8('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x78d8('0x7')](0x3)[_0x78d8('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x78d8('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x78d8('0x7')](0x5)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x78d8('0x7')](0x3)[_0x78d8('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x78d8('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x78d8('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x78d8('0x7')](0x5)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x78d8('0x7')](0x3)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x78d8('0x10')},'dialTimezone':{'type':Sequelize[_0x78d8('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x78d8('0x2')],'defaultValue':_0x78d8('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x78d8('0x4')](_0x78d8('0x12'),_0x78d8('0x13'),_0x78d8('0x14')),'defaultValue':_0x78d8('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x78d8('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x78d8('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x78d8('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x78d8('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x78d8('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x78d8('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x78d8('0x7')](0x9)[_0x78d8('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x78d8('0x7')](0x9)[_0x78d8('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x78d8('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x78d8('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x78d8('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x78d8('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x78d8('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x78d8('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x78d8('0x4')](_0x78d8('0x1d'),_0x78d8('0x1e')),'defaultValue':_0x78d8('0x1d')},'dialPrefix':{'type':Sequelize[_0x78d8('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x78d8('0x7')](0x3)[_0x78d8('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x78d8('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x78d8('0x7')](0x3)[_0x78d8('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x78d8('0x7')](0x5)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0x20')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x78d8('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x78d8('0x7')](0x3)[_0x78d8('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x78d8('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x78d8('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x78d8('0x7')](0x5)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x78d8('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x78d8('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x78d8('0x7')](0x5)[_0x78d8('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x78d8('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index a5adbf8..39f0e85 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 _0xae53=['fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','Campaign','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','getHoppers','findOne','CmHopper','order','CampaignId','getHopperHistories','CmHopperHistory','nolimit','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','ContactId','ListId','select','field','phone','scheduledAt','CmListId','toString','from','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','rawAttributes'];(function(_0x479746,_0x574758){var _0x36d2aa=function(_0x27e29d){while(--_0x27e29d){_0x479746['push'](_0x479746['shift']());}};_0x36d2aa(++_0x574758);}(_0xae53,0xf7));var _0x3ae5=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xae53[_0x243b59];return _0x3e1676;};'use strict';var emlformat=require(_0x3ae5('0x0'));var rimraf=require(_0x3ae5('0x1'));var zipdir=require(_0x3ae5('0x2'));var jsonpatch=require(_0x3ae5('0x3'));var rp=require('request-promise');var moment=require(_0x3ae5('0x4'));var BPromise=require(_0x3ae5('0x5'));var Mustache=require(_0x3ae5('0x6'));var util=require(_0x3ae5('0x7'));var path=require(_0x3ae5('0x8'));var sox=require(_0x3ae5('0x9'));var csv=require('to-csv');var ejs=require(_0x3ae5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ae5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3ae5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3ae5('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3ae5('0xe'));var authService=require(_0x3ae5('0xf'));var qs=require(_0x3ae5('0x10'));var as=require(_0x3ae5('0x11'));var hardwareService=require(_0x3ae5('0x12'));var logger=require(_0x3ae5('0x13'))('api');var utils=require(_0x3ae5('0x14'));var config=require(_0x3ae5('0x15'));var licenseUtil=require(_0x3ae5('0x16'));var db=require(_0x3ae5('0x17'))['db'];function respondWithStatusCode(_0x304a6c,_0x1236fa){_0x1236fa=_0x1236fa||0xcc;return function(_0x408bd5){if(_0x408bd5){return _0x304a6c[_0x3ae5('0x18')](_0x1236fa);}return _0x304a6c[_0x3ae5('0x19')](_0x1236fa)[_0x3ae5('0x1a')]();};}function respondWithResult(_0x1df2f4,_0x285229){_0x285229=_0x285229||0xc8;return function(_0x1fc10){if(_0x1fc10){return _0x1df2f4['status'](_0x285229)[_0x3ae5('0x1b')](_0x1fc10);}};}function respondWithFilteredResult(_0x38698c,_0x2351f8){return function(_0x12a04e){if(_0x12a04e){var _0x1f664f=typeof _0x2351f8[_0x3ae5('0x1c')]===_0x3ae5('0x1d')&&typeof _0x2351f8[_0x3ae5('0x1e')]===_0x3ae5('0x1d');var _0x1ef4b8=_0x12a04e[_0x3ae5('0x1f')];var _0x5c8e26=_0x1f664f?0x0:_0x2351f8[_0x3ae5('0x1c')];var _0x103de5=_0x1f664f?_0x12a04e[_0x3ae5('0x1f')]:_0x2351f8[_0x3ae5('0x1c')]+_0x2351f8[_0x3ae5('0x1e')];var _0x3afcff;if(_0x103de5>=_0x1ef4b8){_0x103de5=_0x1ef4b8;_0x3afcff=0xc8;}else{_0x3afcff=0xce;}_0x38698c[_0x3ae5('0x19')](_0x3afcff);return _0x38698c[_0x3ae5('0x20')](_0x3ae5('0x21'),_0x5c8e26+'-'+_0x103de5+'/'+_0x1ef4b8)[_0x3ae5('0x1b')](_0x12a04e);}return null;};}function patchUpdates(_0x495b34){return function(_0xa669c6){try{jsonpatch[_0x3ae5('0x22')](_0xa669c6,_0x495b34,!![]);}catch(_0x2eb57a){return BPromise['reject'](_0x2eb57a);}return _0xa669c6[_0x3ae5('0x23')]();};}function saveUpdates(_0x469aec,_0x124677){return function(_0x4ebe28){if(_0x4ebe28){return _0x4ebe28[_0x3ae5('0x24')](_0x469aec)[_0x3ae5('0x25')](function(_0xe8ae78){return _0xe8ae78;});}return null;};}function removeEntity(_0xe0a602,_0x25acba){return function(_0x16eed0){if(_0x16eed0){return _0x16eed0[_0x3ae5('0x26')]()[_0x3ae5('0x25')](function(){var _0x36f8bd=_0x16eed0[_0x3ae5('0x27')]({'plain':!![]});var _0x107dd6=_0x3ae5('0x28');return db[_0x3ae5('0x29')][_0x3ae5('0x26')]({'where':{'type':_0x107dd6,'resourceId':_0x36f8bd['id']}})[_0x3ae5('0x25')](function(){return _0x16eed0;});})[_0x3ae5('0x25')](function(){_0xe0a602['status'](0xcc)[_0x3ae5('0x1a')]();});}};}function handleEntityNotFound(_0x12497f,_0x3d0fbb){return function(_0x4e69da){if(!_0x4e69da){_0x12497f['sendStatus'](0x194);}return _0x4e69da;};}function handleError(_0x397fb3,_0x5159a4){_0x5159a4=_0x5159a4||0x1f4;return function(_0x11076f){logger[_0x3ae5('0x2a')](_0x11076f[_0x3ae5('0x2b')]);if(_0x11076f[_0x3ae5('0x2c')]){delete _0x11076f['name'];}_0x397fb3[_0x3ae5('0x19')](_0x5159a4)[_0x3ae5('0x2d')](_0x11076f);};}exports[_0x3ae5('0x2e')]=function(_0x3ff882,_0x170dde){var _0x51f3d9={},_0x3cd1d8={},_0x330d4e={'count':0x0,'rows':[]};var _0x2a090f=_[_0x3ae5('0x2f')](db['Campaign'][_0x3ae5('0x30')],function(_0x4e6241){return{'name':_0x4e6241[_0x3ae5('0x31')],'type':_0x4e6241[_0x3ae5('0x32')][_0x3ae5('0x33')]};});_0x3cd1d8[_0x3ae5('0x34')]=_[_0x3ae5('0x2f')](_0x2a090f,'name');_0x3cd1d8[_0x3ae5('0x35')]=_['keys'](_0x3ff882[_0x3ae5('0x35')]);_0x3cd1d8[_0x3ae5('0x36')]=_[_0x3ae5('0x37')](_0x3cd1d8[_0x3ae5('0x34')],_0x3cd1d8['query']);_0x51f3d9['attributes']=_[_0x3ae5('0x37')](_0x3cd1d8['model'],qs[_0x3ae5('0x38')](_0x3ff882[_0x3ae5('0x35')][_0x3ae5('0x38')]));_0x51f3d9[_0x3ae5('0x39')]=_0x51f3d9[_0x3ae5('0x39')][_0x3ae5('0x3a')]?_0x51f3d9[_0x3ae5('0x39')]:_0x3cd1d8['model'];if(!_0x3ff882[_0x3ae5('0x35')][_0x3ae5('0x3b')]('nolimit')){_0x51f3d9[_0x3ae5('0x1e')]=qs['limit'](_0x3ff882[_0x3ae5('0x35')][_0x3ae5('0x1e')]);_0x51f3d9[_0x3ae5('0x1c')]=qs[_0x3ae5('0x1c')](_0x3ff882['query'][_0x3ae5('0x1c')]);}_0x51f3d9['order']=qs['sort'](_0x3ff882[_0x3ae5('0x35')][_0x3ae5('0x3c')]);_0x51f3d9[_0x3ae5('0x3d')]=qs[_0x3ae5('0x36')](_[_0x3ae5('0x3e')](_0x3ff882['query'],_0x3cd1d8[_0x3ae5('0x36')]),_0x2a090f);if(_0x3ff882[_0x3ae5('0x35')][_0x3ae5('0x3f')]){_0x51f3d9[_0x3ae5('0x3d')]=_['merge'](_0x51f3d9[_0x3ae5('0x3d')],{'$or':_[_0x3ae5('0x2f')](_0x2a090f,function(_0x57fcc4){if(_0x57fcc4['type']!==_0x3ae5('0x40')){var _0x37d66f={};_0x37d66f[_0x57fcc4['name']]={'$like':'%'+_0x3ff882[_0x3ae5('0x35')][_0x3ae5('0x3f')]+'%'};return _0x37d66f;}})});}_0x51f3d9=_[_0x3ae5('0x41')]({},_0x51f3d9,_0x3ff882[_0x3ae5('0x42')]);var _0x29a186={'where':_0x51f3d9[_0x3ae5('0x3d')]};return db[_0x3ae5('0x43')]['count'](_0x29a186)[_0x3ae5('0x25')](function(_0x127131){_0x330d4e[_0x3ae5('0x1f')]=_0x127131;if(_0x3ff882[_0x3ae5('0x35')]['includeAll']){_0x51f3d9[_0x3ae5('0x44')]=[{'all':!![]}];}return db['Campaign'][_0x3ae5('0x45')](_0x51f3d9);})[_0x3ae5('0x25')](function(_0x3c3730){_0x330d4e[_0x3ae5('0x46')]=_0x3c3730;return _0x330d4e;})[_0x3ae5('0x25')](respondWithFilteredResult(_0x170dde,_0x51f3d9))[_0x3ae5('0x47')](handleError(_0x170dde,null));};exports[_0x3ae5('0x48')]=function(_0xab8bf6,_0x59d54e){var _0x5ba8e4={'raw':![],'where':{'id':_0xab8bf6[_0x3ae5('0x49')]['id']}},_0x2efb27={};_0x2efb27['model']=_[_0x3ae5('0x4a')](db[_0x3ae5('0x43')][_0x3ae5('0x30')]);_0x2efb27[_0x3ae5('0x35')]=_[_0x3ae5('0x4a')](_0xab8bf6[_0x3ae5('0x35')]);_0x2efb27[_0x3ae5('0x36')]=_[_0x3ae5('0x37')](_0x2efb27[_0x3ae5('0x34')],_0x2efb27[_0x3ae5('0x35')]);_0x5ba8e4['attributes']=_[_0x3ae5('0x37')](_0x2efb27['model'],qs[_0x3ae5('0x38')](_0xab8bf6[_0x3ae5('0x35')]['fields']));_0x5ba8e4[_0x3ae5('0x39')]=_0x5ba8e4[_0x3ae5('0x39')][_0x3ae5('0x3a')]?_0x5ba8e4[_0x3ae5('0x39')]:_0x2efb27['model'];if(_0xab8bf6[_0x3ae5('0x35')][_0x3ae5('0x4b')]){_0x5ba8e4['include']=[{'all':!![]}];}_0x5ba8e4=_['merge']({},_0x5ba8e4,_0xab8bf6[_0x3ae5('0x42')]);return db[_0x3ae5('0x43')][_0x3ae5('0x4c')](_0x5ba8e4)['then'](handleEntityNotFound(_0x59d54e,null))[_0x3ae5('0x25')](respondWithResult(_0x59d54e,null))[_0x3ae5('0x47')](handleError(_0x59d54e,null));};exports[_0x3ae5('0x4d')]=function(_0x4b9764,_0x453694){return db['Campaign'][_0x3ae5('0x4d')](_0x4b9764[_0x3ae5('0x4e')],{})[_0x3ae5('0x25')](function(_0x5e505){var _0x4aff4b=_0x4b9764[_0x3ae5('0x4f')][_0x3ae5('0x27')]({'plain':!![]});if(!_0x4aff4b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4aff4b['role']==='user'){var _0x5dcf28=_0x5e505[_0x3ae5('0x27')]({'plain':!![]});var _0x5dbd97='IvrCampaigns';return db[_0x3ae5('0x50')][_0x3ae5('0x4c')]({'where':{'name':_0x5dbd97,'userProfileId':_0x4aff4b[_0x3ae5('0x51')]},'raw':!![]})[_0x3ae5('0x25')](function(_0x31e74d){if(_0x31e74d&&_0x31e74d['autoAssociation']===0x0){return db['UserProfileResource'][_0x3ae5('0x4d')]({'name':_0x5dcf28[_0x3ae5('0x2c')],'resourceId':_0x5dcf28['id'],'type':_0x31e74d[_0x3ae5('0x2c')],'sectionId':_0x31e74d['id']},{})[_0x3ae5('0x25')](function(){return _0x5e505;});}else{return _0x5e505;}})['catch'](function(_0x4217bb){logger[_0x3ae5('0x2a')](_0x3ae5('0x52'),_0x4217bb);throw _0x4217bb;});}return _0x5e505;})[_0x3ae5('0x25')](respondWithResult(_0x453694,0xc9))[_0x3ae5('0x47')](handleError(_0x453694,null));};exports['clone']=function(_0x364985,_0x280d44){var _0x46f075={'where':{'id':_0x364985['params']['id']}},_0x5438b6={};_0x5438b6['model']=_['keys'](db['Campaign'][_0x3ae5('0x30')]);_0x46f075[_0x3ae5('0x39')]=_[_0x3ae5('0x37')](_0x5438b6[_0x3ae5('0x34')],qs[_0x3ae5('0x38')](_0x364985[_0x3ae5('0x35')][_0x3ae5('0x38')]));_0x46f075['attributes']=_0x46f075[_0x3ae5('0x39')][_0x3ae5('0x3a')]?_0x46f075[_0x3ae5('0x39')]:_0x5438b6[_0x3ae5('0x34')];if(_0x364985[_0x3ae5('0x35')]['includeAll']){_0x46f075[_0x3ae5('0x44')]=[{'all':!![]}];}_0x46f075=_[_0x3ae5('0x41')]({},_0x46f075,_0x364985['options']);return db['Campaign']['find'](_0x46f075)[_0x3ae5('0x25')](handleEntityNotFound(_0x280d44,null))[_0x3ae5('0x25')](function(_0x3cbbcc){if(_0x3cbbcc){var _0xd75a3=_0x3cbbcc['get']({'plain':!![]});_0xd75a3=qs['omit'](_0xd75a3,['id',_0x3ae5('0x53'),_0x3ae5('0x54')]);_0x364985['body']=_[_0x3ae5('0x55')](_0x364985[_0x3ae5('0x4e')],['id',_0x3ae5('0x53'),_0x3ae5('0x54')]);return db[_0x3ae5('0x43')][_0x3ae5('0x4d')](_[_0x3ae5('0x41')](_0xd75a3,_0x364985['body']),{'include':_0x364985[_0x3ae5('0x35')][_0x3ae5('0x4b')]?[{'all':!![]}]:undefined})[_0x3ae5('0x25')](function(_0x3cfd3a){var _0x4b8676=_0x364985['user'][_0x3ae5('0x27')]({'plain':!![]});if(!_0x4b8676)throw new Error(_0x3ae5('0x56'));if(_0x4b8676[_0x3ae5('0x57')]==='user'){var _0xddc9cc=_0x3cfd3a[_0x3ae5('0x27')]({'plain':!![]});var _0x1cd0a4='IvrCampaigns';return db[_0x3ae5('0x50')][_0x3ae5('0x4c')]({'where':{'name':_0x1cd0a4,'userProfileId':_0x4b8676[_0x3ae5('0x51')]},'raw':!![]})[_0x3ae5('0x25')](function(_0x4c5c01){if(_0x4c5c01&&_0x4c5c01[_0x3ae5('0x58')]===0x0){return db[_0x3ae5('0x29')][_0x3ae5('0x4d')]({'name':_0xddc9cc[_0x3ae5('0x2c')],'resourceId':_0xddc9cc['id'],'type':_0x4c5c01[_0x3ae5('0x2c')],'sectionId':_0x4c5c01['id']},{})[_0x3ae5('0x25')](function(){return _0x3cfd3a;});}else{return _0x3cfd3a;}})['catch'](function(_0x39badd){logger[_0x3ae5('0x2a')](_0x3ae5('0x52'),_0x39badd);throw _0x39badd;});}return _0x3cfd3a;});}})[_0x3ae5('0x25')](respondWithResult(_0x280d44,0xc9))[_0x3ae5('0x47')](handleError(_0x280d44,null));};exports[_0x3ae5('0x24')]=function(_0x5e36fc,_0x4e91cd){if(_0x5e36fc[_0x3ae5('0x4e')]['id']){delete _0x5e36fc[_0x3ae5('0x4e')]['id'];}return db['Campaign']['find']({'where':{'id':_0x5e36fc[_0x3ae5('0x49')]['id']}})[_0x3ae5('0x25')](handleEntityNotFound(_0x4e91cd,null))[_0x3ae5('0x25')](saveUpdates(_0x5e36fc['body'],null))[_0x3ae5('0x25')](respondWithResult(_0x4e91cd,null))[_0x3ae5('0x47')](handleError(_0x4e91cd,null));};exports[_0x3ae5('0x26')]=function(_0x2c29c1,_0x2b41f2){return db[_0x3ae5('0x43')][_0x3ae5('0x4c')]({'where':{'id':_0x2c29c1['params']['id']}})[_0x3ae5('0x25')](handleEntityNotFound(_0x2b41f2,null))[_0x3ae5('0x25')](removeEntity(_0x2b41f2,null))[_0x3ae5('0x47')](handleError(_0x2b41f2,null));};exports[_0x3ae5('0x59')]=function(_0x2bddc2,_0x21d2b0,_0x46e1ce){var _0x305ece={'raw':!![],'where':{}};var _0x427fea={};var _0x5f0d13={'count':0x0,'rows':[]};return db[_0x3ae5('0x43')][_0x3ae5('0x5a')]({'where':{'id':_0x2bddc2[_0x3ae5('0x49')]['id']}})['then'](handleEntityNotFound(_0x21d2b0,null))['then'](function(_0x49110d){if(_0x49110d){_0x427fea['model']=_[_0x3ae5('0x4a')](db[_0x3ae5('0x5b')][_0x3ae5('0x30')]);_0x427fea[_0x3ae5('0x35')]=_[_0x3ae5('0x4a')](_0x2bddc2[_0x3ae5('0x35')]);_0x427fea[_0x3ae5('0x36')]=_[_0x3ae5('0x37')](_0x427fea[_0x3ae5('0x34')],_0x427fea[_0x3ae5('0x35')]);_0x305ece['attributes']=_[_0x3ae5('0x37')](_0x427fea[_0x3ae5('0x34')],qs[_0x3ae5('0x38')](_0x2bddc2[_0x3ae5('0x35')][_0x3ae5('0x38')]));_0x305ece[_0x3ae5('0x39')]=_0x305ece[_0x3ae5('0x39')]['length']?_0x305ece[_0x3ae5('0x39')]:_0x427fea[_0x3ae5('0x34')];if(!_0x2bddc2[_0x3ae5('0x35')][_0x3ae5('0x3b')]('nolimit')){_0x305ece[_0x3ae5('0x1e')]=qs[_0x3ae5('0x1e')](_0x2bddc2[_0x3ae5('0x35')][_0x3ae5('0x1e')]);_0x305ece[_0x3ae5('0x1c')]=qs[_0x3ae5('0x1c')](_0x2bddc2[_0x3ae5('0x35')]['offset']);}_0x305ece[_0x3ae5('0x5c')]=qs[_0x3ae5('0x3c')](_0x2bddc2['query'][_0x3ae5('0x3c')]);_0x305ece['where']=qs[_0x3ae5('0x36')](_[_0x3ae5('0x3e')](_0x2bddc2[_0x3ae5('0x35')],_0x427fea[_0x3ae5('0x36')]));_0x305ece[_0x3ae5('0x3d')][_0x3ae5('0x5d')]=_0x49110d['id'];if(_0x2bddc2[_0x3ae5('0x35')]['filter']){_0x305ece[_0x3ae5('0x3d')]=_[_0x3ae5('0x41')](_0x305ece['where'],{'$or':_[_0x3ae5('0x2f')](_0x305ece[_0x3ae5('0x39')],function(_0x331eca){var _0x3ed9be={};_0x3ed9be[_0x331eca]={'$like':'%'+_0x2bddc2[_0x3ae5('0x35')][_0x3ae5('0x3f')]+'%'};return _0x3ed9be;})});}_0x305ece=_['merge']({},_0x305ece,_0x2bddc2[_0x3ae5('0x42')]);return db[_0x3ae5('0x5b')]['count']({'where':_0x305ece[_0x3ae5('0x3d')]})['then'](function(_0x32ff5b){_0x5f0d13[_0x3ae5('0x1f')]=_0x32ff5b;if(_0x2bddc2['query'][_0x3ae5('0x4b')]){_0x305ece[_0x3ae5('0x44')]=[{'all':!![]}];}return db['CmHopper'][_0x3ae5('0x45')](_0x305ece);})['then'](function(_0x368193){_0x5f0d13[_0x3ae5('0x46')]=_0x368193;return _0x5f0d13;});}})[_0x3ae5('0x25')](respondWithFilteredResult(_0x21d2b0,_0x305ece))[_0x3ae5('0x47')](handleError(_0x21d2b0,null));};exports[_0x3ae5('0x5e')]=function(_0x4bdb86,_0x1d9398,_0x4cb9a3){var _0x38e458={'raw':!![],'where':{}};var _0x28f424={};var _0x7587e4={'count':0x0,'rows':[]};return db[_0x3ae5('0x43')]['findOne']({'where':{'id':_0x4bdb86[_0x3ae5('0x49')]['id']}})['then'](handleEntityNotFound(_0x1d9398,null))[_0x3ae5('0x25')](function(_0x1e529a){if(_0x1e529a){_0x28f424['model']=_[_0x3ae5('0x4a')](db[_0x3ae5('0x5f')][_0x3ae5('0x30')]);_0x28f424['query']=_[_0x3ae5('0x4a')](_0x4bdb86['query']);_0x28f424[_0x3ae5('0x36')]=_[_0x3ae5('0x37')](_0x28f424[_0x3ae5('0x34')],_0x28f424[_0x3ae5('0x35')]);_0x38e458['attributes']=_[_0x3ae5('0x37')](_0x28f424[_0x3ae5('0x34')],qs[_0x3ae5('0x38')](_0x4bdb86['query'][_0x3ae5('0x38')]));_0x38e458[_0x3ae5('0x39')]=_0x38e458[_0x3ae5('0x39')][_0x3ae5('0x3a')]?_0x38e458[_0x3ae5('0x39')]:_0x28f424[_0x3ae5('0x34')];if(!_0x4bdb86['query'][_0x3ae5('0x3b')](_0x3ae5('0x60'))){_0x38e458['limit']=qs[_0x3ae5('0x1e')](_0x4bdb86['query'][_0x3ae5('0x1e')]);_0x38e458[_0x3ae5('0x1c')]=qs[_0x3ae5('0x1c')](_0x4bdb86['query'][_0x3ae5('0x1c')]);}_0x38e458[_0x3ae5('0x5c')]=qs[_0x3ae5('0x3c')](_0x4bdb86['query'][_0x3ae5('0x3c')]);_0x38e458[_0x3ae5('0x3d')]=qs[_0x3ae5('0x36')](_[_0x3ae5('0x3e')](_0x4bdb86[_0x3ae5('0x35')],_0x28f424[_0x3ae5('0x36')]));_0x38e458[_0x3ae5('0x3d')][_0x3ae5('0x5d')]=_0x1e529a['id'];if(_0x4bdb86['query'][_0x3ae5('0x3f')]){_0x38e458['where']=_[_0x3ae5('0x41')](_0x38e458[_0x3ae5('0x3d')],{'$or':_[_0x3ae5('0x2f')](_0x38e458[_0x3ae5('0x39')],function(_0x3c1a6c){var _0xe444b={};_0xe444b[_0x3c1a6c]={'$like':'%'+_0x4bdb86[_0x3ae5('0x35')][_0x3ae5('0x3f')]+'%'};return _0xe444b;})});}_0x38e458=_[_0x3ae5('0x41')]({},_0x38e458,_0x4bdb86[_0x3ae5('0x42')]);return db[_0x3ae5('0x5f')][_0x3ae5('0x1f')]({'where':_0x38e458[_0x3ae5('0x3d')]})['then'](function(_0x5d3446){_0x7587e4[_0x3ae5('0x1f')]=_0x5d3446;if(_0x4bdb86[_0x3ae5('0x35')][_0x3ae5('0x4b')]){_0x38e458[_0x3ae5('0x44')]=[{'all':!![]}];}return db[_0x3ae5('0x5f')][_0x3ae5('0x45')](_0x38e458);})['then'](function(_0x14e95f){_0x7587e4[_0x3ae5('0x46')]=_0x14e95f;return _0x7587e4;});}})[_0x3ae5('0x25')](respondWithFilteredResult(_0x1d9398,_0x38e458))[_0x3ae5('0x47')](handleError(_0x1d9398,null));};exports[_0x3ae5('0x61')]=function(_0x31e5e8,_0x921120,_0x3c6933){var _0x1c5bc2={'raw':!![],'where':{}};var _0x5155cf={};var _0x1c8578={'count':0x0,'rows':[]};return db[_0x3ae5('0x43')]['findOne']({'where':{'id':_0x31e5e8[_0x3ae5('0x49')]['id']}})['then'](handleEntityNotFound(_0x921120,null))[_0x3ae5('0x25')](function(_0x5601a7){if(_0x5601a7){_0x5155cf[_0x3ae5('0x34')]=_['keys'](db[_0x3ae5('0x62')][_0x3ae5('0x30')]);_0x5155cf[_0x3ae5('0x35')]=_['keys'](_0x31e5e8['query']);_0x5155cf[_0x3ae5('0x36')]=_[_0x3ae5('0x37')](_0x5155cf[_0x3ae5('0x34')],_0x5155cf[_0x3ae5('0x35')]);_0x1c5bc2[_0x3ae5('0x39')]=_['intersection'](_0x5155cf[_0x3ae5('0x34')],qs[_0x3ae5('0x38')](_0x31e5e8[_0x3ae5('0x35')]['fields']));_0x1c5bc2[_0x3ae5('0x39')]=_0x1c5bc2['attributes'][_0x3ae5('0x3a')]?_0x1c5bc2[_0x3ae5('0x39')]:_0x5155cf['model'];if(!_0x31e5e8['query']['hasOwnProperty'](_0x3ae5('0x60'))){_0x1c5bc2[_0x3ae5('0x1e')]=qs[_0x3ae5('0x1e')](_0x31e5e8[_0x3ae5('0x35')]['limit']);_0x1c5bc2[_0x3ae5('0x1c')]=qs[_0x3ae5('0x1c')](_0x31e5e8[_0x3ae5('0x35')]['offset']);}_0x1c5bc2[_0x3ae5('0x5c')]=qs[_0x3ae5('0x3c')](_0x31e5e8[_0x3ae5('0x35')][_0x3ae5('0x3c')]);_0x1c5bc2[_0x3ae5('0x3d')]=qs[_0x3ae5('0x36')](_[_0x3ae5('0x3e')](_0x31e5e8[_0x3ae5('0x35')],_0x5155cf[_0x3ae5('0x36')]));_0x1c5bc2[_0x3ae5('0x3d')]['CampaignId']=_0x5601a7['id'];if(_0x31e5e8['query'][_0x3ae5('0x3f')]){_0x1c5bc2[_0x3ae5('0x3d')]=_[_0x3ae5('0x41')](_0x1c5bc2[_0x3ae5('0x3d')],{'$or':_['map'](_0x1c5bc2[_0x3ae5('0x39')],function(_0x590dbf){var _0x5f2361={};_0x5f2361[_0x590dbf]={'$like':'%'+_0x31e5e8[_0x3ae5('0x35')][_0x3ae5('0x3f')]+'%'};return _0x5f2361;})});}_0x1c5bc2=_[_0x3ae5('0x41')]({},_0x1c5bc2,_0x31e5e8[_0x3ae5('0x42')]);return db[_0x3ae5('0x62')][_0x3ae5('0x1f')]({'where':_0x1c5bc2[_0x3ae5('0x3d')]})[_0x3ae5('0x25')](function(_0x8277bf){_0x1c8578[_0x3ae5('0x1f')]=_0x8277bf;if(_0x31e5e8[_0x3ae5('0x35')][_0x3ae5('0x4b')]){_0x1c5bc2[_0x3ae5('0x44')]=[{'all':!![]}];}return db[_0x3ae5('0x62')][_0x3ae5('0x45')](_0x1c5bc2);})[_0x3ae5('0x25')](function(_0x46f305){_0x1c8578[_0x3ae5('0x46')]=_0x46f305;return _0x1c8578;});}})[_0x3ae5('0x25')](respondWithFilteredResult(_0x921120,_0x1c5bc2))[_0x3ae5('0x47')](handleError(_0x921120,null));};exports[_0x3ae5('0x63')]=function(_0x303c70,_0x752a42,_0x50b098){var _0x1f61f1={'raw':!![],'where':{}};var _0xf2af63={};var _0x554c5c={'count':0x0,'rows':[]};return db['Campaign'][_0x3ae5('0x5a')]({'where':{'id':_0x303c70['params']['id']}})['then'](handleEntityNotFound(_0x752a42,null))[_0x3ae5('0x25')](function(_0x553064){if(_0x553064){_0xf2af63['model']=_['keys'](db[_0x3ae5('0x64')]['rawAttributes']);_0xf2af63[_0x3ae5('0x35')]=_[_0x3ae5('0x4a')](_0x303c70['query']);_0xf2af63[_0x3ae5('0x36')]=_['intersection'](_0xf2af63[_0x3ae5('0x34')],_0xf2af63[_0x3ae5('0x35')]);_0x1f61f1[_0x3ae5('0x39')]=_['intersection'](_0xf2af63[_0x3ae5('0x34')],qs[_0x3ae5('0x38')](_0x303c70[_0x3ae5('0x35')][_0x3ae5('0x38')]));_0x1f61f1[_0x3ae5('0x39')]=_0x1f61f1[_0x3ae5('0x39')][_0x3ae5('0x3a')]?_0x1f61f1[_0x3ae5('0x39')]:_0xf2af63[_0x3ae5('0x34')];if(!_0x303c70[_0x3ae5('0x35')][_0x3ae5('0x3b')](_0x3ae5('0x60'))){_0x1f61f1[_0x3ae5('0x1e')]=qs[_0x3ae5('0x1e')](_0x303c70[_0x3ae5('0x35')]['limit']);_0x1f61f1[_0x3ae5('0x1c')]=qs[_0x3ae5('0x1c')](_0x303c70[_0x3ae5('0x35')][_0x3ae5('0x1c')]);}_0x1f61f1[_0x3ae5('0x5c')]=qs[_0x3ae5('0x3c')](_0x303c70[_0x3ae5('0x35')]['sort']);_0x1f61f1['where']=qs['filters'](_[_0x3ae5('0x3e')](_0x303c70[_0x3ae5('0x35')],_0xf2af63[_0x3ae5('0x36')]));_0x1f61f1[_0x3ae5('0x3d')][_0x3ae5('0x5d')]=_0x553064['id'];if(_0x303c70[_0x3ae5('0x35')][_0x3ae5('0x3f')]){_0x1f61f1[_0x3ae5('0x3d')]=_[_0x3ae5('0x41')](_0x1f61f1[_0x3ae5('0x3d')],{'$or':_[_0x3ae5('0x2f')](_0x1f61f1[_0x3ae5('0x39')],function(_0x4812b1){var _0x59dc8f={};_0x59dc8f[_0x4812b1]={'$like':'%'+_0x303c70['query'][_0x3ae5('0x3f')]+'%'};return _0x59dc8f;})});}_0x1f61f1=_[_0x3ae5('0x41')]({},_0x1f61f1,_0x303c70[_0x3ae5('0x42')]);return db[_0x3ae5('0x64')][_0x3ae5('0x1f')]({'where':_0x1f61f1[_0x3ae5('0x3d')]})['then'](function(_0x30474b){_0x554c5c['count']=_0x30474b;if(_0x303c70[_0x3ae5('0x35')][_0x3ae5('0x4b')]){_0x1f61f1['include']=[{'all':!![]}];}return db[_0x3ae5('0x64')][_0x3ae5('0x45')](_0x1f61f1);})[_0x3ae5('0x25')](function(_0x5c7a2a){_0x554c5c['rows']=_0x5c7a2a;return _0x554c5c;});}})[_0x3ae5('0x25')](respondWithFilteredResult(_0x752a42,_0x1f61f1))[_0x3ae5('0x47')](handleError(_0x752a42,null));};exports['getLists']=function(_0x20d98e,_0x3b01b7,_0x1cb770){var _0x58edb0={};var _0x3c14a3={};var _0x382b14;var _0x12b4e8;return db['Campaign']['findOne']({'where':{'id':_0x20d98e[_0x3ae5('0x49')]['id']}})['then'](handleEntityNotFound(_0x3b01b7,null))[_0x3ae5('0x25')](function(_0x2acd6e){if(_0x2acd6e){_0x382b14=_0x2acd6e;_0x3c14a3['model']=_[_0x3ae5('0x4a')](db[_0x3ae5('0x65')][_0x3ae5('0x30')]);_0x3c14a3[_0x3ae5('0x35')]=_[_0x3ae5('0x4a')](_0x20d98e[_0x3ae5('0x35')]);_0x3c14a3[_0x3ae5('0x36')]=_[_0x3ae5('0x37')](_0x3c14a3[_0x3ae5('0x34')],_0x3c14a3[_0x3ae5('0x35')]);_0x58edb0['attributes']=_[_0x3ae5('0x37')](_0x3c14a3['model'],qs[_0x3ae5('0x38')](_0x20d98e['query'][_0x3ae5('0x38')]));_0x58edb0[_0x3ae5('0x39')]=_0x58edb0[_0x3ae5('0x39')][_0x3ae5('0x3a')]?_0x58edb0[_0x3ae5('0x39')]:_0x3c14a3[_0x3ae5('0x34')];_0x58edb0['order']=qs['sort'](_0x20d98e[_0x3ae5('0x35')][_0x3ae5('0x3c')]);_0x58edb0[_0x3ae5('0x3d')]=qs[_0x3ae5('0x36')](_[_0x3ae5('0x3e')](_0x20d98e[_0x3ae5('0x35')],_0x3c14a3[_0x3ae5('0x36')]));if(_0x20d98e['query'][_0x3ae5('0x3f')]){_0x58edb0[_0x3ae5('0x3d')]=_['merge'](_0x58edb0['where'],{'$or':_[_0x3ae5('0x2f')](_0x58edb0[_0x3ae5('0x39')],function(_0x186af0){var _0x254c39={};_0x254c39[_0x186af0]={'$like':'%'+_0x20d98e[_0x3ae5('0x35')][_0x3ae5('0x3f')]+'%'};return _0x254c39;})});}_0x58edb0=_[_0x3ae5('0x41')]({},_0x58edb0,_0x20d98e[_0x3ae5('0x42')]);return _0x382b14['getLists'](_0x58edb0);}})[_0x3ae5('0x25')](function(_0x158663){if(_0x158663){_0x12b4e8=_0x158663[_0x3ae5('0x3a')];if(!_0x20d98e['query'][_0x3ae5('0x3b')](_0x3ae5('0x60'))){_0x58edb0['limit']=qs['limit'](_0x20d98e[_0x3ae5('0x35')][_0x3ae5('0x1e')]);_0x58edb0[_0x3ae5('0x1c')]=qs['offset'](_0x20d98e[_0x3ae5('0x35')][_0x3ae5('0x1c')]);}return _0x382b14['getLists'](_0x58edb0);}})[_0x3ae5('0x25')](function(_0xd57790){if(_0xd57790){return _0xd57790?{'count':_0x12b4e8,'rows':_0xd57790}:null;}})[_0x3ae5('0x25')](respondWithResult(_0x3b01b7,null))[_0x3ae5('0x47')](handleError(_0x3b01b7,null));};exports[_0x3ae5('0x66')]=function(_0x2bfb90,_0x495e7b,_0x4f6d62){var _0x523de7,_0x274b06;var _0x308320=[];var _0x3c2e15=moment()[_0x3ae5('0x67')](_0x3ae5('0x68'));return db[_0x3ae5('0x43')][_0x3ae5('0x4c')]({'where':{'id':_0x2bfb90[_0x3ae5('0x49')]['id']}})[_0x3ae5('0x25')](handleEntityNotFound(_0x495e7b,null))[_0x3ae5('0x25')](function(_0x20b106){if(_0x20b106){_0x274b06=_0x20b106;return _0x20b106[_0x3ae5('0x66')](_0x2bfb90['body'][_0x3ae5('0x69')],_['omit'](_0x2bfb90[_0x3ae5('0x4e')],[_0x3ae5('0x69'),'id'])||{});}return null;})[_0x3ae5('0x6a')](function(_0x3e695a){var _0x10b140;var _0x5c0c77;_0x523de7=_0x3e695a||[];var _0x2cda61=[];if(_0x3e695a){for(var _0x361eab=0x0;_0x361eab<_0x3e695a[_0x3ae5('0x3a')];_0x361eab+=0x1){var _0x52d23a=_0x3e695a[_0x361eab][_0x3ae5('0x27')]({'plain':!![]});_0x274b06[_0x3ae5('0x6b')]=_0x2bfb90[_0x3ae5('0x4e')][_0x3ae5('0x6b')]?_0x2bfb90['body'][_0x3ae5('0x6b')]:_0x274b06[_0x3ae5('0x6b')];switch(_0x274b06[_0x3ae5('0x6b')]){case _0x3ae5('0x6c'):_0x10b140=squel[_0x3ae5('0x6d')]()[_0x3ae5('0x6e')]('cm_hopper')[_0x3ae5('0x6f')](['phone','scheduledAt',_0x3ae5('0x70'),_0x3ae5('0x71'),_0x3ae5('0x5d'),_0x3ae5('0x53'),_0x3ae5('0x54')],squel[_0x3ae5('0x72')]()[_0x3ae5('0x73')](_0x3ae5('0x74'),_0x3ae5('0x74'))['field']('NOW()',_0x3ae5('0x75'))[_0x3ae5('0x73')]('id',_0x3ae5('0x70'))['field'](_0x52d23a[_0x3ae5('0x76')][_0x3ae5('0x77')](),'ListId')[_0x3ae5('0x73')](_0x2bfb90[_0x3ae5('0x49')]['id'][_0x3ae5('0x77')](),'CampaignId')[_0x3ae5('0x73')]('\x27'+_0x3c2e15+'\x27',_0x3ae5('0x53'))[_0x3ae5('0x73')]('\x27'+_0x3c2e15+'\x27','updatedAt')[_0x3ae5('0x78')]('cm_contacts')[_0x3ae5('0x3d')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x52d23a[_0x3ae5('0x76')][_0x3ae5('0x77')]())[_0x3ae5('0x3d')](_0x3ae5('0x79'))[_0x3ae5('0x3d')](_0x3ae5('0x7a'),squel[_0x3ae5('0x72')]()[_0x3ae5('0x73')](_0x3ae5('0x7b'))[_0x3ae5('0x78')]('cm_hopper_final')[_0x3ae5('0x3d')]('CampaignId\x20=\x20?',_0x2bfb90[_0x3ae5('0x49')]['id'][_0x3ae5('0x77')]()))[_0x3ae5('0x3d')](_0x3ae5('0x7a'),squel[_0x3ae5('0x72')]()[_0x3ae5('0x73')](_0x3ae5('0x7c'))['from'](_0x3ae5('0x7d'))['where'](_0x3ae5('0x7e'),_0x2bfb90[_0x3ae5('0x49')]['id'][_0x3ae5('0x77')]())))[_0x3ae5('0x77')]();break;case _0x3ae5('0x7f'):_0x10b140=squel[_0x3ae5('0x6d')]()[_0x3ae5('0x6e')]('cm_hopper')[_0x3ae5('0x6f')]([_0x3ae5('0x74'),'scheduledAt','ContactId',_0x3ae5('0x71'),'CampaignId',_0x3ae5('0x53'),_0x3ae5('0x54')],squel[_0x3ae5('0x72')]()[_0x3ae5('0x73')](_0x3ae5('0x74'),_0x3ae5('0x74'))[_0x3ae5('0x73')](_0x3ae5('0x80'),'scheduledAt')[_0x3ae5('0x73')]('id',_0x3ae5('0x70'))['field'](_0x52d23a[_0x3ae5('0x76')][_0x3ae5('0x77')](),'ListId')['field'](_0x2bfb90['params']['id'][_0x3ae5('0x77')](),_0x3ae5('0x5d'))['field']('\x27'+_0x3c2e15+'\x27','createdAt')['field']('\x27'+_0x3c2e15+'\x27','updatedAt')['from'](_0x3ae5('0x81'))['where'](_0x3ae5('0x82'))[_0x3ae5('0x3d')](_0x3ae5('0x83'),_0x52d23a['CmListId'][_0x3ae5('0x77')]())[_0x3ae5('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x3ae5('0x3d')](_0x3ae5('0x7a'),squel[_0x3ae5('0x72')]()[_0x3ae5('0x73')](_0x3ae5('0x7c'))[_0x3ae5('0x78')](_0x3ae5('0x7d'))[_0x3ae5('0x3d')](_0x3ae5('0x7e'),_0x2bfb90[_0x3ae5('0x49')]['id'][_0x3ae5('0x77')]())))[_0x3ae5('0x77')]();break;default:_0x10b140=squel[_0x3ae5('0x6d')]()[_0x3ae5('0x6e')](_0x3ae5('0x7d'))[_0x3ae5('0x6f')]([_0x3ae5('0x74'),'scheduledAt','ContactId',_0x3ae5('0x71'),_0x3ae5('0x5d'),'createdAt',_0x3ae5('0x54')],squel['select']()[_0x3ae5('0x73')]('phone',_0x3ae5('0x74'))['field'](_0x3ae5('0x80'),_0x3ae5('0x75'))[_0x3ae5('0x73')]('id',_0x3ae5('0x70'))[_0x3ae5('0x73')](_0x52d23a[_0x3ae5('0x76')]['toString'](),_0x3ae5('0x71'))[_0x3ae5('0x73')](_0x2bfb90[_0x3ae5('0x49')]['id'][_0x3ae5('0x77')](),'CampaignId')['field']('\x27'+_0x3c2e15+'\x27','createdAt')[_0x3ae5('0x73')]('\x27'+_0x3c2e15+'\x27',_0x3ae5('0x54'))[_0x3ae5('0x78')](_0x3ae5('0x81'))[_0x3ae5('0x3d')]('deletedAt\x20IS\x20NULL')[_0x3ae5('0x3d')]('ListId\x20=\x20?',_0x52d23a[_0x3ae5('0x76')][_0x3ae5('0x77')]())[_0x3ae5('0x3d')](_0x3ae5('0x79')))[_0x3ae5('0x77')]();}_0x5c0c77=squel['insert']()[_0x3ae5('0x6e')](_0x3ae5('0x84'))['fromQuery']([_0x3ae5('0x85'),_0x3ae5('0x75'),_0x3ae5('0x74'),_0x3ae5('0x86'),_0x3ae5('0x53'),'updatedAt'],squel[_0x3ae5('0x72')]()[_0x3ae5('0x73')](_0x3ae5('0x87'),'id')[_0x3ae5('0x73')](_0x3ae5('0x80'),_0x3ae5('0x75'))[_0x3ae5('0x73')]('ci.item','phone')[_0x3ae5('0x73')](_0x3ae5('0x88'),'OrderBy')[_0x3ae5('0x73')]('\x27'+_0x3c2e15+'\x27','createdAt')[_0x3ae5('0x73')]('\x27'+_0x3c2e15+'\x27','updatedAt')[_0x3ae5('0x78')](_0x3ae5('0x89'),'ci')['join']('cm_hopper','h',_0x3ae5('0x8a'))[_0x3ae5('0x3d')](_0x3ae5('0x8b'),_0x52d23a[_0x3ae5('0x76')]['toString']())['where'](_0x3ae5('0x8c'),_0x2bfb90[_0x3ae5('0x49')]['id'][_0x3ae5('0x77')]())[_0x3ae5('0x3d')]('h.createdAt\x20=\x20?',_0x3c2e15))['toString']();_0x2cda61['push'](db[_0x3ae5('0x8d')][_0x3ae5('0x35')](_0x10b140));_0x308320['push'](db[_0x3ae5('0x8d')][_0x3ae5('0x35')](_0x5c0c77));}return BPromise[_0x3ae5('0x8e')](_0x2cda61);}})['then'](function(){return BPromise['all'](_0x308320);})['then'](function(){return _0x523de7;})[_0x3ae5('0x25')](respondWithResult(_0x495e7b,null))['catch'](handleError(_0x495e7b,null));};exports['removeLists']=function(_0x31c0e6,_0x59c887,_0x5484d5){return db[_0x3ae5('0x43')][_0x3ae5('0x4c')]({'where':{'id':_0x31c0e6[_0x3ae5('0x49')]['id']}})[_0x3ae5('0x25')](handleEntityNotFound(_0x59c887,null))[_0x3ae5('0x25')](function(_0xbedaeb){if(_0xbedaeb){return _0xbedaeb[_0x3ae5('0x8f')](_0x31c0e6['query'][_0x3ae5('0x69')]);}})[_0x3ae5('0x25')](function(_0x447a30){if(_0x447a30){return db[_0x3ae5('0x5b')][_0x3ae5('0x26')]({'where':{'ListId':_0x31c0e6[_0x3ae5('0x35')][_0x3ae5('0x69')],'CampaignId':_0x31c0e6['params']['id']}})['then'](function(){return _0x447a30;});}})[_0x3ae5('0x25')](respondWithStatusCode(_0x59c887,null))[_0x3ae5('0x47')](handleError(_0x59c887,null));};exports[_0x3ae5('0x90')]=function(_0x436438,_0x17b7af,_0x43c9b4){var _0xee5584={};var _0x63f301={};var _0x8dd17c;var _0x40af3d;return db[_0x3ae5('0x43')][_0x3ae5('0x5a')]({'where':{'id':_0x436438[_0x3ae5('0x49')]['id']}})[_0x3ae5('0x25')](handleEntityNotFound(_0x17b7af,null))['then'](function(_0x3cd978){if(_0x3cd978){_0x8dd17c=_0x3cd978;_0x63f301[_0x3ae5('0x34')]=_[_0x3ae5('0x4a')](db['CmList'][_0x3ae5('0x30')]);_0x63f301['query']=_[_0x3ae5('0x4a')](_0x436438[_0x3ae5('0x35')]);_0x63f301[_0x3ae5('0x36')]=_[_0x3ae5('0x37')](_0x63f301[_0x3ae5('0x34')],_0x63f301[_0x3ae5('0x35')]);_0xee5584['attributes']=_['intersection'](_0x63f301[_0x3ae5('0x34')],qs['fields'](_0x436438[_0x3ae5('0x35')][_0x3ae5('0x38')]));_0xee5584[_0x3ae5('0x39')]=_0xee5584[_0x3ae5('0x39')]['length']?_0xee5584[_0x3ae5('0x39')]:_0x63f301[_0x3ae5('0x34')];_0xee5584[_0x3ae5('0x5c')]=qs[_0x3ae5('0x3c')](_0x436438['query'][_0x3ae5('0x3c')]);_0xee5584[_0x3ae5('0x3d')]=qs['filters'](_[_0x3ae5('0x3e')](_0x436438[_0x3ae5('0x35')],_0x63f301[_0x3ae5('0x36')]));if(_0x436438[_0x3ae5('0x35')]['filter']){_0xee5584[_0x3ae5('0x3d')]=_[_0x3ae5('0x41')](_0xee5584[_0x3ae5('0x3d')],{'$or':_['map'](_0xee5584[_0x3ae5('0x39')],function(_0x2262e8){var _0x12bb54={};_0x12bb54[_0x2262e8]={'$like':'%'+_0x436438['query'][_0x3ae5('0x3f')]+'%'};return _0x12bb54;})});}_0xee5584=_[_0x3ae5('0x41')]({},_0xee5584,_0x436438[_0x3ae5('0x42')]);return _0x8dd17c[_0x3ae5('0x90')](_0xee5584);}})[_0x3ae5('0x25')](function(_0x99f3a4){if(_0x99f3a4){_0x40af3d=_0x99f3a4[_0x3ae5('0x3a')];if(!_0x436438[_0x3ae5('0x35')][_0x3ae5('0x3b')](_0x3ae5('0x60'))){_0xee5584['limit']=qs[_0x3ae5('0x1e')](_0x436438[_0x3ae5('0x35')][_0x3ae5('0x1e')]);_0xee5584[_0x3ae5('0x1c')]=qs['offset'](_0x436438[_0x3ae5('0x35')][_0x3ae5('0x1c')]);}return _0x8dd17c[_0x3ae5('0x90')](_0xee5584);}})['then'](function(_0x26d6ba){if(_0x26d6ba){return _0x26d6ba?{'count':_0x40af3d,'rows':_0x26d6ba}:null;}})[_0x3ae5('0x25')](respondWithResult(_0x17b7af,null))[_0x3ae5('0x47')](handleError(_0x17b7af,null));};exports[_0x3ae5('0x91')]=function(_0x38be53,_0x30f1fe,_0x498afd){var _0x4ba842,_0x5126cf;var _0x453d24=[];var _0x43658d=moment()['format'](_0x3ae5('0x68'));return db[_0x3ae5('0x43')][_0x3ae5('0x4c')]({'where':{'id':_0x38be53[_0x3ae5('0x49')]['id']}})[_0x3ae5('0x25')](handleEntityNotFound(_0x30f1fe,null))['then'](function(_0x4d8576){if(_0x4d8576){_0x5126cf=_0x4d8576;return _0x4d8576[_0x3ae5('0x91')](_0x38be53[_0x3ae5('0x4e')]['ids'],_[_0x3ae5('0x55')](_0x38be53[_0x3ae5('0x4e')],[_0x3ae5('0x69'),'id'])||{});}return null;})[_0x3ae5('0x6a')](function(_0x3cb779){var _0x214a2f;var _0x35b11e;_0x4ba842=_0x3cb779||[];var _0x4404dd=[];if(_0x3cb779){for(var _0x28ee14=0x0;_0x28ee14<_0x3cb779[_0x3ae5('0x3a')];_0x28ee14+=0x1){var _0x3fcd7f=_0x3cb779[_0x28ee14]['get']({'plain':!![]});_0x214a2f=squel[_0x3ae5('0x6d')]()[_0x3ae5('0x6e')](_0x3ae5('0x92'))[_0x3ae5('0x6f')]([_0x3ae5('0x74'),_0x3ae5('0x70'),_0x3ae5('0x71'),_0x3ae5('0x5d'),'createdAt',_0x3ae5('0x54')],squel['select']()['field']('phone',_0x3ae5('0x74'))[_0x3ae5('0x73')]('id','ContactId')['field'](_0x3fcd7f[_0x3ae5('0x76')][_0x3ae5('0x77')](),_0x3ae5('0x71'))[_0x3ae5('0x73')](_0x38be53[_0x3ae5('0x49')]['id'][_0x3ae5('0x77')](),_0x3ae5('0x5d'))[_0x3ae5('0x73')](_0x3ae5('0x80'),_0x3ae5('0x53'))['field']('NOW()','updatedAt')[_0x3ae5('0x78')](_0x3ae5('0x81'))[_0x3ae5('0x3d')](_0x3ae5('0x82'))[_0x3ae5('0x3d')]('ListId\x20=\x20?',_0x3fcd7f[_0x3ae5('0x76')][_0x3ae5('0x77')]())[_0x3ae5('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0x3ae5('0x77')]();_0x4404dd['push'](db[_0x3ae5('0x8d')]['query'](_0x214a2f));}return BPromise['all'](_0x4404dd);}})[_0x3ae5('0x25')](function(){return _0x4ba842;})[_0x3ae5('0x25')](respondWithResult(_0x30f1fe,null))[_0x3ae5('0x47')](handleError(_0x30f1fe,null));};exports[_0x3ae5('0x93')]=function(_0x41e2e2,_0x133d14,_0x1342b3){return db['Campaign']['find']({'where':{'id':_0x41e2e2[_0x3ae5('0x49')]['id']}})[_0x3ae5('0x25')](handleEntityNotFound(_0x133d14,null))[_0x3ae5('0x25')](function(_0x2b3b15){if(_0x2b3b15){return _0x2b3b15['removeBlackLists'](_0x41e2e2['query']['ids']);}})[_0x3ae5('0x25')](function(_0x3d3bdf){if(_0x3d3bdf){return db[_0x3ae5('0x64')][_0x3ae5('0x26')]({'where':{'ListId':_0x41e2e2[_0x3ae5('0x35')][_0x3ae5('0x69')],'CampaignId':_0x41e2e2[_0x3ae5('0x49')]['id']}})[_0x3ae5('0x25')](function(){return _0x3d3bdf;});}})[_0x3ae5('0x25')](respondWithStatusCode(_0x133d14,null))['catch'](handleError(_0x133d14,null));}; \ No newline at end of file +var _0xc584=['cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','sequelize','push','removeLists','getBlackLists','CmList','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','spread','cm_hopper_black','all','removeBlackLists','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','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','offset','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','Campaign','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','filters','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','getHoppers','findOne','CmHopper','sort','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','pick','CmHopperBlack','getLists','addLists','format','ids','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','field','phone','NOW()','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','ListId\x20=\x20?'];(function(_0x4e061e,_0x2c72e9){var _0xda83dc=function(_0x1fc8de){while(--_0x1fc8de){_0x4e061e['push'](_0x4e061e['shift']());}};_0xda83dc(++_0x2c72e9);}(_0xc584,0xa8));var _0x4c58=function(_0x1e7ead,_0x7f6227){_0x1e7ead=_0x1e7ead-0x0;var _0x3912b2=_0xc584[_0x1e7ead];return _0x3912b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c58('0x0'));var zipdir=require(_0x4c58('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4c58('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4c58('0x3'));var util=require(_0x4c58('0x4'));var path=require(_0x4c58('0x5'));var sox=require('sox');var csv=require(_0x4c58('0x6'));var ejs=require(_0x4c58('0x7'));var fs=require('fs');var fs_extra=require(_0x4c58('0x8'));var _=require(_0x4c58('0x9'));var squel=require(_0x4c58('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4c58('0x6'));var querystring=require(_0x4c58('0xb'));var Papa=require(_0x4c58('0xc'));var Redis=require(_0x4c58('0xd'));var authService=require(_0x4c58('0xe'));var qs=require(_0x4c58('0xf'));var as=require(_0x4c58('0x10'));var hardwareService=require(_0x4c58('0x11'));var logger=require(_0x4c58('0x12'))(_0x4c58('0x13'));var utils=require(_0x4c58('0x14'));var config=require(_0x4c58('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28f052,_0x4c17de){_0x4c17de=_0x4c17de||0xcc;return function(_0x821dba){if(_0x821dba){return _0x28f052[_0x4c58('0x16')](_0x4c17de);}return _0x28f052[_0x4c58('0x17')](_0x4c17de)[_0x4c58('0x18')]();};}function respondWithResult(_0x308372,_0x442bf9){_0x442bf9=_0x442bf9||0xc8;return function(_0x5a9e76){if(_0x5a9e76){return _0x308372[_0x4c58('0x17')](_0x442bf9)['json'](_0x5a9e76);}};}function respondWithFilteredResult(_0x4fa114,_0x5990c3){return function(_0x1831e4){if(_0x1831e4){var _0x14af92=typeof _0x5990c3[_0x4c58('0x19')]===_0x4c58('0x1a')&&typeof _0x5990c3['limit']===_0x4c58('0x1a');var _0x26db37=_0x1831e4[_0x4c58('0x1b')];var _0x1dc590=_0x14af92?0x0:_0x5990c3[_0x4c58('0x19')];var _0x4b72cc=_0x14af92?_0x1831e4[_0x4c58('0x1b')]:_0x5990c3[_0x4c58('0x19')]+_0x5990c3['limit'];var _0x26631e;if(_0x4b72cc>=_0x26db37){_0x4b72cc=_0x26db37;_0x26631e=0xc8;}else{_0x26631e=0xce;}_0x4fa114[_0x4c58('0x17')](_0x26631e);return _0x4fa114[_0x4c58('0x1c')](_0x4c58('0x1d'),_0x1dc590+'-'+_0x4b72cc+'/'+_0x26db37)[_0x4c58('0x1e')](_0x1831e4);}return null;};}function patchUpdates(_0x46876f){return function(_0x5793d2){try{jsonpatch[_0x4c58('0x1f')](_0x5793d2,_0x46876f,!![]);}catch(_0x408e30){return BPromise[_0x4c58('0x20')](_0x408e30);}return _0x5793d2[_0x4c58('0x21')]();};}function saveUpdates(_0xdd2d81,_0x4f189f){return function(_0x101d23){if(_0x101d23){return _0x101d23['update'](_0xdd2d81)[_0x4c58('0x22')](function(_0x368034){return _0x368034;});}return null;};}function removeEntity(_0x53ab2d,_0x3062fb){return function(_0x386c98){if(_0x386c98){return _0x386c98[_0x4c58('0x23')]()['then'](function(){var _0x159bf8=_0x386c98[_0x4c58('0x24')]({'plain':!![]});var _0x3f7de6=_0x4c58('0x25');return db[_0x4c58('0x26')]['destroy']({'where':{'type':_0x3f7de6,'resourceId':_0x159bf8['id']}})[_0x4c58('0x22')](function(){return _0x386c98;});})[_0x4c58('0x22')](function(){_0x53ab2d[_0x4c58('0x17')](0xcc)[_0x4c58('0x18')]();});}};}function handleEntityNotFound(_0x317409,_0x15efd1){return function(_0x38b2de){if(!_0x38b2de){_0x317409[_0x4c58('0x16')](0x194);}return _0x38b2de;};}function handleError(_0x5b5b4e,_0x33a731){_0x33a731=_0x33a731||0x1f4;return function(_0x10b72c){logger[_0x4c58('0x27')](_0x10b72c[_0x4c58('0x28')]);if(_0x10b72c[_0x4c58('0x29')]){delete _0x10b72c[_0x4c58('0x29')];}_0x5b5b4e[_0x4c58('0x17')](_0x33a731)[_0x4c58('0x2a')](_0x10b72c);};}exports[_0x4c58('0x2b')]=function(_0x437975,_0x13cf99){var _0x3c08a7={},_0x3ec02a={},_0x440ee4={'count':0x0,'rows':[]};var _0x1531f1=_[_0x4c58('0x2c')](db[_0x4c58('0x2d')][_0x4c58('0x2e')],function(_0x55fbf8){return{'name':_0x55fbf8['fieldName'],'type':_0x55fbf8['type'][_0x4c58('0x2f')]};});_0x3ec02a['model']=_[_0x4c58('0x2c')](_0x1531f1,'name');_0x3ec02a[_0x4c58('0x30')]=_[_0x4c58('0x31')](_0x437975[_0x4c58('0x30')]);_0x3ec02a['filters']=_[_0x4c58('0x32')](_0x3ec02a[_0x4c58('0x33')],_0x3ec02a[_0x4c58('0x30')]);_0x3c08a7[_0x4c58('0x34')]=_[_0x4c58('0x32')](_0x3ec02a[_0x4c58('0x33')],qs[_0x4c58('0x35')](_0x437975[_0x4c58('0x30')]['fields']));_0x3c08a7['attributes']=_0x3c08a7['attributes'][_0x4c58('0x36')]?_0x3c08a7[_0x4c58('0x34')]:_0x3ec02a[_0x4c58('0x33')];if(!_0x437975['query'][_0x4c58('0x37')](_0x4c58('0x38'))){_0x3c08a7[_0x4c58('0x39')]=qs[_0x4c58('0x39')](_0x437975['query'][_0x4c58('0x39')]);_0x3c08a7[_0x4c58('0x19')]=qs[_0x4c58('0x19')](_0x437975[_0x4c58('0x30')][_0x4c58('0x19')]);}_0x3c08a7[_0x4c58('0x3a')]=qs['sort'](_0x437975[_0x4c58('0x30')]['sort']);_0x3c08a7['where']=qs[_0x4c58('0x3b')](_['pick'](_0x437975[_0x4c58('0x30')],_0x3ec02a[_0x4c58('0x3b')]),_0x1531f1);if(_0x437975[_0x4c58('0x30')][_0x4c58('0x3c')]){_0x3c08a7[_0x4c58('0x3d')]=_['merge'](_0x3c08a7[_0x4c58('0x3d')],{'$or':_[_0x4c58('0x2c')](_0x1531f1,function(_0x511cfd){if(_0x511cfd['type']!==_0x4c58('0x3e')){var _0xb59516={};_0xb59516[_0x511cfd[_0x4c58('0x29')]]={'$like':'%'+_0x437975['query']['filter']+'%'};return _0xb59516;}})});}_0x3c08a7=_['merge']({},_0x3c08a7,_0x437975[_0x4c58('0x3f')]);var _0x5797ae={'where':_0x3c08a7[_0x4c58('0x3d')]};return db['Campaign'][_0x4c58('0x1b')](_0x5797ae)[_0x4c58('0x22')](function(_0x3b74b4){_0x440ee4[_0x4c58('0x1b')]=_0x3b74b4;if(_0x437975[_0x4c58('0x30')][_0x4c58('0x40')]){_0x3c08a7[_0x4c58('0x41')]=[{'all':!![]}];}return db[_0x4c58('0x2d')][_0x4c58('0x42')](_0x3c08a7);})[_0x4c58('0x22')](function(_0x1f8d23){_0x440ee4[_0x4c58('0x43')]=_0x1f8d23;return _0x440ee4;})[_0x4c58('0x22')](respondWithFilteredResult(_0x13cf99,_0x3c08a7))[_0x4c58('0x44')](handleError(_0x13cf99,null));};exports[_0x4c58('0x45')]=function(_0x41c8ab,_0x5c1653){var _0x5d19a0={'raw':![],'where':{'id':_0x41c8ab[_0x4c58('0x46')]['id']}},_0x54ff5d={};_0x54ff5d['model']=_['keys'](db['Campaign'][_0x4c58('0x2e')]);_0x54ff5d[_0x4c58('0x30')]=_[_0x4c58('0x31')](_0x41c8ab[_0x4c58('0x30')]);_0x54ff5d[_0x4c58('0x3b')]=_['intersection'](_0x54ff5d[_0x4c58('0x33')],_0x54ff5d['query']);_0x5d19a0['attributes']=_[_0x4c58('0x32')](_0x54ff5d['model'],qs[_0x4c58('0x35')](_0x41c8ab[_0x4c58('0x30')][_0x4c58('0x35')]));_0x5d19a0['attributes']=_0x5d19a0['attributes']['length']?_0x5d19a0[_0x4c58('0x34')]:_0x54ff5d['model'];if(_0x41c8ab['query'][_0x4c58('0x40')]){_0x5d19a0['include']=[{'all':!![]}];}_0x5d19a0=_[_0x4c58('0x47')]({},_0x5d19a0,_0x41c8ab['options']);return db[_0x4c58('0x2d')]['find'](_0x5d19a0)[_0x4c58('0x22')](handleEntityNotFound(_0x5c1653,null))['then'](respondWithResult(_0x5c1653,null))[_0x4c58('0x44')](handleError(_0x5c1653,null));};exports[_0x4c58('0x48')]=function(_0x47f744,_0x32ad34){return db[_0x4c58('0x2d')]['create'](_0x47f744[_0x4c58('0x49')],{})[_0x4c58('0x22')](function(_0x2ed13b){var _0x465ca3=_0x47f744[_0x4c58('0x4a')][_0x4c58('0x24')]({'plain':!![]});if(!_0x465ca3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x465ca3[_0x4c58('0x4b')]===_0x4c58('0x4a')){var _0x31483f=_0x2ed13b[_0x4c58('0x24')]({'plain':!![]});var _0x374094='IvrCampaigns';return db[_0x4c58('0x4c')][_0x4c58('0x4d')]({'where':{'name':_0x374094,'userProfileId':_0x465ca3[_0x4c58('0x4e')]},'raw':!![]})['then'](function(_0x57c30d){if(_0x57c30d&&_0x57c30d[_0x4c58('0x4f')]===0x0){return db[_0x4c58('0x26')][_0x4c58('0x48')]({'name':_0x31483f['name'],'resourceId':_0x31483f['id'],'type':_0x57c30d[_0x4c58('0x29')],'sectionId':_0x57c30d['id']},{})[_0x4c58('0x22')](function(){return _0x2ed13b;});}else{return _0x2ed13b;}})['catch'](function(_0x5e89f6){logger['error'](_0x4c58('0x50'),_0x5e89f6);throw _0x5e89f6;});}return _0x2ed13b;})[_0x4c58('0x22')](respondWithResult(_0x32ad34,0xc9))[_0x4c58('0x44')](handleError(_0x32ad34,null));};exports[_0x4c58('0x51')]=function(_0x1a8bb4,_0x1fe254){var _0x3db6d6={'where':{'id':_0x1a8bb4['params']['id']}},_0x3c9319={};_0x3c9319[_0x4c58('0x33')]=_[_0x4c58('0x31')](db[_0x4c58('0x2d')][_0x4c58('0x2e')]);_0x3db6d6['attributes']=_['intersection'](_0x3c9319[_0x4c58('0x33')],qs[_0x4c58('0x35')](_0x1a8bb4['query'][_0x4c58('0x35')]));_0x3db6d6[_0x4c58('0x34')]=_0x3db6d6['attributes'][_0x4c58('0x36')]?_0x3db6d6['attributes']:_0x3c9319[_0x4c58('0x33')];if(_0x1a8bb4[_0x4c58('0x30')][_0x4c58('0x40')]){_0x3db6d6[_0x4c58('0x41')]=[{'all':!![]}];}_0x3db6d6=_[_0x4c58('0x47')]({},_0x3db6d6,_0x1a8bb4[_0x4c58('0x3f')]);return db[_0x4c58('0x2d')][_0x4c58('0x4d')](_0x3db6d6)['then'](handleEntityNotFound(_0x1fe254,null))['then'](function(_0x56ac40){if(_0x56ac40){var _0x545568=_0x56ac40[_0x4c58('0x24')]({'plain':!![]});_0x545568=qs[_0x4c58('0x52')](_0x545568,['id','createdAt',_0x4c58('0x53')]);_0x1a8bb4['body']=_[_0x4c58('0x52')](_0x1a8bb4[_0x4c58('0x49')],['id',_0x4c58('0x54'),_0x4c58('0x53')]);return db['Campaign'][_0x4c58('0x48')](_[_0x4c58('0x47')](_0x545568,_0x1a8bb4[_0x4c58('0x49')]),{'include':_0x1a8bb4[_0x4c58('0x30')][_0x4c58('0x40')]?[{'all':!![]}]:undefined})[_0x4c58('0x22')](function(_0x2b1b70){var _0x312bfd=_0x1a8bb4[_0x4c58('0x4a')]['get']({'plain':!![]});if(!_0x312bfd)throw new Error(_0x4c58('0x55'));if(_0x312bfd[_0x4c58('0x4b')]===_0x4c58('0x4a')){var _0x537054=_0x2b1b70[_0x4c58('0x24')]({'plain':!![]});var _0x3bce6e=_0x4c58('0x25');return db[_0x4c58('0x4c')][_0x4c58('0x4d')]({'where':{'name':_0x3bce6e,'userProfileId':_0x312bfd[_0x4c58('0x4e')]},'raw':!![]})[_0x4c58('0x22')](function(_0xe509e2){if(_0xe509e2&&_0xe509e2[_0x4c58('0x4f')]===0x0){return db[_0x4c58('0x26')][_0x4c58('0x48')]({'name':_0x537054[_0x4c58('0x29')],'resourceId':_0x537054['id'],'type':_0xe509e2[_0x4c58('0x29')],'sectionId':_0xe509e2['id']},{})['then'](function(){return _0x2b1b70;});}else{return _0x2b1b70;}})[_0x4c58('0x44')](function(_0x2cd761){logger[_0x4c58('0x27')](_0x4c58('0x50'),_0x2cd761);throw _0x2cd761;});}return _0x2b1b70;});}})[_0x4c58('0x22')](respondWithResult(_0x1fe254,0xc9))[_0x4c58('0x44')](handleError(_0x1fe254,null));};exports[_0x4c58('0x56')]=function(_0x5c8e31,_0xfb4b0f){if(_0x5c8e31[_0x4c58('0x49')]['id']){delete _0x5c8e31[_0x4c58('0x49')]['id'];}return db['Campaign'][_0x4c58('0x4d')]({'where':{'id':_0x5c8e31[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0xfb4b0f,null))[_0x4c58('0x22')](saveUpdates(_0x5c8e31[_0x4c58('0x49')],null))[_0x4c58('0x22')](respondWithResult(_0xfb4b0f,null))['catch'](handleError(_0xfb4b0f,null));};exports['destroy']=function(_0x4aa070,_0x5c3d80){return db[_0x4c58('0x2d')]['find']({'where':{'id':_0x4aa070[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x5c3d80,null))[_0x4c58('0x22')](removeEntity(_0x5c3d80,null))[_0x4c58('0x44')](handleError(_0x5c3d80,null));};exports[_0x4c58('0x57')]=function(_0x20ce29,_0x2cf937,_0x21f92e){var _0x151b3a={'raw':!![],'where':{}};var _0x1ba8ba={};var _0x7fa9eb={'count':0x0,'rows':[]};return db[_0x4c58('0x2d')][_0x4c58('0x58')]({'where':{'id':_0x20ce29[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x2cf937,null))['then'](function(_0x9b38fd){if(_0x9b38fd){_0x1ba8ba[_0x4c58('0x33')]=_[_0x4c58('0x31')](db[_0x4c58('0x59')][_0x4c58('0x2e')]);_0x1ba8ba[_0x4c58('0x30')]=_['keys'](_0x20ce29['query']);_0x1ba8ba[_0x4c58('0x3b')]=_[_0x4c58('0x32')](_0x1ba8ba[_0x4c58('0x33')],_0x1ba8ba[_0x4c58('0x30')]);_0x151b3a['attributes']=_['intersection'](_0x1ba8ba[_0x4c58('0x33')],qs['fields'](_0x20ce29[_0x4c58('0x30')][_0x4c58('0x35')]));_0x151b3a['attributes']=_0x151b3a[_0x4c58('0x34')][_0x4c58('0x36')]?_0x151b3a['attributes']:_0x1ba8ba['model'];if(!_0x20ce29[_0x4c58('0x30')]['hasOwnProperty'](_0x4c58('0x38'))){_0x151b3a['limit']=qs[_0x4c58('0x39')](_0x20ce29['query'][_0x4c58('0x39')]);_0x151b3a[_0x4c58('0x19')]=qs[_0x4c58('0x19')](_0x20ce29[_0x4c58('0x30')][_0x4c58('0x19')]);}_0x151b3a[_0x4c58('0x3a')]=qs[_0x4c58('0x5a')](_0x20ce29[_0x4c58('0x30')][_0x4c58('0x5a')]);_0x151b3a[_0x4c58('0x3d')]=qs['filters'](_['pick'](_0x20ce29[_0x4c58('0x30')],_0x1ba8ba[_0x4c58('0x3b')]));_0x151b3a[_0x4c58('0x3d')][_0x4c58('0x5b')]=_0x9b38fd['id'];if(_0x20ce29['query'][_0x4c58('0x3c')]){_0x151b3a['where']=_[_0x4c58('0x47')](_0x151b3a[_0x4c58('0x3d')],{'$or':_['map'](_0x151b3a[_0x4c58('0x34')],function(_0x1e02aa){var _0x3ce1ed={};_0x3ce1ed[_0x1e02aa]={'$like':'%'+_0x20ce29['query'][_0x4c58('0x3c')]+'%'};return _0x3ce1ed;})});}_0x151b3a=_[_0x4c58('0x47')]({},_0x151b3a,_0x20ce29[_0x4c58('0x3f')]);return db['CmHopper'][_0x4c58('0x1b')]({'where':_0x151b3a[_0x4c58('0x3d')]})[_0x4c58('0x22')](function(_0x121177){_0x7fa9eb[_0x4c58('0x1b')]=_0x121177;if(_0x20ce29[_0x4c58('0x30')][_0x4c58('0x40')]){_0x151b3a[_0x4c58('0x41')]=[{'all':!![]}];}return db[_0x4c58('0x59')]['findAll'](_0x151b3a);})[_0x4c58('0x22')](function(_0x36ed27){_0x7fa9eb[_0x4c58('0x43')]=_0x36ed27;return _0x7fa9eb;});}})[_0x4c58('0x22')](respondWithFilteredResult(_0x2cf937,_0x151b3a))['catch'](handleError(_0x2cf937,null));};exports[_0x4c58('0x5c')]=function(_0x2a56aa,_0x20b43d,_0x88f08e){var _0x2c4f16={'raw':!![],'where':{}};var _0x59ab28={};var _0xf7ea8e={'count':0x0,'rows':[]};return db[_0x4c58('0x2d')]['findOne']({'where':{'id':_0x2a56aa[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x20b43d,null))[_0x4c58('0x22')](function(_0x1fda5d){if(_0x1fda5d){_0x59ab28[_0x4c58('0x33')]=_[_0x4c58('0x31')](db[_0x4c58('0x5d')][_0x4c58('0x2e')]);_0x59ab28[_0x4c58('0x30')]=_[_0x4c58('0x31')](_0x2a56aa[_0x4c58('0x30')]);_0x59ab28[_0x4c58('0x3b')]=_[_0x4c58('0x32')](_0x59ab28[_0x4c58('0x33')],_0x59ab28['query']);_0x2c4f16[_0x4c58('0x34')]=_['intersection'](_0x59ab28[_0x4c58('0x33')],qs['fields'](_0x2a56aa['query'][_0x4c58('0x35')]));_0x2c4f16[_0x4c58('0x34')]=_0x2c4f16[_0x4c58('0x34')]['length']?_0x2c4f16[_0x4c58('0x34')]:_0x59ab28[_0x4c58('0x33')];if(!_0x2a56aa[_0x4c58('0x30')]['hasOwnProperty'](_0x4c58('0x38'))){_0x2c4f16['limit']=qs['limit'](_0x2a56aa['query'][_0x4c58('0x39')]);_0x2c4f16[_0x4c58('0x19')]=qs[_0x4c58('0x19')](_0x2a56aa[_0x4c58('0x30')]['offset']);}_0x2c4f16['order']=qs[_0x4c58('0x5a')](_0x2a56aa[_0x4c58('0x30')][_0x4c58('0x5a')]);_0x2c4f16['where']=qs[_0x4c58('0x3b')](_['pick'](_0x2a56aa['query'],_0x59ab28['filters']));_0x2c4f16[_0x4c58('0x3d')]['CampaignId']=_0x1fda5d['id'];if(_0x2a56aa[_0x4c58('0x30')][_0x4c58('0x3c')]){_0x2c4f16[_0x4c58('0x3d')]=_['merge'](_0x2c4f16[_0x4c58('0x3d')],{'$or':_[_0x4c58('0x2c')](_0x2c4f16[_0x4c58('0x34')],function(_0x3d0101){var _0x207e08={};_0x207e08[_0x3d0101]={'$like':'%'+_0x2a56aa['query'][_0x4c58('0x3c')]+'%'};return _0x207e08;})});}_0x2c4f16=_[_0x4c58('0x47')]({},_0x2c4f16,_0x2a56aa[_0x4c58('0x3f')]);return db[_0x4c58('0x5d')][_0x4c58('0x1b')]({'where':_0x2c4f16['where']})['then'](function(_0x5ce4e9){_0xf7ea8e[_0x4c58('0x1b')]=_0x5ce4e9;if(_0x2a56aa[_0x4c58('0x30')][_0x4c58('0x40')]){_0x2c4f16[_0x4c58('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x4c58('0x42')](_0x2c4f16);})[_0x4c58('0x22')](function(_0x582d90){_0xf7ea8e[_0x4c58('0x43')]=_0x582d90;return _0xf7ea8e;});}})['then'](respondWithFilteredResult(_0x20b43d,_0x2c4f16))[_0x4c58('0x44')](handleError(_0x20b43d,null));};exports[_0x4c58('0x5e')]=function(_0x1cfd1a,_0x4c9a4b,_0x310ad7){var _0x3b4662={'raw':!![],'where':{}};var _0x45cf5e={};var _0x242a49={'count':0x0,'rows':[]};return db[_0x4c58('0x2d')][_0x4c58('0x58')]({'where':{'id':_0x1cfd1a[_0x4c58('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c9a4b,null))[_0x4c58('0x22')](function(_0x11b98d){if(_0x11b98d){_0x45cf5e[_0x4c58('0x33')]=_[_0x4c58('0x31')](db[_0x4c58('0x5f')]['rawAttributes']);_0x45cf5e[_0x4c58('0x30')]=_[_0x4c58('0x31')](_0x1cfd1a['query']);_0x45cf5e[_0x4c58('0x3b')]=_[_0x4c58('0x32')](_0x45cf5e[_0x4c58('0x33')],_0x45cf5e['query']);_0x3b4662['attributes']=_[_0x4c58('0x32')](_0x45cf5e['model'],qs[_0x4c58('0x35')](_0x1cfd1a[_0x4c58('0x30')][_0x4c58('0x35')]));_0x3b4662[_0x4c58('0x34')]=_0x3b4662['attributes'][_0x4c58('0x36')]?_0x3b4662['attributes']:_0x45cf5e[_0x4c58('0x33')];if(!_0x1cfd1a['query'][_0x4c58('0x37')](_0x4c58('0x38'))){_0x3b4662['limit']=qs[_0x4c58('0x39')](_0x1cfd1a[_0x4c58('0x30')][_0x4c58('0x39')]);_0x3b4662[_0x4c58('0x19')]=qs[_0x4c58('0x19')](_0x1cfd1a[_0x4c58('0x30')][_0x4c58('0x19')]);}_0x3b4662[_0x4c58('0x3a')]=qs[_0x4c58('0x5a')](_0x1cfd1a[_0x4c58('0x30')][_0x4c58('0x5a')]);_0x3b4662['where']=qs[_0x4c58('0x3b')](_[_0x4c58('0x60')](_0x1cfd1a[_0x4c58('0x30')],_0x45cf5e['filters']));_0x3b4662[_0x4c58('0x3d')][_0x4c58('0x5b')]=_0x11b98d['id'];if(_0x1cfd1a['query'][_0x4c58('0x3c')]){_0x3b4662[_0x4c58('0x3d')]=_[_0x4c58('0x47')](_0x3b4662[_0x4c58('0x3d')],{'$or':_[_0x4c58('0x2c')](_0x3b4662[_0x4c58('0x34')],function(_0xbf4110){var _0x25c25a={};_0x25c25a[_0xbf4110]={'$like':'%'+_0x1cfd1a['query'][_0x4c58('0x3c')]+'%'};return _0x25c25a;})});}_0x3b4662=_[_0x4c58('0x47')]({},_0x3b4662,_0x1cfd1a['options']);return db['CmHopperFinal'][_0x4c58('0x1b')]({'where':_0x3b4662[_0x4c58('0x3d')]})[_0x4c58('0x22')](function(_0x6029d4){_0x242a49[_0x4c58('0x1b')]=_0x6029d4;if(_0x1cfd1a[_0x4c58('0x30')][_0x4c58('0x40')]){_0x3b4662[_0x4c58('0x41')]=[{'all':!![]}];}return db[_0x4c58('0x5f')][_0x4c58('0x42')](_0x3b4662);})['then'](function(_0x447a2b){_0x242a49[_0x4c58('0x43')]=_0x447a2b;return _0x242a49;});}})[_0x4c58('0x22')](respondWithFilteredResult(_0x4c9a4b,_0x3b4662))[_0x4c58('0x44')](handleError(_0x4c9a4b,null));};exports['getHopperBlacks']=function(_0x3acdc1,_0x1ac09b,_0x419cc4){var _0x5dffa1={'raw':!![],'where':{}};var _0x5afdca={};var _0x5a7eac={'count':0x0,'rows':[]};return db['Campaign'][_0x4c58('0x58')]({'where':{'id':_0x3acdc1[_0x4c58('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ac09b,null))['then'](function(_0x37e5cf){if(_0x37e5cf){_0x5afdca['model']=_[_0x4c58('0x31')](db['CmHopperBlack'][_0x4c58('0x2e')]);_0x5afdca[_0x4c58('0x30')]=_['keys'](_0x3acdc1[_0x4c58('0x30')]);_0x5afdca['filters']=_['intersection'](_0x5afdca[_0x4c58('0x33')],_0x5afdca[_0x4c58('0x30')]);_0x5dffa1[_0x4c58('0x34')]=_[_0x4c58('0x32')](_0x5afdca[_0x4c58('0x33')],qs[_0x4c58('0x35')](_0x3acdc1[_0x4c58('0x30')][_0x4c58('0x35')]));_0x5dffa1[_0x4c58('0x34')]=_0x5dffa1[_0x4c58('0x34')]['length']?_0x5dffa1[_0x4c58('0x34')]:_0x5afdca['model'];if(!_0x3acdc1[_0x4c58('0x30')]['hasOwnProperty'](_0x4c58('0x38'))){_0x5dffa1[_0x4c58('0x39')]=qs[_0x4c58('0x39')](_0x3acdc1[_0x4c58('0x30')][_0x4c58('0x39')]);_0x5dffa1[_0x4c58('0x19')]=qs[_0x4c58('0x19')](_0x3acdc1['query'][_0x4c58('0x19')]);}_0x5dffa1[_0x4c58('0x3a')]=qs[_0x4c58('0x5a')](_0x3acdc1[_0x4c58('0x30')]['sort']);_0x5dffa1['where']=qs[_0x4c58('0x3b')](_[_0x4c58('0x60')](_0x3acdc1[_0x4c58('0x30')],_0x5afdca[_0x4c58('0x3b')]));_0x5dffa1['where'][_0x4c58('0x5b')]=_0x37e5cf['id'];if(_0x3acdc1[_0x4c58('0x30')][_0x4c58('0x3c')]){_0x5dffa1[_0x4c58('0x3d')]=_[_0x4c58('0x47')](_0x5dffa1['where'],{'$or':_[_0x4c58('0x2c')](_0x5dffa1['attributes'],function(_0x3f9eb6){var _0x562a39={};_0x562a39[_0x3f9eb6]={'$like':'%'+_0x3acdc1['query'][_0x4c58('0x3c')]+'%'};return _0x562a39;})});}_0x5dffa1=_[_0x4c58('0x47')]({},_0x5dffa1,_0x3acdc1[_0x4c58('0x3f')]);return db['CmHopperBlack'][_0x4c58('0x1b')]({'where':_0x5dffa1[_0x4c58('0x3d')]})[_0x4c58('0x22')](function(_0x2d9003){_0x5a7eac[_0x4c58('0x1b')]=_0x2d9003;if(_0x3acdc1['query'][_0x4c58('0x40')]){_0x5dffa1['include']=[{'all':!![]}];}return db[_0x4c58('0x61')][_0x4c58('0x42')](_0x5dffa1);})[_0x4c58('0x22')](function(_0x113c47){_0x5a7eac[_0x4c58('0x43')]=_0x113c47;return _0x5a7eac;});}})[_0x4c58('0x22')](respondWithFilteredResult(_0x1ac09b,_0x5dffa1))['catch'](handleError(_0x1ac09b,null));};exports[_0x4c58('0x62')]=function(_0x1956aa,_0x3630a7,_0x2a4ec3){var _0x1d8a34={};var _0x1cb289={};var _0x389612;var _0x24679d;return db[_0x4c58('0x2d')][_0x4c58('0x58')]({'where':{'id':_0x1956aa['params']['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x3630a7,null))['then'](function(_0x4a7207){if(_0x4a7207){_0x389612=_0x4a7207;_0x1cb289[_0x4c58('0x33')]=_[_0x4c58('0x31')](db['CmList'][_0x4c58('0x2e')]);_0x1cb289[_0x4c58('0x30')]=_[_0x4c58('0x31')](_0x1956aa['query']);_0x1cb289[_0x4c58('0x3b')]=_[_0x4c58('0x32')](_0x1cb289[_0x4c58('0x33')],_0x1cb289[_0x4c58('0x30')]);_0x1d8a34[_0x4c58('0x34')]=_['intersection'](_0x1cb289['model'],qs[_0x4c58('0x35')](_0x1956aa[_0x4c58('0x30')]['fields']));_0x1d8a34[_0x4c58('0x34')]=_0x1d8a34[_0x4c58('0x34')]['length']?_0x1d8a34['attributes']:_0x1cb289['model'];_0x1d8a34[_0x4c58('0x3a')]=qs[_0x4c58('0x5a')](_0x1956aa['query'][_0x4c58('0x5a')]);_0x1d8a34[_0x4c58('0x3d')]=qs[_0x4c58('0x3b')](_[_0x4c58('0x60')](_0x1956aa[_0x4c58('0x30')],_0x1cb289[_0x4c58('0x3b')]));if(_0x1956aa['query'][_0x4c58('0x3c')]){_0x1d8a34[_0x4c58('0x3d')]=_[_0x4c58('0x47')](_0x1d8a34[_0x4c58('0x3d')],{'$or':_['map'](_0x1d8a34[_0x4c58('0x34')],function(_0x3e0335){var _0x27d6c8={};_0x27d6c8[_0x3e0335]={'$like':'%'+_0x1956aa[_0x4c58('0x30')][_0x4c58('0x3c')]+'%'};return _0x27d6c8;})});}_0x1d8a34=_[_0x4c58('0x47')]({},_0x1d8a34,_0x1956aa[_0x4c58('0x3f')]);return _0x389612[_0x4c58('0x62')](_0x1d8a34);}})['then'](function(_0x6c2f85){if(_0x6c2f85){_0x24679d=_0x6c2f85[_0x4c58('0x36')];if(!_0x1956aa[_0x4c58('0x30')][_0x4c58('0x37')](_0x4c58('0x38'))){_0x1d8a34[_0x4c58('0x39')]=qs[_0x4c58('0x39')](_0x1956aa[_0x4c58('0x30')][_0x4c58('0x39')]);_0x1d8a34[_0x4c58('0x19')]=qs[_0x4c58('0x19')](_0x1956aa[_0x4c58('0x30')][_0x4c58('0x19')]);}return _0x389612[_0x4c58('0x62')](_0x1d8a34);}})[_0x4c58('0x22')](function(_0x1f4ff9){if(_0x1f4ff9){return _0x1f4ff9?{'count':_0x24679d,'rows':_0x1f4ff9}:null;}})[_0x4c58('0x22')](respondWithResult(_0x3630a7,null))['catch'](handleError(_0x3630a7,null));};exports[_0x4c58('0x63')]=function(_0x19f318,_0x45a0f3,_0x352681){var _0x410acd,_0x2bb505;var _0x35edc2=[];var _0x1a5ad2=moment()[_0x4c58('0x64')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x4c58('0x2d')][_0x4c58('0x4d')]({'where':{'id':_0x19f318['params']['id']}})['then'](handleEntityNotFound(_0x45a0f3,null))[_0x4c58('0x22')](function(_0x2f2b6a){if(_0x2f2b6a){_0x2bb505=_0x2f2b6a;return _0x2f2b6a[_0x4c58('0x63')](_0x19f318['body'][_0x4c58('0x65')],_[_0x4c58('0x52')](_0x19f318[_0x4c58('0x49')],['ids','id'])||{});}return null;})['spread'](function(_0x23c4a0){var _0x576884;var _0x185288;_0x410acd=_0x23c4a0||[];var _0xf292b6=[];if(_0x23c4a0){for(var _0x461115=0x0;_0x461115<_0x23c4a0['length'];_0x461115+=0x1){var _0x10ae6e=_0x23c4a0[_0x461115][_0x4c58('0x24')]({'plain':!![]});_0x2bb505[_0x4c58('0x66')]=_0x19f318[_0x4c58('0x49')]['dialCheckDuplicateType']?_0x19f318[_0x4c58('0x49')]['dialCheckDuplicateType']:_0x2bb505[_0x4c58('0x66')];switch(_0x2bb505[_0x4c58('0x66')]){case'always':_0x576884=squel[_0x4c58('0x67')]()[_0x4c58('0x68')](_0x4c58('0x69'))[_0x4c58('0x6a')](['phone',_0x4c58('0x6b'),_0x4c58('0x6c'),'ListId',_0x4c58('0x5b'),_0x4c58('0x54'),_0x4c58('0x53')],squel['select']()[_0x4c58('0x6d')](_0x4c58('0x6e'),_0x4c58('0x6e'))[_0x4c58('0x6d')](_0x4c58('0x6f'),'scheduledAt')[_0x4c58('0x6d')]('id','ContactId')['field'](_0x10ae6e[_0x4c58('0x70')][_0x4c58('0x71')](),_0x4c58('0x72'))['field'](_0x19f318[_0x4c58('0x46')]['id'][_0x4c58('0x71')](),_0x4c58('0x5b'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27',_0x4c58('0x54'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27','updatedAt')['from'](_0x4c58('0x73'))[_0x4c58('0x3d')](_0x4c58('0x74'))[_0x4c58('0x3d')]('ListId\x20=\x20?',_0x10ae6e[_0x4c58('0x70')][_0x4c58('0x71')]())[_0x4c58('0x3d')](_0x4c58('0x75'))['where'](_0x4c58('0x76'),squel[_0x4c58('0x77')]()['field'](_0x4c58('0x78'))[_0x4c58('0x79')](_0x4c58('0x7a'))[_0x4c58('0x3d')](_0x4c58('0x7b'),_0x19f318[_0x4c58('0x46')]['id']['toString']()))[_0x4c58('0x3d')](_0x4c58('0x76'),squel['select']()[_0x4c58('0x6d')]('COALESCE(phone,\x27\x27)')[_0x4c58('0x79')](_0x4c58('0x69'))[_0x4c58('0x3d')]('CampaignId\x20=\x20?',_0x19f318[_0x4c58('0x46')]['id'][_0x4c58('0x71')]())))[_0x4c58('0x71')]();break;case'onlyIfOpen':_0x576884=squel[_0x4c58('0x67')]()[_0x4c58('0x68')](_0x4c58('0x69'))[_0x4c58('0x6a')]([_0x4c58('0x6e'),_0x4c58('0x6b'),_0x4c58('0x6c'),_0x4c58('0x72'),_0x4c58('0x5b'),'createdAt','updatedAt'],squel[_0x4c58('0x77')]()['field']('phone',_0x4c58('0x6e'))['field']('NOW()',_0x4c58('0x6b'))[_0x4c58('0x6d')]('id',_0x4c58('0x6c'))['field'](_0x10ae6e[_0x4c58('0x70')][_0x4c58('0x71')](),_0x4c58('0x72'))[_0x4c58('0x6d')](_0x19f318[_0x4c58('0x46')]['id']['toString'](),_0x4c58('0x5b'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27',_0x4c58('0x54'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27',_0x4c58('0x53'))['from'](_0x4c58('0x73'))[_0x4c58('0x3d')](_0x4c58('0x74'))[_0x4c58('0x3d')]('ListId\x20=\x20?',_0x10ae6e[_0x4c58('0x70')][_0x4c58('0x71')]())[_0x4c58('0x3d')](_0x4c58('0x75'))[_0x4c58('0x3d')](_0x4c58('0x76'),squel[_0x4c58('0x77')]()[_0x4c58('0x6d')](_0x4c58('0x7c'))[_0x4c58('0x79')]('cm_hopper')[_0x4c58('0x3d')](_0x4c58('0x7b'),_0x19f318['params']['id'][_0x4c58('0x71')]())))['toString']();break;default:_0x576884=squel[_0x4c58('0x67')]()[_0x4c58('0x68')](_0x4c58('0x69'))[_0x4c58('0x6a')]([_0x4c58('0x6e'),'scheduledAt',_0x4c58('0x6c'),'ListId',_0x4c58('0x5b'),_0x4c58('0x54'),_0x4c58('0x53')],squel[_0x4c58('0x77')]()[_0x4c58('0x6d')](_0x4c58('0x6e'),_0x4c58('0x6e'))['field'](_0x4c58('0x6f'),'scheduledAt')['field']('id','ContactId')[_0x4c58('0x6d')](_0x10ae6e[_0x4c58('0x70')][_0x4c58('0x71')](),_0x4c58('0x72'))[_0x4c58('0x6d')](_0x19f318[_0x4c58('0x46')]['id']['toString'](),_0x4c58('0x5b'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27',_0x4c58('0x54'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27',_0x4c58('0x53'))['from'](_0x4c58('0x73'))['where']('deletedAt\x20IS\x20NULL')[_0x4c58('0x3d')](_0x4c58('0x7d'),_0x10ae6e[_0x4c58('0x70')][_0x4c58('0x71')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x4c58('0x71')]();}_0x185288=squel[_0x4c58('0x67')]()[_0x4c58('0x68')](_0x4c58('0x7e'))['fromQuery'](['cmHopperId',_0x4c58('0x6b'),'phone',_0x4c58('0x7f'),_0x4c58('0x54'),_0x4c58('0x53')],squel[_0x4c58('0x77')]()[_0x4c58('0x6d')](_0x4c58('0x80'),'id')[_0x4c58('0x6d')](_0x4c58('0x6f'),_0x4c58('0x6b'))[_0x4c58('0x6d')](_0x4c58('0x81'),_0x4c58('0x6e'))[_0x4c58('0x6d')](_0x4c58('0x82'),_0x4c58('0x7f'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27',_0x4c58('0x54'))[_0x4c58('0x6d')]('\x27'+_0x1a5ad2+'\x27','updatedAt')[_0x4c58('0x79')](_0x4c58('0x83'),'ci')[_0x4c58('0x84')]('cm_hopper','h',_0x4c58('0x85'))['where'](_0x4c58('0x86'),_0x10ae6e[_0x4c58('0x70')][_0x4c58('0x71')]())[_0x4c58('0x3d')]('h.CampaignId=?',_0x19f318[_0x4c58('0x46')]['id'][_0x4c58('0x71')]())[_0x4c58('0x3d')](_0x4c58('0x87'),_0x1a5ad2))[_0x4c58('0x71')]();_0xf292b6['push'](db[_0x4c58('0x88')]['query'](_0x576884));_0x35edc2[_0x4c58('0x89')](db[_0x4c58('0x88')][_0x4c58('0x30')](_0x185288));}return BPromise['all'](_0xf292b6);}})['then'](function(){return BPromise['all'](_0x35edc2);})[_0x4c58('0x22')](function(){return _0x410acd;})[_0x4c58('0x22')](respondWithResult(_0x45a0f3,null))[_0x4c58('0x44')](handleError(_0x45a0f3,null));};exports[_0x4c58('0x8a')]=function(_0x516919,_0x37b828,_0x4bbf38){return db[_0x4c58('0x2d')][_0x4c58('0x4d')]({'where':{'id':_0x516919[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x37b828,null))[_0x4c58('0x22')](function(_0x9c503){if(_0x9c503){return _0x9c503[_0x4c58('0x8a')](_0x516919['query'][_0x4c58('0x65')]);}})[_0x4c58('0x22')](function(_0x36ace3){if(_0x36ace3){return db[_0x4c58('0x59')][_0x4c58('0x23')]({'where':{'ListId':_0x516919[_0x4c58('0x30')][_0x4c58('0x65')],'CampaignId':_0x516919[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](function(){return _0x36ace3;});}})[_0x4c58('0x22')](respondWithStatusCode(_0x37b828,null))['catch'](handleError(_0x37b828,null));};exports[_0x4c58('0x8b')]=function(_0x26db06,_0x892b6d,_0x519b9d){var _0x195e5a={};var _0x31a34f={};var _0x4aa856;var _0x2c314b;return db['Campaign'][_0x4c58('0x58')]({'where':{'id':_0x26db06[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x892b6d,null))[_0x4c58('0x22')](function(_0x15bf17){if(_0x15bf17){_0x4aa856=_0x15bf17;_0x31a34f[_0x4c58('0x33')]=_[_0x4c58('0x31')](db[_0x4c58('0x8c')][_0x4c58('0x2e')]);_0x31a34f[_0x4c58('0x30')]=_['keys'](_0x26db06[_0x4c58('0x30')]);_0x31a34f[_0x4c58('0x3b')]=_['intersection'](_0x31a34f[_0x4c58('0x33')],_0x31a34f['query']);_0x195e5a[_0x4c58('0x34')]=_[_0x4c58('0x32')](_0x31a34f[_0x4c58('0x33')],qs[_0x4c58('0x35')](_0x26db06[_0x4c58('0x30')][_0x4c58('0x35')]));_0x195e5a[_0x4c58('0x34')]=_0x195e5a['attributes']['length']?_0x195e5a['attributes']:_0x31a34f[_0x4c58('0x33')];_0x195e5a[_0x4c58('0x3a')]=qs[_0x4c58('0x5a')](_0x26db06[_0x4c58('0x30')]['sort']);_0x195e5a[_0x4c58('0x3d')]=qs['filters'](_[_0x4c58('0x60')](_0x26db06[_0x4c58('0x30')],_0x31a34f[_0x4c58('0x3b')]));if(_0x26db06[_0x4c58('0x30')][_0x4c58('0x3c')]){_0x195e5a[_0x4c58('0x3d')]=_[_0x4c58('0x47')](_0x195e5a[_0x4c58('0x3d')],{'$or':_[_0x4c58('0x2c')](_0x195e5a[_0x4c58('0x34')],function(_0x4e444a){var _0x42f667={};_0x42f667[_0x4e444a]={'$like':'%'+_0x26db06[_0x4c58('0x30')][_0x4c58('0x3c')]+'%'};return _0x42f667;})});}_0x195e5a=_[_0x4c58('0x47')]({},_0x195e5a,_0x26db06[_0x4c58('0x3f')]);return _0x4aa856['getBlackLists'](_0x195e5a);}})[_0x4c58('0x22')](function(_0x3f9128){if(_0x3f9128){_0x2c314b=_0x3f9128['length'];if(!_0x26db06[_0x4c58('0x30')][_0x4c58('0x37')](_0x4c58('0x38'))){_0x195e5a[_0x4c58('0x39')]=qs[_0x4c58('0x39')](_0x26db06['query'][_0x4c58('0x39')]);_0x195e5a[_0x4c58('0x19')]=qs[_0x4c58('0x19')](_0x26db06[_0x4c58('0x30')][_0x4c58('0x19')]);}return _0x4aa856[_0x4c58('0x8b')](_0x195e5a);}})[_0x4c58('0x22')](function(_0xce9713){if(_0xce9713){return _0xce9713?{'count':_0x2c314b,'rows':_0xce9713}:null;}})['then'](respondWithResult(_0x892b6d,null))['catch'](handleError(_0x892b6d,null));};exports[_0x4c58('0x8d')]=function(_0x1560a9,_0x38507c,_0x506d7d){var _0x326a4,_0x2e0fd4;var _0x34efd0=[];var _0x57f8cb=moment()[_0x4c58('0x64')](_0x4c58('0x8e'));return db[_0x4c58('0x2d')][_0x4c58('0x4d')]({'where':{'id':_0x1560a9[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x38507c,null))[_0x4c58('0x22')](function(_0x343284){if(_0x343284){_0x2e0fd4=_0x343284;return _0x343284[_0x4c58('0x8d')](_0x1560a9['body'][_0x4c58('0x65')],_['omit'](_0x1560a9[_0x4c58('0x49')],['ids','id'])||{});}return null;})[_0x4c58('0x8f')](function(_0x411be4){var _0x361231;var _0x5e897c;_0x326a4=_0x411be4||[];var _0x3d850a=[];if(_0x411be4){for(var _0x1fb5cf=0x0;_0x1fb5cf<_0x411be4[_0x4c58('0x36')];_0x1fb5cf+=0x1){var _0x53cae5=_0x411be4[_0x1fb5cf]['get']({'plain':!![]});_0x361231=squel[_0x4c58('0x67')]()[_0x4c58('0x68')](_0x4c58('0x90'))['fromQuery']([_0x4c58('0x6e'),_0x4c58('0x6c'),_0x4c58('0x72'),_0x4c58('0x5b'),_0x4c58('0x54'),_0x4c58('0x53')],squel['select']()[_0x4c58('0x6d')]('phone',_0x4c58('0x6e'))[_0x4c58('0x6d')]('id','ContactId')[_0x4c58('0x6d')](_0x53cae5[_0x4c58('0x70')][_0x4c58('0x71')](),'ListId')[_0x4c58('0x6d')](_0x1560a9[_0x4c58('0x46')]['id'][_0x4c58('0x71')](),_0x4c58('0x5b'))[_0x4c58('0x6d')]('NOW()',_0x4c58('0x54'))[_0x4c58('0x6d')]('NOW()',_0x4c58('0x53'))[_0x4c58('0x79')](_0x4c58('0x73'))['where']('deletedAt\x20IS\x20NULL')[_0x4c58('0x3d')]('ListId\x20=\x20?',_0x53cae5['CmListId']['toString']())[_0x4c58('0x3d')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x3d850a[_0x4c58('0x89')](db[_0x4c58('0x88')]['query'](_0x361231));}return BPromise[_0x4c58('0x91')](_0x3d850a);}})[_0x4c58('0x22')](function(){return _0x326a4;})[_0x4c58('0x22')](respondWithResult(_0x38507c,null))[_0x4c58('0x44')](handleError(_0x38507c,null));};exports[_0x4c58('0x92')]=function(_0x1b1d7a,_0x39839d,_0x562bc3){return db[_0x4c58('0x2d')]['find']({'where':{'id':_0x1b1d7a['params']['id']}})[_0x4c58('0x22')](handleEntityNotFound(_0x39839d,null))['then'](function(_0x164579){if(_0x164579){return _0x164579[_0x4c58('0x92')](_0x1b1d7a['query']['ids']);}})['then'](function(_0x253cec){if(_0x253cec){return db[_0x4c58('0x61')][_0x4c58('0x23')]({'where':{'ListId':_0x1b1d7a[_0x4c58('0x30')][_0x4c58('0x65')],'CampaignId':_0x1b1d7a[_0x4c58('0x46')]['id']}})[_0x4c58('0x22')](function(){return _0x253cec;});}})[_0x4c58('0x22')](respondWithStatusCode(_0x39839d,null))[_0x4c58('0x44')](handleError(_0x39839d,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 5cb9876..97b03d4 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 _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 87b6c81..dd7d669 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 _0x6c50=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s,\x20%s','error','Campaign,\x20%s,\x20%s','message','request\x20sent','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','map','include','model','debug','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x58a614,_0x9f5ab6){var _0x3d4f7f=function(_0x43cdf8){while(--_0x43cdf8){_0x58a614['push'](_0x58a614['shift']());}};_0x3d4f7f(++_0x9f5ab6);}(_0x6c50,0xa4));var _0x06c5=function(_0x14693c,_0x43ff4a){_0x14693c=_0x14693c-0x0;var _0x287fcb=_0x6c50[_0x14693c];return _0x287fcb;};'use strict';var _=require(_0x06c5('0x0'));var util=require(_0x06c5('0x1'));var moment=require(_0x06c5('0x2'));var BPromise=require(_0x06c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06c5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x06c5('0x5'));var logger=require(_0x06c5('0x6'))(_0x06c5('0x7'));var config=require(_0x06c5('0x8'));var jayson=require(_0x06c5('0x9'));var client=jayson[_0x06c5('0xa')][_0x06c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x427dd6,_0x181c7f,_0x17c636){return new BPromise(function(_0x154b0a,_0x546ae5){return client[_0x06c5('0xc')](_0x427dd6,_0x17c636)[_0x06c5('0xd')](function(_0x3010af){logger[_0x06c5('0xe')]('Campaign,\x20%s,\x20%s',_0x181c7f,'request\x20sent');logger['debug'](_0x06c5('0xf'),_0x181c7f,'request\x20sent',JSON['stringify'](_0x3010af));if(_0x3010af['error']){if(_0x3010af[_0x06c5('0x10')]['code']===0x1f4){logger[_0x06c5('0x10')](_0x06c5('0x11'),_0x181c7f,_0x3010af[_0x06c5('0x10')]['message']);return _0x546ae5(_0x3010af[_0x06c5('0x10')][_0x06c5('0x12')]);}logger[_0x06c5('0x10')](_0x06c5('0x11'),_0x181c7f,_0x3010af['error']['message']);return _0x154b0a(_0x3010af[_0x06c5('0x10')][_0x06c5('0x12')]);}else{logger[_0x06c5('0xe')]('Campaign,\x20%s,\x20%s',_0x181c7f,_0x06c5('0x13'));_0x154b0a(_0x3010af[_0x06c5('0x14')]['message']);}})[_0x06c5('0x15')](function(_0x9045e6){logger[_0x06c5('0x10')](_0x06c5('0x11'),_0x181c7f,_0x9045e6);_0x546ae5(_0x9045e6);});});}exports[_0x06c5('0x16')]=function(_0x36b9e9){var _0x44d14e=this;return new Promise(function(_0x18a070,_0x1393f5){return db[_0x06c5('0x17')][_0x06c5('0x18')]({'raw':_0x36b9e9[_0x06c5('0x19')]?_0x36b9e9[_0x06c5('0x19')][_0x06c5('0x1a')]===undefined?!![]:![]:!![],'where':_0x36b9e9[_0x06c5('0x19')]?_0x36b9e9[_0x06c5('0x19')][_0x06c5('0x1b')]||null:null,'attributes':_0x36b9e9['options']?_0x36b9e9[_0x06c5('0x19')][_0x06c5('0x1c')]||null:null,'limit':_0x36b9e9[_0x06c5('0x19')]?_0x36b9e9[_0x06c5('0x19')][_0x06c5('0x1d')]||null:null,'include':_0x36b9e9[_0x06c5('0x19')]?_0x36b9e9[_0x06c5('0x19')]['include']?_[_0x06c5('0x1e')](_0x36b9e9[_0x06c5('0x19')][_0x06c5('0x1f')],function(_0x20ba9e){return{'model':db[_0x20ba9e[_0x06c5('0x20')]],'as':_0x20ba9e['as'],'attributes':_0x20ba9e[_0x06c5('0x1c')],'include':_0x20ba9e[_0x06c5('0x1f')]?_['map'](_0x20ba9e[_0x06c5('0x1f')],function(_0x5aeb6c){return{'model':db[_0x5aeb6c['model']],'as':_0x5aeb6c['as'],'attributes':_0x5aeb6c['attributes'],'include':_0x5aeb6c['include']?_[_0x06c5('0x1e')](_0x5aeb6c[_0x06c5('0x1f')],function(_0x1067e1){return{'model':db[_0x1067e1[_0x06c5('0x20')]],'as':_0x1067e1['as'],'attributes':_0x1067e1[_0x06c5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x221965){logger[_0x06c5('0xe')](_0x06c5('0x16'),_0x36b9e9);logger[_0x06c5('0x21')](_0x06c5('0x16'),_0x36b9e9,JSON['stringify'](_0x221965));_0x18a070(_0x221965);})[_0x06c5('0x15')](function(_0x432de5){logger[_0x06c5('0x10')]('GetCampaign',_0x432de5[_0x06c5('0x12')],_0x36b9e9);_0x1393f5(_0x44d14e[_0x06c5('0x10')](0x1f4,_0x432de5[_0x06c5('0x12')]));});});}; \ No newline at end of file +var _0x3140=['include','map','model','then','GetCampaign','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','catch','Campaign','findAll','options','where','attributes','limit'];(function(_0x91fbca,_0x249f60){var _0x582ad8=function(_0x248c20){while(--_0x248c20){_0x91fbca['push'](_0x91fbca['shift']());}};_0x582ad8(++_0x249f60);}(_0x3140,0xaf));var _0x0314=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0x3140[_0x3861f7];return _0x50879f;};'use strict';var _=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var moment=require(_0x0314('0x2'));var BPromise=require(_0x0314('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0314('0x4'))['db'];var utils=require(_0x0314('0x5'));var logger=require(_0x0314('0x6'))(_0x0314('0x7'));var config=require(_0x0314('0x8'));var jayson=require(_0x0314('0x9'));var client=jayson[_0x0314('0xa')][_0x0314('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11ee94,_0x44762d,_0x176944){return new BPromise(function(_0x495b27,_0x26031f){return client[_0x0314('0xc')](_0x11ee94,_0x176944)['then'](function(_0x5e9bca){logger[_0x0314('0xd')]('Campaign,\x20%s,\x20%s',_0x44762d,_0x0314('0xe'));logger[_0x0314('0xf')](_0x0314('0x10'),_0x44762d,_0x0314('0xe'),JSON[_0x0314('0x11')](_0x5e9bca));if(_0x5e9bca[_0x0314('0x12')]){if(_0x5e9bca['error'][_0x0314('0x13')]===0x1f4){logger[_0x0314('0x12')](_0x0314('0x14'),_0x44762d,_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);return _0x26031f(_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);}logger['error'](_0x0314('0x14'),_0x44762d,_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);return _0x495b27(_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);}else{logger[_0x0314('0xd')](_0x0314('0x14'),_0x44762d,_0x0314('0xe'));_0x495b27(_0x5e9bca['result'][_0x0314('0x15')]);}})[_0x0314('0x16')](function(_0x1f23c6){logger['error'](_0x0314('0x14'),_0x44762d,_0x1f23c6);_0x26031f(_0x1f23c6);});});}exports['GetCampaign']=function(_0x575b68){var _0x39db0b=this;return new Promise(function(_0x329679,_0x583d39){return db[_0x0314('0x17')][_0x0314('0x18')]({'raw':_0x575b68['options']?_0x575b68[_0x0314('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x575b68[_0x0314('0x19')]?_0x575b68[_0x0314('0x19')][_0x0314('0x1a')]||null:null,'attributes':_0x575b68[_0x0314('0x19')]?_0x575b68[_0x0314('0x19')][_0x0314('0x1b')]||null:null,'limit':_0x575b68['options']?_0x575b68['options'][_0x0314('0x1c')]||null:null,'include':_0x575b68[_0x0314('0x19')]?_0x575b68[_0x0314('0x19')][_0x0314('0x1d')]?_[_0x0314('0x1e')](_0x575b68[_0x0314('0x19')]['include'],function(_0x3c743e){return{'model':db[_0x3c743e[_0x0314('0x1f')]],'as':_0x3c743e['as'],'attributes':_0x3c743e['attributes'],'include':_0x3c743e[_0x0314('0x1d')]?_[_0x0314('0x1e')](_0x3c743e[_0x0314('0x1d')],function(_0x26c6a4){return{'model':db[_0x26c6a4[_0x0314('0x1f')]],'as':_0x26c6a4['as'],'attributes':_0x26c6a4[_0x0314('0x1b')],'include':_0x26c6a4['include']?_[_0x0314('0x1e')](_0x26c6a4[_0x0314('0x1d')],function(_0x2d636b){return{'model':db[_0x2d636b['model']],'as':_0x2d636b['as'],'attributes':_0x2d636b[_0x0314('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0314('0x20')](function(_0x47c102){logger['info'](_0x0314('0x21'),_0x575b68);logger[_0x0314('0xf')]('GetCampaign',_0x575b68,JSON[_0x0314('0x11')](_0x47c102));_0x329679(_0x47c102);})[_0x0314('0x16')](function(_0x5291c2){logger['error'](_0x0314('0x21'),_0x5291c2[_0x0314('0x15')],_0x575b68);_0x583d39(_0x39db0b['error'](0x1f4,_0x5291c2[_0x0314('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 8c660f0..b097848 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 _0xfb58=['removeLists','/:id/blacklists','removeBlackLists','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','isAuthenticated','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','create','post','/:id/clone','clone','addLists','addBlackLists','delete','destroy','/:id/lists'];(function(_0x34fa28,_0x3ffb30){var _0x32168d=function(_0x1c3325){while(--_0x1c3325){_0x34fa28['push'](_0x34fa28['shift']());}};_0x32168d(++_0x3ffb30);}(_0xfb58,0x143));var _0x8fb5=function(_0x1ce4e6,_0xc91285){_0x1ce4e6=_0x1ce4e6-0x0;var _0x3cbdaa=_0xfb58[_0x1ce4e6];return _0x3cbdaa;};'use strict';var multer=require(_0x8fb5('0x0'));var util=require(_0x8fb5('0x1'));var path=require(_0x8fb5('0x2'));var timeout=require(_0x8fb5('0x3'));var express=require('express');var router=express[_0x8fb5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8fb5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8fb5('0x6'));var controller=require('./campaign.controller');router[_0x8fb5('0x7')]('/',auth['isAuthenticated'](),controller[_0x8fb5('0x8')]);router['get'](_0x8fb5('0x9'),auth['isAuthenticated'](),controller[_0x8fb5('0xa')]);router[_0x8fb5('0x7')](_0x8fb5('0xb'),auth['isAuthenticated'](),controller[_0x8fb5('0xc')]);router[_0x8fb5('0x7')](_0x8fb5('0xd'),auth[_0x8fb5('0xe')](),controller['getHopperHistories']);router[_0x8fb5('0x7')](_0x8fb5('0xf'),auth[_0x8fb5('0xe')](),controller[_0x8fb5('0x10')]);router[_0x8fb5('0x7')](_0x8fb5('0x11'),auth[_0x8fb5('0xe')](),controller[_0x8fb5('0x12')]);router['get']('/:id/lists',auth[_0x8fb5('0xe')](),controller[_0x8fb5('0x13')]);router['get']('/:id/blacklists',auth[_0x8fb5('0xe')](),controller['getBlackLists']);router['post']('/',auth[_0x8fb5('0xe')](),controller[_0x8fb5('0x14')]);router[_0x8fb5('0x15')](_0x8fb5('0x16'),auth['isAuthenticated'](),controller[_0x8fb5('0x17')]);router[_0x8fb5('0x15')]('/:id/lists',auth[_0x8fb5('0xe')](),controller[_0x8fb5('0x18')]);router['post']('/:id/blacklists',auth[_0x8fb5('0xe')](),controller[_0x8fb5('0x19')]);router['put'](_0x8fb5('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x8fb5('0x1a')](_0x8fb5('0x9'),auth[_0x8fb5('0xe')](),controller[_0x8fb5('0x1b')]);router[_0x8fb5('0x1a')](_0x8fb5('0x1c'),auth['isAuthenticated'](),controller[_0x8fb5('0x1d')]);router['delete'](_0x8fb5('0x1e'),auth[_0x8fb5('0xe')](),controller[_0x8fb5('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x3786=['put','update','delete','/:id','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','show','/:id/hoppers','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists'];(function(_0x13b947,_0x65c4df){var _0x803766=function(_0x5e363f){while(--_0x5e363f){_0x13b947['push'](_0x13b947['shift']());}};_0x803766(++_0x65c4df);}(_0x3786,0x13b));var _0x6378=function(_0x231422,_0x26fcd3){_0x231422=_0x231422-0x0;var _0x520643=_0x3786[_0x231422];return _0x520643;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6378('0x0'));var timeout=require(_0x6378('0x1'));var express=require(_0x6378('0x2'));var router=express[_0x6378('0x3')]();var fs_extra=require(_0x6378('0x4'));var auth=require(_0x6378('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6378('0x6'));var controller=require(_0x6378('0x7'));router['get']('/',auth[_0x6378('0x8')](),controller[_0x6378('0x9')]);router[_0x6378('0xa')]('/:id',auth[_0x6378('0x8')](),controller[_0x6378('0xb')]);router[_0x6378('0xa')](_0x6378('0xc'),auth[_0x6378('0x8')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0x6378('0x8')](),controller['getHopperHistories']);router[_0x6378('0xa')](_0x6378('0xd'),auth[_0x6378('0x8')](),controller[_0x6378('0xe')]);router[_0x6378('0xa')](_0x6378('0xf'),auth[_0x6378('0x8')](),controller['getHopperBlacks']);router[_0x6378('0xa')](_0x6378('0x10'),auth[_0x6378('0x8')](),controller[_0x6378('0x11')]);router['get'](_0x6378('0x12'),auth[_0x6378('0x8')](),controller[_0x6378('0x13')]);router[_0x6378('0x14')]('/',auth[_0x6378('0x8')](),controller[_0x6378('0x15')]);router[_0x6378('0x14')](_0x6378('0x16'),auth['isAuthenticated'](),controller[_0x6378('0x17')]);router[_0x6378('0x14')](_0x6378('0x10'),auth[_0x6378('0x8')](),controller[_0x6378('0x18')]);router[_0x6378('0x14')]('/:id/blacklists',auth[_0x6378('0x8')](),controller[_0x6378('0x19')]);router[_0x6378('0x1a')]('/:id',auth[_0x6378('0x8')](),controller[_0x6378('0x1b')]);router[_0x6378('0x1c')](_0x6378('0x1d'),auth[_0x6378('0x8')](),controller['destroy']);router[_0x6378('0x1c')]('/:id/lists',auth[_0x6378('0x8')](),controller['removeLists']);router[_0x6378('0x1c')](_0x6378('0x12'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x6378('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 3f07e79..d3f1afe 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 _0x5fff=['VIRTUAL','getDataValue','key','sequelize','exports','TEXT','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5fff,0x192));var _0xf5ff=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x5fff[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require(_0xf5ff('0x0'));module[_0xf5ff('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xf5ff('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf5ff('0x3')]},'name':{'type':Sequelize[_0xf5ff('0x4')],'get':function(){return this[_0xf5ff('0x5')](_0xf5ff('0x6'));}}}; \ No newline at end of file +var _0xd5d6=['STRING','VIRTUAL','getDataValue','sequelize'];(function(_0x1a4de0,_0xd775ac){var _0x179477=function(_0x147d13){while(--_0x147d13){_0x1a4de0['push'](_0x1a4de0['shift']());}};_0x179477(++_0xd775ac);}(_0xd5d6,0x77));var _0x6d5d=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xd5d6[_0x6cf19c];return _0xce14f3;};'use strict';var Sequelize=require(_0x6d5d('0x0'));module['exports']={'key':{'type':Sequelize[_0x6d5d('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x6d5d('0x2')],'get':function(){return this[_0x6d5d('0x3')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index c466ce2..5a97670 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 _0xd059=['fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','reject','save','update','destroy','get','CannedAnswers','UserProfileResource','then','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','options','CannedAnswer','include','findAll','catch','params','includeAll','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir'];(function(_0x4d1a40,_0x1f8a23){var _0x17b93d=function(_0x169abd){while(--_0x169abd){_0x4d1a40['push'](_0x4d1a40['shift']());}};_0x17b93d(++_0x1f8a23);}(_0xd059,0xad));var _0x9d05=function(_0x45f7ef,_0xd74dc7){_0x45f7ef=_0x45f7ef-0x0;var _0x566b54=_0xd059[_0x45f7ef];return _0x566b54;};'use strict';var emlformat=require(_0x9d05('0x0'));var rimraf=require(_0x9d05('0x1'));var zipdir=require(_0x9d05('0x2'));var jsonpatch=require(_0x9d05('0x3'));var rp=require(_0x9d05('0x4'));var moment=require(_0x9d05('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9d05('0x6'));var path=require(_0x9d05('0x7'));var sox=require(_0x9d05('0x8'));var csv=require(_0x9d05('0x9'));var ejs=require(_0x9d05('0xa'));var fs=require('fs');var fs_extra=require(_0x9d05('0xb'));var _=require(_0x9d05('0xc'));var squel=require(_0x9d05('0xd'));var crypto=require(_0x9d05('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9d05('0xf'));var toCsv=require(_0x9d05('0x9'));var querystring=require(_0x9d05('0x10'));var Papa=require(_0x9d05('0x11'));var Redis=require(_0x9d05('0x12'));var authService=require(_0x9d05('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9d05('0x14'));var hardwareService=require(_0x9d05('0x15'));var logger=require(_0x9d05('0x16'))(_0x9d05('0x17'));var utils=require('../../config/utils');var config=require(_0x9d05('0x18'));var licenseUtil=require(_0x9d05('0x19'));var db=require(_0x9d05('0x1a'))['db'];function respondWithStatusCode(_0x2e8ae8,_0x45a13e){_0x45a13e=_0x45a13e||0xcc;return function(_0xab5dd8){if(_0xab5dd8){return _0x2e8ae8[_0x9d05('0x1b')](_0x45a13e);}return _0x2e8ae8['status'](_0x45a13e)[_0x9d05('0x1c')]();};}function respondWithResult(_0x851099,_0x1484a1){_0x1484a1=_0x1484a1||0xc8;return function(_0x23b0b9){if(_0x23b0b9){return _0x851099[_0x9d05('0x1d')](_0x1484a1)[_0x9d05('0x1e')](_0x23b0b9);}};}function respondWithFilteredResult(_0xfbe7b4,_0x1936b1){return function(_0x424028){if(_0x424028){var _0x19c6e7=typeof _0x1936b1[_0x9d05('0x1f')]==='undefined'&&typeof _0x1936b1[_0x9d05('0x20')]===_0x9d05('0x21');var _0x12a1b4=_0x424028[_0x9d05('0x22')];var _0x30576f=_0x19c6e7?0x0:_0x1936b1[_0x9d05('0x1f')];var _0x323982=_0x19c6e7?_0x424028[_0x9d05('0x22')]:_0x1936b1[_0x9d05('0x1f')]+_0x1936b1[_0x9d05('0x20')];var _0xd73c37;if(_0x323982>=_0x12a1b4){_0x323982=_0x12a1b4;_0xd73c37=0xc8;}else{_0xd73c37=0xce;}_0xfbe7b4[_0x9d05('0x1d')](_0xd73c37);return _0xfbe7b4['set']('Content-Range',_0x30576f+'-'+_0x323982+'/'+_0x12a1b4)['json'](_0x424028);}return null;};}function patchUpdates(_0x5ae4a9){return function(_0x2ba4af){try{jsonpatch['apply'](_0x2ba4af,_0x5ae4a9,!![]);}catch(_0x54ab92){return BPromise[_0x9d05('0x23')](_0x54ab92);}return _0x2ba4af[_0x9d05('0x24')]();};}function saveUpdates(_0xd5eec5,_0x3b1ef5){return function(_0x5ef4c8){if(_0x5ef4c8){return _0x5ef4c8[_0x9d05('0x25')](_0xd5eec5)['then'](function(_0x3b6f83){return _0x3b6f83;});}return null;};}function removeEntity(_0x5c4e10,_0x4a180f){return function(_0x2a6bc5){if(_0x2a6bc5){return _0x2a6bc5[_0x9d05('0x26')]()['then'](function(){var _0x3350ca=_0x2a6bc5[_0x9d05('0x27')]({'plain':!![]});var _0x5877e9=_0x9d05('0x28');return db[_0x9d05('0x29')]['destroy']({'where':{'type':_0x5877e9,'resourceId':_0x3350ca['id']}})[_0x9d05('0x2a')](function(){return _0x2a6bc5;});})['then'](function(){_0x5c4e10[_0x9d05('0x1d')](0xcc)[_0x9d05('0x1c')]();});}};}function handleEntityNotFound(_0x1480fb,_0x1f5736){return function(_0x13d116){if(!_0x13d116){_0x1480fb[_0x9d05('0x1b')](0x194);}return _0x13d116;};}function handleError(_0x4a3632,_0x6aebe){_0x6aebe=_0x6aebe||0x1f4;return function(_0x2d7dbd){logger['error'](_0x2d7dbd[_0x9d05('0x2b')]);if(_0x2d7dbd[_0x9d05('0x2c')]){delete _0x2d7dbd['name'];}_0x4a3632[_0x9d05('0x1d')](_0x6aebe)['send'](_0x2d7dbd);};}exports[_0x9d05('0x2d')]=function(_0xbed60b,_0xc19ccd){var _0x5a4871={},_0x57c8e3={},_0x115e9e={'count':0x0,'rows':[]};var _0x216f63=_[_0x9d05('0x2e')](db['CannedAnswer'][_0x9d05('0x2f')],function(_0x1e7180){return{'name':_0x1e7180[_0x9d05('0x30')],'type':_0x1e7180[_0x9d05('0x31')][_0x9d05('0x32')]};});_0x57c8e3[_0x9d05('0x33')]=_['map'](_0x216f63,'name');_0x57c8e3['query']=_[_0x9d05('0x34')](_0xbed60b[_0x9d05('0x35')]);_0x57c8e3['filters']=_['intersection'](_0x57c8e3[_0x9d05('0x33')],_0x57c8e3[_0x9d05('0x35')]);_0x5a4871[_0x9d05('0x36')]=_[_0x9d05('0x37')](_0x57c8e3[_0x9d05('0x33')],qs[_0x9d05('0x38')](_0xbed60b[_0x9d05('0x35')][_0x9d05('0x38')]));_0x5a4871['attributes']=_0x5a4871[_0x9d05('0x36')][_0x9d05('0x39')]?_0x5a4871[_0x9d05('0x36')]:_0x57c8e3[_0x9d05('0x33')];if(!_0xbed60b[_0x9d05('0x35')][_0x9d05('0x3a')](_0x9d05('0x3b'))){_0x5a4871[_0x9d05('0x20')]=qs[_0x9d05('0x20')](_0xbed60b[_0x9d05('0x35')]['limit']);_0x5a4871['offset']=qs[_0x9d05('0x1f')](_0xbed60b['query'][_0x9d05('0x1f')]);}_0x5a4871['order']=qs[_0x9d05('0x3c')](_0xbed60b[_0x9d05('0x35')]['sort']);_0x5a4871['where']=qs['filters'](_[_0x9d05('0x3d')](_0xbed60b[_0x9d05('0x35')],_0x57c8e3[_0x9d05('0x3e')]),_0x216f63);if(_0xbed60b[_0x9d05('0x35')][_0x9d05('0x3f')]){_0x5a4871[_0x9d05('0x40')]=_[_0x9d05('0x41')](_0x5a4871[_0x9d05('0x40')],{'$or':[{'key':{'$like':'%'+_0xbed60b['query'][_0x9d05('0x3f')]+'%'}},{'value':{'$like':'%'+_0xbed60b[_0x9d05('0x35')][_0x9d05('0x3f')]+'%'}}]});}_0x5a4871=_[_0x9d05('0x41')]({},_0x5a4871,_0xbed60b[_0x9d05('0x42')]);var _0x3604ed={'where':_0x5a4871[_0x9d05('0x40')]};return db[_0x9d05('0x43')][_0x9d05('0x22')](_0x3604ed)[_0x9d05('0x2a')](function(_0x453b9c){_0x115e9e[_0x9d05('0x22')]=_0x453b9c;if(_0xbed60b[_0x9d05('0x35')]['includeAll']){_0x5a4871[_0x9d05('0x44')]=[{'all':!![]}];}return db[_0x9d05('0x43')][_0x9d05('0x45')](_0x5a4871);})['then'](function(_0x334b53){_0x115e9e['rows']=_0x334b53;return _0x115e9e;})['then'](respondWithFilteredResult(_0xc19ccd,_0x5a4871))[_0x9d05('0x46')](handleError(_0xc19ccd,null));};exports['show']=function(_0x3d0491,_0x32ad8c){var _0x19c6ca={'raw':!![],'where':{'id':_0x3d0491[_0x9d05('0x47')]['id']}},_0x4c9ee6={};_0x4c9ee6[_0x9d05('0x33')]=_[_0x9d05('0x34')](db[_0x9d05('0x43')][_0x9d05('0x2f')]);_0x4c9ee6[_0x9d05('0x35')]=_[_0x9d05('0x34')](_0x3d0491[_0x9d05('0x35')]);_0x4c9ee6[_0x9d05('0x3e')]=_[_0x9d05('0x37')](_0x4c9ee6[_0x9d05('0x33')],_0x4c9ee6['query']);_0x19c6ca['attributes']=_[_0x9d05('0x37')](_0x4c9ee6['model'],qs[_0x9d05('0x38')](_0x3d0491['query'][_0x9d05('0x38')]));_0x19c6ca['attributes']=_0x19c6ca['attributes'][_0x9d05('0x39')]?_0x19c6ca[_0x9d05('0x36')]:_0x4c9ee6['model'];if(_0x3d0491[_0x9d05('0x35')][_0x9d05('0x48')]){_0x19c6ca[_0x9d05('0x44')]=[{'all':!![]}];}_0x19c6ca=_['merge']({},_0x19c6ca,_0x3d0491[_0x9d05('0x42')]);return db['CannedAnswer'][_0x9d05('0x49')](_0x19c6ca)[_0x9d05('0x2a')](handleEntityNotFound(_0x32ad8c,null))[_0x9d05('0x2a')](respondWithResult(_0x32ad8c,null))[_0x9d05('0x46')](handleError(_0x32ad8c,null));};exports['update']=function(_0x23806b,_0x5d5490){if(_0x23806b[_0x9d05('0x4a')]['id']){delete _0x23806b['body']['id'];}return db[_0x9d05('0x43')][_0x9d05('0x49')]({'where':{'id':_0x23806b[_0x9d05('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d5490,null))[_0x9d05('0x2a')](saveUpdates(_0x23806b[_0x9d05('0x4a')],null))['then'](respondWithResult(_0x5d5490,null))[_0x9d05('0x46')](handleError(_0x5d5490,null));};exports[_0x9d05('0x26')]=function(_0x2cc402,_0x76bc03){return db[_0x9d05('0x43')][_0x9d05('0x49')]({'where':{'id':_0x2cc402[_0x9d05('0x47')]['id']}})[_0x9d05('0x2a')](handleEntityNotFound(_0x76bc03,null))[_0x9d05('0x2a')](removeEntity(_0x76bc03,null))[_0x9d05('0x46')](handleError(_0x76bc03,null));};exports[_0x9d05('0x4b')]=function(_0x26317e,_0x2e20a7){var _0x325311={'key':_0x26317e['body']['key']};if(_0x26317e['body']['MailAccountId']){_0x325311['MailAccountId']=_0x26317e[_0x9d05('0x4a')][_0x9d05('0x4c')];}else if(_0x26317e[_0x9d05('0x4a')][_0x9d05('0x4d')]){_0x325311[_0x9d05('0x4d')]=_0x26317e[_0x9d05('0x4a')][_0x9d05('0x4d')];}else if(_0x26317e['body']['OpenchannelAccountId']){_0x325311['OpenchannelAccountId']=_0x26317e['body'][_0x9d05('0x4e')];}else if(_0x26317e[_0x9d05('0x4a')][_0x9d05('0x4f')]){_0x325311['ChatWebsiteId']=_0x26317e[_0x9d05('0x4a')][_0x9d05('0x4f')];}return db[_0x9d05('0x43')][_0x9d05('0x49')]({'where':_0x325311})[_0x9d05('0x2a')](function(_0x452334){if(_0x452334){throw new db['Sequelize'][(_0x9d05('0x50'))](_0x9d05('0x51'));}return db[_0x9d05('0x43')]['create'](_0x26317e[_0x9d05('0x4a')]);})[_0x9d05('0x2a')](function(_0x2ec2c5){var _0x4a9218=_0x26317e[_0x9d05('0x52')][_0x9d05('0x27')]({'plain':!![]});if(!_0x4a9218)throw new Error(_0x9d05('0x53'));if(_0x4a9218['role']===_0x9d05('0x52')){var _0x14c8d5=_0x2ec2c5['get']({'plain':!![]});return db['UserProfileSection'][_0x9d05('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x4a9218[_0x9d05('0x54')]},'raw':!![]})[_0x9d05('0x2a')](function(_0x54ce59){if(_0x54ce59&&_0x54ce59[_0x9d05('0x55')]===0x0){return db[_0x9d05('0x29')][_0x9d05('0x4b')]({'name':_0x14c8d5[_0x9d05('0x2c')],'resourceId':_0x14c8d5['id'],'type':_0x54ce59[_0x9d05('0x2c')],'sectionId':_0x54ce59['id']},{})[_0x9d05('0x2a')](function(){return _0x2ec2c5;});}else{return _0x2ec2c5;}})[_0x9d05('0x46')](function(_0x1e1001){logger[_0x9d05('0x56')](_0x9d05('0x57'),_0x1e1001);throw _0x1e1001;});}return _0x2ec2c5;})[_0x9d05('0x2a')](respondWithResult(_0x2e20a7,0xc9))[_0x9d05('0x46')](handleError(_0x2e20a7,null));}; \ No newline at end of file +var _0xe3b6=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','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/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','filter','options','CannedAnswer','includeAll','findAll','catch','keys','include','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xe3b6,0x175));var _0x6e3b=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe3b6[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x6e3b('0x0'));var rimraf=require(_0x6e3b('0x1'));var zipdir=require(_0x6e3b('0x2'));var jsonpatch=require(_0x6e3b('0x3'));var rp=require(_0x6e3b('0x4'));var moment=require(_0x6e3b('0x5'));var BPromise=require(_0x6e3b('0x6'));var Mustache=require(_0x6e3b('0x7'));var util=require(_0x6e3b('0x8'));var path=require(_0x6e3b('0x9'));var sox=require(_0x6e3b('0xa'));var csv=require('to-csv');var ejs=require(_0x6e3b('0xb'));var fs=require('fs');var fs_extra=require(_0x6e3b('0xc'));var _=require('lodash');var squel=require(_0x6e3b('0xd'));var crypto=require(_0x6e3b('0xe'));var jsforce=require(_0x6e3b('0xf'));var deskjs=require(_0x6e3b('0x10'));var toCsv=require(_0x6e3b('0x11'));var querystring=require(_0x6e3b('0x12'));var Papa=require(_0x6e3b('0x13'));var Redis=require(_0x6e3b('0x14'));var authService=require(_0x6e3b('0x15'));var qs=require(_0x6e3b('0x16'));var as=require(_0x6e3b('0x17'));var hardwareService=require(_0x6e3b('0x18'));var logger=require(_0x6e3b('0x19'))(_0x6e3b('0x1a'));var utils=require(_0x6e3b('0x1b'));var config=require(_0x6e3b('0x1c'));var licenseUtil=require(_0x6e3b('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c9882,_0xb464c4){_0xb464c4=_0xb464c4||0xcc;return function(_0x5b2657){if(_0x5b2657){return _0x3c9882['sendStatus'](_0xb464c4);}return _0x3c9882[_0x6e3b('0x1e')](_0xb464c4)[_0x6e3b('0x1f')]();};}function respondWithResult(_0x1884d7,_0x51f07c){_0x51f07c=_0x51f07c||0xc8;return function(_0x48900b){if(_0x48900b){return _0x1884d7[_0x6e3b('0x1e')](_0x51f07c)[_0x6e3b('0x20')](_0x48900b);}};}function respondWithFilteredResult(_0x81d6dc,_0x43063a){return function(_0x1b598f){if(_0x1b598f){var _0x3de81a=typeof _0x43063a[_0x6e3b('0x21')]===_0x6e3b('0x22')&&typeof _0x43063a[_0x6e3b('0x23')]===_0x6e3b('0x22');var _0x1ebd9d=_0x1b598f[_0x6e3b('0x24')];var _0x322fbb=_0x3de81a?0x0:_0x43063a[_0x6e3b('0x21')];var _0x298353=_0x3de81a?_0x1b598f[_0x6e3b('0x24')]:_0x43063a['offset']+_0x43063a[_0x6e3b('0x23')];var _0x2cdd80;if(_0x298353>=_0x1ebd9d){_0x298353=_0x1ebd9d;_0x2cdd80=0xc8;}else{_0x2cdd80=0xce;}_0x81d6dc[_0x6e3b('0x1e')](_0x2cdd80);return _0x81d6dc[_0x6e3b('0x25')](_0x6e3b('0x26'),_0x322fbb+'-'+_0x298353+'/'+_0x1ebd9d)[_0x6e3b('0x20')](_0x1b598f);}return null;};}function patchUpdates(_0x57c033){return function(_0x817739){try{jsonpatch[_0x6e3b('0x27')](_0x817739,_0x57c033,!![]);}catch(_0x45e48d){return BPromise[_0x6e3b('0x28')](_0x45e48d);}return _0x817739[_0x6e3b('0x29')]();};}function saveUpdates(_0x3b4d20,_0x3a9319){return function(_0x43389e){if(_0x43389e){return _0x43389e[_0x6e3b('0x2a')](_0x3b4d20)[_0x6e3b('0x2b')](function(_0x4f4a8c){return _0x4f4a8c;});}return null;};}function removeEntity(_0x15d341,_0x38e5e2){return function(_0x5c1386){if(_0x5c1386){return _0x5c1386[_0x6e3b('0x2c')]()[_0x6e3b('0x2b')](function(){var _0xe8dc86=_0x5c1386[_0x6e3b('0x2d')]({'plain':!![]});var _0x5ec906=_0x6e3b('0x2e');return db['UserProfileResource'][_0x6e3b('0x2c')]({'where':{'type':_0x5ec906,'resourceId':_0xe8dc86['id']}})['then'](function(){return _0x5c1386;});})[_0x6e3b('0x2b')](function(){_0x15d341['status'](0xcc)[_0x6e3b('0x1f')]();});}};}function handleEntityNotFound(_0x3df6a1,_0x27a63d){return function(_0x3ba9f6){if(!_0x3ba9f6){_0x3df6a1[_0x6e3b('0x2f')](0x194);}return _0x3ba9f6;};}function handleError(_0x3d375c,_0x3b790d){_0x3b790d=_0x3b790d||0x1f4;return function(_0x5549b6){logger['error'](_0x5549b6[_0x6e3b('0x30')]);if(_0x5549b6['name']){delete _0x5549b6[_0x6e3b('0x31')];}_0x3d375c['status'](_0x3b790d)[_0x6e3b('0x32')](_0x5549b6);};}exports[_0x6e3b('0x33')]=function(_0x10f630,_0x41868d){var _0x15e907={},_0x5b68a1={},_0x5e78f0={'count':0x0,'rows':[]};var _0x2495a3=_['map'](db['CannedAnswer'][_0x6e3b('0x34')],function(_0x5b82c2){return{'name':_0x5b82c2[_0x6e3b('0x35')],'type':_0x5b82c2['type'][_0x6e3b('0x36')]};});_0x5b68a1[_0x6e3b('0x37')]=_['map'](_0x2495a3,'name');_0x5b68a1[_0x6e3b('0x38')]=_['keys'](_0x10f630[_0x6e3b('0x38')]);_0x5b68a1[_0x6e3b('0x39')]=_[_0x6e3b('0x3a')](_0x5b68a1['model'],_0x5b68a1[_0x6e3b('0x38')]);_0x15e907['attributes']=_[_0x6e3b('0x3a')](_0x5b68a1[_0x6e3b('0x37')],qs['fields'](_0x10f630['query'][_0x6e3b('0x3b')]));_0x15e907['attributes']=_0x15e907[_0x6e3b('0x3c')][_0x6e3b('0x3d')]?_0x15e907[_0x6e3b('0x3c')]:_0x5b68a1[_0x6e3b('0x37')];if(!_0x10f630[_0x6e3b('0x38')]['hasOwnProperty'](_0x6e3b('0x3e'))){_0x15e907['limit']=qs[_0x6e3b('0x23')](_0x10f630[_0x6e3b('0x38')]['limit']);_0x15e907[_0x6e3b('0x21')]=qs['offset'](_0x10f630[_0x6e3b('0x38')][_0x6e3b('0x21')]);}_0x15e907[_0x6e3b('0x3f')]=qs[_0x6e3b('0x40')](_0x10f630['query'][_0x6e3b('0x40')]);_0x15e907['where']=qs[_0x6e3b('0x39')](_[_0x6e3b('0x41')](_0x10f630[_0x6e3b('0x38')],_0x5b68a1[_0x6e3b('0x39')]),_0x2495a3);if(_0x10f630[_0x6e3b('0x38')]['filter']){_0x15e907[_0x6e3b('0x42')]=_[_0x6e3b('0x43')](_0x15e907[_0x6e3b('0x42')],{'$or':[{'key':{'$like':'%'+_0x10f630[_0x6e3b('0x38')][_0x6e3b('0x44')]+'%'}},{'value':{'$like':'%'+_0x10f630['query']['filter']+'%'}}]});}_0x15e907=_[_0x6e3b('0x43')]({},_0x15e907,_0x10f630[_0x6e3b('0x45')]);var _0x4692fb={'where':_0x15e907[_0x6e3b('0x42')]};return db[_0x6e3b('0x46')][_0x6e3b('0x24')](_0x4692fb)[_0x6e3b('0x2b')](function(_0xe60155){_0x5e78f0[_0x6e3b('0x24')]=_0xe60155;if(_0x10f630[_0x6e3b('0x38')][_0x6e3b('0x47')]){_0x15e907['include']=[{'all':!![]}];}return db[_0x6e3b('0x46')][_0x6e3b('0x48')](_0x15e907);})[_0x6e3b('0x2b')](function(_0x430ab5){_0x5e78f0['rows']=_0x430ab5;return _0x5e78f0;})[_0x6e3b('0x2b')](respondWithFilteredResult(_0x41868d,_0x15e907))[_0x6e3b('0x49')](handleError(_0x41868d,null));};exports['show']=function(_0x268b9d,_0xa934e5){var _0x464c17={'raw':!![],'where':{'id':_0x268b9d['params']['id']}},_0x402723={};_0x402723[_0x6e3b('0x37')]=_[_0x6e3b('0x4a')](db[_0x6e3b('0x46')][_0x6e3b('0x34')]);_0x402723[_0x6e3b('0x38')]=_[_0x6e3b('0x4a')](_0x268b9d[_0x6e3b('0x38')]);_0x402723[_0x6e3b('0x39')]=_['intersection'](_0x402723[_0x6e3b('0x37')],_0x402723[_0x6e3b('0x38')]);_0x464c17[_0x6e3b('0x3c')]=_[_0x6e3b('0x3a')](_0x402723[_0x6e3b('0x37')],qs[_0x6e3b('0x3b')](_0x268b9d[_0x6e3b('0x38')][_0x6e3b('0x3b')]));_0x464c17[_0x6e3b('0x3c')]=_0x464c17[_0x6e3b('0x3c')]['length']?_0x464c17[_0x6e3b('0x3c')]:_0x402723['model'];if(_0x268b9d[_0x6e3b('0x38')][_0x6e3b('0x47')]){_0x464c17[_0x6e3b('0x4b')]=[{'all':!![]}];}_0x464c17=_[_0x6e3b('0x43')]({},_0x464c17,_0x268b9d[_0x6e3b('0x45')]);return db['CannedAnswer'][_0x6e3b('0x4c')](_0x464c17)[_0x6e3b('0x2b')](handleEntityNotFound(_0xa934e5,null))[_0x6e3b('0x2b')](respondWithResult(_0xa934e5,null))[_0x6e3b('0x49')](handleError(_0xa934e5,null));};exports[_0x6e3b('0x2a')]=function(_0x247a87,_0xa93483){if(_0x247a87[_0x6e3b('0x4d')]['id']){delete _0x247a87[_0x6e3b('0x4d')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x247a87[_0x6e3b('0x4e')]['id']}})[_0x6e3b('0x2b')](handleEntityNotFound(_0xa93483,null))[_0x6e3b('0x2b')](saveUpdates(_0x247a87[_0x6e3b('0x4d')],null))[_0x6e3b('0x2b')](respondWithResult(_0xa93483,null))[_0x6e3b('0x49')](handleError(_0xa93483,null));};exports[_0x6e3b('0x2c')]=function(_0x20f950,_0x40a51e){return db[_0x6e3b('0x46')][_0x6e3b('0x4c')]({'where':{'id':_0x20f950['params']['id']}})['then'](handleEntityNotFound(_0x40a51e,null))[_0x6e3b('0x2b')](removeEntity(_0x40a51e,null))[_0x6e3b('0x49')](handleError(_0x40a51e,null));};exports[_0x6e3b('0x4f')]=function(_0x355a1a,_0x158953){var _0x11f38f={'key':_0x355a1a['body'][_0x6e3b('0x36')]};if(_0x355a1a[_0x6e3b('0x4d')]['MailAccountId']){_0x11f38f[_0x6e3b('0x50')]=_0x355a1a[_0x6e3b('0x4d')][_0x6e3b('0x50')];}else if(_0x355a1a['body'][_0x6e3b('0x51')]){_0x11f38f[_0x6e3b('0x51')]=_0x355a1a[_0x6e3b('0x4d')][_0x6e3b('0x51')];}else if(_0x355a1a['body'][_0x6e3b('0x52')]){_0x11f38f['OpenchannelAccountId']=_0x355a1a['body'][_0x6e3b('0x52')];}else if(_0x355a1a[_0x6e3b('0x4d')][_0x6e3b('0x53')]){_0x11f38f[_0x6e3b('0x53')]=_0x355a1a['body'][_0x6e3b('0x53')];}return db[_0x6e3b('0x46')][_0x6e3b('0x4c')]({'where':_0x11f38f})['then'](function(_0x5dd18a){if(_0x5dd18a){throw new db[(_0x6e3b('0x54'))][(_0x6e3b('0x55'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x6e3b('0x46')][_0x6e3b('0x4f')](_0x355a1a[_0x6e3b('0x4d')]);})[_0x6e3b('0x2b')](function(_0x574a62){var _0x543e99=_0x355a1a[_0x6e3b('0x56')]['get']({'plain':!![]});if(!_0x543e99)throw new Error(_0x6e3b('0x57'));if(_0x543e99[_0x6e3b('0x58')]===_0x6e3b('0x56')){var _0x48e251=_0x574a62[_0x6e3b('0x2d')]({'plain':!![]});return db[_0x6e3b('0x59')]['find']({'where':{'name':_0x6e3b('0x2e'),'userProfileId':_0x543e99[_0x6e3b('0x5a')]},'raw':!![]})['then'](function(_0x5da73d){if(_0x5da73d&&_0x5da73d[_0x6e3b('0x5b')]===0x0){return db[_0x6e3b('0x5c')]['create']({'name':_0x48e251['name'],'resourceId':_0x48e251['id'],'type':_0x5da73d[_0x6e3b('0x31')],'sectionId':_0x5da73d['id']},{})[_0x6e3b('0x2b')](function(){return _0x574a62;});}else{return _0x574a62;}})['catch'](function(_0x16b804){logger['error'](_0x6e3b('0x5d'),_0x16b804);throw _0x16b804;});}return _0x574a62;})['then'](respondWithResult(_0x158953,0xc9))[_0x6e3b('0x49')](handleError(_0x158953,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 9cfe6f3..2be989a 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 _0xb63b=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes'];(function(_0x513d38,_0x51a893){var _0x17421b=function(_0x3d24ad){while(--_0x3d24ad){_0x513d38['push'](_0x513d38['shift']());}};_0x17421b(++_0x51a893);}(_0xb63b,0x106));var _0xbb63=function(_0x4bfb61,_0x4ffe5f){_0x4bfb61=_0x4bfb61-0x0;var _0x3c2bb0=_0xb63b[_0x4bfb61];return _0x3c2bb0;};'use strict';var _=require(_0xbb63('0x0'));var util=require(_0xbb63('0x1'));var logger=require(_0xbb63('0x2'))(_0xbb63('0x3'));var moment=require(_0xbb63('0x4'));var BPromise=require(_0xbb63('0x5'));var rp=require(_0xbb63('0x6'));var fs=require('fs');var path=require(_0xbb63('0x7'));var rimraf=require(_0xbb63('0x8'));var config=require('../../config/environment');var attributes=require(_0xbb63('0x9'));module[_0xbb63('0xa')]=function(_0x12d54c,_0x49826b){return _0x12d54c[_0xbb63('0xb')](_0xbb63('0xc'),attributes,{'tableName':_0xbb63('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbb63('0xe'),'collate':_0xbb63('0xf')});}; \ No newline at end of file +var _0xad06=['api','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xad06,0xa7));var _0x6ad0=function(_0xc9584,_0x2b670b){_0xc9584=_0xc9584-0x0;var _0x2bb31f=_0xad06[_0xc9584];return _0x2bb31f;};'use strict';var _=require(_0x6ad0('0x0'));var util=require(_0x6ad0('0x1'));var logger=require('../../config/logger')(_0x6ad0('0x2'));var moment=require('moment');var BPromise=require(_0x6ad0('0x3'));var rp=require(_0x6ad0('0x4'));var fs=require('fs');var path=require(_0x6ad0('0x5'));var rimraf=require('rimraf');var config=require(_0x6ad0('0x6'));var attributes=require(_0x6ad0('0x7'));module['exports']=function(_0x143e28,_0xc28ac0){return _0x143e28[_0x6ad0('0x8')](_0x6ad0('0x9'),attributes,{'tableName':_0x6ad0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6ad0('0xb'),'collate':_0x6ad0('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index e28e39e..2fc5a86 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(_0x9cd6ff,_0x4c28a9){var _0x1a2121=function(_0x57ea65){while(--_0x57ea65){_0x9cd6ff['push'](_0x9cd6ff['shift']());}};_0x1a2121(++_0x4c28a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0x2c4d8e,_0x6ba19a){var _0x1b4bef=function(_0x2ad428){while(--_0x2ad428){_0x2c4d8e['push'](_0x2c4d8e['shift']());}};_0x1b4bef(++_0x6ba19a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 16a2344..da7da72 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 _0x204f=['index','get','/:id','isAuthenticated','post','create','put','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x204f,0xda));var _0xf204=function(_0x9dbea0,_0x52290b){_0x9dbea0=_0x9dbea0-0x0;var _0x47c91d=_0x204f[_0x9dbea0];return _0x47c91d;};'use strict';var multer=require(_0xf204('0x0'));var util=require('util');var path=require(_0xf204('0x1'));var timeout=require(_0xf204('0x2'));var express=require(_0xf204('0x3'));var router=express['Router']();var fs_extra=require(_0xf204('0x4'));var auth=require(_0xf204('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf204('0x6'));var controller=require('./cannedAnswer.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf204('0x7')]);router[_0xf204('0x8')](_0xf204('0x9'),auth[_0xf204('0xa')](),controller['show']);router[_0xf204('0xb')]('/',auth['isAuthenticated'](),controller[_0xf204('0xc')]);router[_0xf204('0xd')](_0xf204('0x9'),auth[_0xf204('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf204('0xe')]=router; \ No newline at end of file +var _0xd469=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','create','put','/:id','delete','destroy','exports','multer','util'];(function(_0x556730,_0x39cbbc){var _0x381001=function(_0x1a2572){while(--_0x1a2572){_0x556730['push'](_0x556730['shift']());}};_0x381001(++_0x39cbbc);}(_0xd469,0xfd));var _0x9d46=function(_0x1ebc40,_0x46811a){_0x1ebc40=_0x1ebc40-0x0;var _0x4565f1=_0xd469[_0x1ebc40];return _0x4565f1;};'use strict';var multer=require(_0x9d46('0x0'));var util=require(_0x9d46('0x1'));var path=require('path');var timeout=require(_0x9d46('0x2'));var express=require(_0x9d46('0x3'));var router=express[_0x9d46('0x4')]();var fs_extra=require(_0x9d46('0x5'));var auth=require(_0x9d46('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9d46('0x7'));var controller=require('./cannedAnswer.controller');router[_0x9d46('0x8')]('/',auth[_0x9d46('0x9')](),controller[_0x9d46('0xa')]);router['get']('/:id',auth[_0x9d46('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x9d46('0xb')]);router[_0x9d46('0xc')](_0x9d46('0xd'),auth[_0x9d46('0x9')](),controller['update']);router[_0x9d46('0xe')](_0x9d46('0xd'),auth[_0x9d46('0x9')](),controller[_0x9d46('0xf')]);module[_0x9d46('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index abc7003..3209c15 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 _0x89e8=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x89e8,0x74));var _0x889e=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x89e8[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x889e('0x0'));module[_0x889e('0x1')]={'calldate':{'type':Sequelize[_0x889e('0x2')],'allowNull':![],'defaultValue':_0x889e('0x3')},'clid':{'type':Sequelize[_0x889e('0x4')]},'src':{'type':Sequelize[_0x889e('0x4')]},'dst':{'type':Sequelize[_0x889e('0x4')]},'dcontext':{'type':Sequelize[_0x889e('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x889e('0x4')]},'duration':{'type':Sequelize[_0x889e('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x889e('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x889e('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x889e('0x4')]},'uniqueid':{'type':Sequelize[_0x889e('0x4')]},'linkedid':{'type':Sequelize[_0x889e('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x889e('0x4')]},'type':{'type':Sequelize[_0x889e('0x4')]},'tag':{'type':Sequelize[_0x889e('0x4')]}}; \ No newline at end of file +var _0x87ae=['STRING','INTEGER','DATE'];(function(_0x48bb79,_0x2cbd8a){var _0x50d40c=function(_0x5a6a52){while(--_0x5a6a52){_0x48bb79['push'](_0x48bb79['shift']());}};_0x50d40c(++_0x2cbd8a);}(_0x87ae,0xf5));var _0xe87a=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x87ae[_0x4ce028];return _0x583d0c;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0xe87a('0x0')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xe87a('0x1')]},'dst':{'type':Sequelize[_0xe87a('0x1')]},'dcontext':{'type':Sequelize[_0xe87a('0x1')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xe87a('0x1')]},'lastapp':{'type':Sequelize[_0xe87a('0x1')]},'lastdata':{'type':Sequelize[_0xe87a('0x1')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe87a('0x1')]},'amaflags':{'type':Sequelize[_0xe87a('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xe87a('0x1')]},'uniqueid':{'type':Sequelize[_0xe87a('0x1')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xe87a('0x1')]},'peeraccount':{'type':Sequelize[_0xe87a('0x1')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xe87a('0x1')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index e1bdbf3..da91694 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 _0xe14b=['rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xe14b,0x93));var _0xbe14=function(_0x443c60,_0xbbaca4){_0x443c60=_0x443c60-0x0;var _0x1a80ae=_0xe14b[_0x443c60];return _0x1a80ae;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25'));_0x19252f[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x3c3613[_0xbe14('0x2e')]);_0x19252f[_0xbe14('0x30')]=_['intersection'](_0x19252f[_0xbe14('0x2d')],_0x19252f['query']);_0x1c7cc7['attributes']=_[_0xbe14('0x31')](_0x19252f['model'],qs[_0xbe14('0x32')](_0x3c3613[_0xbe14('0x2e')]['fields']));_0x1c7cc7['attributes']=_0x1c7cc7['attributes'][_0xbe14('0x33')]?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f['model'];if(!_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x3c3613['query']['limit']);_0x1c7cc7[_0xbe14('0x1c')]=qs['offset'](_0x3c3613['query']['offset']);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x30')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x2e')],_0x19252f[_0xbe14('0x30')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3b')]){_0x1c7cc7[_0xbe14('0x39')]=_['merge'](_0x1c7cc7['where'],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x2951e1){if(_0x2951e1[_0xbe14('0x2b')]!=='VIRTUAL'){var _0x326329={};_0x326329[_0x2951e1[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3b')]+'%'};return _0x326329;}})});}_0x1c7cc7=_[_0xbe14('0x3c')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3d')]);var _0x19fa30={'where':_0x1c7cc7[_0xbe14('0x39')]};return db[_0xbe14('0x28')]['count'](_0x19fa30)[_0xbe14('0x22')](function(_0x841b71){_0x34d648[_0xbe14('0x1b')]=_0x841b71;if(_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3e')]){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db['Cdr'][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x1220c9){_0x34d648[_0xbe14('0x41')]=_0x1220c9;return _0x34d648;})['then'](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))['catch'](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0xe417b,_0x3272ae){var _0x51c859={'raw':!![],'where':{'id':_0xe417b[_0xbe14('0x43')]['id']}},_0x5d5318={};_0x5d5318['model']=_['keys'](db[_0xbe14('0x28')][_0xbe14('0x29')]);_0x5d5318[_0xbe14('0x2e')]=_['keys'](_0xe417b['query']);_0x5d5318['filters']=_[_0xbe14('0x31')](_0x5d5318[_0xbe14('0x2d')],_0x5d5318[_0xbe14('0x2e')]);_0x51c859['attributes']=_[_0xbe14('0x31')](_0x5d5318[_0xbe14('0x2d')],qs[_0xbe14('0x32')](_0xe417b[_0xbe14('0x2e')]['fields']));_0x51c859['attributes']=_0x51c859[_0xbe14('0x34')][_0xbe14('0x33')]?_0x51c859[_0xbe14('0x34')]:_0x5d5318[_0xbe14('0x2d')];if(_0xe417b[_0xbe14('0x2e')]['includeAll']){_0x51c859['include']=[{'all':!![]}];}_0x51c859=_[_0xbe14('0x3c')]({},_0x51c859,_0xe417b[_0xbe14('0x3d')]);return db[_0xbe14('0x28')][_0xbe14('0x44')](_0x51c859)['then'](handleEntityNotFound(_0x3272ae,null))[_0xbe14('0x22')](respondWithResult(_0x3272ae,null))[_0xbe14('0x45')](handleError(_0x3272ae,null));};exports['create']=function(_0x396e40,_0x2a35e5){return db[_0xbe14('0x28')][_0xbe14('0x46')](_0x396e40['body'],{})['then'](respondWithResult(_0x2a35e5,0xc9))[_0xbe14('0x45')](handleError(_0x2a35e5,null));};exports[_0xbe14('0x21')]=function(_0x4a1a37,_0x5acf90){if(_0x4a1a37[_0xbe14('0x47')]['id']){delete _0x4a1a37[_0xbe14('0x47')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x44')]({'where':{'id':_0x4a1a37[_0xbe14('0x43')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5acf90,null))[_0xbe14('0x22')](saveUpdates(_0x4a1a37['body'],null))[_0xbe14('0x22')](respondWithResult(_0x5acf90,null))[_0xbe14('0x45')](handleError(_0x5acf90,null));};exports[_0xbe14('0x48')]=function(_0x22b1f8,_0x2fc073){return db['Cdr'][_0xbe14('0x44')]({'where':{'id':_0x22b1f8[_0xbe14('0x43')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x2fc073,null))[_0xbe14('0x22')](removeEntity(_0x2fc073,null))[_0xbe14('0x45')](handleError(_0x2fc073,null));};exports[_0xbe14('0x49')]=function(_0x505829,_0x5aeea9){return db[_0xbe14('0x28')][_0xbe14('0x49')]()[_0xbe14('0x22')](respondWithResult(_0x5aeea9,null))['catch'](handleError(_0x5aeea9,null));}; \ No newline at end of file +var _0xdd0c=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','then','includeAll','findAll','rows','catch','show','length','include','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x239013,_0x4b6af3){var _0x1f80af=function(_0x4b9517){while(--_0x4b9517){_0x239013['push'](_0x239013['shift']());}};_0x1f80af(++_0x4b6af3);}(_0xdd0c,0x165));var _0xcdd0=function(_0x569888,_0x1b93c6){_0x569888=_0x569888-0x0;var _0x1d2e0a=_0xdd0c[_0x569888];return _0x1d2e0a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdd0('0x0'));var zipdir=require(_0xcdd0('0x1'));var jsonpatch=require(_0xcdd0('0x2'));var rp=require('request-promise');var moment=require(_0xcdd0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcdd0('0x4'));var util=require(_0xcdd0('0x5'));var path=require(_0xcdd0('0x6'));var sox=require(_0xcdd0('0x7'));var csv=require(_0xcdd0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdd0('0x9'));var _=require(_0xcdd0('0xa'));var squel=require(_0xcdd0('0xb'));var crypto=require(_0xcdd0('0xc'));var jsforce=require(_0xcdd0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcdd0('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcdd0('0xe'));var authService=require(_0xcdd0('0xf'));var qs=require(_0xcdd0('0x10'));var as=require(_0xcdd0('0x11'));var hardwareService=require(_0xcdd0('0x12'));var logger=require(_0xcdd0('0x13'))(_0xcdd0('0x14'));var utils=require(_0xcdd0('0x15'));var config=require(_0xcdd0('0x16'));var licenseUtil=require(_0xcdd0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a1ff6,_0x356501){_0x356501=_0x356501||0xcc;return function(_0x14c775){if(_0x14c775){return _0x4a1ff6['sendStatus'](_0x356501);}return _0x4a1ff6[_0xcdd0('0x18')](_0x356501)[_0xcdd0('0x19')]();};}function respondWithResult(_0x4f4aa4,_0x1fc89a){_0x1fc89a=_0x1fc89a||0xc8;return function(_0x1d5bff){if(_0x1d5bff){return _0x4f4aa4[_0xcdd0('0x18')](_0x1fc89a)[_0xcdd0('0x1a')](_0x1d5bff);}};}function respondWithFilteredResult(_0xc1c3d5,_0x52aef5){return function(_0x5b5c06){if(_0x5b5c06){var _0x189f54=typeof _0x52aef5[_0xcdd0('0x1b')]===_0xcdd0('0x1c')&&typeof _0x52aef5[_0xcdd0('0x1d')]===_0xcdd0('0x1c');var _0x3b07a1=_0x5b5c06[_0xcdd0('0x1e')];var _0x2c199f=_0x189f54?0x0:_0x52aef5[_0xcdd0('0x1b')];var _0x14d55b=_0x189f54?_0x5b5c06['count']:_0x52aef5[_0xcdd0('0x1b')]+_0x52aef5[_0xcdd0('0x1d')];var _0x5060fa;if(_0x14d55b>=_0x3b07a1){_0x14d55b=_0x3b07a1;_0x5060fa=0xc8;}else{_0x5060fa=0xce;}_0xc1c3d5['status'](_0x5060fa);return _0xc1c3d5[_0xcdd0('0x1f')](_0xcdd0('0x20'),_0x2c199f+'-'+_0x14d55b+'/'+_0x3b07a1)['json'](_0x5b5c06);}return null;};}function patchUpdates(_0x12128e){return function(_0x4f7325){try{jsonpatch['apply'](_0x4f7325,_0x12128e,!![]);}catch(_0x4d038f){return BPromise[_0xcdd0('0x21')](_0x4d038f);}return _0x4f7325[_0xcdd0('0x22')]();};}function saveUpdates(_0x4afcfa,_0x2ab7e4){return function(_0x31a3e6){if(_0x31a3e6){return _0x31a3e6[_0xcdd0('0x23')](_0x4afcfa)['then'](function(_0x9d4727){return _0x9d4727;});}return null;};}function removeEntity(_0x7be0ac,_0x509e9c){return function(_0x3c81b1){if(_0x3c81b1){return _0x3c81b1[_0xcdd0('0x24')]()['then'](function(){_0x7be0ac[_0xcdd0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3797c2,_0x64b52){return function(_0x476018){if(!_0x476018){_0x3797c2['sendStatus'](0x194);}return _0x476018;};}function handleError(_0x22fd47,_0x10cba2){_0x10cba2=_0x10cba2||0x1f4;return function(_0x5e5cc){logger[_0xcdd0('0x25')](_0x5e5cc[_0xcdd0('0x26')]);if(_0x5e5cc[_0xcdd0('0x27')]){delete _0x5e5cc[_0xcdd0('0x27')];}_0x22fd47[_0xcdd0('0x18')](_0x10cba2)[_0xcdd0('0x28')](_0x5e5cc);};}exports[_0xcdd0('0x29')]=function(_0x4074e0,_0x49cfe0){var _0x28084c={},_0xd6d64f={},_0x1bbe37={'count':0x0,'rows':[]};var _0x5b8635=_[_0xcdd0('0x2a')](db[_0xcdd0('0x2b')][_0xcdd0('0x2c')],function(_0x477d1a){return{'name':_0x477d1a[_0xcdd0('0x2d')],'type':_0x477d1a['type'][_0xcdd0('0x2e')]};});_0xd6d64f[_0xcdd0('0x2f')]=_[_0xcdd0('0x2a')](_0x5b8635,'name');_0xd6d64f['query']=_[_0xcdd0('0x30')](_0x4074e0[_0xcdd0('0x31')]);_0xd6d64f[_0xcdd0('0x32')]=_['intersection'](_0xd6d64f[_0xcdd0('0x2f')],_0xd6d64f[_0xcdd0('0x31')]);_0x28084c['attributes']=_[_0xcdd0('0x33')](_0xd6d64f[_0xcdd0('0x2f')],qs[_0xcdd0('0x34')](_0x4074e0[_0xcdd0('0x31')]['fields']));_0x28084c[_0xcdd0('0x35')]=_0x28084c[_0xcdd0('0x35')]['length']?_0x28084c[_0xcdd0('0x35')]:_0xd6d64f[_0xcdd0('0x2f')];if(!_0x4074e0[_0xcdd0('0x31')][_0xcdd0('0x36')]('nolimit')){_0x28084c[_0xcdd0('0x1d')]=qs[_0xcdd0('0x1d')](_0x4074e0[_0xcdd0('0x31')][_0xcdd0('0x1d')]);_0x28084c[_0xcdd0('0x1b')]=qs['offset'](_0x4074e0[_0xcdd0('0x31')]['offset']);}_0x28084c['order']=qs['sort'](_0x4074e0[_0xcdd0('0x31')][_0xcdd0('0x37')]);_0x28084c[_0xcdd0('0x38')]=qs[_0xcdd0('0x32')](_[_0xcdd0('0x39')](_0x4074e0[_0xcdd0('0x31')],_0xd6d64f[_0xcdd0('0x32')]),_0x5b8635);if(_0x4074e0['query'][_0xcdd0('0x3a')]){_0x28084c[_0xcdd0('0x38')]=_[_0xcdd0('0x3b')](_0x28084c[_0xcdd0('0x38')],{'$or':_['map'](_0x5b8635,function(_0x4934a5){if(_0x4934a5[_0xcdd0('0x3c')]!==_0xcdd0('0x3d')){var _0x47a5f5={};_0x47a5f5[_0x4934a5[_0xcdd0('0x27')]]={'$like':'%'+_0x4074e0[_0xcdd0('0x31')]['filter']+'%'};return _0x47a5f5;}})});}_0x28084c=_[_0xcdd0('0x3b')]({},_0x28084c,_0x4074e0['options']);var _0x41ce22={'where':_0x28084c['where']};return db[_0xcdd0('0x2b')][_0xcdd0('0x1e')](_0x41ce22)[_0xcdd0('0x3e')](function(_0x271f47){_0x1bbe37['count']=_0x271f47;if(_0x4074e0[_0xcdd0('0x31')][_0xcdd0('0x3f')]){_0x28084c['include']=[{'all':!![]}];}return db[_0xcdd0('0x2b')][_0xcdd0('0x40')](_0x28084c);})[_0xcdd0('0x3e')](function(_0x27ce74){_0x1bbe37[_0xcdd0('0x41')]=_0x27ce74;return _0x1bbe37;})[_0xcdd0('0x3e')](respondWithFilteredResult(_0x49cfe0,_0x28084c))[_0xcdd0('0x42')](handleError(_0x49cfe0,null));};exports[_0xcdd0('0x43')]=function(_0x375e89,_0xce8a50){var _0x5f0c94={'raw':!![],'where':{'id':_0x375e89['params']['id']}},_0x2718b3={};_0x2718b3['model']=_[_0xcdd0('0x30')](db['Cdr'][_0xcdd0('0x2c')]);_0x2718b3[_0xcdd0('0x31')]=_[_0xcdd0('0x30')](_0x375e89[_0xcdd0('0x31')]);_0x2718b3[_0xcdd0('0x32')]=_['intersection'](_0x2718b3[_0xcdd0('0x2f')],_0x2718b3['query']);_0x5f0c94['attributes']=_[_0xcdd0('0x33')](_0x2718b3[_0xcdd0('0x2f')],qs['fields'](_0x375e89['query']['fields']));_0x5f0c94[_0xcdd0('0x35')]=_0x5f0c94[_0xcdd0('0x35')][_0xcdd0('0x44')]?_0x5f0c94['attributes']:_0x2718b3[_0xcdd0('0x2f')];if(_0x375e89[_0xcdd0('0x31')][_0xcdd0('0x3f')]){_0x5f0c94[_0xcdd0('0x45')]=[{'all':!![]}];}_0x5f0c94=_[_0xcdd0('0x3b')]({},_0x5f0c94,_0x375e89['options']);return db[_0xcdd0('0x2b')]['find'](_0x5f0c94)[_0xcdd0('0x3e')](handleEntityNotFound(_0xce8a50,null))[_0xcdd0('0x3e')](respondWithResult(_0xce8a50,null))[_0xcdd0('0x42')](handleError(_0xce8a50,null));};exports[_0xcdd0('0x46')]=function(_0x265cfb,_0x2fc567){return db[_0xcdd0('0x2b')][_0xcdd0('0x46')](_0x265cfb[_0xcdd0('0x47')],{})[_0xcdd0('0x3e')](respondWithResult(_0x2fc567,0xc9))[_0xcdd0('0x42')](handleError(_0x2fc567,null));};exports[_0xcdd0('0x23')]=function(_0x3afae8,_0x6c2cb8){if(_0x3afae8[_0xcdd0('0x47')]['id']){delete _0x3afae8['body']['id'];}return db[_0xcdd0('0x2b')][_0xcdd0('0x48')]({'where':{'id':_0x3afae8[_0xcdd0('0x49')]['id']}})[_0xcdd0('0x3e')](handleEntityNotFound(_0x6c2cb8,null))[_0xcdd0('0x3e')](saveUpdates(_0x3afae8[_0xcdd0('0x47')],null))[_0xcdd0('0x3e')](respondWithResult(_0x6c2cb8,null))[_0xcdd0('0x42')](handleError(_0x6c2cb8,null));};exports[_0xcdd0('0x24')]=function(_0x214cdd,_0x36156c){return db[_0xcdd0('0x2b')][_0xcdd0('0x48')]({'where':{'id':_0x214cdd[_0xcdd0('0x49')]['id']}})['then'](handleEntityNotFound(_0x36156c,null))[_0xcdd0('0x3e')](removeEntity(_0x36156c,null))[_0xcdd0('0x42')](handleError(_0x36156c,null));};exports[_0xcdd0('0x4a')]=function(_0xc7370e,_0x46c578){return db[_0xcdd0('0x2b')][_0xcdd0('0x4a')]()['then'](respondWithResult(_0x46c578,null))[_0xcdd0('0x42')](handleError(_0x46c578,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index a2cc64e..fe61065 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(_0x4192e7,_0x524083){var _0x126235=function(_0x474509){while(--_0x474509){_0x4192e7['push'](_0x4192e7['shift']());}};_0x126235(++_0x524083);}(_0x7a54,0x106));var _0x47a5=function(_0x1371f1,_0x193453){_0x1371f1=_0x1371f1-0x0;var _0x1542fc=_0x7a54[_0x1371f1];return _0x1542fc;};'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 _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x22b7a6,_0x3ce62c){var _0x1b750e=function(_0x576272){while(--_0x576272){_0x22b7a6['push'](_0x22b7a6['shift']());}};_0x1b750e(++_0x3ce62c);}(_0x7a54,0x106));var _0x47a5=function(_0x505e7e,_0x558dd6){_0x505e7e=_0x505e7e-0x0;var _0x15dcb5=_0x7a54[_0x505e7e];return _0x15dcb5;};'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 diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index dd3d93d..3c7db57 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 _0x623d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x225787,_0x13e489){var _0x4ef075=function(_0x476392){while(--_0x476392){_0x225787['push'](_0x225787['shift']());}};_0x4ef075(++_0x13e489);}(_0x623d,0x112));var _0xd623=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x623d[_0xa6cc5c];return _0x44803d;};'use strict';var _=require(_0xd623('0x0'));var util=require(_0xd623('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd623('0x2'));var fs=require('fs');var Redis=require(_0xd623('0x3'));var db=require(_0xd623('0x4'))['db'];var utils=require(_0xd623('0x5'));var logger=require(_0xd623('0x6'))('rpc');var config=require(_0xd623('0x7'));var jayson=require(_0xd623('0x8'));var client=jayson[_0xd623('0x9')][_0xd623('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23ac57,_0x54ad7e,_0x29ef98){return new BPromise(function(_0x18e522,_0x251f99){return client[_0xd623('0xb')](_0x23ac57,_0x29ef98)[_0xd623('0xc')](function(_0x2f3618){logger[_0xd623('0xd')]('Cdr,\x20%s,\x20%s',_0x54ad7e,_0xd623('0xe'));logger[_0xd623('0xf')](_0xd623('0x10'),_0x54ad7e,'request\x20sent',JSON[_0xd623('0x11')](_0x2f3618));if(_0x2f3618[_0xd623('0x12')]){if(_0x2f3618[_0xd623('0x12')]['code']===0x1f4){logger['error'](_0xd623('0x13'),_0x54ad7e,_0x2f3618[_0xd623('0x12')]['message']);return _0x251f99(_0x2f3618[_0xd623('0x12')][_0xd623('0x14')]);}logger[_0xd623('0x12')](_0xd623('0x13'),_0x54ad7e,_0x2f3618[_0xd623('0x12')][_0xd623('0x14')]);return _0x18e522(_0x2f3618[_0xd623('0x12')][_0xd623('0x14')]);}else{logger[_0xd623('0xd')]('Cdr,\x20%s,\x20%s',_0x54ad7e,_0xd623('0xe'));_0x18e522(_0x2f3618[_0xd623('0x15')]['message']);}})[_0xd623('0x16')](function(_0x4041bf){logger['error'](_0xd623('0x13'),_0x54ad7e,_0x4041bf);_0x251f99(_0x4041bf);});});} \ No newline at end of file +var _0x4b2e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','util','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b2e,0x18e));var _0xe4b2=function(_0x2b0aec,_0x86e4ad){_0x2b0aec=_0x2b0aec-0x0;var _0x2aef33=_0x4b2e[_0x2b0aec];return _0x2aef33;};'use strict';var _=require('lodash');var util=require(_0xe4b2('0x0'));var moment=require('moment');var BPromise=require(_0xe4b2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4b2('0x2'));var db=require(_0xe4b2('0x3'))['db'];var utils=require(_0xe4b2('0x4'));var logger=require(_0xe4b2('0x5'))(_0xe4b2('0x6'));var config=require('../../config/environment');var jayson=require(_0xe4b2('0x7'));var client=jayson[_0xe4b2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55a9ea,_0x5a928d,_0x1b4752){return new BPromise(function(_0x2de17f,_0x3dbbf3){return client[_0xe4b2('0x9')](_0x55a9ea,_0x1b4752)[_0xe4b2('0xa')](function(_0x32c69c){logger['info'](_0xe4b2('0xb'),_0x5a928d,_0xe4b2('0xc'));logger[_0xe4b2('0xd')](_0xe4b2('0xe'),_0x5a928d,_0xe4b2('0xc'),JSON['stringify'](_0x32c69c));if(_0x32c69c[_0xe4b2('0xf')]){if(_0x32c69c[_0xe4b2('0xf')][_0xe4b2('0x10')]===0x1f4){logger[_0xe4b2('0xf')]('Cdr,\x20%s,\x20%s',_0x5a928d,_0x32c69c['error']['message']);return _0x3dbbf3(_0x32c69c[_0xe4b2('0xf')][_0xe4b2('0x11')]);}logger[_0xe4b2('0xf')](_0xe4b2('0xb'),_0x5a928d,_0x32c69c[_0xe4b2('0xf')][_0xe4b2('0x11')]);return _0x2de17f(_0x32c69c[_0xe4b2('0xf')][_0xe4b2('0x11')]);}else{logger[_0xe4b2('0x12')](_0xe4b2('0xb'),_0x5a928d,'request\x20sent');_0x2de17f(_0x32c69c['result'][_0xe4b2('0x11')]);}})[_0xe4b2('0x13')](function(_0x29c0f8){logger[_0xe4b2('0xf')](_0xe4b2('0xb'),_0x5a928d,_0x29c0f8);_0x3dbbf3(_0x29c0f8);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index d225d01..1ee97e8 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(_0x3a31ac,_0x5e2c44){var _0x2aa2bc=function(_0x378452){while(--_0x378452){_0x3a31ac['push'](_0x3a31ac['shift']());}};_0x2aa2bc(++_0x5e2c44);}(_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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index a1f3810..86116fb 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 _0x7144=['INTEGER','STRING','noop','TEXT','exports'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0x7144,0x1f3));var _0x4714=function(_0x385c09,_0x29501b){_0x385c09=_0x385c09-0x0;var _0x368cd9=_0x7144[_0x385c09];return _0x368cd9;};'use strict';var Sequelize=require('sequelize');module[_0x4714('0x0')]={'priority':{'type':Sequelize[_0x4714('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4714('0x2')],'allowNull':![],'defaultValue':_0x4714('0x3')},'appdata':{'type':Sequelize[_0x4714('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4714('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3017=['*,*,*,*','INTEGER','STRING','TEXT'];(function(_0x5162ed,_0x386cb7){var _0x4c579b=function(_0x189260){while(--_0x189260){_0x5162ed['push'](_0x5162ed['shift']());}};_0x4c579b(++_0x386cb7);}(_0x3017,0x18d));var _0x7301=function(_0x42d902,_0x2ee119){_0x42d902=_0x42d902-0x0;var _0x39db2a=_0x3017[_0x42d902];return _0x39db2a;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x7301('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x7301('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7301('0x2')]()},'description':{'type':Sequelize[_0x7301('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7301('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index a2b83a0..e9c1cdb 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 _0xcaa3=['Content-Range','apply','update','destroy','then','end','sendStatus','error','stack','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','fields','length','includeAll','include','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','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','../../mysqldb','status','json','offset','undefined','limit','count','set'];(function(_0x498f67,_0x3c24c9){var _0x10ec95=function(_0x39899d){while(--_0x39899d){_0x498f67['push'](_0x498f67['shift']());}};_0x10ec95(++_0x3c24c9);}(_0xcaa3,0xcb));var _0x3caa=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xcaa3[_0xe73080];return _0x12cbc4;};'use strict';var emlformat=require(_0x3caa('0x0'));var rimraf=require(_0x3caa('0x1'));var zipdir=require(_0x3caa('0x2'));var jsonpatch=require(_0x3caa('0x3'));var rp=require(_0x3caa('0x4'));var moment=require(_0x3caa('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3caa('0x6'));var path=require(_0x3caa('0x7'));var sox=require(_0x3caa('0x8'));var csv=require(_0x3caa('0x9'));var ejs=require(_0x3caa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3caa('0xb'));var squel=require(_0x3caa('0xc'));var crypto=require(_0x3caa('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3caa('0xe'));var toCsv=require(_0x3caa('0x9'));var querystring=require(_0x3caa('0xf'));var Papa=require(_0x3caa('0x10'));var Redis=require(_0x3caa('0x11'));var authService=require(_0x3caa('0x12'));var qs=require(_0x3caa('0x13'));var as=require(_0x3caa('0x14'));var hardwareService=require(_0x3caa('0x15'));var logger=require(_0x3caa('0x16'))(_0x3caa('0x17'));var utils=require(_0x3caa('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3caa('0x19'))['db'];function respondWithStatusCode(_0xe1df65,_0x47da19){_0x47da19=_0x47da19||0xcc;return function(_0x1ec89c){if(_0x1ec89c){return _0xe1df65['sendStatus'](_0x47da19);}return _0xe1df65[_0x3caa('0x1a')](_0x47da19)['end']();};}function respondWithResult(_0x185593,_0x24791e){_0x24791e=_0x24791e||0xc8;return function(_0x1b18e3){if(_0x1b18e3){return _0x185593['status'](_0x24791e)[_0x3caa('0x1b')](_0x1b18e3);}};}function respondWithFilteredResult(_0x47e528,_0x459bb1){return function(_0x12744c){if(_0x12744c){var _0x563cdd=typeof _0x459bb1[_0x3caa('0x1c')]===_0x3caa('0x1d')&&typeof _0x459bb1[_0x3caa('0x1e')]==='undefined';var _0xbfe273=_0x12744c[_0x3caa('0x1f')];var _0x1ba912=_0x563cdd?0x0:_0x459bb1[_0x3caa('0x1c')];var _0xfcbdad=_0x563cdd?_0x12744c[_0x3caa('0x1f')]:_0x459bb1[_0x3caa('0x1c')]+_0x459bb1['limit'];var _0x4c47be;if(_0xfcbdad>=_0xbfe273){_0xfcbdad=_0xbfe273;_0x4c47be=0xc8;}else{_0x4c47be=0xce;}_0x47e528[_0x3caa('0x1a')](_0x4c47be);return _0x47e528[_0x3caa('0x20')](_0x3caa('0x21'),_0x1ba912+'-'+_0xfcbdad+'/'+_0xbfe273)['json'](_0x12744c);}return null;};}function patchUpdates(_0x34f44f){return function(_0x2dfc98){try{jsonpatch[_0x3caa('0x22')](_0x2dfc98,_0x34f44f,!![]);}catch(_0x105265){return BPromise['reject'](_0x105265);}return _0x2dfc98['save']();};}function saveUpdates(_0x3d7dec,_0x3b04ca){return function(_0x1eff81){if(_0x1eff81){return _0x1eff81[_0x3caa('0x23')](_0x3d7dec)['then'](function(_0x366a6c){return _0x366a6c;});}return null;};}function removeEntity(_0x4bfc8e,_0x556bb8){return function(_0x1b0308){if(_0x1b0308){return _0x1b0308[_0x3caa('0x24')]()[_0x3caa('0x25')](function(){_0x4bfc8e[_0x3caa('0x1a')](0xcc)[_0x3caa('0x26')]();});}};}function handleEntityNotFound(_0x422a92,_0x3c42fb){return function(_0x48c378){if(!_0x48c378){_0x422a92[_0x3caa('0x27')](0x194);}return _0x48c378;};}function handleError(_0x9ecb20,_0x38c00f){_0x38c00f=_0x38c00f||0x1f4;return function(_0x8d7851){logger[_0x3caa('0x28')](_0x8d7851[_0x3caa('0x29')]);if(_0x8d7851['name']){delete _0x8d7851['name'];}_0x9ecb20['status'](_0x38c00f)[_0x3caa('0x2a')](_0x8d7851);};}exports[_0x3caa('0x2b')]=function(_0x5255b7,_0x11f340){var _0x738069={'raw':!![],'where':{'id':_0x5255b7[_0x3caa('0x2c')]['id']}},_0x55050f={};_0x55050f[_0x3caa('0x2d')]=_[_0x3caa('0x2e')](db[_0x3caa('0x2f')][_0x3caa('0x30')]);_0x55050f[_0x3caa('0x31')]=_[_0x3caa('0x2e')](_0x5255b7[_0x3caa('0x31')]);_0x55050f[_0x3caa('0x32')]=_['intersection'](_0x55050f[_0x3caa('0x2d')],_0x55050f['query']);_0x738069[_0x3caa('0x33')]=_['intersection'](_0x55050f['model'],qs['fields'](_0x5255b7[_0x3caa('0x31')][_0x3caa('0x34')]));_0x738069[_0x3caa('0x33')]=_0x738069[_0x3caa('0x33')][_0x3caa('0x35')]?_0x738069['attributes']:_0x55050f['model'];if(_0x5255b7['query'][_0x3caa('0x36')]){_0x738069[_0x3caa('0x37')]=[{'all':!![]}];}_0x738069=_['merge']({},_0x738069,_0x5255b7['options']);return db['ChatApplication']['find'](_0x738069)['then'](handleEntityNotFound(_0x11f340,null))[_0x3caa('0x25')](respondWithResult(_0x11f340,null))[_0x3caa('0x38')](handleError(_0x11f340,null));};exports['update']=function(_0x5a0467,_0x4dc938){if(_0x5a0467['body']['id']){delete _0x5a0467[_0x3caa('0x39')]['id'];}return db[_0x3caa('0x2f')][_0x3caa('0x3a')]({'where':{'id':_0x5a0467['params']['id']}})['then'](handleEntityNotFound(_0x4dc938,null))['then'](saveUpdates(_0x5a0467[_0x3caa('0x39')],null))[_0x3caa('0x25')](respondWithResult(_0x4dc938,null))[_0x3caa('0x38')](handleError(_0x4dc938,null));};exports[_0x3caa('0x24')]=function(_0x364f21,_0x3da966){return db[_0x3caa('0x2f')][_0x3caa('0x3a')]({'where':{'id':_0x364f21[_0x3caa('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3da966,null))[_0x3caa('0x25')](removeEntity(_0x3da966,null))['catch'](handleError(_0x3da966,null));}; \ No newline at end of file +var _0x76bc=['send','params','model','keys','ChatApplication','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','end','name'];(function(_0xdd8feb,_0x48cc45){var _0x87ea75=function(_0x2256f5){while(--_0x2256f5){_0xdd8feb['push'](_0xdd8feb['shift']());}};_0x87ea75(++_0x48cc45);}(_0x76bc,0x17f));var _0xc76b=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0x76bc[_0x2b5513];return _0x578fd2;};'use strict';var emlformat=require(_0xc76b('0x0'));var rimraf=require(_0xc76b('0x1'));var zipdir=require(_0xc76b('0x2'));var jsonpatch=require(_0xc76b('0x3'));var rp=require(_0xc76b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc76b('0x5'));var util=require(_0xc76b('0x6'));var path=require(_0xc76b('0x7'));var sox=require(_0xc76b('0x8'));var csv=require(_0xc76b('0x9'));var ejs=require(_0xc76b('0xa'));var fs=require('fs');var fs_extra=require(_0xc76b('0xb'));var _=require(_0xc76b('0xc'));var squel=require(_0xc76b('0xd'));var crypto=require(_0xc76b('0xe'));var jsforce=require(_0xc76b('0xf'));var deskjs=require(_0xc76b('0x10'));var toCsv=require(_0xc76b('0x9'));var querystring=require(_0xc76b('0x11'));var Papa=require(_0xc76b('0x12'));var Redis=require(_0xc76b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc76b('0x14'));var as=require(_0xc76b('0x15'));var hardwareService=require(_0xc76b('0x16'));var logger=require(_0xc76b('0x17'))(_0xc76b('0x18'));var utils=require(_0xc76b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc76b('0x1a'));var db=require(_0xc76b('0x1b'))['db'];function respondWithStatusCode(_0x30835f,_0xc84b2c){_0xc84b2c=_0xc84b2c||0xcc;return function(_0x4474cd){if(_0x4474cd){return _0x30835f[_0xc76b('0x1c')](_0xc84b2c);}return _0x30835f[_0xc76b('0x1d')](_0xc84b2c)['end']();};}function respondWithResult(_0x538ca8,_0x38a0f1){_0x38a0f1=_0x38a0f1||0xc8;return function(_0x25e4a1){if(_0x25e4a1){return _0x538ca8[_0xc76b('0x1d')](_0x38a0f1)[_0xc76b('0x1e')](_0x25e4a1);}};}function respondWithFilteredResult(_0x25752f,_0x5d1130){return function(_0x21d99a){if(_0x21d99a){var _0x2db167=typeof _0x5d1130[_0xc76b('0x1f')]==='undefined'&&typeof _0x5d1130['limit']===_0xc76b('0x20');var _0x2d3e9d=_0x21d99a[_0xc76b('0x21')];var _0x3e716e=_0x2db167?0x0:_0x5d1130[_0xc76b('0x1f')];var _0x55a61d=_0x2db167?_0x21d99a['count']:_0x5d1130['offset']+_0x5d1130[_0xc76b('0x22')];var _0x164d38;if(_0x55a61d>=_0x2d3e9d){_0x55a61d=_0x2d3e9d;_0x164d38=0xc8;}else{_0x164d38=0xce;}_0x25752f[_0xc76b('0x1d')](_0x164d38);return _0x25752f[_0xc76b('0x23')](_0xc76b('0x24'),_0x3e716e+'-'+_0x55a61d+'/'+_0x2d3e9d)[_0xc76b('0x1e')](_0x21d99a);}return null;};}function patchUpdates(_0x336be9){return function(_0x20aed4){try{jsonpatch[_0xc76b('0x25')](_0x20aed4,_0x336be9,!![]);}catch(_0x393b0b){return BPromise['reject'](_0x393b0b);}return _0x20aed4[_0xc76b('0x26')]();};}function saveUpdates(_0x4bf5a9,_0x51fafe){return function(_0x3bbede){if(_0x3bbede){return _0x3bbede[_0xc76b('0x27')](_0x4bf5a9)[_0xc76b('0x28')](function(_0xac9a7f){return _0xac9a7f;});}return null;};}function removeEntity(_0x18332d,_0xa6a862){return function(_0x24ee9a){if(_0x24ee9a){return _0x24ee9a[_0xc76b('0x29')]()['then'](function(){_0x18332d[_0xc76b('0x1d')](0xcc)[_0xc76b('0x2a')]();});}};}function handleEntityNotFound(_0x5f0a7b,_0xf43320){return function(_0x2ac9de){if(!_0x2ac9de){_0x5f0a7b[_0xc76b('0x1c')](0x194);}return _0x2ac9de;};}function handleError(_0x25ea69,_0x369fc1){_0x369fc1=_0x369fc1||0x1f4;return function(_0x451ee1){logger['error'](_0x451ee1['stack']);if(_0x451ee1[_0xc76b('0x2b')]){delete _0x451ee1[_0xc76b('0x2b')];}_0x25ea69[_0xc76b('0x1d')](_0x369fc1)[_0xc76b('0x2c')](_0x451ee1);};}exports['show']=function(_0xd92178,_0x26c19b){var _0x35d1bc={'raw':!![],'where':{'id':_0xd92178[_0xc76b('0x2d')]['id']}},_0x4a0918={};_0x4a0918[_0xc76b('0x2e')]=_[_0xc76b('0x2f')](db[_0xc76b('0x30')]['rawAttributes']);_0x4a0918[_0xc76b('0x31')]=_[_0xc76b('0x2f')](_0xd92178[_0xc76b('0x31')]);_0x4a0918[_0xc76b('0x32')]=_[_0xc76b('0x33')](_0x4a0918['model'],_0x4a0918[_0xc76b('0x31')]);_0x35d1bc['attributes']=_[_0xc76b('0x33')](_0x4a0918[_0xc76b('0x2e')],qs[_0xc76b('0x34')](_0xd92178[_0xc76b('0x31')][_0xc76b('0x34')]));_0x35d1bc[_0xc76b('0x35')]=_0x35d1bc['attributes']['length']?_0x35d1bc[_0xc76b('0x35')]:_0x4a0918[_0xc76b('0x2e')];if(_0xd92178[_0xc76b('0x31')][_0xc76b('0x36')]){_0x35d1bc[_0xc76b('0x37')]=[{'all':!![]}];}_0x35d1bc=_[_0xc76b('0x38')]({},_0x35d1bc,_0xd92178[_0xc76b('0x39')]);return db[_0xc76b('0x30')][_0xc76b('0x3a')](_0x35d1bc)[_0xc76b('0x28')](handleEntityNotFound(_0x26c19b,null))[_0xc76b('0x28')](respondWithResult(_0x26c19b,null))[_0xc76b('0x3b')](handleError(_0x26c19b,null));};exports[_0xc76b('0x27')]=function(_0x21bc23,_0xb3c2c6){if(_0x21bc23['body']['id']){delete _0x21bc23[_0xc76b('0x3c')]['id'];}return db[_0xc76b('0x30')][_0xc76b('0x3a')]({'where':{'id':_0x21bc23[_0xc76b('0x2d')]['id']}})[_0xc76b('0x28')](handleEntityNotFound(_0xb3c2c6,null))[_0xc76b('0x28')](saveUpdates(_0x21bc23[_0xc76b('0x3c')],null))[_0xc76b('0x28')](respondWithResult(_0xb3c2c6,null))[_0xc76b('0x3b')](handleError(_0xb3c2c6,null));};exports[_0xc76b('0x29')]=function(_0x41d26d,_0x3fc3d7){return db[_0xc76b('0x30')][_0xc76b('0x3a')]({'where':{'id':_0x41d26d['params']['id']}})[_0xc76b('0x28')](handleEntityNotFound(_0x3fc3d7,null))['then'](removeEntity(_0x3fc3d7,null))[_0xc76b('0x3b')](handleError(_0x3fc3d7,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index fe4ce32..2636dd8 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 _0xcc3b=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','chat_applications'];(function(_0x139928,_0x41ed69){var _0x16ef95=function(_0x12e1cf){while(--_0x12e1cf){_0x139928['push'](_0x139928['shift']());}};_0x16ef95(++_0x41ed69);}(_0xcc3b,0x119));var _0xbcc3=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xcc3b[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xbcc3('0x0'));var util=require(_0xbcc3('0x1'));var logger=require(_0xbcc3('0x2'))(_0xbcc3('0x3'));var moment=require(_0xbcc3('0x4'));var BPromise=require(_0xbcc3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcc3('0x6'));var rimraf=require(_0xbcc3('0x7'));var config=require(_0xbcc3('0x8'));var attributes=require(_0xbcc3('0x9'));module[_0xbcc3('0xa')]=function(_0x4e6c92,_0x3a1f9d){return _0x4e6c92[_0xbcc3('0xb')]('ChatApplication',attributes,{'tableName':_0xbcc3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbcc3('0xd')});}; \ No newline at end of file +var _0x5da8=['ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatApplication.attributes','define'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x5da8,0x1cb));var _0x85da=function(_0x56a0ec,_0x4bf91b){_0x56a0ec=_0x56a0ec-0x0;var _0x42966f=_0x5da8[_0x56a0ec];return _0x42966f;};'use strict';var _=require(_0x85da('0x0'));var util=require('util');var logger=require(_0x85da('0x1'))(_0x85da('0x2'));var moment=require(_0x85da('0x3'));var BPromise=require(_0x85da('0x4'));var rp=require(_0x85da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85da('0x6'));var attributes=require(_0x85da('0x7'));module['exports']=function(_0x492f7d,_0x21d7a0){return _0x492f7d[_0x85da('0x8')](_0x85da('0x9'),attributes,{'tableName':_0x85da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x85da('0xb'),'collate':_0x85da('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 99d92df..47dee06 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 _0x5905=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5905,0xe3));var _0x5590=function(_0x20e7a7,_0x503cae){_0x20e7a7=_0x20e7a7-0x0;var _0x259372=_0x5905[_0x20e7a7];return _0x259372;};'use strict';var _=require(_0x5590('0x0'));var util=require('util');var moment=require(_0x5590('0x1'));var BPromise=require(_0x5590('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5590('0x3'));var db=require(_0x5590('0x4'))['db'];var utils=require(_0x5590('0x5'));var logger=require(_0x5590('0x6'))(_0x5590('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5590('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1399be,_0x158ed9,_0x52ec4a){return new BPromise(function(_0x517761,_0x24a973){return client[_0x5590('0x9')](_0x1399be,_0x52ec4a)[_0x5590('0xa')](function(_0x4339ff){logger[_0x5590('0xb')](_0x5590('0xc'),_0x158ed9,'request\x20sent');logger[_0x5590('0xd')](_0x5590('0xe'),_0x158ed9,_0x5590('0xf'),JSON[_0x5590('0x10')](_0x4339ff));if(_0x4339ff[_0x5590('0x11')]){if(_0x4339ff[_0x5590('0x11')][_0x5590('0x12')]===0x1f4){logger[_0x5590('0x11')](_0x5590('0xc'),_0x158ed9,_0x4339ff[_0x5590('0x11')][_0x5590('0x13')]);return _0x24a973(_0x4339ff['error']['message']);}logger[_0x5590('0x11')](_0x5590('0xc'),_0x158ed9,_0x4339ff['error'][_0x5590('0x13')]);return _0x517761(_0x4339ff[_0x5590('0x11')][_0x5590('0x13')]);}else{logger[_0x5590('0xb')](_0x5590('0xc'),_0x158ed9,_0x5590('0xf'));_0x517761(_0x4339ff[_0x5590('0x14')][_0x5590('0x13')]);}})['catch'](function(_0xe6cc50){logger[_0x5590('0x11')]('ChatApplication,\x20%s,\x20%s',_0x158ed9,_0xe6cc50);_0x24a973(_0xe6cc50);});});} \ No newline at end of file +var _0x274d=['rpc','../../config/environment','jayson/promise','request','then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','randomstring','ioredis','../../config/logger'];(function(_0x2b4d01,_0x4c6044){var _0x4195d7=function(_0x59935){while(--_0x59935){_0x2b4d01['push'](_0x2b4d01['shift']());}};_0x4195d7(++_0x4c6044);}(_0x274d,0x1b4));var _0xd274=function(_0x1b3884,_0x9aab32){_0x1b3884=_0x1b3884-0x0;var _0x5908ca=_0x274d[_0x1b3884];return _0x5908ca;};'use strict';var _=require(_0xd274('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd274('0x1'));var fs=require('fs');var Redis=require(_0xd274('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd274('0x3'))(_0xd274('0x4'));var config=require(_0xd274('0x5'));var jayson=require(_0xd274('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5dd022,_0x22c2c2,_0x2de697){return new BPromise(function(_0x4732e9,_0x222ac9){return client[_0xd274('0x7')](_0x5dd022,_0x2de697)[_0xd274('0x8')](function(_0x58248e){logger['info'](_0xd274('0x9'),_0x22c2c2,'request\x20sent');logger[_0xd274('0xa')](_0xd274('0xb'),_0x22c2c2,_0xd274('0xc'),JSON[_0xd274('0xd')](_0x58248e));if(_0x58248e[_0xd274('0xe')]){if(_0x58248e['error'][_0xd274('0xf')]===0x1f4){logger[_0xd274('0xe')](_0xd274('0x9'),_0x22c2c2,_0x58248e['error'][_0xd274('0x10')]);return _0x222ac9(_0x58248e[_0xd274('0xe')][_0xd274('0x10')]);}logger[_0xd274('0xe')](_0xd274('0x9'),_0x22c2c2,_0x58248e[_0xd274('0xe')]['message']);return _0x4732e9(_0x58248e[_0xd274('0xe')]['message']);}else{logger[_0xd274('0x11')](_0xd274('0x9'),_0x22c2c2,'request\x20sent');_0x4732e9(_0x58248e[_0xd274('0x12')][_0xd274('0x10')]);}})[_0xd274('0x13')](function(_0x913a48){logger[_0xd274('0xe')](_0xd274('0x9'),_0x22c2c2,_0x913a48);_0x222ac9(_0x913a48);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index d4c29fe..51611d8 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 _0x90e4=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x477a3f,_0x2e0e85){var _0x375942=function(_0x3645eb){while(--_0x3645eb){_0x477a3f['push'](_0x477a3f['shift']());}};_0x375942(++_0x2e0e85);}(_0x90e4,0xfb));var _0x490e=function(_0x145b3c,_0x31ea4a){_0x145b3c=_0x145b3c-0x0;var _0x1b6e36=_0x90e4[_0x145b3c];return _0x1b6e36;};'use strict';var multer=require(_0x490e('0x0'));var util=require('util');var path=require(_0x490e('0x1'));var timeout=require(_0x490e('0x2'));var express=require(_0x490e('0x3'));var router=express[_0x490e('0x4')]();var fs_extra=require(_0x490e('0x5'));var auth=require(_0x490e('0x6'));var interaction=require(_0x490e('0x7'));var config=require(_0x490e('0x8'));var controller=require('./chatApplication.controller');router[_0x490e('0x9')](_0x490e('0xa'),auth[_0x490e('0xb')](),controller[_0x490e('0xc')]);router['put'](_0x490e('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x490e('0xd')]('/:id',auth[_0x490e('0xb')](),controller[_0x490e('0xe')]);module[_0x490e('0xf')]=router; \ No newline at end of file +var _0x3766=['/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3766,0x19b));var _0x6376=function(_0x17c283,_0x587fcc){_0x17c283=_0x17c283-0x0;var _0x4e0800=_0x3766[_0x17c283];return _0x4e0800;};'use strict';var multer=require(_0x6376('0x0'));var util=require(_0x6376('0x1'));var path=require('path');var timeout=require(_0x6376('0x2'));var express=require(_0x6376('0x3'));var router=express[_0x6376('0x4')]();var fs_extra=require(_0x6376('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6376('0x6'));var controller=require(_0x6376('0x7'));router[_0x6376('0x8')]('/:id',auth[_0x6376('0x9')](),controller[_0x6376('0xa')]);router[_0x6376('0xb')]('/:id',auth[_0x6376('0x9')](),controller[_0x6376('0xc')]);router[_0x6376('0xd')](_0x6376('0xe'),auth[_0x6376('0x9')](),controller[_0x6376('0xf')]);module[_0x6376('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 41f6549..09bef79 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 _0x325a=['BOOLEAN','sequelize','exports','STRING'];(function(_0x331cca,_0x4aa4d1){var _0x58c870=function(_0x5e1b43){while(--_0x5e1b43){_0x331cca['push'](_0x331cca['shift']());}};_0x58c870(++_0x4aa4d1);}(_0x325a,0x1b5));var _0xa325=function(_0x1880fd,_0x4c752c){_0x1880fd=_0x1880fd-0x0;var _0x5263e0=_0x325a[_0x1880fd];return _0x5263e0;};'use strict';var Sequelize=require(_0xa325('0x0'));module[_0xa325('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa325('0x2')]},'write':{'type':Sequelize[_0xa325('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xed5e=['sequelize','STRING','BOOLEAN'];(function(_0x57e389,_0x4c6889){var _0xdd53a1=function(_0x11bd50){while(--_0x11bd50){_0x57e389['push'](_0x57e389['shift']());}};_0xdd53a1(++_0x4c6889);}(_0xed5e,0xff));var _0xeed5=function(_0x50b919,_0x7cdb7f){_0x50b919=_0x50b919-0x0;var _0x12fec9=_0xed5e[_0x50b919];return _0x12fec9;};'use strict';var Sequelize=require(_0xeed5('0x0'));module['exports']={'name':{'type':Sequelize[_0xeed5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xeed5('0x1')]},'write':{'type':Sequelize[_0xeed5('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index d52ba6e..f0a8692 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 _0x24d6=['lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatGroup.socket','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','User','hasOwnProperty','removeMembers','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x398404,_0x22df2c){var _0x36d1ac=function(_0xcecea0){while(--_0xcecea0){_0x398404['push'](_0x398404['shift']());}};_0x36d1ac(++_0x22df2c);}(_0x24d6,0x1df));var _0x624d=function(_0x21c6b8,_0x16d6f6){_0x21c6b8=_0x21c6b8-0x0;var _0x39d474=_0x24d6[_0x21c6b8];return _0x39d474;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x624d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x624d('0x1'));var rp=require(_0x624d('0x2'));var moment=require(_0x624d('0x3'));var BPromise=require(_0x624d('0x4'));var Mustache=require(_0x624d('0x5'));var util=require(_0x624d('0x6'));var path=require(_0x624d('0x7'));var sox=require(_0x624d('0x8'));var csv=require(_0x624d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x624d('0xa'));var _=require(_0x624d('0xb'));var squel=require(_0x624d('0xc'));var crypto=require(_0x624d('0xd'));var jsforce=require(_0x624d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x624d('0x9'));var querystring=require(_0x624d('0xf'));var Papa=require('papaparse');var Redis=require(_0x624d('0x10'));var authService=require(_0x624d('0x11'));var qs=require(_0x624d('0x12'));var as=require(_0x624d('0x13'));var hardwareService=require(_0x624d('0x14'));var logger=require(_0x624d('0x15'))('api');var utils=require(_0x624d('0x16'));var config=require(_0x624d('0x17'));var licenseUtil=require(_0x624d('0x18'));var db=require(_0x624d('0x19'))['db'];config[_0x624d('0x1a')]=_[_0x624d('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x624d('0x1a')]));require(_0x624d('0x1c'))['register'](socket);function respondWithStatusCode(_0x22b75c,_0x5bcc89){_0x5bcc89=_0x5bcc89||0xcc;return function(_0x5356f3){if(_0x5356f3){return _0x22b75c[_0x624d('0x1d')](_0x5bcc89);}return _0x22b75c[_0x624d('0x1e')](_0x5bcc89)[_0x624d('0x1f')]();};}function respondWithResult(_0x583bb6,_0x45dce2){_0x45dce2=_0x45dce2||0xc8;return function(_0x58cd92){if(_0x58cd92){return _0x583bb6[_0x624d('0x1e')](_0x45dce2)['json'](_0x58cd92);}};}function respondWithFilteredResult(_0x323d58,_0x2f7268){return function(_0x1c0bd6){if(_0x1c0bd6){var _0x3cd2e9=typeof _0x2f7268[_0x624d('0x20')]==='undefined'&&typeof _0x2f7268[_0x624d('0x21')]===_0x624d('0x22');var _0x3cfc40=_0x1c0bd6['count'];var _0x42c65f=_0x3cd2e9?0x0:_0x2f7268[_0x624d('0x20')];var _0x5c101f=_0x3cd2e9?_0x1c0bd6[_0x624d('0x23')]:_0x2f7268[_0x624d('0x20')]+_0x2f7268['limit'];var _0x54d1db;if(_0x5c101f>=_0x3cfc40){_0x5c101f=_0x3cfc40;_0x54d1db=0xc8;}else{_0x54d1db=0xce;}_0x323d58[_0x624d('0x1e')](_0x54d1db);return _0x323d58[_0x624d('0x24')](_0x624d('0x25'),_0x42c65f+'-'+_0x5c101f+'/'+_0x3cfc40)[_0x624d('0x26')](_0x1c0bd6);}return null;};}function patchUpdates(_0x798fcd){return function(_0x14cd6d){try{jsonpatch[_0x624d('0x27')](_0x14cd6d,_0x798fcd,!![]);}catch(_0x229b0d){return BPromise[_0x624d('0x28')](_0x229b0d);}return _0x14cd6d['save']();};}function saveUpdates(_0x264dcf,_0x1ef17b){return function(_0x32e921){if(_0x32e921){return _0x32e921[_0x624d('0x29')](_0x264dcf)[_0x624d('0x2a')](function(_0x2fc749){return _0x2fc749;});}return null;};}function removeEntity(_0x49ccf5,_0x360cba){return function(_0xd63ba1){if(_0xd63ba1){return _0xd63ba1[_0x624d('0x2b')]()[_0x624d('0x2a')](function(){_0x49ccf5[_0x624d('0x1e')](0xcc)[_0x624d('0x1f')]();});}};}function handleEntityNotFound(_0x1501e3,_0x189828){return function(_0xaf0f6d){if(!_0xaf0f6d){_0x1501e3[_0x624d('0x1d')](0x194);}return _0xaf0f6d;};}function handleError(_0xd05a74,_0x4f8ea4){_0x4f8ea4=_0x4f8ea4||0x1f4;return function(_0x52f19a){logger[_0x624d('0x2c')](_0x52f19a[_0x624d('0x2d')]);if(_0x52f19a['name']){delete _0x52f19a[_0x624d('0x2e')];}_0xd05a74[_0x624d('0x1e')](_0x4f8ea4)['send'](_0x52f19a);};}exports[_0x624d('0x2f')]=function(_0x296890,_0x46214f){var _0x235bca={},_0x4d388b={},_0x5b8a94={'count':0x0,'rows':[]};var _0x12f18f=_[_0x624d('0x30')](db[_0x624d('0x31')][_0x624d('0x32')],function(_0x58d9e8){return{'name':_0x58d9e8[_0x624d('0x33')],'type':_0x58d9e8[_0x624d('0x34')]['key']};});_0x4d388b['model']=_[_0x624d('0x30')](_0x12f18f,_0x624d('0x2e'));_0x4d388b[_0x624d('0x35')]=_[_0x624d('0x36')](_0x296890[_0x624d('0x35')]);_0x4d388b[_0x624d('0x37')]=_[_0x624d('0x38')](_0x4d388b[_0x624d('0x39')],_0x4d388b[_0x624d('0x35')]);_0x235bca[_0x624d('0x3a')]=_[_0x624d('0x38')](_0x4d388b[_0x624d('0x39')],qs['fields'](_0x296890[_0x624d('0x35')]['fields']));_0x235bca[_0x624d('0x3a')]=_0x235bca['attributes'][_0x624d('0x3b')]?_0x235bca[_0x624d('0x3a')]:_0x4d388b['model'];if(!_0x296890['query']['hasOwnProperty'](_0x624d('0x3c'))){_0x235bca['limit']=qs[_0x624d('0x21')](_0x296890[_0x624d('0x35')]['limit']);_0x235bca[_0x624d('0x20')]=qs[_0x624d('0x20')](_0x296890[_0x624d('0x35')][_0x624d('0x20')]);}_0x235bca[_0x624d('0x3d')]=qs[_0x624d('0x3e')](_0x296890[_0x624d('0x35')][_0x624d('0x3e')]);_0x235bca[_0x624d('0x3f')]=qs[_0x624d('0x37')](_[_0x624d('0x40')](_0x296890[_0x624d('0x35')],_0x4d388b[_0x624d('0x37')]),_0x12f18f);if(_0x296890[_0x624d('0x35')][_0x624d('0x41')]){_0x235bca['where']=_[_0x624d('0x42')](_0x235bca[_0x624d('0x3f')],{'$or':_[_0x624d('0x30')](_0x12f18f,function(_0x5cd9c5){if(_0x5cd9c5[_0x624d('0x34')]!==_0x624d('0x43')){var _0x21a5e9={};_0x21a5e9[_0x5cd9c5['name']]={'$like':'%'+_0x296890[_0x624d('0x35')][_0x624d('0x41')]+'%'};return _0x21a5e9;}})});}_0x235bca=_[_0x624d('0x42')]({},_0x235bca,_0x296890[_0x624d('0x44')]);var _0xdda0b3={'where':_0x235bca[_0x624d('0x3f')]};return db[_0x624d('0x31')]['count'](_0xdda0b3)[_0x624d('0x2a')](function(_0x4a9466){_0x5b8a94['count']=_0x4a9466;if(_0x296890['query'][_0x624d('0x45')]){_0x235bca[_0x624d('0x46')]=[{'all':!![]}];}return db['ChatGroup'][_0x624d('0x47')](_0x235bca);})[_0x624d('0x2a')](function(_0x2e67ef){_0x5b8a94[_0x624d('0x48')]=_0x2e67ef;return _0x5b8a94;})[_0x624d('0x2a')](respondWithFilteredResult(_0x46214f,_0x235bca))[_0x624d('0x49')](handleError(_0x46214f,null));};exports[_0x624d('0x4a')]=function(_0x457ff5,_0x57fc98){var _0x428bc1={'raw':!![],'where':{'id':_0x457ff5[_0x624d('0x4b')]['id']}},_0x48148f={};_0x48148f['model']=_[_0x624d('0x36')](db[_0x624d('0x31')][_0x624d('0x32')]);_0x48148f[_0x624d('0x35')]=_[_0x624d('0x36')](_0x457ff5[_0x624d('0x35')]);_0x48148f[_0x624d('0x37')]=_[_0x624d('0x38')](_0x48148f[_0x624d('0x39')],_0x48148f[_0x624d('0x35')]);_0x428bc1[_0x624d('0x3a')]=_[_0x624d('0x38')](_0x48148f['model'],qs[_0x624d('0x4c')](_0x457ff5[_0x624d('0x35')]['fields']));_0x428bc1[_0x624d('0x3a')]=_0x428bc1[_0x624d('0x3a')][_0x624d('0x3b')]?_0x428bc1[_0x624d('0x3a')]:_0x48148f['model'];if(_0x457ff5[_0x624d('0x35')][_0x624d('0x45')]){_0x428bc1[_0x624d('0x46')]=[{'all':!![]}];}_0x428bc1=_[_0x624d('0x42')]({},_0x428bc1,_0x457ff5['options']);return db[_0x624d('0x31')][_0x624d('0x4d')](_0x428bc1)[_0x624d('0x2a')](handleEntityNotFound(_0x57fc98,null))[_0x624d('0x2a')](respondWithResult(_0x57fc98,null))['catch'](handleError(_0x57fc98,null));};exports[_0x624d('0x4e')]=function(_0x4863d9,_0x2d87cb){return db[_0x624d('0x31')][_0x624d('0x4e')](_0x4863d9['body'],{})['then'](respondWithResult(_0x2d87cb,0xc9))[_0x624d('0x49')](handleError(_0x2d87cb,null));};exports[_0x624d('0x29')]=function(_0x2a8809,_0x41a6fa){if(_0x2a8809[_0x624d('0x4f')]['id']){delete _0x2a8809['body']['id'];}return db['ChatGroup'][_0x624d('0x4d')]({'where':{'id':_0x2a8809[_0x624d('0x4b')]['id']}})[_0x624d('0x2a')](handleEntityNotFound(_0x41a6fa,null))[_0x624d('0x2a')](saveUpdates(_0x2a8809['body'],null))['then'](respondWithResult(_0x41a6fa,null))[_0x624d('0x49')](handleError(_0x41a6fa,null));};exports['destroy']=function(_0x464c96,_0x337925){return db['ChatGroup'][_0x624d('0x4d')]({'where':{'id':_0x464c96['params']['id']}})[_0x624d('0x2a')](handleEntityNotFound(_0x337925,null))[_0x624d('0x2a')](removeEntity(_0x337925,null))[_0x624d('0x49')](handleError(_0x337925,null));};exports[_0x624d('0x50')]=function(_0x136d11,_0x1501c3){return db[_0x624d('0x31')][_0x624d('0x50')]()[_0x624d('0x2a')](respondWithResult(_0x1501c3,null))[_0x624d('0x49')](handleError(_0x1501c3,null));};exports[_0x624d('0x51')]=function(_0x176bd1,_0x2109a0,_0x33bbe5){return db[_0x624d('0x52')][_0x624d('0x23')]({'where':{'ChatGroupId':_0x176bd1[_0x624d('0x4b')]['id'],'ToId':_0x176bd1['user']['id'],'read':![]}})[_0x624d('0x2a')](function(_0x22cbdb){return{'id':_[_0x624d('0x53')](_0x176bd1[_0x624d('0x4b')]['id']),'count':_0x22cbdb};})[_0x624d('0x2a')](respondWithResult(_0x2109a0,null))[_0x624d('0x49')](handleError(_0x2109a0,null));};exports[_0x624d('0x54')]=function(_0xac409a,_0x2b8eac,_0x577933){return db[_0x624d('0x31')][_0x624d('0x4d')]({'where':{'id':_0xac409a[_0x624d('0x4b')]['id']}})[_0x624d('0x2a')](handleEntityNotFound(_0x2b8eac,null))[_0x624d('0x2a')](function(_0x2ae41d){if(_0x2ae41d){return _0x2ae41d[_0x624d('0x54')](_0xac409a[_0x624d('0x4f')][_0x624d('0x55')],_[_0x624d('0x56')](_0xac409a[_0x624d('0x4f')],[_0x624d('0x55'),'id'])||{});}})[_0x624d('0x2a')](respondWithResult(_0x2b8eac,null))['catch'](handleError(_0x2b8eac,null));};exports[_0x624d('0x57')]=function(_0x3ce6f3,_0x1e29f2,_0xbde25c){var _0xda7a16={};var _0x24555f={};var _0x16cb38;var _0x370a47;return db[_0x624d('0x31')][_0x624d('0x58')]({'where':{'id':_0x3ce6f3[_0x624d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e29f2,null))[_0x624d('0x2a')](function(_0x575be0){if(_0x575be0){_0x16cb38=_0x575be0;_0x24555f[_0x624d('0x39')]=_[_0x624d('0x36')](db[_0x624d('0x59')]['rawAttributes']);_0x24555f['query']=_[_0x624d('0x36')](_0x3ce6f3[_0x624d('0x35')]);_0x24555f[_0x624d('0x37')]=_[_0x624d('0x38')](_0x24555f['model'],_0x24555f[_0x624d('0x35')]);_0xda7a16[_0x624d('0x3a')]=_[_0x624d('0x38')](_0x24555f[_0x624d('0x39')],qs[_0x624d('0x4c')](_0x3ce6f3['query'][_0x624d('0x4c')]));_0xda7a16[_0x624d('0x3a')]=_0xda7a16[_0x624d('0x3a')]['length']?_0xda7a16['attributes']:_0x24555f[_0x624d('0x39')];_0xda7a16[_0x624d('0x3d')]=qs['sort'](_0x3ce6f3[_0x624d('0x35')][_0x624d('0x3e')]);_0xda7a16[_0x624d('0x3f')]=qs[_0x624d('0x37')](_['pick'](_0x3ce6f3['query'],_0x24555f['filters']));if(_0x3ce6f3[_0x624d('0x35')][_0x624d('0x41')]){_0xda7a16[_0x624d('0x3f')]=_[_0x624d('0x42')](_0xda7a16[_0x624d('0x3f')],{'$or':_[_0x624d('0x30')](_0xda7a16['attributes'],function(_0x151eda){var _0x49587a={};_0x49587a[_0x151eda]={'$like':'%'+_0x3ce6f3[_0x624d('0x35')][_0x624d('0x41')]+'%'};return _0x49587a;})});}_0xda7a16=_[_0x624d('0x42')]({},_0xda7a16,_0x3ce6f3[_0x624d('0x44')]);return _0x16cb38[_0x624d('0x57')](_0xda7a16);}})['then'](function(_0x3b4d80){if(_0x3b4d80){_0x370a47=_0x3b4d80[_0x624d('0x3b')];if(!_0x3ce6f3[_0x624d('0x35')][_0x624d('0x5a')](_0x624d('0x3c'))){_0xda7a16[_0x624d('0x21')]=qs[_0x624d('0x21')](_0x3ce6f3[_0x624d('0x35')]['limit']);_0xda7a16[_0x624d('0x20')]=qs[_0x624d('0x20')](_0x3ce6f3[_0x624d('0x35')][_0x624d('0x20')]);}return _0x16cb38[_0x624d('0x57')](_0xda7a16);}})[_0x624d('0x2a')](function(_0x1244a3){if(_0x1244a3){return _0x1244a3?{'count':_0x370a47,'rows':_0x1244a3}:null;}})['then'](respondWithResult(_0x1e29f2,null))['catch'](handleError(_0x1e29f2,null));};exports[_0x624d('0x5b')]=function(_0x5f0f01,_0x36c5b0,_0x583837){return db[_0x624d('0x31')][_0x624d('0x4d')]({'where':{'id':_0x5f0f01[_0x624d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36c5b0,null))[_0x624d('0x2a')](function(_0x15dec0){if(_0x15dec0){return _0x15dec0['removeMembers'](_0x5f0f01[_0x624d('0x35')][_0x624d('0x55')]);}})[_0x624d('0x2a')](respondWithStatusCode(_0x36c5b0,null))[_0x624d('0x49')](handleError(_0x36c5b0,null));};exports['addMessage']=function(_0x12d468,_0x4f053c,_0x1c3c6c){if(_0x12d468['body']['id']){delete _0x12d468[_0x624d('0x4f')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x12d468[_0x624d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4f053c,null))['then'](function(_0x5ae771){if(_0x5ae771){_0x12d468[_0x624d('0x4f')][_0x624d('0x5c')]=_0x5ae771['id'];return db[_0x624d('0x52')][_0x624d('0x4e')](_0x12d468['body']);}})[_0x624d('0x2a')](respondWithResult(_0x4f053c,null))[_0x624d('0x49')](handleError(_0x4f053c,null));};exports[_0x624d('0x5d')]=function(_0x3cd2b2,_0x99acab,_0x387d3a){var _0x50d2e6={};var _0x25a439={};var _0x2c160f;var _0x3005e4;return db[_0x624d('0x31')][_0x624d('0x58')]({'where':{'id':_0x3cd2b2['params']['id']}})[_0x624d('0x2a')](handleEntityNotFound(_0x99acab,null))[_0x624d('0x2a')](function(_0x3757b7){if(_0x3757b7){_0x2c160f=_0x3757b7;_0x25a439['model']=_[_0x624d('0x36')](db[_0x624d('0x52')][_0x624d('0x32')]);_0x25a439[_0x624d('0x35')]=_[_0x624d('0x36')](_0x3cd2b2[_0x624d('0x35')]);_0x25a439[_0x624d('0x37')]=_['intersection'](_0x25a439['model'],_0x25a439[_0x624d('0x35')]);_0x50d2e6[_0x624d('0x3a')]=_['intersection'](_0x25a439[_0x624d('0x39')],qs[_0x624d('0x4c')](_0x3cd2b2[_0x624d('0x35')][_0x624d('0x4c')]));_0x50d2e6['attributes']=_0x50d2e6[_0x624d('0x3a')]['length']?_0x50d2e6[_0x624d('0x3a')]:_0x25a439[_0x624d('0x39')];_0x50d2e6[_0x624d('0x3d')]=qs[_0x624d('0x3e')](_0x3cd2b2[_0x624d('0x35')][_0x624d('0x3e')]);_0x50d2e6[_0x624d('0x3f')]=qs[_0x624d('0x37')](_[_0x624d('0x40')](_0x3cd2b2[_0x624d('0x35')],_0x25a439[_0x624d('0x37')]));if(_0x3cd2b2['query'][_0x624d('0x41')]){_0x50d2e6['where']=_[_0x624d('0x42')](_0x50d2e6[_0x624d('0x3f')],{'$or':_[_0x624d('0x30')](_0x50d2e6[_0x624d('0x3a')],function(_0x6ac3e7){var _0x28fa62={};_0x28fa62[_0x6ac3e7]={'$like':'%'+_0x3cd2b2[_0x624d('0x35')]['filter']+'%'};return _0x28fa62;})});}if(_0x3cd2b2[_0x624d('0x35')][_0x624d('0x5e')]){var _0x27453a=_0x3cd2b2['query'][_0x624d('0x5e')][_0x624d('0x5f')](',');var _0x4955da={};_0x4955da[_0x27453a[0x0]]={'$gte':moment(_0x27453a[0x1])[_0x624d('0x60')](_0x624d('0x61'))};_0x50d2e6['where']=_[_0x624d('0x42')](_0x50d2e6[_0x624d('0x3f')],_0x4955da);}_0x50d2e6=_[_0x624d('0x42')]({},_0x50d2e6,_0x3cd2b2[_0x624d('0x44')]);return _0x2c160f[_0x624d('0x5d')](_0x50d2e6);}})[_0x624d('0x2a')](function(_0x145ae0){if(_0x145ae0){_0x3005e4=_0x145ae0[_0x624d('0x3b')];if(!_0x3cd2b2[_0x624d('0x35')]['hasOwnProperty'](_0x624d('0x3c'))){_0x50d2e6[_0x624d('0x21')]=qs[_0x624d('0x21')](_0x3cd2b2['query'][_0x624d('0x21')]);_0x50d2e6[_0x624d('0x20')]=qs[_0x624d('0x20')](_0x3cd2b2[_0x624d('0x35')]['offset']);}return _0x2c160f[_0x624d('0x5d')](_0x50d2e6);}})[_0x624d('0x2a')](function(_0x5447b1){if(_0x5447b1){return _0x5447b1?{'count':_0x3005e4,'rows':_0x5447b1}:null;}})[_0x624d('0x2a')](respondWithResult(_0x99acab,null))['catch'](handleError(_0x99acab,null));}; \ No newline at end of file +var _0x007e=['ChatGroupId','findOne','$gte','split','format','getMessages','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','error','name','send','index','map','ChatGroup','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','keys','create','body','find','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','User','order','nolimit','removeMembers','addMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x007e,0x166));var _0xe007=function(_0x5e4487,_0x8b8232){_0x5e4487=_0x5e4487-0x0;var _0x10409b=_0x007e[_0x5e4487];return _0x10409b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe007('0x0'));var zipdir=require(_0xe007('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe007('0x2'));var moment=require(_0xe007('0x3'));var BPromise=require(_0xe007('0x4'));var Mustache=require(_0xe007('0x5'));var util=require('util');var path=require(_0xe007('0x6'));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('lodash');var squel=require(_0xe007('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe007('0x8'));var querystring=require(_0xe007('0x9'));var Papa=require(_0xe007('0xa'));var Redis=require(_0xe007('0xb'));var authService=require(_0xe007('0xc'));var qs=require(_0xe007('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe007('0xe'));var logger=require('../../config/logger')(_0xe007('0xf'));var utils=require('../../config/utils');var config=require(_0xe007('0x10'));var licenseUtil=require(_0xe007('0x11'));var db=require(_0xe007('0x12'))['db'];config['redis']=_[_0xe007('0x13')](config[_0xe007('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xe007('0x15'))(new Redis(config[_0xe007('0x14')]));require(_0xe007('0x16'))[_0xe007('0x17')](socket);function respondWithStatusCode(_0x33c40c,_0xfed403){_0xfed403=_0xfed403||0xcc;return function(_0xc74d13){if(_0xc74d13){return _0x33c40c[_0xe007('0x18')](_0xfed403);}return _0x33c40c[_0xe007('0x19')](_0xfed403)[_0xe007('0x1a')]();};}function respondWithResult(_0x48737c,_0x3882e6){_0x3882e6=_0x3882e6||0xc8;return function(_0x4e4425){if(_0x4e4425){return _0x48737c[_0xe007('0x19')](_0x3882e6)[_0xe007('0x1b')](_0x4e4425);}};}function respondWithFilteredResult(_0x44f2ab,_0x534e54){return function(_0x592a8c){if(_0x592a8c){var _0x49c36a=typeof _0x534e54[_0xe007('0x1c')]==='undefined'&&typeof _0x534e54[_0xe007('0x1d')]===_0xe007('0x1e');var _0xd64719=_0x592a8c[_0xe007('0x1f')];var _0x5076cf=_0x49c36a?0x0:_0x534e54[_0xe007('0x1c')];var _0x1f0185=_0x49c36a?_0x592a8c[_0xe007('0x1f')]:_0x534e54[_0xe007('0x1c')]+_0x534e54[_0xe007('0x1d')];var _0x3d4dd;if(_0x1f0185>=_0xd64719){_0x1f0185=_0xd64719;_0x3d4dd=0xc8;}else{_0x3d4dd=0xce;}_0x44f2ab[_0xe007('0x19')](_0x3d4dd);return _0x44f2ab[_0xe007('0x20')]('Content-Range',_0x5076cf+'-'+_0x1f0185+'/'+_0xd64719)[_0xe007('0x1b')](_0x592a8c);}return null;};}function patchUpdates(_0x5e6eee){return function(_0x5f05a0){try{jsonpatch[_0xe007('0x21')](_0x5f05a0,_0x5e6eee,!![]);}catch(_0x5eaf1b){return BPromise['reject'](_0x5eaf1b);}return _0x5f05a0[_0xe007('0x22')]();};}function saveUpdates(_0x52e693,_0x1d352f){return function(_0x1d74a6){if(_0x1d74a6){return _0x1d74a6[_0xe007('0x23')](_0x52e693)[_0xe007('0x24')](function(_0x53d7e3){return _0x53d7e3;});}return null;};}function removeEntity(_0x445123,_0x5c2735){return function(_0xeee007){if(_0xeee007){return _0xeee007['destroy']()[_0xe007('0x24')](function(){_0x445123[_0xe007('0x19')](0xcc)[_0xe007('0x1a')]();});}};}function handleEntityNotFound(_0x5d9884,_0x121024){return function(_0x44b3a9){if(!_0x44b3a9){_0x5d9884[_0xe007('0x18')](0x194);}return _0x44b3a9;};}function handleError(_0x866d1f,_0x14d27a){_0x14d27a=_0x14d27a||0x1f4;return function(_0x33beba){logger[_0xe007('0x25')](_0x33beba['stack']);if(_0x33beba['name']){delete _0x33beba[_0xe007('0x26')];}_0x866d1f['status'](_0x14d27a)[_0xe007('0x27')](_0x33beba);};}exports[_0xe007('0x28')]=function(_0x2e9ec8,_0x3e6de7){var _0x40432c={},_0x503bf9={},_0x52f9d6={'count':0x0,'rows':[]};var _0x55984a=_[_0xe007('0x29')](db[_0xe007('0x2a')]['rawAttributes'],function(_0x3a67ca){return{'name':_0x3a67ca['fieldName'],'type':_0x3a67ca[_0xe007('0x2b')][_0xe007('0x2c')]};});_0x503bf9[_0xe007('0x2d')]=_['map'](_0x55984a,_0xe007('0x26'));_0x503bf9[_0xe007('0x2e')]=_['keys'](_0x2e9ec8[_0xe007('0x2e')]);_0x503bf9[_0xe007('0x2f')]=_[_0xe007('0x30')](_0x503bf9[_0xe007('0x2d')],_0x503bf9[_0xe007('0x2e')]);_0x40432c[_0xe007('0x31')]=_[_0xe007('0x30')](_0x503bf9[_0xe007('0x2d')],qs[_0xe007('0x32')](_0x2e9ec8['query'][_0xe007('0x32')]));_0x40432c[_0xe007('0x31')]=_0x40432c[_0xe007('0x31')][_0xe007('0x33')]?_0x40432c[_0xe007('0x31')]:_0x503bf9[_0xe007('0x2d')];if(!_0x2e9ec8[_0xe007('0x2e')][_0xe007('0x34')]('nolimit')){_0x40432c[_0xe007('0x1d')]=qs[_0xe007('0x1d')](_0x2e9ec8[_0xe007('0x2e')][_0xe007('0x1d')]);_0x40432c[_0xe007('0x1c')]=qs[_0xe007('0x1c')](_0x2e9ec8[_0xe007('0x2e')][_0xe007('0x1c')]);}_0x40432c['order']=qs[_0xe007('0x35')](_0x2e9ec8[_0xe007('0x2e')][_0xe007('0x35')]);_0x40432c['where']=qs['filters'](_[_0xe007('0x36')](_0x2e9ec8[_0xe007('0x2e')],_0x503bf9[_0xe007('0x2f')]),_0x55984a);if(_0x2e9ec8[_0xe007('0x2e')][_0xe007('0x37')]){_0x40432c['where']=_[_0xe007('0x38')](_0x40432c[_0xe007('0x39')],{'$or':_['map'](_0x55984a,function(_0x185c1b){if(_0x185c1b[_0xe007('0x2b')]!==_0xe007('0x3a')){var _0x590b1a={};_0x590b1a[_0x185c1b[_0xe007('0x26')]]={'$like':'%'+_0x2e9ec8[_0xe007('0x2e')][_0xe007('0x37')]+'%'};return _0x590b1a;}})});}_0x40432c=_[_0xe007('0x38')]({},_0x40432c,_0x2e9ec8[_0xe007('0x3b')]);var _0x43ef64={'where':_0x40432c[_0xe007('0x39')]};return db[_0xe007('0x2a')][_0xe007('0x1f')](_0x43ef64)[_0xe007('0x24')](function(_0x57db58){_0x52f9d6[_0xe007('0x1f')]=_0x57db58;if(_0x2e9ec8[_0xe007('0x2e')][_0xe007('0x3c')]){_0x40432c[_0xe007('0x3d')]=[{'all':!![]}];}return db[_0xe007('0x2a')]['findAll'](_0x40432c);})['then'](function(_0x2c4ff2){_0x52f9d6['rows']=_0x2c4ff2;return _0x52f9d6;})['then'](respondWithFilteredResult(_0x3e6de7,_0x40432c))[_0xe007('0x3e')](handleError(_0x3e6de7,null));};exports['show']=function(_0xff7d34,_0x116831){var _0x348d53={'raw':!![],'where':{'id':_0xff7d34[_0xe007('0x3f')]['id']}},_0x804cc6={};_0x804cc6[_0xe007('0x2d')]=_['keys'](db['ChatGroup'][_0xe007('0x40')]);_0x804cc6[_0xe007('0x2e')]=_[_0xe007('0x41')](_0xff7d34[_0xe007('0x2e')]);_0x804cc6['filters']=_['intersection'](_0x804cc6[_0xe007('0x2d')],_0x804cc6['query']);_0x348d53[_0xe007('0x31')]=_[_0xe007('0x30')](_0x804cc6[_0xe007('0x2d')],qs['fields'](_0xff7d34[_0xe007('0x2e')][_0xe007('0x32')]));_0x348d53['attributes']=_0x348d53['attributes'][_0xe007('0x33')]?_0x348d53[_0xe007('0x31')]:_0x804cc6[_0xe007('0x2d')];if(_0xff7d34['query'][_0xe007('0x3c')]){_0x348d53[_0xe007('0x3d')]=[{'all':!![]}];}_0x348d53=_['merge']({},_0x348d53,_0xff7d34[_0xe007('0x3b')]);return db[_0xe007('0x2a')]['find'](_0x348d53)[_0xe007('0x24')](handleEntityNotFound(_0x116831,null))['then'](respondWithResult(_0x116831,null))['catch'](handleError(_0x116831,null));};exports['create']=function(_0x38f2eb,_0x3ef087){return db[_0xe007('0x2a')][_0xe007('0x42')](_0x38f2eb[_0xe007('0x43')],{})['then'](respondWithResult(_0x3ef087,0xc9))[_0xe007('0x3e')](handleError(_0x3ef087,null));};exports[_0xe007('0x23')]=function(_0x496a85,_0x3d2834){if(_0x496a85[_0xe007('0x43')]['id']){delete _0x496a85[_0xe007('0x43')]['id'];}return db[_0xe007('0x2a')][_0xe007('0x44')]({'where':{'id':_0x496a85[_0xe007('0x3f')]['id']}})[_0xe007('0x24')](handleEntityNotFound(_0x3d2834,null))[_0xe007('0x24')](saveUpdates(_0x496a85['body'],null))[_0xe007('0x24')](respondWithResult(_0x3d2834,null))[_0xe007('0x3e')](handleError(_0x3d2834,null));};exports['destroy']=function(_0x124625,_0x63cf9a){return db[_0xe007('0x2a')][_0xe007('0x44')]({'where':{'id':_0x124625['params']['id']}})[_0xe007('0x24')](handleEntityNotFound(_0x63cf9a,null))['then'](removeEntity(_0x63cf9a,null))[_0xe007('0x3e')](handleError(_0x63cf9a,null));};exports['describe']=function(_0x3579d5,_0x319018){return db['ChatGroup'][_0xe007('0x45')]()[_0xe007('0x24')](respondWithResult(_0x319018,null))['catch'](handleError(_0x319018,null));};exports[_0xe007('0x46')]=function(_0x33582e,_0x161bf6,_0x4f6544){return db[_0xe007('0x47')][_0xe007('0x1f')]({'where':{'ChatGroupId':_0x33582e[_0xe007('0x3f')]['id'],'ToId':_0x33582e['user']['id'],'read':![]}})[_0xe007('0x24')](function(_0x40468b){return{'id':_[_0xe007('0x48')](_0x33582e['params']['id']),'count':_0x40468b};})['then'](respondWithResult(_0x161bf6,null))[_0xe007('0x3e')](handleError(_0x161bf6,null));};exports[_0xe007('0x49')]=function(_0x438d98,_0x24d709,_0x199e6d){return db[_0xe007('0x2a')]['find']({'where':{'id':_0x438d98[_0xe007('0x3f')]['id']}})['then'](handleEntityNotFound(_0x24d709,null))[_0xe007('0x24')](function(_0x1daa1a){if(_0x1daa1a){return _0x1daa1a[_0xe007('0x49')](_0x438d98[_0xe007('0x43')][_0xe007('0x4a')],_[_0xe007('0x4b')](_0x438d98['body'],[_0xe007('0x4a'),'id'])||{});}})[_0xe007('0x24')](respondWithResult(_0x24d709,null))[_0xe007('0x3e')](handleError(_0x24d709,null));};exports[_0xe007('0x4c')]=function(_0x2a6ab1,_0x50669b,_0x2121d6){var _0x566bdc={};var _0x2343cd={};var _0xe25215;var _0x19561f;return db['ChatGroup']['findOne']({'where':{'id':_0x2a6ab1[_0xe007('0x3f')]['id']}})['then'](handleEntityNotFound(_0x50669b,null))['then'](function(_0x3c15c9){if(_0x3c15c9){_0xe25215=_0x3c15c9;_0x2343cd[_0xe007('0x2d')]=_[_0xe007('0x41')](db[_0xe007('0x4d')][_0xe007('0x40')]);_0x2343cd['query']=_[_0xe007('0x41')](_0x2a6ab1[_0xe007('0x2e')]);_0x2343cd[_0xe007('0x2f')]=_[_0xe007('0x30')](_0x2343cd['model'],_0x2343cd[_0xe007('0x2e')]);_0x566bdc[_0xe007('0x31')]=_[_0xe007('0x30')](_0x2343cd[_0xe007('0x2d')],qs[_0xe007('0x32')](_0x2a6ab1[_0xe007('0x2e')][_0xe007('0x32')]));_0x566bdc[_0xe007('0x31')]=_0x566bdc[_0xe007('0x31')]['length']?_0x566bdc[_0xe007('0x31')]:_0x2343cd['model'];_0x566bdc[_0xe007('0x4e')]=qs[_0xe007('0x35')](_0x2a6ab1[_0xe007('0x2e')][_0xe007('0x35')]);_0x566bdc[_0xe007('0x39')]=qs[_0xe007('0x2f')](_[_0xe007('0x36')](_0x2a6ab1[_0xe007('0x2e')],_0x2343cd['filters']));if(_0x2a6ab1['query'][_0xe007('0x37')]){_0x566bdc[_0xe007('0x39')]=_[_0xe007('0x38')](_0x566bdc['where'],{'$or':_[_0xe007('0x29')](_0x566bdc[_0xe007('0x31')],function(_0x20f934){var _0x3a60f0={};_0x3a60f0[_0x20f934]={'$like':'%'+_0x2a6ab1[_0xe007('0x2e')][_0xe007('0x37')]+'%'};return _0x3a60f0;})});}_0x566bdc=_[_0xe007('0x38')]({},_0x566bdc,_0x2a6ab1[_0xe007('0x3b')]);return _0xe25215[_0xe007('0x4c')](_0x566bdc);}})[_0xe007('0x24')](function(_0x5d6b48){if(_0x5d6b48){_0x19561f=_0x5d6b48[_0xe007('0x33')];if(!_0x2a6ab1[_0xe007('0x2e')][_0xe007('0x34')](_0xe007('0x4f'))){_0x566bdc[_0xe007('0x1d')]=qs['limit'](_0x2a6ab1[_0xe007('0x2e')][_0xe007('0x1d')]);_0x566bdc[_0xe007('0x1c')]=qs['offset'](_0x2a6ab1['query']['offset']);}return _0xe25215['getMembers'](_0x566bdc);}})['then'](function(_0x114717){if(_0x114717){return _0x114717?{'count':_0x19561f,'rows':_0x114717}:null;}})[_0xe007('0x24')](respondWithResult(_0x50669b,null))['catch'](handleError(_0x50669b,null));};exports['removeMembers']=function(_0x5d1cce,_0x4acc8e,_0x368a85){return db[_0xe007('0x2a')][_0xe007('0x44')]({'where':{'id':_0x5d1cce['params']['id']}})[_0xe007('0x24')](handleEntityNotFound(_0x4acc8e,null))['then'](function(_0x494633){if(_0x494633){return _0x494633[_0xe007('0x50')](_0x5d1cce[_0xe007('0x2e')][_0xe007('0x4a')]);}})[_0xe007('0x24')](respondWithStatusCode(_0x4acc8e,null))[_0xe007('0x3e')](handleError(_0x4acc8e,null));};exports[_0xe007('0x51')]=function(_0x711581,_0x218e9e,_0x24fca6){if(_0x711581['body']['id']){delete _0x711581['body']['id'];}return db[_0xe007('0x2a')][_0xe007('0x44')]({'where':{'id':_0x711581[_0xe007('0x3f')]['id']}})[_0xe007('0x24')](handleEntityNotFound(_0x218e9e,null))[_0xe007('0x24')](function(_0x56bad3){if(_0x56bad3){_0x711581[_0xe007('0x43')][_0xe007('0x52')]=_0x56bad3['id'];return db[_0xe007('0x47')][_0xe007('0x42')](_0x711581['body']);}})[_0xe007('0x24')](respondWithResult(_0x218e9e,null))[_0xe007('0x3e')](handleError(_0x218e9e,null));};exports['getMessages']=function(_0x61caad,_0x49785a,_0x4a0e9c){var _0x309644={};var _0x5c562c={};var _0x3f1cb8;var _0x1977a5;return db[_0xe007('0x2a')][_0xe007('0x53')]({'where':{'id':_0x61caad['params']['id']}})[_0xe007('0x24')](handleEntityNotFound(_0x49785a,null))['then'](function(_0x287b31){if(_0x287b31){_0x3f1cb8=_0x287b31;_0x5c562c['model']=_['keys'](db[_0xe007('0x47')][_0xe007('0x40')]);_0x5c562c[_0xe007('0x2e')]=_[_0xe007('0x41')](_0x61caad[_0xe007('0x2e')]);_0x5c562c[_0xe007('0x2f')]=_[_0xe007('0x30')](_0x5c562c[_0xe007('0x2d')],_0x5c562c[_0xe007('0x2e')]);_0x309644['attributes']=_[_0xe007('0x30')](_0x5c562c['model'],qs['fields'](_0x61caad[_0xe007('0x2e')][_0xe007('0x32')]));_0x309644['attributes']=_0x309644['attributes'][_0xe007('0x33')]?_0x309644['attributes']:_0x5c562c[_0xe007('0x2d')];_0x309644[_0xe007('0x4e')]=qs['sort'](_0x61caad['query'][_0xe007('0x35')]);_0x309644['where']=qs[_0xe007('0x2f')](_[_0xe007('0x36')](_0x61caad[_0xe007('0x2e')],_0x5c562c['filters']));if(_0x61caad[_0xe007('0x2e')]['filter']){_0x309644[_0xe007('0x39')]=_[_0xe007('0x38')](_0x309644[_0xe007('0x39')],{'$or':_['map'](_0x309644[_0xe007('0x31')],function(_0x2f4ccf){var _0x454f08={};_0x454f08[_0x2f4ccf]={'$like':'%'+_0x61caad[_0xe007('0x2e')][_0xe007('0x37')]+'%'};return _0x454f08;})});}if(_0x61caad['query']['$gte']){var _0x473f2c=_0x61caad[_0xe007('0x2e')][_0xe007('0x54')][_0xe007('0x55')](',');var _0x47af52={};_0x47af52[_0x473f2c[0x0]]={'$gte':moment(_0x473f2c[0x1])[_0xe007('0x56')]('YYYY-MM-DD\x20HH:mm:ss')};_0x309644[_0xe007('0x39')]=_[_0xe007('0x38')](_0x309644[_0xe007('0x39')],_0x47af52);}_0x309644=_[_0xe007('0x38')]({},_0x309644,_0x61caad['options']);return _0x3f1cb8[_0xe007('0x57')](_0x309644);}})[_0xe007('0x24')](function(_0x48cad6){if(_0x48cad6){_0x1977a5=_0x48cad6[_0xe007('0x33')];if(!_0x61caad['query']['hasOwnProperty']('nolimit')){_0x309644['limit']=qs[_0xe007('0x1d')](_0x61caad[_0xe007('0x2e')][_0xe007('0x1d')]);_0x309644[_0xe007('0x1c')]=qs[_0xe007('0x1c')](_0x61caad['query']['offset']);}return _0x3f1cb8[_0xe007('0x57')](_0x309644);}})[_0xe007('0x24')](function(_0x12ee1d){if(_0x12ee1d){return _0x12ee1d?{'count':_0x1977a5,'rows':_0x12ee1d}:null;}})[_0xe007('0x24')](respondWithResult(_0x49785a,null))[_0xe007('0x3e')](handleError(_0x49785a,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 511b036..b3558e0 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 _0x78d1=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','save','update'];(function(_0x225c0c,_0x5071b1){var _0x7d45e6=function(_0x58871d){while(--_0x58871d){_0x225c0c['push'](_0x225c0c['shift']());}};_0x7d45e6(++_0x5071b1);}(_0x78d1,0x159));var _0x178d=function(_0x5ac3c2,_0x4eeba6){_0x5ac3c2=_0x5ac3c2-0x0;var _0x5ac6ef=_0x78d1[_0x5ac3c2];return _0x5ac6ef;};'use strict';var EventEmitter=require(_0x178d('0x0'));var ChatGroup=require(_0x178d('0x1'))['db'][_0x178d('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x178d('0x3'),'afterUpdate':_0x178d('0x4'),'afterDestroy':_0x178d('0x5')};function emitEvent(_0x36446c){return function(_0x3c472e,_0x263b0f,_0x3cdf8b){ChatGroupEvents['emit'](_0x36446c+':'+_0x3c472e['id'],_0x3c472e);ChatGroupEvents[_0x178d('0x6')](_0x36446c,_0x3c472e);_0x3cdf8b(null);};}for(var e in events){if(events[_0x178d('0x7')](e)){var event=events[e];ChatGroup[_0x178d('0x8')](e,emitEvent(event));}}module[_0x178d('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x7c71=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update'];(function(_0x41f6b7,_0x2defae){var _0x215031=function(_0xdcc8b9){while(--_0xdcc8b9){_0x41f6b7['push'](_0x41f6b7['shift']());}};_0x215031(++_0x2defae);}(_0x7c71,0x177));var _0x17c7=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x7c71[_0x40220a];return _0x3903cc;};'use strict';var EventEmitter=require(_0x17c7('0x0'));var ChatGroup=require(_0x17c7('0x1'))['db'][_0x17c7('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x17c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x17c7('0x4'),'afterDestroy':_0x17c7('0x5')};function emitEvent(_0x3f9105){return function(_0x5a4923,_0x4fed29,_0xa4e319){ChatGroupEvents[_0x17c7('0x6')](_0x3f9105+':'+_0x5a4923['id'],_0x5a4923);ChatGroupEvents[_0x17c7('0x6')](_0x3f9105,_0x5a4923);_0xa4e319(null);};}for(var e in events){if(events[_0x17c7('0x7')](e)){var event=events[e];ChatGroup[_0x17c7('0x8')](e,emitEvent(event));}}module[_0x17c7('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 165f5f5..99a52c8 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 _0x73a7=['chat_groups','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x73a7,0xaa));var _0x773a=function(_0x3141ca,_0x2a77d7){_0x3141ca=_0x3141ca-0x0;var _0x521898=_0x73a7[_0x3141ca];return _0x521898;};'use strict';var _=require('lodash');var util=require(_0x773a('0x0'));var logger=require('../../config/logger')(_0x773a('0x1'));var moment=require(_0x773a('0x2'));var BPromise=require(_0x773a('0x3'));var rp=require(_0x773a('0x4'));var fs=require('fs');var path=require(_0x773a('0x5'));var rimraf=require(_0x773a('0x6'));var config=require(_0x773a('0x7'));var attributes=require(_0x773a('0x8'));module[_0x773a('0x9')]=function(_0x3490b1,_0x552fe6){return _0x3490b1[_0x773a('0xa')](_0x773a('0xb'),attributes,{'tableName':_0x773a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x046c=['chat_groups','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup'];(function(_0x36ed67,_0x109b5d){var _0x6efdf7=function(_0x3c9cb6){while(--_0x3c9cb6){_0x36ed67['push'](_0x36ed67['shift']());}};_0x6efdf7(++_0x109b5d);}(_0x046c,0x16c));var _0xc046=function(_0x129726,_0x10fc4a){_0x129726=_0x129726-0x0;var _0x4257bd=_0x046c[_0x129726];return _0x4257bd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc046('0x0'))(_0xc046('0x1'));var moment=require(_0xc046('0x2'));var BPromise=require(_0xc046('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc046('0x4'));var rimraf=require(_0xc046('0x5'));var config=require(_0xc046('0x6'));var attributes=require(_0xc046('0x7'));module['exports']=function(_0x37011a,_0x5e0a2a){return _0x37011a[_0xc046('0x8')](_0xc046('0x9'),attributes,{'tableName':_0xc046('0xa'),'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 52cfcb2..175a372 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 _0x35d0=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','request\x20sent'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x35d0,0xf9));var _0x035d=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x35d0[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x035d('0x0'));var util=require(_0x035d('0x1'));var moment=require('moment');var BPromise=require(_0x035d('0x2'));var rs=require(_0x035d('0x3'));var fs=require('fs');var Redis=require(_0x035d('0x4'));var db=require(_0x035d('0x5'))['db'];var utils=require(_0x035d('0x6'));var logger=require(_0x035d('0x7'))('rpc');var config=require(_0x035d('0x8'));var jayson=require(_0x035d('0x9'));var client=jayson[_0x035d('0xa')][_0x035d('0xb')]({'port':0x232a});config['redis']=_[_0x035d('0xc')](config[_0x035d('0xd')],{'host':_0x035d('0xe'),'port':0x18eb});var socket=require(_0x035d('0xf'))(new Redis(config[_0x035d('0xd')]));require(_0x035d('0x10'))[_0x035d('0x11')](socket);function respondWithRpcPromise(_0x422ef9,_0x347a28,_0x384462){return new BPromise(function(_0x52a011,_0x82cea4){return client['request'](_0x422ef9,_0x384462)[_0x035d('0x12')](function(_0x5b4ea3){logger[_0x035d('0x13')]('ChatGroup,\x20%s,\x20%s',_0x347a28,_0x035d('0x14'));logger[_0x035d('0x15')](_0x035d('0x16'),_0x347a28,_0x035d('0x14'),JSON[_0x035d('0x17')](_0x5b4ea3));if(_0x5b4ea3['error']){if(_0x5b4ea3['error'][_0x035d('0x18')]===0x1f4){logger[_0x035d('0x19')](_0x035d('0x1a'),_0x347a28,_0x5b4ea3[_0x035d('0x19')][_0x035d('0x1b')]);return _0x82cea4(_0x5b4ea3[_0x035d('0x19')][_0x035d('0x1b')]);}logger['error'](_0x035d('0x1a'),_0x347a28,_0x5b4ea3[_0x035d('0x19')][_0x035d('0x1b')]);return _0x52a011(_0x5b4ea3['error'][_0x035d('0x1b')]);}else{logger['info'](_0x035d('0x1a'),_0x347a28,_0x035d('0x14'));_0x52a011(_0x5b4ea3[_0x035d('0x1c')]['message']);}})[_0x035d('0x1d')](function(_0x2a5f1){logger['error'](_0x035d('0x1a'),_0x347a28,_0x2a5f1);_0x82cea4(_0x2a5f1);});});} \ No newline at end of file +var _0x8832=['../../config/environment','jayson/promise','client','redis','localhost','./chatGroup.socket','register','request','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2d5c0c,_0x2b3c68){var _0x586ea4=function(_0xd580fc){while(--_0xd580fc){_0x2d5c0c['push'](_0x2d5c0c['shift']());}};_0x586ea4(++_0x2b3c68);}(_0x8832,0x1f4));var _0x2883=function(_0x593b90,_0x391cd8){_0x593b90=_0x593b90-0x0;var _0xb3290b=_0x8832[_0x593b90];return _0xb3290b;};'use strict';var _=require(_0x2883('0x0'));var util=require(_0x2883('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2883('0x2'));var fs=require('fs');var Redis=require(_0x2883('0x3'));var db=require(_0x2883('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2883('0x5'))('rpc');var config=require(_0x2883('0x6'));var jayson=require(_0x2883('0x7'));var client=jayson[_0x2883('0x8')]['http']({'port':0x232a});config[_0x2883('0x9')]=_['defaults'](config[_0x2883('0x9')],{'host':_0x2883('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2883('0xb'))[_0x2883('0xc')](socket);function respondWithRpcPromise(_0x467978,_0x10f8c8,_0x21fd17){return new BPromise(function(_0x4a729c,_0x4b803f){return client[_0x2883('0xd')](_0x467978,_0x21fd17)['then'](function(_0x5f3fc1){logger['info'](_0x2883('0xe'),_0x10f8c8,'request\x20sent');logger[_0x2883('0xf')](_0x2883('0x10'),_0x10f8c8,_0x2883('0x11'),JSON[_0x2883('0x12')](_0x5f3fc1));if(_0x5f3fc1[_0x2883('0x13')]){if(_0x5f3fc1[_0x2883('0x13')]['code']===0x1f4){logger['error'](_0x2883('0xe'),_0x10f8c8,_0x5f3fc1[_0x2883('0x13')]['message']);return _0x4b803f(_0x5f3fc1[_0x2883('0x13')][_0x2883('0x14')]);}logger[_0x2883('0x13')](_0x2883('0xe'),_0x10f8c8,_0x5f3fc1[_0x2883('0x13')][_0x2883('0x14')]);return _0x4a729c(_0x5f3fc1[_0x2883('0x13')][_0x2883('0x14')]);}else{logger['info'](_0x2883('0xe'),_0x10f8c8,_0x2883('0x11'));_0x4a729c(_0x5f3fc1[_0x2883('0x15')][_0x2883('0x14')]);}})[_0x2883('0x16')](function(_0x2632eb){logger[_0x2883('0x13')](_0x2883('0xe'),_0x10f8c8,_0x2632eb);_0x4b803f(_0x2632eb);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 47dd422..0e4c699 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 _0x2d78=['emit','removeListener','register','length','./chatGroup.events','save','remove','update'];(function(_0x240cca,_0x392017){var _0x118f2c=function(_0x2a42de){while(--_0x2a42de){_0x240cca['push'](_0x240cca['shift']());}};_0x118f2c(++_0x392017);}(_0x2d78,0xe4));var _0x82d7=function(_0x475aa9,_0x439aab){_0x475aa9=_0x475aa9-0x0;var _0x360bbc=_0x2d78[_0x475aa9];return _0x360bbc;};'use strict';var ChatGroupEvents=require(_0x82d7('0x0'));var events=[_0x82d7('0x1'),_0x82d7('0x2'),_0x82d7('0x3')];function createListener(_0x475b68,_0x13ead3){return function(_0x240f54){_0x13ead3[_0x82d7('0x4')](_0x475b68,_0x240f54);};}function removeListener(_0x217ede,_0x2b0120){return function(){ChatGroupEvents[_0x82d7('0x5')](_0x217ede,_0x2b0120);};}exports[_0x82d7('0x6')]=function(_0x376d76){for(var _0x333f5b=0x0,_0xd735e8=events[_0x82d7('0x7')];_0x333f5b<_0xd735e8;_0x333f5b++){var _0x3a8342=events[_0x333f5b];var _0x184943=createListener('chatGroup:'+_0x3a8342,_0x376d76);ChatGroupEvents['on'](_0x3a8342,_0x184943);}}; \ No newline at end of file +var _0x27ff=['emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','update'];(function(_0x1a01b1,_0xcc2032){var _0xbea4b2=function(_0x3768d1){while(--_0x3768d1){_0x1a01b1['push'](_0x1a01b1['shift']());}};_0xbea4b2(++_0xcc2032);}(_0x27ff,0xf5));var _0xf27f=function(_0x23082a,_0x445d35){_0x23082a=_0x23082a-0x0;var _0x4be541=_0x27ff[_0x23082a];return _0x4be541;};'use strict';var ChatGroupEvents=require(_0xf27f('0x0'));var events=[_0xf27f('0x1'),'remove',_0xf27f('0x2')];function createListener(_0xee4c9d,_0x5c0cb9){return function(_0x138a5d){_0x5c0cb9[_0xf27f('0x3')](_0xee4c9d,_0x138a5d);};}function removeListener(_0x422fbb,_0x14cb3c){return function(){ChatGroupEvents[_0xf27f('0x4')](_0x422fbb,_0x14cb3c);};}exports[_0xf27f('0x5')]=function(_0xba170a){for(var _0x38b398=0x0,_0x5de2e1=events[_0xf27f('0x6')];_0x38b398<_0x5de2e1;_0x38b398++){var _0x279a5a=events[_0x38b398];var _0x2959d5=createListener(_0xf27f('0x7')+_0x279a5a,_0xba170a);ChatGroupEvents['on'](_0x279a5a,_0x2959d5);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 8ea44bb..f1b3d45 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 _0x32d9=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','addMessage','put','update','delete','destroy','/:id/members','removeMembers','exports','multer','util','path','connect-timeout','express'];(function(_0x24cf9b,_0x19a454){var _0x48735d=function(_0x11d3b0){while(--_0x11d3b0){_0x24cf9b['push'](_0x24cf9b['shift']());}};_0x48735d(++_0x19a454);}(_0x32d9,0x6f));var _0x932d=function(_0x1729d5,_0x5921c5){_0x1729d5=_0x1729d5-0x0;var _0x6bb300=_0x32d9[_0x1729d5];return _0x6bb300;};'use strict';var multer=require(_0x932d('0x0'));var util=require(_0x932d('0x1'));var path=require(_0x932d('0x2'));var timeout=require(_0x932d('0x3'));var express=require(_0x932d('0x4'));var router=express[_0x932d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x932d('0x6'));var interaction=require(_0x932d('0x7'));var config=require(_0x932d('0x8'));var controller=require('./chatGroup.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x932d('0x9')](_0x932d('0xa'),auth[_0x932d('0xb')](),controller[_0x932d('0xc')]);router[_0x932d('0x9')](_0x932d('0xd'),auth['isAuthenticated'](),controller[_0x932d('0xe')]);router[_0x932d('0x9')](_0x932d('0xf'),auth[_0x932d('0xb')](),controller[_0x932d('0x10')]);router['get']('/:id/members',auth[_0x932d('0xb')](),controller[_0x932d('0x11')]);router[_0x932d('0x9')](_0x932d('0x12'),auth[_0x932d('0xb')](),controller[_0x932d('0x13')]);router[_0x932d('0x14')]('/',auth[_0x932d('0xb')](),controller['create']);router[_0x932d('0x14')]('/:id/members',auth[_0x932d('0xb')](),controller['addMembers']);router['post'](_0x932d('0x12'),auth[_0x932d('0xb')](),controller[_0x932d('0x15')]);router[_0x932d('0x16')](_0x932d('0xd'),auth[_0x932d('0xb')](),controller[_0x932d('0x17')]);router[_0x932d('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x932d('0x19')]);router[_0x932d('0x18')](_0x932d('0x1a'),auth[_0x932d('0xb')](),controller[_0x932d('0x1b')]);module[_0x932d('0x1c')]=router; \ No newline at end of file +var _0x42f4=['/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','post','addMembers','addMessage','put','update','delete','removeMembers','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','describe'];(function(_0x57acaa,_0x34cf60){var _0x34edad=function(_0x1f046f){while(--_0x1f046f){_0x57acaa['push'](_0x57acaa['shift']());}};_0x34edad(++_0x34cf60);}(_0x42f4,0xd6));var _0x442f=function(_0x5ad220,_0x27407e){_0x5ad220=_0x5ad220-0x0;var _0xdec77d=_0x42f4[_0x5ad220];return _0xdec77d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x442f('0x0'));var timeout=require(_0x442f('0x1'));var express=require(_0x442f('0x2'));var router=express['Router']();var fs_extra=require(_0x442f('0x3'));var auth=require(_0x442f('0x4'));var interaction=require(_0x442f('0x5'));var config=require(_0x442f('0x6'));var controller=require(_0x442f('0x7'));router[_0x442f('0x8')]('/',auth[_0x442f('0x9')](),controller['index']);router[_0x442f('0x8')]('/describe',auth[_0x442f('0x9')](),controller[_0x442f('0xa')]);router[_0x442f('0x8')](_0x442f('0xb'),auth[_0x442f('0x9')](),controller[_0x442f('0xc')]);router[_0x442f('0x8')](_0x442f('0xd'),auth[_0x442f('0x9')](),controller[_0x442f('0xe')]);router[_0x442f('0x8')]('/:id/members',auth[_0x442f('0x9')](),controller[_0x442f('0xf')]);router[_0x442f('0x8')](_0x442f('0x10'),auth[_0x442f('0x9')](),controller['getMessages']);router[_0x442f('0x11')]('/',auth[_0x442f('0x9')](),controller['create']);router[_0x442f('0x11')]('/:id/members',auth[_0x442f('0x9')](),controller[_0x442f('0x12')]);router[_0x442f('0x11')](_0x442f('0x10'),auth[_0x442f('0x9')](),controller[_0x442f('0x13')]);router[_0x442f('0x14')]('/:id',auth[_0x442f('0x9')](),controller[_0x442f('0x15')]);router['delete'](_0x442f('0xb'),auth[_0x442f('0x9')](),controller['destroy']);router[_0x442f('0x16')]('/:id/members',auth[_0x442f('0x9')](),controller[_0x442f('0x17')]);module[_0x442f('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 7e2dec3..6d7c5ac 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 _0x4227=['thumb','TEXT','STRING','DATE','long','ENUM','BOOLEAN','sequelize','INTEGER','star'];(function(_0x158d73,_0x57cbb4){var _0x327284=function(_0x10956a){while(--_0x10956a){_0x158d73['push'](_0x158d73['shift']());}};_0x327284(++_0x57cbb4);}(_0x4227,0x89));var _0x7422=function(_0x596d77,_0x408cc9){_0x596d77=_0x596d77-0x0;var _0x5185cf=_0x4227[_0x596d77];return _0x5185cf;};'use strict';var Sequelize=require(_0x7422('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7422('0x1')]},'ratingType':{'type':Sequelize['ENUM'](_0x7422('0x2'),_0x7422('0x3')),'defaultValue':_0x7422('0x2')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x7422('0x4')]},'mailTranscript':{'type':Sequelize[_0x7422('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7422('0x6')]},'disposition':{'type':Sequelize[_0x7422('0x5')]},'secondDisposition':{'type':Sequelize[_0x7422('0x5')]},'thirdDisposition':{'type':Sequelize[_0x7422('0x5')]},'note':{'type':Sequelize[_0x7422('0x5')]},'browserName':{'type':Sequelize[_0x7422('0x5')]},'browserVersion':{'type':Sequelize[_0x7422('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x7422('0x5')]},'deviceModel':{'type':Sequelize[_0x7422('0x5')]},'deviceVendor':{'type':Sequelize[_0x7422('0x5')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x7422('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7422('0x4')](_0x7422('0x7'))},'read1stAt':{'type':Sequelize[_0x7422('0x6')]},'lastMsgAt':{'type':Sequelize[_0x7422('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x7422('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7422('0x5')]},'customerPort':{'type':Sequelize[_0x7422('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x7422('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xa571=['exports','BOOLEAN','INTEGER','star','thumb','TEXT','DATE','STRING','long','ENUM','sequelize'];(function(_0x158e3b,_0x4534b){var _0x551a1d=function(_0x629c21){while(--_0x629c21){_0x158e3b['push'](_0x158e3b['shift']());}};_0x551a1d(++_0x4534b);}(_0xa571,0x107));var _0x1a57=function(_0x34ea07,_0x3c13b0){_0x34ea07=_0x34ea07-0x0;var _0x2af74b=_0xa571[_0x34ea07];return _0x2af74b;};'use strict';var Sequelize=require(_0x1a57('0x0'));module[_0x1a57('0x1')]={'closed':{'type':Sequelize[_0x1a57('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1a57('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x1a57('0x4'),_0x1a57('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x1a57('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1a57('0x7')]},'disposition':{'type':Sequelize[_0x1a57('0x8')]},'secondDisposition':{'type':Sequelize[_0x1a57('0x8')]},'thirdDisposition':{'type':Sequelize[_0x1a57('0x8')]},'note':{'type':Sequelize[_0x1a57('0x8')]},'browserName':{'type':Sequelize[_0x1a57('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x1a57('0x8')]},'osVersion':{'type':Sequelize[_0x1a57('0x8')]},'deviceModel':{'type':Sequelize[_0x1a57('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x1a57('0x8')]},'referer':{'type':Sequelize[_0x1a57('0x6')]},'customerIp':{'type':Sequelize[_0x1a57('0x8')]},'formData':{'type':Sequelize[_0x1a57('0x6')](_0x1a57('0x9'))},'read1stAt':{'type':Sequelize[_0x1a57('0x7')]},'lastMsgAt':{'type':Sequelize[_0x1a57('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x1a57('0xa')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x1a57('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x1a57('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x1a57('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 e46ad2b..cf2f663 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 _0x0ec7=['./chatInteraction.socket','register','http','client','then','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','end','undefined','limit','count','offset','status','Content-Range','update','stack','name','send','body','agent','interaction','account','map','fieldName','key','getOptions','findAll','chat','query','user','show','model','ChatInteraction','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','destroy','createVidaooSession','params','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooApiKey','fullname','contact','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','vidaooMetadata','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','closed','AbandonInteraction','abandon','file','basename','filename','type','Attachment','attachmentDownload','json','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','ContactId','%s%d','agentAlias','System','customer','format','Visitor','agentIdentifier','website_alias','agent_alias','User','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','rawAttributes','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','includeAgent','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','push','read','mkdirSync','Chat','Owner','N.A.','closedAt','disposition','browserName','referer','customerIp','customerPort','existsSync','createReadStream','value','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','request-promise','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0x0ec7,0xbb));var _0x70ec=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x0ec7[_0x484e36];return _0xafc85d;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require(_0x70ec('0x0'));var moment=require(_0x70ec('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x70ec('0x2'));var path=require(_0x70ec('0x3'));var ejs=require(_0x70ec('0x4'));var fs=require('fs');var _=require(_0x70ec('0x5'));var Redis=require(_0x70ec('0x6'));var interaction=require(_0x70ec('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x70ec('0x8'));var config=require(_0x70ec('0x9'));var db=require(_0x70ec('0xa'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x70ec('0xb'),'port':0x18eb});var socket=require(_0x70ec('0xc'))(new Redis(config[_0x70ec('0xd')]));require(_0x70ec('0xe'))[_0x70ec('0xf')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x70ec('0x10')]({'port':0x232b});var client9004=jayson[_0x70ec('0x11')]['http']({'port':0x232c});function respondWithRpcPromise(_0x53594b,_0x2f8f55,_0x27de49,_0x432ae1){return new BPromise(function(_0x2091ff,_0x1809cd){var _0x4ae853=_0x432ae1||client;return _0x4ae853['request'](_0x53594b,_0x27de49)[_0x70ec('0x12')](function(_0x230f4e){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x2f8f55,'request\x20sent');logger['debug'](_0x70ec('0x13'),_0x2f8f55,'request\x20sent',JSON['stringify'](_0x230f4e));if(_0x230f4e[_0x70ec('0x14')]){if(_0x230f4e['error'][_0x70ec('0x15')]===0x1f4){logger[_0x70ec('0x14')](_0x70ec('0x16'),_0x2f8f55,_0x230f4e[_0x70ec('0x14')]['message']);return _0x1809cd(_0x230f4e[_0x70ec('0x14')][_0x70ec('0x17')]);}logger[_0x70ec('0x14')](_0x70ec('0x16'),_0x2f8f55,_0x230f4e['error'][_0x70ec('0x17')]);return _0x2091ff(_0x230f4e[_0x70ec('0x14')][_0x70ec('0x17')]);}else{logger['info'](_0x70ec('0x16'),_0x2f8f55,_0x70ec('0x18'));_0x2091ff(_0x230f4e[_0x70ec('0x19')][_0x70ec('0x17')]);}})[_0x70ec('0x1a')](function(_0x1678d6){logger[_0x70ec('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x2f8f55,_0x1678d6);_0x1809cd(_0x1678d6);});});}function respondWithStatusCode(_0x94da90,_0x9d5eb){_0x9d5eb=_0x9d5eb||0xcc;return function(_0x18660c){if(_0x18660c){return _0x94da90[_0x70ec('0x1b')](_0x9d5eb);}return _0x94da90['status'](_0x9d5eb)[_0x70ec('0x1c')]();};}function respondWithResult(_0x22adae,_0x58968b){_0x58968b=_0x58968b||0xc8;return function(_0x591b59){if(_0x591b59){return _0x22adae['status'](_0x58968b)['json'](_0x591b59);}};}function respondWithFilteredResult(_0x28c784,_0x175a8f){return function(_0x5c6e66){if(_0x5c6e66){var _0x10872d=typeof _0x175a8f['offset']===_0x70ec('0x1d')&&typeof _0x175a8f[_0x70ec('0x1e')]==='undefined';var _0x35ae79=_0x5c6e66[_0x70ec('0x1f')];var _0x5993ff=_0x10872d?0x0:_0x175a8f[_0x70ec('0x20')];var _0x48a93e=_0x10872d?_0x5c6e66[_0x70ec('0x1f')]:_0x175a8f[_0x70ec('0x20')]+_0x175a8f[_0x70ec('0x1e')];var _0x2f7dd9;if(_0x48a93e>=_0x35ae79){_0x48a93e=_0x35ae79;_0x2f7dd9=0xc8;}else{_0x2f7dd9=0xce;}_0x28c784[_0x70ec('0x21')](_0x2f7dd9);return _0x28c784['set'](_0x70ec('0x22'),_0x5993ff+'-'+_0x48a93e+'/'+_0x35ae79)['json'](_0x5c6e66);}return null;};}function saveUpdates(_0x171682){return function(_0x326605){if(_0x326605){return _0x326605[_0x70ec('0x23')](_0x171682)[_0x70ec('0x12')](function(_0x3ab2c9){return _0x3ab2c9;});}return null;};}function removeEntity(_0x356167){return function(_0x353083){if(_0x353083){return _0x353083['destroy']()['then'](function(){_0x356167[_0x70ec('0x21')](0xcc)[_0x70ec('0x1c')]();});}};}function handleEntityNotFound(_0x414780){return function(_0x55bbf5){if(!_0x55bbf5){_0x414780[_0x70ec('0x1b')](0x194);}return _0x55bbf5;};}function handleError(_0x41d2ec,_0x1d716e){_0x1d716e=_0x1d716e||0x1f4;return function(_0x574abc){logger[_0x70ec('0x14')](_0x574abc[_0x70ec('0x24')]);if(_0x574abc['name']){delete _0x574abc[_0x70ec('0x25')];}_0x41d2ec[_0x70ec('0x21')](_0x1d716e)[_0x70ec('0x26')](_0x574abc);};}function getMustacheRender(_0xc502a3,_0x5d6da2){return Mustache['render'](_0xc502a3,_['merge'](_0x5d6da2[_0x70ec('0x27')],{'contact':_0x5d6da2['contact'],'message':_0x5d6da2[_0x70ec('0x17')],'agent':_0x5d6da2[_0x70ec('0x28')],'interaction':_0x5d6da2[_0x70ec('0x29')],'account':_0x5d6da2[_0x70ec('0x2a')]}))||'';}exports['index']=function(_0x33a61b,_0x5aedd5){var _0x5c00c1={};var _0x1bd42e=_[_0x70ec('0x2b')](db['ChatInteraction']['rawAttributes'],function(_0xac977e){return{'name':_0xac977e[_0x70ec('0x2c')],'type':_0xac977e['type'][_0x70ec('0x2d')]};});_0x5c00c1=qs[_0x70ec('0x2e')](_0x1bd42e,_0x33a61b);return interaction[_0x70ec('0x2f')](_0x70ec('0x30'),_0x33a61b[_0x70ec('0x31')],_0x33a61b[_0x70ec('0x32')],_0x5c00c1,_0x1bd42e)[_0x70ec('0x12')](respondWithFilteredResult(_0x5aedd5,_0x5c00c1))[_0x70ec('0x1a')](handleError(_0x5aedd5,null));};exports[_0x70ec('0x33')]=function(_0x48ce62,_0x5edce7){var _0x30f100={'raw':![],'where':{'id':_0x48ce62['params']['id']}},_0x1d3228={};_0x1d3228[_0x70ec('0x34')]=_['keys'](db[_0x70ec('0x35')]['rawAttributes']);_0x1d3228[_0x70ec('0x31')]=_[_0x70ec('0x36')](_0x48ce62[_0x70ec('0x31')]);_0x1d3228[_0x70ec('0x37')]=_[_0x70ec('0x38')](_0x1d3228[_0x70ec('0x34')],_0x1d3228[_0x70ec('0x31')]);_0x30f100[_0x70ec('0x39')]=_[_0x70ec('0x38')](_0x1d3228[_0x70ec('0x34')],qs[_0x70ec('0x3a')](_0x48ce62[_0x70ec('0x31')]['fields']));_0x30f100['attributes']=_0x30f100['attributes'][_0x70ec('0x3b')]?_0x30f100[_0x70ec('0x39')]:_0x1d3228[_0x70ec('0x34')];if(_0x48ce62[_0x70ec('0x31')][_0x70ec('0x3c')]){_0x30f100[_0x70ec('0x3d')]=[{'all':!![]}];}_0x30f100=_[_0x70ec('0x3e')]({},_0x30f100,_0x48ce62[_0x70ec('0x3f')]);return db[_0x70ec('0x35')][_0x70ec('0x40')](_0x30f100)[_0x70ec('0x12')](handleEntityNotFound(_0x5edce7,null))[_0x70ec('0x12')](respondWithResult(_0x5edce7,null))[_0x70ec('0x1a')](handleError(_0x5edce7,null));};exports[_0x70ec('0x41')]=function(_0x1a2eb4,_0x1fa8d2){return db['ChatInteraction'][_0x70ec('0x41')](_0x1a2eb4['body'],{})[_0x70ec('0x12')](respondWithResult(_0x1fa8d2,0xc9))[_0x70ec('0x1a')](handleError(_0x1fa8d2,null));};exports[_0x70ec('0x23')]=function(_0x5f3117,_0x794e5d){if(_0x5f3117[_0x70ec('0x27')]['id']){delete _0x5f3117[_0x70ec('0x27')]['id'];}return db['ChatInteraction'][_0x70ec('0x40')]({'where':{'id':_0x5f3117['params']['id']}})[_0x70ec('0x12')](handleEntityNotFound(_0x794e5d,null))[_0x70ec('0x12')](saveUpdates(_0x5f3117[_0x70ec('0x27')],null))[_0x70ec('0x12')](respondWithResult(_0x794e5d,null))[_0x70ec('0x1a')](handleError(_0x794e5d,null));};exports[_0x70ec('0x42')]=function(_0x1b2366,_0x6cf7e2){return db['ChatInteraction'][_0x70ec('0x40')]({'where':{'id':_0x1b2366['params']['id']}})[_0x70ec('0x12')](handleEntityNotFound(_0x6cf7e2,null))[_0x70ec('0x12')](removeEntity(_0x6cf7e2,null))[_0x70ec('0x1a')](handleError(_0x6cf7e2,null));};exports['describe']=function(_0x401005,_0x127e41){return db[_0x70ec('0x35')]['describe']()[_0x70ec('0x12')](respondWithResult(_0x127e41,null))['catch'](handleError(_0x127e41,null));};exports[_0x70ec('0x43')]=function(_0x5b2c91,_0x3ac2f8){var _0x47e4cb=_0x5b2c91[_0x70ec('0x44')]['id'];var _0x149306;var _0x10fd21;var _0xe84e92;return db[_0x70ec('0x35')][_0x70ec('0x45')]({'where':{'id':_0x47e4cb}})[_0x70ec('0x12')](function(_0x1c139e){_0x149306=_0x1c139e;return db[_0x70ec('0x46')]['findOne']({'where':{'id':_0x1c139e[_0x70ec('0x47')]},'attributes':['id','vidaooApiKey',_0x70ec('0x48'),_0x70ec('0x49'),_0x70ec('0x4a'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x1de936){if(_0x1de936&&_0x1de936[_0x70ec('0x4b')]&&_0x1de936[_0x70ec('0x48')]){_0x10fd21=_0x1de936;var _0x4f8117={'interaction':{'id':_0x47e4cb},'agent':{'id':_0x5b2c91[_0x70ec('0x32')]['id'],'name':_0x5b2c91[_0x70ec('0x32')][_0x70ec('0x25')],'fullname':_0x5b2c91[_0x70ec('0x32')][_0x70ec('0x4c')],'email':_0x5b2c91[_0x70ec('0x32')]['email']},'contact':_0x5b2c91[_0x70ec('0x27')][_0x70ec('0x4d')],'account':_0x5b2c91[_0x70ec('0x27')][_0x70ec('0x2a')]};var _0x71fe27={'rejectUnauthorized':![],'method':'POST','url':_0x70ec('0x4e'),'headers':{'X-APIKEY':_0x1de936[_0x70ec('0x4b')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5b2c91[_0x70ec('0x32')][_0x70ec('0x4f')]],'buttons':null,'topic':_0x10fd21[_0x70ec('0x49')],'note':_[_0x70ec('0x50')](_0x10fd21['vidaooNote'])?null:getMustacheRender(_0x10fd21[_0x70ec('0x4a')],_0x4f8117),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x10fd21['vidaooMetadata'])){var _0x477328=getMustacheRender(_0x10fd21[_0x70ec('0x51')],_0x4f8117);var _0x11a4a3=JSON['parse'](_0x477328);_0x71fe27['body'][_0x70ec('0x52')]=_0x11a4a3;}}catch(_0x41fd25){throw new db[(_0x70ec('0x53'))][(_0x70ec('0x54'))](_0x70ec('0x55'));}return rp(_0x71fe27);}else{throw new db[(_0x70ec('0x53'))][(_0x70ec('0x54'))](_0x70ec('0x56'));}})[_0x70ec('0x12')](function(_0x159a40){_0xe84e92=_0x159a40;if(_0xe84e92['id']){var _0x4ae48b={'body':_0xe84e92[_0x70ec('0x57')],'ChatWebsiteId':_0x10fd21['id'],'ChatInteractionId':_0x149306['id'],'direction':_0x70ec('0x58'),'UserId':_0x5b2c91['user']['id']};return db[_0x70ec('0x59')]['create'](_0x4ae48b,{});}else{throw new db['Sequelize']['ValidationError'](_0x70ec('0x5a'));}})[_0x70ec('0x12')](function(){return _0x149306['updateAttributes']({'vidaooSessionId':_0xe84e92['id']});})[_0x70ec('0x12')](respondWithResult(_0x3ac2f8,null))[_0x70ec('0x1a')](handleError(_0x3ac2f8,null));};exports[_0x70ec('0x5b')]=function(_0x4fceed,_0x427c68){if(_0x4fceed[_0x70ec('0x27')]['id']){delete _0x4fceed[_0x70ec('0x27')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x4fceed[_0x70ec('0x44')]['id']},'include':[{'model':db[_0x70ec('0x5c')],'as':_0x70ec('0x5d')}]})['then'](handleEntityNotFound(_0x427c68,null))['then'](saveUpdates(_0x4fceed[_0x70ec('0x27')],null))['then'](respondWithResult(_0x427c68,null))[_0x70ec('0x1a')](handleError(_0x427c68,null));};exports['abandon']=function(_0x18d3f2,_0xd0fbdd){if(_0x18d3f2[_0x70ec('0x27')]['id']){delete _0x18d3f2[_0x70ec('0x27')]['id'];}return db[_0x70ec('0x35')][_0x70ec('0x40')]({'where':{'id':_0x18d3f2[_0x70ec('0x44')]['id']}})[_0x70ec('0x12')](function(_0x17213b){if(!_0x17213b){logger[_0x70ec('0x14')](_0x70ec('0x5e'),'abandon',0x194,_0x70ec('0x5f'));_0xd0fbdd[_0x70ec('0x1b')](0x194);}else{if(_0x17213b[_0x70ec('0x60')]){throw new db[(_0x70ec('0x53'))][(_0x70ec('0x54'))]('Interaction\x20already\x20assigned');}}return _0x17213b;})[_0x70ec('0x12')](function(_0x23d8b4){if(_0x23d8b4){return _0x23d8b4['update']({'closed':_0x18d3f2['body'][_0x70ec('0x61')],'disposition':_0x18d3f2[_0x70ec('0x27')]['disposition']})[_0x70ec('0x12')](function(_0x48c58a){return _0x48c58a;});}})['then'](function(){return respondWithRpcPromise(_0x70ec('0x62'),_0x70ec('0x63'),_0x18d3f2[_0x70ec('0x27')],client9004);})[_0x70ec('0x12')](respondWithResult(_0xd0fbdd,null))[_0x70ec('0x1a')](handleError(_0xd0fbdd,null));};exports['attachmentUpload']=function(_0x4f69ee,_0x44c68e){_0x4f69ee[_0x70ec('0x27')][_0x70ec('0x25')]=_0x4f69ee[_0x70ec('0x64')]['originalname'];_0x4f69ee[_0x70ec('0x27')][_0x70ec('0x65')]=_0x4f69ee[_0x70ec('0x64')][_0x70ec('0x66')];_0x4f69ee[_0x70ec('0x27')][_0x70ec('0x67')]=_0x4f69ee[_0x70ec('0x64')]['mimetype'];return db[_0x70ec('0x68')]['create'](_0x4f69ee['body'])[_0x70ec('0x12')](respondWithResult(_0x44c68e,0xc9))[_0x70ec('0x1a')](handleError(_0x44c68e,null));};exports[_0x70ec('0x69')]=function(_0x27170e,_0x44e862){return db[_0x70ec('0x35')][_0x70ec('0x45')]({'where':{'id':_0x27170e[_0x70ec('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x44e862,null))[_0x70ec('0x12')](function(_0x3beb3f){if(_0x3beb3f){if(_0x3beb3f['closed']){return _0x44e862[_0x70ec('0x21')](0x193)[_0x70ec('0x6a')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x70ec('0x45')]({'where':{'id':_0x27170e[_0x70ec('0x31')][_0x70ec('0x6b')]},'raw':!![]})[_0x70ec('0x12')](handleEntityNotFound(_0x44e862,null));}})[_0x70ec('0x12')](function(_0x32d965){if(_0x32d965){var _0x294bdb=_0x32d965[_0x70ec('0x6c')]!==null;var _0x5cbbea=path['join'](config[_0x70ec('0x6d')],_0x70ec('0x6e'));if(_0x294bdb){_0x5cbbea=path[_0x70ec('0x6f')](_0x5cbbea,_0x70ec('0x70'));}var _0x2dfda4=path[_0x70ec('0x6f')](_0x5cbbea,_0x32d965['basename']);return _0x44e862[_0x70ec('0x71')](_0x2dfda4);}})[_0x70ec('0x1a')](handleError(_0x44e862,null));};exports[_0x70ec('0x72')]=function(_0xcb30f5,_0x1d69ef){var _0x1791e3=null;var _0x288631=null;var _0x6a53d1=null;if(_0xcb30f5[_0x70ec('0x27')]['id']){delete _0xcb30f5[_0x70ec('0x27')]['id'];}if(_0xcb30f5[_0x70ec('0x27')][_0x70ec('0x73')]){_0x6a53d1=path[_0x70ec('0x6f')](config[_0x70ec('0x6d')],_0x70ec('0x74'),util['format'](_0x70ec('0x75'),Date[_0x70ec('0x76')]()));_0xcb30f5[_0x70ec('0x27')][_0x70ec('0x77')]=_0x6a53d1;}return db[_0x70ec('0x35')][_0x70ec('0x40')]({'where':{'id':_0xcb30f5[_0x70ec('0x44')]['id']},'include':[{'model':db[_0x70ec('0x59')],'as':_0x70ec('0x78'),'include':[{'model':db['User'],'as':'User'}]}]})['then'](handleEntityNotFound(_0x1d69ef,null))[_0x70ec('0x12')](saveUpdates(_0xcb30f5[_0x70ec('0x27')],null))[_0x70ec('0x12')](function(_0x6e9b0){if(_0x6e9b0){_0x1791e3=_0x6e9b0;return db['ChatWebsite']['find']({'where':{'id':_0x1791e3[_0x70ec('0x47')]}});}})[_0x70ec('0x12')](function(_0x40947e){if(_0x40947e){_0x288631=_0x40947e;return db['CmContact']['find']({'where':{'id':_0x1791e3[_0x70ec('0x79')]}});}})['then'](function(_0xa7c41c){if(_0xa7c41c){if(_0x6a53d1){var _0x315c96=null;for(var _0x3ac016=0x1;_0x3ac016<_0x1791e3[_0x70ec('0x78')]['length'];++_0x3ac016){_0x315c96=_0x1791e3[_0x70ec('0x78')][_0x3ac016];var _0x2610ce=_0x315c96[_0x70ec('0x60')]?util['format'](_0x70ec('0x7a'),_0x288631[_0x70ec('0x7b')],_0x315c96['UserId']):_0x70ec('0x7c');var _0x5cdecc=_0xcb30f5[_0x70ec('0x27')][_0x70ec('0x7d')]||util[_0x70ec('0x7e')](_0x70ec('0x7a'),_0x70ec('0x7f'),_0x315c96['ContactId']);switch(_0x288631[_0x70ec('0x80')]){case _0x70ec('0x81'):_0x2610ce=_0x315c96[_0x70ec('0x60')]?util[_0x70ec('0x7e')](_0x70ec('0x7a'),_0x288631['agentAlias'],_0x315c96[_0x70ec('0x60')]):'System';break;case _0x70ec('0x82'):_0x2610ce=_0x315c96[_0x70ec('0x60')]?_0x315c96[_0x70ec('0x83')]['alias']||_0x315c96['User'][_0x70ec('0x4c')]:_0x70ec('0x7c');break;case _0x70ec('0x84'):_0x2610ce=_0x315c96[_0x70ec('0x60')]?_0x315c96[_0x70ec('0x83')][_0x70ec('0x4c')]:_0x70ec('0x7c');break;default:_0x2610ce=_0x315c96['UserId']?util[_0x70ec('0x7e')](_0x70ec('0x7a'),_0x288631[_0x70ec('0x7b')],_0x315c96['UserId']):_0x70ec('0x7c');}var _0x5d7dbe=util[_0x70ec('0x7e')](_0x70ec('0x85'),moment(_0x315c96[_0x70ec('0x86')])[_0x70ec('0x7e')]('MM/DD/YYYY\x20HH:mm:ss'),_0x315c96[_0x70ec('0x87')]==='in'?_0x5cdecc:_0x2610ce,_0x315c96[_0x70ec('0x27')]);if(!_0x315c96[_0x70ec('0x88')]){fs[_0x70ec('0x89')](_0x6a53d1,_0x5d7dbe);}}return db[_0x70ec('0x8a')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x70ec('0x8b')],'as':_0x70ec('0x8c'),'raw':!![],'include':[{'model':db[_0x70ec('0x8d')],'as':_0x70ec('0x8d'),'raw':!![]}]}]});}}})[_0x70ec('0x12')](function(_0xd433c){if(!_0xd433c||!_0xd433c[_0x70ec('0x8c')]||!_0xcb30f5['body'])return _0x1791e3;var _0x214df=_0xd433c['getSmtpOptions']();return respondWithRpcPromise(_0x70ec('0x8e'),_0x70ec('0x8f'),{'account':_0x214df,'message':{'from':util[_0x70ec('0x7e')](_0x70ec('0x90'),_0xd433c[_0x70ec('0x25')],_0xd433c[_0x70ec('0x4f')]||_0xd433c[_0x70ec('0x8c')][_0x70ec('0x32')]),'to':_0xcb30f5['body'][_0x70ec('0x73')],'subject':_0x70ec('0x91'),'text':util['format'](_0x70ec('0x92'),_0xcb30f5[_0x70ec('0x27')][_0x70ec('0x73')]),'attachments':[{'path':_0x6a53d1}]}})[_0x70ec('0x12')](function(){return _0x1791e3;})['catch'](function(_0xf4da8b){logger[_0x70ec('0x14')](_0xf4da8b);});})[_0x70ec('0x12')](respondWithStatusCode(_0x1d69ef,0xc8))[_0x70ec('0x1a')](handleError(_0x1d69ef,null));};exports[_0x70ec('0x93')]=function(_0x25e894,_0x45bcc7){return db[_0x70ec('0x59')][_0x70ec('0x40')]({'where':{'id':_0x25e894['params']['id']}})[_0x70ec('0x12')](handleEntityNotFound(_0x45bcc7,null))[_0x70ec('0x12')](function(_0x426a94){if(_0x426a94){return _0x426a94[_0x70ec('0x93')](_0x25e894['body']['ids'],_[_0x70ec('0x94')](_0x25e894[_0x70ec('0x27')],[_0x70ec('0x95'),'id'])||{});}})[_0x70ec('0x12')](respondWithResult(_0x45bcc7,null))[_0x70ec('0x1a')](handleError(_0x45bcc7,null));};exports[_0x70ec('0x96')]=function(_0x49a8cc,_0x145806){var _0x58077a={'raw':![],'where':{}};var _0x2e58e6={};var _0x2bbcab={'count':0x0,'rows':[]};return db[_0x70ec('0x35')][_0x70ec('0x45')]({'where':{'id':_0x49a8cc[_0x70ec('0x44')]['id']}})['then'](handleEntityNotFound(_0x145806,null))[_0x70ec('0x12')](function(_0x355b20){if(_0x355b20){_0x2e58e6['model']=_['keys'](db[_0x70ec('0x59')][_0x70ec('0x97')]);_0x2e58e6[_0x70ec('0x31')]=_[_0x70ec('0x36')](_0x49a8cc[_0x70ec('0x31')]);_0x2e58e6['filters']=_[_0x70ec('0x38')](_0x2e58e6[_0x70ec('0x34')],_0x2e58e6['query']);_0x58077a['attributes']=_[_0x70ec('0x38')](_0x2e58e6['model'],qs['fields'](_0x49a8cc[_0x70ec('0x31')][_0x70ec('0x3a')]));_0x58077a['attributes']=_0x58077a[_0x70ec('0x39')]['length']?_0x58077a[_0x70ec('0x39')]:_0x2e58e6[_0x70ec('0x34')];if(!_0x49a8cc['query'][_0x70ec('0x98')](_0x70ec('0x99'))){_0x58077a[_0x70ec('0x1e')]=qs[_0x70ec('0x1e')](_0x49a8cc[_0x70ec('0x31')]['limit']);_0x58077a[_0x70ec('0x20')]=qs[_0x70ec('0x20')](_0x49a8cc[_0x70ec('0x31')][_0x70ec('0x20')]);}_0x58077a[_0x70ec('0x9a')]=qs[_0x70ec('0x9b')](_0x49a8cc['query']['sort']);_0x58077a[_0x70ec('0x9c')]=qs[_0x70ec('0x37')](_[_0x70ec('0x9d')](_0x49a8cc[_0x70ec('0x31')],_0x2e58e6[_0x70ec('0x37')]));_0x58077a[_0x70ec('0x9c')][_0x70ec('0x9e')]=_0x355b20['id'];if(_0x49a8cc['query'][_0x70ec('0x9f')]){_0x58077a[_0x70ec('0x9c')]=_[_0x70ec('0x3e')](_0x58077a[_0x70ec('0x9c')],{'$or':_['map'](_0x58077a[_0x70ec('0x39')],function(_0x535ed2){var _0x55e7e8={};_0x55e7e8[_0x535ed2]={'$like':'%'+_0x49a8cc['query']['filter']+'%'};return _0x55e7e8;})});}if(_0x49a8cc['query'][_0x70ec('0xa0')]){var _0x51c65d=_0x49a8cc[_0x70ec('0x31')][_0x70ec('0xa0')][_0x70ec('0xa1')](',');var _0x2f1bdb={};_0x2f1bdb[_0x51c65d[0x0]]={'$gte':moment(_0x51c65d[0x1])[_0x70ec('0x7e')](_0x70ec('0xa2'))};_0x58077a[_0x70ec('0x9c')]=_[_0x70ec('0x3e')](_0x58077a['where'],_0x2f1bdb);}_0x58077a=_['merge']({},_0x58077a,_0x49a8cc[_0x70ec('0x3f')]);return db[_0x70ec('0x59')][_0x70ec('0x1f')]({'where':_0x58077a[_0x70ec('0x9c')]})['then'](function(_0x38901f){_0x2bbcab[_0x70ec('0x1f')]=_0x38901f;if(_0x49a8cc['query'][_0x70ec('0x3c')]){_0x58077a[_0x70ec('0x3d')]=[{'all':!![]}];}return db[_0x70ec('0x59')]['findAll'](_0x58077a);})[_0x70ec('0x12')](function(_0x1c4aab){_0x2bbcab[_0x70ec('0xa3')]=_0x1c4aab;return _0x2bbcab;});}})[_0x70ec('0x12')](respondWithFilteredResult(_0x145806,_0x58077a))[_0x70ec('0x1a')](handleError(_0x145806,null));};exports[_0x70ec('0xa4')]=function(_0x5318e2,_0x271f84){var _0x343695={'where':{}},_0x37c8b7={},_0x4362ac={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x5318e2[_0x70ec('0x44')]['id']}})[_0x70ec('0x12')](handleEntityNotFound(_0x271f84,null))[_0x70ec('0x12')](function(_0x1c98fa){if(_0x1c98fa){_0x37c8b7[_0x70ec('0x34')]=_['keys'](db[_0x70ec('0x59')][_0x70ec('0x97')]);_0x37c8b7[_0x70ec('0x31')]=_[_0x70ec('0x36')](_0x5318e2['query']);_0x37c8b7['filters']=_[_0x70ec('0x38')](_0x37c8b7[_0x70ec('0x34')],_0x37c8b7['query']);_0x343695[_0x70ec('0x39')]=_['intersection'](_0x37c8b7[_0x70ec('0x34')],qs['fields'](_0x5318e2['query'][_0x70ec('0x3a')]));_0x343695[_0x70ec('0x39')]=_0x343695[_0x70ec('0x39')][_0x70ec('0x3b')]?_0x343695[_0x70ec('0x39')]:_0x37c8b7[_0x70ec('0x34')];if(!_0x5318e2[_0x70ec('0x31')][_0x70ec('0x98')](_0x70ec('0x99'))){_0x343695[_0x70ec('0x1e')]=qs[_0x70ec('0x1e')](_0x5318e2['query']['limit']);_0x343695['offset']=qs['offset'](_0x5318e2[_0x70ec('0x31')]['offset']);}_0x343695[_0x70ec('0x9a')]=qs['sort'](_0x5318e2[_0x70ec('0x31')]['sort']);_0x343695[_0x70ec('0x9c')]=qs['filters'](_[_0x70ec('0x9d')](_0x5318e2[_0x70ec('0x31')],_0x37c8b7[_0x70ec('0x37')]));_0x343695['where']['ChatInteractionId']=_0x1c98fa['id'];if(_0x5318e2[_0x70ec('0x31')][_0x70ec('0x9f')]){_0x343695['where']=_['merge'](_0x343695['where'],{'$or':_[_0x70ec('0x2b')](_0x343695[_0x70ec('0x39')],function(_0x536920){var _0x5d37ef={};_0x5d37ef[_0x536920]={'$like':'%'+_0x5318e2[_0x70ec('0x31')][_0x70ec('0x9f')]+'%'};return _0x5d37ef;})});}_0x343695['where']['secret']=![];if(_0x5318e2[_0x70ec('0x31')]['id']){_0x343695[_0x70ec('0x9c')]['id']={'$gt':_0x5318e2['query']['id']};}_0x343695=_[_0x70ec('0x3e')]({},_0x343695,_0x5318e2[_0x70ec('0x3f')]);return db[_0x70ec('0x59')][_0x70ec('0x1f')]({'where':_0x343695['where']})['then'](function(_0x1bcb4b){_0x4362ac[_0x70ec('0x1f')]=_0x1bcb4b;_0x343695['include']=[];if(_0x5318e2['query'][_0x70ec('0xa5')]){_0x343695['include']['push']({'model':db[_0x70ec('0x83')],'as':_0x70ec('0x83'),'attributes':['id',_0x70ec('0x4c'),'alias']});}if(_0x5318e2[_0x70ec('0x31')]['includeAll']){_0x343695[_0x70ec('0x3d')]=[{'all':!![]}];}return db[_0x70ec('0x59')][_0x70ec('0x2f')](_0x343695);})[_0x70ec('0x12')](function(_0x1bdc49){_0x4362ac[_0x70ec('0xa3')]=_0x1bdc49;return _0x4362ac;});}})[_0x70ec('0x12')](respondWithFilteredResult(_0x271f84,_0x343695))[_0x70ec('0x1a')](handleError(_0x271f84,null));};exports[_0x70ec('0xa6')]=function(_0x46aa90,_0x1c78b0){return db['ChatInteraction'][_0x70ec('0x40')]({'where':{'id':_0x46aa90[_0x70ec('0x44')]['id']}})['then'](handleEntityNotFound(_0x1c78b0,null))[_0x70ec('0x12')](function(_0x47272b){if(_0x47272b){return _0x47272b[_0x70ec('0xa7')](_0x46aa90[_0x70ec('0x27')][_0x70ec('0x95')],_[_0x70ec('0x94')](_0x46aa90[_0x70ec('0x27')],[_0x70ec('0x95'),'id'])||{})[_0x70ec('0xa8')](function(){return db['Tag']['findAll']({'attributes':['id',_0x70ec('0x25'),'color'],'where':{'id':_0x46aa90[_0x70ec('0x27')][_0x70ec('0x95')]}});})[_0x70ec('0x12')](function(_0x143145){socket[_0x70ec('0xa9')](_0x70ec('0xaa'),{'id':Number(_0x46aa90['params']['id']),'tags':_0x143145||[]});return{'id':Number(_0x46aa90['params']['id']),'tags':_0x143145||[]};});}})[_0x70ec('0x12')](respondWithResult(_0x1c78b0,null))['catch'](handleError(_0x1c78b0,null));};exports[_0x70ec('0xab')]=function(_0x3e3d08,_0x27ffe3){return db[_0x70ec('0x35')][_0x70ec('0x40')]({'where':{'id':_0x3e3d08[_0x70ec('0x44')]['id']}})['then'](handleEntityNotFound(_0x27ffe3,null))[_0x70ec('0x12')](function(_0x359997){if(_0x359997){return _0x359997[_0x70ec('0xab')](_0x3e3d08[_0x70ec('0x31')][_0x70ec('0x95')]);}})[_0x70ec('0x12')](respondWithStatusCode(_0x27ffe3,null))[_0x70ec('0x1a')](handleError(_0x27ffe3,null));};exports['download']=function(_0x24c550,_0x4800c6){var _0x193d71=moment()[_0x70ec('0xac')]()[_0x70ec('0xad')]();var _0x132e18=path['join'](config[_0x70ec('0x6d')],_0x70ec('0xae'),_0x70ec('0xaf'),_0x70ec('0xb0'));var _0x49a52f=path['join'](config[_0x70ec('0x6d')],_0x70ec('0xae'),'files','attachments');var _0x422d47=path['join'](_0x132e18,_0x193d71);var _0xd9b9bb=util['format'](_0x70ec('0xb1'),_0x24c550['params']['id'],_0x193d71);var _0x40c991=path[_0x70ec('0x6f')](_0x132e18,_0xd9b9bb);var _0x35ccdb=[];_0x35ccdb['push']({'model':db[_0x70ec('0x83')],'as':'User','attributes':['id',_0x70ec('0x4c')],'raw':!![]});_0x35ccdb['push']({'model':db[_0x70ec('0x5c')],'as':_0x70ec('0x5d'),'attributes':['id',_0x70ec('0xb2'),_0x70ec('0xb3')],'raw':!![]});if(_0x24c550[_0x70ec('0x31')]['attachments']){_0x35ccdb[_0x70ec('0xb4')]({'model':db[_0x70ec('0x68')],'as':_0x70ec('0x68'),'raw':!![]});}var _0xe23e59=[{'model':db[_0x70ec('0x59')],'as':_0x70ec('0x78'),'attributes':['id',_0x70ec('0x27'),_0x70ec('0x86'),'direction',_0x70ec('0x88'),_0x70ec('0xb5')],'include':_0x35ccdb}];_0xe23e59['push']({'model':db[_0x70ec('0x46')],'as':'Account','attributes':['id','name']});_0xe23e59[_0x70ec('0xb4')]({'model':db[_0x70ec('0x83')],'as':'Owner','attributes':['id',_0x70ec('0x4c')]});return db['ChatInteraction'][_0x70ec('0x40')]({'where':{'id':_0x24c550[_0x70ec('0x44')]['id']},'include':_0xe23e59})[_0x70ec('0x12')](handleEntityNotFound(_0x4800c6,null))[_0x70ec('0x12')](function(_0x2028a1){if(_0x2028a1){var _0x5bfb49=_0x2028a1['get']({'plain':!![]});fs[_0x70ec('0xb6')](_0x422d47);var _0x4c2d58={'channel':_0x70ec('0xb7'),'account':_0x5bfb49['Account'][_0x70ec('0x25')],'agent':_0x5bfb49[_0x70ec('0xb8')]?_0x5bfb49[_0x70ec('0xb8')][_0x70ec('0x4c')]:_0x70ec('0xb9'),'createdAt':moment(_0x5bfb49[_0x70ec('0x86')])[_0x70ec('0x7e')](_0x70ec('0xa2'))[_0x70ec('0xad')](),'closedAt':_0x5bfb49[_0x70ec('0x61')]?moment(_0x5bfb49[_0x70ec('0xba')])[_0x70ec('0x7e')](_0x70ec('0xa2'))['toString']():'','disposition':_0x5bfb49[_0x70ec('0xbb')],'chatInfo':{'browser':_0x5bfb49[_0x70ec('0xbc')],'os':_0x5bfb49['osName'],'referer':_0x5bfb49[_0x70ec('0xbd')],'customerIp':_0x5bfb49[_0x70ec('0xbe')],'customerPort':_0x5bfb49['customerPort']?_0x5bfb49[_0x70ec('0xbf')]:_0x70ec('0xb9')},'messages':_(_0x5bfb49[_0x70ec('0x78')])['tail']()['filter']({'secret':![]})[_0x70ec('0x2b')](function(_0x634764){if(_0x634764[_0x70ec('0x68')]){var _0xf1cbd=path[_0x70ec('0x6f')](_0x49a52f,_0x634764[_0x70ec('0x68')][_0x70ec('0x65')]);if(fs[_0x70ec('0xc0')](_0xf1cbd)){fs[_0x70ec('0xc1')](_0xf1cbd)['pipe'](fs['createWriteStream'](path[_0x70ec('0x6f')](_0x422d47,_0x634764[_0x70ec('0x68')][_0x70ec('0x65')])));}}return{'date':moment(_0x634764[_0x70ec('0x86')])[_0x70ec('0x7e')](_0x70ec('0xa2'))[_0x70ec('0xad')](),'sender':_0x634764[_0x70ec('0x87')]===_0x70ec('0x58')?_0x634764[_0x70ec('0x83')]?_0x634764[_0x70ec('0x83')][_0x70ec('0x4c')]:'System':_0x634764[_0x70ec('0x5d')][_0x70ec('0xb2')]+(_0x634764[_0x70ec('0x5d')]['lastName']?'\x20'+_0x634764[_0x70ec('0x5d')][_0x70ec('0xb3')]:''),'body':_0x634764[_0x70ec('0x68')]?_0x634764[_0x70ec('0x68')][_0x70ec('0x65')]:_0x634764[_0x70ec('0x27')],'direction':_0x634764[_0x70ec('0x87')]===_0x70ec('0x58')?'A':'C','secret':_0x634764['secret'],'read':_0x634764[_0x70ec('0xb5')],'attachment':_0x634764[_0x70ec('0x68')]};})[_0x70ec('0xc2')]()};return ejs['renderFile'](path[_0x70ec('0x6f')](config[_0x70ec('0x6d')],_0x70ec('0xae'),_0x70ec('0xc3'),'downloadInteraction.ejs'),{'interaction':_0x4c2d58})[_0x70ec('0x12')](function(_0x15a623){var _0x440078=path[_0x70ec('0x6f')](_0x422d47,_0x70ec('0xc4')+_0x5bfb49['id']+'-'+_0x193d71+_0x70ec('0xc5'));var _0x4630fc={'path':_0x440078,'channel':'Chat','interactionId':_0x5bfb49['id']};return pdf[_0x70ec('0xc6')](_0x15a623,_0x4630fc);})[_0x70ec('0x12')](function(){return new Promise(function(_0x25ffe5,_0x5d02e2){zipdir(_0x422d47,{'saveTo':_0x40c991},function(_0x23fa8f,_0x24ec29){if(_0x23fa8f)return _0x5d02e2(_0x23fa8f);return _0x25ffe5(_0x24ec29);});})[_0x70ec('0x12')](function(){return new BPromise(function(_0xe17f61,_0x48dd14){rimraf(_0x422d47,function(_0x422dc6){if(_0x422dc6)_0x48dd14(_0x422dc6);return _0xe17f61();});});})[_0x70ec('0x12')](function(){return _0x4800c6['download'](_0x40c991,_0xd9b9bb,function(_0x30f874){if(_0x30f874){logger[_0x70ec('0x14')](_0x70ec('0xc7'),_0x30f874);}else{fs[_0x70ec('0xc8')](_0x40c991);}});});});}else{return _0x4800c6[_0x70ec('0x1b')](0xc8);}})[_0x70ec('0x1a')](handleError(_0x4800c6,null));}; \ No newline at end of file +var _0xcf0e=['Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','file','basename','filename','mimetype','Attachment','attachmentDownload','closed','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','UserId','%s%d','System','customer','Visitor','agentIdentifier','agentAlias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Smtp','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','pick','ChatInteractionId','options','includeAgent','push','alias','addTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','toString','server','files','tmp','lastName','read','Account','Owner','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerPort','tail','createReadStream','pipe','createWriteStream','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','moment','bluebird','mustache','util','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','localhost','redis','register','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','result','ChatInteraction,\x20%s,\x20%s','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','render','merge','contact','agent','interaction','account','index','map','rawAttributes','fieldName','key','getOptions','findAll','chat','query','user','catch','show','params','ChatInteraction','keys','filters','model','attributes','intersection','fields','length','includeAll','include','find','create','body','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','Sequelize','ValidationError','out','ChatMessage','updateAttributes','customUpdate','CmContact'];(function(_0x58fb9d,_0xc4e55f){var _0x1f2c7f=function(_0x114d88){while(--_0x114d88){_0x58fb9d['push'](_0x58fb9d['shift']());}};_0x1f2c7f(++_0xc4e55f);}(_0xcf0e,0x6d));var _0xecf0=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0xcf0e[_0xf51c06];return _0x1d5420;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xecf0('0x0'));var rp=require('request-promise');var moment=require(_0xecf0('0x1'));var BPromise=require(_0xecf0('0x2'));var Mustache=require(_0xecf0('0x3'));var util=require(_0xecf0('0x4'));var path=require(_0xecf0('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xecf0('0x6'));var Redis=require(_0xecf0('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0xecf0('0x8'));var pdf=require(_0xecf0('0x9'));var logger=require('../../config/logger')(_0xecf0('0xa'));var config=require(_0xecf0('0xb'));var db=require(_0xecf0('0xc'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xecf0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xecf0('0xe')]));require('./chatInteraction.socket')[_0xecf0('0xf')](socket);var jayson=require(_0xecf0('0x10'));var client=jayson[_0xecf0('0x11')][_0xecf0('0x12')]({'port':0x232b});var client9004=jayson[_0xecf0('0x11')][_0xecf0('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x3d3bbd,_0x37cc31,_0x66c47d,_0x295baf){return new BPromise(function(_0x1bd70d,_0x398793){var _0x276a6c=_0x295baf||client;return _0x276a6c[_0xecf0('0x13')](_0x3d3bbd,_0x66c47d)[_0xecf0('0x14')](function(_0x39e325){logger[_0xecf0('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x37cc31,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x37cc31,_0xecf0('0x16'),JSON[_0xecf0('0x17')](_0x39e325));if(_0x39e325[_0xecf0('0x18')]){if(_0x39e325[_0xecf0('0x18')][_0xecf0('0x19')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x37cc31,_0x39e325[_0xecf0('0x18')][_0xecf0('0x1a')]);return _0x398793(_0x39e325[_0xecf0('0x18')]['message']);}logger[_0xecf0('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x37cc31,_0x39e325[_0xecf0('0x18')][_0xecf0('0x1a')]);return _0x1bd70d(_0x39e325[_0xecf0('0x18')]['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x37cc31,_0xecf0('0x16'));_0x1bd70d(_0x39e325[_0xecf0('0x1b')]['message']);}})['catch'](function(_0x2e23a8){logger[_0xecf0('0x18')](_0xecf0('0x1c'),_0x37cc31,_0x2e23a8);_0x398793(_0x2e23a8);});});}function respondWithStatusCode(_0x10087b,_0xdbd195){_0xdbd195=_0xdbd195||0xcc;return function(_0x3d21e2){if(_0x3d21e2){return _0x10087b[_0xecf0('0x1d')](_0xdbd195);}return _0x10087b[_0xecf0('0x1e')](_0xdbd195)[_0xecf0('0x1f')]();};}function respondWithResult(_0x4badc7,_0x354f13){_0x354f13=_0x354f13||0xc8;return function(_0x58e9a1){if(_0x58e9a1){return _0x4badc7[_0xecf0('0x1e')](_0x354f13)[_0xecf0('0x20')](_0x58e9a1);}};}function respondWithFilteredResult(_0x42ecb2,_0x15d57c){return function(_0x580727){if(_0x580727){var _0x388619=typeof _0x15d57c[_0xecf0('0x21')]===_0xecf0('0x22')&&typeof _0x15d57c[_0xecf0('0x23')]===_0xecf0('0x22');var _0x15b966=_0x580727[_0xecf0('0x24')];var _0x4aef05=_0x388619?0x0:_0x15d57c[_0xecf0('0x21')];var _0x1fa553=_0x388619?_0x580727[_0xecf0('0x24')]:_0x15d57c[_0xecf0('0x21')]+_0x15d57c['limit'];var _0x448c30;if(_0x1fa553>=_0x15b966){_0x1fa553=_0x15b966;_0x448c30=0xc8;}else{_0x448c30=0xce;}_0x42ecb2[_0xecf0('0x1e')](_0x448c30);return _0x42ecb2[_0xecf0('0x25')](_0xecf0('0x26'),_0x4aef05+'-'+_0x1fa553+'/'+_0x15b966)[_0xecf0('0x20')](_0x580727);}return null;};}function saveUpdates(_0x3b31ee){return function(_0x515512){if(_0x515512){return _0x515512[_0xecf0('0x27')](_0x3b31ee)[_0xecf0('0x14')](function(_0xd3f5b6){return _0xd3f5b6;});}return null;};}function removeEntity(_0x3b643d){return function(_0x124ac4){if(_0x124ac4){return _0x124ac4[_0xecf0('0x28')]()[_0xecf0('0x14')](function(){_0x3b643d['status'](0xcc)[_0xecf0('0x1f')]();});}};}function handleEntityNotFound(_0x53586c){return function(_0x3181d6){if(!_0x3181d6){_0x53586c[_0xecf0('0x1d')](0x194);}return _0x3181d6;};}function handleError(_0x900106,_0x458788){_0x458788=_0x458788||0x1f4;return function(_0x5cdb9b){logger[_0xecf0('0x18')](_0x5cdb9b[_0xecf0('0x29')]);if(_0x5cdb9b[_0xecf0('0x2a')]){delete _0x5cdb9b[_0xecf0('0x2a')];}_0x900106[_0xecf0('0x1e')](_0x458788)['send'](_0x5cdb9b);};}function getMustacheRender(_0x1c4301,_0x5aebed){return Mustache[_0xecf0('0x2b')](_0x1c4301,_[_0xecf0('0x2c')](_0x5aebed['body'],{'contact':_0x5aebed[_0xecf0('0x2d')],'message':_0x5aebed['message'],'agent':_0x5aebed[_0xecf0('0x2e')],'interaction':_0x5aebed[_0xecf0('0x2f')],'account':_0x5aebed[_0xecf0('0x30')]}))||'';}exports[_0xecf0('0x31')]=function(_0xdc91ad,_0x4f4cdb){var _0x475413={};var _0x8a50d2=_[_0xecf0('0x32')](db['ChatInteraction'][_0xecf0('0x33')],function(_0x534048){return{'name':_0x534048[_0xecf0('0x34')],'type':_0x534048['type'][_0xecf0('0x35')]};});_0x475413=qs[_0xecf0('0x36')](_0x8a50d2,_0xdc91ad);return interaction[_0xecf0('0x37')](_0xecf0('0x38'),_0xdc91ad[_0xecf0('0x39')],_0xdc91ad[_0xecf0('0x3a')],_0x475413,_0x8a50d2)['then'](respondWithFilteredResult(_0x4f4cdb,_0x475413))[_0xecf0('0x3b')](handleError(_0x4f4cdb,null));};exports[_0xecf0('0x3c')]=function(_0x4f3e5f,_0x5e15c9){var _0x2652b3={'raw':![],'where':{'id':_0x4f3e5f[_0xecf0('0x3d')]['id']}},_0x252eec={};_0x252eec['model']=_['keys'](db[_0xecf0('0x3e')][_0xecf0('0x33')]);_0x252eec['query']=_[_0xecf0('0x3f')](_0x4f3e5f[_0xecf0('0x39')]);_0x252eec[_0xecf0('0x40')]=_['intersection'](_0x252eec[_0xecf0('0x41')],_0x252eec[_0xecf0('0x39')]);_0x2652b3[_0xecf0('0x42')]=_[_0xecf0('0x43')](_0x252eec[_0xecf0('0x41')],qs['fields'](_0x4f3e5f[_0xecf0('0x39')][_0xecf0('0x44')]));_0x2652b3['attributes']=_0x2652b3[_0xecf0('0x42')][_0xecf0('0x45')]?_0x2652b3['attributes']:_0x252eec['model'];if(_0x4f3e5f[_0xecf0('0x39')][_0xecf0('0x46')]){_0x2652b3[_0xecf0('0x47')]=[{'all':!![]}];}_0x2652b3=_['merge']({},_0x2652b3,_0x4f3e5f['options']);return db[_0xecf0('0x3e')][_0xecf0('0x48')](_0x2652b3)[_0xecf0('0x14')](handleEntityNotFound(_0x5e15c9,null))[_0xecf0('0x14')](respondWithResult(_0x5e15c9,null))[_0xecf0('0x3b')](handleError(_0x5e15c9,null));};exports[_0xecf0('0x49')]=function(_0x1b5bd8,_0x2eee3f){return db[_0xecf0('0x3e')][_0xecf0('0x49')](_0x1b5bd8[_0xecf0('0x4a')],{})[_0xecf0('0x14')](respondWithResult(_0x2eee3f,0xc9))[_0xecf0('0x3b')](handleError(_0x2eee3f,null));};exports['update']=function(_0x49aedf,_0xa518f3){if(_0x49aedf[_0xecf0('0x4a')]['id']){delete _0x49aedf[_0xecf0('0x4a')]['id'];}return db[_0xecf0('0x3e')][_0xecf0('0x48')]({'where':{'id':_0x49aedf[_0xecf0('0x3d')]['id']}})[_0xecf0('0x14')](handleEntityNotFound(_0xa518f3,null))[_0xecf0('0x14')](saveUpdates(_0x49aedf[_0xecf0('0x4a')],null))[_0xecf0('0x14')](respondWithResult(_0xa518f3,null))[_0xecf0('0x3b')](handleError(_0xa518f3,null));};exports[_0xecf0('0x28')]=function(_0x1f661b,_0x53b978){return db[_0xecf0('0x3e')][_0xecf0('0x48')]({'where':{'id':_0x1f661b[_0xecf0('0x3d')]['id']}})[_0xecf0('0x14')](handleEntityNotFound(_0x53b978,null))[_0xecf0('0x14')](removeEntity(_0x53b978,null))[_0xecf0('0x3b')](handleError(_0x53b978,null));};exports[_0xecf0('0x4b')]=function(_0x20346a,_0x338241){return db['ChatInteraction']['describe']()[_0xecf0('0x14')](respondWithResult(_0x338241,null))['catch'](handleError(_0x338241,null));};exports['createVidaooSession']=function(_0x2e098a,_0x3116e6){var _0xd614c4=_0x2e098a[_0xecf0('0x3d')]['id'];var _0x5d4f3d;var _0x354607;var _0x327399;return db[_0xecf0('0x3e')][_0xecf0('0x4c')]({'where':{'id':_0xd614c4}})[_0xecf0('0x14')](function(_0x5a1663){_0x5d4f3d=_0x5a1663;return db[_0xecf0('0x4d')][_0xecf0('0x4c')]({'where':{'id':_0x5a1663[_0xecf0('0x4e')]},'attributes':['id',_0xecf0('0x4f'),_0xecf0('0x50'),_0xecf0('0x51'),_0xecf0('0x52'),_0xecf0('0x53')],'raw':!![]});})[_0xecf0('0x14')](function(_0x502db8){if(_0x502db8&&_0x502db8['vidaooApiKey']&&_0x502db8['vidaooEscalation']){_0x354607=_0x502db8;var _0x5ceb34={'interaction':{'id':_0xd614c4},'agent':{'id':_0x2e098a[_0xecf0('0x3a')]['id'],'name':_0x2e098a['user']['name'],'fullname':_0x2e098a[_0xecf0('0x3a')][_0xecf0('0x54')],'email':_0x2e098a['user'][_0xecf0('0x55')]},'contact':_0x2e098a[_0xecf0('0x4a')][_0xecf0('0x2d')],'account':_0x2e098a[_0xecf0('0x4a')][_0xecf0('0x30')]};var _0xe817e0={'rejectUnauthorized':![],'method':_0xecf0('0x56'),'url':_0xecf0('0x57'),'headers':{'X-APIKEY':_0x502db8[_0xecf0('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2e098a[_0xecf0('0x3a')][_0xecf0('0x55')]],'buttons':null,'topic':_0x354607[_0xecf0('0x51')],'note':_[_0xecf0('0x58')](_0x354607[_0xecf0('0x52')])?null:getMustacheRender(_0x354607[_0xecf0('0x52')],_0x5ceb34),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x354607[_0xecf0('0x53')])){var _0x375377=getMustacheRender(_0x354607[_0xecf0('0x53')],_0x5ceb34);var _0x463a4c=JSON[_0xecf0('0x59')](_0x375377);_0xe817e0[_0xecf0('0x4a')][_0xecf0('0x5a')]=_0x463a4c;}}catch(_0x3cb581){throw new db[(_0xecf0('0x5b'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xe817e0);}else{throw new db[(_0xecf0('0x5b'))][(_0xecf0('0x5c'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xecf0('0x14')](function(_0x423bd5){_0x327399=_0x423bd5;if(_0x327399['id']){var _0x216bea={'body':_0x327399['join_url'],'ChatWebsiteId':_0x354607['id'],'ChatInteractionId':_0x5d4f3d['id'],'direction':_0xecf0('0x5d'),'UserId':_0x2e098a['user']['id']};return db[_0xecf0('0x5e')][_0xecf0('0x49')](_0x216bea,{});}else{throw new db[(_0xecf0('0x5b'))][(_0xecf0('0x5c'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xecf0('0x14')](function(){return _0x5d4f3d[_0xecf0('0x5f')]({'vidaooSessionId':_0x327399['id']});})[_0xecf0('0x14')](respondWithResult(_0x3116e6,null))[_0xecf0('0x3b')](handleError(_0x3116e6,null));};exports[_0xecf0('0x60')]=function(_0x3d1e2a,_0x1cdb3e){if(_0x3d1e2a[_0xecf0('0x4a')]['id']){delete _0x3d1e2a['body']['id'];}return db[_0xecf0('0x3e')][_0xecf0('0x48')]({'where':{'id':_0x3d1e2a[_0xecf0('0x3d')]['id']},'include':[{'model':db[_0xecf0('0x61')],'as':_0xecf0('0x62')}]})[_0xecf0('0x14')](handleEntityNotFound(_0x1cdb3e,null))[_0xecf0('0x14')](saveUpdates(_0x3d1e2a[_0xecf0('0x4a')],null))[_0xecf0('0x14')](respondWithResult(_0x1cdb3e,null))[_0xecf0('0x3b')](handleError(_0x1cdb3e,null));};exports[_0xecf0('0x63')]=function(_0x15a937,_0x22ca53){if(_0x15a937[_0xecf0('0x4a')]['id']){delete _0x15a937[_0xecf0('0x4a')]['id'];}return db['ChatInteraction'][_0xecf0('0x48')]({'where':{'id':_0x15a937[_0xecf0('0x3d')]['id']}})['then'](function(_0x2364d0){if(!_0x2364d0){logger[_0xecf0('0x18')](_0xecf0('0x64'),_0xecf0('0x63'),0x194,_0xecf0('0x65'));_0x22ca53['sendStatus'](0x194);}else{if(_0x2364d0['UserId']){throw new db[(_0xecf0('0x5b'))]['ValidationError'](_0xecf0('0x66'));}}return _0x2364d0;})[_0xecf0('0x14')](function(_0x4c3986){if(_0x4c3986){return _0x4c3986[_0xecf0('0x27')]({'closed':_0x15a937['body']['closed'],'disposition':_0x15a937[_0xecf0('0x4a')][_0xecf0('0x67')]})[_0xecf0('0x14')](function(_0x133bc3){return _0x133bc3;});}})[_0xecf0('0x14')](function(){return respondWithRpcPromise(_0xecf0('0x68'),_0xecf0('0x63'),_0x15a937[_0xecf0('0x4a')],client9004);})['then'](respondWithResult(_0x22ca53,null))[_0xecf0('0x3b')](handleError(_0x22ca53,null));};exports['attachmentUpload']=function(_0x1aef55,_0x37b0c2){_0x1aef55[_0xecf0('0x4a')]['name']=_0x1aef55[_0xecf0('0x69')]['originalname'];_0x1aef55['body'][_0xecf0('0x6a')]=_0x1aef55[_0xecf0('0x69')][_0xecf0('0x6b')];_0x1aef55[_0xecf0('0x4a')]['type']=_0x1aef55[_0xecf0('0x69')][_0xecf0('0x6c')];return db[_0xecf0('0x6d')][_0xecf0('0x49')](_0x1aef55['body'])[_0xecf0('0x14')](respondWithResult(_0x37b0c2,0xc9))['catch'](handleError(_0x37b0c2,null));};exports[_0xecf0('0x6e')]=function(_0x280b11,_0x2f3f3f){return db[_0xecf0('0x3e')][_0xecf0('0x4c')]({'where':{'id':_0x280b11[_0xecf0('0x3d')]['id']},'raw':!![]})[_0xecf0('0x14')](handleEntityNotFound(_0x2f3f3f,null))[_0xecf0('0x14')](function(_0x30c3a0){if(_0x30c3a0){if(_0x30c3a0[_0xecf0('0x6f')]){return _0x2f3f3f[_0xecf0('0x1e')](0x193)[_0xecf0('0x20')]({'status':0x193,'message':_0xecf0('0x70')});}return db[_0xecf0('0x6d')][_0xecf0('0x4c')]({'where':{'id':_0x280b11[_0xecf0('0x39')][_0xecf0('0x71')]},'raw':!![]})[_0xecf0('0x14')](handleEntityNotFound(_0x2f3f3f,null));}})[_0xecf0('0x14')](function(_0x42aeb5){if(_0x42aeb5){var _0x44b854=_0x42aeb5['ChatOfflineMessageId']!==null;var _0x281fe3=path[_0xecf0('0x72')](config[_0xecf0('0x73')],_0xecf0('0x74'));if(_0x44b854){_0x281fe3=path['join'](_0x281fe3,_0xecf0('0x75'));}var _0x226254=path[_0xecf0('0x72')](_0x281fe3,_0x42aeb5[_0xecf0('0x6a')]);return _0x2f3f3f[_0xecf0('0x76')](_0x226254);}})['catch'](handleError(_0x2f3f3f,null));};exports[_0xecf0('0x77')]=function(_0x49ea93,_0x42d4db){var _0xbe9546=null;var _0x861c37=null;var _0x3163d8=null;if(_0x49ea93['body']['id']){delete _0x49ea93['body']['id'];}if(_0x49ea93['body'][_0xecf0('0x78')]){_0x3163d8=path[_0xecf0('0x72')](config[_0xecf0('0x73')],_0xecf0('0x79'),util[_0xecf0('0x7a')](_0xecf0('0x7b'),Date[_0xecf0('0x7c')]()));_0x49ea93[_0xecf0('0x4a')][_0xecf0('0x7d')]=_0x3163d8;}return db['ChatInteraction'][_0xecf0('0x48')]({'where':{'id':_0x49ea93['params']['id']},'include':[{'model':db[_0xecf0('0x5e')],'as':_0xecf0('0x7e'),'include':[{'model':db[_0xecf0('0x7f')],'as':_0xecf0('0x7f')}]}]})['then'](handleEntityNotFound(_0x42d4db,null))[_0xecf0('0x14')](saveUpdates(_0x49ea93[_0xecf0('0x4a')],null))['then'](function(_0x5357db){if(_0x5357db){_0xbe9546=_0x5357db;return db[_0xecf0('0x4d')][_0xecf0('0x48')]({'where':{'id':_0xbe9546[_0xecf0('0x4e')]}});}})['then'](function(_0x7220c9){if(_0x7220c9){_0x861c37=_0x7220c9;return db[_0xecf0('0x61')]['find']({'where':{'id':_0xbe9546[_0xecf0('0x80')]}});}})[_0xecf0('0x14')](function(_0x1ef488){if(_0x1ef488){if(_0x3163d8){var _0x4d377b=null;for(var _0xc92c99=0x1;_0xc92c99<_0xbe9546['Messages']['length'];++_0xc92c99){_0x4d377b=_0xbe9546[_0xecf0('0x7e')][_0xc92c99];var _0x23ab22=_0x4d377b[_0xecf0('0x81')]?util[_0xecf0('0x7a')](_0xecf0('0x82'),_0x861c37['agentAlias'],_0x4d377b[_0xecf0('0x81')]):_0xecf0('0x83');var _0x29d335=_0x49ea93[_0xecf0('0x4a')][_0xecf0('0x84')]||util[_0xecf0('0x7a')](_0xecf0('0x82'),_0xecf0('0x85'),_0x4d377b[_0xecf0('0x80')]);switch(_0x861c37[_0xecf0('0x86')]){case'website_alias':_0x23ab22=_0x4d377b[_0xecf0('0x81')]?util[_0xecf0('0x7a')](_0xecf0('0x82'),_0x861c37[_0xecf0('0x87')],_0x4d377b[_0xecf0('0x81')]):_0xecf0('0x83');break;case _0xecf0('0x88'):_0x23ab22=_0x4d377b[_0xecf0('0x81')]?_0x4d377b[_0xecf0('0x7f')]['alias']||_0x4d377b[_0xecf0('0x7f')][_0xecf0('0x54')]:_0xecf0('0x83');break;case _0xecf0('0x89'):_0x23ab22=_0x4d377b['UserId']?_0x4d377b[_0xecf0('0x7f')][_0xecf0('0x54')]:_0xecf0('0x83');break;default:_0x23ab22=_0x4d377b[_0xecf0('0x81')]?util[_0xecf0('0x7a')](_0xecf0('0x82'),_0x861c37[_0xecf0('0x87')],_0x4d377b['UserId']):_0xecf0('0x83');}var _0x7d6301=util['format'](_0xecf0('0x8a'),moment(_0x4d377b[_0xecf0('0x8b')])['format'](_0xecf0('0x8c')),_0x4d377b[_0xecf0('0x8d')]==='in'?_0x29d335:_0x23ab22,_0x4d377b[_0xecf0('0x4a')]);if(!_0x4d377b[_0xecf0('0x8e')]){fs[_0xecf0('0x8f')](_0x3163d8,_0x7d6301);}}return db[_0xecf0('0x90')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xecf0('0x91')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xecf0('0x92'),'raw':!![]}]}]});}}})[_0xecf0('0x14')](function(_0x150f9e){if(!_0x150f9e||!_0x150f9e['Smtp']||!_0x49ea93[_0xecf0('0x4a')])return _0xbe9546;var _0x21f900=_0x150f9e[_0xecf0('0x93')]();return respondWithRpcPromise(_0xecf0('0x94'),'sendMail',{'account':_0x21f900,'message':{'from':util[_0xecf0('0x7a')](_0xecf0('0x95'),_0x150f9e[_0xecf0('0x2a')],_0x150f9e[_0xecf0('0x55')]||_0x150f9e[_0xecf0('0x96')][_0xecf0('0x3a')]),'to':_0x49ea93[_0xecf0('0x4a')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0xecf0('0x7a')](_0xecf0('0x97'),_0x49ea93[_0xecf0('0x4a')][_0xecf0('0x78')]),'attachments':[{'path':_0x3163d8}]}})['then'](function(){return _0xbe9546;})[_0xecf0('0x3b')](function(_0x260bb4){logger[_0xecf0('0x18')](_0x260bb4);});})[_0xecf0('0x14')](respondWithStatusCode(_0x42d4db,0xc8))['catch'](handleError(_0x42d4db,null));};exports['addMessage']=function(_0x4a5a1b,_0x37a361){return db[_0xecf0('0x5e')][_0xecf0('0x48')]({'where':{'id':_0x4a5a1b[_0xecf0('0x3d')]['id']}})[_0xecf0('0x14')](handleEntityNotFound(_0x37a361,null))[_0xecf0('0x14')](function(_0x4aa412){if(_0x4aa412){return _0x4aa412['addMessage'](_0x4a5a1b['body'][_0xecf0('0x98')],_[_0xecf0('0x99')](_0x4a5a1b[_0xecf0('0x4a')],[_0xecf0('0x98'),'id'])||{});}})[_0xecf0('0x14')](respondWithResult(_0x37a361,null))[_0xecf0('0x3b')](handleError(_0x37a361,null));};exports[_0xecf0('0x9a')]=function(_0x442f41,_0x4e3538){var _0x756e4e={'raw':![],'where':{}};var _0x55f842={};var _0x169a0b={'count':0x0,'rows':[]};return db[_0xecf0('0x3e')][_0xecf0('0x4c')]({'where':{'id':_0x442f41[_0xecf0('0x3d')]['id']}})[_0xecf0('0x14')](handleEntityNotFound(_0x4e3538,null))['then'](function(_0x44bd0d){if(_0x44bd0d){_0x55f842['model']=_[_0xecf0('0x3f')](db[_0xecf0('0x5e')][_0xecf0('0x33')]);_0x55f842[_0xecf0('0x39')]=_[_0xecf0('0x3f')](_0x442f41[_0xecf0('0x39')]);_0x55f842['filters']=_[_0xecf0('0x43')](_0x55f842[_0xecf0('0x41')],_0x55f842['query']);_0x756e4e[_0xecf0('0x42')]=_[_0xecf0('0x43')](_0x55f842[_0xecf0('0x41')],qs[_0xecf0('0x44')](_0x442f41[_0xecf0('0x39')][_0xecf0('0x44')]));_0x756e4e[_0xecf0('0x42')]=_0x756e4e[_0xecf0('0x42')][_0xecf0('0x45')]?_0x756e4e[_0xecf0('0x42')]:_0x55f842[_0xecf0('0x41')];if(!_0x442f41[_0xecf0('0x39')][_0xecf0('0x9b')](_0xecf0('0x9c'))){_0x756e4e[_0xecf0('0x23')]=qs[_0xecf0('0x23')](_0x442f41['query'][_0xecf0('0x23')]);_0x756e4e[_0xecf0('0x21')]=qs[_0xecf0('0x21')](_0x442f41[_0xecf0('0x39')][_0xecf0('0x21')]);}_0x756e4e[_0xecf0('0x9d')]=qs['sort'](_0x442f41[_0xecf0('0x39')][_0xecf0('0x9e')]);_0x756e4e[_0xecf0('0x9f')]=qs['filters'](_['pick'](_0x442f41[_0xecf0('0x39')],_0x55f842[_0xecf0('0x40')]));_0x756e4e[_0xecf0('0x9f')]['ChatInteractionId']=_0x44bd0d['id'];if(_0x442f41[_0xecf0('0x39')]['filter']){_0x756e4e[_0xecf0('0x9f')]=_[_0xecf0('0x2c')](_0x756e4e[_0xecf0('0x9f')],{'$or':_[_0xecf0('0x32')](_0x756e4e[_0xecf0('0x42')],function(_0x24b03a){var _0x3ecf64={};_0x3ecf64[_0x24b03a]={'$like':'%'+_0x442f41[_0xecf0('0x39')][_0xecf0('0xa0')]+'%'};return _0x3ecf64;})});}if(_0x442f41[_0xecf0('0x39')]['$gte']){var _0x519b53=_0x442f41[_0xecf0('0x39')][_0xecf0('0xa1')]['split'](',');var _0x2ff2da={};_0x2ff2da[_0x519b53[0x0]]={'$gte':moment(_0x519b53[0x1])[_0xecf0('0x7a')](_0xecf0('0xa2'))};_0x756e4e[_0xecf0('0x9f')]=_[_0xecf0('0x2c')](_0x756e4e[_0xecf0('0x9f')],_0x2ff2da);}_0x756e4e=_[_0xecf0('0x2c')]({},_0x756e4e,_0x442f41['options']);return db[_0xecf0('0x5e')][_0xecf0('0x24')]({'where':_0x756e4e[_0xecf0('0x9f')]})[_0xecf0('0x14')](function(_0x29c225){_0x169a0b[_0xecf0('0x24')]=_0x29c225;if(_0x442f41[_0xecf0('0x39')][_0xecf0('0x46')]){_0x756e4e['include']=[{'all':!![]}];}return db[_0xecf0('0x5e')]['findAll'](_0x756e4e);})['then'](function(_0x3d4802){_0x169a0b[_0xecf0('0xa3')]=_0x3d4802;return _0x169a0b;});}})['then'](respondWithFilteredResult(_0x4e3538,_0x756e4e))[_0xecf0('0x3b')](handleError(_0x4e3538,null));};exports['getMyMessages']=function(_0x1aa6d1,_0x49b767){var _0x5b9122={'where':{}},_0x3a4ffb={},_0x4acb4a={'count':0x0,'rows':[]};return db[_0xecf0('0x3e')][_0xecf0('0x4c')]({'where':{'id':_0x1aa6d1[_0xecf0('0x3d')]['id']}})['then'](handleEntityNotFound(_0x49b767,null))[_0xecf0('0x14')](function(_0x26645){if(_0x26645){_0x3a4ffb['model']=_['keys'](db[_0xecf0('0x5e')][_0xecf0('0x33')]);_0x3a4ffb[_0xecf0('0x39')]=_[_0xecf0('0x3f')](_0x1aa6d1[_0xecf0('0x39')]);_0x3a4ffb['filters']=_['intersection'](_0x3a4ffb[_0xecf0('0x41')],_0x3a4ffb[_0xecf0('0x39')]);_0x5b9122[_0xecf0('0x42')]=_[_0xecf0('0x43')](_0x3a4ffb[_0xecf0('0x41')],qs[_0xecf0('0x44')](_0x1aa6d1[_0xecf0('0x39')]['fields']));_0x5b9122['attributes']=_0x5b9122[_0xecf0('0x42')][_0xecf0('0x45')]?_0x5b9122[_0xecf0('0x42')]:_0x3a4ffb[_0xecf0('0x41')];if(!_0x1aa6d1[_0xecf0('0x39')][_0xecf0('0x9b')]('nolimit')){_0x5b9122[_0xecf0('0x23')]=qs[_0xecf0('0x23')](_0x1aa6d1[_0xecf0('0x39')][_0xecf0('0x23')]);_0x5b9122['offset']=qs[_0xecf0('0x21')](_0x1aa6d1[_0xecf0('0x39')][_0xecf0('0x21')]);}_0x5b9122[_0xecf0('0x9d')]=qs[_0xecf0('0x9e')](_0x1aa6d1[_0xecf0('0x39')][_0xecf0('0x9e')]);_0x5b9122[_0xecf0('0x9f')]=qs[_0xecf0('0x40')](_[_0xecf0('0xa4')](_0x1aa6d1[_0xecf0('0x39')],_0x3a4ffb[_0xecf0('0x40')]));_0x5b9122[_0xecf0('0x9f')][_0xecf0('0xa5')]=_0x26645['id'];if(_0x1aa6d1['query'][_0xecf0('0xa0')]){_0x5b9122[_0xecf0('0x9f')]=_['merge'](_0x5b9122[_0xecf0('0x9f')],{'$or':_[_0xecf0('0x32')](_0x5b9122[_0xecf0('0x42')],function(_0x2ce08f){var _0x22ab73={};_0x22ab73[_0x2ce08f]={'$like':'%'+_0x1aa6d1[_0xecf0('0x39')][_0xecf0('0xa0')]+'%'};return _0x22ab73;})});}_0x5b9122[_0xecf0('0x9f')][_0xecf0('0x8e')]=![];if(_0x1aa6d1[_0xecf0('0x39')]['id']){_0x5b9122[_0xecf0('0x9f')]['id']={'$gt':_0x1aa6d1[_0xecf0('0x39')]['id']};}_0x5b9122=_[_0xecf0('0x2c')]({},_0x5b9122,_0x1aa6d1[_0xecf0('0xa6')]);return db[_0xecf0('0x5e')]['count']({'where':_0x5b9122[_0xecf0('0x9f')]})[_0xecf0('0x14')](function(_0x19f779){_0x4acb4a[_0xecf0('0x24')]=_0x19f779;_0x5b9122['include']=[];if(_0x1aa6d1['query'][_0xecf0('0xa7')]){_0x5b9122[_0xecf0('0x47')][_0xecf0('0xa8')]({'model':db[_0xecf0('0x7f')],'as':'User','attributes':['id',_0xecf0('0x54'),_0xecf0('0xa9')]});}if(_0x1aa6d1[_0xecf0('0x39')][_0xecf0('0x46')]){_0x5b9122[_0xecf0('0x47')]=[{'all':!![]}];}return db[_0xecf0('0x5e')][_0xecf0('0x37')](_0x5b9122);})[_0xecf0('0x14')](function(_0xd1ef98){_0x4acb4a[_0xecf0('0xa3')]=_0xd1ef98;return _0x4acb4a;});}})['then'](respondWithFilteredResult(_0x49b767,_0x5b9122))[_0xecf0('0x3b')](handleError(_0x49b767,null));};exports[_0xecf0('0xaa')]=function(_0x49530d,_0x3a7710){return db['ChatInteraction'][_0xecf0('0x48')]({'where':{'id':_0x49530d[_0xecf0('0x3d')]['id']}})[_0xecf0('0x14')](handleEntityNotFound(_0x3a7710,null))['then'](function(_0x408996){if(_0x408996){return _0x408996['setTags'](_0x49530d['body'][_0xecf0('0x98')],_['omit'](_0x49530d[_0xecf0('0x4a')],['ids','id'])||{})[_0xecf0('0xab')](function(){return db[_0xecf0('0xac')][_0xecf0('0x37')]({'attributes':['id',_0xecf0('0x2a'),_0xecf0('0xad')],'where':{'id':_0x49530d[_0xecf0('0x4a')][_0xecf0('0x98')]}});})[_0xecf0('0x14')](function(_0x556379){socket[_0xecf0('0xae')](_0xecf0('0xaf'),{'id':Number(_0x49530d[_0xecf0('0x3d')]['id']),'tags':_0x556379||[]});return{'id':Number(_0x49530d[_0xecf0('0x3d')]['id']),'tags':_0x556379||[]};});}})['then'](respondWithResult(_0x3a7710,null))[_0xecf0('0x3b')](handleError(_0x3a7710,null));};exports[_0xecf0('0xb0')]=function(_0x444574,_0x1775ad){return db[_0xecf0('0x3e')]['find']({'where':{'id':_0x444574[_0xecf0('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1775ad,null))['then'](function(_0x2c90ef){if(_0x2c90ef){return _0x2c90ef[_0xecf0('0xb0')](_0x444574[_0xecf0('0x39')][_0xecf0('0x98')]);}})['then'](respondWithStatusCode(_0x1775ad,null))[_0xecf0('0x3b')](handleError(_0x1775ad,null));};exports[_0xecf0('0x76')]=function(_0x2e75a0,_0x39e8a4){var _0x4cb263=moment()['unix']()[_0xecf0('0xb1')]();var _0x39abc2=path[_0xecf0('0x72')](config[_0xecf0('0x73')],_0xecf0('0xb2'),_0xecf0('0xb3'),_0xecf0('0xb4'));var _0xca76a1=path[_0xecf0('0x72')](config['root'],'server',_0xecf0('0xb3'),'attachments');var _0x453f72=path[_0xecf0('0x72')](_0x39abc2,_0x4cb263);var _0x3a7f13=util['format']('transcript-%d-%s.zip',_0x2e75a0[_0xecf0('0x3d')]['id'],_0x4cb263);var _0x4fe85f=path['join'](_0x39abc2,_0x3a7f13);var _0x32db42=[];_0x32db42['push']({'model':db[_0xecf0('0x7f')],'as':_0xecf0('0x7f'),'attributes':['id',_0xecf0('0x54')],'raw':!![]});_0x32db42['push']({'model':db[_0xecf0('0x61')],'as':_0xecf0('0x62'),'attributes':['id','firstName',_0xecf0('0xb5')],'raw':!![]});if(_0x2e75a0[_0xecf0('0x39')]['attachments']){_0x32db42[_0xecf0('0xa8')]({'model':db[_0xecf0('0x6d')],'as':_0xecf0('0x6d'),'raw':!![]});}var _0x3d795c=[{'model':db['ChatMessage'],'as':_0xecf0('0x7e'),'attributes':['id',_0xecf0('0x4a'),_0xecf0('0x8b'),'direction',_0xecf0('0x8e'),_0xecf0('0xb6')],'include':_0x32db42}];_0x3d795c['push']({'model':db['ChatWebsite'],'as':_0xecf0('0xb7'),'attributes':['id',_0xecf0('0x2a')]});_0x3d795c[_0xecf0('0xa8')]({'model':db['User'],'as':_0xecf0('0xb8'),'attributes':['id','fullname']});return db['ChatInteraction'][_0xecf0('0x48')]({'where':{'id':_0x2e75a0[_0xecf0('0x3d')]['id']},'include':_0x3d795c})['then'](handleEntityNotFound(_0x39e8a4,null))[_0xecf0('0x14')](function(_0x11e3b0){if(_0x11e3b0){var _0x24a61c=_0x11e3b0['get']({'plain':!![]});fs[_0xecf0('0xb9')](_0x453f72);var _0xfb34c8={'channel':_0xecf0('0xba'),'account':_0x24a61c[_0xecf0('0xb7')]['name'],'agent':_0x24a61c[_0xecf0('0xb8')]?_0x24a61c[_0xecf0('0xb8')][_0xecf0('0x54')]:_0xecf0('0xbb'),'createdAt':moment(_0x24a61c[_0xecf0('0x8b')])[_0xecf0('0x7a')](_0xecf0('0xa2'))[_0xecf0('0xb1')](),'closedAt':_0x24a61c['closed']?moment(_0x24a61c[_0xecf0('0xbc')])['format'](_0xecf0('0xa2'))[_0xecf0('0xb1')]():'','disposition':_0x24a61c[_0xecf0('0x67')],'chatInfo':{'browser':_0x24a61c[_0xecf0('0xbd')],'os':_0x24a61c[_0xecf0('0xbe')],'referer':_0x24a61c[_0xecf0('0xbf')],'customerIp':_0x24a61c['customerIp'],'customerPort':_0x24a61c[_0xecf0('0xc0')]?_0x24a61c['customerPort']:_0xecf0('0xbb')},'messages':_(_0x24a61c[_0xecf0('0x7e')])[_0xecf0('0xc1')]()[_0xecf0('0xa0')]({'secret':![]})[_0xecf0('0x32')](function(_0xb24602){if(_0xb24602['Attachment']){var _0x31f6fb=path[_0xecf0('0x72')](_0xca76a1,_0xb24602[_0xecf0('0x6d')]['basename']);if(fs['existsSync'](_0x31f6fb)){fs[_0xecf0('0xc2')](_0x31f6fb)[_0xecf0('0xc3')](fs[_0xecf0('0xc4')](path[_0xecf0('0x72')](_0x453f72,_0xb24602['Attachment'][_0xecf0('0x6a')])));}}return{'date':moment(_0xb24602[_0xecf0('0x8b')])[_0xecf0('0x7a')](_0xecf0('0xa2'))[_0xecf0('0xb1')](),'sender':_0xb24602[_0xecf0('0x8d')]===_0xecf0('0x5d')?_0xb24602[_0xecf0('0x7f')]?_0xb24602[_0xecf0('0x7f')][_0xecf0('0x54')]:_0xecf0('0x83'):_0xb24602['Contact'][_0xecf0('0xc5')]+(_0xb24602[_0xecf0('0x62')][_0xecf0('0xb5')]?'\x20'+_0xb24602['Contact']['lastName']:''),'body':_0xb24602[_0xecf0('0x6d')]?_0xb24602[_0xecf0('0x6d')][_0xecf0('0x6a')]:_0xb24602[_0xecf0('0x4a')],'direction':_0xb24602[_0xecf0('0x8d')]===_0xecf0('0x5d')?'A':'C','secret':_0xb24602[_0xecf0('0x8e')],'read':_0xb24602[_0xecf0('0xb6')],'attachment':_0xb24602[_0xecf0('0x6d')]};})[_0xecf0('0xc6')]()};return ejs[_0xecf0('0xc7')](path[_0xecf0('0x72')](config[_0xecf0('0x73')],_0xecf0('0xb2'),_0xecf0('0xc8'),_0xecf0('0xc9')),{'interaction':_0xfb34c8})[_0xecf0('0x14')](function(_0x5edffe){var _0x6d1a50=path[_0xecf0('0x72')](_0x453f72,_0xecf0('0xca')+_0x24a61c['id']+'-'+_0x4cb263+_0xecf0('0xcb'));var _0x3007f9={'path':_0x6d1a50,'channel':'Chat','interactionId':_0x24a61c['id']};return pdf[_0xecf0('0xcc')](_0x5edffe,_0x3007f9);})[_0xecf0('0x14')](function(){return new Promise(function(_0x1033ce,_0x43fda2){zipdir(_0x453f72,{'saveTo':_0x4fe85f},function(_0x4ab3d8,_0x49eb9c){if(_0x4ab3d8)return _0x43fda2(_0x4ab3d8);return _0x1033ce(_0x49eb9c);});})[_0xecf0('0x14')](function(){return new BPromise(function(_0x1484c4,_0x350581){rimraf(_0x453f72,function(_0x4707ad){if(_0x4707ad)_0x350581(_0x4707ad);return _0x1484c4();});});})[_0xecf0('0x14')](function(){return _0x39e8a4['download'](_0x4fe85f,_0x3a7f13,function(_0x14e6da){if(_0x14e6da){logger[_0xecf0('0x18')](_0xecf0('0xcd'),_0x14e6da);}else{fs[_0xecf0('0xce')](_0x4fe85f);}});});});}else{return _0x39e8a4[_0xecf0('0x1d')](0xc8);}})[_0xecf0('0x3b')](handleError(_0x39e8a4,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 83ed538..f37ba97 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 _0x14f8=['exports','ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers','then','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x296ee6,_0x2c9872){var _0x38d838=function(_0x2bbb79){while(--_0x2bbb79){_0x296ee6['push'](_0x296ee6['shift']());}};_0x38d838(++_0x2c9872);}(_0x14f8,0xe2));var _0x814f=function(_0x5683d4,_0x4abc6f){_0x5683d4=_0x5683d4-0x0;var _0x48a100=_0x14f8[_0x5683d4];return _0x48a100;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x814f('0x0')];var ChatMessage=require('../../mysqldb')['db'][_0x814f('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x814f('0x2')](0x0);var events={'afterCreate':_0x814f('0x3'),'afterUpdate':'update','afterDestroy':_0x814f('0x4')};function emitEvent(_0x547d1f){return function(_0x29a256,_0x26c3e1,_0x4b261c){_0x29a256[_0x814f('0x5')]({'attributes':['id'],'raw':!![]})[_0x814f('0x6')](function(_0x173158){_0x29a256['setDataValue'](_0x814f('0x7'),_0x173158['map'](function(_0x4f6a43){return{'id':_0x4f6a43['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x29a256['id'],'direction':'in','read':![]},'raw':!![]});})[_0x814f('0x6')](function(_0x7e20c8){_0x29a256['setDataValue'](_0x814f('0x8'),_0x7e20c8[_0x814f('0x9')]);ChatInteractionEvents[_0x814f('0xa')](_0x547d1f+':'+_0x29a256['id'],_0x29a256);ChatInteractionEvents['emit'](_0x547d1f,_0x29a256);_0x4b261c(null);})[_0x814f('0xb')](_0x4b261c(null));};}for(var e in events){if(events[_0x814f('0xc')](e)){var event=events[e];ChatInteraction[_0x814f('0xd')](e,emitEvent(event));}}module[_0x814f('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0xea71=['events','../../mysqldb','setMaxListeners','save','update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x2a8020,_0x30b23d){var _0x239636=function(_0x29aa39){while(--_0x29aa39){_0x2a8020['push'](_0x2a8020['shift']());}};_0x239636(++_0x30b23d);}(_0xea71,0x143));var _0x1ea7=function(_0x2d060e,_0xbfe514){_0x2d060e=_0x2d060e-0x0;var _0x36a103=_0xea71[_0x2d060e];return _0x36a103;};'use strict';var EventEmitter=require(_0x1ea7('0x0'));var ChatInteraction=require(_0x1ea7('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x1ea7('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x1ea7('0x2')](0x0);var events={'afterCreate':_0x1ea7('0x3'),'afterUpdate':_0x1ea7('0x4'),'afterDestroy':_0x1ea7('0x5')};function emitEvent(_0x43ba7f){return function(_0xbcd225,_0x179c11,_0x1862ba){_0xbcd225['getUsers']({'attributes':['id'],'raw':!![]})[_0x1ea7('0x6')](function(_0x312a7b){_0xbcd225[_0x1ea7('0x7')]('Users',_0x312a7b[_0x1ea7('0x8')](function(_0x5a486e){return{'id':_0x5a486e['id']};}));return ChatMessage[_0x1ea7('0x9')]({'where':{'ChatInteractionId':_0xbcd225['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x521c38){_0xbcd225[_0x1ea7('0x7')](_0x1ea7('0xa'),_0x521c38[_0x1ea7('0xb')]);ChatInteractionEvents[_0x1ea7('0xc')](_0x43ba7f+':'+_0xbcd225['id'],_0xbcd225);ChatInteractionEvents['emit'](_0x43ba7f,_0xbcd225);_0x1862ba(null);})[_0x1ea7('0xd')](_0x1862ba(null));};}for(var e in events){if(events[_0x1ea7('0xe')](e)){var event=events[e];ChatInteraction[_0x1ea7('0xf')](e,emitEvent(event));}}module[_0x1ea7('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 19e832a..78f4185 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 _0xcd9e=['path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x1acf65,_0x597636){var _0xeb7dd7=function(_0x30261c){while(--_0x30261c){_0x1acf65['push'](_0x1acf65['shift']());}};_0xeb7dd7(++_0x597636);}(_0xcd9e,0x14b));var _0xecd9=function(_0x10eef6,_0x3601ff){_0x10eef6=_0x10eef6-0x0;var _0x3483dd=_0xcd9e[_0x10eef6];return _0x3483dd;};'use strict';var _=require(_0xecd9('0x0'));var util=require(_0xecd9('0x1'));var logger=require(_0xecd9('0x2'))(_0xecd9('0x3'));var moment=require('moment');var BPromise=require(_0xecd9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xecd9('0x5'));var rimraf=require(_0xecd9('0x6'));var config=require(_0xecd9('0x7'));var attributes=require(_0xecd9('0x8'));module[_0xecd9('0x9')]=function(_0xa99aa8,_0x1088fa){return _0xa99aa8[_0xecd9('0xa')](_0xecd9('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48da20,_0x3db9a1,_0x3534bf){if(_0x48da20['changed']('closed')){_0x48da20['closedAt']=moment()[_0xecd9('0xc')](_0xecd9('0xd'));}_0x3534bf(null,_0x48da20);}},'charset':_0xecd9('0xe'),'collate':_0xecd9('0xf')});}; \ No newline at end of file +var _0xcc49=['request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x2d9c11,_0x2a4c8a){var _0x3b3e89=function(_0x415955){while(--_0x415955){_0x2d9c11['push'](_0x2d9c11['shift']());}};_0x3b3e89(++_0x2a4c8a);}(_0xcc49,0x1c8));var _0x9cc4=function(_0x336c8b,_0x56b55b){_0x336c8b=_0x336c8b-0x0;var _0x4dd2f6=_0xcc49[_0x336c8b];return _0x4dd2f6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9cc4('0x0'))(_0x9cc4('0x1'));var moment=require(_0x9cc4('0x2'));var BPromise=require('bluebird');var rp=require(_0x9cc4('0x3'));var fs=require('fs');var path=require(_0x9cc4('0x4'));var rimraf=require(_0x9cc4('0x5'));var config=require(_0x9cc4('0x6'));var attributes=require(_0x9cc4('0x7'));module[_0x9cc4('0x8')]=function(_0x54c3e8,_0x4e5446){return _0x54c3e8['define'](_0x9cc4('0x9'),attributes,{'tableName':_0x9cc4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4205c4,_0xe41488,_0x595ac1){if(_0x4205c4[_0x9cc4('0xb')](_0x9cc4('0xc'))){_0x4205c4[_0x9cc4('0xd')]=moment()[_0x9cc4('0xe')](_0x9cc4('0xf'));}_0x595ac1(null,_0x4205c4);}},'charset':'utf8mb4','collate':_0x9cc4('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 07a6edb..995aee8 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 _0xc184=['redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatInteraction','update','body','options','raw','where','limit','UpdateChatInteraction','stringify','then','ids','omit','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xc184,0x18f));var _0x4c18=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xc184[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x4c18('0x0'));var util=require('util');var moment=require(_0x4c18('0x1'));var BPromise=require('bluebird');var rs=require(_0x4c18('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c18('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c18('0x4'))('rpc');var config=require(_0x4c18('0x5'));var jayson=require(_0x4c18('0x6'));var client=jayson[_0x4c18('0x7')]['http']({'port':0x232a});config[_0x4c18('0x8')]=_['defaults'](config[_0x4c18('0x8')],{'host':_0x4c18('0x9'),'port':0x18eb});var socket=require(_0x4c18('0xa'))(new Redis(config['redis']));require(_0x4c18('0xb'))[_0x4c18('0xc')](socket);function respondWithRpcPromise(_0x9c3442,_0x11cf84,_0x26692f){return new BPromise(function(_0x3de4ad,_0x92e507){return client[_0x4c18('0xd')](_0x9c3442,_0x26692f)['then'](function(_0x50f1c8){logger[_0x4c18('0xe')](_0x4c18('0xf'),_0x11cf84,_0x4c18('0x10'));logger[_0x4c18('0x11')](_0x4c18('0x12'),_0x11cf84,_0x4c18('0x10'),JSON['stringify'](_0x50f1c8));if(_0x50f1c8[_0x4c18('0x13')]){if(_0x50f1c8['error'][_0x4c18('0x14')]===0x1f4){logger['error'](_0x4c18('0xf'),_0x11cf84,_0x50f1c8[_0x4c18('0x13')][_0x4c18('0x15')]);return _0x92e507(_0x50f1c8[_0x4c18('0x13')][_0x4c18('0x15')]);}logger[_0x4c18('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x11cf84,_0x50f1c8[_0x4c18('0x13')][_0x4c18('0x15')]);return _0x3de4ad(_0x50f1c8['error']['message']);}else{logger[_0x4c18('0xe')](_0x4c18('0xf'),_0x11cf84,_0x4c18('0x10'));_0x3de4ad(_0x50f1c8[_0x4c18('0x16')]['message']);}})[_0x4c18('0x17')](function(_0x2944b4){logger['error'](_0x4c18('0xf'),_0x11cf84,_0x2944b4);_0x92e507(_0x2944b4);});});}exports['UpdateChatInteraction']=function(_0x80172d){var _0x3cf66b=this;return new Promise(function(_0x139381,_0x26851b){return db[_0x4c18('0x18')][_0x4c18('0x19')](_0x80172d[_0x4c18('0x1a')],{'raw':_0x80172d[_0x4c18('0x1b')]?_0x80172d['options'][_0x4c18('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x80172d['options']?_0x80172d[_0x4c18('0x1b')][_0x4c18('0x1d')]||null:null,'attributes':_0x80172d[_0x4c18('0x1b')]?_0x80172d[_0x4c18('0x1b')]['attributes']||null:null,'limit':_0x80172d[_0x4c18('0x1b')]?_0x80172d[_0x4c18('0x1b')][_0x4c18('0x1e')]||null:null})['then'](function(_0x3512ef){logger['info']('UpdateChatInteraction',_0x80172d);logger[_0x4c18('0x11')](_0x4c18('0x1f'),_0x80172d,JSON[_0x4c18('0x20')](_0x3512ef));_0x139381(_0x3512ef);})[_0x4c18('0x17')](function(_0x21855e){logger[_0x4c18('0x13')]('UpdateChatInteraction',_0x21855e[_0x4c18('0x15')],_0x80172d);_0x26851b(_0x3cf66b[_0x4c18('0x13')](0x1f4,_0x21855e[_0x4c18('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x17f882){return new Promise(function(_0x135664,_0x2560fd){return db['ChatInteraction']['find']({'where':_0x17f882['options']?_0x17f882[_0x4c18('0x1b')][_0x4c18('0x1d')]||null:null})[_0x4c18('0x21')](function(_0x4c83b){if(_0x4c83b){return _0x4c83b['addTags'](_0x17f882[_0x4c18('0x1a')][_0x4c18('0x22')],_[_0x4c18('0x23')](_0x17f882[_0x4c18('0x1a')],[_0x4c18('0x22'),'id'])||{});}})['spread'](function(_0x255e8b){logger[_0x4c18('0xe')](_0x4c18('0x24'),_0x17f882);logger['debug']('AddTags',_0x17f882,JSON[_0x4c18('0x20')](_0x255e8b));_0x135664(_0x255e8b);})['catch'](function(_0x50a268){logger['error']('AddTags',_0x50a268[_0x4c18('0x15')],_0x17f882);_0x2560fd(_this[_0x4c18('0x13')](0x1f4,_0x50a268['message']));});});}; \ No newline at end of file +var _0xd7f1=['message','result','UpdateChatInteraction','options','raw','where','attributes','limit','info','debug','catch','AddTagsToChatInteraction','addTags','body','ids','omit','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7f1,0xcf));var _0x1d7f=function(_0x1e1858,_0x2bc0ec){_0x1e1858=_0x1e1858-0x0;var _0x4d8d7a=_0xd7f1[_0x1e1858];return _0x4d8d7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1d7f('0x0'));var BPromise=require(_0x1d7f('0x1'));var rs=require(_0x1d7f('0x2'));var fs=require('fs');var Redis=require(_0x1d7f('0x3'));var db=require(_0x1d7f('0x4'))['db'];var utils=require(_0x1d7f('0x5'));var logger=require(_0x1d7f('0x6'))(_0x1d7f('0x7'));var config=require(_0x1d7f('0x8'));var jayson=require(_0x1d7f('0x9'));var client=jayson[_0x1d7f('0xa')]['http']({'port':0x232a});config[_0x1d7f('0xb')]=_['defaults'](config['redis'],{'host':_0x1d7f('0xc'),'port':0x18eb});var socket=require(_0x1d7f('0xd'))(new Redis(config[_0x1d7f('0xb')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x42167e,_0xae04ad,_0x30b968){return new BPromise(function(_0x16dcf0,_0x500446){return client[_0x1d7f('0xe')](_0x42167e,_0x30b968)[_0x1d7f('0xf')](function(_0x342dc2){logger['info'](_0x1d7f('0x10'),_0xae04ad,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xae04ad,_0x1d7f('0x11'),JSON[_0x1d7f('0x12')](_0x342dc2));if(_0x342dc2[_0x1d7f('0x13')]){if(_0x342dc2[_0x1d7f('0x13')][_0x1d7f('0x14')]===0x1f4){logger[_0x1d7f('0x13')](_0x1d7f('0x10'),_0xae04ad,_0x342dc2['error']['message']);return _0x500446(_0x342dc2[_0x1d7f('0x13')]['message']);}logger['error'](_0x1d7f('0x10'),_0xae04ad,_0x342dc2['error'][_0x1d7f('0x15')]);return _0x16dcf0(_0x342dc2[_0x1d7f('0x13')][_0x1d7f('0x15')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0xae04ad,_0x1d7f('0x11'));_0x16dcf0(_0x342dc2[_0x1d7f('0x16')]['message']);}})['catch'](function(_0x35f1de){logger[_0x1d7f('0x13')](_0x1d7f('0x10'),_0xae04ad,_0x35f1de);_0x500446(_0x35f1de);});});}exports[_0x1d7f('0x17')]=function(_0x3770d6){var _0x3bd63a=this;return new Promise(function(_0x37e65b,_0xf5e0d8){return db['ChatInteraction']['update'](_0x3770d6['body'],{'raw':_0x3770d6[_0x1d7f('0x18')]?_0x3770d6[_0x1d7f('0x18')][_0x1d7f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3770d6[_0x1d7f('0x18')]?_0x3770d6['options'][_0x1d7f('0x1a')]||null:null,'attributes':_0x3770d6['options']?_0x3770d6['options'][_0x1d7f('0x1b')]||null:null,'limit':_0x3770d6['options']?_0x3770d6[_0x1d7f('0x18')][_0x1d7f('0x1c')]||null:null})[_0x1d7f('0xf')](function(_0x54ea9e){logger[_0x1d7f('0x1d')](_0x1d7f('0x17'),_0x3770d6);logger[_0x1d7f('0x1e')](_0x1d7f('0x17'),_0x3770d6,JSON[_0x1d7f('0x12')](_0x54ea9e));_0x37e65b(_0x54ea9e);})[_0x1d7f('0x1f')](function(_0x3a0037){logger['error'](_0x1d7f('0x17'),_0x3a0037[_0x1d7f('0x15')],_0x3770d6);_0xf5e0d8(_0x3bd63a[_0x1d7f('0x13')](0x1f4,_0x3a0037[_0x1d7f('0x15')]));});});};exports[_0x1d7f('0x20')]=function(_0x242ef6){return new Promise(function(_0x43115b,_0x42f4ab){return db['ChatInteraction']['find']({'where':_0x242ef6[_0x1d7f('0x18')]?_0x242ef6[_0x1d7f('0x18')][_0x1d7f('0x1a')]||null:null})[_0x1d7f('0xf')](function(_0x3ddbc3){if(_0x3ddbc3){return _0x3ddbc3[_0x1d7f('0x21')](_0x242ef6[_0x1d7f('0x22')][_0x1d7f('0x23')],_[_0x1d7f('0x24')](_0x242ef6['body'],['ids','id'])||{});}})['spread'](function(_0x1f8628){logger['info'](_0x1d7f('0x25'),_0x242ef6);logger['debug'](_0x1d7f('0x25'),_0x242ef6,JSON[_0x1d7f('0x12')](_0x1f8628));_0x43115b(_0x1f8628);})[_0x1d7f('0x1f')](function(_0x247c46){logger[_0x1d7f('0x13')]('AddTags',_0x247c46['message'],_0x242ef6);_0x42f4ab(_this[_0x1d7f('0x13')](0x1f4,_0x247c46[_0x1d7f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0c3ce97..4be9081 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 _0x5947=['update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0xbb79d2,_0x7df561){var _0x3a72eb=function(_0x2511b1){while(--_0x2511b1){_0xbb79d2['push'](_0xbb79d2['shift']());}};_0x3a72eb(++_0x7df561);}(_0x5947,0x16e));var _0x7594=function(_0x43cb67,_0x5aaaa9){_0x43cb67=_0x43cb67-0x0;var _0x2d35a4=_0x5947[_0x43cb67];return _0x2d35a4;};'use strict';var ChatInteractionEvents=require(_0x7594('0x0'));var events=[_0x7594('0x1'),_0x7594('0x2'),_0x7594('0x3')];function createListener(_0xd87c08,_0x22bf9b){return function(_0x2bed84){_0x22bf9b[_0x7594('0x4')](_0xd87c08,_0x2bed84);};}function removeListener(_0x3355ff,_0x1a0c75){return function(){ChatInteractionEvents[_0x7594('0x5')](_0x3355ff,_0x1a0c75);};}exports[_0x7594('0x6')]=function(_0x1fac2e){for(var _0x378695=0x0,_0x5c4b53=events[_0x7594('0x7')];_0x378695<_0x5c4b53;_0x378695++){var _0x58d17b=events[_0x378695];var _0x52b2a3=createListener(_0x7594('0x8')+_0x58d17b,_0x1fac2e);ChatInteractionEvents['on'](_0x58d17b,_0x52b2a3);}}; \ No newline at end of file +var _0x0a7f=['chatInteraction:','remove','update','emit','removeListener','register'];(function(_0x5c1a4c,_0x3778b2){var _0x5c66b7=function(_0x9756e6){while(--_0x9756e6){_0x5c1a4c['push'](_0x5c1a4c['shift']());}};_0x5c66b7(++_0x3778b2);}(_0x0a7f,0xdf));var _0xf0a7=function(_0x2c63ac,_0x1df97a){_0x2c63ac=_0x2c63ac-0x0;var _0xdf3040=_0x0a7f[_0x2c63ac];return _0xdf3040;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0xf0a7('0x0'),_0xf0a7('0x1')];function createListener(_0x4fffb2,_0x100fdd){return function(_0x4cda0c){_0x100fdd[_0xf0a7('0x2')](_0x4fffb2,_0x4cda0c);};}function removeListener(_0xf15212,_0xeaac94){return function(){ChatInteractionEvents[_0xf0a7('0x3')](_0xf15212,_0xeaac94);};}exports[_0xf0a7('0x4')]=function(_0x42e27a){for(var _0x305ea6=0x0,_0x19ffa7=events['length'];_0x305ea6<_0x19ffa7;_0x305ea6++){var _0x22dc7c=events[_0x305ea6];var _0x20e7fa=createListener(_0xf0a7('0x5')+_0x22dc7c,_0x42e27a);ChatInteractionEvents['on'](_0x22dc7c,_0x20e7fa);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 3677c6e..160bc25 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 _0xf2a8=['addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/close','close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','/:id/tags','tracked','chat','chatinteraction:addtags'];(function(_0x13cde0,_0xb9753e){var _0x514733=function(_0x348279){while(--_0x348279){_0x13cde0['push'](_0x13cde0['shift']());}};_0x514733(++_0xb9753e);}(_0xf2a8,0x79));var _0x8f2a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf2a8[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x8f2a('0x0'));var util=require(_0x8f2a('0x1'));var path=require(_0x8f2a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8f2a('0x3')]();var fs_extra=require(_0x8f2a('0x4'));var auth=require(_0x8f2a('0x5'));var interaction=require(_0x8f2a('0x6'));var config=require(_0x8f2a('0x7'));var controller=require(_0x8f2a('0x8'));router[_0x8f2a('0x9')]('/',auth[_0x8f2a('0xa')](),controller[_0x8f2a('0xb')]);router['get'](_0x8f2a('0xc'),auth[_0x8f2a('0xa')](),controller[_0x8f2a('0xd')]);router[_0x8f2a('0x9')](_0x8f2a('0xe'),auth[_0x8f2a('0xf')](),controller[_0x8f2a('0x10')]);router[_0x8f2a('0x9')](_0x8f2a('0x11'),auth[_0x8f2a('0xf')](),controller[_0x8f2a('0x12')]);router[_0x8f2a('0x9')](_0x8f2a('0x13'),auth[_0x8f2a('0xa')](),controller[_0x8f2a('0x14')]);router[_0x8f2a('0x9')](_0x8f2a('0x15'),auth[_0x8f2a('0xf')](),controller[_0x8f2a('0x16')]);router['get']('/:id/download',auth[_0x8f2a('0xa')](),controller[_0x8f2a('0x17')]);router[_0x8f2a('0x18')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8f2a('0x18')](_0x8f2a('0x19'),auth[_0x8f2a('0xa')](),controller[_0x8f2a('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x197f9b,_0x21277c,_0x4aabff){_0x4aabff(null,path[_0x8f2a('0x1b')](config[_0x8f2a('0x1c')],_0x8f2a('0x1d')));},'filename':function(_0x3558f8,_0x19180d,_0x26b829){_0x26b829(null,util[_0x8f2a('0x1e')](_0x8f2a('0x1f'),Date[_0x8f2a('0x20')](),_0x19180d[_0x8f2a('0x21')][_0x8f2a('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8f2a('0x18')](_0x8f2a('0x23'),upload[_0x8f2a('0x24')]('file'),controller['attachmentUpload']);router[_0x8f2a('0x18')](_0x8f2a('0x13'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x8f2a('0x18')](_0x8f2a('0x25'),auth[_0x8f2a('0xa')](),interaction[_0x8f2a('0x26')](_0x8f2a('0x27'),_0x8f2a('0x28')),controller[_0x8f2a('0x29')]);router[_0x8f2a('0x2a')](_0x8f2a('0xe'),auth[_0x8f2a('0xa')](),interaction[_0x8f2a('0x26')](_0x8f2a('0x27'),_0x8f2a('0x2b')),controller[_0x8f2a('0x2c')]);router[_0x8f2a('0x2a')](_0x8f2a('0x2d'),controller[_0x8f2a('0x2e')]);router[_0x8f2a('0x2a')]('/:id/abandon',auth[_0x8f2a('0xf')](),controller['abandon']);router[_0x8f2a('0x2a')](_0x8f2a('0x2f'),controller[_0x8f2a('0x30')]);router['delete'](_0x8f2a('0xe'),auth[_0x8f2a('0xa')](),interaction[_0x8f2a('0x26')]('chat',_0x8f2a('0x31')),controller[_0x8f2a('0x32')]);router[_0x8f2a('0x33')](_0x8f2a('0x25'),auth[_0x8f2a('0xa')](),controller[_0x8f2a('0x34')]);module[_0x8f2a('0x35')]=router; \ No newline at end of file +var _0x998f=['../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','/:id/attachment_upload','single','attachmentUpload','/:id/tags','tracked','chatinteraction:addtags','addTags','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chat','chatinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x998f,0x136));var _0xf998=function(_0x45de99,_0x2b5ffd){_0x45de99=_0x45de99-0x0;var _0x2c846d=_0x998f[_0x45de99];return _0x2c846d;};'use strict';var multer=require(_0xf998('0x0'));var util=require(_0xf998('0x1'));var path=require(_0xf998('0x2'));var timeout=require(_0xf998('0x3'));var express=require(_0xf998('0x4'));var router=express[_0xf998('0x5')]();var fs_extra=require(_0xf998('0x6'));var auth=require(_0xf998('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf998('0x8'));var controller=require(_0xf998('0x9'));router['get']('/',auth[_0xf998('0xa')](),controller[_0xf998('0xb')]);router[_0xf998('0xc')](_0xf998('0xd'),auth['isAuthenticated'](),controller[_0xf998('0xe')]);router[_0xf998('0xc')](_0xf998('0xf'),auth[_0xf998('0x10')](),controller[_0xf998('0x11')]);router[_0xf998('0xc')]('/:id/attachment_download',auth[_0xf998('0x10')](),controller[_0xf998('0x12')]);router[_0xf998('0xc')](_0xf998('0x13'),auth[_0xf998('0xa')](),controller[_0xf998('0x14')]);router['get'](_0xf998('0x15'),auth[_0xf998('0x10')](),controller['getMyMessages']);router['get']('/:id/download',auth[_0xf998('0xa')](),controller[_0xf998('0x16')]);router['post']('/',auth[_0xf998('0xa')](),controller[_0xf998('0x17')]);router[_0xf998('0x18')](_0xf998('0x19'),auth[_0xf998('0xa')](),controller[_0xf998('0x1a')]);var upload=multer({'storage':multer[_0xf998('0x1b')]({'destination':function(_0x34d18a,_0x3f2bc2,_0x1e7343){_0x1e7343(null,path[_0xf998('0x1c')](config[_0xf998('0x1d')],_0xf998('0x1e')));},'filename':function(_0x42733f,_0x177e25,_0xad57ac){_0xad57ac(null,util['format'](_0xf998('0x1f'),Date[_0xf998('0x20')](),_0x177e25[_0xf998('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf998('0x18')](_0xf998('0x22'),upload[_0xf998('0x23')]('file'),controller[_0xf998('0x24')]);router[_0xf998('0x18')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller['addMessage']);router['post'](_0xf998('0x25'),auth[_0xf998('0xa')](),interaction[_0xf998('0x26')]('chat',_0xf998('0x27')),controller[_0xf998('0x28')]);router[_0xf998('0x29')](_0xf998('0xf'),auth[_0xf998('0xa')](),interaction[_0xf998('0x26')]('chat','chatinteraction:update'),controller['update']);router['put'](_0xf998('0x2a'),controller[_0xf998('0x2b')]);router[_0xf998('0x29')](_0xf998('0x2c'),auth[_0xf998('0x10')](),controller[_0xf998('0x2d')]);router['put'](_0xf998('0x2e'),controller[_0xf998('0x2f')]);router[_0xf998('0x30')]('/:id',auth[_0xf998('0xa')](),interaction[_0xf998('0x26')](_0xf998('0x31'),_0xf998('0x32')),controller[_0xf998('0x33')]);router[_0xf998('0x30')](_0xf998('0x25'),auth[_0xf998('0xa')](),controller[_0xf998('0x34')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index c058dc7..0f3a2fc 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 _0x810a=['medium','BOOLEAN','sequelize'];(function(_0x83531b,_0x5daca6){var _0x3696f2=function(_0x368b38){while(--_0x368b38){_0x83531b['push'](_0x83531b['shift']());}};_0x3696f2(++_0x5daca6);}(_0x810a,0x134));var _0xa810=function(_0x25b954,_0x523fe5){_0x25b954=_0x25b954-0x0;var _0x85f71d=_0x810a[_0x25b954];return _0x85f71d;};'use strict';var Sequelize=require(_0xa810('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xa810('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xa810('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xdd7f=['sequelize','medium','BOOLEAN'];(function(_0x1ef0dd,_0x4435ea){var _0x18710c=function(_0x419133){while(--_0x419133){_0x1ef0dd['push'](_0x1ef0dd['shift']());}};_0x18710c(++_0x4435ea);}(_0xdd7f,0x1d7));var _0xfdd7=function(_0x3d125d,_0xc2ce6a){_0x3d125d=_0x3d125d-0x0;var _0x3c7a20=_0xdd7f[_0x3d125d];return _0x3c7a20;};'use strict';var Sequelize=require(_0xfdd7('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xfdd7('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xfdd7('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 73ff6a2..7afde40 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 _0xf2c4=['util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','sort','where','filters','pick','filter','merge','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','get','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','FromId','ToId','read','all','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x4794b7,_0x4207b2){var _0x4552a9=function(_0x1e8123){while(--_0x1e8123){_0x4794b7['push'](_0x4794b7['shift']());}};_0x4552a9(++_0x4207b2);}(_0xf2c4,0x141));var _0x4f2c=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xf2c4[_0x12fc8d];return _0x3f9d04;};'use strict';var emlformat=require(_0x4f2c('0x0'));var rimraf=require(_0x4f2c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f2c('0x2'));var rp=require(_0x4f2c('0x3'));var moment=require('moment');var BPromise=require(_0x4f2c('0x4'));var Mustache=require(_0x4f2c('0x5'));var util=require(_0x4f2c('0x6'));var path=require('path');var sox=require(_0x4f2c('0x7'));var csv=require(_0x4f2c('0x8'));var ejs=require(_0x4f2c('0x9'));var fs=require('fs');var fs_extra=require(_0x4f2c('0xa'));var _=require('lodash');var squel=require(_0x4f2c('0xb'));var crypto=require(_0x4f2c('0xc'));var jsforce=require(_0x4f2c('0xd'));var deskjs=require(_0x4f2c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4f2c('0xf'));var Papa=require(_0x4f2c('0x10'));var Redis=require(_0x4f2c('0x11'));var authService=require(_0x4f2c('0x12'));var qs=require(_0x4f2c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f2c('0x14'))(_0x4f2c('0x15'));var utils=require(_0x4f2c('0x16'));var config=require(_0x4f2c('0x17'));var licenseUtil=require(_0x4f2c('0x18'));var db=require(_0x4f2c('0x19'))['db'];config[_0x4f2c('0x1a')]=_[_0x4f2c('0x1b')](config[_0x4f2c('0x1a')],{'host':_0x4f2c('0x1c'),'port':0x18eb});var socket=require(_0x4f2c('0x1d'))(new Redis(config[_0x4f2c('0x1a')]));require(_0x4f2c('0x1e'))['register'](socket);function respondWithStatusCode(_0x381474,_0x131ac7){_0x131ac7=_0x131ac7||0xcc;return function(_0x1c8f5a){if(_0x1c8f5a){return _0x381474['sendStatus'](_0x131ac7);}return _0x381474[_0x4f2c('0x1f')](_0x131ac7)[_0x4f2c('0x20')]();};}function respondWithResult(_0x23be75,_0xe3856c){_0xe3856c=_0xe3856c||0xc8;return function(_0x1d2b05){if(_0x1d2b05){return _0x23be75[_0x4f2c('0x1f')](_0xe3856c)[_0x4f2c('0x21')](_0x1d2b05);}};}function respondWithFilteredResult(_0x362c82,_0x426dd2){return function(_0x5e2aa8){if(_0x5e2aa8){var _0x1b07d9=typeof _0x426dd2[_0x4f2c('0x22')]===_0x4f2c('0x23')&&typeof _0x426dd2[_0x4f2c('0x24')]===_0x4f2c('0x23');var _0x2eb9ae=_0x5e2aa8['count'];var _0x3fe378=_0x1b07d9?0x0:_0x426dd2[_0x4f2c('0x22')];var _0xb85d05=_0x1b07d9?_0x5e2aa8[_0x4f2c('0x25')]:_0x426dd2['offset']+_0x426dd2[_0x4f2c('0x24')];var _0x2803f8;if(_0xb85d05>=_0x2eb9ae){_0xb85d05=_0x2eb9ae;_0x2803f8=0xc8;}else{_0x2803f8=0xce;}_0x362c82[_0x4f2c('0x1f')](_0x2803f8);return _0x362c82[_0x4f2c('0x26')](_0x4f2c('0x27'),_0x3fe378+'-'+_0xb85d05+'/'+_0x2eb9ae)[_0x4f2c('0x21')](_0x5e2aa8);}return null;};}function patchUpdates(_0x545369){return function(_0x448656){try{jsonpatch[_0x4f2c('0x28')](_0x448656,_0x545369,!![]);}catch(_0x44cfab){return BPromise[_0x4f2c('0x29')](_0x44cfab);}return _0x448656['save']();};}function saveUpdates(_0x4f2584,_0x50c04b){return function(_0x5e79ad){if(_0x5e79ad){return _0x5e79ad[_0x4f2c('0x2a')](_0x4f2584)[_0x4f2c('0x2b')](function(_0xb9fc0f){return _0xb9fc0f;});}return null;};}function removeEntity(_0x3e9133,_0x50b495){return function(_0x19c45e){if(_0x19c45e){return _0x19c45e[_0x4f2c('0x2c')]()['then'](function(){_0x3e9133[_0x4f2c('0x1f')](0xcc)[_0x4f2c('0x20')]();});}};}function handleEntityNotFound(_0x4b52a3,_0x47f28a){return function(_0xb1e52d){if(!_0xb1e52d){_0x4b52a3[_0x4f2c('0x2d')](0x194);}return _0xb1e52d;};}function handleError(_0x262e59,_0x373c9d){_0x373c9d=_0x373c9d||0x1f4;return function(_0x14f4b9){logger[_0x4f2c('0x2e')](_0x14f4b9['stack']);if(_0x14f4b9[_0x4f2c('0x2f')]){delete _0x14f4b9['name'];}_0x262e59[_0x4f2c('0x1f')](_0x373c9d)[_0x4f2c('0x30')](_0x14f4b9);};}exports[_0x4f2c('0x31')]=function(_0x55e575,_0x214af8){var _0x3ad857={},_0x2e8b13={},_0x4c80e7={'count':0x0,'rows':[]};var _0xab25b0=_[_0x4f2c('0x32')](db[_0x4f2c('0x33')][_0x4f2c('0x34')],function(_0x16bec9){return{'name':_0x16bec9[_0x4f2c('0x35')],'type':_0x16bec9[_0x4f2c('0x36')][_0x4f2c('0x37')]};});_0x2e8b13[_0x4f2c('0x38')]=_[_0x4f2c('0x32')](_0xab25b0,_0x4f2c('0x2f'));_0x2e8b13[_0x4f2c('0x39')]=_[_0x4f2c('0x3a')](_0x55e575[_0x4f2c('0x39')]);_0x2e8b13['filters']=_[_0x4f2c('0x3b')](_0x2e8b13[_0x4f2c('0x38')],_0x2e8b13[_0x4f2c('0x39')]);_0x3ad857[_0x4f2c('0x3c')]=_[_0x4f2c('0x3b')](_0x2e8b13[_0x4f2c('0x38')],qs[_0x4f2c('0x3d')](_0x55e575[_0x4f2c('0x39')][_0x4f2c('0x3d')]));_0x3ad857[_0x4f2c('0x3c')]=_0x3ad857[_0x4f2c('0x3c')]['length']?_0x3ad857[_0x4f2c('0x3c')]:_0x2e8b13[_0x4f2c('0x38')];if(!_0x55e575[_0x4f2c('0x39')]['hasOwnProperty']('nolimit')){_0x3ad857[_0x4f2c('0x24')]=qs[_0x4f2c('0x24')](_0x55e575[_0x4f2c('0x39')][_0x4f2c('0x24')]);_0x3ad857[_0x4f2c('0x22')]=qs[_0x4f2c('0x22')](_0x55e575[_0x4f2c('0x39')][_0x4f2c('0x22')]);}_0x3ad857['order']=qs[_0x4f2c('0x3e')](_0x55e575[_0x4f2c('0x39')][_0x4f2c('0x3e')]);_0x3ad857[_0x4f2c('0x3f')]=qs[_0x4f2c('0x40')](_[_0x4f2c('0x41')](_0x55e575[_0x4f2c('0x39')],_0x2e8b13[_0x4f2c('0x40')]),_0xab25b0);if(_0x55e575[_0x4f2c('0x39')][_0x4f2c('0x42')]){_0x3ad857[_0x4f2c('0x3f')]=_[_0x4f2c('0x43')](_0x3ad857[_0x4f2c('0x3f')],{'$or':_[_0x4f2c('0x32')](_0xab25b0,function(_0x5801a8){if(_0x5801a8['type']!=='VIRTUAL'){var _0x314cf7={};_0x314cf7[_0x5801a8[_0x4f2c('0x2f')]]={'$like':'%'+_0x55e575[_0x4f2c('0x39')][_0x4f2c('0x42')]+'%'};return _0x314cf7;}})});}_0x3ad857=_[_0x4f2c('0x43')]({},_0x3ad857,_0x55e575['options']);var _0x151ebc={'where':_0x3ad857[_0x4f2c('0x3f')]};return db['ChatInternalMessage']['count'](_0x151ebc)[_0x4f2c('0x2b')](function(_0x2a1c76){_0x4c80e7[_0x4f2c('0x25')]=_0x2a1c76;if(_0x55e575[_0x4f2c('0x39')][_0x4f2c('0x44')]){_0x3ad857[_0x4f2c('0x45')]=[{'all':!![]}];}return db[_0x4f2c('0x33')][_0x4f2c('0x46')](_0x3ad857);})['then'](function(_0x50d883){_0x4c80e7['rows']=_0x50d883;return _0x4c80e7;})[_0x4f2c('0x2b')](respondWithFilteredResult(_0x214af8,_0x3ad857))[_0x4f2c('0x47')](handleError(_0x214af8,null));};exports[_0x4f2c('0x48')]=function(_0x5252b5,_0x2c8dd2){var _0x2b5948={'raw':!![],'where':{'id':_0x5252b5[_0x4f2c('0x49')]['id']}},_0x1aa53c={};_0x1aa53c[_0x4f2c('0x38')]=_[_0x4f2c('0x3a')](db[_0x4f2c('0x33')]['rawAttributes']);_0x1aa53c[_0x4f2c('0x39')]=_[_0x4f2c('0x3a')](_0x5252b5['query']);_0x1aa53c[_0x4f2c('0x40')]=_[_0x4f2c('0x3b')](_0x1aa53c[_0x4f2c('0x38')],_0x1aa53c[_0x4f2c('0x39')]);_0x2b5948[_0x4f2c('0x3c')]=_['intersection'](_0x1aa53c[_0x4f2c('0x38')],qs[_0x4f2c('0x3d')](_0x5252b5[_0x4f2c('0x39')][_0x4f2c('0x3d')]));_0x2b5948['attributes']=_0x2b5948[_0x4f2c('0x3c')][_0x4f2c('0x4a')]?_0x2b5948['attributes']:_0x1aa53c['model'];if(_0x5252b5[_0x4f2c('0x39')][_0x4f2c('0x44')]){_0x2b5948[_0x4f2c('0x45')]=[{'all':!![]}];}_0x2b5948=_[_0x4f2c('0x43')]({},_0x2b5948,_0x5252b5['options']);return db[_0x4f2c('0x33')][_0x4f2c('0x4b')](_0x2b5948)[_0x4f2c('0x2b')](handleEntityNotFound(_0x2c8dd2,null))[_0x4f2c('0x2b')](respondWithResult(_0x2c8dd2,null))['catch'](handleError(_0x2c8dd2,null));};exports[_0x4f2c('0x4c')]=function(_0x488367,_0x3ce5a1){return db['ChatInternalMessage'][_0x4f2c('0x4c')](_0x488367['body'],{})['then'](respondWithResult(_0x3ce5a1,0xc9))[_0x4f2c('0x47')](handleError(_0x3ce5a1,null));};exports[_0x4f2c('0x2a')]=function(_0x5e6ebf,_0x54c049){if(_0x5e6ebf[_0x4f2c('0x4d')]['id']){delete _0x5e6ebf['body']['id'];}return db[_0x4f2c('0x33')][_0x4f2c('0x4b')]({'where':{'id':_0x5e6ebf[_0x4f2c('0x49')]['id']}})['then'](handleEntityNotFound(_0x54c049,null))[_0x4f2c('0x2b')](saveUpdates(_0x5e6ebf[_0x4f2c('0x4d')],null))['then'](respondWithResult(_0x54c049,null))[_0x4f2c('0x47')](handleError(_0x54c049,null));};exports['destroy']=function(_0x1aa3bb,_0x51fcd4){return db[_0x4f2c('0x33')][_0x4f2c('0x4b')]({'where':{'id':_0x1aa3bb['params']['id']}})['then'](handleEntityNotFound(_0x51fcd4,null))[_0x4f2c('0x2b')](removeEntity(_0x51fcd4,null))['catch'](handleError(_0x51fcd4,null));};exports[_0x4f2c('0x4e')]=function(_0x210c44,_0x31c69d){return db['ChatInternalMessage'][_0x4f2c('0x4e')]()[_0x4f2c('0x2b')](respondWithResult(_0x31c69d,null))['catch'](handleError(_0x31c69d,null));};function wrapUser(_0x15d3e6){return function(_0x3c7724){var _0x166a24=_0x15d3e6[_0x4f2c('0x4f')]({'plain':!![]});_0x166a24['messages']=[];if(_0x3c7724){_0x166a24[_0x4f2c('0x50')]=_0x3c7724[_0x4f2c('0x51')];_0x166a24['lastMessage']=_0x3c7724;}else{_0x166a24[_0x4f2c('0x50')]=moment(0x0)[_0x4f2c('0x52')](_0x4f2c('0x53'));_0x166a24['lastMessage']={};}return _0x166a24;};}exports[_0x4f2c('0x54')]=function(_0x20eb1a,_0x181a05,_0x4cac25){var _0x510fcd=[];return db[_0x4f2c('0x55')][_0x4f2c('0x46')]({'where':{'role':[_0x4f2c('0x56'),_0x4f2c('0x57'),_0x4f2c('0x58')]},'attributes':['id',_0x4f2c('0x59'),_0x4f2c('0x2f'),_0x4f2c('0x5a'),_0x4f2c('0x5b'),_0x4f2c('0x5c'),'online',_0x4f2c('0x5d'),_0x4f2c('0x5e'),'showWebBar'],'order':qs['sort']('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x4f2c('0x5f'),'attributes':['id',_0x4f2c('0x2f'),_0x4f2c('0x36')],'through':{'attributes':[]}}]})['then'](function(_0x29e849){if(_0x29e849){var _0x1193ac=_0x20eb1a[_0x4f2c('0x58')][_0x4f2c('0x4f')]({'plain':!![]});if(!_0x1193ac)throw new Error(_0x4f2c('0x60'));if(_0x1193ac[_0x4f2c('0x5a')]===_0x4f2c('0x58')){return db[_0x4f2c('0x61')][_0x4f2c('0x4b')]({'where':{'name':_0x4f2c('0x62'),'userProfileId':_0x1193ac['userProfileId']},'raw':!![]})[_0x4f2c('0x2b')](function(_0x13507f){if(_0x13507f){if(_0x13507f[_0x4f2c('0x63')]===0x0){return db[_0x4f2c('0x64')][_0x4f2c('0x46')]({'where':{'sectionId':_0x13507f['id']},'raw':!![]})[_0x4f2c('0x2b')](function(_0x1a0d3d){var _0x24fe2d=[];if(_[_0x4f2c('0x65')](_0x1a0d3d)){_0x24fe2d=_[_0x4f2c('0x42')](_0x29e849,function(_0x39229b){if(_0x39229b[_0x4f2c('0x5a')]!==_0x4f2c('0x56')){return _0x39229b;}});return _0x24fe2d;}else{for(var _0x165963=0x0;_0x165963<_0x29e849[_0x4f2c('0x4a')];_0x165963++){var _0x4d2037=_0x29e849[_0x165963];if(_0x4d2037[_0x4f2c('0x5a')]==='agent'){var _0x22a579=_[_0x4f2c('0x4b')](_0x1a0d3d,function(_0x30f6bb){return _0x30f6bb[_0x4f2c('0x66')]===_0x4d2037['id'];});if(_0x22a579)_0x24fe2d['push'](_0x4d2037);}else{_0x24fe2d[_0x4f2c('0x67')](_0x4d2037);}}return _0x24fe2d;}});}else{return _0x29e849;}}else{var _0x326691=_[_0x4f2c('0x42')](_0x29e849,function(_0x568ced){if(_0x568ced[_0x4f2c('0x5a')]!==_0x4f2c('0x56')){return _0x568ced;}});return _0x326691;}});}else{return _0x29e849;}}})[_0x4f2c('0x2b')](function(_0x5ee3f7){var _0x40d65d=[];if(_0x5ee3f7){_0x510fcd=_0x5ee3f7;for(var _0xb7c815=0x0;_0xb7c815<_0x5ee3f7['length'];_0xb7c815+=0x1){_0x510fcd[_0xb7c815][_0x4f2c('0x68')]=[];_0x40d65d[_0x4f2c('0x67')](db[_0x4f2c('0x33')][_0x4f2c('0x4b')]({'where':{'FromId':[_0x20eb1a[_0x4f2c('0x58')]['id'],_0x5ee3f7[_0xb7c815]['id']],'ToId':[_0x20eb1a[_0x4f2c('0x58')]['id'],_0x5ee3f7[_0xb7c815]['id']],'ChatGroupId':null},'attributes':['id',_0x4f2c('0x51'),_0x4f2c('0x69'),_0x4f2c('0x6a'),_0x4f2c('0x6b'),_0x4f2c('0x4d')],'order':qs[_0x4f2c('0x3e')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5ee3f7[_0xb7c815])));}return BPromise[_0x4f2c('0x6c')](_0x40d65d);}return[];})['then'](function(_0x4e2b16){return{'rows':_0x4e2b16,'count':_0x4e2b16[_0x4f2c('0x4a')]};})[_0x4f2c('0x2b')](respondWithResult(_0x181a05,null))['catch'](handleError(_0x181a05,null));}; \ No newline at end of file +var _0x4daa=['showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','destroy','then','sendStatus','error','name','send','map','ChatInternalMessage','key','model','query','filters','intersection','attributes','length','nolimit','sort','where','filter','merge','type','includeAll','include','findAll','catch','show','params','keys','fields','find','create','body','update','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','agent','admin','user','fullname','role','userpic','internal','online'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x4daa,0x1b6));var _0xa4da=function(_0x295e7f,_0x1a4d59){_0x295e7f=_0x295e7f-0x0;var _0xdb8b56=_0x4daa[_0x295e7f];return _0xdb8b56;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa4da('0x0'));var zipdir=require(_0xa4da('0x1'));var jsonpatch=require(_0xa4da('0x2'));var rp=require(_0xa4da('0x3'));var moment=require(_0xa4da('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa4da('0x5'));var path=require(_0xa4da('0x6'));var sox=require(_0xa4da('0x7'));var csv=require(_0xa4da('0x8'));var ejs=require(_0xa4da('0x9'));var fs=require('fs');var fs_extra=require(_0xa4da('0xa'));var _=require(_0xa4da('0xb'));var squel=require(_0xa4da('0xc'));var crypto=require('crypto');var jsforce=require(_0xa4da('0xd'));var deskjs=require(_0xa4da('0xe'));var toCsv=require(_0xa4da('0x8'));var querystring=require(_0xa4da('0xf'));var Papa=require(_0xa4da('0x10'));var Redis=require(_0xa4da('0x11'));var authService=require(_0xa4da('0x12'));var qs=require(_0xa4da('0x13'));var as=require(_0xa4da('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4da('0x15'))(_0xa4da('0x16'));var utils=require(_0xa4da('0x17'));var config=require(_0xa4da('0x18'));var licenseUtil=require(_0xa4da('0x19'));var db=require(_0xa4da('0x1a'))['db'];config['redis']=_[_0xa4da('0x1b')](config[_0xa4da('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xa4da('0x1d'))(new Redis(config[_0xa4da('0x1c')]));require(_0xa4da('0x1e'))[_0xa4da('0x1f')](socket);function respondWithStatusCode(_0x21ccd1,_0x3929dd){_0x3929dd=_0x3929dd||0xcc;return function(_0x4094a0){if(_0x4094a0){return _0x21ccd1['sendStatus'](_0x3929dd);}return _0x21ccd1[_0xa4da('0x20')](_0x3929dd)['end']();};}function respondWithResult(_0x212c6c,_0x14c8b9){_0x14c8b9=_0x14c8b9||0xc8;return function(_0x44ffeb){if(_0x44ffeb){return _0x212c6c[_0xa4da('0x20')](_0x14c8b9)[_0xa4da('0x21')](_0x44ffeb);}};}function respondWithFilteredResult(_0x4541d8,_0x24f322){return function(_0x5c9d8f){if(_0x5c9d8f){var _0x19ef99=typeof _0x24f322['offset']===_0xa4da('0x22')&&typeof _0x24f322['limit']===_0xa4da('0x22');var _0x230543=_0x5c9d8f[_0xa4da('0x23')];var _0x5f3e5b=_0x19ef99?0x0:_0x24f322[_0xa4da('0x24')];var _0x5be1f5=_0x19ef99?_0x5c9d8f[_0xa4da('0x23')]:_0x24f322[_0xa4da('0x24')]+_0x24f322[_0xa4da('0x25')];var _0x29b83c;if(_0x5be1f5>=_0x230543){_0x5be1f5=_0x230543;_0x29b83c=0xc8;}else{_0x29b83c=0xce;}_0x4541d8[_0xa4da('0x20')](_0x29b83c);return _0x4541d8['set'](_0xa4da('0x26'),_0x5f3e5b+'-'+_0x5be1f5+'/'+_0x230543)[_0xa4da('0x21')](_0x5c9d8f);}return null;};}function patchUpdates(_0x583616){return function(_0x34a6ea){try{jsonpatch[_0xa4da('0x27')](_0x34a6ea,_0x583616,!![]);}catch(_0x3a544d){return BPromise[_0xa4da('0x28')](_0x3a544d);}return _0x34a6ea[_0xa4da('0x29')]();};}function saveUpdates(_0x48bfd2,_0x297af2){return function(_0x2a46c1){if(_0x2a46c1){return _0x2a46c1['update'](_0x48bfd2)['then'](function(_0x1d9757){return _0x1d9757;});}return null;};}function removeEntity(_0x378069,_0x442b1f){return function(_0x5133ad){if(_0x5133ad){return _0x5133ad[_0xa4da('0x2a')]()[_0xa4da('0x2b')](function(){_0x378069['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x103083,_0x52ab8b){return function(_0x28e4bd){if(!_0x28e4bd){_0x103083[_0xa4da('0x2c')](0x194);}return _0x28e4bd;};}function handleError(_0x4f095f,_0x2636fd){_0x2636fd=_0x2636fd||0x1f4;return function(_0x2477cb){logger[_0xa4da('0x2d')](_0x2477cb['stack']);if(_0x2477cb['name']){delete _0x2477cb[_0xa4da('0x2e')];}_0x4f095f[_0xa4da('0x20')](_0x2636fd)[_0xa4da('0x2f')](_0x2477cb);};}exports['index']=function(_0x3e60de,_0x558024){var _0x2cb1a2={},_0x15c1c6={},_0x191c84={'count':0x0,'rows':[]};var _0x2f2153=_[_0xa4da('0x30')](db[_0xa4da('0x31')]['rawAttributes'],function(_0x3daf65){return{'name':_0x3daf65['fieldName'],'type':_0x3daf65['type'][_0xa4da('0x32')]};});_0x15c1c6[_0xa4da('0x33')]=_[_0xa4da('0x30')](_0x2f2153,'name');_0x15c1c6[_0xa4da('0x34')]=_['keys'](_0x3e60de[_0xa4da('0x34')]);_0x15c1c6[_0xa4da('0x35')]=_[_0xa4da('0x36')](_0x15c1c6[_0xa4da('0x33')],_0x15c1c6[_0xa4da('0x34')]);_0x2cb1a2[_0xa4da('0x37')]=_['intersection'](_0x15c1c6['model'],qs['fields'](_0x3e60de['query']['fields']));_0x2cb1a2[_0xa4da('0x37')]=_0x2cb1a2[_0xa4da('0x37')][_0xa4da('0x38')]?_0x2cb1a2[_0xa4da('0x37')]:_0x15c1c6[_0xa4da('0x33')];if(!_0x3e60de[_0xa4da('0x34')]['hasOwnProperty'](_0xa4da('0x39'))){_0x2cb1a2[_0xa4da('0x25')]=qs[_0xa4da('0x25')](_0x3e60de[_0xa4da('0x34')]['limit']);_0x2cb1a2[_0xa4da('0x24')]=qs[_0xa4da('0x24')](_0x3e60de[_0xa4da('0x34')][_0xa4da('0x24')]);}_0x2cb1a2['order']=qs[_0xa4da('0x3a')](_0x3e60de[_0xa4da('0x34')][_0xa4da('0x3a')]);_0x2cb1a2[_0xa4da('0x3b')]=qs['filters'](_['pick'](_0x3e60de[_0xa4da('0x34')],_0x15c1c6[_0xa4da('0x35')]),_0x2f2153);if(_0x3e60de[_0xa4da('0x34')][_0xa4da('0x3c')]){_0x2cb1a2['where']=_[_0xa4da('0x3d')](_0x2cb1a2[_0xa4da('0x3b')],{'$or':_[_0xa4da('0x30')](_0x2f2153,function(_0x27a614){if(_0x27a614[_0xa4da('0x3e')]!=='VIRTUAL'){var _0xadc6f0={};_0xadc6f0[_0x27a614[_0xa4da('0x2e')]]={'$like':'%'+_0x3e60de[_0xa4da('0x34')]['filter']+'%'};return _0xadc6f0;}})});}_0x2cb1a2=_[_0xa4da('0x3d')]({},_0x2cb1a2,_0x3e60de['options']);var _0x306f05={'where':_0x2cb1a2[_0xa4da('0x3b')]};return db[_0xa4da('0x31')][_0xa4da('0x23')](_0x306f05)[_0xa4da('0x2b')](function(_0x24f8ca){_0x191c84[_0xa4da('0x23')]=_0x24f8ca;if(_0x3e60de[_0xa4da('0x34')][_0xa4da('0x3f')]){_0x2cb1a2[_0xa4da('0x40')]=[{'all':!![]}];}return db[_0xa4da('0x31')][_0xa4da('0x41')](_0x2cb1a2);})[_0xa4da('0x2b')](function(_0x3a8cc2){_0x191c84['rows']=_0x3a8cc2;return _0x191c84;})['then'](respondWithFilteredResult(_0x558024,_0x2cb1a2))[_0xa4da('0x42')](handleError(_0x558024,null));};exports[_0xa4da('0x43')]=function(_0xc2a3f8,_0xeb8a76){var _0x2f6655={'raw':!![],'where':{'id':_0xc2a3f8[_0xa4da('0x44')]['id']}},_0x22309d={};_0x22309d['model']=_[_0xa4da('0x45')](db[_0xa4da('0x31')]['rawAttributes']);_0x22309d[_0xa4da('0x34')]=_[_0xa4da('0x45')](_0xc2a3f8[_0xa4da('0x34')]);_0x22309d['filters']=_[_0xa4da('0x36')](_0x22309d['model'],_0x22309d[_0xa4da('0x34')]);_0x2f6655[_0xa4da('0x37')]=_[_0xa4da('0x36')](_0x22309d[_0xa4da('0x33')],qs[_0xa4da('0x46')](_0xc2a3f8[_0xa4da('0x34')]['fields']));_0x2f6655['attributes']=_0x2f6655[_0xa4da('0x37')]['length']?_0x2f6655[_0xa4da('0x37')]:_0x22309d[_0xa4da('0x33')];if(_0xc2a3f8[_0xa4da('0x34')][_0xa4da('0x3f')]){_0x2f6655[_0xa4da('0x40')]=[{'all':!![]}];}_0x2f6655=_[_0xa4da('0x3d')]({},_0x2f6655,_0xc2a3f8['options']);return db[_0xa4da('0x31')][_0xa4da('0x47')](_0x2f6655)[_0xa4da('0x2b')](handleEntityNotFound(_0xeb8a76,null))[_0xa4da('0x2b')](respondWithResult(_0xeb8a76,null))[_0xa4da('0x42')](handleError(_0xeb8a76,null));};exports[_0xa4da('0x48')]=function(_0x1d3004,_0x2c0948){return db[_0xa4da('0x31')][_0xa4da('0x48')](_0x1d3004[_0xa4da('0x49')],{})[_0xa4da('0x2b')](respondWithResult(_0x2c0948,0xc9))[_0xa4da('0x42')](handleError(_0x2c0948,null));};exports[_0xa4da('0x4a')]=function(_0x53abdf,_0x442ff2){if(_0x53abdf[_0xa4da('0x49')]['id']){delete _0x53abdf[_0xa4da('0x49')]['id'];}return db[_0xa4da('0x31')][_0xa4da('0x47')]({'where':{'id':_0x53abdf[_0xa4da('0x44')]['id']}})[_0xa4da('0x2b')](handleEntityNotFound(_0x442ff2,null))[_0xa4da('0x2b')](saveUpdates(_0x53abdf[_0xa4da('0x49')],null))[_0xa4da('0x2b')](respondWithResult(_0x442ff2,null))[_0xa4da('0x42')](handleError(_0x442ff2,null));};exports[_0xa4da('0x2a')]=function(_0x57f808,_0x40872b){return db[_0xa4da('0x31')][_0xa4da('0x47')]({'where':{'id':_0x57f808[_0xa4da('0x44')]['id']}})[_0xa4da('0x2b')](handleEntityNotFound(_0x40872b,null))[_0xa4da('0x2b')](removeEntity(_0x40872b,null))[_0xa4da('0x42')](handleError(_0x40872b,null));};exports[_0xa4da('0x4b')]=function(_0x205b3a,_0x5d9d35){return db[_0xa4da('0x31')][_0xa4da('0x4b')]()[_0xa4da('0x2b')](respondWithResult(_0x5d9d35,null))['catch'](handleError(_0x5d9d35,null));};function wrapUser(_0x1a3fb1){return function(_0x34a118){var _0x31468c=_0x1a3fb1[_0xa4da('0x4c')]({'plain':!![]});_0x31468c[_0xa4da('0x4d')]=[];if(_0x34a118){_0x31468c[_0xa4da('0x4e')]=_0x34a118[_0xa4da('0x4f')];_0x31468c['lastMessage']=_0x34a118;}else{_0x31468c[_0xa4da('0x4e')]=moment(0x0)[_0xa4da('0x50')](_0xa4da('0x51'));_0x31468c[_0xa4da('0x52')]={};}return _0x31468c;};}exports[_0xa4da('0x53')]=function(_0x544a3d,_0x184899,_0x2257d0){var _0x4ea71b=[];return db['User'][_0xa4da('0x41')]({'where':{'role':[_0xa4da('0x54'),_0xa4da('0x55'),_0xa4da('0x56')]},'attributes':['id',_0xa4da('0x57'),'name',_0xa4da('0x58'),_0xa4da('0x59'),_0xa4da('0x5a'),_0xa4da('0x5b'),'lastLoginAt','allowmessenger',_0xa4da('0x5c')],'order':qs['sort']('-online'),'include':[{'model':db[_0xa4da('0x5d')],'as':_0xa4da('0x5e'),'attributes':['id',_0xa4da('0x2e'),'type'],'through':{'attributes':[]}}]})[_0xa4da('0x2b')](function(_0x269be1){if(_0x269be1){var _0x46fdfc=_0x544a3d[_0xa4da('0x56')][_0xa4da('0x4c')]({'plain':!![]});if(!_0x46fdfc)throw new Error(_0xa4da('0x5f'));if(_0x46fdfc[_0xa4da('0x58')]===_0xa4da('0x56')){return db['UserProfileSection']['find']({'where':{'name':_0xa4da('0x60'),'userProfileId':_0x46fdfc['userProfileId']},'raw':!![]})[_0xa4da('0x2b')](function(_0x2286e2){if(_0x2286e2){if(_0x2286e2[_0xa4da('0x61')]===0x0){return db[_0xa4da('0x62')][_0xa4da('0x41')]({'where':{'sectionId':_0x2286e2['id']},'raw':!![]})[_0xa4da('0x2b')](function(_0x355988){var _0x359bc9=[];if(_[_0xa4da('0x63')](_0x355988)){_0x359bc9=_[_0xa4da('0x3c')](_0x269be1,function(_0x45e849){if(_0x45e849[_0xa4da('0x58')]!==_0xa4da('0x54')){return _0x45e849;}});return _0x359bc9;}else{for(var _0x4c9bda=0x0;_0x4c9bda<_0x269be1[_0xa4da('0x38')];_0x4c9bda++){var _0x44d413=_0x269be1[_0x4c9bda];if(_0x44d413[_0xa4da('0x58')]===_0xa4da('0x54')){var _0x11fe02=_[_0xa4da('0x47')](_0x355988,function(_0x42bf8d){return _0x42bf8d[_0xa4da('0x64')]===_0x44d413['id'];});if(_0x11fe02)_0x359bc9[_0xa4da('0x65')](_0x44d413);}else{_0x359bc9['push'](_0x44d413);}}return _0x359bc9;}});}else{return _0x269be1;}}else{var _0x438207=_['filter'](_0x269be1,function(_0x48d086){if(_0x48d086['role']!==_0xa4da('0x54')){return _0x48d086;}});return _0x438207;}});}else{return _0x269be1;}}})[_0xa4da('0x2b')](function(_0x109c81){var _0x5e1f41=[];if(_0x109c81){_0x4ea71b=_0x109c81;for(var _0x22df10=0x0;_0x22df10<_0x109c81['length'];_0x22df10+=0x1){_0x4ea71b[_0x22df10]['messages']=[];_0x5e1f41[_0xa4da('0x65')](db[_0xa4da('0x31')]['find']({'where':{'FromId':[_0x544a3d[_0xa4da('0x56')]['id'],_0x109c81[_0x22df10]['id']],'ToId':[_0x544a3d[_0xa4da('0x56')]['id'],_0x109c81[_0x22df10]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xa4da('0x66'),_0xa4da('0x67'),_0xa4da('0x68'),_0xa4da('0x49')],'order':qs['sort'](_0xa4da('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x109c81[_0x22df10])));}return BPromise['all'](_0x5e1f41);}return[];})['then'](function(_0x1add3e){return{'rows':_0x1add3e,'count':_0x1add3e[_0xa4da('0x38')]};})['then'](respondWithResult(_0x184899,null))[_0xa4da('0x42')](handleError(_0x184899,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 26a5af8..471bff6 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 _0x5e6c=['hasOwnProperty','hook','../../mysqldb','ChatInternalMessage','save','emit'];(function(_0x29b97,_0x34f5ee){var _0x474630=function(_0x4d8751){while(--_0x4d8751){_0x29b97['push'](_0x29b97['shift']());}};_0x474630(++_0x34f5ee);}(_0x5e6c,0x1dc));var _0xc5e6=function(_0x2316c0,_0x43333c){_0x2316c0=_0x2316c0-0x0;var _0x103441=_0x5e6c[_0x2316c0];return _0x103441;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xc5e6('0x0'))['db'][_0xc5e6('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc5e6('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5bb81d){return function(_0x3c392e,_0x107078,_0x59f827){ChatInternalMessageEvents[_0xc5e6('0x3')](_0x5bb81d+':'+_0x3c392e['id'],_0x3c392e);ChatInternalMessageEvents['emit'](_0x5bb81d,_0x3c392e);_0x59f827(null);};}for(var e in events){if(events[_0xc5e6('0x4')](e)){var event=events[e];ChatInternalMessage[_0xc5e6('0x5')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xe5f0=['exports','events','../../mysqldb','ChatInternalMessage','save','update','emit','hasOwnProperty'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xe5f0,0x69));var _0x0e5f=function(_0x1ecc8a,_0x2753e7){_0x1ecc8a=_0x1ecc8a-0x0;var _0x5bb893=_0xe5f0[_0x1ecc8a];return _0x5bb893;};'use strict';var EventEmitter=require(_0x0e5f('0x0'));var ChatInternalMessage=require(_0x0e5f('0x1'))['db'][_0x0e5f('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0e5f('0x3'),'afterUpdate':_0x0e5f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x141176){return function(_0x41a4e8,_0x3ab87b,_0xbf2587){ChatInternalMessageEvents[_0x0e5f('0x5')](_0x141176+':'+_0x41a4e8['id'],_0x41a4e8);ChatInternalMessageEvents[_0x0e5f('0x5')](_0x141176,_0x41a4e8);_0xbf2587(null);};}for(var e in events){if(events[_0x0e5f('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x0e5f('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index fed5044..c790b15 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 _0x017d=['moment','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x017d,0x1ca));var _0xd017=function(_0x5940a7,_0x4e5abb){_0x5940a7=_0x5940a7-0x0;var _0x354543=_0x017d[_0x5940a7];return _0x354543;};'use strict';var _=require(_0xd017('0x0'));var util=require(_0xd017('0x1'));var logger=require(_0xd017('0x2'))(_0xd017('0x3'));var moment=require(_0xd017('0x4'));var BPromise=require(_0xd017('0x5'));var rp=require(_0xd017('0x6'));var fs=require('fs');var path=require(_0xd017('0x7'));var rimraf=require('rimraf');var config=require(_0xd017('0x8'));var attributes=require(_0xd017('0x9'));module[_0xd017('0xa')]=function(_0x4a8026,_0x200ed2){return _0x4a8026['define']('ChatInternalMessage',attributes,{'tableName':_0xd017('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd017('0xc'),'collate':_0xd017('0xd')});}; \ No newline at end of file +var _0x58d3=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','./chatInternalMessage.attributes','exports'];(function(_0x56e3f2,_0x4c3db1){var _0x1a0106=function(_0x1e3960){while(--_0x1e3960){_0x56e3f2['push'](_0x56e3f2['shift']());}};_0x1a0106(++_0x4c3db1);}(_0x58d3,0x92));var _0x358d=function(_0x1fa4ae,_0xb27861){_0x1fa4ae=_0x1fa4ae-0x0;var _0x40e58a=_0x58d3[_0x1fa4ae];return _0x40e58a;};'use strict';var _=require(_0x358d('0x0'));var util=require(_0x358d('0x1'));var logger=require('../../config/logger')(_0x358d('0x2'));var moment=require(_0x358d('0x3'));var BPromise=require(_0x358d('0x4'));var rp=require(_0x358d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x358d('0x6'));module[_0x358d('0x7')]=function(_0x5aaa6b,_0x17bf79){return _0x5aaa6b['define']('ChatInternalMessage',attributes,{'tableName':_0x358d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x358d('0x9'),'collate':_0x358d('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index fddc9b2..b4ea088 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 _0x6340=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x584af4,_0x15e71f){var _0x24dc52=function(_0xe0078e){while(--_0xe0078e){_0x584af4['push'](_0x584af4['shift']());}};_0x24dc52(++_0x15e71f);}(_0x6340,0x71));var _0x0634=function(_0x8d2172,_0x30fbbc){_0x8d2172=_0x8d2172-0x0;var _0x528f62=_0x6340[_0x8d2172];return _0x528f62;};'use strict';var _=require(_0x0634('0x0'));var util=require(_0x0634('0x1'));var moment=require(_0x0634('0x2'));var BPromise=require(_0x0634('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0634('0x4'));var db=require(_0x0634('0x5'))['db'];var utils=require(_0x0634('0x6'));var logger=require(_0x0634('0x7'))('rpc');var config=require(_0x0634('0x8'));var jayson=require(_0x0634('0x9'));var client=jayson[_0x0634('0xa')][_0x0634('0xb')]({'port':0x232a});config[_0x0634('0xc')]=_[_0x0634('0xd')](config[_0x0634('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0634('0xe'))(new Redis(config['redis']));require(_0x0634('0xf'))[_0x0634('0x10')](socket);function respondWithRpcPromise(_0x463c51,_0x2c82d0,_0x3db0d2){return new BPromise(function(_0x2f6c47,_0x550ee7){return client[_0x0634('0x11')](_0x463c51,_0x3db0d2)[_0x0634('0x12')](function(_0x3175f1){logger[_0x0634('0x13')](_0x0634('0x14'),_0x2c82d0,_0x0634('0x15'));logger['debug'](_0x0634('0x16'),_0x2c82d0,'request\x20sent',JSON[_0x0634('0x17')](_0x3175f1));if(_0x3175f1[_0x0634('0x18')]){if(_0x3175f1[_0x0634('0x18')]['code']===0x1f4){logger[_0x0634('0x18')](_0x0634('0x14'),_0x2c82d0,_0x3175f1[_0x0634('0x18')][_0x0634('0x19')]);return _0x550ee7(_0x3175f1[_0x0634('0x18')]['message']);}logger[_0x0634('0x18')](_0x0634('0x14'),_0x2c82d0,_0x3175f1[_0x0634('0x18')][_0x0634('0x19')]);return _0x2f6c47(_0x3175f1[_0x0634('0x18')][_0x0634('0x19')]);}else{logger[_0x0634('0x13')](_0x0634('0x14'),_0x2c82d0,_0x0634('0x15'));_0x2f6c47(_0x3175f1[_0x0634('0x1a')][_0x0634('0x19')]);}})[_0x0634('0x1b')](function(_0x20e245){logger[_0x0634('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x2c82d0,_0x20e245);_0x550ee7(_0x20e245);});});} \ No newline at end of file +var _0xc30d=['debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x397984,_0x5cbddf){var _0x54daaa=function(_0x44fd81){while(--_0x44fd81){_0x397984['push'](_0x397984['shift']());}};_0x54daaa(++_0x5cbddf);}(_0xc30d,0x6e));var _0xdc30=function(_0x2ecd91,_0x1f21e8){_0x2ecd91=_0x2ecd91-0x0;var _0x3bf737=_0xc30d[_0x2ecd91];return _0x3bf737;};'use strict';var _=require(_0xdc30('0x0'));var util=require('util');var moment=require(_0xdc30('0x1'));var BPromise=require(_0xdc30('0x2'));var rs=require(_0xdc30('0x3'));var fs=require('fs');var Redis=require(_0xdc30('0x4'));var db=require(_0xdc30('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc30('0x6'))('rpc');var config=require(_0xdc30('0x7'));var jayson=require(_0xdc30('0x8'));var client=jayson[_0xdc30('0x9')][_0xdc30('0xa')]({'port':0x232a});config[_0xdc30('0xb')]=_[_0xdc30('0xc')](config['redis'],{'host':_0xdc30('0xd'),'port':0x18eb});var socket=require(_0xdc30('0xe'))(new Redis(config[_0xdc30('0xb')]));require(_0xdc30('0xf'))[_0xdc30('0x10')](socket);function respondWithRpcPromise(_0x65f596,_0x38b6fc,_0x165fb2){return new BPromise(function(_0x2c4fe1,_0x593143){return client['request'](_0x65f596,_0x165fb2)['then'](function(_0x110f58){logger[_0xdc30('0x11')](_0xdc30('0x12'),_0x38b6fc,_0xdc30('0x13'));logger[_0xdc30('0x14')](_0xdc30('0x15'),_0x38b6fc,_0xdc30('0x13'),JSON['stringify'](_0x110f58));if(_0x110f58[_0xdc30('0x16')]){if(_0x110f58[_0xdc30('0x16')][_0xdc30('0x17')]===0x1f4){logger[_0xdc30('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x38b6fc,_0x110f58[_0xdc30('0x16')][_0xdc30('0x18')]);return _0x593143(_0x110f58[_0xdc30('0x16')]['message']);}logger[_0xdc30('0x16')](_0xdc30('0x12'),_0x38b6fc,_0x110f58[_0xdc30('0x16')][_0xdc30('0x18')]);return _0x2c4fe1(_0x110f58[_0xdc30('0x16')][_0xdc30('0x18')]);}else{logger[_0xdc30('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x38b6fc,_0xdc30('0x13'));_0x2c4fe1(_0x110f58[_0xdc30('0x19')]['message']);}})['catch'](function(_0x3d984e){logger[_0xdc30('0x16')](_0xdc30('0x12'),_0x38b6fc,_0x3d984e);_0x593143(_0x3d984e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 06060aa..e4185b0 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 _0x2306=['chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener','length'];(function(_0x589cdf,_0x53f463){var _0x5f0774=function(_0x530589){while(--_0x530589){_0x589cdf['push'](_0x589cdf['shift']());}};_0x5f0774(++_0x53f463);}(_0x2306,0x1f1));var _0x6230=function(_0x3d0f99,_0x52c4bf){_0x3d0f99=_0x3d0f99-0x0;var _0x274bd2=_0x2306[_0x3d0f99];return _0x274bd2;};'use strict';var ChatInternalMessageEvents=require(_0x6230('0x0'));var events=[_0x6230('0x1'),_0x6230('0x2'),_0x6230('0x3')];function createListener(_0x4750e7,_0x54aca6){return function(_0x2b61eb){_0x54aca6[_0x6230('0x4')](_0x4750e7,_0x2b61eb);};}function removeListener(_0x16d1a9,_0x30d3ec){return function(){ChatInternalMessageEvents[_0x6230('0x5')](_0x16d1a9,_0x30d3ec);};}exports['register']=function(_0x4a5164){for(var _0x55e65e=0x0,_0x2b5e2d=events[_0x6230('0x6')];_0x55e65e<_0x2b5e2d;_0x55e65e++){var _0x61bde6=events[_0x55e65e];var _0x2fd06b=createListener(_0x6230('0x7')+_0x61bde6,_0x4a5164);ChatInternalMessageEvents['on'](_0x61bde6,_0x2fd06b);}}; \ No newline at end of file +var _0x8b61=['remove','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x8b61,0xed));var _0x18b6=function(_0x5f4ef9,_0x2a82c1){_0x5f4ef9=_0x5f4ef9-0x0;var _0x4728cc=_0x8b61[_0x5f4ef9];return _0x4728cc;};'use strict';var ChatInternalMessageEvents=require(_0x18b6('0x0'));var events=['save',_0x18b6('0x1'),'update'];function createListener(_0x36e0cb,_0x51fd91){return function(_0x2997cc){_0x51fd91[_0x18b6('0x2')](_0x36e0cb,_0x2997cc);};}function removeListener(_0x46e210,_0x58a971){return function(){ChatInternalMessageEvents[_0x18b6('0x3')](_0x46e210,_0x58a971);};}exports[_0x18b6('0x4')]=function(_0x26112b){for(var _0x13a20=0x0,_0x18588b=events[_0x18b6('0x5')];_0x13a20<_0x18588b;_0x13a20++){var _0x135abb=events[_0x13a20];var _0x241be7=createListener(_0x18b6('0x6')+_0x135abb,_0x26112b);ChatInternalMessageEvents['on'](_0x135abb,_0x241be7);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4db4028..9d5d685 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 _0xcc3c=['index','isAuthenticated','describe','/users','getUsers','show','put','/:id','update','delete','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x1ad53c,_0x13ebf8){var _0x33afe4=function(_0x2fa995){while(--_0x2fa995){_0x1ad53c['push'](_0x1ad53c['shift']());}};_0x33afe4(++_0x13ebf8);}(_0xcc3c,0xd2));var _0xccc3=function(_0x4fefdd,_0x2453f0){_0x4fefdd=_0x4fefdd-0x0;var _0x6df87=_0xcc3c[_0x4fefdd];return _0x6df87;};'use strict';var multer=require(_0xccc3('0x0'));var util=require('util');var path=require(_0xccc3('0x1'));var timeout=require('connect-timeout');var express=require(_0xccc3('0x2'));var router=express[_0xccc3('0x3')]();var fs_extra=require(_0xccc3('0x4'));var auth=require(_0xccc3('0x5'));var interaction=require(_0xccc3('0x6'));var config=require(_0xccc3('0x7'));var controller=require(_0xccc3('0x8'));router[_0xccc3('0x9')]('/',auth['isAuthenticated'](),controller[_0xccc3('0xa')]);router['get']('/describe',auth[_0xccc3('0xb')](),controller[_0xccc3('0xc')]);router[_0xccc3('0x9')](_0xccc3('0xd'),auth[_0xccc3('0xb')](),controller[_0xccc3('0xe')]);router[_0xccc3('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xccc3('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xccc3('0x10')](_0xccc3('0x11'),controller[_0xccc3('0x12')]);router[_0xccc3('0x13')](_0xccc3('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf4ab=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','describe','/users','getUsers','isAuthenticated','post','put','/:id'];(function(_0x102adc,_0xe36885){var _0x4198cd=function(_0x4f7021){while(--_0x4f7021){_0x102adc['push'](_0x102adc['shift']());}};_0x4198cd(++_0xe36885);}(_0xf4ab,0x1b7));var _0xbf4a=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0xf4ab[_0x245afe];return _0x4eefde;};'use strict';var multer=require(_0xbf4a('0x0'));var util=require(_0xbf4a('0x1'));var path=require(_0xbf4a('0x2'));var timeout=require(_0xbf4a('0x3'));var express=require(_0xbf4a('0x4'));var router=express[_0xbf4a('0x5')]();var fs_extra=require(_0xbf4a('0x6'));var auth=require(_0xbf4a('0x7'));var interaction=require(_0xbf4a('0x8'));var config=require(_0xbf4a('0x9'));var controller=require(_0xbf4a('0xa'));router[_0xbf4a('0xb')]('/',auth['isAuthenticated'](),controller[_0xbf4a('0xc')]);router[_0xbf4a('0xb')](_0xbf4a('0xd'),auth['isAuthenticated'](),controller[_0xbf4a('0xe')]);router[_0xbf4a('0xb')](_0xbf4a('0xf'),auth['isAuthenticated'](),controller[_0xbf4a('0x10')]);router[_0xbf4a('0xb')]('/:id',auth[_0xbf4a('0x11')](),controller['show']);router[_0xbf4a('0x12')]('/',auth[_0xbf4a('0x11')](),controller['create']);router[_0xbf4a('0x13')]('/:id',controller['update']);router['delete'](_0xbf4a('0x14'),auth[_0xbf4a('0x11')](),controller[_0xbf4a('0x15')]);module[_0xbf4a('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 74954d4..13a4b93 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 _0x1707=['BOOLEAN','out','DATE','STRING','TEXT','sequelize'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x1707,0x1df));var _0x7170=function(_0x10e422,_0x520f27){_0x10e422=_0x10e422-0x0;var _0x2ece15=_0x1707[_0x10e422];return _0x2ece15;};'use strict';var Sequelize=require(_0x7170('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7170('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7170('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7170('0x2')),'defaultValue':_0x7170('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7170('0x3')]},'providerName':{'type':Sequelize[_0x7170('0x4')]},'providerResponse':{'type':Sequelize[_0x7170('0x5')]}}; \ No newline at end of file +var _0x585e=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x5cf272,_0x5ef6b4){var _0x479246=function(_0x1fb87c){while(--_0x1fb87c){_0x5cf272['push'](_0x5cf272['shift']());}};_0x479246(++_0x5ef6b4);}(_0x585e,0x1c2));var _0xe585=function(_0x1b4c7b,_0x141bbf){_0x1b4c7b=_0x1b4c7b-0x0;var _0x45f19b=_0x585e[_0x1b4c7b];return _0x45f19b;};'use strict';var Sequelize=require(_0xe585('0x0'));module[_0xe585('0x1')]={'body':{'type':Sequelize[_0xe585('0x2')](_0xe585('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe585('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe585('0x5')),'defaultValue':_0xe585('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xe585('0x6')]},'providerResponse':{'type':Sequelize[_0xe585('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 644cd88..0ba0c0d 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 _0x3d34=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','then','destroy','stack','name','send','map','ChatMessage','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','includeAll','include','rows','show','params','merge','find','create','body','chat-interactions','accept','chat','UserId','user','agent','get','ChatInteraction','ChatInteractionId','update','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','internal','SIP/%s','rejectmessage','parse','formData','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse'];(function(_0x14a02d,_0x240b37){var _0x5abc59=function(_0x2b0b35){while(--_0x2b0b35){_0x14a02d['push'](_0x14a02d['shift']());}};_0x5abc59(++_0x240b37);}(_0x3d34,0xfd));var _0x43d3=function(_0x35b07d,_0x3d0ae7){_0x35b07d=_0x35b07d-0x0;var _0x2868bc=_0x3d34[_0x35b07d];return _0x2868bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x43d3('0x0'));var zipdir=require(_0x43d3('0x1'));var jsonpatch=require(_0x43d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43d3('0x3'));var Mustache=require(_0x43d3('0x4'));var util=require(_0x43d3('0x5'));var path=require(_0x43d3('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43d3('0x7'));var _=require(_0x43d3('0x8'));var squel=require(_0x43d3('0x9'));var crypto=require(_0x43d3('0xa'));var jsforce=require(_0x43d3('0xb'));var deskjs=require(_0x43d3('0xc'));var toCsv=require(_0x43d3('0xd'));var querystring=require('querystring');var Papa=require(_0x43d3('0xe'));var Redis=require(_0x43d3('0xf'));var authService=require(_0x43d3('0x10'));var qs=require(_0x43d3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43d3('0x12'));var logger=require(_0x43d3('0x13'))('api');var utils=require(_0x43d3('0x14'));var config=require(_0x43d3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x43d3('0x16'))['db'];config[_0x43d3('0x17')]=_[_0x43d3('0x18')](config[_0x43d3('0x17')],{'host':_0x43d3('0x19'),'port':0x18eb});var socket=require(_0x43d3('0x1a'))(new Redis(config[_0x43d3('0x17')]));require('./chatMessage.socket')[_0x43d3('0x1b')](socket);var jayson=require(_0x43d3('0x1c'));var client=jayson[_0x43d3('0x1d')][_0x43d3('0x1e')]({'port':0x232c});var client9002=jayson[_0x43d3('0x1d')][_0x43d3('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x98fc3f,_0x516509,_0x4200a8,_0x50054d){return new BPromise(function(_0x2ebd63,_0x416b7f){var _0x5d3d6a=_0x50054d||client;return _0x5d3d6a[_0x43d3('0x1f')](_0x98fc3f,_0x4200a8)['then'](function(_0xb1ff47){logger[_0x43d3('0x20')]('ChatMessage,\x20%s,\x20%s',_0x516509,_0x43d3('0x21'));logger[_0x43d3('0x22')](_0x43d3('0x23'),_0x516509,_0x43d3('0x21'),JSON[_0x43d3('0x24')](_0xb1ff47));if(_0xb1ff47['error']){if(_0xb1ff47[_0x43d3('0x25')][_0x43d3('0x26')]===0x1f4){logger[_0x43d3('0x25')](_0x43d3('0x27'),_0x516509,_0xb1ff47['error'][_0x43d3('0x28')]);return _0x416b7f(_0xb1ff47[_0x43d3('0x25')]['message']);}logger[_0x43d3('0x25')](_0x43d3('0x27'),_0x516509,_0xb1ff47['error'][_0x43d3('0x28')]);return _0x2ebd63(_0xb1ff47[_0x43d3('0x25')][_0x43d3('0x28')]);}else{logger['info'](_0x43d3('0x27'),_0x516509,'request\x20sent');_0x2ebd63(_0xb1ff47[_0x43d3('0x29')]['message']);}})[_0x43d3('0x2a')](function(_0x574474){logger['error'](_0x43d3('0x27'),_0x516509,_0x574474);_0x416b7f(_0x574474);});});}function respondWithStatusCode(_0x995037,_0x488e9a){_0x488e9a=_0x488e9a||0xcc;return function(_0x2aaeb3){if(_0x2aaeb3){return _0x995037[_0x43d3('0x2b')](_0x488e9a);}return _0x995037[_0x43d3('0x2c')](_0x488e9a)[_0x43d3('0x2d')]();};}function respondWithResult(_0x5c31a6,_0x4dc8f3){_0x4dc8f3=_0x4dc8f3||0xc8;return function(_0x34d1d0){if(_0x34d1d0){return _0x5c31a6[_0x43d3('0x2c')](_0x4dc8f3)[_0x43d3('0x2e')](_0x34d1d0);}};}function respondWithFilteredResult(_0x4beb93,_0x568983){return function(_0x4b43ae){if(_0x4b43ae){var _0x358c4c=typeof _0x568983[_0x43d3('0x2f')]===_0x43d3('0x30')&&typeof _0x568983['limit']==='undefined';var _0x27a522=_0x4b43ae[_0x43d3('0x31')];var _0x31b8ca=_0x358c4c?0x0:_0x568983[_0x43d3('0x2f')];var _0x3c27fb=_0x358c4c?_0x4b43ae[_0x43d3('0x31')]:_0x568983[_0x43d3('0x2f')]+_0x568983[_0x43d3('0x32')];var _0x5e326b;if(_0x3c27fb>=_0x27a522){_0x3c27fb=_0x27a522;_0x5e326b=0xc8;}else{_0x5e326b=0xce;}_0x4beb93[_0x43d3('0x2c')](_0x5e326b);return _0x4beb93[_0x43d3('0x33')]('Content-Range',_0x31b8ca+'-'+_0x3c27fb+'/'+_0x27a522)[_0x43d3('0x2e')](_0x4b43ae);}return null;};}function patchUpdates(_0x18ac72){return function(_0x2a013d){try{jsonpatch['apply'](_0x2a013d,_0x18ac72,!![]);}catch(_0x5cc9dc){return BPromise[_0x43d3('0x34')](_0x5cc9dc);}return _0x2a013d[_0x43d3('0x35')]();};}function saveUpdates(_0x372fda,_0x599b63){return function(_0x36c1a3){if(_0x36c1a3){return _0x36c1a3['update'](_0x372fda)[_0x43d3('0x36')](function(_0x514f42){return _0x514f42;});}return null;};}function removeEntity(_0x23ef23,_0x35cff2){return function(_0x511bc3){if(_0x511bc3){return _0x511bc3[_0x43d3('0x37')]()[_0x43d3('0x36')](function(){_0x23ef23[_0x43d3('0x2c')](0xcc)[_0x43d3('0x2d')]();});}};}function handleEntityNotFound(_0x2d2cad,_0x212904){return function(_0x416cc5){if(!_0x416cc5){_0x2d2cad[_0x43d3('0x2b')](0x194);}return _0x416cc5;};}function handleError(_0x2ac5c3,_0x9a454e){_0x9a454e=_0x9a454e||0x1f4;return function(_0x23d59a){logger['error'](_0x23d59a[_0x43d3('0x38')]);if(_0x23d59a[_0x43d3('0x39')]){delete _0x23d59a[_0x43d3('0x39')];}_0x2ac5c3[_0x43d3('0x2c')](_0x9a454e)[_0x43d3('0x3a')](_0x23d59a);};}exports['index']=function(_0x497897,_0xcf473f){var _0x13aee1={},_0x125419={},_0x2a3139={'count':0x0,'rows':[]};var _0x21a546=_[_0x43d3('0x3b')](db[_0x43d3('0x3c')][_0x43d3('0x3d')],function(_0xf8d069){return{'name':_0xf8d069[_0x43d3('0x3e')],'type':_0xf8d069[_0x43d3('0x3f')][_0x43d3('0x40')]};});_0x125419['model']=_[_0x43d3('0x3b')](_0x21a546,_0x43d3('0x39'));_0x125419[_0x43d3('0x41')]=_[_0x43d3('0x42')](_0x497897[_0x43d3('0x41')]);_0x125419['filters']=_[_0x43d3('0x43')](_0x125419['model'],_0x125419['query']);_0x13aee1[_0x43d3('0x44')]=_[_0x43d3('0x43')](_0x125419[_0x43d3('0x45')],qs[_0x43d3('0x46')](_0x497897[_0x43d3('0x41')][_0x43d3('0x46')]));_0x13aee1[_0x43d3('0x44')]=_0x13aee1['attributes'][_0x43d3('0x47')]?_0x13aee1[_0x43d3('0x44')]:_0x125419[_0x43d3('0x45')];if(!_0x497897[_0x43d3('0x41')][_0x43d3('0x48')](_0x43d3('0x49'))){_0x13aee1[_0x43d3('0x32')]=qs[_0x43d3('0x32')](_0x497897[_0x43d3('0x41')][_0x43d3('0x32')]);_0x13aee1[_0x43d3('0x2f')]=qs[_0x43d3('0x2f')](_0x497897[_0x43d3('0x41')][_0x43d3('0x2f')]);}_0x13aee1[_0x43d3('0x4a')]=qs['sort'](_0x497897['query'][_0x43d3('0x4b')]);_0x13aee1[_0x43d3('0x4c')]=qs[_0x43d3('0x4d')](_['pick'](_0x497897[_0x43d3('0x41')],_0x125419[_0x43d3('0x4d')]),_0x21a546);if(_0x497897['query'][_0x43d3('0x4e')]){_0x13aee1[_0x43d3('0x4c')]=_['merge'](_0x13aee1[_0x43d3('0x4c')],{'$or':_[_0x43d3('0x3b')](_0x21a546,function(_0x508813){if(_0x508813[_0x43d3('0x3f')]!==_0x43d3('0x4f')){var _0x48a984={};_0x48a984[_0x508813['name']]={'$like':'%'+_0x497897[_0x43d3('0x41')]['filter']+'%'};return _0x48a984;}})});}_0x13aee1=_['merge']({},_0x13aee1,_0x497897[_0x43d3('0x50')]);var _0x3438c2={'where':_0x13aee1[_0x43d3('0x4c')]};return db['ChatMessage'][_0x43d3('0x31')](_0x3438c2)['then'](function(_0x4302e3){_0x2a3139[_0x43d3('0x31')]=_0x4302e3;if(_0x497897[_0x43d3('0x41')][_0x43d3('0x51')]){_0x13aee1[_0x43d3('0x52')]=[{'all':!![]}];}return db[_0x43d3('0x3c')]['findAll'](_0x13aee1);})[_0x43d3('0x36')](function(_0x3efb03){_0x2a3139[_0x43d3('0x53')]=_0x3efb03;return _0x2a3139;})['then'](respondWithFilteredResult(_0xcf473f,_0x13aee1))['catch'](handleError(_0xcf473f,null));};exports[_0x43d3('0x54')]=function(_0xd139db,_0x13d49f){var _0xb1222a={'raw':!![],'where':{'id':_0xd139db[_0x43d3('0x55')]['id']}},_0x196f36={};_0x196f36[_0x43d3('0x45')]=_['keys'](db['ChatMessage'][_0x43d3('0x3d')]);_0x196f36[_0x43d3('0x41')]=_[_0x43d3('0x42')](_0xd139db[_0x43d3('0x41')]);_0x196f36[_0x43d3('0x4d')]=_[_0x43d3('0x43')](_0x196f36['model'],_0x196f36['query']);_0xb1222a[_0x43d3('0x44')]=_[_0x43d3('0x43')](_0x196f36['model'],qs[_0x43d3('0x46')](_0xd139db[_0x43d3('0x41')][_0x43d3('0x46')]));_0xb1222a[_0x43d3('0x44')]=_0xb1222a['attributes'][_0x43d3('0x47')]?_0xb1222a[_0x43d3('0x44')]:_0x196f36[_0x43d3('0x45')];if(_0xd139db[_0x43d3('0x41')][_0x43d3('0x51')]){_0xb1222a[_0x43d3('0x52')]=[{'all':!![]}];}_0xb1222a=_[_0x43d3('0x56')]({},_0xb1222a,_0xd139db[_0x43d3('0x50')]);return db[_0x43d3('0x3c')][_0x43d3('0x57')](_0xb1222a)[_0x43d3('0x36')](handleEntityNotFound(_0x13d49f,null))['then'](respondWithResult(_0x13d49f,null))['catch'](handleError(_0x13d49f,null));};exports[_0x43d3('0x58')]=function(_0x6742d9,_0x537be5){return db[_0x43d3('0x3c')][_0x43d3('0x58')](_0x6742d9[_0x43d3('0x59')],{})['then'](respondWithResult(_0x537be5,0xc9))[_0x43d3('0x2a')](handleError(_0x537be5,null));};exports['update']=function(_0x39b37e,_0x224b8b){if(_0x39b37e[_0x43d3('0x59')]['id']){delete _0x39b37e[_0x43d3('0x59')]['id'];}return db[_0x43d3('0x3c')][_0x43d3('0x57')]({'where':{'id':_0x39b37e[_0x43d3('0x55')]['id']}})[_0x43d3('0x36')](handleEntityNotFound(_0x224b8b,null))[_0x43d3('0x36')](saveUpdates(_0x39b37e[_0x43d3('0x59')],null))[_0x43d3('0x36')](respondWithResult(_0x224b8b,null))[_0x43d3('0x2a')](handleError(_0x224b8b,null));};exports[_0x43d3('0x37')]=function(_0x365504,_0x1d75e9){return db[_0x43d3('0x3c')]['find']({'where':{'id':_0x365504[_0x43d3('0x55')]['id']}})[_0x43d3('0x36')](handleEntityNotFound(_0x1d75e9,null))[_0x43d3('0x36')](removeEntity(_0x1d75e9,null))['catch'](handleError(_0x1d75e9,null));};exports['describe']=function(_0x2afa00,_0x468895){return db['ChatMessage']['describe']()[_0x43d3('0x36')](respondWithResult(_0x468895,null))[_0x43d3('0x2a')](handleError(_0x468895,null));};var interaction_log=require('../../config/logger')(_0x43d3('0x5a'));exports[_0x43d3('0x5b')]=function(_0x12c7d0,_0x5c37a7,_0x1cc588){var _0x32dced={'agent':{},'channel':_0x43d3('0x5c')};if(_0x12c7d0[_0x43d3('0x59')]['id']){delete _0x12c7d0[_0x43d3('0x59')]['id'];}_0x12c7d0['body']['read']=!![];_0x12c7d0['body']['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x12c7d0[_0x43d3('0x59')]['UserId']=_0x12c7d0[_0x43d3('0x59')][_0x43d3('0x5d')]||_0x12c7d0[_0x43d3('0x5e')]['id'];_0x32dced[_0x43d3('0x5f')]['id']=_0x12c7d0[_0x43d3('0x59')][_0x43d3('0x5d')];return db['ChatMessage']['find']({'where':{'id':_0x12c7d0['params']['id'],'UserId':null}})[_0x43d3('0x36')](handleEntityNotFound(_0x5c37a7,null))[_0x43d3('0x36')](saveUpdates(_0x12c7d0[_0x43d3('0x59')],null))[_0x43d3('0x36')](function(_0x41e020){if(_0x41e020){_0x32dced[_0x43d3('0x28')]=_0x41e020[_0x43d3('0x60')]({'plain':!![]});return db[_0x43d3('0x61')]['find']({'where':{'id':_0x41e020[_0x43d3('0x62')]}});}return null;})[_0x43d3('0x36')](handleEntityNotFound(_0x5c37a7,null))['then'](function(_0xcdcf20){if(_0xcdcf20){return _0xcdcf20[_0x43d3('0x63')]({'UserId':_0x12c7d0[_0x43d3('0x59')][_0x43d3('0x5d')],'read1stAt':_[_0x43d3('0x64')](_0xcdcf20[_0x43d3('0x65')])?moment()[_0x43d3('0x66')](_0x43d3('0x67')):undefined});}return null;})[_0x43d3('0x36')](function(_0x29c980){if(_0x29c980){_0x32dced[_0x43d3('0x68')]=_0x29c980[_0x43d3('0x60')]({'plain':!![]});interaction_log['info'](_0x43d3('0x69'),_0x12c7d0['user']['id'],_0x12c7d0[_0x43d3('0x5e')][_0x43d3('0x39')],_0x12c7d0[_0x43d3('0x5e')][_0x43d3('0x6a')],_0x32dced['interaction']['id'],_0x12c7d0[_0x43d3('0x59')]?JSON[_0x43d3('0x24')](_0x12c7d0[_0x43d3('0x59')]):_0x43d3('0x6b'));return respondWithRpcPromise(_0x43d3('0x6c'),_0x43d3('0x6d'),_0x32dced);}return null;})[_0x43d3('0x36')](function(_0x6d7628){var _0x57620a=_0x43d3('0x6e')+_0x6d7628['message']['ContactId'];return db[_0x43d3('0x6f')][_0x43d3('0x41')](_0x57620a,{'type':db[_0x43d3('0x70')][_0x43d3('0x71')][_0x43d3('0x72')],'raw':!![]})[_0x43d3('0x36')](function(_0x18f034){return _0x18f034;});})['then'](function(_0x148f5c){if(_0x148f5c){_0x32dced[_0x43d3('0x28')][_0x43d3('0x73')]=_0x148f5c[0x0];if(!_0x12c7d0[_0x43d3('0x59')][_0x43d3('0x5d')])return;return db[_0x43d3('0x74')]['find']({'where':{'id':_0x12c7d0[_0x43d3('0x59')]['UserId'],'role':_0x43d3('0x5f')},'attributes':['id',_0x43d3('0x39'),_0x43d3('0x75'),_0x43d3('0x76'),'internal'],'raw':!![]});}return null;})[_0x43d3('0x36')](function(_0x289a02){if(!_0x289a02)return null;_0x32dced[_0x43d3('0x28')][_0x43d3('0x5f')]=_0x289a02;return _0x32dced;})[_0x43d3('0x36')](function(_0x35bd74){if(_0x35bd74){if(_0x12c7d0[_0x43d3('0x59')][_0x43d3('0x77')]){_0x32dced['message'][_0x43d3('0x78')]=util['format']('SIP/%s',_0x12c7d0[_0x43d3('0x5e')]['name']);_0x32dced[_0x43d3('0x28')][_0x43d3('0x79')]=_0x32dced[_0x43d3('0x79')];_0x32dced[_0x43d3('0x28')][_0x43d3('0x7a')]=_0x32dced[_0x43d3('0x79')];_0x32dced['message'][_0x43d3('0x7b')]=_0x43d3('0x5b');return respondWithRpcPromise(_0x43d3('0x7c'),'EventManager',{'event':_0x43d3('0x7d'),'message':_[_0x43d3('0x56')](_0x32dced[_0x43d3('0x28')],JSON['parse'](_0x32dced[_0x43d3('0x68')]['formData']))},client9002)[_0x43d3('0x36')](function(){return _0x32dced;});}return _0x32dced;}return null;})['then'](respondWithResult(_0x5c37a7,null))[_0x43d3('0x2a')](handleError(_0x5c37a7,null));};var interaction_log=require(_0x43d3('0x13'))(_0x43d3('0x5a'));exports['reject']=function(_0xf1cb96,_0x229ab4,_0x499efe){var _0x2e7c46={'agent':{},'channel':_0x43d3('0x5c')};if(_0xf1cb96[_0x43d3('0x59')]['id']){delete _0xf1cb96[_0x43d3('0x59')]['id'];}_0xf1cb96[_0x43d3('0x59')][_0x43d3('0x5d')]=_0xf1cb96['body']['UserId']||_0xf1cb96[_0x43d3('0x5e')]['id'];_0x2e7c46[_0x43d3('0x5f')]['id']=_0xf1cb96['body'][_0x43d3('0x5d')];return db[_0x43d3('0x3c')][_0x43d3('0x57')]({'where':{'id':_0xf1cb96['params']['id'],'UserId':null}})[_0x43d3('0x36')](handleEntityNotFound(_0x229ab4,null))[_0x43d3('0x36')](function(_0x413bb9){if(_0x413bb9){_0x2e7c46['message']=_0x413bb9[_0x43d3('0x60')]({'plain':!![]});return db[_0x43d3('0x61')][_0x43d3('0x57')]({'where':{'id':_0x413bb9[_0x43d3('0x62')]}});}return null;})[_0x43d3('0x36')](handleEntityNotFound(_0x229ab4,null))[_0x43d3('0x36')](function(_0x2fab87){if(_0x2fab87){_0x2e7c46[_0x43d3('0x68')]=_0x2fab87[_0x43d3('0x60')]({'plain':!![]});interaction_log[_0x43d3('0x20')](_0x43d3('0x7e'),_0xf1cb96[_0x43d3('0x5e')]['id'],_0xf1cb96[_0x43d3('0x5e')][_0x43d3('0x39')],_0xf1cb96[_0x43d3('0x5e')][_0x43d3('0x6a')],_0x2e7c46[_0x43d3('0x68')]['id'],_0xf1cb96[_0x43d3('0x59')]?JSON['stringify'](_0xf1cb96['body']):_0x43d3('0x6b'));return respondWithRpcPromise('RejectMessage',_0x43d3('0x7f'),_0x2e7c46);}return null;})['then'](function(_0x282306){var _0x4cb6ef=_0x43d3('0x6e')+_0x282306[_0x43d3('0x28')][_0x43d3('0x80')];return db['sequelize'][_0x43d3('0x41')](_0x4cb6ef,{'type':db['Sequelize'][_0x43d3('0x71')][_0x43d3('0x72')],'raw':!![]})[_0x43d3('0x36')](function(_0x155e33){return _0x155e33;});})[_0x43d3('0x36')](function(_0x4efe8a){if(_0x4efe8a){_0x2e7c46['message'][_0x43d3('0x73')]=_0x4efe8a[0x0];if(!_0xf1cb96['body'][_0x43d3('0x5d')])return;return db[_0x43d3('0x74')][_0x43d3('0x57')]({'where':{'id':_0xf1cb96[_0x43d3('0x59')]['UserId'],'role':_0x43d3('0x5f')},'attributes':['id',_0x43d3('0x39'),_0x43d3('0x75'),'email',_0x43d3('0x81')],'raw':!![]});}return null;})['then'](function(_0x5ef658){if(!_0x5ef658)return null;_0x2e7c46[_0x43d3('0x28')][_0x43d3('0x5f')]=_0x5ef658;return _0x2e7c46;})[_0x43d3('0x36')](function(_0x239561){if(_0x239561){_0x239561[_0x43d3('0x28')][_0x43d3('0x78')]=util['format'](_0x43d3('0x82'),_0xf1cb96['user']['name']);_0x239561[_0x43d3('0x28')][_0x43d3('0x79')]=_0x2e7c46[_0x43d3('0x79')];_0x239561[_0x43d3('0x28')]['motionChannel']=_0x2e7c46['channel'];_0x239561[_0x43d3('0x28')][_0x43d3('0x7b')]='reject';respondWithRpcPromise(_0x43d3('0x7c'),_0x43d3('0x7c'),{'event':_0x43d3('0x83'),'message':_[_0x43d3('0x56')](_0x2e7c46['message'],JSON[_0x43d3('0x84')](_0x2e7c46[_0x43d3('0x68')][_0x43d3('0x85')]))},client9002);return _0x2e7c46;}return null;})['then'](respondWithResult(_0x229ab4,null))['catch'](handleError(_0x229ab4,null));}; \ No newline at end of file +var _0xd0c4=['status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','stack','name','send','map','ChatMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','findAll','rows','show','include','find','body','params','describe','chat-interactions','accept','chat','read','readAt','format','UserId','user','agent','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','parse','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','SIP/%s','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus'];(function(_0x255d9f,_0x558dbf){var _0x435eb4=function(_0x3ca94d){while(--_0x3ca94d){_0x255d9f['push'](_0x255d9f['shift']());}};_0x435eb4(++_0x558dbf);}(_0xd0c4,0xd9));var _0x4d0c=function(_0x149bc3,_0x4b09d8){_0x149bc3=_0x149bc3-0x0;var _0x5d33eb=_0xd0c4[_0x149bc3];return _0x5d33eb;};'use strict';var emlformat=require(_0x4d0c('0x0'));var rimraf=require(_0x4d0c('0x1'));var zipdir=require(_0x4d0c('0x2'));var jsonpatch=require(_0x4d0c('0x3'));var rp=require(_0x4d0c('0x4'));var moment=require(_0x4d0c('0x5'));var BPromise=require(_0x4d0c('0x6'));var Mustache=require('mustache');var util=require(_0x4d0c('0x7'));var path=require(_0x4d0c('0x8'));var sox=require(_0x4d0c('0x9'));var csv=require(_0x4d0c('0xa'));var ejs=require(_0x4d0c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d0c('0xc'));var crypto=require(_0x4d0c('0xd'));var jsforce=require(_0x4d0c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4d0c('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4d0c('0xf'));var as=require(_0x4d0c('0x10'));var hardwareService=require(_0x4d0c('0x11'));var logger=require(_0x4d0c('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4d0c('0x13'));var licenseUtil=require(_0x4d0c('0x14'));var db=require(_0x4d0c('0x15'))['db'];config[_0x4d0c('0x16')]=_[_0x4d0c('0x17')](config[_0x4d0c('0x16')],{'host':_0x4d0c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4d0c('0x19'))[_0x4d0c('0x1a')](socket);var jayson=require(_0x4d0c('0x1b'));var client=jayson[_0x4d0c('0x1c')][_0x4d0c('0x1d')]({'port':0x232c});var client9002=jayson[_0x4d0c('0x1c')][_0x4d0c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x368d82,_0x2c656c,_0x9c952,_0x4b8eb3){return new BPromise(function(_0x1a3506,_0x27df0b){var _0x3faf01=_0x4b8eb3||client;return _0x3faf01[_0x4d0c('0x1e')](_0x368d82,_0x9c952)[_0x4d0c('0x1f')](function(_0x5aba47){logger['info']('ChatMessage,\x20%s,\x20%s',_0x2c656c,_0x4d0c('0x20'));logger[_0x4d0c('0x21')](_0x4d0c('0x22'),_0x2c656c,_0x4d0c('0x20'),JSON[_0x4d0c('0x23')](_0x5aba47));if(_0x5aba47[_0x4d0c('0x24')]){if(_0x5aba47['error']['code']===0x1f4){logger[_0x4d0c('0x24')](_0x4d0c('0x25'),_0x2c656c,_0x5aba47[_0x4d0c('0x24')][_0x4d0c('0x26')]);return _0x27df0b(_0x5aba47['error'][_0x4d0c('0x26')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x2c656c,_0x5aba47['error'][_0x4d0c('0x26')]);return _0x1a3506(_0x5aba47[_0x4d0c('0x24')][_0x4d0c('0x26')]);}else{logger[_0x4d0c('0x27')](_0x4d0c('0x25'),_0x2c656c,_0x4d0c('0x20'));_0x1a3506(_0x5aba47[_0x4d0c('0x28')][_0x4d0c('0x26')]);}})[_0x4d0c('0x29')](function(_0x1f7f35){logger['error'](_0x4d0c('0x25'),_0x2c656c,_0x1f7f35);_0x27df0b(_0x1f7f35);});});}function respondWithStatusCode(_0x1e76c9,_0x478d66){_0x478d66=_0x478d66||0xcc;return function(_0x38f86b){if(_0x38f86b){return _0x1e76c9[_0x4d0c('0x2a')](_0x478d66);}return _0x1e76c9[_0x4d0c('0x2b')](_0x478d66)[_0x4d0c('0x2c')]();};}function respondWithResult(_0x35b1ea,_0x7407f2){_0x7407f2=_0x7407f2||0xc8;return function(_0x53dd14){if(_0x53dd14){return _0x35b1ea[_0x4d0c('0x2b')](_0x7407f2)[_0x4d0c('0x2d')](_0x53dd14);}};}function respondWithFilteredResult(_0x43e0fa,_0x324186){return function(_0x13288c){if(_0x13288c){var _0xe660c=typeof _0x324186['offset']===_0x4d0c('0x2e')&&typeof _0x324186[_0x4d0c('0x2f')]==='undefined';var _0x468128=_0x13288c[_0x4d0c('0x30')];var _0x33fb28=_0xe660c?0x0:_0x324186[_0x4d0c('0x31')];var _0x2a9cd2=_0xe660c?_0x13288c[_0x4d0c('0x30')]:_0x324186[_0x4d0c('0x31')]+_0x324186['limit'];var _0x4c6619;if(_0x2a9cd2>=_0x468128){_0x2a9cd2=_0x468128;_0x4c6619=0xc8;}else{_0x4c6619=0xce;}_0x43e0fa[_0x4d0c('0x2b')](_0x4c6619);return _0x43e0fa[_0x4d0c('0x32')]('Content-Range',_0x33fb28+'-'+_0x2a9cd2+'/'+_0x468128)[_0x4d0c('0x2d')](_0x13288c);}return null;};}function patchUpdates(_0x57b569){return function(_0xaae1e6){try{jsonpatch['apply'](_0xaae1e6,_0x57b569,!![]);}catch(_0x57a8b4){return BPromise[_0x4d0c('0x33')](_0x57a8b4);}return _0xaae1e6[_0x4d0c('0x34')]();};}function saveUpdates(_0x4f6e01,_0x20f68f){return function(_0x575ea2){if(_0x575ea2){return _0x575ea2[_0x4d0c('0x35')](_0x4f6e01)['then'](function(_0x170f19){return _0x170f19;});}return null;};}function removeEntity(_0x56a080,_0x4f1515){return function(_0x3d5f29){if(_0x3d5f29){return _0x3d5f29[_0x4d0c('0x36')]()['then'](function(){_0x56a080[_0x4d0c('0x2b')](0xcc)[_0x4d0c('0x2c')]();});}};}function handleEntityNotFound(_0x14e423,_0x1cf725){return function(_0x33653e){if(!_0x33653e){_0x14e423[_0x4d0c('0x2a')](0x194);}return _0x33653e;};}function handleError(_0x37894d,_0x2d7253){_0x2d7253=_0x2d7253||0x1f4;return function(_0x4e75d8){logger[_0x4d0c('0x24')](_0x4e75d8[_0x4d0c('0x37')]);if(_0x4e75d8[_0x4d0c('0x38')]){delete _0x4e75d8['name'];}_0x37894d[_0x4d0c('0x2b')](_0x2d7253)[_0x4d0c('0x39')](_0x4e75d8);};}exports['index']=function(_0x453393,_0x592ce1){var _0x54508f={},_0x981e52={},_0x38572d={'count':0x0,'rows':[]};var _0x32c712=_[_0x4d0c('0x3a')](db[_0x4d0c('0x3b')][_0x4d0c('0x3c')],function(_0x4ad18f){return{'name':_0x4ad18f[_0x4d0c('0x3d')],'type':_0x4ad18f[_0x4d0c('0x3e')][_0x4d0c('0x3f')]};});_0x981e52['model']=_[_0x4d0c('0x3a')](_0x32c712,_0x4d0c('0x38'));_0x981e52[_0x4d0c('0x40')]=_[_0x4d0c('0x41')](_0x453393[_0x4d0c('0x40')]);_0x981e52['filters']=_[_0x4d0c('0x42')](_0x981e52[_0x4d0c('0x43')],_0x981e52['query']);_0x54508f['attributes']=_[_0x4d0c('0x42')](_0x981e52[_0x4d0c('0x43')],qs[_0x4d0c('0x44')](_0x453393[_0x4d0c('0x40')]['fields']));_0x54508f['attributes']=_0x54508f[_0x4d0c('0x45')][_0x4d0c('0x46')]?_0x54508f['attributes']:_0x981e52[_0x4d0c('0x43')];if(!_0x453393[_0x4d0c('0x40')]['hasOwnProperty'](_0x4d0c('0x47'))){_0x54508f[_0x4d0c('0x2f')]=qs[_0x4d0c('0x2f')](_0x453393['query'][_0x4d0c('0x2f')]);_0x54508f[_0x4d0c('0x31')]=qs[_0x4d0c('0x31')](_0x453393['query'][_0x4d0c('0x31')]);}_0x54508f[_0x4d0c('0x48')]=qs[_0x4d0c('0x49')](_0x453393['query'][_0x4d0c('0x49')]);_0x54508f[_0x4d0c('0x4a')]=qs['filters'](_['pick'](_0x453393[_0x4d0c('0x40')],_0x981e52[_0x4d0c('0x4b')]),_0x32c712);if(_0x453393['query'][_0x4d0c('0x4c')]){_0x54508f['where']=_['merge'](_0x54508f[_0x4d0c('0x4a')],{'$or':_[_0x4d0c('0x3a')](_0x32c712,function(_0x55ae7f){if(_0x55ae7f[_0x4d0c('0x3e')]!=='VIRTUAL'){var _0x4dce59={};_0x4dce59[_0x55ae7f[_0x4d0c('0x38')]]={'$like':'%'+_0x453393[_0x4d0c('0x40')][_0x4d0c('0x4c')]+'%'};return _0x4dce59;}})});}_0x54508f=_[_0x4d0c('0x4d')]({},_0x54508f,_0x453393[_0x4d0c('0x4e')]);var _0x5c6d68={'where':_0x54508f['where']};return db[_0x4d0c('0x3b')][_0x4d0c('0x30')](_0x5c6d68)[_0x4d0c('0x1f')](function(_0x5e2810){_0x38572d[_0x4d0c('0x30')]=_0x5e2810;if(_0x453393[_0x4d0c('0x40')][_0x4d0c('0x4f')]){_0x54508f['include']=[{'all':!![]}];}return db[_0x4d0c('0x3b')][_0x4d0c('0x50')](_0x54508f);})[_0x4d0c('0x1f')](function(_0x98c438){_0x38572d[_0x4d0c('0x51')]=_0x98c438;return _0x38572d;})['then'](respondWithFilteredResult(_0x592ce1,_0x54508f))[_0x4d0c('0x29')](handleError(_0x592ce1,null));};exports[_0x4d0c('0x52')]=function(_0x3d4dd6,_0x27fe22){var _0x3728c1={'raw':!![],'where':{'id':_0x3d4dd6['params']['id']}},_0x33e455={};_0x33e455[_0x4d0c('0x43')]=_[_0x4d0c('0x41')](db[_0x4d0c('0x3b')][_0x4d0c('0x3c')]);_0x33e455[_0x4d0c('0x40')]=_[_0x4d0c('0x41')](_0x3d4dd6['query']);_0x33e455[_0x4d0c('0x4b')]=_[_0x4d0c('0x42')](_0x33e455[_0x4d0c('0x43')],_0x33e455[_0x4d0c('0x40')]);_0x3728c1[_0x4d0c('0x45')]=_[_0x4d0c('0x42')](_0x33e455[_0x4d0c('0x43')],qs[_0x4d0c('0x44')](_0x3d4dd6[_0x4d0c('0x40')][_0x4d0c('0x44')]));_0x3728c1[_0x4d0c('0x45')]=_0x3728c1[_0x4d0c('0x45')][_0x4d0c('0x46')]?_0x3728c1['attributes']:_0x33e455[_0x4d0c('0x43')];if(_0x3d4dd6[_0x4d0c('0x40')][_0x4d0c('0x4f')]){_0x3728c1[_0x4d0c('0x53')]=[{'all':!![]}];}_0x3728c1=_[_0x4d0c('0x4d')]({},_0x3728c1,_0x3d4dd6['options']);return db['ChatMessage'][_0x4d0c('0x54')](_0x3728c1)[_0x4d0c('0x1f')](handleEntityNotFound(_0x27fe22,null))['then'](respondWithResult(_0x27fe22,null))[_0x4d0c('0x29')](handleError(_0x27fe22,null));};exports['create']=function(_0x466c09,_0x2794bc){return db[_0x4d0c('0x3b')]['create'](_0x466c09[_0x4d0c('0x55')],{})[_0x4d0c('0x1f')](respondWithResult(_0x2794bc,0xc9))[_0x4d0c('0x29')](handleError(_0x2794bc,null));};exports[_0x4d0c('0x35')]=function(_0x4885e3,_0xce0ac8){if(_0x4885e3['body']['id']){delete _0x4885e3['body']['id'];}return db['ChatMessage'][_0x4d0c('0x54')]({'where':{'id':_0x4885e3[_0x4d0c('0x56')]['id']}})[_0x4d0c('0x1f')](handleEntityNotFound(_0xce0ac8,null))[_0x4d0c('0x1f')](saveUpdates(_0x4885e3['body'],null))[_0x4d0c('0x1f')](respondWithResult(_0xce0ac8,null))[_0x4d0c('0x29')](handleError(_0xce0ac8,null));};exports[_0x4d0c('0x36')]=function(_0x5aace7,_0x416dad){return db[_0x4d0c('0x3b')][_0x4d0c('0x54')]({'where':{'id':_0x5aace7[_0x4d0c('0x56')]['id']}})[_0x4d0c('0x1f')](handleEntityNotFound(_0x416dad,null))[_0x4d0c('0x1f')](removeEntity(_0x416dad,null))[_0x4d0c('0x29')](handleError(_0x416dad,null));};exports[_0x4d0c('0x57')]=function(_0x1f9d17,_0x1f71da){return db['ChatMessage'][_0x4d0c('0x57')]()[_0x4d0c('0x1f')](respondWithResult(_0x1f71da,null))[_0x4d0c('0x29')](handleError(_0x1f71da,null));};var interaction_log=require(_0x4d0c('0x12'))(_0x4d0c('0x58'));exports[_0x4d0c('0x59')]=function(_0x329394,_0x11b88b,_0x3b67ab){var _0x304364={'agent':{},'channel':_0x4d0c('0x5a')};if(_0x329394[_0x4d0c('0x55')]['id']){delete _0x329394[_0x4d0c('0x55')]['id'];}_0x329394[_0x4d0c('0x55')][_0x4d0c('0x5b')]=!![];_0x329394[_0x4d0c('0x55')][_0x4d0c('0x5c')]=moment()[_0x4d0c('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x329394[_0x4d0c('0x55')][_0x4d0c('0x5e')]=_0x329394[_0x4d0c('0x55')][_0x4d0c('0x5e')]||_0x329394[_0x4d0c('0x5f')]['id'];_0x304364[_0x4d0c('0x60')]['id']=_0x329394[_0x4d0c('0x55')]['UserId'];return db[_0x4d0c('0x3b')][_0x4d0c('0x54')]({'where':{'id':_0x329394[_0x4d0c('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x11b88b,null))[_0x4d0c('0x1f')](saveUpdates(_0x329394[_0x4d0c('0x55')],null))[_0x4d0c('0x1f')](function(_0x3257a4){if(_0x3257a4){_0x304364[_0x4d0c('0x26')]=_0x3257a4['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x3257a4[_0x4d0c('0x61')]}});}return null;})[_0x4d0c('0x1f')](handleEntityNotFound(_0x11b88b,null))[_0x4d0c('0x1f')](function(_0x46d958){if(_0x46d958){return _0x46d958[_0x4d0c('0x35')]({'UserId':_0x329394[_0x4d0c('0x55')][_0x4d0c('0x5e')],'read1stAt':_['isNil'](_0x46d958['read1stAt'])?moment()[_0x4d0c('0x5d')](_0x4d0c('0x62')):undefined});}return null;})['then'](function(_0x494312){if(_0x494312){_0x304364['interaction']=_0x494312[_0x4d0c('0x63')]({'plain':!![]});interaction_log[_0x4d0c('0x27')](_0x4d0c('0x64'),_0x329394[_0x4d0c('0x5f')]['id'],_0x329394[_0x4d0c('0x5f')][_0x4d0c('0x38')],_0x329394[_0x4d0c('0x5f')][_0x4d0c('0x65')],_0x304364[_0x4d0c('0x66')]['id'],_0x329394[_0x4d0c('0x55')]?JSON[_0x4d0c('0x23')](_0x329394[_0x4d0c('0x55')]):_0x4d0c('0x67'));return respondWithRpcPromise(_0x4d0c('0x68'),_0x4d0c('0x69'),_0x304364);}return null;})[_0x4d0c('0x1f')](function(_0x422972){var _0x578764=_0x4d0c('0x6a')+_0x422972['message'][_0x4d0c('0x6b')];return db[_0x4d0c('0x6c')][_0x4d0c('0x40')](_0x578764,{'type':db['Sequelize'][_0x4d0c('0x6d')][_0x4d0c('0x6e')],'raw':!![]})['then'](function(_0x587dfb){return _0x587dfb;});})[_0x4d0c('0x1f')](function(_0x5d919d){if(_0x5d919d){_0x304364[_0x4d0c('0x26')][_0x4d0c('0x6f')]=_0x5d919d[0x0];if(!_0x329394[_0x4d0c('0x55')][_0x4d0c('0x5e')])return;return db[_0x4d0c('0x70')]['find']({'where':{'id':_0x329394[_0x4d0c('0x55')][_0x4d0c('0x5e')],'role':_0x4d0c('0x60')},'attributes':['id','name',_0x4d0c('0x71'),_0x4d0c('0x72'),_0x4d0c('0x73')],'raw':!![]});}return null;})[_0x4d0c('0x1f')](function(_0x434e3e){if(!_0x434e3e)return null;_0x304364[_0x4d0c('0x26')]['agent']=_0x434e3e;return _0x304364;})[_0x4d0c('0x1f')](function(_0x3dd49b){if(_0x3dd49b){if(_0x329394[_0x4d0c('0x55')][_0x4d0c('0x74')]){_0x304364[_0x4d0c('0x26')][_0x4d0c('0x75')]=util[_0x4d0c('0x5d')]('SIP/%s',_0x329394[_0x4d0c('0x5f')][_0x4d0c('0x38')]);_0x304364[_0x4d0c('0x26')][_0x4d0c('0x76')]=_0x304364[_0x4d0c('0x76')];_0x304364[_0x4d0c('0x26')][_0x4d0c('0x77')]=_0x304364[_0x4d0c('0x76')];_0x304364[_0x4d0c('0x26')]['event']=_0x4d0c('0x59');return respondWithRpcPromise(_0x4d0c('0x78'),_0x4d0c('0x78'),{'event':_0x4d0c('0x79'),'message':_[_0x4d0c('0x4d')](_0x304364[_0x4d0c('0x26')],JSON[_0x4d0c('0x7a')](_0x304364[_0x4d0c('0x66')]['formData']))},client9002)[_0x4d0c('0x1f')](function(){return _0x304364;});}return _0x304364;}return null;})[_0x4d0c('0x1f')](respondWithResult(_0x11b88b,null))[_0x4d0c('0x29')](handleError(_0x11b88b,null));};var interaction_log=require(_0x4d0c('0x12'))(_0x4d0c('0x58'));exports[_0x4d0c('0x33')]=function(_0x51f73d,_0x17b29a,_0x3f53b2){var _0x2521d4={'agent':{},'channel':_0x4d0c('0x5a')};if(_0x51f73d['body']['id']){delete _0x51f73d[_0x4d0c('0x55')]['id'];}_0x51f73d[_0x4d0c('0x55')][_0x4d0c('0x5e')]=_0x51f73d[_0x4d0c('0x55')][_0x4d0c('0x5e')]||_0x51f73d['user']['id'];_0x2521d4[_0x4d0c('0x60')]['id']=_0x51f73d['body'][_0x4d0c('0x5e')];return db[_0x4d0c('0x3b')][_0x4d0c('0x54')]({'where':{'id':_0x51f73d[_0x4d0c('0x56')]['id'],'UserId':null}})[_0x4d0c('0x1f')](handleEntityNotFound(_0x17b29a,null))['then'](function(_0x3a0539){if(_0x3a0539){_0x2521d4[_0x4d0c('0x26')]=_0x3a0539[_0x4d0c('0x63')]({'plain':!![]});return db[_0x4d0c('0x7b')]['find']({'where':{'id':_0x3a0539['ChatInteractionId']}});}return null;})[_0x4d0c('0x1f')](handleEntityNotFound(_0x17b29a,null))['then'](function(_0x7d29db){if(_0x7d29db){_0x2521d4[_0x4d0c('0x66')]=_0x7d29db[_0x4d0c('0x63')]({'plain':!![]});interaction_log['info'](_0x4d0c('0x7c'),_0x51f73d[_0x4d0c('0x5f')]['id'],_0x51f73d[_0x4d0c('0x5f')][_0x4d0c('0x38')],_0x51f73d['user'][_0x4d0c('0x65')],_0x2521d4[_0x4d0c('0x66')]['id'],_0x51f73d['body']?JSON[_0x4d0c('0x23')](_0x51f73d[_0x4d0c('0x55')]):_0x4d0c('0x67'));return respondWithRpcPromise(_0x4d0c('0x7d'),'rejectMessage',_0x2521d4);}return null;})['then'](function(_0x27c468){var _0x207f45='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x27c468[_0x4d0c('0x26')][_0x4d0c('0x6b')];return db[_0x4d0c('0x6c')][_0x4d0c('0x40')](_0x207f45,{'type':db[_0x4d0c('0x7e')][_0x4d0c('0x6d')][_0x4d0c('0x6e')],'raw':!![]})['then'](function(_0x17360c){return _0x17360c;});})[_0x4d0c('0x1f')](function(_0xe60750){if(_0xe60750){_0x2521d4[_0x4d0c('0x26')][_0x4d0c('0x6f')]=_0xe60750[0x0];if(!_0x51f73d['body'][_0x4d0c('0x5e')])return;return db[_0x4d0c('0x70')][_0x4d0c('0x54')]({'where':{'id':_0x51f73d[_0x4d0c('0x55')][_0x4d0c('0x5e')],'role':'agent'},'attributes':['id',_0x4d0c('0x38'),'fullname',_0x4d0c('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x235260){if(!_0x235260)return null;_0x2521d4[_0x4d0c('0x26')][_0x4d0c('0x60')]=_0x235260;return _0x2521d4;})[_0x4d0c('0x1f')](function(_0x508d96){if(_0x508d96){_0x508d96[_0x4d0c('0x26')]['interface']=util[_0x4d0c('0x5d')](_0x4d0c('0x7f'),_0x51f73d[_0x4d0c('0x5f')][_0x4d0c('0x38')]);_0x508d96[_0x4d0c('0x26')]['channel']=_0x2521d4[_0x4d0c('0x76')];_0x508d96['message']['motionChannel']=_0x2521d4['channel'];_0x508d96[_0x4d0c('0x26')][_0x4d0c('0x80')]=_0x4d0c('0x33');respondWithRpcPromise(_0x4d0c('0x78'),_0x4d0c('0x78'),{'event':_0x4d0c('0x81'),'message':_[_0x4d0c('0x4d')](_0x2521d4['message'],JSON[_0x4d0c('0x7a')](_0x2521d4[_0x4d0c('0x66')]['formData']))},client9002);return _0x2521d4;}return null;})[_0x4d0c('0x1f')](respondWithResult(_0x17b29a,null))[_0x4d0c('0x29')](handleError(_0x17b29a,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 8150a59..0523f06 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 _0xfcec=['emit','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x301494,_0x1934ad){var _0x2ff6c4=function(_0x3ccf95){while(--_0x3ccf95){_0x301494['push'](_0x301494['shift']());}};_0x2ff6c4(++_0x1934ad);}(_0xfcec,0x108));var _0xcfce=function(_0x4a3e45,_0x1e8ef3){_0x4a3e45=_0x4a3e45-0x0;var _0x48db76=_0xfcec[_0x4a3e45];return _0x48db76;};'use strict';var EventEmitter=require(_0xcfce('0x0'));var ChatMessage=require(_0xcfce('0x1'))['db'][_0xcfce('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xcfce('0x3')](0x0);var events={'afterCreate':_0xcfce('0x4'),'afterUpdate':_0xcfce('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a97a7){return function(_0x111628,_0x249219,_0x40f7b1){ChatMessageEvents[_0xcfce('0x6')](_0x2a97a7+':'+_0x111628['id'],_0x111628);ChatMessageEvents[_0xcfce('0x6')](_0x2a97a7,_0x111628);_0x40f7b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xcfce('0x7')](e,emitEvent(event));}}module[_0xcfce('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xc501=['save','remove','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc501,0x64));var _0x1c50=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0xc501[_0x2c5255];return _0x30d0ea;};'use strict';var EventEmitter=require(_0x1c50('0x0'));var ChatMessage=require(_0x1c50('0x1'))['db'][_0x1c50('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1c50('0x3')](0x0);var events={'afterCreate':_0x1c50('0x4'),'afterUpdate':'update','afterDestroy':_0x1c50('0x5')};function emitEvent(_0x27af38){return function(_0x3d1a13,_0x48791f,_0x271ec2){ChatMessageEvents['emit'](_0x27af38+':'+_0x3d1a13['id'],_0x3d1a13);ChatMessageEvents['emit'](_0x27af38,_0x3d1a13);_0x271ec2(null);};}for(var e in events){if(events[_0x1c50('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x1c50('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index b5a8be7..c11ac62 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 _0x76cb=['findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path','rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x581baa,_0x1a6cf8){var _0x4f9d02=function(_0x30498e){while(--_0x30498e){_0x581baa['push'](_0x581baa['shift']());}};_0x4f9d02(++_0x1a6cf8);}(_0x76cb,0x129));var _0xb76c=function(_0x15a634,_0x4feb86){_0x15a634=_0x15a634-0x0;var _0xf4f7a0=_0x76cb[_0x15a634];return _0xf4f7a0;};'use strict';var _=require(_0xb76c('0x0'));var util=require(_0xb76c('0x1'));var logger=require(_0xb76c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb76c('0x3'));var fs=require('fs');var path=require(_0xb76c('0x4'));var rimraf=require(_0xb76c('0x5'));var config=require('../../config/environment');var attributes=require(_0xb76c('0x6'));module[_0xb76c('0x7')]=function(_0x485111,_0x3d39e5){return _0x485111[_0xb76c('0x8')](_0xb76c('0x9'),attributes,{'tableName':_0xb76c('0xa'),'paranoid':![],'indexes':[{'name':_0xb76c('0xb'),'fields':[_0xb76c('0xc')],'type':_0xb76c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d1ac3,_0x5c07b4,_0x198554){var _0x741581=_0x485111[_0xb76c('0xe')];var _0x3fce99=_0x3d1ac3[_0xb76c('0xf')]({'plain':!![]});if(_0x3fce99[_0xb76c('0x10')]['toLowerCase']()==='in'||_0x3fce99[_0xb76c('0x10')][_0xb76c('0x11')]()===_0xb76c('0x12')&&!_0x3fce99[_0xb76c('0x13')]&&!_[_0xb76c('0x14')](_0x3fce99[_0xb76c('0x15')])){_0x741581['ChatInteraction'][_0xb76c('0x16')]({'where':{'id':_0x3fce99[_0xb76c('0x17')]}})[_0xb76c('0x18')](function(_0x3862a8){if(_0x3862a8){_0x3862a8['update']({'lastMsgAt':_0x3fce99[_0xb76c('0x19')],'lastMsgDirection':_0x3fce99[_0xb76c('0x10')][_0xb76c('0x11')]()});}})[_0xb76c('0x1a')](function(_0x186859){console[_0xb76c('0x1b')](_0x186859);});}_0x198554();}},'charset':'utf8mb4','collate':_0xb76c('0x1c')});}; \ No newline at end of file +var _0x1d9d=['moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x333a60,_0x201ccf){var _0x21e8c2=function(_0x2fbac3){while(--_0x2fbac3){_0x333a60['push'](_0x333a60['shift']());}};_0x21e8c2(++_0x201ccf);}(_0x1d9d,0x6d));var _0xd1d9=function(_0x3fd38f,_0x5c31e2){_0x3fd38f=_0x3fd38f-0x0;var _0x15afd0=_0x1d9d[_0x3fd38f];return _0x15afd0;};'use strict';var _=require(_0xd1d9('0x0'));var util=require(_0xd1d9('0x1'));var logger=require(_0xd1d9('0x2'))('api');var moment=require(_0xd1d9('0x3'));var BPromise=require(_0xd1d9('0x4'));var rp=require(_0xd1d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1d9('0x6'));var config=require(_0xd1d9('0x7'));var attributes=require(_0xd1d9('0x8'));module[_0xd1d9('0x9')]=function(_0x5cc987,_0x286cd0){return _0x5cc987[_0xd1d9('0xa')](_0xd1d9('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xd1d9('0xc'),'fields':[_0xd1d9('0xd')],'type':_0xd1d9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e1b9e,_0x536d32,_0x105a4f){var _0x5132ef=_0x5cc987['models'];var _0x39f3c7=_0x1e1b9e[_0xd1d9('0xf')]({'plain':!![]});if(_0x39f3c7[_0xd1d9('0x10')]['toLowerCase']()==='in'||_0x39f3c7[_0xd1d9('0x10')][_0xd1d9('0x11')]()===_0xd1d9('0x12')&&!_0x39f3c7['secret']&&!_['isNil'](_0x39f3c7['UserId'])){_0x5132ef[_0xd1d9('0x13')][_0xd1d9('0x14')]({'where':{'id':_0x39f3c7[_0xd1d9('0x15')]}})[_0xd1d9('0x16')](function(_0x45c88c){if(_0x45c88c){_0x45c88c['update']({'lastMsgAt':_0x39f3c7[_0xd1d9('0x17')],'lastMsgDirection':_0x39f3c7['direction'][_0xd1d9('0x11')]()});}})[_0xd1d9('0x18')](function(_0x42df45){console[_0xd1d9('0x19')](_0x42df45);});}_0x105a4f();}},'charset':_0xd1d9('0x1a'),'collate':_0xd1d9('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index cd6c66f..e27c4cf 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 _0xe155=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','ChatMessage','create','options','raw','CreateChatMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a7e3c,_0xdc9219){var _0x59252b=function(_0x29655c){while(--_0x29655c){_0x5a7e3c['push'](_0x5a7e3c['shift']());}};_0x59252b(++_0xdc9219);}(_0xe155,0xcf));var _0x5e15=function(_0x34e5cf,_0x3bf4b9){_0x34e5cf=_0x34e5cf-0x0;var _0x3cc62e=_0xe155[_0x34e5cf];return _0x3cc62e;};'use strict';var _=require(_0x5e15('0x0'));var util=require(_0x5e15('0x1'));var moment=require(_0x5e15('0x2'));var BPromise=require(_0x5e15('0x3'));var rs=require(_0x5e15('0x4'));var fs=require('fs');var Redis=require(_0x5e15('0x5'));var db=require(_0x5e15('0x6'))['db'];var utils=require(_0x5e15('0x7'));var logger=require(_0x5e15('0x8'))(_0x5e15('0x9'));var config=require(_0x5e15('0xa'));var jayson=require(_0x5e15('0xb'));var client=jayson[_0x5e15('0xc')][_0x5e15('0xd')]({'port':0x232a});config[_0x5e15('0xe')]=_[_0x5e15('0xf')](config[_0x5e15('0xe')],{'host':_0x5e15('0x10'),'port':0x18eb});var socket=require(_0x5e15('0x11'))(new Redis(config[_0x5e15('0xe')]));require('./chatMessage.socket')[_0x5e15('0x12')](socket);function respondWithRpcPromise(_0x301517,_0x3a8909,_0x99b4f6){return new BPromise(function(_0x412d49,_0x242048){return client[_0x5e15('0x13')](_0x301517,_0x99b4f6)[_0x5e15('0x14')](function(_0x9dde34){logger[_0x5e15('0x15')](_0x5e15('0x16'),_0x3a8909,'request\x20sent');logger[_0x5e15('0x17')](_0x5e15('0x18'),_0x3a8909,'request\x20sent',JSON[_0x5e15('0x19')](_0x9dde34));if(_0x9dde34[_0x5e15('0x1a')]){if(_0x9dde34['error']['code']===0x1f4){logger[_0x5e15('0x1a')](_0x5e15('0x16'),_0x3a8909,_0x9dde34[_0x5e15('0x1a')][_0x5e15('0x1b')]);return _0x242048(_0x9dde34[_0x5e15('0x1a')]['message']);}logger[_0x5e15('0x1a')](_0x5e15('0x16'),_0x3a8909,_0x9dde34[_0x5e15('0x1a')]['message']);return _0x412d49(_0x9dde34[_0x5e15('0x1a')][_0x5e15('0x1b')]);}else{logger[_0x5e15('0x15')](_0x5e15('0x16'),_0x3a8909,_0x5e15('0x1c'));_0x412d49(_0x9dde34[_0x5e15('0x1d')][_0x5e15('0x1b')]);}})[_0x5e15('0x1e')](function(_0x260c56){logger[_0x5e15('0x1a')]('ChatMessage,\x20%s,\x20%s',_0x3a8909,_0x260c56);_0x242048(_0x260c56);});});}exports['CreateChatMessage']=function(_0x17c4cc){var _0xda7c63=this;return new Promise(function(_0x2d9723,_0x224f84){return db[_0x5e15('0x1f')][_0x5e15('0x20')](_0x17c4cc['body'],{'raw':_0x17c4cc[_0x5e15('0x21')]?_0x17c4cc['options'][_0x5e15('0x22')]===undefined?!![]:![]:!![]})[_0x5e15('0x14')](function(_0xf17a2c){logger[_0x5e15('0x15')]('CreateChatMessage',_0x17c4cc);logger[_0x5e15('0x17')](_0x5e15('0x23'),_0x17c4cc,JSON[_0x5e15('0x19')](_0xf17a2c));_0x2d9723(_0xf17a2c);})['catch'](function(_0x163060){logger[_0x5e15('0x1a')](_0x5e15('0x23'),_0x163060[_0x5e15('0x1b')],_0x17c4cc);_0x224f84(_0xda7c63['error'](0x1f4,_0x163060[_0x5e15('0x1b')]));});});}; \ No newline at end of file +var _0x5439=['moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','ChatMessage','create','body','options','raw','CreateChatMessage','lodash'];(function(_0x403580,_0x353dd3){var _0x18f0cf=function(_0x3f5ee4){while(--_0x3f5ee4){_0x403580['push'](_0x403580['shift']());}};_0x18f0cf(++_0x353dd3);}(_0x5439,0x1ef));var _0x9543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5439[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9543('0x0'));var util=require('util');var moment=require(_0x9543('0x1'));var BPromise=require(_0x9543('0x2'));var rs=require(_0x9543('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9543('0x4'));var logger=require(_0x9543('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9543('0x6'));var client=jayson[_0x9543('0x7')][_0x9543('0x8')]({'port':0x232a});config[_0x9543('0x9')]=_[_0x9543('0xa')](config[_0x9543('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9543('0xb'))(new Redis(config[_0x9543('0x9')]));require(_0x9543('0xc'))['register'](socket);function respondWithRpcPromise(_0x2d62a1,_0x3ea8e6,_0x8c8b9f){return new BPromise(function(_0x496dec,_0x3cc885){return client[_0x9543('0xd')](_0x2d62a1,_0x8c8b9f)[_0x9543('0xe')](function(_0xfe3681){logger['info'](_0x9543('0xf'),_0x3ea8e6,_0x9543('0x10'));logger[_0x9543('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3ea8e6,_0x9543('0x10'),JSON[_0x9543('0x12')](_0xfe3681));if(_0xfe3681[_0x9543('0x13')]){if(_0xfe3681['error'][_0x9543('0x14')]===0x1f4){logger[_0x9543('0x13')](_0x9543('0xf'),_0x3ea8e6,_0xfe3681['error'][_0x9543('0x15')]);return _0x3cc885(_0xfe3681['error'][_0x9543('0x15')]);}logger[_0x9543('0x13')](_0x9543('0xf'),_0x3ea8e6,_0xfe3681[_0x9543('0x13')][_0x9543('0x15')]);return _0x496dec(_0xfe3681['error'][_0x9543('0x15')]);}else{logger[_0x9543('0x16')](_0x9543('0xf'),_0x3ea8e6,'request\x20sent');_0x496dec(_0xfe3681[_0x9543('0x17')][_0x9543('0x15')]);}})[_0x9543('0x18')](function(_0x2beae4){logger[_0x9543('0x13')]('ChatMessage,\x20%s,\x20%s',_0x3ea8e6,_0x2beae4);_0x3cc885(_0x2beae4);});});}exports['CreateChatMessage']=function(_0x5d5df8){var _0x345ed9=this;return new Promise(function(_0x49a6c0,_0x589b41){return db[_0x9543('0x19')][_0x9543('0x1a')](_0x5d5df8[_0x9543('0x1b')],{'raw':_0x5d5df8['options']?_0x5d5df8[_0x9543('0x1c')][_0x9543('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x32a25c){logger[_0x9543('0x16')]('CreateChatMessage',_0x5d5df8);logger['debug']('CreateChatMessage',_0x5d5df8,JSON['stringify'](_0x32a25c));_0x49a6c0(_0x32a25c);})[_0x9543('0x18')](function(_0x3e8a47){logger[_0x9543('0x13')](_0x9543('0x1e'),_0x3e8a47[_0x9543('0x15')],_0x5d5df8);_0x589b41(_0x345ed9[_0x9543('0x13')](0x1f4,_0x3e8a47[_0x9543('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index ed55483..db4886d 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 _0x7118=['length','chatMessage:','remove','update','emit','removeListener','register'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0x7118,0x159));var _0x8711=function(_0x16ad5e,_0x224def){_0x16ad5e=_0x16ad5e-0x0;var _0x314c70=_0x7118[_0x16ad5e];return _0x314c70;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x8711('0x0'),_0x8711('0x1')];function createListener(_0x5c64d4,_0x1758c5){return function(_0x3ea36f){_0x1758c5[_0x8711('0x2')](_0x5c64d4,_0x3ea36f);};}function removeListener(_0x259c36,_0x12496b){return function(){ChatMessageEvents[_0x8711('0x3')](_0x259c36,_0x12496b);};}exports[_0x8711('0x4')]=function(_0x54885e){for(var _0x385033=0x0,_0x2244c2=events[_0x8711('0x5')];_0x385033<_0x2244c2;_0x385033++){var _0x3d82f2=events[_0x385033];var _0x189349=createListener(_0x8711('0x6')+_0x3d82f2,_0x54885e);ChatMessageEvents['on'](_0x3d82f2,_0x189349);}}; \ No newline at end of file +var _0xee14=['length','chatMessage:','remove','update','emit','removeListener'];(function(_0x132b71,_0x25f23e){var _0x224664=function(_0x1f9e23){while(--_0x1f9e23){_0x132b71['push'](_0x132b71['shift']());}};_0x224664(++_0x25f23e);}(_0xee14,0x13a));var _0x4ee1=function(_0x1e3c5e,_0x5252b1){_0x1e3c5e=_0x1e3c5e-0x0;var _0x4d9e35=_0xee14[_0x1e3c5e];return _0x4d9e35;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x4ee1('0x0'),_0x4ee1('0x1')];function createListener(_0x34e49d,_0x1fa407){return function(_0x18e3c4){_0x1fa407[_0x4ee1('0x2')](_0x34e49d,_0x18e3c4);};}function removeListener(_0x34a0ae,_0x1e5fb6){return function(){ChatMessageEvents[_0x4ee1('0x3')](_0x34a0ae,_0x1e5fb6);};}exports['register']=function(_0xba6d36){for(var _0x573700=0x0,_0x327c18=events[_0x4ee1('0x4')];_0x573700<_0x327c18;_0x573700++){var _0x187656=events[_0x573700];var _0x293d5f=createListener(_0x4ee1('0x5')+_0x187656,_0xba6d36);ChatMessageEvents['on'](_0x187656,_0x293d5f);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 7a2a8db..50c3e00 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 _0x00b1=['Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','path'];(function(_0x3cd451,_0x26e81a){var _0x571ce6=function(_0x27af9e){while(--_0x27af9e){_0x3cd451['push'](_0x3cd451['shift']());}};_0x571ce6(++_0x26e81a);}(_0x00b1,0x1d9));var _0x100b=function(_0x200585,_0x2878c8){_0x200585=_0x200585-0x0;var _0x44a661=_0x00b1[_0x200585];return _0x44a661;};'use strict';var multer=require(_0x100b('0x0'));var util=require('util');var path=require(_0x100b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x100b('0x2')]();var fs_extra=require(_0x100b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x100b('0x4'));var config=require(_0x100b('0x5'));var controller=require(_0x100b('0x6'));router[_0x100b('0x7')]('/',auth[_0x100b('0x8')](),controller[_0x100b('0x9')]);router[_0x100b('0x7')](_0x100b('0xa'),auth['isAuthenticated'](),controller[_0x100b('0xb')]);router['get'](_0x100b('0xc'),auth[_0x100b('0x8')](),controller[_0x100b('0xd')]);router[_0x100b('0xe')]('/',auth[_0x100b('0x8')](),interaction[_0x100b('0xf')](_0x100b('0x10'),_0x100b('0x11')),controller['create']);router['put']('/:id',controller['update']);router[_0x100b('0x12')](_0x100b('0x13'),auth[_0x100b('0x8')](),controller[_0x100b('0x14')]);router[_0x100b('0x12')](_0x100b('0x15'),auth[_0x100b('0x8')](),controller[_0x100b('0x16')]);router[_0x100b('0x17')](_0x100b('0xc'),auth[_0x100b('0x8')](),controller[_0x100b('0x18')]);module['exports']=router; \ No newline at end of file +var _0x10f9=['isAuthenticated','describe','/:id','show','post','tracked','chatmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get'];(function(_0x240167,_0x38a99c){var _0x292a01=function(_0x19710b){while(--_0x19710b){_0x240167['push'](_0x240167['shift']());}};_0x292a01(++_0x38a99c);}(_0x10f9,0x148));var _0x910f=function(_0x4adbdb,_0x3ff3c7){_0x4adbdb=_0x4adbdb-0x0;var _0x59966b=_0x10f9[_0x4adbdb];return _0x59966b;};'use strict';var multer=require(_0x910f('0x0'));var util=require('util');var path=require(_0x910f('0x1'));var timeout=require(_0x910f('0x2'));var express=require(_0x910f('0x3'));var router=express[_0x910f('0x4')]();var fs_extra=require(_0x910f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x910f('0x6'));var config=require(_0x910f('0x7'));var controller=require(_0x910f('0x8'));router[_0x910f('0x9')]('/',auth[_0x910f('0xa')](),controller['index']);router[_0x910f('0x9')]('/describe',auth[_0x910f('0xa')](),controller[_0x910f('0xb')]);router['get'](_0x910f('0xc'),auth[_0x910f('0xa')](),controller[_0x910f('0xd')]);router[_0x910f('0xe')]('/',auth[_0x910f('0xa')](),interaction[_0x910f('0xf')]('chat',_0x910f('0x10')),controller[_0x910f('0x11')]);router[_0x910f('0x12')]('/:id',controller[_0x910f('0x13')]);router[_0x910f('0x12')](_0x910f('0x14'),auth[_0x910f('0xa')](),controller['accept']);router['put'](_0x910f('0x15'),auth['isAuthenticated'](),controller[_0x910f('0x16')]);router[_0x910f('0x17')](_0x910f('0xc'),auth[_0x910f('0xa')](),controller[_0x910f('0x18')]);module[_0x910f('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 34d57d1..cb4c6d2 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 _0x757a=['exports','TEXT'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x757a,0xde));var _0xa757=function(_0xfd37d6,_0x4e844a){_0xfd37d6=_0xfd37d6-0x0;var _0xab9f9=_0x757a[_0xfd37d6];return _0xab9f9;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x757a=['exports','TEXT'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x757a,0xde));var _0xa757=function(_0x31df51,_0x2d54b4){_0x31df51=_0x31df51-0x0;var _0x1d3e0e=_0x757a[_0x31df51];return _0x1d3e0e;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('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 c353e49..571faac 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 _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(_0x5824e0,_0x394157){var _0x7a610d=function(_0x509af7){while(--_0x509af7){_0x5824e0['push'](_0x5824e0['shift']());}};_0x7a610d(++_0x394157);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 +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(_0x2cca5d,_0x117d96){var _0x507c48=function(_0x255c38){while(--_0x255c38){_0x2cca5d['push'](_0x2cca5d['shift']());}};_0x507c48(++_0x117d96);}(_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){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.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index c3180e2..5553fbe 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8e0=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x57402d,_0x3ebd30){var _0x224071=function(_0x5c8d23){while(--_0x5c8d23){_0x57402d['push'](_0x57402d['shift']());}};_0x224071(++_0x3ebd30);}(_0xc8e0,0xb7));var _0x0c8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8e0[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x0c8e('0x0'));var ChatOfflineMessage=require(_0x0c8e('0x1'))['db'][_0x0c8e('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x0c8e('0x3')](0x0);var events={'afterCreate':_0x0c8e('0x4'),'afterUpdate':_0x0c8e('0x5'),'afterDestroy':_0x0c8e('0x6')};function emitEvent(_0x1334ab){return function(_0x19af18,_0x13dfb9,_0x5668c0){ChatOfflineMessageEvents[_0x0c8e('0x7')](_0x1334ab+':'+_0x19af18['id'],_0x19af18);ChatOfflineMessageEvents[_0x0c8e('0x7')](_0x1334ab,_0x19af18);_0x5668c0(null);};}for(var e in events){if(events[_0x0c8e('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x0c8e('0x9')](e,emitEvent(event));}}module[_0x0c8e('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x33de=['ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x3f5155,_0x13cc8f){var _0x5a8d5a=function(_0x3a47d1){while(--_0x3a47d1){_0x3f5155['push'](_0x3f5155['shift']());}};_0x5a8d5a(++_0x13cc8f);}(_0x33de,0x14b));var _0xe33d=function(_0x59820d,_0xc8e6ba){_0x59820d=_0x59820d-0x0;var _0x3c72b1=_0x33de[_0x59820d];return _0x3c72b1;};'use strict';var EventEmitter=require(_0xe33d('0x0'));var ChatOfflineMessage=require(_0xe33d('0x1'))['db'][_0xe33d('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xe33d('0x3')](0x0);var events={'afterCreate':_0xe33d('0x4'),'afterUpdate':_0xe33d('0x5'),'afterDestroy':_0xe33d('0x6')};function emitEvent(_0x3bd5ec){return function(_0x84395f,_0x451e5a,_0xb4d96){ChatOfflineMessageEvents['emit'](_0x3bd5ec+':'+_0x84395f['id'],_0x84395f);ChatOfflineMessageEvents[_0xe33d('0x7')](_0x3bd5ec,_0x84395f);_0xb4d96(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xe33d('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index bacc681..615f64b 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 _0xb32f=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xb32f,0x17a));var _0xfb32=function(_0x1a1e42,_0x45b0d9){_0x1a1e42=_0x1a1e42-0x0;var _0x409105=_0xb32f[_0x1a1e42];return _0x409105;};'use strict';var attributes=require(_0xfb32('0x0'));module[_0xfb32('0x1')]=function(_0x159b5a){return _0x159b5a[_0xfb32('0x2')](_0xfb32('0x3'),attributes,{'tableName':_0xfb32('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfb32('0x5'),'collate':_0xfb32('0x6')});}; \ No newline at end of file +var _0x5c70=['ChatOfflineMessage','chat_offline_messages','./chatOfflineMessage.attributes','exports','define'];(function(_0x3439bc,_0xc03879){var _0x484801=function(_0x39d69f){while(--_0x39d69f){_0x3439bc['push'](_0x3439bc['shift']());}};_0x484801(++_0xc03879);}(_0x5c70,0x11f));var _0x05c7=function(_0x3ac76f,_0x46494c){_0x3ac76f=_0x3ac76f-0x0;var _0x178ae0=_0x5c70[_0x3ac76f];return _0x178ae0;};'use strict';var attributes=require(_0x05c7('0x0'));module[_0x05c7('0x1')]=function(_0x463380){return _0x463380[_0x05c7('0x2')](_0x05c7('0x3'),attributes,{'tableName':_0x05c7('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 38eb0da..7f014c1 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 _0xde8a=['info','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x1f4c1f,_0x19ff7f){var _0x56ef12=function(_0x36b24a){while(--_0x36b24a){_0x1f4c1f['push'](_0x1f4c1f['shift']());}};_0x56ef12(++_0x19ff7f);}(_0xde8a,0x107));var _0xade8=function(_0x13e784,_0x175ae9){_0x13e784=_0x13e784-0x0;var _0x1ecb5a=_0xde8a[_0x13e784];return _0x1ecb5a;};'use strict';var _=require('lodash');var util=require(_0xade8('0x0'));var moment=require(_0xade8('0x1'));var BPromise=require(_0xade8('0x2'));var rs=require(_0xade8('0x3'));var fs=require('fs');var Redis=require(_0xade8('0x4'));var db=require(_0xade8('0x5'))['db'];var utils=require(_0xade8('0x6'));var logger=require('../../config/logger')(_0xade8('0x7'));var config=require(_0xade8('0x8'));var jayson=require(_0xade8('0x9'));var client=jayson[_0xade8('0xa')][_0xade8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8657e8,_0x187293,_0x4a0425){return new BPromise(function(_0x2e3e61,_0x12db41){return client['request'](_0x8657e8,_0x4a0425)[_0xade8('0xc')](function(_0x284427){logger[_0xade8('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x187293,'request\x20sent');logger[_0xade8('0xe')](_0xade8('0xf'),_0x187293,_0xade8('0x10'),JSON[_0xade8('0x11')](_0x284427));if(_0x284427[_0xade8('0x12')]){if(_0x284427[_0xade8('0x12')][_0xade8('0x13')]===0x1f4){logger[_0xade8('0x12')](_0xade8('0x14'),_0x187293,_0x284427[_0xade8('0x12')][_0xade8('0x15')]);return _0x12db41(_0x284427[_0xade8('0x12')][_0xade8('0x15')]);}logger[_0xade8('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x187293,_0x284427[_0xade8('0x12')]['message']);return _0x2e3e61(_0x284427[_0xade8('0x12')]['message']);}else{logger[_0xade8('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x187293,'request\x20sent');_0x2e3e61(_0x284427[_0xade8('0x16')][_0xade8('0x15')]);}})['catch'](function(_0x4aea85){logger[_0xade8('0x12')](_0xade8('0x14'),_0x187293,_0x4aea85);_0x12db41(_0x4aea85);});});} \ No newline at end of file +var _0x6408=['jayson/promise','client','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1b6f54,_0x17109a){var _0x5ae1c9=function(_0x384a94){while(--_0x384a94){_0x1b6f54['push'](_0x1b6f54['shift']());}};_0x5ae1c9(++_0x17109a);}(_0x6408,0x194));var _0x8640=function(_0x46608c,_0x4bb7a2){_0x46608c=_0x46608c-0x0;var _0x168a0c=_0x6408[_0x46608c];return _0x168a0c;};'use strict';var _=require(_0x8640('0x0'));var util=require(_0x8640('0x1'));var moment=require(_0x8640('0x2'));var BPromise=require(_0x8640('0x3'));var rs=require(_0x8640('0x4'));var fs=require('fs');var Redis=require(_0x8640('0x5'));var db=require(_0x8640('0x6'))['db'];var utils=require(_0x8640('0x7'));var logger=require(_0x8640('0x8'))(_0x8640('0x9'));var config=require('../../config/environment');var jayson=require(_0x8640('0xa'));var client=jayson[_0x8640('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b9083,_0x44d634,_0x52c497){return new BPromise(function(_0x40b941,_0x5113d8){return client['request'](_0x1b9083,_0x52c497)[_0x8640('0xc')](function(_0x590034){logger[_0x8640('0xd')](_0x8640('0xe'),_0x44d634,'request\x20sent');logger[_0x8640('0xf')](_0x8640('0x10'),_0x44d634,_0x8640('0x11'),JSON[_0x8640('0x12')](_0x590034));if(_0x590034[_0x8640('0x13')]){if(_0x590034[_0x8640('0x13')]['code']===0x1f4){logger['error'](_0x8640('0xe'),_0x44d634,_0x590034[_0x8640('0x13')][_0x8640('0x14')]);return _0x5113d8(_0x590034[_0x8640('0x13')]['message']);}logger[_0x8640('0x13')](_0x8640('0xe'),_0x44d634,_0x590034[_0x8640('0x13')][_0x8640('0x14')]);return _0x40b941(_0x590034[_0x8640('0x13')][_0x8640('0x14')]);}else{logger['info'](_0x8640('0xe'),_0x44d634,_0x8640('0x11'));_0x40b941(_0x590034[_0x8640('0x15')][_0x8640('0x14')]);}})[_0x8640('0x16')](function(_0x15ac1b){logger['error'](_0x8640('0xe'),_0x44d634,_0x15ac1b);_0x5113d8(_0x15ac1b);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 3372ba0..3ddb88c 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 _0x57c3=['Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','create','put','/:id','update','delete','destroy','util','express'];(function(_0x2b9885,_0x2ab1ab){var _0x136a82=function(_0x28b328){while(--_0x28b328){_0x2b9885['push'](_0x2b9885['shift']());}};_0x136a82(++_0x2ab1ab);}(_0x57c3,0xb2));var _0x357c=function(_0x15f344,_0xcfdee8){_0x15f344=_0x15f344-0x0;var _0x2de358=_0x57c3[_0x15f344];return _0x2de358;};'use strict';var multer=require('multer');var util=require(_0x357c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x357c('0x1'));var router=express[_0x357c('0x2')]();var fs_extra=require(_0x357c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x357c('0x4'));var config=require(_0x357c('0x5'));var controller=require(_0x357c('0x6'));router[_0x357c('0x7')]('/',auth[_0x357c('0x8')](),controller[_0x357c('0x9')]);router[_0x357c('0x7')](_0x357c('0xa'),auth[_0x357c('0x8')](),controller[_0x357c('0xb')]);router[_0x357c('0x7')]('/:id',auth[_0x357c('0x8')](),controller['show']);router['post']('/',auth[_0x357c('0x8')](),controller[_0x357c('0xc')]);router[_0x357c('0xd')](_0x357c('0xe'),auth['isAuthenticated'](),controller[_0x357c('0xf')]);router[_0x357c('0x10')]('/:id',auth[_0x357c('0x8')](),controller[_0x357c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x656b=['fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','create','update','destroy','multer','connect-timeout','Router'];(function(_0x1aa883,_0x50f53b){var _0x5e9fb5=function(_0x5558f1){while(--_0x5558f1){_0x1aa883['push'](_0x1aa883['shift']());}};_0x5e9fb5(++_0x50f53b);}(_0x656b,0x1dd));var _0xb656=function(_0x14e1da,_0x2d21d2){_0x14e1da=_0x14e1da-0x0;var _0x411d1d=_0x656b[_0x14e1da];return _0x411d1d;};'use strict';var multer=require(_0xb656('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb656('0x1'));var express=require('express');var router=express[_0xb656('0x2')]();var fs_extra=require(_0xb656('0x3'));var auth=require(_0xb656('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb656('0x5'));var controller=require(_0xb656('0x6'));router[_0xb656('0x7')]('/',auth[_0xb656('0x8')](),controller['index']);router['get'](_0xb656('0x9'),auth[_0xb656('0x8')](),controller[_0xb656('0xa')]);router[_0xb656('0x7')](_0xb656('0xb'),auth[_0xb656('0x8')](),controller['show']);router['post']('/',auth[_0xb656('0x8')](),controller[_0xb656('0xc')]);router['put'](_0xb656('0xb'),auth['isAuthenticated'](),controller[_0xb656('0xd')]);router['delete'](_0xb656('0xb'),auth[_0xb656('0x8')](),controller[_0xb656('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 15f539a..ab674bf 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 _0x7c45=['ENUM','timeout','mouseOver','sequelize','exports','STRING'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x7c45,0x7b));var _0x57c4=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x7c45[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require(_0x57c4('0x0'));module[_0x57c4('0x1')]={'name':{'type':Sequelize[_0x57c4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x57c4('0x3')]('mouseOver',_0x57c4('0x4')),'defaultValue':_0x57c4('0x5')},'selector':{'type':Sequelize[_0x57c4('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa7a6=['STRING','timeout','mouseOver','INTEGER','exports'];(function(_0x246464,_0x1f0b14){var _0x26eb18=function(_0x7721b3){while(--_0x7721b3){_0x246464['push'](_0x246464['shift']());}};_0x26eb18(++_0x1f0b14);}(_0xa7a6,0x19e));var _0x6a7a=function(_0x28e196,_0x55ea66){_0x28e196=_0x28e196-0x0;var _0xebe98e=_0xa7a6[_0x28e196];return _0xebe98e;};'use strict';var Sequelize=require('sequelize');module[_0x6a7a('0x0')]={'name':{'type':Sequelize[_0x6a7a('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x6a7a('0x2')),'defaultValue':_0x6a7a('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6a7a('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 8d966e1..3496fb2 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 _0x4b84=['name','show','params','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0xd351b8,_0x410fa3){var _0x3f8a1c=function(_0x55c53e){while(--_0x55c53e){_0xd351b8['push'](_0xd351b8['shift']());}};_0x3f8a1c(++_0x410fa3);}(_0x4b84,0x1cc));var _0x44b8=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0x4b84[_0xb68772];return _0x4189bb;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x25a0c1,_0x47689e){return function(_0x230a3d){if(!_0x230a3d){_0x25a0c1['sendStatus'](0x194);}return _0x230a3d;};}function handleError(_0x474f01,_0x502acf){_0x502acf=_0x502acf||0x1f4;return function(_0x41d673){logger[_0x44b8('0x22')](_0x41d673['stack']);if(_0x41d673[_0x44b8('0x23')]){delete _0x41d673[_0x44b8('0x23')];}_0x474f01[_0x44b8('0x14')](_0x502acf)['send'](_0x41d673);};}exports[_0x44b8('0x24')]=function(_0x242342,_0x53d9c7){var _0x2e0174={'raw':!![],'where':{'id':_0x242342[_0x44b8('0x25')]['id']}},_0x4a182d={};_0x4a182d['model']=_['keys'](db['ChatProactiveAction'][_0x44b8('0x26')]);_0x4a182d[_0x44b8('0x27')]=_[_0x44b8('0x28')](_0x242342[_0x44b8('0x27')]);_0x4a182d[_0x44b8('0x29')]=_[_0x44b8('0x2a')](_0x4a182d[_0x44b8('0x2b')],_0x4a182d[_0x44b8('0x27')]);_0x2e0174[_0x44b8('0x2c')]=_[_0x44b8('0x2a')](_0x4a182d[_0x44b8('0x2b')],qs[_0x44b8('0x2d')](_0x242342[_0x44b8('0x27')]['fields']));_0x2e0174[_0x44b8('0x2c')]=_0x2e0174['attributes'][_0x44b8('0x2e')]?_0x2e0174[_0x44b8('0x2c')]:_0x4a182d[_0x44b8('0x2b')];if(_0x242342[_0x44b8('0x27')][_0x44b8('0x2f')]){_0x2e0174['include']=[{'all':!![]}];}_0x2e0174=_[_0x44b8('0x30')]({},_0x2e0174,_0x242342[_0x44b8('0x31')]);return db[_0x44b8('0x32')][_0x44b8('0x33')](_0x2e0174)[_0x44b8('0x20')](handleEntityNotFound(_0x53d9c7,null))['then'](respondWithResult(_0x53d9c7,null))[_0x44b8('0x34')](handleError(_0x53d9c7,null));};exports[_0x44b8('0x35')]=function(_0x1a30fc,_0x3e93af){return db[_0x44b8('0x32')][_0x44b8('0x35')](_0x1a30fc[_0x44b8('0x36')],{})[_0x44b8('0x20')](respondWithResult(_0x3e93af,0xc9))[_0x44b8('0x34')](handleError(_0x3e93af,null));};exports[_0x44b8('0x1f')]=function(_0x13994c,_0xce304d){if(_0x13994c[_0x44b8('0x36')]['id']){delete _0x13994c[_0x44b8('0x36')]['id'];}return db[_0x44b8('0x32')][_0x44b8('0x33')]({'where':{'id':_0x13994c[_0x44b8('0x25')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0xce304d,null))[_0x44b8('0x20')](saveUpdates(_0x13994c[_0x44b8('0x36')],null))[_0x44b8('0x20')](respondWithResult(_0xce304d,null))[_0x44b8('0x34')](handleError(_0xce304d,null));};exports['destroy']=function(_0x1e2420,_0xd61f14){return db['ChatProactiveAction'][_0x44b8('0x33')]({'where':{'id':_0x1e2420[_0x44b8('0x25')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0xd61f14,null))[_0x44b8('0x20')](removeEntity(_0xd61f14,null))['catch'](handleError(_0xd61f14,null));}; \ No newline at end of file +var _0x1134=['fs-extra','squel','crypto','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','catch','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv'];(function(_0x5edcd8,_0xd8a6ca){var _0x2263cc=function(_0x17df45){while(--_0x17df45){_0x5edcd8['push'](_0x5edcd8['shift']());}};_0x2263cc(++_0xd8a6ca);}(_0x1134,0x19c));var _0x4113=function(_0x364cdd,_0x15c213){_0x364cdd=_0x364cdd-0x0;var _0x6fb254=_0x1134[_0x364cdd];return _0x6fb254;};'use strict';var emlformat=require(_0x4113('0x0'));var rimraf=require(_0x4113('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4113('0x2'));var rp=require(_0x4113('0x3'));var moment=require('moment');var BPromise=require(_0x4113('0x4'));var Mustache=require(_0x4113('0x5'));var util=require('util');var path=require(_0x4113('0x6'));var sox=require('sox');var csv=require(_0x4113('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4113('0x8'));var _=require('lodash');var squel=require(_0x4113('0x9'));var crypto=require(_0x4113('0xa'));var jsforce=require(_0x4113('0xb'));var deskjs=require(_0x4113('0xc'));var toCsv=require(_0x4113('0x7'));var querystring=require(_0x4113('0xd'));var Papa=require(_0x4113('0xe'));var Redis=require(_0x4113('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4113('0x10'));var as=require(_0x4113('0x11'));var hardwareService=require(_0x4113('0x12'));var logger=require(_0x4113('0x13'))(_0x4113('0x14'));var utils=require(_0x4113('0x15'));var config=require(_0x4113('0x16'));var licenseUtil=require(_0x4113('0x17'));var db=require(_0x4113('0x18'))['db'];function respondWithStatusCode(_0x457d3f,_0x53720f){_0x53720f=_0x53720f||0xcc;return function(_0x48b14c){if(_0x48b14c){return _0x457d3f['sendStatus'](_0x53720f);}return _0x457d3f[_0x4113('0x19')](_0x53720f)[_0x4113('0x1a')]();};}function respondWithResult(_0x4ba7ce,_0x567e69){_0x567e69=_0x567e69||0xc8;return function(_0x40f01e){if(_0x40f01e){return _0x4ba7ce['status'](_0x567e69)[_0x4113('0x1b')](_0x40f01e);}};}function respondWithFilteredResult(_0x5ab2a7,_0x59f69b){return function(_0xcdfdd){if(_0xcdfdd){var _0xe88992=typeof _0x59f69b[_0x4113('0x1c')]===_0x4113('0x1d')&&typeof _0x59f69b[_0x4113('0x1e')]===_0x4113('0x1d');var _0x405849=_0xcdfdd[_0x4113('0x1f')];var _0x1051d4=_0xe88992?0x0:_0x59f69b[_0x4113('0x1c')];var _0x59b821=_0xe88992?_0xcdfdd[_0x4113('0x1f')]:_0x59f69b[_0x4113('0x1c')]+_0x59f69b[_0x4113('0x1e')];var _0x1d40ba;if(_0x59b821>=_0x405849){_0x59b821=_0x405849;_0x1d40ba=0xc8;}else{_0x1d40ba=0xce;}_0x5ab2a7[_0x4113('0x19')](_0x1d40ba);return _0x5ab2a7[_0x4113('0x20')](_0x4113('0x21'),_0x1051d4+'-'+_0x59b821+'/'+_0x405849)[_0x4113('0x1b')](_0xcdfdd);}return null;};}function patchUpdates(_0x37bf1e){return function(_0x57540a){try{jsonpatch[_0x4113('0x22')](_0x57540a,_0x37bf1e,!![]);}catch(_0x2776a6){return BPromise['reject'](_0x2776a6);}return _0x57540a['save']();};}function saveUpdates(_0x11deb0,_0x49c72f){return function(_0x149d1a){if(_0x149d1a){return _0x149d1a[_0x4113('0x23')](_0x11deb0)[_0x4113('0x24')](function(_0x5a85be){return _0x5a85be;});}return null;};}function removeEntity(_0x12f1fe,_0x16b16c){return function(_0x349b33){if(_0x349b33){return _0x349b33[_0x4113('0x25')]()[_0x4113('0x24')](function(){_0x12f1fe[_0x4113('0x19')](0xcc)[_0x4113('0x1a')]();});}};}function handleEntityNotFound(_0x1c498a,_0x122102){return function(_0xc73743){if(!_0xc73743){_0x1c498a[_0x4113('0x26')](0x194);}return _0xc73743;};}function handleError(_0x2a014b,_0x56c343){_0x56c343=_0x56c343||0x1f4;return function(_0x44b317){logger[_0x4113('0x27')](_0x44b317['stack']);if(_0x44b317[_0x4113('0x28')]){delete _0x44b317[_0x4113('0x28')];}_0x2a014b[_0x4113('0x19')](_0x56c343)[_0x4113('0x29')](_0x44b317);};}exports[_0x4113('0x2a')]=function(_0x180fed,_0x234543){var _0x134a04={'raw':!![],'where':{'id':_0x180fed[_0x4113('0x2b')]['id']}},_0x3f063f={};_0x3f063f[_0x4113('0x2c')]=_[_0x4113('0x2d')](db[_0x4113('0x2e')][_0x4113('0x2f')]);_0x3f063f['query']=_[_0x4113('0x2d')](_0x180fed[_0x4113('0x30')]);_0x3f063f['filters']=_[_0x4113('0x31')](_0x3f063f[_0x4113('0x2c')],_0x3f063f[_0x4113('0x30')]);_0x134a04[_0x4113('0x32')]=_['intersection'](_0x3f063f[_0x4113('0x2c')],qs[_0x4113('0x33')](_0x180fed[_0x4113('0x30')][_0x4113('0x33')]));_0x134a04[_0x4113('0x32')]=_0x134a04[_0x4113('0x32')][_0x4113('0x34')]?_0x134a04[_0x4113('0x32')]:_0x3f063f[_0x4113('0x2c')];if(_0x180fed['query'][_0x4113('0x35')]){_0x134a04['include']=[{'all':!![]}];}_0x134a04=_[_0x4113('0x36')]({},_0x134a04,_0x180fed[_0x4113('0x37')]);return db[_0x4113('0x2e')][_0x4113('0x38')](_0x134a04)[_0x4113('0x24')](handleEntityNotFound(_0x234543,null))[_0x4113('0x24')](respondWithResult(_0x234543,null))['catch'](handleError(_0x234543,null));};exports[_0x4113('0x39')]=function(_0x56ad93,_0x397fcd){return db[_0x4113('0x2e')][_0x4113('0x39')](_0x56ad93['body'],{})[_0x4113('0x24')](respondWithResult(_0x397fcd,0xc9))['catch'](handleError(_0x397fcd,null));};exports[_0x4113('0x23')]=function(_0x580434,_0x13d161){if(_0x580434[_0x4113('0x3a')]['id']){delete _0x580434['body']['id'];}return db['ChatProactiveAction'][_0x4113('0x38')]({'where':{'id':_0x580434[_0x4113('0x2b')]['id']}})[_0x4113('0x24')](handleEntityNotFound(_0x13d161,null))['then'](saveUpdates(_0x580434['body'],null))[_0x4113('0x24')](respondWithResult(_0x13d161,null))[_0x4113('0x3b')](handleError(_0x13d161,null));};exports[_0x4113('0x25')]=function(_0xed3af2,_0xa50de0){return db['ChatProactiveAction'][_0x4113('0x38')]({'where':{'id':_0xed3af2[_0x4113('0x2b')]['id']}})[_0x4113('0x24')](handleEntityNotFound(_0xa50de0,null))['then'](removeEntity(_0xa50de0,null))[_0x4113('0x3b')](handleError(_0xa50de0,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index cfe1721..799846e 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 _0xd75b=['chat_proactive_actions','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0x53411f,_0x23a4fc){var _0x9a1691=function(_0x5a3d76){while(--_0x5a3d76){_0x53411f['push'](_0x53411f['shift']());}};_0x9a1691(++_0x23a4fc);}(_0xd75b,0x139));var _0xbd75=function(_0x4faabc,_0x349a1e){_0x4faabc=_0x4faabc-0x0;var _0x42fc45=_0xd75b[_0x4faabc];return _0x42fc45;};'use strict';var _=require(_0xbd75('0x0'));var util=require(_0xbd75('0x1'));var logger=require('../../config/logger')(_0xbd75('0x2'));var moment=require(_0xbd75('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd75('0x4'));var fs=require('fs');var path=require(_0xbd75('0x5'));var rimraf=require(_0xbd75('0x6'));var config=require(_0xbd75('0x7'));var attributes=require(_0xbd75('0x8'));module[_0xbd75('0x9')]=function(_0x298f13,_0x4b5493){return _0x298f13[_0xbd75('0xa')](_0xbd75('0xb'),attributes,{'tableName':_0xbd75('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d5a=['bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','util','../../config/logger','api','moment'];(function(_0x10cc9f,_0x5d40a5){var _0x392aaa=function(_0x2f0e7b){while(--_0x2f0e7b){_0x10cc9f['push'](_0x10cc9f['shift']());}};_0x392aaa(++_0x5d40a5);}(_0x8d5a,0x67));var _0xa8d5=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x8d5a[_0x5f0089];return _0x193892;};'use strict';var _=require(_0xa8d5('0x0'));var util=require(_0xa8d5('0x1'));var logger=require(_0xa8d5('0x2'))(_0xa8d5('0x3'));var moment=require(_0xa8d5('0x4'));var BPromise=require(_0xa8d5('0x5'));var rp=require(_0xa8d5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8d5('0x7'));var config=require(_0xa8d5('0x8'));var attributes=require(_0xa8d5('0x9'));module[_0xa8d5('0xa')]=function(_0x1ffe07,_0x45bb52){return _0x1ffe07['define'](_0xa8d5('0xb'),attributes,{'tableName':'chat_proactive_actions','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 67df291..060f43c 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 _0xfbba=['lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x110bf2,_0x1cac5d){var _0x39cb78=function(_0x1e0241){while(--_0x1e0241){_0x110bf2['push'](_0x110bf2['shift']());}};_0x39cb78(++_0x1cac5d);}(_0xfbba,0xcf));var _0xafbb=function(_0x44edd8,_0x1adc9e){_0x44edd8=_0x44edd8-0x0;var _0x542bb6=_0xfbba[_0x44edd8];return _0x542bb6;};'use strict';var _=require(_0xafbb('0x0'));var util=require('util');var moment=require(_0xafbb('0x1'));var BPromise=require(_0xafbb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafbb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xafbb('0x4'));var logger=require(_0xafbb('0x5'))(_0xafbb('0x6'));var config=require(_0xafbb('0x7'));var jayson=require(_0xafbb('0x8'));var client=jayson[_0xafbb('0x9')][_0xafbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x555f96,_0x260a3a,_0x27638c){return new BPromise(function(_0x2b29e2,_0x5a0cea){return client[_0xafbb('0xb')](_0x555f96,_0x27638c)[_0xafbb('0xc')](function(_0x37d764){logger[_0xafbb('0xd')](_0xafbb('0xe'),_0x260a3a,_0xafbb('0xf'));logger[_0xafbb('0x10')](_0xafbb('0x11'),_0x260a3a,_0xafbb('0xf'),JSON[_0xafbb('0x12')](_0x37d764));if(_0x37d764[_0xafbb('0x13')]){if(_0x37d764[_0xafbb('0x13')][_0xafbb('0x14')]===0x1f4){logger[_0xafbb('0x13')](_0xafbb('0xe'),_0x260a3a,_0x37d764[_0xafbb('0x13')][_0xafbb('0x15')]);return _0x5a0cea(_0x37d764[_0xafbb('0x13')][_0xafbb('0x15')]);}logger[_0xafbb('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x260a3a,_0x37d764[_0xafbb('0x13')][_0xafbb('0x15')]);return _0x2b29e2(_0x37d764[_0xafbb('0x13')][_0xafbb('0x15')]);}else{logger['info'](_0xafbb('0xe'),_0x260a3a,_0xafbb('0xf'));_0x2b29e2(_0x37d764['result'][_0xafbb('0x15')]);}})[_0xafbb('0x16')](function(_0x2b9600){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x260a3a,_0x2b9600);_0x5a0cea(_0x2b9600);});});} \ No newline at end of file +var _0xc7f3=['then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xc7f3,0x1c1));var _0x3c7f=function(_0x22205c,_0x473493){_0x22205c=_0x22205c-0x0;var _0x3f5efe=_0xc7f3[_0x22205c];return _0x3f5efe;};'use strict';var _=require(_0x3c7f('0x0'));var util=require(_0x3c7f('0x1'));var moment=require(_0x3c7f('0x2'));var BPromise=require(_0x3c7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c7f('0x4'))['db'];var utils=require(_0x3c7f('0x5'));var logger=require(_0x3c7f('0x6'))(_0x3c7f('0x7'));var config=require(_0x3c7f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3c7f('0x9')][_0x3c7f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa8a8e5,_0xd237fc,_0x46cffb){return new BPromise(function(_0x3fdd3f,_0x11dd9f){return client['request'](_0xa8a8e5,_0x46cffb)[_0x3c7f('0xb')](function(_0x3c7e0c){logger['info'](_0x3c7f('0xc'),_0xd237fc,_0x3c7f('0xd'));logger[_0x3c7f('0xe')](_0x3c7f('0xf'),_0xd237fc,_0x3c7f('0xd'),JSON[_0x3c7f('0x10')](_0x3c7e0c));if(_0x3c7e0c[_0x3c7f('0x11')]){if(_0x3c7e0c[_0x3c7f('0x11')][_0x3c7f('0x12')]===0x1f4){logger[_0x3c7f('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0xd237fc,_0x3c7e0c[_0x3c7f('0x11')]['message']);return _0x11dd9f(_0x3c7e0c[_0x3c7f('0x11')][_0x3c7f('0x13')]);}logger[_0x3c7f('0x11')](_0x3c7f('0xc'),_0xd237fc,_0x3c7e0c[_0x3c7f('0x11')][_0x3c7f('0x13')]);return _0x3fdd3f(_0x3c7e0c[_0x3c7f('0x11')][_0x3c7f('0x13')]);}else{logger[_0x3c7f('0x14')](_0x3c7f('0xc'),_0xd237fc,_0x3c7f('0xd'));_0x3fdd3f(_0x3c7e0c[_0x3c7f('0x15')]['message']);}})[_0x3c7f('0x16')](function(_0x84265){logger[_0x3c7f('0x11')](_0x3c7f('0xc'),_0xd237fc,_0x84265);_0x11dd9f(_0x84265);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index b3d8d2e..03adb85 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 _0x3f8a=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get'];(function(_0x307835,_0x34473c){var _0x7a5ee=function(_0x5d1723){while(--_0x5d1723){_0x307835['push'](_0x307835['shift']());}};_0x7a5ee(++_0x34473c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x484a60,_0x63e920){_0x484a60=_0x484a60-0x0;var _0x18217b=_0x3f8a[_0x484a60];return _0x18217b;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xc')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0x11')]);router['delete'](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0x12')]);module[_0xa3f8('0x13')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x43023c,_0x53062e){var _0x8c0d9a=function(_0x144ead){while(--_0x144ead){_0x43023c['push'](_0x43023c['shift']());}};_0x8c0d9a(++_0x53062e);}(_0x7217,0x19e));var _0x7721=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x7217[_0x138f59];return _0x3d114d;};'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')](_0x7721('0x9'),auth[_0x7721('0xa')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0xa')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')](_0x7721('0x9'),auth[_0x7721('0xa')](),controller[_0x7721('0xf')]);router[_0x7721('0x10')](_0x7721('0x9'),auth['isAuthenticated'](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 284755b..ece26e2 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 _0x96db=['ENUM','rrmemory','beepall','exports','STRING','INTEGER'];(function(_0xf8c068,_0x233159){var _0x4d6940=function(_0x4c590f){while(--_0x4c590f){_0xf8c068['push'](_0xf8c068['shift']());}};_0x4d6940(++_0x233159);}(_0x96db,0x18f));var _0xb96d=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x96db[_0xda464c];return _0x19e222;};'use strict';var Sequelize=require('sequelize');module[_0xb96d('0x0')]={'name':{'type':Sequelize[_0xb96d('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb96d('0x1')]},'timeout':{'type':Sequelize[_0xb96d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb96d('0x3')](_0xb96d('0x4'),_0xb96d('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x5c97=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x47cb0f,_0x5c7147){var _0x4dd971=function(_0x2fd41c){while(--_0x2fd41c){_0x47cb0f['push'](_0x47cb0f['shift']());}};_0x4dd971(++_0x5c7147);}(_0x5c97,0x1b3));var _0x75c9=function(_0x49c341,_0x5b9570){_0x49c341=_0x49c341-0x0;var _0x1c106d=_0x5c97[_0x49c341];return _0x1c106d;};'use strict';var Sequelize=require(_0x75c9('0x0'));module[_0x75c9('0x1')]={'name':{'type':Sequelize[_0x75c9('0x2')],'unique':_0x75c9('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x75c9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x75c9('0x5')](_0x75c9('0x6'),'beepall',_0x75c9('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index a9ee568..e1fd78e 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 _0x6cdd=['result','catch','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','end','name','index','ChatQueue','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','map','findAndCountAll','agent','chatPause','createdAt','rows','format','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','UserChatQueue','emit','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeAgents','forEach','userChatQueue:remove','addAgents','omit','isArray','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3d70aa,_0x3bea48){var _0x169953=function(_0x375b01){while(--_0x375b01){_0x3d70aa['push'](_0x3d70aa['shift']());}};_0x169953(++_0x3bea48);}(_0x6cdd,0x70));var _0xd6cd=function(_0x1d8364,_0x57478a){_0x1d8364=_0x1d8364-0x0;var _0x17f34d=_0x6cdd[_0x1d8364];return _0x17f34d;};'use strict';var emlformat=require(_0xd6cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd6cd('0x1'));var jsonpatch=require(_0xd6cd('0x2'));var rp=require('request-promise');var moment=require(_0xd6cd('0x3'));var BPromise=require(_0xd6cd('0x4'));var Mustache=require(_0xd6cd('0x5'));var util=require(_0xd6cd('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd6cd('0x7'));var ejs=require(_0xd6cd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6cd('0x9'));var squel=require(_0xd6cd('0xa'));var crypto=require('crypto');var jsforce=require(_0xd6cd('0xb'));var deskjs=require(_0xd6cd('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd6cd('0xd'));var Papa=require(_0xd6cd('0xe'));var Redis=require(_0xd6cd('0xf'));var authService=require(_0xd6cd('0x10'));var qs=require(_0xd6cd('0x11'));var as=require(_0xd6cd('0x12'));var hardwareService=require(_0xd6cd('0x13'));var logger=require(_0xd6cd('0x14'))(_0xd6cd('0x15'));var utils=require(_0xd6cd('0x16'));var config=require(_0xd6cd('0x17'));var licenseUtil=require(_0xd6cd('0x18'));var db=require('../../mysqldb')['db'];config[_0xd6cd('0x19')]=_[_0xd6cd('0x1a')](config['redis'],{'host':_0xd6cd('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6cd('0x19')]));require('./chatQueue.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xd6cd('0x1c')][_0xd6cd('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3a07b1,_0x52493f,_0x3a37c5,_0x6115bc){return new BPromise(function(_0x325e42,_0x3a2303){var _0x18fc01=_0x6115bc||client;return _0x18fc01[_0xd6cd('0x1e')](_0x3a07b1,_0x3a37c5)[_0xd6cd('0x1f')](function(_0x443a03){logger[_0xd6cd('0x20')](_0xd6cd('0x21'),_0x52493f,_0xd6cd('0x22'));logger['debug'](_0xd6cd('0x23'),_0x52493f,_0xd6cd('0x22'),JSON[_0xd6cd('0x24')](_0x443a03));if(_0x443a03[_0xd6cd('0x25')]){if(_0x443a03[_0xd6cd('0x25')][_0xd6cd('0x26')]===0x1f4){logger[_0xd6cd('0x25')]('ChatQueue,\x20%s,\x20%s',_0x52493f,_0x443a03[_0xd6cd('0x25')][_0xd6cd('0x27')]);return _0x3a2303(_0x443a03[_0xd6cd('0x25')]['message']);}logger['error'](_0xd6cd('0x21'),_0x52493f,_0x443a03[_0xd6cd('0x25')]['message']);return _0x325e42(_0x443a03[_0xd6cd('0x25')][_0xd6cd('0x27')]);}else{logger[_0xd6cd('0x20')](_0xd6cd('0x21'),_0x52493f,_0xd6cd('0x22'));_0x325e42(_0x443a03[_0xd6cd('0x28')][_0xd6cd('0x27')]);}})[_0xd6cd('0x29')](function(_0x519a78){logger['error'](_0xd6cd('0x21'),_0x52493f,_0x519a78);_0x3a2303(_0x519a78);});});}function respondWithStatusCode(_0x4c74c4,_0x14ad61){_0x14ad61=_0x14ad61||0xcc;return function(_0xd10b09){if(_0xd10b09){return _0x4c74c4[_0xd6cd('0x2a')](_0x14ad61);}return _0x4c74c4[_0xd6cd('0x2b')](_0x14ad61)['end']();};}function respondWithResult(_0x14138d,_0x143f18){_0x143f18=_0x143f18||0xc8;return function(_0xf2cc3c){if(_0xf2cc3c){return _0x14138d[_0xd6cd('0x2b')](_0x143f18)[_0xd6cd('0x2c')](_0xf2cc3c);}};}function respondWithFilteredResult(_0x290b44,_0x39a158){return function(_0x5b0590){if(_0x5b0590){var _0x2e0f0e=typeof _0x39a158['offset']==='undefined'&&typeof _0x39a158[_0xd6cd('0x2d')]==='undefined';var _0x290d7e=_0x5b0590[_0xd6cd('0x2e')];var _0x19c7b7=_0x2e0f0e?0x0:_0x39a158[_0xd6cd('0x2f')];var _0x122fba=_0x2e0f0e?_0x5b0590[_0xd6cd('0x2e')]:_0x39a158[_0xd6cd('0x2f')]+_0x39a158[_0xd6cd('0x2d')];var _0x377a99;if(_0x122fba>=_0x290d7e){_0x122fba=_0x290d7e;_0x377a99=0xc8;}else{_0x377a99=0xce;}_0x290b44[_0xd6cd('0x2b')](_0x377a99);return _0x290b44[_0xd6cd('0x30')](_0xd6cd('0x31'),_0x19c7b7+'-'+_0x122fba+'/'+_0x290d7e)[_0xd6cd('0x2c')](_0x5b0590);}return null;};}function patchUpdates(_0x5ebefb){return function(_0x1e59e2){try{jsonpatch[_0xd6cd('0x32')](_0x1e59e2,_0x5ebefb,!![]);}catch(_0x28ca1c){return BPromise[_0xd6cd('0x33')](_0x28ca1c);}return _0x1e59e2[_0xd6cd('0x34')]();};}function saveUpdates(_0x155850,_0x2a4a07){return function(_0x3e6614){if(_0x3e6614){return _0x3e6614[_0xd6cd('0x35')](_0x155850)[_0xd6cd('0x1f')](function(_0x189b55){return _0x189b55;});}return null;};}function removeEntity(_0x5bf695,_0x1d4f99){return function(_0x1e70a4){if(_0x1e70a4){return _0x1e70a4[_0xd6cd('0x36')]()[_0xd6cd('0x1f')](function(){var _0x30f884=_0x1e70a4[_0xd6cd('0x37')]({'plain':!![]});var _0x3f982a=_0xd6cd('0x38');return db[_0xd6cd('0x39')][_0xd6cd('0x36')]({'where':{'type':_0x3f982a,'resourceId':_0x30f884['id']}})['then'](function(){return _0x1e70a4;});})['then'](function(){_0x5bf695['status'](0xcc)[_0xd6cd('0x3a')]();});}};}function handleEntityNotFound(_0x43f89f,_0x58ac7b){return function(_0x15b0e3){if(!_0x15b0e3){_0x43f89f[_0xd6cd('0x2a')](0x194);}return _0x15b0e3;};}function handleError(_0x2ba09c,_0x58531){_0x58531=_0x58531||0x1f4;return function(_0x40bc3f){logger['error'](_0x40bc3f['stack']);if(_0x40bc3f[_0xd6cd('0x3b')]){delete _0x40bc3f[_0xd6cd('0x3b')];}_0x2ba09c['status'](_0x58531)['send'](_0x40bc3f);};}exports[_0xd6cd('0x3c')]=function(_0x14c087,_0x1b2d65){var _0xc3bce4={},_0xdb3653={},_0x3f0ddc={'count':0x0,'rows':[]};var _0x1f8cc1=_['map'](db[_0xd6cd('0x3d')][_0xd6cd('0x3e')],function(_0x2179ba){return{'name':_0x2179ba['fieldName'],'type':_0x2179ba[_0xd6cd('0x3f')][_0xd6cd('0x40')]};});_0xdb3653[_0xd6cd('0x41')]=_['map'](_0x1f8cc1,_0xd6cd('0x3b'));_0xdb3653[_0xd6cd('0x42')]=_[_0xd6cd('0x43')](_0x14c087[_0xd6cd('0x42')]);_0xdb3653['filters']=_[_0xd6cd('0x44')](_0xdb3653['model'],_0xdb3653[_0xd6cd('0x42')]);_0xc3bce4[_0xd6cd('0x45')]=_[_0xd6cd('0x44')](_0xdb3653['model'],qs['fields'](_0x14c087['query'][_0xd6cd('0x46')]));_0xc3bce4[_0xd6cd('0x45')]=_0xc3bce4[_0xd6cd('0x45')][_0xd6cd('0x47')]?_0xc3bce4[_0xd6cd('0x45')]:_0xdb3653[_0xd6cd('0x41')];if(!_0x14c087['query'][_0xd6cd('0x48')](_0xd6cd('0x49'))){_0xc3bce4[_0xd6cd('0x2d')]=qs[_0xd6cd('0x2d')](_0x14c087[_0xd6cd('0x42')][_0xd6cd('0x2d')]);_0xc3bce4[_0xd6cd('0x2f')]=qs[_0xd6cd('0x2f')](_0x14c087[_0xd6cd('0x42')][_0xd6cd('0x2f')]);}_0xc3bce4[_0xd6cd('0x4a')]=qs[_0xd6cd('0x4b')](_0x14c087[_0xd6cd('0x42')][_0xd6cd('0x4b')]);_0xc3bce4['where']=qs[_0xd6cd('0x4c')](_[_0xd6cd('0x4d')](_0x14c087[_0xd6cd('0x42')],_0xdb3653['filters']),_0x1f8cc1);if(_0x14c087[_0xd6cd('0x42')][_0xd6cd('0x4e')]){_0xc3bce4[_0xd6cd('0x4f')]=_[_0xd6cd('0x50')](_0xc3bce4['where'],{'$or':_['map'](_0x1f8cc1,function(_0x42b647){if(_0x42b647['type']!==_0xd6cd('0x51')){var _0x431d5d={};_0x431d5d[_0x42b647[_0xd6cd('0x3b')]]={'$like':'%'+_0x14c087[_0xd6cd('0x42')]['filter']+'%'};return _0x431d5d;}})});}_0xc3bce4=_[_0xd6cd('0x50')]({},_0xc3bce4,_0x14c087[_0xd6cd('0x52')]);var _0x5e3420={'where':_0xc3bce4['where']};return db[_0xd6cd('0x3d')][_0xd6cd('0x2e')](_0x5e3420)[_0xd6cd('0x1f')](function(_0x473935){_0x3f0ddc[_0xd6cd('0x2e')]=_0x473935;if(_0x14c087[_0xd6cd('0x42')][_0xd6cd('0x53')]){_0xc3bce4[_0xd6cd('0x54')]=[{'all':!![]}];}return db[_0xd6cd('0x3d')][_0xd6cd('0x55')](_0xc3bce4);})[_0xd6cd('0x1f')](function(_0x13b879){_0x3f0ddc['rows']=_0x13b879;return _0x3f0ddc;})[_0xd6cd('0x1f')](respondWithFilteredResult(_0x1b2d65,_0xc3bce4))[_0xd6cd('0x29')](handleError(_0x1b2d65,null));};exports[_0xd6cd('0x56')]=function(_0x57d296,_0x5de8ea){var _0x3c506b={'raw':!![],'where':{'id':_0x57d296['params']['id']}},_0x549d3f={};_0x549d3f[_0xd6cd('0x41')]=_[_0xd6cd('0x43')](db[_0xd6cd('0x3d')][_0xd6cd('0x3e')]);_0x549d3f['query']=_[_0xd6cd('0x43')](_0x57d296['query']);_0x549d3f['filters']=_[_0xd6cd('0x44')](_0x549d3f[_0xd6cd('0x41')],_0x549d3f[_0xd6cd('0x42')]);_0x3c506b[_0xd6cd('0x45')]=_[_0xd6cd('0x44')](_0x549d3f[_0xd6cd('0x41')],qs[_0xd6cd('0x46')](_0x57d296[_0xd6cd('0x42')]['fields']));_0x3c506b[_0xd6cd('0x45')]=_0x3c506b['attributes'][_0xd6cd('0x47')]?_0x3c506b['attributes']:_0x549d3f['model'];if(_0x57d296[_0xd6cd('0x42')][_0xd6cd('0x53')]){_0x3c506b[_0xd6cd('0x54')]=[{'all':!![]}];}_0x3c506b=_[_0xd6cd('0x50')]({},_0x3c506b,_0x57d296['options']);return db['ChatQueue'][_0xd6cd('0x57')](_0x3c506b)[_0xd6cd('0x1f')](handleEntityNotFound(_0x5de8ea,null))[_0xd6cd('0x1f')](respondWithResult(_0x5de8ea,null))[_0xd6cd('0x29')](handleError(_0x5de8ea,null));};exports[_0xd6cd('0x58')]=function(_0x430515,_0x3cad35){return db[_0xd6cd('0x3d')][_0xd6cd('0x58')](_0x430515[_0xd6cd('0x59')],{})[_0xd6cd('0x1f')](function(_0x24d512){var _0x1e5e96=_0x430515['user'][_0xd6cd('0x37')]({'plain':!![]});if(!_0x1e5e96)throw new Error(_0xd6cd('0x5a'));if(_0x1e5e96[_0xd6cd('0x5b')]===_0xd6cd('0x5c')){var _0x2e96a0=_0x24d512[_0xd6cd('0x37')]({'plain':!![]});var _0x592346='ChatQueues';return db[_0xd6cd('0x5d')][_0xd6cd('0x57')]({'where':{'name':_0x592346,'userProfileId':_0x1e5e96['userProfileId']},'raw':!![]})['then'](function(_0x23f08b){if(_0x23f08b&&_0x23f08b['autoAssociation']===0x0){return db[_0xd6cd('0x39')][_0xd6cd('0x58')]({'name':_0x2e96a0['name'],'resourceId':_0x2e96a0['id'],'type':_0x23f08b[_0xd6cd('0x3b')],'sectionId':_0x23f08b['id']},{})[_0xd6cd('0x1f')](function(){return _0x24d512;});}else{return _0x24d512;}})[_0xd6cd('0x29')](function(_0x5b791d){logger['error'](_0xd6cd('0x5e'),_0x5b791d);throw _0x5b791d;});}return _0x24d512;})[_0xd6cd('0x1f')](respondWithResult(_0x3cad35,0xc9))[_0xd6cd('0x29')](handleError(_0x3cad35,null));};exports['update']=function(_0x32dba6,_0x3bf277){if(_0x32dba6[_0xd6cd('0x59')]['id']){delete _0x32dba6[_0xd6cd('0x59')]['id'];}return db[_0xd6cd('0x3d')]['find']({'where':{'id':_0x32dba6['params']['id']}})[_0xd6cd('0x1f')](handleEntityNotFound(_0x3bf277,null))[_0xd6cd('0x1f')](saveUpdates(_0x32dba6[_0xd6cd('0x59')],null))['then'](respondWithResult(_0x3bf277,null))[_0xd6cd('0x29')](handleError(_0x3bf277,null));};exports['destroy']=function(_0x2fb258,_0x3c5271){return db['ChatQueue'][_0xd6cd('0x57')]({'where':{'id':_0x2fb258[_0xd6cd('0x5f')]['id']}})[_0xd6cd('0x1f')](handleEntityNotFound(_0x3c5271,null))[_0xd6cd('0x1f')](removeEntity(_0x3c5271,null))[_0xd6cd('0x29')](handleError(_0x3c5271,null));};exports[_0xd6cd('0x60')]=function(_0x3f5db3,_0x102265){return db[_0xd6cd('0x3d')][_0xd6cd('0x60')]()[_0xd6cd('0x1f')](respondWithResult(_0x102265,null))['catch'](handleError(_0x102265,null));};exports[_0xd6cd('0x61')]=function(_0x36f648,_0x580fb2,_0x3a0cc6){var _0x4e0b63={'raw':!![],'where':{}},_0x5436d9={},_0x241da3;return db['ChatQueue'][_0xd6cd('0x62')]({'where':{'id':_0x36f648[_0xd6cd('0x5f')]['id']}})['then'](handleEntityNotFound(_0x580fb2,null))[_0xd6cd('0x1f')](function(_0x59dfb4){if(_0x59dfb4){_0x241da3=_0x59dfb4[_0xd6cd('0x37')]({'plain':!![]});_0x5436d9[_0xd6cd('0x41')]=_['keys'](db['UserChatQueue'][_0xd6cd('0x3e')]);_0x5436d9[_0xd6cd('0x42')]=_[_0xd6cd('0x43')](_0x36f648[_0xd6cd('0x42')]);_0x5436d9[_0xd6cd('0x4c')]=_[_0xd6cd('0x44')](_0x5436d9['model'],_0x5436d9[_0xd6cd('0x42')]);_0x4e0b63['attributes']=_['intersection'](_0x5436d9[_0xd6cd('0x41')],qs['fields'](_0x36f648[_0xd6cd('0x42')][_0xd6cd('0x46')]));_0x4e0b63[_0xd6cd('0x45')]=_0x4e0b63[_0xd6cd('0x45')][_0xd6cd('0x47')]?_0x4e0b63[_0xd6cd('0x45')]:_0x5436d9[_0xd6cd('0x41')];if(!_0x36f648[_0xd6cd('0x42')][_0xd6cd('0x48')](_0xd6cd('0x49'))){_0x4e0b63[_0xd6cd('0x2d')]=qs[_0xd6cd('0x2d')](_0x36f648[_0xd6cd('0x42')][_0xd6cd('0x2d')]);_0x4e0b63[_0xd6cd('0x2f')]=qs[_0xd6cd('0x2f')](_0x36f648[_0xd6cd('0x42')][_0xd6cd('0x2f')]);}_0x4e0b63[_0xd6cd('0x4a')]=qs['sort'](_0x36f648[_0xd6cd('0x42')]['sort']);_0x4e0b63['where']=qs['filters'](_[_0xd6cd('0x4d')](_0x36f648['query'],_0x5436d9[_0xd6cd('0x4c')]));_0x4e0b63[_0xd6cd('0x4f')]['ChatQueueId']=_0x59dfb4['id'];if(_0x36f648[_0xd6cd('0x42')]['filter']){_0x4e0b63[_0xd6cd('0x4f')]=_[_0xd6cd('0x50')](_0x4e0b63['where'],{'$or':_[_0xd6cd('0x63')](_0x4e0b63['attributes'],function(_0x37d52c){var _0x32063a={};_0x32063a[_0x37d52c]={'$like':'%'+_0x36f648[_0xd6cd('0x42')][_0xd6cd('0x4e')]+'%'};return _0x32063a;})});}_0x4e0b63=_[_0xd6cd('0x50')]({},_0x4e0b63,_0x36f648[_0xd6cd('0x52')]);return db['UserChatQueue'][_0xd6cd('0x55')](_0x4e0b63);}})['then'](function(_0x491a1c){if(_0x491a1c){return db['User'][_0xd6cd('0x64')]({'where':{'id':_[_0xd6cd('0x63')](_0x491a1c,'UserId'),'role':_0xd6cd('0x65')},'attributes':['id','name',_0xd6cd('0x66'),'updatedAt',_0xd6cd('0x67')]});}})[_0xd6cd('0x1f')](function(_0x302088){if(_0x302088){return{'count':_0x302088[_0xd6cd('0x2e')],'rows':_[_0xd6cd('0x63')](_0x302088[_0xd6cd('0x68')],function(_0x5b3e40){return{'membername':_0x5b3e40[_0xd6cd('0x3b')],'UserId':_0x5b3e40['id'],'queue_name':_0x241da3[_0xd6cd('0x3b')],'ChatQueueId':_0x241da3['id'],'interface':util[_0xd6cd('0x69')](_0xd6cd('0x6a'),_0xd6cd('0x6b'),_0x5b3e40[_0xd6cd('0x3b')]),'penalty':0x0,'paused':_0x5b3e40[_0xd6cd('0x66')],'createdAt':_0x5b3e40[_0xd6cd('0x67')],'updatedAt':_0x5b3e40[_0xd6cd('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd6cd('0x1f')](respondWithFilteredResult(_0x580fb2,_0x4e0b63))[_0xd6cd('0x29')](handleError(_0x580fb2,null));};exports['getTeams']=function(_0xfef063,_0x51d989,_0x2a8f3a){var _0x7d1cb5={};var _0x152a13={};var _0x29fa4c;var _0x2f494f;return db[_0xd6cd('0x3d')][_0xd6cd('0x62')]({'where':{'id':_0xfef063[_0xd6cd('0x5f')]['id']}})[_0xd6cd('0x1f')](handleEntityNotFound(_0x51d989,null))[_0xd6cd('0x1f')](function(_0x1c8d42){if(_0x1c8d42){_0x29fa4c=_0x1c8d42;_0x152a13[_0xd6cd('0x41')]=_[_0xd6cd('0x43')](db[_0xd6cd('0x6d')][_0xd6cd('0x3e')]);_0x152a13[_0xd6cd('0x42')]=_[_0xd6cd('0x43')](_0xfef063[_0xd6cd('0x42')]);_0x152a13[_0xd6cd('0x4c')]=_[_0xd6cd('0x44')](_0x152a13[_0xd6cd('0x41')],_0x152a13[_0xd6cd('0x42')]);_0x7d1cb5[_0xd6cd('0x45')]=_[_0xd6cd('0x44')](_0x152a13[_0xd6cd('0x41')],qs['fields'](_0xfef063[_0xd6cd('0x42')][_0xd6cd('0x46')]));_0x7d1cb5['attributes']=_0x7d1cb5[_0xd6cd('0x45')][_0xd6cd('0x47')]?_0x7d1cb5[_0xd6cd('0x45')]:_0x152a13[_0xd6cd('0x41')];_0x7d1cb5[_0xd6cd('0x4a')]=qs[_0xd6cd('0x4b')](_0xfef063['query']['sort']);_0x7d1cb5[_0xd6cd('0x4f')]=qs[_0xd6cd('0x4c')](_[_0xd6cd('0x4d')](_0xfef063['query'],_0x152a13[_0xd6cd('0x4c')]));if(_0xfef063[_0xd6cd('0x42')][_0xd6cd('0x4e')]){_0x7d1cb5[_0xd6cd('0x4f')]=_['merge'](_0x7d1cb5[_0xd6cd('0x4f')],{'$or':_['map'](_0x7d1cb5[_0xd6cd('0x45')],function(_0x126a22){var _0x7c5250={};_0x7c5250[_0x126a22]={'$like':'%'+_0xfef063[_0xd6cd('0x42')]['filter']+'%'};return _0x7c5250;})});}_0x7d1cb5=_['merge']({},_0x7d1cb5,_0xfef063['options']);return _0x29fa4c[_0xd6cd('0x6e')](_0x7d1cb5);}})[_0xd6cd('0x1f')](function(_0x1af133){if(_0x1af133){_0x2f494f=_0x1af133[_0xd6cd('0x47')];if(!_0xfef063[_0xd6cd('0x42')][_0xd6cd('0x48')](_0xd6cd('0x49'))){_0x7d1cb5[_0xd6cd('0x2d')]=qs[_0xd6cd('0x2d')](_0xfef063[_0xd6cd('0x42')][_0xd6cd('0x2d')]);_0x7d1cb5[_0xd6cd('0x2f')]=qs[_0xd6cd('0x2f')](_0xfef063['query'][_0xd6cd('0x2f')]);}return _0x29fa4c[_0xd6cd('0x6e')](_0x7d1cb5);}})[_0xd6cd('0x1f')](function(_0x1f89b8){if(_0x1f89b8){return _0x1f89b8?{'count':_0x2f494f,'rows':_0x1f89b8}:null;}})[_0xd6cd('0x1f')](respondWithResult(_0x51d989,null))['catch'](handleError(_0x51d989,null));};exports[_0xd6cd('0x6f')]=function(_0x1a4d0f,_0x29dde2,_0x4acd26){var _0x4bac71=_0x1a4d0f[_0xd6cd('0x59')][_0xd6cd('0x70')];return db['Team'][_0xd6cd('0x55')]({'where':{'id':_0x4bac71},'attributes':['id'],'include':[{'model':db[_0xd6cd('0x71')],'as':_0xd6cd('0x72'),'attributes':['id','name',_0xd6cd('0x73'),_0xd6cd('0x74'),_0xd6cd('0x75')],'raw':!![]}]})[_0xd6cd('0x1f')](function(_0x5006dc){if(_0x5006dc){var _0xda04d3=_[_0xd6cd('0x76')](_0x5006dc,function(_0x56c65c){var _0x111ba9=_0x56c65c[_0xd6cd('0x37')]({'plain':!![]});return _0x111ba9[_0xd6cd('0x72')];});return db['ChatQueue'][_0xd6cd('0x57')]({'where':{'id':_0x1a4d0f[_0xd6cd('0x5f')]['id']}})[_0xd6cd('0x1f')](function(_0x59750e){return db[_0xd6cd('0x77')][_0xd6cd('0x78')](function(_0x1bee44){return _0x59750e[_0xd6cd('0x6f')](_0x4bac71,{'transaction':_0x1bee44})['then'](function(){return BPromise[_0xd6cd('0x79')](_0xda04d3,function(_0x6b8072){return db[_0xd6cd('0x7a')]['findOrCreate']({'where':{'UserId':_0x6b8072['id'],'ChatQueueId':_0x1a4d0f[_0xd6cd('0x5f')]['id']},'transaction':_0x1bee44});});})[_0xd6cd('0x1f')](function(){_0xda04d3['forEach'](function(_0x5e852b){socket[_0xd6cd('0x7b')]('userChatQueue:save',{'UserId':_0x5e852b['id'],'ChatQueueId':_0x59750e['id']});});});});});}})[_0xd6cd('0x1f')](respondWithStatusCode(_0x29dde2,null))['catch'](handleError(_0x29dde2,null));};exports[_0xd6cd('0x7c')]=function(_0x2fda8f,_0x265ded,_0x5262e1){return db[_0xd6cd('0x6d')]['findAll']({'where':{'id':_0x2fda8f[_0xd6cd('0x42')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd6cd('0x71')],'as':_0xd6cd('0x72'),'attributes':['id'],'raw':!![]}]})[_0xd6cd('0x1f')](handleEntityNotFound(_0x265ded,null))[_0xd6cd('0x1f')](function(_0x4d7c52){var _0x1cefcd=_['map'](_0x4d7c52,'id');var _0x2f8239=[];var _0x1a971f=[];var _0x3804b8=squel[_0xd6cd('0x7d')]();_0x3804b8[_0xd6cd('0x7e')](_0xd6cd('0x7f'))[_0xd6cd('0x80')](_0xd6cd('0x81'),'tq')[_0xd6cd('0x82')]('user_has_teams','ut',_0xd6cd('0x83'))[_0xd6cd('0x4f')](_0xd6cd('0x84'),_0x2fda8f[_0xd6cd('0x5f')]['id']);for(var _0x310a6d=0x0;_0x310a6d<_0x4d7c52['length'];_0x310a6d+=0x1){let _0x465189=_0x4d7c52[_0x310a6d];for(var _0x27b9dc=0x0;_0x27b9dc<_0x465189[_0xd6cd('0x72')][_0xd6cd('0x47')];_0x27b9dc+=0x1){let _0x27beae=_0x465189['Agents'][_0x27b9dc];var _0x1047cd=_0x3804b8[_0xd6cd('0x85')]();_0x1047cd[_0xd6cd('0x4f')](_0xd6cd('0x86'),_0x27beae['id']);_0x1a971f[_0xd6cd('0x87')](db['sequelize'][_0xd6cd('0x42')](_0x1047cd[_0xd6cd('0x88')](),{'type':db['sequelize'][_0xd6cd('0x89')][_0xd6cd('0x8a')]})[_0xd6cd('0x1f')](function(_0x4e7a37){if(_0x4e7a37[_0xd6cd('0x47')]===0x1){return _0x27beae['id'];}else{var _0x2c1022=_[_0xd6cd('0x8b')](_['map'](_0x4e7a37,_0xd6cd('0x8c')),function(_0x13afb9){return _[_0xd6cd('0x8d')](_0x1cefcd,_0x13afb9);});if(_0x2c1022){return _0x27beae['id'];}}}));}}return BPromise[_0xd6cd('0x8e')](_0x1a971f)[_0xd6cd('0x1f')](function(_0x1b1fe4){_0x2f8239=_(_0x2f8239)['union'](_0x1b1fe4)[_0xd6cd('0x8f')]()[_0xd6cd('0x90')]();return db[_0xd6cd('0x3d')][_0xd6cd('0x57')]({'where':{'id':_0x2fda8f[_0xd6cd('0x5f')]['id']}})[_0xd6cd('0x1f')](function(_0x5055d5){return db[_0xd6cd('0x77')][_0xd6cd('0x78')](function(_0x1faaf6){return _0x5055d5['removeTeams'](_0x2fda8f[_0xd6cd('0x42')]['ids'],{'transaction':_0x1faaf6})[_0xd6cd('0x1f')](function(){if(!_['isEmpty'](_0x2f8239)){return _0x5055d5[_0xd6cd('0x91')](_0x2f8239,{'transaction':_0x1faaf6});}})[_0xd6cd('0x1f')](function(){_0x2f8239[_0xd6cd('0x92')](function(_0x5ba67c){socket['emit'](_0xd6cd('0x93'),{'UserId':_0x5ba67c,'ChatQueueId':_0x5055d5['id']});});});});});});})[_0xd6cd('0x1f')](respondWithStatusCode(_0x265ded,null))[_0xd6cd('0x29')](handleError(_0x265ded,null));};exports[_0xd6cd('0x94')]=function(_0x220211,_0xbd0767,_0x50d3e0){return db[_0xd6cd('0x3d')][_0xd6cd('0x57')]({'where':{'id':_0x220211[_0xd6cd('0x5f')]['id']}})['then'](handleEntityNotFound(_0xbd0767,null))['then'](function(_0x23a5c9){if(_0x23a5c9){return _0x23a5c9[_0xd6cd('0x94')](_0x220211['body'][_0xd6cd('0x70')],_[_0xd6cd('0x95')](_0x220211[_0xd6cd('0x59')],[_0xd6cd('0x70'),'id'])||{})['spread'](function(_0x470d7e){for(var _0x58adad=0x0;_0x58adad<_0x220211[_0xd6cd('0x59')][_0xd6cd('0x70')][_0xd6cd('0x47')];_0x58adad+=0x1){socket[_0xd6cd('0x7b')]('userChatQueue:save',{'UserId':Number(_0x220211[_0xd6cd('0x59')]['ids'][_0x58adad]),'ChatQueueId':Number(_0x220211[_0xd6cd('0x5f')]['id'])});}return _0x470d7e;});}})[_0xd6cd('0x1f')](respondWithResult(_0xbd0767,null))[_0xd6cd('0x29')](handleError(_0xbd0767,null));};exports['removeAgents']=function(_0x3a5604,_0x38a217,_0x152ae0){return db['ChatQueue'][_0xd6cd('0x57')]({'where':{'id':_0x3a5604[_0xd6cd('0x5f')]['id']}})[_0xd6cd('0x1f')](handleEntityNotFound(_0x38a217,null))[_0xd6cd('0x1f')](function(_0x3d2381){if(_0x3d2381){return _0x3d2381[_0xd6cd('0x91')](_0x3a5604[_0xd6cd('0x42')]['ids'])[_0xd6cd('0x1f')](function(){if(_[_0xd6cd('0x96')](_0x3a5604[_0xd6cd('0x42')][_0xd6cd('0x70')])){for(var _0x31d63e=0x0;_0x31d63e<_0x3a5604[_0xd6cd('0x42')][_0xd6cd('0x70')][_0xd6cd('0x47')];_0x31d63e+=0x1){socket[_0xd6cd('0x7b')](_0xd6cd('0x93'),{'UserId':Number(_0x3a5604[_0xd6cd('0x42')][_0xd6cd('0x70')][_0x31d63e]),'ChatQueueId':Number(_0x3a5604[_0xd6cd('0x5f')]['id'])});}}else{socket['emit'](_0xd6cd('0x93'),{'UserId':Number(_0x3a5604['query']['ids']),'ChatQueueId':Number(_0x3a5604['params']['id'])});}});}})[_0xd6cd('0x1f')](respondWithStatusCode(_0x38a217,null))[_0xd6cd('0x29')](handleError(_0x38a217,null));};exports['getAgents']=function(_0xf92a66,_0x46ce19,_0x249473){var _0x383ea2={};var _0x174b6c={};var _0x5ed84d;var _0x76e717;return db['ChatQueue']['findOne']({'where':{'id':_0xf92a66['params']['id']}})[_0xd6cd('0x1f')](handleEntityNotFound(_0x46ce19,null))[_0xd6cd('0x1f')](function(_0x5a551f){if(_0x5a551f){_0x5ed84d=_0x5a551f;_0x174b6c[_0xd6cd('0x41')]=_['keys'](db[_0xd6cd('0x71')][_0xd6cd('0x3e')]);_0x174b6c[_0xd6cd('0x42')]=_[_0xd6cd('0x43')](_0xf92a66['query']);_0x174b6c[_0xd6cd('0x4c')]=_[_0xd6cd('0x44')](_0x174b6c[_0xd6cd('0x41')],_0x174b6c[_0xd6cd('0x42')]);_0x383ea2[_0xd6cd('0x45')]=_[_0xd6cd('0x44')](_0x174b6c[_0xd6cd('0x41')],qs[_0xd6cd('0x46')](_0xf92a66[_0xd6cd('0x42')][_0xd6cd('0x46')]));_0x383ea2[_0xd6cd('0x45')]=_0x383ea2[_0xd6cd('0x45')][_0xd6cd('0x47')]?_0x383ea2[_0xd6cd('0x45')]:_0x174b6c[_0xd6cd('0x41')];_0x383ea2['order']=qs[_0xd6cd('0x4b')](_0xf92a66['query']['sort']);_0x383ea2[_0xd6cd('0x4f')]=qs['filters'](_['pick'](_0xf92a66['query'],_0x174b6c[_0xd6cd('0x4c')]));if(_0xf92a66[_0xd6cd('0x42')][_0xd6cd('0x4e')]){_0x383ea2[_0xd6cd('0x4f')]=_[_0xd6cd('0x50')](_0x383ea2[_0xd6cd('0x4f')],{'$or':_['map'](_0x383ea2[_0xd6cd('0x45')],function(_0x3900b2){var _0x24e8cf={};_0x24e8cf[_0x3900b2]={'$like':'%'+_0xf92a66[_0xd6cd('0x42')][_0xd6cd('0x4e')]+'%'};return _0x24e8cf;})});}_0x383ea2=_['merge']({},_0x383ea2,_0xf92a66['options']);return _0x5ed84d[_0xd6cd('0x97')](_0x383ea2);}})[_0xd6cd('0x1f')](function(_0x2a43db){if(_0x2a43db){_0x76e717=_0x2a43db['length'];if(!_0xf92a66[_0xd6cd('0x42')][_0xd6cd('0x48')]('nolimit')){_0x383ea2[_0xd6cd('0x2d')]=qs['limit'](_0xf92a66['query'][_0xd6cd('0x2d')]);_0x383ea2[_0xd6cd('0x2f')]=qs[_0xd6cd('0x2f')](_0xf92a66['query'][_0xd6cd('0x2f')]);}return _0x5ed84d['getAgents'](_0x383ea2);}})['then'](function(_0x19ac6c){if(_0x19ac6c){return _0x19ac6c?{'count':_0x76e717,'rows':_0x19ac6c}:null;}})['then'](respondWithResult(_0x46ce19,null))[_0xd6cd('0x29')](handleError(_0x46ce19,null));}; \ No newline at end of file +var _0xb0ad=['localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','findAll','rows','includeAll','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','body','params','describe','getMembers','findOne','UserChatQueue','findAndCountAll','agent','chatPause','updatedAt','format','%s/%s','getTeams','addTeams','ids','Team','User','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ChatQueueId\x20=\x20?','clone','push','sequelize','every','TeamId','all','compact','value','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','order','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis'];(function(_0x1ff192,_0x350338){var _0x11f5ad=function(_0x492244){while(--_0x492244){_0x1ff192['push'](_0x1ff192['shift']());}};_0x11f5ad(++_0x350338);}(_0xb0ad,0x113));var _0xdb0a=function(_0x46fc52,_0x1dcbe4){_0x46fc52=_0x46fc52-0x0;var _0x3a4be0=_0xb0ad[_0x46fc52];return _0x3a4be0;};'use strict';var emlformat=require(_0xdb0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb0a('0x1'));var jsonpatch=require(_0xdb0a('0x2'));var rp=require(_0xdb0a('0x3'));var moment=require('moment');var BPromise=require(_0xdb0a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdb0a('0x5'));var sox=require(_0xdb0a('0x6'));var csv=require(_0xdb0a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdb0a('0x8'));var squel=require(_0xdb0a('0x9'));var crypto=require(_0xdb0a('0xa'));var jsforce=require(_0xdb0a('0xb'));var deskjs=require(_0xdb0a('0xc'));var toCsv=require(_0xdb0a('0x7'));var querystring=require(_0xdb0a('0xd'));var Papa=require(_0xdb0a('0xe'));var Redis=require(_0xdb0a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdb0a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb0a('0x11'))(_0xdb0a('0x12'));var utils=require(_0xdb0a('0x13'));var config=require(_0xdb0a('0x14'));var licenseUtil=require(_0xdb0a('0x15'));var db=require(_0xdb0a('0x16'))['db'];config['redis']=_[_0xdb0a('0x17')](config[_0xdb0a('0x18')],{'host':_0xdb0a('0x19'),'port':0x18eb});var socket=require(_0xdb0a('0x1a'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xdb0a('0x1b')](socket);var jayson=require(_0xdb0a('0x1c'));var client=jayson[_0xdb0a('0x1d')][_0xdb0a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xd6f476,_0x3a12c3,_0x5711c7,_0x43415d){return new BPromise(function(_0x45223d,_0x595fc0){var _0x401fc2=_0x43415d||client;return _0x401fc2['request'](_0xd6f476,_0x5711c7)[_0xdb0a('0x1f')](function(_0xdd4568){logger[_0xdb0a('0x20')](_0xdb0a('0x21'),_0x3a12c3,_0xdb0a('0x22'));logger[_0xdb0a('0x23')](_0xdb0a('0x24'),_0x3a12c3,_0xdb0a('0x22'),JSON[_0xdb0a('0x25')](_0xdd4568));if(_0xdd4568[_0xdb0a('0x26')]){if(_0xdd4568[_0xdb0a('0x26')]['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x3a12c3,_0xdd4568[_0xdb0a('0x26')][_0xdb0a('0x27')]);return _0x595fc0(_0xdd4568[_0xdb0a('0x26')][_0xdb0a('0x27')]);}logger[_0xdb0a('0x26')](_0xdb0a('0x21'),_0x3a12c3,_0xdd4568[_0xdb0a('0x26')][_0xdb0a('0x27')]);return _0x45223d(_0xdd4568[_0xdb0a('0x26')]['message']);}else{logger[_0xdb0a('0x20')]('ChatQueue,\x20%s,\x20%s',_0x3a12c3,_0xdb0a('0x22'));_0x45223d(_0xdd4568[_0xdb0a('0x28')][_0xdb0a('0x27')]);}})[_0xdb0a('0x29')](function(_0x406246){logger[_0xdb0a('0x26')]('ChatQueue,\x20%s,\x20%s',_0x3a12c3,_0x406246);_0x595fc0(_0x406246);});});}function respondWithStatusCode(_0x5ab7a6,_0x1153a2){_0x1153a2=_0x1153a2||0xcc;return function(_0xf1a2c8){if(_0xf1a2c8){return _0x5ab7a6[_0xdb0a('0x2a')](_0x1153a2);}return _0x5ab7a6[_0xdb0a('0x2b')](_0x1153a2)['end']();};}function respondWithResult(_0x3f5b2d,_0x448d59){_0x448d59=_0x448d59||0xc8;return function(_0x3bce13){if(_0x3bce13){return _0x3f5b2d[_0xdb0a('0x2b')](_0x448d59)[_0xdb0a('0x2c')](_0x3bce13);}};}function respondWithFilteredResult(_0xb98459,_0x26a327){return function(_0x26fce9){if(_0x26fce9){var _0x3b586c=typeof _0x26a327[_0xdb0a('0x2d')]===_0xdb0a('0x2e')&&typeof _0x26a327[_0xdb0a('0x2f')]===_0xdb0a('0x2e');var _0x1052a2=_0x26fce9[_0xdb0a('0x30')];var _0x3e49d4=_0x3b586c?0x0:_0x26a327['offset'];var _0x532870=_0x3b586c?_0x26fce9['count']:_0x26a327[_0xdb0a('0x2d')]+_0x26a327[_0xdb0a('0x2f')];var _0x244fdf;if(_0x532870>=_0x1052a2){_0x532870=_0x1052a2;_0x244fdf=0xc8;}else{_0x244fdf=0xce;}_0xb98459['status'](_0x244fdf);return _0xb98459[_0xdb0a('0x31')](_0xdb0a('0x32'),_0x3e49d4+'-'+_0x532870+'/'+_0x1052a2)['json'](_0x26fce9);}return null;};}function patchUpdates(_0x5e8b13){return function(_0x306254){try{jsonpatch[_0xdb0a('0x33')](_0x306254,_0x5e8b13,!![]);}catch(_0x47ad0c){return BPromise[_0xdb0a('0x34')](_0x47ad0c);}return _0x306254[_0xdb0a('0x35')]();};}function saveUpdates(_0xf0d148,_0x2e4709){return function(_0x4bbb79){if(_0x4bbb79){return _0x4bbb79['update'](_0xf0d148)[_0xdb0a('0x1f')](function(_0xe487b2){return _0xe487b2;});}return null;};}function removeEntity(_0x95e6bd,_0x45b95e){return function(_0x54bd93){if(_0x54bd93){return _0x54bd93[_0xdb0a('0x36')]()[_0xdb0a('0x1f')](function(){var _0x3dae8c=_0x54bd93[_0xdb0a('0x37')]({'plain':!![]});var _0x34f520=_0xdb0a('0x38');return db[_0xdb0a('0x39')][_0xdb0a('0x36')]({'where':{'type':_0x34f520,'resourceId':_0x3dae8c['id']}})[_0xdb0a('0x1f')](function(){return _0x54bd93;});})['then'](function(){_0x95e6bd[_0xdb0a('0x2b')](0xcc)[_0xdb0a('0x3a')]();});}};}function handleEntityNotFound(_0x49d4ae,_0x34c5de){return function(_0x3cd66c){if(!_0x3cd66c){_0x49d4ae[_0xdb0a('0x2a')](0x194);}return _0x3cd66c;};}function handleError(_0x11dde0,_0xb24ac){_0xb24ac=_0xb24ac||0x1f4;return function(_0x50652d){logger[_0xdb0a('0x26')](_0x50652d[_0xdb0a('0x3b')]);if(_0x50652d[_0xdb0a('0x3c')]){delete _0x50652d[_0xdb0a('0x3c')];}_0x11dde0[_0xdb0a('0x2b')](_0xb24ac)[_0xdb0a('0x3d')](_0x50652d);};}exports[_0xdb0a('0x3e')]=function(_0x3df1ac,_0x3b8149){var _0x175004={},_0x41fea4={},_0xa281d4={'count':0x0,'rows':[]};var _0x1e8f0d=_[_0xdb0a('0x3f')](db[_0xdb0a('0x40')][_0xdb0a('0x41')],function(_0x2eb56f){return{'name':_0x2eb56f[_0xdb0a('0x42')],'type':_0x2eb56f[_0xdb0a('0x43')][_0xdb0a('0x44')]};});_0x41fea4[_0xdb0a('0x45')]=_[_0xdb0a('0x3f')](_0x1e8f0d,'name');_0x41fea4[_0xdb0a('0x46')]=_[_0xdb0a('0x47')](_0x3df1ac[_0xdb0a('0x46')]);_0x41fea4['filters']=_[_0xdb0a('0x48')](_0x41fea4[_0xdb0a('0x45')],_0x41fea4['query']);_0x175004[_0xdb0a('0x49')]=_[_0xdb0a('0x48')](_0x41fea4[_0xdb0a('0x45')],qs[_0xdb0a('0x4a')](_0x3df1ac[_0xdb0a('0x46')][_0xdb0a('0x4a')]));_0x175004['attributes']=_0x175004[_0xdb0a('0x49')][_0xdb0a('0x4b')]?_0x175004[_0xdb0a('0x49')]:_0x41fea4[_0xdb0a('0x45')];if(!_0x3df1ac[_0xdb0a('0x46')][_0xdb0a('0x4c')](_0xdb0a('0x4d'))){_0x175004[_0xdb0a('0x2f')]=qs['limit'](_0x3df1ac['query']['limit']);_0x175004[_0xdb0a('0x2d')]=qs[_0xdb0a('0x2d')](_0x3df1ac['query'][_0xdb0a('0x2d')]);}_0x175004['order']=qs[_0xdb0a('0x4e')](_0x3df1ac[_0xdb0a('0x46')][_0xdb0a('0x4e')]);_0x175004[_0xdb0a('0x4f')]=qs[_0xdb0a('0x50')](_[_0xdb0a('0x51')](_0x3df1ac[_0xdb0a('0x46')],_0x41fea4[_0xdb0a('0x50')]),_0x1e8f0d);if(_0x3df1ac[_0xdb0a('0x46')][_0xdb0a('0x52')]){_0x175004[_0xdb0a('0x4f')]=_[_0xdb0a('0x53')](_0x175004[_0xdb0a('0x4f')],{'$or':_['map'](_0x1e8f0d,function(_0x4de2b9){if(_0x4de2b9[_0xdb0a('0x43')]!=='VIRTUAL'){var _0x3837a4={};_0x3837a4[_0x4de2b9[_0xdb0a('0x3c')]]={'$like':'%'+_0x3df1ac[_0xdb0a('0x46')][_0xdb0a('0x52')]+'%'};return _0x3837a4;}})});}_0x175004=_[_0xdb0a('0x53')]({},_0x175004,_0x3df1ac['options']);var _0x2bb342={'where':_0x175004[_0xdb0a('0x4f')]};return db['ChatQueue'][_0xdb0a('0x30')](_0x2bb342)['then'](function(_0xf226b1){_0xa281d4[_0xdb0a('0x30')]=_0xf226b1;if(_0x3df1ac[_0xdb0a('0x46')]['includeAll']){_0x175004['include']=[{'all':!![]}];}return db['ChatQueue'][_0xdb0a('0x54')](_0x175004);})['then'](function(_0x141383){_0xa281d4[_0xdb0a('0x55')]=_0x141383;return _0xa281d4;})[_0xdb0a('0x1f')](respondWithFilteredResult(_0x3b8149,_0x175004))[_0xdb0a('0x29')](handleError(_0x3b8149,null));};exports['show']=function(_0x12bb6d,_0x4dd154){var _0x3d0e33={'raw':!![],'where':{'id':_0x12bb6d['params']['id']}},_0x115e60={};_0x115e60[_0xdb0a('0x45')]=_[_0xdb0a('0x47')](db[_0xdb0a('0x40')][_0xdb0a('0x41')]);_0x115e60[_0xdb0a('0x46')]=_[_0xdb0a('0x47')](_0x12bb6d[_0xdb0a('0x46')]);_0x115e60['filters']=_['intersection'](_0x115e60['model'],_0x115e60[_0xdb0a('0x46')]);_0x3d0e33[_0xdb0a('0x49')]=_[_0xdb0a('0x48')](_0x115e60[_0xdb0a('0x45')],qs[_0xdb0a('0x4a')](_0x12bb6d[_0xdb0a('0x46')][_0xdb0a('0x4a')]));_0x3d0e33[_0xdb0a('0x49')]=_0x3d0e33[_0xdb0a('0x49')][_0xdb0a('0x4b')]?_0x3d0e33[_0xdb0a('0x49')]:_0x115e60['model'];if(_0x12bb6d['query'][_0xdb0a('0x56')]){_0x3d0e33[_0xdb0a('0x57')]=[{'all':!![]}];}_0x3d0e33=_[_0xdb0a('0x53')]({},_0x3d0e33,_0x12bb6d[_0xdb0a('0x58')]);return db['ChatQueue'][_0xdb0a('0x59')](_0x3d0e33)[_0xdb0a('0x1f')](handleEntityNotFound(_0x4dd154,null))[_0xdb0a('0x1f')](respondWithResult(_0x4dd154,null))[_0xdb0a('0x29')](handleError(_0x4dd154,null));};exports[_0xdb0a('0x5a')]=function(_0x1df126,_0x40b4b7){return db[_0xdb0a('0x40')][_0xdb0a('0x5a')](_0x1df126['body'],{})[_0xdb0a('0x1f')](function(_0x14f41b){var _0x1b3e83=_0x1df126[_0xdb0a('0x5b')][_0xdb0a('0x37')]({'plain':!![]});if(!_0x1b3e83)throw new Error(_0xdb0a('0x5c'));if(_0x1b3e83[_0xdb0a('0x5d')]===_0xdb0a('0x5b')){var _0x271416=_0x14f41b[_0xdb0a('0x37')]({'plain':!![]});var _0x56556a=_0xdb0a('0x38');return db[_0xdb0a('0x5e')][_0xdb0a('0x59')]({'where':{'name':_0x56556a,'userProfileId':_0x1b3e83[_0xdb0a('0x5f')]},'raw':!![]})['then'](function(_0x2561aa){if(_0x2561aa&&_0x2561aa[_0xdb0a('0x60')]===0x0){return db[_0xdb0a('0x39')][_0xdb0a('0x5a')]({'name':_0x271416[_0xdb0a('0x3c')],'resourceId':_0x271416['id'],'type':_0x2561aa['name'],'sectionId':_0x2561aa['id']},{})['then'](function(){return _0x14f41b;});}else{return _0x14f41b;}})[_0xdb0a('0x29')](function(_0x1401ed){logger[_0xdb0a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1401ed);throw _0x1401ed;});}return _0x14f41b;})[_0xdb0a('0x1f')](respondWithResult(_0x40b4b7,0xc9))[_0xdb0a('0x29')](handleError(_0x40b4b7,null));};exports[_0xdb0a('0x61')]=function(_0x57d26f,_0x1345a2){if(_0x57d26f[_0xdb0a('0x62')]['id']){delete _0x57d26f[_0xdb0a('0x62')]['id'];}return db['ChatQueue'][_0xdb0a('0x59')]({'where':{'id':_0x57d26f[_0xdb0a('0x63')]['id']}})[_0xdb0a('0x1f')](handleEntityNotFound(_0x1345a2,null))[_0xdb0a('0x1f')](saveUpdates(_0x57d26f[_0xdb0a('0x62')],null))['then'](respondWithResult(_0x1345a2,null))[_0xdb0a('0x29')](handleError(_0x1345a2,null));};exports[_0xdb0a('0x36')]=function(_0x239f57,_0x139826){return db[_0xdb0a('0x40')][_0xdb0a('0x59')]({'where':{'id':_0x239f57[_0xdb0a('0x63')]['id']}})[_0xdb0a('0x1f')](handleEntityNotFound(_0x139826,null))[_0xdb0a('0x1f')](removeEntity(_0x139826,null))[_0xdb0a('0x29')](handleError(_0x139826,null));};exports[_0xdb0a('0x64')]=function(_0xd58b2e,_0x591f6a){return db['ChatQueue'][_0xdb0a('0x64')]()['then'](respondWithResult(_0x591f6a,null))[_0xdb0a('0x29')](handleError(_0x591f6a,null));};exports[_0xdb0a('0x65')]=function(_0xcca25,_0x491098,_0x3a7514){var _0x58c006={'raw':!![],'where':{}},_0x41281c={},_0x219934;return db[_0xdb0a('0x40')][_0xdb0a('0x66')]({'where':{'id':_0xcca25[_0xdb0a('0x63')]['id']}})[_0xdb0a('0x1f')](handleEntityNotFound(_0x491098,null))[_0xdb0a('0x1f')](function(_0x3dbc21){if(_0x3dbc21){_0x219934=_0x3dbc21[_0xdb0a('0x37')]({'plain':!![]});_0x41281c[_0xdb0a('0x45')]=_['keys'](db['UserChatQueue'][_0xdb0a('0x41')]);_0x41281c['query']=_[_0xdb0a('0x47')](_0xcca25[_0xdb0a('0x46')]);_0x41281c['filters']=_['intersection'](_0x41281c[_0xdb0a('0x45')],_0x41281c[_0xdb0a('0x46')]);_0x58c006[_0xdb0a('0x49')]=_[_0xdb0a('0x48')](_0x41281c[_0xdb0a('0x45')],qs['fields'](_0xcca25[_0xdb0a('0x46')]['fields']));_0x58c006[_0xdb0a('0x49')]=_0x58c006[_0xdb0a('0x49')][_0xdb0a('0x4b')]?_0x58c006[_0xdb0a('0x49')]:_0x41281c[_0xdb0a('0x45')];if(!_0xcca25[_0xdb0a('0x46')]['hasOwnProperty'](_0xdb0a('0x4d'))){_0x58c006[_0xdb0a('0x2f')]=qs['limit'](_0xcca25[_0xdb0a('0x46')][_0xdb0a('0x2f')]);_0x58c006[_0xdb0a('0x2d')]=qs['offset'](_0xcca25[_0xdb0a('0x46')]['offset']);}_0x58c006['order']=qs[_0xdb0a('0x4e')](_0xcca25['query'][_0xdb0a('0x4e')]);_0x58c006['where']=qs[_0xdb0a('0x50')](_[_0xdb0a('0x51')](_0xcca25[_0xdb0a('0x46')],_0x41281c['filters']));_0x58c006[_0xdb0a('0x4f')]['ChatQueueId']=_0x3dbc21['id'];if(_0xcca25[_0xdb0a('0x46')][_0xdb0a('0x52')]){_0x58c006[_0xdb0a('0x4f')]=_[_0xdb0a('0x53')](_0x58c006[_0xdb0a('0x4f')],{'$or':_[_0xdb0a('0x3f')](_0x58c006[_0xdb0a('0x49')],function(_0x15f5ab){var _0x44ad38={};_0x44ad38[_0x15f5ab]={'$like':'%'+_0xcca25['query'][_0xdb0a('0x52')]+'%'};return _0x44ad38;})});}_0x58c006=_['merge']({},_0x58c006,_0xcca25[_0xdb0a('0x58')]);return db[_0xdb0a('0x67')][_0xdb0a('0x54')](_0x58c006);}})[_0xdb0a('0x1f')](function(_0x2d64a6){if(_0x2d64a6){return db['User'][_0xdb0a('0x68')]({'where':{'id':_[_0xdb0a('0x3f')](_0x2d64a6,'UserId'),'role':_0xdb0a('0x69')},'attributes':['id',_0xdb0a('0x3c'),_0xdb0a('0x6a'),_0xdb0a('0x6b'),'createdAt']});}})['then'](function(_0x62e4c0){if(_0x62e4c0){return{'count':_0x62e4c0['count'],'rows':_[_0xdb0a('0x3f')](_0x62e4c0['rows'],function(_0x4e16bd){return{'membername':_0x4e16bd[_0xdb0a('0x3c')],'UserId':_0x4e16bd['id'],'queue_name':_0x219934['name'],'ChatQueueId':_0x219934['id'],'interface':util[_0xdb0a('0x6c')](_0xdb0a('0x6d'),'SIP',_0x4e16bd[_0xdb0a('0x3c')]),'penalty':0x0,'paused':_0x4e16bd['chatPause'],'createdAt':_0x4e16bd['createdAt'],'updatedAt':_0x4e16bd[_0xdb0a('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x491098,_0x58c006))['catch'](handleError(_0x491098,null));};exports[_0xdb0a('0x6e')]=function(_0x1d849d,_0x2de924,_0x4c0ae8){var _0x45e7bc={};var _0x28db73={};var _0xff1820;var _0x14df8e;return db[_0xdb0a('0x40')][_0xdb0a('0x66')]({'where':{'id':_0x1d849d[_0xdb0a('0x63')]['id']}})[_0xdb0a('0x1f')](handleEntityNotFound(_0x2de924,null))[_0xdb0a('0x1f')](function(_0x3d1ebe){if(_0x3d1ebe){_0xff1820=_0x3d1ebe;_0x28db73[_0xdb0a('0x45')]=_['keys'](db['Team']['rawAttributes']);_0x28db73[_0xdb0a('0x46')]=_[_0xdb0a('0x47')](_0x1d849d[_0xdb0a('0x46')]);_0x28db73[_0xdb0a('0x50')]=_[_0xdb0a('0x48')](_0x28db73[_0xdb0a('0x45')],_0x28db73[_0xdb0a('0x46')]);_0x45e7bc['attributes']=_[_0xdb0a('0x48')](_0x28db73['model'],qs['fields'](_0x1d849d[_0xdb0a('0x46')][_0xdb0a('0x4a')]));_0x45e7bc[_0xdb0a('0x49')]=_0x45e7bc[_0xdb0a('0x49')][_0xdb0a('0x4b')]?_0x45e7bc[_0xdb0a('0x49')]:_0x28db73[_0xdb0a('0x45')];_0x45e7bc['order']=qs[_0xdb0a('0x4e')](_0x1d849d['query'][_0xdb0a('0x4e')]);_0x45e7bc['where']=qs['filters'](_['pick'](_0x1d849d['query'],_0x28db73['filters']));if(_0x1d849d[_0xdb0a('0x46')]['filter']){_0x45e7bc[_0xdb0a('0x4f')]=_['merge'](_0x45e7bc[_0xdb0a('0x4f')],{'$or':_[_0xdb0a('0x3f')](_0x45e7bc[_0xdb0a('0x49')],function(_0x581d6d){var _0x14f2ed={};_0x14f2ed[_0x581d6d]={'$like':'%'+_0x1d849d[_0xdb0a('0x46')][_0xdb0a('0x52')]+'%'};return _0x14f2ed;})});}_0x45e7bc=_['merge']({},_0x45e7bc,_0x1d849d['options']);return _0xff1820[_0xdb0a('0x6e')](_0x45e7bc);}})[_0xdb0a('0x1f')](function(_0xaf4a0f){if(_0xaf4a0f){_0x14df8e=_0xaf4a0f[_0xdb0a('0x4b')];if(!_0x1d849d[_0xdb0a('0x46')][_0xdb0a('0x4c')](_0xdb0a('0x4d'))){_0x45e7bc[_0xdb0a('0x2f')]=qs[_0xdb0a('0x2f')](_0x1d849d[_0xdb0a('0x46')][_0xdb0a('0x2f')]);_0x45e7bc[_0xdb0a('0x2d')]=qs[_0xdb0a('0x2d')](_0x1d849d['query'][_0xdb0a('0x2d')]);}return _0xff1820[_0xdb0a('0x6e')](_0x45e7bc);}})[_0xdb0a('0x1f')](function(_0x20c058){if(_0x20c058){return _0x20c058?{'count':_0x14df8e,'rows':_0x20c058}:null;}})[_0xdb0a('0x1f')](respondWithResult(_0x2de924,null))['catch'](handleError(_0x2de924,null));};exports[_0xdb0a('0x6f')]=function(_0x203754,_0x394cb7,_0x5b1a09){var _0x4af425=_0x203754[_0xdb0a('0x62')][_0xdb0a('0x70')];return db[_0xdb0a('0x71')][_0xdb0a('0x54')]({'where':{'id':_0x4af425},'attributes':['id'],'include':[{'model':db[_0xdb0a('0x72')],'as':_0xdb0a('0x73'),'attributes':['id',_0xdb0a('0x3c'),_0xdb0a('0x74'),_0xdb0a('0x75'),'interface'],'raw':!![]}]})[_0xdb0a('0x1f')](function(_0x1565a2){if(_0x1565a2){var _0x292667=_[_0xdb0a('0x76')](_0x1565a2,function(_0xc826d4){var _0x51a7c3=_0xc826d4[_0xdb0a('0x37')]({'plain':!![]});return _0x51a7c3['Agents'];});return db[_0xdb0a('0x40')][_0xdb0a('0x59')]({'where':{'id':_0x203754[_0xdb0a('0x63')]['id']}})['then'](function(_0x174f75){return db['sequelize'][_0xdb0a('0x77')](function(_0x14836b){return _0x174f75[_0xdb0a('0x6f')](_0x4af425,{'transaction':_0x14836b})['then'](function(){return BPromise[_0xdb0a('0x78')](_0x292667,function(_0x346bf5){return db[_0xdb0a('0x67')][_0xdb0a('0x79')]({'where':{'UserId':_0x346bf5['id'],'ChatQueueId':_0x203754['params']['id']},'transaction':_0x14836b});});})[_0xdb0a('0x1f')](function(){_0x292667[_0xdb0a('0x7a')](function(_0x22e82b){socket[_0xdb0a('0x7b')](_0xdb0a('0x7c'),{'UserId':_0x22e82b['id'],'ChatQueueId':_0x174f75['id']});});});});});}})[_0xdb0a('0x1f')](respondWithStatusCode(_0x394cb7,null))[_0xdb0a('0x29')](handleError(_0x394cb7,null));};exports[_0xdb0a('0x7d')]=function(_0x58ca99,_0x538344,_0x178989){return db['Team'][_0xdb0a('0x54')]({'where':{'id':_0x58ca99['query'][_0xdb0a('0x70')]},'attributes':['id'],'include':[{'model':db[_0xdb0a('0x72')],'as':_0xdb0a('0x73'),'attributes':['id'],'raw':!![]}]})[_0xdb0a('0x1f')](handleEntityNotFound(_0x538344,null))['then'](function(_0x16329f){var _0x287bbb=_[_0xdb0a('0x3f')](_0x16329f,'id');var _0x4f366c=[];var _0x33bf24=[];var _0x2304c2=squel[_0xdb0a('0x7e')]();_0x2304c2[_0xdb0a('0x7f')](_0xdb0a('0x80'))[_0xdb0a('0x81')](_0xdb0a('0x82'),'tq')['join'](_0xdb0a('0x83'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdb0a('0x4f')](_0xdb0a('0x84'),_0x58ca99['params']['id']);for(var _0x19605a=0x0;_0x19605a<_0x16329f[_0xdb0a('0x4b')];_0x19605a+=0x1){let _0x4f2ba4=_0x16329f[_0x19605a];for(var _0x544e1c=0x0;_0x544e1c<_0x4f2ba4['Agents'][_0xdb0a('0x4b')];_0x544e1c+=0x1){let _0x1cf9f8=_0x4f2ba4[_0xdb0a('0x73')][_0x544e1c];var _0x46a5b2=_0x2304c2[_0xdb0a('0x85')]();_0x46a5b2[_0xdb0a('0x4f')]('ut.UserId\x20=\x20?',_0x1cf9f8['id']);_0x33bf24[_0xdb0a('0x86')](db[_0xdb0a('0x87')][_0xdb0a('0x46')](_0x46a5b2['toString'](),{'type':db[_0xdb0a('0x87')]['QueryTypes']['SELECT']})[_0xdb0a('0x1f')](function(_0x659206){if(_0x659206[_0xdb0a('0x4b')]===0x1){return _0x1cf9f8['id'];}else{var _0x4eac3f=_[_0xdb0a('0x88')](_[_0xdb0a('0x3f')](_0x659206,_0xdb0a('0x89')),function(_0x2e3d43){return _['includes'](_0x287bbb,_0x2e3d43);});if(_0x4eac3f){return _0x1cf9f8['id'];}}}));}}return BPromise[_0xdb0a('0x8a')](_0x33bf24)['then'](function(_0x443255){_0x4f366c=_(_0x4f366c)['union'](_0x443255)[_0xdb0a('0x8b')]()[_0xdb0a('0x8c')]();return db[_0xdb0a('0x40')]['find']({'where':{'id':_0x58ca99[_0xdb0a('0x63')]['id']}})[_0xdb0a('0x1f')](function(_0x40d715){return db['sequelize']['transaction'](function(_0x5b3e23){return _0x40d715[_0xdb0a('0x7d')](_0x58ca99[_0xdb0a('0x46')][_0xdb0a('0x70')],{'transaction':_0x5b3e23})[_0xdb0a('0x1f')](function(){if(!_[_0xdb0a('0x8d')](_0x4f366c)){return _0x40d715['removeAgents'](_0x4f366c,{'transaction':_0x5b3e23});}})[_0xdb0a('0x1f')](function(){_0x4f366c[_0xdb0a('0x7a')](function(_0x8c7b2a){socket[_0xdb0a('0x7b')](_0xdb0a('0x8e'),{'UserId':_0x8c7b2a,'ChatQueueId':_0x40d715['id']});});});});});});})['then'](respondWithStatusCode(_0x538344,null))[_0xdb0a('0x29')](handleError(_0x538344,null));};exports['addAgents']=function(_0xc1fc21,_0x7074ba,_0x542648){return db[_0xdb0a('0x40')]['find']({'where':{'id':_0xc1fc21['params']['id']}})[_0xdb0a('0x1f')](handleEntityNotFound(_0x7074ba,null))[_0xdb0a('0x1f')](function(_0x40a0bd){if(_0x40a0bd){return _0x40a0bd[_0xdb0a('0x8f')](_0xc1fc21[_0xdb0a('0x62')]['ids'],_[_0xdb0a('0x90')](_0xc1fc21[_0xdb0a('0x62')],[_0xdb0a('0x70'),'id'])||{})[_0xdb0a('0x91')](function(_0x176328){for(var _0x5078c8=0x0;_0x5078c8<_0xc1fc21[_0xdb0a('0x62')]['ids'][_0xdb0a('0x4b')];_0x5078c8+=0x1){socket[_0xdb0a('0x7b')]('userChatQueue:save',{'UserId':Number(_0xc1fc21[_0xdb0a('0x62')][_0xdb0a('0x70')][_0x5078c8]),'ChatQueueId':Number(_0xc1fc21[_0xdb0a('0x63')]['id'])});}return _0x176328;});}})[_0xdb0a('0x1f')](respondWithResult(_0x7074ba,null))['catch'](handleError(_0x7074ba,null));};exports[_0xdb0a('0x92')]=function(_0x57f7d3,_0x3425f4,_0x2c0971){return db['ChatQueue'][_0xdb0a('0x59')]({'where':{'id':_0x57f7d3['params']['id']}})[_0xdb0a('0x1f')](handleEntityNotFound(_0x3425f4,null))[_0xdb0a('0x1f')](function(_0x3e8ba0){if(_0x3e8ba0){return _0x3e8ba0[_0xdb0a('0x92')](_0x57f7d3[_0xdb0a('0x46')][_0xdb0a('0x70')])[_0xdb0a('0x1f')](function(){if(_[_0xdb0a('0x93')](_0x57f7d3[_0xdb0a('0x46')][_0xdb0a('0x70')])){for(var _0x3f1288=0x0;_0x3f1288<_0x57f7d3[_0xdb0a('0x46')]['ids'][_0xdb0a('0x4b')];_0x3f1288+=0x1){socket[_0xdb0a('0x7b')]('userChatQueue:remove',{'UserId':Number(_0x57f7d3['query'][_0xdb0a('0x70')][_0x3f1288]),'ChatQueueId':Number(_0x57f7d3['params']['id'])});}}else{socket[_0xdb0a('0x7b')](_0xdb0a('0x8e'),{'UserId':Number(_0x57f7d3['query'][_0xdb0a('0x70')]),'ChatQueueId':Number(_0x57f7d3['params']['id'])});}});}})[_0xdb0a('0x1f')](respondWithStatusCode(_0x3425f4,null))['catch'](handleError(_0x3425f4,null));};exports[_0xdb0a('0x94')]=function(_0x2a9468,_0x208b57,_0x43acc1){var _0x15df04={};var _0x1712d7={};var _0x1b9894;var _0x1fc661;return db['ChatQueue'][_0xdb0a('0x66')]({'where':{'id':_0x2a9468[_0xdb0a('0x63')]['id']}})[_0xdb0a('0x1f')](handleEntityNotFound(_0x208b57,null))['then'](function(_0x178fa4){if(_0x178fa4){_0x1b9894=_0x178fa4;_0x1712d7[_0xdb0a('0x45')]=_[_0xdb0a('0x47')](db[_0xdb0a('0x72')][_0xdb0a('0x41')]);_0x1712d7[_0xdb0a('0x46')]=_[_0xdb0a('0x47')](_0x2a9468[_0xdb0a('0x46')]);_0x1712d7[_0xdb0a('0x50')]=_[_0xdb0a('0x48')](_0x1712d7['model'],_0x1712d7[_0xdb0a('0x46')]);_0x15df04['attributes']=_[_0xdb0a('0x48')](_0x1712d7[_0xdb0a('0x45')],qs[_0xdb0a('0x4a')](_0x2a9468[_0xdb0a('0x46')][_0xdb0a('0x4a')]));_0x15df04[_0xdb0a('0x49')]=_0x15df04[_0xdb0a('0x49')]['length']?_0x15df04[_0xdb0a('0x49')]:_0x1712d7[_0xdb0a('0x45')];_0x15df04[_0xdb0a('0x95')]=qs[_0xdb0a('0x4e')](_0x2a9468[_0xdb0a('0x46')][_0xdb0a('0x4e')]);_0x15df04[_0xdb0a('0x4f')]=qs['filters'](_[_0xdb0a('0x51')](_0x2a9468[_0xdb0a('0x46')],_0x1712d7[_0xdb0a('0x50')]));if(_0x2a9468[_0xdb0a('0x46')][_0xdb0a('0x52')]){_0x15df04[_0xdb0a('0x4f')]=_[_0xdb0a('0x53')](_0x15df04['where'],{'$or':_['map'](_0x15df04[_0xdb0a('0x49')],function(_0x16fe7e){var _0x5694d8={};_0x5694d8[_0x16fe7e]={'$like':'%'+_0x2a9468[_0xdb0a('0x46')][_0xdb0a('0x52')]+'%'};return _0x5694d8;})});}_0x15df04=_[_0xdb0a('0x53')]({},_0x15df04,_0x2a9468[_0xdb0a('0x58')]);return _0x1b9894['getAgents'](_0x15df04);}})['then'](function(_0x4a8428){if(_0x4a8428){_0x1fc661=_0x4a8428[_0xdb0a('0x4b')];if(!_0x2a9468[_0xdb0a('0x46')][_0xdb0a('0x4c')]('nolimit')){_0x15df04['limit']=qs['limit'](_0x2a9468['query']['limit']);_0x15df04[_0xdb0a('0x2d')]=qs[_0xdb0a('0x2d')](_0x2a9468[_0xdb0a('0x46')]['offset']);}return _0x1b9894[_0xdb0a('0x94')](_0x15df04);}})[_0xdb0a('0x1f')](function(_0x538be1){if(_0x538be1){return _0x538be1?{'count':_0x1fc661,'rows':_0x538be1}:null;}})[_0xdb0a('0x1f')](respondWithResult(_0x208b57,null))['catch'](handleError(_0x208b57,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index a7381d2..55fa0df 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 _0x7e16=['ChatQueue','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4ca571,_0xd1d6b6){var _0xaa55a5=function(_0x3a71f4){while(--_0x3a71f4){_0x4ca571['push'](_0x4ca571['shift']());}};_0xaa55a5(++_0xd1d6b6);}(_0x7e16,0x16f));var _0x67e1=function(_0x5547d4,_0x3a847c){_0x5547d4=_0x5547d4-0x0;var _0x2ed9ce=_0x7e16[_0x5547d4];return _0x2ed9ce;};'use strict';var EventEmitter=require(_0x67e1('0x0'));var ChatQueue=require(_0x67e1('0x1'))['db'][_0x67e1('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x67e1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x67e1('0x4')};function emitEvent(_0x53bbdf){return function(_0x268f07,_0x25d798,_0x563303){ChatQueueEvents[_0x67e1('0x5')](_0x53bbdf+':'+_0x268f07['id'],_0x268f07);ChatQueueEvents[_0x67e1('0x5')](_0x53bbdf,_0x268f07);_0x563303(null);};}for(var e in events){if(events[_0x67e1('0x6')](e)){var event=events[e];ChatQueue[_0x67e1('0x7')](e,emitEvent(event));}}module[_0x67e1('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x3e9e=['events','ChatQueue','hasOwnProperty','hook','exports'];(function(_0x3b59d5,_0x1e23f2){var _0x30cc91=function(_0x54815d){while(--_0x54815d){_0x3b59d5['push'](_0x3b59d5['shift']());}};_0x30cc91(++_0x1e23f2);}(_0x3e9e,0x91));var _0xe3e9=function(_0xe10194,_0x7ff838){_0xe10194=_0xe10194-0x0;var _0x2369cf=_0x3e9e[_0xe10194];return _0x2369cf;};'use strict';var EventEmitter=require(_0xe3e9('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe3e9('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x229cee){return function(_0x1846d6,_0x334206,_0x455c8f){ChatQueueEvents['emit'](_0x229cee+':'+_0x1846d6['id'],_0x1846d6);ChatQueueEvents['emit'](_0x229cee,_0x1846d6);_0x455c8f(null);};}for(var e in events){if(events[_0xe3e9('0x2')](e)){var event=events[e];ChatQueue[_0xe3e9('0x3')](e,emitEvent(event));}}module[_0xe3e9('0x4')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index b081457..57830a0 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 _0xe35a=['bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue','util','../../config/logger','api'];(function(_0x5c8f85,_0x7957cc){var _0x319d90=function(_0x173e1f){while(--_0x173e1f){_0x5c8f85['push'](_0x5c8f85['shift']());}};_0x319d90(++_0x7957cc);}(_0xe35a,0x147));var _0xae35=function(_0xce8299,_0x55ec18){_0xce8299=_0xce8299-0x0;var _0xa39773=_0xe35a[_0xce8299];return _0xa39773;};'use strict';var _=require('lodash');var util=require(_0xae35('0x0'));var logger=require(_0xae35('0x1'))(_0xae35('0x2'));var moment=require('moment');var BPromise=require(_0xae35('0x3'));var rp=require(_0xae35('0x4'));var fs=require('fs');var path=require(_0xae35('0x5'));var rimraf=require(_0xae35('0x6'));var config=require(_0xae35('0x7'));var attributes=require(_0xae35('0x8'));module['exports']=function(_0x5a21bb,_0x59a07d){return _0x5a21bb[_0xae35('0x9')](_0xae35('0xa'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7287=['path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4a247e,_0x2099a7){var _0x30a6ca=function(_0x7397cc){while(--_0x7397cc){_0x4a247e['push'](_0x4a247e['shift']());}};_0x30a6ca(++_0x2099a7);}(_0x7287,0x96));var _0x7728=function(_0xebfd56,_0x5967f1){_0xebfd56=_0xebfd56-0x0;var _0x4cb58e=_0x7287[_0xebfd56];return _0x4cb58e;};'use strict';var _=require(_0x7728('0x0'));var util=require(_0x7728('0x1'));var logger=require(_0x7728('0x2'))(_0x7728('0x3'));var moment=require('moment');var BPromise=require(_0x7728('0x4'));var rp=require(_0x7728('0x5'));var fs=require('fs');var path=require(_0x7728('0x6'));var rimraf=require(_0x7728('0x7'));var config=require(_0x7728('0x8'));var attributes=require(_0x7728('0x9'));module[_0x7728('0xa')]=function(_0x5f1233,_0x29e53b){return _0x5f1233[_0x7728('0xb')](_0x7728('0xc'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index b56aa22..b768b0e 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 _0x6c00=['register','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','options','raw','where','attributes','include','map','model','info','ShowChatQueue','ChatQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatQueue.socket'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x6c00,0x1a9));var _0x06c0=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x6c00[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0x06c0('0x0'));var util=require(_0x06c0('0x1'));var moment=require(_0x06c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x06c0('0x3'));var fs=require('fs');var Redis=require(_0x06c0('0x4'));var db=require(_0x06c0('0x5'))['db'];var utils=require(_0x06c0('0x6'));var logger=require('../../config/logger')(_0x06c0('0x7'));var config=require(_0x06c0('0x8'));var jayson=require(_0x06c0('0x9'));var client=jayson[_0x06c0('0xa')][_0x06c0('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x06c0('0xc')],{'host':_0x06c0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x06c0('0xc')]));require(_0x06c0('0xe'))[_0x06c0('0xf')](socket);function respondWithRpcPromise(_0x617889,_0x2a6e7b,_0x140b20){return new BPromise(function(_0x27d317,_0x139770){return client[_0x06c0('0x10')](_0x617889,_0x140b20)[_0x06c0('0x11')](function(_0x2409fd){logger['info']('ChatQueue,\x20%s,\x20%s',_0x2a6e7b,_0x06c0('0x12'));logger[_0x06c0('0x13')](_0x06c0('0x14'),_0x2a6e7b,_0x06c0('0x12'),JSON[_0x06c0('0x15')](_0x2409fd));if(_0x2409fd['error']){if(_0x2409fd['error'][_0x06c0('0x16')]===0x1f4){logger[_0x06c0('0x17')](_0x06c0('0x18'),_0x2a6e7b,_0x2409fd[_0x06c0('0x17')][_0x06c0('0x19')]);return _0x139770(_0x2409fd[_0x06c0('0x17')][_0x06c0('0x19')]);}logger['error'](_0x06c0('0x18'),_0x2a6e7b,_0x2409fd[_0x06c0('0x17')][_0x06c0('0x19')]);return _0x27d317(_0x2409fd[_0x06c0('0x17')][_0x06c0('0x19')]);}else{logger['info'](_0x06c0('0x18'),_0x2a6e7b,'request\x20sent');_0x27d317(_0x2409fd[_0x06c0('0x1a')][_0x06c0('0x19')]);}})[_0x06c0('0x1b')](function(_0x47484e){logger['error']('ChatQueue,\x20%s,\x20%s',_0x2a6e7b,_0x47484e);_0x139770(_0x47484e);});});}exports[_0x06c0('0x1c')]=function(_0x55c25e){var _0x1b897b=this;return new Promise(function(_0x1e3623,_0x30bf8c){return db['ChatQueue']['findAll']({'raw':_0x55c25e[_0x06c0('0x1d')]?_0x55c25e['options'][_0x06c0('0x1e')]===undefined?!![]:![]:!![],'where':_0x55c25e[_0x06c0('0x1d')]?_0x55c25e[_0x06c0('0x1d')][_0x06c0('0x1f')]||null:null,'attributes':_0x55c25e[_0x06c0('0x1d')]?_0x55c25e['options'][_0x06c0('0x20')]||null:null,'limit':_0x55c25e[_0x06c0('0x1d')]?_0x55c25e['options']['limit']||null:null,'include':_0x55c25e[_0x06c0('0x1d')]?_0x55c25e[_0x06c0('0x1d')][_0x06c0('0x21')]?_[_0x06c0('0x22')](_0x55c25e['options']['include'],function(_0x13f63e){return{'model':db[_0x13f63e[_0x06c0('0x23')]],'as':_0x13f63e['as'],'attributes':_0x13f63e[_0x06c0('0x20')],'include':_0x13f63e[_0x06c0('0x21')]?_[_0x06c0('0x22')](_0x13f63e[_0x06c0('0x21')],function(_0x42e370){return{'model':db[_0x42e370[_0x06c0('0x23')]],'as':_0x42e370['as'],'attributes':_0x42e370['attributes'],'include':_0x42e370[_0x06c0('0x21')]?_[_0x06c0('0x22')](_0x42e370[_0x06c0('0x21')],function(_0x46115a){return{'model':db[_0x46115a[_0x06c0('0x23')]],'as':_0x46115a['as'],'attributes':_0x46115a[_0x06c0('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x426792){logger[_0x06c0('0x24')](_0x06c0('0x1c'),_0x55c25e);logger[_0x06c0('0x13')]('GetChatQueue',_0x55c25e,JSON[_0x06c0('0x15')](_0x426792));_0x1e3623(_0x426792);})[_0x06c0('0x1b')](function(_0x4c5ed7){logger[_0x06c0('0x17')]('GetChatQueue',_0x4c5ed7[_0x06c0('0x19')],_0x55c25e);_0x30bf8c(_0x1b897b[_0x06c0('0x17')](0x1f4,_0x4c5ed7[_0x06c0('0x19')]));});});};exports[_0x06c0('0x25')]=function(_0x4bc6dc){var _0x5627e1=this;return new Promise(function(_0x522e78,_0x2da993){return db[_0x06c0('0x26')][_0x06c0('0x27')]({'raw':_0x4bc6dc[_0x06c0('0x1d')]?_0x4bc6dc['options'][_0x06c0('0x1e')]===undefined?!![]:![]:!![],'where':_0x4bc6dc[_0x06c0('0x1d')]?_0x4bc6dc['options'][_0x06c0('0x1f')]||null:null,'attributes':_0x4bc6dc[_0x06c0('0x1d')]?_0x4bc6dc[_0x06c0('0x1d')][_0x06c0('0x20')]||null:null,'include':_0x4bc6dc[_0x06c0('0x1d')]?_0x4bc6dc[_0x06c0('0x1d')][_0x06c0('0x21')]?_[_0x06c0('0x22')](_0x4bc6dc[_0x06c0('0x1d')]['include'],function(_0x7b9528){return{'model':db[_0x7b9528['model']],'as':_0x7b9528['as'],'attributes':_0x7b9528[_0x06c0('0x20')],'include':_0x7b9528['include']?_[_0x06c0('0x22')](_0x7b9528[_0x06c0('0x21')],function(_0x47e55e){return{'model':db[_0x47e55e['model']],'as':_0x47e55e['as'],'attributes':_0x47e55e['attributes'],'include':_0x47e55e[_0x06c0('0x21')]?_[_0x06c0('0x22')](_0x47e55e[_0x06c0('0x21')],function(_0xc18b0e){return{'model':db[_0xc18b0e['model']],'as':_0xc18b0e['as'],'attributes':_0xc18b0e[_0x06c0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x06c0('0x11')](function(_0x1aa553){logger['info'](_0x06c0('0x25'),_0x4bc6dc);logger['debug'](_0x06c0('0x25'),_0x4bc6dc,JSON[_0x06c0('0x15')](_0x1aa553));_0x522e78(_0x1aa553);})['catch'](function(_0x4e14fc){logger['error'](_0x06c0('0x25'),_0x4e14fc[_0x06c0('0x19')],_0x4bc6dc);_0x2da993(_0x5627e1[_0x06c0('0x17')](0x1f4,_0x4e14fc['message']));});});}; \ No newline at end of file +var _0xd027=['limit','include','map','model','ShowChatQueue','find','stringify','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes'];(function(_0x3adb53,_0x344e17){var _0x36be40=function(_0x2dc6f5){while(--_0x2dc6f5){_0x3adb53['push'](_0x3adb53['shift']());}};_0x36be40(++_0x344e17);}(_0xd027,0x197));var _0x7d02=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd027[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7d02('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7d02('0x1'));var fs=require('fs');var Redis=require(_0x7d02('0x2'));var db=require(_0x7d02('0x3'))['db'];var utils=require(_0x7d02('0x4'));var logger=require(_0x7d02('0x5'))(_0x7d02('0x6'));var config=require(_0x7d02('0x7'));var jayson=require(_0x7d02('0x8'));var client=jayson['client'][_0x7d02('0x9')]({'port':0x232a});config[_0x7d02('0xa')]=_[_0x7d02('0xb')](config[_0x7d02('0xa')],{'host':_0x7d02('0xc'),'port':0x18eb});var socket=require(_0x7d02('0xd'))(new Redis(config[_0x7d02('0xa')]));require(_0x7d02('0xe'))[_0x7d02('0xf')](socket);function respondWithRpcPromise(_0x37217c,_0x21abe5,_0x3bfc73){return new BPromise(function(_0x259517,_0x55b35a){return client[_0x7d02('0x10')](_0x37217c,_0x3bfc73)[_0x7d02('0x11')](function(_0x5eefcd){logger[_0x7d02('0x12')](_0x7d02('0x13'),_0x21abe5,_0x7d02('0x14'));logger[_0x7d02('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x21abe5,_0x7d02('0x14'),JSON['stringify'](_0x5eefcd));if(_0x5eefcd[_0x7d02('0x16')]){if(_0x5eefcd[_0x7d02('0x16')]['code']===0x1f4){logger[_0x7d02('0x16')](_0x7d02('0x13'),_0x21abe5,_0x5eefcd['error'][_0x7d02('0x17')]);return _0x55b35a(_0x5eefcd[_0x7d02('0x16')][_0x7d02('0x17')]);}logger['error'](_0x7d02('0x13'),_0x21abe5,_0x5eefcd[_0x7d02('0x16')][_0x7d02('0x17')]);return _0x259517(_0x5eefcd[_0x7d02('0x16')][_0x7d02('0x17')]);}else{logger[_0x7d02('0x12')](_0x7d02('0x13'),_0x21abe5,_0x7d02('0x14'));_0x259517(_0x5eefcd[_0x7d02('0x18')][_0x7d02('0x17')]);}})[_0x7d02('0x19')](function(_0x1168c0){logger[_0x7d02('0x16')](_0x7d02('0x13'),_0x21abe5,_0x1168c0);_0x55b35a(_0x1168c0);});});}exports[_0x7d02('0x1a')]=function(_0x82a804){var _0x579565=this;return new Promise(function(_0x41c538,_0x152291){return db[_0x7d02('0x1b')][_0x7d02('0x1c')]({'raw':_0x82a804[_0x7d02('0x1d')]?_0x82a804[_0x7d02('0x1d')][_0x7d02('0x1e')]===undefined?!![]:![]:!![],'where':_0x82a804['options']?_0x82a804[_0x7d02('0x1d')][_0x7d02('0x1f')]||null:null,'attributes':_0x82a804[_0x7d02('0x1d')]?_0x82a804[_0x7d02('0x1d')][_0x7d02('0x20')]||null:null,'limit':_0x82a804[_0x7d02('0x1d')]?_0x82a804[_0x7d02('0x1d')][_0x7d02('0x21')]||null:null,'include':_0x82a804[_0x7d02('0x1d')]?_0x82a804[_0x7d02('0x1d')][_0x7d02('0x22')]?_['map'](_0x82a804[_0x7d02('0x1d')][_0x7d02('0x22')],function(_0xe81f55){return{'model':db[_0xe81f55['model']],'as':_0xe81f55['as'],'attributes':_0xe81f55['attributes'],'include':_0xe81f55[_0x7d02('0x22')]?_[_0x7d02('0x23')](_0xe81f55[_0x7d02('0x22')],function(_0x478506){return{'model':db[_0x478506[_0x7d02('0x24')]],'as':_0x478506['as'],'attributes':_0x478506[_0x7d02('0x20')],'include':_0x478506[_0x7d02('0x22')]?_[_0x7d02('0x23')](_0x478506['include'],function(_0x5b94c8){return{'model':db[_0x5b94c8['model']],'as':_0x5b94c8['as'],'attributes':_0x5b94c8[_0x7d02('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7d02('0x11')](function(_0x2d6132){logger[_0x7d02('0x12')]('GetChatQueue',_0x82a804);logger[_0x7d02('0x15')]('GetChatQueue',_0x82a804,JSON['stringify'](_0x2d6132));_0x41c538(_0x2d6132);})[_0x7d02('0x19')](function(_0x7a05c6){logger[_0x7d02('0x16')](_0x7d02('0x1a'),_0x7a05c6['message'],_0x82a804);_0x152291(_0x579565[_0x7d02('0x16')](0x1f4,_0x7a05c6[_0x7d02('0x17')]));});});};exports[_0x7d02('0x25')]=function(_0x4bac3e){var _0x868f7e=this;return new Promise(function(_0x3aaa05,_0x22cf7e){return db[_0x7d02('0x1b')][_0x7d02('0x26')]({'raw':_0x4bac3e[_0x7d02('0x1d')]?_0x4bac3e[_0x7d02('0x1d')][_0x7d02('0x1e')]===undefined?!![]:![]:!![],'where':_0x4bac3e[_0x7d02('0x1d')]?_0x4bac3e[_0x7d02('0x1d')][_0x7d02('0x1f')]||null:null,'attributes':_0x4bac3e[_0x7d02('0x1d')]?_0x4bac3e['options'][_0x7d02('0x20')]||null:null,'include':_0x4bac3e[_0x7d02('0x1d')]?_0x4bac3e[_0x7d02('0x1d')][_0x7d02('0x22')]?_['map'](_0x4bac3e['options'][_0x7d02('0x22')],function(_0x4dfe91){return{'model':db[_0x4dfe91['model']],'as':_0x4dfe91['as'],'attributes':_0x4dfe91[_0x7d02('0x20')],'include':_0x4dfe91['include']?_['map'](_0x4dfe91[_0x7d02('0x22')],function(_0x4841cc){return{'model':db[_0x4841cc[_0x7d02('0x24')]],'as':_0x4841cc['as'],'attributes':_0x4841cc['attributes'],'include':_0x4841cc[_0x7d02('0x22')]?_['map'](_0x4841cc[_0x7d02('0x22')],function(_0x1b1037){return{'model':db[_0x1b1037[_0x7d02('0x24')]],'as':_0x1b1037['as'],'attributes':_0x1b1037['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x388842){logger[_0x7d02('0x12')](_0x7d02('0x25'),_0x4bac3e);logger[_0x7d02('0x15')](_0x7d02('0x25'),_0x4bac3e,JSON[_0x7d02('0x27')](_0x388842));_0x3aaa05(_0x388842);})[_0x7d02('0x19')](function(_0x46c843){logger[_0x7d02('0x16')](_0x7d02('0x25'),_0x46c843[_0x7d02('0x17')],_0x4bac3e);_0x22cf7e(_0x868f7e['error'](0x1f4,_0x46c843['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 74e660b..d36cac8 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 _0xf021=['update','length','chatQueue:','./chatQueue.events','save','remove'];(function(_0x3b601a,_0x1fcc08){var _0x3b4d2b=function(_0x5e5d8b){while(--_0x5e5d8b){_0x3b601a['push'](_0x3b601a['shift']());}};_0x3b4d2b(++_0x1fcc08);}(_0xf021,0x18f));var _0x1f02=function(_0xc0bf56,_0x476134){_0xc0bf56=_0xc0bf56-0x0;var _0x43ff64=_0xf021[_0xc0bf56];return _0x43ff64;};'use strict';var ChatQueueEvents=require(_0x1f02('0x0'));var events=[_0x1f02('0x1'),_0x1f02('0x2'),_0x1f02('0x3')];function createListener(_0x30184d,_0x53cc42){return function(_0x1027d2){_0x53cc42['emit'](_0x30184d,_0x1027d2);};}function removeListener(_0x2e8594,_0x3164f0){return function(){ChatQueueEvents['removeListener'](_0x2e8594,_0x3164f0);};}exports['register']=function(_0x84a8f0){for(var _0x56b275=0x0,_0x383d0b=events[_0x1f02('0x4')];_0x56b275<_0x383d0b;_0x56b275++){var _0x2a6c50=events[_0x56b275];var _0x4193d2=createListener(_0x1f02('0x5')+_0x2a6c50,_0x84a8f0);ChatQueueEvents['on'](_0x2a6c50,_0x4193d2);}}; \ No newline at end of file +var _0x425d=['./chatQueue.events','remove','update','emit','removeListener','register','length','chatQueue:'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x425d,0x1e0));var _0xd425=function(_0x1e1818,_0x5bb131){_0x1e1818=_0x1e1818-0x0;var _0x5c7561=_0x425d[_0x1e1818];return _0x5c7561;};'use strict';var ChatQueueEvents=require(_0xd425('0x0'));var events=['save',_0xd425('0x1'),_0xd425('0x2')];function createListener(_0x314a2b,_0x97e370){return function(_0x183caa){_0x97e370[_0xd425('0x3')](_0x314a2b,_0x183caa);};}function removeListener(_0x47043f,_0x596be7){return function(){ChatQueueEvents[_0xd425('0x4')](_0x47043f,_0x596be7);};}exports[_0xd425('0x5')]=function(_0xc4e080){for(var _0x36866e=0x0,_0x1d97d9=events[_0xd425('0x6')];_0x36866e<_0x1d97d9;_0x36866e++){var _0x50b061=events[_0x36866e];var _0xb6ba8e=createListener(_0xd425('0x7')+_0x50b061,_0xc4e080);ChatQueueEvents['on'](_0x50b061,_0xb6ba8e);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 3044429..672e856 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 _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x394060,_0x53eba3){var _0xedd258=function(_0xc447a6){while(--_0xc447a6){_0x394060['push'](_0x394060['shift']());}};_0xedd258(++_0x53eba3);}(_0x7217,0x19e));var _0x7721=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x7217[_0x3899d1];return _0xeb4a7d;};'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['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x23f615,_0xc4a2e8){var _0x3e7474=function(_0xe3ede1){while(--_0xe3ede1){_0x23f615['push'](_0x23f615['shift']());}};_0x3e7474(++_0xc4a2e8);}(_0x7217,0x19e));var _0x7721=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x7217[_0x31e29a];return _0x32d892;};'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['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index c6b40c6..785260c 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 _0x7741=['DATE','moment','sequelize','exports','STRING'];(function(_0x2c4f3f,_0x266947){var _0x3d0234=function(_0x31495c){while(--_0x31495c){_0x2c4f3f['push'](_0x2c4f3f['shift']());}};_0x3d0234(++_0x266947);}(_0x7741,0x1af));var _0x1774=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x7741[_0x49ca18];return _0x145d54;};'use strict';var moment=require(_0x1774('0x0'));var Sequelize=require(_0x1774('0x1'));module[_0x1774('0x2')]={'uniqueid':{'type':Sequelize[_0x1774('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1774('0x3')]},'joinAt':{'type':Sequelize[_0x1774('0x4')]},'leaveAt':{'type':Sequelize[_0x1774('0x4')]},'acceptAt':{'type':Sequelize[_0x1774('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe3ab=['exports','STRING','DATE','moment'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xe3ab,0x8b));var _0xbe3a=function(_0x2c52cd,_0x17bf79){_0x2c52cd=_0x2c52cd-0x0;var _0x432dd5=_0xe3ab[_0x2c52cd];return _0x432dd5;};'use strict';var moment=require(_0xbe3a('0x0'));var Sequelize=require('sequelize');module[_0xbe3a('0x1')]={'uniqueid':{'type':Sequelize[_0xbe3a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xbe3a('0x2')]},'joinAt':{'type':Sequelize[_0xbe3a('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbe3a('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xbe3a('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 6ab8384..a69fdd7 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 _0x4cfd=['destroy','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','end','sendStatus','stack','send','map','ChatQueueReport','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','show','rawAttributes','find','catch','create','body'];(function(_0x26dab8,_0x3be499){var _0xda463e=function(_0x2f2f4b){while(--_0x2f2f4b){_0x26dab8['push'](_0x26dab8['shift']());}};_0xda463e(++_0x3be499);}(_0x4cfd,0x170));var _0xd4cf=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0x4cfd[_0x3c2b2e];return _0x27a338;};'use strict';var emlformat=require(_0xd4cf('0x0'));var rimraf=require(_0xd4cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4cf('0x2'));var rp=require(_0xd4cf('0x3'));var moment=require(_0xd4cf('0x4'));var BPromise=require(_0xd4cf('0x5'));var Mustache=require(_0xd4cf('0x6'));var util=require(_0xd4cf('0x7'));var path=require('path');var sox=require(_0xd4cf('0x8'));var csv=require(_0xd4cf('0x9'));var ejs=require(_0xd4cf('0xa'));var fs=require('fs');var fs_extra=require(_0xd4cf('0xb'));var _=require(_0xd4cf('0xc'));var squel=require(_0xd4cf('0xd'));var crypto=require('crypto');var jsforce=require(_0xd4cf('0xe'));var deskjs=require(_0xd4cf('0xf'));var toCsv=require(_0xd4cf('0x9'));var querystring=require(_0xd4cf('0x10'));var Papa=require(_0xd4cf('0x11'));var Redis=require(_0xd4cf('0x12'));var authService=require(_0xd4cf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd4cf('0x14'));var hardwareService=require(_0xd4cf('0x15'));var logger=require(_0xd4cf('0x16'))(_0xd4cf('0x17'));var utils=require(_0xd4cf('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd4cf('0x19'))['db'];function respondWithStatusCode(_0x294c99,_0x544065){_0x544065=_0x544065||0xcc;return function(_0x3ff2db){if(_0x3ff2db){return _0x294c99['sendStatus'](_0x544065);}return _0x294c99[_0xd4cf('0x1a')](_0x544065)['end']();};}function respondWithResult(_0x330630,_0xa597cd){_0xa597cd=_0xa597cd||0xc8;return function(_0x51c61e){if(_0x51c61e){return _0x330630[_0xd4cf('0x1a')](_0xa597cd)[_0xd4cf('0x1b')](_0x51c61e);}};}function respondWithFilteredResult(_0x2f8607,_0x13c0a1){return function(_0x44abd7){if(_0x44abd7){var _0x2ff69e=typeof _0x13c0a1['offset']===_0xd4cf('0x1c')&&typeof _0x13c0a1[_0xd4cf('0x1d')]===_0xd4cf('0x1c');var _0x11b06a=_0x44abd7[_0xd4cf('0x1e')];var _0x3e749d=_0x2ff69e?0x0:_0x13c0a1[_0xd4cf('0x1f')];var _0x1df3e0=_0x2ff69e?_0x44abd7[_0xd4cf('0x1e')]:_0x13c0a1[_0xd4cf('0x1f')]+_0x13c0a1[_0xd4cf('0x1d')];var _0x540e2b;if(_0x1df3e0>=_0x11b06a){_0x1df3e0=_0x11b06a;_0x540e2b=0xc8;}else{_0x540e2b=0xce;}_0x2f8607[_0xd4cf('0x1a')](_0x540e2b);return _0x2f8607[_0xd4cf('0x20')](_0xd4cf('0x21'),_0x3e749d+'-'+_0x1df3e0+'/'+_0x11b06a)[_0xd4cf('0x1b')](_0x44abd7);}return null;};}function patchUpdates(_0x1caa70){return function(_0x2bef15){try{jsonpatch[_0xd4cf('0x22')](_0x2bef15,_0x1caa70,!![]);}catch(_0x5338dc){return BPromise[_0xd4cf('0x23')](_0x5338dc);}return _0x2bef15['save']();};}function saveUpdates(_0x4ec111,_0x10f6a7){return function(_0x3dbe6d){if(_0x3dbe6d){return _0x3dbe6d[_0xd4cf('0x24')](_0x4ec111)[_0xd4cf('0x25')](function(_0x2fe806){return _0x2fe806;});}return null;};}function removeEntity(_0x40c251,_0x54aaab){return function(_0x14c159){if(_0x14c159){return _0x14c159['destroy']()[_0xd4cf('0x25')](function(){_0x40c251[_0xd4cf('0x1a')](0xcc)[_0xd4cf('0x26')]();});}};}function handleEntityNotFound(_0x4c1896,_0x5266aa){return function(_0x52c21b){if(!_0x52c21b){_0x4c1896[_0xd4cf('0x27')](0x194);}return _0x52c21b;};}function handleError(_0x413317,_0x4fd6ea){_0x4fd6ea=_0x4fd6ea||0x1f4;return function(_0x59c215){logger['error'](_0x59c215[_0xd4cf('0x28')]);if(_0x59c215['name']){delete _0x59c215['name'];}_0x413317['status'](_0x4fd6ea)[_0xd4cf('0x29')](_0x59c215);};}exports['index']=function(_0xd08f38,_0xa9ae56){var _0x2459f4={},_0x3b507f={},_0x45943d={'count':0x0,'rows':[]};var _0x2183c1=_[_0xd4cf('0x2a')](db[_0xd4cf('0x2b')]['rawAttributes'],function(_0x1c6ae5){return{'name':_0x1c6ae5[_0xd4cf('0x2c')],'type':_0x1c6ae5[_0xd4cf('0x2d')]['key']};});_0x3b507f['model']=_[_0xd4cf('0x2a')](_0x2183c1,_0xd4cf('0x2e'));_0x3b507f[_0xd4cf('0x2f')]=_[_0xd4cf('0x30')](_0xd08f38[_0xd4cf('0x2f')]);_0x3b507f[_0xd4cf('0x31')]=_[_0xd4cf('0x32')](_0x3b507f[_0xd4cf('0x33')],_0x3b507f['query']);_0x2459f4[_0xd4cf('0x34')]=_[_0xd4cf('0x32')](_0x3b507f[_0xd4cf('0x33')],qs[_0xd4cf('0x35')](_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x35')]));_0x2459f4[_0xd4cf('0x34')]=_0x2459f4[_0xd4cf('0x34')][_0xd4cf('0x36')]?_0x2459f4[_0xd4cf('0x34')]:_0x3b507f[_0xd4cf('0x33')];if(!_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x37')]('nolimit')){_0x2459f4['limit']=qs[_0xd4cf('0x1d')](_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x1d')]);_0x2459f4[_0xd4cf('0x1f')]=qs[_0xd4cf('0x1f')](_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x1f')]);}_0x2459f4[_0xd4cf('0x38')]=qs['sort'](_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x39')]);_0x2459f4[_0xd4cf('0x3a')]=qs['filters'](_['pick'](_0xd08f38[_0xd4cf('0x2f')],_0x3b507f[_0xd4cf('0x31')]),_0x2183c1);if(_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x3b')]){_0x2459f4['where']=_[_0xd4cf('0x3c')](_0x2459f4[_0xd4cf('0x3a')],{'$or':_[_0xd4cf('0x2a')](_0x2183c1,function(_0x222669){if(_0x222669['type']!=='VIRTUAL'){var _0x4aeaa8={};_0x4aeaa8[_0x222669[_0xd4cf('0x2e')]]={'$like':'%'+_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x3b')]+'%'};return _0x4aeaa8;}})});}_0x2459f4=_[_0xd4cf('0x3c')]({},_0x2459f4,_0xd08f38[_0xd4cf('0x3d')]);var _0x17a8ee={'where':_0x2459f4[_0xd4cf('0x3a')]};return db[_0xd4cf('0x2b')]['count'](_0x17a8ee)['then'](function(_0x52fa6b){_0x45943d[_0xd4cf('0x1e')]=_0x52fa6b;if(_0xd08f38['query'][_0xd4cf('0x3e')]){_0x2459f4[_0xd4cf('0x3f')]=[{'all':!![]}];}return db[_0xd4cf('0x2b')]['findAll'](_0x2459f4);})[_0xd4cf('0x25')](function(_0x1ee4e2){_0x45943d['rows']=_0x1ee4e2;return _0x45943d;})[_0xd4cf('0x25')](respondWithFilteredResult(_0xa9ae56,_0x2459f4))['catch'](handleError(_0xa9ae56,null));};exports[_0xd4cf('0x40')]=function(_0x4b6da5,_0x4541db){var _0x476b2d={'raw':!![],'where':{'id':_0x4b6da5['params']['id']}},_0x4b874e={};_0x4b874e['model']=_[_0xd4cf('0x30')](db[_0xd4cf('0x2b')][_0xd4cf('0x41')]);_0x4b874e[_0xd4cf('0x2f')]=_[_0xd4cf('0x30')](_0x4b6da5[_0xd4cf('0x2f')]);_0x4b874e['filters']=_[_0xd4cf('0x32')](_0x4b874e[_0xd4cf('0x33')],_0x4b874e[_0xd4cf('0x2f')]);_0x476b2d[_0xd4cf('0x34')]=_['intersection'](_0x4b874e[_0xd4cf('0x33')],qs['fields'](_0x4b6da5[_0xd4cf('0x2f')][_0xd4cf('0x35')]));_0x476b2d['attributes']=_0x476b2d['attributes'][_0xd4cf('0x36')]?_0x476b2d[_0xd4cf('0x34')]:_0x4b874e['model'];if(_0x4b6da5[_0xd4cf('0x2f')][_0xd4cf('0x3e')]){_0x476b2d[_0xd4cf('0x3f')]=[{'all':!![]}];}_0x476b2d=_[_0xd4cf('0x3c')]({},_0x476b2d,_0x4b6da5[_0xd4cf('0x3d')]);return db['ChatQueueReport'][_0xd4cf('0x42')](_0x476b2d)[_0xd4cf('0x25')](handleEntityNotFound(_0x4541db,null))[_0xd4cf('0x25')](respondWithResult(_0x4541db,null))[_0xd4cf('0x43')](handleError(_0x4541db,null));};exports[_0xd4cf('0x44')]=function(_0x1a547a,_0x55504f){return db[_0xd4cf('0x2b')][_0xd4cf('0x44')](_0x1a547a[_0xd4cf('0x45')],{})[_0xd4cf('0x25')](respondWithResult(_0x55504f,0xc9))[_0xd4cf('0x43')](handleError(_0x55504f,null));};exports[_0xd4cf('0x24')]=function(_0x14af9f,_0x532c7b){if(_0x14af9f[_0xd4cf('0x45')]['id']){delete _0x14af9f[_0xd4cf('0x45')]['id'];}return db[_0xd4cf('0x2b')][_0xd4cf('0x42')]({'where':{'id':_0x14af9f['params']['id']}})[_0xd4cf('0x25')](handleEntityNotFound(_0x532c7b,null))[_0xd4cf('0x25')](saveUpdates(_0x14af9f[_0xd4cf('0x45')],null))[_0xd4cf('0x25')](respondWithResult(_0x532c7b,null))[_0xd4cf('0x43')](handleError(_0x532c7b,null));};exports[_0xd4cf('0x46')]=function(_0xe69dbf,_0x4fd5e0){return db['ChatQueueReport']['find']({'where':{'id':_0xe69dbf[_0xd4cf('0x47')]['id']}})[_0xd4cf('0x25')](handleEntityNotFound(_0x4fd5e0,null))[_0xd4cf('0x25')](removeEntity(_0x4fd5e0,null))[_0xd4cf('0x43')](handleError(_0x4fd5e0,null));};exports[_0xd4cf('0x48')]=function(_0x4934a0,_0x54bb75){return db[_0xd4cf('0x2b')]['describe']()[_0xd4cf('0x25')](respondWithResult(_0x54bb75,null))[_0xd4cf('0x43')](handleError(_0x54bb75,null));}; \ No newline at end of file +var _0x9120=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','length','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x9120,0x1b3));var _0x0912=function(_0x5ef8d8,_0x3d70a2){_0x5ef8d8=_0x5ef8d8-0x0;var _0x21cd90=_0x9120[_0x5ef8d8];return _0x21cd90;};'use strict';var emlformat=require(_0x0912('0x0'));var rimraf=require(_0x0912('0x1'));var zipdir=require(_0x0912('0x2'));var jsonpatch=require(_0x0912('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0912('0x4'));var Mustache=require(_0x0912('0x5'));var util=require(_0x0912('0x6'));var path=require(_0x0912('0x7'));var sox=require(_0x0912('0x8'));var csv=require(_0x0912('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0912('0xa'));var _=require(_0x0912('0xb'));var squel=require(_0x0912('0xc'));var crypto=require('crypto');var jsforce=require(_0x0912('0xd'));var deskjs=require(_0x0912('0xe'));var toCsv=require(_0x0912('0x9'));var querystring=require(_0x0912('0xf'));var Papa=require(_0x0912('0x10'));var Redis=require('ioredis');var authService=require(_0x0912('0x11'));var qs=require(_0x0912('0x12'));var as=require(_0x0912('0x13'));var hardwareService=require(_0x0912('0x14'));var logger=require('../../config/logger')(_0x0912('0x15'));var utils=require('../../config/utils');var config=require(_0x0912('0x16'));var licenseUtil=require(_0x0912('0x17'));var db=require(_0x0912('0x18'))['db'];function respondWithStatusCode(_0xc7af62,_0x22752b){_0x22752b=_0x22752b||0xcc;return function(_0x10faac){if(_0x10faac){return _0xc7af62[_0x0912('0x19')](_0x22752b);}return _0xc7af62[_0x0912('0x1a')](_0x22752b)[_0x0912('0x1b')]();};}function respondWithResult(_0x102468,_0x17f22d){_0x17f22d=_0x17f22d||0xc8;return function(_0x350d6b){if(_0x350d6b){return _0x102468[_0x0912('0x1a')](_0x17f22d)[_0x0912('0x1c')](_0x350d6b);}};}function respondWithFilteredResult(_0x247612,_0x5eb1c9){return function(_0x4d00fd){if(_0x4d00fd){var _0x1ed3e8=typeof _0x5eb1c9['offset']===_0x0912('0x1d')&&typeof _0x5eb1c9['limit']===_0x0912('0x1d');var _0x49b581=_0x4d00fd[_0x0912('0x1e')];var _0x5eace1=_0x1ed3e8?0x0:_0x5eb1c9[_0x0912('0x1f')];var _0x5357db=_0x1ed3e8?_0x4d00fd[_0x0912('0x1e')]:_0x5eb1c9['offset']+_0x5eb1c9['limit'];var _0x3377af;if(_0x5357db>=_0x49b581){_0x5357db=_0x49b581;_0x3377af=0xc8;}else{_0x3377af=0xce;}_0x247612['status'](_0x3377af);return _0x247612[_0x0912('0x20')](_0x0912('0x21'),_0x5eace1+'-'+_0x5357db+'/'+_0x49b581)['json'](_0x4d00fd);}return null;};}function patchUpdates(_0x106008){return function(_0xb1af32){try{jsonpatch[_0x0912('0x22')](_0xb1af32,_0x106008,!![]);}catch(_0x5927d2){return BPromise['reject'](_0x5927d2);}return _0xb1af32[_0x0912('0x23')]();};}function saveUpdates(_0x626428,_0x1f04a1){return function(_0x30b7cc){if(_0x30b7cc){return _0x30b7cc[_0x0912('0x24')](_0x626428)[_0x0912('0x25')](function(_0x6c4902){return _0x6c4902;});}return null;};}function removeEntity(_0x2a3e70,_0xca7f8b){return function(_0x572d12){if(_0x572d12){return _0x572d12[_0x0912('0x26')]()[_0x0912('0x25')](function(){_0x2a3e70[_0x0912('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a938e,_0x21d65b){return function(_0x53d673){if(!_0x53d673){_0x4a938e['sendStatus'](0x194);}return _0x53d673;};}function handleError(_0x39462e,_0x39e96b){_0x39e96b=_0x39e96b||0x1f4;return function(_0x4d45d2){logger[_0x0912('0x27')](_0x4d45d2[_0x0912('0x28')]);if(_0x4d45d2[_0x0912('0x29')]){delete _0x4d45d2[_0x0912('0x29')];}_0x39462e[_0x0912('0x1a')](_0x39e96b)['send'](_0x4d45d2);};}exports[_0x0912('0x2a')]=function(_0x1d6c87,_0x4ac024){var _0x2b1653={},_0x3428a9={},_0x2ce714={'count':0x0,'rows':[]};var _0x5b3956=_[_0x0912('0x2b')](db[_0x0912('0x2c')][_0x0912('0x2d')],function(_0x176529){return{'name':_0x176529['fieldName'],'type':_0x176529[_0x0912('0x2e')][_0x0912('0x2f')]};});_0x3428a9[_0x0912('0x30')]=_[_0x0912('0x2b')](_0x5b3956,_0x0912('0x29'));_0x3428a9[_0x0912('0x31')]=_['keys'](_0x1d6c87['query']);_0x3428a9[_0x0912('0x32')]=_[_0x0912('0x33')](_0x3428a9['model'],_0x3428a9['query']);_0x2b1653[_0x0912('0x34')]=_[_0x0912('0x33')](_0x3428a9[_0x0912('0x30')],qs[_0x0912('0x35')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x35')]));_0x2b1653[_0x0912('0x34')]=_0x2b1653[_0x0912('0x34')]['length']?_0x2b1653['attributes']:_0x3428a9[_0x0912('0x30')];if(!_0x1d6c87[_0x0912('0x31')]['hasOwnProperty'](_0x0912('0x36'))){_0x2b1653[_0x0912('0x37')]=qs[_0x0912('0x37')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x37')]);_0x2b1653[_0x0912('0x1f')]=qs[_0x0912('0x1f')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x1f')]);}_0x2b1653['order']=qs[_0x0912('0x38')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x38')]);_0x2b1653[_0x0912('0x39')]=qs[_0x0912('0x32')](_[_0x0912('0x3a')](_0x1d6c87[_0x0912('0x31')],_0x3428a9['filters']),_0x5b3956);if(_0x1d6c87[_0x0912('0x31')]['filter']){_0x2b1653['where']=_['merge'](_0x2b1653[_0x0912('0x39')],{'$or':_[_0x0912('0x2b')](_0x5b3956,function(_0x5db5f9){if(_0x5db5f9[_0x0912('0x2e')]!==_0x0912('0x3b')){var _0xfdf81c={};_0xfdf81c[_0x5db5f9['name']]={'$like':'%'+_0x1d6c87[_0x0912('0x31')][_0x0912('0x3c')]+'%'};return _0xfdf81c;}})});}_0x2b1653=_['merge']({},_0x2b1653,_0x1d6c87[_0x0912('0x3d')]);var _0x40de57={'where':_0x2b1653[_0x0912('0x39')]};return db[_0x0912('0x2c')][_0x0912('0x1e')](_0x40de57)[_0x0912('0x25')](function(_0x4eb359){_0x2ce714[_0x0912('0x1e')]=_0x4eb359;if(_0x1d6c87[_0x0912('0x31')][_0x0912('0x3e')]){_0x2b1653[_0x0912('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0912('0x40')](_0x2b1653);})[_0x0912('0x25')](function(_0x10040b){_0x2ce714['rows']=_0x10040b;return _0x2ce714;})[_0x0912('0x25')](respondWithFilteredResult(_0x4ac024,_0x2b1653))[_0x0912('0x41')](handleError(_0x4ac024,null));};exports[_0x0912('0x42')]=function(_0x19839e,_0x1c5158){var _0x320f98={'raw':!![],'where':{'id':_0x19839e[_0x0912('0x43')]['id']}},_0x15e23b={};_0x15e23b['model']=_[_0x0912('0x44')](db['ChatQueueReport'][_0x0912('0x2d')]);_0x15e23b[_0x0912('0x31')]=_[_0x0912('0x44')](_0x19839e[_0x0912('0x31')]);_0x15e23b[_0x0912('0x32')]=_[_0x0912('0x33')](_0x15e23b[_0x0912('0x30')],_0x15e23b[_0x0912('0x31')]);_0x320f98['attributes']=_[_0x0912('0x33')](_0x15e23b[_0x0912('0x30')],qs[_0x0912('0x35')](_0x19839e['query'][_0x0912('0x35')]));_0x320f98[_0x0912('0x34')]=_0x320f98[_0x0912('0x34')][_0x0912('0x45')]?_0x320f98[_0x0912('0x34')]:_0x15e23b[_0x0912('0x30')];if(_0x19839e[_0x0912('0x31')][_0x0912('0x3e')]){_0x320f98[_0x0912('0x3f')]=[{'all':!![]}];}_0x320f98=_[_0x0912('0x46')]({},_0x320f98,_0x19839e[_0x0912('0x3d')]);return db[_0x0912('0x2c')][_0x0912('0x47')](_0x320f98)[_0x0912('0x25')](handleEntityNotFound(_0x1c5158,null))[_0x0912('0x25')](respondWithResult(_0x1c5158,null))[_0x0912('0x41')](handleError(_0x1c5158,null));};exports[_0x0912('0x48')]=function(_0x255ee5,_0x3b0548){return db[_0x0912('0x2c')][_0x0912('0x48')](_0x255ee5[_0x0912('0x49')],{})[_0x0912('0x25')](respondWithResult(_0x3b0548,0xc9))['catch'](handleError(_0x3b0548,null));};exports[_0x0912('0x24')]=function(_0x3b94cc,_0x591c83){if(_0x3b94cc[_0x0912('0x49')]['id']){delete _0x3b94cc[_0x0912('0x49')]['id'];}return db[_0x0912('0x2c')][_0x0912('0x47')]({'where':{'id':_0x3b94cc[_0x0912('0x43')]['id']}})[_0x0912('0x25')](handleEntityNotFound(_0x591c83,null))['then'](saveUpdates(_0x3b94cc[_0x0912('0x49')],null))[_0x0912('0x25')](respondWithResult(_0x591c83,null))[_0x0912('0x41')](handleError(_0x591c83,null));};exports['destroy']=function(_0x11364e,_0x3ce4bf){return db[_0x0912('0x2c')][_0x0912('0x47')]({'where':{'id':_0x11364e[_0x0912('0x43')]['id']}})[_0x0912('0x25')](handleEntityNotFound(_0x3ce4bf,null))[_0x0912('0x25')](removeEntity(_0x3ce4bf,null))[_0x0912('0x41')](handleError(_0x3ce4bf,null));};exports['describe']=function(_0x91bb1a,_0x360313){return db[_0x0912('0x2c')][_0x0912('0x4a')]()[_0x0912('0x25')](respondWithResult(_0x360313,null))['catch'](handleError(_0x360313,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index d2ed5c9..ee18a5b 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 _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x36d25e,_0x1a047d){_0x36d25e=_0x36d25e-0x0;var _0x4b95b8=_0xcb91[_0x36d25e];return _0x4b95b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xf51299,_0x388983){var _0x2db212=function(_0x285929){while(--_0x285929){_0xf51299['push'](_0xf51299['shift']());}};_0x2db212(++_0x388983);}(_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('./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 diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index c542a21..d76bb67 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 _0xbd99=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','info','catch','UpdateChatQueueReport','limit','lodash'];(function(_0x1e8ded,_0x2c2bcc){var _0xe418ec=function(_0x502880){while(--_0x502880){_0x1e8ded['push'](_0x1e8ded['shift']());}};_0xe418ec(++_0x2c2bcc);}(_0xbd99,0x1df));var _0x9bd9=function(_0x254d9c,_0x29723f){_0x254d9c=_0x254d9c-0x0;var _0x3dc0e9=_0xbd99[_0x254d9c];return _0x3dc0e9;};'use strict';var _=require(_0x9bd9('0x0'));var util=require(_0x9bd9('0x1'));var moment=require('moment');var BPromise=require(_0x9bd9('0x2'));var rs=require(_0x9bd9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bd9('0x4'))['db'];var utils=require(_0x9bd9('0x5'));var logger=require(_0x9bd9('0x6'))(_0x9bd9('0x7'));var config=require(_0x9bd9('0x8'));var jayson=require(_0x9bd9('0x9'));var client=jayson[_0x9bd9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b41ea,_0x241303,_0x28b83f){return new BPromise(function(_0x7ddd62,_0x441225){return client[_0x9bd9('0xb')](_0x3b41ea,_0x28b83f)['then'](function(_0x865dc1){logger['info'](_0x9bd9('0xc'),_0x241303,_0x9bd9('0xd'));logger[_0x9bd9('0xe')](_0x9bd9('0xf'),_0x241303,_0x9bd9('0xd'),JSON[_0x9bd9('0x10')](_0x865dc1));if(_0x865dc1[_0x9bd9('0x11')]){if(_0x865dc1['error'][_0x9bd9('0x12')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x241303,_0x865dc1[_0x9bd9('0x11')]['message']);return _0x441225(_0x865dc1[_0x9bd9('0x11')][_0x9bd9('0x13')]);}logger[_0x9bd9('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x241303,_0x865dc1[_0x9bd9('0x11')]['message']);return _0x7ddd62(_0x865dc1[_0x9bd9('0x11')][_0x9bd9('0x13')]);}else{logger['info'](_0x9bd9('0xc'),_0x241303,_0x9bd9('0xd'));_0x7ddd62(_0x865dc1[_0x9bd9('0x14')][_0x9bd9('0x13')]);}})['catch'](function(_0x57ffcb){logger[_0x9bd9('0x11')](_0x9bd9('0xc'),_0x241303,_0x57ffcb);_0x441225(_0x57ffcb);});});}exports[_0x9bd9('0x15')]=function(_0x46a4bf){var _0x3cba37=this;return new Promise(function(_0x3e52ae,_0x4bb159){return db[_0x9bd9('0x16')][_0x9bd9('0x17')](_0x46a4bf[_0x9bd9('0x18')],{'raw':_0x46a4bf['options']?_0x46a4bf[_0x9bd9('0x19')][_0x9bd9('0x1a')]===undefined?!![]:![]:!![]})[_0x9bd9('0x1b')](function(_0x1820e3){logger[_0x9bd9('0x1c')](_0x9bd9('0x15'),_0x46a4bf);logger['debug']('CreateChatQueueReport',_0x46a4bf,JSON['stringify'](_0x1820e3));_0x3e52ae(_0x1820e3);})[_0x9bd9('0x1d')](function(_0x1fd658){logger[_0x9bd9('0x11')](_0x9bd9('0x15'),_0x1fd658[_0x9bd9('0x13')],_0x46a4bf);_0x4bb159(_0x3cba37[_0x9bd9('0x11')](0x1f4,_0x1fd658['message']));});});};exports[_0x9bd9('0x1e')]=function(_0x4b6bec){var _0x17f3ff=this;return new Promise(function(_0x511d05,_0x2a06e9){return db[_0x9bd9('0x16')]['update'](_0x4b6bec[_0x9bd9('0x18')],{'raw':_0x4b6bec[_0x9bd9('0x19')]?_0x4b6bec[_0x9bd9('0x19')][_0x9bd9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b6bec[_0x9bd9('0x19')]?_0x4b6bec[_0x9bd9('0x19')]['where']||null:null,'attributes':_0x4b6bec[_0x9bd9('0x19')]?_0x4b6bec[_0x9bd9('0x19')]['attributes']||null:null,'limit':_0x4b6bec[_0x9bd9('0x19')]?_0x4b6bec[_0x9bd9('0x19')][_0x9bd9('0x1f')]||null:null})['then'](function(_0x4fdcc6){logger['info'](_0x9bd9('0x1e'),_0x4b6bec);logger[_0x9bd9('0xe')](_0x9bd9('0x1e'),_0x4b6bec,JSON[_0x9bd9('0x10')](_0x4fdcc6));_0x511d05(_0x4fdcc6);})[_0x9bd9('0x1d')](function(_0x29a10c){logger['error'](_0x9bd9('0x1e'),_0x29a10c[_0x9bd9('0x13')],_0x4b6bec);_0x2a06e9(_0x17f3ff[_0x9bd9('0x11')](0x1f4,_0x29a10c[_0x9bd9('0x13')]));});});}; \ No newline at end of file +var _0xc0dc=['request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x285f9b,_0xfcae6c){var _0x32dd58=function(_0x392920){while(--_0x392920){_0x285f9b['push'](_0x285f9b['shift']());}};_0x32dd58(++_0xfcae6c);}(_0xc0dc,0xf6));var _0xcc0d=function(_0x4e291b,_0x1f1dcc){_0x4e291b=_0x4e291b-0x0;var _0x2d0bd3=_0xc0dc[_0x4e291b];return _0x2d0bd3;};'use strict';var _=require(_0xcc0d('0x0'));var util=require(_0xcc0d('0x1'));var moment=require(_0xcc0d('0x2'));var BPromise=require(_0xcc0d('0x3'));var rs=require(_0xcc0d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc0d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc0d('0x6'))(_0xcc0d('0x7'));var config=require(_0xcc0d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcc0d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387e4f,_0x43de3e,_0x4f387e){return new BPromise(function(_0x49fda8,_0xb83ca3){return client[_0xcc0d('0xa')](_0x387e4f,_0x4f387e)[_0xcc0d('0xb')](function(_0x6e4dca){logger[_0xcc0d('0xc')](_0xcc0d('0xd'),_0x43de3e,'request\x20sent');logger[_0xcc0d('0xe')](_0xcc0d('0xf'),_0x43de3e,_0xcc0d('0x10'),JSON[_0xcc0d('0x11')](_0x6e4dca));if(_0x6e4dca['error']){if(_0x6e4dca['error']['code']===0x1f4){logger['error'](_0xcc0d('0xd'),_0x43de3e,_0x6e4dca[_0xcc0d('0x12')][_0xcc0d('0x13')]);return _0xb83ca3(_0x6e4dca[_0xcc0d('0x12')][_0xcc0d('0x13')]);}logger[_0xcc0d('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x43de3e,_0x6e4dca[_0xcc0d('0x12')][_0xcc0d('0x13')]);return _0x49fda8(_0x6e4dca[_0xcc0d('0x12')][_0xcc0d('0x13')]);}else{logger[_0xcc0d('0xc')](_0xcc0d('0xd'),_0x43de3e,'request\x20sent');_0x49fda8(_0x6e4dca[_0xcc0d('0x14')]['message']);}})['catch'](function(_0x4d7182){logger['error'](_0xcc0d('0xd'),_0x43de3e,_0x4d7182);_0xb83ca3(_0x4d7182);});});}exports[_0xcc0d('0x15')]=function(_0x57d7f1){var _0x4c2b0e=this;return new Promise(function(_0x23f28d,_0x22745e){return db[_0xcc0d('0x16')][_0xcc0d('0x17')](_0x57d7f1[_0xcc0d('0x18')],{'raw':_0x57d7f1['options']?_0x57d7f1[_0xcc0d('0x19')][_0xcc0d('0x1a')]===undefined?!![]:![]:!![]})[_0xcc0d('0xb')](function(_0x40dbbc){logger['info'](_0xcc0d('0x15'),_0x57d7f1);logger[_0xcc0d('0xe')](_0xcc0d('0x15'),_0x57d7f1,JSON[_0xcc0d('0x11')](_0x40dbbc));_0x23f28d(_0x40dbbc);})['catch'](function(_0x59285d){logger[_0xcc0d('0x12')](_0xcc0d('0x15'),_0x59285d['message'],_0x57d7f1);_0x22745e(_0x4c2b0e['error'](0x1f4,_0x59285d[_0xcc0d('0x13')]));});});};exports[_0xcc0d('0x1b')]=function(_0x8fd67c){var _0xca46ee=this;return new Promise(function(_0x306c05,_0x5487f7){return db[_0xcc0d('0x16')]['update'](_0x8fd67c[_0xcc0d('0x18')],{'raw':_0x8fd67c['options']?_0x8fd67c[_0xcc0d('0x19')][_0xcc0d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8fd67c[_0xcc0d('0x19')]?_0x8fd67c[_0xcc0d('0x19')][_0xcc0d('0x1c')]||null:null,'attributes':_0x8fd67c[_0xcc0d('0x19')]?_0x8fd67c[_0xcc0d('0x19')][_0xcc0d('0x1d')]||null:null,'limit':_0x8fd67c[_0xcc0d('0x19')]?_0x8fd67c[_0xcc0d('0x19')][_0xcc0d('0x1e')]||null:null})[_0xcc0d('0xb')](function(_0x226f57){logger[_0xcc0d('0xc')]('UpdateChatQueueReport',_0x8fd67c);logger['debug'](_0xcc0d('0x1b'),_0x8fd67c,JSON[_0xcc0d('0x11')](_0x226f57));_0x306c05(_0x226f57);})[_0xcc0d('0x1f')](function(_0x448941){logger[_0xcc0d('0x12')]('UpdateChatQueueReport',_0x448941['message'],_0x8fd67c);_0x5487f7(_0xca46ee[_0xcc0d('0x12')](0x1f4,_0x448941[_0xcc0d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 758bd15..8e15c2d 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 _0x5517=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','post','create','/:id','update','destroy','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x4c5b92,_0x4bef5c){var _0x137efd=function(_0x19637a){while(--_0x19637a){_0x4c5b92['push'](_0x4c5b92['shift']());}};_0x137efd(++_0x4bef5c);}(_0x5517,0x151));var _0x7551=function(_0x5cc14b,_0x17f0d0){_0x5cc14b=_0x5cc14b-0x0;var _0x1064de=_0x5517[_0x5cc14b];return _0x1064de;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7551('0x0'));var timeout=require(_0x7551('0x1'));var express=require(_0x7551('0x2'));var router=express[_0x7551('0x3')]();var fs_extra=require(_0x7551('0x4'));var auth=require(_0x7551('0x5'));var interaction=require(_0x7551('0x6'));var config=require(_0x7551('0x7'));var controller=require(_0x7551('0x8'));router[_0x7551('0x9')]('/',auth[_0x7551('0xa')](),controller[_0x7551('0xb')]);router['get']('/describe',auth[_0x7551('0xa')](),controller[_0x7551('0xc')]);router[_0x7551('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7551('0xd')]('/',auth[_0x7551('0xa')](),controller[_0x7551('0xe')]);router['put'](_0x7551('0xf'),auth[_0x7551('0xa')](),controller[_0x7551('0x10')]);router['delete']('/:id',auth[_0x7551('0xa')](),controller[_0x7551('0x11')]);module[_0x7551('0x12')]=router; \ No newline at end of file +var _0xe554=['/:id','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','get','show','post','create','put'];(function(_0x197043,_0x3ebf47){var _0x233e33=function(_0x17bd0f){while(--_0x17bd0f){_0x197043['push'](_0x197043['shift']());}};_0x233e33(++_0x3ebf47);}(_0xe554,0x112));var _0x4e55=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe554[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x4e55('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e55('0x1'));var express=require(_0x4e55('0x2'));var router=express[_0x4e55('0x3')]();var fs_extra=require(_0x4e55('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4e55('0x5'));var config=require(_0x4e55('0x6'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x4e55('0x7')](),controller['index']);router['get'](_0x4e55('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x4e55('0x9')]('/:id',auth[_0x4e55('0x7')](),controller[_0x4e55('0xa')]);router[_0x4e55('0xb')]('/',auth[_0x4e55('0x7')](),controller[_0x4e55('0xc')]);router[_0x4e55('0xd')](_0x4e55('0xe'),auth['isAuthenticated'](),controller[_0x4e55('0xf')]);router[_0x4e55('0x10')](_0x4e55('0xe'),auth[_0x4e55('0x7')](),controller['destroy']);module[_0x4e55('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index c103d25..071274a 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x3928a0,_0x491c35){var _0x54839f=function(_0x379754){while(--_0x379754){_0x3928a0['push'](_0x3928a0['shift']());}};_0x54839f(++_0x491c35);}(_0x70e0,0x17b));var _0x070e=function(_0x4e3851,_0x51ae8d){_0x4e3851=_0x4e3851-0x0;var _0x22a59c=_0x70e0[_0x4e3851];return _0x22a59c;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x5a19fc,_0x58f9f4){var _0x34b413=function(_0x344feb){while(--_0x344feb){_0x5a19fc['push'](_0x5a19fc['shift']());}};_0x34b413(++_0x58f9f4);}(_0xb43b,0x1b2));var _0xbb43=function(_0x437344,_0x482d45){_0x437344=_0x437344-0x0;var _0x450a49=_0xb43b[_0x437344];return _0x450a49;};'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 diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index d2b9fe9..2e6b013 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 _0xe8f3=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','ChatTransferReport','rawAttributes','type','key','map','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','then','includeAll','include','findAll','rows','catch','params','intersection','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x26caac,_0x5469d6){var _0x5bd934=function(_0x39ad2){while(--_0x39ad2){_0x26caac['push'](_0x26caac['shift']());}};_0x5bd934(++_0x5469d6);}(_0xe8f3,0x1bc));var _0x3e8f=function(_0x2f5d29,_0x5b9a42){_0x2f5d29=_0x2f5d29-0x0;var _0x5a633e=_0xe8f3[_0x2f5d29];return _0x5a633e;};'use strict';var emlformat=require(_0x3e8f('0x0'));var rimraf=require(_0x3e8f('0x1'));var zipdir=require(_0x3e8f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e8f('0x3'));var moment=require(_0x3e8f('0x4'));var BPromise=require(_0x3e8f('0x5'));var Mustache=require(_0x3e8f('0x6'));var util=require(_0x3e8f('0x7'));var path=require(_0x3e8f('0x8'));var sox=require('sox');var csv=require(_0x3e8f('0x9'));var ejs=require(_0x3e8f('0xa'));var fs=require('fs');var fs_extra=require(_0x3e8f('0xb'));var _=require(_0x3e8f('0xc'));var squel=require(_0x3e8f('0xd'));var crypto=require(_0x3e8f('0xe'));var jsforce=require(_0x3e8f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3e8f('0x9'));var querystring=require(_0x3e8f('0x10'));var Papa=require(_0x3e8f('0x11'));var Redis=require(_0x3e8f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e8f('0x13'));var logger=require(_0x3e8f('0x14'))(_0x3e8f('0x15'));var utils=require(_0x3e8f('0x16'));var config=require(_0x3e8f('0x17'));var licenseUtil=require(_0x3e8f('0x18'));var db=require(_0x3e8f('0x19'))['db'];function respondWithStatusCode(_0x269897,_0x120bf1){_0x120bf1=_0x120bf1||0xcc;return function(_0x50d53e){if(_0x50d53e){return _0x269897[_0x3e8f('0x1a')](_0x120bf1);}return _0x269897[_0x3e8f('0x1b')](_0x120bf1)[_0x3e8f('0x1c')]();};}function respondWithResult(_0x727074,_0x3839bb){_0x3839bb=_0x3839bb||0xc8;return function(_0x2fd73e){if(_0x2fd73e){return _0x727074[_0x3e8f('0x1b')](_0x3839bb)[_0x3e8f('0x1d')](_0x2fd73e);}};}function respondWithFilteredResult(_0x5b854d,_0x149e18){return function(_0x377e3a){if(_0x377e3a){var _0x3407c3=typeof _0x149e18[_0x3e8f('0x1e')]===_0x3e8f('0x1f')&&typeof _0x149e18[_0x3e8f('0x20')]===_0x3e8f('0x1f');var _0x2e838f=_0x377e3a[_0x3e8f('0x21')];var _0x5099a1=_0x3407c3?0x0:_0x149e18[_0x3e8f('0x1e')];var _0x3dc2a1=_0x3407c3?_0x377e3a[_0x3e8f('0x21')]:_0x149e18[_0x3e8f('0x1e')]+_0x149e18[_0x3e8f('0x20')];var _0x599201;if(_0x3dc2a1>=_0x2e838f){_0x3dc2a1=_0x2e838f;_0x599201=0xc8;}else{_0x599201=0xce;}_0x5b854d['status'](_0x599201);return _0x5b854d[_0x3e8f('0x22')](_0x3e8f('0x23'),_0x5099a1+'-'+_0x3dc2a1+'/'+_0x2e838f)[_0x3e8f('0x1d')](_0x377e3a);}return null;};}function patchUpdates(_0x4dc3b0){return function(_0x3aed5f){try{jsonpatch[_0x3e8f('0x24')](_0x3aed5f,_0x4dc3b0,!![]);}catch(_0x3b8111){return BPromise[_0x3e8f('0x25')](_0x3b8111);}return _0x3aed5f[_0x3e8f('0x26')]();};}function saveUpdates(_0x47f2cf,_0x5d9333){return function(_0x57ecad){if(_0x57ecad){return _0x57ecad[_0x3e8f('0x27')](_0x47f2cf)['then'](function(_0x39da9a){return _0x39da9a;});}return null;};}function removeEntity(_0x43d304,_0x1db034){return function(_0x12a062){if(_0x12a062){return _0x12a062[_0x3e8f('0x28')]()['then'](function(){_0x43d304[_0x3e8f('0x1b')](0xcc)[_0x3e8f('0x1c')]();});}};}function handleEntityNotFound(_0x1f34fe,_0x384c7d){return function(_0x6c69aa){if(!_0x6c69aa){_0x1f34fe['sendStatus'](0x194);}return _0x6c69aa;};}function handleError(_0x3f68fb,_0x537d7c){_0x537d7c=_0x537d7c||0x1f4;return function(_0x546d3d){logger[_0x3e8f('0x29')](_0x546d3d[_0x3e8f('0x2a')]);if(_0x546d3d[_0x3e8f('0x2b')]){delete _0x546d3d[_0x3e8f('0x2b')];}_0x3f68fb[_0x3e8f('0x1b')](_0x537d7c)[_0x3e8f('0x2c')](_0x546d3d);};}exports[_0x3e8f('0x2d')]=function(_0x277c94,_0x7c6957){var _0x5c1d8c={},_0x131678={},_0x4ae593={'count':0x0,'rows':[]};var _0x399dd8=_['map'](db[_0x3e8f('0x2e')][_0x3e8f('0x2f')],function(_0x54ac81){return{'name':_0x54ac81['fieldName'],'type':_0x54ac81[_0x3e8f('0x30')][_0x3e8f('0x31')]};});_0x131678['model']=_[_0x3e8f('0x32')](_0x399dd8,'name');_0x131678[_0x3e8f('0x33')]=_[_0x3e8f('0x34')](_0x277c94[_0x3e8f('0x33')]);_0x131678[_0x3e8f('0x35')]=_['intersection'](_0x131678[_0x3e8f('0x36')],_0x131678[_0x3e8f('0x33')]);_0x5c1d8c['attributes']=_['intersection'](_0x131678[_0x3e8f('0x36')],qs[_0x3e8f('0x37')](_0x277c94[_0x3e8f('0x33')][_0x3e8f('0x37')]));_0x5c1d8c['attributes']=_0x5c1d8c[_0x3e8f('0x38')][_0x3e8f('0x39')]?_0x5c1d8c[_0x3e8f('0x38')]:_0x131678[_0x3e8f('0x36')];if(!_0x277c94[_0x3e8f('0x33')][_0x3e8f('0x3a')](_0x3e8f('0x3b'))){_0x5c1d8c['limit']=qs[_0x3e8f('0x20')](_0x277c94[_0x3e8f('0x33')][_0x3e8f('0x20')]);_0x5c1d8c[_0x3e8f('0x1e')]=qs['offset'](_0x277c94['query']['offset']);}_0x5c1d8c['order']=qs[_0x3e8f('0x3c')](_0x277c94[_0x3e8f('0x33')][_0x3e8f('0x3c')]);_0x5c1d8c['where']=qs[_0x3e8f('0x35')](_['pick'](_0x277c94[_0x3e8f('0x33')],_0x131678[_0x3e8f('0x35')]),_0x399dd8);if(_0x277c94[_0x3e8f('0x33')][_0x3e8f('0x3d')]){_0x5c1d8c[_0x3e8f('0x3e')]=_['merge'](_0x5c1d8c[_0x3e8f('0x3e')],{'$or':_[_0x3e8f('0x32')](_0x399dd8,function(_0x25ce41){if(_0x25ce41['type']!==_0x3e8f('0x3f')){var _0x49558f={};_0x49558f[_0x25ce41[_0x3e8f('0x2b')]]={'$like':'%'+_0x277c94[_0x3e8f('0x33')]['filter']+'%'};return _0x49558f;}})});}_0x5c1d8c=_[_0x3e8f('0x40')]({},_0x5c1d8c,_0x277c94['options']);var _0x1cc9c9={'where':_0x5c1d8c[_0x3e8f('0x3e')]};return db['ChatTransferReport'][_0x3e8f('0x21')](_0x1cc9c9)[_0x3e8f('0x41')](function(_0x5bca73){_0x4ae593['count']=_0x5bca73;if(_0x277c94['query'][_0x3e8f('0x42')]){_0x5c1d8c[_0x3e8f('0x43')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x3e8f('0x44')](_0x5c1d8c);})[_0x3e8f('0x41')](function(_0x43852c){_0x4ae593[_0x3e8f('0x45')]=_0x43852c;return _0x4ae593;})[_0x3e8f('0x41')](respondWithFilteredResult(_0x7c6957,_0x5c1d8c))[_0x3e8f('0x46')](handleError(_0x7c6957,null));};exports['show']=function(_0x592e2e,_0x579970){var _0x271f49={'raw':!![],'where':{'id':_0x592e2e[_0x3e8f('0x47')]['id']}},_0x407792={};_0x407792[_0x3e8f('0x36')]=_['keys'](db[_0x3e8f('0x2e')]['rawAttributes']);_0x407792[_0x3e8f('0x33')]=_[_0x3e8f('0x34')](_0x592e2e['query']);_0x407792[_0x3e8f('0x35')]=_[_0x3e8f('0x48')](_0x407792[_0x3e8f('0x36')],_0x407792[_0x3e8f('0x33')]);_0x271f49['attributes']=_[_0x3e8f('0x48')](_0x407792[_0x3e8f('0x36')],qs[_0x3e8f('0x37')](_0x592e2e[_0x3e8f('0x33')][_0x3e8f('0x37')]));_0x271f49[_0x3e8f('0x38')]=_0x271f49['attributes'][_0x3e8f('0x39')]?_0x271f49['attributes']:_0x407792[_0x3e8f('0x36')];if(_0x592e2e[_0x3e8f('0x33')][_0x3e8f('0x42')]){_0x271f49['include']=[{'all':!![]}];}_0x271f49=_[_0x3e8f('0x40')]({},_0x271f49,_0x592e2e[_0x3e8f('0x49')]);return db['ChatTransferReport'][_0x3e8f('0x4a')](_0x271f49)[_0x3e8f('0x41')](handleEntityNotFound(_0x579970,null))[_0x3e8f('0x41')](respondWithResult(_0x579970,null))[_0x3e8f('0x46')](handleError(_0x579970,null));};exports['create']=function(_0x405d55,_0x496b8d){return db[_0x3e8f('0x2e')][_0x3e8f('0x4b')](_0x405d55[_0x3e8f('0x4c')],{})[_0x3e8f('0x41')](respondWithResult(_0x496b8d,0xc9))[_0x3e8f('0x46')](handleError(_0x496b8d,null));};exports['update']=function(_0x48711d,_0x46b860){if(_0x48711d['body']['id']){delete _0x48711d[_0x3e8f('0x4c')]['id'];}return db['ChatTransferReport'][_0x3e8f('0x4a')]({'where':{'id':_0x48711d['params']['id']}})[_0x3e8f('0x41')](handleEntityNotFound(_0x46b860,null))[_0x3e8f('0x41')](saveUpdates(_0x48711d[_0x3e8f('0x4c')],null))[_0x3e8f('0x41')](respondWithResult(_0x46b860,null))['catch'](handleError(_0x46b860,null));};exports['destroy']=function(_0x22b9c5,_0x5324d2){return db[_0x3e8f('0x2e')][_0x3e8f('0x4a')]({'where':{'id':_0x22b9c5[_0x3e8f('0x47')]['id']}})[_0x3e8f('0x41')](handleEntityNotFound(_0x5324d2,null))[_0x3e8f('0x41')](removeEntity(_0x5324d2,null))[_0x3e8f('0x46')](handleError(_0x5324d2,null));};exports['describe']=function(_0x407d62,_0x5a673f){return db['ChatTransferReport'][_0x3e8f('0x4d')]()[_0x3e8f('0x41')](respondWithResult(_0x5a673f,null))[_0x3e8f('0x46')](handleError(_0x5a673f,null));}; \ No newline at end of file +var _0xfacc=['fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','ChatTransferReport','includeAll','include','rows','catch','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model'];(function(_0x49710a,_0x56a5f1){var _0x686417=function(_0x5d51ef){while(--_0x5d51ef){_0x49710a['push'](_0x49710a['shift']());}};_0x686417(++_0x56a5f1);}(_0xfacc,0xfc));var _0xcfac=function(_0x540311,_0x53ca8b){_0x540311=_0x540311-0x0;var _0x56beef=_0xfacc[_0x540311];return _0x56beef;};'use strict';var emlformat=require(_0xcfac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcfac('0x1'));var jsonpatch=require(_0xcfac('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcfac('0x3'));var Mustache=require('mustache');var util=require(_0xcfac('0x4'));var path=require(_0xcfac('0x5'));var sox=require(_0xcfac('0x6'));var csv=require(_0xcfac('0x7'));var ejs=require(_0xcfac('0x8'));var fs=require('fs');var fs_extra=require(_0xcfac('0x9'));var _=require(_0xcfac('0xa'));var squel=require(_0xcfac('0xb'));var crypto=require(_0xcfac('0xc'));var jsforce=require(_0xcfac('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcfac('0xe'));var Papa=require(_0xcfac('0xf'));var Redis=require(_0xcfac('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcfac('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcfac('0x12'));var logger=require(_0xcfac('0x13'))(_0xcfac('0x14'));var utils=require(_0xcfac('0x15'));var config=require(_0xcfac('0x16'));var licenseUtil=require(_0xcfac('0x17'));var db=require(_0xcfac('0x18'))['db'];function respondWithStatusCode(_0x4dd907,_0x21681a){_0x21681a=_0x21681a||0xcc;return function(_0x12e854){if(_0x12e854){return _0x4dd907['sendStatus'](_0x21681a);}return _0x4dd907[_0xcfac('0x19')](_0x21681a)[_0xcfac('0x1a')]();};}function respondWithResult(_0xffea01,_0x57069c){_0x57069c=_0x57069c||0xc8;return function(_0x297623){if(_0x297623){return _0xffea01[_0xcfac('0x19')](_0x57069c)[_0xcfac('0x1b')](_0x297623);}};}function respondWithFilteredResult(_0x117df8,_0x562e3c){return function(_0x356bfd){if(_0x356bfd){var _0xc2fcc4=typeof _0x562e3c[_0xcfac('0x1c')]===_0xcfac('0x1d')&&typeof _0x562e3c['limit']===_0xcfac('0x1d');var _0x3baaad=_0x356bfd[_0xcfac('0x1e')];var _0x286063=_0xc2fcc4?0x0:_0x562e3c[_0xcfac('0x1c')];var _0x36e510=_0xc2fcc4?_0x356bfd[_0xcfac('0x1e')]:_0x562e3c[_0xcfac('0x1c')]+_0x562e3c['limit'];var _0x458b54;if(_0x36e510>=_0x3baaad){_0x36e510=_0x3baaad;_0x458b54=0xc8;}else{_0x458b54=0xce;}_0x117df8['status'](_0x458b54);return _0x117df8[_0xcfac('0x1f')](_0xcfac('0x20'),_0x286063+'-'+_0x36e510+'/'+_0x3baaad)['json'](_0x356bfd);}return null;};}function patchUpdates(_0x42678c){return function(_0x2f18fd){try{jsonpatch[_0xcfac('0x21')](_0x2f18fd,_0x42678c,!![]);}catch(_0x397c07){return BPromise['reject'](_0x397c07);}return _0x2f18fd[_0xcfac('0x22')]();};}function saveUpdates(_0x1e8ae7,_0xab1813){return function(_0x4cabe8){if(_0x4cabe8){return _0x4cabe8[_0xcfac('0x23')](_0x1e8ae7)['then'](function(_0x47ed6f){return _0x47ed6f;});}return null;};}function removeEntity(_0x19b518,_0x1937de){return function(_0x2d8b50){if(_0x2d8b50){return _0x2d8b50[_0xcfac('0x24')]()[_0xcfac('0x25')](function(){_0x19b518[_0xcfac('0x19')](0xcc)[_0xcfac('0x1a')]();});}};}function handleEntityNotFound(_0x4a6f0a,_0x2a6a17){return function(_0x2dfd9f){if(!_0x2dfd9f){_0x4a6f0a[_0xcfac('0x26')](0x194);}return _0x2dfd9f;};}function handleError(_0x2909eb,_0x5f0964){_0x5f0964=_0x5f0964||0x1f4;return function(_0xabc551){logger[_0xcfac('0x27')](_0xabc551[_0xcfac('0x28')]);if(_0xabc551[_0xcfac('0x29')]){delete _0xabc551[_0xcfac('0x29')];}_0x2909eb[_0xcfac('0x19')](_0x5f0964)[_0xcfac('0x2a')](_0xabc551);};}exports[_0xcfac('0x2b')]=function(_0x4e78d2,_0x5a3b9c){var _0x3528e5={},_0x45e91a={},_0x4ee3e7={'count':0x0,'rows':[]};var _0x465912=_[_0xcfac('0x2c')](db['ChatTransferReport'][_0xcfac('0x2d')],function(_0x4ca36f){return{'name':_0x4ca36f[_0xcfac('0x2e')],'type':_0x4ca36f['type']['key']};});_0x45e91a['model']=_[_0xcfac('0x2c')](_0x465912,_0xcfac('0x29'));_0x45e91a[_0xcfac('0x2f')]=_[_0xcfac('0x30')](_0x4e78d2[_0xcfac('0x2f')]);_0x45e91a[_0xcfac('0x31')]=_[_0xcfac('0x32')](_0x45e91a[_0xcfac('0x33')],_0x45e91a[_0xcfac('0x2f')]);_0x3528e5['attributes']=_[_0xcfac('0x32')](_0x45e91a['model'],qs[_0xcfac('0x34')](_0x4e78d2[_0xcfac('0x2f')]['fields']));_0x3528e5['attributes']=_0x3528e5['attributes']['length']?_0x3528e5[_0xcfac('0x35')]:_0x45e91a[_0xcfac('0x33')];if(!_0x4e78d2[_0xcfac('0x2f')][_0xcfac('0x36')](_0xcfac('0x37'))){_0x3528e5[_0xcfac('0x38')]=qs['limit'](_0x4e78d2[_0xcfac('0x2f')][_0xcfac('0x38')]);_0x3528e5[_0xcfac('0x1c')]=qs['offset'](_0x4e78d2['query']['offset']);}_0x3528e5[_0xcfac('0x39')]=qs[_0xcfac('0x3a')](_0x4e78d2[_0xcfac('0x2f')]['sort']);_0x3528e5['where']=qs[_0xcfac('0x31')](_[_0xcfac('0x3b')](_0x4e78d2[_0xcfac('0x2f')],_0x45e91a[_0xcfac('0x31')]),_0x465912);if(_0x4e78d2[_0xcfac('0x2f')][_0xcfac('0x3c')]){_0x3528e5[_0xcfac('0x3d')]=_[_0xcfac('0x3e')](_0x3528e5['where'],{'$or':_['map'](_0x465912,function(_0x40a87c){if(_0x40a87c[_0xcfac('0x3f')]!==_0xcfac('0x40')){var _0x58f23f={};_0x58f23f[_0x40a87c[_0xcfac('0x29')]]={'$like':'%'+_0x4e78d2['query'][_0xcfac('0x3c')]+'%'};return _0x58f23f;}})});}_0x3528e5=_[_0xcfac('0x3e')]({},_0x3528e5,_0x4e78d2[_0xcfac('0x41')]);var _0x173537={'where':_0x3528e5[_0xcfac('0x3d')]};return db[_0xcfac('0x42')][_0xcfac('0x1e')](_0x173537)['then'](function(_0x204cc4){_0x4ee3e7[_0xcfac('0x1e')]=_0x204cc4;if(_0x4e78d2['query'][_0xcfac('0x43')]){_0x3528e5[_0xcfac('0x44')]=[{'all':!![]}];}return db[_0xcfac('0x42')]['findAll'](_0x3528e5);})[_0xcfac('0x25')](function(_0x1b71e1){_0x4ee3e7[_0xcfac('0x45')]=_0x1b71e1;return _0x4ee3e7;})['then'](respondWithFilteredResult(_0x5a3b9c,_0x3528e5))[_0xcfac('0x46')](handleError(_0x5a3b9c,null));};exports['show']=function(_0x194571,_0x5ebedf){var _0x1db5d8={'raw':!![],'where':{'id':_0x194571[_0xcfac('0x47')]['id']}},_0x1d5f5f={};_0x1d5f5f['model']=_['keys'](db[_0xcfac('0x42')][_0xcfac('0x2d')]);_0x1d5f5f['query']=_[_0xcfac('0x30')](_0x194571[_0xcfac('0x2f')]);_0x1d5f5f['filters']=_['intersection'](_0x1d5f5f['model'],_0x1d5f5f['query']);_0x1db5d8[_0xcfac('0x35')]=_[_0xcfac('0x32')](_0x1d5f5f[_0xcfac('0x33')],qs['fields'](_0x194571[_0xcfac('0x2f')][_0xcfac('0x34')]));_0x1db5d8['attributes']=_0x1db5d8[_0xcfac('0x35')]['length']?_0x1db5d8[_0xcfac('0x35')]:_0x1d5f5f[_0xcfac('0x33')];if(_0x194571[_0xcfac('0x2f')][_0xcfac('0x43')]){_0x1db5d8[_0xcfac('0x44')]=[{'all':!![]}];}_0x1db5d8=_['merge']({},_0x1db5d8,_0x194571[_0xcfac('0x41')]);return db[_0xcfac('0x42')]['find'](_0x1db5d8)[_0xcfac('0x25')](handleEntityNotFound(_0x5ebedf,null))[_0xcfac('0x25')](respondWithResult(_0x5ebedf,null))[_0xcfac('0x46')](handleError(_0x5ebedf,null));};exports['create']=function(_0x2abc29,_0x316629){return db[_0xcfac('0x42')][_0xcfac('0x48')](_0x2abc29[_0xcfac('0x49')],{})[_0xcfac('0x25')](respondWithResult(_0x316629,0xc9))[_0xcfac('0x46')](handleError(_0x316629,null));};exports[_0xcfac('0x23')]=function(_0x2f3539,_0x3de1a4){if(_0x2f3539[_0xcfac('0x49')]['id']){delete _0x2f3539[_0xcfac('0x49')]['id'];}return db[_0xcfac('0x42')][_0xcfac('0x4a')]({'where':{'id':_0x2f3539[_0xcfac('0x47')]['id']}})[_0xcfac('0x25')](handleEntityNotFound(_0x3de1a4,null))[_0xcfac('0x25')](saveUpdates(_0x2f3539['body'],null))['then'](respondWithResult(_0x3de1a4,null))[_0xcfac('0x46')](handleError(_0x3de1a4,null));};exports[_0xcfac('0x24')]=function(_0x18b3d4,_0x9c935c){return db[_0xcfac('0x42')][_0xcfac('0x4a')]({'where':{'id':_0x18b3d4[_0xcfac('0x47')]['id']}})[_0xcfac('0x25')](handleEntityNotFound(_0x9c935c,null))[_0xcfac('0x25')](removeEntity(_0x9c935c,null))[_0xcfac('0x46')](handleError(_0x9c935c,null));};exports[_0xcfac('0x4b')]=function(_0x4c9734,_0x3124c3){return db['ChatTransferReport']['describe']()['then'](respondWithResult(_0x3124c3,null))[_0xcfac('0x46')](handleError(_0x3124c3,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index ff40873..4ee58c0 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 _0x418c=['request-promise','../../config/environment','./chatTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4c391e,_0x58e86b){var _0x44143a=function(_0x2c5e3f){while(--_0x2c5e3f){_0x4c391e['push'](_0x4c391e['shift']());}};_0x44143a(++_0x58e86b);}(_0x418c,0x192));var _0xc418=function(_0x50c6d8,_0x166278){_0x50c6d8=_0x50c6d8-0x0;var _0x416c3a=_0x418c[_0x50c6d8];return _0x416c3a;};'use strict';var _=require(_0xc418('0x0'));var util=require(_0xc418('0x1'));var logger=require(_0xc418('0x2'))('api');var moment=require(_0xc418('0x3'));var BPromise=require(_0xc418('0x4'));var rp=require(_0xc418('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc418('0x6'));var attributes=require(_0xc418('0x7'));module[_0xc418('0x8')]=function(_0x4ee8ee,_0x2f3ee1){return _0x4ee8ee[_0xc418('0x9')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xc418('0xa'),'fields':[_0xc418('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x14fb=['request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','uniqueid','util','moment','bluebird'];(function(_0x5f2cd,_0x2640ce){var _0x356ba8=function(_0x2a5ee1){while(--_0x2a5ee1){_0x5f2cd['push'](_0x5f2cd['shift']());}};_0x356ba8(++_0x2640ce);}(_0x14fb,0xbb));var _0xb14f=function(_0x45f24d,_0x1055a2){_0x45f24d=_0x45f24d-0x0;var _0x374cd6=_0x14fb[_0x45f24d];return _0x374cd6;};'use strict';var _=require('lodash');var util=require(_0xb14f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb14f('0x1'));var BPromise=require(_0xb14f('0x2'));var rp=require(_0xb14f('0x3'));var fs=require('fs');var path=require(_0xb14f('0x4'));var rimraf=require(_0xb14f('0x5'));var config=require(_0xb14f('0x6'));var attributes=require(_0xb14f('0x7'));module[_0xb14f('0x8')]=function(_0x332fe6,_0x43345b){return _0x332fe6['define']('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xb14f('0x9'),'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 80d67d0..9a2e027 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 _0x67fd=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0x67fd,0x94));var _0xd67f=function(_0x162338,_0x509994){_0x162338=_0x162338-0x0;var _0x296cc0=_0x67fd[_0x162338];return _0x296cc0;};'use strict';var _=require(_0xd67f('0x0'));var util=require(_0xd67f('0x1'));var moment=require(_0xd67f('0x2'));var BPromise=require('bluebird');var rs=require(_0xd67f('0x3'));var fs=require('fs');var Redis=require(_0xd67f('0x4'));var db=require(_0xd67f('0x5'))['db'];var utils=require(_0xd67f('0x6'));var logger=require(_0xd67f('0x7'))(_0xd67f('0x8'));var config=require(_0xd67f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd67f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58171c,_0x4cb619,_0x39915b){return new BPromise(function(_0x42acbe,_0x1fe56a){return client[_0xd67f('0xb')](_0x58171c,_0x39915b)[_0xd67f('0xc')](function(_0x2c46fd){logger[_0xd67f('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x4cb619,_0xd67f('0xe'));logger['debug'](_0xd67f('0xf'),_0x4cb619,_0xd67f('0xe'),JSON[_0xd67f('0x10')](_0x2c46fd));if(_0x2c46fd[_0xd67f('0x11')]){if(_0x2c46fd[_0xd67f('0x11')][_0xd67f('0x12')]===0x1f4){logger['error'](_0xd67f('0x13'),_0x4cb619,_0x2c46fd[_0xd67f('0x11')][_0xd67f('0x14')]);return _0x1fe56a(_0x2c46fd['error']['message']);}logger[_0xd67f('0x11')](_0xd67f('0x13'),_0x4cb619,_0x2c46fd['error']['message']);return _0x42acbe(_0x2c46fd[_0xd67f('0x11')][_0xd67f('0x14')]);}else{logger[_0xd67f('0xd')](_0xd67f('0x13'),_0x4cb619,_0xd67f('0xe'));_0x42acbe(_0x2c46fd[_0xd67f('0x15')][_0xd67f('0x14')]);}})['catch'](function(_0x323dc0){logger[_0xd67f('0x11')](_0xd67f('0x13'),_0x4cb619,_0x323dc0);_0x1fe56a(_0x323dc0);});});} \ No newline at end of file +var _0x7b04=['request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s'];(function(_0x43a8b9,_0x4ff1e0){var _0x39894b=function(_0x48b507){while(--_0x48b507){_0x43a8b9['push'](_0x43a8b9['shift']());}};_0x39894b(++_0x4ff1e0);}(_0x7b04,0x157));var _0x47b0=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x7b04[_0x1203f];return _0x365f0a;};'use strict';var _=require('lodash');var util=require(_0x47b0('0x0'));var moment=require(_0x47b0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47b0('0x2'));var db=require(_0x47b0('0x3'))['db'];var utils=require(_0x47b0('0x4'));var logger=require(_0x47b0('0x5'))(_0x47b0('0x6'));var config=require(_0x47b0('0x7'));var jayson=require(_0x47b0('0x8'));var client=jayson[_0x47b0('0x9')][_0x47b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x366e67,_0x3227cf,_0x35e8c7){return new BPromise(function(_0x4fc356,_0x4fa919){return client[_0x47b0('0xb')](_0x366e67,_0x35e8c7)[_0x47b0('0xc')](function(_0x74ac52){logger['info'](_0x47b0('0xd'),_0x3227cf,_0x47b0('0xe'));logger[_0x47b0('0xf')](_0x47b0('0x10'),_0x3227cf,_0x47b0('0xe'),JSON[_0x47b0('0x11')](_0x74ac52));if(_0x74ac52['error']){if(_0x74ac52[_0x47b0('0x12')]['code']===0x1f4){logger['error'](_0x47b0('0xd'),_0x3227cf,_0x74ac52[_0x47b0('0x12')][_0x47b0('0x13')]);return _0x4fa919(_0x74ac52[_0x47b0('0x12')][_0x47b0('0x13')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x3227cf,_0x74ac52[_0x47b0('0x12')][_0x47b0('0x13')]);return _0x4fc356(_0x74ac52[_0x47b0('0x12')][_0x47b0('0x13')]);}else{logger['info'](_0x47b0('0xd'),_0x3227cf,'request\x20sent');_0x4fc356(_0x74ac52['result'][_0x47b0('0x13')]);}})[_0x47b0('0x14')](function(_0x1f09e9){logger[_0x47b0('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x3227cf,_0x1f09e9);_0x4fa919(_0x1f09e9);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 9d6fb1d..1fd236b 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 _0xe1fd=['create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','show','post'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xe1fd,0x7e));var _0xde1f=function(_0x3fe41d,_0xe45d60){_0x3fe41d=_0x3fe41d-0x0;var _0x40c928=_0xe1fd[_0x3fe41d];return _0x40c928;};'use strict';var multer=require(_0xde1f('0x0'));var util=require(_0xde1f('0x1'));var path=require('path');var timeout=require(_0xde1f('0x2'));var express=require(_0xde1f('0x3'));var router=express['Router']();var fs_extra=require(_0xde1f('0x4'));var auth=require(_0xde1f('0x5'));var interaction=require(_0xde1f('0x6'));var config=require(_0xde1f('0x7'));var controller=require(_0xde1f('0x8'));router[_0xde1f('0x9')]('/',auth[_0xde1f('0xa')](),controller[_0xde1f('0xb')]);router['get']('/describe',auth[_0xde1f('0xa')](),controller['describe']);router[_0xde1f('0x9')]('/:id',auth[_0xde1f('0xa')](),controller[_0xde1f('0xc')]);router[_0xde1f('0xd')]('/',auth[_0xde1f('0xa')](),controller[_0xde1f('0xe')]);router['put'](_0xde1f('0xf'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x10')]);router[_0xde1f('0x11')](_0xde1f('0xf'),auth[_0xde1f('0xa')](),controller[_0xde1f('0x12')]);module[_0xde1f('0x13')]=router; \ No newline at end of file +var _0x016c=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update'];(function(_0x4ca426,_0x265a46){var _0x23edec=function(_0xe03a6a){while(--_0xe03a6a){_0x4ca426['push'](_0x4ca426['shift']());}};_0x23edec(++_0x265a46);}(_0x016c,0x1c3));var _0xc016=function(_0x6d948e,_0x240e7c){_0x6d948e=_0x6d948e-0x0;var _0x1affc4=_0x016c[_0x6d948e];return _0x1affc4;};'use strict';var multer=require(_0xc016('0x0'));var util=require(_0xc016('0x1'));var path=require(_0xc016('0x2'));var timeout=require('connect-timeout');var express=require(_0xc016('0x3'));var router=express['Router']();var fs_extra=require(_0xc016('0x4'));var auth=require(_0xc016('0x5'));var interaction=require(_0xc016('0x6'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0xc016('0x7')]('/',auth[_0xc016('0x8')](),controller[_0xc016('0x9')]);router[_0xc016('0x7')](_0xc016('0xa'),auth['isAuthenticated'](),controller[_0xc016('0xb')]);router[_0xc016('0x7')](_0xc016('0xc'),auth['isAuthenticated'](),controller[_0xc016('0xd')]);router[_0xc016('0xe')]('/',auth[_0xc016('0x8')](),controller[_0xc016('0xf')]);router['put'](_0xc016('0xc'),auth[_0xc016('0x8')](),controller[_0xc016('0x10')]);router['delete']('/:id',auth[_0xc016('0x8')](),controller['destroy']);module[_0xc016('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index a84b4ec..76b26b3 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 _0xb58b=['alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','ENUM','squared','rounded','We\x20are\x20here!','Chat','Contact\x20us','BOOLEAN','TEXT','Form\x20properly\x20submitted','Type\x20a\x20message','Skip','star','thumb','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','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:','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT'];(function(_0x35c01e,_0x16c60f){var _0xd0cb89=function(_0x30d08e){while(--_0x30d08e){_0x35c01e['push'](_0x35c01e['shift']());}};_0xd0cb89(++_0x16c60f);}(_0xb58b,0x1f1));var _0xbb58=function(_0x849132,_0x104c4e){_0x849132=_0x849132-0x0;var _0x597dd6=_0xb58b[_0x849132];return _0x597dd6;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xbb58('0x0'));module[_0xbb58('0x1')]={'name':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbb58('0x3')},'description':{'type':Sequelize[_0xbb58('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x4')},'key':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xbb58('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xbb58('0x8')]('rounded',_0xbb58('0x9')),'defaultValue':_0xbb58('0xa')},'header_online':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0xc')},'offline_chat_button':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0xd')},'download_transcript':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xbb58('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x11')},'closingMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x12')},'conditionAgreement':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xbb58('0x8')](_0xbb58('0x13'),_0xbb58('0x14')),'defaultValue':_0xbb58('0x13')},'ratingStarsNumber':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbb58('0xf')],'defaultValue':function(){return JSON[_0xbb58('0x15')]({'items':[{'type':_0xbb58('0x16'),'variable':null,'config':{'placeholder':_0xbb58('0x17'),'type':'text','required':!![]},'props':{'title':_0xbb58('0x17'),'helpText':''}},{'type':'input','props':{'title':_0xbb58('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbb58('0x4'),'type':_0xbb58('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xbb58('0x18')](_0xbb58('0x19'))?JSON[_0xbb58('0x1a')](this[_0xbb58('0x18')](_0xbb58('0x19'))):{};},'set':function(_0x4e0303){return this[_0xbb58('0x1b')](_0xbb58('0x19'),JSON[_0xbb58('0x15')](_0x4e0303));}},'offlineForm':{'type':Sequelize[_0xbb58('0xf')],'defaultValue':function(){return JSON[_0xbb58('0x15')]({'items':[{'type':_0xbb58('0x16'),'props':{'title':_0xbb58('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbb58('0x4'),'type':_0xbb58('0x4')},'variable':null},{'type':_0xbb58('0x1c'),'config':{'placeholder':_0xbb58('0x1d')},'props':{'title':_0xbb58('0x1d'),'helpText':_0xbb58('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0xbb58('0x18')](_0xbb58('0x1f'))?JSON['parse'](this[_0xbb58('0x18')](_0xbb58('0x1f'))):{};},'set':function(_0x12b3eb){return this[_0xbb58('0x1b')](_0xbb58('0x1f'),JSON[_0xbb58('0x15')](_0x12b3eb));}},'token':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':function(){return rs[_0xbb58('0x20')]();}},'autoclose':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xbb58('0x2')]},'forwardOffline':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbb58('0x2')]},'waitingTitle':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x21')},'waitingMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x22')},'offlineMessageSubject':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x23')},'offlineMessageBody':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x12')},'sendUnmanaged':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x25')},'enableCustomerAttachment':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbb58('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbb58('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbb58('0x26');}},'notificationSound':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x27')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x28')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x29')},'messagesAlignment':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x2a')},'defaultTitle':{'type':Sequelize[_0xbb58('0x2')]},'customerAvatar':{'type':Sequelize[_0xbb58('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbb58('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbb58('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xbb58('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbb58('0x7')],'comment':_0xbb58('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xc29171){if(!_0xc29171)this[_0xbb58('0x1b')](_0xbb58('0x2d'),null);this[_0xbb58('0x1b')](_0xbb58('0x2e'),_0xc29171);}},'vidaooEscalation':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x2f')},'vidaooNote':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':function(){return _0xbb58('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xbb58('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa75b=['ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','TEXT','stringify','input','text','name','onlineForm','parse','getDataValue','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','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.','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0xa75b,0x170));var _0xba75=function(_0x2bbde9,_0x3a3e09){_0x2bbde9=_0x2bbde9-0x0;var _0x19418e=_0xa75b[_0x2bbde9];return _0x19418e;};'use strict';var Sequelize=require(_0xba75('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xba75('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xba75('0x1')],'allowNull':![],'unique':_0xba75('0x2')},'description':{'type':Sequelize[_0xba75('0x1')]},'mapKey':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x3')},'mapKeyOffline':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x3')},'key':{'type':Sequelize[_0xba75('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x4')},'customerAlias':{'type':Sequelize[_0xba75('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xba75('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xba75('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xba75('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xba75('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xba75('0x1')]},'animation':{'type':Sequelize[_0xba75('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xba75('0x8')](_0xba75('0x9'),_0xba75('0xa')),'defaultValue':_0xba75('0x9')},'header_online':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0xb')},'start_chat_button':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0xc')},'offline_chat_button':{'type':Sequelize[_0xba75('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xba75('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xba75('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xba75('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xba75('0x1')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x11')},'placeholderMessage':{'type':Sequelize[_0xba75('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x12')},'closingMessageButton':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x13')},'skipMessageButton':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xba75('0x15')},'ratingType':{'type':Sequelize[_0xba75('0x8')]('star','thumb'),'defaultValue':_0xba75('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xba75('0x17')],'defaultValue':function(){return JSON[_0xba75('0x18')]({'items':[{'type':_0xba75('0x19'),'variable':null,'config':{'placeholder':'name','type':_0xba75('0x1a'),'required':!![]},'props':{'title':_0xba75('0x1b'),'helpText':''}},{'type':_0xba75('0x19'),'props':{'title':_0xba75('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xba75('0x3'),'type':_0xba75('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xba75('0x1c'))?JSON[_0xba75('0x1d')](this[_0xba75('0x1e')](_0xba75('0x1c'))):{};},'set':function(_0x1caa6){return this[_0xba75('0x1f')](_0xba75('0x1c'),JSON[_0xba75('0x18')](_0x1caa6));}},'offlineForm':{'type':Sequelize[_0xba75('0x17')],'defaultValue':function(){return JSON[_0xba75('0x18')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xba75('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':_0xba75('0x20')},'props':{'title':'Comments','helpText':_0xba75('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xba75('0x1e')](_0xba75('0x22'))?JSON['parse'](this[_0xba75('0x1e')](_0xba75('0x22'))):{};},'set':function(_0x8a2e4d){return this[_0xba75('0x1f')]('offlineForm',JSON['stringify'](_0x8a2e4d));}},'token':{'type':Sequelize[_0xba75('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xba75('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xba75('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xba75('0x1')]},'waitingTitle':{'type':Sequelize[_0xba75('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x23')},'offlineMessageSubject':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xba75('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0xba75('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xba75('0x26')},'skipUnmanaged':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x14')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xba75('0x13')},'enableCustomerAttachment':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xba75('0x17')]},'showAgentAvatar':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xba75('0x1')]},'notificationTemplate':{'type':Sequelize[_0xba75('0x17')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xba75('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xba75('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xba75('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x27')},'messagesAlignment':{'type':Sequelize[_0xba75('0x1')],'defaultValue':_0xba75('0x28')},'defaultTitle':{'type':Sequelize[_0xba75('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xba75('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xba75('0x1')],'allowNull':![],'defaultValue':_0xba75('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xba75('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xba75('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xba75('0x2a')},'systemAvatar':{'type':Sequelize[_0xba75('0x17')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xba75('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![],'comment':_0xba75('0x2c'),'set':function(_0x45d8cd){if(!_0x45d8cd)this[_0xba75('0x1f')](_0xba75('0x2d'),null);this[_0xba75('0x1f')]('mandatoryDisposition',_0x45d8cd);}},'vidaooEscalation':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xba75('0x1')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xba75('0x1')],'defaultValue':function(){return _0xba75('0x2e');}},'vidaooMetadata':{'type':Sequelize[_0xba75('0x17')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xba75('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xba75('0x17')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 6ff0284..99572ca 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 _0x273b=['referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','lastName','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','send','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','User','fullname','internal','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','inspect','No\x20timezone','Interval','getProactiveActions','increment','chatLicenseExceeded','Intervals','address','origin','remote','x-real-ip','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','priority','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','map','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','includeAll','findAll','rows','show','params','ChatWebsite','rawAttributes','fields','include','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','findOne','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','addLogo','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','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','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','List','Contacts','DESC','Applications','applications','list','orderBy','account','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port'];(function(_0x5f0cb0,_0x242b92){var _0x1ec431=function(_0x2d56e1){while(--_0x2d56e1){_0x5f0cb0['push'](_0x5f0cb0['shift']());}};_0x1ec431(++_0x242b92);}(_0x273b,0x1b6));var _0xb273=function(_0x16bb34,_0x2b658d){_0x16bb34=_0x16bb34-0x0;var _0x47b4f8=_0x273b[_0x16bb34];return _0x47b4f8;};'use strict';var BPromise=require(_0xb273('0x0'));var Mustache=require('mustache');var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb273('0x1'));var _=require(_0xb273('0x2'));var querystring=require(_0xb273('0x3'));var Redis=require(_0xb273('0x4'));var qs=require(_0xb273('0x5'));var logger=require(_0xb273('0x6'))(_0xb273('0x7'));var config=require('../../config/environment');var url=require(_0xb273('0x8'));var db=require(_0xb273('0x9'))['db'];config[_0xb273('0xa')]=_[_0xb273('0xb')](config['redis'],{'host':_0xb273('0xc'),'port':0x18eb});var socket=require(_0xb273('0xd'))(new Redis(config[_0xb273('0xa')]));require(_0xb273('0xe'))['register'](socket);var htmlToText=require(_0xb273('0xf'));var jayson=require(_0xb273('0x10'));var client=jayson[_0xb273('0x11')]['http']({'port':0x232c});var client9002=jayson[_0xb273('0x11')][_0xb273('0x12')]({'port':0x232a});var client9003=jayson[_0xb273('0x11')][_0xb273('0x12')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x26271c,_0x4148f5,_0x52fc69,_0x49cb59){return new BPromise(function(_0x51fcb4,_0x1e084d){var _0x303011=_0x49cb59||client;return _0x303011['request'](_0x26271c,_0x52fc69)[_0xb273('0x13')](function(_0x433170){logger[_0xb273('0x14')](_0xb273('0x15'),_0x4148f5,_0xb273('0x16'));logger['debug'](_0xb273('0x17'),_0x4148f5,_0xb273('0x16'),JSON['stringify'](_0x433170));if(_0x433170[_0xb273('0x18')]){if(_0x433170[_0xb273('0x18')][_0xb273('0x19')]===0x1f4){logger[_0xb273('0x18')](_0xb273('0x15'),_0x4148f5,_0x433170[_0xb273('0x18')][_0xb273('0x1a')]);return _0x1e084d(_0x433170[_0xb273('0x18')][_0xb273('0x1a')]);}logger[_0xb273('0x18')](_0xb273('0x15'),_0x4148f5,_0x433170[_0xb273('0x18')][_0xb273('0x1a')]);return _0x51fcb4(_0x433170['error'][_0xb273('0x1a')]);}else{logger[_0xb273('0x14')](_0xb273('0x15'),_0x4148f5,'request\x20sent');_0x51fcb4(_0x433170[_0xb273('0x1b')][_0xb273('0x1a')]);}})['catch'](function(_0x2ad192){logger[_0xb273('0x18')](_0xb273('0x15'),_0x4148f5,_0x2ad192);_0x1e084d(_0x2ad192);});});}function respondWithStatusCode(_0x4e9b46,_0x536143){_0x536143=_0x536143||0xcc;return function(_0x58a9be){if(_0x58a9be){return _0x4e9b46[_0xb273('0x1c')](_0x536143);}return _0x4e9b46[_0xb273('0x1d')](_0x536143)['end']();};}function respondWithResult(_0x517278,_0x43a96d){_0x43a96d=_0x43a96d||0xc8;return function(_0x3708a9){if(_0x3708a9){return _0x517278[_0xb273('0x1d')](_0x43a96d)[_0xb273('0x1e')](_0x3708a9);}};}function respondWithFilteredResult(_0x1c335b,_0xb05bfd){return function(_0x1e630a){if(_0x1e630a){var _0x4672f0=typeof _0xb05bfd[_0xb273('0x1f')]===_0xb273('0x20')&&typeof _0xb05bfd[_0xb273('0x21')]===_0xb273('0x20');var _0x142f77=_0x1e630a[_0xb273('0x22')];var _0x27aec5=_0x4672f0?0x0:_0xb05bfd[_0xb273('0x1f')];var _0x5bf595=_0x4672f0?_0x1e630a['count']:_0xb05bfd[_0xb273('0x1f')]+_0xb05bfd[_0xb273('0x21')];var _0x46ec22;if(_0x5bf595>=_0x142f77){_0x5bf595=_0x142f77;_0x46ec22=0xc8;}else{_0x46ec22=0xce;}_0x1c335b['status'](_0x46ec22);return _0x1c335b[_0xb273('0x23')](_0xb273('0x24'),_0x27aec5+'-'+_0x5bf595+'/'+_0x142f77)[_0xb273('0x1e')](_0x1e630a);}return null;};}function saveUpdates(_0x43d968){return function(_0x41ea1d){if(_0x41ea1d){return _0x41ea1d[_0xb273('0x25')](_0x43d968)[_0xb273('0x13')](function(_0x43d724){return _0x43d724;});}return null;};}function removeEntity(_0x1db350){return function(_0x3e7bf8){if(_0x3e7bf8){return _0x3e7bf8[_0xb273('0x26')]()[_0xb273('0x13')](function(){var _0x453566=_0x3e7bf8[_0xb273('0x27')]({'plain':!![]});var _0x6dc1a1=_0xb273('0x28');return db[_0xb273('0x29')][_0xb273('0x26')]({'where':{'type':_0x6dc1a1,'resourceId':_0x453566['id']}})[_0xb273('0x13')](function(){return _0x3e7bf8;});})['then'](function(){_0x1db350[_0xb273('0x1d')](0xcc)[_0xb273('0x2a')]();});}};}function handleEntityNotFound(_0x16a586){return function(_0x4e7f29){if(!_0x4e7f29){_0x16a586[_0xb273('0x1c')](0x194);}return _0x4e7f29;};}function handleError(_0x18102e,_0x30cf1d){_0x30cf1d=_0x30cf1d||0x1f4;return function(_0x55330c){logger[_0xb273('0x18')](_0x55330c[_0xb273('0x2b')]);if(_0x55330c[_0xb273('0x2c')]){delete _0x55330c[_0xb273('0x2c')];}_0x18102e[_0xb273('0x1d')](_0x30cf1d)['send'](_0x55330c);};}exports[_0xb273('0x2d')]=function(_0x368308,_0x3ebbd6){var _0x31c4f6={'include':[{'model':db[_0xb273('0x2e')],'as':_0xb273('0x2f')}]},_0xcf9d25={},_0x107213={'count':0x0,'rows':[]};var _0x2bfe2e=_[_0xb273('0x30')](db['ChatWebsite']['rawAttributes'],function(_0xfefac0){return{'name':_0xfefac0['fieldName'],'type':_0xfefac0['type'][_0xb273('0x31')]};});_0xcf9d25[_0xb273('0x32')]=_[_0xb273('0x30')](_0x2bfe2e,'name');_0xcf9d25['query']=_[_0xb273('0x33')](_0x368308[_0xb273('0x34')]);_0xcf9d25[_0xb273('0x35')]=_[_0xb273('0x36')](_0xcf9d25['model'],_0xcf9d25[_0xb273('0x34')]);_0x31c4f6[_0xb273('0x37')]=_[_0xb273('0x36')](_0xcf9d25[_0xb273('0x32')],qs['fields'](_0x368308[_0xb273('0x34')]['fields']));_0x31c4f6[_0xb273('0x37')]=_0x31c4f6[_0xb273('0x37')][_0xb273('0x38')]?_0x31c4f6['attributes']:_0xcf9d25[_0xb273('0x32')];if(!_0x368308[_0xb273('0x34')][_0xb273('0x39')]('nolimit')){_0x31c4f6[_0xb273('0x21')]=qs[_0xb273('0x21')](_0x368308['query']['limit']);_0x31c4f6[_0xb273('0x1f')]=qs['offset'](_0x368308['query'][_0xb273('0x1f')]);}_0x31c4f6[_0xb273('0x3a')]=qs[_0xb273('0x3b')](_0x368308[_0xb273('0x34')][_0xb273('0x3b')]);_0x31c4f6[_0xb273('0x3c')]=qs[_0xb273('0x35')](_[_0xb273('0x3d')](_0x368308[_0xb273('0x34')],_0xcf9d25['filters']),_0x2bfe2e);if(_0x368308[_0xb273('0x34')]['filter']){_0x31c4f6[_0xb273('0x3c')]=_['merge'](_0x31c4f6[_0xb273('0x3c')],{'$or':_[_0xb273('0x30')](_0x2bfe2e,function(_0x55d623){if(_0x55d623[_0xb273('0x3e')]!==_0xb273('0x3f')){var _0x28a815={};_0x28a815[_0x55d623[_0xb273('0x2c')]]={'$like':'%'+_0x368308['query'][_0xb273('0x40')]+'%'};return _0x28a815;}})});}_0x31c4f6=_[_0xb273('0x41')]({},_0x31c4f6,_0x368308['options']);var _0x391311={'where':_0x31c4f6[_0xb273('0x3c')]};return db['ChatWebsite'][_0xb273('0x22')](_0x391311)[_0xb273('0x13')](function(_0xa2cf7b){_0x107213[_0xb273('0x22')]=_0xa2cf7b;if(_0x368308[_0xb273('0x34')][_0xb273('0x42')]){_0x31c4f6['include']=[{'all':!![]}];}return db['ChatWebsite'][_0xb273('0x43')](_0x31c4f6);})[_0xb273('0x13')](function(_0x4b4c94){_0x107213[_0xb273('0x44')]=_0x4b4c94;return _0x107213;})[_0xb273('0x13')](respondWithFilteredResult(_0x3ebbd6,_0x31c4f6))['catch'](handleError(_0x3ebbd6,null));};exports[_0xb273('0x45')]=function(_0x58dff9,_0x13dd84){var _0x169aad={'raw':![],'where':{'id':_0x58dff9[_0xb273('0x46')]['id']},'include':[{'model':db[_0xb273('0x2e')],'as':_0xb273('0x2f')}]},_0x4e9c32={};_0x4e9c32[_0xb273('0x32')]=_[_0xb273('0x33')](db[_0xb273('0x47')][_0xb273('0x48')]);_0x4e9c32[_0xb273('0x34')]=_[_0xb273('0x33')](_0x58dff9['query']);_0x4e9c32[_0xb273('0x35')]=_[_0xb273('0x36')](_0x4e9c32['model'],_0x4e9c32[_0xb273('0x34')]);_0x169aad[_0xb273('0x37')]=_['intersection'](_0x4e9c32[_0xb273('0x32')],qs[_0xb273('0x49')](_0x58dff9['query'][_0xb273('0x49')]));_0x169aad[_0xb273('0x37')]=_0x169aad[_0xb273('0x37')][_0xb273('0x38')]?_0x169aad[_0xb273('0x37')]:_0x4e9c32[_0xb273('0x32')];if(_0x58dff9[_0xb273('0x34')][_0xb273('0x42')]){_0x169aad[_0xb273('0x4a')]=[{'all':!![]}];}_0x169aad=_[_0xb273('0x41')]({},_0x169aad,_0x58dff9[_0xb273('0x4b')]);return db[_0xb273('0x47')]['find'](_0x169aad)[_0xb273('0x13')](handleEntityNotFound(_0x13dd84,null))['then'](respondWithResult(_0x13dd84,null))[_0xb273('0x4c')](handleError(_0x13dd84,null));};exports[_0xb273('0x4d')]=function(_0x5814c0,_0x348bd6){return db[_0xb273('0x47')][_0xb273('0x4d')](_0x5814c0[_0xb273('0x4e')],{})[_0xb273('0x13')](function(_0x3b7004){var _0x5448e8=_0x5814c0['user'][_0xb273('0x27')]({'plain':!![]});if(!_0x5448e8)throw new Error(_0xb273('0x4f'));if(_0x5448e8[_0xb273('0x50')]===_0xb273('0x51')){var _0x102698=_0x3b7004['get']({'plain':!![]});var _0x58251a='ChatWebsites';return db[_0xb273('0x52')][_0xb273('0x53')]({'where':{'name':_0x58251a,'userProfileId':_0x5448e8[_0xb273('0x54')]},'raw':!![]})[_0xb273('0x13')](function(_0x590fea){if(_0x590fea&&_0x590fea['autoAssociation']===0x0){return db['UserProfileResource'][_0xb273('0x4d')]({'name':_0x102698['name'],'resourceId':_0x102698['id'],'type':_0x590fea[_0xb273('0x2c')],'sectionId':_0x590fea['id']},{})[_0xb273('0x13')](function(){return _0x3b7004;});}else{return _0x3b7004;}})[_0xb273('0x4c')](function(_0x4424d4){logger[_0xb273('0x18')](_0xb273('0x55'),_0x4424d4);throw _0x4424d4;});}return _0x3b7004;})[_0xb273('0x13')](respondWithResult(_0x348bd6,0xc9))['catch'](handleError(_0x348bd6,null));};exports[_0xb273('0x25')]=function(_0x3813d5,_0x1f405f){if(_0x3813d5['body']['id']){delete _0x3813d5['body']['id'];}return db[_0xb273('0x47')][_0xb273('0x53')]({'where':{'id':_0x3813d5[_0xb273('0x46')]['id']},'include':[{'model':db[_0xb273('0x2e')],'as':_0xb273('0x2f')}]})[_0xb273('0x13')](handleEntityNotFound(_0x1f405f,null))[_0xb273('0x13')](saveUpdates(_0x3813d5['body'],null))[_0xb273('0x13')](respondWithResult(_0x1f405f,null))[_0xb273('0x4c')](handleError(_0x1f405f,null));};exports['destroy']=function(_0x5fc982,_0x26ac88){return db[_0xb273('0x47')][_0xb273('0x53')]({'where':{'id':_0x5fc982[_0xb273('0x46')]['id']}})['then'](handleEntityNotFound(_0x26ac88,null))[_0xb273('0x13')](removeEntity(_0x26ac88,null))[_0xb273('0x4c')](handleError(_0x26ac88,null));};exports[_0xb273('0x56')]=function(_0x453c1f,_0x4a6be1){return db[_0xb273('0x47')][_0xb273('0x56')]()['then'](respondWithResult(_0x4a6be1,null))[_0xb273('0x4c')](handleError(_0x4a6be1,null));};exports['addDisposition']=function(_0xf7ca82,_0x3be665){if(_0xf7ca82[_0xb273('0x4e')]['id']){delete _0xf7ca82[_0xb273('0x4e')]['id'];}return db[_0xb273('0x47')][_0xb273('0x53')]({'where':{'id':_0xf7ca82[_0xb273('0x46')]['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x3be665,null))[_0xb273('0x13')](function(_0x41f77e){if(_0x41f77e){_0xf7ca82[_0xb273('0x4e')][_0xb273('0x57')]=_0x41f77e['id'];return db[_0xb273('0x58')][_0xb273('0x4d')](_0xf7ca82[_0xb273('0x4e')]);}})[_0xb273('0x13')](respondWithResult(_0x3be665,null))[_0xb273('0x4c')](handleError(_0x3be665,null));};exports[_0xb273('0x59')]=function(_0x3c7bbb,_0x5c9ad1){var _0x1e3410={'raw':![],'where':{}};var _0x763c84={};var _0x3bc231={'count':0x0,'rows':[]};return db[_0xb273('0x47')][_0xb273('0x5a')]({'where':{'id':_0x3c7bbb[_0xb273('0x46')]['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x5c9ad1,null))[_0xb273('0x13')](function(_0x326ddd){if(_0x326ddd){_0x763c84[_0xb273('0x32')]=_['keys'](db[_0xb273('0x58')][_0xb273('0x48')]);_0x763c84['query']=_[_0xb273('0x33')](_0x3c7bbb[_0xb273('0x34')]);_0x763c84['filters']=_['intersection'](_0x763c84[_0xb273('0x32')],_0x763c84[_0xb273('0x34')]);_0x1e3410[_0xb273('0x37')]=_['intersection'](_0x763c84[_0xb273('0x32')],qs[_0xb273('0x49')](_0x3c7bbb[_0xb273('0x34')][_0xb273('0x49')]));_0x1e3410[_0xb273('0x37')]=_0x1e3410[_0xb273('0x37')]['length']?_0x1e3410[_0xb273('0x37')]:_0x763c84[_0xb273('0x32')];if(!_0x3c7bbb[_0xb273('0x34')]['hasOwnProperty']('nolimit')){_0x1e3410[_0xb273('0x21')]=qs[_0xb273('0x21')](_0x3c7bbb[_0xb273('0x34')][_0xb273('0x21')]);_0x1e3410[_0xb273('0x1f')]=qs[_0xb273('0x1f')](_0x3c7bbb[_0xb273('0x34')][_0xb273('0x1f')]);}_0x1e3410['order']=qs['sort'](_0x3c7bbb[_0xb273('0x34')][_0xb273('0x3b')]);_0x1e3410[_0xb273('0x3c')]=qs[_0xb273('0x35')](_['pick'](_0x3c7bbb[_0xb273('0x34')],_0x763c84[_0xb273('0x35')]));_0x1e3410[_0xb273('0x3c')]['ChatWebsiteId']=_0x326ddd['id'];if(_0x3c7bbb['query'][_0xb273('0x40')]){_0x1e3410['where']=_[_0xb273('0x41')](_0x1e3410[_0xb273('0x3c')],{'$or':_[_0xb273('0x30')](_0x1e3410[_0xb273('0x37')],function(_0xecfaaf){var _0x53776b={};_0x53776b[_0xecfaaf]={'$like':'%'+_0x3c7bbb[_0xb273('0x34')][_0xb273('0x40')]+'%'};return _0x53776b;})});}_0x1e3410=_[_0xb273('0x41')]({},_0x1e3410,_0x3c7bbb[_0xb273('0x4b')]);return db[_0xb273('0x58')][_0xb273('0x22')]({'where':_0x1e3410[_0xb273('0x3c')]})[_0xb273('0x13')](function(_0x536e34){_0x3bc231[_0xb273('0x22')]=_0x536e34;if(_0x3c7bbb['query'][_0xb273('0x42')]){_0x1e3410[_0xb273('0x4a')]=[{'all':!![]}];}return db[_0xb273('0x58')][_0xb273('0x43')](_0x1e3410);})[_0xb273('0x13')](function(_0x340da3){_0x3bc231[_0xb273('0x44')]=_0x340da3;return _0x3bc231;});}})[_0xb273('0x13')](respondWithFilteredResult(_0x5c9ad1,_0x1e3410))['catch'](handleError(_0x5c9ad1,null));};exports['removeDispositions']=function(_0x4a13c7,_0x5e727c){return db[_0xb273('0x47')]['find']({'where':{'id':_0x4a13c7[_0xb273('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e727c,null))['then'](function(_0x2486d6){if(_0x2486d6){return _0x2486d6['removeDispositions'](_0x4a13c7[_0xb273('0x34')][_0xb273('0x5b')]);}})[_0xb273('0x13')](respondWithStatusCode(_0x5e727c,null))[_0xb273('0x4c')](handleError(_0x5e727c,null));};exports[_0xb273('0x5c')]=function(_0x2c0985,_0x3f594a){if(_0x2c0985['body']['id']){delete _0x2c0985[_0xb273('0x4e')]['id'];}return db[_0xb273('0x47')][_0xb273('0x53')]({'where':{'id':_0x2c0985['params']['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x3f594a,null))[_0xb273('0x13')](function(_0x594510){if(_0x594510){_0x2c0985[_0xb273('0x4e')][_0xb273('0x57')]=_0x594510['id'];return db[_0xb273('0x5d')][_0xb273('0x4d')](_0x2c0985[_0xb273('0x4e')]);}})['then'](respondWithResult(_0x3f594a,null))[_0xb273('0x4c')](handleError(_0x3f594a,null));};exports[_0xb273('0x5e')]=function(_0x39bcc9,_0x50a6bb){var _0xbe68b7={'raw':![],'where':{}};var _0x147996={};var _0x217741={'count':0x0,'rows':[]};return db[_0xb273('0x47')][_0xb273('0x5a')]({'where':{'id':_0x39bcc9[_0xb273('0x46')]['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x50a6bb,null))[_0xb273('0x13')](function(_0x4812ae){if(_0x4812ae){_0x147996[_0xb273('0x32')]=_[_0xb273('0x33')](db[_0xb273('0x5d')]['rawAttributes']);_0x147996['query']=_[_0xb273('0x33')](_0x39bcc9[_0xb273('0x34')]);_0x147996[_0xb273('0x35')]=_['intersection'](_0x147996[_0xb273('0x32')],_0x147996[_0xb273('0x34')]);_0xbe68b7[_0xb273('0x37')]=_[_0xb273('0x36')](_0x147996['model'],qs[_0xb273('0x49')](_0x39bcc9[_0xb273('0x34')][_0xb273('0x49')]));_0xbe68b7[_0xb273('0x37')]=_0xbe68b7[_0xb273('0x37')][_0xb273('0x38')]?_0xbe68b7['attributes']:_0x147996[_0xb273('0x32')];if(!_0x39bcc9[_0xb273('0x34')][_0xb273('0x39')](_0xb273('0x5f'))){_0xbe68b7[_0xb273('0x21')]=qs[_0xb273('0x21')](_0x39bcc9['query'][_0xb273('0x21')]);_0xbe68b7[_0xb273('0x1f')]=qs['offset'](_0x39bcc9['query'][_0xb273('0x1f')]);}_0xbe68b7['order']=qs[_0xb273('0x3b')](_0x39bcc9[_0xb273('0x34')][_0xb273('0x3b')]);_0xbe68b7[_0xb273('0x3c')]=qs[_0xb273('0x35')](_[_0xb273('0x3d')](_0x39bcc9['query'],_0x147996['filters']));_0xbe68b7[_0xb273('0x3c')]['ChatWebsiteId']=_0x4812ae['id'];if(_0x39bcc9[_0xb273('0x34')][_0xb273('0x40')]){_0xbe68b7['where']=_[_0xb273('0x41')](_0xbe68b7[_0xb273('0x3c')],{'$or':_[_0xb273('0x30')](_0xbe68b7[_0xb273('0x37')],function(_0x8f7c79){var _0x2148f7={};_0x2148f7[_0x8f7c79]={'$like':'%'+_0x39bcc9['query'][_0xb273('0x40')]+'%'};return _0x2148f7;})});}_0xbe68b7=_[_0xb273('0x41')]({},_0xbe68b7,_0x39bcc9[_0xb273('0x4b')]);return db[_0xb273('0x5d')]['count']({'where':_0xbe68b7[_0xb273('0x3c')]})[_0xb273('0x13')](function(_0x12c928){_0x217741[_0xb273('0x22')]=_0x12c928;if(_0x39bcc9[_0xb273('0x34')]['includeAll']){_0xbe68b7[_0xb273('0x4a')]=[{'all':!![]}];}return db[_0xb273('0x5d')][_0xb273('0x43')](_0xbe68b7);})[_0xb273('0x13')](function(_0x151f61){_0x217741['rows']=_0x151f61;return _0x217741;});}})[_0xb273('0x13')](respondWithFilteredResult(_0x50a6bb,_0xbe68b7))[_0xb273('0x4c')](handleError(_0x50a6bb,null));};exports[_0xb273('0x60')]=function(_0x1b756a,_0x88320a){return db[_0xb273('0x47')]['find']({'where':{'id':_0x1b756a['params']['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x88320a,null))['then'](function(_0x5a3ea7){if(_0x5a3ea7){return _0x5a3ea7['removeAnswers'](_0x1b756a[_0xb273('0x34')][_0xb273('0x5b')]);}})[_0xb273('0x13')](respondWithStatusCode(_0x88320a,null))[_0xb273('0x4c')](handleError(_0x88320a,null));};exports[_0xb273('0x61')]=function(_0x96ba3d,_0x4906e3){_0x96ba3d[_0xb273('0x4e')][_0xb273('0x62')]=_0x96ba3d[_0xb273('0x63')][_0xb273('0x64')];return db[_0xb273('0x47')][_0xb273('0x53')]({'where':{'id':_0x96ba3d[_0xb273('0x46')]['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x4906e3,null))[_0xb273('0x13')](saveUpdates(_0x96ba3d[_0xb273('0x4e')],null))[_0xb273('0x13')](respondWithResult(_0x4906e3,null))[_0xb273('0x4c')](handleError(_0x4906e3,null));};exports[_0xb273('0x65')]=function(_0x32d2d0,_0x597dd1){_0x32d2d0[_0xb273('0x4e')][_0xb273('0x66')]=_0x32d2d0['file'][_0xb273('0x64')];return db[_0xb273('0x47')]['find']({'where':{'id':_0x32d2d0[_0xb273('0x46')]['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x597dd1,null))['then'](saveUpdates(_0x32d2d0[_0xb273('0x4e')],null))[_0xb273('0x13')](respondWithResult(_0x597dd1,null))[_0xb273('0x4c')](handleError(_0x597dd1,null));};exports[_0xb273('0x67')]=function(_0x389624,_0x5321f6){_0x389624[_0xb273('0x4e')][_0xb273('0x68')]=_0x389624[_0xb273('0x63')][_0xb273('0x64')];return db[_0xb273('0x47')][_0xb273('0x53')]({'where':{'id':_0x389624[_0xb273('0x46')]['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x5321f6,null))[_0xb273('0x13')](saveUpdates(_0x389624[_0xb273('0x4e')],null))[_0xb273('0x13')](respondWithResult(_0x5321f6,null))[_0xb273('0x4c')](handleError(_0x5321f6,null));};exports[_0xb273('0x69')]=function(_0x4dbf2c,_0x5c5f14){_0x4dbf2c['body'][_0xb273('0x6a')]=_0x4dbf2c['file']['filename'];return db[_0xb273('0x47')][_0xb273('0x53')]({'where':{'id':_0x4dbf2c['params']['id']}})['then'](handleEntityNotFound(_0x5c5f14,null))[_0xb273('0x13')](saveUpdates(_0x4dbf2c[_0xb273('0x4e')],null))['then'](respondWithResult(_0x5c5f14,null))[_0xb273('0x4c')](handleError(_0x5c5f14,null));};exports[_0xb273('0x6b')]=function(_0x4b923e,_0x1de2f7){var _0x229ed1=path[_0xb273('0x6c')](config[_0xb273('0x6d')],_0xb273('0x6e'));var _0x3e82a0={'where':{'id':_0x4b923e[_0xb273('0x46')]['id']},'attributes':['id',_0xb273('0x62')],'raw':!![]};var _0x19cf30=![];return require(_0xb273('0x6f'))[_0xb273('0x70')]()[_0xb273('0x13')](function(_0x26d99d){if(_0x26d99d){_0x19cf30=_0x26d99d[_0xb273('0x71')];}})[_0xb273('0x13')](function(){return db[_0xb273('0x47')]['find'](_0x3e82a0);})['then'](handleEntityNotFound(_0x1de2f7,null))[_0xb273('0x13')](function(_0x127922){if(_0x127922){if(!_[_0xb273('0x72')](_0x127922[_0xb273('0x62')])){if(fs[_0xb273('0x73')](path[_0xb273('0x6c')](config[_0xb273('0x6d')],_0xb273('0x74'),_0x127922['sitepic']))&&_0x19cf30){_0x229ed1=path[_0xb273('0x6c')](config[_0xb273('0x6d')],'server/files/images/logos/',_0x127922['sitepic']);}}return _0x1de2f7[_0xb273('0x75')](_0x229ed1);}})[_0xb273('0x4c')](handleError(_0x1de2f7,null));};exports[_0xb273('0x76')]=function(_0x541e15,_0x8ff450){var _0x4ef3bf=path['join'](config[_0xb273('0x6d')],_0xb273('0x77'));var _0x20ae5e={'where':{'id':_0x541e15[_0xb273('0x46')]['id']},'attributes':['id',_0xb273('0x66')],'raw':!![]};return db[_0xb273('0x47')][_0xb273('0x53')](_0x20ae5e)[_0xb273('0x13')](handleEntityNotFound(_0x8ff450,null))['then'](function(_0xfd6131){if(_0xfd6131){if(!_[_0xb273('0x72')](_0xfd6131['agentAvatar'])){if(fs[_0xb273('0x73')](path[_0xb273('0x6c')](config[_0xb273('0x6d')],'server/files/images/avatars/',_0xfd6131[_0xb273('0x66')]))){_0x4ef3bf=path[_0xb273('0x6c')](config[_0xb273('0x6d')],_0xb273('0x78'),_0xfd6131[_0xb273('0x66')]);}}return _0x8ff450[_0xb273('0x75')](_0x4ef3bf);}})[_0xb273('0x4c')](handleError(_0x8ff450,null));};exports[_0xb273('0x79')]=function(_0x51161f,_0x399387){var _0x24a043=path[_0xb273('0x6c')](config[_0xb273('0x6d')],_0xb273('0x7a'));var _0x565b3e={'where':{'id':_0x51161f['params']['id']},'attributes':['id',_0xb273('0x68'),_0xb273('0x7b')],'raw':!![]};return db[_0xb273('0x47')][_0xb273('0x53')](_0x565b3e)[_0xb273('0x13')](handleEntityNotFound(_0x399387,null))[_0xb273('0x13')](function(_0x5f5d29){if(_0x5f5d29){if(!_[_0xb273('0x72')](_0x5f5d29[_0xb273('0x68')])){if(fs[_0xb273('0x73')](path['join'](config[_0xb273('0x6d')],_0xb273('0x78'),_0x5f5d29[_0xb273('0x68')]))&&_0x5f5d29['showCustomerAvatar']){_0x24a043=path['join'](config['root'],_0xb273('0x78'),_0x5f5d29[_0xb273('0x68')]);}}return _0x399387[_0xb273('0x75')](_0x24a043);}})[_0xb273('0x4c')](handleError(_0x399387,null));};exports[_0xb273('0x7c')]=function(_0x20037f,_0x28a5d7){var _0x133253=path[_0xb273('0x6c')](config['root'],_0xb273('0x7d'));var _0x26f139={'where':{'id':_0x20037f[_0xb273('0x46')]['id']},'attributes':['id',_0xb273('0x6a')],'raw':!![]};return db[_0xb273('0x47')]['find'](_0x26f139)[_0xb273('0x13')](handleEntityNotFound(_0x28a5d7,null))[_0xb273('0x13')](function(_0x38843e){if(_0x38843e){if(!_[_0xb273('0x72')](_0x38843e[_0xb273('0x6a')])){if(fs[_0xb273('0x73')](path[_0xb273('0x6c')](config[_0xb273('0x6d')],'server/files/images/avatars/',_0x38843e[_0xb273('0x6a')]))){_0x133253=path['join'](config['root'],_0xb273('0x78'),_0x38843e[_0xb273('0x6a')]);}}return _0x28a5d7['download'](_0x133253);}})['catch'](handleError(_0x28a5d7,null));};exports[_0xb273('0x7e')]=function(_0x59b212,_0x2e367c){var _0x406114=require(_0xb273('0x7f'));var _0x3e9baf=new _0x406114();var _0xa8c58a=_0x3e9baf['setUA'](_0x59b212[_0xb273('0x80')][_0xb273('0x81')])[_0xb273('0x82')]();var _0x34dae7={'body':_0x59b212[_0xb273('0x4e')],'channel':_0xb273('0x83')};var _0x2df63b=[];var _0x4dbe7f=[];var _0x302d17={};var _0x4e36ad=![];return db[_0xb273('0x84')][_0xb273('0x56')]()[_0xb273('0x13')](function(_0x3e2519){if(!_0x3e2519){throw new db[(_0xb273('0x85'))][(_0xb273('0x86'))](_0xb273('0x87'));}_0x2df63b=_[_0xb273('0x88')](_[_0xb273('0x33')](_0x3e2519),['createdAt','updatedAt']);_0x4dbe7f=_[_0xb273('0x88')](_[_0xb273('0x33')](_0x3e2519),[_0xb273('0x89'),_0xb273('0x8a'),'CompanyId',_0xb273('0x8b')]);if(_0x59b212['body']['id']){delete _0x59b212[_0xb273('0x4e')]['id'];}if(_[_0xb273('0x72')](_0x59b212[_0xb273('0x4e')][_0xb273('0x8c')])){throw new db['Sequelize'][(_0xb273('0x86'))](_0xb273('0x8d'));}if(_[_0xb273('0x72')](_0x59b212[_0xb273('0x4e')][_0xb273('0x4e')])||_0x59b212[_0xb273('0x4e')][_0xb273('0x4e')]===''){throw new db[(_0xb273('0x85'))][(_0xb273('0x86'))](_0xb273('0x8e'));}if(_[_0xb273('0x72')](_0x59b212[_0xb273('0x4e')][_0xb273('0x8f')])){throw new db[(_0xb273('0x85'))][(_0xb273('0x86'))](_0xb273('0x90')+_0x4dbe7f);}if(!_[_0xb273('0x91')](_0x4dbe7f,_0x59b212[_0xb273('0x4e')][_0xb273('0x8f')])){throw new db[(_0xb273('0x85'))][(_0xb273('0x86'))](_0xb273('0x92')+_0x4dbe7f);}_0x302d17[_0x59b212[_0xb273('0x4e')][_0xb273('0x8f')]]=_0x59b212[_0xb273('0x4e')][_0xb273('0x8c')];})['then'](function(){return db[_0xb273('0x47')][_0xb273('0x53')]({'where':{'id':_0x59b212[_0xb273('0x46')]['id']},'include':[{'model':db['CmList'],'as':_0xb273('0x93'),'include':[{'model':db[_0xb273('0x84')],'as':_0xb273('0x94'),'where':_0x302d17,'limit':0x1,'order':[[_0xb273('0x8a'),_0xb273('0x95')]]}]},{'model':db['ChatApplication'],'as':_0xb273('0x96')}]});})[_0xb273('0x13')](handleEntityNotFound(_0x2e367c,null))[_0xb273('0x13')](function(_0x21b439){if(_0x21b439&&_0x21b439['List']){_0x34dae7['account']=_0x21b439;_0x34dae7[_0xb273('0x97')]=_0x21b439[_0xb273('0x96')];_0x34dae7[_0xb273('0x98')]=_0x21b439[_0xb273('0x93')];_0x34dae7[_0xb273('0x97')]=_[_0xb273('0x99')](_0x34dae7[_0xb273('0x97')],['priority'],['asc']);if(_0x34dae7[_0xb273('0x9a')][_0xb273('0x96')]){delete _0x34dae7[_0xb273('0x9a')][_0xb273('0x96')];}if(_0x34dae7[_0xb273('0x9a')]['List']&&_0x34dae7[_0xb273('0x9a')][_0xb273('0x93')][_0xb273('0x94')][_0xb273('0x38')]){return _0x34dae7[_0xb273('0x9a')]['List'][_0xb273('0x94')][0x0];}var _0x68bf9e=_[_0xb273('0xb')](_0x59b212['body'],{'firstName':_0x59b212['body'][_0xb273('0x8c')],'ListId':_0x21b439[_0xb273('0x8b')]});_0x68bf9e[_0x59b212[_0xb273('0x4e')][_0xb273('0x8f')]]=_0x59b212['body'][_0xb273('0x8c')];return db['CmContact']['create'](_0x68bf9e,{'fields':_0x2df63b,'raw':!![]});}})[_0xb273('0x13')](handleEntityNotFound(_0x2e367c,null))[_0xb273('0x13')](function(_0x2cb13e){_0x34dae7['contact']=_0x2cb13e;var _0x41db79=_0x59b212[_0xb273('0x4e')][_0xb273('0x9b')];if(_0x59b212[_0xb273('0x80')][_0xb273('0x9c')]){_0x41db79=_0x59b212[_0xb273('0x80')][_0xb273('0x9c')];}else if(_0x59b212[_0xb273('0x80')][_0xb273('0x9d')]){_0x41db79=_[_0xb273('0x9e')](_0x59b212[_0xb273('0x80')][_0xb273('0x9d')][_0xb273('0x9f')](','));}if(_0x2cb13e){var _0x47f6be={'ContactId':_0x2cb13e['id'],'ChatWebsiteId':_0x59b212[_0xb273('0x46')]['id'],'from':(_0x2cb13e[_0xb273('0xa0')]||'')+'\x20'+(_0x2cb13e['lastName']||''),'customerIp':_0x41db79,'customerPort':_0x59b212[_0xb273('0x80')][_0xb273('0xa1')]?_0x59b212[_0xb273('0x80')][_0xb273('0xa1')]:null,'referer':_0x59b212[_0xb273('0x4e')][_0xb273('0xa2')],'browserName':_0xa8c58a[_0xb273('0xa3')][_0xb273('0x2c')]&&_0xa8c58a['browser'][_0xb273('0xa4')]?util[_0xb273('0xa5')](_0xb273('0xa6'),_0xa8c58a['browser'][_0xb273('0x2c')],_0xa8c58a[_0xb273('0xa3')][_0xb273('0xa4')]):_0xb273('0xa7'),'browserVersion':_0xa8c58a[_0xb273('0xa3')][_0xb273('0xa4')]||_0xb273('0xa7'),'osName':util[_0xb273('0xa5')](_0xb273('0xa6'),_0xa8c58a['os']['name'],_0xa8c58a['os']['version']),'osVersion':_0xa8c58a['os'][_0xb273('0xa4')],'deviceModel':_0xa8c58a['device'][_0xb273('0x32')]&&_0xa8c58a[_0xb273('0xa8')][_0xb273('0xa9')]?util[_0xb273('0xa5')](_0xb273('0xaa'),_0xa8c58a[_0xb273('0xa8')]['model'],_0xa8c58a[_0xb273('0xa8')][_0xb273('0xa9')],_0xa8c58a['device'][_0xb273('0x3e')]):null,'deviceVendor':_0xa8c58a['device']['vendor'],'deviceType':_0xa8c58a['device'][_0xb273('0x3e')],'formData':JSON[_0xb273('0xab')](_0x59b212[_0xb273('0x4e')])};var _0x5bfac7={'ChatWebsiteId':_0x59b212['params']['id'],'closed':![]};if(_0x59b212[_0xb273('0x4e')][_0xb273('0xac')]){_0x5bfac7[_0xb273('0xac')]=_0x59b212[_0xb273('0x4e')][_0xb273('0xac')];return db[_0xb273('0xad')]['find']({'where':_0x5bfac7})['then'](function(_0x12252e){if(_0x12252e){return[_0x12252e,![]];}_0x47f6be['threadId']=_0x59b212[_0xb273('0x4e')]['threadId'];_0x47f6be['externalUrl']=_0x59b212['body'][_0xb273('0xae')];return db[_0xb273('0xad')][_0xb273('0x4d')](_0x47f6be)['then'](function(_0x352fae){return[_0x352fae,!![]];});});}_0x5bfac7[_0xb273('0xaf')]=_0x2cb13e['id'];if(_0x59b212[_0xb273('0x4e')]['interaction']&&_0x59b212[_0xb273('0x4e')][_0xb273('0xb0')]['id']){_0x5bfac7['id']=_0x59b212['body']['interaction']['id'];return db[_0xb273('0xad')][_0xb273('0x53')]({'where':_0x5bfac7})[_0xb273('0x13')](function(_0x7a363e){if(_0x7a363e){return[_0x7a363e,![]];}return db['ChatInteraction'][_0xb273('0x4d')](_0x47f6be)[_0xb273('0x13')](function(_0xb34f4){return[_0xb34f4,!![]];});});}return db[_0xb273('0xad')]['create'](_0x47f6be)['then'](function(_0x2f586b){return[_0x2f586b,!![]];});}})[_0xb273('0xb1')](function(_0x5cbdc3,_0x342a58){if(_0x5cbdc3){_0x4e36ad=_0x342a58;if(!_0x342a58){var _0x130238={'from':(_0x34dae7[_0xb273('0xb2')][_0xb273('0xa0')]||'')+'\x20'+(_0x34dae7[_0xb273('0xb2')][_0xb273('0xb3')]||'')};if(_0x59b212[_0xb273('0x4e')][_0xb273('0xac')]&&_0x59b212[_0xb273('0x4e')][_0xb273('0xb4')]&&_0x59b212[_0xb273('0x4e')][_0xb273('0xac')]!=_0x59b212[_0xb273('0x4e')][_0xb273('0xb4')]){_0x130238['threadId']=_0x59b212['body'][_0xb273('0xb4')];}return _0x5cbdc3['update'](_0x130238);}else{return _0x5cbdc3;}}})['then'](function(_0x4af8d2){_0x34dae7[_0xb273('0xb0')]=_0x4af8d2[_0xb273('0x27')]({'plain':!![]});_0x34dae7[_0xb273('0xb0')]['created']=_0x4e36ad;if(_0x34dae7['interaction'][_0xb273('0xb5')]){if(_0x34dae7['account'][_0xb273('0xb6')]){_0x34dae7[_0xb273('0x97')][_0xb273('0xb7')]({'id':0x0,'priority':_0x34dae7[_0xb273('0x97')]['length']+0x1,'app':_0xb273('0xb8'),'appdata':'unmanaged','interval':_0xb273('0xb9')});}}return db[_0xb273('0xba')]['create']({'body':_0x59b212[_0xb273('0x4e')][_0xb273('0x4e')],'ChatWebsiteId':_0x59b212['params']['id'],'ChatInteractionId':_0x4af8d2['id'],'direction':'in','ContactId':_0x34dae7[_0xb273('0xb2')]['id'],'AttachmentId':_0x59b212[_0xb273('0x4e')]['AttachmentId']});})[_0xb273('0x13')](function(_0x596eea){_0x34dae7['message']=_0x596eea;if(_0x34dae7[_0xb273('0xb0')]['UserId']){return db['User'][_0xb273('0x53')]({'attributes':['id',_0xb273('0x2c')],'where':{'id':_0x34dae7[_0xb273('0xb0')][_0xb273('0xbb')]}})[_0xb273('0x13')](function(_0x5175cb){if(_0x5175cb){_0x34dae7[_0xb273('0x97')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb273('0xbc'),'appdata':_0x5175cb[_0xb273('0x2c')]+','+(_0x34dae7[_0xb273('0x9a')][_0xb273('0xbd')]||0xa),'interval':_0xb273('0xb9')});_0x34dae7[_0xb273('0xbe')]=!![];}return respondWithRpcPromise(_0xb273('0xbf'),_0xb273('0xc0'),_0x34dae7);});}return respondWithRpcPromise(_0xb273('0xbf'),_0xb273('0xc0'),_0x34dae7);})[_0xb273('0x13')](function(_0x4c693f){respondWithRpcPromise(_0xb273('0xc1'),_0xb273('0xc1'),{'event':_0xb273('0x7e'),'message':_0x4c693f},client9002);return _0x4c693f;})[_0xb273('0x13')](respondWithResult(_0x2e367c,null))['catch'](handleError(_0x2e367c,null));};exports[_0xb273('0xc2')]=function(_0x3be6fa,_0x47fc98){var _0x247e89,_0x6e2894,_0x18e169;var _0x1781ec=[];var _0x464eb9={};var _0x4a82f5=_0x3be6fa[_0xb273('0xc3')]||[];var _0x539d19=[];var _0x2b096f;return db[_0xb273('0x84')][_0xb273('0x56')]()['then'](function(_0x1ced3b){if(!_0x1ced3b){throw new db[(_0xb273('0x85'))][(_0xb273('0x86'))](_0xb273('0x87'));}_0x1781ec=_[_0xb273('0x88')](_[_0xb273('0x33')](_0x1ced3b),[_0xb273('0x89'),_0xb273('0x8a'),'CompanyId',_0xb273('0x8b')]);if(_0x3be6fa[_0xb273('0x4e')]['id']){delete _0x3be6fa[_0xb273('0x4e')]['id'];}if(_['isNil'](_0x3be6fa[_0xb273('0x4e')][_0xb273('0x8c')])){throw _0x47fc98[_0xb273('0x1d')](0x1f4)[_0xb273('0xc4')](new db[(_0xb273('0x85'))][(_0xb273('0x86'))](_0xb273('0x8d')));}if(_['isNil'](_0x3be6fa[_0xb273('0x4e')][_0xb273('0x4e')])||_0x3be6fa['body'][_0xb273('0x4e')]===''){throw _0x47fc98[_0xb273('0x1d')](0x1f4)['send'](new db[(_0xb273('0x85'))][(_0xb273('0x86'))](_0xb273('0x8e')));}if(_[_0xb273('0x72')](_0x3be6fa[_0xb273('0x4e')]['mapKeyOffline'])){throw _0x47fc98[_0xb273('0x1d')](0x1f4)[_0xb273('0xc4')](new db[(_0xb273('0x85'))][(_0xb273('0x86'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1781ec));}if(!_[_0xb273('0x91')](_0x1781ec,_0x3be6fa[_0xb273('0x4e')]['mapKeyOffline'])){throw _0x47fc98[_0xb273('0x1d')](0x1f4)[_0xb273('0xc4')](new db[(_0xb273('0x85'))][(_0xb273('0x86'))](_0xb273('0xc5')+_0x1781ec));}_0x464eb9[_0x3be6fa[_0xb273('0x4e')][_0xb273('0xc6')]]=_0x3be6fa['body'][_0xb273('0x8c')];})['then'](function(){return db['ChatWebsite'][_0xb273('0x53')]({'where':{'id':_0x3be6fa[_0xb273('0x46')]['id']},'include':[{'model':db['CmList'],'as':_0xb273('0x93')},{'model':db[_0xb273('0xc7')],'as':'MailAccount'}]});})[_0xb273('0x13')](handleEntityNotFound(_0x47fc98,null))[_0xb273('0x13')](function(_0x2fc619){if(_0x2fc619&&_0x2fc619['List']){_0x6e2894=_0x2fc619;var _0x105fcd=_[_0xb273('0xb')](_0x3be6fa['body'],{'firstName':_0x3be6fa[_0xb273('0x4e')][_0xb273('0x8c')],'phone':_0x3be6fa[_0xb273('0x4e')][_0xb273('0x8c')],'ListId':_0x2fc619[_0xb273('0x8b')]});_0x105fcd[_0x3be6fa[_0xb273('0x4e')][_0xb273('0xc6')]]=_0x3be6fa[_0xb273('0x4e')]['from'];return db[_0xb273('0x84')][_0xb273('0xc8')]({'where':_0x464eb9,'defaults':_0x105fcd});}})[_0xb273('0xb1')](function(_0x15ad83){if(_0x15ad83){_0x18e169=_0x15ad83;var _0x5f8ea0=fs[_0xb273('0xc9')](path[_0xb273('0x6c')](config[_0xb273('0x6d')],_0xb273('0xca')),_0xb273('0xcb'));var _0x1ab479=ejs[_0xb273('0xcc')](_0x5f8ea0,{'body':_[_0xb273('0xcd')](_0x3be6fa[_0xb273('0x4e')]['body']),'bodyTitle':_0x6e2894[_0xb273('0xce')]});return db[_0xb273('0xcf')][_0xb273('0x4d')]({'body':_0x1ab479,'plainBody':htmlToText[_0xb273('0xd0')](_0x1ab479),'ContactId':_0x15ad83['id'],'ChatWebsiteId':_0x6e2894['id']});}})[_0xb273('0x13')](function(_0x101faa){_0x2b096f=_0x101faa;if(_0x4a82f5[_0xb273('0x38')]){var _0x5750ab=_0x4a82f5[_0xb273('0x30')](function(_0x593296){return{'name':_0x593296[_0xb273('0xd1')],'basename':_0x593296[_0xb273('0x64')],'type':_0x593296[_0xb273('0xd2')],'ChatOfflineMessageId':_0x101faa['id']};});_0x539d19=_0x5750ab['map'](_0x24f039=>{var _0x4dcc98={'filename':_0x24f039['name'],'path':path[_0xb273('0x6c')](config['root'],_0xb273('0xd3'),_0xb273('0xc3'),_0xb273('0xd4'),_0xb273('0xd5'),_0x24f039[_0xb273('0xd6')])};return _0x4dcc98;});if(!_0x6e2894[_0xb273('0xd7')]){return db['sequelize']['transaction'](function(_0x5d46d2){return db[_0xb273('0xd8')][_0xb273('0xd9')](_0x5750ab,{'transaction':_0x5d46d2});});}}})['then'](function(){if(_0x2b096f){_0x247e89=_0x2b096f;return db[_0xb273('0xc7')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xb273('0xda')],'as':_0xb273('0xdb'),'raw':!![],'include':[{'model':db[_0xb273('0xdc')],'as':_0xb273('0xdc'),'raw':!![]}]}]});}})[_0xb273('0x13')](function(_0x466db6){if(_0x466db6&&_0x466db6[_0xb273('0xdb')]&&_0x6e2894[_0xb273('0xdd')]&&_0x6e2894[_0xb273('0xde')]){var _0x374823=_0x466db6['getSmtpOptions']();return respondWithRpcPromise(_0xb273('0xdf'),_0xb273('0xe0'),{'account':_0x374823,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x466db6[_0xb273('0x2c')],_0x466db6[_0xb273('0xe1')]||_0x466db6[_0xb273('0xdb')][_0xb273('0x51')]),'to':_0x6e2894['forwardOfflineAddress'],'subject':_0x6e2894[_0xb273('0xe2')],'html':_0x247e89[_0xb273('0x4e')],'attachments':_0x539d19}},client9003)[_0xb273('0x13')](function(){return _0x247e89;})[_0xb273('0x4c')](function(_0x3e6304){logger[_0xb273('0x18')](_0x3e6304);});}})[_0xb273('0x13')](function(){if(_0x6e2894&&_0x6e2894[_0xb273('0xd7')]&&_0x6e2894[_0xb273('0xe3')]){var _0x1dce68=[];if(_0x4a82f5[_0xb273('0x38')]){_0x1dce68=_0x4a82f5[_0xb273('0x30')](function(_0x34f282){return{'name':_0x34f282['originalname'],'basename':_0x34f282[_0xb273('0x64')],'type':_0x34f282[_0xb273('0xd2')],'ChatOfflineMessageId':_0x2b096f['id']};});}var _0x3d89e7;if(!_['isNil'](_0x6e2894[_0xb273('0xe4')])){var _0x2876fc=_[_0xb273('0x30')](_0x3be6fa[_0xb273('0x4e')],function(_0x3384e7){return _0x3384e7;});var _0x1ca9fa=_[_0xb273('0xe5')](_0x2876fc)[0x0];var _0x367dad=_[_0xb273('0xe6')](_0x1ca9fa,function(_0x505a1f){return _0x505a1f;});_0x3d89e7=_0x367dad[0x1][_0x6e2894[_0xb273('0xe4')]];}var _0x55b139={'from':_0x18e169[_0xb273('0xe1')],'firstName':_0x18e169['firstName'],'lastName':_0x18e169[_0xb273('0xb3')],'mapKey':_0xb273('0xe1'),'message':{'from':_0x18e169[_0xb273('0xe1')],'to':_0x6e2894[_0xb273('0xc7')]['email'],'cc':'','subject':_[_0xb273('0x72')](_0x3d89e7)?_0x6e2894[_0xb273('0xe2')]:_0x3d89e7,'messageId':'','sentAt':new Date(),'attach':_0x1dce68['length'],'attachments':_0x1dce68,'originChannel':'Chat','ChatWebsiteId':_0x6e2894['id'],'ChatOfflineMessageId':_0x247e89['id'],'originTo':_0x6e2894[_0xb273('0xc7')][_0xb273('0xe1')]},'body':_0x247e89[_0xb273('0x4e')]};var _0x5ce23e={'account':{'id':_0x6e2894[_0xb273('0xe3')]},'body':_0x55b139,'log':_0xb273('0xe7')};return respondWithRpcPromise('NotifyMailAccount',_0xb273('0xe8'),_0x5ce23e,client9001)[_0xb273('0x13')](function(){return _0x247e89;})[_0xb273('0x4c')](function(_0x406ffe){logger[_0xb273('0x18')](_0x406ffe);});}return;})[_0xb273('0x13')](function(){if(_0x247e89){return _0x247e89;}})[_0xb273('0x13')](respondWithResult(_0x47fc98,null))['catch'](function(_0x25921c){logger['error'](_0xb273('0x4c'),_0x25921c);for(var _0x3f176d of _0x4a82f5){var _0x33fa19=path['join'](config[_0xb273('0x6d')],_0xb273('0xd3'),_0xb273('0xc3'),_0xb273('0xd4'),_0xb273('0xd5'),_0x3f176d[_0xb273('0x64')]);fs_extra['remove'](_0x33fa19)[_0xb273('0x4c')](function(_0xe5ca1e){logger[_0xb273('0x18')](_0xb273('0xe9'),_0x33fa19,_0xe5ca1e);});}});};exports[_0xb273('0xea')]=function(_0x4f4b7c,_0x309058){return db[_0xb273('0xad')][_0xb273('0x53')]({'where':{'id':_0x4f4b7c[_0xb273('0x46')]['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x309058,null))[_0xb273('0x13')](function(_0x2ff4e){if(_0x2ff4e){return _0x2ff4e[_0xb273('0xea')](_0x4f4b7c[_0xb273('0x4e')][_0xb273('0x5b')],_[_0xb273('0xeb')](_0x4f4b7c[_0xb273('0x4e')],[_0xb273('0x5b'),'id'])||{});}})[_0xb273('0x13')](respondWithResult(_0x309058,null))[_0xb273('0x4c')](handleError(_0x309058,null));};exports[_0xb273('0xec')]=function(_0x41d168,_0x56d9bf){var _0x464796={'raw':![],'where':{}};var _0x51e44b={};var _0x19c542={'count':0x0,'rows':[]};return db[_0xb273('0x47')][_0xb273('0x5a')]({'where':{'id':_0x41d168['params']['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x56d9bf,null))['then'](function(_0x619b6a){if(_0x619b6a){_0x51e44b['model']=_['keys'](db[_0xb273('0xad')][_0xb273('0x48')]);_0x51e44b[_0xb273('0x34')]=_['keys'](_0x41d168[_0xb273('0x34')]);_0x51e44b[_0xb273('0x35')]=_['intersection'](_0x51e44b[_0xb273('0x32')],_0x51e44b[_0xb273('0x34')]);_0x464796[_0xb273('0x37')]=_[_0xb273('0x36')](_0x51e44b[_0xb273('0x32')],qs['fields'](_0x41d168['query'][_0xb273('0x49')]));_0x464796['attributes']=_0x464796[_0xb273('0x37')][_0xb273('0x38')]?_0x464796[_0xb273('0x37')]:_0x51e44b[_0xb273('0x32')];if(!_0x41d168[_0xb273('0x34')][_0xb273('0x39')](_0xb273('0x5f'))){_0x464796[_0xb273('0x21')]=qs['limit'](_0x41d168[_0xb273('0x34')][_0xb273('0x21')]);_0x464796['offset']=qs[_0xb273('0x1f')](_0x41d168[_0xb273('0x34')][_0xb273('0x1f')]);}_0x464796[_0xb273('0x3a')]=qs['sort'](_0x41d168[_0xb273('0x34')][_0xb273('0x3b')]);_0x464796[_0xb273('0x3c')]=qs[_0xb273('0x35')](_[_0xb273('0x3d')](_0x41d168['query'],_0x51e44b['filters']));_0x464796[_0xb273('0x3c')][_0xb273('0x57')]=_0x619b6a['id'];if(_0x41d168[_0xb273('0x34')]['filter']){_0x464796['where']=_[_0xb273('0x41')](_0x464796[_0xb273('0x3c')],{'$or':_[_0xb273('0x30')](_0x464796[_0xb273('0x37')],function(_0x2f701e){var _0x17e888={};_0x17e888[_0x2f701e]={'$like':'%'+_0x41d168['query'][_0xb273('0x40')]+'%'};return _0x17e888;})});}_0x464796=_[_0xb273('0x41')]({},_0x464796,_0x41d168[_0xb273('0x4b')]);return db[_0xb273('0xad')]['count']({'where':_0x464796[_0xb273('0x3c')]})[_0xb273('0x13')](function(_0x4d49e1){_0x19c542['count']=_0x4d49e1;if(_0x41d168[_0xb273('0x34')][_0xb273('0x42')]){_0x464796['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xb273('0xed')],'as':'Owner','attributes':[_0xb273('0x2c'),_0xb273('0xee'),_0xb273('0xef')],'required':![]},{'model':db['Tag'],'as':_0xb273('0xf0'),'attributes':['id',_0xb273('0x2c'),'color'],'where':_0x41d168[_0xb273('0x34')][_0xb273('0xf1')]?{'id':_0x41d168[_0xb273('0x34')][_0xb273('0xf1')]}:undefined,'required':_0x41d168['query'][_0xb273('0xf1')]?!![]:![]}];}return db[_0xb273('0xad')]['findAll'](_0x464796);})[_0xb273('0x13')](function(_0x2b93c2){_0x19c542['rows']=_0x2b93c2;return _0x19c542;});}})[_0xb273('0x13')](respondWithFilteredResult(_0x56d9bf,_0x464796))[_0xb273('0x4c')](handleError(_0x56d9bf,null));};function iftimePromise(_0x9c28c3,_0x536675){return respondWithRpcPromise(_0xb273('0xf2'),_0xb273('0xf3'),{'command':_0x536675[_0xb273('0xf4')]?util[_0xb273('0xa5')](_0xb273('0xf5'),_0x9c28c3['interval'],_0x536675[_0xb273('0xf4')]):util[_0xb273('0xa5')](_0xb273('0xf6'),_0x9c28c3[_0xb273('0xf7')])},client9002)['then'](function(_0x37f253){var _0x88c4=_0x37f253&&_0x37f253[_0xb273('0xf8')](_0xb273('0xf9'))>=0x0?!![]:![];logger[_0xb273('0x14')](_0xb273('0xfa'),_0x536675['id'],_0x9c28c3['id'],_0x9c28c3[_0xb273('0xf7')],_0x88c4?_0xb273('0xfb'):'OFFLINE',_0x536675[_0xb273('0xf4')]?_0x536675[_0xb273('0xf4')]:'No\x20timezone');return _0x88c4;})['catch'](function(_0xe8d206){logger[_0xb273('0x18')](_0xb273('0xfa'),_0x536675['id'],_0x9c28c3['id'],_0x9c28c3[_0xb273('0xf7')],util[_0xb273('0xfc')](_0xe8d206,{'showHidden':![],'depth':null}),_0x536675[_0xb273('0xf4')]?_0x536675[_0xb273('0xf4')]:_0xb273('0xfd'));return![];});}exports[_0xb273('0xf3')]=function(_0x71de17,_0x2e4777){var _0x30074e=0x0;var _0x4186da=0x0;var _0x181e67=![];var _0x57f5e7;var _0x47cd63;return db['ChatWebsite']['find']({'where':{'id':_0x71de17[_0xb273('0x46')]['id']},'include':[{'model':db[_0xb273('0xfe')],'as':'Interval','include':[{'model':db[_0xb273('0xfe')],'as':'Intervals','attributes':['id',_0xb273('0xf7')],'raw':!![]}]}]})[_0xb273('0x13')](handleEntityNotFound(_0x2e4777,null))[_0xb273('0x13')](function(_0x20d997){if(_0x20d997){_0x57f5e7=_0x20d997;return _0x20d997[_0xb273('0xff')]({'raw':!![]});}})['then'](function(_0x4b733a){if(_0x57f5e7){if(_0x4b733a){_0x47cd63=_0x4b733a;}}return require(_0xb273('0x6f'))['getLicense']();})[_0xb273('0x13')](function(_0x3184da){if(_0x3184da){_0x4186da=_0x3184da['virtual'];_0x181e67=_0x3184da['custom'];}})[_0xb273('0x13')](function(){return db[_0xb273('0xad')][_0xb273('0x22')]({'where':{'closed':![]}});})['then'](function(_0x446c6d){_0x30074e=_0x446c6d;if(_0x4186da&&_0x446c6d>_0x4186da){return db['License'][_0xb273('0x5a')]({'where':{'id':0x1}})[_0xb273('0x13')](function(_0x22eae5){if(_0x22eae5){_0x22eae5[_0xb273('0x100')](_0xb273('0x101'));}});}})[_0xb273('0x13')](function(){if(_0x57f5e7[_0xb273('0xfe')]&&_0x57f5e7[_0xb273('0xfe')][_0xb273('0x102')]){var _0x3fd55b=[];for(var _0xddd862=0x0;_0xddd862<_0x57f5e7[_0xb273('0xfe')][_0xb273('0x102')][_0xb273('0x38')];_0xddd862++){var _0x5c948b=_0x57f5e7[_0xb273('0xfe')][_0xb273('0x102')][_0xddd862]['get']({'plain':!![]});_0x3fd55b[_0xb273('0xb7')](iftimePromise(_0x5c948b,_0x57f5e7));}return BPromise['all'](_0x3fd55b)[_0xb273('0x13')](function(_0x2902b6){return _['some'](_0x2902b6);});}else{return!![];}})[_0xb273('0x13')](function(_0x3ec1d9){var _0x56d048=fs[_0xb273('0xc9')](path[_0xb273('0x6c')](config[_0xb273('0x6d')],'server/files/chat/iframe.ejs'),_0xb273('0xcb'));var _0x5ee5c8=new url['URL'](_0x57f5e7[_0xb273('0x103')])[_0xb273('0x104')];var _0x268fd1='3.1.0';var _0x445637=![];var _0x1edbf6={'chatVersion':_0x268fd1,'chatWebsiteAddressOrigin':_0x5ee5c8,'remote':_0x57f5e7[_0xb273('0x105')],'query':querystring[_0xb273('0xab')](_[_0xb273('0x41')](_0x57f5e7[_0xb273('0x27')]({'plain':!![]}),{'customerIp':_0x71de17[_0xb273('0x80')][_0xb273('0x9d')]||_0x71de17[_0xb273('0x80')][_0xb273('0x106')]||_0x71de17['connection']['remoteAddress']||_0x71de17['ip'],'referer':_0x71de17[_0xb273('0x80')]['referer'],'openedInteractions':_0x30074e,'maxInteractions':_0x4186da,'virtual':_0x181e67['virtual'],'online':_0x3ec1d9,'custom':_0x181e67}))[_0xb273('0x107')](/'/g,'\x5c\x27')};_0x2e4777[_0xb273('0xc4')](ejs[_0xb273('0xcc')](Mustache[_0xb273('0xcc')](_0x56d048,_0x1edbf6),{'proactiveActions':_0x47cd63,'alignment':_0x57f5e7[_0xb273('0x108')],'verticalAlignment':_0x57f5e7[_0xb273('0x109')],'div_color':_0x57f5e7['color'],'labelText':_0x57f5e7[_0xb273('0x10a')],'text_color':_0x57f5e7[_0xb273('0x10b')],'text_button_color':_0x57f5e7['textButtonColor'],'button_color':_0x57f5e7[_0xb273('0x10c')],'background_color':_0x57f5e7[_0xb273('0x10d')],'hideWhenOffline':_0x57f5e7[_0xb273('0x10e')],'intervalId':_0x57f5e7[_0xb273('0x10f')],'isDevelopment':_0x445637,'chatVersion':_0x268fd1}));})[_0xb273('0x4c')](handleError(_0x2e4777,null));};exports['addApplications']=function(_0xc1f8c0,_0x1a22ba){var _0x4e7e0a=_0xc1f8c0[_0xb273('0x46')]['id'];var _0x20dd37=_0xc1f8c0[_0xb273('0x4e')];var _0x51cc83=0xc8;var _0x2709f0=null;return db[_0xb273('0x110')][_0xb273('0x111')]({'isolationLevel':db['sequelize'][_0xb273('0x112')][_0xb273('0x113')][_0xb273('0x114')]},function(_0xae67eb){return db[_0xb273('0x47')][_0xb273('0x5a')]({'where':{'id':_0x4e7e0a},'transaction':_0xae67eb})['then'](function(_0x324665){if(_0x324665){return db[_0xb273('0x115')][_0xb273('0x26')]({'where':{'ChatWebsiteId':_0x4e7e0a},'transaction':_0xae67eb})[_0xb273('0x13')](function(){var _0x55f6a5=_[_0xb273('0x30')](_0x20dd37,function(_0x20809d){_0x20809d[_0xb273('0x57')]=_0x4e7e0a;return _0x20809d;});return db[_0xb273('0x115')][_0xb273('0xd9')](_0x55f6a5,{'transaction':_0xae67eb});});}else{_0x51cc83=0x194;_0x2709f0=[];}});})[_0xb273('0x13')](function(){if(_0x51cc83!==0x194){return db[_0xb273('0x115')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x4e7e0a},'order':_0xb273('0x116')})[_0xb273('0x13')](function(_0x491c5c){_0x2709f0=_0x491c5c;});}})['catch'](function(_0xaf1656){_0x51cc83=0x1f4;logger[_0xb273('0x18')](_0xaf1656[_0xb273('0x2b')]);if(_0xaf1656['name']){delete _0xaf1656['name'];}_0x2709f0=_0xaf1656;})[_0xb273('0x117')](function(){if(_0x2709f0===null){_0x1a22ba['sendStatus'](_0x51cc83);}else{if(_0x51cc83===0x1f4){_0x1a22ba[_0xb273('0x1d')](_0x51cc83)[_0xb273('0xc4')](_0x2709f0);}else{_0x1a22ba[_0xb273('0x1d')](_0x51cc83)['json'](_0x2709f0);}}});};exports[_0xb273('0x118')]=function(_0x5cbacf,_0x4859be){var _0x25099c={};var _0x8d43d={};var _0x34b285;var _0x1f6c16;return db[_0xb273('0x47')][_0xb273('0x5a')]({'where':{'id':_0x5cbacf[_0xb273('0x46')]['id']}})['then'](handleEntityNotFound(_0x4859be,null))[_0xb273('0x13')](function(_0x5ca2d5){if(_0x5ca2d5){_0x34b285=_0x5ca2d5;_0x8d43d[_0xb273('0x32')]=_[_0xb273('0x33')](db['ChatApplication'][_0xb273('0x48')]);_0x8d43d[_0xb273('0x34')]=_['keys'](_0x5cbacf[_0xb273('0x34')]);_0x8d43d['filters']=_['intersection'](_0x8d43d[_0xb273('0x32')],_0x8d43d[_0xb273('0x34')]);_0x25099c[_0xb273('0x37')]=_[_0xb273('0x36')](_0x8d43d[_0xb273('0x32')],qs['fields'](_0x5cbacf[_0xb273('0x34')][_0xb273('0x49')]));_0x25099c[_0xb273('0x37')]=_0x25099c['attributes'][_0xb273('0x38')]?_0x25099c['attributes']:_0x8d43d[_0xb273('0x32')];_0x25099c[_0xb273('0x3a')]=qs['sort'](_0x5cbacf['query'][_0xb273('0x3b')]);_0x25099c['where']=qs[_0xb273('0x35')](_[_0xb273('0x3d')](_0x5cbacf[_0xb273('0x34')],_0x8d43d[_0xb273('0x35')]));if(_0x5cbacf[_0xb273('0x34')][_0xb273('0x40')]){_0x25099c['where']=_[_0xb273('0x41')](_0x25099c['where'],{'$or':_[_0xb273('0x30')](_0x25099c[_0xb273('0x37')],function(_0x5ded6c){var _0x47b23e={};_0x47b23e[_0x5ded6c]={'$like':'%'+_0x5cbacf[_0xb273('0x34')][_0xb273('0x40')]+'%'};return _0x47b23e;})});}_0x25099c=_[_0xb273('0x41')]({},_0x25099c,_0x5cbacf[_0xb273('0x4b')]);return _0x34b285[_0xb273('0x118')](_0x25099c);}})[_0xb273('0x13')](function(_0x280ca7){if(_0x280ca7){_0x1f6c16=_0x280ca7['length'];if(!_0x5cbacf[_0xb273('0x34')]['hasOwnProperty']('nolimit')){_0x25099c[_0xb273('0x21')]=qs[_0xb273('0x21')](_0x5cbacf['query']['limit']);_0x25099c[_0xb273('0x1f')]=qs[_0xb273('0x1f')](_0x5cbacf[_0xb273('0x34')][_0xb273('0x1f')]);}return _0x34b285[_0xb273('0x118')](_0x25099c);}})[_0xb273('0x13')](function(_0x5e09e9){if(_0x5e09e9){return _0x5e09e9?{'count':_0x1f6c16,'rows':_0x5e09e9}:null;}})[_0xb273('0x13')](respondWithResult(_0x4859be,null))[_0xb273('0x4c')](handleError(_0x4859be,null));};exports[_0xb273('0x119')]=function(_0x4dec0d,_0x186000){return db[_0xb273('0x11a')][_0xb273('0x53')]({'where':{'id':_0x4dec0d[_0xb273('0x46')]['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x186000,null))[_0xb273('0x13')](function(_0x5ed5a6){if(_0x5ed5a6){return _0x5ed5a6[_0xb273('0x119')](_0x4dec0d[_0xb273('0x4e')][_0xb273('0x5b')],_[_0xb273('0xeb')](_0x4dec0d[_0xb273('0x4e')],['ids','id'])||{});}})[_0xb273('0x13')](respondWithResult(_0x186000,null))['catch'](handleError(_0x186000,null));};exports['getProactiveActions']=function(_0x45dae6,_0x1ec15a){var _0x1bd68d={};var _0xae22c4={};var _0x1f78ea;var _0x28076b;return db[_0xb273('0x47')][_0xb273('0x5a')]({'where':{'id':_0x45dae6['params']['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x1ec15a,null))[_0xb273('0x13')](function(_0x14a7bd){if(_0x14a7bd){_0x1f78ea=_0x14a7bd;_0xae22c4[_0xb273('0x32')]=_[_0xb273('0x33')](db[_0xb273('0x11b')][_0xb273('0x48')]);_0xae22c4[_0xb273('0x34')]=_['keys'](_0x45dae6[_0xb273('0x34')]);_0xae22c4[_0xb273('0x35')]=_[_0xb273('0x36')](_0xae22c4[_0xb273('0x32')],_0xae22c4[_0xb273('0x34')]);_0x1bd68d['attributes']=_['intersection'](_0xae22c4[_0xb273('0x32')],qs[_0xb273('0x49')](_0x45dae6[_0xb273('0x34')]['fields']));_0x1bd68d[_0xb273('0x37')]=_0x1bd68d[_0xb273('0x37')]['length']?_0x1bd68d[_0xb273('0x37')]:_0xae22c4[_0xb273('0x32')];_0x1bd68d[_0xb273('0x3a')]=qs['sort'](_0x45dae6['query'][_0xb273('0x3b')]);_0x1bd68d[_0xb273('0x3c')]=qs['filters'](_[_0xb273('0x3d')](_0x45dae6[_0xb273('0x34')],_0xae22c4[_0xb273('0x35')]));if(_0x45dae6[_0xb273('0x34')]['filter']){_0x1bd68d[_0xb273('0x3c')]=_[_0xb273('0x41')](_0x1bd68d['where'],{'$or':_[_0xb273('0x30')](_0x1bd68d[_0xb273('0x37')],function(_0x5123e8){var _0xb63365={};_0xb63365[_0x5123e8]={'$like':'%'+_0x45dae6[_0xb273('0x34')][_0xb273('0x40')]+'%'};return _0xb63365;})});}_0x1bd68d=_['merge']({},_0x1bd68d,_0x45dae6['options']);return _0x1f78ea[_0xb273('0xff')](_0x1bd68d);}})[_0xb273('0x13')](function(_0x367d1f){if(_0x367d1f){_0x28076b=_0x367d1f['length'];if(!_0x45dae6['query'][_0xb273('0x39')](_0xb273('0x5f'))){_0x1bd68d[_0xb273('0x21')]=qs['limit'](_0x45dae6[_0xb273('0x34')]['limit']);_0x1bd68d['offset']=qs[_0xb273('0x1f')](_0x45dae6['query']['offset']);}return _0x1f78ea['getProactiveActions'](_0x1bd68d);}})[_0xb273('0x13')](function(_0x5e6063){if(_0x5e6063){return _0x5e6063?{'count':_0x28076b,'rows':_0x5e6063}:null;}})['then'](respondWithResult(_0x1ec15a,null))['catch'](handleError(_0x1ec15a,null));};exports[_0xb273('0x11c')]=function(_0x41cfde,_0x57d8af){var _0x1d0cf9=_0x41cfde[_0xb273('0x34')][_0xb273('0x11d')]===_0xb273('0x11e')?_0xb273('0x11f'):_0xb273('0x120');return db['ChatWebsite'][_0xb273('0x53')]({'attributes':['id',_0x1d0cf9],'where':{'id':_0x41cfde[_0xb273('0x46')]['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x57d8af,null))[_0xb273('0x13')](function(_0x4caf42){if(_0x4caf42){var _0x1f3e3a=_0x4caf42[_0x1d0cf9];var _0xbc9d72=_0x1f3e3a&&_0x1f3e3a[_0xb273('0x121')]?_0x1f3e3a[_0xb273('0x121')]:[];_0x57d8af[_0xb273('0xc4')]({'fromKey':_['isNil'](_0x1f3e3a[_0xb273('0x122')])?undefined:_0x1f3e3a['fromKey'],'count':_0xbc9d72['length'],'rows':_0xbc9d72});}})[_0xb273('0x4c')](handleError(_0x57d8af,null));};exports[_0xb273('0x123')]=function(_0x4a554a,_0x1fe77c){var _0x4ee8c0={'raw':![],'where':{}};var _0x3ee91f={};var _0x5f02cf={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb273('0x5a')]({'where':{'id':_0x4a554a[_0xb273('0x46')]['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x1fe77c,null))[_0xb273('0x13')](function(_0x462647){if(_0x462647){_0x3ee91f[_0xb273('0x32')]=_[_0xb273('0x33')](db[_0xb273('0xcf')][_0xb273('0x48')]);_0x3ee91f[_0xb273('0x34')]=_[_0xb273('0x33')](_0x4a554a['query']);_0x3ee91f[_0xb273('0x35')]=_[_0xb273('0x36')](_0x3ee91f[_0xb273('0x32')],_0x3ee91f[_0xb273('0x34')]);_0x4ee8c0['attributes']=_[_0xb273('0x36')](_0x3ee91f[_0xb273('0x32')],qs['fields'](_0x4a554a[_0xb273('0x34')]['fields']));_0x4ee8c0[_0xb273('0x37')]=_0x4ee8c0[_0xb273('0x37')][_0xb273('0x38')]?_0x4ee8c0['attributes']:_0x3ee91f[_0xb273('0x32')];if(!_0x4a554a[_0xb273('0x34')][_0xb273('0x39')](_0xb273('0x5f'))){_0x4ee8c0[_0xb273('0x21')]=qs[_0xb273('0x21')](_0x4a554a[_0xb273('0x34')][_0xb273('0x21')]);_0x4ee8c0[_0xb273('0x1f')]=qs[_0xb273('0x1f')](_0x4a554a[_0xb273('0x34')]['offset']);}_0x4ee8c0['order']=qs['sort'](_0x4a554a[_0xb273('0x34')][_0xb273('0x3b')]);_0x4ee8c0[_0xb273('0x3c')]=qs['filters'](_[_0xb273('0x3d')](_0x4a554a[_0xb273('0x34')],_0x3ee91f[_0xb273('0x35')]));_0x4ee8c0[_0xb273('0x3c')][_0xb273('0x57')]=_0x462647['id'];if(_0x4a554a[_0xb273('0x34')][_0xb273('0x40')]){_0x4ee8c0[_0xb273('0x3c')]=_[_0xb273('0x41')](_0x4ee8c0[_0xb273('0x3c')],{'$or':_['map'](_0x4ee8c0[_0xb273('0x37')],function(_0x40448c){var _0x315c6a={};_0x315c6a[_0x40448c]={'$like':'%'+_0x4a554a[_0xb273('0x34')][_0xb273('0x40')]+'%'};return _0x315c6a;})});}_0x4ee8c0=_['merge']({},_0x4ee8c0,_0x4a554a[_0xb273('0x4b')]);return db[_0xb273('0xcf')]['count']({'where':_0x4ee8c0[_0xb273('0x3c')]})[_0xb273('0x13')](function(_0x36cf67){_0x5f02cf[_0xb273('0x22')]=_0x36cf67;if(_0x4a554a[_0xb273('0x34')][_0xb273('0x42')]){_0x4ee8c0['include']=[{'all':!![]}];}else{_0x4ee8c0[_0xb273('0x4a')]=[{'model':db['CmContact'],'as':_0xb273('0x124'),'required':![]},{'model':db[_0xb273('0xd8')],'as':'Attachments','required':![]}];}return db[_0xb273('0xcf')][_0xb273('0x43')](_0x4ee8c0);})[_0xb273('0x13')](function(_0x51d974){_0x5f02cf[_0xb273('0x44')]=_0x51d974;return _0x5f02cf;});}})[_0xb273('0x13')](respondWithFilteredResult(_0x1fe77c,_0x4ee8c0))[_0xb273('0x4c')](handleError(_0x1fe77c,null));};exports[_0xb273('0x125')]=function(_0x255baa,_0x5402c2){return db[_0xb273('0x47')][_0xb273('0x53')]({'where':{'id':_0x255baa[_0xb273('0x46')]['id']}})['then'](handleEntityNotFound(_0x5402c2,null))[_0xb273('0x13')](function(_0x5251f2){if(_0x5251f2){return _0x5251f2[_0xb273('0x125')](_0x255baa[_0xb273('0x4e')]['ids'],_[_0xb273('0xeb')](_0x255baa[_0xb273('0x4e')],[_0xb273('0x5b'),'id'])||{})['spread'](function(_0x5f342a){for(var _0x1496f2=0x0;_0x1496f2<_0x255baa['body'][_0xb273('0x5b')][_0xb273('0x38')];_0x1496f2+=0x1){socket[_0xb273('0x126')](_0xb273('0x127'),{'UserId':Number(_0x255baa['body'][_0xb273('0x5b')][_0x1496f2]),'ChatWebsiteId':Number(_0x255baa[_0xb273('0x46')]['id'])});}return _0x5f342a;});}})[_0xb273('0x13')](respondWithResult(_0x5402c2,null))['catch'](handleError(_0x5402c2,null));};exports[_0xb273('0x128')]=function(_0x49624e,_0x1ea122){return db['ChatWebsite']['find']({'where':{'id':_0x49624e[_0xb273('0x46')]['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x1ea122,null))[_0xb273('0x13')](function(_0x18708d){if(_0x18708d){return _0x18708d[_0xb273('0x128')](_0x49624e[_0xb273('0x34')][_0xb273('0x5b')])[_0xb273('0x13')](function(){if(_[_0xb273('0x129')](_0x49624e[_0xb273('0x34')][_0xb273('0x5b')])){for(var _0x1cbac5=0x0;_0x1cbac5<_0x49624e[_0xb273('0x34')][_0xb273('0x5b')][_0xb273('0x38')];_0x1cbac5+=0x1){socket[_0xb273('0x126')]('userChatWebsite:remove',{'UserId':Number(_0x49624e[_0xb273('0x34')][_0xb273('0x5b')][_0x1cbac5]),'ChatWebsiteId':Number(_0x49624e[_0xb273('0x46')]['id'])});}}else{socket[_0xb273('0x126')](_0xb273('0x12a'),{'UserId':Number(_0x49624e[_0xb273('0x34')]['ids']),'ChatWebsiteId':Number(_0x49624e['params']['id'])});}});}})[_0xb273('0x13')](respondWithStatusCode(_0x1ea122,null))[_0xb273('0x4c')](handleError(_0x1ea122,null));};exports[_0xb273('0x12b')]=function(_0x567cc0,_0x1334bf){var _0x2ddb8c={};var _0x2d3d7c={};var _0x5f0ec8;var _0x3e0513;return db[_0xb273('0x47')][_0xb273('0x5a')]({'where':{'id':_0x567cc0[_0xb273('0x46')]['id']}})[_0xb273('0x13')](handleEntityNotFound(_0x1334bf,null))[_0xb273('0x13')](function(_0xbacbc6){if(_0xbacbc6){_0x5f0ec8=_0xbacbc6;_0x2d3d7c[_0xb273('0x32')]=_[_0xb273('0x33')](db[_0xb273('0xed')]['rawAttributes']);_0x2d3d7c[_0xb273('0x34')]=_[_0xb273('0x33')](_0x567cc0[_0xb273('0x34')]);_0x2d3d7c[_0xb273('0x35')]=_[_0xb273('0x36')](_0x2d3d7c['model'],_0x2d3d7c['query']);_0x2ddb8c[_0xb273('0x37')]=_['intersection'](_0x2d3d7c['model'],qs[_0xb273('0x49')](_0x567cc0[_0xb273('0x34')][_0xb273('0x49')]));_0x2ddb8c[_0xb273('0x37')]=_0x2ddb8c['attributes'][_0xb273('0x38')]?_0x2ddb8c[_0xb273('0x37')]:_0x2d3d7c['model'];_0x2ddb8c[_0xb273('0x3a')]=qs['sort'](_0x567cc0[_0xb273('0x34')]['sort']);_0x2ddb8c[_0xb273('0x3c')]=qs['filters'](_['pick'](_0x567cc0[_0xb273('0x34')],_0x2d3d7c[_0xb273('0x35')]));if(_0x567cc0[_0xb273('0x34')]['filter']){_0x2ddb8c[_0xb273('0x3c')]=_[_0xb273('0x41')](_0x2ddb8c['where'],{'$or':_[_0xb273('0x30')](_0x2ddb8c['attributes'],function(_0x1582e0){var _0x1d6520={};_0x1d6520[_0x1582e0]={'$like':'%'+_0x567cc0[_0xb273('0x34')][_0xb273('0x40')]+'%'};return _0x1d6520;})});}_0x2ddb8c=_[_0xb273('0x41')]({},_0x2ddb8c,_0x567cc0[_0xb273('0x4b')]);return _0x5f0ec8[_0xb273('0x12b')](_0x2ddb8c);}})['then'](function(_0x2c4eb6){if(_0x2c4eb6){_0x3e0513=_0x2c4eb6[_0xb273('0x38')];if(!_0x567cc0['query'][_0xb273('0x39')](_0xb273('0x5f'))){_0x2ddb8c[_0xb273('0x21')]=qs['limit'](_0x567cc0[_0xb273('0x34')][_0xb273('0x21')]);_0x2ddb8c[_0xb273('0x1f')]=qs['offset'](_0x567cc0[_0xb273('0x34')][_0xb273('0x1f')]);}return _0x5f0ec8[_0xb273('0x12b')](_0x2ddb8c);}})[_0xb273('0x13')](function(_0x1d5814){if(_0x1d5814){return _0x1d5814?{'count':_0x3e0513,'rows':_0x1d5814}:null;}})['then'](respondWithResult(_0x1334bf,null))[_0xb273('0x4c')](handleError(_0x1334bf,null));}; \ No newline at end of file +var _0x426e=['Attachment','MailAccount','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','openNewInteraction','mimetype','mapValues','subjectOffline','Chat','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','utf8','URL','3.1.0','remote','connection','remoteAddress','alignment','verticalAlignment','labelText','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','destroy','bulkCreate','stack','finally','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','false','offlineForm','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','Content-Range','ChatWebsites','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','rows','show','params','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','ChatWebsiteId','Disposition','findOne','options','findAll','removeDispositions','addAnswer','CannedAnswer','hasOwnProperty','include','removeAnswers','ids','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','server/files/images/avatars/system_avatar.png','notify','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','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','CmList','List','Contacts','ChatApplication','account','list','applications','priority','Applications','defaults','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','interaction','spread','contact','messageId','created','autoclose','unmanaged','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','files','attachments','offline-chat','basename','sequelize','transaction'];(function(_0x329d13,_0x1aff27){var _0x33efd9=function(_0x265b7d){while(--_0x265b7d){_0x329d13['push'](_0x329d13['shift']());}};_0x33efd9(++_0x1aff27);}(_0x426e,0x182));var _0xe426=function(_0x404303,_0xcf6dee){_0x404303=_0x404303-0x0;var _0x2bb9e5=_0x426e[_0x404303];return _0x2bb9e5;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xe426('0x0'));var util=require('util');var path=require(_0xe426('0x1'));var ejs=require(_0xe426('0x2'));var fs=require('fs');var fs_extra=require(_0xe426('0x3'));var _=require(_0xe426('0x4'));var querystring=require(_0xe426('0x5'));var Redis=require(_0xe426('0x6'));var qs=require(_0xe426('0x7'));var logger=require(_0xe426('0x8'))(_0xe426('0x9'));var config=require(_0xe426('0xa'));var url=require(_0xe426('0xb'));var db=require(_0xe426('0xc'))['db'];config[_0xe426('0xd')]=_['defaults'](config[_0xe426('0xd')],{'host':_0xe426('0xe'),'port':0x18eb});var socket=require(_0xe426('0xf'))(new Redis(config[_0xe426('0xd')]));require(_0xe426('0x10'))[_0xe426('0x11')](socket);var htmlToText=require(_0xe426('0x12'));var jayson=require(_0xe426('0x13'));var client=jayson[_0xe426('0x14')][_0xe426('0x15')]({'port':0x232c});var client9002=jayson[_0xe426('0x14')][_0xe426('0x15')]({'port':0x232a});var client9003=jayson[_0xe426('0x14')][_0xe426('0x15')]({'port':0x232b});var client9001=jayson[_0xe426('0x14')]['http']({'port':0x2329});function respondWithRpcPromise(_0x5b29a4,_0x13d983,_0x43a4d8,_0x411ea1){return new BPromise(function(_0x4ec2cb,_0x1f23a1){var _0x7a3333=_0x411ea1||client;return _0x7a3333[_0xe426('0x16')](_0x5b29a4,_0x43a4d8)[_0xe426('0x17')](function(_0x1b0567){logger['info'](_0xe426('0x18'),_0x13d983,'request\x20sent');logger[_0xe426('0x19')](_0xe426('0x1a'),_0x13d983,_0xe426('0x1b'),JSON['stringify'](_0x1b0567));if(_0x1b0567[_0xe426('0x1c')]){if(_0x1b0567['error']['code']===0x1f4){logger[_0xe426('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x13d983,_0x1b0567[_0xe426('0x1c')][_0xe426('0x1d')]);return _0x1f23a1(_0x1b0567[_0xe426('0x1c')]['message']);}logger[_0xe426('0x1c')](_0xe426('0x18'),_0x13d983,_0x1b0567['error'][_0xe426('0x1d')]);return _0x4ec2cb(_0x1b0567['error']['message']);}else{logger[_0xe426('0x1e')](_0xe426('0x18'),_0x13d983,'request\x20sent');_0x4ec2cb(_0x1b0567[_0xe426('0x1f')][_0xe426('0x1d')]);}})[_0xe426('0x20')](function(_0x36f2c4){logger[_0xe426('0x1c')](_0xe426('0x18'),_0x13d983,_0x36f2c4);_0x1f23a1(_0x36f2c4);});});}function respondWithStatusCode(_0x37baa0,_0x577504){_0x577504=_0x577504||0xcc;return function(_0xbea2c8){if(_0xbea2c8){return _0x37baa0[_0xe426('0x21')](_0x577504);}return _0x37baa0[_0xe426('0x22')](_0x577504)[_0xe426('0x23')]();};}function respondWithResult(_0x62954e,_0x2e381f){_0x2e381f=_0x2e381f||0xc8;return function(_0x42d06c){if(_0x42d06c){return _0x62954e[_0xe426('0x22')](_0x2e381f)[_0xe426('0x24')](_0x42d06c);}};}function respondWithFilteredResult(_0x20a9cc,_0x1e64a7){return function(_0x101d8c){if(_0x101d8c){var _0x53c4f3=typeof _0x1e64a7[_0xe426('0x25')]===_0xe426('0x26')&&typeof _0x1e64a7['limit']===_0xe426('0x26');var _0xfbbbf3=_0x101d8c[_0xe426('0x27')];var _0x554411=_0x53c4f3?0x0:_0x1e64a7[_0xe426('0x25')];var _0x5ad5ba=_0x53c4f3?_0x101d8c[_0xe426('0x27')]:_0x1e64a7[_0xe426('0x25')]+_0x1e64a7['limit'];var _0xbf028e;if(_0x5ad5ba>=_0xfbbbf3){_0x5ad5ba=_0xfbbbf3;_0xbf028e=0xc8;}else{_0xbf028e=0xce;}_0x20a9cc[_0xe426('0x22')](_0xbf028e);return _0x20a9cc['set'](_0xe426('0x28'),_0x554411+'-'+_0x5ad5ba+'/'+_0xfbbbf3)[_0xe426('0x24')](_0x101d8c);}return null;};}function saveUpdates(_0x1cb9be){return function(_0x5e6cd0){if(_0x5e6cd0){return _0x5e6cd0['update'](_0x1cb9be)[_0xe426('0x17')](function(_0xfcbb07){return _0xfcbb07;});}return null;};}function removeEntity(_0x396bd4){return function(_0x55edb2){if(_0x55edb2){return _0x55edb2['destroy']()['then'](function(){var _0x1c03e5=_0x55edb2['get']({'plain':!![]});var _0x478703=_0xe426('0x29');return db[_0xe426('0x2a')]['destroy']({'where':{'type':_0x478703,'resourceId':_0x1c03e5['id']}})[_0xe426('0x17')](function(){return _0x55edb2;});})[_0xe426('0x17')](function(){_0x396bd4[_0xe426('0x22')](0xcc)[_0xe426('0x23')]();});}};}function handleEntityNotFound(_0x2e504b){return function(_0x21a4cb){if(!_0x21a4cb){_0x2e504b[_0xe426('0x21')](0x194);}return _0x21a4cb;};}function handleError(_0x5106c5,_0xa2cdc1){_0xa2cdc1=_0xa2cdc1||0x1f4;return function(_0x1c177b){logger['error'](_0x1c177b['stack']);if(_0x1c177b[_0xe426('0x2b')]){delete _0x1c177b[_0xe426('0x2b')];}_0x5106c5['status'](_0xa2cdc1)[_0xe426('0x2c')](_0x1c177b);};}exports['index']=function(_0x2d13e5,_0x36a224){var _0x365f72={'include':[{'model':db[_0xe426('0x2d')],'as':_0xe426('0x2e')}]},_0x3cdc10={},_0x5e58ff={'count':0x0,'rows':[]};var _0xa91b0b=_[_0xe426('0x2f')](db[_0xe426('0x30')][_0xe426('0x31')],function(_0x4a261a){return{'name':_0x4a261a['fieldName'],'type':_0x4a261a[_0xe426('0x32')][_0xe426('0x33')]};});_0x3cdc10[_0xe426('0x34')]=_['map'](_0xa91b0b,_0xe426('0x2b'));_0x3cdc10[_0xe426('0x35')]=_[_0xe426('0x36')](_0x2d13e5[_0xe426('0x35')]);_0x3cdc10[_0xe426('0x37')]=_[_0xe426('0x38')](_0x3cdc10[_0xe426('0x34')],_0x3cdc10[_0xe426('0x35')]);_0x365f72[_0xe426('0x39')]=_[_0xe426('0x38')](_0x3cdc10[_0xe426('0x34')],qs[_0xe426('0x3a')](_0x2d13e5[_0xe426('0x35')][_0xe426('0x3a')]));_0x365f72[_0xe426('0x39')]=_0x365f72[_0xe426('0x39')]['length']?_0x365f72[_0xe426('0x39')]:_0x3cdc10[_0xe426('0x34')];if(!_0x2d13e5[_0xe426('0x35')]['hasOwnProperty'](_0xe426('0x3b'))){_0x365f72['limit']=qs[_0xe426('0x3c')](_0x2d13e5[_0xe426('0x35')][_0xe426('0x3c')]);_0x365f72[_0xe426('0x25')]=qs['offset'](_0x2d13e5[_0xe426('0x35')][_0xe426('0x25')]);}_0x365f72[_0xe426('0x3d')]=qs[_0xe426('0x3e')](_0x2d13e5['query'][_0xe426('0x3e')]);_0x365f72['where']=qs[_0xe426('0x37')](_[_0xe426('0x3f')](_0x2d13e5['query'],_0x3cdc10[_0xe426('0x37')]),_0xa91b0b);if(_0x2d13e5[_0xe426('0x35')]['filter']){_0x365f72[_0xe426('0x40')]=_[_0xe426('0x41')](_0x365f72[_0xe426('0x40')],{'$or':_['map'](_0xa91b0b,function(_0x345b8e){if(_0x345b8e[_0xe426('0x32')]!==_0xe426('0x42')){var _0x55936f={};_0x55936f[_0x345b8e[_0xe426('0x2b')]]={'$like':'%'+_0x2d13e5[_0xe426('0x35')][_0xe426('0x43')]+'%'};return _0x55936f;}})});}_0x365f72=_['merge']({},_0x365f72,_0x2d13e5['options']);var _0x5dbaae={'where':_0x365f72[_0xe426('0x40')]};return db[_0xe426('0x30')][_0xe426('0x27')](_0x5dbaae)[_0xe426('0x17')](function(_0x2d4e4c){_0x5e58ff['count']=_0x2d4e4c;if(_0x2d13e5[_0xe426('0x35')][_0xe426('0x44')]){_0x365f72['include']=[{'all':!![]}];}return db[_0xe426('0x30')]['findAll'](_0x365f72);})[_0xe426('0x17')](function(_0x5ad755){_0x5e58ff[_0xe426('0x45')]=_0x5ad755;return _0x5e58ff;})[_0xe426('0x17')](respondWithFilteredResult(_0x36a224,_0x365f72))['catch'](handleError(_0x36a224,null));};exports[_0xe426('0x46')]=function(_0x310500,_0x5d7545){var _0x522872={'raw':![],'where':{'id':_0x310500[_0xe426('0x47')]['id']},'include':[{'model':db[_0xe426('0x2d')],'as':_0xe426('0x2e')}]},_0x53b71a={};_0x53b71a[_0xe426('0x34')]=_[_0xe426('0x36')](db[_0xe426('0x30')][_0xe426('0x31')]);_0x53b71a[_0xe426('0x35')]=_[_0xe426('0x36')](_0x310500[_0xe426('0x35')]);_0x53b71a['filters']=_[_0xe426('0x38')](_0x53b71a[_0xe426('0x34')],_0x53b71a['query']);_0x522872[_0xe426('0x39')]=_[_0xe426('0x38')](_0x53b71a[_0xe426('0x34')],qs[_0xe426('0x3a')](_0x310500['query']['fields']));_0x522872[_0xe426('0x39')]=_0x522872[_0xe426('0x39')][_0xe426('0x48')]?_0x522872[_0xe426('0x39')]:_0x53b71a['model'];if(_0x310500[_0xe426('0x35')][_0xe426('0x44')]){_0x522872['include']=[{'all':!![]}];}_0x522872=_[_0xe426('0x41')]({},_0x522872,_0x310500['options']);return db[_0xe426('0x30')][_0xe426('0x49')](_0x522872)[_0xe426('0x17')](handleEntityNotFound(_0x5d7545,null))['then'](respondWithResult(_0x5d7545,null))['catch'](handleError(_0x5d7545,null));};exports[_0xe426('0x4a')]=function(_0x4ff4a2,_0x528c0d){return db['ChatWebsite']['create'](_0x4ff4a2[_0xe426('0x4b')],{})[_0xe426('0x17')](function(_0x3fccc5){var _0x2aeac2=_0x4ff4a2['user'][_0xe426('0x4c')]({'plain':!![]});if(!_0x2aeac2)throw new Error(_0xe426('0x4d'));if(_0x2aeac2[_0xe426('0x4e')]===_0xe426('0x4f')){var _0x3bf7bb=_0x3fccc5[_0xe426('0x4c')]({'plain':!![]});var _0x110372=_0xe426('0x29');return db[_0xe426('0x50')][_0xe426('0x49')]({'where':{'name':_0x110372,'userProfileId':_0x2aeac2['userProfileId']},'raw':!![]})[_0xe426('0x17')](function(_0x1eea18){if(_0x1eea18&&_0x1eea18[_0xe426('0x51')]===0x0){return db[_0xe426('0x2a')]['create']({'name':_0x3bf7bb[_0xe426('0x2b')],'resourceId':_0x3bf7bb['id'],'type':_0x1eea18[_0xe426('0x2b')],'sectionId':_0x1eea18['id']},{})[_0xe426('0x17')](function(){return _0x3fccc5;});}else{return _0x3fccc5;}})[_0xe426('0x20')](function(_0x3ef90c){logger[_0xe426('0x1c')](_0xe426('0x52'),_0x3ef90c);throw _0x3ef90c;});}return _0x3fccc5;})['then'](respondWithResult(_0x528c0d,0xc9))[_0xe426('0x20')](handleError(_0x528c0d,null));};exports[_0xe426('0x53')]=function(_0x9f5082,_0x2d0205){if(_0x9f5082['body']['id']){delete _0x9f5082[_0xe426('0x4b')]['id'];}return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x9f5082[_0xe426('0x47')]['id']},'include':[{'model':db['Pause'],'as':_0xe426('0x2e')}]})['then'](handleEntityNotFound(_0x2d0205,null))[_0xe426('0x17')](saveUpdates(_0x9f5082['body'],null))[_0xe426('0x17')](respondWithResult(_0x2d0205,null))['catch'](handleError(_0x2d0205,null));};exports['destroy']=function(_0x3c6681,_0x55ddbe){return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x3c6681[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x55ddbe,null))[_0xe426('0x17')](removeEntity(_0x55ddbe,null))[_0xe426('0x20')](handleError(_0x55ddbe,null));};exports[_0xe426('0x54')]=function(_0x4450af,_0x317787){return db[_0xe426('0x30')][_0xe426('0x54')]()['then'](respondWithResult(_0x317787,null))['catch'](handleError(_0x317787,null));};exports['addDisposition']=function(_0x12b481,_0x307ff3){if(_0x12b481['body']['id']){delete _0x12b481[_0xe426('0x4b')]['id'];}return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x12b481[_0xe426('0x47')]['id']}})['then'](handleEntityNotFound(_0x307ff3,null))[_0xe426('0x17')](function(_0x59b68f){if(_0x59b68f){_0x12b481['body'][_0xe426('0x55')]=_0x59b68f['id'];return db[_0xe426('0x56')][_0xe426('0x4a')](_0x12b481[_0xe426('0x4b')]);}})[_0xe426('0x17')](respondWithResult(_0x307ff3,null))[_0xe426('0x20')](handleError(_0x307ff3,null));};exports['getDispositions']=function(_0x472031,_0x2fd67a){var _0x5d28a5={'raw':![],'where':{}};var _0x508fe2={};var _0x29d091={'count':0x0,'rows':[]};return db[_0xe426('0x30')][_0xe426('0x57')]({'where':{'id':_0x472031[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x2fd67a,null))[_0xe426('0x17')](function(_0x152125){if(_0x152125){_0x508fe2[_0xe426('0x34')]=_['keys'](db['Disposition']['rawAttributes']);_0x508fe2[_0xe426('0x35')]=_[_0xe426('0x36')](_0x472031[_0xe426('0x35')]);_0x508fe2[_0xe426('0x37')]=_[_0xe426('0x38')](_0x508fe2[_0xe426('0x34')],_0x508fe2[_0xe426('0x35')]);_0x5d28a5[_0xe426('0x39')]=_[_0xe426('0x38')](_0x508fe2[_0xe426('0x34')],qs[_0xe426('0x3a')](_0x472031[_0xe426('0x35')][_0xe426('0x3a')]));_0x5d28a5['attributes']=_0x5d28a5[_0xe426('0x39')][_0xe426('0x48')]?_0x5d28a5[_0xe426('0x39')]:_0x508fe2[_0xe426('0x34')];if(!_0x472031[_0xe426('0x35')]['hasOwnProperty']('nolimit')){_0x5d28a5[_0xe426('0x3c')]=qs[_0xe426('0x3c')](_0x472031[_0xe426('0x35')]['limit']);_0x5d28a5[_0xe426('0x25')]=qs[_0xe426('0x25')](_0x472031['query'][_0xe426('0x25')]);}_0x5d28a5[_0xe426('0x3d')]=qs[_0xe426('0x3e')](_0x472031[_0xe426('0x35')][_0xe426('0x3e')]);_0x5d28a5[_0xe426('0x40')]=qs['filters'](_[_0xe426('0x3f')](_0x472031[_0xe426('0x35')],_0x508fe2[_0xe426('0x37')]));_0x5d28a5[_0xe426('0x40')][_0xe426('0x55')]=_0x152125['id'];if(_0x472031[_0xe426('0x35')][_0xe426('0x43')]){_0x5d28a5['where']=_['merge'](_0x5d28a5[_0xe426('0x40')],{'$or':_[_0xe426('0x2f')](_0x5d28a5['attributes'],function(_0x59d120){var _0x2384e5={};_0x2384e5[_0x59d120]={'$like':'%'+_0x472031[_0xe426('0x35')][_0xe426('0x43')]+'%'};return _0x2384e5;})});}_0x5d28a5=_[_0xe426('0x41')]({},_0x5d28a5,_0x472031[_0xe426('0x58')]);return db[_0xe426('0x56')][_0xe426('0x27')]({'where':_0x5d28a5[_0xe426('0x40')]})[_0xe426('0x17')](function(_0x136e54){_0x29d091[_0xe426('0x27')]=_0x136e54;if(_0x472031['query']['includeAll']){_0x5d28a5['include']=[{'all':!![]}];}return db[_0xe426('0x56')][_0xe426('0x59')](_0x5d28a5);})['then'](function(_0x16ba01){_0x29d091['rows']=_0x16ba01;return _0x29d091;});}})[_0xe426('0x17')](respondWithFilteredResult(_0x2fd67a,_0x5d28a5))[_0xe426('0x20')](handleError(_0x2fd67a,null));};exports[_0xe426('0x5a')]=function(_0x30d198,_0x918582){return db['ChatWebsite'][_0xe426('0x49')]({'where':{'id':_0x30d198[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x918582,null))[_0xe426('0x17')](function(_0x129898){if(_0x129898){return _0x129898['removeDispositions'](_0x30d198['query']['ids']);}})['then'](respondWithStatusCode(_0x918582,null))[_0xe426('0x20')](handleError(_0x918582,null));};exports[_0xe426('0x5b')]=function(_0x34f09a,_0x2830c2){if(_0x34f09a['body']['id']){delete _0x34f09a[_0xe426('0x4b')]['id'];}return db[_0xe426('0x30')]['find']({'where':{'id':_0x34f09a[_0xe426('0x47')]['id']}})['then'](handleEntityNotFound(_0x2830c2,null))[_0xe426('0x17')](function(_0x1ad8b5){if(_0x1ad8b5){_0x34f09a[_0xe426('0x4b')][_0xe426('0x55')]=_0x1ad8b5['id'];return db[_0xe426('0x5c')][_0xe426('0x4a')](_0x34f09a[_0xe426('0x4b')]);}})[_0xe426('0x17')](respondWithResult(_0x2830c2,null))[_0xe426('0x20')](handleError(_0x2830c2,null));};exports['getAnswers']=function(_0x4992df,_0x184ea6){var _0x3d4ef7={'raw':![],'where':{}};var _0x51f3b1={};var _0x250f78={'count':0x0,'rows':[]};return db[_0xe426('0x30')]['findOne']({'where':{'id':_0x4992df[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x184ea6,null))['then'](function(_0x9eaac2){if(_0x9eaac2){_0x51f3b1[_0xe426('0x34')]=_[_0xe426('0x36')](db[_0xe426('0x5c')][_0xe426('0x31')]);_0x51f3b1[_0xe426('0x35')]=_['keys'](_0x4992df[_0xe426('0x35')]);_0x51f3b1[_0xe426('0x37')]=_[_0xe426('0x38')](_0x51f3b1[_0xe426('0x34')],_0x51f3b1[_0xe426('0x35')]);_0x3d4ef7[_0xe426('0x39')]=_[_0xe426('0x38')](_0x51f3b1[_0xe426('0x34')],qs[_0xe426('0x3a')](_0x4992df[_0xe426('0x35')][_0xe426('0x3a')]));_0x3d4ef7[_0xe426('0x39')]=_0x3d4ef7['attributes'][_0xe426('0x48')]?_0x3d4ef7[_0xe426('0x39')]:_0x51f3b1[_0xe426('0x34')];if(!_0x4992df[_0xe426('0x35')][_0xe426('0x5d')](_0xe426('0x3b'))){_0x3d4ef7[_0xe426('0x3c')]=qs['limit'](_0x4992df['query'][_0xe426('0x3c')]);_0x3d4ef7[_0xe426('0x25')]=qs[_0xe426('0x25')](_0x4992df['query'][_0xe426('0x25')]);}_0x3d4ef7[_0xe426('0x3d')]=qs['sort'](_0x4992df['query'][_0xe426('0x3e')]);_0x3d4ef7['where']=qs[_0xe426('0x37')](_[_0xe426('0x3f')](_0x4992df['query'],_0x51f3b1[_0xe426('0x37')]));_0x3d4ef7['where'][_0xe426('0x55')]=_0x9eaac2['id'];if(_0x4992df[_0xe426('0x35')][_0xe426('0x43')]){_0x3d4ef7[_0xe426('0x40')]=_[_0xe426('0x41')](_0x3d4ef7[_0xe426('0x40')],{'$or':_[_0xe426('0x2f')](_0x3d4ef7['attributes'],function(_0x2309bd){var _0x467759={};_0x467759[_0x2309bd]={'$like':'%'+_0x4992df['query'][_0xe426('0x43')]+'%'};return _0x467759;})});}_0x3d4ef7=_[_0xe426('0x41')]({},_0x3d4ef7,_0x4992df['options']);return db['CannedAnswer'][_0xe426('0x27')]({'where':_0x3d4ef7[_0xe426('0x40')]})['then'](function(_0x2c2651){_0x250f78[_0xe426('0x27')]=_0x2c2651;if(_0x4992df['query'][_0xe426('0x44')]){_0x3d4ef7[_0xe426('0x5e')]=[{'all':!![]}];}return db[_0xe426('0x5c')][_0xe426('0x59')](_0x3d4ef7);})[_0xe426('0x17')](function(_0xb35ff3){_0x250f78[_0xe426('0x45')]=_0xb35ff3;return _0x250f78;});}})['then'](respondWithFilteredResult(_0x184ea6,_0x3d4ef7))[_0xe426('0x20')](handleError(_0x184ea6,null));};exports[_0xe426('0x5f')]=function(_0x215aa4,_0x2d5c89){return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x215aa4['params']['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x2d5c89,null))[_0xe426('0x17')](function(_0x4726d5){if(_0x4726d5){return _0x4726d5[_0xe426('0x5f')](_0x215aa4['query'][_0xe426('0x60')]);}})['then'](respondWithStatusCode(_0x2d5c89,null))[_0xe426('0x20')](handleError(_0x2d5c89,null));};exports['addLogo']=function(_0x357641,_0x2380b8){_0x357641[_0xe426('0x4b')][_0xe426('0x61')]=_0x357641[_0xe426('0x62')][_0xe426('0x63')];return db['ChatWebsite']['find']({'where':{'id':_0x357641[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x2380b8,null))['then'](saveUpdates(_0x357641[_0xe426('0x4b')],null))['then'](respondWithResult(_0x2380b8,null))[_0xe426('0x20')](handleError(_0x2380b8,null));};exports['addAvatar']=function(_0xb3de01,_0x1275da){_0xb3de01[_0xe426('0x4b')][_0xe426('0x64')]=_0xb3de01['file']['filename'];return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0xb3de01[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x1275da,null))[_0xe426('0x17')](saveUpdates(_0xb3de01[_0xe426('0x4b')],null))[_0xe426('0x17')](respondWithResult(_0x1275da,null))[_0xe426('0x20')](handleError(_0x1275da,null));};exports[_0xe426('0x65')]=function(_0x135566,_0x3a89ba){_0x135566[_0xe426('0x4b')][_0xe426('0x66')]=_0x135566[_0xe426('0x62')]['filename'];return db['ChatWebsite'][_0xe426('0x49')]({'where':{'id':_0x135566[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x3a89ba,null))[_0xe426('0x17')](saveUpdates(_0x135566['body'],null))['then'](respondWithResult(_0x3a89ba,null))[_0xe426('0x20')](handleError(_0x3a89ba,null));};exports[_0xe426('0x67')]=function(_0x5d1af1,_0x2a1232){_0x5d1af1[_0xe426('0x4b')][_0xe426('0x68')]=_0x5d1af1[_0xe426('0x62')][_0xe426('0x63')];return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x5d1af1[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x2a1232,null))[_0xe426('0x17')](saveUpdates(_0x5d1af1['body'],null))['then'](respondWithResult(_0x2a1232,null))[_0xe426('0x20')](handleError(_0x2a1232,null));};exports[_0xe426('0x69')]=function(_0x26fc94,_0x4a926a){var _0xe87470=path[_0xe426('0x6a')](config[_0xe426('0x6b')],_0xe426('0x6c'));var _0x128c1e={'where':{'id':_0x26fc94[_0xe426('0x47')]['id']},'attributes':['id',_0xe426('0x61')],'raw':!![]};var _0x316cfa=![];return require('../../config/license/util')[_0xe426('0x6d')]()[_0xe426('0x17')](function(_0x369a0a){if(_0x369a0a){_0x316cfa=_0x369a0a[_0xe426('0x6e')];}})[_0xe426('0x17')](function(){return db['ChatWebsite'][_0xe426('0x49')](_0x128c1e);})[_0xe426('0x17')](handleEntityNotFound(_0x4a926a,null))[_0xe426('0x17')](function(_0x5aa974){if(_0x5aa974){if(!_[_0xe426('0x6f')](_0x5aa974[_0xe426('0x61')])){if(fs[_0xe426('0x70')](path[_0xe426('0x6a')](config['root'],_0xe426('0x71'),_0x5aa974[_0xe426('0x61')]))&&_0x316cfa){_0xe87470=path[_0xe426('0x6a')](config[_0xe426('0x6b')],_0xe426('0x71'),_0x5aa974[_0xe426('0x61')]);}}return _0x4a926a[_0xe426('0x72')](_0xe87470);}})[_0xe426('0x20')](handleError(_0x4a926a,null));};exports['getAvatar']=function(_0x3a2792,_0x1c96f7){var _0x18a3de=path['join'](config[_0xe426('0x6b')],_0xe426('0x73'));var _0x476fba={'where':{'id':_0x3a2792[_0xe426('0x47')]['id']},'attributes':['id',_0xe426('0x64')],'raw':!![]};return db[_0xe426('0x30')][_0xe426('0x49')](_0x476fba)[_0xe426('0x17')](handleEntityNotFound(_0x1c96f7,null))[_0xe426('0x17')](function(_0x42ccd4){if(_0x42ccd4){if(!_['isNil'](_0x42ccd4[_0xe426('0x64')])){if(fs['existsSync'](path[_0xe426('0x6a')](config['root'],_0xe426('0x74'),_0x42ccd4[_0xe426('0x64')]))){_0x18a3de=path[_0xe426('0x6a')](config[_0xe426('0x6b')],_0xe426('0x74'),_0x42ccd4['agentAvatar']);}}return _0x1c96f7[_0xe426('0x72')](_0x18a3de);}})['catch'](handleError(_0x1c96f7,null));};exports[_0xe426('0x75')]=function(_0x2b56da,_0x401297){var _0x26c954=path['join'](config['root'],_0xe426('0x76'));var _0x584dac={'where':{'id':_0x2b56da[_0xe426('0x47')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0xe426('0x30')][_0xe426('0x49')](_0x584dac)['then'](handleEntityNotFound(_0x401297,null))[_0xe426('0x17')](function(_0x5d1756){if(_0x5d1756){if(!_[_0xe426('0x6f')](_0x5d1756[_0xe426('0x66')])){if(fs[_0xe426('0x70')](path[_0xe426('0x6a')](config['root'],'server/files/images/avatars/',_0x5d1756['customerAvatar']))&&_0x5d1756['showCustomerAvatar']){_0x26c954=path[_0xe426('0x6a')](config[_0xe426('0x6b')],_0xe426('0x74'),_0x5d1756[_0xe426('0x66')]);}}return _0x401297['download'](_0x26c954);}})[_0xe426('0x20')](handleError(_0x401297,null));};exports['getSystemAvatar']=function(_0x55afad,_0x27ed74){var _0x3b8560=path['join'](config[_0xe426('0x6b')],_0xe426('0x77'));var _0x239eca={'where':{'id':_0x55afad[_0xe426('0x47')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0xe426('0x49')](_0x239eca)[_0xe426('0x17')](handleEntityNotFound(_0x27ed74,null))['then'](function(_0x421f7c){if(_0x421f7c){if(!_[_0xe426('0x6f')](_0x421f7c[_0xe426('0x68')])){if(fs[_0xe426('0x70')](path['join'](config[_0xe426('0x6b')],_0xe426('0x74'),_0x421f7c['systemAvatar']))){_0x3b8560=path['join'](config['root'],'server/files/images/avatars/',_0x421f7c[_0xe426('0x68')]);}}return _0x27ed74[_0xe426('0x72')](_0x3b8560);}})['catch'](handleError(_0x27ed74,null));};exports[_0xe426('0x78')]=function(_0x922e28,_0x30d0c7){var _0x324bc9=require('user-agent-parser');var _0x4ea2fd=new _0x324bc9();var _0x181e45=_0x4ea2fd['setUA'](_0x922e28[_0xe426('0x79')][_0xe426('0x7a')])[_0xe426('0x7b')]();var _0x751919={'body':_0x922e28['body'],'channel':_0xe426('0x7c')};var _0x25b1a5=[];var _0x3e64da=[];var _0x5de36a={};var _0x5618ec=![];return db[_0xe426('0x7d')][_0xe426('0x54')]()['then'](function(_0x2798a2){if(!_0x2798a2){throw new db[(_0xe426('0x7e'))][(_0xe426('0x7f'))](_0xe426('0x80'));}_0x25b1a5=_[_0xe426('0x81')](_[_0xe426('0x36')](_0x2798a2),[_0xe426('0x82'),'updatedAt']);_0x3e64da=_[_0xe426('0x81')](_[_0xe426('0x36')](_0x2798a2),[_0xe426('0x82'),_0xe426('0x83'),_0xe426('0x84'),_0xe426('0x85')]);if(_0x922e28[_0xe426('0x4b')]['id']){delete _0x922e28[_0xe426('0x4b')]['id'];}if(_[_0xe426('0x6f')](_0x922e28['body'][_0xe426('0x86')])){throw new db[(_0xe426('0x7e'))]['ValidationError'](_0xe426('0x87'));}if(_[_0xe426('0x6f')](_0x922e28[_0xe426('0x4b')][_0xe426('0x4b')])||_0x922e28[_0xe426('0x4b')][_0xe426('0x4b')]===''){throw new db[(_0xe426('0x7e'))][(_0xe426('0x7f'))](_0xe426('0x88'));}if(_[_0xe426('0x6f')](_0x922e28[_0xe426('0x4b')][_0xe426('0x89')])){throw new db[(_0xe426('0x7e'))]['ValidationError'](_0xe426('0x8a')+_0x3e64da);}if(!_[_0xe426('0x8b')](_0x3e64da,_0x922e28[_0xe426('0x4b')][_0xe426('0x89')])){throw new db[(_0xe426('0x7e'))][(_0xe426('0x7f'))](_0xe426('0x8c')+_0x3e64da);}_0x5de36a[_0x922e28[_0xe426('0x4b')][_0xe426('0x89')]]=_0x922e28[_0xe426('0x4b')]['from'];})[_0xe426('0x17')](function(){return db['ChatWebsite'][_0xe426('0x49')]({'where':{'id':_0x922e28[_0xe426('0x47')]['id']},'include':[{'model':db[_0xe426('0x8d')],'as':_0xe426('0x8e'),'include':[{'model':db[_0xe426('0x7d')],'as':_0xe426('0x8f'),'where':_0x5de36a,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xe426('0x90')],'as':'Applications'}]});})[_0xe426('0x17')](handleEntityNotFound(_0x30d0c7,null))['then'](function(_0x32eaae){if(_0x32eaae&&_0x32eaae['List']){_0x751919[_0xe426('0x91')]=_0x32eaae;_0x751919['applications']=_0x32eaae['Applications'];_0x751919[_0xe426('0x92')]=_0x32eaae[_0xe426('0x8e')];_0x751919[_0xe426('0x93')]=_['orderBy'](_0x751919[_0xe426('0x93')],[_0xe426('0x94')],['asc']);if(_0x751919[_0xe426('0x91')]['Applications']){delete _0x751919[_0xe426('0x91')][_0xe426('0x95')];}if(_0x751919[_0xe426('0x91')][_0xe426('0x8e')]&&_0x751919[_0xe426('0x91')][_0xe426('0x8e')]['Contacts']['length']){return _0x751919[_0xe426('0x91')][_0xe426('0x8e')][_0xe426('0x8f')][0x0];}var _0x43cfad=_[_0xe426('0x96')](_0x922e28[_0xe426('0x4b')],{'firstName':_0x922e28[_0xe426('0x4b')][_0xe426('0x86')],'ListId':_0x32eaae[_0xe426('0x85')]});_0x43cfad[_0x922e28[_0xe426('0x4b')]['mapKey']]=_0x922e28[_0xe426('0x4b')][_0xe426('0x86')];return db['CmContact'][_0xe426('0x4a')](_0x43cfad,{'fields':_0x25b1a5,'raw':!![]});}})['then'](handleEntityNotFound(_0x30d0c7,null))[_0xe426('0x17')](function(_0x59e2b3){_0x751919['contact']=_0x59e2b3;var _0x4047f9=_0x922e28[_0xe426('0x4b')][_0xe426('0x97')];if(_0x922e28[_0xe426('0x79')][_0xe426('0x98')]){_0x4047f9=_0x922e28[_0xe426('0x79')][_0xe426('0x98')];}else if(_0x922e28['headers'][_0xe426('0x99')]){_0x4047f9=_[_0xe426('0x9a')](_0x922e28[_0xe426('0x79')][_0xe426('0x99')][_0xe426('0x9b')](','));}if(_0x59e2b3){var _0x1688df={'ContactId':_0x59e2b3['id'],'ChatWebsiteId':_0x922e28[_0xe426('0x47')]['id'],'from':(_0x59e2b3[_0xe426('0x9c')]||'')+'\x20'+(_0x59e2b3[_0xe426('0x9d')]||''),'customerIp':_0x4047f9,'customerPort':_0x922e28[_0xe426('0x79')][_0xe426('0x9e')]?_0x922e28['headers']['x-real-port']:null,'referer':_0x922e28[_0xe426('0x4b')][_0xe426('0x9f')],'browserName':_0x181e45[_0xe426('0xa0')][_0xe426('0x2b')]&&_0x181e45['browser'][_0xe426('0xa1')]?util['format'](_0xe426('0xa2'),_0x181e45[_0xe426('0xa0')][_0xe426('0x2b')],_0x181e45[_0xe426('0xa0')][_0xe426('0xa1')]):_0xe426('0xa3'),'browserVersion':_0x181e45[_0xe426('0xa0')][_0xe426('0xa1')]||_0xe426('0xa3'),'osName':util[_0xe426('0xa4')](_0xe426('0xa2'),_0x181e45['os'][_0xe426('0x2b')],_0x181e45['os'][_0xe426('0xa1')]),'osVersion':_0x181e45['os'][_0xe426('0xa1')],'deviceModel':_0x181e45[_0xe426('0xa5')][_0xe426('0x34')]&&_0x181e45[_0xe426('0xa5')][_0xe426('0xa6')]?util[_0xe426('0xa4')](_0xe426('0xa7'),_0x181e45[_0xe426('0xa5')][_0xe426('0x34')],_0x181e45[_0xe426('0xa5')][_0xe426('0xa6')],_0x181e45['device'][_0xe426('0x32')]):null,'deviceVendor':_0x181e45[_0xe426('0xa5')][_0xe426('0xa6')],'deviceType':_0x181e45[_0xe426('0xa5')]['type'],'formData':JSON[_0xe426('0xa8')](_0x922e28[_0xe426('0x4b')])};var _0x5669e1={'ChatWebsiteId':_0x922e28[_0xe426('0x47')]['id'],'closed':![]};if(_0x922e28['body'][_0xe426('0xa9')]){_0x5669e1[_0xe426('0xa9')]=_0x922e28['body']['threadId'];return db[_0xe426('0xaa')][_0xe426('0x49')]({'where':_0x5669e1})[_0xe426('0x17')](function(_0x3856d4){if(_0x3856d4){return[_0x3856d4,![]];}_0x1688df[_0xe426('0xa9')]=_0x922e28[_0xe426('0x4b')][_0xe426('0xa9')];_0x1688df[_0xe426('0xab')]=_0x922e28[_0xe426('0x4b')][_0xe426('0xab')];return db[_0xe426('0xaa')][_0xe426('0x4a')](_0x1688df)[_0xe426('0x17')](function(_0x370235){return[_0x370235,!![]];});});}_0x5669e1['ContactId']=_0x59e2b3['id'];if(_0x922e28[_0xe426('0x4b')]['interaction']&&_0x922e28[_0xe426('0x4b')][_0xe426('0xac')]['id']){_0x5669e1['id']=_0x922e28[_0xe426('0x4b')][_0xe426('0xac')]['id'];return db[_0xe426('0xaa')][_0xe426('0x49')]({'where':_0x5669e1})[_0xe426('0x17')](function(_0x44668d){if(_0x44668d){return[_0x44668d,![]];}return db[_0xe426('0xaa')][_0xe426('0x4a')](_0x1688df)[_0xe426('0x17')](function(_0x3bfa0){return[_0x3bfa0,!![]];});});}return db[_0xe426('0xaa')][_0xe426('0x4a')](_0x1688df)['then'](function(_0x4f3011){return[_0x4f3011,!![]];});}})[_0xe426('0xad')](function(_0x1b8726,_0x2f2192){if(_0x1b8726){_0x5618ec=_0x2f2192;if(!_0x2f2192){var _0xf8d0cd={'from':(_0x751919[_0xe426('0xae')][_0xe426('0x9c')]||'')+'\x20'+(_0x751919['contact']['lastName']||'')};if(_0x922e28['body'][_0xe426('0xa9')]&&_0x922e28[_0xe426('0x4b')][_0xe426('0xaf')]&&_0x922e28['body'][_0xe426('0xa9')]!=_0x922e28['body'][_0xe426('0xaf')]){_0xf8d0cd[_0xe426('0xa9')]=_0x922e28[_0xe426('0x4b')]['messageId'];}return _0x1b8726['update'](_0xf8d0cd);}else{return _0x1b8726;}}})[_0xe426('0x17')](function(_0x2d7ac6){_0x751919['interaction']=_0x2d7ac6[_0xe426('0x4c')]({'plain':!![]});_0x751919[_0xe426('0xac')][_0xe426('0xb0')]=_0x5618ec;if(_0x751919[_0xe426('0xac')][_0xe426('0xb0')]){if(_0x751919[_0xe426('0x91')][_0xe426('0xb1')]){_0x751919[_0xe426('0x93')]['push']({'id':0x0,'priority':_0x751919['applications'][_0xe426('0x48')]+0x1,'app':'close','appdata':_0xe426('0xb2'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x922e28[_0xe426('0x4b')][_0xe426('0x4b')],'ChatWebsiteId':_0x922e28[_0xe426('0x47')]['id'],'ChatInteractionId':_0x2d7ac6['id'],'direction':'in','ContactId':_0x751919['contact']['id'],'AttachmentId':_0x922e28[_0xe426('0x4b')][_0xe426('0xb3')]});})[_0xe426('0x17')](function(_0x4ebe54){_0x751919['message']=_0x4ebe54;if(_0x751919[_0xe426('0xac')][_0xe426('0xb4')]){return db[_0xe426('0xb5')][_0xe426('0x49')]({'attributes':['id',_0xe426('0x2b')],'where':{'id':_0x751919['interaction'][_0xe426('0xb4')]}})[_0xe426('0x17')](function(_0x4d0cc4){if(_0x4d0cc4){_0x751919[_0xe426('0x93')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe426('0xb6'),'appdata':_0x4d0cc4[_0xe426('0x2b')]+','+(_0x751919[_0xe426('0x91')][_0xe426('0xb7')]||0xa),'interval':'*,*,*,*'});_0x751919[_0xe426('0xb8')]=!![];}return respondWithRpcPromise(_0xe426('0xb9'),_0xe426('0xba'),_0x751919);});}return respondWithRpcPromise('Start',_0xe426('0xba'),_0x751919);})[_0xe426('0x17')](function(_0x232c32){respondWithRpcPromise('EventManager',_0xe426('0xbb'),{'event':_0xe426('0x78'),'message':_0x232c32},client9002);return _0x232c32;})[_0xe426('0x17')](respondWithResult(_0x30d0c7,null))[_0xe426('0x20')](handleError(_0x30d0c7,null));};exports[_0xe426('0xbc')]=function(_0x48af6c,_0x2bb0c1){var _0x1f769e,_0xc28a0c,_0x24cf7f;var _0x2d00a6=[];var _0x7e1f28={};var _0xc8340=_0x48af6c['files']||[];var _0x43b14a=[];var _0x3602df;return db[_0xe426('0x7d')][_0xe426('0x54')]()['then'](function(_0x1a9c3d){if(!_0x1a9c3d){throw new db['Sequelize'][(_0xe426('0x7f'))](_0xe426('0x80'));}_0x2d00a6=_[_0xe426('0x81')](_[_0xe426('0x36')](_0x1a9c3d),[_0xe426('0x82'),_0xe426('0x83'),_0xe426('0x84'),_0xe426('0x85')]);if(_0x48af6c[_0xe426('0x4b')]['id']){delete _0x48af6c['body']['id'];}if(_[_0xe426('0x6f')](_0x48af6c['body']['from'])){throw _0x2bb0c1['status'](0x1f4)[_0xe426('0x2c')](new db[(_0xe426('0x7e'))][(_0xe426('0x7f'))](_0xe426('0x87')));}if(_['isNil'](_0x48af6c['body'][_0xe426('0x4b')])||_0x48af6c[_0xe426('0x4b')][_0xe426('0x4b')]===''){throw _0x2bb0c1[_0xe426('0x22')](0x1f4)[_0xe426('0x2c')](new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xe426('0x6f')](_0x48af6c[_0xe426('0x4b')][_0xe426('0xbd')])){throw _0x2bb0c1[_0xe426('0x22')](0x1f4)[_0xe426('0x2c')](new db['Sequelize']['ValidationError'](_0xe426('0xbe')+_0x2d00a6));}if(!_[_0xe426('0x8b')](_0x2d00a6,_0x48af6c[_0xe426('0x4b')]['mapKeyOffline'])){throw _0x2bb0c1['status'](0x1f4)['send'](new db[(_0xe426('0x7e'))][(_0xe426('0x7f'))](_0xe426('0xbf')+_0x2d00a6));}_0x7e1f28[_0x48af6c[_0xe426('0x4b')][_0xe426('0xbd')]]=_0x48af6c[_0xe426('0x4b')][_0xe426('0x86')];})[_0xe426('0x17')](function(){return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x48af6c[_0xe426('0x47')]['id']},'include':[{'model':db[_0xe426('0x8d')],'as':'List'},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0xe426('0x17')](handleEntityNotFound(_0x2bb0c1,null))[_0xe426('0x17')](function(_0x17864b){if(_0x17864b&&_0x17864b[_0xe426('0x8e')]){_0xc28a0c=_0x17864b;var _0x1fe58a=_['defaults'](_0x48af6c[_0xe426('0x4b')],{'firstName':_0x48af6c['body'][_0xe426('0x86')],'phone':_0x48af6c[_0xe426('0x4b')]['from'],'ListId':_0x17864b[_0xe426('0x85')]});_0x1fe58a[_0x48af6c[_0xe426('0x4b')][_0xe426('0xbd')]]=_0x48af6c[_0xe426('0x4b')][_0xe426('0x86')];return db[_0xe426('0x7d')][_0xe426('0xc0')]({'where':_0x7e1f28,'defaults':_0x1fe58a});}})[_0xe426('0xad')](function(_0x2664fb){if(_0x2664fb){_0x24cf7f=_0x2664fb;var _0x413672=fs[_0xe426('0xc1')](path[_0xe426('0x6a')](config['root'],_0xe426('0xc2')),'utf8');var _0x44216d=ejs[_0xe426('0xc3')](_0x413672,{'body':_[_0xe426('0xc4')](_0x48af6c[_0xe426('0x4b')][_0xe426('0x4b')]),'bodyTitle':_0xc28a0c[_0xe426('0xc5')]});return db[_0xe426('0xc6')][_0xe426('0x4a')]({'body':_0x44216d,'plainBody':htmlToText[_0xe426('0xc7')](_0x44216d),'ContactId':_0x2664fb['id'],'ChatWebsiteId':_0xc28a0c['id']});}})[_0xe426('0x17')](function(_0x229824){_0x3602df=_0x229824;if(_0xc8340[_0xe426('0x48')]){var _0x2db419=_0xc8340[_0xe426('0x2f')](function(_0x1baac3){return{'name':_0x1baac3['originalname'],'basename':_0x1baac3[_0xe426('0x63')],'type':_0x1baac3['mimetype'],'ChatOfflineMessageId':_0x229824['id']};});_0x43b14a=_0x2db419[_0xe426('0x2f')](_0x2dbcb2=>{var _0x4b6ed6={'filename':_0x2dbcb2[_0xe426('0x2b')],'path':path[_0xe426('0x6a')](config[_0xe426('0x6b')],'server',_0xe426('0xc8'),_0xe426('0xc9'),_0xe426('0xca'),_0x2dbcb2[_0xe426('0xcb')])};return _0x4b6ed6;});if(!_0xc28a0c['openNewInteraction']){return db[_0xe426('0xcc')][_0xe426('0xcd')](function(_0xb8484a){return db[_0xe426('0xce')]['bulkCreate'](_0x2db419,{'transaction':_0xb8484a});});}}})[_0xe426('0x17')](function(){if(_0x3602df){_0x1f769e=_0x3602df;return db[_0xe426('0xcf')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xe426('0xd0')],'as':_0xe426('0xd1'),'raw':!![],'include':[{'model':db[_0xe426('0xd2')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xe426('0x17')](function(_0x3e35f9){if(_0x3e35f9&&_0x3e35f9[_0xe426('0xd1')]&&_0xc28a0c[_0xe426('0xd3')]&&_0xc28a0c[_0xe426('0xd4')]){var _0x2de72a=_0x3e35f9[_0xe426('0xd5')]();return respondWithRpcPromise('SendMail',_0xe426('0xd6'),{'account':_0x2de72a,'message':{'from':util[_0xe426('0xa4')](_0xe426('0xd7'),_0x3e35f9['name'],_0x3e35f9[_0xe426('0xd8')]||_0x3e35f9[_0xe426('0xd1')][_0xe426('0x4f')]),'to':_0xc28a0c[_0xe426('0xd4')],'subject':_0xc28a0c['offlineMessageSubject'],'html':_0x1f769e[_0xe426('0x4b')],'attachments':_0x43b14a}},client9003)[_0xe426('0x17')](function(){return _0x1f769e;})[_0xe426('0x20')](function(_0x2dda46){logger[_0xe426('0x1c')](_0x2dda46);});}})[_0xe426('0x17')](function(){if(_0xc28a0c&&_0xc28a0c[_0xe426('0xd9')]&&_0xc28a0c['MailAccountId']){var _0xeddf87=[];if(_0xc8340['length']){_0xeddf87=_0xc8340[_0xe426('0x2f')](function(_0x2ca6b1){return{'name':_0x2ca6b1['originalname'],'basename':_0x2ca6b1[_0xe426('0x63')],'type':_0x2ca6b1[_0xe426('0xda')],'ChatOfflineMessageId':_0x3602df['id']};});}var _0x290f15;if(!_[_0xe426('0x6f')](_0xc28a0c['subjectOffline'])){var _0x36c49e=_['map'](_0x48af6c[_0xe426('0x4b')],function(_0x2b268d){return _0x2b268d;});var _0x1f3d74=_['toPairsIn'](_0x36c49e)[0x0];var _0x1a245e=_[_0xe426('0xdb')](_0x1f3d74,function(_0x27a73f){return _0x27a73f;});_0x290f15=_0x1a245e[0x1][_0xc28a0c[_0xe426('0xdc')]];}var _0x4256ef={'from':_0x24cf7f[_0xe426('0xd8')],'firstName':_0x24cf7f[_0xe426('0x9c')],'lastName':_0x24cf7f[_0xe426('0x9d')],'mapKey':'email','message':{'from':_0x24cf7f[_0xe426('0xd8')],'to':_0xc28a0c[_0xe426('0xcf')][_0xe426('0xd8')],'cc':'','subject':_['isNil'](_0x290f15)?_0xc28a0c['offlineMessageSubject']:_0x290f15,'messageId':'','sentAt':new Date(),'attach':_0xeddf87[_0xe426('0x48')],'attachments':_0xeddf87,'originChannel':_0xe426('0xdd'),'ChatWebsiteId':_0xc28a0c['id'],'ChatOfflineMessageId':_0x1f769e['id'],'originTo':_0xc28a0c['MailAccount']['email']},'body':_0x1f769e[_0xe426('0x4b')]};var _0x373bd0={'account':{'id':_0xc28a0c['MailAccountId']},'body':_0x4256ef,'log':_0xe426('0xde')};return respondWithRpcPromise('NotifyMailAccount',_0xe426('0xdf'),_0x373bd0,client9001)[_0xe426('0x17')](function(){return _0x1f769e;})[_0xe426('0x20')](function(_0x582450){logger[_0xe426('0x1c')](_0x582450);});}return;})['then'](function(){if(_0x1f769e){return _0x1f769e;}})[_0xe426('0x17')](respondWithResult(_0x2bb0c1,null))[_0xe426('0x20')](function(_0xe9c092){logger[_0xe426('0x1c')](_0xe426('0x20'),_0xe9c092);for(var _0x5edb84 of _0xc8340){var _0x36d29c=path[_0xe426('0x6a')](config['root'],_0xe426('0xe0'),_0xe426('0xc8'),_0xe426('0xc9'),_0xe426('0xca'),_0x5edb84[_0xe426('0x63')]);fs_extra[_0xe426('0xe1')](_0x36d29c)['catch'](function(_0x2c02e0){logger[_0xe426('0x1c')](_0xe426('0xe2'),_0x36d29c,_0x2c02e0);});}});};exports['addInteraction']=function(_0x3d9931,_0x1479e2){return db[_0xe426('0xaa')]['find']({'where':{'id':_0x3d9931[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x1479e2,null))['then'](function(_0x47c191){if(_0x47c191){return _0x47c191[_0xe426('0xe3')](_0x3d9931[_0xe426('0x4b')]['ids'],_['omit'](_0x3d9931[_0xe426('0x4b')],[_0xe426('0x60'),'id'])||{});}})[_0xe426('0x17')](respondWithResult(_0x1479e2,null))[_0xe426('0x20')](handleError(_0x1479e2,null));};exports[_0xe426('0xe4')]=function(_0x4e204a,_0x140867){var _0x1ee551={'raw':![],'where':{}};var _0x3e3118={};var _0x11a219={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe426('0x57')]({'where':{'id':_0x4e204a[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x140867,null))[_0xe426('0x17')](function(_0x30bce2){if(_0x30bce2){_0x3e3118['model']=_[_0xe426('0x36')](db[_0xe426('0xaa')]['rawAttributes']);_0x3e3118[_0xe426('0x35')]=_[_0xe426('0x36')](_0x4e204a[_0xe426('0x35')]);_0x3e3118['filters']=_['intersection'](_0x3e3118[_0xe426('0x34')],_0x3e3118['query']);_0x1ee551[_0xe426('0x39')]=_['intersection'](_0x3e3118[_0xe426('0x34')],qs[_0xe426('0x3a')](_0x4e204a[_0xe426('0x35')][_0xe426('0x3a')]));_0x1ee551[_0xe426('0x39')]=_0x1ee551[_0xe426('0x39')]['length']?_0x1ee551[_0xe426('0x39')]:_0x3e3118[_0xe426('0x34')];if(!_0x4e204a[_0xe426('0x35')]['hasOwnProperty'](_0xe426('0x3b'))){_0x1ee551['limit']=qs[_0xe426('0x3c')](_0x4e204a[_0xe426('0x35')][_0xe426('0x3c')]);_0x1ee551['offset']=qs[_0xe426('0x25')](_0x4e204a[_0xe426('0x35')]['offset']);}_0x1ee551[_0xe426('0x3d')]=qs[_0xe426('0x3e')](_0x4e204a[_0xe426('0x35')][_0xe426('0x3e')]);_0x1ee551[_0xe426('0x40')]=qs[_0xe426('0x37')](_['pick'](_0x4e204a['query'],_0x3e3118[_0xe426('0x37')]));_0x1ee551[_0xe426('0x40')][_0xe426('0x55')]=_0x30bce2['id'];if(_0x4e204a[_0xe426('0x35')][_0xe426('0x43')]){_0x1ee551['where']=_[_0xe426('0x41')](_0x1ee551[_0xe426('0x40')],{'$or':_['map'](_0x1ee551[_0xe426('0x39')],function(_0x197e70){var _0xb04408={};_0xb04408[_0x197e70]={'$like':'%'+_0x4e204a[_0xe426('0x35')][_0xe426('0x43')]+'%'};return _0xb04408;})});}_0x1ee551=_[_0xe426('0x41')]({},_0x1ee551,_0x4e204a[_0xe426('0x58')]);return db[_0xe426('0xaa')]['count']({'where':_0x1ee551[_0xe426('0x40')]})['then'](function(_0x1e9202){_0x11a219['count']=_0x1e9202;if(_0x4e204a[_0xe426('0x35')][_0xe426('0x44')]){_0x1ee551['include']=[{'model':db[_0xe426('0x7d')],'as':_0xe426('0xe5'),'required':![]},{'model':db['User'],'as':_0xe426('0xe6'),'attributes':[_0xe426('0x2b'),_0xe426('0xe7'),_0xe426('0xe8')],'required':![]},{'model':db[_0xe426('0xe9')],'as':_0xe426('0xea'),'attributes':['id',_0xe426('0x2b'),_0xe426('0xeb')],'where':_0x4e204a[_0xe426('0x35')][_0xe426('0xec')]?{'id':_0x4e204a[_0xe426('0x35')]['tag']}:undefined,'required':_0x4e204a[_0xe426('0x35')][_0xe426('0xec')]?!![]:![]}];}return db[_0xe426('0xaa')]['findAll'](_0x1ee551);})['then'](function(_0x26fa7d){_0x11a219[_0xe426('0x45')]=_0x26fa7d;return _0x11a219;});}})[_0xe426('0x17')](respondWithFilteredResult(_0x140867,_0x1ee551))['catch'](handleError(_0x140867,null));};function iftimePromise(_0xe55103,_0x5639b9){return respondWithRpcPromise(_0xe426('0xed'),'getSnippet',{'command':_0x5639b9[_0xe426('0xee')]?util['format'](_0xe426('0xef'),_0xe55103[_0xe426('0xf0')],_0x5639b9['timezone']):util[_0xe426('0xa4')](_0xe426('0xf1'),_0xe55103[_0xe426('0xf0')])},client9002)[_0xe426('0x17')](function(_0x5f0496){var _0x53be1d=_0x5f0496&&_0x5f0496[_0xe426('0xf2')](_0xe426('0xf3'))>=0x0?!![]:![];logger[_0xe426('0x1e')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5639b9['id'],_0xe55103['id'],_0xe55103[_0xe426('0xf0')],_0x53be1d?_0xe426('0xf4'):_0xe426('0xf5'),_0x5639b9[_0xe426('0xee')]?_0x5639b9[_0xe426('0xee')]:_0xe426('0xf6'));return _0x53be1d;})[_0xe426('0x20')](function(_0x5378ab){logger[_0xe426('0x1c')](_0xe426('0xf7'),_0x5639b9['id'],_0xe55103['id'],_0xe55103['interval'],util[_0xe426('0xf8')](_0x5378ab,{'showHidden':![],'depth':null}),_0x5639b9[_0xe426('0xee')]?_0x5639b9['timezone']:_0xe426('0xf6'));return![];});}exports['getSnippet']=function(_0x1cd7fa,_0xb91145){var _0x26a003=0x0;var _0x4a2f59=0x0;var _0x342ac4=![];var _0x17ac63;var _0x5b6cff;return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x1cd7fa['params']['id']},'include':[{'model':db[_0xe426('0xf9')],'as':_0xe426('0xf9'),'include':[{'model':db[_0xe426('0xf9')],'as':_0xe426('0xfa'),'attributes':['id',_0xe426('0xf0')],'raw':!![]}]}]})[_0xe426('0x17')](handleEntityNotFound(_0xb91145,null))[_0xe426('0x17')](function(_0x4f4dcd){if(_0x4f4dcd){_0x17ac63=_0x4f4dcd;return _0x4f4dcd[_0xe426('0xfb')]({'raw':!![]});}})[_0xe426('0x17')](function(_0x4a7a88){if(_0x17ac63){if(_0x4a7a88){_0x5b6cff=_0x4a7a88;}}return require('../../config/license/util')[_0xe426('0x6d')]();})['then'](function(_0x7b96d0){if(_0x7b96d0){_0x4a2f59=_0x7b96d0[_0xe426('0xfc')];_0x342ac4=_0x7b96d0['custom'];}})['then'](function(){return db[_0xe426('0xaa')][_0xe426('0x27')]({'where':{'closed':![]}});})[_0xe426('0x17')](function(_0x44f0c1){_0x26a003=_0x44f0c1;if(_0x4a2f59&&_0x44f0c1>_0x4a2f59){return db[_0xe426('0xfd')][_0xe426('0x57')]({'where':{'id':0x1}})['then'](function(_0x3a9eec){if(_0x3a9eec){_0x3a9eec[_0xe426('0xfe')](_0xe426('0xff'));}});}})[_0xe426('0x17')](function(){if(_0x17ac63[_0xe426('0xf9')]&&_0x17ac63[_0xe426('0xf9')]['Intervals']){var _0x3cfaf4=[];for(var _0x37f73f=0x0;_0x37f73f<_0x17ac63[_0xe426('0xf9')][_0xe426('0xfa')]['length'];_0x37f73f++){var _0x1d8649=_0x17ac63['Interval'][_0xe426('0xfa')][_0x37f73f]['get']({'plain':!![]});_0x3cfaf4['push'](iftimePromise(_0x1d8649,_0x17ac63));}return BPromise[_0xe426('0x100')](_0x3cfaf4)['then'](function(_0x2228cf){return _[_0xe426('0x101')](_0x2228cf);});}else{return!![];}})[_0xe426('0x17')](function(_0x4c029d){var _0x192f79=fs[_0xe426('0xc1')](path[_0xe426('0x6a')](config[_0xe426('0x6b')],_0xe426('0x102')),_0xe426('0x103'));var _0x26a96a=new url[(_0xe426('0x104'))](_0x17ac63['address'])['origin'];var _0xe7579e=_0xe426('0x105');var _0x4840f7=![];var _0x2a02f4={'chatVersion':_0xe7579e,'chatWebsiteAddressOrigin':_0x26a96a,'remote':_0x17ac63[_0xe426('0x106')],'query':querystring['stringify'](_['merge'](_0x17ac63[_0xe426('0x4c')]({'plain':!![]}),{'customerIp':_0x1cd7fa[_0xe426('0x79')][_0xe426('0x99')]||_0x1cd7fa['headers']['x-real-ip']||_0x1cd7fa[_0xe426('0x107')][_0xe426('0x108')]||_0x1cd7fa['ip'],'referer':_0x1cd7fa[_0xe426('0x79')]['referer'],'openedInteractions':_0x26a003,'maxInteractions':_0x4a2f59,'virtual':_0x342ac4[_0xe426('0xfc')],'online':_0x4c029d,'custom':_0x342ac4}))['replace'](/'/g,'\x5c\x27')};_0xb91145[_0xe426('0x2c')](ejs[_0xe426('0xc3')](Mustache['render'](_0x192f79,_0x2a02f4),{'proactiveActions':_0x5b6cff,'alignment':_0x17ac63[_0xe426('0x109')],'verticalAlignment':_0x17ac63[_0xe426('0x10a')],'div_color':_0x17ac63['color'],'labelText':_0x17ac63[_0xe426('0x10b')],'text_color':_0x17ac63['textColor'],'text_button_color':_0x17ac63[_0xe426('0x10c')],'button_color':_0x17ac63['color_button'],'background_color':_0x17ac63[_0xe426('0x10d')],'hideWhenOffline':_0x17ac63[_0xe426('0x10e')],'intervalId':_0x17ac63[_0xe426('0x10f')],'isDevelopment':_0x4840f7,'chatVersion':_0xe7579e}));})['catch'](handleError(_0xb91145,null));};exports[_0xe426('0x110')]=function(_0x5368d5,_0x38f847){var _0x29b950=_0x5368d5[_0xe426('0x47')]['id'];var _0x482b1e=_0x5368d5[_0xe426('0x4b')];var _0x3d8fa9=0xc8;var _0x2846b2=null;return db['sequelize'][_0xe426('0xcd')]({'isolationLevel':db[_0xe426('0xcc')][_0xe426('0x111')][_0xe426('0x112')]['READ_COMMITTED']},function(_0x47a7fe){return db[_0xe426('0x30')][_0xe426('0x57')]({'where':{'id':_0x29b950},'transaction':_0x47a7fe})[_0xe426('0x17')](function(_0x97c875){if(_0x97c875){return db['ChatApplication'][_0xe426('0x113')]({'where':{'ChatWebsiteId':_0x29b950},'transaction':_0x47a7fe})['then'](function(){var _0x1b7e30=_[_0xe426('0x2f')](_0x482b1e,function(_0x587f6e){_0x587f6e[_0xe426('0x55')]=_0x29b950;return _0x587f6e;});return db[_0xe426('0x90')][_0xe426('0x114')](_0x1b7e30,{'transaction':_0x47a7fe});});}else{_0x3d8fa9=0x194;_0x2846b2=[];}});})[_0xe426('0x17')](function(){if(_0x3d8fa9!==0x194){return db[_0xe426('0x90')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x29b950},'order':_0xe426('0x94')})[_0xe426('0x17')](function(_0x2e9bc8){_0x2846b2=_0x2e9bc8;});}})[_0xe426('0x20')](function(_0x452bf2){_0x3d8fa9=0x1f4;logger[_0xe426('0x1c')](_0x452bf2[_0xe426('0x115')]);if(_0x452bf2['name']){delete _0x452bf2[_0xe426('0x2b')];}_0x2846b2=_0x452bf2;})[_0xe426('0x116')](function(){if(_0x2846b2===null){_0x38f847['sendStatus'](_0x3d8fa9);}else{if(_0x3d8fa9===0x1f4){_0x38f847[_0xe426('0x22')](_0x3d8fa9)[_0xe426('0x2c')](_0x2846b2);}else{_0x38f847[_0xe426('0x22')](_0x3d8fa9)['json'](_0x2846b2);}}});};exports[_0xe426('0x117')]=function(_0x2f0c58,_0x16d1af){var _0x3da150={};var _0x4b73da={};var _0x2be093;var _0x1ea724;return db['ChatWebsite'][_0xe426('0x57')]({'where':{'id':_0x2f0c58['params']['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x16d1af,null))[_0xe426('0x17')](function(_0x26bc6b){if(_0x26bc6b){_0x2be093=_0x26bc6b;_0x4b73da['model']=_[_0xe426('0x36')](db['ChatApplication'][_0xe426('0x31')]);_0x4b73da['query']=_[_0xe426('0x36')](_0x2f0c58[_0xe426('0x35')]);_0x4b73da[_0xe426('0x37')]=_['intersection'](_0x4b73da[_0xe426('0x34')],_0x4b73da[_0xe426('0x35')]);_0x3da150[_0xe426('0x39')]=_[_0xe426('0x38')](_0x4b73da[_0xe426('0x34')],qs[_0xe426('0x3a')](_0x2f0c58['query'][_0xe426('0x3a')]));_0x3da150['attributes']=_0x3da150['attributes']['length']?_0x3da150[_0xe426('0x39')]:_0x4b73da['model'];_0x3da150[_0xe426('0x3d')]=qs[_0xe426('0x3e')](_0x2f0c58[_0xe426('0x35')]['sort']);_0x3da150[_0xe426('0x40')]=qs[_0xe426('0x37')](_[_0xe426('0x3f')](_0x2f0c58['query'],_0x4b73da['filters']));if(_0x2f0c58[_0xe426('0x35')]['filter']){_0x3da150[_0xe426('0x40')]=_[_0xe426('0x41')](_0x3da150[_0xe426('0x40')],{'$or':_[_0xe426('0x2f')](_0x3da150[_0xe426('0x39')],function(_0x1ce007){var _0x288e1c={};_0x288e1c[_0x1ce007]={'$like':'%'+_0x2f0c58['query'][_0xe426('0x43')]+'%'};return _0x288e1c;})});}_0x3da150=_[_0xe426('0x41')]({},_0x3da150,_0x2f0c58[_0xe426('0x58')]);return _0x2be093[_0xe426('0x117')](_0x3da150);}})[_0xe426('0x17')](function(_0x49a551){if(_0x49a551){_0x1ea724=_0x49a551[_0xe426('0x48')];if(!_0x2f0c58[_0xe426('0x35')][_0xe426('0x5d')](_0xe426('0x3b'))){_0x3da150[_0xe426('0x3c')]=qs[_0xe426('0x3c')](_0x2f0c58[_0xe426('0x35')]['limit']);_0x3da150[_0xe426('0x25')]=qs[_0xe426('0x25')](_0x2f0c58[_0xe426('0x35')][_0xe426('0x25')]);}return _0x2be093['getApplications'](_0x3da150);}})[_0xe426('0x17')](function(_0x533325){if(_0x533325){return _0x533325?{'count':_0x1ea724,'rows':_0x533325}:null;}})[_0xe426('0x17')](respondWithResult(_0x16d1af,null))[_0xe426('0x20')](handleError(_0x16d1af,null));};exports[_0xe426('0x118')]=function(_0x47a0e0,_0x1c43c7){return db[_0xe426('0x119')][_0xe426('0x49')]({'where':{'id':_0x47a0e0[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x1c43c7,null))[_0xe426('0x17')](function(_0x4aa808){if(_0x4aa808){return _0x4aa808[_0xe426('0x118')](_0x47a0e0[_0xe426('0x4b')][_0xe426('0x60')],_[_0xe426('0x11a')](_0x47a0e0[_0xe426('0x4b')],[_0xe426('0x60'),'id'])||{});}})[_0xe426('0x17')](respondWithResult(_0x1c43c7,null))[_0xe426('0x20')](handleError(_0x1c43c7,null));};exports[_0xe426('0xfb')]=function(_0x21da57,_0xb80bc7){var _0x224914={};var _0x129b7a={};var _0x3fd503;var _0x54dc09;return db[_0xe426('0x30')]['findOne']({'where':{'id':_0x21da57[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0xb80bc7,null))[_0xe426('0x17')](function(_0x597e56){if(_0x597e56){_0x3fd503=_0x597e56;_0x129b7a['model']=_[_0xe426('0x36')](db[_0xe426('0x11b')][_0xe426('0x31')]);_0x129b7a['query']=_['keys'](_0x21da57[_0xe426('0x35')]);_0x129b7a['filters']=_[_0xe426('0x38')](_0x129b7a[_0xe426('0x34')],_0x129b7a[_0xe426('0x35')]);_0x224914[_0xe426('0x39')]=_['intersection'](_0x129b7a['model'],qs['fields'](_0x21da57['query'][_0xe426('0x3a')]));_0x224914[_0xe426('0x39')]=_0x224914[_0xe426('0x39')][_0xe426('0x48')]?_0x224914[_0xe426('0x39')]:_0x129b7a[_0xe426('0x34')];_0x224914[_0xe426('0x3d')]=qs['sort'](_0x21da57['query'][_0xe426('0x3e')]);_0x224914[_0xe426('0x40')]=qs['filters'](_[_0xe426('0x3f')](_0x21da57[_0xe426('0x35')],_0x129b7a['filters']));if(_0x21da57[_0xe426('0x35')][_0xe426('0x43')]){_0x224914[_0xe426('0x40')]=_[_0xe426('0x41')](_0x224914[_0xe426('0x40')],{'$or':_[_0xe426('0x2f')](_0x224914[_0xe426('0x39')],function(_0x519656){var _0x2de78f={};_0x2de78f[_0x519656]={'$like':'%'+_0x21da57[_0xe426('0x35')][_0xe426('0x43')]+'%'};return _0x2de78f;})});}_0x224914=_[_0xe426('0x41')]({},_0x224914,_0x21da57[_0xe426('0x58')]);return _0x3fd503[_0xe426('0xfb')](_0x224914);}})[_0xe426('0x17')](function(_0x50cdcd){if(_0x50cdcd){_0x54dc09=_0x50cdcd[_0xe426('0x48')];if(!_0x21da57[_0xe426('0x35')]['hasOwnProperty'](_0xe426('0x3b'))){_0x224914[_0xe426('0x3c')]=qs[_0xe426('0x3c')](_0x21da57['query'][_0xe426('0x3c')]);_0x224914[_0xe426('0x25')]=qs['offset'](_0x21da57[_0xe426('0x35')][_0xe426('0x25')]);}return _0x3fd503['getProactiveActions'](_0x224914);}})[_0xe426('0x17')](function(_0x4d86b5){if(_0x4d86b5){return _0x4d86b5?{'count':_0x54dc09,'rows':_0x4d86b5}:null;}})[_0xe426('0x17')](respondWithResult(_0xb80bc7,null))[_0xe426('0x20')](handleError(_0xb80bc7,null));};exports[_0xe426('0x11c')]=function(_0x1fd656,_0x1910a2){var _0x3894c4=_0x1fd656[_0xe426('0x35')]['online']===_0xe426('0x11d')?_0xe426('0x11e'):'onlineForm';return db[_0xe426('0x30')][_0xe426('0x49')]({'attributes':['id',_0x3894c4],'where':{'id':_0x1fd656['params']['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x1910a2,null))[_0xe426('0x17')](function(_0x429f63){if(_0x429f63){var _0x23527f=_0x429f63[_0x3894c4];var _0x1b7b7c=_0x23527f&&_0x23527f['items']?_0x23527f['items']:[];_0x1910a2[_0xe426('0x2c')]({'fromKey':_[_0xe426('0x6f')](_0x23527f[_0xe426('0x11f')])?undefined:_0x23527f[_0xe426('0x11f')],'count':_0x1b7b7c[_0xe426('0x48')],'rows':_0x1b7b7c});}})[_0xe426('0x20')](handleError(_0x1910a2,null));};exports[_0xe426('0x120')]=function(_0x35ccb3,_0x5dbce1){var _0x403c83={'raw':![],'where':{}};var _0x310da6={};var _0x34f7d1={'count':0x0,'rows':[]};return db[_0xe426('0x30')][_0xe426('0x57')]({'where':{'id':_0x35ccb3[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x5dbce1,null))['then'](function(_0x18f545){if(_0x18f545){_0x310da6[_0xe426('0x34')]=_[_0xe426('0x36')](db['ChatOfflineMessage'][_0xe426('0x31')]);_0x310da6[_0xe426('0x35')]=_[_0xe426('0x36')](_0x35ccb3[_0xe426('0x35')]);_0x310da6[_0xe426('0x37')]=_[_0xe426('0x38')](_0x310da6[_0xe426('0x34')],_0x310da6['query']);_0x403c83[_0xe426('0x39')]=_['intersection'](_0x310da6[_0xe426('0x34')],qs[_0xe426('0x3a')](_0x35ccb3[_0xe426('0x35')][_0xe426('0x3a')]));_0x403c83[_0xe426('0x39')]=_0x403c83['attributes'][_0xe426('0x48')]?_0x403c83[_0xe426('0x39')]:_0x310da6[_0xe426('0x34')];if(!_0x35ccb3[_0xe426('0x35')][_0xe426('0x5d')]('nolimit')){_0x403c83[_0xe426('0x3c')]=qs[_0xe426('0x3c')](_0x35ccb3[_0xe426('0x35')][_0xe426('0x3c')]);_0x403c83['offset']=qs[_0xe426('0x25')](_0x35ccb3[_0xe426('0x35')][_0xe426('0x25')]);}_0x403c83[_0xe426('0x3d')]=qs['sort'](_0x35ccb3['query'][_0xe426('0x3e')]);_0x403c83['where']=qs['filters'](_[_0xe426('0x3f')](_0x35ccb3[_0xe426('0x35')],_0x310da6['filters']));_0x403c83[_0xe426('0x40')]['ChatWebsiteId']=_0x18f545['id'];if(_0x35ccb3[_0xe426('0x35')]['filter']){_0x403c83[_0xe426('0x40')]=_[_0xe426('0x41')](_0x403c83[_0xe426('0x40')],{'$or':_[_0xe426('0x2f')](_0x403c83[_0xe426('0x39')],function(_0x1e4f64){var _0x2494b6={};_0x2494b6[_0x1e4f64]={'$like':'%'+_0x35ccb3[_0xe426('0x35')][_0xe426('0x43')]+'%'};return _0x2494b6;})});}_0x403c83=_[_0xe426('0x41')]({},_0x403c83,_0x35ccb3[_0xe426('0x58')]);return db[_0xe426('0xc6')][_0xe426('0x27')]({'where':_0x403c83[_0xe426('0x40')]})[_0xe426('0x17')](function(_0x21e200){_0x34f7d1[_0xe426('0x27')]=_0x21e200;if(_0x35ccb3['query']['includeAll']){_0x403c83['include']=[{'all':!![]}];}else{_0x403c83[_0xe426('0x5e')]=[{'model':db[_0xe426('0x7d')],'as':_0xe426('0xe5'),'required':![]},{'model':db[_0xe426('0xce')],'as':'Attachments','required':![]}];}return db[_0xe426('0xc6')][_0xe426('0x59')](_0x403c83);})[_0xe426('0x17')](function(_0x7f3b72){_0x34f7d1[_0xe426('0x45')]=_0x7f3b72;return _0x34f7d1;});}})[_0xe426('0x17')](respondWithFilteredResult(_0x5dbce1,_0x403c83))['catch'](handleError(_0x5dbce1,null));};exports[_0xe426('0x121')]=function(_0x48a91d,_0x5ccaff){return db[_0xe426('0x30')][_0xe426('0x49')]({'where':{'id':_0x48a91d[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x5ccaff,null))['then'](function(_0x9634e3){if(_0x9634e3){return _0x9634e3[_0xe426('0x121')](_0x48a91d[_0xe426('0x4b')][_0xe426('0x60')],_[_0xe426('0x11a')](_0x48a91d['body'],[_0xe426('0x60'),'id'])||{})[_0xe426('0xad')](function(_0x1463e0){for(var _0x3d0418=0x0;_0x3d0418<_0x48a91d[_0xe426('0x4b')][_0xe426('0x60')]['length'];_0x3d0418+=0x1){socket[_0xe426('0x122')](_0xe426('0x123'),{'UserId':Number(_0x48a91d[_0xe426('0x4b')][_0xe426('0x60')][_0x3d0418]),'ChatWebsiteId':Number(_0x48a91d['params']['id'])});}return _0x1463e0;});}})['then'](respondWithResult(_0x5ccaff,null))[_0xe426('0x20')](handleError(_0x5ccaff,null));};exports[_0xe426('0x124')]=function(_0x9b3b0,_0x2dde1e){return db[_0xe426('0x30')]['find']({'where':{'id':_0x9b3b0[_0xe426('0x47')]['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x2dde1e,null))['then'](function(_0x230053){if(_0x230053){return _0x230053[_0xe426('0x124')](_0x9b3b0['query'][_0xe426('0x60')])[_0xe426('0x17')](function(){if(_[_0xe426('0x125')](_0x9b3b0[_0xe426('0x35')][_0xe426('0x60')])){for(var _0x346944=0x0;_0x346944<_0x9b3b0['query'][_0xe426('0x60')][_0xe426('0x48')];_0x346944+=0x1){socket[_0xe426('0x122')](_0xe426('0x126'),{'UserId':Number(_0x9b3b0[_0xe426('0x35')][_0xe426('0x60')][_0x346944]),'ChatWebsiteId':Number(_0x9b3b0['params']['id'])});}}else{socket['emit'](_0xe426('0x126'),{'UserId':Number(_0x9b3b0[_0xe426('0x35')][_0xe426('0x60')]),'ChatWebsiteId':Number(_0x9b3b0[_0xe426('0x47')]['id'])});}});}})[_0xe426('0x17')](respondWithStatusCode(_0x2dde1e,null))[_0xe426('0x20')](handleError(_0x2dde1e,null));};exports[_0xe426('0x127')]=function(_0x1c13d8,_0x3045db){var _0x27cb61={};var _0x1550d0={};var _0x4a968a;var _0x4e06e2;return db[_0xe426('0x30')][_0xe426('0x57')]({'where':{'id':_0x1c13d8['params']['id']}})[_0xe426('0x17')](handleEntityNotFound(_0x3045db,null))['then'](function(_0x251ba6){if(_0x251ba6){_0x4a968a=_0x251ba6;_0x1550d0[_0xe426('0x34')]=_[_0xe426('0x36')](db['User'][_0xe426('0x31')]);_0x1550d0[_0xe426('0x35')]=_[_0xe426('0x36')](_0x1c13d8[_0xe426('0x35')]);_0x1550d0[_0xe426('0x37')]=_[_0xe426('0x38')](_0x1550d0[_0xe426('0x34')],_0x1550d0[_0xe426('0x35')]);_0x27cb61['attributes']=_[_0xe426('0x38')](_0x1550d0[_0xe426('0x34')],qs['fields'](_0x1c13d8[_0xe426('0x35')][_0xe426('0x3a')]));_0x27cb61['attributes']=_0x27cb61[_0xe426('0x39')][_0xe426('0x48')]?_0x27cb61['attributes']:_0x1550d0[_0xe426('0x34')];_0x27cb61[_0xe426('0x3d')]=qs['sort'](_0x1c13d8[_0xe426('0x35')][_0xe426('0x3e')]);_0x27cb61[_0xe426('0x40')]=qs['filters'](_[_0xe426('0x3f')](_0x1c13d8[_0xe426('0x35')],_0x1550d0[_0xe426('0x37')]));if(_0x1c13d8[_0xe426('0x35')][_0xe426('0x43')]){_0x27cb61['where']=_[_0xe426('0x41')](_0x27cb61['where'],{'$or':_[_0xe426('0x2f')](_0x27cb61[_0xe426('0x39')],function(_0x1f7968){var _0x1202e6={};_0x1202e6[_0x1f7968]={'$like':'%'+_0x1c13d8[_0xe426('0x35')]['filter']+'%'};return _0x1202e6;})});}_0x27cb61=_[_0xe426('0x41')]({},_0x27cb61,_0x1c13d8[_0xe426('0x58')]);return _0x4a968a['getAgents'](_0x27cb61);}})['then'](function(_0x928504){if(_0x928504){_0x4e06e2=_0x928504['length'];if(!_0x1c13d8[_0xe426('0x35')]['hasOwnProperty'](_0xe426('0x3b'))){_0x27cb61[_0xe426('0x3c')]=qs[_0xe426('0x3c')](_0x1c13d8[_0xe426('0x35')][_0xe426('0x3c')]);_0x27cb61[_0xe426('0x25')]=qs[_0xe426('0x25')](_0x1c13d8[_0xe426('0x35')][_0xe426('0x25')]);}return _0x4a968a['getAgents'](_0x27cb61);}})[_0xe426('0x17')](function(_0x2c7361){if(_0x2c7361){return _0x2c7361?{'count':_0x4e06e2,'rows':_0x2c7361}:null;}})[_0xe426('0x17')](respondWithResult(_0x3045db,null))[_0xe426('0x20')](handleError(_0x3045db,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 11bce62..c3201ea 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite'];(function(_0x14634f,_0x5c3b5b){var _0x452ced=function(_0x35c771){while(--_0x35c771){_0x14634f['push'](_0x14634f['shift']());}};_0x452ced(++_0x5c3b5b);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x7995('0x0'));var ChatWebsite=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){ChatWebsiteEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);ChatWebsiteEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];ChatWebsite[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xe599=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0x29bc23,_0x470822){var _0x8116bf=function(_0x40df49){while(--_0x40df49){_0x29bc23['push'](_0x29bc23['shift']());}};_0x8116bf(++_0x470822);}(_0xe599,0x1e5));var _0x9e59=function(_0x4ca3d6,_0x48e3ae){_0x4ca3d6=_0x4ca3d6-0x0;var _0x117506=_0xe599[_0x4ca3d6];return _0x117506;};'use strict';var EventEmitter=require(_0x9e59('0x0'));var ChatWebsite=require(_0x9e59('0x1'))['db'][_0x9e59('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9e59('0x3')](0x0);var events={'afterCreate':_0x9e59('0x4'),'afterUpdate':_0x9e59('0x5'),'afterDestroy':_0x9e59('0x6')};function emitEvent(_0x296a98){return function(_0x3b40cc,_0x568c08,_0x156af6){ChatWebsiteEvents[_0x9e59('0x7')](_0x296a98+':'+_0x3b40cc['id'],_0x3b40cc);ChatWebsiteEvents['emit'](_0x296a98,_0x3b40cc);_0x156af6(null);};}for(var e in events){if(events[_0x9e59('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x9e59('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index a5ab330..1a78889 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 _0x5d58=['define','ChatWebsite','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x56193b,_0x49a9c3){var _0x4624e8=function(_0xf05f89){while(--_0xf05f89){_0x56193b['push'](_0x56193b['shift']());}};_0x4624e8(++_0x49a9c3);}(_0x5d58,0x1ee));var _0x85d5=function(_0x46f5b6,_0x5064b4){_0x46f5b6=_0x46f5b6-0x0;var _0x54169b=_0x5d58[_0x46f5b6];return _0x54169b;};'use strict';var _=require(_0x85d5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x85d5('0x1'));var moment=require(_0x85d5('0x2'));var BPromise=require(_0x85d5('0x3'));var rp=require(_0x85d5('0x4'));var fs=require('fs');var path=require(_0x85d5('0x5'));var rimraf=require(_0x85d5('0x6'));var config=require(_0x85d5('0x7'));var attributes=require(_0x85d5('0x8'));module[_0x85d5('0x9')]=function(_0x351e61,_0x3c9208){return _0x351e61[_0x85d5('0xa')](_0x85d5('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fe0=['ChatWebsite','chat_websites','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x553870,_0x247a0d){var _0x406fa4=function(_0x3ee467){while(--_0x3ee467){_0x553870['push'](_0x553870['shift']());}};_0x406fa4(++_0x247a0d);}(_0x9fe0,0x7b));var _0x09fe=function(_0x45ce62,_0x1b1631){_0x45ce62=_0x45ce62-0x0;var _0x2d5b0e=_0x9fe0[_0x45ce62];return _0x2d5b0e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x09fe('0x0'))(_0x09fe('0x1'));var moment=require(_0x09fe('0x2'));var BPromise=require(_0x09fe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x09fe('0x4'));var config=require(_0x09fe('0x5'));var attributes=require(_0x09fe('0x6'));module[_0x09fe('0x7')]=function(_0x5e2622,_0x202979){return _0x5e2622[_0x09fe('0x8')](_0x09fe('0x9'),attributes,{'tableName':_0x09fe('0xa'),'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 951383b..4f4dbbd 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 _0xb87f=['client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb87f,0x9b));var _0xfb87=function(_0x32751d,_0x4612d8){_0x32751d=_0x32751d-0x0;var _0x99f81f=_0xb87f[_0x32751d];return _0x99f81f;};'use strict';var _=require('lodash');var util=require(_0xfb87('0x0'));var moment=require(_0xfb87('0x1'));var BPromise=require('bluebird');var rs=require(_0xfb87('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb87('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb87('0x4'))(_0xfb87('0x5'));var config=require('../../config/environment');var jayson=require(_0xfb87('0x6'));var client=jayson[_0xfb87('0x7')][_0xfb87('0x8')]({'port':0x232a});config[_0xfb87('0x9')]=_[_0xfb87('0xa')](config[_0xfb87('0x9')],{'host':_0xfb87('0xb'),'port':0x18eb});var socket=require(_0xfb87('0xc'))(new Redis(config[_0xfb87('0x9')]));require(_0xfb87('0xd'))['register'](socket);function respondWithRpcPromise(_0x41e2d7,_0x13b611,_0x3cb6cb){return new BPromise(function(_0xd14f06,_0xe19f5a){return client[_0xfb87('0xe')](_0x41e2d7,_0x3cb6cb)[_0xfb87('0xf')](function(_0x3c9057){logger[_0xfb87('0x10')](_0xfb87('0x11'),_0x13b611,_0xfb87('0x12'));logger[_0xfb87('0x13')](_0xfb87('0x14'),_0x13b611,_0xfb87('0x12'),JSON[_0xfb87('0x15')](_0x3c9057));if(_0x3c9057[_0xfb87('0x16')]){if(_0x3c9057[_0xfb87('0x16')][_0xfb87('0x17')]===0x1f4){logger[_0xfb87('0x16')](_0xfb87('0x11'),_0x13b611,_0x3c9057[_0xfb87('0x16')][_0xfb87('0x18')]);return _0xe19f5a(_0x3c9057[_0xfb87('0x16')]['message']);}logger['error'](_0xfb87('0x11'),_0x13b611,_0x3c9057[_0xfb87('0x16')][_0xfb87('0x18')]);return _0xd14f06(_0x3c9057[_0xfb87('0x16')][_0xfb87('0x18')]);}else{logger[_0xfb87('0x10')](_0xfb87('0x11'),_0x13b611,_0xfb87('0x12'));_0xd14f06(_0x3c9057[_0xfb87('0x19')]['message']);}})[_0xfb87('0x1a')](function(_0x19a8b5){logger[_0xfb87('0x16')](_0xfb87('0x11'),_0x13b611,_0x19a8b5);_0xe19f5a(_0x19a8b5);});});} \ No newline at end of file +var _0x0df5=['rpc','jayson/promise','client','http','redis','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x48935f,_0x534032){var _0xc8e4c6=function(_0x5737b7){while(--_0x5737b7){_0x48935f['push'](_0x48935f['shift']());}};_0xc8e4c6(++_0x534032);}(_0x0df5,0xaf));var _0x50df=function(_0x1f8f0a,_0x52a210){_0x1f8f0a=_0x1f8f0a-0x0;var _0x5b32e4=_0x0df5[_0x1f8f0a];return _0x5b32e4;};'use strict';var _=require('lodash');var util=require(_0x50df('0x0'));var moment=require(_0x50df('0x1'));var BPromise=require(_0x50df('0x2'));var rs=require(_0x50df('0x3'));var fs=require('fs');var Redis=require(_0x50df('0x4'));var db=require(_0x50df('0x5'))['db'];var utils=require(_0x50df('0x6'));var logger=require('../../config/logger')(_0x50df('0x7'));var config=require('../../config/environment');var jayson=require(_0x50df('0x8'));var client=jayson[_0x50df('0x9')][_0x50df('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x50df('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x50df('0xc'))(new Redis(config[_0x50df('0xb')]));require(_0x50df('0xd'))[_0x50df('0xe')](socket);function respondWithRpcPromise(_0x4955df,_0x2a1e87,_0x33903d){return new BPromise(function(_0xf11104,_0x458f7c){return client[_0x50df('0xf')](_0x4955df,_0x33903d)[_0x50df('0x10')](function(_0x4e3f9a){logger[_0x50df('0x11')](_0x50df('0x12'),_0x2a1e87,'request\x20sent');logger[_0x50df('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2a1e87,'request\x20sent',JSON[_0x50df('0x14')](_0x4e3f9a));if(_0x4e3f9a[_0x50df('0x15')]){if(_0x4e3f9a[_0x50df('0x15')]['code']===0x1f4){logger[_0x50df('0x15')](_0x50df('0x12'),_0x2a1e87,_0x4e3f9a[_0x50df('0x15')][_0x50df('0x16')]);return _0x458f7c(_0x4e3f9a[_0x50df('0x15')][_0x50df('0x16')]);}logger[_0x50df('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x2a1e87,_0x4e3f9a[_0x50df('0x15')][_0x50df('0x16')]);return _0xf11104(_0x4e3f9a[_0x50df('0x15')]['message']);}else{logger['info'](_0x50df('0x12'),_0x2a1e87,_0x50df('0x17'));_0xf11104(_0x4e3f9a[_0x50df('0x18')][_0x50df('0x16')]);}})[_0x50df('0x19')](function(_0x1f0f71){logger[_0x50df('0x15')](_0x50df('0x12'),_0x2a1e87,_0x1f0f71);_0x458f7c(_0x1f0f71);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 58ccad9..cacb637 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 _0xe873=['remove','update','emit','removeListener','./chatWebsite.events','save'];(function(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0xe873,0xca));var _0x3e87=function(_0x44d63b,_0x32cfbb){_0x44d63b=_0x44d63b-0x0;var _0x9d72d5=_0xe873[_0x44d63b];return _0x9d72d5;};'use strict';var ChatWebsiteEvents=require(_0x3e87('0x0'));var events=[_0x3e87('0x1'),_0x3e87('0x2'),_0x3e87('0x3')];function createListener(_0x226eb8,_0x2a9c46){return function(_0x315c7){_0x2a9c46[_0x3e87('0x4')](_0x226eb8,_0x315c7);};}function removeListener(_0x341d1c,_0x203d87){return function(){ChatWebsiteEvents[_0x3e87('0x5')](_0x341d1c,_0x203d87);};}exports['register']=function(_0x21b0a6){for(var _0x19fafb=0x0,_0xb4e16f=events['length'];_0x19fafb<_0xb4e16f;_0x19fafb++){var _0x278ba1=events[_0x19fafb];var _0x44fb44=createListener('chatWebsite:'+_0x278ba1,_0x21b0a6);ChatWebsiteEvents['on'](_0x278ba1,_0x44fb44);}}; \ No newline at end of file +var _0x5633=['chatWebsite:','./chatWebsite.events','save','update','emit','removeListener','register','length'];(function(_0x69555a,_0x5f0c36){var _0x5c9b69=function(_0xa4f5ff){while(--_0xa4f5ff){_0x69555a['push'](_0x69555a['shift']());}};_0x5c9b69(++_0x5f0c36);}(_0x5633,0x121));var _0x3563=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5633[_0x36eaaa];return _0x461349;};'use strict';var ChatWebsiteEvents=require(_0x3563('0x0'));var events=[_0x3563('0x1'),'remove',_0x3563('0x2')];function createListener(_0x4df85,_0x346bd0){return function(_0x4e229b){_0x346bd0[_0x3563('0x3')](_0x4df85,_0x4e229b);};}function removeListener(_0x237de0,_0x36f937){return function(){ChatWebsiteEvents[_0x3563('0x4')](_0x237de0,_0x36f937);};}exports[_0x3563('0x5')]=function(_0x2a6f2d){for(var _0x3c81c7=0x0,_0x4eb8e6=events[_0x3563('0x6')];_0x3c81c7<_0x4eb8e6;_0x3c81c7++){var _0xfb3507=events[_0x3c81c7];var _0x109dad=createListener(_0x3563('0x7')+_0xfb3507,_0x2a6f2d);ChatWebsiteEvents['on'](_0xfb3507,_0x109dad);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 42d1423..be54f05 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 _0x5cb2=['destroy','removeDispositions','exports','multer','util','path','express','Router','fs-extra','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addAnswer','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','ensureDir','replace','extname','/:id/offline','addApplications','addProactiveActions','addAgents','update','delete'];(function(_0x311293,_0xbde3b9){var _0x1cdd56=function(_0x759066){while(--_0x759066){_0x311293['push'](_0x311293['shift']());}};_0x1cdd56(++_0xbde3b9);}(_0x5cb2,0x195));var _0x25cb=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0x5cb2[_0x117f4c];return _0x2b24e9;};'use strict';var multer=require(_0x25cb('0x0'));var util=require(_0x25cb('0x1'));var path=require(_0x25cb('0x2'));var timeout=require('connect-timeout');var express=require(_0x25cb('0x3'));var router=express[_0x25cb('0x4')]();var fs_extra=require(_0x25cb('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x25cb('0x6'));router[_0x25cb('0x7')]('/',auth[_0x25cb('0x8')](),controller[_0x25cb('0x9')]);router[_0x25cb('0x7')](_0x25cb('0xa'),auth[_0x25cb('0x8')](),controller[_0x25cb('0xb')]);router['get'](_0x25cb('0xc'),auth[_0x25cb('0x8')](),controller['show']);router[_0x25cb('0x7')](_0x25cb('0xd'),auth[_0x25cb('0x8')](),controller[_0x25cb('0xe')]);router[_0x25cb('0x7')](_0x25cb('0xf'),auth['isAuthenticated'](),controller[_0x25cb('0x10')]);router['get'](_0x25cb('0x11'),controller[_0x25cb('0x12')]);router[_0x25cb('0x7')](_0x25cb('0x13'),controller[_0x25cb('0x14')]);router[_0x25cb('0x7')](_0x25cb('0x15'),controller[_0x25cb('0x16')]);router[_0x25cb('0x7')](_0x25cb('0x17'),controller[_0x25cb('0x18')]);router['get'](_0x25cb('0x19'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x25cb('0x7')](_0x25cb('0x1a'),controller[_0x25cb('0x1b')]);router[_0x25cb('0x7')](_0x25cb('0x1c'),auth['isAuthenticated'](),controller['getApplications']);router['get'](_0x25cb('0x1d'),auth[_0x25cb('0x8')](),controller['getProactiveActions']);router[_0x25cb('0x7')](_0x25cb('0x1e'),controller[_0x25cb('0x1f')]);router['get'](_0x25cb('0x20'),auth[_0x25cb('0x8')](),controller['getOfflineMessages']);router[_0x25cb('0x7')](_0x25cb('0x21'),auth[_0x25cb('0x8')](),controller[_0x25cb('0x22')]);router[_0x25cb('0x23')]('/',auth[_0x25cb('0x8')](),controller[_0x25cb('0x24')]);router[_0x25cb('0x23')](_0x25cb('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x25cb('0x23')](_0x25cb('0xf'),auth[_0x25cb('0x8')](),controller[_0x25cb('0x25')]);var upload=multer({'storage':multer[_0x25cb('0x26')]({'destination':function(_0x1c90ed,_0x1d097a,_0x39c5cb){_0x39c5cb(null,path[_0x25cb('0x27')](config[_0x25cb('0x28')],'server/files/images/logos/'));},'filename':function(_0x2447e4,_0x371f99,_0x59ee00){_0x59ee00(null,util[_0x25cb('0x29')](_0x25cb('0x2a'),Date[_0x25cb('0x2b')](),_0x371f99[_0x25cb('0x2c')]));}})});router[_0x25cb('0x23')]('/:id/logo',upload[_0x25cb('0x2d')](_0x25cb('0x2e')),controller[_0x25cb('0x2f')]);var upload=multer({'storage':multer[_0x25cb('0x26')]({'destination':function(_0x3e0780,_0x396f7c,_0x3f16b0){_0x3f16b0(null,path[_0x25cb('0x27')](config[_0x25cb('0x28')],_0x25cb('0x30')));},'filename':function(_0x2a4cc7,_0x16a993,_0x455dfe){_0x455dfe(null,util[_0x25cb('0x29')]('%s-%s',Date[_0x25cb('0x2b')](),_0x16a993['originalname']));}})});router[_0x25cb('0x23')](_0x25cb('0x13'),upload[_0x25cb('0x2d')]('file'),controller[_0x25cb('0x31')]);var upload=multer({'storage':multer[_0x25cb('0x26')]({'destination':function(_0x1e6960,_0x368062,_0x2a0548){_0x2a0548(null,path[_0x25cb('0x27')](config[_0x25cb('0x28')],_0x25cb('0x30')));},'filename':function(_0xff5791,_0x40c103,_0x43b538){_0x43b538(null,util[_0x25cb('0x29')]('%s-%s',Date[_0x25cb('0x2b')](),_0x40c103['originalname']));}})});router['post'](_0x25cb('0x15'),upload['single'](_0x25cb('0x2e')),controller[_0x25cb('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x283eca,_0x4a531c,_0x23b98f){_0x23b98f(null,path[_0x25cb('0x27')](config['root'],_0x25cb('0x30')));},'filename':function(_0x36c153,_0x47a94e,_0x19c3f6){_0x19c3f6(null,util[_0x25cb('0x29')](_0x25cb('0x2a'),Date[_0x25cb('0x2b')](),_0x47a94e[_0x25cb('0x2c')]));}})});router[_0x25cb('0x23')](_0x25cb('0x17'),upload[_0x25cb('0x2d')](_0x25cb('0x2e')),controller[_0x25cb('0x33')]);router[_0x25cb('0x23')](_0x25cb('0x34'),controller[_0x25cb('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x25cb('0x26')]({'destination':function(_0x491127,_0x317ce9,_0x1e4abe){const _0x353686=path[_0x25cb('0x27')](config[_0x25cb('0x28')],_0x25cb('0x36'),'attachments','offline-chat');fs_extra[_0x25cb('0x37')](_0x353686,function(){_0x1e4abe(null,_0x353686);});},'filename':function(_0x49211c,_0x1b305d,_0x28514c){const _0x5d970c=_0x1b305d['originalname'][_0x25cb('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x577839=path[_0x25cb('0x39')](_0x5d970c);const _0x2f0694=Date[_0x25cb('0x2b')]()+'-'+_0x5d970c[_0x25cb('0x38')](_0x577839,'')+_0x577839;_0x28514c(null,_0x2f0694);}})});router[_0x25cb('0x23')](_0x25cb('0x3a'),offlineUploadMulter['any'](),controller['offline']);router[_0x25cb('0x23')](_0x25cb('0x19'),auth[_0x25cb('0x8')](),controller['addInteraction']);router['post'](_0x25cb('0x1c'),auth[_0x25cb('0x8')](),controller[_0x25cb('0x3b')]);router[_0x25cb('0x23')](_0x25cb('0x1d'),auth['isAuthenticated'](),controller[_0x25cb('0x3c')]);router[_0x25cb('0x23')](_0x25cb('0x21'),auth[_0x25cb('0x8')](),controller[_0x25cb('0x3d')]);router['put'](_0x25cb('0xc'),auth[_0x25cb('0x8')](),controller[_0x25cb('0x3e')]);router[_0x25cb('0x3f')](_0x25cb('0xc'),auth[_0x25cb('0x8')](),controller[_0x25cb('0x40')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x25cb('0x41')]);router['delete'](_0x25cb('0xf'),auth[_0x25cb('0x8')](),controller['removeAnswers']);router['delete'](_0x25cb('0x21'),auth[_0x25cb('0x8')](),controller['removeAgents']);module[_0x25cb('0x42')]=router; \ No newline at end of file +var _0xa4ef=['replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','/:id/users','post','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','file','addLogo','root','server/files/images/avatars/','now','single','addAvatar','originalname','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','offline-chat','ensureDir'];(function(_0x3cb4c7,_0xf4a50e){var _0x3c6060=function(_0xbea008){while(--_0xbea008){_0x3cb4c7['push'](_0x3cb4c7['shift']());}};_0x3c6060(++_0xf4a50e);}(_0xa4ef,0xee));var _0xfa4e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa4ef[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xfa4e('0x0'));var util=require(_0xfa4e('0x1'));var path=require(_0xfa4e('0x2'));var timeout=require(_0xfa4e('0x3'));var express=require(_0xfa4e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfa4e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa4e('0x6'));var controller=require(_0xfa4e('0x7'));router[_0xfa4e('0x8')]('/',auth[_0xfa4e('0x9')](),controller[_0xfa4e('0xa')]);router[_0xfa4e('0x8')](_0xfa4e('0xb'),auth[_0xfa4e('0x9')](),controller['describe']);router['get']('/:id',auth[_0xfa4e('0x9')](),controller[_0xfa4e('0xc')]);router[_0xfa4e('0x8')](_0xfa4e('0xd'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0xe')]);router[_0xfa4e('0x8')](_0xfa4e('0xf'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x10')]);router[_0xfa4e('0x8')](_0xfa4e('0x11'),controller[_0xfa4e('0x12')]);router[_0xfa4e('0x8')](_0xfa4e('0x13'),controller[_0xfa4e('0x14')]);router[_0xfa4e('0x8')]('/:id/customer_avatar',controller[_0xfa4e('0x15')]);router[_0xfa4e('0x8')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0xfa4e('0x8')]('/:id/interactions',auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x16')]);router[_0xfa4e('0x8')](_0xfa4e('0x17'),controller[_0xfa4e('0x18')]);router['get']('/:id/applications',auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x19')]);router[_0xfa4e('0x8')](_0xfa4e('0x1a'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x1b')]);router[_0xfa4e('0x8')]('/:id/fields',controller[_0xfa4e('0x1c')]);router[_0xfa4e('0x8')](_0xfa4e('0x1d'),auth[_0xfa4e('0x9')](),controller['getOfflineMessages']);router[_0xfa4e('0x8')](_0xfa4e('0x1e'),auth[_0xfa4e('0x9')](),controller['getAgents']);router[_0xfa4e('0x1f')]('/',auth[_0xfa4e('0x9')](),controller['create']);router[_0xfa4e('0x1f')](_0xfa4e('0xd'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x20')]);router[_0xfa4e('0x1f')](_0xfa4e('0xf'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x21')]);var upload=multer({'storage':multer[_0xfa4e('0x22')]({'destination':function(_0x15d93d,_0x3d5837,_0x474078){_0x474078(null,path[_0xfa4e('0x23')](config['root'],_0xfa4e('0x24')));},'filename':function(_0x394678,_0x37a27f,_0xeef2c){_0xeef2c(null,util[_0xfa4e('0x25')](_0xfa4e('0x26'),Date['now'](),_0x37a27f['originalname']));}})});router[_0xfa4e('0x1f')](_0xfa4e('0x11'),upload['single'](_0xfa4e('0x27')),controller[_0xfa4e('0x28')]);var upload=multer({'storage':multer[_0xfa4e('0x22')]({'destination':function(_0xeeec03,_0x4bfdb0,_0x1e6b84){_0x1e6b84(null,path[_0xfa4e('0x23')](config[_0xfa4e('0x29')],_0xfa4e('0x2a')));},'filename':function(_0xa141a3,_0xea5d4f,_0x5cd3f8){_0x5cd3f8(null,util[_0xfa4e('0x25')]('%s-%s',Date[_0xfa4e('0x2b')](),_0xea5d4f['originalname']));}})});router[_0xfa4e('0x1f')](_0xfa4e('0x13'),upload[_0xfa4e('0x2c')](_0xfa4e('0x27')),controller[_0xfa4e('0x2d')]);var upload=multer({'storage':multer[_0xfa4e('0x22')]({'destination':function(_0x56c8f1,_0x39144d,_0x58d70b){_0x58d70b(null,path[_0xfa4e('0x23')](config[_0xfa4e('0x29')],_0xfa4e('0x2a')));},'filename':function(_0x2bb059,_0xcdb8a6,_0x252f06){_0x252f06(null,util[_0xfa4e('0x25')](_0xfa4e('0x26'),Date[_0xfa4e('0x2b')](),_0xcdb8a6[_0xfa4e('0x2e')]));}})});router[_0xfa4e('0x1f')](_0xfa4e('0x2f'),upload[_0xfa4e('0x2c')](_0xfa4e('0x27')),controller[_0xfa4e('0x30')]);var upload=multer({'storage':multer[_0xfa4e('0x22')]({'destination':function(_0x3df91a,_0x84b6c5,_0x44ea68){_0x44ea68(null,path[_0xfa4e('0x23')](config['root'],_0xfa4e('0x2a')));},'filename':function(_0x1f42ba,_0x4341fd,_0x309996){_0x309996(null,util['format'](_0xfa4e('0x26'),Date['now'](),_0x4341fd['originalname']));}})});router[_0xfa4e('0x1f')](_0xfa4e('0x31'),upload[_0xfa4e('0x2c')](_0xfa4e('0x27')),controller[_0xfa4e('0x32')]);router['post'](_0xfa4e('0x33'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x33906f,_0x3f2131,_0x3aaaaf){const _0x31888d=path[_0xfa4e('0x23')](config['root'],'server/files','attachments',_0xfa4e('0x34'));fs_extra[_0xfa4e('0x35')](_0x31888d,function(){_0x3aaaaf(null,_0x31888d);});},'filename':function(_0x2b0fdc,_0x4c0aad,_0x5f2035){const _0x4ae65e=_0x4c0aad['originalname'][_0xfa4e('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1f9113=path[_0xfa4e('0x37')](_0x4ae65e);const _0x7dfc64=Date['now']()+'-'+_0x4ae65e[_0xfa4e('0x36')](_0x1f9113,'')+_0x1f9113;_0x5f2035(null,_0x7dfc64);}})});router[_0xfa4e('0x1f')](_0xfa4e('0x38'),offlineUploadMulter[_0xfa4e('0x39')](),controller[_0xfa4e('0x3a')]);router[_0xfa4e('0x1f')](_0xfa4e('0x3b'),auth['isAuthenticated'](),controller[_0xfa4e('0x3c')]);router[_0xfa4e('0x1f')](_0xfa4e('0x3d'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x3e')]);router[_0xfa4e('0x1f')](_0xfa4e('0x1a'),auth['isAuthenticated'](),controller[_0xfa4e('0x3f')]);router['post'](_0xfa4e('0x1e'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x40')]);router[_0xfa4e('0x41')]('/:id',auth['isAuthenticated'](),controller[_0xfa4e('0x42')]);router[_0xfa4e('0x43')]('/:id',auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x44')]);router[_0xfa4e('0x43')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xfa4e('0x45')]);router['delete'](_0xfa4e('0xf'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x46')]);router['delete'](_0xfa4e('0x1e'),auth[_0xfa4e('0x9')](),controller[_0xfa4e('0x47')]);module[_0xfa4e('0x48')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 0c77f93..79a07a1 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebcc=['use','isAuthenticated','exports','beaver-logger/server','express','../config/environment','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x542e59,_0x3a9b0f){var _0x6106e5=function(_0x3fdf41){while(--_0x3fdf41){_0x542e59['push'](_0x542e59['shift']());}};_0x6106e5(++_0x3a9b0f);}(_0xebcc,0xf3));var _0xcebc=function(_0x30ff7c,_0x4d51b5){_0x30ff7c=_0x30ff7c-0x0;var _0x5583c2=_0xebcc[_0x30ff7c];return _0x5583c2;};var beaverLogger=require(_0xcebc('0x0'));var express=require(_0xcebc('0x1'));var auth=require('../components/auth/service');var config=require(_0xcebc('0x2'));var router=express['Router']();var isProduction=config['env']===_0xcebc('0x3')||![];function clientSideLogs(_0x58f2f5,_0x305e7f,_0x2824d5){var _0x3c43c7=_0x58f2f5[_0xcebc('0x4')][_0xcebc('0x5')](_0xcebc('0x6'));if(!_0x3c43c7){throw new Error(_0xcebc('0x7'));}return beaverLogger[_0xcebc('0x8')]({'uri':'/client-logs','logger':_0x3c43c7,'enableCors':!isProduction})(_0x58f2f5,_0x305e7f,_0x2824d5);}router[_0xcebc('0x9')](auth[_0xcebc('0xa')](),clientSideLogs);module[_0xcebc('0xb')]=router; \ No newline at end of file +var _0x7920=['Client-Side\x20logger\x20not\x20found!','/client-logs','exports','../components/auth/service','../config/environment','Router','env','production','app','get','client-side-logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7920,0x19a));var _0x0792=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x7920[_0x1a36a5];return _0x746243;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0x0792('0x0'));var config=require(_0x0792('0x1'));var router=express[_0x0792('0x2')]();var isProduction=config[_0x0792('0x3')]===_0x0792('0x4')||![];function clientSideLogs(_0xa82dc5,_0xe45935,_0x5d3a12){var _0x4d61f3=_0xa82dc5[_0x0792('0x5')][_0x0792('0x6')](_0x0792('0x7'));if(!_0x4d61f3){throw new Error(_0x0792('0x8'));}return beaverLogger['expressEndpoint']({'uri':_0x0792('0x9'),'logger':_0x4d61f3,'enableCors':!isProduction})(_0xa82dc5,_0xe45935,_0x5d3a12);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0x0792('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index c43f106..71ac0d6 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 _0xddb8=['MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize','STRING','ENUM','AmazonAWS','Google','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT'];(function(_0x34d2a0,_0x6cde4f){var _0x505c5b=function(_0x2130a3){while(--_0x2130a3){_0x34d2a0['push'](_0x34d2a0['shift']());}};_0x505c5b(++_0x6cde4f);}(_0xddb8,0x147));var _0x8ddb=function(_0x1bb553,_0x10c76a){_0x1bb553=_0x1bb553-0x0;var _0x207f64=_0xddb8[_0x1bb553];return _0x207f64;};'use strict';var Sequelize=require(_0x8ddb('0x0'));module['exports']={'name':{'type':Sequelize[_0x8ddb('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8ddb('0x2')](_0x8ddb('0x3'),_0x8ddb('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365',_0x8ddb('0x5'))},'data1':{'type':Sequelize[_0x8ddb('0x1')],'comment':_0x8ddb('0x6')},'data2':{'type':Sequelize[_0x8ddb('0x1')],'comment':_0x8ddb('0x7')},'data3':{'type':Sequelize[_0x8ddb('0x1')],'comment':_0x8ddb('0x8')},'data4':{'type':Sequelize[_0x8ddb('0x1')],'comment':_0x8ddb('0x9')},'data5':{'type':Sequelize[_0x8ddb('0xa')],'comment':_0x8ddb('0xb')},'data6':{'type':Sequelize[_0x8ddb('0xa')],'comment':_0x8ddb('0xc')},'data7':{'type':Sequelize[_0x8ddb('0xa')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x5502=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x1dbaf1,_0x16ae3b){var _0x3bcc08=function(_0x4ec701){while(--_0x4ec701){_0x1dbaf1['push'](_0x1dbaf1['shift']());}};_0x3bcc08(++_0x16ae3b);}(_0x5502,0x7b));var _0x2550=function(_0xb6cc07,_0x3ef661){_0xb6cc07=_0xb6cc07-0x0;var _0x5c8c21=_0x5502[_0xb6cc07];return _0x5c8c21;};'use strict';var Sequelize=require(_0x2550('0x0'));module[_0x2550('0x1')]={'name':{'type':Sequelize[_0x2550('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x2550('0x3')](_0x2550('0x4'),_0x2550('0x5'),_0x2550('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x2550('0x3')](_0x2550('0x7'),_0x2550('0x8'))},'data1':{'type':Sequelize[_0x2550('0x2')],'comment':_0x2550('0x9')},'data2':{'type':Sequelize[_0x2550('0x2')],'comment':_0x2550('0xa')},'data3':{'type':Sequelize[_0x2550('0x2')],'comment':_0x2550('0xb')},'data4':{'type':Sequelize[_0x2550('0x2')],'comment':_0x2550('0xc')},'data5':{'type':Sequelize[_0x2550('0xd')],'comment':_0x2550('0xe')},'data6':{'type':Sequelize[_0x2550('0xd')],'comment':_0x2550('0xf')},'data7':{'type':Sequelize['TEXT'],'comment':_0x2550('0x10')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index b21be38..0c3a465 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 _0xb330=['offset','undefined','count','limit','Content-Range','update','then','destroy','error','stack','name','padEnd','slice','map','CloudProvider','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','includeAll','include','find','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','Invalid\x20state\x20parameter','from','state','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','sendStatus','status','end'];(function(_0xaffc69,_0x4272a7){var _0x1bc6dd=function(_0x2ed754){while(--_0x2ed754){_0xaffc69['push'](_0xaffc69['shift']());}};_0x1bc6dd(++_0x4272a7);}(_0xb330,0xb1));var _0x0b33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb330[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0b33('0x0'));var Redis=require(_0x0b33('0x1'));var qs=require(_0x0b33('0x2'));var encryptor=require(_0x0b33('0x3'));var config=require(_0x0b33('0x4'));var logger=require(_0x0b33('0x5'))('api');var db=require(_0x0b33('0x6'))['db'];var oauth=require(_0x0b33('0x7'));config[_0x0b33('0x8')]=_[_0x0b33('0x9')](config[_0x0b33('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config[_0x0b33('0x8')]);function respondWithStatusCode(_0x44335a,_0x244e80){_0x244e80=_0x244e80||0xcc;return function(_0xcfa4f9){if(_0xcfa4f9){return _0x44335a[_0x0b33('0xa')](_0x244e80);}return _0x44335a[_0x0b33('0xb')](_0x244e80)[_0x0b33('0xc')]();};}function respondWithResult(_0x220461,_0xacb5cd){_0xacb5cd=_0xacb5cd||0xc8;return function(_0x1a6d57){if(_0x1a6d57){return _0x220461['status'](_0xacb5cd)['json'](_0x1a6d57);}};}function respondWithFilteredResult(_0x158301,_0x4516ee){return function(_0x220bea){if(_0x220bea){var _0x4a0958=typeof _0x4516ee[_0x0b33('0xd')]===_0x0b33('0xe')&&typeof _0x4516ee['limit']==='undefined';var _0x576096=_0x220bea[_0x0b33('0xf')];var _0x315d5f=_0x4a0958?0x0:_0x4516ee[_0x0b33('0xd')];var _0x315b56=_0x4a0958?_0x220bea[_0x0b33('0xf')]:_0x4516ee[_0x0b33('0xd')]+_0x4516ee[_0x0b33('0x10')];var _0x4f3042;if(_0x315b56>=_0x576096){_0x315b56=_0x576096;_0x4f3042=0xc8;}else{_0x4f3042=0xce;}_0x158301[_0x0b33('0xb')](_0x4f3042);return _0x158301['set'](_0x0b33('0x11'),_0x315d5f+'-'+_0x315b56+'/'+_0x576096)['json'](_0x220bea);}return null;};}function saveUpdates(_0x103ff7){return function(_0x58adcd){if(_0x58adcd){return _0x58adcd[_0x0b33('0x12')](_0x103ff7)[_0x0b33('0x13')](function(_0x34d7fd){return _0x34d7fd;});}return null;};}function removeEntity(_0x32ce1a){return function(_0x4033dc){if(_0x4033dc){return _0x4033dc[_0x0b33('0x14')]()[_0x0b33('0x13')](function(){_0x32ce1a['status'](0xcc)[_0x0b33('0xc')]();});}};}function handleEntityNotFound(_0x5c0b1c){return function(_0x43d55e){if(!_0x43d55e){_0x5c0b1c[_0x0b33('0xa')](0x194);}return _0x43d55e;};}function handleError(_0x4b4d00,_0x296d4d){_0x296d4d=_0x296d4d||0x1f4;return function(_0x4ab676){logger[_0x0b33('0x15')](_0x4ab676[_0x0b33('0x16')]);if(_0x4ab676[_0x0b33('0x17')]){delete _0x4ab676[_0x0b33('0x17')];}_0x4b4d00[_0x0b33('0xb')](_0x296d4d)['send'](_0x4ab676);};}function maskClientSecret(_0x5412d7){return _[_0x0b33('0x18')](_0x5412d7[_0x0b33('0x19')](0x0,0x3),0x14,'*');}exports['index']=function(_0x5e6920,_0x3a3317){var _0x257e4f={},_0x2c164b={},_0x4a8e8a={'count':0x0,'rows':[]};var _0x425ed0=_[_0x0b33('0x1a')](db[_0x0b33('0x1b')]['rawAttributes'],function(_0x590fb0){return{'name':_0x590fb0[_0x0b33('0x1c')],'type':_0x590fb0[_0x0b33('0x1d')]['key']};});_0x2c164b[_0x0b33('0x1e')]=_[_0x0b33('0x1a')](_0x425ed0,'name');_0x2c164b[_0x0b33('0x1f')]=_[_0x0b33('0x20')](_0x5e6920[_0x0b33('0x1f')]);_0x2c164b[_0x0b33('0x21')]=_[_0x0b33('0x22')](_0x2c164b[_0x0b33('0x1e')],_0x2c164b[_0x0b33('0x1f')]);_0x257e4f[_0x0b33('0x23')]=_['intersection'](_0x2c164b[_0x0b33('0x1e')],qs[_0x0b33('0x24')](_0x5e6920[_0x0b33('0x1f')][_0x0b33('0x24')]));_0x257e4f['attributes']=_0x257e4f[_0x0b33('0x23')][_0x0b33('0x25')]?_0x257e4f[_0x0b33('0x23')]:_0x2c164b['model'];if(!_0x5e6920[_0x0b33('0x1f')][_0x0b33('0x26')](_0x0b33('0x27'))){_0x257e4f['limit']=qs['limit'](_0x5e6920['query'][_0x0b33('0x10')]);_0x257e4f[_0x0b33('0xd')]=qs[_0x0b33('0xd')](_0x5e6920['query'][_0x0b33('0xd')]);}_0x257e4f[_0x0b33('0x28')]=qs[_0x0b33('0x29')](_0x5e6920[_0x0b33('0x1f')]['sort']);_0x257e4f[_0x0b33('0x2a')]=qs[_0x0b33('0x21')](_[_0x0b33('0x2b')](_0x5e6920[_0x0b33('0x1f')],_0x2c164b['filters']),_0x425ed0);if(_0x5e6920[_0x0b33('0x1f')][_0x0b33('0x2c')]){_0x257e4f[_0x0b33('0x2a')]=_['merge'](_0x257e4f[_0x0b33('0x2a')],{'$or':_[_0x0b33('0x1a')](_0x425ed0,function(_0x3b60fe){if(_0x3b60fe['type']!=='VIRTUAL'){var _0x419bb1={};_0x419bb1[_0x3b60fe[_0x0b33('0x17')]]={'$like':'%'+_0x5e6920[_0x0b33('0x1f')]['filter']+'%'};return _0x419bb1;}})});}_0x257e4f=_[_0x0b33('0x2d')]({},_0x257e4f,_0x5e6920[_0x0b33('0x2e')]);var _0x31fbfa={'where':_0x257e4f[_0x0b33('0x2a')]};return db['CloudProvider'][_0x0b33('0xf')](_0x31fbfa)[_0x0b33('0x13')](function(_0x2b5e2f){_0x4a8e8a['count']=_0x2b5e2f;if(_0x5e6920[_0x0b33('0x1f')]['includeAll']){_0x257e4f['include']=[{'all':!![]}];}return db[_0x0b33('0x1b')][_0x0b33('0x2f')](_0x257e4f);})[_0x0b33('0x13')](function(_0x26c705){_0x4a8e8a[_0x0b33('0x30')]=_[_0x0b33('0x1a')](_0x26c705,function(_0x3b9c39){if(_0x3b9c39[_0x0b33('0x31')]===_0x0b33('0x32')){var _0x17aedc=encryptor[_0x0b33('0x33')](_0x3b9c39[_0x0b33('0x34')]);_0x3b9c39['data3']=maskClientSecret(_0x17aedc);}return _0x3b9c39;});return _0x4a8e8a;})[_0x0b33('0x13')](respondWithFilteredResult(_0x3a3317,_0x257e4f))[_0x0b33('0x35')](handleError(_0x3a3317,null));};exports[_0x0b33('0x36')]=function(_0x4b2036,_0x506e9e){var _0x1e296d={'raw':!![],'where':{'id':_0x4b2036[_0x0b33('0x37')]['id']}},_0x25d02c={};_0x25d02c['model']=_[_0x0b33('0x20')](db[_0x0b33('0x1b')][_0x0b33('0x38')]);_0x25d02c[_0x0b33('0x1f')]=_[_0x0b33('0x20')](_0x4b2036[_0x0b33('0x1f')]);_0x25d02c[_0x0b33('0x21')]=_[_0x0b33('0x22')](_0x25d02c[_0x0b33('0x1e')],_0x25d02c[_0x0b33('0x1f')]);_0x1e296d[_0x0b33('0x23')]=_[_0x0b33('0x22')](_0x25d02c[_0x0b33('0x1e')],qs[_0x0b33('0x24')](_0x4b2036['query'][_0x0b33('0x24')]));_0x1e296d[_0x0b33('0x23')]=_0x1e296d[_0x0b33('0x23')]['length']?_0x1e296d[_0x0b33('0x23')]:_0x25d02c[_0x0b33('0x1e')];if(_0x4b2036[_0x0b33('0x1f')][_0x0b33('0x39')]){_0x1e296d[_0x0b33('0x3a')]=[{'all':!![]}];}_0x1e296d=_[_0x0b33('0x2d')]({},_0x1e296d,_0x4b2036[_0x0b33('0x2e')]);return db[_0x0b33('0x1b')][_0x0b33('0x3b')](_0x1e296d)[_0x0b33('0x13')](handleEntityNotFound(_0x506e9e,null))[_0x0b33('0x13')](function(_0x58dd55){if(_0x58dd55[_0x0b33('0x31')]===_0x0b33('0x32')){var _0x1b96b0=encryptor[_0x0b33('0x33')](_0x58dd55['data3']);_0x58dd55[_0x0b33('0x34')]=maskClientSecret(_0x1b96b0);}return _0x58dd55;})['then'](respondWithResult(_0x506e9e,null))[_0x0b33('0x35')](handleError(_0x506e9e,null));};exports[_0x0b33('0x3c')]=function(_0x242861,_0x405c01){if(!_0x242861['body'][_0x0b33('0x17')])throw new Error(_0x0b33('0x3d'));if(!_0x242861[_0x0b33('0x3e')][_0x0b33('0x31')])throw new Error(_0x0b33('0x3f'));var _0x1b6a79=db[_0x0b33('0x1b')][_0x0b33('0x38')][_0x0b33('0x31')][_0x0b33('0x40')];if(!_0x1b6a79['includes'](_0x242861[_0x0b33('0x3e')][_0x0b33('0x31')]))throw new Error(_0x0b33('0x41')+_0x1b6a79['join'](',\x20'));if(_0x242861[_0x0b33('0x3e')][_0x0b33('0x31')]===_0x0b33('0x32')&&_0x242861[_0x0b33('0x3e')]['data3']){_0x242861[_0x0b33('0x3e')]['data3']=encryptor['encryptString'](_0x242861[_0x0b33('0x3e')]['data3']);}return db['CloudProvider'][_0x0b33('0x3c')](_0x242861['body'],{})[_0x0b33('0x13')](respondWithResult(_0x405c01,0xc9))[_0x0b33('0x35')](handleError(_0x405c01,null));};exports[_0x0b33('0x12')]=function(_0xd8373e,_0x19c0ab){if(_0xd8373e[_0x0b33('0x3e')]['id']){delete _0xd8373e['body']['id'];}return db[_0x0b33('0x1b')][_0x0b33('0x3b')]({'where':{'id':_0xd8373e[_0x0b33('0x37')]['id']}})[_0x0b33('0x13')](handleEntityNotFound(_0x19c0ab,null))[_0x0b33('0x13')](function(_0x3f64c2){if(_0x3f64c2[_0x0b33('0x31')]===_0x0b33('0x32')&&_0xd8373e['body']['data3']){_0xd8373e['body']['data3']=encryptor[_0x0b33('0x42')](_0xd8373e[_0x0b33('0x3e')][_0x0b33('0x34')]);}return _0x3f64c2;})[_0x0b33('0x13')](saveUpdates(_0xd8373e[_0x0b33('0x3e')],null))[_0x0b33('0x13')](respondWithResult(_0x19c0ab,null))[_0x0b33('0x35')](handleError(_0x19c0ab,null));};exports['destroy']=function(_0x397eaa,_0xab2071){return db['CloudProvider']['find']({'where':{'id':_0x397eaa[_0x0b33('0x37')]['id']}})[_0x0b33('0x13')](handleEntityNotFound(_0xab2071,null))['then'](removeEntity(_0xab2071,null))[_0x0b33('0x35')](handleError(_0xab2071,null));};exports[_0x0b33('0x43')]=function(_0x55b01e,_0x10647c){return db[_0x0b33('0x1b')][_0x0b33('0x44')]({'where':{'id':_0x55b01e[_0x0b33('0x37')]['id']},'raw':!![]})[_0x0b33('0x13')](function(_0x3bd97e){if(!_0x3bd97e)return _0x10647c[_0x0b33('0xa')](0x194);return{'url':oauth[_0x0b33('0x45')](_0x3bd97e,_0x55b01e['user']['id'])};})['then'](respondWithResult(_0x10647c,null))[_0x0b33('0x35')](handleError(_0x10647c,null));};exports[_0x0b33('0x46')]=function(_0x4e9dac,_0x14327d){var _0x405e4f=_0x4e9dac['body'];var _0x39950c;var _0x414339;if(_0x405e4f['error'])throw _0x405e4f;redis['get'](_0x405e4f['state'])[_0x0b33('0x13')](function(_0x4183a2){if(!_0x4183a2)throw new Error(_0x0b33('0x47'));_0x39950c=JSON['parse'](_0x4183a2);var _0x16b51c=Buffer[_0x0b33('0x48')](_0x405e4f[_0x0b33('0x49')],'base64')[_0x0b33('0x4a')](_0x0b33('0x4b'));_0x414339=JSON[_0x0b33('0x4c')](_0x16b51c);if(!oauth[_0x0b33('0x4d')](_0x405e4f[_0x0b33('0x4e')],_0x39950c[_0x0b33('0x4f')]))throw new Error(_0x0b33('0x50'));redis[_0x0b33('0x51')](_0x405e4f[_0x0b33('0x49')]);return oauth['getOauth2MicrosoftAccessToken'](_0x405e4f[_0x0b33('0x52')],_0x39950c);})[_0x0b33('0x13')](function(_0xb1f5d9){_0x39950c[_0x0b33('0x53')]=_0xb1f5d9[_0x0b33('0x54')];_0x39950c[_0x0b33('0x55')]=_0xb1f5d9['refresh_token'];return db[_0x0b33('0x1b')]['update']({'data5':_0x39950c[_0x0b33('0x53')],'data6':_0x39950c['data6']},{'where':{'id':_0x39950c['id']}});})['then'](function(){oauth[_0x0b33('0x56')](_0x39950c);socket[_0x0b33('0x57')](_0x0b33('0x58'),{'id':_0x414339['id']});return;})[_0x0b33('0x13')](respondWithStatusCode(_0x14327d,null))[_0x0b33('0x35')](function(_0x1a647a){if(_0x414339){socket[_0x0b33('0x57')](_0x0b33('0x59'),{'id':_0x414339['id']});}if(!_0x39950c){logger['error'](_0x0b33('0x5a'),_0x1a647a);return _0x14327d[_0x0b33('0xb')](0x1f4)[_0x0b33('0x5b')](_0x1a647a[_0x0b33('0x5c')]);}logger[_0x0b33('0x15')](_0x0b33('0x5d'),_0x39950c['id'],JSON[_0x0b33('0x5e')](_0x1a647a));});}; \ No newline at end of file +var _0x81ad=['join','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','Invalid\x20state\x20parameter','parse','from','state','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','send','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/encryptor','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','service','MicrosoftAzure','data3','catch','show','params','find','decryptString','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'];(function(_0x4b368a,_0x5e4556){var _0x1e16fb=function(_0x4ab059){while(--_0x4ab059){_0x4b368a['push'](_0x4b368a['shift']());}};_0x1e16fb(++_0x5e4556);}(_0x81ad,0xdf));var _0xd81a=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x81ad[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0xd81a('0x0'));var Redis=require(_0xd81a('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xd81a('0x2'));var config=require('../../config/environment');var logger=require(_0xd81a('0x3'))('api');var db=require(_0xd81a('0x4'))['db'];var oauth=require(_0xd81a('0x5'));config[_0xd81a('0x6')]=_[_0xd81a('0x7')](config[_0xd81a('0x6')],{'host':_0xd81a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x4a7a4f,_0x1feb24){_0x1feb24=_0x1feb24||0xcc;return function(_0x10b1b6){if(_0x10b1b6){return _0x4a7a4f[_0xd81a('0x9')](_0x1feb24);}return _0x4a7a4f[_0xd81a('0xa')](_0x1feb24)[_0xd81a('0xb')]();};}function respondWithResult(_0x33ec2c,_0x4f6655){_0x4f6655=_0x4f6655||0xc8;return function(_0xd3b543){if(_0xd3b543){return _0x33ec2c[_0xd81a('0xa')](_0x4f6655)[_0xd81a('0xc')](_0xd3b543);}};}function respondWithFilteredResult(_0x19de1a,_0x1e0124){return function(_0x1ddcb4){if(_0x1ddcb4){var _0x79614b=typeof _0x1e0124[_0xd81a('0xd')]===_0xd81a('0xe')&&typeof _0x1e0124[_0xd81a('0xf')]===_0xd81a('0xe');var _0x2f4ae8=_0x1ddcb4[_0xd81a('0x10')];var _0x5f2fba=_0x79614b?0x0:_0x1e0124[_0xd81a('0xd')];var _0xaa87fb=_0x79614b?_0x1ddcb4['count']:_0x1e0124[_0xd81a('0xd')]+_0x1e0124[_0xd81a('0xf')];var _0x4262a3;if(_0xaa87fb>=_0x2f4ae8){_0xaa87fb=_0x2f4ae8;_0x4262a3=0xc8;}else{_0x4262a3=0xce;}_0x19de1a['status'](_0x4262a3);return _0x19de1a[_0xd81a('0x11')](_0xd81a('0x12'),_0x5f2fba+'-'+_0xaa87fb+'/'+_0x2f4ae8)[_0xd81a('0xc')](_0x1ddcb4);}return null;};}function saveUpdates(_0x508b78){return function(_0x335345){if(_0x335345){return _0x335345[_0xd81a('0x13')](_0x508b78)[_0xd81a('0x14')](function(_0x14dfe4){return _0x14dfe4;});}return null;};}function removeEntity(_0x2faa06){return function(_0x5d48e4){if(_0x5d48e4){return _0x5d48e4[_0xd81a('0x15')]()[_0xd81a('0x14')](function(){_0x2faa06[_0xd81a('0xa')](0xcc)[_0xd81a('0xb')]();});}};}function handleEntityNotFound(_0x3a5e1c){return function(_0x45f993){if(!_0x45f993){_0x3a5e1c[_0xd81a('0x9')](0x194);}return _0x45f993;};}function handleError(_0x1e5188,_0x4afcac){_0x4afcac=_0x4afcac||0x1f4;return function(_0x172247){logger[_0xd81a('0x16')](_0x172247[_0xd81a('0x17')]);if(_0x172247[_0xd81a('0x18')]){delete _0x172247[_0xd81a('0x18')];}_0x1e5188['status'](_0x4afcac)['send'](_0x172247);};}function maskClientSecret(_0x4d429f){return _[_0xd81a('0x19')](_0x4d429f[_0xd81a('0x1a')](0x0,0x3),0x14,'*');}exports[_0xd81a('0x1b')]=function(_0x336a42,_0x340eac){var _0x4ab3cb={},_0x14bcbb={},_0x24ba29={'count':0x0,'rows':[]};var _0x99697d=_[_0xd81a('0x1c')](db[_0xd81a('0x1d')][_0xd81a('0x1e')],function(_0x3bca33){return{'name':_0x3bca33[_0xd81a('0x1f')],'type':_0x3bca33['type'][_0xd81a('0x20')]};});_0x14bcbb['model']=_[_0xd81a('0x1c')](_0x99697d,_0xd81a('0x18'));_0x14bcbb[_0xd81a('0x21')]=_[_0xd81a('0x22')](_0x336a42['query']);_0x14bcbb[_0xd81a('0x23')]=_[_0xd81a('0x24')](_0x14bcbb[_0xd81a('0x25')],_0x14bcbb[_0xd81a('0x21')]);_0x4ab3cb[_0xd81a('0x26')]=_[_0xd81a('0x24')](_0x14bcbb[_0xd81a('0x25')],qs[_0xd81a('0x27')](_0x336a42[_0xd81a('0x21')][_0xd81a('0x27')]));_0x4ab3cb[_0xd81a('0x26')]=_0x4ab3cb[_0xd81a('0x26')][_0xd81a('0x28')]?_0x4ab3cb[_0xd81a('0x26')]:_0x14bcbb[_0xd81a('0x25')];if(!_0x336a42['query'][_0xd81a('0x29')](_0xd81a('0x2a'))){_0x4ab3cb[_0xd81a('0xf')]=qs[_0xd81a('0xf')](_0x336a42['query'][_0xd81a('0xf')]);_0x4ab3cb[_0xd81a('0xd')]=qs[_0xd81a('0xd')](_0x336a42[_0xd81a('0x21')]['offset']);}_0x4ab3cb['order']=qs[_0xd81a('0x2b')](_0x336a42[_0xd81a('0x21')][_0xd81a('0x2b')]);_0x4ab3cb[_0xd81a('0x2c')]=qs['filters'](_[_0xd81a('0x2d')](_0x336a42[_0xd81a('0x21')],_0x14bcbb[_0xd81a('0x23')]),_0x99697d);if(_0x336a42[_0xd81a('0x21')][_0xd81a('0x2e')]){_0x4ab3cb[_0xd81a('0x2c')]=_['merge'](_0x4ab3cb['where'],{'$or':_['map'](_0x99697d,function(_0x2ebd87){if(_0x2ebd87[_0xd81a('0x2f')]!==_0xd81a('0x30')){var _0x52f763={};_0x52f763[_0x2ebd87[_0xd81a('0x18')]]={'$like':'%'+_0x336a42[_0xd81a('0x21')]['filter']+'%'};return _0x52f763;}})});}_0x4ab3cb=_[_0xd81a('0x31')]({},_0x4ab3cb,_0x336a42['options']);var _0xeb1e61={'where':_0x4ab3cb[_0xd81a('0x2c')]};return db[_0xd81a('0x1d')][_0xd81a('0x10')](_0xeb1e61)['then'](function(_0x45a46b){_0x24ba29[_0xd81a('0x10')]=_0x45a46b;if(_0x336a42[_0xd81a('0x21')][_0xd81a('0x32')]){_0x4ab3cb[_0xd81a('0x33')]=[{'all':!![]}];}return db[_0xd81a('0x1d')][_0xd81a('0x34')](_0x4ab3cb);})[_0xd81a('0x14')](function(_0x562ae4){_0x24ba29[_0xd81a('0x35')]=_[_0xd81a('0x1c')](_0x562ae4,function(_0x1838bc){if(_0x1838bc[_0xd81a('0x36')]===_0xd81a('0x37')){var _0x497134=encryptor['decryptString'](_0x1838bc[_0xd81a('0x38')]);_0x1838bc[_0xd81a('0x38')]=maskClientSecret(_0x497134);}return _0x1838bc;});return _0x24ba29;})[_0xd81a('0x14')](respondWithFilteredResult(_0x340eac,_0x4ab3cb))[_0xd81a('0x39')](handleError(_0x340eac,null));};exports[_0xd81a('0x3a')]=function(_0x28cb14,_0x8f5f56){var _0x51c27c={'raw':!![],'where':{'id':_0x28cb14[_0xd81a('0x3b')]['id']}},_0x1abced={};_0x1abced[_0xd81a('0x25')]=_[_0xd81a('0x22')](db['CloudProvider'][_0xd81a('0x1e')]);_0x1abced[_0xd81a('0x21')]=_[_0xd81a('0x22')](_0x28cb14[_0xd81a('0x21')]);_0x1abced[_0xd81a('0x23')]=_[_0xd81a('0x24')](_0x1abced['model'],_0x1abced[_0xd81a('0x21')]);_0x51c27c[_0xd81a('0x26')]=_[_0xd81a('0x24')](_0x1abced[_0xd81a('0x25')],qs['fields'](_0x28cb14[_0xd81a('0x21')][_0xd81a('0x27')]));_0x51c27c['attributes']=_0x51c27c['attributes']['length']?_0x51c27c[_0xd81a('0x26')]:_0x1abced['model'];if(_0x28cb14[_0xd81a('0x21')][_0xd81a('0x32')]){_0x51c27c['include']=[{'all':!![]}];}_0x51c27c=_['merge']({},_0x51c27c,_0x28cb14['options']);return db[_0xd81a('0x1d')][_0xd81a('0x3c')](_0x51c27c)['then'](handleEntityNotFound(_0x8f5f56,null))[_0xd81a('0x14')](function(_0x453f5a){if(_0x453f5a[_0xd81a('0x36')]==='MicrosoftAzure'){var _0x3c72e1=encryptor[_0xd81a('0x3d')](_0x453f5a[_0xd81a('0x38')]);_0x453f5a[_0xd81a('0x38')]=maskClientSecret(_0x3c72e1);}return _0x453f5a;})[_0xd81a('0x14')](respondWithResult(_0x8f5f56,null))['catch'](handleError(_0x8f5f56,null));};exports['create']=function(_0x462e4d,_0x4fbd6c){if(!_0x462e4d[_0xd81a('0x3e')][_0xd81a('0x18')])throw new Error(_0xd81a('0x3f'));if(!_0x462e4d[_0xd81a('0x3e')][_0xd81a('0x36')])throw new Error(_0xd81a('0x40'));var _0x8e7353=db[_0xd81a('0x1d')][_0xd81a('0x1e')][_0xd81a('0x36')][_0xd81a('0x41')];if(!_0x8e7353[_0xd81a('0x42')](_0x462e4d[_0xd81a('0x3e')][_0xd81a('0x36')]))throw new Error(_0xd81a('0x43')+_0x8e7353[_0xd81a('0x44')](',\x20'));if(_0x462e4d[_0xd81a('0x3e')]['service']===_0xd81a('0x37')&&_0x462e4d[_0xd81a('0x3e')][_0xd81a('0x38')]){_0x462e4d[_0xd81a('0x3e')][_0xd81a('0x38')]=encryptor[_0xd81a('0x45')](_0x462e4d['body']['data3']);}return db[_0xd81a('0x1d')][_0xd81a('0x46')](_0x462e4d['body'],{})[_0xd81a('0x14')](respondWithResult(_0x4fbd6c,0xc9))[_0xd81a('0x39')](handleError(_0x4fbd6c,null));};exports[_0xd81a('0x13')]=function(_0x302a54,_0x3fadba){if(_0x302a54[_0xd81a('0x3e')]['id']){delete _0x302a54[_0xd81a('0x3e')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x302a54[_0xd81a('0x3b')]['id']}})[_0xd81a('0x14')](handleEntityNotFound(_0x3fadba,null))[_0xd81a('0x14')](function(_0x18b7a0){if(_0x18b7a0['service']===_0xd81a('0x37')&&_0x302a54[_0xd81a('0x3e')][_0xd81a('0x38')]){_0x302a54['body'][_0xd81a('0x38')]=encryptor[_0xd81a('0x45')](_0x302a54[_0xd81a('0x3e')][_0xd81a('0x38')]);}return _0x18b7a0;})[_0xd81a('0x14')](saveUpdates(_0x302a54[_0xd81a('0x3e')],null))['then'](respondWithResult(_0x3fadba,null))[_0xd81a('0x39')](handleError(_0x3fadba,null));};exports[_0xd81a('0x15')]=function(_0x2175b5,_0x363ab6){return db[_0xd81a('0x1d')][_0xd81a('0x3c')]({'where':{'id':_0x2175b5['params']['id']}})[_0xd81a('0x14')](handleEntityNotFound(_0x363ab6,null))['then'](removeEntity(_0x363ab6,null))[_0xd81a('0x39')](handleError(_0x363ab6,null));};exports[_0xd81a('0x47')]=function(_0x381c5d,_0x48dbb8){return db[_0xd81a('0x1d')][_0xd81a('0x48')]({'where':{'id':_0x381c5d[_0xd81a('0x3b')]['id']},'raw':!![]})['then'](function(_0x46210a){if(!_0x46210a)return _0x48dbb8['sendStatus'](0x194);return{'url':oauth[_0xd81a('0x49')](_0x46210a,_0x381c5d[_0xd81a('0x4a')]['id'])};})['then'](respondWithResult(_0x48dbb8,null))[_0xd81a('0x39')](handleError(_0x48dbb8,null));};exports['oauth2MicrosoftCallback']=function(_0x479365,_0x1e33f4){var _0x959526=_0x479365[_0xd81a('0x3e')];var _0x370bde;var _0x4b54b4;if(_0x959526['error'])throw _0x959526;redis['get'](_0x959526['state'])[_0xd81a('0x14')](function(_0x503f59){if(!_0x503f59)throw new Error(_0xd81a('0x4b'));_0x370bde=JSON[_0xd81a('0x4c')](_0x503f59);var _0x9edb31=Buffer[_0xd81a('0x4d')](_0x959526[_0xd81a('0x4e')],'base64')[_0xd81a('0x4f')](_0xd81a('0x50'));_0x4b54b4=JSON[_0xd81a('0x4c')](_0x9edb31);if(!oauth['isValidIdToken'](_0x959526[_0xd81a('0x51')],_0x370bde[_0xd81a('0x52')]))throw new Error(_0xd81a('0x53'));redis[_0xd81a('0x54')](_0x959526[_0xd81a('0x4e')]);return oauth[_0xd81a('0x55')](_0x959526[_0xd81a('0x56')],_0x370bde);})[_0xd81a('0x14')](function(_0xc25183){_0x370bde[_0xd81a('0x57')]=_0xc25183[_0xd81a('0x58')];_0x370bde[_0xd81a('0x59')]=_0xc25183[_0xd81a('0x5a')];return db[_0xd81a('0x1d')][_0xd81a('0x13')]({'data5':_0x370bde[_0xd81a('0x57')],'data6':_0x370bde['data6']},{'where':{'id':_0x370bde['id']}});})['then'](function(){oauth[_0xd81a('0x5b')](_0x370bde);socket[_0xd81a('0x5c')](_0xd81a('0x5d'),{'id':_0x4b54b4['id']});return;})['then'](respondWithStatusCode(_0x1e33f4,null))[_0xd81a('0x39')](function(_0x20bfd4){if(_0x4b54b4){socket[_0xd81a('0x5c')](_0xd81a('0x5e'),{'id':_0x4b54b4['id']});}if(!_0x370bde){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x20bfd4);return _0x1e33f4[_0xd81a('0xa')](0x1f4)[_0xd81a('0x5f')](_0x20bfd4['message']);}logger['error'](_0xd81a('0x60'),_0x370bde['id'],JSON['stringify'](_0x20bfd4));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 4eb03e9..2ff0847 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 _0x29a8=['rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x29a8,0x158));var _0x829a=function(_0x102d1c,_0x36f1e4){_0x102d1c=_0x102d1c-0x0;var _0x5b9be5=_0x29a8[_0x102d1c];return _0x5b9be5;};'use strict';var _=require(_0x829a('0x0'));var util=require(_0x829a('0x1'));var logger=require(_0x829a('0x2'))(_0x829a('0x3'));var moment=require(_0x829a('0x4'));var BPromise=require(_0x829a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x829a('0x6'));var rimraf=require(_0x829a('0x7'));var config=require(_0x829a('0x8'));var attributes=require(_0x829a('0x9'));module[_0x829a('0xa')]=function(_0x424a75,_0x42bf2b){return _0x424a75[_0x829a('0xb')](_0x829a('0xc'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe52c=['path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','../../config/logger','api','moment','bluebird'];(function(_0x19b2d2,_0x2485b2){var _0x183e8e=function(_0x47b88b){while(--_0x47b88b){_0x19b2d2['push'](_0x19b2d2['shift']());}};_0x183e8e(++_0x2485b2);}(_0xe52c,0x196));var _0xce52=function(_0x3c36aa,_0x52a733){_0x3c36aa=_0x3c36aa-0x0;var _0x210dfb=_0xe52c[_0x3c36aa];return _0x210dfb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xce52('0x0'))(_0xce52('0x1'));var moment=require(_0xce52('0x2'));var BPromise=require(_0xce52('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce52('0x4'));var rimraf=require(_0xce52('0x5'));var config=require('../../config/environment');var attributes=require(_0xce52('0x6'));module[_0xce52('0x7')]=function(_0xf4bd3,_0xd1fe8f){return _0xf4bd3[_0xce52('0x8')](_0xce52('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 6b48393..d5a19a5 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74d8=['https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','data7','Outlook365','/.default','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','join','redirect_uri','response_mode','form_post','scope','state','nonce','login','key','value','oauth2Claims','oauth2/','set','payload','iss','issuer','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','data4','decryptString','POST','data5','access_token','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0x74d8,0x1e6));var _0x874d=function(_0x355b43,_0x1ea26e){_0x355b43=_0x355b43-0x0;var _0x122791=_0x74d8[_0x355b43];return _0x122791;};'use strict';var _=require('lodash');var crypto=require(_0x874d('0x0'));var jwt=require('jsonwebtoken');var moment=require(_0x874d('0x1'));var Redis=require(_0x874d('0x2'));var rp=require(_0x874d('0x3'));var util=require(_0x874d('0x4'));var encryptor=require(_0x874d('0x5'));var config=require(_0x874d('0x6'));var logger=require('../../config/logger')(_0x874d('0x7'));var schedule=require(_0x874d('0x8'));var db=require(_0x874d('0x9'))['db'];config[_0x874d('0xa')]=_[_0x874d('0xb')](config[_0x874d('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x874d('0xa')]);var MICROSOFT_AUTH_URL=_0x874d('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x874d('0xd'),_0x874d('0xe'),_0x874d('0xf'),_0x874d('0x10'),_0x874d('0x11'),_0x874d('0x12'),_0x874d('0x13')],'Dynamics365':[_0x874d('0xd'),_0x874d('0x10')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x874d('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xa820ae){var _0x53fb65=_[_0x874d('0x15')](AZURE_AUTH_SCOPES[_0xa820ae[_0x874d('0x16')]]);if(_0xa820ae[_0x874d('0x16')]===_0x874d('0x17'))_0x53fb65[_0x874d('0x18')](_0xa820ae[_0x874d('0x19')]+'/.default');return _0x53fb65['join']('\x20');}function getAccessTokenScope(_0x4c837f){if(_0x4c837f[_0x874d('0x16')]===_0x874d('0x1a'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x4c837f[_0x874d('0x16')]===_0x874d('0x17'))return _0x4c837f[_0x874d('0x19')]+_0x874d('0x1b');}function generateMicrosoftAuthorizationUrl(_0xbfb63a,_0x440f51){var _0xafdbf3=MICROSOFT_AUTH_URL[_0x874d('0x1c')](_0x874d('0x1d'),_0xbfb63a[_0x874d('0x1e')]);var _0x472b46=[_0x874d('0x1f'),_0x874d('0x20')];var _0x2a4a9e=Buffer[_0x874d('0x21')](JSON[_0x874d('0x22')]({'id':_0x440f51}))[_0x874d('0x23')](_0x874d('0x24'));var _0x55d5fa=crypto[_0x874d('0x25')](0x10)[_0x874d('0x23')](_0x874d('0x26'));var _0x20fb59=getAuthorizationScopes(_0xbfb63a);var _0x3800e4=[{'key':_0x874d('0x27'),'value':_0xbfb63a[_0x874d('0x28')]},{'key':_0x874d('0x29'),'value':encodeURIComponent(_0x472b46[_0x874d('0x2a')]('\x20'))},{'key':_0x874d('0x2b'),'value':_0xbfb63a['data4']},{'key':_0x874d('0x2c'),'value':_0x874d('0x2d')},{'key':_0x874d('0x2e'),'value':encodeURIComponent(_0x20fb59)},{'key':_0x874d('0x2f'),'value':_0x2a4a9e},{'key':_0x874d('0x30'),'value':_0x55d5fa},{'key':'prompt','value':_0x874d('0x31')}];var _0x4759ed=_0xafdbf3+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x874d('0x15')](_0x3800e4,function(_0x5e7091){return _0x5e7091[_0x874d('0x32')]+'='+_0x5e7091[_0x874d('0x33')];})[_0x874d('0x2a')]('&');_0xbfb63a[_0x874d('0x34')]={'issuer':_0xafdbf3['replace'](_0x874d('0x35'),''),'audience':_0xbfb63a[_0x874d('0x28')],'state':_0x2a4a9e,'nonce':_0x55d5fa};redis[_0x874d('0x36')](_0x2a4a9e,JSON[_0x874d('0x22')](_0xbfb63a));return _0x4759ed;}function isValidIdToken(_0x2a615c,_0x4c3cf7){try{var _0x554582=jwt['decode'](_0x2a615c,{'complete':!![]});var _0x37b876=_0x554582[_0x874d('0x37')];if(_0x37b876[_0x874d('0x38')]!==_0x4c3cf7[_0x874d('0x39')])return![];if(_0x37b876['aud']!==_0x4c3cf7['audience'])return![];if(_0x37b876[_0x874d('0x30')]!==_0x4c3cf7[_0x874d('0x30')])return![];if(moment()[_0x874d('0x3a')](moment[_0x874d('0x3b')](_0x37b876[_0x874d('0x3c')])))return![];return!![];}catch(_0x4bd205){throw _0x4bd205;}}function refreshOauth2MicrosoftAccessToken(_0xb10920){return Promise[_0x874d('0x3d')]()[_0x874d('0x3e')](function(){if(_0xb10920[_0x874d('0x3f')])return _0xb10920;return db[_0x874d('0x40')][_0x874d('0x41')]({'where':{'id':_0xb10920['id']},'raw':!![]});})[_0x874d('0x3e')](function(_0x33428e){var _0x1e765f={'grant_type':_0x874d('0x42'),'refresh_token':_0x33428e[_0x874d('0x43')],'scope':getAccessTokenScope(_0x33428e),'redirect_uri':_0x33428e[_0x874d('0x44')],'client_id':_0x33428e[_0x874d('0x28')],'client_secret':encryptor[_0x874d('0x45')](_0x33428e['data3'])};var _0x598371={'method':_0x874d('0x46'),'uri':MICROSOFT_AUTH_URL['replace'](_0x874d('0x1d'),_0x33428e[_0x874d('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1e765f,'json':!![]};return rp(_0x598371);})[_0x874d('0x3e')](function(_0x2cd9d2){_0xb10920[_0x874d('0x47')]=_0x2cd9d2[_0x874d('0x48')];_0xb10920['data6']=_0x2cd9d2['refresh_token'];return db[_0x874d('0x40')]['update']({'data5':_0xb10920[_0x874d('0x47')],'data6':_0xb10920[_0x874d('0x43')]},{'where':{'id':_0xb10920['id']}});})[_0x874d('0x3e')](function(){return _0xb10920;})[_0x874d('0x49')](function(_0x54c5fa){logger[_0x874d('0x4a')](_0x874d('0x4b'),_0xb10920['id'],_0x54c5fa);});}function getOauth2MicrosoftAccessToken(_0x1842ce,_0x36bf18){var _0x2301f3={'grant_type':_0x874d('0x4c'),'code':_0x1842ce,'scope':getAccessTokenScope(_0x36bf18),'redirect_uri':_0x36bf18[_0x874d('0x44')],'client_id':_0x36bf18[_0x874d('0x28')],'client_secret':encryptor[_0x874d('0x45')](_0x36bf18['data3'])};var _0x166de7={'method':_0x874d('0x46'),'uri':MICROSOFT_AUTH_URL[_0x874d('0x1c')](_0x874d('0x1d'),_0x36bf18[_0x874d('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2301f3,'json':!![]};return rp(_0x166de7);}function startRefreshInterval(_0x5ed234){var _0x26de0e=schedule[_0x874d('0x4d')];if(_0x26de0e[_0x5ed234['id']])clearInterval(_0x26de0e[_0x5ed234['id']]);_0x26de0e[_0x5ed234['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x5ed234['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x874d('0x4d')]=_0x26de0e;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x874d('0x4e')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x874d('0x3e')](function(_0x434684){var _0x1b0a61=_0x434684[_0x874d('0x15')](function(_0x1a2ea4){return refreshOauth2MicrosoftAccessToken(_0x1a2ea4)['then'](function(_0x475806){startRefreshInterval(_0x475806);});});return Promise[_0x874d('0x4f')](_0x1b0a61);})['catch'](function(_0x1f2cfd){var _0x2db8bf=_0x1f2cfd?util[_0x874d('0x50')](_0x1f2cfd,{'showHidden':![],'depth':null}):'';logger[_0x874d('0x4a')](_0x874d('0x51'),_0x2db8bf);});}module[_0x874d('0x52')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x492a=['catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','findAll','all','exports','lodash','crypto','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','openid','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','Dynamics365','push','data7','/.default','join','type','Outlook365','replace','{TENANT_ID}','id_token','from','stringify','base64','randomBytes','toString','hex','response_type','redirect_uri','response_mode','form_post','scope','state','login','key','oauth2Claims','oauth2/','data1','set','decode','payload','iss','audience','nonce','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','data4','POST','data5','update'];(function(_0x34ced0,_0x21907f){var _0x3db58d=function(_0x51fb31){while(--_0x51fb31){_0x34ced0['push'](_0x34ced0['shift']());}};_0x3db58d(++_0x21907f);}(_0x492a,0x1cb));var _0xa492=function(_0x9ef902,_0x25ed15){_0x9ef902=_0x9ef902-0x0;var _0x126e46=_0x492a[_0x9ef902];return _0x126e46;};'use strict';var _=require(_0xa492('0x0'));var crypto=require(_0xa492('0x1'));var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require(_0xa492('0x2'));var rp=require(_0xa492('0x3'));var util=require('util');var encryptor=require(_0xa492('0x4'));var config=require(_0xa492('0x5'));var logger=require(_0xa492('0x6'))(_0xa492('0x7'));var schedule=require(_0xa492('0x8'));var db=require(_0xa492('0x9'))['db'];config[_0xa492('0xa')]=_[_0xa492('0xb')](config[_0xa492('0xa')],{'host':_0xa492('0xc'),'port':0x18eb});var redis=new Redis(config[_0xa492('0xa')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xa492('0xd'),'profile',_0xa492('0xe'),'offline_access',_0xa492('0xf'),_0xa492('0x10'),_0xa492('0x11')],'Dynamics365':[_0xa492('0xd'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xa492('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xa492('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x220cea){var _0xe165c=_[_0xa492('0x14')](AZURE_AUTH_SCOPES[_0x220cea['type']]);if(_0x220cea['type']===_0xa492('0x15'))_0xe165c[_0xa492('0x16')](_0x220cea[_0xa492('0x17')]+_0xa492('0x18'));return _0xe165c[_0xa492('0x19')]('\x20');}function getAccessTokenScope(_0x18e52e){if(_0x18e52e[_0xa492('0x1a')]===_0xa492('0x1b'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x18e52e['type']===_0xa492('0x15'))return _0x18e52e[_0xa492('0x17')]+_0xa492('0x18');}function generateMicrosoftAuthorizationUrl(_0x59a70a,_0x23eda0){var _0x93fa60=MICROSOFT_AUTH_URL[_0xa492('0x1c')](_0xa492('0x1d'),_0x59a70a['data2']);var _0x1422c9=['code',_0xa492('0x1e')];var _0x4c663a=Buffer[_0xa492('0x1f')](JSON[_0xa492('0x20')]({'id':_0x23eda0}))['toString'](_0xa492('0x21'));var _0x339984=crypto[_0xa492('0x22')](0x10)[_0xa492('0x23')](_0xa492('0x24'));var _0x1caf9d=getAuthorizationScopes(_0x59a70a);var _0x460734=[{'key':'client_id','value':_0x59a70a['data1']},{'key':_0xa492('0x25'),'value':encodeURIComponent(_0x1422c9[_0xa492('0x19')]('\x20'))},{'key':_0xa492('0x26'),'value':_0x59a70a['data4']},{'key':_0xa492('0x27'),'value':_0xa492('0x28')},{'key':_0xa492('0x29'),'value':encodeURIComponent(_0x1caf9d)},{'key':_0xa492('0x2a'),'value':_0x4c663a},{'key':'nonce','value':_0x339984},{'key':'prompt','value':_0xa492('0x2b')}];var _0x5d66f0=_0x93fa60+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xa492('0x14')](_0x460734,function(_0x44aa2d){return _0x44aa2d[_0xa492('0x2c')]+'='+_0x44aa2d['value'];})[_0xa492('0x19')]('&');_0x59a70a[_0xa492('0x2d')]={'issuer':_0x93fa60[_0xa492('0x1c')](_0xa492('0x2e'),''),'audience':_0x59a70a[_0xa492('0x2f')],'state':_0x4c663a,'nonce':_0x339984};redis[_0xa492('0x30')](_0x4c663a,JSON[_0xa492('0x20')](_0x59a70a));return _0x5d66f0;}function isValidIdToken(_0x4fa3a3,_0x1d89ef){try{var _0x52f9a7=jwt[_0xa492('0x31')](_0x4fa3a3,{'complete':!![]});var _0x17a1ec=_0x52f9a7[_0xa492('0x32')];if(_0x17a1ec[_0xa492('0x33')]!==_0x1d89ef['issuer'])return![];if(_0x17a1ec['aud']!==_0x1d89ef[_0xa492('0x34')])return![];if(_0x17a1ec[_0xa492('0x35')]!==_0x1d89ef[_0xa492('0x35')])return![];if(moment()['isAfter'](moment[_0xa492('0x36')](_0x17a1ec['exp'])))return![];return!![];}catch(_0x5938da){throw _0x5938da;}}function refreshOauth2MicrosoftAccessToken(_0x2759eb){return Promise[_0xa492('0x37')]()[_0xa492('0x38')](function(){if(_0x2759eb[_0xa492('0x39')])return _0x2759eb;return db[_0xa492('0x3a')][_0xa492('0x3b')]({'where':{'id':_0x2759eb['id']},'raw':!![]});})[_0xa492('0x38')](function(_0x1cdd56){var _0x4b12d7={'grant_type':_0xa492('0x3c'),'refresh_token':_0x1cdd56[_0xa492('0x3d')],'scope':getAccessTokenScope(_0x1cdd56),'redirect_uri':_0x1cdd56[_0xa492('0x3e')],'client_id':_0x1cdd56[_0xa492('0x2f')],'client_secret':encryptor['decryptString'](_0x1cdd56[_0xa492('0x39')])};var _0x14dbf2={'method':_0xa492('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0xa492('0x1d'),_0x1cdd56['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4b12d7,'json':!![]};return rp(_0x14dbf2);})[_0xa492('0x38')](function(_0x40ac73){_0x2759eb[_0xa492('0x40')]=_0x40ac73['access_token'];_0x2759eb[_0xa492('0x3d')]=_0x40ac73[_0xa492('0x3c')];return db[_0xa492('0x3a')][_0xa492('0x41')]({'data5':_0x2759eb[_0xa492('0x40')],'data6':_0x2759eb[_0xa492('0x3d')]},{'where':{'id':_0x2759eb['id']}});})['then'](function(){return _0x2759eb;})[_0xa492('0x42')](function(_0xefea69){logger[_0xa492('0x43')](_0xa492('0x44'),_0x2759eb['id'],_0xefea69);});}function getOauth2MicrosoftAccessToken(_0x575c6b,_0x1585bb){var _0x46b7bc={'grant_type':_0xa492('0x45'),'code':_0x575c6b,'scope':getAccessTokenScope(_0x1585bb),'redirect_uri':_0x1585bb['data4'],'client_id':_0x1585bb[_0xa492('0x2f')],'client_secret':encryptor[_0xa492('0x46')](_0x1585bb[_0xa492('0x39')])};var _0x20a0a5={'method':_0xa492('0x3f'),'uri':MICROSOFT_AUTH_URL[_0xa492('0x1c')]('{TENANT_ID}',_0x1585bb['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x46b7bc,'json':!![]};return rp(_0x20a0a5);}function startRefreshInterval(_0x3c4411){var _0x5ca6d6=schedule['intervals'];if(_0x5ca6d6[_0x3c4411['id']])clearInterval(_0x5ca6d6[_0x3c4411['id']]);_0x5ca6d6[_0x3c4411['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x3c4411['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xa492('0x47')]=_0x5ca6d6;}function startAllRefreshIntervals(){return db[_0xa492('0x3a')][_0xa492('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa492('0x38')](function(_0x4a9c60){var _0x56919c=_0x4a9c60[_0xa492('0x14')](function(_0xef644a){return refreshOauth2MicrosoftAccessToken(_0xef644a)[_0xa492('0x38')](function(_0x35f4a7){startRefreshInterval(_0x35f4a7);});});return Promise[_0xa492('0x49')](_0x56919c);})['catch'](function(_0x487bad){var _0x3ea61f=_0x487bad?util['inspect'](_0x487bad,{'showHidden':![],'depth':null}):'';logger[_0xa492('0x43')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x3ea61f);});}module[_0xa492('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 98ca94a..130884a 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 _0xb2af=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb2af,0xd2));var _0xfb2a=function(_0x49742b,_0x21e377){_0x49742b=_0x49742b-0x0;var _0x488468=_0xb2af[_0x49742b];return _0x488468;};'use strict';var _=require(_0xfb2a('0x0'));var util=require(_0xfb2a('0x1'));var moment=require(_0xfb2a('0x2'));var BPromise=require(_0xfb2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb2a('0x4'));var db=require(_0xfb2a('0x5'))['db'];var utils=require(_0xfb2a('0x6'));var logger=require(_0xfb2a('0x7'))(_0xfb2a('0x8'));var config=require('../../config/environment');var jayson=require(_0xfb2a('0x9'));var client=jayson[_0xfb2a('0xa')][_0xfb2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55cf25,_0x715404,_0x3e20de){return new BPromise(function(_0x1f3315,_0x55bb4e){return client[_0xfb2a('0xc')](_0x55cf25,_0x3e20de)[_0xfb2a('0xd')](function(_0x3d3333){logger[_0xfb2a('0xe')](_0xfb2a('0xf'),_0x715404,_0xfb2a('0x10'));logger[_0xfb2a('0x11')](_0xfb2a('0x12'),_0x715404,_0xfb2a('0x10'),JSON[_0xfb2a('0x13')](_0x3d3333));if(_0x3d3333[_0xfb2a('0x14')]){if(_0x3d3333[_0xfb2a('0x14')]['code']===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x715404,_0x3d3333[_0xfb2a('0x14')][_0xfb2a('0x15')]);return _0x55bb4e(_0x3d3333[_0xfb2a('0x14')][_0xfb2a('0x15')]);}logger['error'](_0xfb2a('0xf'),_0x715404,_0x3d3333['error']['message']);return _0x1f3315(_0x3d3333[_0xfb2a('0x14')]['message']);}else{logger['info'](_0xfb2a('0xf'),_0x715404,_0xfb2a('0x10'));_0x1f3315(_0x3d3333[_0xfb2a('0x16')][_0xfb2a('0x15')]);}})[_0xfb2a('0x17')](function(_0xc85abf){logger[_0xfb2a('0x14')](_0xfb2a('0xf'),_0x715404,_0xc85abf);_0x55bb4e(_0xc85abf);});});} \ No newline at end of file +var _0x8325=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','randomstring'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8325,0x1f1));var _0x5832=function(_0x37a73b,_0x569e74){_0x37a73b=_0x37a73b-0x0;var _0x39cee2=_0x8325[_0x37a73b];return _0x39cee2;};'use strict';var _=require(_0x5832('0x0'));var util=require('util');var moment=require(_0x5832('0x1'));var BPromise=require('bluebird');var rs=require(_0x5832('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5832('0x3'))['db'];var utils=require(_0x5832('0x4'));var logger=require(_0x5832('0x5'))(_0x5832('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5832('0x7')][_0x5832('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8b3b30,_0xe80d1d,_0xb4e9b9){return new BPromise(function(_0x333780,_0x495531){return client[_0x5832('0x9')](_0x8b3b30,_0xb4e9b9)[_0x5832('0xa')](function(_0x10192d){logger[_0x5832('0xb')](_0x5832('0xc'),_0xe80d1d,_0x5832('0xd'));logger[_0x5832('0xe')](_0x5832('0xf'),_0xe80d1d,_0x5832('0xd'),JSON['stringify'](_0x10192d));if(_0x10192d['error']){if(_0x10192d[_0x5832('0x10')][_0x5832('0x11')]===0x1f4){logger[_0x5832('0x10')](_0x5832('0xc'),_0xe80d1d,_0x10192d['error']['message']);return _0x495531(_0x10192d[_0x5832('0x10')][_0x5832('0x12')]);}logger[_0x5832('0x10')](_0x5832('0xc'),_0xe80d1d,_0x10192d['error'][_0x5832('0x12')]);return _0x333780(_0x10192d[_0x5832('0x10')][_0x5832('0x12')]);}else{logger[_0x5832('0xb')]('CloudProvider,\x20%s,\x20%s',_0xe80d1d,_0x5832('0xd'));_0x333780(_0x10192d[_0x5832('0x13')][_0x5832('0x12')]);}})['catch'](function(_0x32d360){logger[_0x5832('0x10')](_0x5832('0xc'),_0xe80d1d,_0x32d360);_0x495531(_0x32d360);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index d338894..fea1fe4 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 _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x328d50,_0x4da1a9){var _0x19f171=function(_0x4ea53b){while(--_0x4ea53b){_0x328d50['push'](_0x328d50['shift']());}};_0x19f171(++_0x4da1a9);}(_0xadb5,0xad));var _0x5adb=function(_0x5bb743,_0x40462f){_0x5bb743=_0x5bb743-0x0;var _0x565df5=_0xadb5[_0x5bb743];return _0x565df5;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c3f08,_0x380f2b){_0x2c3f08=_0x2c3f08-0x0;var _0x4ea2ab=_0x5f2f[_0x2c3f08];return _0x4ea2ab;};'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')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 9e0e207..d88ce70 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 _0xe2bb=['STRING','name','sequelize'];(function(_0x46fbee,_0x4bbebd){var _0x1528a1=function(_0x5bbaf1){while(--_0x5bbaf1){_0x46fbee['push'](_0x46fbee['shift']());}};_0x1528a1(++_0x4bbebd);}(_0xe2bb,0x13d));var _0xbe2b=function(_0x6c00b2,_0x2769d4){_0x6c00b2=_0x6c00b2-0x0;var _0x255585=_0xe2bb[_0x6c00b2];return _0x255585;};'use strict';var Sequelize=require(_0xbe2b('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe2b('0x1')],'unique':_0xbe2b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbe2b('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xbe2b('0x1')]},'phone':{'type':Sequelize[_0xbe2b('0x1')]},'fax':{'type':Sequelize[_0xbe2b('0x1')]},'type':{'type':Sequelize[_0xbe2b('0x1')]},'street':{'type':Sequelize[_0xbe2b('0x1')]},'postalCode':{'type':Sequelize[_0xbe2b('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xbe2b('0x1')]},'email':{'type':Sequelize[_0xbe2b('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbe2b('0x1')]},'sStreet':{'type':Sequelize[_0xbe2b('0x1')]},'sPostalCode':{'type':Sequelize[_0xbe2b('0x1')]},'sCity':{'type':Sequelize[_0xbe2b('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbe2b('0x1')]}}; \ No newline at end of file +var _0x1d6f=['STRING','sequelize'];(function(_0x340165,_0x27fd27){var _0x346e2a=function(_0x4b3839){while(--_0x4b3839){_0x340165['push'](_0x340165['shift']());}};_0x346e2a(++_0x27fd27);}(_0x1d6f,0x171));var _0xf1d6=function(_0x141323,_0x4c0370){_0x141323=_0x141323-0x0;var _0x1cb78f=_0x1d6f[_0x141323];return _0x1cb78f;};'use strict';var Sequelize=require(_0xf1d6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xf1d6('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xf1d6('0x1')]},'phone':{'type':Sequelize[_0xf1d6('0x1')]},'fax':{'type':Sequelize[_0xf1d6('0x1')]},'type':{'type':Sequelize[_0xf1d6('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xf1d6('0x1')]},'city':{'type':Sequelize[_0xf1d6('0x1')]},'country':{'type':Sequelize[_0xf1d6('0x1')]},'email':{'type':Sequelize[_0xf1d6('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xf1d6('0x1')]},'sPostalCode':{'type':Sequelize[_0xf1d6('0x1')]},'sCity':{'type':Sequelize[_0xf1d6('0x1')]},'sCountry':{'type':Sequelize[_0xf1d6('0x1')]},'description':{'type':Sequelize[_0xf1d6('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index c727dcd..d7c1abe 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 _0xcc23=['name','send','CmCompany','describe','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','filters','pick','filter','map','merge','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','order','sort','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','error','stack'];(function(_0x25e109,_0x6ab24c){var _0xc0f7d6=function(_0x2fb92b){while(--_0x2fb92b){_0x25e109['push'](_0x25e109['shift']());}};_0xc0f7d6(++_0x6ab24c);}(_0xcc23,0x178));var _0x3cc2=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0xcc23[_0x50e40b];return _0x2608b7;};'use strict';var emlformat=require(_0x3cc2('0x0'));var rimraf=require(_0x3cc2('0x1'));var zipdir=require(_0x3cc2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3cc2('0x3'));var moment=require(_0x3cc2('0x4'));var BPromise=require(_0x3cc2('0x5'));var Mustache=require(_0x3cc2('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3cc2('0x7'));var csv=require(_0x3cc2('0x8'));var ejs=require(_0x3cc2('0x9'));var fs=require('fs');var fs_extra=require(_0x3cc2('0xa'));var _=require('lodash');var squel=require(_0x3cc2('0xb'));var crypto=require('crypto');var jsforce=require(_0x3cc2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3cc2('0x8'));var querystring=require(_0x3cc2('0xd'));var Papa=require('papaparse');var Redis=require(_0x3cc2('0xe'));var authService=require(_0x3cc2('0xf'));var qs=require(_0x3cc2('0x10'));var as=require(_0x3cc2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cc2('0x12'))(_0x3cc2('0x13'));var utils=require('../../config/utils');var config=require(_0x3cc2('0x14'));var licenseUtil=require(_0x3cc2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32a6c8,_0x44372b){_0x44372b=_0x44372b||0xcc;return function(_0x3894b8){if(_0x3894b8){return _0x32a6c8['sendStatus'](_0x44372b);}return _0x32a6c8[_0x3cc2('0x16')](_0x44372b)[_0x3cc2('0x17')]();};}function respondWithResult(_0x2c1be0,_0x4df307){_0x4df307=_0x4df307||0xc8;return function(_0x30884c){if(_0x30884c){return _0x2c1be0['status'](_0x4df307)[_0x3cc2('0x18')](_0x30884c);}};}function respondWithFilteredResult(_0x43b343,_0x518b4e){return function(_0x4eceb7){if(_0x4eceb7){var _0x250e3b=typeof _0x518b4e[_0x3cc2('0x19')]===_0x3cc2('0x1a')&&typeof _0x518b4e[_0x3cc2('0x1b')]===_0x3cc2('0x1a');var _0x2b2a9f=_0x4eceb7[_0x3cc2('0x1c')];var _0x5042ad=_0x250e3b?0x0:_0x518b4e[_0x3cc2('0x19')];var _0x206cd7=_0x250e3b?_0x4eceb7[_0x3cc2('0x1c')]:_0x518b4e[_0x3cc2('0x19')]+_0x518b4e['limit'];var _0x2b409a;if(_0x206cd7>=_0x2b2a9f){_0x206cd7=_0x2b2a9f;_0x2b409a=0xc8;}else{_0x2b409a=0xce;}_0x43b343[_0x3cc2('0x16')](_0x2b409a);return _0x43b343[_0x3cc2('0x1d')](_0x3cc2('0x1e'),_0x5042ad+'-'+_0x206cd7+'/'+_0x2b2a9f)[_0x3cc2('0x18')](_0x4eceb7);}return null;};}function patchUpdates(_0x4ffe3a){return function(_0x27e294){try{jsonpatch[_0x3cc2('0x1f')](_0x27e294,_0x4ffe3a,!![]);}catch(_0x2039e1){return BPromise['reject'](_0x2039e1);}return _0x27e294['save']();};}function saveUpdates(_0x18adea,_0x41b9e0){return function(_0xfcdc76){if(_0xfcdc76){return _0xfcdc76[_0x3cc2('0x20')](_0x18adea)[_0x3cc2('0x21')](function(_0x321ee5){return _0x321ee5;});}return null;};}function removeEntity(_0x3eaac7,_0x3df037){return function(_0x3a7927){if(_0x3a7927){return _0x3a7927[_0x3cc2('0x22')]()[_0x3cc2('0x21')](function(){var _0x57089e=_0x3a7927[_0x3cc2('0x23')]({'plain':!![]});var _0x41b7df='Companies';return db[_0x3cc2('0x24')][_0x3cc2('0x22')]({'where':{'type':_0x41b7df,'resourceId':_0x57089e['id']}})[_0x3cc2('0x21')](function(){return _0x3a7927;});})['then'](function(){_0x3eaac7[_0x3cc2('0x16')](0xcc)[_0x3cc2('0x17')]();});}};}function handleEntityNotFound(_0x2ae3ee,_0x52a319){return function(_0x3f1fcf){if(!_0x3f1fcf){_0x2ae3ee['sendStatus'](0x194);}return _0x3f1fcf;};}function handleError(_0x4c75b8,_0x52dedc){_0x52dedc=_0x52dedc||0x1f4;return function(_0x31bb79){logger[_0x3cc2('0x25')](_0x31bb79[_0x3cc2('0x26')]);if(_0x31bb79[_0x3cc2('0x27')]){delete _0x31bb79[_0x3cc2('0x27')];}_0x4c75b8['status'](_0x52dedc)[_0x3cc2('0x28')](_0x31bb79);};}exports['index']=function(_0x1896aa,_0x147438){var _0x2c4727={},_0x1af842={},_0x26f1a3={'count':0x0,'rows':[]};return db[_0x3cc2('0x29')][_0x3cc2('0x2a')]()[_0x3cc2('0x21')](function(_0x46e35f){_0x1af842[_0x3cc2('0x2b')]=_['keys'](_0x46e35f);_0x1af842[_0x3cc2('0x2c')]=_['keys'](_0x1896aa['query']);_0x1af842['filters']=_[_0x3cc2('0x2d')](_0x1af842[_0x3cc2('0x2b')],_0x1af842[_0x3cc2('0x2c')]);_0x2c4727['attributes']=_[_0x3cc2('0x2d')](_0x1af842[_0x3cc2('0x2b')],qs[_0x3cc2('0x2e')](_0x1896aa[_0x3cc2('0x2c')][_0x3cc2('0x2e')]));_0x2c4727[_0x3cc2('0x2f')]=_0x2c4727[_0x3cc2('0x2f')][_0x3cc2('0x30')]?_0x2c4727[_0x3cc2('0x2f')]:_0x1af842[_0x3cc2('0x2b')];if(!_0x1896aa[_0x3cc2('0x2c')][_0x3cc2('0x31')](_0x3cc2('0x32'))){_0x2c4727[_0x3cc2('0x1b')]=qs[_0x3cc2('0x1b')](_0x1896aa['query']['limit']);_0x2c4727[_0x3cc2('0x19')]=qs[_0x3cc2('0x19')](_0x1896aa[_0x3cc2('0x2c')][_0x3cc2('0x19')]);}_0x2c4727['order']=qs['sort'](_0x1896aa[_0x3cc2('0x2c')]['sort']);_0x2c4727[_0x3cc2('0x33')]=qs[_0x3cc2('0x34')](_[_0x3cc2('0x35')](_0x1896aa[_0x3cc2('0x2c')],_0x1af842['filters']),_0x46e35f);if(_0x1896aa[_0x3cc2('0x2c')][_0x3cc2('0x36')]){_0x2c4727['where']=_['merge'](_0x2c4727[_0x3cc2('0x33')],{'$or':_[_0x3cc2('0x37')](_0x2c4727[_0x3cc2('0x2f')],function(_0x2d0615){var _0xeb3cbe={};_0xeb3cbe[_0x2d0615]={'$like':'%'+_0x1896aa[_0x3cc2('0x2c')][_0x3cc2('0x36')]+'%'};return _0xeb3cbe;})});}_0x2c4727=_[_0x3cc2('0x38')]({},_0x2c4727,_0x1896aa[_0x3cc2('0x39')]);var _0x2eff7b={'where':_0x2c4727[_0x3cc2('0x33')]};return db['CmCompany'][_0x3cc2('0x1c')](_0x2eff7b)['then'](function(_0x821f16){_0x26f1a3[_0x3cc2('0x1c')]=_0x821f16;if(_0x1896aa['query'][_0x3cc2('0x3a')]){_0x2c4727[_0x3cc2('0x3b')]=[{'all':!![]}];}return db[_0x3cc2('0x29')][_0x3cc2('0x3c')](_0x2c4727);})[_0x3cc2('0x21')](function(_0x5ec466){_0x26f1a3[_0x3cc2('0x3d')]=_0x5ec466;return _0x26f1a3;})[_0x3cc2('0x21')](respondWithFilteredResult(_0x147438,_0x2c4727))['catch'](handleError(_0x147438,null));})[_0x3cc2('0x3e')](handleError(_0x147438,null));};exports['show']=function(_0x48d92c,_0x3ef2cf){var _0x4eed08={'raw':![],'where':{'id':_0x48d92c[_0x3cc2('0x3f')]['id']}},_0x30696f={};_0x30696f[_0x3cc2('0x2b')]=_[_0x3cc2('0x40')](db[_0x3cc2('0x29')][_0x3cc2('0x41')]);_0x30696f[_0x3cc2('0x2c')]=_['keys'](_0x48d92c['query']);_0x30696f[_0x3cc2('0x34')]=_[_0x3cc2('0x2d')](_0x30696f[_0x3cc2('0x2b')],_0x30696f[_0x3cc2('0x2c')]);_0x4eed08['attributes']=_[_0x3cc2('0x2d')](_0x30696f['model'],qs[_0x3cc2('0x2e')](_0x48d92c[_0x3cc2('0x2c')]['fields']));_0x4eed08[_0x3cc2('0x2f')]=_0x4eed08[_0x3cc2('0x2f')][_0x3cc2('0x30')]?_0x4eed08['attributes']:_0x30696f[_0x3cc2('0x2b')];if(_0x48d92c[_0x3cc2('0x2c')]['includeAll']){_0x4eed08[_0x3cc2('0x3b')]=[{'all':!![]}];}_0x4eed08=_[_0x3cc2('0x38')]({},_0x4eed08,_0x48d92c['options']);return db[_0x3cc2('0x29')][_0x3cc2('0x42')](_0x4eed08)[_0x3cc2('0x21')](handleEntityNotFound(_0x3ef2cf,null))[_0x3cc2('0x21')](respondWithResult(_0x3ef2cf,null))[_0x3cc2('0x3e')](handleError(_0x3ef2cf,null));};exports[_0x3cc2('0x43')]=function(_0x487f44,_0x4541d5){return db[_0x3cc2('0x29')][_0x3cc2('0x43')](_0x487f44[_0x3cc2('0x44')],{})[_0x3cc2('0x21')](function(_0x726aaa){var _0x21ed2c=_0x487f44[_0x3cc2('0x45')][_0x3cc2('0x23')]({'plain':!![]});if(!_0x21ed2c)throw new Error(_0x3cc2('0x46'));if(_0x21ed2c[_0x3cc2('0x47')]===_0x3cc2('0x45')){var _0x39b014=_0x726aaa['get']({'plain':!![]});var _0x77a136='Companies';return db[_0x3cc2('0x48')][_0x3cc2('0x42')]({'where':{'name':_0x77a136,'userProfileId':_0x21ed2c['userProfileId']},'raw':!![]})[_0x3cc2('0x21')](function(_0x1f75b1){if(_0x1f75b1&&_0x1f75b1[_0x3cc2('0x49')]===0x0){return db[_0x3cc2('0x24')][_0x3cc2('0x43')]({'name':_0x39b014['name'],'resourceId':_0x39b014['id'],'type':_0x1f75b1['name'],'sectionId':_0x1f75b1['id']},{})[_0x3cc2('0x21')](function(){return _0x726aaa;});}else{return _0x726aaa;}})[_0x3cc2('0x3e')](function(_0x41039f){logger[_0x3cc2('0x25')](_0x3cc2('0x4a'),_0x41039f);throw _0x41039f;});}return _0x726aaa;})['then'](respondWithResult(_0x4541d5,0xc9))[_0x3cc2('0x3e')](handleError(_0x4541d5,null));};exports[_0x3cc2('0x20')]=function(_0x4beb9f,_0x45bb9a){if(_0x4beb9f['body']['id']){delete _0x4beb9f['body']['id'];}return db['CmCompany'][_0x3cc2('0x42')]({'where':{'id':_0x4beb9f[_0x3cc2('0x3f')]['id']}})[_0x3cc2('0x21')](handleEntityNotFound(_0x45bb9a,null))['then'](saveUpdates(_0x4beb9f[_0x3cc2('0x44')],null))[_0x3cc2('0x21')](respondWithResult(_0x45bb9a,null))[_0x3cc2('0x3e')](handleError(_0x45bb9a,null));};exports[_0x3cc2('0x22')]=function(_0x46543c,_0x2c8f2f){return db[_0x3cc2('0x29')]['find']({'where':{'id':_0x46543c[_0x3cc2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2c8f2f,null))[_0x3cc2('0x21')](removeEntity(_0x2c8f2f,null))[_0x3cc2('0x3e')](handleError(_0x2c8f2f,null));};exports[_0x3cc2('0x2a')]=function(_0x5ba68b,_0x13f15f){return db['CmCompany'][_0x3cc2('0x2a')]()[_0x3cc2('0x21')](respondWithResult(_0x13f15f,null))[_0x3cc2('0x3e')](handleError(_0x13f15f,null));};exports[_0x3cc2('0x4b')]=function(_0x289ca2,_0x4377be,_0x3fd53){return db[_0x3cc2('0x4c')][_0x3cc2('0x42')]({'where':{'id':_0x289ca2[_0x3cc2('0x3f')]['id']}})[_0x3cc2('0x21')](handleEntityNotFound(_0x4377be,null))['then'](function(_0x2ce09e){if(_0x2ce09e){return _0x2ce09e[_0x3cc2('0x4b')](_0x289ca2[_0x3cc2('0x44')][_0x3cc2('0x4d')],_[_0x3cc2('0x4e')](_0x289ca2[_0x3cc2('0x44')],[_0x3cc2('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x4377be,null))[_0x3cc2('0x3e')](handleError(_0x4377be,null));};exports[_0x3cc2('0x4f')]=function(_0x480c3c,_0x41ed0e,_0x543436){var _0x3271a3={};var _0x3bf0a6={};var _0x24eef3;var _0x1a8c64;return db[_0x3cc2('0x29')][_0x3cc2('0x50')]({'where':{'id':_0x480c3c[_0x3cc2('0x3f')]['id']}})[_0x3cc2('0x21')](handleEntityNotFound(_0x41ed0e,null))[_0x3cc2('0x21')](function(_0x1d9d7c){if(_0x1d9d7c){_0x24eef3=_0x1d9d7c;_0x3bf0a6[_0x3cc2('0x2b')]=_['keys'](db['CmContact'][_0x3cc2('0x41')]);_0x3bf0a6[_0x3cc2('0x2c')]=_[_0x3cc2('0x40')](_0x480c3c[_0x3cc2('0x2c')]);_0x3bf0a6[_0x3cc2('0x34')]=_[_0x3cc2('0x2d')](_0x3bf0a6[_0x3cc2('0x2b')],_0x3bf0a6[_0x3cc2('0x2c')]);_0x3271a3[_0x3cc2('0x2f')]=_[_0x3cc2('0x2d')](_0x3bf0a6[_0x3cc2('0x2b')],qs[_0x3cc2('0x2e')](_0x480c3c[_0x3cc2('0x2c')]['fields']));_0x3271a3[_0x3cc2('0x2f')]=_0x3271a3[_0x3cc2('0x2f')]['length']?_0x3271a3[_0x3cc2('0x2f')]:_0x3bf0a6['model'];_0x3271a3[_0x3cc2('0x51')]=qs[_0x3cc2('0x52')](_0x480c3c['query'][_0x3cc2('0x52')]);_0x3271a3['where']=qs[_0x3cc2('0x34')](_[_0x3cc2('0x35')](_0x480c3c[_0x3cc2('0x2c')],_0x3bf0a6[_0x3cc2('0x34')]));if(_0x480c3c['query']['filter']){_0x3271a3[_0x3cc2('0x33')]=_['merge'](_0x3271a3[_0x3cc2('0x33')],{'$or':_[_0x3cc2('0x37')](_0x3271a3[_0x3cc2('0x2f')],function(_0x21181c){var _0x3bca6a={};_0x3bca6a[_0x21181c]={'$like':'%'+_0x480c3c['query'][_0x3cc2('0x36')]+'%'};return _0x3bca6a;})});}_0x3271a3=_[_0x3cc2('0x38')]({},_0x3271a3,_0x480c3c[_0x3cc2('0x39')]);return _0x24eef3[_0x3cc2('0x4f')](_0x3271a3);}})['then'](function(_0x2d861d){if(_0x2d861d){_0x1a8c64=_0x2d861d[_0x3cc2('0x30')];if(!_0x480c3c[_0x3cc2('0x2c')][_0x3cc2('0x31')](_0x3cc2('0x32'))){_0x3271a3[_0x3cc2('0x1b')]=qs[_0x3cc2('0x1b')](_0x480c3c[_0x3cc2('0x2c')][_0x3cc2('0x1b')]);_0x3271a3[_0x3cc2('0x19')]=qs[_0x3cc2('0x19')](_0x480c3c[_0x3cc2('0x2c')]['offset']);}return _0x24eef3['getContacts'](_0x3271a3);}})[_0x3cc2('0x21')](function(_0x47ef67){if(_0x47ef67){return _0x47ef67?{'count':_0x1a8c64,'rows':_0x47ef67}:null;}})[_0x3cc2('0x21')](respondWithResult(_0x41ed0e,null))['catch'](handleError(_0x41ed0e,null));}; \ No newline at end of file +var _0xbeb0=['merge','map','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x224721,_0x45b988){var _0x145358=function(_0x42305e){while(--_0x42305e){_0x224721['push'](_0x224721['shift']());}};_0x145358(++_0x45b988);}(_0xbeb0,0x69));var _0x0beb=function(_0x5a5b49,_0x2a11fb){_0x5a5b49=_0x5a5b49-0x0;var _0x42e871=_0xbeb0[_0x5a5b49];return _0x42e871;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0beb('0x0'));var jsonpatch=require(_0x0beb('0x1'));var rp=require(_0x0beb('0x2'));var moment=require(_0x0beb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0beb('0x4'));var util=require(_0x0beb('0x5'));var path=require(_0x0beb('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0beb('0x7'));var _=require(_0x0beb('0x8'));var squel=require(_0x0beb('0x9'));var crypto=require('crypto');var jsforce=require(_0x0beb('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0beb('0xb'));var Papa=require(_0x0beb('0xc'));var Redis=require(_0x0beb('0xd'));var authService=require(_0x0beb('0xe'));var qs=require(_0x0beb('0xf'));var as=require(_0x0beb('0x10'));var hardwareService=require(_0x0beb('0x11'));var logger=require('../../config/logger')(_0x0beb('0x12'));var utils=require(_0x0beb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0beb('0x14'));var db=require(_0x0beb('0x15'))['db'];function respondWithStatusCode(_0x480eb3,_0x5dc202){_0x5dc202=_0x5dc202||0xcc;return function(_0x459f86){if(_0x459f86){return _0x480eb3[_0x0beb('0x16')](_0x5dc202);}return _0x480eb3[_0x0beb('0x17')](_0x5dc202)[_0x0beb('0x18')]();};}function respondWithResult(_0x47129e,_0x39f5ad){_0x39f5ad=_0x39f5ad||0xc8;return function(_0x2e7d6e){if(_0x2e7d6e){return _0x47129e[_0x0beb('0x17')](_0x39f5ad)['json'](_0x2e7d6e);}};}function respondWithFilteredResult(_0x3311c3,_0x54a760){return function(_0x527c78){if(_0x527c78){var _0x4419da=typeof _0x54a760[_0x0beb('0x19')]===_0x0beb('0x1a')&&typeof _0x54a760[_0x0beb('0x1b')]==='undefined';var _0x28a30f=_0x527c78[_0x0beb('0x1c')];var _0x549a96=_0x4419da?0x0:_0x54a760[_0x0beb('0x19')];var _0x4fd805=_0x4419da?_0x527c78['count']:_0x54a760[_0x0beb('0x19')]+_0x54a760[_0x0beb('0x1b')];var _0x145884;if(_0x4fd805>=_0x28a30f){_0x4fd805=_0x28a30f;_0x145884=0xc8;}else{_0x145884=0xce;}_0x3311c3[_0x0beb('0x17')](_0x145884);return _0x3311c3['set'](_0x0beb('0x1d'),_0x549a96+'-'+_0x4fd805+'/'+_0x28a30f)[_0x0beb('0x1e')](_0x527c78);}return null;};}function patchUpdates(_0x446a62){return function(_0x5a5931){try{jsonpatch[_0x0beb('0x1f')](_0x5a5931,_0x446a62,!![]);}catch(_0x469365){return BPromise['reject'](_0x469365);}return _0x5a5931[_0x0beb('0x20')]();};}function saveUpdates(_0x34eb24,_0x8b150b){return function(_0x3c285d){if(_0x3c285d){return _0x3c285d[_0x0beb('0x21')](_0x34eb24)[_0x0beb('0x22')](function(_0x35f63e){return _0x35f63e;});}return null;};}function removeEntity(_0x5ca394,_0x5c49ba){return function(_0xde42af){if(_0xde42af){return _0xde42af[_0x0beb('0x23')]()[_0x0beb('0x22')](function(){var _0x347023=_0xde42af[_0x0beb('0x24')]({'plain':!![]});var _0x83dbb2=_0x0beb('0x25');return db[_0x0beb('0x26')][_0x0beb('0x23')]({'where':{'type':_0x83dbb2,'resourceId':_0x347023['id']}})['then'](function(){return _0xde42af;});})[_0x0beb('0x22')](function(){_0x5ca394['status'](0xcc)[_0x0beb('0x18')]();});}};}function handleEntityNotFound(_0x274cdd,_0x480d10){return function(_0x2a3f75){if(!_0x2a3f75){_0x274cdd[_0x0beb('0x16')](0x194);}return _0x2a3f75;};}function handleError(_0x5d5765,_0x55f287){_0x55f287=_0x55f287||0x1f4;return function(_0x1370e8){logger[_0x0beb('0x27')](_0x1370e8[_0x0beb('0x28')]);if(_0x1370e8[_0x0beb('0x29')]){delete _0x1370e8[_0x0beb('0x29')];}_0x5d5765[_0x0beb('0x17')](_0x55f287)[_0x0beb('0x2a')](_0x1370e8);};}exports[_0x0beb('0x2b')]=function(_0x5f1dd6,_0x527152){var _0x5b8b2a={},_0x43ae7e={},_0x9043b3={'count':0x0,'rows':[]};return db[_0x0beb('0x2c')][_0x0beb('0x2d')]()[_0x0beb('0x22')](function(_0x26ed6e){_0x43ae7e[_0x0beb('0x2e')]=_[_0x0beb('0x2f')](_0x26ed6e);_0x43ae7e[_0x0beb('0x30')]=_[_0x0beb('0x2f')](_0x5f1dd6['query']);_0x43ae7e[_0x0beb('0x31')]=_[_0x0beb('0x32')](_0x43ae7e[_0x0beb('0x2e')],_0x43ae7e[_0x0beb('0x30')]);_0x5b8b2a[_0x0beb('0x33')]=_[_0x0beb('0x32')](_0x43ae7e['model'],qs[_0x0beb('0x34')](_0x5f1dd6[_0x0beb('0x30')][_0x0beb('0x34')]));_0x5b8b2a[_0x0beb('0x33')]=_0x5b8b2a[_0x0beb('0x33')][_0x0beb('0x35')]?_0x5b8b2a[_0x0beb('0x33')]:_0x43ae7e[_0x0beb('0x2e')];if(!_0x5f1dd6['query'][_0x0beb('0x36')](_0x0beb('0x37'))){_0x5b8b2a[_0x0beb('0x1b')]=qs[_0x0beb('0x1b')](_0x5f1dd6[_0x0beb('0x30')]['limit']);_0x5b8b2a[_0x0beb('0x19')]=qs['offset'](_0x5f1dd6[_0x0beb('0x30')]['offset']);}_0x5b8b2a[_0x0beb('0x38')]=qs[_0x0beb('0x39')](_0x5f1dd6[_0x0beb('0x30')]['sort']);_0x5b8b2a[_0x0beb('0x3a')]=qs[_0x0beb('0x31')](_[_0x0beb('0x3b')](_0x5f1dd6['query'],_0x43ae7e[_0x0beb('0x31')]),_0x26ed6e);if(_0x5f1dd6[_0x0beb('0x30')][_0x0beb('0x3c')]){_0x5b8b2a[_0x0beb('0x3a')]=_[_0x0beb('0x3d')](_0x5b8b2a[_0x0beb('0x3a')],{'$or':_[_0x0beb('0x3e')](_0x5b8b2a['attributes'],function(_0x363064){var _0x4d451d={};_0x4d451d[_0x363064]={'$like':'%'+_0x5f1dd6[_0x0beb('0x30')][_0x0beb('0x3c')]+'%'};return _0x4d451d;})});}_0x5b8b2a=_[_0x0beb('0x3d')]({},_0x5b8b2a,_0x5f1dd6[_0x0beb('0x3f')]);var _0x1f06e9={'where':_0x5b8b2a[_0x0beb('0x3a')]};return db['CmCompany'][_0x0beb('0x1c')](_0x1f06e9)['then'](function(_0x13cb13){_0x9043b3[_0x0beb('0x1c')]=_0x13cb13;if(_0x5f1dd6[_0x0beb('0x30')][_0x0beb('0x40')]){_0x5b8b2a[_0x0beb('0x41')]=[{'all':!![]}];}return db[_0x0beb('0x2c')]['findAll'](_0x5b8b2a);})[_0x0beb('0x22')](function(_0x2ba7d5){_0x9043b3[_0x0beb('0x42')]=_0x2ba7d5;return _0x9043b3;})[_0x0beb('0x22')](respondWithFilteredResult(_0x527152,_0x5b8b2a))[_0x0beb('0x43')](handleError(_0x527152,null));})['catch'](handleError(_0x527152,null));};exports[_0x0beb('0x44')]=function(_0x599393,_0x440790){var _0x578de0={'raw':![],'where':{'id':_0x599393[_0x0beb('0x45')]['id']}},_0x19c6c0={};_0x19c6c0[_0x0beb('0x2e')]=_[_0x0beb('0x2f')](db[_0x0beb('0x2c')][_0x0beb('0x46')]);_0x19c6c0[_0x0beb('0x30')]=_[_0x0beb('0x2f')](_0x599393['query']);_0x19c6c0['filters']=_[_0x0beb('0x32')](_0x19c6c0['model'],_0x19c6c0['query']);_0x578de0[_0x0beb('0x33')]=_[_0x0beb('0x32')](_0x19c6c0[_0x0beb('0x2e')],qs[_0x0beb('0x34')](_0x599393[_0x0beb('0x30')][_0x0beb('0x34')]));_0x578de0['attributes']=_0x578de0[_0x0beb('0x33')]['length']?_0x578de0['attributes']:_0x19c6c0[_0x0beb('0x2e')];if(_0x599393['query'][_0x0beb('0x40')]){_0x578de0[_0x0beb('0x41')]=[{'all':!![]}];}_0x578de0=_['merge']({},_0x578de0,_0x599393[_0x0beb('0x3f')]);return db['CmCompany'][_0x0beb('0x47')](_0x578de0)[_0x0beb('0x22')](handleEntityNotFound(_0x440790,null))[_0x0beb('0x22')](respondWithResult(_0x440790,null))[_0x0beb('0x43')](handleError(_0x440790,null));};exports[_0x0beb('0x48')]=function(_0x49e17c,_0x2d88dd){return db[_0x0beb('0x2c')]['create'](_0x49e17c[_0x0beb('0x49')],{})[_0x0beb('0x22')](function(_0xc35b29){var _0x311abf=_0x49e17c[_0x0beb('0x4a')][_0x0beb('0x24')]({'plain':!![]});if(!_0x311abf)throw new Error(_0x0beb('0x4b'));if(_0x311abf['role']===_0x0beb('0x4a')){var _0x5232ef=_0xc35b29[_0x0beb('0x24')]({'plain':!![]});var _0x285d23='Companies';return db[_0x0beb('0x4c')][_0x0beb('0x47')]({'where':{'name':_0x285d23,'userProfileId':_0x311abf[_0x0beb('0x4d')]},'raw':!![]})[_0x0beb('0x22')](function(_0x1cd63c){if(_0x1cd63c&&_0x1cd63c[_0x0beb('0x4e')]===0x0){return db[_0x0beb('0x26')][_0x0beb('0x48')]({'name':_0x5232ef['name'],'resourceId':_0x5232ef['id'],'type':_0x1cd63c[_0x0beb('0x29')],'sectionId':_0x1cd63c['id']},{})['then'](function(){return _0xc35b29;});}else{return _0xc35b29;}})[_0x0beb('0x43')](function(_0x256d92){logger[_0x0beb('0x27')](_0x0beb('0x4f'),_0x256d92);throw _0x256d92;});}return _0xc35b29;})[_0x0beb('0x22')](respondWithResult(_0x2d88dd,0xc9))[_0x0beb('0x43')](handleError(_0x2d88dd,null));};exports[_0x0beb('0x21')]=function(_0x19042e,_0x44f75d){if(_0x19042e[_0x0beb('0x49')]['id']){delete _0x19042e['body']['id'];}return db[_0x0beb('0x2c')][_0x0beb('0x47')]({'where':{'id':_0x19042e['params']['id']}})[_0x0beb('0x22')](handleEntityNotFound(_0x44f75d,null))[_0x0beb('0x22')](saveUpdates(_0x19042e[_0x0beb('0x49')],null))['then'](respondWithResult(_0x44f75d,null))[_0x0beb('0x43')](handleError(_0x44f75d,null));};exports['destroy']=function(_0x346f0b,_0x11a64b){return db[_0x0beb('0x2c')]['find']({'where':{'id':_0x346f0b[_0x0beb('0x45')]['id']}})[_0x0beb('0x22')](handleEntityNotFound(_0x11a64b,null))[_0x0beb('0x22')](removeEntity(_0x11a64b,null))[_0x0beb('0x43')](handleError(_0x11a64b,null));};exports[_0x0beb('0x2d')]=function(_0x5c81f3,_0x3f7b04){return db['CmCompany'][_0x0beb('0x2d')]()[_0x0beb('0x22')](respondWithResult(_0x3f7b04,null))[_0x0beb('0x43')](handleError(_0x3f7b04,null));};exports[_0x0beb('0x50')]=function(_0x48c2a1,_0x337045,_0x4b4a20){return db[_0x0beb('0x51')][_0x0beb('0x47')]({'where':{'id':_0x48c2a1[_0x0beb('0x45')]['id']}})['then'](handleEntityNotFound(_0x337045,null))['then'](function(_0x483ac5){if(_0x483ac5){return _0x483ac5[_0x0beb('0x50')](_0x48c2a1['body'][_0x0beb('0x52')],_['omit'](_0x48c2a1[_0x0beb('0x49')],[_0x0beb('0x52'),'id'])||{});}})[_0x0beb('0x22')](respondWithResult(_0x337045,null))[_0x0beb('0x43')](handleError(_0x337045,null));};exports['getContacts']=function(_0x17bae4,_0x5190fd,_0x2ab3d7){var _0x464b31={};var _0x1facc2={};var _0x1a04d1;var _0xef30d1;return db[_0x0beb('0x2c')]['findOne']({'where':{'id':_0x17bae4['params']['id']}})[_0x0beb('0x22')](handleEntityNotFound(_0x5190fd,null))[_0x0beb('0x22')](function(_0x4f5b3a){if(_0x4f5b3a){_0x1a04d1=_0x4f5b3a;_0x1facc2[_0x0beb('0x2e')]=_[_0x0beb('0x2f')](db[_0x0beb('0x51')][_0x0beb('0x46')]);_0x1facc2[_0x0beb('0x30')]=_[_0x0beb('0x2f')](_0x17bae4[_0x0beb('0x30')]);_0x1facc2['filters']=_[_0x0beb('0x32')](_0x1facc2['model'],_0x1facc2['query']);_0x464b31[_0x0beb('0x33')]=_[_0x0beb('0x32')](_0x1facc2[_0x0beb('0x2e')],qs[_0x0beb('0x34')](_0x17bae4['query'][_0x0beb('0x34')]));_0x464b31['attributes']=_0x464b31['attributes'][_0x0beb('0x35')]?_0x464b31[_0x0beb('0x33')]:_0x1facc2[_0x0beb('0x2e')];_0x464b31[_0x0beb('0x38')]=qs['sort'](_0x17bae4[_0x0beb('0x30')][_0x0beb('0x39')]);_0x464b31[_0x0beb('0x3a')]=qs[_0x0beb('0x31')](_[_0x0beb('0x3b')](_0x17bae4['query'],_0x1facc2[_0x0beb('0x31')]));if(_0x17bae4[_0x0beb('0x30')]['filter']){_0x464b31['where']=_[_0x0beb('0x3d')](_0x464b31['where'],{'$or':_['map'](_0x464b31[_0x0beb('0x33')],function(_0x587d7e){var _0x39b8b1={};_0x39b8b1[_0x587d7e]={'$like':'%'+_0x17bae4['query'][_0x0beb('0x3c')]+'%'};return _0x39b8b1;})});}_0x464b31=_[_0x0beb('0x3d')]({},_0x464b31,_0x17bae4[_0x0beb('0x3f')]);return _0x1a04d1['getContacts'](_0x464b31);}})[_0x0beb('0x22')](function(_0x507ad6){if(_0x507ad6){_0xef30d1=_0x507ad6[_0x0beb('0x35')];if(!_0x17bae4[_0x0beb('0x30')][_0x0beb('0x36')](_0x0beb('0x37'))){_0x464b31['limit']=qs[_0x0beb('0x1b')](_0x17bae4[_0x0beb('0x30')][_0x0beb('0x1b')]);_0x464b31[_0x0beb('0x19')]=qs['offset'](_0x17bae4[_0x0beb('0x30')]['offset']);}return _0x1a04d1['getContacts'](_0x464b31);}})['then'](function(_0x16ad9c){if(_0x16ad9c){return _0x16ad9c?{'count':_0xef30d1,'rows':_0x16ad9c}:null;}})['then'](respondWithResult(_0x5190fd,null))[_0x0beb('0x43')](handleError(_0x5190fd,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 394c899..54e1eeb 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 _0xc284=['../../config/environment','exports','define','CmCompany','cm_companies','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x2e600a,_0x415a78){var _0x330169=function(_0xc069d1){while(--_0xc069d1){_0x2e600a['push'](_0x2e600a['shift']());}};_0x330169(++_0x415a78);}(_0xc284,0x1b5));var _0x4c28=function(_0x272188,_0x56363a){_0x272188=_0x272188-0x0;var _0x2ca472=_0xc284[_0x272188];return _0x2ca472;};'use strict';var _=require(_0x4c28('0x0'));var util=require(_0x4c28('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4c28('0x2'));var BPromise=require(_0x4c28('0x3'));var rp=require(_0x4c28('0x4'));var fs=require('fs');var path=require(_0x4c28('0x5'));var rimraf=require(_0x4c28('0x6'));var config=require(_0x4c28('0x7'));var attributes=require('./cmCompany.attributes');module[_0x4c28('0x8')]=function(_0x4b5b80,_0x454b2f){return _0x4b5b80[_0x4c28('0x9')](_0x4c28('0xa'),attributes,{'tableName':_0x4c28('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2767=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','CmCompany','cm_companies'];(function(_0x20e07a,_0x53d32e){var _0xacd186=function(_0x387593){while(--_0x387593){_0x20e07a['push'](_0x20e07a['shift']());}};_0xacd186(++_0x53d32e);}(_0x2767,0x8f));var _0x7276=function(_0x42dd13,_0x408c01){_0x42dd13=_0x42dd13-0x0;var _0x18cfdd=_0x2767[_0x42dd13];return _0x18cfdd;};'use strict';var _=require(_0x7276('0x0'));var util=require(_0x7276('0x1'));var logger=require(_0x7276('0x2'))(_0x7276('0x3'));var moment=require(_0x7276('0x4'));var BPromise=require(_0x7276('0x5'));var rp=require(_0x7276('0x6'));var fs=require('fs');var path=require(_0x7276('0x7'));var rimraf=require(_0x7276('0x8'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0x7276('0x9')]=function(_0x6d8f27,_0x42cfed){return _0x6d8f27[_0x7276('0xa')](_0x7276('0xb'),attributes,{'tableName':_0x7276('0xc'),'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 5dd628b..3cdb30c 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 _0x9471=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0x9471,0x1d3));var _0x1947=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9471[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1947('0x0'));var util=require(_0x1947('0x1'));var moment=require(_0x1947('0x2'));var BPromise=require(_0x1947('0x3'));var rs=require(_0x1947('0x4'));var fs=require('fs');var Redis=require(_0x1947('0x5'));var db=require(_0x1947('0x6'))['db'];var utils=require(_0x1947('0x7'));var logger=require(_0x1947('0x8'))(_0x1947('0x9'));var config=require('../../config/environment');var jayson=require(_0x1947('0xa'));var client=jayson[_0x1947('0xb')][_0x1947('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c7a62,_0x46d9ff,_0x2cfba6){return new BPromise(function(_0x5804d2,_0x5f19dd){return client[_0x1947('0xd')](_0x4c7a62,_0x2cfba6)[_0x1947('0xe')](function(_0x4f86d8){logger[_0x1947('0xf')](_0x1947('0x10'),_0x46d9ff,_0x1947('0x11'));logger[_0x1947('0x12')](_0x1947('0x13'),_0x46d9ff,_0x1947('0x11'),JSON[_0x1947('0x14')](_0x4f86d8));if(_0x4f86d8[_0x1947('0x15')]){if(_0x4f86d8[_0x1947('0x15')][_0x1947('0x16')]===0x1f4){logger['error'](_0x1947('0x10'),_0x46d9ff,_0x4f86d8[_0x1947('0x15')]['message']);return _0x5f19dd(_0x4f86d8[_0x1947('0x15')]['message']);}logger[_0x1947('0x15')]('CmCompany,\x20%s,\x20%s',_0x46d9ff,_0x4f86d8[_0x1947('0x15')]['message']);return _0x5804d2(_0x4f86d8[_0x1947('0x15')][_0x1947('0x17')]);}else{logger[_0x1947('0xf')](_0x1947('0x10'),_0x46d9ff,_0x1947('0x11'));_0x5804d2(_0x4f86d8['result'][_0x1947('0x17')]);}})[_0x1947('0x18')](function(_0x4628f1){logger['error'](_0x1947('0x10'),_0x46d9ff,_0x4628f1);_0x5f19dd(_0x4628f1);});});} \ No newline at end of file +var _0x0f40=['jayson/promise','client','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xdcbbb,_0x39b964){var _0x19bb4e=function(_0x4952b7){while(--_0x4952b7){_0xdcbbb['push'](_0xdcbbb['shift']());}};_0x19bb4e(++_0x39b964);}(_0x0f40,0xc9));var _0x00f4=function(_0x59522a,_0x14d1e5){_0x59522a=_0x59522a-0x0;var _0x30f09d=_0x0f40[_0x59522a];return _0x30f09d;};'use strict';var _=require(_0x00f4('0x0'));var util=require(_0x00f4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x00f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00f4('0x3'))['db'];var utils=require(_0x00f4('0x4'));var logger=require(_0x00f4('0x5'))(_0x00f4('0x6'));var config=require(_0x00f4('0x7'));var jayson=require(_0x00f4('0x8'));var client=jayson[_0x00f4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ed2f9,_0xd66c18,_0x36001c){return new BPromise(function(_0x10fb70,_0x13b260){return client['request'](_0x2ed2f9,_0x36001c)['then'](function(_0x3aa3bb){logger['info'](_0x00f4('0xa'),_0xd66c18,_0x00f4('0xb'));logger[_0x00f4('0xc')](_0x00f4('0xd'),_0xd66c18,_0x00f4('0xb'),JSON['stringify'](_0x3aa3bb));if(_0x3aa3bb[_0x00f4('0xe')]){if(_0x3aa3bb[_0x00f4('0xe')][_0x00f4('0xf')]===0x1f4){logger['error'](_0x00f4('0xa'),_0xd66c18,_0x3aa3bb[_0x00f4('0xe')][_0x00f4('0x10')]);return _0x13b260(_0x3aa3bb['error']['message']);}logger[_0x00f4('0xe')](_0x00f4('0xa'),_0xd66c18,_0x3aa3bb[_0x00f4('0xe')][_0x00f4('0x10')]);return _0x10fb70(_0x3aa3bb[_0x00f4('0xe')][_0x00f4('0x10')]);}else{logger['info'](_0x00f4('0xa'),_0xd66c18,_0x00f4('0xb'));_0x10fb70(_0x3aa3bb[_0x00f4('0x11')][_0x00f4('0x10')]);}})[_0x00f4('0x12')](function(_0x5a8da2){logger[_0x00f4('0xe')](_0x00f4('0xa'),_0xd66c18,_0x5a8da2);_0x13b260(_0x5a8da2);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index cee3a0b..0e1c7ba 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 _0xae3f=['/:id/contacts','addContacts','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','post','create'];(function(_0x5f4a67,_0x4cb2e7){var _0x57faa3=function(_0x465b96){while(--_0x465b96){_0x5f4a67['push'](_0x5f4a67['shift']());}};_0x57faa3(++_0x4cb2e7);}(_0xae3f,0x115));var _0xfae3=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xae3f[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require('multer');var util=require(_0xfae3('0x0'));var path=require('path');var timeout=require(_0xfae3('0x1'));var express=require(_0xfae3('0x2'));var router=express['Router']();var fs_extra=require(_0xfae3('0x3'));var auth=require(_0xfae3('0x4'));var interaction=require(_0xfae3('0x5'));var config=require(_0xfae3('0x6'));var controller=require('./cmCompany.controller');router[_0xfae3('0x7')]('/',auth[_0xfae3('0x8')](),controller[_0xfae3('0x9')]);router['get'](_0xfae3('0xa'),auth[_0xfae3('0x8')](),controller[_0xfae3('0xb')]);router[_0xfae3('0x7')](_0xfae3('0xc'),auth[_0xfae3('0x8')](),controller[_0xfae3('0xd')]);router[_0xfae3('0x7')]('/:id/contacts',auth[_0xfae3('0x8')](),controller[_0xfae3('0xe')]);router[_0xfae3('0xf')]('/',auth[_0xfae3('0x8')](),controller[_0xfae3('0x10')]);router[_0xfae3('0xf')](_0xfae3('0x11'),auth[_0xfae3('0x8')](),controller[_0xfae3('0x12')]);router['put']('/:id',auth[_0xfae3('0x8')](),controller['update']);router['delete'](_0xfae3('0xc'),auth[_0xfae3('0x8')](),controller[_0xfae3('0x13')]);module[_0xfae3('0x14')]=router; \ No newline at end of file +var _0x66a3=['put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/contacts','getContacts','create','post','addContacts'];(function(_0x1e032e,_0xcaea0a){var _0x3dc166=function(_0x2710fb){while(--_0x2710fb){_0x1e032e['push'](_0x1e032e['shift']());}};_0x3dc166(++_0xcaea0a);}(_0x66a3,0x1c5));var _0x366a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66a3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x366a('0x0'));var util=require(_0x366a('0x1'));var path=require(_0x366a('0x2'));var timeout=require(_0x366a('0x3'));var express=require(_0x366a('0x4'));var router=express[_0x366a('0x5')]();var fs_extra=require(_0x366a('0x6'));var auth=require(_0x366a('0x7'));var interaction=require(_0x366a('0x8'));var config=require(_0x366a('0x9'));var controller=require(_0x366a('0xa'));router[_0x366a('0xb')]('/',auth[_0x366a('0xc')](),controller[_0x366a('0xd')]);router['get'](_0x366a('0xe'),auth[_0x366a('0xc')](),controller['describe']);router['get'](_0x366a('0xf'),auth[_0x366a('0xc')](),controller[_0x366a('0x10')]);router[_0x366a('0xb')](_0x366a('0x11'),auth[_0x366a('0xc')](),controller[_0x366a('0x12')]);router['post']('/',auth[_0x366a('0xc')](),controller[_0x366a('0x13')]);router[_0x366a('0x14')]('/:id/contacts',auth[_0x366a('0xc')](),controller[_0x366a('0x15')]);router[_0x366a('0x16')](_0x366a('0xf'),auth[_0x366a('0xc')](),controller[_0x366a('0x17')]);router[_0x366a('0x18')]('/:id',auth[_0x366a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 799f27f..0efef7f 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 _0x2342=['exports','STRING','INTEGER','UNSIGNED','DATE','lodash'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x2342,0x1d9));var _0x2234=function(_0x5843e3,_0x34319e){_0x5843e3=_0x5843e3-0x0;var _0x4e935b=_0x2342[_0x5843e3];return _0x4e935b;};'use strict';var _=require(_0x2234('0x0'));var Sequelize=require('sequelize');module[_0x2234('0x1')]={'firstName':{'type':Sequelize[_0x2234('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x2234('0x2')]},'street':{'type':Sequelize[_0x2234('0x2')]},'postalCode':{'type':Sequelize[_0x2234('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2234('0x2')]},'dateOfBirth':{'type':Sequelize[_0x2234('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x2234('0x2')]},'fax':{'type':Sequelize[_0x2234('0x2')]},'email':{'type':Sequelize[_0x2234('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x2234('0x2')]},'fb_data':{'type':Sequelize[_0x2234('0x2')]},'twitter':{'type':Sequelize[_0x2234('0x2')]},'skype':{'type':Sequelize[_0x2234('0x2')]},'teams':{'type':Sequelize[_0x2234('0x2')]},'viber':{'type':Sequelize[_0x2234('0x2')]},'line':{'type':Sequelize[_0x2234('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x2234('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x2234('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x2234('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x2234('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x2234('0x3')]}}; \ No newline at end of file +var _0xf5f3=['NOW','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xf5f3,0xb9));var _0x3f5f=function(_0x563828,_0xa51f73){_0x563828=_0x563828-0x0;var _0x3508d2=_0xf5f3[_0x563828];return _0x3508d2;};'use strict';var _=require('lodash');var Sequelize=require(_0x3f5f('0x0'));module[_0x3f5f('0x1')]={'firstName':{'type':Sequelize[_0x3f5f('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x3f5f('0x2')]},'street':{'type':Sequelize[_0x3f5f('0x2')]},'postalCode':{'type':Sequelize[_0x3f5f('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x3f5f('0x2')]},'dateOfBirth':{'type':Sequelize[_0x3f5f('0x2')]},'description':{'type':Sequelize[_0x3f5f('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x3f5f('0x2')]},'email':{'type':Sequelize[_0x3f5f('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x3f5f('0x2')]},'twitter':{'type':Sequelize[_0x3f5f('0x2')]},'skype':{'type':Sequelize[_0x3f5f('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x3f5f('0x2')]},'line':{'type':Sequelize[_0x3f5f('0x2')]},'wechat':{'type':Sequelize[_0x3f5f('0x2')]},'telegram':{'type':Sequelize[_0x3f5f('0x2')]},'UserId':{'type':Sequelize[_0x3f5f('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3f5f('0x4')](0x2)[_0x3f5f('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3f5f('0x6')],'defaultValue':Sequelize[_0x3f5f('0x7')]},'dialTimezone':{'type':Sequelize[_0x3f5f('0x2')]},'utcOffset':{'type':Sequelize[_0x3f5f('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index df0d888..ea42a4c 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 _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','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','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','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','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 76c06ad..9efe812 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85c6=['CmContact','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x85c6,0xaf));var _0x685c=function(_0x17a4ed,_0x12fa30){_0x17a4ed=_0x17a4ed-0x0;var _0x5ac46c=_0x85c6[_0x17a4ed];return _0x5ac46c;};'use strict';var EventEmitter=require('events');var CmContact=require('../../mysqldb')['db'][_0x685c('0x0')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x685c('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x685c('0x2'),'afterDestroy':'remove'};function emitEvent(_0x42d868){return function(_0x1fb597,_0x378406,_0x40d6e5){CmContactEvents[_0x685c('0x3')](_0x42d868+':'+_0x1fb597['id'],_0x1fb597);CmContactEvents[_0x685c('0x3')](_0x42d868,_0x1fb597);_0x40d6e5(null);};}for(var e in events){if(events[_0x685c('0x4')](e)){var event=events[e];CmContact[_0x685c('0x5')](e,emitEvent(event));}}module[_0x685c('0x6')]=CmContactEvents; \ No newline at end of file +var _0x0b8c=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4458f3,_0x4056f9){var _0x28db0e=function(_0x3ad12b){while(--_0x3ad12b){_0x4458f3['push'](_0x4458f3['shift']());}};_0x28db0e(++_0x4056f9);}(_0x0b8c,0x9f));var _0xc0b8=function(_0x21b088,_0x1facfb){_0x21b088=_0x21b088-0x0;var _0x816fb0=_0x0b8c[_0x21b088];return _0x816fb0;};'use strict';var EventEmitter=require(_0xc0b8('0x0'));var CmContact=require(_0xc0b8('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc0b8('0x2')](0x0);var events={'afterCreate':_0xc0b8('0x3'),'afterUpdate':_0xc0b8('0x4'),'afterDestroy':_0xc0b8('0x5')};function emitEvent(_0x3fa859){return function(_0x5cc64e,_0x54e104,_0x4ead87){CmContactEvents[_0xc0b8('0x6')](_0x3fa859+':'+_0x5cc64e['id'],_0x5cc64e);CmContactEvents['emit'](_0x3fa859,_0x5cc64e);_0x4ead87(null);};}for(var e in events){if(events[_0xc0b8('0x7')](e)){var event=events[e];CmContact[_0xc0b8('0x8')](e,emitEvent(event));}}module[_0xc0b8('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 7d5dafe..53e0e0f 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd529=['CmContact','cm_contacts','phone','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','then','timezones','utcOffset','minutes','ret','CmHopper','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','findAll','BlackLists','CmHopperBlack','message','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','api','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports'];(function(_0x36b703,_0x49079a){var _0x3abc58=function(_0x476720){while(--_0x476720){_0x36b703['push'](_0x36b703['shift']());}};_0x3abc58(++_0x49079a);}(_0xd529,0xd7));var _0x9d52=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd529[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9d52('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9d52('0x1'));var fs=require('fs');var path=require(_0x9d52('0x2'));var rimraf=require(_0x9d52('0x3'));var config=require('../../config/environment');var shared=require(_0x9d52('0x4'));var attributes=require(_0x9d52('0x5'));module[_0x9d52('0x6')]=function(_0x447901,_0x160cce){return _0x447901['define'](_0x9d52('0x7'),attributes,{'tableName':_0x9d52('0x8'),'paranoid':!![],'indexes':[{'name':_0x9d52('0x9'),'fields':[_0x9d52('0x9')]},{'name':'fti_cm_contacts','fields':[_0x9d52('0xa'),_0x9d52('0xb'),_0x9d52('0x9'),_0x9d52('0xc'),_0x9d52('0xd'),_0x9d52('0xe')],'type':_0x9d52('0xf')}],'timestamps':!![],'charset':_0x9d52('0x10'),'collate':_0x9d52('0x11'),'hooks':{'afterCreate':function(_0x4e98e3,_0x42d210,_0x14c626){var _0x25cb55=_0x447901[_0x9d52('0x12')];var _0x224078=_0x4e98e3[_0x9d52('0x13')]({'plain':!![]});function _0x4fa5ee(){return function(_0x2bab3e){logger[_0x9d52('0x14')](_0x9d52('0x15'),_0x9d52('0x16'),util[_0x9d52('0x17')](_0x2bab3e,{'showHidden':![],'depth':null}));};}function _0x57934d(_0x1d1c06,_0x41ea2c){var _0x1eff7e=_0x41ea2c[_0x9d52('0x18')]?_0x41ea2c[_0x9d52('0x18')]:moment()[_0x9d52('0x19')](_0x9d52('0x1a'));return new BPromise(function(_0x8d3516,_0x53d548){if(_[_0x9d52('0x1b')](_0x41ea2c[_0x9d52('0x1c')])){_0x8d3516({'ret':_0x1eff7e});}else{_0x25cb55[_0x9d52('0x1d')]['findOne']({'where':{'id':_0x1d1c06['id']}})[_0x9d52('0x1e')](function(_0x483224){if(!_['isNil'](_0x483224)){var _0x3c5bfc=_0x483224['dialTimezone'];if(!_['isNil'](_0x3c5bfc)){var _0x90f3e3=shared[_0x9d52('0x1f')];var _0x20dbb5=_0x90f3e3[_0x3c5bfc];var _0x4404dc=_0x90f3e3[_0x41ea2c[_0x9d52('0x1c')]];if(!_[_0x9d52('0x1b')](_0x20dbb5)&&!_[_0x9d52('0x1b')](_0x4404dc)){var _0x5cd08f=_0x20dbb5['utcOffset']-_0x4404dc[_0x9d52('0x20')];_0x1eff7e=_0x41ea2c['scheduledat']?_0x41ea2c['scheduledat']:moment();var _0x5ea39d=moment(_0x1eff7e)['add'](_0x5cd08f,_0x9d52('0x21'));_0x8d3516({'ret':_0x5ea39d['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x8d3516({'ret':_0x1eff7e});}else _0x8d3516({'ret':_0x1eff7e});}else{_0x8d3516({'ret':_0x1eff7e});}});}});return 0xa;}var _0x46584c=function(_0x328578){return new BPromise(function(_0x511911,_0x4f73c2){_0x57934d(_0x328578,_0x224078)[_0x9d52('0x1e')](function(_0x393b19){_0x224078[_0x9d52('0x18')]=_0x393b19[_0x9d52('0x22')];_0x25cb55[_0x9d52('0x23')][_0x9d52('0x24')]({'where':{'phone':_0x224078[_0x9d52('0x9')],'VoiceQueueId':_0x328578['id']}})[_0x9d52('0x1e')](function(_0x4bafcb){if(!_[_0x9d52('0x1b')](_0x4bafcb)){throw new Error(_0x9d52('0x25')+_0x224078[_0x9d52('0x9')]+_0x9d52('0x26')+_0x328578['id']);}return _0x25cb55['CmHopper'][_0x9d52('0x27')]({'phone':_0x224078[_0x9d52('0x9')],'ContactId':_0x224078['id'],'ListId':_0x224078[_0x9d52('0x28')],'priority':_0x224078[_0x9d52('0x29')]?_0x224078[_0x9d52('0x29')]:0x2,'scheduledat':_0x224078[_0x9d52('0x18')]?_0x224078[_0x9d52('0x18')]:moment()['format'](_0x9d52('0x1a')),'callback':_0x224078['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x224078[_0x9d52('0x2a')]?_0x224078[_0x9d52('0x2a')]:undefined,'callbackat':_0x224078[_0x9d52('0x2a')]?moment()[_0x9d52('0x19')](_0x9d52('0x1a')):undefined,'VoiceQueueId':_0x328578['id']});})[_0x9d52('0x2b')](function(_0x2ecb01){_0x4f73c2(_0x2ecb01);});});});};var _0x4772cd=function(_0x5084b2){return new BPromise(function(_0x5b74eb,_0x13b90e){_0x57934d(_0x5084b2,_0x224078)[_0x9d52('0x1e')](function(_0x2f06bc){_0x224078[_0x9d52('0x18')]=_0x2f06bc[_0x9d52('0x22')];_0x25cb55['CmHopper'][_0x9d52('0x24')]({'where':{'phone':_0x224078[_0x9d52('0x9')],'VoiceQueueId':_0x5084b2['id']}})['then'](function(_0x4adaae){if(!_['isNil'](_0x4adaae)){throw new Error(_0x9d52('0x25')+_0x224078['phone']+_0x9d52('0x2c')+_0x5084b2['id']);}return _0x25cb55['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x224078[_0x9d52('0x9')],'VoiceQueueId':_0x5084b2['id']}});})['then'](function(_0x1555f4){if(!_[_0x9d52('0x1b')](_0x1555f4)){throw new Error(_0x9d52('0x2d')+_0x224078['phone']+_0x9d52('0x2e')+_0x5084b2['id']);}return _0x25cb55['CmHopper'][_0x9d52('0x27')]({'phone':_0x224078['phone'],'ContactId':_0x224078['id'],'ListId':_0x224078['ListId'],'priority':_0x224078[_0x9d52('0x29')]?_0x224078[_0x9d52('0x29')]:0x2,'scheduledat':_0x224078[_0x9d52('0x18')]?_0x224078[_0x9d52('0x18')]:moment()[_0x9d52('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x224078[_0x9d52('0x2a')]?!![]:![],'callbackuniqueid':_0x224078[_0x9d52('0x2a')]?_0x224078[_0x9d52('0x2a')]:undefined,'callbackat':_0x224078[_0x9d52('0x2a')]?moment()[_0x9d52('0x19')](_0x9d52('0x1a')):undefined,'VoiceQueueId':_0x5084b2['id']});})['catch'](function(_0x1eb299){_0x13b90e(_0x1eb299);});});});};function _0x56af25(){return function(_0x414c90){logger[_0x9d52('0x14')]('cmContact','afterCreate',util[_0x9d52('0x17')](_0x414c90,{'showHidden':![],'depth':null}));};}function _0x3d1b85(_0x5556f3,_0x56f303){var _0x1e9994=_0x56f303[_0x9d52('0x18')]?_0x56f303['scheduledat']:moment()[_0x9d52('0x19')](_0x9d52('0x1a'));return new BPromise(function(_0x5baa61,_0x445676){if(_['isNil'](_0x56f303[_0x9d52('0x1c')])){_0x5baa61({'ret':_0x1e9994});}else{_0x25cb55[_0x9d52('0x2f')]['findOne']({'where':{'id':_0x5556f3['id']}})[_0x9d52('0x1e')](function(_0x206492){if(!_['isNil'](_0x206492)){var _0x41aa03=_0x206492[_0x9d52('0x1c')];if(!_[_0x9d52('0x1b')](_0x41aa03)){var _0x1f56b7=shared[_0x9d52('0x1f')];var _0x536dbb=_0x1f56b7[_0x41aa03];var _0x1f08fc=_0x1f56b7[_0x56f303[_0x9d52('0x1c')]];if(!_['isNil'](_0x536dbb)&&!_[_0x9d52('0x1b')](_0x1f08fc)){var _0x4e18fb=_0x536dbb[_0x9d52('0x20')]-_0x1f08fc['utcOffset'];_0x1e9994=_0x56f303[_0x9d52('0x18')]?_0x56f303[_0x9d52('0x18')]:moment();var _0x55c94c=moment(_0x1e9994)[_0x9d52('0x30')](_0x4e18fb,_0x9d52('0x21'));_0x5baa61({'ret':_0x55c94c[_0x9d52('0x19')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x5baa61({'ret':_0x1e9994});}else _0x5baa61({'ret':_0x1e9994});}else{_0x5baa61({'ret':_0x1e9994});}});}});return 0xa;}var _0x324120=function(_0x2593ba){return new BPromise(function(_0x17fdff,_0x295b77){_0x3d1b85(_0x2593ba,_0x224078)[_0x9d52('0x1e')](function(_0x410e31){_0x224078['scheduledat']=_0x410e31[_0x9d52('0x22')];_0x25cb55['CmHopper']['findOne']({'where':{'phone':_0x224078[_0x9d52('0x9')],'CampaignId':_0x2593ba['id']}})['then'](function(_0x23a3c2){if(!_[_0x9d52('0x1b')](_0x23a3c2)){throw new Error('cmContact,\x20afterCreate\x20'+_0x224078['phone']+_0x9d52('0x31')+_0x2593ba['id']);}return _0x25cb55[_0x9d52('0x23')][_0x9d52('0x27')]({'phone':_0x224078[_0x9d52('0x9')],'ContactId':_0x224078['id'],'ListId':_0x224078[_0x9d52('0x28')],'priority':_0x224078[_0x9d52('0x29')]?_0x224078['priority']:0x2,'scheduledat':_0x224078[_0x9d52('0x18')]?_0x224078['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x224078[_0x9d52('0x2a')]?!![]:![],'callbackuniqueid':_0x224078['callbackUniqueid']?_0x224078[_0x9d52('0x2a')]:undefined,'callbackat':_0x224078[_0x9d52('0x2a')]?moment()[_0x9d52('0x19')](_0x9d52('0x1a')):undefined,'CampaignId':_0x2593ba['id']});})['catch'](function(_0x4895f4){_0x295b77(_0x4895f4);});});});};var _0x37c0bc=function(_0x45afa6){return new BPromise(function(_0x2ed5b7,_0x3829c5){_0x3d1b85(_0x45afa6,_0x224078)[_0x9d52('0x1e')](function(_0x376103){_0x224078[_0x9d52('0x18')]=_0x376103[_0x9d52('0x22')];_0x25cb55['CmHopper'][_0x9d52('0x24')]({'where':{'phone':_0x224078[_0x9d52('0x9')],'CampaignId':_0x45afa6['id']}})[_0x9d52('0x1e')](function(_0xde75e2){if(!_['isNil'](_0xde75e2)){throw new Error('cmContact,\x20afterCreate\x20'+_0x224078[_0x9d52('0x9')]+_0x9d52('0x32')+_0x45afa6['id']);}return _0x25cb55[_0x9d52('0x33')][_0x9d52('0x24')]({'where':{'calleridnum':_0x224078[_0x9d52('0x9')],'CampaignId':_0x45afa6['id']}});})['then'](function(_0x3f3711){if(!_[_0x9d52('0x1b')](_0x3f3711)){throw new Error(_0x9d52('0x2d')+_0x224078[_0x9d52('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x45afa6['id']);}return _0x25cb55[_0x9d52('0x23')][_0x9d52('0x27')]({'phone':_0x224078[_0x9d52('0x9')],'ContactId':_0x224078['id'],'ListId':_0x224078[_0x9d52('0x28')],'priority':_0x224078[_0x9d52('0x29')]?_0x224078[_0x9d52('0x29')]:0x2,'scheduledat':_0x224078[_0x9d52('0x18')]?_0x224078[_0x9d52('0x18')]:moment()[_0x9d52('0x19')](_0x9d52('0x1a')),'callback':_0x224078[_0x9d52('0x2a')]?!![]:![],'callbackuniqueid':_0x224078[_0x9d52('0x2a')]?_0x224078[_0x9d52('0x2a')]:undefined,'callbackat':_0x224078['callbackUniqueid']?moment()[_0x9d52('0x19')](_0x9d52('0x1a')):undefined,'CampaignId':_0x45afa6['id']});})[_0x9d52('0x2b')](function(_0x4f2e0c){_0x3829c5(_0x4f2e0c);});});});};if(_0x224078[_0x9d52('0x28')]){_0x25cb55[_0x9d52('0x1d')]['findAll']({'where':{'type':_0x9d52('0x34')},'attributes':['id',_0x9d52('0x35'),_0x9d52('0x1c')],'include':[{'model':_0x25cb55[_0x9d52('0x36')],'as':_0x9d52('0x37'),'where':{'id':_0x224078[_0x9d52('0x28')]}}]})[_0x9d52('0x1e')](function(_0x6400f2){if(_0x6400f2){var _0x53f8d2=[];for(var _0x20a128=0x0,_0x46babd;_0x20a128<_0x6400f2[_0x9d52('0x38')];_0x20a128+=0x1){_0x46babd=_0x6400f2[_0x20a128]['get']({'plain':!![]});switch(_0x46babd[_0x9d52('0x35')]){case _0x9d52('0x39'):_0x4772cd(_0x46babd)[_0x9d52('0x2b')](_0x4fa5ee());break;case _0x9d52('0x3a'):_0x46584c(_0x46babd)['catch'](_0x4fa5ee());break;default:_0x3d1b85(_0x46babd,_0x224078)[_0x9d52('0x1e')](function(_0x200c32){_0x224078[_0x9d52('0x18')]=_0x200c32[_0x9d52('0x22')];_0x25cb55['CmHopper'][_0x9d52('0x27')]({'phone':_0x224078['phone'],'ContactId':_0x224078['id'],'ListId':_0x224078['ListId'],'scheduledat':_0x224078[_0x9d52('0x18')]?_0x224078['scheduledat']:moment()['format'](_0x9d52('0x1a')),'priority':_0x224078['priority']?_0x224078[_0x9d52('0x29')]:0x2,'callback':_0x224078['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x224078[_0x9d52('0x2a')]?_0x224078['callbackUniqueid']:undefined,'callbackat':_0x224078[_0x9d52('0x2a')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x46babd['id']})[_0x9d52('0x2b')](_0x4fa5ee());});}}}})[_0x9d52('0x1e')](function(){return _0x25cb55[_0x9d52('0x1d')][_0x9d52('0x3b')]({'where':{'type':_0x9d52('0x34')},'attributes':['id'],'include':[{'model':_0x25cb55[_0x9d52('0x36')],'as':_0x9d52('0x3c'),'where':{'id':_0x224078[_0x9d52('0x28')]}}]})[_0x9d52('0x1e')](function(_0x124695){if(_0x124695){var _0x5df54f=[];for(var _0x54bbab=0x0,_0xbec16b;_0x54bbab<_0x124695[_0x9d52('0x38')];_0x54bbab+=0x1){_0xbec16b=_0x124695[_0x54bbab][_0x9d52('0x13')]({'plain':!![]});_0x25cb55[_0x9d52('0x3d')]['create']({'phone':_0x224078['phone'],'ContactId':_0x224078['id'],'ListId':_0x224078['ListId'],'VoiceQueueId':_0xbec16b['id']})[_0x9d52('0x2b')](function(_0x472689){logger[_0x9d52('0x14')]('cmContact,\x20%s,\x20%s','afterCreate',_0x472689[_0x9d52('0x3e')]);});}}});})[_0x9d52('0x1e')](function(){return _0x25cb55[_0x9d52('0x2f')]['findAll']({'attributes':['id',_0x9d52('0x35'),_0x9d52('0x1c')],'include':[{'model':_0x25cb55[_0x9d52('0x36')],'as':_0x9d52('0x37'),'where':{'id':_0x224078[_0x9d52('0x28')]}}]})[_0x9d52('0x1e')](function(_0x50b853){if(_0x50b853){var _0xbed395=[];for(var _0x250df8=0x0,_0x235945;_0x250df8<_0x50b853['length'];_0x250df8+=0x1){_0x235945=_0x50b853[_0x250df8][_0x9d52('0x13')]({'plain':!![]});switch(_0x235945[_0x9d52('0x35')]){case _0x9d52('0x39'):_0x37c0bc(_0x235945)[_0x9d52('0x2b')](_0x56af25());break;case'onlyIfOpen':_0x324120(_0x235945)[_0x9d52('0x2b')](_0x56af25());break;default:_0x25cb55[_0x9d52('0x23')][_0x9d52('0x27')]({'phone':_0x224078[_0x9d52('0x9')],'ContactId':_0x224078['id'],'ListId':_0x224078[_0x9d52('0x28')],'scheduledat':_0x224078['scheduledat']?_0x224078[_0x9d52('0x18')]:moment()[_0x9d52('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x224078[_0x9d52('0x29')]?_0x224078['priority']:0x2,'callback':_0x224078[_0x9d52('0x2a')]?!![]:![],'callbackuniqueid':_0x224078[_0x9d52('0x2a')]?_0x224078[_0x9d52('0x2a')]:undefined,'callbackat':_0x224078[_0x9d52('0x2a')]?moment()[_0x9d52('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x235945['id']})['catch'](_0x56af25());}}}});})[_0x9d52('0x1e')](function(){return _0x25cb55['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x25cb55['CmList'],'as':_0x9d52('0x3c'),'where':{'id':_0x224078[_0x9d52('0x28')]}}]})[_0x9d52('0x1e')](function(_0x11387a){if(_0x11387a){var _0x2e778f=[];for(var _0x33d38e=0x0,_0x1a46ad;_0x33d38e<_0x11387a[_0x9d52('0x38')];_0x33d38e+=0x1){_0x1a46ad=_0x11387a[_0x33d38e]['get']({'plain':!![]});_0x25cb55[_0x9d52('0x3d')][_0x9d52('0x27')]({'phone':_0x224078[_0x9d52('0x9')],'ContactId':_0x224078['id'],'ListId':_0x224078[_0x9d52('0x28')],'CampaignId':_0x1a46ad['id']})[_0x9d52('0x2b')](function(_0x1f08dc){logger['error'](_0x9d52('0x3f'),_0x9d52('0x16'),_0x1f08dc[_0x9d52('0x3e')]);});}}});})[_0x9d52('0x1e')](function(){_0x14c626();})['catch'](function(_0x20fab3){logger[_0x9d52('0x14')](_0x9d52('0x3f'),'afterCreate',_0x20fab3['message']);_0x14c626(_0x20fab3);});}else{_0x14c626(new Error(_0x9d52('0x40')));}},'afterDestroy':function(_0xa7a614,_0x2aef5a,_0x32ce37){var _0x247fe9=_0x447901['models'];var _0x4d52b5=_0xa7a614[_0x9d52('0x13')]({'plain':!![]});return _0x247fe9[_0x9d52('0x23')][_0x9d52('0x3b')]({'raw':!![],'where':{'ListId':_0x4d52b5['ListId'],'ContactId':_0x4d52b5['id']}})[_0x9d52('0x1e')](function(_0x15f198){if(!_[_0x9d52('0x41')](_0x15f198)){var _0x13c802=[];for(var _0x30b2e4=0x0;_0x30b2e4<_0x15f198[_0x9d52('0x38')];_0x30b2e4+=0x1){var _0xa40f47=_0x247fe9['CmHopper'][_0x9d52('0x42')]({'where':{'ListId':_0x15f198[_0x30b2e4][_0x9d52('0x28')],'ContactId':_0x15f198[_0x30b2e4][_0x9d52('0x43')],'VoiceQueueId':_0x15f198[_0x30b2e4][_0x9d52('0x44')],'CampaignId':_0x15f198[_0x30b2e4]['CampaignId']}});_0x13c802[_0x9d52('0x45')](_0xa40f47);}return BPromise[_0x9d52('0x46')](_0x13c802);}})[_0x9d52('0x1e')](function(_0x4763a6){logger[_0x9d52('0x47')](_0x9d52('0x48'),util['inspect'](_0x4763a6,{'showHidden':![],'depth':null}));_0x32ce37();})[_0x9d52('0x2b')](function(_0x4cb78d){logger[_0x9d52('0x14')](_0x9d52('0x49'),util[_0x9d52('0x17')](_0x4cb78d,{'showHidden':![],'depth':null}));_0x32ce37(_0x4cb78d);});}}});}; \ No newline at end of file +var _0xc03a=['dialCheckDuplicateType','CmList','length','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','Lists','message','List\x20not\x20found','models','isEmpty','ContactId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment/shared','exports','define','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','catch','Campaign','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound'];(function(_0x5c7f6d,_0x5d03a3){var _0x128160=function(_0x177de9){while(--_0x177de9){_0x5c7f6d['push'](_0x5c7f6d['shift']());}};_0x128160(++_0x5d03a3);}(_0xc03a,0x180));var _0xac03=function(_0x24afdb,_0x4ef53b){_0x24afdb=_0x24afdb-0x0;var _0x3c4604=_0xc03a[_0x24afdb];return _0x3c4604;};'use strict';var _=require(_0xac03('0x0'));var util=require(_0xac03('0x1'));var logger=require(_0xac03('0x2'))(_0xac03('0x3'));var moment=require('moment');var BPromise=require(_0xac03('0x4'));var rp=require(_0xac03('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac03('0x6'));var config=require('../../config/environment');var shared=require(_0xac03('0x7'));var attributes=require('./cmContact.attributes');module[_0xac03('0x8')]=function(_0x229fd6,_0x27999e){return _0x229fd6[_0xac03('0x9')](_0xac03('0xa'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xac03('0xb'),'fields':[_0xac03('0xb')]},{'name':_0xac03('0xc'),'fields':[_0xac03('0xd'),_0xac03('0xe'),_0xac03('0xb'),_0xac03('0xf'),_0xac03('0x10'),_0xac03('0x11')],'type':_0xac03('0x12')}],'timestamps':!![],'charset':_0xac03('0x13'),'collate':_0xac03('0x14'),'hooks':{'afterCreate':function(_0x34a4a7,_0x2b2481,_0x10b372){var _0x5a793f=_0x229fd6['models'];var _0x435721=_0x34a4a7[_0xac03('0x15')]({'plain':!![]});function _0x15f402(){return function(_0x5c42b8){logger[_0xac03('0x16')](_0xac03('0x17'),_0xac03('0x18'),util[_0xac03('0x19')](_0x5c42b8,{'showHidden':![],'depth':null}));};}function _0x6193e3(_0x176d20,_0x5e30b5){var _0x3f0529=_0x5e30b5[_0xac03('0x1a')]?_0x5e30b5[_0xac03('0x1a')]:moment()[_0xac03('0x1b')](_0xac03('0x1c'));return new BPromise(function(_0x10a77a,_0x1a6ab9){if(_[_0xac03('0x1d')](_0x5e30b5[_0xac03('0x1e')])){_0x10a77a({'ret':_0x3f0529});}else{_0x5a793f[_0xac03('0x1f')][_0xac03('0x20')]({'where':{'id':_0x176d20['id']}})[_0xac03('0x21')](function(_0x497073){if(!_[_0xac03('0x1d')](_0x497073)){var _0x24db35=_0x497073['dialTimezone'];if(!_['isNil'](_0x24db35)){var _0x2006ec=shared[_0xac03('0x22')];var _0x45fc58=_0x2006ec[_0x24db35];var _0x4aa181=_0x2006ec[_0x5e30b5[_0xac03('0x1e')]];if(!_['isNil'](_0x45fc58)&&!_[_0xac03('0x1d')](_0x4aa181)){var _0x3df97e=_0x45fc58[_0xac03('0x23')]-_0x4aa181[_0xac03('0x23')];_0x3f0529=_0x5e30b5[_0xac03('0x1a')]?_0x5e30b5['scheduledat']:moment();var _0x3b1361=moment(_0x3f0529)['add'](_0x3df97e,'minutes');_0x10a77a({'ret':_0x3b1361[_0xac03('0x1b')](_0xac03('0x1c'))});}else _0x10a77a({'ret':_0x3f0529});}else _0x10a77a({'ret':_0x3f0529});}else{_0x10a77a({'ret':_0x3f0529});}});}});return 0xa;}var _0x313cb8=function(_0x49d934){return new BPromise(function(_0x4573c1,_0x20e94c){_0x6193e3(_0x49d934,_0x435721)[_0xac03('0x21')](function(_0xedc8b9){_0x435721[_0xac03('0x1a')]=_0xedc8b9[_0xac03('0x24')];_0x5a793f[_0xac03('0x25')]['findOne']({'where':{'phone':_0x435721[_0xac03('0xb')],'VoiceQueueId':_0x49d934['id']}})[_0xac03('0x21')](function(_0x160f24){if(!_['isNil'](_0x160f24)){throw new Error(_0xac03('0x26')+_0x435721[_0xac03('0xb')]+_0xac03('0x27')+_0x49d934['id']);}return _0x5a793f['CmHopper'][_0xac03('0x28')]({'phone':_0x435721['phone'],'ContactId':_0x435721['id'],'ListId':_0x435721[_0xac03('0x29')],'priority':_0x435721[_0xac03('0x2a')]?_0x435721[_0xac03('0x2a')]:0x2,'scheduledat':_0x435721[_0xac03('0x1a')]?_0x435721[_0xac03('0x1a')]:moment()['format'](_0xac03('0x1c')),'callback':_0x435721[_0xac03('0x2b')]?!![]:![],'callbackuniqueid':_0x435721[_0xac03('0x2b')]?_0x435721['callbackUniqueid']:undefined,'callbackat':_0x435721[_0xac03('0x2b')]?moment()[_0xac03('0x1b')](_0xac03('0x1c')):undefined,'VoiceQueueId':_0x49d934['id']});})['catch'](function(_0x1c26f2){_0x20e94c(_0x1c26f2);});});});};var _0x460003=function(_0x346474){return new BPromise(function(_0x28e8cf,_0x500b9e){_0x6193e3(_0x346474,_0x435721)['then'](function(_0xa8842f){_0x435721[_0xac03('0x1a')]=_0xa8842f[_0xac03('0x24')];_0x5a793f[_0xac03('0x25')]['findOne']({'where':{'phone':_0x435721[_0xac03('0xb')],'VoiceQueueId':_0x346474['id']}})[_0xac03('0x21')](function(_0x151f9a){if(!_['isNil'](_0x151f9a)){throw new Error(_0xac03('0x26')+_0x435721[_0xac03('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x346474['id']);}return _0x5a793f['CmHopperFinal'][_0xac03('0x20')]({'where':{'calleridnum':_0x435721['phone'],'VoiceQueueId':_0x346474['id']}});})[_0xac03('0x21')](function(_0x18f92e){if(!_[_0xac03('0x1d')](_0x18f92e)){throw new Error(_0xac03('0x2c')+_0x435721['phone']+_0xac03('0x2d')+_0x346474['id']);}return _0x5a793f[_0xac03('0x25')][_0xac03('0x28')]({'phone':_0x435721['phone'],'ContactId':_0x435721['id'],'ListId':_0x435721[_0xac03('0x29')],'priority':_0x435721[_0xac03('0x2a')]?_0x435721[_0xac03('0x2a')]:0x2,'scheduledat':_0x435721[_0xac03('0x1a')]?_0x435721[_0xac03('0x1a')]:moment()['format'](_0xac03('0x1c')),'callback':_0x435721[_0xac03('0x2b')]?!![]:![],'callbackuniqueid':_0x435721['callbackUniqueid']?_0x435721[_0xac03('0x2b')]:undefined,'callbackat':_0x435721['callbackUniqueid']?moment()[_0xac03('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x346474['id']});})[_0xac03('0x2e')](function(_0x3ca718){_0x500b9e(_0x3ca718);});});});};function _0x5d12c8(){return function(_0x2b85e5){logger[_0xac03('0x16')](_0xac03('0x17'),_0xac03('0x18'),util[_0xac03('0x19')](_0x2b85e5,{'showHidden':![],'depth':null}));};}function _0x58beac(_0x3ab85e,_0x947bea){var _0x2767c9=_0x947bea['scheduledat']?_0x947bea[_0xac03('0x1a')]:moment()[_0xac03('0x1b')](_0xac03('0x1c'));return new BPromise(function(_0x130d50,_0x520ac5){if(_[_0xac03('0x1d')](_0x947bea[_0xac03('0x1e')])){_0x130d50({'ret':_0x2767c9});}else{_0x5a793f[_0xac03('0x2f')][_0xac03('0x20')]({'where':{'id':_0x3ab85e['id']}})[_0xac03('0x21')](function(_0x55acc8){if(!_[_0xac03('0x1d')](_0x55acc8)){var _0x34289a=_0x55acc8[_0xac03('0x1e')];if(!_[_0xac03('0x1d')](_0x34289a)){var _0x1480ce=shared[_0xac03('0x22')];var _0x4a324d=_0x1480ce[_0x34289a];var _0x3d9821=_0x1480ce[_0x947bea[_0xac03('0x1e')]];if(!_[_0xac03('0x1d')](_0x4a324d)&&!_['isNil'](_0x3d9821)){var _0x39fe2d=_0x4a324d[_0xac03('0x23')]-_0x3d9821[_0xac03('0x23')];_0x2767c9=_0x947bea[_0xac03('0x1a')]?_0x947bea[_0xac03('0x1a')]:moment();var _0x1d51dc=moment(_0x2767c9)[_0xac03('0x30')](_0x39fe2d,'minutes');_0x130d50({'ret':_0x1d51dc[_0xac03('0x1b')](_0xac03('0x1c'))});}else _0x130d50({'ret':_0x2767c9});}else _0x130d50({'ret':_0x2767c9});}else{_0x130d50({'ret':_0x2767c9});}});}});return 0xa;}var _0x3e5faf=function(_0x30161c){return new BPromise(function(_0x35e0d3,_0x5dd99b){_0x58beac(_0x30161c,_0x435721)[_0xac03('0x21')](function(_0x288b50){_0x435721['scheduledat']=_0x288b50[_0xac03('0x24')];_0x5a793f[_0xac03('0x25')][_0xac03('0x20')]({'where':{'phone':_0x435721[_0xac03('0xb')],'CampaignId':_0x30161c['id']}})[_0xac03('0x21')](function(_0x4a2437){if(!_[_0xac03('0x1d')](_0x4a2437)){throw new Error(_0xac03('0x26')+_0x435721[_0xac03('0xb')]+_0xac03('0x31')+_0x30161c['id']);}return _0x5a793f[_0xac03('0x25')][_0xac03('0x28')]({'phone':_0x435721[_0xac03('0xb')],'ContactId':_0x435721['id'],'ListId':_0x435721['ListId'],'priority':_0x435721[_0xac03('0x2a')]?_0x435721[_0xac03('0x2a')]:0x2,'scheduledat':_0x435721[_0xac03('0x1a')]?_0x435721['scheduledat']:moment()[_0xac03('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x435721[_0xac03('0x2b')]?!![]:![],'callbackuniqueid':_0x435721[_0xac03('0x2b')]?_0x435721[_0xac03('0x2b')]:undefined,'callbackat':_0x435721[_0xac03('0x2b')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x30161c['id']});})[_0xac03('0x2e')](function(_0x1f60d9){_0x5dd99b(_0x1f60d9);});});});};var _0x1e86d8=function(_0x5ce735){return new BPromise(function(_0x1d2a96,_0x157157){_0x58beac(_0x5ce735,_0x435721)['then'](function(_0x537825){_0x435721[_0xac03('0x1a')]=_0x537825[_0xac03('0x24')];_0x5a793f[_0xac03('0x25')][_0xac03('0x20')]({'where':{'phone':_0x435721[_0xac03('0xb')],'CampaignId':_0x5ce735['id']}})[_0xac03('0x21')](function(_0x582463){if(!_[_0xac03('0x1d')](_0x582463)){throw new Error(_0xac03('0x26')+_0x435721[_0xac03('0xb')]+_0xac03('0x32')+_0x5ce735['id']);}return _0x5a793f['CmHopperFinal'][_0xac03('0x20')]({'where':{'calleridnum':_0x435721['phone'],'CampaignId':_0x5ce735['id']}});})[_0xac03('0x21')](function(_0x491ab7){if(!_[_0xac03('0x1d')](_0x491ab7)){throw new Error(_0xac03('0x2c')+_0x435721['phone']+_0xac03('0x33')+_0x5ce735['id']);}return _0x5a793f[_0xac03('0x25')][_0xac03('0x28')]({'phone':_0x435721[_0xac03('0xb')],'ContactId':_0x435721['id'],'ListId':_0x435721[_0xac03('0x29')],'priority':_0x435721['priority']?_0x435721[_0xac03('0x2a')]:0x2,'scheduledat':_0x435721[_0xac03('0x1a')]?_0x435721[_0xac03('0x1a')]:moment()['format'](_0xac03('0x1c')),'callback':_0x435721['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x435721['callbackUniqueid']?_0x435721[_0xac03('0x2b')]:undefined,'callbackat':_0x435721[_0xac03('0x2b')]?moment()[_0xac03('0x1b')](_0xac03('0x1c')):undefined,'CampaignId':_0x5ce735['id']});})[_0xac03('0x2e')](function(_0x389d8f){_0x157157(_0x389d8f);});});});};if(_0x435721[_0xac03('0x29')]){_0x5a793f[_0xac03('0x1f')][_0xac03('0x34')]({'where':{'type':_0xac03('0x35')},'attributes':['id',_0xac03('0x36'),_0xac03('0x1e')],'include':[{'model':_0x5a793f[_0xac03('0x37')],'as':'Lists','where':{'id':_0x435721[_0xac03('0x29')]}}]})[_0xac03('0x21')](function(_0x2d8489){if(_0x2d8489){var _0x4048ce=[];for(var _0x440111=0x0,_0x13b53a;_0x440111<_0x2d8489[_0xac03('0x38')];_0x440111+=0x1){_0x13b53a=_0x2d8489[_0x440111][_0xac03('0x15')]({'plain':!![]});switch(_0x13b53a['dialCheckDuplicateType']){case _0xac03('0x39'):_0x460003(_0x13b53a)['catch'](_0x15f402());break;case _0xac03('0x3a'):_0x313cb8(_0x13b53a)['catch'](_0x15f402());break;default:_0x58beac(_0x13b53a,_0x435721)[_0xac03('0x21')](function(_0x3298c8){_0x435721[_0xac03('0x1a')]=_0x3298c8[_0xac03('0x24')];_0x5a793f[_0xac03('0x25')][_0xac03('0x28')]({'phone':_0x435721[_0xac03('0xb')],'ContactId':_0x435721['id'],'ListId':_0x435721['ListId'],'scheduledat':_0x435721[_0xac03('0x1a')]?_0x435721[_0xac03('0x1a')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x435721[_0xac03('0x2a')]?_0x435721[_0xac03('0x2a')]:0x2,'callback':_0x435721[_0xac03('0x2b')]?!![]:![],'callbackuniqueid':_0x435721[_0xac03('0x2b')]?_0x435721['callbackUniqueid']:undefined,'callbackat':_0x435721[_0xac03('0x2b')]?moment()[_0xac03('0x1b')](_0xac03('0x1c')):undefined,'VoiceQueueId':_0x13b53a['id']})['catch'](_0x15f402());});}}}})[_0xac03('0x21')](function(){return _0x5a793f[_0xac03('0x1f')][_0xac03('0x34')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x5a793f[_0xac03('0x37')],'as':_0xac03('0x3b'),'where':{'id':_0x435721[_0xac03('0x29')]}}]})[_0xac03('0x21')](function(_0x27e0e0){if(_0x27e0e0){var _0xa8a87a=[];for(var _0x29a0b7=0x0,_0x4df0a3;_0x29a0b7<_0x27e0e0[_0xac03('0x38')];_0x29a0b7+=0x1){_0x4df0a3=_0x27e0e0[_0x29a0b7][_0xac03('0x15')]({'plain':!![]});_0x5a793f[_0xac03('0x3c')][_0xac03('0x28')]({'phone':_0x435721[_0xac03('0xb')],'ContactId':_0x435721['id'],'ListId':_0x435721['ListId'],'VoiceQueueId':_0x4df0a3['id']})[_0xac03('0x2e')](function(_0x1a4f7e){logger[_0xac03('0x16')](_0xac03('0x3d'),'afterCreate',_0x1a4f7e['message']);});}}});})[_0xac03('0x21')](function(){return _0x5a793f['Campaign']['findAll']({'attributes':['id',_0xac03('0x36'),'dialTimezone'],'include':[{'model':_0x5a793f[_0xac03('0x37')],'as':_0xac03('0x3e'),'where':{'id':_0x435721[_0xac03('0x29')]}}]})['then'](function(_0x5d0b5c){if(_0x5d0b5c){var _0x1d06e3=[];for(var _0x68ef6f=0x0,_0x559a3d;_0x68ef6f<_0x5d0b5c[_0xac03('0x38')];_0x68ef6f+=0x1){_0x559a3d=_0x5d0b5c[_0x68ef6f][_0xac03('0x15')]({'plain':!![]});switch(_0x559a3d[_0xac03('0x36')]){case _0xac03('0x39'):_0x1e86d8(_0x559a3d)[_0xac03('0x2e')](_0x5d12c8());break;case _0xac03('0x3a'):_0x3e5faf(_0x559a3d)[_0xac03('0x2e')](_0x5d12c8());break;default:_0x5a793f[_0xac03('0x25')]['create']({'phone':_0x435721[_0xac03('0xb')],'ContactId':_0x435721['id'],'ListId':_0x435721[_0xac03('0x29')],'scheduledat':_0x435721['scheduledat']?_0x435721['scheduledat']:moment()[_0xac03('0x1b')](_0xac03('0x1c')),'priority':_0x435721['priority']?_0x435721[_0xac03('0x2a')]:0x2,'callback':_0x435721[_0xac03('0x2b')]?!![]:![],'callbackuniqueid':_0x435721[_0xac03('0x2b')]?_0x435721[_0xac03('0x2b')]:undefined,'callbackat':_0x435721[_0xac03('0x2b')]?moment()[_0xac03('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x559a3d['id']})[_0xac03('0x2e')](_0x5d12c8());}}}});})[_0xac03('0x21')](function(){return _0x5a793f['Campaign'][_0xac03('0x34')]({'attributes':['id'],'include':[{'model':_0x5a793f[_0xac03('0x37')],'as':_0xac03('0x3b'),'where':{'id':_0x435721[_0xac03('0x29')]}}]})[_0xac03('0x21')](function(_0x593050){if(_0x593050){var _0x371dd9=[];for(var _0xe9e4dd=0x0,_0x1feba7;_0xe9e4dd<_0x593050['length'];_0xe9e4dd+=0x1){_0x1feba7=_0x593050[_0xe9e4dd]['get']({'plain':!![]});_0x5a793f[_0xac03('0x3c')][_0xac03('0x28')]({'phone':_0x435721[_0xac03('0xb')],'ContactId':_0x435721['id'],'ListId':_0x435721[_0xac03('0x29')],'CampaignId':_0x1feba7['id']})['catch'](function(_0x309bb4){logger[_0xac03('0x16')]('cmContact,\x20%s,\x20%s',_0xac03('0x18'),_0x309bb4[_0xac03('0x3f')]);});}}});})[_0xac03('0x21')](function(){_0x10b372();})['catch'](function(_0x8ebd2a){logger[_0xac03('0x16')]('cmContact,\x20%s,\x20%s',_0xac03('0x18'),_0x8ebd2a[_0xac03('0x3f')]);_0x10b372(_0x8ebd2a);});}else{_0x10b372(new Error(_0xac03('0x40')));}},'afterDestroy':function(_0x39f6d4,_0x5eac76,_0x3e6d7d){var _0x2f84c5=_0x229fd6[_0xac03('0x41')];var _0x3a5bd7=_0x39f6d4[_0xac03('0x15')]({'plain':!![]});return _0x2f84c5[_0xac03('0x25')][_0xac03('0x34')]({'raw':!![],'where':{'ListId':_0x3a5bd7[_0xac03('0x29')],'ContactId':_0x3a5bd7['id']}})[_0xac03('0x21')](function(_0x1ffc5d){if(!_[_0xac03('0x42')](_0x1ffc5d)){var _0x30f305=[];for(var _0x62767c=0x0;_0x62767c<_0x1ffc5d[_0xac03('0x38')];_0x62767c+=0x1){var _0x2d5f34=_0x2f84c5[_0xac03('0x25')]['destroy']({'where':{'ListId':_0x1ffc5d[_0x62767c][_0xac03('0x29')],'ContactId':_0x1ffc5d[_0x62767c][_0xac03('0x43')],'VoiceQueueId':_0x1ffc5d[_0x62767c]['VoiceQueueId'],'CampaignId':_0x1ffc5d[_0x62767c][_0xac03('0x44')]}});_0x30f305[_0xac03('0x45')](_0x2d5f34);}return BPromise['all'](_0x30f305);}})[_0xac03('0x21')](function(_0x5b856d){logger[_0xac03('0x46')](_0xac03('0x47'),util[_0xac03('0x19')](_0x5b856d,{'showHidden':![],'depth':null}));_0x3e6d7d();})[_0xac03('0x2e')](function(_0x29a526){logger[_0xac03('0x16')](_0xac03('0x48'),util[_0xac03('0x19')](_0x29a526,{'showHidden':![],'depth':null}));_0x3e6d7d(_0x29a526);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 3b989e8..f2baf22 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x604240,_0x44bff1){var _0x524659=function(_0x4d1d29){while(--_0x4d1d29){_0x604240['push'](_0x604240['shift']());}};_0x524659(++_0x44bff1);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x531ba9,_0x2b5165){var _0x32b2c6=function(_0x369070){while(--_0x369070){_0x531ba9['push'](_0x531ba9['shift']());}};_0x32b2c6(++_0x2b5165);}(_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['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/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index e66e2cc..0d58b00 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d53=['sequelize','exports','STRING','INTEGER','PHONE'];(function(_0x6bbc50,_0x26b8e9){var _0x5e8e93=function(_0x2dda79){while(--_0x2dda79){_0x6bbc50['push'](_0x6bbc50['shift']());}};_0x5e8e93(++_0x26b8e9);}(_0x8d53,0x1c2));var _0x38d5=function(_0x547328,_0x4a6ff0){_0x547328=_0x547328-0x0;var _0x1a428c=_0x8d53[_0x547328];return _0x1a428c;};'use strict';var Sequelize=require(_0x38d5('0x0'));module[_0x38d5('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x38d5('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x38d5('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x38d5('0x2')],'defaultValue':_0x38d5('0x4')},'OrderBy':{'type':Sequelize[_0x38d5('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x38d5('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x238f=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x4d9cad,_0x5562ff){var _0x23efed=function(_0x402bec){while(--_0x402bec){_0x4d9cad['push'](_0x4d9cad['shift']());}};_0x23efed(++_0x5562ff);}(_0x238f,0xa5));var _0xf238=function(_0x599aa8,_0x41505c){_0x599aa8=_0x599aa8-0x0;var _0x23ef8f=_0x238f[_0x599aa8];return _0x23ef8f;};'use strict';var Sequelize=require(_0xf238('0x0'));module[_0xf238('0x1')]={'CmContactId':{'type':Sequelize[_0xf238('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xf238('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xf238('0x3')],'defaultValue':_0xf238('0x4')},'OrderBy':{'type':Sequelize[_0xf238('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xf238('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index f8b66cd..ea16741 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f67=['map','CmContactHasItem','rawAttributes','type','model','keys','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','include','findAll','rows','catch','show','params','intersection','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','send','index'];(function(_0x21d58c,_0x1c3bfe){var _0x4ea447=function(_0x141079){while(--_0x141079){_0x21d58c['push'](_0x21d58c['shift']());}};_0x4ea447(++_0x1c3bfe);}(_0x6f67,0xcd));var _0x76f6=function(_0x4702b2,_0x5e063b){_0x4702b2=_0x4702b2-0x0;var _0x2aef33=_0x6f67[_0x4702b2];return _0x2aef33;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x76f6('0x0'));var jsonpatch=require(_0x76f6('0x1'));var rp=require(_0x76f6('0x2'));var moment=require(_0x76f6('0x3'));var BPromise=require(_0x76f6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x76f6('0x5'));var sox=require(_0x76f6('0x6'));var csv=require(_0x76f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f6('0x8'));var _=require(_0x76f6('0x9'));var squel=require(_0x76f6('0xa'));var crypto=require(_0x76f6('0xb'));var jsforce=require(_0x76f6('0xc'));var deskjs=require(_0x76f6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x76f6('0xe'));var Papa=require('papaparse');var Redis=require(_0x76f6('0xf'));var authService=require(_0x76f6('0x10'));var qs=require(_0x76f6('0x11'));var as=require(_0x76f6('0x12'));var hardwareService=require(_0x76f6('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x76f6('0x14'));var config=require(_0x76f6('0x15'));var licenseUtil=require(_0x76f6('0x16'));var db=require(_0x76f6('0x17'))['db'];function respondWithStatusCode(_0x500386,_0x367274){_0x367274=_0x367274||0xcc;return function(_0x288f84){if(_0x288f84){return _0x500386['sendStatus'](_0x367274);}return _0x500386[_0x76f6('0x18')](_0x367274)[_0x76f6('0x19')]();};}function respondWithResult(_0x298ff4,_0x26079e){_0x26079e=_0x26079e||0xc8;return function(_0x653e15){if(_0x653e15){return _0x298ff4[_0x76f6('0x18')](_0x26079e)[_0x76f6('0x1a')](_0x653e15);}};}function respondWithFilteredResult(_0x2d6dab,_0x56b9b8){return function(_0x1b0287){if(_0x1b0287){var _0x521b58=typeof _0x56b9b8[_0x76f6('0x1b')]==='undefined'&&typeof _0x56b9b8[_0x76f6('0x1c')]===_0x76f6('0x1d');var _0x23d0dd=_0x1b0287[_0x76f6('0x1e')];var _0x25e5fd=_0x521b58?0x0:_0x56b9b8[_0x76f6('0x1b')];var _0x298649=_0x521b58?_0x1b0287[_0x76f6('0x1e')]:_0x56b9b8[_0x76f6('0x1b')]+_0x56b9b8[_0x76f6('0x1c')];var _0x3e7a4c;if(_0x298649>=_0x23d0dd){_0x298649=_0x23d0dd;_0x3e7a4c=0xc8;}else{_0x3e7a4c=0xce;}_0x2d6dab['status'](_0x3e7a4c);return _0x2d6dab[_0x76f6('0x1f')](_0x76f6('0x20'),_0x25e5fd+'-'+_0x298649+'/'+_0x23d0dd)['json'](_0x1b0287);}return null;};}function patchUpdates(_0x540542){return function(_0x5d07ef){try{jsonpatch['apply'](_0x5d07ef,_0x540542,!![]);}catch(_0xaa402d){return BPromise[_0x76f6('0x21')](_0xaa402d);}return _0x5d07ef[_0x76f6('0x22')]();};}function saveUpdates(_0x5858a2,_0x188d14){return function(_0x230160){if(_0x230160){return _0x230160[_0x76f6('0x23')](_0x5858a2)[_0x76f6('0x24')](function(_0x4b0d11){return _0x4b0d11;});}return null;};}function removeEntity(_0x680b23,_0x5375ca){return function(_0x44155b){if(_0x44155b){return _0x44155b[_0x76f6('0x25')]()[_0x76f6('0x24')](function(){var _0x29dd02=_0x44155b[_0x76f6('0x26')]({'plain':!![]});var _0x54872c=_0x76f6('0x27');return db[_0x76f6('0x28')][_0x76f6('0x25')]({'where':{'type':_0x54872c,'resourceId':_0x29dd02['id']}})[_0x76f6('0x24')](function(){return _0x44155b;});})[_0x76f6('0x24')](function(){_0x680b23[_0x76f6('0x18')](0xcc)[_0x76f6('0x19')]();});}};}function handleEntityNotFound(_0x550ba7,_0x3e4cd4){return function(_0x2d1d9e){if(!_0x2d1d9e){_0x550ba7[_0x76f6('0x29')](0x194);}return _0x2d1d9e;};}function handleError(_0x208a3e,_0xe2c235){_0xe2c235=_0xe2c235||0x1f4;return function(_0x1f441a){logger[_0x76f6('0x2a')](_0x1f441a[_0x76f6('0x2b')]);if(_0x1f441a[_0x76f6('0x2c')]){delete _0x1f441a[_0x76f6('0x2c')];}_0x208a3e[_0x76f6('0x18')](_0xe2c235)[_0x76f6('0x2d')](_0x1f441a);};}exports[_0x76f6('0x2e')]=function(_0x2ceaf4,_0x7c5290){var _0x555cf1={},_0x4aca8e={},_0x46675b={'count':0x0,'rows':[]};var _0x6b746d=_[_0x76f6('0x2f')](db[_0x76f6('0x30')][_0x76f6('0x31')],function(_0x36a31c){return{'name':_0x36a31c['fieldName'],'type':_0x36a31c[_0x76f6('0x32')]['key']};});_0x4aca8e[_0x76f6('0x33')]=_[_0x76f6('0x2f')](_0x6b746d,'name');_0x4aca8e['query']=_[_0x76f6('0x34')](_0x2ceaf4['query']);_0x4aca8e[_0x76f6('0x35')]=_['intersection'](_0x4aca8e[_0x76f6('0x33')],_0x4aca8e[_0x76f6('0x36')]);_0x555cf1[_0x76f6('0x37')]=_['intersection'](_0x4aca8e[_0x76f6('0x33')],qs[_0x76f6('0x38')](_0x2ceaf4[_0x76f6('0x36')][_0x76f6('0x38')]));_0x555cf1[_0x76f6('0x37')]=_0x555cf1[_0x76f6('0x37')][_0x76f6('0x39')]?_0x555cf1[_0x76f6('0x37')]:_0x4aca8e[_0x76f6('0x33')];if(!_0x2ceaf4[_0x76f6('0x36')][_0x76f6('0x3a')](_0x76f6('0x3b'))){_0x555cf1['limit']=qs[_0x76f6('0x1c')](_0x2ceaf4['query'][_0x76f6('0x1c')]);_0x555cf1[_0x76f6('0x1b')]=qs[_0x76f6('0x1b')](_0x2ceaf4[_0x76f6('0x36')][_0x76f6('0x1b')]);}_0x555cf1[_0x76f6('0x3c')]=qs[_0x76f6('0x3d')](_0x2ceaf4[_0x76f6('0x36')][_0x76f6('0x3d')]);_0x555cf1['where']=qs['filters'](_[_0x76f6('0x3e')](_0x2ceaf4[_0x76f6('0x36')],_0x4aca8e[_0x76f6('0x35')]),_0x6b746d);if(_0x2ceaf4['query'][_0x76f6('0x3f')]){_0x555cf1['where']=_[_0x76f6('0x40')](_0x555cf1[_0x76f6('0x41')],{'$or':_['map'](_0x6b746d,function(_0xa5d8dc){if(_0xa5d8dc['type']!=='VIRTUAL'){var _0x855f78={};_0x855f78[_0xa5d8dc[_0x76f6('0x2c')]]={'$like':'%'+_0x2ceaf4['query']['filter']+'%'};return _0x855f78;}})});}_0x555cf1=_[_0x76f6('0x40')]({},_0x555cf1,_0x2ceaf4[_0x76f6('0x42')]);var _0x2ccdd0={'where':_0x555cf1[_0x76f6('0x41')]};return db[_0x76f6('0x30')][_0x76f6('0x1e')](_0x2ccdd0)['then'](function(_0x4fcd88){_0x46675b[_0x76f6('0x1e')]=_0x4fcd88;if(_0x2ceaf4[_0x76f6('0x36')]['includeAll']){_0x555cf1[_0x76f6('0x43')]=[{'all':!![]}];}return db[_0x76f6('0x30')][_0x76f6('0x44')](_0x555cf1);})[_0x76f6('0x24')](function(_0x3a5f98){_0x46675b[_0x76f6('0x45')]=_0x3a5f98;return _0x46675b;})[_0x76f6('0x24')](respondWithFilteredResult(_0x7c5290,_0x555cf1))[_0x76f6('0x46')](handleError(_0x7c5290,null));};exports[_0x76f6('0x47')]=function(_0x47de78,_0x5e18d0){var _0x56d0e7={'raw':!![],'where':{'id':_0x47de78[_0x76f6('0x48')]['id']}},_0x3630e4={};_0x3630e4[_0x76f6('0x33')]=_[_0x76f6('0x34')](db[_0x76f6('0x30')][_0x76f6('0x31')]);_0x3630e4['query']=_[_0x76f6('0x34')](_0x47de78[_0x76f6('0x36')]);_0x3630e4[_0x76f6('0x35')]=_[_0x76f6('0x49')](_0x3630e4['model'],_0x3630e4['query']);_0x56d0e7[_0x76f6('0x37')]=_[_0x76f6('0x49')](_0x3630e4[_0x76f6('0x33')],qs[_0x76f6('0x38')](_0x47de78[_0x76f6('0x36')][_0x76f6('0x38')]));_0x56d0e7[_0x76f6('0x37')]=_0x56d0e7[_0x76f6('0x37')][_0x76f6('0x39')]?_0x56d0e7[_0x76f6('0x37')]:_0x3630e4['model'];if(_0x47de78[_0x76f6('0x36')][_0x76f6('0x4a')]){_0x56d0e7[_0x76f6('0x43')]=[{'all':!![]}];}_0x56d0e7=_['merge']({},_0x56d0e7,_0x47de78['options']);return db[_0x76f6('0x30')]['find'](_0x56d0e7)[_0x76f6('0x24')](handleEntityNotFound(_0x5e18d0,null))[_0x76f6('0x24')](respondWithResult(_0x5e18d0,null))['catch'](handleError(_0x5e18d0,null));};exports[_0x76f6('0x4b')]=function(_0x331312,_0x5b98b3){return db[_0x76f6('0x30')]['create'](_0x331312[_0x76f6('0x4c')],{})[_0x76f6('0x24')](function(_0x38c034){var _0x317f57=_0x331312[_0x76f6('0x4d')][_0x76f6('0x26')]({'plain':!![]});if(!_0x317f57)throw new Error(_0x76f6('0x4e'));if(_0x317f57['role']===_0x76f6('0x4d')){var _0x1bec48=_0x38c034[_0x76f6('0x26')]({'plain':!![]});var _0xcc05ea=_0x76f6('0x27');return db[_0x76f6('0x4f')][_0x76f6('0x50')]({'where':{'name':_0xcc05ea,'userProfileId':_0x317f57[_0x76f6('0x51')]},'raw':!![]})[_0x76f6('0x24')](function(_0xe7155f){if(_0xe7155f&&_0xe7155f[_0x76f6('0x52')]===0x0){return db['UserProfileResource'][_0x76f6('0x4b')]({'name':_0x1bec48[_0x76f6('0x2c')],'resourceId':_0x1bec48['id'],'type':_0xe7155f[_0x76f6('0x2c')],'sectionId':_0xe7155f['id']},{})['then'](function(){return _0x38c034;});}else{return _0x38c034;}})[_0x76f6('0x46')](function(_0x155e00){logger[_0x76f6('0x2a')](_0x76f6('0x53'),_0x155e00);throw _0x155e00;});}return _0x38c034;})[_0x76f6('0x24')](respondWithResult(_0x5b98b3,0xc9))[_0x76f6('0x46')](handleError(_0x5b98b3,null));};exports[_0x76f6('0x23')]=function(_0x8e435a,_0x402c51){if(_0x8e435a[_0x76f6('0x4c')]['id']){delete _0x8e435a['body']['id'];}return db[_0x76f6('0x30')]['find']({'where':{'id':_0x8e435a['params']['id']}})['then'](handleEntityNotFound(_0x402c51,null))[_0x76f6('0x24')](saveUpdates(_0x8e435a[_0x76f6('0x4c')],null))['then'](respondWithResult(_0x402c51,null))[_0x76f6('0x46')](handleError(_0x402c51,null));};exports['destroy']=function(_0x47e397,_0x213a0c){return db['CmContactHasItem'][_0x76f6('0x50')]({'where':{'id':_0x47e397[_0x76f6('0x48')]['id']}})[_0x76f6('0x24')](handleEntityNotFound(_0x213a0c,null))[_0x76f6('0x24')](removeEntity(_0x213a0c,null))[_0x76f6('0x46')](handleError(_0x213a0c,null));}; \ No newline at end of file +var _0xae91=['save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','type','VIRTUAL','options','count','include','findAll','rows','catch','params','includeAll','merge','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','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject'];(function(_0x3091ed,_0x5d45a0){var _0x1e63f4=function(_0x161834){while(--_0x161834){_0x3091ed['push'](_0x3091ed['shift']());}};_0x1e63f4(++_0x5d45a0);}(_0xae91,0x1e6));var _0x1ae9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xae91[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x1ae9('0x0'));var rimraf=require(_0x1ae9('0x1'));var zipdir=require(_0x1ae9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ae9('0x3'));var moment=require(_0x1ae9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1ae9('0x5'));var util=require(_0x1ae9('0x6'));var path=require(_0x1ae9('0x7'));var sox=require(_0x1ae9('0x8'));var csv=require(_0x1ae9('0x9'));var ejs=require(_0x1ae9('0xa'));var fs=require('fs');var fs_extra=require(_0x1ae9('0xb'));var _=require(_0x1ae9('0xc'));var squel=require(_0x1ae9('0xd'));var crypto=require('crypto');var jsforce=require(_0x1ae9('0xe'));var deskjs=require(_0x1ae9('0xf'));var toCsv=require(_0x1ae9('0x9'));var querystring=require('querystring');var Papa=require(_0x1ae9('0x10'));var Redis=require(_0x1ae9('0x11'));var authService=require(_0x1ae9('0x12'));var qs=require(_0x1ae9('0x13'));var as=require(_0x1ae9('0x14'));var hardwareService=require(_0x1ae9('0x15'));var logger=require(_0x1ae9('0x16'))('api');var utils=require(_0x1ae9('0x17'));var config=require(_0x1ae9('0x18'));var licenseUtil=require(_0x1ae9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2dcacb,_0x2258c0){_0x2258c0=_0x2258c0||0xcc;return function(_0x17f601){if(_0x17f601){return _0x2dcacb[_0x1ae9('0x1a')](_0x2258c0);}return _0x2dcacb['status'](_0x2258c0)[_0x1ae9('0x1b')]();};}function respondWithResult(_0x15a5f5,_0xc4891d){_0xc4891d=_0xc4891d||0xc8;return function(_0x22efc6){if(_0x22efc6){return _0x15a5f5[_0x1ae9('0x1c')](_0xc4891d)[_0x1ae9('0x1d')](_0x22efc6);}};}function respondWithFilteredResult(_0x8d10d5,_0x27c05e){return function(_0x579358){if(_0x579358){var _0x1dbb69=typeof _0x27c05e[_0x1ae9('0x1e')]===_0x1ae9('0x1f')&&typeof _0x27c05e[_0x1ae9('0x20')]==='undefined';var _0x2baf11=_0x579358['count'];var _0x5b46ec=_0x1dbb69?0x0:_0x27c05e[_0x1ae9('0x1e')];var _0x418778=_0x1dbb69?_0x579358['count']:_0x27c05e[_0x1ae9('0x1e')]+_0x27c05e[_0x1ae9('0x20')];var _0x1af5ae;if(_0x418778>=_0x2baf11){_0x418778=_0x2baf11;_0x1af5ae=0xc8;}else{_0x1af5ae=0xce;}_0x8d10d5[_0x1ae9('0x1c')](_0x1af5ae);return _0x8d10d5['set'](_0x1ae9('0x21'),_0x5b46ec+'-'+_0x418778+'/'+_0x2baf11)[_0x1ae9('0x1d')](_0x579358);}return null;};}function patchUpdates(_0x518f3c){return function(_0x7bfc3c){try{jsonpatch[_0x1ae9('0x22')](_0x7bfc3c,_0x518f3c,!![]);}catch(_0x118010){return BPromise[_0x1ae9('0x23')](_0x118010);}return _0x7bfc3c[_0x1ae9('0x24')]();};}function saveUpdates(_0x3ed7de,_0x243bb2){return function(_0x5f224a){if(_0x5f224a){return _0x5f224a[_0x1ae9('0x25')](_0x3ed7de)[_0x1ae9('0x26')](function(_0x453b1e){return _0x453b1e;});}return null;};}function removeEntity(_0x28b3b9,_0x4c19f2){return function(_0x29e483){if(_0x29e483){return _0x29e483[_0x1ae9('0x27')]()[_0x1ae9('0x26')](function(){var _0x3c2328=_0x29e483[_0x1ae9('0x28')]({'plain':!![]});var _0x58c03d=_0x1ae9('0x29');return db[_0x1ae9('0x2a')][_0x1ae9('0x27')]({'where':{'type':_0x58c03d,'resourceId':_0x3c2328['id']}})[_0x1ae9('0x26')](function(){return _0x29e483;});})[_0x1ae9('0x26')](function(){_0x28b3b9[_0x1ae9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14d039,_0x3cbfbe){return function(_0x1dfb51){if(!_0x1dfb51){_0x14d039['sendStatus'](0x194);}return _0x1dfb51;};}function handleError(_0x1f2687,_0xfea4bc){_0xfea4bc=_0xfea4bc||0x1f4;return function(_0x5983e1){logger[_0x1ae9('0x2b')](_0x5983e1[_0x1ae9('0x2c')]);if(_0x5983e1[_0x1ae9('0x2d')]){delete _0x5983e1[_0x1ae9('0x2d')];}_0x1f2687[_0x1ae9('0x1c')](_0xfea4bc)[_0x1ae9('0x2e')](_0x5983e1);};}exports[_0x1ae9('0x2f')]=function(_0x1818f9,_0xe68d17){var _0x491214={},_0x6c023b={},_0xa20ec4={'count':0x0,'rows':[]};var _0x4ebc9e=_[_0x1ae9('0x30')](db[_0x1ae9('0x31')][_0x1ae9('0x32')],function(_0xa681){return{'name':_0xa681[_0x1ae9('0x33')],'type':_0xa681['type'][_0x1ae9('0x34')]};});_0x6c023b[_0x1ae9('0x35')]=_[_0x1ae9('0x30')](_0x4ebc9e,'name');_0x6c023b[_0x1ae9('0x36')]=_[_0x1ae9('0x37')](_0x1818f9['query']);_0x6c023b['filters']=_[_0x1ae9('0x38')](_0x6c023b['model'],_0x6c023b['query']);_0x491214[_0x1ae9('0x39')]=_[_0x1ae9('0x38')](_0x6c023b[_0x1ae9('0x35')],qs['fields'](_0x1818f9[_0x1ae9('0x36')][_0x1ae9('0x3a')]));_0x491214['attributes']=_0x491214[_0x1ae9('0x39')][_0x1ae9('0x3b')]?_0x491214[_0x1ae9('0x39')]:_0x6c023b[_0x1ae9('0x35')];if(!_0x1818f9['query'][_0x1ae9('0x3c')]('nolimit')){_0x491214[_0x1ae9('0x20')]=qs[_0x1ae9('0x20')](_0x1818f9[_0x1ae9('0x36')][_0x1ae9('0x20')]);_0x491214[_0x1ae9('0x1e')]=qs[_0x1ae9('0x1e')](_0x1818f9[_0x1ae9('0x36')]['offset']);}_0x491214[_0x1ae9('0x3d')]=qs['sort'](_0x1818f9['query'][_0x1ae9('0x3e')]);_0x491214[_0x1ae9('0x3f')]=qs[_0x1ae9('0x40')](_['pick'](_0x1818f9[_0x1ae9('0x36')],_0x6c023b[_0x1ae9('0x40')]),_0x4ebc9e);if(_0x1818f9[_0x1ae9('0x36')][_0x1ae9('0x41')]){_0x491214[_0x1ae9('0x3f')]=_['merge'](_0x491214[_0x1ae9('0x3f')],{'$or':_[_0x1ae9('0x30')](_0x4ebc9e,function(_0x13c95f){if(_0x13c95f[_0x1ae9('0x42')]!==_0x1ae9('0x43')){var _0x891b02={};_0x891b02[_0x13c95f[_0x1ae9('0x2d')]]={'$like':'%'+_0x1818f9[_0x1ae9('0x36')][_0x1ae9('0x41')]+'%'};return _0x891b02;}})});}_0x491214=_['merge']({},_0x491214,_0x1818f9[_0x1ae9('0x44')]);var _0x2024b7={'where':_0x491214[_0x1ae9('0x3f')]};return db[_0x1ae9('0x31')][_0x1ae9('0x45')](_0x2024b7)[_0x1ae9('0x26')](function(_0x245df4){_0xa20ec4[_0x1ae9('0x45')]=_0x245df4;if(_0x1818f9['query']['includeAll']){_0x491214[_0x1ae9('0x46')]=[{'all':!![]}];}return db[_0x1ae9('0x31')][_0x1ae9('0x47')](_0x491214);})[_0x1ae9('0x26')](function(_0x4616b4){_0xa20ec4[_0x1ae9('0x48')]=_0x4616b4;return _0xa20ec4;})[_0x1ae9('0x26')](respondWithFilteredResult(_0xe68d17,_0x491214))[_0x1ae9('0x49')](handleError(_0xe68d17,null));};exports['show']=function(_0x12ccba,_0x21af7a){var _0x3891ab={'raw':!![],'where':{'id':_0x12ccba[_0x1ae9('0x4a')]['id']}},_0x15d778={};_0x15d778[_0x1ae9('0x35')]=_[_0x1ae9('0x37')](db[_0x1ae9('0x31')]['rawAttributes']);_0x15d778['query']=_['keys'](_0x12ccba[_0x1ae9('0x36')]);_0x15d778[_0x1ae9('0x40')]=_['intersection'](_0x15d778[_0x1ae9('0x35')],_0x15d778[_0x1ae9('0x36')]);_0x3891ab[_0x1ae9('0x39')]=_[_0x1ae9('0x38')](_0x15d778[_0x1ae9('0x35')],qs[_0x1ae9('0x3a')](_0x12ccba[_0x1ae9('0x36')][_0x1ae9('0x3a')]));_0x3891ab[_0x1ae9('0x39')]=_0x3891ab[_0x1ae9('0x39')][_0x1ae9('0x3b')]?_0x3891ab[_0x1ae9('0x39')]:_0x15d778[_0x1ae9('0x35')];if(_0x12ccba['query'][_0x1ae9('0x4b')]){_0x3891ab[_0x1ae9('0x46')]=[{'all':!![]}];}_0x3891ab=_[_0x1ae9('0x4c')]({},_0x3891ab,_0x12ccba[_0x1ae9('0x44')]);return db[_0x1ae9('0x31')][_0x1ae9('0x4d')](_0x3891ab)[_0x1ae9('0x26')](handleEntityNotFound(_0x21af7a,null))['then'](respondWithResult(_0x21af7a,null))[_0x1ae9('0x49')](handleError(_0x21af7a,null));};exports[_0x1ae9('0x4e')]=function(_0x5a862a,_0x56c817){return db[_0x1ae9('0x31')]['create'](_0x5a862a[_0x1ae9('0x4f')],{})[_0x1ae9('0x26')](function(_0x300865){var _0x41391d=_0x5a862a['user'][_0x1ae9('0x28')]({'plain':!![]});if(!_0x41391d)throw new Error(_0x1ae9('0x50'));if(_0x41391d[_0x1ae9('0x51')]===_0x1ae9('0x52')){var _0x2777eb=_0x300865[_0x1ae9('0x28')]({'plain':!![]});var _0x1d8127=_0x1ae9('0x29');return db[_0x1ae9('0x53')][_0x1ae9('0x4d')]({'where':{'name':_0x1d8127,'userProfileId':_0x41391d[_0x1ae9('0x54')]},'raw':!![]})[_0x1ae9('0x26')](function(_0x14a600){if(_0x14a600&&_0x14a600[_0x1ae9('0x55')]===0x0){return db['UserProfileResource'][_0x1ae9('0x4e')]({'name':_0x2777eb['name'],'resourceId':_0x2777eb['id'],'type':_0x14a600['name'],'sectionId':_0x14a600['id']},{})[_0x1ae9('0x26')](function(){return _0x300865;});}else{return _0x300865;}})['catch'](function(_0x410fd2){logger[_0x1ae9('0x2b')](_0x1ae9('0x56'),_0x410fd2);throw _0x410fd2;});}return _0x300865;})['then'](respondWithResult(_0x56c817,0xc9))[_0x1ae9('0x49')](handleError(_0x56c817,null));};exports[_0x1ae9('0x25')]=function(_0x205ef6,_0xb1474f){if(_0x205ef6[_0x1ae9('0x4f')]['id']){delete _0x205ef6[_0x1ae9('0x4f')]['id'];}return db[_0x1ae9('0x31')][_0x1ae9('0x4d')]({'where':{'id':_0x205ef6[_0x1ae9('0x4a')]['id']}})[_0x1ae9('0x26')](handleEntityNotFound(_0xb1474f,null))[_0x1ae9('0x26')](saveUpdates(_0x205ef6[_0x1ae9('0x4f')],null))['then'](respondWithResult(_0xb1474f,null))['catch'](handleError(_0xb1474f,null));};exports[_0x1ae9('0x27')]=function(_0x30d635,_0x4f541f){return db[_0x1ae9('0x31')]['find']({'where':{'id':_0x30d635[_0x1ae9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f541f,null))[_0x1ae9('0x26')](removeEntity(_0x4f541f,null))[_0x1ae9('0x49')](handleError(_0x4f541f,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index af57b77..2b8e05e 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11ca=['define','CmContactHasItem','cm_contact_has_items','lodash','moment','bluebird','../../config/environment'];(function(_0xa9281b,_0x57b5d1){var _0x400cd7=function(_0x2005ee){while(--_0x2005ee){_0xa9281b['push'](_0xa9281b['shift']());}};_0x400cd7(++_0x57b5d1);}(_0x11ca,0x10d));var _0xa11c=function(_0x2507ae,_0x155d93){_0x2507ae=_0x2507ae-0x0;var _0x4c9710=_0x11ca[_0x2507ae];return _0x4c9710;};'use strict';var _=require(_0xa11c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa11c('0x1'));var BPromise=require(_0xa11c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa11c('0x3'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0x1c8d25,_0x5c49b6){return _0x1c8d25[_0xa11c('0x4')](_0xa11c('0x5'),attributes,{'tableName':_0xa11c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed5f=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','define','cm_contact_has_items','lodash','util'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0xed5f,0x106));var _0xfed5=function(_0x21b4f3,_0x388c0a){_0x21b4f3=_0x21b4f3-0x0;var _0x59031c=_0xed5f[_0x21b4f3];return _0x59031c;};'use strict';var _=require(_0xfed5('0x0'));var util=require(_0xfed5('0x1'));var logger=require(_0xfed5('0x2'))('api');var moment=require(_0xfed5('0x3'));var BPromise=require(_0xfed5('0x4'));var rp=require(_0xfed5('0x5'));var fs=require('fs');var path=require(_0xfed5('0x6'));var rimraf=require(_0xfed5('0x7'));var config=require(_0xfed5('0x8'));var attributes=require(_0xfed5('0x9'));module['exports']=function(_0xe65ec5,_0x4c5f15){return _0xe65ec5[_0xfed5('0xa')]('CmContactHasItem',attributes,{'tableName':_0xfed5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 49f1001..0b00f67 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x845d=['request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1a1c3d,_0x16a27b){var _0x5b4d4f=function(_0x2ff4be){while(--_0x2ff4be){_0x1a1c3d['push'](_0x1a1c3d['shift']());}};_0x5b4d4f(++_0x16a27b);}(_0x845d,0x1c3));var _0xd845=function(_0x307f0,_0x514242){_0x307f0=_0x307f0-0x0;var _0x49921f=_0x845d[_0x307f0];return _0x49921f;};'use strict';var _=require('lodash');var util=require(_0xd845('0x0'));var moment=require(_0xd845('0x1'));var BPromise=require(_0xd845('0x2'));var rs=require(_0xd845('0x3'));var fs=require('fs');var Redis=require(_0xd845('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd845('0x5'));var logger=require(_0xd845('0x6'))('rpc');var config=require(_0xd845('0x7'));var jayson=require(_0xd845('0x8'));var client=jayson[_0xd845('0x9')][_0xd845('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e068a,_0x2d8c8e,_0x4719e0){return new BPromise(function(_0xca0487,_0x4f7eb5){return client[_0xd845('0xb')](_0x4e068a,_0x4719e0)[_0xd845('0xc')](function(_0x43f88e){logger['info'](_0xd845('0xd'),_0x2d8c8e,_0xd845('0xe'));logger[_0xd845('0xf')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x2d8c8e,_0xd845('0xe'),JSON[_0xd845('0x10')](_0x43f88e));if(_0x43f88e[_0xd845('0x11')]){if(_0x43f88e[_0xd845('0x11')]['code']===0x1f4){logger[_0xd845('0x11')](_0xd845('0xd'),_0x2d8c8e,_0x43f88e[_0xd845('0x11')]['message']);return _0x4f7eb5(_0x43f88e[_0xd845('0x11')][_0xd845('0x12')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x2d8c8e,_0x43f88e[_0xd845('0x11')]['message']);return _0xca0487(_0x43f88e[_0xd845('0x11')][_0xd845('0x12')]);}else{logger[_0xd845('0x13')](_0xd845('0xd'),_0x2d8c8e,'request\x20sent');_0xca0487(_0x43f88e[_0xd845('0x14')][_0xd845('0x12')]);}})['catch'](function(_0xe802e2){logger[_0xd845('0x11')](_0xd845('0xd'),_0x2d8c8e,_0xe802e2);_0x4f7eb5(_0xe802e2);});});} \ No newline at end of file +var _0x58ef=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x58ef,0xf1));var _0xf58e=function(_0x16e8bd,_0x4c99b2){_0x16e8bd=_0x16e8bd-0x0;var _0x1516ba=_0x58ef[_0x16e8bd];return _0x1516ba;};'use strict';var _=require(_0xf58e('0x0'));var util=require(_0xf58e('0x1'));var moment=require(_0xf58e('0x2'));var BPromise=require(_0xf58e('0x3'));var rs=require(_0xf58e('0x4'));var fs=require('fs');var Redis=require(_0xf58e('0x5'));var db=require(_0xf58e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf58e('0x7'))(_0xf58e('0x8'));var config=require(_0xf58e('0x9'));var jayson=require(_0xf58e('0xa'));var client=jayson['client'][_0xf58e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f1b8a,_0x57e8f2,_0x3cab93){return new BPromise(function(_0x3685cb,_0x95df9b){return client[_0xf58e('0xc')](_0x3f1b8a,_0x3cab93)[_0xf58e('0xd')](function(_0x27446c){logger[_0xf58e('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x57e8f2,_0xf58e('0xf'));logger[_0xf58e('0x10')](_0xf58e('0x11'),_0x57e8f2,_0xf58e('0xf'),JSON[_0xf58e('0x12')](_0x27446c));if(_0x27446c[_0xf58e('0x13')]){if(_0x27446c[_0xf58e('0x13')][_0xf58e('0x14')]===0x1f4){logger[_0xf58e('0x13')](_0xf58e('0x15'),_0x57e8f2,_0x27446c[_0xf58e('0x13')]['message']);return _0x95df9b(_0x27446c['error'][_0xf58e('0x16')]);}logger[_0xf58e('0x13')](_0xf58e('0x15'),_0x57e8f2,_0x27446c[_0xf58e('0x13')][_0xf58e('0x16')]);return _0x3685cb(_0x27446c[_0xf58e('0x13')][_0xf58e('0x16')]);}else{logger[_0xf58e('0xe')](_0xf58e('0x15'),_0x57e8f2,_0xf58e('0xf'));_0x3685cb(_0x27446c['result'][_0xf58e('0x16')]);}})[_0xf58e('0x17')](function(_0x4ce455){logger['error'](_0xf58e('0x15'),_0x57e8f2,_0x4ce455);_0x95df9b(_0x4ce455);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index a78591e..a10fb03 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3c3=['./cmContactHasItem.controller','get','index','/:id','isAuthenticated','show','create','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4ac819,_0x26aec5){var _0x59d4a9=function(_0x62ef62){while(--_0x62ef62){_0x4ac819['push'](_0x4ac819['shift']());}};_0x59d4a9(++_0x26aec5);}(_0xb3c3,0x1ce));var _0x3b3c=function(_0x50f54c,_0x145310){_0x50f54c=_0x50f54c-0x0;var _0x4af4fd=_0xb3c3[_0x50f54c];return _0x4af4fd;};'use strict';var multer=require(_0x3b3c('0x0'));var util=require('util');var path=require(_0x3b3c('0x1'));var timeout=require('connect-timeout');var express=require(_0x3b3c('0x2'));var router=express['Router']();var fs_extra=require(_0x3b3c('0x3'));var auth=require(_0x3b3c('0x4'));var interaction=require(_0x3b3c('0x5'));var config=require('../../config/environment');var controller=require(_0x3b3c('0x6'));router[_0x3b3c('0x7')]('/',auth['isAuthenticated'](),controller[_0x3b3c('0x8')]);router['get'](_0x3b3c('0x9'),auth[_0x3b3c('0xa')](),controller[_0x3b3c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3b3c('0xc')]);router['put'](_0x3b3c('0x9'),auth[_0x3b3c('0xa')](),controller['update']);router['delete'](_0x3b3c('0x9'),auth[_0x3b3c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9124=['fs-extra','../../config/environment','./cmContactHasItem.controller','index','/:id','post','isAuthenticated','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x143f68,_0x3435f6){var _0x2fc373=function(_0xdc1b5d){while(--_0xdc1b5d){_0x143f68['push'](_0x143f68['shift']());}};_0x2fc373(++_0x3435f6);}(_0x9124,0x83));var _0x4912=function(_0x105176,_0xb7816a){_0x105176=_0x105176-0x0;var _0x3c0709=_0x9124[_0x105176];return _0x3c0709;};'use strict';var multer=require(_0x4912('0x0'));var util=require(_0x4912('0x1'));var path=require('path');var timeout=require(_0x4912('0x2'));var express=require(_0x4912('0x3'));var router=express[_0x4912('0x4')]();var fs_extra=require(_0x4912('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4912('0x6'));var controller=require(_0x4912('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4912('0x8')]);router['get'](_0x4912('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4912('0xa')]('/',auth[_0x4912('0xb')](),controller[_0x4912('0xc')]);router['put'](_0x4912('0x9'),auth[_0x4912('0xb')](),controller[_0x4912('0xd')]);router[_0x4912('0xe')](_0x4912('0x9'),auth['isAuthenticated'](),controller[_0x4912('0xf')]);module[_0x4912('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 701fc54..6a9d27c 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 _0xb8da=['values','isArray','stringify','BOOLEAN','voice','sequelize','lodash','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','long','type','select','parse'];(function(_0x384447,_0x41669a){var _0x3810db=function(_0x3f1288){while(--_0x3f1288){_0x384447['push'](_0x384447['shift']());}};_0x3810db(++_0x41669a);}(_0xb8da,0x1ae));var _0xab8d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb8da[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xab8d('0x0'));var _=require(_0xab8d('0x1'));module['exports']={'name':{'type':Sequelize[_0xab8d('0x2')],'get':function(_0x11706c){return this[_0xab8d('0x3')]('alias');}},'alias':{'type':Sequelize[_0xab8d('0x4')],'allowNull':![],'set':function(_0x4fac29){this[_0xab8d('0x5')](_0xab8d('0x6'),_0x4fac29?_0x4fac29:this[_0xab8d('0x3')](_0xab8d('0x7')));}},'type':{'type':Sequelize[_0xab8d('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xab8d('0x8')),'get':function(){if(this[_0xab8d('0x3')](_0xab8d('0x9'))===_0xab8d('0xa')){return JSON[_0xab8d('0xb')](this['getDataValue'](_0xab8d('0xc')));}else{return this[_0xab8d('0x3')](_0xab8d('0xc'));}},'set':function(_0x81c7c6){if(Array[_0xab8d('0xd')](_0x81c7c6)){this[_0xab8d('0x5')](_0xab8d('0xc'),JSON[_0xab8d('0xe')](_0x81c7c6));}else{this['setDataValue'](_0xab8d('0xc'),_0x81c7c6);}}},'required':{'type':Sequelize[_0xab8d('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xab8d('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xab8d('0x10'))}}; \ No newline at end of file +var _0xa35c=['setDataValue','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','getDataValue','alias','STRING'];(function(_0x10adbe,_0x24bbe8){var _0x181f45=function(_0x163953){while(--_0x163953){_0x10adbe['push'](_0x10adbe['shift']());}};_0x181f45(++_0x24bbe8);}(_0xa35c,0xf6));var _0xca35=function(_0x40d661,_0xc26671){_0x40d661=_0x40d661-0x0;var _0x228bae=_0xa35c[_0x40d661];return _0x228bae;};'use strict';var Sequelize=require('sequelize');var _=require(_0xca35('0x0'));module[_0xca35('0x1')]={'name':{'type':Sequelize[_0xca35('0x2')],'get':function(_0x306489){return this[_0xca35('0x3')](_0xca35('0x4'));}},'alias':{'type':Sequelize[_0xca35('0x5')],'allowNull':![],'set':function(_0x5382c0){this[_0xca35('0x6')](_0xca35('0x4'),_0x5382c0?_0x5382c0:this[_0xca35('0x3')]('name'));}},'type':{'type':Sequelize[_0xca35('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xca35('0x7')](_0xca35('0x8')),'get':function(){if(this['getDataValue'](_0xca35('0x9'))===_0xca35('0xa')){return JSON[_0xca35('0xb')](this[_0xca35('0x3')](_0xca35('0xc')));}else{return this[_0xca35('0x3')]('values');}},'set':function(_0x3692fe){if(Array[_0xca35('0xd')](_0x3692fe)){this[_0xca35('0x6')](_0xca35('0xc'),JSON[_0xca35('0xe')](_0x3692fe));}else{this['setDataValue'](_0xca35('0xc'),_0x3692fe);}}},'required':{'type':Sequelize[_0xca35('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xca35('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xca35('0x10')](_0xca35('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index bba9873..451c2b8 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 _0x777c=['sequelize','transaction','Sequelize','TEXT','switch','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','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','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','differenceBy','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','CmCustomField','includeAll','include','findAll','rows','catch','show','length','options','find','body','create'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0x777c,0x10b));var _0xc777=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x777c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc777('0x0'));var rimraf=require(_0xc777('0x1'));var zipdir=require(_0xc777('0x2'));var jsonpatch=require(_0xc777('0x3'));var rp=require(_0xc777('0x4'));var moment=require(_0xc777('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc777('0x6'));var sox=require(_0xc777('0x7'));var csv=require(_0xc777('0x8'));var ejs=require(_0xc777('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc777('0xa'));var squel=require(_0xc777('0xb'));var crypto=require(_0xc777('0xc'));var jsforce=require(_0xc777('0xd'));var deskjs=require(_0xc777('0xe'));var toCsv=require(_0xc777('0x8'));var querystring=require(_0xc777('0xf'));var Papa=require(_0xc777('0x10'));var Redis=require(_0xc777('0x11'));var authService=require(_0xc777('0x12'));var qs=require(_0xc777('0x13'));var as=require(_0xc777('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc777('0x15'))(_0xc777('0x16'));var utils=require(_0xc777('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc777('0x18'));var db=require(_0xc777('0x19'))['db'];function respondWithStatusCode(_0x5ec1d6,_0x3976bb){_0x3976bb=_0x3976bb||0xcc;return function(_0x17615d){if(_0x17615d){return _0x5ec1d6[_0xc777('0x1a')](_0x3976bb);}return _0x5ec1d6[_0xc777('0x1b')](_0x3976bb)['end']();};}function respondWithResult(_0x527bd8,_0x3fbee6){_0x3fbee6=_0x3fbee6||0xc8;return function(_0x52cd9a){if(_0x52cd9a){return _0x527bd8['status'](_0x3fbee6)[_0xc777('0x1c')](_0x52cd9a);}};}function respondWithFilteredResult(_0x5839ab,_0x3a05c7){return function(_0xedd016){if(_0xedd016){var _0xd7959d=typeof _0x3a05c7[_0xc777('0x1d')]===_0xc777('0x1e')&&typeof _0x3a05c7['limit']===_0xc777('0x1e');var _0x3bd708=_0xedd016['count'];var _0x29149c=_0xd7959d?0x0:_0x3a05c7[_0xc777('0x1d')];var _0x22c021=_0xd7959d?_0xedd016[_0xc777('0x1f')]:_0x3a05c7[_0xc777('0x1d')]+_0x3a05c7['limit'];var _0x550db2;if(_0x22c021>=_0x3bd708){_0x22c021=_0x3bd708;_0x550db2=0xc8;}else{_0x550db2=0xce;}_0x5839ab[_0xc777('0x1b')](_0x550db2);return _0x5839ab[_0xc777('0x20')](_0xc777('0x21'),_0x29149c+'-'+_0x22c021+'/'+_0x3bd708)[_0xc777('0x1c')](_0xedd016);}return null;};}function patchUpdates(_0x51d823){return function(_0x46fd01){try{jsonpatch[_0xc777('0x22')](_0x46fd01,_0x51d823,!![]);}catch(_0x22929f){return BPromise['reject'](_0x22929f);}return _0x46fd01[_0xc777('0x23')]();};}function saveUpdates(_0x4bb212,_0x2b2b25){return function(_0x4e771a){if(_0x4e771a){return _0x4e771a[_0xc777('0x24')](_0x4bb212)[_0xc777('0x25')](function(_0x2b7f1e){return _0x2b7f1e;});}return null;};}function removeEntity(_0x220118,_0x457123){return function(_0x2e3e67){if(_0x2e3e67){return _0x2e3e67[_0xc777('0x26')]()['then'](function(){_0x220118[_0xc777('0x1b')](0xcc)[_0xc777('0x27')]();});}};}function handleEntityNotFound(_0x246a9a,_0x244909){return function(_0xfc59ff){if(!_0xfc59ff){_0x246a9a[_0xc777('0x1a')](0x194);}return _0xfc59ff;};}function handleError(_0x21dd50,_0x53e4f4){_0x53e4f4=_0x53e4f4||0x1f4;return function(_0x1c0d82){logger[_0xc777('0x28')](_0x1c0d82[_0xc777('0x29')]);if(_0x1c0d82[_0xc777('0x2a')]){delete _0x1c0d82[_0xc777('0x2a')];}_0x21dd50[_0xc777('0x1b')](_0x53e4f4)['send'](_0x1c0d82);};}exports[_0xc777('0x2b')]=function(_0x4effda,_0x37be7e){var _0x164ccf={},_0x388f17={},_0x1e2934={'count':0x0,'rows':[]};var _0x3ebd71=_['map'](db['CmCustomField'][_0xc777('0x2c')],function(_0x5888bc){return{'name':_0x5888bc[_0xc777('0x2d')],'type':_0x5888bc[_0xc777('0x2e')][_0xc777('0x2f')]};});_0x388f17[_0xc777('0x30')]=_[_0xc777('0x31')](_[_0xc777('0x32')](_0x3ebd71,'name'),['name']);_0x388f17['query']=_[_0xc777('0x33')](_0x4effda[_0xc777('0x34')]);_0x388f17[_0xc777('0x35')]=_['intersection'](_0x388f17[_0xc777('0x30')],_0x388f17[_0xc777('0x34')]);_0x164ccf[_0xc777('0x36')]=_[_0xc777('0x37')](_0x388f17[_0xc777('0x30')],qs[_0xc777('0x38')](_0x4effda[_0xc777('0x34')][_0xc777('0x38')]));_0x164ccf['attributes']=_0x164ccf[_0xc777('0x36')]['length']?_0x164ccf[_0xc777('0x36')]:_0x388f17[_0xc777('0x30')];if(!_0x4effda[_0xc777('0x34')][_0xc777('0x39')](_0xc777('0x3a'))){_0x164ccf[_0xc777('0x3b')]=qs[_0xc777('0x3b')](_0x4effda[_0xc777('0x34')][_0xc777('0x3b')]);_0x164ccf[_0xc777('0x1d')]=qs[_0xc777('0x1d')](_0x4effda['query']['offset']);}_0x164ccf['order']=qs[_0xc777('0x3c')](_0x4effda[_0xc777('0x34')]['sort']);_0x164ccf['where']=qs[_0xc777('0x35')](_[_0xc777('0x3d')](_0x4effda[_0xc777('0x34')],_0x388f17[_0xc777('0x35')]),_0x3ebd71);if(_0x4effda[_0xc777('0x34')][_0xc777('0x3e')]){_0x164ccf[_0xc777('0x3f')]=_[_0xc777('0x40')](_0x164ccf[_0xc777('0x3f')],{'$or':_[_0xc777('0x32')](_0x3ebd71,function(_0x2971b0){if(_0x2971b0[_0xc777('0x2e')]!=='VIRTUAL'){var _0x1a968a={};_0x1a968a[_0x2971b0[_0xc777('0x2a')]]={'$like':'%'+_0x4effda['query']['filter']+'%'};return _0x1a968a;}})});}_0x164ccf=_[_0xc777('0x40')]({},_0x164ccf,_0x4effda['options']);var _0x100945={'where':_0x164ccf[_0xc777('0x3f')]};return db[_0xc777('0x41')][_0xc777('0x1f')](_0x100945)[_0xc777('0x25')](function(_0x3a3046){_0x1e2934['count']=_0x3a3046;if(_0x4effda[_0xc777('0x34')][_0xc777('0x42')]){_0x164ccf[_0xc777('0x43')]=[{'all':!![]}];}return db[_0xc777('0x41')][_0xc777('0x44')](_0x164ccf);})['then'](function(_0x1efc54){_0x1e2934[_0xc777('0x45')]=_0x1efc54;return _0x1e2934;})[_0xc777('0x25')](respondWithFilteredResult(_0x37be7e,_0x164ccf))[_0xc777('0x46')](handleError(_0x37be7e,null));};exports[_0xc777('0x47')]=function(_0x48c496,_0x18f445){var _0x3cff63={'raw':!![],'where':{'id':_0x48c496['params']['id']}},_0x5df3e8={};_0x5df3e8[_0xc777('0x30')]=_[_0xc777('0x33')](db[_0xc777('0x41')][_0xc777('0x2c')]);_0x5df3e8[_0xc777('0x34')]=_[_0xc777('0x33')](_0x48c496[_0xc777('0x34')]);_0x5df3e8[_0xc777('0x35')]=_[_0xc777('0x37')](_0x5df3e8[_0xc777('0x30')],_0x5df3e8['query']);_0x3cff63[_0xc777('0x36')]=_['intersection'](_0x5df3e8[_0xc777('0x30')],qs[_0xc777('0x38')](_0x48c496[_0xc777('0x34')][_0xc777('0x38')]));_0x3cff63[_0xc777('0x36')]=_0x3cff63['attributes'][_0xc777('0x48')]?_0x3cff63[_0xc777('0x36')]:_0x5df3e8['model'];if(_0x48c496[_0xc777('0x34')][_0xc777('0x42')]){_0x3cff63[_0xc777('0x43')]=[{'all':!![]}];}_0x3cff63=_['merge']({},_0x3cff63,_0x48c496[_0xc777('0x49')]);return db['CmCustomField'][_0xc777('0x4a')](_0x3cff63)[_0xc777('0x25')](handleEntityNotFound(_0x18f445,null))['then'](respondWithResult(_0x18f445,null))[_0xc777('0x46')](handleError(_0x18f445,null));};exports[_0xc777('0x24')]=function(_0x32f349,_0x304007){if(_0x32f349[_0xc777('0x4b')]['id']){delete _0x32f349['body']['id'];}return db[_0xc777('0x41')][_0xc777('0x4a')]({'where':{'id':_0x32f349['params']['id']}})[_0xc777('0x25')](handleEntityNotFound(_0x304007,null))[_0xc777('0x25')](saveUpdates(_0x32f349[_0xc777('0x4b')],null))['then'](respondWithResult(_0x304007,null))[_0xc777('0x46')](handleError(_0x304007,null));};exports[_0xc777('0x26')]=function(_0xbbd1c3,_0x16d6c1){return db['CmCustomField'][_0xc777('0x4a')]({'where':{'id':_0xbbd1c3['params']['id']}})['then'](handleEntityNotFound(_0x16d6c1,null))['then'](removeEntity(_0x16d6c1,null))['catch'](handleError(_0x16d6c1,null));};exports[_0xc777('0x4c')]=function(_0x443388,_0x309b56){var _0x38e640;return db[_0xc777('0x4d')][_0xc777('0x4e')](function(_0x2ee470){return db[_0xc777('0x41')]['create'](_0x443388[_0xc777('0x4b')],{'transaction':_0x2ee470})['then'](function(_0x26bca5){_0x38e640=_0x26bca5;var _0x576c11={'type':db[_0xc777('0x4f')][_0xc777('0x50')],'transaction':_0x2ee470};switch(_0x443388[_0xc777('0x4b')][_0xc777('0x2e')]){case'text':_0x576c11[_0xc777('0x2e')]=db[_0xc777('0x4f')][_0xc777('0x50')];break;case'number':_0x576c11['type']=db['Sequelize']['INTEGER'];break;case _0xc777('0x51'):_0x576c11[_0xc777('0x2e')]=db[_0xc777('0x4f')]['BOOLEAN'];_0x576c11['defaultValue']=![];break;default:}return db[_0xc777('0x4d')]['queryInterface'][_0xc777('0x52')](_0xc777('0x53'),util[_0xc777('0x54')](_0xc777('0x55'),_0x38e640['id']),_0x576c11);})[_0xc777('0x25')](function(){return _0x38e640;});})['then'](respondWithResult(_0x309b56,0xc9))['catch'](handleError(_0x309b56,null));}; \ No newline at end of file +var _0x5bf7=['text','Sequelize','number','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%d','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','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','CmCustomField','include','findAll','rows','catch','show','params','keys','length','includeAll','options','body','find','create','sequelize','TEXT'];(function(_0x1dd82f,_0x52acb7){var _0x353ca4=function(_0x5ee4c9){while(--_0x5ee4c9){_0x1dd82f['push'](_0x1dd82f['shift']());}};_0x353ca4(++_0x52acb7);}(_0x5bf7,0xb4));var _0x75bf=function(_0x56719a,_0x460df3){_0x56719a=_0x56719a-0x0;var _0x44e892=_0x5bf7[_0x56719a];return _0x44e892;};'use strict';var emlformat=require(_0x75bf('0x0'));var rimraf=require(_0x75bf('0x1'));var zipdir=require(_0x75bf('0x2'));var jsonpatch=require(_0x75bf('0x3'));var rp=require('request-promise');var moment=require(_0x75bf('0x4'));var BPromise=require(_0x75bf('0x5'));var Mustache=require(_0x75bf('0x6'));var util=require(_0x75bf('0x7'));var path=require(_0x75bf('0x8'));var sox=require(_0x75bf('0x9'));var csv=require(_0x75bf('0xa'));var ejs=require(_0x75bf('0xb'));var fs=require('fs');var fs_extra=require(_0x75bf('0xc'));var _=require(_0x75bf('0xd'));var squel=require(_0x75bf('0xe'));var crypto=require(_0x75bf('0xf'));var jsforce=require(_0x75bf('0x10'));var deskjs=require(_0x75bf('0x11'));var toCsv=require(_0x75bf('0xa'));var querystring=require(_0x75bf('0x12'));var Papa=require('papaparse');var Redis=require(_0x75bf('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x75bf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75bf('0x15'));var logger=require(_0x75bf('0x16'))(_0x75bf('0x17'));var utils=require(_0x75bf('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x75bf('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x185e00,_0x3d33a9){_0x3d33a9=_0x3d33a9||0xcc;return function(_0x228128){if(_0x228128){return _0x185e00['sendStatus'](_0x3d33a9);}return _0x185e00[_0x75bf('0x1a')](_0x3d33a9)[_0x75bf('0x1b')]();};}function respondWithResult(_0x231641,_0x590668){_0x590668=_0x590668||0xc8;return function(_0x4adffe){if(_0x4adffe){return _0x231641[_0x75bf('0x1a')](_0x590668)[_0x75bf('0x1c')](_0x4adffe);}};}function respondWithFilteredResult(_0x147b98,_0x494c47){return function(_0x3313ad){if(_0x3313ad){var _0xddf84b=typeof _0x494c47['offset']===_0x75bf('0x1d')&&typeof _0x494c47['limit']===_0x75bf('0x1d');var _0x5c3c70=_0x3313ad[_0x75bf('0x1e')];var _0x4d9c46=_0xddf84b?0x0:_0x494c47[_0x75bf('0x1f')];var _0x306c51=_0xddf84b?_0x3313ad[_0x75bf('0x1e')]:_0x494c47['offset']+_0x494c47[_0x75bf('0x20')];var _0x17875d;if(_0x306c51>=_0x5c3c70){_0x306c51=_0x5c3c70;_0x17875d=0xc8;}else{_0x17875d=0xce;}_0x147b98[_0x75bf('0x1a')](_0x17875d);return _0x147b98[_0x75bf('0x21')](_0x75bf('0x22'),_0x4d9c46+'-'+_0x306c51+'/'+_0x5c3c70)['json'](_0x3313ad);}return null;};}function patchUpdates(_0x4ede56){return function(_0x1d7c22){try{jsonpatch[_0x75bf('0x23')](_0x1d7c22,_0x4ede56,!![]);}catch(_0x2bb280){return BPromise[_0x75bf('0x24')](_0x2bb280);}return _0x1d7c22[_0x75bf('0x25')]();};}function saveUpdates(_0x335110,_0x1fe6d4){return function(_0xefd52){if(_0xefd52){return _0xefd52[_0x75bf('0x26')](_0x335110)[_0x75bf('0x27')](function(_0x3bf909){return _0x3bf909;});}return null;};}function removeEntity(_0x2337b4,_0x1c0949){return function(_0x605790){if(_0x605790){return _0x605790[_0x75bf('0x28')]()[_0x75bf('0x27')](function(){_0x2337b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bd45c,_0x247ec7){return function(_0x1e419e){if(!_0x1e419e){_0x3bd45c['sendStatus'](0x194);}return _0x1e419e;};}function handleError(_0x437c65,_0x1b8bd3){_0x1b8bd3=_0x1b8bd3||0x1f4;return function(_0x3a1e78){logger[_0x75bf('0x29')](_0x3a1e78['stack']);if(_0x3a1e78[_0x75bf('0x2a')]){delete _0x3a1e78[_0x75bf('0x2a')];}_0x437c65['status'](_0x1b8bd3)['send'](_0x3a1e78);};}exports['index']=function(_0x514fe3,_0x2c90fc){var _0xe68661={},_0x1e31ab={},_0x427493={'count':0x0,'rows':[]};var _0xe969bf=_[_0x75bf('0x2b')](db['CmCustomField'][_0x75bf('0x2c')],function(_0x2d4f99){return{'name':_0x2d4f99[_0x75bf('0x2d')],'type':_0x2d4f99[_0x75bf('0x2e')][_0x75bf('0x2f')]};});_0x1e31ab[_0x75bf('0x30')]=_[_0x75bf('0x31')](_['map'](_0xe969bf,_0x75bf('0x2a')),['name']);_0x1e31ab[_0x75bf('0x32')]=_['keys'](_0x514fe3[_0x75bf('0x32')]);_0x1e31ab[_0x75bf('0x33')]=_[_0x75bf('0x34')](_0x1e31ab[_0x75bf('0x30')],_0x1e31ab[_0x75bf('0x32')]);_0xe68661[_0x75bf('0x35')]=_[_0x75bf('0x34')](_0x1e31ab[_0x75bf('0x30')],qs[_0x75bf('0x36')](_0x514fe3[_0x75bf('0x32')]['fields']));_0xe68661[_0x75bf('0x35')]=_0xe68661[_0x75bf('0x35')]['length']?_0xe68661['attributes']:_0x1e31ab[_0x75bf('0x30')];if(!_0x514fe3['query']['hasOwnProperty'](_0x75bf('0x37'))){_0xe68661['limit']=qs[_0x75bf('0x20')](_0x514fe3[_0x75bf('0x32')][_0x75bf('0x20')]);_0xe68661['offset']=qs[_0x75bf('0x1f')](_0x514fe3[_0x75bf('0x32')][_0x75bf('0x1f')]);}_0xe68661['order']=qs[_0x75bf('0x38')](_0x514fe3['query'][_0x75bf('0x38')]);_0xe68661[_0x75bf('0x39')]=qs[_0x75bf('0x33')](_[_0x75bf('0x3a')](_0x514fe3[_0x75bf('0x32')],_0x1e31ab[_0x75bf('0x33')]),_0xe969bf);if(_0x514fe3['query'][_0x75bf('0x3b')]){_0xe68661['where']=_[_0x75bf('0x3c')](_0xe68661[_0x75bf('0x39')],{'$or':_['map'](_0xe969bf,function(_0x8c55aa){if(_0x8c55aa[_0x75bf('0x2e')]!==_0x75bf('0x3d')){var _0x30914b={};_0x30914b[_0x8c55aa[_0x75bf('0x2a')]]={'$like':'%'+_0x514fe3[_0x75bf('0x32')][_0x75bf('0x3b')]+'%'};return _0x30914b;}})});}_0xe68661=_['merge']({},_0xe68661,_0x514fe3['options']);var _0x469b97={'where':_0xe68661[_0x75bf('0x39')]};return db[_0x75bf('0x3e')]['count'](_0x469b97)[_0x75bf('0x27')](function(_0x2c3faa){_0x427493[_0x75bf('0x1e')]=_0x2c3faa;if(_0x514fe3[_0x75bf('0x32')]['includeAll']){_0xe68661[_0x75bf('0x3f')]=[{'all':!![]}];}return db[_0x75bf('0x3e')][_0x75bf('0x40')](_0xe68661);})[_0x75bf('0x27')](function(_0x505a9b){_0x427493[_0x75bf('0x41')]=_0x505a9b;return _0x427493;})[_0x75bf('0x27')](respondWithFilteredResult(_0x2c90fc,_0xe68661))[_0x75bf('0x42')](handleError(_0x2c90fc,null));};exports[_0x75bf('0x43')]=function(_0x37db2f,_0x24fa1b){var _0x585a38={'raw':!![],'where':{'id':_0x37db2f[_0x75bf('0x44')]['id']}},_0x552ba2={};_0x552ba2['model']=_[_0x75bf('0x45')](db[_0x75bf('0x3e')]['rawAttributes']);_0x552ba2[_0x75bf('0x32')]=_[_0x75bf('0x45')](_0x37db2f[_0x75bf('0x32')]);_0x552ba2['filters']=_[_0x75bf('0x34')](_0x552ba2['model'],_0x552ba2[_0x75bf('0x32')]);_0x585a38[_0x75bf('0x35')]=_[_0x75bf('0x34')](_0x552ba2[_0x75bf('0x30')],qs[_0x75bf('0x36')](_0x37db2f[_0x75bf('0x32')][_0x75bf('0x36')]));_0x585a38['attributes']=_0x585a38[_0x75bf('0x35')][_0x75bf('0x46')]?_0x585a38[_0x75bf('0x35')]:_0x552ba2[_0x75bf('0x30')];if(_0x37db2f[_0x75bf('0x32')][_0x75bf('0x47')]){_0x585a38['include']=[{'all':!![]}];}_0x585a38=_[_0x75bf('0x3c')]({},_0x585a38,_0x37db2f[_0x75bf('0x48')]);return db[_0x75bf('0x3e')]['find'](_0x585a38)[_0x75bf('0x27')](handleEntityNotFound(_0x24fa1b,null))['then'](respondWithResult(_0x24fa1b,null))['catch'](handleError(_0x24fa1b,null));};exports[_0x75bf('0x26')]=function(_0xa66bd7,_0x1f30e8){if(_0xa66bd7[_0x75bf('0x49')]['id']){delete _0xa66bd7['body']['id'];}return db[_0x75bf('0x3e')][_0x75bf('0x4a')]({'where':{'id':_0xa66bd7[_0x75bf('0x44')]['id']}})[_0x75bf('0x27')](handleEntityNotFound(_0x1f30e8,null))[_0x75bf('0x27')](saveUpdates(_0xa66bd7[_0x75bf('0x49')],null))[_0x75bf('0x27')](respondWithResult(_0x1f30e8,null))[_0x75bf('0x42')](handleError(_0x1f30e8,null));};exports[_0x75bf('0x28')]=function(_0x5c243e,_0xe54eeb){return db[_0x75bf('0x3e')][_0x75bf('0x4a')]({'where':{'id':_0x5c243e[_0x75bf('0x44')]['id']}})[_0x75bf('0x27')](handleEntityNotFound(_0xe54eeb,null))['then'](removeEntity(_0xe54eeb,null))[_0x75bf('0x42')](handleError(_0xe54eeb,null));};exports[_0x75bf('0x4b')]=function(_0x5a4ab9,_0x354bc4){var _0x5ce1ff;return db[_0x75bf('0x4c')]['transaction'](function(_0x21d70f){return db[_0x75bf('0x3e')][_0x75bf('0x4b')](_0x5a4ab9['body'],{'transaction':_0x21d70f})[_0x75bf('0x27')](function(_0xddd8f8){_0x5ce1ff=_0xddd8f8;var _0x4aad13={'type':db['Sequelize'][_0x75bf('0x4d')],'transaction':_0x21d70f};switch(_0x5a4ab9[_0x75bf('0x49')]['type']){case _0x75bf('0x4e'):_0x4aad13['type']=db[_0x75bf('0x4f')]['TEXT'];break;case _0x75bf('0x50'):_0x4aad13[_0x75bf('0x2e')]=db[_0x75bf('0x4f')]['INTEGER'];break;case'switch':_0x4aad13['type']=db[_0x75bf('0x4f')][_0x75bf('0x51')];_0x4aad13[_0x75bf('0x52')]=![];break;default:}return db[_0x75bf('0x4c')]['queryInterface'][_0x75bf('0x53')](_0x75bf('0x54'),util['format'](_0x75bf('0x55'),_0x5ce1ff['id']),_0x4aad13);})[_0x75bf('0x27')](function(){return _0x5ce1ff;});})[_0x75bf('0x27')](respondWithResult(_0x354bc4,0xc9))[_0x75bf('0x42')](handleError(_0x354bc4,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index b873a15..8369dcd 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 _0xc382=['exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x23f564,_0x48d2ba){var _0x47582b=function(_0x3a8876){while(--_0x3a8876){_0x23f564['push'](_0x23f564['shift']());}};_0x47582b(++_0x48d2ba);}(_0xc382,0x16e));var _0x2c38=function(_0x35027c,_0x4af623){_0x35027c=_0x35027c-0x0;var _0x4bba7d=_0xc382[_0x35027c];return _0x4bba7d;};'use strict';var _=require(_0x2c38('0x0'));var util=require(_0x2c38('0x1'));var logger=require(_0x2c38('0x2'))(_0x2c38('0x3'));var moment=require(_0x2c38('0x4'));var BPromise=require(_0x2c38('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c38('0x6'));var rimraf=require('rimraf');var config=require(_0x2c38('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x2c38('0x8')]=function(_0x19cc18,_0x234ae4){return _0x19cc18['define'](_0x2c38('0x9'),attributes,{'tableName':_0x2c38('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd275=['rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd275,0x10e));var _0x5d27=function(_0xb45ffc,_0x2e7440){_0xb45ffc=_0xb45ffc-0x0;var _0x1fbe30=_0xd275[_0xb45ffc];return _0x1fbe30;};'use strict';var _=require(_0x5d27('0x0'));var util=require('util');var logger=require(_0x5d27('0x1'))(_0x5d27('0x2'));var moment=require(_0x5d27('0x3'));var BPromise=require(_0x5d27('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5d27('0x5'));var config=require(_0x5d27('0x6'));var attributes=require('./cmCustomField.attributes');module[_0x5d27('0x7')]=function(_0x44f7f8,_0x48e7de){return _0x44f7f8[_0x5d27('0x8')](_0x5d27('0x9'),attributes,{'tableName':_0x5d27('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 90c0e9f..3384883 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 _0xbfa9=['error','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x217449,_0x1caf28){var _0x2b9e20=function(_0x502da4){while(--_0x502da4){_0x217449['push'](_0x217449['shift']());}};_0x2b9e20(++_0x1caf28);}(_0xbfa9,0x1e7));var _0x9bfa=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0xbfa9[_0xb68772];return _0x4189bb;};'use strict';var _=require(_0x9bfa('0x0'));var util=require(_0x9bfa('0x1'));var moment=require(_0x9bfa('0x2'));var BPromise=require(_0x9bfa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9bfa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9bfa('0x5'));var logger=require(_0x9bfa('0x6'))(_0x9bfa('0x7'));var config=require(_0x9bfa('0x8'));var jayson=require(_0x9bfa('0x9'));var client=jayson['client'][_0x9bfa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11a960,_0xd3e1a5,_0x4d82a8){return new BPromise(function(_0x48a0f9,_0x1fb937){return client[_0x9bfa('0xb')](_0x11a960,_0x4d82a8)[_0x9bfa('0xc')](function(_0x4f2dbe){logger[_0x9bfa('0xd')](_0x9bfa('0xe'),_0xd3e1a5,_0x9bfa('0xf'));logger[_0x9bfa('0x10')](_0x9bfa('0x11'),_0xd3e1a5,_0x9bfa('0xf'),JSON[_0x9bfa('0x12')](_0x4f2dbe));if(_0x4f2dbe['error']){if(_0x4f2dbe[_0x9bfa('0x13')]['code']===0x1f4){logger[_0x9bfa('0x13')](_0x9bfa('0xe'),_0xd3e1a5,_0x4f2dbe[_0x9bfa('0x13')][_0x9bfa('0x14')]);return _0x1fb937(_0x4f2dbe[_0x9bfa('0x13')][_0x9bfa('0x14')]);}logger[_0x9bfa('0x13')](_0x9bfa('0xe'),_0xd3e1a5,_0x4f2dbe[_0x9bfa('0x13')][_0x9bfa('0x14')]);return _0x48a0f9(_0x4f2dbe[_0x9bfa('0x13')][_0x9bfa('0x14')]);}else{logger[_0x9bfa('0xd')]('CmCustomField,\x20%s,\x20%s',_0xd3e1a5,'request\x20sent');_0x48a0f9(_0x4f2dbe[_0x9bfa('0x15')]['message']);}})['catch'](function(_0x3cbbda){logger[_0x9bfa('0x13')](_0x9bfa('0xe'),_0xd3e1a5,_0x3cbbda);_0x1fb937(_0x3cbbda);});});} \ No newline at end of file +var _0x99f3=['../../config/environment','client','http','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x436a4a,_0x5622d3){var _0x39e3ec=function(_0x40b558){while(--_0x40b558){_0x436a4a['push'](_0x436a4a['shift']());}};_0x39e3ec(++_0x5622d3);}(_0x99f3,0x1dc));var _0x399f=function(_0x37dcf8,_0x50437b){_0x37dcf8=_0x37dcf8-0x0;var _0x1d121c=_0x99f3[_0x37dcf8];return _0x1d121c;};'use strict';var _=require('lodash');var util=require(_0x399f('0x0'));var moment=require(_0x399f('0x1'));var BPromise=require('bluebird');var rs=require(_0x399f('0x2'));var fs=require('fs');var Redis=require(_0x399f('0x3'));var db=require(_0x399f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x399f('0x5'))(_0x399f('0x6'));var config=require(_0x399f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x399f('0x8')][_0x399f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55ec4b,_0x472a55,_0x2a2927){return new BPromise(function(_0x4e2e7e,_0x2bf589){return client['request'](_0x55ec4b,_0x2a2927)['then'](function(_0x123610){logger[_0x399f('0xa')]('CmCustomField,\x20%s,\x20%s',_0x472a55,'request\x20sent');logger[_0x399f('0xb')](_0x399f('0xc'),_0x472a55,_0x399f('0xd'),JSON[_0x399f('0xe')](_0x123610));if(_0x123610['error']){if(_0x123610[_0x399f('0xf')][_0x399f('0x10')]===0x1f4){logger[_0x399f('0xf')](_0x399f('0x11'),_0x472a55,_0x123610[_0x399f('0xf')]['message']);return _0x2bf589(_0x123610[_0x399f('0xf')][_0x399f('0x12')]);}logger[_0x399f('0xf')]('CmCustomField,\x20%s,\x20%s',_0x472a55,_0x123610[_0x399f('0xf')][_0x399f('0x12')]);return _0x4e2e7e(_0x123610[_0x399f('0xf')][_0x399f('0x12')]);}else{logger['info'](_0x399f('0x11'),_0x472a55,_0x399f('0xd'));_0x4e2e7e(_0x123610[_0x399f('0x13')][_0x399f('0x12')]);}})[_0x399f('0x14')](function(_0x199420){logger['error'](_0x399f('0x11'),_0x472a55,_0x199420);_0x2bf589(_0x199420);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 1b4e927..da5b1d2 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 _0xc5b4=['isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xc5b4,0x1cb));var _0x4c5b=function(_0x251925,_0x5d8569){_0x251925=_0x251925-0x0;var _0x5c6336=_0xc5b4[_0x251925];return _0x5c6336;};'use strict';var multer=require(_0x4c5b('0x0'));var util=require(_0x4c5b('0x1'));var path=require(_0x4c5b('0x2'));var timeout=require(_0x4c5b('0x3'));var express=require('express');var router=express[_0x4c5b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4c5b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4c5b('0x6'));var controller=require(_0x4c5b('0x7'));router[_0x4c5b('0x8')]('/',auth[_0x4c5b('0x9')](),controller['index']);router['get'](_0x4c5b('0xa'),auth[_0x4c5b('0x9')](),controller[_0x4c5b('0xb')]);router[_0x4c5b('0xc')]('/',auth[_0x4c5b('0x9')](),controller[_0x4c5b('0xd')]);router[_0x4c5b('0xe')]('/:id',auth[_0x4c5b('0x9')](),controller[_0x4c5b('0xf')]);router[_0x4c5b('0x10')](_0x4c5b('0xa'),auth[_0x4c5b('0x9')](),controller['destroy']);module[_0x4c5b('0x11')]=router; \ No newline at end of file +var _0xd5b2=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports'];(function(_0x1f8cf7,_0xc62474){var _0x5ac9d4=function(_0x5a6cf0){while(--_0x5a6cf0){_0x1f8cf7['push'](_0x1f8cf7['shift']());}};_0x5ac9d4(++_0xc62474);}(_0xd5b2,0x10e));var _0x2d5b=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xd5b2[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require('multer');var util=require(_0x2d5b('0x0'));var path=require(_0x2d5b('0x1'));var timeout=require('connect-timeout');var express=require(_0x2d5b('0x2'));var router=express[_0x2d5b('0x3')]();var fs_extra=require(_0x2d5b('0x4'));var auth=require(_0x2d5b('0x5'));var interaction=require(_0x2d5b('0x6'));var config=require(_0x2d5b('0x7'));var controller=require('./cmCustomField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2d5b('0x8')]);router['get'](_0x2d5b('0x9'),auth['isAuthenticated'](),controller[_0x2d5b('0xa')]);router['post']('/',auth[_0x2d5b('0xb')](),controller[_0x2d5b('0xc')]);router[_0x2d5b('0xd')](_0x2d5b('0x9'),auth[_0x2d5b('0xb')](),controller[_0x2d5b('0xe')]);router[_0x2d5b('0xf')](_0x2d5b('0x9'),auth[_0x2d5b('0xb')](),controller[_0x2d5b('0x10')]);module[_0x2d5b('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index deb79d9..11b50b8 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 _0xa3ef=['sequelize','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','contactListQueue','moment'];(function(_0x2653cb,_0xd4c905){var _0x1fd51d=function(_0x29da2f){while(--_0x29da2f){_0x2653cb['push'](_0x2653cb['shift']());}};_0x1fd51d(++_0xd4c905);}(_0xa3ef,0xa9));var _0xfa3e=function(_0x5816f8,_0xe5d330){_0x5816f8=_0x5816f8-0x0;var _0xdb404a=_0xa3ef[_0x5816f8];return _0xdb404a;};'use strict';var moment=require(_0xfa3e('0x0'));var Sequelize=require(_0xfa3e('0x1'));module[_0xfa3e('0x2')]={'phone':{'type':Sequelize[_0xfa3e('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xfa3e('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xfa3e('0x5')](_0xfa3e('0x6'))},'countbusyretry':{'type':Sequelize[_0xfa3e('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfa3e('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfa3e('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xfa3e('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfa3e('0x8')]},'priority':{'type':Sequelize[_0xfa3e('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xfa3e('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xfa3e('0x7')],'unique':_0xfa3e('0x9')},'ListId':{'type':Sequelize[_0xfa3e('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xfa3e('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xfa3e('0x7')],'unique':_0xfa3e('0x9')},'CampaignId':{'type':Sequelize[_0xfa3e('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfa3e('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfa3e('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfa3e('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfa3e('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xfa3e('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xfa3e('0x8')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xe413=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE','format'];(function(_0x53ae51,_0x2a0cc4){var _0x593ed8=function(_0x18aa50){while(--_0x18aa50){_0x53ae51['push'](_0x53ae51['shift']());}};_0x593ed8(++_0x2a0cc4);}(_0xe413,0xa5));var _0x3e41=function(_0xa4495a,_0x521f12){_0xa4495a=_0xa4495a-0x0;var _0x362289=_0xe413[_0xa4495a];return _0x362289;};'use strict';var moment=require('moment');var Sequelize=require(_0x3e41('0x0'));module[_0x3e41('0x1')]={'phone':{'type':Sequelize[_0x3e41('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x3e41('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x3e41('0x4')],'defaultValue':moment()[_0x3e41('0x5')](_0x3e41('0x6'))},'countbusyretry':{'type':Sequelize[_0x3e41('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3e41('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3e41('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3e41('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3e41('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3e41('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x3e41('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x3e41('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x3e41('0x7')],'unique':_0x3e41('0x8')},'UserId':{'type':Sequelize[_0x3e41('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x3e41('0x7')],'unique':_0x3e41('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x3e41('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3e41('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3e41('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3e41('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3e41('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x3e41('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index cccab07..7affd07 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 _0xec39=['utcOffset','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','update','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','attributes','fields','length','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','rows','catch','show','params','keys','CmHopper','include','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','campaign','user','deleted','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','direction','prev','isEmpty','hopperIds','priority','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','ASC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','transaction','getOpenContacts','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xec39,0x19f));var _0x9ec3=function(_0x29477e,_0xfde466){_0x29477e=_0x29477e-0x0;var _0x5e149a=_0xec39[_0x29477e];return _0x5e149a;};'use strict';var moment=require(_0x9ec3('0x0'));var _=require(_0x9ec3('0x1'));var qs=require(_0x9ec3('0x2'));var logger=require(_0x9ec3('0x3'))(_0x9ec3('0x4'));var shared=require(_0x9ec3('0x5'));var db=require(_0x9ec3('0x6'))['db'];function respondWithResult(_0x5c0885,_0x1f43fb){_0x1f43fb=_0x1f43fb||0xc8;return function(_0x1c944d){if(_0x1c944d){return _0x5c0885[_0x9ec3('0x7')](_0x1f43fb)['json'](_0x1c944d);}};}function respondWithFilteredResult(_0x49ddff,_0x55adba){return function(_0x3742c5){if(_0x3742c5){var _0x11c4d1=typeof _0x55adba[_0x9ec3('0x8')]==='undefined'&&typeof _0x55adba[_0x9ec3('0x9')]===_0x9ec3('0xa');var _0x2e49f3=_0x3742c5[_0x9ec3('0xb')];var _0x11c3e9=_0x11c4d1?0x0:_0x55adba[_0x9ec3('0x8')];var _0x1c492e=_0x11c4d1?_0x3742c5['count']:_0x55adba[_0x9ec3('0x8')]+_0x55adba[_0x9ec3('0x9')];var _0x3c68b3;if(_0x1c492e>=_0x2e49f3){_0x1c492e=_0x2e49f3;_0x3c68b3=0xc8;}else{_0x3c68b3=0xce;}_0x49ddff[_0x9ec3('0x7')](_0x3c68b3);return _0x49ddff[_0x9ec3('0xc')](_0x9ec3('0xd'),_0x11c3e9+'-'+_0x1c492e+'/'+_0x2e49f3)[_0x9ec3('0xe')](_0x3742c5);}return null;};}function saveUpdates(_0x536796,_0x2790dc){return function(_0x555fc4){if(_0x555fc4){return _0x555fc4[_0x9ec3('0xf')](_0x536796)['then'](function(_0x2b9f69){return _0x2b9f69;});}return null;};}function handleEntityNotFound(_0x4d26ad,_0x471112){return function(_0x23ac30){if(!_0x23ac30){_0x4d26ad[_0x9ec3('0x10')](0x194);}return _0x23ac30;};}function handleError(_0x3cb266,_0x42b0fb){_0x42b0fb=_0x42b0fb||0x1f4;return function(_0x2c0ad5){logger[_0x9ec3('0x11')](_0x2c0ad5[_0x9ec3('0x12')]);if(_0x2c0ad5[_0x9ec3('0x13')]){delete _0x2c0ad5['name'];}_0x3cb266[_0x9ec3('0x7')](_0x42b0fb)['send'](_0x2c0ad5);};}exports['index']=function(_0x2ae9bd,_0x35ec3e){var _0xa1e4a5={},_0xa3bade={},_0x3af3db={'count':0x0,'rows':[]};var _0x57d057=_[_0x9ec3('0x14')](db['CmHopper'][_0x9ec3('0x15')],function(_0x58a7d8){return{'name':_0x58a7d8[_0x9ec3('0x16')],'type':_0x58a7d8[_0x9ec3('0x17')][_0x9ec3('0x18')]};});_0xa3bade['model']=_[_0x9ec3('0x14')](_0x57d057,'name');_0xa3bade[_0x9ec3('0x19')]=_['keys'](_0x2ae9bd[_0x9ec3('0x19')]);_0xa3bade[_0x9ec3('0x1a')]=_[_0x9ec3('0x1b')](_0xa3bade[_0x9ec3('0x1c')],_0xa3bade[_0x9ec3('0x19')]);_0xa3bade[_0x9ec3('0x1a')]=_[_0x9ec3('0x1d')](_0xa3bade['filters'],[_0x9ec3('0x1e'),_0x9ec3('0x1f'),_0x9ec3('0x20'),_0x9ec3('0x21'),_0x9ec3('0x22'),_0x9ec3('0x23'),_0x9ec3('0x24'),_0x9ec3('0x25'),_0x9ec3('0x26'),_0x9ec3('0x27'),_0x9ec3('0x28'),'$in',_0x9ec3('0x29'),_0x9ec3('0x2a'),_0x9ec3('0x2b'),_0x9ec3('0x2c'),'$notILike',_0x9ec3('0x2a'),_0x9ec3('0x2d'),_0x9ec3('0x2e'),_0x9ec3('0x2f'),_0x9ec3('0x30')]);_0xa1e4a5[_0x9ec3('0x31')]=_[_0x9ec3('0x1b')](_0xa3bade[_0x9ec3('0x1c')],qs[_0x9ec3('0x32')](_0x2ae9bd[_0x9ec3('0x19')][_0x9ec3('0x32')]));_0xa1e4a5[_0x9ec3('0x31')]=_0xa1e4a5[_0x9ec3('0x31')][_0x9ec3('0x33')]?_0xa1e4a5[_0x9ec3('0x31')]:_0xa3bade[_0x9ec3('0x1c')];if(!_0x2ae9bd[_0x9ec3('0x19')]['hasOwnProperty']('nolimit')){_0xa1e4a5['limit']=qs[_0x9ec3('0x9')](_0x2ae9bd[_0x9ec3('0x19')][_0x9ec3('0x9')]);_0xa1e4a5[_0x9ec3('0x8')]=qs[_0x9ec3('0x8')](_0x2ae9bd[_0x9ec3('0x19')][_0x9ec3('0x8')]);}_0xa1e4a5['order']=qs[_0x9ec3('0x34')](_0x2ae9bd[_0x9ec3('0x19')][_0x9ec3('0x34')]);_0xa1e4a5['where']=qs[_0x9ec3('0x1a')](_[_0x9ec3('0x35')](_0x2ae9bd['query'],_0xa3bade[_0x9ec3('0x1a')]),_0x57d057);if(_0x2ae9bd[_0x9ec3('0x19')][_0x9ec3('0x36')]){_0xa1e4a5[_0x9ec3('0x37')]=_[_0x9ec3('0x38')](_0xa1e4a5[_0x9ec3('0x37')],{'$or':_[_0x9ec3('0x14')](_0x57d057,function(_0x489fd2){if(_0x489fd2[_0x9ec3('0x17')]!==_0x9ec3('0x39')){var _0x515055={};_0x515055[_0x489fd2['name']]={'$like':'%'+_0x2ae9bd[_0x9ec3('0x19')]['filter']+'%'};return _0x515055;}})});}_0xa1e4a5=_[_0x9ec3('0x38')]({},_0xa1e4a5,_0x2ae9bd[_0x9ec3('0x3a')]);var _0x1b9704={'where':_0xa1e4a5[_0x9ec3('0x37')]};return db['CmHopper'][_0x9ec3('0xb')](_0x1b9704)[_0x9ec3('0x3b')](function(_0x37e92b){_0x3af3db[_0x9ec3('0xb')]=_0x37e92b;if(_0x2ae9bd[_0x9ec3('0x19')][_0x9ec3('0x3c')]){_0xa1e4a5['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0xa1e4a5);})[_0x9ec3('0x3b')](function(_0x88dcd4){_0x3af3db[_0x9ec3('0x3d')]=_0x88dcd4;return _0x3af3db;})[_0x9ec3('0x3b')](respondWithFilteredResult(_0x35ec3e,_0xa1e4a5))[_0x9ec3('0x3e')](handleError(_0x35ec3e,null));};exports[_0x9ec3('0x3f')]=function(_0x53b4d6,_0xe53beb){var _0x4241b1={'raw':!![],'where':{'id':_0x53b4d6[_0x9ec3('0x40')]['id']}},_0x58ed33={};_0x58ed33[_0x9ec3('0x1c')]=_[_0x9ec3('0x41')](db[_0x9ec3('0x42')]['rawAttributes']);_0x58ed33[_0x9ec3('0x19')]=_['keys'](_0x53b4d6[_0x9ec3('0x19')]);_0x58ed33[_0x9ec3('0x1a')]=_[_0x9ec3('0x1b')](_0x58ed33[_0x9ec3('0x1c')],_0x58ed33[_0x9ec3('0x19')]);_0x4241b1['attributes']=_['intersection'](_0x58ed33[_0x9ec3('0x1c')],qs['fields'](_0x53b4d6[_0x9ec3('0x19')]['fields']));_0x4241b1[_0x9ec3('0x31')]=_0x4241b1['attributes'][_0x9ec3('0x33')]?_0x4241b1[_0x9ec3('0x31')]:_0x58ed33['model'];if(_0x53b4d6[_0x9ec3('0x19')]['includeAll']){_0x4241b1[_0x9ec3('0x43')]=[{'all':!![]}];}_0x4241b1=_[_0x9ec3('0x38')]({},_0x4241b1,_0x53b4d6['options']);return db[_0x9ec3('0x42')][_0x9ec3('0x44')](_0x4241b1)[_0x9ec3('0x3b')](handleEntityNotFound(_0xe53beb,null))['then'](respondWithResult(_0xe53beb,null))[_0x9ec3('0x3e')](handleError(_0xe53beb,null));};exports[_0x9ec3('0x45')]=function(_0x551be3,_0x223e40){return db[_0x9ec3('0x42')][_0x9ec3('0x45')](_0x551be3[_0x9ec3('0x46')],{})[_0x9ec3('0x3b')](respondWithResult(_0x223e40,0xc9))[_0x9ec3('0x3e')](handleError(_0x223e40,null));};exports[_0x9ec3('0xf')]=function(_0x340d52,_0x550a0d){if(_0x340d52['body']['id']){delete _0x340d52[_0x9ec3('0x46')]['id'];}return db[_0x9ec3('0x42')]['find']({'where':{'id':_0x340d52[_0x9ec3('0x40')]['id']}})[_0x9ec3('0x3b')](handleEntityNotFound(_0x550a0d,null))['then'](saveUpdates(_0x340d52[_0x9ec3('0x46')],null))[_0x9ec3('0x3b')](respondWithResult(_0x550a0d,null))[_0x9ec3('0x3e')](handleError(_0x550a0d,null));};exports[_0x9ec3('0x47')]=function(_0x278f1a,_0x1b9346){return db[_0x9ec3('0x42')][_0x9ec3('0x47')]()[_0x9ec3('0x3b')](respondWithResult(_0x1b9346,null))[_0x9ec3('0x3e')](handleError(_0x1b9346,null));};exports[_0x9ec3('0x48')]=function(_0x1bcaec,_0x284088){var _0x5717a7;var _0x60ac46=_0x1bcaec['params']['id'];return db[_0x9ec3('0x42')][_0x9ec3('0x44')]({'where':{'id':_0x1bcaec[_0x9ec3('0x40')]['id']}})['then'](handleEntityNotFound(_0x284088,null))['then'](function(_0x53bb29){if(_0x53bb29){return _0x53bb29[_0x9ec3('0x48')]()[_0x9ec3('0x3b')](function(_0x3fd1c3){return _0x3fd1c3;});}})['then'](function(_0x4f2a2c){_0x5717a7=_0x4f2a2c;if(_0x4f2a2c){if(_0x4f2a2c['VoiceQueueId']||_0x4f2a2c[_0x9ec3('0x49')]){return db[_0x4f2a2c[_0x9ec3('0x4a')]?_0x9ec3('0x4b'):_0x9ec3('0x4c')][_0x9ec3('0x44')]({'where':{'id':_0x4f2a2c[_0x9ec3('0x4a')]?_0x4f2a2c['VoiceQueueId']:_0x4f2a2c[_0x9ec3('0x49')]},'attributes':['id',_0x9ec3('0x13')],'raw':!![]});}}})[_0x9ec3('0x3b')](function(_0xc4199b){var _0x2eaa2d={};if(_0xc4199b){_[_0x9ec3('0x38')](_0x2eaa2d,_[_0x9ec3('0x4d')](_0x5717a7[_0x9ec3('0x4e')],[_0x9ec3('0x4f'),_0x9ec3('0x50'),'id']));_0x2eaa2d[_0x9ec3('0x51')]=0x15;_0x2eaa2d['statedesc']='deleted';_0x2eaa2d[_0x9ec3('0x52')]=_0xc4199b[_0x9ec3('0x13')];_0x2eaa2d['membername']=_0x1bcaec[_0x9ec3('0x53')]['name'];_0x2eaa2d['UserId']=_0x1bcaec[_0x9ec3('0x53')]['id'];_0x2eaa2d[_0x9ec3('0x54')]=!![];_0x2eaa2d['deletedat']=moment()[_0x9ec3('0x55')](_0x9ec3('0x56'));_0x2eaa2d[_0x9ec3('0x57')]=_0x5717a7[_0x9ec3('0x58')];_0x2eaa2d[_0x9ec3('0x59')]=_0x5717a7['VoiceQueueId']?_0x9ec3('0x5a'):_0x9ec3('0x5b');return db['CmContact'][_0x9ec3('0x44')]({'where':{'id':_0x2eaa2d['ContactId']},'attributes':[_0x9ec3('0x5c'),_0x9ec3('0x5d')]})[_0x9ec3('0x3b')](function(_0x203a10){if(!_[_0x9ec3('0x5e')](_0x284088)&&!_[_0x9ec3('0x5e')](_0x203a10[_0x9ec3('0x5c')])){_0x2eaa2d['calleridname']=_0x203a10['firstName'];if(!_['isNil'](_0x203a10[_0x9ec3('0x5d')])){_0x2eaa2d[_0x9ec3('0x5f')]+='\x20'+_0x203a10[_0x9ec3('0x5d')];}}})[_0x9ec3('0x60')](function(){return db[_0x9ec3('0x61')][_0x9ec3('0x45')](_0x2eaa2d);});}})[_0x9ec3('0x3b')](function(_0x2921dc){return db[_0x9ec3('0x62')][_0x9ec3('0x48')]({'where':{'CmHopperId':_0x60ac46}});})[_0x9ec3('0x3b')](function(){return _0x284088[_0x9ec3('0x7')](0xcc)[_0x9ec3('0x63')]();})[_0x9ec3('0x3e')](handleError(_0x284088,null));};exports[_0x9ec3('0x64')]=function(_0x5ba3e3,_0x54fa71){var _0x4f96d3=[];return db[_0x9ec3('0x65')][_0x9ec3('0x47')]()[_0x9ec3('0x3b')](function(_0xf48efa){_0x4f96d3=_[_0x9ec3('0x41')](_0xf48efa);return _0x5ba3e3['user'][_0x9ec3('0x66')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x9ec3('0x67')},'attributes':['id',_0x9ec3('0x68'),_0x9ec3('0x69')],'raw':!![]});})[_0x9ec3('0x3b')](function(_0x568f61){if(_0x568f61&&_0x568f61['length']){return db[_0x9ec3('0x6a')]['transaction'](function(_0x30dc77){var _0x1aac06={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x9ec3('0x56'))},'VoiceQueueId':{'$in':_['map'](_0x568f61,'id')},'$or':[{'UserId':null},{'UserId':_0x5ba3e3[_0x9ec3('0x53')]['id']}]};var _0x158f92={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x568f61)[_0x9ec3('0x36')]([_0x9ec3('0x69'),0x0])[_0x9ec3('0x14')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x5ba3e3['user']['id']}]};var _0x3ad45c={'$or':[_0x1aac06,_0x158f92]};var _0x27e460=[];if(_0x5ba3e3[_0x9ec3('0x46')][_0x9ec3('0x6b')]&&_0x5ba3e3['body']['direction']===_0x9ec3('0x6c')){if(!_[_0x9ec3('0x6d')](_0x5ba3e3[_0x9ec3('0x46')][_0x9ec3('0x6e')])){_0x3ad45c['id']={'$in':_0x5ba3e3[_0x9ec3('0x46')][_0x9ec3('0x6e')]};}_0x27e460=[[_0x9ec3('0x6f'),'ASC'],[_0x9ec3('0x70'),_0x568f61[0x0][_0x9ec3('0x68')]==='ASC'?_0x9ec3('0x71'):'ASC'],db[_0x9ec3('0x6a')]['literal'](_0x9ec3('0x72')),['id',_0x9ec3('0x71')]];}else{if(!_[_0x9ec3('0x6d')](_0x5ba3e3['body']['hopperIds'])){_0x3ad45c['id']={'$notIn':_0x5ba3e3[_0x9ec3('0x46')][_0x9ec3('0x6e')]};}_0x27e460=[['priority',_0x9ec3('0x71')],[_0x9ec3('0x70'),_0x568f61[0x0][_0x9ec3('0x68')]],db[_0x9ec3('0x6a')][_0x9ec3('0x73')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x9ec3('0x74')]];}return db[_0x9ec3('0x42')][_0x9ec3('0x75')]({'attributes':['id',_0x9ec3('0x76'),_0x9ec3('0x58'),_0x9ec3('0x77')],'where':_0x3ad45c,'order':_0x27e460,'transaction':_0x30dc77,'lock':_0x30dc77[_0x9ec3('0x78')][_0x9ec3('0x79')],'include':[{'model':db[_0x9ec3('0x65')],'as':_0x9ec3('0x7a'),'attributes':_0x4f96d3,'include':[{'model':db[_0x9ec3('0x7b')],'as':_0x9ec3('0x7c'),'attributes':['id','name']}]},{'model':db[_0x9ec3('0x7d')],'as':_0x9ec3('0x7e'),'attributes':['id','name']},{'model':db[_0x9ec3('0x4b')],'as':_0x9ec3('0x7f'),'attributes':['id',_0x9ec3('0x13'),_0x9ec3('0x80')]}]})[_0x9ec3('0x3b')](function(_0x27dd15){if(_0x27dd15){return _0x27dd15[_0x9ec3('0xf')]({'UserId':_0x5ba3e3[_0x9ec3('0x53')]['id']},{'transaction':_0x30dc77});}});});}})[_0x9ec3('0x3b')](handleEntityNotFound(_0x54fa71,null))[_0x9ec3('0x3b')](respondWithResult(_0x54fa71,null))[_0x9ec3('0x3e')](handleError(_0x54fa71,null));};exports['getPreviewRecall']=function(_0x491719,_0x5ef50b,_0xe1b497){var _0x2edfe5=[];var _0x4881ff=_0x491719[_0x9ec3('0x40')]['id'];var _0x45f3a5=_0x491719[_0x9ec3('0x53')]['id'];return db[_0x9ec3('0x65')][_0x9ec3('0x47')]()[_0x9ec3('0x3b')](function(_0x15d6da){_0x2edfe5=_['keys'](_0x15d6da);return db[_0x9ec3('0x6a')][_0x9ec3('0x81')](function(_0x1ac7fd){const _0x4eb440={'id':_0x4881ff};return db[_0x9ec3('0x42')][_0x9ec3('0x75')]({'attributes':['id',_0x9ec3('0x76'),_0x9ec3('0x77')],'where':_0x4eb440,'transaction':_0x1ac7fd,'lock':_0x1ac7fd[_0x9ec3('0x78')][_0x9ec3('0x79')],'include':[{'model':db[_0x9ec3('0x65')],'as':_0x9ec3('0x7a'),'attributes':_0x2edfe5,'include':[{'model':db[_0x9ec3('0x7b')],'as':_0x9ec3('0x7c'),'attributes':['id',_0x9ec3('0x13')]}]},{'model':db[_0x9ec3('0x7d')],'as':_0x9ec3('0x7e'),'attributes':['id',_0x9ec3('0x13')]},{'model':db[_0x9ec3('0x4b')],'as':_0x9ec3('0x7f'),'attributes':['id','name',_0x9ec3('0x80')]}]})[_0x9ec3('0x3b')](function(_0x29c01f){if(_0x29c01f){return _0x29c01f[_0x9ec3('0xf')]({'UserId':_0x45f3a5},{'transaction':_0x1ac7fd});}});});})[_0x9ec3('0x3b')](handleEntityNotFound(_0x5ef50b,null))[_0x9ec3('0x3b')](respondWithResult(_0x5ef50b,null))[_0x9ec3('0x3e')](handleError(_0x5ef50b,null));};exports[_0x9ec3('0x82')]=function(_0xe15edf,_0x5774c1){return _0xe15edf['user'][_0x9ec3('0x66')]({'where':{'type':_0x9ec3('0x83'),'dialActive':!![],'dialMethod':_0x9ec3('0x67')},'attributes':['id'],'raw':!![]})[_0x9ec3('0x3b')](function(_0x274845){if(_0x274845&&_0x274845[_0x9ec3('0x33')]){return db[_0x9ec3('0x42')][_0x9ec3('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9ec3('0x55')](_0x9ec3('0x56'))},'VoiceQueueId':{'$in':_[_0x9ec3('0x14')](_0x274845,'id')},'$or':[{'UserId':null},{'UserId':_0xe15edf['user']['id']}]}});}return 0x0;})['then'](function(_0x26fdc1){if(!_['isNil'](_0x26fdc1)&&_[_0x9ec3('0x84')](_0x26fdc1)){return _0x5774c1['status'](0xc8)[_0x9ec3('0xe')]({'contacts':_0x26fdc1});}else{logger[_0x9ec3('0x11')](_0x9ec3('0x85'),'getOpenContacts',0x194,_0x9ec3('0x86'));_0x5774c1[_0x9ec3('0x10')](0x194);}})[_0x9ec3('0x3e')](handleError(_0x5774c1,null));};exports[_0x9ec3('0x87')]=function(_0x2b0346,_0x2f0b22){var _0x54258d=shared[_0x9ec3('0x88')];var _0x499cea=[];_[_0x9ec3('0x14')](_0x54258d,function(_0x204656){_0x499cea['push']({'id':_0x204656[_0x9ec3('0x13')],'name':_0x204656['name'],'utcOffset':_0x204656[_0x9ec3('0x89')]});});return _0x2f0b22[_0x9ec3('0x7')](0xc8)['json']({'tz':_0x499cea});};exports['getTimezone']=function(_0x1005c6,_0xc2ba5b){var _0x40cb7f=shared[_0x9ec3('0x88')];var _0x42bd4c={};if(!_[_0x9ec3('0x5e')](_0x40cb7f[_0x1005c6[_0x9ec3('0x46')]['id']]))_0x42bd4c=_0x40cb7f[_0x1005c6[_0x9ec3('0x46')]['id']];return _0xc2ba5b['status'](0xc8)[_0x9ec3('0xe')](_0x42bd4c);}; \ No newline at end of file +var _0x9f5a=['omit','dataValues','state','statedesc','campaign','membername','user','UserId','deleted','calleridnum','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','finally','CmHopperFinal','end','getPreview','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','phone','LOCK','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','findOne','scheduledat','UPDATE','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','update','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','model','query','keys','filters','intersection','concat','$and','$gt','$gte','$lt','$lte','$ne','$eq','$between','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','findAll','rows','catch','params','length','includeAll','include','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue'];(function(_0x5f1b05,_0x5b61d2){var _0x140a0d=function(_0x242f7a){while(--_0x242f7a){_0x5f1b05['push'](_0x5f1b05['shift']());}};_0x140a0d(++_0x5b61d2);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x45587c,_0x4610dc){_0x45587c=_0x45587c-0x0;var _0xc76f17=_0x9f5a[_0x45587c];return _0xc76f17;};'use strict';var moment=require(_0xa9f5('0x0'));var _=require(_0xa9f5('0x1'));var qs=require(_0xa9f5('0x2'));var logger=require(_0xa9f5('0x3'))('api');var shared=require(_0xa9f5('0x4'));var db=require(_0xa9f5('0x5'))['db'];function respondWithResult(_0x3cdf79,_0x4eeedd){_0x4eeedd=_0x4eeedd||0xc8;return function(_0x20f51f){if(_0x20f51f){return _0x3cdf79['status'](_0x4eeedd)[_0xa9f5('0x6')](_0x20f51f);}};}function respondWithFilteredResult(_0x219e89,_0x49e337){return function(_0x6c040d){if(_0x6c040d){var _0x285dad=typeof _0x49e337[_0xa9f5('0x7')]===_0xa9f5('0x8')&&typeof _0x49e337[_0xa9f5('0x9')]===_0xa9f5('0x8');var _0x189ef8=_0x6c040d['count'];var _0x2e0ff8=_0x285dad?0x0:_0x49e337[_0xa9f5('0x7')];var _0x4bb362=_0x285dad?_0x6c040d[_0xa9f5('0xa')]:_0x49e337[_0xa9f5('0x7')]+_0x49e337['limit'];var _0x5866a1;if(_0x4bb362>=_0x189ef8){_0x4bb362=_0x189ef8;_0x5866a1=0xc8;}else{_0x5866a1=0xce;}_0x219e89[_0xa9f5('0xb')](_0x5866a1);return _0x219e89[_0xa9f5('0xc')](_0xa9f5('0xd'),_0x2e0ff8+'-'+_0x4bb362+'/'+_0x189ef8)[_0xa9f5('0x6')](_0x6c040d);}return null;};}function saveUpdates(_0x4c26a8,_0x788dec){return function(_0x24ce85){if(_0x24ce85){return _0x24ce85[_0xa9f5('0xe')](_0x4c26a8)['then'](function(_0xc78de5){return _0xc78de5;});}return null;};}function handleEntityNotFound(_0x899513,_0x5a5653){return function(_0x58609c){if(!_0x58609c){_0x899513['sendStatus'](0x194);}return _0x58609c;};}function handleError(_0x100e72,_0x48bfdc){_0x48bfdc=_0x48bfdc||0x1f4;return function(_0x5f2b6a){logger[_0xa9f5('0xf')](_0x5f2b6a[_0xa9f5('0x10')]);if(_0x5f2b6a[_0xa9f5('0x11')]){delete _0x5f2b6a[_0xa9f5('0x11')];}_0x100e72['status'](_0x48bfdc)[_0xa9f5('0x12')](_0x5f2b6a);};}exports[_0xa9f5('0x13')]=function(_0x230fc2,_0x45af85){var _0x2fe6a7={},_0x1ee027={},_0x3b706b={'count':0x0,'rows':[]};var _0x430acb=_[_0xa9f5('0x14')](db[_0xa9f5('0x15')][_0xa9f5('0x16')],function(_0x27a7b0){return{'name':_0x27a7b0['fieldName'],'type':_0x27a7b0[_0xa9f5('0x17')][_0xa9f5('0x18')]};});_0x1ee027[_0xa9f5('0x19')]=_[_0xa9f5('0x14')](_0x430acb,_0xa9f5('0x11'));_0x1ee027[_0xa9f5('0x1a')]=_[_0xa9f5('0x1b')](_0x230fc2['query']);_0x1ee027[_0xa9f5('0x1c')]=_[_0xa9f5('0x1d')](_0x1ee027[_0xa9f5('0x19')],_0x1ee027[_0xa9f5('0x1a')]);_0x1ee027[_0xa9f5('0x1c')]=_[_0xa9f5('0x1e')](_0x1ee027[_0xa9f5('0x1c')],[_0xa9f5('0x1f'),'$or',_0xa9f5('0x20'),_0xa9f5('0x21'),_0xa9f5('0x22'),_0xa9f5('0x23'),_0xa9f5('0x24'),_0xa9f5('0x25'),'$not',_0xa9f5('0x26'),'$notBetween','$in','$notIn',_0xa9f5('0x27'),_0xa9f5('0x28'),_0xa9f5('0x29'),_0xa9f5('0x2a'),_0xa9f5('0x27'),_0xa9f5('0x2b'),'$contains',_0xa9f5('0x2c'),_0xa9f5('0x2d')]);_0x2fe6a7[_0xa9f5('0x2e')]=_[_0xa9f5('0x1d')](_0x1ee027[_0xa9f5('0x19')],qs[_0xa9f5('0x2f')](_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x2f')]));_0x2fe6a7['attributes']=_0x2fe6a7['attributes']['length']?_0x2fe6a7[_0xa9f5('0x2e')]:_0x1ee027[_0xa9f5('0x19')];if(!_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x30')](_0xa9f5('0x31'))){_0x2fe6a7[_0xa9f5('0x9')]=qs[_0xa9f5('0x9')](_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x9')]);_0x2fe6a7[_0xa9f5('0x7')]=qs[_0xa9f5('0x7')](_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x7')]);}_0x2fe6a7['order']=qs[_0xa9f5('0x32')](_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x32')]);_0x2fe6a7[_0xa9f5('0x33')]=qs[_0xa9f5('0x1c')](_[_0xa9f5('0x34')](_0x230fc2[_0xa9f5('0x1a')],_0x1ee027[_0xa9f5('0x1c')]),_0x430acb);if(_0x230fc2['query'][_0xa9f5('0x35')]){_0x2fe6a7['where']=_[_0xa9f5('0x36')](_0x2fe6a7[_0xa9f5('0x33')],{'$or':_['map'](_0x430acb,function(_0x11cc39){if(_0x11cc39[_0xa9f5('0x17')]!==_0xa9f5('0x37')){var _0x2cbd28={};_0x2cbd28[_0x11cc39['name']]={'$like':'%'+_0x230fc2[_0xa9f5('0x1a')][_0xa9f5('0x35')]+'%'};return _0x2cbd28;}})});}_0x2fe6a7=_['merge']({},_0x2fe6a7,_0x230fc2[_0xa9f5('0x38')]);var _0x23232b={'where':_0x2fe6a7[_0xa9f5('0x33')]};return db[_0xa9f5('0x15')][_0xa9f5('0xa')](_0x23232b)[_0xa9f5('0x39')](function(_0x1d71f8){_0x3b706b[_0xa9f5('0xa')]=_0x1d71f8;if(_0x230fc2[_0xa9f5('0x1a')]['includeAll']){_0x2fe6a7['include']=[{'all':!![]}];}return db[_0xa9f5('0x15')][_0xa9f5('0x3a')](_0x2fe6a7);})['then'](function(_0x90b200){_0x3b706b[_0xa9f5('0x3b')]=_0x90b200;return _0x3b706b;})[_0xa9f5('0x39')](respondWithFilteredResult(_0x45af85,_0x2fe6a7))[_0xa9f5('0x3c')](handleError(_0x45af85,null));};exports['show']=function(_0x2bc650,_0x39f83f){var _0x5a4715={'raw':!![],'where':{'id':_0x2bc650[_0xa9f5('0x3d')]['id']}},_0x1d856f={};_0x1d856f['model']=_[_0xa9f5('0x1b')](db[_0xa9f5('0x15')]['rawAttributes']);_0x1d856f[_0xa9f5('0x1a')]=_[_0xa9f5('0x1b')](_0x2bc650['query']);_0x1d856f[_0xa9f5('0x1c')]=_[_0xa9f5('0x1d')](_0x1d856f['model'],_0x1d856f[_0xa9f5('0x1a')]);_0x5a4715['attributes']=_[_0xa9f5('0x1d')](_0x1d856f[_0xa9f5('0x19')],qs['fields'](_0x2bc650[_0xa9f5('0x1a')]['fields']));_0x5a4715['attributes']=_0x5a4715[_0xa9f5('0x2e')][_0xa9f5('0x3e')]?_0x5a4715[_0xa9f5('0x2e')]:_0x1d856f[_0xa9f5('0x19')];if(_0x2bc650[_0xa9f5('0x1a')][_0xa9f5('0x3f')]){_0x5a4715[_0xa9f5('0x40')]=[{'all':!![]}];}_0x5a4715=_[_0xa9f5('0x36')]({},_0x5a4715,_0x2bc650[_0xa9f5('0x38')]);return db['CmHopper'][_0xa9f5('0x41')](_0x5a4715)[_0xa9f5('0x39')](handleEntityNotFound(_0x39f83f,null))[_0xa9f5('0x39')](respondWithResult(_0x39f83f,null))[_0xa9f5('0x3c')](handleError(_0x39f83f,null));};exports[_0xa9f5('0x42')]=function(_0x2b00db,_0x11c1d4){return db[_0xa9f5('0x15')][_0xa9f5('0x42')](_0x2b00db[_0xa9f5('0x43')],{})[_0xa9f5('0x39')](respondWithResult(_0x11c1d4,0xc9))[_0xa9f5('0x3c')](handleError(_0x11c1d4,null));};exports[_0xa9f5('0xe')]=function(_0xd95e3,_0x2dc190){if(_0xd95e3[_0xa9f5('0x43')]['id']){delete _0xd95e3[_0xa9f5('0x43')]['id'];}return db[_0xa9f5('0x15')][_0xa9f5('0x41')]({'where':{'id':_0xd95e3['params']['id']}})['then'](handleEntityNotFound(_0x2dc190,null))[_0xa9f5('0x39')](saveUpdates(_0xd95e3[_0xa9f5('0x43')],null))['then'](respondWithResult(_0x2dc190,null))[_0xa9f5('0x3c')](handleError(_0x2dc190,null));};exports[_0xa9f5('0x44')]=function(_0x44ee96,_0x59e5b7){return db[_0xa9f5('0x15')]['describe']()[_0xa9f5('0x39')](respondWithResult(_0x59e5b7,null))[_0xa9f5('0x3c')](handleError(_0x59e5b7,null));};exports[_0xa9f5('0x45')]=function(_0x836a8d,_0x102ed8){var _0x57c877;var _0x4e17a9=_0x836a8d[_0xa9f5('0x3d')]['id'];return db['CmHopper']['find']({'where':{'id':_0x836a8d[_0xa9f5('0x3d')]['id']}})['then'](handleEntityNotFound(_0x102ed8,null))[_0xa9f5('0x39')](function(_0x56fe65){if(_0x56fe65){return _0x56fe65[_0xa9f5('0x45')]()[_0xa9f5('0x39')](function(_0xafeecc){return _0xafeecc;});}})['then'](function(_0x2cc06e){_0x57c877=_0x2cc06e;if(_0x2cc06e){if(_0x2cc06e[_0xa9f5('0x46')]||_0x2cc06e[_0xa9f5('0x47')]){return db[_0x2cc06e['VoiceQueueId']?_0xa9f5('0x48'):'Campaign']['find']({'where':{'id':_0x2cc06e[_0xa9f5('0x46')]?_0x2cc06e[_0xa9f5('0x46')]:_0x2cc06e[_0xa9f5('0x47')]},'attributes':['id',_0xa9f5('0x11')],'raw':!![]});}}})['then'](function(_0x31cf70){var _0x58b278={};if(_0x31cf70){_[_0xa9f5('0x36')](_0x58b278,_[_0xa9f5('0x49')](_0x57c877[_0xa9f5('0x4a')],['createdAt','updatedAt','id']));_0x58b278[_0xa9f5('0x4b')]=0x15;_0x58b278[_0xa9f5('0x4c')]='deleted';_0x58b278[_0xa9f5('0x4d')]=_0x31cf70[_0xa9f5('0x11')];_0x58b278[_0xa9f5('0x4e')]=_0x836a8d[_0xa9f5('0x4f')][_0xa9f5('0x11')];_0x58b278[_0xa9f5('0x50')]=_0x836a8d[_0xa9f5('0x4f')]['id'];_0x58b278[_0xa9f5('0x51')]=!![];_0x58b278['deletedat']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x58b278[_0xa9f5('0x52')]=_0x57c877['phone'];_0x58b278[_0xa9f5('0x53')]=_0x57c877[_0xa9f5('0x46')]?_0xa9f5('0x54'):_0xa9f5('0x55');return db[_0xa9f5('0x56')][_0xa9f5('0x41')]({'where':{'id':_0x58b278['ContactId']},'attributes':[_0xa9f5('0x57'),_0xa9f5('0x58')]})[_0xa9f5('0x39')](function(_0x19dad6){if(!_[_0xa9f5('0x59')](_0x102ed8)&&!_['isNil'](_0x19dad6[_0xa9f5('0x57')])){_0x58b278['calleridname']=_0x19dad6['firstName'];if(!_['isNil'](_0x19dad6[_0xa9f5('0x58')])){_0x58b278['calleridname']+='\x20'+_0x19dad6[_0xa9f5('0x58')];}}})[_0xa9f5('0x5a')](function(){return db[_0xa9f5('0x5b')]['create'](_0x58b278);});}})['then'](function(_0x2ee9cf){return db['CmHopperAdditionalPhone'][_0xa9f5('0x45')]({'where':{'CmHopperId':_0x4e17a9}});})[_0xa9f5('0x39')](function(){return _0x102ed8[_0xa9f5('0xb')](0xcc)[_0xa9f5('0x5c')]();})[_0xa9f5('0x3c')](handleError(_0x102ed8,null));};exports[_0xa9f5('0x5d')]=function(_0x34c6cb,_0x28ee02){var _0x326a87=[];return db['CmContact']['describe']()[_0xa9f5('0x39')](function(_0x51bd6f){_0x326a87=_[_0xa9f5('0x1b')](_0x51bd6f);return _0x34c6cb[_0xa9f5('0x4f')]['getVoiceQueues']({'where':{'type':_0xa9f5('0x5e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xa9f5('0x5f'),_0xa9f5('0x60')],'raw':!![]});})[_0xa9f5('0x39')](function(_0x5c661e){if(_0x5c661e&&_0x5c661e[_0xa9f5('0x3e')]){return db[_0xa9f5('0x61')][_0xa9f5('0x62')](function(_0x5ab4c0){var _0x2eaa8c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa9f5('0x63')](_0xa9f5('0x64'))},'VoiceQueueId':{'$in':_[_0xa9f5('0x14')](_0x5c661e,'id')},'$or':[{'UserId':null},{'UserId':_0x34c6cb[_0xa9f5('0x4f')]['id']}]};var _0x5f0986={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5c661e)[_0xa9f5('0x35')](['dialPreviewAutoRecallMe',0x0])[_0xa9f5('0x14')]('id')[_0xa9f5('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x34c6cb[_0xa9f5('0x4f')]['id']}]};var _0x272c19={'$or':[_0x2eaa8c,_0x5f0986]};var _0x3a79f1=[];if(_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x66')]&&_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x66')]===_0xa9f5('0x67')){if(!_[_0xa9f5('0x68')](_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x69')])){_0x272c19['id']={'$in':_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x69')]};}_0x3a79f1=[['priority',_0xa9f5('0x6a')],[_0xa9f5('0x6b'),_0x5c661e[0x0][_0xa9f5('0x5f')]===_0xa9f5('0x6a')?'DESC':_0xa9f5('0x6a')],db[_0xa9f5('0x61')][_0xa9f5('0x6c')](_0xa9f5('0x6d')),['id','DESC']];}else{if(!_[_0xa9f5('0x68')](_0x34c6cb[_0xa9f5('0x43')]['hopperIds'])){_0x272c19['id']={'$notIn':_0x34c6cb[_0xa9f5('0x43')][_0xa9f5('0x69')]};}_0x3a79f1=[['priority','DESC'],[_0xa9f5('0x6b'),_0x5c661e[0x0][_0xa9f5('0x5f')]],db[_0xa9f5('0x61')][_0xa9f5('0x6c')](_0xa9f5('0x6e')),['id',_0xa9f5('0x6a')]];}return db[_0xa9f5('0x15')]['findOne']({'attributes':['id','scheduledat',_0xa9f5('0x6f'),'recallme'],'where':_0x272c19,'order':_0x3a79f1,'transaction':_0x5ab4c0,'lock':_0x5ab4c0[_0xa9f5('0x70')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xa9f5('0x71'),'attributes':_0x326a87,'include':[{'model':db[_0xa9f5('0x72')],'as':_0xa9f5('0x73'),'attributes':['id',_0xa9f5('0x11')]}]},{'model':db['CmList'],'as':_0xa9f5('0x74'),'attributes':['id',_0xa9f5('0x11')]},{'model':db[_0xa9f5('0x48')],'as':_0xa9f5('0x75'),'attributes':['id',_0xa9f5('0x11'),_0xa9f5('0x76')]}]})[_0xa9f5('0x39')](function(_0x25da3e){if(_0x25da3e){return _0x25da3e[_0xa9f5('0xe')]({'UserId':_0x34c6cb[_0xa9f5('0x4f')]['id']},{'transaction':_0x5ab4c0});}});});}})['then'](handleEntityNotFound(_0x28ee02,null))['then'](respondWithResult(_0x28ee02,null))[_0xa9f5('0x3c')](handleError(_0x28ee02,null));};exports[_0xa9f5('0x77')]=function(_0x53875e,_0x52cae4,_0x3c754a){var _0x18647f=[];var _0x36b1a0=_0x53875e[_0xa9f5('0x3d')]['id'];var _0x26a27a=_0x53875e[_0xa9f5('0x4f')]['id'];return db[_0xa9f5('0x56')][_0xa9f5('0x44')]()[_0xa9f5('0x39')](function(_0x56d603){_0x18647f=_['keys'](_0x56d603);return db[_0xa9f5('0x61')][_0xa9f5('0x62')](function(_0x5a8788){const _0x5e7a9b={'id':_0x36b1a0};return db[_0xa9f5('0x15')][_0xa9f5('0x78')]({'attributes':['id',_0xa9f5('0x79'),'recallme'],'where':_0x5e7a9b,'transaction':_0x5a8788,'lock':_0x5a8788[_0xa9f5('0x70')][_0xa9f5('0x7a')],'include':[{'model':db[_0xa9f5('0x56')],'as':'Contact','attributes':_0x18647f,'include':[{'model':db[_0xa9f5('0x72')],'as':_0xa9f5('0x73'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xa9f5('0x74'),'attributes':['id','name']},{'model':db[_0xa9f5('0x48')],'as':_0xa9f5('0x75'),'attributes':['id',_0xa9f5('0x11'),'dialActive']}]})[_0xa9f5('0x39')](function(_0x4b61e5){if(_0x4b61e5){return _0x4b61e5['update']({'UserId':_0x26a27a},{'transaction':_0x5a8788});}});});})[_0xa9f5('0x39')](handleEntityNotFound(_0x52cae4,null))[_0xa9f5('0x39')](respondWithResult(_0x52cae4,null))[_0xa9f5('0x3c')](handleError(_0x52cae4,null));};exports[_0xa9f5('0x7b')]=function(_0x4e874b,_0x2ba0c2){return _0x4e874b[_0xa9f5('0x4f')]['getVoiceQueues']({'where':{'type':_0xa9f5('0x5e'),'dialActive':!![],'dialMethod':_0xa9f5('0x7c')},'attributes':['id'],'raw':!![]})['then'](function(_0x5effe9){if(_0x5effe9&&_0x5effe9[_0xa9f5('0x3e')]){return db[_0xa9f5('0x15')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa9f5('0x63')](_0xa9f5('0x64'))},'VoiceQueueId':{'$in':_[_0xa9f5('0x14')](_0x5effe9,'id')},'$or':[{'UserId':null},{'UserId':_0x4e874b[_0xa9f5('0x4f')]['id']}]}});}return 0x0;})[_0xa9f5('0x39')](function(_0x413ad5){if(!_[_0xa9f5('0x59')](_0x413ad5)&&_[_0xa9f5('0x7d')](_0x413ad5)){return _0x2ba0c2[_0xa9f5('0xb')](0xc8)[_0xa9f5('0x6')]({'contacts':_0x413ad5});}else{logger[_0xa9f5('0xf')](_0xa9f5('0x7e'),_0xa9f5('0x7b'),0x194,_0xa9f5('0x7f'));_0x2ba0c2[_0xa9f5('0x80')](0x194);}})['catch'](handleError(_0x2ba0c2,null));};exports[_0xa9f5('0x81')]=function(_0x32e2d5,_0x5662ce){var _0x2b44c0=shared[_0xa9f5('0x82')];var _0x314942=[];_[_0xa9f5('0x14')](_0x2b44c0,function(_0x2e5e6c){_0x314942['push']({'id':_0x2e5e6c['name'],'name':_0x2e5e6c[_0xa9f5('0x11')],'utcOffset':_0x2e5e6c['utcOffset']});});return _0x5662ce[_0xa9f5('0xb')](0xc8)[_0xa9f5('0x6')]({'tz':_0x314942});};exports['getTimezone']=function(_0xabacab,_0x4ebc6e){var _0x3afef3=shared[_0xa9f5('0x82')];var _0x37be26={};if(!_[_0xa9f5('0x59')](_0x3afef3[_0xabacab['body']['id']]))_0x37be26=_0x3afef3[_0xabacab[_0xa9f5('0x43')]['id']];return _0x4ebc6e[_0xa9f5('0xb')](0xc8)[_0xa9f5('0x6')](_0x37be26);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 7859eae..d1441ff 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 _0x6f47=['CmHopper','scheduledat','phone','priority','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x6f47,0xc7));var _0x76f4=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x6f47[_0x2a6809];return _0x11c371;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var logger=require(_0x76f4('0x1'))('api');var moment=require(_0x76f4('0x2'));var BPromise=require('bluebird');var rp=require(_0x76f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var attributes=require(_0x76f4('0x6'));module[_0x76f4('0x7')]=function(_0x5754ca,_0x35602f){return _0x5754ca[_0x76f4('0x8')](_0x76f4('0x9'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x76f4('0xa'),'fields':[_0x76f4('0xa')]},{'name':_0x76f4('0xb'),'fields':[_0x76f4('0xb')]},{'name':_0x76f4('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['priority','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone'];(function(_0x119a07,_0x2289f6){var _0x36025c=function(_0xf28f4){while(--_0xf28f4){_0x119a07['push'](_0x119a07['shift']());}};_0x36025c(++_0x2289f6);}(_0xba34,0x119));var _0x4ba3=function(_0x495114,_0x1ec1a4){_0x495114=_0x495114-0x0;var _0x246a6b=_0xba34[_0x495114];return _0x246a6b;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('CmHopper',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[{'name':_0x4ba3('0xb'),'fields':[_0x4ba3('0xb')]},{'name':_0x4ba3('0xc'),'fields':[_0x4ba3('0xc')]},{'name':_0x4ba3('0xd'),'fields':[_0x4ba3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index cde4834..b4ba614 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 _0xcca2=['lodash','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','then','debug','catch','error','message','ShowCmHopper','find','info','stringify','CreateCmHopper','create','body','UpdateCmHopper','update','active','DestroyCmHopper','destroy','describe','transaction','LOCK','UPDATE','CmContact','Contact','keys','User','name','voicePause','push','includes','GetContactDialer','length','dataValues','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','sequelize','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','order','UserId','all','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','interval','availableAgentsIds','literal','NOW()','Agent','CmList','List','CmHopperHandlePreviewRecallNotifications'];(function(_0x223c0d,_0x3ec04d){var _0x207827=function(_0x39d240){while(--_0x39d240){_0x223c0d['push'](_0x223c0d['shift']());}};_0x207827(++_0x3ec04d);}(_0xcca2,0x1bc));var _0x2cca=function(_0x2ddc94,_0x5511ce){_0x2ddc94=_0x2ddc94-0x0;var _0x2a120b=_0xcca2[_0x2ddc94];return _0x2a120b;};'use strict';var _=require(_0x2cca('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var db=require(_0x2cca('0x1'))['db'];var logger=require(_0x2cca('0x2'))(_0x2cca('0x3'));exports[_0x2cca('0x4')]=function(_0x1be6fb){var _0x50eaa5=this;return new Promise(function(_0x43789a,_0x5cb2bd){return db[_0x2cca('0x5')][_0x2cca('0x6')]({'raw':_0x1be6fb[_0x2cca('0x7')]?_0x1be6fb['options'][_0x2cca('0x8')]===undefined?!![]:![]:!![],'where':_0x1be6fb[_0x2cca('0x7')]?_0x1be6fb['options'][_0x2cca('0x9')]||null:null,'attributes':_0x1be6fb['options']?_0x1be6fb['options'][_0x2cca('0xa')]||null:null,'limit':_0x1be6fb[_0x2cca('0x7')]?_0x1be6fb[_0x2cca('0x7')][_0x2cca('0xb')]||null:null,'include':_0x1be6fb[_0x2cca('0x7')]?_0x1be6fb[_0x2cca('0x7')][_0x2cca('0xc')]?_['map'](_0x1be6fb['options'][_0x2cca('0xc')],function(_0x35c8eb){return{'model':db[_0x35c8eb[_0x2cca('0xd')]],'as':_0x35c8eb['as'],'attributes':_0x35c8eb['attributes'],'include':_0x35c8eb[_0x2cca('0xc')]?_[_0x2cca('0xe')](_0x35c8eb[_0x2cca('0xc')],function(_0x48cb89){return{'model':db[_0x48cb89[_0x2cca('0xd')]],'as':_0x48cb89['as'],'attributes':_0x48cb89[_0x2cca('0xa')],'include':_0x48cb89[_0x2cca('0xc')]?_[_0x2cca('0xe')](_0x48cb89[_0x2cca('0xc')],function(_0x5d7bb1){return{'model':db[_0x5d7bb1[_0x2cca('0xd')]],'as':_0x5d7bb1['as'],'attributes':_0x5d7bb1[_0x2cca('0xa')]};}):[]};}):[]};}):[]:[]})[_0x2cca('0xf')](function(_0x55b47f){logger['info'](_0x2cca('0x4'),_0x1be6fb);logger[_0x2cca('0x10')](_0x2cca('0x4'),_0x1be6fb,JSON['stringify'](_0x55b47f));_0x43789a(_0x55b47f);})[_0x2cca('0x11')](function(_0x5c4127){logger[_0x2cca('0x12')](_0x2cca('0x4'),_0x5c4127['message'],_0x1be6fb);_0x5cb2bd(_0x50eaa5['error'](0x1f4,_0x5c4127[_0x2cca('0x13')]));});});};exports[_0x2cca('0x14')]=function(_0x448b28){var _0x3f8013=this;return new Promise(function(_0x2ee191,_0x41030f){return db['CmHopper'][_0x2cca('0x15')]({'raw':_0x448b28['options']?_0x448b28['options'][_0x2cca('0x8')]===undefined?!![]:![]:!![],'where':_0x448b28[_0x2cca('0x7')]?_0x448b28[_0x2cca('0x7')]['where']||null:null,'attributes':_0x448b28[_0x2cca('0x7')]?_0x448b28[_0x2cca('0x7')][_0x2cca('0xa')]||null:null,'include':_0x448b28['options']?_0x448b28[_0x2cca('0x7')][_0x2cca('0xc')]?_['map'](_0x448b28[_0x2cca('0x7')][_0x2cca('0xc')],function(_0x3ce00a){return{'model':db[_0x3ce00a[_0x2cca('0xd')]],'as':_0x3ce00a['as'],'attributes':_0x3ce00a[_0x2cca('0xa')],'include':_0x3ce00a['include']?_[_0x2cca('0xe')](_0x3ce00a['include'],function(_0x306313){return{'model':db[_0x306313[_0x2cca('0xd')]],'as':_0x306313['as'],'attributes':_0x306313[_0x2cca('0xa')],'include':_0x306313[_0x2cca('0xc')]?_[_0x2cca('0xe')](_0x306313['include'],function(_0x13a245){return{'model':db[_0x13a245[_0x2cca('0xd')]],'as':_0x13a245['as'],'attributes':_0x13a245['attributes']};}):[]};}):[]};}):[]:[]})[_0x2cca('0xf')](function(_0x39833d){logger[_0x2cca('0x16')](_0x2cca('0x14'),_0x448b28);logger[_0x2cca('0x10')](_0x2cca('0x14'),_0x448b28,JSON[_0x2cca('0x17')](_0x39833d));_0x2ee191(_0x39833d);})[_0x2cca('0x11')](function(_0x204a70){logger['error']('ShowCmHopper',_0x204a70[_0x2cca('0x13')],_0x448b28);_0x41030f(_0x3f8013[_0x2cca('0x12')](0x1f4,_0x204a70[_0x2cca('0x13')]));});});};exports[_0x2cca('0x18')]=function(_0x4011ba){var _0x476b6a=this;return new Promise(function(_0x2fb782,_0x435459){return db[_0x2cca('0x5')][_0x2cca('0x19')](_0x4011ba[_0x2cca('0x1a')],{'raw':_0x4011ba[_0x2cca('0x7')]?_0x4011ba[_0x2cca('0x7')][_0x2cca('0x8')]===undefined?!![]:![]:!![]})[_0x2cca('0xf')](function(_0x45ac4b){logger['info'](_0x2cca('0x18'),_0x4011ba);logger[_0x2cca('0x10')](_0x2cca('0x18'),_0x4011ba,JSON[_0x2cca('0x17')](_0x45ac4b));_0x2fb782(_0x45ac4b);})[_0x2cca('0x11')](function(_0x33269f){logger[_0x2cca('0x12')](_0x2cca('0x18'),_0x33269f[_0x2cca('0x13')],_0x4011ba);_0x435459(_0x476b6a[_0x2cca('0x12')](0x1f4,_0x33269f[_0x2cca('0x13')]));});});};exports[_0x2cca('0x1b')]=function(_0x12d279){var _0x1e00b5=this;return new Promise(function(_0x15af2f,_0x8c90f3){return db[_0x2cca('0x5')][_0x2cca('0x1c')](_0x12d279[_0x2cca('0x1a')],{'raw':_0x12d279[_0x2cca('0x7')]?_0x12d279[_0x2cca('0x7')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12d279[_0x2cca('0x7')]?_0x12d279[_0x2cca('0x7')][_0x2cca('0x9')]||null:null,'attributes':_0x12d279[_0x2cca('0x7')]?_0x12d279[_0x2cca('0x7')]['attributes']||null:null,'limit':_0x12d279[_0x2cca('0x7')]?_0x12d279[_0x2cca('0x7')][_0x2cca('0xb')]||null:null})[_0x2cca('0xf')](function(_0x5a1f1e){logger[_0x2cca('0x16')](_0x2cca('0x1b'),_0x12d279);logger[_0x2cca('0x16')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x2cca('0x17')](_0x12d279[_0x2cca('0x7')][_0x2cca('0x9')]),_0x12d279[_0x2cca('0x1a')][_0x2cca('0x1d')]);logger[_0x2cca('0x10')]('UpdateCmHopper',_0x12d279,JSON[_0x2cca('0x17')](_0x5a1f1e));_0x15af2f(_0x5a1f1e);})['catch'](function(_0x23beb6){logger[_0x2cca('0x12')](_0x2cca('0x1b'),_0x23beb6[_0x2cca('0x13')],_0x12d279);_0x8c90f3(_0x1e00b5[_0x2cca('0x12')](0x1f4,_0x23beb6['message']));});});};exports[_0x2cca('0x1e')]=function(_0x10e4cd){var _0x10d104=this;return new Promise(function(_0x498e97,_0x499e1c){return db[_0x2cca('0x5')][_0x2cca('0x1f')]({'where':_0x10e4cd[_0x2cca('0x7')]?_0x10e4cd[_0x2cca('0x7')][_0x2cca('0x9')]||null:null})[_0x2cca('0xf')](function(_0x59b2de){logger[_0x2cca('0x16')](_0x2cca('0x1e'),_0x10e4cd);logger[_0x2cca('0x10')](_0x2cca('0x1e'),_0x10e4cd,JSON[_0x2cca('0x17')](_0x59b2de));_0x498e97(_0x59b2de);})['catch'](function(_0x45de77){logger['error'](_0x2cca('0x1e'),_0x45de77[_0x2cca('0x13')],_0x10e4cd);_0x499e1c(_0x10d104['error'](0x1f4,_0x45de77[_0x2cca('0x13')]));});});};exports['GetContactDialer']=function(_0x242eb5){var _0x471ed5=this;return new Promise(function(_0xb828d6,_0x486150){return db['CmContact'][_0x2cca('0x20')]()[_0x2cca('0xf')](function(_0x4c3bbf){return db['sequelize'][_0x2cca('0x21')](function(_0x204126){return db[_0x2cca('0x5')][_0x2cca('0x6')]({'where':_0x242eb5[_0x2cca('0x7')]?_0x242eb5[_0x2cca('0x7')]['where']||null:null,'attributes':_0x242eb5[_0x2cca('0x7')]?_0x242eb5[_0x2cca('0x7')]['attributes']||null:null,'limit':_0x242eb5['options']?_0x242eb5[_0x2cca('0x7')][_0x2cca('0xb')]||null:null,'order':_0x242eb5['options']?_0x242eb5[_0x2cca('0x7')]['order']||null:null,'transaction':_0x204126,'lock':_0x204126[_0x2cca('0x22')][_0x2cca('0x23')],'include':[{'model':db[_0x2cca('0x24')],'as':_0x2cca('0x25'),'attributes':_[_0x2cca('0x26')](_0x4c3bbf)},{'model':db[_0x2cca('0x27')],'as':'Agent','attributes':['id',_0x2cca('0x28'),_0x2cca('0x29')]}]})['then'](function(_0x2f92c9){var _0x5a24cb=[];var _0x52fcbf=[];for(var _0x315714=0x0;_0x315714<_0x2f92c9['length'];_0x315714+=0x1){var _0x2a6337=_0x2f92c9[_0x315714]['UserId'];if(_0x2a6337===null){_0x5a24cb[_0x2cca('0x2a')](_0x2f92c9[_0x315714][_0x2cca('0x1c')](_0x242eb5[_0x2cca('0x1a')],{'transaction':_0x204126}));}else if(!_0x52fcbf[_0x2cca('0x2b')](_0x2a6337)){_0x52fcbf[_0x2cca('0x2a')](_0x2a6337);_0x5a24cb['push'](_0x2f92c9[_0x315714]['update'](_0x242eb5[_0x2cca('0x1a')],{'transaction':_0x204126}));}}return BPromise['all'](_0x5a24cb);});})[_0x2cca('0xf')](function(_0x132dcb){logger[_0x2cca('0x16')](_0x2cca('0x2c'),_0x242eb5);if(_0x132dcb[_0x2cca('0x2d')]>0x0){logger[_0x2cca('0x16')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x132dcb[0x0][_0x2cca('0x2e')]['id'],_0x132dcb[0x0]['dataValues']['ContactId'],_0x132dcb[0x0][_0x2cca('0x2e')][_0x2cca('0x1d')]);}logger[_0x2cca('0x10')](_0x2cca('0x2c'),_0x242eb5,JSON[_0x2cca('0x17')](_0x132dcb));_0xb828d6(_0x132dcb);})[_0x2cca('0x11')](function(_0x41b5ff){logger['error'](_0x2cca('0x2c'),_0x41b5ff[_0x2cca('0x13')],_0x242eb5);_0x486150(_0x471ed5[_0x2cca('0x12')](0x1f4,_0x41b5ff[_0x2cca('0x13')]));});});});};exports[_0x2cca('0x2f')]=function(_0x1302f6){var _0x2b7f48=this;return new Promise(function(_0x5365e6,_0x3ffb5b){return db['sequelize']['transaction'](function(_0x10bb57){return db['CmHopperFinal']['create'](_0x1302f6[_0x2cca('0x1a')],{'raw':_0x1302f6['options']?_0x1302f6[_0x2cca('0x7')][_0x2cca('0x8')]===undefined?!![]:![]:!![],'transaction':_0x10bb57})[_0x2cca('0xf')](function(){logger[_0x2cca('0x16')](_0x2cca('0x30'),JSON[_0x2cca('0x17')](_0x1302f6['options'][_0x2cca('0x9')]),_0x1302f6[_0x2cca('0x7')][_0x2cca('0x9')][_0x2cca('0x1d')]);return db[_0x2cca('0x5')][_0x2cca('0x1f')]({'where':_0x1302f6[_0x2cca('0x7')]?_0x1302f6[_0x2cca('0x7')][_0x2cca('0x9')]||null:null,'transaction':_0x10bb57});});})[_0x2cca('0xf')](function(_0x23c620){logger[_0x2cca('0x16')]('MoveContactManagedDialer',_0x1302f6);logger[_0x2cca('0x10')](_0x2cca('0x2f'),_0x1302f6,JSON[_0x2cca('0x17')](_0x23c620));_0x5365e6(_0x23c620);})[_0x2cca('0x11')](function(_0x285601){logger[_0x2cca('0x12')](_0x2cca('0x2f'),_0x285601[_0x2cca('0x13')],_0x1302f6);_0x3ffb5b(_0x2b7f48[_0x2cca('0x12')](0x1f4,_0x285601['message']));});});};exports[_0x2cca('0x31')]=function(_0x1cae4c){var _0x16b3f1=this;return new Promise(function(_0x23c818,_0xc6e47a){return db[_0x2cca('0x5')][_0x2cca('0x6')]({'raw':_0x1cae4c[_0x2cca('0x7')]?_0x1cae4c['options'][_0x2cca('0x8')]===undefined?!![]:![]:!![],'where':_0x1cae4c['options']?_0x1cae4c[_0x2cca('0x7')][_0x2cca('0x9')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x2cca('0x32')]['fn']('IF',db[_0x2cca('0x32')]['literal'](_0x2cca('0x33')+util[_0x2cca('0x34')]('\x22%s\x22',moment()['format'](_0x2cca('0x35')))+'\x20,\x201,\x20null'))),_0x2cca('0x36')]]})[_0x2cca('0xf')](function(_0x3bedb3){logger[_0x2cca('0x16')](_0x2cca('0x31'),_0x1cae4c);logger[_0x2cca('0x10')]('CountReScheduled',_0x1cae4c,JSON['stringify'](_0x3bedb3));_0x23c818(_0x3bedb3);})[_0x2cca('0x11')](function(_0x2a6ace){logger[_0x2cca('0x12')](_0x2cca('0x31'),_0x2a6ace[_0x2cca('0x13')],_0x1cae4c);_0xc6e47a(_0x16b3f1['error'](0x1f4,_0x2a6ace[_0x2cca('0x13')]));});});};exports[_0x2cca('0x37')]=function(_0x311957){var _0x25e360=this;return new Promise(function(_0x50c539,_0x3313d4){return db[_0x2cca('0x24')]['describe']()[_0x2cca('0xf')](function(){return db['sequelize'][_0x2cca('0x21')](function(_0x21b6a0){return db[_0x2cca('0x5')]['findAll']({'where':_0x311957[_0x2cca('0x7')]?_0x311957[_0x2cca('0x7')][_0x2cca('0x9')]||null:null,'attributes':_0x311957[_0x2cca('0x7')]?_0x311957[_0x2cca('0x7')][_0x2cca('0xa')]||null:null,'limit':0x1,'order':_0x311957[_0x2cca('0x7')]?_0x311957[_0x2cca('0x7')][_0x2cca('0x38')]||null:null,'group':db[_0x2cca('0x5')][_0x2cca('0x39')],'transaction':_0x21b6a0,'lock':_0x21b6a0[_0x2cca('0x22')][_0x2cca('0x23')],'include':_0x311957['options']?_0x311957[_0x2cca('0x7')][_0x2cca('0xc')]?_['map'](_0x311957[_0x2cca('0x7')]['include'],function(_0x1d9beb){return{'model':db[_0x1d9beb[_0x2cca('0xd')]],'as':_0x1d9beb['as'],'attributes':_0x1d9beb['attributes'],'include':_0x1d9beb['include']?_['map'](_0x1d9beb['include'],function(_0x3141e1){return{'model':db[_0x3141e1[_0x2cca('0xd')]],'as':_0x3141e1['as'],'attributes':_0x3141e1[_0x2cca('0xa')],'include':_0x3141e1[_0x2cca('0xc')]?_['map'](_0x3141e1[_0x2cca('0xc')],function(_0xf345bc){return{'model':db[_0xf345bc[_0x2cca('0xd')]],'as':_0xf345bc['as'],'attributes':_0xf345bc[_0x2cca('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ae351){var _0x252b53=[];for(var _0x45ee21=0x0;_0x45ee21<_0x3ae351[_0x2cca('0x2d')];_0x45ee21+=0x1){_0x252b53[_0x2cca('0x2a')](_0x3ae351[_0x45ee21]['update'](_0x311957['body'],{'transaction':_0x21b6a0}));}return BPromise[_0x2cca('0x3a')](_0x252b53);});})[_0x2cca('0xf')](function(_0x216252){logger[_0x2cca('0x16')](_0x2cca('0x37'),_0x311957);logger[_0x2cca('0x10')](_0x2cca('0x37'),_0x311957,JSON[_0x2cca('0x17')](_0x216252));_0x50c539(_0x216252);})[_0x2cca('0x11')](function(_0x4ff48f){logger[_0x2cca('0x12')](_0x2cca('0x37'),_0x4ff48f[_0x2cca('0x13')],_0x311957);_0x3313d4(_0x25e360[_0x2cca('0x12')](0x1f4,_0x4ff48f['message']));});});});};exports[_0x2cca('0x3b')]=function(_0x147847){var _0x2ccea6=this;return new Promise(function(_0x356709,_0x4d4f81){db['CmContact'][_0x2cca('0x20')]()[_0x2cca('0xf')](function(_0x41622e){return db['CmHopper'][_0x2cca('0x6')]({'raw':_0x147847[_0x2cca('0x7')]?_0x147847['options'][_0x2cca('0x8')]===undefined?!![]:![]:!![],'where':_0x147847['options']?_0x147847[_0x2cca('0x7')][_0x2cca('0x9')]||null:null,'attributes':_0x147847[_0x2cca('0x7')]?_0x147847[_0x2cca('0x7')][_0x2cca('0xa')]||null:null,'limit':_0x147847['options']?_0x147847[_0x2cca('0x7')][_0x2cca('0xb')]||null:null,'include':_0x147847[_0x2cca('0x7')]?_0x147847['options'][_0x2cca('0xc')]?_['map'](_0x147847[_0x2cca('0x7')][_0x2cca('0xc')],function(_0x1fc717){return{'model':db[_0x1fc717['model']],'as':_0x1fc717['as'],'attributes':_0x1fc717['as']===_0x2cca('0x25')?_['keys'](_0x41622e):_0x1fc717[_0x2cca('0xa')],'include':_0x1fc717['include']?_[_0x2cca('0xe')](_0x1fc717[_0x2cca('0xc')],function(_0x9471ca){return{'model':db[_0x9471ca['model']],'as':_0x9471ca['as'],'attributes':_0x9471ca[_0x2cca('0xa')],'include':_0x9471ca[_0x2cca('0xc')]?_[_0x2cca('0xe')](_0x9471ca['include'],function(_0xc44709){return{'model':db[_0xc44709['model']],'as':_0xc44709['as'],'attributes':_0xc44709['attributes']};}):[]};}):[]};}):[]:[]})[_0x2cca('0xf')](function(_0x3dd42c){logger[_0x2cca('0x16')](_0x2cca('0x4'),_0x147847);logger[_0x2cca('0x10')](_0x2cca('0x4'),_0x147847,JSON[_0x2cca('0x17')](_0x3dd42c));_0x356709(_0x3dd42c);})[_0x2cca('0x11')](function(_0x11c3d6){logger[_0x2cca('0x12')](_0x2cca('0x4'),_0x11c3d6[_0x2cca('0x13')],_0x147847);_0x4d4f81(_0x2ccea6[_0x2cca('0x12')](0x1f4,_0x11c3d6[_0x2cca('0x13')]));});});});};exports[_0x2cca('0x3c')]=function(_0x299673){var _0x11564a=this;return new Promise(function(_0xc7170,_0x1adbbe){return db['CmContact'][_0x2cca('0x3d')]({'raw':!![],'where':{'phone':_0x299673[_0x2cca('0x7')][_0x2cca('0x9')]['phone']},'attributes':['id',_0x2cca('0x3e')],'order':[['id',_0x2cca('0x3f')]]})[_0x2cca('0xf')](function(_0x254ff9){logger[_0x2cca('0x16')](_0x2cca('0x40'),_0x299673);logger[_0x2cca('0x10')](_0x2cca('0x40'),_0x299673,JSON[_0x2cca('0x17')](_0x254ff9));_0xc7170(_0x254ff9);})[_0x2cca('0x11')](function(_0x12edb9){logger[_0x2cca('0x12')](_0x2cca('0x40'),_0x12edb9[_0x2cca('0x13')],_0x299673);_0x1adbbe(_0x11564a['error'](0x1f4,_0x12edb9[_0x2cca('0x13')]));});});};exports[_0x2cca('0x41')]=function(_0x338ca2){var _0xfce44f=this;return new Promise(function(_0x6fd62f,_0x2f34d4){return db['sequelize']['transaction'](function(_0x4e660a){var _0x5a9702=_0x338ca2['options']&&_0x338ca2['options'][_0x2cca('0x9')]?_0x338ca2[_0x2cca('0x7')][_0x2cca('0x9')]:{};return db[_0x2cca('0x5')][_0x2cca('0x1c')](_0x338ca2['body'],{'where':_0x5a9702,'transaction':_0x4e660a})[_0x2cca('0xf')](function(_0x1ec52e){logger[_0x2cca('0x16')](_0x2cca('0x41'),_0x338ca2);logger['debug']('ResetActiveCalls',_0x338ca2,JSON[_0x2cca('0x17')](_0x1ec52e));_0x6fd62f(_0x1ec52e);})[_0x2cca('0x11')](function(_0x3c4133){logger['error']('ResetActiveCalls',_0x3c4133[_0x2cca('0x13')],_0x338ca2);_0x2f34d4(_0xfce44f[_0x2cca('0x12')](0x1f4,_0x3c4133['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x542793){var _0x346776=this;var _0x4f2112=_0x542793[_0x2cca('0x1a')][_0x2cca('0x9')]['voiceQueueIds'];var _0x19ec9d=_0x542793[_0x2cca('0x1a')][_0x2cca('0x9')][_0x2cca('0x42')];var _0x538560=_0x542793[_0x2cca('0x1a')][_0x2cca('0x9')][_0x2cca('0x43')];return new Promise(function(_0x242c3c,_0xc664ea){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0x4f2112},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x2cca('0x32')][_0x2cca('0x44')]('NOW()\x20+\x20INTERVAL\x20'+_0x19ec9d+'\x20MINUTE'),'$gt':db[_0x2cca('0x32')][_0x2cca('0x44')](_0x2cca('0x45'))}},'UserId':{'$in':_0x538560}},'include':[{'model':db[_0x2cca('0x24')],'as':_0x2cca('0x25')},{'model':db[_0x2cca('0x27')],'as':_0x2cca('0x46'),'attributes':['id',_0x2cca('0x28'),'voicePause']},{'model':db[_0x2cca('0x47')],'as':_0x2cca('0x48')}]})['then'](function(_0xa88885){if(_0xa88885[_0x2cca('0x2d')]>0x0){return db['sequelize'][_0x2cca('0x21')](function(_0x480f9e){return db['CmHopper']['update']({'recallmeNotifiedDate':db[_0x2cca('0x32')][_0x2cca('0x44')](_0x2cca('0x45'))},{'where':{'id':{'$in':_[_0x2cca('0xe')](_0xa88885,'id')}},'transaction':_0x480f9e})[_0x2cca('0xf')](function(){_0x242c3c(_0xa88885);})[_0x2cca('0x11')](function(_0x2ff90f){logger[_0x2cca('0x12')](_0x2cca('0x49'),_0x2ff90f[_0x2cca('0x13')],_0x542793);_0xc664ea(_0x346776[_0x2cca('0x12')](0x1f4,_0x2ff90f[_0x2cca('0x13')]));});})['catch'](function(_0x3531a8){logger[_0x2cca('0x12')](_0x2cca('0x49'),_0x3531a8[_0x2cca('0x13')],_0x542793);_0xc664ea(_0x346776[_0x2cca('0x12')](0x1f4,_0x3531a8[_0x2cca('0x13')]));});}else{_0x242c3c(_0xa88885);}});});}; \ No newline at end of file +var _0x6f75=['push','includes','all','dataValues','active','MoveContactManagedDialer','transaction','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','literal','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','LOCK','UPDATE','GetCmHopperPreview','keys','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','\x20MINUTE','NOW()','name','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','options','attributes','limit','include','map','model','then','info','GetCmHopper','debug','stringify','catch','message','ShowCmHopper','CmHopper','find','raw','error','CreateCmHopper','UpdateCmHopper','update','body','where','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','findAll','order','Contact','User','Agent','voicePause','length','UserId'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x6f75,0x71));var _0x56f7=function(_0x1e2dd4,_0x2e27a1){_0x1e2dd4=_0x1e2dd4-0x0;var _0x583cce=_0x6f75[_0x1e2dd4];return _0x583cce;};'use strict';var _=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var moment=require(_0x56f7('0x2'));var BPromise=require(_0x56f7('0x3'));var db=require(_0x56f7('0x4'))['db'];var logger=require(_0x56f7('0x5'))(_0x56f7('0x6'));exports['GetCmHopper']=function(_0x3443a5){var _0x150c16=this;return new Promise(function(_0x433c6c,_0x4cfe87){return db['CmHopper']['findAll']({'raw':_0x3443a5[_0x56f7('0x7')]?_0x3443a5[_0x56f7('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x3443a5[_0x56f7('0x7')]?_0x3443a5['options']['where']||null:null,'attributes':_0x3443a5[_0x56f7('0x7')]?_0x3443a5[_0x56f7('0x7')][_0x56f7('0x8')]||null:null,'limit':_0x3443a5[_0x56f7('0x7')]?_0x3443a5[_0x56f7('0x7')][_0x56f7('0x9')]||null:null,'include':_0x3443a5[_0x56f7('0x7')]?_0x3443a5[_0x56f7('0x7')][_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x3443a5[_0x56f7('0x7')][_0x56f7('0xa')],function(_0x1fb37d){return{'model':db[_0x1fb37d[_0x56f7('0xc')]],'as':_0x1fb37d['as'],'attributes':_0x1fb37d['attributes'],'include':_0x1fb37d[_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x1fb37d[_0x56f7('0xa')],function(_0x19a47f){return{'model':db[_0x19a47f[_0x56f7('0xc')]],'as':_0x19a47f['as'],'attributes':_0x19a47f[_0x56f7('0x8')],'include':_0x19a47f[_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x19a47f[_0x56f7('0xa')],function(_0x519336){return{'model':db[_0x519336['model']],'as':_0x519336['as'],'attributes':_0x519336[_0x56f7('0x8')]};}):[]};}):[]};}):[]:[]})[_0x56f7('0xd')](function(_0x436a07){logger[_0x56f7('0xe')](_0x56f7('0xf'),_0x3443a5);logger[_0x56f7('0x10')]('GetCmHopper',_0x3443a5,JSON[_0x56f7('0x11')](_0x436a07));_0x433c6c(_0x436a07);})[_0x56f7('0x12')](function(_0x4f0e3a){logger['error'](_0x56f7('0xf'),_0x4f0e3a[_0x56f7('0x13')],_0x3443a5);_0x4cfe87(_0x150c16['error'](0x1f4,_0x4f0e3a[_0x56f7('0x13')]));});});};exports[_0x56f7('0x14')]=function(_0x1d4e8b){var _0x5abaeb=this;return new Promise(function(_0x5a944d,_0x5cf936){return db[_0x56f7('0x15')][_0x56f7('0x16')]({'raw':_0x1d4e8b[_0x56f7('0x7')]?_0x1d4e8b[_0x56f7('0x7')][_0x56f7('0x17')]===undefined?!![]:![]:!![],'where':_0x1d4e8b[_0x56f7('0x7')]?_0x1d4e8b['options']['where']||null:null,'attributes':_0x1d4e8b[_0x56f7('0x7')]?_0x1d4e8b[_0x56f7('0x7')][_0x56f7('0x8')]||null:null,'include':_0x1d4e8b['options']?_0x1d4e8b[_0x56f7('0x7')][_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x1d4e8b[_0x56f7('0x7')][_0x56f7('0xa')],function(_0x443db4){return{'model':db[_0x443db4[_0x56f7('0xc')]],'as':_0x443db4['as'],'attributes':_0x443db4[_0x56f7('0x8')],'include':_0x443db4[_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x443db4[_0x56f7('0xa')],function(_0x4d6db4){return{'model':db[_0x4d6db4[_0x56f7('0xc')]],'as':_0x4d6db4['as'],'attributes':_0x4d6db4[_0x56f7('0x8')],'include':_0x4d6db4['include']?_[_0x56f7('0xb')](_0x4d6db4[_0x56f7('0xa')],function(_0x209648){return{'model':db[_0x209648[_0x56f7('0xc')]],'as':_0x209648['as'],'attributes':_0x209648[_0x56f7('0x8')]};}):[]};}):[]};}):[]:[]})[_0x56f7('0xd')](function(_0x72fbcb){logger[_0x56f7('0xe')]('ShowCmHopper',_0x1d4e8b);logger[_0x56f7('0x10')](_0x56f7('0x14'),_0x1d4e8b,JSON['stringify'](_0x72fbcb));_0x5a944d(_0x72fbcb);})['catch'](function(_0x47699e){logger[_0x56f7('0x18')]('ShowCmHopper',_0x47699e[_0x56f7('0x13')],_0x1d4e8b);_0x5cf936(_0x5abaeb[_0x56f7('0x18')](0x1f4,_0x47699e[_0x56f7('0x13')]));});});};exports[_0x56f7('0x19')]=function(_0x59c65d){var _0x4a2be0=this;return new Promise(function(_0x5acd7b,_0x2dbe0a){return db['CmHopper']['create'](_0x59c65d['body'],{'raw':_0x59c65d[_0x56f7('0x7')]?_0x59c65d[_0x56f7('0x7')][_0x56f7('0x17')]===undefined?!![]:![]:!![]})[_0x56f7('0xd')](function(_0x5e051c){logger[_0x56f7('0xe')](_0x56f7('0x19'),_0x59c65d);logger[_0x56f7('0x10')](_0x56f7('0x19'),_0x59c65d,JSON[_0x56f7('0x11')](_0x5e051c));_0x5acd7b(_0x5e051c);})['catch'](function(_0x3a1afc){logger['error'](_0x56f7('0x19'),_0x3a1afc['message'],_0x59c65d);_0x2dbe0a(_0x4a2be0['error'](0x1f4,_0x3a1afc[_0x56f7('0x13')]));});});};exports[_0x56f7('0x1a')]=function(_0x275176){var _0x1a254e=this;return new Promise(function(_0x903324,_0x2afcc8){return db['CmHopper'][_0x56f7('0x1b')](_0x275176[_0x56f7('0x1c')],{'raw':_0x275176['options']?_0x275176['options'][_0x56f7('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x275176[_0x56f7('0x7')]?_0x275176[_0x56f7('0x7')]['where']||null:null,'attributes':_0x275176[_0x56f7('0x7')]?_0x275176[_0x56f7('0x7')][_0x56f7('0x8')]||null:null,'limit':_0x275176[_0x56f7('0x7')]?_0x275176['options'][_0x56f7('0x9')]||null:null})[_0x56f7('0xd')](function(_0x53435e){logger[_0x56f7('0xe')](_0x56f7('0x1a'),_0x275176);logger[_0x56f7('0xe')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x56f7('0x11')](_0x275176[_0x56f7('0x7')][_0x56f7('0x1d')]),_0x275176[_0x56f7('0x1c')]['active']);logger[_0x56f7('0x10')](_0x56f7('0x1a'),_0x275176,JSON[_0x56f7('0x11')](_0x53435e));_0x903324(_0x53435e);})['catch'](function(_0x549c10){logger['error'](_0x56f7('0x1a'),_0x549c10[_0x56f7('0x13')],_0x275176);_0x2afcc8(_0x1a254e['error'](0x1f4,_0x549c10['message']));});});};exports[_0x56f7('0x1e')]=function(_0x1748df){var _0x6d8054=this;return new Promise(function(_0x57e9a7,_0x4bed45){return db[_0x56f7('0x15')]['destroy']({'where':_0x1748df[_0x56f7('0x7')]?_0x1748df[_0x56f7('0x7')][_0x56f7('0x1d')]||null:null})['then'](function(_0xbb2154){logger[_0x56f7('0xe')](_0x56f7('0x1e'),_0x1748df);logger[_0x56f7('0x10')](_0x56f7('0x1e'),_0x1748df,JSON[_0x56f7('0x11')](_0xbb2154));_0x57e9a7(_0xbb2154);})['catch'](function(_0x3d2c61){logger[_0x56f7('0x18')](_0x56f7('0x1e'),_0x3d2c61['message'],_0x1748df);_0x4bed45(_0x6d8054[_0x56f7('0x18')](0x1f4,_0x3d2c61['message']));});});};exports[_0x56f7('0x1f')]=function(_0x129892){var _0x543939=this;return new Promise(function(_0x1bc07e,_0x303c32){return db[_0x56f7('0x20')][_0x56f7('0x21')]()[_0x56f7('0xd')](function(_0x5a9398){return db[_0x56f7('0x22')]['transaction'](function(_0x2a06c2){return db['CmHopper'][_0x56f7('0x23')]({'where':_0x129892['options']?_0x129892[_0x56f7('0x7')][_0x56f7('0x1d')]||null:null,'attributes':_0x129892[_0x56f7('0x7')]?_0x129892['options']['attributes']||null:null,'limit':_0x129892[_0x56f7('0x7')]?_0x129892[_0x56f7('0x7')]['limit']||null:null,'order':_0x129892[_0x56f7('0x7')]?_0x129892['options'][_0x56f7('0x24')]||null:null,'transaction':_0x2a06c2,'lock':_0x2a06c2['LOCK']['UPDATE'],'include':[{'model':db[_0x56f7('0x20')],'as':_0x56f7('0x25'),'attributes':_['keys'](_0x5a9398)},{'model':db[_0x56f7('0x26')],'as':_0x56f7('0x27'),'attributes':['id','name',_0x56f7('0x28')]}]})['then'](function(_0x214a49){var _0x135466=[];var _0x2a944f=[];for(var _0xb156e8=0x0;_0xb156e8<_0x214a49[_0x56f7('0x29')];_0xb156e8+=0x1){var _0x5059dd=_0x214a49[_0xb156e8][_0x56f7('0x2a')];if(_0x5059dd===null){_0x135466[_0x56f7('0x2b')](_0x214a49[_0xb156e8][_0x56f7('0x1b')](_0x129892['body'],{'transaction':_0x2a06c2}));}else if(!_0x2a944f[_0x56f7('0x2c')](_0x5059dd)){_0x2a944f[_0x56f7('0x2b')](_0x5059dd);_0x135466['push'](_0x214a49[_0xb156e8][_0x56f7('0x1b')](_0x129892[_0x56f7('0x1c')],{'transaction':_0x2a06c2}));}}return BPromise[_0x56f7('0x2d')](_0x135466);});})['then'](function(_0x758e00){logger[_0x56f7('0xe')](_0x56f7('0x1f'),_0x129892);if(_0x758e00[_0x56f7('0x29')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x758e00[0x0][_0x56f7('0x2e')]['id'],_0x758e00[0x0]['dataValues']['ContactId'],_0x758e00[0x0][_0x56f7('0x2e')][_0x56f7('0x2f')]);}logger['debug']('GetContactDialer',_0x129892,JSON[_0x56f7('0x11')](_0x758e00));_0x1bc07e(_0x758e00);})[_0x56f7('0x12')](function(_0x8a8e04){logger[_0x56f7('0x18')](_0x56f7('0x1f'),_0x8a8e04[_0x56f7('0x13')],_0x129892);_0x303c32(_0x543939['error'](0x1f4,_0x8a8e04['message']));});});});};exports[_0x56f7('0x30')]=function(_0x394ab8){var _0x154ae6=this;return new Promise(function(_0x774c3a,_0x352740){return db[_0x56f7('0x22')][_0x56f7('0x31')](function(_0x582fef){return db[_0x56f7('0x32')][_0x56f7('0x33')](_0x394ab8[_0x56f7('0x1c')],{'raw':_0x394ab8[_0x56f7('0x7')]?_0x394ab8[_0x56f7('0x7')][_0x56f7('0x17')]===undefined?!![]:![]:!![],'transaction':_0x582fef})['then'](function(){logger['info'](_0x56f7('0x34'),JSON[_0x56f7('0x11')](_0x394ab8['options'][_0x56f7('0x1d')]),_0x394ab8[_0x56f7('0x7')]['where'][_0x56f7('0x2f')]);return db[_0x56f7('0x15')][_0x56f7('0x35')]({'where':_0x394ab8[_0x56f7('0x7')]?_0x394ab8[_0x56f7('0x7')][_0x56f7('0x1d')]||null:null,'transaction':_0x582fef});});})[_0x56f7('0xd')](function(_0x225d18){logger['info'](_0x56f7('0x30'),_0x394ab8);logger[_0x56f7('0x10')](_0x56f7('0x30'),_0x394ab8,JSON['stringify'](_0x225d18));_0x774c3a(_0x225d18);})[_0x56f7('0x12')](function(_0x540581){logger[_0x56f7('0x18')](_0x56f7('0x30'),_0x540581[_0x56f7('0x13')],_0x394ab8);_0x352740(_0x154ae6[_0x56f7('0x18')](0x1f4,_0x540581[_0x56f7('0x13')]));});});};exports[_0x56f7('0x36')]=function(_0x47a657){var _0x3c7139=this;return new Promise(function(_0xdb8bce,_0x37da8b){return db['CmHopper'][_0x56f7('0x23')]({'raw':_0x47a657[_0x56f7('0x7')]?_0x47a657[_0x56f7('0x7')][_0x56f7('0x17')]===undefined?!![]:![]:!![],'where':_0x47a657['options']?_0x47a657[_0x56f7('0x7')][_0x56f7('0x1d')]||null:null,'attributes':[[db[_0x56f7('0x22')]['fn'](_0x56f7('0x37'),db[_0x56f7('0x22')]['fn']('IF',db[_0x56f7('0x22')][_0x56f7('0x38')]('`scheduledat`\x20>=\x20'+util[_0x56f7('0x39')](_0x56f7('0x3a'),moment()[_0x56f7('0x39')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x56f7('0x3b')))),_0x56f7('0x3c')]]})[_0x56f7('0xd')](function(_0x336656){logger[_0x56f7('0xe')](_0x56f7('0x36'),_0x47a657);logger[_0x56f7('0x10')](_0x56f7('0x36'),_0x47a657,JSON[_0x56f7('0x11')](_0x336656));_0xdb8bce(_0x336656);})[_0x56f7('0x12')](function(_0x5ce35a){logger[_0x56f7('0x18')](_0x56f7('0x36'),_0x5ce35a[_0x56f7('0x13')],_0x47a657);_0x37da8b(_0x3c7139[_0x56f7('0x18')](0x1f4,_0x5ce35a['message']));});});};exports[_0x56f7('0x3d')]=function(_0x11f21f){var _0x3e1ab1=this;return new Promise(function(_0xd88e00,_0x422a8d){return db['CmContact'][_0x56f7('0x21')]()[_0x56f7('0xd')](function(){return db['sequelize'][_0x56f7('0x31')](function(_0x3d6e23){return db[_0x56f7('0x15')][_0x56f7('0x23')]({'where':_0x11f21f['options']?_0x11f21f[_0x56f7('0x7')][_0x56f7('0x1d')]||null:null,'attributes':_0x11f21f[_0x56f7('0x7')]?_0x11f21f['options']['attributes']||null:null,'limit':0x1,'order':_0x11f21f[_0x56f7('0x7')]?_0x11f21f[_0x56f7('0x7')]['order']||null:null,'group':db[_0x56f7('0x15')][_0x56f7('0x2a')],'transaction':_0x3d6e23,'lock':_0x3d6e23[_0x56f7('0x3e')][_0x56f7('0x3f')],'include':_0x11f21f[_0x56f7('0x7')]?_0x11f21f[_0x56f7('0x7')][_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x11f21f['options'][_0x56f7('0xa')],function(_0x19b437){return{'model':db[_0x19b437['model']],'as':_0x19b437['as'],'attributes':_0x19b437['attributes'],'include':_0x19b437[_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x19b437[_0x56f7('0xa')],function(_0x47ecda){return{'model':db[_0x47ecda['model']],'as':_0x47ecda['as'],'attributes':_0x47ecda[_0x56f7('0x8')],'include':_0x47ecda[_0x56f7('0xa')]?_['map'](_0x47ecda['include'],function(_0x5f0a0c){return{'model':db[_0x5f0a0c[_0x56f7('0xc')]],'as':_0x5f0a0c['as'],'attributes':_0x5f0a0c[_0x56f7('0x8')]};}):[]};}):[]};}):[]:[]})[_0x56f7('0xd')](function(_0x2d925b){var _0x5156c1=[];for(var _0x227b56=0x0;_0x227b56<_0x2d925b[_0x56f7('0x29')];_0x227b56+=0x1){_0x5156c1[_0x56f7('0x2b')](_0x2d925b[_0x227b56]['update'](_0x11f21f[_0x56f7('0x1c')],{'transaction':_0x3d6e23}));}return BPromise[_0x56f7('0x2d')](_0x5156c1);});})[_0x56f7('0xd')](function(_0x462c8a){logger[_0x56f7('0xe')](_0x56f7('0x3d'),_0x11f21f);logger[_0x56f7('0x10')](_0x56f7('0x3d'),_0x11f21f,JSON[_0x56f7('0x11')](_0x462c8a));_0xd88e00(_0x462c8a);})['catch'](function(_0x396cc7){logger[_0x56f7('0x18')]('GetContactRecallMe',_0x396cc7['message'],_0x11f21f);_0x422a8d(_0x3e1ab1[_0x56f7('0x18')](0x1f4,_0x396cc7['message']));});});});};exports[_0x56f7('0x40')]=function(_0x24cbe8){var _0xd0495f=this;return new Promise(function(_0x55442b,_0x14bd22){db[_0x56f7('0x20')][_0x56f7('0x21')]()['then'](function(_0x1c091f){return db[_0x56f7('0x15')]['findAll']({'raw':_0x24cbe8[_0x56f7('0x7')]?_0x24cbe8['options']['raw']===undefined?!![]:![]:!![],'where':_0x24cbe8[_0x56f7('0x7')]?_0x24cbe8[_0x56f7('0x7')][_0x56f7('0x1d')]||null:null,'attributes':_0x24cbe8[_0x56f7('0x7')]?_0x24cbe8[_0x56f7('0x7')]['attributes']||null:null,'limit':_0x24cbe8[_0x56f7('0x7')]?_0x24cbe8[_0x56f7('0x7')][_0x56f7('0x9')]||null:null,'include':_0x24cbe8[_0x56f7('0x7')]?_0x24cbe8['options']['include']?_[_0x56f7('0xb')](_0x24cbe8[_0x56f7('0x7')]['include'],function(_0x453063){return{'model':db[_0x453063[_0x56f7('0xc')]],'as':_0x453063['as'],'attributes':_0x453063['as']===_0x56f7('0x25')?_[_0x56f7('0x41')](_0x1c091f):_0x453063[_0x56f7('0x8')],'include':_0x453063[_0x56f7('0xa')]?_['map'](_0x453063[_0x56f7('0xa')],function(_0x57c300){return{'model':db[_0x57c300[_0x56f7('0xc')]],'as':_0x57c300['as'],'attributes':_0x57c300[_0x56f7('0x8')],'include':_0x57c300[_0x56f7('0xa')]?_[_0x56f7('0xb')](_0x57c300[_0x56f7('0xa')],function(_0x4aa804){return{'model':db[_0x4aa804[_0x56f7('0xc')]],'as':_0x4aa804['as'],'attributes':_0x4aa804[_0x56f7('0x8')]};}):[]};}):[]};}):[]:[]})[_0x56f7('0xd')](function(_0x2e1e6b){logger[_0x56f7('0xe')](_0x56f7('0xf'),_0x24cbe8);logger[_0x56f7('0x10')](_0x56f7('0xf'),_0x24cbe8,JSON['stringify'](_0x2e1e6b));_0x55442b(_0x2e1e6b);})[_0x56f7('0x12')](function(_0x538863){logger[_0x56f7('0x18')]('GetCmHopper',_0x538863[_0x56f7('0x13')],_0x24cbe8);_0x14bd22(_0xd0495f[_0x56f7('0x18')](0x1f4,_0x538863[_0x56f7('0x13')]));});});});};exports[_0x56f7('0x42')]=function(_0x13085c){var _0x533786=this;return new Promise(function(_0x4efc5a,_0x46fe8b){return db[_0x56f7('0x20')][_0x56f7('0x43')]({'raw':!![],'where':{'phone':_0x13085c['options'][_0x56f7('0x1d')][_0x56f7('0x44')]},'attributes':['id','dialTimezone'],'order':[['id',_0x56f7('0x45')]]})[_0x56f7('0xd')](function(_0x10e320){logger[_0x56f7('0xe')]('getContactByPhone',_0x13085c);logger[_0x56f7('0x10')]('getContactByPhone',_0x13085c,JSON[_0x56f7('0x11')](_0x10e320));_0x4efc5a(_0x10e320);})[_0x56f7('0x12')](function(_0x1d060d){logger['error'](_0x56f7('0x46'),_0x1d060d[_0x56f7('0x13')],_0x13085c);_0x46fe8b(_0x533786['error'](0x1f4,_0x1d060d[_0x56f7('0x13')]));});});};exports[_0x56f7('0x47')]=function(_0x2c2a96){var _0x395c37=this;return new Promise(function(_0x2bdaf1,_0x35de00){return db[_0x56f7('0x22')][_0x56f7('0x31')](function(_0xf18236){var _0x4a21d6=_0x2c2a96[_0x56f7('0x7')]&&_0x2c2a96[_0x56f7('0x7')][_0x56f7('0x1d')]?_0x2c2a96[_0x56f7('0x7')][_0x56f7('0x1d')]:{};return db[_0x56f7('0x15')][_0x56f7('0x1b')](_0x2c2a96[_0x56f7('0x1c')],{'where':_0x4a21d6,'transaction':_0xf18236})['then'](function(_0xb1de49){logger['info'](_0x56f7('0x47'),_0x2c2a96);logger[_0x56f7('0x10')](_0x56f7('0x47'),_0x2c2a96,JSON[_0x56f7('0x11')](_0xb1de49));_0x2bdaf1(_0xb1de49);})[_0x56f7('0x12')](function(_0x1e74d2){logger[_0x56f7('0x18')](_0x56f7('0x47'),_0x1e74d2['message'],_0x2c2a96);_0x35de00(_0x395c37[_0x56f7('0x18')](0x1f4,_0x1e74d2[_0x56f7('0x13')]));});});});};exports[_0x56f7('0x48')]=function(_0x358715){var _0x32a588=this;var _0x3a9c89=_0x358715['body'][_0x56f7('0x1d')]['voiceQueueIds'];var _0x10ca03=_0x358715[_0x56f7('0x1c')]['where'][_0x56f7('0x49')];var _0x4e9060=_0x358715[_0x56f7('0x1c')][_0x56f7('0x1d')]['availableAgentsIds'];return new Promise(function(_0x217bc5,_0x27057a){return db[_0x56f7('0x15')]['findAll']({'where':{'voiceQueueId':{'$in':_0x3a9c89},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x56f7('0x22')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x10ca03+_0x56f7('0x4a')),'$gt':db[_0x56f7('0x22')][_0x56f7('0x38')](_0x56f7('0x4b'))}},'UserId':{'$in':_0x4e9060}},'include':[{'model':db['CmContact'],'as':_0x56f7('0x25')},{'model':db[_0x56f7('0x26')],'as':_0x56f7('0x27'),'attributes':['id',_0x56f7('0x4c'),_0x56f7('0x28')]},{'model':db['CmList'],'as':_0x56f7('0x4d')}]})['then'](function(_0x37f0df){if(_0x37f0df[_0x56f7('0x29')]>0x0){return db['sequelize'][_0x56f7('0x31')](function(_0x32894c){return db[_0x56f7('0x15')]['update']({'recallmeNotifiedDate':db[_0x56f7('0x22')][_0x56f7('0x38')](_0x56f7('0x4b'))},{'where':{'id':{'$in':_[_0x56f7('0xb')](_0x37f0df,'id')}},'transaction':_0x32894c})[_0x56f7('0xd')](function(){_0x217bc5(_0x37f0df);})[_0x56f7('0x12')](function(_0x2557f6){logger[_0x56f7('0x18')](_0x56f7('0x48'),_0x2557f6[_0x56f7('0x13')],_0x358715);_0x27057a(_0x32a588[_0x56f7('0x18')](0x1f4,_0x2557f6[_0x56f7('0x13')]));});})[_0x56f7('0x12')](function(_0x28d0ae){logger['error'](_0x56f7('0x48'),_0x28d0ae[_0x56f7('0x13')],_0x358715);_0x27057a(_0x32a588[_0x56f7('0x18')](0x1f4,_0x28d0ae[_0x56f7('0x13')]));});}else{_0x217bc5(_0x37f0df);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index f67a394..7749f53 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 _0x17d9=['get','isAuthenticated','index','/describe','describe','/opencontacts','/timezones','getTimezones','/:id/previewrecall','post','/preview','getPreview','/timezone','getTimezone','put','/:id','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller'];(function(_0x2000c2,_0x5ea419){var _0x2c7711=function(_0x32811f){while(--_0x32811f){_0x2000c2['push'](_0x2000c2['shift']());}};_0x2c7711(++_0x5ea419);}(_0x17d9,0x1f4));var _0x917d=function(_0x593752,_0xfc3827){_0x593752=_0x593752-0x0;var _0x4612be=_0x17d9[_0x593752];return _0x4612be;};'use strict';var express=require(_0x917d('0x0'));var router=express[_0x917d('0x1')]();var auth=require(_0x917d('0x2'));var controller=require(_0x917d('0x3'));router[_0x917d('0x4')]('/',auth[_0x917d('0x5')](),controller[_0x917d('0x6')]);router[_0x917d('0x4')](_0x917d('0x7'),auth[_0x917d('0x5')](),controller[_0x917d('0x8')]);router[_0x917d('0x4')](_0x917d('0x9'),auth[_0x917d('0x5')](),controller['getOpenContacts']);router[_0x917d('0x4')](_0x917d('0xa'),auth[_0x917d('0x5')](),controller[_0x917d('0xb')]);router[_0x917d('0x4')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x917d('0x4')](_0x917d('0xc'),auth[_0x917d('0x5')](),controller['getPreviewRecall']);router['post']('/',auth[_0x917d('0x5')](),controller['create']);router[_0x917d('0xd')](_0x917d('0xe'),auth[_0x917d('0x5')](),controller[_0x917d('0xf')]);router[_0x917d('0xd')](_0x917d('0x10'),auth[_0x917d('0x5')](),controller[_0x917d('0x11')]);router[_0x917d('0x12')](_0x917d('0x13'),auth[_0x917d('0x5')](),controller[_0x917d('0x14')]);router[_0x917d('0x15')](_0x917d('0x13'),auth[_0x917d('0x5')](),controller[_0x917d('0x16')]);module[_0x917d('0x17')]=router; \ No newline at end of file +var _0x57a1=['create','/preview','getPreview','/timezone','getTimezone','put','update','delete','destroy','express','Router','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','getPreviewRecall','post'];(function(_0x4fa291,_0x56e289){var _0x506d9b=function(_0x24c31f){while(--_0x24c31f){_0x4fa291['push'](_0x4fa291['shift']());}};_0x506d9b(++_0x56e289);}(_0x57a1,0x159));var _0x157a=function(_0x5dbc6a,_0x55c7c6){_0x5dbc6a=_0x5dbc6a-0x0;var _0x33c9c7=_0x57a1[_0x5dbc6a];return _0x33c9c7;};'use strict';var express=require(_0x157a('0x0'));var router=express[_0x157a('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x157a('0x2'));router[_0x157a('0x3')]('/',auth[_0x157a('0x4')](),controller[_0x157a('0x5')]);router['get']('/describe',auth[_0x157a('0x4')](),controller[_0x157a('0x6')]);router[_0x157a('0x3')](_0x157a('0x7'),auth[_0x157a('0x4')](),controller[_0x157a('0x8')]);router['get'](_0x157a('0x9'),auth[_0x157a('0x4')](),controller[_0x157a('0xa')]);router[_0x157a('0x3')](_0x157a('0xb'),auth['isAuthenticated'](),controller[_0x157a('0xc')]);router[_0x157a('0x3')]('/:id/previewrecall',auth[_0x157a('0x4')](),controller[_0x157a('0xd')]);router[_0x157a('0xe')]('/',auth[_0x157a('0x4')](),controller[_0x157a('0xf')]);router[_0x157a('0xe')](_0x157a('0x10'),auth['isAuthenticated'](),controller[_0x157a('0x11')]);router[_0x157a('0xe')](_0x157a('0x12'),auth[_0x157a('0x4')](),controller[_0x157a('0x13')]);router[_0x157a('0x14')](_0x157a('0xb'),auth[_0x157a('0x4')](),controller[_0x157a('0x15')]);router[_0x157a('0x16')]('/:id',auth[_0x157a('0x4')](),controller[_0x157a('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 11ce892..82107ad 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x130c=['moment','sequelize','INTEGER','STRING','DATE'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x130c,0x136));var _0xc130=function(_0x171a8b,_0x3e6f46){_0x171a8b=_0x171a8b-0x0;var _0x1124c0=_0x130c[_0x171a8b];return _0x1124c0;};'use strict';var moment=require(_0xc130('0x0'));var Sequelize=require(_0xc130('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xc130('0x2')]},'phone':{'type':Sequelize[_0xc130('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xc130('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xc130('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc130('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xc130('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc130('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc130('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc130('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc540=['sequelize','exports','STRING','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x25949d,_0x49889d){var _0x321fac=function(_0x345e70){while(--_0x345e70){_0x25949d['push'](_0x25949d['shift']());}};_0x321fac(++_0x49889d);}(_0xc540,0x150));var _0x0c54=function(_0x4007e7,_0x4d6055){_0x4007e7=_0x4007e7-0x0;var _0x24eb90=_0xc540[_0x4007e7];return _0x24eb90;};'use strict';var moment=require('moment');var Sequelize=require(_0x0c54('0x0'));module[_0x0c54('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x0c54('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x0c54('0x4')],'defaultValue':moment()[_0x0c54('0x5')](_0x0c54('0x6'))},'countbusyretry':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0c54('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 928b2ea..9c91573 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6a1=['order','sort','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','reject','update','then','destroy','get','UserProfileResource','end','name','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0xf6a1,0x1ec));var _0x1f6a=function(_0x16e08b,_0x3b8862){_0x16e08b=_0x16e08b-0x0;var _0xeb39f4=_0xf6a1[_0x16e08b];return _0xeb39f4;};'use strict';var emlformat=require(_0x1f6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f6a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f6a('0x2'));var moment=require(_0x1f6a('0x3'));var BPromise=require(_0x1f6a('0x4'));var Mustache=require('mustache');var util=require(_0x1f6a('0x5'));var path=require('path');var sox=require(_0x1f6a('0x6'));var csv=require('to-csv');var ejs=require(_0x1f6a('0x7'));var fs=require('fs');var fs_extra=require(_0x1f6a('0x8'));var _=require(_0x1f6a('0x9'));var squel=require(_0x1f6a('0xa'));var crypto=require('crypto');var jsforce=require(_0x1f6a('0xb'));var deskjs=require(_0x1f6a('0xc'));var toCsv=require(_0x1f6a('0xd'));var querystring=require(_0x1f6a('0xe'));var Papa=require(_0x1f6a('0xf'));var Redis=require(_0x1f6a('0x10'));var authService=require(_0x1f6a('0x11'));var qs=require(_0x1f6a('0x12'));var as=require(_0x1f6a('0x13'));var hardwareService=require(_0x1f6a('0x14'));var logger=require(_0x1f6a('0x15'))(_0x1f6a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1f6a('0x17'));var db=require(_0x1f6a('0x18'))['db'];function respondWithStatusCode(_0x4b581e,_0x783407){_0x783407=_0x783407||0xcc;return function(_0x43e69e){if(_0x43e69e){return _0x4b581e[_0x1f6a('0x19')](_0x783407);}return _0x4b581e[_0x1f6a('0x1a')](_0x783407)['end']();};}function respondWithResult(_0x29ed91,_0x12e42b){_0x12e42b=_0x12e42b||0xc8;return function(_0x1038cd){if(_0x1038cd){return _0x29ed91[_0x1f6a('0x1a')](_0x12e42b)[_0x1f6a('0x1b')](_0x1038cd);}};}function respondWithFilteredResult(_0x436a0f,_0x3c86d2){return function(_0x18dbca){if(_0x18dbca){var _0x4234b0=typeof _0x3c86d2[_0x1f6a('0x1c')]===_0x1f6a('0x1d')&&typeof _0x3c86d2[_0x1f6a('0x1e')]==='undefined';var _0x419614=_0x18dbca['count'];var _0x41e0f1=_0x4234b0?0x0:_0x3c86d2[_0x1f6a('0x1c')];var _0x15e18d=_0x4234b0?_0x18dbca[_0x1f6a('0x1f')]:_0x3c86d2['offset']+_0x3c86d2[_0x1f6a('0x1e')];var _0x2ecb58;if(_0x15e18d>=_0x419614){_0x15e18d=_0x419614;_0x2ecb58=0xc8;}else{_0x2ecb58=0xce;}_0x436a0f['status'](_0x2ecb58);return _0x436a0f['set']('Content-Range',_0x41e0f1+'-'+_0x15e18d+'/'+_0x419614)[_0x1f6a('0x1b')](_0x18dbca);}return null;};}function patchUpdates(_0x40df70){return function(_0x52e9d0){try{jsonpatch['apply'](_0x52e9d0,_0x40df70,!![]);}catch(_0x2726ef){return BPromise[_0x1f6a('0x20')](_0x2726ef);}return _0x52e9d0['save']();};}function saveUpdates(_0x2c61f8,_0x1b5491){return function(_0x43e377){if(_0x43e377){return _0x43e377[_0x1f6a('0x21')](_0x2c61f8)[_0x1f6a('0x22')](function(_0x1830fe){return _0x1830fe;});}return null;};}function removeEntity(_0x8f7106,_0x3d356a){return function(_0x2e15e6){if(_0x2e15e6){return _0x2e15e6[_0x1f6a('0x23')]()[_0x1f6a('0x22')](function(){var _0x228dc2=_0x2e15e6[_0x1f6a('0x24')]({'plain':!![]});var _0x3414ab='CmHopperAdditionalPhones';return db[_0x1f6a('0x25')]['destroy']({'where':{'type':_0x3414ab,'resourceId':_0x228dc2['id']}})[_0x1f6a('0x22')](function(){return _0x2e15e6;});})[_0x1f6a('0x22')](function(){_0x8f7106['status'](0xcc)[_0x1f6a('0x26')]();});}};}function handleEntityNotFound(_0x72f7c7,_0x205869){return function(_0x5788a0){if(!_0x5788a0){_0x72f7c7[_0x1f6a('0x19')](0x194);}return _0x5788a0;};}function handleError(_0x4e4831,_0x17f64b){_0x17f64b=_0x17f64b||0x1f4;return function(_0x5b04e4){logger['error'](_0x5b04e4['stack']);if(_0x5b04e4['name']){delete _0x5b04e4[_0x1f6a('0x27')];}_0x4e4831[_0x1f6a('0x1a')](_0x17f64b)['send'](_0x5b04e4);};}exports[_0x1f6a('0x28')]=function(_0x55118d,_0x1f7c12){var _0x124e99={},_0x16a375={},_0x198077={'count':0x0,'rows':[]};var _0x1b1cac=_[_0x1f6a('0x29')](db[_0x1f6a('0x2a')][_0x1f6a('0x2b')],function(_0xfe8250){return{'name':_0xfe8250['fieldName'],'type':_0xfe8250[_0x1f6a('0x2c')][_0x1f6a('0x2d')]};});_0x16a375[_0x1f6a('0x2e')]=_[_0x1f6a('0x29')](_0x1b1cac,_0x1f6a('0x27'));_0x16a375[_0x1f6a('0x2f')]=_['keys'](_0x55118d['query']);_0x16a375[_0x1f6a('0x30')]=_[_0x1f6a('0x31')](_0x16a375[_0x1f6a('0x2e')],_0x16a375[_0x1f6a('0x2f')]);_0x124e99[_0x1f6a('0x32')]=_[_0x1f6a('0x31')](_0x16a375[_0x1f6a('0x2e')],qs[_0x1f6a('0x33')](_0x55118d['query'][_0x1f6a('0x33')]));_0x124e99[_0x1f6a('0x32')]=_0x124e99[_0x1f6a('0x32')]['length']?_0x124e99[_0x1f6a('0x32')]:_0x16a375[_0x1f6a('0x2e')];if(!_0x55118d[_0x1f6a('0x2f')][_0x1f6a('0x34')](_0x1f6a('0x35'))){_0x124e99[_0x1f6a('0x1e')]=qs[_0x1f6a('0x1e')](_0x55118d['query'][_0x1f6a('0x1e')]);_0x124e99[_0x1f6a('0x1c')]=qs[_0x1f6a('0x1c')](_0x55118d['query']['offset']);}_0x124e99[_0x1f6a('0x36')]=qs[_0x1f6a('0x37')](_0x55118d[_0x1f6a('0x2f')][_0x1f6a('0x37')]);_0x124e99['where']=qs['filters'](_['pick'](_0x55118d['query'],_0x16a375[_0x1f6a('0x30')]),_0x1b1cac);if(_0x55118d[_0x1f6a('0x2f')][_0x1f6a('0x38')]){_0x124e99[_0x1f6a('0x39')]=_[_0x1f6a('0x3a')](_0x124e99['where'],{'$or':_[_0x1f6a('0x29')](_0x1b1cac,function(_0x229a71){if(_0x229a71[_0x1f6a('0x2c')]!==_0x1f6a('0x3b')){var _0x2cd257={};_0x2cd257[_0x229a71[_0x1f6a('0x27')]]={'$like':'%'+_0x55118d[_0x1f6a('0x2f')][_0x1f6a('0x38')]+'%'};return _0x2cd257;}})});}_0x124e99=_['merge']({},_0x124e99,_0x55118d['options']);var _0x2ff3ba={'where':_0x124e99[_0x1f6a('0x39')]};return db[_0x1f6a('0x2a')][_0x1f6a('0x1f')](_0x2ff3ba)[_0x1f6a('0x22')](function(_0xce163d){_0x198077['count']=_0xce163d;if(_0x55118d['query'][_0x1f6a('0x3c')]){_0x124e99[_0x1f6a('0x3d')]=[{'all':!![]}];}return db[_0x1f6a('0x2a')]['findAll'](_0x124e99);})[_0x1f6a('0x22')](function(_0x26696c){_0x198077[_0x1f6a('0x3e')]=_0x26696c;return _0x198077;})[_0x1f6a('0x22')](respondWithFilteredResult(_0x1f7c12,_0x124e99))[_0x1f6a('0x3f')](handleError(_0x1f7c12,null));};exports['show']=function(_0x5d2dd6,_0x739ef0){var _0x399fa5={'raw':!![],'where':{'id':_0x5d2dd6[_0x1f6a('0x40')]['id']}},_0x2e5f07={};_0x2e5f07[_0x1f6a('0x2e')]=_['keys'](db[_0x1f6a('0x2a')][_0x1f6a('0x2b')]);_0x2e5f07[_0x1f6a('0x2f')]=_['keys'](_0x5d2dd6[_0x1f6a('0x2f')]);_0x2e5f07['filters']=_[_0x1f6a('0x31')](_0x2e5f07['model'],_0x2e5f07['query']);_0x399fa5[_0x1f6a('0x32')]=_[_0x1f6a('0x31')](_0x2e5f07['model'],qs[_0x1f6a('0x33')](_0x5d2dd6[_0x1f6a('0x2f')]['fields']));_0x399fa5[_0x1f6a('0x32')]=_0x399fa5[_0x1f6a('0x32')][_0x1f6a('0x41')]?_0x399fa5['attributes']:_0x2e5f07['model'];if(_0x5d2dd6['query'][_0x1f6a('0x3c')]){_0x399fa5['include']=[{'all':!![]}];}_0x399fa5=_[_0x1f6a('0x3a')]({},_0x399fa5,_0x5d2dd6[_0x1f6a('0x42')]);return db[_0x1f6a('0x2a')][_0x1f6a('0x43')](_0x399fa5)[_0x1f6a('0x22')](handleEntityNotFound(_0x739ef0,null))[_0x1f6a('0x22')](respondWithResult(_0x739ef0,null))[_0x1f6a('0x3f')](handleError(_0x739ef0,null));};exports[_0x1f6a('0x44')]=function(_0x167727,_0x31eebf){return db['CmHopperAdditionalPhone']['create'](_0x167727[_0x1f6a('0x45')],{})[_0x1f6a('0x22')](function(_0x223159){var _0x4068ec=_0x167727[_0x1f6a('0x46')]['get']({'plain':!![]});if(!_0x4068ec)throw new Error(_0x1f6a('0x47'));if(_0x4068ec[_0x1f6a('0x48')]===_0x1f6a('0x46')){var _0x47cac8=_0x223159[_0x1f6a('0x24')]({'plain':!![]});var _0x4a0d77=_0x1f6a('0x49');return db[_0x1f6a('0x4a')][_0x1f6a('0x43')]({'where':{'name':_0x4a0d77,'userProfileId':_0x4068ec['userProfileId']},'raw':!![]})[_0x1f6a('0x22')](function(_0x276594){if(_0x276594&&_0x276594[_0x1f6a('0x4b')]===0x0){return db[_0x1f6a('0x25')][_0x1f6a('0x44')]({'name':_0x47cac8[_0x1f6a('0x27')],'resourceId':_0x47cac8['id'],'type':_0x276594[_0x1f6a('0x27')],'sectionId':_0x276594['id']},{})[_0x1f6a('0x22')](function(){return _0x223159;});}else{return _0x223159;}})[_0x1f6a('0x3f')](function(_0x521d4c){logger[_0x1f6a('0x4c')](_0x1f6a('0x4d'),_0x521d4c);throw _0x521d4c;});}return _0x223159;})['then'](respondWithResult(_0x31eebf,0xc9))[_0x1f6a('0x3f')](handleError(_0x31eebf,null));};exports[_0x1f6a('0x21')]=function(_0x2960d6,_0x4020ab){if(_0x2960d6['body']['id']){delete _0x2960d6['body']['id'];}return db[_0x1f6a('0x2a')]['find']({'where':{'id':_0x2960d6['params']['id']}})[_0x1f6a('0x22')](handleEntityNotFound(_0x4020ab,null))[_0x1f6a('0x22')](saveUpdates(_0x2960d6['body'],null))[_0x1f6a('0x22')](respondWithResult(_0x4020ab,null))[_0x1f6a('0x3f')](handleError(_0x4020ab,null));};exports['destroy']=function(_0x483a65,_0x1397fe){return db[_0x1f6a('0x2a')]['find']({'where':{'id':_0x483a65[_0x1f6a('0x40')]['id']}})['then'](handleEntityNotFound(_0x1397fe,null))[_0x1f6a('0x22')](removeEntity(_0x1397fe,null))['catch'](handleError(_0x1397fe,null));}; \ No newline at end of file +var _0xfb86=['limit','count','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','sendStatus','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','status','json','offset','undefined'];(function(_0x557b09,_0x51faeb){var _0x10fd19=function(_0x10e707){while(--_0x10e707){_0x557b09['push'](_0x557b09['shift']());}};_0x10fd19(++_0x51faeb);}(_0xfb86,0x1c6));var _0x6fb8=function(_0x30dba7,_0x2fb710){_0x30dba7=_0x30dba7-0x0;var _0x1a9a83=_0xfb86[_0x30dba7];return _0x1a9a83;};'use strict';var emlformat=require(_0x6fb8('0x0'));var rimraf=require(_0x6fb8('0x1'));var zipdir=require(_0x6fb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6fb8('0x3'));var BPromise=require(_0x6fb8('0x4'));var Mustache=require(_0x6fb8('0x5'));var util=require(_0x6fb8('0x6'));var path=require(_0x6fb8('0x7'));var sox=require(_0x6fb8('0x8'));var csv=require(_0x6fb8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6fb8('0xa'));var _=require(_0x6fb8('0xb'));var squel=require(_0x6fb8('0xc'));var crypto=require(_0x6fb8('0xd'));var jsforce=require(_0x6fb8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6fb8('0x9'));var querystring=require('querystring');var Papa=require(_0x6fb8('0xf'));var Redis=require(_0x6fb8('0x10'));var authService=require(_0x6fb8('0x11'));var qs=require(_0x6fb8('0x12'));var as=require(_0x6fb8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6fb8('0x14'))(_0x6fb8('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43e8f0,_0x4b002c){_0x4b002c=_0x4b002c||0xcc;return function(_0x4d17af){if(_0x4d17af){return _0x43e8f0['sendStatus'](_0x4b002c);}return _0x43e8f0[_0x6fb8('0x16')](_0x4b002c)['end']();};}function respondWithResult(_0x4eb0e9,_0x5cd90c){_0x5cd90c=_0x5cd90c||0xc8;return function(_0x46e6c4){if(_0x46e6c4){return _0x4eb0e9['status'](_0x5cd90c)[_0x6fb8('0x17')](_0x46e6c4);}};}function respondWithFilteredResult(_0x563a1f,_0x436d90){return function(_0x1acfe9){if(_0x1acfe9){var _0x2b292e=typeof _0x436d90[_0x6fb8('0x18')]===_0x6fb8('0x19')&&typeof _0x436d90[_0x6fb8('0x1a')]===_0x6fb8('0x19');var _0x113884=_0x1acfe9[_0x6fb8('0x1b')];var _0x397a6d=_0x2b292e?0x0:_0x436d90[_0x6fb8('0x18')];var _0x4f3cb8=_0x2b292e?_0x1acfe9[_0x6fb8('0x1b')]:_0x436d90['offset']+_0x436d90[_0x6fb8('0x1a')];var _0x1ffcfb;if(_0x4f3cb8>=_0x113884){_0x4f3cb8=_0x113884;_0x1ffcfb=0xc8;}else{_0x1ffcfb=0xce;}_0x563a1f[_0x6fb8('0x16')](_0x1ffcfb);return _0x563a1f['set'](_0x6fb8('0x1c'),_0x397a6d+'-'+_0x4f3cb8+'/'+_0x113884)[_0x6fb8('0x17')](_0x1acfe9);}return null;};}function patchUpdates(_0xd2b4d){return function(_0x1bd9aa){try{jsonpatch[_0x6fb8('0x1d')](_0x1bd9aa,_0xd2b4d,!![]);}catch(_0x1b976f){return BPromise[_0x6fb8('0x1e')](_0x1b976f);}return _0x1bd9aa[_0x6fb8('0x1f')]();};}function saveUpdates(_0x4e74bc,_0x487204){return function(_0xc0e255){if(_0xc0e255){return _0xc0e255[_0x6fb8('0x20')](_0x4e74bc)[_0x6fb8('0x21')](function(_0x107f94){return _0x107f94;});}return null;};}function removeEntity(_0x3dea5d,_0x17cf86){return function(_0x2782b2){if(_0x2782b2){return _0x2782b2[_0x6fb8('0x22')]()[_0x6fb8('0x21')](function(){var _0x1850cd=_0x2782b2[_0x6fb8('0x23')]({'plain':!![]});var _0x5f01eb=_0x6fb8('0x24');return db[_0x6fb8('0x25')][_0x6fb8('0x22')]({'where':{'type':_0x5f01eb,'resourceId':_0x1850cd['id']}})[_0x6fb8('0x21')](function(){return _0x2782b2;});})[_0x6fb8('0x21')](function(){_0x3dea5d[_0x6fb8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49337a,_0x268b8f){return function(_0x16b3d3){if(!_0x16b3d3){_0x49337a[_0x6fb8('0x26')](0x194);}return _0x16b3d3;};}function handleError(_0x6be768,_0x107ce7){_0x107ce7=_0x107ce7||0x1f4;return function(_0xd8ef3b){logger['error'](_0xd8ef3b[_0x6fb8('0x27')]);if(_0xd8ef3b[_0x6fb8('0x28')]){delete _0xd8ef3b[_0x6fb8('0x28')];}_0x6be768[_0x6fb8('0x16')](_0x107ce7)[_0x6fb8('0x29')](_0xd8ef3b);};}exports[_0x6fb8('0x2a')]=function(_0x52c5ff,_0x58b5b8){var _0x268ac9={},_0x5342cc={},_0x41f932={'count':0x0,'rows':[]};var _0x749590=_[_0x6fb8('0x2b')](db[_0x6fb8('0x2c')][_0x6fb8('0x2d')],function(_0x4973f9){return{'name':_0x4973f9['fieldName'],'type':_0x4973f9[_0x6fb8('0x2e')][_0x6fb8('0x2f')]};});_0x5342cc['model']=_[_0x6fb8('0x2b')](_0x749590,_0x6fb8('0x28'));_0x5342cc[_0x6fb8('0x30')]=_['keys'](_0x52c5ff['query']);_0x5342cc[_0x6fb8('0x31')]=_['intersection'](_0x5342cc[_0x6fb8('0x32')],_0x5342cc['query']);_0x268ac9[_0x6fb8('0x33')]=_[_0x6fb8('0x34')](_0x5342cc[_0x6fb8('0x32')],qs[_0x6fb8('0x35')](_0x52c5ff[_0x6fb8('0x30')]['fields']));_0x268ac9[_0x6fb8('0x33')]=_0x268ac9[_0x6fb8('0x33')][_0x6fb8('0x36')]?_0x268ac9['attributes']:_0x5342cc['model'];if(!_0x52c5ff[_0x6fb8('0x30')][_0x6fb8('0x37')](_0x6fb8('0x38'))){_0x268ac9['limit']=qs[_0x6fb8('0x1a')](_0x52c5ff[_0x6fb8('0x30')][_0x6fb8('0x1a')]);_0x268ac9[_0x6fb8('0x18')]=qs['offset'](_0x52c5ff[_0x6fb8('0x30')][_0x6fb8('0x18')]);}_0x268ac9[_0x6fb8('0x39')]=qs[_0x6fb8('0x3a')](_0x52c5ff[_0x6fb8('0x30')][_0x6fb8('0x3a')]);_0x268ac9[_0x6fb8('0x3b')]=qs['filters'](_[_0x6fb8('0x3c')](_0x52c5ff[_0x6fb8('0x30')],_0x5342cc['filters']),_0x749590);if(_0x52c5ff['query'][_0x6fb8('0x3d')]){_0x268ac9[_0x6fb8('0x3b')]=_[_0x6fb8('0x3e')](_0x268ac9['where'],{'$or':_[_0x6fb8('0x2b')](_0x749590,function(_0x484677){if(_0x484677[_0x6fb8('0x2e')]!=='VIRTUAL'){var _0xca26e0={};_0xca26e0[_0x484677['name']]={'$like':'%'+_0x52c5ff[_0x6fb8('0x30')]['filter']+'%'};return _0xca26e0;}})});}_0x268ac9=_[_0x6fb8('0x3e')]({},_0x268ac9,_0x52c5ff[_0x6fb8('0x3f')]);var _0x215cee={'where':_0x268ac9[_0x6fb8('0x3b')]};return db[_0x6fb8('0x2c')][_0x6fb8('0x1b')](_0x215cee)[_0x6fb8('0x21')](function(_0x26249b){_0x41f932[_0x6fb8('0x1b')]=_0x26249b;if(_0x52c5ff[_0x6fb8('0x30')][_0x6fb8('0x40')]){_0x268ac9['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x268ac9);})[_0x6fb8('0x21')](function(_0x1136c7){_0x41f932[_0x6fb8('0x41')]=_0x1136c7;return _0x41f932;})[_0x6fb8('0x21')](respondWithFilteredResult(_0x58b5b8,_0x268ac9))[_0x6fb8('0x42')](handleError(_0x58b5b8,null));};exports['show']=function(_0x1f0649,_0x2a24c8){var _0x3d2b8e={'raw':!![],'where':{'id':_0x1f0649[_0x6fb8('0x43')]['id']}},_0x56d6b8={};_0x56d6b8['model']=_[_0x6fb8('0x44')](db[_0x6fb8('0x2c')][_0x6fb8('0x2d')]);_0x56d6b8['query']=_[_0x6fb8('0x44')](_0x1f0649[_0x6fb8('0x30')]);_0x56d6b8[_0x6fb8('0x31')]=_[_0x6fb8('0x34')](_0x56d6b8[_0x6fb8('0x32')],_0x56d6b8[_0x6fb8('0x30')]);_0x3d2b8e['attributes']=_[_0x6fb8('0x34')](_0x56d6b8[_0x6fb8('0x32')],qs[_0x6fb8('0x35')](_0x1f0649[_0x6fb8('0x30')]['fields']));_0x3d2b8e[_0x6fb8('0x33')]=_0x3d2b8e[_0x6fb8('0x33')]['length']?_0x3d2b8e[_0x6fb8('0x33')]:_0x56d6b8[_0x6fb8('0x32')];if(_0x1f0649[_0x6fb8('0x30')]['includeAll']){_0x3d2b8e[_0x6fb8('0x45')]=[{'all':!![]}];}_0x3d2b8e=_[_0x6fb8('0x3e')]({},_0x3d2b8e,_0x1f0649[_0x6fb8('0x3f')]);return db[_0x6fb8('0x2c')][_0x6fb8('0x46')](_0x3d2b8e)[_0x6fb8('0x21')](handleEntityNotFound(_0x2a24c8,null))['then'](respondWithResult(_0x2a24c8,null))['catch'](handleError(_0x2a24c8,null));};exports[_0x6fb8('0x47')]=function(_0x1bd2f0,_0x5107c0){return db[_0x6fb8('0x2c')][_0x6fb8('0x47')](_0x1bd2f0[_0x6fb8('0x48')],{})['then'](function(_0x1b76cb){var _0x4765ab=_0x1bd2f0[_0x6fb8('0x49')][_0x6fb8('0x23')]({'plain':!![]});if(!_0x4765ab)throw new Error(_0x6fb8('0x4a'));if(_0x4765ab['role']===_0x6fb8('0x49')){var _0xd47955=_0x1b76cb[_0x6fb8('0x23')]({'plain':!![]});var _0x52d9df=_0x6fb8('0x24');return db[_0x6fb8('0x4b')][_0x6fb8('0x46')]({'where':{'name':_0x52d9df,'userProfileId':_0x4765ab[_0x6fb8('0x4c')]},'raw':!![]})[_0x6fb8('0x21')](function(_0x2aef40){if(_0x2aef40&&_0x2aef40[_0x6fb8('0x4d')]===0x0){return db[_0x6fb8('0x25')][_0x6fb8('0x47')]({'name':_0xd47955[_0x6fb8('0x28')],'resourceId':_0xd47955['id'],'type':_0x2aef40[_0x6fb8('0x28')],'sectionId':_0x2aef40['id']},{})[_0x6fb8('0x21')](function(){return _0x1b76cb;});}else{return _0x1b76cb;}})[_0x6fb8('0x42')](function(_0x354ef6){logger[_0x6fb8('0x4e')](_0x6fb8('0x4f'),_0x354ef6);throw _0x354ef6;});}return _0x1b76cb;})[_0x6fb8('0x21')](respondWithResult(_0x5107c0,0xc9))[_0x6fb8('0x42')](handleError(_0x5107c0,null));};exports[_0x6fb8('0x20')]=function(_0x1ce626,_0x3e29b5){if(_0x1ce626[_0x6fb8('0x48')]['id']){delete _0x1ce626[_0x6fb8('0x48')]['id'];}return db[_0x6fb8('0x2c')][_0x6fb8('0x46')]({'where':{'id':_0x1ce626[_0x6fb8('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e29b5,null))['then'](saveUpdates(_0x1ce626[_0x6fb8('0x48')],null))[_0x6fb8('0x21')](respondWithResult(_0x3e29b5,null))[_0x6fb8('0x42')](handleError(_0x3e29b5,null));};exports[_0x6fb8('0x22')]=function(_0x3136e7,_0x10df32){return db['CmHopperAdditionalPhone'][_0x6fb8('0x46')]({'where':{'id':_0x3136e7[_0x6fb8('0x43')]['id']}})[_0x6fb8('0x21')](handleEntityNotFound(_0x10df32,null))[_0x6fb8('0x21')](removeEntity(_0x10df32,null))['catch'](handleError(_0x10df32,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index b13bb9e..3a3c66d 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x788c=['path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','lodash','util','../../config/logger','api','bluebird'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x788c,0x97));var _0xc788=function(_0x5e9d22,_0x515645){_0x5e9d22=_0x5e9d22-0x0;var _0x3286d9=_0x788c[_0x5e9d22];return _0x3286d9;};'use strict';var _=require(_0xc788('0x0'));var util=require(_0xc788('0x1'));var logger=require(_0xc788('0x2'))(_0xc788('0x3'));var moment=require('moment');var BPromise=require(_0xc788('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc788('0x5'));var rimraf=require(_0xc788('0x6'));var config=require(_0xc788('0x7'));var attributes=require(_0xc788('0x8'));module[_0xc788('0x9')]=function(_0x218112,_0x489f6f){return _0x218112[_0xc788('0xa')](_0xc788('0xb'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc01c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','util','../../config/logger','api'];(function(_0x25e7bc,_0x6c04a4){var _0x42ecf6=function(_0x5c47df){while(--_0x5c47df){_0x25e7bc['push'](_0x25e7bc['shift']());}};_0x42ecf6(++_0x6c04a4);}(_0xc01c,0x1dd));var _0xcc01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc01c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcc01('0x0'));var logger=require(_0xcc01('0x1'))(_0xcc01('0x2'));var moment=require(_0xcc01('0x3'));var BPromise=require(_0xcc01('0x4'));var rp=require(_0xcc01('0x5'));var fs=require('fs');var path=require(_0xcc01('0x6'));var rimraf=require(_0xcc01('0x7'));var config=require(_0xcc01('0x8'));var attributes=require(_0xcc01('0x9'));module[_0xcc01('0xa')]=function(_0x4f650e,_0x1d77cc){return _0x4f650e[_0xcc01('0xb')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index b41291f..208a740 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4556=['http','request','info','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','then','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','duration','waitTime','scheduledat','add','minutes','phone','isNil','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x3a53d9,_0x429bcf){var _0x483c41=function(_0x318af5){while(--_0x318af5){_0x3a53d9['push'](_0x3a53d9['shift']());}};_0x483c41(++_0x429bcf);}(_0x4556,0x152));var _0x6455=function(_0x78e96d,_0x446ca5){_0x78e96d=_0x78e96d-0x0;var _0x501296=_0x4556[_0x78e96d];return _0x501296;};'use strict';var _=require(_0x6455('0x0'));var util=require(_0x6455('0x1'));var moment=require('moment');var BPromise=require(_0x6455('0x2'));var rs=require(_0x6455('0x3'));var fs=require('fs');var Redis=require(_0x6455('0x4'));var db=require(_0x6455('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6455('0x6'))(_0x6455('0x7'));var config=require('../../config/environment');var jayson=require(_0x6455('0x8'));var client=jayson[_0x6455('0x9')][_0x6455('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e72c2,_0x1e4d1b,_0x5b523d){return new BPromise(function(_0x3cb6bc,_0x540f37){return client[_0x6455('0xb')](_0x3e72c2,_0x5b523d)['then'](function(_0x2fc835){logger[_0x6455('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1e4d1b,'request\x20sent');logger[_0x6455('0xd')](_0x6455('0xe'),_0x1e4d1b,'request\x20sent',JSON[_0x6455('0xf')](_0x2fc835));if(_0x2fc835['error']){if(_0x2fc835[_0x6455('0x10')]['code']===0x1f4){logger[_0x6455('0x10')](_0x6455('0x11'),_0x1e4d1b,_0x2fc835[_0x6455('0x10')][_0x6455('0x12')]);return _0x540f37(_0x2fc835['error']['message']);}logger[_0x6455('0x10')](_0x6455('0x11'),_0x1e4d1b,_0x2fc835['error'][_0x6455('0x12')]);return _0x3cb6bc(_0x2fc835[_0x6455('0x10')][_0x6455('0x12')]);}else{logger[_0x6455('0xc')](_0x6455('0x11'),_0x1e4d1b,'request\x20sent');_0x3cb6bc(_0x2fc835[_0x6455('0x13')]['message']);}})[_0x6455('0x14')](function(_0x127d50){logger[_0x6455('0x10')](_0x6455('0x11'),_0x1e4d1b,_0x127d50);_0x540f37(_0x127d50);});});}exports[_0x6455('0x15')]=function(_0x34086f){var _0x46ffce=this;return new Promise(function(_0x3de5a4,_0x3268ca){return db[_0x6455('0x16')][_0x6455('0x17')]({'raw':!![],'where':{'ContactId':_0x34086f['body'][_0x6455('0x18')],'ListId':_0x34086f[_0x6455('0x19')][_0x6455('0x1a')],'VoiceQueueId':_0x34086f[_0x6455('0x19')][_0x6455('0x1b')]===undefined?null:_0x34086f['body'][_0x6455('0x1b')],'CampaignId':_0x34086f['body']['CampaignId']===undefined?null:_0x34086f['body'][_0x6455('0x1c')]}})['then'](function(_0x3dc8d5){if(_0x3dc8d5!=null){return db['CmHopperAdditionalPhone'][_0x6455('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3dc8d5['id'],'OrderBy':{'$gt':_0x3dc8d5['OrderBy']}},'order':[[_0x6455('0x1d'),_0x6455('0x1e')]]})[_0x6455('0x1f')](function(_0x147b33){var _0x476ecf=0x0;if(_0x147b33){if(_0x147b33[_0x6455('0x20')]+_0x147b33[_0x6455('0x21')]+_0x147b33[_0x6455('0x22')]+_0x147b33[_0x6455('0x23')]+_0x147b33[_0x6455('0x24')]+_0x147b33[_0x6455('0x25')]+_0x147b33[_0x6455('0x26')]+_0x147b33[_0x6455('0x27')]<_0x34086f[_0x6455('0x28')][_0x6455('0x29')])_0x476ecf=0x1;_0x3de5a4({'additional':_0x476ecf});}else{return db[_0x6455('0x2a')][_0x6455('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3dc8d5['id']},'order':[[_0x6455('0x1d'),_0x6455('0x1e')]]})[_0x6455('0x1f')](function(_0x44731f){var _0x21946b=0x0;if(_0x44731f){if(_0x44731f['countbusyretry']+_0x44731f[_0x6455('0x21')]+_0x44731f[_0x6455('0x22')]+_0x44731f[_0x6455('0x23')]+_0x44731f[_0x6455('0x24')]+_0x44731f[_0x6455('0x25')]+_0x44731f[_0x6455('0x26')]+_0x44731f[_0x6455('0x27')]<_0x34086f[_0x6455('0x28')][_0x6455('0x29')])_0x21946b=0x1;_0x3de5a4({'additional':_0x21946b});}else{_0x3de5a4({'additional':0x0});}})[_0x6455('0x14')](function(_0x1663ed){logger['error'](_0x6455('0x15'),_0x1663ed[_0x6455('0x12')]);_0x3268ca(_0x46ffce[_0x6455('0x10')](0x1f4,_0x1663ed['message']));});}})[_0x6455('0x14')](function(_0x1e4606){logger[_0x6455('0x10')](_0x6455('0x15'),_0x1e4606['message']);_0x3268ca(_0x46ffce[_0x6455('0x10')](0x1f4,_0x1e4606[_0x6455('0x12')]));});}else _0x3de5a4({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x531a5f){var _0x530efd=this;return new Promise(function(_0x159b55,_0x4efd31){return db['CmHopper'][_0x6455('0x17')]({'raw':!![],'where':{'ContactId':_0x531a5f['body'][_0x6455('0x18')],'ListId':_0x531a5f['body'][_0x6455('0x1a')],'VoiceQueueId':_0x531a5f[_0x6455('0x19')][_0x6455('0x1b')]===undefined?null:_0x531a5f[_0x6455('0x19')]['VoiceQueueId'],'CampaignId':_0x531a5f[_0x6455('0x19')][_0x6455('0x1c')]===undefined?null:_0x531a5f[_0x6455('0x19')][_0x6455('0x1c')]}})[_0x6455('0x1f')](function(_0x26e49b){if(_0x26e49b!=null){return db[_0x6455('0x2a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x26e49b['id'],'OrderBy':{'$gte':_0x26e49b[_0x6455('0x1d')]}},'order':[['OrderBy',_0x6455('0x1e')]]})[_0x6455('0x1f')](function(_0x538ea2){if(_0x538ea2)return activateAdditionalPhone(_0x26e49b,_0x531a5f[_0x6455('0x19')],_0x538ea2,_0x531a5f[_0x6455('0x2b')],_0x531a5f[_0x6455('0x2c')])[_0x6455('0x1f')](function(_0x285b59){_0x159b55(_0x285b59);});else{return db[_0x6455('0x2a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x26e49b['id']},'order':[[_0x6455('0x1d'),'ASC']]})[_0x6455('0x1f')](function(_0x5de301){if(_0x5de301)return activateAdditionalPhone(_0x26e49b,_0x531a5f[_0x6455('0x19')],_0x5de301,_0x531a5f[_0x6455('0x2b')],_0x531a5f[_0x6455('0x2c')])['then'](function(_0x30f886){_0x159b55(_0x30f886);});else{_0x159b55({'id':_0x26e49b['id'],'phone':''});}})[_0x6455('0x14')](function(_0x7cf2f){logger['error'](_0x6455('0x15'),_0x7cf2f[_0x6455('0x12')]);_0x4efd31(_0x530efd['error'](0x1f4,_0x7cf2f['message']));});}})[_0x6455('0x14')](function(_0x5d1398){logger[_0x6455('0x10')](_0x6455('0x15'),_0x5d1398[_0x6455('0x12')]);_0x4efd31(_0x530efd[_0x6455('0x10')](0x1f4,_0x5d1398[_0x6455('0x12')]));});}else _0x159b55(0x1);});});};function activateAdditionalPhone(_0x22b5a4,_0x195b3f,_0x4e6a9d,_0xd68e65,_0x30bd22){return new Promise(function(_0x373d9e,_0x2b32fc){var _0x5cfd7f;if(_['isNil'](_0x4e6a9d[_0x6455('0x2d')])){_0x4e6a9d[_0x6455('0x2d')]=moment();}if(moment()>moment(_0x4e6a9d[_0x6455('0x2d')])){_0x5cfd7f=moment()[_0x6455('0x2e')](_0x30bd22||0x3,_0x6455('0x2f'));}else{if(_0x4e6a9d[_0x6455('0x1d')]==0x0){_0x5cfd7f=moment(_0x4e6a9d[_0x6455('0x2d')]);}else{_0x5cfd7f=moment()[_0x6455('0x2e')](_0x30bd22||0x3,_0x6455('0x2f'));}}if(_['isNil'](_0x5cfd7f)){_0x5cfd7f=moment()['add'](_0x30bd22||0x3,_0x6455('0x2f'));}var _0x39f4e1={'phone':_0x22b5a4[_0x6455('0x30')],'active':0x0,'OrderBy':_[_0x6455('0x31')](_0x22b5a4[_0x6455('0x1d')])?0x0:_0x22b5a4[_0x6455('0x1d')],'scheduledat':moment()[_0x6455('0x2e')](_0xd68e65||0x1,_0x6455('0x2f')),'countbusyretry':_0x195b3f[_0x6455('0x20')],'countcongestionretry':_0x195b3f[_0x6455('0x21')],'countnoanswerretry':_0x195b3f[_0x6455('0x22')],'countnosuchnumberretry':_0x195b3f[_0x6455('0x23')],'countdropretry':_0x195b3f[_0x6455('0x24')],'countabandonedretry':_0x195b3f[_0x6455('0x25')],'countmachineretry':_0x195b3f['countmachineretry'],'countagentrejectretry':_0x195b3f[_0x6455('0x27')],'createdAt':_0x195b3f[_0x6455('0x32')],'updatedAt':_0x195b3f[_0x6455('0x33')]};var _0x453df4={'CmHopperId':_0x22b5a4['id'],'phone':_0x4e6a9d[_0x6455('0x30')],'active':0x0,'OrderBy':_[_0x6455('0x31')](_0x4e6a9d[_0x6455('0x1d')])?0x0:_0x4e6a9d[_0x6455('0x1d')],'scheduledat':_0x5cfd7f,'countbusyretry':_0x4e6a9d[_0x6455('0x20')],'countcongestionretry':_0x4e6a9d[_0x6455('0x21')],'countnoanswerretry':_0x4e6a9d[_0x6455('0x22')],'countnosuchnumberretry':_0x4e6a9d['countnosuchnumberretry'],'countdropretry':_0x4e6a9d['countdropretry'],'countabandonedretry':_0x4e6a9d[_0x6455('0x25')],'countmachineretry':_0x4e6a9d[_0x6455('0x26')],'countagentrejectretry':_0x4e6a9d['countagentrejectretry'],'createdAt':_0x4e6a9d[_0x6455('0x32')],'updatedAt':_0x4e6a9d[_0x6455('0x33')]};return db[_0x6455('0x34')][_0x6455('0x35')](function(_0x40a5de){return db['CmHopperAdditionalPhone'][_0x6455('0x36')](_0x39f4e1,{'where':{'id':_0x4e6a9d['id']}},{'transaction':_0x40a5de})[_0x6455('0x1f')](function(){return db[_0x6455('0x16')][_0x6455('0x36')](_0x453df4,{'where':{'id':_0x22b5a4['id']}},{'transaction':_0x40a5de});});})[_0x6455('0x1f')](function(_0x4fa30c){_0x373d9e({'id':_0x22b5a4['id'],'phone':_0x4e6a9d[_0x6455('0x30')]});})['catch'](function(_0xec3dea){logger[_0x6455('0x10')](_0x6455('0x37'),_0xec3dea[_0x6455('0x12')]);_0x2b32fc({'error':_0xec3dea[_0x6455('0x12')]});});});}exports[_0x6455('0x38')]=function(_0x5deeb5){var _0x227556=this;return new Promise(function(_0x2386ad,_0x3e461a){return db[_0x6455('0x16')][_0x6455('0x36')](_0x5deeb5[_0x6455('0x19')][_0x6455('0x39')],{'where':{'id':_0x5deeb5['body']['id']}})[_0x6455('0x1f')](function(_0x18f173){_0x2386ad(_0x18f173);})[_0x6455('0x14')](function(_0x224afd){logger['error'](_0x6455('0x38'),_0x224afd[_0x6455('0x12')]);_0x3e461a(_0x227556[_0x6455('0x10')](0x1f4,_0x224afd['message']));});});}; \ No newline at end of file +var _0xaeea=['client','request','then','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','countnosuchnumberretry','countmachineretry','entity','waitTime','duration','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x50c7d6,_0x43aaed){var _0x4e1b11=function(_0x247a15){while(--_0x247a15){_0x50c7d6['push'](_0x50c7d6['shift']());}};_0x4e1b11(++_0x43aaed);}(_0xaeea,0x1bf));var _0xaaee=function(_0x595c9c,_0x281699){_0x595c9c=_0x595c9c-0x0;var _0x58e095=_0xaeea[_0x595c9c];return _0x58e095;};'use strict';var _=require('lodash');var util=require(_0xaaee('0x0'));var moment=require(_0xaaee('0x1'));var BPromise=require(_0xaaee('0x2'));var rs=require(_0xaaee('0x3'));var fs=require('fs');var Redis=require(_0xaaee('0x4'));var db=require(_0xaaee('0x5'))['db'];var utils=require(_0xaaee('0x6'));var logger=require('../../config/logger')(_0xaaee('0x7'));var config=require('../../config/environment');var jayson=require(_0xaaee('0x8'));var client=jayson[_0xaaee('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1eceb5,_0x37c7e7,_0x4f85bb){return new BPromise(function(_0x362558,_0xf9a1c0){return client[_0xaaee('0xa')](_0x1eceb5,_0x4f85bb)[_0xaaee('0xb')](function(_0x360856){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x37c7e7,_0xaaee('0xc'));logger['debug'](_0xaaee('0xd'),_0x37c7e7,_0xaaee('0xc'),JSON[_0xaaee('0xe')](_0x360856));if(_0x360856['error']){if(_0x360856[_0xaaee('0xf')][_0xaaee('0x10')]===0x1f4){logger[_0xaaee('0xf')](_0xaaee('0x11'),_0x37c7e7,_0x360856[_0xaaee('0xf')][_0xaaee('0x12')]);return _0xf9a1c0(_0x360856[_0xaaee('0xf')]['message']);}logger[_0xaaee('0xf')](_0xaaee('0x11'),_0x37c7e7,_0x360856[_0xaaee('0xf')]['message']);return _0x362558(_0x360856[_0xaaee('0xf')][_0xaaee('0x12')]);}else{logger[_0xaaee('0x13')](_0xaaee('0x11'),_0x37c7e7,'request\x20sent');_0x362558(_0x360856[_0xaaee('0x14')]['message']);}})[_0xaaee('0x15')](function(_0x21a250){logger[_0xaaee('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x37c7e7,_0x21a250);_0xf9a1c0(_0x21a250);});});}exports[_0xaaee('0x16')]=function(_0x2e1f21){var _0x38761f=this;return new Promise(function(_0x39ac37,_0x943caa){return db[_0xaaee('0x17')][_0xaaee('0x18')]({'raw':!![],'where':{'ContactId':_0x2e1f21[_0xaaee('0x19')][_0xaaee('0x1a')],'ListId':_0x2e1f21[_0xaaee('0x19')][_0xaaee('0x1b')],'VoiceQueueId':_0x2e1f21['body'][_0xaaee('0x1c')]===undefined?null:_0x2e1f21[_0xaaee('0x19')][_0xaaee('0x1c')],'CampaignId':_0x2e1f21[_0xaaee('0x19')][_0xaaee('0x1d')]===undefined?null:_0x2e1f21[_0xaaee('0x19')]['CampaignId']}})[_0xaaee('0xb')](function(_0x5308cb){if(_0x5308cb!=null){return db[_0xaaee('0x1e')][_0xaaee('0x18')]({'raw':!![],'where':{'CmHopperId':_0x5308cb['id'],'OrderBy':{'$gt':_0x5308cb[_0xaaee('0x1f')]}},'order':[['OrderBy',_0xaaee('0x20')]]})[_0xaaee('0xb')](function(_0x111683){var _0x3151a9=0x0;if(_0x111683){if(_0x111683[_0xaaee('0x21')]+_0x111683[_0xaaee('0x22')]+_0x111683[_0xaaee('0x23')]+_0x111683['countnosuchnumberretry']+_0x111683[_0xaaee('0x24')]+_0x111683[_0xaaee('0x25')]+_0x111683['countmachineretry']+_0x111683[_0xaaee('0x26')]<_0x2e1f21['entity'][_0xaaee('0x27')])_0x3151a9=0x1;_0x39ac37({'additional':_0x3151a9});}else{return db[_0xaaee('0x1e')][_0xaaee('0x18')]({'raw':!![],'where':{'CmHopperId':_0x5308cb['id']},'order':[[_0xaaee('0x1f'),_0xaaee('0x20')]]})[_0xaaee('0xb')](function(_0x2ff78f){var _0x5ea1a6=0x0;if(_0x2ff78f){if(_0x2ff78f[_0xaaee('0x21')]+_0x2ff78f['countcongestionretry']+_0x2ff78f[_0xaaee('0x23')]+_0x2ff78f[_0xaaee('0x28')]+_0x2ff78f[_0xaaee('0x24')]+_0x2ff78f['countabandonedretry']+_0x2ff78f[_0xaaee('0x29')]+_0x2ff78f[_0xaaee('0x26')]<_0x2e1f21[_0xaaee('0x2a')]['dialGlobalMaxRetry'])_0x5ea1a6=0x1;_0x39ac37({'additional':_0x5ea1a6});}else{_0x39ac37({'additional':0x0});}})[_0xaaee('0x15')](function(_0x7c118b){logger['error'](_0xaaee('0x16'),_0x7c118b['message']);_0x943caa(_0x38761f[_0xaaee('0xf')](0x1f4,_0x7c118b[_0xaaee('0x12')]));});}})[_0xaaee('0x15')](function(_0x579dcb){logger['error']('VerifyAdditionalPhones',_0x579dcb[_0xaaee('0x12')]);_0x943caa(_0x38761f[_0xaaee('0xf')](0x1f4,_0x579dcb[_0xaaee('0x12')]));});}else _0x39ac37({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0xbc6d4e){var _0x20ef27=this;return new Promise(function(_0x29950a,_0x505c83){return db[_0xaaee('0x17')][_0xaaee('0x18')]({'raw':!![],'where':{'ContactId':_0xbc6d4e[_0xaaee('0x19')][_0xaaee('0x1a')],'ListId':_0xbc6d4e['body'][_0xaaee('0x1b')],'VoiceQueueId':_0xbc6d4e['body'][_0xaaee('0x1c')]===undefined?null:_0xbc6d4e[_0xaaee('0x19')][_0xaaee('0x1c')],'CampaignId':_0xbc6d4e[_0xaaee('0x19')][_0xaaee('0x1d')]===undefined?null:_0xbc6d4e[_0xaaee('0x19')]['CampaignId']}})[_0xaaee('0xb')](function(_0x22d73c){if(_0x22d73c!=null){return db[_0xaaee('0x1e')][_0xaaee('0x18')]({'raw':!![],'where':{'CmHopperId':_0x22d73c['id'],'OrderBy':{'$gte':_0x22d73c['OrderBy']}},'order':[[_0xaaee('0x1f'),_0xaaee('0x20')]]})[_0xaaee('0xb')](function(_0x1c1d1a){if(_0x1c1d1a)return activateAdditionalPhone(_0x22d73c,_0xbc6d4e[_0xaaee('0x19')],_0x1c1d1a,_0xbc6d4e['duration'],_0xbc6d4e[_0xaaee('0x2b')])[_0xaaee('0xb')](function(_0x1118f0){_0x29950a(_0x1118f0);});else{return db[_0xaaee('0x1e')][_0xaaee('0x18')]({'raw':!![],'where':{'CmHopperId':_0x22d73c['id']},'order':[[_0xaaee('0x1f'),_0xaaee('0x20')]]})['then'](function(_0x47e529){if(_0x47e529)return activateAdditionalPhone(_0x22d73c,_0xbc6d4e[_0xaaee('0x19')],_0x47e529,_0xbc6d4e[_0xaaee('0x2c')],_0xbc6d4e[_0xaaee('0x2b')])[_0xaaee('0xb')](function(_0x5abe39){_0x29950a(_0x5abe39);});else{_0x29950a({'id':_0x22d73c['id'],'phone':''});}})[_0xaaee('0x15')](function(_0x5b11f1){logger['error']('VerifyAdditionalPhones',_0x5b11f1[_0xaaee('0x12')]);_0x505c83(_0x20ef27[_0xaaee('0xf')](0x1f4,_0x5b11f1[_0xaaee('0x12')]));});}})[_0xaaee('0x15')](function(_0x49f0e7){logger[_0xaaee('0xf')](_0xaaee('0x16'),_0x49f0e7[_0xaaee('0x12')]);_0x505c83(_0x20ef27['error'](0x1f4,_0x49f0e7[_0xaaee('0x12')]));});}else _0x29950a(0x1);});});};function activateAdditionalPhone(_0xd37c20,_0x18505e,_0x6c88ce,_0x1865d2,_0x2cde19){return new Promise(function(_0x253d15,_0x57c62b){var _0x9beb08;if(_[_0xaaee('0x2d')](_0x6c88ce[_0xaaee('0x2e')])){_0x6c88ce[_0xaaee('0x2e')]=moment();}if(moment()>moment(_0x6c88ce[_0xaaee('0x2e')])){_0x9beb08=moment()[_0xaaee('0x2f')](_0x2cde19||0x3,_0xaaee('0x30'));}else{if(_0x6c88ce[_0xaaee('0x1f')]==0x0){_0x9beb08=moment(_0x6c88ce[_0xaaee('0x2e')]);}else{_0x9beb08=moment()[_0xaaee('0x2f')](_0x2cde19||0x3,_0xaaee('0x30'));}}if(_['isNil'](_0x9beb08)){_0x9beb08=moment()[_0xaaee('0x2f')](_0x2cde19||0x3,'minutes');}var _0x2cd5da={'phone':_0xd37c20[_0xaaee('0x31')],'active':0x0,'OrderBy':_[_0xaaee('0x2d')](_0xd37c20[_0xaaee('0x1f')])?0x0:_0xd37c20[_0xaaee('0x1f')],'scheduledat':moment()[_0xaaee('0x2f')](_0x1865d2||0x1,'minutes'),'countbusyretry':_0x18505e[_0xaaee('0x21')],'countcongestionretry':_0x18505e[_0xaaee('0x22')],'countnoanswerretry':_0x18505e['countnoanswerretry'],'countnosuchnumberretry':_0x18505e[_0xaaee('0x28')],'countdropretry':_0x18505e[_0xaaee('0x24')],'countabandonedretry':_0x18505e[_0xaaee('0x25')],'countmachineretry':_0x18505e['countmachineretry'],'countagentrejectretry':_0x18505e[_0xaaee('0x26')],'createdAt':_0x18505e[_0xaaee('0x32')],'updatedAt':_0x18505e['updatedAt']};var _0x10622e={'CmHopperId':_0xd37c20['id'],'phone':_0x6c88ce[_0xaaee('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x6c88ce[_0xaaee('0x1f')])?0x0:_0x6c88ce[_0xaaee('0x1f')],'scheduledat':_0x9beb08,'countbusyretry':_0x6c88ce[_0xaaee('0x21')],'countcongestionretry':_0x6c88ce['countcongestionretry'],'countnoanswerretry':_0x6c88ce[_0xaaee('0x23')],'countnosuchnumberretry':_0x6c88ce[_0xaaee('0x28')],'countdropretry':_0x6c88ce[_0xaaee('0x24')],'countabandonedretry':_0x6c88ce['countabandonedretry'],'countmachineretry':_0x6c88ce[_0xaaee('0x29')],'countagentrejectretry':_0x6c88ce['countagentrejectretry'],'createdAt':_0x6c88ce['createdAt'],'updatedAt':_0x6c88ce[_0xaaee('0x33')]};return db[_0xaaee('0x34')]['transaction'](function(_0x15afd4){return db['CmHopperAdditionalPhone']['update'](_0x2cd5da,{'where':{'id':_0x6c88ce['id']}},{'transaction':_0x15afd4})[_0xaaee('0xb')](function(){return db[_0xaaee('0x17')][_0xaaee('0x35')](_0x10622e,{'where':{'id':_0xd37c20['id']}},{'transaction':_0x15afd4});});})[_0xaaee('0xb')](function(_0xdf111a){_0x253d15({'id':_0xd37c20['id'],'phone':_0x6c88ce[_0xaaee('0x31')]});})['catch'](function(_0x3d9ccf){logger[_0xaaee('0xf')](_0xaaee('0x36'),_0x3d9ccf[_0xaaee('0x12')]);_0x57c62b({'error':_0x3d9ccf[_0xaaee('0x12')]});});});}exports[_0xaaee('0x37')]=function(_0x325d39){var _0x551046=this;return new Promise(function(_0x34c238,_0x3a9e8d){return db[_0xaaee('0x17')][_0xaaee('0x35')](_0x325d39[_0xaaee('0x19')][_0xaaee('0x38')],{'where':{'id':_0x325d39[_0xaaee('0x19')]['id']}})[_0xaaee('0xb')](function(_0x5cc3b3){_0x34c238(_0x5cc3b3);})[_0xaaee('0x15')](function(_0x3854dc){logger[_0xaaee('0xf')]('IncrementPreviewCounters',_0x3854dc['message']);_0x3a9e8d(_0x551046['error'](0x1f4,_0x3854dc[_0xaaee('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index c607e21..c5a0df3 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96cf=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x39d0ed,_0x346a6c){var _0x3432de=function(_0x4d20ce){while(--_0x4d20ce){_0x39d0ed['push'](_0x39d0ed['shift']());}};_0x3432de(++_0x346a6c);}(_0x96cf,0x7a));var _0xf96c=function(_0x5ef8c2,_0x20af7a){_0x5ef8c2=_0x5ef8c2-0x0;var _0x3b1a6f=_0x96cf[_0x5ef8c2];return _0x3b1a6f;};'use strict';var multer=require(_0xf96c('0x0'));var util=require(_0xf96c('0x1'));var path=require('path');var timeout=require(_0xf96c('0x2'));var express=require(_0xf96c('0x3'));var router=express[_0xf96c('0x4')]();var fs_extra=require(_0xf96c('0x5'));var auth=require(_0xf96c('0x6'));var interaction=require(_0xf96c('0x7'));var config=require(_0xf96c('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth[_0xf96c('0x9')](),controller[_0xf96c('0xa')]);router['get'](_0xf96c('0xb'),auth[_0xf96c('0x9')](),controller[_0xf96c('0xc')]);router['post']('/',auth[_0xf96c('0x9')](),controller[_0xf96c('0xd')]);router[_0xf96c('0xe')](_0xf96c('0xb'),auth[_0xf96c('0x9')](),controller[_0xf96c('0xf')]);router[_0xf96c('0x10')](_0xf96c('0xb'),auth[_0xf96c('0x9')](),controller[_0xf96c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3cac=['../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x3e2df7,_0x117d02){var _0x2b9d39=function(_0x550a16){while(--_0x550a16){_0x3e2df7['push'](_0x3e2df7['shift']());}};_0x2b9d39(++_0x117d02);}(_0x3cac,0x176));var _0xc3ca=function(_0xf3b7fe,_0x21c801){_0xf3b7fe=_0xf3b7fe-0x0;var _0x7a96ad=_0x3cac[_0xf3b7fe];return _0x7a96ad;};'use strict';var multer=require(_0xc3ca('0x0'));var util=require(_0xc3ca('0x1'));var path=require('path');var timeout=require(_0xc3ca('0x2'));var express=require(_0xc3ca('0x3'));var router=express[_0xc3ca('0x4')]();var fs_extra=require(_0xc3ca('0x5'));var auth=require(_0xc3ca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc3ca('0x7'));var controller=require(_0xc3ca('0x8'));router['get']('/',auth[_0xc3ca('0x9')](),controller[_0xc3ca('0xa')]);router[_0xc3ca('0xb')](_0xc3ca('0xc'),auth[_0xc3ca('0x9')](),controller[_0xc3ca('0xd')]);router[_0xc3ca('0xe')]('/',auth[_0xc3ca('0x9')](),controller['create']);router[_0xc3ca('0xf')](_0xc3ca('0xc'),auth[_0xc3ca('0x9')](),controller[_0xc3ca('0x10')]);router[_0xc3ca('0x11')](_0xc3ca('0xc'),auth['isAuthenticated'](),controller[_0xc3ca('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 7922ea2..9037927 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 _0xe4d9=['contactListQueue','moment','sequelize','exports','INTEGER'];(function(_0xa92b8c,_0x2b50e3){var _0x55bfa1=function(_0xb70ab){while(--_0xb70ab){_0xa92b8c['push'](_0xa92b8c['shift']());}};_0x55bfa1(++_0x2b50e3);}(_0xe4d9,0x141));var _0x9e4d=function(_0x425692,_0x27240f){_0x425692=_0x425692-0x0;var _0x14b16d=_0xe4d9[_0x425692];return _0x14b16d;};'use strict';var moment=require(_0x9e4d('0x0'));var Sequelize=require(_0x9e4d('0x1'));module[_0x9e4d('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9e4d('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x9e4d('0x4')},'VoiceQueueId':{'type':Sequelize[_0x9e4d('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x2b34=['contactListQueue','INTEGER','moment','sequelize','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2b34,0x165));var _0x42b3=function(_0x15ddc9,_0x209223){_0x15ddc9=_0x15ddc9-0x0;var _0x2fc9e8=_0x2b34[_0x15ddc9];return _0x2fc9e8;};'use strict';var moment=require(_0x42b3('0x0'));var Sequelize=require(_0x42b3('0x1'));module['exports']={'phone':{'type':Sequelize[_0x42b3('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x42b3('0x3')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x42b3('0x3')},'VoiceQueueId':{'type':Sequelize[_0x42b3('0x4')],'unique':_0x42b3('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 9d50a35..3480043 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 _0x7a7c=['CmHopperBlack','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','where','pick','filter','merge','options','includeAll','include','findAll','show','params','catch','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map'];(function(_0x364852,_0x17691e){var _0x2ec071=function(_0x5608a1){while(--_0x5608a1){_0x364852['push'](_0x364852['shift']());}};_0x2ec071(++_0x17691e);}(_0x7a7c,0x1c6));var _0xc7a7=function(_0x283104,_0x3e9701){_0x283104=_0x283104-0x0;var _0x4df8ca=_0x7a7c[_0x283104];return _0x4df8ca;};'use strict';var emlformat=require(_0xc7a7('0x0'));var rimraf=require(_0xc7a7('0x1'));var zipdir=require(_0xc7a7('0x2'));var jsonpatch=require(_0xc7a7('0x3'));var rp=require('request-promise');var moment=require(_0xc7a7('0x4'));var BPromise=require(_0xc7a7('0x5'));var Mustache=require(_0xc7a7('0x6'));var util=require('util');var path=require(_0xc7a7('0x7'));var sox=require(_0xc7a7('0x8'));var csv=require('to-csv');var ejs=require(_0xc7a7('0x9'));var fs=require('fs');var fs_extra=require(_0xc7a7('0xa'));var _=require(_0xc7a7('0xb'));var squel=require(_0xc7a7('0xc'));var crypto=require(_0xc7a7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc7a7('0xe'));var toCsv=require(_0xc7a7('0xf'));var querystring=require('querystring');var Papa=require(_0xc7a7('0x10'));var Redis=require(_0xc7a7('0x11'));var authService=require(_0xc7a7('0x12'));var qs=require(_0xc7a7('0x13'));var as=require(_0xc7a7('0x14'));var hardwareService=require(_0xc7a7('0x15'));var logger=require(_0xc7a7('0x16'))(_0xc7a7('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x333473,_0x10cd40){_0x10cd40=_0x10cd40||0xcc;return function(_0x28f8b1){if(_0x28f8b1){return _0x333473[_0xc7a7('0x18')](_0x10cd40);}return _0x333473[_0xc7a7('0x19')](_0x10cd40)[_0xc7a7('0x1a')]();};}function respondWithResult(_0x5b439e,_0x208b21){_0x208b21=_0x208b21||0xc8;return function(_0x82529c){if(_0x82529c){return _0x5b439e[_0xc7a7('0x19')](_0x208b21)[_0xc7a7('0x1b')](_0x82529c);}};}function respondWithFilteredResult(_0x16e19f,_0x2e0293){return function(_0x2ba3e0){if(_0x2ba3e0){var _0x530b6c=typeof _0x2e0293[_0xc7a7('0x1c')]===_0xc7a7('0x1d')&&typeof _0x2e0293['limit']===_0xc7a7('0x1d');var _0x6b7bef=_0x2ba3e0[_0xc7a7('0x1e')];var _0x57055b=_0x530b6c?0x0:_0x2e0293[_0xc7a7('0x1c')];var _0x397f6c=_0x530b6c?_0x2ba3e0['count']:_0x2e0293['offset']+_0x2e0293['limit'];var _0x4af4d5;if(_0x397f6c>=_0x6b7bef){_0x397f6c=_0x6b7bef;_0x4af4d5=0xc8;}else{_0x4af4d5=0xce;}_0x16e19f[_0xc7a7('0x19')](_0x4af4d5);return _0x16e19f[_0xc7a7('0x1f')](_0xc7a7('0x20'),_0x57055b+'-'+_0x397f6c+'/'+_0x6b7bef)['json'](_0x2ba3e0);}return null;};}function patchUpdates(_0x57e622){return function(_0x1bb161){try{jsonpatch[_0xc7a7('0x21')](_0x1bb161,_0x57e622,!![]);}catch(_0xfdbae9){return BPromise[_0xc7a7('0x22')](_0xfdbae9);}return _0x1bb161[_0xc7a7('0x23')]();};}function saveUpdates(_0x5dc11b,_0x109c16){return function(_0x275b2f){if(_0x275b2f){return _0x275b2f[_0xc7a7('0x24')](_0x5dc11b)[_0xc7a7('0x25')](function(_0x18961d){return _0x18961d;});}return null;};}function removeEntity(_0x4ce961,_0x58fe53){return function(_0x49cbce){if(_0x49cbce){return _0x49cbce[_0xc7a7('0x26')]()[_0xc7a7('0x25')](function(){_0x4ce961[_0xc7a7('0x19')](0xcc)[_0xc7a7('0x1a')]();});}};}function handleEntityNotFound(_0x3faf70,_0x27fb1e){return function(_0x101010){if(!_0x101010){_0x3faf70[_0xc7a7('0x18')](0x194);}return _0x101010;};}function handleError(_0x4d126e,_0x50bcc){_0x50bcc=_0x50bcc||0x1f4;return function(_0x3a21fb){logger[_0xc7a7('0x27')](_0x3a21fb[_0xc7a7('0x28')]);if(_0x3a21fb[_0xc7a7('0x29')]){delete _0x3a21fb[_0xc7a7('0x29')];}_0x4d126e['status'](_0x50bcc)['send'](_0x3a21fb);};}exports['index']=function(_0x5e0c87,_0x563b4c){var _0x4e9594={},_0x5b0f1e={},_0x178436={'count':0x0,'rows':[]};var _0x47cc43=_[_0xc7a7('0x2a')](db[_0xc7a7('0x2b')][_0xc7a7('0x2c')],function(_0x47123c){return{'name':_0x47123c['fieldName'],'type':_0x47123c[_0xc7a7('0x2d')][_0xc7a7('0x2e')]};});_0x5b0f1e[_0xc7a7('0x2f')]=_[_0xc7a7('0x2a')](_0x47cc43,'name');_0x5b0f1e[_0xc7a7('0x30')]=_[_0xc7a7('0x31')](_0x5e0c87[_0xc7a7('0x30')]);_0x5b0f1e[_0xc7a7('0x32')]=_[_0xc7a7('0x33')](_0x5b0f1e[_0xc7a7('0x2f')],_0x5b0f1e[_0xc7a7('0x30')]);_0x4e9594[_0xc7a7('0x34')]=_[_0xc7a7('0x33')](_0x5b0f1e[_0xc7a7('0x2f')],qs[_0xc7a7('0x35')](_0x5e0c87[_0xc7a7('0x30')]['fields']));_0x4e9594['attributes']=_0x4e9594['attributes']['length']?_0x4e9594[_0xc7a7('0x34')]:_0x5b0f1e['model'];if(!_0x5e0c87[_0xc7a7('0x30')][_0xc7a7('0x36')](_0xc7a7('0x37'))){_0x4e9594[_0xc7a7('0x38')]=qs['limit'](_0x5e0c87[_0xc7a7('0x30')][_0xc7a7('0x38')]);_0x4e9594['offset']=qs[_0xc7a7('0x1c')](_0x5e0c87[_0xc7a7('0x30')]['offset']);}_0x4e9594['order']=qs['sort'](_0x5e0c87[_0xc7a7('0x30')]['sort']);_0x4e9594[_0xc7a7('0x39')]=qs['filters'](_[_0xc7a7('0x3a')](_0x5e0c87[_0xc7a7('0x30')],_0x5b0f1e['filters']),_0x47cc43);if(_0x5e0c87[_0xc7a7('0x30')][_0xc7a7('0x3b')]){_0x4e9594[_0xc7a7('0x39')]=_['merge'](_0x4e9594[_0xc7a7('0x39')],{'$or':_[_0xc7a7('0x2a')](_0x47cc43,function(_0x42cb21){if(_0x42cb21[_0xc7a7('0x2d')]!=='VIRTUAL'){var _0x51bdf0={};_0x51bdf0[_0x42cb21[_0xc7a7('0x29')]]={'$like':'%'+_0x5e0c87[_0xc7a7('0x30')][_0xc7a7('0x3b')]+'%'};return _0x51bdf0;}})});}_0x4e9594=_[_0xc7a7('0x3c')]({},_0x4e9594,_0x5e0c87[_0xc7a7('0x3d')]);var _0x1a5685={'where':_0x4e9594[_0xc7a7('0x39')]};return db[_0xc7a7('0x2b')][_0xc7a7('0x1e')](_0x1a5685)[_0xc7a7('0x25')](function(_0x8366f7){_0x178436[_0xc7a7('0x1e')]=_0x8366f7;if(_0x5e0c87[_0xc7a7('0x30')][_0xc7a7('0x3e')]){_0x4e9594[_0xc7a7('0x3f')]=[{'all':!![]}];}return db[_0xc7a7('0x2b')][_0xc7a7('0x40')](_0x4e9594);})[_0xc7a7('0x25')](function(_0x50e3ac){_0x178436['rows']=_0x50e3ac;return _0x178436;})[_0xc7a7('0x25')](respondWithFilteredResult(_0x563b4c,_0x4e9594))['catch'](handleError(_0x563b4c,null));};exports[_0xc7a7('0x41')]=function(_0x3d2e08,_0x28e31e){var _0x14b7ad={'raw':!![],'where':{'id':_0x3d2e08[_0xc7a7('0x42')]['id']}},_0x5fc355={};_0x5fc355[_0xc7a7('0x2f')]=_[_0xc7a7('0x31')](db[_0xc7a7('0x2b')][_0xc7a7('0x2c')]);_0x5fc355[_0xc7a7('0x30')]=_['keys'](_0x3d2e08[_0xc7a7('0x30')]);_0x5fc355[_0xc7a7('0x32')]=_[_0xc7a7('0x33')](_0x5fc355[_0xc7a7('0x2f')],_0x5fc355['query']);_0x14b7ad[_0xc7a7('0x34')]=_['intersection'](_0x5fc355[_0xc7a7('0x2f')],qs[_0xc7a7('0x35')](_0x3d2e08[_0xc7a7('0x30')]['fields']));_0x14b7ad[_0xc7a7('0x34')]=_0x14b7ad[_0xc7a7('0x34')]['length']?_0x14b7ad[_0xc7a7('0x34')]:_0x5fc355[_0xc7a7('0x2f')];if(_0x3d2e08['query']['includeAll']){_0x14b7ad[_0xc7a7('0x3f')]=[{'all':!![]}];}_0x14b7ad=_[_0xc7a7('0x3c')]({},_0x14b7ad,_0x3d2e08['options']);return db[_0xc7a7('0x2b')]['find'](_0x14b7ad)[_0xc7a7('0x25')](handleEntityNotFound(_0x28e31e,null))['then'](respondWithResult(_0x28e31e,null))[_0xc7a7('0x43')](handleError(_0x28e31e,null));};exports[_0xc7a7('0x24')]=function(_0xd8e17f,_0x308f0d){if(_0xd8e17f['body']['id']){delete _0xd8e17f['body']['id'];}return db[_0xc7a7('0x2b')][_0xc7a7('0x44')]({'where':{'id':_0xd8e17f[_0xc7a7('0x42')]['id']}})['then'](handleEntityNotFound(_0x308f0d,null))[_0xc7a7('0x25')](saveUpdates(_0xd8e17f[_0xc7a7('0x45')],null))[_0xc7a7('0x25')](respondWithResult(_0x308f0d,null))[_0xc7a7('0x43')](handleError(_0x308f0d,null));};exports[_0xc7a7('0x26')]=function(_0x407be7,_0x1efda1){return db[_0xc7a7('0x2b')][_0xc7a7('0x44')]({'where':{'id':_0x407be7[_0xc7a7('0x42')]['id']}})[_0xc7a7('0x25')](handleEntityNotFound(_0x1efda1,null))[_0xc7a7('0x25')](removeEntity(_0x1efda1,null))[_0xc7a7('0x43')](handleError(_0x1efda1,null));};exports[_0xc7a7('0x46')]=function(_0x1b23d8,_0x35bd2b){return db[_0xc7a7('0x2b')]['describe']()['then'](respondWithResult(_0x35bd2b,null))['catch'](handleError(_0x35bd2b,null));}; \ No newline at end of file +var _0x4d1f=['query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopperBlack','include','rows','catch','show','params','keys','includeAll','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','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','apply','reject','save','update','then','destroy','send','map','rawAttributes','fieldName','key','name'];(function(_0x319152,_0x21851a){var _0x4beaa1=function(_0x301550){while(--_0x301550){_0x319152['push'](_0x319152['shift']());}};_0x4beaa1(++_0x21851a);}(_0x4d1f,0x141));var _0xf4d1=function(_0x488914,_0x4732e3){_0x488914=_0x488914-0x0;var _0xd1402=_0x4d1f[_0x488914];return _0xd1402;};'use strict';var emlformat=require(_0xf4d1('0x0'));var rimraf=require(_0xf4d1('0x1'));var zipdir=require(_0xf4d1('0x2'));var jsonpatch=require(_0xf4d1('0x3'));var rp=require(_0xf4d1('0x4'));var moment=require(_0xf4d1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf4d1('0x6'));var path=require('path');var sox=require(_0xf4d1('0x7'));var csv=require('to-csv');var ejs=require(_0xf4d1('0x8'));var fs=require('fs');var fs_extra=require(_0xf4d1('0x9'));var _=require(_0xf4d1('0xa'));var squel=require(_0xf4d1('0xb'));var crypto=require(_0xf4d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf4d1('0xd'));var Redis=require(_0xf4d1('0xe'));var authService=require(_0xf4d1('0xf'));var qs=require(_0xf4d1('0x10'));var as=require(_0xf4d1('0x11'));var hardwareService=require(_0xf4d1('0x12'));var logger=require(_0xf4d1('0x13'))('api');var utils=require(_0xf4d1('0x14'));var config=require(_0xf4d1('0x15'));var licenseUtil=require(_0xf4d1('0x16'));var db=require(_0xf4d1('0x17'))['db'];function respondWithStatusCode(_0x4b3c0f,_0x23eed8){_0x23eed8=_0x23eed8||0xcc;return function(_0x572d11){if(_0x572d11){return _0x4b3c0f[_0xf4d1('0x18')](_0x23eed8);}return _0x4b3c0f[_0xf4d1('0x19')](_0x23eed8)[_0xf4d1('0x1a')]();};}function respondWithResult(_0x239a80,_0x4cce73){_0x4cce73=_0x4cce73||0xc8;return function(_0x5736b3){if(_0x5736b3){return _0x239a80[_0xf4d1('0x19')](_0x4cce73)[_0xf4d1('0x1b')](_0x5736b3);}};}function respondWithFilteredResult(_0x1f07a7,_0x293f17){return function(_0x111815){if(_0x111815){var _0x4dc791=typeof _0x293f17[_0xf4d1('0x1c')]===_0xf4d1('0x1d')&&typeof _0x293f17[_0xf4d1('0x1e')]==='undefined';var _0x70ffdc=_0x111815[_0xf4d1('0x1f')];var _0x4cfeb5=_0x4dc791?0x0:_0x293f17[_0xf4d1('0x1c')];var _0x23b36e=_0x4dc791?_0x111815['count']:_0x293f17[_0xf4d1('0x1c')]+_0x293f17[_0xf4d1('0x1e')];var _0xfd3e27;if(_0x23b36e>=_0x70ffdc){_0x23b36e=_0x70ffdc;_0xfd3e27=0xc8;}else{_0xfd3e27=0xce;}_0x1f07a7[_0xf4d1('0x19')](_0xfd3e27);return _0x1f07a7['set']('Content-Range',_0x4cfeb5+'-'+_0x23b36e+'/'+_0x70ffdc)[_0xf4d1('0x1b')](_0x111815);}return null;};}function patchUpdates(_0x1c6499){return function(_0x2c5e9f){try{jsonpatch[_0xf4d1('0x20')](_0x2c5e9f,_0x1c6499,!![]);}catch(_0x4cae24){return BPromise[_0xf4d1('0x21')](_0x4cae24);}return _0x2c5e9f[_0xf4d1('0x22')]();};}function saveUpdates(_0x2de8f6,_0x452aa2){return function(_0x48fab7){if(_0x48fab7){return _0x48fab7[_0xf4d1('0x23')](_0x2de8f6)[_0xf4d1('0x24')](function(_0x41ecae){return _0x41ecae;});}return null;};}function removeEntity(_0x103000,_0x5ae0cf){return function(_0x205243){if(_0x205243){return _0x205243[_0xf4d1('0x25')]()['then'](function(){_0x103000[_0xf4d1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e25f6,_0x3d316d){return function(_0x52f4a5){if(!_0x52f4a5){_0x2e25f6[_0xf4d1('0x18')](0x194);}return _0x52f4a5;};}function handleError(_0x49d323,_0x1ac6e1){_0x1ac6e1=_0x1ac6e1||0x1f4;return function(_0x43d80e){logger['error'](_0x43d80e['stack']);if(_0x43d80e['name']){delete _0x43d80e['name'];}_0x49d323[_0xf4d1('0x19')](_0x1ac6e1)[_0xf4d1('0x26')](_0x43d80e);};}exports['index']=function(_0x505a10,_0xd7f553){var _0x4718a3={},_0x42dcef={},_0x4bebad={'count':0x0,'rows':[]};var _0x17da0c=_[_0xf4d1('0x27')](db['CmHopperBlack'][_0xf4d1('0x28')],function(_0x4fee5a){return{'name':_0x4fee5a[_0xf4d1('0x29')],'type':_0x4fee5a['type'][_0xf4d1('0x2a')]};});_0x42dcef['model']=_['map'](_0x17da0c,_0xf4d1('0x2b'));_0x42dcef[_0xf4d1('0x2c')]=_['keys'](_0x505a10[_0xf4d1('0x2c')]);_0x42dcef[_0xf4d1('0x2d')]=_[_0xf4d1('0x2e')](_0x42dcef[_0xf4d1('0x2f')],_0x42dcef['query']);_0x4718a3[_0xf4d1('0x30')]=_['intersection'](_0x42dcef[_0xf4d1('0x2f')],qs[_0xf4d1('0x31')](_0x505a10[_0xf4d1('0x2c')]['fields']));_0x4718a3[_0xf4d1('0x30')]=_0x4718a3['attributes'][_0xf4d1('0x32')]?_0x4718a3[_0xf4d1('0x30')]:_0x42dcef[_0xf4d1('0x2f')];if(!_0x505a10['query'][_0xf4d1('0x33')](_0xf4d1('0x34'))){_0x4718a3['limit']=qs[_0xf4d1('0x1e')](_0x505a10['query'][_0xf4d1('0x1e')]);_0x4718a3[_0xf4d1('0x1c')]=qs[_0xf4d1('0x1c')](_0x505a10[_0xf4d1('0x2c')][_0xf4d1('0x1c')]);}_0x4718a3[_0xf4d1('0x35')]=qs[_0xf4d1('0x36')](_0x505a10[_0xf4d1('0x2c')]['sort']);_0x4718a3[_0xf4d1('0x37')]=qs[_0xf4d1('0x2d')](_[_0xf4d1('0x38')](_0x505a10[_0xf4d1('0x2c')],_0x42dcef[_0xf4d1('0x2d')]),_0x17da0c);if(_0x505a10[_0xf4d1('0x2c')][_0xf4d1('0x39')]){_0x4718a3[_0xf4d1('0x37')]=_[_0xf4d1('0x3a')](_0x4718a3[_0xf4d1('0x37')],{'$or':_[_0xf4d1('0x27')](_0x17da0c,function(_0xb5b489){if(_0xb5b489[_0xf4d1('0x3b')]!==_0xf4d1('0x3c')){var _0x3b2246={};_0x3b2246[_0xb5b489[_0xf4d1('0x2b')]]={'$like':'%'+_0x505a10[_0xf4d1('0x2c')][_0xf4d1('0x39')]+'%'};return _0x3b2246;}})});}_0x4718a3=_[_0xf4d1('0x3a')]({},_0x4718a3,_0x505a10[_0xf4d1('0x3d')]);var _0xabbc41={'where':_0x4718a3['where']};return db[_0xf4d1('0x3e')][_0xf4d1('0x1f')](_0xabbc41)[_0xf4d1('0x24')](function(_0x1d2cf8){_0x4bebad[_0xf4d1('0x1f')]=_0x1d2cf8;if(_0x505a10[_0xf4d1('0x2c')]['includeAll']){_0x4718a3[_0xf4d1('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x4718a3);})['then'](function(_0x4b876c){_0x4bebad[_0xf4d1('0x40')]=_0x4b876c;return _0x4bebad;})[_0xf4d1('0x24')](respondWithFilteredResult(_0xd7f553,_0x4718a3))[_0xf4d1('0x41')](handleError(_0xd7f553,null));};exports[_0xf4d1('0x42')]=function(_0x480db1,_0x5281de){var _0x52c271={'raw':!![],'where':{'id':_0x480db1[_0xf4d1('0x43')]['id']}},_0x47b2e3={};_0x47b2e3[_0xf4d1('0x2f')]=_[_0xf4d1('0x44')](db[_0xf4d1('0x3e')][_0xf4d1('0x28')]);_0x47b2e3[_0xf4d1('0x2c')]=_['keys'](_0x480db1[_0xf4d1('0x2c')]);_0x47b2e3['filters']=_['intersection'](_0x47b2e3[_0xf4d1('0x2f')],_0x47b2e3['query']);_0x52c271[_0xf4d1('0x30')]=_[_0xf4d1('0x2e')](_0x47b2e3[_0xf4d1('0x2f')],qs['fields'](_0x480db1[_0xf4d1('0x2c')][_0xf4d1('0x31')]));_0x52c271['attributes']=_0x52c271[_0xf4d1('0x30')][_0xf4d1('0x32')]?_0x52c271['attributes']:_0x47b2e3[_0xf4d1('0x2f')];if(_0x480db1[_0xf4d1('0x2c')][_0xf4d1('0x45')]){_0x52c271[_0xf4d1('0x3f')]=[{'all':!![]}];}_0x52c271=_[_0xf4d1('0x3a')]({},_0x52c271,_0x480db1['options']);return db[_0xf4d1('0x3e')][_0xf4d1('0x46')](_0x52c271)[_0xf4d1('0x24')](handleEntityNotFound(_0x5281de,null))[_0xf4d1('0x24')](respondWithResult(_0x5281de,null))[_0xf4d1('0x41')](handleError(_0x5281de,null));};exports[_0xf4d1('0x23')]=function(_0x3bde58,_0x3e93bc){if(_0x3bde58[_0xf4d1('0x47')]['id']){delete _0x3bde58[_0xf4d1('0x47')]['id'];}return db['CmHopperBlack'][_0xf4d1('0x46')]({'where':{'id':_0x3bde58['params']['id']}})[_0xf4d1('0x24')](handleEntityNotFound(_0x3e93bc,null))[_0xf4d1('0x24')](saveUpdates(_0x3bde58['body'],null))['then'](respondWithResult(_0x3e93bc,null))['catch'](handleError(_0x3e93bc,null));};exports[_0xf4d1('0x25')]=function(_0x334f24,_0x428868){return db[_0xf4d1('0x3e')][_0xf4d1('0x46')]({'where':{'id':_0x334f24['params']['id']}})[_0xf4d1('0x24')](handleEntityNotFound(_0x428868,null))[_0xf4d1('0x24')](removeEntity(_0x428868,null))[_0xf4d1('0x41')](handleError(_0x428868,null));};exports[_0xf4d1('0x48')]=function(_0x2691b,_0x2b7504){return db['CmHopperBlack'][_0xf4d1('0x48')]()[_0xf4d1('0x24')](respondWithResult(_0x2b7504,null))[_0xf4d1('0x41')](handleError(_0x2b7504,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 34671bb..f43afa4 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 _0x925d=['bluebird','request-promise','../../config/environment','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api'];(function(_0x281017,_0x5e3345){var _0x8f8861=function(_0x23c293){while(--_0x23c293){_0x281017['push'](_0x281017['shift']());}};_0x8f8861(++_0x5e3345);}(_0x925d,0x6a));var _0xd925=function(_0x3fb0fd,_0x112a5d){_0x3fb0fd=_0x3fb0fd-0x0;var _0x54e13d=_0x925d[_0x3fb0fd];return _0x54e13d;};'use strict';var _=require(_0xd925('0x0'));var util=require(_0xd925('0x1'));var logger=require(_0xd925('0x2'))(_0xd925('0x3'));var moment=require('moment');var BPromise=require(_0xd925('0x4'));var rp=require(_0xd925('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd925('0x6'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x5a6484,_0x3b341b){return _0x5a6484[_0xd925('0x7')](_0xd925('0x8'),attributes,{'tableName':_0xd925('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4b0=['cm_hopper_black','lodash','util','../../config/logger','moment','bluebird','request-promise','path','exports','define','CmHopperBlack'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf4b0,0x177));var _0x0f4b=function(_0x3a3ba3,_0x25d3fb){_0x3a3ba3=_0x3a3ba3-0x0;var _0x283e50=_0xf4b0[_0x3a3ba3];return _0x283e50;};'use strict';var _=require(_0x0f4b('0x0'));var util=require(_0x0f4b('0x1'));var logger=require(_0x0f4b('0x2'))('api');var moment=require(_0x0f4b('0x3'));var BPromise=require(_0x0f4b('0x4'));var rp=require(_0x0f4b('0x5'));var fs=require('fs');var path=require(_0x0f4b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x0f4b('0x7')]=function(_0x2b015d,_0x49f3de){return _0x2b015d[_0x0f4b('0x8')](_0x0f4b('0x9'),attributes,{'tableName':_0x0f4b('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 0c95ca2..9ec07d9 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 _0xd2a7=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','include','map','model','attributes','catch','UpdateCmHopperBlack','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0xd2a7,0x12a));var _0x7d2a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d2a('0x0'));var util=require(_0x7d2a('0x1'));var moment=require(_0x7d2a('0x2'));var BPromise=require(_0x7d2a('0x3'));var rs=require(_0x7d2a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d2a('0x5'))['db'];var utils=require(_0x7d2a('0x6'));var logger=require(_0x7d2a('0x7'))(_0x7d2a('0x8'));var config=require(_0x7d2a('0x9'));var jayson=require(_0x7d2a('0xa'));var client=jayson[_0x7d2a('0xb')][_0x7d2a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34ac61,_0x419c0d,_0x3753ce){return new BPromise(function(_0x4144a6,_0x4fa444){return client[_0x7d2a('0xd')](_0x34ac61,_0x3753ce)[_0x7d2a('0xe')](function(_0xd6f6fe){logger[_0x7d2a('0xf')](_0x7d2a('0x10'),_0x419c0d,_0x7d2a('0x11'));logger[_0x7d2a('0x12')](_0x7d2a('0x13'),_0x419c0d,_0x7d2a('0x11'),JSON[_0x7d2a('0x14')](_0xd6f6fe));if(_0xd6f6fe[_0x7d2a('0x15')]){if(_0xd6f6fe['error']['code']===0x1f4){logger[_0x7d2a('0x15')](_0x7d2a('0x10'),_0x419c0d,_0xd6f6fe['error'][_0x7d2a('0x16')]);return _0x4fa444(_0xd6f6fe[_0x7d2a('0x15')][_0x7d2a('0x16')]);}logger[_0x7d2a('0x15')](_0x7d2a('0x10'),_0x419c0d,_0xd6f6fe[_0x7d2a('0x15')][_0x7d2a('0x16')]);return _0x4144a6(_0xd6f6fe['error']['message']);}else{logger[_0x7d2a('0xf')](_0x7d2a('0x10'),_0x419c0d,_0x7d2a('0x11'));_0x4144a6(_0xd6f6fe[_0x7d2a('0x17')][_0x7d2a('0x16')]);}})['catch'](function(_0x368c8b){logger[_0x7d2a('0x15')](_0x7d2a('0x10'),_0x419c0d,_0x368c8b);_0x4fa444(_0x368c8b);});});}exports[_0x7d2a('0x18')]=function(_0x69b822){var _0x23437e=this;return new Promise(function(_0x50f2b2,_0x58417d){return db[_0x7d2a('0x19')][_0x7d2a('0x1a')]({'raw':_0x69b822[_0x7d2a('0x1b')]?_0x69b822[_0x7d2a('0x1b')][_0x7d2a('0x1c')]===undefined?!![]:![]:!![],'where':_0x69b822[_0x7d2a('0x1b')]?_0x69b822['options'][_0x7d2a('0x1d')]||null:null,'attributes':_0x69b822[_0x7d2a('0x1b')]?_0x69b822[_0x7d2a('0x1b')]['attributes']||null:null,'limit':_0x69b822['options']?_0x69b822[_0x7d2a('0x1b')][_0x7d2a('0x1e')]||null:null,'include':_0x69b822['options']?_0x69b822['options'][_0x7d2a('0x1f')]?_[_0x7d2a('0x20')](_0x69b822[_0x7d2a('0x1b')][_0x7d2a('0x1f')],function(_0x2f6ef4){return{'model':db[_0x2f6ef4[_0x7d2a('0x21')]],'as':_0x2f6ef4['as'],'attributes':_0x2f6ef4[_0x7d2a('0x22')],'include':_0x2f6ef4[_0x7d2a('0x1f')]?_[_0x7d2a('0x20')](_0x2f6ef4[_0x7d2a('0x1f')],function(_0x4b92b6){return{'model':db[_0x4b92b6['model']],'as':_0x4b92b6['as'],'attributes':_0x4b92b6['attributes'],'include':_0x4b92b6[_0x7d2a('0x1f')]?_[_0x7d2a('0x20')](_0x4b92b6[_0x7d2a('0x1f')],function(_0x3e741d){return{'model':db[_0x3e741d['model']],'as':_0x3e741d['as'],'attributes':_0x3e741d[_0x7d2a('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7d2a('0xe')](function(_0x30759c){logger['info'](_0x7d2a('0x18'),_0x69b822);logger[_0x7d2a('0x12')](_0x7d2a('0x18'),_0x69b822,JSON[_0x7d2a('0x14')](_0x30759c));_0x50f2b2(_0x30759c);})[_0x7d2a('0x23')](function(_0x35dd0d){logger[_0x7d2a('0x15')](_0x7d2a('0x18'),_0x35dd0d[_0x7d2a('0x16')],_0x69b822);_0x58417d(_0x23437e[_0x7d2a('0x15')](0x1f4,_0x35dd0d[_0x7d2a('0x16')]));});});};exports[_0x7d2a('0x24')]=function(_0xfdbe25){var _0x4fea1e=this;return new Promise(function(_0x3555e3,_0x5e8631){return db[_0x7d2a('0x19')]['update'](_0xfdbe25['body'],{'raw':_0xfdbe25[_0x7d2a('0x1b')]?_0xfdbe25[_0x7d2a('0x1b')][_0x7d2a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfdbe25['options']?_0xfdbe25[_0x7d2a('0x1b')][_0x7d2a('0x1d')]||null:null,'attributes':_0xfdbe25[_0x7d2a('0x1b')]?_0xfdbe25['options']['attributes']||null:null,'limit':_0xfdbe25[_0x7d2a('0x1b')]?_0xfdbe25[_0x7d2a('0x1b')][_0x7d2a('0x1e')]||null:null})[_0x7d2a('0xe')](function(_0x5ba6a4){logger[_0x7d2a('0xf')](_0x7d2a('0x24'),_0xfdbe25);logger['debug']('UpdateCmHopperBlack',_0xfdbe25,JSON[_0x7d2a('0x14')](_0x5ba6a4));_0x3555e3(_0x5ba6a4);})[_0x7d2a('0x23')](function(_0x3cdb7e){logger['error']('UpdateCmHopperBlack',_0x3cdb7e[_0x7d2a('0x16')],_0xfdbe25);_0x5e8631(_0x4fea1e[_0x7d2a('0x15')](0x1f4,_0x3cdb7e[_0x7d2a('0x16')]));});});};exports[_0x7d2a('0x25')]=function(_0x416eb3){var _0x506eae=this;return new Promise(function(_0x17d0e2,_0x49a91c){return db['CmHopperBlack']['destroy']({'where':_0x416eb3[_0x7d2a('0x1b')]?_0x416eb3[_0x7d2a('0x1b')][_0x7d2a('0x1d')]||null:null})[_0x7d2a('0xe')](function(_0x4a3be2){logger[_0x7d2a('0xf')]('DestroyCmHopperBlack',_0x416eb3);logger[_0x7d2a('0x12')](_0x7d2a('0x25'),_0x416eb3,JSON['stringify'](_0x4a3be2));_0x17d0e2(_0x4a3be2);})['catch'](function(_0x21d683){logger[_0x7d2a('0x15')]('DestroyCmHopperBlack',_0x21d683[_0x7d2a('0x16')],_0x416eb3);_0x49a91c(_0x506eae['error'](0x1f4,_0x21d683[_0x7d2a('0x16')]));});});}; \ No newline at end of file +var _0xbe67=['../../config/environment','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','stringify','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2a2fdb,_0x5b5d57){var _0x34fbbf=function(_0x414ba3){while(--_0x414ba3){_0x2a2fdb['push'](_0x2a2fdb['shift']());}};_0x34fbbf(++_0x5b5d57);}(_0xbe67,0x120));var _0x7be6=function(_0x181f22,_0x2a983d){_0x181f22=_0x181f22-0x0;var _0x5ea458=_0xbe67[_0x181f22];return _0x5ea458;};'use strict';var _=require(_0x7be6('0x0'));var util=require(_0x7be6('0x1'));var moment=require(_0x7be6('0x2'));var BPromise=require(_0x7be6('0x3'));var rs=require(_0x7be6('0x4'));var fs=require('fs');var Redis=require(_0x7be6('0x5'));var db=require(_0x7be6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7be6('0x7'))('rpc');var config=require(_0x7be6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7be6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c97a7,_0x21d32b,_0xb7b664){return new BPromise(function(_0x324783,_0x5a7f03){return client[_0x7be6('0xa')](_0x6c97a7,_0xb7b664)[_0x7be6('0xb')](function(_0x1df368){logger[_0x7be6('0xc')](_0x7be6('0xd'),_0x21d32b,'request\x20sent');logger[_0x7be6('0xe')](_0x7be6('0xf'),_0x21d32b,'request\x20sent',JSON['stringify'](_0x1df368));if(_0x1df368[_0x7be6('0x10')]){if(_0x1df368['error'][_0x7be6('0x11')]===0x1f4){logger[_0x7be6('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x21d32b,_0x1df368[_0x7be6('0x10')][_0x7be6('0x12')]);return _0x5a7f03(_0x1df368[_0x7be6('0x10')][_0x7be6('0x12')]);}logger[_0x7be6('0x10')](_0x7be6('0xd'),_0x21d32b,_0x1df368['error'][_0x7be6('0x12')]);return _0x324783(_0x1df368['error'][_0x7be6('0x12')]);}else{logger[_0x7be6('0xc')](_0x7be6('0xd'),_0x21d32b,'request\x20sent');_0x324783(_0x1df368[_0x7be6('0x13')][_0x7be6('0x12')]);}})[_0x7be6('0x14')](function(_0x2d86f7){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x21d32b,_0x2d86f7);_0x5a7f03(_0x2d86f7);});});}exports[_0x7be6('0x15')]=function(_0xbe554d){var _0x51b73c=this;return new Promise(function(_0x1fa4e0,_0x316336){return db[_0x7be6('0x16')][_0x7be6('0x17')]({'raw':_0xbe554d['options']?_0xbe554d[_0x7be6('0x18')][_0x7be6('0x19')]===undefined?!![]:![]:!![],'where':_0xbe554d[_0x7be6('0x18')]?_0xbe554d['options'][_0x7be6('0x1a')]||null:null,'attributes':_0xbe554d[_0x7be6('0x18')]?_0xbe554d['options'][_0x7be6('0x1b')]||null:null,'limit':_0xbe554d[_0x7be6('0x18')]?_0xbe554d[_0x7be6('0x18')][_0x7be6('0x1c')]||null:null,'include':_0xbe554d[_0x7be6('0x18')]?_0xbe554d[_0x7be6('0x18')][_0x7be6('0x1d')]?_[_0x7be6('0x1e')](_0xbe554d[_0x7be6('0x18')][_0x7be6('0x1d')],function(_0x4da074){return{'model':db[_0x4da074['model']],'as':_0x4da074['as'],'attributes':_0x4da074['attributes'],'include':_0x4da074[_0x7be6('0x1d')]?_[_0x7be6('0x1e')](_0x4da074[_0x7be6('0x1d')],function(_0x3d1598){return{'model':db[_0x3d1598[_0x7be6('0x1f')]],'as':_0x3d1598['as'],'attributes':_0x3d1598[_0x7be6('0x1b')],'include':_0x3d1598[_0x7be6('0x1d')]?_[_0x7be6('0x1e')](_0x3d1598[_0x7be6('0x1d')],function(_0x5b102e){return{'model':db[_0x5b102e[_0x7be6('0x1f')]],'as':_0x5b102e['as'],'attributes':_0x5b102e[_0x7be6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7be6('0xb')](function(_0x2e6a26){logger[_0x7be6('0xc')](_0x7be6('0x15'),_0xbe554d);logger['debug'](_0x7be6('0x15'),_0xbe554d,JSON[_0x7be6('0x20')](_0x2e6a26));_0x1fa4e0(_0x2e6a26);})[_0x7be6('0x14')](function(_0x115a0d){logger[_0x7be6('0x10')]('GetCmHopperBlack',_0x115a0d['message'],_0xbe554d);_0x316336(_0x51b73c[_0x7be6('0x10')](0x1f4,_0x115a0d[_0x7be6('0x12')]));});});};exports[_0x7be6('0x21')]=function(_0x5eae6e){var _0x37f2ed=this;return new Promise(function(_0x218aa6,_0x3378db){return db['CmHopperBlack'][_0x7be6('0x22')](_0x5eae6e['body'],{'raw':_0x5eae6e['options']?_0x5eae6e['options'][_0x7be6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eae6e['options']?_0x5eae6e[_0x7be6('0x18')][_0x7be6('0x1a')]||null:null,'attributes':_0x5eae6e[_0x7be6('0x18')]?_0x5eae6e[_0x7be6('0x18')][_0x7be6('0x1b')]||null:null,'limit':_0x5eae6e[_0x7be6('0x18')]?_0x5eae6e[_0x7be6('0x18')][_0x7be6('0x1c')]||null:null})[_0x7be6('0xb')](function(_0x4cb815){logger[_0x7be6('0xc')]('UpdateCmHopperBlack',_0x5eae6e);logger[_0x7be6('0xe')](_0x7be6('0x21'),_0x5eae6e,JSON[_0x7be6('0x20')](_0x4cb815));_0x218aa6(_0x4cb815);})['catch'](function(_0x3abfbb){logger['error'](_0x7be6('0x21'),_0x3abfbb[_0x7be6('0x12')],_0x5eae6e);_0x3378db(_0x37f2ed[_0x7be6('0x10')](0x1f4,_0x3abfbb[_0x7be6('0x12')]));});});};exports[_0x7be6('0x23')]=function(_0x30bb65){var _0x1b54ae=this;return new Promise(function(_0x274a9e,_0x1b984f){return db[_0x7be6('0x16')][_0x7be6('0x24')]({'where':_0x30bb65['options']?_0x30bb65[_0x7be6('0x18')][_0x7be6('0x1a')]||null:null})['then'](function(_0x2f3277){logger[_0x7be6('0xc')](_0x7be6('0x23'),_0x30bb65);logger[_0x7be6('0xe')](_0x7be6('0x23'),_0x30bb65,JSON['stringify'](_0x2f3277));_0x274a9e(_0x2f3277);})['catch'](function(_0x5a995b){logger[_0x7be6('0x10')](_0x7be6('0x23'),_0x5a995b[_0x7be6('0x12')],_0x30bb65);_0x1b984f(_0x1b54ae['error'](0x1f4,_0x5a995b[_0x7be6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 4d9ab65..a7b9df2 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 _0x0adf=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','get','/describe','describe','/:id','put','update','delete','multer','util'];(function(_0x1b389d,_0x11579d){var _0x4704f2=function(_0x62739f){while(--_0x62739f){_0x1b389d['push'](_0x1b389d['shift']());}};_0x4704f2(++_0x11579d);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x2dab84,_0x469c78){_0x2dab84=_0x2dab84-0x0;var _0x4ae481=_0x0adf[_0x2dab84];return _0x4ae481;};'use strict';var multer=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var path=require(_0xf0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0ad('0x3'));var router=express[_0xf0ad('0x4')]();var fs_extra=require(_0xf0ad('0x5'));var auth=require(_0xf0ad('0x6'));var interaction=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var controller=require(_0xf0ad('0x9'));router['get']('/',auth[_0xf0ad('0xa')](),controller['index']);router[_0xf0ad('0xb')](_0xf0ad('0xc'),auth[_0xf0ad('0xa')](),controller[_0xf0ad('0xd')]);router[_0xf0ad('0xb')](_0xf0ad('0xe'),auth[_0xf0ad('0xa')](),controller['show']);router[_0xf0ad('0xf')]('/:id',auth[_0xf0ad('0xa')](),controller[_0xf0ad('0x10')]);router[_0xf0ad('0x11')](_0xf0ad('0xe'),auth[_0xf0ad('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcaf2=['./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0xd5d4ab,_0x20bf18){var _0x30ca91=function(_0x22dc57){while(--_0x22dc57){_0xd5d4ab['push'](_0xd5d4ab['shift']());}};_0x30ca91(++_0x20bf18);}(_0xcaf2,0x8a));var _0x2caf=function(_0x407b00,_0x3868c1){_0x407b00=_0x407b00-0x0;var _0x2450aa=_0xcaf2[_0x407b00];return _0x2450aa;};'use strict';var multer=require(_0x2caf('0x0'));var util=require('util');var path=require(_0x2caf('0x1'));var timeout=require(_0x2caf('0x2'));var express=require('express');var router=express[_0x2caf('0x3')]();var fs_extra=require(_0x2caf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2caf('0x5'));var config=require('../../config/environment');var controller=require(_0x2caf('0x6'));router[_0x2caf('0x7')]('/',auth[_0x2caf('0x8')](),controller['index']);router[_0x2caf('0x7')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xa')]);router['get'](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xc')]);router[_0x2caf('0xd')](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xe')]);router[_0x2caf('0xf')](_0x2caf('0xb'),auth['isAuthenticated'](),controller[_0x2caf('0x10')]);module[_0x2caf('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 1e8b851..a31f0d6 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 _0xdba8=['endtime','setDataValue','followuptime','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue'];(function(_0x51d656,_0x2d6d0a){var _0x449db0=function(_0x222326){while(--_0x222326){_0x51d656['push'](_0x51d656['shift']());}};_0x449db0(++_0x2d6d0a);}(_0xdba8,0x125));var _0x8dba=function(_0x4578bb,_0x540c03){_0x4578bb=_0x4578bb-0x0;var _0xb3a076=_0xdba8[_0x4578bb];return _0xb3a076;};'use strict';var Sequelize=require(_0x8dba('0x0'));var moment=require(_0x8dba('0x1'));module[_0x8dba('0x2')]={'state':{'type':Sequelize[_0x8dba('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x8dba('0x4')]},'scheduledat':{'type':Sequelize[_0x8dba('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8dba('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x8dba('0x4')]},'originatecalleridname':{'type':Sequelize[_0x8dba('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8dba('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x8dba('0x5')]},'droptime':{'type':Sequelize[_0x8dba('0x5')]},'endtime':{'type':Sequelize[_0x8dba('0x5')]},'ringtime':{'type':Sequelize[_0x8dba('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8dba('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8dba('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8dba('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8dba('0x4')]},'campaign':{'type':Sequelize[_0x8dba('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8dba('0x4')]},'disposition':{'type':Sequelize[_0x8dba('0x4')]},'secondDisposition':{'type':Sequelize[_0x8dba('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8dba('0x4')]},'dispositionat':{'type':Sequelize[_0x8dba('0x5')],'set':function(_0x2d51f3){var _0x22d8ca=this[_0x8dba('0x6')](_0x8dba('0x7'));if(_0x22d8ca&&_0x2d51f3){this[_0x8dba('0x8')](_0x8dba('0x9'),moment(_0x2d51f3)['diff'](moment(_0x22d8ca),_0x8dba('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8dba('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8dba('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x8dba('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x8dba('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8dba('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8dba('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x8dba('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8dba('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xef0b=['BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff'];(function(_0x104504,_0x443c9b){var _0x2f3e8f=function(_0x31c8ca){while(--_0x31c8ca){_0x104504['push'](_0x104504['shift']());}};_0x2f3e8f(++_0x443c9b);}(_0xef0b,0xa6));var _0xbef0=function(_0x2fc44f,_0x378dc5){_0x2fc44f=_0x2fc44f-0x0;var _0x13984c=_0xef0b[_0x2fc44f];return _0x13984c;};'use strict';var Sequelize=require(_0xbef0('0x0'));var moment=require(_0xbef0('0x1'));module[_0xbef0('0x2')]={'state':{'type':Sequelize[_0xbef0('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xbef0('0x4')]},'scheduledat':{'type':Sequelize[_0xbef0('0x5')]},'countbusyretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbef0('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xbef0('0x4')]},'calleridnum':{'type':Sequelize[_0xbef0('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xbef0('0x5')]},'answertime':{'type':Sequelize[_0xbef0('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xbef0('0x4')]},'campaigntype':{'type':Sequelize[_0xbef0('0x4')]},'membername':{'type':Sequelize[_0xbef0('0x4')]},'reason':{'type':Sequelize[_0xbef0('0x4')]},'disposition':{'type':Sequelize[_0xbef0('0x4')]},'secondDisposition':{'type':Sequelize[_0xbef0('0x4')]},'thirdDisposition':{'type':Sequelize[_0xbef0('0x4')]},'dispositionat':{'type':Sequelize[_0xbef0('0x5')],'set':function(_0x4bd1d9){var _0xcedf98=this[_0xbef0('0x6')](_0xbef0('0x7'));if(_0xcedf98&&_0x4bd1d9){this[_0xbef0('0x8')]('followuptime',moment(_0x4bd1d9)[_0xbef0('0x9')](moment(_0xcedf98),'seconds'));}}},'amd':{'type':Sequelize[_0xbef0('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xbef0('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xbef0('0x5')]},'callback':{'type':Sequelize[_0xbef0('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbef0('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbef0('0x5')]},'deleted':{'type':Sequelize[_0xbef0('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xbef0('0x5')]},'recallme':{'type':Sequelize[_0xbef0('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xbef0('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbef0('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbef0('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 0f44f71..ae7f7fe 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 _0x0295=['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','CmHopperFinal','includeAll','rows','catch','show','params','intersection','include','find','describe','body','uniqueid','findAll','sequelize','literal','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','createdAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','CmHopper','findOne','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x5edf0a,_0x16d23b){var _0x253e31=function(_0x4ec803){while(--_0x4ec803){_0x5edf0a['push'](_0x5edf0a['shift']());}};_0x253e31(++_0x16d23b);}(_0x0295,0x1f0));var _0x5029=function(_0x395718,_0x20322d){_0x395718=_0x395718-0x0;var _0x3028b8=_0x0295[_0x395718];return _0x3028b8;};'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['CmHopperFinal'][_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['CmHopperFinal'][_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')]()[_0x5029('0x20')](respondWithResult(_0x2bb7fc,null))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x449ef5,_0x18f1f5){if(_0x449ef5[_0x5029('0x45')][_0x5029('0x46')]){delete _0x449ef5[_0x5029('0x45')][_0x5029('0x46')];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'uniqueid':_0x449ef5[_0x5029('0x40')]['id']}})['then'](handleEntityNotFound(_0x18f1f5,null))[_0x5029('0x20')](saveUpdates(_0x449ef5['body'],null))[_0x5029('0x20')](respondWithResult(_0x18f1f5,null))[_0x5029('0x3e')](handleError(_0x18f1f5,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x5343c6,_0x319bff,_0x5e739d){return db['CmHopperFinal'][_0x5029('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x5343c6[_0x5029('0x40')]['id']},'attributes':[[db[_0x5029('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x5029('0x4a')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x4c')))),_0x5029('0x4d')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')]['literal'](_0x5029('0x4e')))),'busyContacts'],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5029('0x4f')],[db['sequelize']['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x50')))),_0x5029('0x51')],[db['sequelize']['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x2022,\x201,\x20null'))),_0x5029('0x52')],[db[_0x5029('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x53')))),_0x5029('0x54')]]})['then'](handleEntityNotFound(_0x319bff,null))[_0x5029('0x20')](respondWithResult(_0x319bff,null))[_0x5029('0x3e')](handleError(_0x319bff,null));};exports[_0x5029('0x55')]=function(_0x2aebb3,_0x3a82f7,_0x26f56f){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x2aebb3[_0x5029('0x40')]['id']},'attributes':[[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x56')))),_0x5029('0x4a')],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x203,\x201,\x20null'))),_0x5029('0x4d')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x4e')))),_0x5029('0x57')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x58')))),_0x5029('0x59')],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db['sequelize'][_0x5029('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5029('0x4f')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0x5029('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5029('0x51')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')]['literal'](_0x5029('0x5a')))),_0x5029('0x52')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db['sequelize'][_0x5029('0x49')](_0x5029('0x53')))),'answeringMachine']]})[_0x5029('0x20')](handleEntityNotFound(_0x3a82f7,null))[_0x5029('0x20')](respondWithResult(_0x3a82f7,null))[_0x5029('0x3e')](handleError(_0x3a82f7,null));};exports[_0x5029('0x5b')]=function(_0x9b1c13,_0x1bd1c6,_0x5bd84e){return db['VoiceQueue'][_0x5029('0x43')]({'where':{'id':_0x9b1c13['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x1bd1c6,null))[_0x5029('0x20')](function(_0x58db57){var _0x181956;if(_0x58db57){_0x181956=squel['insert']()['into'](_0x5029('0x5c'))[_0x5029('0x5d')]([_0x5029('0x5e'),_0x5029('0x5f'),'ContactId',_0x5029('0x60'),_0x5029('0x61'),'createdAt',_0x5029('0x62')],squel[_0x5029('0x63')]()['field']('ANY_VALUE(calleridnum)','phone')[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x5f'))[_0x5029('0x64')](_0x5029('0x66'),_0x5029('0x67'))[_0x5029('0x64')](_0x5029('0x68'),_0x5029('0x60'))['field']('ANY_VALUE(VoiceQueueId)',_0x5029('0x61'))[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x69'))[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x62'))['from'](_0x5029('0x6a'))[_0x5029('0x38')](_0x5029('0x6b'),_0x9b1c13['params']['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x6d'),_0x9b1c13['body'][_0x5029('0x6e')][_0x5029('0x6c')]())[_0x5029('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x5029('0x38')](_0x5029('0x6f'),squel['select']()[_0x5029('0x64')](_0x5029('0x5e'))[_0x5029('0x70')](_0x5029('0x5c'))[_0x5029('0x38')]('VoiceQueueId\x20=\x20?',_0x9b1c13[_0x5029('0x40')]['id'][_0x5029('0x6c')]()))[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()['field'](_0x5029('0x71'))[_0x5029('0x70')](_0x5029('0x6a'))['where'](_0x5029('0x6b'),_0x9b1c13[_0x5029('0x40')]['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x72')))[_0x5029('0x73')](_0x5029('0x67')))['toString']();return db[_0x5029('0x48')][_0x5029('0x2c')](_0x181956);}return[];})[_0x5029('0x20')](respondWithResult(_0x1bd1c6,null))[_0x5029('0x3e')](handleError(_0x1bd1c6,null));};exports[_0x5029('0x74')]=function(_0x4c40d1,_0x209c83,_0x443070){return db[_0x5029('0x75')]['find']({'where':{'id':_0x4c40d1[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x209c83,null))['then'](function(_0x5c8bd4){var _0x524825;if(_0x5c8bd4){_0x524825=squel[_0x5029('0x76')]()[_0x5029('0x77')](_0x5029('0x5c'))[_0x5029('0x5d')]([_0x5029('0x5e'),'scheduledAt',_0x5029('0x67'),_0x5029('0x60'),_0x5029('0x78'),'createdAt','updatedAt'],squel[_0x5029('0x63')]()[_0x5029('0x64')](_0x5029('0x79'),_0x5029('0x5e'))['field'](_0x5029('0x65'),_0x5029('0x5f'))[_0x5029('0x64')](_0x5029('0x66'),_0x5029('0x67'))[_0x5029('0x64')](_0x5029('0x68'),_0x5029('0x60'))['field'](_0x5029('0x7a'),'CampaignId')['field'](_0x5029('0x65'),'createdAt')[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x62'))[_0x5029('0x70')](_0x5029('0x6a'))[_0x5029('0x38')](_0x5029('0x7b'),_0x4c40d1[_0x5029('0x40')]['id']['toString']())['where'](_0x5029('0x6d'),_0x4c40d1['body']['state'][_0x5029('0x6c')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()[_0x5029('0x64')](_0x5029('0x5e'))['from'](_0x5029('0x5c'))[_0x5029('0x38')](_0x5029('0x7b'),_0x4c40d1['params']['id'][_0x5029('0x6c')]()))[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()[_0x5029('0x64')]('calleridnum')['from'](_0x5029('0x6a'))[_0x5029('0x38')]('CampaignId\x20=\x20?',_0x4c40d1[_0x5029('0x40')]['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x72')))[_0x5029('0x73')](_0x5029('0x67')))[_0x5029('0x6c')]();return db[_0x5029('0x48')]['query'](_0x524825);}return[];})['then'](respondWithResult(_0x209c83,null))[_0x5029('0x3e')](handleError(_0x209c83,null));};exports['checkContactHopper']=function(_0x20a259,_0x5e5f88,_0x36fdce){return db[_0x5029('0x7c')][_0x5029('0x7d')]({'where':{'VoiceQueueId':_0x20a259['body'][_0x5029('0x61')],'CampaignId':_0x20a259[_0x5029('0x45')][_0x5029('0x78')],'ContactId':_0x20a259['body'][_0x5029('0x67')]}})[_0x5029('0x20')](handleEntityNotFound(_0x5e5f88,null))[_0x5029('0x20')](function(_0x4421bd){if(_0x4421bd){return _0x4421bd;}return null;})[_0x5029('0x20')](respondWithResult(_0x5e5f88,null))[_0x5029('0x3e')](handleError(_0x5e5f88,null));}; \ No newline at end of file +var _0xeff8=['eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','noAnswerContacts','`state`\x20=\x2011\x20,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','toString','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne'];(function(_0x2a46ae,_0x2490f4){var _0x4e0564=function(_0x578e7e){while(--_0x578e7e){_0x2a46ae['push'](_0x2a46ae['shift']());}};_0x4e0564(++_0x2490f4);}(_0xeff8,0x186));var _0x8eff=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0xeff8[_0x52085a];return _0x5afc1a;};'use strict';var emlformat=require(_0x8eff('0x0'));var rimraf=require(_0x8eff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eff('0x2'));var rp=require(_0x8eff('0x3'));var moment=require(_0x8eff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8eff('0x5'));var util=require(_0x8eff('0x6'));var path=require(_0x8eff('0x7'));var sox=require(_0x8eff('0x8'));var csv=require('to-csv');var ejs=require(_0x8eff('0x9'));var fs=require('fs');var fs_extra=require(_0x8eff('0xa'));var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0xf'));var querystring=require(_0x8eff('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x11'));var qs=require(_0x8eff('0x12'));var as=require(_0x8eff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x14'))(_0x8eff('0x15'));var utils=require('../../config/utils');var config=require(_0x8eff('0x16'));var licenseUtil=require(_0x8eff('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xcc;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0x18')](_0x45f280);}return _0x4a399e[_0x8eff('0x19')](_0x45f280)[_0x8eff('0x1a')]();};}function respondWithResult(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0xc8;return function(_0x212a2e){if(_0x212a2e){return _0x56efdf[_0x8eff('0x19')](_0x3e7c01)[_0x8eff('0x1b')](_0x212a2e);}};}function respondWithFilteredResult(_0x228eb1,_0x4cfc91){return function(_0x16202e){if(_0x16202e){var _0xdbb753=typeof _0x4cfc91[_0x8eff('0x1c')]===_0x8eff('0x1d')&&typeof _0x4cfc91[_0x8eff('0x1e')]==='undefined';var _0x32b791=_0x16202e[_0x8eff('0x1f')];var _0x3cd1dc=_0xdbb753?0x0:_0x4cfc91[_0x8eff('0x1c')];var _0x2cd7c5=_0xdbb753?_0x16202e[_0x8eff('0x1f')]:_0x4cfc91[_0x8eff('0x1c')]+_0x4cfc91[_0x8eff('0x1e')];var _0x1b003c;if(_0x2cd7c5>=_0x32b791){_0x2cd7c5=_0x32b791;_0x1b003c=0xc8;}else{_0x1b003c=0xce;}_0x228eb1[_0x8eff('0x19')](_0x1b003c);return _0x228eb1[_0x8eff('0x20')](_0x8eff('0x21'),_0x3cd1dc+'-'+_0x2cd7c5+'/'+_0x32b791)[_0x8eff('0x1b')](_0x16202e);}return null;};}function patchUpdates(_0x2a7337){return function(_0xdbb7b5){try{jsonpatch[_0x8eff('0x22')](_0xdbb7b5,_0x2a7337,!![]);}catch(_0x5e157c){return BPromise[_0x8eff('0x23')](_0x5e157c);}return _0xdbb7b5[_0x8eff('0x24')]();};}function saveUpdates(_0x5a2492,_0x1c4ad3){return function(_0x5ea31f){if(_0x5ea31f){return _0x5ea31f[_0x8eff('0x25')](_0x5a2492)[_0x8eff('0x26')](function(_0x1ccc79){return _0x1ccc79;});}return null;};}function removeEntity(_0x59cc32,_0x1ee09c){return function(_0x4e891c){if(_0x4e891c){return _0x4e891c[_0x8eff('0x27')]()[_0x8eff('0x26')](function(){_0x59cc32['status'](0xcc)[_0x8eff('0x1a')]();});}};}function handleEntityNotFound(_0x5ec3d7,_0x40404b){return function(_0x3b698b){if(!_0x3b698b){_0x5ec3d7[_0x8eff('0x18')](0x194);}return _0x3b698b;};}function handleError(_0x41324b,_0x6359df){_0x6359df=_0x6359df||0x1f4;return function(_0x2e8067){logger['error'](_0x2e8067[_0x8eff('0x28')]);if(_0x2e8067[_0x8eff('0x29')]){delete _0x2e8067[_0x8eff('0x29')];}_0x41324b[_0x8eff('0x19')](_0x6359df)[_0x8eff('0x2a')](_0x2e8067);};}exports[_0x8eff('0x2b')]=function(_0x4cc146,_0x4ed3b8){var _0x44dcdb={},_0x472b19={},_0x17ff3f={'count':0x0,'rows':[]};var _0x5ce071=_[_0x8eff('0x2c')](db[_0x8eff('0x2d')][_0x8eff('0x2e')],function(_0x1da0fa){return{'name':_0x1da0fa[_0x8eff('0x2f')],'type':_0x1da0fa[_0x8eff('0x30')][_0x8eff('0x31')]};});_0x472b19[_0x8eff('0x32')]=_[_0x8eff('0x2c')](_0x5ce071,_0x8eff('0x29'));_0x472b19[_0x8eff('0x33')]=_[_0x8eff('0x34')](_0x4cc146['query']);_0x472b19[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],_0x472b19[_0x8eff('0x33')]);_0x44dcdb['attributes']=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],qs['fields'](_0x4cc146['query'][_0x8eff('0x37')]));_0x44dcdb[_0x8eff('0x38')]=_0x44dcdb['attributes']['length']?_0x44dcdb['attributes']:_0x472b19[_0x8eff('0x32')];if(!_0x4cc146['query'][_0x8eff('0x39')]('nolimit')){_0x44dcdb[_0x8eff('0x1e')]=qs[_0x8eff('0x1e')](_0x4cc146[_0x8eff('0x33')][_0x8eff('0x1e')]);_0x44dcdb[_0x8eff('0x1c')]=qs[_0x8eff('0x1c')](_0x4cc146['query'][_0x8eff('0x1c')]);}_0x44dcdb['order']=qs[_0x8eff('0x3a')](_0x4cc146['query'][_0x8eff('0x3a')]);_0x44dcdb[_0x8eff('0x3b')]=qs[_0x8eff('0x35')](_[_0x8eff('0x3c')](_0x4cc146['query'],_0x472b19[_0x8eff('0x35')]),_0x5ce071);if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x3d')]){_0x44dcdb['where']=_[_0x8eff('0x3e')](_0x44dcdb[_0x8eff('0x3b')],{'$or':_[_0x8eff('0x2c')](_0x5ce071,function(_0x345bc7){if(_0x345bc7[_0x8eff('0x30')]!==_0x8eff('0x3f')){var _0x29f68e={};_0x29f68e[_0x345bc7[_0x8eff('0x29')]]={'$like':'%'+_0x4cc146[_0x8eff('0x33')]['filter']+'%'};return _0x29f68e;}})});}_0x44dcdb=_['merge']({},_0x44dcdb,_0x4cc146[_0x8eff('0x40')]);var _0x114f8e={'where':_0x44dcdb[_0x8eff('0x3b')]};return db[_0x8eff('0x2d')][_0x8eff('0x1f')](_0x114f8e)[_0x8eff('0x26')](function(_0x18b132){_0x17ff3f['count']=_0x18b132;if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x41')]){_0x44dcdb['include']=[{'all':!![]}];}return db[_0x8eff('0x2d')][_0x8eff('0x42')](_0x44dcdb);})[_0x8eff('0x26')](function(_0x18309b){_0x17ff3f[_0x8eff('0x43')]=_0x18309b;return _0x17ff3f;})[_0x8eff('0x26')](respondWithFilteredResult(_0x4ed3b8,_0x44dcdb))[_0x8eff('0x44')](handleError(_0x4ed3b8,null));};exports[_0x8eff('0x45')]=function(_0x6d0568,_0x480c4c){var _0x37f376={'raw':!![],'where':{'id':_0x6d0568[_0x8eff('0x46')]['id']}},_0x27a8c9={};_0x27a8c9[_0x8eff('0x32')]=_[_0x8eff('0x34')](db['CmHopperFinal'][_0x8eff('0x2e')]);_0x27a8c9['query']=_[_0x8eff('0x34')](_0x6d0568[_0x8eff('0x33')]);_0x27a8c9[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x27a8c9['model'],_0x27a8c9[_0x8eff('0x33')]);_0x37f376[_0x8eff('0x38')]=_[_0x8eff('0x36')](_0x27a8c9['model'],qs['fields'](_0x6d0568[_0x8eff('0x33')][_0x8eff('0x37')]));_0x37f376[_0x8eff('0x38')]=_0x37f376[_0x8eff('0x38')][_0x8eff('0x47')]?_0x37f376['attributes']:_0x27a8c9[_0x8eff('0x32')];if(_0x6d0568['query'][_0x8eff('0x41')]){_0x37f376[_0x8eff('0x48')]=[{'all':!![]}];}_0x37f376=_['merge']({},_0x37f376,_0x6d0568['options']);return db['CmHopperFinal']['find'](_0x37f376)['then'](handleEntityNotFound(_0x480c4c,null))['then'](respondWithResult(_0x480c4c,null))[_0x8eff('0x44')](handleError(_0x480c4c,null));};exports[_0x8eff('0x49')]=function(_0x33aa8d,_0x1b5fda){return db[_0x8eff('0x2d')][_0x8eff('0x49')]()[_0x8eff('0x26')](respondWithResult(_0x1b5fda,null))[_0x8eff('0x44')](handleError(_0x1b5fda,null));};exports[_0x8eff('0x25')]=function(_0x3287d6,_0x4c7013){if(_0x3287d6[_0x8eff('0x4a')]['uniqueid']){delete _0x3287d6[_0x8eff('0x4a')][_0x8eff('0x4b')];}return db[_0x8eff('0x2d')][_0x8eff('0x4c')]({'where':{'uniqueid':_0x3287d6[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x4c7013,null))[_0x8eff('0x26')](saveUpdates(_0x3287d6[_0x8eff('0x4a')],null))[_0x8eff('0x26')](respondWithResult(_0x4c7013,null))[_0x8eff('0x44')](handleError(_0x4c7013,null));};exports[_0x8eff('0x4d')]=function(_0x452f7a,_0x47b28d,_0x13ae7c){return db[_0x8eff('0x2d')][_0x8eff('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x452f7a[_0x8eff('0x46')]['id']},'attributes':[[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x51')))),'noAnswerContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db['sequelize'][_0x8eff('0x50')](_0x8eff('0x52')))),_0x8eff('0x53')],[db[_0x8eff('0x4e')]['fn']('COUNT',db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x54')))),_0x8eff('0x55')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x56')))),_0x8eff('0x57')],[db[_0x8eff('0x4e')]['fn']('COUNT',db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x8eff('0x58')],[db['sequelize']['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x59')))),_0x8eff('0x5a')],[db[_0x8eff('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eff('0x4e')]['literal'](_0x8eff('0x5b')))),_0x8eff('0x5c')]]})[_0x8eff('0x26')](handleEntityNotFound(_0x47b28d,null))[_0x8eff('0x26')](respondWithResult(_0x47b28d,null))[_0x8eff('0x44')](handleError(_0x47b28d,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x4064bd,_0x36afc3,_0x1813df){return db[_0x8eff('0x2d')][_0x8eff('0x42')]({'raw':![],'where':{'CampaignId':_0x4064bd[_0x8eff('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0x8eff('0x5d')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x51')))),_0x8eff('0x5e')],[db['sequelize']['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0x8eff('0x50')](_0x8eff('0x52')))),'busyContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0x8eff('0x55')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x56')))),'dropContacts'],[db['sequelize']['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x5f')))),_0x8eff('0x58')],[db[_0x8eff('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eff('0x4e')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x5b')))),_0x8eff('0x5c')]]})[_0x8eff('0x26')](handleEntityNotFound(_0x36afc3,null))['then'](respondWithResult(_0x36afc3,null))[_0x8eff('0x44')](handleError(_0x36afc3,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x42efc6,_0x35a221,_0x12ebd1){return db[_0x8eff('0x60')][_0x8eff('0x4c')]({'where':{'id':_0x42efc6[_0x8eff('0x46')]['id']}})['then'](handleEntityNotFound(_0x35a221,null))[_0x8eff('0x26')](function(_0x545fcf){var _0x1d8d8f;if(_0x545fcf){_0x1d8d8f=squel[_0x8eff('0x61')]()[_0x8eff('0x62')](_0x8eff('0x63'))[_0x8eff('0x64')]([_0x8eff('0x65'),_0x8eff('0x66'),_0x8eff('0x67'),_0x8eff('0x68'),'VoiceQueueId',_0x8eff('0x69'),_0x8eff('0x6a')],squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')](_0x8eff('0x6d'),_0x8eff('0x65'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x66'))[_0x8eff('0x6c')]('ANY_VALUE(ContactId)','ContactId')['field']('ANY_VALUE(ListId)',_0x8eff('0x68'))[_0x8eff('0x6c')](_0x8eff('0x6f'),_0x8eff('0x70'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x69'))['field'](_0x8eff('0x6e'),_0x8eff('0x6a'))[_0x8eff('0x71')](_0x8eff('0x72'))['where'](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id']['toString']())[_0x8eff('0x3b')](_0x8eff('0x74'),_0x42efc6[_0x8eff('0x4a')]['state']['toString']())['where'](_0x8eff('0x75'))[_0x8eff('0x3b')](_0x8eff('0x76'),squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')](_0x8eff('0x65'))[_0x8eff('0x71')](_0x8eff('0x63'))[_0x8eff('0x3b')](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id']['toString']()))[_0x8eff('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')]('calleridnum')[_0x8eff('0x71')]('cm_hopper_final')[_0x8eff('0x3b')](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id'][_0x8eff('0x77')]())[_0x8eff('0x3b')]('state\x20=\x204'))[_0x8eff('0x78')](_0x8eff('0x67')))[_0x8eff('0x77')]();return db[_0x8eff('0x4e')][_0x8eff('0x33')](_0x1d8d8f);}return[];})[_0x8eff('0x26')](respondWithResult(_0x35a221,null))[_0x8eff('0x44')](handleError(_0x35a221,null));};exports[_0x8eff('0x79')]=function(_0x23a771,_0x452b90,_0x43bbce){return db['Campaign'][_0x8eff('0x4c')]({'where':{'id':_0x23a771[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x452b90,null))[_0x8eff('0x26')](function(_0x17f63b){var _0x582478;if(_0x17f63b){_0x582478=squel[_0x8eff('0x61')]()[_0x8eff('0x62')]('cm_hopper')['fromQuery']([_0x8eff('0x65'),_0x8eff('0x66'),_0x8eff('0x67'),_0x8eff('0x68'),_0x8eff('0x7a'),_0x8eff('0x69'),'updatedAt'],squel[_0x8eff('0x6b')]()['field'](_0x8eff('0x6d'),_0x8eff('0x65'))['field'](_0x8eff('0x6e'),'scheduledAt')['field'](_0x8eff('0x7b'),'ContactId')[_0x8eff('0x6c')](_0x8eff('0x7c'),'ListId')[_0x8eff('0x6c')](_0x8eff('0x7d'),'CampaignId')[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x69'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x6a'))[_0x8eff('0x71')](_0x8eff('0x72'))[_0x8eff('0x3b')]('CampaignId\x20=\x20?',_0x23a771['params']['id']['toString']())[_0x8eff('0x3b')](_0x8eff('0x74'),_0x23a771[_0x8eff('0x4a')]['state'][_0x8eff('0x77')]())[_0x8eff('0x3b')](_0x8eff('0x75'))[_0x8eff('0x3b')](_0x8eff('0x76'),squel[_0x8eff('0x6b')]()['field'](_0x8eff('0x65'))['from'](_0x8eff('0x63'))[_0x8eff('0x3b')](_0x8eff('0x7e'),_0x23a771[_0x8eff('0x46')]['id'][_0x8eff('0x77')]()))[_0x8eff('0x3b')](_0x8eff('0x76'),squel['select']()[_0x8eff('0x6c')](_0x8eff('0x7f'))[_0x8eff('0x71')](_0x8eff('0x72'))[_0x8eff('0x3b')]('CampaignId\x20=\x20?',_0x23a771[_0x8eff('0x46')]['id'][_0x8eff('0x77')]())[_0x8eff('0x3b')]('state\x20=\x204'))['group'](_0x8eff('0x67')))[_0x8eff('0x77')]();return db[_0x8eff('0x4e')]['query'](_0x582478);}return[];})[_0x8eff('0x26')](respondWithResult(_0x452b90,null))['catch'](handleError(_0x452b90,null));};exports['checkContactHopper']=function(_0x10b9ac,_0x6bc93b,_0x10ade6){return db[_0x8eff('0x80')][_0x8eff('0x81')]({'where':{'VoiceQueueId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x70')],'CampaignId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x7a')],'ContactId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x67')]}})[_0x8eff('0x26')](handleEntityNotFound(_0x6bc93b,null))['then'](function(_0x34a0f7){if(_0x34a0f7){return _0x34a0f7;}return null;})[_0x8eff('0x26')](respondWithResult(_0x6bc93b,null))[_0x8eff('0x44')](handleError(_0x6bc93b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 3db3ae9..2a09df9 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 _0x7331=['exports','define','CmHopperFinal','calleridnum','uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x4d5d1e,_0x6e992b){var _0x498465=function(_0x440a82){while(--_0x440a82){_0x4d5d1e['push'](_0x4d5d1e['shift']());}};_0x498465(++_0x6e992b);}(_0x7331,0x1b7));var _0x1733=function(_0x41bce7,_0x42ba8f){_0x41bce7=_0x41bce7-0x0;var _0x45fe2e=_0x7331[_0x41bce7];return _0x45fe2e;};'use strict';var _=require('lodash');var util=require(_0x1733('0x0'));var logger=require(_0x1733('0x1'))(_0x1733('0x2'));var moment=require(_0x1733('0x3'));var BPromise=require('bluebird');var rp=require(_0x1733('0x4'));var fs=require('fs');var path=require(_0x1733('0x5'));var rimraf=require(_0x1733('0x6'));var config=require(_0x1733('0x7'));var attributes=require(_0x1733('0x8'));module[_0x1733('0x9')]=function(_0x28e609,_0x367d41){return _0x28e609[_0x1733('0xa')](_0x1733('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x1733('0xc')]},{'name':_0x1733('0xd'),'fields':[_0x1733('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7d7=['moment','request-promise','path','rimraf','./cmHopperFinal.attributes','exports','define','calleridnum','uniqueid','lodash','../../config/logger','api'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xf7d7,0x17d));var _0x7f7d=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xf7d7[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x7f7d('0x0'));var util=require('util');var logger=require(_0x7f7d('0x1'))(_0x7f7d('0x2'));var moment=require(_0x7f7d('0x3'));var BPromise=require('bluebird');var rp=require(_0x7f7d('0x4'));var fs=require('fs');var path=require(_0x7f7d('0x5'));var rimraf=require(_0x7f7d('0x6'));var config=require('../../config/environment');var attributes=require(_0x7f7d('0x7'));module[_0x7f7d('0x8')]=function(_0x4f7618,_0x347aba){return _0x4f7618[_0x7f7d('0x9')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x7f7d('0xa'),'fields':['calleridnum']},{'name':_0x7f7d('0xb'),'fields':[_0x7f7d('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 eb00e1f..c9ed162 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(_0x278f76,_0x138533){var _0x28e38b=function(_0x262064){while(--_0x262064){_0x278f76['push'](_0x278f76['shift']());}};_0x28e38b(++_0x138533);}(_0xb10b,0x12a));var _0xbb10=function(_0x21a0cb,_0x5a4cc5){_0x21a0cb=_0x21a0cb-0x0;var _0x2e9bb4=_0xb10b[_0x21a0cb];return _0x2e9bb4;};'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(_0x4c72f3,_0x243a08){var _0x19bf85=function(_0x450442){while(--_0x450442){_0x4c72f3['push'](_0x4c72f3['shift']());}};_0x19bf85(++_0x243a08);}(_0xb10b,0x12a));var _0xbb10=function(_0x57b5d5,_0x25b4ee){_0x57b5d5=_0x57b5d5-0x0;var _0x24e2b5=_0xb10b[_0x57b5d5];return _0x24e2b5;};'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 38bb614..34930ae 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 _0xa35e=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','post','/checkContactHopper','checkContactHopper','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0xa35e,0x111));var _0xea35=function(_0x31dd7d,_0x41e269){_0x31dd7d=_0x31dd7d-0x0;var _0x3f8100=_0xa35e[_0x31dd7d];return _0x3f8100;};'use strict';var multer=require(_0xea35('0x0'));var util=require('util');var path=require(_0xea35('0x1'));var timeout=require(_0xea35('0x2'));var express=require(_0xea35('0x3'));var router=express[_0xea35('0x4')]();var fs_extra=require(_0xea35('0x5'));var auth=require(_0xea35('0x6'));var interaction=require(_0xea35('0x7'));var config=require(_0xea35('0x8'));var controller=require(_0xea35('0x9'));router[_0xea35('0xa')]('/',auth[_0xea35('0xb')](),controller[_0xea35('0xc')]);router[_0xea35('0xa')](_0xea35('0xd'),auth['isAuthenticated'](),controller[_0xea35('0xe')]);router[_0xea35('0xa')](_0xea35('0xf'),auth['isAuthenticated'](),controller[_0xea35('0x10')]);router[_0xea35('0xa')](_0xea35('0x11'),auth['isAuthenticated'](),controller[_0xea35('0x12')]);router[_0xea35('0xa')](_0xea35('0x13'),auth[_0xea35('0xb')](),controller[_0xea35('0x14')]);router['post'](_0xea35('0x15'),auth[_0xea35('0xb')](),controller[_0xea35('0x16')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0xea35('0xb')](),controller[_0xea35('0x17')]);router[_0xea35('0x18')](_0xea35('0x19'),auth['isAuthenticated'](),controller[_0xea35('0x1a')]);router['put'](_0xea35('0xf'),auth[_0xea35('0xb')](),controller['update']);module[_0xea35('0x1b')]=router; \ No newline at end of file +var _0x23c8=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','put','update','multer','util','path','connect-timeout','Router'];(function(_0x568bd6,_0x31ebb3){var _0x3e5d0d=function(_0x5aeab5){while(--_0x5aeab5){_0x568bd6['push'](_0x568bd6['shift']());}};_0x3e5d0d(++_0x31ebb3);}(_0x23c8,0xca));var _0x823c=function(_0x3377bd,_0xd90a06){_0x3377bd=_0x3377bd-0x0;var _0x10365a=_0x23c8[_0x3377bd];return _0x10365a;};'use strict';var multer=require(_0x823c('0x0'));var util=require(_0x823c('0x1'));var path=require(_0x823c('0x2'));var timeout=require(_0x823c('0x3'));var express=require('express');var router=express[_0x823c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x823c('0x5'));var config=require(_0x823c('0x6'));var controller=require(_0x823c('0x7'));router[_0x823c('0x8')]('/',auth[_0x823c('0x9')](),controller[_0x823c('0xa')]);router[_0x823c('0x8')](_0x823c('0xb'),auth['isAuthenticated'](),controller[_0x823c('0xc')]);router[_0x823c('0x8')](_0x823c('0xd'),auth[_0x823c('0x9')](),controller[_0x823c('0xe')]);router['get'](_0x823c('0xf'),auth[_0x823c('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x823c('0x8')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x823c('0x10')]);router[_0x823c('0x11')](_0x823c('0x12'),auth['isAuthenticated'](),controller[_0x823c('0x13')]);router['post'](_0x823c('0x14'),auth[_0x823c('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router['post']('/checkContactHopper',auth[_0x823c('0x9')](),controller['checkContactHopper']);router[_0x823c('0x15')](_0x823c('0xd'),auth[_0x823c('0x9')](),controller[_0x823c('0x16')]);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 8bfbdf9..c35c026 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 _0x1753=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x8133ca,_0x3b2efc){var _0x225e17=function(_0xeab268){while(--_0xeab268){_0x8133ca['push'](_0x8133ca['shift']());}};_0x225e17(++_0x3b2efc);}(_0x1753,0x1cb));var _0x3175=function(_0x464aa8,_0x2b56e0){_0x464aa8=_0x464aa8-0x0;var _0x2fdb41=_0x1753[_0x464aa8];return _0x2fdb41;};'use strict';var Sequelize=require(_0x3175('0x0'));module[_0x3175('0x1')]={'state':{'type':Sequelize[_0x3175('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3175('0x3')]},'scheduledat':{'type':Sequelize[_0x3175('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3175('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3175('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3175('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3175('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x3175('0x3')]},'originatecalleridname':{'type':Sequelize[_0x3175('0x3')]},'calleridnum':{'type':Sequelize[_0x3175('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3175('0x4')]},'answertime':{'type':Sequelize[_0x3175('0x4')]},'droptime':{'type':Sequelize[_0x3175('0x4')]},'endtime':{'type':Sequelize[_0x3175('0x4')]},'ringtime':{'type':Sequelize[_0x3175('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3175('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3175('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3175('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x3175('0x3')]},'campaigntype':{'type':Sequelize[_0x3175('0x3')]},'membername':{'type':Sequelize[_0x3175('0x3')]},'reason':{'type':Sequelize[_0x3175('0x3')]},'amd':{'type':Sequelize[_0x3175('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3175('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3175('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3175('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3175('0x4')]},'recallme':{'type':Sequelize[_0x3175('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x3175('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3175('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3175('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3175('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3175('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3175('0x3')]}}; \ No newline at end of file +var _0xcd15=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x59b48b,_0x584733){var _0x4c3f79=function(_0x3f2e94){while(--_0x3f2e94){_0x59b48b['push'](_0x59b48b['shift']());}};_0x4c3f79(++_0x584733);}(_0xcd15,0xf6));var _0x5cd1=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0xcd15[_0x10df1e];return _0x3e24fb;};'use strict';var Sequelize=require(_0x5cd1('0x0'));module[_0x5cd1('0x1')]={'state':{'type':Sequelize[_0x5cd1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5cd1('0x3')]},'scheduledat':{'type':Sequelize[_0x5cd1('0x4')]},'countbusyretry':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x5cd1('0x3')]},'originatecalleridname':{'type':Sequelize[_0x5cd1('0x3')]},'calleridnum':{'type':Sequelize[_0x5cd1('0x3')]},'calleridname':{'type':Sequelize[_0x5cd1('0x3')]},'starttime':{'type':Sequelize[_0x5cd1('0x4')]},'responsetime':{'type':Sequelize[_0x5cd1('0x4')]},'answertime':{'type':Sequelize[_0x5cd1('0x4')]},'droptime':{'type':Sequelize[_0x5cd1('0x4')]},'endtime':{'type':Sequelize[_0x5cd1('0x4')]},'ringtime':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5cd1('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x5cd1('0x3')]},'membername':{'type':Sequelize[_0x5cd1('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x5cd1('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5cd1('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x5cd1('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5cd1('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5cd1('0x4')]},'recallme':{'type':Sequelize[_0x5cd1('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5cd1('0x4')]},'edited':{'type':Sequelize[_0x5cd1('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5cd1('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5cd1('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index c7c4e8f..ec247c6 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 _0x6f35=['params','keys','rawAttributes','intersection','find','create','describe','body','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','error','send','index','map','CmHopperHistory','fieldName','type','key','model','name','query','filters','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x1a680b,_0x4b1b16){var _0xc76ec=function(_0x3fcc93){while(--_0x3fcc93){_0x1a680b['push'](_0x1a680b['shift']());}};_0xc76ec(++_0x4b1b16);}(_0x6f35,0x97));var _0x56f3=function(_0x35d83a,_0x4fccb3){_0x35d83a=_0x35d83a-0x0;var _0x23dfb0=_0x6f35[_0x35d83a];return _0x23dfb0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56f3('0x0'));var zipdir=require(_0x56f3('0x1'));var jsonpatch=require(_0x56f3('0x2'));var rp=require(_0x56f3('0x3'));var moment=require(_0x56f3('0x4'));var BPromise=require(_0x56f3('0x5'));var Mustache=require('mustache');var util=require(_0x56f3('0x6'));var path=require(_0x56f3('0x7'));var sox=require(_0x56f3('0x8'));var csv=require(_0x56f3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x56f3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56f3('0xb'));var toCsv=require(_0x56f3('0x9'));var querystring=require('querystring');var Papa=require(_0x56f3('0xc'));var Redis=require(_0x56f3('0xd'));var authService=require(_0x56f3('0xe'));var qs=require(_0x56f3('0xf'));var as=require(_0x56f3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x56f3('0x11'))('api');var utils=require(_0x56f3('0x12'));var config=require(_0x56f3('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x56f3('0x14'))['db'];function respondWithStatusCode(_0xcb8ff3,_0x54d752){_0x54d752=_0x54d752||0xcc;return function(_0x2a2ac6){if(_0x2a2ac6){return _0xcb8ff3[_0x56f3('0x15')](_0x54d752);}return _0xcb8ff3[_0x56f3('0x16')](_0x54d752)[_0x56f3('0x17')]();};}function respondWithResult(_0x1a6a9b,_0x46ddc7){_0x46ddc7=_0x46ddc7||0xc8;return function(_0x8bb4bc){if(_0x8bb4bc){return _0x1a6a9b[_0x56f3('0x16')](_0x46ddc7)[_0x56f3('0x18')](_0x8bb4bc);}};}function respondWithFilteredResult(_0x13c029,_0xe6de91){return function(_0x15e33b){if(_0x15e33b){var _0x3e302e=typeof _0xe6de91[_0x56f3('0x19')]===_0x56f3('0x1a')&&typeof _0xe6de91['limit']==='undefined';var _0x3e6621=_0x15e33b[_0x56f3('0x1b')];var _0x50073b=_0x3e302e?0x0:_0xe6de91['offset'];var _0x3f3115=_0x3e302e?_0x15e33b['count']:_0xe6de91[_0x56f3('0x19')]+_0xe6de91['limit'];var _0x42d678;if(_0x3f3115>=_0x3e6621){_0x3f3115=_0x3e6621;_0x42d678=0xc8;}else{_0x42d678=0xce;}_0x13c029[_0x56f3('0x16')](_0x42d678);return _0x13c029[_0x56f3('0x1c')](_0x56f3('0x1d'),_0x50073b+'-'+_0x3f3115+'/'+_0x3e6621)[_0x56f3('0x18')](_0x15e33b);}return null;};}function patchUpdates(_0x5a4a44){return function(_0xd4f58d){try{jsonpatch[_0x56f3('0x1e')](_0xd4f58d,_0x5a4a44,!![]);}catch(_0x14137c){return BPromise[_0x56f3('0x1f')](_0x14137c);}return _0xd4f58d[_0x56f3('0x20')]();};}function saveUpdates(_0x520aa0,_0xe703db){return function(_0x50eb62){if(_0x50eb62){return _0x50eb62['update'](_0x520aa0)[_0x56f3('0x21')](function(_0x596650){return _0x596650;});}return null;};}function removeEntity(_0x1138fa,_0x594df2){return function(_0x29a682){if(_0x29a682){return _0x29a682['destroy']()['then'](function(){_0x1138fa[_0x56f3('0x16')](0xcc)[_0x56f3('0x17')]();});}};}function handleEntityNotFound(_0x22f30b,_0x13e770){return function(_0x38606e){if(!_0x38606e){_0x22f30b[_0x56f3('0x15')](0x194);}return _0x38606e;};}function handleError(_0x1b8f00,_0x15ef4f){_0x15ef4f=_0x15ef4f||0x1f4;return function(_0x3067b3){logger[_0x56f3('0x22')](_0x3067b3['stack']);if(_0x3067b3['name']){delete _0x3067b3['name'];}_0x1b8f00[_0x56f3('0x16')](_0x15ef4f)[_0x56f3('0x23')](_0x3067b3);};}exports[_0x56f3('0x24')]=function(_0x52e94a,_0x47e0a0){var _0x1f6f27={},_0x402b4a={},_0x428260={'count':0x0,'rows':[]};var _0x117c10=_[_0x56f3('0x25')](db[_0x56f3('0x26')]['rawAttributes'],function(_0x1b4468){return{'name':_0x1b4468[_0x56f3('0x27')],'type':_0x1b4468[_0x56f3('0x28')][_0x56f3('0x29')]};});_0x402b4a[_0x56f3('0x2a')]=_[_0x56f3('0x25')](_0x117c10,_0x56f3('0x2b'));_0x402b4a[_0x56f3('0x2c')]=_['keys'](_0x52e94a[_0x56f3('0x2c')]);_0x402b4a[_0x56f3('0x2d')]=_['intersection'](_0x402b4a[_0x56f3('0x2a')],_0x402b4a[_0x56f3('0x2c')]);_0x1f6f27[_0x56f3('0x2e')]=_['intersection'](_0x402b4a[_0x56f3('0x2a')],qs['fields'](_0x52e94a[_0x56f3('0x2c')][_0x56f3('0x2f')]));_0x1f6f27[_0x56f3('0x2e')]=_0x1f6f27['attributes'][_0x56f3('0x30')]?_0x1f6f27[_0x56f3('0x2e')]:_0x402b4a[_0x56f3('0x2a')];if(!_0x52e94a[_0x56f3('0x2c')]['hasOwnProperty'](_0x56f3('0x31'))){_0x1f6f27[_0x56f3('0x32')]=qs[_0x56f3('0x32')](_0x52e94a[_0x56f3('0x2c')]['limit']);_0x1f6f27[_0x56f3('0x19')]=qs[_0x56f3('0x19')](_0x52e94a[_0x56f3('0x2c')][_0x56f3('0x19')]);}_0x1f6f27['order']=qs[_0x56f3('0x33')](_0x52e94a[_0x56f3('0x2c')][_0x56f3('0x33')]);_0x1f6f27[_0x56f3('0x34')]=qs[_0x56f3('0x2d')](_[_0x56f3('0x35')](_0x52e94a[_0x56f3('0x2c')],_0x402b4a[_0x56f3('0x2d')]),_0x117c10);if(_0x52e94a[_0x56f3('0x2c')][_0x56f3('0x36')]){_0x1f6f27[_0x56f3('0x34')]=_[_0x56f3('0x37')](_0x1f6f27[_0x56f3('0x34')],{'$or':_[_0x56f3('0x25')](_0x117c10,function(_0x43c4f6){if(_0x43c4f6[_0x56f3('0x28')]!=='VIRTUAL'){var _0x49cf8a={};_0x49cf8a[_0x43c4f6[_0x56f3('0x2b')]]={'$like':'%'+_0x52e94a[_0x56f3('0x2c')][_0x56f3('0x36')]+'%'};return _0x49cf8a;}})});}_0x1f6f27=_['merge']({},_0x1f6f27,_0x52e94a[_0x56f3('0x38')]);var _0x3ff39d={'where':_0x1f6f27[_0x56f3('0x34')]};return db[_0x56f3('0x26')][_0x56f3('0x1b')](_0x3ff39d)['then'](function(_0xf77da3){_0x428260[_0x56f3('0x1b')]=_0xf77da3;if(_0x52e94a[_0x56f3('0x2c')][_0x56f3('0x39')]){_0x1f6f27[_0x56f3('0x3a')]=[{'all':!![]}];}return db[_0x56f3('0x26')][_0x56f3('0x3b')](_0x1f6f27);})[_0x56f3('0x21')](function(_0x4af156){_0x428260[_0x56f3('0x3c')]=_0x4af156;return _0x428260;})[_0x56f3('0x21')](respondWithFilteredResult(_0x47e0a0,_0x1f6f27))[_0x56f3('0x3d')](handleError(_0x47e0a0,null));};exports['show']=function(_0x364e34,_0x55fb4c){var _0x4093b8={'raw':!![],'where':{'id':_0x364e34[_0x56f3('0x3e')]['id']}},_0xaa7e12={};_0xaa7e12['model']=_[_0x56f3('0x3f')](db[_0x56f3('0x26')][_0x56f3('0x40')]);_0xaa7e12['query']=_[_0x56f3('0x3f')](_0x364e34[_0x56f3('0x2c')]);_0xaa7e12[_0x56f3('0x2d')]=_[_0x56f3('0x41')](_0xaa7e12['model'],_0xaa7e12['query']);_0x4093b8['attributes']=_['intersection'](_0xaa7e12['model'],qs[_0x56f3('0x2f')](_0x364e34['query'][_0x56f3('0x2f')]));_0x4093b8['attributes']=_0x4093b8['attributes']['length']?_0x4093b8['attributes']:_0xaa7e12['model'];if(_0x364e34[_0x56f3('0x2c')][_0x56f3('0x39')]){_0x4093b8[_0x56f3('0x3a')]=[{'all':!![]}];}_0x4093b8=_[_0x56f3('0x37')]({},_0x4093b8,_0x364e34[_0x56f3('0x38')]);return db[_0x56f3('0x26')][_0x56f3('0x42')](_0x4093b8)[_0x56f3('0x21')](handleEntityNotFound(_0x55fb4c,null))[_0x56f3('0x21')](respondWithResult(_0x55fb4c,null))[_0x56f3('0x3d')](handleError(_0x55fb4c,null));};exports[_0x56f3('0x43')]=function(_0x20d34b,_0x477514){return db[_0x56f3('0x26')][_0x56f3('0x43')](_0x20d34b['body'],{})['then'](respondWithResult(_0x477514,0xc9))['catch'](handleError(_0x477514,null));};exports[_0x56f3('0x44')]=function(_0x56f578,_0x21fa92){return db[_0x56f3('0x26')][_0x56f3('0x44')]()[_0x56f3('0x21')](respondWithResult(_0x21fa92,null))[_0x56f3('0x3d')](handleError(_0x21fa92,null));};exports['update']=function(_0x43bebd,_0x329f02){if(_0x43bebd[_0x56f3('0x45')][_0x56f3('0x46')]){delete _0x43bebd['body'][_0x56f3('0x46')];}return db[_0x56f3('0x26')][_0x56f3('0x42')]({'where':{'uniqueid':_0x43bebd[_0x56f3('0x3e')]['id']}})[_0x56f3('0x21')](handleEntityNotFound(_0x329f02,null))[_0x56f3('0x21')](saveUpdates(_0x43bebd['body'],null))[_0x56f3('0x21')](respondWithResult(_0x329f02,null))[_0x56f3('0x3d')](handleError(_0x329f02,null));}; \ No newline at end of file +var _0xed83=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','end','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','catch','show','params','keys','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x19a11f,_0x6d8be7){var _0x51485f=function(_0x1394a1){while(--_0x1394a1){_0x19a11f['push'](_0x19a11f['shift']());}};_0x51485f(++_0x6d8be7);}(_0xed83,0x91));var _0x3ed8=function(_0xa98302,_0x844f27){_0xa98302=_0xa98302-0x0;var _0x1ad8e3=_0xed83[_0xa98302];return _0x1ad8e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ed8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ed8('0x1'));var rp=require(_0x3ed8('0x2'));var moment=require(_0x3ed8('0x3'));var BPromise=require(_0x3ed8('0x4'));var Mustache=require(_0x3ed8('0x5'));var util=require(_0x3ed8('0x6'));var path=require(_0x3ed8('0x7'));var sox=require(_0x3ed8('0x8'));var csv=require(_0x3ed8('0x9'));var ejs=require(_0x3ed8('0xa'));var fs=require('fs');var fs_extra=require(_0x3ed8('0xb'));var _=require(_0x3ed8('0xc'));var squel=require(_0x3ed8('0xd'));var crypto=require(_0x3ed8('0xe'));var jsforce=require(_0x3ed8('0xf'));var deskjs=require(_0x3ed8('0x10'));var toCsv=require(_0x3ed8('0x9'));var querystring=require(_0x3ed8('0x11'));var Papa=require(_0x3ed8('0x12'));var Redis=require(_0x3ed8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3ed8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ed8('0x15'));var logger=require(_0x3ed8('0x16'))(_0x3ed8('0x17'));var utils=require(_0x3ed8('0x18'));var config=require(_0x3ed8('0x19'));var licenseUtil=require(_0x3ed8('0x1a'));var db=require(_0x3ed8('0x1b'))['db'];function respondWithStatusCode(_0x5e32aa,_0x2cc167){_0x2cc167=_0x2cc167||0xcc;return function(_0x4b71c9){if(_0x4b71c9){return _0x5e32aa[_0x3ed8('0x1c')](_0x2cc167);}return _0x5e32aa[_0x3ed8('0x1d')](_0x2cc167)['end']();};}function respondWithResult(_0x1ebf8a,_0x3e2909){_0x3e2909=_0x3e2909||0xc8;return function(_0x138710){if(_0x138710){return _0x1ebf8a[_0x3ed8('0x1d')](_0x3e2909)[_0x3ed8('0x1e')](_0x138710);}};}function respondWithFilteredResult(_0x4c1f55,_0x47153c){return function(_0x1ebd4f){if(_0x1ebd4f){var _0xfa3cce=typeof _0x47153c[_0x3ed8('0x1f')]==='undefined'&&typeof _0x47153c[_0x3ed8('0x20')]===_0x3ed8('0x21');var _0x4b194f=_0x1ebd4f['count'];var _0x49c363=_0xfa3cce?0x0:_0x47153c[_0x3ed8('0x1f')];var _0xbeedc4=_0xfa3cce?_0x1ebd4f[_0x3ed8('0x22')]:_0x47153c[_0x3ed8('0x1f')]+_0x47153c['limit'];var _0x346e06;if(_0xbeedc4>=_0x4b194f){_0xbeedc4=_0x4b194f;_0x346e06=0xc8;}else{_0x346e06=0xce;}_0x4c1f55[_0x3ed8('0x1d')](_0x346e06);return _0x4c1f55[_0x3ed8('0x23')](_0x3ed8('0x24'),_0x49c363+'-'+_0xbeedc4+'/'+_0x4b194f)[_0x3ed8('0x1e')](_0x1ebd4f);}return null;};}function patchUpdates(_0x34b8ed){return function(_0xfe4505){try{jsonpatch[_0x3ed8('0x25')](_0xfe4505,_0x34b8ed,!![]);}catch(_0x4ec305){return BPromise[_0x3ed8('0x26')](_0x4ec305);}return _0xfe4505['save']();};}function saveUpdates(_0x4a91bb,_0x285632){return function(_0x35064b){if(_0x35064b){return _0x35064b[_0x3ed8('0x27')](_0x4a91bb)['then'](function(_0x4ef9b6){return _0x4ef9b6;});}return null;};}function removeEntity(_0x3f597b,_0x3a2971){return function(_0x42e5ef){if(_0x42e5ef){return _0x42e5ef[_0x3ed8('0x28')]()[_0x3ed8('0x29')](function(){_0x3f597b[_0x3ed8('0x1d')](0xcc)[_0x3ed8('0x2a')]();});}};}function handleEntityNotFound(_0x155392,_0x253be4){return function(_0x3c7ce6){if(!_0x3c7ce6){_0x155392[_0x3ed8('0x1c')](0x194);}return _0x3c7ce6;};}function handleError(_0x1b5bb3,_0x17fd0a){_0x17fd0a=_0x17fd0a||0x1f4;return function(_0x1ddedc){logger['error'](_0x1ddedc[_0x3ed8('0x2b')]);if(_0x1ddedc[_0x3ed8('0x2c')]){delete _0x1ddedc[_0x3ed8('0x2c')];}_0x1b5bb3[_0x3ed8('0x1d')](_0x17fd0a)[_0x3ed8('0x2d')](_0x1ddedc);};}exports[_0x3ed8('0x2e')]=function(_0x56c8ab,_0x32ea61){var _0x5e1ec9={},_0x12a650={},_0x25cb0f={'count':0x0,'rows':[]};var _0x230840=_[_0x3ed8('0x2f')](db[_0x3ed8('0x30')][_0x3ed8('0x31')],function(_0x472112){return{'name':_0x472112['fieldName'],'type':_0x472112[_0x3ed8('0x32')][_0x3ed8('0x33')]};});_0x12a650['model']=_['map'](_0x230840,_0x3ed8('0x2c'));_0x12a650[_0x3ed8('0x34')]=_['keys'](_0x56c8ab[_0x3ed8('0x34')]);_0x12a650[_0x3ed8('0x35')]=_[_0x3ed8('0x36')](_0x12a650[_0x3ed8('0x37')],_0x12a650['query']);_0x5e1ec9[_0x3ed8('0x38')]=_[_0x3ed8('0x36')](_0x12a650[_0x3ed8('0x37')],qs[_0x3ed8('0x39')](_0x56c8ab[_0x3ed8('0x34')][_0x3ed8('0x39')]));_0x5e1ec9[_0x3ed8('0x38')]=_0x5e1ec9[_0x3ed8('0x38')][_0x3ed8('0x3a')]?_0x5e1ec9[_0x3ed8('0x38')]:_0x12a650[_0x3ed8('0x37')];if(!_0x56c8ab[_0x3ed8('0x34')][_0x3ed8('0x3b')](_0x3ed8('0x3c'))){_0x5e1ec9[_0x3ed8('0x20')]=qs['limit'](_0x56c8ab[_0x3ed8('0x34')][_0x3ed8('0x20')]);_0x5e1ec9[_0x3ed8('0x1f')]=qs['offset'](_0x56c8ab[_0x3ed8('0x34')][_0x3ed8('0x1f')]);}_0x5e1ec9[_0x3ed8('0x3d')]=qs[_0x3ed8('0x3e')](_0x56c8ab['query'][_0x3ed8('0x3e')]);_0x5e1ec9[_0x3ed8('0x3f')]=qs[_0x3ed8('0x35')](_[_0x3ed8('0x40')](_0x56c8ab[_0x3ed8('0x34')],_0x12a650[_0x3ed8('0x35')]),_0x230840);if(_0x56c8ab[_0x3ed8('0x34')]['filter']){_0x5e1ec9[_0x3ed8('0x3f')]=_[_0x3ed8('0x41')](_0x5e1ec9[_0x3ed8('0x3f')],{'$or':_[_0x3ed8('0x2f')](_0x230840,function(_0x39bf55){if(_0x39bf55[_0x3ed8('0x32')]!=='VIRTUAL'){var _0x5a4831={};_0x5a4831[_0x39bf55[_0x3ed8('0x2c')]]={'$like':'%'+_0x56c8ab[_0x3ed8('0x34')][_0x3ed8('0x42')]+'%'};return _0x5a4831;}})});}_0x5e1ec9=_[_0x3ed8('0x41')]({},_0x5e1ec9,_0x56c8ab[_0x3ed8('0x43')]);var _0x20a5ae={'where':_0x5e1ec9['where']};return db[_0x3ed8('0x30')][_0x3ed8('0x22')](_0x20a5ae)[_0x3ed8('0x29')](function(_0x32d551){_0x25cb0f['count']=_0x32d551;if(_0x56c8ab[_0x3ed8('0x34')]['includeAll']){_0x5e1ec9[_0x3ed8('0x44')]=[{'all':!![]}];}return db[_0x3ed8('0x30')][_0x3ed8('0x45')](_0x5e1ec9);})[_0x3ed8('0x29')](function(_0x1a7655){_0x25cb0f['rows']=_0x1a7655;return _0x25cb0f;})[_0x3ed8('0x29')](respondWithFilteredResult(_0x32ea61,_0x5e1ec9))[_0x3ed8('0x46')](handleError(_0x32ea61,null));};exports[_0x3ed8('0x47')]=function(_0x16ad77,_0x3fbf82){var _0x278d79={'raw':!![],'where':{'id':_0x16ad77[_0x3ed8('0x48')]['id']}},_0x39cb85={};_0x39cb85['model']=_[_0x3ed8('0x49')](db[_0x3ed8('0x30')][_0x3ed8('0x31')]);_0x39cb85[_0x3ed8('0x34')]=_['keys'](_0x16ad77[_0x3ed8('0x34')]);_0x39cb85['filters']=_[_0x3ed8('0x36')](_0x39cb85[_0x3ed8('0x37')],_0x39cb85[_0x3ed8('0x34')]);_0x278d79[_0x3ed8('0x38')]=_[_0x3ed8('0x36')](_0x39cb85[_0x3ed8('0x37')],qs[_0x3ed8('0x39')](_0x16ad77[_0x3ed8('0x34')][_0x3ed8('0x39')]));_0x278d79[_0x3ed8('0x38')]=_0x278d79[_0x3ed8('0x38')][_0x3ed8('0x3a')]?_0x278d79['attributes']:_0x39cb85['model'];if(_0x16ad77[_0x3ed8('0x34')]['includeAll']){_0x278d79[_0x3ed8('0x44')]=[{'all':!![]}];}_0x278d79=_[_0x3ed8('0x41')]({},_0x278d79,_0x16ad77['options']);return db[_0x3ed8('0x30')][_0x3ed8('0x4a')](_0x278d79)[_0x3ed8('0x29')](handleEntityNotFound(_0x3fbf82,null))[_0x3ed8('0x29')](respondWithResult(_0x3fbf82,null))['catch'](handleError(_0x3fbf82,null));};exports[_0x3ed8('0x4b')]=function(_0x3ad494,_0x157b99){return db[_0x3ed8('0x30')][_0x3ed8('0x4b')](_0x3ad494[_0x3ed8('0x4c')],{})['then'](respondWithResult(_0x157b99,0xc9))[_0x3ed8('0x46')](handleError(_0x157b99,null));};exports['describe']=function(_0x11814e,_0x10a619){return db['CmHopperHistory'][_0x3ed8('0x4d')]()['then'](respondWithResult(_0x10a619,null))[_0x3ed8('0x46')](handleError(_0x10a619,null));};exports[_0x3ed8('0x27')]=function(_0x4651d1,_0x530892){if(_0x4651d1[_0x3ed8('0x4c')][_0x3ed8('0x4e')]){delete _0x4651d1[_0x3ed8('0x4c')][_0x3ed8('0x4e')];}return db[_0x3ed8('0x30')][_0x3ed8('0x4a')]({'where':{'uniqueid':_0x4651d1[_0x3ed8('0x48')]['id']}})[_0x3ed8('0x29')](handleEntityNotFound(_0x530892,null))['then'](saveUpdates(_0x4651d1[_0x3ed8('0x4c')],null))['then'](respondWithResult(_0x530892,null))[_0x3ed8('0x46')](handleError(_0x530892,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 111551f..536bf6f 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 _0x58e6=['util','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0x28c17c,_0x5b983b){var _0xcb62f3=function(_0x263128){while(--_0x263128){_0x28c17c['push'](_0x28c17c['shift']());}};_0xcb62f3(++_0x5b983b);}(_0x58e6,0x1c2));var _0x658e=function(_0x41ff5b,_0x385a85){_0x41ff5b=_0x41ff5b-0x0;var _0x52009b=_0x58e6[_0x41ff5b];return _0x52009b;};'use strict';var _=require(_0x658e('0x0'));var util=require(_0x658e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x658e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x658e('0x3'));var rimraf=require(_0x658e('0x4'));var config=require(_0x658e('0x5'));var attributes=require(_0x658e('0x6'));module[_0x658e('0x7')]=function(_0x2add44,_0x3251b8){return _0x2add44['define']('CmHopperHistory',attributes,{'tableName':_0x658e('0x8'),'paranoid':![],'indexes':[{'name':_0x658e('0x9'),'fields':[_0x658e('0x9')]},{'name':'uniqueid','fields':[_0x658e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x77a9=['../../config/environment','./cmHopperHistory.attributes','exports','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77a9,0x19e));var _0x977a=function(_0x41ec1a,_0x4702bc){_0x41ec1a=_0x41ec1a-0x0;var _0xe4ffc7=_0x77a9[_0x41ec1a];return _0xe4ffc7;};'use strict';var _=require(_0x977a('0x0'));var util=require('util');var logger=require(_0x977a('0x1'))('api');var moment=require(_0x977a('0x2'));var BPromise=require(_0x977a('0x3'));var rp=require(_0x977a('0x4'));var fs=require('fs');var path=require(_0x977a('0x5'));var rimraf=require('rimraf');var config=require(_0x977a('0x6'));var attributes=require(_0x977a('0x7'));module[_0x977a('0x8')]=function(_0x2b4ba5,_0x261e46){return _0x2b4ba5['define']('CmHopperHistory',attributes,{'tableName':_0x977a('0x9'),'paranoid':![],'indexes':[{'name':_0x977a('0xa'),'fields':['endtime']},{'name':_0x977a('0xb'),'fields':[_0x977a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 2a643f9..65b603f 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 _0x5dea=['options','raw','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','campaign','ivrAnswerCallsDay','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','catch','CreateCmHopperHistory','CmHopperHistory','create'];(function(_0x2cb1a0,_0x55ce1e){var _0x3037a9=function(_0x280822){while(--_0x280822){_0x2cb1a0['push'](_0x2cb1a0['shift']());}};_0x3037a9(++_0x55ce1e);}(_0x5dea,0x1bc));var _0xa5de=function(_0x585e0b,_0x581d40){_0x585e0b=_0x585e0b-0x0;var _0x37b14f=_0x5dea[_0x585e0b];return _0x37b14f;};'use strict';var _=require(_0xa5de('0x0'));var util=require(_0xa5de('0x1'));var moment=require(_0xa5de('0x2'));var BPromise=require(_0xa5de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa5de('0x5'))(_0xa5de('0x6'));var config=require(_0xa5de('0x7'));var jayson=require(_0xa5de('0x8'));var client=jayson['client'][_0xa5de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52ab35,_0x37f97d,_0x39579f){return new BPromise(function(_0x49eb0a,_0x44f1a8){return client[_0xa5de('0xa')](_0x52ab35,_0x39579f)[_0xa5de('0xb')](function(_0x119d05){logger[_0xa5de('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x37f97d,_0xa5de('0xd'));logger[_0xa5de('0xe')](_0xa5de('0xf'),_0x37f97d,_0xa5de('0xd'),JSON[_0xa5de('0x10')](_0x119d05));if(_0x119d05['error']){if(_0x119d05[_0xa5de('0x11')][_0xa5de('0x12')]===0x1f4){logger['error'](_0xa5de('0x13'),_0x37f97d,_0x119d05[_0xa5de('0x11')][_0xa5de('0x14')]);return _0x44f1a8(_0x119d05[_0xa5de('0x11')]['message']);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x37f97d,_0x119d05['error'][_0xa5de('0x14')]);return _0x49eb0a(_0x119d05['error'][_0xa5de('0x14')]);}else{logger[_0xa5de('0xc')](_0xa5de('0x13'),_0x37f97d,_0xa5de('0xd'));_0x49eb0a(_0x119d05['result'][_0xa5de('0x14')]);}})[_0xa5de('0x15')](function(_0x1d4c54){logger[_0xa5de('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x37f97d,_0x1d4c54);_0x44f1a8(_0x1d4c54);});});}exports[_0xa5de('0x16')]=function(_0x4bf68a){var _0x4eccb9=this;return new Promise(function(_0x5302ca,_0x414d8c){return db[_0xa5de('0x17')][_0xa5de('0x18')](_0x4bf68a['body'],{'raw':_0x4bf68a[_0xa5de('0x19')]?_0x4bf68a[_0xa5de('0x19')][_0xa5de('0x1a')]===undefined?!![]:![]:!![]})[_0xa5de('0xb')](function(_0x5e3e42){logger[_0xa5de('0xc')]('CreateCmHopperHistory',_0x4bf68a);logger[_0xa5de('0xe')]('CreateCmHopperHistory',_0x4bf68a,JSON[_0xa5de('0x10')](_0x5e3e42));_0x5302ca(_0x5e3e42);})[_0xa5de('0x15')](function(_0x3b190e){logger[_0xa5de('0x11')](_0xa5de('0x16'),_0x3b190e[_0xa5de('0x14')],_0x4bf68a);_0x414d8c(_0x4eccb9[_0xa5de('0x11')](0x1f4,_0x3b190e[_0xa5de('0x14')]));});});};exports['AvgHandleTime']=function(_0x4938dd){var _0x1e7542=this;return new Promise(function(_0x4ed8e1,_0x181574){return db[_0xa5de('0x17')]['findAll']({'raw':_0x4938dd['options']?_0x4938dd[_0xa5de('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4938dd[_0xa5de('0x19')]?_0x4938dd['options'][_0xa5de('0x1b')]||null:null,'attributes':[[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')][_0xa5de('0x1e')]('id')),'predictiveIntervalTotalCalls'],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x20')))),_0xa5de('0x21')],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db['sequelize'][_0xa5de('0x1f')](_0xa5de('0x22')))),_0xa5de('0x23')],[db[_0xa5de('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa5de('0x1c')]['literal'](_0xa5de('0x24')))),_0xa5de('0x25')],[db[_0xa5de('0x1c')]['fn']('AVG',db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x26')))),_0xa5de('0x27')],[db['sequelize']['fn'](_0xa5de('0x28'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x55b822){logger[_0xa5de('0xc')]('AvgHandleTime',_0x4938dd);logger[_0xa5de('0xe')]('AvgHandleTime',_0x4938dd,JSON[_0xa5de('0x10')](_0x55b822));_0x4ed8e1(_0x55b822);})[_0xa5de('0x15')](function(_0x42775b){logger[_0xa5de('0x11')](_0xa5de('0x29'),_0x42775b['message'],_0x4938dd);_0x181574(_0x1e7542[_0xa5de('0x11')](0x1f4,_0x42775b[_0xa5de('0x14')]));});});};exports[_0xa5de('0x2a')]=function(_0x5b2a23){var _0x459899=this;return new Promise(function(_0x42cc38,_0x50f174){return db[_0xa5de('0x17')][_0xa5de('0x2b')]({'raw':_0x5b2a23[_0xa5de('0x19')]?_0x5b2a23['options'][_0xa5de('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b2a23[_0xa5de('0x19')]?_0x5b2a23[_0xa5de('0x19')][_0xa5de('0x1b')]||null:null,'attributes':[['campaign',_0xa5de('0x2c')],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')]['literal'](_0xa5de('0x2d')))),_0xa5de('0x2e')],[db[_0xa5de('0x1c')]['fn']('COUNT',db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x2f')))),_0xa5de('0x30')],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x20')))),'outboundAnswerCallsDay'],[db[_0xa5de('0x1c')]['fn']('COUNT',db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x31')))),'outboundBusyCallsDay'],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db['sequelize']['fn']('IF',db[_0xa5de('0x1c')]['literal'](_0xa5de('0x32')))),_0xa5de('0x33')],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db['sequelize']['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x34')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x35')))),_0xa5de('0x36')],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db['sequelize']['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')]('`state`\x20=\x2012,\x201,\x20null'))),_0xa5de('0x37')],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x38')))),_0xa5de('0x39')],[db['sequelize']['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db['sequelize']['literal'](_0xa5de('0x3a')))),_0xa5de('0x3b')],[db['sequelize']['fn']('COUNT',db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')]('`state`\x20=\x2018,\x201,\x20null'))),_0xa5de('0x3c')],[db['sequelize']['fn']('COUNT',db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x3d')))),'outboundAnswerAgiCallsDay'],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),_0xa5de('0x3c')],[db['sequelize']['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db['sequelize'][_0xa5de('0x1f')](_0xa5de('0x3e')))),_0xa5de('0x3f')]],'group':['campaign']})['then'](function(_0x12eb97){logger[_0xa5de('0xc')]('GetVoiceQueueHopperHistory',_0x5b2a23);logger[_0xa5de('0xe')]('GetVoiceQueueHopperHistory',_0x5b2a23,JSON[_0xa5de('0x10')](_0x12eb97));_0x42cc38(_0x12eb97);})[_0xa5de('0x15')](function(_0x3e0818){logger[_0xa5de('0x11')](_0xa5de('0x2a'),_0x3e0818[_0xa5de('0x14')],_0x5b2a23);_0x50f174(_0x459899[_0xa5de('0x11')](0x1f4,_0x3e0818[_0xa5de('0x14')]));});});};exports[_0xa5de('0x40')]=function(_0xbc113d){var _0x515b7f=this;return new Promise(function(_0x502063,_0x216a49){return db[_0xa5de('0x17')][_0xa5de('0x2b')]({'raw':_0xbc113d[_0xa5de('0x19')]?_0xbc113d[_0xa5de('0x19')][_0xa5de('0x1a')]===undefined?!![]:![]:!![],'where':_0xbc113d[_0xa5de('0x19')]?_0xbc113d['options'][_0xa5de('0x1b')]||null:null,'attributes':[[_0xa5de('0x41'),_0xa5de('0x2c')],[db[_0xa5de('0x1c')]['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')][_0xa5de('0x1e')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0xa5de('0x1d'),db[_0xa5de('0x1c')]['fn']('IF',db[_0xa5de('0x1c')][_0xa5de('0x1f')](_0xa5de('0x20')))),_0xa5de('0x42')]],'group':[_0xa5de('0x41')]})['then'](function(_0x3f46fb){logger[_0xa5de('0xc')](_0xa5de('0x40'),_0xbc113d);logger[_0xa5de('0xe')](_0xa5de('0x40'),_0xbc113d,JSON['stringify'](_0x3f46fb));_0x502063(_0x3f46fb);})[_0xa5de('0x15')](function(_0x2f5e6a){logger[_0xa5de('0x11')](_0xa5de('0x40'),_0x2f5e6a[_0xa5de('0x14')],_0xbc113d);_0x216a49(_0x515b7f[_0xa5de('0x11')](0x1f4,_0x2f5e6a[_0xa5de('0x14')]));});});}; \ No newline at end of file +var _0xd01f=['AvgHandleTime','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','options','raw','catch'];(function(_0x3780f1,_0x2bd1cd){var _0x33b372=function(_0x57af75){while(--_0x57af75){_0x3780f1['push'](_0x3780f1['shift']());}};_0x33b372(++_0x2bd1cd);}(_0xd01f,0x1d6));var _0xfd01=function(_0x590a7d,_0x47938e){_0x590a7d=_0x590a7d-0x0;var _0x3ce2b1=_0xd01f[_0x590a7d];return _0x3ce2b1;};'use strict';var _=require(_0xfd01('0x0'));var util=require('util');var moment=require(_0xfd01('0x1'));var BPromise=require('bluebird');var rs=require(_0xfd01('0x2'));var fs=require('fs');var Redis=require(_0xfd01('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd01('0x4'));var logger=require('../../config/logger')(_0xfd01('0x5'));var config=require(_0xfd01('0x6'));var jayson=require(_0xfd01('0x7'));var client=jayson['client'][_0xfd01('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b1a99,_0x585168,_0x580990){return new BPromise(function(_0x36a127,_0x4593f0){return client[_0xfd01('0x9')](_0x2b1a99,_0x580990)[_0xfd01('0xa')](function(_0x2e2e38){logger[_0xfd01('0xb')](_0xfd01('0xc'),_0x585168,_0xfd01('0xd'));logger[_0xfd01('0xe')](_0xfd01('0xf'),_0x585168,_0xfd01('0xd'),JSON[_0xfd01('0x10')](_0x2e2e38));if(_0x2e2e38['error']){if(_0x2e2e38[_0xfd01('0x11')][_0xfd01('0x12')]===0x1f4){logger[_0xfd01('0x11')](_0xfd01('0xc'),_0x585168,_0x2e2e38[_0xfd01('0x11')][_0xfd01('0x13')]);return _0x4593f0(_0x2e2e38[_0xfd01('0x11')][_0xfd01('0x13')]);}logger[_0xfd01('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x585168,_0x2e2e38['error'][_0xfd01('0x13')]);return _0x36a127(_0x2e2e38[_0xfd01('0x11')][_0xfd01('0x13')]);}else{logger[_0xfd01('0xb')](_0xfd01('0xc'),_0x585168,_0xfd01('0xd'));_0x36a127(_0x2e2e38[_0xfd01('0x14')][_0xfd01('0x13')]);}})['catch'](function(_0x4d832a){logger['error'](_0xfd01('0xc'),_0x585168,_0x4d832a);_0x4593f0(_0x4d832a);});});}exports[_0xfd01('0x15')]=function(_0x41e195){var _0x1f10c6=this;return new Promise(function(_0x29e375,_0x2108a0){return db[_0xfd01('0x16')][_0xfd01('0x17')](_0x41e195['body'],{'raw':_0x41e195['options']?_0x41e195[_0xfd01('0x18')][_0xfd01('0x19')]===undefined?!![]:![]:!![]})[_0xfd01('0xa')](function(_0x136338){logger['info']('CreateCmHopperHistory',_0x41e195);logger[_0xfd01('0xe')](_0xfd01('0x15'),_0x41e195,JSON[_0xfd01('0x10')](_0x136338));_0x29e375(_0x136338);})[_0xfd01('0x1a')](function(_0x2dd343){logger['error'](_0xfd01('0x15'),_0x2dd343[_0xfd01('0x13')],_0x41e195);_0x2108a0(_0x1f10c6[_0xfd01('0x11')](0x1f4,_0x2dd343['message']));});});};exports[_0xfd01('0x1b')]=function(_0x5dcc54){var _0x3b2c22=this;return new Promise(function(_0x2f6dcd,_0x470244){return db[_0xfd01('0x16')]['findAll']({'raw':_0x5dcc54['options']?_0x5dcc54[_0xfd01('0x18')][_0xfd01('0x19')]===undefined?!![]:![]:!![],'where':_0x5dcc54[_0xfd01('0x18')]?_0x5dcc54[_0xfd01('0x18')][_0xfd01('0x1c')]||null:null,'attributes':[[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')][_0xfd01('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db['sequelize']['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x21')))),_0xfd01('0x22')],[db[_0xfd01('0x1d')]['fn']('COUNT',db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xfd01('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')]('`state`\x20=\x2011,\x201,\x20null'))),_0xfd01('0x24')],[db['sequelize']['fn']('AVG',db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x25')))),_0xfd01('0x26')],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x27'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x28')))),_0xfd01('0x29')]]})[_0xfd01('0xa')](function(_0x3685cd){logger[_0xfd01('0xb')](_0xfd01('0x1b'),_0x5dcc54);logger[_0xfd01('0xe')]('AvgHandleTime',_0x5dcc54,JSON[_0xfd01('0x10')](_0x3685cd));_0x2f6dcd(_0x3685cd);})[_0xfd01('0x1a')](function(_0x1b9b3b){logger[_0xfd01('0x11')](_0xfd01('0x1b'),_0x1b9b3b[_0xfd01('0x13')],_0x5dcc54);_0x470244(_0x3b2c22[_0xfd01('0x11')](0x1f4,_0x1b9b3b['message']));});});};exports[_0xfd01('0x2a')]=function(_0x469c09){var _0x298116=this;return new Promise(function(_0x3e0803,_0x33339b){return db[_0xfd01('0x16')][_0xfd01('0x2b')]({'raw':_0x469c09[_0xfd01('0x18')]?_0x469c09[_0xfd01('0x18')][_0xfd01('0x19')]===undefined?!![]:![]:!![],'where':_0x469c09[_0xfd01('0x18')]?_0x469c09[_0xfd01('0x18')][_0xfd01('0x1c')]||null:null,'attributes':[[_0xfd01('0x2c'),'name'],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x2d')))),_0xfd01('0x2e')],[db['sequelize']['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x2f')))),_0xfd01('0x30')],[db['sequelize']['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x21')))),'outboundAnswerCallsDay'],[db[_0xfd01('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xfd01('0x1d')]['literal'](_0xfd01('0x31')))),_0xfd01('0x32')],[db[_0xfd01('0x1d')]['fn']('COUNT',db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x33')))),_0xfd01('0x34')],[db['sequelize']['fn'](_0xfd01('0x1e'),db['sequelize']['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x35')))),_0xfd01('0x36')],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db['sequelize']['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x37')))),'outboundDropCallsDayCallersExit'],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db['sequelize'][_0xfd01('0x20')](_0xfd01('0x38')))),_0xfd01('0x39')],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')]['literal'](_0xfd01('0x3a')))),_0xfd01('0x3b')],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xfd01('0x20')](_0xfd01('0x3c')))),_0xfd01('0x3d')],[db[_0xfd01('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')]('`state`\x20=\x2018,\x201,\x20null'))),_0xfd01('0x3e')],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x3f')))),_0xfd01('0x40')],[db['sequelize']['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x41')))),_0xfd01('0x3e')],[db['sequelize']['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x42')))),_0xfd01('0x43')]],'group':[_0xfd01('0x2c')]})['then'](function(_0x5ccf6e){logger[_0xfd01('0xb')](_0xfd01('0x2a'),_0x469c09);logger[_0xfd01('0xe')](_0xfd01('0x2a'),_0x469c09,JSON[_0xfd01('0x10')](_0x5ccf6e));_0x3e0803(_0x5ccf6e);})[_0xfd01('0x1a')](function(_0x857530){logger[_0xfd01('0x11')](_0xfd01('0x2a'),_0x857530[_0xfd01('0x13')],_0x469c09);_0x33339b(_0x298116['error'](0x1f4,_0x857530['message']));});});};exports[_0xfd01('0x44')]=function(_0xa88b45){var _0x505426=this;return new Promise(function(_0x4ece45,_0x17abff){return db['CmHopperHistory'][_0xfd01('0x2b')]({'raw':_0xa88b45[_0xfd01('0x18')]?_0xa88b45[_0xfd01('0x18')][_0xfd01('0x19')]===undefined?!![]:![]:!![],'where':_0xa88b45[_0xfd01('0x18')]?_0xa88b45[_0xfd01('0x18')]['where']||null:null,'attributes':[['campaign',_0xfd01('0x45')],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['col']('id')),_0xfd01('0x46')],[db[_0xfd01('0x1d')]['fn'](_0xfd01('0x1e'),db[_0xfd01('0x1d')]['fn']('IF',db[_0xfd01('0x1d')][_0xfd01('0x20')](_0xfd01('0x21')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0xfd01('0xa')](function(_0x2d60e3){logger[_0xfd01('0xb')]('GetCampaignHopperHistory',_0xa88b45);logger[_0xfd01('0xe')]('GetCampaignHopperHistory',_0xa88b45,JSON[_0xfd01('0x10')](_0x2d60e3));_0x4ece45(_0x2d60e3);})[_0xfd01('0x1a')](function(_0x53fb98){logger['error']('GetCampaignHopperHistory',_0x53fb98[_0xfd01('0x13')],_0xa88b45);_0x17abff(_0x505426['error'](0x1f4,_0x53fb98['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 2a4bc01..e4dc8ff 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 _0x9962=['../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0xc970c1,_0xca7e3d){var _0x5087e0=function(_0x4ab39e){while(--_0x4ab39e){_0xc970c1['push'](_0xc970c1['shift']());}};_0x5087e0(++_0xca7e3d);}(_0x9962,0x186));var _0x2996=function(_0x5a046b,_0x142382){_0x5a046b=_0x5a046b-0x0;var _0x2deeb0=_0x9962[_0x5a046b];return _0x2deeb0;};'use strict';var multer=require(_0x2996('0x0'));var util=require('util');var path=require(_0x2996('0x1'));var timeout=require(_0x2996('0x2'));var express=require(_0x2996('0x3'));var router=express[_0x2996('0x4')]();var fs_extra=require(_0x2996('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2996('0x6'));var config=require(_0x2996('0x7'));var controller=require(_0x2996('0x8'));router[_0x2996('0x9')]('/',auth[_0x2996('0xa')](),controller['index']);router[_0x2996('0x9')](_0x2996('0xb'),auth[_0x2996('0xa')](),controller[_0x2996('0xc')]);router[_0x2996('0x9')](_0x2996('0xd'),auth[_0x2996('0xa')](),controller['show']);router[_0x2996('0xe')]('/',auth[_0x2996('0xa')](),controller[_0x2996('0xf')]);router[_0x2996('0x10')](_0x2996('0xd'),auth[_0x2996('0xa')](),controller['update']);module[_0x2996('0x11')]=router; \ No newline at end of file +var _0x3d8e=['isAuthenticated','show','post','create','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','index','get','/describe','describe'];(function(_0x49af09,_0xafac0){var _0x317b0a=function(_0x93fe40){while(--_0x93fe40){_0x49af09['push'](_0x49af09['shift']());}};_0x317b0a(++_0xafac0);}(_0x3d8e,0x196));var _0xe3d8=function(_0x2709bb,_0x41eede){_0x2709bb=_0x2709bb-0x0;var _0x5a5bbd=_0x3d8e[_0x2709bb];return _0x5a5bbd;};'use strict';var multer=require(_0xe3d8('0x0'));var util=require(_0xe3d8('0x1'));var path=require(_0xe3d8('0x2'));var timeout=require(_0xe3d8('0x3'));var express=require(_0xe3d8('0x4'));var router=express[_0xe3d8('0x5')]();var fs_extra=require(_0xe3d8('0x6'));var auth=require(_0xe3d8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe3d8('0x8'));var controller=require(_0xe3d8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe3d8('0xa')]);router[_0xe3d8('0xb')](_0xe3d8('0xc'),auth['isAuthenticated'](),controller[_0xe3d8('0xd')]);router['get']('/:id',auth[_0xe3d8('0xe')](),controller[_0xe3d8('0xf')]);router[_0xe3d8('0x10')]('/',auth['isAuthenticated'](),controller[_0xe3d8('0x11')]);router['put'](_0xe3d8('0x12'),auth[_0xe3d8('0xe')](),controller['update']);module[_0xe3d8('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 987ef85..e50cec0 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 _0xa3e6=['sequelize','STRING'];(function(_0x443089,_0x1e0b97){var _0xecbe89=function(_0x53a1b3){while(--_0x53a1b3){_0x443089['push'](_0x443089['shift']());}};_0xecbe89(++_0x1e0b97);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x27932d,_0x385e24){_0x27932d=_0x27932d-0x0;var _0x3877cb=_0xa3e6[_0x27932d];return _0x3877cb;};'use strict';var Sequelize=require(_0x6a3e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a3e('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6a3e('0x1')]},'dialPrefix':{'type':Sequelize[_0x6a3e('0x1')]}}; \ No newline at end of file +var _0xe700=['STRING','name','sequelize','exports'];(function(_0xc1af5c,_0x3ee814){var _0x47a61c=function(_0x5c406f){while(--_0x5c406f){_0xc1af5c['push'](_0xc1af5c['shift']());}};_0x47a61c(++_0x3ee814);}(_0xe700,0x16a));var _0x0e70=function(_0x3781b4,_0x39f19d){_0x3781b4=_0x3781b4-0x0;var _0x3b280e=_0xe700[_0x3781b4];return _0x3b280e;};'use strict';var Sequelize=require(_0x0e70('0x0'));module[_0x0e70('0x1')]={'name':{'type':Sequelize[_0x0e70('0x2')],'unique':_0x0e70('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0e70('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index ae3cdf0..366708e 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 _0xbab5=['ids','addContacts','tags','isArray','join','push','each','omit','dataValues','errors','message','getContacts','CustomFields','CmContact','concat','raw','getContactsCsv','CmCustomField','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','description_additionalPhone_','toString','isEmpty','now','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','Sequelize','text','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Lists','UserProfileResource','error','stack','send','map','CmList','rawAttributes','fieldName','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','type','VIRTUAL','filter','merge','includeAll','include','rows','catch','show','filters','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','findOne','nolimit','pick','removeDispositions'];(function(_0x40b14e,_0x5f30e2){var _0x2ee629=function(_0x25632d){while(--_0x25632d){_0x40b14e['push'](_0x40b14e['shift']());}};_0x2ee629(++_0x5f30e2);}(_0xbab5,0x18f));var _0x5bab=function(_0x50205b,_0x299dec){_0x50205b=_0x50205b-0x0;var _0x4a3f87=_0xbab5[_0x50205b];return _0x4a3f87;};'use strict';var emlformat=require(_0x5bab('0x0'));var rimraf=require(_0x5bab('0x1'));var zipdir=require(_0x5bab('0x2'));var jsonpatch=require(_0x5bab('0x3'));var rp=require(_0x5bab('0x4'));var moment=require(_0x5bab('0x5'));var BPromise=require(_0x5bab('0x6'));var Mustache=require('mustache');var util=require(_0x5bab('0x7'));var path=require('path');var sox=require(_0x5bab('0x8'));var csv=require(_0x5bab('0x9'));var ejs=require(_0x5bab('0xa'));var fs=require('fs');var fs_extra=require(_0x5bab('0xb'));var _=require(_0x5bab('0xc'));var squel=require(_0x5bab('0xd'));var crypto=require(_0x5bab('0xe'));var jsforce=require(_0x5bab('0xf'));var deskjs=require(_0x5bab('0x10'));var toCsv=require(_0x5bab('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5bab('0x11'));var authService=require(_0x5bab('0x12'));var qs=require(_0x5bab('0x13'));var as=require(_0x5bab('0x14'));var hardwareService=require(_0x5bab('0x15'));var logger=require(_0x5bab('0x16'))('api');var utils=require(_0x5bab('0x17'));var config=require(_0x5bab('0x18'));var licenseUtil=require(_0x5bab('0x19'));var db=require(_0x5bab('0x1a'))['db'];var csv_results;config[_0x5bab('0x1b')]=_[_0x5bab('0x1c')](config['redis'],{'host':_0x5bab('0x1d'),'port':0x18eb});var socket=require(_0x5bab('0x1e'))(new Redis(config['redis']));require('./cmList.socket')[_0x5bab('0x1f')](socket);function respondWithStatusCode(_0x38b011,_0x2bc15e){_0x2bc15e=_0x2bc15e||0xcc;return function(_0x390708){if(_0x390708){return _0x38b011[_0x5bab('0x20')](_0x2bc15e);}return _0x38b011[_0x5bab('0x21')](_0x2bc15e)[_0x5bab('0x22')]();};}function respondWithResult(_0xe06659,_0x2c4548){_0x2c4548=_0x2c4548||0xc8;return function(_0x3cfdb1){if(_0x3cfdb1){return _0xe06659[_0x5bab('0x21')](_0x2c4548)[_0x5bab('0x23')](_0x3cfdb1);}};}function respondWithFilteredResult(_0x310331,_0x40f446){return function(_0x44c6ca){if(_0x44c6ca){var _0xe5bfdb=typeof _0x40f446[_0x5bab('0x24')]===_0x5bab('0x25')&&typeof _0x40f446[_0x5bab('0x26')]===_0x5bab('0x25');var _0x2e1088=_0x44c6ca['count'];var _0x1244d7=_0xe5bfdb?0x0:_0x40f446['offset'];var _0x17af6b=_0xe5bfdb?_0x44c6ca[_0x5bab('0x27')]:_0x40f446[_0x5bab('0x24')]+_0x40f446[_0x5bab('0x26')];var _0x2812ad;if(_0x17af6b>=_0x2e1088){_0x17af6b=_0x2e1088;_0x2812ad=0xc8;}else{_0x2812ad=0xce;}_0x310331['status'](_0x2812ad);return _0x310331[_0x5bab('0x28')](_0x5bab('0x29'),_0x1244d7+'-'+_0x17af6b+'/'+_0x2e1088)[_0x5bab('0x23')](_0x44c6ca);}return null;};}function patchUpdates(_0x398f0f){return function(_0x227ccc){try{jsonpatch[_0x5bab('0x2a')](_0x227ccc,_0x398f0f,!![]);}catch(_0x3c35a1){return BPromise[_0x5bab('0x2b')](_0x3c35a1);}return _0x227ccc[_0x5bab('0x2c')]();};}function saveUpdates(_0x50967c,_0x11caa3){return function(_0x56f80f){if(_0x56f80f){return _0x56f80f[_0x5bab('0x2d')](_0x50967c)[_0x5bab('0x2e')](function(_0x149fdb){return _0x149fdb;});}return null;};}function removeEntity(_0x547a2c,_0x44a88e){return function(_0x49c027){if(_0x49c027){return _0x49c027[_0x5bab('0x2f')]()[_0x5bab('0x2e')](function(){var _0x2a6669=_0x49c027['get']({'plain':!![]});var _0x884711=_0x5bab('0x30');return db[_0x5bab('0x31')][_0x5bab('0x2f')]({'where':{'type':_0x884711,'resourceId':_0x2a6669['id']}})[_0x5bab('0x2e')](function(){return _0x49c027;});})[_0x5bab('0x2e')](function(){_0x547a2c[_0x5bab('0x21')](0xcc)[_0x5bab('0x22')]();});}};}function handleEntityNotFound(_0x5491a8,_0x34741f){return function(_0xd5821){if(!_0xd5821){_0x5491a8[_0x5bab('0x20')](0x194);}return _0xd5821;};}function handleError(_0xd05c8d,_0x506d92){_0x506d92=_0x506d92||0x1f4;return function(_0x519573){logger[_0x5bab('0x32')](_0x519573[_0x5bab('0x33')]);if(_0x519573['name']){delete _0x519573['name'];}_0xd05c8d[_0x5bab('0x21')](_0x506d92)[_0x5bab('0x34')](_0x519573);};}exports['index']=function(_0x30137b,_0x29a36d){var _0x38006e={},_0x3e40d9={},_0x28f3fb={'count':0x0,'rows':[]};var _0x45f938=_[_0x5bab('0x35')](db[_0x5bab('0x36')][_0x5bab('0x37')],function(_0x45bca1){return{'name':_0x45bca1[_0x5bab('0x38')],'type':_0x45bca1['type'][_0x5bab('0x39')]};});_0x3e40d9[_0x5bab('0x3a')]=_[_0x5bab('0x35')](_0x45f938,_0x5bab('0x3b'));_0x3e40d9['query']=_[_0x5bab('0x3c')](_0x30137b[_0x5bab('0x3d')]);_0x3e40d9['filters']=_[_0x5bab('0x3e')](_0x3e40d9['model'],_0x3e40d9['query']);_0x38006e[_0x5bab('0x3f')]=_['intersection'](_0x3e40d9[_0x5bab('0x3a')],qs['fields'](_0x30137b[_0x5bab('0x3d')][_0x5bab('0x40')]));_0x38006e[_0x5bab('0x3f')]=_0x38006e[_0x5bab('0x3f')][_0x5bab('0x41')]?_0x38006e[_0x5bab('0x3f')]:_0x3e40d9['model'];if(!_0x30137b[_0x5bab('0x3d')][_0x5bab('0x42')]('nolimit')){_0x38006e['limit']=qs[_0x5bab('0x26')](_0x30137b[_0x5bab('0x3d')][_0x5bab('0x26')]);_0x38006e['offset']=qs[_0x5bab('0x24')](_0x30137b[_0x5bab('0x3d')][_0x5bab('0x24')]);}_0x38006e[_0x5bab('0x43')]=qs[_0x5bab('0x44')](_0x30137b[_0x5bab('0x3d')][_0x5bab('0x44')]);_0x38006e['where']=qs['filters'](_['pick'](_0x30137b['query'],_0x3e40d9['filters']),_0x45f938);if(_0x30137b[_0x5bab('0x3d')]['filter']){_0x38006e['where']=_['merge'](_0x38006e[_0x5bab('0x45')],{'$or':_[_0x5bab('0x35')](_0x45f938,function(_0x36989b){if(_0x36989b[_0x5bab('0x46')]!==_0x5bab('0x47')){var _0x45544e={};_0x45544e[_0x36989b['name']]={'$like':'%'+_0x30137b[_0x5bab('0x3d')][_0x5bab('0x48')]+'%'};return _0x45544e;}})});}_0x38006e=_[_0x5bab('0x49')]({},_0x38006e,_0x30137b['options']);var _0x4710b1={'where':_0x38006e[_0x5bab('0x45')]};return db[_0x5bab('0x36')]['count'](_0x4710b1)[_0x5bab('0x2e')](function(_0x53f1cf){_0x28f3fb['count']=_0x53f1cf;if(_0x30137b[_0x5bab('0x3d')][_0x5bab('0x4a')]){_0x38006e[_0x5bab('0x4b')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x38006e);})[_0x5bab('0x2e')](function(_0x2888d7){_0x28f3fb[_0x5bab('0x4c')]=_0x2888d7;return _0x28f3fb;})['then'](respondWithFilteredResult(_0x29a36d,_0x38006e))[_0x5bab('0x4d')](handleError(_0x29a36d,null));};exports[_0x5bab('0x4e')]=function(_0x466541,_0x232db5){var _0x312e58={'raw':![],'where':{'id':_0x466541['params']['id']}},_0x2f1351={};_0x2f1351[_0x5bab('0x3a')]=_[_0x5bab('0x3c')](db['CmList'][_0x5bab('0x37')]);_0x2f1351[_0x5bab('0x3d')]=_[_0x5bab('0x3c')](_0x466541[_0x5bab('0x3d')]);_0x2f1351[_0x5bab('0x4f')]=_[_0x5bab('0x3e')](_0x2f1351['model'],_0x2f1351['query']);_0x312e58[_0x5bab('0x3f')]=_['intersection'](_0x2f1351[_0x5bab('0x3a')],qs[_0x5bab('0x40')](_0x466541['query'][_0x5bab('0x40')]));_0x312e58[_0x5bab('0x3f')]=_0x312e58[_0x5bab('0x3f')][_0x5bab('0x41')]?_0x312e58[_0x5bab('0x3f')]:_0x2f1351['model'];if(_0x466541[_0x5bab('0x3d')][_0x5bab('0x4a')]){_0x312e58[_0x5bab('0x4b')]=[{'all':!![]}];}_0x312e58=_[_0x5bab('0x49')]({},_0x312e58,_0x466541[_0x5bab('0x50')]);return db[_0x5bab('0x36')][_0x5bab('0x51')](_0x312e58)[_0x5bab('0x2e')](handleEntityNotFound(_0x232db5,null))[_0x5bab('0x2e')](respondWithResult(_0x232db5,null))[_0x5bab('0x4d')](handleError(_0x232db5,null));};exports[_0x5bab('0x52')]=function(_0x1253a7,_0x4d086e){return db[_0x5bab('0x36')]['create'](_0x1253a7[_0x5bab('0x53')],{})[_0x5bab('0x2e')](function(_0x34d53d){var _0x370cec=_0x1253a7[_0x5bab('0x54')][_0x5bab('0x55')]({'plain':!![]});if(!_0x370cec)throw new Error(_0x5bab('0x56'));if(_0x370cec['role']===_0x5bab('0x54')){var _0x48c2e0=_0x34d53d[_0x5bab('0x55')]({'plain':!![]});var _0xdb42a2=_0x5bab('0x30');return db[_0x5bab('0x57')][_0x5bab('0x51')]({'where':{'name':_0xdb42a2,'userProfileId':_0x370cec['userProfileId']},'raw':!![]})[_0x5bab('0x2e')](function(_0x4cf5c9){if(_0x4cf5c9&&_0x4cf5c9[_0x5bab('0x58')]===0x0){return db['UserProfileResource'][_0x5bab('0x52')]({'name':_0x48c2e0['name'],'resourceId':_0x48c2e0['id'],'type':_0x4cf5c9['name'],'sectionId':_0x4cf5c9['id']},{})[_0x5bab('0x2e')](function(){return _0x34d53d;});}else{return _0x34d53d;}})[_0x5bab('0x4d')](function(_0x291982){logger[_0x5bab('0x32')](_0x5bab('0x59'),_0x291982);throw _0x291982;});}return _0x34d53d;})[_0x5bab('0x2e')](respondWithResult(_0x4d086e,0xc9))[_0x5bab('0x4d')](handleError(_0x4d086e,null));};exports[_0x5bab('0x2d')]=function(_0x2c832c,_0xddff0a){if(_0x2c832c[_0x5bab('0x53')]['id']){delete _0x2c832c[_0x5bab('0x53')]['id'];}return db[_0x5bab('0x36')][_0x5bab('0x51')]({'where':{'id':_0x2c832c[_0x5bab('0x5a')]['id']}})[_0x5bab('0x2e')](handleEntityNotFound(_0xddff0a,null))[_0x5bab('0x2e')](saveUpdates(_0x2c832c['body'],null))['then'](respondWithResult(_0xddff0a,null))[_0x5bab('0x4d')](handleError(_0xddff0a,null));};exports['destroy']=function(_0x6ad8da,_0x5604b7){return db[_0x5bab('0x36')][_0x5bab('0x51')]({'where':{'id':_0x6ad8da[_0x5bab('0x5a')]['id']}})[_0x5bab('0x2e')](handleEntityNotFound(_0x5604b7,null))[_0x5bab('0x2e')](removeEntity(_0x5604b7,null))['catch'](handleError(_0x5604b7,null));};exports[_0x5bab('0x5b')]=function(_0x2f738b,_0x1db6eb){return db[_0x5bab('0x36')][_0x5bab('0x5b')]()[_0x5bab('0x2e')](respondWithResult(_0x1db6eb,null))['catch'](handleError(_0x1db6eb,null));};exports[_0x5bab('0x5c')]=function(_0x59aa69,_0x188940,_0x45a6db){if(_0x59aa69[_0x5bab('0x53')]['id']){delete _0x59aa69[_0x5bab('0x53')]['id'];}return db[_0x5bab('0x36')][_0x5bab('0x51')]({'where':{'id':_0x59aa69['params']['id']}})[_0x5bab('0x2e')](handleEntityNotFound(_0x188940,null))[_0x5bab('0x2e')](function(_0x4132ea){if(_0x4132ea){_0x59aa69[_0x5bab('0x53')][_0x5bab('0x5d')]=_0x4132ea['id'];return db[_0x5bab('0x5e')][_0x5bab('0x52')](_0x59aa69[_0x5bab('0x53')]);}})['then'](respondWithResult(_0x188940,null))[_0x5bab('0x4d')](handleError(_0x188940,null));};exports['getDispositions']=function(_0x3fee31,_0xa98f0,_0x52a22c){var _0xe37e11={'raw':![],'where':{}};var _0x10f56a={};var _0x3351e4={'count':0x0,'rows':[]};return db['CmList'][_0x5bab('0x5f')]({'where':{'id':_0x3fee31[_0x5bab('0x5a')]['id']}})[_0x5bab('0x2e')](handleEntityNotFound(_0xa98f0,null))[_0x5bab('0x2e')](function(_0x1b083b){if(_0x1b083b){_0x10f56a[_0x5bab('0x3a')]=_['keys'](db[_0x5bab('0x5e')][_0x5bab('0x37')]);_0x10f56a[_0x5bab('0x3d')]=_[_0x5bab('0x3c')](_0x3fee31[_0x5bab('0x3d')]);_0x10f56a[_0x5bab('0x4f')]=_['intersection'](_0x10f56a[_0x5bab('0x3a')],_0x10f56a[_0x5bab('0x3d')]);_0xe37e11[_0x5bab('0x3f')]=_[_0x5bab('0x3e')](_0x10f56a[_0x5bab('0x3a')],qs['fields'](_0x3fee31[_0x5bab('0x3d')][_0x5bab('0x40')]));_0xe37e11[_0x5bab('0x3f')]=_0xe37e11['attributes'][_0x5bab('0x41')]?_0xe37e11[_0x5bab('0x3f')]:_0x10f56a[_0x5bab('0x3a')];if(!_0x3fee31[_0x5bab('0x3d')][_0x5bab('0x42')](_0x5bab('0x60'))){_0xe37e11[_0x5bab('0x26')]=qs[_0x5bab('0x26')](_0x3fee31[_0x5bab('0x3d')][_0x5bab('0x26')]);_0xe37e11[_0x5bab('0x24')]=qs[_0x5bab('0x24')](_0x3fee31['query'][_0x5bab('0x24')]);}_0xe37e11[_0x5bab('0x43')]=qs[_0x5bab('0x44')](_0x3fee31[_0x5bab('0x3d')][_0x5bab('0x44')]);_0xe37e11[_0x5bab('0x45')]=qs[_0x5bab('0x4f')](_[_0x5bab('0x61')](_0x3fee31[_0x5bab('0x3d')],_0x10f56a[_0x5bab('0x4f')]));_0xe37e11['where'][_0x5bab('0x5d')]=_0x1b083b['id'];if(_0x3fee31[_0x5bab('0x3d')][_0x5bab('0x48')]){_0xe37e11['where']=_[_0x5bab('0x49')](_0xe37e11[_0x5bab('0x45')],{'$or':_[_0x5bab('0x35')](_0xe37e11['attributes'],function(_0x5c96bb){var _0x550ce6={};_0x550ce6[_0x5c96bb]={'$like':'%'+_0x3fee31[_0x5bab('0x3d')][_0x5bab('0x48')]+'%'};return _0x550ce6;})});}_0xe37e11=_[_0x5bab('0x49')]({},_0xe37e11,_0x3fee31['options']);return db[_0x5bab('0x5e')][_0x5bab('0x27')]({'where':_0xe37e11[_0x5bab('0x45')]})['then'](function(_0x478453){_0x3351e4[_0x5bab('0x27')]=_0x478453;if(_0x3fee31[_0x5bab('0x3d')][_0x5bab('0x4a')]){_0xe37e11[_0x5bab('0x4b')]=[{'all':!![]}];}return db[_0x5bab('0x5e')]['findAll'](_0xe37e11);})[_0x5bab('0x2e')](function(_0x3f80fa){_0x3351e4[_0x5bab('0x4c')]=_0x3f80fa;return _0x3351e4;});}})[_0x5bab('0x2e')](respondWithFilteredResult(_0xa98f0,_0xe37e11))[_0x5bab('0x4d')](handleError(_0xa98f0,null));};exports[_0x5bab('0x62')]=function(_0x582bf1,_0x4be009,_0x35c143){return db[_0x5bab('0x36')][_0x5bab('0x51')]({'where':{'id':_0x582bf1[_0x5bab('0x5a')]['id']}})[_0x5bab('0x2e')](handleEntityNotFound(_0x4be009,null))['then'](function(_0x5f0379){if(_0x5f0379){return _0x5f0379[_0x5bab('0x62')](_0x582bf1[_0x5bab('0x3d')][_0x5bab('0x63')]);}})[_0x5bab('0x2e')](respondWithStatusCode(_0x4be009,null))[_0x5bab('0x4d')](handleError(_0x4be009,null));};exports[_0x5bab('0x64')]=function(_0x1adde1,_0x3c8e08,_0x397175){return db[_0x5bab('0x36')]['find']({'where':{'id':_0x1adde1[_0x5bab('0x5a')]['id']}})[_0x5bab('0x2e')](handleEntityNotFound(_0x3c8e08,null))[_0x5bab('0x2e')](function(_0x38d17f){if(_0x38d17f){var _0x28a9cc=[];var _0x509cd1={'success':[],'errors':[]};return db['CmContact']['describe']()[_0x5bab('0x2e')](function(_0x36add3){if(_0x1adde1['body'][_0x5bab('0x65')]&&_[_0x5bab('0x66')](_0x1adde1[_0x5bab('0x53')]['tags'])){if(_0x1adde1[_0x5bab('0x53')]['tags'][_0x5bab('0x41')]){_0x1adde1[_0x5bab('0x53')][_0x5bab('0x65')]=_0x1adde1[_0x5bab('0x53')]['tags'][_0x5bab('0x67')](';')+';';}else{_0x1adde1['body']['tags']=null;}}else{_0x1adde1[_0x5bab('0x53')][_0x5bab('0x65')]=null;}if(_0x1adde1['body']&&_['isArray'](_0x1adde1[_0x5bab('0x53')])){for(var _0x26f2bb=0x0;_0x26f2bb<_0x1adde1[_0x5bab('0x53')]['length'];_0x26f2bb+=0x1){_0x1adde1[_0x5bab('0x53')][_0x26f2bb]['ListId']=_0x1adde1[_0x5bab('0x5a')]['id'];_0x28a9cc[_0x5bab('0x68')](_0x1adde1[_0x5bab('0x53')][_0x26f2bb]);}return BPromise[_0x5bab('0x69')](_0x28a9cc,function(_0x59ae1b){return db['CmContact'][_0x5bab('0x52')](_[_0x5bab('0x6a')](_0x59ae1b,[_0x5bab('0x63'),'id'])||{},{'fields':_[_0x5bab('0x3c')](_0x36add3),'raw':!![]})['then'](function(_0x4d6313){_0x509cd1['success'][_0x5bab('0x68')](_0x4d6313[_0x5bab('0x6b')]);})[_0x5bab('0x4d')](function(_0xe40591){_0x509cd1[_0x5bab('0x6c')][_0x5bab('0x68')]({'data':_0x59ae1b,'error':_0xe40591[_0x5bab('0x6d')]});});})[_0x5bab('0x2e')](function(_0x9edb8d){return _0x509cd1;})['catch'](function(_0x1cbb9e){return _0x1cbb9e;});}else{_0x3c8e08[_0x5bab('0x21')](0x190)[_0x5bab('0x23')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x3c8e08,null))['catch'](handleError(_0x3c8e08,null));};exports[_0x5bab('0x6e')]=function(_0xd11a8,_0x3c1bc1,_0x25ca0a){var _0x4868fb;return db[_0x5bab('0x36')]['find']({'where':{'id':_0xd11a8[_0x5bab('0x5a')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x5bab('0x6f')}]})[_0x5bab('0x2e')](handleEntityNotFound(_0x3c1bc1,null))['then'](function(_0x163004){if(_0x163004){_0x4868fb=_0x163004;return db[_0x5bab('0x70')][_0x5bab('0x37')];}})['then'](function(_0xf5f22e){if(_0xf5f22e){var _0x429060={};var _0x218a9f={};_0x218a9f['model']=_[_0x5bab('0x71')](_[_0x5bab('0x3c')](_0xf5f22e),_[_0x5bab('0x35')](_0x4868fb[_0x5bab('0x6f')],function(_0x4ef2e2){return util['format']('cf_%d',_0x4ef2e2['id']);}));_0x218a9f[_0x5bab('0x3d')]=_[_0x5bab('0x3c')](_0xd11a8['query']);_0x218a9f[_0x5bab('0x4f')]=_[_0x5bab('0x3e')](_0x218a9f[_0x5bab('0x3a')],_0x218a9f[_0x5bab('0x3d')]);_0x429060[_0x5bab('0x3f')]=_['intersection'](_0x218a9f['model'],qs[_0x5bab('0x40')](_0xd11a8[_0x5bab('0x3d')][_0x5bab('0x40')]));_0x429060['attributes']=_0x429060['attributes'][_0x5bab('0x41')]?_0x429060[_0x5bab('0x3f')]:_0x218a9f['model'];if(!_0xd11a8[_0x5bab('0x3d')]['hasOwnProperty'](_0x5bab('0x60'))){_0x429060['limit']=qs['limit'](_0xd11a8[_0x5bab('0x3d')]['limit']);_0x429060[_0x5bab('0x24')]=qs['offset'](_0xd11a8[_0x5bab('0x3d')]['offset']);}_0x429060[_0x5bab('0x43')]=qs[_0x5bab('0x44')](_0xd11a8[_0x5bab('0x3d')][_0x5bab('0x44')]);_0x429060[_0x5bab('0x45')]=qs[_0x5bab('0x4f')](_[_0x5bab('0x61')](_0xd11a8['query'],_0x218a9f[_0x5bab('0x4f')]));_0x429060[_0x5bab('0x72')]=!![];if(_0xd11a8[_0x5bab('0x3d')][_0x5bab('0x48')]){_0x429060[_0x5bab('0x45')]=_[_0x5bab('0x49')](_0x429060[_0x5bab('0x45')],{'$or':_[_0x5bab('0x35')](_0x429060[_0x5bab('0x3f')],function(_0x4dc3ab){var _0x573880={};_0x573880[_0x4dc3ab]={'$like':'%'+_0xd11a8[_0x5bab('0x3d')][_0x5bab('0x48')]+'%'};return _0x573880;})});}_0x429060=_[_0x5bab('0x49')]({},_0x429060,_0xd11a8[_0x5bab('0x50')]);return _0x4868fb[_0x5bab('0x6e')](_0x429060);}})[_0x5bab('0x2e')](respondWithResult(_0x3c1bc1,null))[_0x5bab('0x4d')](handleError(_0x3c1bc1,null));};exports[_0x5bab('0x73')]=function(_0x2c2fb4,_0x18d47f,_0xd3527f){var _0x2d7258;var _0x51d02d;var _0x3846b4;var _0x2c7be5=_0x2c2fb4[_0x5bab('0x5a')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0x5bab('0x3b')],'raw':!![],'order':['OrderBy']})[_0x5bab('0x2e')](function(_0x48ef68){_0x2d7258=_0x48ef68;var _0x5b9588=_[_0x5bab('0x3c')](db[_0x5bab('0x70')]['rawAttributes']);return db[_0x5bab('0x74')]['findAll']({'raw':!![],'attributes':['id',_0x5bab('0x75')]})[_0x5bab('0x2e')](function(_0x3a6c22){_0x51d02d=_0x3a6c22;var _0x1237c8=squel[_0x5bab('0x76')]()[_0x5bab('0x40')](_0x5b9588)[_0x5bab('0x77')](_0x5bab('0x78'),'c')[_0x5bab('0x45')](_0x5bab('0x79'),_0x2c7be5)['where'](_0x5bab('0x7a'))[_0x5bab('0x7b')]();for(var _0x437ce0=0x0;_0x437ce0<_0x51d02d[_0x5bab('0x41')];_0x437ce0++){_0x1237c8[_0x5bab('0x7c')](_0x5bab('0x7d')+_0x51d02d[_0x437ce0]['id'],_0x5bab('0x7e')+_0x51d02d[_0x437ce0][_0x5bab('0x75')]);}for(var _0x437ce0=0x0;_0x437ce0<_0x2d7258[_0x5bab('0x41')];_0x437ce0++){_0x1237c8[_0x5bab('0x7c')](squel[_0x5bab('0x76')]()['field'](_0x5bab('0x7f'))[_0x5bab('0x77')](_0x5bab('0x80'))[_0x5bab('0x45')](_0x5bab('0x81'),_0x2d7258[_0x437ce0]['id'])[_0x5bab('0x45')](_0x5bab('0x82')),'additionalPhone_'+_0x2d7258[_0x437ce0][_0x5bab('0x3b')]);_0x1237c8['field'](squel[_0x5bab('0x76')]()[_0x5bab('0x7c')](_0x5bab('0x83'))[_0x5bab('0x77')](_0x5bab('0x80'))[_0x5bab('0x45')](_0x5bab('0x81'),_0x2d7258[_0x437ce0]['id'])[_0x5bab('0x45')](_0x5bab('0x82')),_0x5bab('0x84')+_0x2d7258[_0x437ce0]['name']);}var _0x24d91b=[];_0x24d91b['push'](_0x1237c8[_0x5bab('0x85')]());BPromise[_0x5bab('0x69')](_0x24d91b,handleQuery)[_0x5bab('0x2e')](function(_0x474ef9){handleQuery(_0x1237c8[_0x5bab('0x85')]());var _0x19bab9=csv_results[0x0];if(!_[_0x5bab('0x86')](_0x19bab9)){var _0x3f5030=toCsv(_0x19bab9);var _0x2184c8=Date[_0x5bab('0x87')]();fs['writeFileSync'](util[_0x5bab('0x88')](_0x5bab('0x89'),_0x2c7be5,_0x2184c8),_0x3f5030);_0x18d47f[_0x5bab('0x8a')](_0x5bab('0x8b'),'attachment;\x20filename='+util[_0x5bab('0x88')](_0x5bab('0x8c'),_0x2c7be5,_0x2184c8));_0x18d47f['setHeader'](_0x5bab('0x8d'),_0x5bab('0x8e'));return _0x18d47f[_0x5bab('0x8f')](util[_0x5bab('0x88')](_0x5bab('0x89'),_0x2c7be5,_0x2184c8));}else{return _0x18d47f[_0x5bab('0x20')](0xcc);}});});});};exports[_0x5bab('0x90')]=function(_0xaee373,_0x109130,_0x5bc657){var _0x3cf184;delete _0xaee373[_0x5bab('0x53')]['id'];return db[_0x5bab('0x36')][_0x5bab('0x5f')]({'where':{'id':_0xaee373[_0x5bab('0x5a')]['id']}})[_0x5bab('0x2e')](handleEntityNotFound(_0x109130,null))[_0x5bab('0x2e')](function(_0x287c2c){if(_0x287c2c){return db[_0x5bab('0x91')][_0x5bab('0x92')](function(_0x18bfbe){return db[_0x5bab('0x74')]['create'](_0xaee373['body'],{'transaction':_0x18bfbe})[_0x5bab('0x2e')](function(_0x4e5a28){_0x3cf184=_0x4e5a28;return _0x287c2c['addCustomFields'](_0x4e5a28,{'transaction':_0x18bfbe});})['then'](function(){var _0x536583={'type':db[_0x5bab('0x93')]['TEXT'],'transaction':_0x18bfbe};switch(_0xaee373[_0x5bab('0x53')][_0x5bab('0x46')]){case _0x5bab('0x94'):_0x536583[_0x5bab('0x46')]=db[_0x5bab('0x93')][_0x5bab('0x95')];break;case _0x5bab('0x96'):_0x536583[_0x5bab('0x46')]=db[_0x5bab('0x93')]['INTEGER'];break;case _0x5bab('0x97'):_0x536583[_0x5bab('0x46')]=db[_0x5bab('0x93')][_0x5bab('0x98')];_0x536583[_0x5bab('0x99')]=![];break;default:}return db[_0x5bab('0x91')][_0x5bab('0x9a')]['addColumn'](_0x5bab('0x78'),util[_0x5bab('0x88')](_0x5bab('0x9b'),_0x3cf184['id']),_0x536583);})[_0x5bab('0x2e')](function(){return _0x3cf184;});});}})['then'](respondWithResult(_0x109130,null))['catch'](handleError(_0x109130,null));};exports['getCustomFields']=function(_0x4164ab,_0x46e1ad,_0x4c9c6d){var _0x58a6cc={};var _0x4c7436={};var _0x2a2226;var _0x32570d;return db[_0x5bab('0x36')][_0x5bab('0x5f')]({'where':{'id':_0x4164ab[_0x5bab('0x5a')]['id']}})[_0x5bab('0x2e')](handleEntityNotFound(_0x46e1ad,null))[_0x5bab('0x2e')](function(_0x5118ff){if(_0x5118ff){_0x2a2226=_0x5118ff;_0x4c7436[_0x5bab('0x3a')]=_['keys'](db['CmCustomField']['rawAttributes']);_0x4c7436[_0x5bab('0x3d')]=_[_0x5bab('0x3c')](_0x4164ab[_0x5bab('0x3d')]);_0x4c7436[_0x5bab('0x4f')]=_[_0x5bab('0x3e')](_0x4c7436[_0x5bab('0x3a')],_0x4c7436[_0x5bab('0x3d')]);_0x58a6cc[_0x5bab('0x3f')]=_[_0x5bab('0x3e')](_0x4c7436['model'],qs[_0x5bab('0x40')](_0x4164ab[_0x5bab('0x3d')]['fields']));_0x58a6cc[_0x5bab('0x3f')]=_0x58a6cc[_0x5bab('0x3f')][_0x5bab('0x41')]?_0x58a6cc[_0x5bab('0x3f')]:_0x4c7436[_0x5bab('0x3a')];_0x58a6cc['order']=qs[_0x5bab('0x44')](_0x4164ab[_0x5bab('0x3d')][_0x5bab('0x44')]);_0x58a6cc[_0x5bab('0x45')]=qs[_0x5bab('0x4f')](_[_0x5bab('0x61')](_0x4164ab[_0x5bab('0x3d')],_0x4c7436[_0x5bab('0x4f')]));_0x58a6cc[_0x5bab('0x45')]=_['merge'](_0x58a6cc[_0x5bab('0x45')],{'$or':[{'ListId':_0x5118ff['id']},{'ListId':null}]});if(_0x4164ab[_0x5bab('0x3d')][_0x5bab('0x48')]){_0x58a6cc[_0x5bab('0x45')]=_[_0x5bab('0x49')](_0x58a6cc[_0x5bab('0x45')],{'$or':_['map'](_0x58a6cc[_0x5bab('0x3f')],function(_0xafad2d){var _0x3c95f2={};_0x3c95f2[_0xafad2d]={'$like':'%'+_0x4164ab[_0x5bab('0x3d')]['filter']+'%'};return _0x3c95f2;})});}_0x58a6cc=_[_0x5bab('0x49')]({},_0x58a6cc,_0x4164ab[_0x5bab('0x50')]);return db[_0x5bab('0x74')][_0x5bab('0x9c')](_0x58a6cc);}})['then'](respondWithResult(_0x46e1ad,null))['catch'](handleError(_0x46e1ad,null));};exports['getGlobalCustomFields']=function(_0x4a74fa,_0x1c2fd4){return db['CmCustomField'][_0x5bab('0x9c')]({'where':{'ListId':null}})[_0x5bab('0x2e')](handleEntityNotFound(_0x1c2fd4,null))[_0x5bab('0x2e')](function(_0x48d21e){return _0x48d21e;})[_0x5bab('0x2e')](respondWithResult(_0x1c2fd4,null))[_0x5bab('0x4d')](handleError(_0x1c2fd4,null));};exports[_0x5bab('0x9d')]=function(_0x3e4ec1,_0x357c96,_0xee392d){return db[_0x5bab('0x36')][_0x5bab('0x51')]({'where':{'id':_0x3e4ec1['params']['id']}})[_0x5bab('0x2e')](handleEntityNotFound(_0x357c96,null))[_0x5bab('0x2e')](function(_0x3ca4db){if(_0x3ca4db){return _0x3ca4db[_0x5bab('0x9d')](_0x3e4ec1[_0x5bab('0x53')]['ids'],_[_0x5bab('0x6a')](_0x3e4ec1[_0x5bab('0x53')],[_0x5bab('0x63'),'id'])||{})[_0x5bab('0x9e')](function(_0x4976ea){for(var _0x199081=0x0;_0x199081<_0x3e4ec1[_0x5bab('0x53')]['ids'][_0x5bab('0x41')];_0x199081+=0x1){socket[_0x5bab('0x9f')](_0x5bab('0xa0'),{'UserId':Number(_0x3e4ec1[_0x5bab('0x53')][_0x5bab('0x63')][_0x199081]),'CmListId':Number(_0x3e4ec1[_0x5bab('0x5a')]['id'])});}return _0x4976ea;});}})['then'](respondWithResult(_0x357c96,null))[_0x5bab('0x4d')](handleError(_0x357c96,null));};exports['removeAgents']=function(_0x46321a,_0x4569bc,_0x1b856e){return db[_0x5bab('0x36')][_0x5bab('0x51')]({'where':{'id':_0x46321a[_0x5bab('0x5a')]['id']}})[_0x5bab('0x2e')](handleEntityNotFound(_0x4569bc,null))[_0x5bab('0x2e')](function(_0x260628){if(_0x260628){return _0x260628[_0x5bab('0xa1')](_0x46321a[_0x5bab('0x3d')][_0x5bab('0x63')])['then'](function(){if(_[_0x5bab('0x66')](_0x46321a['query'][_0x5bab('0x63')])){for(var _0x410a96=0x0;_0x410a96<_0x46321a['query'][_0x5bab('0x63')][_0x5bab('0x41')];_0x410a96+=0x1){socket[_0x5bab('0x9f')](_0x5bab('0xa2'),{'UserId':Number(_0x46321a[_0x5bab('0x3d')][_0x5bab('0x63')][_0x410a96]),'CmListId':Number(_0x46321a[_0x5bab('0x5a')]['id'])});}}else{socket['emit'](_0x5bab('0xa2'),{'UserId':Number(_0x46321a[_0x5bab('0x3d')]['ids']),'CmListId':Number(_0x46321a['params']['id'])});}});}})[_0x5bab('0x2e')](respondWithStatusCode(_0x4569bc,null))[_0x5bab('0x4d')](handleError(_0x4569bc,null));};exports[_0x5bab('0xa3')]=function(_0x1bb41d,_0x478046,_0x32dcf0){var _0x37be71={};var _0x5aca1b={};var _0x3ea06c;var _0x15c06d;return db['CmList'][_0x5bab('0x5f')]({'where':{'id':_0x1bb41d['params']['id']}})[_0x5bab('0x2e')](handleEntityNotFound(_0x478046,null))[_0x5bab('0x2e')](function(_0x1badd3){if(_0x1badd3){_0x3ea06c=_0x1badd3;_0x5aca1b[_0x5bab('0x3a')]=_['keys'](db[_0x5bab('0xa4')]['rawAttributes']);_0x5aca1b[_0x5bab('0x3d')]=_[_0x5bab('0x3c')](_0x1bb41d[_0x5bab('0x3d')]);_0x5aca1b['filters']=_[_0x5bab('0x3e')](_0x5aca1b[_0x5bab('0x3a')],_0x5aca1b[_0x5bab('0x3d')]);_0x37be71['attributes']=_[_0x5bab('0x3e')](_0x5aca1b[_0x5bab('0x3a')],qs[_0x5bab('0x40')](_0x1bb41d[_0x5bab('0x3d')]['fields']));_0x37be71['attributes']=_0x37be71[_0x5bab('0x3f')]['length']?_0x37be71[_0x5bab('0x3f')]:_0x5aca1b['model'];_0x37be71[_0x5bab('0x43')]=qs['sort'](_0x1bb41d[_0x5bab('0x3d')]['sort']);_0x37be71[_0x5bab('0x45')]=qs[_0x5bab('0x4f')](_['pick'](_0x1bb41d['query'],_0x5aca1b[_0x5bab('0x4f')]));if(_0x1bb41d[_0x5bab('0x3d')][_0x5bab('0x48')]){_0x37be71[_0x5bab('0x45')]=_[_0x5bab('0x49')](_0x37be71[_0x5bab('0x45')],{'$or':_[_0x5bab('0x35')](_0x37be71[_0x5bab('0x3f')],function(_0x2ec7bc){var _0x2542d4={};_0x2542d4[_0x2ec7bc]={'$like':'%'+_0x1bb41d[_0x5bab('0x3d')][_0x5bab('0x48')]+'%'};return _0x2542d4;})});}_0x37be71=_[_0x5bab('0x49')]({},_0x37be71,_0x1bb41d['options']);return _0x3ea06c[_0x5bab('0xa3')](_0x37be71);}})['then'](function(_0x412b49){if(_0x412b49){_0x15c06d=_0x412b49['length'];if(!_0x1bb41d[_0x5bab('0x3d')][_0x5bab('0x42')]('nolimit')){_0x37be71['limit']=qs[_0x5bab('0x26')](_0x1bb41d[_0x5bab('0x3d')][_0x5bab('0x26')]);_0x37be71['offset']=qs[_0x5bab('0x24')](_0x1bb41d[_0x5bab('0x3d')][_0x5bab('0x24')]);}return _0x3ea06c[_0x5bab('0xa3')](_0x37be71);}})['then'](function(_0x24b4bf){if(_0x24b4bf){return _0x24b4bf?{'count':_0x15c06d,'rows':_0x24b4bf}:null;}})[_0x5bab('0x2e')](respondWithResult(_0x478046,null))[_0x5bab('0x4d')](handleError(_0x478046,null));};function handleQuery(_0x4f9084){logger[_0x5bab('0xa5')](_0x4f9084);return db['sequelize'][_0x5bab('0x3d')](_0x4f9084)['spread'](function(_0x5b4118){csv_results[_0x5bab('0x68')](_0x5b4118);})['catch'](function(_0x36151a){logger['error'](_0x36151a[_0x5bab('0x6d')]);});} \ No newline at end of file +var _0xb50d=['emit','userCmList:remove','User','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','update','then','get','Lists','destroy','stack','name','send','index','map','CmList','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','ListId','findOne','Disposition','nolimit','order','removeDispositions','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','hasOwnProperty','getContactsCsv','OrderBy','alias','cm_contacts','c.ListId\x20=\x20?','distinct','customField_','field','item','CmContactId\x20=\x20c.id','additionalPhone_','select','description','cm_contact_has_items','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','findAndCountAll','addAgents','spread','userCmList:save','removeAgents'];(function(_0x1fdd50,_0x478860){var _0xd2c2f3=function(_0x49bfe0){while(--_0x49bfe0){_0x1fdd50['push'](_0x1fdd50['shift']());}};_0xd2c2f3(++_0x478860);}(_0xb50d,0x14d));var _0xdb50=function(_0x474985,_0x5cce35){_0x474985=_0x474985-0x0;var _0x559926=_0xb50d[_0x474985];return _0x559926;};'use strict';var emlformat=require(_0xdb50('0x0'));var rimraf=require(_0xdb50('0x1'));var zipdir=require(_0xdb50('0x2'));var jsonpatch=require(_0xdb50('0x3'));var rp=require('request-promise');var moment=require(_0xdb50('0x4'));var BPromise=require(_0xdb50('0x5'));var Mustache=require(_0xdb50('0x6'));var util=require(_0xdb50('0x7'));var path=require(_0xdb50('0x8'));var sox=require(_0xdb50('0x9'));var csv=require(_0xdb50('0xa'));var ejs=require(_0xdb50('0xb'));var fs=require('fs');var fs_extra=require(_0xdb50('0xc'));var _=require(_0xdb50('0xd'));var squel=require('squel');var crypto=require(_0xdb50('0xe'));var jsforce=require(_0xdb50('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdb50('0xa'));var querystring=require(_0xdb50('0x10'));var Papa=require('papaparse');var Redis=require(_0xdb50('0x11'));var authService=require(_0xdb50('0x12'));var qs=require(_0xdb50('0x13'));var as=require(_0xdb50('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb50('0x15'))(_0xdb50('0x16'));var utils=require(_0xdb50('0x17'));var config=require(_0xdb50('0x18'));var licenseUtil=require(_0xdb50('0x19'));var db=require(_0xdb50('0x1a'))['db'];var csv_results;config[_0xdb50('0x1b')]=_[_0xdb50('0x1c')](config[_0xdb50('0x1b')],{'host':_0xdb50('0x1d'),'port':0x18eb});var socket=require(_0xdb50('0x1e'))(new Redis(config[_0xdb50('0x1b')]));require('./cmList.socket')[_0xdb50('0x1f')](socket);function respondWithStatusCode(_0x469509,_0x583e17){_0x583e17=_0x583e17||0xcc;return function(_0x4fdbd8){if(_0x4fdbd8){return _0x469509[_0xdb50('0x20')](_0x583e17);}return _0x469509[_0xdb50('0x21')](_0x583e17)[_0xdb50('0x22')]();};}function respondWithResult(_0x43b7c2,_0x5dda5d){_0x5dda5d=_0x5dda5d||0xc8;return function(_0x219a97){if(_0x219a97){return _0x43b7c2[_0xdb50('0x21')](_0x5dda5d)[_0xdb50('0x23')](_0x219a97);}};}function respondWithFilteredResult(_0x5a7ad1,_0x4bf0bb){return function(_0x259dfc){if(_0x259dfc){var _0xa725e=typeof _0x4bf0bb[_0xdb50('0x24')]===_0xdb50('0x25')&&typeof _0x4bf0bb['limit']==='undefined';var _0xfe02ac=_0x259dfc[_0xdb50('0x26')];var _0xd393bc=_0xa725e?0x0:_0x4bf0bb['offset'];var _0x23e58a=_0xa725e?_0x259dfc[_0xdb50('0x26')]:_0x4bf0bb[_0xdb50('0x24')]+_0x4bf0bb['limit'];var _0x35cf4f;if(_0x23e58a>=_0xfe02ac){_0x23e58a=_0xfe02ac;_0x35cf4f=0xc8;}else{_0x35cf4f=0xce;}_0x5a7ad1['status'](_0x35cf4f);return _0x5a7ad1['set'](_0xdb50('0x27'),_0xd393bc+'-'+_0x23e58a+'/'+_0xfe02ac)[_0xdb50('0x23')](_0x259dfc);}return null;};}function patchUpdates(_0x412699){return function(_0x206cf1){try{jsonpatch['apply'](_0x206cf1,_0x412699,!![]);}catch(_0x14bdb1){return BPromise[_0xdb50('0x28')](_0x14bdb1);}return _0x206cf1['save']();};}function saveUpdates(_0x57dda7,_0x5b697c){return function(_0x20562d){if(_0x20562d){return _0x20562d[_0xdb50('0x29')](_0x57dda7)['then'](function(_0x5f36c9){return _0x5f36c9;});}return null;};}function removeEntity(_0x5c6800,_0x3b5736){return function(_0x5d8b67){if(_0x5d8b67){return _0x5d8b67['destroy']()[_0xdb50('0x2a')](function(){var _0x5ad6e0=_0x5d8b67[_0xdb50('0x2b')]({'plain':!![]});var _0x305be7=_0xdb50('0x2c');return db['UserProfileResource'][_0xdb50('0x2d')]({'where':{'type':_0x305be7,'resourceId':_0x5ad6e0['id']}})[_0xdb50('0x2a')](function(){return _0x5d8b67;});})['then'](function(){_0x5c6800[_0xdb50('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45aef9,_0x50b215){return function(_0x270fa8){if(!_0x270fa8){_0x45aef9[_0xdb50('0x20')](0x194);}return _0x270fa8;};}function handleError(_0x77721b,_0x5d7c5a){_0x5d7c5a=_0x5d7c5a||0x1f4;return function(_0x44dc48){logger['error'](_0x44dc48[_0xdb50('0x2e')]);if(_0x44dc48[_0xdb50('0x2f')]){delete _0x44dc48[_0xdb50('0x2f')];}_0x77721b[_0xdb50('0x21')](_0x5d7c5a)[_0xdb50('0x30')](_0x44dc48);};}exports[_0xdb50('0x31')]=function(_0x4301dd,_0x26276b){var _0xce323={},_0x45d163={},_0x3cf70b={'count':0x0,'rows':[]};var _0x2350bc=_[_0xdb50('0x32')](db[_0xdb50('0x33')][_0xdb50('0x34')],function(_0x18d993){return{'name':_0x18d993['fieldName'],'type':_0x18d993['type'][_0xdb50('0x35')]};});_0x45d163[_0xdb50('0x36')]=_[_0xdb50('0x32')](_0x2350bc,_0xdb50('0x2f'));_0x45d163['query']=_['keys'](_0x4301dd[_0xdb50('0x37')]);_0x45d163[_0xdb50('0x38')]=_[_0xdb50('0x39')](_0x45d163[_0xdb50('0x36')],_0x45d163[_0xdb50('0x37')]);_0xce323[_0xdb50('0x3a')]=_[_0xdb50('0x39')](_0x45d163['model'],qs[_0xdb50('0x3b')](_0x4301dd[_0xdb50('0x37')][_0xdb50('0x3b')]));_0xce323[_0xdb50('0x3a')]=_0xce323[_0xdb50('0x3a')][_0xdb50('0x3c')]?_0xce323[_0xdb50('0x3a')]:_0x45d163[_0xdb50('0x36')];if(!_0x4301dd['query']['hasOwnProperty']('nolimit')){_0xce323[_0xdb50('0x3d')]=qs[_0xdb50('0x3d')](_0x4301dd[_0xdb50('0x37')][_0xdb50('0x3d')]);_0xce323[_0xdb50('0x24')]=qs[_0xdb50('0x24')](_0x4301dd[_0xdb50('0x37')][_0xdb50('0x24')]);}_0xce323['order']=qs[_0xdb50('0x3e')](_0x4301dd[_0xdb50('0x37')][_0xdb50('0x3e')]);_0xce323[_0xdb50('0x3f')]=qs[_0xdb50('0x38')](_[_0xdb50('0x40')](_0x4301dd[_0xdb50('0x37')],_0x45d163[_0xdb50('0x38')]),_0x2350bc);if(_0x4301dd[_0xdb50('0x37')][_0xdb50('0x41')]){_0xce323[_0xdb50('0x3f')]=_[_0xdb50('0x42')](_0xce323[_0xdb50('0x3f')],{'$or':_[_0xdb50('0x32')](_0x2350bc,function(_0x5efad8){if(_0x5efad8[_0xdb50('0x43')]!==_0xdb50('0x44')){var _0x4108a6={};_0x4108a6[_0x5efad8[_0xdb50('0x2f')]]={'$like':'%'+_0x4301dd['query'][_0xdb50('0x41')]+'%'};return _0x4108a6;}})});}_0xce323=_[_0xdb50('0x42')]({},_0xce323,_0x4301dd[_0xdb50('0x45')]);var _0xb15bb4={'where':_0xce323[_0xdb50('0x3f')]};return db[_0xdb50('0x33')]['count'](_0xb15bb4)['then'](function(_0x3e2f55){_0x3cf70b[_0xdb50('0x26')]=_0x3e2f55;if(_0x4301dd[_0xdb50('0x37')]['includeAll']){_0xce323[_0xdb50('0x46')]=[{'all':!![]}];}return db[_0xdb50('0x33')][_0xdb50('0x47')](_0xce323);})[_0xdb50('0x2a')](function(_0x122a87){_0x3cf70b[_0xdb50('0x48')]=_0x122a87;return _0x3cf70b;})[_0xdb50('0x2a')](respondWithFilteredResult(_0x26276b,_0xce323))[_0xdb50('0x49')](handleError(_0x26276b,null));};exports[_0xdb50('0x4a')]=function(_0x39055c,_0x14b53f){var _0x39f941={'raw':![],'where':{'id':_0x39055c['params']['id']}},_0xc9f120={};_0xc9f120[_0xdb50('0x36')]=_[_0xdb50('0x4b')](db[_0xdb50('0x33')][_0xdb50('0x34')]);_0xc9f120[_0xdb50('0x37')]=_[_0xdb50('0x4b')](_0x39055c['query']);_0xc9f120[_0xdb50('0x38')]=_[_0xdb50('0x39')](_0xc9f120[_0xdb50('0x36')],_0xc9f120['query']);_0x39f941[_0xdb50('0x3a')]=_[_0xdb50('0x39')](_0xc9f120['model'],qs[_0xdb50('0x3b')](_0x39055c[_0xdb50('0x37')][_0xdb50('0x3b')]));_0x39f941[_0xdb50('0x3a')]=_0x39f941['attributes'][_0xdb50('0x3c')]?_0x39f941[_0xdb50('0x3a')]:_0xc9f120[_0xdb50('0x36')];if(_0x39055c[_0xdb50('0x37')][_0xdb50('0x4c')]){_0x39f941[_0xdb50('0x46')]=[{'all':!![]}];}_0x39f941=_[_0xdb50('0x42')]({},_0x39f941,_0x39055c['options']);return db[_0xdb50('0x33')][_0xdb50('0x4d')](_0x39f941)['then'](handleEntityNotFound(_0x14b53f,null))[_0xdb50('0x2a')](respondWithResult(_0x14b53f,null))[_0xdb50('0x49')](handleError(_0x14b53f,null));};exports['create']=function(_0x252612,_0x43ba87){return db[_0xdb50('0x33')]['create'](_0x252612[_0xdb50('0x4e')],{})['then'](function(_0x300890){var _0x564924=_0x252612[_0xdb50('0x4f')][_0xdb50('0x2b')]({'plain':!![]});if(!_0x564924)throw new Error(_0xdb50('0x50'));if(_0x564924[_0xdb50('0x51')]===_0xdb50('0x4f')){var _0x5366df=_0x300890[_0xdb50('0x2b')]({'plain':!![]});var _0x2003d9=_0xdb50('0x2c');return db[_0xdb50('0x52')]['find']({'where':{'name':_0x2003d9,'userProfileId':_0x564924[_0xdb50('0x53')]},'raw':!![]})[_0xdb50('0x2a')](function(_0x80c0d6){if(_0x80c0d6&&_0x80c0d6['autoAssociation']===0x0){return db[_0xdb50('0x54')][_0xdb50('0x55')]({'name':_0x5366df[_0xdb50('0x2f')],'resourceId':_0x5366df['id'],'type':_0x80c0d6[_0xdb50('0x2f')],'sectionId':_0x80c0d6['id']},{})[_0xdb50('0x2a')](function(){return _0x300890;});}else{return _0x300890;}})[_0xdb50('0x49')](function(_0x1697e9){logger[_0xdb50('0x56')](_0xdb50('0x57'),_0x1697e9);throw _0x1697e9;});}return _0x300890;})['then'](respondWithResult(_0x43ba87,0xc9))[_0xdb50('0x49')](handleError(_0x43ba87,null));};exports[_0xdb50('0x29')]=function(_0x463ea5,_0x24ea5f){if(_0x463ea5['body']['id']){delete _0x463ea5[_0xdb50('0x4e')]['id'];}return db[_0xdb50('0x33')][_0xdb50('0x4d')]({'where':{'id':_0x463ea5[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x24ea5f,null))[_0xdb50('0x2a')](saveUpdates(_0x463ea5['body'],null))[_0xdb50('0x2a')](respondWithResult(_0x24ea5f,null))[_0xdb50('0x49')](handleError(_0x24ea5f,null));};exports['destroy']=function(_0x526d1d,_0xb54004){return db[_0xdb50('0x33')][_0xdb50('0x4d')]({'where':{'id':_0x526d1d[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0xb54004,null))[_0xdb50('0x2a')](removeEntity(_0xb54004,null))[_0xdb50('0x49')](handleError(_0xb54004,null));};exports['describe']=function(_0x4dfbf4,_0x5f2dd9){return db[_0xdb50('0x33')]['describe']()[_0xdb50('0x2a')](respondWithResult(_0x5f2dd9,null))[_0xdb50('0x49')](handleError(_0x5f2dd9,null));};exports[_0xdb50('0x59')]=function(_0x366e03,_0x20365d,_0x5a5fae){if(_0x366e03['body']['id']){delete _0x366e03[_0xdb50('0x4e')]['id'];}return db[_0xdb50('0x33')][_0xdb50('0x4d')]({'where':{'id':_0x366e03[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x20365d,null))[_0xdb50('0x2a')](function(_0x29d9fc){if(_0x29d9fc){_0x366e03['body'][_0xdb50('0x5a')]=_0x29d9fc['id'];return db['Disposition'][_0xdb50('0x55')](_0x366e03[_0xdb50('0x4e')]);}})[_0xdb50('0x2a')](respondWithResult(_0x20365d,null))[_0xdb50('0x49')](handleError(_0x20365d,null));};exports['getDispositions']=function(_0x1c3f99,_0x54c332,_0x14a9ee){var _0x380aa3={'raw':![],'where':{}};var _0x1fdb35={};var _0x39258a={'count':0x0,'rows':[]};return db[_0xdb50('0x33')][_0xdb50('0x5b')]({'where':{'id':_0x1c3f99[_0xdb50('0x58')]['id']}})['then'](handleEntityNotFound(_0x54c332,null))['then'](function(_0x2fc09f){if(_0x2fc09f){_0x1fdb35['model']=_['keys'](db[_0xdb50('0x5c')]['rawAttributes']);_0x1fdb35[_0xdb50('0x37')]=_[_0xdb50('0x4b')](_0x1c3f99[_0xdb50('0x37')]);_0x1fdb35[_0xdb50('0x38')]=_[_0xdb50('0x39')](_0x1fdb35[_0xdb50('0x36')],_0x1fdb35[_0xdb50('0x37')]);_0x380aa3['attributes']=_[_0xdb50('0x39')](_0x1fdb35['model'],qs['fields'](_0x1c3f99[_0xdb50('0x37')][_0xdb50('0x3b')]));_0x380aa3['attributes']=_0x380aa3[_0xdb50('0x3a')][_0xdb50('0x3c')]?_0x380aa3['attributes']:_0x1fdb35[_0xdb50('0x36')];if(!_0x1c3f99[_0xdb50('0x37')]['hasOwnProperty'](_0xdb50('0x5d'))){_0x380aa3[_0xdb50('0x3d')]=qs['limit'](_0x1c3f99[_0xdb50('0x37')][_0xdb50('0x3d')]);_0x380aa3[_0xdb50('0x24')]=qs[_0xdb50('0x24')](_0x1c3f99[_0xdb50('0x37')][_0xdb50('0x24')]);}_0x380aa3[_0xdb50('0x5e')]=qs[_0xdb50('0x3e')](_0x1c3f99['query'][_0xdb50('0x3e')]);_0x380aa3['where']=qs[_0xdb50('0x38')](_[_0xdb50('0x40')](_0x1c3f99[_0xdb50('0x37')],_0x1fdb35[_0xdb50('0x38')]));_0x380aa3[_0xdb50('0x3f')]['ListId']=_0x2fc09f['id'];if(_0x1c3f99[_0xdb50('0x37')]['filter']){_0x380aa3[_0xdb50('0x3f')]=_[_0xdb50('0x42')](_0x380aa3[_0xdb50('0x3f')],{'$or':_[_0xdb50('0x32')](_0x380aa3[_0xdb50('0x3a')],function(_0x2623e9){var _0x1bf5a4={};_0x1bf5a4[_0x2623e9]={'$like':'%'+_0x1c3f99[_0xdb50('0x37')]['filter']+'%'};return _0x1bf5a4;})});}_0x380aa3=_[_0xdb50('0x42')]({},_0x380aa3,_0x1c3f99[_0xdb50('0x45')]);return db['Disposition'][_0xdb50('0x26')]({'where':_0x380aa3[_0xdb50('0x3f')]})['then'](function(_0x197331){_0x39258a[_0xdb50('0x26')]=_0x197331;if(_0x1c3f99[_0xdb50('0x37')][_0xdb50('0x4c')]){_0x380aa3[_0xdb50('0x46')]=[{'all':!![]}];}return db[_0xdb50('0x5c')][_0xdb50('0x47')](_0x380aa3);})[_0xdb50('0x2a')](function(_0x193370){_0x39258a[_0xdb50('0x48')]=_0x193370;return _0x39258a;});}})['then'](respondWithFilteredResult(_0x54c332,_0x380aa3))[_0xdb50('0x49')](handleError(_0x54c332,null));};exports['removeDispositions']=function(_0x222dae,_0xa21111,_0x558bd7){return db[_0xdb50('0x33')][_0xdb50('0x4d')]({'where':{'id':_0x222dae['params']['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0xa21111,null))[_0xdb50('0x2a')](function(_0x434a28){if(_0x434a28){return _0x434a28[_0xdb50('0x5f')](_0x222dae[_0xdb50('0x37')][_0xdb50('0x60')]);}})[_0xdb50('0x2a')](respondWithStatusCode(_0xa21111,null))[_0xdb50('0x49')](handleError(_0xa21111,null));};exports['addContacts']=function(_0x533c9e,_0x203854,_0x3dacff){return db[_0xdb50('0x33')][_0xdb50('0x4d')]({'where':{'id':_0x533c9e[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x203854,null))[_0xdb50('0x2a')](function(_0x4c4a77){if(_0x4c4a77){var _0x2eb39f=[];var _0x551f37={'success':[],'errors':[]};return db[_0xdb50('0x61')][_0xdb50('0x62')]()[_0xdb50('0x2a')](function(_0x364c5f){if(_0x533c9e[_0xdb50('0x4e')][_0xdb50('0x63')]&&_[_0xdb50('0x64')](_0x533c9e[_0xdb50('0x4e')][_0xdb50('0x63')])){if(_0x533c9e[_0xdb50('0x4e')][_0xdb50('0x63')][_0xdb50('0x3c')]){_0x533c9e['body']['tags']=_0x533c9e['body'][_0xdb50('0x63')][_0xdb50('0x65')](';')+';';}else{_0x533c9e[_0xdb50('0x4e')]['tags']=null;}}else{_0x533c9e['body']['tags']=null;}if(_0x533c9e[_0xdb50('0x4e')]&&_['isArray'](_0x533c9e[_0xdb50('0x4e')])){for(var _0x34ba08=0x0;_0x34ba08<_0x533c9e['body'][_0xdb50('0x3c')];_0x34ba08+=0x1){_0x533c9e[_0xdb50('0x4e')][_0x34ba08]['ListId']=_0x533c9e[_0xdb50('0x58')]['id'];_0x2eb39f[_0xdb50('0x66')](_0x533c9e[_0xdb50('0x4e')][_0x34ba08]);}return BPromise[_0xdb50('0x67')](_0x2eb39f,function(_0x30d275){return db[_0xdb50('0x61')][_0xdb50('0x55')](_[_0xdb50('0x68')](_0x30d275,[_0xdb50('0x60'),'id'])||{},{'fields':_[_0xdb50('0x4b')](_0x364c5f),'raw':!![]})[_0xdb50('0x2a')](function(_0x1b389d){_0x551f37[_0xdb50('0x69')]['push'](_0x1b389d[_0xdb50('0x6a')]);})['catch'](function(_0x3a4037){_0x551f37['errors']['push']({'data':_0x30d275,'error':_0x3a4037[_0xdb50('0x6b')]});});})[_0xdb50('0x2a')](function(_0xae3c1){return _0x551f37;})['catch'](function(_0x4d099d){return _0x4d099d;});}else{_0x203854[_0xdb50('0x21')](0x190)[_0xdb50('0x23')]({'message':_0xdb50('0x6c')});}});}})[_0xdb50('0x2a')](respondWithResult(_0x203854,null))['catch'](handleError(_0x203854,null));};exports[_0xdb50('0x6d')]=function(_0x1cd8e7,_0x206469,_0x3a6174){var _0x79ffda;return db[_0xdb50('0x33')][_0xdb50('0x4d')]({'where':{'id':_0x1cd8e7['params']['id']},'include':[{'model':db[_0xdb50('0x6e')],'as':_0xdb50('0x6f')}]})[_0xdb50('0x2a')](handleEntityNotFound(_0x206469,null))[_0xdb50('0x2a')](function(_0x4ce491){if(_0x4ce491){_0x79ffda=_0x4ce491;return db[_0xdb50('0x61')]['rawAttributes'];}})[_0xdb50('0x2a')](function(_0x105142){if(_0x105142){var _0x2b4907={};var _0x16d924={};_0x16d924[_0xdb50('0x36')]=_[_0xdb50('0x70')](_[_0xdb50('0x4b')](_0x105142),_[_0xdb50('0x32')](_0x79ffda[_0xdb50('0x6f')],function(_0x5ac133){return util[_0xdb50('0x71')]('cf_%d',_0x5ac133['id']);}));_0x16d924[_0xdb50('0x37')]=_['keys'](_0x1cd8e7['query']);_0x16d924[_0xdb50('0x38')]=_['intersection'](_0x16d924[_0xdb50('0x36')],_0x16d924['query']);_0x2b4907[_0xdb50('0x3a')]=_['intersection'](_0x16d924['model'],qs[_0xdb50('0x3b')](_0x1cd8e7['query']['fields']));_0x2b4907[_0xdb50('0x3a')]=_0x2b4907['attributes'][_0xdb50('0x3c')]?_0x2b4907[_0xdb50('0x3a')]:_0x16d924[_0xdb50('0x36')];if(!_0x1cd8e7['query'][_0xdb50('0x72')]('nolimit')){_0x2b4907[_0xdb50('0x3d')]=qs['limit'](_0x1cd8e7[_0xdb50('0x37')][_0xdb50('0x3d')]);_0x2b4907[_0xdb50('0x24')]=qs[_0xdb50('0x24')](_0x1cd8e7['query'][_0xdb50('0x24')]);}_0x2b4907[_0xdb50('0x5e')]=qs['sort'](_0x1cd8e7[_0xdb50('0x37')]['sort']);_0x2b4907[_0xdb50('0x3f')]=qs[_0xdb50('0x38')](_[_0xdb50('0x40')](_0x1cd8e7[_0xdb50('0x37')],_0x16d924['filters']));_0x2b4907['raw']=!![];if(_0x1cd8e7[_0xdb50('0x37')]['filter']){_0x2b4907[_0xdb50('0x3f')]=_[_0xdb50('0x42')](_0x2b4907[_0xdb50('0x3f')],{'$or':_[_0xdb50('0x32')](_0x2b4907[_0xdb50('0x3a')],function(_0x32a5bc){var _0x5bbe26={};_0x5bbe26[_0x32a5bc]={'$like':'%'+_0x1cd8e7['query'][_0xdb50('0x41')]+'%'};return _0x5bbe26;})});}_0x2b4907=_[_0xdb50('0x42')]({},_0x2b4907,_0x1cd8e7[_0xdb50('0x45')]);return _0x79ffda[_0xdb50('0x6d')](_0x2b4907);}})[_0xdb50('0x2a')](respondWithResult(_0x206469,null))[_0xdb50('0x49')](handleError(_0x206469,null));};exports[_0xdb50('0x73')]=function(_0x365e78,_0x2a3ed1,_0x7de05c){var _0x57c084;var _0x324d0e;var _0x315e0c;var _0x1c0707=_0x365e78[_0xdb50('0x58')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0xdb50('0x2f')],'raw':!![],'order':[_0xdb50('0x74')]})[_0xdb50('0x2a')](function(_0x41b7cb){_0x57c084=_0x41b7cb;var _0x2f8073=_[_0xdb50('0x4b')](db[_0xdb50('0x61')]['rawAttributes']);return db[_0xdb50('0x6e')][_0xdb50('0x47')]({'raw':!![],'attributes':['id',_0xdb50('0x75')]})['then'](function(_0x17d3db){_0x324d0e=_0x17d3db;var _0x8c9cca=squel['select']()['fields'](_0x2f8073)['from'](_0xdb50('0x76'),'c')[_0xdb50('0x3f')](_0xdb50('0x77'),_0x1c0707)['where']('c.deletedAt\x20is\x20null')[_0xdb50('0x78')]();for(var _0x4b1ab2=0x0;_0x4b1ab2<_0x324d0e['length'];_0x4b1ab2++){_0x8c9cca['field']('c.cf_'+_0x324d0e[_0x4b1ab2]['id'],_0xdb50('0x79')+_0x324d0e[_0x4b1ab2][_0xdb50('0x75')]);}for(var _0x4b1ab2=0x0;_0x4b1ab2<_0x57c084[_0xdb50('0x3c')];_0x4b1ab2++){_0x8c9cca[_0xdb50('0x7a')](squel['select']()[_0xdb50('0x7a')](_0xdb50('0x7b'))['from']('cm_contact_has_items')[_0xdb50('0x3f')]('ItemTypeId\x20=\x20?',_0x57c084[_0x4b1ab2]['id'])[_0xdb50('0x3f')](_0xdb50('0x7c')),_0xdb50('0x7d')+_0x57c084[_0x4b1ab2][_0xdb50('0x2f')]);_0x8c9cca[_0xdb50('0x7a')](squel[_0xdb50('0x7e')]()['field'](_0xdb50('0x7f'))['from'](_0xdb50('0x80'))[_0xdb50('0x3f')](_0xdb50('0x81'),_0x57c084[_0x4b1ab2]['id'])['where']('CmContactId\x20=\x20c.id'),_0xdb50('0x82')+_0x57c084[_0x4b1ab2]['name']);}var _0x19a879=[];_0x19a879[_0xdb50('0x66')](_0x8c9cca[_0xdb50('0x83')]());BPromise['each'](_0x19a879,handleQuery)[_0xdb50('0x2a')](function(_0x42bd88){handleQuery(_0x8c9cca[_0xdb50('0x83')]());var _0x50ec48=csv_results[0x0];if(!_[_0xdb50('0x84')](_0x50ec48)){var _0x438772=toCsv(_0x50ec48);var _0x1fc920=Date[_0xdb50('0x85')]();fs['writeFileSync'](util[_0xdb50('0x71')](_0xdb50('0x86'),_0x1c0707,_0x1fc920),_0x438772);_0x2a3ed1[_0xdb50('0x87')](_0xdb50('0x88'),_0xdb50('0x89')+util[_0xdb50('0x71')](_0xdb50('0x8a'),_0x1c0707,_0x1fc920));_0x2a3ed1[_0xdb50('0x87')](_0xdb50('0x8b'),'text/csv');return _0x2a3ed1[_0xdb50('0x8c')](util[_0xdb50('0x71')](_0xdb50('0x86'),_0x1c0707,_0x1fc920));}else{return _0x2a3ed1[_0xdb50('0x20')](0xcc);}});});});};exports['addCustomField']=function(_0x438e45,_0x3e5d99,_0x4d2ea7){var _0xc67b06;delete _0x438e45[_0xdb50('0x4e')]['id'];return db[_0xdb50('0x33')]['findOne']({'where':{'id':_0x438e45[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x3e5d99,null))[_0xdb50('0x2a')](function(_0x56a2f3){if(_0x56a2f3){return db[_0xdb50('0x8d')][_0xdb50('0x8e')](function(_0x2bcc4a){return db['CmCustomField'][_0xdb50('0x55')](_0x438e45[_0xdb50('0x4e')],{'transaction':_0x2bcc4a})[_0xdb50('0x2a')](function(_0x265084){_0xc67b06=_0x265084;return _0x56a2f3[_0xdb50('0x8f')](_0x265084,{'transaction':_0x2bcc4a});})['then'](function(){var _0x305d4a={'type':db[_0xdb50('0x90')][_0xdb50('0x91')],'transaction':_0x2bcc4a};switch(_0x438e45[_0xdb50('0x4e')][_0xdb50('0x43')]){case _0xdb50('0x92'):_0x305d4a[_0xdb50('0x43')]=db[_0xdb50('0x90')]['TEXT'];break;case _0xdb50('0x93'):_0x305d4a[_0xdb50('0x43')]=db[_0xdb50('0x90')][_0xdb50('0x94')];break;case _0xdb50('0x95'):_0x305d4a[_0xdb50('0x43')]=db[_0xdb50('0x90')][_0xdb50('0x96')];_0x305d4a[_0xdb50('0x97')]=![];break;default:}return db[_0xdb50('0x8d')][_0xdb50('0x98')][_0xdb50('0x99')](_0xdb50('0x76'),util[_0xdb50('0x71')]('cf_%s',_0xc67b06['id']),_0x305d4a);})[_0xdb50('0x2a')](function(){return _0xc67b06;});});}})[_0xdb50('0x2a')](respondWithResult(_0x3e5d99,null))[_0xdb50('0x49')](handleError(_0x3e5d99,null));};exports['getCustomFields']=function(_0x4f1fbd,_0x3afca4,_0x599ae1){var _0x117fac={};var _0x2a11f7={};var _0x5f4f32;var _0x3bd114;return db[_0xdb50('0x33')][_0xdb50('0x5b')]({'where':{'id':_0x4f1fbd['params']['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x3afca4,null))[_0xdb50('0x2a')](function(_0x2a125e){if(_0x2a125e){_0x5f4f32=_0x2a125e;_0x2a11f7[_0xdb50('0x36')]=_[_0xdb50('0x4b')](db[_0xdb50('0x6e')][_0xdb50('0x34')]);_0x2a11f7[_0xdb50('0x37')]=_[_0xdb50('0x4b')](_0x4f1fbd['query']);_0x2a11f7[_0xdb50('0x38')]=_['intersection'](_0x2a11f7[_0xdb50('0x36')],_0x2a11f7[_0xdb50('0x37')]);_0x117fac[_0xdb50('0x3a')]=_[_0xdb50('0x39')](_0x2a11f7['model'],qs[_0xdb50('0x3b')](_0x4f1fbd[_0xdb50('0x37')][_0xdb50('0x3b')]));_0x117fac[_0xdb50('0x3a')]=_0x117fac[_0xdb50('0x3a')][_0xdb50('0x3c')]?_0x117fac[_0xdb50('0x3a')]:_0x2a11f7[_0xdb50('0x36')];_0x117fac[_0xdb50('0x5e')]=qs[_0xdb50('0x3e')](_0x4f1fbd[_0xdb50('0x37')]['sort']);_0x117fac[_0xdb50('0x3f')]=qs[_0xdb50('0x38')](_[_0xdb50('0x40')](_0x4f1fbd[_0xdb50('0x37')],_0x2a11f7[_0xdb50('0x38')]));_0x117fac[_0xdb50('0x3f')]=_[_0xdb50('0x42')](_0x117fac[_0xdb50('0x3f')],{'$or':[{'ListId':_0x2a125e['id']},{'ListId':null}]});if(_0x4f1fbd[_0xdb50('0x37')][_0xdb50('0x41')]){_0x117fac['where']=_[_0xdb50('0x42')](_0x117fac[_0xdb50('0x3f')],{'$or':_[_0xdb50('0x32')](_0x117fac[_0xdb50('0x3a')],function(_0x4e5109){var _0x508440={};_0x508440[_0x4e5109]={'$like':'%'+_0x4f1fbd[_0xdb50('0x37')]['filter']+'%'};return _0x508440;})});}_0x117fac=_[_0xdb50('0x42')]({},_0x117fac,_0x4f1fbd[_0xdb50('0x45')]);return db[_0xdb50('0x6e')][_0xdb50('0x9a')](_0x117fac);}})[_0xdb50('0x2a')](respondWithResult(_0x3afca4,null))[_0xdb50('0x49')](handleError(_0x3afca4,null));};exports['getGlobalCustomFields']=function(_0x4e7a62,_0x4b5cfe){return db[_0xdb50('0x6e')][_0xdb50('0x9a')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x4b5cfe,null))[_0xdb50('0x2a')](function(_0x238652){return _0x238652;})['then'](respondWithResult(_0x4b5cfe,null))['catch'](handleError(_0x4b5cfe,null));};exports[_0xdb50('0x9b')]=function(_0x1bb1bd,_0x5615e5,_0x260681){return db['CmList'][_0xdb50('0x4d')]({'where':{'id':_0x1bb1bd[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x5615e5,null))[_0xdb50('0x2a')](function(_0x1c941a){if(_0x1c941a){return _0x1c941a[_0xdb50('0x9b')](_0x1bb1bd['body'][_0xdb50('0x60')],_[_0xdb50('0x68')](_0x1bb1bd[_0xdb50('0x4e')],['ids','id'])||{})[_0xdb50('0x9c')](function(_0x49f7e4){for(var _0x15a763=0x0;_0x15a763<_0x1bb1bd[_0xdb50('0x4e')][_0xdb50('0x60')][_0xdb50('0x3c')];_0x15a763+=0x1){socket['emit'](_0xdb50('0x9d'),{'UserId':Number(_0x1bb1bd[_0xdb50('0x4e')][_0xdb50('0x60')][_0x15a763]),'CmListId':Number(_0x1bb1bd[_0xdb50('0x58')]['id'])});}return _0x49f7e4;});}})[_0xdb50('0x2a')](respondWithResult(_0x5615e5,null))[_0xdb50('0x49')](handleError(_0x5615e5,null));};exports['removeAgents']=function(_0x39add9,_0x39ce20,_0x7d9a7e){return db[_0xdb50('0x33')][_0xdb50('0x4d')]({'where':{'id':_0x39add9[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x39ce20,null))['then'](function(_0x2e08c1){if(_0x2e08c1){return _0x2e08c1[_0xdb50('0x9e')](_0x39add9[_0xdb50('0x37')][_0xdb50('0x60')])['then'](function(){if(_[_0xdb50('0x64')](_0x39add9[_0xdb50('0x37')]['ids'])){for(var _0x58c178=0x0;_0x58c178<_0x39add9['query'][_0xdb50('0x60')][_0xdb50('0x3c')];_0x58c178+=0x1){socket[_0xdb50('0x9f')](_0xdb50('0xa0'),{'UserId':Number(_0x39add9[_0xdb50('0x37')][_0xdb50('0x60')][_0x58c178]),'CmListId':Number(_0x39add9[_0xdb50('0x58')]['id'])});}}else{socket['emit'](_0xdb50('0xa0'),{'UserId':Number(_0x39add9[_0xdb50('0x37')][_0xdb50('0x60')]),'CmListId':Number(_0x39add9['params']['id'])});}});}})[_0xdb50('0x2a')](respondWithStatusCode(_0x39ce20,null))[_0xdb50('0x49')](handleError(_0x39ce20,null));};exports['getAgents']=function(_0x40831d,_0x4cd1d0,_0x3ccd4e){var _0xa25a88={};var _0x26176b={};var _0x2bd12d;var _0x9c0fa9;return db['CmList'][_0xdb50('0x5b')]({'where':{'id':_0x40831d[_0xdb50('0x58')]['id']}})[_0xdb50('0x2a')](handleEntityNotFound(_0x4cd1d0,null))[_0xdb50('0x2a')](function(_0x25a443){if(_0x25a443){_0x2bd12d=_0x25a443;_0x26176b[_0xdb50('0x36')]=_[_0xdb50('0x4b')](db[_0xdb50('0xa1')][_0xdb50('0x34')]);_0x26176b['query']=_[_0xdb50('0x4b')](_0x40831d[_0xdb50('0x37')]);_0x26176b[_0xdb50('0x38')]=_[_0xdb50('0x39')](_0x26176b[_0xdb50('0x36')],_0x26176b['query']);_0xa25a88['attributes']=_[_0xdb50('0x39')](_0x26176b['model'],qs[_0xdb50('0x3b')](_0x40831d[_0xdb50('0x37')]['fields']));_0xa25a88[_0xdb50('0x3a')]=_0xa25a88[_0xdb50('0x3a')][_0xdb50('0x3c')]?_0xa25a88['attributes']:_0x26176b[_0xdb50('0x36')];_0xa25a88[_0xdb50('0x5e')]=qs['sort'](_0x40831d[_0xdb50('0x37')][_0xdb50('0x3e')]);_0xa25a88[_0xdb50('0x3f')]=qs[_0xdb50('0x38')](_[_0xdb50('0x40')](_0x40831d[_0xdb50('0x37')],_0x26176b[_0xdb50('0x38')]));if(_0x40831d[_0xdb50('0x37')][_0xdb50('0x41')]){_0xa25a88['where']=_['merge'](_0xa25a88['where'],{'$or':_['map'](_0xa25a88['attributes'],function(_0x375e38){var _0x2995af={};_0x2995af[_0x375e38]={'$like':'%'+_0x40831d['query']['filter']+'%'};return _0x2995af;})});}_0xa25a88=_['merge']({},_0xa25a88,_0x40831d['options']);return _0x2bd12d[_0xdb50('0xa2')](_0xa25a88);}})['then'](function(_0x461558){if(_0x461558){_0x9c0fa9=_0x461558[_0xdb50('0x3c')];if(!_0x40831d[_0xdb50('0x37')][_0xdb50('0x72')](_0xdb50('0x5d'))){_0xa25a88[_0xdb50('0x3d')]=qs[_0xdb50('0x3d')](_0x40831d[_0xdb50('0x37')][_0xdb50('0x3d')]);_0xa25a88[_0xdb50('0x24')]=qs[_0xdb50('0x24')](_0x40831d[_0xdb50('0x37')][_0xdb50('0x24')]);}return _0x2bd12d[_0xdb50('0xa2')](_0xa25a88);}})[_0xdb50('0x2a')](function(_0x2f5356){if(_0x2f5356){return _0x2f5356?{'count':_0x9c0fa9,'rows':_0x2f5356}:null;}})[_0xdb50('0x2a')](respondWithResult(_0x4cd1d0,null))[_0xdb50('0x49')](handleError(_0x4cd1d0,null));};function handleQuery(_0xd137){logger[_0xdb50('0xa3')](_0xd137);return db[_0xdb50('0x8d')][_0xdb50('0x37')](_0xd137)[_0xdb50('0x9c')](function(_0x4dda21){csv_results['push'](_0x4dda21);})[_0xdb50('0x49')](function(_0x507b24){logger[_0xdb50('0x56')](_0x507b24[_0xdb50('0x6b')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index ca4aafe..c3d7c84 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x5fc3[_0x421196];return _0x2738af;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x55ca,0x126));var _0xa55c=function(_0x1aac60,_0x2e5ce5){_0x1aac60=_0x1aac60-0x0;var _0x186adf=_0x55ca[_0x1aac60];return _0x186adf;};'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 diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 0f4452c..26f2642 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 _0x4ea3=['CmList','cm_lists','lodash','util','../../config/logger','api','bluebird','path','./cmList.attributes','exports','define'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x4ea3,0x70));var _0x34ea=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4ea3[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));var moment=require('moment');var BPromise=require(_0x34ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34ea('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x34ea('0x6'));module[_0x34ea('0x7')]=function(_0x962596,_0x123d48){return _0x962596[_0x34ea('0x8')](_0x34ea('0x9'),attributes,{'tableName':_0x34ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4483=['define','CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0xc6a72f,_0x1ac77c){var _0x3728f7=function(_0x3d1427){while(--_0x3d1427){_0xc6a72f['push'](_0xc6a72f['shift']());}};_0x3728f7(++_0x1ac77c);}(_0x4483,0x1a3));var _0x3448=function(_0xa1dc15,_0x2f3c63){_0xa1dc15=_0xa1dc15-0x0;var _0x2c4d39=_0x4483[_0xa1dc15];return _0x2c4d39;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var logger=require(_0x3448('0x2'))('api');var moment=require(_0x3448('0x3'));var BPromise=require(_0x3448('0x4'));var rp=require(_0x3448('0x5'));var fs=require('fs');var path=require(_0x3448('0x6'));var rimraf=require(_0x3448('0x7'));var config=require('../../config/environment');var attributes=require(_0x3448('0x8'));module[_0x3448('0x9')]=function(_0x1b05db,_0xd3606d){return _0x1b05db[_0x3448('0xa')](_0x3448('0xb'),attributes,{'tableName':_0x3448('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index fb8ef6c..6d25941 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 _0x52ef=['http','redis','socket.io-emitter','./cmList.socket','register','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x52ef,0x121));var _0xf52e=function(_0x47edc4,_0x550a5d){_0x47edc4=_0x47edc4-0x0;var _0x159758=_0x52ef[_0x47edc4];return _0x159758;};'use strict';var _=require('lodash');var util=require(_0xf52e('0x0'));var moment=require(_0xf52e('0x1'));var BPromise=require('bluebird');var rs=require(_0xf52e('0x2'));var fs=require('fs');var Redis=require(_0xf52e('0x3'));var db=require(_0xf52e('0x4'))['db'];var utils=require(_0xf52e('0x5'));var logger=require(_0xf52e('0x6'))(_0xf52e('0x7'));var config=require(_0xf52e('0x8'));var jayson=require(_0xf52e('0x9'));var client=jayson[_0xf52e('0xa')][_0xf52e('0xb')]({'port':0x232a});config[_0xf52e('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf52e('0xd'))(new Redis(config[_0xf52e('0xc')]));require(_0xf52e('0xe'))[_0xf52e('0xf')](socket);function respondWithRpcPromise(_0x3d1860,_0x2d7d31,_0x4a3f63){return new BPromise(function(_0x2388a1,_0x8a3177){return client['request'](_0x3d1860,_0x4a3f63)['then'](function(_0x4c45d3){logger['info'](_0xf52e('0x10'),_0x2d7d31,'request\x20sent');logger[_0xf52e('0x11')](_0xf52e('0x12'),_0x2d7d31,_0xf52e('0x13'),JSON[_0xf52e('0x14')](_0x4c45d3));if(_0x4c45d3[_0xf52e('0x15')]){if(_0x4c45d3[_0xf52e('0x15')]['code']===0x1f4){logger['error'](_0xf52e('0x10'),_0x2d7d31,_0x4c45d3[_0xf52e('0x15')][_0xf52e('0x16')]);return _0x8a3177(_0x4c45d3['error'][_0xf52e('0x16')]);}logger[_0xf52e('0x15')](_0xf52e('0x10'),_0x2d7d31,_0x4c45d3[_0xf52e('0x15')][_0xf52e('0x16')]);return _0x2388a1(_0x4c45d3[_0xf52e('0x15')][_0xf52e('0x16')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x2d7d31,_0xf52e('0x13'));_0x2388a1(_0x4c45d3[_0xf52e('0x17')]['message']);}})[_0xf52e('0x18')](function(_0x62c62e){logger['error']('CmList,\x20%s,\x20%s',_0x2d7d31,_0x62c62e);_0x8a3177(_0x62c62e);});});} \ No newline at end of file +var _0xc709=['CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','info','CmList,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5d386b,_0x352e3f){var _0xdfc622=function(_0xad5ee7){while(--_0xad5ee7){_0x5d386b['push'](_0x5d386b['shift']());}};_0xdfc622(++_0x352e3f);}(_0xc709,0xc4));var _0x9c70=function(_0xc753c8,_0x5627ff){_0xc753c8=_0xc753c8-0x0;var _0xd02f5c=_0xc709[_0xc753c8];return _0xd02f5c;};'use strict';var _=require(_0x9c70('0x0'));var util=require(_0x9c70('0x1'));var moment=require('moment');var BPromise=require(_0x9c70('0x2'));var rs=require(_0x9c70('0x3'));var fs=require('fs');var Redis=require(_0x9c70('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c70('0x5'));var logger=require(_0x9c70('0x6'))(_0x9c70('0x7'));var config=require('../../config/environment');var jayson=require(_0x9c70('0x8'));var client=jayson[_0x9c70('0x9')]['http']({'port':0x232a});config[_0x9c70('0xa')]=_[_0x9c70('0xb')](config[_0x9c70('0xa')],{'host':_0x9c70('0xc'),'port':0x18eb});var socket=require(_0x9c70('0xd'))(new Redis(config[_0x9c70('0xa')]));require(_0x9c70('0xe'))[_0x9c70('0xf')](socket);function respondWithRpcPromise(_0x297aa7,_0x1989a9,_0x208f0f){return new BPromise(function(_0x5ca722,_0x4000b5){return client['request'](_0x297aa7,_0x208f0f)['then'](function(_0x8ec694){logger[_0x9c70('0x10')](_0x9c70('0x11'),_0x1989a9,_0x9c70('0x12'));logger[_0x9c70('0x13')](_0x9c70('0x14'),_0x1989a9,_0x9c70('0x12'),JSON[_0x9c70('0x15')](_0x8ec694));if(_0x8ec694['error']){if(_0x8ec694[_0x9c70('0x16')][_0x9c70('0x17')]===0x1f4){logger['error'](_0x9c70('0x11'),_0x1989a9,_0x8ec694[_0x9c70('0x16')]['message']);return _0x4000b5(_0x8ec694[_0x9c70('0x16')][_0x9c70('0x18')]);}logger[_0x9c70('0x16')](_0x9c70('0x11'),_0x1989a9,_0x8ec694['error'][_0x9c70('0x18')]);return _0x5ca722(_0x8ec694['error'][_0x9c70('0x18')]);}else{logger['info'](_0x9c70('0x11'),_0x1989a9,_0x9c70('0x12'));_0x5ca722(_0x8ec694[_0x9c70('0x19')][_0x9c70('0x18')]);}})[_0x9c70('0x1a')](function(_0xf4e370){logger['error'](_0x9c70('0x11'),_0x1989a9,_0xf4e370);_0x4000b5(_0xf4e370);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index fee16f8..7a3d4af 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 _0x6ffb=['cmList:','remove','update','register'];(function(_0x2f228a,_0x50eb4a){var _0x394907=function(_0x1046ac){while(--_0x1046ac){_0x2f228a['push'](_0x2f228a['shift']());}};_0x394907(++_0x50eb4a);}(_0x6ffb,0x181));var _0xb6ff=function(_0x5bf6fc,_0xdfe0fd){_0x5bf6fc=_0x5bf6fc-0x0;var _0x1e099c=_0x6ffb[_0x5bf6fc];return _0x1e099c;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xb6ff('0x0'),_0xb6ff('0x1')];function createListener(_0x17b351,_0x58606e){return function(_0x330ba1){_0x58606e['emit'](_0x17b351,_0x330ba1);};}function removeListener(_0x1d0675,_0x4419f0){return function(){CmListEvents['removeListener'](_0x1d0675,_0x4419f0);};}exports[_0xb6ff('0x2')]=function(_0x21fdd9){for(var _0x58c5f1=0x0,_0x5a65ee=events['length'];_0x58c5f1<_0x5a65ee;_0x58c5f1++){var _0x5d03e5=events[_0x58c5f1];var _0x5303bf=createListener(_0xb6ff('0x3')+_0x5d03e5,_0x21fdd9);CmListEvents['on'](_0x5d03e5,_0x5303bf);}}; \ No newline at end of file +var _0x1b42=['remove','emit','removeListener','register','length','cmList:'];(function(_0x3b37a9,_0x4fce02){var _0x1a7fee=function(_0x429579){while(--_0x429579){_0x3b37a9['push'](_0x3b37a9['shift']());}};_0x1a7fee(++_0x4fce02);}(_0x1b42,0x1c2));var _0x21b4=function(_0x5a67d0,_0x2f62ce){_0x5a67d0=_0x5a67d0-0x0;var _0x1ef0b5=_0x1b42[_0x5a67d0];return _0x1ef0b5;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x21b4('0x0'),'update'];function createListener(_0xdefbc,_0xe29a32){return function(_0x12878e){_0xe29a32[_0x21b4('0x1')](_0xdefbc,_0x12878e);};}function removeListener(_0x5c05f7,_0x6faa99){return function(){CmListEvents[_0x21b4('0x2')](_0x5c05f7,_0x6faa99);};}exports[_0x21b4('0x3')]=function(_0x35aa13){for(var _0x2fd9e9=0x0,_0x49fe71=events[_0x21b4('0x4')];_0x2fd9e9<_0x49fe71;_0x2fd9e9++){var _0xf97829=events[_0x2fd9e9];var _0x50ecac=createListener(_0x21b4('0x5')+_0xf97829,_0x35aa13);CmListEvents['on'](_0xf97829,_0x50ecac);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index b9ed975..73e8d77 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 _0x054b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addCustomField','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path'];(function(_0x5417a5,_0x56a429){var _0x3a1364=function(_0x3dd0b3){while(--_0x3dd0b3){_0x5417a5['push'](_0x5417a5['shift']());}};_0x3a1364(++_0x56a429);}(_0x054b,0x11c));var _0xb054=function(_0x22f04d,_0x33dc4f){_0x22f04d=_0x22f04d-0x0;var _0x5811f4=_0x054b[_0x22f04d];return _0x5811f4;};'use strict';var multer=require(_0xb054('0x0'));var util=require(_0xb054('0x1'));var path=require(_0xb054('0x2'));var timeout=require(_0xb054('0x3'));var express=require(_0xb054('0x4'));var router=express[_0xb054('0x5')]();var fs_extra=require(_0xb054('0x6'));var auth=require(_0xb054('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb054('0x8'));var controller=require(_0xb054('0x9'));router[_0xb054('0xa')]('/',auth[_0xb054('0xb')](),controller[_0xb054('0xc')]);router[_0xb054('0xa')](_0xb054('0xd'),auth['isAuthenticated'](),controller[_0xb054('0xe')]);router[_0xb054('0xa')](_0xb054('0xf'),auth[_0xb054('0xb')](),controller[_0xb054('0x10')]);router['get'](_0xb054('0x11'),auth[_0xb054('0xb')](),controller[_0xb054('0x12')]);router[_0xb054('0xa')](_0xb054('0x13'),auth[_0xb054('0xb')](),controller[_0xb054('0x14')]);router[_0xb054('0xa')](_0xb054('0x15'),auth[_0xb054('0xb')](),controller[_0xb054('0x16')]);router[_0xb054('0xa')](_0xb054('0x17'),auth[_0xb054('0xb')](),controller[_0xb054('0x18')]);router['get'](_0xb054('0x19'),auth[_0xb054('0xb')](),controller[_0xb054('0x1a')]);router[_0xb054('0xa')]('/:id/users',auth[_0xb054('0xb')](),controller[_0xb054('0x1b')]);router[_0xb054('0x1c')]('/',auth[_0xb054('0xb')](),controller[_0xb054('0x1d')]);router[_0xb054('0x1c')]('/:id/dispositions',auth[_0xb054('0xb')](),controller[_0xb054('0x1e')]);router[_0xb054('0x1c')](_0xb054('0x15'),auth[_0xb054('0xb')](),controller['addContacts']);router[_0xb054('0x1c')](_0xb054('0x19'),auth['isAuthenticated'](),controller[_0xb054('0x1f')]);router['post'](_0xb054('0x20'),auth['isAuthenticated'](),controller[_0xb054('0x21')]);router[_0xb054('0x22')](_0xb054('0x11'),auth[_0xb054('0xb')](),controller[_0xb054('0x23')]);router[_0xb054('0x24')]('/:id',auth[_0xb054('0xb')](),controller[_0xb054('0x25')]);router[_0xb054('0x24')](_0xb054('0x13'),auth[_0xb054('0xb')](),controller[_0xb054('0x26')]);router[_0xb054('0x24')](_0xb054('0x20'),auth[_0xb054('0xb')](),controller[_0xb054('0x27')]);module[_0xb054('0x28')]=router; \ No newline at end of file +var _0x18b8=['/:id/dispositions','getDispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','update','destroy','removeDispositions','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','getGlobalCustomFields','/:id','show'];(function(_0x218c0c,_0x2b21e3){var _0xf0347d=function(_0xb3b51c){while(--_0xb3b51c){_0x218c0c['push'](_0x218c0c['shift']());}};_0xf0347d(++_0x2b21e3);}(_0x18b8,0xff));var _0x818b=function(_0x57c7d7,_0x245a80){_0x57c7d7=_0x57c7d7-0x0;var _0x59cab1=_0x18b8[_0x57c7d7];return _0x59cab1;};'use strict';var multer=require(_0x818b('0x0'));var util=require(_0x818b('0x1'));var path=require(_0x818b('0x2'));var timeout=require(_0x818b('0x3'));var express=require(_0x818b('0x4'));var router=express[_0x818b('0x5')]();var fs_extra=require(_0x818b('0x6'));var auth=require(_0x818b('0x7'));var interaction=require(_0x818b('0x8'));var config=require(_0x818b('0x9'));var controller=require('./cmList.controller');router[_0x818b('0xa')]('/',auth[_0x818b('0xb')](),controller[_0x818b('0xc')]);router[_0x818b('0xa')](_0x818b('0xd'),auth[_0x818b('0xb')](),controller[_0x818b('0xe')]);router[_0x818b('0xa')]('/global_fields',auth[_0x818b('0xb')](),controller[_0x818b('0xf')]);router[_0x818b('0xa')](_0x818b('0x10'),auth['isAuthenticated'](),controller[_0x818b('0x11')]);router[_0x818b('0xa')](_0x818b('0x12'),auth[_0x818b('0xb')](),controller[_0x818b('0x13')]);router[_0x818b('0xa')](_0x818b('0x14'),auth[_0x818b('0xb')](),controller[_0x818b('0x15')]);router['get']('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0x818b('0x16')]);router[_0x818b('0xa')](_0x818b('0x17'),auth[_0x818b('0xb')](),controller[_0x818b('0x18')]);router[_0x818b('0xa')](_0x818b('0x19'),auth[_0x818b('0xb')](),controller[_0x818b('0x1a')]);router[_0x818b('0x1b')]('/',auth['isAuthenticated'](),controller[_0x818b('0x1c')]);router[_0x818b('0x1b')](_0x818b('0x12'),auth[_0x818b('0xb')](),controller[_0x818b('0x1d')]);router['post'](_0x818b('0x14'),auth[_0x818b('0xb')](),controller[_0x818b('0x1e')]);router[_0x818b('0x1b')](_0x818b('0x17'),auth[_0x818b('0xb')](),controller[_0x818b('0x1f')]);router[_0x818b('0x1b')](_0x818b('0x19'),auth[_0x818b('0xb')](),controller[_0x818b('0x20')]);router['put'](_0x818b('0x10'),auth[_0x818b('0xb')](),controller[_0x818b('0x21')]);router['delete'](_0x818b('0x10'),auth[_0x818b('0xb')](),controller[_0x818b('0x22')]);router['delete'](_0x818b('0x12'),auth[_0x818b('0xb')](),controller[_0x818b('0x23')]);router[_0x818b('0x24')](_0x818b('0x19'),auth[_0x818b('0xb')](),controller[_0x818b('0x25')]);module[_0x818b('0x26')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index c5025e9..a264b22 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 _0xc294=['getDataValue','field','STRING','exports'];(function(_0x88ca06,_0x32973d){var _0x5ae6e6=function(_0x59e8ae){while(--_0x59e8ae){_0x88ca06['push'](_0x88ca06['shift']());}};_0x5ae6e6(++_0x32973d);}(_0xc294,0x13f));var _0x4c29=function(_0x3a33ff,_0x431390){_0x3a33ff=_0x3a33ff-0x0;var _0x214ba7=_0xc294[_0x3a33ff];return _0x214ba7;};'use strict';var Sequelize=require('sequelize');module[_0x4c29('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x41548){return this[_0x4c29('0x1')](_0x4c29('0x2'));}},'field':{'type':Sequelize[_0x4c29('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x4c29('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1713=['exports','VIRTUAL','field','STRING','sequelize'];(function(_0x676a53,_0x2d7dda){var _0x1a4a81=function(_0x25c3f5){while(--_0x25c3f5){_0x676a53['push'](_0x676a53['shift']());}};_0x1a4a81(++_0x2d7dda);}(_0x1713,0x1a8));var _0x3171=function(_0x4432a5,_0x170722){_0x4432a5=_0x4432a5-0x0;var _0x3db217=_0x1713[_0x4432a5];return _0x3db217;};'use strict';var Sequelize=require(_0x3171('0x0'));module[_0x3171('0x1')]={'name':{'type':Sequelize[_0x3171('0x2')],'get':function(_0x52b20c){return this['getDataValue'](_0x3171('0x3'));}},'field':{'type':Sequelize[_0x3171('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x3171('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x3171('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 9f0332a..9cb4b61 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 _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(_0x290a68,_0x5bce6c){var _0x49fd96=function(_0x1f676f){while(--_0x1f676f){_0x290a68['push'](_0x290a68['shift']());}};_0x49fd96(++_0x5bce6c);}(_0x7a54,0x106));var _0x47a5=function(_0x303601,_0x47cac3){_0x303601=_0x303601-0x0;var _0x1a0c6c=_0x7a54[_0x303601];return _0x1a0c6c;};'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 +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(_0x10dfd0,_0x514dfb){var _0x737d94=function(_0x1ba65e){while(--_0x1ba65e){_0x10dfd0['push'](_0x10dfd0['shift']());}};_0x737d94(++_0x514dfb);}(_0x7a54,0x106));var _0x47a5=function(_0x5d7782,_0x352112){_0x5d7782=_0x5d7782-0x0;var _0x33d729=_0x7a54[_0x5d7782];return _0x33d729;};'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 36ad25b..50629a7 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 _0xe9b1=['rimraf','../../config/environment','exports','define','Condition','tools_conditions','../../config/logger','moment','request-promise'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xe9b1,0x102));var _0x1e9b=function(_0x1e9ae1,_0x10dc5d){_0x1e9ae1=_0x1e9ae1-0x0;var _0xc6bc15=_0xe9b1[_0x1e9ae1];return _0xc6bc15;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1e9b('0x0'))('api');var moment=require(_0x1e9b('0x1'));var BPromise=require('bluebird');var rp=require(_0x1e9b('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e9b('0x3'));var config=require(_0x1e9b('0x4'));var attributes=require('./condition.attributes');module[_0x1e9b('0x5')]=function(_0x28a08a,_0x416512){return _0x28a08a[_0x1e9b('0x6')](_0x1e9b('0x7'),attributes,{'tableName':_0x1e9b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x426e=['tools_conditions','util','../../config/logger','api','path','../../config/environment','./condition.attributes','exports','define','Condition'];(function(_0x11da1e,_0x597cc5){var _0x404daa=function(_0x3de8f7){while(--_0x3de8f7){_0x11da1e['push'](_0x11da1e['shift']());}};_0x404daa(++_0x597cc5);}(_0x426e,0xfb));var _0xe426=function(_0x18db49,_0x20affd){_0x18db49=_0x18db49-0x0;var _0x1e80e4=_0x426e[_0x18db49];return _0x1e80e4;};'use strict';var _=require('lodash');var util=require(_0xe426('0x0'));var logger=require(_0xe426('0x1'))(_0xe426('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe426('0x3'));var rimraf=require('rimraf');var config=require(_0xe426('0x4'));var attributes=require(_0xe426('0x5'));module[_0xe426('0x6')]=function(_0x119d37,_0x2697bd){return _0x119d37[_0xe426('0x7')](_0xe426('0x8'),attributes,{'tableName':_0xe426('0x9'),'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 8664380..c25ae9c 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 _0x3f9e=['info','Condition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1609f3,_0x150d5f){var _0x5067ca=function(_0x2fe591){while(--_0x2fe591){_0x1609f3['push'](_0x1609f3['shift']());}};_0x5067ca(++_0x150d5f);}(_0x3f9e,0x99));var _0xe3f9=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0x3f9e[_0x1ab0e6];return _0x248815;};'use strict';var _=require(_0xe3f9('0x0'));var util=require(_0xe3f9('0x1'));var moment=require(_0xe3f9('0x2'));var BPromise=require(_0xe3f9('0x3'));var rs=require(_0xe3f9('0x4'));var fs=require('fs');var Redis=require(_0xe3f9('0x5'));var db=require(_0xe3f9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3f9('0x7'))(_0xe3f9('0x8'));var config=require(_0xe3f9('0x9'));var jayson=require(_0xe3f9('0xa'));var client=jayson[_0xe3f9('0xb')][_0xe3f9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cab7f,_0xa1adc6,_0x35046a){return new BPromise(function(_0x17db86,_0x1c4cc7){return client[_0xe3f9('0xd')](_0x1cab7f,_0x35046a)[_0xe3f9('0xe')](function(_0x3586ba){logger[_0xe3f9('0xf')](_0xe3f9('0x10'),_0xa1adc6,_0xe3f9('0x11'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0xa1adc6,_0xe3f9('0x11'),JSON[_0xe3f9('0x12')](_0x3586ba));if(_0x3586ba['error']){if(_0x3586ba[_0xe3f9('0x13')][_0xe3f9('0x14')]===0x1f4){logger['error'](_0xe3f9('0x10'),_0xa1adc6,_0x3586ba[_0xe3f9('0x13')]['message']);return _0x1c4cc7(_0x3586ba[_0xe3f9('0x13')][_0xe3f9('0x15')]);}logger[_0xe3f9('0x13')](_0xe3f9('0x10'),_0xa1adc6,_0x3586ba[_0xe3f9('0x13')][_0xe3f9('0x15')]);return _0x17db86(_0x3586ba[_0xe3f9('0x13')][_0xe3f9('0x15')]);}else{logger['info'](_0xe3f9('0x10'),_0xa1adc6,_0xe3f9('0x11'));_0x17db86(_0x3586ba[_0xe3f9('0x16')]['message']);}})[_0xe3f9('0x17')](function(_0x1b58f5){logger[_0xe3f9('0x13')](_0xe3f9('0x10'),_0xa1adc6,_0x1b58f5);_0x1c4cc7(_0x1b58f5);});});} \ No newline at end of file +var _0x4140=['stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x323aa0,_0x1998f6){var _0x5176fb=function(_0x190866){while(--_0x190866){_0x323aa0['push'](_0x323aa0['shift']());}};_0x5176fb(++_0x1998f6);}(_0x4140,0x12b));var _0x0414=function(_0x43b609,_0xcf0924){_0x43b609=_0x43b609-0x0;var _0x5d4cef=_0x4140[_0x43b609];return _0x5d4cef;};'use strict';var _=require(_0x0414('0x0'));var util=require(_0x0414('0x1'));var moment=require('moment');var BPromise=require(_0x0414('0x2'));var rs=require(_0x0414('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0414('0x4'))['db'];var utils=require(_0x0414('0x5'));var logger=require(_0x0414('0x6'))('rpc');var config=require(_0x0414('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0414('0x8')][_0x0414('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11fc2b,_0x25ce3d,_0x1d0bf9){return new BPromise(function(_0x59c110,_0xfabcf5){return client[_0x0414('0xa')](_0x11fc2b,_0x1d0bf9)['then'](function(_0x57b46d){logger[_0x0414('0xb')](_0x0414('0xc'),_0x25ce3d,_0x0414('0xd'));logger[_0x0414('0xe')](_0x0414('0xf'),_0x25ce3d,_0x0414('0xd'),JSON[_0x0414('0x10')](_0x57b46d));if(_0x57b46d[_0x0414('0x11')]){if(_0x57b46d['error'][_0x0414('0x12')]===0x1f4){logger[_0x0414('0x11')](_0x0414('0xc'),_0x25ce3d,_0x57b46d[_0x0414('0x11')][_0x0414('0x13')]);return _0xfabcf5(_0x57b46d['error']['message']);}logger['error'](_0x0414('0xc'),_0x25ce3d,_0x57b46d[_0x0414('0x11')][_0x0414('0x13')]);return _0x59c110(_0x57b46d[_0x0414('0x11')][_0x0414('0x13')]);}else{logger['info'](_0x0414('0xc'),_0x25ce3d,_0x0414('0xd'));_0x59c110(_0x57b46d['result'][_0x0414('0x13')]);}})[_0x0414('0x14')](function(_0x2fe551){logger['error'](_0x0414('0xc'),_0x25ce3d,_0x2fe551);_0xfabcf5(_0x2fe551);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index b364ecc..ea4dd95 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 _0x966f=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated'];(function(_0x1e1858,_0x2bc0ec){var _0x4d8d7a=function(_0x2145eb){while(--_0x2145eb){_0x1e1858['push'](_0x1e1858['shift']());}};_0x4d8d7a(++_0x2bc0ec);}(_0x966f,0xbf));var _0xf966=function(_0x3642da,_0x4d991){_0x3642da=_0x3642da-0x0;var _0x230d58=_0x966f[_0x3642da];return _0x230d58;};'use strict';var multer=require(_0xf966('0x0'));var util=require(_0xf966('0x1'));var path=require('path');var timeout=require(_0xf966('0x2'));var express=require(_0xf966('0x3'));var router=express[_0xf966('0x4')]();var fs_extra=require(_0xf966('0x5'));var auth=require(_0xf966('0x6'));var interaction=require(_0xf966('0x7'));var config=require(_0xf966('0x8'));var controller=require(_0xf966('0x9'));router[_0xf966('0xa')](_0xf966('0xb'),auth[_0xf966('0xc')](),controller[_0xf966('0xd')]);router[_0xf966('0xe')]('/:id',auth[_0xf966('0xc')](),controller[_0xf966('0xf')]);module[_0xf966('0x10')]=router; \ No newline at end of file +var _0xf44d=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','/:id','isAuthenticated'];(function(_0x1f4e10,_0x1db2a1){var _0x4c9c4d=function(_0x2b21af){while(--_0x2b21af){_0x1f4e10['push'](_0x1f4e10['shift']());}};_0x4c9c4d(++_0x1db2a1);}(_0xf44d,0x120));var _0xdf44=function(_0x3ceecc,_0x184ee8){_0x3ceecc=_0x3ceecc-0x0;var _0x4eeb95=_0xf44d[_0x3ceecc];return _0x4eeb95;};'use strict';var multer=require(_0xdf44('0x0'));var util=require(_0xdf44('0x1'));var path=require(_0xdf44('0x2'));var timeout=require(_0xdf44('0x3'));var express=require(_0xdf44('0x4'));var router=express[_0xdf44('0x5')]();var fs_extra=require(_0xdf44('0x6'));var auth=require(_0xdf44('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdf44('0x8'));var controller=require(_0xdf44('0x9'));router['put'](_0xdf44('0xa'),auth[_0xdf44('0xb')](),controller['update']);router[_0xdf44('0xc')](_0xdf44('0xa'),auth[_0xdf44('0xb')](),controller[_0xdf44('0xd')]);module[_0xdf44('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 2afbaeb..23daea4 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb155=['STRING','exports','name','INTEGER'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0xb155,0x1a5));var _0x5b15=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0xb155[_0x1e3c02];return _0x4d26d7;};'use strict';var Sequelize=require('sequelize');module[_0x5b15('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5b15('0x1')},'OrderBy':{'type':Sequelize[_0x5b15('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x5b15('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x0e0f=['STRING','sequelize','name','INTEGER'];(function(_0x5f0335,_0x4c9cc3){var _0x3d775a=function(_0x1cc3e8){while(--_0x1cc3e8){_0x5f0335['push'](_0x5f0335['shift']());}};_0x3d775a(++_0x4c9cc3);}(_0x0e0f,0xe5));var _0xf0e0=function(_0x9881c5,_0x57fe72){_0x9881c5=_0x9881c5-0x0;var _0x19cd18=_0x0e0f[_0x9881c5];return _0x19cd18;};'use strict';var Sequelize=require(_0xf0e0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf0e0('0x1')},'OrderBy':{'type':Sequelize[_0xf0e0('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xf0e0('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index a155ff9..206336b 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6343=['status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','get','ContactItemTypes','UserProfileResource','then','error','name','send','map','ContactItemType','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x11a022,_0x52c4bf){var _0x4b8a94=function(_0x478f35){while(--_0x478f35){_0x11a022['push'](_0x11a022['shift']());}};_0x4b8a94(++_0x52c4bf);}(_0x6343,0x168));var _0x3634=function(_0x410121,_0x2f52c4){_0x410121=_0x410121-0x0;var _0x495e37=_0x6343[_0x410121];return _0x495e37;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){var _0x1b25be=_0x3a8c41[_0x3634('0x21')]({'plain':!![]});var _0x17db44=_0x3634('0x22');return db[_0x3634('0x23')][_0x3634('0x20')]({'where':{'type':_0x17db44,'resourceId':_0x1b25be['id']}})[_0x3634('0x24')](function(){return _0x3a8c41;});})[_0x3634('0x24')](function(){_0x596acb[_0x3634('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b0a44,_0x552cc3){return function(_0x58841d){if(!_0x58841d){_0x1b0a44['sendStatus'](0x194);}return _0x58841d;};}function handleError(_0x7a35c4,_0x576977){_0x576977=_0x576977||0x1f4;return function(_0x3bf28b){logger[_0x3634('0x25')](_0x3bf28b['stack']);if(_0x3bf28b['name']){delete _0x3bf28b[_0x3634('0x26')];}_0x7a35c4['status'](_0x576977)[_0x3634('0x27')](_0x3bf28b);};}exports['index']=function(_0x1e04cc,_0x3d7322){var _0x1d88f7={},_0x17a0fd={},_0x1f46d9={'count':0x0,'rows':[]};var _0x20b062=_[_0x3634('0x28')](db[_0x3634('0x29')]['rawAttributes'],function(_0x535215){return{'name':_0x535215['fieldName'],'type':_0x535215[_0x3634('0x2a')]['key']};});_0x17a0fd[_0x3634('0x2b')]=_[_0x3634('0x28')](_0x20b062,_0x3634('0x26'));_0x17a0fd[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x1e04cc[_0x3634('0x2c')]);_0x17a0fd['filters']=_[_0x3634('0x2e')](_0x17a0fd[_0x3634('0x2b')],_0x17a0fd[_0x3634('0x2c')]);_0x1d88f7[_0x3634('0x2f')]=_[_0x3634('0x2e')](_0x17a0fd[_0x3634('0x2b')],qs[_0x3634('0x30')](_0x1e04cc[_0x3634('0x2c')][_0x3634('0x30')]));_0x1d88f7['attributes']=_0x1d88f7[_0x3634('0x2f')][_0x3634('0x31')]?_0x1d88f7[_0x3634('0x2f')]:_0x17a0fd[_0x3634('0x2b')];if(!_0x1e04cc['query'][_0x3634('0x32')](_0x3634('0x33'))){_0x1d88f7[_0x3634('0x18')]=qs['limit'](_0x1e04cc['query']['limit']);_0x1d88f7[_0x3634('0x16')]=qs[_0x3634('0x16')](_0x1e04cc['query'][_0x3634('0x16')]);}_0x1d88f7[_0x3634('0x34')]=qs[_0x3634('0x35')](_0x1e04cc[_0x3634('0x2c')][_0x3634('0x35')]);_0x1d88f7[_0x3634('0x36')]=qs[_0x3634('0x37')](_['pick'](_0x1e04cc[_0x3634('0x2c')],_0x17a0fd['filters']),_0x20b062);if(_0x1e04cc[_0x3634('0x2c')][_0x3634('0x38')]){_0x1d88f7[_0x3634('0x36')]=_[_0x3634('0x39')](_0x1d88f7[_0x3634('0x36')],{'$or':_['map'](_0x20b062,function(_0x10ff70){if(_0x10ff70[_0x3634('0x2a')]!==_0x3634('0x3a')){var _0x242a6c={};_0x242a6c[_0x10ff70[_0x3634('0x26')]]={'$like':'%'+_0x1e04cc[_0x3634('0x2c')][_0x3634('0x38')]+'%'};return _0x242a6c;}})});}_0x1d88f7=_[_0x3634('0x39')]({},_0x1d88f7,_0x1e04cc[_0x3634('0x3b')]);var _0x523555={'where':_0x1d88f7['where']};return db[_0x3634('0x29')]['count'](_0x523555)['then'](function(_0x5948db){_0x1f46d9[_0x3634('0x19')]=_0x5948db;if(_0x1e04cc['query'][_0x3634('0x3c')]){_0x1d88f7[_0x3634('0x3d')]=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x1d88f7);})['then'](function(_0x324970){_0x1f46d9[_0x3634('0x3e')]=_0x324970;return _0x1f46d9;})['then'](respondWithFilteredResult(_0x3d7322,_0x1d88f7))[_0x3634('0x3f')](handleError(_0x3d7322,null));};exports[_0x3634('0x40')]=function(_0x3ff2fb,_0x18ce5a){var _0x123a91={'raw':!![],'where':{'id':_0x3ff2fb['params']['id']}},_0x5f0711={};_0x5f0711[_0x3634('0x2b')]=_[_0x3634('0x2d')](db[_0x3634('0x29')][_0x3634('0x41')]);_0x5f0711[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x3ff2fb['query']);_0x5f0711[_0x3634('0x37')]=_[_0x3634('0x2e')](_0x5f0711[_0x3634('0x2b')],_0x5f0711['query']);_0x123a91['attributes']=_[_0x3634('0x2e')](_0x5f0711[_0x3634('0x2b')],qs[_0x3634('0x30')](_0x3ff2fb[_0x3634('0x2c')][_0x3634('0x30')]));_0x123a91[_0x3634('0x2f')]=_0x123a91[_0x3634('0x2f')][_0x3634('0x31')]?_0x123a91['attributes']:_0x5f0711[_0x3634('0x2b')];if(_0x3ff2fb[_0x3634('0x2c')][_0x3634('0x3c')]){_0x123a91[_0x3634('0x3d')]=[{'all':!![]}];}_0x123a91=_[_0x3634('0x39')]({},_0x123a91,_0x3ff2fb[_0x3634('0x3b')]);return db[_0x3634('0x29')][_0x3634('0x42')](_0x123a91)[_0x3634('0x24')](handleEntityNotFound(_0x18ce5a,null))['then'](respondWithResult(_0x18ce5a,null))[_0x3634('0x3f')](handleError(_0x18ce5a,null));};exports[_0x3634('0x43')]=function(_0x4a4a94,_0x3c356b){return db[_0x3634('0x29')][_0x3634('0x43')](_0x4a4a94[_0x3634('0x44')],{})[_0x3634('0x24')](function(_0x1ca58d){var _0x5cc8d1=_0x4a4a94[_0x3634('0x45')][_0x3634('0x21')]({'plain':!![]});if(!_0x5cc8d1)throw new Error(_0x3634('0x46'));if(_0x5cc8d1[_0x3634('0x47')]===_0x3634('0x45')){var _0x582475=_0x1ca58d[_0x3634('0x21')]({'plain':!![]});var _0x20f9f8='ContactItemTypes';return db['UserProfileSection'][_0x3634('0x42')]({'where':{'name':_0x20f9f8,'userProfileId':_0x5cc8d1['userProfileId']},'raw':!![]})[_0x3634('0x24')](function(_0x475b37){if(_0x475b37&&_0x475b37[_0x3634('0x48')]===0x0){return db[_0x3634('0x23')]['create']({'name':_0x582475[_0x3634('0x26')],'resourceId':_0x582475['id'],'type':_0x475b37[_0x3634('0x26')],'sectionId':_0x475b37['id']},{})[_0x3634('0x24')](function(){return _0x1ca58d;});}else{return _0x1ca58d;}})[_0x3634('0x3f')](function(_0x1ac9a9){logger[_0x3634('0x25')](_0x3634('0x49'),_0x1ac9a9);throw _0x1ac9a9;});}return _0x1ca58d;})[_0x3634('0x24')](respondWithResult(_0x3c356b,0xc9))[_0x3634('0x3f')](handleError(_0x3c356b,null));};exports[_0x3634('0x1f')]=function(_0xcedbb6,_0x4265eb){if(_0xcedbb6['body']['id']){delete _0xcedbb6[_0x3634('0x44')]['id'];}return db[_0x3634('0x29')][_0x3634('0x42')]({'where':{'id':_0xcedbb6[_0x3634('0x4a')]['id']}})[_0x3634('0x24')](handleEntityNotFound(_0x4265eb,null))[_0x3634('0x24')](saveUpdates(_0xcedbb6[_0x3634('0x44')],null))[_0x3634('0x24')](respondWithResult(_0x4265eb,null))[_0x3634('0x3f')](handleError(_0x4265eb,null));};exports['destroy']=function(_0x2bcb9e,_0x2ea4b0){return db['ContactItemType'][_0x3634('0x42')]({'where':{'id':_0x2bcb9e[_0x3634('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2ea4b0,null))[_0x3634('0x24')](db[_0x3634('0x4b')][_0x3634('0x1f')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x2bcb9e['params']['id']}}))[_0x3634('0x24')](removeEntity(_0x2ea4b0,null))['catch'](handleError(_0x2ea4b0,null));}; \ No newline at end of file +var _0x1399=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','findAll','rows','show','rawAttributes','includeAll','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','sendStatus','error','stack','name','send','index','map','ContactItemType','fieldName'];(function(_0x4192da,_0x46b408){var _0xe87ea6=function(_0x123fb2){while(--_0x123fb2){_0x4192da['push'](_0x4192da['shift']());}};_0xe87ea6(++_0x46b408);}(_0x1399,0x16c));var _0x9139=function(_0x4fcb0f,_0x5e8627){_0x4fcb0f=_0x4fcb0f-0x0;var _0xf9107d=_0x1399[_0x4fcb0f];return _0xf9107d;};'use strict';var emlformat=require(_0x9139('0x0'));var rimraf=require(_0x9139('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9139('0x2'));var rp=require('request-promise');var moment=require(_0x9139('0x3'));var BPromise=require(_0x9139('0x4'));var Mustache=require(_0x9139('0x5'));var util=require(_0x9139('0x6'));var path=require(_0x9139('0x7'));var sox=require(_0x9139('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9139('0x9'));var _=require(_0x9139('0xa'));var squel=require(_0x9139('0xb'));var crypto=require('crypto');var jsforce=require(_0x9139('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9139('0xd'));var Papa=require(_0x9139('0xe'));var Redis=require('ioredis');var authService=require(_0x9139('0xf'));var qs=require(_0x9139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9139('0x11'))(_0x9139('0x12'));var utils=require(_0x9139('0x13'));var config=require(_0x9139('0x14'));var licenseUtil=require(_0x9139('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b32d,_0x511ec9){_0x511ec9=_0x511ec9||0xcc;return function(_0x417637){if(_0x417637){return _0x52b32d['sendStatus'](_0x511ec9);}return _0x52b32d[_0x9139('0x16')](_0x511ec9)[_0x9139('0x17')]();};}function respondWithResult(_0x375ada,_0x262009){_0x262009=_0x262009||0xc8;return function(_0x5936d2){if(_0x5936d2){return _0x375ada[_0x9139('0x16')](_0x262009)['json'](_0x5936d2);}};}function respondWithFilteredResult(_0x58307f,_0x52c57b){return function(_0x159e50){if(_0x159e50){var _0x3e2bad=typeof _0x52c57b[_0x9139('0x18')]===_0x9139('0x19')&&typeof _0x52c57b[_0x9139('0x1a')]===_0x9139('0x19');var _0x4bd957=_0x159e50['count'];var _0x13cab8=_0x3e2bad?0x0:_0x52c57b[_0x9139('0x18')];var _0x5e0a59=_0x3e2bad?_0x159e50['count']:_0x52c57b[_0x9139('0x18')]+_0x52c57b[_0x9139('0x1a')];var _0x56add4;if(_0x5e0a59>=_0x4bd957){_0x5e0a59=_0x4bd957;_0x56add4=0xc8;}else{_0x56add4=0xce;}_0x58307f[_0x9139('0x16')](_0x56add4);return _0x58307f[_0x9139('0x1b')](_0x9139('0x1c'),_0x13cab8+'-'+_0x5e0a59+'/'+_0x4bd957)[_0x9139('0x1d')](_0x159e50);}return null;};}function patchUpdates(_0xd2eb33){return function(_0x6f901b){try{jsonpatch[_0x9139('0x1e')](_0x6f901b,_0xd2eb33,!![]);}catch(_0x45fa16){return BPromise[_0x9139('0x1f')](_0x45fa16);}return _0x6f901b[_0x9139('0x20')]();};}function saveUpdates(_0x1bac18,_0x269f8a){return function(_0x5a3e2e){if(_0x5a3e2e){return _0x5a3e2e[_0x9139('0x21')](_0x1bac18)[_0x9139('0x22')](function(_0x31635a){return _0x31635a;});}return null;};}function removeEntity(_0x1aee3b,_0x934732){return function(_0x1a7350){if(_0x1a7350){return _0x1a7350['destroy']()[_0x9139('0x22')](function(){var _0x31c22d=_0x1a7350['get']({'plain':!![]});var _0x3ed4da=_0x9139('0x23');return db[_0x9139('0x24')]['destroy']({'where':{'type':_0x3ed4da,'resourceId':_0x31c22d['id']}})[_0x9139('0x22')](function(){return _0x1a7350;});})[_0x9139('0x22')](function(){_0x1aee3b['status'](0xcc)[_0x9139('0x17')]();});}};}function handleEntityNotFound(_0x39e8cf,_0x452d9a){return function(_0x55e95f){if(!_0x55e95f){_0x39e8cf[_0x9139('0x25')](0x194);}return _0x55e95f;};}function handleError(_0x22e11e,_0x2a35fd){_0x2a35fd=_0x2a35fd||0x1f4;return function(_0x22994c){logger[_0x9139('0x26')](_0x22994c[_0x9139('0x27')]);if(_0x22994c[_0x9139('0x28')]){delete _0x22994c['name'];}_0x22e11e['status'](_0x2a35fd)[_0x9139('0x29')](_0x22994c);};}exports[_0x9139('0x2a')]=function(_0xd27355,_0x4c1693){var _0x50d545={},_0x24e8d5={},_0x2118a2={'count':0x0,'rows':[]};var _0x2dff49=_[_0x9139('0x2b')](db[_0x9139('0x2c')]['rawAttributes'],function(_0x5a1673){return{'name':_0x5a1673[_0x9139('0x2d')],'type':_0x5a1673['type']['key']};});_0x24e8d5[_0x9139('0x2e')]=_[_0x9139('0x2b')](_0x2dff49,'name');_0x24e8d5[_0x9139('0x2f')]=_[_0x9139('0x30')](_0xd27355['query']);_0x24e8d5[_0x9139('0x31')]=_[_0x9139('0x32')](_0x24e8d5[_0x9139('0x2e')],_0x24e8d5[_0x9139('0x2f')]);_0x50d545[_0x9139('0x33')]=_[_0x9139('0x32')](_0x24e8d5[_0x9139('0x2e')],qs[_0x9139('0x34')](_0xd27355[_0x9139('0x2f')][_0x9139('0x34')]));_0x50d545[_0x9139('0x33')]=_0x50d545['attributes'][_0x9139('0x35')]?_0x50d545[_0x9139('0x33')]:_0x24e8d5['model'];if(!_0xd27355[_0x9139('0x2f')][_0x9139('0x36')](_0x9139('0x37'))){_0x50d545['limit']=qs[_0x9139('0x1a')](_0xd27355[_0x9139('0x2f')][_0x9139('0x1a')]);_0x50d545[_0x9139('0x18')]=qs[_0x9139('0x18')](_0xd27355[_0x9139('0x2f')][_0x9139('0x18')]);}_0x50d545[_0x9139('0x38')]=qs[_0x9139('0x39')](_0xd27355[_0x9139('0x2f')]['sort']);_0x50d545[_0x9139('0x3a')]=qs[_0x9139('0x31')](_[_0x9139('0x3b')](_0xd27355[_0x9139('0x2f')],_0x24e8d5[_0x9139('0x31')]),_0x2dff49);if(_0xd27355[_0x9139('0x2f')][_0x9139('0x3c')]){_0x50d545['where']=_[_0x9139('0x3d')](_0x50d545['where'],{'$or':_[_0x9139('0x2b')](_0x2dff49,function(_0x11789e){if(_0x11789e[_0x9139('0x3e')]!=='VIRTUAL'){var _0x1228b6={};_0x1228b6[_0x11789e[_0x9139('0x28')]]={'$like':'%'+_0xd27355[_0x9139('0x2f')][_0x9139('0x3c')]+'%'};return _0x1228b6;}})});}_0x50d545=_[_0x9139('0x3d')]({},_0x50d545,_0xd27355[_0x9139('0x3f')]);var _0x3c98a4={'where':_0x50d545[_0x9139('0x3a')]};return db[_0x9139('0x2c')][_0x9139('0x40')](_0x3c98a4)['then'](function(_0xf14393){_0x2118a2[_0x9139('0x40')]=_0xf14393;if(_0xd27355[_0x9139('0x2f')]['includeAll']){_0x50d545['include']=[{'all':!![]}];}return db['ContactItemType'][_0x9139('0x41')](_0x50d545);})[_0x9139('0x22')](function(_0x3611b4){_0x2118a2[_0x9139('0x42')]=_0x3611b4;return _0x2118a2;})[_0x9139('0x22')](respondWithFilteredResult(_0x4c1693,_0x50d545))['catch'](handleError(_0x4c1693,null));};exports[_0x9139('0x43')]=function(_0x2f3ed4,_0x40fd52){var _0xf81f77={'raw':!![],'where':{'id':_0x2f3ed4['params']['id']}},_0x2197ff={};_0x2197ff[_0x9139('0x2e')]=_[_0x9139('0x30')](db[_0x9139('0x2c')][_0x9139('0x44')]);_0x2197ff['query']=_['keys'](_0x2f3ed4[_0x9139('0x2f')]);_0x2197ff[_0x9139('0x31')]=_['intersection'](_0x2197ff['model'],_0x2197ff[_0x9139('0x2f')]);_0xf81f77[_0x9139('0x33')]=_['intersection'](_0x2197ff[_0x9139('0x2e')],qs[_0x9139('0x34')](_0x2f3ed4['query'][_0x9139('0x34')]));_0xf81f77['attributes']=_0xf81f77['attributes'][_0x9139('0x35')]?_0xf81f77[_0x9139('0x33')]:_0x2197ff[_0x9139('0x2e')];if(_0x2f3ed4[_0x9139('0x2f')][_0x9139('0x45')]){_0xf81f77['include']=[{'all':!![]}];}_0xf81f77=_[_0x9139('0x3d')]({},_0xf81f77,_0x2f3ed4[_0x9139('0x3f')]);return db[_0x9139('0x2c')]['find'](_0xf81f77)[_0x9139('0x22')](handleEntityNotFound(_0x40fd52,null))[_0x9139('0x22')](respondWithResult(_0x40fd52,null))[_0x9139('0x46')](handleError(_0x40fd52,null));};exports[_0x9139('0x47')]=function(_0x215793,_0x31395f){return db[_0x9139('0x2c')][_0x9139('0x47')](_0x215793[_0x9139('0x48')],{})[_0x9139('0x22')](function(_0x2da28c){var _0x54c926=_0x215793[_0x9139('0x49')][_0x9139('0x4a')]({'plain':!![]});if(!_0x54c926)throw new Error(_0x9139('0x4b'));if(_0x54c926['role']===_0x9139('0x49')){var _0x46f77a=_0x2da28c['get']({'plain':!![]});var _0x2f4a6f=_0x9139('0x23');return db[_0x9139('0x4c')]['find']({'where':{'name':_0x2f4a6f,'userProfileId':_0x54c926[_0x9139('0x4d')]},'raw':!![]})[_0x9139('0x22')](function(_0x1404ce){if(_0x1404ce&&_0x1404ce[_0x9139('0x4e')]===0x0){return db['UserProfileResource'][_0x9139('0x47')]({'name':_0x46f77a[_0x9139('0x28')],'resourceId':_0x46f77a['id'],'type':_0x1404ce[_0x9139('0x28')],'sectionId':_0x1404ce['id']},{})['then'](function(){return _0x2da28c;});}else{return _0x2da28c;}})[_0x9139('0x46')](function(_0x146201){logger[_0x9139('0x26')](_0x9139('0x4f'),_0x146201);throw _0x146201;});}return _0x2da28c;})[_0x9139('0x22')](respondWithResult(_0x31395f,0xc9))[_0x9139('0x46')](handleError(_0x31395f,null));};exports[_0x9139('0x21')]=function(_0x5857bf,_0x35002d){if(_0x5857bf[_0x9139('0x48')]['id']){delete _0x5857bf['body']['id'];}return db[_0x9139('0x2c')][_0x9139('0x50')]({'where':{'id':_0x5857bf[_0x9139('0x51')]['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x35002d,null))[_0x9139('0x22')](saveUpdates(_0x5857bf['body'],null))[_0x9139('0x22')](respondWithResult(_0x35002d,null))[_0x9139('0x46')](handleError(_0x35002d,null));};exports['destroy']=function(_0x500863,_0x212d56){return db[_0x9139('0x2c')][_0x9139('0x50')]({'where':{'id':_0x500863['params']['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x212d56,null))['then'](db['CmContactHasItem'][_0x9139('0x21')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x500863[_0x9139('0x51')]['id']}}))[_0x9139('0x22')](removeEntity(_0x212d56,null))[_0x9139('0x46')](handleError(_0x212d56,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 0d7cfaf..0ee9bb7 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe85d=['rimraf','../../config/environment','./contactItemType.attributes','define','tools_contact_item_types','util','../../config/logger','api','bluebird','path'];(function(_0x17e582,_0x4bf829){var _0x3f4463=function(_0x2101e3){while(--_0x2101e3){_0x17e582['push'](_0x17e582['shift']());}};_0x3f4463(++_0x4bf829);}(_0xe85d,0x1d1));var _0xde85=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xe85d[_0x62c958];return _0x57ec61;};'use strict';var _=require('lodash');var util=require(_0xde85('0x0'));var logger=require(_0xde85('0x1'))(_0xde85('0x2'));var moment=require('moment');var BPromise=require(_0xde85('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde85('0x4'));var rimraf=require(_0xde85('0x5'));var config=require(_0xde85('0x6'));var attributes=require(_0xde85('0x7'));module['exports']=function(_0x1775ca,_0x536f9e){return _0x1775ca[_0xde85('0x8')]('ContactItemType',attributes,{'tableName':_0xde85('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4156=['define','ContactItemType','tools_contact_item_types','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes'];(function(_0xc315de,_0x5dc877){var _0x11a627=function(_0x4039d6){while(--_0x4039d6){_0xc315de['push'](_0xc315de['shift']());}};_0x11a627(++_0x5dc877);}(_0x4156,0x1e4));var _0x6415=function(_0x8b88e2,_0x49149d){_0x8b88e2=_0x8b88e2-0x0;var _0x2b7a43=_0x4156[_0x8b88e2];return _0x2b7a43;};'use strict';var _=require('lodash');var util=require(_0x6415('0x0'));var logger=require(_0x6415('0x1'))(_0x6415('0x2'));var moment=require(_0x6415('0x3'));var BPromise=require(_0x6415('0x4'));var rp=require(_0x6415('0x5'));var fs=require('fs');var path=require(_0x6415('0x6'));var rimraf=require(_0x6415('0x7'));var config=require(_0x6415('0x8'));var attributes=require(_0x6415('0x9'));module['exports']=function(_0x2236a6,_0x3ee00a){return _0x2236a6[_0x6415('0xa')](_0x6415('0xb'),attributes,{'tableName':_0x6415('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 87857ad..14e4c34 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd693=['message','ContactItemType,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code'];(function(_0x37933f,_0x53461f){var _0x3a1e95=function(_0x458057){while(--_0x458057){_0x37933f['push'](_0x37933f['shift']());}};_0x3a1e95(++_0x53461f);}(_0xd693,0xdf));var _0x3d69=function(_0x458edc,_0x9baf98){_0x458edc=_0x458edc-0x0;var _0x44af29=_0xd693[_0x458edc];return _0x44af29;};'use strict';var _=require(_0x3d69('0x0'));var util=require('util');var moment=require(_0x3d69('0x1'));var BPromise=require(_0x3d69('0x2'));var rs=require(_0x3d69('0x3'));var fs=require('fs');var Redis=require(_0x3d69('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3d69('0x5'));var config=require(_0x3d69('0x6'));var jayson=require(_0x3d69('0x7'));var client=jayson[_0x3d69('0x8')][_0x3d69('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20ed67,_0x99a908,_0x55dfda){return new BPromise(function(_0x30f035,_0x5c9e5c){return client[_0x3d69('0xa')](_0x20ed67,_0x55dfda)[_0x3d69('0xb')](function(_0x37d7c5){logger[_0x3d69('0xc')]('ContactItemType,\x20%s,\x20%s',_0x99a908,_0x3d69('0xd'));logger[_0x3d69('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x99a908,_0x3d69('0xd'),JSON['stringify'](_0x37d7c5));if(_0x37d7c5[_0x3d69('0xf')]){if(_0x37d7c5[_0x3d69('0xf')][_0x3d69('0x10')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x99a908,_0x37d7c5[_0x3d69('0xf')][_0x3d69('0x11')]);return _0x5c9e5c(_0x37d7c5['error'][_0x3d69('0x11')]);}logger[_0x3d69('0xf')](_0x3d69('0x12'),_0x99a908,_0x37d7c5[_0x3d69('0xf')][_0x3d69('0x11')]);return _0x30f035(_0x37d7c5[_0x3d69('0xf')]['message']);}else{logger[_0x3d69('0xc')](_0x3d69('0x12'),_0x99a908,_0x3d69('0xd'));_0x30f035(_0x37d7c5['result'][_0x3d69('0x11')]);}})[_0x3d69('0x13')](function(_0x2938b9){logger[_0x3d69('0xf')](_0x3d69('0x12'),_0x99a908,_0x2938b9);_0x5c9e5c(_0x2938b9);});});} \ No newline at end of file +var _0x3b51=['request','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0xff7722,_0x169000){var _0x12a189=function(_0x114286){while(--_0x114286){_0xff7722['push'](_0xff7722['shift']());}};_0x12a189(++_0x169000);}(_0x3b51,0x19a));var _0x13b5=function(_0x11eec5,_0x49c834){_0x11eec5=_0x11eec5-0x0;var _0x184378=_0x3b51[_0x11eec5];return _0x184378;};'use strict';var _=require('lodash');var util=require(_0x13b5('0x0'));var moment=require(_0x13b5('0x1'));var BPromise=require(_0x13b5('0x2'));var rs=require(_0x13b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x13b5('0x4'))('rpc');var config=require(_0x13b5('0x5'));var jayson=require(_0x13b5('0x6'));var client=jayson['client'][_0x13b5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x196568,_0x2659e1,_0x1d9d0d){return new BPromise(function(_0xf05cde,_0x328e2b){return client[_0x13b5('0x8')](_0x196568,_0x1d9d0d)[_0x13b5('0x9')](function(_0x5c392c){logger[_0x13b5('0xa')](_0x13b5('0xb'),_0x2659e1,'request\x20sent');logger[_0x13b5('0xc')](_0x13b5('0xd'),_0x2659e1,_0x13b5('0xe'),JSON['stringify'](_0x5c392c));if(_0x5c392c['error']){if(_0x5c392c['error']['code']===0x1f4){logger[_0x13b5('0xf')](_0x13b5('0xb'),_0x2659e1,_0x5c392c['error'][_0x13b5('0x10')]);return _0x328e2b(_0x5c392c[_0x13b5('0xf')][_0x13b5('0x10')]);}logger[_0x13b5('0xf')](_0x13b5('0xb'),_0x2659e1,_0x5c392c[_0x13b5('0xf')]['message']);return _0xf05cde(_0x5c392c[_0x13b5('0xf')][_0x13b5('0x10')]);}else{logger['info'](_0x13b5('0xb'),_0x2659e1,'request\x20sent');_0xf05cde(_0x5c392c[_0x13b5('0x11')]['message']);}})[_0x13b5('0x12')](function(_0x3d3c1a){logger[_0x13b5('0xf')](_0x13b5('0xb'),_0x2659e1,_0x3d3c1a);_0x328e2b(_0x3d3c1a);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index c800d27..05d050f 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6acf=['post','create','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0xe2ad6c,_0x538f06){var _0x3d1ae8=function(_0x290c3b){while(--_0x290c3b){_0xe2ad6c['push'](_0xe2ad6c['shift']());}};_0x3d1ae8(++_0x538f06);}(_0x6acf,0x190));var _0xf6ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6acf[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf6ac('0x0'));var util=require('util');var path=require(_0xf6ac('0x1'));var timeout=require(_0xf6ac('0x2'));var express=require(_0xf6ac('0x3'));var router=express[_0xf6ac('0x4')]();var fs_extra=require(_0xf6ac('0x5'));var auth=require(_0xf6ac('0x6'));var interaction=require(_0xf6ac('0x7'));var config=require(_0xf6ac('0x8'));var controller=require('./contactItemType.controller');router['get']('/',auth[_0xf6ac('0x9')](),controller[_0xf6ac('0xa')]);router[_0xf6ac('0xb')](_0xf6ac('0xc'),auth[_0xf6ac('0x9')](),controller[_0xf6ac('0xd')]);router[_0xf6ac('0xe')]('/',auth[_0xf6ac('0x9')](),controller[_0xf6ac('0xf')]);router['put'](_0xf6ac('0xc'),auth[_0xf6ac('0x9')](),controller['update']);router[_0xf6ac('0x10')](_0xf6ac('0xc'),auth[_0xf6ac('0x9')](),controller[_0xf6ac('0x11')]);module['exports']=router; \ No newline at end of file +var _0x830f=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x36dc6c,_0x478105){var _0x11d279=function(_0x4ebc90){while(--_0x4ebc90){_0x36dc6c['push'](_0x36dc6c['shift']());}};_0x11d279(++_0x478105);}(_0x830f,0x17a));var _0xf830=function(_0xa42968,_0x5996ec){_0xa42968=_0xa42968-0x0;var _0xc72bb3=_0x830f[_0xa42968];return _0xc72bb3;};'use strict';var multer=require(_0xf830('0x0'));var util=require(_0xf830('0x1'));var path=require('path');var timeout=require(_0xf830('0x2'));var express=require('express');var router=express[_0xf830('0x3')]();var fs_extra=require(_0xf830('0x4'));var auth=require(_0xf830('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf830('0x6'));var controller=require(_0xf830('0x7'));router[_0xf830('0x8')]('/',auth[_0xf830('0x9')](),controller['index']);router[_0xf830('0x8')](_0xf830('0xa'),auth[_0xf830('0x9')](),controller[_0xf830('0xb')]);router[_0xf830('0xc')]('/',auth[_0xf830('0x9')](),controller[_0xf830('0xd')]);router[_0xf830('0xe')](_0xf830('0xa'),auth[_0xf830('0x9')](),controller[_0xf830('0xf')]);router[_0xf830('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf830('0x11')]);module[_0xf830('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 9b13733..5cdbe1b 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(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'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 _0xbaf0=['name','exports','STRING'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index eea3d30..3e75e42 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 _0xa133=['counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','web-report','attrReport','reportType','attrRefresh','addItem','DashboardId','DashboardItem','getItems','findOne','order','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','createdAt','userProfileId','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa133,0x9e));var _0x3a13=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xa133[_0x23e7c1];return _0x1add43;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3a13('0x0'));var jsonpatch=require(_0x3a13('0x1'));var rp=require(_0x3a13('0x2'));var moment=require(_0x3a13('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3a13('0x4'));var csv=require(_0x3a13('0x5'));var ejs=require(_0x3a13('0x6'));var fs=require('fs');var fs_extra=require(_0x3a13('0x7'));var _=require(_0x3a13('0x8'));var squel=require(_0x3a13('0x9'));var crypto=require(_0x3a13('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3a13('0xb'));var Redis=require(_0x3a13('0xc'));var authService=require(_0x3a13('0xd'));var qs=require(_0x3a13('0xe'));var as=require(_0x3a13('0xf'));var hardwareService=require(_0x3a13('0x10'));var logger=require('../../config/logger')(_0x3a13('0x11'));var utils=require(_0x3a13('0x12'));var config=require(_0x3a13('0x13'));var licenseUtil=require(_0x3a13('0x14'));var db=require(_0x3a13('0x15'))['db'];config[_0x3a13('0x16')]=_['defaults'](config[_0x3a13('0x16')],{'host':_0x3a13('0x17'),'port':0x18eb});var socket=require(_0x3a13('0x18'))(new Redis(config[_0x3a13('0x16')]));require(_0x3a13('0x19'))[_0x3a13('0x1a')](socket);function respondWithStatusCode(_0x252af3,_0x622390){_0x622390=_0x622390||0xcc;return function(_0x54c3cf){if(_0x54c3cf){return _0x252af3[_0x3a13('0x1b')](_0x622390);}return _0x252af3['status'](_0x622390)[_0x3a13('0x1c')]();};}function respondWithResult(_0x3a0155,_0xb6d356){_0xb6d356=_0xb6d356||0xc8;return function(_0x32c1bc){if(_0x32c1bc){return _0x3a0155[_0x3a13('0x1d')](_0xb6d356)[_0x3a13('0x1e')](_0x32c1bc);}};}function respondWithFilteredResult(_0x36b3a3,_0x2aba8e){return function(_0x28df8d){if(_0x28df8d){var _0x344301=typeof _0x2aba8e[_0x3a13('0x1f')]===_0x3a13('0x20')&&typeof _0x2aba8e['limit']===_0x3a13('0x20');var _0x548053=_0x28df8d[_0x3a13('0x21')];var _0x525acc=_0x344301?0x0:_0x2aba8e[_0x3a13('0x1f')];var _0x539aa5=_0x344301?_0x28df8d[_0x3a13('0x21')]:_0x2aba8e[_0x3a13('0x1f')]+_0x2aba8e[_0x3a13('0x22')];var _0x2d0745;if(_0x539aa5>=_0x548053){_0x539aa5=_0x548053;_0x2d0745=0xc8;}else{_0x2d0745=0xce;}_0x36b3a3[_0x3a13('0x1d')](_0x2d0745);return _0x36b3a3[_0x3a13('0x23')](_0x3a13('0x24'),_0x525acc+'-'+_0x539aa5+'/'+_0x548053)[_0x3a13('0x1e')](_0x28df8d);}return null;};}function patchUpdates(_0x1d84e0){return function(_0x51fb5a){try{jsonpatch[_0x3a13('0x25')](_0x51fb5a,_0x1d84e0,!![]);}catch(_0x234921){return BPromise[_0x3a13('0x26')](_0x234921);}return _0x51fb5a[_0x3a13('0x27')]();};}function saveUpdates(_0x31d123,_0x5d8dce){return function(_0x5d4d7f){if(_0x5d4d7f){return _0x5d4d7f[_0x3a13('0x28')](_0x31d123)[_0x3a13('0x29')](function(_0x7774a4){return _0x7774a4;});}return null;};}function removeEntity(_0x2e6c7f,_0x5bf85a){return function(_0x2ba85b){if(_0x2ba85b){return _0x2ba85b[_0x3a13('0x2a')]()['then'](function(){var _0x46838d=_0x2ba85b[_0x3a13('0x2b')]({'plain':!![]});var _0x5786c9=_0x3a13('0x2c');return db[_0x3a13('0x2d')]['destroy']({'where':{'type':_0x5786c9,'resourceId':_0x46838d['id']}})[_0x3a13('0x29')](function(){return _0x2ba85b;});})[_0x3a13('0x29')](function(){_0x2e6c7f[_0x3a13('0x1d')](0xcc)[_0x3a13('0x1c')]();});}};}function handleEntityNotFound(_0x39b62b,_0x52ea4e){return function(_0x2bcd56){if(!_0x2bcd56){_0x39b62b['sendStatus'](0x194);}return _0x2bcd56;};}function handleError(_0x401384,_0xf9e5b2){_0xf9e5b2=_0xf9e5b2||0x1f4;return function(_0x398c1a){logger[_0x3a13('0x2e')](_0x398c1a[_0x3a13('0x2f')]);if(_0x398c1a[_0x3a13('0x30')]){delete _0x398c1a[_0x3a13('0x30')];}_0x401384['status'](_0xf9e5b2)[_0x3a13('0x31')](_0x398c1a);};}exports[_0x3a13('0x32')]=function(_0x4e6fc3,_0x1f2ebc){var _0x4658d5={},_0x3848bb={},_0x4225a6={'count':0x0,'rows':[]};var _0x5118f1=_[_0x3a13('0x33')](db[_0x3a13('0x34')][_0x3a13('0x35')],function(_0x2a2fd2){return{'name':_0x2a2fd2['fieldName'],'type':_0x2a2fd2[_0x3a13('0x36')][_0x3a13('0x37')]};});_0x3848bb[_0x3a13('0x38')]=_[_0x3a13('0x33')](_0x5118f1,_0x3a13('0x30'));_0x3848bb[_0x3a13('0x39')]=_['keys'](_0x4e6fc3['query']);_0x3848bb[_0x3a13('0x3a')]=_['intersection'](_0x3848bb[_0x3a13('0x38')],_0x3848bb[_0x3a13('0x39')]);_0x4658d5[_0x3a13('0x3b')]=_[_0x3a13('0x3c')](_0x3848bb[_0x3a13('0x38')],qs[_0x3a13('0x3d')](_0x4e6fc3['query'][_0x3a13('0x3d')]));_0x4658d5[_0x3a13('0x3b')]=_0x4658d5[_0x3a13('0x3b')]['length']?_0x4658d5[_0x3a13('0x3b')]:_0x3848bb[_0x3a13('0x38')];if(!_0x4e6fc3[_0x3a13('0x39')][_0x3a13('0x3e')](_0x3a13('0x3f'))){_0x4658d5[_0x3a13('0x22')]=qs[_0x3a13('0x22')](_0x4e6fc3[_0x3a13('0x39')]['limit']);_0x4658d5['offset']=qs[_0x3a13('0x1f')](_0x4e6fc3[_0x3a13('0x39')][_0x3a13('0x1f')]);}_0x4658d5['order']=qs[_0x3a13('0x40')](_0x4e6fc3['query'][_0x3a13('0x40')]);_0x4658d5[_0x3a13('0x41')]=qs[_0x3a13('0x3a')](_[_0x3a13('0x42')](_0x4e6fc3['query'],_0x3848bb[_0x3a13('0x3a')]),_0x5118f1);if(_0x4e6fc3[_0x3a13('0x39')][_0x3a13('0x43')]){_0x4658d5['where']=_[_0x3a13('0x44')](_0x4658d5[_0x3a13('0x41')],{'$or':_[_0x3a13('0x33')](_0x5118f1,function(_0x58fdb7){if(_0x58fdb7['type']!==_0x3a13('0x45')){var _0x35af22={};_0x35af22[_0x58fdb7[_0x3a13('0x30')]]={'$like':'%'+_0x4e6fc3['query'][_0x3a13('0x43')]+'%'};return _0x35af22;}})});}_0x4658d5=_[_0x3a13('0x44')]({},_0x4658d5,_0x4e6fc3[_0x3a13('0x46')]);var _0x1f5b14={'where':_0x4658d5[_0x3a13('0x41')]};return db[_0x3a13('0x34')]['count'](_0x1f5b14)['then'](function(_0xdff13e){_0x4225a6[_0x3a13('0x21')]=_0xdff13e;if(_0x4e6fc3[_0x3a13('0x39')][_0x3a13('0x47')]){_0x4658d5[_0x3a13('0x48')]=[{'all':!![]}];}return db[_0x3a13('0x34')][_0x3a13('0x49')](_0x4658d5);})[_0x3a13('0x29')](function(_0x444107){_0x4225a6[_0x3a13('0x4a')]=_0x444107;return _0x4225a6;})[_0x3a13('0x29')](respondWithFilteredResult(_0x1f2ebc,_0x4658d5))['catch'](handleError(_0x1f2ebc,null));};exports[_0x3a13('0x4b')]=function(_0x5ce541,_0x37612b){var _0x8741eb={'raw':![],'where':{'id':_0x5ce541[_0x3a13('0x4c')]['id']}},_0x42c79d={};_0x42c79d['model']=_[_0x3a13('0x4d')](db[_0x3a13('0x34')]['rawAttributes']);_0x42c79d['query']=_[_0x3a13('0x4d')](_0x5ce541[_0x3a13('0x39')]);_0x42c79d[_0x3a13('0x3a')]=_[_0x3a13('0x3c')](_0x42c79d['model'],_0x42c79d[_0x3a13('0x39')]);_0x8741eb[_0x3a13('0x3b')]=_['intersection'](_0x42c79d[_0x3a13('0x38')],qs[_0x3a13('0x3d')](_0x5ce541[_0x3a13('0x39')][_0x3a13('0x3d')]));_0x8741eb[_0x3a13('0x3b')]=_0x8741eb['attributes'][_0x3a13('0x4e')]?_0x8741eb['attributes']:_0x42c79d[_0x3a13('0x38')];if(_0x5ce541[_0x3a13('0x39')]['includeAll']){_0x8741eb[_0x3a13('0x48')]=[{'all':!![]}];}_0x8741eb=_[_0x3a13('0x44')]({},_0x8741eb,_0x5ce541[_0x3a13('0x46')]);return db[_0x3a13('0x34')][_0x3a13('0x4f')](_0x8741eb)[_0x3a13('0x29')](handleEntityNotFound(_0x37612b,null))[_0x3a13('0x29')](respondWithResult(_0x37612b,null))[_0x3a13('0x50')](handleError(_0x37612b,null));};exports[_0x3a13('0x51')]=function(_0x1f81b6,_0x43fda8){return db[_0x3a13('0x34')][_0x3a13('0x51')](_0x1f81b6[_0x3a13('0x52')],{})['then'](function(_0x1988a4){var _0x344afb=_0x1f81b6[_0x3a13('0x53')][_0x3a13('0x2b')]({'plain':!![]});if(!_0x344afb)throw new Error(_0x3a13('0x54'));if(_0x344afb[_0x3a13('0x55')]==='user'){var _0x2c39ff=_0x1988a4[_0x3a13('0x2b')]({'plain':!![]});var _0x2b31f3='CustomDashboards';return db['UserProfileSection'][_0x3a13('0x4f')]({'where':{'name':_0x2b31f3,'userProfileId':_0x344afb['userProfileId']},'raw':!![]})['then'](function(_0x2d5611){if(_0x2d5611&&_0x2d5611[_0x3a13('0x56')]===0x0){return db[_0x3a13('0x2d')]['create']({'name':_0x2c39ff[_0x3a13('0x30')],'resourceId':_0x2c39ff['id'],'type':_0x2d5611[_0x3a13('0x30')],'sectionId':_0x2d5611['id']},{})['then'](function(){return _0x1988a4;});}else{return _0x1988a4;}})[_0x3a13('0x50')](function(_0x2edf90){logger[_0x3a13('0x2e')](_0x3a13('0x57'),_0x2edf90);throw _0x2edf90;});}return _0x1988a4;})['then'](respondWithResult(_0x43fda8,0xc9))[_0x3a13('0x50')](handleError(_0x43fda8,null));};exports[_0x3a13('0x58')]=function(_0x3c1ac5,_0x5d18d3){var _0x865638={'where':{'id':_0x3c1ac5['params']['id']}},_0x1924cb={};_0x1924cb[_0x3a13('0x38')]=_[_0x3a13('0x4d')](db[_0x3a13('0x34')][_0x3a13('0x35')]);_0x865638[_0x3a13('0x3b')]=_['intersection'](_0x1924cb['model'],qs[_0x3a13('0x3d')](_0x3c1ac5[_0x3a13('0x39')][_0x3a13('0x3d')]));_0x865638['attributes']=_0x865638[_0x3a13('0x3b')][_0x3a13('0x4e')]?_0x865638[_0x3a13('0x3b')]:_0x1924cb[_0x3a13('0x38')];if(_0x3c1ac5['query'][_0x3a13('0x47')]){_0x865638[_0x3a13('0x48')]=[{'all':!![]}];}_0x865638=_[_0x3a13('0x44')]({},_0x865638,_0x3c1ac5[_0x3a13('0x46')]);return db[_0x3a13('0x34')][_0x3a13('0x4f')](_0x865638)['then'](handleEntityNotFound(_0x5d18d3,null))[_0x3a13('0x29')](function(_0x1c2206){if(_0x1c2206){var _0x69184c=_0x1c2206[_0x3a13('0x2b')]({'plain':!![]});_0x69184c=qs['omit'](_0x69184c,['id','createdAt',_0x3a13('0x59')]);_0x3c1ac5[_0x3a13('0x52')]=_[_0x3a13('0x5a')](_0x3c1ac5['body'],['id',_0x3a13('0x5b'),_0x3a13('0x59')]);return db['Dashboard']['create'](_[_0x3a13('0x44')](_0x69184c,_0x3c1ac5['body']),{'include':_0x3c1ac5[_0x3a13('0x39')]['includeAll']?[{'all':!![]}]:undefined})[_0x3a13('0x29')](function(_0x4f4f2f){var _0x11bf56=_0x3c1ac5['user']['get']({'plain':!![]});if(!_0x11bf56)throw new Error(_0x3a13('0x54'));if(_0x11bf56['role']===_0x3a13('0x53')){var _0x5b155c=_0x4f4f2f[_0x3a13('0x2b')]({'plain':!![]});var _0xad4c14='CustomDashboards';return db['UserProfileSection'][_0x3a13('0x4f')]({'where':{'name':_0xad4c14,'userProfileId':_0x11bf56[_0x3a13('0x5c')]},'raw':!![]})[_0x3a13('0x29')](function(_0x5db7cf){if(_0x5db7cf&&_0x5db7cf[_0x3a13('0x56')]===0x0){return db['UserProfileResource'][_0x3a13('0x51')]({'name':_0x5b155c[_0x3a13('0x30')],'resourceId':_0x5b155c['id'],'type':_0x5db7cf[_0x3a13('0x30')],'sectionId':_0x5db7cf['id']},{})[_0x3a13('0x29')](function(){return _0x4f4f2f;});}else{return _0x4f4f2f;}})['catch'](function(_0x45018d){logger[_0x3a13('0x2e')](_0x3a13('0x57'),_0x45018d);throw _0x45018d;});}return _0x4f4f2f;});}})[_0x3a13('0x29')](respondWithResult(_0x5d18d3,0xc9))['catch'](handleError(_0x5d18d3,null));};exports['update']=function(_0x36f194,_0x3b1863){if(_0x36f194['body']['id']){delete _0x36f194['body']['id'];}return db[_0x3a13('0x34')][_0x3a13('0x4f')]({'where':{'id':_0x36f194[_0x3a13('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3b1863,null))[_0x3a13('0x29')](saveUpdates(_0x36f194[_0x3a13('0x52')],null))[_0x3a13('0x29')](respondWithResult(_0x3b1863,null))['catch'](handleError(_0x3b1863,null));};exports[_0x3a13('0x2a')]=function(_0x13599e,_0x1f050e){return db[_0x3a13('0x34')]['find']({'where':{'id':_0x13599e['params']['id']}})[_0x3a13('0x29')](handleEntityNotFound(_0x1f050e,null))[_0x3a13('0x29')](removeEntity(_0x1f050e,null))[_0x3a13('0x50')](handleError(_0x1f050e,null));};function widgetAttributes(_0x46af8a){try{switch(_0x46af8a[_0x3a13('0x36')]){case'iframe':return[{'name':'attrUrl','value':_0x46af8a[_0x3a13('0x5d')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x0]?_0x46af8a['attrs'][0x0][_0x3a13('0x5f')]:undefined)||_0x3a13('0x60')}];case'custom':return[{'name':_0x3a13('0x61'),'value':_0x46af8a[_0x3a13('0x61')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x0]?_0x46af8a[_0x3a13('0x5e')][0x0][_0x3a13('0x5f')]:undefined)||''}];case _0x3a13('0x62'):return[{'name':'attrHourFormat','value':_0x46af8a[_0x3a13('0x63')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x0]?_0x46af8a[_0x3a13('0x5e')][0x0]['value']:undefined)||_0x3a13('0x64')},{'name':_0x3a13('0x65'),'value':_0x46af8a[_0x3a13('0x65')]||(_0x46af8a['attrs']&&_0x46af8a[_0x3a13('0x5e')][0x1]?_0x46af8a[_0x3a13('0x5e')][0x1][_0x3a13('0x5f')]:undefined)||_0x3a13('0x66')},{'name':_0x3a13('0x67'),'value':_0x46af8a['attrFontSize']||(_0x46af8a['attrs']&&_0x46af8a[_0x3a13('0x5e')][0x2]?_0x46af8a['attrs'][0x2][_0x3a13('0x5f')]:undefined)||0xc}];case _0x3a13('0x68'):return[{'name':_0x3a13('0x69'),'value':_0x46af8a[_0x3a13('0x69')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a['attrs'][0x0]?_0x46af8a[_0x3a13('0x5e')][0x0][_0x3a13('0x5f')]:undefined)||_0x3a13('0x6a')},{'name':'attrVoiceQueues','value':_0x46af8a[_0x3a13('0x6b')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x1]?_0x46af8a[_0x3a13('0x5e')][0x1][_0x3a13('0x5f')]:undefined)||[]},{'name':_0x3a13('0x67'),'value':_0x46af8a[_0x3a13('0x67')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x2]?_0x46af8a[_0x3a13('0x5e')][0x2][_0x3a13('0x5f')]:undefined)||0x14},{'name':'attrChannel','value':_0x46af8a['attrChannel']||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x3]?_0x46af8a[_0x3a13('0x5e')][0x3][_0x3a13('0x5f')]:undefined)||_0x3a13('0x6c')},{'name':_0x3a13('0x6d'),'value':_0x46af8a[_0x3a13('0x6d')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x4]?_0x46af8a[_0x3a13('0x5e')][0x4][_0x3a13('0x5f')]:undefined)||''},{'name':_0x3a13('0x6e'),'value':_0x46af8a[_0x3a13('0x6e')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x5]?_0x46af8a[_0x3a13('0x5e')][0x5][_0x3a13('0x5f')]:undefined)||''},{'name':_0x3a13('0x6f'),'value':_0x46af8a[_0x3a13('0x6f')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x6]?_0x46af8a[_0x3a13('0x5e')][0x6]['value']:undefined)||''},{'name':_0x3a13('0x70'),'value':_0x46af8a[_0x3a13('0x70')]||(_0x46af8a['attrs']&&_0x46af8a[_0x3a13('0x5e')][0x7]?_0x46af8a[_0x3a13('0x5e')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x46af8a[_0x3a13('0x71')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x8]?_0x46af8a['attrs'][0x8][_0x3a13('0x5f')]:undefined)||''},{'name':_0x3a13('0x72'),'value':_0x46af8a[_0x3a13('0x72')]||(_0x46af8a['attrs']&&_0x46af8a[_0x3a13('0x5e')][0x9]?_0x46af8a[_0x3a13('0x5e')][0x9]['value']:undefined)||''}];case _0x3a13('0x73'):case _0x3a13('0x74'):return[{'name':'attrSerie1','value':_0x46af8a[_0x3a13('0x75')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a['attrs'][0x0]?_0x46af8a[_0x3a13('0x5e')][0x0]['value']:undefined)||_0x3a13('0x6a')},{'name':_0x3a13('0x76'),'value':_0x46af8a['attrSerie2']||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x1]?_0x46af8a[_0x3a13('0x5e')][0x1]['value']:undefined)||null},{'name':_0x3a13('0x77'),'value':_0x46af8a[_0x3a13('0x77')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x2]?_0x46af8a['attrs'][0x2][_0x3a13('0x5f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x46af8a[_0x3a13('0x6b')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x3]?_0x46af8a[_0x3a13('0x5e')][0x3][_0x3a13('0x5f')]:undefined)||[]},{'name':_0x3a13('0x78'),'value':_0x46af8a[_0x3a13('0x78')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x4]?_0x46af8a[_0x3a13('0x5e')][0x4][_0x3a13('0x5f')]:undefined)||'voice'},{'name':_0x3a13('0x6d'),'value':_0x46af8a['attrEmailAccounts']||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x5]?_0x46af8a[_0x3a13('0x5e')][0x5][_0x3a13('0x5f')]:undefined)||''},{'name':_0x3a13('0x6e'),'value':_0x46af8a[_0x3a13('0x6e')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a['attrs'][0x6]?_0x46af8a[_0x3a13('0x5e')][0x6][_0x3a13('0x5f')]:undefined)||''},{'name':_0x3a13('0x6f'),'value':_0x46af8a[_0x3a13('0x6f')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x7]?_0x46af8a['attrs'][0x7][_0x3a13('0x5f')]:undefined)||''},{'name':_0x3a13('0x70'),'value':_0x46af8a['attrOpenchannelAccounts']||(_0x46af8a['attrs']&&_0x46af8a[_0x3a13('0x5e')][0x8]?_0x46af8a[_0x3a13('0x5e')][0x8][_0x3a13('0x5f')]:undefined)||''},{'name':_0x3a13('0x71'),'value':_0x46af8a[_0x3a13('0x71')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x9]?_0x46af8a[_0x3a13('0x5e')][0x9][_0x3a13('0x5f')]:undefined)||''},{'name':_0x3a13('0x72'),'value':_0x46af8a['attrChatWebsites']||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a['attrs'][0xa]?_0x46af8a[_0x3a13('0x5e')][0xa]['value']:undefined)||''}];case _0x3a13('0x79'):return[{'name':_0x3a13('0x7a'),'type':_0x46af8a[_0x3a13('0x7b')]||(_0x46af8a['attrs']&&_0x46af8a[_0x3a13('0x5e')][0x0]?_0x46af8a[_0x3a13('0x5e')][0x0]['type']:undefined)||null,'value':_0x46af8a[_0x3a13('0x7a')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x0]?_0x46af8a['attrs'][0x0][_0x3a13('0x5f')]:undefined)||null},{'name':_0x3a13('0x7c'),'value':_0x46af8a[_0x3a13('0x7c')]||(_0x46af8a[_0x3a13('0x5e')]&&_0x46af8a[_0x3a13('0x5e')][0x1]?_0x46af8a[_0x3a13('0x5e')][0x1][_0x3a13('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x38026d){logger[_0x3a13('0x2e')]('widgetAttributes:\x20%s',JSON['stringify'](_0x38026d));return[];}}exports[_0x3a13('0x7d')]=function(_0x1e9fae,_0x5872ac,_0x154897){if(_0x1e9fae[_0x3a13('0x52')]['id']){delete _0x1e9fae[_0x3a13('0x52')]['id'];}return db[_0x3a13('0x34')]['find']({'where':{'id':_0x1e9fae['params']['id']}})[_0x3a13('0x29')](handleEntityNotFound(_0x5872ac,null))[_0x3a13('0x29')](function(_0x116fab){if(_0x116fab){_0x1e9fae[_0x3a13('0x52')][_0x3a13('0x7e')]=_0x116fab['id'];_0x1e9fae[_0x3a13('0x52')]['attrs']=widgetAttributes(_0x1e9fae[_0x3a13('0x52')]);return db[_0x3a13('0x7f')][_0x3a13('0x51')](_0x1e9fae[_0x3a13('0x52')]);}})[_0x3a13('0x29')](respondWithResult(_0x5872ac,null))[_0x3a13('0x50')](handleError(_0x5872ac,null));};exports[_0x3a13('0x80')]=function(_0x3223bd,_0x4da373,_0x32efad){var _0x3b79dc={};var _0x560e98={};var _0x5ee987;var _0x19468f;return db[_0x3a13('0x34')][_0x3a13('0x81')]({'where':{'id':_0x3223bd[_0x3a13('0x4c')]['id']}})[_0x3a13('0x29')](handleEntityNotFound(_0x4da373,null))['then'](function(_0x2e4056){if(_0x2e4056){_0x5ee987=_0x2e4056;_0x560e98[_0x3a13('0x38')]=_[_0x3a13('0x4d')](db['DashboardItem'][_0x3a13('0x35')]);_0x560e98[_0x3a13('0x39')]=_[_0x3a13('0x4d')](_0x3223bd[_0x3a13('0x39')]);_0x560e98[_0x3a13('0x3a')]=_[_0x3a13('0x3c')](_0x560e98[_0x3a13('0x38')],_0x560e98[_0x3a13('0x39')]);_0x3b79dc[_0x3a13('0x3b')]=_['intersection'](_0x560e98[_0x3a13('0x38')],qs[_0x3a13('0x3d')](_0x3223bd[_0x3a13('0x39')][_0x3a13('0x3d')]));_0x3b79dc[_0x3a13('0x3b')]=_0x3b79dc[_0x3a13('0x3b')][_0x3a13('0x4e')]?_0x3b79dc[_0x3a13('0x3b')]:_0x560e98['model'];_0x3b79dc[_0x3a13('0x82')]=qs['sort'](_0x3223bd[_0x3a13('0x39')][_0x3a13('0x40')]);_0x3b79dc[_0x3a13('0x41')]=qs[_0x3a13('0x3a')](_[_0x3a13('0x42')](_0x3223bd['query'],_0x560e98['filters']));if(_0x3223bd[_0x3a13('0x39')][_0x3a13('0x43')]){_0x3b79dc[_0x3a13('0x41')]=_[_0x3a13('0x44')](_0x3b79dc[_0x3a13('0x41')],{'$or':_[_0x3a13('0x33')](_0x3b79dc['attributes'],function(_0x336f0f){var _0x18474e={};_0x18474e[_0x336f0f]={'$like':'%'+_0x3223bd[_0x3a13('0x39')][_0x3a13('0x43')]+'%'};return _0x18474e;})});}_0x3b79dc=_[_0x3a13('0x44')]({},_0x3b79dc,_0x3223bd[_0x3a13('0x46')]);return _0x5ee987[_0x3a13('0x80')](_0x3b79dc);}})[_0x3a13('0x29')](function(_0x1eb620){if(_0x1eb620){_0x19468f=_0x1eb620[_0x3a13('0x4e')];if(!_0x3223bd[_0x3a13('0x39')][_0x3a13('0x3e')](_0x3a13('0x3f'))){_0x3b79dc['limit']=qs['limit'](_0x3223bd[_0x3a13('0x39')][_0x3a13('0x22')]);_0x3b79dc[_0x3a13('0x1f')]=qs['offset'](_0x3223bd[_0x3a13('0x39')]['offset']);}return _0x5ee987['getItems'](_0x3b79dc);}})[_0x3a13('0x29')](function(_0xb8f7be){if(_0xb8f7be){return _0xb8f7be?{'count':_0x19468f,'rows':_0xb8f7be}:null;}})[_0x3a13('0x29')](respondWithResult(_0x4da373,null))[_0x3a13('0x50')](handleError(_0x4da373,null));}; \ No newline at end of file +var _0xcb1e=['./dashboard.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','Dashboard','include','findAll','rows','catch','show','keys','length','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','params','omit','createdAt','updatedAt','body','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','DashboardId','DashboardItem','options','getItems','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0x4fcb90,_0x3c427a){var _0x4a7111=function(_0x1e6530){while(--_0x1e6530){_0x4fcb90['push'](_0x4fcb90['shift']());}};_0x4a7111(++_0x3c427a);}(_0xcb1e,0x1d8));var _0xecb1=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0xcb1e[_0x3b7b8a];return _0x441206;};'use strict';var emlformat=require(_0xecb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xecb1('0x1'));var jsonpatch=require(_0xecb1('0x2'));var rp=require(_0xecb1('0x3'));var moment=require(_0xecb1('0x4'));var BPromise=require(_0xecb1('0x5'));var Mustache=require(_0xecb1('0x6'));var util=require(_0xecb1('0x7'));var path=require('path');var sox=require(_0xecb1('0x8'));var csv=require(_0xecb1('0x9'));var ejs=require(_0xecb1('0xa'));var fs=require('fs');var fs_extra=require(_0xecb1('0xb'));var _=require('lodash');var squel=require(_0xecb1('0xc'));var crypto=require(_0xecb1('0xd'));var jsforce=require(_0xecb1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xecb1('0x9'));var querystring=require(_0xecb1('0xf'));var Papa=require(_0xecb1('0x10'));var Redis=require('ioredis');var authService=require(_0xecb1('0x11'));var qs=require(_0xecb1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecb1('0x13'));var logger=require('../../config/logger')(_0xecb1('0x14'));var utils=require(_0xecb1('0x15'));var config=require(_0xecb1('0x16'));var licenseUtil=require(_0xecb1('0x17'));var db=require(_0xecb1('0x18'))['db'];config[_0xecb1('0x19')]=_[_0xecb1('0x1a')](config[_0xecb1('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xecb1('0x1b'))(new Redis(config[_0xecb1('0x19')]));require(_0xecb1('0x1c'))[_0xecb1('0x1d')](socket);function respondWithStatusCode(_0x1e7222,_0x3087ca){_0x3087ca=_0x3087ca||0xcc;return function(_0xc88714){if(_0xc88714){return _0x1e7222[_0xecb1('0x1e')](_0x3087ca);}return _0x1e7222[_0xecb1('0x1f')](_0x3087ca)['end']();};}function respondWithResult(_0x25cd90,_0x5af590){_0x5af590=_0x5af590||0xc8;return function(_0x43c192){if(_0x43c192){return _0x25cd90[_0xecb1('0x1f')](_0x5af590)[_0xecb1('0x20')](_0x43c192);}};}function respondWithFilteredResult(_0x4b1026,_0x46498f){return function(_0x32fdc2){if(_0x32fdc2){var _0x58bf02=typeof _0x46498f[_0xecb1('0x21')]===_0xecb1('0x22')&&typeof _0x46498f['limit']==='undefined';var _0x3e0db0=_0x32fdc2['count'];var _0xbe330f=_0x58bf02?0x0:_0x46498f['offset'];var _0x528cbe=_0x58bf02?_0x32fdc2[_0xecb1('0x23')]:_0x46498f[_0xecb1('0x21')]+_0x46498f[_0xecb1('0x24')];var _0x302850;if(_0x528cbe>=_0x3e0db0){_0x528cbe=_0x3e0db0;_0x302850=0xc8;}else{_0x302850=0xce;}_0x4b1026[_0xecb1('0x1f')](_0x302850);return _0x4b1026[_0xecb1('0x25')]('Content-Range',_0xbe330f+'-'+_0x528cbe+'/'+_0x3e0db0)[_0xecb1('0x20')](_0x32fdc2);}return null;};}function patchUpdates(_0x471395){return function(_0x72dff4){try{jsonpatch[_0xecb1('0x26')](_0x72dff4,_0x471395,!![]);}catch(_0x130149){return BPromise[_0xecb1('0x27')](_0x130149);}return _0x72dff4[_0xecb1('0x28')]();};}function saveUpdates(_0x2ddd09,_0x16f545){return function(_0x49bbae){if(_0x49bbae){return _0x49bbae[_0xecb1('0x29')](_0x2ddd09)['then'](function(_0x15a53a){return _0x15a53a;});}return null;};}function removeEntity(_0x2ebb78,_0x32bc70){return function(_0x2b0799){if(_0x2b0799){return _0x2b0799['destroy']()[_0xecb1('0x2a')](function(){var _0x15af43=_0x2b0799[_0xecb1('0x2b')]({'plain':!![]});var _0x224d8f=_0xecb1('0x2c');return db[_0xecb1('0x2d')][_0xecb1('0x2e')]({'where':{'type':_0x224d8f,'resourceId':_0x15af43['id']}})['then'](function(){return _0x2b0799;});})[_0xecb1('0x2a')](function(){_0x2ebb78['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2da4bf,_0x42ceb0){return function(_0x118669){if(!_0x118669){_0x2da4bf['sendStatus'](0x194);}return _0x118669;};}function handleError(_0xcfde64,_0x478620){_0x478620=_0x478620||0x1f4;return function(_0x1f971b){logger[_0xecb1('0x2f')](_0x1f971b['stack']);if(_0x1f971b['name']){delete _0x1f971b[_0xecb1('0x30')];}_0xcfde64[_0xecb1('0x1f')](_0x478620)[_0xecb1('0x31')](_0x1f971b);};}exports[_0xecb1('0x32')]=function(_0x1b2938,_0x209e46){var _0x249523={},_0x4b3b19={},_0x4a41f3={'count':0x0,'rows':[]};var _0x75ca8b=_[_0xecb1('0x33')](db['Dashboard'][_0xecb1('0x34')],function(_0x223f1e){return{'name':_0x223f1e[_0xecb1('0x35')],'type':_0x223f1e['type'][_0xecb1('0x36')]};});_0x4b3b19[_0xecb1('0x37')]=_['map'](_0x75ca8b,'name');_0x4b3b19[_0xecb1('0x38')]=_['keys'](_0x1b2938[_0xecb1('0x38')]);_0x4b3b19[_0xecb1('0x39')]=_[_0xecb1('0x3a')](_0x4b3b19[_0xecb1('0x37')],_0x4b3b19[_0xecb1('0x38')]);_0x249523[_0xecb1('0x3b')]=_['intersection'](_0x4b3b19['model'],qs['fields'](_0x1b2938['query'][_0xecb1('0x3c')]));_0x249523[_0xecb1('0x3b')]=_0x249523[_0xecb1('0x3b')]['length']?_0x249523['attributes']:_0x4b3b19[_0xecb1('0x37')];if(!_0x1b2938[_0xecb1('0x38')][_0xecb1('0x3d')](_0xecb1('0x3e'))){_0x249523['limit']=qs['limit'](_0x1b2938[_0xecb1('0x38')][_0xecb1('0x24')]);_0x249523[_0xecb1('0x21')]=qs[_0xecb1('0x21')](_0x1b2938[_0xecb1('0x38')]['offset']);}_0x249523[_0xecb1('0x3f')]=qs[_0xecb1('0x40')](_0x1b2938[_0xecb1('0x38')][_0xecb1('0x40')]);_0x249523[_0xecb1('0x41')]=qs['filters'](_[_0xecb1('0x42')](_0x1b2938[_0xecb1('0x38')],_0x4b3b19[_0xecb1('0x39')]),_0x75ca8b);if(_0x1b2938[_0xecb1('0x38')]['filter']){_0x249523[_0xecb1('0x41')]=_[_0xecb1('0x43')](_0x249523[_0xecb1('0x41')],{'$or':_[_0xecb1('0x33')](_0x75ca8b,function(_0x22111d){if(_0x22111d[_0xecb1('0x44')]!=='VIRTUAL'){var _0x4570db={};_0x4570db[_0x22111d[_0xecb1('0x30')]]={'$like':'%'+_0x1b2938['query'][_0xecb1('0x45')]+'%'};return _0x4570db;}})});}_0x249523=_[_0xecb1('0x43')]({},_0x249523,_0x1b2938['options']);var _0x3cf8db={'where':_0x249523[_0xecb1('0x41')]};return db[_0xecb1('0x46')]['count'](_0x3cf8db)['then'](function(_0x534ee4){_0x4a41f3['count']=_0x534ee4;if(_0x1b2938[_0xecb1('0x38')]['includeAll']){_0x249523[_0xecb1('0x47')]=[{'all':!![]}];}return db['Dashboard'][_0xecb1('0x48')](_0x249523);})[_0xecb1('0x2a')](function(_0x131a91){_0x4a41f3[_0xecb1('0x49')]=_0x131a91;return _0x4a41f3;})['then'](respondWithFilteredResult(_0x209e46,_0x249523))[_0xecb1('0x4a')](handleError(_0x209e46,null));};exports[_0xecb1('0x4b')]=function(_0x13dd3e,_0x5ef9ae){var _0x17fa3b={'raw':![],'where':{'id':_0x13dd3e['params']['id']}},_0x449f4c={};_0x449f4c['model']=_['keys'](db[_0xecb1('0x46')][_0xecb1('0x34')]);_0x449f4c[_0xecb1('0x38')]=_[_0xecb1('0x4c')](_0x13dd3e[_0xecb1('0x38')]);_0x449f4c[_0xecb1('0x39')]=_[_0xecb1('0x3a')](_0x449f4c[_0xecb1('0x37')],_0x449f4c[_0xecb1('0x38')]);_0x17fa3b[_0xecb1('0x3b')]=_[_0xecb1('0x3a')](_0x449f4c[_0xecb1('0x37')],qs[_0xecb1('0x3c')](_0x13dd3e[_0xecb1('0x38')][_0xecb1('0x3c')]));_0x17fa3b['attributes']=_0x17fa3b[_0xecb1('0x3b')][_0xecb1('0x4d')]?_0x17fa3b['attributes']:_0x449f4c[_0xecb1('0x37')];if(_0x13dd3e[_0xecb1('0x38')][_0xecb1('0x4e')]){_0x17fa3b[_0xecb1('0x47')]=[{'all':!![]}];}_0x17fa3b=_[_0xecb1('0x43')]({},_0x17fa3b,_0x13dd3e['options']);return db[_0xecb1('0x46')][_0xecb1('0x4f')](_0x17fa3b)['then'](handleEntityNotFound(_0x5ef9ae,null))['then'](respondWithResult(_0x5ef9ae,null))[_0xecb1('0x4a')](handleError(_0x5ef9ae,null));};exports[_0xecb1('0x50')]=function(_0x18e902,_0x3f3ff7){return db[_0xecb1('0x46')][_0xecb1('0x50')](_0x18e902['body'],{})['then'](function(_0x1eb022){var _0x2a49bd=_0x18e902['user'][_0xecb1('0x2b')]({'plain':!![]});if(!_0x2a49bd)throw new Error(_0xecb1('0x51'));if(_0x2a49bd[_0xecb1('0x52')]===_0xecb1('0x53')){var _0x3a43c2=_0x1eb022[_0xecb1('0x2b')]({'plain':!![]});var _0x519c47=_0xecb1('0x2c');return db[_0xecb1('0x54')]['find']({'where':{'name':_0x519c47,'userProfileId':_0x2a49bd[_0xecb1('0x55')]},'raw':!![]})[_0xecb1('0x2a')](function(_0x26ca55){if(_0x26ca55&&_0x26ca55[_0xecb1('0x56')]===0x0){return db[_0xecb1('0x2d')]['create']({'name':_0x3a43c2[_0xecb1('0x30')],'resourceId':_0x3a43c2['id'],'type':_0x26ca55[_0xecb1('0x30')],'sectionId':_0x26ca55['id']},{})[_0xecb1('0x2a')](function(){return _0x1eb022;});}else{return _0x1eb022;}})['catch'](function(_0xeb96c3){logger[_0xecb1('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xeb96c3);throw _0xeb96c3;});}return _0x1eb022;})[_0xecb1('0x2a')](respondWithResult(_0x3f3ff7,0xc9))['catch'](handleError(_0x3f3ff7,null));};exports['clone']=function(_0x1ba28e,_0x2bd484){var _0x1bc479={'where':{'id':_0x1ba28e[_0xecb1('0x57')]['id']}},_0x44fe49={};_0x44fe49[_0xecb1('0x37')]=_[_0xecb1('0x4c')](db[_0xecb1('0x46')][_0xecb1('0x34')]);_0x1bc479[_0xecb1('0x3b')]=_[_0xecb1('0x3a')](_0x44fe49[_0xecb1('0x37')],qs['fields'](_0x1ba28e[_0xecb1('0x38')][_0xecb1('0x3c')]));_0x1bc479['attributes']=_0x1bc479[_0xecb1('0x3b')][_0xecb1('0x4d')]?_0x1bc479[_0xecb1('0x3b')]:_0x44fe49[_0xecb1('0x37')];if(_0x1ba28e['query'][_0xecb1('0x4e')]){_0x1bc479[_0xecb1('0x47')]=[{'all':!![]}];}_0x1bc479=_[_0xecb1('0x43')]({},_0x1bc479,_0x1ba28e['options']);return db[_0xecb1('0x46')][_0xecb1('0x4f')](_0x1bc479)[_0xecb1('0x2a')](handleEntityNotFound(_0x2bd484,null))['then'](function(_0x38c9a7){if(_0x38c9a7){var _0x2b2bc7=_0x38c9a7[_0xecb1('0x2b')]({'plain':!![]});_0x2b2bc7=qs[_0xecb1('0x58')](_0x2b2bc7,['id',_0xecb1('0x59'),_0xecb1('0x5a')]);_0x1ba28e[_0xecb1('0x5b')]=_['omit'](_0x1ba28e[_0xecb1('0x5b')],['id','createdAt','updatedAt']);return db[_0xecb1('0x46')][_0xecb1('0x50')](_[_0xecb1('0x43')](_0x2b2bc7,_0x1ba28e[_0xecb1('0x5b')]),{'include':_0x1ba28e[_0xecb1('0x38')][_0xecb1('0x4e')]?[{'all':!![]}]:undefined})[_0xecb1('0x2a')](function(_0x571a58){var _0x362145=_0x1ba28e[_0xecb1('0x53')][_0xecb1('0x2b')]({'plain':!![]});if(!_0x362145)throw new Error(_0xecb1('0x51'));if(_0x362145['role']===_0xecb1('0x53')){var _0x108cc1=_0x571a58['get']({'plain':!![]});var _0x2ee05e='CustomDashboards';return db[_0xecb1('0x54')][_0xecb1('0x4f')]({'where':{'name':_0x2ee05e,'userProfileId':_0x362145[_0xecb1('0x55')]},'raw':!![]})['then'](function(_0x184a0a){if(_0x184a0a&&_0x184a0a[_0xecb1('0x56')]===0x0){return db[_0xecb1('0x2d')][_0xecb1('0x50')]({'name':_0x108cc1['name'],'resourceId':_0x108cc1['id'],'type':_0x184a0a[_0xecb1('0x30')],'sectionId':_0x184a0a['id']},{})[_0xecb1('0x2a')](function(){return _0x571a58;});}else{return _0x571a58;}})[_0xecb1('0x4a')](function(_0x4d51fb){logger[_0xecb1('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d51fb);throw _0x4d51fb;});}return _0x571a58;});}})['then'](respondWithResult(_0x2bd484,0xc9))[_0xecb1('0x4a')](handleError(_0x2bd484,null));};exports[_0xecb1('0x29')]=function(_0x127124,_0x2b7a9f){if(_0x127124['body']['id']){delete _0x127124['body']['id'];}return db[_0xecb1('0x46')]['find']({'where':{'id':_0x127124[_0xecb1('0x57')]['id']}})[_0xecb1('0x2a')](handleEntityNotFound(_0x2b7a9f,null))['then'](saveUpdates(_0x127124[_0xecb1('0x5b')],null))[_0xecb1('0x2a')](respondWithResult(_0x2b7a9f,null))[_0xecb1('0x4a')](handleError(_0x2b7a9f,null));};exports[_0xecb1('0x2e')]=function(_0x2b5627,_0x39b95d){return db['Dashboard']['find']({'where':{'id':_0x2b5627[_0xecb1('0x57')]['id']}})[_0xecb1('0x2a')](handleEntityNotFound(_0x39b95d,null))[_0xecb1('0x2a')](removeEntity(_0x39b95d,null))[_0xecb1('0x4a')](handleError(_0x39b95d,null));};function widgetAttributes(_0xf1ea74){try{switch(_0xf1ea74[_0xecb1('0x44')]){case'iframe':return[{'name':_0xecb1('0x5c'),'value':_0xf1ea74[_0xecb1('0x5c')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x0]?_0xf1ea74[_0xecb1('0x5d')][0x0]['value']:undefined)||_0xecb1('0x5e')}];case _0xecb1('0x5f'):return[{'name':_0xecb1('0x60'),'value':_0xf1ea74[_0xecb1('0x60')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x0]?_0xf1ea74[_0xecb1('0x5d')][0x0][_0xecb1('0x61')]:undefined)||''}];case'clock':return[{'name':_0xecb1('0x62'),'value':_0xf1ea74[_0xecb1('0x62')]||(_0xf1ea74['attrs']&&_0xf1ea74[_0xecb1('0x5d')][0x0]?_0xf1ea74[_0xecb1('0x5d')][0x0][_0xecb1('0x61')]:undefined)||_0xecb1('0x63')},{'name':'attrTimezone','value':_0xf1ea74[_0xecb1('0x64')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x1]?_0xf1ea74[_0xecb1('0x5d')][0x1][_0xecb1('0x61')]:undefined)||_0xecb1('0x65')},{'name':_0xecb1('0x66'),'value':_0xf1ea74[_0xecb1('0x66')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x2]?_0xf1ea74[_0xecb1('0x5d')][0x2][_0xecb1('0x61')]:undefined)||0xc}];case'counter':return[{'name':_0xecb1('0x67'),'value':_0xf1ea74[_0xecb1('0x67')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x0]?_0xf1ea74[_0xecb1('0x5d')][0x0][_0xecb1('0x61')]:undefined)||_0xecb1('0x68')},{'name':_0xecb1('0x69'),'value':_0xf1ea74[_0xecb1('0x69')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x1]?_0xf1ea74[_0xecb1('0x5d')][0x1][_0xecb1('0x61')]:undefined)||[]},{'name':_0xecb1('0x66'),'value':_0xf1ea74[_0xecb1('0x66')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x2]?_0xf1ea74[_0xecb1('0x5d')][0x2][_0xecb1('0x61')]:undefined)||0x14},{'name':_0xecb1('0x6a'),'value':_0xf1ea74[_0xecb1('0x6a')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x3]?_0xf1ea74[_0xecb1('0x5d')][0x3]['value']:undefined)||_0xecb1('0x6b')},{'name':_0xecb1('0x6c'),'value':_0xf1ea74['attrEmailAccounts']||(_0xf1ea74['attrs']&&_0xf1ea74[_0xecb1('0x5d')][0x4]?_0xf1ea74[_0xecb1('0x5d')][0x4][_0xecb1('0x61')]:undefined)||''},{'name':_0xecb1('0x6d'),'value':_0xf1ea74[_0xecb1('0x6d')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x5]?_0xf1ea74[_0xecb1('0x5d')][0x5][_0xecb1('0x61')]:undefined)||''},{'name':_0xecb1('0x6e'),'value':_0xf1ea74['attrSmsAccounts']||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x6]?_0xf1ea74[_0xecb1('0x5d')][0x6][_0xecb1('0x61')]:undefined)||''},{'name':_0xecb1('0x6f'),'value':_0xf1ea74[_0xecb1('0x6f')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x7]?_0xf1ea74['attrs'][0x7][_0xecb1('0x61')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xf1ea74[_0xecb1('0x70')]||(_0xf1ea74['attrs']&&_0xf1ea74[_0xecb1('0x5d')][0x8]?_0xf1ea74['attrs'][0x8][_0xecb1('0x61')]:undefined)||''},{'name':_0xecb1('0x71'),'value':_0xf1ea74['attrChatWebsites']||(_0xf1ea74['attrs']&&_0xf1ea74[_0xecb1('0x5d')][0x9]?_0xf1ea74['attrs'][0x9][_0xecb1('0x61')]:undefined)||''}];case'multibar-chart':case _0xecb1('0x72'):return[{'name':'attrSerie1','value':_0xf1ea74[_0xecb1('0x73')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x0]?_0xf1ea74[_0xecb1('0x5d')][0x0]['value']:undefined)||_0xecb1('0x68')},{'name':_0xecb1('0x74'),'value':_0xf1ea74[_0xecb1('0x74')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x1]?_0xf1ea74['attrs'][0x1][_0xecb1('0x61')]:undefined)||null},{'name':_0xecb1('0x75'),'value':_0xf1ea74[_0xecb1('0x75')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x2]?_0xf1ea74[_0xecb1('0x5d')][0x2]['value']:undefined)||null},{'name':_0xecb1('0x69'),'value':_0xf1ea74[_0xecb1('0x69')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x3]?_0xf1ea74['attrs'][0x3][_0xecb1('0x61')]:undefined)||[]},{'name':'attrChannel','value':_0xf1ea74[_0xecb1('0x6a')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x4]?_0xf1ea74['attrs'][0x4][_0xecb1('0x61')]:undefined)||_0xecb1('0x6b')},{'name':'attrEmailAccounts','value':_0xf1ea74[_0xecb1('0x6c')]||(_0xf1ea74['attrs']&&_0xf1ea74[_0xecb1('0x5d')][0x5]?_0xf1ea74['attrs'][0x5][_0xecb1('0x61')]:undefined)||''},{'name':_0xecb1('0x6d'),'value':_0xf1ea74[_0xecb1('0x6d')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x6]?_0xf1ea74['attrs'][0x6][_0xecb1('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0xf1ea74[_0xecb1('0x6e')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x7]?_0xf1ea74[_0xecb1('0x5d')][0x7][_0xecb1('0x61')]:undefined)||''},{'name':_0xecb1('0x6f'),'value':_0xf1ea74[_0xecb1('0x6f')]||(_0xf1ea74['attrs']&&_0xf1ea74[_0xecb1('0x5d')][0x8]?_0xf1ea74[_0xecb1('0x5d')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xf1ea74[_0xecb1('0x70')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x9]?_0xf1ea74['attrs'][0x9][_0xecb1('0x61')]:undefined)||''},{'name':_0xecb1('0x71'),'value':_0xf1ea74[_0xecb1('0x71')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0xa]?_0xf1ea74['attrs'][0xa]['value']:undefined)||''}];case _0xecb1('0x76'):return[{'name':_0xecb1('0x77'),'type':_0xf1ea74['reportType']||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x0]?_0xf1ea74['attrs'][0x0][_0xecb1('0x44')]:undefined)||null,'value':_0xf1ea74['attrReport']||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74['attrs'][0x0]?_0xf1ea74['attrs'][0x0][_0xecb1('0x61')]:undefined)||null},{'name':_0xecb1('0x78'),'value':_0xf1ea74[_0xecb1('0x78')]||(_0xf1ea74[_0xecb1('0x5d')]&&_0xf1ea74[_0xecb1('0x5d')][0x1]?_0xf1ea74['attrs'][0x1][_0xecb1('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x4f1d63){logger[_0xecb1('0x2f')]('widgetAttributes:\x20%s',JSON['stringify'](_0x4f1d63));return[];}}exports['addItem']=function(_0xceba65,_0x5cf960,_0x480a1e){if(_0xceba65['body']['id']){delete _0xceba65[_0xecb1('0x5b')]['id'];}return db[_0xecb1('0x46')][_0xecb1('0x4f')]({'where':{'id':_0xceba65[_0xecb1('0x57')]['id']}})[_0xecb1('0x2a')](handleEntityNotFound(_0x5cf960,null))[_0xecb1('0x2a')](function(_0x5a1015){if(_0x5a1015){_0xceba65[_0xecb1('0x5b')][_0xecb1('0x79')]=_0x5a1015['id'];_0xceba65[_0xecb1('0x5b')][_0xecb1('0x5d')]=widgetAttributes(_0xceba65['body']);return db['DashboardItem']['create'](_0xceba65[_0xecb1('0x5b')]);}})[_0xecb1('0x2a')](respondWithResult(_0x5cf960,null))[_0xecb1('0x4a')](handleError(_0x5cf960,null));};exports['getItems']=function(_0x1444b4,_0x196a28,_0x323600){var _0x5e4144={};var _0x38ec17={};var _0x333cb2;var _0x21d3de;return db['Dashboard']['findOne']({'where':{'id':_0x1444b4['params']['id']}})['then'](handleEntityNotFound(_0x196a28,null))['then'](function(_0x19f6f9){if(_0x19f6f9){_0x333cb2=_0x19f6f9;_0x38ec17[_0xecb1('0x37')]=_[_0xecb1('0x4c')](db[_0xecb1('0x7a')][_0xecb1('0x34')]);_0x38ec17[_0xecb1('0x38')]=_[_0xecb1('0x4c')](_0x1444b4[_0xecb1('0x38')]);_0x38ec17[_0xecb1('0x39')]=_['intersection'](_0x38ec17[_0xecb1('0x37')],_0x38ec17[_0xecb1('0x38')]);_0x5e4144[_0xecb1('0x3b')]=_[_0xecb1('0x3a')](_0x38ec17['model'],qs[_0xecb1('0x3c')](_0x1444b4[_0xecb1('0x38')]['fields']));_0x5e4144[_0xecb1('0x3b')]=_0x5e4144['attributes'][_0xecb1('0x4d')]?_0x5e4144[_0xecb1('0x3b')]:_0x38ec17[_0xecb1('0x37')];_0x5e4144[_0xecb1('0x3f')]=qs[_0xecb1('0x40')](_0x1444b4[_0xecb1('0x38')][_0xecb1('0x40')]);_0x5e4144[_0xecb1('0x41')]=qs[_0xecb1('0x39')](_[_0xecb1('0x42')](_0x1444b4['query'],_0x38ec17[_0xecb1('0x39')]));if(_0x1444b4['query'][_0xecb1('0x45')]){_0x5e4144[_0xecb1('0x41')]=_[_0xecb1('0x43')](_0x5e4144[_0xecb1('0x41')],{'$or':_[_0xecb1('0x33')](_0x5e4144['attributes'],function(_0x4f888d){var _0x3e7a6f={};_0x3e7a6f[_0x4f888d]={'$like':'%'+_0x1444b4[_0xecb1('0x38')][_0xecb1('0x45')]+'%'};return _0x3e7a6f;})});}_0x5e4144=_[_0xecb1('0x43')]({},_0x5e4144,_0x1444b4[_0xecb1('0x7b')]);return _0x333cb2[_0xecb1('0x7c')](_0x5e4144);}})[_0xecb1('0x2a')](function(_0x339362){if(_0x339362){_0x21d3de=_0x339362[_0xecb1('0x4d')];if(!_0x1444b4[_0xecb1('0x38')][_0xecb1('0x3d')]('nolimit')){_0x5e4144[_0xecb1('0x24')]=qs[_0xecb1('0x24')](_0x1444b4[_0xecb1('0x38')][_0xecb1('0x24')]);_0x5e4144[_0xecb1('0x21')]=qs[_0xecb1('0x21')](_0x1444b4['query'][_0xecb1('0x21')]);}return _0x333cb2['getItems'](_0x5e4144);}})[_0xecb1('0x2a')](function(_0x3cbc0d){if(_0x3cbc0d){return _0x3cbc0d?{'count':_0x21d3de,'rows':_0x3cbc0d}:null;}})[_0xecb1('0x2a')](respondWithResult(_0x196a28,null))[_0xecb1('0x4a')](handleError(_0x196a28,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 94d7739..a909c82 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 _0xd2a4=['hook','exports','events','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x3f6962,_0x2e558b){var _0x3565a7=function(_0x4a381c){while(--_0x4a381c){_0x3f6962['push'](_0x3f6962['shift']());}};_0x3565a7(++_0x2e558b);}(_0xd2a4,0x142));var _0x4d2a=function(_0x22ac60,_0x246924){_0x22ac60=_0x22ac60-0x0;var _0x2fa2f0=_0xd2a4[_0x22ac60];return _0x2fa2f0;};'use strict';var EventEmitter=require(_0x4d2a('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4d2a('0x1')](0x0);var events={'afterCreate':_0x4d2a('0x2'),'afterUpdate':'update','afterDestroy':_0x4d2a('0x3')};function emitEvent(_0x51662d){return function(_0x4a3360,_0x28cc49,_0x120d35){DashboardEvents[_0x4d2a('0x4')](_0x51662d+':'+_0x4a3360['id'],_0x4a3360);DashboardEvents[_0x4d2a('0x4')](_0x51662d,_0x4a3360);_0x120d35(null);};}for(var e in events){if(events[_0x4d2a('0x5')](e)){var event=events[e];Dashboard[_0x4d2a('0x6')](e,emitEvent(event));}}module[_0x4d2a('0x7')]=DashboardEvents; \ No newline at end of file +var _0x92ca=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x1c1172,_0x27c3c4){var _0x300943=function(_0x3f8b89){while(--_0x3f8b89){_0x1c1172['push'](_0x1c1172['shift']());}};_0x300943(++_0x27c3c4);}(_0x92ca,0x16c));var _0xa92c=function(_0x4eda15,_0x28fa8c){_0x4eda15=_0x4eda15-0x0;var _0x292fe7=_0x92ca[_0x4eda15];return _0x292fe7;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xa92c('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa92c('0x1')](0x0);var events={'afterCreate':_0xa92c('0x2'),'afterUpdate':_0xa92c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x51be50){return function(_0x47a452,_0x1fa08a,_0x21260c){DashboardEvents['emit'](_0x51be50+':'+_0x47a452['id'],_0x47a452);DashboardEvents[_0xa92c('0x4')](_0x51be50,_0x47a452);_0x21260c(null);};}for(var e in events){if(events[_0xa92c('0x5')](e)){var event=events[e];Dashboard[_0xa92c('0x6')](e,emitEvent(event));}}module[_0xa92c('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index f1f881e..08ac9a2 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 _0xde05=['moment','bluebird','rimraf','./dashboard.attributes','Dashboard','dashboards','util','../../config/logger'];(function(_0x40ef20,_0x294d44){var _0x415188=function(_0x213549){while(--_0x213549){_0x40ef20['push'](_0x40ef20['shift']());}};_0x415188(++_0x294d44);}(_0xde05,0x7e));var _0x5de0=function(_0x2064c3,_0xddfdfa){_0x2064c3=_0x2064c3-0x0;var _0x4165e6=_0xde05[_0x2064c3];return _0x4165e6;};'use strict';var _=require('lodash');var util=require(_0x5de0('0x0'));var logger=require(_0x5de0('0x1'))('api');var moment=require(_0x5de0('0x2'));var BPromise=require(_0x5de0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5de0('0x4'));var config=require('../../config/environment');var attributes=require(_0x5de0('0x5'));module['exports']=function(_0x501a74,_0x46c257){return _0x501a74['define'](_0x5de0('0x6'),attributes,{'tableName':_0x5de0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad00=['Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xad00,0x195));var _0x0ad0=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xad00[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0x0ad0('0x0'));var util=require(_0x0ad0('0x1'));var logger=require(_0x0ad0('0x2'))(_0x0ad0('0x3'));var moment=require(_0x0ad0('0x4'));var BPromise=require(_0x0ad0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ad0('0x6'));var rimraf=require(_0x0ad0('0x7'));var config=require(_0x0ad0('0x8'));var attributes=require('./dashboard.attributes');module[_0x0ad0('0x9')]=function(_0x4165e6,_0x1f33d8){return _0x4165e6[_0x0ad0('0xa')](_0x0ad0('0xb'),attributes,{'tableName':_0x0ad0('0xc'),'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 b39b3f3..56f091d 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 _0x08da=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','request\x20sent','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xd52df2,_0x53355d){var _0x13b66b=function(_0x3a009c){while(--_0x3a009c){_0xd52df2['push'](_0xd52df2['shift']());}};_0x13b66b(++_0x53355d);}(_0x08da,0x180));var _0xa08d=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x08da[_0x411017];return _0x2adeea;};'use strict';var _=require('lodash');var util=require(_0xa08d('0x0'));var moment=require(_0xa08d('0x1'));var BPromise=require('bluebird');var rs=require(_0xa08d('0x2'));var fs=require('fs');var Redis=require(_0xa08d('0x3'));var db=require(_0xa08d('0x4'))['db'];var utils=require(_0xa08d('0x5'));var logger=require('../../config/logger')(_0xa08d('0x6'));var config=require(_0xa08d('0x7'));var jayson=require(_0xa08d('0x8'));var client=jayson[_0xa08d('0x9')][_0xa08d('0xa')]({'port':0x232a});config[_0xa08d('0xb')]=_[_0xa08d('0xc')](config[_0xa08d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa08d('0xd'))(new Redis(config[_0xa08d('0xb')]));require(_0xa08d('0xe'))[_0xa08d('0xf')](socket);function respondWithRpcPromise(_0x3296ab,_0x25ba56,_0xaab4cd){return new BPromise(function(_0x383af5,_0x54fe32){return client[_0xa08d('0x10')](_0x3296ab,_0xaab4cd)[_0xa08d('0x11')](function(_0x4c6a40){logger['info']('Dashboard,\x20%s,\x20%s',_0x25ba56,_0xa08d('0x12'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x25ba56,_0xa08d('0x12'),JSON['stringify'](_0x4c6a40));if(_0x4c6a40[_0xa08d('0x13')]){if(_0x4c6a40['error'][_0xa08d('0x14')]===0x1f4){logger['error'](_0xa08d('0x15'),_0x25ba56,_0x4c6a40[_0xa08d('0x13')][_0xa08d('0x16')]);return _0x54fe32(_0x4c6a40['error'][_0xa08d('0x16')]);}logger[_0xa08d('0x13')](_0xa08d('0x15'),_0x25ba56,_0x4c6a40[_0xa08d('0x13')][_0xa08d('0x16')]);return _0x383af5(_0x4c6a40[_0xa08d('0x13')][_0xa08d('0x16')]);}else{logger[_0xa08d('0x17')]('Dashboard,\x20%s,\x20%s',_0x25ba56,_0xa08d('0x12'));_0x383af5(_0x4c6a40[_0xa08d('0x18')][_0xa08d('0x16')]);}})[_0xa08d('0x19')](function(_0x34342b){logger[_0xa08d('0x13')]('Dashboard,\x20%s,\x20%s',_0x25ba56,_0x34342b);_0x54fe32(_0x34342b);});});} \ No newline at end of file +var _0xdf1c=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info','lodash','util'];(function(_0x2e7b28,_0x14094e){var _0x24e5bd=function(_0x3a762d){while(--_0x3a762d){_0x2e7b28['push'](_0x2e7b28['shift']());}};_0x24e5bd(++_0x14094e);}(_0xdf1c,0x112));var _0xcdf1=function(_0x151076,_0x11d021){_0x151076=_0x151076-0x0;var _0x230967=_0xdf1c[_0x151076];return _0x230967;};'use strict';var _=require(_0xcdf1('0x0'));var util=require(_0xcdf1('0x1'));var moment=require('moment');var BPromise=require(_0xcdf1('0x2'));var rs=require(_0xcdf1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdf1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdf1('0x5'))(_0xcdf1('0x6'));var config=require(_0xcdf1('0x7'));var jayson=require(_0xcdf1('0x8'));var client=jayson[_0xcdf1('0x9')]['http']({'port':0x232a});config[_0xcdf1('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcdf1('0xb'))(new Redis(config[_0xcdf1('0xa')]));require(_0xcdf1('0xc'))[_0xcdf1('0xd')](socket);function respondWithRpcPromise(_0x4fdcd6,_0x813af7,_0x33ae76){return new BPromise(function(_0xa26a5e,_0x27099e){return client[_0xcdf1('0xe')](_0x4fdcd6,_0x33ae76)[_0xcdf1('0xf')](function(_0x537c5a){logger['info'](_0xcdf1('0x10'),_0x813af7,_0xcdf1('0x11'));logger[_0xcdf1('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x813af7,_0xcdf1('0x11'),JSON['stringify'](_0x537c5a));if(_0x537c5a['error']){if(_0x537c5a['error'][_0xcdf1('0x13')]===0x1f4){logger[_0xcdf1('0x14')](_0xcdf1('0x10'),_0x813af7,_0x537c5a[_0xcdf1('0x14')]['message']);return _0x27099e(_0x537c5a[_0xcdf1('0x14')][_0xcdf1('0x15')]);}logger[_0xcdf1('0x14')]('Dashboard,\x20%s,\x20%s',_0x813af7,_0x537c5a[_0xcdf1('0x14')]['message']);return _0xa26a5e(_0x537c5a[_0xcdf1('0x14')][_0xcdf1('0x15')]);}else{logger[_0xcdf1('0x16')](_0xcdf1('0x10'),_0x813af7,_0xcdf1('0x11'));_0xa26a5e(_0x537c5a['result'][_0xcdf1('0x15')]);}})['catch'](function(_0x2d899c){logger[_0xcdf1('0x14')](_0xcdf1('0x10'),_0x813af7,_0x2d899c);_0x27099e(_0x2d899c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index a9e6009..bf02ead 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 _0xecd6=['length','dashboard:','./dashboard.events','save','remove','update','emit','removeListener','register'];(function(_0x5b3e0a,_0x23ae42){var _0x12bcd0=function(_0xb48058){while(--_0xb48058){_0x5b3e0a['push'](_0x5b3e0a['shift']());}};_0x12bcd0(++_0x23ae42);}(_0xecd6,0xd1));var _0x6ecd=function(_0x40443c,_0x368f22){_0x40443c=_0x40443c-0x0;var _0x30078d=_0xecd6[_0x40443c];return _0x30078d;};'use strict';var DashboardEvents=require(_0x6ecd('0x0'));var events=[_0x6ecd('0x1'),_0x6ecd('0x2'),_0x6ecd('0x3')];function createListener(_0x289826,_0x18c6b2){return function(_0x3141b8){_0x18c6b2[_0x6ecd('0x4')](_0x289826,_0x3141b8);};}function removeListener(_0x3ecceb,_0x114208){return function(){DashboardEvents[_0x6ecd('0x5')](_0x3ecceb,_0x114208);};}exports[_0x6ecd('0x6')]=function(_0x573e22){for(var _0x67acd8=0x0,_0x37e7f6=events[_0x6ecd('0x7')];_0x67acd8<_0x37e7f6;_0x67acd8++){var _0x482b42=events[_0x67acd8];var _0x2b8707=createListener(_0x6ecd('0x8')+_0x482b42,_0x573e22);DashboardEvents['on'](_0x482b42,_0x2b8707);}}; \ No newline at end of file +var _0x05f0=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener','length'];(function(_0x29d63a,_0x41634b){var _0x585d57=function(_0x5ba8b4){while(--_0x5ba8b4){_0x29d63a['push'](_0x29d63a['shift']());}};_0x585d57(++_0x41634b);}(_0x05f0,0x179));var _0x005f=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0x05f0[_0x5d5bcb];return _0x4ea5eb;};'use strict';var DashboardEvents=require(_0x005f('0x0'));var events=[_0x005f('0x1'),_0x005f('0x2'),_0x005f('0x3')];function createListener(_0x44fcc2,_0x2281be){return function(_0x1feb13){_0x2281be[_0x005f('0x4')](_0x44fcc2,_0x1feb13);};}function removeListener(_0x5ab2ad,_0x38ec02){return function(){DashboardEvents[_0x005f('0x5')](_0x5ab2ad,_0x38ec02);};}exports['register']=function(_0x4743a7){for(var _0x5a5952=0x0,_0x217f98=events[_0x005f('0x6')];_0x5a5952<_0x217f98;_0x5a5952++){var _0x5af1c9=events[_0x5a5952];var _0x2e4ba1=createListener(_0x005f('0x7')+_0x5af1c9,_0x4743a7);DashboardEvents['on'](_0x5af1c9,_0x2e4ba1);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5880677..1d8bcf5 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 _0xd9ec=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./dashboard.controller','get','isAuthenticated','index','/:id','getItems','create','post','/:id/clone','/:id/items','update','destroy'];(function(_0x1af5b2,_0x1b82fe){var _0xf1aa2d=function(_0x2ceae2){while(--_0x2ceae2){_0x1af5b2['push'](_0x1af5b2['shift']());}};_0xf1aa2d(++_0x1b82fe);}(_0xd9ec,0x10b));var _0xcd9e=function(_0x3da7cf,_0x2631b2){_0x3da7cf=_0x3da7cf-0x0;var _0x41febf=_0xd9ec[_0x3da7cf];return _0x41febf;};'use strict';var multer=require('multer');var util=require(_0xcd9e('0x0'));var path=require('path');var timeout=require(_0xcd9e('0x1'));var express=require(_0xcd9e('0x2'));var router=express[_0xcd9e('0x3')]();var fs_extra=require(_0xcd9e('0x4'));var auth=require(_0xcd9e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcd9e('0x6'));router[_0xcd9e('0x7')]('/',auth[_0xcd9e('0x8')](),controller[_0xcd9e('0x9')]);router['get'](_0xcd9e('0xa'),auth[_0xcd9e('0x8')](),controller['show']);router[_0xcd9e('0x7')]('/:id/items',auth[_0xcd9e('0x8')](),controller[_0xcd9e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcd9e('0xc')]);router[_0xcd9e('0xd')](_0xcd9e('0xe'),auth[_0xcd9e('0x8')](),controller['clone']);router['post'](_0xcd9e('0xf'),auth['isAuthenticated'](),controller['addItem']);router['put'](_0xcd9e('0xa'),auth[_0xcd9e('0x8')](),controller[_0xcd9e('0x10')]);router['delete'](_0xcd9e('0xa'),auth[_0xcd9e('0x8')](),controller[_0xcd9e('0x11')]);module[_0xcd9e('0x12')]=router; \ No newline at end of file +var _0x2e77=['./dashboard.controller','isAuthenticated','get','/:id','show','/:id/items','post','create','clone','addItem','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xad1d34,_0x5a748b){var _0x4e4701=function(_0x2209cc){while(--_0x2209cc){_0xad1d34['push'](_0xad1d34['shift']());}};_0x4e4701(++_0x5a748b);}(_0x2e77,0x159));var _0x72e7=function(_0x1bc35e,_0x4095be){_0x1bc35e=_0x1bc35e-0x0;var _0x22cd9f=_0x2e77[_0x1bc35e];return _0x22cd9f;};'use strict';var multer=require(_0x72e7('0x0'));var util=require(_0x72e7('0x1'));var path=require(_0x72e7('0x2'));var timeout=require(_0x72e7('0x3'));var express=require('express');var router=express[_0x72e7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x72e7('0x5'));var interaction=require(_0x72e7('0x6'));var config=require('../../config/environment');var controller=require(_0x72e7('0x7'));router['get']('/',auth[_0x72e7('0x8')](),controller['index']);router[_0x72e7('0x9')](_0x72e7('0xa'),auth[_0x72e7('0x8')](),controller[_0x72e7('0xb')]);router[_0x72e7('0x9')](_0x72e7('0xc'),auth[_0x72e7('0x8')](),controller['getItems']);router[_0x72e7('0xd')]('/',auth[_0x72e7('0x8')](),controller[_0x72e7('0xe')]);router[_0x72e7('0xd')]('/:id/clone',auth[_0x72e7('0x8')](),controller[_0x72e7('0xf')]);router[_0x72e7('0xd')](_0x72e7('0xc'),auth[_0x72e7('0x8')](),controller[_0x72e7('0x10')]);router[_0x72e7('0x11')](_0x72e7('0xa'),auth[_0x72e7('0x8')](),controller[_0x72e7('0x12')]);router[_0x72e7('0x13')]('/:id',auth[_0x72e7('0x8')](),controller[_0x72e7('0x14')]);module[_0x72e7('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 6322367..7792d1d 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 _0x2a07=['setDataValue','stringify','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x573fdf,_0x16cc8f){var _0x269299=function(_0x1c34cc){while(--_0x1c34cc){_0x573fdf['push'](_0x573fdf['shift']());}};_0x269299(++_0x16cc8f);}(_0x2a07,0x74));var _0x72a0=function(_0x6c823,_0x3f5e35){_0x6c823=_0x6c823-0x0;var _0x1fda1b=_0x2a07[_0x6c823];return _0x1fda1b;};'use strict';var Sequelize=require(_0x72a0('0x0'));var squel=require(_0x72a0('0x1'));var _=require(_0x72a0('0x2'));module[_0x72a0('0x3')]={'title':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x72a0('0x5')](_0x72a0('0x6')),'get':function(){try{return JSON[_0x72a0('0x7')](this[_0x72a0('0x8')](_0x72a0('0x9')));}catch(_0xce74c){return[];}},'set':function(_0x3ccf6d){try{this[_0x72a0('0xa')](_0x72a0('0x9'),JSON[_0x72a0('0xb')](_0x3ccf6d));}catch(_0x21c819){this[_0x72a0('0xa')](_0x72a0('0x9'),JSON[_0x72a0('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x72a0('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x72a0('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x72a0('0xc')]},'background':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![],'defaultValue':_0x72a0('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x72a0('0x4')]},'titleFontSize':{'type':Sequelize[_0x72a0('0xc')],'defaultValue':0xc}}; \ No newline at end of file +var _0x2ef3=['parse','attrs','stringify','setDataValue','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','long'];(function(_0x14b792,_0x4b4c7f){var _0x1f9eb0=function(_0x46699b){while(--_0x46699b){_0x14b792['push'](_0x14b792['shift']());}};_0x1f9eb0(++_0x4b4c7f);}(_0x2ef3,0xba));var _0x32ef=function(_0x43fbea,_0x20a528){_0x43fbea=_0x43fbea-0x0;var _0x3174bd=_0x2ef3[_0x43fbea];return _0x3174bd;};'use strict';var Sequelize=require(_0x32ef('0x0'));var squel=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));module[_0x32ef('0x3')]={'title':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x32ef('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x32ef('0x5')),'get':function(){try{return JSON[_0x32ef('0x6')](this['getDataValue'](_0x32ef('0x7')));}catch(_0x37dd1d){return[];}},'set':function(_0x4c8104){try{this['setDataValue'](_0x32ef('0x7'),JSON[_0x32ef('0x8')](_0x4c8104));}catch(_0x367c39){this[_0x32ef('0x9')](_0x32ef('0x7'),JSON[_0x32ef('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x32ef('0xa')]},'col':{'type':Sequelize[_0x32ef('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![],'defaultValue':_0x32ef('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x32ef('0x4')]},'titleFontSize':{'type':Sequelize[_0x32ef('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 cbea9cc..3909e48 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 _0x8d0a=['attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','show','keys','DashboardItem','rawAttributes','query','filters','intersection','model','attributes','length','include','merge','options','find','catch','params','iframe','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType'];(function(_0x306636,_0x406bd4){var _0x301589=function(_0x574931){while(--_0x574931){_0x306636['push'](_0x306636['shift']());}};_0x301589(++_0x406bd4);}(_0x8d0a,0x65));var _0xa8d0=function(_0x3402eb,_0x3780f3){_0x3402eb=_0x3402eb-0x0;var _0x5ed4b4=_0x8d0a[_0x3402eb];return _0x5ed4b4;};'use strict';var emlformat=require(_0xa8d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa8d0('0x1'));var jsonpatch=require(_0xa8d0('0x2'));var rp=require(_0xa8d0('0x3'));var moment=require(_0xa8d0('0x4'));var BPromise=require(_0xa8d0('0x5'));var Mustache=require(_0xa8d0('0x6'));var util=require(_0xa8d0('0x7'));var path=require(_0xa8d0('0x8'));var sox=require(_0xa8d0('0x9'));var csv=require('to-csv');var ejs=require(_0xa8d0('0xa'));var fs=require('fs');var fs_extra=require(_0xa8d0('0xb'));var _=require(_0xa8d0('0xc'));var squel=require(_0xa8d0('0xd'));var crypto=require(_0xa8d0('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa8d0('0xf'));var querystring=require(_0xa8d0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa8d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa8d0('0x12'));var logger=require(_0xa8d0('0x13'))(_0xa8d0('0x14'));var utils=require(_0xa8d0('0x15'));var config=require(_0xa8d0('0x16'));var licenseUtil=require(_0xa8d0('0x17'));var db=require(_0xa8d0('0x18'))['db'];config[_0xa8d0('0x19')]=_[_0xa8d0('0x1a')](config[_0xa8d0('0x19')],{'host':_0xa8d0('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa8d0('0x19')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x32ea3e,_0x2816d1){_0x2816d1=_0x2816d1||0xcc;return function(_0x523ec0){if(_0x523ec0){return _0x32ea3e[_0xa8d0('0x1c')](_0x2816d1);}return _0x32ea3e[_0xa8d0('0x1d')](_0x2816d1)[_0xa8d0('0x1e')]();};}function respondWithResult(_0x44a48e,_0x10ec3c){_0x10ec3c=_0x10ec3c||0xc8;return function(_0x3a5fe3){if(_0x3a5fe3){return _0x44a48e['status'](_0x10ec3c)[_0xa8d0('0x1f')](_0x3a5fe3);}};}function respondWithFilteredResult(_0x470b4a,_0x5cf619){return function(_0x2f0b00){if(_0x2f0b00){var _0x1e325a=typeof _0x5cf619['offset']===_0xa8d0('0x20')&&typeof _0x5cf619[_0xa8d0('0x21')]==='undefined';var _0x582a54=_0x2f0b00[_0xa8d0('0x22')];var _0x25ed8d=_0x1e325a?0x0:_0x5cf619['offset'];var _0x38d600=_0x1e325a?_0x2f0b00[_0xa8d0('0x22')]:_0x5cf619[_0xa8d0('0x23')]+_0x5cf619['limit'];var _0x36891d;if(_0x38d600>=_0x582a54){_0x38d600=_0x582a54;_0x36891d=0xc8;}else{_0x36891d=0xce;}_0x470b4a['status'](_0x36891d);return _0x470b4a[_0xa8d0('0x24')](_0xa8d0('0x25'),_0x25ed8d+'-'+_0x38d600+'/'+_0x582a54)[_0xa8d0('0x1f')](_0x2f0b00);}return null;};}function patchUpdates(_0x27c798){return function(_0x92d065){try{jsonpatch[_0xa8d0('0x26')](_0x92d065,_0x27c798,!![]);}catch(_0x41667d){return BPromise['reject'](_0x41667d);}return _0x92d065['save']();};}function saveUpdates(_0x265dce,_0x486422){return function(_0x3ec672){if(_0x3ec672){return _0x3ec672[_0xa8d0('0x27')](_0x265dce)[_0xa8d0('0x28')](function(_0x1ddb63){return _0x1ddb63;});}return null;};}function removeEntity(_0x17bdfc,_0x5b9560){return function(_0x3eab24){if(_0x3eab24){return _0x3eab24[_0xa8d0('0x29')]()[_0xa8d0('0x28')](function(){_0x17bdfc[_0xa8d0('0x1d')](0xcc)[_0xa8d0('0x1e')]();});}};}function handleEntityNotFound(_0x1adc0d,_0x80390d){return function(_0x28ba73){if(!_0x28ba73){_0x1adc0d['sendStatus'](0x194);}return _0x28ba73;};}function handleError(_0x195dae,_0xc7761d){_0xc7761d=_0xc7761d||0x1f4;return function(_0xd7943a){logger[_0xa8d0('0x2a')](_0xd7943a[_0xa8d0('0x2b')]);if(_0xd7943a[_0xa8d0('0x2c')]){delete _0xd7943a['name'];}_0x195dae[_0xa8d0('0x1d')](_0xc7761d)[_0xa8d0('0x2d')](_0xd7943a);};}exports[_0xa8d0('0x2e')]=function(_0x78777c,_0x4c46fc){var _0x2d3725={'raw':![],'where':{'id':_0x78777c['params']['id']}},_0x385e05={};_0x385e05['model']=_[_0xa8d0('0x2f')](db[_0xa8d0('0x30')][_0xa8d0('0x31')]);_0x385e05[_0xa8d0('0x32')]=_[_0xa8d0('0x2f')](_0x78777c[_0xa8d0('0x32')]);_0x385e05[_0xa8d0('0x33')]=_[_0xa8d0('0x34')](_0x385e05[_0xa8d0('0x35')],_0x385e05[_0xa8d0('0x32')]);_0x2d3725[_0xa8d0('0x36')]=_[_0xa8d0('0x34')](_0x385e05['model'],qs['fields'](_0x78777c[_0xa8d0('0x32')]['fields']));_0x2d3725[_0xa8d0('0x36')]=_0x2d3725[_0xa8d0('0x36')][_0xa8d0('0x37')]?_0x2d3725[_0xa8d0('0x36')]:_0x385e05[_0xa8d0('0x35')];if(_0x78777c['query']['includeAll']){_0x2d3725[_0xa8d0('0x38')]=[{'all':!![]}];}_0x2d3725=_[_0xa8d0('0x39')]({},_0x2d3725,_0x78777c[_0xa8d0('0x3a')]);return db[_0xa8d0('0x30')][_0xa8d0('0x3b')](_0x2d3725)[_0xa8d0('0x28')](handleEntityNotFound(_0x4c46fc,null))['then'](respondWithResult(_0x4c46fc,null))[_0xa8d0('0x3c')](handleError(_0x4c46fc,null));};exports[_0xa8d0('0x29')]=function(_0x41fc4e,_0x4d175c){return db[_0xa8d0('0x30')][_0xa8d0('0x3b')]({'where':{'id':_0x41fc4e[_0xa8d0('0x3d')]['id']}})[_0xa8d0('0x28')](handleEntityNotFound(_0x4d175c,null))[_0xa8d0('0x28')](removeEntity(_0x4d175c,null))[_0xa8d0('0x3c')](handleError(_0x4d175c,null));};function widgetAttributes(_0x27515e){try{switch(_0x27515e['type']){case _0xa8d0('0x3e'):return[{'name':_0xa8d0('0x3f'),'value':_0x27515e[_0xa8d0('0x3f')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x0]?_0x27515e[_0xa8d0('0x40')][0x0]['value']:undefined)||_0xa8d0('0x41')}];case _0xa8d0('0x42'):return[{'name':_0xa8d0('0x43'),'value':_0x27515e[_0xa8d0('0x43')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x0]?_0x27515e[_0xa8d0('0x40')][0x0][_0xa8d0('0x44')]:undefined)||''}];case'clock':return[{'name':_0xa8d0('0x45'),'value':_0x27515e['attrHourFormat']||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x0]?_0x27515e[_0xa8d0('0x40')][0x0][_0xa8d0('0x44')]:undefined)||_0xa8d0('0x46')},{'name':_0xa8d0('0x47'),'value':_0x27515e[_0xa8d0('0x47')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x1]?_0x27515e[_0xa8d0('0x40')][0x1][_0xa8d0('0x44')]:undefined)||_0xa8d0('0x48')},{'name':'attrFontSize','value':_0x27515e[_0xa8d0('0x49')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x2]?_0x27515e[_0xa8d0('0x40')][0x2][_0xa8d0('0x44')]:undefined)||0xc}];case _0xa8d0('0x4a'):return[{'name':'attrMetric','value':_0x27515e[_0xa8d0('0x4b')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x0]?_0x27515e[_0xa8d0('0x40')][0x0][_0xa8d0('0x44')]:undefined)||_0xa8d0('0x4c')},{'name':_0xa8d0('0x4d'),'value':_0x27515e[_0xa8d0('0x4d')]||(_0x27515e['attrs']&&_0x27515e[_0xa8d0('0x40')][0x1]?_0x27515e['attrs'][0x1][_0xa8d0('0x44')]:undefined)||[]},{'name':_0xa8d0('0x49'),'value':_0x27515e[_0xa8d0('0x49')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e['attrs'][0x2]?_0x27515e[_0xa8d0('0x40')][0x2][_0xa8d0('0x44')]:undefined)||0x14},{'name':'attrChannel','value':_0x27515e[_0xa8d0('0x4e')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x3]?_0x27515e['attrs'][0x3]['value']:undefined)||_0xa8d0('0x4f')},{'name':_0xa8d0('0x50'),'value':_0x27515e[_0xa8d0('0x50')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e['attrs'][0x4]?_0x27515e[_0xa8d0('0x40')][0x4][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x51'),'value':_0x27515e[_0xa8d0('0x51')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e['attrs'][0x5]?_0x27515e[_0xa8d0('0x40')][0x5]['value']:undefined)||''},{'name':_0xa8d0('0x52'),'value':_0x27515e[_0xa8d0('0x52')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e['attrs'][0x6]?_0x27515e[_0xa8d0('0x40')][0x6][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x53'),'value':_0x27515e[_0xa8d0('0x53')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e['attrs'][0x7]?_0x27515e[_0xa8d0('0x40')][0x7][_0xa8d0('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x27515e[_0xa8d0('0x54')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x8]?_0x27515e[_0xa8d0('0x40')][0x8][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x55'),'value':_0x27515e[_0xa8d0('0x55')]||(_0x27515e['attrs']&&_0x27515e[_0xa8d0('0x40')][0x9]?_0x27515e['attrs'][0x9]['value']:undefined)||''}];case _0xa8d0('0x56'):case _0xa8d0('0x57'):return[{'name':'attrSerie1','value':_0x27515e[_0xa8d0('0x58')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x0]?_0x27515e[_0xa8d0('0x40')][0x0][_0xa8d0('0x44')]:undefined)||'total'},{'name':_0xa8d0('0x59'),'value':_0x27515e[_0xa8d0('0x59')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x1]?_0x27515e[_0xa8d0('0x40')][0x1][_0xa8d0('0x44')]:undefined)||null},{'name':'attrSerie3','value':_0x27515e[_0xa8d0('0x5a')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x2]?_0x27515e['attrs'][0x2][_0xa8d0('0x44')]:undefined)||null},{'name':_0xa8d0('0x4d'),'value':_0x27515e[_0xa8d0('0x4d')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x3]?_0x27515e[_0xa8d0('0x40')][0x3][_0xa8d0('0x44')]:undefined)||[]},{'name':_0xa8d0('0x4e'),'value':_0x27515e[_0xa8d0('0x4e')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x4]?_0x27515e[_0xa8d0('0x40')][0x4][_0xa8d0('0x44')]:undefined)||'voice'},{'name':_0xa8d0('0x50'),'value':_0x27515e['attrEmailAccounts']||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e['attrs'][0x5]?_0x27515e['attrs'][0x5][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x51'),'value':_0x27515e[_0xa8d0('0x51')]||(_0x27515e['attrs']&&_0x27515e['attrs'][0x6]?_0x27515e[_0xa8d0('0x40')][0x6][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x52'),'value':_0x27515e['attrSmsAccounts']||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x7]?_0x27515e[_0xa8d0('0x40')][0x7][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x53'),'value':_0x27515e[_0xa8d0('0x53')]||(_0x27515e['attrs']&&_0x27515e[_0xa8d0('0x40')][0x8]?_0x27515e[_0xa8d0('0x40')][0x8][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x54'),'value':_0x27515e[_0xa8d0('0x54')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x9]?_0x27515e[_0xa8d0('0x40')][0x9][_0xa8d0('0x44')]:undefined)||''},{'name':_0xa8d0('0x55'),'value':_0x27515e['attrChatWebsites']||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0xa]?_0x27515e['attrs'][0xa][_0xa8d0('0x44')]:undefined)||''}];case'web-report':return[{'name':_0xa8d0('0x5b'),'type':_0x27515e[_0xa8d0('0x5c')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x0]?_0x27515e['attrs'][0x0]['type']:undefined)||null,'value':_0x27515e[_0xa8d0('0x5b')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x0]?_0x27515e[_0xa8d0('0x40')][0x0][_0xa8d0('0x44')]:undefined)||null},{'name':_0xa8d0('0x5d'),'value':_0x27515e[_0xa8d0('0x5d')]||(_0x27515e[_0xa8d0('0x40')]&&_0x27515e[_0xa8d0('0x40')][0x1]?_0x27515e['attrs'][0x1][_0xa8d0('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x995725){logger[_0xa8d0('0x2a')](_0xa8d0('0x5e'),JSON['stringify'](_0x995725));return[];}}exports[_0xa8d0('0x5f')]=function(_0xf40c7a,_0x25bf63){if(_0xf40c7a[_0xa8d0('0x60')]){_0xf40c7a['body'][_0xa8d0('0x40')]=widgetAttributes(_0xf40c7a[_0xa8d0('0x60')]);}return db[_0xa8d0('0x30')]['create'](_0xf40c7a[_0xa8d0('0x60')],{})[_0xa8d0('0x28')](respondWithResult(_0x25bf63,0xc9))[_0xa8d0('0x3c')](handleError(_0x25bf63,null));};exports[_0xa8d0('0x27')]=function(_0x25d600,_0x54f15d){if(_0x25d600[_0xa8d0('0x60')]['id']){delete _0x25d600[_0xa8d0('0x60')]['id'];}_0x25d600['body'][_0xa8d0('0x40')]=widgetAttributes(_0x25d600[_0xa8d0('0x60')]);return db[_0xa8d0('0x30')][_0xa8d0('0x3b')]({'where':{'id':_0x25d600[_0xa8d0('0x3d')]['id']}})[_0xa8d0('0x28')](handleEntityNotFound(_0x54f15d,null))[_0xa8d0('0x28')](saveUpdates(_0x25d600['body'],null))[_0xa8d0('0x28')](respondWithResult(_0x54f15d,null))[_0xa8d0('0x3c')](handleError(_0x54f15d,null));}; \ No newline at end of file +var _0x1261=['offset','undefined','set','Content-Range','json','apply','reject','update','then','destroy','error','name','show','model','keys','DashboardItem','query','filters','intersection','fields','attributes','length','include','merge','options','catch','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','attrTimezone','counter','attrMetric','attrVoiceQueues','attrFontSize','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie3','attrChannel','web-report','type','attrReport','attrRefresh','widgetAttributes:\x20%s','body','create','params','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','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','end','status'];(function(_0x24aff9,_0x479f13){var _0x53f9b1=function(_0x2346da){while(--_0x2346da){_0x24aff9['push'](_0x24aff9['shift']());}};_0x53f9b1(++_0x479f13);}(_0x1261,0x144));var _0x1126=function(_0x225d44,_0x399b52){_0x225d44=_0x225d44-0x0;var _0x4aa98a=_0x1261[_0x225d44];return _0x4aa98a;};'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'];config[_0x1126('0x18')]=_[_0x1126('0x19')](config[_0x1126('0x18')],{'host':_0x1126('0x1a'),'port':0x18eb});var socket=require(_0x1126('0x1b'))(new Redis(config[_0x1126('0x18')]));require(_0x1126('0x1c'))['register'](socket);function respondWithStatusCode(_0x5de9a7,_0x1af673){_0x1af673=_0x1af673||0xcc;return function(_0x154e20){if(_0x154e20){return _0x5de9a7[_0x1126('0x1d')](_0x1af673);}return _0x5de9a7['status'](_0x1af673)[_0x1126('0x1e')]();};}function respondWithResult(_0x4794a7,_0x35fe9f){_0x35fe9f=_0x35fe9f||0xc8;return function(_0x42f379){if(_0x42f379){return _0x4794a7[_0x1126('0x1f')](_0x35fe9f)['json'](_0x42f379);}};}function respondWithFilteredResult(_0x245cd7,_0x1695f6){return function(_0x4a7b49){if(_0x4a7b49){var _0x4d2b38=typeof _0x1695f6[_0x1126('0x20')]===_0x1126('0x21')&&typeof _0x1695f6['limit']==='undefined';var _0x4564c0=_0x4a7b49['count'];var _0x22ed37=_0x4d2b38?0x0:_0x1695f6[_0x1126('0x20')];var _0x2f70ac=_0x4d2b38?_0x4a7b49['count']:_0x1695f6[_0x1126('0x20')]+_0x1695f6['limit'];var _0x56efeb;if(_0x2f70ac>=_0x4564c0){_0x2f70ac=_0x4564c0;_0x56efeb=0xc8;}else{_0x56efeb=0xce;}_0x245cd7[_0x1126('0x1f')](_0x56efeb);return _0x245cd7[_0x1126('0x22')](_0x1126('0x23'),_0x22ed37+'-'+_0x2f70ac+'/'+_0x4564c0)[_0x1126('0x24')](_0x4a7b49);}return null;};}function patchUpdates(_0x526ca1){return function(_0x29ab60){try{jsonpatch[_0x1126('0x25')](_0x29ab60,_0x526ca1,!![]);}catch(_0x48a08d){return BPromise[_0x1126('0x26')](_0x48a08d);}return _0x29ab60['save']();};}function saveUpdates(_0x529dd9,_0x4b57ab){return function(_0x2199d9){if(_0x2199d9){return _0x2199d9[_0x1126('0x27')](_0x529dd9)[_0x1126('0x28')](function(_0x34bcf1){return _0x34bcf1;});}return null;};}function removeEntity(_0x566c09,_0x1b07a7){return function(_0xea0971){if(_0xea0971){return _0xea0971[_0x1126('0x29')]()['then'](function(){_0x566c09[_0x1126('0x1f')](0xcc)[_0x1126('0x1e')]();});}};}function handleEntityNotFound(_0xa293f4,_0x5ddf63){return function(_0x541bc9){if(!_0x541bc9){_0xa293f4[_0x1126('0x1d')](0x194);}return _0x541bc9;};}function handleError(_0x39bf0e,_0x55e195){_0x55e195=_0x55e195||0x1f4;return function(_0x2fb797){logger[_0x1126('0x2a')](_0x2fb797['stack']);if(_0x2fb797[_0x1126('0x2b')]){delete _0x2fb797['name'];}_0x39bf0e[_0x1126('0x1f')](_0x55e195)['send'](_0x2fb797);};}exports[_0x1126('0x2c')]=function(_0x583ce6,_0x378f4d){var _0x5f2611={'raw':![],'where':{'id':_0x583ce6['params']['id']}},_0x5252e0={};_0x5252e0[_0x1126('0x2d')]=_[_0x1126('0x2e')](db[_0x1126('0x2f')]['rawAttributes']);_0x5252e0[_0x1126('0x30')]=_[_0x1126('0x2e')](_0x583ce6['query']);_0x5252e0[_0x1126('0x31')]=_[_0x1126('0x32')](_0x5252e0[_0x1126('0x2d')],_0x5252e0[_0x1126('0x30')]);_0x5f2611['attributes']=_['intersection'](_0x5252e0[_0x1126('0x2d')],qs[_0x1126('0x33')](_0x583ce6[_0x1126('0x30')][_0x1126('0x33')]));_0x5f2611['attributes']=_0x5f2611[_0x1126('0x34')][_0x1126('0x35')]?_0x5f2611[_0x1126('0x34')]:_0x5252e0[_0x1126('0x2d')];if(_0x583ce6[_0x1126('0x30')]['includeAll']){_0x5f2611[_0x1126('0x36')]=[{'all':!![]}];}_0x5f2611=_[_0x1126('0x37')]({},_0x5f2611,_0x583ce6[_0x1126('0x38')]);return db[_0x1126('0x2f')]['find'](_0x5f2611)['then'](handleEntityNotFound(_0x378f4d,null))[_0x1126('0x28')](respondWithResult(_0x378f4d,null))[_0x1126('0x39')](handleError(_0x378f4d,null));};exports['destroy']=function(_0xde37cf,_0xf3c21b){return db[_0x1126('0x2f')]['find']({'where':{'id':_0xde37cf['params']['id']}})[_0x1126('0x28')](handleEntityNotFound(_0xf3c21b,null))[_0x1126('0x28')](removeEntity(_0xf3c21b,null))[_0x1126('0x39')](handleError(_0xf3c21b,null));};function widgetAttributes(_0x156554){try{switch(_0x156554['type']){case _0x1126('0x3a'):return[{'name':'attrUrl','value':_0x156554[_0x1126('0x3b')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x3d')]:undefined)||'https://'}];case _0x1126('0x3e'):return[{'name':_0x1126('0x3f'),'value':_0x156554[_0x1126('0x3f')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x3d')]:undefined)||''}];case'clock':return[{'name':_0x1126('0x40'),'value':_0x156554[_0x1126('0x40')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x1126('0x41'),'value':_0x156554[_0x1126('0x41')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x1]?_0x156554[_0x1126('0x3c')][0x1][_0x1126('0x3d')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x156554['attrFontSize']||(_0x156554[_0x1126('0x3c')]&&_0x156554['attrs'][0x2]?_0x156554[_0x1126('0x3c')][0x2][_0x1126('0x3d')]:undefined)||0xc}];case _0x1126('0x42'):return[{'name':_0x1126('0x43'),'value':_0x156554['attrMetric']||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x3d')]:undefined)||'total'},{'name':_0x1126('0x44'),'value':_0x156554['attrVoiceQueues']||(_0x156554[_0x1126('0x3c')]&&_0x156554['attrs'][0x1]?_0x156554[_0x1126('0x3c')][0x1][_0x1126('0x3d')]:undefined)||[]},{'name':_0x1126('0x45'),'value':_0x156554['attrFontSize']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x2]?_0x156554[_0x1126('0x3c')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x156554['attrChannel']||(_0x156554[_0x1126('0x3c')]&&_0x156554['attrs'][0x3]?_0x156554[_0x1126('0x3c')][0x3]['value']:undefined)||_0x1126('0x46')},{'name':_0x1126('0x47'),'value':_0x156554[_0x1126('0x47')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x4]?_0x156554['attrs'][0x4][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x48'),'value':_0x156554['attrFaxAccounts']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x5]?_0x156554['attrs'][0x5][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x49'),'value':_0x156554['attrSmsAccounts']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x6]?_0x156554[_0x1126('0x3c')][0x6]['value']:undefined)||''},{'name':_0x1126('0x4a'),'value':_0x156554[_0x1126('0x4a')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x7]?_0x156554[_0x1126('0x3c')][0x7][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x4b'),'value':_0x156554[_0x1126('0x4b')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x8]?_0x156554['attrs'][0x8][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x4c'),'value':_0x156554['attrChatWebsites']||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x9]?_0x156554[_0x1126('0x3c')][0x9][_0x1126('0x3d')]:undefined)||''}];case'multibar-chart':case _0x1126('0x4d'):return[{'name':_0x1126('0x4e'),'value':_0x156554[_0x1126('0x4e')]||(_0x156554[_0x1126('0x3c')]&&_0x156554['attrs'][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x3d')]:undefined)||'total'},{'name':'attrSerie2','value':_0x156554['attrSerie2']||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x1]?_0x156554[_0x1126('0x3c')][0x1]['value']:undefined)||null},{'name':_0x1126('0x4f'),'value':_0x156554[_0x1126('0x4f')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x2]?_0x156554[_0x1126('0x3c')][0x2]['value']:undefined)||null},{'name':_0x1126('0x44'),'value':_0x156554[_0x1126('0x44')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x3]?_0x156554[_0x1126('0x3c')][0x3][_0x1126('0x3d')]:undefined)||[]},{'name':_0x1126('0x50'),'value':_0x156554[_0x1126('0x50')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x4]?_0x156554['attrs'][0x4][_0x1126('0x3d')]:undefined)||_0x1126('0x46')},{'name':_0x1126('0x47'),'value':_0x156554['attrEmailAccounts']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x5]?_0x156554['attrs'][0x5][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x48'),'value':_0x156554[_0x1126('0x48')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x6]?_0x156554[_0x1126('0x3c')][0x6][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x49'),'value':_0x156554[_0x1126('0x49')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x7]?_0x156554[_0x1126('0x3c')][0x7]['value']:undefined)||''},{'name':_0x1126('0x4a'),'value':_0x156554[_0x1126('0x4a')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x8]?_0x156554[_0x1126('0x3c')][0x8]['value']:undefined)||''},{'name':_0x1126('0x4b'),'value':_0x156554[_0x1126('0x4b')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x9]?_0x156554['attrs'][0x9][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x4c'),'value':_0x156554['attrChatWebsites']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0xa]?_0x156554[_0x1126('0x3c')][0xa]['value']:undefined)||''}];case _0x1126('0x51'):return[{'name':'attrReport','type':_0x156554['reportType']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x52')]:undefined)||null,'value':_0x156554[_0x1126('0x53')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554['attrs'][0x0][_0x1126('0x3d')]:undefined)||null},{'name':_0x1126('0x54'),'value':_0x156554[_0x1126('0x54')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x1]?_0x156554[_0x1126('0x3c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5b17d6){logger[_0x1126('0x2a')](_0x1126('0x55'),JSON['stringify'](_0x5b17d6));return[];}}exports['create']=function(_0x5e9260,_0x51a28d){if(_0x5e9260[_0x1126('0x56')]){_0x5e9260[_0x1126('0x56')][_0x1126('0x3c')]=widgetAttributes(_0x5e9260['body']);}return db[_0x1126('0x2f')][_0x1126('0x57')](_0x5e9260[_0x1126('0x56')],{})[_0x1126('0x28')](respondWithResult(_0x51a28d,0xc9))[_0x1126('0x39')](handleError(_0x51a28d,null));};exports[_0x1126('0x27')]=function(_0x131056,_0x49a0a3){if(_0x131056[_0x1126('0x56')]['id']){delete _0x131056[_0x1126('0x56')]['id'];}_0x131056[_0x1126('0x56')][_0x1126('0x3c')]=widgetAttributes(_0x131056[_0x1126('0x56')]);return db['DashboardItem']['find']({'where':{'id':_0x131056[_0x1126('0x58')]['id']}})[_0x1126('0x28')](handleEntityNotFound(_0x49a0a3,null))['then'](saveUpdates(_0x131056[_0x1126('0x56')],null))[_0x1126('0x28')](respondWithResult(_0x49a0a3,null))[_0x1126('0x39')](handleError(_0x49a0a3,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 9cf3513..8d5a2eb 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 _0xac9a=['../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x3109e6,_0x3e0450){var _0x12aed5=function(_0x492ec2){while(--_0x492ec2){_0x3109e6['push'](_0x3109e6['shift']());}};_0x12aed5(++_0x3e0450);}(_0xac9a,0x131));var _0xaac9=function(_0x3a1c15,_0x102335){_0x3a1c15=_0x3a1c15-0x0;var _0x1aa072=_0xac9a[_0x3a1c15];return _0x1aa072;};'use strict';var EventEmitter=require(_0xaac9('0x0'));var DashboardItem=require(_0xaac9('0x1'))['db'][_0xaac9('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xaac9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaac9('0x4'),'afterDestroy':_0xaac9('0x5')};function emitEvent(_0x55bf00){return function(_0x4601b9,_0x226bf7,_0x23938e){DashboardItemEvents[_0xaac9('0x6')](_0x55bf00+':'+_0x4601b9['id'],_0x4601b9);DashboardItemEvents[_0xaac9('0x6')](_0x55bf00,_0x4601b9);_0x23938e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xaac9('0x7')](e,emitEvent(event));}}module[_0xaac9('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x140e=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0xdae6b9,_0x370831){var _0x4f7567=function(_0x2b96b6){while(--_0x2b96b6){_0xdae6b9['push'](_0xdae6b9['shift']());}};_0x4f7567(++_0x370831);}(_0x140e,0xea));var _0xe140=function(_0x4f5b8c,_0x17f8d8){_0x4f5b8c=_0x4f5b8c-0x0;var _0x592a7b=_0x140e[_0x4f5b8c];return _0x592a7b;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xe140('0x0'))['db'][_0xe140('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe140('0x2')](0x0);var events={'afterCreate':_0xe140('0x3'),'afterUpdate':_0xe140('0x4'),'afterDestroy':_0xe140('0x5')};function emitEvent(_0x15e998){return function(_0x59a505,_0x32b90b,_0x1ea51d){DashboardItemEvents['emit'](_0x15e998+':'+_0x59a505['id'],_0x59a505);DashboardItemEvents[_0xe140('0x6')](_0x15e998,_0x59a505);_0x1ea51d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xe140('0x7')](e,emitEvent(event));}}module[_0xe140('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 3b70f7e..0bc9356 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 _0x0032=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','util','../../config/logger','api','moment'];(function(_0x1f7a18,_0x5cd917){var _0xc0d8f5=function(_0x1a94b1){while(--_0x1a94b1){_0x1f7a18['push'](_0x1f7a18['shift']());}};_0xc0d8f5(++_0x5cd917);}(_0x0032,0x127));var _0x2003=function(_0xe094f2,_0x45e7ad){_0xe094f2=_0xe094f2-0x0;var _0x4f45d4=_0x0032[_0xe094f2];return _0x4f45d4;};'use strict';var _=require('lodash');var util=require(_0x2003('0x0'));var logger=require(_0x2003('0x1'))(_0x2003('0x2'));var moment=require(_0x2003('0x3'));var BPromise=require(_0x2003('0x4'));var rp=require(_0x2003('0x5'));var fs=require('fs');var path=require(_0x2003('0x6'));var rimraf=require(_0x2003('0x7'));var config=require(_0x2003('0x8'));var attributes=require(_0x2003('0x9'));module[_0x2003('0xa')]=function(_0x380641,_0x37c01a){return _0x380641[_0x2003('0xb')](_0x2003('0xc'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa204=['path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items','util','../../config/logger','api','bluebird'];(function(_0x14ab6e,_0x567125){var _0x67bd15=function(_0x2e1128){while(--_0x2e1128){_0x14ab6e['push'](_0x14ab6e['shift']());}};_0x67bd15(++_0x567125);}(_0xa204,0xb7));var _0x4a20=function(_0x4e946a,_0x50f6e8){_0x4e946a=_0x4e946a-0x0;var _0x8550b2=_0xa204[_0x4e946a];return _0x8550b2;};'use strict';var _=require('lodash');var util=require(_0x4a20('0x0'));var logger=require(_0x4a20('0x1'))(_0x4a20('0x2'));var moment=require('moment');var BPromise=require(_0x4a20('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a20('0x4'));var rimraf=require(_0x4a20('0x5'));var config=require(_0x4a20('0x6'));var attributes=require(_0x4a20('0x7'));module['exports']=function(_0x31eb77,_0x556a37){return _0x31eb77[_0x4a20('0x8')](_0x4a20('0x9'),attributes,{'tableName':_0x4a20('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 f3ca41a..5ebae43 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 _0xca29=['bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment'];(function(_0x113833,_0x52ada0){var _0x3c544f=function(_0x17478f){while(--_0x17478f){_0x113833['push'](_0x113833['shift']());}};_0x3c544f(++_0x52ada0);}(_0xca29,0x1c8));var _0x9ca2=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0xca29[_0x339129];return _0x1570df;};'use strict';var _=require(_0x9ca2('0x0'));var util=require(_0x9ca2('0x1'));var moment=require(_0x9ca2('0x2'));var BPromise=require(_0x9ca2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ca2('0x4'));var db=require(_0x9ca2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9ca2('0x6'));var config=require(_0x9ca2('0x7'));var jayson=require(_0x9ca2('0x8'));var client=jayson[_0x9ca2('0x9')][_0x9ca2('0xa')]({'port':0x232a});config[_0x9ca2('0xb')]=_[_0x9ca2('0xc')](config['redis'],{'host':_0x9ca2('0xd'),'port':0x18eb});var socket=require(_0x9ca2('0xe'))(new Redis(config[_0x9ca2('0xb')]));require(_0x9ca2('0xf'))['register'](socket);function respondWithRpcPromise(_0x2f4245,_0x29e765,_0x413b5d){return new BPromise(function(_0x8cfe56,_0x5808e8){return client[_0x9ca2('0x10')](_0x2f4245,_0x413b5d)[_0x9ca2('0x11')](function(_0x38329f){logger[_0x9ca2('0x12')](_0x9ca2('0x13'),_0x29e765,'request\x20sent');logger[_0x9ca2('0x14')](_0x9ca2('0x15'),_0x29e765,_0x9ca2('0x16'),JSON[_0x9ca2('0x17')](_0x38329f));if(_0x38329f[_0x9ca2('0x18')]){if(_0x38329f[_0x9ca2('0x18')][_0x9ca2('0x19')]===0x1f4){logger[_0x9ca2('0x18')]('DashboardItem,\x20%s,\x20%s',_0x29e765,_0x38329f['error'][_0x9ca2('0x1a')]);return _0x5808e8(_0x38329f[_0x9ca2('0x18')]['message']);}logger['error'](_0x9ca2('0x13'),_0x29e765,_0x38329f[_0x9ca2('0x18')][_0x9ca2('0x1a')]);return _0x8cfe56(_0x38329f['error']['message']);}else{logger[_0x9ca2('0x12')](_0x9ca2('0x13'),_0x29e765,'request\x20sent');_0x8cfe56(_0x38329f['result'][_0x9ca2('0x1a')]);}})['catch'](function(_0x4e5d0a){logger[_0x9ca2('0x18')](_0x9ca2('0x13'),_0x29e765,_0x4e5d0a);_0x5808e8(_0x4e5d0a);});});} \ No newline at end of file +var _0x1f59=['rpc','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x32646f,_0x42824e){var _0x4f169f=function(_0x3d48bb){while(--_0x3d48bb){_0x32646f['push'](_0x32646f['shift']());}};_0x4f169f(++_0x42824e);}(_0x1f59,0x67));var _0x91f5=function(_0x52c28f,_0x317791){_0x52c28f=_0x52c28f-0x0;var _0x3daa4a=_0x1f59[_0x52c28f];return _0x3daa4a;};'use strict';var _=require(_0x91f5('0x0'));var util=require(_0x91f5('0x1'));var moment=require(_0x91f5('0x2'));var BPromise=require(_0x91f5('0x3'));var rs=require(_0x91f5('0x4'));var fs=require('fs');var Redis=require(_0x91f5('0x5'));var db=require(_0x91f5('0x6'))['db'];var utils=require(_0x91f5('0x7'));var logger=require(_0x91f5('0x8'))(_0x91f5('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x91f5('0xa')]['http']({'port':0x232a});config['redis']=_[_0x91f5('0xb')](config[_0x91f5('0xc')],{'host':_0x91f5('0xd'),'port':0x18eb});var socket=require(_0x91f5('0xe'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x91f5('0xf')](socket);function respondWithRpcPromise(_0x5f1ad3,_0x1a55e1,_0x3faf13){return new BPromise(function(_0x5d959c,_0x5d1cad){return client[_0x91f5('0x10')](_0x5f1ad3,_0x3faf13)[_0x91f5('0x11')](function(_0xc41897){logger[_0x91f5('0x12')](_0x91f5('0x13'),_0x1a55e1,_0x91f5('0x14'));logger[_0x91f5('0x15')](_0x91f5('0x16'),_0x1a55e1,_0x91f5('0x14'),JSON[_0x91f5('0x17')](_0xc41897));if(_0xc41897[_0x91f5('0x18')]){if(_0xc41897[_0x91f5('0x18')][_0x91f5('0x19')]===0x1f4){logger[_0x91f5('0x18')](_0x91f5('0x13'),_0x1a55e1,_0xc41897[_0x91f5('0x18')][_0x91f5('0x1a')]);return _0x5d1cad(_0xc41897[_0x91f5('0x18')][_0x91f5('0x1a')]);}logger[_0x91f5('0x18')](_0x91f5('0x13'),_0x1a55e1,_0xc41897[_0x91f5('0x18')]['message']);return _0x5d959c(_0xc41897['error'][_0x91f5('0x1a')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x1a55e1,'request\x20sent');_0x5d959c(_0xc41897['result'][_0x91f5('0x1a')]);}})[_0x91f5('0x1b')](function(_0xe7d695){logger[_0x91f5('0x18')](_0x91f5('0x13'),_0x1a55e1,_0xe7d695);_0x5d1cad(_0xe7d695);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index c79d957..9af7549 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 _0x0e25=['emit','removeListener','register','dashboardItem:','save','remove','update'];(function(_0x6caa47,_0x3c5940){var _0xd0a60a=function(_0x408931){while(--_0x408931){_0x6caa47['push'](_0x6caa47['shift']());}};_0xd0a60a(++_0x3c5940);}(_0x0e25,0x107));var _0x50e2=function(_0x25b65e,_0x4d0a81){_0x25b65e=_0x25b65e-0x0;var _0x4fffb0=_0x0e25[_0x25b65e];return _0x4fffb0;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x50e2('0x0'),_0x50e2('0x1'),_0x50e2('0x2')];function createListener(_0x32e738,_0x551d72){return function(_0x50158c){_0x551d72[_0x50e2('0x3')](_0x32e738,_0x50158c);};}function removeListener(_0x326759,_0x2b4ec1){return function(){DashboardItemEvents[_0x50e2('0x4')](_0x326759,_0x2b4ec1);};}exports[_0x50e2('0x5')]=function(_0x3e6bc8){for(var _0x511569=0x0,_0x1ff017=events['length'];_0x511569<_0x1ff017;_0x511569++){var _0x440d23=events[_0x511569];var _0x11d8fb=createListener(_0x50e2('0x6')+_0x440d23,_0x3e6bc8);DashboardItemEvents['on'](_0x440d23,_0x11d8fb);}}; \ No newline at end of file +var _0xa4e0=['length','dashboardItem:','./dashboardItem.events','save','update','emit','removeListener','register'];(function(_0x27c4b8,_0x114101){var _0x1c3671=function(_0x1adfb9){while(--_0x1adfb9){_0x27c4b8['push'](_0x27c4b8['shift']());}};_0x1c3671(++_0x114101);}(_0xa4e0,0x1b2));var _0x0a4e=function(_0x41caac,_0x50c421){_0x41caac=_0x41caac-0x0;var _0x28d2ba=_0xa4e0[_0x41caac];return _0x28d2ba;};'use strict';var DashboardItemEvents=require(_0x0a4e('0x0'));var events=[_0x0a4e('0x1'),'remove',_0x0a4e('0x2')];function createListener(_0x150e12,_0x4bf8f5){return function(_0x21dfc3){_0x4bf8f5[_0x0a4e('0x3')](_0x150e12,_0x21dfc3);};}function removeListener(_0x249c91,_0x411c32){return function(){DashboardItemEvents[_0x0a4e('0x4')](_0x249c91,_0x411c32);};}exports[_0x0a4e('0x5')]=function(_0x33a452){for(var _0x37bf40=0x0,_0x4ad405=events[_0x0a4e('0x6')];_0x37bf40<_0x4ad405;_0x37bf40++){var _0x319178=events[_0x37bf40];var _0x2fafb2=createListener(_0x0a4e('0x7')+_0x319178,_0x33a452);DashboardItemEvents['on'](_0x319178,_0x2fafb2);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1208f21..503eb35 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 _0x78f6=['post','create','put','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0x4e376b,_0x3b823b){var _0x1f1474=function(_0x1fd7f8){while(--_0x1fd7f8){_0x4e376b['push'](_0x4e376b['shift']());}};_0x1f1474(++_0x3b823b);}(_0x78f6,0x83));var _0x678f=function(_0x37d621,_0x1a4481){_0x37d621=_0x37d621-0x0;var _0x5038e3=_0x78f6[_0x37d621];return _0x5038e3;};'use strict';var multer=require('multer');var util=require(_0x678f('0x0'));var path=require('path');var timeout=require(_0x678f('0x1'));var express=require(_0x678f('0x2'));var router=express[_0x678f('0x3')]();var fs_extra=require(_0x678f('0x4'));var auth=require(_0x678f('0x5'));var interaction=require(_0x678f('0x6'));var config=require(_0x678f('0x7'));var controller=require(_0x678f('0x8'));router[_0x678f('0x9')](_0x678f('0xa'),auth[_0x678f('0xb')](),controller[_0x678f('0xc')]);router[_0x678f('0xd')]('/',auth[_0x678f('0xb')](),controller[_0x678f('0xe')]);router[_0x678f('0xf')](_0x678f('0xa'),auth[_0x678f('0xb')](),controller['update']);router[_0x678f('0x10')](_0x678f('0xa'),auth[_0x678f('0xb')](),controller['destroy']);module[_0x678f('0x11')]=router; \ No newline at end of file +var _0xc74c=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports'];(function(_0x52565a,_0x18e624){var _0x55b78e=function(_0x54cb00){while(--_0x54cb00){_0x52565a['push'](_0x52565a['shift']());}};_0x55b78e(++_0x18e624);}(_0xc74c,0x1a9));var _0xcc74=function(_0x5eb750,_0x42146f){_0x5eb750=_0x5eb750-0x0;var _0xa8e5d7=_0xc74c[_0x5eb750];return _0xa8e5d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcc74('0x0'));var timeout=require('connect-timeout');var express=require(_0xcc74('0x1'));var router=express[_0xcc74('0x2')]();var fs_extra=require(_0xcc74('0x3'));var auth=require(_0xcc74('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcc74('0x5'));var controller=require(_0xcc74('0x6'));router[_0xcc74('0x7')](_0xcc74('0x8'),auth[_0xcc74('0x9')](),controller[_0xcc74('0xa')]);router[_0xcc74('0xb')]('/',auth[_0xcc74('0x9')](),controller[_0xcc74('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xcc74('0xd')]);router[_0xcc74('0xe')](_0xcc74('0x8'),auth[_0xcc74('0x9')](),controller[_0xcc74('0xf')]);module[_0xcc74('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 9e9d540..91d264b 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 _0xfd49=['third','sequelize','exports','STRING','ENUM','first','second'];(function(_0x4ae11a,_0x5c3910){var _0x1ab0ec=function(_0x309364){while(--_0x309364){_0x4ae11a['push'](_0x4ae11a['shift']());}};_0x1ab0ec(++_0x5c3910);}(_0xfd49,0x1c8));var _0x9fd4=function(_0x56bcf7,_0x4c440b){_0x56bcf7=_0x56bcf7-0x0;var _0xad1ba0=_0xfd49[_0x56bcf7];return _0xad1ba0;};'use strict';var Sequelize=require(_0x9fd4('0x0'));module[_0x9fd4('0x1')]={'name':{'type':Sequelize[_0x9fd4('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x9fd4('0x3')](_0x9fd4('0x4'),_0x9fd4('0x5'),_0x9fd4('0x6')),'allowNull':![],'defaultValue':_0x9fd4('0x4')},'description':{'type':Sequelize[_0x9fd4('0x2')]}}; \ No newline at end of file +var _0x7977=['ENUM','first','second','third','exports','STRING'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0x7977,0x8e));var _0x7797=function(_0x4e29f1,_0x3da155){_0x4e29f1=_0x4e29f1-0x0;var _0x4bc72f=_0x7977[_0x4e29f1];return _0x4bc72f;};'use strict';var Sequelize=require('sequelize');module[_0x7797('0x0')]={'name':{'type':Sequelize[_0x7797('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x7797('0x2')](_0x7797('0x3'),_0x7797('0x4'),_0x7797('0x5')),'allowNull':![],'defaultValue':_0x7797('0x3')},'description':{'type':Sequelize[_0x7797('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 7ac578b..d8865aa 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 _0x889d=['query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','include','findAll','rows','catch','keys','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','get','Dispositions','UserProfileResource','stack','name','index','Disposition','rawAttributes','type','key','model','map'];(function(_0x2dd9e9,_0x4c9263){var _0x471a59=function(_0x4884ab){while(--_0x4884ab){_0x2dd9e9['push'](_0x2dd9e9['shift']());}};_0x471a59(++_0x4c9263);}(_0x889d,0x179));var _0xd889=function(_0x3b0e76,_0x239221){_0x3b0e76=_0x3b0e76-0x0;var _0x1e4af4=_0x889d[_0x3b0e76];return _0x1e4af4;};'use strict';var emlformat=require(_0xd889('0x0'));var rimraf=require(_0xd889('0x1'));var zipdir=require(_0xd889('0x2'));var jsonpatch=require(_0xd889('0x3'));var rp=require(_0xd889('0x4'));var moment=require(_0xd889('0x5'));var BPromise=require(_0xd889('0x6'));var Mustache=require(_0xd889('0x7'));var util=require(_0xd889('0x8'));var path=require(_0xd889('0x9'));var sox=require(_0xd889('0xa'));var csv=require(_0xd889('0xb'));var ejs=require(_0xd889('0xc'));var fs=require('fs');var fs_extra=require(_0xd889('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd889('0xe'));var jsforce=require(_0xd889('0xf'));var deskjs=require(_0xd889('0x10'));var toCsv=require(_0xd889('0xb'));var querystring=require(_0xd889('0x11'));var Papa=require(_0xd889('0x12'));var Redis=require('ioredis');var authService=require(_0xd889('0x13'));var qs=require(_0xd889('0x14'));var as=require(_0xd889('0x15'));var hardwareService=require(_0xd889('0x16'));var logger=require(_0xd889('0x17'))('api');var utils=require(_0xd889('0x18'));var config=require(_0xd889('0x19'));var licenseUtil=require(_0xd889('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a76d1,_0x2783d8){_0x2783d8=_0x2783d8||0xcc;return function(_0x5a2264){if(_0x5a2264){return _0x1a76d1[_0xd889('0x1b')](_0x2783d8);}return _0x1a76d1[_0xd889('0x1c')](_0x2783d8)[_0xd889('0x1d')]();};}function respondWithResult(_0x5818f1,_0x1a3598){_0x1a3598=_0x1a3598||0xc8;return function(_0x55eb92){if(_0x55eb92){return _0x5818f1[_0xd889('0x1c')](_0x1a3598)[_0xd889('0x1e')](_0x55eb92);}};}function respondWithFilteredResult(_0x4b720d,_0x5ba55d){return function(_0x5379be){if(_0x5379be){var _0x41fe0e=typeof _0x5ba55d[_0xd889('0x1f')]==='undefined'&&typeof _0x5ba55d[_0xd889('0x20')]===_0xd889('0x21');var _0x536ba0=_0x5379be[_0xd889('0x22')];var _0x48c3eb=_0x41fe0e?0x0:_0x5ba55d[_0xd889('0x1f')];var _0x3d3ca7=_0x41fe0e?_0x5379be[_0xd889('0x22')]:_0x5ba55d[_0xd889('0x1f')]+_0x5ba55d[_0xd889('0x20')];var _0x1b4cf7;if(_0x3d3ca7>=_0x536ba0){_0x3d3ca7=_0x536ba0;_0x1b4cf7=0xc8;}else{_0x1b4cf7=0xce;}_0x4b720d['status'](_0x1b4cf7);return _0x4b720d[_0xd889('0x23')]('Content-Range',_0x48c3eb+'-'+_0x3d3ca7+'/'+_0x536ba0)[_0xd889('0x1e')](_0x5379be);}return null;};}function patchUpdates(_0x16cde3){return function(_0x18ee92){try{jsonpatch[_0xd889('0x24')](_0x18ee92,_0x16cde3,!![]);}catch(_0x369d52){return BPromise['reject'](_0x369d52);}return _0x18ee92[_0xd889('0x25')]();};}function saveUpdates(_0x38a578,_0x2349af){return function(_0x575074){if(_0x575074){return _0x575074[_0xd889('0x26')](_0x38a578)[_0xd889('0x27')](function(_0x579119){return _0x579119;});}return null;};}function removeEntity(_0x599592,_0x51e6bf){return function(_0x5548f1){if(_0x5548f1){return _0x5548f1[_0xd889('0x28')]()[_0xd889('0x27')](function(){var _0x1d1429=_0x5548f1[_0xd889('0x29')]({'plain':!![]});var _0xc2068e=_0xd889('0x2a');return db[_0xd889('0x2b')][_0xd889('0x28')]({'where':{'type':_0xc2068e,'resourceId':_0x1d1429['id']}})['then'](function(){return _0x5548f1;});})['then'](function(){_0x599592[_0xd889('0x1c')](0xcc)[_0xd889('0x1d')]();});}};}function handleEntityNotFound(_0x4f2289,_0xe3cf7e){return function(_0x323791){if(!_0x323791){_0x4f2289[_0xd889('0x1b')](0x194);}return _0x323791;};}function handleError(_0x2d3a01,_0x592898){_0x592898=_0x592898||0x1f4;return function(_0x130765){logger['error'](_0x130765[_0xd889('0x2c')]);if(_0x130765[_0xd889('0x2d')]){delete _0x130765['name'];}_0x2d3a01[_0xd889('0x1c')](_0x592898)['send'](_0x130765);};}exports[_0xd889('0x2e')]=function(_0x2cfd71,_0x423bf0){var _0x29bbbf={},_0x2db50d={},_0xe0aa0b={'count':0x0,'rows':[]};var _0x150200=_['map'](db[_0xd889('0x2f')][_0xd889('0x30')],function(_0x18a059){return{'name':_0x18a059['fieldName'],'type':_0x18a059[_0xd889('0x31')][_0xd889('0x32')]};});_0x2db50d[_0xd889('0x33')]=_[_0xd889('0x34')](_0x150200,_0xd889('0x2d'));_0x2db50d[_0xd889('0x35')]=_['keys'](_0x2cfd71[_0xd889('0x35')]);_0x2db50d['filters']=_['intersection'](_0x2db50d[_0xd889('0x33')],_0x2db50d['query']);_0x29bbbf[_0xd889('0x36')]=_[_0xd889('0x37')](_0x2db50d['model'],qs[_0xd889('0x38')](_0x2cfd71[_0xd889('0x35')][_0xd889('0x38')]));_0x29bbbf[_0xd889('0x36')]=_0x29bbbf['attributes'][_0xd889('0x39')]?_0x29bbbf[_0xd889('0x36')]:_0x2db50d[_0xd889('0x33')];if(!_0x2cfd71[_0xd889('0x35')][_0xd889('0x3a')](_0xd889('0x3b'))){_0x29bbbf[_0xd889('0x20')]=qs[_0xd889('0x20')](_0x2cfd71[_0xd889('0x35')]['limit']);_0x29bbbf[_0xd889('0x1f')]=qs[_0xd889('0x1f')](_0x2cfd71['query']['offset']);}_0x29bbbf[_0xd889('0x3c')]=qs[_0xd889('0x3d')](_0x2cfd71[_0xd889('0x35')][_0xd889('0x3d')]);_0x29bbbf[_0xd889('0x3e')]=qs['filters'](_[_0xd889('0x3f')](_0x2cfd71['query'],_0x2db50d[_0xd889('0x40')]),_0x150200);if(_0x2cfd71[_0xd889('0x35')][_0xd889('0x41')]){_0x29bbbf[_0xd889('0x3e')]=_['merge'](_0x29bbbf['where'],{'$or':_[_0xd889('0x34')](_0x150200,function(_0x43ca4d){if(_0x43ca4d[_0xd889('0x31')]!==_0xd889('0x42')){var _0x51ca3c={};_0x51ca3c[_0x43ca4d[_0xd889('0x2d')]]={'$like':'%'+_0x2cfd71[_0xd889('0x35')][_0xd889('0x41')]+'%'};return _0x51ca3c;}})});}_0x29bbbf=_[_0xd889('0x43')]({},_0x29bbbf,_0x2cfd71['options']);var _0x50e1bf={'where':_0x29bbbf[_0xd889('0x3e')]};return db[_0xd889('0x2f')][_0xd889('0x22')](_0x50e1bf)[_0xd889('0x27')](function(_0x5c504c){_0xe0aa0b[_0xd889('0x22')]=_0x5c504c;if(_0x2cfd71[_0xd889('0x35')]['includeAll']){_0x29bbbf[_0xd889('0x44')]=[{'all':!![]}];}return db['Disposition'][_0xd889('0x45')](_0x29bbbf);})[_0xd889('0x27')](function(_0x5875a0){_0xe0aa0b[_0xd889('0x46')]=_0x5875a0;return _0xe0aa0b;})['then'](respondWithFilteredResult(_0x423bf0,_0x29bbbf))[_0xd889('0x47')](handleError(_0x423bf0,null));};exports['show']=function(_0x37d49c,_0x560deb){var _0x2bd4a2={'raw':!![],'where':{'id':_0x37d49c['params']['id']}},_0x584c71={};_0x584c71['model']=_['keys'](db['Disposition'][_0xd889('0x30')]);_0x584c71[_0xd889('0x35')]=_[_0xd889('0x48')](_0x37d49c[_0xd889('0x35')]);_0x584c71['filters']=_[_0xd889('0x37')](_0x584c71[_0xd889('0x33')],_0x584c71['query']);_0x2bd4a2[_0xd889('0x36')]=_[_0xd889('0x37')](_0x584c71[_0xd889('0x33')],qs['fields'](_0x37d49c[_0xd889('0x35')][_0xd889('0x38')]));_0x2bd4a2['attributes']=_0x2bd4a2[_0xd889('0x36')][_0xd889('0x39')]?_0x2bd4a2[_0xd889('0x36')]:_0x584c71[_0xd889('0x33')];if(_0x37d49c[_0xd889('0x35')][_0xd889('0x49')]){_0x2bd4a2[_0xd889('0x44')]=[{'all':!![]}];}_0x2bd4a2=_[_0xd889('0x43')]({},_0x2bd4a2,_0x37d49c[_0xd889('0x4a')]);return db[_0xd889('0x2f')][_0xd889('0x4b')](_0x2bd4a2)['then'](handleEntityNotFound(_0x560deb,null))['then'](respondWithResult(_0x560deb,null))['catch'](handleError(_0x560deb,null));};exports[_0xd889('0x4c')]=function(_0x3d0745,_0x2fcb0d){return db['Disposition'][_0xd889('0x4c')](_0x3d0745[_0xd889('0x4d')],{})['then'](function(_0x312a17){var _0x55da1a=_0x3d0745['user'][_0xd889('0x29')]({'plain':!![]});if(!_0x55da1a)throw new Error(_0xd889('0x4e'));if(_0x55da1a[_0xd889('0x4f')]===_0xd889('0x50')){var _0x39e390=_0x312a17['get']({'plain':!![]});var _0x43d84d=_0xd889('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x43d84d,'userProfileId':_0x55da1a[_0xd889('0x51')]},'raw':!![]})[_0xd889('0x27')](function(_0x10c468){if(_0x10c468&&_0x10c468[_0xd889('0x52')]===0x0){return db['UserProfileResource'][_0xd889('0x4c')]({'name':_0x39e390[_0xd889('0x2d')],'resourceId':_0x39e390['id'],'type':_0x10c468[_0xd889('0x2d')],'sectionId':_0x10c468['id']},{})[_0xd889('0x27')](function(){return _0x312a17;});}else{return _0x312a17;}})[_0xd889('0x47')](function(_0x1e2e21){logger[_0xd889('0x53')](_0xd889('0x54'),_0x1e2e21);throw _0x1e2e21;});}return _0x312a17;})[_0xd889('0x27')](respondWithResult(_0x2fcb0d,0xc9))['catch'](handleError(_0x2fcb0d,null));};exports[_0xd889('0x26')]=function(_0x22e012,_0x9a64fc){if(_0x22e012[_0xd889('0x4d')]['id']){delete _0x22e012['body']['id'];}return db[_0xd889('0x2f')][_0xd889('0x4b')]({'where':{'id':_0x22e012[_0xd889('0x55')]['id']}})[_0xd889('0x27')](handleEntityNotFound(_0x9a64fc,null))['then'](saveUpdates(_0x22e012[_0xd889('0x4d')],null))[_0xd889('0x27')](respondWithResult(_0x9a64fc,null))[_0xd889('0x47')](handleError(_0x9a64fc,null));};exports[_0xd889('0x28')]=function(_0x2ea04f,_0x37c538){return db[_0xd889('0x2f')][_0xd889('0x4b')]({'where':{'id':_0x2ea04f[_0xd889('0x55')]['id']}})['then'](handleEntityNotFound(_0x37c538,null))[_0xd889('0x27')](removeEntity(_0x37c538,null))[_0xd889('0x47')](handleError(_0x37c538,null));}; \ No newline at end of file +var _0x4f0d=['../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','get','Dispositions','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','Disposition','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0xc36d01,_0x3bf1a6){var _0xecb231=function(_0x2fb301){while(--_0x2fb301){_0xc36d01['push'](_0xc36d01['shift']());}};_0xecb231(++_0x3bf1a6);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x592a9d,_0x434abb){_0x592a9d=_0x592a9d-0x0;var _0x59d2b3=_0x4f0d[_0x592a9d];return _0x59d2b3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd4f0('0x0'));var BPromise=require(_0xd4f0('0x1'));var Mustache=require(_0xd4f0('0x2'));var util=require('util');var path=require(_0xd4f0('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd4f0('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4f0('0x5'));var squel=require(_0xd4f0('0x6'));var crypto=require('crypto');var jsforce=require(_0xd4f0('0x7'));var deskjs=require(_0xd4f0('0x8'));var toCsv=require(_0xd4f0('0x9'));var querystring=require(_0xd4f0('0xa'));var Papa=require(_0xd4f0('0xb'));var Redis=require('ioredis');var authService=require(_0xd4f0('0xc'));var qs=require(_0xd4f0('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4f0('0xe'))(_0xd4f0('0xf'));var utils=require('../../config/utils');var config=require(_0xd4f0('0x10'));var licenseUtil=require(_0xd4f0('0x11'));var db=require(_0xd4f0('0x12'))['db'];function respondWithStatusCode(_0x2cd80d,_0x333ea5){_0x333ea5=_0x333ea5||0xcc;return function(_0x4d004f){if(_0x4d004f){return _0x2cd80d[_0xd4f0('0x13')](_0x333ea5);}return _0x2cd80d[_0xd4f0('0x14')](_0x333ea5)[_0xd4f0('0x15')]();};}function respondWithResult(_0x46b4de,_0x2fbeab){_0x2fbeab=_0x2fbeab||0xc8;return function(_0x544936){if(_0x544936){return _0x46b4de[_0xd4f0('0x14')](_0x2fbeab)[_0xd4f0('0x16')](_0x544936);}};}function respondWithFilteredResult(_0x89a7a4,_0x21eb54){return function(_0x44cf9f){if(_0x44cf9f){var _0x2dd02d=typeof _0x21eb54['offset']==='undefined'&&typeof _0x21eb54[_0xd4f0('0x17')]===_0xd4f0('0x18');var _0xff90e=_0x44cf9f[_0xd4f0('0x19')];var _0x4d0dcc=_0x2dd02d?0x0:_0x21eb54['offset'];var _0x122d27=_0x2dd02d?_0x44cf9f[_0xd4f0('0x19')]:_0x21eb54[_0xd4f0('0x1a')]+_0x21eb54[_0xd4f0('0x17')];var _0x7560d6;if(_0x122d27>=_0xff90e){_0x122d27=_0xff90e;_0x7560d6=0xc8;}else{_0x7560d6=0xce;}_0x89a7a4[_0xd4f0('0x14')](_0x7560d6);return _0x89a7a4[_0xd4f0('0x1b')](_0xd4f0('0x1c'),_0x4d0dcc+'-'+_0x122d27+'/'+_0xff90e)[_0xd4f0('0x16')](_0x44cf9f);}return null;};}function patchUpdates(_0x297e3c){return function(_0x5af067){try{jsonpatch[_0xd4f0('0x1d')](_0x5af067,_0x297e3c,!![]);}catch(_0x474c22){return BPromise[_0xd4f0('0x1e')](_0x474c22);}return _0x5af067['save']();};}function saveUpdates(_0x2c2bd5,_0x31c7a0){return function(_0x655480){if(_0x655480){return _0x655480['update'](_0x2c2bd5)[_0xd4f0('0x1f')](function(_0x174e52){return _0x174e52;});}return null;};}function removeEntity(_0xe85527,_0x143aee){return function(_0x4fd650){if(_0x4fd650){return _0x4fd650[_0xd4f0('0x20')]()[_0xd4f0('0x1f')](function(){var _0x9a1fe6=_0x4fd650[_0xd4f0('0x21')]({'plain':!![]});var _0x5f4858=_0xd4f0('0x22');return db['UserProfileResource'][_0xd4f0('0x20')]({'where':{'type':_0x5f4858,'resourceId':_0x9a1fe6['id']}})[_0xd4f0('0x1f')](function(){return _0x4fd650;});})[_0xd4f0('0x1f')](function(){_0xe85527[_0xd4f0('0x14')](0xcc)[_0xd4f0('0x15')]();});}};}function handleEntityNotFound(_0x2f4291,_0x1dd584){return function(_0xe25e57){if(!_0xe25e57){_0x2f4291[_0xd4f0('0x13')](0x194);}return _0xe25e57;};}function handleError(_0x2c1f4f,_0xe2bf28){_0xe2bf28=_0xe2bf28||0x1f4;return function(_0x4ea8aa){logger[_0xd4f0('0x23')](_0x4ea8aa[_0xd4f0('0x24')]);if(_0x4ea8aa[_0xd4f0('0x25')]){delete _0x4ea8aa[_0xd4f0('0x25')];}_0x2c1f4f['status'](_0xe2bf28)[_0xd4f0('0x26')](_0x4ea8aa);};}exports[_0xd4f0('0x27')]=function(_0x401a5b,_0x40da73){var _0x4b8244={},_0x39c44a={},_0x1b074f={'count':0x0,'rows':[]};var _0x132524=_[_0xd4f0('0x28')](db['Disposition'][_0xd4f0('0x29')],function(_0x2cb68f){return{'name':_0x2cb68f[_0xd4f0('0x2a')],'type':_0x2cb68f[_0xd4f0('0x2b')][_0xd4f0('0x2c')]};});_0x39c44a[_0xd4f0('0x2d')]=_[_0xd4f0('0x28')](_0x132524,_0xd4f0('0x25'));_0x39c44a[_0xd4f0('0x2e')]=_[_0xd4f0('0x2f')](_0x401a5b[_0xd4f0('0x2e')]);_0x39c44a['filters']=_[_0xd4f0('0x30')](_0x39c44a[_0xd4f0('0x2d')],_0x39c44a[_0xd4f0('0x2e')]);_0x4b8244[_0xd4f0('0x31')]=_[_0xd4f0('0x30')](_0x39c44a['model'],qs[_0xd4f0('0x32')](_0x401a5b[_0xd4f0('0x2e')]['fields']));_0x4b8244[_0xd4f0('0x31')]=_0x4b8244[_0xd4f0('0x31')][_0xd4f0('0x33')]?_0x4b8244['attributes']:_0x39c44a[_0xd4f0('0x2d')];if(!_0x401a5b['query']['hasOwnProperty']('nolimit')){_0x4b8244[_0xd4f0('0x17')]=qs[_0xd4f0('0x17')](_0x401a5b[_0xd4f0('0x2e')][_0xd4f0('0x17')]);_0x4b8244[_0xd4f0('0x1a')]=qs['offset'](_0x401a5b['query'][_0xd4f0('0x1a')]);}_0x4b8244[_0xd4f0('0x34')]=qs[_0xd4f0('0x35')](_0x401a5b['query'][_0xd4f0('0x35')]);_0x4b8244[_0xd4f0('0x36')]=qs[_0xd4f0('0x37')](_['pick'](_0x401a5b[_0xd4f0('0x2e')],_0x39c44a['filters']),_0x132524);if(_0x401a5b[_0xd4f0('0x2e')][_0xd4f0('0x38')]){_0x4b8244[_0xd4f0('0x36')]=_[_0xd4f0('0x39')](_0x4b8244[_0xd4f0('0x36')],{'$or':_[_0xd4f0('0x28')](_0x132524,function(_0x50904e){if(_0x50904e['type']!==_0xd4f0('0x3a')){var _0x2df381={};_0x2df381[_0x50904e['name']]={'$like':'%'+_0x401a5b[_0xd4f0('0x2e')][_0xd4f0('0x38')]+'%'};return _0x2df381;}})});}_0x4b8244=_[_0xd4f0('0x39')]({},_0x4b8244,_0x401a5b[_0xd4f0('0x3b')]);var _0x29e48f={'where':_0x4b8244[_0xd4f0('0x36')]};return db['Disposition'][_0xd4f0('0x19')](_0x29e48f)[_0xd4f0('0x1f')](function(_0x2e59e4){_0x1b074f[_0xd4f0('0x19')]=_0x2e59e4;if(_0x401a5b[_0xd4f0('0x2e')][_0xd4f0('0x3c')]){_0x4b8244['include']=[{'all':!![]}];}return db[_0xd4f0('0x3d')][_0xd4f0('0x3e')](_0x4b8244);})['then'](function(_0x50ccda){_0x1b074f[_0xd4f0('0x3f')]=_0x50ccda;return _0x1b074f;})[_0xd4f0('0x1f')](respondWithFilteredResult(_0x40da73,_0x4b8244))[_0xd4f0('0x40')](handleError(_0x40da73,null));};exports['show']=function(_0x4af132,_0x43fdc8){var _0x453675={'raw':!![],'where':{'id':_0x4af132[_0xd4f0('0x41')]['id']}},_0xcd831={};_0xcd831[_0xd4f0('0x2d')]=_[_0xd4f0('0x2f')](db[_0xd4f0('0x3d')][_0xd4f0('0x29')]);_0xcd831[_0xd4f0('0x2e')]=_[_0xd4f0('0x2f')](_0x4af132[_0xd4f0('0x2e')]);_0xcd831[_0xd4f0('0x37')]=_[_0xd4f0('0x30')](_0xcd831['model'],_0xcd831[_0xd4f0('0x2e')]);_0x453675['attributes']=_[_0xd4f0('0x30')](_0xcd831['model'],qs[_0xd4f0('0x32')](_0x4af132[_0xd4f0('0x2e')][_0xd4f0('0x32')]));_0x453675['attributes']=_0x453675[_0xd4f0('0x31')][_0xd4f0('0x33')]?_0x453675['attributes']:_0xcd831[_0xd4f0('0x2d')];if(_0x4af132['query'][_0xd4f0('0x3c')]){_0x453675[_0xd4f0('0x42')]=[{'all':!![]}];}_0x453675=_['merge']({},_0x453675,_0x4af132[_0xd4f0('0x3b')]);return db[_0xd4f0('0x3d')][_0xd4f0('0x43')](_0x453675)[_0xd4f0('0x1f')](handleEntityNotFound(_0x43fdc8,null))[_0xd4f0('0x1f')](respondWithResult(_0x43fdc8,null))[_0xd4f0('0x40')](handleError(_0x43fdc8,null));};exports[_0xd4f0('0x44')]=function(_0x42f52d,_0x63d99){return db[_0xd4f0('0x3d')][_0xd4f0('0x44')](_0x42f52d[_0xd4f0('0x45')],{})['then'](function(_0x1426c2){var _0x3cb364=_0x42f52d[_0xd4f0('0x46')][_0xd4f0('0x21')]({'plain':!![]});if(!_0x3cb364)throw new Error(_0xd4f0('0x47'));if(_0x3cb364['role']===_0xd4f0('0x46')){var _0x353f82=_0x1426c2[_0xd4f0('0x21')]({'plain':!![]});var _0x1f5c98=_0xd4f0('0x22');return db[_0xd4f0('0x48')][_0xd4f0('0x43')]({'where':{'name':_0x1f5c98,'userProfileId':_0x3cb364[_0xd4f0('0x49')]},'raw':!![]})[_0xd4f0('0x1f')](function(_0x8b388d){if(_0x8b388d&&_0x8b388d[_0xd4f0('0x4a')]===0x0){return db[_0xd4f0('0x4b')][_0xd4f0('0x44')]({'name':_0x353f82[_0xd4f0('0x25')],'resourceId':_0x353f82['id'],'type':_0x8b388d[_0xd4f0('0x25')],'sectionId':_0x8b388d['id']},{})['then'](function(){return _0x1426c2;});}else{return _0x1426c2;}})[_0xd4f0('0x40')](function(_0x4e3b6f){logger[_0xd4f0('0x23')](_0xd4f0('0x4c'),_0x4e3b6f);throw _0x4e3b6f;});}return _0x1426c2;})[_0xd4f0('0x1f')](respondWithResult(_0x63d99,0xc9))['catch'](handleError(_0x63d99,null));};exports[_0xd4f0('0x4d')]=function(_0xf5e504,_0x486044){if(_0xf5e504[_0xd4f0('0x45')]['id']){delete _0xf5e504[_0xd4f0('0x45')]['id'];}return db[_0xd4f0('0x3d')][_0xd4f0('0x43')]({'where':{'id':_0xf5e504['params']['id']}})[_0xd4f0('0x1f')](handleEntityNotFound(_0x486044,null))['then'](saveUpdates(_0xf5e504[_0xd4f0('0x45')],null))[_0xd4f0('0x1f')](respondWithResult(_0x486044,null))[_0xd4f0('0x40')](handleError(_0x486044,null));};exports[_0xd4f0('0x20')]=function(_0x2c9478,_0x4c663d){return db['Disposition'][_0xd4f0('0x43')]({'where':{'id':_0x2c9478[_0xd4f0('0x41')]['id']}})[_0xd4f0('0x1f')](handleEntityNotFound(_0x4c663d,null))[_0xd4f0('0x1f')](removeEntity(_0x4c663d,null))[_0xd4f0('0x40')](handleError(_0x4c663d,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 63ff176..244509f 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 _0xb724=['name_mail','MailAccountId','name_fax','FaxAccountId','name_whatsapp','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Disposition','tools_dispositions','name','ListId','name_chat'];(function(_0x587f34,_0x2721b5){var _0x157d40=function(_0x14d676){while(--_0x14d676){_0x587f34['push'](_0x587f34['shift']());}};_0x157d40(++_0x2721b5);}(_0xb724,0x1d3));var _0x4b72=function(_0x3c45ff,_0x5054b7){_0x3c45ff=_0x3c45ff-0x0;var _0x2a8756=_0xb724[_0x3c45ff];return _0x2a8756;};'use strict';var _=require('lodash');var util=require(_0x4b72('0x0'));var logger=require(_0x4b72('0x1'))(_0x4b72('0x2'));var moment=require(_0x4b72('0x3'));var BPromise=require(_0x4b72('0x4'));var rp=require(_0x4b72('0x5'));var fs=require('fs');var path=require(_0x4b72('0x6'));var rimraf=require(_0x4b72('0x7'));var config=require(_0x4b72('0x8'));var attributes=require('./disposition.attributes');module[_0x4b72('0x9')]=function(_0x1a3e5a,_0x5858ff){return _0x1a3e5a[_0x4b72('0xa')](_0x4b72('0xb'),attributes,{'tableName':_0x4b72('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x4b72('0xd'),_0x4b72('0xe')]},{'unique':!![],'name':_0x4b72('0xf'),'fields':[_0x4b72('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0x4b72('0x10'),'fields':['name',_0x4b72('0x11')]},{'unique':!![],'name':'name_sms','fields':[_0x4b72('0xd'),'SmsAccountId']},{'unique':!![],'name':_0x4b72('0x12'),'fields':[_0x4b72('0xd'),_0x4b72('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0x4b72('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':_0x4b72('0x14'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb094=['./disposition.attributes','exports','define','Disposition','tools_dispositions','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb094,0xb1));var _0x4b09=function(_0x4199c3,_0x3d2223){_0x4199c3=_0x4199c3-0x0;var _0x3ccdab=_0xb094[_0x4199c3];return _0x3ccdab;};'use strict';var _=require(_0x4b09('0x0'));var util=require(_0x4b09('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4b09('0x2'));var BPromise=require(_0x4b09('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b09('0x4'));var rimraf=require(_0x4b09('0x5'));var config=require(_0x4b09('0x6'));var attributes=require(_0x4b09('0x7'));module[_0x4b09('0x8')]=function(_0x10bf22,_0xc193a8){return _0x10bf22[_0x4b09('0x9')](_0x4b09('0xa'),attributes,{'tableName':_0x4b09('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x4b09('0xc'),_0x4b09('0xd')]},{'unique':!![],'name':_0x4b09('0xe'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0x4b09('0xf'),'fields':['name',_0x4b09('0x10')]},{'unique':!![],'name':_0x4b09('0x11'),'fields':[_0x4b09('0xc'),_0x4b09('0x12')]},{'unique':!![],'name':_0x4b09('0x13'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x4b09('0x14'),'fields':[_0x4b09('0xc'),_0x4b09('0x15')]},{'unique':!![],'name':_0x4b09('0x16'),'fields':[_0x4b09('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 63f8ade..84bc25b 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(_0x474dc0,_0x1993bb){var _0x4d5539=function(_0x1048b6){while(--_0x1048b6){_0x474dc0['push'](_0x474dc0['shift']());}};_0x4d5539(++_0x1993bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x25f63b,_0x151e6f){var _0x150168=function(_0x359477){while(--_0x359477){_0x25f63b['push'](_0x25f63b['shift']());}};_0x150168(++_0x151e6f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 49dccd9..f6be36d 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 _0xaadc=['get','isAuthenticated','index','/:id','post','create','put','update','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller'];(function(_0x2da45d,_0x35397b){var _0x1012a0=function(_0x2babc3){while(--_0x2babc3){_0x2da45d['push'](_0x2da45d['shift']());}};_0x1012a0(++_0x35397b);}(_0xaadc,0x134));var _0xcaad=function(_0xfe8278,_0x2b8e81){_0xfe8278=_0xfe8278-0x0;var _0x213026=_0xaadc[_0xfe8278];return _0x213026;};'use strict';var multer=require('multer');var util=require(_0xcaad('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcaad('0x1'));var router=express[_0xcaad('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xcaad('0x3'));var interaction=require(_0xcaad('0x4'));var config=require(_0xcaad('0x5'));var controller=require(_0xcaad('0x6'));router[_0xcaad('0x7')]('/',auth[_0xcaad('0x8')](),controller[_0xcaad('0x9')]);router[_0xcaad('0x7')](_0xcaad('0xa'),auth[_0xcaad('0x8')](),controller['show']);router[_0xcaad('0xb')]('/',auth[_0xcaad('0x8')](),controller[_0xcaad('0xc')]);router[_0xcaad('0xd')](_0xcaad('0xa'),auth[_0xcaad('0x8')](),controller[_0xcaad('0xe')]);router['delete'](_0xcaad('0xa'),auth[_0xcaad('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5ee9=['update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x275357,_0x126c88){var _0x237d0a=function(_0x3276b8){while(--_0x3276b8){_0x275357['push'](_0x275357['shift']());}};_0x237d0a(++_0x126c88);}(_0x5ee9,0x120));var _0x95ee=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5ee9[_0x5f0089];return _0x193892;};'use strict';var multer=require(_0x95ee('0x0'));var util=require(_0x95ee('0x1'));var path=require(_0x95ee('0x2'));var timeout=require('connect-timeout');var express=require(_0x95ee('0x3'));var router=express['Router']();var fs_extra=require(_0x95ee('0x4'));var auth=require(_0x95ee('0x5'));var interaction=require(_0x95ee('0x6'));var config=require(_0x95ee('0x7'));var controller=require(_0x95ee('0x8'));router[_0x95ee('0x9')]('/',auth[_0x95ee('0xa')](),controller[_0x95ee('0xb')]);router[_0x95ee('0x9')](_0x95ee('0xc'),auth[_0x95ee('0xa')](),controller['show']);router[_0x95ee('0xd')]('/',auth[_0x95ee('0xa')](),controller[_0x95ee('0xe')]);router[_0x95ee('0xf')]('/:id',auth[_0x95ee('0xa')](),controller[_0x95ee('0x10')]);router[_0x95ee('0x11')](_0x95ee('0xc'),auth[_0x95ee('0xa')](),controller['destroy']);module[_0x95ee('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 3f3770c..4cf1f86 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 _0x87b0=['14400','IAX','DADHI','SIP','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','localstationid','2400','4800','9600','12000','7200'];(function(_0x2e27dd,_0x550941){var _0x3f6b81=function(_0x260508){while(--_0x260508){_0x2e27dd['push'](_0x2e27dd['shift']());}};_0x3f6b81(++_0x550941);}(_0x87b0,0x16d));var _0x087b=function(_0x3d5d43,_0x9d65ef){_0x3d5d43=_0x3d5d43-0x0;var _0x54cebc=_0x87b0[_0x3d5d43];return _0x54cebc;};'use strict';var Sequelize=require(_0x087b('0x0'));module['exports']={'name':{'type':Sequelize[_0x087b('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x087b('0x1')]},'ecm':{'type':Sequelize[_0x087b('0x2')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x087b('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x087b('0x1')],'unique':_0x087b('0x3')},'minrate':{'type':Sequelize[_0x087b('0x2')](_0x087b('0x4'),_0x087b('0x5'),'7200',_0x087b('0x6'),_0x087b('0x7'),'14400'),'defaultValue':_0x087b('0x5')},'maxrate':{'type':Sequelize[_0x087b('0x2')](_0x087b('0x4'),_0x087b('0x5'),_0x087b('0x8'),_0x087b('0x6'),'12000','14400'),'defaultValue':_0x087b('0x9')},'modem':{'type':Sequelize[_0x087b('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x087b('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x087b('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x087b('0x2')]('SIP',_0x087b('0xa'),_0x087b('0xb'),'KHOMP'),'defaultValue':_0x087b('0xc')},'key':{'type':Sequelize[_0x087b('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x087b('0xd')],'defaultValue':function(){return _0x087b('0xe');}},'notificationSound':{'type':Sequelize[_0x087b('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x087b('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x087b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x087b('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x087b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x087b('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x087b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x087b('0x10')],'allowNull':!![],'defaultValue':null,'comment':_0x087b('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x087b('0xf')],'defaultValue':![],'comment':_0x087b('0x12'),'set':function(_0x2db430){if(!_0x2db430)this[_0x087b('0x13')](_0x087b('0x14'),null);this[_0x087b('0x13')](_0x087b('0x15'),_0x2db430);}}}; \ No newline at end of file +var _0x689c=['DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','ENUM','yes','STRING','localstationid','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x689c,0xd0));var _0xc689=function(_0x3acef5,_0x33189f){_0x3acef5=_0x3acef5-0x0;var _0x2db9dc=_0x689c[_0x3acef5];return _0x2db9dc;};'use strict';var Sequelize=require(_0xc689('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xc689('0x1')]('yes','no'),'defaultValue':_0xc689('0x2')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xc689('0x3')],'unique':_0xc689('0x4')},'minrate':{'type':Sequelize[_0xc689('0x1')]('2400',_0xc689('0x5'),_0xc689('0x6'),_0xc689('0x7'),_0xc689('0x8'),_0xc689('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xc689('0x1')]('2400',_0xc689('0x5'),_0xc689('0x6'),_0xc689('0x7'),_0xc689('0x8'),_0xc689('0x9')),'defaultValue':_0xc689('0x9')},'modem':{'type':Sequelize[_0xc689('0x3')],'defaultValue':_0xc689('0xa')},'gateway':{'type':Sequelize[_0xc689('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xc689('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xc689('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP','IAX',_0xc689('0xc'),_0xc689('0xd')),'defaultValue':_0xc689('0xe')},'key':{'type':Sequelize[_0xc689('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc689('0xf')],'defaultValue':function(){return _0xc689('0x10');}},'notificationSound':{'type':Sequelize[_0xc689('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc689('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc689('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc689('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc689('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc689('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc689('0xb')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc689('0x11')],'defaultValue':![],'comment':_0xc689('0x12'),'set':function(_0x58cfab){if(!_0x58cfab)this[_0xc689('0x13')](_0xc689('0x14'),null);this['setDataValue'](_0xc689('0x15'),_0x58cfab);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 5baa9ad..f6d1acc 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 _0x254f=['order','sort','filters','pick','filter','where','merge','options','include','findAll','rows','show','params','Pause','keys','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','sendStatus','send','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','transaction','VoiceExtension','bulkCreate','updateAccountApplications','tech','createdAt','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','ListId','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','defaults','redis','socket.io-emitter','register','client','http','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','end','stack','name','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x53bf6c,_0x54f366){var _0x5aae3e=function(_0x5b5993){while(--_0x5b5993){_0x53bf6c['push'](_0x53bf6c['shift']());}};_0x5aae3e(++_0x54f366);}(_0x254f,0x148));var _0xf254=function(_0x305df6,_0x5d09a3){_0x305df6=_0x305df6-0x0;var _0x5dc37d=_0x254f[_0x305df6];return _0x5dc37d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf254('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf254('0x1'));var rp=require(_0xf254('0x2'));var moment=require(_0xf254('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf254('0x4'));var sox=require('sox');var csv=require(_0xf254('0x5'));var ejs=require(_0xf254('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf254('0x7'));var squel=require(_0xf254('0x8'));var crypto=require(_0xf254('0x9'));var jsforce=require(_0xf254('0xa'));var deskjs=require(_0xf254('0xb'));var toCsv=require(_0xf254('0x5'));var querystring=require('querystring');var Papa=require(_0xf254('0xc'));var Redis=require(_0xf254('0xd'));var authService=require(_0xf254('0xe'));var qs=require(_0xf254('0xf'));var as=require(_0xf254('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf254('0x11'))(_0xf254('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xf254('0x13')](config[_0xf254('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xf254('0x15'))(new Redis(config['redis']));require('./faxAccount.socket')[_0xf254('0x16')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf254('0x17')][_0xf254('0x18')]({'port':0x232c});var client9002=jayson[_0xf254('0x17')][_0xf254('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x17100e,_0x1d241d,_0x3c0ad8,_0xa34593){return new BPromise(function(_0x3ad4a0,_0x46cf84){var _0x1d2234=_0xa34593||client;return _0x1d2234['request'](_0x17100e,_0x3c0ad8)[_0xf254('0x19')](function(_0x1dc1c6){logger[_0xf254('0x1a')](_0xf254('0x1b'),_0x1d241d,'request\x20sent');logger[_0xf254('0x1c')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1d241d,_0xf254('0x1d'),JSON[_0xf254('0x1e')](_0x1dc1c6));if(_0x1dc1c6[_0xf254('0x1f')]){if(_0x1dc1c6[_0xf254('0x1f')][_0xf254('0x20')]===0x1f4){logger['error'](_0xf254('0x1b'),_0x1d241d,_0x1dc1c6[_0xf254('0x1f')]['message']);return _0x46cf84(_0x1dc1c6[_0xf254('0x1f')]['message']);}logger[_0xf254('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x1d241d,_0x1dc1c6[_0xf254('0x1f')][_0xf254('0x21')]);return _0x3ad4a0(_0x1dc1c6[_0xf254('0x1f')]['message']);}else{logger['info'](_0xf254('0x1b'),_0x1d241d,_0xf254('0x1d'));_0x3ad4a0(_0x1dc1c6[_0xf254('0x22')][_0xf254('0x21')]);}})[_0xf254('0x23')](function(_0x47ac36){logger['error'](_0xf254('0x1b'),_0x1d241d,_0x47ac36);_0x46cf84(_0x47ac36);});});}function respondWithStatusCode(_0x75bfd3,_0x56512f){_0x56512f=_0x56512f||0xcc;return function(_0x4811c8){if(_0x4811c8){return _0x75bfd3['sendStatus'](_0x56512f);}return _0x75bfd3[_0xf254('0x24')](_0x56512f)['end']();};}function respondWithResult(_0x331313,_0x3af0c1){_0x3af0c1=_0x3af0c1||0xc8;return function(_0x3c69ec){if(_0x3c69ec){return _0x331313[_0xf254('0x24')](_0x3af0c1)[_0xf254('0x25')](_0x3c69ec);}};}function respondWithFilteredResult(_0x11923c,_0x23b9f8){return function(_0x2f079b){if(_0x2f079b){var _0x2f8d0a=typeof _0x23b9f8['offset']===_0xf254('0x26')&&typeof _0x23b9f8[_0xf254('0x27')]==='undefined';var _0x2a13bb=_0x2f079b[_0xf254('0x28')];var _0x37b040=_0x2f8d0a?0x0:_0x23b9f8[_0xf254('0x29')];var _0x3289b5=_0x2f8d0a?_0x2f079b[_0xf254('0x28')]:_0x23b9f8[_0xf254('0x29')]+_0x23b9f8[_0xf254('0x27')];var _0x5d1cc2;if(_0x3289b5>=_0x2a13bb){_0x3289b5=_0x2a13bb;_0x5d1cc2=0xc8;}else{_0x5d1cc2=0xce;}_0x11923c['status'](_0x5d1cc2);return _0x11923c[_0xf254('0x2a')]('Content-Range',_0x37b040+'-'+_0x3289b5+'/'+_0x2a13bb)['json'](_0x2f079b);}return null;};}function patchUpdates(_0x43ef27){return function(_0x52f718){try{jsonpatch[_0xf254('0x2b')](_0x52f718,_0x43ef27,!![]);}catch(_0x30d865){return BPromise[_0xf254('0x2c')](_0x30d865);}return _0x52f718[_0xf254('0x2d')]();};}function saveUpdates(_0x3ee2f4,_0x1ebb82){return function(_0x2107e3){if(_0x2107e3){return _0x2107e3[_0xf254('0x2e')](_0x3ee2f4)[_0xf254('0x19')](function(_0x39de6a){return _0x39de6a;});}return null;};}function removeEntity(_0x158a42,_0x595ef9){return function(_0x106750){if(_0x106750){return _0x106750[_0xf254('0x2f')]()[_0xf254('0x19')](function(){var _0x18316d=_0x106750['get']({'plain':!![]});var _0x1ad139=_0xf254('0x30');return db[_0xf254('0x31')][_0xf254('0x2f')]({'where':{'type':_0x1ad139,'resourceId':_0x18316d['id']}})['then'](function(){return _0x106750;});})['then'](function(){_0x158a42[_0xf254('0x24')](0xcc)[_0xf254('0x32')]();});}};}function handleEntityNotFound(_0x2d2ae8,_0x204d0f){return function(_0x22ef74){if(!_0x22ef74){_0x2d2ae8['sendStatus'](0x194);}return _0x22ef74;};}function handleError(_0x2486ec,_0x286478){_0x286478=_0x286478||0x1f4;return function(_0x1f97d0){logger[_0xf254('0x1f')](_0x1f97d0[_0xf254('0x33')]);if(_0x1f97d0[_0xf254('0x34')]){delete _0x1f97d0[_0xf254('0x34')];}_0x2486ec['status'](_0x286478)['send'](_0x1f97d0);};}exports[_0xf254('0x35')]=function(_0xb5c9e9,_0x2b5c3c){var _0x5f2f7f={'include':[{'model':db['Pause'],'as':_0xf254('0x36')}]},_0x208a09={},_0xdfab8d={'count':0x0,'rows':[]};var _0x4e82ca=_[_0xf254('0x37')](db[_0xf254('0x38')][_0xf254('0x39')],function(_0x41f65c){return{'name':_0x41f65c['fieldName'],'type':_0x41f65c[_0xf254('0x3a')][_0xf254('0x3b')]};});_0x208a09[_0xf254('0x3c')]=_[_0xf254('0x37')](_0x4e82ca,'name');_0x208a09[_0xf254('0x3d')]=_['keys'](_0xb5c9e9[_0xf254('0x3d')]);_0x208a09['filters']=_['intersection'](_0x208a09['model'],_0x208a09[_0xf254('0x3d')]);_0x5f2f7f[_0xf254('0x3e')]=_[_0xf254('0x3f')](_0x208a09[_0xf254('0x3c')],qs[_0xf254('0x40')](_0xb5c9e9[_0xf254('0x3d')]['fields']));_0x5f2f7f[_0xf254('0x3e')]=_0x5f2f7f['attributes'][_0xf254('0x41')]?_0x5f2f7f[_0xf254('0x3e')]:_0x208a09['model'];if(!_0xb5c9e9[_0xf254('0x3d')][_0xf254('0x42')](_0xf254('0x43'))){_0x5f2f7f[_0xf254('0x27')]=qs[_0xf254('0x27')](_0xb5c9e9[_0xf254('0x3d')][_0xf254('0x27')]);_0x5f2f7f['offset']=qs[_0xf254('0x29')](_0xb5c9e9['query'][_0xf254('0x29')]);}_0x5f2f7f[_0xf254('0x44')]=qs[_0xf254('0x45')](_0xb5c9e9[_0xf254('0x3d')][_0xf254('0x45')]);_0x5f2f7f['where']=qs[_0xf254('0x46')](_[_0xf254('0x47')](_0xb5c9e9['query'],_0x208a09[_0xf254('0x46')]),_0x4e82ca);if(_0xb5c9e9[_0xf254('0x3d')][_0xf254('0x48')]){_0x5f2f7f['where']=_['merge'](_0x5f2f7f[_0xf254('0x49')],{'$or':_[_0xf254('0x37')](_0x4e82ca,function(_0x12a688){if(_0x12a688['type']!=='VIRTUAL'){var _0x442c6b={};_0x442c6b[_0x12a688[_0xf254('0x34')]]={'$like':'%'+_0xb5c9e9[_0xf254('0x3d')][_0xf254('0x48')]+'%'};return _0x442c6b;}})});}_0x5f2f7f=_[_0xf254('0x4a')]({},_0x5f2f7f,_0xb5c9e9[_0xf254('0x4b')]);var _0x4b7e82={'where':_0x5f2f7f[_0xf254('0x49')]};return db[_0xf254('0x38')][_0xf254('0x28')](_0x4b7e82)[_0xf254('0x19')](function(_0x35a271){_0xdfab8d[_0xf254('0x28')]=_0x35a271;if(_0xb5c9e9[_0xf254('0x3d')]['includeAll']){_0x5f2f7f[_0xf254('0x4c')]=[{'all':!![]}];}return db[_0xf254('0x38')][_0xf254('0x4d')](_0x5f2f7f);})['then'](function(_0x79d4e0){_0xdfab8d[_0xf254('0x4e')]=_0x79d4e0;return _0xdfab8d;})[_0xf254('0x19')](respondWithFilteredResult(_0x2b5c3c,_0x5f2f7f))['catch'](handleError(_0x2b5c3c,null));};exports[_0xf254('0x4f')]=function(_0x484511,_0x7c6afc){var _0x4e60b3={'raw':![],'where':{'id':_0x484511[_0xf254('0x50')]['id']},'include':[{'model':db[_0xf254('0x51')],'as':_0xf254('0x36')}]},_0x37c5f0={};_0x37c5f0['model']=_[_0xf254('0x52')](db[_0xf254('0x38')][_0xf254('0x39')]);_0x37c5f0['query']=_[_0xf254('0x52')](_0x484511['query']);_0x37c5f0['filters']=_[_0xf254('0x3f')](_0x37c5f0['model'],_0x37c5f0[_0xf254('0x3d')]);_0x4e60b3[_0xf254('0x3e')]=_[_0xf254('0x3f')](_0x37c5f0[_0xf254('0x3c')],qs[_0xf254('0x40')](_0x484511[_0xf254('0x3d')][_0xf254('0x40')]));_0x4e60b3[_0xf254('0x3e')]=_0x4e60b3[_0xf254('0x3e')][_0xf254('0x41')]?_0x4e60b3[_0xf254('0x3e')]:_0x37c5f0[_0xf254('0x3c')];if(_0x484511[_0xf254('0x3d')][_0xf254('0x53')]){_0x4e60b3[_0xf254('0x4c')]=[{'all':!![]}];}_0x4e60b3=_['merge']({},_0x4e60b3,_0x484511[_0xf254('0x4b')]);return db[_0xf254('0x38')]['find'](_0x4e60b3)[_0xf254('0x19')](handleEntityNotFound(_0x7c6afc,null))[_0xf254('0x19')](respondWithResult(_0x7c6afc,null))[_0xf254('0x23')](handleError(_0x7c6afc,null));};exports[_0xf254('0x54')]=function(_0x13e6f1,_0x418bf7){return db[_0xf254('0x38')]['create'](_0x13e6f1[_0xf254('0x55')],{})[_0xf254('0x19')](function(_0x536983){var _0x47a56a=_0x13e6f1[_0xf254('0x56')][_0xf254('0x57')]({'plain':!![]});if(!_0x47a56a)throw new Error(_0xf254('0x58'));if(_0x47a56a['role']==='user'){var _0xc91104=_0x536983[_0xf254('0x57')]({'plain':!![]});var _0x3f41f5=_0xf254('0x30');return db[_0xf254('0x59')][_0xf254('0x5a')]({'where':{'name':_0x3f41f5,'userProfileId':_0x47a56a[_0xf254('0x5b')]},'raw':!![]})['then'](function(_0x20b251){if(_0x20b251&&_0x20b251[_0xf254('0x5c')]===0x0){return db[_0xf254('0x31')][_0xf254('0x54')]({'name':_0xc91104[_0xf254('0x34')],'resourceId':_0xc91104['id'],'type':_0x20b251['name'],'sectionId':_0x20b251['id']},{})[_0xf254('0x19')](function(){return _0x536983;});}else{return _0x536983;}})[_0xf254('0x23')](function(_0x387241){logger[_0xf254('0x1f')](_0xf254('0x5d'),_0x387241);throw _0x387241;});}return _0x536983;})['then'](respondWithResult(_0x418bf7,0xc9))['catch'](handleError(_0x418bf7,null));};exports[_0xf254('0x2e')]=function(_0x8da653,_0x3a38a){if(_0x8da653[_0xf254('0x55')]['id']){delete _0x8da653[_0xf254('0x55')]['id'];}return db[_0xf254('0x38')][_0xf254('0x5a')]({'where':{'id':_0x8da653['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xf254('0x19')](handleEntityNotFound(_0x3a38a,null))[_0xf254('0x19')](saveUpdates(_0x8da653[_0xf254('0x55')],null))[_0xf254('0x19')](respondWithResult(_0x3a38a,null))[_0xf254('0x23')](handleError(_0x3a38a,null));};exports[_0xf254('0x2f')]=function(_0x1bafaf,_0x43c257){return db[_0xf254('0x38')]['find']({'where':{'id':_0x1bafaf['params']['id']}})['then'](handleEntityNotFound(_0x43c257,null))[_0xf254('0x19')](removeEntity(_0x43c257,null))[_0xf254('0x23')](handleError(_0x43c257,null));};exports[_0xf254('0x5e')]=function(_0xb279f0,_0xa05667){return db[_0xf254('0x38')][_0xf254('0x5e')]()[_0xf254('0x19')](respondWithResult(_0xa05667,null))['catch'](handleError(_0xa05667,null));};exports[_0xf254('0x5f')]=function(_0x277341,_0x8b2620,_0x3781f7){if(_0x277341['body']['id']){delete _0x277341[_0xf254('0x55')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x277341[_0xf254('0x50')]['id']}})['then'](handleEntityNotFound(_0x8b2620,null))[_0xf254('0x19')](function(_0x45026b){if(_0x45026b){_0x277341['body'][_0xf254('0x60')]=_0x45026b['id'];return db['Disposition'][_0xf254('0x54')](_0x277341[_0xf254('0x55')]);}})[_0xf254('0x19')](respondWithResult(_0x8b2620,null))['catch'](handleError(_0x8b2620,null));};exports[_0xf254('0x61')]=function(_0x3aa489,_0x5e364f,_0xcaa8ad){var _0x1d23f2={'raw':![],'where':{}};var _0x91500c={};var _0xeb4419={'count':0x0,'rows':[]};return db[_0xf254('0x38')][_0xf254('0x62')]({'where':{'id':_0x3aa489[_0xf254('0x50')]['id']}})['then'](handleEntityNotFound(_0x5e364f,null))[_0xf254('0x19')](function(_0x146c16){if(_0x146c16){_0x91500c[_0xf254('0x3c')]=_['keys'](db[_0xf254('0x63')][_0xf254('0x39')]);_0x91500c[_0xf254('0x3d')]=_['keys'](_0x3aa489[_0xf254('0x3d')]);_0x91500c[_0xf254('0x46')]=_['intersection'](_0x91500c[_0xf254('0x3c')],_0x91500c[_0xf254('0x3d')]);_0x1d23f2[_0xf254('0x3e')]=_['intersection'](_0x91500c[_0xf254('0x3c')],qs[_0xf254('0x40')](_0x3aa489[_0xf254('0x3d')][_0xf254('0x40')]));_0x1d23f2[_0xf254('0x3e')]=_0x1d23f2[_0xf254('0x3e')][_0xf254('0x41')]?_0x1d23f2[_0xf254('0x3e')]:_0x91500c['model'];if(!_0x3aa489[_0xf254('0x3d')][_0xf254('0x42')](_0xf254('0x43'))){_0x1d23f2[_0xf254('0x27')]=qs[_0xf254('0x27')](_0x3aa489[_0xf254('0x3d')][_0xf254('0x27')]);_0x1d23f2[_0xf254('0x29')]=qs[_0xf254('0x29')](_0x3aa489['query'][_0xf254('0x29')]);}_0x1d23f2[_0xf254('0x44')]=qs[_0xf254('0x45')](_0x3aa489[_0xf254('0x3d')][_0xf254('0x45')]);_0x1d23f2[_0xf254('0x49')]=qs['filters'](_['pick'](_0x3aa489['query'],_0x91500c[_0xf254('0x46')]));_0x1d23f2[_0xf254('0x49')]['FaxAccountId']=_0x146c16['id'];if(_0x3aa489[_0xf254('0x3d')][_0xf254('0x48')]){_0x1d23f2[_0xf254('0x49')]=_['merge'](_0x1d23f2[_0xf254('0x49')],{'$or':_['map'](_0x1d23f2[_0xf254('0x3e')],function(_0x143c2b){var _0x3ad99d={};_0x3ad99d[_0x143c2b]={'$like':'%'+_0x3aa489[_0xf254('0x3d')][_0xf254('0x48')]+'%'};return _0x3ad99d;})});}_0x1d23f2=_[_0xf254('0x4a')]({},_0x1d23f2,_0x3aa489[_0xf254('0x4b')]);return db[_0xf254('0x63')][_0xf254('0x28')]({'where':_0x1d23f2[_0xf254('0x49')]})['then'](function(_0x214388){_0xeb4419[_0xf254('0x28')]=_0x214388;if(_0x3aa489[_0xf254('0x3d')][_0xf254('0x53')]){_0x1d23f2[_0xf254('0x4c')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1d23f2);})[_0xf254('0x19')](function(_0x885e55){_0xeb4419[_0xf254('0x4e')]=_0x885e55;return _0xeb4419;});}})[_0xf254('0x19')](respondWithFilteredResult(_0x5e364f,_0x1d23f2))[_0xf254('0x23')](handleError(_0x5e364f,null));};exports['removeDispositions']=function(_0x471ae3,_0x406a59,_0xee05ff){return db[_0xf254('0x38')][_0xf254('0x5a')]({'where':{'id':_0x471ae3[_0xf254('0x50')]['id']}})[_0xf254('0x19')](handleEntityNotFound(_0x406a59,null))[_0xf254('0x19')](function(_0x125311){if(_0x125311){return _0x125311[_0xf254('0x64')](_0x471ae3[_0xf254('0x3d')][_0xf254('0x65')]);}})[_0xf254('0x19')](respondWithStatusCode(_0x406a59,null))[_0xf254('0x23')](handleError(_0x406a59,null));};exports[_0xf254('0x66')]=function(_0x54dc32,_0x2345e8,_0x507850){if(_0x54dc32[_0xf254('0x55')]['id']){delete _0x54dc32[_0xf254('0x55')]['id'];}return db[_0xf254('0x38')][_0xf254('0x5a')]({'where':{'id':_0x54dc32[_0xf254('0x50')]['id']}})[_0xf254('0x19')](handleEntityNotFound(_0x2345e8,null))[_0xf254('0x19')](function(_0x4c944f){if(_0x4c944f){_0x54dc32[_0xf254('0x55')][_0xf254('0x60')]=_0x4c944f['id'];return db[_0xf254('0x67')][_0xf254('0x54')](_0x54dc32[_0xf254('0x55')]);}})[_0xf254('0x19')](respondWithResult(_0x2345e8,null))[_0xf254('0x23')](handleError(_0x2345e8,null));};exports[_0xf254('0x68')]=function(_0x277a2e,_0x55e778,_0x4ba854){var _0x8167ae={'raw':![],'where':{}};var _0x5096cc={};var _0x5a754e={'count':0x0,'rows':[]};return db['FaxAccount'][_0xf254('0x62')]({'where':{'id':_0x277a2e[_0xf254('0x50')]['id']}})[_0xf254('0x19')](handleEntityNotFound(_0x55e778,null))['then'](function(_0x46c3d2){if(_0x46c3d2){_0x5096cc[_0xf254('0x3c')]=_[_0xf254('0x52')](db[_0xf254('0x67')][_0xf254('0x39')]);_0x5096cc[_0xf254('0x3d')]=_[_0xf254('0x52')](_0x277a2e[_0xf254('0x3d')]);_0x5096cc[_0xf254('0x46')]=_[_0xf254('0x3f')](_0x5096cc[_0xf254('0x3c')],_0x5096cc[_0xf254('0x3d')]);_0x8167ae[_0xf254('0x3e')]=_['intersection'](_0x5096cc[_0xf254('0x3c')],qs[_0xf254('0x40')](_0x277a2e[_0xf254('0x3d')][_0xf254('0x40')]));_0x8167ae[_0xf254('0x3e')]=_0x8167ae['attributes'][_0xf254('0x41')]?_0x8167ae['attributes']:_0x5096cc[_0xf254('0x3c')];if(!_0x277a2e[_0xf254('0x3d')][_0xf254('0x42')](_0xf254('0x43'))){_0x8167ae[_0xf254('0x27')]=qs[_0xf254('0x27')](_0x277a2e[_0xf254('0x3d')][_0xf254('0x27')]);_0x8167ae[_0xf254('0x29')]=qs[_0xf254('0x29')](_0x277a2e['query']['offset']);}_0x8167ae[_0xf254('0x44')]=qs[_0xf254('0x45')](_0x277a2e['query'][_0xf254('0x45')]);_0x8167ae[_0xf254('0x49')]=qs[_0xf254('0x46')](_['pick'](_0x277a2e['query'],_0x5096cc['filters']));_0x8167ae[_0xf254('0x49')][_0xf254('0x60')]=_0x46c3d2['id'];if(_0x277a2e[_0xf254('0x3d')][_0xf254('0x48')]){_0x8167ae[_0xf254('0x49')]=_[_0xf254('0x4a')](_0x8167ae['where'],{'$or':_[_0xf254('0x37')](_0x8167ae[_0xf254('0x3e')],function(_0x27f6c7){var _0x580269={};_0x580269[_0x27f6c7]={'$like':'%'+_0x277a2e[_0xf254('0x3d')][_0xf254('0x48')]+'%'};return _0x580269;})});}_0x8167ae=_[_0xf254('0x4a')]({},_0x8167ae,_0x277a2e[_0xf254('0x4b')]);return db[_0xf254('0x67')]['count']({'where':_0x8167ae['where']})[_0xf254('0x19')](function(_0x174607){_0x5a754e[_0xf254('0x28')]=_0x174607;if(_0x277a2e['query'][_0xf254('0x53')]){_0x8167ae[_0xf254('0x4c')]=[{'all':!![]}];}return db[_0xf254('0x67')][_0xf254('0x4d')](_0x8167ae);})[_0xf254('0x19')](function(_0x3cfaab){_0x5a754e[_0xf254('0x4e')]=_0x3cfaab;return _0x5a754e;});}})[_0xf254('0x19')](respondWithFilteredResult(_0x55e778,_0x8167ae))['catch'](handleError(_0x55e778,null));};exports['removeAnswers']=function(_0x33b6fc,_0x3ab9ca,_0x547b36){return db['FaxAccount'][_0xf254('0x5a')]({'where':{'id':_0x33b6fc[_0xf254('0x50')]['id']}})[_0xf254('0x19')](handleEntityNotFound(_0x3ab9ca,null))[_0xf254('0x19')](function(_0x323ef5){if(_0x323ef5){return _0x323ef5[_0xf254('0x69')](_0x33b6fc[_0xf254('0x3d')]['ids']);}})[_0xf254('0x19')](respondWithStatusCode(_0x3ab9ca,null))[_0xf254('0x23')](handleError(_0x3ab9ca,null));};exports[_0xf254('0x6a')]=function(_0x1b49f9,_0x26dc6b,_0xc2f97e){return db[_0xf254('0x6b')][_0xf254('0x5a')]({'where':{'id':_0x1b49f9[_0xf254('0x50')]['id']}})[_0xf254('0x19')](handleEntityNotFound(_0x26dc6b,null))[_0xf254('0x19')](function(_0x4221ca){if(_0x4221ca){return _0x4221ca[_0xf254('0x6a')](_0x1b49f9['body'][_0xf254('0x65')],_[_0xf254('0x6c')](_0x1b49f9['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x26dc6b,null))['catch'](handleError(_0x26dc6b,null));};exports[_0xf254('0x6d')]=function(_0x2a7f24,_0x4cf3b9,_0x20c419){var _0x4c24ea={'raw':![],'where':{}};var _0x1c5e69={};var _0xeb0c72={'count':0x0,'rows':[]};return db[_0xf254('0x38')][_0xf254('0x62')]({'where':{'id':_0x2a7f24[_0xf254('0x50')]['id']}})[_0xf254('0x19')](handleEntityNotFound(_0x4cf3b9,null))[_0xf254('0x19')](function(_0x36e3c7){if(_0x36e3c7){_0x1c5e69[_0xf254('0x3c')]=_[_0xf254('0x52')](db['FaxInteraction'][_0xf254('0x39')]);_0x1c5e69[_0xf254('0x3d')]=_[_0xf254('0x52')](_0x2a7f24[_0xf254('0x3d')]);_0x1c5e69[_0xf254('0x46')]=_['intersection'](_0x1c5e69[_0xf254('0x3c')],_0x1c5e69['query']);_0x4c24ea[_0xf254('0x3e')]=_[_0xf254('0x3f')](_0x1c5e69[_0xf254('0x3c')],qs[_0xf254('0x40')](_0x2a7f24[_0xf254('0x3d')][_0xf254('0x40')]));_0x4c24ea['attributes']=_0x4c24ea[_0xf254('0x3e')]['length']?_0x4c24ea[_0xf254('0x3e')]:_0x1c5e69['model'];if(!_0x2a7f24[_0xf254('0x3d')][_0xf254('0x42')](_0xf254('0x43'))){_0x4c24ea[_0xf254('0x27')]=qs[_0xf254('0x27')](_0x2a7f24[_0xf254('0x3d')][_0xf254('0x27')]);_0x4c24ea[_0xf254('0x29')]=qs[_0xf254('0x29')](_0x2a7f24[_0xf254('0x3d')]['offset']);}_0x4c24ea[_0xf254('0x44')]=qs[_0xf254('0x45')](_0x2a7f24[_0xf254('0x3d')][_0xf254('0x45')]);_0x4c24ea[_0xf254('0x49')]=qs['filters'](_[_0xf254('0x47')](_0x2a7f24[_0xf254('0x3d')],_0x1c5e69[_0xf254('0x46')]));_0x4c24ea[_0xf254('0x49')][_0xf254('0x60')]=_0x36e3c7['id'];if(_0x2a7f24[_0xf254('0x3d')][_0xf254('0x48')]){_0x4c24ea[_0xf254('0x49')]=_[_0xf254('0x4a')](_0x4c24ea[_0xf254('0x49')],{'$or':_[_0xf254('0x37')](_0x4c24ea[_0xf254('0x3e')],function(_0x37e84f){var _0x5755a0={};_0x5755a0[_0x37e84f]={'$like':'%'+_0x2a7f24['query'][_0xf254('0x48')]+'%'};return _0x5755a0;})});}_0x4c24ea=_[_0xf254('0x4a')]({},_0x4c24ea,_0x2a7f24[_0xf254('0x4b')]);return db[_0xf254('0x6b')][_0xf254('0x28')]({'where':_0x4c24ea[_0xf254('0x49')]})['then'](function(_0x29a240){_0xeb0c72[_0xf254('0x28')]=_0x29a240;if(_0x2a7f24[_0xf254('0x3d')][_0xf254('0x53')]){_0x4c24ea[_0xf254('0x4c')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xf254('0x6e')],'as':_0xf254('0x6f'),'attributes':[_0xf254('0x34'),_0xf254('0x70'),_0xf254('0x71')],'required':![]},{'model':db[_0xf254('0x72')],'as':'Tags','attributes':['id',_0xf254('0x34'),_0xf254('0x73')],'where':_0x2a7f24[_0xf254('0x3d')][_0xf254('0x74')]?{'id':_0x2a7f24[_0xf254('0x3d')][_0xf254('0x74')]}:undefined,'required':_0x2a7f24[_0xf254('0x3d')]['tag']?!![]:![]}];}return db[_0xf254('0x6b')][_0xf254('0x4d')](_0x4c24ea);})[_0xf254('0x19')](function(_0x367373){_0xeb0c72[_0xf254('0x4e')]=_0x367373;return _0xeb0c72;});}})[_0xf254('0x19')](respondWithFilteredResult(_0x4cf3b9,_0x4c24ea))[_0xf254('0x23')](handleError(_0x4cf3b9,null));};exports[_0xf254('0x75')]=function(_0x5a1fe3,_0x542cd3){var _0x50b7b7=_0x5a1fe3[_0xf254('0x50')]['id'];var _0x16fb8c=_0x5a1fe3['body'];var _0xb747c8=0xc8;var _0x25caf6=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xf254('0x76')][_0xf254('0x77')][_0xf254('0x78')][_0xf254('0x79')]},function(_0x24f4fa){return db[_0xf254('0x38')][_0xf254('0x62')]({'where':{'id':_0x50b7b7},'transaction':_0x24f4fa})[_0xf254('0x19')](function(_0x4dd2c6){if(_0x4dd2c6){return db['FaxApplication'][_0xf254('0x2f')]({'where':{'FaxAccountId':_0x50b7b7},'transaction':_0x24f4fa})[_0xf254('0x19')](function(){var _0x1730a7=_['map'](_0x16fb8c,function(_0x544049){_0x544049[_0xf254('0x60')]=_0x50b7b7;return _0x544049;});return db[_0xf254('0x7a')]['bulkCreate'](_0x1730a7,{'transaction':_0x24f4fa});});}else{_0xb747c8=0x194;_0x25caf6=[];}});})[_0xf254('0x19')](function(){if(_0xb747c8!==0x194){return db[_0xf254('0x7a')][_0xf254('0x7b')]({'where':{'FaxAccountId':_0x50b7b7},'order':_0xf254('0x7c')})[_0xf254('0x19')](function(_0x489934){_0x25caf6=_0x489934;});}})[_0xf254('0x23')](function(_0x44b34e){_0xb747c8=0x1f4;logger[_0xf254('0x1f')](_0x44b34e['stack']);if(_0x44b34e['name']){delete _0x44b34e['name'];}_0x25caf6=_0x44b34e;})['finally'](function(){if(_0x25caf6===null){_0x542cd3[_0xf254('0x7d')](_0xb747c8);}else{if(_0xb747c8===0x1f4){_0x542cd3[_0xf254('0x24')](_0xb747c8)[_0xf254('0x7e')](_0x25caf6);}else{_0x542cd3[_0xf254('0x24')](_0xb747c8)[_0xf254('0x25')](_0x25caf6);}}});};exports[_0xf254('0x7f')]=function(_0x45af8e,_0x588759,_0x23bc29){var _0x478c2b={};var _0x338cbb={};var _0x4cdaa3;var _0xe0a4da;return db[_0xf254('0x38')]['findOne']({'where':{'id':_0x45af8e['params']['id']}})[_0xf254('0x19')](handleEntityNotFound(_0x588759,null))[_0xf254('0x19')](function(_0x3a1ece){if(_0x3a1ece){_0x4cdaa3=_0x3a1ece;_0x338cbb['model']=_['keys'](db[_0xf254('0x7a')][_0xf254('0x39')]);_0x338cbb[_0xf254('0x3d')]=_[_0xf254('0x52')](_0x45af8e['query']);_0x338cbb['filters']=_[_0xf254('0x3f')](_0x338cbb['model'],_0x338cbb[_0xf254('0x3d')]);_0x478c2b[_0xf254('0x3e')]=_['intersection'](_0x338cbb[_0xf254('0x3c')],qs[_0xf254('0x40')](_0x45af8e[_0xf254('0x3d')][_0xf254('0x40')]));_0x478c2b[_0xf254('0x3e')]=_0x478c2b[_0xf254('0x3e')]['length']?_0x478c2b[_0xf254('0x3e')]:_0x338cbb[_0xf254('0x3c')];_0x478c2b[_0xf254('0x44')]=qs[_0xf254('0x45')](_0x45af8e['query'][_0xf254('0x45')]);_0x478c2b['where']=qs[_0xf254('0x46')](_[_0xf254('0x47')](_0x45af8e[_0xf254('0x3d')],_0x338cbb[_0xf254('0x46')]));if(_0x45af8e[_0xf254('0x3d')][_0xf254('0x48')]){_0x478c2b[_0xf254('0x49')]=_[_0xf254('0x4a')](_0x478c2b['where'],{'$or':_[_0xf254('0x37')](_0x478c2b[_0xf254('0x3e')],function(_0x350182){var _0x236a3e={};_0x236a3e[_0x350182]={'$like':'%'+_0x45af8e['query'][_0xf254('0x48')]+'%'};return _0x236a3e;})});}_0x478c2b=_['merge']({},_0x478c2b,_0x45af8e[_0xf254('0x4b')]);return _0x4cdaa3[_0xf254('0x7f')](_0x478c2b);}})[_0xf254('0x19')](function(_0x2f571f){if(_0x2f571f){_0xe0a4da=_0x2f571f[_0xf254('0x41')];if(!_0x45af8e[_0xf254('0x3d')]['hasOwnProperty'](_0xf254('0x43'))){_0x478c2b['limit']=qs[_0xf254('0x27')](_0x45af8e['query']['limit']);_0x478c2b[_0xf254('0x29')]=qs[_0xf254('0x29')](_0x45af8e[_0xf254('0x3d')][_0xf254('0x29')]);}return _0x4cdaa3[_0xf254('0x7f')](_0x478c2b);}})['then'](function(_0x1fd099){if(_0x1fd099){return _0x1fd099?{'count':_0xe0a4da,'rows':_0x1fd099}:null;}})[_0xf254('0x19')](respondWithResult(_0x588759,null))['catch'](handleError(_0x588759,null));};function Extension(_0x16a240,_0x3b065c,_0x49a9f8,_0x8fc36f){this[_0xf254('0x80')]=_0xf254('0x81');this[_0xf254('0x82')]=_0x16a240[_0xf254('0x83')];this[_0xf254('0x84')]=_0x8fc36f;this[_0xf254('0x3a')]=_0xf254('0x85');this['description']=_0xf254('0x86');this['FaxAccountId']=_0x16a240['id'];this[_0xf254('0x7c')]=_0x3b065c;this[_0xf254('0x87')]=_0x49a9f8;}function createExtensionsReciveFax(_0x3c93c5){var _0x3695bc=0x1;var _0x971733=[];_0x971733['push'](new Extension(_0x3c93c5,_0x3695bc,'',_0xf254('0x88')));_0x3695bc+=0x1;_0x971733[_0xf254('0x89')](new Extension(_0x3c93c5,_0x3695bc,_0xf254('0x8a'),_0xf254('0x8b')));_0x3695bc+=0x1;for(var _0x319656 in _0x3c93c5){if(_0x3c93c5[_0xf254('0x42')](_0x319656)&&(_0x319656===_0xf254('0x8c')||_0x319656===_0xf254('0x83')||_0x319656===_0xf254('0x8d')||_0x319656===_0xf254('0x8e')||_0x319656===_0xf254('0x8f')||_0x319656===_0xf254('0x90')||_0x319656===_0xf254('0x91')||_0x319656===_0xf254('0x92')||_0x319656===_0xf254('0x93'))){_0x971733['push'](new Extension(_0x3c93c5,_0x3695bc,_0xf254('0x94')+_0x319656+')='+_0x3c93c5[_0x319656],'Set'));_0x3695bc+=0x1;}}_0x971733[_0xf254('0x89')](new Extension(_0x3c93c5,_0x3695bc,'6',_0xf254('0x95')));_0x3695bc+=0x1;_0x971733[_0xf254('0x89')](new Extension(_0x3c93c5,_0x3695bc,'/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',_0xf254('0x96')));_0x3695bc=0x0;return _0x971733;}exports[_0xf254('0x97')]=function(_0xd228b0,_0x5386e3,_0xd2d888){var _0x5e1031;return db[_0xf254('0x76')][_0xf254('0x98')](function(_0x562402){return db[_0xf254('0x38')][_0xf254('0x54')](_0xd228b0[_0xf254('0x55')],{'transaction':_0x562402})[_0xf254('0x19')](function(_0x2c2226){_0x5e1031=_0x2c2226[_0xf254('0x57')]({'plain':!![]});return db[_0xf254('0x99')][_0xf254('0x9a')](createExtensionsReciveFax(_0x5e1031),{'transaction':_0x562402});});})['then'](function(){return _0x5e1031;})['then'](respondWithResult(_0x5386e3,null))[_0xf254('0x23')](handleError(_0x5386e3,null));};exports[_0xf254('0x9b')]=function(_0x186587,_0x54c470,_0x21cc43){var _0x579ffc;return db[_0xf254('0x76')][_0xf254('0x98')](function(_0x5d32a9){return db[_0xf254('0x38')][_0xf254('0x2e')](_0x186587[_0xf254('0x55')],{'where':{'id':_0x186587['body']['id']},'transaction':_0x5d32a9})[_0xf254('0x19')](function(_0x10f36a){return db['VoiceExtension'][_0xf254('0x2f')]({'where':{'FaxAccountId':_0x186587[_0xf254('0x55')]['id']},'transaction':_0x5d32a9})[_0xf254('0x19')](function(_0x150ba2){return db[_0xf254('0x99')]['bulkCreate'](createExtensionsReciveFax(_[_0xf254('0x6c')](_0x186587[_0xf254('0x55')],[_0xf254('0x9c'),_0xf254('0x3b'),_0xf254('0x9d'),'updatedAt','TrunkId','ListId'])),{'transaction':_0x5d32a9});});});})['then'](function(){return db[_0xf254('0x38')][_0xf254('0x9e')](_0x186587['body']['id']);})['then'](respondWithResult(_0x54c470,null))[_0xf254('0x23')](handleError(_0x54c470,null));};exports[_0xf254('0x9f')]=function(_0x34eeb3,_0x4c72e0,_0x5d135b){var _0x5eb971={'raw':!![],'where':{}};var _0x17994f={};var _0x1b66f9={'count':0x0,'rows':[]};return db['FaxAccount'][_0xf254('0x62')]({'where':{'id':_0x34eeb3[_0xf254('0x50')]['id']}})['then'](handleEntityNotFound(_0x4c72e0,null))[_0xf254('0x19')](function(_0x12428d){if(_0x12428d){_0x17994f[_0xf254('0x3c')]=_['keys'](db['FaxMessage'][_0xf254('0x39')]);_0x17994f['query']=_['keys'](_0x34eeb3[_0xf254('0x3d')]);_0x17994f['filters']=_[_0xf254('0x3f')](_0x17994f[_0xf254('0x3c')],_0x17994f[_0xf254('0x3d')]);_0x5eb971['attributes']=_[_0xf254('0x3f')](_0x17994f[_0xf254('0x3c')],qs[_0xf254('0x40')](_0x34eeb3[_0xf254('0x3d')][_0xf254('0x40')]));_0x5eb971[_0xf254('0x3e')]=_0x5eb971[_0xf254('0x3e')]['length']?_0x5eb971[_0xf254('0x3e')]:_0x17994f[_0xf254('0x3c')];if(!_0x34eeb3[_0xf254('0x3d')][_0xf254('0x42')](_0xf254('0x43'))){_0x5eb971['limit']=qs['limit'](_0x34eeb3['query'][_0xf254('0x27')]);_0x5eb971['offset']=qs[_0xf254('0x29')](_0x34eeb3[_0xf254('0x3d')][_0xf254('0x29')]);}_0x5eb971['order']=qs['sort'](_0x34eeb3[_0xf254('0x3d')][_0xf254('0x45')]);_0x5eb971['where']=qs[_0xf254('0x46')](_[_0xf254('0x47')](_0x34eeb3[_0xf254('0x3d')],_0x17994f[_0xf254('0x46')]));_0x5eb971['where'][_0xf254('0x60')]=_0x12428d['id'];if(_0x34eeb3[_0xf254('0x3d')][_0xf254('0x48')]){_0x5eb971[_0xf254('0x49')]=_['merge'](_0x5eb971['where'],{'$or':_[_0xf254('0x37')](_0x5eb971[_0xf254('0x3e')],function(_0xe7ba31){var _0xeca417={};_0xeca417[_0xe7ba31]={'$like':'%'+_0x34eeb3[_0xf254('0x3d')][_0xf254('0x48')]+'%'};return _0xeca417;})});}if(_0x34eeb3[_0xf254('0x3d')][_0xf254('0xa0')]){var _0x9e6ece=_0x34eeb3[_0xf254('0x3d')]['$gte'][_0xf254('0xa1')](',');var _0x4ba163={};_0x4ba163[_0x9e6ece[0x0]]={'$gte':moment(_0x9e6ece[0x1])[_0xf254('0xa2')](_0xf254('0xa3'))};_0x5eb971[_0xf254('0x49')]=_['merge'](_0x5eb971['where'],_0x4ba163);}_0x5eb971=_['merge']({},_0x5eb971,_0x34eeb3[_0xf254('0x4b')]);return db[_0xf254('0xa4')]['count']({'where':_0x5eb971[_0xf254('0x49')]})['then'](function(_0x4eb182){_0x1b66f9[_0xf254('0x28')]=_0x4eb182;if(_0x34eeb3[_0xf254('0x3d')][_0xf254('0x53')]){_0x5eb971[_0xf254('0x4c')]=[{'all':!![]}];}return db[_0xf254('0xa4')][_0xf254('0x4d')](_0x5eb971);})[_0xf254('0x19')](function(_0x282f6d){_0x1b66f9[_0xf254('0x4e')]=_0x282f6d;return _0x1b66f9;});}})['then'](respondWithFilteredResult(_0x4c72e0,_0x5eb971))['catch'](handleError(_0x4c72e0,null));};exports[_0xf254('0x7e')]=function(_0xa92c1d,_0x3f13ce,_0x55391a){var _0x5bbc95,_0x21646d={},_0x1bf9c7;if(_0xa92c1d[_0xf254('0x55')]['to']){_0x1bf9c7=_0xa92c1d[_0xf254('0x55')]['to'][0x0];}return db[_0xf254('0x38')][_0xf254('0x5a')]({'where':{'id':_0xa92c1d[_0xf254('0x50')]['id']},'include':[{'model':db[_0xf254('0xa5')],'as':_0xf254('0xa6'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x1bf9c7},'limit':0x1,'order':[[_0xf254('0xa7'),_0xf254('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x3f13ce,null))[_0xf254('0x19')](function(_0x1a52f3){_0x5bbc95=_0x1a52f3;if(_0xa92c1d[_0xf254('0x55')][_0xf254('0xa9')]&&_0xa92c1d[_0xf254('0x55')][_0xf254('0xa9')][_0xf254('0x41')]){for(var _0x1c25b4=0x0;_0x1c25b4<_0xa92c1d[_0xf254('0x55')][_0xf254('0xa9')]['length'];_0x1c25b4+=0x1){_0xa92c1d[_0xf254('0x55')][_0xf254('0xa9')][_0x1c25b4]={'filename':_0xa92c1d['body'][_0xf254('0xa9')][_0x1c25b4][_0xf254('0x34')],'id':_0xa92c1d['body'][_0xf254('0xa9')][_0x1c25b4]['id'],'path':path[_0xf254('0xaa')](config[_0xf254('0xab')],_0xf254('0xac'),_0xa92c1d[_0xf254('0x55')][_0xf254('0xa9')][_0x1c25b4][_0xf254('0xad')])};}}return respondWithRpcPromise(_0xf254('0xae'),_0xf254('0xae'),{'FaxAccountId':_['isNil'](_0xa92c1d[_0xf254('0x50')]['id'])?undefined:_0xa92c1d[_0xf254('0x50')]['id'],'path':_[_0xf254('0xaf')](_0xa92c1d[_0xf254('0x55')][_0xf254('0xa9')][0x0][_0xf254('0x4')])?undefined:_0xa92c1d['body'][_0xf254('0xa9')][0x0][_0xf254('0x4')],'fax':_[_0xf254('0xaf')](_0xa92c1d[_0xf254('0x55')]['to'][0x0])?undefined:_0xa92c1d[_0xf254('0x55')]['to'][0x0]},client9002);})['then'](function(){if(_0x5bbc95){if(_['isNil'](_0xa92c1d[_0xf254('0x55')][_0xf254('0xb0')])){_0xa92c1d['body'][_0xf254('0xb0')]=util[_0xf254('0xa2')](_0xf254('0xb1'),_0x5bbc95[_0xf254('0x34')],_0x5bbc95[_0xf254('0xb2')]);}if(_0x5bbc95[_0xf254('0xa6')]){if(_0x5bbc95[_0xf254('0xa6')]['Contacts'][_0xf254('0x41')]){return _0x5bbc95[_0xf254('0xa6')][_0xf254('0xb3')][0x0];}else{return db['CmContact'][_0xf254('0x54')](_[_0xf254('0x13')](_0xa92c1d['body'],{'firstName':_0xa92c1d[_0xf254('0x55')]['to'][0x0],'phone':_0xa92c1d[_0xf254('0x55')]['to'][0x0],'fax':_0xa92c1d[_0xf254('0x55')]['to'][0x0],'ListId':_0x5bbc95[_0xf254('0xb4')]}));}}else{throw new Error(_0xf254('0xb5'));}}else{throw new Error(_0xf254('0xb6'));}})[_0xf254('0x19')](function(_0xa9ede4){if(_0xa9ede4){return db['FaxInteraction']['find']({'where':{'ContactId':_0xa9ede4['id'],'closed':![],'FaxAccountId':_0x5bbc95['id']}})['then'](function(_0x2a4411){if(_0x2a4411){return[_0x2a4411,![]];}return db[_0xf254('0x6b')][_0xf254('0x54')]({'UserId':_0xa92c1d[_0xf254('0x56')]['id'],'ContactId':_0xa9ede4['id'],'FaxAccountId':_0x5bbc95['id'],'fax':_0xa92c1d['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xf254('0x4a')](_0xa92c1d[_0xf254('0x55')],{'read':![],'body':_0xa92c1d['body'][_0xf254('0xa9')][0x0][_0xf254('0xb7')],'FaxAccountId':_0x5bbc95['id'],'UserId':_0xa92c1d[_0xf254('0x56')]['id'],'ContactId':_0xa9ede4['id'],'AttachmentId':_0xa92c1d[_0xf254('0x55')][_0xf254('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0xf254('0xa4')],'as':_0xf254('0xb8')}]})[_0xf254('0x19')](function(_0x4f7305){return[_0x4f7305,!![]];});});}else{throw new Error(_0xf254('0xb9'));}})[_0xf254('0xba')](function(_0x2942e8,_0x4d7439){if(_0x4d7439){return _0x2942e8;}return db[_0xf254('0xa4')][_0xf254('0x54')]({'direction':_0xf254('0xbb'),'read':![],'body':_0xa92c1d[_0xf254('0x55')]['attachments'][0x0][_0xf254('0xb7')],'FaxAccountId':_0x5bbc95['id'],'FaxInteractionId':_0x2942e8['id'],'UserId':_0xa92c1d[_0xf254('0x56')]['id'],'ContactId':_0x2942e8[_0xf254('0xbc')],'AttachmentId':_0xa92c1d[_0xf254('0x55')][_0xf254('0xa9')][0x0]['id']})[_0xf254('0x19')](function(_0x4c9a63){_0x2942e8['dataValues'][_0xf254('0xb8')]=[];_0x2942e8['dataValues']['Messages'][_0xf254('0x89')](_0x4c9a63[_0xf254('0xbd')]);return _0x2942e8;});})[_0xf254('0x19')](function(_0x425209){respondWithRpcPromise(_0xf254('0xbe'),_0xf254('0xbe'),{'FaxAccountId':_[_0xf254('0xaf')](_0xa92c1d['params']['id'])?undefined:_0xa92c1d[_0xf254('0x50')]['id'],'path':_[_0xf254('0xaf')](_0xa92c1d[_0xf254('0x55')]['attachments'][0x0][_0xf254('0x4')])?undefined:_0xa92c1d['body'][_0xf254('0xa9')][0x0][_0xf254('0x4')],'fax':_[_0xf254('0xaf')](_0xa92c1d[_0xf254('0x55')]['to'][0x0])?undefined:_0xa92c1d[_0xf254('0x55')]['to'][0x0],'AttachmentId':_0xa92c1d[_0xf254('0x55')][_0xf254('0xa9')][0x0]['id']},client9002)['then'](function(_0x140f82){logger[_0xf254('0x1a')](_0xf254('0xbf'),_0x140f82);})[_0xf254('0x23')](function(_0x151e50){logger[_0xf254('0x1a')](_0xf254('0xbf'),_0x151e50);});return _0x425209;})[_0xf254('0x19')](respondWithResult(_0x3f13ce,null))[_0xf254('0x23')](handleError(_0x3f13ce,null));};exports[_0xf254('0xc0')]=function(_0x2846ee,_0x2e787f,_0xf72cad){return db[_0xf254('0x38')]['find']({'where':{'id':_0x2846ee[_0xf254('0x50')]['id']}})['then'](handleEntityNotFound(_0x2e787f,null))[_0xf254('0x19')](function(_0x1b3787){if(_0x1b3787){return _0x1b3787['addAgents'](_0x2846ee[_0xf254('0x55')][_0xf254('0x65')],_[_0xf254('0x6c')](_0x2846ee[_0xf254('0x55')],[_0xf254('0x65'),'id'])||{})['spread'](function(_0x1c6a21){for(var _0x279fb7=0x0;_0x279fb7<_0x2846ee['body']['ids'][_0xf254('0x41')];_0x279fb7+=0x1){socket[_0xf254('0xc1')]('userFaxAccount:save',{'UserId':Number(_0x2846ee[_0xf254('0x55')]['ids'][_0x279fb7]),'FaxAccountId':Number(_0x2846ee['params']['id'])});}return _0x1c6a21;});}})[_0xf254('0x19')](respondWithResult(_0x2e787f,null))[_0xf254('0x23')](handleError(_0x2e787f,null));};exports[_0xf254('0xc2')]=function(_0x3f96ba,_0x44436d,_0x317706){return db[_0xf254('0x38')][_0xf254('0x5a')]({'where':{'id':_0x3f96ba['params']['id']}})[_0xf254('0x19')](handleEntityNotFound(_0x44436d,null))[_0xf254('0x19')](function(_0x494662){if(_0x494662){return _0x494662[_0xf254('0xc2')](_0x3f96ba[_0xf254('0x3d')][_0xf254('0x65')])[_0xf254('0x19')](function(){if(_[_0xf254('0xc3')](_0x3f96ba['query']['ids'])){for(var _0x337db9=0x0;_0x337db9<_0x3f96ba[_0xf254('0x3d')][_0xf254('0x65')]['length'];_0x337db9+=0x1){socket['emit'](_0xf254('0xc4'),{'UserId':Number(_0x3f96ba[_0xf254('0x3d')]['ids'][_0x337db9]),'FaxAccountId':Number(_0x3f96ba[_0xf254('0x50')]['id'])});}}else{socket[_0xf254('0xc1')](_0xf254('0xc4'),{'UserId':Number(_0x3f96ba[_0xf254('0x3d')][_0xf254('0x65')]),'FaxAccountId':Number(_0x3f96ba[_0xf254('0x50')]['id'])});}});}})[_0xf254('0x19')](respondWithStatusCode(_0x44436d,null))['catch'](handleError(_0x44436d,null));};exports[_0xf254('0xc5')]=function(_0x606780,_0x1e0a82,_0x3c15c6){var _0x44bce1={};var _0x5e12e2={};var _0x2df6e0;var _0x577f7e;return db[_0xf254('0x38')][_0xf254('0x62')]({'where':{'id':_0x606780[_0xf254('0x50')]['id']}})[_0xf254('0x19')](handleEntityNotFound(_0x1e0a82,null))['then'](function(_0x43f157){if(_0x43f157){_0x2df6e0=_0x43f157;_0x5e12e2['model']=_['keys'](db[_0xf254('0x6e')][_0xf254('0x39')]);_0x5e12e2[_0xf254('0x3d')]=_['keys'](_0x606780[_0xf254('0x3d')]);_0x5e12e2[_0xf254('0x46')]=_[_0xf254('0x3f')](_0x5e12e2[_0xf254('0x3c')],_0x5e12e2[_0xf254('0x3d')]);_0x44bce1['attributes']=_[_0xf254('0x3f')](_0x5e12e2['model'],qs[_0xf254('0x40')](_0x606780[_0xf254('0x3d')][_0xf254('0x40')]));_0x44bce1['attributes']=_0x44bce1[_0xf254('0x3e')][_0xf254('0x41')]?_0x44bce1['attributes']:_0x5e12e2['model'];_0x44bce1[_0xf254('0x44')]=qs['sort'](_0x606780[_0xf254('0x3d')]['sort']);_0x44bce1[_0xf254('0x49')]=qs[_0xf254('0x46')](_[_0xf254('0x47')](_0x606780['query'],_0x5e12e2[_0xf254('0x46')]));if(_0x606780[_0xf254('0x3d')][_0xf254('0x48')]){_0x44bce1['where']=_[_0xf254('0x4a')](_0x44bce1[_0xf254('0x49')],{'$or':_[_0xf254('0x37')](_0x44bce1[_0xf254('0x3e')],function(_0x3bc249){var _0xddeb3f={};_0xddeb3f[_0x3bc249]={'$like':'%'+_0x606780[_0xf254('0x3d')]['filter']+'%'};return _0xddeb3f;})});}_0x44bce1=_['merge']({},_0x44bce1,_0x606780[_0xf254('0x4b')]);return _0x2df6e0['getAgents'](_0x44bce1);}})[_0xf254('0x19')](function(_0x2ea194){if(_0x2ea194){_0x577f7e=_0x2ea194[_0xf254('0x41')];if(!_0x606780[_0xf254('0x3d')][_0xf254('0x42')](_0xf254('0x43'))){_0x44bce1[_0xf254('0x27')]=qs['limit'](_0x606780[_0xf254('0x3d')][_0xf254('0x27')]);_0x44bce1[_0xf254('0x29')]=qs[_0xf254('0x29')](_0x606780['query'][_0xf254('0x29')]);}return _0x2df6e0['getAgents'](_0x44bce1);}})['then'](function(_0x498a42){if(_0x498a42){return _0x498a42?{'count':_0x577f7e,'rows':_0x498a42}:null;}})[_0xf254('0x19')](respondWithResult(_0x1e0a82,null))[_0xf254('0x23')](handleError(_0x1e0a82,null));}; \ No newline at end of file +var _0x8a4b=['ecm','localstationid','gateway','headerinfo','maxrate','minrate','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','transaction','get','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','ListId','findById','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','List','List\x20not\x20found','Send\x20Fax\x20failed','Messages','Contact\x20not\x20found','spread','out','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','./faxAccount.socket','register','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','update','UserProfileResource','destroy','stack','name','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','type','key','model','map','keys','filters','attributes','intersection','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','include','Pause','length','includeAll','merge','find','create','body','user','role','FaxAccounts','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','filter','findAll','rows','removeDispositions','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addInteraction','FaxInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','FaxApplication','priority','finally','sendStatus','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0x8a4b,0xfe));var _0xb8a4=function(_0x4ce46c,_0x3002e5){_0x4ce46c=_0x4ce46c-0x0;var _0x132542=_0x8a4b[_0x4ce46c];return _0x132542;};'use strict';var emlformat=require(_0xb8a4('0x0'));var rimraf=require(_0xb8a4('0x1'));var zipdir=require(_0xb8a4('0x2'));var jsonpatch=require(_0xb8a4('0x3'));var rp=require(_0xb8a4('0x4'));var moment=require(_0xb8a4('0x5'));var BPromise=require(_0xb8a4('0x6'));var Mustache=require(_0xb8a4('0x7'));var util=require('util');var path=require(_0xb8a4('0x8'));var sox=require(_0xb8a4('0x9'));var csv=require(_0xb8a4('0xa'));var ejs=require(_0xb8a4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8a4('0xc'));var squel=require(_0xb8a4('0xd'));var crypto=require(_0xb8a4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb8a4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb8a4('0x10'));var Redis=require('ioredis');var authService=require(_0xb8a4('0x11'));var qs=require(_0xb8a4('0x12'));var as=require(_0xb8a4('0x13'));var hardwareService=require(_0xb8a4('0x14'));var logger=require(_0xb8a4('0x15'))(_0xb8a4('0x16'));var utils=require('../../config/utils');var config=require(_0xb8a4('0x17'));var licenseUtil=require(_0xb8a4('0x18'));var db=require(_0xb8a4('0x19'))['db'];config[_0xb8a4('0x1a')]=_['defaults'](config[_0xb8a4('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb8a4('0x1a')]));require(_0xb8a4('0x1b'))[_0xb8a4('0x1c')](socket);var jayson=require(_0xb8a4('0x1d'));var client=jayson[_0xb8a4('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xb8a4('0x1e')][_0xb8a4('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xd7d383,_0x29cc72,_0x2b6d73,_0x44d1b8){return new BPromise(function(_0xbaca69,_0x1b48e3){var _0x2d7997=_0x44d1b8||client;return _0x2d7997[_0xb8a4('0x20')](_0xd7d383,_0x2b6d73)[_0xb8a4('0x21')](function(_0x981a1){logger['info'](_0xb8a4('0x22'),_0x29cc72,_0xb8a4('0x23'));logger[_0xb8a4('0x24')](_0xb8a4('0x25'),_0x29cc72,_0xb8a4('0x23'),JSON[_0xb8a4('0x26')](_0x981a1));if(_0x981a1[_0xb8a4('0x27')]){if(_0x981a1['error'][_0xb8a4('0x28')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x29cc72,_0x981a1[_0xb8a4('0x27')][_0xb8a4('0x29')]);return _0x1b48e3(_0x981a1['error'][_0xb8a4('0x29')]);}logger[_0xb8a4('0x27')]('FaxAccount,\x20%s,\x20%s',_0x29cc72,_0x981a1[_0xb8a4('0x27')][_0xb8a4('0x29')]);return _0xbaca69(_0x981a1[_0xb8a4('0x27')][_0xb8a4('0x29')]);}else{logger[_0xb8a4('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x29cc72,_0xb8a4('0x23'));_0xbaca69(_0x981a1[_0xb8a4('0x2b')]['message']);}})[_0xb8a4('0x2c')](function(_0xc64b1e){logger[_0xb8a4('0x27')]('FaxAccount,\x20%s,\x20%s',_0x29cc72,_0xc64b1e);_0x1b48e3(_0xc64b1e);});});}function respondWithStatusCode(_0x297847,_0x9994a0){_0x9994a0=_0x9994a0||0xcc;return function(_0xba589b){if(_0xba589b){return _0x297847['sendStatus'](_0x9994a0);}return _0x297847[_0xb8a4('0x2d')](_0x9994a0)[_0xb8a4('0x2e')]();};}function respondWithResult(_0x7bf67d,_0x588c0b){_0x588c0b=_0x588c0b||0xc8;return function(_0x5520c3){if(_0x5520c3){return _0x7bf67d[_0xb8a4('0x2d')](_0x588c0b)[_0xb8a4('0x2f')](_0x5520c3);}};}function respondWithFilteredResult(_0x16cccf,_0x1432cf){return function(_0x3bc146){if(_0x3bc146){var _0x5d9d1d=typeof _0x1432cf[_0xb8a4('0x30')]===_0xb8a4('0x31')&&typeof _0x1432cf[_0xb8a4('0x32')]===_0xb8a4('0x31');var _0x3fec8e=_0x3bc146[_0xb8a4('0x33')];var _0x47477b=_0x5d9d1d?0x0:_0x1432cf['offset'];var _0x5725a4=_0x5d9d1d?_0x3bc146['count']:_0x1432cf[_0xb8a4('0x30')]+_0x1432cf[_0xb8a4('0x32')];var _0x341d21;if(_0x5725a4>=_0x3fec8e){_0x5725a4=_0x3fec8e;_0x341d21=0xc8;}else{_0x341d21=0xce;}_0x16cccf[_0xb8a4('0x2d')](_0x341d21);return _0x16cccf[_0xb8a4('0x34')]('Content-Range',_0x47477b+'-'+_0x5725a4+'/'+_0x3fec8e)['json'](_0x3bc146);}return null;};}function patchUpdates(_0x26f787){return function(_0x1b3353){try{jsonpatch[_0xb8a4('0x35')](_0x1b3353,_0x26f787,!![]);}catch(_0x4560e7){return BPromise[_0xb8a4('0x36')](_0x4560e7);}return _0x1b3353['save']();};}function saveUpdates(_0x1b79ef,_0x36a1e3){return function(_0x2e4c1e){if(_0x2e4c1e){return _0x2e4c1e[_0xb8a4('0x37')](_0x1b79ef)['then'](function(_0x516c33){return _0x516c33;});}return null;};}function removeEntity(_0x4668da,_0xedda85){return function(_0x483ed8){if(_0x483ed8){return _0x483ed8['destroy']()[_0xb8a4('0x21')](function(){var _0x135157=_0x483ed8['get']({'plain':!![]});var _0x1bc918='FaxAccounts';return db[_0xb8a4('0x38')][_0xb8a4('0x39')]({'where':{'type':_0x1bc918,'resourceId':_0x135157['id']}})['then'](function(){return _0x483ed8;});})[_0xb8a4('0x21')](function(){_0x4668da[_0xb8a4('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x374eac,_0x1b9201){return function(_0x35a6bd){if(!_0x35a6bd){_0x374eac['sendStatus'](0x194);}return _0x35a6bd;};}function handleError(_0x26814d,_0x292045){_0x292045=_0x292045||0x1f4;return function(_0x2ef894){logger[_0xb8a4('0x27')](_0x2ef894[_0xb8a4('0x3a')]);if(_0x2ef894[_0xb8a4('0x3b')]){delete _0x2ef894['name'];}_0x26814d[_0xb8a4('0x2d')](_0x292045)[_0xb8a4('0x3c')](_0x2ef894);};}exports[_0xb8a4('0x3d')]=function(_0x31736b,_0x52e6c5){var _0x2b0daf={'include':[{'model':db['Pause'],'as':_0xb8a4('0x3e')}]},_0x17ddfb={},_0x2ffd04={'count':0x0,'rows':[]};var _0x1085bc=_['map'](db[_0xb8a4('0x3f')][_0xb8a4('0x40')],function(_0x22a78b){return{'name':_0x22a78b['fieldName'],'type':_0x22a78b[_0xb8a4('0x41')][_0xb8a4('0x42')]};});_0x17ddfb[_0xb8a4('0x43')]=_[_0xb8a4('0x44')](_0x1085bc,_0xb8a4('0x3b'));_0x17ddfb['query']=_[_0xb8a4('0x45')](_0x31736b['query']);_0x17ddfb[_0xb8a4('0x46')]=_['intersection'](_0x17ddfb[_0xb8a4('0x43')],_0x17ddfb['query']);_0x2b0daf[_0xb8a4('0x47')]=_[_0xb8a4('0x48')](_0x17ddfb[_0xb8a4('0x43')],qs[_0xb8a4('0x49')](_0x31736b[_0xb8a4('0x4a')][_0xb8a4('0x49')]));_0x2b0daf[_0xb8a4('0x47')]=_0x2b0daf[_0xb8a4('0x47')]['length']?_0x2b0daf['attributes']:_0x17ddfb[_0xb8a4('0x43')];if(!_0x31736b[_0xb8a4('0x4a')][_0xb8a4('0x4b')](_0xb8a4('0x4c'))){_0x2b0daf[_0xb8a4('0x32')]=qs[_0xb8a4('0x32')](_0x31736b[_0xb8a4('0x4a')]['limit']);_0x2b0daf[_0xb8a4('0x30')]=qs[_0xb8a4('0x30')](_0x31736b[_0xb8a4('0x4a')][_0xb8a4('0x30')]);}_0x2b0daf[_0xb8a4('0x4d')]=qs[_0xb8a4('0x4e')](_0x31736b[_0xb8a4('0x4a')][_0xb8a4('0x4e')]);_0x2b0daf[_0xb8a4('0x4f')]=qs[_0xb8a4('0x46')](_[_0xb8a4('0x50')](_0x31736b['query'],_0x17ddfb['filters']),_0x1085bc);if(_0x31736b[_0xb8a4('0x4a')]['filter']){_0x2b0daf[_0xb8a4('0x4f')]=_['merge'](_0x2b0daf[_0xb8a4('0x4f')],{'$or':_[_0xb8a4('0x44')](_0x1085bc,function(_0x2ec493){if(_0x2ec493[_0xb8a4('0x41')]!==_0xb8a4('0x51')){var _0x36d1af={};_0x36d1af[_0x2ec493['name']]={'$like':'%'+_0x31736b[_0xb8a4('0x4a')]['filter']+'%'};return _0x36d1af;}})});}_0x2b0daf=_['merge']({},_0x2b0daf,_0x31736b[_0xb8a4('0x52')]);var _0x52e0c7={'where':_0x2b0daf[_0xb8a4('0x4f')]};return db[_0xb8a4('0x3f')][_0xb8a4('0x33')](_0x52e0c7)[_0xb8a4('0x21')](function(_0x392f65){_0x2ffd04[_0xb8a4('0x33')]=_0x392f65;if(_0x31736b['query']['includeAll']){_0x2b0daf[_0xb8a4('0x53')]=[{'all':!![]}];}return db[_0xb8a4('0x3f')]['findAll'](_0x2b0daf);})[_0xb8a4('0x21')](function(_0x1a64a1){_0x2ffd04['rows']=_0x1a64a1;return _0x2ffd04;})['then'](respondWithFilteredResult(_0x52e6c5,_0x2b0daf))[_0xb8a4('0x2c')](handleError(_0x52e6c5,null));};exports['show']=function(_0x16c61e,_0x46d9b8){var _0xc525f4={'raw':![],'where':{'id':_0x16c61e['params']['id']},'include':[{'model':db[_0xb8a4('0x54')],'as':_0xb8a4('0x3e')}]},_0x5f22dd={};_0x5f22dd[_0xb8a4('0x43')]=_[_0xb8a4('0x45')](db[_0xb8a4('0x3f')]['rawAttributes']);_0x5f22dd[_0xb8a4('0x4a')]=_[_0xb8a4('0x45')](_0x16c61e['query']);_0x5f22dd[_0xb8a4('0x46')]=_[_0xb8a4('0x48')](_0x5f22dd[_0xb8a4('0x43')],_0x5f22dd['query']);_0xc525f4[_0xb8a4('0x47')]=_[_0xb8a4('0x48')](_0x5f22dd[_0xb8a4('0x43')],qs[_0xb8a4('0x49')](_0x16c61e[_0xb8a4('0x4a')]['fields']));_0xc525f4[_0xb8a4('0x47')]=_0xc525f4[_0xb8a4('0x47')][_0xb8a4('0x55')]?_0xc525f4[_0xb8a4('0x47')]:_0x5f22dd[_0xb8a4('0x43')];if(_0x16c61e[_0xb8a4('0x4a')][_0xb8a4('0x56')]){_0xc525f4[_0xb8a4('0x53')]=[{'all':!![]}];}_0xc525f4=_[_0xb8a4('0x57')]({},_0xc525f4,_0x16c61e[_0xb8a4('0x52')]);return db[_0xb8a4('0x3f')][_0xb8a4('0x58')](_0xc525f4)[_0xb8a4('0x21')](handleEntityNotFound(_0x46d9b8,null))[_0xb8a4('0x21')](respondWithResult(_0x46d9b8,null))[_0xb8a4('0x2c')](handleError(_0x46d9b8,null));};exports['create']=function(_0x182348,_0x1a4ec2){return db[_0xb8a4('0x3f')][_0xb8a4('0x59')](_0x182348[_0xb8a4('0x5a')],{})[_0xb8a4('0x21')](function(_0x381533){var _0x3b462c=_0x182348[_0xb8a4('0x5b')]['get']({'plain':!![]});if(!_0x3b462c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b462c[_0xb8a4('0x5c')]===_0xb8a4('0x5b')){var _0x25cad7=_0x381533['get']({'plain':!![]});var _0x39de94=_0xb8a4('0x5d');return db['UserProfileSection']['find']({'where':{'name':_0x39de94,'userProfileId':_0x3b462c['userProfileId']},'raw':!![]})['then'](function(_0x1fbe86){if(_0x1fbe86&&_0x1fbe86['autoAssociation']===0x0){return db[_0xb8a4('0x38')][_0xb8a4('0x59')]({'name':_0x25cad7[_0xb8a4('0x3b')],'resourceId':_0x25cad7['id'],'type':_0x1fbe86[_0xb8a4('0x3b')],'sectionId':_0x1fbe86['id']},{})[_0xb8a4('0x21')](function(){return _0x381533;});}else{return _0x381533;}})['catch'](function(_0x506b98){logger['error'](_0xb8a4('0x5e'),_0x506b98);throw _0x506b98;});}return _0x381533;})['then'](respondWithResult(_0x1a4ec2,0xc9))[_0xb8a4('0x2c')](handleError(_0x1a4ec2,null));};exports[_0xb8a4('0x37')]=function(_0x214f59,_0xf6b1c3){if(_0x214f59[_0xb8a4('0x5a')]['id']){delete _0x214f59[_0xb8a4('0x5a')]['id'];}return db[_0xb8a4('0x3f')][_0xb8a4('0x58')]({'where':{'id':_0x214f59['params']['id']},'include':[{'model':db[_0xb8a4('0x54')],'as':_0xb8a4('0x3e')}]})[_0xb8a4('0x21')](handleEntityNotFound(_0xf6b1c3,null))[_0xb8a4('0x21')](saveUpdates(_0x214f59[_0xb8a4('0x5a')],null))[_0xb8a4('0x21')](respondWithResult(_0xf6b1c3,null))[_0xb8a4('0x2c')](handleError(_0xf6b1c3,null));};exports['destroy']=function(_0x5912f2,_0x55e802){return db[_0xb8a4('0x3f')][_0xb8a4('0x58')]({'where':{'id':_0x5912f2[_0xb8a4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x55e802,null))['then'](removeEntity(_0x55e802,null))[_0xb8a4('0x2c')](handleError(_0x55e802,null));};exports[_0xb8a4('0x60')]=function(_0x555b57,_0x148709){return db[_0xb8a4('0x3f')][_0xb8a4('0x60')]()['then'](respondWithResult(_0x148709,null))[_0xb8a4('0x2c')](handleError(_0x148709,null));};exports[_0xb8a4('0x61')]=function(_0x2d07d7,_0xdb5e37,_0x295d9b){if(_0x2d07d7[_0xb8a4('0x5a')]['id']){delete _0x2d07d7[_0xb8a4('0x5a')]['id'];}return db[_0xb8a4('0x3f')][_0xb8a4('0x58')]({'where':{'id':_0x2d07d7['params']['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0xdb5e37,null))['then'](function(_0x51eaeb){if(_0x51eaeb){_0x2d07d7[_0xb8a4('0x5a')][_0xb8a4('0x62')]=_0x51eaeb['id'];return db[_0xb8a4('0x63')][_0xb8a4('0x59')](_0x2d07d7[_0xb8a4('0x5a')]);}})[_0xb8a4('0x21')](respondWithResult(_0xdb5e37,null))[_0xb8a4('0x2c')](handleError(_0xdb5e37,null));};exports[_0xb8a4('0x64')]=function(_0x198fb0,_0x236f39,_0x3960fd){var _0x55f310={'raw':![],'where':{}};var _0x2436d8={};var _0x28dcc3={'count':0x0,'rows':[]};return db[_0xb8a4('0x3f')]['findOne']({'where':{'id':_0x198fb0[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x236f39,null))[_0xb8a4('0x21')](function(_0x4eebed){if(_0x4eebed){_0x2436d8[_0xb8a4('0x43')]=_[_0xb8a4('0x45')](db[_0xb8a4('0x63')][_0xb8a4('0x40')]);_0x2436d8[_0xb8a4('0x4a')]=_['keys'](_0x198fb0[_0xb8a4('0x4a')]);_0x2436d8[_0xb8a4('0x46')]=_[_0xb8a4('0x48')](_0x2436d8[_0xb8a4('0x43')],_0x2436d8[_0xb8a4('0x4a')]);_0x55f310[_0xb8a4('0x47')]=_[_0xb8a4('0x48')](_0x2436d8[_0xb8a4('0x43')],qs['fields'](_0x198fb0[_0xb8a4('0x4a')][_0xb8a4('0x49')]));_0x55f310[_0xb8a4('0x47')]=_0x55f310[_0xb8a4('0x47')][_0xb8a4('0x55')]?_0x55f310[_0xb8a4('0x47')]:_0x2436d8['model'];if(!_0x198fb0[_0xb8a4('0x4a')]['hasOwnProperty'](_0xb8a4('0x4c'))){_0x55f310[_0xb8a4('0x32')]=qs[_0xb8a4('0x32')](_0x198fb0[_0xb8a4('0x4a')][_0xb8a4('0x32')]);_0x55f310[_0xb8a4('0x30')]=qs[_0xb8a4('0x30')](_0x198fb0[_0xb8a4('0x4a')][_0xb8a4('0x30')]);}_0x55f310[_0xb8a4('0x4d')]=qs[_0xb8a4('0x4e')](_0x198fb0['query']['sort']);_0x55f310['where']=qs[_0xb8a4('0x46')](_[_0xb8a4('0x50')](_0x198fb0['query'],_0x2436d8['filters']));_0x55f310[_0xb8a4('0x4f')][_0xb8a4('0x62')]=_0x4eebed['id'];if(_0x198fb0[_0xb8a4('0x4a')][_0xb8a4('0x65')]){_0x55f310[_0xb8a4('0x4f')]=_[_0xb8a4('0x57')](_0x55f310[_0xb8a4('0x4f')],{'$or':_[_0xb8a4('0x44')](_0x55f310['attributes'],function(_0x511149){var _0x42f1f3={};_0x42f1f3[_0x511149]={'$like':'%'+_0x198fb0[_0xb8a4('0x4a')][_0xb8a4('0x65')]+'%'};return _0x42f1f3;})});}_0x55f310=_['merge']({},_0x55f310,_0x198fb0[_0xb8a4('0x52')]);return db[_0xb8a4('0x63')][_0xb8a4('0x33')]({'where':_0x55f310[_0xb8a4('0x4f')]})[_0xb8a4('0x21')](function(_0x502f86){_0x28dcc3[_0xb8a4('0x33')]=_0x502f86;if(_0x198fb0[_0xb8a4('0x4a')][_0xb8a4('0x56')]){_0x55f310[_0xb8a4('0x53')]=[{'all':!![]}];}return db[_0xb8a4('0x63')][_0xb8a4('0x66')](_0x55f310);})[_0xb8a4('0x21')](function(_0x5eda38){_0x28dcc3[_0xb8a4('0x67')]=_0x5eda38;return _0x28dcc3;});}})[_0xb8a4('0x21')](respondWithFilteredResult(_0x236f39,_0x55f310))['catch'](handleError(_0x236f39,null));};exports[_0xb8a4('0x68')]=function(_0x417e50,_0x30d61f,_0x3122c0){return db['FaxAccount'][_0xb8a4('0x58')]({'where':{'id':_0x417e50[_0xb8a4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x30d61f,null))['then'](function(_0x3318ff){if(_0x3318ff){return _0x3318ff[_0xb8a4('0x68')](_0x417e50[_0xb8a4('0x4a')]['ids']);}})[_0xb8a4('0x21')](respondWithStatusCode(_0x30d61f,null))[_0xb8a4('0x2c')](handleError(_0x30d61f,null));};exports['addAnswer']=function(_0x3282bb,_0x43908a,_0x43df53){if(_0x3282bb[_0xb8a4('0x5a')]['id']){delete _0x3282bb[_0xb8a4('0x5a')]['id'];}return db[_0xb8a4('0x3f')][_0xb8a4('0x58')]({'where':{'id':_0x3282bb[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x43908a,null))[_0xb8a4('0x21')](function(_0x550685){if(_0x550685){_0x3282bb['body'][_0xb8a4('0x62')]=_0x550685['id'];return db[_0xb8a4('0x69')][_0xb8a4('0x59')](_0x3282bb[_0xb8a4('0x5a')]);}})[_0xb8a4('0x21')](respondWithResult(_0x43908a,null))[_0xb8a4('0x2c')](handleError(_0x43908a,null));};exports[_0xb8a4('0x6a')]=function(_0xaeb9b3,_0x3b32aa,_0x17acf9){var _0x16afd6={'raw':![],'where':{}};var _0x510535={};var _0x518010={'count':0x0,'rows':[]};return db[_0xb8a4('0x3f')][_0xb8a4('0x6b')]({'where':{'id':_0xaeb9b3['params']['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x3b32aa,null))[_0xb8a4('0x21')](function(_0x51b935){if(_0x51b935){_0x510535[_0xb8a4('0x43')]=_[_0xb8a4('0x45')](db[_0xb8a4('0x69')][_0xb8a4('0x40')]);_0x510535[_0xb8a4('0x4a')]=_[_0xb8a4('0x45')](_0xaeb9b3[_0xb8a4('0x4a')]);_0x510535['filters']=_[_0xb8a4('0x48')](_0x510535[_0xb8a4('0x43')],_0x510535[_0xb8a4('0x4a')]);_0x16afd6[_0xb8a4('0x47')]=_[_0xb8a4('0x48')](_0x510535[_0xb8a4('0x43')],qs[_0xb8a4('0x49')](_0xaeb9b3[_0xb8a4('0x4a')]['fields']));_0x16afd6[_0xb8a4('0x47')]=_0x16afd6['attributes'][_0xb8a4('0x55')]?_0x16afd6['attributes']:_0x510535[_0xb8a4('0x43')];if(!_0xaeb9b3[_0xb8a4('0x4a')]['hasOwnProperty']('nolimit')){_0x16afd6[_0xb8a4('0x32')]=qs[_0xb8a4('0x32')](_0xaeb9b3[_0xb8a4('0x4a')][_0xb8a4('0x32')]);_0x16afd6[_0xb8a4('0x30')]=qs[_0xb8a4('0x30')](_0xaeb9b3['query'][_0xb8a4('0x30')]);}_0x16afd6[_0xb8a4('0x4d')]=qs[_0xb8a4('0x4e')](_0xaeb9b3[_0xb8a4('0x4a')][_0xb8a4('0x4e')]);_0x16afd6[_0xb8a4('0x4f')]=qs[_0xb8a4('0x46')](_[_0xb8a4('0x50')](_0xaeb9b3[_0xb8a4('0x4a')],_0x510535[_0xb8a4('0x46')]));_0x16afd6['where']['FaxAccountId']=_0x51b935['id'];if(_0xaeb9b3['query'][_0xb8a4('0x65')]){_0x16afd6[_0xb8a4('0x4f')]=_['merge'](_0x16afd6[_0xb8a4('0x4f')],{'$or':_[_0xb8a4('0x44')](_0x16afd6['attributes'],function(_0x521201){var _0x3003ab={};_0x3003ab[_0x521201]={'$like':'%'+_0xaeb9b3[_0xb8a4('0x4a')]['filter']+'%'};return _0x3003ab;})});}_0x16afd6=_[_0xb8a4('0x57')]({},_0x16afd6,_0xaeb9b3[_0xb8a4('0x52')]);return db['CannedAnswer'][_0xb8a4('0x33')]({'where':_0x16afd6[_0xb8a4('0x4f')]})[_0xb8a4('0x21')](function(_0x4a8e9f){_0x518010['count']=_0x4a8e9f;if(_0xaeb9b3[_0xb8a4('0x4a')]['includeAll']){_0x16afd6[_0xb8a4('0x53')]=[{'all':!![]}];}return db[_0xb8a4('0x69')][_0xb8a4('0x66')](_0x16afd6);})[_0xb8a4('0x21')](function(_0x20e8c5){_0x518010['rows']=_0x20e8c5;return _0x518010;});}})['then'](respondWithFilteredResult(_0x3b32aa,_0x16afd6))[_0xb8a4('0x2c')](handleError(_0x3b32aa,null));};exports['removeAnswers']=function(_0x569002,_0x1e5366,_0x485bae){return db[_0xb8a4('0x3f')]['find']({'where':{'id':_0x569002[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x1e5366,null))['then'](function(_0x2ab562){if(_0x2ab562){return _0x2ab562[_0xb8a4('0x6c')](_0x569002[_0xb8a4('0x4a')][_0xb8a4('0x6d')]);}})[_0xb8a4('0x21')](respondWithStatusCode(_0x1e5366,null))[_0xb8a4('0x2c')](handleError(_0x1e5366,null));};exports[_0xb8a4('0x6e')]=function(_0x5b939b,_0x1c8107,_0x10b8ff){return db[_0xb8a4('0x6f')][_0xb8a4('0x58')]({'where':{'id':_0x5b939b[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x1c8107,null))['then'](function(_0x572a68){if(_0x572a68){return _0x572a68[_0xb8a4('0x6e')](_0x5b939b[_0xb8a4('0x5a')]['ids'],_[_0xb8a4('0x70')](_0x5b939b['body'],[_0xb8a4('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x1c8107,null))[_0xb8a4('0x2c')](handleError(_0x1c8107,null));};exports['getInteractions']=function(_0x7c08d3,_0x17adde,_0x257f5a){var _0x671aaf={'raw':![],'where':{}};var _0xb118f4={};var _0x369899={'count':0x0,'rows':[]};return db[_0xb8a4('0x3f')]['findOne']({'where':{'id':_0x7c08d3[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x17adde,null))[_0xb8a4('0x21')](function(_0x2f5f3b){if(_0x2f5f3b){_0xb118f4[_0xb8a4('0x43')]=_[_0xb8a4('0x45')](db[_0xb8a4('0x6f')][_0xb8a4('0x40')]);_0xb118f4[_0xb8a4('0x4a')]=_['keys'](_0x7c08d3[_0xb8a4('0x4a')]);_0xb118f4[_0xb8a4('0x46')]=_[_0xb8a4('0x48')](_0xb118f4[_0xb8a4('0x43')],_0xb118f4[_0xb8a4('0x4a')]);_0x671aaf[_0xb8a4('0x47')]=_[_0xb8a4('0x48')](_0xb118f4[_0xb8a4('0x43')],qs[_0xb8a4('0x49')](_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x49')]));_0x671aaf['attributes']=_0x671aaf[_0xb8a4('0x47')]['length']?_0x671aaf['attributes']:_0xb118f4[_0xb8a4('0x43')];if(!_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x4b')](_0xb8a4('0x4c'))){_0x671aaf[_0xb8a4('0x32')]=qs[_0xb8a4('0x32')](_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x32')]);_0x671aaf['offset']=qs[_0xb8a4('0x30')](_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x30')]);}_0x671aaf['order']=qs[_0xb8a4('0x4e')](_0x7c08d3['query'][_0xb8a4('0x4e')]);_0x671aaf['where']=qs[_0xb8a4('0x46')](_['pick'](_0x7c08d3[_0xb8a4('0x4a')],_0xb118f4[_0xb8a4('0x46')]));_0x671aaf['where']['FaxAccountId']=_0x2f5f3b['id'];if(_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x65')]){_0x671aaf[_0xb8a4('0x4f')]=_[_0xb8a4('0x57')](_0x671aaf[_0xb8a4('0x4f')],{'$or':_[_0xb8a4('0x44')](_0x671aaf[_0xb8a4('0x47')],function(_0x31b313){var _0x319542={};_0x319542[_0x31b313]={'$like':'%'+_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x65')]+'%'};return _0x319542;})});}_0x671aaf=_[_0xb8a4('0x57')]({},_0x671aaf,_0x7c08d3[_0xb8a4('0x52')]);return db[_0xb8a4('0x6f')][_0xb8a4('0x33')]({'where':_0x671aaf[_0xb8a4('0x4f')]})[_0xb8a4('0x21')](function(_0x55518f){_0x369899[_0xb8a4('0x33')]=_0x55518f;if(_0x7c08d3['query']['includeAll']){_0x671aaf['include']=[{'model':db[_0xb8a4('0x71')],'as':_0xb8a4('0x72'),'required':![]},{'model':db[_0xb8a4('0x73')],'as':_0xb8a4('0x74'),'attributes':['name',_0xb8a4('0x75'),_0xb8a4('0x76')],'required':![]},{'model':db[_0xb8a4('0x77')],'as':_0xb8a4('0x78'),'attributes':['id',_0xb8a4('0x3b'),'color'],'where':_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x79')]?{'id':_0x7c08d3[_0xb8a4('0x4a')][_0xb8a4('0x79')]}:undefined,'required':_0x7c08d3[_0xb8a4('0x4a')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0xb8a4('0x66')](_0x671aaf);})[_0xb8a4('0x21')](function(_0x1eee7e){_0x369899['rows']=_0x1eee7e;return _0x369899;});}})['then'](respondWithFilteredResult(_0x17adde,_0x671aaf))[_0xb8a4('0x2c')](handleError(_0x17adde,null));};exports['addApplications']=function(_0x56edea,_0x188005){var _0x37af88=_0x56edea[_0xb8a4('0x5f')]['id'];var _0x345c87=_0x56edea['body'];var _0x5c7fda=0xc8;var _0x230615=null;return db[_0xb8a4('0x7a')]['transaction']({'isolationLevel':db[_0xb8a4('0x7a')][_0xb8a4('0x7b')][_0xb8a4('0x7c')][_0xb8a4('0x7d')]},function(_0x1cb760){return db[_0xb8a4('0x3f')]['findOne']({'where':{'id':_0x37af88},'transaction':_0x1cb760})['then'](function(_0x4de0bb){if(_0x4de0bb){return db['FaxApplication'][_0xb8a4('0x39')]({'where':{'FaxAccountId':_0x37af88},'transaction':_0x1cb760})['then'](function(){var _0x1c1b09=_['map'](_0x345c87,function(_0x492eac){_0x492eac['FaxAccountId']=_0x37af88;return _0x492eac;});return db['FaxApplication'][_0xb8a4('0x7e')](_0x1c1b09,{'transaction':_0x1cb760});});}else{_0x5c7fda=0x194;_0x230615=[];}});})[_0xb8a4('0x21')](function(){if(_0x5c7fda!==0x194){return db[_0xb8a4('0x7f')]['findAndCountAll']({'where':{'FaxAccountId':_0x37af88},'order':_0xb8a4('0x80')})[_0xb8a4('0x21')](function(_0x5ca4d0){_0x230615=_0x5ca4d0;});}})['catch'](function(_0x5ad668){_0x5c7fda=0x1f4;logger[_0xb8a4('0x27')](_0x5ad668[_0xb8a4('0x3a')]);if(_0x5ad668[_0xb8a4('0x3b')]){delete _0x5ad668[_0xb8a4('0x3b')];}_0x230615=_0x5ad668;})[_0xb8a4('0x81')](function(){if(_0x230615===null){_0x188005[_0xb8a4('0x82')](_0x5c7fda);}else{if(_0x5c7fda===0x1f4){_0x188005['status'](_0x5c7fda)[_0xb8a4('0x3c')](_0x230615);}else{_0x188005['status'](_0x5c7fda)[_0xb8a4('0x2f')](_0x230615);}}});};exports[_0xb8a4('0x83')]=function(_0x32c54d,_0x4c93a5,_0x961813){var _0x3d0de5={};var _0x5f4bb9={};var _0xe427ad;var _0x46ca32;return db[_0xb8a4('0x3f')]['findOne']({'where':{'id':_0x32c54d[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x4c93a5,null))[_0xb8a4('0x21')](function(_0x17fb27){if(_0x17fb27){_0xe427ad=_0x17fb27;_0x5f4bb9[_0xb8a4('0x43')]=_[_0xb8a4('0x45')](db[_0xb8a4('0x7f')][_0xb8a4('0x40')]);_0x5f4bb9[_0xb8a4('0x4a')]=_['keys'](_0x32c54d[_0xb8a4('0x4a')]);_0x5f4bb9[_0xb8a4('0x46')]=_[_0xb8a4('0x48')](_0x5f4bb9[_0xb8a4('0x43')],_0x5f4bb9[_0xb8a4('0x4a')]);_0x3d0de5[_0xb8a4('0x47')]=_[_0xb8a4('0x48')](_0x5f4bb9[_0xb8a4('0x43')],qs[_0xb8a4('0x49')](_0x32c54d[_0xb8a4('0x4a')][_0xb8a4('0x49')]));_0x3d0de5[_0xb8a4('0x47')]=_0x3d0de5[_0xb8a4('0x47')]['length']?_0x3d0de5[_0xb8a4('0x47')]:_0x5f4bb9[_0xb8a4('0x43')];_0x3d0de5[_0xb8a4('0x4d')]=qs[_0xb8a4('0x4e')](_0x32c54d['query'][_0xb8a4('0x4e')]);_0x3d0de5[_0xb8a4('0x4f')]=qs[_0xb8a4('0x46')](_[_0xb8a4('0x50')](_0x32c54d['query'],_0x5f4bb9[_0xb8a4('0x46')]));if(_0x32c54d['query'][_0xb8a4('0x65')]){_0x3d0de5[_0xb8a4('0x4f')]=_[_0xb8a4('0x57')](_0x3d0de5['where'],{'$or':_['map'](_0x3d0de5[_0xb8a4('0x47')],function(_0x2560b0){var _0x5f29fc={};_0x5f29fc[_0x2560b0]={'$like':'%'+_0x32c54d[_0xb8a4('0x4a')][_0xb8a4('0x65')]+'%'};return _0x5f29fc;})});}_0x3d0de5=_[_0xb8a4('0x57')]({},_0x3d0de5,_0x32c54d[_0xb8a4('0x52')]);return _0xe427ad['getApplications'](_0x3d0de5);}})[_0xb8a4('0x21')](function(_0xfd01e7){if(_0xfd01e7){_0x46ca32=_0xfd01e7[_0xb8a4('0x55')];if(!_0x32c54d[_0xb8a4('0x4a')]['hasOwnProperty'](_0xb8a4('0x4c'))){_0x3d0de5[_0xb8a4('0x32')]=qs[_0xb8a4('0x32')](_0x32c54d[_0xb8a4('0x4a')][_0xb8a4('0x32')]);_0x3d0de5[_0xb8a4('0x30')]=qs[_0xb8a4('0x30')](_0x32c54d[_0xb8a4('0x4a')]['offset']);}return _0xe427ad['getApplications'](_0x3d0de5);}})[_0xb8a4('0x21')](function(_0x155dd8){if(_0x155dd8){return _0x155dd8?{'count':_0x46ca32,'rows':_0x155dd8}:null;}})[_0xb8a4('0x21')](respondWithResult(_0x4c93a5,null))['catch'](handleError(_0x4c93a5,null));};function Extension(_0x2b9728,_0x3ac77d,_0x28b670,_0x5a1245){this[_0xb8a4('0x84')]=_0xb8a4('0x85');this[_0xb8a4('0x86')]=_0x2b9728['localstationid'];this[_0xb8a4('0x87')]=_0x5a1245;this[_0xb8a4('0x41')]=_0xb8a4('0x88');this[_0xb8a4('0x89')]=_0xb8a4('0x8a');this[_0xb8a4('0x62')]=_0x2b9728['id'];this[_0xb8a4('0x80')]=_0x3ac77d;this[_0xb8a4('0x8b')]=_0x28b670;}function createExtensionsReciveFax(_0x5e2cec){var _0x5f5ccc=0x1;var _0x571886=[];_0x571886[_0xb8a4('0x8c')](new Extension(_0x5e2cec,_0x5f5ccc,'',_0xb8a4('0x8d')));_0x5f5ccc+=0x1;_0x571886[_0xb8a4('0x8c')](new Extension(_0x5e2cec,_0x5f5ccc,_0xb8a4('0x8e'),_0xb8a4('0x8f')));_0x5f5ccc+=0x1;for(var _0x54d259 in _0x5e2cec){if(_0x5e2cec[_0xb8a4('0x4b')](_0x54d259)&&(_0x54d259===_0xb8a4('0x90')||_0x54d259===_0xb8a4('0x91')||_0x54d259===_0xb8a4('0x92')||_0x54d259==='faxdetect'||_0x54d259===_0xb8a4('0x93')||_0x54d259===_0xb8a4('0x94')||_0x54d259===_0xb8a4('0x95')||_0x54d259==='modem'||_0x54d259==='t38timeout')){_0x571886[_0xb8a4('0x8c')](new Extension(_0x5e2cec,_0x5f5ccc,_0xb8a4('0x96')+_0x54d259+')='+_0x5e2cec[_0x54d259],_0xb8a4('0x8f')));_0x5f5ccc+=0x1;}}_0x571886['push'](new Extension(_0x5e2cec,_0x5f5ccc,'6',_0xb8a4('0x97')));_0x5f5ccc+=0x1;_0x571886[_0xb8a4('0x8c')](new Extension(_0x5e2cec,_0x5f5ccc,_0xb8a4('0x98'),_0xb8a4('0x99')));_0x5f5ccc=0x0;return _0x571886;}exports[_0xb8a4('0x9a')]=function(_0xfa0eeb,_0x4c6201,_0x483262){var _0x4f74a1;return db[_0xb8a4('0x7a')][_0xb8a4('0x9b')](function(_0x5c54ef){return db[_0xb8a4('0x3f')]['create'](_0xfa0eeb['body'],{'transaction':_0x5c54ef})[_0xb8a4('0x21')](function(_0x3ebd0a){_0x4f74a1=_0x3ebd0a[_0xb8a4('0x9c')]({'plain':!![]});return db[_0xb8a4('0x9d')][_0xb8a4('0x7e')](createExtensionsReciveFax(_0x4f74a1),{'transaction':_0x5c54ef});});})[_0xb8a4('0x21')](function(){return _0x4f74a1;})[_0xb8a4('0x21')](respondWithResult(_0x4c6201,null))[_0xb8a4('0x2c')](handleError(_0x4c6201,null));};exports[_0xb8a4('0x9e')]=function(_0x4ae715,_0x9f8dd6,_0x1e6f23){var _0x58141c;return db['sequelize'][_0xb8a4('0x9b')](function(_0x26ba86){return db[_0xb8a4('0x3f')][_0xb8a4('0x37')](_0x4ae715[_0xb8a4('0x5a')],{'where':{'id':_0x4ae715['body']['id']},'transaction':_0x26ba86})[_0xb8a4('0x21')](function(_0x153ead){return db[_0xb8a4('0x9d')]['destroy']({'where':{'FaxAccountId':_0x4ae715[_0xb8a4('0x5a')]['id']},'transaction':_0x26ba86})[_0xb8a4('0x21')](function(_0x248f35){return db[_0xb8a4('0x9d')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x4ae715[_0xb8a4('0x5a')],[_0xb8a4('0x9f'),_0xb8a4('0x42'),_0xb8a4('0xa0'),_0xb8a4('0xa1'),'TrunkId',_0xb8a4('0xa2')])),{'transaction':_0x26ba86});});});})[_0xb8a4('0x21')](function(){return db[_0xb8a4('0x3f')][_0xb8a4('0xa3')](_0x4ae715[_0xb8a4('0x5a')]['id']);})[_0xb8a4('0x21')](respondWithResult(_0x9f8dd6,null))[_0xb8a4('0x2c')](handleError(_0x9f8dd6,null));};exports[_0xb8a4('0xa4')]=function(_0x4cbde6,_0x59e7a0,_0x54107c){var _0x57f4ad={'raw':!![],'where':{}};var _0x25de87={};var _0x16240d={'count':0x0,'rows':[]};return db[_0xb8a4('0x3f')][_0xb8a4('0x6b')]({'where':{'id':_0x4cbde6[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x59e7a0,null))[_0xb8a4('0x21')](function(_0x131c68){if(_0x131c68){_0x25de87['model']=_['keys'](db['FaxMessage'][_0xb8a4('0x40')]);_0x25de87[_0xb8a4('0x4a')]=_[_0xb8a4('0x45')](_0x4cbde6[_0xb8a4('0x4a')]);_0x25de87[_0xb8a4('0x46')]=_['intersection'](_0x25de87[_0xb8a4('0x43')],_0x25de87[_0xb8a4('0x4a')]);_0x57f4ad[_0xb8a4('0x47')]=_['intersection'](_0x25de87[_0xb8a4('0x43')],qs[_0xb8a4('0x49')](_0x4cbde6['query'][_0xb8a4('0x49')]));_0x57f4ad[_0xb8a4('0x47')]=_0x57f4ad['attributes'][_0xb8a4('0x55')]?_0x57f4ad[_0xb8a4('0x47')]:_0x25de87[_0xb8a4('0x43')];if(!_0x4cbde6[_0xb8a4('0x4a')]['hasOwnProperty']('nolimit')){_0x57f4ad['limit']=qs[_0xb8a4('0x32')](_0x4cbde6[_0xb8a4('0x4a')][_0xb8a4('0x32')]);_0x57f4ad[_0xb8a4('0x30')]=qs[_0xb8a4('0x30')](_0x4cbde6[_0xb8a4('0x4a')][_0xb8a4('0x30')]);}_0x57f4ad[_0xb8a4('0x4d')]=qs[_0xb8a4('0x4e')](_0x4cbde6[_0xb8a4('0x4a')][_0xb8a4('0x4e')]);_0x57f4ad[_0xb8a4('0x4f')]=qs[_0xb8a4('0x46')](_[_0xb8a4('0x50')](_0x4cbde6['query'],_0x25de87['filters']));_0x57f4ad[_0xb8a4('0x4f')][_0xb8a4('0x62')]=_0x131c68['id'];if(_0x4cbde6[_0xb8a4('0x4a')][_0xb8a4('0x65')]){_0x57f4ad[_0xb8a4('0x4f')]=_[_0xb8a4('0x57')](_0x57f4ad[_0xb8a4('0x4f')],{'$or':_['map'](_0x57f4ad[_0xb8a4('0x47')],function(_0x4588d8){var _0x3ccd39={};_0x3ccd39[_0x4588d8]={'$like':'%'+_0x4cbde6['query'][_0xb8a4('0x65')]+'%'};return _0x3ccd39;})});}if(_0x4cbde6['query'][_0xb8a4('0xa5')]){var _0x31f934=_0x4cbde6[_0xb8a4('0x4a')][_0xb8a4('0xa5')]['split'](',');var _0x4690dd={};_0x4690dd[_0x31f934[0x0]]={'$gte':moment(_0x31f934[0x1])['format'](_0xb8a4('0xa6'))};_0x57f4ad[_0xb8a4('0x4f')]=_['merge'](_0x57f4ad['where'],_0x4690dd);}_0x57f4ad=_[_0xb8a4('0x57')]({},_0x57f4ad,_0x4cbde6[_0xb8a4('0x52')]);return db[_0xb8a4('0xa7')]['count']({'where':_0x57f4ad[_0xb8a4('0x4f')]})[_0xb8a4('0x21')](function(_0x31b165){_0x16240d[_0xb8a4('0x33')]=_0x31b165;if(_0x4cbde6[_0xb8a4('0x4a')][_0xb8a4('0x56')]){_0x57f4ad[_0xb8a4('0x53')]=[{'all':!![]}];}return db[_0xb8a4('0xa7')][_0xb8a4('0x66')](_0x57f4ad);})[_0xb8a4('0x21')](function(_0x5f217){_0x16240d['rows']=_0x5f217;return _0x16240d;});}})[_0xb8a4('0x21')](respondWithFilteredResult(_0x59e7a0,_0x57f4ad))[_0xb8a4('0x2c')](handleError(_0x59e7a0,null));};exports[_0xb8a4('0x3c')]=function(_0x160287,_0x54b519,_0x5d2f2e){var _0x2a5276,_0x49dc8d={},_0x4c4b29;if(_0x160287['body']['to']){_0x4c4b29=_0x160287[_0xb8a4('0x5a')]['to'][0x0];}return db[_0xb8a4('0x3f')][_0xb8a4('0x58')]({'where':{'id':_0x160287[_0xb8a4('0x5f')]['id']},'include':[{'model':db[_0xb8a4('0xa8')],'as':'List','include':[{'model':db[_0xb8a4('0x71')],'as':_0xb8a4('0xa9'),'where':{'fax':_0x4c4b29},'limit':0x1,'order':[[_0xb8a4('0xa1'),_0xb8a4('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x54b519,null))[_0xb8a4('0x21')](function(_0x550183){_0x2a5276=_0x550183;if(_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')]&&_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][_0xb8a4('0x55')]){for(var _0x36cb2e=0x0;_0x36cb2e<_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][_0xb8a4('0x55')];_0x36cb2e+=0x1){_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][_0x36cb2e]={'filename':_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][_0x36cb2e][_0xb8a4('0x3b')],'id':_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][_0x36cb2e]['id'],'path':path[_0xb8a4('0xac')](config['root'],_0xb8a4('0xad'),_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][_0x36cb2e][_0xb8a4('0xae')])};}}return respondWithRpcPromise(_0xb8a4('0xaf'),'CheckAfterSend',{'FaxAccountId':_[_0xb8a4('0xb0')](_0x160287[_0xb8a4('0x5f')]['id'])?undefined:_0x160287['params']['id'],'path':_[_0xb8a4('0xb0')](_0x160287['body']['attachments'][0x0]['path'])?undefined:_0x160287['body'][_0xb8a4('0xab')][0x0][_0xb8a4('0x8')],'fax':_[_0xb8a4('0xb0')](_0x160287[_0xb8a4('0x5a')]['to'][0x0])?undefined:_0x160287[_0xb8a4('0x5a')]['to'][0x0]},client9002);})[_0xb8a4('0x21')](function(){if(_0x2a5276){if(_[_0xb8a4('0xb0')](_0x160287['body'][_0xb8a4('0xb1')])){_0x160287[_0xb8a4('0x5a')]['from']=util[_0xb8a4('0xb2')](_0xb8a4('0xb3'),_0x2a5276['name'],_0x2a5276['fax']);}if(_0x2a5276[_0xb8a4('0xb4')]){if(_0x2a5276[_0xb8a4('0xb4')]['Contacts']['length']){return _0x2a5276['List'][_0xb8a4('0xa9')][0x0];}else{return db['CmContact'][_0xb8a4('0x59')](_['defaults'](_0x160287['body'],{'firstName':_0x160287[_0xb8a4('0x5a')]['to'][0x0],'phone':_0x160287[_0xb8a4('0x5a')]['to'][0x0],'fax':_0x160287[_0xb8a4('0x5a')]['to'][0x0],'ListId':_0x2a5276[_0xb8a4('0xa2')]}));}}else{throw new Error(_0xb8a4('0xb5'));}}else{throw new Error(_0xb8a4('0xb6'));}})['then'](function(_0x28c4e3){if(_0x28c4e3){return db['FaxInteraction'][_0xb8a4('0x58')]({'where':{'ContactId':_0x28c4e3['id'],'closed':![],'FaxAccountId':_0x2a5276['id']}})[_0xb8a4('0x21')](function(_0x45663b){if(_0x45663b){return[_0x45663b,![]];}return db[_0xb8a4('0x6f')][_0xb8a4('0x59')]({'UserId':_0x160287[_0xb8a4('0x5b')]['id'],'ContactId':_0x28c4e3['id'],'FaxAccountId':_0x2a5276['id'],'fax':_0x160287['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x160287[_0xb8a4('0x5a')],{'read':![],'body':_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][0x0]['filename'],'FaxAccountId':_0x2a5276['id'],'UserId':_0x160287[_0xb8a4('0x5b')]['id'],'ContactId':_0x28c4e3['id'],'AttachmentId':_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][0x0]['id']})]},{'include':[{'model':db[_0xb8a4('0xa7')],'as':_0xb8a4('0xb7')}]})[_0xb8a4('0x21')](function(_0x293b69){return[_0x293b69,!![]];});});}else{throw new Error(_0xb8a4('0xb8'));}})[_0xb8a4('0xb9')](function(_0x1de8f2,_0x388096){if(_0x388096){return _0x1de8f2;}return db['FaxMessage'][_0xb8a4('0x59')]({'direction':_0xb8a4('0xba'),'read':![],'body':_0x160287[_0xb8a4('0x5a')][_0xb8a4('0xab')][0x0][_0xb8a4('0xbb')],'FaxAccountId':_0x2a5276['id'],'FaxInteractionId':_0x1de8f2['id'],'UserId':_0x160287['user']['id'],'ContactId':_0x1de8f2[_0xb8a4('0xbc')],'AttachmentId':_0x160287[_0xb8a4('0x5a')]['attachments'][0x0]['id']})[_0xb8a4('0x21')](function(_0xacc11b){_0x1de8f2[_0xb8a4('0xbd')]['Messages']=[];_0x1de8f2[_0xb8a4('0xbd')][_0xb8a4('0xb7')][_0xb8a4('0x8c')](_0xacc11b[_0xb8a4('0xbd')]);return _0x1de8f2;});})[_0xb8a4('0x21')](function(_0x3f1aaa){respondWithRpcPromise('SendFax',_0xb8a4('0xbe'),{'FaxAccountId':_[_0xb8a4('0xb0')](_0x160287['params']['id'])?undefined:_0x160287[_0xb8a4('0x5f')]['id'],'path':_[_0xb8a4('0xb0')](_0x160287['body'][_0xb8a4('0xab')][0x0][_0xb8a4('0x8')])?undefined:_0x160287[_0xb8a4('0x5a')]['attachments'][0x0][_0xb8a4('0x8')],'fax':_[_0xb8a4('0xb0')](_0x160287[_0xb8a4('0x5a')]['to'][0x0])?undefined:_0x160287['body']['to'][0x0],'AttachmentId':_0x160287[_0xb8a4('0x5a')]['attachments'][0x0]['id']},client9002)[_0xb8a4('0x21')](function(_0x3ada33){logger['info'](_0xb8a4('0xbf'),_0x3ada33);})[_0xb8a4('0x2c')](function(_0x5135e6){logger[_0xb8a4('0x2a')]('SendFaxRpc,\x20%s',_0x5135e6);});return _0x3f1aaa;})[_0xb8a4('0x21')](respondWithResult(_0x54b519,null))[_0xb8a4('0x2c')](handleError(_0x54b519,null));};exports['addAgents']=function(_0x4a76d1,_0x3c1c94,_0x47015c){return db['FaxAccount'][_0xb8a4('0x58')]({'where':{'id':_0x4a76d1['params']['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x3c1c94,null))[_0xb8a4('0x21')](function(_0x208444){if(_0x208444){return _0x208444[_0xb8a4('0xc0')](_0x4a76d1['body'][_0xb8a4('0x6d')],_[_0xb8a4('0x70')](_0x4a76d1['body'],[_0xb8a4('0x6d'),'id'])||{})[_0xb8a4('0xb9')](function(_0x375b2c){for(var _0x57569d=0x0;_0x57569d<_0x4a76d1[_0xb8a4('0x5a')][_0xb8a4('0x6d')][_0xb8a4('0x55')];_0x57569d+=0x1){socket['emit'](_0xb8a4('0xc1'),{'UserId':Number(_0x4a76d1['body'][_0xb8a4('0x6d')][_0x57569d]),'FaxAccountId':Number(_0x4a76d1[_0xb8a4('0x5f')]['id'])});}return _0x375b2c;});}})['then'](respondWithResult(_0x3c1c94,null))[_0xb8a4('0x2c')](handleError(_0x3c1c94,null));};exports[_0xb8a4('0xc2')]=function(_0x3288f6,_0x4a31b5,_0x38284e){return db['FaxAccount']['find']({'where':{'id':_0x3288f6[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x4a31b5,null))[_0xb8a4('0x21')](function(_0x41dafc){if(_0x41dafc){return _0x41dafc[_0xb8a4('0xc2')](_0x3288f6[_0xb8a4('0x4a')][_0xb8a4('0x6d')])[_0xb8a4('0x21')](function(){if(_[_0xb8a4('0xc3')](_0x3288f6['query'][_0xb8a4('0x6d')])){for(var _0x4e3f01=0x0;_0x4e3f01<_0x3288f6[_0xb8a4('0x4a')]['ids']['length'];_0x4e3f01+=0x1){socket['emit'](_0xb8a4('0xc4'),{'UserId':Number(_0x3288f6[_0xb8a4('0x4a')][_0xb8a4('0x6d')][_0x4e3f01]),'FaxAccountId':Number(_0x3288f6['params']['id'])});}}else{socket[_0xb8a4('0xc5')](_0xb8a4('0xc4'),{'UserId':Number(_0x3288f6[_0xb8a4('0x4a')][_0xb8a4('0x6d')]),'FaxAccountId':Number(_0x3288f6[_0xb8a4('0x5f')]['id'])});}});}})[_0xb8a4('0x21')](respondWithStatusCode(_0x4a31b5,null))['catch'](handleError(_0x4a31b5,null));};exports[_0xb8a4('0xc6')]=function(_0x4d14cc,_0x56aabe,_0x2dd944){var _0x4f5a0e={};var _0x3699b2={};var _0x2d3094;var _0x5d7a72;return db[_0xb8a4('0x3f')][_0xb8a4('0x6b')]({'where':{'id':_0x4d14cc[_0xb8a4('0x5f')]['id']}})[_0xb8a4('0x21')](handleEntityNotFound(_0x56aabe,null))[_0xb8a4('0x21')](function(_0x5d006b){if(_0x5d006b){_0x2d3094=_0x5d006b;_0x3699b2[_0xb8a4('0x43')]=_[_0xb8a4('0x45')](db['User'][_0xb8a4('0x40')]);_0x3699b2[_0xb8a4('0x4a')]=_[_0xb8a4('0x45')](_0x4d14cc[_0xb8a4('0x4a')]);_0x3699b2[_0xb8a4('0x46')]=_[_0xb8a4('0x48')](_0x3699b2[_0xb8a4('0x43')],_0x3699b2['query']);_0x4f5a0e[_0xb8a4('0x47')]=_['intersection'](_0x3699b2[_0xb8a4('0x43')],qs[_0xb8a4('0x49')](_0x4d14cc[_0xb8a4('0x4a')]['fields']));_0x4f5a0e['attributes']=_0x4f5a0e['attributes'][_0xb8a4('0x55')]?_0x4f5a0e[_0xb8a4('0x47')]:_0x3699b2[_0xb8a4('0x43')];_0x4f5a0e[_0xb8a4('0x4d')]=qs[_0xb8a4('0x4e')](_0x4d14cc[_0xb8a4('0x4a')][_0xb8a4('0x4e')]);_0x4f5a0e[_0xb8a4('0x4f')]=qs[_0xb8a4('0x46')](_[_0xb8a4('0x50')](_0x4d14cc[_0xb8a4('0x4a')],_0x3699b2[_0xb8a4('0x46')]));if(_0x4d14cc[_0xb8a4('0x4a')][_0xb8a4('0x65')]){_0x4f5a0e[_0xb8a4('0x4f')]=_[_0xb8a4('0x57')](_0x4f5a0e[_0xb8a4('0x4f')],{'$or':_[_0xb8a4('0x44')](_0x4f5a0e[_0xb8a4('0x47')],function(_0x56c4fd){var _0x9c79ab={};_0x9c79ab[_0x56c4fd]={'$like':'%'+_0x4d14cc[_0xb8a4('0x4a')][_0xb8a4('0x65')]+'%'};return _0x9c79ab;})});}_0x4f5a0e=_[_0xb8a4('0x57')]({},_0x4f5a0e,_0x4d14cc[_0xb8a4('0x52')]);return _0x2d3094[_0xb8a4('0xc6')](_0x4f5a0e);}})[_0xb8a4('0x21')](function(_0x5f0526){if(_0x5f0526){_0x5d7a72=_0x5f0526[_0xb8a4('0x55')];if(!_0x4d14cc['query'][_0xb8a4('0x4b')](_0xb8a4('0x4c'))){_0x4f5a0e[_0xb8a4('0x32')]=qs[_0xb8a4('0x32')](_0x4d14cc['query'][_0xb8a4('0x32')]);_0x4f5a0e[_0xb8a4('0x30')]=qs[_0xb8a4('0x30')](_0x4d14cc[_0xb8a4('0x4a')]['offset']);}return _0x2d3094[_0xb8a4('0xc6')](_0x4f5a0e);}})['then'](function(_0x2bf7f7){if(_0x2bf7f7){return _0x2bf7f7?{'count':_0x5d7a72,'rows':_0x2bf7f7}:null;}})[_0xb8a4('0x21')](respondWithResult(_0x56aabe,null))[_0xb8a4('0x2c')](handleError(_0x56aabe,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index ff5451f..428c7fc 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 _0x54ac=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','emit'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x54ac,0x159));var _0xc54a=function(_0xbb0ce8,_0xb63549){_0xbb0ce8=_0xbb0ce8-0x0;var _0x1a1b17=_0x54ac[_0xbb0ce8];return _0x1a1b17;};'use strict';var EventEmitter=require(_0xc54a('0x0'));var FaxAccount=require(_0xc54a('0x1'))['db'][_0xc54a('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc54a('0x3')](0x0);var events={'afterCreate':_0xc54a('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x7b9a2e){return function(_0x508ddd,_0x44abea,_0x3d8562){FaxAccountEvents[_0xc54a('0x5')](_0x7b9a2e+':'+_0x508ddd['id'],_0x508ddd);FaxAccountEvents['emit'](_0x7b9a2e,_0x508ddd);_0x3d8562(null);};}for(var e in events){if(events[_0xc54a('0x6')](e)){var event=events[e];FaxAccount[_0xc54a('0x7')](e,emitEvent(event));}}module[_0xc54a('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x0c71=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x3cd204,_0x273fe7){var _0x2338d4=function(_0x1a95b5){while(--_0x1a95b5){_0x3cd204['push'](_0x3cd204['shift']());}};_0x2338d4(++_0x273fe7);}(_0x0c71,0xfb));var _0x10c7=function(_0x36d554,_0xbf52a0){_0x36d554=_0x36d554-0x0;var _0x3718f8=_0x0c71[_0x36d554];return _0x3718f8;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x10c7('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x10c7('0x1')](0x0);var events={'afterCreate':_0x10c7('0x2'),'afterUpdate':_0x10c7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5832f1){return function(_0xa72176,_0x57f92f,_0x2397ae){FaxAccountEvents[_0x10c7('0x4')](_0x5832f1+':'+_0xa72176['id'],_0xa72176);FaxAccountEvents[_0x10c7('0x4')](_0x5832f1,_0xa72176);_0x2397ae(null);};}for(var e in events){if(events[_0x10c7('0x5')](e)){var event=events[e];FaxAccount[_0x10c7('0x6')](e,emitEvent(event));}}module[_0x10c7('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index e43ec80..a98c49e 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 _0x00fa=['FaxAccount','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x3b3dff,_0x1fe6e0){var _0x12e19b=function(_0x3f02b7){while(--_0x3f02b7){_0x3b3dff['push'](_0x3b3dff['shift']());}};_0x12e19b(++_0x1fe6e0);}(_0x00fa,0xc7));var _0xa00f=function(_0x3ab769,_0x435be9){_0x3ab769=_0x3ab769-0x0;var _0x5e193f=_0x00fa[_0x3ab769];return _0x5e193f;};'use strict';var _=require(_0xa00f('0x0'));var util=require('util');var logger=require(_0xa00f('0x1'))('api');var moment=require(_0xa00f('0x2'));var BPromise=require(_0xa00f('0x3'));var rp=require(_0xa00f('0x4'));var fs=require('fs');var path=require(_0xa00f('0x5'));var rimraf=require(_0xa00f('0x6'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xa00f('0x7')]=function(_0x5c10e5,_0x16c314){return _0x5c10e5['define'](_0xa00f('0x8'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x740e=['rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4c4b63,_0x18703c){var _0x1a10e4=function(_0x26bc6b){while(--_0x26bc6b){_0x4c4b63['push'](_0x4c4b63['shift']());}};_0x1a10e4(++_0x18703c);}(_0x740e,0x123));var _0xe740=function(_0x143e1f,_0x51102b){_0x143e1f=_0x143e1f-0x0;var _0x45aee3=_0x740e[_0x143e1f];return _0x45aee3;};'use strict';var _=require(_0xe740('0x0'));var util=require(_0xe740('0x1'));var logger=require(_0xe740('0x2'))(_0xe740('0x3'));var moment=require('moment');var BPromise=require(_0xe740('0x4'));var rp=require(_0xe740('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe740('0x6'));var config=require(_0xe740('0x7'));var attributes=require(_0xe740('0x8'));module['exports']=function(_0x1363ce,_0x553dbe){return _0x1363ce[_0xe740('0x9')](_0xe740('0xa'),attributes,{'tableName':'fax_accounts','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 51b288e..6972964 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 _0xb01b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','include','model','map','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','List','DESC','FaxApplication','Applications','get','account','applications','list','asc','Contacts','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xb01b,0x173));var _0xbb01=function(_0x201625,_0x198ddc){_0x201625=_0x201625-0x0;var _0x2e1f6b=_0xb01b[_0x201625];return _0x2e1f6b;};'use strict';var _=require(_0xbb01('0x0'));var util=require(_0xbb01('0x1'));var moment=require(_0xbb01('0x2'));var BPromise=require(_0xbb01('0x3'));var rs=require(_0xbb01('0x4'));var fs=require('fs');var Redis=require(_0xbb01('0x5'));var db=require(_0xbb01('0x6'))['db'];var utils=require(_0xbb01('0x7'));var logger=require(_0xbb01('0x8'))(_0xbb01('0x9'));var config=require(_0xbb01('0xa'));var jayson=require(_0xbb01('0xb'));var client=jayson[_0xbb01('0xc')][_0xbb01('0xd')]({'port':0x232c});config[_0xbb01('0xe')]=_[_0xbb01('0xf')](config[_0xbb01('0xe')],{'host':_0xbb01('0x10'),'port':0x18eb});var socket=require(_0xbb01('0x11'))(new Redis(config['redis']));require(_0xbb01('0x12'))['register'](socket);function respondWithRpcPromise(_0x5a76c9,_0x1c3279,_0x3f129e){return new BPromise(function(_0x185f55,_0x1ff45c){return client[_0xbb01('0x13')](_0x5a76c9,_0x3f129e)[_0xbb01('0x14')](function(_0x329811){logger[_0xbb01('0x15')]('FaxAccount,\x20%s,\x20%s',_0x1c3279,_0xbb01('0x16'));logger[_0xbb01('0x17')](_0xbb01('0x18'),_0x1c3279,'request\x20sent',JSON[_0xbb01('0x19')](_0x329811));if(_0x329811[_0xbb01('0x1a')]){if(_0x329811[_0xbb01('0x1a')][_0xbb01('0x1b')]===0x1f4){logger['error'](_0xbb01('0x1c'),_0x1c3279,_0x329811[_0xbb01('0x1a')][_0xbb01('0x1d')]);return _0x1ff45c(_0x329811[_0xbb01('0x1a')][_0xbb01('0x1d')]);}logger[_0xbb01('0x1a')](_0xbb01('0x1c'),_0x1c3279,_0x329811['error'][_0xbb01('0x1d')]);return _0x185f55(_0x329811[_0xbb01('0x1a')][_0xbb01('0x1d')]);}else{logger[_0xbb01('0x15')](_0xbb01('0x1c'),_0x1c3279,_0xbb01('0x16'));_0x185f55(_0x329811['result'][_0xbb01('0x1d')]);}})['catch'](function(_0x523856){logger[_0xbb01('0x1a')](_0xbb01('0x1c'),_0x1c3279,_0x523856);_0x1ff45c(_0x523856);});});}exports[_0xbb01('0x1e')]=function(_0x3335ac){var _0xcd7074=this;return new Promise(function(_0x371dc4,_0x4735aa){return db[_0xbb01('0x1f')][_0xbb01('0x20')]({'raw':_0x3335ac[_0xbb01('0x21')]?_0x3335ac[_0xbb01('0x21')][_0xbb01('0x22')]===undefined?!![]:![]:!![],'where':_0x3335ac['options']?_0x3335ac['options']['where']||null:null,'attributes':_0x3335ac[_0xbb01('0x21')]?_0x3335ac[_0xbb01('0x21')][_0xbb01('0x23')]||null:null,'limit':_0x3335ac[_0xbb01('0x21')]?_0x3335ac['options']['limit']||null:null,'include':_0x3335ac[_0xbb01('0x21')]?_0x3335ac[_0xbb01('0x21')][_0xbb01('0x24')]?_['map'](_0x3335ac[_0xbb01('0x21')][_0xbb01('0x24')],function(_0x125d56){return{'model':db[_0x125d56[_0xbb01('0x25')]],'as':_0x125d56['as'],'attributes':_0x125d56[_0xbb01('0x23')],'include':_0x125d56[_0xbb01('0x24')]?_[_0xbb01('0x26')](_0x125d56[_0xbb01('0x24')],function(_0xb7a682){return{'model':db[_0xb7a682['model']],'as':_0xb7a682['as'],'attributes':_0xb7a682[_0xbb01('0x23')],'include':_0xb7a682[_0xbb01('0x24')]?_[_0xbb01('0x26')](_0xb7a682[_0xbb01('0x24')],function(_0x4fe992){return{'model':db[_0x4fe992[_0xbb01('0x25')]],'as':_0x4fe992['as'],'attributes':_0x4fe992[_0xbb01('0x23')]};}):[]};}):[]};}):[]:[]})[_0xbb01('0x14')](function(_0x21b897){logger[_0xbb01('0x15')](_0xbb01('0x1e'),_0x3335ac);logger[_0xbb01('0x17')](_0xbb01('0x1e'),_0x3335ac,JSON[_0xbb01('0x19')](_0x21b897));_0x371dc4(_0x21b897);})['catch'](function(_0x3c5e7f){logger[_0xbb01('0x1a')]('GetFaxAccount',_0x3c5e7f[_0xbb01('0x1d')],_0x3335ac);_0x4735aa(_0xcd7074['error'](0x1f4,_0x3c5e7f[_0xbb01('0x1d')]));});});};exports[_0xbb01('0x27')]=function(_0x4a047d,_0x314790,_0x1c1da4){var _0xb43c8=this;return new Promise(function(_0x5b13d1,_0xc6f880){var _0x269e40={'body':_0x4a047d[_0xbb01('0x28')],'channel':_0xbb01('0x29')};var _0x107efa=[];var _0xcfbff0=[];var _0x278c91={};return db[_0xbb01('0x2a')][_0xbb01('0x2b')]()[_0xbb01('0x14')](function(_0x45b34c){if(!_0x45b34c){throw new db[(_0xbb01('0x2c'))][(_0xbb01('0x2d'))](_0xbb01('0x2e'));}_0x107efa=_['difference'](_[_0xbb01('0x2f')](_0x45b34c),[_0xbb01('0x30'),_0xbb01('0x31')]);_0xcfbff0=_[_0xbb01('0x32')](_['keys'](_0x45b34c),[_0xbb01('0x30'),_0xbb01('0x31'),_0xbb01('0x33'),_0xbb01('0x34')]);if(_0x4a047d[_0xbb01('0x28')]['id']){delete _0x4a047d[_0xbb01('0x28')]['id'];}if(_['isNil'](_0x4a047d[_0xbb01('0x28')][_0xbb01('0x35')])){throw new db['Sequelize'][(_0xbb01('0x2d'))]('from\x20is\x20mandatory');}if(_[_0xbb01('0x36')](_0x4a047d[_0xbb01('0x28')][_0xbb01('0x28')])||_0x4a047d['body'][_0xbb01('0x28')]===''){throw new db[(_0xbb01('0x2c'))][(_0xbb01('0x2d'))](_0xbb01('0x37'));}if(_['isNil'](_0x4a047d[_0xbb01('0x28')][_0xbb01('0x38')])){throw new db[(_0xbb01('0x2c'))][(_0xbb01('0x2d'))](_0xbb01('0x39')+_0xcfbff0);}if(!_[_0xbb01('0x3a')](_0xcfbff0,_0x4a047d[_0xbb01('0x28')]['mapKey'])){throw new db[(_0xbb01('0x2c'))][(_0xbb01('0x2d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xcfbff0);}_0x278c91[_0x4a047d[_0xbb01('0x28')]['mapKey']]=_0x4a047d[_0xbb01('0x28')][_0xbb01('0x35')];})['then'](function(){return db[_0xbb01('0x1f')][_0xbb01('0x3b')]({'where':{'id':_0x4a047d['account']['id']},'include':[{'model':db['CmList'],'as':_0xbb01('0x3c'),'include':[{'model':db[_0xbb01('0x2a')],'as':'Contacts','where':_0x278c91,'limit':0x1,'order':[[_0xbb01('0x31'),_0xbb01('0x3d')]]}]},{'model':db[_0xbb01('0x3e')],'as':_0xbb01('0x3f')}]});})['then'](function(_0x550c17){if(_0x550c17&&_0x550c17[_0xbb01('0x3c')]){var _0x290b4f=_0x550c17[_0xbb01('0x40')]({'plain':!![]});_0x269e40[_0xbb01('0x41')]=_0x290b4f;_0x269e40[_0xbb01('0x42')]=_0x290b4f[_0xbb01('0x3f')];_0x269e40[_0xbb01('0x43')]=_0x290b4f[_0xbb01('0x3c')];_0x269e40['applications']=_['orderBy'](_0x269e40[_0xbb01('0x42')],['priority'],[_0xbb01('0x44')]);if(_0x269e40[_0xbb01('0x41')][_0xbb01('0x3f')]){delete _0x269e40[_0xbb01('0x41')][_0xbb01('0x3f')];}if(_0x269e40[_0xbb01('0x41')][_0xbb01('0x3c')]&&_0x269e40[_0xbb01('0x41')]['List'][_0xbb01('0x45')][_0xbb01('0x46')]){return _0x269e40['account']['List']['Contacts'][0x0];}var _0x2590f6=_[_0xbb01('0xf')](_0x4a047d['body'],{'firstName':_0x4a047d['body'][_0xbb01('0x35')],'ListId':_0x290b4f[_0xbb01('0x34')]});_0x2590f6[_0x4a047d[_0xbb01('0x28')][_0xbb01('0x38')]]=_0x4a047d[_0xbb01('0x28')][_0xbb01('0x35')];return db[_0xbb01('0x2a')][_0xbb01('0x47')](_0x2590f6,{'fields':_0x107efa,'raw':!![]});}})['then'](function(_0x1e8a96){_0x269e40[_0xbb01('0x48')]=_0x1e8a96;if(_0x1e8a96){var _0x5effb9={'ContactId':_0x1e8a96['id'],'FaxAccountId':_0x4a047d[_0xbb01('0x41')]['id'],'fax':_0x1e8a96[_0xbb01('0x29')]};return db[_0xbb01('0x49')][_0xbb01('0x3b')]({'where':{'ContactId':_0x1e8a96['id'],'closed':![],'FaxAccountId':_0x4a047d['account']['id']}})[_0xbb01('0x14')](function(_0x245f70){if(_0x245f70){return[_0x245f70,![]];}return db[_0xbb01('0x49')][_0xbb01('0x47')](_0x5effb9)['then'](function(_0x362d11){return[_0x362d11,!![]];});});}else{throw new Error(_0xbb01('0x4a'));}})[_0xbb01('0x4b')](function(_0xecbd26,_0x2f596e){var _0x12c9df=_0xecbd26[_0xbb01('0x40')]({'plain':!![]});if(_0x2f596e){if(_0x269e40[_0xbb01('0x41')][_0xbb01('0x4c')]){_0x269e40[_0xbb01('0x42')][_0xbb01('0x4d')]({'id':0x0,'priority':_0x269e40['applications'][_0xbb01('0x46')]+0x1,'app':'close','appdata':_0xbb01('0x4e'),'interval':'*,*,*,*'});}_0x12c9df['created']=!![];}else{_0x12c9df[_0xbb01('0x4f')]=![];}_0x269e40['interaction']=_0x12c9df;return db[_0xbb01('0x50')][_0xbb01('0x47')]({'body':_0x4a047d['body'][_0xbb01('0x28')],'FaxAccountId':_0x4a047d[_0xbb01('0x41')]['id'],'FaxInteractionId':_0xecbd26['id'],'direction':'in','ContactId':_0xecbd26[_0xbb01('0x51')],'AttachmentId':_0x4a047d[_0xbb01('0x28')][_0xbb01('0x52')]});})[_0xbb01('0x14')](function(_0x805817){_0x269e40[_0xbb01('0x1d')]=_0x805817;if(_0x269e40[_0xbb01('0x53')][_0xbb01('0x54')]){return db[_0xbb01('0x55')]['find']({'attributes':['id',_0xbb01('0x56')],'where':{'id':_0x269e40[_0xbb01('0x53')][_0xbb01('0x54')]}})[_0xbb01('0x14')](function(_0x5130ff){if(_0x5130ff){_0x269e40['applications'][_0xbb01('0x57')]({'id':0x0,'priority':0x0,'app':_0xbb01('0x58'),'appdata':_0x5130ff[_0xbb01('0x56')]+','+(_0x269e40[_0xbb01('0x41')][_0xbb01('0x59')]||0xa),'interval':_0xbb01('0x5a')});}return respondWithRpcPromise(_0xbb01('0x5b'),_0xbb01('0x5c'),_0x269e40);});}return respondWithRpcPromise(_0xbb01('0x5b'),_0xbb01('0x5c'),_0x269e40);})[_0xbb01('0x14')](function(_0x5987c0){_0x5b13d1(_0x5987c0);})[_0xbb01('0x5d')](function(_0x45026e){_0xc6f880(_0xb43c8[_0xbb01('0x1a')](0x1f4,_0x45026e['message']));});});}; \ No newline at end of file +var _0xd8bc=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','get','applications','Applications','list','orderBy','priority','account','length','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','register','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','FaxAccount','options','where','attributes','limit','include','map','model','NotifyFaxAccount','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','ListId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey'];(function(_0x5be55c,_0x2190b7){var _0x1aea2b=function(_0x56212a){while(--_0x56212a){_0x5be55c['push'](_0x5be55c['shift']());}};_0x1aea2b(++_0x2190b7);}(_0xd8bc,0xd1));var _0xcd8b=function(_0x44e755,_0x346947){_0x44e755=_0x44e755-0x0;var _0x10e812=_0xd8bc[_0x44e755];return _0x10e812;};'use strict';var _=require(_0xcd8b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcd8b('0x1'));var rs=require(_0xcd8b('0x2'));var fs=require('fs');var Redis=require(_0xcd8b('0x3'));var db=require(_0xcd8b('0x4'))['db'];var utils=require(_0xcd8b('0x5'));var logger=require(_0xcd8b('0x6'))(_0xcd8b('0x7'));var config=require('../../config/environment');var jayson=require(_0xcd8b('0x8'));var client=jayson['client'][_0xcd8b('0x9')]({'port':0x232c});config[_0xcd8b('0xa')]=_['defaults'](config[_0xcd8b('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0xcd8b('0xb')](socket);function respondWithRpcPromise(_0x95411b,_0x1736f6,_0x53b0cb){return new BPromise(function(_0x36f53f,_0x1bbd02){return client['request'](_0x95411b,_0x53b0cb)[_0xcd8b('0xc')](function(_0x2722cf){logger[_0xcd8b('0xd')]('FaxAccount,\x20%s,\x20%s',_0x1736f6,_0xcd8b('0xe'));logger[_0xcd8b('0xf')](_0xcd8b('0x10'),_0x1736f6,'request\x20sent',JSON[_0xcd8b('0x11')](_0x2722cf));if(_0x2722cf[_0xcd8b('0x12')]){if(_0x2722cf[_0xcd8b('0x12')][_0xcd8b('0x13')]===0x1f4){logger[_0xcd8b('0x12')]('FaxAccount,\x20%s,\x20%s',_0x1736f6,_0x2722cf[_0xcd8b('0x12')]['message']);return _0x1bbd02(_0x2722cf[_0xcd8b('0x12')][_0xcd8b('0x14')]);}logger[_0xcd8b('0x12')](_0xcd8b('0x15'),_0x1736f6,_0x2722cf[_0xcd8b('0x12')]['message']);return _0x36f53f(_0x2722cf['error'][_0xcd8b('0x14')]);}else{logger['info'](_0xcd8b('0x15'),_0x1736f6,_0xcd8b('0xe'));_0x36f53f(_0x2722cf[_0xcd8b('0x16')][_0xcd8b('0x14')]);}})[_0xcd8b('0x17')](function(_0x4cb511){logger[_0xcd8b('0x12')](_0xcd8b('0x15'),_0x1736f6,_0x4cb511);_0x1bbd02(_0x4cb511);});});}exports[_0xcd8b('0x18')]=function(_0x38e32e){var _0x3ca6ef=this;return new Promise(function(_0x212906,_0x274db7){return db[_0xcd8b('0x19')]['findAll']({'raw':_0x38e32e[_0xcd8b('0x1a')]?_0x38e32e[_0xcd8b('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x38e32e['options']?_0x38e32e[_0xcd8b('0x1a')][_0xcd8b('0x1b')]||null:null,'attributes':_0x38e32e[_0xcd8b('0x1a')]?_0x38e32e[_0xcd8b('0x1a')][_0xcd8b('0x1c')]||null:null,'limit':_0x38e32e['options']?_0x38e32e['options'][_0xcd8b('0x1d')]||null:null,'include':_0x38e32e[_0xcd8b('0x1a')]?_0x38e32e[_0xcd8b('0x1a')][_0xcd8b('0x1e')]?_[_0xcd8b('0x1f')](_0x38e32e[_0xcd8b('0x1a')][_0xcd8b('0x1e')],function(_0x5e7470){return{'model':db[_0x5e7470[_0xcd8b('0x20')]],'as':_0x5e7470['as'],'attributes':_0x5e7470[_0xcd8b('0x1c')],'include':_0x5e7470[_0xcd8b('0x1e')]?_[_0xcd8b('0x1f')](_0x5e7470[_0xcd8b('0x1e')],function(_0x352195){return{'model':db[_0x352195[_0xcd8b('0x20')]],'as':_0x352195['as'],'attributes':_0x352195[_0xcd8b('0x1c')],'include':_0x352195[_0xcd8b('0x1e')]?_[_0xcd8b('0x1f')](_0x352195['include'],function(_0x478ded){return{'model':db[_0x478ded[_0xcd8b('0x20')]],'as':_0x478ded['as'],'attributes':_0x478ded[_0xcd8b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcd8b('0xc')](function(_0x47f8bd){logger[_0xcd8b('0xd')](_0xcd8b('0x18'),_0x38e32e);logger[_0xcd8b('0xf')](_0xcd8b('0x18'),_0x38e32e,JSON[_0xcd8b('0x11')](_0x47f8bd));_0x212906(_0x47f8bd);})[_0xcd8b('0x17')](function(_0x283fb7){logger[_0xcd8b('0x12')](_0xcd8b('0x18'),_0x283fb7['message'],_0x38e32e);_0x274db7(_0x3ca6ef[_0xcd8b('0x12')](0x1f4,_0x283fb7[_0xcd8b('0x14')]));});});};exports[_0xcd8b('0x21')]=function(_0x1a3a83,_0x1ce5a5,_0x2fa30e){var _0x40b1aa=this;return new Promise(function(_0x1aff43,_0x435bb3){var _0x164060={'body':_0x1a3a83['body'],'channel':'fax'};var _0x1e086b=[];var _0x3ba38c=[];var _0x345886={};return db['CmContact'][_0xcd8b('0x22')]()[_0xcd8b('0xc')](function(_0x2767a2){if(!_0x2767a2){throw new db[(_0xcd8b('0x23'))][(_0xcd8b('0x24'))](_0xcd8b('0x25'));}_0x1e086b=_[_0xcd8b('0x26')](_[_0xcd8b('0x27')](_0x2767a2),['createdAt',_0xcd8b('0x28')]);_0x3ba38c=_[_0xcd8b('0x26')](_[_0xcd8b('0x27')](_0x2767a2),['createdAt',_0xcd8b('0x28'),'CompanyId',_0xcd8b('0x29')]);if(_0x1a3a83[_0xcd8b('0x2a')]['id']){delete _0x1a3a83[_0xcd8b('0x2a')]['id'];}if(_[_0xcd8b('0x2b')](_0x1a3a83['body']['from'])){throw new db[(_0xcd8b('0x23'))]['ValidationError'](_0xcd8b('0x2c'));}if(_[_0xcd8b('0x2b')](_0x1a3a83['body']['body'])||_0x1a3a83[_0xcd8b('0x2a')][_0xcd8b('0x2a')]===''){throw new db[(_0xcd8b('0x23'))]['ValidationError'](_0xcd8b('0x2d'));}if(_[_0xcd8b('0x2b')](_0x1a3a83['body']['mapKey'])){throw new db['Sequelize'][(_0xcd8b('0x24'))](_0xcd8b('0x2e')+_0x3ba38c);}if(!_[_0xcd8b('0x2f')](_0x3ba38c,_0x1a3a83['body'][_0xcd8b('0x30')])){throw new db[(_0xcd8b('0x23'))][(_0xcd8b('0x24'))](_0xcd8b('0x31')+_0x3ba38c);}_0x345886[_0x1a3a83[_0xcd8b('0x2a')][_0xcd8b('0x30')]]=_0x1a3a83[_0xcd8b('0x2a')][_0xcd8b('0x32')];})[_0xcd8b('0xc')](function(){return db[_0xcd8b('0x19')]['find']({'where':{'id':_0x1a3a83['account']['id']},'include':[{'model':db[_0xcd8b('0x33')],'as':_0xcd8b('0x34'),'include':[{'model':db['CmContact'],'as':_0xcd8b('0x35'),'where':_0x345886,'limit':0x1,'order':[['updatedAt',_0xcd8b('0x36')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})['then'](function(_0x3ca837){if(_0x3ca837&&_0x3ca837[_0xcd8b('0x34')]){var _0x21166c=_0x3ca837[_0xcd8b('0x37')]({'plain':!![]});_0x164060['account']=_0x21166c;_0x164060[_0xcd8b('0x38')]=_0x21166c[_0xcd8b('0x39')];_0x164060[_0xcd8b('0x3a')]=_0x21166c['List'];_0x164060[_0xcd8b('0x38')]=_[_0xcd8b('0x3b')](_0x164060[_0xcd8b('0x38')],[_0xcd8b('0x3c')],['asc']);if(_0x164060[_0xcd8b('0x3d')]['Applications']){delete _0x164060[_0xcd8b('0x3d')]['Applications'];}if(_0x164060[_0xcd8b('0x3d')][_0xcd8b('0x34')]&&_0x164060[_0xcd8b('0x3d')][_0xcd8b('0x34')][_0xcd8b('0x35')][_0xcd8b('0x3e')]){return _0x164060[_0xcd8b('0x3d')][_0xcd8b('0x34')][_0xcd8b('0x35')][0x0];}var _0x12c1d3=_['defaults'](_0x1a3a83[_0xcd8b('0x2a')],{'firstName':_0x1a3a83[_0xcd8b('0x2a')]['from'],'ListId':_0x21166c[_0xcd8b('0x29')]});_0x12c1d3[_0x1a3a83[_0xcd8b('0x2a')][_0xcd8b('0x30')]]=_0x1a3a83[_0xcd8b('0x2a')]['from'];return db['CmContact'][_0xcd8b('0x3f')](_0x12c1d3,{'fields':_0x1e086b,'raw':!![]});}})[_0xcd8b('0xc')](function(_0x59fa3e){_0x164060[_0xcd8b('0x40')]=_0x59fa3e;if(_0x59fa3e){var _0x1d6d40={'ContactId':_0x59fa3e['id'],'FaxAccountId':_0x1a3a83[_0xcd8b('0x3d')]['id'],'fax':_0x59fa3e['fax']};return db[_0xcd8b('0x41')][_0xcd8b('0x42')]({'where':{'ContactId':_0x59fa3e['id'],'closed':![],'FaxAccountId':_0x1a3a83[_0xcd8b('0x3d')]['id']}})[_0xcd8b('0xc')](function(_0x4162f8){if(_0x4162f8){return[_0x4162f8,![]];}return db[_0xcd8b('0x41')][_0xcd8b('0x3f')](_0x1d6d40)[_0xcd8b('0xc')](function(_0x4d5786){return[_0x4d5786,!![]];});});}else{throw new Error(_0xcd8b('0x43'));}})[_0xcd8b('0x44')](function(_0x2513af,_0x3f2043){var _0x5d7c23=_0x2513af[_0xcd8b('0x37')]({'plain':!![]});if(_0x3f2043){if(_0x164060['account'][_0xcd8b('0x45')]){_0x164060[_0xcd8b('0x38')][_0xcd8b('0x46')]({'id':0x0,'priority':_0x164060[_0xcd8b('0x38')][_0xcd8b('0x3e')]+0x1,'app':_0xcd8b('0x47'),'appdata':'unmanaged','interval':_0xcd8b('0x48')});}_0x5d7c23[_0xcd8b('0x49')]=!![];}else{_0x5d7c23[_0xcd8b('0x49')]=![];}_0x164060[_0xcd8b('0x4a')]=_0x5d7c23;return db[_0xcd8b('0x4b')][_0xcd8b('0x3f')]({'body':_0x1a3a83[_0xcd8b('0x2a')][_0xcd8b('0x2a')],'FaxAccountId':_0x1a3a83[_0xcd8b('0x3d')]['id'],'FaxInteractionId':_0x2513af['id'],'direction':'in','ContactId':_0x2513af[_0xcd8b('0x4c')],'AttachmentId':_0x1a3a83[_0xcd8b('0x2a')][_0xcd8b('0x4d')]});})[_0xcd8b('0xc')](function(_0x499d45){_0x164060[_0xcd8b('0x14')]=_0x499d45;if(_0x164060['interaction'][_0xcd8b('0x4e')]){return db[_0xcd8b('0x4f')]['find']({'attributes':['id',_0xcd8b('0x50')],'where':{'id':_0x164060[_0xcd8b('0x4a')][_0xcd8b('0x4e')]}})[_0xcd8b('0xc')](function(_0x568456){if(_0x568456){_0x164060[_0xcd8b('0x38')][_0xcd8b('0x51')]({'id':0x0,'priority':0x0,'app':_0xcd8b('0x52'),'appdata':_0x568456['name']+','+(_0x164060['account'][_0xcd8b('0x53')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcd8b('0x54'),_0xcd8b('0x55'),_0x164060);});}return respondWithRpcPromise('Start',_0xcd8b('0x55'),_0x164060);})[_0xcd8b('0xc')](function(_0x3a4342){_0x1aff43(_0x3a4342);})[_0xcd8b('0x17')](function(_0x7aafcd){_0x435bb3(_0x40b1aa[_0xcd8b('0x12')](0x1f4,_0x7aafcd['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 5cfca74..c57e8c7 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 _0x4a7b=['remove','update','emit','removeListener','length','./faxAccount.events','save'];(function(_0x10f1f7,_0x56f279){var _0x22abcf=function(_0x255584){while(--_0x255584){_0x10f1f7['push'](_0x10f1f7['shift']());}};_0x22abcf(++_0x56f279);}(_0x4a7b,0x1e1));var _0xb4a7=function(_0x1b456f,_0x7682d5){_0x1b456f=_0x1b456f-0x0;var _0xe85d96=_0x4a7b[_0x1b456f];return _0xe85d96;};'use strict';var FaxAccountEvents=require(_0xb4a7('0x0'));var events=[_0xb4a7('0x1'),_0xb4a7('0x2'),_0xb4a7('0x3')];function createListener(_0x3e4e59,_0x3c922e){return function(_0x1ae70c){_0x3c922e[_0xb4a7('0x4')](_0x3e4e59,_0x1ae70c);};}function removeListener(_0x19fbf9,_0x3fb48c){return function(){FaxAccountEvents[_0xb4a7('0x5')](_0x19fbf9,_0x3fb48c);};}exports['register']=function(_0x43e7cf){for(var _0x46f8fe=0x0,_0x2d41b1=events[_0xb4a7('0x6')];_0x46f8fe<_0x2d41b1;_0x46f8fe++){var _0x3dc7df=events[_0x46f8fe];var _0x102a27=createListener('faxAccount:'+_0x3dc7df,_0x43e7cf);FaxAccountEvents['on'](_0x3dc7df,_0x102a27);}}; \ No newline at end of file +var _0x645f=['emit','register','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x1bfbef,_0x41ae01){var _0x360503=function(_0x59576c){while(--_0x59576c){_0x1bfbef['push'](_0x1bfbef['shift']());}};_0x360503(++_0x41ae01);}(_0x645f,0x194));var _0xf645=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x645f[_0x122ef9];return _0x42fba0;};'use strict';var FaxAccountEvents=require(_0xf645('0x0'));var events=[_0xf645('0x1'),_0xf645('0x2'),_0xf645('0x3')];function createListener(_0x43e2fa,_0x2fb562){return function(_0x7e730a){_0x2fb562[_0xf645('0x4')](_0x43e2fa,_0x7e730a);};}function removeListener(_0x47b2f9,_0x34fb28){return function(){FaxAccountEvents['removeListener'](_0x47b2f9,_0x34fb28);};}exports[_0xf645('0x5')]=function(_0x1108e5){for(var _0x45ac4f=0x0,_0x1d89c6=events[_0xf645('0x6')];_0x45ac4f<_0x1d89c6;_0x45ac4f++){var _0x2ae65a=events[_0x45ac4f];var _0x530e58=createListener(_0xf645('0x7')+_0x2ae65a,_0x1108e5);FaxAccountEvents['on'](_0x2ae65a,_0x530e58);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index a9a7090..48fdfd5 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(_0x421b4e,_0x540632){var _0x494faa=function(_0x474865){while(--_0x474865){_0x421b4e['push'](_0x421b4e['shift']());}};_0x494faa(++_0x540632);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x4f5a01,_0x590de4){var _0x3c882a=function(_0x260482){while(--_0x260482){_0x4f5a01['push'](_0x4f5a01['shift']());}};_0x3c882a(++_0x590de4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 dea9065..2e741f0 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 _0xb600=['STRING','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x575020,_0x35bec1){var _0x297ee9=function(_0x4e09f1){while(--_0x4e09f1){_0x575020['push'](_0x575020['shift']());}};_0x297ee9(++_0x35bec1);}(_0xb600,0xee));var _0x0b60=function(_0x5b51d2,_0xd3846c){_0x5b51d2=_0x5b51d2-0x0;var _0x1ecc32=_0xb600[_0x5b51d2];return _0x1ecc32;};'use strict';var Sequelize=require(_0x0b60('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0b60('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0b60('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0b60('0x3')]()},'description':{'type':Sequelize[_0x0b60('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0b60('0x4')}}; \ No newline at end of file +var _0xe350=['*,*,*,*','sequelize','exports','INTEGER','TEXT','STRING'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xe350,0x1c9));var _0x0e35=function(_0x284c2c,_0x46553){_0x284c2c=_0x284c2c-0x0;var _0x266db2=_0xe350[_0x284c2c];return _0x266db2;};'use strict';var Sequelize=require(_0x0e35('0x0'));module[_0x0e35('0x1')]={'priority':{'type':Sequelize[_0x0e35('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0e35('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0e35('0x4')],'defaultValue':_0x0e35('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d9a8d7e..dd1d106 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 _0x348f=['set','Content-Range','apply','reject','save','update','then','error','stack','send','FaxApplication','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','body','destroy','eml-format','rimraf','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','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','end','status','json','offset','limit','undefined','count'];(function(_0x33de76,_0x4ec6c7){var _0x551f23=function(_0x2550d7){while(--_0x2550d7){_0x33de76['push'](_0x33de76['shift']());}};_0x551f23(++_0x4ec6c7);}(_0x348f,0x185));var _0xf348=function(_0xd6c4ba,_0x3b3403){_0xd6c4ba=_0xd6c4ba-0x0;var _0x26ad0e=_0x348f[_0xd6c4ba];return _0x26ad0e;};'use strict';var emlformat=require(_0xf348('0x0'));var rimraf=require(_0xf348('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf348('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf348('0x3'));var util=require('util');var path=require(_0xf348('0x4'));var sox=require(_0xf348('0x5'));var csv=require(_0xf348('0x6'));var ejs=require(_0xf348('0x7'));var fs=require('fs');var fs_extra=require(_0xf348('0x8'));var _=require(_0xf348('0x9'));var squel=require('squel');var crypto=require(_0xf348('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf348('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf348('0xc'));var Papa=require('papaparse');var Redis=require(_0xf348('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf348('0xe'));var as=require(_0xf348('0xf'));var hardwareService=require(_0xf348('0x10'));var logger=require(_0xf348('0x11'))(_0xf348('0x12'));var utils=require(_0xf348('0x13'));var config=require(_0xf348('0x14'));var licenseUtil=require(_0xf348('0x15'));var db=require(_0xf348('0x16'))['db'];function respondWithStatusCode(_0x2d0af8,_0x514c5c){_0x514c5c=_0x514c5c||0xcc;return function(_0x4f93be){if(_0x4f93be){return _0x2d0af8[_0xf348('0x17')](_0x514c5c);}return _0x2d0af8['status'](_0x514c5c)[_0xf348('0x18')]();};}function respondWithResult(_0x4fc15c,_0x1972eb){_0x1972eb=_0x1972eb||0xc8;return function(_0xf9729c){if(_0xf9729c){return _0x4fc15c[_0xf348('0x19')](_0x1972eb)[_0xf348('0x1a')](_0xf9729c);}};}function respondWithFilteredResult(_0x276c83,_0x1b0792){return function(_0x26b7b0){if(_0x26b7b0){var _0x1aff8e=typeof _0x1b0792[_0xf348('0x1b')]==='undefined'&&typeof _0x1b0792[_0xf348('0x1c')]===_0xf348('0x1d');var _0xfa685a=_0x26b7b0['count'];var _0x1cf59f=_0x1aff8e?0x0:_0x1b0792[_0xf348('0x1b')];var _0x46dbc0=_0x1aff8e?_0x26b7b0[_0xf348('0x1e')]:_0x1b0792[_0xf348('0x1b')]+_0x1b0792[_0xf348('0x1c')];var _0x17209f;if(_0x46dbc0>=_0xfa685a){_0x46dbc0=_0xfa685a;_0x17209f=0xc8;}else{_0x17209f=0xce;}_0x276c83[_0xf348('0x19')](_0x17209f);return _0x276c83[_0xf348('0x1f')](_0xf348('0x20'),_0x1cf59f+'-'+_0x46dbc0+'/'+_0xfa685a)['json'](_0x26b7b0);}return null;};}function patchUpdates(_0x1db326){return function(_0x126206){try{jsonpatch[_0xf348('0x21')](_0x126206,_0x1db326,!![]);}catch(_0x556d05){return BPromise[_0xf348('0x22')](_0x556d05);}return _0x126206[_0xf348('0x23')]();};}function saveUpdates(_0x360894,_0x37c7df){return function(_0x4cadeb){if(_0x4cadeb){return _0x4cadeb[_0xf348('0x24')](_0x360894)[_0xf348('0x25')](function(_0x51c47d){return _0x51c47d;});}return null;};}function removeEntity(_0x12211e,_0x42bcc9){return function(_0x443b12){if(_0x443b12){return _0x443b12['destroy']()[_0xf348('0x25')](function(){_0x12211e[_0xf348('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x149115,_0x400f1c){return function(_0x556b32){if(!_0x556b32){_0x149115[_0xf348('0x17')](0x194);}return _0x556b32;};}function handleError(_0x3fb70b,_0x569853){_0x569853=_0x569853||0x1f4;return function(_0x142e9b){logger[_0xf348('0x26')](_0x142e9b[_0xf348('0x27')]);if(_0x142e9b['name']){delete _0x142e9b['name'];}_0x3fb70b[_0xf348('0x19')](_0x569853)[_0xf348('0x28')](_0x142e9b);};}exports['index']=function(_0x5ebfed,_0x5866f7){var _0x9d21d9={},_0x5f1dd0={},_0x3d2ee9={'count':0x0,'rows':[]};var _0x327dd5=_['map'](db[_0xf348('0x29')][_0xf348('0x2a')],function(_0x2bd6d5){return{'name':_0x2bd6d5[_0xf348('0x2b')],'type':_0x2bd6d5[_0xf348('0x2c')]['key']};});_0x5f1dd0['model']=_[_0xf348('0x2d')](_0x327dd5,'name');_0x5f1dd0[_0xf348('0x2e')]=_[_0xf348('0x2f')](_0x5ebfed[_0xf348('0x2e')]);_0x5f1dd0[_0xf348('0x30')]=_['intersection'](_0x5f1dd0[_0xf348('0x31')],_0x5f1dd0[_0xf348('0x2e')]);_0x9d21d9[_0xf348('0x32')]=_[_0xf348('0x33')](_0x5f1dd0['model'],qs['fields'](_0x5ebfed[_0xf348('0x2e')][_0xf348('0x34')]));_0x9d21d9[_0xf348('0x32')]=_0x9d21d9[_0xf348('0x32')]['length']?_0x9d21d9[_0xf348('0x32')]:_0x5f1dd0[_0xf348('0x31')];if(!_0x5ebfed[_0xf348('0x2e')]['hasOwnProperty'](_0xf348('0x35'))){_0x9d21d9[_0xf348('0x1c')]=qs[_0xf348('0x1c')](_0x5ebfed[_0xf348('0x2e')]['limit']);_0x9d21d9['offset']=qs['offset'](_0x5ebfed[_0xf348('0x2e')][_0xf348('0x1b')]);}_0x9d21d9['order']=qs[_0xf348('0x36')](_0x5ebfed[_0xf348('0x2e')]['sort']);_0x9d21d9[_0xf348('0x37')]=qs[_0xf348('0x30')](_[_0xf348('0x38')](_0x5ebfed[_0xf348('0x2e')],_0x5f1dd0[_0xf348('0x30')]),_0x327dd5);if(_0x5ebfed[_0xf348('0x2e')][_0xf348('0x39')]){_0x9d21d9[_0xf348('0x37')]=_[_0xf348('0x3a')](_0x9d21d9['where'],{'$or':_['map'](_0x327dd5,function(_0x404f13){if(_0x404f13[_0xf348('0x2c')]!==_0xf348('0x3b')){var _0x5ac506={};_0x5ac506[_0x404f13['name']]={'$like':'%'+_0x5ebfed[_0xf348('0x2e')][_0xf348('0x39')]+'%'};return _0x5ac506;}})});}_0x9d21d9=_[_0xf348('0x3a')]({},_0x9d21d9,_0x5ebfed[_0xf348('0x3c')]);var _0x4bb62a={'where':_0x9d21d9[_0xf348('0x37')]};return db[_0xf348('0x29')]['count'](_0x4bb62a)['then'](function(_0x2dcb8f){_0x3d2ee9[_0xf348('0x1e')]=_0x2dcb8f;if(_0x5ebfed[_0xf348('0x2e')][_0xf348('0x3d')]){_0x9d21d9['include']=[{'all':!![]}];}return db[_0xf348('0x29')][_0xf348('0x3e')](_0x9d21d9);})[_0xf348('0x25')](function(_0x4249ab){_0x3d2ee9['rows']=_0x4249ab;return _0x3d2ee9;})[_0xf348('0x25')](respondWithFilteredResult(_0x5866f7,_0x9d21d9))[_0xf348('0x3f')](handleError(_0x5866f7,null));};exports[_0xf348('0x40')]=function(_0x19f555,_0x117fbf){var _0x3486cf={'raw':!![],'where':{'id':_0x19f555[_0xf348('0x41')]['id']}},_0x53039a={};_0x53039a[_0xf348('0x31')]=_[_0xf348('0x2f')](db[_0xf348('0x29')][_0xf348('0x2a')]);_0x53039a['query']=_[_0xf348('0x2f')](_0x19f555[_0xf348('0x2e')]);_0x53039a[_0xf348('0x30')]=_[_0xf348('0x33')](_0x53039a['model'],_0x53039a[_0xf348('0x2e')]);_0x3486cf[_0xf348('0x32')]=_['intersection'](_0x53039a[_0xf348('0x31')],qs[_0xf348('0x34')](_0x19f555[_0xf348('0x2e')][_0xf348('0x34')]));_0x3486cf['attributes']=_0x3486cf[_0xf348('0x32')]['length']?_0x3486cf['attributes']:_0x53039a[_0xf348('0x31')];if(_0x19f555[_0xf348('0x2e')]['includeAll']){_0x3486cf[_0xf348('0x42')]=[{'all':!![]}];}_0x3486cf=_[_0xf348('0x3a')]({},_0x3486cf,_0x19f555[_0xf348('0x3c')]);return db[_0xf348('0x29')][_0xf348('0x43')](_0x3486cf)[_0xf348('0x25')](handleEntityNotFound(_0x117fbf,null))[_0xf348('0x25')](respondWithResult(_0x117fbf,null))[_0xf348('0x3f')](handleError(_0x117fbf,null));};exports['create']=function(_0x88068d,_0x36d90f){return db[_0xf348('0x29')]['create'](_0x88068d[_0xf348('0x44')],{})[_0xf348('0x25')](respondWithResult(_0x36d90f,0xc9))[_0xf348('0x3f')](handleError(_0x36d90f,null));};exports[_0xf348('0x24')]=function(_0x998673,_0xd9e0e7){if(_0x998673['body']['id']){delete _0x998673[_0xf348('0x44')]['id'];}return db[_0xf348('0x29')]['find']({'where':{'id':_0x998673[_0xf348('0x41')]['id']}})[_0xf348('0x25')](handleEntityNotFound(_0xd9e0e7,null))[_0xf348('0x25')](saveUpdates(_0x998673[_0xf348('0x44')],null))[_0xf348('0x25')](respondWithResult(_0xd9e0e7,null))[_0xf348('0x3f')](handleError(_0xd9e0e7,null));};exports[_0xf348('0x45')]=function(_0xbb859,_0x107dc4){return db[_0xf348('0x29')][_0xf348('0x43')]({'where':{'id':_0xbb859[_0xf348('0x41')]['id']}})['then'](handleEntityNotFound(_0x107dc4,null))[_0xf348('0x25')](removeEntity(_0x107dc4,null))['catch'](handleError(_0x107dc4,null));}; \ No newline at end of file +var _0x0f5f=['apply','update','destroy','then','end','error','stack','name','map','FaxApplication','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','include','rows','catch','includeAll','find','create','body','params','eml-format','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/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x1fcbd8,_0x9da9aa){var _0x3ad2aa=function(_0x35d98d){while(--_0x35d98d){_0x1fcbd8['push'](_0x1fcbd8['shift']());}};_0x3ad2aa(++_0x9da9aa);}(_0x0f5f,0x153));var _0xf0f5=function(_0x577ff1,_0x377206){_0x577ff1=_0x577ff1-0x0;var _0x527bd9=_0x0f5f[_0x577ff1];return _0x527bd9;};'use strict';var emlformat=require(_0xf0f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0f5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0f5('0x2'));var moment=require(_0xf0f5('0x3'));var BPromise=require(_0xf0f5('0x4'));var Mustache=require(_0xf0f5('0x5'));var util=require(_0xf0f5('0x6'));var path=require(_0xf0f5('0x7'));var sox=require(_0xf0f5('0x8'));var csv=require(_0xf0f5('0x9'));var ejs=require(_0xf0f5('0xa'));var fs=require('fs');var fs_extra=require(_0xf0f5('0xb'));var _=require(_0xf0f5('0xc'));var squel=require(_0xf0f5('0xd'));var crypto=require(_0xf0f5('0xe'));var jsforce=require(_0xf0f5('0xf'));var deskjs=require(_0xf0f5('0x10'));var toCsv=require(_0xf0f5('0x9'));var querystring=require(_0xf0f5('0x11'));var Papa=require(_0xf0f5('0x12'));var Redis=require(_0xf0f5('0x13'));var authService=require(_0xf0f5('0x14'));var qs=require(_0xf0f5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0f5('0x16'))(_0xf0f5('0x17'));var utils=require(_0xf0f5('0x18'));var config=require(_0xf0f5('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xf0f5('0x1a'))['db'];function respondWithStatusCode(_0x491e4e,_0xd16317){_0xd16317=_0xd16317||0xcc;return function(_0x39baaa){if(_0x39baaa){return _0x491e4e[_0xf0f5('0x1b')](_0xd16317);}return _0x491e4e[_0xf0f5('0x1c')](_0xd16317)['end']();};}function respondWithResult(_0x3f220c,_0x1f6d66){_0x1f6d66=_0x1f6d66||0xc8;return function(_0x23b63){if(_0x23b63){return _0x3f220c[_0xf0f5('0x1c')](_0x1f6d66)[_0xf0f5('0x1d')](_0x23b63);}};}function respondWithFilteredResult(_0x102c45,_0x3b35b3){return function(_0x49726f){if(_0x49726f){var _0x34ea92=typeof _0x3b35b3[_0xf0f5('0x1e')]===_0xf0f5('0x1f')&&typeof _0x3b35b3[_0xf0f5('0x20')]===_0xf0f5('0x1f');var _0x26aa35=_0x49726f[_0xf0f5('0x21')];var _0x4ecdb1=_0x34ea92?0x0:_0x3b35b3['offset'];var _0xc4ca0=_0x34ea92?_0x49726f[_0xf0f5('0x21')]:_0x3b35b3[_0xf0f5('0x1e')]+_0x3b35b3[_0xf0f5('0x20')];var _0x3dab79;if(_0xc4ca0>=_0x26aa35){_0xc4ca0=_0x26aa35;_0x3dab79=0xc8;}else{_0x3dab79=0xce;}_0x102c45['status'](_0x3dab79);return _0x102c45[_0xf0f5('0x22')](_0xf0f5('0x23'),_0x4ecdb1+'-'+_0xc4ca0+'/'+_0x26aa35)[_0xf0f5('0x1d')](_0x49726f);}return null;};}function patchUpdates(_0x21fb1d){return function(_0x252075){try{jsonpatch[_0xf0f5('0x24')](_0x252075,_0x21fb1d,!![]);}catch(_0x55d846){return BPromise['reject'](_0x55d846);}return _0x252075['save']();};}function saveUpdates(_0x42142d,_0x41c700){return function(_0x2d6d6e){if(_0x2d6d6e){return _0x2d6d6e[_0xf0f5('0x25')](_0x42142d)['then'](function(_0x258809){return _0x258809;});}return null;};}function removeEntity(_0x2b245c,_0x20ea06){return function(_0x1ed8b4){if(_0x1ed8b4){return _0x1ed8b4[_0xf0f5('0x26')]()[_0xf0f5('0x27')](function(){_0x2b245c['status'](0xcc)[_0xf0f5('0x28')]();});}};}function handleEntityNotFound(_0x239230,_0x1561ce){return function(_0x520a35){if(!_0x520a35){_0x239230[_0xf0f5('0x1b')](0x194);}return _0x520a35;};}function handleError(_0x13a212,_0x1bfec0){_0x1bfec0=_0x1bfec0||0x1f4;return function(_0x131f0b){logger[_0xf0f5('0x29')](_0x131f0b[_0xf0f5('0x2a')]);if(_0x131f0b[_0xf0f5('0x2b')]){delete _0x131f0b[_0xf0f5('0x2b')];}_0x13a212[_0xf0f5('0x1c')](_0x1bfec0)['send'](_0x131f0b);};}exports['index']=function(_0x4fa71f,_0x192a5c){var _0x43002b={},_0x1fe6de={},_0x1c9286={'count':0x0,'rows':[]};var _0x485304=_[_0xf0f5('0x2c')](db[_0xf0f5('0x2d')][_0xf0f5('0x2e')],function(_0x2c5896){return{'name':_0x2c5896[_0xf0f5('0x2f')],'type':_0x2c5896[_0xf0f5('0x30')][_0xf0f5('0x31')]};});_0x1fe6de[_0xf0f5('0x32')]=_[_0xf0f5('0x2c')](_0x485304,_0xf0f5('0x2b'));_0x1fe6de['query']=_[_0xf0f5('0x33')](_0x4fa71f['query']);_0x1fe6de[_0xf0f5('0x34')]=_[_0xf0f5('0x35')](_0x1fe6de[_0xf0f5('0x32')],_0x1fe6de[_0xf0f5('0x36')]);_0x43002b[_0xf0f5('0x37')]=_[_0xf0f5('0x35')](_0x1fe6de[_0xf0f5('0x32')],qs[_0xf0f5('0x38')](_0x4fa71f[_0xf0f5('0x36')]['fields']));_0x43002b[_0xf0f5('0x37')]=_0x43002b['attributes'][_0xf0f5('0x39')]?_0x43002b[_0xf0f5('0x37')]:_0x1fe6de[_0xf0f5('0x32')];if(!_0x4fa71f[_0xf0f5('0x36')][_0xf0f5('0x3a')](_0xf0f5('0x3b'))){_0x43002b[_0xf0f5('0x20')]=qs[_0xf0f5('0x20')](_0x4fa71f['query']['limit']);_0x43002b['offset']=qs[_0xf0f5('0x1e')](_0x4fa71f[_0xf0f5('0x36')]['offset']);}_0x43002b[_0xf0f5('0x3c')]=qs[_0xf0f5('0x3d')](_0x4fa71f[_0xf0f5('0x36')][_0xf0f5('0x3d')]);_0x43002b[_0xf0f5('0x3e')]=qs[_0xf0f5('0x34')](_['pick'](_0x4fa71f['query'],_0x1fe6de[_0xf0f5('0x34')]),_0x485304);if(_0x4fa71f['query']['filter']){_0x43002b[_0xf0f5('0x3e')]=_['merge'](_0x43002b['where'],{'$or':_[_0xf0f5('0x2c')](_0x485304,function(_0x5be44a){if(_0x5be44a['type']!==_0xf0f5('0x3f')){var _0x5861c2={};_0x5861c2[_0x5be44a['name']]={'$like':'%'+_0x4fa71f[_0xf0f5('0x36')][_0xf0f5('0x40')]+'%'};return _0x5861c2;}})});}_0x43002b=_[_0xf0f5('0x41')]({},_0x43002b,_0x4fa71f[_0xf0f5('0x42')]);var _0xf3debc={'where':_0x43002b[_0xf0f5('0x3e')]};return db['FaxApplication'][_0xf0f5('0x21')](_0xf3debc)[_0xf0f5('0x27')](function(_0x280268){_0x1c9286[_0xf0f5('0x21')]=_0x280268;if(_0x4fa71f['query']['includeAll']){_0x43002b[_0xf0f5('0x43')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x43002b);})['then'](function(_0x157a37){_0x1c9286[_0xf0f5('0x44')]=_0x157a37;return _0x1c9286;})['then'](respondWithFilteredResult(_0x192a5c,_0x43002b))[_0xf0f5('0x45')](handleError(_0x192a5c,null));};exports['show']=function(_0x407345,_0xd7f29f){var _0x5b2455={'raw':!![],'where':{'id':_0x407345['params']['id']}},_0x4cc9df={};_0x4cc9df[_0xf0f5('0x32')]=_['keys'](db[_0xf0f5('0x2d')][_0xf0f5('0x2e')]);_0x4cc9df[_0xf0f5('0x36')]=_[_0xf0f5('0x33')](_0x407345[_0xf0f5('0x36')]);_0x4cc9df[_0xf0f5('0x34')]=_[_0xf0f5('0x35')](_0x4cc9df[_0xf0f5('0x32')],_0x4cc9df['query']);_0x5b2455['attributes']=_[_0xf0f5('0x35')](_0x4cc9df[_0xf0f5('0x32')],qs['fields'](_0x407345[_0xf0f5('0x36')][_0xf0f5('0x38')]));_0x5b2455[_0xf0f5('0x37')]=_0x5b2455[_0xf0f5('0x37')][_0xf0f5('0x39')]?_0x5b2455[_0xf0f5('0x37')]:_0x4cc9df['model'];if(_0x407345[_0xf0f5('0x36')][_0xf0f5('0x46')]){_0x5b2455['include']=[{'all':!![]}];}_0x5b2455=_[_0xf0f5('0x41')]({},_0x5b2455,_0x407345[_0xf0f5('0x42')]);return db[_0xf0f5('0x2d')][_0xf0f5('0x47')](_0x5b2455)[_0xf0f5('0x27')](handleEntityNotFound(_0xd7f29f,null))[_0xf0f5('0x27')](respondWithResult(_0xd7f29f,null))[_0xf0f5('0x45')](handleError(_0xd7f29f,null));};exports[_0xf0f5('0x48')]=function(_0x5ad953,_0x2abc67){return db[_0xf0f5('0x2d')][_0xf0f5('0x48')](_0x5ad953[_0xf0f5('0x49')],{})['then'](respondWithResult(_0x2abc67,0xc9))[_0xf0f5('0x45')](handleError(_0x2abc67,null));};exports[_0xf0f5('0x25')]=function(_0x5b6889,_0x3e5484){if(_0x5b6889[_0xf0f5('0x49')]['id']){delete _0x5b6889[_0xf0f5('0x49')]['id'];}return db['FaxApplication'][_0xf0f5('0x47')]({'where':{'id':_0x5b6889[_0xf0f5('0x4a')]['id']}})[_0xf0f5('0x27')](handleEntityNotFound(_0x3e5484,null))[_0xf0f5('0x27')](saveUpdates(_0x5b6889[_0xf0f5('0x49')],null))[_0xf0f5('0x27')](respondWithResult(_0x3e5484,null))[_0xf0f5('0x45')](handleError(_0x3e5484,null));};exports[_0xf0f5('0x26')]=function(_0x5642bf,_0x44009c){return db['FaxApplication'][_0xf0f5('0x47')]({'where':{'id':_0x5642bf[_0xf0f5('0x4a')]['id']}})[_0xf0f5('0x27')](handleEntityNotFound(_0x44009c,null))['then'](removeEntity(_0x44009c,null))['catch'](handleError(_0x44009c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index c74be4c..6925cfa 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 _0x539b=['FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','path','rimraf','../../config/environment','./faxApplication.attributes','define'];(function(_0x2ecb67,_0x8ec62d){var _0x168079=function(_0x56c365){while(--_0x56c365){_0x2ecb67['push'](_0x2ecb67['shift']());}};_0x168079(++_0x8ec62d);}(_0x539b,0xb8));var _0xb539=function(_0x470bb6,_0xaaa88e){_0x470bb6=_0x470bb6-0x0;var _0x3584cd=_0x539b[_0x470bb6];return _0x3584cd;};'use strict';var _=require(_0xb539('0x0'));var util=require(_0xb539('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb539('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb539('0x3'));var rimraf=require(_0xb539('0x4'));var config=require(_0xb539('0x5'));var attributes=require(_0xb539('0x6'));module['exports']=function(_0x4b7d97,_0x5521c5){return _0x4b7d97[_0xb539('0x7')](_0xb539('0x8'),attributes,{'tableName':_0xb539('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb539('0xa'),'collate':_0xb539('0xb')});}; \ No newline at end of file +var _0x4e64=['../../config/logger','api','moment','bluebird','path','rimraf','./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4','lodash','util'];(function(_0x372433,_0xb55d02){var _0x375ac3=function(_0x1c1d22){while(--_0x1c1d22){_0x372433['push'](_0x372433['shift']());}};_0x375ac3(++_0xb55d02);}(_0x4e64,0xb2));var _0x44e6=function(_0x3f6d50,_0x2b09ba){_0x3f6d50=_0x3f6d50-0x0;var _0x41c69f=_0x4e64[_0x3f6d50];return _0x41c69f;};'use strict';var _=require(_0x44e6('0x0'));var util=require(_0x44e6('0x1'));var logger=require(_0x44e6('0x2'))(_0x44e6('0x3'));var moment=require(_0x44e6('0x4'));var BPromise=require(_0x44e6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x44e6('0x6'));var rimraf=require(_0x44e6('0x7'));var config=require('../../config/environment');var attributes=require(_0x44e6('0x8'));module['exports']=function(_0x35bf52,_0x2b8737){return _0x35bf52['define'](_0x44e6('0x9'),attributes,{'tableName':_0x44e6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x44e6('0xb'),'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 e4cbed5..5d32b05 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 _0x34ec=['error','code','message','result','catch','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','debug','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x364179,_0xf9120d){var _0x28d5ac=function(_0x5982ee){while(--_0x5982ee){_0x364179['push'](_0x364179['shift']());}};_0x28d5ac(++_0xf9120d);}(_0x34ec,0x1f4));var _0xc34e=function(_0x169f96,_0x570f9c){_0x169f96=_0x169f96-0x0;var _0x28e921=_0x34ec[_0x169f96];return _0x28e921;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc34e('0x0'));var BPromise=require(_0xc34e('0x1'));var rs=require(_0xc34e('0x2'));var fs=require('fs');var Redis=require(_0xc34e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc34e('0x4'))(_0xc34e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc34e('0x6')][_0xc34e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2bca29,_0x4b3a02,_0x3d2636){return new BPromise(function(_0x8a2a50,_0x14143a){return client['request'](_0x2bca29,_0x3d2636)[_0xc34e('0x8')](function(_0x2403c2){logger[_0xc34e('0x9')](_0xc34e('0xa'),_0x4b3a02,'request\x20sent');logger['debug'](_0xc34e('0xb'),_0x4b3a02,'request\x20sent',JSON[_0xc34e('0xc')](_0x2403c2));if(_0x2403c2['error']){if(_0x2403c2[_0xc34e('0xd')][_0xc34e('0xe')]===0x1f4){logger[_0xc34e('0xd')](_0xc34e('0xa'),_0x4b3a02,_0x2403c2[_0xc34e('0xd')][_0xc34e('0xf')]);return _0x14143a(_0x2403c2['error']['message']);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x4b3a02,_0x2403c2['error'][_0xc34e('0xf')]);return _0x8a2a50(_0x2403c2[_0xc34e('0xd')][_0xc34e('0xf')]);}else{logger['info'](_0xc34e('0xa'),_0x4b3a02,'request\x20sent');_0x8a2a50(_0x2403c2[_0xc34e('0x10')][_0xc34e('0xf')]);}})[_0xc34e('0x11')](function(_0x106467){logger['error'](_0xc34e('0xa'),_0x4b3a02,_0x106467);_0x14143a(_0x106467);});});}exports[_0xc34e('0x12')]=function(_0x3bd5e4){var _0x306bb1=this;return new Promise(function(_0x244e61,_0x17e3c2){return db['FaxApplication'][_0xc34e('0x13')](_0x3bd5e4[_0xc34e('0x14')],{'raw':_0x3bd5e4['options']?_0x3bd5e4[_0xc34e('0x15')][_0xc34e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bd5e4[_0xc34e('0x15')]?_0x3bd5e4[_0xc34e('0x15')][_0xc34e('0x17')]||null:null,'attributes':_0x3bd5e4[_0xc34e('0x15')]?_0x3bd5e4[_0xc34e('0x15')][_0xc34e('0x18')]||null:null,'limit':_0x3bd5e4[_0xc34e('0x15')]?_0x3bd5e4[_0xc34e('0x15')][_0xc34e('0x19')]||null:null})[_0xc34e('0x8')](function(_0x34e1bb){logger['info'](_0xc34e('0x12'),_0x3bd5e4);logger[_0xc34e('0x1a')](_0xc34e('0x12'),_0x3bd5e4,JSON['stringify'](_0x34e1bb));_0x244e61(_0x34e1bb);})[_0xc34e('0x11')](function(_0x29e7df){logger[_0xc34e('0xd')](_0xc34e('0x12'),_0x29e7df[_0xc34e('0xf')],_0x3bd5e4);_0x17e3c2(_0x306bb1[_0xc34e('0xd')](0x1f4,_0x29e7df[_0xc34e('0xf')]));});});}; \ No newline at end of file +var _0x260f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit','lodash','util','bluebird'];(function(_0x526a61,_0x1fe433){var _0x29b6ee=function(_0x2eb234){while(--_0x2eb234){_0x526a61['push'](_0x526a61['shift']());}};_0x29b6ee(++_0x1fe433);}(_0x260f,0xfd));var _0xf260=function(_0x360f77,_0x2c095e){_0x360f77=_0x360f77-0x0;var _0x77e350=_0x260f[_0x360f77];return _0x77e350;};'use strict';var _=require(_0xf260('0x0'));var util=require(_0xf260('0x1'));var moment=require('moment');var BPromise=require(_0xf260('0x2'));var rs=require(_0xf260('0x3'));var fs=require('fs');var Redis=require(_0xf260('0x4'));var db=require(_0xf260('0x5'))['db'];var utils=require(_0xf260('0x6'));var logger=require(_0xf260('0x7'))(_0xf260('0x8'));var config=require(_0xf260('0x9'));var jayson=require(_0xf260('0xa'));var client=jayson[_0xf260('0xb')][_0xf260('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58c05c,_0x4e6157,_0x514d72){return new BPromise(function(_0x1fd4b0,_0x432bbc){return client[_0xf260('0xd')](_0x58c05c,_0x514d72)[_0xf260('0xe')](function(_0x3e0fea){logger['info'](_0xf260('0xf'),_0x4e6157,_0xf260('0x10'));logger[_0xf260('0x11')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4e6157,_0xf260('0x10'),JSON[_0xf260('0x12')](_0x3e0fea));if(_0x3e0fea[_0xf260('0x13')]){if(_0x3e0fea['error']['code']===0x1f4){logger[_0xf260('0x13')](_0xf260('0xf'),_0x4e6157,_0x3e0fea[_0xf260('0x13')][_0xf260('0x14')]);return _0x432bbc(_0x3e0fea[_0xf260('0x13')][_0xf260('0x14')]);}logger[_0xf260('0x13')](_0xf260('0xf'),_0x4e6157,_0x3e0fea[_0xf260('0x13')]['message']);return _0x1fd4b0(_0x3e0fea[_0xf260('0x13')][_0xf260('0x14')]);}else{logger[_0xf260('0x15')](_0xf260('0xf'),_0x4e6157,_0xf260('0x10'));_0x1fd4b0(_0x3e0fea[_0xf260('0x16')]['message']);}})[_0xf260('0x17')](function(_0x5e5d9a){logger['error'](_0xf260('0xf'),_0x4e6157,_0x5e5d9a);_0x432bbc(_0x5e5d9a);});});}exports[_0xf260('0x18')]=function(_0x2f8714){var _0x550de6=this;return new Promise(function(_0x3aa06d,_0x2805f4){return db[_0xf260('0x19')][_0xf260('0x1a')](_0x2f8714[_0xf260('0x1b')],{'raw':_0x2f8714[_0xf260('0x1c')]?_0x2f8714[_0xf260('0x1c')][_0xf260('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f8714[_0xf260('0x1c')]?_0x2f8714[_0xf260('0x1c')][_0xf260('0x1e')]||null:null,'attributes':_0x2f8714[_0xf260('0x1c')]?_0x2f8714[_0xf260('0x1c')]['attributes']||null:null,'limit':_0x2f8714[_0xf260('0x1c')]?_0x2f8714[_0xf260('0x1c')][_0xf260('0x1f')]||null:null})[_0xf260('0xe')](function(_0x52d220){logger[_0xf260('0x15')]('UpdateFaxApplication',_0x2f8714);logger['debug'](_0xf260('0x18'),_0x2f8714,JSON['stringify'](_0x52d220));_0x3aa06d(_0x52d220);})[_0xf260('0x17')](function(_0x223338){logger[_0xf260('0x13')](_0xf260('0x18'),_0x223338[_0xf260('0x14')],_0x2f8714);_0x2805f4(_0x550de6[_0xf260('0x13')](0x1f4,_0x223338['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 3e35d16..a233744 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 _0x0b0e=['./faxApplication.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xdfb29a,_0x3443b5){var _0x52f21e=function(_0x56598e){while(--_0x56598e){_0xdfb29a['push'](_0xdfb29a['shift']());}};_0x52f21e(++_0x3443b5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x0b0e[_0x5cb1af];return _0x8d7940;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x2134da,_0x7b3d){var _0xe3c737=function(_0x446b51){while(--_0x446b51){_0x2134da['push'](_0x2134da['shift']());}};_0xe3c737(++_0x7b3d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb7e7[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index a483afa..a828d78 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 _0xa531=['sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa531,0x78));var _0x1a53=function(_0x5221b5,_0x3d7bd1){_0x5221b5=_0x5221b5-0x0;var _0x5352f6=_0xa531[_0x5221b5];return _0x5352f6;};'use strict';var Sequelize=require(_0x1a53('0x0'));module[_0x1a53('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1a53('0x2')]},'disposition':{'type':Sequelize[_0x1a53('0x3')]},'secondDisposition':{'type':Sequelize[_0x1a53('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1a53('0x3')]},'read1stAt':{'type':Sequelize[_0x1a53('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x1a53('0x4')]('in',_0x1a53('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1a53('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1a53('0x4')]('in',_0x1a53('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x0b2b=['ENUM','exports','BOOLEAN','DATE','STRING','out'];(function(_0x3e55dc,_0x160219){var _0x4e4906=function(_0x17f4ec){while(--_0x17f4ec){_0x3e55dc['push'](_0x3e55dc['shift']());}};_0x4e4906(++_0x160219);}(_0x0b2b,0x15d));var _0xb0b2=function(_0x233f21,_0x58e9a9){_0x233f21=_0x233f21-0x0;var _0x297913=_0x0b2b[_0x233f21];return _0x297913;};'use strict';var Sequelize=require('sequelize');module[_0xb0b2('0x0')]={'closed':{'type':Sequelize[_0xb0b2('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb0b2('0x2')]},'disposition':{'type':Sequelize[_0xb0b2('0x3')]},'secondDisposition':{'type':Sequelize[_0xb0b2('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb0b2('0x3')]},'note':{'type':Sequelize[_0xb0b2('0x3')]},'read1stAt':{'type':Sequelize[_0xb0b2('0x2')]},'fax':{'type':Sequelize[_0xb0b2('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb0b2('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb0b2('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xb0b2('0x5')]('in',_0xb0b2('0x4')),'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 c7bbced..d597bbd 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 _0xf67e=['../../config/logger','../../mysqldb','defaults','socket.io-emitter','redis','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','index','fieldName','key','getOptions','findAll','fax','user','catch','keys','FaxInteraction','query','filters','intersection','attributes','model','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','FaxMessage','params','omit','ids','findOne','rawAttributes','hasOwnProperty','nolimit','order','sort','pick','where','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','Tag','color','faxInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','root','attachments','push','Attachment','createdAt','Messages','get','basename','existsSync','pipe','createWriteStream','log','err','unlinkSync','rimraf','moment','util','path','ioredis','../../components/parsers/qs'];(function(_0x486649,_0x2c7d2a){var _0x41e86e=function(_0x44eb0b){while(--_0x44eb0b){_0x486649['push'](_0x486649['shift']());}};_0x41e86e(++_0x2c7d2a);}(_0xf67e,0x186));var _0xef67=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf67e[_0x4b369d];return _0x571a98;};'use strict';var rimraf=require(_0xef67('0x0'));var zipdir=require('zip-dir');var moment=require(_0xef67('0x1'));var BPromise=require('bluebird');var util=require(_0xef67('0x2'));var path=require(_0xef67('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xef67('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0xef67('0x5'));var logger=require(_0xef67('0x6'))('api');var config=require('../../config/environment');var db=require(_0xef67('0x7'))['db'];config['redis']=_[_0xef67('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xef67('0x9'))(new Redis(config[_0xef67('0xa')]));require(_0xef67('0xb'))[_0xef67('0xc')](socket);function respondWithStatusCode(_0x1f2981,_0xb2c9c0){_0xb2c9c0=_0xb2c9c0||0xcc;return function(_0x58c0aa){if(_0x58c0aa){return _0x1f2981[_0xef67('0xd')](_0xb2c9c0);}return _0x1f2981[_0xef67('0xe')](_0xb2c9c0)[_0xef67('0xf')]();};}function respondWithResult(_0x9c2ed8,_0x38bb67){_0x38bb67=_0x38bb67||0xc8;return function(_0x44f806){if(_0x44f806){return _0x9c2ed8[_0xef67('0xe')](_0x38bb67)[_0xef67('0x10')](_0x44f806);}};}function respondWithFilteredResult(_0x1d564b,_0x1a752f){return function(_0xf7b945){if(_0xf7b945){var _0x158afa=typeof _0x1a752f[_0xef67('0x11')]===_0xef67('0x12')&&typeof _0x1a752f['limit']===_0xef67('0x12');var _0x3b9f90=_0xf7b945['count'];var _0x3a43c3=_0x158afa?0x0:_0x1a752f[_0xef67('0x11')];var _0x131d86=_0x158afa?_0xf7b945[_0xef67('0x13')]:_0x1a752f[_0xef67('0x11')]+_0x1a752f[_0xef67('0x14')];var _0x5e28df;if(_0x131d86>=_0x3b9f90){_0x131d86=_0x3b9f90;_0x5e28df=0xc8;}else{_0x5e28df=0xce;}_0x1d564b[_0xef67('0xe')](_0x5e28df);return _0x1d564b[_0xef67('0x15')](_0xef67('0x16'),_0x3a43c3+'-'+_0x131d86+'/'+_0x3b9f90)['json'](_0xf7b945);}return null;};}function saveUpdates(_0x1a000b){return function(_0x5e3643){if(_0x5e3643){return _0x5e3643[_0xef67('0x17')](_0x1a000b)[_0xef67('0x18')](function(_0xff292d){return _0xff292d;});}return null;};}function removeEntity(_0x2e1ff9){return function(_0xe188b7){if(_0xe188b7){return _0xe188b7[_0xef67('0x19')]()[_0xef67('0x18')](function(){_0x2e1ff9[_0xef67('0xe')](0xcc)[_0xef67('0xf')]();});}};}function handleEntityNotFound(_0x5bc05b){return function(_0x84a48a){if(!_0x84a48a){_0x5bc05b[_0xef67('0xd')](0x194);}return _0x84a48a;};}function handleError(_0xeb5305,_0xe3e589){_0xe3e589=_0xe3e589||0x1f4;return function(_0x146734){logger['error'](_0x146734[_0xef67('0x1a')]);if(_0x146734[_0xef67('0x1b')]){delete _0x146734[_0xef67('0x1b')];}_0xeb5305[_0xef67('0xe')](_0xe3e589)['send'](_0x146734);};}exports[_0xef67('0x1c')]=function(_0xd635e0,_0x28a5be){var _0x53a597={};var _0x3b2858=_['map'](db['FaxInteraction']['rawAttributes'],function(_0x3af5a3){return{'name':_0x3af5a3[_0xef67('0x1d')],'type':_0x3af5a3['type'][_0xef67('0x1e')]};});_0x53a597=qs[_0xef67('0x1f')](_0x3b2858,_0xd635e0);return interaction[_0xef67('0x20')](_0xef67('0x21'),_0xd635e0['query'],_0xd635e0[_0xef67('0x22')],_0x53a597,_0x3b2858)[_0xef67('0x18')](respondWithFilteredResult(_0x28a5be,_0x53a597))[_0xef67('0x23')](handleError(_0x28a5be,null));};exports['show']=function(_0x2fc844,_0x40418d){var _0x3ec0ed={'raw':![],'where':{'id':_0x2fc844['params']['id']}},_0x7c58b8={};_0x7c58b8['model']=_[_0xef67('0x24')](db[_0xef67('0x25')]['rawAttributes']);_0x7c58b8[_0xef67('0x26')]=_[_0xef67('0x24')](_0x2fc844[_0xef67('0x26')]);_0x7c58b8[_0xef67('0x27')]=_[_0xef67('0x28')](_0x7c58b8['model'],_0x7c58b8[_0xef67('0x26')]);_0x3ec0ed[_0xef67('0x29')]=_[_0xef67('0x28')](_0x7c58b8[_0xef67('0x2a')],qs['fields'](_0x2fc844[_0xef67('0x26')][_0xef67('0x2b')]));_0x3ec0ed[_0xef67('0x29')]=_0x3ec0ed[_0xef67('0x29')][_0xef67('0x2c')]?_0x3ec0ed[_0xef67('0x29')]:_0x7c58b8['model'];if(_0x2fc844['query'][_0xef67('0x2d')]){_0x3ec0ed[_0xef67('0x2e')]=[{'all':!![]}];}_0x3ec0ed=_[_0xef67('0x2f')]({},_0x3ec0ed,_0x2fc844[_0xef67('0x30')]);return db[_0xef67('0x25')]['find'](_0x3ec0ed)['then'](handleEntityNotFound(_0x40418d,null))[_0xef67('0x18')](respondWithResult(_0x40418d,null))[_0xef67('0x23')](handleError(_0x40418d,null));};exports[_0xef67('0x31')]=function(_0x83c628,_0x2e0c94){return db[_0xef67('0x25')][_0xef67('0x31')](_0x83c628[_0xef67('0x32')],{})['then'](respondWithResult(_0x2e0c94,0xc9))['catch'](handleError(_0x2e0c94,null));};exports[_0xef67('0x17')]=function(_0x45a62b,_0x15309b){if(_0x45a62b[_0xef67('0x32')]['id']){delete _0x45a62b[_0xef67('0x32')]['id'];}return db[_0xef67('0x25')][_0xef67('0x33')]({'where':{'id':_0x45a62b['params']['id']}})[_0xef67('0x18')](handleEntityNotFound(_0x15309b,null))[_0xef67('0x18')](saveUpdates(_0x45a62b[_0xef67('0x32')],null))['then'](respondWithResult(_0x15309b,null))[_0xef67('0x23')](handleError(_0x15309b,null));};exports[_0xef67('0x19')]=function(_0x139c55,_0x619e5d){return db[_0xef67('0x25')][_0xef67('0x33')]({'where':{'id':_0x139c55['params']['id']}})[_0xef67('0x18')](handleEntityNotFound(_0x619e5d,null))[_0xef67('0x18')](removeEntity(_0x619e5d,null))[_0xef67('0x23')](handleError(_0x619e5d,null));};exports[_0xef67('0x34')]=function(_0x28ffba,_0x487339){return db[_0xef67('0x25')]['describe']()[_0xef67('0x18')](respondWithResult(_0x487339,null))[_0xef67('0x23')](handleError(_0x487339,null));};exports[_0xef67('0x35')]=function(_0x4d891f,_0xaa1c32){return db[_0xef67('0x36')][_0xef67('0x33')]({'where':{'id':_0x4d891f[_0xef67('0x37')]['id']}})[_0xef67('0x18')](handleEntityNotFound(_0xaa1c32,null))[_0xef67('0x18')](function(_0x31fe20){if(_0x31fe20){return _0x31fe20[_0xef67('0x35')](_0x4d891f[_0xef67('0x32')]['ids'],_[_0xef67('0x38')](_0x4d891f[_0xef67('0x32')],[_0xef67('0x39'),'id'])||{});}})[_0xef67('0x18')](respondWithResult(_0xaa1c32,null))[_0xef67('0x23')](handleError(_0xaa1c32,null));};exports['getMessages']=function(_0x214ccd,_0x891a92){var _0xa83c8f={'raw':![],'where':{}};var _0x5154bd={};var _0x315425={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xef67('0x3a')]({'where':{'id':_0x214ccd[_0xef67('0x37')]['id']}})[_0xef67('0x18')](handleEntityNotFound(_0x891a92,null))['then'](function(_0x20a8b3){if(_0x20a8b3){_0x5154bd[_0xef67('0x2a')]=_[_0xef67('0x24')](db[_0xef67('0x36')][_0xef67('0x3b')]);_0x5154bd[_0xef67('0x26')]=_[_0xef67('0x24')](_0x214ccd[_0xef67('0x26')]);_0x5154bd[_0xef67('0x27')]=_[_0xef67('0x28')](_0x5154bd[_0xef67('0x2a')],_0x5154bd[_0xef67('0x26')]);_0xa83c8f[_0xef67('0x29')]=_['intersection'](_0x5154bd[_0xef67('0x2a')],qs[_0xef67('0x2b')](_0x214ccd[_0xef67('0x26')][_0xef67('0x2b')]));_0xa83c8f[_0xef67('0x29')]=_0xa83c8f[_0xef67('0x29')]['length']?_0xa83c8f[_0xef67('0x29')]:_0x5154bd['model'];if(!_0x214ccd[_0xef67('0x26')][_0xef67('0x3c')](_0xef67('0x3d'))){_0xa83c8f[_0xef67('0x14')]=qs[_0xef67('0x14')](_0x214ccd['query'][_0xef67('0x14')]);_0xa83c8f[_0xef67('0x11')]=qs['offset'](_0x214ccd['query'][_0xef67('0x11')]);}_0xa83c8f[_0xef67('0x3e')]=qs[_0xef67('0x3f')](_0x214ccd[_0xef67('0x26')][_0xef67('0x3f')]);_0xa83c8f['where']=qs[_0xef67('0x27')](_[_0xef67('0x40')](_0x214ccd['query'],_0x5154bd[_0xef67('0x27')]));_0xa83c8f['where']['FaxInteractionId']=_0x20a8b3['id'];if(_0x214ccd[_0xef67('0x26')]['filter']){_0xa83c8f[_0xef67('0x41')]=_[_0xef67('0x2f')](_0xa83c8f[_0xef67('0x41')],{'$or':_[_0xef67('0x42')](_0xa83c8f[_0xef67('0x29')],function(_0x37332a){var _0x211a7c={};_0x211a7c[_0x37332a]={'$like':'%'+_0x214ccd['query'][_0xef67('0x43')]+'%'};return _0x211a7c;})});}if(_0x214ccd[_0xef67('0x26')][_0xef67('0x44')]){var _0x404b4b=_0x214ccd[_0xef67('0x26')][_0xef67('0x44')][_0xef67('0x45')](',');var _0x389802={};_0x389802[_0x404b4b[0x0]]={'$gte':moment(_0x404b4b[0x1])[_0xef67('0x46')](_0xef67('0x47'))};_0xa83c8f['where']=_[_0xef67('0x2f')](_0xa83c8f[_0xef67('0x41')],_0x389802);}_0xa83c8f=_[_0xef67('0x2f')]({},_0xa83c8f,_0x214ccd[_0xef67('0x30')]);return db[_0xef67('0x36')]['count']({'where':_0xa83c8f[_0xef67('0x41')]})[_0xef67('0x18')](function(_0x137250){_0x315425[_0xef67('0x13')]=_0x137250;if(_0x214ccd[_0xef67('0x26')][_0xef67('0x2d')]){_0xa83c8f[_0xef67('0x2e')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0xa83c8f);})[_0xef67('0x18')](function(_0x500559){_0x315425[_0xef67('0x48')]=_0x500559;return _0x315425;});}})['then'](respondWithFilteredResult(_0x891a92,_0xa83c8f))[_0xef67('0x23')](handleError(_0x891a92,null));};exports['addTags']=function(_0x351da7,_0x2b497a){return db[_0xef67('0x25')][_0xef67('0x33')]({'where':{'id':_0x351da7[_0xef67('0x37')]['id']}})[_0xef67('0x18')](handleEntityNotFound(_0x2b497a,null))[_0xef67('0x18')](function(_0x443010){if(_0x443010){return _0x443010[_0xef67('0x49')](_0x351da7[_0xef67('0x32')][_0xef67('0x39')],_['omit'](_0x351da7['body'],['ids','id'])||{})['spread'](function(){return db[_0xef67('0x4a')]['findAll']({'attributes':['id',_0xef67('0x1b'),_0xef67('0x4b')],'where':{'id':_0x351da7['body'][_0xef67('0x39')]}});})[_0xef67('0x18')](function(_0x3019e3){socket['emit'](_0xef67('0x4c'),{'id':Number(_0x351da7['params']['id']),'tags':_0x3019e3||[]});return{'id':Number(_0x351da7[_0xef67('0x37')]['id']),'tags':_0x3019e3||[]};});}})[_0xef67('0x18')](respondWithResult(_0x2b497a,null))[_0xef67('0x23')](handleError(_0x2b497a,null));};exports[_0xef67('0x4d')]=function(_0x35aa81,_0x3fcdb2){return db[_0xef67('0x25')]['find']({'where':{'id':_0x35aa81['params']['id']}})[_0xef67('0x18')](handleEntityNotFound(_0x3fcdb2,null))[_0xef67('0x18')](function(_0x114b57){if(_0x114b57){return _0x114b57[_0xef67('0x4d')](_0x35aa81['query'][_0xef67('0x39')]);}})[_0xef67('0x18')](respondWithStatusCode(_0x3fcdb2,null))[_0xef67('0x23')](handleError(_0x3fcdb2,null));};exports[_0xef67('0x4e')]=function(_0x48408d,_0x74d66c){var _0x2f4781=moment()[_0xef67('0x4f')]()[_0xef67('0x50')]();var _0x21d4cf=path['join'](config['root'],_0xef67('0x51'),_0xef67('0x52'),_0xef67('0x53'));var _0x4173fe=path[_0xef67('0x54')](config[_0xef67('0x55')],'server','files',_0xef67('0x56'));var _0x3dada3=path[_0xef67('0x54')](_0x21d4cf,_0x2f4781);var _0x30834c=util[_0xef67('0x46')]('transcript-%d-%s.zip',_0x48408d[_0xef67('0x37')]['id'],_0x2f4781);var _0x15ccf0=path[_0xef67('0x54')](_0x21d4cf,_0x30834c);var _0x3eeaa4=[];_0x3eeaa4[_0xef67('0x57')]({'model':db['Attachment'],'as':_0xef67('0x58'),'raw':!![]});var _0x2f8d3c=[{'model':db[_0xef67('0x36')],'as':'Messages','attributes':['id','body',_0xef67('0x59')],'include':_0x3eeaa4}];return db[_0xef67('0x25')]['find']({'where':{'id':_0x48408d[_0xef67('0x37')]['id']},'include':_0x2f8d3c})[_0xef67('0x18')](handleEntityNotFound(_0x74d66c,null))[_0xef67('0x18')](function(_0x4c130e){if(_0x4c130e&&_0x4c130e[_0xef67('0x5a')]){var _0x433f39=_0x4c130e[_0xef67('0x5b')]({'plain':!![]});fs['mkdirSync'](_0x3dada3);for(var _0xc9bc4a=0x0;_0xc9bc4a<_0x433f39[_0xef67('0x5a')][_0xef67('0x2c')];_0xc9bc4a++){var _0x5b5c61=_0x433f39[_0xef67('0x5a')][_0xc9bc4a][_0xef67('0x58')];if(_0x5b5c61){var _0x356f16=path[_0xef67('0x54')](_0x4173fe,_0x5b5c61[_0xef67('0x5c')]);if(fs[_0xef67('0x5d')](_0x356f16)){fs['createReadStream'](_0x356f16)[_0xef67('0x5e')](fs[_0xef67('0x5f')](path[_0xef67('0x54')](_0x3dada3,_0x5b5c61[_0xef67('0x5c')])));}}}return BPromise['resolve']()[_0xef67('0x18')](function(){return new BPromise(function(_0x40e8cd,_0x364409){zipdir(_0x3dada3,{'saveTo':_0x15ccf0},function(_0x30c732,_0x3bb353){if(_0x30c732)return _0x364409(_0x30c732);return _0x40e8cd(_0x3bb353);});})['then'](function(){return new BPromise(function(_0x56ee8b,_0x10e6e7){rimraf(_0x3dada3,function(_0x8f90a){if(_0x8f90a)_0x10e6e7(_0x8f90a);return _0x56ee8b();});});})['then'](function(){return _0x74d66c[_0xef67('0x4e')](_0x15ccf0,_0x30834c,function(_0x5413e6){if(_0x5413e6){console[_0xef67('0x60')](_0xef67('0x61'),_0x5413e6);}else{fs[_0xef67('0x62')](_0x15ccf0);}});});});}else{return _0x74d66c[_0xef67('0xd')](0xc8);}})['catch'](handleError(_0x74d66c,null));}; \ No newline at end of file +var _0xb05e=['describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','length','sort','where','pick','FaxInteractionId','filter','$gte','split','format','findAll','rows','addTags','setTags','spread','Tag','emit','removeTags','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','download','unlinkSync','sendStatus','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','getOptions','fax','query','user','catch','show','params','keys','filters','intersection','attributes','model','fields','includeAll','include','merge','create','body','FaxInteraction','find'];(function(_0x1ca69a,_0x1d42e2){var _0x505965=function(_0x4a2b34){while(--_0x4a2b34){_0x1ca69a['push'](_0x1ca69a['shift']());}};_0x505965(++_0x1d42e2);}(_0xb05e,0x160));var _0xeb05=function(_0xf6cd94,_0x25d081){_0xf6cd94=_0xf6cd94-0x0;var _0x527621=_0xb05e[_0xf6cd94];return _0x527621;};'use strict';var rimraf=require(_0xeb05('0x0'));var zipdir=require(_0xeb05('0x1'));var moment=require(_0xeb05('0x2'));var BPromise=require(_0xeb05('0x3'));var util=require(_0xeb05('0x4'));var path=require(_0xeb05('0x5'));var fs=require('fs');var _=require(_0xeb05('0x6'));var Redis=require('ioredis');var interaction=require(_0xeb05('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xeb05('0x8'))(_0xeb05('0x9'));var config=require('../../config/environment');var db=require(_0xeb05('0xa'))['db'];config['redis']=_[_0xeb05('0xb')](config[_0xeb05('0xc')],{'host':_0xeb05('0xd'),'port':0x18eb});var socket=require(_0xeb05('0xe'))(new Redis(config[_0xeb05('0xc')]));require(_0xeb05('0xf'))[_0xeb05('0x10')](socket);function respondWithStatusCode(_0x2a6e58,_0x153113){_0x153113=_0x153113||0xcc;return function(_0x545659){if(_0x545659){return _0x2a6e58['sendStatus'](_0x153113);}return _0x2a6e58[_0xeb05('0x11')](_0x153113)[_0xeb05('0x12')]();};}function respondWithResult(_0x32bbf0,_0x1d858c){_0x1d858c=_0x1d858c||0xc8;return function(_0x2a8758){if(_0x2a8758){return _0x32bbf0[_0xeb05('0x11')](_0x1d858c)[_0xeb05('0x13')](_0x2a8758);}};}function respondWithFilteredResult(_0xb6c239,_0x248c58){return function(_0x557e55){if(_0x557e55){var _0x312da6=typeof _0x248c58[_0xeb05('0x14')]===_0xeb05('0x15')&&typeof _0x248c58[_0xeb05('0x16')]==='undefined';var _0x2f4eba=_0x557e55[_0xeb05('0x17')];var _0x311832=_0x312da6?0x0:_0x248c58[_0xeb05('0x14')];var _0x198d01=_0x312da6?_0x557e55[_0xeb05('0x17')]:_0x248c58[_0xeb05('0x14')]+_0x248c58[_0xeb05('0x16')];var _0x2fb048;if(_0x198d01>=_0x2f4eba){_0x198d01=_0x2f4eba;_0x2fb048=0xc8;}else{_0x2fb048=0xce;}_0xb6c239[_0xeb05('0x11')](_0x2fb048);return _0xb6c239[_0xeb05('0x18')](_0xeb05('0x19'),_0x311832+'-'+_0x198d01+'/'+_0x2f4eba)[_0xeb05('0x13')](_0x557e55);}return null;};}function saveUpdates(_0x2f7612){return function(_0x2b370c){if(_0x2b370c){return _0x2b370c[_0xeb05('0x1a')](_0x2f7612)[_0xeb05('0x1b')](function(_0x1cd890){return _0x1cd890;});}return null;};}function removeEntity(_0x129099){return function(_0x3b3a87){if(_0x3b3a87){return _0x3b3a87[_0xeb05('0x1c')]()[_0xeb05('0x1b')](function(){_0x129099[_0xeb05('0x11')](0xcc)[_0xeb05('0x12')]();});}};}function handleEntityNotFound(_0x218ccf){return function(_0x4e3ded){if(!_0x4e3ded){_0x218ccf['sendStatus'](0x194);}return _0x4e3ded;};}function handleError(_0x5eb2e8,_0x47c0de){_0x47c0de=_0x47c0de||0x1f4;return function(_0x3b6ea7){logger[_0xeb05('0x1d')](_0x3b6ea7['stack']);if(_0x3b6ea7[_0xeb05('0x1e')]){delete _0x3b6ea7[_0xeb05('0x1e')];}_0x5eb2e8[_0xeb05('0x11')](_0x47c0de)['send'](_0x3b6ea7);};}exports[_0xeb05('0x1f')]=function(_0x3f3716,_0x13cdb3){var _0x5c4f75={};var _0x3002ab=_[_0xeb05('0x20')](db['FaxInteraction'][_0xeb05('0x21')],function(_0x3e6162){return{'name':_0x3e6162[_0xeb05('0x22')],'type':_0x3e6162[_0xeb05('0x23')]['key']};});_0x5c4f75=qs[_0xeb05('0x24')](_0x3002ab,_0x3f3716);return interaction['findAll'](_0xeb05('0x25'),_0x3f3716[_0xeb05('0x26')],_0x3f3716[_0xeb05('0x27')],_0x5c4f75,_0x3002ab)['then'](respondWithFilteredResult(_0x13cdb3,_0x5c4f75))[_0xeb05('0x28')](handleError(_0x13cdb3,null));};exports[_0xeb05('0x29')]=function(_0x51768d,_0x10e2a2){var _0x40fb0e={'raw':![],'where':{'id':_0x51768d[_0xeb05('0x2a')]['id']}},_0x2a2e5b={};_0x2a2e5b['model']=_['keys'](db['FaxInteraction']['rawAttributes']);_0x2a2e5b[_0xeb05('0x26')]=_[_0xeb05('0x2b')](_0x51768d[_0xeb05('0x26')]);_0x2a2e5b[_0xeb05('0x2c')]=_[_0xeb05('0x2d')](_0x2a2e5b['model'],_0x2a2e5b[_0xeb05('0x26')]);_0x40fb0e[_0xeb05('0x2e')]=_[_0xeb05('0x2d')](_0x2a2e5b[_0xeb05('0x2f')],qs[_0xeb05('0x30')](_0x51768d[_0xeb05('0x26')][_0xeb05('0x30')]));_0x40fb0e[_0xeb05('0x2e')]=_0x40fb0e[_0xeb05('0x2e')]['length']?_0x40fb0e[_0xeb05('0x2e')]:_0x2a2e5b[_0xeb05('0x2f')];if(_0x51768d[_0xeb05('0x26')][_0xeb05('0x31')]){_0x40fb0e[_0xeb05('0x32')]=[{'all':!![]}];}_0x40fb0e=_[_0xeb05('0x33')]({},_0x40fb0e,_0x51768d['options']);return db['FaxInteraction']['find'](_0x40fb0e)[_0xeb05('0x1b')](handleEntityNotFound(_0x10e2a2,null))[_0xeb05('0x1b')](respondWithResult(_0x10e2a2,null))[_0xeb05('0x28')](handleError(_0x10e2a2,null));};exports[_0xeb05('0x34')]=function(_0x38f9f9,_0x4709b4){return db['FaxInteraction'][_0xeb05('0x34')](_0x38f9f9[_0xeb05('0x35')],{})[_0xeb05('0x1b')](respondWithResult(_0x4709b4,0xc9))['catch'](handleError(_0x4709b4,null));};exports[_0xeb05('0x1a')]=function(_0x3c4a6f,_0x4cea31){if(_0x3c4a6f[_0xeb05('0x35')]['id']){delete _0x3c4a6f[_0xeb05('0x35')]['id'];}return db[_0xeb05('0x36')][_0xeb05('0x37')]({'where':{'id':_0x3c4a6f[_0xeb05('0x2a')]['id']}})[_0xeb05('0x1b')](handleEntityNotFound(_0x4cea31,null))[_0xeb05('0x1b')](saveUpdates(_0x3c4a6f[_0xeb05('0x35')],null))['then'](respondWithResult(_0x4cea31,null))['catch'](handleError(_0x4cea31,null));};exports[_0xeb05('0x1c')]=function(_0xce632c,_0x48137c){return db['FaxInteraction'][_0xeb05('0x37')]({'where':{'id':_0xce632c['params']['id']}})['then'](handleEntityNotFound(_0x48137c,null))[_0xeb05('0x1b')](removeEntity(_0x48137c,null))[_0xeb05('0x28')](handleError(_0x48137c,null));};exports[_0xeb05('0x38')]=function(_0x3d0f76,_0x8037fc){return db[_0xeb05('0x36')][_0xeb05('0x38')]()[_0xeb05('0x1b')](respondWithResult(_0x8037fc,null))[_0xeb05('0x28')](handleError(_0x8037fc,null));};exports['addMessage']=function(_0x3e3b53,_0x2eaea8){return db[_0xeb05('0x39')][_0xeb05('0x37')]({'where':{'id':_0x3e3b53[_0xeb05('0x2a')]['id']}})[_0xeb05('0x1b')](handleEntityNotFound(_0x2eaea8,null))[_0xeb05('0x1b')](function(_0x548129){if(_0x548129){return _0x548129[_0xeb05('0x3a')](_0x3e3b53[_0xeb05('0x35')][_0xeb05('0x3b')],_[_0xeb05('0x3c')](_0x3e3b53[_0xeb05('0x35')],[_0xeb05('0x3b'),'id'])||{});}})[_0xeb05('0x1b')](respondWithResult(_0x2eaea8,null))[_0xeb05('0x28')](handleError(_0x2eaea8,null));};exports[_0xeb05('0x3d')]=function(_0x503f3e,_0x1b90b2){var _0x196dc2={'raw':![],'where':{}};var _0x3b7abe={};var _0x379dbf={'count':0x0,'rows':[]};return db[_0xeb05('0x36')][_0xeb05('0x3e')]({'where':{'id':_0x503f3e['params']['id']}})[_0xeb05('0x1b')](handleEntityNotFound(_0x1b90b2,null))[_0xeb05('0x1b')](function(_0x514db5){if(_0x514db5){_0x3b7abe[_0xeb05('0x2f')]=_[_0xeb05('0x2b')](db[_0xeb05('0x39')][_0xeb05('0x21')]);_0x3b7abe[_0xeb05('0x26')]=_['keys'](_0x503f3e[_0xeb05('0x26')]);_0x3b7abe[_0xeb05('0x2c')]=_['intersection'](_0x3b7abe[_0xeb05('0x2f')],_0x3b7abe[_0xeb05('0x26')]);_0x196dc2['attributes']=_[_0xeb05('0x2d')](_0x3b7abe['model'],qs[_0xeb05('0x30')](_0x503f3e[_0xeb05('0x26')][_0xeb05('0x30')]));_0x196dc2[_0xeb05('0x2e')]=_0x196dc2[_0xeb05('0x2e')][_0xeb05('0x3f')]?_0x196dc2[_0xeb05('0x2e')]:_0x3b7abe['model'];if(!_0x503f3e['query']['hasOwnProperty']('nolimit')){_0x196dc2['limit']=qs[_0xeb05('0x16')](_0x503f3e[_0xeb05('0x26')][_0xeb05('0x16')]);_0x196dc2[_0xeb05('0x14')]=qs[_0xeb05('0x14')](_0x503f3e[_0xeb05('0x26')][_0xeb05('0x14')]);}_0x196dc2['order']=qs[_0xeb05('0x40')](_0x503f3e[_0xeb05('0x26')][_0xeb05('0x40')]);_0x196dc2[_0xeb05('0x41')]=qs[_0xeb05('0x2c')](_[_0xeb05('0x42')](_0x503f3e[_0xeb05('0x26')],_0x3b7abe[_0xeb05('0x2c')]));_0x196dc2[_0xeb05('0x41')][_0xeb05('0x43')]=_0x514db5['id'];if(_0x503f3e['query']['filter']){_0x196dc2['where']=_[_0xeb05('0x33')](_0x196dc2[_0xeb05('0x41')],{'$or':_[_0xeb05('0x20')](_0x196dc2[_0xeb05('0x2e')],function(_0x3f05ce){var _0x4422b0={};_0x4422b0[_0x3f05ce]={'$like':'%'+_0x503f3e[_0xeb05('0x26')][_0xeb05('0x44')]+'%'};return _0x4422b0;})});}if(_0x503f3e[_0xeb05('0x26')]['$gte']){var _0xf0dc91=_0x503f3e[_0xeb05('0x26')][_0xeb05('0x45')][_0xeb05('0x46')](',');var _0x3f9169={};_0x3f9169[_0xf0dc91[0x0]]={'$gte':moment(_0xf0dc91[0x1])[_0xeb05('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x196dc2['where']=_[_0xeb05('0x33')](_0x196dc2['where'],_0x3f9169);}_0x196dc2=_[_0xeb05('0x33')]({},_0x196dc2,_0x503f3e['options']);return db['FaxMessage'][_0xeb05('0x17')]({'where':_0x196dc2[_0xeb05('0x41')]})[_0xeb05('0x1b')](function(_0x360b53){_0x379dbf[_0xeb05('0x17')]=_0x360b53;if(_0x503f3e[_0xeb05('0x26')]['includeAll']){_0x196dc2[_0xeb05('0x32')]=[{'all':!![]}];}return db[_0xeb05('0x39')][_0xeb05('0x48')](_0x196dc2);})[_0xeb05('0x1b')](function(_0x979da){_0x379dbf[_0xeb05('0x49')]=_0x979da;return _0x379dbf;});}})[_0xeb05('0x1b')](respondWithFilteredResult(_0x1b90b2,_0x196dc2))[_0xeb05('0x28')](handleError(_0x1b90b2,null));};exports[_0xeb05('0x4a')]=function(_0x3f1898,_0x3ebb4d){return db['FaxInteraction'][_0xeb05('0x37')]({'where':{'id':_0x3f1898[_0xeb05('0x2a')]['id']}})[_0xeb05('0x1b')](handleEntityNotFound(_0x3ebb4d,null))[_0xeb05('0x1b')](function(_0x56c2af){if(_0x56c2af){return _0x56c2af[_0xeb05('0x4b')](_0x3f1898[_0xeb05('0x35')]['ids'],_[_0xeb05('0x3c')](_0x3f1898[_0xeb05('0x35')],['ids','id'])||{})[_0xeb05('0x4c')](function(){return db[_0xeb05('0x4d')][_0xeb05('0x48')]({'attributes':['id',_0xeb05('0x1e'),'color'],'where':{'id':_0x3f1898[_0xeb05('0x35')][_0xeb05('0x3b')]}});})['then'](function(_0x177e09){socket[_0xeb05('0x4e')]('faxInteractionTags:save',{'id':Number(_0x3f1898[_0xeb05('0x2a')]['id']),'tags':_0x177e09||[]});return{'id':Number(_0x3f1898[_0xeb05('0x2a')]['id']),'tags':_0x177e09||[]};});}})[_0xeb05('0x1b')](respondWithResult(_0x3ebb4d,null))[_0xeb05('0x28')](handleError(_0x3ebb4d,null));};exports[_0xeb05('0x4f')]=function(_0x372f4a,_0x191c3a){return db[_0xeb05('0x36')]['find']({'where':{'id':_0x372f4a[_0xeb05('0x2a')]['id']}})[_0xeb05('0x1b')](handleEntityNotFound(_0x191c3a,null))[_0xeb05('0x1b')](function(_0xcc057b){if(_0xcc057b){return _0xcc057b[_0xeb05('0x4f')](_0x372f4a[_0xeb05('0x26')][_0xeb05('0x3b')]);}})['then'](respondWithStatusCode(_0x191c3a,null))['catch'](handleError(_0x191c3a,null));};exports['download']=function(_0x45b8f6,_0x2dca90){var _0x417102=moment()[_0xeb05('0x50')]()[_0xeb05('0x51')]();var _0x406359=path['join'](config[_0xeb05('0x52')],_0xeb05('0x53'),_0xeb05('0x54'),_0xeb05('0x55'));var _0xbe3462=path[_0xeb05('0x56')](config['root'],_0xeb05('0x53'),'files',_0xeb05('0x57'));var _0x384269=path['join'](_0x406359,_0x417102);var _0x41c273=util[_0xeb05('0x47')](_0xeb05('0x58'),_0x45b8f6[_0xeb05('0x2a')]['id'],_0x417102);var _0x2cb6f7=path['join'](_0x406359,_0x41c273);var _0x55a275=[];_0x55a275[_0xeb05('0x59')]({'model':db[_0xeb05('0x5a')],'as':'Attachment','raw':!![]});var _0x1056c9=[{'model':db[_0xeb05('0x39')],'as':_0xeb05('0x5b'),'attributes':['id',_0xeb05('0x35'),'createdAt'],'include':_0x55a275}];return db[_0xeb05('0x36')]['find']({'where':{'id':_0x45b8f6[_0xeb05('0x2a')]['id']},'include':_0x1056c9})[_0xeb05('0x1b')](handleEntityNotFound(_0x2dca90,null))[_0xeb05('0x1b')](function(_0x3b0faf){if(_0x3b0faf&&_0x3b0faf[_0xeb05('0x5b')]){var _0x406d1f=_0x3b0faf['get']({'plain':!![]});fs[_0xeb05('0x5c')](_0x384269);for(var _0x134f3d=0x0;_0x134f3d<_0x406d1f[_0xeb05('0x5b')][_0xeb05('0x3f')];_0x134f3d++){var _0x347ef1=_0x406d1f[_0xeb05('0x5b')][_0x134f3d][_0xeb05('0x5a')];if(_0x347ef1){var _0x5781cd=path[_0xeb05('0x56')](_0xbe3462,_0x347ef1[_0xeb05('0x5d')]);if(fs[_0xeb05('0x5e')](_0x5781cd)){fs[_0xeb05('0x5f')](_0x5781cd)[_0xeb05('0x60')](fs[_0xeb05('0x61')](path[_0xeb05('0x56')](_0x384269,_0x347ef1[_0xeb05('0x5d')])));}}}return BPromise[_0xeb05('0x62')]()[_0xeb05('0x1b')](function(){return new BPromise(function(_0x412bb6,_0x246334){zipdir(_0x384269,{'saveTo':_0x2cb6f7},function(_0x40f0fa,_0x37ad09){if(_0x40f0fa)return _0x246334(_0x40f0fa);return _0x412bb6(_0x37ad09);});})[_0xeb05('0x1b')](function(){return new BPromise(function(_0x30ee6f,_0x204a15){rimraf(_0x384269,function(_0x237e19){if(_0x237e19)_0x204a15(_0x237e19);return _0x30ee6f();});});})[_0xeb05('0x1b')](function(){return _0x2dca90[_0xeb05('0x63')](_0x2cb6f7,_0x41c273,function(_0x5cdb3b){if(_0x5cdb3b){console['log']('err',_0x5cdb3b);}else{fs[_0xeb05('0x64')](_0x2cb6f7);}});});});}else{return _0x2dca90[_0xeb05('0x65')](0xc8);}})['catch'](handleError(_0x2dca90,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a2c585d..558a189 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 _0xe8c0=['getUsers','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update'];(function(_0x4be8ba,_0x5d10ba){var _0x1af822=function(_0x40ed8a){while(--_0x40ed8a){_0x4be8ba['push'](_0x4be8ba['shift']());}};_0x1af822(++_0x5d10ba);}(_0xe8c0,0x159));var _0x0e8c=function(_0x2d150e,_0x4ea8b4){_0x2d150e=_0x2d150e-0x0;var _0xc11e21=_0xe8c0[_0x2d150e];return _0xc11e21;};'use strict';var EventEmitter=require(_0x0e8c('0x0'));var FaxInteraction=require(_0x0e8c('0x1'))['db'][_0x0e8c('0x2')];var FaxMessage=require(_0x0e8c('0x1'))['db'][_0x0e8c('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x0e8c('0x4')](0x0);var events={'afterCreate':_0x0e8c('0x5'),'afterUpdate':_0x0e8c('0x6'),'afterDestroy':'remove'};function emitEvent(_0x31b878){return function(_0x4dbfba,_0x2f75d3,_0x14fdd6){_0x4dbfba[_0x0e8c('0x7')]({'attributes':['id'],'raw':!![]})[_0x0e8c('0x8')](function(_0x295eac){_0x4dbfba[_0x0e8c('0x9')](_0x0e8c('0xa'),_0x295eac['map'](function(_0x23153c){return{'id':_0x23153c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x4dbfba['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0e8c('0x8')](function(_0x388004){_0x4dbfba['setDataValue'](_0x0e8c('0xb'),_0x388004[_0x0e8c('0xc')]);FaxInteractionEvents[_0x0e8c('0xd')](_0x31b878+':'+_0x4dbfba['id'],_0x4dbfba);FaxInteractionEvents[_0x0e8c('0xd')](_0x31b878,_0x4dbfba);_0x14fdd6(null);})['catch'](_0x14fdd6(null));};}for(var e in events){if(events[_0x0e8c('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x0e8c('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x898c=['setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0x898c,0x1b1));var _0xc898=function(_0x3c5c3c,_0x13b428){_0x3c5c3c=_0x3c5c3c-0x0;var _0x2a4714=_0x898c[_0x3c5c3c];return _0x2a4714;};'use strict';var EventEmitter=require(_0xc898('0x0'));var FaxInteraction=require(_0xc898('0x1'))['db'][_0xc898('0x2')];var FaxMessage=require(_0xc898('0x1'))['db'][_0xc898('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xc898('0x4')](0x0);var events={'afterCreate':_0xc898('0x5'),'afterUpdate':'update','afterDestroy':_0xc898('0x6')};function emitEvent(_0x52d8f6){return function(_0x32a822,_0xdc6134,_0x4b3cfb){_0x32a822[_0xc898('0x7')]({'attributes':['id'],'raw':!![]})[_0xc898('0x8')](function(_0x289c10){_0x32a822[_0xc898('0x9')](_0xc898('0xa'),_0x289c10[_0xc898('0xb')](function(_0x2137c1){return{'id':_0x2137c1['id']};}));return FaxMessage[_0xc898('0xc')]({'where':{'FaxInteractionId':_0x32a822['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc898('0x8')](function(_0x3b3809){_0x32a822['setDataValue']('unreadMessages',_0x3b3809[_0xc898('0xd')]);FaxInteractionEvents[_0xc898('0xe')](_0x52d8f6+':'+_0x32a822['id'],_0x32a822);FaxInteractionEvents['emit'](_0x52d8f6,_0x32a822);_0x4b3cfb(null);})[_0xc898('0xf')](_0x4b3cfb(null));};}for(var e in events){if(events[_0xc898('0x10')](e)){var event=events[e];FaxInteraction[_0xc898('0x11')](e,emitEvent(event));}}module[_0xc898('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 14cbd5e..dbddb53 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 _0x294d=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x10718a,_0xff468){var _0x2445a5=function(_0x2e132a){while(--_0x2e132a){_0x10718a['push'](_0x10718a['shift']());}};_0x2445a5(++_0xff468);}(_0x294d,0x7f));var _0xd294=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x294d[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xd294('0x0'));var util=require(_0xd294('0x1'));var logger=require(_0xd294('0x2'))(_0xd294('0x3'));var moment=require(_0xd294('0x4'));var BPromise=require(_0xd294('0x5'));var rp=require(_0xd294('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd294('0x7'));var config=require('../../config/environment');var attributes=require(_0xd294('0x8'));module['exports']=function(_0x4ce4fa,_0x860b7a){return _0x4ce4fa[_0xd294('0x9')](_0xd294('0xa'),attributes,{'tableName':_0xd294('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a1257,_0x1a6558,_0x31019f){if(_0x5a1257[_0xd294('0xc')]('closed')){_0x5a1257[_0xd294('0xd')]=moment()[_0xd294('0xe')](_0xd294('0xf'));}_0x31019f(null,_0x5a1257);}}});}; \ No newline at end of file +var _0xb928=['fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction'];(function(_0x2fbdda,_0x3e935a){var _0x48defb=function(_0x41f4b9){while(--_0x41f4b9){_0x2fbdda['push'](_0x2fbdda['shift']());}};_0x48defb(++_0x3e935a);}(_0xb928,0x16e));var _0x8b92=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xb928[_0x125ff8];return _0x2d9ef;};'use strict';var _=require(_0x8b92('0x0'));var util=require(_0x8b92('0x1'));var logger=require(_0x8b92('0x2'))(_0x8b92('0x3'));var moment=require(_0x8b92('0x4'));var BPromise=require('bluebird');var rp=require(_0x8b92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b92('0x6'));var config=require(_0x8b92('0x7'));var attributes=require(_0x8b92('0x8'));module[_0x8b92('0x9')]=function(_0x11678f,_0x59cc61){return _0x11678f[_0x8b92('0xa')](_0x8b92('0xb'),attributes,{'tableName':_0x8b92('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb4e233,_0x42f79b,_0x1c6677){if(_0xb4e233[_0x8b92('0xd')](_0x8b92('0xe'))){_0xb4e233[_0x8b92('0xf')]=moment()[_0x8b92('0x10')](_0x8b92('0x11'));}_0x1c6677(null,_0xb4e233);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 6374d98..76c6273 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 _0x1607=['catch','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','addTags','ids','spread','AddTags','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x1bdc1c,_0x1af188){var _0x594daf=function(_0x237875){while(--_0x237875){_0x1bdc1c['push'](_0x1bdc1c['shift']());}};_0x594daf(++_0x1af188);}(_0x1607,0xd2));var _0x7160=function(_0xd2c42c,_0x5ee45b){_0xd2c42c=_0xd2c42c-0x0;var _0x247f06=_0x1607[_0xd2c42c];return _0x247f06;};'use strict';var _=require(_0x7160('0x0'));var util=require(_0x7160('0x1'));var moment=require(_0x7160('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7160('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7160('0x4'));var logger=require('../../config/logger')(_0x7160('0x5'));var config=require(_0x7160('0x6'));var jayson=require(_0x7160('0x7'));var client=jayson[_0x7160('0x8')]['http']({'port':0x232a});config['redis']=_[_0x7160('0x9')](config[_0x7160('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7160('0xb'))(new Redis(config[_0x7160('0xa')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x276586,_0x3994dd,_0x55a1dd){return new BPromise(function(_0x5f5354,_0x47eb1f){return client[_0x7160('0xc')](_0x276586,_0x55a1dd)[_0x7160('0xd')](function(_0x1a91fb){logger[_0x7160('0xe')](_0x7160('0xf'),_0x3994dd,'request\x20sent');logger[_0x7160('0x10')](_0x7160('0x11'),_0x3994dd,'request\x20sent',JSON[_0x7160('0x12')](_0x1a91fb));if(_0x1a91fb[_0x7160('0x13')]){if(_0x1a91fb[_0x7160('0x13')][_0x7160('0x14')]===0x1f4){logger[_0x7160('0x13')](_0x7160('0xf'),_0x3994dd,_0x1a91fb[_0x7160('0x13')][_0x7160('0x15')]);return _0x47eb1f(_0x1a91fb[_0x7160('0x13')][_0x7160('0x15')]);}logger[_0x7160('0x13')](_0x7160('0xf'),_0x3994dd,_0x1a91fb[_0x7160('0x13')][_0x7160('0x15')]);return _0x5f5354(_0x1a91fb[_0x7160('0x13')][_0x7160('0x15')]);}else{logger['info'](_0x7160('0xf'),_0x3994dd,_0x7160('0x16'));_0x5f5354(_0x1a91fb[_0x7160('0x17')][_0x7160('0x15')]);}})[_0x7160('0x18')](function(_0x3ecacb){logger['error'](_0x7160('0xf'),_0x3994dd,_0x3ecacb);_0x47eb1f(_0x3ecacb);});});}exports['UpdateFaxInteraction']=function(_0x4dd448){var _0x1f8a1a=this;return new Promise(function(_0x501afa,_0x181211){return db[_0x7160('0x19')][_0x7160('0x1a')](_0x4dd448[_0x7160('0x1b')],{'raw':_0x4dd448[_0x7160('0x1c')]?_0x4dd448[_0x7160('0x1c')][_0x7160('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dd448[_0x7160('0x1c')]?_0x4dd448[_0x7160('0x1c')][_0x7160('0x1e')]||null:null,'attributes':_0x4dd448[_0x7160('0x1c')]?_0x4dd448[_0x7160('0x1c')][_0x7160('0x1f')]||null:null,'limit':_0x4dd448[_0x7160('0x1c')]?_0x4dd448['options'][_0x7160('0x20')]||null:null})[_0x7160('0xd')](function(_0x3e0b4d){logger['info'](_0x7160('0x21'),_0x4dd448);logger[_0x7160('0x10')](_0x7160('0x21'),_0x4dd448,JSON[_0x7160('0x12')](_0x3e0b4d));_0x501afa(_0x3e0b4d);})[_0x7160('0x18')](function(_0x1aa6fa){logger['error'](_0x7160('0x21'),_0x1aa6fa[_0x7160('0x15')],_0x4dd448);_0x181211(_0x1f8a1a[_0x7160('0x13')](0x1f4,_0x1aa6fa['message']));});});};exports[_0x7160('0x22')]=function(_0x4a24cc){return new Promise(function(_0xc1e7bd,_0x434fe2){return db['FaxInteraction']['find']({'where':_0x4a24cc['options']?_0x4a24cc[_0x7160('0x1c')]['where']||null:null})[_0x7160('0xd')](function(_0x44c131){if(_0x44c131){return _0x44c131[_0x7160('0x23')](_0x4a24cc[_0x7160('0x1b')][_0x7160('0x24')],_['omit'](_0x4a24cc[_0x7160('0x1b')],[_0x7160('0x24'),'id'])||{});}})[_0x7160('0x25')](function(_0x27c604){logger[_0x7160('0xe')](_0x7160('0x26'),_0x4a24cc);logger[_0x7160('0x10')](_0x7160('0x26'),_0x4a24cc,JSON[_0x7160('0x12')](_0x27c604));_0xc1e7bd(_0x27c604);})['catch'](function(_0xefa550){logger[_0x7160('0x13')]('AddTags',_0xefa550[_0x7160('0x15')],_0x4a24cc);_0x434fe2(_this[_0x7160('0x13')](0x1f4,_0xefa550[_0x7160('0x15')]));});});}; \ No newline at end of file +var _0x7a7b=['socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','limit','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a7b,0x15d));var _0xb7a7=function(_0x3a2aab,_0x47b12d){_0x3a2aab=_0x3a2aab-0x0;var _0x404775=_0x7a7b[_0x3a2aab];return _0x404775;};'use strict';var _=require(_0xb7a7('0x0'));var util=require(_0xb7a7('0x1'));var moment=require(_0xb7a7('0x2'));var BPromise=require(_0xb7a7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7a7('0x4'))['db'];var utils=require(_0xb7a7('0x5'));var logger=require('../../config/logger')(_0xb7a7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb7a7('0x7')]({'port':0x232a});config[_0xb7a7('0x8')]=_[_0xb7a7('0x9')](config[_0xb7a7('0x8')],{'host':_0xb7a7('0xa'),'port':0x18eb});var socket=require(_0xb7a7('0xb'))(new Redis(config[_0xb7a7('0x8')]));require(_0xb7a7('0xc'))[_0xb7a7('0xd')](socket);function respondWithRpcPromise(_0x4fd507,_0x36e1e0,_0x132ac2){return new BPromise(function(_0x7f665c,_0x3e769e){return client[_0xb7a7('0xe')](_0x4fd507,_0x132ac2)[_0xb7a7('0xf')](function(_0x5aa903){logger['info'](_0xb7a7('0x10'),_0x36e1e0,_0xb7a7('0x11'));logger[_0xb7a7('0x12')](_0xb7a7('0x13'),_0x36e1e0,_0xb7a7('0x11'),JSON[_0xb7a7('0x14')](_0x5aa903));if(_0x5aa903[_0xb7a7('0x15')]){if(_0x5aa903['error'][_0xb7a7('0x16')]===0x1f4){logger['error'](_0xb7a7('0x10'),_0x36e1e0,_0x5aa903[_0xb7a7('0x15')]['message']);return _0x3e769e(_0x5aa903[_0xb7a7('0x15')]['message']);}logger[_0xb7a7('0x15')](_0xb7a7('0x10'),_0x36e1e0,_0x5aa903[_0xb7a7('0x15')][_0xb7a7('0x17')]);return _0x7f665c(_0x5aa903[_0xb7a7('0x15')][_0xb7a7('0x17')]);}else{logger[_0xb7a7('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x36e1e0,_0xb7a7('0x11'));_0x7f665c(_0x5aa903[_0xb7a7('0x19')][_0xb7a7('0x17')]);}})[_0xb7a7('0x1a')](function(_0x3e271d){logger[_0xb7a7('0x15')](_0xb7a7('0x10'),_0x36e1e0,_0x3e271d);_0x3e769e(_0x3e271d);});});}exports[_0xb7a7('0x1b')]=function(_0x2c5242){var _0x1214a6=this;return new Promise(function(_0x4ba3f0,_0x4b65d5){return db[_0xb7a7('0x1c')][_0xb7a7('0x1d')](_0x2c5242[_0xb7a7('0x1e')],{'raw':_0x2c5242['options']?_0x2c5242[_0xb7a7('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c5242[_0xb7a7('0x1f')]?_0x2c5242[_0xb7a7('0x1f')]['where']||null:null,'attributes':_0x2c5242[_0xb7a7('0x1f')]?_0x2c5242[_0xb7a7('0x1f')]['attributes']||null:null,'limit':_0x2c5242[_0xb7a7('0x1f')]?_0x2c5242[_0xb7a7('0x1f')][_0xb7a7('0x20')]||null:null})[_0xb7a7('0xf')](function(_0x5558ac){logger[_0xb7a7('0x18')](_0xb7a7('0x1b'),_0x2c5242);logger[_0xb7a7('0x12')]('UpdateFaxInteraction',_0x2c5242,JSON[_0xb7a7('0x14')](_0x5558ac));_0x4ba3f0(_0x5558ac);})[_0xb7a7('0x1a')](function(_0x1fe19c){logger[_0xb7a7('0x15')](_0xb7a7('0x1b'),_0x1fe19c['message'],_0x2c5242);_0x4b65d5(_0x1214a6[_0xb7a7('0x15')](0x1f4,_0x1fe19c[_0xb7a7('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x17860f){return new Promise(function(_0x4c063a,_0x5c3b73){return db['FaxInteraction'][_0xb7a7('0x21')]({'where':_0x17860f['options']?_0x17860f[_0xb7a7('0x1f')][_0xb7a7('0x22')]||null:null})[_0xb7a7('0xf')](function(_0x534ab3){if(_0x534ab3){return _0x534ab3[_0xb7a7('0x23')](_0x17860f[_0xb7a7('0x1e')][_0xb7a7('0x24')],_[_0xb7a7('0x25')](_0x17860f[_0xb7a7('0x1e')],[_0xb7a7('0x24'),'id'])||{});}})[_0xb7a7('0x26')](function(_0x2b75c0){logger[_0xb7a7('0x18')](_0xb7a7('0x27'),_0x17860f);logger[_0xb7a7('0x12')](_0xb7a7('0x27'),_0x17860f,JSON[_0xb7a7('0x14')](_0x2b75c0));_0x4c063a(_0x2b75c0);})['catch'](function(_0xc69632){logger['error'](_0xb7a7('0x27'),_0xc69632[_0xb7a7('0x17')],_0x17860f);_0x5c3b73(_this[_0xb7a7('0x15')](0x1f4,_0xc69632[_0xb7a7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 2fafb9d..4719b40 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 _0x023a=['save','update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x14fd8a,_0x145ce2){var _0x170e86=function(_0x21f26b){while(--_0x21f26b){_0x14fd8a['push'](_0x14fd8a['shift']());}};_0x170e86(++_0x145ce2);}(_0x023a,0x1ef));var _0xa023=function(_0x514113,_0xf29268){_0x514113=_0x514113-0x0;var _0x5b13fc=_0x023a[_0x514113];return _0x5b13fc;};'use strict';var FaxInteractionEvents=require(_0xa023('0x0'));var events=[_0xa023('0x1'),'remove',_0xa023('0x2')];function createListener(_0x44e820,_0x44c3fe){return function(_0x31f1dd){_0x44c3fe[_0xa023('0x3')](_0x44e820,_0x31f1dd);};}function removeListener(_0x56a8df,_0xabb130){return function(){FaxInteractionEvents[_0xa023('0x4')](_0x56a8df,_0xabb130);};}exports[_0xa023('0x5')]=function(_0x3c41da){for(var _0x566b06=0x0,_0xb3d02b=events[_0xa023('0x6')];_0x566b06<_0xb3d02b;_0x566b06++){var _0x4072c1=events[_0x566b06];var _0x3134c4=createListener(_0xa023('0x7')+_0x4072c1,_0x3c41da);FaxInteractionEvents['on'](_0x4072c1,_0x3134c4);}}; \ No newline at end of file +var _0x464f=['save','remove','update','emit','removeListener','register','faxInteraction:','./faxInteraction.events'];(function(_0x95572,_0x7c3d86){var _0x2a0565=function(_0x159c64){while(--_0x159c64){_0x95572['push'](_0x95572['shift']());}};_0x2a0565(++_0x7c3d86);}(_0x464f,0x127));var _0xf464=function(_0x4b4d99,_0x2e19f3){_0x4b4d99=_0x4b4d99-0x0;var _0x2908aa=_0x464f[_0x4b4d99];return _0x2908aa;};'use strict';var FaxInteractionEvents=require(_0xf464('0x0'));var events=[_0xf464('0x1'),_0xf464('0x2'),_0xf464('0x3')];function createListener(_0x246d6c,_0x30a338){return function(_0x5ae3f7){_0x30a338[_0xf464('0x4')](_0x246d6c,_0x5ae3f7);};}function removeListener(_0x363944,_0xb1022){return function(){FaxInteractionEvents[_0xf464('0x5')](_0x363944,_0xb1022);};}exports[_0xf464('0x6')]=function(_0x3f8eee){for(var _0x3f0fd0=0x0,_0x25901e=events['length'];_0x3f0fd0<_0x25901e;_0x3f0fd0++){var _0x5df3b7=events[_0x3f0fd0];var _0x22f33f=createListener(_0xf464('0x7')+_0x5df3b7,_0x3f8eee);FaxInteractionEvents['on'](_0x5df3b7,_0x22f33f);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index fbb2bfe..8a52e81 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 _0x862f=['faxinteraction:update','update','delete','fax','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags'];(function(_0x3e78f4,_0x5d4c9a){var _0x5ca5eb=function(_0x1161b6){while(--_0x1161b6){_0x3e78f4['push'](_0x3e78f4['shift']());}};_0x5ca5eb(++_0x5d4c9a);}(_0x862f,0xba));var _0xf862=function(_0x3d09b0,_0x466d6a){_0x3d09b0=_0x3d09b0-0x0;var _0x95e533=_0x862f[_0x3d09b0];return _0x95e533;};'use strict';var multer=require('multer');var util=require(_0xf862('0x0'));var path=require(_0xf862('0x1'));var timeout=require(_0xf862('0x2'));var express=require(_0xf862('0x3'));var router=express['Router']();var fs_extra=require(_0xf862('0x4'));var auth=require(_0xf862('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf862('0x6'));router[_0xf862('0x7')]('/',auth[_0xf862('0x8')](),controller[_0xf862('0x9')]);router['get'](_0xf862('0xa'),auth[_0xf862('0x8')](),controller[_0xf862('0xb')]);router[_0xf862('0x7')](_0xf862('0xc'),auth[_0xf862('0x8')](),controller[_0xf862('0xd')]);router['get'](_0xf862('0xe'),auth[_0xf862('0x8')](),controller[_0xf862('0xf')]);router[_0xf862('0x7')](_0xf862('0x10'),auth[_0xf862('0x8')](),controller['download']);router[_0xf862('0x11')]('/',auth[_0xf862('0x8')](),controller[_0xf862('0x12')]);router[_0xf862('0x11')]('/:id/messages',auth[_0xf862('0x8')](),controller[_0xf862('0x13')]);router[_0xf862('0x11')](_0xf862('0x14'),auth[_0xf862('0x8')](),interaction[_0xf862('0x15')]('fax',_0xf862('0x16')),controller[_0xf862('0x17')]);router['put'](_0xf862('0xc'),auth[_0xf862('0x8')](),interaction['tracked']('fax',_0xf862('0x18')),controller[_0xf862('0x19')]);router[_0xf862('0x1a')](_0xf862('0xc'),auth[_0xf862('0x8')](),interaction[_0xf862('0x15')](_0xf862('0x1b'),'faxinteraction:destroy'),controller[_0xf862('0x1c')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0xf862('0x1d')]=router; \ No newline at end of file +var _0xe555=['download','post','create','/:id/tags','tracked','addTags','put','fax','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages'];(function(_0x1fedd1,_0x9e045e){var _0x262a23=function(_0x10906e){while(--_0x10906e){_0x1fedd1['push'](_0x1fedd1['shift']());}};_0x262a23(++_0x9e045e);}(_0xe555,0x158));var _0x5e55=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0xe555[_0x1f239e];return _0x826971;};'use strict';var multer=require(_0x5e55('0x0'));var util=require(_0x5e55('0x1'));var path=require('path');var timeout=require(_0x5e55('0x2'));var express=require(_0x5e55('0x3'));var router=express['Router']();var fs_extra=require(_0x5e55('0x4'));var auth=require(_0x5e55('0x5'));var interaction=require(_0x5e55('0x6'));var config=require(_0x5e55('0x7'));var controller=require(_0x5e55('0x8'));router[_0x5e55('0x9')]('/',auth[_0x5e55('0xa')](),controller[_0x5e55('0xb')]);router[_0x5e55('0x9')](_0x5e55('0xc'),auth[_0x5e55('0xa')](),controller['describe']);router[_0x5e55('0x9')](_0x5e55('0xd'),auth[_0x5e55('0xa')](),controller['show']);router['get'](_0x5e55('0xe'),auth['isAuthenticated'](),controller[_0x5e55('0xf')]);router['get']('/:id/download',auth[_0x5e55('0xa')](),controller[_0x5e55('0x10')]);router[_0x5e55('0x11')]('/',auth[_0x5e55('0xa')](),controller[_0x5e55('0x12')]);router['post'](_0x5e55('0xe'),auth[_0x5e55('0xa')](),controller['addMessage']);router[_0x5e55('0x11')](_0x5e55('0x13'),auth[_0x5e55('0xa')](),interaction[_0x5e55('0x14')]('fax','faxinteraction:addtags'),controller[_0x5e55('0x15')]);router[_0x5e55('0x16')]('/:id',auth[_0x5e55('0xa')](),interaction[_0x5e55('0x14')](_0x5e55('0x17'),_0x5e55('0x18')),controller['update']);router[_0x5e55('0x19')](_0x5e55('0xd'),auth[_0x5e55('0xa')](),interaction['tracked'](_0x5e55('0x17'),_0x5e55('0x1a')),controller[_0x5e55('0x1b')]);router[_0x5e55('0x19')](_0x5e55('0x13'),auth['isAuthenticated'](),controller[_0x5e55('0x1c')]);module[_0x5e55('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index be990a5..9b2fca1 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 _0x13c0=['DATE','sequelize','exports','TEXT','medium','out'];(function(_0x3e4996,_0x211189){var _0x28a9c4=function(_0x5d5563){while(--_0x5d5563){_0x3e4996['push'](_0x3e4996['shift']());}};_0x28a9c4(++_0x211189);}(_0x13c0,0x79));var _0x013c=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0x13c0[_0x2af160];return _0x439d67;};'use strict';var Sequelize=require(_0x013c('0x0'));module[_0x013c('0x1')]={'body':{'type':Sequelize[_0x013c('0x2')](_0x013c('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x013c('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x013c('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x013c('0x5')]}}; \ No newline at end of file +var _0x89e8=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x1baa9b,_0x2e5917){var _0x538a9e=function(_0x5be711){while(--_0x5be711){_0x1baa9b['push'](_0x1baa9b['shift']());}};_0x538a9e(++_0x2e5917);}(_0x89e8,0x74));var _0x889e=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x89e8[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x889e('0x0'));module[_0x889e('0x1')]={'body':{'type':Sequelize[_0x889e('0x2')](_0x889e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x889e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x889e('0x5')]('in',_0x889e('0x6')),'defaultValue':_0x889e('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 389a27d..637f169 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 _0x5ab8=['event','EventManager','acceptmessage','../../config/logger','fax-interactions','get','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','contact','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','AttachmentId','download','join','server','files','attachments','basename','eml-format','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','stack','name','map','FaxMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','body','find','params','describe','accept','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','format','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel'];(function(_0x500b96,_0x5e04bf){var _0x17cd23=function(_0x110efd){while(--_0x110efd){_0x500b96['push'](_0x500b96['shift']());}};_0x17cd23(++_0x5e04bf);}(_0x5ab8,0x1c8));var _0x85ab=function(_0x3ef2e7,_0x42b805){_0x3ef2e7=_0x3ef2e7-0x0;var _0x1ecf7c=_0x5ab8[_0x3ef2e7];return _0x1ecf7c;};'use strict';var emlformat=require(_0x85ab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x85ab('0x1'));var rp=require('request-promise');var moment=require(_0x85ab('0x2'));var BPromise=require(_0x85ab('0x3'));var Mustache=require(_0x85ab('0x4'));var util=require(_0x85ab('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x85ab('0x6'));var ejs=require(_0x85ab('0x7'));var fs=require('fs');var fs_extra=require(_0x85ab('0x8'));var _=require(_0x85ab('0x9'));var squel=require(_0x85ab('0xa'));var crypto=require(_0x85ab('0xb'));var jsforce=require(_0x85ab('0xc'));var deskjs=require(_0x85ab('0xd'));var toCsv=require(_0x85ab('0x6'));var querystring=require(_0x85ab('0xe'));var Papa=require(_0x85ab('0xf'));var Redis=require(_0x85ab('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x85ab('0x11'));var as=require(_0x85ab('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x85ab('0x13'));var utils=require(_0x85ab('0x14'));var config=require(_0x85ab('0x15'));var licenseUtil=require(_0x85ab('0x16'));var db=require(_0x85ab('0x17'))['db'];config[_0x85ab('0x18')]=_[_0x85ab('0x19')](config[_0x85ab('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x85ab('0x1a'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x85ab('0x1b')](socket);var jayson=require(_0x85ab('0x1c'));var client=jayson[_0x85ab('0x1d')][_0x85ab('0x1e')]({'port':0x232c});var client9002=jayson[_0x85ab('0x1d')][_0x85ab('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xa19e72,_0x1a6c65,_0xd152cd,_0x1b6c2d){return new BPromise(function(_0x12f638,_0x5bc7bb){var _0x19f6a2=_0x1b6c2d||client;return _0x19f6a2[_0x85ab('0x1f')](_0xa19e72,_0xd152cd)['then'](function(_0x2498d9){logger[_0x85ab('0x20')](_0x85ab('0x21'),_0x1a6c65,'request\x20sent');logger['debug'](_0x85ab('0x22'),_0x1a6c65,_0x85ab('0x23'),JSON['stringify'](_0x2498d9));if(_0x2498d9[_0x85ab('0x24')]){if(_0x2498d9[_0x85ab('0x24')][_0x85ab('0x25')]===0x1f4){logger[_0x85ab('0x24')](_0x85ab('0x21'),_0x1a6c65,_0x2498d9['error'][_0x85ab('0x26')]);return _0x5bc7bb(_0x2498d9[_0x85ab('0x24')][_0x85ab('0x26')]);}logger[_0x85ab('0x24')](_0x85ab('0x21'),_0x1a6c65,_0x2498d9['error'][_0x85ab('0x26')]);return _0x12f638(_0x2498d9[_0x85ab('0x24')][_0x85ab('0x26')]);}else{logger[_0x85ab('0x20')]('FaxMessage,\x20%s,\x20%s',_0x1a6c65,_0x85ab('0x23'));_0x12f638(_0x2498d9[_0x85ab('0x27')][_0x85ab('0x26')]);}})[_0x85ab('0x28')](function(_0x315a85){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1a6c65,_0x315a85);_0x5bc7bb(_0x315a85);});});}function respondWithStatusCode(_0x581287,_0x149633){_0x149633=_0x149633||0xcc;return function(_0x441928){if(_0x441928){return _0x581287['sendStatus'](_0x149633);}return _0x581287[_0x85ab('0x29')](_0x149633)[_0x85ab('0x2a')]();};}function respondWithResult(_0x58a138,_0x2935d8){_0x2935d8=_0x2935d8||0xc8;return function(_0x74adc3){if(_0x74adc3){return _0x58a138[_0x85ab('0x29')](_0x2935d8)['json'](_0x74adc3);}};}function respondWithFilteredResult(_0x76f695,_0x2365fe){return function(_0x36dde2){if(_0x36dde2){var _0x39c407=typeof _0x2365fe[_0x85ab('0x2b')]===_0x85ab('0x2c')&&typeof _0x2365fe[_0x85ab('0x2d')]===_0x85ab('0x2c');var _0x511429=_0x36dde2[_0x85ab('0x2e')];var _0x4ed1ad=_0x39c407?0x0:_0x2365fe['offset'];var _0x36aefc=_0x39c407?_0x36dde2[_0x85ab('0x2e')]:_0x2365fe['offset']+_0x2365fe[_0x85ab('0x2d')];var _0x2e8977;if(_0x36aefc>=_0x511429){_0x36aefc=_0x511429;_0x2e8977=0xc8;}else{_0x2e8977=0xce;}_0x76f695[_0x85ab('0x29')](_0x2e8977);return _0x76f695['set'](_0x85ab('0x2f'),_0x4ed1ad+'-'+_0x36aefc+'/'+_0x511429)[_0x85ab('0x30')](_0x36dde2);}return null;};}function patchUpdates(_0x2efe4c){return function(_0x24063a){try{jsonpatch['apply'](_0x24063a,_0x2efe4c,!![]);}catch(_0xe5f585){return BPromise[_0x85ab('0x31')](_0xe5f585);}return _0x24063a[_0x85ab('0x32')]();};}function saveUpdates(_0x49dd64,_0x36f9f8){return function(_0x28192d){if(_0x28192d){return _0x28192d[_0x85ab('0x33')](_0x49dd64)[_0x85ab('0x34')](function(_0x55607c){return _0x55607c;});}return null;};}function removeEntity(_0x432402,_0x40c214){return function(_0x261376){if(_0x261376){return _0x261376[_0x85ab('0x35')]()['then'](function(){_0x432402['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40fb24,_0xe95d3f){return function(_0x2ff3d6){if(!_0x2ff3d6){_0x40fb24['sendStatus'](0x194);}return _0x2ff3d6;};}function handleError(_0x1d5d97,_0x1d4751){_0x1d4751=_0x1d4751||0x1f4;return function(_0x4d41fc){logger[_0x85ab('0x24')](_0x4d41fc[_0x85ab('0x36')]);if(_0x4d41fc[_0x85ab('0x37')]){delete _0x4d41fc[_0x85ab('0x37')];}_0x1d5d97[_0x85ab('0x29')](_0x1d4751)['send'](_0x4d41fc);};}exports['index']=function(_0x55963b,_0x49a496){var _0x520d1d={},_0x2dafde={},_0x526fa1={'count':0x0,'rows':[]};var _0x15b593=_[_0x85ab('0x38')](db[_0x85ab('0x39')][_0x85ab('0x3a')],function(_0x9ceaaf){return{'name':_0x9ceaaf[_0x85ab('0x3b')],'type':_0x9ceaaf[_0x85ab('0x3c')][_0x85ab('0x3d')]};});_0x2dafde['model']=_[_0x85ab('0x38')](_0x15b593,_0x85ab('0x37'));_0x2dafde[_0x85ab('0x3e')]=_[_0x85ab('0x3f')](_0x55963b['query']);_0x2dafde['filters']=_[_0x85ab('0x40')](_0x2dafde[_0x85ab('0x41')],_0x2dafde[_0x85ab('0x3e')]);_0x520d1d[_0x85ab('0x42')]=_[_0x85ab('0x40')](_0x2dafde[_0x85ab('0x41')],qs[_0x85ab('0x43')](_0x55963b[_0x85ab('0x3e')][_0x85ab('0x43')]));_0x520d1d['attributes']=_0x520d1d[_0x85ab('0x42')][_0x85ab('0x44')]?_0x520d1d[_0x85ab('0x42')]:_0x2dafde['model'];if(!_0x55963b[_0x85ab('0x3e')][_0x85ab('0x45')]('nolimit')){_0x520d1d['limit']=qs[_0x85ab('0x2d')](_0x55963b[_0x85ab('0x3e')][_0x85ab('0x2d')]);_0x520d1d[_0x85ab('0x2b')]=qs[_0x85ab('0x2b')](_0x55963b[_0x85ab('0x3e')]['offset']);}_0x520d1d[_0x85ab('0x46')]=qs[_0x85ab('0x47')](_0x55963b['query']['sort']);_0x520d1d[_0x85ab('0x48')]=qs[_0x85ab('0x49')](_[_0x85ab('0x4a')](_0x55963b[_0x85ab('0x3e')],_0x2dafde[_0x85ab('0x49')]),_0x15b593);if(_0x55963b[_0x85ab('0x3e')]['filter']){_0x520d1d[_0x85ab('0x48')]=_[_0x85ab('0x4b')](_0x520d1d[_0x85ab('0x48')],{'$or':_[_0x85ab('0x38')](_0x15b593,function(_0x33bdfb){if(_0x33bdfb['type']!==_0x85ab('0x4c')){var _0x319c2c={};_0x319c2c[_0x33bdfb[_0x85ab('0x37')]]={'$like':'%'+_0x55963b[_0x85ab('0x3e')][_0x85ab('0x4d')]+'%'};return _0x319c2c;}})});}_0x520d1d=_[_0x85ab('0x4b')]({},_0x520d1d,_0x55963b[_0x85ab('0x4e')]);var _0xcf97f8={'where':_0x520d1d[_0x85ab('0x48')]};return db[_0x85ab('0x39')][_0x85ab('0x2e')](_0xcf97f8)[_0x85ab('0x34')](function(_0xa27e48){_0x526fa1[_0x85ab('0x2e')]=_0xa27e48;if(_0x55963b[_0x85ab('0x3e')][_0x85ab('0x4f')]){_0x520d1d[_0x85ab('0x50')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x520d1d);})[_0x85ab('0x34')](function(_0x45efeb){_0x526fa1[_0x85ab('0x51')]=_0x45efeb;return _0x526fa1;})[_0x85ab('0x34')](respondWithFilteredResult(_0x49a496,_0x520d1d))['catch'](handleError(_0x49a496,null));};exports[_0x85ab('0x52')]=function(_0xbe1705,_0x575fb8){var _0x2929c4={'raw':!![],'where':{'id':_0xbe1705['params']['id']}},_0x3b7bac={};_0x3b7bac[_0x85ab('0x41')]=_['keys'](db[_0x85ab('0x39')][_0x85ab('0x3a')]);_0x3b7bac[_0x85ab('0x3e')]=_['keys'](_0xbe1705[_0x85ab('0x3e')]);_0x3b7bac[_0x85ab('0x49')]=_['intersection'](_0x3b7bac['model'],_0x3b7bac['query']);_0x2929c4['attributes']=_['intersection'](_0x3b7bac['model'],qs[_0x85ab('0x43')](_0xbe1705[_0x85ab('0x3e')][_0x85ab('0x43')]));_0x2929c4[_0x85ab('0x42')]=_0x2929c4[_0x85ab('0x42')][_0x85ab('0x44')]?_0x2929c4[_0x85ab('0x42')]:_0x3b7bac['model'];if(_0xbe1705[_0x85ab('0x3e')][_0x85ab('0x4f')]){_0x2929c4[_0x85ab('0x50')]=[{'all':!![]}];}_0x2929c4=_[_0x85ab('0x4b')]({},_0x2929c4,_0xbe1705[_0x85ab('0x4e')]);return db[_0x85ab('0x39')]['find'](_0x2929c4)[_0x85ab('0x34')](handleEntityNotFound(_0x575fb8,null))['then'](respondWithResult(_0x575fb8,null))['catch'](handleError(_0x575fb8,null));};exports[_0x85ab('0x33')]=function(_0x1d2476,_0x1d8337){if(_0x1d2476[_0x85ab('0x53')]['id']){delete _0x1d2476[_0x85ab('0x53')]['id'];}return db[_0x85ab('0x39')]['find']({'where':{'id':_0x1d2476['params']['id']}})[_0x85ab('0x34')](handleEntityNotFound(_0x1d8337,null))[_0x85ab('0x34')](saveUpdates(_0x1d2476[_0x85ab('0x53')],null))[_0x85ab('0x34')](respondWithResult(_0x1d8337,null))[_0x85ab('0x28')](handleError(_0x1d8337,null));};exports['destroy']=function(_0x128467,_0x22e618){return db[_0x85ab('0x39')][_0x85ab('0x54')]({'where':{'id':_0x128467[_0x85ab('0x55')]['id']}})[_0x85ab('0x34')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))['catch'](handleError(_0x22e618,null));};exports[_0x85ab('0x56')]=function(_0x1db57b,_0x399256){return db[_0x85ab('0x39')]['describe']()[_0x85ab('0x34')](respondWithResult(_0x399256,null))['catch'](handleError(_0x399256,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x85ab('0x57')]=function(_0x23c7fb,_0x3610ae,_0x505ccf){var _0x5c93e9={'agent':{},'channel':_0x85ab('0x58')};if(_0x23c7fb[_0x85ab('0x53')]['id']){delete _0x23c7fb[_0x85ab('0x53')]['id'];}_0x23c7fb[_0x85ab('0x53')]['read']=!![];_0x23c7fb[_0x85ab('0x53')][_0x85ab('0x59')]=moment()['format'](_0x85ab('0x5a'));_0x23c7fb[_0x85ab('0x53')][_0x85ab('0x5b')]=_0x23c7fb[_0x85ab('0x53')]['UserId']||_0x23c7fb[_0x85ab('0x5c')]['id'];_0x5c93e9[_0x85ab('0x5d')]['id']=_0x23c7fb['body'][_0x85ab('0x5b')];return db[_0x85ab('0x39')][_0x85ab('0x54')]({'where':{'id':_0x23c7fb['params']['id'],'UserId':null}})[_0x85ab('0x34')](handleEntityNotFound(_0x3610ae,null))[_0x85ab('0x34')](saveUpdates(_0x23c7fb['body'],null))[_0x85ab('0x34')](function(_0x4167e8){if(_0x4167e8){_0x5c93e9[_0x85ab('0x26')]=_0x4167e8['get']({'plain':!![]});return db[_0x85ab('0x5e')][_0x85ab('0x54')]({'where':{'id':_0x4167e8[_0x85ab('0x5f')]}});}return null;})[_0x85ab('0x34')](handleEntityNotFound(_0x3610ae,null))['then'](function(_0x2e9dd3){if(_0x2e9dd3){return _0x2e9dd3['update']({'UserId':_0x23c7fb[_0x85ab('0x53')][_0x85ab('0x5b')],'read1stAt':_[_0x85ab('0x60')](_0x2e9dd3['read1stAt'])?moment()[_0x85ab('0x61')](_0x85ab('0x5a')):undefined});}return null;})['then'](function(_0x5da1a6){if(_0x5da1a6){_0x5c93e9['interaction']=_0x5da1a6['get']({'plain':!![]});interaction_log[_0x85ab('0x20')](_0x85ab('0x62'),_0x23c7fb[_0x85ab('0x5c')]['id'],_0x23c7fb[_0x85ab('0x5c')][_0x85ab('0x37')],_0x23c7fb[_0x85ab('0x5c')]['role'],_0x5c93e9['interaction']['id'],_0x23c7fb[_0x85ab('0x53')]?JSON[_0x85ab('0x63')](_0x23c7fb['body']):_0x85ab('0x64'));return respondWithRpcPromise(_0x85ab('0x65'),'acceptMessage',_0x5c93e9);}return null;})[_0x85ab('0x34')](function(_0x21b46f){var _0x56a580=_0x85ab('0x66')+_0x21b46f['message']['ContactId'];return db[_0x85ab('0x67')][_0x85ab('0x3e')](_0x56a580,{'type':db[_0x85ab('0x68')][_0x85ab('0x69')][_0x85ab('0x6a')],'raw':!![]})[_0x85ab('0x34')](function(_0x4afdcd){return _0x4afdcd;});})[_0x85ab('0x34')](function(_0x4cbe5e){if(_0x4cbe5e){_0x5c93e9['message']['contact']=_0x4cbe5e[0x0];if(!_0x23c7fb[_0x85ab('0x53')][_0x85ab('0x5b')])return;return db[_0x85ab('0x6b')][_0x85ab('0x54')]({'where':{'id':_0x23c7fb['body'][_0x85ab('0x5b')],'role':_0x85ab('0x5d')},'attributes':['id',_0x85ab('0x37'),_0x85ab('0x6c'),_0x85ab('0x6d'),_0x85ab('0x6e')],'raw':!![]});}return null;})[_0x85ab('0x34')](function(_0x5a7cb0){if(!_0x5a7cb0)return null;_0x5c93e9[_0x85ab('0x26')][_0x85ab('0x5d')]=_0x5a7cb0;return _0x5c93e9;})[_0x85ab('0x34')](function(_0x493b3b){if(_0x493b3b){if(_0x23c7fb[_0x85ab('0x53')][_0x85ab('0x6f')]){_0x5c93e9[_0x85ab('0x26')][_0x85ab('0x70')]=util['format'](_0x85ab('0x71'),_0x23c7fb[_0x85ab('0x5c')]['name']);_0x5c93e9[_0x85ab('0x26')][_0x85ab('0x72')]=_0x5c93e9[_0x85ab('0x72')];_0x5c93e9[_0x85ab('0x26')][_0x85ab('0x73')]=_0x5c93e9['channel'];_0x5c93e9[_0x85ab('0x26')][_0x85ab('0x74')]=_0x85ab('0x57');return respondWithRpcPromise(_0x85ab('0x75'),'EventManager',{'event':_0x85ab('0x76'),'message':_0x5c93e9['message']},client9002)[_0x85ab('0x34')](function(){return _0x5c93e9;});}return _0x5c93e9;}return null;})[_0x85ab('0x34')](respondWithResult(_0x3610ae,null))[_0x85ab('0x28')](handleError(_0x3610ae,null));};var interaction_log=require(_0x85ab('0x77'))(_0x85ab('0x78'));exports[_0x85ab('0x31')]=function(_0x23210a,_0x4254a3,_0x2c81c6){var _0x26cbd8={'agent':{},'channel':_0x85ab('0x58')};if(_0x23210a['body']['id']){delete _0x23210a[_0x85ab('0x53')]['id'];}_0x23210a[_0x85ab('0x53')][_0x85ab('0x5b')]=_0x23210a['body'][_0x85ab('0x5b')]||_0x23210a[_0x85ab('0x5c')]['id'];_0x26cbd8['agent']['id']=_0x23210a[_0x85ab('0x53')]['UserId'];return db['FaxMessage'][_0x85ab('0x54')]({'where':{'id':_0x23210a[_0x85ab('0x55')]['id'],'UserId':null}})[_0x85ab('0x34')](handleEntityNotFound(_0x4254a3,null))['then'](function(_0x3d5100){if(_0x3d5100){_0x26cbd8[_0x85ab('0x26')]=_0x3d5100[_0x85ab('0x79')]({'plain':!![]});return db[_0x85ab('0x5e')][_0x85ab('0x54')]({'where':{'id':_0x3d5100[_0x85ab('0x5f')]}});}return null;})[_0x85ab('0x34')](handleEntityNotFound(_0x4254a3,null))[_0x85ab('0x34')](function(_0x1320b5){if(_0x1320b5){_0x26cbd8[_0x85ab('0x7a')]=_0x1320b5['get']({'plain':!![]});interaction_log[_0x85ab('0x20')](_0x85ab('0x7b'),_0x23210a[_0x85ab('0x5c')]['id'],_0x23210a[_0x85ab('0x5c')][_0x85ab('0x37')],_0x23210a[_0x85ab('0x5c')][_0x85ab('0x7c')],_0x26cbd8[_0x85ab('0x7a')]['id'],_0x23210a[_0x85ab('0x53')]?JSON[_0x85ab('0x63')](_0x23210a['body']):_0x85ab('0x64'));return respondWithRpcPromise(_0x85ab('0x7d'),_0x85ab('0x7e'),_0x26cbd8);}return null;})[_0x85ab('0x34')](function(_0x20975b){var _0x5de0c7=_0x85ab('0x66')+_0x20975b[_0x85ab('0x26')][_0x85ab('0x7f')];return db['sequelize']['query'](_0x5de0c7,{'type':db['Sequelize'][_0x85ab('0x69')][_0x85ab('0x6a')],'raw':!![]})[_0x85ab('0x34')](function(_0x17720e){return _0x17720e;});})[_0x85ab('0x34')](function(_0x3b0247){if(_0x3b0247){_0x26cbd8['message'][_0x85ab('0x80')]=_0x3b0247[0x0];if(!_0x23210a[_0x85ab('0x53')]['UserId'])return;return db[_0x85ab('0x6b')][_0x85ab('0x54')]({'where':{'id':_0x23210a[_0x85ab('0x53')]['UserId'],'role':_0x85ab('0x5d')},'attributes':['id',_0x85ab('0x37'),_0x85ab('0x6c'),_0x85ab('0x6d'),_0x85ab('0x6e')],'raw':!![]});}return null;})[_0x85ab('0x34')](function(_0x8d6f57){if(!_0x8d6f57)return null;_0x26cbd8[_0x85ab('0x26')][_0x85ab('0x5d')]=_0x8d6f57;return _0x26cbd8;})[_0x85ab('0x34')](function(_0x56a490){if(_0x56a490){_0x56a490[_0x85ab('0x26')][_0x85ab('0x70')]=util[_0x85ab('0x61')](_0x85ab('0x71'),_0x23210a[_0x85ab('0x5c')]['name']);_0x56a490[_0x85ab('0x26')][_0x85ab('0x72')]=_0x26cbd8[_0x85ab('0x72')];_0x56a490['message'][_0x85ab('0x73')]=_0x26cbd8[_0x85ab('0x72')];_0x56a490['message'][_0x85ab('0x74')]=_0x85ab('0x31');respondWithRpcPromise(_0x85ab('0x75'),'EventManager',{'event':_0x85ab('0x81'),'message':_0x56a490[_0x85ab('0x26')]},client9002);return _0x26cbd8;}return null;})[_0x85ab('0x34')](respondWithResult(_0x4254a3,null))[_0x85ab('0x28')](handleError(_0x4254a3,null));};exports[_0x85ab('0x82')]=function(_0x50ded9,_0xab6516){var _0x4b7bc6;return db[_0x85ab('0x39')][_0x85ab('0x82')](_0x50ded9[_0x85ab('0x53')],{})[_0x85ab('0x34')](function(_0x2da553){_0x4b7bc6=_0x2da553;return db[_0x85ab('0x83')][_0x85ab('0x84')]({'where':{'id':_0x4b7bc6[_0x85ab('0x7f')]}});})['then'](function(_0x461329){if(_[_0x85ab('0x60')](_0x461329)){return;}else{_0x4b7bc6[_0x85ab('0x58')]=_0x461329[_0x85ab('0x58')];return db[_0x85ab('0x85')][_0x85ab('0x84')]({'where':{'id':_0x4b7bc6['AttachmentId']}});}})[_0x85ab('0x34')](function(_0x6c6a50){return respondWithRpcPromise(_0x85ab('0x86'),_0x85ab('0x86'),{'FaxAccountId':_[_0x85ab('0x60')](_0x50ded9[_0x85ab('0x53')])?undefined:_0x50ded9[_0x85ab('0x53')][_0x85ab('0x87')],'path':_[_0x85ab('0x60')](_0x6c6a50)?undefined:util[_0x85ab('0x61')]('/var/opt/motion2/server/files/attachments/%s',_0x6c6a50['basename']),'fax':_[_0x85ab('0x60')](_0x4b7bc6[_0x85ab('0x58')])?undefined:_0x4b7bc6[_0x85ab('0x58')],'AttachmentId':_0x4b7bc6[_0x85ab('0x88')]},client9002);})[_0x85ab('0x34')](respondWithResult(_0xab6516,0xc9))[_0x85ab('0x28')](handleError(_0xab6516,null));};exports[_0x85ab('0x89')]=function(_0x311edb,_0x4630dc){var _0x237998=path[_0x85ab('0x8a')](config['root'],_0x85ab('0x8b'),_0x85ab('0x8c'),_0x85ab('0x8d'));return db[_0x85ab('0x39')][_0x85ab('0x54')]({'where':{'id':_0x311edb[_0x85ab('0x55')]['id']},'include':[{'model':db[_0x85ab('0x85')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x4630dc,null))[_0x85ab('0x34')](function(_0x118022){if(_0x118022){return _0x4630dc['download'](path[_0x85ab('0x8a')](_0x237998,_0x118022[_0x85ab('0x85')][_0x85ab('0x8e')]));}})[_0x85ab('0x28')](handleError(_0x4630dc,null));}; \ No newline at end of file +var _0xef18=['fullname','email','manual','SIP/%s','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','rejectMessage','Sequelize','internal','motionChannel','rejectmessage','create','Attachment','findOne','SendFax','FaxAccountId','AttachmentId','join','root','server','files','attachments','download','basename','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','offset','count','set','Content-Range','apply','reject','save','destroy','stack','name','send','map','FaxMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','then','findAll','rows','show','params','rawAttributes','includeAll','include','body','find','describe','accept','fax','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','update','isNil','YYYY-MM-DD\x20HH:mm:ss','[FAXMESSAGE: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','QueryTypes','SELECT','contact'];(function(_0x179b74,_0x5dc97d){var _0x268f76=function(_0x19c8c2){while(--_0x19c8c2){_0x179b74['push'](_0x179b74['shift']());}};_0x268f76(++_0x5dc97d);}(_0xef18,0xac));var _0x8ef1=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0xef18[_0x45d1fd];return _0xd0e542;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ef1('0x0'));var zipdir=require(_0x8ef1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8ef1('0x2'));var BPromise=require(_0x8ef1('0x3'));var Mustache=require(_0x8ef1('0x4'));var util=require(_0x8ef1('0x5'));var path=require(_0x8ef1('0x6'));var sox=require(_0x8ef1('0x7'));var csv=require(_0x8ef1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ef1('0x9'));var _=require(_0x8ef1('0xa'));var squel=require(_0x8ef1('0xb'));var crypto=require(_0x8ef1('0xc'));var jsforce=require(_0x8ef1('0xd'));var deskjs=require(_0x8ef1('0xe'));var toCsv=require(_0x8ef1('0x8'));var querystring=require(_0x8ef1('0xf'));var Papa=require(_0x8ef1('0x10'));var Redis=require(_0x8ef1('0x11'));var authService=require(_0x8ef1('0x12'));var qs=require(_0x8ef1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ef1('0x14'))('api');var utils=require(_0x8ef1('0x15'));var config=require(_0x8ef1('0x16'));var licenseUtil=require(_0x8ef1('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8ef1('0x18')](config[_0x8ef1('0x19')],{'host':_0x8ef1('0x1a'),'port':0x18eb});var socket=require(_0x8ef1('0x1b'))(new Redis(config[_0x8ef1('0x19')]));require(_0x8ef1('0x1c'))[_0x8ef1('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8ef1('0x1e')][_0x8ef1('0x1f')]({'port':0x232c});var client9002=jayson[_0x8ef1('0x1e')][_0x8ef1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2ba15f,_0x1daa7c,_0x532b80,_0xf84418){return new BPromise(function(_0x33a7ce,_0x43836f){var _0x29cf80=_0xf84418||client;return _0x29cf80[_0x8ef1('0x20')](_0x2ba15f,_0x532b80)['then'](function(_0x5c5a2d){logger[_0x8ef1('0x21')]('FaxMessage,\x20%s,\x20%s',_0x1daa7c,_0x8ef1('0x22'));logger[_0x8ef1('0x23')](_0x8ef1('0x24'),_0x1daa7c,_0x8ef1('0x22'),JSON['stringify'](_0x5c5a2d));if(_0x5c5a2d[_0x8ef1('0x25')]){if(_0x5c5a2d[_0x8ef1('0x25')][_0x8ef1('0x26')]===0x1f4){logger[_0x8ef1('0x25')](_0x8ef1('0x27'),_0x1daa7c,_0x5c5a2d[_0x8ef1('0x25')][_0x8ef1('0x28')]);return _0x43836f(_0x5c5a2d[_0x8ef1('0x25')][_0x8ef1('0x28')]);}logger[_0x8ef1('0x25')](_0x8ef1('0x27'),_0x1daa7c,_0x5c5a2d[_0x8ef1('0x25')][_0x8ef1('0x28')]);return _0x33a7ce(_0x5c5a2d[_0x8ef1('0x25')]['message']);}else{logger['info'](_0x8ef1('0x27'),_0x1daa7c,_0x8ef1('0x22'));_0x33a7ce(_0x5c5a2d[_0x8ef1('0x29')][_0x8ef1('0x28')]);}})[_0x8ef1('0x2a')](function(_0x18ca7c){logger[_0x8ef1('0x25')]('FaxMessage,\x20%s,\x20%s',_0x1daa7c,_0x18ca7c);_0x43836f(_0x18ca7c);});});}function respondWithStatusCode(_0x18ec91,_0xf5f47){_0xf5f47=_0xf5f47||0xcc;return function(_0x226dcb){if(_0x226dcb){return _0x18ec91[_0x8ef1('0x2b')](_0xf5f47);}return _0x18ec91[_0x8ef1('0x2c')](_0xf5f47)[_0x8ef1('0x2d')]();};}function respondWithResult(_0xf57fe1,_0x4e72af){_0x4e72af=_0x4e72af||0xc8;return function(_0x4d345b){if(_0x4d345b){return _0xf57fe1[_0x8ef1('0x2c')](_0x4e72af)[_0x8ef1('0x2e')](_0x4d345b);}};}function respondWithFilteredResult(_0x233a39,_0x36540a){return function(_0xd8c8a1){if(_0xd8c8a1){var _0x4b7cf3=typeof _0x36540a['offset']===_0x8ef1('0x2f')&&typeof _0x36540a['limit']===_0x8ef1('0x2f');var _0x5ae32b=_0xd8c8a1['count'];var _0x1b979b=_0x4b7cf3?0x0:_0x36540a[_0x8ef1('0x30')];var _0x2fcba4=_0x4b7cf3?_0xd8c8a1[_0x8ef1('0x31')]:_0x36540a[_0x8ef1('0x30')]+_0x36540a['limit'];var _0x46974c;if(_0x2fcba4>=_0x5ae32b){_0x2fcba4=_0x5ae32b;_0x46974c=0xc8;}else{_0x46974c=0xce;}_0x233a39[_0x8ef1('0x2c')](_0x46974c);return _0x233a39[_0x8ef1('0x32')](_0x8ef1('0x33'),_0x1b979b+'-'+_0x2fcba4+'/'+_0x5ae32b)[_0x8ef1('0x2e')](_0xd8c8a1);}return null;};}function patchUpdates(_0x3f4051){return function(_0x148a26){try{jsonpatch[_0x8ef1('0x34')](_0x148a26,_0x3f4051,!![]);}catch(_0x3f7bb0){return BPromise[_0x8ef1('0x35')](_0x3f7bb0);}return _0x148a26[_0x8ef1('0x36')]();};}function saveUpdates(_0x1652bb,_0x31f4a2){return function(_0x5f5536){if(_0x5f5536){return _0x5f5536['update'](_0x1652bb)['then'](function(_0x2ae5a4){return _0x2ae5a4;});}return null;};}function removeEntity(_0x3364dd,_0x3ad01b){return function(_0x14cb60){if(_0x14cb60){return _0x14cb60[_0x8ef1('0x37')]()['then'](function(){_0x3364dd[_0x8ef1('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e8fe0,_0x27948b){return function(_0x5d1f14){if(!_0x5d1f14){_0x3e8fe0[_0x8ef1('0x2b')](0x194);}return _0x5d1f14;};}function handleError(_0x52dca8,_0xc02b57){_0xc02b57=_0xc02b57||0x1f4;return function(_0x52f4e4){logger[_0x8ef1('0x25')](_0x52f4e4[_0x8ef1('0x38')]);if(_0x52f4e4['name']){delete _0x52f4e4[_0x8ef1('0x39')];}_0x52dca8[_0x8ef1('0x2c')](_0xc02b57)[_0x8ef1('0x3a')](_0x52f4e4);};}exports['index']=function(_0x1aba77,_0xe98d05){var _0x500723={},_0x33ec97={},_0x1a1eb6={'count':0x0,'rows':[]};var _0xffa52d=_[_0x8ef1('0x3b')](db[_0x8ef1('0x3c')]['rawAttributes'],function(_0x6d5a8b){return{'name':_0x6d5a8b[_0x8ef1('0x3d')],'type':_0x6d5a8b[_0x8ef1('0x3e')][_0x8ef1('0x3f')]};});_0x33ec97[_0x8ef1('0x40')]=_['map'](_0xffa52d,_0x8ef1('0x39'));_0x33ec97[_0x8ef1('0x41')]=_[_0x8ef1('0x42')](_0x1aba77[_0x8ef1('0x41')]);_0x33ec97[_0x8ef1('0x43')]=_[_0x8ef1('0x44')](_0x33ec97['model'],_0x33ec97[_0x8ef1('0x41')]);_0x500723[_0x8ef1('0x45')]=_[_0x8ef1('0x44')](_0x33ec97[_0x8ef1('0x40')],qs[_0x8ef1('0x46')](_0x1aba77[_0x8ef1('0x41')]['fields']));_0x500723['attributes']=_0x500723[_0x8ef1('0x45')]['length']?_0x500723[_0x8ef1('0x45')]:_0x33ec97[_0x8ef1('0x40')];if(!_0x1aba77['query'][_0x8ef1('0x47')](_0x8ef1('0x48'))){_0x500723['limit']=qs[_0x8ef1('0x49')](_0x1aba77[_0x8ef1('0x41')][_0x8ef1('0x49')]);_0x500723[_0x8ef1('0x30')]=qs[_0x8ef1('0x30')](_0x1aba77[_0x8ef1('0x41')][_0x8ef1('0x30')]);}_0x500723['order']=qs[_0x8ef1('0x4a')](_0x1aba77[_0x8ef1('0x41')][_0x8ef1('0x4a')]);_0x500723[_0x8ef1('0x4b')]=qs['filters'](_[_0x8ef1('0x4c')](_0x1aba77[_0x8ef1('0x41')],_0x33ec97[_0x8ef1('0x43')]),_0xffa52d);if(_0x1aba77['query'][_0x8ef1('0x4d')]){_0x500723['where']=_['merge'](_0x500723[_0x8ef1('0x4b')],{'$or':_[_0x8ef1('0x3b')](_0xffa52d,function(_0x3fcb87){if(_0x3fcb87[_0x8ef1('0x3e')]!==_0x8ef1('0x4e')){var _0x2e4585={};_0x2e4585[_0x3fcb87[_0x8ef1('0x39')]]={'$like':'%'+_0x1aba77[_0x8ef1('0x41')][_0x8ef1('0x4d')]+'%'};return _0x2e4585;}})});}_0x500723=_[_0x8ef1('0x4f')]({},_0x500723,_0x1aba77[_0x8ef1('0x50')]);var _0x41230e={'where':_0x500723[_0x8ef1('0x4b')]};return db[_0x8ef1('0x3c')][_0x8ef1('0x31')](_0x41230e)[_0x8ef1('0x51')](function(_0x2c3689){_0x1a1eb6[_0x8ef1('0x31')]=_0x2c3689;if(_0x1aba77[_0x8ef1('0x41')]['includeAll']){_0x500723['include']=[{'all':!![]}];}return db[_0x8ef1('0x3c')][_0x8ef1('0x52')](_0x500723);})[_0x8ef1('0x51')](function(_0x3274b8){_0x1a1eb6[_0x8ef1('0x53')]=_0x3274b8;return _0x1a1eb6;})[_0x8ef1('0x51')](respondWithFilteredResult(_0xe98d05,_0x500723))[_0x8ef1('0x2a')](handleError(_0xe98d05,null));};exports[_0x8ef1('0x54')]=function(_0x1f5bd6,_0x1eb345){var _0xc6da21={'raw':!![],'where':{'id':_0x1f5bd6[_0x8ef1('0x55')]['id']}},_0x2eeeca={};_0x2eeeca[_0x8ef1('0x40')]=_[_0x8ef1('0x42')](db[_0x8ef1('0x3c')][_0x8ef1('0x56')]);_0x2eeeca[_0x8ef1('0x41')]=_[_0x8ef1('0x42')](_0x1f5bd6['query']);_0x2eeeca[_0x8ef1('0x43')]=_[_0x8ef1('0x44')](_0x2eeeca[_0x8ef1('0x40')],_0x2eeeca[_0x8ef1('0x41')]);_0xc6da21[_0x8ef1('0x45')]=_[_0x8ef1('0x44')](_0x2eeeca[_0x8ef1('0x40')],qs['fields'](_0x1f5bd6[_0x8ef1('0x41')][_0x8ef1('0x46')]));_0xc6da21['attributes']=_0xc6da21[_0x8ef1('0x45')]['length']?_0xc6da21['attributes']:_0x2eeeca[_0x8ef1('0x40')];if(_0x1f5bd6[_0x8ef1('0x41')][_0x8ef1('0x57')]){_0xc6da21[_0x8ef1('0x58')]=[{'all':!![]}];}_0xc6da21=_[_0x8ef1('0x4f')]({},_0xc6da21,_0x1f5bd6[_0x8ef1('0x50')]);return db[_0x8ef1('0x3c')]['find'](_0xc6da21)[_0x8ef1('0x51')](handleEntityNotFound(_0x1eb345,null))['then'](respondWithResult(_0x1eb345,null))[_0x8ef1('0x2a')](handleError(_0x1eb345,null));};exports['update']=function(_0x499aa6,_0x3477ba){if(_0x499aa6[_0x8ef1('0x59')]['id']){delete _0x499aa6[_0x8ef1('0x59')]['id'];}return db[_0x8ef1('0x3c')][_0x8ef1('0x5a')]({'where':{'id':_0x499aa6[_0x8ef1('0x55')]['id']}})[_0x8ef1('0x51')](handleEntityNotFound(_0x3477ba,null))[_0x8ef1('0x51')](saveUpdates(_0x499aa6[_0x8ef1('0x59')],null))[_0x8ef1('0x51')](respondWithResult(_0x3477ba,null))['catch'](handleError(_0x3477ba,null));};exports[_0x8ef1('0x37')]=function(_0x3c4c3d,_0x169ac4){return db[_0x8ef1('0x3c')][_0x8ef1('0x5a')]({'where':{'id':_0x3c4c3d[_0x8ef1('0x55')]['id']}})[_0x8ef1('0x51')](handleEntityNotFound(_0x169ac4,null))[_0x8ef1('0x51')](removeEntity(_0x169ac4,null))[_0x8ef1('0x2a')](handleError(_0x169ac4,null));};exports['describe']=function(_0x37852b,_0x15ff69){return db[_0x8ef1('0x3c')][_0x8ef1('0x5b')]()[_0x8ef1('0x51')](respondWithResult(_0x15ff69,null))[_0x8ef1('0x2a')](handleError(_0x15ff69,null));};var interaction_log=require(_0x8ef1('0x14'))('fax-interactions');exports[_0x8ef1('0x5c')]=function(_0xd7b905,_0x30e6b2,_0x528d01){var _0x21b7ad={'agent':{},'channel':_0x8ef1('0x5d')};if(_0xd7b905[_0x8ef1('0x59')]['id']){delete _0xd7b905[_0x8ef1('0x59')]['id'];}_0xd7b905[_0x8ef1('0x59')]['read']=!![];_0xd7b905[_0x8ef1('0x59')][_0x8ef1('0x5e')]=moment()[_0x8ef1('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0xd7b905[_0x8ef1('0x59')][_0x8ef1('0x60')]=_0xd7b905[_0x8ef1('0x59')][_0x8ef1('0x60')]||_0xd7b905[_0x8ef1('0x61')]['id'];_0x21b7ad[_0x8ef1('0x62')]['id']=_0xd7b905[_0x8ef1('0x59')][_0x8ef1('0x60')];return db[_0x8ef1('0x3c')]['find']({'where':{'id':_0xd7b905[_0x8ef1('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x30e6b2,null))[_0x8ef1('0x51')](saveUpdates(_0xd7b905['body'],null))[_0x8ef1('0x51')](function(_0x83d6b0){if(_0x83d6b0){_0x21b7ad['message']=_0x83d6b0[_0x8ef1('0x63')]({'plain':!![]});return db[_0x8ef1('0x64')][_0x8ef1('0x5a')]({'where':{'id':_0x83d6b0[_0x8ef1('0x65')]}});}return null;})[_0x8ef1('0x51')](handleEntityNotFound(_0x30e6b2,null))[_0x8ef1('0x51')](function(_0xe5becc){if(_0xe5becc){return _0xe5becc[_0x8ef1('0x66')]({'UserId':_0xd7b905[_0x8ef1('0x59')][_0x8ef1('0x60')],'read1stAt':_[_0x8ef1('0x67')](_0xe5becc['read1stAt'])?moment()[_0x8ef1('0x5f')](_0x8ef1('0x68')):undefined});}return null;})[_0x8ef1('0x51')](function(_0x57f2ed){if(_0x57f2ed){_0x21b7ad['interaction']=_0x57f2ed['get']({'plain':!![]});interaction_log['info'](_0x8ef1('0x69'),_0xd7b905[_0x8ef1('0x61')]['id'],_0xd7b905['user'][_0x8ef1('0x39')],_0xd7b905[_0x8ef1('0x61')][_0x8ef1('0x6a')],_0x21b7ad[_0x8ef1('0x6b')]['id'],_0xd7b905['body']?JSON['stringify'](_0xd7b905['body']):_0x8ef1('0x6c'));return respondWithRpcPromise(_0x8ef1('0x6d'),'acceptMessage',_0x21b7ad);}return null;})[_0x8ef1('0x51')](function(_0x24cab7){var _0x21197b=_0x8ef1('0x6e')+_0x24cab7[_0x8ef1('0x28')][_0x8ef1('0x6f')];return db[_0x8ef1('0x70')][_0x8ef1('0x41')](_0x21197b,{'type':db['Sequelize'][_0x8ef1('0x71')][_0x8ef1('0x72')],'raw':!![]})[_0x8ef1('0x51')](function(_0x39e095){return _0x39e095;});})['then'](function(_0x69fdac){if(_0x69fdac){_0x21b7ad[_0x8ef1('0x28')][_0x8ef1('0x73')]=_0x69fdac[0x0];if(!_0xd7b905['body'][_0x8ef1('0x60')])return;return db['User'][_0x8ef1('0x5a')]({'where':{'id':_0xd7b905['body'][_0x8ef1('0x60')],'role':_0x8ef1('0x62')},'attributes':['id','name',_0x8ef1('0x74'),_0x8ef1('0x75'),'internal'],'raw':!![]});}return null;})[_0x8ef1('0x51')](function(_0x325a02){if(!_0x325a02)return null;_0x21b7ad[_0x8ef1('0x28')][_0x8ef1('0x62')]=_0x325a02;return _0x21b7ad;})['then'](function(_0x232e56){if(_0x232e56){if(_0xd7b905[_0x8ef1('0x59')][_0x8ef1('0x76')]){_0x21b7ad['message']['interface']=util[_0x8ef1('0x5f')](_0x8ef1('0x77'),_0xd7b905['user']['name']);_0x21b7ad['message'][_0x8ef1('0x78')]=_0x21b7ad['channel'];_0x21b7ad[_0x8ef1('0x28')]['motionChannel']=_0x21b7ad[_0x8ef1('0x78')];_0x21b7ad[_0x8ef1('0x28')][_0x8ef1('0x79')]='accept';return respondWithRpcPromise(_0x8ef1('0x7a'),'EventManager',{'event':_0x8ef1('0x7b'),'message':_0x21b7ad[_0x8ef1('0x28')]},client9002)[_0x8ef1('0x51')](function(){return _0x21b7ad;});}return _0x21b7ad;}return null;})[_0x8ef1('0x51')](respondWithResult(_0x30e6b2,null))['catch'](handleError(_0x30e6b2,null));};var interaction_log=require(_0x8ef1('0x14'))('fax-interactions');exports[_0x8ef1('0x35')]=function(_0x1a18cc,_0x58aab9,_0xf2f6ac){var _0x4ef4b4={'agent':{},'channel':'fax'};if(_0x1a18cc[_0x8ef1('0x59')]['id']){delete _0x1a18cc['body']['id'];}_0x1a18cc['body'][_0x8ef1('0x60')]=_0x1a18cc[_0x8ef1('0x59')][_0x8ef1('0x60')]||_0x1a18cc[_0x8ef1('0x61')]['id'];_0x4ef4b4[_0x8ef1('0x62')]['id']=_0x1a18cc[_0x8ef1('0x59')][_0x8ef1('0x60')];return db['FaxMessage'][_0x8ef1('0x5a')]({'where':{'id':_0x1a18cc[_0x8ef1('0x55')]['id'],'UserId':null}})[_0x8ef1('0x51')](handleEntityNotFound(_0x58aab9,null))[_0x8ef1('0x51')](function(_0x124885){if(_0x124885){_0x4ef4b4[_0x8ef1('0x28')]=_0x124885[_0x8ef1('0x63')]({'plain':!![]});return db[_0x8ef1('0x64')][_0x8ef1('0x5a')]({'where':{'id':_0x124885[_0x8ef1('0x65')]}});}return null;})[_0x8ef1('0x51')](handleEntityNotFound(_0x58aab9,null))[_0x8ef1('0x51')](function(_0x3c4326){if(_0x3c4326){_0x4ef4b4[_0x8ef1('0x6b')]=_0x3c4326[_0x8ef1('0x63')]({'plain':!![]});interaction_log['info'](_0x8ef1('0x7c'),_0x1a18cc['user']['id'],_0x1a18cc[_0x8ef1('0x61')][_0x8ef1('0x39')],_0x1a18cc['user'][_0x8ef1('0x6a')],_0x4ef4b4[_0x8ef1('0x6b')]['id'],_0x1a18cc[_0x8ef1('0x59')]?JSON[_0x8ef1('0x7d')](_0x1a18cc[_0x8ef1('0x59')]):_0x8ef1('0x6c'));return respondWithRpcPromise('RejectMessage',_0x8ef1('0x7e'),_0x4ef4b4);}return null;})[_0x8ef1('0x51')](function(_0x565d59){var _0x32c53b=_0x8ef1('0x6e')+_0x565d59[_0x8ef1('0x28')][_0x8ef1('0x6f')];return db[_0x8ef1('0x70')][_0x8ef1('0x41')](_0x32c53b,{'type':db[_0x8ef1('0x7f')][_0x8ef1('0x71')]['SELECT'],'raw':!![]})[_0x8ef1('0x51')](function(_0x113cbb){return _0x113cbb;});})['then'](function(_0x4beeed){if(_0x4beeed){_0x4ef4b4[_0x8ef1('0x28')][_0x8ef1('0x73')]=_0x4beeed[0x0];if(!_0x1a18cc[_0x8ef1('0x59')][_0x8ef1('0x60')])return;return db['User'][_0x8ef1('0x5a')]({'where':{'id':_0x1a18cc[_0x8ef1('0x59')][_0x8ef1('0x60')],'role':_0x8ef1('0x62')},'attributes':['id',_0x8ef1('0x39'),'fullname','email',_0x8ef1('0x80')],'raw':!![]});}return null;})[_0x8ef1('0x51')](function(_0x414d55){if(!_0x414d55)return null;_0x4ef4b4['message'][_0x8ef1('0x62')]=_0x414d55;return _0x4ef4b4;})['then'](function(_0x14b765){if(_0x14b765){_0x14b765['message']['interface']=util['format'](_0x8ef1('0x77'),_0x1a18cc[_0x8ef1('0x61')][_0x8ef1('0x39')]);_0x14b765[_0x8ef1('0x28')]['channel']=_0x4ef4b4[_0x8ef1('0x78')];_0x14b765['message'][_0x8ef1('0x81')]=_0x4ef4b4[_0x8ef1('0x78')];_0x14b765[_0x8ef1('0x28')]['event']=_0x8ef1('0x35');respondWithRpcPromise(_0x8ef1('0x7a'),_0x8ef1('0x7a'),{'event':_0x8ef1('0x82'),'message':_0x14b765[_0x8ef1('0x28')]},client9002);return _0x4ef4b4;}return null;})['then'](respondWithResult(_0x58aab9,null))[_0x8ef1('0x2a')](handleError(_0x58aab9,null));};exports[_0x8ef1('0x83')]=function(_0x45a6a9,_0x826a9e){var _0x63479c;return db['FaxMessage']['create'](_0x45a6a9[_0x8ef1('0x59')],{})[_0x8ef1('0x51')](function(_0x694b55){_0x63479c=_0x694b55;return db['CmContact']['findOne']({'where':{'id':_0x63479c[_0x8ef1('0x6f')]}});})[_0x8ef1('0x51')](function(_0x5492d0){if(_[_0x8ef1('0x67')](_0x5492d0)){return;}else{_0x63479c['fax']=_0x5492d0[_0x8ef1('0x5d')];return db[_0x8ef1('0x84')][_0x8ef1('0x85')]({'where':{'id':_0x63479c['AttachmentId']}});}})[_0x8ef1('0x51')](function(_0x3790de){return respondWithRpcPromise('SendFax',_0x8ef1('0x86'),{'FaxAccountId':_[_0x8ef1('0x67')](_0x45a6a9[_0x8ef1('0x59')])?undefined:_0x45a6a9['body'][_0x8ef1('0x87')],'path':_[_0x8ef1('0x67')](_0x3790de)?undefined:util[_0x8ef1('0x5f')]('/var/opt/motion2/server/files/attachments/%s',_0x3790de['basename']),'fax':_['isNil'](_0x63479c[_0x8ef1('0x5d')])?undefined:_0x63479c['fax'],'AttachmentId':_0x63479c[_0x8ef1('0x88')]},client9002);})['then'](respondWithResult(_0x826a9e,0xc9))[_0x8ef1('0x2a')](handleError(_0x826a9e,null));};exports['download']=function(_0x35125a,_0x3d8682){var _0x7ca40d=path[_0x8ef1('0x89')](config[_0x8ef1('0x8a')],_0x8ef1('0x8b'),_0x8ef1('0x8c'),_0x8ef1('0x8d'));return db['FaxMessage'][_0x8ef1('0x5a')]({'where':{'id':_0x35125a[_0x8ef1('0x55')]['id']},'include':[{'model':db[_0x8ef1('0x84')],'as':_0x8ef1('0x84')}]})['then'](handleEntityNotFound(_0x3d8682,null))[_0x8ef1('0x51')](function(_0x17f729){if(_0x17f729){return _0x3d8682[_0x8ef1('0x8e')](path[_0x8ef1('0x89')](_0x7ca40d,_0x17f729[_0x8ef1('0x84')][_0x8ef1('0x8f')]));}})[_0x8ef1('0x2a')](handleError(_0x3d8682,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 8ed1a2d..e35beb9 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 _0x7d37=['FaxMessage','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x52248f,_0x341011){var _0x367efd=function(_0x34eacb){while(--_0x34eacb){_0x52248f['push'](_0x52248f['shift']());}};_0x367efd(++_0x341011);}(_0x7d37,0x1db));var _0x77d3=function(_0x310446,_0x16c029){_0x310446=_0x310446-0x0;var _0x2f5b43=_0x7d37[_0x310446];return _0x2f5b43;};'use strict';var EventEmitter=require(_0x77d3('0x0'));var FaxMessage=require(_0x77d3('0x1'))['db'][_0x77d3('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x77d3('0x3'),'afterUpdate':_0x77d3('0x4'),'afterDestroy':_0x77d3('0x5')};function emitEvent(_0x52c909){return function(_0x293f20,_0x2ae533,_0x59773d){FaxMessageEvents[_0x77d3('0x6')](_0x52c909+':'+_0x293f20['id'],_0x293f20);FaxMessageEvents['emit'](_0x52c909,_0x293f20);_0x59773d(null);};}for(var e in events){if(events[_0x77d3('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x77d3('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x110e=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x110e,0x68));var _0xe110=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x110e[_0x599f41];return _0x2e4d58;};'use strict';var EventEmitter=require(_0xe110('0x0'));var FaxMessage=require(_0xe110('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xe110('0x2')](0x0);var events={'afterCreate':_0xe110('0x3'),'afterUpdate':_0xe110('0x4'),'afterDestroy':_0xe110('0x5')};function emitEvent(_0x3f8825){return function(_0x4d182f,_0x563977,_0x5032de){FaxMessageEvents['emit'](_0x3f8825+':'+_0x4d182f['id'],_0x4d182f);FaxMessageEvents[_0xe110('0x6')](_0x3f8825,_0x4d182f);_0x5032de(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xe110('0x7')](e,emitEvent(event));}}module[_0xe110('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 130640d..d22231d 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 _0xcd40=['fti_fax_messages','get','direction','toLowerCase','out','secret','FaxInteraction','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages'];(function(_0x25b598,_0x5861d0){var _0x582cb2=function(_0x438d31){while(--_0x438d31){_0x25b598['push'](_0x25b598['shift']());}};_0x582cb2(++_0x5861d0);}(_0xcd40,0x184));var _0x0cd4=function(_0x3a349e,_0x35c4af){_0x3a349e=_0x3a349e-0x0;var _0x3130ae=_0xcd40[_0x3a349e];return _0x3130ae;};'use strict';var _=require(_0x0cd4('0x0'));var util=require(_0x0cd4('0x1'));var logger=require(_0x0cd4('0x2'))('api');var moment=require(_0x0cd4('0x3'));var BPromise=require(_0x0cd4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0cd4('0x5'));var rimraf=require('rimraf');var config=require(_0x0cd4('0x6'));var attributes=require(_0x0cd4('0x7'));module[_0x0cd4('0x8')]=function(_0x5e2a4d,_0x50a2b7){return _0x5e2a4d[_0x0cd4('0x9')](_0x0cd4('0xa'),attributes,{'tableName':_0x0cd4('0xb'),'paranoid':![],'indexes':[{'name':_0x0cd4('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12205e,_0x25c3a6,_0x5c0c24){var _0x4db8f8=_0x5e2a4d['models'];var _0x53979f=_0x12205e[_0x0cd4('0xd')]({'plain':!![]});if(_0x53979f[_0x0cd4('0xe')][_0x0cd4('0xf')]()==='in'||_0x53979f[_0x0cd4('0xe')]['toLowerCase']()===_0x0cd4('0x10')&&!_0x53979f[_0x0cd4('0x11')]&&!_['isNil'](_0x53979f['UserId'])){_0x4db8f8[_0x0cd4('0x12')]['findOne']({'where':{'id':_0x53979f['FaxInteractionId']}})[_0x0cd4('0x13')](function(_0x1d0a6c){if(_0x1d0a6c){_0x1d0a6c[_0x0cd4('0x14')]({'lastMsgAt':_0x53979f[_0x0cd4('0x15')],'lastMsgDirection':_0x53979f['direction']['toLowerCase']()});}})[_0x0cd4('0x16')](function(_0x296001){console[_0x0cd4('0x17')](_0x296001);});}_0x5c0c24();}},'charset':_0x0cd4('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x36f4=['exports','FaxMessage','fax_messages','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','FaxInteraction','FaxInteractionId','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxMessage.attributes'];(function(_0x123902,_0x4912bf){var _0x1464f1=function(_0x4d95db){while(--_0x4d95db){_0x123902['push'](_0x123902['shift']());}};_0x1464f1(++_0x4912bf);}(_0x36f4,0x163));var _0x436f=function(_0x16d416,_0x2791dc){_0x16d416=_0x16d416-0x0;var _0x1c592c=_0x36f4[_0x16d416];return _0x1c592c;};'use strict';var _=require(_0x436f('0x0'));var util=require(_0x436f('0x1'));var logger=require(_0x436f('0x2'))(_0x436f('0x3'));var moment=require(_0x436f('0x4'));var BPromise=require('bluebird');var rp=require(_0x436f('0x5'));var fs=require('fs');var path=require(_0x436f('0x6'));var rimraf=require('rimraf');var config=require(_0x436f('0x7'));var attributes=require(_0x436f('0x8'));module[_0x436f('0x9')]=function(_0x280e2b,_0x12a45b){return _0x280e2b['define'](_0x436f('0xa'),attributes,{'tableName':_0x436f('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0x436f('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x206452,_0x4b269,_0x3064f5){var _0x104db7=_0x280e2b[_0x436f('0xd')];var _0x226d73=_0x206452[_0x436f('0xe')]({'plain':!![]});if(_0x226d73['direction']['toLowerCase']()==='in'||_0x226d73[_0x436f('0xf')][_0x436f('0x10')]()==='out'&&!_0x226d73['secret']&&!_[_0x436f('0x11')](_0x226d73[_0x436f('0x12')])){_0x104db7[_0x436f('0x13')]['findOne']({'where':{'id':_0x226d73[_0x436f('0x14')]}})['then'](function(_0x4c36ee){if(_0x4c36ee){_0x4c36ee[_0x436f('0x15')]({'lastMsgAt':_0x226d73[_0x436f('0x16')],'lastMsgDirection':_0x226d73[_0x436f('0xf')][_0x436f('0x10')]()});}})[_0x436f('0x17')](function(_0xd59c0){console[_0x436f('0x18')](_0xd59c0);});}_0x3064f5();}},'charset':_0x436f('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index d067324..7ab5d08 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 _0x008c=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','catch','options','raw','then','CreateFaxMessage','attributes','limit','UpdateFaxMessage','stringify','lodash','util','moment','bluebird'];(function(_0x25e516,_0x5670ea){var _0x59a84c=function(_0x3fa6a0){while(--_0x3fa6a0){_0x25e516['push'](_0x25e516['shift']());}};_0x59a84c(++_0x5670ea);}(_0x008c,0x188));var _0xc008=function(_0x3eae8d,_0x331b35){_0x3eae8d=_0x3eae8d-0x0;var _0x360920=_0x008c[_0x3eae8d];return _0x360920;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});config[_0xc008('0xd')]=_['defaults'](config[_0xc008('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc008('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xc008('0xf')](socket);function respondWithRpcPromise(_0x7231b4,_0x57c46d,_0x51ba7d){return new BPromise(function(_0x543eb8,_0x1eacfa){return client[_0xc008('0x10')](_0x7231b4,_0x51ba7d)['then'](function(_0xae2dab){logger[_0xc008('0x11')](_0xc008('0x12'),_0x57c46d,_0xc008('0x13'));logger[_0xc008('0x14')](_0xc008('0x15'),_0x57c46d,_0xc008('0x13'),JSON['stringify'](_0xae2dab));if(_0xae2dab['error']){if(_0xae2dab[_0xc008('0x16')]['code']===0x1f4){logger[_0xc008('0x16')](_0xc008('0x12'),_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x1eacfa(_0xae2dab[_0xc008('0x16')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x543eb8(_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x57c46d,'request\x20sent');_0x543eb8(_0xae2dab['result'][_0xc008('0x17')]);}})[_0xc008('0x18')](function(_0x501137){logger[_0xc008('0x16')]('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0x501137);_0x1eacfa(_0x501137);});});}exports['CreateFaxMessage']=function(_0x543e5d){var _0x50261c=this;return new Promise(function(_0x5754a0,_0x4b9726){return db['FaxMessage']['create'](_0x543e5d['body'],{'raw':_0x543e5d['options']?_0x543e5d[_0xc008('0x19')][_0xc008('0x1a')]===undefined?!![]:![]:!![]})[_0xc008('0x1b')](function(_0x415af3){logger[_0xc008('0x11')](_0xc008('0x1c'),_0x543e5d);logger['debug'](_0xc008('0x1c'),_0x543e5d,JSON['stringify'](_0x415af3));_0x5754a0(_0x415af3);})['catch'](function(_0x218599){logger[_0xc008('0x16')](_0xc008('0x1c'),_0x218599[_0xc008('0x17')],_0x543e5d);_0x4b9726(_0x50261c['error'](0x1f4,_0x218599['message']));});});};exports['UpdateFaxMessage']=function(_0x3f7b07){var _0x15dade=this;return new Promise(function(_0x92c582,_0x2e31c2){return db['FaxMessage']['update'](_0x3f7b07['body'],{'raw':_0x3f7b07['options']?_0x3f7b07['options'][_0xc008('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')]['where']||null:null,'attributes':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')][_0xc008('0x1d')]||null:null,'limit':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07['options'][_0xc008('0x1e')]||null:null})[_0xc008('0x1b')](function(_0x53ed35){logger['info']('UpdateFaxMessage',_0x3f7b07);logger[_0xc008('0x14')](_0xc008('0x1f'),_0x3f7b07,JSON[_0xc008('0x20')](_0x53ed35));_0x92c582(_0x53ed35);})[_0xc008('0x18')](function(_0x1de04b){logger[_0xc008('0x16')](_0xc008('0x1f'),_0x1de04b[_0xc008('0x17')],_0x3f7b07);_0x2e31c2(_0x15dade[_0xc008('0x16')](0x1f4,_0x1de04b[_0xc008('0x17')]));});});}; \ No newline at end of file +var _0x84ab=['code','message','result','catch','FaxMessage','create','body','raw','CreateFaxMessage','debug','UpdateFaxMessage','update','options','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','./faxMessage.socket','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x566f61,_0x443ab7){var _0x25863c=function(_0x5a2e57){while(--_0x5a2e57){_0x566f61['push'](_0x566f61['shift']());}};_0x25863c(++_0x443ab7);}(_0x84ab,0x12f));var _0xb84a=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0x84ab[_0x4d67b8];return _0x55af3b;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xb84a('0xa')](config['redis'],{'host':_0xb84a('0xb'),'port':0x18eb});var socket=require(_0xb84a('0xc'))(new Redis(config['redis']));require(_0xb84a('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e6a71,_0x1886e0,_0x42daf5){return new BPromise(function(_0x5d3b29,_0x5a34f7){return client['request'](_0x2e6a71,_0x42daf5)[_0xb84a('0xe')](function(_0x17379b){logger[_0xb84a('0xf')](_0xb84a('0x10'),_0x1886e0,_0xb84a('0x11'));logger['debug'](_0xb84a('0x12'),_0x1886e0,_0xb84a('0x11'),JSON[_0xb84a('0x13')](_0x17379b));if(_0x17379b[_0xb84a('0x14')]){if(_0x17379b[_0xb84a('0x14')][_0xb84a('0x15')]===0x1f4){logger[_0xb84a('0x14')](_0xb84a('0x10'),_0x1886e0,_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);return _0x5a34f7(_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);}logger['error'](_0xb84a('0x10'),_0x1886e0,_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);return _0x5d3b29(_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);}else{logger[_0xb84a('0xf')](_0xb84a('0x10'),_0x1886e0,_0xb84a('0x11'));_0x5d3b29(_0x17379b[_0xb84a('0x17')][_0xb84a('0x16')]);}})[_0xb84a('0x18')](function(_0x2de49c){logger[_0xb84a('0x14')](_0xb84a('0x10'),_0x1886e0,_0x2de49c);_0x5a34f7(_0x2de49c);});});}exports['CreateFaxMessage']=function(_0x1a0056){var _0x319216=this;return new Promise(function(_0x55a633,_0xac76d3){return db[_0xb84a('0x19')][_0xb84a('0x1a')](_0x1a0056[_0xb84a('0x1b')],{'raw':_0x1a0056['options']?_0x1a0056['options'][_0xb84a('0x1c')]===undefined?!![]:![]:!![]})[_0xb84a('0xe')](function(_0x2d70fd){logger[_0xb84a('0xf')](_0xb84a('0x1d'),_0x1a0056);logger[_0xb84a('0x1e')](_0xb84a('0x1d'),_0x1a0056,JSON[_0xb84a('0x13')](_0x2d70fd));_0x55a633(_0x2d70fd);})[_0xb84a('0x18')](function(_0x26fe42){logger[_0xb84a('0x14')](_0xb84a('0x1d'),_0x26fe42[_0xb84a('0x16')],_0x1a0056);_0xac76d3(_0x319216[_0xb84a('0x14')](0x1f4,_0x26fe42[_0xb84a('0x16')]));});});};exports[_0xb84a('0x1f')]=function(_0x378ce1){var _0x3ff0bc=this;return new Promise(function(_0x3b6805,_0xd468c3){return db[_0xb84a('0x19')][_0xb84a('0x20')](_0x378ce1[_0xb84a('0x1b')],{'raw':_0x378ce1[_0xb84a('0x21')]?_0x378ce1[_0xb84a('0x21')][_0xb84a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378ce1['options']?_0x378ce1['options'][_0xb84a('0x22')]||null:null,'attributes':_0x378ce1[_0xb84a('0x21')]?_0x378ce1['options'][_0xb84a('0x23')]||null:null,'limit':_0x378ce1[_0xb84a('0x21')]?_0x378ce1['options']['limit']||null:null})[_0xb84a('0xe')](function(_0x8e9319){logger['info'](_0xb84a('0x1f'),_0x378ce1);logger[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x378ce1,JSON[_0xb84a('0x13')](_0x8e9319));_0x3b6805(_0x8e9319);})[_0xb84a('0x18')](function(_0x144c25){logger[_0xb84a('0x14')](_0xb84a('0x1f'),_0x144c25['message'],_0x378ce1);_0xd468c3(_0x3ff0bc[_0xb84a('0x14')](0x1f4,_0x144c25['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 5b263ef..4fd0b6f 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 _0xc6eb=['faxMessage:','./faxMessage.events','save','remove','removeListener','register','length'];(function(_0x3bdb1f,_0x266eda){var _0x220ee3=function(_0x1a0d2a){while(--_0x1a0d2a){_0x3bdb1f['push'](_0x3bdb1f['shift']());}};_0x220ee3(++_0x266eda);}(_0xc6eb,0x1dd));var _0xbc6e=function(_0x4c4d9c,_0x5bd0eb){_0x4c4d9c=_0x4c4d9c-0x0;var _0x5063fb=_0xc6eb[_0x4c4d9c];return _0x5063fb;};'use strict';var FaxMessageEvents=require(_0xbc6e('0x0'));var events=[_0xbc6e('0x1'),_0xbc6e('0x2'),'update'];function createListener(_0x2b2f7f,_0x549563){return function(_0x39cc4a){_0x549563['emit'](_0x2b2f7f,_0x39cc4a);};}function removeListener(_0x365e59,_0x1d19b8){return function(){FaxMessageEvents[_0xbc6e('0x3')](_0x365e59,_0x1d19b8);};}exports[_0xbc6e('0x4')]=function(_0x17074e){for(var _0x2c9b14=0x0,_0x397856=events[_0xbc6e('0x5')];_0x2c9b14<_0x397856;_0x2c9b14++){var _0x5657b4=events[_0x2c9b14];var _0x2bb577=createListener(_0xbc6e('0x6')+_0x5657b4,_0x17074e);FaxMessageEvents['on'](_0x5657b4,_0x2bb577);}}; \ No newline at end of file +var _0xa2b0=['register','length','faxMessage:','save','remove','update','emit'];(function(_0x4a5516,_0x4cf973){var _0x161148=function(_0xe05e8a){while(--_0xe05e8a){_0x4a5516['push'](_0x4a5516['shift']());}};_0x161148(++_0x4cf973);}(_0xa2b0,0xc0));var _0x0a2b=function(_0x2bd9f4,_0x43e4a6){_0x2bd9f4=_0x2bd9f4-0x0;var _0x25cabc=_0xa2b0[_0x2bd9f4];return _0x25cabc;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x0a2b('0x0'),_0x0a2b('0x1'),_0x0a2b('0x2')];function createListener(_0x1aecaf,_0x36d0c2){return function(_0x37bf3f){_0x36d0c2[_0x0a2b('0x3')](_0x1aecaf,_0x37bf3f);};}function removeListener(_0x39be0d,_0x3d69e5){return function(){FaxMessageEvents['removeListener'](_0x39be0d,_0x3d69e5);};}exports[_0x0a2b('0x4')]=function(_0x415007){for(var _0x2cdff0=0x0,_0x3d95c3=events[_0x0a2b('0x5')];_0x2cdff0<_0x3d95c3;_0x2cdff0++){var _0x692554=events[_0x2cdff0];var _0x37a4d9=createListener(_0x0a2b('0x6')+_0x692554,_0x415007);FaxMessageEvents['on'](_0x692554,_0x37a4d9);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 1df1c13..3df053d 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 _0xda55=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','express'];(function(_0x245ee2,_0x2e6cd2){var _0x514482=function(_0x41bd28){while(--_0x41bd28){_0x245ee2['push'](_0x245ee2['shift']());}};_0x514482(++_0x2e6cd2);}(_0xda55,0x6d));var _0x5da5=function(_0x1c25c7,_0x335fab){_0x1c25c7=_0x1c25c7-0x0;var _0x5e0173=_0xda55[_0x1c25c7];return _0x5e0173;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var fs_extra=require(_0x5da5('0x4'));var auth=require(_0x5da5('0x5'));var interaction=require(_0x5da5('0x6'));var config=require('../../config/environment');var controller=require(_0x5da5('0x7'));router['get']('/',auth[_0x5da5('0x8')](),controller['index']);router[_0x5da5('0x9')](_0x5da5('0xa'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xb')]);router[_0x5da5('0x9')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xd')]);router['get'](_0x5da5('0xe'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xf')]);router[_0x5da5('0x10')]('/',auth[_0x5da5('0x8')](),interaction[_0x5da5('0x11')](_0x5da5('0x12'),'faxmessage:create'),controller[_0x5da5('0x13')]);router[_0x5da5('0x14')]('/:id',auth[_0x5da5('0x8')](),controller[_0x5da5('0x15')]);router[_0x5da5('0x14')](_0x5da5('0x16'),auth[_0x5da5('0x8')](),controller[_0x5da5('0x17')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x5da5('0x18')]);router[_0x5da5('0x19')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0x1a')]);module[_0x5da5('0x1b')]=router; \ No newline at end of file +var _0xc6d8=['describe','/:id','show','/:id/download','download','post','tracked','faxmessage:create','update','put','/:id/accept','accept','/:id/reject','delete','exports','multer','path','express','fs-extra','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x2cce65,_0x432a8b){var _0x413539=function(_0x1b0cf2){while(--_0x1b0cf2){_0x2cce65['push'](_0x2cce65['shift']());}};_0x413539(++_0x432a8b);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x5383f1,_0x327fb3){_0x5383f1=_0x5383f1-0x0;var _0xa23930=_0xc6d8[_0x5383f1];return _0xa23930;};'use strict';var multer=require(_0x8c6d('0x0'));var util=require('util');var path=require(_0x8c6d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c6d('0x2'));var router=express['Router']();var fs_extra=require(_0x8c6d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c6d('0x4'));var controller=require(_0x8c6d('0x5'));router[_0x8c6d('0x6')]('/',auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x8')]);router[_0x8c6d('0x6')](_0x8c6d('0x9'),auth['isAuthenticated'](),controller[_0x8c6d('0xa')]);router[_0x8c6d('0x6')](_0x8c6d('0xb'),auth['isAuthenticated'](),controller[_0x8c6d('0xc')]);router[_0x8c6d('0x6')](_0x8c6d('0xd'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0xe')]);router[_0x8c6d('0xf')]('/',auth[_0x8c6d('0x7')](),interaction[_0x8c6d('0x10')]('fax',_0x8c6d('0x11')),controller['create']);router['put'](_0x8c6d('0xb'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x12')]);router[_0x8c6d('0x13')](_0x8c6d('0x14'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x15')]);router[_0x8c6d('0x13')](_0x8c6d('0x16'),auth[_0x8c6d('0x7')](),controller['reject']);router[_0x8c6d('0x17')]('/:id',auth[_0x8c6d('0x7')](),controller['destroy']);module[_0x8c6d('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 3cd4719..0bd7f2b 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 _0x5c0f=['INTEGER','ENUM','rrmemory','roundrobin','STRING','name'];(function(_0x4d8b19,_0x1c480c){var _0x341ff0=function(_0x174563){while(--_0x174563){_0x4d8b19['push'](_0x4d8b19['shift']());}};_0x341ff0(++_0x1c480c);}(_0x5c0f,0x160));var _0xf5c0=function(_0x2a8255,_0x2ab6cb){_0x2a8255=_0x2a8255-0x0;var _0x20d7a5=_0x5c0f[_0x2a8255];return _0x20d7a5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf5c0('0x0')],'unique':_0xf5c0('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf5c0('0x0')]},'timeout':{'type':Sequelize[_0xf5c0('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf5c0('0x3')](_0xf5c0('0x4'),'beepall',_0xf5c0('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xf5c0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd9ce=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x1adccf,_0x266fca){var _0x2ffe3b=function(_0x5c3b29){while(--_0x5c3b29){_0x1adccf['push'](_0x1adccf['shift']());}};_0x2ffe3b(++_0x266fca);}(_0xd9ce,0xeb));var _0xed9c=function(_0x1aaf79,_0x298f15){_0x1aaf79=_0x1aaf79-0x0;var _0x12e371=_0xd9ce[_0x1aaf79];return _0x12e371;};'use strict';var Sequelize=require(_0xed9c('0x0'));module[_0xed9c('0x1')]={'name':{'type':Sequelize[_0xed9c('0x2')],'unique':_0xed9c('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xed9c('0x2')]},'timeout':{'type':Sequelize[_0xed9c('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xed9c('0x5')](_0xed9c('0x6'),'beepall',_0xed9c('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xed9c('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 23ef77b..bf627d4 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 _0xaf68=['findOrCreate','forEach','userFaxQueue:save','User','select','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeTeams','isEmpty','emit','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','end','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','FaxQueue','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','pick','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','rawAttributes','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','UserFaxQueue'];(function(_0x50d7ce,_0x570279){var _0xf7a6e1=function(_0x11cd57){while(--_0x11cd57){_0x50d7ce['push'](_0x50d7ce['shift']());}};_0xf7a6e1(++_0x570279);}(_0xaf68,0x146));var _0x8af6=function(_0x2d8fa7,_0x181dcc){_0x2d8fa7=_0x2d8fa7-0x0;var _0x46114a=_0xaf68[_0x2d8fa7];return _0x46114a;};'use strict';var emlformat=require(_0x8af6('0x0'));var rimraf=require(_0x8af6('0x1'));var zipdir=require(_0x8af6('0x2'));var jsonpatch=require(_0x8af6('0x3'));var rp=require(_0x8af6('0x4'));var moment=require(_0x8af6('0x5'));var BPromise=require(_0x8af6('0x6'));var Mustache=require(_0x8af6('0x7'));var util=require(_0x8af6('0x8'));var path=require(_0x8af6('0x9'));var sox=require(_0x8af6('0xa'));var csv=require('to-csv');var ejs=require(_0x8af6('0xb'));var fs=require('fs');var fs_extra=require(_0x8af6('0xc'));var _=require(_0x8af6('0xd'));var squel=require('squel');var crypto=require(_0x8af6('0xe'));var jsforce=require(_0x8af6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8af6('0x10'));var querystring=require(_0x8af6('0x11'));var Papa=require(_0x8af6('0x12'));var Redis=require(_0x8af6('0x13'));var authService=require(_0x8af6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x8af6('0x15'));var hardwareService=require(_0x8af6('0x16'));var logger=require(_0x8af6('0x17'))(_0x8af6('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8af6('0x19'));var db=require(_0x8af6('0x1a'))['db'];config[_0x8af6('0x1b')]=_[_0x8af6('0x1c')](config['redis'],{'host':_0x8af6('0x1d'),'port':0x18eb});var socket=require(_0x8af6('0x1e'))(new Redis(config[_0x8af6('0x1b')]));require(_0x8af6('0x1f'))['register'](socket);function respondWithStatusCode(_0x117fc3,_0x52da1c){_0x52da1c=_0x52da1c||0xcc;return function(_0x4a2ddb){if(_0x4a2ddb){return _0x117fc3['sendStatus'](_0x52da1c);}return _0x117fc3['status'](_0x52da1c)[_0x8af6('0x20')]();};}function respondWithResult(_0x15fe1f,_0x50592a){_0x50592a=_0x50592a||0xc8;return function(_0x27738f){if(_0x27738f){return _0x15fe1f[_0x8af6('0x21')](_0x50592a)[_0x8af6('0x22')](_0x27738f);}};}function respondWithFilteredResult(_0x51a93b,_0x2e2079){return function(_0x14b8c0){if(_0x14b8c0){var _0x3b0b22=typeof _0x2e2079[_0x8af6('0x23')]===_0x8af6('0x24')&&typeof _0x2e2079[_0x8af6('0x25')]==='undefined';var _0x49b94a=_0x14b8c0[_0x8af6('0x26')];var _0x4d926f=_0x3b0b22?0x0:_0x2e2079[_0x8af6('0x23')];var _0x2207e4=_0x3b0b22?_0x14b8c0[_0x8af6('0x26')]:_0x2e2079[_0x8af6('0x23')]+_0x2e2079['limit'];var _0x4a391a;if(_0x2207e4>=_0x49b94a){_0x2207e4=_0x49b94a;_0x4a391a=0xc8;}else{_0x4a391a=0xce;}_0x51a93b[_0x8af6('0x21')](_0x4a391a);return _0x51a93b['set']('Content-Range',_0x4d926f+'-'+_0x2207e4+'/'+_0x49b94a)['json'](_0x14b8c0);}return null;};}function patchUpdates(_0x1bd4a5){return function(_0x1aca7a){try{jsonpatch[_0x8af6('0x27')](_0x1aca7a,_0x1bd4a5,!![]);}catch(_0xf2e7c0){return BPromise['reject'](_0xf2e7c0);}return _0x1aca7a[_0x8af6('0x28')]();};}function saveUpdates(_0xd35f74,_0x31f9f6){return function(_0x10a976){if(_0x10a976){return _0x10a976[_0x8af6('0x29')](_0xd35f74)[_0x8af6('0x2a')](function(_0x5986ee){return _0x5986ee;});}return null;};}function removeEntity(_0x36e578,_0x374f1a){return function(_0x5d44f6){if(_0x5d44f6){return _0x5d44f6[_0x8af6('0x2b')]()[_0x8af6('0x2a')](function(){var _0x5353a8=_0x5d44f6[_0x8af6('0x2c')]({'plain':!![]});var _0x1970af='FaxQueues';return db[_0x8af6('0x2d')][_0x8af6('0x2b')]({'where':{'type':_0x1970af,'resourceId':_0x5353a8['id']}})[_0x8af6('0x2a')](function(){return _0x5d44f6;});})[_0x8af6('0x2a')](function(){_0x36e578[_0x8af6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62e5ce,_0x547f97){return function(_0x2eebff){if(!_0x2eebff){_0x62e5ce[_0x8af6('0x2e')](0x194);}return _0x2eebff;};}function handleError(_0x29dd32,_0x4425a2){_0x4425a2=_0x4425a2||0x1f4;return function(_0x7e6fbc){logger['error'](_0x7e6fbc[_0x8af6('0x2f')]);if(_0x7e6fbc[_0x8af6('0x30')]){delete _0x7e6fbc[_0x8af6('0x30')];}_0x29dd32[_0x8af6('0x21')](_0x4425a2)[_0x8af6('0x31')](_0x7e6fbc);};}exports[_0x8af6('0x32')]=function(_0x1c645f,_0x108597){var _0x42bf30={},_0x1ca1a2={},_0x1a211e={'count':0x0,'rows':[]};var _0x4cc7a4=_['map'](db[_0x8af6('0x33')]['rawAttributes'],function(_0x829a5a){return{'name':_0x829a5a['fieldName'],'type':_0x829a5a['type'][_0x8af6('0x34')]};});_0x1ca1a2[_0x8af6('0x35')]=_[_0x8af6('0x36')](_0x4cc7a4,_0x8af6('0x30'));_0x1ca1a2[_0x8af6('0x37')]=_[_0x8af6('0x38')](_0x1c645f['query']);_0x1ca1a2[_0x8af6('0x39')]=_[_0x8af6('0x3a')](_0x1ca1a2[_0x8af6('0x35')],_0x1ca1a2[_0x8af6('0x37')]);_0x42bf30[_0x8af6('0x3b')]=_[_0x8af6('0x3a')](_0x1ca1a2['model'],qs['fields'](_0x1c645f[_0x8af6('0x37')][_0x8af6('0x3c')]));_0x42bf30[_0x8af6('0x3b')]=_0x42bf30[_0x8af6('0x3b')][_0x8af6('0x3d')]?_0x42bf30[_0x8af6('0x3b')]:_0x1ca1a2['model'];if(!_0x1c645f[_0x8af6('0x37')][_0x8af6('0x3e')](_0x8af6('0x3f'))){_0x42bf30['limit']=qs[_0x8af6('0x25')](_0x1c645f[_0x8af6('0x37')][_0x8af6('0x25')]);_0x42bf30[_0x8af6('0x23')]=qs[_0x8af6('0x23')](_0x1c645f[_0x8af6('0x37')][_0x8af6('0x23')]);}_0x42bf30[_0x8af6('0x40')]=qs[_0x8af6('0x41')](_0x1c645f[_0x8af6('0x37')][_0x8af6('0x41')]);_0x42bf30[_0x8af6('0x42')]=qs['filters'](_['pick'](_0x1c645f[_0x8af6('0x37')],_0x1ca1a2['filters']),_0x4cc7a4);if(_0x1c645f[_0x8af6('0x37')][_0x8af6('0x43')]){_0x42bf30[_0x8af6('0x42')]=_['merge'](_0x42bf30[_0x8af6('0x42')],{'$or':_['map'](_0x4cc7a4,function(_0xe14965){if(_0xe14965[_0x8af6('0x44')]!==_0x8af6('0x45')){var _0x1490ab={};_0x1490ab[_0xe14965[_0x8af6('0x30')]]={'$like':'%'+_0x1c645f[_0x8af6('0x37')][_0x8af6('0x43')]+'%'};return _0x1490ab;}})});}_0x42bf30=_[_0x8af6('0x46')]({},_0x42bf30,_0x1c645f[_0x8af6('0x47')]);var _0x5178ce={'where':_0x42bf30[_0x8af6('0x42')]};return db['FaxQueue'][_0x8af6('0x26')](_0x5178ce)['then'](function(_0x188d3e){_0x1a211e['count']=_0x188d3e;if(_0x1c645f['query']['includeAll']){_0x42bf30[_0x8af6('0x48')]=[{'all':!![]}];}return db[_0x8af6('0x33')][_0x8af6('0x49')](_0x42bf30);})[_0x8af6('0x2a')](function(_0x21a2eb){_0x1a211e[_0x8af6('0x4a')]=_0x21a2eb;return _0x1a211e;})['then'](respondWithFilteredResult(_0x108597,_0x42bf30))[_0x8af6('0x4b')](handleError(_0x108597,null));};exports[_0x8af6('0x4c')]=function(_0x5891e4,_0x2b8667){var _0x4fede5={'raw':!![],'where':{'id':_0x5891e4[_0x8af6('0x4d')]['id']}},_0x3fb910={};_0x3fb910[_0x8af6('0x35')]=_['keys'](db[_0x8af6('0x33')]['rawAttributes']);_0x3fb910[_0x8af6('0x37')]=_[_0x8af6('0x38')](_0x5891e4['query']);_0x3fb910['filters']=_[_0x8af6('0x3a')](_0x3fb910[_0x8af6('0x35')],_0x3fb910[_0x8af6('0x37')]);_0x4fede5[_0x8af6('0x3b')]=_['intersection'](_0x3fb910[_0x8af6('0x35')],qs[_0x8af6('0x3c')](_0x5891e4[_0x8af6('0x37')][_0x8af6('0x3c')]));_0x4fede5[_0x8af6('0x3b')]=_0x4fede5[_0x8af6('0x3b')]['length']?_0x4fede5[_0x8af6('0x3b')]:_0x3fb910[_0x8af6('0x35')];if(_0x5891e4[_0x8af6('0x37')][_0x8af6('0x4e')]){_0x4fede5[_0x8af6('0x48')]=[{'all':!![]}];}_0x4fede5=_[_0x8af6('0x46')]({},_0x4fede5,_0x5891e4['options']);return db[_0x8af6('0x33')][_0x8af6('0x4f')](_0x4fede5)[_0x8af6('0x2a')](handleEntityNotFound(_0x2b8667,null))[_0x8af6('0x2a')](respondWithResult(_0x2b8667,null))[_0x8af6('0x4b')](handleError(_0x2b8667,null));};exports['create']=function(_0x537ffd,_0x3cf56f){return db[_0x8af6('0x33')]['create'](_0x537ffd[_0x8af6('0x50')],{})[_0x8af6('0x2a')](function(_0x1d3773){var _0x21498d=_0x537ffd[_0x8af6('0x51')][_0x8af6('0x2c')]({'plain':!![]});if(!_0x21498d)throw new Error(_0x8af6('0x52'));if(_0x21498d[_0x8af6('0x53')]===_0x8af6('0x51')){var _0x5c3c4b=_0x1d3773[_0x8af6('0x2c')]({'plain':!![]});var _0x33e667=_0x8af6('0x54');return db[_0x8af6('0x55')][_0x8af6('0x4f')]({'where':{'name':_0x33e667,'userProfileId':_0x21498d[_0x8af6('0x56')]},'raw':!![]})['then'](function(_0x505d66){if(_0x505d66&&_0x505d66[_0x8af6('0x57')]===0x0){return db[_0x8af6('0x2d')]['create']({'name':_0x5c3c4b[_0x8af6('0x30')],'resourceId':_0x5c3c4b['id'],'type':_0x505d66['name'],'sectionId':_0x505d66['id']},{})[_0x8af6('0x2a')](function(){return _0x1d3773;});}else{return _0x1d3773;}})[_0x8af6('0x4b')](function(_0x5e689d){logger[_0x8af6('0x58')](_0x8af6('0x59'),_0x5e689d);throw _0x5e689d;});}return _0x1d3773;})[_0x8af6('0x2a')](respondWithResult(_0x3cf56f,0xc9))[_0x8af6('0x4b')](handleError(_0x3cf56f,null));};exports[_0x8af6('0x29')]=function(_0xabb05c,_0x1dbcbe){if(_0xabb05c[_0x8af6('0x50')]['id']){delete _0xabb05c[_0x8af6('0x50')]['id'];}return db[_0x8af6('0x33')][_0x8af6('0x4f')]({'where':{'id':_0xabb05c['params']['id']}})[_0x8af6('0x2a')](handleEntityNotFound(_0x1dbcbe,null))[_0x8af6('0x2a')](saveUpdates(_0xabb05c[_0x8af6('0x50')],null))[_0x8af6('0x2a')](respondWithResult(_0x1dbcbe,null))[_0x8af6('0x4b')](handleError(_0x1dbcbe,null));};exports[_0x8af6('0x2b')]=function(_0x593ca7,_0x5b88ba){return db[_0x8af6('0x33')]['find']({'where':{'id':_0x593ca7[_0x8af6('0x4d')]['id']}})[_0x8af6('0x2a')](handleEntityNotFound(_0x5b88ba,null))[_0x8af6('0x2a')](removeEntity(_0x5b88ba,null))['catch'](handleError(_0x5b88ba,null));};exports[_0x8af6('0x5a')]=function(_0x14a1d5,_0x21d7e4){return db['FaxQueue'][_0x8af6('0x5a')]()[_0x8af6('0x2a')](respondWithResult(_0x21d7e4,null))['catch'](handleError(_0x21d7e4,null));};exports[_0x8af6('0x5b')]=function(_0x399208,_0x443205,_0x3ea678){var _0x5be411={'raw':!![],'where':{}},_0x11d507={},_0x53d30c;return db[_0x8af6('0x33')][_0x8af6('0x5c')]({'where':{'id':_0x399208['params']['id']}})[_0x8af6('0x2a')](handleEntityNotFound(_0x443205,null))[_0x8af6('0x2a')](function(_0x4e04f5){if(_0x4e04f5){_0x53d30c=_0x4e04f5['get']({'plain':!![]});_0x11d507[_0x8af6('0x35')]=_[_0x8af6('0x38')](db['UserFaxQueue']['rawAttributes']);_0x11d507[_0x8af6('0x37')]=_[_0x8af6('0x38')](_0x399208['query']);_0x11d507['filters']=_[_0x8af6('0x3a')](_0x11d507[_0x8af6('0x35')],_0x11d507[_0x8af6('0x37')]);_0x5be411[_0x8af6('0x3b')]=_['intersection'](_0x11d507[_0x8af6('0x35')],qs[_0x8af6('0x3c')](_0x399208[_0x8af6('0x37')][_0x8af6('0x3c')]));_0x5be411['attributes']=_0x5be411[_0x8af6('0x3b')][_0x8af6('0x3d')]?_0x5be411['attributes']:_0x11d507[_0x8af6('0x35')];if(!_0x399208['query'][_0x8af6('0x3e')](_0x8af6('0x3f'))){_0x5be411[_0x8af6('0x25')]=qs[_0x8af6('0x25')](_0x399208[_0x8af6('0x37')][_0x8af6('0x25')]);_0x5be411[_0x8af6('0x23')]=qs[_0x8af6('0x23')](_0x399208['query'][_0x8af6('0x23')]);}_0x5be411['order']=qs[_0x8af6('0x41')](_0x399208[_0x8af6('0x37')][_0x8af6('0x41')]);_0x5be411[_0x8af6('0x42')]=qs[_0x8af6('0x39')](_[_0x8af6('0x5d')](_0x399208[_0x8af6('0x37')],_0x11d507[_0x8af6('0x39')]));_0x5be411[_0x8af6('0x42')]['FaxQueueId']=_0x4e04f5['id'];if(_0x399208['query'][_0x8af6('0x43')]){_0x5be411[_0x8af6('0x42')]=_[_0x8af6('0x46')](_0x5be411[_0x8af6('0x42')],{'$or':_['map'](_0x5be411[_0x8af6('0x3b')],function(_0x2fc2cd){var _0x11962e={};_0x11962e[_0x2fc2cd]={'$like':'%'+_0x399208[_0x8af6('0x37')]['filter']+'%'};return _0x11962e;})});}_0x5be411=_[_0x8af6('0x46')]({},_0x5be411,_0x399208[_0x8af6('0x47')]);return db['UserFaxQueue'][_0x8af6('0x49')](_0x5be411);}})[_0x8af6('0x2a')](function(_0x1ddb0b){if(_0x1ddb0b){return db['User'][_0x8af6('0x5e')]({'where':{'id':_[_0x8af6('0x36')](_0x1ddb0b,_0x8af6('0x5f')),'role':_0x8af6('0x60')},'attributes':['id',_0x8af6('0x30'),'faxPause',_0x8af6('0x61'),_0x8af6('0x62')]});}})[_0x8af6('0x2a')](function(_0x5e6ca3){if(_0x5e6ca3){return{'count':_0x5e6ca3[_0x8af6('0x26')],'rows':_[_0x8af6('0x36')](_0x5e6ca3[_0x8af6('0x4a')],function(_0xdeaaa4){return{'membername':_0xdeaaa4[_0x8af6('0x30')],'UserId':_0xdeaaa4['id'],'queue_name':_0x53d30c[_0x8af6('0x30')],'FaxQueueId':_0x53d30c['id'],'interface':util[_0x8af6('0x63')](_0x8af6('0x64'),_0x8af6('0x65'),_0xdeaaa4[_0x8af6('0x30')]),'penalty':0x0,'paused':_0xdeaaa4['faxPause'],'createdAt':_0xdeaaa4[_0x8af6('0x62')],'updatedAt':_0xdeaaa4[_0x8af6('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8af6('0x2a')](respondWithFilteredResult(_0x443205,_0x5be411))[_0x8af6('0x4b')](handleError(_0x443205,null));};exports[_0x8af6('0x66')]=function(_0x204caf,_0x547a11,_0x16fb4e){var _0x307eb4={};var _0xaaed50={};var _0x187441;var _0x3a0802;return db[_0x8af6('0x33')][_0x8af6('0x5c')]({'where':{'id':_0x204caf[_0x8af6('0x4d')]['id']}})[_0x8af6('0x2a')](handleEntityNotFound(_0x547a11,null))[_0x8af6('0x2a')](function(_0x5ec87f){if(_0x5ec87f){_0x187441=_0x5ec87f;_0xaaed50[_0x8af6('0x35')]=_[_0x8af6('0x38')](db[_0x8af6('0x67')][_0x8af6('0x68')]);_0xaaed50[_0x8af6('0x37')]=_[_0x8af6('0x38')](_0x204caf[_0x8af6('0x37')]);_0xaaed50['filters']=_[_0x8af6('0x3a')](_0xaaed50['model'],_0xaaed50[_0x8af6('0x37')]);_0x307eb4[_0x8af6('0x3b')]=_['intersection'](_0xaaed50[_0x8af6('0x35')],qs[_0x8af6('0x3c')](_0x204caf[_0x8af6('0x37')][_0x8af6('0x3c')]));_0x307eb4[_0x8af6('0x3b')]=_0x307eb4[_0x8af6('0x3b')][_0x8af6('0x3d')]?_0x307eb4[_0x8af6('0x3b')]:_0xaaed50['model'];_0x307eb4[_0x8af6('0x40')]=qs['sort'](_0x204caf[_0x8af6('0x37')][_0x8af6('0x41')]);_0x307eb4[_0x8af6('0x42')]=qs[_0x8af6('0x39')](_[_0x8af6('0x5d')](_0x204caf[_0x8af6('0x37')],_0xaaed50[_0x8af6('0x39')]));if(_0x204caf[_0x8af6('0x37')][_0x8af6('0x43')]){_0x307eb4[_0x8af6('0x42')]=_[_0x8af6('0x46')](_0x307eb4['where'],{'$or':_['map'](_0x307eb4[_0x8af6('0x3b')],function(_0x25bbe6){var _0x59dead={};_0x59dead[_0x25bbe6]={'$like':'%'+_0x204caf[_0x8af6('0x37')][_0x8af6('0x43')]+'%'};return _0x59dead;})});}_0x307eb4=_[_0x8af6('0x46')]({},_0x307eb4,_0x204caf[_0x8af6('0x47')]);return _0x187441[_0x8af6('0x66')](_0x307eb4);}})['then'](function(_0x136751){if(_0x136751){_0x3a0802=_0x136751['length'];if(!_0x204caf['query']['hasOwnProperty'](_0x8af6('0x3f'))){_0x307eb4[_0x8af6('0x25')]=qs[_0x8af6('0x25')](_0x204caf[_0x8af6('0x37')][_0x8af6('0x25')]);_0x307eb4[_0x8af6('0x23')]=qs['offset'](_0x204caf[_0x8af6('0x37')][_0x8af6('0x23')]);}return _0x187441['getTeams'](_0x307eb4);}})[_0x8af6('0x2a')](function(_0x24d6e3){if(_0x24d6e3){return _0x24d6e3?{'count':_0x3a0802,'rows':_0x24d6e3}:null;}})[_0x8af6('0x2a')](respondWithResult(_0x547a11,null))[_0x8af6('0x4b')](handleError(_0x547a11,null));};exports[_0x8af6('0x69')]=function(_0x3aead8,_0x53d3c8,_0x28acdd){var _0x3cf752=_0x3aead8['body'][_0x8af6('0x6a')];return db[_0x8af6('0x67')][_0x8af6('0x49')]({'where':{'id':_0x3cf752},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8af6('0x6b'),'attributes':['id',_0x8af6('0x30'),_0x8af6('0x6c'),_0x8af6('0x6d'),_0x8af6('0x6e')],'raw':!![]}]})[_0x8af6('0x2a')](function(_0x3c998d){if(_0x3c998d){var _0x114fde=_[_0x8af6('0x6f')](_0x3c998d,function(_0x3c4515){var _0x4e8d78=_0x3c4515[_0x8af6('0x2c')]({'plain':!![]});return _0x4e8d78[_0x8af6('0x6b')];});return db[_0x8af6('0x33')][_0x8af6('0x4f')]({'where':{'id':_0x3aead8[_0x8af6('0x4d')]['id']}})[_0x8af6('0x2a')](function(_0x5c6e4e){return db[_0x8af6('0x70')][_0x8af6('0x71')](function(_0x4c4653){return _0x5c6e4e[_0x8af6('0x69')](_0x3cf752,{'transaction':_0x4c4653})[_0x8af6('0x2a')](function(){return BPromise['each'](_0x114fde,function(_0x595b7d){return db[_0x8af6('0x72')][_0x8af6('0x73')]({'where':{'UserId':_0x595b7d['id'],'FaxQueueId':_0x3aead8[_0x8af6('0x4d')]['id']},'transaction':_0x4c4653});});})[_0x8af6('0x2a')](function(){_0x114fde[_0x8af6('0x74')](function(_0x25633b){socket['emit'](_0x8af6('0x75'),{'UserId':_0x25633b['id'],'FaxQueueId':_0x5c6e4e['id']});});});});});}})[_0x8af6('0x2a')](respondWithStatusCode(_0x53d3c8,null))['catch'](handleError(_0x53d3c8,null));};exports['removeTeams']=function(_0x2c0bce,_0x2f69e3,_0x5eda8f){return db[_0x8af6('0x67')][_0x8af6('0x49')]({'where':{'id':_0x2c0bce[_0x8af6('0x37')][_0x8af6('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x8af6('0x76')],'as':_0x8af6('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x8af6('0x2a')](handleEntityNotFound(_0x2f69e3,null))[_0x8af6('0x2a')](function(_0x25baf3){var _0x4254c3=_[_0x8af6('0x36')](_0x25baf3,'id');var _0x3be0a5=[];var _0x261283=[];var _0x3f9d1b=squel[_0x8af6('0x77')]();_0x3f9d1b['field'](_0x8af6('0x78'))[_0x8af6('0x79')](_0x8af6('0x7a'),'tq')['join'](_0x8af6('0x7b'),'ut',_0x8af6('0x7c'))[_0x8af6('0x42')](_0x8af6('0x7d'),_0x2c0bce[_0x8af6('0x4d')]['id']);for(var _0x24c8e6=0x0;_0x24c8e6<_0x25baf3[_0x8af6('0x3d')];_0x24c8e6+=0x1){let _0x2ef548=_0x25baf3[_0x24c8e6];for(var _0x4eac6e=0x0;_0x4eac6e<_0x2ef548[_0x8af6('0x6b')][_0x8af6('0x3d')];_0x4eac6e+=0x1){let _0x489497=_0x2ef548[_0x8af6('0x6b')][_0x4eac6e];var _0x27b981=_0x3f9d1b[_0x8af6('0x7e')]();_0x27b981[_0x8af6('0x42')](_0x8af6('0x7f'),_0x489497['id']);_0x261283[_0x8af6('0x80')](db[_0x8af6('0x70')]['query'](_0x27b981['toString'](),{'type':db['sequelize'][_0x8af6('0x81')][_0x8af6('0x82')]})['then'](function(_0x4ed108){if(_0x4ed108[_0x8af6('0x3d')]===0x1){return _0x489497['id'];}else{var _0x6bd4fb=_[_0x8af6('0x83')](_[_0x8af6('0x36')](_0x4ed108,_0x8af6('0x84')),function(_0x330ef8){return _[_0x8af6('0x85')](_0x4254c3,_0x330ef8);});if(_0x6bd4fb){return _0x489497['id'];}}}));}}return BPromise[_0x8af6('0x86')](_0x261283)[_0x8af6('0x2a')](function(_0x3e17bc){_0x3be0a5=_(_0x3be0a5)[_0x8af6('0x87')](_0x3e17bc)[_0x8af6('0x88')]()['value']();return db[_0x8af6('0x33')][_0x8af6('0x4f')]({'where':{'id':_0x2c0bce[_0x8af6('0x4d')]['id']}})[_0x8af6('0x2a')](function(_0x59dfa6){return db[_0x8af6('0x70')][_0x8af6('0x71')](function(_0x2b434d){return _0x59dfa6[_0x8af6('0x89')](_0x2c0bce[_0x8af6('0x37')]['ids'],{'transaction':_0x2b434d})[_0x8af6('0x2a')](function(){if(!_[_0x8af6('0x8a')](_0x3be0a5)){return _0x59dfa6['removeAgents'](_0x3be0a5,{'transaction':_0x2b434d});}})[_0x8af6('0x2a')](function(){_0x3be0a5['forEach'](function(_0x187c6c){socket[_0x8af6('0x8b')](_0x8af6('0x8c'),{'UserId':_0x187c6c,'FaxQueueId':_0x59dfa6['id']});});});});});});})[_0x8af6('0x2a')](respondWithStatusCode(_0x2f69e3,null))[_0x8af6('0x4b')](handleError(_0x2f69e3,null));};exports[_0x8af6('0x8d')]=function(_0x177223,_0x5113c6,_0x341cfd){return db[_0x8af6('0x33')]['find']({'where':{'id':_0x177223[_0x8af6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5113c6,null))['then'](function(_0x3411e9){if(_0x3411e9){return _0x3411e9['addAgents'](_0x177223[_0x8af6('0x50')][_0x8af6('0x6a')],_[_0x8af6('0x8e')](_0x177223[_0x8af6('0x50')],[_0x8af6('0x6a'),'id'])||{})[_0x8af6('0x8f')](function(_0x521bfe){for(var _0x2403da=0x0;_0x2403da<_0x177223[_0x8af6('0x50')][_0x8af6('0x6a')][_0x8af6('0x3d')];_0x2403da+=0x1){socket[_0x8af6('0x8b')](_0x8af6('0x75'),{'UserId':Number(_0x177223['body'][_0x8af6('0x6a')][_0x2403da]),'FaxQueueId':Number(_0x177223['params']['id'])});}return _0x521bfe;});}})[_0x8af6('0x2a')](respondWithResult(_0x5113c6,null))[_0x8af6('0x4b')](handleError(_0x5113c6,null));};exports[_0x8af6('0x90')]=function(_0x180289,_0x2a0ca9,_0x29162b){return db[_0x8af6('0x33')][_0x8af6('0x4f')]({'where':{'id':_0x180289[_0x8af6('0x4d')]['id']}})[_0x8af6('0x2a')](handleEntityNotFound(_0x2a0ca9,null))['then'](function(_0x2a48b8){if(_0x2a48b8){return _0x2a48b8[_0x8af6('0x90')](_0x180289['query'][_0x8af6('0x6a')])[_0x8af6('0x2a')](function(){if(_[_0x8af6('0x91')](_0x180289['query'][_0x8af6('0x6a')])){for(var _0x5d413c=0x0;_0x5d413c<_0x180289[_0x8af6('0x37')][_0x8af6('0x6a')]['length'];_0x5d413c+=0x1){socket['emit'](_0x8af6('0x8c'),{'UserId':Number(_0x180289[_0x8af6('0x37')][_0x8af6('0x6a')][_0x5d413c]),'FaxQueueId':Number(_0x180289[_0x8af6('0x4d')]['id'])});}}else{socket[_0x8af6('0x8b')](_0x8af6('0x8c'),{'UserId':Number(_0x180289[_0x8af6('0x37')]['ids']),'FaxQueueId':Number(_0x180289['params']['id'])});}});}})[_0x8af6('0x2a')](respondWithStatusCode(_0x2a0ca9,null))[_0x8af6('0x4b')](handleError(_0x2a0ca9,null));};exports[_0x8af6('0x92')]=function(_0xe8de20,_0x13a804,_0x570ee6){var _0x9a9f9c={};var _0x281121={};var _0x4e3613;var _0x4f0698;return db['FaxQueue'][_0x8af6('0x5c')]({'where':{'id':_0xe8de20[_0x8af6('0x4d')]['id']}})[_0x8af6('0x2a')](handleEntityNotFound(_0x13a804,null))['then'](function(_0x303d5e){if(_0x303d5e){_0x4e3613=_0x303d5e;_0x281121[_0x8af6('0x35')]=_[_0x8af6('0x38')](db[_0x8af6('0x76')][_0x8af6('0x68')]);_0x281121[_0x8af6('0x37')]=_[_0x8af6('0x38')](_0xe8de20[_0x8af6('0x37')]);_0x281121[_0x8af6('0x39')]=_[_0x8af6('0x3a')](_0x281121[_0x8af6('0x35')],_0x281121['query']);_0x9a9f9c[_0x8af6('0x3b')]=_[_0x8af6('0x3a')](_0x281121[_0x8af6('0x35')],qs[_0x8af6('0x3c')](_0xe8de20[_0x8af6('0x37')][_0x8af6('0x3c')]));_0x9a9f9c[_0x8af6('0x3b')]=_0x9a9f9c[_0x8af6('0x3b')][_0x8af6('0x3d')]?_0x9a9f9c[_0x8af6('0x3b')]:_0x281121['model'];_0x9a9f9c['order']=qs[_0x8af6('0x41')](_0xe8de20['query']['sort']);_0x9a9f9c[_0x8af6('0x42')]=qs[_0x8af6('0x39')](_[_0x8af6('0x5d')](_0xe8de20[_0x8af6('0x37')],_0x281121[_0x8af6('0x39')]));if(_0xe8de20[_0x8af6('0x37')][_0x8af6('0x43')]){_0x9a9f9c[_0x8af6('0x42')]=_[_0x8af6('0x46')](_0x9a9f9c[_0x8af6('0x42')],{'$or':_[_0x8af6('0x36')](_0x9a9f9c[_0x8af6('0x3b')],function(_0xe4c627){var _0x4934f8={};_0x4934f8[_0xe4c627]={'$like':'%'+_0xe8de20['query'][_0x8af6('0x43')]+'%'};return _0x4934f8;})});}_0x9a9f9c=_[_0x8af6('0x46')]({},_0x9a9f9c,_0xe8de20[_0x8af6('0x47')]);return _0x4e3613[_0x8af6('0x92')](_0x9a9f9c);}})[_0x8af6('0x2a')](function(_0x44c44e){if(_0x44c44e){_0x4f0698=_0x44c44e[_0x8af6('0x3d')];if(!_0xe8de20[_0x8af6('0x37')]['hasOwnProperty']('nolimit')){_0x9a9f9c[_0x8af6('0x25')]=qs[_0x8af6('0x25')](_0xe8de20['query'][_0x8af6('0x25')]);_0x9a9f9c[_0x8af6('0x23')]=qs[_0x8af6('0x23')](_0xe8de20[_0x8af6('0x37')][_0x8af6('0x23')]);}return _0x4e3613[_0x8af6('0x92')](_0x9a9f9c);}})[_0x8af6('0x2a')](function(_0x42c1f9){if(_0x42c1f9){return _0x42c1f9?{'count':_0x4f0698,'rows':_0x42c1f9}:null;}})['then'](respondWithResult(_0x13a804,null))[_0x8af6('0x4b')](handleError(_0x13a804,null));}; \ No newline at end of file +var _0x93de=['updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','findOne','Team','addTeams','findAll','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','userFaxQueue:save','getAgents','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','FaxQueue','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','body','describe','UserFaxQueue','FaxQueueId','User','UserId'];(function(_0x178f72,_0x18da4f){var _0x267367=function(_0x532b2f){while(--_0x532b2f){_0x178f72['push'](_0x178f72['shift']());}};_0x267367(++_0x18da4f);}(_0x93de,0xc0));var _0xe93d=function(_0x27e443,_0x1bcf60){_0x27e443=_0x27e443-0x0;var _0x3305fc=_0x93de[_0x27e443];return _0x3305fc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe93d('0x0'));var jsonpatch=require(_0xe93d('0x1'));var rp=require(_0xe93d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe93d('0x3'));var util=require(_0xe93d('0x4'));var path=require(_0xe93d('0x5'));var sox=require(_0xe93d('0x6'));var csv=require(_0xe93d('0x7'));var ejs=require(_0xe93d('0x8'));var fs=require('fs');var fs_extra=require(_0xe93d('0x9'));var _=require(_0xe93d('0xa'));var squel=require(_0xe93d('0xb'));var crypto=require(_0xe93d('0xc'));var jsforce=require(_0xe93d('0xd'));var deskjs=require(_0xe93d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe93d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe93d('0x10'));var as=require(_0xe93d('0x11'));var hardwareService=require(_0xe93d('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe93d('0x13'));var config=require(_0xe93d('0x14'));var licenseUtil=require(_0xe93d('0x15'));var db=require(_0xe93d('0x16'))['db'];config[_0xe93d('0x17')]=_[_0xe93d('0x18')](config[_0xe93d('0x17')],{'host':_0xe93d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe93d('0x17')]));require(_0xe93d('0x1a'))[_0xe93d('0x1b')](socket);function respondWithStatusCode(_0x4f82d4,_0xf79da7){_0xf79da7=_0xf79da7||0xcc;return function(_0x2081fc){if(_0x2081fc){return _0x4f82d4['sendStatus'](_0xf79da7);}return _0x4f82d4[_0xe93d('0x1c')](_0xf79da7)['end']();};}function respondWithResult(_0x16719b,_0x3cb2d7){_0x3cb2d7=_0x3cb2d7||0xc8;return function(_0x20e896){if(_0x20e896){return _0x16719b[_0xe93d('0x1c')](_0x3cb2d7)[_0xe93d('0x1d')](_0x20e896);}};}function respondWithFilteredResult(_0x174411,_0x14aa5e){return function(_0x478902){if(_0x478902){var _0x4d6989=typeof _0x14aa5e[_0xe93d('0x1e')]==='undefined'&&typeof _0x14aa5e['limit']===_0xe93d('0x1f');var _0x114b0b=_0x478902[_0xe93d('0x20')];var _0x1c749f=_0x4d6989?0x0:_0x14aa5e[_0xe93d('0x1e')];var _0x669cc2=_0x4d6989?_0x478902['count']:_0x14aa5e[_0xe93d('0x1e')]+_0x14aa5e[_0xe93d('0x21')];var _0x23384d;if(_0x669cc2>=_0x114b0b){_0x669cc2=_0x114b0b;_0x23384d=0xc8;}else{_0x23384d=0xce;}_0x174411['status'](_0x23384d);return _0x174411['set'](_0xe93d('0x22'),_0x1c749f+'-'+_0x669cc2+'/'+_0x114b0b)['json'](_0x478902);}return null;};}function patchUpdates(_0xb88f85){return function(_0x435f40){try{jsonpatch['apply'](_0x435f40,_0xb88f85,!![]);}catch(_0x367c79){return BPromise[_0xe93d('0x23')](_0x367c79);}return _0x435f40[_0xe93d('0x24')]();};}function saveUpdates(_0x3517ee,_0x3dd728){return function(_0x5d048f){if(_0x5d048f){return _0x5d048f[_0xe93d('0x25')](_0x3517ee)[_0xe93d('0x26')](function(_0xb5885){return _0xb5885;});}return null;};}function removeEntity(_0x49bae5,_0x987d5){return function(_0x47d776){if(_0x47d776){return _0x47d776[_0xe93d('0x27')]()[_0xe93d('0x26')](function(){var _0x14e4c9=_0x47d776[_0xe93d('0x28')]({'plain':!![]});var _0x2b45c8='FaxQueues';return db[_0xe93d('0x29')]['destroy']({'where':{'type':_0x2b45c8,'resourceId':_0x14e4c9['id']}})['then'](function(){return _0x47d776;});})[_0xe93d('0x26')](function(){_0x49bae5['status'](0xcc)[_0xe93d('0x2a')]();});}};}function handleEntityNotFound(_0x15efa5,_0x4b0e54){return function(_0x5de3dd){if(!_0x5de3dd){_0x15efa5['sendStatus'](0x194);}return _0x5de3dd;};}function handleError(_0xaaf9bd,_0x593bf0){_0x593bf0=_0x593bf0||0x1f4;return function(_0x5d4cf9){logger[_0xe93d('0x2b')](_0x5d4cf9[_0xe93d('0x2c')]);if(_0x5d4cf9[_0xe93d('0x2d')]){delete _0x5d4cf9[_0xe93d('0x2d')];}_0xaaf9bd[_0xe93d('0x1c')](_0x593bf0)[_0xe93d('0x2e')](_0x5d4cf9);};}exports[_0xe93d('0x2f')]=function(_0x5d0000,_0x3ac3b3){var _0x28b59a={},_0x3dd437={},_0x3c0ffa={'count':0x0,'rows':[]};var _0x5fe54c=_[_0xe93d('0x30')](db[_0xe93d('0x31')][_0xe93d('0x32')],function(_0x272fbb){return{'name':_0x272fbb['fieldName'],'type':_0x272fbb[_0xe93d('0x33')][_0xe93d('0x34')]};});_0x3dd437[_0xe93d('0x35')]=_['map'](_0x5fe54c,_0xe93d('0x2d'));_0x3dd437[_0xe93d('0x36')]=_[_0xe93d('0x37')](_0x5d0000[_0xe93d('0x36')]);_0x3dd437[_0xe93d('0x38')]=_[_0xe93d('0x39')](_0x3dd437['model'],_0x3dd437['query']);_0x28b59a['attributes']=_[_0xe93d('0x39')](_0x3dd437['model'],qs[_0xe93d('0x3a')](_0x5d0000[_0xe93d('0x36')][_0xe93d('0x3a')]));_0x28b59a[_0xe93d('0x3b')]=_0x28b59a[_0xe93d('0x3b')][_0xe93d('0x3c')]?_0x28b59a[_0xe93d('0x3b')]:_0x3dd437[_0xe93d('0x35')];if(!_0x5d0000[_0xe93d('0x36')][_0xe93d('0x3d')](_0xe93d('0x3e'))){_0x28b59a[_0xe93d('0x21')]=qs[_0xe93d('0x21')](_0x5d0000[_0xe93d('0x36')][_0xe93d('0x21')]);_0x28b59a[_0xe93d('0x1e')]=qs[_0xe93d('0x1e')](_0x5d0000[_0xe93d('0x36')][_0xe93d('0x1e')]);}_0x28b59a[_0xe93d('0x3f')]=qs[_0xe93d('0x40')](_0x5d0000[_0xe93d('0x36')]['sort']);_0x28b59a[_0xe93d('0x41')]=qs[_0xe93d('0x38')](_[_0xe93d('0x42')](_0x5d0000[_0xe93d('0x36')],_0x3dd437[_0xe93d('0x38')]),_0x5fe54c);if(_0x5d0000['query'][_0xe93d('0x43')]){_0x28b59a[_0xe93d('0x41')]=_[_0xe93d('0x44')](_0x28b59a[_0xe93d('0x41')],{'$or':_['map'](_0x5fe54c,function(_0x50455c){if(_0x50455c['type']!=='VIRTUAL'){var _0x2f6e89={};_0x2f6e89[_0x50455c[_0xe93d('0x2d')]]={'$like':'%'+_0x5d0000['query'][_0xe93d('0x43')]+'%'};return _0x2f6e89;}})});}_0x28b59a=_['merge']({},_0x28b59a,_0x5d0000['options']);var _0x52e717={'where':_0x28b59a[_0xe93d('0x41')]};return db[_0xe93d('0x31')][_0xe93d('0x20')](_0x52e717)[_0xe93d('0x26')](function(_0x14e5ac){_0x3c0ffa[_0xe93d('0x20')]=_0x14e5ac;if(_0x5d0000[_0xe93d('0x36')][_0xe93d('0x45')]){_0x28b59a[_0xe93d('0x46')]=[{'all':!![]}];}return db[_0xe93d('0x31')]['findAll'](_0x28b59a);})[_0xe93d('0x26')](function(_0xc58133){_0x3c0ffa[_0xe93d('0x47')]=_0xc58133;return _0x3c0ffa;})[_0xe93d('0x26')](respondWithFilteredResult(_0x3ac3b3,_0x28b59a))[_0xe93d('0x48')](handleError(_0x3ac3b3,null));};exports[_0xe93d('0x49')]=function(_0x9fb93c,_0x61bfe2){var _0x37811e={'raw':!![],'where':{'id':_0x9fb93c[_0xe93d('0x4a')]['id']}},_0x261b13={};_0x261b13[_0xe93d('0x35')]=_[_0xe93d('0x37')](db[_0xe93d('0x31')]['rawAttributes']);_0x261b13[_0xe93d('0x36')]=_[_0xe93d('0x37')](_0x9fb93c[_0xe93d('0x36')]);_0x261b13['filters']=_['intersection'](_0x261b13[_0xe93d('0x35')],_0x261b13[_0xe93d('0x36')]);_0x37811e[_0xe93d('0x3b')]=_['intersection'](_0x261b13['model'],qs[_0xe93d('0x3a')](_0x9fb93c[_0xe93d('0x36')][_0xe93d('0x3a')]));_0x37811e[_0xe93d('0x3b')]=_0x37811e[_0xe93d('0x3b')][_0xe93d('0x3c')]?_0x37811e[_0xe93d('0x3b')]:_0x261b13[_0xe93d('0x35')];if(_0x9fb93c[_0xe93d('0x36')]['includeAll']){_0x37811e['include']=[{'all':!![]}];}_0x37811e=_['merge']({},_0x37811e,_0x9fb93c[_0xe93d('0x4b')]);return db['FaxQueue'][_0xe93d('0x4c')](_0x37811e)['then'](handleEntityNotFound(_0x61bfe2,null))[_0xe93d('0x26')](respondWithResult(_0x61bfe2,null))[_0xe93d('0x48')](handleError(_0x61bfe2,null));};exports[_0xe93d('0x4d')]=function(_0x44a3ae,_0x18f65a){return db[_0xe93d('0x31')][_0xe93d('0x4d')](_0x44a3ae['body'],{})[_0xe93d('0x26')](function(_0x4b6371){var _0x52a806=_0x44a3ae[_0xe93d('0x4e')][_0xe93d('0x28')]({'plain':!![]});if(!_0x52a806)throw new Error(_0xe93d('0x4f'));if(_0x52a806[_0xe93d('0x50')]===_0xe93d('0x4e')){var _0x3c0098=_0x4b6371[_0xe93d('0x28')]({'plain':!![]});var _0x22c226=_0xe93d('0x51');return db[_0xe93d('0x52')]['find']({'where':{'name':_0x22c226,'userProfileId':_0x52a806[_0xe93d('0x53')]},'raw':!![]})['then'](function(_0x296e25){if(_0x296e25&&_0x296e25['autoAssociation']===0x0){return db[_0xe93d('0x29')][_0xe93d('0x4d')]({'name':_0x3c0098[_0xe93d('0x2d')],'resourceId':_0x3c0098['id'],'type':_0x296e25['name'],'sectionId':_0x296e25['id']},{})[_0xe93d('0x26')](function(){return _0x4b6371;});}else{return _0x4b6371;}})[_0xe93d('0x48')](function(_0x2b82d9){logger[_0xe93d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b82d9);throw _0x2b82d9;});}return _0x4b6371;})[_0xe93d('0x26')](respondWithResult(_0x18f65a,0xc9))[_0xe93d('0x48')](handleError(_0x18f65a,null));};exports['update']=function(_0x49a66e,_0x44a276){if(_0x49a66e['body']['id']){delete _0x49a66e[_0xe93d('0x54')]['id'];}return db[_0xe93d('0x31')][_0xe93d('0x4c')]({'where':{'id':_0x49a66e[_0xe93d('0x4a')]['id']}})[_0xe93d('0x26')](handleEntityNotFound(_0x44a276,null))[_0xe93d('0x26')](saveUpdates(_0x49a66e[_0xe93d('0x54')],null))['then'](respondWithResult(_0x44a276,null))[_0xe93d('0x48')](handleError(_0x44a276,null));};exports[_0xe93d('0x27')]=function(_0x2ee769,_0x59ea54){return db['FaxQueue'][_0xe93d('0x4c')]({'where':{'id':_0x2ee769['params']['id']}})[_0xe93d('0x26')](handleEntityNotFound(_0x59ea54,null))[_0xe93d('0x26')](removeEntity(_0x59ea54,null))[_0xe93d('0x48')](handleError(_0x59ea54,null));};exports[_0xe93d('0x55')]=function(_0x31c24a,_0x65b91a){return db[_0xe93d('0x31')][_0xe93d('0x55')]()[_0xe93d('0x26')](respondWithResult(_0x65b91a,null))[_0xe93d('0x48')](handleError(_0x65b91a,null));};exports['getMembers']=function(_0x12b41f,_0x14c537,_0xdf95a6){var _0xd2ac17={'raw':!![],'where':{}},_0x2dbb36={},_0x49b5e;return db[_0xe93d('0x31')]['findOne']({'where':{'id':_0x12b41f[_0xe93d('0x4a')]['id']}})[_0xe93d('0x26')](handleEntityNotFound(_0x14c537,null))[_0xe93d('0x26')](function(_0x41fcc4){if(_0x41fcc4){_0x49b5e=_0x41fcc4[_0xe93d('0x28')]({'plain':!![]});_0x2dbb36[_0xe93d('0x35')]=_[_0xe93d('0x37')](db[_0xe93d('0x56')][_0xe93d('0x32')]);_0x2dbb36['query']=_[_0xe93d('0x37')](_0x12b41f['query']);_0x2dbb36[_0xe93d('0x38')]=_[_0xe93d('0x39')](_0x2dbb36[_0xe93d('0x35')],_0x2dbb36['query']);_0xd2ac17[_0xe93d('0x3b')]=_[_0xe93d('0x39')](_0x2dbb36[_0xe93d('0x35')],qs[_0xe93d('0x3a')](_0x12b41f[_0xe93d('0x36')][_0xe93d('0x3a')]));_0xd2ac17[_0xe93d('0x3b')]=_0xd2ac17['attributes'][_0xe93d('0x3c')]?_0xd2ac17[_0xe93d('0x3b')]:_0x2dbb36[_0xe93d('0x35')];if(!_0x12b41f[_0xe93d('0x36')][_0xe93d('0x3d')](_0xe93d('0x3e'))){_0xd2ac17[_0xe93d('0x21')]=qs[_0xe93d('0x21')](_0x12b41f['query']['limit']);_0xd2ac17['offset']=qs[_0xe93d('0x1e')](_0x12b41f['query'][_0xe93d('0x1e')]);}_0xd2ac17[_0xe93d('0x3f')]=qs[_0xe93d('0x40')](_0x12b41f[_0xe93d('0x36')]['sort']);_0xd2ac17[_0xe93d('0x41')]=qs[_0xe93d('0x38')](_['pick'](_0x12b41f[_0xe93d('0x36')],_0x2dbb36[_0xe93d('0x38')]));_0xd2ac17[_0xe93d('0x41')][_0xe93d('0x57')]=_0x41fcc4['id'];if(_0x12b41f[_0xe93d('0x36')][_0xe93d('0x43')]){_0xd2ac17[_0xe93d('0x41')]=_['merge'](_0xd2ac17[_0xe93d('0x41')],{'$or':_[_0xe93d('0x30')](_0xd2ac17['attributes'],function(_0x509331){var _0xc00c1b={};_0xc00c1b[_0x509331]={'$like':'%'+_0x12b41f[_0xe93d('0x36')][_0xe93d('0x43')]+'%'};return _0xc00c1b;})});}_0xd2ac17=_[_0xe93d('0x44')]({},_0xd2ac17,_0x12b41f[_0xe93d('0x4b')]);return db[_0xe93d('0x56')]['findAll'](_0xd2ac17);}})[_0xe93d('0x26')](function(_0x2cbb9c){if(_0x2cbb9c){return db[_0xe93d('0x58')]['findAndCountAll']({'where':{'id':_[_0xe93d('0x30')](_0x2cbb9c,_0xe93d('0x59')),'role':'agent'},'attributes':['id',_0xe93d('0x2d'),'faxPause',_0xe93d('0x5a'),_0xe93d('0x5b')]});}})[_0xe93d('0x26')](function(_0xee216c){if(_0xee216c){return{'count':_0xee216c['count'],'rows':_['map'](_0xee216c[_0xe93d('0x47')],function(_0x20aeff){return{'membername':_0x20aeff['name'],'UserId':_0x20aeff['id'],'queue_name':_0x49b5e[_0xe93d('0x2d')],'FaxQueueId':_0x49b5e['id'],'interface':util[_0xe93d('0x5c')](_0xe93d('0x5d'),_0xe93d('0x5e'),_0x20aeff[_0xe93d('0x2d')]),'penalty':0x0,'paused':_0x20aeff[_0xe93d('0x5f')],'createdAt':_0x20aeff['createdAt'],'updatedAt':_0x20aeff[_0xe93d('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe93d('0x26')](respondWithFilteredResult(_0x14c537,_0xd2ac17))['catch'](handleError(_0x14c537,null));};exports[_0xe93d('0x60')]=function(_0x2c0ef8,_0x2eecea,_0x48c2ff){var _0x3bf6db={};var _0x2a0aef={};var _0x2f4900;var _0x10597f;return db[_0xe93d('0x31')][_0xe93d('0x61')]({'where':{'id':_0x2c0ef8['params']['id']}})['then'](handleEntityNotFound(_0x2eecea,null))[_0xe93d('0x26')](function(_0x372e50){if(_0x372e50){_0x2f4900=_0x372e50;_0x2a0aef[_0xe93d('0x35')]=_[_0xe93d('0x37')](db[_0xe93d('0x62')]['rawAttributes']);_0x2a0aef[_0xe93d('0x36')]=_[_0xe93d('0x37')](_0x2c0ef8['query']);_0x2a0aef['filters']=_[_0xe93d('0x39')](_0x2a0aef[_0xe93d('0x35')],_0x2a0aef[_0xe93d('0x36')]);_0x3bf6db['attributes']=_['intersection'](_0x2a0aef[_0xe93d('0x35')],qs['fields'](_0x2c0ef8['query'][_0xe93d('0x3a')]));_0x3bf6db[_0xe93d('0x3b')]=_0x3bf6db['attributes'][_0xe93d('0x3c')]?_0x3bf6db[_0xe93d('0x3b')]:_0x2a0aef[_0xe93d('0x35')];_0x3bf6db[_0xe93d('0x3f')]=qs[_0xe93d('0x40')](_0x2c0ef8[_0xe93d('0x36')]['sort']);_0x3bf6db['where']=qs[_0xe93d('0x38')](_[_0xe93d('0x42')](_0x2c0ef8[_0xe93d('0x36')],_0x2a0aef[_0xe93d('0x38')]));if(_0x2c0ef8[_0xe93d('0x36')][_0xe93d('0x43')]){_0x3bf6db[_0xe93d('0x41')]=_[_0xe93d('0x44')](_0x3bf6db[_0xe93d('0x41')],{'$or':_['map'](_0x3bf6db[_0xe93d('0x3b')],function(_0x5ba3e2){var _0x2e1634={};_0x2e1634[_0x5ba3e2]={'$like':'%'+_0x2c0ef8[_0xe93d('0x36')]['filter']+'%'};return _0x2e1634;})});}_0x3bf6db=_[_0xe93d('0x44')]({},_0x3bf6db,_0x2c0ef8[_0xe93d('0x4b')]);return _0x2f4900[_0xe93d('0x60')](_0x3bf6db);}})[_0xe93d('0x26')](function(_0xd26deb){if(_0xd26deb){_0x10597f=_0xd26deb['length'];if(!_0x2c0ef8[_0xe93d('0x36')][_0xe93d('0x3d')](_0xe93d('0x3e'))){_0x3bf6db[_0xe93d('0x21')]=qs[_0xe93d('0x21')](_0x2c0ef8[_0xe93d('0x36')]['limit']);_0x3bf6db['offset']=qs['offset'](_0x2c0ef8[_0xe93d('0x36')][_0xe93d('0x1e')]);}return _0x2f4900[_0xe93d('0x60')](_0x3bf6db);}})[_0xe93d('0x26')](function(_0x321ebe){if(_0x321ebe){return _0x321ebe?{'count':_0x10597f,'rows':_0x321ebe}:null;}})['then'](respondWithResult(_0x2eecea,null))[_0xe93d('0x48')](handleError(_0x2eecea,null));};exports[_0xe93d('0x63')]=function(_0x44fbb5,_0x40ce73,_0x3cf141){var _0x39686a=_0x44fbb5[_0xe93d('0x54')]['ids'];return db['Team'][_0xe93d('0x64')]({'where':{'id':_0x39686a},'attributes':['id'],'include':[{'model':db[_0xe93d('0x58')],'as':_0xe93d('0x65'),'attributes':['id',_0xe93d('0x2d'),_0xe93d('0x66'),_0xe93d('0x67'),_0xe93d('0x68')],'raw':!![]}]})[_0xe93d('0x26')](function(_0x1b4211){if(_0x1b4211){var _0x533974=_[_0xe93d('0x69')](_0x1b4211,function(_0x5317bb){var _0x557190=_0x5317bb[_0xe93d('0x28')]({'plain':!![]});return _0x557190[_0xe93d('0x65')];});return db[_0xe93d('0x31')][_0xe93d('0x4c')]({'where':{'id':_0x44fbb5[_0xe93d('0x4a')]['id']}})[_0xe93d('0x26')](function(_0xe5f10d){return db['sequelize'][_0xe93d('0x6a')](function(_0x5d203c){return _0xe5f10d[_0xe93d('0x63')](_0x39686a,{'transaction':_0x5d203c})[_0xe93d('0x26')](function(){return BPromise[_0xe93d('0x6b')](_0x533974,function(_0x343a5b){return db['UserFaxQueue'][_0xe93d('0x6c')]({'where':{'UserId':_0x343a5b['id'],'FaxQueueId':_0x44fbb5[_0xe93d('0x4a')]['id']},'transaction':_0x5d203c});});})[_0xe93d('0x26')](function(){_0x533974[_0xe93d('0x6d')](function(_0x9e3c62){socket[_0xe93d('0x6e')]('userFaxQueue:save',{'UserId':_0x9e3c62['id'],'FaxQueueId':_0xe5f10d['id']});});});});});}})[_0xe93d('0x26')](respondWithStatusCode(_0x40ce73,null))[_0xe93d('0x48')](handleError(_0x40ce73,null));};exports[_0xe93d('0x6f')]=function(_0xd8d10b,_0x15961f,_0x3ed70f){return db['Team'][_0xe93d('0x64')]({'where':{'id':_0xd8d10b['query'][_0xe93d('0x70')]},'attributes':['id'],'include':[{'model':db[_0xe93d('0x58')],'as':_0xe93d('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x15961f,null))['then'](function(_0x3e2955){var _0x12f869=_['map'](_0x3e2955,'id');var _0x4d07a7=[];var _0x1b6d8f=[];var _0x2f13f1=squel['select']();_0x2f13f1[_0xe93d('0x71')](_0xe93d('0x72'))[_0xe93d('0x73')](_0xe93d('0x74'),'tq')[_0xe93d('0x75')](_0xe93d('0x76'),'ut',_0xe93d('0x77'))[_0xe93d('0x41')](_0xe93d('0x78'),_0xd8d10b[_0xe93d('0x4a')]['id']);for(var _0x202e97=0x0;_0x202e97<_0x3e2955['length'];_0x202e97+=0x1){let _0x16cd7b=_0x3e2955[_0x202e97];for(var _0x12e90e=0x0;_0x12e90e<_0x16cd7b['Agents'][_0xe93d('0x3c')];_0x12e90e+=0x1){let _0x57fac8=_0x16cd7b[_0xe93d('0x65')][_0x12e90e];var _0x3dc2e4=_0x2f13f1[_0xe93d('0x79')]();_0x3dc2e4[_0xe93d('0x41')](_0xe93d('0x7a'),_0x57fac8['id']);_0x1b6d8f[_0xe93d('0x7b')](db[_0xe93d('0x7c')][_0xe93d('0x36')](_0x3dc2e4[_0xe93d('0x7d')](),{'type':db[_0xe93d('0x7c')][_0xe93d('0x7e')][_0xe93d('0x7f')]})['then'](function(_0x8a7390){if(_0x8a7390[_0xe93d('0x3c')]===0x1){return _0x57fac8['id'];}else{var _0x5406d2=_[_0xe93d('0x80')](_[_0xe93d('0x30')](_0x8a7390,_0xe93d('0x81')),function(_0x352abe){return _[_0xe93d('0x82')](_0x12f869,_0x352abe);});if(_0x5406d2){return _0x57fac8['id'];}}}));}}return BPromise[_0xe93d('0x83')](_0x1b6d8f)[_0xe93d('0x26')](function(_0x4f1196){_0x4d07a7=_(_0x4d07a7)['union'](_0x4f1196)[_0xe93d('0x84')]()[_0xe93d('0x85')]();return db[_0xe93d('0x31')]['find']({'where':{'id':_0xd8d10b[_0xe93d('0x4a')]['id']}})[_0xe93d('0x26')](function(_0x1f97d4){return db['sequelize']['transaction'](function(_0xc3855e){return _0x1f97d4[_0xe93d('0x6f')](_0xd8d10b['query'][_0xe93d('0x70')],{'transaction':_0xc3855e})[_0xe93d('0x26')](function(){if(!_[_0xe93d('0x86')](_0x4d07a7)){return _0x1f97d4[_0xe93d('0x87')](_0x4d07a7,{'transaction':_0xc3855e});}})['then'](function(){_0x4d07a7[_0xe93d('0x6d')](function(_0x3fe668){socket[_0xe93d('0x6e')](_0xe93d('0x88'),{'UserId':_0x3fe668,'FaxQueueId':_0x1f97d4['id']});});});});});});})[_0xe93d('0x26')](respondWithStatusCode(_0x15961f,null))[_0xe93d('0x48')](handleError(_0x15961f,null));};exports['addAgents']=function(_0x3cff84,_0x1af865,_0xa465a9){return db[_0xe93d('0x31')][_0xe93d('0x4c')]({'where':{'id':_0x3cff84[_0xe93d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1af865,null))['then'](function(_0x59b0c7){if(_0x59b0c7){return _0x59b0c7[_0xe93d('0x89')](_0x3cff84['body'][_0xe93d('0x70')],_[_0xe93d('0x8a')](_0x3cff84['body'],['ids','id'])||{})['spread'](function(_0x35fe0d){for(var _0x4b78d1=0x0;_0x4b78d1<_0x3cff84[_0xe93d('0x54')]['ids'][_0xe93d('0x3c')];_0x4b78d1+=0x1){socket[_0xe93d('0x6e')](_0xe93d('0x8b'),{'UserId':Number(_0x3cff84['body'][_0xe93d('0x70')][_0x4b78d1]),'FaxQueueId':Number(_0x3cff84['params']['id'])});}return _0x35fe0d;});}})[_0xe93d('0x26')](respondWithResult(_0x1af865,null))[_0xe93d('0x48')](handleError(_0x1af865,null));};exports[_0xe93d('0x87')]=function(_0x329116,_0x1d0230,_0x568ae1){return db[_0xe93d('0x31')]['find']({'where':{'id':_0x329116['params']['id']}})[_0xe93d('0x26')](handleEntityNotFound(_0x1d0230,null))[_0xe93d('0x26')](function(_0x53de3e){if(_0x53de3e){return _0x53de3e['removeAgents'](_0x329116[_0xe93d('0x36')][_0xe93d('0x70')])['then'](function(){if(_['isArray'](_0x329116[_0xe93d('0x36')][_0xe93d('0x70')])){for(var _0x3fb517=0x0;_0x3fb517<_0x329116['query'][_0xe93d('0x70')][_0xe93d('0x3c')];_0x3fb517+=0x1){socket[_0xe93d('0x6e')](_0xe93d('0x88'),{'UserId':Number(_0x329116[_0xe93d('0x36')][_0xe93d('0x70')][_0x3fb517]),'FaxQueueId':Number(_0x329116[_0xe93d('0x4a')]['id'])});}}else{socket['emit'](_0xe93d('0x88'),{'UserId':Number(_0x329116[_0xe93d('0x36')][_0xe93d('0x70')]),'FaxQueueId':Number(_0x329116[_0xe93d('0x4a')]['id'])});}});}})[_0xe93d('0x26')](respondWithStatusCode(_0x1d0230,null))['catch'](handleError(_0x1d0230,null));};exports[_0xe93d('0x8c')]=function(_0x4bae8f,_0x5ac560,_0x36cc8d){var _0x18cdaa={};var _0x57a80a={};var _0x482d27;var _0x139102;return db[_0xe93d('0x31')][_0xe93d('0x61')]({'where':{'id':_0x4bae8f[_0xe93d('0x4a')]['id']}})[_0xe93d('0x26')](handleEntityNotFound(_0x5ac560,null))[_0xe93d('0x26')](function(_0x54f0ba){if(_0x54f0ba){_0x482d27=_0x54f0ba;_0x57a80a[_0xe93d('0x35')]=_[_0xe93d('0x37')](db['User'][_0xe93d('0x32')]);_0x57a80a['query']=_[_0xe93d('0x37')](_0x4bae8f[_0xe93d('0x36')]);_0x57a80a[_0xe93d('0x38')]=_[_0xe93d('0x39')](_0x57a80a[_0xe93d('0x35')],_0x57a80a['query']);_0x18cdaa['attributes']=_[_0xe93d('0x39')](_0x57a80a[_0xe93d('0x35')],qs[_0xe93d('0x3a')](_0x4bae8f[_0xe93d('0x36')]['fields']));_0x18cdaa[_0xe93d('0x3b')]=_0x18cdaa[_0xe93d('0x3b')][_0xe93d('0x3c')]?_0x18cdaa[_0xe93d('0x3b')]:_0x57a80a[_0xe93d('0x35')];_0x18cdaa[_0xe93d('0x3f')]=qs[_0xe93d('0x40')](_0x4bae8f[_0xe93d('0x36')][_0xe93d('0x40')]);_0x18cdaa[_0xe93d('0x41')]=qs[_0xe93d('0x38')](_[_0xe93d('0x42')](_0x4bae8f[_0xe93d('0x36')],_0x57a80a[_0xe93d('0x38')]));if(_0x4bae8f[_0xe93d('0x36')][_0xe93d('0x43')]){_0x18cdaa['where']=_[_0xe93d('0x44')](_0x18cdaa['where'],{'$or':_[_0xe93d('0x30')](_0x18cdaa[_0xe93d('0x3b')],function(_0x384b53){var _0x2d847a={};_0x2d847a[_0x384b53]={'$like':'%'+_0x4bae8f[_0xe93d('0x36')][_0xe93d('0x43')]+'%'};return _0x2d847a;})});}_0x18cdaa=_[_0xe93d('0x44')]({},_0x18cdaa,_0x4bae8f[_0xe93d('0x4b')]);return _0x482d27[_0xe93d('0x8c')](_0x18cdaa);}})[_0xe93d('0x26')](function(_0x316d52){if(_0x316d52){_0x139102=_0x316d52[_0xe93d('0x3c')];if(!_0x4bae8f[_0xe93d('0x36')]['hasOwnProperty'](_0xe93d('0x3e'))){_0x18cdaa[_0xe93d('0x21')]=qs[_0xe93d('0x21')](_0x4bae8f[_0xe93d('0x36')]['limit']);_0x18cdaa[_0xe93d('0x1e')]=qs['offset'](_0x4bae8f[_0xe93d('0x36')][_0xe93d('0x1e')]);}return _0x482d27[_0xe93d('0x8c')](_0x18cdaa);}})[_0xe93d('0x26')](function(_0x406698){if(_0x406698){return _0x406698?{'count':_0x139102,'rows':_0x406698}:null;}})[_0xe93d('0x26')](respondWithResult(_0x5ac560,null))[_0xe93d('0x48')](handleError(_0x5ac560,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index a8c7a4b..179c4e8 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 _0xa280=['exports','events','FaxQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x41327d,_0x2611d8){var _0x39f24e=function(_0x335a63){while(--_0x335a63){_0x41327d['push'](_0x41327d['shift']());}};_0x39f24e(++_0x2611d8);}(_0xa280,0x1d5));var _0x0a28=function(_0x284b34,_0x3c9f21){_0x284b34=_0x284b34-0x0;var _0x13483b=_0xa280[_0x284b34];return _0x13483b;};'use strict';var EventEmitter=require(_0x0a28('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x0a28('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0a28('0x2'),'afterUpdate':_0x0a28('0x3'),'afterDestroy':_0x0a28('0x4')};function emitEvent(_0x48ca93){return function(_0x583d76,_0x4e957f,_0x3528f2){FaxQueueEvents[_0x0a28('0x5')](_0x48ca93+':'+_0x583d76['id'],_0x583d76);FaxQueueEvents[_0x0a28('0x5')](_0x48ca93,_0x583d76);_0x3528f2(null);};}for(var e in events){if(events[_0x0a28('0x6')](e)){var event=events[e];FaxQueue[_0x0a28('0x7')](e,emitEvent(event));}}module[_0x0a28('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xfad6=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hook'];(function(_0x59e2d2,_0x1f6357){var _0x38326a=function(_0x244dab){while(--_0x244dab){_0x59e2d2['push'](_0x59e2d2['shift']());}};_0x38326a(++_0x1f6357);}(_0xfad6,0x13c));var _0x6fad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfad6[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x6fad('0x0'));var FaxQueue=require(_0x6fad('0x1'))['db'][_0x6fad('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6fad('0x3')](0x0);var events={'afterCreate':_0x6fad('0x4'),'afterUpdate':_0x6fad('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2c6b45){return function(_0x301618,_0x2e199e,_0x37f972){FaxQueueEvents[_0x6fad('0x6')](_0x2c6b45+':'+_0x301618['id'],_0x301618);FaxQueueEvents[_0x6fad('0x6')](_0x2c6b45,_0x301618);_0x37f972(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x6fad('0x7')](e,emitEvent(event));}}module[_0x6fad('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 e08f0cf..fbfff67 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 _0x280e=['util','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues'];(function(_0x51ec17,_0x4b5f1e){var _0x4bca04=function(_0x64fd26){while(--_0x64fd26){_0x51ec17['push'](_0x51ec17['shift']());}};_0x4bca04(++_0x4b5f1e);}(_0x280e,0x129));var _0xe280=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x280e[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require(_0xe280('0x0'));var logger=require('../../config/logger')(_0xe280('0x1'));var moment=require(_0xe280('0x2'));var BPromise=require(_0xe280('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe280('0x4'));var rimraf=require(_0xe280('0x5'));var config=require(_0xe280('0x6'));var attributes=require(_0xe280('0x7'));module[_0xe280('0x8')]=function(_0x5974be,_0x577cb5){return _0x5974be['define'](_0xe280('0x9'),attributes,{'tableName':_0xe280('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x026d=['define','FaxQueue','fax_queues','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxQueue.attributes'];(function(_0x109ca8,_0x3a0ced){var _0x6c7ac3=function(_0x184d29){while(--_0x184d29){_0x109ca8['push'](_0x109ca8['shift']());}};_0x6c7ac3(++_0x3a0ced);}(_0x026d,0x1e7));var _0xd026=function(_0xa0abad,_0x3adedb){_0xa0abad=_0xa0abad-0x0;var _0x1632ab=_0x026d[_0xa0abad];return _0x1632ab;};'use strict';var _=require(_0xd026('0x0'));var util=require('util');var logger=require(_0xd026('0x1'))(_0xd026('0x2'));var moment=require(_0xd026('0x3'));var BPromise=require('bluebird');var rp=require(_0xd026('0x4'));var fs=require('fs');var path=require(_0xd026('0x5'));var rimraf=require('rimraf');var config=require(_0xd026('0x6'));var attributes=require(_0xd026('0x7'));module['exports']=function(_0x9f644c,_0x12762b){return _0x9f644c[_0xd026('0x8')](_0xd026('0x9'),attributes,{'tableName':_0xd026('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 8a05f53..6372aef 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 _0xd5c3=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','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','where','attributes','limit','include','map','model','then','stringify','ShowFaxQueue','find','lodash'];(function(_0xa7963b,_0x376dc0){var _0x52c918=function(_0x46ba6e){while(--_0x46ba6e){_0xa7963b['push'](_0xa7963b['shift']());}};_0x52c918(++_0x376dc0);}(_0xd5c3,0xcc));var _0x3d5c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd5c3[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x3d5c('0x0'));var util=require(_0x3d5c('0x1'));var moment=require(_0x3d5c('0x2'));var BPromise=require('bluebird');var rs=require(_0x3d5c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3d5c('0x4'));var logger=require(_0x3d5c('0x5'))(_0x3d5c('0x6'));var config=require(_0x3d5c('0x7'));var jayson=require(_0x3d5c('0x8'));var client=jayson[_0x3d5c('0x9')][_0x3d5c('0xa')]({'port':0x232a});config[_0x3d5c('0xb')]=_['defaults'](config[_0x3d5c('0xb')],{'host':_0x3d5c('0xc'),'port':0x18eb});var socket=require(_0x3d5c('0xd'))(new Redis(config['redis']));require(_0x3d5c('0xe'))[_0x3d5c('0xf')](socket);function respondWithRpcPromise(_0x4a3d4b,_0x42c804,_0x352305){return new BPromise(function(_0x467851,_0x4957db){return client['request'](_0x4a3d4b,_0x352305)['then'](function(_0x60cb89){logger['info'](_0x3d5c('0x10'),_0x42c804,_0x3d5c('0x11'));logger[_0x3d5c('0x12')](_0x3d5c('0x13'),_0x42c804,'request\x20sent',JSON['stringify'](_0x60cb89));if(_0x60cb89[_0x3d5c('0x14')]){if(_0x60cb89['error'][_0x3d5c('0x15')]===0x1f4){logger[_0x3d5c('0x14')](_0x3d5c('0x10'),_0x42c804,_0x60cb89[_0x3d5c('0x14')]['message']);return _0x4957db(_0x60cb89[_0x3d5c('0x14')][_0x3d5c('0x16')]);}logger[_0x3d5c('0x14')](_0x3d5c('0x10'),_0x42c804,_0x60cb89[_0x3d5c('0x14')][_0x3d5c('0x16')]);return _0x467851(_0x60cb89[_0x3d5c('0x14')][_0x3d5c('0x16')]);}else{logger[_0x3d5c('0x17')](_0x3d5c('0x10'),_0x42c804,'request\x20sent');_0x467851(_0x60cb89[_0x3d5c('0x18')]['message']);}})[_0x3d5c('0x19')](function(_0x2620ad){logger['error'](_0x3d5c('0x10'),_0x42c804,_0x2620ad);_0x4957db(_0x2620ad);});});}exports[_0x3d5c('0x1a')]=function(_0x3439b0){var _0x49ec98=this;return new Promise(function(_0x13c2fd,_0x224a38){return db[_0x3d5c('0x1b')][_0x3d5c('0x1c')]({'raw':_0x3439b0[_0x3d5c('0x1d')]?_0x3439b0[_0x3d5c('0x1d')][_0x3d5c('0x1e')]===undefined?!![]:![]:!![],'where':_0x3439b0[_0x3d5c('0x1d')]?_0x3439b0['options'][_0x3d5c('0x1f')]||null:null,'attributes':_0x3439b0['options']?_0x3439b0[_0x3d5c('0x1d')][_0x3d5c('0x20')]||null:null,'limit':_0x3439b0[_0x3d5c('0x1d')]?_0x3439b0['options'][_0x3d5c('0x21')]||null:null,'include':_0x3439b0[_0x3d5c('0x1d')]?_0x3439b0[_0x3d5c('0x1d')][_0x3d5c('0x22')]?_[_0x3d5c('0x23')](_0x3439b0[_0x3d5c('0x1d')][_0x3d5c('0x22')],function(_0x439646){return{'model':db[_0x439646[_0x3d5c('0x24')]],'as':_0x439646['as'],'attributes':_0x439646['attributes'],'include':_0x439646[_0x3d5c('0x22')]?_[_0x3d5c('0x23')](_0x439646[_0x3d5c('0x22')],function(_0x4a53ab){return{'model':db[_0x4a53ab[_0x3d5c('0x24')]],'as':_0x4a53ab['as'],'attributes':_0x4a53ab['attributes'],'include':_0x4a53ab[_0x3d5c('0x22')]?_['map'](_0x4a53ab[_0x3d5c('0x22')],function(_0xe0c3a9){return{'model':db[_0xe0c3a9[_0x3d5c('0x24')]],'as':_0xe0c3a9['as'],'attributes':_0xe0c3a9[_0x3d5c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3d5c('0x25')](function(_0x79dd3c){logger[_0x3d5c('0x17')](_0x3d5c('0x1a'),_0x3439b0);logger[_0x3d5c('0x12')]('GetFaxQueue',_0x3439b0,JSON[_0x3d5c('0x26')](_0x79dd3c));_0x13c2fd(_0x79dd3c);})['catch'](function(_0x466d67){logger[_0x3d5c('0x14')]('GetFaxQueue',_0x466d67[_0x3d5c('0x16')],_0x3439b0);_0x224a38(_0x49ec98[_0x3d5c('0x14')](0x1f4,_0x466d67[_0x3d5c('0x16')]));});});};exports[_0x3d5c('0x27')]=function(_0x1dc947){var _0x1d07ae=this;return new Promise(function(_0x2b5240,_0x172f9f){return db[_0x3d5c('0x1b')][_0x3d5c('0x28')]({'raw':_0x1dc947[_0x3d5c('0x1d')]?_0x1dc947[_0x3d5c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1dc947[_0x3d5c('0x1d')]?_0x1dc947[_0x3d5c('0x1d')][_0x3d5c('0x1f')]||null:null,'attributes':_0x1dc947[_0x3d5c('0x1d')]?_0x1dc947[_0x3d5c('0x1d')][_0x3d5c('0x20')]||null:null,'include':_0x1dc947['options']?_0x1dc947[_0x3d5c('0x1d')][_0x3d5c('0x22')]?_[_0x3d5c('0x23')](_0x1dc947[_0x3d5c('0x1d')]['include'],function(_0x40e3de){return{'model':db[_0x40e3de[_0x3d5c('0x24')]],'as':_0x40e3de['as'],'attributes':_0x40e3de[_0x3d5c('0x20')],'include':_0x40e3de[_0x3d5c('0x22')]?_[_0x3d5c('0x23')](_0x40e3de[_0x3d5c('0x22')],function(_0x102714){return{'model':db[_0x102714[_0x3d5c('0x24')]],'as':_0x102714['as'],'attributes':_0x102714[_0x3d5c('0x20')],'include':_0x102714['include']?_[_0x3d5c('0x23')](_0x102714[_0x3d5c('0x22')],function(_0x4bfcc3){return{'model':db[_0x4bfcc3[_0x3d5c('0x24')]],'as':_0x4bfcc3['as'],'attributes':_0x4bfcc3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3768d0){logger[_0x3d5c('0x17')](_0x3d5c('0x27'),_0x1dc947);logger['debug']('ShowFaxQueue',_0x1dc947,JSON[_0x3d5c('0x26')](_0x3768d0));_0x2b5240(_0x3768d0);})[_0x3d5c('0x19')](function(_0x43c56a){logger[_0x3d5c('0x14')](_0x3d5c('0x27'),_0x43c56a[_0x3d5c('0x16')],_0x1dc947);_0x172f9f(_0x1d07ae[_0x3d5c('0x14')](0x1f4,_0x43c56a[_0x3d5c('0x16')]));});});}; \ No newline at end of file +var _0x0e96=['error','code','message','result','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','map','include','model','ShowFaxQueue','find','raw','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3efc74,_0x5075a7){var _0x4d4853=function(_0x6f3f25){while(--_0x6f3f25){_0x3efc74['push'](_0x3efc74['shift']());}};_0x4d4853(++_0x5075a7);}(_0x0e96,0xb2));var _0x60e9=function(_0x5e26f0,_0x3fe2e0){_0x5e26f0=_0x5e26f0-0x0;var _0x513758=_0x0e96[_0x5e26f0];return _0x513758;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x60e9('0x0'));var BPromise=require(_0x60e9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60e9('0x2'));var db=require(_0x60e9('0x3'))['db'];var utils=require(_0x60e9('0x4'));var logger=require(_0x60e9('0x5'))(_0x60e9('0x6'));var config=require('../../config/environment');var jayson=require(_0x60e9('0x7'));var client=jayson[_0x60e9('0x8')]['http']({'port':0x232a});config[_0x60e9('0x9')]=_[_0x60e9('0xa')](config['redis'],{'host':_0x60e9('0xb'),'port':0x18eb});var socket=require(_0x60e9('0xc'))(new Redis(config[_0x60e9('0x9')]));require('./faxQueue.socket')[_0x60e9('0xd')](socket);function respondWithRpcPromise(_0x500f36,_0x31d217,_0x982261){return new BPromise(function(_0x4fcbb0,_0x19d8c4){return client[_0x60e9('0xe')](_0x500f36,_0x982261)[_0x60e9('0xf')](function(_0x5e2247){logger[_0x60e9('0x10')](_0x60e9('0x11'),_0x31d217,_0x60e9('0x12'));logger[_0x60e9('0x13')](_0x60e9('0x14'),_0x31d217,_0x60e9('0x12'),JSON[_0x60e9('0x15')](_0x5e2247));if(_0x5e2247[_0x60e9('0x16')]){if(_0x5e2247[_0x60e9('0x16')][_0x60e9('0x17')]===0x1f4){logger[_0x60e9('0x16')](_0x60e9('0x11'),_0x31d217,_0x5e2247[_0x60e9('0x16')][_0x60e9('0x18')]);return _0x19d8c4(_0x5e2247[_0x60e9('0x16')][_0x60e9('0x18')]);}logger[_0x60e9('0x16')]('FaxQueue,\x20%s,\x20%s',_0x31d217,_0x5e2247[_0x60e9('0x16')][_0x60e9('0x18')]);return _0x4fcbb0(_0x5e2247[_0x60e9('0x16')][_0x60e9('0x18')]);}else{logger['info'](_0x60e9('0x11'),_0x31d217,_0x60e9('0x12'));_0x4fcbb0(_0x5e2247[_0x60e9('0x19')][_0x60e9('0x18')]);}})['catch'](function(_0xd9c80f){logger[_0x60e9('0x16')](_0x60e9('0x11'),_0x31d217,_0xd9c80f);_0x19d8c4(_0xd9c80f);});});}exports[_0x60e9('0x1a')]=function(_0x1546e1){var _0x12726c=this;return new Promise(function(_0x395a17,_0x1966f8){return db[_0x60e9('0x1b')][_0x60e9('0x1c')]({'raw':_0x1546e1[_0x60e9('0x1d')]?_0x1546e1[_0x60e9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1546e1[_0x60e9('0x1d')]?_0x1546e1['options'][_0x60e9('0x1e')]||null:null,'attributes':_0x1546e1[_0x60e9('0x1d')]?_0x1546e1[_0x60e9('0x1d')][_0x60e9('0x1f')]||null:null,'limit':_0x1546e1[_0x60e9('0x1d')]?_0x1546e1['options'][_0x60e9('0x20')]||null:null,'include':_0x1546e1[_0x60e9('0x1d')]?_0x1546e1[_0x60e9('0x1d')]['include']?_[_0x60e9('0x21')](_0x1546e1[_0x60e9('0x1d')][_0x60e9('0x22')],function(_0x1a5ece){return{'model':db[_0x1a5ece[_0x60e9('0x23')]],'as':_0x1a5ece['as'],'attributes':_0x1a5ece[_0x60e9('0x1f')],'include':_0x1a5ece['include']?_[_0x60e9('0x21')](_0x1a5ece[_0x60e9('0x22')],function(_0x22348b){return{'model':db[_0x22348b['model']],'as':_0x22348b['as'],'attributes':_0x22348b[_0x60e9('0x1f')],'include':_0x22348b[_0x60e9('0x22')]?_['map'](_0x22348b[_0x60e9('0x22')],function(_0x9ea7b1){return{'model':db[_0x9ea7b1[_0x60e9('0x23')]],'as':_0x9ea7b1['as'],'attributes':_0x9ea7b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x60e9('0xf')](function(_0x2d42e9){logger[_0x60e9('0x10')](_0x60e9('0x1a'),_0x1546e1);logger[_0x60e9('0x13')](_0x60e9('0x1a'),_0x1546e1,JSON[_0x60e9('0x15')](_0x2d42e9));_0x395a17(_0x2d42e9);})['catch'](function(_0x505121){logger[_0x60e9('0x16')]('GetFaxQueue',_0x505121[_0x60e9('0x18')],_0x1546e1);_0x1966f8(_0x12726c[_0x60e9('0x16')](0x1f4,_0x505121[_0x60e9('0x18')]));});});};exports[_0x60e9('0x24')]=function(_0x5c47c7){var _0x57b621=this;return new Promise(function(_0x28c571,_0x4043a2){return db[_0x60e9('0x1b')][_0x60e9('0x25')]({'raw':_0x5c47c7['options']?_0x5c47c7['options'][_0x60e9('0x26')]===undefined?!![]:![]:!![],'where':_0x5c47c7[_0x60e9('0x1d')]?_0x5c47c7['options'][_0x60e9('0x1e')]||null:null,'attributes':_0x5c47c7[_0x60e9('0x1d')]?_0x5c47c7[_0x60e9('0x1d')][_0x60e9('0x1f')]||null:null,'include':_0x5c47c7['options']?_0x5c47c7[_0x60e9('0x1d')][_0x60e9('0x22')]?_['map'](_0x5c47c7[_0x60e9('0x1d')][_0x60e9('0x22')],function(_0x1c5819){return{'model':db[_0x1c5819[_0x60e9('0x23')]],'as':_0x1c5819['as'],'attributes':_0x1c5819['attributes'],'include':_0x1c5819[_0x60e9('0x22')]?_[_0x60e9('0x21')](_0x1c5819[_0x60e9('0x22')],function(_0x40eae5){return{'model':db[_0x40eae5[_0x60e9('0x23')]],'as':_0x40eae5['as'],'attributes':_0x40eae5[_0x60e9('0x1f')],'include':_0x40eae5[_0x60e9('0x22')]?_[_0x60e9('0x21')](_0x40eae5[_0x60e9('0x22')],function(_0x33f108){return{'model':db[_0x33f108['model']],'as':_0x33f108['as'],'attributes':_0x33f108[_0x60e9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x60e9('0xf')](function(_0x44497e){logger[_0x60e9('0x10')](_0x60e9('0x24'),_0x5c47c7);logger[_0x60e9('0x13')](_0x60e9('0x24'),_0x5c47c7,JSON['stringify'](_0x44497e));_0x28c571(_0x44497e);})[_0x60e9('0x27')](function(_0x1374d7){logger[_0x60e9('0x16')](_0x60e9('0x24'),_0x1374d7[_0x60e9('0x18')],_0x5c47c7);_0x4043a2(_0x57b621['error'](0x1f4,_0x1374d7[_0x60e9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index c3216f8..b46f9e2 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 _0x62f2=['emit','removeListener','register','./faxQueue.events','save','remove','update'];(function(_0x4d6562,_0x2d2bfa){var _0x377102=function(_0x1d0e30){while(--_0x1d0e30){_0x4d6562['push'](_0x4d6562['shift']());}};_0x377102(++_0x2d2bfa);}(_0x62f2,0xff));var _0x262f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x62f2[_0x21a9d9];return _0x46adce;};'use strict';var FaxQueueEvents=require(_0x262f('0x0'));var events=[_0x262f('0x1'),_0x262f('0x2'),_0x262f('0x3')];function createListener(_0x554ba7,_0x12a324){return function(_0x27fa80){_0x12a324[_0x262f('0x4')](_0x554ba7,_0x27fa80);};}function removeListener(_0x510fa3,_0x23ebfb){return function(){FaxQueueEvents[_0x262f('0x5')](_0x510fa3,_0x23ebfb);};}exports[_0x262f('0x6')]=function(_0x10ceb0){for(var _0x3f9f05=0x0,_0x5d5b29=events['length'];_0x3f9f05<_0x5d5b29;_0x3f9f05++){var _0x415644=events[_0x3f9f05];var _0x219dc5=createListener('faxQueue:'+_0x415644,_0x10ceb0);FaxQueueEvents['on'](_0x415644,_0x219dc5);}}; \ No newline at end of file +var _0x9278=['update','removeListener','register','length','faxQueue:','./faxQueue.events','remove'];(function(_0x25836c,_0x1047c4){var _0x383e29=function(_0x2b47ba){while(--_0x2b47ba){_0x25836c['push'](_0x25836c['shift']());}};_0x383e29(++_0x1047c4);}(_0x9278,0x1c5));var _0x8927=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9278[_0x1cc8fe];return _0x230054;};'use strict';var FaxQueueEvents=require(_0x8927('0x0'));var events=['save',_0x8927('0x1'),_0x8927('0x2')];function createListener(_0x81d15d,_0x232fb6){return function(_0xf435c2){_0x232fb6['emit'](_0x81d15d,_0xf435c2);};}function removeListener(_0x307db7,_0x4e1287){return function(){FaxQueueEvents[_0x8927('0x3')](_0x307db7,_0x4e1287);};}exports[_0x8927('0x4')]=function(_0x56cb52){for(var _0x308ad1=0x0,_0x9ada3e=events[_0x8927('0x5')];_0x308ad1<_0x9ada3e;_0x308ad1++){var _0x4b1242=events[_0x308ad1];var _0x5aa23b=createListener(_0x8927('0x6')+_0x4b1242,_0x56cb52);FaxQueueEvents['on'](_0x4b1242,_0x5aa23b);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index dafd3f6..66a267d 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 _0x2d72=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','destroy','delete','exports'];(function(_0x2c4272,_0x96066e){var _0x146c03=function(_0x160a7f){while(--_0x160a7f){_0x2c4272['push'](_0x2c4272['shift']());}};_0x146c03(++_0x96066e);}(_0x2d72,0xa8));var _0x22d7=function(_0x386624,_0x4100d3){_0x386624=_0x386624-0x0;var _0x3d308c=_0x2d72[_0x386624];return _0x3d308c;};'use strict';var multer=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var path=require(_0x22d7('0x2'));var timeout=require(_0x22d7('0x3'));var express=require(_0x22d7('0x4'));var router=express[_0x22d7('0x5')]();var fs_extra=require(_0x22d7('0x6'));var auth=require(_0x22d7('0x7'));var interaction=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var controller=require(_0x22d7('0xa'));router[_0x22d7('0xb')]('/',auth[_0x22d7('0xc')](),controller[_0x22d7('0xd')]);router['get'](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller['describe']);router[_0x22d7('0xb')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x10')]);router['get']('/:id/members',auth[_0x22d7('0xc')](),controller[_0x22d7('0x11')]);router[_0x22d7('0xb')](_0x22d7('0x12'),auth[_0x22d7('0xc')](),controller['getTeams']);router['get'](_0x22d7('0x13'),auth['isAuthenticated'](),controller[_0x22d7('0x14')]);router[_0x22d7('0x15')]('/',auth['isAuthenticated'](),controller[_0x22d7('0x16')]);router[_0x22d7('0x15')](_0x22d7('0x12'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x17')]);router[_0x22d7('0x15')](_0x22d7('0x13'),auth[_0x22d7('0xc')](),controller['addAgents']);router[_0x22d7('0x18')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller['update']);router['delete']('/:id',auth[_0x22d7('0xc')](),controller[_0x22d7('0x19')]);router[_0x22d7('0x1a')](_0x22d7('0x12'),auth[_0x22d7('0xc')](),controller['removeTeams']);router[_0x22d7('0x1a')](_0x22d7('0x13'),auth[_0x22d7('0xc')](),controller['removeAgents']);module[_0x22d7('0x1b')]=router; \ No newline at end of file +var _0x8aad=['removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','/:id/teams','removeTeams'];(function(_0x2697dd,_0x55851a){var _0x75f500=function(_0xb846fd){while(--_0xb846fd){_0x2697dd['push'](_0x2697dd['shift']());}};_0x75f500(++_0x55851a);}(_0x8aad,0x146));var _0xd8aa=function(_0x7a1151,_0x5a193d){_0x7a1151=_0x7a1151-0x0;var _0x56e54f=_0x8aad[_0x7a1151];return _0x56e54f;};'use strict';var multer=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var path=require('path');var timeout=require(_0xd8aa('0x2'));var express=require('express');var router=express[_0xd8aa('0x3')]();var fs_extra=require(_0xd8aa('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8aa('0x5'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x7')]);router[_0xd8aa('0x8')]('/describe',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x9')]);router[_0xd8aa('0x8')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd8aa('0x8')](_0xd8aa('0xb'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xc')]);router[_0xd8aa('0x8')]('/:id/teams',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xd')]);router[_0xd8aa('0x8')](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xf')]);router[_0xd8aa('0x10')]('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x11')]);router[_0xd8aa('0x10')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd8aa('0x12')]);router[_0xd8aa('0x10')](_0xd8aa('0xe'),auth['isAuthenticated'](),controller[_0xd8aa('0x13')]);router[_0xd8aa('0x14')](_0xd8aa('0xa'),auth[_0xd8aa('0x6')](),controller['update']);router[_0xd8aa('0x15')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller[_0xd8aa('0x16')]);router[_0xd8aa('0x15')](_0xd8aa('0x17'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x18')]);router['delete'](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x19')]);module[_0xd8aa('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 14f8a71..0e614fd 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 _0xe73c=['sequelize','exports','STRING','DATE','moment'];(function(_0xa962ff,_0x4b24f2){var _0x343d8a=function(_0x4ac6cf){while(--_0x4ac6cf){_0xa962ff['push'](_0xa962ff['shift']());}};_0x343d8a(++_0x4b24f2);}(_0xe73c,0x167));var _0xce73=function(_0x138202,_0x4539cb){_0x138202=_0x138202-0x0;var _0x422492=_0xe73c[_0x138202];return _0x422492;};'use strict';var moment=require(_0xce73('0x0'));var Sequelize=require(_0xce73('0x1'));module[_0xce73('0x2')]={'uniqueid':{'type':Sequelize[_0xce73('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xce73('0x3')]},'joinAt':{'type':Sequelize[_0xce73('0x4')]},'leaveAt':{'type':Sequelize[_0xce73('0x4')]},'acceptAt':{'type':Sequelize[_0xce73('0x4')]},'exitAt':{'type':Sequelize[_0xce73('0x4')]},'reason':{'type':Sequelize[_0xce73('0x3')]}}; \ No newline at end of file +var _0xc6a1=['STRING','DATE','moment','sequelize','exports'];(function(_0x179c9d,_0x1e576d){var _0x2195c8=function(_0x1d637c){while(--_0x1d637c){_0x179c9d['push'](_0x179c9d['shift']());}};_0x2195c8(++_0x1e576d);}(_0xc6a1,0xb1));var _0x1c6a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xc6a1[_0x3e5086];return _0xfeb102;};'use strict';var moment=require(_0x1c6a('0x0'));var Sequelize=require(_0x1c6a('0x1'));module[_0x1c6a('0x2')]={'uniqueid':{'type':Sequelize[_0x1c6a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1c6a('0x3')]},'joinAt':{'type':Sequelize[_0x1c6a('0x4')]},'leaveAt':{'type':Sequelize[_0x1c6a('0x4')]},'acceptAt':{'type':Sequelize[_0x1c6a('0x4')]},'exitAt':{'type':Sequelize[_0x1c6a('0x4')]},'reason':{'type':Sequelize[_0x1c6a('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 5f6ceef..0365934 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 _0x9b9b=['set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','FaxQueueReport','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit'];(function(_0x8b220a,_0x37906b){var _0x32ba05=function(_0x259fd2){while(--_0x259fd2){_0x8b220a['push'](_0x8b220a['shift']());}};_0x32ba05(++_0x37906b);}(_0x9b9b,0x114));var _0xb9b9=function(_0x41b133,_0x114320){_0x41b133=_0x41b133-0x0;var _0x844201=_0x9b9b[_0x41b133];return _0x844201;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9b9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb9b9('0x1'));var moment=require(_0xb9b9('0x2'));var BPromise=require(_0xb9b9('0x3'));var Mustache=require(_0xb9b9('0x4'));var util=require(_0xb9b9('0x5'));var path=require(_0xb9b9('0x6'));var sox=require(_0xb9b9('0x7'));var csv=require(_0xb9b9('0x8'));var ejs=require(_0xb9b9('0x9'));var fs=require('fs');var fs_extra=require(_0xb9b9('0xa'));var _=require(_0xb9b9('0xb'));var squel=require(_0xb9b9('0xc'));var crypto=require(_0xb9b9('0xd'));var jsforce=require(_0xb9b9('0xe'));var deskjs=require(_0xb9b9('0xf'));var toCsv=require(_0xb9b9('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb9b9('0x10'));var authService=require(_0xb9b9('0x11'));var qs=require(_0xb9b9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9b9('0x13'));var logger=require(_0xb9b9('0x14'))(_0xb9b9('0x15'));var utils=require('../../config/utils');var config=require(_0xb9b9('0x16'));var licenseUtil=require(_0xb9b9('0x17'));var db=require(_0xb9b9('0x18'))['db'];function respondWithStatusCode(_0x26fa04,_0x230fea){_0x230fea=_0x230fea||0xcc;return function(_0x135cdc){if(_0x135cdc){return _0x26fa04['sendStatus'](_0x230fea);}return _0x26fa04['status'](_0x230fea)[_0xb9b9('0x19')]();};}function respondWithResult(_0x4ef543,_0xe78d58){_0xe78d58=_0xe78d58||0xc8;return function(_0x50e5d6){if(_0x50e5d6){return _0x4ef543[_0xb9b9('0x1a')](_0xe78d58)[_0xb9b9('0x1b')](_0x50e5d6);}};}function respondWithFilteredResult(_0x21fa2a,_0x29794c){return function(_0x177ad9){if(_0x177ad9){var _0x3fd09c=typeof _0x29794c[_0xb9b9('0x1c')]===_0xb9b9('0x1d')&&typeof _0x29794c['limit']===_0xb9b9('0x1d');var _0x48d9ae=_0x177ad9[_0xb9b9('0x1e')];var _0x3e6d23=_0x3fd09c?0x0:_0x29794c[_0xb9b9('0x1c')];var _0x11bb05=_0x3fd09c?_0x177ad9['count']:_0x29794c[_0xb9b9('0x1c')]+_0x29794c[_0xb9b9('0x1f')];var _0x398f3d;if(_0x11bb05>=_0x48d9ae){_0x11bb05=_0x48d9ae;_0x398f3d=0xc8;}else{_0x398f3d=0xce;}_0x21fa2a[_0xb9b9('0x1a')](_0x398f3d);return _0x21fa2a[_0xb9b9('0x20')](_0xb9b9('0x21'),_0x3e6d23+'-'+_0x11bb05+'/'+_0x48d9ae)[_0xb9b9('0x1b')](_0x177ad9);}return null;};}function patchUpdates(_0x3d0edb){return function(_0xb16391){try{jsonpatch[_0xb9b9('0x22')](_0xb16391,_0x3d0edb,!![]);}catch(_0xbf7c16){return BPromise[_0xb9b9('0x23')](_0xbf7c16);}return _0xb16391[_0xb9b9('0x24')]();};}function saveUpdates(_0x4e33a0,_0x10b7e1){return function(_0xe1e1d7){if(_0xe1e1d7){return _0xe1e1d7[_0xb9b9('0x25')](_0x4e33a0)['then'](function(_0x9898bc){return _0x9898bc;});}return null;};}function removeEntity(_0x46525d,_0x5efa01){return function(_0x18e2ca){if(_0x18e2ca){return _0x18e2ca[_0xb9b9('0x26')]()[_0xb9b9('0x27')](function(){_0x46525d[_0xb9b9('0x1a')](0xcc)[_0xb9b9('0x19')]();});}};}function handleEntityNotFound(_0x5299fb,_0x4dfa3f){return function(_0x33ab82){if(!_0x33ab82){_0x5299fb[_0xb9b9('0x28')](0x194);}return _0x33ab82;};}function handleError(_0x48014a,_0x30ac24){_0x30ac24=_0x30ac24||0x1f4;return function(_0x134ed6){logger[_0xb9b9('0x29')](_0x134ed6[_0xb9b9('0x2a')]);if(_0x134ed6[_0xb9b9('0x2b')]){delete _0x134ed6['name'];}_0x48014a[_0xb9b9('0x1a')](_0x30ac24)['send'](_0x134ed6);};}exports[_0xb9b9('0x2c')]=function(_0xe28f3c,_0x4f47da){var _0x1b53e1={},_0x31b509={},_0x17a6f6={'count':0x0,'rows':[]};var _0x5eb860=_[_0xb9b9('0x2d')](db[_0xb9b9('0x2e')][_0xb9b9('0x2f')],function(_0x300453){return{'name':_0x300453['fieldName'],'type':_0x300453[_0xb9b9('0x30')][_0xb9b9('0x31')]};});_0x31b509['model']=_[_0xb9b9('0x2d')](_0x5eb860,_0xb9b9('0x2b'));_0x31b509[_0xb9b9('0x32')]=_[_0xb9b9('0x33')](_0xe28f3c['query']);_0x31b509[_0xb9b9('0x34')]=_[_0xb9b9('0x35')](_0x31b509[_0xb9b9('0x36')],_0x31b509[_0xb9b9('0x32')]);_0x1b53e1['attributes']=_[_0xb9b9('0x35')](_0x31b509[_0xb9b9('0x36')],qs['fields'](_0xe28f3c[_0xb9b9('0x32')][_0xb9b9('0x37')]));_0x1b53e1[_0xb9b9('0x38')]=_0x1b53e1[_0xb9b9('0x38')][_0xb9b9('0x39')]?_0x1b53e1[_0xb9b9('0x38')]:_0x31b509['model'];if(!_0xe28f3c[_0xb9b9('0x32')][_0xb9b9('0x3a')]('nolimit')){_0x1b53e1[_0xb9b9('0x1f')]=qs[_0xb9b9('0x1f')](_0xe28f3c[_0xb9b9('0x32')]['limit']);_0x1b53e1[_0xb9b9('0x1c')]=qs['offset'](_0xe28f3c[_0xb9b9('0x32')]['offset']);}_0x1b53e1[_0xb9b9('0x3b')]=qs[_0xb9b9('0x3c')](_0xe28f3c[_0xb9b9('0x32')][_0xb9b9('0x3c')]);_0x1b53e1[_0xb9b9('0x3d')]=qs[_0xb9b9('0x34')](_[_0xb9b9('0x3e')](_0xe28f3c['query'],_0x31b509['filters']),_0x5eb860);if(_0xe28f3c[_0xb9b9('0x32')][_0xb9b9('0x3f')]){_0x1b53e1[_0xb9b9('0x3d')]=_['merge'](_0x1b53e1[_0xb9b9('0x3d')],{'$or':_['map'](_0x5eb860,function(_0x2778f9){if(_0x2778f9[_0xb9b9('0x30')]!==_0xb9b9('0x40')){var _0x21c1e4={};_0x21c1e4[_0x2778f9[_0xb9b9('0x2b')]]={'$like':'%'+_0xe28f3c[_0xb9b9('0x32')][_0xb9b9('0x3f')]+'%'};return _0x21c1e4;}})});}_0x1b53e1=_[_0xb9b9('0x41')]({},_0x1b53e1,_0xe28f3c[_0xb9b9('0x42')]);var _0x40058c={'where':_0x1b53e1['where']};return db[_0xb9b9('0x2e')][_0xb9b9('0x1e')](_0x40058c)[_0xb9b9('0x27')](function(_0x2e50fa){_0x17a6f6[_0xb9b9('0x1e')]=_0x2e50fa;if(_0xe28f3c[_0xb9b9('0x32')][_0xb9b9('0x43')]){_0x1b53e1[_0xb9b9('0x44')]=[{'all':!![]}];}return db[_0xb9b9('0x2e')][_0xb9b9('0x45')](_0x1b53e1);})['then'](function(_0x357b9c){_0x17a6f6[_0xb9b9('0x46')]=_0x357b9c;return _0x17a6f6;})[_0xb9b9('0x27')](respondWithFilteredResult(_0x4f47da,_0x1b53e1))[_0xb9b9('0x47')](handleError(_0x4f47da,null));};exports['show']=function(_0x46ccb7,_0x4eb97e){var _0x5b439e={'raw':!![],'where':{'id':_0x46ccb7[_0xb9b9('0x48')]['id']}},_0x3e374e={};_0x3e374e['model']=_['keys'](db[_0xb9b9('0x2e')][_0xb9b9('0x2f')]);_0x3e374e[_0xb9b9('0x32')]=_[_0xb9b9('0x33')](_0x46ccb7['query']);_0x3e374e[_0xb9b9('0x34')]=_[_0xb9b9('0x35')](_0x3e374e[_0xb9b9('0x36')],_0x3e374e['query']);_0x5b439e['attributes']=_[_0xb9b9('0x35')](_0x3e374e['model'],qs[_0xb9b9('0x37')](_0x46ccb7[_0xb9b9('0x32')][_0xb9b9('0x37')]));_0x5b439e[_0xb9b9('0x38')]=_0x5b439e['attributes'][_0xb9b9('0x39')]?_0x5b439e[_0xb9b9('0x38')]:_0x3e374e[_0xb9b9('0x36')];if(_0x46ccb7[_0xb9b9('0x32')][_0xb9b9('0x43')]){_0x5b439e[_0xb9b9('0x44')]=[{'all':!![]}];}_0x5b439e=_[_0xb9b9('0x41')]({},_0x5b439e,_0x46ccb7[_0xb9b9('0x42')]);return db[_0xb9b9('0x2e')][_0xb9b9('0x49')](_0x5b439e)[_0xb9b9('0x27')](handleEntityNotFound(_0x4eb97e,null))[_0xb9b9('0x27')](respondWithResult(_0x4eb97e,null))['catch'](handleError(_0x4eb97e,null));};exports[_0xb9b9('0x4a')]=function(_0x59f6e2,_0x8254f9){return db[_0xb9b9('0x2e')][_0xb9b9('0x4a')](_0x59f6e2[_0xb9b9('0x4b')],{})['then'](respondWithResult(_0x8254f9,0xc9))[_0xb9b9('0x47')](handleError(_0x8254f9,null));};exports['update']=function(_0x2b3e22,_0x576c06){if(_0x2b3e22[_0xb9b9('0x4b')]['id']){delete _0x2b3e22[_0xb9b9('0x4b')]['id'];}return db[_0xb9b9('0x2e')][_0xb9b9('0x49')]({'where':{'id':_0x2b3e22[_0xb9b9('0x48')]['id']}})[_0xb9b9('0x27')](handleEntityNotFound(_0x576c06,null))[_0xb9b9('0x27')](saveUpdates(_0x2b3e22[_0xb9b9('0x4b')],null))[_0xb9b9('0x27')](respondWithResult(_0x576c06,null))['catch'](handleError(_0x576c06,null));};exports['destroy']=function(_0x4da7d8,_0x124b54){return db['FaxQueueReport'][_0xb9b9('0x49')]({'where':{'id':_0x4da7d8[_0xb9b9('0x48')]['id']}})[_0xb9b9('0x27')](handleEntityNotFound(_0x124b54,null))[_0xb9b9('0x27')](removeEntity(_0x124b54,null))['catch'](handleError(_0x124b54,null));};exports[_0xb9b9('0x4c')]=function(_0x1f4e9a,_0x4f31cd){return db[_0xb9b9('0x2e')][_0xb9b9('0x4c')]()['then'](respondWithResult(_0x4f31cd,null))['catch'](handleError(_0x4f31cd,null));}; \ No newline at end of file +var _0xb4e6=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','update','then','end','error','stack','name','index','FaxQueueReport','rawAttributes','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filters','merge','where','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4688c6,_0x51fd26){var _0x3dc94a=function(_0x35be21){while(--_0x35be21){_0x4688c6['push'](_0x4688c6['shift']());}};_0x3dc94a(++_0x51fd26);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0xb4e6[_0x179e11];return _0x549f04;};'use strict';var emlformat=require(_0x6b4e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b4e('0x1'));var jsonpatch=require(_0x6b4e('0x2'));var rp=require(_0x6b4e('0x3'));var moment=require(_0x6b4e('0x4'));var BPromise=require(_0x6b4e('0x5'));var Mustache=require(_0x6b4e('0x6'));var util=require(_0x6b4e('0x7'));var path=require('path');var sox=require(_0x6b4e('0x8'));var csv=require(_0x6b4e('0x9'));var ejs=require(_0x6b4e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b4e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b4e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b4e('0xd'));var Papa=require(_0x6b4e('0xe'));var Redis=require(_0x6b4e('0xf'));var authService=require(_0x6b4e('0x10'));var qs=require(_0x6b4e('0x11'));var as=require(_0x6b4e('0x12'));var hardwareService=require(_0x6b4e('0x13'));var logger=require('../../config/logger')(_0x6b4e('0x14'));var utils=require(_0x6b4e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6b4e('0x16'));var db=require(_0x6b4e('0x17'))['db'];function respondWithStatusCode(_0x432399,_0x2b2ce0){_0x2b2ce0=_0x2b2ce0||0xcc;return function(_0x9f8f6c){if(_0x9f8f6c){return _0x432399[_0x6b4e('0x18')](_0x2b2ce0);}return _0x432399[_0x6b4e('0x19')](_0x2b2ce0)['end']();};}function respondWithResult(_0x36f8a5,_0x29bdee){_0x29bdee=_0x29bdee||0xc8;return function(_0x4788cf){if(_0x4788cf){return _0x36f8a5[_0x6b4e('0x19')](_0x29bdee)['json'](_0x4788cf);}};}function respondWithFilteredResult(_0x355f10,_0x2195c1){return function(_0x3ba513){if(_0x3ba513){var _0x42e265=typeof _0x2195c1[_0x6b4e('0x1a')]===_0x6b4e('0x1b')&&typeof _0x2195c1['limit']==='undefined';var _0x67496d=_0x3ba513[_0x6b4e('0x1c')];var _0x10d2b1=_0x42e265?0x0:_0x2195c1[_0x6b4e('0x1a')];var _0x101d0a=_0x42e265?_0x3ba513[_0x6b4e('0x1c')]:_0x2195c1[_0x6b4e('0x1a')]+_0x2195c1[_0x6b4e('0x1d')];var _0x35aee1;if(_0x101d0a>=_0x67496d){_0x101d0a=_0x67496d;_0x35aee1=0xc8;}else{_0x35aee1=0xce;}_0x355f10[_0x6b4e('0x19')](_0x35aee1);return _0x355f10[_0x6b4e('0x1e')]('Content-Range',_0x10d2b1+'-'+_0x101d0a+'/'+_0x67496d)[_0x6b4e('0x1f')](_0x3ba513);}return null;};}function patchUpdates(_0x248fea){return function(_0x31fb9d){try{jsonpatch[_0x6b4e('0x20')](_0x31fb9d,_0x248fea,!![]);}catch(_0x5e5dcd){return BPromise[_0x6b4e('0x21')](_0x5e5dcd);}return _0x31fb9d['save']();};}function saveUpdates(_0x2503a5,_0x163dea){return function(_0x165a99){if(_0x165a99){return _0x165a99[_0x6b4e('0x22')](_0x2503a5)[_0x6b4e('0x23')](function(_0x346566){return _0x346566;});}return null;};}function removeEntity(_0x3e636f,_0x5c33be){return function(_0x2e36db){if(_0x2e36db){return _0x2e36db['destroy']()[_0x6b4e('0x23')](function(){_0x3e636f[_0x6b4e('0x19')](0xcc)[_0x6b4e('0x24')]();});}};}function handleEntityNotFound(_0xdba4fe,_0x4ec9cc){return function(_0xec7d35){if(!_0xec7d35){_0xdba4fe[_0x6b4e('0x18')](0x194);}return _0xec7d35;};}function handleError(_0x4e217c,_0x32102f){_0x32102f=_0x32102f||0x1f4;return function(_0x381ff0){logger[_0x6b4e('0x25')](_0x381ff0[_0x6b4e('0x26')]);if(_0x381ff0['name']){delete _0x381ff0[_0x6b4e('0x27')];}_0x4e217c[_0x6b4e('0x19')](_0x32102f)['send'](_0x381ff0);};}exports[_0x6b4e('0x28')]=function(_0x453beb,_0x2f1129){var _0x143de5={},_0x4a6c90={},_0x445278={'count':0x0,'rows':[]};var _0x4007b6=_['map'](db[_0x6b4e('0x29')][_0x6b4e('0x2a')],function(_0x37b636){return{'name':_0x37b636['fieldName'],'type':_0x37b636['type'][_0x6b4e('0x2b')]};});_0x4a6c90[_0x6b4e('0x2c')]=_[_0x6b4e('0x2d')](_0x4007b6,'name');_0x4a6c90[_0x6b4e('0x2e')]=_[_0x6b4e('0x2f')](_0x453beb[_0x6b4e('0x2e')]);_0x4a6c90['filters']=_['intersection'](_0x4a6c90[_0x6b4e('0x2c')],_0x4a6c90['query']);_0x143de5[_0x6b4e('0x30')]=_[_0x6b4e('0x31')](_0x4a6c90['model'],qs[_0x6b4e('0x32')](_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x32')]));_0x143de5[_0x6b4e('0x30')]=_0x143de5['attributes']['length']?_0x143de5[_0x6b4e('0x30')]:_0x4a6c90[_0x6b4e('0x2c')];if(!_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x33')](_0x6b4e('0x34'))){_0x143de5[_0x6b4e('0x1d')]=qs[_0x6b4e('0x1d')](_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x1d')]);_0x143de5[_0x6b4e('0x1a')]=qs[_0x6b4e('0x1a')](_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x1a')]);}_0x143de5['order']=qs[_0x6b4e('0x35')](_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x35')]);_0x143de5['where']=qs[_0x6b4e('0x36')](_['pick'](_0x453beb[_0x6b4e('0x2e')],_0x4a6c90[_0x6b4e('0x36')]),_0x4007b6);if(_0x453beb[_0x6b4e('0x2e')]['filter']){_0x143de5['where']=_[_0x6b4e('0x37')](_0x143de5[_0x6b4e('0x38')],{'$or':_['map'](_0x4007b6,function(_0x4d61dc){if(_0x4d61dc[_0x6b4e('0x39')]!==_0x6b4e('0x3a')){var _0x303507={};_0x303507[_0x4d61dc[_0x6b4e('0x27')]]={'$like':'%'+_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x3b')]+'%'};return _0x303507;}})});}_0x143de5=_[_0x6b4e('0x37')]({},_0x143de5,_0x453beb[_0x6b4e('0x3c')]);var _0x2faf8d={'where':_0x143de5[_0x6b4e('0x38')]};return db[_0x6b4e('0x29')]['count'](_0x2faf8d)[_0x6b4e('0x23')](function(_0x5516e7){_0x445278['count']=_0x5516e7;if(_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x3d')]){_0x143de5[_0x6b4e('0x3e')]=[{'all':!![]}];}return db[_0x6b4e('0x29')][_0x6b4e('0x3f')](_0x143de5);})['then'](function(_0x4e545c){_0x445278[_0x6b4e('0x40')]=_0x4e545c;return _0x445278;})['then'](respondWithFilteredResult(_0x2f1129,_0x143de5))[_0x6b4e('0x41')](handleError(_0x2f1129,null));};exports[_0x6b4e('0x42')]=function(_0x4d8227,_0xf70c24){var _0x50f0e7={'raw':!![],'where':{'id':_0x4d8227['params']['id']}},_0x3dec0f={};_0x3dec0f[_0x6b4e('0x2c')]=_[_0x6b4e('0x2f')](db[_0x6b4e('0x29')][_0x6b4e('0x2a')]);_0x3dec0f['query']=_[_0x6b4e('0x2f')](_0x4d8227[_0x6b4e('0x2e')]);_0x3dec0f[_0x6b4e('0x36')]=_['intersection'](_0x3dec0f[_0x6b4e('0x2c')],_0x3dec0f[_0x6b4e('0x2e')]);_0x50f0e7[_0x6b4e('0x30')]=_[_0x6b4e('0x31')](_0x3dec0f[_0x6b4e('0x2c')],qs[_0x6b4e('0x32')](_0x4d8227[_0x6b4e('0x2e')][_0x6b4e('0x32')]));_0x50f0e7[_0x6b4e('0x30')]=_0x50f0e7['attributes'][_0x6b4e('0x43')]?_0x50f0e7[_0x6b4e('0x30')]:_0x3dec0f[_0x6b4e('0x2c')];if(_0x4d8227[_0x6b4e('0x2e')][_0x6b4e('0x3d')]){_0x50f0e7['include']=[{'all':!![]}];}_0x50f0e7=_[_0x6b4e('0x37')]({},_0x50f0e7,_0x4d8227['options']);return db[_0x6b4e('0x29')][_0x6b4e('0x44')](_0x50f0e7)[_0x6b4e('0x23')](handleEntityNotFound(_0xf70c24,null))[_0x6b4e('0x23')](respondWithResult(_0xf70c24,null))['catch'](handleError(_0xf70c24,null));};exports[_0x6b4e('0x45')]=function(_0x46467e,_0x1d0eb3){return db['FaxQueueReport'][_0x6b4e('0x45')](_0x46467e[_0x6b4e('0x46')],{})[_0x6b4e('0x23')](respondWithResult(_0x1d0eb3,0xc9))[_0x6b4e('0x41')](handleError(_0x1d0eb3,null));};exports[_0x6b4e('0x22')]=function(_0x33c797,_0x289dfa){if(_0x33c797[_0x6b4e('0x46')]['id']){delete _0x33c797[_0x6b4e('0x46')]['id'];}return db[_0x6b4e('0x29')]['find']({'where':{'id':_0x33c797[_0x6b4e('0x47')]['id']}})[_0x6b4e('0x23')](handleEntityNotFound(_0x289dfa,null))[_0x6b4e('0x23')](saveUpdates(_0x33c797['body'],null))[_0x6b4e('0x23')](respondWithResult(_0x289dfa,null))[_0x6b4e('0x41')](handleError(_0x289dfa,null));};exports[_0x6b4e('0x48')]=function(_0x738ee5,_0x73c6be){return db[_0x6b4e('0x29')][_0x6b4e('0x44')]({'where':{'id':_0x738ee5[_0x6b4e('0x47')]['id']}})[_0x6b4e('0x23')](handleEntityNotFound(_0x73c6be,null))[_0x6b4e('0x23')](removeEntity(_0x73c6be,null))[_0x6b4e('0x41')](handleError(_0x73c6be,null));};exports['describe']=function(_0x4e183b,_0x2e67cd){return db[_0x6b4e('0x29')][_0x6b4e('0x49')]()[_0x6b4e('0x23')](respondWithResult(_0x2e67cd,null))['catch'](handleError(_0x2e67cd,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index e8b9b13..322f11d 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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x30eb66,_0x3f51a8){var _0x3b53a0=function(_0x29ed12){while(--_0x29ed12){_0x30eb66['push'](_0x30eb66['shift']());}};_0x3b53a0(++_0x3f51a8);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4bd67a,_0x4f9725){_0x4bd67a=_0x4bd67a-0x0;var _0x2be5fb=_0x7fbe[_0x4bd67a];return _0x2be5fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4dda23,_0x5240d1){var _0x3a90e0=function(_0x4099ff){while(--_0x4099ff){_0x4dda23['push'](_0x4dda23['shift']());}};_0x3a90e0(++_0x5240d1);}(_0x4975,0x86));var _0x5497=function(_0x4cc74f,_0x4b18ee){_0x4cc74f=_0x4cc74f-0x0;var _0x2554a7=_0x4975[_0x4cc74f];return _0x2554a7;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('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 66cc446..dcc5c4a 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 _0xfc49=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x745cf6,_0xd10e2a){var _0x171179=function(_0xe6f6d3){while(--_0xe6f6d3){_0x745cf6['push'](_0x745cf6['shift']());}};_0x171179(++_0xd10e2a);}(_0xfc49,0x15c));var _0x9fc4=function(_0x2a2a4f,_0x1bf011){_0x2a2a4f=_0x2a2a4f-0x0;var _0x14ffc0=_0xfc49[_0x2a2a4f];return _0x14ffc0;};'use strict';var _=require(_0x9fc4('0x0'));var util=require(_0x9fc4('0x1'));var moment=require(_0x9fc4('0x2'));var BPromise=require(_0x9fc4('0x3'));var rs=require(_0x9fc4('0x4'));var fs=require('fs');var Redis=require(_0x9fc4('0x5'));var db=require(_0x9fc4('0x6'))['db'];var utils=require(_0x9fc4('0x7'));var logger=require(_0x9fc4('0x8'))(_0x9fc4('0x9'));var config=require(_0x9fc4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9fc4('0xb')][_0x9fc4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e8e93,_0xebc391,_0x954586){return new BPromise(function(_0x1b9bb4,_0x505e00){return client['request'](_0x1e8e93,_0x954586)['then'](function(_0x1fea7d){logger['info'](_0x9fc4('0xd'),_0xebc391,_0x9fc4('0xe'));logger[_0x9fc4('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0xebc391,_0x9fc4('0xe'),JSON[_0x9fc4('0x10')](_0x1fea7d));if(_0x1fea7d[_0x9fc4('0x11')]){if(_0x1fea7d[_0x9fc4('0x11')]['code']===0x1f4){logger[_0x9fc4('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0xebc391,_0x1fea7d[_0x9fc4('0x11')][_0x9fc4('0x12')]);return _0x505e00(_0x1fea7d[_0x9fc4('0x11')][_0x9fc4('0x12')]);}logger['error'](_0x9fc4('0xd'),_0xebc391,_0x1fea7d[_0x9fc4('0x11')][_0x9fc4('0x12')]);return _0x1b9bb4(_0x1fea7d[_0x9fc4('0x11')][_0x9fc4('0x12')]);}else{logger[_0x9fc4('0x13')](_0x9fc4('0xd'),_0xebc391,'request\x20sent');_0x1b9bb4(_0x1fea7d['result'][_0x9fc4('0x12')]);}})['catch'](function(_0x5f2a14){logger[_0x9fc4('0x11')](_0x9fc4('0xd'),_0xebc391,_0x5f2a14);_0x505e00(_0x5f2a14);});});}exports[_0x9fc4('0x14')]=function(_0x4ca49b){var _0x1fa641=this;return new Promise(function(_0x5f0f9d,_0x37f9d2){return db[_0x9fc4('0x15')][_0x9fc4('0x16')](_0x4ca49b[_0x9fc4('0x17')],{'raw':_0x4ca49b['options']?_0x4ca49b[_0x9fc4('0x18')][_0x9fc4('0x19')]===undefined?!![]:![]:!![]})[_0x9fc4('0x1a')](function(_0x42b22e){logger[_0x9fc4('0x13')](_0x9fc4('0x14'),_0x4ca49b);logger[_0x9fc4('0xf')](_0x9fc4('0x14'),_0x4ca49b,JSON[_0x9fc4('0x10')](_0x42b22e));_0x5f0f9d(_0x42b22e);})['catch'](function(_0x3aaf0e){logger[_0x9fc4('0x11')](_0x9fc4('0x14'),_0x3aaf0e['message'],_0x4ca49b);_0x37f9d2(_0x1fa641[_0x9fc4('0x11')](0x1f4,_0x3aaf0e[_0x9fc4('0x12')]));});});};exports[_0x9fc4('0x1b')]=function(_0x1746ed){var _0x2aefc0=this;return new Promise(function(_0x550cdb,_0x4fe61d){return db[_0x9fc4('0x15')][_0x9fc4('0x1c')](_0x1746ed['body'],{'raw':_0x1746ed[_0x9fc4('0x18')]?_0x1746ed[_0x9fc4('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1746ed[_0x9fc4('0x18')]?_0x1746ed['options'][_0x9fc4('0x1d')]||null:null,'attributes':_0x1746ed['options']?_0x1746ed[_0x9fc4('0x18')][_0x9fc4('0x1e')]||null:null,'limit':_0x1746ed[_0x9fc4('0x18')]?_0x1746ed['options'][_0x9fc4('0x1f')]||null:null})['then'](function(_0x29d9a8){logger[_0x9fc4('0x13')](_0x9fc4('0x1b'),_0x1746ed);logger[_0x9fc4('0xf')](_0x9fc4('0x1b'),_0x1746ed,JSON['stringify'](_0x29d9a8));_0x550cdb(_0x29d9a8);})['catch'](function(_0x167a7b){logger[_0x9fc4('0x11')](_0x9fc4('0x1b'),_0x167a7b[_0x9fc4('0x12')],_0x1746ed);_0x4fe61d(_0x2aefc0['error'](0x1f4,_0x167a7b['message']));});});}; \ No newline at end of file +var _0xd109=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','info','result','catch','FaxQueueReport','create','options','CreateFaxQueueReport','UpdateFaxQueueReport','update','body','raw','where','attributes','limit','lodash','util','moment'];(function(_0x201715,_0x445f6c){var _0x56008a=function(_0x538d32){while(--_0x538d32){_0x201715['push'](_0x201715['shift']());}};_0x56008a(++_0x445f6c);}(_0xd109,0x19d));var _0x9d10=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd109[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x9d10('0x0'));var util=require(_0x9d10('0x1'));var moment=require(_0x9d10('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d10('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d10('0x5'))(_0x9d10('0x6'));var config=require('../../config/environment');var jayson=require(_0x9d10('0x7'));var client=jayson['client'][_0x9d10('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35882d,_0x923de0,_0x3a474c){return new BPromise(function(_0x374fc2,_0x5ae044){return client[_0x9d10('0x9')](_0x35882d,_0x3a474c)[_0x9d10('0xa')](function(_0x2b71b1){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x923de0,_0x9d10('0xb'));logger[_0x9d10('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x923de0,_0x9d10('0xb'),JSON[_0x9d10('0xd')](_0x2b71b1));if(_0x2b71b1[_0x9d10('0xe')]){if(_0x2b71b1['error'][_0x9d10('0xf')]===0x1f4){logger[_0x9d10('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x923de0,_0x2b71b1[_0x9d10('0xe')][_0x9d10('0x10')]);return _0x5ae044(_0x2b71b1['error'][_0x9d10('0x10')]);}logger[_0x9d10('0xe')](_0x9d10('0x11'),_0x923de0,_0x2b71b1[_0x9d10('0xe')][_0x9d10('0x10')]);return _0x374fc2(_0x2b71b1[_0x9d10('0xe')]['message']);}else{logger[_0x9d10('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x923de0,_0x9d10('0xb'));_0x374fc2(_0x2b71b1[_0x9d10('0x13')][_0x9d10('0x10')]);}})[_0x9d10('0x14')](function(_0x34410c){logger['error'](_0x9d10('0x11'),_0x923de0,_0x34410c);_0x5ae044(_0x34410c);});});}exports['CreateFaxQueueReport']=function(_0x41d600){var _0x53f3aa=this;return new Promise(function(_0x2e99c8,_0x3372c6){return db[_0x9d10('0x15')][_0x9d10('0x16')](_0x41d600['body'],{'raw':_0x41d600[_0x9d10('0x17')]?_0x41d600[_0x9d10('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x500c0a){logger[_0x9d10('0x12')](_0x9d10('0x18'),_0x41d600);logger[_0x9d10('0xc')](_0x9d10('0x18'),_0x41d600,JSON['stringify'](_0x500c0a));_0x2e99c8(_0x500c0a);})[_0x9d10('0x14')](function(_0xb0016c){logger['error'](_0x9d10('0x18'),_0xb0016c[_0x9d10('0x10')],_0x41d600);_0x3372c6(_0x53f3aa[_0x9d10('0xe')](0x1f4,_0xb0016c[_0x9d10('0x10')]));});});};exports[_0x9d10('0x19')]=function(_0x403cc2){var _0x358265=this;return new Promise(function(_0x1c435f,_0x44dbf6){return db['FaxQueueReport'][_0x9d10('0x1a')](_0x403cc2[_0x9d10('0x1b')],{'raw':_0x403cc2[_0x9d10('0x17')]?_0x403cc2[_0x9d10('0x17')][_0x9d10('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x403cc2[_0x9d10('0x17')]?_0x403cc2[_0x9d10('0x17')][_0x9d10('0x1d')]||null:null,'attributes':_0x403cc2[_0x9d10('0x17')]?_0x403cc2[_0x9d10('0x17')][_0x9d10('0x1e')]||null:null,'limit':_0x403cc2[_0x9d10('0x17')]?_0x403cc2[_0x9d10('0x17')][_0x9d10('0x1f')]||null:null})[_0x9d10('0xa')](function(_0x45d8ad){logger[_0x9d10('0x12')](_0x9d10('0x19'),_0x403cc2);logger['debug'](_0x9d10('0x19'),_0x403cc2,JSON[_0x9d10('0xd')](_0x45d8ad));_0x1c435f(_0x45d8ad);})[_0x9d10('0x14')](function(_0x447a27){logger['error'](_0x9d10('0x19'),_0x447a27['message'],_0x403cc2);_0x44dbf6(_0x358265[_0x9d10('0xe')](0x1f4,_0x447a27['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 0fb4588..b777568 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 _0x1614=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','util','path','Router','fs-extra'];(function(_0x36ff47,_0x3a2082){var _0x425663=function(_0x105a20){while(--_0x105a20){_0x36ff47['push'](_0x36ff47['shift']());}};_0x425663(++_0x3a2082);}(_0x1614,0xe6));var _0x4161=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x1614[_0x179e11];return _0x549f04;};'use strict';var multer=require('multer');var util=require(_0x4161('0x0'));var path=require(_0x4161('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4161('0x2')]();var fs_extra=require(_0x4161('0x3'));var auth=require(_0x4161('0x4'));var interaction=require(_0x4161('0x5'));var config=require(_0x4161('0x6'));var controller=require(_0x4161('0x7'));router[_0x4161('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4161('0x8')]('/describe',auth[_0x4161('0x9')](),controller['describe']);router['get'](_0x4161('0xa'),auth[_0x4161('0x9')](),controller[_0x4161('0xb')]);router[_0x4161('0xc')]('/',auth[_0x4161('0x9')](),controller[_0x4161('0xd')]);router[_0x4161('0xe')]('/:id',auth[_0x4161('0x9')](),controller['update']);router[_0x4161('0xf')](_0x4161('0xa'),auth['isAuthenticated'](),controller[_0x4161('0x10')]);module[_0x4161('0x11')]=router; \ No newline at end of file +var _0x1858=['post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x2ce596,_0x10313b){var _0x2e65a4=function(_0x2f6e17){while(--_0x2f6e17){_0x2ce596['push'](_0x2ce596['shift']());}};_0x2e65a4(++_0x10313b);}(_0x1858,0x1e8));var _0x8185=function(_0x45e3ce,_0x416ceb){_0x45e3ce=_0x45e3ce-0x0;var _0xef3d06=_0x1858[_0x45e3ce];return _0xef3d06;};'use strict';var multer=require(_0x8185('0x0'));var util=require(_0x8185('0x1'));var path=require(_0x8185('0x2'));var timeout=require(_0x8185('0x3'));var express=require(_0x8185('0x4'));var router=express[_0x8185('0x5')]();var fs_extra=require(_0x8185('0x6'));var auth=require(_0x8185('0x7'));var interaction=require(_0x8185('0x8'));var config=require(_0x8185('0x9'));var controller=require(_0x8185('0xa'));router[_0x8185('0xb')]('/',auth[_0x8185('0xc')](),controller['index']);router[_0x8185('0xb')]('/describe',auth[_0x8185('0xc')](),controller[_0x8185('0xd')]);router[_0x8185('0xb')](_0x8185('0xe'),auth[_0x8185('0xc')](),controller[_0x8185('0xf')]);router[_0x8185('0x10')]('/',auth[_0x8185('0xc')](),controller[_0x8185('0x11')]);router['put'](_0x8185('0xe'),auth[_0x8185('0xc')](),controller[_0x8185('0x12')]);router['delete'](_0x8185('0xe'),auth[_0x8185('0xc')](),controller[_0x8185('0x13')]);module[_0x8185('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 367a662..805a519 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x20daa9,_0x40487e){var _0x550698=function(_0x131ef8){while(--_0x131ef8){_0x20daa9['push'](_0x20daa9['shift']());}};_0x550698(++_0x40487e);}(_0x70e0,0x17b));var _0x070e=function(_0x9425d7,_0x220b32){_0x9425d7=_0x9425d7-0x0;var _0xc2a49=_0x70e0[_0x9425d7];return _0xc2a49;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x5c31dc,_0x4a598f){var _0x2f48c2=function(_0x182653){while(--_0x182653){_0x5c31dc['push'](_0x5c31dc['shift']());}};_0x2f48c2(++_0x4a598f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0xf3cd[_0x17784a];return _0x41aded;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index ed01689..09ee953 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 _0x9b84=['fieldName','key','model','keys','filters','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','intersection','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','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','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','map','FaxTransferReport','rawAttributes'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x9b84,0x149));var _0x49b8=function(_0x401d67,_0xeb1592){_0x401d67=_0x401d67-0x0;var _0x25076b=_0x9b84[_0x401d67];return _0x25076b;};'use strict';var emlformat=require(_0x49b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49b8('0x1'));var jsonpatch=require(_0x49b8('0x2'));var rp=require(_0x49b8('0x3'));var moment=require(_0x49b8('0x4'));var BPromise=require(_0x49b8('0x5'));var Mustache=require(_0x49b8('0x6'));var util=require(_0x49b8('0x7'));var path=require('path');var sox=require(_0x49b8('0x8'));var csv=require(_0x49b8('0x9'));var ejs=require(_0x49b8('0xa'));var fs=require('fs');var fs_extra=require(_0x49b8('0xb'));var _=require(_0x49b8('0xc'));var squel=require(_0x49b8('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x49b8('0xe'));var toCsv=require(_0x49b8('0x9'));var querystring=require(_0x49b8('0xf'));var Papa=require('papaparse');var Redis=require(_0x49b8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x49b8('0x11'));var as=require(_0x49b8('0x12'));var hardwareService=require(_0x49b8('0x13'));var logger=require(_0x49b8('0x14'))(_0x49b8('0x15'));var utils=require(_0x49b8('0x16'));var config=require(_0x49b8('0x17'));var licenseUtil=require(_0x49b8('0x18'));var db=require(_0x49b8('0x19'))['db'];function respondWithStatusCode(_0x418ef4,_0x1d14b8){_0x1d14b8=_0x1d14b8||0xcc;return function(_0x553b6f){if(_0x553b6f){return _0x418ef4[_0x49b8('0x1a')](_0x1d14b8);}return _0x418ef4['status'](_0x1d14b8)['end']();};}function respondWithResult(_0x2e342a,_0x6d64ce){_0x6d64ce=_0x6d64ce||0xc8;return function(_0xdcef5c){if(_0xdcef5c){return _0x2e342a['status'](_0x6d64ce)['json'](_0xdcef5c);}};}function respondWithFilteredResult(_0x50477c,_0x272cd0){return function(_0xbd96f4){if(_0xbd96f4){var _0x397989=typeof _0x272cd0[_0x49b8('0x1b')]===_0x49b8('0x1c')&&typeof _0x272cd0[_0x49b8('0x1d')]==='undefined';var _0x5145b9=_0xbd96f4[_0x49b8('0x1e')];var _0x41a715=_0x397989?0x0:_0x272cd0[_0x49b8('0x1b')];var _0x2af9a4=_0x397989?_0xbd96f4[_0x49b8('0x1e')]:_0x272cd0[_0x49b8('0x1b')]+_0x272cd0['limit'];var _0x2b6a7a;if(_0x2af9a4>=_0x5145b9){_0x2af9a4=_0x5145b9;_0x2b6a7a=0xc8;}else{_0x2b6a7a=0xce;}_0x50477c['status'](_0x2b6a7a);return _0x50477c[_0x49b8('0x1f')](_0x49b8('0x20'),_0x41a715+'-'+_0x2af9a4+'/'+_0x5145b9)['json'](_0xbd96f4);}return null;};}function patchUpdates(_0x54c4e8){return function(_0xd3fe39){try{jsonpatch[_0x49b8('0x21')](_0xd3fe39,_0x54c4e8,!![]);}catch(_0x11ae97){return BPromise[_0x49b8('0x22')](_0x11ae97);}return _0xd3fe39[_0x49b8('0x23')]();};}function saveUpdates(_0x3af207,_0x25fd71){return function(_0x3556fb){if(_0x3556fb){return _0x3556fb[_0x49b8('0x24')](_0x3af207)[_0x49b8('0x25')](function(_0x28395d){return _0x28395d;});}return null;};}function removeEntity(_0x1fd852,_0x2a2fa1){return function(_0xa9a948){if(_0xa9a948){return _0xa9a948['destroy']()[_0x49b8('0x25')](function(){_0x1fd852['status'](0xcc)[_0x49b8('0x26')]();});}};}function handleEntityNotFound(_0x49a135,_0x5935d9){return function(_0x1cc5ce){if(!_0x1cc5ce){_0x49a135[_0x49b8('0x1a')](0x194);}return _0x1cc5ce;};}function handleError(_0x58dd04,_0x2d4252){_0x2d4252=_0x2d4252||0x1f4;return function(_0x4609ce){logger[_0x49b8('0x27')](_0x4609ce['stack']);if(_0x4609ce[_0x49b8('0x28')]){delete _0x4609ce[_0x49b8('0x28')];}_0x58dd04['status'](_0x2d4252)[_0x49b8('0x29')](_0x4609ce);};}exports[_0x49b8('0x2a')]=function(_0x18c097,_0x4f9346){var _0x3aa529={},_0x1ee2e9={},_0x54d13d={'count':0x0,'rows':[]};var _0x37e96e=_[_0x49b8('0x2b')](db[_0x49b8('0x2c')][_0x49b8('0x2d')],function(_0x3c8f4f){return{'name':_0x3c8f4f[_0x49b8('0x2e')],'type':_0x3c8f4f['type'][_0x49b8('0x2f')]};});_0x1ee2e9[_0x49b8('0x30')]=_[_0x49b8('0x2b')](_0x37e96e,_0x49b8('0x28'));_0x1ee2e9['query']=_[_0x49b8('0x31')](_0x18c097['query']);_0x1ee2e9[_0x49b8('0x32')]=_['intersection'](_0x1ee2e9[_0x49b8('0x30')],_0x1ee2e9[_0x49b8('0x33')]);_0x3aa529['attributes']=_['intersection'](_0x1ee2e9[_0x49b8('0x30')],qs[_0x49b8('0x34')](_0x18c097[_0x49b8('0x33')][_0x49b8('0x34')]));_0x3aa529[_0x49b8('0x35')]=_0x3aa529[_0x49b8('0x35')][_0x49b8('0x36')]?_0x3aa529[_0x49b8('0x35')]:_0x1ee2e9[_0x49b8('0x30')];if(!_0x18c097[_0x49b8('0x33')][_0x49b8('0x37')]('nolimit')){_0x3aa529['limit']=qs[_0x49b8('0x1d')](_0x18c097[_0x49b8('0x33')]['limit']);_0x3aa529[_0x49b8('0x1b')]=qs[_0x49b8('0x1b')](_0x18c097[_0x49b8('0x33')]['offset']);}_0x3aa529[_0x49b8('0x38')]=qs[_0x49b8('0x39')](_0x18c097[_0x49b8('0x33')]['sort']);_0x3aa529[_0x49b8('0x3a')]=qs[_0x49b8('0x32')](_[_0x49b8('0x3b')](_0x18c097['query'],_0x1ee2e9['filters']),_0x37e96e);if(_0x18c097[_0x49b8('0x33')][_0x49b8('0x3c')]){_0x3aa529[_0x49b8('0x3a')]=_[_0x49b8('0x3d')](_0x3aa529[_0x49b8('0x3a')],{'$or':_[_0x49b8('0x2b')](_0x37e96e,function(_0x14a159){if(_0x14a159['type']!==_0x49b8('0x3e')){var _0x4f75ce={};_0x4f75ce[_0x14a159[_0x49b8('0x28')]]={'$like':'%'+_0x18c097[_0x49b8('0x33')][_0x49b8('0x3c')]+'%'};return _0x4f75ce;}})});}_0x3aa529=_[_0x49b8('0x3d')]({},_0x3aa529,_0x18c097[_0x49b8('0x3f')]);var _0x4ce5d1={'where':_0x3aa529[_0x49b8('0x3a')]};return db['FaxTransferReport'][_0x49b8('0x1e')](_0x4ce5d1)[_0x49b8('0x25')](function(_0x3290c8){_0x54d13d[_0x49b8('0x1e')]=_0x3290c8;if(_0x18c097[_0x49b8('0x33')][_0x49b8('0x40')]){_0x3aa529['include']=[{'all':!![]}];}return db[_0x49b8('0x2c')]['findAll'](_0x3aa529);})[_0x49b8('0x25')](function(_0x3fbc7c){_0x54d13d[_0x49b8('0x41')]=_0x3fbc7c;return _0x54d13d;})[_0x49b8('0x25')](respondWithFilteredResult(_0x4f9346,_0x3aa529))[_0x49b8('0x42')](handleError(_0x4f9346,null));};exports[_0x49b8('0x43')]=function(_0x1e08ce,_0x35c378){var _0x266517={'raw':!![],'where':{'id':_0x1e08ce[_0x49b8('0x44')]['id']}},_0x187803={};_0x187803[_0x49b8('0x30')]=_[_0x49b8('0x31')](db[_0x49b8('0x2c')][_0x49b8('0x2d')]);_0x187803['query']=_[_0x49b8('0x31')](_0x1e08ce[_0x49b8('0x33')]);_0x187803[_0x49b8('0x32')]=_[_0x49b8('0x45')](_0x187803[_0x49b8('0x30')],_0x187803[_0x49b8('0x33')]);_0x266517[_0x49b8('0x35')]=_[_0x49b8('0x45')](_0x187803[_0x49b8('0x30')],qs[_0x49b8('0x34')](_0x1e08ce[_0x49b8('0x33')]['fields']));_0x266517[_0x49b8('0x35')]=_0x266517[_0x49b8('0x35')][_0x49b8('0x36')]?_0x266517[_0x49b8('0x35')]:_0x187803[_0x49b8('0x30')];if(_0x1e08ce[_0x49b8('0x33')][_0x49b8('0x40')]){_0x266517[_0x49b8('0x46')]=[{'all':!![]}];}_0x266517=_[_0x49b8('0x3d')]({},_0x266517,_0x1e08ce[_0x49b8('0x3f')]);return db[_0x49b8('0x2c')][_0x49b8('0x47')](_0x266517)['then'](handleEntityNotFound(_0x35c378,null))[_0x49b8('0x25')](respondWithResult(_0x35c378,null))['catch'](handleError(_0x35c378,null));};exports[_0x49b8('0x48')]=function(_0x27f2aa,_0x27cae3){return db[_0x49b8('0x2c')]['create'](_0x27f2aa[_0x49b8('0x49')],{})[_0x49b8('0x25')](respondWithResult(_0x27cae3,0xc9))[_0x49b8('0x42')](handleError(_0x27cae3,null));};exports[_0x49b8('0x24')]=function(_0x55b94d,_0x2b0892){if(_0x55b94d['body']['id']){delete _0x55b94d['body']['id'];}return db[_0x49b8('0x2c')][_0x49b8('0x47')]({'where':{'id':_0x55b94d[_0x49b8('0x44')]['id']}})[_0x49b8('0x25')](handleEntityNotFound(_0x2b0892,null))[_0x49b8('0x25')](saveUpdates(_0x55b94d[_0x49b8('0x49')],null))[_0x49b8('0x25')](respondWithResult(_0x2b0892,null))[_0x49b8('0x42')](handleError(_0x2b0892,null));};exports['destroy']=function(_0x54a1bc,_0x5930a5){return db['FaxTransferReport'][_0x49b8('0x47')]({'where':{'id':_0x54a1bc['params']['id']}})['then'](handleEntityNotFound(_0x5930a5,null))['then'](removeEntity(_0x5930a5,null))[_0x49b8('0x42')](handleError(_0x5930a5,null));};exports[_0x49b8('0x4a')]=function(_0x276b0b,_0x7797db){return db[_0x49b8('0x2c')][_0x49b8('0x4a')]()[_0x49b8('0x25')](respondWithResult(_0x7797db,null))[_0x49b8('0x42')](handleError(_0x7797db,null));}; \ No newline at end of file +var _0xf19c=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','then','destroy','error','name','index','map','FaxTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','rawAttributes','include','find','create','body','catch','update','params','describe','zip-dir','request-promise','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'];(function(_0x322bef,_0x4890d4){var _0x229e60=function(_0x45f89b){while(--_0x45f89b){_0x322bef['push'](_0x322bef['shift']());}};_0x229e60(++_0x4890d4);}(_0xf19c,0x11b));var _0xcf19=function(_0x409ed5,_0x1fad5f){_0x409ed5=_0x409ed5-0x0;var _0x3de2c5=_0xf19c[_0x409ed5];return _0x3de2c5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcf19('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf19('0x1'));var moment=require(_0xcf19('0x2'));var BPromise=require(_0xcf19('0x3'));var Mustache=require(_0xcf19('0x4'));var util=require(_0xcf19('0x5'));var path=require(_0xcf19('0x6'));var sox=require(_0xcf19('0x7'));var csv=require(_0xcf19('0x8'));var ejs=require(_0xcf19('0x9'));var fs=require('fs');var fs_extra=require(_0xcf19('0xa'));var _=require(_0xcf19('0xb'));var squel=require(_0xcf19('0xc'));var crypto=require('crypto');var jsforce=require(_0xcf19('0xd'));var deskjs=require(_0xcf19('0xe'));var toCsv=require(_0xcf19('0x8'));var querystring=require(_0xcf19('0xf'));var Papa=require(_0xcf19('0x10'));var Redis=require(_0xcf19('0x11'));var authService=require(_0xcf19('0x12'));var qs=require(_0xcf19('0x13'));var as=require(_0xcf19('0x14'));var hardwareService=require(_0xcf19('0x15'));var logger=require(_0xcf19('0x16'))('api');var utils=require(_0xcf19('0x17'));var config=require(_0xcf19('0x18'));var licenseUtil=require(_0xcf19('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc108b0,_0x2a9d9a){_0x2a9d9a=_0x2a9d9a||0xcc;return function(_0x3bc40f){if(_0x3bc40f){return _0xc108b0['sendStatus'](_0x2a9d9a);}return _0xc108b0['status'](_0x2a9d9a)[_0xcf19('0x1a')]();};}function respondWithResult(_0x82d6c7,_0xca3e2c){_0xca3e2c=_0xca3e2c||0xc8;return function(_0x57fec5){if(_0x57fec5){return _0x82d6c7[_0xcf19('0x1b')](_0xca3e2c)['json'](_0x57fec5);}};}function respondWithFilteredResult(_0x3ce77c,_0x5adf2f){return function(_0x4ff469){if(_0x4ff469){var _0x169f04=typeof _0x5adf2f['offset']===_0xcf19('0x1c')&&typeof _0x5adf2f[_0xcf19('0x1d')]===_0xcf19('0x1c');var _0x47d474=_0x4ff469[_0xcf19('0x1e')];var _0x42769c=_0x169f04?0x0:_0x5adf2f[_0xcf19('0x1f')];var _0x325918=_0x169f04?_0x4ff469[_0xcf19('0x1e')]:_0x5adf2f[_0xcf19('0x1f')]+_0x5adf2f[_0xcf19('0x1d')];var _0x2fcd14;if(_0x325918>=_0x47d474){_0x325918=_0x47d474;_0x2fcd14=0xc8;}else{_0x2fcd14=0xce;}_0x3ce77c[_0xcf19('0x1b')](_0x2fcd14);return _0x3ce77c[_0xcf19('0x20')](_0xcf19('0x21'),_0x42769c+'-'+_0x325918+'/'+_0x47d474)[_0xcf19('0x22')](_0x4ff469);}return null;};}function patchUpdates(_0x21cfd0){return function(_0x5eed59){try{jsonpatch[_0xcf19('0x23')](_0x5eed59,_0x21cfd0,!![]);}catch(_0x272988){return BPromise['reject'](_0x272988);}return _0x5eed59[_0xcf19('0x24')]();};}function saveUpdates(_0x1209be,_0xa43e69){return function(_0x324f9c){if(_0x324f9c){return _0x324f9c['update'](_0x1209be)[_0xcf19('0x25')](function(_0x43bb81){return _0x43bb81;});}return null;};}function removeEntity(_0x339bfe,_0x47fc66){return function(_0x4acce0){if(_0x4acce0){return _0x4acce0[_0xcf19('0x26')]()[_0xcf19('0x25')](function(){_0x339bfe['status'](0xcc)[_0xcf19('0x1a')]();});}};}function handleEntityNotFound(_0x158ed8,_0x9c5efc){return function(_0x158ff4){if(!_0x158ff4){_0x158ed8['sendStatus'](0x194);}return _0x158ff4;};}function handleError(_0x32af40,_0x5d9043){_0x5d9043=_0x5d9043||0x1f4;return function(_0x316810){logger[_0xcf19('0x27')](_0x316810['stack']);if(_0x316810['name']){delete _0x316810[_0xcf19('0x28')];}_0x32af40[_0xcf19('0x1b')](_0x5d9043)['send'](_0x316810);};}exports[_0xcf19('0x29')]=function(_0x5ea79a,_0x33d892){var _0x1daec7={},_0x4d6b4b={},_0x3f0b03={'count':0x0,'rows':[]};var _0x24452f=_[_0xcf19('0x2a')](db[_0xcf19('0x2b')]['rawAttributes'],function(_0x46003f){return{'name':_0x46003f[_0xcf19('0x2c')],'type':_0x46003f[_0xcf19('0x2d')][_0xcf19('0x2e')]};});_0x4d6b4b[_0xcf19('0x2f')]=_['map'](_0x24452f,_0xcf19('0x28'));_0x4d6b4b[_0xcf19('0x30')]=_[_0xcf19('0x31')](_0x5ea79a[_0xcf19('0x30')]);_0x4d6b4b[_0xcf19('0x32')]=_[_0xcf19('0x33')](_0x4d6b4b[_0xcf19('0x2f')],_0x4d6b4b[_0xcf19('0x30')]);_0x1daec7[_0xcf19('0x34')]=_[_0xcf19('0x33')](_0x4d6b4b[_0xcf19('0x2f')],qs[_0xcf19('0x35')](_0x5ea79a['query']['fields']));_0x1daec7['attributes']=_0x1daec7['attributes'][_0xcf19('0x36')]?_0x1daec7[_0xcf19('0x34')]:_0x4d6b4b[_0xcf19('0x2f')];if(!_0x5ea79a[_0xcf19('0x30')][_0xcf19('0x37')](_0xcf19('0x38'))){_0x1daec7[_0xcf19('0x1d')]=qs['limit'](_0x5ea79a[_0xcf19('0x30')][_0xcf19('0x1d')]);_0x1daec7[_0xcf19('0x1f')]=qs[_0xcf19('0x1f')](_0x5ea79a[_0xcf19('0x30')][_0xcf19('0x1f')]);}_0x1daec7[_0xcf19('0x39')]=qs[_0xcf19('0x3a')](_0x5ea79a[_0xcf19('0x30')][_0xcf19('0x3a')]);_0x1daec7[_0xcf19('0x3b')]=qs[_0xcf19('0x32')](_[_0xcf19('0x3c')](_0x5ea79a[_0xcf19('0x30')],_0x4d6b4b[_0xcf19('0x32')]),_0x24452f);if(_0x5ea79a[_0xcf19('0x30')][_0xcf19('0x3d')]){_0x1daec7['where']=_[_0xcf19('0x3e')](_0x1daec7[_0xcf19('0x3b')],{'$or':_[_0xcf19('0x2a')](_0x24452f,function(_0x47de15){if(_0x47de15[_0xcf19('0x2d')]!=='VIRTUAL'){var _0x1c9449={};_0x1c9449[_0x47de15[_0xcf19('0x28')]]={'$like':'%'+_0x5ea79a['query']['filter']+'%'};return _0x1c9449;}})});}_0x1daec7=_[_0xcf19('0x3e')]({},_0x1daec7,_0x5ea79a[_0xcf19('0x3f')]);var _0x3639a1={'where':_0x1daec7[_0xcf19('0x3b')]};return db[_0xcf19('0x2b')]['count'](_0x3639a1)['then'](function(_0x363aaf){_0x3f0b03[_0xcf19('0x1e')]=_0x363aaf;if(_0x5ea79a[_0xcf19('0x30')][_0xcf19('0x40')]){_0x1daec7['include']=[{'all':!![]}];}return db[_0xcf19('0x2b')][_0xcf19('0x41')](_0x1daec7);})[_0xcf19('0x25')](function(_0xf35942){_0x3f0b03[_0xcf19('0x42')]=_0xf35942;return _0x3f0b03;})['then'](respondWithFilteredResult(_0x33d892,_0x1daec7))['catch'](handleError(_0x33d892,null));};exports['show']=function(_0x3ed15a,_0xb51718){var _0x99f65a={'raw':!![],'where':{'id':_0x3ed15a['params']['id']}},_0x175d8f={};_0x175d8f['model']=_[_0xcf19('0x31')](db[_0xcf19('0x2b')][_0xcf19('0x43')]);_0x175d8f['query']=_[_0xcf19('0x31')](_0x3ed15a[_0xcf19('0x30')]);_0x175d8f[_0xcf19('0x32')]=_[_0xcf19('0x33')](_0x175d8f[_0xcf19('0x2f')],_0x175d8f[_0xcf19('0x30')]);_0x99f65a[_0xcf19('0x34')]=_['intersection'](_0x175d8f['model'],qs['fields'](_0x3ed15a[_0xcf19('0x30')]['fields']));_0x99f65a[_0xcf19('0x34')]=_0x99f65a['attributes'][_0xcf19('0x36')]?_0x99f65a['attributes']:_0x175d8f[_0xcf19('0x2f')];if(_0x3ed15a['query'][_0xcf19('0x40')]){_0x99f65a[_0xcf19('0x44')]=[{'all':!![]}];}_0x99f65a=_[_0xcf19('0x3e')]({},_0x99f65a,_0x3ed15a['options']);return db[_0xcf19('0x2b')][_0xcf19('0x45')](_0x99f65a)['then'](handleEntityNotFound(_0xb51718,null))[_0xcf19('0x25')](respondWithResult(_0xb51718,null))['catch'](handleError(_0xb51718,null));};exports['create']=function(_0x5114eb,_0x1c8d18){return db['FaxTransferReport'][_0xcf19('0x46')](_0x5114eb[_0xcf19('0x47')],{})[_0xcf19('0x25')](respondWithResult(_0x1c8d18,0xc9))[_0xcf19('0x48')](handleError(_0x1c8d18,null));};exports[_0xcf19('0x49')]=function(_0x25a55a,_0x11e8c1){if(_0x25a55a['body']['id']){delete _0x25a55a[_0xcf19('0x47')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x25a55a[_0xcf19('0x4a')]['id']}})[_0xcf19('0x25')](handleEntityNotFound(_0x11e8c1,null))[_0xcf19('0x25')](saveUpdates(_0x25a55a[_0xcf19('0x47')],null))[_0xcf19('0x25')](respondWithResult(_0x11e8c1,null))[_0xcf19('0x48')](handleError(_0x11e8c1,null));};exports[_0xcf19('0x26')]=function(_0x2b3488,_0x4ffa57){return db[_0xcf19('0x2b')][_0xcf19('0x45')]({'where':{'id':_0x2b3488[_0xcf19('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ffa57,null))[_0xcf19('0x25')](removeEntity(_0x4ffa57,null))[_0xcf19('0x48')](handleError(_0x4ffa57,null));};exports['describe']=function(_0x45b6c9,_0x7e90af){return db['FaxTransferReport'][_0xcf19('0x4b')]()[_0xcf19('0x25')](respondWithResult(_0x7e90af,null))[_0xcf19('0x48')](handleError(_0x7e90af,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index f2676b4..28b2f39 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 _0xf95b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','../../config/logger'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf95b,0x197));var _0xbf95=function(_0x1aed95,_0x1de484){_0x1aed95=_0x1aed95-0x0;var _0x31cbda=_0xf95b[_0x1aed95];return _0x31cbda;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf95('0x0'))(_0xbf95('0x1'));var moment=require(_0xbf95('0x2'));var BPromise=require(_0xbf95('0x3'));var rp=require(_0xbf95('0x4'));var fs=require('fs');var path=require(_0xbf95('0x5'));var rimraf=require(_0xbf95('0x6'));var config=require(_0xbf95('0x7'));var attributes=require(_0xbf95('0x8'));module[_0xbf95('0x9')]=function(_0x3b42f0,_0x412486){return _0x3b42f0['define'](_0xbf95('0xa'),attributes,{'tableName':_0xbf95('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6918=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x6918,0xc8));var _0x8691=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6918[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x8691('0x0'));var logger=require(_0x8691('0x1'))(_0x8691('0x2'));var moment=require(_0x8691('0x3'));var BPromise=require(_0x8691('0x4'));var rp=require(_0x8691('0x5'));var fs=require('fs');var path=require(_0x8691('0x6'));var rimraf=require(_0x8691('0x7'));var config=require(_0x8691('0x8'));var attributes=require(_0x8691('0x9'));module[_0x8691('0xa')]=function(_0x49a440,_0x4a5f14){return _0x49a440[_0x8691('0xb')](_0x8691('0xc'),attributes,{'tableName':_0x8691('0xd'),'paranoid':![],'indexes':[{'name':_0x8691('0xe'),'fields':[_0x8691('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 976e5c8..765b673 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 _0xfe37=['FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then'];(function(_0x4dfdef,_0x1349b0){var _0x3d63bd=function(_0x2585d4){while(--_0x2585d4){_0x4dfdef['push'](_0x4dfdef['shift']());}};_0x3d63bd(++_0x1349b0);}(_0xfe37,0xe6));var _0x7fe3=function(_0x3f2088,_0x3f33b8){_0x3f2088=_0x3f2088-0x0;var _0xb33792=_0xfe37[_0x3f2088];return _0xb33792;};'use strict';var _=require('lodash');var util=require(_0x7fe3('0x0'));var moment=require(_0x7fe3('0x1'));var BPromise=require(_0x7fe3('0x2'));var rs=require(_0x7fe3('0x3'));var fs=require('fs');var Redis=require(_0x7fe3('0x4'));var db=require(_0x7fe3('0x5'))['db'];var utils=require(_0x7fe3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7fe3('0x7'));var jayson=require(_0x7fe3('0x8'));var client=jayson['client'][_0x7fe3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc02d59,_0xc0e88e,_0x46e521){return new BPromise(function(_0x59e2bc,_0x5d704f){return client[_0x7fe3('0xa')](_0xc02d59,_0x46e521)[_0x7fe3('0xb')](function(_0x3f9baf){logger['info'](_0x7fe3('0xc'),_0xc0e88e,'request\x20sent');logger[_0x7fe3('0xd')](_0x7fe3('0xe'),_0xc0e88e,_0x7fe3('0xf'),JSON['stringify'](_0x3f9baf));if(_0x3f9baf[_0x7fe3('0x10')]){if(_0x3f9baf[_0x7fe3('0x10')][_0x7fe3('0x11')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0xc0e88e,_0x3f9baf[_0x7fe3('0x10')]['message']);return _0x5d704f(_0x3f9baf[_0x7fe3('0x10')][_0x7fe3('0x12')]);}logger[_0x7fe3('0x10')](_0x7fe3('0xc'),_0xc0e88e,_0x3f9baf[_0x7fe3('0x10')][_0x7fe3('0x12')]);return _0x59e2bc(_0x3f9baf[_0x7fe3('0x10')]['message']);}else{logger[_0x7fe3('0x13')](_0x7fe3('0xc'),_0xc0e88e,_0x7fe3('0xf'));_0x59e2bc(_0x3f9baf[_0x7fe3('0x14')][_0x7fe3('0x12')]);}})[_0x7fe3('0x15')](function(_0x55ce23){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0xc0e88e,_0x55ce23);_0x5d704f(_0x55ce23);});});} \ No newline at end of file +var _0x818c=['../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x15c623,_0x2a2355){var _0x44a7fe=function(_0x1e5172){while(--_0x1e5172){_0x15c623['push'](_0x15c623['shift']());}};_0x44a7fe(++_0x2a2355);}(_0x818c,0x14e));var _0xc818=function(_0xb7eab8,_0x2dac09){_0xb7eab8=_0xb7eab8-0x0;var _0x29b77b=_0x818c[_0xb7eab8];return _0x29b77b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc818('0x0'));var BPromise=require(_0xc818('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc818('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc818('0x3'));var logger=require(_0xc818('0x4'))(_0xc818('0x5'));var config=require(_0xc818('0x6'));var jayson=require(_0xc818('0x7'));var client=jayson[_0xc818('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x362cc7,_0x14ff59,_0x8cc82c){return new BPromise(function(_0x1415c7,_0x53b678){return client[_0xc818('0x9')](_0x362cc7,_0x8cc82c)[_0xc818('0xa')](function(_0x29985e){logger[_0xc818('0xb')](_0xc818('0xc'),_0x14ff59,_0xc818('0xd'));logger[_0xc818('0xe')](_0xc818('0xf'),_0x14ff59,'request\x20sent',JSON['stringify'](_0x29985e));if(_0x29985e[_0xc818('0x10')]){if(_0x29985e['error'][_0xc818('0x11')]===0x1f4){logger[_0xc818('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x14ff59,_0x29985e['error'][_0xc818('0x12')]);return _0x53b678(_0x29985e['error']['message']);}logger[_0xc818('0x10')](_0xc818('0xc'),_0x14ff59,_0x29985e[_0xc818('0x10')][_0xc818('0x12')]);return _0x1415c7(_0x29985e[_0xc818('0x10')][_0xc818('0x12')]);}else{logger['info'](_0xc818('0xc'),_0x14ff59,_0xc818('0xd'));_0x1415c7(_0x29985e['result'][_0xc818('0x12')]);}})[_0xc818('0x13')](function(_0x27f227){logger[_0xc818('0x10')](_0xc818('0xc'),_0x14ff59,_0x27f227);_0x53b678(_0x27f227);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e82f048..326cd20 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 _0x28d6=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x4bd950,_0x184ed5){var _0x5dc59a=function(_0x6ff30f){while(--_0x6ff30f){_0x4bd950['push'](_0x4bd950['shift']());}};_0x5dc59a(++_0x184ed5);}(_0x28d6,0xe4));var _0x628d=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0x28d6[_0x173113];return _0x3bea89;};'use strict';var multer=require(_0x628d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x628d('0x1'));var express=require(_0x628d('0x2'));var router=express['Router']();var fs_extra=require(_0x628d('0x3'));var auth=require(_0x628d('0x4'));var interaction=require(_0x628d('0x5'));var config=require(_0x628d('0x6'));var controller=require(_0x628d('0x7'));router['get']('/',auth[_0x628d('0x8')](),controller[_0x628d('0x9')]);router[_0x628d('0xa')](_0x628d('0xb'),auth['isAuthenticated'](),controller[_0x628d('0xc')]);router[_0x628d('0xa')](_0x628d('0xd'),auth[_0x628d('0x8')](),controller[_0x628d('0xe')]);router[_0x628d('0xf')]('/',auth[_0x628d('0x8')](),controller[_0x628d('0x10')]);router[_0x628d('0x11')]('/:id',auth[_0x628d('0x8')](),controller['update']);router[_0x628d('0x12')](_0x628d('0xd'),auth['isAuthenticated'](),controller[_0x628d('0x13')]);module[_0x628d('0x14')]=router; \ No newline at end of file +var _0xe79d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x59f812,_0x8dd430){var _0x1e1e63=function(_0x4d3de9){while(--_0x4d3de9){_0x59f812['push'](_0x59f812['shift']());}};_0x1e1e63(++_0x8dd430);}(_0xe79d,0x111));var _0xde79=function(_0x3bf873,_0x9afb55){_0x3bf873=_0x3bf873-0x0;var _0x1283e3=_0xe79d[_0x3bf873];return _0x1283e3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xde79('0x0'));var timeout=require(_0xde79('0x1'));var express=require(_0xde79('0x2'));var router=express[_0xde79('0x3')]();var fs_extra=require(_0xde79('0x4'));var auth=require(_0xde79('0x5'));var interaction=require(_0xde79('0x6'));var config=require(_0xde79('0x7'));var controller=require('./faxTransferReport.controller');router[_0xde79('0x8')]('/',auth[_0xde79('0x9')](),controller[_0xde79('0xa')]);router[_0xde79('0x8')](_0xde79('0xb'),auth[_0xde79('0x9')](),controller[_0xde79('0xc')]);router[_0xde79('0x8')](_0xde79('0xd'),auth[_0xde79('0x9')](),controller[_0xde79('0xe')]);router[_0xde79('0xf')]('/',auth[_0xde79('0x9')](),controller[_0xde79('0x10')]);router[_0xde79('0x11')](_0xde79('0xd'),auth[_0xde79('0x9')](),controller[_0xde79('0x12')]);router['delete'](_0xde79('0xd'),auth[_0xde79('0x9')](),controller[_0xde79('0x13')]);module[_0xde79('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 3eb0fed..6db8bc6 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 _0x056d=['/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x37f605,_0x5ca76e){var _0x4f1aff=function(_0x4463c8){while(--_0x4463c8){_0x37f605['push'](_0x37f605['shift']());}};_0x4f1aff(++_0x5ca76e);}(_0x056d,0x174));var _0xd056=function(_0x3f4ac8,_0x57a8fe){_0x3f4ac8=_0x3f4ac8-0x0;var _0x48cc0e=_0x056d[_0x3f4ac8];return _0x48cc0e;};'use strict';var multer=require(_0xd056('0x0'));var util=require(_0xd056('0x1'));var path=require(_0xd056('0x2'));var timeout=require(_0xd056('0x3'));var express=require(_0xd056('0x4'));var router=express[_0xd056('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd056('0x6'));var interaction=require(_0xd056('0x7'));var config=require(_0xd056('0x8'));var controller=require('./intDeskAccount.controller');router[_0xd056('0x9')]('/',auth[_0xd056('0xa')](),controller['index']);router[_0xd056('0x9')](_0xd056('0xb'),auth[_0xd056('0xa')](),controller['show']);router[_0xd056('0x9')](_0xd056('0xc'),auth[_0xd056('0xa')](),controller[_0xd056('0xd')]);router[_0xd056('0x9')](_0xd056('0xe'),auth['isAuthenticated'](),controller[_0xd056('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd056('0x10')]);router[_0xd056('0x11')](_0xd056('0xc'),auth[_0xd056('0xa')](),controller[_0xd056('0x12')]);router[_0xd056('0x13')]('/:id',auth[_0xd056('0xa')](),controller[_0xd056('0x14')]);router[_0xd056('0x15')](_0xd056('0xb'),auth[_0xd056('0xa')](),controller[_0xd056('0x16')]);module[_0xd056('0x17')]=router; \ No newline at end of file +var _0xc64b=['put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration'];(function(_0x524bc1,_0x230985){var _0x5c112f=function(_0x4583e1){while(--_0x4583e1){_0x524bc1['push'](_0x524bc1['shift']());}};_0x5c112f(++_0x230985);}(_0xc64b,0x16d));var _0xbc64=function(_0x38ff2b,_0x3a0316){_0x38ff2b=_0x38ff2b-0x0;var _0x341f5e=_0xc64b[_0x38ff2b];return _0x341f5e;};'use strict';var multer=require(_0xbc64('0x0'));var util=require('util');var path=require(_0xbc64('0x1'));var timeout=require(_0xbc64('0x2'));var express=require(_0xbc64('0x3'));var router=express[_0xbc64('0x4')]();var fs_extra=require(_0xbc64('0x5'));var auth=require(_0xbc64('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbc64('0x7'));var controller=require(_0xbc64('0x8'));router[_0xbc64('0x9')]('/',auth['isAuthenticated'](),controller[_0xbc64('0xa')]);router[_0xbc64('0x9')]('/:id',auth[_0xbc64('0xb')](),controller[_0xbc64('0xc')]);router[_0xbc64('0x9')](_0xbc64('0xd'),auth[_0xbc64('0xb')](),controller[_0xbc64('0xe')]);router[_0xbc64('0x9')](_0xbc64('0xf'),auth[_0xbc64('0xb')](),controller[_0xbc64('0x10')]);router[_0xbc64('0x11')]('/',auth[_0xbc64('0xb')](),controller['create']);router[_0xbc64('0x11')]('/:id/configurations',auth[_0xbc64('0xb')](),controller[_0xbc64('0x12')]);router[_0xbc64('0x13')](_0xbc64('0x14'),auth[_0xbc64('0xb')](),controller[_0xbc64('0x15')]);router[_0xbc64('0x16')](_0xbc64('0x14'),auth[_0xbc64('0xb')](),controller[_0xbc64('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index db5fc76..a73ce6d 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 _0xb8a9=['STRING','basic','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x1e393b,_0x355f6b){var _0x3d0bfe=function(_0x320830){while(--_0x320830){_0x1e393b['push'](_0x1e393b['shift']());}};_0x3d0bfe(++_0x355f6b);}(_0xb8a9,0x116));var _0x9b8a=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0xb8a9[_0x5fa520];return _0x1bf6c4;};'use strict';var Sequelize=require(_0x9b8a('0x0'));module[_0x9b8a('0x1')]={'name':{'type':Sequelize[_0x9b8a('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9b8a('0x2')]},'remoteUri':{'type':Sequelize[_0x9b8a('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x9b8a('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x9b8a('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x9b8a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9b8a('0x4')](_0x9b8a('0x5'),_0x9b8a('0x6')),'defaultValue':_0x9b8a('0x5')}}; \ No newline at end of file +var _0xc5ac=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x55b2b6,_0x5d8933){var _0x2c4f02=function(_0x3af0e0){while(--_0x3af0e0){_0x55b2b6['push'](_0x55b2b6['shift']());}};_0x2c4f02(++_0x5d8933);}(_0xc5ac,0x1bd));var _0xcc5a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc5ac[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xcc5a('0x0'));module[_0xcc5a('0x1')]={'name':{'type':Sequelize[_0xcc5a('0x2')]},'description':{'type':Sequelize[_0xcc5a('0x2')]},'username':{'type':Sequelize[_0xcc5a('0x2')]},'remoteUri':{'type':Sequelize[_0xcc5a('0x2')]},'authType':{'type':Sequelize[_0xcc5a('0x3')](_0xcc5a('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xcc5a('0x2')]},'consumerKey':{'type':Sequelize[_0xcc5a('0x2')]},'consumerSecret':{'type':Sequelize[_0xcc5a('0x2')]},'token':{'type':Sequelize[_0xcc5a('0x2')]},'tokenSecret':{'type':Sequelize[_0xcc5a('0x2')]},'serverUrl':{'type':Sequelize[_0xcc5a('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xcc5a('0x5'),_0xcc5a('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f6cff1e..52a4dff 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 _0x31ff=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','stack','name','send','index','map','DeskAccount','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','include','rows','rawAttributes','length','find','catch','create','body','params','getConfigurations','findOne','pick','filter','Subjects','getSubjects','Descriptions','channel','DeskField','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','GET','%s/custom_fields','application/json','Authorization','format','Basic\x20%s','%s:%s','toString','_embedded','entries','active','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x31ff,0x19d));var _0xf31f=function(_0x7220f4,_0x5ac632){_0x7220f4=_0x7220f4-0x0;var _0x5e4f9f=_0x31ff[_0x7220f4];return _0x5e4f9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf31f('0x0'));var zipdir=require(_0xf31f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf31f('0x2'));var moment=require('moment');var BPromise=require(_0xf31f('0x3'));var Mustache=require(_0xf31f('0x4'));var util=require(_0xf31f('0x5'));var path=require(_0xf31f('0x6'));var sox=require('sox');var csv=require(_0xf31f('0x7'));var ejs=require(_0xf31f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf31f('0x9'));var squel=require(_0xf31f('0xa'));var crypto=require(_0xf31f('0xb'));var jsforce=require(_0xf31f('0xc'));var deskjs=require(_0xf31f('0xd'));var toCsv=require(_0xf31f('0x7'));var querystring=require(_0xf31f('0xe'));var Papa=require(_0xf31f('0xf'));var Redis=require('ioredis');var authService=require(_0xf31f('0x10'));var qs=require(_0xf31f('0x11'));var as=require(_0xf31f('0x12'));var hardwareService=require(_0xf31f('0x13'));var logger=require(_0xf31f('0x14'))('api');var utils=require(_0xf31f('0x15'));var config=require(_0xf31f('0x16'));var licenseUtil=require(_0xf31f('0x17'));var db=require(_0xf31f('0x18'))['db'];var integrations=require(_0xf31f('0x19'));function respondWithStatusCode(_0x1716b6,_0x1ade32){_0x1ade32=_0x1ade32||0xcc;return function(_0x1f74e1){if(_0x1f74e1){return _0x1716b6[_0xf31f('0x1a')](_0x1ade32);}return _0x1716b6[_0xf31f('0x1b')](_0x1ade32)[_0xf31f('0x1c')]();};}function respondWithResult(_0x25a34f,_0x11ff8a){_0x11ff8a=_0x11ff8a||0xc8;return function(_0x1292e6){if(_0x1292e6){return _0x25a34f[_0xf31f('0x1b')](_0x11ff8a)[_0xf31f('0x1d')](_0x1292e6);}};}function respondWithFilteredResult(_0x34b863,_0x17a673){return function(_0x3388eb){if(_0x3388eb){var _0x32bbd8=typeof _0x17a673[_0xf31f('0x1e')]===_0xf31f('0x1f')&&typeof _0x17a673[_0xf31f('0x20')]===_0xf31f('0x1f');var _0x14598e=_0x3388eb['count'];var _0x1c8459=_0x32bbd8?0x0:_0x17a673[_0xf31f('0x1e')];var _0x2a1f2b=_0x32bbd8?_0x3388eb[_0xf31f('0x21')]:_0x17a673[_0xf31f('0x1e')]+_0x17a673[_0xf31f('0x20')];var _0x1a9931;if(_0x2a1f2b>=_0x14598e){_0x2a1f2b=_0x14598e;_0x1a9931=0xc8;}else{_0x1a9931=0xce;}_0x34b863[_0xf31f('0x1b')](_0x1a9931);return _0x34b863['set'](_0xf31f('0x22'),_0x1c8459+'-'+_0x2a1f2b+'/'+_0x14598e)['json'](_0x3388eb);}return null;};}function patchUpdates(_0x662ccd){return function(_0x4e6ed3){try{jsonpatch[_0xf31f('0x23')](_0x4e6ed3,_0x662ccd,!![]);}catch(_0x9ac6ca){return BPromise['reject'](_0x9ac6ca);}return _0x4e6ed3['save']();};}function saveUpdates(_0xdef293,_0x3d7e34){return function(_0x38df3d){if(_0x38df3d){return _0x38df3d[_0xf31f('0x24')](_0xdef293)[_0xf31f('0x25')](function(_0x5d9b7c){return _0x5d9b7c;});}return null;};}function removeEntity(_0x2907f2,_0x2d47ab){return function(_0x52686a){if(_0x52686a){return _0x52686a[_0xf31f('0x26')]()[_0xf31f('0x25')](function(){_0x2907f2[_0xf31f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21592c,_0x574ab2){return function(_0x1f0f8c){if(!_0x1f0f8c){_0x21592c['sendStatus'](0x194);}return _0x1f0f8c;};}function handleError(_0x180e33,_0x145fc9){_0x145fc9=_0x145fc9||0x1f4;return function(_0x4115ef){logger['error'](_0x4115ef[_0xf31f('0x27')]);if(_0x4115ef[_0xf31f('0x28')]){delete _0x4115ef[_0xf31f('0x28')];}_0x180e33[_0xf31f('0x1b')](_0x145fc9)[_0xf31f('0x29')](_0x4115ef);};}exports[_0xf31f('0x2a')]=function(_0x5d00f3,_0x102386){var _0x12dd4a={},_0x2f9d62={},_0x491f34={'count':0x0,'rows':[]};var _0x543690=_[_0xf31f('0x2b')](db[_0xf31f('0x2c')]['rawAttributes'],function(_0xe252c0){return{'name':_0xe252c0['fieldName'],'type':_0xe252c0['type']['key']};});_0x2f9d62[_0xf31f('0x2d')]=_['map'](_0x543690,_0xf31f('0x28'));_0x2f9d62['query']=_[_0xf31f('0x2e')](_0x5d00f3[_0xf31f('0x2f')]);_0x2f9d62[_0xf31f('0x30')]=_['intersection'](_0x2f9d62[_0xf31f('0x2d')],_0x2f9d62[_0xf31f('0x2f')]);_0x12dd4a[_0xf31f('0x31')]=_[_0xf31f('0x32')](_0x2f9d62['model'],qs[_0xf31f('0x33')](_0x5d00f3['query']['fields']));_0x12dd4a[_0xf31f('0x31')]=_0x12dd4a[_0xf31f('0x31')]['length']?_0x12dd4a['attributes']:_0x2f9d62[_0xf31f('0x2d')];if(!_0x5d00f3['query'][_0xf31f('0x34')](_0xf31f('0x35'))){_0x12dd4a['limit']=qs[_0xf31f('0x20')](_0x5d00f3[_0xf31f('0x2f')][_0xf31f('0x20')]);_0x12dd4a['offset']=qs[_0xf31f('0x1e')](_0x5d00f3[_0xf31f('0x2f')]['offset']);}_0x12dd4a[_0xf31f('0x36')]=qs[_0xf31f('0x37')](_0x5d00f3[_0xf31f('0x2f')][_0xf31f('0x37')]);_0x12dd4a[_0xf31f('0x38')]=qs['filters'](_['pick'](_0x5d00f3[_0xf31f('0x2f')],_0x2f9d62['filters']),_0x543690);if(_0x5d00f3[_0xf31f('0x2f')]['filter']){_0x12dd4a[_0xf31f('0x38')]=_[_0xf31f('0x39')](_0x12dd4a[_0xf31f('0x38')],{'$or':_['map'](_0x543690,function(_0x79e22){if(_0x79e22[_0xf31f('0x3a')]!==_0xf31f('0x3b')){var _0xfaba05={};_0xfaba05[_0x79e22[_0xf31f('0x28')]]={'$like':'%'+_0x5d00f3[_0xf31f('0x2f')]['filter']+'%'};return _0xfaba05;}})});}_0x12dd4a=_['merge']({},_0x12dd4a,_0x5d00f3[_0xf31f('0x3c')]);var _0x34346d={'where':_0x12dd4a[_0xf31f('0x38')]};return db['DeskAccount'][_0xf31f('0x21')](_0x34346d)[_0xf31f('0x25')](function(_0x4f6337){_0x491f34[_0xf31f('0x21')]=_0x4f6337;if(_0x5d00f3[_0xf31f('0x2f')]['includeAll']){_0x12dd4a[_0xf31f('0x3d')]=[{'all':!![]}];}return db[_0xf31f('0x2c')]['findAll'](_0x12dd4a);})[_0xf31f('0x25')](function(_0x297240){_0x491f34[_0xf31f('0x3e')]=_0x297240;return _0x491f34;})[_0xf31f('0x25')](respondWithFilteredResult(_0x102386,_0x12dd4a))['catch'](handleError(_0x102386,null));};exports['show']=function(_0x580a33,_0x214782){var _0x39137e={'raw':![],'where':{'id':_0x580a33['params']['id']}},_0x21d6e6={};_0x21d6e6[_0xf31f('0x2d')]=_['keys'](db['DeskAccount'][_0xf31f('0x3f')]);_0x21d6e6['query']=_[_0xf31f('0x2e')](_0x580a33[_0xf31f('0x2f')]);_0x21d6e6[_0xf31f('0x30')]=_[_0xf31f('0x32')](_0x21d6e6[_0xf31f('0x2d')],_0x21d6e6[_0xf31f('0x2f')]);_0x39137e[_0xf31f('0x31')]=_[_0xf31f('0x32')](_0x21d6e6[_0xf31f('0x2d')],qs[_0xf31f('0x33')](_0x580a33['query']['fields']));_0x39137e[_0xf31f('0x31')]=_0x39137e[_0xf31f('0x31')][_0xf31f('0x40')]?_0x39137e[_0xf31f('0x31')]:_0x21d6e6['model'];if(_0x580a33[_0xf31f('0x2f')]['includeAll']){_0x39137e[_0xf31f('0x3d')]=[{'all':!![]}];}_0x39137e=_[_0xf31f('0x39')]({},_0x39137e,_0x580a33[_0xf31f('0x3c')]);return db[_0xf31f('0x2c')][_0xf31f('0x41')](_0x39137e)[_0xf31f('0x25')](handleEntityNotFound(_0x214782,null))[_0xf31f('0x25')](respondWithResult(_0x214782,null))[_0xf31f('0x42')](handleError(_0x214782,null));};exports[_0xf31f('0x43')]=function(_0x1155d4,_0x5e3300){return db[_0xf31f('0x2c')]['create'](_0x1155d4[_0xf31f('0x44')],{})[_0xf31f('0x25')](respondWithResult(_0x5e3300,0xc9))['catch'](handleError(_0x5e3300,null));};exports[_0xf31f('0x24')]=function(_0x46cde,_0x56268f){if(_0x46cde[_0xf31f('0x44')]['id']){delete _0x46cde[_0xf31f('0x44')]['id'];}return db[_0xf31f('0x2c')]['find']({'where':{'id':_0x46cde[_0xf31f('0x45')]['id']}})[_0xf31f('0x25')](handleEntityNotFound(_0x56268f,null))['then'](saveUpdates(_0x46cde[_0xf31f('0x44')],null))['then'](respondWithResult(_0x56268f,null))[_0xf31f('0x42')](handleError(_0x56268f,null));};exports['destroy']=function(_0x2b54fa,_0x1e41de){return db[_0xf31f('0x2c')][_0xf31f('0x41')]({'where':{'id':_0x2b54fa['params']['id']}})[_0xf31f('0x25')](handleEntityNotFound(_0x1e41de,null))[_0xf31f('0x25')](removeEntity(_0x1e41de,null))['catch'](handleError(_0x1e41de,null));};exports[_0xf31f('0x46')]=function(_0x392096,_0x532043,_0x44606d){var _0x3c7eb4={};var _0x4c0df6={};var _0x51f24c;var _0x1fec77;return db[_0xf31f('0x2c')][_0xf31f('0x47')]({'where':{'id':_0x392096['params']['id']}})[_0xf31f('0x25')](handleEntityNotFound(_0x532043,null))[_0xf31f('0x25')](function(_0x50fa1c){if(_0x50fa1c){_0x51f24c=_0x50fa1c;_0x4c0df6[_0xf31f('0x2d')]=_[_0xf31f('0x2e')](db['DeskConfiguration'][_0xf31f('0x3f')]);_0x4c0df6[_0xf31f('0x2f')]=_[_0xf31f('0x2e')](_0x392096[_0xf31f('0x2f')]);_0x4c0df6['filters']=_[_0xf31f('0x32')](_0x4c0df6[_0xf31f('0x2d')],_0x4c0df6[_0xf31f('0x2f')]);_0x3c7eb4[_0xf31f('0x31')]=_[_0xf31f('0x32')](_0x4c0df6[_0xf31f('0x2d')],qs['fields'](_0x392096['query']['fields']));_0x3c7eb4['attributes']=_0x3c7eb4[_0xf31f('0x31')][_0xf31f('0x40')]?_0x3c7eb4[_0xf31f('0x31')]:_0x4c0df6[_0xf31f('0x2d')];_0x3c7eb4[_0xf31f('0x36')]=qs[_0xf31f('0x37')](_0x392096['query'][_0xf31f('0x37')]);_0x3c7eb4['where']=qs[_0xf31f('0x30')](_[_0xf31f('0x48')](_0x392096[_0xf31f('0x2f')],_0x4c0df6[_0xf31f('0x30')]));if(_0x392096['query'][_0xf31f('0x49')]){_0x3c7eb4[_0xf31f('0x38')]=_[_0xf31f('0x39')](_0x3c7eb4[_0xf31f('0x38')],{'$or':_[_0xf31f('0x2b')](_0x3c7eb4[_0xf31f('0x31')],function(_0x162e00){var _0x1d674f={};_0x1d674f[_0x162e00]={'$like':'%'+_0x392096[_0xf31f('0x2f')][_0xf31f('0x49')]+'%'};return _0x1d674f;})});}_0x3c7eb4=_['merge']({},_0x3c7eb4,_0x392096[_0xf31f('0x3c')]);return _0x51f24c[_0xf31f('0x46')](_0x3c7eb4);}})[_0xf31f('0x25')](function(_0x1e7803){if(_0x1e7803){_0x1fec77=_0x1e7803[_0xf31f('0x40')];if(!_0x392096[_0xf31f('0x2f')][_0xf31f('0x34')](_0xf31f('0x35'))){_0x3c7eb4['limit']=qs[_0xf31f('0x20')](_0x392096[_0xf31f('0x2f')][_0xf31f('0x20')]);_0x3c7eb4[_0xf31f('0x1e')]=qs[_0xf31f('0x1e')](_0x392096[_0xf31f('0x2f')][_0xf31f('0x1e')]);}return _0x51f24c[_0xf31f('0x46')](_0x3c7eb4);}})[_0xf31f('0x25')](function(_0x9801b9){if(_0x9801b9){return _0x9801b9?{'count':_0x1fec77,'rows':_0x9801b9}:null;}})[_0xf31f('0x25')](respondWithResult(_0x532043,null))[_0xf31f('0x42')](handleError(_0x532043,null));};exports['addConfiguration']=function(_0x2c3da8,_0x1707ce,_0x5af5f5){if(_0x2c3da8[_0xf31f('0x44')]['id']){delete _0x2c3da8[_0xf31f('0x44')]['id'];}return db[_0xf31f('0x2c')]['findOne']({'where':{'id':_0x2c3da8[_0xf31f('0x45')]['id']}})[_0xf31f('0x25')](handleEntityNotFound(_0x1707ce,null))[_0xf31f('0x25')](function(_0x2e4608){if(_0x2e4608){_0x2c3da8['body']['AccountId']=_0x2e4608['id'];_0x2c3da8[_0xf31f('0x44')][_0xf31f('0x4a')]=integrations[_0xf31f('0x4b')](_0x2c3da8[_0xf31f('0x44')]['channel'],_0x2c3da8['body'][_0xf31f('0x3a')]);_0x2c3da8[_0xf31f('0x44')][_0xf31f('0x4c')]=integrations['getDescriptions'](_0x2c3da8[_0xf31f('0x44')][_0xf31f('0x4d')],_0x2c3da8[_0xf31f('0x44')]['type']);return db['DeskConfiguration']['create'](_0x2c3da8['body'],{'include':[{'model':db[_0xf31f('0x4e')],'as':'Subjects'},{'model':db['DeskField'],'as':_0xf31f('0x4c')}]});}return null;})['then'](respondWithResult(_0x1707ce,null))[_0xf31f('0x42')](handleError(_0x1707ce,null));};exports['getFields']=function(_0x23c916,_0x54021e,_0x4c1b73){var _0x3dbc1f=[{'name':_0xf31f('0x4f'),'label':_0xf31f('0x4f'),'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 _0x33f4d6='';return db[_0xf31f('0x2c')][_0xf31f('0x47')]({'where':{'id':_0x23c916[_0xf31f('0x45')]['id']},'attributes':['id','remoteUri',_0xf31f('0x50'),_0xf31f('0x51'),_0xf31f('0x52'),_0xf31f('0x53'),_0xf31f('0x54'),_0xf31f('0x55'),_0xf31f('0x56')]})['then'](handleEntityNotFound(_0x54021e,null))[_0xf31f('0x25')](function(_0x2397c5){if(_0x2397c5){_0x33f4d6=_0x2397c5[_0xf31f('0x57')];var _0x50594b=_0x33f4d6[_0xf31f('0x58')](-0x1);if(_0x50594b==='/'){_0x33f4d6=_0x33f4d6['substring'](0x0,_0x33f4d6['lastIndexOf'](_0x50594b));}var _0x650c4={'method':_0xf31f('0x59'),'uri':util['format'](_0xf31f('0x5a'),_0x33f4d6),'headers':{'Content-Type':_0xf31f('0x5b'),'Accept':'application/json'},'json':!![]};if(_0x2397c5[_0xf31f('0x50')]==='basic'){_0x650c4['headers'][_0xf31f('0x5c')]=util[_0xf31f('0x5d')](_0xf31f('0x5e'),new Buffer(util[_0xf31f('0x5d')](_0xf31f('0x5f'),_0x2397c5[_0xf31f('0x51')],_0x2397c5[_0xf31f('0x52')]))[_0xf31f('0x60')]('base64'));}return rp(_0x650c4)[_0xf31f('0x25')](function(_0x2cfc06){return _0x3dbc1f['concat'](_[_0xf31f('0x2b')](_0x2cfc06[_0xf31f('0x61')][_0xf31f('0x62')],function(_0x8e5f75){return{'id':_0x8e5f75['name'],'name':_0x8e5f75[_0xf31f('0x28')],'type':_0x8e5f75[_0xf31f('0x3a')],'active':_0x8e5f75[_0xf31f('0x63')],'label':_0x8e5f75['label'],'custom':!![]};}));});}})['then'](function(_0x2bfca9){return{'count':_0x2bfca9[_0xf31f('0x40')],'rows':_0x2bfca9};})[_0xf31f('0x25')](respondWithResult(_0x54021e,null))['catch'](function(_0x5f5356){var _0x12f468=_0x23c916[_0xf31f('0x2f')][_0xf31f('0x64')]?0x1f4:_0x5f5356[_0xf31f('0x65')]||0x1f4;logger[_0xf31f('0x66')](_0xf31f('0x67'),_0xf31f('0x68'),_0x12f468,JSON[_0xf31f('0x69')](_0x5f5356));delete _0x5f5356[_0xf31f('0x28')];if(_0x12f468===0x191){_0x12f468=0x190;}_0x54021e[_0xf31f('0x1b')](_0x12f468)[_0xf31f('0x29')](_0x23c916[_0xf31f('0x2f')][_0xf31f('0x64')]?{'message':_0xf31f('0x6a'),'statusCode':_0x5f5356[_0xf31f('0x65')]}:_0x5f5356);});}; \ No newline at end of file +var _0xcc8a=['end','json','offset','undefined','count','set','Content-Range','apply','reject','then','stack','name','send','map','DeskAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','merge','include','findAll','rows','catch','params','includeAll','options','find','create','body','update','destroy','getConfigurations','findOne','DeskConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','concat','_embedded','entries','active','label','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status'];(function(_0x221f3f,_0x572f89){var _0x4cee7c=function(_0x474015){while(--_0x474015){_0x221f3f['push'](_0x221f3f['shift']());}};_0x4cee7c(++_0x572f89);}(_0xcc8a,0x1b5));var _0xacc8=function(_0x3bf9cc,_0x38a7bf){_0x3bf9cc=_0x3bf9cc-0x0;var _0x270534=_0xcc8a[_0x3bf9cc];return _0x270534;};'use strict';var emlformat=require(_0xacc8('0x0'));var rimraf=require(_0xacc8('0x1'));var zipdir=require(_0xacc8('0x2'));var jsonpatch=require(_0xacc8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xacc8('0x4'));var Mustache=require('mustache');var util=require(_0xacc8('0x5'));var path=require(_0xacc8('0x6'));var sox=require(_0xacc8('0x7'));var csv=require(_0xacc8('0x8'));var ejs=require(_0xacc8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xacc8('0xa'));var jsforce=require(_0xacc8('0xb'));var deskjs=require(_0xacc8('0xc'));var toCsv=require(_0xacc8('0x8'));var querystring=require('querystring');var Papa=require(_0xacc8('0xd'));var Redis=require(_0xacc8('0xe'));var authService=require(_0xacc8('0xf'));var qs=require(_0xacc8('0x10'));var as=require(_0xacc8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacc8('0x12'))(_0xacc8('0x13'));var utils=require(_0xacc8('0x14'));var config=require(_0xacc8('0x15'));var licenseUtil=require(_0xacc8('0x16'));var db=require(_0xacc8('0x17'))['db'];var integrations=require(_0xacc8('0x18'));function respondWithStatusCode(_0x448fcc,_0x420302){_0x420302=_0x420302||0xcc;return function(_0x59b6be){if(_0x59b6be){return _0x448fcc[_0xacc8('0x19')](_0x420302);}return _0x448fcc[_0xacc8('0x1a')](_0x420302)[_0xacc8('0x1b')]();};}function respondWithResult(_0x2bc564,_0x2a2b93){_0x2a2b93=_0x2a2b93||0xc8;return function(_0xd8f5b6){if(_0xd8f5b6){return _0x2bc564[_0xacc8('0x1a')](_0x2a2b93)[_0xacc8('0x1c')](_0xd8f5b6);}};}function respondWithFilteredResult(_0x3ae070,_0x51ddbb){return function(_0x465143){if(_0x465143){var _0xd33fcb=typeof _0x51ddbb[_0xacc8('0x1d')]===_0xacc8('0x1e')&&typeof _0x51ddbb['limit']===_0xacc8('0x1e');var _0x96a5ad=_0x465143[_0xacc8('0x1f')];var _0x3a2d36=_0xd33fcb?0x0:_0x51ddbb[_0xacc8('0x1d')];var _0xea2b34=_0xd33fcb?_0x465143['count']:_0x51ddbb[_0xacc8('0x1d')]+_0x51ddbb['limit'];var _0x22bfb1;if(_0xea2b34>=_0x96a5ad){_0xea2b34=_0x96a5ad;_0x22bfb1=0xc8;}else{_0x22bfb1=0xce;}_0x3ae070[_0xacc8('0x1a')](_0x22bfb1);return _0x3ae070[_0xacc8('0x20')](_0xacc8('0x21'),_0x3a2d36+'-'+_0xea2b34+'/'+_0x96a5ad)[_0xacc8('0x1c')](_0x465143);}return null;};}function patchUpdates(_0x25befa){return function(_0x42fcc4){try{jsonpatch[_0xacc8('0x22')](_0x42fcc4,_0x25befa,!![]);}catch(_0x3619e7){return BPromise[_0xacc8('0x23')](_0x3619e7);}return _0x42fcc4['save']();};}function saveUpdates(_0x4def38,_0x482d51){return function(_0x2bfdce){if(_0x2bfdce){return _0x2bfdce['update'](_0x4def38)[_0xacc8('0x24')](function(_0x37f9ea){return _0x37f9ea;});}return null;};}function removeEntity(_0x46e51b,_0x184c49){return function(_0x25ca7a){if(_0x25ca7a){return _0x25ca7a['destroy']()[_0xacc8('0x24')](function(){_0x46e51b[_0xacc8('0x1a')](0xcc)[_0xacc8('0x1b')]();});}};}function handleEntityNotFound(_0x42dd09,_0x2ad302){return function(_0x243cef){if(!_0x243cef){_0x42dd09['sendStatus'](0x194);}return _0x243cef;};}function handleError(_0x130a58,_0x2eff78){_0x2eff78=_0x2eff78||0x1f4;return function(_0x37b7b4){logger['error'](_0x37b7b4[_0xacc8('0x25')]);if(_0x37b7b4['name']){delete _0x37b7b4[_0xacc8('0x26')];}_0x130a58[_0xacc8('0x1a')](_0x2eff78)[_0xacc8('0x27')](_0x37b7b4);};}exports['index']=function(_0x43d7b9,_0x2dd449){var _0x33d9ad={},_0x5c032f={},_0x3494c5={'count':0x0,'rows':[]};var _0x294b90=_[_0xacc8('0x28')](db[_0xacc8('0x29')][_0xacc8('0x2a')],function(_0x4081f9){return{'name':_0x4081f9['fieldName'],'type':_0x4081f9['type'][_0xacc8('0x2b')]};});_0x5c032f[_0xacc8('0x2c')]=_[_0xacc8('0x28')](_0x294b90,_0xacc8('0x26'));_0x5c032f[_0xacc8('0x2d')]=_[_0xacc8('0x2e')](_0x43d7b9['query']);_0x5c032f[_0xacc8('0x2f')]=_[_0xacc8('0x30')](_0x5c032f['model'],_0x5c032f[_0xacc8('0x2d')]);_0x33d9ad['attributes']=_[_0xacc8('0x30')](_0x5c032f[_0xacc8('0x2c')],qs['fields'](_0x43d7b9[_0xacc8('0x2d')][_0xacc8('0x31')]));_0x33d9ad[_0xacc8('0x32')]=_0x33d9ad[_0xacc8('0x32')][_0xacc8('0x33')]?_0x33d9ad[_0xacc8('0x32')]:_0x5c032f[_0xacc8('0x2c')];if(!_0x43d7b9[_0xacc8('0x2d')]['hasOwnProperty'](_0xacc8('0x34'))){_0x33d9ad[_0xacc8('0x35')]=qs[_0xacc8('0x35')](_0x43d7b9[_0xacc8('0x2d')][_0xacc8('0x35')]);_0x33d9ad[_0xacc8('0x1d')]=qs[_0xacc8('0x1d')](_0x43d7b9[_0xacc8('0x2d')][_0xacc8('0x1d')]);}_0x33d9ad['order']=qs[_0xacc8('0x36')](_0x43d7b9[_0xacc8('0x2d')][_0xacc8('0x36')]);_0x33d9ad[_0xacc8('0x37')]=qs[_0xacc8('0x2f')](_[_0xacc8('0x38')](_0x43d7b9['query'],_0x5c032f[_0xacc8('0x2f')]),_0x294b90);if(_0x43d7b9[_0xacc8('0x2d')][_0xacc8('0x39')]){_0x33d9ad[_0xacc8('0x37')]=_['merge'](_0x33d9ad['where'],{'$or':_['map'](_0x294b90,function(_0x1320cd){if(_0x1320cd[_0xacc8('0x3a')]!==_0xacc8('0x3b')){var _0x2de267={};_0x2de267[_0x1320cd['name']]={'$like':'%'+_0x43d7b9[_0xacc8('0x2d')][_0xacc8('0x39')]+'%'};return _0x2de267;}})});}_0x33d9ad=_[_0xacc8('0x3c')]({},_0x33d9ad,_0x43d7b9['options']);var _0x1ab443={'where':_0x33d9ad[_0xacc8('0x37')]};return db[_0xacc8('0x29')]['count'](_0x1ab443)[_0xacc8('0x24')](function(_0x5b907a){_0x3494c5[_0xacc8('0x1f')]=_0x5b907a;if(_0x43d7b9[_0xacc8('0x2d')]['includeAll']){_0x33d9ad[_0xacc8('0x3d')]=[{'all':!![]}];}return db[_0xacc8('0x29')][_0xacc8('0x3e')](_0x33d9ad);})['then'](function(_0x4df855){_0x3494c5[_0xacc8('0x3f')]=_0x4df855;return _0x3494c5;})[_0xacc8('0x24')](respondWithFilteredResult(_0x2dd449,_0x33d9ad))[_0xacc8('0x40')](handleError(_0x2dd449,null));};exports['show']=function(_0x919304,_0xa5c476){var _0x33eaf1={'raw':![],'where':{'id':_0x919304[_0xacc8('0x41')]['id']}},_0x1b2f67={};_0x1b2f67['model']=_[_0xacc8('0x2e')](db[_0xacc8('0x29')]['rawAttributes']);_0x1b2f67[_0xacc8('0x2d')]=_[_0xacc8('0x2e')](_0x919304[_0xacc8('0x2d')]);_0x1b2f67[_0xacc8('0x2f')]=_[_0xacc8('0x30')](_0x1b2f67[_0xacc8('0x2c')],_0x1b2f67['query']);_0x33eaf1[_0xacc8('0x32')]=_[_0xacc8('0x30')](_0x1b2f67[_0xacc8('0x2c')],qs['fields'](_0x919304[_0xacc8('0x2d')]['fields']));_0x33eaf1[_0xacc8('0x32')]=_0x33eaf1[_0xacc8('0x32')][_0xacc8('0x33')]?_0x33eaf1[_0xacc8('0x32')]:_0x1b2f67[_0xacc8('0x2c')];if(_0x919304['query'][_0xacc8('0x42')]){_0x33eaf1[_0xacc8('0x3d')]=[{'all':!![]}];}_0x33eaf1=_[_0xacc8('0x3c')]({},_0x33eaf1,_0x919304[_0xacc8('0x43')]);return db[_0xacc8('0x29')][_0xacc8('0x44')](_0x33eaf1)[_0xacc8('0x24')](handleEntityNotFound(_0xa5c476,null))[_0xacc8('0x24')](respondWithResult(_0xa5c476,null))[_0xacc8('0x40')](handleError(_0xa5c476,null));};exports[_0xacc8('0x45')]=function(_0x1d0689,_0x36cbfb){return db[_0xacc8('0x29')]['create'](_0x1d0689[_0xacc8('0x46')],{})['then'](respondWithResult(_0x36cbfb,0xc9))['catch'](handleError(_0x36cbfb,null));};exports[_0xacc8('0x47')]=function(_0x1ad32d,_0x32a5a4){if(_0x1ad32d[_0xacc8('0x46')]['id']){delete _0x1ad32d['body']['id'];}return db[_0xacc8('0x29')][_0xacc8('0x44')]({'where':{'id':_0x1ad32d[_0xacc8('0x41')]['id']}})[_0xacc8('0x24')](handleEntityNotFound(_0x32a5a4,null))[_0xacc8('0x24')](saveUpdates(_0x1ad32d[_0xacc8('0x46')],null))[_0xacc8('0x24')](respondWithResult(_0x32a5a4,null))[_0xacc8('0x40')](handleError(_0x32a5a4,null));};exports[_0xacc8('0x48')]=function(_0x14812a,_0x2d7935){return db[_0xacc8('0x29')][_0xacc8('0x44')]({'where':{'id':_0x14812a[_0xacc8('0x41')]['id']}})[_0xacc8('0x24')](handleEntityNotFound(_0x2d7935,null))[_0xacc8('0x24')](removeEntity(_0x2d7935,null))[_0xacc8('0x40')](handleError(_0x2d7935,null));};exports[_0xacc8('0x49')]=function(_0x1acb6b,_0x79b6a4,_0x4803c9){var _0x12eba9={};var _0x53a329={};var _0x3af2ce;var _0x428949;return db['DeskAccount'][_0xacc8('0x4a')]({'where':{'id':_0x1acb6b[_0xacc8('0x41')]['id']}})['then'](handleEntityNotFound(_0x79b6a4,null))['then'](function(_0x3bfd0c){if(_0x3bfd0c){_0x3af2ce=_0x3bfd0c;_0x53a329[_0xacc8('0x2c')]=_['keys'](db[_0xacc8('0x4b')][_0xacc8('0x2a')]);_0x53a329[_0xacc8('0x2d')]=_[_0xacc8('0x2e')](_0x1acb6b[_0xacc8('0x2d')]);_0x53a329[_0xacc8('0x2f')]=_['intersection'](_0x53a329[_0xacc8('0x2c')],_0x53a329[_0xacc8('0x2d')]);_0x12eba9[_0xacc8('0x32')]=_[_0xacc8('0x30')](_0x53a329[_0xacc8('0x2c')],qs['fields'](_0x1acb6b[_0xacc8('0x2d')][_0xacc8('0x31')]));_0x12eba9[_0xacc8('0x32')]=_0x12eba9[_0xacc8('0x32')]['length']?_0x12eba9[_0xacc8('0x32')]:_0x53a329[_0xacc8('0x2c')];_0x12eba9[_0xacc8('0x4c')]=qs[_0xacc8('0x36')](_0x1acb6b[_0xacc8('0x2d')][_0xacc8('0x36')]);_0x12eba9[_0xacc8('0x37')]=qs[_0xacc8('0x2f')](_['pick'](_0x1acb6b[_0xacc8('0x2d')],_0x53a329[_0xacc8('0x2f')]));if(_0x1acb6b[_0xacc8('0x2d')][_0xacc8('0x39')]){_0x12eba9[_0xacc8('0x37')]=_[_0xacc8('0x3c')](_0x12eba9[_0xacc8('0x37')],{'$or':_['map'](_0x12eba9[_0xacc8('0x32')],function(_0x5de483){var _0x552180={};_0x552180[_0x5de483]={'$like':'%'+_0x1acb6b['query']['filter']+'%'};return _0x552180;})});}_0x12eba9=_[_0xacc8('0x3c')]({},_0x12eba9,_0x1acb6b[_0xacc8('0x43')]);return _0x3af2ce[_0xacc8('0x49')](_0x12eba9);}})[_0xacc8('0x24')](function(_0x542a79){if(_0x542a79){_0x428949=_0x542a79[_0xacc8('0x33')];if(!_0x1acb6b[_0xacc8('0x2d')][_0xacc8('0x4d')](_0xacc8('0x34'))){_0x12eba9[_0xacc8('0x35')]=qs[_0xacc8('0x35')](_0x1acb6b['query'][_0xacc8('0x35')]);_0x12eba9['offset']=qs[_0xacc8('0x1d')](_0x1acb6b[_0xacc8('0x2d')][_0xacc8('0x1d')]);}return _0x3af2ce[_0xacc8('0x49')](_0x12eba9);}})[_0xacc8('0x24')](function(_0x33963f){if(_0x33963f){return _0x33963f?{'count':_0x428949,'rows':_0x33963f}:null;}})[_0xacc8('0x24')](respondWithResult(_0x79b6a4,null))[_0xacc8('0x40')](handleError(_0x79b6a4,null));};exports[_0xacc8('0x4e')]=function(_0x54cc24,_0x4652ba,_0x2fcc75){if(_0x54cc24['body']['id']){delete _0x54cc24[_0xacc8('0x46')]['id'];}return db[_0xacc8('0x29')][_0xacc8('0x4a')]({'where':{'id':_0x54cc24[_0xacc8('0x41')]['id']}})[_0xacc8('0x24')](handleEntityNotFound(_0x4652ba,null))[_0xacc8('0x24')](function(_0x43f659){if(_0x43f659){_0x54cc24[_0xacc8('0x46')][_0xacc8('0x4f')]=_0x43f659['id'];_0x54cc24['body'][_0xacc8('0x50')]=integrations[_0xacc8('0x51')](_0x54cc24[_0xacc8('0x46')][_0xacc8('0x52')],_0x54cc24[_0xacc8('0x46')][_0xacc8('0x3a')]);_0x54cc24[_0xacc8('0x46')][_0xacc8('0x53')]=integrations[_0xacc8('0x54')](_0x54cc24[_0xacc8('0x46')][_0xacc8('0x52')],_0x54cc24['body'][_0xacc8('0x3a')]);return db[_0xacc8('0x4b')][_0xacc8('0x45')](_0x54cc24[_0xacc8('0x46')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0xacc8('0x55')],'as':_0xacc8('0x53')}]});}return null;})[_0xacc8('0x24')](respondWithResult(_0x4652ba,null))[_0xacc8('0x40')](handleError(_0x4652ba,null));};exports[_0xacc8('0x56')]=function(_0x26a9f1,_0x4aa967,_0x4b7013){var _0x27126c=[{'name':_0xacc8('0x57'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4e296d='';return db[_0xacc8('0x29')][_0xacc8('0x4a')]({'where':{'id':_0x26a9f1[_0xacc8('0x41')]['id']},'attributes':['id',_0xacc8('0x58'),_0xacc8('0x59'),_0xacc8('0x5a'),_0xacc8('0x5b'),_0xacc8('0x5c'),_0xacc8('0x5d'),_0xacc8('0x5e'),_0xacc8('0x5f')]})['then'](handleEntityNotFound(_0x4aa967,null))['then'](function(_0x572e42){if(_0x572e42){_0x4e296d=_0x572e42[_0xacc8('0x58')];var _0x44af5e=_0x4e296d[_0xacc8('0x60')](-0x1);if(_0x44af5e==='/'){_0x4e296d=_0x4e296d['substring'](0x0,_0x4e296d['lastIndexOf'](_0x44af5e));}var _0x5a37de={'method':_0xacc8('0x61'),'uri':util[_0xacc8('0x62')](_0xacc8('0x63'),_0x4e296d),'headers':{'Content-Type':_0xacc8('0x64'),'Accept':_0xacc8('0x64')},'json':!![]};if(_0x572e42['authType']===_0xacc8('0x65')){_0x5a37de[_0xacc8('0x66')][_0xacc8('0x67')]=util[_0xacc8('0x62')](_0xacc8('0x68'),new Buffer(util[_0xacc8('0x62')](_0xacc8('0x69'),_0x572e42['username'],_0x572e42[_0xacc8('0x5b')]))['toString']('base64'));}return rp(_0x5a37de)[_0xacc8('0x24')](function(_0x532281){return _0x27126c[_0xacc8('0x6a')](_['map'](_0x532281[_0xacc8('0x6b')][_0xacc8('0x6c')],function(_0x52a8d6){return{'id':_0x52a8d6[_0xacc8('0x26')],'name':_0x52a8d6[_0xacc8('0x26')],'type':_0x52a8d6['type'],'active':_0x52a8d6[_0xacc8('0x6d')],'label':_0x52a8d6[_0xacc8('0x6e')],'custom':!![]};}));});}})[_0xacc8('0x24')](function(_0x45571b){return{'count':_0x45571b['length'],'rows':_0x45571b};})['then'](respondWithResult(_0x4aa967,null))[_0xacc8('0x40')](function(_0x2fdf5f){var _0x4748ba=_0x26a9f1[_0xacc8('0x2d')]['test']?0x1f4:_0x2fdf5f['statusCode']||0x1f4;logger[_0xacc8('0x6f')](_0xacc8('0x70'),_0xacc8('0x56'),_0x4748ba,JSON[_0xacc8('0x71')](_0x2fdf5f));delete _0x2fdf5f[_0xacc8('0x26')];if(_0x4748ba===0x191){_0x4748ba=0x190;}_0x4aa967[_0xacc8('0x1a')](_0x4748ba)['send'](_0x26a9f1[_0xacc8('0x2d')][_0xacc8('0x72')]?{'message':_0xacc8('0x73'),'statusCode':_0x2fdf5f['statusCode']}:_0x2fdf5f);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 366d23d..d9ffd0e 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 _0x3fec=['moment','rimraf','../../components/integrations/configuration','exports','define','DeskAccount','lodash','../../config/logger','api'];(function(_0x3c8630,_0xb4218d){var _0x1d0412=function(_0x139315){while(--_0x139315){_0x3c8630['push'](_0x3c8630['shift']());}};_0x1d0412(++_0xb4218d);}(_0x3fec,0x153));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc3fe('0x0'));var util=require('util');var logger=require(_0xc3fe('0x1'))(_0xc3fe('0x2'));var moment=require(_0xc3fe('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc3fe('0x4'));var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xc3fe('0x5'));module[_0xc3fe('0x6')]=function(_0x2e78b3,_0x38aef1){return _0x2e78b3[_0xc3fe('0x7')](_0xc3fe('0x8'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd94=['./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1496c1,_0x29c931){var _0xf87499=function(_0xa8e12a){while(--_0xa8e12a){_0x1496c1['push'](_0x1496c1['shift']());}};_0xf87499(++_0x29c931);}(_0xdd94,0x148));var _0x4dd9=function(_0x327a3d,_0x39376b){_0x327a3d=_0x327a3d-0x0;var _0x35f844=_0xdd94[_0x327a3d];return _0x35f844;};'use strict';var _=require('lodash');var util=require(_0x4dd9('0x0'));var logger=require(_0x4dd9('0x1'))(_0x4dd9('0x2'));var moment=require(_0x4dd9('0x3'));var BPromise=require(_0x4dd9('0x4'));var rp=require(_0x4dd9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4dd9('0x6'));var config=require(_0x4dd9('0x7'));var attributes=require(_0x4dd9('0x8'));var integrations=require(_0x4dd9('0x9'));module['exports']=function(_0x807f3c,_0x2c6637){return _0x807f3c[_0x4dd9('0xa')](_0x4dd9('0xb'),attributes,{'tableName':'int_desk_accounts','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 e3ed6e9..e8d9efb 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 _0xeb80=['find','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0xeb80,0x1c9));var _0x0eb8=function(_0x50421d,_0x68ff5){_0x50421d=_0x50421d-0x0;var _0x9d96a=_0xeb80[_0x50421d];return _0x9d96a;};'use strict';var _=require(_0x0eb8('0x0'));var util=require(_0x0eb8('0x1'));var moment=require(_0x0eb8('0x2'));var BPromise=require(_0x0eb8('0x3'));var rs=require(_0x0eb8('0x4'));var fs=require('fs');var Redis=require(_0x0eb8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0eb8('0x6'));var config=require(_0x0eb8('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0eb8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50a399,_0x4c4e95,_0xa7c79){return new BPromise(function(_0x34bde8,_0x4cf2c1){return client[_0x0eb8('0x9')](_0x50a399,_0xa7c79)[_0x0eb8('0xa')](function(_0x8c2c6c){logger[_0x0eb8('0xb')](_0x0eb8('0xc'),_0x4c4e95,_0x0eb8('0xd'));logger[_0x0eb8('0xe')](_0x0eb8('0xf'),_0x4c4e95,_0x0eb8('0xd'),JSON[_0x0eb8('0x10')](_0x8c2c6c));if(_0x8c2c6c[_0x0eb8('0x11')]){if(_0x8c2c6c['error'][_0x0eb8('0x12')]===0x1f4){logger[_0x0eb8('0x11')](_0x0eb8('0xc'),_0x4c4e95,_0x8c2c6c[_0x0eb8('0x11')]['message']);return _0x4cf2c1(_0x8c2c6c['error']['message']);}logger[_0x0eb8('0x11')](_0x0eb8('0xc'),_0x4c4e95,_0x8c2c6c[_0x0eb8('0x11')][_0x0eb8('0x13')]);return _0x34bde8(_0x8c2c6c[_0x0eb8('0x11')][_0x0eb8('0x13')]);}else{logger[_0x0eb8('0xb')](_0x0eb8('0xc'),_0x4c4e95,_0x0eb8('0xd'));_0x34bde8(_0x8c2c6c[_0x0eb8('0x14')][_0x0eb8('0x13')]);}})[_0x0eb8('0x15')](function(_0x57c37c){logger['error']('DeskAccount,\x20%s,\x20%s',_0x4c4e95,_0x57c37c);_0x4cf2c1(_0x57c37c);});});}exports[_0x0eb8('0x16')]=function(_0x2dccf6){var _0x121fb1=this;return new Promise(function(_0xae0a2b,_0x5c1c16){return db[_0x0eb8('0x17')][_0x0eb8('0x18')]({'raw':_0x2dccf6[_0x0eb8('0x19')]?_0x2dccf6['options'][_0x0eb8('0x1a')]===undefined?!![]:![]:!![],'where':_0x2dccf6['options']?_0x2dccf6[_0x0eb8('0x19')][_0x0eb8('0x1b')]||null:null,'attributes':_0x2dccf6[_0x0eb8('0x19')]?_0x2dccf6[_0x0eb8('0x19')]['attributes']||null:null,'limit':_0x2dccf6[_0x0eb8('0x19')]?_0x2dccf6[_0x0eb8('0x19')][_0x0eb8('0x1c')]||null:null,'include':_0x2dccf6[_0x0eb8('0x19')]?_0x2dccf6[_0x0eb8('0x19')][_0x0eb8('0x1d')]?_[_0x0eb8('0x1e')](_0x2dccf6[_0x0eb8('0x19')][_0x0eb8('0x1d')],function(_0x474c23){return{'model':db[_0x474c23[_0x0eb8('0x1f')]],'as':_0x474c23['as'],'attributes':_0x474c23[_0x0eb8('0x20')],'include':_0x474c23[_0x0eb8('0x1d')]?_[_0x0eb8('0x1e')](_0x474c23[_0x0eb8('0x1d')],function(_0x114c0f){return{'model':db[_0x114c0f[_0x0eb8('0x1f')]],'as':_0x114c0f['as'],'attributes':_0x114c0f[_0x0eb8('0x20')],'include':_0x114c0f[_0x0eb8('0x1d')]?_['map'](_0x114c0f[_0x0eb8('0x1d')],function(_0x26b9e8){return{'model':db[_0x26b9e8['model']],'as':_0x26b9e8['as'],'attributes':_0x26b9e8[_0x0eb8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0eb8('0xa')](function(_0x38d669){logger[_0x0eb8('0xb')](_0x0eb8('0x16'),_0x2dccf6);logger['debug'](_0x0eb8('0x16'),_0x2dccf6,JSON[_0x0eb8('0x10')](_0x38d669));_0xae0a2b(_0x38d669);})['catch'](function(_0x5e4670){logger[_0x0eb8('0x11')]('GetDeskAccount',_0x5e4670[_0x0eb8('0x13')],_0x2dccf6);_0x5c1c16(_0x121fb1[_0x0eb8('0x11')](0x1f4,_0x5e4670[_0x0eb8('0x13')]));});});};exports['ShowDeskAccount']=function(_0x4d4aa3){var _0x3c88ee=this;return new Promise(function(_0x2d21c2,_0x74d177){return db[_0x0eb8('0x17')][_0x0eb8('0x21')]({'raw':_0x4d4aa3[_0x0eb8('0x19')]?_0x4d4aa3[_0x0eb8('0x19')][_0x0eb8('0x1a')]===undefined?!![]:![]:!![],'where':_0x4d4aa3['options']?_0x4d4aa3[_0x0eb8('0x19')]['where']||null:null,'attributes':_0x4d4aa3[_0x0eb8('0x19')]?_0x4d4aa3[_0x0eb8('0x19')][_0x0eb8('0x20')]||null:null,'include':_0x4d4aa3['options']?_0x4d4aa3['options'][_0x0eb8('0x1d')]?_[_0x0eb8('0x1e')](_0x4d4aa3[_0x0eb8('0x19')][_0x0eb8('0x1d')],function(_0x329ed2){return{'model':db[_0x329ed2[_0x0eb8('0x1f')]],'as':_0x329ed2['as'],'attributes':_0x329ed2[_0x0eb8('0x20')],'include':_0x329ed2[_0x0eb8('0x1d')]?_[_0x0eb8('0x1e')](_0x329ed2[_0x0eb8('0x1d')],function(_0x496cf2){return{'model':db[_0x496cf2[_0x0eb8('0x1f')]],'as':_0x496cf2['as'],'attributes':_0x496cf2[_0x0eb8('0x20')],'include':_0x496cf2['include']?_[_0x0eb8('0x1e')](_0x496cf2[_0x0eb8('0x1d')],function(_0x80d7ef){return{'model':db[_0x80d7ef[_0x0eb8('0x1f')]],'as':_0x80d7ef['as'],'attributes':_0x80d7ef[_0x0eb8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0eb8('0xa')](function(_0x4ded10){logger['info'](_0x0eb8('0x22'),_0x4d4aa3);logger[_0x0eb8('0xe')](_0x0eb8('0x22'),_0x4d4aa3,JSON[_0x0eb8('0x10')](_0x4ded10));_0x2d21c2(_0x4ded10);})['catch'](function(_0x2eef2b){logger['error'](_0x0eb8('0x22'),_0x2eef2b['message'],_0x4d4aa3);_0x74d177(_0x3c88ee['error'](0x1f4,_0x2eef2b[_0x0eb8('0x13')]));});});}; \ No newline at end of file +var _0x50cc=['rpc','jayson/promise','client','http','then','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','map','include','model','ShowDeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x22a941,_0xadc989){var _0x35e762=function(_0x2a5d1b){while(--_0x2a5d1b){_0x22a941['push'](_0x22a941['shift']());}};_0x35e762(++_0xadc989);}(_0x50cc,0x110));var _0xc50c=function(_0x4168c8,_0x21464a){_0x4168c8=_0x4168c8-0x0;var _0x56db03=_0x50cc[_0x4168c8];return _0x56db03;};'use strict';var _=require(_0xc50c('0x0'));var util=require(_0xc50c('0x1'));var moment=require(_0xc50c('0x2'));var BPromise=require(_0xc50c('0x3'));var rs=require(_0xc50c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc50c('0x5'))['db'];var utils=require(_0xc50c('0x6'));var logger=require(_0xc50c('0x7'))(_0xc50c('0x8'));var config=require('../../config/environment');var jayson=require(_0xc50c('0x9'));var client=jayson[_0xc50c('0xa')][_0xc50c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34a446,_0x92deb4,_0x4f9a2b){return new BPromise(function(_0x3a3669,_0x5dd7c3){return client['request'](_0x34a446,_0x4f9a2b)[_0xc50c('0xc')](function(_0x69a950){logger['info'](_0xc50c('0xd'),_0x92deb4,'request\x20sent');logger[_0xc50c('0xe')](_0xc50c('0xf'),_0x92deb4,_0xc50c('0x10'),JSON[_0xc50c('0x11')](_0x69a950));if(_0x69a950[_0xc50c('0x12')]){if(_0x69a950['error']['code']===0x1f4){logger['error'](_0xc50c('0xd'),_0x92deb4,_0x69a950[_0xc50c('0x12')][_0xc50c('0x13')]);return _0x5dd7c3(_0x69a950[_0xc50c('0x12')][_0xc50c('0x13')]);}logger[_0xc50c('0x12')](_0xc50c('0xd'),_0x92deb4,_0x69a950[_0xc50c('0x12')][_0xc50c('0x13')]);return _0x3a3669(_0x69a950['error'][_0xc50c('0x13')]);}else{logger[_0xc50c('0x14')](_0xc50c('0xd'),_0x92deb4,_0xc50c('0x10'));_0x3a3669(_0x69a950['result'][_0xc50c('0x13')]);}})[_0xc50c('0x15')](function(_0x802177){logger[_0xc50c('0x12')](_0xc50c('0xd'),_0x92deb4,_0x802177);_0x5dd7c3(_0x802177);});});}exports[_0xc50c('0x16')]=function(_0x51a924){var _0xcc4e27=this;return new Promise(function(_0x7d1715,_0x345e26){return db[_0xc50c('0x17')][_0xc50c('0x18')]({'raw':_0x51a924[_0xc50c('0x19')]?_0x51a924[_0xc50c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x51a924[_0xc50c('0x19')]?_0x51a924[_0xc50c('0x19')][_0xc50c('0x1a')]||null:null,'attributes':_0x51a924[_0xc50c('0x19')]?_0x51a924[_0xc50c('0x19')][_0xc50c('0x1b')]||null:null,'limit':_0x51a924['options']?_0x51a924[_0xc50c('0x19')][_0xc50c('0x1c')]||null:null,'include':_0x51a924[_0xc50c('0x19')]?_0x51a924[_0xc50c('0x19')]['include']?_[_0xc50c('0x1d')](_0x51a924[_0xc50c('0x19')][_0xc50c('0x1e')],function(_0x17c497){return{'model':db[_0x17c497[_0xc50c('0x1f')]],'as':_0x17c497['as'],'attributes':_0x17c497[_0xc50c('0x1b')],'include':_0x17c497['include']?_[_0xc50c('0x1d')](_0x17c497['include'],function(_0x15097e){return{'model':db[_0x15097e[_0xc50c('0x1f')]],'as':_0x15097e['as'],'attributes':_0x15097e[_0xc50c('0x1b')],'include':_0x15097e['include']?_[_0xc50c('0x1d')](_0x15097e['include'],function(_0x2c157c){return{'model':db[_0x2c157c[_0xc50c('0x1f')]],'as':_0x2c157c['as'],'attributes':_0x2c157c[_0xc50c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc50c('0xc')](function(_0x7834dc){logger[_0xc50c('0x14')](_0xc50c('0x16'),_0x51a924);logger['debug'](_0xc50c('0x16'),_0x51a924,JSON[_0xc50c('0x11')](_0x7834dc));_0x7d1715(_0x7834dc);})['catch'](function(_0x26be21){logger['error'](_0xc50c('0x16'),_0x26be21[_0xc50c('0x13')],_0x51a924);_0x345e26(_0xcc4e27['error'](0x1f4,_0x26be21[_0xc50c('0x13')]));});});};exports[_0xc50c('0x20')]=function(_0x35fda5){var _0x56f8c3=this;return new Promise(function(_0x167739,_0x4cb5c9){return db['DeskAccount'][_0xc50c('0x21')]({'raw':_0x35fda5[_0xc50c('0x19')]?_0x35fda5[_0xc50c('0x19')][_0xc50c('0x22')]===undefined?!![]:![]:!![],'where':_0x35fda5[_0xc50c('0x19')]?_0x35fda5[_0xc50c('0x19')][_0xc50c('0x1a')]||null:null,'attributes':_0x35fda5['options']?_0x35fda5['options'][_0xc50c('0x1b')]||null:null,'include':_0x35fda5[_0xc50c('0x19')]?_0x35fda5[_0xc50c('0x19')][_0xc50c('0x1e')]?_[_0xc50c('0x1d')](_0x35fda5[_0xc50c('0x19')][_0xc50c('0x1e')],function(_0x16b908){return{'model':db[_0x16b908['model']],'as':_0x16b908['as'],'attributes':_0x16b908[_0xc50c('0x1b')],'include':_0x16b908[_0xc50c('0x1e')]?_['map'](_0x16b908[_0xc50c('0x1e')],function(_0x42d630){return{'model':db[_0x42d630[_0xc50c('0x1f')]],'as':_0x42d630['as'],'attributes':_0x42d630[_0xc50c('0x1b')],'include':_0x42d630[_0xc50c('0x1e')]?_[_0xc50c('0x1d')](_0x42d630[_0xc50c('0x1e')],function(_0x17cb9d){return{'model':db[_0x17cb9d[_0xc50c('0x1f')]],'as':_0x17cb9d['as'],'attributes':_0x17cb9d[_0xc50c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc50c('0xc')](function(_0x205583){logger[_0xc50c('0x14')](_0xc50c('0x20'),_0x35fda5);logger[_0xc50c('0xe')]('ShowDeskAccount',_0x35fda5,JSON[_0xc50c('0x11')](_0x205583));_0x167739(_0x205583);})[_0xc50c('0x15')](function(_0x2d14ac){logger[_0xc50c('0x12')](_0xc50c('0x20'),_0x2d14ac[_0xc50c('0x13')],_0x35fda5);_0x4cb5c9(_0x56f8c3[_0xc50c('0x12')](0x1f4,_0x2d14ac[_0xc50c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 682e026..878064d 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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x5773f9,_0x293036){var _0x330807=function(_0x151832){while(--_0x151832){_0x5773f9['push'](_0x5773f9['shift']());}};_0x330807(++_0x293036);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',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/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +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(_0x2fb9dd,_0x24ca8a){var _0x123df9=function(_0x5ceb99){while(--_0x5ceb99){_0x2fb9dd['push'](_0x2fb9dd['shift']());}};_0x123df9(++_0x24ca8a);}(_0x008c,0x188));var _0xc008=function(_0x542ab0,_0x4f10d5){_0x542ab0=_0x542ab0-0x0;var _0x165baa=_0x008c[_0x542ab0];return _0x165baa;};'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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index d36d691..44665dd 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 _0x010d=['STRING','sequelize'];(function(_0x14989e,_0x4e0bbc){var _0x87239=function(_0x203bbf){while(--_0x203bbf){_0x14989e['push'](_0x14989e['shift']());}};_0x87239(++_0x4e0bbc);}(_0x010d,0x163));var _0xd010=function(_0x15ef45,_0x389ce5){_0x15ef45=_0x15ef45-0x0;var _0xe06315=_0x010d[_0x15ef45];return _0xe06315;};'use strict';var Sequelize=require(_0xd010('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd010('0x1')]}}; \ No newline at end of file +var _0x4c62=['STRING'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x4c62,0x17f));var _0x24c6=function(_0x43b9fd,_0x5c3b2a){_0x43b9fd=_0x43b9fd-0x0;var _0x4f9b48=_0x4c62[_0x43b9fd];return _0x4f9b48;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x24c6('0x0')]},'description':{'type':Sequelize[_0x24c6('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index c21fc3f..8fb5e81 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 _0x50cb=['getFields','DeskField','pick','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','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','then','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','DeskConfiguration','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','update'];(function(_0x45937f,_0x256a25){var _0x5bf5d1=function(_0x4300bd){while(--_0x4300bd){_0x45937f['push'](_0x45937f['shift']());}};_0x5bf5d1(++_0x256a25);}(_0x50cb,0x165));var _0xb50c=function(_0x26332e,_0x2b1f06){_0x26332e=_0x26332e-0x0;var _0x1bf653=_0x50cb[_0x26332e];return _0x1bf653;};'use strict';var emlformat=require(_0xb50c('0x0'));var rimraf=require(_0xb50c('0x1'));var zipdir=require(_0xb50c('0x2'));var jsonpatch=require(_0xb50c('0x3'));var rp=require('request-promise');var moment=require(_0xb50c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb50c('0x5'));var util=require(_0xb50c('0x6'));var path=require(_0xb50c('0x7'));var sox=require('sox');var csv=require(_0xb50c('0x8'));var ejs=require(_0xb50c('0x9'));var fs=require('fs');var fs_extra=require(_0xb50c('0xa'));var _=require(_0xb50c('0xb'));var squel=require(_0xb50c('0xc'));var crypto=require(_0xb50c('0xd'));var jsforce=require(_0xb50c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb50c('0x8'));var querystring=require(_0xb50c('0xf'));var Papa=require(_0xb50c('0x10'));var Redis=require(_0xb50c('0x11'));var authService=require(_0xb50c('0x12'));var qs=require(_0xb50c('0x13'));var as=require(_0xb50c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb50c('0x15'))(_0xb50c('0x16'));var utils=require(_0xb50c('0x17'));var config=require(_0xb50c('0x18'));var licenseUtil=require(_0xb50c('0x19'));var db=require(_0xb50c('0x1a'))['db'];function respondWithStatusCode(_0x4c5f50,_0x529346){_0x529346=_0x529346||0xcc;return function(_0x3ed248){if(_0x3ed248){return _0x4c5f50[_0xb50c('0x1b')](_0x529346);}return _0x4c5f50['status'](_0x529346)[_0xb50c('0x1c')]();};}function respondWithResult(_0x2f8710,_0x2355c0){_0x2355c0=_0x2355c0||0xc8;return function(_0x360aae){if(_0x360aae){return _0x2f8710[_0xb50c('0x1d')](_0x2355c0)[_0xb50c('0x1e')](_0x360aae);}};}function respondWithFilteredResult(_0x2cc933,_0x2b4f2c){return function(_0xbdc675){if(_0xbdc675){var _0x3cae77=typeof _0x2b4f2c[_0xb50c('0x1f')]===_0xb50c('0x20')&&typeof _0x2b4f2c[_0xb50c('0x21')]==='undefined';var _0x340ead=_0xbdc675['count'];var _0x13ea82=_0x3cae77?0x0:_0x2b4f2c['offset'];var _0x37186d=_0x3cae77?_0xbdc675[_0xb50c('0x22')]:_0x2b4f2c[_0xb50c('0x1f')]+_0x2b4f2c[_0xb50c('0x21')];var _0x2226cf;if(_0x37186d>=_0x340ead){_0x37186d=_0x340ead;_0x2226cf=0xc8;}else{_0x2226cf=0xce;}_0x2cc933['status'](_0x2226cf);return _0x2cc933[_0xb50c('0x23')](_0xb50c('0x24'),_0x13ea82+'-'+_0x37186d+'/'+_0x340ead)['json'](_0xbdc675);}return null;};}function patchUpdates(_0x1640e3){return function(_0x22c6c4){try{jsonpatch[_0xb50c('0x25')](_0x22c6c4,_0x1640e3,!![]);}catch(_0x2d82fb){return BPromise[_0xb50c('0x26')](_0x2d82fb);}return _0x22c6c4[_0xb50c('0x27')]();};}function saveUpdates(_0xaddfa2,_0x2f278b){return function(_0x503236){if(_0x503236){return _0x503236['update'](_0xaddfa2)[_0xb50c('0x28')](function(_0x5083d6){return _0x5083d6;});}return null;};}function removeEntity(_0x3240c9,_0x36b5bf){return function(_0x11fb80){if(_0x11fb80){return _0x11fb80['destroy']()[_0xb50c('0x28')](function(){_0x3240c9[_0xb50c('0x1d')](0xcc)[_0xb50c('0x1c')]();});}};}function handleEntityNotFound(_0x1e1116,_0x4aeb7e){return function(_0x15c883){if(!_0x15c883){_0x1e1116[_0xb50c('0x1b')](0x194);}return _0x15c883;};}function handleError(_0x1ad754,_0x63e7cb){_0x63e7cb=_0x63e7cb||0x1f4;return function(_0x4e3e0a){logger['error'](_0x4e3e0a[_0xb50c('0x29')]);if(_0x4e3e0a[_0xb50c('0x2a')]){delete _0x4e3e0a[_0xb50c('0x2a')];}_0x1ad754[_0xb50c('0x1d')](_0x63e7cb)[_0xb50c('0x2b')](_0x4e3e0a);};}exports[_0xb50c('0x2c')]=function(_0x2277a9,_0x1173c8){var _0x3576f3={},_0x5b0c32={},_0x54bf7c={'count':0x0,'rows':[]};var _0x3ddb40=_[_0xb50c('0x2d')](db['DeskConfiguration']['rawAttributes'],function(_0x57440c){return{'name':_0x57440c[_0xb50c('0x2e')],'type':_0x57440c[_0xb50c('0x2f')][_0xb50c('0x30')]};});_0x5b0c32[_0xb50c('0x31')]=_[_0xb50c('0x2d')](_0x3ddb40,_0xb50c('0x2a'));_0x5b0c32[_0xb50c('0x32')]=_[_0xb50c('0x33')](_0x2277a9[_0xb50c('0x32')]);_0x5b0c32[_0xb50c('0x34')]=_['intersection'](_0x5b0c32[_0xb50c('0x31')],_0x5b0c32[_0xb50c('0x32')]);_0x3576f3[_0xb50c('0x35')]=_[_0xb50c('0x36')](_0x5b0c32['model'],qs['fields'](_0x2277a9[_0xb50c('0x32')][_0xb50c('0x37')]));_0x3576f3[_0xb50c('0x35')]=_0x3576f3[_0xb50c('0x35')][_0xb50c('0x38')]?_0x3576f3[_0xb50c('0x35')]:_0x5b0c32[_0xb50c('0x31')];if(!_0x2277a9[_0xb50c('0x32')][_0xb50c('0x39')](_0xb50c('0x3a'))){_0x3576f3['limit']=qs[_0xb50c('0x21')](_0x2277a9['query'][_0xb50c('0x21')]);_0x3576f3[_0xb50c('0x1f')]=qs[_0xb50c('0x1f')](_0x2277a9['query'][_0xb50c('0x1f')]);}_0x3576f3[_0xb50c('0x3b')]=qs[_0xb50c('0x3c')](_0x2277a9[_0xb50c('0x32')][_0xb50c('0x3c')]);_0x3576f3['where']=qs[_0xb50c('0x34')](_['pick'](_0x2277a9[_0xb50c('0x32')],_0x5b0c32[_0xb50c('0x34')]),_0x3ddb40);if(_0x2277a9[_0xb50c('0x32')][_0xb50c('0x3d')]){_0x3576f3[_0xb50c('0x3e')]=_[_0xb50c('0x3f')](_0x3576f3[_0xb50c('0x3e')],{'$or':_[_0xb50c('0x2d')](_0x3ddb40,function(_0x44716e){if(_0x44716e[_0xb50c('0x2f')]!=='VIRTUAL'){var _0x11ec98={};_0x11ec98[_0x44716e[_0xb50c('0x2a')]]={'$like':'%'+_0x2277a9[_0xb50c('0x32')]['filter']+'%'};return _0x11ec98;}})});}_0x3576f3=_[_0xb50c('0x3f')]({},_0x3576f3,_0x2277a9['options']);var _0x531c6b={'where':_0x3576f3[_0xb50c('0x3e')]};return db[_0xb50c('0x40')][_0xb50c('0x22')](_0x531c6b)[_0xb50c('0x28')](function(_0xbf1156){_0x54bf7c[_0xb50c('0x22')]=_0xbf1156;if(_0x2277a9[_0xb50c('0x32')][_0xb50c('0x41')]){_0x3576f3[_0xb50c('0x42')]=[{'all':!![]}];}return db[_0xb50c('0x40')][_0xb50c('0x43')](_0x3576f3);})['then'](function(_0x2b992f){_0x54bf7c[_0xb50c('0x44')]=_0x2b992f;return _0x54bf7c;})[_0xb50c('0x28')](respondWithFilteredResult(_0x1173c8,_0x3576f3))['catch'](handleError(_0x1173c8,null));};exports[_0xb50c('0x45')]=function(_0x4a8a43,_0x29bd8e){var _0x525b04={'raw':![],'where':{'id':_0x4a8a43[_0xb50c('0x46')]['id']}},_0x11fd70={};_0x11fd70[_0xb50c('0x31')]=_[_0xb50c('0x33')](db[_0xb50c('0x40')][_0xb50c('0x47')]);_0x11fd70[_0xb50c('0x32')]=_[_0xb50c('0x33')](_0x4a8a43[_0xb50c('0x32')]);_0x11fd70[_0xb50c('0x34')]=_[_0xb50c('0x36')](_0x11fd70[_0xb50c('0x31')],_0x11fd70[_0xb50c('0x32')]);_0x525b04[_0xb50c('0x35')]=_[_0xb50c('0x36')](_0x11fd70[_0xb50c('0x31')],qs['fields'](_0x4a8a43[_0xb50c('0x32')][_0xb50c('0x37')]));_0x525b04[_0xb50c('0x35')]=_0x525b04['attributes'][_0xb50c('0x38')]?_0x525b04[_0xb50c('0x35')]:_0x11fd70[_0xb50c('0x31')];if(_0x4a8a43[_0xb50c('0x32')]['includeAll']){_0x525b04['include']=[{'all':!![]}];}_0x525b04=_['merge']({},_0x525b04,_0x4a8a43[_0xb50c('0x48')]);return db[_0xb50c('0x40')][_0xb50c('0x49')](_0x525b04)[_0xb50c('0x28')](handleEntityNotFound(_0x29bd8e,null))['then'](respondWithResult(_0x29bd8e,null))[_0xb50c('0x4a')](handleError(_0x29bd8e,null));};exports[_0xb50c('0x4b')]=function(_0x37d39f,_0x483ff3){return db[_0xb50c('0x40')][_0xb50c('0x4b')](_0x37d39f[_0xb50c('0x4c')],{})[_0xb50c('0x28')](respondWithResult(_0x483ff3,0xc9))['catch'](handleError(_0x483ff3,null));};exports[_0xb50c('0x4d')]=function(_0x462c3c,_0x1f884b){if(_0x462c3c[_0xb50c('0x4c')]['id']){delete _0x462c3c[_0xb50c('0x4c')]['id'];}return db[_0xb50c('0x40')][_0xb50c('0x49')]({'where':{'id':_0x462c3c[_0xb50c('0x46')]['id']}})[_0xb50c('0x28')](handleEntityNotFound(_0x1f884b,null))['then'](saveUpdates(_0x462c3c[_0xb50c('0x4c')],null))[_0xb50c('0x28')](respondWithResult(_0x1f884b,null))[_0xb50c('0x4a')](handleError(_0x1f884b,null));};exports['destroy']=function(_0xf7d3aa,_0x5dde5d){return db[_0xb50c('0x40')][_0xb50c('0x49')]({'where':{'id':_0xf7d3aa[_0xb50c('0x46')]['id']}})[_0xb50c('0x28')](handleEntityNotFound(_0x5dde5d,null))[_0xb50c('0x28')](removeEntity(_0x5dde5d,null))[_0xb50c('0x4a')](handleError(_0x5dde5d,null));};exports[_0xb50c('0x4e')]=function(_0x2a4437,_0x3df4dd,_0x8337b){var _0x56478d={};var _0x571875={};var _0x4e76f6;var _0x10cda3;return db[_0xb50c('0x40')]['findOne']({'where':{'id':_0x2a4437[_0xb50c('0x46')]['id']}})[_0xb50c('0x28')](handleEntityNotFound(_0x3df4dd,null))[_0xb50c('0x28')](function(_0x47878d){if(_0x47878d){_0x4e76f6=_0x47878d;_0x571875[_0xb50c('0x31')]=_[_0xb50c('0x33')](db[_0xb50c('0x4f')][_0xb50c('0x47')]);_0x571875[_0xb50c('0x32')]=_[_0xb50c('0x33')](_0x2a4437[_0xb50c('0x32')]);_0x571875[_0xb50c('0x34')]=_['intersection'](_0x571875[_0xb50c('0x31')],_0x571875[_0xb50c('0x32')]);_0x56478d[_0xb50c('0x35')]=_[_0xb50c('0x36')](_0x571875[_0xb50c('0x31')],qs[_0xb50c('0x37')](_0x2a4437[_0xb50c('0x32')][_0xb50c('0x37')]));_0x56478d[_0xb50c('0x35')]=_0x56478d[_0xb50c('0x35')][_0xb50c('0x38')]?_0x56478d[_0xb50c('0x35')]:_0x571875[_0xb50c('0x31')];_0x56478d[_0xb50c('0x3b')]=qs[_0xb50c('0x3c')](_0x2a4437[_0xb50c('0x32')]['sort']);_0x56478d[_0xb50c('0x3e')]=qs[_0xb50c('0x34')](_[_0xb50c('0x50')](_0x2a4437[_0xb50c('0x32')],_0x571875[_0xb50c('0x34')]));if(_0x2a4437['query'][_0xb50c('0x3d')]){_0x56478d[_0xb50c('0x3e')]=_[_0xb50c('0x3f')](_0x56478d[_0xb50c('0x3e')],{'$or':_[_0xb50c('0x2d')](_0x56478d[_0xb50c('0x35')],function(_0x16b306){var _0x9dfc27={};_0x9dfc27[_0x16b306]={'$like':'%'+_0x2a4437[_0xb50c('0x32')][_0xb50c('0x3d')]+'%'};return _0x9dfc27;})});}_0x56478d=_['merge']({},_0x56478d,_0x2a4437[_0xb50c('0x48')]);return _0x4e76f6[_0xb50c('0x4e')](_0x56478d);}})['then'](function(_0x434d1c){if(_0x434d1c){_0x10cda3=_0x434d1c[_0xb50c('0x38')];if(!_0x2a4437[_0xb50c('0x32')]['hasOwnProperty'](_0xb50c('0x3a'))){_0x56478d['limit']=qs[_0xb50c('0x21')](_0x2a4437[_0xb50c('0x32')][_0xb50c('0x21')]);_0x56478d[_0xb50c('0x1f')]=qs[_0xb50c('0x1f')](_0x2a4437['query']['offset']);}return _0x4e76f6[_0xb50c('0x4e')](_0x56478d);}})[_0xb50c('0x28')](function(_0x3e5477){if(_0x3e5477){return _0x3e5477?{'count':_0x10cda3,'rows':_0x3e5477}:null;}})[_0xb50c('0x28')](respondWithResult(_0x3df4dd,null))[_0xb50c('0x4a')](handleError(_0x3df4dd,null));};exports[_0xb50c('0x51')]=function(_0x20a5f1,_0x4c296e,_0x565155){var _0x28340d={};var _0x108f64={};var _0x528415;var _0x1c02db;return db['DeskConfiguration'][_0xb50c('0x52')]({'where':{'id':_0x20a5f1['params']['id']}})[_0xb50c('0x28')](handleEntityNotFound(_0x4c296e,null))[_0xb50c('0x28')](function(_0x43344f){if(_0x43344f){_0x528415=_0x43344f;_0x108f64[_0xb50c('0x31')]=_['keys'](db['DeskField'][_0xb50c('0x47')]);_0x108f64[_0xb50c('0x32')]=_[_0xb50c('0x33')](_0x20a5f1[_0xb50c('0x32')]);_0x108f64[_0xb50c('0x34')]=_[_0xb50c('0x36')](_0x108f64[_0xb50c('0x31')],_0x108f64['query']);_0x28340d[_0xb50c('0x35')]=_[_0xb50c('0x36')](_0x108f64['model'],qs[_0xb50c('0x37')](_0x20a5f1['query'][_0xb50c('0x37')]));_0x28340d[_0xb50c('0x35')]=_0x28340d['attributes'][_0xb50c('0x38')]?_0x28340d['attributes']:_0x108f64['model'];_0x28340d[_0xb50c('0x3b')]=qs[_0xb50c('0x3c')](_0x20a5f1[_0xb50c('0x32')][_0xb50c('0x3c')]);_0x28340d[_0xb50c('0x3e')]=qs[_0xb50c('0x34')](_[_0xb50c('0x50')](_0x20a5f1[_0xb50c('0x32')],_0x108f64[_0xb50c('0x34')]));if(_0x20a5f1[_0xb50c('0x32')][_0xb50c('0x3d')]){_0x28340d[_0xb50c('0x3e')]=_[_0xb50c('0x3f')](_0x28340d[_0xb50c('0x3e')],{'$or':_[_0xb50c('0x2d')](_0x28340d[_0xb50c('0x35')],function(_0xe0d5f3){var _0x260261={};_0x260261[_0xe0d5f3]={'$like':'%'+_0x20a5f1[_0xb50c('0x32')]['filter']+'%'};return _0x260261;})});}_0x28340d=_['merge']({},_0x28340d,_0x20a5f1[_0xb50c('0x48')]);return _0x528415[_0xb50c('0x51')](_0x28340d);}})['then'](function(_0x414ad0){if(_0x414ad0){_0x1c02db=_0x414ad0[_0xb50c('0x38')];if(!_0x20a5f1[_0xb50c('0x32')][_0xb50c('0x39')](_0xb50c('0x3a'))){_0x28340d[_0xb50c('0x21')]=qs[_0xb50c('0x21')](_0x20a5f1[_0xb50c('0x32')][_0xb50c('0x21')]);_0x28340d[_0xb50c('0x1f')]=qs['offset'](_0x20a5f1['query']['offset']);}return _0x528415[_0xb50c('0x51')](_0x28340d);}})[_0xb50c('0x28')](function(_0x4bd16b){if(_0x4bd16b){return _0x4bd16b?{'count':_0x1c02db,'rows':_0x4bd16b}:null;}})[_0xb50c('0x28')](respondWithResult(_0x4c296e,null))[_0xb50c('0x4a')](handleError(_0x4c296e,null));};exports[_0xb50c('0x53')]=function(_0x11dc14,_0x1d73a4,_0xb896d7){var _0x3bf558={};var _0x2084f8={};var _0xf0aa8d;var _0xadd3d4;return db['DeskConfiguration'][_0xb50c('0x52')]({'where':{'id':_0x11dc14[_0xb50c('0x46')]['id']}})[_0xb50c('0x28')](handleEntityNotFound(_0x1d73a4,null))[_0xb50c('0x28')](function(_0x50c09c){if(_0x50c09c){_0xf0aa8d=_0x50c09c;_0x2084f8[_0xb50c('0x31')]=_[_0xb50c('0x33')](db['DeskField']['rawAttributes']);_0x2084f8['query']=_['keys'](_0x11dc14[_0xb50c('0x32')]);_0x2084f8[_0xb50c('0x34')]=_[_0xb50c('0x36')](_0x2084f8[_0xb50c('0x31')],_0x2084f8['query']);_0x3bf558[_0xb50c('0x35')]=_['intersection'](_0x2084f8[_0xb50c('0x31')],qs['fields'](_0x11dc14[_0xb50c('0x32')][_0xb50c('0x37')]));_0x3bf558[_0xb50c('0x35')]=_0x3bf558[_0xb50c('0x35')][_0xb50c('0x38')]?_0x3bf558[_0xb50c('0x35')]:_0x2084f8['model'];_0x3bf558[_0xb50c('0x3b')]=qs[_0xb50c('0x3c')](_0x11dc14['query'][_0xb50c('0x3c')]);_0x3bf558[_0xb50c('0x3e')]=qs['filters'](_['pick'](_0x11dc14[_0xb50c('0x32')],_0x2084f8[_0xb50c('0x34')]));if(_0x11dc14[_0xb50c('0x32')][_0xb50c('0x3d')]){_0x3bf558[_0xb50c('0x3e')]=_[_0xb50c('0x3f')](_0x3bf558['where'],{'$or':_[_0xb50c('0x2d')](_0x3bf558['attributes'],function(_0x28b623){var _0x310ae7={};_0x310ae7[_0x28b623]={'$like':'%'+_0x11dc14[_0xb50c('0x32')][_0xb50c('0x3d')]+'%'};return _0x310ae7;})});}_0x3bf558=_[_0xb50c('0x3f')]({},_0x3bf558,_0x11dc14[_0xb50c('0x48')]);return _0xf0aa8d[_0xb50c('0x53')](_0x3bf558);}})[_0xb50c('0x28')](function(_0x4eee9d){if(_0x4eee9d){_0xadd3d4=_0x4eee9d[_0xb50c('0x38')];if(!_0x11dc14['query'][_0xb50c('0x39')](_0xb50c('0x3a'))){_0x3bf558[_0xb50c('0x21')]=qs[_0xb50c('0x21')](_0x11dc14['query']['limit']);_0x3bf558[_0xb50c('0x1f')]=qs[_0xb50c('0x1f')](_0x11dc14[_0xb50c('0x32')]['offset']);}return _0xf0aa8d[_0xb50c('0x53')](_0x3bf558);}})[_0xb50c('0x28')](function(_0x32a96f){if(_0x32a96f){return _0x32a96f?{'count':_0xadd3d4,'rows':_0x32a96f}:null;}})['then'](respondWithResult(_0x1d73a4,null))[_0xb50c('0x4a')](handleError(_0x1d73a4,null));};exports[_0xb50c('0x54')]=function(_0x438ee5,_0x1d9cc2,_0x211a6a){var _0x2381bc={};var _0x412a6e={};var _0x4e0419;var _0x38018b;return db[_0xb50c('0x40')]['findOne']({'where':{'id':_0x438ee5[_0xb50c('0x46')]['id']}})[_0xb50c('0x28')](handleEntityNotFound(_0x1d9cc2,null))['then'](function(_0x21e939){if(_0x21e939){_0x4e0419=_0x21e939;_0x412a6e['model']=_[_0xb50c('0x33')](db[_0xb50c('0x55')][_0xb50c('0x47')]);_0x412a6e[_0xb50c('0x32')]=_['keys'](_0x438ee5[_0xb50c('0x32')]);_0x412a6e[_0xb50c('0x34')]=_[_0xb50c('0x36')](_0x412a6e['model'],_0x412a6e['query']);_0x2381bc[_0xb50c('0x35')]=_[_0xb50c('0x36')](_0x412a6e['model'],qs[_0xb50c('0x37')](_0x438ee5['query']['fields']));_0x2381bc[_0xb50c('0x35')]=_0x2381bc[_0xb50c('0x35')][_0xb50c('0x38')]?_0x2381bc[_0xb50c('0x35')]:_0x412a6e[_0xb50c('0x31')];_0x2381bc['order']=qs[_0xb50c('0x3c')](_0x438ee5[_0xb50c('0x32')][_0xb50c('0x3c')]);_0x2381bc[_0xb50c('0x3e')]=qs['filters'](_['pick'](_0x438ee5['query'],_0x412a6e[_0xb50c('0x34')]));if(_0x438ee5['query']['filter']){_0x2381bc[_0xb50c('0x3e')]=_[_0xb50c('0x3f')](_0x2381bc[_0xb50c('0x3e')],{'$or':_[_0xb50c('0x2d')](_0x2381bc[_0xb50c('0x35')],function(_0x1472c2){var _0x3789b3={};_0x3789b3[_0x1472c2]={'$like':'%'+_0x438ee5[_0xb50c('0x32')][_0xb50c('0x3d')]+'%'};return _0x3789b3;})});}_0x2381bc=_[_0xb50c('0x3f')]({},_0x2381bc,_0x438ee5[_0xb50c('0x48')]);return _0x4e0419[_0xb50c('0x54')](_0x2381bc);}})['then'](function(_0x402437){if(_0x402437){_0x38018b=_0x402437['length'];if(!_0x438ee5[_0xb50c('0x32')][_0xb50c('0x39')](_0xb50c('0x3a'))){_0x2381bc[_0xb50c('0x21')]=qs[_0xb50c('0x21')](_0x438ee5[_0xb50c('0x32')]['limit']);_0x2381bc[_0xb50c('0x1f')]=qs[_0xb50c('0x1f')](_0x438ee5[_0xb50c('0x32')][_0xb50c('0x1f')]);}return _0x4e0419[_0xb50c('0x54')](_0x2381bc);}})[_0xb50c('0x28')](function(_0x12a7d6){if(_0x12a7d6){return _0x12a7d6?{'count':_0x38018b,'rows':_0x12a7d6}:null;}})[_0xb50c('0x28')](respondWithResult(_0x1d9cc2,null))[_0xb50c('0x4a')](handleError(_0x1d9cc2,null));};exports[_0xb50c('0x56')]=function(_0xd4a8f7,_0x894a78,_0x25858f){if(_0xd4a8f7[_0xb50c('0x4c')]['id']){delete _0xd4a8f7[_0xb50c('0x4c')]['id'];}return db[_0xb50c('0x40')]['findOne']({'where':{'id':_0xd4a8f7['params']['id']}})[_0xb50c('0x28')](handleEntityNotFound(_0x894a78,null))[_0xb50c('0x28')](function(_0x5f1929){if(_0x5f1929){return _0x5f1929[_0xb50c('0x56')](_0xd4a8f7[_0xb50c('0x4c')]['ids']||[]);}return null;})[_0xb50c('0x28')](respondWithResult(_0x894a78,null))[_0xb50c('0x4a')](handleError(_0x894a78,null));}; \ No newline at end of file +var _0x348f=['send','index','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','params','find','body','getFields','findOne','pick','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x348f,0x16e));var _0xf348=function(_0x2c466f,_0x3692e1){_0x2c466f=_0x2c466f-0x0;var _0x46c775=_0x348f[_0x2c466f];return _0x46c775;};'use strict';var emlformat=require(_0xf348('0x0'));var rimraf=require(_0xf348('0x1'));var zipdir=require(_0xf348('0x2'));var jsonpatch=require(_0xf348('0x3'));var rp=require('request-promise');var moment=require(_0xf348('0x4'));var BPromise=require(_0xf348('0x5'));var Mustache=require('mustache');var util=require(_0xf348('0x6'));var path=require(_0xf348('0x7'));var sox=require(_0xf348('0x8'));var csv=require(_0xf348('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf348('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf348('0x9'));var querystring=require(_0xf348('0xb'));var Papa=require(_0xf348('0xc'));var Redis=require(_0xf348('0xd'));var authService=require(_0xf348('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf348('0xf'));var hardwareService=require(_0xf348('0x10'));var logger=require(_0xf348('0x11'))('api');var utils=require(_0xf348('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf348('0x13'));var db=require(_0xf348('0x14'))['db'];function respondWithStatusCode(_0x4c81ef,_0x406d0b){_0x406d0b=_0x406d0b||0xcc;return function(_0xe4594){if(_0xe4594){return _0x4c81ef[_0xf348('0x15')](_0x406d0b);}return _0x4c81ef[_0xf348('0x16')](_0x406d0b)['end']();};}function respondWithResult(_0x5e3008,_0x1dd878){_0x1dd878=_0x1dd878||0xc8;return function(_0x3bc1dc){if(_0x3bc1dc){return _0x5e3008[_0xf348('0x16')](_0x1dd878)[_0xf348('0x17')](_0x3bc1dc);}};}function respondWithFilteredResult(_0x3f6b59,_0x4d9203){return function(_0x3907a3){if(_0x3907a3){var _0x481703=typeof _0x4d9203['offset']===_0xf348('0x18')&&typeof _0x4d9203['limit']===_0xf348('0x18');var _0x45e9ae=_0x3907a3[_0xf348('0x19')];var _0x5662a8=_0x481703?0x0:_0x4d9203[_0xf348('0x1a')];var _0x3ee0e8=_0x481703?_0x3907a3['count']:_0x4d9203[_0xf348('0x1a')]+_0x4d9203[_0xf348('0x1b')];var _0x15994d;if(_0x3ee0e8>=_0x45e9ae){_0x3ee0e8=_0x45e9ae;_0x15994d=0xc8;}else{_0x15994d=0xce;}_0x3f6b59[_0xf348('0x16')](_0x15994d);return _0x3f6b59[_0xf348('0x1c')](_0xf348('0x1d'),_0x5662a8+'-'+_0x3ee0e8+'/'+_0x45e9ae)[_0xf348('0x17')](_0x3907a3);}return null;};}function patchUpdates(_0x126214){return function(_0x309726){try{jsonpatch[_0xf348('0x1e')](_0x309726,_0x126214,!![]);}catch(_0x316c7c){return BPromise[_0xf348('0x1f')](_0x316c7c);}return _0x309726[_0xf348('0x20')]();};}function saveUpdates(_0x11b94f,_0x16c80d){return function(_0x11871a){if(_0x11871a){return _0x11871a[_0xf348('0x21')](_0x11b94f)['then'](function(_0x514338){return _0x514338;});}return null;};}function removeEntity(_0x4e8a0a,_0x51c10c){return function(_0x3eec19){if(_0x3eec19){return _0x3eec19[_0xf348('0x22')]()[_0xf348('0x23')](function(){_0x4e8a0a[_0xf348('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2da69b,_0x44aef5){return function(_0x3e3113){if(!_0x3e3113){_0x2da69b[_0xf348('0x15')](0x194);}return _0x3e3113;};}function handleError(_0x239035,_0x981665){_0x981665=_0x981665||0x1f4;return function(_0x2a4401){logger[_0xf348('0x24')](_0x2a4401[_0xf348('0x25')]);if(_0x2a4401[_0xf348('0x26')]){delete _0x2a4401['name'];}_0x239035[_0xf348('0x16')](_0x981665)[_0xf348('0x27')](_0x2a4401);};}exports[_0xf348('0x28')]=function(_0x4a5d58,_0x12064c){var _0x20e703={},_0x1d20d3={},_0x31ade3={'count':0x0,'rows':[]};var _0x67ed85=_['map'](db['DeskConfiguration'][_0xf348('0x29')],function(_0x1f6e09){return{'name':_0x1f6e09['fieldName'],'type':_0x1f6e09[_0xf348('0x2a')][_0xf348('0x2b')]};});_0x1d20d3['model']=_[_0xf348('0x2c')](_0x67ed85,_0xf348('0x26'));_0x1d20d3[_0xf348('0x2d')]=_[_0xf348('0x2e')](_0x4a5d58[_0xf348('0x2d')]);_0x1d20d3['filters']=_[_0xf348('0x2f')](_0x1d20d3[_0xf348('0x30')],_0x1d20d3[_0xf348('0x2d')]);_0x20e703[_0xf348('0x31')]=_['intersection'](_0x1d20d3[_0xf348('0x30')],qs['fields'](_0x4a5d58[_0xf348('0x2d')][_0xf348('0x32')]));_0x20e703['attributes']=_0x20e703['attributes'][_0xf348('0x33')]?_0x20e703[_0xf348('0x31')]:_0x1d20d3['model'];if(!_0x4a5d58[_0xf348('0x2d')][_0xf348('0x34')](_0xf348('0x35'))){_0x20e703[_0xf348('0x1b')]=qs[_0xf348('0x1b')](_0x4a5d58['query']['limit']);_0x20e703['offset']=qs[_0xf348('0x1a')](_0x4a5d58[_0xf348('0x2d')][_0xf348('0x1a')]);}_0x20e703[_0xf348('0x36')]=qs['sort'](_0x4a5d58[_0xf348('0x2d')][_0xf348('0x37')]);_0x20e703[_0xf348('0x38')]=qs[_0xf348('0x39')](_['pick'](_0x4a5d58['query'],_0x1d20d3[_0xf348('0x39')]),_0x67ed85);if(_0x4a5d58['query'][_0xf348('0x3a')]){_0x20e703['where']=_[_0xf348('0x3b')](_0x20e703[_0xf348('0x38')],{'$or':_[_0xf348('0x2c')](_0x67ed85,function(_0x3950e2){if(_0x3950e2[_0xf348('0x2a')]!==_0xf348('0x3c')){var _0x58bca1={};_0x58bca1[_0x3950e2[_0xf348('0x26')]]={'$like':'%'+_0x4a5d58['query'][_0xf348('0x3a')]+'%'};return _0x58bca1;}})});}_0x20e703=_[_0xf348('0x3b')]({},_0x20e703,_0x4a5d58[_0xf348('0x3d')]);var _0x51d8ec={'where':_0x20e703[_0xf348('0x38')]};return db[_0xf348('0x3e')][_0xf348('0x19')](_0x51d8ec)[_0xf348('0x23')](function(_0x4f1a59){_0x31ade3['count']=_0x4f1a59;if(_0x4a5d58['query'][_0xf348('0x3f')]){_0x20e703[_0xf348('0x40')]=[{'all':!![]}];}return db[_0xf348('0x3e')][_0xf348('0x41')](_0x20e703);})[_0xf348('0x23')](function(_0x265c19){_0x31ade3[_0xf348('0x42')]=_0x265c19;return _0x31ade3;})[_0xf348('0x23')](respondWithFilteredResult(_0x12064c,_0x20e703))[_0xf348('0x43')](handleError(_0x12064c,null));};exports[_0xf348('0x44')]=function(_0x490f32,_0x1d763c){var _0x9a1f47={'raw':![],'where':{'id':_0x490f32[_0xf348('0x45')]['id']}},_0x584b53={};_0x584b53[_0xf348('0x30')]=_[_0xf348('0x2e')](db[_0xf348('0x3e')][_0xf348('0x29')]);_0x584b53[_0xf348('0x2d')]=_['keys'](_0x490f32[_0xf348('0x2d')]);_0x584b53[_0xf348('0x39')]=_['intersection'](_0x584b53[_0xf348('0x30')],_0x584b53['query']);_0x9a1f47[_0xf348('0x31')]=_[_0xf348('0x2f')](_0x584b53[_0xf348('0x30')],qs[_0xf348('0x32')](_0x490f32[_0xf348('0x2d')][_0xf348('0x32')]));_0x9a1f47[_0xf348('0x31')]=_0x9a1f47[_0xf348('0x31')]['length']?_0x9a1f47['attributes']:_0x584b53['model'];if(_0x490f32[_0xf348('0x2d')][_0xf348('0x3f')]){_0x9a1f47[_0xf348('0x40')]=[{'all':!![]}];}_0x9a1f47=_[_0xf348('0x3b')]({},_0x9a1f47,_0x490f32[_0xf348('0x3d')]);return db[_0xf348('0x3e')][_0xf348('0x46')](_0x9a1f47)['then'](handleEntityNotFound(_0x1d763c,null))['then'](respondWithResult(_0x1d763c,null))[_0xf348('0x43')](handleError(_0x1d763c,null));};exports['create']=function(_0x4db7b6,_0x33774e){return db['DeskConfiguration']['create'](_0x4db7b6[_0xf348('0x47')],{})[_0xf348('0x23')](respondWithResult(_0x33774e,0xc9))[_0xf348('0x43')](handleError(_0x33774e,null));};exports[_0xf348('0x21')]=function(_0x4927f0,_0x7b3559){if(_0x4927f0[_0xf348('0x47')]['id']){delete _0x4927f0['body']['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x4927f0['params']['id']}})['then'](handleEntityNotFound(_0x7b3559,null))[_0xf348('0x23')](saveUpdates(_0x4927f0[_0xf348('0x47')],null))[_0xf348('0x23')](respondWithResult(_0x7b3559,null))['catch'](handleError(_0x7b3559,null));};exports[_0xf348('0x22')]=function(_0x490e41,_0x20f231){return db[_0xf348('0x3e')]['find']({'where':{'id':_0x490e41[_0xf348('0x45')]['id']}})[_0xf348('0x23')](handleEntityNotFound(_0x20f231,null))[_0xf348('0x23')](removeEntity(_0x20f231,null))[_0xf348('0x43')](handleError(_0x20f231,null));};exports[_0xf348('0x48')]=function(_0x35c400,_0x2fc883,_0x4231dc){var _0x3777a9={};var _0x25cd6d={};var _0x125286;var _0x3d0f7a;return db['DeskConfiguration'][_0xf348('0x49')]({'where':{'id':_0x35c400['params']['id']}})[_0xf348('0x23')](handleEntityNotFound(_0x2fc883,null))[_0xf348('0x23')](function(_0x2dfde8){if(_0x2dfde8){_0x125286=_0x2dfde8;_0x25cd6d[_0xf348('0x30')]=_['keys'](db['DeskField'][_0xf348('0x29')]);_0x25cd6d['query']=_[_0xf348('0x2e')](_0x35c400[_0xf348('0x2d')]);_0x25cd6d['filters']=_[_0xf348('0x2f')](_0x25cd6d[_0xf348('0x30')],_0x25cd6d[_0xf348('0x2d')]);_0x3777a9[_0xf348('0x31')]=_[_0xf348('0x2f')](_0x25cd6d[_0xf348('0x30')],qs['fields'](_0x35c400[_0xf348('0x2d')][_0xf348('0x32')]));_0x3777a9[_0xf348('0x31')]=_0x3777a9[_0xf348('0x31')][_0xf348('0x33')]?_0x3777a9['attributes']:_0x25cd6d[_0xf348('0x30')];_0x3777a9[_0xf348('0x36')]=qs[_0xf348('0x37')](_0x35c400[_0xf348('0x2d')]['sort']);_0x3777a9[_0xf348('0x38')]=qs[_0xf348('0x39')](_[_0xf348('0x4a')](_0x35c400['query'],_0x25cd6d[_0xf348('0x39')]));if(_0x35c400[_0xf348('0x2d')]['filter']){_0x3777a9[_0xf348('0x38')]=_[_0xf348('0x3b')](_0x3777a9[_0xf348('0x38')],{'$or':_[_0xf348('0x2c')](_0x3777a9[_0xf348('0x31')],function(_0x8cf7e1){var _0x57c678={};_0x57c678[_0x8cf7e1]={'$like':'%'+_0x35c400[_0xf348('0x2d')]['filter']+'%'};return _0x57c678;})});}_0x3777a9=_[_0xf348('0x3b')]({},_0x3777a9,_0x35c400['options']);return _0x125286['getFields'](_0x3777a9);}})[_0xf348('0x23')](function(_0x155c3e){if(_0x155c3e){_0x3d0f7a=_0x155c3e[_0xf348('0x33')];if(!_0x35c400['query'][_0xf348('0x34')]('nolimit')){_0x3777a9[_0xf348('0x1b')]=qs[_0xf348('0x1b')](_0x35c400[_0xf348('0x2d')][_0xf348('0x1b')]);_0x3777a9[_0xf348('0x1a')]=qs[_0xf348('0x1a')](_0x35c400[_0xf348('0x2d')]['offset']);}return _0x125286[_0xf348('0x48')](_0x3777a9);}})[_0xf348('0x23')](function(_0x1087ea){if(_0x1087ea){return _0x1087ea?{'count':_0x3d0f7a,'rows':_0x1087ea}:null;}})['then'](respondWithResult(_0x2fc883,null))[_0xf348('0x43')](handleError(_0x2fc883,null));};exports[_0xf348('0x4b')]=function(_0x579d63,_0x448032,_0x39be78){var _0xc9efe2={};var _0x28ec5e={};var _0x2c7f62;var _0x20a958;return db[_0xf348('0x3e')]['findOne']({'where':{'id':_0x579d63[_0xf348('0x45')]['id']}})[_0xf348('0x23')](handleEntityNotFound(_0x448032,null))[_0xf348('0x23')](function(_0x53f0db){if(_0x53f0db){_0x2c7f62=_0x53f0db;_0x28ec5e[_0xf348('0x30')]=_['keys'](db[_0xf348('0x4c')]['rawAttributes']);_0x28ec5e[_0xf348('0x2d')]=_['keys'](_0x579d63['query']);_0x28ec5e[_0xf348('0x39')]=_[_0xf348('0x2f')](_0x28ec5e[_0xf348('0x30')],_0x28ec5e[_0xf348('0x2d')]);_0xc9efe2[_0xf348('0x31')]=_[_0xf348('0x2f')](_0x28ec5e[_0xf348('0x30')],qs[_0xf348('0x32')](_0x579d63['query'][_0xf348('0x32')]));_0xc9efe2['attributes']=_0xc9efe2[_0xf348('0x31')][_0xf348('0x33')]?_0xc9efe2['attributes']:_0x28ec5e[_0xf348('0x30')];_0xc9efe2[_0xf348('0x36')]=qs[_0xf348('0x37')](_0x579d63[_0xf348('0x2d')][_0xf348('0x37')]);_0xc9efe2[_0xf348('0x38')]=qs[_0xf348('0x39')](_[_0xf348('0x4a')](_0x579d63[_0xf348('0x2d')],_0x28ec5e['filters']));if(_0x579d63[_0xf348('0x2d')]['filter']){_0xc9efe2['where']=_[_0xf348('0x3b')](_0xc9efe2[_0xf348('0x38')],{'$or':_[_0xf348('0x2c')](_0xc9efe2[_0xf348('0x31')],function(_0x4cb6c4){var _0x2e85a1={};_0x2e85a1[_0x4cb6c4]={'$like':'%'+_0x579d63[_0xf348('0x2d')][_0xf348('0x3a')]+'%'};return _0x2e85a1;})});}_0xc9efe2=_[_0xf348('0x3b')]({},_0xc9efe2,_0x579d63[_0xf348('0x3d')]);return _0x2c7f62[_0xf348('0x4b')](_0xc9efe2);}})[_0xf348('0x23')](function(_0xd278e7){if(_0xd278e7){_0x20a958=_0xd278e7[_0xf348('0x33')];if(!_0x579d63[_0xf348('0x2d')][_0xf348('0x34')](_0xf348('0x35'))){_0xc9efe2[_0xf348('0x1b')]=qs[_0xf348('0x1b')](_0x579d63[_0xf348('0x2d')]['limit']);_0xc9efe2[_0xf348('0x1a')]=qs[_0xf348('0x1a')](_0x579d63['query'][_0xf348('0x1a')]);}return _0x2c7f62['getSubjects'](_0xc9efe2);}})[_0xf348('0x23')](function(_0x13a330){if(_0x13a330){return _0x13a330?{'count':_0x20a958,'rows':_0x13a330}:null;}})[_0xf348('0x23')](respondWithResult(_0x448032,null))[_0xf348('0x43')](handleError(_0x448032,null));};exports['getDescriptions']=function(_0x190d7e,_0x4ab331,_0x421d73){var _0x3c311c={};var _0x3296b7={};var _0x1bac9f;var _0x2e1ec4;return db['DeskConfiguration'][_0xf348('0x49')]({'where':{'id':_0x190d7e[_0xf348('0x45')]['id']}})[_0xf348('0x23')](handleEntityNotFound(_0x4ab331,null))['then'](function(_0x4914b0){if(_0x4914b0){_0x1bac9f=_0x4914b0;_0x3296b7['model']=_['keys'](db[_0xf348('0x4c')][_0xf348('0x29')]);_0x3296b7[_0xf348('0x2d')]=_[_0xf348('0x2e')](_0x190d7e['query']);_0x3296b7[_0xf348('0x39')]=_[_0xf348('0x2f')](_0x3296b7['model'],_0x3296b7['query']);_0x3c311c[_0xf348('0x31')]=_[_0xf348('0x2f')](_0x3296b7[_0xf348('0x30')],qs[_0xf348('0x32')](_0x190d7e[_0xf348('0x2d')][_0xf348('0x32')]));_0x3c311c[_0xf348('0x31')]=_0x3c311c[_0xf348('0x31')][_0xf348('0x33')]?_0x3c311c[_0xf348('0x31')]:_0x3296b7[_0xf348('0x30')];_0x3c311c['order']=qs[_0xf348('0x37')](_0x190d7e[_0xf348('0x2d')]['sort']);_0x3c311c['where']=qs[_0xf348('0x39')](_['pick'](_0x190d7e[_0xf348('0x2d')],_0x3296b7[_0xf348('0x39')]));if(_0x190d7e[_0xf348('0x2d')][_0xf348('0x3a')]){_0x3c311c[_0xf348('0x38')]=_[_0xf348('0x3b')](_0x3c311c[_0xf348('0x38')],{'$or':_[_0xf348('0x2c')](_0x3c311c[_0xf348('0x31')],function(_0x5f446b){var _0x93aeca={};_0x93aeca[_0x5f446b]={'$like':'%'+_0x190d7e[_0xf348('0x2d')][_0xf348('0x3a')]+'%'};return _0x93aeca;})});}_0x3c311c=_[_0xf348('0x3b')]({},_0x3c311c,_0x190d7e[_0xf348('0x3d')]);return _0x1bac9f[_0xf348('0x4d')](_0x3c311c);}})['then'](function(_0x294429){if(_0x294429){_0x2e1ec4=_0x294429[_0xf348('0x33')];if(!_0x190d7e[_0xf348('0x2d')][_0xf348('0x34')](_0xf348('0x35'))){_0x3c311c['limit']=qs[_0xf348('0x1b')](_0x190d7e['query']['limit']);_0x3c311c[_0xf348('0x1a')]=qs['offset'](_0x190d7e[_0xf348('0x2d')]['offset']);}return _0x1bac9f[_0xf348('0x4d')](_0x3c311c);}})[_0xf348('0x23')](function(_0x34e2ba){if(_0x34e2ba){return _0x34e2ba?{'count':_0x2e1ec4,'rows':_0x34e2ba}:null;}})[_0xf348('0x23')](respondWithResult(_0x4ab331,null))['catch'](handleError(_0x4ab331,null));};exports[_0xf348('0x4e')]=function(_0x137938,_0x41c376,_0x4294a7){var _0x3e1b87={};var _0xf7405e={};var _0x3f6182;var _0x10d707;return db[_0xf348('0x3e')][_0xf348('0x49')]({'where':{'id':_0x137938['params']['id']}})[_0xf348('0x23')](handleEntityNotFound(_0x41c376,null))[_0xf348('0x23')](function(_0x3a2978){if(_0x3a2978){_0x3f6182=_0x3a2978;_0xf7405e['model']=_['keys'](db[_0xf348('0x4f')][_0xf348('0x29')]);_0xf7405e[_0xf348('0x2d')]=_[_0xf348('0x2e')](_0x137938['query']);_0xf7405e[_0xf348('0x39')]=_[_0xf348('0x2f')](_0xf7405e[_0xf348('0x30')],_0xf7405e[_0xf348('0x2d')]);_0x3e1b87[_0xf348('0x31')]=_[_0xf348('0x2f')](_0xf7405e['model'],qs[_0xf348('0x32')](_0x137938[_0xf348('0x2d')][_0xf348('0x32')]));_0x3e1b87[_0xf348('0x31')]=_0x3e1b87[_0xf348('0x31')][_0xf348('0x33')]?_0x3e1b87[_0xf348('0x31')]:_0xf7405e[_0xf348('0x30')];_0x3e1b87[_0xf348('0x36')]=qs[_0xf348('0x37')](_0x137938['query'][_0xf348('0x37')]);_0x3e1b87['where']=qs[_0xf348('0x39')](_[_0xf348('0x4a')](_0x137938[_0xf348('0x2d')],_0xf7405e['filters']));if(_0x137938[_0xf348('0x2d')][_0xf348('0x3a')]){_0x3e1b87[_0xf348('0x38')]=_['merge'](_0x3e1b87[_0xf348('0x38')],{'$or':_['map'](_0x3e1b87[_0xf348('0x31')],function(_0x4f1450){var _0x43c2fb={};_0x43c2fb[_0x4f1450]={'$like':'%'+_0x137938[_0xf348('0x2d')][_0xf348('0x3a')]+'%'};return _0x43c2fb;})});}_0x3e1b87=_[_0xf348('0x3b')]({},_0x3e1b87,_0x137938[_0xf348('0x3d')]);return _0x3f6182[_0xf348('0x4e')](_0x3e1b87);}})[_0xf348('0x23')](function(_0x20fd94){if(_0x20fd94){_0x10d707=_0x20fd94['length'];if(!_0x137938[_0xf348('0x2d')]['hasOwnProperty'](_0xf348('0x35'))){_0x3e1b87['limit']=qs[_0xf348('0x1b')](_0x137938[_0xf348('0x2d')]['limit']);_0x3e1b87[_0xf348('0x1a')]=qs[_0xf348('0x1a')](_0x137938[_0xf348('0x2d')][_0xf348('0x1a')]);}return _0x3f6182[_0xf348('0x4e')](_0x3e1b87);}})[_0xf348('0x23')](function(_0x403de0){if(_0x403de0){return _0x403de0?{'count':_0x10d707,'rows':_0x403de0}:null;}})[_0xf348('0x23')](respondWithResult(_0x41c376,null))['catch'](handleError(_0x41c376,null));};exports[_0xf348('0x50')]=function(_0x479a41,_0x233690,_0x16bc55){if(_0x479a41['body']['id']){delete _0x479a41[_0xf348('0x47')]['id'];}return db[_0xf348('0x3e')][_0xf348('0x49')]({'where':{'id':_0x479a41[_0xf348('0x45')]['id']}})[_0xf348('0x23')](handleEntityNotFound(_0x233690,null))[_0xf348('0x23')](function(_0x459b75){if(_0x459b75){return _0x459b75['setTags'](_0x479a41['body']['ids']||[]);}return null;})[_0xf348('0x23')](respondWithResult(_0x233690,null))['catch'](handleError(_0x233690,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 51c6e3f..143ea21 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 _0xfa47=['DeskConfiguration','int_desk_configurations','lodash','util','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x3add6d,_0x2d9c64){var _0x1e7817=function(_0x4394f8){while(--_0x4394f8){_0x3add6d['push'](_0x3add6d['shift']());}};_0x1e7817(++_0x2d9c64);}(_0xfa47,0x1db));var _0x7fa4=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xfa47[_0x39e283];return _0x7de89f;};'use strict';var _=require(_0x7fa4('0x0'));var util=require(_0x7fa4('0x1'));var logger=require('../../config/logger')(_0x7fa4('0x2'));var moment=require(_0x7fa4('0x3'));var BPromise=require(_0x7fa4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7fa4('0x5'));var rimraf=require('rimraf');var config=require(_0x7fa4('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x7fa4('0x7')]=function(_0x14299e,_0x40f33b){return _0x14299e[_0x7fa4('0x8')](_0x7fa4('0x9'),attributes,{'tableName':_0x7fa4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e9e=['path','rimraf','../../config/environment','exports','DeskConfiguration','int_desk_configurations','lodash','util','api','moment','request-promise'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0x5e9e,0x145));var _0xe5e9=function(_0x37ef22,_0x348c92){_0x37ef22=_0x37ef22-0x0;var _0x49eeb3=_0x5e9e[_0x37ef22];return _0x49eeb3;};'use strict';var _=require(_0xe5e9('0x0'));var util=require(_0xe5e9('0x1'));var logger=require('../../config/logger')(_0xe5e9('0x2'));var moment=require(_0xe5e9('0x3'));var BPromise=require('bluebird');var rp=require(_0xe5e9('0x4'));var fs=require('fs');var path=require(_0xe5e9('0x5'));var rimraf=require(_0xe5e9('0x6'));var config=require(_0xe5e9('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0xe5e9('0x8')]=function(_0x4eb5ef,_0x65419a){return _0x4eb5ef['define'](_0xe5e9('0x9'),attributes,{'tableName':_0xe5e9('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 e89a87f..20146d1 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 _0x6075=['debug','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent'];(function(_0x110afc,_0x4f67ad){var _0x33c91e=function(_0x458167){while(--_0x458167){_0x110afc['push'](_0x110afc['shift']());}};_0x33c91e(++_0x4f67ad);}(_0x6075,0x126));var _0x5607=function(_0x27bc0d,_0x599006){_0x27bc0d=_0x27bc0d-0x0;var _0x119483=_0x6075[_0x27bc0d];return _0x119483;};'use strict';var _=require(_0x5607('0x0'));var util=require('util');var moment=require(_0x5607('0x1'));var BPromise=require(_0x5607('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5607('0x3'));var db=require(_0x5607('0x4'))['db'];var utils=require(_0x5607('0x5'));var logger=require(_0x5607('0x6'))(_0x5607('0x7'));var config=require(_0x5607('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5607('0x9')][_0x5607('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x62e02,_0x2d0e25,_0x14a86c){return new BPromise(function(_0x1be57d,_0x188e92){return client[_0x5607('0xb')](_0x62e02,_0x14a86c)['then'](function(_0x4188c7){logger[_0x5607('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x2d0e25,_0x5607('0xd'));logger[_0x5607('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2d0e25,_0x5607('0xd'),JSON[_0x5607('0xf')](_0x4188c7));if(_0x4188c7[_0x5607('0x10')]){if(_0x4188c7[_0x5607('0x10')][_0x5607('0x11')]===0x1f4){logger[_0x5607('0x10')](_0x5607('0x12'),_0x2d0e25,_0x4188c7[_0x5607('0x10')][_0x5607('0x13')]);return _0x188e92(_0x4188c7[_0x5607('0x10')][_0x5607('0x13')]);}logger[_0x5607('0x10')](_0x5607('0x12'),_0x2d0e25,_0x4188c7['error'][_0x5607('0x13')]);return _0x1be57d(_0x4188c7['error'][_0x5607('0x13')]);}else{logger[_0x5607('0xc')](_0x5607('0x12'),_0x2d0e25,_0x5607('0xd'));_0x1be57d(_0x4188c7[_0x5607('0x14')]['message']);}})[_0x5607('0x15')](function(_0x1ce81a){logger[_0x5607('0x10')](_0x5607('0x12'),_0x2d0e25,_0x1ce81a);_0x188e92(_0x1ce81a);});});} \ No newline at end of file +var _0x4201=['debug','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','request\x20sent'];(function(_0x55c40f,_0x867562){var _0x241ce8=function(_0x514ed6){while(--_0x514ed6){_0x55c40f['push'](_0x55c40f['shift']());}};_0x241ce8(++_0x867562);}(_0x4201,0x71));var _0x1420=function(_0x5cc30e,_0x2646b6){_0x5cc30e=_0x5cc30e-0x0;var _0x208c6d=_0x4201[_0x5cc30e];return _0x208c6d;};'use strict';var _=require(_0x1420('0x0'));var util=require(_0x1420('0x1'));var moment=require('moment');var BPromise=require(_0x1420('0x2'));var rs=require(_0x1420('0x3'));var fs=require('fs');var Redis=require(_0x1420('0x4'));var db=require(_0x1420('0x5'))['db'];var utils=require(_0x1420('0x6'));var logger=require(_0x1420('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1420('0x8'));var client=jayson[_0x1420('0x9')][_0x1420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a8ba,_0x239e16,_0x59ddc5){return new BPromise(function(_0x5a925c,_0x46d303){return client[_0x1420('0xb')](_0x35a8ba,_0x59ddc5)['then'](function(_0x1d52ff){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x239e16,_0x1420('0xc'));logger[_0x1420('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x239e16,_0x1420('0xc'),JSON[_0x1420('0xe')](_0x1d52ff));if(_0x1d52ff[_0x1420('0xf')]){if(_0x1d52ff[_0x1420('0xf')][_0x1420('0x10')]===0x1f4){logger[_0x1420('0xf')](_0x1420('0x11'),_0x239e16,_0x1d52ff[_0x1420('0xf')]['message']);return _0x46d303(_0x1d52ff['error']['message']);}logger['error'](_0x1420('0x11'),_0x239e16,_0x1d52ff[_0x1420('0xf')][_0x1420('0x12')]);return _0x5a925c(_0x1d52ff[_0x1420('0xf')][_0x1420('0x12')]);}else{logger[_0x1420('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x239e16,'request\x20sent');_0x5a925c(_0x1d52ff[_0x1420('0x14')]['message']);}})['catch'](function(_0x231659){logger[_0x1420('0xf')](_0x1420('0x11'),_0x239e16,_0x231659);_0x46d303(_0x231659);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index dc8206f..ca5ba34 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 _0x7014=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','/:id','isAuthenticated','post','create','update'];(function(_0x137edd,_0x532881){var _0x23df5e=function(_0x4e3f34){while(--_0x4e3f34){_0x137edd['push'](_0x137edd['shift']());}};_0x23df5e(++_0x532881);}(_0x7014,0xec));var _0x4701=function(_0xd11da5,_0x4cda97){_0xd11da5=_0xd11da5-0x0;var _0x2e0ce9=_0x7014[_0xd11da5];return _0x2e0ce9;};'use strict';var multer=require(_0x4701('0x0'));var util=require(_0x4701('0x1'));var path=require(_0x4701('0x2'));var timeout=require(_0x4701('0x3'));var express=require('express');var router=express[_0x4701('0x4')]();var fs_extra=require(_0x4701('0x5'));var auth=require(_0x4701('0x6'));var interaction=require(_0x4701('0x7'));var config=require(_0x4701('0x8'));var controller=require(_0x4701('0x9'));router[_0x4701('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4701('0xa')](_0x4701('0xb'),auth[_0x4701('0xc')](),controller['show']);router[_0x4701('0xd')]('/',auth[_0x4701('0xc')](),controller[_0x4701('0xe')]);router['put']('/:id',auth[_0x4701('0xc')](),controller[_0x4701('0xf')]);router[_0x4701('0x10')](_0x4701('0xb'),auth[_0x4701('0xc')](),controller[_0x4701('0x11')]);module['exports']=router; \ No newline at end of file +var _0x221c=['index','/:id','create','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated'];(function(_0x46612e,_0x9ed8d2){var _0x4ec3d9=function(_0x1d80b6){while(--_0x1d80b6){_0x46612e['push'](_0x46612e['shift']());}};_0x4ec3d9(++_0x9ed8d2);}(_0x221c,0x17c));var _0xc221=function(_0x45944a,_0x18827c){_0x45944a=_0x45944a-0x0;var _0x28df7d=_0x221c[_0x45944a];return _0x28df7d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc221('0x0'));var timeout=require(_0xc221('0x1'));var express=require(_0xc221('0x2'));var router=express[_0xc221('0x3')]();var fs_extra=require(_0xc221('0x4'));var auth=require(_0xc221('0x5'));var interaction=require(_0xc221('0x6'));var config=require(_0xc221('0x7'));var controller=require(_0xc221('0x8'));router[_0xc221('0x9')]('/',auth[_0xc221('0xa')](),controller[_0xc221('0xb')]);router['get'](_0xc221('0xc'),auth[_0xc221('0xa')](),controller['show']);router['post']('/',auth[_0xc221('0xa')](),controller[_0xc221('0xd')]);router['put'](_0xc221('0xc'),auth[_0xc221('0xa')](),controller[_0xc221('0xe')]);router['delete']('/:id',auth[_0xc221('0xa')](),controller[_0xc221('0xf')]);module[_0xc221('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 a79c028..2928c35 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 _0x2532=['ENUM','string','customVariable','STRING','variable','sequelize'];(function(_0x382760,_0x59c55f){var _0x3ca405=function(_0x21fae1){while(--_0x21fae1){_0x382760['push'](_0x382760['shift']());}};_0x3ca405(++_0x59c55f);}(_0x2532,0x155));var _0x2253=function(_0x77d3c4,_0x3a735f){_0x77d3c4=_0x77d3c4-0x0;var _0x234932=_0x2532[_0x77d3c4];return _0x234932;};'use strict';var Sequelize=require(_0x2253('0x0'));module['exports']={'type':{'type':Sequelize[_0x2253('0x1')](_0x2253('0x2'),'variable',_0x2253('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2253('0x4')]},'key':{'type':Sequelize[_0x2253('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x2253('0x2'),_0x2253('0x5'),_0x2253('0x3'))},'keyContent':{'type':Sequelize[_0x2253('0x4')]},'idField':{'type':Sequelize[_0x2253('0x4')]},'nameField':{'type':Sequelize[_0x2253('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2253('0x4')]}}; \ No newline at end of file +var _0xbcd1=['ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist','STRING'];(function(_0x7cb5eb,_0x40e72c){var _0x5006df=function(_0x282b85){while(--_0x282b85){_0x7cb5eb['push'](_0x7cb5eb['shift']());}};_0x5006df(++_0x40e72c);}(_0xbcd1,0x89));var _0x1bcd=function(_0x6be029,_0x1ebc18){_0x6be029=_0x6be029-0x0;var _0xe2df60=_0xbcd1[_0x6be029];return _0xe2df60;};'use strict';var Sequelize=require(_0x1bcd('0x0'));module[_0x1bcd('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x1bcd('0x2'),_0x1bcd('0x3'),_0x1bcd('0x4'),_0x1bcd('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1bcd('0x6')]},'key':{'type':Sequelize[_0x1bcd('0x6')]},'keyType':{'type':Sequelize[_0x1bcd('0x7')]('string',_0x1bcd('0x2'),_0x1bcd('0x3'))},'keyContent':{'type':Sequelize[_0x1bcd('0x6')]},'idField':{'type':Sequelize[_0x1bcd('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1bcd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1bcd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index a4d809d..d2dd39b 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 _0xa899=['../../config/environment','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','end','sendStatus','error','name','index','map','DeskField','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa899,0x155));var _0x9a89=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0xa899[_0x33554b];return _0x256954;};'use strict';var emlformat=require(_0x9a89('0x0'));var rimraf=require(_0x9a89('0x1'));var zipdir=require(_0x9a89('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a89('0x3'));var moment=require(_0x9a89('0x4'));var BPromise=require(_0x9a89('0x5'));var Mustache=require(_0x9a89('0x6'));var util=require(_0x9a89('0x7'));var path=require(_0x9a89('0x8'));var sox=require(_0x9a89('0x9'));var csv=require(_0x9a89('0xa'));var ejs=require(_0x9a89('0xb'));var fs=require('fs');var fs_extra=require(_0x9a89('0xc'));var _=require(_0x9a89('0xd'));var squel=require(_0x9a89('0xe'));var crypto=require(_0x9a89('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9a89('0xa'));var querystring=require(_0x9a89('0x10'));var Papa=require('papaparse');var Redis=require(_0x9a89('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9a89('0x12'));var as=require(_0x9a89('0x13'));var hardwareService=require(_0x9a89('0x14'));var logger=require(_0x9a89('0x15'))(_0x9a89('0x16'));var utils=require(_0x9a89('0x17'));var config=require(_0x9a89('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4342c8,_0x8b7403){_0x8b7403=_0x8b7403||0xcc;return function(_0x2bdb0d){if(_0x2bdb0d){return _0x4342c8['sendStatus'](_0x8b7403);}return _0x4342c8['status'](_0x8b7403)['end']();};}function respondWithResult(_0x1c66a3,_0xf08a5a){_0xf08a5a=_0xf08a5a||0xc8;return function(_0x5720a2){if(_0x5720a2){return _0x1c66a3[_0x9a89('0x19')](_0xf08a5a)[_0x9a89('0x1a')](_0x5720a2);}};}function respondWithFilteredResult(_0x33a08f,_0x203ee9){return function(_0x597e58){if(_0x597e58){var _0x11a933=typeof _0x203ee9[_0x9a89('0x1b')]==='undefined'&&typeof _0x203ee9['limit']===_0x9a89('0x1c');var _0x4a15f1=_0x597e58[_0x9a89('0x1d')];var _0x334725=_0x11a933?0x0:_0x203ee9['offset'];var _0xdbb337=_0x11a933?_0x597e58['count']:_0x203ee9[_0x9a89('0x1b')]+_0x203ee9[_0x9a89('0x1e')];var _0x54c45d;if(_0xdbb337>=_0x4a15f1){_0xdbb337=_0x4a15f1;_0x54c45d=0xc8;}else{_0x54c45d=0xce;}_0x33a08f[_0x9a89('0x19')](_0x54c45d);return _0x33a08f[_0x9a89('0x1f')](_0x9a89('0x20'),_0x334725+'-'+_0xdbb337+'/'+_0x4a15f1)[_0x9a89('0x1a')](_0x597e58);}return null;};}function patchUpdates(_0x66f8c7){return function(_0x146ec0){try{jsonpatch[_0x9a89('0x21')](_0x146ec0,_0x66f8c7,!![]);}catch(_0x1548db){return BPromise['reject'](_0x1548db);}return _0x146ec0['save']();};}function saveUpdates(_0x1ef5ef,_0x330121){return function(_0xea8910){if(_0xea8910){return _0xea8910[_0x9a89('0x22')](_0x1ef5ef)[_0x9a89('0x23')](function(_0x3cc288){return _0x3cc288;});}return null;};}function removeEntity(_0x4ac234,_0x50adcf){return function(_0x42c5ee){if(_0x42c5ee){return _0x42c5ee['destroy']()[_0x9a89('0x23')](function(){_0x4ac234[_0x9a89('0x19')](0xcc)[_0x9a89('0x24')]();});}};}function handleEntityNotFound(_0x3b1807,_0x423a1d){return function(_0x35032a){if(!_0x35032a){_0x3b1807[_0x9a89('0x25')](0x194);}return _0x35032a;};}function handleError(_0x4d7876,_0x1a5005){_0x1a5005=_0x1a5005||0x1f4;return function(_0x5002a2){logger[_0x9a89('0x26')](_0x5002a2['stack']);if(_0x5002a2['name']){delete _0x5002a2[_0x9a89('0x27')];}_0x4d7876[_0x9a89('0x19')](_0x1a5005)['send'](_0x5002a2);};}exports[_0x9a89('0x28')]=function(_0x5abe70,_0x27f442){var _0x365e34={},_0x267512={},_0x2d019e={'count':0x0,'rows':[]};var _0x2324c0=_[_0x9a89('0x29')](db[_0x9a89('0x2a')]['rawAttributes'],function(_0x4df9f2){return{'name':_0x4df9f2['fieldName'],'type':_0x4df9f2[_0x9a89('0x2b')]['key']};});_0x267512[_0x9a89('0x2c')]=_[_0x9a89('0x29')](_0x2324c0,_0x9a89('0x27'));_0x267512['query']=_[_0x9a89('0x2d')](_0x5abe70['query']);_0x267512[_0x9a89('0x2e')]=_[_0x9a89('0x2f')](_0x267512[_0x9a89('0x2c')],_0x267512[_0x9a89('0x30')]);_0x365e34[_0x9a89('0x31')]=_['intersection'](_0x267512[_0x9a89('0x2c')],qs[_0x9a89('0x32')](_0x5abe70[_0x9a89('0x30')][_0x9a89('0x32')]));_0x365e34[_0x9a89('0x31')]=_0x365e34[_0x9a89('0x31')][_0x9a89('0x33')]?_0x365e34[_0x9a89('0x31')]:_0x267512[_0x9a89('0x2c')];if(!_0x5abe70['query'][_0x9a89('0x34')](_0x9a89('0x35'))){_0x365e34[_0x9a89('0x1e')]=qs[_0x9a89('0x1e')](_0x5abe70[_0x9a89('0x30')][_0x9a89('0x1e')]);_0x365e34[_0x9a89('0x1b')]=qs[_0x9a89('0x1b')](_0x5abe70[_0x9a89('0x30')][_0x9a89('0x1b')]);}_0x365e34['order']=qs[_0x9a89('0x36')](_0x5abe70[_0x9a89('0x30')][_0x9a89('0x36')]);_0x365e34[_0x9a89('0x37')]=qs[_0x9a89('0x2e')](_[_0x9a89('0x38')](_0x5abe70[_0x9a89('0x30')],_0x267512[_0x9a89('0x2e')]),_0x2324c0);if(_0x5abe70[_0x9a89('0x30')][_0x9a89('0x39')]){_0x365e34[_0x9a89('0x37')]=_[_0x9a89('0x3a')](_0x365e34['where'],{'$or':_[_0x9a89('0x29')](_0x2324c0,function(_0x4a26e7){if(_0x4a26e7[_0x9a89('0x2b')]!==_0x9a89('0x3b')){var _0x26112d={};_0x26112d[_0x4a26e7[_0x9a89('0x27')]]={'$like':'%'+_0x5abe70[_0x9a89('0x30')][_0x9a89('0x39')]+'%'};return _0x26112d;}})});}_0x365e34=_[_0x9a89('0x3a')]({},_0x365e34,_0x5abe70[_0x9a89('0x3c')]);var _0x192138={'where':_0x365e34['where']};return db[_0x9a89('0x2a')][_0x9a89('0x1d')](_0x192138)[_0x9a89('0x23')](function(_0x20c53b){_0x2d019e['count']=_0x20c53b;if(_0x5abe70['query'][_0x9a89('0x3d')]){_0x365e34['include']=[{'all':!![]}];}return db[_0x9a89('0x2a')][_0x9a89('0x3e')](_0x365e34);})[_0x9a89('0x23')](function(_0x34885f){_0x2d019e[_0x9a89('0x3f')]=_0x34885f;return _0x2d019e;})[_0x9a89('0x23')](respondWithFilteredResult(_0x27f442,_0x365e34))[_0x9a89('0x40')](handleError(_0x27f442,null));};exports[_0x9a89('0x41')]=function(_0x5e592b,_0x4c4f2c){var _0x4fe28a={'raw':!![],'where':{'id':_0x5e592b['params']['id']}},_0x1d3545={};_0x1d3545['model']=_[_0x9a89('0x2d')](db[_0x9a89('0x2a')][_0x9a89('0x42')]);_0x1d3545['query']=_[_0x9a89('0x2d')](_0x5e592b['query']);_0x1d3545[_0x9a89('0x2e')]=_['intersection'](_0x1d3545[_0x9a89('0x2c')],_0x1d3545[_0x9a89('0x30')]);_0x4fe28a[_0x9a89('0x31')]=_['intersection'](_0x1d3545[_0x9a89('0x2c')],qs[_0x9a89('0x32')](_0x5e592b[_0x9a89('0x30')]['fields']));_0x4fe28a['attributes']=_0x4fe28a[_0x9a89('0x31')]['length']?_0x4fe28a[_0x9a89('0x31')]:_0x1d3545[_0x9a89('0x2c')];if(_0x5e592b['query'][_0x9a89('0x3d')]){_0x4fe28a[_0x9a89('0x43')]=[{'all':!![]}];}_0x4fe28a=_['merge']({},_0x4fe28a,_0x5e592b['options']);return db[_0x9a89('0x2a')][_0x9a89('0x44')](_0x4fe28a)['then'](handleEntityNotFound(_0x4c4f2c,null))[_0x9a89('0x23')](respondWithResult(_0x4c4f2c,null))['catch'](handleError(_0x4c4f2c,null));};exports[_0x9a89('0x45')]=function(_0x2d58d4,_0x31f48){return db[_0x9a89('0x2a')][_0x9a89('0x45')](_0x2d58d4['body'],{})[_0x9a89('0x23')](respondWithResult(_0x31f48,0xc9))['catch'](handleError(_0x31f48,null));};exports[_0x9a89('0x22')]=function(_0xc007aa,_0x58196c){if(_0xc007aa[_0x9a89('0x46')]['id']){delete _0xc007aa[_0x9a89('0x46')]['id'];}return db[_0x9a89('0x2a')][_0x9a89('0x44')]({'where':{'id':_0xc007aa[_0x9a89('0x47')]['id']}})[_0x9a89('0x23')](handleEntityNotFound(_0x58196c,null))[_0x9a89('0x23')](saveUpdates(_0xc007aa[_0x9a89('0x46')],null))[_0x9a89('0x23')](respondWithResult(_0x58196c,null))[_0x9a89('0x40')](handleError(_0x58196c,null));};exports[_0x9a89('0x48')]=function(_0x5abc42,_0x3546ba){return db[_0x9a89('0x2a')][_0x9a89('0x44')]({'where':{'id':_0x5abc42['params']['id']}})[_0x9a89('0x23')](handleEntityNotFound(_0x3546ba,null))[_0x9a89('0x23')](removeEntity(_0x3546ba,null))['catch'](handleError(_0x3546ba,null));}; \ No newline at end of file +var _0xb76d=['path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','findAll','catch','params','filters','intersection','includeAll','include','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x3d5709,_0x1318fd){var _0x409bb5=function(_0x3c4e3c){while(--_0x3c4e3c){_0x3d5709['push'](_0x3d5709['shift']());}};_0x409bb5(++_0x1318fd);}(_0xb76d,0x119));var _0xdb76=function(_0x1f9055,_0xe7a919){_0x1f9055=_0x1f9055-0x0;var _0x576999=_0xb76d[_0x1f9055];return _0x576999;};'use strict';var emlformat=require(_0xdb76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb76('0x1'));var jsonpatch=require(_0xdb76('0x2'));var rp=require(_0xdb76('0x3'));var moment=require('moment');var BPromise=require(_0xdb76('0x4'));var Mustache=require(_0xdb76('0x5'));var util=require(_0xdb76('0x6'));var path=require(_0xdb76('0x7'));var sox=require(_0xdb76('0x8'));var csv=require(_0xdb76('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb76('0xa'));var _=require(_0xdb76('0xb'));var squel=require(_0xdb76('0xc'));var crypto=require(_0xdb76('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdb76('0xe'));var toCsv=require(_0xdb76('0x9'));var querystring=require('querystring');var Papa=require(_0xdb76('0xf'));var Redis=require(_0xdb76('0x10'));var authService=require(_0xdb76('0x11'));var qs=require(_0xdb76('0x12'));var as=require(_0xdb76('0x13'));var hardwareService=require(_0xdb76('0x14'));var logger=require(_0xdb76('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xdb76('0x16'));var licenseUtil=require(_0xdb76('0x17'));var db=require(_0xdb76('0x18'))['db'];function respondWithStatusCode(_0x579435,_0x4efbbd){_0x4efbbd=_0x4efbbd||0xcc;return function(_0x35c8ba){if(_0x35c8ba){return _0x579435['sendStatus'](_0x4efbbd);}return _0x579435[_0xdb76('0x19')](_0x4efbbd)['end']();};}function respondWithResult(_0x4d2970,_0xcc589e){_0xcc589e=_0xcc589e||0xc8;return function(_0x28d3a5){if(_0x28d3a5){return _0x4d2970[_0xdb76('0x19')](_0xcc589e)[_0xdb76('0x1a')](_0x28d3a5);}};}function respondWithFilteredResult(_0x4e6963,_0x7fd0ef){return function(_0x2f1e41){if(_0x2f1e41){var _0x5a1017=typeof _0x7fd0ef[_0xdb76('0x1b')]===_0xdb76('0x1c')&&typeof _0x7fd0ef[_0xdb76('0x1d')]===_0xdb76('0x1c');var _0x388fb0=_0x2f1e41[_0xdb76('0x1e')];var _0x557649=_0x5a1017?0x0:_0x7fd0ef[_0xdb76('0x1b')];var _0x11ae59=_0x5a1017?_0x2f1e41[_0xdb76('0x1e')]:_0x7fd0ef['offset']+_0x7fd0ef[_0xdb76('0x1d')];var _0xf06f1c;if(_0x11ae59>=_0x388fb0){_0x11ae59=_0x388fb0;_0xf06f1c=0xc8;}else{_0xf06f1c=0xce;}_0x4e6963[_0xdb76('0x19')](_0xf06f1c);return _0x4e6963['set'](_0xdb76('0x1f'),_0x557649+'-'+_0x11ae59+'/'+_0x388fb0)[_0xdb76('0x1a')](_0x2f1e41);}return null;};}function patchUpdates(_0x3c786c){return function(_0x468cd1){try{jsonpatch[_0xdb76('0x20')](_0x468cd1,_0x3c786c,!![]);}catch(_0xa574d4){return BPromise[_0xdb76('0x21')](_0xa574d4);}return _0x468cd1[_0xdb76('0x22')]();};}function saveUpdates(_0x54706a,_0x389668){return function(_0x3718e1){if(_0x3718e1){return _0x3718e1[_0xdb76('0x23')](_0x54706a)[_0xdb76('0x24')](function(_0x560433){return _0x560433;});}return null;};}function removeEntity(_0xd3f54f,_0x5cbf51){return function(_0x12f479){if(_0x12f479){return _0x12f479[_0xdb76('0x25')]()[_0xdb76('0x24')](function(){_0xd3f54f[_0xdb76('0x19')](0xcc)[_0xdb76('0x26')]();});}};}function handleEntityNotFound(_0x25d904,_0xec9e4b){return function(_0x168dc4){if(!_0x168dc4){_0x25d904[_0xdb76('0x27')](0x194);}return _0x168dc4;};}function handleError(_0x4534b5,_0x1244b9){_0x1244b9=_0x1244b9||0x1f4;return function(_0x51f919){logger[_0xdb76('0x28')](_0x51f919['stack']);if(_0x51f919[_0xdb76('0x29')]){delete _0x51f919[_0xdb76('0x29')];}_0x4534b5[_0xdb76('0x19')](_0x1244b9)['send'](_0x51f919);};}exports['index']=function(_0x1ffce7,_0xa68943){var _0x258df1={},_0x53ec87={},_0x309cc0={'count':0x0,'rows':[]};var _0x6600a1=_[_0xdb76('0x2a')](db[_0xdb76('0x2b')][_0xdb76('0x2c')],function(_0x13b7a0){return{'name':_0x13b7a0[_0xdb76('0x2d')],'type':_0x13b7a0[_0xdb76('0x2e')][_0xdb76('0x2f')]};});_0x53ec87[_0xdb76('0x30')]=_['map'](_0x6600a1,_0xdb76('0x29'));_0x53ec87[_0xdb76('0x31')]=_[_0xdb76('0x32')](_0x1ffce7[_0xdb76('0x31')]);_0x53ec87['filters']=_['intersection'](_0x53ec87[_0xdb76('0x30')],_0x53ec87[_0xdb76('0x31')]);_0x258df1[_0xdb76('0x33')]=_['intersection'](_0x53ec87['model'],qs[_0xdb76('0x34')](_0x1ffce7['query']['fields']));_0x258df1[_0xdb76('0x33')]=_0x258df1[_0xdb76('0x33')][_0xdb76('0x35')]?_0x258df1[_0xdb76('0x33')]:_0x53ec87[_0xdb76('0x30')];if(!_0x1ffce7['query']['hasOwnProperty'](_0xdb76('0x36'))){_0x258df1[_0xdb76('0x1d')]=qs[_0xdb76('0x1d')](_0x1ffce7['query']['limit']);_0x258df1[_0xdb76('0x1b')]=qs[_0xdb76('0x1b')](_0x1ffce7[_0xdb76('0x31')][_0xdb76('0x1b')]);}_0x258df1[_0xdb76('0x37')]=qs[_0xdb76('0x38')](_0x1ffce7[_0xdb76('0x31')][_0xdb76('0x38')]);_0x258df1[_0xdb76('0x39')]=qs['filters'](_[_0xdb76('0x3a')](_0x1ffce7[_0xdb76('0x31')],_0x53ec87['filters']),_0x6600a1);if(_0x1ffce7[_0xdb76('0x31')][_0xdb76('0x3b')]){_0x258df1[_0xdb76('0x39')]=_[_0xdb76('0x3c')](_0x258df1[_0xdb76('0x39')],{'$or':_[_0xdb76('0x2a')](_0x6600a1,function(_0x16769c){if(_0x16769c['type']!=='VIRTUAL'){var _0x2aa60d={};_0x2aa60d[_0x16769c[_0xdb76('0x29')]]={'$like':'%'+_0x1ffce7['query'][_0xdb76('0x3b')]+'%'};return _0x2aa60d;}})});}_0x258df1=_['merge']({},_0x258df1,_0x1ffce7[_0xdb76('0x3d')]);var _0x363976={'where':_0x258df1['where']};return db[_0xdb76('0x2b')][_0xdb76('0x1e')](_0x363976)[_0xdb76('0x24')](function(_0x1cd77e){_0x309cc0[_0xdb76('0x1e')]=_0x1cd77e;if(_0x1ffce7[_0xdb76('0x31')]['includeAll']){_0x258df1['include']=[{'all':!![]}];}return db['DeskField'][_0xdb76('0x3e')](_0x258df1);})[_0xdb76('0x24')](function(_0x8c79e6){_0x309cc0['rows']=_0x8c79e6;return _0x309cc0;})['then'](respondWithFilteredResult(_0xa68943,_0x258df1))[_0xdb76('0x3f')](handleError(_0xa68943,null));};exports['show']=function(_0x588c50,_0x5259c3){var _0x66dd8d={'raw':!![],'where':{'id':_0x588c50[_0xdb76('0x40')]['id']}},_0x92f567={};_0x92f567[_0xdb76('0x30')]=_['keys'](db[_0xdb76('0x2b')][_0xdb76('0x2c')]);_0x92f567[_0xdb76('0x31')]=_['keys'](_0x588c50['query']);_0x92f567[_0xdb76('0x41')]=_[_0xdb76('0x42')](_0x92f567[_0xdb76('0x30')],_0x92f567['query']);_0x66dd8d['attributes']=_[_0xdb76('0x42')](_0x92f567[_0xdb76('0x30')],qs[_0xdb76('0x34')](_0x588c50[_0xdb76('0x31')][_0xdb76('0x34')]));_0x66dd8d[_0xdb76('0x33')]=_0x66dd8d[_0xdb76('0x33')]['length']?_0x66dd8d[_0xdb76('0x33')]:_0x92f567['model'];if(_0x588c50[_0xdb76('0x31')][_0xdb76('0x43')]){_0x66dd8d[_0xdb76('0x44')]=[{'all':!![]}];}_0x66dd8d=_['merge']({},_0x66dd8d,_0x588c50[_0xdb76('0x3d')]);return db[_0xdb76('0x2b')]['find'](_0x66dd8d)['then'](handleEntityNotFound(_0x5259c3,null))[_0xdb76('0x24')](respondWithResult(_0x5259c3,null))[_0xdb76('0x3f')](handleError(_0x5259c3,null));};exports[_0xdb76('0x45')]=function(_0x4be87e,_0x26c062){return db[_0xdb76('0x2b')][_0xdb76('0x45')](_0x4be87e['body'],{})[_0xdb76('0x24')](respondWithResult(_0x26c062,0xc9))[_0xdb76('0x3f')](handleError(_0x26c062,null));};exports[_0xdb76('0x23')]=function(_0x31e5fd,_0x265d9c){if(_0x31e5fd['body']['id']){delete _0x31e5fd[_0xdb76('0x46')]['id'];}return db[_0xdb76('0x2b')][_0xdb76('0x47')]({'where':{'id':_0x31e5fd[_0xdb76('0x40')]['id']}})[_0xdb76('0x24')](handleEntityNotFound(_0x265d9c,null))['then'](saveUpdates(_0x31e5fd[_0xdb76('0x46')],null))[_0xdb76('0x24')](respondWithResult(_0x265d9c,null))[_0xdb76('0x3f')](handleError(_0x265d9c,null));};exports[_0xdb76('0x25')]=function(_0x14a780,_0x199186){return db['DeskField'][_0xdb76('0x47')]({'where':{'id':_0x14a780[_0xdb76('0x40')]['id']}})[_0xdb76('0x24')](handleEntityNotFound(_0x199186,null))[_0xdb76('0x24')](removeEntity(_0x199186,null))[_0xdb76('0x3f')](handleError(_0x199186,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index eefe977..34267d3 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 _0x91af=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intDeskField.attributes','DeskField','int_desk_fields','idField','FieldId','lodash','util'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0x91af,0x1ec));var _0xf91a=function(_0xce9abc,_0x50cfb8){_0xce9abc=_0xce9abc-0x0;var _0x25b8bb=_0x91af[_0xce9abc];return _0x25b8bb;};'use strict';var _=require(_0xf91a('0x0'));var util=require(_0xf91a('0x1'));var logger=require(_0xf91a('0x2'))(_0xf91a('0x3'));var moment=require(_0xf91a('0x4'));var BPromise=require('bluebird');var rp=require(_0xf91a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf91a('0x6'));var config=require(_0xf91a('0x7'));var attributes=require(_0xf91a('0x8'));module['exports']=function(_0x494ce8,_0x17b3a6){return _0x494ce8['define'](_0xf91a('0x9'),attributes,{'tableName':_0xf91a('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xf91a('0xb'),_0xf91a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x662f=['rimraf','exports','DeskField','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0x662f,0x1f4));var _0xf662=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x662f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf662('0x0'));var util=require(_0xf662('0x1'));var logger=require(_0xf662('0x2'))(_0xf662('0x3'));var moment=require(_0xf662('0x4'));var BPromise=require('bluebird');var rp=require(_0xf662('0x5'));var fs=require('fs');var path=require(_0xf662('0x6'));var rimraf=require(_0xf662('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0xf662('0x8')]=function(_0x3e6aa1,_0x5e8f3b){return _0x3e6aa1['define'](_0xf662('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xf662('0xa'),'fields':[_0xf662('0xb'),_0xf662('0xc')],'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 66a68f7..8f063e8 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 _0xcc44=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xcc44,0x92));var _0x4cc4=function(_0x49a8b5,_0x555b0b){_0x49a8b5=_0x49a8b5-0x0;var _0x2057a8=_0xcc44[_0x49a8b5];return _0x2057a8;};'use strict';var _=require(_0x4cc4('0x0'));var util=require(_0x4cc4('0x1'));var moment=require(_0x4cc4('0x2'));var BPromise=require(_0x4cc4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cc4('0x4'));var db=require(_0x4cc4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4cc4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33903f,_0x2795a6,_0x5f3ca7){return new BPromise(function(_0x165f5f,_0x2df9a9){return client[_0x4cc4('0x7')](_0x33903f,_0x5f3ca7)[_0x4cc4('0x8')](function(_0x54f9e7){logger[_0x4cc4('0x9')](_0x4cc4('0xa'),_0x2795a6,'request\x20sent');logger[_0x4cc4('0xb')](_0x4cc4('0xc'),_0x2795a6,_0x4cc4('0xd'),JSON[_0x4cc4('0xe')](_0x54f9e7));if(_0x54f9e7[_0x4cc4('0xf')]){if(_0x54f9e7[_0x4cc4('0xf')][_0x4cc4('0x10')]===0x1f4){logger[_0x4cc4('0xf')](_0x4cc4('0xa'),_0x2795a6,_0x54f9e7[_0x4cc4('0xf')][_0x4cc4('0x11')]);return _0x2df9a9(_0x54f9e7[_0x4cc4('0xf')]['message']);}logger[_0x4cc4('0xf')](_0x4cc4('0xa'),_0x2795a6,_0x54f9e7[_0x4cc4('0xf')][_0x4cc4('0x11')]);return _0x165f5f(_0x54f9e7[_0x4cc4('0xf')][_0x4cc4('0x11')]);}else{logger['info'](_0x4cc4('0xa'),_0x2795a6,_0x4cc4('0xd'));_0x165f5f(_0x54f9e7[_0x4cc4('0x12')][_0x4cc4('0x11')]);}})[_0x4cc4('0x13')](function(_0x202cb9){logger[_0x4cc4('0xf')](_0x4cc4('0xa'),_0x2795a6,_0x202cb9);_0x2df9a9(_0x202cb9);});});} \ No newline at end of file +var _0x40b2=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x903dcc,_0x10d4f8){var _0x24d5ce=function(_0x4aadfa){while(--_0x4aadfa){_0x903dcc['push'](_0x903dcc['shift']());}};_0x24d5ce(++_0x10d4f8);}(_0x40b2,0xa9));var _0x240b=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x40b2[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x240b('0x0'));var util=require(_0x240b('0x1'));var moment=require('moment');var BPromise=require(_0x240b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x240b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x240b('0x4'));var logger=require(_0x240b('0x5'))(_0x240b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x240b('0x7')][_0x240b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x544332,_0x59dea9,_0x27fef3){return new BPromise(function(_0x1366f3,_0x3b906c){return client['request'](_0x544332,_0x27fef3)[_0x240b('0x9')](function(_0x522ae8){logger[_0x240b('0xa')](_0x240b('0xb'),_0x59dea9,_0x240b('0xc'));logger[_0x240b('0xd')](_0x240b('0xe'),_0x59dea9,_0x240b('0xc'),JSON[_0x240b('0xf')](_0x522ae8));if(_0x522ae8[_0x240b('0x10')]){if(_0x522ae8[_0x240b('0x10')][_0x240b('0x11')]===0x1f4){logger[_0x240b('0x10')](_0x240b('0xb'),_0x59dea9,_0x522ae8[_0x240b('0x10')][_0x240b('0x12')]);return _0x3b906c(_0x522ae8[_0x240b('0x10')][_0x240b('0x12')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x59dea9,_0x522ae8[_0x240b('0x10')][_0x240b('0x12')]);return _0x1366f3(_0x522ae8[_0x240b('0x10')][_0x240b('0x12')]);}else{logger[_0x240b('0xa')]('DeskField,\x20%s,\x20%s',_0x59dea9,_0x240b('0xc'));_0x1366f3(_0x522ae8['result']['message']);}})['catch'](function(_0xc433ee){logger[_0x240b('0x10')](_0x240b('0xb'),_0x59dea9,_0xc433ee);_0x3b906c(_0xc433ee);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index c755f09..73c94a1 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 _0xe618=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Account.controller','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy'];(function(_0xdb47d8,_0x933e5b){var _0x5cdfd9=function(_0x3b69a8){while(--_0x3b69a8){_0xdb47d8['push'](_0xdb47d8['shift']());}};_0x5cdfd9(++_0x933e5b);}(_0xe618,0x1b9));var _0x8e61=function(_0x494fa2,_0x84b5d8){_0x494fa2=_0x494fa2-0x0;var _0xf013c7=_0xe618[_0x494fa2];return _0xf013c7;};'use strict';var multer=require(_0x8e61('0x0'));var util=require(_0x8e61('0x1'));var path=require(_0x8e61('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e61('0x3'));var router=express[_0x8e61('0x4')]();var fs_extra=require(_0x8e61('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8e61('0x6'));var config=require('../../config/environment');var controller=require(_0x8e61('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8e61('0x8')]);router[_0x8e61('0x9')](_0x8e61('0xa'),auth[_0x8e61('0xb')](),controller['show']);router[_0x8e61('0x9')](_0x8e61('0xc'),auth[_0x8e61('0xb')](),controller[_0x8e61('0xd')]);router[_0x8e61('0x9')](_0x8e61('0xe'),auth[_0x8e61('0xb')](),controller[_0x8e61('0xf')]);router[_0x8e61('0x10')]('/',auth[_0x8e61('0xb')](),controller[_0x8e61('0x11')]);router[_0x8e61('0x10')](_0x8e61('0xc'),auth[_0x8e61('0xb')](),controller[_0x8e61('0x12')]);router['put'](_0x8e61('0xa'),auth[_0x8e61('0xb')](),controller[_0x8e61('0x13')]);router['delete'](_0x8e61('0xa'),auth['isAuthenticated'](),controller[_0x8e61('0x14')]);module[_0x8e61('0x15')]=router; \ No newline at end of file +var _0x4ed8=['/:id','update','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id/configurations','getConfigurations','isAuthenticated','getFields','create','post','addConfiguration','put'];(function(_0x5e767a,_0x47bc4e){var _0x29a6fe=function(_0xabd17d){while(--_0xabd17d){_0x5e767a['push'](_0x5e767a['shift']());}};_0x29a6fe(++_0x47bc4e);}(_0x4ed8,0x1bc));var _0x84ed=function(_0x378d69,_0x35e775){_0x378d69=_0x378d69-0x0;var _0x5b75ef=_0x4ed8[_0x378d69];return _0x5b75ef;};'use strict';var multer=require(_0x84ed('0x0'));var util=require('util');var path=require(_0x84ed('0x1'));var timeout=require(_0x84ed('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x84ed('0x3'));var auth=require(_0x84ed('0x4'));var interaction=require(_0x84ed('0x5'));var config=require(_0x84ed('0x6'));var controller=require(_0x84ed('0x7'));router[_0x84ed('0x8')]('/',auth['isAuthenticated'](),controller[_0x84ed('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x84ed('0x8')](_0x84ed('0xa'),auth['isAuthenticated'](),controller[_0x84ed('0xb')]);router[_0x84ed('0x8')]('/:id/fields',auth[_0x84ed('0xc')](),controller[_0x84ed('0xd')]);router['post']('/',auth[_0x84ed('0xc')](),controller[_0x84ed('0xe')]);router[_0x84ed('0xf')](_0x84ed('0xa'),auth[_0x84ed('0xc')](),controller[_0x84ed('0x10')]);router[_0x84ed('0x11')](_0x84ed('0x12'),auth[_0x84ed('0xc')](),controller[_0x84ed('0x13')]);router[_0x84ed('0x14')](_0x84ed('0x12'),auth[_0x84ed('0xc')](),controller[_0x84ed('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 84ce379..905252b 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 _0x82f5=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4275a8,_0x1646e3){var _0x2845ce=function(_0x4d3683){while(--_0x4d3683){_0x4275a8['push'](_0x4275a8['shift']());}};_0x2845ce(++_0x1646e3);}(_0x82f5,0x15d));var _0x582f=function(_0x1942ba,_0x170f0b){_0x1942ba=_0x1942ba-0x0;var _0xf842b0=_0x82f5[_0x1942ba];return _0xf842b0;};'use strict';var Sequelize=require(_0x582f('0x0'));module[_0x582f('0x1')]={'name':{'type':Sequelize[_0x582f('0x2')]},'username':{'type':Sequelize[_0x582f('0x2')]},'password':{'type':Sequelize[_0x582f('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x582f('0x2')]},'clientSecret':{'type':Sequelize[_0x582f('0x2')]},'serverUrl':{'type':Sequelize[_0x582f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x582f('0x2')]},'modernAuthentication':{'type':Sequelize[_0x582f('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x90b5=['BOOLEAN','sequelize','STRING'];(function(_0x385344,_0x3bce76){var _0x321ce3=function(_0x373cbd){while(--_0x373cbd){_0x385344['push'](_0x385344['shift']());}};_0x321ce3(++_0x3bce76);}(_0x90b5,0x139));var _0x590b=function(_0x16559e,_0x35954b){_0x16559e=_0x16559e-0x0;var _0x326a83=_0x90b5[_0x16559e];return _0x326a83;};'use strict';var Sequelize=require(_0x590b('0x0'));module['exports']={'name':{'type':Sequelize[_0x590b('0x1')]},'username':{'type':Sequelize[_0x590b('0x1')]},'password':{'type':Sequelize[_0x590b('0x1')]},'remoteUri':{'type':Sequelize[_0x590b('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x590b('0x1')]},'serverUrl':{'type':Sequelize[_0x590b('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x590b('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 7428c95..bd3d6f6 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 _0x7189=['nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','keys','include','options','create','body','update','find','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','incident','Incident','title','description','customerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdonbehalfbyname','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedonbehalfbyname','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','concat','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','access_token','data7','POST','tenantId','/oauth2/token','username','GET','Bearer\x20','4.0','value','EntityDefinitions(','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/integrations/configuration','status','offset','undefined','count','limit','set','Content-Range','json','then','destroy','end','sendStatus','error','stack','name','index','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x45bcd9,_0x1ed0f1){var _0x6a0870=function(_0x119ed2){while(--_0x119ed2){_0x45bcd9['push'](_0x45bcd9['shift']());}};_0x6a0870(++_0x1ed0f1);}(_0x7189,0x14a));var _0x9718=function(_0x141ad6,_0xcb24c0){_0x141ad6=_0x141ad6-0x0;var _0x17475b=_0x7189[_0x141ad6];return _0x17475b;};'use strict';var rp=require(_0x9718('0x0'));var util=require(_0x9718('0x1'));var _=require(_0x9718('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var db=require('../../mysqldb')['db'];var integrations=require(_0x9718('0x3'));function respondWithResult(_0x50c768,_0x3d9b6d){_0x3d9b6d=_0x3d9b6d||0xc8;return function(_0x14cc03){if(_0x14cc03){return _0x50c768[_0x9718('0x4')](_0x3d9b6d)['json'](_0x14cc03);}};}function respondWithFilteredResult(_0x38cb7b,_0x346c59){return function(_0x3e5d30){if(_0x3e5d30){var _0x3223bf=typeof _0x346c59[_0x9718('0x5')]===_0x9718('0x6')&&typeof _0x346c59['limit']===_0x9718('0x6');var _0x1db467=_0x3e5d30[_0x9718('0x7')];var _0x571c3f=_0x3223bf?0x0:_0x346c59[_0x9718('0x5')];var _0x4216ea=_0x3223bf?_0x3e5d30[_0x9718('0x7')]:_0x346c59['offset']+_0x346c59[_0x9718('0x8')];var _0x572ffc;if(_0x4216ea>=_0x1db467){_0x4216ea=_0x1db467;_0x572ffc=0xc8;}else{_0x572ffc=0xce;}_0x38cb7b[_0x9718('0x4')](_0x572ffc);return _0x38cb7b[_0x9718('0x9')](_0x9718('0xa'),_0x571c3f+'-'+_0x4216ea+'/'+_0x1db467)[_0x9718('0xb')](_0x3e5d30);}return null;};}function saveUpdates(_0x4cb49e){return function(_0x4cbfca){if(_0x4cbfca){return _0x4cbfca['update'](_0x4cb49e)[_0x9718('0xc')](function(_0x48fd60){return _0x48fd60;});}return null;};}function removeEntity(_0x48f6cf){return function(_0x8a5e8){if(_0x8a5e8){return _0x8a5e8[_0x9718('0xd')]()[_0x9718('0xc')](function(){_0x48f6cf[_0x9718('0x4')](0xcc)[_0x9718('0xe')]();});}};}function handleEntityNotFound(_0x1e3bc3){return function(_0x3e64dd){if(!_0x3e64dd){_0x1e3bc3[_0x9718('0xf')](0x194);}return _0x3e64dd;};}function handleError(_0x257258,_0x4a1c4c){_0x4a1c4c=_0x4a1c4c||0x1f4;return function(_0x316161){logger[_0x9718('0x10')](_0x316161[_0x9718('0x11')]);if(_0x316161[_0x9718('0x12')]){delete _0x316161['name'];}_0x257258[_0x9718('0x4')](_0x4a1c4c)['send'](_0x316161);};}exports[_0x9718('0x13')]=function(_0x319f48,_0x28ac46){var _0x33add6={},_0xc9ab9a={},_0x15ad1b={'count':0x0,'rows':[]};var _0x1b9573=_['map'](db[_0x9718('0x14')][_0x9718('0x15')],function(_0x3787f8){return{'name':_0x3787f8[_0x9718('0x16')],'type':_0x3787f8[_0x9718('0x17')][_0x9718('0x18')]};});_0xc9ab9a[_0x9718('0x19')]=_[_0x9718('0x1a')](_0x1b9573,_0x9718('0x12'));_0xc9ab9a[_0x9718('0x1b')]=_['keys'](_0x319f48[_0x9718('0x1b')]);_0xc9ab9a[_0x9718('0x1c')]=_[_0x9718('0x1d')](_0xc9ab9a['model'],_0xc9ab9a[_0x9718('0x1b')]);_0x33add6[_0x9718('0x1e')]=_[_0x9718('0x1d')](_0xc9ab9a[_0x9718('0x19')],qs[_0x9718('0x1f')](_0x319f48[_0x9718('0x1b')][_0x9718('0x1f')]));_0x33add6[_0x9718('0x1e')]=_0x33add6[_0x9718('0x1e')][_0x9718('0x20')]?_0x33add6[_0x9718('0x1e')]:_0xc9ab9a[_0x9718('0x19')];if(!_0x319f48[_0x9718('0x1b')][_0x9718('0x21')](_0x9718('0x22'))){_0x33add6[_0x9718('0x8')]=qs[_0x9718('0x8')](_0x319f48[_0x9718('0x1b')]['limit']);_0x33add6['offset']=qs['offset'](_0x319f48[_0x9718('0x1b')][_0x9718('0x5')]);}_0x33add6[_0x9718('0x23')]=qs[_0x9718('0x24')](_0x319f48['query']['sort']);_0x33add6[_0x9718('0x25')]=qs['filters'](_['pick'](_0x319f48['query'],_0xc9ab9a[_0x9718('0x1c')]),_0x1b9573);if(_0x319f48[_0x9718('0x1b')][_0x9718('0x26')]){_0x33add6[_0x9718('0x25')]=_[_0x9718('0x27')](_0x33add6[_0x9718('0x25')],{'$or':_[_0x9718('0x1a')](_0x1b9573,function(_0x4e6ea7){if(_0x4e6ea7[_0x9718('0x17')]!==_0x9718('0x28')){var _0x562720={};_0x562720[_0x4e6ea7[_0x9718('0x12')]]={'$like':'%'+_0x319f48[_0x9718('0x1b')][_0x9718('0x26')]+'%'};return _0x562720;}})});}_0x33add6=_[_0x9718('0x27')]({},_0x33add6,_0x319f48['options']);var _0x5adbaa={'where':_0x33add6[_0x9718('0x25')]};return db[_0x9718('0x14')][_0x9718('0x7')](_0x5adbaa)['then'](function(_0x30af46){_0x15ad1b[_0x9718('0x7')]=_0x30af46;if(_0x319f48[_0x9718('0x1b')][_0x9718('0x29')]){_0x33add6['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x9718('0x2a')](_0x33add6);})[_0x9718('0xc')](function(_0x6d3718){_0x15ad1b[_0x9718('0x2b')]=_0x6d3718;return _0x15ad1b;})[_0x9718('0xc')](respondWithFilteredResult(_0x28ac46,_0x33add6))[_0x9718('0x2c')](handleError(_0x28ac46,null));};exports['show']=function(_0x28c760,_0x235382){var _0x11783c={'raw':![],'where':{'id':_0x28c760[_0x9718('0x2d')]['id']}},_0x212293={};_0x212293[_0x9718('0x19')]=_[_0x9718('0x2e')](db[_0x9718('0x14')][_0x9718('0x15')]);_0x212293['query']=_[_0x9718('0x2e')](_0x28c760[_0x9718('0x1b')]);_0x212293['filters']=_[_0x9718('0x1d')](_0x212293[_0x9718('0x19')],_0x212293[_0x9718('0x1b')]);_0x11783c['attributes']=_[_0x9718('0x1d')](_0x212293[_0x9718('0x19')],qs[_0x9718('0x1f')](_0x28c760[_0x9718('0x1b')][_0x9718('0x1f')]));_0x11783c['attributes']=_0x11783c[_0x9718('0x1e')][_0x9718('0x20')]?_0x11783c[_0x9718('0x1e')]:_0x212293[_0x9718('0x19')];if(_0x28c760[_0x9718('0x1b')][_0x9718('0x29')]){_0x11783c[_0x9718('0x2f')]=[{'all':!![]}];}_0x11783c=_[_0x9718('0x27')]({},_0x11783c,_0x28c760[_0x9718('0x30')]);return db['Dynamics365Account']['find'](_0x11783c)[_0x9718('0xc')](handleEntityNotFound(_0x235382,null))[_0x9718('0xc')](respondWithResult(_0x235382,null))[_0x9718('0x2c')](handleError(_0x235382,null));};exports[_0x9718('0x31')]=function(_0x3668aa,_0x20bf86){return db[_0x9718('0x14')]['create'](_0x3668aa[_0x9718('0x32')],{})['then'](respondWithResult(_0x20bf86,0xc9))[_0x9718('0x2c')](handleError(_0x20bf86,null));};exports[_0x9718('0x33')]=function(_0x5b6a9b,_0x3a86a7){if(_0x5b6a9b[_0x9718('0x32')]['id']){delete _0x5b6a9b[_0x9718('0x32')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x5b6a9b[_0x9718('0x2d')]['id']}})[_0x9718('0xc')](handleEntityNotFound(_0x3a86a7,null))[_0x9718('0xc')](saveUpdates(_0x5b6a9b[_0x9718('0x32')],null))['then'](respondWithResult(_0x3a86a7,null))['catch'](handleError(_0x3a86a7,null));};exports[_0x9718('0xd')]=function(_0x541854,_0x209c79){return db[_0x9718('0x14')][_0x9718('0x34')]({'where':{'id':_0x541854['params']['id']}})[_0x9718('0xc')](handleEntityNotFound(_0x209c79,null))['then'](removeEntity(_0x209c79,null))[_0x9718('0x2c')](handleError(_0x209c79,null));};exports[_0x9718('0x35')]=function(_0x540b21,_0x5ee4ed){var _0x5e4d18={};var _0x18863b={};var _0x39ba3c;var _0x2b8f00;return db[_0x9718('0x14')][_0x9718('0x36')]({'where':{'id':_0x540b21[_0x9718('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5ee4ed,null))[_0x9718('0xc')](function(_0x53841b){if(_0x53841b){_0x39ba3c=_0x53841b;_0x18863b[_0x9718('0x19')]=_['keys'](db[_0x9718('0x37')][_0x9718('0x15')]);_0x18863b['query']=_[_0x9718('0x2e')](_0x540b21['query']);_0x18863b[_0x9718('0x1c')]=_[_0x9718('0x1d')](_0x18863b[_0x9718('0x19')],_0x18863b[_0x9718('0x1b')]);_0x5e4d18[_0x9718('0x1e')]=_[_0x9718('0x1d')](_0x18863b['model'],qs[_0x9718('0x1f')](_0x540b21[_0x9718('0x1b')][_0x9718('0x1f')]));_0x5e4d18[_0x9718('0x1e')]=_0x5e4d18[_0x9718('0x1e')][_0x9718('0x20')]?_0x5e4d18[_0x9718('0x1e')]:_0x18863b[_0x9718('0x19')];_0x5e4d18[_0x9718('0x23')]=qs[_0x9718('0x24')](_0x540b21[_0x9718('0x1b')][_0x9718('0x24')]);_0x5e4d18[_0x9718('0x25')]=qs[_0x9718('0x1c')](_['pick'](_0x540b21[_0x9718('0x1b')],_0x18863b[_0x9718('0x1c')]));if(_0x540b21[_0x9718('0x1b')]['filter']){_0x5e4d18['where']=_[_0x9718('0x27')](_0x5e4d18[_0x9718('0x25')],{'$or':_[_0x9718('0x1a')](_0x5e4d18[_0x9718('0x1e')],function(_0xaf4e83){var _0x2e9a5e={};_0x2e9a5e[_0xaf4e83]={'$like':'%'+_0x540b21[_0x9718('0x1b')]['filter']+'%'};return _0x2e9a5e;})});}_0x5e4d18=_[_0x9718('0x27')]({},_0x5e4d18,_0x540b21[_0x9718('0x30')]);return _0x39ba3c[_0x9718('0x35')](_0x5e4d18);}})[_0x9718('0xc')](function(_0xc4b06){if(_0xc4b06){_0x2b8f00=_0xc4b06[_0x9718('0x20')];if(!_0x540b21[_0x9718('0x1b')][_0x9718('0x21')](_0x9718('0x22'))){_0x5e4d18[_0x9718('0x8')]=qs[_0x9718('0x8')](_0x540b21[_0x9718('0x1b')][_0x9718('0x8')]);_0x5e4d18['offset']=qs[_0x9718('0x5')](_0x540b21[_0x9718('0x1b')][_0x9718('0x5')]);}return _0x39ba3c[_0x9718('0x35')](_0x5e4d18);}})[_0x9718('0xc')](function(_0x1ab4e6){if(_0x1ab4e6){return _0x1ab4e6?{'count':_0x2b8f00,'rows':_0x1ab4e6}:null;}})[_0x9718('0xc')](respondWithResult(_0x5ee4ed,null))[_0x9718('0x2c')](handleError(_0x5ee4ed,null));};exports[_0x9718('0x38')]=function(_0x20942e,_0x5b4c88){if(_0x20942e[_0x9718('0x32')]['id']){delete _0x20942e[_0x9718('0x32')]['id'];}return db[_0x9718('0x14')][_0x9718('0x36')]({'where':{'id':_0x20942e[_0x9718('0x2d')]['id']}})[_0x9718('0xc')](handleEntityNotFound(_0x5b4c88,null))[_0x9718('0xc')](function(_0x599d69){if(_0x599d69){_0x20942e[_0x9718('0x32')][_0x9718('0x39')]=_0x599d69['id'];_0x20942e['body'][_0x9718('0x3a')]=integrations[_0x9718('0x3b')](_0x20942e[_0x9718('0x32')][_0x9718('0x3c')],_0x20942e['body'][_0x9718('0x17')]);_0x20942e[_0x9718('0x32')][_0x9718('0x3d')]=integrations[_0x9718('0x3e')](_0x20942e[_0x9718('0x32')][_0x9718('0x3c')],_0x20942e[_0x9718('0x32')]['type']);return db['Dynamics365Configuration'][_0x9718('0x31')](_0x20942e[_0x9718('0x32')],{'include':[{'model':db[_0x9718('0x3f')],'as':_0x9718('0x3a')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5b4c88,null))[_0x9718('0x2c')](handleError(_0x5b4c88,null));};function sanitizeRemoteUri(_0xc959ac){var _0x1b16bc=_0xc959ac[_0x9718('0x40')](-0x1);if(_0x1b16bc==='/')return _0xc959ac[_0x9718('0x41')](0x0,_0xc959ac[_0x9718('0x42')](_0x1b16bc));return _0xc959ac;}function getWebApiUrl(_0x2e11c2){return util['format'](_0x9718('0x43'),_0x2e11c2);}exports[_0x9718('0x44')]=function(_0xe95bb0,_0x2c06ae){var _0x29c32c=_0xe95bb0[_0x9718('0x1b')]['ticketType'];var _0x57c02b=_0x29c32c===_0x9718('0x45')?_0x9718('0x46'):'PhoneCall';var _0xaff923='';var _0x719797='';var _0x4f6137='';var _0x37fee2='';var _0x2cdfb7='';var _0x52669a='';var _0x941f5e='';var _0x413549='';var _0x4b6306=[_0x9718('0x47'),_0x9718('0x48'),_0x9718('0x49'),'ownerid',_0x9718('0x4a'),_0x9718('0x4b'),_0x9718('0x4c'),'regardingobjectid',_0x9718('0x4d'),_0x9718('0x4e')];var _0x4fa24c=[_0x9718('0x4f'),_0x9718('0x50'),_0x9718('0x51'),_0x9718('0x52'),_0x9718('0x53'),_0x9718('0x54'),'contractdetailidname',_0x9718('0x55'),_0x9718('0x56'),_0x9718('0x57'),_0x9718('0x58'),'createdbyyominame','createdon',_0x9718('0x59'),'createdonbehalfbyyominame',_0x9718('0x5a'),_0x9718('0x5b'),'customeridyominame',_0x9718('0x5c'),_0x9718('0x5d'),_0x9718('0x5e'),_0x9718('0x5f'),_0x9718('0x60'),_0x9718('0x61'),_0x9718('0x62'),_0x9718('0x63'),_0x9718('0x64'),'influencescore',_0x9718('0x65'),'lastonholdtime',_0x9718('0x66'),'modifiedbyexternalpartyname',_0x9718('0x67'),'modifiedbyname',_0x9718('0x68'),'modifiedon',_0x9718('0x69'),'modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents',_0x9718('0x6a'),_0x9718('0x6b'),'owneridname',_0x9718('0x6c'),_0x9718('0x6d'),_0x9718('0x6e'),_0x9718('0x6f'),'primarycontactidyominame','prioritycodename','productidname','productserialnumber',_0x9718('0x70'),_0x9718('0x71'),_0x9718('0x72'),_0x9718('0x73'),_0x9718('0x74'),_0x9718('0x75'),'slainvokedidname','slaname',_0x9718('0x76'),_0x9718('0x77'),_0x9718('0x78'),_0x9718('0x79'),_0x9718('0x7a'),_0x9718('0x7b'),_0x9718('0x7c'),'traversedpath','utcconversiontimezonecode',_0x9718('0x7d')];var _0x17eaf8=_0x4b6306[_0x9718('0x7e')](_0x4fa24c);return db['Dynamics365Account']['findOne']({'where':{'id':_0xe95bb0['params']['id']},'attributes':['id','username',_0x9718('0x7f'),_0x9718('0x80'),'tenantId',_0x9718('0x81'),_0x9718('0x82'),_0x9718('0x83')],'include':[{'model':db[_0x9718('0x84')],'as':'CloudProvider','attributes':['id','data5','data7']}]})[_0x9718('0xc')](handleEntityNotFound(_0x2c06ae,null))[_0x9718('0xc')](function(_0x19b9a7){if(_0x19b9a7){if(_0x19b9a7[_0x9718('0x83')]){_0x19b9a7[_0x9718('0x85')]=_0x19b9a7['CloudProvider']['data5'];_0x413549=sanitizeRemoteUri(_0x19b9a7[_0x9718('0x84')][_0x9718('0x86')]);_0x941f5e=getWebApiUrl(_0x413549);return _0x19b9a7;}_0x413549=sanitizeRemoteUri(_0x19b9a7[_0x9718('0x80')]);_0x941f5e=getWebApiUrl(_0x413549);var _0x31c9a1={'method':_0x9718('0x87'),'uri':'https://login.microsoftonline.com/'+_0x19b9a7[_0x9718('0x88')]+_0x9718('0x89'),'form':{'client_id':_0x19b9a7[_0x9718('0x81')],'resource':_0x413549,'username':_0x19b9a7[_0x9718('0x8a')],'password':_0x19b9a7[_0x9718('0x7f')],'grant_type':_0x9718('0x7f'),'client_secret':_0x19b9a7[_0x9718('0x82')]},'json':!![]};return rp(_0x31c9a1);}})['then'](function(_0x339696){_0x52669a=_0x339696[_0x9718('0x85')];var _0x47d303={'method':_0x9718('0x8b'),'uri':encodeURI(_0x941f5e+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x57c02b+'\x27'),'headers':{'Authorization':_0x9718('0x8c')+_0x52669a,'If-None-Match':null,'OData-Version':_0x9718('0x8d')},'json':!![]};return rp(_0x47d303);})[_0x9718('0xc')](function(_0x58e6f4){var _0x272afa=_0x58e6f4[_0x9718('0x8e')][0x0];var _0x42a1f0=_0x272afa['MetadataId'];var _0x77e92d={'method':_0x9718('0x8b'),'uri':_0x941f5e+_0x9718('0x8f')+_0x42a1f0+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x9718('0x8c')+_0x52669a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x77e92d);})[_0x9718('0xc')](function(_0x232f95){_0xaff923=_0x232f95;_0x719797=_0xaff923['Attributes'];_0x719797=_['remove'](_0x719797,function(_0x49b5ef){return!_0x17eaf8['includes'](_0x49b5ef[_0x9718('0x90')]);});var _0x1e85b7=[];var _0x403774=[];_0x719797[_0x9718('0x91')](function(_0x3c0bcc){if(_0x3c0bcc[_0x9718('0x92')]){var _0x329f65=_0x3c0bcc['@odata.type'][_0x9718('0x41')](_0x3c0bcc['@odata.type']['lastIndexOf']('.')+0x1);if(_0x329f65===_0x9718('0x93')){_0x1e85b7['push'](getSelectList(_0x941f5e,_0x29c32c,_0x403774,_0xaff923[_0x9718('0x94')],_0x3c0bcc['MetadataId'],_0x52669a));}}});return Promise[_0x9718('0x95')](_0x1e85b7);})[_0x9718('0xc')](function(_0x58cbc8){_0x4f6137=_0x58cbc8[0x0];var _0x266c4b=[];var _0x947f0d=[];_0x719797[_0x9718('0x91')](function(_0x28baaa){if(!_[_0x9718('0x96')](_0x28baaa[_0x9718('0x92')])){var _0x463e11=_0x28baaa[_0x9718('0x92')][_0x9718('0x41')](_0x28baaa['@odata.type'][_0x9718('0x42')]('.')+0x1);if(_0x463e11===_0x9718('0x97')){_0x266c4b[_0x9718('0x98')](getBooleanList(_0x941f5e,_0x29c32c,_0x947f0d,_0xaff923[_0x9718('0x94')],_0x28baaa['MetadataId'],_0x52669a));}}});return Promise['all'](_0x266c4b);})[_0x9718('0xc')](function(_0x33f8a3){_0x37fee2=_0x33f8a3[0x0];var _0x2efe16=[];var _0x285532=[];_0x719797['forEach'](function(_0x4b5949){if(_0x4b5949['@odata.type']){var _0x5a2fac=_0x4b5949['@odata.type'][_0x9718('0x41')](_0x4b5949[_0x9718('0x92')][_0x9718('0x42')]('.')+0x1);if(_0x5a2fac===_0x9718('0x99')||_0x5a2fac===_0x9718('0x9a')||_0x5a2fac===_0x9718('0x9b')||_0x5a2fac===_0x9718('0x9c')||_0x5a2fac===_0x9718('0x9d')||_0x5a2fac===_0x9718('0x9e')||_0x5a2fac===_0x9718('0x9f')||_0x5a2fac===_0x9718('0xa0')||_0x5a2fac===_0x9718('0xa1')||_0x5a2fac===_0x9718('0xa2')){_0x2efe16[_0x9718('0x98')](getInputList(_0x941f5e,_0x29c32c,_0x5a2fac,_0x285532,_0xaff923[_0x9718('0x94')],_0x4b5949[_0x9718('0x94')],_0x52669a));}}});return Promise['all'](_0x2efe16);})[_0x9718('0xc')](function(_0x1d8f5a){_0x2cdfb7=_0x1d8f5a[0x0];var _0x4e08ab=_0x4f6137[_0x9718('0x7e')](_0x37fee2)[_0x9718('0x7e')](_0x2cdfb7);var _0x38810d={'count':_0x4e08ab[_0x9718('0x20')],'rows':_0x4e08ab};return _0x38810d;})['then'](respondWithResult(_0x2c06ae,null))['catch'](function(_0xc6f35e){var _0x2fab61=_0xe95bb0[_0x9718('0x1b')][_0x9718('0xa3')]?0x1f4:_0xc6f35e[_0x9718('0xa4')]||0x1f4;logger[_0x9718('0x10')](_0xc6f35e[_0x9718('0x11')]);delete _0xc6f35e[_0x9718('0x12')];if(_0x2fab61===0x191){_0x2fab61=0x190;}_0x2c06ae['status'](_0x2fab61)[_0x9718('0xa5')](_0xe95bb0['query']['test']?{'message':_0x9718('0xa6'),'statusCode':_0xc6f35e[_0x9718('0xa4')]}:_0xc6f35e);});};function getSelectList(_0x213217,_0xc9ac12,_0x5a4e4e,_0x15fd0f,_0x2b466e,_0x2324fe){var _0x1d4877={'method':_0x9718('0x8b'),'uri':_0x213217+'EntityDefinitions('+_0x15fd0f+_0x9718('0xa7')+_0x2b466e+_0x9718('0xa8')+_0x9718('0xa9'),'headers':{'Authorization':_0x9718('0x8c')+_0x2324fe,'If-None-Match':null,'OData-Version':_0x9718('0x8d')},'json':!![]};return rp(_0x1d4877)['then'](function(_0x4b4570){var _0x17d59f=[];var _0x26d8d6=_0x4b4570[_0x9718('0xaa')][_0x9718('0xab')];_0x26d8d6['forEach'](function(_0x10c8c2){_0x17d59f[_0x9718('0x98')]({'name':_0x10c8c2['Label'][_0x9718('0xac')][_0x9718('0xad')],'value':String(_0x10c8c2[_0x9718('0xae')])});});var _0xcc3841={'id':_0xc9ac12+'_'+_0x4b4570[_0x9718('0x90')],'name':_0x4b4570[_0x9718('0xaf')][_0x9718('0xac')][_0x9718('0xad')],'custom':![],'options':_0x17d59f};_0x5a4e4e['push'](_0xcc3841);return _0x5a4e4e;});}function getBooleanList(_0x3cf79c,_0x3e6fc8,_0x46aa9b,_0x141a29,_0x3d7e83,_0x24be77){var _0x5c3274={'method':_0x9718('0x8b'),'uri':_0x3cf79c+_0x9718('0x8f')+_0x141a29+_0x9718('0xa7')+_0x3d7e83+_0x9718('0xb0'),'headers':{'Authorization':'Bearer\x20'+_0x24be77,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5c3274)[_0x9718('0xc')](function(_0x1b1610){var _0x1f685e=[];_0x1f685e['push']({'name':_0x1b1610[_0x9718('0xaa')]['TrueOption'][_0x9718('0xad')][_0x9718('0xac')][_0x9718('0xad')],'value':_0x9718('0xb1')},{'name':_0x1b1610[_0x9718('0xaa')][_0x9718('0xb2')][_0x9718('0xad')][_0x9718('0xac')]['Label'],'value':_0x9718('0xb3')});var _0x4adc26={'id':_0x3e6fc8+'_'+_0x1b1610[_0x9718('0x90')],'name':_0x1b1610[_0x9718('0xaf')][_0x9718('0xac')][_0x9718('0xad')],'custom':![],'options':_0x1f685e};_0x46aa9b['push'](_0x4adc26);return _0x46aa9b;});}function getInputList(_0x1465b7,_0x2be7da,_0x273eaf,_0x330cb6,_0x3de660,_0x3238b6,_0x586350){var _0x30642d={'method':'GET','uri':_0x1465b7+_0x9718('0x8f')+_0x3de660+_0x9718('0xa7')+_0x3238b6+_0x9718('0xb4')+_0x273eaf+_0x9718('0xb5'),'headers':{'Authorization':_0x9718('0x8c')+_0x586350,'If-None-Match':null,'OData-Version':_0x9718('0x8d')},'json':!![]};return rp(_0x30642d)[_0x9718('0xc')](function(_0x22a641){var _0xde7e3d={'id':_0x2be7da+'_'+_0x22a641[_0x9718('0x90')],'name':_0x22a641[_0x9718('0xaf')][_0x9718('0xac')]?_0x22a641['DisplayName'][_0x9718('0xac')]['Label']:_0x22a641[_0x9718('0x90')],'custom':![],'options':[]};_0x330cb6['push'](_0xde7e3d);return _0x330cb6;});} \ No newline at end of file +var _0xe9e8=['contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','slaname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','lastIndexOf','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','LogicalName','UserLocalizedLabel','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','json','offset','undefined','limit','count','status','set','update','then','destroy','end','sendStatus','error','name','send','index','map','Dynamics365Account','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','length','find','create','body','params','Dynamics365Configuration','hasOwnProperty','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','format','%s/api/data/v9.0/','getFields','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame'];(function(_0x5004ab,_0x2dbfaa){var _0x34ec4b=function(_0x4e38e8){while(--_0x4e38e8){_0x5004ab['push'](_0x5004ab['shift']());}};_0x34ec4b(++_0x2dbfaa);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x551368,_0x35e717){_0x551368=_0x551368-0x0;var _0x4feceb=_0xe9e8[_0x551368];return _0x4feceb;};'use strict';var rp=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var _=require(_0x8e9e('0x2'));var qs=require(_0x8e9e('0x3'));var logger=require(_0x8e9e('0x4'))(_0x8e9e('0x5'));var db=require(_0x8e9e('0x6'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x103d8b,_0x2a1d41){_0x2a1d41=_0x2a1d41||0xc8;return function(_0x1c09c6){if(_0x1c09c6){return _0x103d8b['status'](_0x2a1d41)[_0x8e9e('0x7')](_0x1c09c6);}};}function respondWithFilteredResult(_0x39983a,_0x204f5c){return function(_0x1fb8d3){if(_0x1fb8d3){var _0x58f822=typeof _0x204f5c[_0x8e9e('0x8')]===_0x8e9e('0x9')&&typeof _0x204f5c[_0x8e9e('0xa')]==='undefined';var _0x39f5e5=_0x1fb8d3[_0x8e9e('0xb')];var _0x449f72=_0x58f822?0x0:_0x204f5c['offset'];var _0xbcfd72=_0x58f822?_0x1fb8d3[_0x8e9e('0xb')]:_0x204f5c[_0x8e9e('0x8')]+_0x204f5c[_0x8e9e('0xa')];var _0x35f014;if(_0xbcfd72>=_0x39f5e5){_0xbcfd72=_0x39f5e5;_0x35f014=0xc8;}else{_0x35f014=0xce;}_0x39983a[_0x8e9e('0xc')](_0x35f014);return _0x39983a[_0x8e9e('0xd')]('Content-Range',_0x449f72+'-'+_0xbcfd72+'/'+_0x39f5e5)[_0x8e9e('0x7')](_0x1fb8d3);}return null;};}function saveUpdates(_0x4af4da){return function(_0x29d7ec){if(_0x29d7ec){return _0x29d7ec[_0x8e9e('0xe')](_0x4af4da)[_0x8e9e('0xf')](function(_0x4355ca){return _0x4355ca;});}return null;};}function removeEntity(_0x1683ba){return function(_0x1c927d){if(_0x1c927d){return _0x1c927d[_0x8e9e('0x10')]()['then'](function(){_0x1683ba['status'](0xcc)[_0x8e9e('0x11')]();});}};}function handleEntityNotFound(_0x36ca0a){return function(_0x5674ef){if(!_0x5674ef){_0x36ca0a[_0x8e9e('0x12')](0x194);}return _0x5674ef;};}function handleError(_0xb67ecc,_0xa45d92){_0xa45d92=_0xa45d92||0x1f4;return function(_0x22b2c7){logger[_0x8e9e('0x13')](_0x22b2c7['stack']);if(_0x22b2c7['name']){delete _0x22b2c7[_0x8e9e('0x14')];}_0xb67ecc[_0x8e9e('0xc')](_0xa45d92)[_0x8e9e('0x15')](_0x22b2c7);};}exports[_0x8e9e('0x16')]=function(_0xa079b5,_0x1b56db){var _0x311697={},_0x5dc0b1={},_0x461d00={'count':0x0,'rows':[]};var _0x5ad498=_[_0x8e9e('0x17')](db[_0x8e9e('0x18')]['rawAttributes'],function(_0x3cbf6b){return{'name':_0x3cbf6b[_0x8e9e('0x19')],'type':_0x3cbf6b[_0x8e9e('0x1a')][_0x8e9e('0x1b')]};});_0x5dc0b1[_0x8e9e('0x1c')]=_[_0x8e9e('0x17')](_0x5ad498,_0x8e9e('0x14'));_0x5dc0b1[_0x8e9e('0x1d')]=_['keys'](_0xa079b5['query']);_0x5dc0b1[_0x8e9e('0x1e')]=_[_0x8e9e('0x1f')](_0x5dc0b1[_0x8e9e('0x1c')],_0x5dc0b1['query']);_0x311697[_0x8e9e('0x20')]=_['intersection'](_0x5dc0b1[_0x8e9e('0x1c')],qs[_0x8e9e('0x21')](_0xa079b5[_0x8e9e('0x1d')]['fields']));_0x311697[_0x8e9e('0x20')]=_0x311697['attributes']['length']?_0x311697[_0x8e9e('0x20')]:_0x5dc0b1['model'];if(!_0xa079b5[_0x8e9e('0x1d')]['hasOwnProperty'](_0x8e9e('0x22'))){_0x311697[_0x8e9e('0xa')]=qs['limit'](_0xa079b5[_0x8e9e('0x1d')][_0x8e9e('0xa')]);_0x311697[_0x8e9e('0x8')]=qs[_0x8e9e('0x8')](_0xa079b5[_0x8e9e('0x1d')][_0x8e9e('0x8')]);}_0x311697[_0x8e9e('0x23')]=qs[_0x8e9e('0x24')](_0xa079b5[_0x8e9e('0x1d')]['sort']);_0x311697[_0x8e9e('0x25')]=qs[_0x8e9e('0x1e')](_[_0x8e9e('0x26')](_0xa079b5[_0x8e9e('0x1d')],_0x5dc0b1['filters']),_0x5ad498);if(_0xa079b5[_0x8e9e('0x1d')][_0x8e9e('0x27')]){_0x311697[_0x8e9e('0x25')]=_[_0x8e9e('0x28')](_0x311697[_0x8e9e('0x25')],{'$or':_[_0x8e9e('0x17')](_0x5ad498,function(_0x221dab){if(_0x221dab[_0x8e9e('0x1a')]!=='VIRTUAL'){var _0x48aa5f={};_0x48aa5f[_0x221dab[_0x8e9e('0x14')]]={'$like':'%'+_0xa079b5['query'][_0x8e9e('0x27')]+'%'};return _0x48aa5f;}})});}_0x311697=_[_0x8e9e('0x28')]({},_0x311697,_0xa079b5[_0x8e9e('0x29')]);var _0x385dae={'where':_0x311697[_0x8e9e('0x25')]};return db[_0x8e9e('0x18')][_0x8e9e('0xb')](_0x385dae)[_0x8e9e('0xf')](function(_0x563903){_0x461d00[_0x8e9e('0xb')]=_0x563903;if(_0xa079b5[_0x8e9e('0x1d')][_0x8e9e('0x2a')]){_0x311697[_0x8e9e('0x2b')]=[{'all':!![]}];}return db[_0x8e9e('0x18')][_0x8e9e('0x2c')](_0x311697);})['then'](function(_0x51e8da){_0x461d00[_0x8e9e('0x2d')]=_0x51e8da;return _0x461d00;})['then'](respondWithFilteredResult(_0x1b56db,_0x311697))[_0x8e9e('0x2e')](handleError(_0x1b56db,null));};exports[_0x8e9e('0x2f')]=function(_0x5df186,_0x412d65){var _0x575190={'raw':![],'where':{'id':_0x5df186['params']['id']}},_0x11a378={};_0x11a378[_0x8e9e('0x1c')]=_[_0x8e9e('0x30')](db['Dynamics365Account'][_0x8e9e('0x31')]);_0x11a378[_0x8e9e('0x1d')]=_[_0x8e9e('0x30')](_0x5df186[_0x8e9e('0x1d')]);_0x11a378[_0x8e9e('0x1e')]=_[_0x8e9e('0x1f')](_0x11a378[_0x8e9e('0x1c')],_0x11a378['query']);_0x575190[_0x8e9e('0x20')]=_[_0x8e9e('0x1f')](_0x11a378[_0x8e9e('0x1c')],qs[_0x8e9e('0x21')](_0x5df186[_0x8e9e('0x1d')]['fields']));_0x575190['attributes']=_0x575190[_0x8e9e('0x20')][_0x8e9e('0x32')]?_0x575190[_0x8e9e('0x20')]:_0x11a378[_0x8e9e('0x1c')];if(_0x5df186[_0x8e9e('0x1d')][_0x8e9e('0x2a')]){_0x575190[_0x8e9e('0x2b')]=[{'all':!![]}];}_0x575190=_['merge']({},_0x575190,_0x5df186[_0x8e9e('0x29')]);return db[_0x8e9e('0x18')][_0x8e9e('0x33')](_0x575190)[_0x8e9e('0xf')](handleEntityNotFound(_0x412d65,null))[_0x8e9e('0xf')](respondWithResult(_0x412d65,null))['catch'](handleError(_0x412d65,null));};exports['create']=function(_0x17e215,_0x513fc9){return db[_0x8e9e('0x18')][_0x8e9e('0x34')](_0x17e215[_0x8e9e('0x35')],{})['then'](respondWithResult(_0x513fc9,0xc9))[_0x8e9e('0x2e')](handleError(_0x513fc9,null));};exports[_0x8e9e('0xe')]=function(_0x474b01,_0x3ba910){if(_0x474b01[_0x8e9e('0x35')]['id']){delete _0x474b01[_0x8e9e('0x35')]['id'];}return db[_0x8e9e('0x18')][_0x8e9e('0x33')]({'where':{'id':_0x474b01[_0x8e9e('0x36')]['id']}})[_0x8e9e('0xf')](handleEntityNotFound(_0x3ba910,null))[_0x8e9e('0xf')](saveUpdates(_0x474b01['body'],null))[_0x8e9e('0xf')](respondWithResult(_0x3ba910,null))[_0x8e9e('0x2e')](handleError(_0x3ba910,null));};exports[_0x8e9e('0x10')]=function(_0x4d15b9,_0x57bf29){return db[_0x8e9e('0x18')][_0x8e9e('0x33')]({'where':{'id':_0x4d15b9[_0x8e9e('0x36')]['id']}})[_0x8e9e('0xf')](handleEntityNotFound(_0x57bf29,null))[_0x8e9e('0xf')](removeEntity(_0x57bf29,null))[_0x8e9e('0x2e')](handleError(_0x57bf29,null));};exports['getConfigurations']=function(_0x5c0abc,_0x30ebf5){var _0x12229b={};var _0x58b1d1={};var _0x3bdf84;var _0x488948;return db[_0x8e9e('0x18')]['findOne']({'where':{'id':_0x5c0abc['params']['id']}})[_0x8e9e('0xf')](handleEntityNotFound(_0x30ebf5,null))[_0x8e9e('0xf')](function(_0xe14a7){if(_0xe14a7){_0x3bdf84=_0xe14a7;_0x58b1d1['model']=_['keys'](db[_0x8e9e('0x37')][_0x8e9e('0x31')]);_0x58b1d1[_0x8e9e('0x1d')]=_[_0x8e9e('0x30')](_0x5c0abc[_0x8e9e('0x1d')]);_0x58b1d1[_0x8e9e('0x1e')]=_[_0x8e9e('0x1f')](_0x58b1d1[_0x8e9e('0x1c')],_0x58b1d1[_0x8e9e('0x1d')]);_0x12229b[_0x8e9e('0x20')]=_['intersection'](_0x58b1d1[_0x8e9e('0x1c')],qs[_0x8e9e('0x21')](_0x5c0abc[_0x8e9e('0x1d')]['fields']));_0x12229b[_0x8e9e('0x20')]=_0x12229b['attributes']['length']?_0x12229b[_0x8e9e('0x20')]:_0x58b1d1[_0x8e9e('0x1c')];_0x12229b[_0x8e9e('0x23')]=qs[_0x8e9e('0x24')](_0x5c0abc[_0x8e9e('0x1d')][_0x8e9e('0x24')]);_0x12229b[_0x8e9e('0x25')]=qs['filters'](_['pick'](_0x5c0abc['query'],_0x58b1d1[_0x8e9e('0x1e')]));if(_0x5c0abc[_0x8e9e('0x1d')][_0x8e9e('0x27')]){_0x12229b[_0x8e9e('0x25')]=_[_0x8e9e('0x28')](_0x12229b[_0x8e9e('0x25')],{'$or':_['map'](_0x12229b['attributes'],function(_0x238aca){var _0x32606f={};_0x32606f[_0x238aca]={'$like':'%'+_0x5c0abc['query']['filter']+'%'};return _0x32606f;})});}_0x12229b=_['merge']({},_0x12229b,_0x5c0abc['options']);return _0x3bdf84['getConfigurations'](_0x12229b);}})['then'](function(_0x6d7fe1){if(_0x6d7fe1){_0x488948=_0x6d7fe1[_0x8e9e('0x32')];if(!_0x5c0abc[_0x8e9e('0x1d')][_0x8e9e('0x38')](_0x8e9e('0x22'))){_0x12229b[_0x8e9e('0xa')]=qs['limit'](_0x5c0abc[_0x8e9e('0x1d')]['limit']);_0x12229b[_0x8e9e('0x8')]=qs[_0x8e9e('0x8')](_0x5c0abc[_0x8e9e('0x1d')][_0x8e9e('0x8')]);}return _0x3bdf84[_0x8e9e('0x39')](_0x12229b);}})[_0x8e9e('0xf')](function(_0x127589){if(_0x127589){return _0x127589?{'count':_0x488948,'rows':_0x127589}:null;}})[_0x8e9e('0xf')](respondWithResult(_0x30ebf5,null))[_0x8e9e('0x2e')](handleError(_0x30ebf5,null));};exports[_0x8e9e('0x3a')]=function(_0x1e43a8,_0x367f2c){if(_0x1e43a8[_0x8e9e('0x35')]['id']){delete _0x1e43a8[_0x8e9e('0x35')]['id'];}return db[_0x8e9e('0x18')][_0x8e9e('0x3b')]({'where':{'id':_0x1e43a8[_0x8e9e('0x36')]['id']}})['then'](handleEntityNotFound(_0x367f2c,null))[_0x8e9e('0xf')](function(_0x3e538a){if(_0x3e538a){_0x1e43a8['body'][_0x8e9e('0x3c')]=_0x3e538a['id'];_0x1e43a8[_0x8e9e('0x35')][_0x8e9e('0x3d')]=integrations['getSubjects'](_0x1e43a8[_0x8e9e('0x35')][_0x8e9e('0x3e')],_0x1e43a8[_0x8e9e('0x35')][_0x8e9e('0x1a')]);_0x1e43a8[_0x8e9e('0x35')][_0x8e9e('0x3f')]=integrations[_0x8e9e('0x40')](_0x1e43a8[_0x8e9e('0x35')][_0x8e9e('0x3e')],_0x1e43a8[_0x8e9e('0x35')][_0x8e9e('0x1a')]);return db[_0x8e9e('0x37')][_0x8e9e('0x34')](_0x1e43a8['body'],{'include':[{'model':db[_0x8e9e('0x41')],'as':_0x8e9e('0x3d')},{'model':db[_0x8e9e('0x41')],'as':_0x8e9e('0x3f')}]});}return null;})[_0x8e9e('0xf')](respondWithResult(_0x367f2c,null))[_0x8e9e('0x2e')](handleError(_0x367f2c,null));};function sanitizeRemoteUri(_0x2bcebf){var _0x4d6041=_0x2bcebf[_0x8e9e('0x42')](-0x1);if(_0x4d6041==='/')return _0x2bcebf[_0x8e9e('0x43')](0x0,_0x2bcebf['lastIndexOf'](_0x4d6041));return _0x2bcebf;}function getWebApiUrl(_0x598676){return util[_0x8e9e('0x44')](_0x8e9e('0x45'),_0x598676);}exports[_0x8e9e('0x46')]=function(_0x557ee5,_0x366359){var _0xe8efe4=_0x557ee5[_0x8e9e('0x1d')]['ticketType'];var _0x4663e4=_0xe8efe4==='incident'?_0x8e9e('0x47'):_0x8e9e('0x48');var _0x74076f='';var _0x2aaadc='';var _0x287cdd='';var _0x507f5f='';var _0x8ff8a6='';var _0x1dd757='';var _0x5c9b5f='';var _0x476176='';var _0x1f51df=[_0x8e9e('0x49'),_0x8e9e('0x4a'),_0x8e9e('0x4b'),_0x8e9e('0x4c'),_0x8e9e('0x4d'),'subject',_0x8e9e('0x4e'),_0x8e9e('0x4f'),_0x8e9e('0x50'),_0x8e9e('0x51')];var _0x59f9b4=[_0x8e9e('0x52'),_0x8e9e('0x53'),_0x8e9e('0x54'),_0x8e9e('0x55'),_0x8e9e('0x56'),_0x8e9e('0x57'),_0x8e9e('0x58'),_0x8e9e('0x59'),'createdbyexternalpartyname',_0x8e9e('0x5a'),_0x8e9e('0x5b'),'createdbyyominame',_0x8e9e('0x5c'),_0x8e9e('0x5d'),'createdonbehalfbyyominame',_0x8e9e('0x5e'),_0x8e9e('0x5f'),_0x8e9e('0x60'),_0x8e9e('0x61'),'entitlementidname',_0x8e9e('0x62'),_0x8e9e('0x63'),_0x8e9e('0x64'),_0x8e9e('0x65'),'firstresponsebykpiidname',_0x8e9e('0x66'),_0x8e9e('0x67'),_0x8e9e('0x68'),'kbarticleidname',_0x8e9e('0x69'),_0x8e9e('0x6a'),'modifiedbyexternalpartyname',_0x8e9e('0x6b'),_0x8e9e('0x6c'),_0x8e9e('0x6d'),_0x8e9e('0x6e'),_0x8e9e('0x6f'),_0x8e9e('0x70'),_0x8e9e('0x71'),_0x8e9e('0x72'),'numberofchildincidents',_0x8e9e('0x73'),_0x8e9e('0x74'),_0x8e9e('0x75'),_0x8e9e('0x76'),_0x8e9e('0x77'),_0x8e9e('0x78'),'primarycontactidname','primarycontactidyominame',_0x8e9e('0x79'),'productidname',_0x8e9e('0x7a'),_0x8e9e('0x7b'),_0x8e9e('0x7c'),'responseby',_0x8e9e('0x7d'),_0x8e9e('0x7e'),'sentimentvalue','slainvokedidname',_0x8e9e('0x7f'),_0x8e9e('0x80'),_0x8e9e('0x81'),_0x8e9e('0x82'),_0x8e9e('0x83'),'ticketnumber',_0x8e9e('0x84'),_0x8e9e('0x85'),_0x8e9e('0x86'),'utcconversiontimezonecode',_0x8e9e('0x87')];var _0x14fc5d=_0x1f51df[_0x8e9e('0x88')](_0x59f9b4);return db[_0x8e9e('0x18')][_0x8e9e('0x3b')]({'where':{'id':_0x557ee5['params']['id']},'attributes':['id',_0x8e9e('0x89'),_0x8e9e('0x8a'),_0x8e9e('0x8b'),_0x8e9e('0x8c'),'clientId',_0x8e9e('0x8d'),_0x8e9e('0x8e')],'include':[{'model':db[_0x8e9e('0x8f')],'as':_0x8e9e('0x8f'),'attributes':['id',_0x8e9e('0x90'),_0x8e9e('0x91')]}]})[_0x8e9e('0xf')](handleEntityNotFound(_0x366359,null))['then'](function(_0x338dee){if(_0x338dee){if(_0x338dee['modernAuthentication']){_0x338dee['access_token']=_0x338dee[_0x8e9e('0x8f')][_0x8e9e('0x90')];_0x476176=sanitizeRemoteUri(_0x338dee[_0x8e9e('0x8f')][_0x8e9e('0x91')]);_0x5c9b5f=getWebApiUrl(_0x476176);return _0x338dee;}_0x476176=sanitizeRemoteUri(_0x338dee[_0x8e9e('0x8b')]);_0x5c9b5f=getWebApiUrl(_0x476176);var _0x49695c={'method':_0x8e9e('0x92'),'uri':_0x8e9e('0x93')+_0x338dee['tenantId']+_0x8e9e('0x94'),'form':{'client_id':_0x338dee[_0x8e9e('0x95')],'resource':_0x476176,'username':_0x338dee['username'],'password':_0x338dee[_0x8e9e('0x8a')],'grant_type':_0x8e9e('0x8a'),'client_secret':_0x338dee[_0x8e9e('0x8d')]},'json':!![]};return rp(_0x49695c);}})[_0x8e9e('0xf')](function(_0x46a515){_0x1dd757=_0x46a515['access_token'];var _0x212066={'method':_0x8e9e('0x96'),'uri':encodeURI(_0x5c9b5f+_0x8e9e('0x97')+_0x4663e4+'\x27'),'headers':{'Authorization':_0x8e9e('0x98')+_0x1dd757,'If-None-Match':null,'OData-Version':_0x8e9e('0x99')},'json':!![]};return rp(_0x212066);})[_0x8e9e('0xf')](function(_0x461d0e){var _0x1979a7=_0x461d0e[_0x8e9e('0x9a')][0x0];var _0x4ae037=_0x1979a7[_0x8e9e('0x9b')];var _0x5f3e11={'method':'GET','uri':_0x5c9b5f+_0x8e9e('0x9c')+_0x4ae037+_0x8e9e('0x9d'),'headers':{'Authorization':_0x8e9e('0x98')+_0x1dd757,'If-None-Match':null,'OData-Version':_0x8e9e('0x99')},'json':!![]};return rp(_0x5f3e11);})['then'](function(_0xa5ad0b){_0x74076f=_0xa5ad0b;_0x2aaadc=_0x74076f['Attributes'];_0x2aaadc=_[_0x8e9e('0x9e')](_0x2aaadc,function(_0x12e9a0){return!_0x14fc5d[_0x8e9e('0x9f')](_0x12e9a0['LogicalName']);});var _0x1da900=[];var _0x4fbf2f=[];_0x2aaadc[_0x8e9e('0xa0')](function(_0x18996f){if(_0x18996f['@odata.type']){var _0x1110c7=_0x18996f[_0x8e9e('0xa1')][_0x8e9e('0x43')](_0x18996f[_0x8e9e('0xa1')]['lastIndexOf']('.')+0x1);if(_0x1110c7===_0x8e9e('0xa2')){_0x1da900[_0x8e9e('0xa3')](getSelectList(_0x5c9b5f,_0xe8efe4,_0x4fbf2f,_0x74076f[_0x8e9e('0x9b')],_0x18996f['MetadataId'],_0x1dd757));}}});return Promise['all'](_0x1da900);})[_0x8e9e('0xf')](function(_0x1ba8b8){_0x287cdd=_0x1ba8b8[0x0];var _0x68ae35=[];var _0x3e4133=[];_0x2aaadc[_0x8e9e('0xa0')](function(_0xa5d58d){if(!_[_0x8e9e('0xa4')](_0xa5d58d['@odata.type'])){var _0xc266ad=_0xa5d58d[_0x8e9e('0xa1')][_0x8e9e('0x43')](_0xa5d58d['@odata.type'][_0x8e9e('0xa5')]('.')+0x1);if(_0xc266ad===_0x8e9e('0xa6')){_0x68ae35[_0x8e9e('0xa3')](getBooleanList(_0x5c9b5f,_0xe8efe4,_0x3e4133,_0x74076f[_0x8e9e('0x9b')],_0xa5d58d[_0x8e9e('0x9b')],_0x1dd757));}}});return Promise[_0x8e9e('0xa7')](_0x68ae35);})[_0x8e9e('0xf')](function(_0x4e5584){_0x507f5f=_0x4e5584[0x0];var _0x3678d2=[];var _0x1d3fef=[];_0x2aaadc['forEach'](function(_0x8d171a){if(_0x8d171a[_0x8e9e('0xa1')]){var _0x506559=_0x8d171a[_0x8e9e('0xa1')]['substring'](_0x8d171a['@odata.type'][_0x8e9e('0xa5')]('.')+0x1);if(_0x506559===_0x8e9e('0xa8')||_0x506559===_0x8e9e('0xa9')||_0x506559===_0x8e9e('0xaa')||_0x506559==='IntegerAttributeMetadata'||_0x506559==='MemoAttributeMetadata'||_0x506559===_0x8e9e('0xab')||_0x506559===_0x8e9e('0xac')||_0x506559===_0x8e9e('0xad')||_0x506559===_0x8e9e('0xae')||_0x506559===_0x8e9e('0xaf')){_0x3678d2[_0x8e9e('0xa3')](getInputList(_0x5c9b5f,_0xe8efe4,_0x506559,_0x1d3fef,_0x74076f[_0x8e9e('0x9b')],_0x8d171a[_0x8e9e('0x9b')],_0x1dd757));}}});return Promise['all'](_0x3678d2);})[_0x8e9e('0xf')](function(_0x243bd9){_0x8ff8a6=_0x243bd9[0x0];var _0x3827fd=_0x287cdd['concat'](_0x507f5f)[_0x8e9e('0x88')](_0x8ff8a6);var _0x55bcdd={'count':_0x3827fd[_0x8e9e('0x32')],'rows':_0x3827fd};return _0x55bcdd;})['then'](respondWithResult(_0x366359,null))[_0x8e9e('0x2e')](function(_0x6cfb02){var _0x16da90=_0x557ee5[_0x8e9e('0x1d')][_0x8e9e('0xb0')]?0x1f4:_0x6cfb02[_0x8e9e('0xb1')]||0x1f4;logger[_0x8e9e('0x13')](_0x6cfb02[_0x8e9e('0xb2')]);delete _0x6cfb02[_0x8e9e('0x14')];if(_0x16da90===0x191){_0x16da90=0x190;}_0x366359[_0x8e9e('0xc')](_0x16da90)[_0x8e9e('0x15')](_0x557ee5[_0x8e9e('0x1d')][_0x8e9e('0xb0')]?{'message':_0x8e9e('0xb3'),'statusCode':_0x6cfb02[_0x8e9e('0xb1')]}:_0x6cfb02);});};function getSelectList(_0x309085,_0x3b411b,_0x3b89a4,_0x44be22,_0xe6dc68,_0x56c887){var _0x7ea3f5={'method':'GET','uri':_0x309085+_0x8e9e('0x9c')+_0x44be22+_0x8e9e('0xb4')+_0xe6dc68+_0x8e9e('0xb5')+_0x8e9e('0xb6'),'headers':{'Authorization':_0x8e9e('0x98')+_0x56c887,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x7ea3f5)['then'](function(_0x2c9267){var _0x3ec38b=[];var _0x5dcd42=_0x2c9267['OptionSet'][_0x8e9e('0xb7')];_0x5dcd42[_0x8e9e('0xa0')](function(_0x10e276){_0x3ec38b[_0x8e9e('0xa3')]({'name':_0x10e276['Label']['UserLocalizedLabel']['Label'],'value':String(_0x10e276['Value'])});});var _0x505997={'id':_0x3b411b+'_'+_0x2c9267[_0x8e9e('0xb8')],'name':_0x2c9267['DisplayName'][_0x8e9e('0xb9')][_0x8e9e('0xba')],'custom':![],'options':_0x3ec38b};_0x3b89a4[_0x8e9e('0xa3')](_0x505997);return _0x3b89a4;});}function getBooleanList(_0x40e854,_0x404b46,_0x11685e,_0x30068e,_0x5e321a,_0x3a3054){var _0x7e4276={'method':'GET','uri':_0x40e854+'EntityDefinitions('+_0x30068e+_0x8e9e('0xb4')+_0x5e321a+_0x8e9e('0xbb'),'headers':{'Authorization':'Bearer\x20'+_0x3a3054,'If-None-Match':null,'OData-Version':_0x8e9e('0x99')},'json':!![]};return rp(_0x7e4276)['then'](function(_0x42412e){var _0x309e51=[];_0x309e51[_0x8e9e('0xa3')]({'name':_0x42412e[_0x8e9e('0xbc')][_0x8e9e('0xbd')][_0x8e9e('0xba')][_0x8e9e('0xb9')][_0x8e9e('0xba')],'value':_0x8e9e('0xbe')},{'name':_0x42412e['OptionSet'][_0x8e9e('0xbf')][_0x8e9e('0xba')][_0x8e9e('0xb9')][_0x8e9e('0xba')],'value':_0x8e9e('0xc0')});var _0x1cb605={'id':_0x404b46+'_'+_0x42412e[_0x8e9e('0xb8')],'name':_0x42412e[_0x8e9e('0xc1')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x309e51};_0x11685e[_0x8e9e('0xa3')](_0x1cb605);return _0x11685e;});}function getInputList(_0x41af6b,_0x3dfc57,_0x237f3a,_0x5c0793,_0x35c2ba,_0x607ee2,_0x543eb2){var _0x452c84={'method':'GET','uri':_0x41af6b+_0x8e9e('0x9c')+_0x35c2ba+_0x8e9e('0xb4')+_0x607ee2+_0x8e9e('0xc2')+_0x237f3a+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x543eb2,'If-None-Match':null,'OData-Version':_0x8e9e('0x99')},'json':!![]};return rp(_0x452c84)[_0x8e9e('0xf')](function(_0x41ee31){var _0x40fbb6={'id':_0x3dfc57+'_'+_0x41ee31['LogicalName'],'name':_0x41ee31[_0x8e9e('0xc1')][_0x8e9e('0xb9')]?_0x41ee31[_0x8e9e('0xc1')]['UserLocalizedLabel'][_0x8e9e('0xba')]:_0x41ee31[_0x8e9e('0xb8')],'custom':![],'options':[]};_0x5c0793[_0x8e9e('0xa3')](_0x40fbb6);return _0x5c0793;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index a4fa86e..41b593b 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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x5b862c,_0x541c55){var _0x303e00=function(_0x34e92b){while(--_0x34e92b){_0x5b862c['push'](_0x5b862c['shift']());}};_0x303e00(++_0x541c55);}(_0x757a,0xde));var _0xa757=function(_0x41d45c,_0x18131f){_0x41d45c=_0x41d45c-0x0;var _0x418f05=_0x757a[_0x41d45c];return _0x418f05;};'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 +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x56f437,_0x16b910){var _0x1ede62=function(_0x5a65ab){while(--_0x5a65ab){_0x56f437['push'](_0x56f437['shift']());}};_0x1ede62(++_0x16b910);}(_0xb7e7,0x121));var _0x7b7e=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xb7e7[_0x468b0f];return _0x3e74d9;};'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'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'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 5800b54..a9d51d0 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 _0x9bca=['http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDynamics365Account','findAll','options','raw','where','limit','include','map','attributes','model','stringify','Dynamics365Account','find','then','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x23699c,_0x44e04e){var _0xaa7d3=function(_0x4b8410){while(--_0x4b8410){_0x23699c['push'](_0x23699c['shift']());}};_0xaa7d3(++_0x44e04e);}(_0x9bca,0x12c));var _0xa9bc=function(_0x351c4e,_0x444b68){_0x351c4e=_0x351c4e-0x0;var _0x42a8ad=_0x9bca[_0x351c4e];return _0x42a8ad;};'use strict';var _=require(_0xa9bc('0x0'));var util=require(_0xa9bc('0x1'));var moment=require(_0xa9bc('0x2'));var BPromise=require(_0xa9bc('0x3'));var rs=require(_0xa9bc('0x4'));var fs=require('fs');var Redis=require(_0xa9bc('0x5'));var db=require(_0xa9bc('0x6'))['db'];var utils=require(_0xa9bc('0x7'));var logger=require('../../config/logger')(_0xa9bc('0x8'));var config=require(_0xa9bc('0x9'));var jayson=require(_0xa9bc('0xa'));var client=jayson[_0xa9bc('0xb')][_0xa9bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f078f,_0x40e9fe,_0x267b69){return new BPromise(function(_0x1160fd,_0x5182a1){return client[_0xa9bc('0xd')](_0x2f078f,_0x267b69)['then'](function(_0x421aca){logger[_0xa9bc('0xe')](_0xa9bc('0xf'),_0x40e9fe,_0xa9bc('0x10'));logger[_0xa9bc('0x11')](_0xa9bc('0x12'),_0x40e9fe,_0xa9bc('0x10'),JSON['stringify'](_0x421aca));if(_0x421aca[_0xa9bc('0x13')]){if(_0x421aca[_0xa9bc('0x13')][_0xa9bc('0x14')]===0x1f4){logger[_0xa9bc('0x13')](_0xa9bc('0xf'),_0x40e9fe,_0x421aca[_0xa9bc('0x13')][_0xa9bc('0x15')]);return _0x5182a1(_0x421aca[_0xa9bc('0x13')][_0xa9bc('0x15')]);}logger['error'](_0xa9bc('0xf'),_0x40e9fe,_0x421aca[_0xa9bc('0x13')][_0xa9bc('0x15')]);return _0x1160fd(_0x421aca[_0xa9bc('0x13')][_0xa9bc('0x15')]);}else{logger['info'](_0xa9bc('0xf'),_0x40e9fe,_0xa9bc('0x10'));_0x1160fd(_0x421aca[_0xa9bc('0x16')]['message']);}})[_0xa9bc('0x17')](function(_0x45f879){logger[_0xa9bc('0x13')](_0xa9bc('0xf'),_0x40e9fe,_0x45f879);_0x5182a1(_0x45f879);});});}exports[_0xa9bc('0x18')]=function(_0x4bffb4){var _0xdb90a6=this;return new Promise(function(_0x3d96e2,_0x353e64){return db['Dynamics365Account'][_0xa9bc('0x19')]({'raw':_0x4bffb4['options']?_0x4bffb4[_0xa9bc('0x1a')][_0xa9bc('0x1b')]===undefined?!![]:![]:!![],'where':_0x4bffb4[_0xa9bc('0x1a')]?_0x4bffb4[_0xa9bc('0x1a')][_0xa9bc('0x1c')]||null:null,'attributes':_0x4bffb4[_0xa9bc('0x1a')]?_0x4bffb4[_0xa9bc('0x1a')]['attributes']||null:null,'limit':_0x4bffb4['options']?_0x4bffb4[_0xa9bc('0x1a')][_0xa9bc('0x1d')]||null:null,'include':_0x4bffb4[_0xa9bc('0x1a')]?_0x4bffb4[_0xa9bc('0x1a')][_0xa9bc('0x1e')]?_[_0xa9bc('0x1f')](_0x4bffb4['options'][_0xa9bc('0x1e')],function(_0x3c4085){return{'model':db[_0x3c4085['model']],'as':_0x3c4085['as'],'attributes':_0x3c4085[_0xa9bc('0x20')],'include':_0x3c4085[_0xa9bc('0x1e')]?_[_0xa9bc('0x1f')](_0x3c4085[_0xa9bc('0x1e')],function(_0x3dc5f5){return{'model':db[_0x3dc5f5[_0xa9bc('0x21')]],'as':_0x3dc5f5['as'],'attributes':_0x3dc5f5[_0xa9bc('0x20')],'include':_0x3dc5f5[_0xa9bc('0x1e')]?_[_0xa9bc('0x1f')](_0x3dc5f5[_0xa9bc('0x1e')],function(_0x118463){return{'model':db[_0x118463[_0xa9bc('0x21')]],'as':_0x118463['as'],'attributes':_0x118463['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x274189){logger[_0xa9bc('0xe')](_0xa9bc('0x18'),_0x4bffb4);logger[_0xa9bc('0x11')](_0xa9bc('0x18'),_0x4bffb4,JSON[_0xa9bc('0x22')](_0x274189));_0x3d96e2(_0x274189);})[_0xa9bc('0x17')](function(_0x21428b){logger[_0xa9bc('0x13')](_0xa9bc('0x18'),_0x21428b[_0xa9bc('0x15')],_0x4bffb4);_0x353e64(_0xdb90a6['error'](0x1f4,_0x21428b[_0xa9bc('0x15')]));});});};exports['ShowDynamics365Account']=function(_0xd7e582){var _0x46eecb=this;return new Promise(function(_0x3ffe93,_0x48b3b5){return db[_0xa9bc('0x23')][_0xa9bc('0x24')]({'raw':_0xd7e582['options']?_0xd7e582[_0xa9bc('0x1a')][_0xa9bc('0x1b')]===undefined?!![]:![]:!![],'where':_0xd7e582[_0xa9bc('0x1a')]?_0xd7e582['options'][_0xa9bc('0x1c')]||null:null,'attributes':_0xd7e582[_0xa9bc('0x1a')]?_0xd7e582[_0xa9bc('0x1a')][_0xa9bc('0x20')]||null:null,'include':_0xd7e582[_0xa9bc('0x1a')]?_0xd7e582[_0xa9bc('0x1a')][_0xa9bc('0x1e')]?_['map'](_0xd7e582[_0xa9bc('0x1a')][_0xa9bc('0x1e')],function(_0x1f164e){return{'model':db[_0x1f164e[_0xa9bc('0x21')]],'as':_0x1f164e['as'],'attributes':_0x1f164e['attributes'],'include':_0x1f164e[_0xa9bc('0x1e')]?_[_0xa9bc('0x1f')](_0x1f164e[_0xa9bc('0x1e')],function(_0x1f41af){return{'model':db[_0x1f41af[_0xa9bc('0x21')]],'as':_0x1f41af['as'],'attributes':_0x1f41af[_0xa9bc('0x20')],'include':_0x1f41af[_0xa9bc('0x1e')]?_[_0xa9bc('0x1f')](_0x1f41af['include'],function(_0x4241bb){return{'model':db[_0x4241bb['model']],'as':_0x4241bb['as'],'attributes':_0x4241bb[_0xa9bc('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa9bc('0x25')](function(_0xf7c706){logger[_0xa9bc('0xe')](_0xa9bc('0x26'),_0xd7e582);logger['debug'](_0xa9bc('0x26'),_0xd7e582,JSON[_0xa9bc('0x22')](_0xf7c706));_0x3ffe93(_0xf7c706);})[_0xa9bc('0x17')](function(_0x2ed108){logger[_0xa9bc('0x13')]('ShowDynamics365Account',_0x2ed108[_0xa9bc('0x15')],_0xd7e582);_0x48b3b5(_0x46eecb['error'](0x1f4,_0x2ed108['message']));});});}; \ No newline at end of file +var _0x4def=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowDynamics365Account','then','debug','util'];(function(_0x51b66f,_0x23c9b0){var _0x545f8f=function(_0x175d84){while(--_0x175d84){_0x51b66f['push'](_0x51b66f['shift']());}};_0x545f8f(++_0x23c9b0);}(_0x4def,0xcb));var _0xf4de=function(_0x3f9aa0,_0x478ec3){_0x3f9aa0=_0x3f9aa0-0x0;var _0x4a82c0=_0x4def[_0x3f9aa0];return _0x4a82c0;};'use strict';var _=require('lodash');var util=require(_0xf4de('0x0'));var moment=require('moment');var BPromise=require(_0xf4de('0x1'));var rs=require(_0xf4de('0x2'));var fs=require('fs');var Redis=require(_0xf4de('0x3'));var db=require(_0xf4de('0x4'))['db'];var utils=require(_0xf4de('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf4de('0x6'));var jayson=require(_0xf4de('0x7'));var client=jayson[_0xf4de('0x8')][_0xf4de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47ad79,_0x27465f,_0x31316b){return new BPromise(function(_0x456168,_0x4eb27a){return client[_0xf4de('0xa')](_0x47ad79,_0x31316b)['then'](function(_0xd6aa2d){logger[_0xf4de('0xb')](_0xf4de('0xc'),_0x27465f,_0xf4de('0xd'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x27465f,_0xf4de('0xd'),JSON['stringify'](_0xd6aa2d));if(_0xd6aa2d[_0xf4de('0xe')]){if(_0xd6aa2d[_0xf4de('0xe')][_0xf4de('0xf')]===0x1f4){logger['error'](_0xf4de('0xc'),_0x27465f,_0xd6aa2d[_0xf4de('0xe')][_0xf4de('0x10')]);return _0x4eb27a(_0xd6aa2d[_0xf4de('0xe')]['message']);}logger[_0xf4de('0xe')](_0xf4de('0xc'),_0x27465f,_0xd6aa2d[_0xf4de('0xe')]['message']);return _0x456168(_0xd6aa2d[_0xf4de('0xe')][_0xf4de('0x10')]);}else{logger[_0xf4de('0xb')](_0xf4de('0xc'),_0x27465f,'request\x20sent');_0x456168(_0xd6aa2d[_0xf4de('0x11')][_0xf4de('0x10')]);}})[_0xf4de('0x12')](function(_0x341bc4){logger[_0xf4de('0xe')](_0xf4de('0xc'),_0x27465f,_0x341bc4);_0x4eb27a(_0x341bc4);});});}exports[_0xf4de('0x13')]=function(_0x5cbaad){var _0x32f9b3=this;return new Promise(function(_0x2e3fb5,_0x27c47a){return db[_0xf4de('0x14')][_0xf4de('0x15')]({'raw':_0x5cbaad[_0xf4de('0x16')]?_0x5cbaad['options'][_0xf4de('0x17')]===undefined?!![]:![]:!![],'where':_0x5cbaad[_0xf4de('0x16')]?_0x5cbaad[_0xf4de('0x16')][_0xf4de('0x18')]||null:null,'attributes':_0x5cbaad['options']?_0x5cbaad[_0xf4de('0x16')][_0xf4de('0x19')]||null:null,'limit':_0x5cbaad[_0xf4de('0x16')]?_0x5cbaad[_0xf4de('0x16')][_0xf4de('0x1a')]||null:null,'include':_0x5cbaad[_0xf4de('0x16')]?_0x5cbaad[_0xf4de('0x16')][_0xf4de('0x1b')]?_['map'](_0x5cbaad[_0xf4de('0x16')][_0xf4de('0x1b')],function(_0x3859d8){return{'model':db[_0x3859d8[_0xf4de('0x1c')]],'as':_0x3859d8['as'],'attributes':_0x3859d8[_0xf4de('0x19')],'include':_0x3859d8[_0xf4de('0x1b')]?_[_0xf4de('0x1d')](_0x3859d8[_0xf4de('0x1b')],function(_0x3090a1){return{'model':db[_0x3090a1[_0xf4de('0x1c')]],'as':_0x3090a1['as'],'attributes':_0x3090a1[_0xf4de('0x19')],'include':_0x3090a1[_0xf4de('0x1b')]?_[_0xf4de('0x1d')](_0x3090a1[_0xf4de('0x1b')],function(_0xfaf430){return{'model':db[_0xfaf430[_0xf4de('0x1c')]],'as':_0xfaf430['as'],'attributes':_0xfaf430[_0xf4de('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x374a65){logger[_0xf4de('0xb')](_0xf4de('0x13'),_0x5cbaad);logger['debug'](_0xf4de('0x13'),_0x5cbaad,JSON[_0xf4de('0x1e')](_0x374a65));_0x2e3fb5(_0x374a65);})[_0xf4de('0x12')](function(_0x37ed72){logger[_0xf4de('0xe')](_0xf4de('0x13'),_0x37ed72[_0xf4de('0x10')],_0x5cbaad);_0x27c47a(_0x32f9b3[_0xf4de('0xe')](0x1f4,_0x37ed72[_0xf4de('0x10')]));});});};exports[_0xf4de('0x1f')]=function(_0x5e8b06){var _0x176620=this;return new Promise(function(_0x5a90ea,_0x3c2a12){return db[_0xf4de('0x14')]['find']({'raw':_0x5e8b06['options']?_0x5e8b06[_0xf4de('0x16')][_0xf4de('0x17')]===undefined?!![]:![]:!![],'where':_0x5e8b06[_0xf4de('0x16')]?_0x5e8b06[_0xf4de('0x16')]['where']||null:null,'attributes':_0x5e8b06[_0xf4de('0x16')]?_0x5e8b06[_0xf4de('0x16')][_0xf4de('0x19')]||null:null,'include':_0x5e8b06[_0xf4de('0x16')]?_0x5e8b06[_0xf4de('0x16')][_0xf4de('0x1b')]?_[_0xf4de('0x1d')](_0x5e8b06[_0xf4de('0x16')][_0xf4de('0x1b')],function(_0x5b6298){return{'model':db[_0x5b6298[_0xf4de('0x1c')]],'as':_0x5b6298['as'],'attributes':_0x5b6298[_0xf4de('0x19')],'include':_0x5b6298[_0xf4de('0x1b')]?_[_0xf4de('0x1d')](_0x5b6298['include'],function(_0x1dfa07){return{'model':db[_0x1dfa07[_0xf4de('0x1c')]],'as':_0x1dfa07['as'],'attributes':_0x1dfa07[_0xf4de('0x19')],'include':_0x1dfa07[_0xf4de('0x1b')]?_['map'](_0x1dfa07[_0xf4de('0x1b')],function(_0x3e0e12){return{'model':db[_0x3e0e12[_0xf4de('0x1c')]],'as':_0x3e0e12['as'],'attributes':_0x3e0e12[_0xf4de('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf4de('0x20')](function(_0x15612b){logger[_0xf4de('0xb')]('ShowDynamics365Account',_0x5e8b06);logger[_0xf4de('0x21')](_0xf4de('0x1f'),_0x5e8b06,JSON[_0xf4de('0x1e')](_0x15612b));_0x5a90ea(_0x15612b);})[_0xf4de('0x12')](function(_0x190e63){logger[_0xf4de('0xe')](_0xf4de('0x1f'),_0x190e63[_0xf4de('0x10')],_0x5e8b06);_0x3c2a12(_0x176620[_0xf4de('0xe')](0x1f4,_0x190e63['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 02db322..e38d6ac 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 _0x18a8=['get','/:id','show','getSubjects','getDescriptions','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index'];(function(_0x32e646,_0x85e8f1){var _0x40c5d9=function(_0x5d1548){while(--_0x5d1548){_0x32e646['push'](_0x32e646['shift']());}};_0x40c5d9(++_0x85e8f1);}(_0x18a8,0x127));var _0x818a=function(_0x46dba8,_0x15f02e){_0x46dba8=_0x46dba8-0x0;var _0x35614e=_0x18a8[_0x46dba8];return _0x35614e;};'use strict';var multer=require(_0x818a('0x0'));var util=require(_0x818a('0x1'));var path=require('path');var timeout=require(_0x818a('0x2'));var express=require(_0x818a('0x3'));var router=express[_0x818a('0x4')]();var fs_extra=require(_0x818a('0x5'));var auth=require(_0x818a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x818a('0x7'));var controller=require(_0x818a('0x8'));router['get']('/',auth[_0x818a('0x9')](),controller[_0x818a('0xa')]);router[_0x818a('0xb')](_0x818a('0xc'),auth[_0x818a('0x9')](),controller[_0x818a('0xd')]);router[_0x818a('0xb')]('/:id/fields',auth[_0x818a('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x818a('0xe')]);router[_0x818a('0xb')]('/:id/descriptions',auth[_0x818a('0x9')](),controller[_0x818a('0xf')]);router['post']('/',auth[_0x818a('0x9')](),controller['create']);router['put'](_0x818a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x818a('0x10')](_0x818a('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x818a('0x11')]=router; \ No newline at end of file +var _0xb7e2=['../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','multer','path','express','fs-extra','../../components/interaction/service'];(function(_0x208dcd,_0x21b78a){var _0x471717=function(_0x4bf68a){while(--_0x4bf68a){_0x208dcd['push'](_0x208dcd['shift']());}};_0x471717(++_0x21b78a);}(_0xb7e2,0x103));var _0x2b7e=function(_0x2ef84a,_0xdf6a89){_0x2ef84a=_0x2ef84a-0x0;var _0x20b62a=_0xb7e2[_0x2ef84a];return _0x20b62a;};'use strict';var multer=require(_0x2b7e('0x0'));var util=require('util');var path=require(_0x2b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x2b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x2b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2b7e('0x4'));var config=require(_0x2b7e('0x5'));var controller=require(_0x2b7e('0x6'));router[_0x2b7e('0x7')]('/',auth[_0x2b7e('0x8')](),controller[_0x2b7e('0x9')]);router['get'](_0x2b7e('0xa'),auth[_0x2b7e('0x8')](),controller[_0x2b7e('0xb')]);router['get'](_0x2b7e('0xc'),auth[_0x2b7e('0x8')](),controller[_0x2b7e('0xd')]);router[_0x2b7e('0x7')](_0x2b7e('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x2b7e('0x7')](_0x2b7e('0xf'),auth[_0x2b7e('0x8')](),controller[_0x2b7e('0x10')]);router[_0x2b7e('0x11')]('/',auth[_0x2b7e('0x8')](),controller[_0x2b7e('0x12')]);router['put'](_0x2b7e('0xa'),auth[_0x2b7e('0x8')](),controller[_0x2b7e('0x13')]);router[_0x2b7e('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2b7e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e0e6f10..019ce41 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 _0x2c8b=['contact','sequelize','exports','STRING','ENUM','incident','phonecall'];(function(_0x54361a,_0x68068e){var _0x5f3a15=function(_0x292137){while(--_0x292137){_0x54361a['push'](_0x54361a['shift']());}};_0x5f3a15(++_0x68068e);}(_0x2c8b,0x1eb));var _0xb2c8=function(_0x373b1b,_0x4efa64){_0x373b1b=_0x373b1b-0x0;var _0x21a34c=_0x2c8b[_0x373b1b];return _0x21a34c;};'use strict';var Sequelize=require(_0xb2c8('0x0'));module[_0xb2c8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb2c8('0x2')]},'ticketType':{'type':Sequelize[_0xb2c8('0x3')](_0xb2c8('0x4'),_0xb2c8('0x5')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xb2c8('0x3')](_0xb2c8('0x6'),'nothing'),'defaultValue':_0xb2c8('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xb2c8('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x8057=['sequelize','exports','STRING','ENUM','incident','phonecall','contact','nothing'];(function(_0x50d5ae,_0x22a349){var _0x1e8d74=function(_0xd256a9){while(--_0xd256a9){_0x50d5ae['push'](_0x50d5ae['shift']());}};_0x1e8d74(++_0x22a349);}(_0x8057,0x150));var _0x7805=function(_0x2ebd47,_0x5c7d31){_0x2ebd47=_0x2ebd47-0x0;var _0x21cea0=_0x8057[_0x2ebd47];return _0x21cea0;};'use strict';var Sequelize=require(_0x7805('0x0'));module[_0x7805('0x1')]={'name':{'type':Sequelize[_0x7805('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x7805('0x3')](_0x7805('0x4'),_0x7805('0x5')),'defaultValue':_0x7805('0x4')},'moduleCreate':{'type':Sequelize[_0x7805('0x3')](_0x7805('0x6'),_0x7805('0x7')),'defaultValue':_0x7805('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7805('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index e4f2483..8a0d077 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 _0xaf53=['moment','util','path','ejs','fs-extra','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','getFields','Dynamics365Field','hasOwnProperty','nolimit','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2f9d4c,_0x1f500a){var _0x5769c2=function(_0xa4e928){while(--_0xa4e928){_0x2f9d4c['push'](_0x2f9d4c['shift']());}};_0x5769c2(++_0x1f500a);}(_0xaf53,0x19f));var _0x3af5=function(_0x190597,_0x27cf55){_0x190597=_0x190597-0x0;var _0x44e38d=_0xaf53[_0x190597];return _0x44e38d;};'use strict';var emlformat=require(_0x3af5('0x0'));var rimraf=require(_0x3af5('0x1'));var zipdir=require(_0x3af5('0x2'));var jsonpatch=require(_0x3af5('0x3'));var rp=require(_0x3af5('0x4'));var moment=require(_0x3af5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3af5('0x6'));var path=require(_0x3af5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3af5('0x8'));var fs=require('fs');var fs_extra=require(_0x3af5('0x9'));var _=require('lodash');var squel=require(_0x3af5('0xa'));var crypto=require(_0x3af5('0xb'));var jsforce=require(_0x3af5('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3af5('0xd'));var Papa=require(_0x3af5('0xe'));var Redis=require(_0x3af5('0xf'));var authService=require(_0x3af5('0x10'));var qs=require(_0x3af5('0x11'));var as=require(_0x3af5('0x12'));var hardwareService=require(_0x3af5('0x13'));var logger=require(_0x3af5('0x14'))(_0x3af5('0x15'));var utils=require(_0x3af5('0x16'));var config=require(_0x3af5('0x17'));var licenseUtil=require(_0x3af5('0x18'));var db=require(_0x3af5('0x19'))['db'];function respondWithStatusCode(_0x1f1893,_0x153f0e){_0x153f0e=_0x153f0e||0xcc;return function(_0x5bd797){if(_0x5bd797){return _0x1f1893[_0x3af5('0x1a')](_0x153f0e);}return _0x1f1893[_0x3af5('0x1b')](_0x153f0e)[_0x3af5('0x1c')]();};}function respondWithResult(_0xe3df0,_0x614ef){_0x614ef=_0x614ef||0xc8;return function(_0x4a83c7){if(_0x4a83c7){return _0xe3df0[_0x3af5('0x1b')](_0x614ef)[_0x3af5('0x1d')](_0x4a83c7);}};}function respondWithFilteredResult(_0x2ddf23,_0x36661f){return function(_0x184491){if(_0x184491){var _0x3f942a=typeof _0x36661f[_0x3af5('0x1e')]===_0x3af5('0x1f')&&typeof _0x36661f[_0x3af5('0x20')]==='undefined';var _0x218d5b=_0x184491[_0x3af5('0x21')];var _0x4a3e2a=_0x3f942a?0x0:_0x36661f['offset'];var _0x46cd2d=_0x3f942a?_0x184491['count']:_0x36661f['offset']+_0x36661f[_0x3af5('0x20')];var _0x5ca327;if(_0x46cd2d>=_0x218d5b){_0x46cd2d=_0x218d5b;_0x5ca327=0xc8;}else{_0x5ca327=0xce;}_0x2ddf23[_0x3af5('0x1b')](_0x5ca327);return _0x2ddf23[_0x3af5('0x22')](_0x3af5('0x23'),_0x4a3e2a+'-'+_0x46cd2d+'/'+_0x218d5b)[_0x3af5('0x1d')](_0x184491);}return null;};}function patchUpdates(_0xd8939e){return function(_0x7f7d09){try{jsonpatch[_0x3af5('0x24')](_0x7f7d09,_0xd8939e,!![]);}catch(_0x49ba01){return BPromise[_0x3af5('0x25')](_0x49ba01);}return _0x7f7d09[_0x3af5('0x26')]();};}function saveUpdates(_0x4c0367,_0x5e61fe){return function(_0x18c1a6){if(_0x18c1a6){return _0x18c1a6[_0x3af5('0x27')](_0x4c0367)[_0x3af5('0x28')](function(_0x5314f2){return _0x5314f2;});}return null;};}function removeEntity(_0x32512c,_0x992528){return function(_0x170220){if(_0x170220){return _0x170220[_0x3af5('0x29')]()[_0x3af5('0x28')](function(){_0x32512c[_0x3af5('0x1b')](0xcc)[_0x3af5('0x1c')]();});}};}function handleEntityNotFound(_0x13b12f,_0x3af375){return function(_0xb83fb2){if(!_0xb83fb2){_0x13b12f[_0x3af5('0x1a')](0x194);}return _0xb83fb2;};}function handleError(_0x29950a,_0x36170e){_0x36170e=_0x36170e||0x1f4;return function(_0x397729){logger[_0x3af5('0x2a')](_0x397729[_0x3af5('0x2b')]);if(_0x397729[_0x3af5('0x2c')]){delete _0x397729['name'];}_0x29950a['status'](_0x36170e)[_0x3af5('0x2d')](_0x397729);};}exports[_0x3af5('0x2e')]=function(_0x549563,_0x3bda2a){var _0x294014={},_0x49bb30={},_0x325e55={'count':0x0,'rows':[]};var _0x298fb3=_[_0x3af5('0x2f')](db[_0x3af5('0x30')][_0x3af5('0x31')],function(_0x86b10d){return{'name':_0x86b10d[_0x3af5('0x32')],'type':_0x86b10d[_0x3af5('0x33')][_0x3af5('0x34')]};});_0x49bb30[_0x3af5('0x35')]=_[_0x3af5('0x2f')](_0x298fb3,'name');_0x49bb30[_0x3af5('0x36')]=_[_0x3af5('0x37')](_0x549563[_0x3af5('0x36')]);_0x49bb30[_0x3af5('0x38')]=_[_0x3af5('0x39')](_0x49bb30[_0x3af5('0x35')],_0x49bb30[_0x3af5('0x36')]);_0x294014[_0x3af5('0x3a')]=_[_0x3af5('0x39')](_0x49bb30['model'],qs[_0x3af5('0x3b')](_0x549563[_0x3af5('0x36')]['fields']));_0x294014[_0x3af5('0x3a')]=_0x294014[_0x3af5('0x3a')]['length']?_0x294014[_0x3af5('0x3a')]:_0x49bb30[_0x3af5('0x35')];if(!_0x549563['query']['hasOwnProperty']('nolimit')){_0x294014['limit']=qs[_0x3af5('0x20')](_0x549563['query']['limit']);_0x294014[_0x3af5('0x1e')]=qs['offset'](_0x549563[_0x3af5('0x36')][_0x3af5('0x1e')]);}_0x294014[_0x3af5('0x3c')]=qs[_0x3af5('0x3d')](_0x549563[_0x3af5('0x36')][_0x3af5('0x3d')]);_0x294014[_0x3af5('0x3e')]=qs['filters'](_[_0x3af5('0x3f')](_0x549563[_0x3af5('0x36')],_0x49bb30['filters']),_0x298fb3);if(_0x549563[_0x3af5('0x36')][_0x3af5('0x40')]){_0x294014[_0x3af5('0x3e')]=_[_0x3af5('0x41')](_0x294014['where'],{'$or':_[_0x3af5('0x2f')](_0x298fb3,function(_0x56aea9){if(_0x56aea9[_0x3af5('0x33')]!=='VIRTUAL'){var _0x5c1f13={};_0x5c1f13[_0x56aea9[_0x3af5('0x2c')]]={'$like':'%'+_0x549563[_0x3af5('0x36')][_0x3af5('0x40')]+'%'};return _0x5c1f13;}})});}_0x294014=_[_0x3af5('0x41')]({},_0x294014,_0x549563[_0x3af5('0x42')]);var _0x327a06={'where':_0x294014['where']};return db[_0x3af5('0x30')][_0x3af5('0x21')](_0x327a06)[_0x3af5('0x28')](function(_0x2c77fd){_0x325e55[_0x3af5('0x21')]=_0x2c77fd;if(_0x549563[_0x3af5('0x36')][_0x3af5('0x43')]){_0x294014[_0x3af5('0x44')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x294014);})[_0x3af5('0x28')](function(_0x2b3ac3){_0x325e55[_0x3af5('0x45')]=_0x2b3ac3;return _0x325e55;})['then'](respondWithFilteredResult(_0x3bda2a,_0x294014))[_0x3af5('0x46')](handleError(_0x3bda2a,null));};exports[_0x3af5('0x47')]=function(_0x2dbcb8,_0x416875){var _0x50d435={'raw':![],'where':{'id':_0x2dbcb8[_0x3af5('0x48')]['id']}},_0x6e28e7={};_0x6e28e7[_0x3af5('0x35')]=_[_0x3af5('0x37')](db[_0x3af5('0x30')]['rawAttributes']);_0x6e28e7['query']=_['keys'](_0x2dbcb8[_0x3af5('0x36')]);_0x6e28e7[_0x3af5('0x38')]=_[_0x3af5('0x39')](_0x6e28e7[_0x3af5('0x35')],_0x6e28e7[_0x3af5('0x36')]);_0x50d435[_0x3af5('0x3a')]=_[_0x3af5('0x39')](_0x6e28e7[_0x3af5('0x35')],qs[_0x3af5('0x3b')](_0x2dbcb8[_0x3af5('0x36')][_0x3af5('0x3b')]));_0x50d435[_0x3af5('0x3a')]=_0x50d435[_0x3af5('0x3a')][_0x3af5('0x49')]?_0x50d435[_0x3af5('0x3a')]:_0x6e28e7[_0x3af5('0x35')];if(_0x2dbcb8[_0x3af5('0x36')][_0x3af5('0x43')]){_0x50d435[_0x3af5('0x44')]=[{'all':!![]}];}_0x50d435=_[_0x3af5('0x41')]({},_0x50d435,_0x2dbcb8['options']);return db[_0x3af5('0x30')][_0x3af5('0x4a')](_0x50d435)[_0x3af5('0x28')](handleEntityNotFound(_0x416875,null))['then'](respondWithResult(_0x416875,null))[_0x3af5('0x46')](handleError(_0x416875,null));};exports[_0x3af5('0x4b')]=function(_0x402de6,_0x204815){return db[_0x3af5('0x30')][_0x3af5('0x4b')](_0x402de6[_0x3af5('0x4c')],{})['then'](respondWithResult(_0x204815,0xc9))[_0x3af5('0x46')](handleError(_0x204815,null));};exports[_0x3af5('0x27')]=function(_0x38a56a,_0x167877){if(_0x38a56a[_0x3af5('0x4c')]['id']){delete _0x38a56a[_0x3af5('0x4c')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x38a56a['params']['id']}})[_0x3af5('0x28')](handleEntityNotFound(_0x167877,null))[_0x3af5('0x28')](saveUpdates(_0x38a56a[_0x3af5('0x4c')],null))[_0x3af5('0x28')](respondWithResult(_0x167877,null))['catch'](handleError(_0x167877,null));};exports[_0x3af5('0x29')]=function(_0x260f52,_0x1f9369){return db[_0x3af5('0x30')][_0x3af5('0x4a')]({'where':{'id':_0x260f52[_0x3af5('0x48')]['id']}})[_0x3af5('0x28')](handleEntityNotFound(_0x1f9369,null))[_0x3af5('0x28')](removeEntity(_0x1f9369,null))[_0x3af5('0x46')](handleError(_0x1f9369,null));};exports[_0x3af5('0x4d')]=function(_0x2fe4a0,_0x276057,_0x78cd1b){var _0x4d0675={};var _0x2fd979={};var _0x23c1e7;var _0x445c6c;return db[_0x3af5('0x30')]['findOne']({'where':{'id':_0x2fe4a0[_0x3af5('0x48')]['id']}})['then'](handleEntityNotFound(_0x276057,null))['then'](function(_0x528340){if(_0x528340){_0x23c1e7=_0x528340;_0x2fd979[_0x3af5('0x35')]=_[_0x3af5('0x37')](db[_0x3af5('0x4e')][_0x3af5('0x31')]);_0x2fd979[_0x3af5('0x36')]=_[_0x3af5('0x37')](_0x2fe4a0[_0x3af5('0x36')]);_0x2fd979[_0x3af5('0x38')]=_[_0x3af5('0x39')](_0x2fd979['model'],_0x2fd979[_0x3af5('0x36')]);_0x4d0675[_0x3af5('0x3a')]=_['intersection'](_0x2fd979['model'],qs[_0x3af5('0x3b')](_0x2fe4a0[_0x3af5('0x36')]['fields']));_0x4d0675[_0x3af5('0x3a')]=_0x4d0675[_0x3af5('0x3a')][_0x3af5('0x49')]?_0x4d0675[_0x3af5('0x3a')]:_0x2fd979[_0x3af5('0x35')];_0x4d0675[_0x3af5('0x3c')]=qs[_0x3af5('0x3d')](_0x2fe4a0[_0x3af5('0x36')][_0x3af5('0x3d')]);_0x4d0675[_0x3af5('0x3e')]=qs[_0x3af5('0x38')](_['pick'](_0x2fe4a0[_0x3af5('0x36')],_0x2fd979[_0x3af5('0x38')]));if(_0x2fe4a0[_0x3af5('0x36')][_0x3af5('0x40')]){_0x4d0675['where']=_['merge'](_0x4d0675[_0x3af5('0x3e')],{'$or':_[_0x3af5('0x2f')](_0x4d0675['attributes'],function(_0x1d578a){var _0x2c0045={};_0x2c0045[_0x1d578a]={'$like':'%'+_0x2fe4a0[_0x3af5('0x36')]['filter']+'%'};return _0x2c0045;})});}_0x4d0675=_[_0x3af5('0x41')]({},_0x4d0675,_0x2fe4a0['options']);return _0x23c1e7[_0x3af5('0x4d')](_0x4d0675);}})[_0x3af5('0x28')](function(_0x2de8c7){if(_0x2de8c7){_0x445c6c=_0x2de8c7['length'];if(!_0x2fe4a0[_0x3af5('0x36')][_0x3af5('0x4f')](_0x3af5('0x50'))){_0x4d0675[_0x3af5('0x20')]=qs['limit'](_0x2fe4a0[_0x3af5('0x36')][_0x3af5('0x20')]);_0x4d0675[_0x3af5('0x1e')]=qs[_0x3af5('0x1e')](_0x2fe4a0['query'][_0x3af5('0x1e')]);}return _0x23c1e7['getFields'](_0x4d0675);}})[_0x3af5('0x28')](function(_0x106fdd){if(_0x106fdd){return _0x106fdd?{'count':_0x445c6c,'rows':_0x106fdd}:null;}})[_0x3af5('0x28')](respondWithResult(_0x276057,null))['catch'](handleError(_0x276057,null));};exports['getSubjects']=function(_0x141115,_0x17051a,_0x7012f8){var _0x3c5a1e={};var _0xdc3782={};var _0x117105;var _0x48cfe4;return db[_0x3af5('0x30')][_0x3af5('0x51')]({'where':{'id':_0x141115[_0x3af5('0x48')]['id']}})[_0x3af5('0x28')](handleEntityNotFound(_0x17051a,null))['then'](function(_0x193149){if(_0x193149){_0x117105=_0x193149;_0xdc3782[_0x3af5('0x35')]=_[_0x3af5('0x37')](db[_0x3af5('0x4e')][_0x3af5('0x31')]);_0xdc3782['query']=_['keys'](_0x141115[_0x3af5('0x36')]);_0xdc3782[_0x3af5('0x38')]=_[_0x3af5('0x39')](_0xdc3782['model'],_0xdc3782['query']);_0x3c5a1e['attributes']=_[_0x3af5('0x39')](_0xdc3782[_0x3af5('0x35')],qs[_0x3af5('0x3b')](_0x141115[_0x3af5('0x36')][_0x3af5('0x3b')]));_0x3c5a1e['attributes']=_0x3c5a1e['attributes'][_0x3af5('0x49')]?_0x3c5a1e[_0x3af5('0x3a')]:_0xdc3782['model'];_0x3c5a1e[_0x3af5('0x3c')]=qs[_0x3af5('0x3d')](_0x141115[_0x3af5('0x36')][_0x3af5('0x3d')]);_0x3c5a1e[_0x3af5('0x3e')]=qs['filters'](_['pick'](_0x141115['query'],_0xdc3782[_0x3af5('0x38')]));if(_0x141115[_0x3af5('0x36')][_0x3af5('0x40')]){_0x3c5a1e[_0x3af5('0x3e')]=_[_0x3af5('0x41')](_0x3c5a1e[_0x3af5('0x3e')],{'$or':_[_0x3af5('0x2f')](_0x3c5a1e[_0x3af5('0x3a')],function(_0x32b934){var _0x25a5a6={};_0x25a5a6[_0x32b934]={'$like':'%'+_0x141115[_0x3af5('0x36')][_0x3af5('0x40')]+'%'};return _0x25a5a6;})});}_0x3c5a1e=_['merge']({},_0x3c5a1e,_0x141115[_0x3af5('0x42')]);return _0x117105[_0x3af5('0x52')](_0x3c5a1e);}})[_0x3af5('0x28')](function(_0x477b47){if(_0x477b47){_0x48cfe4=_0x477b47['length'];if(!_0x141115['query']['hasOwnProperty'](_0x3af5('0x50'))){_0x3c5a1e[_0x3af5('0x20')]=qs['limit'](_0x141115['query'][_0x3af5('0x20')]);_0x3c5a1e[_0x3af5('0x1e')]=qs[_0x3af5('0x1e')](_0x141115[_0x3af5('0x36')][_0x3af5('0x1e')]);}return _0x117105[_0x3af5('0x52')](_0x3c5a1e);}})['then'](function(_0x317d8f){if(_0x317d8f){return _0x317d8f?{'count':_0x48cfe4,'rows':_0x317d8f}:null;}})[_0x3af5('0x28')](respondWithResult(_0x17051a,null))['catch'](handleError(_0x17051a,null));};exports[_0x3af5('0x53')]=function(_0x58dcf8,_0x26b7d1,_0x5f45b3){var _0x1767e7={};var _0x17e84a={};var _0x50263e;var _0x3bca81;return db['Dynamics365Configuration'][_0x3af5('0x51')]({'where':{'id':_0x58dcf8['params']['id']}})[_0x3af5('0x28')](handleEntityNotFound(_0x26b7d1,null))[_0x3af5('0x28')](function(_0x2b32a6){if(_0x2b32a6){_0x50263e=_0x2b32a6;_0x17e84a[_0x3af5('0x35')]=_[_0x3af5('0x37')](db[_0x3af5('0x4e')][_0x3af5('0x31')]);_0x17e84a[_0x3af5('0x36')]=_[_0x3af5('0x37')](_0x58dcf8[_0x3af5('0x36')]);_0x17e84a[_0x3af5('0x38')]=_['intersection'](_0x17e84a[_0x3af5('0x35')],_0x17e84a[_0x3af5('0x36')]);_0x1767e7['attributes']=_[_0x3af5('0x39')](_0x17e84a[_0x3af5('0x35')],qs[_0x3af5('0x3b')](_0x58dcf8[_0x3af5('0x36')][_0x3af5('0x3b')]));_0x1767e7[_0x3af5('0x3a')]=_0x1767e7[_0x3af5('0x3a')][_0x3af5('0x49')]?_0x1767e7['attributes']:_0x17e84a[_0x3af5('0x35')];_0x1767e7[_0x3af5('0x3c')]=qs[_0x3af5('0x3d')](_0x58dcf8[_0x3af5('0x36')][_0x3af5('0x3d')]);_0x1767e7['where']=qs[_0x3af5('0x38')](_[_0x3af5('0x3f')](_0x58dcf8['query'],_0x17e84a[_0x3af5('0x38')]));if(_0x58dcf8[_0x3af5('0x36')][_0x3af5('0x40')]){_0x1767e7['where']=_[_0x3af5('0x41')](_0x1767e7[_0x3af5('0x3e')],{'$or':_[_0x3af5('0x2f')](_0x1767e7[_0x3af5('0x3a')],function(_0x4543a6){var _0x17721e={};_0x17721e[_0x4543a6]={'$like':'%'+_0x58dcf8[_0x3af5('0x36')][_0x3af5('0x40')]+'%'};return _0x17721e;})});}_0x1767e7=_['merge']({},_0x1767e7,_0x58dcf8['options']);return _0x50263e[_0x3af5('0x53')](_0x1767e7);}})[_0x3af5('0x28')](function(_0x5b540f){if(_0x5b540f){_0x3bca81=_0x5b540f['length'];if(!_0x58dcf8[_0x3af5('0x36')][_0x3af5('0x4f')]('nolimit')){_0x1767e7[_0x3af5('0x20')]=qs[_0x3af5('0x20')](_0x58dcf8[_0x3af5('0x36')][_0x3af5('0x20')]);_0x1767e7['offset']=qs[_0x3af5('0x1e')](_0x58dcf8[_0x3af5('0x36')][_0x3af5('0x1e')]);}return _0x50263e[_0x3af5('0x53')](_0x1767e7);}})[_0x3af5('0x28')](function(_0x4bfa0a){if(_0x4bfa0a){return _0x4bfa0a?{'count':_0x3bca81,'rows':_0x4bfa0a}:null;}})[_0x3af5('0x28')](respondWithResult(_0x26b7d1,null))['catch'](handleError(_0x26b7d1,null));}; \ No newline at end of file +var _0xbb62=['sendStatus','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','map','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','intersection','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','request-promise','moment','util','sox','fs-extra','crypto','jsforce','desk.js','to-csv','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','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy'];(function(_0x55fbea,_0x381e55){var _0x13520d=function(_0x3ef0eb){while(--_0x3ef0eb){_0x55fbea['push'](_0x55fbea['shift']());}};_0x13520d(++_0x381e55);}(_0xbb62,0x163));var _0x2bb6=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xbb62[_0x54d4a8];return _0x3b321b;};'use strict';var emlformat=require(_0x2bb6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2bb6('0x1'));var moment=require(_0x2bb6('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2bb6('0x3'));var path=require('path');var sox=require(_0x2bb6('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2bb6('0x5'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2bb6('0x6'));var jsforce=require(_0x2bb6('0x7'));var deskjs=require(_0x2bb6('0x8'));var toCsv=require(_0x2bb6('0x9'));var querystring=require(_0x2bb6('0xa'));var Papa=require(_0x2bb6('0xb'));var Redis=require('ioredis');var authService=require(_0x2bb6('0xc'));var qs=require(_0x2bb6('0xd'));var as=require(_0x2bb6('0xe'));var hardwareService=require(_0x2bb6('0xf'));var logger=require(_0x2bb6('0x10'))(_0x2bb6('0x11'));var utils=require(_0x2bb6('0x12'));var config=require(_0x2bb6('0x13'));var licenseUtil=require(_0x2bb6('0x14'));var db=require(_0x2bb6('0x15'))['db'];function respondWithStatusCode(_0x6a86d6,_0x24209d){_0x24209d=_0x24209d||0xcc;return function(_0x29e289){if(_0x29e289){return _0x6a86d6['sendStatus'](_0x24209d);}return _0x6a86d6[_0x2bb6('0x16')](_0x24209d)[_0x2bb6('0x17')]();};}function respondWithResult(_0x436c94,_0x34fc14){_0x34fc14=_0x34fc14||0xc8;return function(_0x21899d){if(_0x21899d){return _0x436c94[_0x2bb6('0x16')](_0x34fc14)['json'](_0x21899d);}};}function respondWithFilteredResult(_0x4f8abc,_0x5d31a0){return function(_0x1805e4){if(_0x1805e4){var _0x526b33=typeof _0x5d31a0[_0x2bb6('0x18')]===_0x2bb6('0x19')&&typeof _0x5d31a0[_0x2bb6('0x1a')]===_0x2bb6('0x19');var _0x37a109=_0x1805e4['count'];var _0x2972ec=_0x526b33?0x0:_0x5d31a0[_0x2bb6('0x18')];var _0x3ce6f0=_0x526b33?_0x1805e4[_0x2bb6('0x1b')]:_0x5d31a0[_0x2bb6('0x18')]+_0x5d31a0[_0x2bb6('0x1a')];var _0x13dc30;if(_0x3ce6f0>=_0x37a109){_0x3ce6f0=_0x37a109;_0x13dc30=0xc8;}else{_0x13dc30=0xce;}_0x4f8abc[_0x2bb6('0x16')](_0x13dc30);return _0x4f8abc[_0x2bb6('0x1c')]('Content-Range',_0x2972ec+'-'+_0x3ce6f0+'/'+_0x37a109)['json'](_0x1805e4);}return null;};}function patchUpdates(_0xa16f1a){return function(_0x22ca5c){try{jsonpatch[_0x2bb6('0x1d')](_0x22ca5c,_0xa16f1a,!![]);}catch(_0x48c2a4){return BPromise[_0x2bb6('0x1e')](_0x48c2a4);}return _0x22ca5c[_0x2bb6('0x1f')]();};}function saveUpdates(_0x5c2c58,_0x7adeed){return function(_0x2a4079){if(_0x2a4079){return _0x2a4079[_0x2bb6('0x20')](_0x5c2c58)[_0x2bb6('0x21')](function(_0x3822ad){return _0x3822ad;});}return null;};}function removeEntity(_0x576828,_0x79ba0d){return function(_0x432a53){if(_0x432a53){return _0x432a53[_0x2bb6('0x22')]()[_0x2bb6('0x21')](function(){_0x576828[_0x2bb6('0x16')](0xcc)[_0x2bb6('0x17')]();});}};}function handleEntityNotFound(_0xec3671,_0x5365d0){return function(_0x516279){if(!_0x516279){_0xec3671[_0x2bb6('0x23')](0x194);}return _0x516279;};}function handleError(_0x3f55fe,_0x282b05){_0x282b05=_0x282b05||0x1f4;return function(_0x3b0360){logger[_0x2bb6('0x24')](_0x3b0360[_0x2bb6('0x25')]);if(_0x3b0360[_0x2bb6('0x26')]){delete _0x3b0360[_0x2bb6('0x26')];}_0x3f55fe['status'](_0x282b05)[_0x2bb6('0x27')](_0x3b0360);};}exports[_0x2bb6('0x28')]=function(_0x53939a,_0x5eefcf){var _0x6aa513={},_0x31bf78={},_0x2c44d4={'count':0x0,'rows':[]};var _0x276e6d=_['map'](db[_0x2bb6('0x29')][_0x2bb6('0x2a')],function(_0x9fc1de){return{'name':_0x9fc1de[_0x2bb6('0x2b')],'type':_0x9fc1de[_0x2bb6('0x2c')][_0x2bb6('0x2d')]};});_0x31bf78['model']=_[_0x2bb6('0x2e')](_0x276e6d,_0x2bb6('0x26'));_0x31bf78[_0x2bb6('0x2f')]=_[_0x2bb6('0x30')](_0x53939a['query']);_0x31bf78[_0x2bb6('0x31')]=_['intersection'](_0x31bf78['model'],_0x31bf78[_0x2bb6('0x2f')]);_0x6aa513[_0x2bb6('0x32')]=_['intersection'](_0x31bf78[_0x2bb6('0x33')],qs[_0x2bb6('0x34')](_0x53939a['query'][_0x2bb6('0x34')]));_0x6aa513[_0x2bb6('0x32')]=_0x6aa513[_0x2bb6('0x32')][_0x2bb6('0x35')]?_0x6aa513[_0x2bb6('0x32')]:_0x31bf78[_0x2bb6('0x33')];if(!_0x53939a[_0x2bb6('0x2f')][_0x2bb6('0x36')](_0x2bb6('0x37'))){_0x6aa513[_0x2bb6('0x1a')]=qs['limit'](_0x53939a['query'][_0x2bb6('0x1a')]);_0x6aa513[_0x2bb6('0x18')]=qs['offset'](_0x53939a[_0x2bb6('0x2f')][_0x2bb6('0x18')]);}_0x6aa513[_0x2bb6('0x38')]=qs[_0x2bb6('0x39')](_0x53939a[_0x2bb6('0x2f')][_0x2bb6('0x39')]);_0x6aa513[_0x2bb6('0x3a')]=qs[_0x2bb6('0x31')](_[_0x2bb6('0x3b')](_0x53939a[_0x2bb6('0x2f')],_0x31bf78[_0x2bb6('0x31')]),_0x276e6d);if(_0x53939a[_0x2bb6('0x2f')][_0x2bb6('0x3c')]){_0x6aa513[_0x2bb6('0x3a')]=_['merge'](_0x6aa513[_0x2bb6('0x3a')],{'$or':_[_0x2bb6('0x2e')](_0x276e6d,function(_0xcb0a60){if(_0xcb0a60[_0x2bb6('0x2c')]!==_0x2bb6('0x3d')){var _0x20f9a3={};_0x20f9a3[_0xcb0a60[_0x2bb6('0x26')]]={'$like':'%'+_0x53939a[_0x2bb6('0x2f')][_0x2bb6('0x3c')]+'%'};return _0x20f9a3;}})});}_0x6aa513=_[_0x2bb6('0x3e')]({},_0x6aa513,_0x53939a[_0x2bb6('0x3f')]);var _0x41f4cc={'where':_0x6aa513[_0x2bb6('0x3a')]};return db[_0x2bb6('0x29')]['count'](_0x41f4cc)['then'](function(_0x5babca){_0x2c44d4[_0x2bb6('0x1b')]=_0x5babca;if(_0x53939a[_0x2bb6('0x2f')]['includeAll']){_0x6aa513['include']=[{'all':!![]}];}return db[_0x2bb6('0x29')][_0x2bb6('0x40')](_0x6aa513);})[_0x2bb6('0x21')](function(_0x10fa31){_0x2c44d4[_0x2bb6('0x41')]=_0x10fa31;return _0x2c44d4;})[_0x2bb6('0x21')](respondWithFilteredResult(_0x5eefcf,_0x6aa513))[_0x2bb6('0x42')](handleError(_0x5eefcf,null));};exports[_0x2bb6('0x43')]=function(_0x1af582,_0x3d9514){var _0x53fc50={'raw':![],'where':{'id':_0x1af582[_0x2bb6('0x44')]['id']}},_0x7f1118={};_0x7f1118[_0x2bb6('0x33')]=_[_0x2bb6('0x30')](db['Dynamics365Configuration'][_0x2bb6('0x2a')]);_0x7f1118[_0x2bb6('0x2f')]=_[_0x2bb6('0x30')](_0x1af582['query']);_0x7f1118[_0x2bb6('0x31')]=_[_0x2bb6('0x45')](_0x7f1118[_0x2bb6('0x33')],_0x7f1118[_0x2bb6('0x2f')]);_0x53fc50[_0x2bb6('0x32')]=_[_0x2bb6('0x45')](_0x7f1118[_0x2bb6('0x33')],qs['fields'](_0x1af582['query'][_0x2bb6('0x34')]));_0x53fc50[_0x2bb6('0x32')]=_0x53fc50[_0x2bb6('0x32')][_0x2bb6('0x35')]?_0x53fc50[_0x2bb6('0x32')]:_0x7f1118[_0x2bb6('0x33')];if(_0x1af582[_0x2bb6('0x2f')]['includeAll']){_0x53fc50['include']=[{'all':!![]}];}_0x53fc50=_[_0x2bb6('0x3e')]({},_0x53fc50,_0x1af582[_0x2bb6('0x3f')]);return db['Dynamics365Configuration'][_0x2bb6('0x46')](_0x53fc50)[_0x2bb6('0x21')](handleEntityNotFound(_0x3d9514,null))[_0x2bb6('0x21')](respondWithResult(_0x3d9514,null))[_0x2bb6('0x42')](handleError(_0x3d9514,null));};exports[_0x2bb6('0x47')]=function(_0x27bf53,_0x3799c9){return db[_0x2bb6('0x29')][_0x2bb6('0x47')](_0x27bf53[_0x2bb6('0x48')],{})[_0x2bb6('0x21')](respondWithResult(_0x3799c9,0xc9))[_0x2bb6('0x42')](handleError(_0x3799c9,null));};exports[_0x2bb6('0x20')]=function(_0x4268f8,_0x2dbda8){if(_0x4268f8['body']['id']){delete _0x4268f8['body']['id'];}return db['Dynamics365Configuration'][_0x2bb6('0x46')]({'where':{'id':_0x4268f8['params']['id']}})[_0x2bb6('0x21')](handleEntityNotFound(_0x2dbda8,null))['then'](saveUpdates(_0x4268f8[_0x2bb6('0x48')],null))['then'](respondWithResult(_0x2dbda8,null))[_0x2bb6('0x42')](handleError(_0x2dbda8,null));};exports[_0x2bb6('0x22')]=function(_0x4e9f99,_0xab715c){return db[_0x2bb6('0x29')][_0x2bb6('0x46')]({'where':{'id':_0x4e9f99[_0x2bb6('0x44')]['id']}})[_0x2bb6('0x21')](handleEntityNotFound(_0xab715c,null))[_0x2bb6('0x21')](removeEntity(_0xab715c,null))['catch'](handleError(_0xab715c,null));};exports[_0x2bb6('0x49')]=function(_0x59757a,_0x5e9f49,_0x3c26ff){var _0x40b5ad={};var _0x3d879e={};var _0x5c7a2a;var _0x3d163d;return db['Dynamics365Configuration'][_0x2bb6('0x4a')]({'where':{'id':_0x59757a[_0x2bb6('0x44')]['id']}})[_0x2bb6('0x21')](handleEntityNotFound(_0x5e9f49,null))['then'](function(_0x63af98){if(_0x63af98){_0x5c7a2a=_0x63af98;_0x3d879e['model']=_[_0x2bb6('0x30')](db[_0x2bb6('0x4b')]['rawAttributes']);_0x3d879e[_0x2bb6('0x2f')]=_[_0x2bb6('0x30')](_0x59757a[_0x2bb6('0x2f')]);_0x3d879e[_0x2bb6('0x31')]=_['intersection'](_0x3d879e['model'],_0x3d879e[_0x2bb6('0x2f')]);_0x40b5ad[_0x2bb6('0x32')]=_[_0x2bb6('0x45')](_0x3d879e[_0x2bb6('0x33')],qs[_0x2bb6('0x34')](_0x59757a['query'][_0x2bb6('0x34')]));_0x40b5ad[_0x2bb6('0x32')]=_0x40b5ad['attributes'][_0x2bb6('0x35')]?_0x40b5ad[_0x2bb6('0x32')]:_0x3d879e[_0x2bb6('0x33')];_0x40b5ad[_0x2bb6('0x38')]=qs[_0x2bb6('0x39')](_0x59757a[_0x2bb6('0x2f')][_0x2bb6('0x39')]);_0x40b5ad['where']=qs[_0x2bb6('0x31')](_[_0x2bb6('0x3b')](_0x59757a[_0x2bb6('0x2f')],_0x3d879e['filters']));if(_0x59757a[_0x2bb6('0x2f')][_0x2bb6('0x3c')]){_0x40b5ad[_0x2bb6('0x3a')]=_['merge'](_0x40b5ad['where'],{'$or':_['map'](_0x40b5ad[_0x2bb6('0x32')],function(_0x30181a){var _0x4da381={};_0x4da381[_0x30181a]={'$like':'%'+_0x59757a[_0x2bb6('0x2f')][_0x2bb6('0x3c')]+'%'};return _0x4da381;})});}_0x40b5ad=_['merge']({},_0x40b5ad,_0x59757a[_0x2bb6('0x3f')]);return _0x5c7a2a[_0x2bb6('0x49')](_0x40b5ad);}})[_0x2bb6('0x21')](function(_0x142ad4){if(_0x142ad4){_0x3d163d=_0x142ad4['length'];if(!_0x59757a[_0x2bb6('0x2f')][_0x2bb6('0x36')](_0x2bb6('0x37'))){_0x40b5ad['limit']=qs[_0x2bb6('0x1a')](_0x59757a[_0x2bb6('0x2f')][_0x2bb6('0x1a')]);_0x40b5ad[_0x2bb6('0x18')]=qs['offset'](_0x59757a[_0x2bb6('0x2f')][_0x2bb6('0x18')]);}return _0x5c7a2a['getFields'](_0x40b5ad);}})[_0x2bb6('0x21')](function(_0x4bfadf){if(_0x4bfadf){return _0x4bfadf?{'count':_0x3d163d,'rows':_0x4bfadf}:null;}})[_0x2bb6('0x21')](respondWithResult(_0x5e9f49,null))[_0x2bb6('0x42')](handleError(_0x5e9f49,null));};exports['getSubjects']=function(_0x583558,_0x3778d6,_0x45f74d){var _0x51fc68={};var _0x246f2c={};var _0x5d56fb;var _0x491007;return db[_0x2bb6('0x29')][_0x2bb6('0x4a')]({'where':{'id':_0x583558[_0x2bb6('0x44')]['id']}})['then'](handleEntityNotFound(_0x3778d6,null))['then'](function(_0x3e5a05){if(_0x3e5a05){_0x5d56fb=_0x3e5a05;_0x246f2c['model']=_[_0x2bb6('0x30')](db[_0x2bb6('0x4b')][_0x2bb6('0x2a')]);_0x246f2c[_0x2bb6('0x2f')]=_['keys'](_0x583558[_0x2bb6('0x2f')]);_0x246f2c[_0x2bb6('0x31')]=_[_0x2bb6('0x45')](_0x246f2c['model'],_0x246f2c['query']);_0x51fc68[_0x2bb6('0x32')]=_[_0x2bb6('0x45')](_0x246f2c[_0x2bb6('0x33')],qs[_0x2bb6('0x34')](_0x583558['query'][_0x2bb6('0x34')]));_0x51fc68['attributes']=_0x51fc68['attributes'][_0x2bb6('0x35')]?_0x51fc68['attributes']:_0x246f2c[_0x2bb6('0x33')];_0x51fc68[_0x2bb6('0x38')]=qs[_0x2bb6('0x39')](_0x583558[_0x2bb6('0x2f')]['sort']);_0x51fc68['where']=qs[_0x2bb6('0x31')](_[_0x2bb6('0x3b')](_0x583558[_0x2bb6('0x2f')],_0x246f2c['filters']));if(_0x583558['query']['filter']){_0x51fc68[_0x2bb6('0x3a')]=_[_0x2bb6('0x3e')](_0x51fc68[_0x2bb6('0x3a')],{'$or':_[_0x2bb6('0x2e')](_0x51fc68[_0x2bb6('0x32')],function(_0x1ac1b6){var _0x3967bd={};_0x3967bd[_0x1ac1b6]={'$like':'%'+_0x583558[_0x2bb6('0x2f')][_0x2bb6('0x3c')]+'%'};return _0x3967bd;})});}_0x51fc68=_['merge']({},_0x51fc68,_0x583558[_0x2bb6('0x3f')]);return _0x5d56fb[_0x2bb6('0x4c')](_0x51fc68);}})[_0x2bb6('0x21')](function(_0x490f88){if(_0x490f88){_0x491007=_0x490f88['length'];if(!_0x583558[_0x2bb6('0x2f')][_0x2bb6('0x36')](_0x2bb6('0x37'))){_0x51fc68[_0x2bb6('0x1a')]=qs[_0x2bb6('0x1a')](_0x583558[_0x2bb6('0x2f')][_0x2bb6('0x1a')]);_0x51fc68['offset']=qs[_0x2bb6('0x18')](_0x583558['query'][_0x2bb6('0x18')]);}return _0x5d56fb[_0x2bb6('0x4c')](_0x51fc68);}})[_0x2bb6('0x21')](function(_0x267276){if(_0x267276){return _0x267276?{'count':_0x491007,'rows':_0x267276}:null;}})[_0x2bb6('0x21')](respondWithResult(_0x3778d6,null))['catch'](handleError(_0x3778d6,null));};exports[_0x2bb6('0x4d')]=function(_0x3ca302,_0x2667c1,_0x480d34){var _0x20c9a2={};var _0x189820={};var _0xac2e9d;var _0x1ac821;return db[_0x2bb6('0x29')]['findOne']({'where':{'id':_0x3ca302[_0x2bb6('0x44')]['id']}})[_0x2bb6('0x21')](handleEntityNotFound(_0x2667c1,null))[_0x2bb6('0x21')](function(_0x34001b){if(_0x34001b){_0xac2e9d=_0x34001b;_0x189820[_0x2bb6('0x33')]=_[_0x2bb6('0x30')](db[_0x2bb6('0x4b')][_0x2bb6('0x2a')]);_0x189820[_0x2bb6('0x2f')]=_[_0x2bb6('0x30')](_0x3ca302['query']);_0x189820[_0x2bb6('0x31')]=_['intersection'](_0x189820[_0x2bb6('0x33')],_0x189820['query']);_0x20c9a2[_0x2bb6('0x32')]=_[_0x2bb6('0x45')](_0x189820[_0x2bb6('0x33')],qs[_0x2bb6('0x34')](_0x3ca302['query']['fields']));_0x20c9a2[_0x2bb6('0x32')]=_0x20c9a2[_0x2bb6('0x32')]['length']?_0x20c9a2[_0x2bb6('0x32')]:_0x189820[_0x2bb6('0x33')];_0x20c9a2[_0x2bb6('0x38')]=qs['sort'](_0x3ca302[_0x2bb6('0x2f')]['sort']);_0x20c9a2[_0x2bb6('0x3a')]=qs['filters'](_[_0x2bb6('0x3b')](_0x3ca302['query'],_0x189820['filters']));if(_0x3ca302[_0x2bb6('0x2f')][_0x2bb6('0x3c')]){_0x20c9a2[_0x2bb6('0x3a')]=_[_0x2bb6('0x3e')](_0x20c9a2[_0x2bb6('0x3a')],{'$or':_[_0x2bb6('0x2e')](_0x20c9a2[_0x2bb6('0x32')],function(_0x3e1dc4){var _0x580699={};_0x580699[_0x3e1dc4]={'$like':'%'+_0x3ca302[_0x2bb6('0x2f')]['filter']+'%'};return _0x580699;})});}_0x20c9a2=_[_0x2bb6('0x3e')]({},_0x20c9a2,_0x3ca302[_0x2bb6('0x3f')]);return _0xac2e9d[_0x2bb6('0x4d')](_0x20c9a2);}})[_0x2bb6('0x21')](function(_0x5ba71f){if(_0x5ba71f){_0x1ac821=_0x5ba71f[_0x2bb6('0x35')];if(!_0x3ca302[_0x2bb6('0x2f')][_0x2bb6('0x36')](_0x2bb6('0x37'))){_0x20c9a2['limit']=qs[_0x2bb6('0x1a')](_0x3ca302[_0x2bb6('0x2f')]['limit']);_0x20c9a2[_0x2bb6('0x18')]=qs['offset'](_0x3ca302[_0x2bb6('0x2f')][_0x2bb6('0x18')]);}return _0xac2e9d[_0x2bb6('0x4d')](_0x20c9a2);}})[_0x2bb6('0x21')](function(_0x135954){if(_0x135954){return _0x135954?{'count':_0x1ac821,'rows':_0x135954}:null;}})['then'](respondWithResult(_0x2667c1,null))[_0x2bb6('0x42')](handleError(_0x2667c1,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a784838..3a3a2b5 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 _0x8d0e=['define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x102d42,_0x39f78b){var _0x39eb28=function(_0x5531e7){while(--_0x5531e7){_0x102d42['push'](_0x102d42['shift']());}};_0x39eb28(++_0x39f78b);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x227963,_0x274e24){_0x227963=_0x227963-0x0;var _0x1d73d1=_0x8d0e[_0x227963];return _0x1d73d1;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x97e5c7,_0x32ff6b){var _0x2cb195=function(_0x4a634f){while(--_0x4a634f){_0x97e5c7['push'](_0x97e5c7['shift']());}};_0x2cb195(++_0x32ff6b);}(_0x9f62,0x154));var _0x29f6=function(_0x102783,_0x813a64){_0x102783=_0x102783-0x0;var _0x51d466=_0x9f62[_0x102783];return _0x51d466;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'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 0165c14..84b1ee8 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 _0xe1fa=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4a3acd,_0x4bf641){var _0x3efdaa=function(_0x32842d){while(--_0x32842d){_0x4a3acd['push'](_0x4a3acd['shift']());}};_0x3efdaa(++_0x4bf641);}(_0xe1fa,0x1a9));var _0xae1f=function(_0x19fb31,_0x12710e){_0x19fb31=_0x19fb31-0x0;var _0x512e8d=_0xe1fa[_0x19fb31];return _0x512e8d;};'use strict';var _=require(_0xae1f('0x0'));var util=require(_0xae1f('0x1'));var moment=require(_0xae1f('0x2'));var BPromise=require(_0xae1f('0x3'));var rs=require(_0xae1f('0x4'));var fs=require('fs');var Redis=require(_0xae1f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xae1f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xae1f('0x7'));var jayson=require(_0xae1f('0x8'));var client=jayson[_0xae1f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39c573,_0x70f980,_0x5b1fec){return new BPromise(function(_0xff3bd6,_0x48cdfa){return client[_0xae1f('0xa')](_0x39c573,_0x5b1fec)[_0xae1f('0xb')](function(_0x4aacee){logger[_0xae1f('0xc')](_0xae1f('0xd'),_0x70f980,_0xae1f('0xe'));logger[_0xae1f('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x70f980,_0xae1f('0xe'),JSON['stringify'](_0x4aacee));if(_0x4aacee[_0xae1f('0x10')]){if(_0x4aacee['error'][_0xae1f('0x11')]===0x1f4){logger[_0xae1f('0x10')](_0xae1f('0xd'),_0x70f980,_0x4aacee[_0xae1f('0x10')][_0xae1f('0x12')]);return _0x48cdfa(_0x4aacee[_0xae1f('0x10')][_0xae1f('0x12')]);}logger['error'](_0xae1f('0xd'),_0x70f980,_0x4aacee[_0xae1f('0x10')][_0xae1f('0x12')]);return _0xff3bd6(_0x4aacee[_0xae1f('0x10')][_0xae1f('0x12')]);}else{logger[_0xae1f('0xc')](_0xae1f('0xd'),_0x70f980,_0xae1f('0xe'));_0xff3bd6(_0x4aacee[_0xae1f('0x13')]['message']);}})[_0xae1f('0x14')](function(_0x170822){logger[_0xae1f('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x70f980,_0x170822);_0x48cdfa(_0x170822);});});} \ No newline at end of file +var _0x508b=['catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message'];(function(_0x32a6ae,_0x337b8c){var _0xb55768=function(_0x360a39){while(--_0x360a39){_0x32a6ae['push'](_0x32a6ae['shift']());}};_0xb55768(++_0x337b8c);}(_0x508b,0x13c));var _0xb508=function(_0x218479,_0x4fb190){_0x218479=_0x218479-0x0;var _0x3b67a0=_0x508b[_0x218479];return _0x3b67a0;};'use strict';var _=require(_0xb508('0x0'));var util=require('util');var moment=require(_0xb508('0x1'));var BPromise=require(_0xb508('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb508('0x3'))['db'];var utils=require(_0xb508('0x4'));var logger=require(_0xb508('0x5'))('rpc');var config=require(_0xb508('0x6'));var jayson=require(_0xb508('0x7'));var client=jayson[_0xb508('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5962d9,_0x5a6b69,_0x230b76){return new BPromise(function(_0x5fab3c,_0x284167){return client[_0xb508('0x9')](_0x5962d9,_0x230b76)[_0xb508('0xa')](function(_0x2f6f60){logger[_0xb508('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5a6b69,_0xb508('0xc'));logger[_0xb508('0xd')](_0xb508('0xe'),_0x5a6b69,'request\x20sent',JSON[_0xb508('0xf')](_0x2f6f60));if(_0x2f6f60[_0xb508('0x10')]){if(_0x2f6f60[_0xb508('0x10')][_0xb508('0x11')]===0x1f4){logger[_0xb508('0x10')](_0xb508('0x12'),_0x5a6b69,_0x2f6f60[_0xb508('0x10')]['message']);return _0x284167(_0x2f6f60[_0xb508('0x10')][_0xb508('0x13')]);}logger[_0xb508('0x10')](_0xb508('0x12'),_0x5a6b69,_0x2f6f60[_0xb508('0x10')]['message']);return _0x5fab3c(_0x2f6f60[_0xb508('0x10')][_0xb508('0x13')]);}else{logger[_0xb508('0xb')](_0xb508('0x12'),_0x5a6b69,_0xb508('0xc'));_0x5fab3c(_0x2f6f60['result']['message']);}})[_0xb508('0x14')](function(_0x2b81c){logger[_0xb508('0x10')](_0xb508('0x12'),_0x5a6b69,_0x2b81c);_0x284167(_0x2b81c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index a97be62..959463f 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 _0xc3ec=['/:id','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x10c7e9,_0x19d5fc){var _0x586cbf=function(_0x266167){while(--_0x266167){_0x10c7e9['push'](_0x10c7e9['shift']());}};_0x586cbf(++_0x19d5fc);}(_0xc3ec,0x107));var _0xcc3e=function(_0x1c0b0f,_0x4ca945){_0x1c0b0f=_0x1c0b0f-0x0;var _0x307aa9=_0xc3ec[_0x1c0b0f];return _0x307aa9;};'use strict';var multer=require('multer');var util=require(_0xcc3e('0x0'));var path=require('path');var timeout=require(_0xcc3e('0x1'));var express=require('express');var router=express[_0xcc3e('0x2')]();var fs_extra=require(_0xcc3e('0x3'));var auth=require(_0xcc3e('0x4'));var interaction=require(_0xcc3e('0x5'));var config=require(_0xcc3e('0x6'));var controller=require('./intDynamics365Field.controller');router[_0xcc3e('0x7')]('/',auth[_0xcc3e('0x8')](),controller['index']);router[_0xcc3e('0x7')](_0xcc3e('0x9'),auth[_0xcc3e('0x8')](),controller['show']);router['post']('/',auth[_0xcc3e('0x8')](),controller[_0xcc3e('0xa')]);router[_0xcc3e('0xb')](_0xcc3e('0x9'),auth[_0xcc3e('0x8')](),controller[_0xcc3e('0xc')]);router[_0xcc3e('0xd')](_0xcc3e('0x9'),auth['isAuthenticated'](),controller[_0xcc3e('0xe')]);module[_0xcc3e('0xf')]=router; \ No newline at end of file +var _0xc2fa=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','multer'];(function(_0xd202f5,_0x4a372a){var _0x55df8b=function(_0x313463){while(--_0x313463){_0xd202f5['push'](_0xd202f5['shift']());}};_0x55df8b(++_0x4a372a);}(_0xc2fa,0x143));var _0xac2f=function(_0x481bb5,_0x168c2e){_0x481bb5=_0x481bb5-0x0;var _0x5e0e44=_0xc2fa[_0x481bb5];return _0x5e0e44;};'use strict';var multer=require(_0xac2f('0x0'));var util=require('util');var path=require(_0xac2f('0x1'));var timeout=require(_0xac2f('0x2'));var express=require(_0xac2f('0x3'));var router=express[_0xac2f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xac2f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xac2f('0x6'));var controller=require(_0xac2f('0x7'));router[_0xac2f('0x8')]('/',auth['isAuthenticated'](),controller[_0xac2f('0x9')]);router[_0xac2f('0x8')](_0xac2f('0xa'),auth[_0xac2f('0xb')](),controller[_0xac2f('0xc')]);router[_0xac2f('0xd')]('/',auth['isAuthenticated'](),controller[_0xac2f('0xe')]);router['put'](_0xac2f('0xa'),auth[_0xac2f('0xb')](),controller[_0xac2f('0xf')]);router[_0xac2f('0x10')](_0xac2f('0xa'),auth['isAuthenticated'](),controller[_0xac2f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 8f50ce7..770ecea 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 _0xd02d=['customVariable','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x3b3a90,_0x19d121){var _0x1df2a5=function(_0x55e06c){while(--_0x55e06c){_0x3b3a90['push'](_0x3b3a90['shift']());}};_0x1df2a5(++_0x19d121);}(_0xd02d,0x17f));var _0xdd02=function(_0x21a383,_0x2456d3){_0x21a383=_0x21a383-0x0;var _0x5798a7=_0xd02d[_0x21a383];return _0x5798a7;};'use strict';var Sequelize=require(_0xdd02('0x0'));module[_0xdd02('0x1')]={'type':{'type':Sequelize['ENUM'](_0xdd02('0x2'),_0xdd02('0x3'),_0xdd02('0x4'),'keyValue',_0xdd02('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdd02('0x6')]},'keyType':{'type':Sequelize[_0xdd02('0x7')](_0xdd02('0x2'),_0xdd02('0x3'),_0xdd02('0x4'))},'keyContent':{'type':Sequelize[_0xdd02('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdd02('0x6')]},'customField':{'type':Sequelize[_0xdd02('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdd02('0x6')]}}; \ No newline at end of file +var _0xae78=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x5edc38,_0x1fee22){var _0xe32e5=function(_0x2d6490){while(--_0x2d6490){_0x5edc38['push'](_0x5edc38['shift']());}};_0xe32e5(++_0x1fee22);}(_0xae78,0x19d));var _0x8ae7=function(_0x4cc070,_0x476313){_0x4cc070=_0x4cc070-0x0;var _0x161feb=_0xae78[_0x4cc070];return _0x161feb;};'use strict';var Sequelize=require(_0x8ae7('0x0'));module[_0x8ae7('0x1')]={'type':{'type':Sequelize[_0x8ae7('0x2')](_0x8ae7('0x3'),'variable',_0x8ae7('0x4'),_0x8ae7('0x5'),_0x8ae7('0x6')),'defaultValue':_0x8ae7('0x3')},'content':{'type':Sequelize[_0x8ae7('0x7')]},'key':{'type':Sequelize[_0x8ae7('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x8ae7('0x3'),_0x8ae7('0x8'),_0x8ae7('0x4'))},'keyContent':{'type':Sequelize[_0x8ae7('0x7')]},'idField':{'type':Sequelize[_0x8ae7('0x7')]},'nameField':{'type':Sequelize[_0x8ae7('0x7')]},'customField':{'type':Sequelize[_0x8ae7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8ae7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 3ec0393..ec15323 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 _0xa92d=['find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','Dynamics365Field','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','offset','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','intersection'];(function(_0x1eccfe,_0xb1ec4f){var _0x4cbbbf=function(_0x3c7cbf){while(--_0x3c7cbf){_0x1eccfe['push'](_0x1eccfe['shift']());}};_0x4cbbbf(++_0xb1ec4f);}(_0xa92d,0x1a1));var _0xda92=function(_0x5a430f,_0x81f66d){_0x5a430f=_0x5a430f-0x0;var _0x4cd3e2=_0xa92d[_0x5a430f];return _0x4cd3e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda92('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda92('0x1'));var rp=require(_0xda92('0x2'));var moment=require(_0xda92('0x3'));var BPromise=require(_0xda92('0x4'));var Mustache=require(_0xda92('0x5'));var util=require(_0xda92('0x6'));var path=require(_0xda92('0x7'));var sox=require('sox');var csv=require(_0xda92('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda92('0x9'));var _=require('lodash');var squel=require(_0xda92('0xa'));var crypto=require(_0xda92('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xda92('0xc'));var toCsv=require(_0xda92('0x8'));var querystring=require(_0xda92('0xd'));var Papa=require(_0xda92('0xe'));var Redis=require(_0xda92('0xf'));var authService=require(_0xda92('0x10'));var qs=require(_0xda92('0x11'));var as=require(_0xda92('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda92('0x13'))(_0xda92('0x14'));var utils=require('../../config/utils');var config=require(_0xda92('0x15'));var licenseUtil=require(_0xda92('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bbaa2,_0x12933b){_0x12933b=_0x12933b||0xcc;return function(_0x13189b){if(_0x13189b){return _0x2bbaa2[_0xda92('0x17')](_0x12933b);}return _0x2bbaa2[_0xda92('0x18')](_0x12933b)[_0xda92('0x19')]();};}function respondWithResult(_0x2b61af,_0x3472d7){_0x3472d7=_0x3472d7||0xc8;return function(_0x38892c){if(_0x38892c){return _0x2b61af[_0xda92('0x18')](_0x3472d7)[_0xda92('0x1a')](_0x38892c);}};}function respondWithFilteredResult(_0x5ac83b,_0x49a79b){return function(_0x17b00e){if(_0x17b00e){var _0x22b87f=typeof _0x49a79b['offset']===_0xda92('0x1b')&&typeof _0x49a79b[_0xda92('0x1c')]===_0xda92('0x1b');var _0x1e2b53=_0x17b00e[_0xda92('0x1d')];var _0x3dd19f=_0x22b87f?0x0:_0x49a79b['offset'];var _0x1dfc50=_0x22b87f?_0x17b00e[_0xda92('0x1d')]:_0x49a79b['offset']+_0x49a79b[_0xda92('0x1c')];var _0x9df346;if(_0x1dfc50>=_0x1e2b53){_0x1dfc50=_0x1e2b53;_0x9df346=0xc8;}else{_0x9df346=0xce;}_0x5ac83b[_0xda92('0x18')](_0x9df346);return _0x5ac83b[_0xda92('0x1e')](_0xda92('0x1f'),_0x3dd19f+'-'+_0x1dfc50+'/'+_0x1e2b53)[_0xda92('0x1a')](_0x17b00e);}return null;};}function patchUpdates(_0x1d639c){return function(_0x2649b9){try{jsonpatch[_0xda92('0x20')](_0x2649b9,_0x1d639c,!![]);}catch(_0x3bb128){return BPromise[_0xda92('0x21')](_0x3bb128);}return _0x2649b9['save']();};}function saveUpdates(_0x378195,_0x184350){return function(_0x290b66){if(_0x290b66){return _0x290b66[_0xda92('0x22')](_0x378195)[_0xda92('0x23')](function(_0x5f1947){return _0x5f1947;});}return null;};}function removeEntity(_0x2d8349,_0x3485b1){return function(_0x18a095){if(_0x18a095){return _0x18a095[_0xda92('0x24')]()[_0xda92('0x23')](function(){_0x2d8349[_0xda92('0x18')](0xcc)[_0xda92('0x19')]();});}};}function handleEntityNotFound(_0x51363e,_0x38e1bc){return function(_0x239ca8){if(!_0x239ca8){_0x51363e[_0xda92('0x17')](0x194);}return _0x239ca8;};}function handleError(_0x38db61,_0x4abb51){_0x4abb51=_0x4abb51||0x1f4;return function(_0x47f6cf){logger['error'](_0x47f6cf[_0xda92('0x25')]);if(_0x47f6cf[_0xda92('0x26')]){delete _0x47f6cf['name'];}_0x38db61[_0xda92('0x18')](_0x4abb51)['send'](_0x47f6cf);};}exports[_0xda92('0x27')]=function(_0x42a300,_0x1dd760){var _0x2117e3={},_0x1eda5c={},_0x926f62={'count':0x0,'rows':[]};var _0xa8e4bb=_['map'](db[_0xda92('0x28')][_0xda92('0x29')],function(_0x19af09){return{'name':_0x19af09['fieldName'],'type':_0x19af09[_0xda92('0x2a')][_0xda92('0x2b')]};});_0x1eda5c[_0xda92('0x2c')]=_['map'](_0xa8e4bb,_0xda92('0x26'));_0x1eda5c[_0xda92('0x2d')]=_['keys'](_0x42a300[_0xda92('0x2d')]);_0x1eda5c[_0xda92('0x2e')]=_['intersection'](_0x1eda5c[_0xda92('0x2c')],_0x1eda5c[_0xda92('0x2d')]);_0x2117e3[_0xda92('0x2f')]=_['intersection'](_0x1eda5c[_0xda92('0x2c')],qs[_0xda92('0x30')](_0x42a300[_0xda92('0x2d')][_0xda92('0x30')]));_0x2117e3['attributes']=_0x2117e3[_0xda92('0x2f')][_0xda92('0x31')]?_0x2117e3[_0xda92('0x2f')]:_0x1eda5c[_0xda92('0x2c')];if(!_0x42a300[_0xda92('0x2d')][_0xda92('0x32')]('nolimit')){_0x2117e3['limit']=qs[_0xda92('0x1c')](_0x42a300[_0xda92('0x2d')]['limit']);_0x2117e3[_0xda92('0x33')]=qs['offset'](_0x42a300[_0xda92('0x2d')][_0xda92('0x33')]);}_0x2117e3['order']=qs['sort'](_0x42a300[_0xda92('0x2d')]['sort']);_0x2117e3['where']=qs['filters'](_[_0xda92('0x34')](_0x42a300['query'],_0x1eda5c['filters']),_0xa8e4bb);if(_0x42a300['query'][_0xda92('0x35')]){_0x2117e3[_0xda92('0x36')]=_[_0xda92('0x37')](_0x2117e3[_0xda92('0x36')],{'$or':_[_0xda92('0x38')](_0xa8e4bb,function(_0xc82e51){if(_0xc82e51[_0xda92('0x2a')]!==_0xda92('0x39')){var _0x3390b7={};_0x3390b7[_0xc82e51[_0xda92('0x26')]]={'$like':'%'+_0x42a300['query'][_0xda92('0x35')]+'%'};return _0x3390b7;}})});}_0x2117e3=_[_0xda92('0x37')]({},_0x2117e3,_0x42a300[_0xda92('0x3a')]);var _0xfe137b={'where':_0x2117e3['where']};return db['Dynamics365Field'][_0xda92('0x1d')](_0xfe137b)[_0xda92('0x23')](function(_0x52eddb){_0x926f62[_0xda92('0x1d')]=_0x52eddb;if(_0x42a300[_0xda92('0x2d')][_0xda92('0x3b')]){_0x2117e3[_0xda92('0x3c')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xda92('0x3d')](_0x2117e3);})[_0xda92('0x23')](function(_0x2690d2){_0x926f62['rows']=_0x2690d2;return _0x926f62;})['then'](respondWithFilteredResult(_0x1dd760,_0x2117e3))[_0xda92('0x3e')](handleError(_0x1dd760,null));};exports[_0xda92('0x3f')]=function(_0x5936e8,_0x1908b3){var _0x19068d={'raw':!![],'where':{'id':_0x5936e8[_0xda92('0x40')]['id']}},_0x7dc9da={};_0x7dc9da[_0xda92('0x2c')]=_['keys'](db['Dynamics365Field'][_0xda92('0x29')]);_0x7dc9da[_0xda92('0x2d')]=_['keys'](_0x5936e8['query']);_0x7dc9da[_0xda92('0x2e')]=_[_0xda92('0x41')](_0x7dc9da[_0xda92('0x2c')],_0x7dc9da['query']);_0x19068d[_0xda92('0x2f')]=_[_0xda92('0x41')](_0x7dc9da[_0xda92('0x2c')],qs[_0xda92('0x30')](_0x5936e8[_0xda92('0x2d')][_0xda92('0x30')]));_0x19068d[_0xda92('0x2f')]=_0x19068d[_0xda92('0x2f')][_0xda92('0x31')]?_0x19068d[_0xda92('0x2f')]:_0x7dc9da[_0xda92('0x2c')];if(_0x5936e8[_0xda92('0x2d')][_0xda92('0x3b')]){_0x19068d[_0xda92('0x3c')]=[{'all':!![]}];}_0x19068d=_['merge']({},_0x19068d,_0x5936e8['options']);return db['Dynamics365Field'][_0xda92('0x42')](_0x19068d)[_0xda92('0x23')](handleEntityNotFound(_0x1908b3,null))[_0xda92('0x23')](respondWithResult(_0x1908b3,null))[_0xda92('0x3e')](handleError(_0x1908b3,null));};exports[_0xda92('0x43')]=function(_0x178930,_0x1015f4){return db[_0xda92('0x28')][_0xda92('0x43')](_0x178930['body'],{})[_0xda92('0x23')](respondWithResult(_0x1015f4,0xc9))[_0xda92('0x3e')](handleError(_0x1015f4,null));};exports[_0xda92('0x22')]=function(_0x5847e5,_0x4d6c51){if(_0x5847e5['body']['id']){delete _0x5847e5[_0xda92('0x44')]['id'];}return db[_0xda92('0x28')][_0xda92('0x42')]({'where':{'id':_0x5847e5[_0xda92('0x40')]['id']}})[_0xda92('0x23')](handleEntityNotFound(_0x4d6c51,null))[_0xda92('0x23')](saveUpdates(_0x5847e5[_0xda92('0x44')],null))[_0xda92('0x23')](respondWithResult(_0x4d6c51,null))[_0xda92('0x3e')](handleError(_0x4d6c51,null));};exports['destroy']=function(_0x1b2665,_0x28302a){return db[_0xda92('0x28')][_0xda92('0x42')]({'where':{'id':_0x1b2665[_0xda92('0x40')]['id']}})[_0xda92('0x23')](handleEntityNotFound(_0x28302a,null))[_0xda92('0x23')](removeEntity(_0x28302a,null))[_0xda92('0x3e')](handleError(_0x28302a,null));}; \ No newline at end of file +var _0x8604=['apply','reject','then','error','stack','name','index','map','Dynamics365Field','rawAttributes','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','catch','show','keys','intersection','find','create','update','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0x8604,0x1a8));var _0x4860=function(_0x4e86c2,_0xf1a379){_0x4e86c2=_0x4e86c2-0x0;var _0x1bea6c=_0x8604[_0x4e86c2];return _0x1bea6c;};'use strict';var emlformat=require(_0x4860('0x0'));var rimraf=require(_0x4860('0x1'));var zipdir=require(_0x4860('0x2'));var jsonpatch=require(_0x4860('0x3'));var rp=require(_0x4860('0x4'));var moment=require(_0x4860('0x5'));var BPromise=require(_0x4860('0x6'));var Mustache=require(_0x4860('0x7'));var util=require(_0x4860('0x8'));var path=require(_0x4860('0x9'));var sox=require(_0x4860('0xa'));var csv=require(_0x4860('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4860('0xc'));var _=require(_0x4860('0xd'));var squel=require(_0x4860('0xe'));var crypto=require(_0x4860('0xf'));var jsforce=require(_0x4860('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x4860('0xb'));var querystring=require(_0x4860('0x11'));var Papa=require(_0x4860('0x12'));var Redis=require(_0x4860('0x13'));var authService=require(_0x4860('0x14'));var qs=require(_0x4860('0x15'));var as=require(_0x4860('0x16'));var hardwareService=require(_0x4860('0x17'));var logger=require(_0x4860('0x18'))(_0x4860('0x19'));var utils=require('../../config/utils');var config=require(_0x4860('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4860('0x1b'))['db'];function respondWithStatusCode(_0x2d365f,_0x8eeaf){_0x8eeaf=_0x8eeaf||0xcc;return function(_0x599fb3){if(_0x599fb3){return _0x2d365f[_0x4860('0x1c')](_0x8eeaf);}return _0x2d365f[_0x4860('0x1d')](_0x8eeaf)[_0x4860('0x1e')]();};}function respondWithResult(_0x205cb5,_0x3d0a1a){_0x3d0a1a=_0x3d0a1a||0xc8;return function(_0x5da0ea){if(_0x5da0ea){return _0x205cb5[_0x4860('0x1d')](_0x3d0a1a)['json'](_0x5da0ea);}};}function respondWithFilteredResult(_0x51e90d,_0x4c0214){return function(_0x2dc3f1){if(_0x2dc3f1){var _0x454345=typeof _0x4c0214['offset']===_0x4860('0x1f')&&typeof _0x4c0214[_0x4860('0x20')]===_0x4860('0x1f');var _0x80c52f=_0x2dc3f1[_0x4860('0x21')];var _0x169369=_0x454345?0x0:_0x4c0214[_0x4860('0x22')];var _0x2a7950=_0x454345?_0x2dc3f1[_0x4860('0x21')]:_0x4c0214[_0x4860('0x22')]+_0x4c0214[_0x4860('0x20')];var _0x1b7420;if(_0x2a7950>=_0x80c52f){_0x2a7950=_0x80c52f;_0x1b7420=0xc8;}else{_0x1b7420=0xce;}_0x51e90d[_0x4860('0x1d')](_0x1b7420);return _0x51e90d[_0x4860('0x23')](_0x4860('0x24'),_0x169369+'-'+_0x2a7950+'/'+_0x80c52f)[_0x4860('0x25')](_0x2dc3f1);}return null;};}function patchUpdates(_0x512423){return function(_0x120ed4){try{jsonpatch[_0x4860('0x26')](_0x120ed4,_0x512423,!![]);}catch(_0xb62c2b){return BPromise[_0x4860('0x27')](_0xb62c2b);}return _0x120ed4['save']();};}function saveUpdates(_0x32cb85,_0x1465e4){return function(_0x42d9c8){if(_0x42d9c8){return _0x42d9c8['update'](_0x32cb85)[_0x4860('0x28')](function(_0x1236d5){return _0x1236d5;});}return null;};}function removeEntity(_0xee53d9,_0x2efc55){return function(_0x473512){if(_0x473512){return _0x473512['destroy']()[_0x4860('0x28')](function(){_0xee53d9[_0x4860('0x1d')](0xcc)[_0x4860('0x1e')]();});}};}function handleEntityNotFound(_0x54f084,_0x445be8){return function(_0x147ae4){if(!_0x147ae4){_0x54f084[_0x4860('0x1c')](0x194);}return _0x147ae4;};}function handleError(_0x43ca95,_0x4ae93a){_0x4ae93a=_0x4ae93a||0x1f4;return function(_0x346cdf){logger[_0x4860('0x29')](_0x346cdf[_0x4860('0x2a')]);if(_0x346cdf[_0x4860('0x2b')]){delete _0x346cdf['name'];}_0x43ca95[_0x4860('0x1d')](_0x4ae93a)['send'](_0x346cdf);};}exports[_0x4860('0x2c')]=function(_0x40b995,_0x11ecd4){var _0x6d08e8={},_0x3106ce={},_0x321eb1={'count':0x0,'rows':[]};var _0x1ce86d=_[_0x4860('0x2d')](db[_0x4860('0x2e')][_0x4860('0x2f')],function(_0x26f683){return{'name':_0x26f683['fieldName'],'type':_0x26f683[_0x4860('0x30')][_0x4860('0x31')]};});_0x3106ce[_0x4860('0x32')]=_[_0x4860('0x2d')](_0x1ce86d,_0x4860('0x2b'));_0x3106ce[_0x4860('0x33')]=_['keys'](_0x40b995[_0x4860('0x33')]);_0x3106ce[_0x4860('0x34')]=_['intersection'](_0x3106ce[_0x4860('0x32')],_0x3106ce[_0x4860('0x33')]);_0x6d08e8['attributes']=_['intersection'](_0x3106ce[_0x4860('0x32')],qs[_0x4860('0x35')](_0x40b995['query'][_0x4860('0x35')]));_0x6d08e8[_0x4860('0x36')]=_0x6d08e8['attributes'][_0x4860('0x37')]?_0x6d08e8['attributes']:_0x3106ce[_0x4860('0x32')];if(!_0x40b995['query'][_0x4860('0x38')](_0x4860('0x39'))){_0x6d08e8[_0x4860('0x20')]=qs[_0x4860('0x20')](_0x40b995['query'][_0x4860('0x20')]);_0x6d08e8[_0x4860('0x22')]=qs[_0x4860('0x22')](_0x40b995[_0x4860('0x33')][_0x4860('0x22')]);}_0x6d08e8[_0x4860('0x3a')]=qs[_0x4860('0x3b')](_0x40b995['query'][_0x4860('0x3b')]);_0x6d08e8[_0x4860('0x3c')]=qs[_0x4860('0x34')](_[_0x4860('0x3d')](_0x40b995['query'],_0x3106ce[_0x4860('0x34')]),_0x1ce86d);if(_0x40b995[_0x4860('0x33')]['filter']){_0x6d08e8[_0x4860('0x3c')]=_[_0x4860('0x3e')](_0x6d08e8[_0x4860('0x3c')],{'$or':_[_0x4860('0x2d')](_0x1ce86d,function(_0x58cd83){if(_0x58cd83[_0x4860('0x30')]!=='VIRTUAL'){var _0x15c813={};_0x15c813[_0x58cd83['name']]={'$like':'%'+_0x40b995[_0x4860('0x33')]['filter']+'%'};return _0x15c813;}})});}_0x6d08e8=_[_0x4860('0x3e')]({},_0x6d08e8,_0x40b995[_0x4860('0x3f')]);var _0x5b0254={'where':_0x6d08e8['where']};return db[_0x4860('0x2e')][_0x4860('0x21')](_0x5b0254)[_0x4860('0x28')](function(_0x3897b0){_0x321eb1[_0x4860('0x21')]=_0x3897b0;if(_0x40b995[_0x4860('0x33')][_0x4860('0x40')]){_0x6d08e8[_0x4860('0x41')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x4860('0x42')](_0x6d08e8);})[_0x4860('0x28')](function(_0x579bf3){_0x321eb1['rows']=_0x579bf3;return _0x321eb1;})[_0x4860('0x28')](respondWithFilteredResult(_0x11ecd4,_0x6d08e8))[_0x4860('0x43')](handleError(_0x11ecd4,null));};exports[_0x4860('0x44')]=function(_0x1d64c4,_0x2cc863){var _0x4f7bd0={'raw':!![],'where':{'id':_0x1d64c4['params']['id']}},_0x1a7af4={};_0x1a7af4[_0x4860('0x32')]=_[_0x4860('0x45')](db[_0x4860('0x2e')][_0x4860('0x2f')]);_0x1a7af4[_0x4860('0x33')]=_[_0x4860('0x45')](_0x1d64c4[_0x4860('0x33')]);_0x1a7af4[_0x4860('0x34')]=_['intersection'](_0x1a7af4[_0x4860('0x32')],_0x1a7af4[_0x4860('0x33')]);_0x4f7bd0[_0x4860('0x36')]=_[_0x4860('0x46')](_0x1a7af4[_0x4860('0x32')],qs[_0x4860('0x35')](_0x1d64c4[_0x4860('0x33')]['fields']));_0x4f7bd0[_0x4860('0x36')]=_0x4f7bd0[_0x4860('0x36')][_0x4860('0x37')]?_0x4f7bd0[_0x4860('0x36')]:_0x1a7af4[_0x4860('0x32')];if(_0x1d64c4['query'][_0x4860('0x40')]){_0x4f7bd0[_0x4860('0x41')]=[{'all':!![]}];}_0x4f7bd0=_['merge']({},_0x4f7bd0,_0x1d64c4[_0x4860('0x3f')]);return db['Dynamics365Field'][_0x4860('0x47')](_0x4f7bd0)['then'](handleEntityNotFound(_0x2cc863,null))['then'](respondWithResult(_0x2cc863,null))[_0x4860('0x43')](handleError(_0x2cc863,null));};exports[_0x4860('0x48')]=function(_0x15c4f8,_0x4e0b8a){return db[_0x4860('0x2e')][_0x4860('0x48')](_0x15c4f8['body'],{})[_0x4860('0x28')](respondWithResult(_0x4e0b8a,0xc9))[_0x4860('0x43')](handleError(_0x4e0b8a,null));};exports[_0x4860('0x49')]=function(_0x4178c5,_0x3af29d){if(_0x4178c5[_0x4860('0x4a')]['id']){delete _0x4178c5[_0x4860('0x4a')]['id'];}return db[_0x4860('0x2e')][_0x4860('0x47')]({'where':{'id':_0x4178c5[_0x4860('0x4b')]['id']}})[_0x4860('0x28')](handleEntityNotFound(_0x3af29d,null))['then'](saveUpdates(_0x4178c5[_0x4860('0x4a')],null))['then'](respondWithResult(_0x3af29d,null))[_0x4860('0x43')](handleError(_0x3af29d,null));};exports[_0x4860('0x4c')]=function(_0x161ec4,_0x43a498){return db[_0x4860('0x2e')]['find']({'where':{'id':_0x161ec4[_0x4860('0x4b')]['id']}})['then'](handleEntityNotFound(_0x43a498,null))['then'](removeEntity(_0x43a498,null))[_0x4860('0x43')](handleError(_0x43a498,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 0e1f894..798cd29 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 _0x35ae=['FieldId','util','../../config/logger','api','moment','bluebird','request-promise','./intDynamics365Field.attributes','define','Dynamics365Field','dynamics365_unique_index','idField'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x35ae,0xf1));var _0xe35a=function(_0x3e0c16,_0x42c928){_0x3e0c16=_0x3e0c16-0x0;var _0x16d949=_0x35ae[_0x3e0c16];return _0x16d949;};'use strict';var _=require('lodash');var util=require(_0xe35a('0x0'));var logger=require(_0xe35a('0x1'))(_0xe35a('0x2'));var moment=require(_0xe35a('0x3'));var BPromise=require(_0xe35a('0x4'));var rp=require(_0xe35a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe35a('0x6'));module['exports']=function(_0x2eac1d,_0x3445af){return _0x2eac1d[_0xe35a('0x7')](_0xe35a('0x8'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xe35a('0x9'),'fields':[_0xe35a('0xa'),_0xe35a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60dd=['Dynamics365Field','int_dynamics365_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define'];(function(_0x2c1e7a,_0x155f86){var _0xcacb4f=function(_0x2b2eb3){while(--_0x2b2eb3){_0x2c1e7a['push'](_0x2c1e7a['shift']());}};_0xcacb4f(++_0x155f86);}(_0x60dd,0x15c));var _0xd60d=function(_0x128520,_0x2e65ee){_0x128520=_0x128520-0x0;var _0x191542=_0x60dd[_0x128520];return _0x191542;};'use strict';var _=require(_0xd60d('0x0'));var util=require(_0xd60d('0x1'));var logger=require(_0xd60d('0x2'))(_0xd60d('0x3'));var moment=require(_0xd60d('0x4'));var BPromise=require(_0xd60d('0x5'));var rp=require(_0xd60d('0x6'));var fs=require('fs');var path=require(_0xd60d('0x7'));var rimraf=require(_0xd60d('0x8'));var config=require('../../config/environment');var attributes=require(_0xd60d('0x9'));module[_0xd60d('0xa')]=function(_0x199f1d,_0x4646f1){return _0x199f1d[_0xd60d('0xb')](_0xd60d('0xc'),attributes,{'tableName':_0xd60d('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0xd60d('0xe')],'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 9ab0f36..dd1450a 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 _0x2e68=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x554619,_0x1c2f80){var _0x291e71=function(_0x4888ac){while(--_0x4888ac){_0x554619['push'](_0x554619['shift']());}};_0x291e71(++_0x1c2f80);}(_0x2e68,0xf9));var _0x82e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2e68[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x82e6('0x0'));var util=require(_0x82e6('0x1'));var moment=require('moment');var BPromise=require(_0x82e6('0x2'));var rs=require(_0x82e6('0x3'));var fs=require('fs');var Redis=require(_0x82e6('0x4'));var db=require(_0x82e6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x82e6('0x6'));var config=require(_0x82e6('0x7'));var jayson=require(_0x82e6('0x8'));var client=jayson[_0x82e6('0x9')][_0x82e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f2e1d,_0x4596fc,_0x23df4d){return new BPromise(function(_0xd91aa5,_0x2d4192){return client[_0x82e6('0xb')](_0x5f2e1d,_0x23df4d)[_0x82e6('0xc')](function(_0x43ab04){logger[_0x82e6('0xd')](_0x82e6('0xe'),_0x4596fc,'request\x20sent');logger[_0x82e6('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4596fc,_0x82e6('0x10'),JSON[_0x82e6('0x11')](_0x43ab04));if(_0x43ab04[_0x82e6('0x12')]){if(_0x43ab04[_0x82e6('0x12')][_0x82e6('0x13')]===0x1f4){logger[_0x82e6('0x12')](_0x82e6('0xe'),_0x4596fc,_0x43ab04[_0x82e6('0x12')]['message']);return _0x2d4192(_0x43ab04[_0x82e6('0x12')][_0x82e6('0x14')]);}logger[_0x82e6('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x4596fc,_0x43ab04['error'][_0x82e6('0x14')]);return _0xd91aa5(_0x43ab04[_0x82e6('0x12')][_0x82e6('0x14')]);}else{logger[_0x82e6('0xd')](_0x82e6('0xe'),_0x4596fc,'request\x20sent');_0xd91aa5(_0x43ab04[_0x82e6('0x15')][_0x82e6('0x14')]);}})[_0x82e6('0x16')](function(_0x116a9f){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x4596fc,_0x116a9f);_0x2d4192(_0x116a9f);});});} \ No newline at end of file +var _0x4c2e=['jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment'];(function(_0x460e05,_0x37f195){var _0x48dcd9=function(_0x29712d){while(--_0x29712d){_0x460e05['push'](_0x460e05['shift']());}};_0x48dcd9(++_0x37f195);}(_0x4c2e,0x1ed));var _0xe4c2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4c2e[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe4c2('0x0'));var util=require(_0xe4c2('0x1'));var moment=require(_0xe4c2('0x2'));var BPromise=require(_0xe4c2('0x3'));var rs=require(_0xe4c2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe4c2('0x5'))('rpc');var config=require(_0xe4c2('0x6'));var jayson=require(_0xe4c2('0x7'));var client=jayson[_0xe4c2('0x8')][_0xe4c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16d3a1,_0x5cbedd,_0x4fd68e){return new BPromise(function(_0x2c1fe7,_0x14f43e){return client[_0xe4c2('0xa')](_0x16d3a1,_0x4fd68e)[_0xe4c2('0xb')](function(_0x24d681){logger['info'](_0xe4c2('0xc'),_0x5cbedd,'request\x20sent');logger[_0xe4c2('0xd')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x5cbedd,_0xe4c2('0xe'),JSON['stringify'](_0x24d681));if(_0x24d681[_0xe4c2('0xf')]){if(_0x24d681['error'][_0xe4c2('0x10')]===0x1f4){logger['error'](_0xe4c2('0xc'),_0x5cbedd,_0x24d681['error']['message']);return _0x14f43e(_0x24d681[_0xe4c2('0xf')][_0xe4c2('0x11')]);}logger[_0xe4c2('0xf')](_0xe4c2('0xc'),_0x5cbedd,_0x24d681[_0xe4c2('0xf')][_0xe4c2('0x11')]);return _0x2c1fe7(_0x24d681['error'][_0xe4c2('0x11')]);}else{logger['info'](_0xe4c2('0xc'),_0x5cbedd,_0xe4c2('0xe'));_0x2c1fe7(_0x24d681[_0xe4c2('0x12')][_0xe4c2('0x11')]);}})[_0xe4c2('0x13')](function(_0x355e4a){logger[_0xe4c2('0xf')](_0xe4c2('0xc'),_0x5cbedd,_0x355e4a);_0x14f43e(_0x355e4a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 74df0bb..a2d6cea 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 _0x8338=['isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','./intFreshdeskAccount.controller','get'];(function(_0x12ec65,_0x275502){var _0x2746e6=function(_0x4b05a3){while(--_0x4b05a3){_0x12ec65['push'](_0x12ec65['shift']());}};_0x2746e6(++_0x275502);}(_0x8338,0x149));var _0x8833=function(_0x557cf8,_0x44fcf6){_0x557cf8=_0x557cf8-0x0;var _0x438267=_0x8338[_0x557cf8];return _0x438267;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8833('0x0'));var timeout=require(_0x8833('0x1'));var express=require(_0x8833('0x2'));var router=express[_0x8833('0x3')]();var fs_extra=require(_0x8833('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8833('0x5'));router[_0x8833('0x6')]('/',auth[_0x8833('0x7')](),controller[_0x8833('0x8')]);router[_0x8833('0x6')](_0x8833('0x9'),auth[_0x8833('0x7')](),controller[_0x8833('0xa')]);router[_0x8833('0x6')]('/:id/configurations',auth[_0x8833('0x7')](),controller[_0x8833('0xb')]);router['get'](_0x8833('0xc'),auth[_0x8833('0x7')](),controller[_0x8833('0xd')]);router[_0x8833('0xe')]('/',auth[_0x8833('0x7')](),controller[_0x8833('0xf')]);router[_0x8833('0xe')](_0x8833('0x10'),auth[_0x8833('0x7')](),controller[_0x8833('0x11')]);router['put'](_0x8833('0x9'),auth[_0x8833('0x7')](),controller['update']);router[_0x8833('0x12')](_0x8833('0x9'),auth[_0x8833('0x7')](),controller[_0x8833('0x13')]);module[_0x8833('0x14')]=router; \ No newline at end of file +var _0xb858=['create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields'];(function(_0x562d26,_0x2cf731){var _0x493266=function(_0x5e38df){while(--_0x5e38df){_0x562d26['push'](_0x562d26['shift']());}};_0x493266(++_0x2cf731);}(_0xb858,0x6c));var _0x8b85=function(_0xf3d5a0,_0x4c3828){_0xf3d5a0=_0xf3d5a0-0x0;var _0x1c3150=_0xb858[_0xf3d5a0];return _0x1c3150;};'use strict';var multer=require(_0x8b85('0x0'));var util=require(_0x8b85('0x1'));var path=require('path');var timeout=require(_0x8b85('0x2'));var express=require('express');var router=express[_0x8b85('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8b85('0x4'));var interaction=require(_0x8b85('0x5'));var config=require(_0x8b85('0x6'));var controller=require(_0x8b85('0x7'));router[_0x8b85('0x8')]('/',auth['isAuthenticated'](),controller[_0x8b85('0x9')]);router['get'](_0x8b85('0xa'),auth['isAuthenticated'](),controller[_0x8b85('0xb')]);router[_0x8b85('0x8')](_0x8b85('0xc'),auth[_0x8b85('0xd')](),controller[_0x8b85('0xe')]);router[_0x8b85('0x8')](_0x8b85('0xf'),auth['isAuthenticated'](),controller[_0x8b85('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8b85('0x11')]);router[_0x8b85('0x12')](_0x8b85('0xc'),auth[_0x8b85('0xd')](),controller[_0x8b85('0x13')]);router[_0x8b85('0x14')](_0x8b85('0xa'),auth[_0x8b85('0xd')](),controller[_0x8b85('0x15')]);router[_0x8b85('0x16')]('/:id',auth[_0x8b85('0xd')](),controller[_0x8b85('0x17')]);module[_0x8b85('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index ab03ab8..e473b26 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 _0x7b84=['sequelize','exports','STRING','username','remoteUri'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x7b84,0x17c));var _0x47b8=function(_0xc787cd,_0x2788db){_0xc787cd=_0xc787cd-0x0;var _0x347884=_0x7b84[_0xc787cd];return _0x347884;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')]},'description':{'type':Sequelize[_0x47b8('0x2')]},'username':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x3')},'apiKey':{'type':Sequelize[_0x47b8('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x47b8('0x4')},'serverUrl':{'type':Sequelize[_0x47b8('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb145=['STRING','username','remoteUri','exports'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0xb145,0xa3));var _0x5b14=function(_0x5161a6,_0x58e171){_0x5161a6=_0x5161a6-0x0;var _0x490c6d=_0xb145[_0x5161a6];return _0x490c6d;};'use strict';var Sequelize=require('sequelize');module[_0x5b14('0x0')]={'name':{'type':Sequelize[_0x5b14('0x1')]},'description':{'type':Sequelize[_0x5b14('0x1')]},'username':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x2')},'apiKey':{'type':Sequelize[_0x5b14('0x1')]},'remoteUri':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 62e92d5..3cdf117 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 _0x03bc=['update','then','end','error','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','fields','length','include','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','source','group','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save'];(function(_0x51c533,_0x383746){var _0x166276=function(_0x4c4378){while(--_0x4c4378){_0x51c533['push'](_0x51c533['shift']());}};_0x166276(++_0x383746);}(_0x03bc,0xb8));var _0xc03b=function(_0x68ec17,_0x404d37){_0x68ec17=_0x68ec17-0x0;var _0x3bbcdb=_0x03bc[_0x68ec17];return _0x3bbcdb;};'use strict';var emlformat=require(_0xc03b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc03b('0x1'));var jsonpatch=require(_0xc03b('0x2'));var rp=require('request-promise');var moment=require(_0xc03b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc03b('0x4'));var util=require(_0xc03b('0x5'));var path=require(_0xc03b('0x6'));var sox=require(_0xc03b('0x7'));var csv=require(_0xc03b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc03b('0x9'));var _=require('lodash');var squel=require(_0xc03b('0xa'));var crypto=require(_0xc03b('0xb'));var jsforce=require(_0xc03b('0xc'));var deskjs=require(_0xc03b('0xd'));var toCsv=require(_0xc03b('0x8'));var querystring=require(_0xc03b('0xe'));var Papa=require(_0xc03b('0xf'));var Redis=require(_0xc03b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc03b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc03b('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x90a00a,_0x410e9f){_0x410e9f=_0x410e9f||0xcc;return function(_0x142fe0){if(_0x142fe0){return _0x90a00a[_0xc03b('0x13')](_0x410e9f);}return _0x90a00a[_0xc03b('0x14')](_0x410e9f)['end']();};}function respondWithResult(_0x3510e7,_0x4fdfbe){_0x4fdfbe=_0x4fdfbe||0xc8;return function(_0x4b4046){if(_0x4b4046){return _0x3510e7['status'](_0x4fdfbe)[_0xc03b('0x15')](_0x4b4046);}};}function respondWithFilteredResult(_0xcd680b,_0xc4c35c){return function(_0x45c890){if(_0x45c890){var _0x14b4c1=typeof _0xc4c35c['offset']==='undefined'&&typeof _0xc4c35c[_0xc03b('0x16')]===_0xc03b('0x17');var _0xc09f60=_0x45c890[_0xc03b('0x18')];var _0x479125=_0x14b4c1?0x0:_0xc4c35c[_0xc03b('0x19')];var _0x1e5526=_0x14b4c1?_0x45c890[_0xc03b('0x18')]:_0xc4c35c['offset']+_0xc4c35c['limit'];var _0x146db9;if(_0x1e5526>=_0xc09f60){_0x1e5526=_0xc09f60;_0x146db9=0xc8;}else{_0x146db9=0xce;}_0xcd680b[_0xc03b('0x14')](_0x146db9);return _0xcd680b[_0xc03b('0x1a')](_0xc03b('0x1b'),_0x479125+'-'+_0x1e5526+'/'+_0xc09f60)[_0xc03b('0x15')](_0x45c890);}return null;};}function patchUpdates(_0x46a467){return function(_0x52d4ad){try{jsonpatch[_0xc03b('0x1c')](_0x52d4ad,_0x46a467,!![]);}catch(_0x433027){return BPromise['reject'](_0x433027);}return _0x52d4ad[_0xc03b('0x1d')]();};}function saveUpdates(_0x21cc21,_0x4541a6){return function(_0x59a63d){if(_0x59a63d){return _0x59a63d[_0xc03b('0x1e')](_0x21cc21)[_0xc03b('0x1f')](function(_0x1ea975){return _0x1ea975;});}return null;};}function removeEntity(_0x2ec936,_0x2d5355){return function(_0x50a18){if(_0x50a18){return _0x50a18['destroy']()['then'](function(){_0x2ec936[_0xc03b('0x14')](0xcc)[_0xc03b('0x20')]();});}};}function handleEntityNotFound(_0x3f6af0,_0x10caa0){return function(_0x36a89f){if(!_0x36a89f){_0x3f6af0[_0xc03b('0x13')](0x194);}return _0x36a89f;};}function handleError(_0x24456,_0x55ee96){_0x55ee96=_0x55ee96||0x1f4;return function(_0x3ef852){logger[_0xc03b('0x21')](_0x3ef852['stack']);if(_0x3ef852['name']){delete _0x3ef852[_0xc03b('0x22')];}_0x24456['status'](_0x55ee96)[_0xc03b('0x23')](_0x3ef852);};}exports[_0xc03b('0x24')]=function(_0x34fefa,_0x2c91be){var _0x3f895a={},_0x1dd14d={},_0x22c496={'count':0x0,'rows':[]};var _0x42cfbb=_[_0xc03b('0x25')](db[_0xc03b('0x26')][_0xc03b('0x27')],function(_0x1e17ab){return{'name':_0x1e17ab[_0xc03b('0x28')],'type':_0x1e17ab[_0xc03b('0x29')]['key']};});_0x1dd14d[_0xc03b('0x2a')]=_[_0xc03b('0x25')](_0x42cfbb,_0xc03b('0x22'));_0x1dd14d[_0xc03b('0x2b')]=_[_0xc03b('0x2c')](_0x34fefa[_0xc03b('0x2b')]);_0x1dd14d[_0xc03b('0x2d')]=_[_0xc03b('0x2e')](_0x1dd14d[_0xc03b('0x2a')],_0x1dd14d[_0xc03b('0x2b')]);_0x3f895a[_0xc03b('0x2f')]=_['intersection'](_0x1dd14d[_0xc03b('0x2a')],qs['fields'](_0x34fefa[_0xc03b('0x2b')]['fields']));_0x3f895a[_0xc03b('0x2f')]=_0x3f895a['attributes']['length']?_0x3f895a[_0xc03b('0x2f')]:_0x1dd14d[_0xc03b('0x2a')];if(!_0x34fefa[_0xc03b('0x2b')][_0xc03b('0x30')](_0xc03b('0x31'))){_0x3f895a[_0xc03b('0x16')]=qs[_0xc03b('0x16')](_0x34fefa[_0xc03b('0x2b')][_0xc03b('0x16')]);_0x3f895a[_0xc03b('0x19')]=qs[_0xc03b('0x19')](_0x34fefa[_0xc03b('0x2b')][_0xc03b('0x19')]);}_0x3f895a[_0xc03b('0x32')]=qs[_0xc03b('0x33')](_0x34fefa[_0xc03b('0x2b')][_0xc03b('0x33')]);_0x3f895a[_0xc03b('0x34')]=qs['filters'](_['pick'](_0x34fefa[_0xc03b('0x2b')],_0x1dd14d['filters']),_0x42cfbb);if(_0x34fefa[_0xc03b('0x2b')][_0xc03b('0x35')]){_0x3f895a[_0xc03b('0x34')]=_[_0xc03b('0x36')](_0x3f895a[_0xc03b('0x34')],{'$or':_[_0xc03b('0x25')](_0x42cfbb,function(_0x40cb36){if(_0x40cb36[_0xc03b('0x29')]!==_0xc03b('0x37')){var _0x5737de={};_0x5737de[_0x40cb36[_0xc03b('0x22')]]={'$like':'%'+_0x34fefa['query'][_0xc03b('0x35')]+'%'};return _0x5737de;}})});}_0x3f895a=_[_0xc03b('0x36')]({},_0x3f895a,_0x34fefa[_0xc03b('0x38')]);var _0x57bb25={'where':_0x3f895a[_0xc03b('0x34')]};return db[_0xc03b('0x26')][_0xc03b('0x18')](_0x57bb25)[_0xc03b('0x1f')](function(_0x2b7b7a){_0x22c496[_0xc03b('0x18')]=_0x2b7b7a;if(_0x34fefa[_0xc03b('0x2b')][_0xc03b('0x39')]){_0x3f895a['include']=[{'all':!![]}];}return db[_0xc03b('0x26')][_0xc03b('0x3a')](_0x3f895a);})[_0xc03b('0x1f')](function(_0xbb49c2){_0x22c496[_0xc03b('0x3b')]=_0xbb49c2;return _0x22c496;})['then'](respondWithFilteredResult(_0x2c91be,_0x3f895a))[_0xc03b('0x3c')](handleError(_0x2c91be,null));};exports['show']=function(_0x4e1e3d,_0x1260f0){var _0x4a0d9c={'raw':![],'where':{'id':_0x4e1e3d[_0xc03b('0x3d')]['id']}},_0x331a3a={};_0x331a3a[_0xc03b('0x2a')]=_[_0xc03b('0x2c')](db[_0xc03b('0x26')][_0xc03b('0x27')]);_0x331a3a[_0xc03b('0x2b')]=_[_0xc03b('0x2c')](_0x4e1e3d['query']);_0x331a3a['filters']=_['intersection'](_0x331a3a[_0xc03b('0x2a')],_0x331a3a['query']);_0x4a0d9c[_0xc03b('0x2f')]=_[_0xc03b('0x2e')](_0x331a3a[_0xc03b('0x2a')],qs[_0xc03b('0x3e')](_0x4e1e3d[_0xc03b('0x2b')][_0xc03b('0x3e')]));_0x4a0d9c[_0xc03b('0x2f')]=_0x4a0d9c['attributes'][_0xc03b('0x3f')]?_0x4a0d9c['attributes']:_0x331a3a[_0xc03b('0x2a')];if(_0x4e1e3d[_0xc03b('0x2b')]['includeAll']){_0x4a0d9c[_0xc03b('0x40')]=[{'all':!![]}];}_0x4a0d9c=_[_0xc03b('0x36')]({},_0x4a0d9c,_0x4e1e3d[_0xc03b('0x38')]);return db['FreshdeskAccount']['find'](_0x4a0d9c)['then'](handleEntityNotFound(_0x1260f0,null))[_0xc03b('0x1f')](respondWithResult(_0x1260f0,null))[_0xc03b('0x3c')](handleError(_0x1260f0,null));};exports[_0xc03b('0x41')]=function(_0x4183de,_0x1c5c6a){return db['FreshdeskAccount'][_0xc03b('0x41')](_0x4183de['body'],{})[_0xc03b('0x1f')](respondWithResult(_0x1c5c6a,0xc9))[_0xc03b('0x3c')](handleError(_0x1c5c6a,null));};exports[_0xc03b('0x1e')]=function(_0x36e2d3,_0x130912){if(_0x36e2d3[_0xc03b('0x42')]['id']){delete _0x36e2d3['body']['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x36e2d3[_0xc03b('0x3d')]['id']}})[_0xc03b('0x1f')](handleEntityNotFound(_0x130912,null))[_0xc03b('0x1f')](saveUpdates(_0x36e2d3[_0xc03b('0x42')],null))['then'](respondWithResult(_0x130912,null))[_0xc03b('0x3c')](handleError(_0x130912,null));};exports['destroy']=function(_0x4996c4,_0x6b4b10){return db[_0xc03b('0x26')]['find']({'where':{'id':_0x4996c4[_0xc03b('0x3d')]['id']}})[_0xc03b('0x1f')](handleEntityNotFound(_0x6b4b10,null))[_0xc03b('0x1f')](removeEntity(_0x6b4b10,null))[_0xc03b('0x3c')](handleError(_0x6b4b10,null));};exports[_0xc03b('0x43')]=function(_0xac4ba3,_0x238e06,_0x29585b){var _0x42e25c={};var _0x169818={};var _0x5540db;var _0x53c956;return db[_0xc03b('0x26')]['findOne']({'where':{'id':_0xac4ba3[_0xc03b('0x3d')]['id']}})[_0xc03b('0x1f')](handleEntityNotFound(_0x238e06,null))[_0xc03b('0x1f')](function(_0x438a17){if(_0x438a17){_0x5540db=_0x438a17;_0x169818[_0xc03b('0x2a')]=_[_0xc03b('0x2c')](db[_0xc03b('0x44')][_0xc03b('0x27')]);_0x169818[_0xc03b('0x2b')]=_['keys'](_0xac4ba3[_0xc03b('0x2b')]);_0x169818['filters']=_[_0xc03b('0x2e')](_0x169818[_0xc03b('0x2a')],_0x169818[_0xc03b('0x2b')]);_0x42e25c[_0xc03b('0x2f')]=_[_0xc03b('0x2e')](_0x169818[_0xc03b('0x2a')],qs[_0xc03b('0x3e')](_0xac4ba3[_0xc03b('0x2b')][_0xc03b('0x3e')]));_0x42e25c[_0xc03b('0x2f')]=_0x42e25c['attributes'][_0xc03b('0x3f')]?_0x42e25c[_0xc03b('0x2f')]:_0x169818[_0xc03b('0x2a')];_0x42e25c['order']=qs[_0xc03b('0x33')](_0xac4ba3[_0xc03b('0x2b')]['sort']);_0x42e25c[_0xc03b('0x34')]=qs[_0xc03b('0x2d')](_['pick'](_0xac4ba3[_0xc03b('0x2b')],_0x169818[_0xc03b('0x2d')]));if(_0xac4ba3['query']['filter']){_0x42e25c[_0xc03b('0x34')]=_['merge'](_0x42e25c[_0xc03b('0x34')],{'$or':_[_0xc03b('0x25')](_0x42e25c['attributes'],function(_0x3c9521){var _0x42ea29={};_0x42ea29[_0x3c9521]={'$like':'%'+_0xac4ba3['query']['filter']+'%'};return _0x42ea29;})});}_0x42e25c=_['merge']({},_0x42e25c,_0xac4ba3[_0xc03b('0x38')]);return _0x5540db['getConfigurations'](_0x42e25c);}})[_0xc03b('0x1f')](function(_0x59d25a){if(_0x59d25a){_0x53c956=_0x59d25a[_0xc03b('0x3f')];if(!_0xac4ba3['query']['hasOwnProperty']('nolimit')){_0x42e25c[_0xc03b('0x16')]=qs['limit'](_0xac4ba3[_0xc03b('0x2b')][_0xc03b('0x16')]);_0x42e25c[_0xc03b('0x19')]=qs[_0xc03b('0x19')](_0xac4ba3['query']['offset']);}return _0x5540db[_0xc03b('0x43')](_0x42e25c);}})[_0xc03b('0x1f')](function(_0xf4db6b){if(_0xf4db6b){return _0xf4db6b?{'count':_0x53c956,'rows':_0xf4db6b}:null;}})[_0xc03b('0x1f')](respondWithResult(_0x238e06,null))[_0xc03b('0x3c')](handleError(_0x238e06,null));};exports[_0xc03b('0x45')]=function(_0x321fa4,_0x53092d,_0x1c49ed){if(_0x321fa4[_0xc03b('0x42')]['id']){delete _0x321fa4[_0xc03b('0x42')]['id'];}return db[_0xc03b('0x26')][_0xc03b('0x46')]({'where':{'id':_0x321fa4[_0xc03b('0x3d')]['id']}})[_0xc03b('0x1f')](handleEntityNotFound(_0x53092d,null))[_0xc03b('0x1f')](function(_0x45619e){if(_0x45619e){_0x321fa4[_0xc03b('0x42')][_0xc03b('0x47')]=_0x45619e['id'];_0x321fa4[_0xc03b('0x42')][_0xc03b('0x48')]=integrations[_0xc03b('0x49')](_0x321fa4[_0xc03b('0x42')][_0xc03b('0x4a')],_0x321fa4[_0xc03b('0x42')]['type']);_0x321fa4[_0xc03b('0x42')]['Descriptions']=integrations[_0xc03b('0x4b')](_0x321fa4[_0xc03b('0x42')][_0xc03b('0x4a')],_0x321fa4[_0xc03b('0x42')][_0xc03b('0x29')]);return db[_0xc03b('0x44')][_0xc03b('0x41')](_0x321fa4[_0xc03b('0x42')],{'include':[{'model':db['FreshdeskField'],'as':_0xc03b('0x48')},{'model':db[_0xc03b('0x4c')],'as':_0xc03b('0x4d')}]});}return null;})[_0xc03b('0x1f')](respondWithResult(_0x53092d,null))[_0xc03b('0x3c')](handleError(_0x53092d,null));};exports[_0xc03b('0x4e')]=function(_0x40073a,_0x2349dd,_0x5e2e38){var _0x2fe117='';return db['FreshdeskAccount'][_0xc03b('0x46')]({'where':{'id':_0x40073a[_0xc03b('0x3d')]['id']},'attributes':['id',_0xc03b('0x4f'),_0xc03b('0x50')]})[_0xc03b('0x1f')](handleEntityNotFound(_0x2349dd,null))['then'](function(_0x5ac6f1){if(_0x5ac6f1){_0x2fe117=_0x5ac6f1['remoteUri'];var _0x201b0d=_0x2fe117['slice'](-0x1);if(_0x201b0d==='/'){_0x2fe117=_0x2fe117[_0xc03b('0x51')](0x0,_0x2fe117[_0xc03b('0x52')](_0x201b0d));}return rp({'method':_0xc03b('0x53'),'uri':util[_0xc03b('0x54')]('%s/%s',_0x2fe117,_0xc03b('0x55')),'headers':{'Authorization':util[_0xc03b('0x54')](_0xc03b('0x56'),new Buffer(util[_0xc03b('0x54')](_0xc03b('0x57'),_0x5ac6f1['apiKey']))[_0xc03b('0x58')](_0xc03b('0x59')))},'json':!![]});}})[_0xc03b('0x1f')](function(_0xf74184){if(_0xf74184){var _0x16ba2d=[_0xc03b('0x5a'),_0xc03b('0x5b'),_0xc03b('0x5c'),_0xc03b('0x5d'),_0xc03b('0x14'),_0xc03b('0x5e'),'group',_0xc03b('0x5f'),'ticket_type',_0xc03b('0x60'),_0xc03b('0x61')];_[_0xc03b('0x62')](_0xf74184,function(_0x27504a){return _0x16ba2d[_0xc03b('0x63')](_0x27504a[_0xc03b('0x22')])||!_0x27504a[_0xc03b('0x64')]&&_0x27504a[_0xc03b('0x29')]!==_0xc03b('0x65')&&_0x27504a[_0xc03b('0x29')]!==_0xc03b('0x66');});return{'count':_0xf74184['length'],'rows':_[_0xc03b('0x25')](_0xf74184,function(_0x11587a){return{'id':_0x11587a[_0xc03b('0x22')],'name':_0x11587a['label'],'custom':!_0x11587a['default'],'options':_0x11587a[_0xc03b('0x67')]?_['map'](_0x11587a['choices'],function(_0x3def44){return{'name':_[_0xc03b('0x68')](_0x3def44),'value':_0x3def44};}):[]};})};}})[_0xc03b('0x1f')](respondWithResult(_0x2349dd,null))['catch'](function(_0xa01874){var _0x2bd9e2=_0x40073a[_0xc03b('0x2b')]['test']?0x1f4:_0xa01874[_0xc03b('0x69')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xc03b('0x4e'),_0x2bd9e2,JSON['stringify'](_0xa01874));delete _0xa01874[_0xc03b('0x22')];if(_0x2bd9e2===0x191){_0x2bd9e2=0x190;}_0x2349dd[_0xc03b('0x14')](_0x2bd9e2)['send'](_0x40073a[_0xc03b('0x2b')]['test']?{'message':_0xc03b('0x6a'),'statusCode':_0xa01874[_0xc03b('0x69')]}:_0xa01874);});}; \ No newline at end of file +var _0x55f1=['addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','Basic\x20%s','format','%s:X','toString','requester','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','catch','params','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','length','nolimit'];(function(_0x1d2bc8,_0x2860bc){var _0x1857e1=function(_0x3a3073){while(--_0x3a3073){_0x1d2bc8['push'](_0x1d2bc8['shift']());}};_0x1857e1(++_0x2860bc);}(_0x55f1,0x9b));var _0x155f=function(_0x2fbc8c,_0x3d8a8f){_0x2fbc8c=_0x2fbc8c-0x0;var _0x2885b6=_0x55f1[_0x2fbc8c];return _0x2885b6;};'use strict';var emlformat=require(_0x155f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x155f('0x1'));var jsonpatch=require(_0x155f('0x2'));var rp=require(_0x155f('0x3'));var moment=require(_0x155f('0x4'));var BPromise=require(_0x155f('0x5'));var Mustache=require(_0x155f('0x6'));var util=require(_0x155f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x155f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x155f('0x9'));var _=require(_0x155f('0xa'));var squel=require(_0x155f('0xb'));var crypto=require(_0x155f('0xc'));var jsforce=require(_0x155f('0xd'));var deskjs=require(_0x155f('0xe'));var toCsv=require(_0x155f('0x8'));var querystring=require(_0x155f('0xf'));var Papa=require(_0x155f('0x10'));var Redis=require(_0x155f('0x11'));var authService=require(_0x155f('0x12'));var qs=require(_0x155f('0x13'));var as=require(_0x155f('0x14'));var hardwareService=require(_0x155f('0x15'));var logger=require(_0x155f('0x16'))(_0x155f('0x17'));var utils=require(_0x155f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x155f('0x19'));var db=require(_0x155f('0x1a'))['db'];var integrations=require(_0x155f('0x1b'));function respondWithStatusCode(_0x56f9e9,_0x517753){_0x517753=_0x517753||0xcc;return function(_0x2aaa3c){if(_0x2aaa3c){return _0x56f9e9[_0x155f('0x1c')](_0x517753);}return _0x56f9e9[_0x155f('0x1d')](_0x517753)[_0x155f('0x1e')]();};}function respondWithResult(_0x177c4e,_0x2fa0d4){_0x2fa0d4=_0x2fa0d4||0xc8;return function(_0x14dad8){if(_0x14dad8){return _0x177c4e['status'](_0x2fa0d4)[_0x155f('0x1f')](_0x14dad8);}};}function respondWithFilteredResult(_0x2ef684,_0x581ee9){return function(_0x44c018){if(_0x44c018){var _0x1c2d06=typeof _0x581ee9[_0x155f('0x20')]===_0x155f('0x21')&&typeof _0x581ee9[_0x155f('0x22')]===_0x155f('0x21');var _0x1cca82=_0x44c018[_0x155f('0x23')];var _0x2f5b83=_0x1c2d06?0x0:_0x581ee9[_0x155f('0x20')];var _0x2e248d=_0x1c2d06?_0x44c018[_0x155f('0x23')]:_0x581ee9[_0x155f('0x20')]+_0x581ee9[_0x155f('0x22')];var _0x1f76e9;if(_0x2e248d>=_0x1cca82){_0x2e248d=_0x1cca82;_0x1f76e9=0xc8;}else{_0x1f76e9=0xce;}_0x2ef684[_0x155f('0x1d')](_0x1f76e9);return _0x2ef684['set'](_0x155f('0x24'),_0x2f5b83+'-'+_0x2e248d+'/'+_0x1cca82)[_0x155f('0x1f')](_0x44c018);}return null;};}function patchUpdates(_0x39c362){return function(_0x5ec409){try{jsonpatch['apply'](_0x5ec409,_0x39c362,!![]);}catch(_0x5786f1){return BPromise['reject'](_0x5786f1);}return _0x5ec409[_0x155f('0x25')]();};}function saveUpdates(_0x3a40b4,_0x2e337e){return function(_0x54366f){if(_0x54366f){return _0x54366f[_0x155f('0x26')](_0x3a40b4)['then'](function(_0x1855cd){return _0x1855cd;});}return null;};}function removeEntity(_0x2047c2,_0x172077){return function(_0x348240){if(_0x348240){return _0x348240[_0x155f('0x27')]()[_0x155f('0x28')](function(){_0x2047c2[_0x155f('0x1d')](0xcc)[_0x155f('0x1e')]();});}};}function handleEntityNotFound(_0x45b580,_0x2bc5b5){return function(_0x143749){if(!_0x143749){_0x45b580[_0x155f('0x1c')](0x194);}return _0x143749;};}function handleError(_0x52af8e,_0x5c0a30){_0x5c0a30=_0x5c0a30||0x1f4;return function(_0x346a14){logger[_0x155f('0x29')](_0x346a14[_0x155f('0x2a')]);if(_0x346a14[_0x155f('0x2b')]){delete _0x346a14['name'];}_0x52af8e[_0x155f('0x1d')](_0x5c0a30)[_0x155f('0x2c')](_0x346a14);};}exports[_0x155f('0x2d')]=function(_0x29e9dd,_0x1f53c8){var _0x3d3e46={},_0x1a89bb={},_0x54cc56={'count':0x0,'rows':[]};var _0x142e32=_[_0x155f('0x2e')](db[_0x155f('0x2f')][_0x155f('0x30')],function(_0x189315){return{'name':_0x189315[_0x155f('0x31')],'type':_0x189315[_0x155f('0x32')][_0x155f('0x33')]};});_0x1a89bb[_0x155f('0x34')]=_['map'](_0x142e32,_0x155f('0x2b'));_0x1a89bb[_0x155f('0x35')]=_[_0x155f('0x36')](_0x29e9dd['query']);_0x1a89bb[_0x155f('0x37')]=_[_0x155f('0x38')](_0x1a89bb['model'],_0x1a89bb[_0x155f('0x35')]);_0x3d3e46['attributes']=_[_0x155f('0x38')](_0x1a89bb[_0x155f('0x34')],qs['fields'](_0x29e9dd['query'][_0x155f('0x39')]));_0x3d3e46[_0x155f('0x3a')]=_0x3d3e46[_0x155f('0x3a')]['length']?_0x3d3e46[_0x155f('0x3a')]:_0x1a89bb[_0x155f('0x34')];if(!_0x29e9dd[_0x155f('0x35')][_0x155f('0x3b')]('nolimit')){_0x3d3e46[_0x155f('0x22')]=qs[_0x155f('0x22')](_0x29e9dd['query'][_0x155f('0x22')]);_0x3d3e46['offset']=qs[_0x155f('0x20')](_0x29e9dd['query'][_0x155f('0x20')]);}_0x3d3e46['order']=qs['sort'](_0x29e9dd[_0x155f('0x35')][_0x155f('0x3c')]);_0x3d3e46[_0x155f('0x3d')]=qs[_0x155f('0x37')](_[_0x155f('0x3e')](_0x29e9dd[_0x155f('0x35')],_0x1a89bb['filters']),_0x142e32);if(_0x29e9dd[_0x155f('0x35')][_0x155f('0x3f')]){_0x3d3e46[_0x155f('0x3d')]=_['merge'](_0x3d3e46[_0x155f('0x3d')],{'$or':_[_0x155f('0x2e')](_0x142e32,function(_0x1be700){if(_0x1be700[_0x155f('0x32')]!==_0x155f('0x40')){var _0x3c02fb={};_0x3c02fb[_0x1be700['name']]={'$like':'%'+_0x29e9dd[_0x155f('0x35')][_0x155f('0x3f')]+'%'};return _0x3c02fb;}})});}_0x3d3e46=_[_0x155f('0x41')]({},_0x3d3e46,_0x29e9dd['options']);var _0xa0d308={'where':_0x3d3e46['where']};return db[_0x155f('0x2f')][_0x155f('0x23')](_0xa0d308)[_0x155f('0x28')](function(_0x1f23ab){_0x54cc56[_0x155f('0x23')]=_0x1f23ab;if(_0x29e9dd['query'][_0x155f('0x42')]){_0x3d3e46['include']=[{'all':!![]}];}return db[_0x155f('0x2f')][_0x155f('0x43')](_0x3d3e46);})[_0x155f('0x28')](function(_0x55eebe){_0x54cc56['rows']=_0x55eebe;return _0x54cc56;})[_0x155f('0x28')](respondWithFilteredResult(_0x1f53c8,_0x3d3e46))[_0x155f('0x44')](handleError(_0x1f53c8,null));};exports['show']=function(_0x4dcbd5,_0x105a85){var _0x51f824={'raw':![],'where':{'id':_0x4dcbd5[_0x155f('0x45')]['id']}},_0x2d0e67={};_0x2d0e67['model']=_[_0x155f('0x36')](db[_0x155f('0x2f')][_0x155f('0x30')]);_0x2d0e67['query']=_[_0x155f('0x36')](_0x4dcbd5['query']);_0x2d0e67['filters']=_[_0x155f('0x38')](_0x2d0e67[_0x155f('0x34')],_0x2d0e67['query']);_0x51f824[_0x155f('0x3a')]=_[_0x155f('0x38')](_0x2d0e67[_0x155f('0x34')],qs[_0x155f('0x39')](_0x4dcbd5[_0x155f('0x35')][_0x155f('0x39')]));_0x51f824[_0x155f('0x3a')]=_0x51f824['attributes']['length']?_0x51f824['attributes']:_0x2d0e67[_0x155f('0x34')];if(_0x4dcbd5['query'][_0x155f('0x42')]){_0x51f824['include']=[{'all':!![]}];}_0x51f824=_['merge']({},_0x51f824,_0x4dcbd5[_0x155f('0x46')]);return db[_0x155f('0x2f')][_0x155f('0x47')](_0x51f824)[_0x155f('0x28')](handleEntityNotFound(_0x105a85,null))[_0x155f('0x28')](respondWithResult(_0x105a85,null))[_0x155f('0x44')](handleError(_0x105a85,null));};exports[_0x155f('0x48')]=function(_0x321e96,_0x3cb4b1){return db[_0x155f('0x2f')][_0x155f('0x48')](_0x321e96[_0x155f('0x49')],{})[_0x155f('0x28')](respondWithResult(_0x3cb4b1,0xc9))[_0x155f('0x44')](handleError(_0x3cb4b1,null));};exports[_0x155f('0x26')]=function(_0x150c16,_0x3cf6d3){if(_0x150c16[_0x155f('0x49')]['id']){delete _0x150c16[_0x155f('0x49')]['id'];}return db[_0x155f('0x2f')]['find']({'where':{'id':_0x150c16[_0x155f('0x45')]['id']}})[_0x155f('0x28')](handleEntityNotFound(_0x3cf6d3,null))[_0x155f('0x28')](saveUpdates(_0x150c16[_0x155f('0x49')],null))['then'](respondWithResult(_0x3cf6d3,null))[_0x155f('0x44')](handleError(_0x3cf6d3,null));};exports[_0x155f('0x27')]=function(_0x9855f4,_0xeeeef7){return db[_0x155f('0x2f')][_0x155f('0x47')]({'where':{'id':_0x9855f4[_0x155f('0x45')]['id']}})[_0x155f('0x28')](handleEntityNotFound(_0xeeeef7,null))[_0x155f('0x28')](removeEntity(_0xeeeef7,null))[_0x155f('0x44')](handleError(_0xeeeef7,null));};exports[_0x155f('0x4a')]=function(_0x42eabb,_0x438a8d,_0x41a6bc){var _0x389be1={};var _0x2a2b05={};var _0x1ff18c;var _0x4ae039;return db[_0x155f('0x2f')][_0x155f('0x4b')]({'where':{'id':_0x42eabb[_0x155f('0x45')]['id']}})[_0x155f('0x28')](handleEntityNotFound(_0x438a8d,null))[_0x155f('0x28')](function(_0x47d85d){if(_0x47d85d){_0x1ff18c=_0x47d85d;_0x2a2b05[_0x155f('0x34')]=_['keys'](db[_0x155f('0x4c')][_0x155f('0x30')]);_0x2a2b05[_0x155f('0x35')]=_[_0x155f('0x36')](_0x42eabb[_0x155f('0x35')]);_0x2a2b05[_0x155f('0x37')]=_['intersection'](_0x2a2b05[_0x155f('0x34')],_0x2a2b05[_0x155f('0x35')]);_0x389be1[_0x155f('0x3a')]=_[_0x155f('0x38')](_0x2a2b05[_0x155f('0x34')],qs[_0x155f('0x39')](_0x42eabb['query'][_0x155f('0x39')]));_0x389be1[_0x155f('0x3a')]=_0x389be1[_0x155f('0x3a')][_0x155f('0x4d')]?_0x389be1[_0x155f('0x3a')]:_0x2a2b05[_0x155f('0x34')];_0x389be1['order']=qs[_0x155f('0x3c')](_0x42eabb[_0x155f('0x35')][_0x155f('0x3c')]);_0x389be1[_0x155f('0x3d')]=qs['filters'](_[_0x155f('0x3e')](_0x42eabb[_0x155f('0x35')],_0x2a2b05[_0x155f('0x37')]));if(_0x42eabb[_0x155f('0x35')][_0x155f('0x3f')]){_0x389be1[_0x155f('0x3d')]=_[_0x155f('0x41')](_0x389be1[_0x155f('0x3d')],{'$or':_[_0x155f('0x2e')](_0x389be1['attributes'],function(_0x38f90a){var _0x2c23b1={};_0x2c23b1[_0x38f90a]={'$like':'%'+_0x42eabb[_0x155f('0x35')][_0x155f('0x3f')]+'%'};return _0x2c23b1;})});}_0x389be1=_[_0x155f('0x41')]({},_0x389be1,_0x42eabb[_0x155f('0x46')]);return _0x1ff18c['getConfigurations'](_0x389be1);}})[_0x155f('0x28')](function(_0x10bcbc){if(_0x10bcbc){_0x4ae039=_0x10bcbc[_0x155f('0x4d')];if(!_0x42eabb[_0x155f('0x35')][_0x155f('0x3b')](_0x155f('0x4e'))){_0x389be1[_0x155f('0x22')]=qs[_0x155f('0x22')](_0x42eabb[_0x155f('0x35')][_0x155f('0x22')]);_0x389be1[_0x155f('0x20')]=qs['offset'](_0x42eabb[_0x155f('0x35')][_0x155f('0x20')]);}return _0x1ff18c['getConfigurations'](_0x389be1);}})[_0x155f('0x28')](function(_0xc4d1a8){if(_0xc4d1a8){return _0xc4d1a8?{'count':_0x4ae039,'rows':_0xc4d1a8}:null;}})['then'](respondWithResult(_0x438a8d,null))['catch'](handleError(_0x438a8d,null));};exports[_0x155f('0x4f')]=function(_0x4182e1,_0x2a3312,_0x46cd52){if(_0x4182e1[_0x155f('0x49')]['id']){delete _0x4182e1['body']['id'];}return db[_0x155f('0x2f')][_0x155f('0x4b')]({'where':{'id':_0x4182e1['params']['id']}})[_0x155f('0x28')](handleEntityNotFound(_0x2a3312,null))[_0x155f('0x28')](function(_0x389cd1){if(_0x389cd1){_0x4182e1['body'][_0x155f('0x50')]=_0x389cd1['id'];_0x4182e1[_0x155f('0x49')]['Subjects']=integrations[_0x155f('0x51')](_0x4182e1[_0x155f('0x49')][_0x155f('0x52')],_0x4182e1[_0x155f('0x49')][_0x155f('0x32')]);_0x4182e1['body'][_0x155f('0x53')]=integrations[_0x155f('0x54')](_0x4182e1[_0x155f('0x49')][_0x155f('0x52')],_0x4182e1['body'][_0x155f('0x32')]);return db[_0x155f('0x4c')]['create'](_0x4182e1[_0x155f('0x49')],{'include':[{'model':db[_0x155f('0x55')],'as':'Subjects'},{'model':db[_0x155f('0x55')],'as':'Descriptions'}]});}return null;})[_0x155f('0x28')](respondWithResult(_0x2a3312,null))[_0x155f('0x44')](handleError(_0x2a3312,null));};exports[_0x155f('0x56')]=function(_0x415626,_0x1d7cfa,_0x289ed4){var _0x5ebb09='';return db[_0x155f('0x2f')][_0x155f('0x4b')]({'where':{'id':_0x415626[_0x155f('0x45')]['id']},'attributes':['id',_0x155f('0x57'),_0x155f('0x58')]})[_0x155f('0x28')](handleEntityNotFound(_0x1d7cfa,null))[_0x155f('0x28')](function(_0x135752){if(_0x135752){_0x5ebb09=_0x135752[_0x155f('0x57')];var _0x217301=_0x5ebb09['slice'](-0x1);if(_0x217301==='/'){_0x5ebb09=_0x5ebb09[_0x155f('0x59')](0x0,_0x5ebb09[_0x155f('0x5a')](_0x217301));}return rp({'method':_0x155f('0x5b'),'uri':util['format'](_0x155f('0x5c'),_0x5ebb09,_0x155f('0x5d')),'headers':{'Authorization':util['format'](_0x155f('0x5e'),new Buffer(util[_0x155f('0x5f')](_0x155f('0x60'),_0x135752['apiKey']))[_0x155f('0x61')]('base64'))},'json':!![]});}})[_0x155f('0x28')](function(_0xfd302f){if(_0xfd302f){var _0x4a0faf=[_0x155f('0x62'),'subject','agent',_0x155f('0x63'),_0x155f('0x1d'),_0x155f('0x64'),_0x155f('0x65'),_0x155f('0x66'),_0x155f('0x67'),_0x155f('0x65'),_0x155f('0x68')];_[_0x155f('0x69')](_0xfd302f,function(_0x3be629){return _0x4a0faf[_0x155f('0x6a')](_0x3be629[_0x155f('0x2b')])||!_0x3be629[_0x155f('0x6b')]&&_0x3be629[_0x155f('0x32')]!==_0x155f('0x6c')&&_0x3be629[_0x155f('0x32')]!==_0x155f('0x6d');});return{'count':_0xfd302f[_0x155f('0x4d')],'rows':_['map'](_0xfd302f,function(_0x1ad198){return{'id':_0x1ad198[_0x155f('0x2b')],'name':_0x1ad198[_0x155f('0x6e')],'custom':!_0x1ad198[_0x155f('0x6b')],'options':_0x1ad198[_0x155f('0x6f')]?_[_0x155f('0x2e')](_0x1ad198['choices'],function(_0x2e85ad){return{'name':_['capitalize'](_0x2e85ad),'value':_0x2e85ad};}):[]};})};}})[_0x155f('0x28')](respondWithResult(_0x1d7cfa,null))[_0x155f('0x44')](function(_0x25d6d4){var _0x4b95aa=_0x415626[_0x155f('0x35')][_0x155f('0x70')]?0x1f4:_0x25d6d4[_0x155f('0x71')]||0x1f4;logger['error'](_0x155f('0x72'),_0x155f('0x56'),_0x4b95aa,JSON[_0x155f('0x73')](_0x25d6d4));delete _0x25d6d4[_0x155f('0x2b')];if(_0x4b95aa===0x191){_0x4b95aa=0x190;}_0x1d7cfa[_0x155f('0x1d')](_0x4b95aa)[_0x155f('0x2c')](_0x415626['query'][_0x155f('0x70')]?{'message':_0x155f('0x74'),'statusCode':_0x25d6d4[_0x155f('0x71')]}:_0x25d6d4);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index d297d94..28f00ba 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 _0x7d54=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x30c91d,_0x1a8c6d){var _0x319942=function(_0x4cc72a){while(--_0x4cc72a){_0x30c91d['push'](_0x30c91d['shift']());}};_0x319942(++_0x1a8c6d);}(_0x7d54,0xe2));var _0x47d5=function(_0x498b38,_0x2d9583){_0x498b38=_0x498b38-0x0;var _0x10feb7=_0x7d54[_0x498b38];return _0x10feb7;};'use strict';var _=require(_0x47d5('0x0'));var util=require(_0x47d5('0x1'));var logger=require('../../config/logger')(_0x47d5('0x2'));var moment=require(_0x47d5('0x3'));var BPromise=require(_0x47d5('0x4'));var rp=require(_0x47d5('0x5'));var fs=require('fs');var path=require(_0x47d5('0x6'));var rimraf=require(_0x47d5('0x7'));var config=require(_0x47d5('0x8'));var attributes=require(_0x47d5('0x9'));var integrations=require(_0x47d5('0xa'));module[_0x47d5('0xb')]=function(_0x4193a6,_0x49fa30){return _0x4193a6[_0x47d5('0xc')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7bc=['exports','define','FreshdeskAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0xc7bc,0x1e3));var _0xcc7b=function(_0x205a22,_0x2f16da){_0x205a22=_0x205a22-0x0;var _0x2982a9=_0xc7bc[_0x205a22];return _0x2982a9;};'use strict';var _=require(_0xcc7b('0x0'));var util=require(_0xcc7b('0x1'));var logger=require(_0xcc7b('0x2'))('api');var moment=require(_0xcc7b('0x3'));var BPromise=require(_0xcc7b('0x4'));var rp=require(_0xcc7b('0x5'));var fs=require('fs');var path=require(_0xcc7b('0x6'));var rimraf=require(_0xcc7b('0x7'));var config=require(_0xcc7b('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xcc7b('0x9')]=function(_0x58a842,_0x450df9){return _0x58a842[_0xcc7b('0xa')](_0xcc7b('0xb'),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 de02ecc..bc4ed79 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 _0xe49a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetFreshdeskAccount','options','where','attributes','limit','include','map','model','stringify','FreshdeskAccount','find','raw','ShowFreshdeskAccount','util'];(function(_0x53e002,_0x51cc09){var _0x4207fd=function(_0x29e61d){while(--_0x29e61d){_0x53e002['push'](_0x53e002['shift']());}};_0x4207fd(++_0x51cc09);}(_0xe49a,0xd7));var _0xae49=function(_0x16c39e,_0x493d5f){_0x16c39e=_0x16c39e-0x0;var _0x1f114c=_0xe49a[_0x16c39e];return _0x1f114c;};'use strict';var _=require('lodash');var util=require(_0xae49('0x0'));var moment=require(_0xae49('0x1'));var BPromise=require(_0xae49('0x2'));var rs=require(_0xae49('0x3'));var fs=require('fs');var Redis=require(_0xae49('0x4'));var db=require(_0xae49('0x5'))['db'];var utils=require(_0xae49('0x6'));var logger=require('../../config/logger')(_0xae49('0x7'));var config=require(_0xae49('0x8'));var jayson=require(_0xae49('0x9'));var client=jayson['client'][_0xae49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49eecf,_0x63a8be,_0x1e33f6){return new BPromise(function(_0x4480bf,_0x476f2a){return client[_0xae49('0xb')](_0x49eecf,_0x1e33f6)[_0xae49('0xc')](function(_0x408685){logger['info'](_0xae49('0xd'),_0x63a8be,'request\x20sent');logger[_0xae49('0xe')](_0xae49('0xf'),_0x63a8be,_0xae49('0x10'),JSON['stringify'](_0x408685));if(_0x408685[_0xae49('0x11')]){if(_0x408685[_0xae49('0x11')][_0xae49('0x12')]===0x1f4){logger[_0xae49('0x11')](_0xae49('0xd'),_0x63a8be,_0x408685[_0xae49('0x11')]['message']);return _0x476f2a(_0x408685['error'][_0xae49('0x13')]);}logger[_0xae49('0x11')](_0xae49('0xd'),_0x63a8be,_0x408685[_0xae49('0x11')][_0xae49('0x13')]);return _0x4480bf(_0x408685[_0xae49('0x11')][_0xae49('0x13')]);}else{logger[_0xae49('0x14')](_0xae49('0xd'),_0x63a8be,_0xae49('0x10'));_0x4480bf(_0x408685[_0xae49('0x15')]['message']);}})[_0xae49('0x16')](function(_0x2d5dcb){logger[_0xae49('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x63a8be,_0x2d5dcb);_0x476f2a(_0x2d5dcb);});});}exports[_0xae49('0x17')]=function(_0x1ec3be){var _0x54bc9c=this;return new Promise(function(_0x290d8b,_0xb55a03){return db['FreshdeskAccount']['findAll']({'raw':_0x1ec3be[_0xae49('0x18')]?_0x1ec3be['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ec3be['options']?_0x1ec3be[_0xae49('0x18')][_0xae49('0x19')]||null:null,'attributes':_0x1ec3be['options']?_0x1ec3be[_0xae49('0x18')][_0xae49('0x1a')]||null:null,'limit':_0x1ec3be[_0xae49('0x18')]?_0x1ec3be[_0xae49('0x18')][_0xae49('0x1b')]||null:null,'include':_0x1ec3be['options']?_0x1ec3be[_0xae49('0x18')][_0xae49('0x1c')]?_[_0xae49('0x1d')](_0x1ec3be['options'][_0xae49('0x1c')],function(_0x5d3fcc){return{'model':db[_0x5d3fcc[_0xae49('0x1e')]],'as':_0x5d3fcc['as'],'attributes':_0x5d3fcc[_0xae49('0x1a')],'include':_0x5d3fcc[_0xae49('0x1c')]?_['map'](_0x5d3fcc[_0xae49('0x1c')],function(_0x38fdf4){return{'model':db[_0x38fdf4['model']],'as':_0x38fdf4['as'],'attributes':_0x38fdf4['attributes'],'include':_0x38fdf4['include']?_[_0xae49('0x1d')](_0x38fdf4[_0xae49('0x1c')],function(_0xd79a45){return{'model':db[_0xd79a45[_0xae49('0x1e')]],'as':_0xd79a45['as'],'attributes':_0xd79a45[_0xae49('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ec237){logger[_0xae49('0x14')](_0xae49('0x17'),_0x1ec3be);logger[_0xae49('0xe')](_0xae49('0x17'),_0x1ec3be,JSON[_0xae49('0x1f')](_0x3ec237));_0x290d8b(_0x3ec237);})[_0xae49('0x16')](function(_0xb47cdf){logger[_0xae49('0x11')](_0xae49('0x17'),_0xb47cdf[_0xae49('0x13')],_0x1ec3be);_0xb55a03(_0x54bc9c['error'](0x1f4,_0xb47cdf[_0xae49('0x13')]));});});};exports['ShowFreshdeskAccount']=function(_0x2ee37e){var _0x4eddfb=this;return new Promise(function(_0x338370,_0x31da17){return db[_0xae49('0x20')][_0xae49('0x21')]({'raw':_0x2ee37e[_0xae49('0x18')]?_0x2ee37e[_0xae49('0x18')][_0xae49('0x22')]===undefined?!![]:![]:!![],'where':_0x2ee37e['options']?_0x2ee37e[_0xae49('0x18')]['where']||null:null,'attributes':_0x2ee37e[_0xae49('0x18')]?_0x2ee37e['options'][_0xae49('0x1a')]||null:null,'include':_0x2ee37e['options']?_0x2ee37e[_0xae49('0x18')][_0xae49('0x1c')]?_[_0xae49('0x1d')](_0x2ee37e[_0xae49('0x18')][_0xae49('0x1c')],function(_0x2cff21){return{'model':db[_0x2cff21[_0xae49('0x1e')]],'as':_0x2cff21['as'],'attributes':_0x2cff21[_0xae49('0x1a')],'include':_0x2cff21[_0xae49('0x1c')]?_[_0xae49('0x1d')](_0x2cff21[_0xae49('0x1c')],function(_0x228491){return{'model':db[_0x228491['model']],'as':_0x228491['as'],'attributes':_0x228491[_0xae49('0x1a')],'include':_0x228491[_0xae49('0x1c')]?_[_0xae49('0x1d')](_0x228491[_0xae49('0x1c')],function(_0xe3a13e){return{'model':db[_0xe3a13e[_0xae49('0x1e')]],'as':_0xe3a13e['as'],'attributes':_0xe3a13e[_0xae49('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xae49('0xc')](function(_0x4135d7){logger[_0xae49('0x14')]('ShowFreshdeskAccount',_0x2ee37e);logger[_0xae49('0xe')]('ShowFreshdeskAccount',_0x2ee37e,JSON['stringify'](_0x4135d7));_0x338370(_0x4135d7);})[_0xae49('0x16')](function(_0x49b20f){logger['error'](_0xae49('0x23'),_0x49b20f[_0xae49('0x13')],_0x2ee37e);_0x31da17(_0x4eddfb['error'](0x1f4,_0x49b20f[_0xae49('0x13')]));});});}; \ No newline at end of file +var _0x3768=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','limit','map','model','attributes','include','find','ShowFreshdeskAccount','util','bluebird'];(function(_0x290417,_0x21dcfc){var _0x164d7c=function(_0x3071b7){while(--_0x3071b7){_0x290417['push'](_0x290417['shift']());}};_0x164d7c(++_0x21dcfc);}(_0x3768,0x10e));var _0x8376=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0x3768[_0x29df9a];return _0x3a8e96;};'use strict';var _=require('lodash');var util=require(_0x8376('0x0'));var moment=require('moment');var BPromise=require(_0x8376('0x1'));var rs=require(_0x8376('0x2'));var fs=require('fs');var Redis=require(_0x8376('0x3'));var db=require(_0x8376('0x4'))['db'];var utils=require(_0x8376('0x5'));var logger=require(_0x8376('0x6'))(_0x8376('0x7'));var config=require(_0x8376('0x8'));var jayson=require(_0x8376('0x9'));var client=jayson[_0x8376('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x444d08,_0x448f9a,_0x518c20){return new BPromise(function(_0x3b6ea2,_0x25bd06){return client[_0x8376('0xb')](_0x444d08,_0x518c20)[_0x8376('0xc')](function(_0x3ae4bb){logger[_0x8376('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x448f9a,_0x8376('0xe'));logger[_0x8376('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x448f9a,_0x8376('0xe'),JSON[_0x8376('0x10')](_0x3ae4bb));if(_0x3ae4bb[_0x8376('0x11')]){if(_0x3ae4bb['error']['code']===0x1f4){logger[_0x8376('0x11')](_0x8376('0x12'),_0x448f9a,_0x3ae4bb[_0x8376('0x11')][_0x8376('0x13')]);return _0x25bd06(_0x3ae4bb[_0x8376('0x11')][_0x8376('0x13')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x448f9a,_0x3ae4bb['error'][_0x8376('0x13')]);return _0x3b6ea2(_0x3ae4bb[_0x8376('0x11')]['message']);}else{logger[_0x8376('0xd')](_0x8376('0x12'),_0x448f9a,'request\x20sent');_0x3b6ea2(_0x3ae4bb[_0x8376('0x14')][_0x8376('0x13')]);}})[_0x8376('0x15')](function(_0x4cec0b){logger[_0x8376('0x11')](_0x8376('0x12'),_0x448f9a,_0x4cec0b);_0x25bd06(_0x4cec0b);});});}exports[_0x8376('0x16')]=function(_0x50c4d1){var _0x183c5c=this;return new Promise(function(_0x88a88,_0x1dbc64){return db[_0x8376('0x17')]['findAll']({'raw':_0x50c4d1[_0x8376('0x18')]?_0x50c4d1['options'][_0x8376('0x19')]===undefined?!![]:![]:!![],'where':_0x50c4d1[_0x8376('0x18')]?_0x50c4d1[_0x8376('0x18')][_0x8376('0x1a')]||null:null,'attributes':_0x50c4d1[_0x8376('0x18')]?_0x50c4d1[_0x8376('0x18')]['attributes']||null:null,'limit':_0x50c4d1[_0x8376('0x18')]?_0x50c4d1[_0x8376('0x18')][_0x8376('0x1b')]||null:null,'include':_0x50c4d1[_0x8376('0x18')]?_0x50c4d1[_0x8376('0x18')]['include']?_[_0x8376('0x1c')](_0x50c4d1[_0x8376('0x18')]['include'],function(_0x15cc83){return{'model':db[_0x15cc83[_0x8376('0x1d')]],'as':_0x15cc83['as'],'attributes':_0x15cc83[_0x8376('0x1e')],'include':_0x15cc83[_0x8376('0x1f')]?_['map'](_0x15cc83[_0x8376('0x1f')],function(_0x132554){return{'model':db[_0x132554['model']],'as':_0x132554['as'],'attributes':_0x132554['attributes'],'include':_0x132554[_0x8376('0x1f')]?_[_0x8376('0x1c')](_0x132554[_0x8376('0x1f')],function(_0x51eac7){return{'model':db[_0x51eac7[_0x8376('0x1d')]],'as':_0x51eac7['as'],'attributes':_0x51eac7[_0x8376('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8376('0xc')](function(_0x369539){logger[_0x8376('0xd')]('GetFreshdeskAccount',_0x50c4d1);logger[_0x8376('0xf')](_0x8376('0x16'),_0x50c4d1,JSON[_0x8376('0x10')](_0x369539));_0x88a88(_0x369539);})[_0x8376('0x15')](function(_0x2923af){logger[_0x8376('0x11')]('GetFreshdeskAccount',_0x2923af[_0x8376('0x13')],_0x50c4d1);_0x1dbc64(_0x183c5c['error'](0x1f4,_0x2923af['message']));});});};exports['ShowFreshdeskAccount']=function(_0x2ac4c3){var _0x709a51=this;return new Promise(function(_0x512b5a,_0x5ea1ad){return db[_0x8376('0x17')][_0x8376('0x20')]({'raw':_0x2ac4c3[_0x8376('0x18')]?_0x2ac4c3[_0x8376('0x18')][_0x8376('0x19')]===undefined?!![]:![]:!![],'where':_0x2ac4c3['options']?_0x2ac4c3[_0x8376('0x18')][_0x8376('0x1a')]||null:null,'attributes':_0x2ac4c3['options']?_0x2ac4c3[_0x8376('0x18')][_0x8376('0x1e')]||null:null,'include':_0x2ac4c3['options']?_0x2ac4c3[_0x8376('0x18')]['include']?_[_0x8376('0x1c')](_0x2ac4c3[_0x8376('0x18')][_0x8376('0x1f')],function(_0x5b39cf){return{'model':db[_0x5b39cf[_0x8376('0x1d')]],'as':_0x5b39cf['as'],'attributes':_0x5b39cf[_0x8376('0x1e')],'include':_0x5b39cf['include']?_[_0x8376('0x1c')](_0x5b39cf['include'],function(_0x4cc72c){return{'model':db[_0x4cc72c[_0x8376('0x1d')]],'as':_0x4cc72c['as'],'attributes':_0x4cc72c[_0x8376('0x1e')],'include':_0x4cc72c['include']?_[_0x8376('0x1c')](_0x4cc72c[_0x8376('0x1f')],function(_0x28ec9d){return{'model':db[_0x28ec9d[_0x8376('0x1d')]],'as':_0x28ec9d['as'],'attributes':_0x28ec9d[_0x8376('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8376('0xc')](function(_0x25219c){logger['info'](_0x8376('0x21'),_0x2ac4c3);logger[_0x8376('0xf')](_0x8376('0x21'),_0x2ac4c3,JSON['stringify'](_0x25219c));_0x512b5a(_0x25219c);})[_0x8376('0x15')](function(_0x311b7b){logger['error'](_0x8376('0x21'),_0x311b7b[_0x8376('0x13')],_0x2ac4c3);_0x5ea1ad(_0x709a51[_0x8376('0x11')](0x1f4,_0x311b7b[_0x8376('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index bf3dbbb..3423013 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 _0x344f=['exports','multer','util','path','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','setTags','put','destroy'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0x344f,0xb9));var _0xf344=function(_0xeb1bee,_0x51e5c7){_0xeb1bee=_0xeb1bee-0x0;var _0x5e4bbc=_0x344f[_0xeb1bee];return _0x5e4bbc;};'use strict';var multer=require(_0xf344('0x0'));var util=require(_0xf344('0x1'));var path=require(_0xf344('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf344('0x3'));var config=require(_0xf344('0x4'));var controller=require(_0xf344('0x5'));router[_0xf344('0x6')]('/',auth[_0xf344('0x7')](),controller[_0xf344('0x8')]);router[_0xf344('0x6')](_0xf344('0x9'),auth[_0xf344('0x7')](),controller[_0xf344('0xa')]);router[_0xf344('0x6')](_0xf344('0xb'),auth[_0xf344('0x7')](),controller[_0xf344('0xc')]);router[_0xf344('0x6')](_0xf344('0xd'),auth[_0xf344('0x7')](),controller[_0xf344('0xe')]);router[_0xf344('0x6')](_0xf344('0xf'),auth['isAuthenticated'](),controller[_0xf344('0x10')]);router[_0xf344('0x6')](_0xf344('0x11'),auth['isAuthenticated'](),controller['getTags']);router[_0xf344('0x12')]('/',auth[_0xf344('0x7')](),controller['create']);router[_0xf344('0x12')]('/:id/tags',auth[_0xf344('0x7')](),controller[_0xf344('0x13')]);router[_0xf344('0x14')](_0xf344('0x9'),auth[_0xf344('0x7')](),controller['update']);router['delete']('/:id',auth[_0xf344('0x7')](),controller[_0xf344('0x15')]);module[_0xf344('0x16')]=router; \ No newline at end of file +var _0x9272=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags','getTags','post','create','put','update','destroy','exports','multer','connect-timeout','fs-extra'];(function(_0x288269,_0x5e2d74){var _0x2a2ffa=function(_0x455f2c){while(--_0x455f2c){_0x288269['push'](_0x288269['shift']());}};_0x2a2ffa(++_0x5e2d74);}(_0x9272,0x123));var _0x2927=function(_0xc4a668,_0x445a94){_0xc4a668=_0xc4a668-0x0;var _0x5346b1=_0x9272[_0xc4a668];return _0x5346b1;};'use strict';var multer=require(_0x2927('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2927('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2927('0x2'));var auth=require(_0x2927('0x3'));var interaction=require(_0x2927('0x4'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x2927('0x5')]('/',auth[_0x2927('0x6')](),controller['index']);router[_0x2927('0x5')](_0x2927('0x7'),auth[_0x2927('0x6')](),controller[_0x2927('0x8')]);router['get'](_0x2927('0x9'),auth['isAuthenticated'](),controller[_0x2927('0xa')]);router[_0x2927('0x5')](_0x2927('0xb'),auth[_0x2927('0x6')](),controller['getSubjects']);router['get'](_0x2927('0xc'),auth[_0x2927('0x6')](),controller['getDescriptions']);router[_0x2927('0x5')](_0x2927('0xd'),auth[_0x2927('0x6')](),controller[_0x2927('0xe')]);router[_0x2927('0xf')]('/',auth[_0x2927('0x6')](),controller[_0x2927('0x10')]);router[_0x2927('0xf')]('/:id/tags',auth[_0x2927('0x6')](),controller['setTags']);router[_0x2927('0x11')](_0x2927('0x7'),auth['isAuthenticated'](),controller[_0x2927('0x12')]);router['delete'](_0x2927('0x7'),auth[_0x2927('0x6')](),controller[_0x2927('0x13')]);module[_0x2927('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 22f415f..a9a9c5d 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 _0x45da=['exports'];(function(_0x34bc2d,_0x1252fc){var _0x589d85=function(_0x3dc66b){while(--_0x3dc66b){_0x34bc2d['push'](_0x34bc2d['shift']());}};_0x589d85(++_0x1252fc);}(_0x45da,0x92));var _0xa45d=function(_0x221c04,_0x41fe21){_0x221c04=_0x221c04-0x0;var _0x3a1d21=_0x45da[_0x221c04];return _0x3a1d21;};'use strict';var Sequelize=require('sequelize');module[_0xa45d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9e6d=['STRING'];(function(_0x579f06,_0x52d8eb){var _0x25aeac=function(_0x9d31f5){while(--_0x9d31f5){_0x579f06['push'](_0x579f06['shift']());}};_0x25aeac(++_0x52d8eb);}(_0x9e6d,0x15d));var _0xd9e6=function(_0x155f12,_0x59d17c){_0x155f12=_0x155f12-0x0;var _0x1b071e=_0x9e6d[_0x155f12];return _0x1b071e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd9e6('0x0')]},'description':{'type':Sequelize[_0xd9e6('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b2a61a6..4d066e1 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 _0xd783=['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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','error','stack','name','send','index','map','FreshdeskConfiguration','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','rawAttributes','keys','create','body','update','find','params','destroy','getFields','findOne','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1af05b,_0x5134b5){var _0x5be7cc=function(_0x2d4ac0){while(--_0x2d4ac0){_0x1af05b['push'](_0x1af05b['shift']());}};_0x5be7cc(++_0x5134b5);}(_0xd783,0xa7));var _0x3d78=function(_0x250669,_0xb15e88){_0x250669=_0x250669-0x0;var _0x131447=_0xd783[_0x250669];return _0x131447;};'use strict';var emlformat=require(_0x3d78('0x0'));var rimraf=require(_0x3d78('0x1'));var zipdir=require(_0x3d78('0x2'));var jsonpatch=require(_0x3d78('0x3'));var rp=require(_0x3d78('0x4'));var moment=require(_0x3d78('0x5'));var BPromise=require(_0x3d78('0x6'));var Mustache=require(_0x3d78('0x7'));var util=require(_0x3d78('0x8'));var path=require(_0x3d78('0x9'));var sox=require(_0x3d78('0xa'));var csv=require(_0x3d78('0xb'));var ejs=require(_0x3d78('0xc'));var fs=require('fs');var fs_extra=require(_0x3d78('0xd'));var _=require(_0x3d78('0xe'));var squel=require(_0x3d78('0xf'));var crypto=require(_0x3d78('0x10'));var jsforce=require(_0x3d78('0x11'));var deskjs=require(_0x3d78('0x12'));var toCsv=require(_0x3d78('0xb'));var querystring=require(_0x3d78('0x13'));var Papa=require(_0x3d78('0x14'));var Redis=require(_0x3d78('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x3d78('0x16'));var as=require(_0x3d78('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3d78('0x18'));var utils=require(_0x3d78('0x19'));var config=require(_0x3d78('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x3d78('0x1b'))['db'];function respondWithStatusCode(_0x1f39bc,_0x38a2b5){_0x38a2b5=_0x38a2b5||0xcc;return function(_0x5b261b){if(_0x5b261b){return _0x1f39bc[_0x3d78('0x1c')](_0x38a2b5);}return _0x1f39bc['status'](_0x38a2b5)[_0x3d78('0x1d')]();};}function respondWithResult(_0x559c1a,_0xdaa48){_0xdaa48=_0xdaa48||0xc8;return function(_0xd515b0){if(_0xd515b0){return _0x559c1a[_0x3d78('0x1e')](_0xdaa48)[_0x3d78('0x1f')](_0xd515b0);}};}function respondWithFilteredResult(_0x156799,_0x1a55ad){return function(_0x48af75){if(_0x48af75){var _0x3c8b64=typeof _0x1a55ad[_0x3d78('0x20')]===_0x3d78('0x21')&&typeof _0x1a55ad[_0x3d78('0x22')]===_0x3d78('0x21');var _0x1dbd9d=_0x48af75[_0x3d78('0x23')];var _0x358ea2=_0x3c8b64?0x0:_0x1a55ad[_0x3d78('0x20')];var _0x359e8c=_0x3c8b64?_0x48af75['count']:_0x1a55ad[_0x3d78('0x20')]+_0x1a55ad[_0x3d78('0x22')];var _0x32dd0e;if(_0x359e8c>=_0x1dbd9d){_0x359e8c=_0x1dbd9d;_0x32dd0e=0xc8;}else{_0x32dd0e=0xce;}_0x156799[_0x3d78('0x1e')](_0x32dd0e);return _0x156799[_0x3d78('0x24')](_0x3d78('0x25'),_0x358ea2+'-'+_0x359e8c+'/'+_0x1dbd9d)[_0x3d78('0x1f')](_0x48af75);}return null;};}function patchUpdates(_0x14cdbe){return function(_0x30222b){try{jsonpatch['apply'](_0x30222b,_0x14cdbe,!![]);}catch(_0x26777a){return BPromise[_0x3d78('0x26')](_0x26777a);}return _0x30222b['save']();};}function saveUpdates(_0x451956,_0x305e37){return function(_0x3478f7){if(_0x3478f7){return _0x3478f7['update'](_0x451956)[_0x3d78('0x27')](function(_0x358083){return _0x358083;});}return null;};}function removeEntity(_0xf225ad,_0x57e791){return function(_0x3af644){if(_0x3af644){return _0x3af644['destroy']()[_0x3d78('0x27')](function(){_0xf225ad[_0x3d78('0x1e')](0xcc)[_0x3d78('0x1d')]();});}};}function handleEntityNotFound(_0x575779,_0x1cd869){return function(_0x1a7618){if(!_0x1a7618){_0x575779[_0x3d78('0x1c')](0x194);}return _0x1a7618;};}function handleError(_0x4e3b9c,_0x30bebe){_0x30bebe=_0x30bebe||0x1f4;return function(_0x2572ad){logger[_0x3d78('0x28')](_0x2572ad[_0x3d78('0x29')]);if(_0x2572ad[_0x3d78('0x2a')]){delete _0x2572ad[_0x3d78('0x2a')];}_0x4e3b9c[_0x3d78('0x1e')](_0x30bebe)[_0x3d78('0x2b')](_0x2572ad);};}exports[_0x3d78('0x2c')]=function(_0x1fde32,_0x4fb3a5){var _0x5c79d6={},_0x25a310={},_0x21debc={'count':0x0,'rows':[]};var _0x5deef4=_[_0x3d78('0x2d')](db[_0x3d78('0x2e')]['rawAttributes'],function(_0x216eb8){return{'name':_0x216eb8[_0x3d78('0x2f')],'type':_0x216eb8['type']['key']};});_0x25a310[_0x3d78('0x30')]=_[_0x3d78('0x2d')](_0x5deef4,_0x3d78('0x2a'));_0x25a310[_0x3d78('0x31')]=_['keys'](_0x1fde32[_0x3d78('0x31')]);_0x25a310[_0x3d78('0x32')]=_['intersection'](_0x25a310[_0x3d78('0x30')],_0x25a310[_0x3d78('0x31')]);_0x5c79d6[_0x3d78('0x33')]=_[_0x3d78('0x34')](_0x25a310[_0x3d78('0x30')],qs['fields'](_0x1fde32[_0x3d78('0x31')][_0x3d78('0x35')]));_0x5c79d6[_0x3d78('0x33')]=_0x5c79d6[_0x3d78('0x33')][_0x3d78('0x36')]?_0x5c79d6[_0x3d78('0x33')]:_0x25a310[_0x3d78('0x30')];if(!_0x1fde32[_0x3d78('0x31')][_0x3d78('0x37')](_0x3d78('0x38'))){_0x5c79d6[_0x3d78('0x22')]=qs['limit'](_0x1fde32[_0x3d78('0x31')][_0x3d78('0x22')]);_0x5c79d6['offset']=qs[_0x3d78('0x20')](_0x1fde32['query'][_0x3d78('0x20')]);}_0x5c79d6[_0x3d78('0x39')]=qs[_0x3d78('0x3a')](_0x1fde32[_0x3d78('0x31')][_0x3d78('0x3a')]);_0x5c79d6[_0x3d78('0x3b')]=qs[_0x3d78('0x32')](_[_0x3d78('0x3c')](_0x1fde32[_0x3d78('0x31')],_0x25a310[_0x3d78('0x32')]),_0x5deef4);if(_0x1fde32['query'][_0x3d78('0x3d')]){_0x5c79d6[_0x3d78('0x3b')]=_[_0x3d78('0x3e')](_0x5c79d6['where'],{'$or':_[_0x3d78('0x2d')](_0x5deef4,function(_0x27663d){if(_0x27663d[_0x3d78('0x3f')]!=='VIRTUAL'){var _0x13510b={};_0x13510b[_0x27663d[_0x3d78('0x2a')]]={'$like':'%'+_0x1fde32['query'][_0x3d78('0x3d')]+'%'};return _0x13510b;}})});}_0x5c79d6=_[_0x3d78('0x3e')]({},_0x5c79d6,_0x1fde32[_0x3d78('0x40')]);var _0xe9a9ba={'where':_0x5c79d6['where']};return db[_0x3d78('0x2e')][_0x3d78('0x23')](_0xe9a9ba)[_0x3d78('0x27')](function(_0x4657ec){_0x21debc[_0x3d78('0x23')]=_0x4657ec;if(_0x1fde32[_0x3d78('0x31')][_0x3d78('0x41')]){_0x5c79d6[_0x3d78('0x42')]=[{'all':!![]}];}return db[_0x3d78('0x2e')][_0x3d78('0x43')](_0x5c79d6);})[_0x3d78('0x27')](function(_0xc81471){_0x21debc[_0x3d78('0x44')]=_0xc81471;return _0x21debc;})[_0x3d78('0x27')](respondWithFilteredResult(_0x4fb3a5,_0x5c79d6))[_0x3d78('0x45')](handleError(_0x4fb3a5,null));};exports['show']=function(_0x7007f1,_0x5505c6){var _0x470d5f={'raw':![],'where':{'id':_0x7007f1['params']['id']}},_0x3f0bcd={};_0x3f0bcd[_0x3d78('0x30')]=_['keys'](db[_0x3d78('0x2e')][_0x3d78('0x46')]);_0x3f0bcd[_0x3d78('0x31')]=_[_0x3d78('0x47')](_0x7007f1[_0x3d78('0x31')]);_0x3f0bcd[_0x3d78('0x32')]=_[_0x3d78('0x34')](_0x3f0bcd[_0x3d78('0x30')],_0x3f0bcd['query']);_0x470d5f[_0x3d78('0x33')]=_[_0x3d78('0x34')](_0x3f0bcd[_0x3d78('0x30')],qs[_0x3d78('0x35')](_0x7007f1[_0x3d78('0x31')][_0x3d78('0x35')]));_0x470d5f[_0x3d78('0x33')]=_0x470d5f['attributes'][_0x3d78('0x36')]?_0x470d5f[_0x3d78('0x33')]:_0x3f0bcd[_0x3d78('0x30')];if(_0x7007f1[_0x3d78('0x31')][_0x3d78('0x41')]){_0x470d5f['include']=[{'all':!![]}];}_0x470d5f=_[_0x3d78('0x3e')]({},_0x470d5f,_0x7007f1[_0x3d78('0x40')]);return db[_0x3d78('0x2e')]['find'](_0x470d5f)[_0x3d78('0x27')](handleEntityNotFound(_0x5505c6,null))['then'](respondWithResult(_0x5505c6,null))[_0x3d78('0x45')](handleError(_0x5505c6,null));};exports[_0x3d78('0x48')]=function(_0x324fe6,_0x5a2243){return db[_0x3d78('0x2e')][_0x3d78('0x48')](_0x324fe6[_0x3d78('0x49')],{})[_0x3d78('0x27')](respondWithResult(_0x5a2243,0xc9))[_0x3d78('0x45')](handleError(_0x5a2243,null));};exports[_0x3d78('0x4a')]=function(_0x374704,_0x1b7b7c){if(_0x374704[_0x3d78('0x49')]['id']){delete _0x374704[_0x3d78('0x49')]['id'];}return db[_0x3d78('0x2e')][_0x3d78('0x4b')]({'where':{'id':_0x374704[_0x3d78('0x4c')]['id']}})[_0x3d78('0x27')](handleEntityNotFound(_0x1b7b7c,null))['then'](saveUpdates(_0x374704[_0x3d78('0x49')],null))[_0x3d78('0x27')](respondWithResult(_0x1b7b7c,null))[_0x3d78('0x45')](handleError(_0x1b7b7c,null));};exports[_0x3d78('0x4d')]=function(_0x5cf11a,_0x569460){return db[_0x3d78('0x2e')][_0x3d78('0x4b')]({'where':{'id':_0x5cf11a['params']['id']}})['then'](handleEntityNotFound(_0x569460,null))[_0x3d78('0x27')](removeEntity(_0x569460,null))[_0x3d78('0x45')](handleError(_0x569460,null));};exports[_0x3d78('0x4e')]=function(_0x215087,_0x20bcac,_0x219fda){var _0x4db021={};var _0x325354={};var _0x4acce9;var _0x4232f3;return db[_0x3d78('0x2e')][_0x3d78('0x4f')]({'where':{'id':_0x215087['params']['id']}})[_0x3d78('0x27')](handleEntityNotFound(_0x20bcac,null))[_0x3d78('0x27')](function(_0x1fc75a){if(_0x1fc75a){_0x4acce9=_0x1fc75a;_0x325354['model']=_[_0x3d78('0x47')](db['FreshdeskField']['rawAttributes']);_0x325354[_0x3d78('0x31')]=_[_0x3d78('0x47')](_0x215087['query']);_0x325354['filters']=_[_0x3d78('0x34')](_0x325354[_0x3d78('0x30')],_0x325354[_0x3d78('0x31')]);_0x4db021['attributes']=_['intersection'](_0x325354[_0x3d78('0x30')],qs[_0x3d78('0x35')](_0x215087['query'][_0x3d78('0x35')]));_0x4db021[_0x3d78('0x33')]=_0x4db021['attributes'][_0x3d78('0x36')]?_0x4db021[_0x3d78('0x33')]:_0x325354[_0x3d78('0x30')];_0x4db021[_0x3d78('0x39')]=qs[_0x3d78('0x3a')](_0x215087['query'][_0x3d78('0x3a')]);_0x4db021[_0x3d78('0x3b')]=qs[_0x3d78('0x32')](_[_0x3d78('0x3c')](_0x215087[_0x3d78('0x31')],_0x325354[_0x3d78('0x32')]));if(_0x215087[_0x3d78('0x31')][_0x3d78('0x3d')]){_0x4db021[_0x3d78('0x3b')]=_[_0x3d78('0x3e')](_0x4db021[_0x3d78('0x3b')],{'$or':_[_0x3d78('0x2d')](_0x4db021['attributes'],function(_0x262d65){var _0x3675b3={};_0x3675b3[_0x262d65]={'$like':'%'+_0x215087[_0x3d78('0x31')][_0x3d78('0x3d')]+'%'};return _0x3675b3;})});}_0x4db021=_[_0x3d78('0x3e')]({},_0x4db021,_0x215087[_0x3d78('0x40')]);return _0x4acce9[_0x3d78('0x4e')](_0x4db021);}})[_0x3d78('0x27')](function(_0xde94f0){if(_0xde94f0){_0x4232f3=_0xde94f0['length'];if(!_0x215087[_0x3d78('0x31')][_0x3d78('0x37')]('nolimit')){_0x4db021['limit']=qs[_0x3d78('0x22')](_0x215087[_0x3d78('0x31')][_0x3d78('0x22')]);_0x4db021[_0x3d78('0x20')]=qs[_0x3d78('0x20')](_0x215087[_0x3d78('0x31')]['offset']);}return _0x4acce9[_0x3d78('0x4e')](_0x4db021);}})['then'](function(_0xe83c45){if(_0xe83c45){return _0xe83c45?{'count':_0x4232f3,'rows':_0xe83c45}:null;}})['then'](respondWithResult(_0x20bcac,null))['catch'](handleError(_0x20bcac,null));};exports[_0x3d78('0x50')]=function(_0x54d8fe,_0x5c6d80,_0x239cff){var _0xb44177={};var _0x55b344={};var _0x55fdc6;var _0x59565b;return db[_0x3d78('0x2e')]['findOne']({'where':{'id':_0x54d8fe[_0x3d78('0x4c')]['id']}})[_0x3d78('0x27')](handleEntityNotFound(_0x5c6d80,null))[_0x3d78('0x27')](function(_0x196971){if(_0x196971){_0x55fdc6=_0x196971;_0x55b344['model']=_[_0x3d78('0x47')](db[_0x3d78('0x51')][_0x3d78('0x46')]);_0x55b344[_0x3d78('0x31')]=_['keys'](_0x54d8fe['query']);_0x55b344[_0x3d78('0x32')]=_[_0x3d78('0x34')](_0x55b344[_0x3d78('0x30')],_0x55b344['query']);_0xb44177[_0x3d78('0x33')]=_[_0x3d78('0x34')](_0x55b344[_0x3d78('0x30')],qs[_0x3d78('0x35')](_0x54d8fe['query'][_0x3d78('0x35')]));_0xb44177['attributes']=_0xb44177['attributes'][_0x3d78('0x36')]?_0xb44177[_0x3d78('0x33')]:_0x55b344[_0x3d78('0x30')];_0xb44177[_0x3d78('0x39')]=qs[_0x3d78('0x3a')](_0x54d8fe[_0x3d78('0x31')][_0x3d78('0x3a')]);_0xb44177['where']=qs[_0x3d78('0x32')](_[_0x3d78('0x3c')](_0x54d8fe[_0x3d78('0x31')],_0x55b344[_0x3d78('0x32')]));if(_0x54d8fe[_0x3d78('0x31')][_0x3d78('0x3d')]){_0xb44177[_0x3d78('0x3b')]=_[_0x3d78('0x3e')](_0xb44177[_0x3d78('0x3b')],{'$or':_[_0x3d78('0x2d')](_0xb44177[_0x3d78('0x33')],function(_0x17149f){var _0x184342={};_0x184342[_0x17149f]={'$like':'%'+_0x54d8fe[_0x3d78('0x31')][_0x3d78('0x3d')]+'%'};return _0x184342;})});}_0xb44177=_[_0x3d78('0x3e')]({},_0xb44177,_0x54d8fe[_0x3d78('0x40')]);return _0x55fdc6[_0x3d78('0x50')](_0xb44177);}})[_0x3d78('0x27')](function(_0x4b8941){if(_0x4b8941){_0x59565b=_0x4b8941[_0x3d78('0x36')];if(!_0x54d8fe[_0x3d78('0x31')][_0x3d78('0x37')](_0x3d78('0x38'))){_0xb44177[_0x3d78('0x22')]=qs['limit'](_0x54d8fe[_0x3d78('0x31')][_0x3d78('0x22')]);_0xb44177['offset']=qs[_0x3d78('0x20')](_0x54d8fe['query'][_0x3d78('0x20')]);}return _0x55fdc6[_0x3d78('0x50')](_0xb44177);}})[_0x3d78('0x27')](function(_0x44dcea){if(_0x44dcea){return _0x44dcea?{'count':_0x59565b,'rows':_0x44dcea}:null;}})[_0x3d78('0x27')](respondWithResult(_0x5c6d80,null))[_0x3d78('0x45')](handleError(_0x5c6d80,null));};exports['getDescriptions']=function(_0xd08037,_0x3d5381,_0x1fa986){var _0x43e7e0={};var _0x63beaf={};var _0x2897ef;var _0x2e8b8f;return db['FreshdeskConfiguration'][_0x3d78('0x4f')]({'where':{'id':_0xd08037[_0x3d78('0x4c')]['id']}})[_0x3d78('0x27')](handleEntityNotFound(_0x3d5381,null))[_0x3d78('0x27')](function(_0x5e87b3){if(_0x5e87b3){_0x2897ef=_0x5e87b3;_0x63beaf[_0x3d78('0x30')]=_[_0x3d78('0x47')](db[_0x3d78('0x51')][_0x3d78('0x46')]);_0x63beaf[_0x3d78('0x31')]=_['keys'](_0xd08037[_0x3d78('0x31')]);_0x63beaf[_0x3d78('0x32')]=_['intersection'](_0x63beaf['model'],_0x63beaf[_0x3d78('0x31')]);_0x43e7e0[_0x3d78('0x33')]=_[_0x3d78('0x34')](_0x63beaf[_0x3d78('0x30')],qs[_0x3d78('0x35')](_0xd08037[_0x3d78('0x31')][_0x3d78('0x35')]));_0x43e7e0['attributes']=_0x43e7e0[_0x3d78('0x33')][_0x3d78('0x36')]?_0x43e7e0[_0x3d78('0x33')]:_0x63beaf[_0x3d78('0x30')];_0x43e7e0['order']=qs[_0x3d78('0x3a')](_0xd08037['query'][_0x3d78('0x3a')]);_0x43e7e0['where']=qs[_0x3d78('0x32')](_[_0x3d78('0x3c')](_0xd08037[_0x3d78('0x31')],_0x63beaf['filters']));if(_0xd08037['query']['filter']){_0x43e7e0['where']=_['merge'](_0x43e7e0['where'],{'$or':_[_0x3d78('0x2d')](_0x43e7e0[_0x3d78('0x33')],function(_0x212dac){var _0x588d39={};_0x588d39[_0x212dac]={'$like':'%'+_0xd08037['query'][_0x3d78('0x3d')]+'%'};return _0x588d39;})});}_0x43e7e0=_[_0x3d78('0x3e')]({},_0x43e7e0,_0xd08037[_0x3d78('0x40')]);return _0x2897ef[_0x3d78('0x52')](_0x43e7e0);}})[_0x3d78('0x27')](function(_0xf4e7f3){if(_0xf4e7f3){_0x2e8b8f=_0xf4e7f3[_0x3d78('0x36')];if(!_0xd08037[_0x3d78('0x31')][_0x3d78('0x37')]('nolimit')){_0x43e7e0[_0x3d78('0x22')]=qs[_0x3d78('0x22')](_0xd08037[_0x3d78('0x31')]['limit']);_0x43e7e0[_0x3d78('0x20')]=qs[_0x3d78('0x20')](_0xd08037[_0x3d78('0x31')][_0x3d78('0x20')]);}return _0x2897ef['getDescriptions'](_0x43e7e0);}})[_0x3d78('0x27')](function(_0xb9bc75){if(_0xb9bc75){return _0xb9bc75?{'count':_0x2e8b8f,'rows':_0xb9bc75}:null;}})['then'](respondWithResult(_0x3d5381,null))[_0x3d78('0x45')](handleError(_0x3d5381,null));};exports[_0x3d78('0x53')]=function(_0x26dea1,_0x22e6b8,_0x4273a9){var _0x8a4e6f={};var _0x765a5f={};var _0x2a9f0;var _0x4f4f09;return db[_0x3d78('0x2e')][_0x3d78('0x4f')]({'where':{'id':_0x26dea1['params']['id']}})[_0x3d78('0x27')](handleEntityNotFound(_0x22e6b8,null))[_0x3d78('0x27')](function(_0xc25875){if(_0xc25875){_0x2a9f0=_0xc25875;_0x765a5f[_0x3d78('0x30')]=_[_0x3d78('0x47')](db[_0x3d78('0x54')][_0x3d78('0x46')]);_0x765a5f['query']=_['keys'](_0x26dea1['query']);_0x765a5f[_0x3d78('0x32')]=_[_0x3d78('0x34')](_0x765a5f[_0x3d78('0x30')],_0x765a5f['query']);_0x8a4e6f[_0x3d78('0x33')]=_[_0x3d78('0x34')](_0x765a5f['model'],qs['fields'](_0x26dea1[_0x3d78('0x31')][_0x3d78('0x35')]));_0x8a4e6f[_0x3d78('0x33')]=_0x8a4e6f[_0x3d78('0x33')]['length']?_0x8a4e6f[_0x3d78('0x33')]:_0x765a5f[_0x3d78('0x30')];_0x8a4e6f[_0x3d78('0x39')]=qs[_0x3d78('0x3a')](_0x26dea1[_0x3d78('0x31')][_0x3d78('0x3a')]);_0x8a4e6f['where']=qs[_0x3d78('0x32')](_[_0x3d78('0x3c')](_0x26dea1['query'],_0x765a5f[_0x3d78('0x32')]));if(_0x26dea1[_0x3d78('0x31')][_0x3d78('0x3d')]){_0x8a4e6f[_0x3d78('0x3b')]=_[_0x3d78('0x3e')](_0x8a4e6f[_0x3d78('0x3b')],{'$or':_['map'](_0x8a4e6f[_0x3d78('0x33')],function(_0x20b6a1){var _0x3a27b2={};_0x3a27b2[_0x20b6a1]={'$like':'%'+_0x26dea1[_0x3d78('0x31')][_0x3d78('0x3d')]+'%'};return _0x3a27b2;})});}_0x8a4e6f=_[_0x3d78('0x3e')]({},_0x8a4e6f,_0x26dea1[_0x3d78('0x40')]);return _0x2a9f0[_0x3d78('0x53')](_0x8a4e6f);}})[_0x3d78('0x27')](function(_0xe76ecd){if(_0xe76ecd){_0x4f4f09=_0xe76ecd[_0x3d78('0x36')];if(!_0x26dea1[_0x3d78('0x31')][_0x3d78('0x37')]('nolimit')){_0x8a4e6f[_0x3d78('0x22')]=qs[_0x3d78('0x22')](_0x26dea1[_0x3d78('0x31')][_0x3d78('0x22')]);_0x8a4e6f['offset']=qs['offset'](_0x26dea1[_0x3d78('0x31')][_0x3d78('0x20')]);}return _0x2a9f0[_0x3d78('0x53')](_0x8a4e6f);}})[_0x3d78('0x27')](function(_0x50aafb){if(_0x50aafb){return _0x50aafb?{'count':_0x4f4f09,'rows':_0x50aafb}:null;}})[_0x3d78('0x27')](respondWithResult(_0x22e6b8,null))[_0x3d78('0x45')](handleError(_0x22e6b8,null));};exports[_0x3d78('0x55')]=function(_0x294b00,_0x2bded2,_0x4a0cf1){if(_0x294b00[_0x3d78('0x49')]['id']){delete _0x294b00[_0x3d78('0x49')]['id'];}return db[_0x3d78('0x2e')][_0x3d78('0x4f')]({'where':{'id':_0x294b00[_0x3d78('0x4c')]['id']}})[_0x3d78('0x27')](handleEntityNotFound(_0x2bded2,null))['then'](function(_0x544170){if(_0x544170){return _0x544170[_0x3d78('0x55')](_0x294b00[_0x3d78('0x49')]['ids']||[]);}return null;})[_0x3d78('0x27')](respondWithResult(_0x2bded2,null))[_0x3d78('0x45')](handleError(_0x2bded2,null));}; \ No newline at end of file +var _0x90cc=['type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','FreshdeskConfiguration','includeAll','findAll','rows','params','length','include','find','catch','create','body','destroy','getFields','findOne','filter','getSubjects','FreshdeskField','order','getDescriptions','pick','getTags','Tag','setTags','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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','sendStatus','status','end','offset','limit','undefined','count','json','reject','update','then','error','stack','name','index','map','rawAttributes','fieldName'];(function(_0x8e2d4d,_0x310930){var _0x5e3047=function(_0x4665e4){while(--_0x4665e4){_0x8e2d4d['push'](_0x8e2d4d['shift']());}};_0x5e3047(++_0x310930);}(_0x90cc,0x11a));var _0xc90c=function(_0x10d395,_0xb05d46){_0x10d395=_0x10d395-0x0;var _0x2f6438=_0x90cc[_0x10d395];return _0x2f6438;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc90c('0x0'));var rp=require(_0xc90c('0x1'));var moment=require(_0xc90c('0x2'));var BPromise=require(_0xc90c('0x3'));var Mustache=require(_0xc90c('0x4'));var util=require(_0xc90c('0x5'));var path=require('path');var sox=require(_0xc90c('0x6'));var csv=require(_0xc90c('0x7'));var ejs=require(_0xc90c('0x8'));var fs=require('fs');var fs_extra=require(_0xc90c('0x9'));var _=require('lodash');var squel=require(_0xc90c('0xa'));var crypto=require(_0xc90c('0xb'));var jsforce=require(_0xc90c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc90c('0x7'));var querystring=require(_0xc90c('0xd'));var Papa=require(_0xc90c('0xe'));var Redis=require(_0xc90c('0xf'));var authService=require(_0xc90c('0x10'));var qs=require(_0xc90c('0x11'));var as=require(_0xc90c('0x12'));var hardwareService=require(_0xc90c('0x13'));var logger=require(_0xc90c('0x14'))(_0xc90c('0x15'));var utils=require(_0xc90c('0x16'));var config=require(_0xc90c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e60a3,_0x50e78e){_0x50e78e=_0x50e78e||0xcc;return function(_0x3685bf){if(_0x3685bf){return _0x3e60a3[_0xc90c('0x18')](_0x50e78e);}return _0x3e60a3[_0xc90c('0x19')](_0x50e78e)[_0xc90c('0x1a')]();};}function respondWithResult(_0x2d3a52,_0x116f6b){_0x116f6b=_0x116f6b||0xc8;return function(_0x2f9db0){if(_0x2f9db0){return _0x2d3a52[_0xc90c('0x19')](_0x116f6b)['json'](_0x2f9db0);}};}function respondWithFilteredResult(_0x4171e1,_0xfbd1f5){return function(_0x4316c5){if(_0x4316c5){var _0x4d5324=typeof _0xfbd1f5[_0xc90c('0x1b')]==='undefined'&&typeof _0xfbd1f5[_0xc90c('0x1c')]===_0xc90c('0x1d');var _0xa2d167=_0x4316c5[_0xc90c('0x1e')];var _0x7d3469=_0x4d5324?0x0:_0xfbd1f5[_0xc90c('0x1b')];var _0x29707c=_0x4d5324?_0x4316c5[_0xc90c('0x1e')]:_0xfbd1f5[_0xc90c('0x1b')]+_0xfbd1f5[_0xc90c('0x1c')];var _0x59e4a4;if(_0x29707c>=_0xa2d167){_0x29707c=_0xa2d167;_0x59e4a4=0xc8;}else{_0x59e4a4=0xce;}_0x4171e1[_0xc90c('0x19')](_0x59e4a4);return _0x4171e1['set']('Content-Range',_0x7d3469+'-'+_0x29707c+'/'+_0xa2d167)[_0xc90c('0x1f')](_0x4316c5);}return null;};}function patchUpdates(_0x12b58c){return function(_0x3eaeda){try{jsonpatch['apply'](_0x3eaeda,_0x12b58c,!![]);}catch(_0x3f9ab2){return BPromise[_0xc90c('0x20')](_0x3f9ab2);}return _0x3eaeda['save']();};}function saveUpdates(_0x35afc6,_0x3e36d6){return function(_0x57d97b){if(_0x57d97b){return _0x57d97b[_0xc90c('0x21')](_0x35afc6)[_0xc90c('0x22')](function(_0x3c8e19){return _0x3c8e19;});}return null;};}function removeEntity(_0x358103,_0x78cc98){return function(_0x4cf0b7){if(_0x4cf0b7){return _0x4cf0b7['destroy']()[_0xc90c('0x22')](function(){_0x358103[_0xc90c('0x19')](0xcc)[_0xc90c('0x1a')]();});}};}function handleEntityNotFound(_0x2c3493,_0x5f1957){return function(_0x387743){if(!_0x387743){_0x2c3493[_0xc90c('0x18')](0x194);}return _0x387743;};}function handleError(_0x175ead,_0x2be5a0){_0x2be5a0=_0x2be5a0||0x1f4;return function(_0x320195){logger[_0xc90c('0x23')](_0x320195[_0xc90c('0x24')]);if(_0x320195[_0xc90c('0x25')]){delete _0x320195['name'];}_0x175ead[_0xc90c('0x19')](_0x2be5a0)['send'](_0x320195);};}exports[_0xc90c('0x26')]=function(_0x2858ac,_0x4c4ac5){var _0x165a53={},_0x39068a={},_0x438ef3={'count':0x0,'rows':[]};var _0xc91600=_[_0xc90c('0x27')](db['FreshdeskConfiguration'][_0xc90c('0x28')],function(_0x21c6f4){return{'name':_0x21c6f4[_0xc90c('0x29')],'type':_0x21c6f4[_0xc90c('0x2a')][_0xc90c('0x2b')]};});_0x39068a['model']=_['map'](_0xc91600,'name');_0x39068a[_0xc90c('0x2c')]=_[_0xc90c('0x2d')](_0x2858ac[_0xc90c('0x2c')]);_0x39068a[_0xc90c('0x2e')]=_[_0xc90c('0x2f')](_0x39068a[_0xc90c('0x30')],_0x39068a[_0xc90c('0x2c')]);_0x165a53[_0xc90c('0x31')]=_['intersection'](_0x39068a['model'],qs['fields'](_0x2858ac[_0xc90c('0x2c')][_0xc90c('0x32')]));_0x165a53['attributes']=_0x165a53[_0xc90c('0x31')]['length']?_0x165a53[_0xc90c('0x31')]:_0x39068a[_0xc90c('0x30')];if(!_0x2858ac[_0xc90c('0x2c')][_0xc90c('0x33')](_0xc90c('0x34'))){_0x165a53['limit']=qs[_0xc90c('0x1c')](_0x2858ac[_0xc90c('0x2c')][_0xc90c('0x1c')]);_0x165a53[_0xc90c('0x1b')]=qs[_0xc90c('0x1b')](_0x2858ac[_0xc90c('0x2c')]['offset']);}_0x165a53['order']=qs[_0xc90c('0x35')](_0x2858ac[_0xc90c('0x2c')][_0xc90c('0x35')]);_0x165a53[_0xc90c('0x36')]=qs[_0xc90c('0x2e')](_['pick'](_0x2858ac['query'],_0x39068a[_0xc90c('0x2e')]),_0xc91600);if(_0x2858ac[_0xc90c('0x2c')]['filter']){_0x165a53[_0xc90c('0x36')]=_[_0xc90c('0x37')](_0x165a53[_0xc90c('0x36')],{'$or':_[_0xc90c('0x27')](_0xc91600,function(_0x9c300b){if(_0x9c300b[_0xc90c('0x2a')]!==_0xc90c('0x38')){var _0xb1e1cb={};_0xb1e1cb[_0x9c300b[_0xc90c('0x25')]]={'$like':'%'+_0x2858ac[_0xc90c('0x2c')]['filter']+'%'};return _0xb1e1cb;}})});}_0x165a53=_[_0xc90c('0x37')]({},_0x165a53,_0x2858ac[_0xc90c('0x39')]);var _0x15946e={'where':_0x165a53[_0xc90c('0x36')]};return db[_0xc90c('0x3a')][_0xc90c('0x1e')](_0x15946e)[_0xc90c('0x22')](function(_0x8876c0){_0x438ef3[_0xc90c('0x1e')]=_0x8876c0;if(_0x2858ac[_0xc90c('0x2c')][_0xc90c('0x3b')]){_0x165a53['include']=[{'all':!![]}];}return db[_0xc90c('0x3a')][_0xc90c('0x3c')](_0x165a53);})['then'](function(_0x1498af){_0x438ef3[_0xc90c('0x3d')]=_0x1498af;return _0x438ef3;})[_0xc90c('0x22')](respondWithFilteredResult(_0x4c4ac5,_0x165a53))['catch'](handleError(_0x4c4ac5,null));};exports['show']=function(_0x195224,_0x1028ce){var _0x416614={'raw':![],'where':{'id':_0x195224[_0xc90c('0x3e')]['id']}},_0x1b64d0={};_0x1b64d0['model']=_['keys'](db[_0xc90c('0x3a')][_0xc90c('0x28')]);_0x1b64d0[_0xc90c('0x2c')]=_[_0xc90c('0x2d')](_0x195224[_0xc90c('0x2c')]);_0x1b64d0[_0xc90c('0x2e')]=_[_0xc90c('0x2f')](_0x1b64d0[_0xc90c('0x30')],_0x1b64d0[_0xc90c('0x2c')]);_0x416614[_0xc90c('0x31')]=_[_0xc90c('0x2f')](_0x1b64d0[_0xc90c('0x30')],qs[_0xc90c('0x32')](_0x195224[_0xc90c('0x2c')]['fields']));_0x416614['attributes']=_0x416614['attributes'][_0xc90c('0x3f')]?_0x416614[_0xc90c('0x31')]:_0x1b64d0[_0xc90c('0x30')];if(_0x195224[_0xc90c('0x2c')]['includeAll']){_0x416614[_0xc90c('0x40')]=[{'all':!![]}];}_0x416614=_['merge']({},_0x416614,_0x195224['options']);return db['FreshdeskConfiguration'][_0xc90c('0x41')](_0x416614)[_0xc90c('0x22')](handleEntityNotFound(_0x1028ce,null))[_0xc90c('0x22')](respondWithResult(_0x1028ce,null))[_0xc90c('0x42')](handleError(_0x1028ce,null));};exports[_0xc90c('0x43')]=function(_0x59182c,_0x47e59e){return db['FreshdeskConfiguration'][_0xc90c('0x43')](_0x59182c[_0xc90c('0x44')],{})['then'](respondWithResult(_0x47e59e,0xc9))['catch'](handleError(_0x47e59e,null));};exports['update']=function(_0x5d0019,_0x45305b){if(_0x5d0019[_0xc90c('0x44')]['id']){delete _0x5d0019[_0xc90c('0x44')]['id'];}return db['FreshdeskConfiguration'][_0xc90c('0x41')]({'where':{'id':_0x5d0019[_0xc90c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x45305b,null))[_0xc90c('0x22')](saveUpdates(_0x5d0019[_0xc90c('0x44')],null))[_0xc90c('0x22')](respondWithResult(_0x45305b,null))[_0xc90c('0x42')](handleError(_0x45305b,null));};exports[_0xc90c('0x45')]=function(_0x480577,_0x1d3a8a){return db[_0xc90c('0x3a')][_0xc90c('0x41')]({'where':{'id':_0x480577['params']['id']}})[_0xc90c('0x22')](handleEntityNotFound(_0x1d3a8a,null))[_0xc90c('0x22')](removeEntity(_0x1d3a8a,null))[_0xc90c('0x42')](handleError(_0x1d3a8a,null));};exports[_0xc90c('0x46')]=function(_0x10db93,_0x11200d,_0x2d811a){var _0x5a9766={};var _0x2619b9={};var _0x39d84c;var _0xcd3d8b;return db[_0xc90c('0x3a')][_0xc90c('0x47')]({'where':{'id':_0x10db93['params']['id']}})[_0xc90c('0x22')](handleEntityNotFound(_0x11200d,null))[_0xc90c('0x22')](function(_0x433648){if(_0x433648){_0x39d84c=_0x433648;_0x2619b9['model']=_[_0xc90c('0x2d')](db['FreshdeskField'][_0xc90c('0x28')]);_0x2619b9[_0xc90c('0x2c')]=_[_0xc90c('0x2d')](_0x10db93['query']);_0x2619b9[_0xc90c('0x2e')]=_[_0xc90c('0x2f')](_0x2619b9[_0xc90c('0x30')],_0x2619b9['query']);_0x5a9766[_0xc90c('0x31')]=_[_0xc90c('0x2f')](_0x2619b9[_0xc90c('0x30')],qs[_0xc90c('0x32')](_0x10db93[_0xc90c('0x2c')][_0xc90c('0x32')]));_0x5a9766[_0xc90c('0x31')]=_0x5a9766['attributes'][_0xc90c('0x3f')]?_0x5a9766['attributes']:_0x2619b9['model'];_0x5a9766['order']=qs[_0xc90c('0x35')](_0x10db93['query'][_0xc90c('0x35')]);_0x5a9766[_0xc90c('0x36')]=qs[_0xc90c('0x2e')](_['pick'](_0x10db93[_0xc90c('0x2c')],_0x2619b9[_0xc90c('0x2e')]));if(_0x10db93[_0xc90c('0x2c')][_0xc90c('0x48')]){_0x5a9766['where']=_[_0xc90c('0x37')](_0x5a9766['where'],{'$or':_[_0xc90c('0x27')](_0x5a9766[_0xc90c('0x31')],function(_0x3eb467){var _0x4e2531={};_0x4e2531[_0x3eb467]={'$like':'%'+_0x10db93[_0xc90c('0x2c')][_0xc90c('0x48')]+'%'};return _0x4e2531;})});}_0x5a9766=_['merge']({},_0x5a9766,_0x10db93[_0xc90c('0x39')]);return _0x39d84c['getFields'](_0x5a9766);}})[_0xc90c('0x22')](function(_0x545e83){if(_0x545e83){_0xcd3d8b=_0x545e83[_0xc90c('0x3f')];if(!_0x10db93['query']['hasOwnProperty'](_0xc90c('0x34'))){_0x5a9766[_0xc90c('0x1c')]=qs[_0xc90c('0x1c')](_0x10db93[_0xc90c('0x2c')]['limit']);_0x5a9766[_0xc90c('0x1b')]=qs['offset'](_0x10db93[_0xc90c('0x2c')][_0xc90c('0x1b')]);}return _0x39d84c[_0xc90c('0x46')](_0x5a9766);}})[_0xc90c('0x22')](function(_0x492972){if(_0x492972){return _0x492972?{'count':_0xcd3d8b,'rows':_0x492972}:null;}})[_0xc90c('0x22')](respondWithResult(_0x11200d,null))[_0xc90c('0x42')](handleError(_0x11200d,null));};exports[_0xc90c('0x49')]=function(_0x14002e,_0x5091ca,_0x2d90e5){var _0x16d860={};var _0x34dede={};var _0xd29323;var _0x15afc5;return db[_0xc90c('0x3a')][_0xc90c('0x47')]({'where':{'id':_0x14002e[_0xc90c('0x3e')]['id']}})[_0xc90c('0x22')](handleEntityNotFound(_0x5091ca,null))[_0xc90c('0x22')](function(_0x4de1c6){if(_0x4de1c6){_0xd29323=_0x4de1c6;_0x34dede[_0xc90c('0x30')]=_[_0xc90c('0x2d')](db[_0xc90c('0x4a')]['rawAttributes']);_0x34dede['query']=_[_0xc90c('0x2d')](_0x14002e[_0xc90c('0x2c')]);_0x34dede['filters']=_[_0xc90c('0x2f')](_0x34dede[_0xc90c('0x30')],_0x34dede[_0xc90c('0x2c')]);_0x16d860[_0xc90c('0x31')]=_[_0xc90c('0x2f')](_0x34dede[_0xc90c('0x30')],qs[_0xc90c('0x32')](_0x14002e[_0xc90c('0x2c')][_0xc90c('0x32')]));_0x16d860[_0xc90c('0x31')]=_0x16d860[_0xc90c('0x31')][_0xc90c('0x3f')]?_0x16d860[_0xc90c('0x31')]:_0x34dede['model'];_0x16d860[_0xc90c('0x4b')]=qs[_0xc90c('0x35')](_0x14002e['query'][_0xc90c('0x35')]);_0x16d860[_0xc90c('0x36')]=qs['filters'](_['pick'](_0x14002e[_0xc90c('0x2c')],_0x34dede['filters']));if(_0x14002e[_0xc90c('0x2c')][_0xc90c('0x48')]){_0x16d860[_0xc90c('0x36')]=_['merge'](_0x16d860['where'],{'$or':_['map'](_0x16d860['attributes'],function(_0x37844f){var _0x4ffa26={};_0x4ffa26[_0x37844f]={'$like':'%'+_0x14002e[_0xc90c('0x2c')][_0xc90c('0x48')]+'%'};return _0x4ffa26;})});}_0x16d860=_[_0xc90c('0x37')]({},_0x16d860,_0x14002e[_0xc90c('0x39')]);return _0xd29323[_0xc90c('0x49')](_0x16d860);}})[_0xc90c('0x22')](function(_0x32bae0){if(_0x32bae0){_0x15afc5=_0x32bae0[_0xc90c('0x3f')];if(!_0x14002e['query'][_0xc90c('0x33')](_0xc90c('0x34'))){_0x16d860[_0xc90c('0x1c')]=qs[_0xc90c('0x1c')](_0x14002e[_0xc90c('0x2c')][_0xc90c('0x1c')]);_0x16d860[_0xc90c('0x1b')]=qs[_0xc90c('0x1b')](_0x14002e[_0xc90c('0x2c')][_0xc90c('0x1b')]);}return _0xd29323['getSubjects'](_0x16d860);}})['then'](function(_0x2b60ac){if(_0x2b60ac){return _0x2b60ac?{'count':_0x15afc5,'rows':_0x2b60ac}:null;}})[_0xc90c('0x22')](respondWithResult(_0x5091ca,null))[_0xc90c('0x42')](handleError(_0x5091ca,null));};exports[_0xc90c('0x4c')]=function(_0x4d0493,_0x454791,_0x6c9b09){var _0xac679c={};var _0x1f53d5={};var _0x332433;var _0x5e18b7;return db['FreshdeskConfiguration'][_0xc90c('0x47')]({'where':{'id':_0x4d0493[_0xc90c('0x3e')]['id']}})[_0xc90c('0x22')](handleEntityNotFound(_0x454791,null))[_0xc90c('0x22')](function(_0x218227){if(_0x218227){_0x332433=_0x218227;_0x1f53d5[_0xc90c('0x30')]=_[_0xc90c('0x2d')](db['FreshdeskField']['rawAttributes']);_0x1f53d5[_0xc90c('0x2c')]=_[_0xc90c('0x2d')](_0x4d0493[_0xc90c('0x2c')]);_0x1f53d5[_0xc90c('0x2e')]=_['intersection'](_0x1f53d5[_0xc90c('0x30')],_0x1f53d5['query']);_0xac679c['attributes']=_['intersection'](_0x1f53d5[_0xc90c('0x30')],qs['fields'](_0x4d0493['query']['fields']));_0xac679c[_0xc90c('0x31')]=_0xac679c[_0xc90c('0x31')][_0xc90c('0x3f')]?_0xac679c['attributes']:_0x1f53d5['model'];_0xac679c[_0xc90c('0x4b')]=qs[_0xc90c('0x35')](_0x4d0493[_0xc90c('0x2c')][_0xc90c('0x35')]);_0xac679c['where']=qs[_0xc90c('0x2e')](_[_0xc90c('0x4d')](_0x4d0493[_0xc90c('0x2c')],_0x1f53d5[_0xc90c('0x2e')]));if(_0x4d0493[_0xc90c('0x2c')]['filter']){_0xac679c[_0xc90c('0x36')]=_[_0xc90c('0x37')](_0xac679c[_0xc90c('0x36')],{'$or':_['map'](_0xac679c[_0xc90c('0x31')],function(_0x3ffc3f){var _0x1b62d9={};_0x1b62d9[_0x3ffc3f]={'$like':'%'+_0x4d0493['query'][_0xc90c('0x48')]+'%'};return _0x1b62d9;})});}_0xac679c=_[_0xc90c('0x37')]({},_0xac679c,_0x4d0493['options']);return _0x332433[_0xc90c('0x4c')](_0xac679c);}})[_0xc90c('0x22')](function(_0x3624c6){if(_0x3624c6){_0x5e18b7=_0x3624c6[_0xc90c('0x3f')];if(!_0x4d0493[_0xc90c('0x2c')][_0xc90c('0x33')](_0xc90c('0x34'))){_0xac679c[_0xc90c('0x1c')]=qs[_0xc90c('0x1c')](_0x4d0493[_0xc90c('0x2c')]['limit']);_0xac679c['offset']=qs['offset'](_0x4d0493[_0xc90c('0x2c')]['offset']);}return _0x332433[_0xc90c('0x4c')](_0xac679c);}})[_0xc90c('0x22')](function(_0x40b62d){if(_0x40b62d){return _0x40b62d?{'count':_0x5e18b7,'rows':_0x40b62d}:null;}})['then'](respondWithResult(_0x454791,null))[_0xc90c('0x42')](handleError(_0x454791,null));};exports[_0xc90c('0x4e')]=function(_0x51a83d,_0x5d15c4,_0x41aba5){var _0xa9c026={};var _0x3040a1={};var _0x757376;var _0x1273c7;return db[_0xc90c('0x3a')][_0xc90c('0x47')]({'where':{'id':_0x51a83d['params']['id']}})[_0xc90c('0x22')](handleEntityNotFound(_0x5d15c4,null))[_0xc90c('0x22')](function(_0x1d78ce){if(_0x1d78ce){_0x757376=_0x1d78ce;_0x3040a1[_0xc90c('0x30')]=_[_0xc90c('0x2d')](db[_0xc90c('0x4f')][_0xc90c('0x28')]);_0x3040a1['query']=_[_0xc90c('0x2d')](_0x51a83d['query']);_0x3040a1[_0xc90c('0x2e')]=_[_0xc90c('0x2f')](_0x3040a1['model'],_0x3040a1[_0xc90c('0x2c')]);_0xa9c026[_0xc90c('0x31')]=_[_0xc90c('0x2f')](_0x3040a1[_0xc90c('0x30')],qs[_0xc90c('0x32')](_0x51a83d[_0xc90c('0x2c')][_0xc90c('0x32')]));_0xa9c026['attributes']=_0xa9c026[_0xc90c('0x31')]['length']?_0xa9c026['attributes']:_0x3040a1[_0xc90c('0x30')];_0xa9c026[_0xc90c('0x4b')]=qs['sort'](_0x51a83d[_0xc90c('0x2c')][_0xc90c('0x35')]);_0xa9c026['where']=qs[_0xc90c('0x2e')](_[_0xc90c('0x4d')](_0x51a83d[_0xc90c('0x2c')],_0x3040a1['filters']));if(_0x51a83d[_0xc90c('0x2c')][_0xc90c('0x48')]){_0xa9c026[_0xc90c('0x36')]=_[_0xc90c('0x37')](_0xa9c026[_0xc90c('0x36')],{'$or':_['map'](_0xa9c026[_0xc90c('0x31')],function(_0x17d235){var _0x4933ee={};_0x4933ee[_0x17d235]={'$like':'%'+_0x51a83d['query'][_0xc90c('0x48')]+'%'};return _0x4933ee;})});}_0xa9c026=_[_0xc90c('0x37')]({},_0xa9c026,_0x51a83d[_0xc90c('0x39')]);return _0x757376[_0xc90c('0x4e')](_0xa9c026);}})[_0xc90c('0x22')](function(_0x2a19e5){if(_0x2a19e5){_0x1273c7=_0x2a19e5['length'];if(!_0x51a83d[_0xc90c('0x2c')][_0xc90c('0x33')](_0xc90c('0x34'))){_0xa9c026['limit']=qs['limit'](_0x51a83d[_0xc90c('0x2c')][_0xc90c('0x1c')]);_0xa9c026['offset']=qs['offset'](_0x51a83d['query'][_0xc90c('0x1b')]);}return _0x757376['getTags'](_0xa9c026);}})[_0xc90c('0x22')](function(_0x118fcd){if(_0x118fcd){return _0x118fcd?{'count':_0x1273c7,'rows':_0x118fcd}:null;}})[_0xc90c('0x22')](respondWithResult(_0x5d15c4,null))[_0xc90c('0x42')](handleError(_0x5d15c4,null));};exports['setTags']=function(_0xcbaf3b,_0x23867f,_0x377ea5){if(_0xcbaf3b[_0xc90c('0x44')]['id']){delete _0xcbaf3b[_0xc90c('0x44')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xcbaf3b[_0xc90c('0x3e')]['id']}})[_0xc90c('0x22')](handleEntityNotFound(_0x23867f,null))['then'](function(_0x31ee72){if(_0x31ee72){return _0x31ee72[_0xc90c('0x50')](_0xcbaf3b[_0xc90c('0x44')]['ids']||[]);}return null;})[_0xc90c('0x22')](respondWithResult(_0x23867f,null))[_0xc90c('0x42')](handleError(_0x23867f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index cb7ea9a..63bb600 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 _0x3675=['../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4aa058,_0x35c174){var _0x2d8fbb=function(_0x69d744){while(--_0x69d744){_0x4aa058['push'](_0x4aa058['shift']());}};_0x2d8fbb(++_0x35c174);}(_0x3675,0x87));var _0x5367=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0x3675[_0x3f88bc];return _0x4df1c4;};'use strict';var _=require(_0x5367('0x0'));var util=require(_0x5367('0x1'));var logger=require(_0x5367('0x2'))(_0x5367('0x3'));var moment=require(_0x5367('0x4'));var BPromise=require(_0x5367('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5367('0x6'));var rimraf=require(_0x5367('0x7'));var config=require(_0x5367('0x8'));var attributes=require(_0x5367('0x9'));module['exports']=function(_0x42bc7f,_0x5f41fe){return _0x42bc7f[_0x5367('0xa')](_0x5367('0xb'),attributes,{'tableName':_0x5367('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10aa=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger'];(function(_0x5a8269,_0xfb2f54){var _0x539ed7=function(_0x31ce98){while(--_0x31ce98){_0x5a8269['push'](_0x5a8269['shift']());}};_0x539ed7(++_0xfb2f54);}(_0x10aa,0x8c));var _0xa10a=function(_0x16c121,_0x544d17){_0x16c121=_0x16c121-0x0;var _0x5a9e7d=_0x10aa[_0x16c121];return _0x5a9e7d;};'use strict';var _=require(_0xa10a('0x0'));var util=require(_0xa10a('0x1'));var logger=require(_0xa10a('0x2'))('api');var moment=require(_0xa10a('0x3'));var BPromise=require(_0xa10a('0x4'));var rp=require(_0xa10a('0x5'));var fs=require('fs');var path=require(_0xa10a('0x6'));var rimraf=require(_0xa10a('0x7'));var config=require(_0xa10a('0x8'));var attributes=require(_0xa10a('0x9'));module['exports']=function(_0x2951c9,_0xca0eae){return _0x2951c9[_0xa10a('0xa')](_0xa10a('0xb'),attributes,{'tableName':_0xa10a('0xc'),'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 c109104..6be257f 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 _0x49ab=['lodash','util','moment','bluebird','randomstring','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x4b4a86,_0x497617){var _0x1b79bb=function(_0x184657){while(--_0x184657){_0x4b4a86['push'](_0x4b4a86['shift']());}};_0x1b79bb(++_0x497617);}(_0x49ab,0x1e0));var _0xb49a=function(_0x48b39d,_0x3b5f52){_0x48b39d=_0x48b39d-0x0;var _0x5e99d5=_0x49ab[_0x48b39d];return _0x5e99d5;};'use strict';var _=require(_0xb49a('0x0'));var util=require(_0xb49a('0x1'));var moment=require(_0xb49a('0x2'));var BPromise=require(_0xb49a('0x3'));var rs=require(_0xb49a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb49a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb49a('0x6'));var client=jayson[_0xb49a('0x7')][_0xb49a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16da09,_0x10f1f9,_0x2f7665){return new BPromise(function(_0x5900a7,_0x6c3884){return client[_0xb49a('0x9')](_0x16da09,_0x2f7665)[_0xb49a('0xa')](function(_0x1445bb){logger[_0xb49a('0xb')](_0xb49a('0xc'),_0x10f1f9,_0xb49a('0xd'));logger['debug'](_0xb49a('0xe'),_0x10f1f9,'request\x20sent',JSON[_0xb49a('0xf')](_0x1445bb));if(_0x1445bb[_0xb49a('0x10')]){if(_0x1445bb[_0xb49a('0x10')]['code']===0x1f4){logger[_0xb49a('0x10')](_0xb49a('0xc'),_0x10f1f9,_0x1445bb[_0xb49a('0x10')][_0xb49a('0x11')]);return _0x6c3884(_0x1445bb[_0xb49a('0x10')]['message']);}logger[_0xb49a('0x10')](_0xb49a('0xc'),_0x10f1f9,_0x1445bb[_0xb49a('0x10')][_0xb49a('0x11')]);return _0x5900a7(_0x1445bb['error'][_0xb49a('0x11')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x10f1f9,_0xb49a('0xd'));_0x5900a7(_0x1445bb[_0xb49a('0x12')][_0xb49a('0x11')]);}})[_0xb49a('0x13')](function(_0x160563){logger[_0xb49a('0x10')](_0xb49a('0xc'),_0x10f1f9,_0x160563);_0x6c3884(_0x160563);});});} \ No newline at end of file +var _0xbd68=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0xbd68,0x133));var _0x8bd6=function(_0x2b2d47,_0x1e1d5e){_0x2b2d47=_0x2b2d47-0x0;var _0x3e2be7=_0xbd68[_0x2b2d47];return _0x3e2be7;};'use strict';var _=require(_0x8bd6('0x0'));var util=require('util');var moment=require(_0x8bd6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bd6('0x2'));var db=require(_0x8bd6('0x3'))['db'];var utils=require(_0x8bd6('0x4'));var logger=require(_0x8bd6('0x5'))(_0x8bd6('0x6'));var config=require(_0x8bd6('0x7'));var jayson=require(_0x8bd6('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x370181,_0x47de89,_0x4e4afc){return new BPromise(function(_0x1c289c,_0x1eeb5f){return client['request'](_0x370181,_0x4e4afc)[_0x8bd6('0x9')](function(_0x50413c){logger['info'](_0x8bd6('0xa'),_0x47de89,_0x8bd6('0xb'));logger[_0x8bd6('0xc')](_0x8bd6('0xd'),_0x47de89,_0x8bd6('0xb'),JSON[_0x8bd6('0xe')](_0x50413c));if(_0x50413c['error']){if(_0x50413c[_0x8bd6('0xf')][_0x8bd6('0x10')]===0x1f4){logger['error'](_0x8bd6('0xa'),_0x47de89,_0x50413c['error']['message']);return _0x1eeb5f(_0x50413c['error'][_0x8bd6('0x11')]);}logger[_0x8bd6('0xf')](_0x8bd6('0xa'),_0x47de89,_0x50413c['error'][_0x8bd6('0x11')]);return _0x1c289c(_0x50413c[_0x8bd6('0xf')][_0x8bd6('0x11')]);}else{logger[_0x8bd6('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x47de89,_0x8bd6('0xb'));_0x1c289c(_0x50413c['result']['message']);}})[_0x8bd6('0x13')](function(_0xbeb838){logger['error'](_0x8bd6('0xa'),_0x47de89,_0xbeb838);_0x1eeb5f(_0xbeb838);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index e3c9b2d..47022ff 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 _0xf3e1=['show','post','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id'];(function(_0x562328,_0x3263a6){var _0xaa3a58=function(_0x2a0bc9){while(--_0x2a0bc9){_0x562328['push'](_0x562328['shift']());}};_0xaa3a58(++_0x3263a6);}(_0xf3e1,0x17f));var _0x1f3e=function(_0x16f4fd,_0x3f5bcc){_0x16f4fd=_0x16f4fd-0x0;var _0x22cf4f=_0xf3e1[_0x16f4fd];return _0x22cf4f;};'use strict';var multer=require('multer');var util=require(_0x1f3e('0x0'));var path=require(_0x1f3e('0x1'));var timeout=require(_0x1f3e('0x2'));var express=require(_0x1f3e('0x3'));var router=express[_0x1f3e('0x4')]();var fs_extra=require(_0x1f3e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1f3e('0x6'));var config=require(_0x1f3e('0x7'));var controller=require(_0x1f3e('0x8'));router['get']('/',auth[_0x1f3e('0x9')](),controller[_0x1f3e('0xa')]);router[_0x1f3e('0xb')](_0x1f3e('0xc'),auth[_0x1f3e('0x9')](),controller[_0x1f3e('0xd')]);router[_0x1f3e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x1f3e('0x9')](),controller[_0x1f3e('0xf')]);router[_0x1f3e('0x10')]('/:id',auth[_0x1f3e('0x9')](),controller[_0x1f3e('0x11')]);module['exports']=router; \ No newline at end of file +var _0x68c6=['show','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','isAuthenticated'];(function(_0x467d78,_0x1b657c){var _0x5af294=function(_0x1b289f){while(--_0x1b289f){_0x467d78['push'](_0x467d78['shift']());}};_0x5af294(++_0x1b657c);}(_0x68c6,0x85));var _0x668c=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0x68c6[_0x1ca890];return _0x3f8e01;};'use strict';var multer=require(_0x668c('0x0'));var util=require(_0x668c('0x1'));var path=require(_0x668c('0x2'));var timeout=require(_0x668c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x668c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x668c('0x5'));var config=require(_0x668c('0x6'));var controller=require(_0x668c('0x7'));router[_0x668c('0x8')]('/',auth['isAuthenticated'](),controller[_0x668c('0x9')]);router[_0x668c('0x8')]('/:id',auth[_0x668c('0xa')](),controller[_0x668c('0xb')]);router[_0x668c('0xc')]('/',auth[_0x668c('0xa')](),controller[_0x668c('0xd')]);router[_0x668c('0xe')](_0x668c('0xf'),auth['isAuthenticated'](),controller[_0x668c('0x10')]);router[_0x668c('0x11')](_0x668c('0xf'),auth[_0x668c('0xa')](),controller['destroy']);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 f76bb01..5d7d76a 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 _0x31b4=['exports','variable','customVariable','picklist','string','STRING','sequelize'];(function(_0x5bbe3b,_0x489a3a){var _0x185d87=function(_0x4504c1){while(--_0x4504c1){_0x5bbe3b['push'](_0x5bbe3b['shift']());}};_0x185d87(++_0x489a3a);}(_0x31b4,0x12c));var _0x431b=function(_0x374e5a,_0x4361ee){_0x374e5a=_0x374e5a-0x0;var _0xaf3daf=_0x31b4[_0x374e5a];return _0xaf3daf;};'use strict';var Sequelize=require(_0x431b('0x0'));module[_0x431b('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x431b('0x2'),_0x431b('0x3'),'keyValue',_0x431b('0x4')),'defaultValue':_0x431b('0x5')},'content':{'type':Sequelize[_0x431b('0x6')]},'key':{'type':Sequelize[_0x431b('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x431b('0x5'),'variable',_0x431b('0x3'))},'keyContent':{'type':Sequelize[_0x431b('0x6')]},'idField':{'type':Sequelize[_0x431b('0x6')]},'nameField':{'type':Sequelize[_0x431b('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x431b('0x6')]}}; \ No newline at end of file +var _0x24c1=['keyValue','string','STRING','customVariable','sequelize','exports','ENUM','variable'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x24c1,0x174));var _0x124c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x24c1[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x124c('0x0'));module[_0x124c('0x1')]={'type':{'type':Sequelize[_0x124c('0x2')]('string',_0x124c('0x3'),'customVariable',_0x124c('0x4'),'picklist'),'defaultValue':_0x124c('0x5')},'content':{'type':Sequelize[_0x124c('0x6')]},'key':{'type':Sequelize[_0x124c('0x6')]},'keyType':{'type':Sequelize[_0x124c('0x2')](_0x124c('0x5'),_0x124c('0x3'),_0x124c('0x7'))},'keyContent':{'type':Sequelize[_0x124c('0x6')]},'idField':{'type':Sequelize[_0x124c('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x124c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 93a9f04..f1a6ac5 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 _0x4522=['querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','type','merge','options','FreshdeskField','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','destroy','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x213508,_0x55e93a){var _0x174d20=function(_0x5117ae){while(--_0x5117ae){_0x213508['push'](_0x213508['shift']());}};_0x174d20(++_0x55e93a);}(_0x4522,0x1a0));var _0x2452=function(_0x567c30,_0x503c16){_0x567c30=_0x567c30-0x0;var _0x1931ca=_0x4522[_0x567c30];return _0x1931ca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2452('0x0'));var jsonpatch=require(_0x2452('0x1'));var rp=require(_0x2452('0x2'));var moment=require('moment');var BPromise=require(_0x2452('0x3'));var Mustache=require(_0x2452('0x4'));var util=require(_0x2452('0x5'));var path=require(_0x2452('0x6'));var sox=require(_0x2452('0x7'));var csv=require(_0x2452('0x8'));var ejs=require(_0x2452('0x9'));var fs=require('fs');var fs_extra=require(_0x2452('0xa'));var _=require(_0x2452('0xb'));var squel=require(_0x2452('0xc'));var crypto=require(_0x2452('0xd'));var jsforce=require(_0x2452('0xe'));var deskjs=require(_0x2452('0xf'));var toCsv=require(_0x2452('0x8'));var querystring=require(_0x2452('0x10'));var Papa=require(_0x2452('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2452('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2452('0x13'))(_0x2452('0x14'));var utils=require(_0x2452('0x15'));var config=require(_0x2452('0x16'));var licenseUtil=require(_0x2452('0x17'));var db=require(_0x2452('0x18'))['db'];function respondWithStatusCode(_0x2c1e0f,_0x2377b9){_0x2377b9=_0x2377b9||0xcc;return function(_0x4968e8){if(_0x4968e8){return _0x2c1e0f['sendStatus'](_0x2377b9);}return _0x2c1e0f['status'](_0x2377b9)[_0x2452('0x19')]();};}function respondWithResult(_0x4fafa0,_0x33e592){_0x33e592=_0x33e592||0xc8;return function(_0x506cd4){if(_0x506cd4){return _0x4fafa0[_0x2452('0x1a')](_0x33e592)[_0x2452('0x1b')](_0x506cd4);}};}function respondWithFilteredResult(_0x5d0438,_0x1dbadf){return function(_0x47930c){if(_0x47930c){var _0x3dd8cc=typeof _0x1dbadf[_0x2452('0x1c')]===_0x2452('0x1d')&&typeof _0x1dbadf[_0x2452('0x1e')]==='undefined';var _0x2108e4=_0x47930c[_0x2452('0x1f')];var _0x59d89a=_0x3dd8cc?0x0:_0x1dbadf['offset'];var _0x1bfb44=_0x3dd8cc?_0x47930c[_0x2452('0x1f')]:_0x1dbadf[_0x2452('0x1c')]+_0x1dbadf['limit'];var _0x914d2b;if(_0x1bfb44>=_0x2108e4){_0x1bfb44=_0x2108e4;_0x914d2b=0xc8;}else{_0x914d2b=0xce;}_0x5d0438[_0x2452('0x1a')](_0x914d2b);return _0x5d0438[_0x2452('0x20')](_0x2452('0x21'),_0x59d89a+'-'+_0x1bfb44+'/'+_0x2108e4)[_0x2452('0x1b')](_0x47930c);}return null;};}function patchUpdates(_0x1c70cb){return function(_0x3f48c2){try{jsonpatch[_0x2452('0x22')](_0x3f48c2,_0x1c70cb,!![]);}catch(_0x5e921d){return BPromise['reject'](_0x5e921d);}return _0x3f48c2[_0x2452('0x23')]();};}function saveUpdates(_0x32dfe7,_0x4bb3ff){return function(_0x17d0a0){if(_0x17d0a0){return _0x17d0a0[_0x2452('0x24')](_0x32dfe7)[_0x2452('0x25')](function(_0x617ba7){return _0x617ba7;});}return null;};}function removeEntity(_0x285281,_0x397f21){return function(_0x155caa){if(_0x155caa){return _0x155caa['destroy']()[_0x2452('0x25')](function(){_0x285281[_0x2452('0x1a')](0xcc)[_0x2452('0x19')]();});}};}function handleEntityNotFound(_0x231410,_0x3a4326){return function(_0x516fcf){if(!_0x516fcf){_0x231410['sendStatus'](0x194);}return _0x516fcf;};}function handleError(_0x295be0,_0x159ba1){_0x159ba1=_0x159ba1||0x1f4;return function(_0x46fcbb){logger[_0x2452('0x26')](_0x46fcbb[_0x2452('0x27')]);if(_0x46fcbb['name']){delete _0x46fcbb[_0x2452('0x28')];}_0x295be0[_0x2452('0x1a')](_0x159ba1)['send'](_0x46fcbb);};}exports['index']=function(_0x332878,_0xe8d39b){var _0x36cb6c={},_0x28e6ea={},_0x43fde0={'count':0x0,'rows':[]};var _0x258fa6=_['map'](db['FreshdeskField'][_0x2452('0x29')],function(_0x454e0a){return{'name':_0x454e0a[_0x2452('0x2a')],'type':_0x454e0a['type'][_0x2452('0x2b')]};});_0x28e6ea[_0x2452('0x2c')]=_['map'](_0x258fa6,_0x2452('0x28'));_0x28e6ea[_0x2452('0x2d')]=_[_0x2452('0x2e')](_0x332878[_0x2452('0x2d')]);_0x28e6ea[_0x2452('0x2f')]=_[_0x2452('0x30')](_0x28e6ea[_0x2452('0x2c')],_0x28e6ea[_0x2452('0x2d')]);_0x36cb6c[_0x2452('0x31')]=_[_0x2452('0x30')](_0x28e6ea[_0x2452('0x2c')],qs[_0x2452('0x32')](_0x332878[_0x2452('0x2d')]['fields']));_0x36cb6c[_0x2452('0x31')]=_0x36cb6c[_0x2452('0x31')]['length']?_0x36cb6c[_0x2452('0x31')]:_0x28e6ea['model'];if(!_0x332878[_0x2452('0x2d')][_0x2452('0x33')]('nolimit')){_0x36cb6c[_0x2452('0x1e')]=qs[_0x2452('0x1e')](_0x332878[_0x2452('0x2d')]['limit']);_0x36cb6c[_0x2452('0x1c')]=qs[_0x2452('0x1c')](_0x332878['query'][_0x2452('0x1c')]);}_0x36cb6c[_0x2452('0x34')]=qs[_0x2452('0x35')](_0x332878[_0x2452('0x2d')][_0x2452('0x35')]);_0x36cb6c['where']=qs['filters'](_['pick'](_0x332878[_0x2452('0x2d')],_0x28e6ea[_0x2452('0x2f')]),_0x258fa6);if(_0x332878[_0x2452('0x2d')][_0x2452('0x36')]){_0x36cb6c[_0x2452('0x37')]=_['merge'](_0x36cb6c[_0x2452('0x37')],{'$or':_['map'](_0x258fa6,function(_0x5be9b4){if(_0x5be9b4[_0x2452('0x38')]!=='VIRTUAL'){var _0x44ef50={};_0x44ef50[_0x5be9b4[_0x2452('0x28')]]={'$like':'%'+_0x332878['query'][_0x2452('0x36')]+'%'};return _0x44ef50;}})});}_0x36cb6c=_[_0x2452('0x39')]({},_0x36cb6c,_0x332878[_0x2452('0x3a')]);var _0x34d7f9={'where':_0x36cb6c[_0x2452('0x37')]};return db[_0x2452('0x3b')][_0x2452('0x1f')](_0x34d7f9)[_0x2452('0x25')](function(_0x5b864e){_0x43fde0[_0x2452('0x1f')]=_0x5b864e;if(_0x332878['query'][_0x2452('0x3c')]){_0x36cb6c[_0x2452('0x3d')]=[{'all':!![]}];}return db['FreshdeskField'][_0x2452('0x3e')](_0x36cb6c);})[_0x2452('0x25')](function(_0xb4e3f5){_0x43fde0[_0x2452('0x3f')]=_0xb4e3f5;return _0x43fde0;})[_0x2452('0x25')](respondWithFilteredResult(_0xe8d39b,_0x36cb6c))['catch'](handleError(_0xe8d39b,null));};exports[_0x2452('0x40')]=function(_0x29910e,_0x5379a9){var _0xfabbd8={'raw':!![],'where':{'id':_0x29910e[_0x2452('0x41')]['id']}},_0x449b89={};_0x449b89[_0x2452('0x2c')]=_['keys'](db[_0x2452('0x3b')][_0x2452('0x29')]);_0x449b89[_0x2452('0x2d')]=_[_0x2452('0x2e')](_0x29910e[_0x2452('0x2d')]);_0x449b89[_0x2452('0x2f')]=_['intersection'](_0x449b89[_0x2452('0x2c')],_0x449b89['query']);_0xfabbd8[_0x2452('0x31')]=_[_0x2452('0x30')](_0x449b89['model'],qs['fields'](_0x29910e['query']['fields']));_0xfabbd8[_0x2452('0x31')]=_0xfabbd8['attributes'][_0x2452('0x42')]?_0xfabbd8['attributes']:_0x449b89[_0x2452('0x2c')];if(_0x29910e[_0x2452('0x2d')]['includeAll']){_0xfabbd8['include']=[{'all':!![]}];}_0xfabbd8=_[_0x2452('0x39')]({},_0xfabbd8,_0x29910e['options']);return db[_0x2452('0x3b')][_0x2452('0x43')](_0xfabbd8)[_0x2452('0x25')](handleEntityNotFound(_0x5379a9,null))[_0x2452('0x25')](respondWithResult(_0x5379a9,null))['catch'](handleError(_0x5379a9,null));};exports['create']=function(_0x3e4a8b,_0x38615e){return db[_0x2452('0x3b')][_0x2452('0x44')](_0x3e4a8b[_0x2452('0x45')],{})['then'](respondWithResult(_0x38615e,0xc9))[_0x2452('0x46')](handleError(_0x38615e,null));};exports['update']=function(_0x3634f7,_0x53fd05){if(_0x3634f7[_0x2452('0x45')]['id']){delete _0x3634f7[_0x2452('0x45')]['id'];}return db['FreshdeskField'][_0x2452('0x43')]({'where':{'id':_0x3634f7['params']['id']}})[_0x2452('0x25')](handleEntityNotFound(_0x53fd05,null))['then'](saveUpdates(_0x3634f7['body'],null))['then'](respondWithResult(_0x53fd05,null))[_0x2452('0x46')](handleError(_0x53fd05,null));};exports[_0x2452('0x47')]=function(_0x36ebcb,_0x4b705f){return db[_0x2452('0x3b')][_0x2452('0x43')]({'where':{'id':_0x36ebcb[_0x2452('0x41')]['id']}})[_0x2452('0x25')](handleEntityNotFound(_0x4b705f,null))[_0x2452('0x25')](removeEntity(_0x4b705f,null))['catch'](handleError(_0x4b705f,null));}; \ No newline at end of file +var _0x3c81=['apply','reject','save','update','then','destroy','end','error','name','send','map','FreshdeskField','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','path','sox','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c81,0x102));var _0x13c8=function(_0x439fba,_0x2937b8){_0x439fba=_0x439fba-0x0;var _0x19659b=_0x3c81[_0x439fba];return _0x19659b;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13c8('0x2'));var rp=require(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x13c8('0x4'));var sox=require(_0x13c8('0x5'));var csv=require(_0x13c8('0x6'));var ejs=require(_0x13c8('0x7'));var fs=require('fs');var fs_extra=require(_0x13c8('0x8'));var _=require(_0x13c8('0x9'));var squel=require(_0x13c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x13c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13c8('0x6'));var querystring=require(_0x13c8('0xc'));var Papa=require(_0x13c8('0xd'));var Redis=require(_0x13c8('0xe'));var authService=require(_0x13c8('0xf'));var qs=require(_0x13c8('0x10'));var as=require(_0x13c8('0x11'));var hardwareService=require(_0x13c8('0x12'));var logger=require(_0x13c8('0x13'))(_0x13c8('0x14'));var utils=require(_0x13c8('0x15'));var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require(_0x13c8('0x18'))['db'];function respondWithStatusCode(_0x5ab91d,_0x21442d){_0x21442d=_0x21442d||0xcc;return function(_0x7b6da8){if(_0x7b6da8){return _0x5ab91d[_0x13c8('0x19')](_0x21442d);}return _0x5ab91d[_0x13c8('0x1a')](_0x21442d)['end']();};}function respondWithResult(_0x42955d,_0x515681){_0x515681=_0x515681||0xc8;return function(_0x4d7a88){if(_0x4d7a88){return _0x42955d['status'](_0x515681)[_0x13c8('0x1b')](_0x4d7a88);}};}function respondWithFilteredResult(_0x5e0e06,_0x337397){return function(_0x17a3c1){if(_0x17a3c1){var _0x23f64e=typeof _0x337397[_0x13c8('0x1c')]==='undefined'&&typeof _0x337397[_0x13c8('0x1d')]===_0x13c8('0x1e');var _0x31ae02=_0x17a3c1[_0x13c8('0x1f')];var _0xce1ad2=_0x23f64e?0x0:_0x337397[_0x13c8('0x1c')];var _0x346417=_0x23f64e?_0x17a3c1[_0x13c8('0x1f')]:_0x337397[_0x13c8('0x1c')]+_0x337397[_0x13c8('0x1d')];var _0xe9386a;if(_0x346417>=_0x31ae02){_0x346417=_0x31ae02;_0xe9386a=0xc8;}else{_0xe9386a=0xce;}_0x5e0e06['status'](_0xe9386a);return _0x5e0e06[_0x13c8('0x20')](_0x13c8('0x21'),_0xce1ad2+'-'+_0x346417+'/'+_0x31ae02)[_0x13c8('0x1b')](_0x17a3c1);}return null;};}function patchUpdates(_0x313ea3){return function(_0x513085){try{jsonpatch[_0x13c8('0x22')](_0x513085,_0x313ea3,!![]);}catch(_0x3c4603){return BPromise[_0x13c8('0x23')](_0x3c4603);}return _0x513085[_0x13c8('0x24')]();};}function saveUpdates(_0x436d5d,_0x2fc123){return function(_0x5ab47f){if(_0x5ab47f){return _0x5ab47f[_0x13c8('0x25')](_0x436d5d)[_0x13c8('0x26')](function(_0x315d6c){return _0x315d6c;});}return null;};}function removeEntity(_0xcf41d2,_0x577df6){return function(_0x1770e5){if(_0x1770e5){return _0x1770e5[_0x13c8('0x27')]()['then'](function(){_0xcf41d2['status'](0xcc)[_0x13c8('0x28')]();});}};}function handleEntityNotFound(_0x4aff35,_0x47e8ae){return function(_0x5ad0dc){if(!_0x5ad0dc){_0x4aff35[_0x13c8('0x19')](0x194);}return _0x5ad0dc;};}function handleError(_0xc7f1b6,_0x53ada9){_0x53ada9=_0x53ada9||0x1f4;return function(_0x4df077){logger[_0x13c8('0x29')](_0x4df077['stack']);if(_0x4df077['name']){delete _0x4df077[_0x13c8('0x2a')];}_0xc7f1b6[_0x13c8('0x1a')](_0x53ada9)[_0x13c8('0x2b')](_0x4df077);};}exports['index']=function(_0x5ef2f7,_0x277a89){var _0x1071a0={},_0x399840={},_0x441182={'count':0x0,'rows':[]};var _0x138017=_[_0x13c8('0x2c')](db[_0x13c8('0x2d')]['rawAttributes'],function(_0x109cb8){return{'name':_0x109cb8[_0x13c8('0x2e')],'type':_0x109cb8['type']['key']};});_0x399840[_0x13c8('0x2f')]=_[_0x13c8('0x2c')](_0x138017,'name');_0x399840[_0x13c8('0x30')]=_[_0x13c8('0x31')](_0x5ef2f7['query']);_0x399840[_0x13c8('0x32')]=_[_0x13c8('0x33')](_0x399840[_0x13c8('0x2f')],_0x399840[_0x13c8('0x30')]);_0x1071a0[_0x13c8('0x34')]=_[_0x13c8('0x33')](_0x399840[_0x13c8('0x2f')],qs[_0x13c8('0x35')](_0x5ef2f7['query']['fields']));_0x1071a0[_0x13c8('0x34')]=_0x1071a0[_0x13c8('0x34')]['length']?_0x1071a0[_0x13c8('0x34')]:_0x399840['model'];if(!_0x5ef2f7[_0x13c8('0x30')]['hasOwnProperty'](_0x13c8('0x36'))){_0x1071a0[_0x13c8('0x1d')]=qs[_0x13c8('0x1d')](_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x1d')]);_0x1071a0[_0x13c8('0x1c')]=qs[_0x13c8('0x1c')](_0x5ef2f7['query'][_0x13c8('0x1c')]);}_0x1071a0[_0x13c8('0x37')]=qs['sort'](_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x38')]);_0x1071a0[_0x13c8('0x39')]=qs['filters'](_['pick'](_0x5ef2f7['query'],_0x399840[_0x13c8('0x32')]),_0x138017);if(_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3a')]){_0x1071a0[_0x13c8('0x39')]=_[_0x13c8('0x3b')](_0x1071a0[_0x13c8('0x39')],{'$or':_[_0x13c8('0x2c')](_0x138017,function(_0xe19858){if(_0xe19858[_0x13c8('0x3c')]!=='VIRTUAL'){var _0x5b2a28={};_0x5b2a28[_0xe19858[_0x13c8('0x2a')]]={'$like':'%'+_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3a')]+'%'};return _0x5b2a28;}})});}_0x1071a0=_[_0x13c8('0x3b')]({},_0x1071a0,_0x5ef2f7['options']);var _0x35e1e7={'where':_0x1071a0['where']};return db[_0x13c8('0x2d')][_0x13c8('0x1f')](_0x35e1e7)[_0x13c8('0x26')](function(_0x1cd02c){_0x441182[_0x13c8('0x1f')]=_0x1cd02c;if(_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3d')]){_0x1071a0[_0x13c8('0x3e')]=[{'all':!![]}];}return db[_0x13c8('0x2d')][_0x13c8('0x3f')](_0x1071a0);})[_0x13c8('0x26')](function(_0x416169){_0x441182[_0x13c8('0x40')]=_0x416169;return _0x441182;})[_0x13c8('0x26')](respondWithFilteredResult(_0x277a89,_0x1071a0))[_0x13c8('0x41')](handleError(_0x277a89,null));};exports[_0x13c8('0x42')]=function(_0x1b2ada,_0x1505fb){var _0xc5eb86={'raw':!![],'where':{'id':_0x1b2ada[_0x13c8('0x43')]['id']}},_0x1cff99={};_0x1cff99[_0x13c8('0x2f')]=_[_0x13c8('0x31')](db[_0x13c8('0x2d')][_0x13c8('0x44')]);_0x1cff99['query']=_[_0x13c8('0x31')](_0x1b2ada[_0x13c8('0x30')]);_0x1cff99[_0x13c8('0x32')]=_[_0x13c8('0x33')](_0x1cff99[_0x13c8('0x2f')],_0x1cff99['query']);_0xc5eb86['attributes']=_[_0x13c8('0x33')](_0x1cff99[_0x13c8('0x2f')],qs[_0x13c8('0x35')](_0x1b2ada['query']['fields']));_0xc5eb86['attributes']=_0xc5eb86[_0x13c8('0x34')]['length']?_0xc5eb86[_0x13c8('0x34')]:_0x1cff99['model'];if(_0x1b2ada[_0x13c8('0x30')][_0x13c8('0x3d')]){_0xc5eb86[_0x13c8('0x3e')]=[{'all':!![]}];}_0xc5eb86=_[_0x13c8('0x3b')]({},_0xc5eb86,_0x1b2ada[_0x13c8('0x45')]);return db[_0x13c8('0x2d')]['find'](_0xc5eb86)[_0x13c8('0x26')](handleEntityNotFound(_0x1505fb,null))[_0x13c8('0x26')](respondWithResult(_0x1505fb,null))['catch'](handleError(_0x1505fb,null));};exports[_0x13c8('0x46')]=function(_0x26155d,_0x2e925f){return db[_0x13c8('0x2d')][_0x13c8('0x46')](_0x26155d['body'],{})[_0x13c8('0x26')](respondWithResult(_0x2e925f,0xc9))[_0x13c8('0x41')](handleError(_0x2e925f,null));};exports[_0x13c8('0x25')]=function(_0x38418b,_0x185d18){if(_0x38418b['body']['id']){delete _0x38418b[_0x13c8('0x47')]['id'];}return db[_0x13c8('0x2d')][_0x13c8('0x48')]({'where':{'id':_0x38418b[_0x13c8('0x43')]['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x185d18,null))[_0x13c8('0x26')](saveUpdates(_0x38418b[_0x13c8('0x47')],null))[_0x13c8('0x26')](respondWithResult(_0x185d18,null))[_0x13c8('0x41')](handleError(_0x185d18,null));};exports[_0x13c8('0x27')]=function(_0x266f4e,_0x5e1fe5){return db[_0x13c8('0x2d')][_0x13c8('0x48')]({'where':{'id':_0x266f4e[_0x13c8('0x43')]['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x5e1fe5,null))[_0x13c8('0x26')](removeEntity(_0x5e1fe5,null))[_0x13c8('0x41')](handleError(_0x5e1fe5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index d5d7577..38ffd26 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 _0xf3f9=['path','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3b6617,_0x479502){var _0x3cdcab=function(_0x14c6df){while(--_0x14c6df){_0x3b6617['push'](_0x3b6617['shift']());}};_0x3cdcab(++_0x479502);}(_0xf3f9,0x14a));var _0x9f3f=function(_0x3be2a0,_0x30d5af){_0x3be2a0=_0x3be2a0-0x0;var _0x130828=_0xf3f9[_0x3be2a0];return _0x130828;};'use strict';var _=require(_0x9f3f('0x0'));var util=require('util');var logger=require(_0x9f3f('0x1'))(_0x9f3f('0x2'));var moment=require(_0x9f3f('0x3'));var BPromise=require(_0x9f3f('0x4'));var rp=require(_0x9f3f('0x5'));var fs=require('fs');var path=require(_0x9f3f('0x6'));var rimraf=require(_0x9f3f('0x7'));var config=require(_0x9f3f('0x8'));var attributes=require('./intFreshdeskField.attributes');module[_0x9f3f('0x9')]=function(_0x3dbe10,_0x45d721){return _0x3dbe10[_0x9f3f('0xa')](_0x9f3f('0xb'),attributes,{'tableName':_0x9f3f('0xc'),'paranoid':![],'indexes':[{'name':_0x9f3f('0xd'),'fields':[_0x9f3f('0xe'),_0x9f3f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd78b=['define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','util','../../config/logger','api','bluebird','request-promise','./intFreshdeskField.attributes','exports'];(function(_0x2b1c74,_0x27db09){var _0x2fc80a=function(_0x1ecfde){while(--_0x1ecfde){_0x2b1c74['push'](_0x2b1c74['shift']());}};_0x2fc80a(++_0x27db09);}(_0xd78b,0x155));var _0xbd78=function(_0x4a4d6e,_0x38ab14){_0x4a4d6e=_0x4a4d6e-0x0;var _0x377fa8=_0xd78b[_0x4a4d6e];return _0x377fa8;};'use strict';var _=require('lodash');var util=require(_0xbd78('0x0'));var logger=require(_0xbd78('0x1'))(_0xbd78('0x2'));var moment=require('moment');var BPromise=require(_0xbd78('0x3'));var rp=require(_0xbd78('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbd78('0x5'));module[_0xbd78('0x6')]=function(_0x4d8ef1,_0x404d1c){return _0x4d8ef1[_0xbd78('0x7')](_0xbd78('0x8'),attributes,{'tableName':_0xbd78('0x9'),'paranoid':![],'indexes':[{'name':_0xbd78('0xa'),'fields':[_0xbd78('0xb'),'FieldId'],'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 64ab0f8..068ce26 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 _0x7915=['../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x48ceba,_0x30c1f5){var _0x350818=function(_0xc579a8){while(--_0xc579a8){_0x48ceba['push'](_0x48ceba['shift']());}};_0x350818(++_0x30c1f5);}(_0x7915,0xc7));var _0x5791=function(_0x52a4fd,_0xade59c){_0x52a4fd=_0x52a4fd-0x0;var _0x54ce36=_0x7915[_0x52a4fd];return _0x54ce36;};'use strict';var _=require(_0x5791('0x0'));var util=require('util');var moment=require(_0x5791('0x1'));var BPromise=require(_0x5791('0x2'));var rs=require(_0x5791('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5791('0x4'))['db'];var utils=require(_0x5791('0x5'));var logger=require(_0x5791('0x6'))(_0x5791('0x7'));var config=require(_0x5791('0x8'));var jayson=require(_0x5791('0x9'));var client=jayson[_0x5791('0xa')][_0x5791('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1824a7,_0xa85234,_0x2fc384){return new BPromise(function(_0x27ed94,_0x3ca0c9){return client[_0x5791('0xc')](_0x1824a7,_0x2fc384)[_0x5791('0xd')](function(_0x56017f){logger[_0x5791('0xe')](_0x5791('0xf'),_0xa85234,_0x5791('0x10'));logger[_0x5791('0x11')](_0x5791('0x12'),_0xa85234,'request\x20sent',JSON[_0x5791('0x13')](_0x56017f));if(_0x56017f[_0x5791('0x14')]){if(_0x56017f[_0x5791('0x14')]['code']===0x1f4){logger['error'](_0x5791('0xf'),_0xa85234,_0x56017f[_0x5791('0x14')]['message']);return _0x3ca0c9(_0x56017f[_0x5791('0x14')][_0x5791('0x15')]);}logger[_0x5791('0x14')](_0x5791('0xf'),_0xa85234,_0x56017f[_0x5791('0x14')]['message']);return _0x27ed94(_0x56017f[_0x5791('0x14')][_0x5791('0x15')]);}else{logger[_0x5791('0xe')](_0x5791('0xf'),_0xa85234,_0x5791('0x10'));_0x27ed94(_0x56017f['result'][_0x5791('0x15')]);}})[_0x5791('0x16')](function(_0x408432){logger[_0x5791('0x14')](_0x5791('0xf'),_0xa85234,_0x408432);_0x3ca0c9(_0x408432);});});} \ No newline at end of file +var _0x2fbc=['rpc','jayson/promise','client','http','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0x2fbc,0x1c6));var _0xc2fb=function(_0x2b9255,_0x5be6c6){_0x2b9255=_0x2b9255-0x0;var _0x104ca4=_0x2fbc[_0x2b9255];return _0x104ca4;};'use strict';var _=require(_0xc2fb('0x0'));var util=require(_0xc2fb('0x1'));var moment=require(_0xc2fb('0x2'));var BPromise=require(_0xc2fb('0x3'));var rs=require(_0xc2fb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2fb('0x5'))['db'];var utils=require(_0xc2fb('0x6'));var logger=require(_0xc2fb('0x7'))(_0xc2fb('0x8'));var config=require('../../config/environment');var jayson=require(_0xc2fb('0x9'));var client=jayson[_0xc2fb('0xa')][_0xc2fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ce4b6,_0xa90b9e,_0x543e77){return new BPromise(function(_0x204da9,_0x4e9e98){return client['request'](_0x5ce4b6,_0x543e77)[_0xc2fb('0xc')](function(_0x98a4d8){logger['info'](_0xc2fb('0xd'),_0xa90b9e,_0xc2fb('0xe'));logger['debug'](_0xc2fb('0xf'),_0xa90b9e,_0xc2fb('0xe'),JSON[_0xc2fb('0x10')](_0x98a4d8));if(_0x98a4d8[_0xc2fb('0x11')]){if(_0x98a4d8['error']['code']===0x1f4){logger[_0xc2fb('0x11')](_0xc2fb('0xd'),_0xa90b9e,_0x98a4d8['error'][_0xc2fb('0x12')]);return _0x4e9e98(_0x98a4d8['error']['message']);}logger['error'](_0xc2fb('0xd'),_0xa90b9e,_0x98a4d8[_0xc2fb('0x11')][_0xc2fb('0x12')]);return _0x204da9(_0x98a4d8[_0xc2fb('0x11')][_0xc2fb('0x12')]);}else{logger[_0xc2fb('0x13')]('FreshdeskField,\x20%s,\x20%s',_0xa90b9e,_0xc2fb('0xe'));_0x204da9(_0x98a4d8[_0xc2fb('0x14')][_0xc2fb('0x12')]);}})[_0xc2fb('0x15')](function(_0x15044f){logger['error'](_0xc2fb('0xd'),_0xa90b9e,_0x15044f);_0x4e9e98(_0x15044f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index b2c3fa0..64742a0 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 _0x4cf8=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','create','addConfiguration'];(function(_0x172c14,_0x2f7383){var _0x4f93e8=function(_0x313e0c){while(--_0x313e0c){_0x172c14['push'](_0x172c14['shift']());}};_0x4f93e8(++_0x2f7383);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x131e60,_0x5352ce){_0x131e60=_0x131e60-0x0;var _0x4bc497=_0x4cf8[_0x131e60];return _0x4bc497;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var fs_extra=require(_0x84cf('0x6'));var auth=require(_0x84cf('0x7'));var interaction=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var controller=require(_0x84cf('0xa'));router[_0x84cf('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x84cf('0xb')]('/:id',auth[_0x84cf('0xc')](),controller[_0x84cf('0xd')]);router['get'](_0x84cf('0xe'),auth[_0x84cf('0xc')](),controller['getConfigurations']);router[_0x84cf('0xb')](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x10')]);router['post']('/',auth[_0x84cf('0xc')](),controller[_0x84cf('0x11')]);router['post']('/:id/configurations',auth[_0x84cf('0xc')](),controller[_0x84cf('0x12')]);router[_0x84cf('0x13')](_0x84cf('0x14'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x15')]);router[_0x84cf('0x16')](_0x84cf('0x14'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x17')]);module[_0x84cf('0x18')]=router; \ No newline at end of file +var _0xa5fa=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','put','update','destroy','exports','util','path'];(function(_0x458d40,_0x51ba41){var _0x4ed6e9=function(_0x2ff091){while(--_0x2ff091){_0x458d40['push'](_0x458d40['shift']());}};_0x4ed6e9(++_0x51ba41);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0xa5fa[_0x967959];return _0x5c4489;};'use strict';var multer=require('multer');var util=require(_0xaa5f('0x0'));var path=require(_0xaa5f('0x1'));var timeout=require(_0xaa5f('0x2'));var express=require(_0xaa5f('0x3'));var router=express['Router']();var fs_extra=require(_0xaa5f('0x4'));var auth=require(_0xaa5f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa5f('0x6'));var controller=require(_0xaa5f('0x7'));router[_0xaa5f('0x8')]('/',auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xa')]);router[_0xaa5f('0x8')](_0xaa5f('0xb'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xc')]);router[_0xaa5f('0x8')](_0xaa5f('0xd'),auth['isAuthenticated'](),controller[_0xaa5f('0xe')]);router[_0xaa5f('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xaa5f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaa5f('0x10')]);router['post'](_0xaa5f('0xd'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x11')]);router[_0xaa5f('0x12')](_0xaa5f('0xb'),auth['isAuthenticated'](),controller[_0xaa5f('0x13')]);router['delete'](_0xaa5f('0xb'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x14')]);module[_0xaa5f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index d5b49b8..015426b 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 _0x5204=['exports','STRING','username','sequelize'];(function(_0x5d7876,_0x28ccb7){var _0x1a10ae=function(_0x6cf64c){while(--_0x6cf64c){_0x5d7876['push'](_0x5d7876['shift']());}};_0x1a10ae(++_0x28ccb7);}(_0x5204,0xdf));var _0x4520=function(_0x3a607e,_0x54d530){_0x3a607e=_0x3a607e-0x0;var _0x37b106=_0x5204[_0x3a607e];return _0x37b106;};'use strict';var Sequelize=require(_0x4520('0x0'));module[_0x4520('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4520('0x2')]},'username':{'type':Sequelize[_0x4520('0x2')],'unique':_0x4520('0x3')},'apiKey':{'type':Sequelize[_0x4520('0x2')]},'remoteUri':{'type':Sequelize[_0x4520('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4520('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5b12=['STRING','sequelize','exports'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x5b12,0xa3));var _0x25b1=function(_0xb895b0,_0x4dbd2b){_0xb895b0=_0xb895b0-0x0;var _0x338338=_0x5b12[_0xb895b0];return _0x338338;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index fad402f..948fb8f 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 _0x5149=['options','includeAll','findAll','rows','catch','params','keys','length','include','merge','create','update','body','find','getConfigurations','FreshsalesConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','reject','save','then','destroy','error','name','send','index','map','FreshsalesAccount','rawAttributes','type','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL'];(function(_0xac75be,_0xde7b3f){var _0x4e7233=function(_0x45d4f2){while(--_0x45d4f2){_0xac75be['push'](_0xac75be['shift']());}};_0x4e7233(++_0xde7b3f);}(_0x5149,0x90));var _0x9514=function(_0x483f1d,_0x5d7b57){_0x483f1d=_0x483f1d-0x0;var _0xf34e80=_0x5149[_0x483f1d];return _0xf34e80;};'use strict';var emlformat=require(_0x9514('0x0'));var rimraf=require(_0x9514('0x1'));var zipdir=require(_0x9514('0x2'));var jsonpatch=require(_0x9514('0x3'));var rp=require(_0x9514('0x4'));var moment=require(_0x9514('0x5'));var BPromise=require(_0x9514('0x6'));var Mustache=require(_0x9514('0x7'));var util=require(_0x9514('0x8'));var path=require(_0x9514('0x9'));var sox=require('sox');var csv=require(_0x9514('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9514('0xb'));var jsforce=require(_0x9514('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9514('0xa'));var querystring=require(_0x9514('0xd'));var Papa=require(_0x9514('0xe'));var Redis=require(_0x9514('0xf'));var authService=require(_0x9514('0x10'));var qs=require(_0x9514('0x11'));var as=require(_0x9514('0x12'));var hardwareService=require(_0x9514('0x13'));var logger=require(_0x9514('0x14'))(_0x9514('0x15'));var utils=require(_0x9514('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9514('0x17'));var db=require(_0x9514('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b68c5,_0x523d5e){_0x523d5e=_0x523d5e||0xcc;return function(_0x51232f){if(_0x51232f){return _0x5b68c5[_0x9514('0x19')](_0x523d5e);}return _0x5b68c5[_0x9514('0x1a')](_0x523d5e)[_0x9514('0x1b')]();};}function respondWithResult(_0x2221fe,_0x1bd673){_0x1bd673=_0x1bd673||0xc8;return function(_0x43a2ad){if(_0x43a2ad){return _0x2221fe[_0x9514('0x1a')](_0x1bd673)['json'](_0x43a2ad);}};}function respondWithFilteredResult(_0x46fbaa,_0x5ced23){return function(_0x1b7e84){if(_0x1b7e84){var _0x4e19ac=typeof _0x5ced23[_0x9514('0x1c')]==='undefined'&&typeof _0x5ced23[_0x9514('0x1d')]===_0x9514('0x1e');var _0x18ed6d=_0x1b7e84[_0x9514('0x1f')];var _0x29edd9=_0x4e19ac?0x0:_0x5ced23[_0x9514('0x1c')];var _0x2c6ad3=_0x4e19ac?_0x1b7e84[_0x9514('0x1f')]:_0x5ced23['offset']+_0x5ced23['limit'];var _0x413881;if(_0x2c6ad3>=_0x18ed6d){_0x2c6ad3=_0x18ed6d;_0x413881=0xc8;}else{_0x413881=0xce;}_0x46fbaa[_0x9514('0x1a')](_0x413881);return _0x46fbaa[_0x9514('0x20')](_0x9514('0x21'),_0x29edd9+'-'+_0x2c6ad3+'/'+_0x18ed6d)[_0x9514('0x22')](_0x1b7e84);}return null;};}function patchUpdates(_0x2ac5b0){return function(_0x55e6f9){try{jsonpatch[_0x9514('0x23')](_0x55e6f9,_0x2ac5b0,!![]);}catch(_0x2af681){return BPromise[_0x9514('0x24')](_0x2af681);}return _0x55e6f9[_0x9514('0x25')]();};}function saveUpdates(_0x412e30,_0x1d0792){return function(_0x95198c){if(_0x95198c){return _0x95198c['update'](_0x412e30)[_0x9514('0x26')](function(_0x51b7e3){return _0x51b7e3;});}return null;};}function removeEntity(_0x3ac612,_0x29b63f){return function(_0x168ee3){if(_0x168ee3){return _0x168ee3[_0x9514('0x27')]()[_0x9514('0x26')](function(){_0x3ac612[_0x9514('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25fdb3,_0x48de0a){return function(_0x4097b2){if(!_0x4097b2){_0x25fdb3[_0x9514('0x19')](0x194);}return _0x4097b2;};}function handleError(_0x22447e,_0x1eb80b){_0x1eb80b=_0x1eb80b||0x1f4;return function(_0x2d21b7){logger[_0x9514('0x28')](_0x2d21b7['stack']);if(_0x2d21b7[_0x9514('0x29')]){delete _0x2d21b7['name'];}_0x22447e[_0x9514('0x1a')](_0x1eb80b)[_0x9514('0x2a')](_0x2d21b7);};}exports[_0x9514('0x2b')]=function(_0x49f1ca,_0x4bb8ae){var _0x5a4135={},_0x5dc9a4={},_0x24eb14={'count':0x0,'rows':[]};var _0x25c984=_[_0x9514('0x2c')](db[_0x9514('0x2d')][_0x9514('0x2e')],function(_0xe581cc){return{'name':_0xe581cc['fieldName'],'type':_0xe581cc[_0x9514('0x2f')]['key']};});_0x5dc9a4[_0x9514('0x30')]=_[_0x9514('0x2c')](_0x25c984,'name');_0x5dc9a4['query']=_['keys'](_0x49f1ca['query']);_0x5dc9a4[_0x9514('0x31')]=_[_0x9514('0x32')](_0x5dc9a4[_0x9514('0x30')],_0x5dc9a4[_0x9514('0x33')]);_0x5a4135[_0x9514('0x34')]=_['intersection'](_0x5dc9a4[_0x9514('0x30')],qs['fields'](_0x49f1ca[_0x9514('0x33')][_0x9514('0x35')]));_0x5a4135['attributes']=_0x5a4135['attributes']['length']?_0x5a4135[_0x9514('0x34')]:_0x5dc9a4[_0x9514('0x30')];if(!_0x49f1ca[_0x9514('0x33')][_0x9514('0x36')](_0x9514('0x37'))){_0x5a4135[_0x9514('0x1d')]=qs[_0x9514('0x1d')](_0x49f1ca[_0x9514('0x33')][_0x9514('0x1d')]);_0x5a4135[_0x9514('0x1c')]=qs[_0x9514('0x1c')](_0x49f1ca[_0x9514('0x33')]['offset']);}_0x5a4135[_0x9514('0x38')]=qs[_0x9514('0x39')](_0x49f1ca['query'][_0x9514('0x39')]);_0x5a4135[_0x9514('0x3a')]=qs[_0x9514('0x31')](_[_0x9514('0x3b')](_0x49f1ca['query'],_0x5dc9a4[_0x9514('0x31')]),_0x25c984);if(_0x49f1ca[_0x9514('0x33')][_0x9514('0x3c')]){_0x5a4135[_0x9514('0x3a')]=_['merge'](_0x5a4135[_0x9514('0x3a')],{'$or':_['map'](_0x25c984,function(_0x47b274){if(_0x47b274[_0x9514('0x2f')]!==_0x9514('0x3d')){var _0x3c87a0={};_0x3c87a0[_0x47b274[_0x9514('0x29')]]={'$like':'%'+_0x49f1ca[_0x9514('0x33')][_0x9514('0x3c')]+'%'};return _0x3c87a0;}})});}_0x5a4135=_['merge']({},_0x5a4135,_0x49f1ca[_0x9514('0x3e')]);var _0xa71a3b={'where':_0x5a4135[_0x9514('0x3a')]};return db[_0x9514('0x2d')][_0x9514('0x1f')](_0xa71a3b)[_0x9514('0x26')](function(_0x33e659){_0x24eb14[_0x9514('0x1f')]=_0x33e659;if(_0x49f1ca[_0x9514('0x33')][_0x9514('0x3f')]){_0x5a4135['include']=[{'all':!![]}];}return db[_0x9514('0x2d')][_0x9514('0x40')](_0x5a4135);})[_0x9514('0x26')](function(_0x14ea1b){_0x24eb14[_0x9514('0x41')]=_0x14ea1b;return _0x24eb14;})[_0x9514('0x26')](respondWithFilteredResult(_0x4bb8ae,_0x5a4135))[_0x9514('0x42')](handleError(_0x4bb8ae,null));};exports['show']=function(_0x4d7f6d,_0x39e243){var _0x4134e6={'raw':![],'where':{'id':_0x4d7f6d[_0x9514('0x43')]['id']}},_0x417028={};_0x417028[_0x9514('0x30')]=_[_0x9514('0x44')](db[_0x9514('0x2d')][_0x9514('0x2e')]);_0x417028[_0x9514('0x33')]=_[_0x9514('0x44')](_0x4d7f6d[_0x9514('0x33')]);_0x417028[_0x9514('0x31')]=_[_0x9514('0x32')](_0x417028[_0x9514('0x30')],_0x417028[_0x9514('0x33')]);_0x4134e6['attributes']=_[_0x9514('0x32')](_0x417028['model'],qs[_0x9514('0x35')](_0x4d7f6d[_0x9514('0x33')]['fields']));_0x4134e6['attributes']=_0x4134e6[_0x9514('0x34')][_0x9514('0x45')]?_0x4134e6['attributes']:_0x417028[_0x9514('0x30')];if(_0x4d7f6d[_0x9514('0x33')][_0x9514('0x3f')]){_0x4134e6[_0x9514('0x46')]=[{'all':!![]}];}_0x4134e6=_[_0x9514('0x47')]({},_0x4134e6,_0x4d7f6d[_0x9514('0x3e')]);return db[_0x9514('0x2d')]['find'](_0x4134e6)[_0x9514('0x26')](handleEntityNotFound(_0x39e243,null))['then'](respondWithResult(_0x39e243,null))[_0x9514('0x42')](handleError(_0x39e243,null));};exports[_0x9514('0x48')]=function(_0x2ba5ca,_0x43f26e){return db[_0x9514('0x2d')][_0x9514('0x48')](_0x2ba5ca['body'],{})[_0x9514('0x26')](respondWithResult(_0x43f26e,0xc9))['catch'](handleError(_0x43f26e,null));};exports[_0x9514('0x49')]=function(_0x3db48d,_0x565e6a){if(_0x3db48d[_0x9514('0x4a')]['id']){delete _0x3db48d[_0x9514('0x4a')]['id'];}return db[_0x9514('0x2d')]['find']({'where':{'id':_0x3db48d[_0x9514('0x43')]['id']}})[_0x9514('0x26')](handleEntityNotFound(_0x565e6a,null))['then'](saveUpdates(_0x3db48d[_0x9514('0x4a')],null))['then'](respondWithResult(_0x565e6a,null))['catch'](handleError(_0x565e6a,null));};exports[_0x9514('0x27')]=function(_0x156f86,_0x7565c3){return db[_0x9514('0x2d')][_0x9514('0x4b')]({'where':{'id':_0x156f86['params']['id']}})[_0x9514('0x26')](handleEntityNotFound(_0x7565c3,null))[_0x9514('0x26')](removeEntity(_0x7565c3,null))[_0x9514('0x42')](handleError(_0x7565c3,null));};exports[_0x9514('0x4c')]=function(_0x6d3dbd,_0x2e0f65,_0x329f47){var _0x28088a={};var _0x5a32b1={};var _0x35a47d;var _0x2b1f12;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x6d3dbd['params']['id']}})[_0x9514('0x26')](handleEntityNotFound(_0x2e0f65,null))[_0x9514('0x26')](function(_0x379894){if(_0x379894){_0x35a47d=_0x379894;_0x5a32b1[_0x9514('0x30')]=_[_0x9514('0x44')](db[_0x9514('0x4d')][_0x9514('0x2e')]);_0x5a32b1['query']=_[_0x9514('0x44')](_0x6d3dbd[_0x9514('0x33')]);_0x5a32b1['filters']=_['intersection'](_0x5a32b1[_0x9514('0x30')],_0x5a32b1[_0x9514('0x33')]);_0x28088a['attributes']=_['intersection'](_0x5a32b1[_0x9514('0x30')],qs[_0x9514('0x35')](_0x6d3dbd[_0x9514('0x33')]['fields']));_0x28088a[_0x9514('0x34')]=_0x28088a[_0x9514('0x34')][_0x9514('0x45')]?_0x28088a[_0x9514('0x34')]:_0x5a32b1[_0x9514('0x30')];_0x28088a[_0x9514('0x38')]=qs[_0x9514('0x39')](_0x6d3dbd[_0x9514('0x33')][_0x9514('0x39')]);_0x28088a[_0x9514('0x3a')]=qs[_0x9514('0x31')](_[_0x9514('0x3b')](_0x6d3dbd['query'],_0x5a32b1[_0x9514('0x31')]));if(_0x6d3dbd[_0x9514('0x33')][_0x9514('0x3c')]){_0x28088a[_0x9514('0x3a')]=_['merge'](_0x28088a[_0x9514('0x3a')],{'$or':_[_0x9514('0x2c')](_0x28088a[_0x9514('0x34')],function(_0x1b9b9b){var _0x1f2609={};_0x1f2609[_0x1b9b9b]={'$like':'%'+_0x6d3dbd['query']['filter']+'%'};return _0x1f2609;})});}_0x28088a=_['merge']({},_0x28088a,_0x6d3dbd['options']);return _0x35a47d[_0x9514('0x4c')](_0x28088a);}})['then'](function(_0xe87745){if(_0xe87745){_0x2b1f12=_0xe87745['length'];if(!_0x6d3dbd[_0x9514('0x33')][_0x9514('0x36')](_0x9514('0x37'))){_0x28088a[_0x9514('0x1d')]=qs[_0x9514('0x1d')](_0x6d3dbd[_0x9514('0x33')]['limit']);_0x28088a[_0x9514('0x1c')]=qs['offset'](_0x6d3dbd['query'][_0x9514('0x1c')]);}return _0x35a47d[_0x9514('0x4c')](_0x28088a);}})[_0x9514('0x26')](function(_0x5eb246){if(_0x5eb246){return _0x5eb246?{'count':_0x2b1f12,'rows':_0x5eb246}:null;}})[_0x9514('0x26')](respondWithResult(_0x2e0f65,null))[_0x9514('0x42')](handleError(_0x2e0f65,null));};exports['addConfiguration']=function(_0x264378,_0x572cec,_0x255e2e){if(_0x264378[_0x9514('0x4a')]['id']){delete _0x264378[_0x9514('0x4a')]['id'];}return db[_0x9514('0x2d')]['findOne']({'where':{'id':_0x264378[_0x9514('0x43')]['id']}})[_0x9514('0x26')](handleEntityNotFound(_0x572cec,null))[_0x9514('0x26')](function(_0x36dfb3){if(_0x36dfb3){_0x264378['body'][_0x9514('0x4e')]=_0x36dfb3['id'];_0x264378['body']['Subjects']=integrations[_0x9514('0x4f')](_0x264378[_0x9514('0x4a')][_0x9514('0x50')],_0x264378[_0x9514('0x4a')][_0x9514('0x2f')]);_0x264378[_0x9514('0x4a')][_0x9514('0x51')]=integrations[_0x9514('0x52')](_0x264378[_0x9514('0x4a')][_0x9514('0x50')],_0x264378[_0x9514('0x4a')][_0x9514('0x2f')]);return db['FreshsalesConfiguration'][_0x9514('0x48')](_0x264378[_0x9514('0x4a')],{'include':[{'model':db[_0x9514('0x53')],'as':_0x9514('0x54')},{'model':db[_0x9514('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x572cec,null))[_0x9514('0x42')](handleError(_0x572cec,null));};exports[_0x9514('0x55')]=function(_0x53009b,_0x32fb9d,_0xf34a11){var _0x30ccaf='';var _0x5b27dd='';return db[_0x9514('0x2d')]['findOne']({'where':{'id':_0x53009b[_0x9514('0x43')]['id']},'attributes':['id',_0x9514('0x56'),_0x9514('0x57'),_0x9514('0x58')]})[_0x9514('0x26')](handleEntityNotFound(_0x32fb9d,null))['then'](function(_0x2872bd){if(_0x2872bd){_0x5b27dd=_0x2872bd[_0x9514('0x56')];_0x30ccaf=_0x2872bd[_0x9514('0x57')];var _0x3e000c=_0x2872bd[_0x9514('0x57')][_0x9514('0x59')](-0x1);if(_0x3e000c==='/'){_0x30ccaf=_0x30ccaf[_0x9514('0x5a')](0x0,_0x30ccaf[_0x9514('0x5b')](_0x3e000c));}return rp({'method':_0x9514('0x5c'),'uri':util[_0x9514('0x5d')]('%s%s',_0x30ccaf,_0x9514('0x5e')),'headers':{'Authorization':'Token\x20token='+_0x2872bd[_0x9514('0x58')]},'json':!![]});}})[_0x9514('0x26')](function(_0x4d7564){if(_0x4d7564){var _0x1ed9c9=_0x4d7564[_0x9514('0x5f')];var _0x1c9891=![];var _0x542a72=null;for(_0x542a72=0x0;_0x542a72<_0x1ed9c9['length'];_0x542a72++){if(_0x1ed9c9[_0x542a72][_0x9514('0x60')]===_0x5b27dd){_0x1c9891=!![];}}if(_0x1c9891){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9514('0x61')});}}})['then'](respondWithResult(_0x32fb9d,null))[_0x9514('0x42')](function(_0x4ad712){var _0x35ddee=_0x53009b[_0x9514('0x33')][_0x9514('0x62')]?0x1f4:_0x4ad712[_0x9514('0x63')]||0x1f4;logger[_0x9514('0x28')](_0x9514('0x64'),_0x9514('0x55'),_0x35ddee,JSON[_0x9514('0x65')](_0x4ad712));delete _0x4ad712[_0x9514('0x29')];if(_0x35ddee===0x191){_0x35ddee=0x190;}_0x32fb9d[_0x9514('0x1a')](_0x35ddee)[_0x9514('0x2a')](_0x53009b[_0x9514('0x33')][_0x9514('0x62')]?{'message':_0x9514('0x66'),'statusCode':_0x4ad712[_0x9514('0x63')]}:_0x4ad712);});}; \ No newline at end of file +var _0x0303=['email','Requested\x20Resource\x20not\x20Found','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','apply','reject','save','then','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','GET','format','%s%s','/api/selector/owners','Token\x20token=','users'];(function(_0x5e0bfe,_0x747312){var _0x6468b8=function(_0x20e5e0){while(--_0x20e5e0){_0x5e0bfe['push'](_0x5e0bfe['shift']());}};_0x6468b8(++_0x747312);}(_0x0303,0x19f));var _0x3030=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x0303[_0x432fca];return _0x3adba4;};'use strict';var emlformat=require(_0x3030('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3030('0x1'));var rp=require('request-promise');var moment=require(_0x3030('0x2'));var BPromise=require(_0x3030('0x3'));var Mustache=require(_0x3030('0x4'));var util=require(_0x3030('0x5'));var path=require(_0x3030('0x6'));var sox=require('sox');var csv=require(_0x3030('0x7'));var ejs=require(_0x3030('0x8'));var fs=require('fs');var fs_extra=require(_0x3030('0x9'));var _=require(_0x3030('0xa'));var squel=require('squel');var crypto=require(_0x3030('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3030('0xc'));var toCsv=require(_0x3030('0x7'));var querystring=require(_0x3030('0xd'));var Papa=require(_0x3030('0xe'));var Redis=require(_0x3030('0xf'));var authService=require(_0x3030('0x10'));var qs=require(_0x3030('0x11'));var as=require(_0x3030('0x12'));var hardwareService=require(_0x3030('0x13'));var logger=require('../../config/logger')(_0x3030('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3030('0x15'));var db=require(_0x3030('0x16'))['db'];var integrations=require(_0x3030('0x17'));function respondWithStatusCode(_0x57b72,_0x2cffc6){_0x2cffc6=_0x2cffc6||0xcc;return function(_0xc65e4f){if(_0xc65e4f){return _0x57b72['sendStatus'](_0x2cffc6);}return _0x57b72[_0x3030('0x18')](_0x2cffc6)[_0x3030('0x19')]();};}function respondWithResult(_0x3db098,_0x2441fe){_0x2441fe=_0x2441fe||0xc8;return function(_0x12526f){if(_0x12526f){return _0x3db098[_0x3030('0x18')](_0x2441fe)[_0x3030('0x1a')](_0x12526f);}};}function respondWithFilteredResult(_0x57ebd3,_0x265666){return function(_0x575dce){if(_0x575dce){var _0x37d2fa=typeof _0x265666[_0x3030('0x1b')]===_0x3030('0x1c')&&typeof _0x265666[_0x3030('0x1d')]===_0x3030('0x1c');var _0x5d0a18=_0x575dce[_0x3030('0x1e')];var _0x48ddde=_0x37d2fa?0x0:_0x265666[_0x3030('0x1b')];var _0x1b8259=_0x37d2fa?_0x575dce[_0x3030('0x1e')]:_0x265666[_0x3030('0x1b')]+_0x265666[_0x3030('0x1d')];var _0x24c647;if(_0x1b8259>=_0x5d0a18){_0x1b8259=_0x5d0a18;_0x24c647=0xc8;}else{_0x24c647=0xce;}_0x57ebd3[_0x3030('0x18')](_0x24c647);return _0x57ebd3['set']('Content-Range',_0x48ddde+'-'+_0x1b8259+'/'+_0x5d0a18)['json'](_0x575dce);}return null;};}function patchUpdates(_0x19649f){return function(_0x382b94){try{jsonpatch[_0x3030('0x1f')](_0x382b94,_0x19649f,!![]);}catch(_0x1cca6c){return BPromise[_0x3030('0x20')](_0x1cca6c);}return _0x382b94[_0x3030('0x21')]();};}function saveUpdates(_0x4b45d9,_0x4462d3){return function(_0x36515b){if(_0x36515b){return _0x36515b['update'](_0x4b45d9)[_0x3030('0x22')](function(_0x49edee){return _0x49edee;});}return null;};}function removeEntity(_0x39cb50,_0x21e4b2){return function(_0x55aeff){if(_0x55aeff){return _0x55aeff['destroy']()[_0x3030('0x22')](function(){_0x39cb50['status'](0xcc)[_0x3030('0x19')]();});}};}function handleEntityNotFound(_0x510b21,_0x229caf){return function(_0x11a334){if(!_0x11a334){_0x510b21[_0x3030('0x23')](0x194);}return _0x11a334;};}function handleError(_0x588f1c,_0x5e6f05){_0x5e6f05=_0x5e6f05||0x1f4;return function(_0x1eca42){logger['error'](_0x1eca42[_0x3030('0x24')]);if(_0x1eca42[_0x3030('0x25')]){delete _0x1eca42['name'];}_0x588f1c[_0x3030('0x18')](_0x5e6f05)[_0x3030('0x26')](_0x1eca42);};}exports[_0x3030('0x27')]=function(_0x11c2b5,_0x575b06){var _0x842f0e={},_0x2d088b={},_0x24e7c1={'count':0x0,'rows':[]};var _0x19540a=_[_0x3030('0x28')](db[_0x3030('0x29')][_0x3030('0x2a')],function(_0x494ec8){return{'name':_0x494ec8['fieldName'],'type':_0x494ec8['type'][_0x3030('0x2b')]};});_0x2d088b[_0x3030('0x2c')]=_[_0x3030('0x28')](_0x19540a,'name');_0x2d088b[_0x3030('0x2d')]=_[_0x3030('0x2e')](_0x11c2b5[_0x3030('0x2d')]);_0x2d088b[_0x3030('0x2f')]=_[_0x3030('0x30')](_0x2d088b[_0x3030('0x2c')],_0x2d088b[_0x3030('0x2d')]);_0x842f0e[_0x3030('0x31')]=_['intersection'](_0x2d088b[_0x3030('0x2c')],qs[_0x3030('0x32')](_0x11c2b5[_0x3030('0x2d')][_0x3030('0x32')]));_0x842f0e['attributes']=_0x842f0e['attributes']['length']?_0x842f0e[_0x3030('0x31')]:_0x2d088b[_0x3030('0x2c')];if(!_0x11c2b5[_0x3030('0x2d')][_0x3030('0x33')](_0x3030('0x34'))){_0x842f0e['limit']=qs[_0x3030('0x1d')](_0x11c2b5[_0x3030('0x2d')][_0x3030('0x1d')]);_0x842f0e[_0x3030('0x1b')]=qs['offset'](_0x11c2b5['query']['offset']);}_0x842f0e[_0x3030('0x35')]=qs[_0x3030('0x36')](_0x11c2b5[_0x3030('0x2d')]['sort']);_0x842f0e[_0x3030('0x37')]=qs['filters'](_[_0x3030('0x38')](_0x11c2b5[_0x3030('0x2d')],_0x2d088b[_0x3030('0x2f')]),_0x19540a);if(_0x11c2b5[_0x3030('0x2d')][_0x3030('0x39')]){_0x842f0e[_0x3030('0x37')]=_[_0x3030('0x3a')](_0x842f0e[_0x3030('0x37')],{'$or':_[_0x3030('0x28')](_0x19540a,function(_0x590aae){if(_0x590aae[_0x3030('0x3b')]!=='VIRTUAL'){var _0x261e1c={};_0x261e1c[_0x590aae[_0x3030('0x25')]]={'$like':'%'+_0x11c2b5[_0x3030('0x2d')][_0x3030('0x39')]+'%'};return _0x261e1c;}})});}_0x842f0e=_[_0x3030('0x3a')]({},_0x842f0e,_0x11c2b5[_0x3030('0x3c')]);var _0x2cefa1={'where':_0x842f0e[_0x3030('0x37')]};return db[_0x3030('0x29')][_0x3030('0x1e')](_0x2cefa1)[_0x3030('0x22')](function(_0x41c564){_0x24e7c1[_0x3030('0x1e')]=_0x41c564;if(_0x11c2b5[_0x3030('0x2d')][_0x3030('0x3d')]){_0x842f0e[_0x3030('0x3e')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x3030('0x3f')](_0x842f0e);})['then'](function(_0x23bef7){_0x24e7c1[_0x3030('0x40')]=_0x23bef7;return _0x24e7c1;})[_0x3030('0x22')](respondWithFilteredResult(_0x575b06,_0x842f0e))[_0x3030('0x41')](handleError(_0x575b06,null));};exports[_0x3030('0x42')]=function(_0x5627c8,_0x2dcad5){var _0x5d9e1d={'raw':![],'where':{'id':_0x5627c8[_0x3030('0x43')]['id']}},_0x3eec7b={};_0x3eec7b['model']=_[_0x3030('0x2e')](db['FreshsalesAccount'][_0x3030('0x2a')]);_0x3eec7b[_0x3030('0x2d')]=_[_0x3030('0x2e')](_0x5627c8[_0x3030('0x2d')]);_0x3eec7b[_0x3030('0x2f')]=_[_0x3030('0x30')](_0x3eec7b[_0x3030('0x2c')],_0x3eec7b[_0x3030('0x2d')]);_0x5d9e1d[_0x3030('0x31')]=_['intersection'](_0x3eec7b[_0x3030('0x2c')],qs[_0x3030('0x32')](_0x5627c8[_0x3030('0x2d')]['fields']));_0x5d9e1d[_0x3030('0x31')]=_0x5d9e1d[_0x3030('0x31')][_0x3030('0x44')]?_0x5d9e1d['attributes']:_0x3eec7b[_0x3030('0x2c')];if(_0x5627c8[_0x3030('0x2d')]['includeAll']){_0x5d9e1d[_0x3030('0x3e')]=[{'all':!![]}];}_0x5d9e1d=_[_0x3030('0x3a')]({},_0x5d9e1d,_0x5627c8[_0x3030('0x3c')]);return db[_0x3030('0x29')][_0x3030('0x45')](_0x5d9e1d)['then'](handleEntityNotFound(_0x2dcad5,null))[_0x3030('0x22')](respondWithResult(_0x2dcad5,null))[_0x3030('0x41')](handleError(_0x2dcad5,null));};exports[_0x3030('0x46')]=function(_0x440ccb,_0x5be8bc){return db[_0x3030('0x29')][_0x3030('0x46')](_0x440ccb[_0x3030('0x47')],{})[_0x3030('0x22')](respondWithResult(_0x5be8bc,0xc9))[_0x3030('0x41')](handleError(_0x5be8bc,null));};exports[_0x3030('0x48')]=function(_0xe48f28,_0x40da52){if(_0xe48f28['body']['id']){delete _0xe48f28[_0x3030('0x47')]['id'];}return db[_0x3030('0x29')][_0x3030('0x45')]({'where':{'id':_0xe48f28[_0x3030('0x43')]['id']}})[_0x3030('0x22')](handleEntityNotFound(_0x40da52,null))[_0x3030('0x22')](saveUpdates(_0xe48f28[_0x3030('0x47')],null))[_0x3030('0x22')](respondWithResult(_0x40da52,null))[_0x3030('0x41')](handleError(_0x40da52,null));};exports['destroy']=function(_0x15de23,_0x583474){return db[_0x3030('0x29')][_0x3030('0x45')]({'where':{'id':_0x15de23[_0x3030('0x43')]['id']}})[_0x3030('0x22')](handleEntityNotFound(_0x583474,null))[_0x3030('0x22')](removeEntity(_0x583474,null))[_0x3030('0x41')](handleError(_0x583474,null));};exports[_0x3030('0x49')]=function(_0x5061e0,_0x5ccecc,_0x4fc177){var _0x27fe36={};var _0x49ecb1={};var _0x121aa7;var _0x55fbe1;return db[_0x3030('0x29')][_0x3030('0x4a')]({'where':{'id':_0x5061e0['params']['id']}})[_0x3030('0x22')](handleEntityNotFound(_0x5ccecc,null))[_0x3030('0x22')](function(_0x5b9cfa){if(_0x5b9cfa){_0x121aa7=_0x5b9cfa;_0x49ecb1[_0x3030('0x2c')]=_['keys'](db[_0x3030('0x4b')][_0x3030('0x2a')]);_0x49ecb1[_0x3030('0x2d')]=_[_0x3030('0x2e')](_0x5061e0[_0x3030('0x2d')]);_0x49ecb1['filters']=_[_0x3030('0x30')](_0x49ecb1[_0x3030('0x2c')],_0x49ecb1[_0x3030('0x2d')]);_0x27fe36[_0x3030('0x31')]=_[_0x3030('0x30')](_0x49ecb1[_0x3030('0x2c')],qs[_0x3030('0x32')](_0x5061e0[_0x3030('0x2d')][_0x3030('0x32')]));_0x27fe36['attributes']=_0x27fe36[_0x3030('0x31')][_0x3030('0x44')]?_0x27fe36[_0x3030('0x31')]:_0x49ecb1[_0x3030('0x2c')];_0x27fe36[_0x3030('0x35')]=qs[_0x3030('0x36')](_0x5061e0[_0x3030('0x2d')][_0x3030('0x36')]);_0x27fe36[_0x3030('0x37')]=qs[_0x3030('0x2f')](_[_0x3030('0x38')](_0x5061e0[_0x3030('0x2d')],_0x49ecb1[_0x3030('0x2f')]));if(_0x5061e0['query'][_0x3030('0x39')]){_0x27fe36['where']=_['merge'](_0x27fe36['where'],{'$or':_['map'](_0x27fe36[_0x3030('0x31')],function(_0x378b7f){var _0x53f4eb={};_0x53f4eb[_0x378b7f]={'$like':'%'+_0x5061e0[_0x3030('0x2d')][_0x3030('0x39')]+'%'};return _0x53f4eb;})});}_0x27fe36=_[_0x3030('0x3a')]({},_0x27fe36,_0x5061e0['options']);return _0x121aa7[_0x3030('0x49')](_0x27fe36);}})[_0x3030('0x22')](function(_0x4a22a0){if(_0x4a22a0){_0x55fbe1=_0x4a22a0['length'];if(!_0x5061e0[_0x3030('0x2d')][_0x3030('0x33')](_0x3030('0x34'))){_0x27fe36['limit']=qs['limit'](_0x5061e0[_0x3030('0x2d')][_0x3030('0x1d')]);_0x27fe36[_0x3030('0x1b')]=qs['offset'](_0x5061e0[_0x3030('0x2d')][_0x3030('0x1b')]);}return _0x121aa7[_0x3030('0x49')](_0x27fe36);}})[_0x3030('0x22')](function(_0x437348){if(_0x437348){return _0x437348?{'count':_0x55fbe1,'rows':_0x437348}:null;}})[_0x3030('0x22')](respondWithResult(_0x5ccecc,null))['catch'](handleError(_0x5ccecc,null));};exports[_0x3030('0x4c')]=function(_0x3a963f,_0x3eda44,_0x454eda){if(_0x3a963f[_0x3030('0x47')]['id']){delete _0x3a963f[_0x3030('0x47')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x3a963f[_0x3030('0x43')]['id']}})[_0x3030('0x22')](handleEntityNotFound(_0x3eda44,null))[_0x3030('0x22')](function(_0x337fa7){if(_0x337fa7){_0x3a963f['body'][_0x3030('0x4d')]=_0x337fa7['id'];_0x3a963f['body'][_0x3030('0x4e')]=integrations[_0x3030('0x4f')](_0x3a963f[_0x3030('0x47')][_0x3030('0x50')],_0x3a963f[_0x3030('0x47')][_0x3030('0x3b')]);_0x3a963f[_0x3030('0x47')][_0x3030('0x51')]=integrations[_0x3030('0x52')](_0x3a963f[_0x3030('0x47')][_0x3030('0x50')],_0x3a963f['body'][_0x3030('0x3b')]);return db['FreshsalesConfiguration'][_0x3030('0x46')](_0x3a963f[_0x3030('0x47')],{'include':[{'model':db[_0x3030('0x53')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0x3030('0x51')}]});}return null;})[_0x3030('0x22')](respondWithResult(_0x3eda44,null))[_0x3030('0x41')](handleError(_0x3eda44,null));};exports[_0x3030('0x54')]=function(_0x2e3e93,_0x485587,_0x2cd05f){var _0x19f760='';var _0x529e7b='';return db[_0x3030('0x29')][_0x3030('0x4a')]({'where':{'id':_0x2e3e93[_0x3030('0x43')]['id']},'attributes':['id',_0x3030('0x55'),'remoteUri',_0x3030('0x56')]})['then'](handleEntityNotFound(_0x485587,null))[_0x3030('0x22')](function(_0x3d673b){if(_0x3d673b){_0x529e7b=_0x3d673b['username'];_0x19f760=_0x3d673b[_0x3030('0x57')];var _0x48f32a=_0x3d673b['remoteUri'][_0x3030('0x58')](-0x1);if(_0x48f32a==='/'){_0x19f760=_0x19f760['substring'](0x0,_0x19f760['lastIndexOf'](_0x48f32a));}return rp({'method':_0x3030('0x59'),'uri':util[_0x3030('0x5a')](_0x3030('0x5b'),_0x19f760,_0x3030('0x5c')),'headers':{'Authorization':_0x3030('0x5d')+_0x3d673b[_0x3030('0x56')]},'json':!![]});}})[_0x3030('0x22')](function(_0x4d5f18){if(_0x4d5f18){var _0x8dd55e=_0x4d5f18[_0x3030('0x5e')];var _0x8e2179=![];var _0x2c7b21=null;for(_0x2c7b21=0x0;_0x2c7b21<_0x8dd55e[_0x3030('0x44')];_0x2c7b21++){if(_0x8dd55e[_0x2c7b21][_0x3030('0x5f')]===_0x529e7b){_0x8e2179=!![];}}if(_0x8e2179){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3030('0x60')});}}})[_0x3030('0x22')](respondWithResult(_0x485587,null))[_0x3030('0x41')](function(_0x7a2424){var _0x156551=_0x2e3e93[_0x3030('0x2d')][_0x3030('0x61')]?0x1f4:_0x7a2424['statusCode']||0x1f4;logger[_0x3030('0x62')](_0x3030('0x63'),_0x3030('0x54'),_0x156551,JSON[_0x3030('0x64')](_0x7a2424));delete _0x7a2424[_0x3030('0x25')];if(_0x156551===0x191){_0x156551=0x190;}_0x485587['status'](_0x156551)[_0x3030('0x26')](_0x2e3e93[_0x3030('0x2d')]['test']?{'message':_0x3030('0x65'),'statusCode':_0x7a2424['statusCode']}:_0x7a2424);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index e90058d..8f95bd0 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 _0x2542=['api','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger'];(function(_0x5e8cac,_0x3bea9e){var _0x3ddd38=function(_0x93a3a6){while(--_0x93a3a6){_0x5e8cac['push'](_0x5e8cac['shift']());}};_0x3ddd38(++_0x3bea9e);}(_0x2542,0x169));var _0x2254=function(_0x275b70,_0x406fcd){_0x275b70=_0x275b70-0x0;var _0x4c6aa8=_0x2542[_0x275b70];return _0x4c6aa8;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));var integrations=require(_0x2254('0x9'));module['exports']=function(_0x19ad3c,_0xe8ca50){return _0x19ad3c[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a55=['define','FreshsalesAccount','int_freshsales_accounts','lodash','moment','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x722103,_0x5732f3){var _0x3e2435=function(_0x44c44a){while(--_0x44c44a){_0x722103['push'](_0x722103['shift']());}};_0x3e2435(++_0x5732f3);}(_0x6a55,0xdb));var _0x56a5=function(_0x2eea9a,_0x368daf){_0x2eea9a=_0x2eea9a-0x0;var _0x1ec61e=_0x6a55[_0x2eea9a];return _0x1ec61e;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56a5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a5('0x2'));var rimraf=require('rimraf');var config=require(_0x56a5('0x3'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x56a5('0x4'));module[_0x56a5('0x5')]=function(_0x42d164,_0x293ea1){return _0x42d164[_0x56a5('0x6')](_0x56a5('0x7'),attributes,{'tableName':_0x56a5('0x8'),'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 be6c1b0..03b4d85 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 _0x524e=['http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFreshsalesAccount','catch','ShowFreshsalesAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x43b1fb,_0x22e01e){var _0x2eb5bc=function(_0x1622a4){while(--_0x1622a4){_0x43b1fb['push'](_0x43b1fb['shift']());}};_0x2eb5bc(++_0x22e01e);}(_0x524e,0x15e));var _0xe524=function(_0x430e48,_0x1c5e4a){_0x430e48=_0x430e48-0x0;var _0x502573=_0x524e[_0x430e48];return _0x502573;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});}exports['GetFreshsalesAccount']=function(_0x3a4027){var _0x4f1dfb=this;return new Promise(function(_0x11b2a1,_0x238f8f){return db[_0xe524('0x16')][_0xe524('0x17')]({'raw':_0x3a4027['options']?_0x3a4027[_0xe524('0x18')][_0xe524('0x19')]===undefined?!![]:![]:!![],'where':_0x3a4027['options']?_0x3a4027[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'attributes':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1b')]||null:null,'limit':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1c')]||null:null,'include':_0x3a4027[_0xe524('0x18')]?_0x3a4027['options'][_0xe524('0x1d')]?_['map'](_0x3a4027['options'][_0xe524('0x1d')],function(_0x23df5e){return{'model':db[_0x23df5e[_0xe524('0x1e')]],'as':_0x23df5e['as'],'attributes':_0x23df5e[_0xe524('0x1b')],'include':_0x23df5e['include']?_[_0xe524('0x1f')](_0x23df5e['include'],function(_0x17e245){return{'model':db[_0x17e245[_0xe524('0x1e')]],'as':_0x17e245['as'],'attributes':_0x17e245[_0xe524('0x1b')],'include':_0x17e245[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x17e245[_0xe524('0x1d')],function(_0x2141db){return{'model':db[_0x2141db['model']],'as':_0x2141db['as'],'attributes':_0x2141db['attributes']};}):[]};}):[]};}):[]:[]})[_0xe524('0xc')](function(_0x45abad){logger[_0xe524('0xd')](_0xe524('0x20'),_0x3a4027);logger[_0xe524('0x10')]('GetFreshsalesAccount',_0x3a4027,JSON['stringify'](_0x45abad));_0x11b2a1(_0x45abad);})[_0xe524('0x21')](function(_0x25e7a7){logger[_0xe524('0x13')](_0xe524('0x20'),_0x25e7a7[_0xe524('0x15')],_0x3a4027);_0x238f8f(_0x4f1dfb['error'](0x1f4,_0x25e7a7[_0xe524('0x15')]));});});};exports[_0xe524('0x22')]=function(_0x4a4e15){var _0x5b7ded=this;return new Promise(function(_0x20688e,_0x376324){return db['FreshsalesAccount'][_0xe524('0x23')]({'raw':_0x4a4e15['options']?_0x4a4e15[_0xe524('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4a4e15[_0xe524('0x18')]?_0x4a4e15[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'attributes':_0x4a4e15['options']?_0x4a4e15[_0xe524('0x18')]['attributes']||null:null,'include':_0x4a4e15[_0xe524('0x18')]?_0x4a4e15[_0xe524('0x18')][_0xe524('0x1d')]?_['map'](_0x4a4e15[_0xe524('0x18')][_0xe524('0x1d')],function(_0x49c43e){return{'model':db[_0x49c43e[_0xe524('0x1e')]],'as':_0x49c43e['as'],'attributes':_0x49c43e[_0xe524('0x1b')],'include':_0x49c43e[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x49c43e['include'],function(_0x415450){return{'model':db[_0x415450[_0xe524('0x1e')]],'as':_0x415450['as'],'attributes':_0x415450[_0xe524('0x1b')],'include':_0x415450[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x415450[_0xe524('0x1d')],function(_0x2741e8){return{'model':db[_0x2741e8[_0xe524('0x1e')]],'as':_0x2741e8['as'],'attributes':_0x2741e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xe524('0xc')](function(_0x56f371){logger[_0xe524('0xd')](_0xe524('0x22'),_0x4a4e15);logger['debug'](_0xe524('0x22'),_0x4a4e15,JSON['stringify'](_0x56f371));_0x20688e(_0x56f371);})[_0xe524('0x21')](function(_0x41af26){logger[_0xe524('0x13')](_0xe524('0x22'),_0x41af26[_0xe524('0x15')],_0x4a4e15);_0x376324(_0x5b7ded[_0xe524('0x13')](0x1f4,_0x41af26[_0xe524('0x15')]));});});}; \ No newline at end of file +var _0xd943=['limit','include','map','model','attributes','debug','ShowFreshsalesAccount','find','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where'];(function(_0x435150,_0x591cd9){var _0x13b3a4=function(_0x44eb28){while(--_0x44eb28){_0x435150['push'](_0x435150['shift']());}};_0x13b3a4(++_0x591cd9);}(_0xd943,0x15d));var _0x3d94=function(_0x2ccfa0,_0x53bc22){_0x2ccfa0=_0x2ccfa0-0x0;var _0x4d0510=_0xd943[_0x2ccfa0];return _0x4d0510;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['findAll']({'raw':_0x2acee3[_0x3d94('0x16')]?_0x2acee3['options'][_0x3d94('0x17')]===undefined?!![]:![]:!![],'where':_0x2acee3[_0x3d94('0x16')]?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x18')]||null:null,'attributes':_0x2acee3[_0x3d94('0x16')]?_0x2acee3['options']['attributes']||null:null,'limit':_0x2acee3[_0x3d94('0x16')]?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x19')]||null:null,'include':_0x2acee3['options']?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x2acee3[_0x3d94('0x16')][_0x3d94('0x1a')],function(_0x4093a4){return{'model':db[_0x4093a4[_0x3d94('0x1c')]],'as':_0x4093a4['as'],'attributes':_0x4093a4[_0x3d94('0x1d')],'include':_0x4093a4[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x4093a4[_0x3d94('0x1a')],function(_0x192839){return{'model':db[_0x192839[_0x3d94('0x1c')]],'as':_0x192839['as'],'attributes':_0x192839[_0x3d94('0x1d')],'include':_0x192839[_0x3d94('0x1a')]?_['map'](_0x192839[_0x3d94('0x1a')],function(_0x558fd2){return{'model':db[_0x558fd2[_0x3d94('0x1c')]],'as':_0x558fd2['as'],'attributes':_0x558fd2[_0x3d94('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3d94('0xa')](function(_0x439173){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1e')]('GetFreshsalesAccount',_0x2acee3,JSON['stringify'](_0x439173));_0x4afc92(_0x439173);})[_0x3d94('0x13')](function(_0x4813e1){logger['error'](_0x3d94('0x14'),_0x4813e1['message'],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0x4813e1[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1f')]=function(_0x4cef9c){var _0x2a07b4=this;return new Promise(function(_0x4c1237,_0x3d4994){return db['FreshsalesAccount'][_0x3d94('0x20')]({'raw':_0x4cef9c[_0x3d94('0x16')]?_0x4cef9c[_0x3d94('0x16')][_0x3d94('0x17')]===undefined?!![]:![]:!![],'where':_0x4cef9c['options']?_0x4cef9c[_0x3d94('0x16')]['where']||null:null,'attributes':_0x4cef9c[_0x3d94('0x16')]?_0x4cef9c[_0x3d94('0x16')]['attributes']||null:null,'include':_0x4cef9c['options']?_0x4cef9c[_0x3d94('0x16')][_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x4cef9c['options'][_0x3d94('0x1a')],function(_0x3d29fd){return{'model':db[_0x3d29fd['model']],'as':_0x3d29fd['as'],'attributes':_0x3d29fd[_0x3d94('0x1d')],'include':_0x3d29fd[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x3d29fd[_0x3d94('0x1a')],function(_0x782c1){return{'model':db[_0x782c1['model']],'as':_0x782c1['as'],'attributes':_0x782c1[_0x3d94('0x1d')],'include':_0x782c1[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x782c1[_0x3d94('0x1a')],function(_0xb493f1){return{'model':db[_0xb493f1[_0x3d94('0x1c')]],'as':_0xb493f1['as'],'attributes':_0xb493f1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfe58eb){logger[_0x3d94('0xb')](_0x3d94('0x1f'),_0x4cef9c);logger[_0x3d94('0x1e')](_0x3d94('0x1f'),_0x4cef9c,JSON[_0x3d94('0x21')](_0xfe58eb));_0x4c1237(_0xfe58eb);})[_0x3d94('0x13')](function(_0x12c01a){logger[_0x3d94('0xe')](_0x3d94('0x1f'),_0x12c01a['message'],_0x4cef9c);_0x3d4994(_0x2a07b4[_0x3d94('0xe')](0x1f4,_0x12c01a[_0x3d94('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index c27f2a3..0666f26 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 _0xb063=['getDescriptions','/:id/fields','getFields','post','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x19a59e,_0x17c763){var _0x4b87ae=function(_0x1778b3){while(--_0x1778b3){_0x19a59e['push'](_0x19a59e['shift']());}};_0x4b87ae(++_0x17c763);}(_0xb063,0x75));var _0x3b06=function(_0x47990b,_0xf722d6){_0x47990b=_0x47990b-0x0;var _0x57bb0a=_0xb063[_0x47990b];return _0x57bb0a;};'use strict';var multer=require(_0x3b06('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3b06('0x1'));var express=require(_0x3b06('0x2'));var router=express['Router']();var fs_extra=require(_0x3b06('0x3'));var auth=require(_0x3b06('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3b06('0x5'));var controller=require(_0x3b06('0x6'));router['get']('/',auth[_0x3b06('0x7')](),controller[_0x3b06('0x8')]);router[_0x3b06('0x9')](_0x3b06('0xa'),auth['isAuthenticated'](),controller[_0x3b06('0xb')]);router[_0x3b06('0x9')](_0x3b06('0xc'),auth[_0x3b06('0x7')](),controller[_0x3b06('0xd')]);router[_0x3b06('0x9')](_0x3b06('0xe'),auth['isAuthenticated'](),controller[_0x3b06('0xf')]);router[_0x3b06('0x9')](_0x3b06('0x10'),auth[_0x3b06('0x7')](),controller[_0x3b06('0x11')]);router[_0x3b06('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3b06('0xa'),auth[_0x3b06('0x7')](),controller['update']);router[_0x3b06('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3b06('0x14')]);module[_0x3b06('0x15')]=router; \ No newline at end of file +var _0x2013=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x2013,0x111));var _0x3201=function(_0x1dcd67,_0x35d318){_0x1dcd67=_0x1dcd67-0x0;var _0x4b21e0=_0x2013[_0x1dcd67];return _0x4b21e0;};'use strict';var multer=require(_0x3201('0x0'));var util=require(_0x3201('0x1'));var path=require(_0x3201('0x2'));var timeout=require(_0x3201('0x3'));var express=require('express');var router=express[_0x3201('0x4')]();var fs_extra=require(_0x3201('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3201('0x6'));var config=require(_0x3201('0x7'));var controller=require(_0x3201('0x8'));router[_0x3201('0x9')]('/',auth[_0x3201('0xa')](),controller['index']);router[_0x3201('0x9')](_0x3201('0xb'),auth[_0x3201('0xa')](),controller[_0x3201('0xc')]);router[_0x3201('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x3201('0xd'),auth[_0x3201('0xa')](),controller[_0x3201('0xe')]);router[_0x3201('0x9')](_0x3201('0xf'),auth[_0x3201('0xa')](),controller[_0x3201('0x10')]);router[_0x3201('0x11')]('/',auth[_0x3201('0xa')](),controller[_0x3201('0x12')]);router[_0x3201('0x13')](_0x3201('0xb'),auth[_0x3201('0xa')](),controller['update']);router[_0x3201('0x14')]('/:id',auth[_0x3201('0xa')](),controller[_0x3201('0x15')]);module[_0x3201('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 272d34b..6ca972e 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 _0x4c51=['STRING','exports'];(function(_0x32c35f,_0x21425d){var _0x48c9b2=function(_0x5480e7){while(--_0x5480e7){_0x32c35f['push'](_0x32c35f['shift']());}};_0x48c9b2(++_0x21425d);}(_0x4c51,0x173));var _0x14c5=function(_0x106e72,_0x271e38){_0x106e72=_0x106e72-0x0;var _0x5aa7f6=_0x4c51[_0x106e72];return _0x5aa7f6;};'use strict';var Sequelize=require('sequelize');module[_0x14c5('0x0')]={'name':{'type':Sequelize[_0x14c5('0x1')]},'description':{'type':Sequelize[_0x14c5('0x1')]}}; \ No newline at end of file +var _0x0ade=['STRING'];(function(_0x188c88,_0x210793){var _0x4e4c38=function(_0x3d9e41){while(--_0x3d9e41){_0x188c88['push'](_0x188c88['shift']());}};_0x4e4c38(++_0x210793);}(_0x0ade,0x82));var _0xe0ad=function(_0xc94f90,_0x5d7f52){_0xc94f90=_0xc94f90-0x0;var _0x546e42=_0x0ade[_0xc94f90];return _0x546e42;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe0ad('0x0')]},'description':{'type':Sequelize[_0xe0ad('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index a3aca23..d2fb2de 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 _0x7e70=['include','findAll','rows','catch','show','length','options','find','create','body','params','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','end','error','stack','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','map','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7e70,0x1f1));var _0x07e7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e70[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07e7('0x0'));var zipdir=require(_0x07e7('0x1'));var jsonpatch=require(_0x07e7('0x2'));var rp=require('request-promise');var moment=require(_0x07e7('0x3'));var BPromise=require(_0x07e7('0x4'));var Mustache=require(_0x07e7('0x5'));var util=require(_0x07e7('0x6'));var path=require(_0x07e7('0x7'));var sox=require(_0x07e7('0x8'));var csv=require(_0x07e7('0x9'));var ejs=require(_0x07e7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x07e7('0xb'));var squel=require(_0x07e7('0xc'));var crypto=require(_0x07e7('0xd'));var jsforce=require(_0x07e7('0xe'));var deskjs=require(_0x07e7('0xf'));var toCsv=require(_0x07e7('0x9'));var querystring=require(_0x07e7('0x10'));var Papa=require(_0x07e7('0x11'));var Redis=require(_0x07e7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x07e7('0x13'));var as=require(_0x07e7('0x14'));var hardwareService=require(_0x07e7('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x07e7('0x16'));var config=require(_0x07e7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x07e7('0x18'))['db'];function respondWithStatusCode(_0x3cbd2f,_0x2d0e82){_0x2d0e82=_0x2d0e82||0xcc;return function(_0xf1e529){if(_0xf1e529){return _0x3cbd2f[_0x07e7('0x19')](_0x2d0e82);}return _0x3cbd2f['status'](_0x2d0e82)['end']();};}function respondWithResult(_0x5c3f12,_0x429cd2){_0x429cd2=_0x429cd2||0xc8;return function(_0x20722c){if(_0x20722c){return _0x5c3f12[_0x07e7('0x1a')](_0x429cd2)[_0x07e7('0x1b')](_0x20722c);}};}function respondWithFilteredResult(_0x33c761,_0x484561){return function(_0x363900){if(_0x363900){var _0x2b5b6a=typeof _0x484561[_0x07e7('0x1c')]===_0x07e7('0x1d')&&typeof _0x484561[_0x07e7('0x1e')]==='undefined';var _0xc3e401=_0x363900[_0x07e7('0x1f')];var _0x9e0c02=_0x2b5b6a?0x0:_0x484561[_0x07e7('0x1c')];var _0x4f239c=_0x2b5b6a?_0x363900[_0x07e7('0x1f')]:_0x484561[_0x07e7('0x1c')]+_0x484561[_0x07e7('0x1e')];var _0x4c4cb7;if(_0x4f239c>=_0xc3e401){_0x4f239c=_0xc3e401;_0x4c4cb7=0xc8;}else{_0x4c4cb7=0xce;}_0x33c761[_0x07e7('0x1a')](_0x4c4cb7);return _0x33c761['set'](_0x07e7('0x20'),_0x9e0c02+'-'+_0x4f239c+'/'+_0xc3e401)[_0x07e7('0x1b')](_0x363900);}return null;};}function patchUpdates(_0xf43bf7){return function(_0x12dbea){try{jsonpatch['apply'](_0x12dbea,_0xf43bf7,!![]);}catch(_0x5288c3){return BPromise[_0x07e7('0x21')](_0x5288c3);}return _0x12dbea['save']();};}function saveUpdates(_0x25ff48,_0x170412){return function(_0x561b0d){if(_0x561b0d){return _0x561b0d[_0x07e7('0x22')](_0x25ff48)[_0x07e7('0x23')](function(_0x20e122){return _0x20e122;});}return null;};}function removeEntity(_0x248464,_0x2ddbda){return function(_0xaf0a7e){if(_0xaf0a7e){return _0xaf0a7e[_0x07e7('0x24')]()[_0x07e7('0x23')](function(){_0x248464[_0x07e7('0x1a')](0xcc)[_0x07e7('0x25')]();});}};}function handleEntityNotFound(_0x3ba03b,_0x47f8c1){return function(_0x201129){if(!_0x201129){_0x3ba03b[_0x07e7('0x19')](0x194);}return _0x201129;};}function handleError(_0x36cea8,_0x5c9221){_0x5c9221=_0x5c9221||0x1f4;return function(_0x207c41){logger[_0x07e7('0x26')](_0x207c41[_0x07e7('0x27')]);if(_0x207c41['name']){delete _0x207c41['name'];}_0x36cea8[_0x07e7('0x1a')](_0x5c9221)[_0x07e7('0x28')](_0x207c41);};}exports[_0x07e7('0x29')]=function(_0x5989d9,_0x64f62b){var _0x3f3eab={},_0x257c92={},_0x383c2d={'count':0x0,'rows':[]};var _0x30b712=_['map'](db[_0x07e7('0x2a')][_0x07e7('0x2b')],function(_0x545abc){return{'name':_0x545abc[_0x07e7('0x2c')],'type':_0x545abc[_0x07e7('0x2d')]['key']};});_0x257c92['model']=_[_0x07e7('0x2e')](_0x30b712,_0x07e7('0x2f'));_0x257c92[_0x07e7('0x30')]=_[_0x07e7('0x31')](_0x5989d9[_0x07e7('0x30')]);_0x257c92[_0x07e7('0x32')]=_[_0x07e7('0x33')](_0x257c92[_0x07e7('0x34')],_0x257c92[_0x07e7('0x30')]);_0x3f3eab[_0x07e7('0x35')]=_[_0x07e7('0x33')](_0x257c92[_0x07e7('0x34')],qs[_0x07e7('0x36')](_0x5989d9['query'][_0x07e7('0x36')]));_0x3f3eab['attributes']=_0x3f3eab['attributes']['length']?_0x3f3eab[_0x07e7('0x35')]:_0x257c92['model'];if(!_0x5989d9[_0x07e7('0x30')][_0x07e7('0x37')](_0x07e7('0x38'))){_0x3f3eab[_0x07e7('0x1e')]=qs['limit'](_0x5989d9[_0x07e7('0x30')]['limit']);_0x3f3eab[_0x07e7('0x1c')]=qs[_0x07e7('0x1c')](_0x5989d9[_0x07e7('0x30')][_0x07e7('0x1c')]);}_0x3f3eab[_0x07e7('0x39')]=qs[_0x07e7('0x3a')](_0x5989d9[_0x07e7('0x30')][_0x07e7('0x3a')]);_0x3f3eab[_0x07e7('0x3b')]=qs['filters'](_['pick'](_0x5989d9[_0x07e7('0x30')],_0x257c92['filters']),_0x30b712);if(_0x5989d9[_0x07e7('0x30')]['filter']){_0x3f3eab[_0x07e7('0x3b')]=_['merge'](_0x3f3eab[_0x07e7('0x3b')],{'$or':_[_0x07e7('0x2e')](_0x30b712,function(_0x48780d){if(_0x48780d[_0x07e7('0x2d')]!=='VIRTUAL'){var _0x2a2fee={};_0x2a2fee[_0x48780d[_0x07e7('0x2f')]]={'$like':'%'+_0x5989d9['query'][_0x07e7('0x3c')]+'%'};return _0x2a2fee;}})});}_0x3f3eab=_[_0x07e7('0x3d')]({},_0x3f3eab,_0x5989d9['options']);var _0x312ccf={'where':_0x3f3eab[_0x07e7('0x3b')]};return db[_0x07e7('0x2a')]['count'](_0x312ccf)['then'](function(_0x5509e4){_0x383c2d[_0x07e7('0x1f')]=_0x5509e4;if(_0x5989d9['query'][_0x07e7('0x3e')]){_0x3f3eab[_0x07e7('0x3f')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x07e7('0x40')](_0x3f3eab);})[_0x07e7('0x23')](function(_0x4a919d){_0x383c2d[_0x07e7('0x41')]=_0x4a919d;return _0x383c2d;})['then'](respondWithFilteredResult(_0x64f62b,_0x3f3eab))[_0x07e7('0x42')](handleError(_0x64f62b,null));};exports[_0x07e7('0x43')]=function(_0x156f77,_0x358ce1){var _0x10c9ba={'raw':![],'where':{'id':_0x156f77['params']['id']}},_0x3c4ccc={};_0x3c4ccc[_0x07e7('0x34')]=_['keys'](db[_0x07e7('0x2a')][_0x07e7('0x2b')]);_0x3c4ccc['query']=_[_0x07e7('0x31')](_0x156f77[_0x07e7('0x30')]);_0x3c4ccc['filters']=_[_0x07e7('0x33')](_0x3c4ccc[_0x07e7('0x34')],_0x3c4ccc['query']);_0x10c9ba['attributes']=_['intersection'](_0x3c4ccc[_0x07e7('0x34')],qs[_0x07e7('0x36')](_0x156f77['query'][_0x07e7('0x36')]));_0x10c9ba[_0x07e7('0x35')]=_0x10c9ba['attributes'][_0x07e7('0x44')]?_0x10c9ba['attributes']:_0x3c4ccc[_0x07e7('0x34')];if(_0x156f77[_0x07e7('0x30')][_0x07e7('0x3e')]){_0x10c9ba[_0x07e7('0x3f')]=[{'all':!![]}];}_0x10c9ba=_['merge']({},_0x10c9ba,_0x156f77[_0x07e7('0x45')]);return db[_0x07e7('0x2a')][_0x07e7('0x46')](_0x10c9ba)[_0x07e7('0x23')](handleEntityNotFound(_0x358ce1,null))[_0x07e7('0x23')](respondWithResult(_0x358ce1,null))[_0x07e7('0x42')](handleError(_0x358ce1,null));};exports['create']=function(_0x5206c4,_0x42e439){return db[_0x07e7('0x2a')][_0x07e7('0x47')](_0x5206c4[_0x07e7('0x48')],{})['then'](respondWithResult(_0x42e439,0xc9))[_0x07e7('0x42')](handleError(_0x42e439,null));};exports[_0x07e7('0x22')]=function(_0x3f00ec,_0x17527c){if(_0x3f00ec[_0x07e7('0x48')]['id']){delete _0x3f00ec['body']['id'];}return db[_0x07e7('0x2a')][_0x07e7('0x46')]({'where':{'id':_0x3f00ec[_0x07e7('0x49')]['id']}})[_0x07e7('0x23')](handleEntityNotFound(_0x17527c,null))['then'](saveUpdates(_0x3f00ec[_0x07e7('0x48')],null))[_0x07e7('0x23')](respondWithResult(_0x17527c,null))[_0x07e7('0x42')](handleError(_0x17527c,null));};exports[_0x07e7('0x24')]=function(_0x529186,_0x365b07){return db[_0x07e7('0x2a')][_0x07e7('0x46')]({'where':{'id':_0x529186['params']['id']}})[_0x07e7('0x23')](handleEntityNotFound(_0x365b07,null))['then'](removeEntity(_0x365b07,null))[_0x07e7('0x42')](handleError(_0x365b07,null));};exports[_0x07e7('0x4a')]=function(_0xfd48ca,_0xce97ad,_0x3d716f){var _0x46c45a={};var _0x35e6e6={};var _0x4fa367;var _0x17287e;return db['FreshsalesConfiguration'][_0x07e7('0x4b')]({'where':{'id':_0xfd48ca[_0x07e7('0x49')]['id']}})[_0x07e7('0x23')](handleEntityNotFound(_0xce97ad,null))['then'](function(_0x564a52){if(_0x564a52){_0x4fa367=_0x564a52;_0x35e6e6[_0x07e7('0x34')]=_[_0x07e7('0x31')](db[_0x07e7('0x4c')][_0x07e7('0x2b')]);_0x35e6e6[_0x07e7('0x30')]=_[_0x07e7('0x31')](_0xfd48ca[_0x07e7('0x30')]);_0x35e6e6[_0x07e7('0x32')]=_[_0x07e7('0x33')](_0x35e6e6[_0x07e7('0x34')],_0x35e6e6[_0x07e7('0x30')]);_0x46c45a[_0x07e7('0x35')]=_[_0x07e7('0x33')](_0x35e6e6['model'],qs[_0x07e7('0x36')](_0xfd48ca[_0x07e7('0x30')][_0x07e7('0x36')]));_0x46c45a[_0x07e7('0x35')]=_0x46c45a['attributes'][_0x07e7('0x44')]?_0x46c45a['attributes']:_0x35e6e6[_0x07e7('0x34')];_0x46c45a[_0x07e7('0x39')]=qs[_0x07e7('0x3a')](_0xfd48ca[_0x07e7('0x30')][_0x07e7('0x3a')]);_0x46c45a[_0x07e7('0x3b')]=qs[_0x07e7('0x32')](_[_0x07e7('0x4d')](_0xfd48ca[_0x07e7('0x30')],_0x35e6e6[_0x07e7('0x32')]));if(_0xfd48ca[_0x07e7('0x30')][_0x07e7('0x3c')]){_0x46c45a[_0x07e7('0x3b')]=_['merge'](_0x46c45a['where'],{'$or':_[_0x07e7('0x2e')](_0x46c45a[_0x07e7('0x35')],function(_0x44b964){var _0x2a5452={};_0x2a5452[_0x44b964]={'$like':'%'+_0xfd48ca['query'][_0x07e7('0x3c')]+'%'};return _0x2a5452;})});}_0x46c45a=_[_0x07e7('0x3d')]({},_0x46c45a,_0xfd48ca[_0x07e7('0x45')]);return _0x4fa367[_0x07e7('0x4a')](_0x46c45a);}})['then'](function(_0x81871b){if(_0x81871b){_0x17287e=_0x81871b['length'];if(!_0xfd48ca['query'][_0x07e7('0x37')](_0x07e7('0x38'))){_0x46c45a[_0x07e7('0x1e')]=qs[_0x07e7('0x1e')](_0xfd48ca[_0x07e7('0x30')]['limit']);_0x46c45a['offset']=qs[_0x07e7('0x1c')](_0xfd48ca[_0x07e7('0x30')]['offset']);}return _0x4fa367[_0x07e7('0x4a')](_0x46c45a);}})[_0x07e7('0x23')](function(_0x154cf4){if(_0x154cf4){return _0x154cf4?{'count':_0x17287e,'rows':_0x154cf4}:null;}})[_0x07e7('0x23')](respondWithResult(_0xce97ad,null))[_0x07e7('0x42')](handleError(_0xce97ad,null));};exports[_0x07e7('0x4e')]=function(_0x30f930,_0x5c8091,_0x34a94f){var _0x12cdef={};var _0x468c16={};var _0x47144c;var _0x9e14f2;return db[_0x07e7('0x2a')]['findOne']({'where':{'id':_0x30f930['params']['id']}})['then'](handleEntityNotFound(_0x5c8091,null))['then'](function(_0x1465bc){if(_0x1465bc){_0x47144c=_0x1465bc;_0x468c16[_0x07e7('0x34')]=_[_0x07e7('0x31')](db['FreshsalesField'][_0x07e7('0x2b')]);_0x468c16['query']=_[_0x07e7('0x31')](_0x30f930[_0x07e7('0x30')]);_0x468c16[_0x07e7('0x32')]=_[_0x07e7('0x33')](_0x468c16[_0x07e7('0x34')],_0x468c16[_0x07e7('0x30')]);_0x12cdef['attributes']=_[_0x07e7('0x33')](_0x468c16[_0x07e7('0x34')],qs['fields'](_0x30f930['query'][_0x07e7('0x36')]));_0x12cdef[_0x07e7('0x35')]=_0x12cdef[_0x07e7('0x35')]['length']?_0x12cdef[_0x07e7('0x35')]:_0x468c16[_0x07e7('0x34')];_0x12cdef['order']=qs[_0x07e7('0x3a')](_0x30f930[_0x07e7('0x30')][_0x07e7('0x3a')]);_0x12cdef[_0x07e7('0x3b')]=qs[_0x07e7('0x32')](_['pick'](_0x30f930[_0x07e7('0x30')],_0x468c16['filters']));if(_0x30f930[_0x07e7('0x30')]['filter']){_0x12cdef[_0x07e7('0x3b')]=_[_0x07e7('0x3d')](_0x12cdef[_0x07e7('0x3b')],{'$or':_[_0x07e7('0x2e')](_0x12cdef[_0x07e7('0x35')],function(_0x4b45b8){var _0x2f443f={};_0x2f443f[_0x4b45b8]={'$like':'%'+_0x30f930['query']['filter']+'%'};return _0x2f443f;})});}_0x12cdef=_[_0x07e7('0x3d')]({},_0x12cdef,_0x30f930[_0x07e7('0x45')]);return _0x47144c['getDescriptions'](_0x12cdef);}})[_0x07e7('0x23')](function(_0x376c99){if(_0x376c99){_0x9e14f2=_0x376c99[_0x07e7('0x44')];if(!_0x30f930[_0x07e7('0x30')][_0x07e7('0x37')](_0x07e7('0x38'))){_0x12cdef[_0x07e7('0x1e')]=qs[_0x07e7('0x1e')](_0x30f930['query'][_0x07e7('0x1e')]);_0x12cdef[_0x07e7('0x1c')]=qs[_0x07e7('0x1c')](_0x30f930['query'][_0x07e7('0x1c')]);}return _0x47144c[_0x07e7('0x4e')](_0x12cdef);}})['then'](function(_0x3dc7cf){if(_0x3dc7cf){return _0x3dc7cf?{'count':_0x9e14f2,'rows':_0x3dc7cf}:null;}})['then'](respondWithResult(_0x5c8091,null))[_0x07e7('0x42')](handleError(_0x5c8091,null));};exports['getFields']=function(_0x25ffe9,_0x351adc,_0x49d4c9){var _0x3c90b7={};var _0x14358a={};var _0x3e37ab;var _0x1d6014;return db[_0x07e7('0x2a')][_0x07e7('0x4b')]({'where':{'id':_0x25ffe9['params']['id']}})[_0x07e7('0x23')](handleEntityNotFound(_0x351adc,null))[_0x07e7('0x23')](function(_0x398d14){if(_0x398d14){_0x3e37ab=_0x398d14;_0x14358a['model']=_[_0x07e7('0x31')](db[_0x07e7('0x4c')]['rawAttributes']);_0x14358a['query']=_[_0x07e7('0x31')](_0x25ffe9[_0x07e7('0x30')]);_0x14358a['filters']=_[_0x07e7('0x33')](_0x14358a['model'],_0x14358a[_0x07e7('0x30')]);_0x3c90b7['attributes']=_[_0x07e7('0x33')](_0x14358a[_0x07e7('0x34')],qs[_0x07e7('0x36')](_0x25ffe9[_0x07e7('0x30')][_0x07e7('0x36')]));_0x3c90b7[_0x07e7('0x35')]=_0x3c90b7[_0x07e7('0x35')][_0x07e7('0x44')]?_0x3c90b7[_0x07e7('0x35')]:_0x14358a[_0x07e7('0x34')];_0x3c90b7[_0x07e7('0x39')]=qs[_0x07e7('0x3a')](_0x25ffe9[_0x07e7('0x30')][_0x07e7('0x3a')]);_0x3c90b7[_0x07e7('0x3b')]=qs[_0x07e7('0x32')](_[_0x07e7('0x4d')](_0x25ffe9[_0x07e7('0x30')],_0x14358a[_0x07e7('0x32')]));if(_0x25ffe9[_0x07e7('0x30')]['filter']){_0x3c90b7[_0x07e7('0x3b')]=_[_0x07e7('0x3d')](_0x3c90b7[_0x07e7('0x3b')],{'$or':_[_0x07e7('0x2e')](_0x3c90b7[_0x07e7('0x35')],function(_0x462008){var _0x1dc1ec={};_0x1dc1ec[_0x462008]={'$like':'%'+_0x25ffe9[_0x07e7('0x30')][_0x07e7('0x3c')]+'%'};return _0x1dc1ec;})});}_0x3c90b7=_[_0x07e7('0x3d')]({},_0x3c90b7,_0x25ffe9['options']);return _0x3e37ab[_0x07e7('0x4f')](_0x3c90b7);}})[_0x07e7('0x23')](function(_0x55bd1){if(_0x55bd1){_0x1d6014=_0x55bd1[_0x07e7('0x44')];if(!_0x25ffe9['query'][_0x07e7('0x37')](_0x07e7('0x38'))){_0x3c90b7[_0x07e7('0x1e')]=qs[_0x07e7('0x1e')](_0x25ffe9[_0x07e7('0x30')][_0x07e7('0x1e')]);_0x3c90b7[_0x07e7('0x1c')]=qs[_0x07e7('0x1c')](_0x25ffe9[_0x07e7('0x30')][_0x07e7('0x1c')]);}return _0x3e37ab['getFields'](_0x3c90b7);}})[_0x07e7('0x23')](function(_0x876397){if(_0x876397){return _0x876397?{'count':_0x1d6014,'rows':_0x876397}:null;}})[_0x07e7('0x23')](respondWithResult(_0x351adc,null))[_0x07e7('0x42')](handleError(_0x351adc,null));}; \ No newline at end of file +var _0x4be7=['end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x4be7,0x16f));var _0x74be=function(_0x3500f2,_0x142fb1){_0x3500f2=_0x3500f2-0x0;var _0x7ad03f=_0x4be7[_0x3500f2];return _0x7ad03f;};'use strict';var emlformat=require(_0x74be('0x0'));var rimraf=require(_0x74be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x74be('0x2'));var moment=require(_0x74be('0x3'));var BPromise=require(_0x74be('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x74be('0x5'));var sox=require(_0x74be('0x6'));var csv=require(_0x74be('0x7'));var ejs=require(_0x74be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74be('0x9'));var squel=require('squel');var crypto=require(_0x74be('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x74be('0xb'));var toCsv=require(_0x74be('0x7'));var querystring=require(_0x74be('0xc'));var Papa=require(_0x74be('0xd'));var Redis=require(_0x74be('0xe'));var authService=require(_0x74be('0xf'));var qs=require(_0x74be('0x10'));var as=require(_0x74be('0x11'));var hardwareService=require(_0x74be('0x12'));var logger=require(_0x74be('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x74be('0x14'))['db'];function respondWithStatusCode(_0xb266da,_0x10b23b){_0x10b23b=_0x10b23b||0xcc;return function(_0x474e8c){if(_0x474e8c){return _0xb266da[_0x74be('0x15')](_0x10b23b);}return _0xb266da[_0x74be('0x16')](_0x10b23b)[_0x74be('0x17')]();};}function respondWithResult(_0x2fa66c,_0x13d628){_0x13d628=_0x13d628||0xc8;return function(_0x206d46){if(_0x206d46){return _0x2fa66c[_0x74be('0x16')](_0x13d628)['json'](_0x206d46);}};}function respondWithFilteredResult(_0x5bfa13,_0x4909ad){return function(_0x52c2d5){if(_0x52c2d5){var _0x2fda71=typeof _0x4909ad[_0x74be('0x18')]===_0x74be('0x19')&&typeof _0x4909ad[_0x74be('0x1a')]==='undefined';var _0x585f54=_0x52c2d5['count'];var _0x6def45=_0x2fda71?0x0:_0x4909ad['offset'];var _0x4e46d0=_0x2fda71?_0x52c2d5[_0x74be('0x1b')]:_0x4909ad[_0x74be('0x18')]+_0x4909ad['limit'];var _0x44cf60;if(_0x4e46d0>=_0x585f54){_0x4e46d0=_0x585f54;_0x44cf60=0xc8;}else{_0x44cf60=0xce;}_0x5bfa13[_0x74be('0x16')](_0x44cf60);return _0x5bfa13[_0x74be('0x1c')](_0x74be('0x1d'),_0x6def45+'-'+_0x4e46d0+'/'+_0x585f54)[_0x74be('0x1e')](_0x52c2d5);}return null;};}function patchUpdates(_0x44d458){return function(_0x4ec0d5){try{jsonpatch[_0x74be('0x1f')](_0x4ec0d5,_0x44d458,!![]);}catch(_0x532923){return BPromise[_0x74be('0x20')](_0x532923);}return _0x4ec0d5[_0x74be('0x21')]();};}function saveUpdates(_0x150057,_0x4ecb78){return function(_0x22c3d8){if(_0x22c3d8){return _0x22c3d8[_0x74be('0x22')](_0x150057)[_0x74be('0x23')](function(_0x2d2a5b){return _0x2d2a5b;});}return null;};}function removeEntity(_0x166e09,_0x372cb3){return function(_0x274878){if(_0x274878){return _0x274878[_0x74be('0x24')]()['then'](function(){_0x166e09[_0x74be('0x16')](0xcc)[_0x74be('0x17')]();});}};}function handleEntityNotFound(_0x336978,_0x3ac6c8){return function(_0x5d88f6){if(!_0x5d88f6){_0x336978[_0x74be('0x15')](0x194);}return _0x5d88f6;};}function handleError(_0x5b8633,_0x1d815f){_0x1d815f=_0x1d815f||0x1f4;return function(_0xf6fc30){logger[_0x74be('0x25')](_0xf6fc30[_0x74be('0x26')]);if(_0xf6fc30['name']){delete _0xf6fc30[_0x74be('0x27')];}_0x5b8633[_0x74be('0x16')](_0x1d815f)[_0x74be('0x28')](_0xf6fc30);};}exports[_0x74be('0x29')]=function(_0x173b8e,_0x184a5c){var _0x566098={},_0xa85903={},_0xe68c6c={'count':0x0,'rows':[]};var _0x30ea93=_[_0x74be('0x2a')](db[_0x74be('0x2b')][_0x74be('0x2c')],function(_0x546c81){return{'name':_0x546c81['fieldName'],'type':_0x546c81[_0x74be('0x2d')][_0x74be('0x2e')]};});_0xa85903['model']=_['map'](_0x30ea93,_0x74be('0x27'));_0xa85903['query']=_[_0x74be('0x2f')](_0x173b8e[_0x74be('0x30')]);_0xa85903[_0x74be('0x31')]=_[_0x74be('0x32')](_0xa85903[_0x74be('0x33')],_0xa85903[_0x74be('0x30')]);_0x566098[_0x74be('0x34')]=_['intersection'](_0xa85903['model'],qs[_0x74be('0x35')](_0x173b8e[_0x74be('0x30')][_0x74be('0x35')]));_0x566098[_0x74be('0x34')]=_0x566098[_0x74be('0x34')][_0x74be('0x36')]?_0x566098[_0x74be('0x34')]:_0xa85903[_0x74be('0x33')];if(!_0x173b8e['query']['hasOwnProperty'](_0x74be('0x37'))){_0x566098[_0x74be('0x1a')]=qs[_0x74be('0x1a')](_0x173b8e[_0x74be('0x30')][_0x74be('0x1a')]);_0x566098[_0x74be('0x18')]=qs[_0x74be('0x18')](_0x173b8e[_0x74be('0x30')][_0x74be('0x18')]);}_0x566098['order']=qs['sort'](_0x173b8e[_0x74be('0x30')][_0x74be('0x38')]);_0x566098[_0x74be('0x39')]=qs[_0x74be('0x31')](_[_0x74be('0x3a')](_0x173b8e[_0x74be('0x30')],_0xa85903[_0x74be('0x31')]),_0x30ea93);if(_0x173b8e[_0x74be('0x30')][_0x74be('0x3b')]){_0x566098['where']=_[_0x74be('0x3c')](_0x566098[_0x74be('0x39')],{'$or':_[_0x74be('0x2a')](_0x30ea93,function(_0x566818){if(_0x566818[_0x74be('0x2d')]!=='VIRTUAL'){var _0x3bdc15={};_0x3bdc15[_0x566818[_0x74be('0x27')]]={'$like':'%'+_0x173b8e[_0x74be('0x30')][_0x74be('0x3b')]+'%'};return _0x3bdc15;}})});}_0x566098=_[_0x74be('0x3c')]({},_0x566098,_0x173b8e['options']);var _0x5a687d={'where':_0x566098[_0x74be('0x39')]};return db['FreshsalesConfiguration']['count'](_0x5a687d)[_0x74be('0x23')](function(_0x37e752){_0xe68c6c['count']=_0x37e752;if(_0x173b8e[_0x74be('0x30')][_0x74be('0x3d')]){_0x566098[_0x74be('0x3e')]=[{'all':!![]}];}return db[_0x74be('0x2b')][_0x74be('0x3f')](_0x566098);})[_0x74be('0x23')](function(_0x2925ef){_0xe68c6c[_0x74be('0x40')]=_0x2925ef;return _0xe68c6c;})[_0x74be('0x23')](respondWithFilteredResult(_0x184a5c,_0x566098))[_0x74be('0x41')](handleError(_0x184a5c,null));};exports[_0x74be('0x42')]=function(_0x327295,_0x18de8e){var _0x2f8f69={'raw':![],'where':{'id':_0x327295[_0x74be('0x43')]['id']}},_0x49154a={};_0x49154a['model']=_[_0x74be('0x2f')](db['FreshsalesConfiguration'][_0x74be('0x2c')]);_0x49154a[_0x74be('0x30')]=_[_0x74be('0x2f')](_0x327295[_0x74be('0x30')]);_0x49154a[_0x74be('0x31')]=_[_0x74be('0x32')](_0x49154a[_0x74be('0x33')],_0x49154a['query']);_0x2f8f69[_0x74be('0x34')]=_[_0x74be('0x32')](_0x49154a[_0x74be('0x33')],qs[_0x74be('0x35')](_0x327295['query'][_0x74be('0x35')]));_0x2f8f69[_0x74be('0x34')]=_0x2f8f69[_0x74be('0x34')][_0x74be('0x36')]?_0x2f8f69[_0x74be('0x34')]:_0x49154a[_0x74be('0x33')];if(_0x327295['query']['includeAll']){_0x2f8f69['include']=[{'all':!![]}];}_0x2f8f69=_[_0x74be('0x3c')]({},_0x2f8f69,_0x327295[_0x74be('0x44')]);return db[_0x74be('0x2b')]['find'](_0x2f8f69)[_0x74be('0x23')](handleEntityNotFound(_0x18de8e,null))[_0x74be('0x23')](respondWithResult(_0x18de8e,null))[_0x74be('0x41')](handleError(_0x18de8e,null));};exports[_0x74be('0x45')]=function(_0x1dce69,_0x3fb867){return db[_0x74be('0x2b')][_0x74be('0x45')](_0x1dce69[_0x74be('0x46')],{})[_0x74be('0x23')](respondWithResult(_0x3fb867,0xc9))[_0x74be('0x41')](handleError(_0x3fb867,null));};exports['update']=function(_0x36c185,_0x29c284){if(_0x36c185['body']['id']){delete _0x36c185[_0x74be('0x46')]['id'];}return db[_0x74be('0x2b')][_0x74be('0x47')]({'where':{'id':_0x36c185[_0x74be('0x43')]['id']}})['then'](handleEntityNotFound(_0x29c284,null))[_0x74be('0x23')](saveUpdates(_0x36c185[_0x74be('0x46')],null))[_0x74be('0x23')](respondWithResult(_0x29c284,null))[_0x74be('0x41')](handleError(_0x29c284,null));};exports[_0x74be('0x24')]=function(_0x530dad,_0x9926ba){return db[_0x74be('0x2b')][_0x74be('0x47')]({'where':{'id':_0x530dad[_0x74be('0x43')]['id']}})[_0x74be('0x23')](handleEntityNotFound(_0x9926ba,null))[_0x74be('0x23')](removeEntity(_0x9926ba,null))[_0x74be('0x41')](handleError(_0x9926ba,null));};exports[_0x74be('0x48')]=function(_0x2d96a4,_0x12859f,_0x579808){var _0x386a7e={};var _0x58fe4c={};var _0x5ebc4c;var _0x107fbc;return db[_0x74be('0x2b')][_0x74be('0x49')]({'where':{'id':_0x2d96a4[_0x74be('0x43')]['id']}})[_0x74be('0x23')](handleEntityNotFound(_0x12859f,null))['then'](function(_0x710c5b){if(_0x710c5b){_0x5ebc4c=_0x710c5b;_0x58fe4c['model']=_[_0x74be('0x2f')](db[_0x74be('0x4a')][_0x74be('0x2c')]);_0x58fe4c['query']=_[_0x74be('0x2f')](_0x2d96a4[_0x74be('0x30')]);_0x58fe4c[_0x74be('0x31')]=_[_0x74be('0x32')](_0x58fe4c['model'],_0x58fe4c[_0x74be('0x30')]);_0x386a7e[_0x74be('0x34')]=_['intersection'](_0x58fe4c['model'],qs[_0x74be('0x35')](_0x2d96a4[_0x74be('0x30')][_0x74be('0x35')]));_0x386a7e[_0x74be('0x34')]=_0x386a7e[_0x74be('0x34')][_0x74be('0x36')]?_0x386a7e[_0x74be('0x34')]:_0x58fe4c['model'];_0x386a7e['order']=qs[_0x74be('0x38')](_0x2d96a4[_0x74be('0x30')]['sort']);_0x386a7e[_0x74be('0x39')]=qs[_0x74be('0x31')](_['pick'](_0x2d96a4[_0x74be('0x30')],_0x58fe4c[_0x74be('0x31')]));if(_0x2d96a4[_0x74be('0x30')]['filter']){_0x386a7e[_0x74be('0x39')]=_[_0x74be('0x3c')](_0x386a7e[_0x74be('0x39')],{'$or':_[_0x74be('0x2a')](_0x386a7e['attributes'],function(_0xca1bb3){var _0xa580ee={};_0xa580ee[_0xca1bb3]={'$like':'%'+_0x2d96a4[_0x74be('0x30')][_0x74be('0x3b')]+'%'};return _0xa580ee;})});}_0x386a7e=_[_0x74be('0x3c')]({},_0x386a7e,_0x2d96a4[_0x74be('0x44')]);return _0x5ebc4c['getSubjects'](_0x386a7e);}})[_0x74be('0x23')](function(_0x21dfdc){if(_0x21dfdc){_0x107fbc=_0x21dfdc[_0x74be('0x36')];if(!_0x2d96a4[_0x74be('0x30')][_0x74be('0x4b')](_0x74be('0x37'))){_0x386a7e[_0x74be('0x1a')]=qs[_0x74be('0x1a')](_0x2d96a4['query'][_0x74be('0x1a')]);_0x386a7e[_0x74be('0x18')]=qs[_0x74be('0x18')](_0x2d96a4[_0x74be('0x30')]['offset']);}return _0x5ebc4c[_0x74be('0x48')](_0x386a7e);}})[_0x74be('0x23')](function(_0x1b0894){if(_0x1b0894){return _0x1b0894?{'count':_0x107fbc,'rows':_0x1b0894}:null;}})[_0x74be('0x23')](respondWithResult(_0x12859f,null))[_0x74be('0x41')](handleError(_0x12859f,null));};exports[_0x74be('0x4c')]=function(_0x480960,_0x3ead83,_0x253bf8){var _0x58ba65={};var _0x49dde5={};var _0x53d9cc;var _0x4dcbc5;return db[_0x74be('0x2b')][_0x74be('0x49')]({'where':{'id':_0x480960['params']['id']}})[_0x74be('0x23')](handleEntityNotFound(_0x3ead83,null))[_0x74be('0x23')](function(_0x4f1469){if(_0x4f1469){_0x53d9cc=_0x4f1469;_0x49dde5[_0x74be('0x33')]=_[_0x74be('0x2f')](db[_0x74be('0x4a')][_0x74be('0x2c')]);_0x49dde5[_0x74be('0x30')]=_[_0x74be('0x2f')](_0x480960[_0x74be('0x30')]);_0x49dde5[_0x74be('0x31')]=_[_0x74be('0x32')](_0x49dde5['model'],_0x49dde5[_0x74be('0x30')]);_0x58ba65[_0x74be('0x34')]=_[_0x74be('0x32')](_0x49dde5['model'],qs[_0x74be('0x35')](_0x480960[_0x74be('0x30')][_0x74be('0x35')]));_0x58ba65[_0x74be('0x34')]=_0x58ba65[_0x74be('0x34')][_0x74be('0x36')]?_0x58ba65[_0x74be('0x34')]:_0x49dde5[_0x74be('0x33')];_0x58ba65['order']=qs['sort'](_0x480960[_0x74be('0x30')][_0x74be('0x38')]);_0x58ba65[_0x74be('0x39')]=qs[_0x74be('0x31')](_['pick'](_0x480960[_0x74be('0x30')],_0x49dde5[_0x74be('0x31')]));if(_0x480960['query'][_0x74be('0x3b')]){_0x58ba65[_0x74be('0x39')]=_[_0x74be('0x3c')](_0x58ba65['where'],{'$or':_['map'](_0x58ba65[_0x74be('0x34')],function(_0x4c4bfe){var _0x34cc4b={};_0x34cc4b[_0x4c4bfe]={'$like':'%'+_0x480960[_0x74be('0x30')][_0x74be('0x3b')]+'%'};return _0x34cc4b;})});}_0x58ba65=_[_0x74be('0x3c')]({},_0x58ba65,_0x480960[_0x74be('0x44')]);return _0x53d9cc[_0x74be('0x4c')](_0x58ba65);}})['then'](function(_0x31d860){if(_0x31d860){_0x4dcbc5=_0x31d860[_0x74be('0x36')];if(!_0x480960['query']['hasOwnProperty'](_0x74be('0x37'))){_0x58ba65[_0x74be('0x1a')]=qs[_0x74be('0x1a')](_0x480960[_0x74be('0x30')][_0x74be('0x1a')]);_0x58ba65[_0x74be('0x18')]=qs['offset'](_0x480960['query']['offset']);}return _0x53d9cc[_0x74be('0x4c')](_0x58ba65);}})[_0x74be('0x23')](function(_0x188e97){if(_0x188e97){return _0x188e97?{'count':_0x4dcbc5,'rows':_0x188e97}:null;}})[_0x74be('0x23')](respondWithResult(_0x3ead83,null))[_0x74be('0x41')](handleError(_0x3ead83,null));};exports['getFields']=function(_0x3ada42,_0x1995e1,_0x4bd7a1){var _0x2546f6={};var _0x3a3a30={};var _0x560e70;var _0x2a438b;return db[_0x74be('0x2b')][_0x74be('0x49')]({'where':{'id':_0x3ada42[_0x74be('0x43')]['id']}})[_0x74be('0x23')](handleEntityNotFound(_0x1995e1,null))[_0x74be('0x23')](function(_0x4203f1){if(_0x4203f1){_0x560e70=_0x4203f1;_0x3a3a30[_0x74be('0x33')]=_[_0x74be('0x2f')](db[_0x74be('0x4a')]['rawAttributes']);_0x3a3a30[_0x74be('0x30')]=_[_0x74be('0x2f')](_0x3ada42[_0x74be('0x30')]);_0x3a3a30[_0x74be('0x31')]=_['intersection'](_0x3a3a30['model'],_0x3a3a30[_0x74be('0x30')]);_0x2546f6['attributes']=_[_0x74be('0x32')](_0x3a3a30['model'],qs[_0x74be('0x35')](_0x3ada42[_0x74be('0x30')][_0x74be('0x35')]));_0x2546f6[_0x74be('0x34')]=_0x2546f6[_0x74be('0x34')][_0x74be('0x36')]?_0x2546f6[_0x74be('0x34')]:_0x3a3a30['model'];_0x2546f6['order']=qs['sort'](_0x3ada42[_0x74be('0x30')]['sort']);_0x2546f6[_0x74be('0x39')]=qs[_0x74be('0x31')](_[_0x74be('0x3a')](_0x3ada42[_0x74be('0x30')],_0x3a3a30[_0x74be('0x31')]));if(_0x3ada42['query']['filter']){_0x2546f6[_0x74be('0x39')]=_[_0x74be('0x3c')](_0x2546f6[_0x74be('0x39')],{'$or':_[_0x74be('0x2a')](_0x2546f6[_0x74be('0x34')],function(_0x224d4a){var _0x283749={};_0x283749[_0x224d4a]={'$like':'%'+_0x3ada42[_0x74be('0x30')]['filter']+'%'};return _0x283749;})});}_0x2546f6=_[_0x74be('0x3c')]({},_0x2546f6,_0x3ada42[_0x74be('0x44')]);return _0x560e70['getFields'](_0x2546f6);}})[_0x74be('0x23')](function(_0x2feb9b){if(_0x2feb9b){_0x2a438b=_0x2feb9b[_0x74be('0x36')];if(!_0x3ada42[_0x74be('0x30')]['hasOwnProperty'](_0x74be('0x37'))){_0x2546f6['limit']=qs[_0x74be('0x1a')](_0x3ada42['query'][_0x74be('0x1a')]);_0x2546f6[_0x74be('0x18')]=qs[_0x74be('0x18')](_0x3ada42[_0x74be('0x30')][_0x74be('0x18')]);}return _0x560e70[_0x74be('0x4d')](_0x2546f6);}})[_0x74be('0x23')](function(_0x4eff87){if(_0x4eff87){return _0x4eff87?{'count':_0x2a438b,'rows':_0x4eff87}:null;}})[_0x74be('0x23')](respondWithResult(_0x1995e1,null))[_0x74be('0x41')](handleError(_0x1995e1,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index b46981b..a6a202b 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 _0x5320=['../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x6c289b,_0x4a581b){var _0x4b4c00=function(_0x4b4259){while(--_0x4b4259){_0x6c289b['push'](_0x6c289b['shift']());}};_0x4b4c00(++_0x4a581b);}(_0x5320,0x7e));var _0x0532=function(_0x263a5e,_0x10702e){_0x263a5e=_0x263a5e-0x0;var _0x2245fe=_0x5320[_0x263a5e];return _0x2245fe;};'use strict';var _=require(_0x0532('0x0'));var util=require(_0x0532('0x1'));var logger=require(_0x0532('0x2'))(_0x0532('0x3'));var moment=require(_0x0532('0x4'));var BPromise=require(_0x0532('0x5'));var rp=require(_0x0532('0x6'));var fs=require('fs');var path=require(_0x0532('0x7'));var rimraf=require(_0x0532('0x8'));var config=require(_0x0532('0x9'));var attributes=require(_0x0532('0xa'));module[_0x0532('0xb')]=function(_0x3c1dc3,_0x7d2ae5){return _0x3c1dc3[_0x0532('0xc')](_0x0532('0xd'),attributes,{'tableName':_0x0532('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7388=['bluebird','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','../../config/logger','api','moment'];(function(_0x4a4e5e,_0x346d8d){var _0x15b0c2=function(_0x5edcd1){while(--_0x5edcd1){_0x4a4e5e['push'](_0x4a4e5e['shift']());}};_0x15b0c2(++_0x346d8d);}(_0x7388,0x167));var _0x8738=function(_0x2cb5c4,_0x114ab1){_0x2cb5c4=_0x2cb5c4-0x0;var _0x524247=_0x7388[_0x2cb5c4];return _0x524247;};'use strict';var _=require(_0x8738('0x0'));var util=require('util');var logger=require(_0x8738('0x1'))(_0x8738('0x2'));var moment=require(_0x8738('0x3'));var BPromise=require(_0x8738('0x4'));var rp=require(_0x8738('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8738('0x6'));var attributes=require(_0x8738('0x7'));module[_0x8738('0x8')]=function(_0x339c56,_0x2f5030){return _0x339c56[_0x8738('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0x8738('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 eb9c978..62901ec 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 _0xa340=['ioredis','../../mysqldb','../../config/logger','jayson/promise','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xa340,0x1ab));var _0x0a34=function(_0x48cca7,_0x43666e){_0x48cca7=_0x48cca7-0x0;var _0x307485=_0xa340[_0x48cca7];return _0x307485;};'use strict';var _=require(_0x0a34('0x0'));var util=require(_0x0a34('0x1'));var moment=require(_0x0a34('0x2'));var BPromise=require(_0x0a34('0x3'));var rs=require(_0x0a34('0x4'));var fs=require('fs');var Redis=require(_0x0a34('0x5'));var db=require(_0x0a34('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a34('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0a34('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a6d1e,_0xcd9bb3,_0x4a754f){return new BPromise(function(_0x208011,_0x24a902){return client[_0x0a34('0x9')](_0x2a6d1e,_0x4a754f)['then'](function(_0x4e442c){logger['info'](_0x0a34('0xa'),_0xcd9bb3,_0x0a34('0xb'));logger[_0x0a34('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0xcd9bb3,_0x0a34('0xb'),JSON['stringify'](_0x4e442c));if(_0x4e442c[_0x0a34('0xd')]){if(_0x4e442c[_0x0a34('0xd')][_0x0a34('0xe')]===0x1f4){logger['error'](_0x0a34('0xa'),_0xcd9bb3,_0x4e442c['error'][_0x0a34('0xf')]);return _0x24a902(_0x4e442c[_0x0a34('0xd')][_0x0a34('0xf')]);}logger[_0x0a34('0xd')](_0x0a34('0xa'),_0xcd9bb3,_0x4e442c[_0x0a34('0xd')][_0x0a34('0xf')]);return _0x208011(_0x4e442c[_0x0a34('0xd')]['message']);}else{logger[_0x0a34('0x10')](_0x0a34('0xa'),_0xcd9bb3,'request\x20sent');_0x208011(_0x4e442c['result'][_0x0a34('0xf')]);}})[_0x0a34('0x11')](function(_0x5a244c){logger['error'](_0x0a34('0xa'),_0xcd9bb3,_0x5a244c);_0x24a902(_0x5a244c);});});} \ No newline at end of file +var _0x8518=['message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x3be309,_0x1a2e45){var _0x25d5db=function(_0x4df36a){while(--_0x4df36a){_0x3be309['push'](_0x3be309['shift']());}};_0x25d5db(++_0x1a2e45);}(_0x8518,0x1d2));var _0x8851=function(_0x21f19a,_0x12adef){_0x21f19a=_0x21f19a-0x0;var _0x14edb2=_0x8518[_0x21f19a];return _0x14edb2;};'use strict';var _=require(_0x8851('0x0'));var util=require('util');var moment=require(_0x8851('0x1'));var BPromise=require(_0x8851('0x2'));var rs=require(_0x8851('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8851('0x4'))['db'];var utils=require(_0x8851('0x5'));var logger=require(_0x8851('0x6'))(_0x8851('0x7'));var config=require('../../config/environment');var jayson=require(_0x8851('0x8'));var client=jayson[_0x8851('0x9')][_0x8851('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcb5a71,_0x55833e,_0x2c8de9){return new BPromise(function(_0x4f00b7,_0xa47a8d){return client['request'](_0xcb5a71,_0x2c8de9)[_0x8851('0xb')](function(_0x50c3d8){logger['info'](_0x8851('0xc'),_0x55833e,_0x8851('0xd'));logger[_0x8851('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x55833e,'request\x20sent',JSON['stringify'](_0x50c3d8));if(_0x50c3d8[_0x8851('0xf')]){if(_0x50c3d8['error'][_0x8851('0x10')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x55833e,_0x50c3d8[_0x8851('0xf')]['message']);return _0xa47a8d(_0x50c3d8[_0x8851('0xf')]['message']);}logger[_0x8851('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x55833e,_0x50c3d8[_0x8851('0xf')]['message']);return _0x4f00b7(_0x50c3d8['error'][_0x8851('0x11')]);}else{logger[_0x8851('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x55833e,_0x8851('0xd'));_0x4f00b7(_0x50c3d8[_0x8851('0x13')]['message']);}})[_0x8851('0x14')](function(_0x44478c){logger[_0x8851('0xf')](_0x8851('0xc'),_0x55833e,_0x44478c);_0xa47a8d(_0x44478c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index fa72b17..c6ec81d 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 _0xa047=['../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','show','post','create','put','isAuthenticated','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x52e68e,_0x309912){var _0x3211a4=function(_0x467c01){while(--_0x467c01){_0x52e68e['push'](_0x52e68e['shift']());}};_0x3211a4(++_0x309912);}(_0xa047,0x1c5));var _0x7a04=function(_0x390733,_0x1e3d32){_0x390733=_0x390733-0x0;var _0x33beb9=_0xa047[_0x390733];return _0x33beb9;};'use strict';var multer=require(_0x7a04('0x0'));var util=require(_0x7a04('0x1'));var path=require(_0x7a04('0x2'));var timeout=require(_0x7a04('0x3'));var express=require('express');var router=express[_0x7a04('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7a04('0x5'));var interaction=require(_0x7a04('0x6'));var config=require(_0x7a04('0x7'));var controller=require(_0x7a04('0x8'));router[_0x7a04('0x9')]('/',auth['isAuthenticated'](),controller[_0x7a04('0xa')]);router[_0x7a04('0x9')](_0x7a04('0xb'),auth['isAuthenticated'](),controller[_0x7a04('0xc')]);router[_0x7a04('0xd')]('/',auth['isAuthenticated'](),controller[_0x7a04('0xe')]);router[_0x7a04('0xf')]('/:id',auth[_0x7a04('0x10')](),controller['update']);router['delete'](_0x7a04('0xb'),auth[_0x7a04('0x10')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x19ea=['connect-timeout','Router','fs-extra','../../components/auth/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x8042a9,_0x51c8cd){var _0x489878=function(_0x290921){while(--_0x290921){_0x8042a9['push'](_0x8042a9['shift']());}};_0x489878(++_0x51c8cd);}(_0x19ea,0xfe));var _0xa19e=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x19ea[_0x4e93a9];return _0x43013c;};'use strict';var multer=require(_0xa19e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa19e('0x1'));var express=require('express');var router=express[_0xa19e('0x2')]();var fs_extra=require(_0xa19e('0x3'));var auth=require(_0xa19e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa19e('0x5'));router[_0xa19e('0x6')]('/',auth[_0xa19e('0x7')](),controller[_0xa19e('0x8')]);router[_0xa19e('0x6')](_0xa19e('0x9'),auth[_0xa19e('0x7')](),controller[_0xa19e('0xa')]);router[_0xa19e('0xb')]('/',auth[_0xa19e('0x7')](),controller[_0xa19e('0xc')]);router['put'](_0xa19e('0x9'),auth[_0xa19e('0x7')](),controller[_0xa19e('0xd')]);router[_0xa19e('0xe')]('/:id',auth[_0xa19e('0x7')](),controller[_0xa19e('0xf')]);module[_0xa19e('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 36682d9..3d68084 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 _0xf693=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0xf693,0x1eb));var _0x3f69=function(_0x46ca36,_0x3abee8){_0x46ca36=_0x46ca36-0x0;var _0x1bac60=_0xf693[_0x46ca36];return _0x1bac60;};'use strict';var Sequelize=require(_0x3f69('0x0'));module[_0x3f69('0x1')]={'type':{'type':Sequelize[_0x3f69('0x2')](_0x3f69('0x3'),'variable','customVariable',_0x3f69('0x4'),_0x3f69('0x5')),'defaultValue':_0x3f69('0x3')},'content':{'type':Sequelize[_0x3f69('0x6')]},'key':{'type':Sequelize[_0x3f69('0x6')]},'keyType':{'type':Sequelize[_0x3f69('0x2')](_0x3f69('0x3'),'variable',_0x3f69('0x7'))},'keyContent':{'type':Sequelize[_0x3f69('0x6')]},'idField':{'type':Sequelize[_0x3f69('0x6')]},'nameField':{'type':Sequelize[_0x3f69('0x6')]},'customField':{'type':Sequelize[_0x3f69('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3f69('0x6')]}}; \ No newline at end of file +var _0x932f=['sequelize','string','variable','keyValue','picklist','STRING','ENUM','customVariable','BOOLEAN'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0x932f,0x19e));var _0xf932=function(_0x9e15aa,_0x55276a){_0x9e15aa=_0x9e15aa-0x0;var _0x17a76c=_0x932f[_0x9e15aa];return _0x17a76c;};'use strict';var Sequelize=require(_0xf932('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xf932('0x1'),_0xf932('0x2'),'customVariable',_0xf932('0x3'),_0xf932('0x4')),'defaultValue':_0xf932('0x1')},'content':{'type':Sequelize[_0xf932('0x5')]},'key':{'type':Sequelize[_0xf932('0x5')]},'keyType':{'type':Sequelize[_0xf932('0x6')]('string',_0xf932('0x2'),_0xf932('0x7'))},'keyContent':{'type':Sequelize[_0xf932('0x5')]},'idField':{'type':Sequelize[_0xf932('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf932('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf932('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index fa9a731..3c5a296 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 _0x50b9=['send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','count','set','Content-Range','apply','reject','save','then','error','stack','name'];(function(_0x2d93e7,_0x44aef2){var _0x120757=function(_0x3b373d){while(--_0x3b373d){_0x2d93e7['push'](_0x2d93e7['shift']());}};_0x120757(++_0x44aef2);}(_0x50b9,0x19b));var _0x950b=function(_0x42b3aa,_0x223f53){_0x42b3aa=_0x42b3aa-0x0;var _0x319157=_0x50b9[_0x42b3aa];return _0x319157;};'use strict';var emlformat=require(_0x950b('0x0'));var rimraf=require(_0x950b('0x1'));var zipdir=require(_0x950b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x950b('0x3'));var moment=require(_0x950b('0x4'));var BPromise=require(_0x950b('0x5'));var Mustache=require(_0x950b('0x6'));var util=require(_0x950b('0x7'));var path=require(_0x950b('0x8'));var sox=require(_0x950b('0x9'));var csv=require('to-csv');var ejs=require(_0x950b('0xa'));var fs=require('fs');var fs_extra=require(_0x950b('0xb'));var _=require(_0x950b('0xc'));var squel=require('squel');var crypto=require(_0x950b('0xd'));var jsforce=require(_0x950b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x950b('0xf'));var Papa=require(_0x950b('0x10'));var Redis=require('ioredis');var authService=require(_0x950b('0x11'));var qs=require(_0x950b('0x12'));var as=require(_0x950b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x950b('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x950b('0x15'));var db=require(_0x950b('0x16'))['db'];function respondWithStatusCode(_0x14b3a5,_0x48cd84){_0x48cd84=_0x48cd84||0xcc;return function(_0x37eff9){if(_0x37eff9){return _0x14b3a5[_0x950b('0x17')](_0x48cd84);}return _0x14b3a5[_0x950b('0x18')](_0x48cd84)[_0x950b('0x19')]();};}function respondWithResult(_0x3235ed,_0x4c8031){_0x4c8031=_0x4c8031||0xc8;return function(_0x416c63){if(_0x416c63){return _0x3235ed[_0x950b('0x18')](_0x4c8031)[_0x950b('0x1a')](_0x416c63);}};}function respondWithFilteredResult(_0x32a5e9,_0x1a19a8){return function(_0x54e4b7){if(_0x54e4b7){var _0x298738=typeof _0x1a19a8['offset']==='undefined'&&typeof _0x1a19a8[_0x950b('0x1b')]==='undefined';var _0x547c95=_0x54e4b7['count'];var _0x499216=_0x298738?0x0:_0x1a19a8[_0x950b('0x1c')];var _0x13779a=_0x298738?_0x54e4b7[_0x950b('0x1d')]:_0x1a19a8[_0x950b('0x1c')]+_0x1a19a8['limit'];var _0x433eb5;if(_0x13779a>=_0x547c95){_0x13779a=_0x547c95;_0x433eb5=0xc8;}else{_0x433eb5=0xce;}_0x32a5e9[_0x950b('0x18')](_0x433eb5);return _0x32a5e9[_0x950b('0x1e')](_0x950b('0x1f'),_0x499216+'-'+_0x13779a+'/'+_0x547c95)['json'](_0x54e4b7);}return null;};}function patchUpdates(_0x8fe3e7){return function(_0x3cab1a){try{jsonpatch[_0x950b('0x20')](_0x3cab1a,_0x8fe3e7,!![]);}catch(_0x158ae1){return BPromise[_0x950b('0x21')](_0x158ae1);}return _0x3cab1a[_0x950b('0x22')]();};}function saveUpdates(_0x32dda5,_0x2be1b4){return function(_0x4ebf03){if(_0x4ebf03){return _0x4ebf03['update'](_0x32dda5)[_0x950b('0x23')](function(_0x40aef2){return _0x40aef2;});}return null;};}function removeEntity(_0x41e9e0,_0x4cc5b){return function(_0x5eb953){if(_0x5eb953){return _0x5eb953['destroy']()[_0x950b('0x23')](function(){_0x41e9e0[_0x950b('0x18')](0xcc)[_0x950b('0x19')]();});}};}function handleEntityNotFound(_0x13dd25,_0x3cddf2){return function(_0x4efbc8){if(!_0x4efbc8){_0x13dd25['sendStatus'](0x194);}return _0x4efbc8;};}function handleError(_0x4de7c3,_0x5585e7){_0x5585e7=_0x5585e7||0x1f4;return function(_0x26d164){logger[_0x950b('0x24')](_0x26d164[_0x950b('0x25')]);if(_0x26d164['name']){delete _0x26d164[_0x950b('0x26')];}_0x4de7c3['status'](_0x5585e7)[_0x950b('0x27')](_0x26d164);};}exports[_0x950b('0x28')]=function(_0x4e6832,_0x3d1012){var _0x4620b0={},_0x5cc5ad={},_0x25ae5f={'count':0x0,'rows':[]};var _0x10e71a=_[_0x950b('0x29')](db[_0x950b('0x2a')][_0x950b('0x2b')],function(_0x22395e){return{'name':_0x22395e[_0x950b('0x2c')],'type':_0x22395e[_0x950b('0x2d')][_0x950b('0x2e')]};});_0x5cc5ad[_0x950b('0x2f')]=_[_0x950b('0x29')](_0x10e71a,_0x950b('0x26'));_0x5cc5ad['query']=_['keys'](_0x4e6832[_0x950b('0x30')]);_0x5cc5ad[_0x950b('0x31')]=_[_0x950b('0x32')](_0x5cc5ad[_0x950b('0x2f')],_0x5cc5ad[_0x950b('0x30')]);_0x4620b0[_0x950b('0x33')]=_[_0x950b('0x32')](_0x5cc5ad[_0x950b('0x2f')],qs[_0x950b('0x34')](_0x4e6832[_0x950b('0x30')][_0x950b('0x34')]));_0x4620b0['attributes']=_0x4620b0[_0x950b('0x33')][_0x950b('0x35')]?_0x4620b0['attributes']:_0x5cc5ad[_0x950b('0x2f')];if(!_0x4e6832[_0x950b('0x30')]['hasOwnProperty'](_0x950b('0x36'))){_0x4620b0['limit']=qs[_0x950b('0x1b')](_0x4e6832[_0x950b('0x30')][_0x950b('0x1b')]);_0x4620b0['offset']=qs[_0x950b('0x1c')](_0x4e6832[_0x950b('0x30')][_0x950b('0x1c')]);}_0x4620b0[_0x950b('0x37')]=qs[_0x950b('0x38')](_0x4e6832[_0x950b('0x30')][_0x950b('0x38')]);_0x4620b0[_0x950b('0x39')]=qs[_0x950b('0x31')](_[_0x950b('0x3a')](_0x4e6832[_0x950b('0x30')],_0x5cc5ad[_0x950b('0x31')]),_0x10e71a);if(_0x4e6832[_0x950b('0x30')]['filter']){_0x4620b0[_0x950b('0x39')]=_[_0x950b('0x3b')](_0x4620b0[_0x950b('0x39')],{'$or':_[_0x950b('0x29')](_0x10e71a,function(_0x15ed28){if(_0x15ed28['type']!==_0x950b('0x3c')){var _0x3a6fed={};_0x3a6fed[_0x15ed28[_0x950b('0x26')]]={'$like':'%'+_0x4e6832[_0x950b('0x30')][_0x950b('0x3d')]+'%'};return _0x3a6fed;}})});}_0x4620b0=_[_0x950b('0x3b')]({},_0x4620b0,_0x4e6832['options']);var _0xc25832={'where':_0x4620b0[_0x950b('0x39')]};return db[_0x950b('0x2a')][_0x950b('0x1d')](_0xc25832)[_0x950b('0x23')](function(_0x4142e3){_0x25ae5f[_0x950b('0x1d')]=_0x4142e3;if(_0x4e6832[_0x950b('0x30')][_0x950b('0x3e')]){_0x4620b0[_0x950b('0x3f')]=[{'all':!![]}];}return db['FreshsalesField'][_0x950b('0x40')](_0x4620b0);})['then'](function(_0x3db9ab){_0x25ae5f[_0x950b('0x41')]=_0x3db9ab;return _0x25ae5f;})['then'](respondWithFilteredResult(_0x3d1012,_0x4620b0))[_0x950b('0x42')](handleError(_0x3d1012,null));};exports[_0x950b('0x43')]=function(_0x387edb,_0x396279){var _0x394a3f={'raw':!![],'where':{'id':_0x387edb[_0x950b('0x44')]['id']}},_0x4cac7a={};_0x4cac7a[_0x950b('0x2f')]=_[_0x950b('0x45')](db['FreshsalesField'][_0x950b('0x2b')]);_0x4cac7a[_0x950b('0x30')]=_['keys'](_0x387edb['query']);_0x4cac7a[_0x950b('0x31')]=_['intersection'](_0x4cac7a['model'],_0x4cac7a['query']);_0x394a3f[_0x950b('0x33')]=_[_0x950b('0x32')](_0x4cac7a[_0x950b('0x2f')],qs['fields'](_0x387edb['query']['fields']));_0x394a3f[_0x950b('0x33')]=_0x394a3f[_0x950b('0x33')][_0x950b('0x35')]?_0x394a3f['attributes']:_0x4cac7a['model'];if(_0x387edb[_0x950b('0x30')][_0x950b('0x3e')]){_0x394a3f['include']=[{'all':!![]}];}_0x394a3f=_[_0x950b('0x3b')]({},_0x394a3f,_0x387edb['options']);return db[_0x950b('0x2a')][_0x950b('0x46')](_0x394a3f)['then'](handleEntityNotFound(_0x396279,null))[_0x950b('0x23')](respondWithResult(_0x396279,null))['catch'](handleError(_0x396279,null));};exports['create']=function(_0x5b2778,_0x55cb19){return db[_0x950b('0x2a')][_0x950b('0x47')](_0x5b2778[_0x950b('0x48')],{})['then'](respondWithResult(_0x55cb19,0xc9))[_0x950b('0x42')](handleError(_0x55cb19,null));};exports[_0x950b('0x49')]=function(_0xdb9c87,_0xb73075){if(_0xdb9c87[_0x950b('0x48')]['id']){delete _0xdb9c87[_0x950b('0x48')]['id'];}return db['FreshsalesField'][_0x950b('0x46')]({'where':{'id':_0xdb9c87[_0x950b('0x44')]['id']}})[_0x950b('0x23')](handleEntityNotFound(_0xb73075,null))[_0x950b('0x23')](saveUpdates(_0xdb9c87[_0x950b('0x48')],null))[_0x950b('0x23')](respondWithResult(_0xb73075,null))['catch'](handleError(_0xb73075,null));};exports[_0x950b('0x4a')]=function(_0x578d76,_0x12e222){return db['FreshsalesField'][_0x950b('0x46')]({'where':{'id':_0x578d76[_0x950b('0x44')]['id']}})[_0x950b('0x23')](handleEntityNotFound(_0x12e222,null))['then'](removeEntity(_0x12e222,null))[_0x950b('0x42')](handleError(_0x12e222,null));}; \ No newline at end of file +var _0x73cb=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','stack','name','send','index','FreshsalesField','rawAttributes','type','model','map','keys'];(function(_0x306548,_0x1054aa){var _0x389d27=function(_0x2ed19b){while(--_0x2ed19b){_0x306548['push'](_0x306548['shift']());}};_0x389d27(++_0x1054aa);}(_0x73cb,0x1dc));var _0xb73c=function(_0x72db45,_0x2dd78d){_0x72db45=_0x72db45-0x0;var _0x407749=_0x73cb[_0x72db45];return _0x407749;};'use strict';var emlformat=require(_0xb73c('0x0'));var rimraf=require(_0xb73c('0x1'));var zipdir=require(_0xb73c('0x2'));var jsonpatch=require(_0xb73c('0x3'));var rp=require('request-promise');var moment=require(_0xb73c('0x4'));var BPromise=require(_0xb73c('0x5'));var Mustache=require(_0xb73c('0x6'));var util=require(_0xb73c('0x7'));var path=require(_0xb73c('0x8'));var sox=require(_0xb73c('0x9'));var csv=require('to-csv');var ejs=require(_0xb73c('0xa'));var fs=require('fs');var fs_extra=require(_0xb73c('0xb'));var _=require('lodash');var squel=require(_0xb73c('0xc'));var crypto=require('crypto');var jsforce=require(_0xb73c('0xd'));var deskjs=require(_0xb73c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb73c('0xf'));var Papa=require(_0xb73c('0x10'));var Redis=require(_0xb73c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb73c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb73c('0x13'));var logger=require(_0xb73c('0x14'))(_0xb73c('0x15'));var utils=require(_0xb73c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb73c('0x17'));var db=require(_0xb73c('0x18'))['db'];function respondWithStatusCode(_0x2f6d01,_0x4b712c){_0x4b712c=_0x4b712c||0xcc;return function(_0x41695){if(_0x41695){return _0x2f6d01[_0xb73c('0x19')](_0x4b712c);}return _0x2f6d01[_0xb73c('0x1a')](_0x4b712c)['end']();};}function respondWithResult(_0x2b31b9,_0x1cb798){_0x1cb798=_0x1cb798||0xc8;return function(_0x172c4c){if(_0x172c4c){return _0x2b31b9[_0xb73c('0x1a')](_0x1cb798)[_0xb73c('0x1b')](_0x172c4c);}};}function respondWithFilteredResult(_0x328e04,_0x2156a9){return function(_0x498f7b){if(_0x498f7b){var _0x1d2474=typeof _0x2156a9[_0xb73c('0x1c')]===_0xb73c('0x1d')&&typeof _0x2156a9[_0xb73c('0x1e')]===_0xb73c('0x1d');var _0x2fb8f6=_0x498f7b[_0xb73c('0x1f')];var _0x519dfb=_0x1d2474?0x0:_0x2156a9[_0xb73c('0x1c')];var _0x12034e=_0x1d2474?_0x498f7b[_0xb73c('0x1f')]:_0x2156a9[_0xb73c('0x1c')]+_0x2156a9['limit'];var _0x926dc6;if(_0x12034e>=_0x2fb8f6){_0x12034e=_0x2fb8f6;_0x926dc6=0xc8;}else{_0x926dc6=0xce;}_0x328e04[_0xb73c('0x1a')](_0x926dc6);return _0x328e04[_0xb73c('0x20')](_0xb73c('0x21'),_0x519dfb+'-'+_0x12034e+'/'+_0x2fb8f6)['json'](_0x498f7b);}return null;};}function patchUpdates(_0x357afb){return function(_0x347659){try{jsonpatch[_0xb73c('0x22')](_0x347659,_0x357afb,!![]);}catch(_0x13dd5d){return BPromise[_0xb73c('0x23')](_0x13dd5d);}return _0x347659['save']();};}function saveUpdates(_0xfe01cc,_0x39e029){return function(_0x4b033b){if(_0x4b033b){return _0x4b033b[_0xb73c('0x24')](_0xfe01cc)[_0xb73c('0x25')](function(_0x3bea4c){return _0x3bea4c;});}return null;};}function removeEntity(_0x5d8cb3,_0x4ddd91){return function(_0x2ad2b3){if(_0x2ad2b3){return _0x2ad2b3['destroy']()[_0xb73c('0x25')](function(){_0x5d8cb3[_0xb73c('0x1a')](0xcc)[_0xb73c('0x26')]();});}};}function handleEntityNotFound(_0x5cf431,_0x194c6b){return function(_0x2b5b6b){if(!_0x2b5b6b){_0x5cf431[_0xb73c('0x19')](0x194);}return _0x2b5b6b;};}function handleError(_0x230c6c,_0x16ee76){_0x16ee76=_0x16ee76||0x1f4;return function(_0x2c7187){logger['error'](_0x2c7187[_0xb73c('0x27')]);if(_0x2c7187[_0xb73c('0x28')]){delete _0x2c7187[_0xb73c('0x28')];}_0x230c6c[_0xb73c('0x1a')](_0x16ee76)[_0xb73c('0x29')](_0x2c7187);};}exports[_0xb73c('0x2a')]=function(_0x22e710,_0x50a966){var _0x298972={},_0xb6743={},_0x3865d0={'count':0x0,'rows':[]};var _0x342c4e=_['map'](db[_0xb73c('0x2b')][_0xb73c('0x2c')],function(_0x37bcc3){return{'name':_0x37bcc3['fieldName'],'type':_0x37bcc3[_0xb73c('0x2d')]['key']};});_0xb6743[_0xb73c('0x2e')]=_[_0xb73c('0x2f')](_0x342c4e,_0xb73c('0x28'));_0xb6743['query']=_[_0xb73c('0x30')](_0x22e710[_0xb73c('0x31')]);_0xb6743[_0xb73c('0x32')]=_[_0xb73c('0x33')](_0xb6743[_0xb73c('0x2e')],_0xb6743['query']);_0x298972[_0xb73c('0x34')]=_[_0xb73c('0x33')](_0xb6743[_0xb73c('0x2e')],qs['fields'](_0x22e710[_0xb73c('0x31')][_0xb73c('0x35')]));_0x298972[_0xb73c('0x34')]=_0x298972[_0xb73c('0x34')][_0xb73c('0x36')]?_0x298972[_0xb73c('0x34')]:_0xb6743['model'];if(!_0x22e710['query'][_0xb73c('0x37')](_0xb73c('0x38'))){_0x298972['limit']=qs[_0xb73c('0x1e')](_0x22e710[_0xb73c('0x31')][_0xb73c('0x1e')]);_0x298972[_0xb73c('0x1c')]=qs['offset'](_0x22e710[_0xb73c('0x31')][_0xb73c('0x1c')]);}_0x298972[_0xb73c('0x39')]=qs[_0xb73c('0x3a')](_0x22e710[_0xb73c('0x31')][_0xb73c('0x3a')]);_0x298972[_0xb73c('0x3b')]=qs[_0xb73c('0x32')](_[_0xb73c('0x3c')](_0x22e710[_0xb73c('0x31')],_0xb6743[_0xb73c('0x32')]),_0x342c4e);if(_0x22e710[_0xb73c('0x31')][_0xb73c('0x3d')]){_0x298972[_0xb73c('0x3b')]=_['merge'](_0x298972[_0xb73c('0x3b')],{'$or':_['map'](_0x342c4e,function(_0x49bfd8){if(_0x49bfd8[_0xb73c('0x2d')]!==_0xb73c('0x3e')){var _0x540d65={};_0x540d65[_0x49bfd8[_0xb73c('0x28')]]={'$like':'%'+_0x22e710[_0xb73c('0x31')][_0xb73c('0x3d')]+'%'};return _0x540d65;}})});}_0x298972=_[_0xb73c('0x3f')]({},_0x298972,_0x22e710[_0xb73c('0x40')]);var _0x37f678={'where':_0x298972[_0xb73c('0x3b')]};return db[_0xb73c('0x2b')][_0xb73c('0x1f')](_0x37f678)['then'](function(_0x57d8f3){_0x3865d0[_0xb73c('0x1f')]=_0x57d8f3;if(_0x22e710[_0xb73c('0x31')][_0xb73c('0x41')]){_0x298972[_0xb73c('0x42')]=[{'all':!![]}];}return db[_0xb73c('0x2b')]['findAll'](_0x298972);})['then'](function(_0x3d9758){_0x3865d0[_0xb73c('0x43')]=_0x3d9758;return _0x3865d0;})[_0xb73c('0x25')](respondWithFilteredResult(_0x50a966,_0x298972))[_0xb73c('0x44')](handleError(_0x50a966,null));};exports[_0xb73c('0x45')]=function(_0x4982ae,_0x26e5ea){var _0x42e8b0={'raw':!![],'where':{'id':_0x4982ae[_0xb73c('0x46')]['id']}},_0x201ce9={};_0x201ce9[_0xb73c('0x2e')]=_[_0xb73c('0x30')](db['FreshsalesField'][_0xb73c('0x2c')]);_0x201ce9[_0xb73c('0x31')]=_['keys'](_0x4982ae['query']);_0x201ce9[_0xb73c('0x32')]=_['intersection'](_0x201ce9['model'],_0x201ce9[_0xb73c('0x31')]);_0x42e8b0[_0xb73c('0x34')]=_[_0xb73c('0x33')](_0x201ce9[_0xb73c('0x2e')],qs['fields'](_0x4982ae[_0xb73c('0x31')][_0xb73c('0x35')]));_0x42e8b0[_0xb73c('0x34')]=_0x42e8b0['attributes'][_0xb73c('0x36')]?_0x42e8b0[_0xb73c('0x34')]:_0x201ce9[_0xb73c('0x2e')];if(_0x4982ae[_0xb73c('0x31')]['includeAll']){_0x42e8b0[_0xb73c('0x42')]=[{'all':!![]}];}_0x42e8b0=_[_0xb73c('0x3f')]({},_0x42e8b0,_0x4982ae[_0xb73c('0x40')]);return db['FreshsalesField'][_0xb73c('0x47')](_0x42e8b0)['then'](handleEntityNotFound(_0x26e5ea,null))['then'](respondWithResult(_0x26e5ea,null))[_0xb73c('0x44')](handleError(_0x26e5ea,null));};exports[_0xb73c('0x48')]=function(_0x494e29,_0x3592ed){return db[_0xb73c('0x2b')][_0xb73c('0x48')](_0x494e29['body'],{})[_0xb73c('0x25')](respondWithResult(_0x3592ed,0xc9))[_0xb73c('0x44')](handleError(_0x3592ed,null));};exports[_0xb73c('0x24')]=function(_0x2e969b,_0x5057e3){if(_0x2e969b[_0xb73c('0x49')]['id']){delete _0x2e969b['body']['id'];}return db[_0xb73c('0x2b')][_0xb73c('0x47')]({'where':{'id':_0x2e969b[_0xb73c('0x46')]['id']}})[_0xb73c('0x25')](handleEntityNotFound(_0x5057e3,null))[_0xb73c('0x25')](saveUpdates(_0x2e969b[_0xb73c('0x49')],null))[_0xb73c('0x25')](respondWithResult(_0x5057e3,null))[_0xb73c('0x44')](handleError(_0x5057e3,null));};exports[_0xb73c('0x4a')]=function(_0x1d868f,_0x58ac25){return db[_0xb73c('0x2b')][_0xb73c('0x47')]({'where':{'id':_0x1d868f[_0xb73c('0x46')]['id']}})[_0xb73c('0x25')](handleEntityNotFound(_0x58ac25,null))[_0xb73c('0x25')](removeEntity(_0x58ac25,null))['catch'](handleError(_0x58ac25,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index f7b6729..9bd43de 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 _0xa3e8=['bluebird','request-promise','path','rimraf','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','moment'];(function(_0x52fbf6,_0x24ce88){var _0x4b48cd=function(_0x2f5545){while(--_0x2f5545){_0x52fbf6['push'](_0x52fbf6['shift']());}};_0x4b48cd(++_0x24ce88);}(_0xa3e8,0x127));var _0x8a3e=function(_0x3c1050,_0x421a12){_0x3c1050=_0x3c1050-0x0;var _0x5513f8=_0xa3e8[_0x3c1050];return _0x5513f8;};'use strict';var _=require(_0x8a3e('0x0'));var util=require(_0x8a3e('0x1'));var logger=require(_0x8a3e('0x2'))('api');var moment=require(_0x8a3e('0x3'));var BPromise=require(_0x8a3e('0x4'));var rp=require(_0x8a3e('0x5'));var fs=require('fs');var path=require(_0x8a3e('0x6'));var rimraf=require(_0x8a3e('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x920901,_0xe682f5){return _0x920901[_0x8a3e('0x8')]('FreshsalesField',attributes,{'tableName':_0x8a3e('0x9'),'paranoid':![],'indexes':[{'name':_0x8a3e('0xa'),'fields':[_0x8a3e('0xb'),_0x8a3e('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb350=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xb350,0x6f));var _0x0b35=function(_0x208d6d,_0x47f7b6){_0x208d6d=_0x208d6d-0x0;var _0x432519=_0xb350[_0x208d6d];return _0x432519;};'use strict';var _=require(_0x0b35('0x0'));var util=require(_0x0b35('0x1'));var logger=require(_0x0b35('0x2'))(_0x0b35('0x3'));var moment=require('moment');var BPromise=require(_0x0b35('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b35('0x5'));var rimraf=require('rimraf');var config=require(_0x0b35('0x6'));var attributes=require(_0x0b35('0x7'));module[_0x0b35('0x8')]=function(_0x1218c3,_0x417722){return _0x1218c3[_0x0b35('0x9')](_0x0b35('0xa'),attributes,{'tableName':_0x0b35('0xb'),'paranoid':![],'indexes':[{'name':_0x0b35('0xc'),'fields':['idField','FieldId'],'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 9d008b5..821c598 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x109371,_0x441c8e){var _0x4fd858=function(_0x13504f){while(--_0x13504f){_0x109371['push'](_0x109371['shift']());}};_0x4fd858(++_0x441c8e);}(_0x687b,0x14a));var _0xb687=function(_0x201043,_0x57e46b){_0x201043=_0x201043-0x0;var _0x29e5f2=_0x687b[_0x201043];return _0x29e5f2;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file +var _0xeda8=['debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent'];(function(_0x1c5b76,_0x1d3c41){var _0x179518=function(_0x3601d7){while(--_0x3601d7){_0x1c5b76['push'](_0x1c5b76['shift']());}};_0x179518(++_0x1d3c41);}(_0xeda8,0x104));var _0x8eda=function(_0x2b9003,_0x466ad8){_0x2b9003=_0x2b9003-0x0;var _0x555984=_0xeda8[_0x2b9003];return _0x555984;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32abe8,_0x4e2ebb,_0x28b721){return new BPromise(function(_0x1b6a1d,_0x5aa93d){return client[_0x8eda('0xd')](_0x32abe8,_0x28b721)['then'](function(_0x4f7893){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x8eda('0xe'));logger[_0x8eda('0xf')](_0x8eda('0x10'),_0x4e2ebb,'request\x20sent',JSON[_0x8eda('0x11')](_0x4f7893));if(_0x4f7893['error']){if(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x13')]===0x1f4){logger[_0x8eda('0x12')](_0x8eda('0x14'),_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x5aa93d(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x1b6a1d(_0x4f7893['error'][_0x8eda('0x15')]);}else{logger[_0x8eda('0x16')](_0x8eda('0x14'),_0x4e2ebb,'request\x20sent');_0x1b6a1d(_0x4f7893[_0x8eda('0x17')]['message']);}})[_0x8eda('0x18')](function(_0x553382){logger[_0x8eda('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x553382);_0x5aa93d(_0x553382);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index addb477..3025d57 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(_0x51319b,_0x1020f3){var _0x318a3c=function(_0x2d736f){while(--_0x2d736f){_0x51319b['push'](_0x51319b['shift']());}};_0x318a3c(++_0x1020f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x26966d,_0x18fd70){var _0x4e5754=function(_0x46f33f){while(--_0x46f33f){_0x26966d['push'](_0x26966d['shift']());}};_0x4e5754(++_0x18fd70);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 3bdbcd6..3dfd5e3 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 _0xbd3a=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x1ed21f,_0x11058b){var _0xfc84cf=function(_0x4e00a3){while(--_0x4e00a3){_0x1ed21f['push'](_0x1ed21f['shift']());}};_0xfc84cf(++_0x11058b);}(_0xbd3a,0xb9));var _0xabd3=function(_0x549051,_0x20c0d4){_0x549051=_0x549051-0x0;var _0x4df703=_0xbd3a[_0x549051];return _0x4df703;};'use strict';var Sequelize=require(_0xabd3('0x0'));module[_0xabd3('0x1')]={'name':{'type':Sequelize[_0xabd3('0x2')]},'description':{'type':Sequelize[_0xabd3('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xabd3('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xabd3('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xabd3('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x5'),_0xabd3('0x6')),'defaultValue':_0xabd3('0x5')}}; \ No newline at end of file +var _0xbd36=['exports','STRING','username','integrationTab','newTab','sequelize'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xbd36,0x65));var _0x6bd3=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xbd36[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0x6bd3('0x0'));module[_0x6bd3('0x1')]={'name':{'type':Sequelize[_0x6bd3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x6bd3('0x3')},'remoteUri':{'type':Sequelize[_0x6bd3('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6bd3('0x2')]},'clientSecret':{'type':Sequelize[_0x6bd3('0x2')]},'securityToken':{'type':Sequelize[_0x6bd3('0x2')]},'serverUrl':{'type':Sequelize[_0x6bd3('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6bd3('0x4'),_0x6bd3('0x5')),'defaultValue':_0x6bd3('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index e837899..ac54d56 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 _0x6499=['getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','filters','pick','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','securityToken','substring','lastIndexOf','Connection','clientId','clientSecret','username','password','concat','isNil','ticketType','describe','OwnerId','IsRecurrence','string','picklist','email','phone','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0x6499,0x173));var _0x9649=function(_0x2d21e7,_0x491db3){_0x2d21e7=_0x2d21e7-0x0;var _0x1d6e26=_0x6499[_0x2d21e7];return _0x1d6e26;};'use strict';var emlformat=require(_0x9649('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9649('0x1'));var jsonpatch=require(_0x9649('0x2'));var rp=require(_0x9649('0x3'));var moment=require(_0x9649('0x4'));var BPromise=require(_0x9649('0x5'));var Mustache=require(_0x9649('0x6'));var util=require(_0x9649('0x7'));var path=require(_0x9649('0x8'));var sox=require(_0x9649('0x9'));var csv=require('to-csv');var ejs=require(_0x9649('0xa'));var fs=require('fs');var fs_extra=require(_0x9649('0xb'));var _=require('lodash');var squel=require(_0x9649('0xc'));var crypto=require('crypto');var jsforce=require(_0x9649('0xd'));var deskjs=require(_0x9649('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9649('0xf'));var Papa=require(_0x9649('0x10'));var Redis=require(_0x9649('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9649('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9649('0x13'));var logger=require(_0x9649('0x14'))(_0x9649('0x15'));var utils=require('../../config/utils');var config=require(_0x9649('0x16'));var licenseUtil=require(_0x9649('0x17'));var db=require(_0x9649('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x34b62a,_0x367b5a){_0x367b5a=_0x367b5a||0xcc;return function(_0x2e49ac){if(_0x2e49ac){return _0x34b62a[_0x9649('0x19')](_0x367b5a);}return _0x34b62a['status'](_0x367b5a)[_0x9649('0x1a')]();};}function respondWithResult(_0x2c2eb5,_0x49ed87){_0x49ed87=_0x49ed87||0xc8;return function(_0x1d143a){if(_0x1d143a){return _0x2c2eb5[_0x9649('0x1b')](_0x49ed87)['json'](_0x1d143a);}};}function respondWithFilteredResult(_0x12a847,_0x34809b){return function(_0x156050){if(_0x156050){var _0x1354c9=typeof _0x34809b['offset']===_0x9649('0x1c')&&typeof _0x34809b[_0x9649('0x1d')]===_0x9649('0x1c');var _0x372075=_0x156050[_0x9649('0x1e')];var _0x31c378=_0x1354c9?0x0:_0x34809b[_0x9649('0x1f')];var _0x28a7ef=_0x1354c9?_0x156050[_0x9649('0x1e')]:_0x34809b[_0x9649('0x1f')]+_0x34809b[_0x9649('0x1d')];var _0x24de5e;if(_0x28a7ef>=_0x372075){_0x28a7ef=_0x372075;_0x24de5e=0xc8;}else{_0x24de5e=0xce;}_0x12a847['status'](_0x24de5e);return _0x12a847[_0x9649('0x20')](_0x9649('0x21'),_0x31c378+'-'+_0x28a7ef+'/'+_0x372075)[_0x9649('0x22')](_0x156050);}return null;};}function patchUpdates(_0x3c53e2){return function(_0x122398){try{jsonpatch[_0x9649('0x23')](_0x122398,_0x3c53e2,!![]);}catch(_0x2158a9){return BPromise[_0x9649('0x24')](_0x2158a9);}return _0x122398[_0x9649('0x25')]();};}function saveUpdates(_0x4ce7a9,_0x4f27b5){return function(_0x41d0e4){if(_0x41d0e4){return _0x41d0e4[_0x9649('0x26')](_0x4ce7a9)[_0x9649('0x27')](function(_0x2e554c){return _0x2e554c;});}return null;};}function removeEntity(_0x52560f,_0x4e8c3a){return function(_0x7f3e42){if(_0x7f3e42){return _0x7f3e42[_0x9649('0x28')]()[_0x9649('0x27')](function(){_0x52560f[_0x9649('0x1b')](0xcc)[_0x9649('0x1a')]();});}};}function handleEntityNotFound(_0x107b66,_0x2ad3aa){return function(_0x5457b2){if(!_0x5457b2){_0x107b66['sendStatus'](0x194);}return _0x5457b2;};}function handleError(_0x15d2db,_0x57852a){_0x57852a=_0x57852a||0x1f4;return function(_0x4e02d5){logger[_0x9649('0x29')](_0x4e02d5[_0x9649('0x2a')]);if(_0x4e02d5[_0x9649('0x2b')]){delete _0x4e02d5[_0x9649('0x2b')];}_0x15d2db[_0x9649('0x1b')](_0x57852a)[_0x9649('0x2c')](_0x4e02d5);};}exports[_0x9649('0x2d')]=function(_0x3e7779,_0x2ec16b){var _0x97b811={},_0x587f0a={},_0x1b7d12={'count':0x0,'rows':[]};var _0xce36f9=_[_0x9649('0x2e')](db[_0x9649('0x2f')][_0x9649('0x30')],function(_0x3e92a2){return{'name':_0x3e92a2[_0x9649('0x31')],'type':_0x3e92a2[_0x9649('0x32')][_0x9649('0x33')]};});_0x587f0a[_0x9649('0x34')]=_[_0x9649('0x2e')](_0xce36f9,_0x9649('0x2b'));_0x587f0a[_0x9649('0x35')]=_['keys'](_0x3e7779[_0x9649('0x35')]);_0x587f0a['filters']=_[_0x9649('0x36')](_0x587f0a[_0x9649('0x34')],_0x587f0a[_0x9649('0x35')]);_0x97b811[_0x9649('0x37')]=_[_0x9649('0x36')](_0x587f0a[_0x9649('0x34')],qs['fields'](_0x3e7779[_0x9649('0x35')][_0x9649('0x38')]));_0x97b811[_0x9649('0x37')]=_0x97b811[_0x9649('0x37')][_0x9649('0x39')]?_0x97b811[_0x9649('0x37')]:_0x587f0a[_0x9649('0x34')];if(!_0x3e7779[_0x9649('0x35')][_0x9649('0x3a')](_0x9649('0x3b'))){_0x97b811[_0x9649('0x1d')]=qs['limit'](_0x3e7779[_0x9649('0x35')][_0x9649('0x1d')]);_0x97b811[_0x9649('0x1f')]=qs[_0x9649('0x1f')](_0x3e7779[_0x9649('0x35')][_0x9649('0x1f')]);}_0x97b811[_0x9649('0x3c')]=qs[_0x9649('0x3d')](_0x3e7779[_0x9649('0x35')][_0x9649('0x3d')]);_0x97b811[_0x9649('0x3e')]=qs['filters'](_['pick'](_0x3e7779[_0x9649('0x35')],_0x587f0a['filters']),_0xce36f9);if(_0x3e7779[_0x9649('0x35')]['filter']){_0x97b811[_0x9649('0x3e')]=_[_0x9649('0x3f')](_0x97b811[_0x9649('0x3e')],{'$or':_[_0x9649('0x2e')](_0xce36f9,function(_0x2a3a86){if(_0x2a3a86['type']!==_0x9649('0x40')){var _0x39ee79={};_0x39ee79[_0x2a3a86[_0x9649('0x2b')]]={'$like':'%'+_0x3e7779[_0x9649('0x35')][_0x9649('0x41')]+'%'};return _0x39ee79;}})});}_0x97b811=_[_0x9649('0x3f')]({},_0x97b811,_0x3e7779[_0x9649('0x42')]);var _0x50491a={'where':_0x97b811[_0x9649('0x3e')]};return db['SalesforceAccount'][_0x9649('0x1e')](_0x50491a)[_0x9649('0x27')](function(_0x3a789e){_0x1b7d12[_0x9649('0x1e')]=_0x3a789e;if(_0x3e7779[_0x9649('0x35')][_0x9649('0x43')]){_0x97b811[_0x9649('0x44')]=[{'all':!![]}];}return db[_0x9649('0x2f')][_0x9649('0x45')](_0x97b811);})['then'](function(_0x4fc405){_0x1b7d12[_0x9649('0x46')]=_0x4fc405;return _0x1b7d12;})['then'](respondWithFilteredResult(_0x2ec16b,_0x97b811))[_0x9649('0x47')](handleError(_0x2ec16b,null));};exports[_0x9649('0x48')]=function(_0x353c53,_0x47df91){var _0x134f32={'raw':![],'where':{'id':_0x353c53[_0x9649('0x49')]['id']}},_0x6d0e99={};_0x6d0e99['model']=_[_0x9649('0x4a')](db[_0x9649('0x2f')][_0x9649('0x30')]);_0x6d0e99[_0x9649('0x35')]=_[_0x9649('0x4a')](_0x353c53[_0x9649('0x35')]);_0x6d0e99['filters']=_['intersection'](_0x6d0e99[_0x9649('0x34')],_0x6d0e99[_0x9649('0x35')]);_0x134f32[_0x9649('0x37')]=_[_0x9649('0x36')](_0x6d0e99[_0x9649('0x34')],qs[_0x9649('0x38')](_0x353c53[_0x9649('0x35')][_0x9649('0x38')]));_0x134f32[_0x9649('0x37')]=_0x134f32[_0x9649('0x37')][_0x9649('0x39')]?_0x134f32[_0x9649('0x37')]:_0x6d0e99[_0x9649('0x34')];if(_0x353c53['query'][_0x9649('0x43')]){_0x134f32['include']=[{'all':!![]}];}_0x134f32=_[_0x9649('0x3f')]({},_0x134f32,_0x353c53['options']);return db[_0x9649('0x2f')][_0x9649('0x4b')](_0x134f32)[_0x9649('0x27')](handleEntityNotFound(_0x47df91,null))[_0x9649('0x27')](respondWithResult(_0x47df91,null))[_0x9649('0x47')](handleError(_0x47df91,null));};exports[_0x9649('0x4c')]=function(_0x396605,_0x280122){return db[_0x9649('0x2f')][_0x9649('0x4c')](_0x396605[_0x9649('0x4d')],{})[_0x9649('0x27')](respondWithResult(_0x280122,0xc9))[_0x9649('0x47')](handleError(_0x280122,null));};exports['update']=function(_0x6bd526,_0xa5ad10){if(_0x6bd526['body']['id']){delete _0x6bd526[_0x9649('0x4d')]['id'];}return db['SalesforceAccount'][_0x9649('0x4b')]({'where':{'id':_0x6bd526[_0x9649('0x49')]['id']}})[_0x9649('0x27')](handleEntityNotFound(_0xa5ad10,null))[_0x9649('0x27')](saveUpdates(_0x6bd526[_0x9649('0x4d')],null))['then'](respondWithResult(_0xa5ad10,null))[_0x9649('0x47')](handleError(_0xa5ad10,null));};exports[_0x9649('0x28')]=function(_0x36eb00,_0x3211c9){return db[_0x9649('0x2f')][_0x9649('0x4b')]({'where':{'id':_0x36eb00[_0x9649('0x49')]['id']}})[_0x9649('0x27')](handleEntityNotFound(_0x3211c9,null))['then'](removeEntity(_0x3211c9,null))[_0x9649('0x47')](handleError(_0x3211c9,null));};exports[_0x9649('0x4e')]=function(_0xd464d1,_0x690fac,_0x5d05c0){var _0x3364fd={};var _0x12b5ac={};var _0xe32266;var _0x24545c;return db['SalesforceAccount'][_0x9649('0x4f')]({'where':{'id':_0xd464d1[_0x9649('0x49')]['id']}})['then'](handleEntityNotFound(_0x690fac,null))['then'](function(_0x500de8){if(_0x500de8){_0xe32266=_0x500de8;_0x12b5ac[_0x9649('0x34')]=_['keys'](db['SalesforceConfiguration'][_0x9649('0x30')]);_0x12b5ac[_0x9649('0x35')]=_[_0x9649('0x4a')](_0xd464d1['query']);_0x12b5ac['filters']=_[_0x9649('0x36')](_0x12b5ac['model'],_0x12b5ac['query']);_0x3364fd[_0x9649('0x37')]=_[_0x9649('0x36')](_0x12b5ac['model'],qs['fields'](_0xd464d1['query'][_0x9649('0x38')]));_0x3364fd[_0x9649('0x37')]=_0x3364fd[_0x9649('0x37')][_0x9649('0x39')]?_0x3364fd[_0x9649('0x37')]:_0x12b5ac[_0x9649('0x34')];_0x3364fd[_0x9649('0x3c')]=qs[_0x9649('0x3d')](_0xd464d1[_0x9649('0x35')][_0x9649('0x3d')]);_0x3364fd['where']=qs[_0x9649('0x50')](_[_0x9649('0x51')](_0xd464d1[_0x9649('0x35')],_0x12b5ac['filters']));if(_0xd464d1[_0x9649('0x35')][_0x9649('0x41')]){_0x3364fd['where']=_['merge'](_0x3364fd['where'],{'$or':_[_0x9649('0x2e')](_0x3364fd['attributes'],function(_0x57cf99){var _0x34517a={};_0x34517a[_0x57cf99]={'$like':'%'+_0xd464d1[_0x9649('0x35')]['filter']+'%'};return _0x34517a;})});}_0x3364fd=_['merge']({},_0x3364fd,_0xd464d1[_0x9649('0x42')]);return _0xe32266[_0x9649('0x4e')](_0x3364fd);}})['then'](function(_0x2dbf32){if(_0x2dbf32){_0x24545c=_0x2dbf32[_0x9649('0x39')];if(!_0xd464d1[_0x9649('0x35')]['hasOwnProperty'](_0x9649('0x3b'))){_0x3364fd[_0x9649('0x1d')]=qs[_0x9649('0x1d')](_0xd464d1[_0x9649('0x35')][_0x9649('0x1d')]);_0x3364fd[_0x9649('0x1f')]=qs[_0x9649('0x1f')](_0xd464d1['query'][_0x9649('0x1f')]);}return _0xe32266['getConfigurations'](_0x3364fd);}})[_0x9649('0x27')](function(_0x310f0d){if(_0x310f0d){return _0x310f0d?{'count':_0x24545c,'rows':_0x310f0d}:null;}})['then'](respondWithResult(_0x690fac,null))[_0x9649('0x47')](handleError(_0x690fac,null));};exports['addConfiguration']=function(_0x18a212,_0x44d08f,_0x309274){if(_0x18a212[_0x9649('0x4d')]['id']){delete _0x18a212[_0x9649('0x4d')]['id'];}return db[_0x9649('0x2f')][_0x9649('0x4f')]({'where':{'id':_0x18a212[_0x9649('0x49')]['id']}})['then'](handleEntityNotFound(_0x44d08f,null))[_0x9649('0x27')](function(_0x1f5aef){if(_0x1f5aef){_0x18a212[_0x9649('0x4d')][_0x9649('0x52')]=_0x1f5aef['id'];_0x18a212['body'][_0x9649('0x53')]=integrations[_0x9649('0x54')](_0x18a212[_0x9649('0x4d')][_0x9649('0x55')],_0x18a212['body'][_0x9649('0x32')]);_0x18a212['body'][_0x9649('0x56')]=integrations['getDescriptions'](_0x18a212[_0x9649('0x4d')][_0x9649('0x55')],_0x18a212['body'][_0x9649('0x32')]);return db[_0x9649('0x57')][_0x9649('0x4c')](_0x18a212[_0x9649('0x4d')],{'include':[{'model':db['SalesforceField'],'as':_0x9649('0x53')},{'model':db[_0x9649('0x58')],'as':_0x9649('0x56')}]});}return null;})[_0x9649('0x27')](respondWithResult(_0x44d08f,null))[_0x9649('0x47')](handleError(_0x44d08f,null));};exports[_0x9649('0x59')]=function(_0x594cbb,_0x529ed1,_0x268cb5){var _0x1b4ea7;var _0xfc1050='';var _0x4e18f2=_0x9649('0x5a');return db[_0x9649('0x2f')][_0x9649('0x4f')]({'where':{'id':_0x594cbb[_0x9649('0x49')]['id']},'attributes':['id',_0x9649('0x5b'),'clientId','clientSecret','username','password',_0x9649('0x5c')]})[_0x9649('0x27')](handleEntityNotFound(_0x529ed1,null))[_0x9649('0x27')](function(_0x27f198){if(_0x27f198){_0xfc1050=_0x27f198[_0x9649('0x5b')];var _0x2fb449=_0xfc1050['slice'](-0x1);if(_0x2fb449==='/'){_0xfc1050=_0xfc1050[_0x9649('0x5d')](0x0,_0xfc1050[_0x9649('0x5e')](_0x2fb449));}_0x1b4ea7=new jsforce[(_0x9649('0x5f'))]({'oauth2':{'loginUrl':_0xfc1050,'clientId':_0x27f198[_0x9649('0x60')],'clientSecret':_0x27f198[_0x9649('0x61')]}});return _0x1b4ea7['login'](_0x27f198[_0x9649('0x62')],_0x27f198[_0x9649('0x63')][_0x9649('0x64')](_0x27f198[_0x9649('0x5c')]));}})['then'](function(_0x22c3d4){if(_0x22c3d4){if(!_[_0x9649('0x65')](_0x594cbb['query']['ticketType'])){_0x4e18f2=_0x594cbb[_0x9649('0x35')][_0x9649('0x66')];}return _0x1b4ea7['sobject'](_0x4e18f2)[_0x9649('0x67')]();}})[_0x9649('0x27')](function(_0x16533f){var _0x2e6984=[_0x9649('0x68'),'ActivityDate','IsReminderSet',_0x9649('0x69'),'Subject','Description'];var _0x4503f1=[_0x9649('0x6a'),'int',_0x9649('0x6b'),'boolean',_0x9649('0x6c'),'textarea',_0x9649('0x6d')];if(_0x16533f){_['remove'](_0x16533f[_0x9649('0x38')],function(_0x520414){return _0x2e6984[_0x9649('0x6e')](_0x520414['name'])||!_0x4503f1['includes'](_0x520414[_0x9649('0x32')]);});return{'count':_0x16533f[_0x9649('0x38')][_0x9649('0x39')],'rows':_[_0x9649('0x2e')](_0x16533f['fields'],function(_0x5b95b0){return{'id':_0x5b95b0[_0x9649('0x2b')],'name':_0x5b95b0[_0x9649('0x6f')],'custom':_0x5b95b0[_0x9649('0x70')],'options':_0x5b95b0[_0x9649('0x71')][_0x9649('0x39')]>0x0?_[_0x9649('0x2e')](_0x5b95b0['picklistValues'],function(_0x2e44be){return{'name':_0x2e44be[_0x9649('0x6f')],'value':_0x2e44be[_0x9649('0x72')]};}):_0x5b95b0[_0x9649('0x32')]=='boolean'?[{'name':_0x9649('0x73'),'value':_0x9649('0x74')},{'name':_0x9649('0x75'),'value':_0x9649('0x76')}]:[]};})};}})[_0x9649('0x27')](respondWithResult(_0x529ed1,null))[_0x9649('0x47')](function(_0xcd0dc2){var _0x30face=_0x594cbb[_0x9649('0x35')][_0x9649('0x77')]?0x1f4:_0xcd0dc2[_0x9649('0x78')]||0x1f4;logger[_0x9649('0x29')](_0x9649('0x79'),_0x9649('0x59'),_0x30face,JSON['stringify'](_0xcd0dc2));delete _0xcd0dc2['name'];if(_0x30face===0x191){_0x30face=0x190;}_0x529ed1[_0x9649('0x1b')](_0x30face)['send'](_0x594cbb[_0x9649('0x35')]['test']?{'message':_0x9649('0x7a'),'statusCode':_0xcd0dc2[_0x9649('0x78')]}:_0xcd0dc2);});}; \ No newline at end of file +var _0x36f2=['email','textarea','phone','remove','includes','picklistValues','false','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','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','SalesforceAccount','includeAll','include','findAll','rows','show','params','find','create','body','catch','findOne','SalesforceConfiguration','order','pick','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','SalesforceField','Subjects','Task','remoteUri','clientId','username','securityToken','slice','substring','lastIndexOf','Connection','clientSecret','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean'];(function(_0xb3bbc8,_0x2a3635){var _0x3254b7=function(_0x823e23){while(--_0x823e23){_0xb3bbc8['push'](_0xb3bbc8['shift']());}};_0x3254b7(++_0x2a3635);}(_0x36f2,0x8b));var _0x236f=function(_0x38d154,_0x3e835b){_0x38d154=_0x38d154-0x0;var _0x50c412=_0x36f2[_0x38d154];return _0x50c412;};'use strict';var emlformat=require(_0x236f('0x0'));var rimraf=require(_0x236f('0x1'));var zipdir=require(_0x236f('0x2'));var jsonpatch=require(_0x236f('0x3'));var rp=require(_0x236f('0x4'));var moment=require(_0x236f('0x5'));var BPromise=require(_0x236f('0x6'));var Mustache=require(_0x236f('0x7'));var util=require(_0x236f('0x8'));var path=require(_0x236f('0x9'));var sox=require(_0x236f('0xa'));var csv=require('to-csv');var ejs=require(_0x236f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x236f('0xc'));var squel=require(_0x236f('0xd'));var crypto=require(_0x236f('0xe'));var jsforce=require(_0x236f('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x236f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x236f('0x11'));var qs=require(_0x236f('0x12'));var as=require(_0x236f('0x13'));var hardwareService=require(_0x236f('0x14'));var logger=require(_0x236f('0x15'))('api');var utils=require(_0x236f('0x16'));var config=require(_0x236f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x236f('0x18'))['db'];var integrations=require(_0x236f('0x19'));function respondWithStatusCode(_0x2e5631,_0x11d619){_0x11d619=_0x11d619||0xcc;return function(_0x1d82da){if(_0x1d82da){return _0x2e5631[_0x236f('0x1a')](_0x11d619);}return _0x2e5631[_0x236f('0x1b')](_0x11d619)[_0x236f('0x1c')]();};}function respondWithResult(_0x2be4f8,_0x41fdb5){_0x41fdb5=_0x41fdb5||0xc8;return function(_0x1081ac){if(_0x1081ac){return _0x2be4f8[_0x236f('0x1b')](_0x41fdb5)[_0x236f('0x1d')](_0x1081ac);}};}function respondWithFilteredResult(_0x3574b3,_0x39dfa0){return function(_0x4adfbf){if(_0x4adfbf){var _0xf6f6d5=typeof _0x39dfa0['offset']===_0x236f('0x1e')&&typeof _0x39dfa0['limit']==='undefined';var _0x254e94=_0x4adfbf['count'];var _0x345b69=_0xf6f6d5?0x0:_0x39dfa0[_0x236f('0x1f')];var _0x8b1f35=_0xf6f6d5?_0x4adfbf[_0x236f('0x20')]:_0x39dfa0[_0x236f('0x1f')]+_0x39dfa0[_0x236f('0x21')];var _0x22b4e5;if(_0x8b1f35>=_0x254e94){_0x8b1f35=_0x254e94;_0x22b4e5=0xc8;}else{_0x22b4e5=0xce;}_0x3574b3[_0x236f('0x1b')](_0x22b4e5);return _0x3574b3[_0x236f('0x22')](_0x236f('0x23'),_0x345b69+'-'+_0x8b1f35+'/'+_0x254e94)[_0x236f('0x1d')](_0x4adfbf);}return null;};}function patchUpdates(_0x90fdd5){return function(_0x5df2fb){try{jsonpatch['apply'](_0x5df2fb,_0x90fdd5,!![]);}catch(_0x8f4727){return BPromise[_0x236f('0x24')](_0x8f4727);}return _0x5df2fb['save']();};}function saveUpdates(_0x480a13,_0x48cfa2){return function(_0x2a4dbf){if(_0x2a4dbf){return _0x2a4dbf[_0x236f('0x25')](_0x480a13)['then'](function(_0x521d4b){return _0x521d4b;});}return null;};}function removeEntity(_0x5cf7d2,_0x47f644){return function(_0x416ae1){if(_0x416ae1){return _0x416ae1[_0x236f('0x26')]()[_0x236f('0x27')](function(){_0x5cf7d2[_0x236f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dc5dc,_0x1b420a){return function(_0x446221){if(!_0x446221){_0x2dc5dc[_0x236f('0x1a')](0x194);}return _0x446221;};}function handleError(_0x46d739,_0xb14373){_0xb14373=_0xb14373||0x1f4;return function(_0x338170){logger['error'](_0x338170[_0x236f('0x28')]);if(_0x338170[_0x236f('0x29')]){delete _0x338170[_0x236f('0x29')];}_0x46d739['status'](_0xb14373)[_0x236f('0x2a')](_0x338170);};}exports[_0x236f('0x2b')]=function(_0x34b514,_0x5b230c){var _0x5b37c0={},_0x294599={},_0x3fdb2d={'count':0x0,'rows':[]};var _0x30ea85=_[_0x236f('0x2c')](db['SalesforceAccount'][_0x236f('0x2d')],function(_0x4648f7){return{'name':_0x4648f7[_0x236f('0x2e')],'type':_0x4648f7[_0x236f('0x2f')][_0x236f('0x30')]};});_0x294599[_0x236f('0x31')]=_[_0x236f('0x2c')](_0x30ea85,'name');_0x294599[_0x236f('0x32')]=_[_0x236f('0x33')](_0x34b514['query']);_0x294599[_0x236f('0x34')]=_[_0x236f('0x35')](_0x294599[_0x236f('0x31')],_0x294599[_0x236f('0x32')]);_0x5b37c0[_0x236f('0x36')]=_[_0x236f('0x35')](_0x294599[_0x236f('0x31')],qs[_0x236f('0x37')](_0x34b514[_0x236f('0x32')]['fields']));_0x5b37c0[_0x236f('0x36')]=_0x5b37c0['attributes'][_0x236f('0x38')]?_0x5b37c0[_0x236f('0x36')]:_0x294599[_0x236f('0x31')];if(!_0x34b514[_0x236f('0x32')][_0x236f('0x39')](_0x236f('0x3a'))){_0x5b37c0[_0x236f('0x21')]=qs[_0x236f('0x21')](_0x34b514[_0x236f('0x32')]['limit']);_0x5b37c0[_0x236f('0x1f')]=qs['offset'](_0x34b514[_0x236f('0x32')][_0x236f('0x1f')]);}_0x5b37c0['order']=qs[_0x236f('0x3b')](_0x34b514[_0x236f('0x32')][_0x236f('0x3b')]);_0x5b37c0['where']=qs['filters'](_['pick'](_0x34b514[_0x236f('0x32')],_0x294599[_0x236f('0x34')]),_0x30ea85);if(_0x34b514['query'][_0x236f('0x3c')]){_0x5b37c0[_0x236f('0x3d')]=_[_0x236f('0x3e')](_0x5b37c0[_0x236f('0x3d')],{'$or':_[_0x236f('0x2c')](_0x30ea85,function(_0x327181){if(_0x327181[_0x236f('0x2f')]!==_0x236f('0x3f')){var _0xb9d27={};_0xb9d27[_0x327181[_0x236f('0x29')]]={'$like':'%'+_0x34b514[_0x236f('0x32')]['filter']+'%'};return _0xb9d27;}})});}_0x5b37c0=_[_0x236f('0x3e')]({},_0x5b37c0,_0x34b514[_0x236f('0x40')]);var _0x53a7ca={'where':_0x5b37c0['where']};return db[_0x236f('0x41')]['count'](_0x53a7ca)['then'](function(_0x586ba2){_0x3fdb2d[_0x236f('0x20')]=_0x586ba2;if(_0x34b514[_0x236f('0x32')][_0x236f('0x42')]){_0x5b37c0[_0x236f('0x43')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x236f('0x44')](_0x5b37c0);})[_0x236f('0x27')](function(_0x2b1663){_0x3fdb2d[_0x236f('0x45')]=_0x2b1663;return _0x3fdb2d;})['then'](respondWithFilteredResult(_0x5b230c,_0x5b37c0))['catch'](handleError(_0x5b230c,null));};exports[_0x236f('0x46')]=function(_0x5f0bbe,_0x5adc47){var _0x34bcbe={'raw':![],'where':{'id':_0x5f0bbe[_0x236f('0x47')]['id']}},_0x1aaa43={};_0x1aaa43['model']=_[_0x236f('0x33')](db['SalesforceAccount'][_0x236f('0x2d')]);_0x1aaa43[_0x236f('0x32')]=_['keys'](_0x5f0bbe[_0x236f('0x32')]);_0x1aaa43[_0x236f('0x34')]=_[_0x236f('0x35')](_0x1aaa43[_0x236f('0x31')],_0x1aaa43[_0x236f('0x32')]);_0x34bcbe[_0x236f('0x36')]=_[_0x236f('0x35')](_0x1aaa43[_0x236f('0x31')],qs[_0x236f('0x37')](_0x5f0bbe[_0x236f('0x32')][_0x236f('0x37')]));_0x34bcbe[_0x236f('0x36')]=_0x34bcbe['attributes'][_0x236f('0x38')]?_0x34bcbe[_0x236f('0x36')]:_0x1aaa43[_0x236f('0x31')];if(_0x5f0bbe[_0x236f('0x32')]['includeAll']){_0x34bcbe['include']=[{'all':!![]}];}_0x34bcbe=_['merge']({},_0x34bcbe,_0x5f0bbe['options']);return db['SalesforceAccount'][_0x236f('0x48')](_0x34bcbe)[_0x236f('0x27')](handleEntityNotFound(_0x5adc47,null))[_0x236f('0x27')](respondWithResult(_0x5adc47,null))['catch'](handleError(_0x5adc47,null));};exports[_0x236f('0x49')]=function(_0x2d5ff3,_0x58ba27){return db['SalesforceAccount']['create'](_0x2d5ff3[_0x236f('0x4a')],{})[_0x236f('0x27')](respondWithResult(_0x58ba27,0xc9))['catch'](handleError(_0x58ba27,null));};exports[_0x236f('0x25')]=function(_0x145b29,_0x5845a9){if(_0x145b29[_0x236f('0x4a')]['id']){delete _0x145b29[_0x236f('0x4a')]['id'];}return db[_0x236f('0x41')][_0x236f('0x48')]({'where':{'id':_0x145b29['params']['id']}})[_0x236f('0x27')](handleEntityNotFound(_0x5845a9,null))[_0x236f('0x27')](saveUpdates(_0x145b29[_0x236f('0x4a')],null))['then'](respondWithResult(_0x5845a9,null))['catch'](handleError(_0x5845a9,null));};exports['destroy']=function(_0x1122d8,_0x561d76){return db[_0x236f('0x41')][_0x236f('0x48')]({'where':{'id':_0x1122d8['params']['id']}})[_0x236f('0x27')](handleEntityNotFound(_0x561d76,null))[_0x236f('0x27')](removeEntity(_0x561d76,null))[_0x236f('0x4b')](handleError(_0x561d76,null));};exports['getConfigurations']=function(_0x1cb094,_0x2897ff,_0x59232f){var _0x481619={};var _0x1b5cbb={};var _0x62287c;var _0x41b8ec;return db[_0x236f('0x41')][_0x236f('0x4c')]({'where':{'id':_0x1cb094[_0x236f('0x47')]['id']}})[_0x236f('0x27')](handleEntityNotFound(_0x2897ff,null))['then'](function(_0x3ebd6a){if(_0x3ebd6a){_0x62287c=_0x3ebd6a;_0x1b5cbb['model']=_['keys'](db[_0x236f('0x4d')][_0x236f('0x2d')]);_0x1b5cbb['query']=_[_0x236f('0x33')](_0x1cb094[_0x236f('0x32')]);_0x1b5cbb[_0x236f('0x34')]=_[_0x236f('0x35')](_0x1b5cbb[_0x236f('0x31')],_0x1b5cbb[_0x236f('0x32')]);_0x481619[_0x236f('0x36')]=_[_0x236f('0x35')](_0x1b5cbb[_0x236f('0x31')],qs[_0x236f('0x37')](_0x1cb094[_0x236f('0x32')][_0x236f('0x37')]));_0x481619['attributes']=_0x481619[_0x236f('0x36')][_0x236f('0x38')]?_0x481619[_0x236f('0x36')]:_0x1b5cbb[_0x236f('0x31')];_0x481619[_0x236f('0x4e')]=qs[_0x236f('0x3b')](_0x1cb094[_0x236f('0x32')][_0x236f('0x3b')]);_0x481619[_0x236f('0x3d')]=qs['filters'](_[_0x236f('0x4f')](_0x1cb094[_0x236f('0x32')],_0x1b5cbb[_0x236f('0x34')]));if(_0x1cb094['query'][_0x236f('0x3c')]){_0x481619[_0x236f('0x3d')]=_[_0x236f('0x3e')](_0x481619[_0x236f('0x3d')],{'$or':_[_0x236f('0x2c')](_0x481619[_0x236f('0x36')],function(_0x5b87e2){var _0x42a2ba={};_0x42a2ba[_0x5b87e2]={'$like':'%'+_0x1cb094[_0x236f('0x32')][_0x236f('0x3c')]+'%'};return _0x42a2ba;})});}_0x481619=_[_0x236f('0x3e')]({},_0x481619,_0x1cb094['options']);return _0x62287c[_0x236f('0x50')](_0x481619);}})[_0x236f('0x27')](function(_0xb1725b){if(_0xb1725b){_0x41b8ec=_0xb1725b['length'];if(!_0x1cb094[_0x236f('0x32')][_0x236f('0x39')](_0x236f('0x3a'))){_0x481619[_0x236f('0x21')]=qs[_0x236f('0x21')](_0x1cb094[_0x236f('0x32')][_0x236f('0x21')]);_0x481619[_0x236f('0x1f')]=qs[_0x236f('0x1f')](_0x1cb094['query'][_0x236f('0x1f')]);}return _0x62287c[_0x236f('0x50')](_0x481619);}})[_0x236f('0x27')](function(_0x3fc443){if(_0x3fc443){return _0x3fc443?{'count':_0x41b8ec,'rows':_0x3fc443}:null;}})[_0x236f('0x27')](respondWithResult(_0x2897ff,null))[_0x236f('0x4b')](handleError(_0x2897ff,null));};exports[_0x236f('0x51')]=function(_0x4ffdcd,_0x482b39,_0x13c2d7){if(_0x4ffdcd['body']['id']){delete _0x4ffdcd[_0x236f('0x4a')]['id'];}return db[_0x236f('0x41')][_0x236f('0x4c')]({'where':{'id':_0x4ffdcd[_0x236f('0x47')]['id']}})['then'](handleEntityNotFound(_0x482b39,null))[_0x236f('0x27')](function(_0x2b9497){if(_0x2b9497){_0x4ffdcd[_0x236f('0x4a')][_0x236f('0x52')]=_0x2b9497['id'];_0x4ffdcd['body']['Subjects']=integrations[_0x236f('0x53')](_0x4ffdcd['body'][_0x236f('0x54')],_0x4ffdcd[_0x236f('0x4a')]['type']);_0x4ffdcd['body'][_0x236f('0x55')]=integrations['getDescriptions'](_0x4ffdcd[_0x236f('0x4a')][_0x236f('0x54')],_0x4ffdcd[_0x236f('0x4a')][_0x236f('0x2f')]);return db['SalesforceConfiguration'][_0x236f('0x49')](_0x4ffdcd[_0x236f('0x4a')],{'include':[{'model':db[_0x236f('0x56')],'as':_0x236f('0x57')},{'model':db['SalesforceField'],'as':_0x236f('0x55')}]});}return null;})[_0x236f('0x27')](respondWithResult(_0x482b39,null))['catch'](handleError(_0x482b39,null));};exports['getFields']=function(_0x506c41,_0x27c616,_0x1d4a51){var _0x196bc5;var _0x687369='';var _0x11a3f0=_0x236f('0x58');return db[_0x236f('0x41')]['findOne']({'where':{'id':_0x506c41[_0x236f('0x47')]['id']},'attributes':['id',_0x236f('0x59'),_0x236f('0x5a'),'clientSecret',_0x236f('0x5b'),'password',_0x236f('0x5c')]})['then'](handleEntityNotFound(_0x27c616,null))['then'](function(_0x341e3a){if(_0x341e3a){_0x687369=_0x341e3a[_0x236f('0x59')];var _0x5b4b72=_0x687369[_0x236f('0x5d')](-0x1);if(_0x5b4b72==='/'){_0x687369=_0x687369[_0x236f('0x5e')](0x0,_0x687369[_0x236f('0x5f')](_0x5b4b72));}_0x196bc5=new jsforce[(_0x236f('0x60'))]({'oauth2':{'loginUrl':_0x687369,'clientId':_0x341e3a[_0x236f('0x5a')],'clientSecret':_0x341e3a[_0x236f('0x61')]}});return _0x196bc5[_0x236f('0x62')](_0x341e3a['username'],_0x341e3a['password'][_0x236f('0x63')](_0x341e3a[_0x236f('0x5c')]));}})[_0x236f('0x27')](function(_0x3f7242){if(_0x3f7242){if(!_[_0x236f('0x64')](_0x506c41[_0x236f('0x32')][_0x236f('0x65')])){_0x11a3f0=_0x506c41[_0x236f('0x32')][_0x236f('0x65')];}return _0x196bc5[_0x236f('0x66')](_0x11a3f0)[_0x236f('0x67')]();}})[_0x236f('0x27')](function(_0x51a95d){var _0x48469c=[_0x236f('0x68'),_0x236f('0x69'),_0x236f('0x6a'),_0x236f('0x6b'),_0x236f('0x6c'),'Description'];var _0x45f948=[_0x236f('0x6d'),_0x236f('0x6e'),_0x236f('0x6f'),_0x236f('0x70'),_0x236f('0x71'),_0x236f('0x72'),_0x236f('0x73')];if(_0x51a95d){_[_0x236f('0x74')](_0x51a95d['fields'],function(_0x45a0a1){return _0x48469c[_0x236f('0x75')](_0x45a0a1['name'])||!_0x45f948[_0x236f('0x75')](_0x45a0a1[_0x236f('0x2f')]);});return{'count':_0x51a95d[_0x236f('0x37')][_0x236f('0x38')],'rows':_[_0x236f('0x2c')](_0x51a95d[_0x236f('0x37')],function(_0x388854){return{'id':_0x388854[_0x236f('0x29')],'name':_0x388854['label'],'custom':_0x388854['custom'],'options':_0x388854[_0x236f('0x76')]['length']>0x0?_[_0x236f('0x2c')](_0x388854[_0x236f('0x76')],function(_0x7accd7){return{'name':_0x7accd7['label'],'value':_0x7accd7['value']};}):_0x388854[_0x236f('0x2f')]==_0x236f('0x70')?[{'name':'True','value':'true'},{'name':'False','value':_0x236f('0x77')}]:[]};})};}})['then'](respondWithResult(_0x27c616,null))[_0x236f('0x4b')](function(_0x4793){var _0x2e8b80=_0x506c41['query'][_0x236f('0x78')]?0x1f4:_0x4793[_0x236f('0x79')]||0x1f4;logger['error'](_0x236f('0x7a'),_0x236f('0x7b'),_0x2e8b80,JSON[_0x236f('0x7c')](_0x4793));delete _0x4793[_0x236f('0x29')];if(_0x2e8b80===0x191){_0x2e8b80=0x190;}_0x27c616['status'](_0x2e8b80)[_0x236f('0x2a')](_0x506c41[_0x236f('0x32')][_0x236f('0x78')]?{'message':_0x236f('0x7d'),'statusCode':_0x4793[_0x236f('0x79')]}:_0x4793);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index c2e4731..2f1b3c5 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 _0xbaa9=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','bluebird','request-promise'];(function(_0x3cc47c,_0x1e59e2){var _0x1fe90f=function(_0x1c024b){while(--_0x1c024b){_0x3cc47c['push'](_0x3cc47c['shift']());}};_0x1fe90f(++_0x1e59e2);}(_0xbaa9,0x188));var _0x9baa=function(_0x2a16f3,_0x37360a){_0x2a16f3=_0x2a16f3-0x0;var _0x13e18b=_0xbaa9[_0x2a16f3];return _0x13e18b;};'use strict';var _=require(_0x9baa('0x0'));var util=require('util');var logger=require(_0x9baa('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9baa('0x2'));var rp=require(_0x9baa('0x3'));var fs=require('fs');var path=require(_0x9baa('0x4'));var rimraf=require(_0x9baa('0x5'));var config=require(_0x9baa('0x6'));var attributes=require(_0x9baa('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x9baa('0x8')]=function(_0x5be12a,_0x102c4d){return _0x5be12a[_0x9baa('0x9')](_0x9baa('0xa'),attributes,{'tableName':_0x9baa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48e0=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','util','../../config/logger','api','moment'];(function(_0x15d68a,_0x2cbb0f){var _0x311647=function(_0x45e54f){while(--_0x45e54f){_0x15d68a['push'](_0x15d68a['shift']());}};_0x311647(++_0x2cbb0f);}(_0x48e0,0x146));var _0x048e=function(_0x31dbf1,_0x424a9c){_0x31dbf1=_0x31dbf1-0x0;var _0x3966cb=_0x48e0[_0x31dbf1];return _0x3966cb;};'use strict';var _=require('lodash');var util=require(_0x048e('0x0'));var logger=require(_0x048e('0x1'))(_0x048e('0x2'));var moment=require(_0x048e('0x3'));var BPromise=require(_0x048e('0x4'));var rp=require(_0x048e('0x5'));var fs=require('fs');var path=require(_0x048e('0x6'));var rimraf=require(_0x048e('0x7'));var config=require(_0x048e('0x8'));var attributes=require(_0x048e('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x133959,_0x12a9ba){return _0x133959['define']('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','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 92570c6..c9c127c 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 _0x88f5=['then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','limit','include','map','model','attributes','ShowSalesforceAccount','raw','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','http','request'];(function(_0x30d815,_0x2c5c67){var _0x150123=function(_0x48282b){while(--_0x48282b){_0x30d815['push'](_0x30d815['shift']());}};_0x150123(++_0x2c5c67);}(_0x88f5,0x162));var _0x588f=function(_0x47b9f4,_0x52b165){_0x47b9f4=_0x47b9f4-0x0;var _0x4cc4b5=_0x88f5[_0x47b9f4];return _0x4cc4b5;};'use strict';var _=require(_0x588f('0x0'));var util=require('util');var moment=require(_0x588f('0x1'));var BPromise=require(_0x588f('0x2'));var rs=require(_0x588f('0x3'));var fs=require('fs');var Redis=require(_0x588f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x588f('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x588f('0x6'));var client=jayson['client'][_0x588f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2af8c1,_0x3798ec,_0x437e0e){return new BPromise(function(_0x4bf7e2,_0x322014){return client[_0x588f('0x8')](_0x2af8c1,_0x437e0e)[_0x588f('0x9')](function(_0x36b79d){logger[_0x588f('0xa')](_0x588f('0xb'),_0x3798ec,_0x588f('0xc'));logger[_0x588f('0xd')](_0x588f('0xe'),_0x3798ec,_0x588f('0xc'),JSON['stringify'](_0x36b79d));if(_0x36b79d[_0x588f('0xf')]){if(_0x36b79d[_0x588f('0xf')][_0x588f('0x10')]===0x1f4){logger['error'](_0x588f('0xb'),_0x3798ec,_0x36b79d[_0x588f('0xf')]['message']);return _0x322014(_0x36b79d['error'][_0x588f('0x11')]);}logger[_0x588f('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x3798ec,_0x36b79d[_0x588f('0xf')][_0x588f('0x11')]);return _0x4bf7e2(_0x36b79d[_0x588f('0xf')][_0x588f('0x11')]);}else{logger[_0x588f('0xa')](_0x588f('0xb'),_0x3798ec,_0x588f('0xc'));_0x4bf7e2(_0x36b79d[_0x588f('0x12')][_0x588f('0x11')]);}})[_0x588f('0x13')](function(_0x165694){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x3798ec,_0x165694);_0x322014(_0x165694);});});}exports[_0x588f('0x14')]=function(_0x1886d9){var _0x8ceaab=this;return new Promise(function(_0x40d827,_0x5c657f){return db[_0x588f('0x15')][_0x588f('0x16')]({'raw':_0x1886d9[_0x588f('0x17')]?_0x1886d9['options']['raw']===undefined?!![]:![]:!![],'where':_0x1886d9['options']?_0x1886d9[_0x588f('0x17')][_0x588f('0x18')]||null:null,'attributes':_0x1886d9[_0x588f('0x17')]?_0x1886d9[_0x588f('0x17')]['attributes']||null:null,'limit':_0x1886d9[_0x588f('0x17')]?_0x1886d9['options'][_0x588f('0x19')]||null:null,'include':_0x1886d9[_0x588f('0x17')]?_0x1886d9['options'][_0x588f('0x1a')]?_[_0x588f('0x1b')](_0x1886d9[_0x588f('0x17')][_0x588f('0x1a')],function(_0x1f9ce8){return{'model':db[_0x1f9ce8[_0x588f('0x1c')]],'as':_0x1f9ce8['as'],'attributes':_0x1f9ce8['attributes'],'include':_0x1f9ce8[_0x588f('0x1a')]?_['map'](_0x1f9ce8[_0x588f('0x1a')],function(_0x478809){return{'model':db[_0x478809[_0x588f('0x1c')]],'as':_0x478809['as'],'attributes':_0x478809['attributes'],'include':_0x478809[_0x588f('0x1a')]?_[_0x588f('0x1b')](_0x478809[_0x588f('0x1a')],function(_0x52ed33){return{'model':db[_0x52ed33[_0x588f('0x1c')]],'as':_0x52ed33['as'],'attributes':_0x52ed33[_0x588f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x588f('0x9')](function(_0x5bd6c3){logger['info'](_0x588f('0x14'),_0x1886d9);logger[_0x588f('0xd')]('GetSalesforceAccount',_0x1886d9,JSON['stringify'](_0x5bd6c3));_0x40d827(_0x5bd6c3);})[_0x588f('0x13')](function(_0x373c06){logger['error'](_0x588f('0x14'),_0x373c06['message'],_0x1886d9);_0x5c657f(_0x8ceaab[_0x588f('0xf')](0x1f4,_0x373c06['message']));});});};exports[_0x588f('0x1e')]=function(_0x428638){var _0x41a6c4=this;return new Promise(function(_0x54cfe0,_0x387700){return db['SalesforceAccount']['find']({'raw':_0x428638['options']?_0x428638[_0x588f('0x17')][_0x588f('0x1f')]===undefined?!![]:![]:!![],'where':_0x428638[_0x588f('0x17')]?_0x428638[_0x588f('0x17')][_0x588f('0x18')]||null:null,'attributes':_0x428638[_0x588f('0x17')]?_0x428638[_0x588f('0x17')][_0x588f('0x1d')]||null:null,'include':_0x428638[_0x588f('0x17')]?_0x428638['options']['include']?_[_0x588f('0x1b')](_0x428638[_0x588f('0x17')][_0x588f('0x1a')],function(_0x873264){return{'model':db[_0x873264[_0x588f('0x1c')]],'as':_0x873264['as'],'attributes':_0x873264[_0x588f('0x1d')],'include':_0x873264[_0x588f('0x1a')]?_[_0x588f('0x1b')](_0x873264[_0x588f('0x1a')],function(_0x4095b0){return{'model':db[_0x4095b0[_0x588f('0x1c')]],'as':_0x4095b0['as'],'attributes':_0x4095b0[_0x588f('0x1d')],'include':_0x4095b0[_0x588f('0x1a')]?_[_0x588f('0x1b')](_0x4095b0[_0x588f('0x1a')],function(_0x2c92ee){return{'model':db[_0x2c92ee[_0x588f('0x1c')]],'as':_0x2c92ee['as'],'attributes':_0x2c92ee[_0x588f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x588f('0x9')](function(_0x3c48c1){logger[_0x588f('0xa')](_0x588f('0x1e'),_0x428638);logger['debug'](_0x588f('0x1e'),_0x428638,JSON[_0x588f('0x20')](_0x3c48c1));_0x54cfe0(_0x3c48c1);})[_0x588f('0x13')](function(_0x3a9df1){logger[_0x588f('0xf')](_0x588f('0x1e'),_0x3a9df1['message'],_0x428638);_0x387700(_0x41a6c4['error'](0x1f4,_0x3a9df1[_0x588f('0x11')]));});});}; \ No newline at end of file +var _0x6aba=['SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowSalesforceAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x6aba,0x1e8));var _0xa6ab=function(_0x20f1ac,_0x2ffdb4){_0x20f1ac=_0x20f1ac-0x0;var _0xcb2985=_0x6aba[_0x20f1ac];return _0xcb2985;};'use strict';var _=require(_0xa6ab('0x0'));var util=require('util');var moment=require(_0xa6ab('0x1'));var BPromise=require('bluebird');var rs=require(_0xa6ab('0x2'));var fs=require('fs');var Redis=require(_0xa6ab('0x3'));var db=require(_0xa6ab('0x4'))['db'];var utils=require(_0xa6ab('0x5'));var logger=require(_0xa6ab('0x6'))(_0xa6ab('0x7'));var config=require('../../config/environment');var jayson=require(_0xa6ab('0x8'));var client=jayson[_0xa6ab('0x9')][_0xa6ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xee3bb0,_0xc2242b,_0x67d233){return new BPromise(function(_0x3c7f00,_0x3edd63){return client['request'](_0xee3bb0,_0x67d233)[_0xa6ab('0xb')](function(_0x3cf302){logger[_0xa6ab('0xc')](_0xa6ab('0xd'),_0xc2242b,_0xa6ab('0xe'));logger[_0xa6ab('0xf')](_0xa6ab('0x10'),_0xc2242b,_0xa6ab('0xe'),JSON['stringify'](_0x3cf302));if(_0x3cf302[_0xa6ab('0x11')]){if(_0x3cf302[_0xa6ab('0x11')][_0xa6ab('0x12')]===0x1f4){logger[_0xa6ab('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0xc2242b,_0x3cf302['error'][_0xa6ab('0x13')]);return _0x3edd63(_0x3cf302[_0xa6ab('0x11')][_0xa6ab('0x13')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0xc2242b,_0x3cf302[_0xa6ab('0x11')][_0xa6ab('0x13')]);return _0x3c7f00(_0x3cf302[_0xa6ab('0x11')][_0xa6ab('0x13')]);}else{logger[_0xa6ab('0xc')](_0xa6ab('0xd'),_0xc2242b,_0xa6ab('0xe'));_0x3c7f00(_0x3cf302[_0xa6ab('0x14')]['message']);}})['catch'](function(_0x2e83a6){logger[_0xa6ab('0x11')](_0xa6ab('0xd'),_0xc2242b,_0x2e83a6);_0x3edd63(_0x2e83a6);});});}exports[_0xa6ab('0x15')]=function(_0x213283){var _0x18d855=this;return new Promise(function(_0x202d13,_0x35bf06){return db[_0xa6ab('0x16')][_0xa6ab('0x17')]({'raw':_0x213283[_0xa6ab('0x18')]?_0x213283[_0xa6ab('0x18')][_0xa6ab('0x19')]===undefined?!![]:![]:!![],'where':_0x213283['options']?_0x213283[_0xa6ab('0x18')][_0xa6ab('0x1a')]||null:null,'attributes':_0x213283[_0xa6ab('0x18')]?_0x213283['options'][_0xa6ab('0x1b')]||null:null,'limit':_0x213283[_0xa6ab('0x18')]?_0x213283['options'][_0xa6ab('0x1c')]||null:null,'include':_0x213283[_0xa6ab('0x18')]?_0x213283['options'][_0xa6ab('0x1d')]?_[_0xa6ab('0x1e')](_0x213283[_0xa6ab('0x18')][_0xa6ab('0x1d')],function(_0x1cb08f){return{'model':db[_0x1cb08f[_0xa6ab('0x1f')]],'as':_0x1cb08f['as'],'attributes':_0x1cb08f['attributes'],'include':_0x1cb08f[_0xa6ab('0x1d')]?_[_0xa6ab('0x1e')](_0x1cb08f[_0xa6ab('0x1d')],function(_0x11ecaa){return{'model':db[_0x11ecaa['model']],'as':_0x11ecaa['as'],'attributes':_0x11ecaa[_0xa6ab('0x1b')],'include':_0x11ecaa[_0xa6ab('0x1d')]?_['map'](_0x11ecaa[_0xa6ab('0x1d')],function(_0x369c1d){return{'model':db[_0x369c1d[_0xa6ab('0x1f')]],'as':_0x369c1d['as'],'attributes':_0x369c1d[_0xa6ab('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa6ab('0xb')](function(_0x1dcefe){logger[_0xa6ab('0xc')](_0xa6ab('0x15'),_0x213283);logger[_0xa6ab('0xf')](_0xa6ab('0x15'),_0x213283,JSON[_0xa6ab('0x20')](_0x1dcefe));_0x202d13(_0x1dcefe);})[_0xa6ab('0x21')](function(_0x4845b5){logger[_0xa6ab('0x11')](_0xa6ab('0x15'),_0x4845b5[_0xa6ab('0x13')],_0x213283);_0x35bf06(_0x18d855[_0xa6ab('0x11')](0x1f4,_0x4845b5[_0xa6ab('0x13')]));});});};exports[_0xa6ab('0x22')]=function(_0xc3ad54){var _0x252fd6=this;return new Promise(function(_0x567b29,_0x1f5326){return db[_0xa6ab('0x16')][_0xa6ab('0x23')]({'raw':_0xc3ad54['options']?_0xc3ad54[_0xa6ab('0x18')][_0xa6ab('0x19')]===undefined?!![]:![]:!![],'where':_0xc3ad54['options']?_0xc3ad54[_0xa6ab('0x18')][_0xa6ab('0x1a')]||null:null,'attributes':_0xc3ad54[_0xa6ab('0x18')]?_0xc3ad54[_0xa6ab('0x18')][_0xa6ab('0x1b')]||null:null,'include':_0xc3ad54[_0xa6ab('0x18')]?_0xc3ad54['options']['include']?_['map'](_0xc3ad54[_0xa6ab('0x18')][_0xa6ab('0x1d')],function(_0x37e673){return{'model':db[_0x37e673['model']],'as':_0x37e673['as'],'attributes':_0x37e673[_0xa6ab('0x1b')],'include':_0x37e673[_0xa6ab('0x1d')]?_[_0xa6ab('0x1e')](_0x37e673[_0xa6ab('0x1d')],function(_0x22f736){return{'model':db[_0x22f736['model']],'as':_0x22f736['as'],'attributes':_0x22f736['attributes'],'include':_0x22f736[_0xa6ab('0x1d')]?_[_0xa6ab('0x1e')](_0x22f736[_0xa6ab('0x1d')],function(_0x224eb4){return{'model':db[_0x224eb4[_0xa6ab('0x1f')]],'as':_0x224eb4['as'],'attributes':_0x224eb4[_0xa6ab('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa6ab('0xb')](function(_0x461065){logger[_0xa6ab('0xc')](_0xa6ab('0x22'),_0xc3ad54);logger[_0xa6ab('0xf')](_0xa6ab('0x22'),_0xc3ad54,JSON['stringify'](_0x461065));_0x567b29(_0x461065);})[_0xa6ab('0x21')](function(_0x4aa5c1){logger[_0xa6ab('0x11')]('ShowSalesforceAccount',_0x4aa5c1['message'],_0xc3ad54);_0x1f5326(_0x252fd6[_0xa6ab('0x11')](0x1f4,_0x4aa5c1[_0xa6ab('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ddf1992..fa4f0e2 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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x48cdf1,_0x414634){var _0x4daac2=function(_0x564847){while(--_0x564847){_0x48cdf1['push'](_0x48cdf1['shift']());}};_0x4daac2(++_0x414634);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'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('./intSalesforceConfiguration.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['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x36eeaf,_0x3daec3){var _0x1f0282=function(_0x1fcfa6){while(--_0x1fcfa6){_0x36eeaf['push'](_0x36eeaf['shift']());}};_0x1f0282(++_0x3daec3);}(_0x7a54,0x106));var _0x47a5=function(_0x3ed2a7,_0x30f86b){_0x3ed2a7=_0x3ed2a7-0x0;var _0x56693f=_0x7a54[_0x3ed2a7];return _0x56693f;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index e6cd226..1f2074d 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 _0x59b9=['account_contact_lead','nothing','account','sequelize','STRING','ENUM','Task','Case','contact_lead','contact','lead'];(function(_0x49f368,_0xf070e2){var _0x3923f3=function(_0x5a313a){while(--_0x5a313a){_0x49f368['push'](_0x49f368['shift']());}};_0x3923f3(++_0xf070e2);}(_0x59b9,0x1f2));var _0x959b=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x59b9[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x959b('0x0'));module['exports']={'name':{'type':Sequelize[_0x959b('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x959b('0x2')](_0x959b('0x3'),_0x959b('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x959b('0x2')](_0x959b('0x5'),_0x959b('0x6'),_0x959b('0x7'),_0x959b('0x8'),'account'),'defaultValue':_0x959b('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x959b('0x9'),'contact',_0x959b('0x7'),_0x959b('0xa')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x959b('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x959b('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x959b('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2f78=['Task','Case','contact_lead','lead','account_contact_lead','account','nothing','contact','sequelize','STRING','ENUM'];(function(_0x2ae22a,_0x4fe753){var _0x286a82=function(_0x256e58){while(--_0x256e58){_0x2ae22a['push'](_0x2ae22a['shift']());}};_0x286a82(++_0x4fe753);}(_0x2f78,0x19f));var _0x82f7=function(_0xba11f6,_0x3026e1){_0xba11f6=_0xba11f6-0x0;var _0x4fe35f=_0x2f78[_0xba11f6];return _0x4fe35f;};'use strict';var Sequelize=require(_0x82f7('0x0'));module['exports']={'name':{'type':Sequelize[_0x82f7('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x82f7('0x2')](_0x82f7('0x3'),_0x82f7('0x4')),'defaultValue':_0x82f7('0x3')},'moduleSearch':{'type':Sequelize[_0x82f7('0x2')](_0x82f7('0x5'),'contact',_0x82f7('0x6'),_0x82f7('0x7'),_0x82f7('0x8')),'defaultValue':_0x82f7('0x5')},'moduleCreate':{'type':Sequelize[_0x82f7('0x2')](_0x82f7('0x9'),_0x82f7('0xa'),_0x82f7('0x6'),_0x82f7('0x8')),'defaultValue':_0x82f7('0x6')},'leadId':{'type':Sequelize[_0x82f7('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x82f7('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x82f7('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x82f7('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index c1a3cfb..c230908 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 _0xb170=['key','model','keys','filters','attributes','intersection','fields','query','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','getFields','findOne','SalesforceField','hasOwnProperty','getSubjects','getDescriptions','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','count','offset','status','set','apply','reject','update','then','destroy','end','stack','name','index','map','SalesforceConfiguration','fieldName','type'];(function(_0x1b872a,_0x41b8a9){var _0x3263d6=function(_0x2c3dfd){while(--_0x2c3dfd){_0x1b872a['push'](_0x1b872a['shift']());}};_0x3263d6(++_0x41b8a9);}(_0xb170,0xbd));var _0x0b17=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb170[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0b17('0x0'));var jsonpatch=require(_0x0b17('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0b17('0x2'));var Mustache=require(_0x0b17('0x3'));var util=require('util');var path=require(_0x0b17('0x4'));var sox=require(_0x0b17('0x5'));var csv=require(_0x0b17('0x6'));var ejs=require(_0x0b17('0x7'));var fs=require('fs');var fs_extra=require(_0x0b17('0x8'));var _=require('lodash');var squel=require(_0x0b17('0x9'));var crypto=require(_0x0b17('0xa'));var jsforce=require(_0x0b17('0xb'));var deskjs=require(_0x0b17('0xc'));var toCsv=require(_0x0b17('0x6'));var querystring=require(_0x0b17('0xd'));var Papa=require(_0x0b17('0xe'));var Redis=require(_0x0b17('0xf'));var authService=require(_0x0b17('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b17('0x11'));var logger=require(_0x0b17('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0b17('0x13'));var db=require(_0x0b17('0x14'))['db'];function respondWithStatusCode(_0x57fc8f,_0x572b70){_0x572b70=_0x572b70||0xcc;return function(_0x467a8e){if(_0x467a8e){return _0x57fc8f[_0x0b17('0x15')](_0x572b70);}return _0x57fc8f['status'](_0x572b70)['end']();};}function respondWithResult(_0x7e3f13,_0x33fddd){_0x33fddd=_0x33fddd||0xc8;return function(_0x17c131){if(_0x17c131){return _0x7e3f13['status'](_0x33fddd)[_0x0b17('0x16')](_0x17c131);}};}function respondWithFilteredResult(_0x215996,_0x45ba1a){return function(_0x4123d6){if(_0x4123d6){var _0x2d797f=typeof _0x45ba1a['offset']===_0x0b17('0x17')&&typeof _0x45ba1a[_0x0b17('0x18')]===_0x0b17('0x17');var _0x412d67=_0x4123d6[_0x0b17('0x19')];var _0x550664=_0x2d797f?0x0:_0x45ba1a[_0x0b17('0x1a')];var _0x44283d=_0x2d797f?_0x4123d6[_0x0b17('0x19')]:_0x45ba1a[_0x0b17('0x1a')]+_0x45ba1a['limit'];var _0x5a8d36;if(_0x44283d>=_0x412d67){_0x44283d=_0x412d67;_0x5a8d36=0xc8;}else{_0x5a8d36=0xce;}_0x215996[_0x0b17('0x1b')](_0x5a8d36);return _0x215996[_0x0b17('0x1c')]('Content-Range',_0x550664+'-'+_0x44283d+'/'+_0x412d67)[_0x0b17('0x16')](_0x4123d6);}return null;};}function patchUpdates(_0x4bb9a5){return function(_0x1b8ded){try{jsonpatch[_0x0b17('0x1d')](_0x1b8ded,_0x4bb9a5,!![]);}catch(_0x5749e7){return BPromise[_0x0b17('0x1e')](_0x5749e7);}return _0x1b8ded['save']();};}function saveUpdates(_0x58a454,_0x4b0aaa){return function(_0x252118){if(_0x252118){return _0x252118[_0x0b17('0x1f')](_0x58a454)[_0x0b17('0x20')](function(_0x8308ab){return _0x8308ab;});}return null;};}function removeEntity(_0x15c463,_0x3bad8c){return function(_0x3e15bf){if(_0x3e15bf){return _0x3e15bf[_0x0b17('0x21')]()[_0x0b17('0x20')](function(){_0x15c463[_0x0b17('0x1b')](0xcc)[_0x0b17('0x22')]();});}};}function handleEntityNotFound(_0x340200,_0x186de1){return function(_0x5ed0be){if(!_0x5ed0be){_0x340200[_0x0b17('0x15')](0x194);}return _0x5ed0be;};}function handleError(_0x28c88c,_0x15353b){_0x15353b=_0x15353b||0x1f4;return function(_0x49c1df){logger['error'](_0x49c1df[_0x0b17('0x23')]);if(_0x49c1df[_0x0b17('0x24')]){delete _0x49c1df[_0x0b17('0x24')];}_0x28c88c['status'](_0x15353b)['send'](_0x49c1df);};}exports[_0x0b17('0x25')]=function(_0x487253,_0x5add80){var _0x312d36={},_0x4564ef={},_0x38988e={'count':0x0,'rows':[]};var _0x62c586=_[_0x0b17('0x26')](db[_0x0b17('0x27')]['rawAttributes'],function(_0x3ea73e){return{'name':_0x3ea73e[_0x0b17('0x28')],'type':_0x3ea73e[_0x0b17('0x29')][_0x0b17('0x2a')]};});_0x4564ef[_0x0b17('0x2b')]=_[_0x0b17('0x26')](_0x62c586,_0x0b17('0x24'));_0x4564ef['query']=_[_0x0b17('0x2c')](_0x487253['query']);_0x4564ef[_0x0b17('0x2d')]=_['intersection'](_0x4564ef[_0x0b17('0x2b')],_0x4564ef['query']);_0x312d36[_0x0b17('0x2e')]=_[_0x0b17('0x2f')](_0x4564ef['model'],qs[_0x0b17('0x30')](_0x487253[_0x0b17('0x31')][_0x0b17('0x30')]));_0x312d36['attributes']=_0x312d36[_0x0b17('0x2e')][_0x0b17('0x32')]?_0x312d36['attributes']:_0x4564ef[_0x0b17('0x2b')];if(!_0x487253[_0x0b17('0x31')]['hasOwnProperty'](_0x0b17('0x33'))){_0x312d36[_0x0b17('0x18')]=qs[_0x0b17('0x18')](_0x487253[_0x0b17('0x31')][_0x0b17('0x18')]);_0x312d36['offset']=qs[_0x0b17('0x1a')](_0x487253[_0x0b17('0x31')][_0x0b17('0x1a')]);}_0x312d36[_0x0b17('0x34')]=qs['sort'](_0x487253[_0x0b17('0x31')][_0x0b17('0x35')]);_0x312d36[_0x0b17('0x36')]=qs[_0x0b17('0x2d')](_[_0x0b17('0x37')](_0x487253[_0x0b17('0x31')],_0x4564ef[_0x0b17('0x2d')]),_0x62c586);if(_0x487253['query'][_0x0b17('0x38')]){_0x312d36[_0x0b17('0x36')]=_[_0x0b17('0x39')](_0x312d36[_0x0b17('0x36')],{'$or':_[_0x0b17('0x26')](_0x62c586,function(_0x4f7720){if(_0x4f7720[_0x0b17('0x29')]!==_0x0b17('0x3a')){var _0x1311fd={};_0x1311fd[_0x4f7720[_0x0b17('0x24')]]={'$like':'%'+_0x487253['query'][_0x0b17('0x38')]+'%'};return _0x1311fd;}})});}_0x312d36=_[_0x0b17('0x39')]({},_0x312d36,_0x487253[_0x0b17('0x3b')]);var _0x18f810={'where':_0x312d36['where']};return db[_0x0b17('0x27')][_0x0b17('0x19')](_0x18f810)['then'](function(_0x5d7744){_0x38988e['count']=_0x5d7744;if(_0x487253[_0x0b17('0x31')][_0x0b17('0x3c')]){_0x312d36[_0x0b17('0x3d')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x0b17('0x3e')](_0x312d36);})[_0x0b17('0x20')](function(_0x32963f){_0x38988e[_0x0b17('0x3f')]=_0x32963f;return _0x38988e;})[_0x0b17('0x20')](respondWithFilteredResult(_0x5add80,_0x312d36))[_0x0b17('0x40')](handleError(_0x5add80,null));};exports[_0x0b17('0x41')]=function(_0x3d4580,_0x111ca6){var _0x251148={'raw':![],'where':{'id':_0x3d4580['params']['id']}},_0x40e3ea={};_0x40e3ea['model']=_['keys'](db[_0x0b17('0x27')][_0x0b17('0x42')]);_0x40e3ea[_0x0b17('0x31')]=_[_0x0b17('0x2c')](_0x3d4580[_0x0b17('0x31')]);_0x40e3ea[_0x0b17('0x2d')]=_['intersection'](_0x40e3ea[_0x0b17('0x2b')],_0x40e3ea['query']);_0x251148[_0x0b17('0x2e')]=_[_0x0b17('0x2f')](_0x40e3ea[_0x0b17('0x2b')],qs[_0x0b17('0x30')](_0x3d4580[_0x0b17('0x31')][_0x0b17('0x30')]));_0x251148[_0x0b17('0x2e')]=_0x251148[_0x0b17('0x2e')][_0x0b17('0x32')]?_0x251148[_0x0b17('0x2e')]:_0x40e3ea[_0x0b17('0x2b')];if(_0x3d4580[_0x0b17('0x31')][_0x0b17('0x3c')]){_0x251148[_0x0b17('0x3d')]=[{'all':!![]}];}_0x251148=_[_0x0b17('0x39')]({},_0x251148,_0x3d4580[_0x0b17('0x3b')]);return db[_0x0b17('0x27')]['find'](_0x251148)['then'](handleEntityNotFound(_0x111ca6,null))[_0x0b17('0x20')](respondWithResult(_0x111ca6,null))['catch'](handleError(_0x111ca6,null));};exports[_0x0b17('0x43')]=function(_0x27eada,_0x10b9e9){return db[_0x0b17('0x27')][_0x0b17('0x43')](_0x27eada[_0x0b17('0x44')],{})[_0x0b17('0x20')](respondWithResult(_0x10b9e9,0xc9))[_0x0b17('0x40')](handleError(_0x10b9e9,null));};exports['update']=function(_0xc6fe0f,_0xe606ed){if(_0xc6fe0f[_0x0b17('0x44')]['id']){delete _0xc6fe0f['body']['id'];}return db[_0x0b17('0x27')][_0x0b17('0x45')]({'where':{'id':_0xc6fe0f[_0x0b17('0x46')]['id']}})[_0x0b17('0x20')](handleEntityNotFound(_0xe606ed,null))[_0x0b17('0x20')](saveUpdates(_0xc6fe0f[_0x0b17('0x44')],null))['then'](respondWithResult(_0xe606ed,null))['catch'](handleError(_0xe606ed,null));};exports[_0x0b17('0x21')]=function(_0x2c8a0c,_0x3b742b){return db['SalesforceConfiguration'][_0x0b17('0x45')]({'where':{'id':_0x2c8a0c[_0x0b17('0x46')]['id']}})[_0x0b17('0x20')](handleEntityNotFound(_0x3b742b,null))['then'](removeEntity(_0x3b742b,null))[_0x0b17('0x40')](handleError(_0x3b742b,null));};exports[_0x0b17('0x47')]=function(_0x4d3f78,_0x25e264,_0x3a631a){var _0x16eae8={};var _0x5c186e={};var _0x1ff25d;var _0x2ef3ac;return db[_0x0b17('0x27')][_0x0b17('0x48')]({'where':{'id':_0x4d3f78[_0x0b17('0x46')]['id']}})[_0x0b17('0x20')](handleEntityNotFound(_0x25e264,null))['then'](function(_0x26f9d3){if(_0x26f9d3){_0x1ff25d=_0x26f9d3;_0x5c186e[_0x0b17('0x2b')]=_['keys'](db[_0x0b17('0x49')]['rawAttributes']);_0x5c186e[_0x0b17('0x31')]=_[_0x0b17('0x2c')](_0x4d3f78['query']);_0x5c186e['filters']=_[_0x0b17('0x2f')](_0x5c186e[_0x0b17('0x2b')],_0x5c186e[_0x0b17('0x31')]);_0x16eae8['attributes']=_['intersection'](_0x5c186e[_0x0b17('0x2b')],qs[_0x0b17('0x30')](_0x4d3f78['query'][_0x0b17('0x30')]));_0x16eae8[_0x0b17('0x2e')]=_0x16eae8['attributes']['length']?_0x16eae8[_0x0b17('0x2e')]:_0x5c186e[_0x0b17('0x2b')];_0x16eae8['order']=qs[_0x0b17('0x35')](_0x4d3f78[_0x0b17('0x31')][_0x0b17('0x35')]);_0x16eae8[_0x0b17('0x36')]=qs[_0x0b17('0x2d')](_[_0x0b17('0x37')](_0x4d3f78[_0x0b17('0x31')],_0x5c186e[_0x0b17('0x2d')]));if(_0x4d3f78[_0x0b17('0x31')]['filter']){_0x16eae8[_0x0b17('0x36')]=_[_0x0b17('0x39')](_0x16eae8['where'],{'$or':_['map'](_0x16eae8[_0x0b17('0x2e')],function(_0x5c47b5){var _0x4a9178={};_0x4a9178[_0x5c47b5]={'$like':'%'+_0x4d3f78[_0x0b17('0x31')][_0x0b17('0x38')]+'%'};return _0x4a9178;})});}_0x16eae8=_[_0x0b17('0x39')]({},_0x16eae8,_0x4d3f78[_0x0b17('0x3b')]);return _0x1ff25d[_0x0b17('0x47')](_0x16eae8);}})[_0x0b17('0x20')](function(_0x4fd6a5){if(_0x4fd6a5){_0x2ef3ac=_0x4fd6a5[_0x0b17('0x32')];if(!_0x4d3f78[_0x0b17('0x31')][_0x0b17('0x4a')](_0x0b17('0x33'))){_0x16eae8[_0x0b17('0x18')]=qs[_0x0b17('0x18')](_0x4d3f78[_0x0b17('0x31')][_0x0b17('0x18')]);_0x16eae8['offset']=qs[_0x0b17('0x1a')](_0x4d3f78['query'][_0x0b17('0x1a')]);}return _0x1ff25d[_0x0b17('0x47')](_0x16eae8);}})[_0x0b17('0x20')](function(_0x8241d0){if(_0x8241d0){return _0x8241d0?{'count':_0x2ef3ac,'rows':_0x8241d0}:null;}})[_0x0b17('0x20')](respondWithResult(_0x25e264,null))[_0x0b17('0x40')](handleError(_0x25e264,null));};exports['getSubjects']=function(_0x199044,_0x4f8256,_0x43b02b){var _0x48ec36={};var _0x1cad75={};var _0x1e1b4d;var _0x1840ca;return db[_0x0b17('0x27')]['findOne']({'where':{'id':_0x199044[_0x0b17('0x46')]['id']}})[_0x0b17('0x20')](handleEntityNotFound(_0x4f8256,null))['then'](function(_0x20e6c6){if(_0x20e6c6){_0x1e1b4d=_0x20e6c6;_0x1cad75[_0x0b17('0x2b')]=_['keys'](db[_0x0b17('0x49')][_0x0b17('0x42')]);_0x1cad75['query']=_[_0x0b17('0x2c')](_0x199044[_0x0b17('0x31')]);_0x1cad75[_0x0b17('0x2d')]=_[_0x0b17('0x2f')](_0x1cad75['model'],_0x1cad75[_0x0b17('0x31')]);_0x48ec36[_0x0b17('0x2e')]=_[_0x0b17('0x2f')](_0x1cad75['model'],qs[_0x0b17('0x30')](_0x199044['query'][_0x0b17('0x30')]));_0x48ec36[_0x0b17('0x2e')]=_0x48ec36[_0x0b17('0x2e')][_0x0b17('0x32')]?_0x48ec36[_0x0b17('0x2e')]:_0x1cad75[_0x0b17('0x2b')];_0x48ec36[_0x0b17('0x34')]=qs['sort'](_0x199044[_0x0b17('0x31')][_0x0b17('0x35')]);_0x48ec36[_0x0b17('0x36')]=qs[_0x0b17('0x2d')](_[_0x0b17('0x37')](_0x199044['query'],_0x1cad75['filters']));if(_0x199044[_0x0b17('0x31')][_0x0b17('0x38')]){_0x48ec36[_0x0b17('0x36')]=_[_0x0b17('0x39')](_0x48ec36[_0x0b17('0x36')],{'$or':_[_0x0b17('0x26')](_0x48ec36[_0x0b17('0x2e')],function(_0x1debe3){var _0x5a4adb={};_0x5a4adb[_0x1debe3]={'$like':'%'+_0x199044[_0x0b17('0x31')]['filter']+'%'};return _0x5a4adb;})});}_0x48ec36=_['merge']({},_0x48ec36,_0x199044[_0x0b17('0x3b')]);return _0x1e1b4d[_0x0b17('0x4b')](_0x48ec36);}})['then'](function(_0x193497){if(_0x193497){_0x1840ca=_0x193497['length'];if(!_0x199044['query'][_0x0b17('0x4a')](_0x0b17('0x33'))){_0x48ec36[_0x0b17('0x18')]=qs[_0x0b17('0x18')](_0x199044['query'][_0x0b17('0x18')]);_0x48ec36[_0x0b17('0x1a')]=qs[_0x0b17('0x1a')](_0x199044[_0x0b17('0x31')][_0x0b17('0x1a')]);}return _0x1e1b4d['getSubjects'](_0x48ec36);}})[_0x0b17('0x20')](function(_0x229556){if(_0x229556){return _0x229556?{'count':_0x1840ca,'rows':_0x229556}:null;}})[_0x0b17('0x20')](respondWithResult(_0x4f8256,null))[_0x0b17('0x40')](handleError(_0x4f8256,null));};exports[_0x0b17('0x4c')]=function(_0x3f8bb6,_0x46b989,_0x32edfd){var _0x4d4411={};var _0x3b4a95={};var _0x10f6df;var _0x24f858;return db[_0x0b17('0x27')]['findOne']({'where':{'id':_0x3f8bb6[_0x0b17('0x46')]['id']}})[_0x0b17('0x20')](handleEntityNotFound(_0x46b989,null))[_0x0b17('0x20')](function(_0x4b77ff){if(_0x4b77ff){_0x10f6df=_0x4b77ff;_0x3b4a95[_0x0b17('0x2b')]=_['keys'](db[_0x0b17('0x49')][_0x0b17('0x42')]);_0x3b4a95[_0x0b17('0x31')]=_['keys'](_0x3f8bb6['query']);_0x3b4a95[_0x0b17('0x2d')]=_[_0x0b17('0x2f')](_0x3b4a95[_0x0b17('0x2b')],_0x3b4a95[_0x0b17('0x31')]);_0x4d4411[_0x0b17('0x2e')]=_[_0x0b17('0x2f')](_0x3b4a95[_0x0b17('0x2b')],qs[_0x0b17('0x30')](_0x3f8bb6['query'][_0x0b17('0x30')]));_0x4d4411['attributes']=_0x4d4411['attributes'][_0x0b17('0x32')]?_0x4d4411['attributes']:_0x3b4a95[_0x0b17('0x2b')];_0x4d4411[_0x0b17('0x34')]=qs[_0x0b17('0x35')](_0x3f8bb6[_0x0b17('0x31')][_0x0b17('0x35')]);_0x4d4411[_0x0b17('0x36')]=qs[_0x0b17('0x2d')](_[_0x0b17('0x37')](_0x3f8bb6[_0x0b17('0x31')],_0x3b4a95[_0x0b17('0x2d')]));if(_0x3f8bb6[_0x0b17('0x31')]['filter']){_0x4d4411['where']=_[_0x0b17('0x39')](_0x4d4411[_0x0b17('0x36')],{'$or':_[_0x0b17('0x26')](_0x4d4411['attributes'],function(_0x29c797){var _0x18fb38={};_0x18fb38[_0x29c797]={'$like':'%'+_0x3f8bb6[_0x0b17('0x31')][_0x0b17('0x38')]+'%'};return _0x18fb38;})});}_0x4d4411=_['merge']({},_0x4d4411,_0x3f8bb6['options']);return _0x10f6df[_0x0b17('0x4c')](_0x4d4411);}})[_0x0b17('0x20')](function(_0x21c624){if(_0x21c624){_0x24f858=_0x21c624[_0x0b17('0x32')];if(!_0x3f8bb6['query'][_0x0b17('0x4a')](_0x0b17('0x33'))){_0x4d4411[_0x0b17('0x18')]=qs[_0x0b17('0x18')](_0x3f8bb6[_0x0b17('0x31')]['limit']);_0x4d4411[_0x0b17('0x1a')]=qs[_0x0b17('0x1a')](_0x3f8bb6['query'][_0x0b17('0x1a')]);}return _0x10f6df[_0x0b17('0x4c')](_0x4d4411);}})[_0x0b17('0x20')](function(_0x45f86b){if(_0x45f86b){return _0x45f86b?{'count':_0x24f858,'rows':_0x45f86b}:null;}})[_0x0b17('0x20')](respondWithResult(_0x46b989,null))[_0x0b17('0x40')](handleError(_0x46b989,null));}; \ No newline at end of file +var _0x50cd=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','type','merge','options','SalesforceConfiguration','includeAll','include','findAll','rows','catch','find','create','body','params','getFields','findOne','SalesforceField','where','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','destroy','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0x50cd,0x6e));var _0xd50c=function(_0xd5bb22,_0x5cfccb){_0xd5bb22=_0xd5bb22-0x0;var _0x2d105a=_0x50cd[_0xd5bb22];return _0x2d105a;};'use strict';var emlformat=require(_0xd50c('0x0'));var rimraf=require(_0xd50c('0x1'));var zipdir=require(_0xd50c('0x2'));var jsonpatch=require(_0xd50c('0x3'));var rp=require(_0xd50c('0x4'));var moment=require(_0xd50c('0x5'));var BPromise=require(_0xd50c('0x6'));var Mustache=require(_0xd50c('0x7'));var util=require('util');var path=require('path');var sox=require(_0xd50c('0x8'));var csv=require(_0xd50c('0x9'));var ejs=require(_0xd50c('0xa'));var fs=require('fs');var fs_extra=require(_0xd50c('0xb'));var _=require('lodash');var squel=require(_0xd50c('0xc'));var crypto=require('crypto');var jsforce=require(_0xd50c('0xd'));var deskjs=require(_0xd50c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd50c('0xf'));var Redis=require(_0xd50c('0x10'));var authService=require(_0xd50c('0x11'));var qs=require(_0xd50c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd50c('0x13'));var logger=require('../../config/logger')(_0xd50c('0x14'));var utils=require(_0xd50c('0x15'));var config=require(_0xd50c('0x16'));var licenseUtil=require(_0xd50c('0x17'));var db=require(_0xd50c('0x18'))['db'];function respondWithStatusCode(_0x164a6f,_0x4b9f0d){_0x4b9f0d=_0x4b9f0d||0xcc;return function(_0x1da3ee){if(_0x1da3ee){return _0x164a6f[_0xd50c('0x19')](_0x4b9f0d);}return _0x164a6f[_0xd50c('0x1a')](_0x4b9f0d)[_0xd50c('0x1b')]();};}function respondWithResult(_0x310f12,_0x58a1e2){_0x58a1e2=_0x58a1e2||0xc8;return function(_0x58d1d0){if(_0x58d1d0){return _0x310f12[_0xd50c('0x1a')](_0x58a1e2)[_0xd50c('0x1c')](_0x58d1d0);}};}function respondWithFilteredResult(_0x485dea,_0x5c08cf){return function(_0x42c09a){if(_0x42c09a){var _0x2909e5=typeof _0x5c08cf[_0xd50c('0x1d')]===_0xd50c('0x1e')&&typeof _0x5c08cf[_0xd50c('0x1f')]==='undefined';var _0x286b02=_0x42c09a[_0xd50c('0x20')];var _0x4e2739=_0x2909e5?0x0:_0x5c08cf['offset'];var _0x595919=_0x2909e5?_0x42c09a[_0xd50c('0x20')]:_0x5c08cf[_0xd50c('0x1d')]+_0x5c08cf[_0xd50c('0x1f')];var _0x395c99;if(_0x595919>=_0x286b02){_0x595919=_0x286b02;_0x395c99=0xc8;}else{_0x395c99=0xce;}_0x485dea[_0xd50c('0x1a')](_0x395c99);return _0x485dea[_0xd50c('0x21')](_0xd50c('0x22'),_0x4e2739+'-'+_0x595919+'/'+_0x286b02)[_0xd50c('0x1c')](_0x42c09a);}return null;};}function patchUpdates(_0x471f87){return function(_0x4a8c46){try{jsonpatch[_0xd50c('0x23')](_0x4a8c46,_0x471f87,!![]);}catch(_0x3a85f5){return BPromise[_0xd50c('0x24')](_0x3a85f5);}return _0x4a8c46[_0xd50c('0x25')]();};}function saveUpdates(_0x218795,_0x106f6f){return function(_0x4b0239){if(_0x4b0239){return _0x4b0239[_0xd50c('0x26')](_0x218795)[_0xd50c('0x27')](function(_0x5a9ada){return _0x5a9ada;});}return null;};}function removeEntity(_0x51741d,_0x1cda85){return function(_0x2cbceb){if(_0x2cbceb){return _0x2cbceb[_0xd50c('0x28')]()[_0xd50c('0x27')](function(){_0x51741d[_0xd50c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x109543,_0x110682){return function(_0x310828){if(!_0x310828){_0x109543[_0xd50c('0x19')](0x194);}return _0x310828;};}function handleError(_0xbba714,_0x58988b){_0x58988b=_0x58988b||0x1f4;return function(_0xfd2aea){logger[_0xd50c('0x29')](_0xfd2aea['stack']);if(_0xfd2aea[_0xd50c('0x2a')]){delete _0xfd2aea['name'];}_0xbba714[_0xd50c('0x1a')](_0x58988b)[_0xd50c('0x2b')](_0xfd2aea);};}exports['index']=function(_0x27e247,_0x2ed105){var _0x2a9d0a={},_0x48489f={},_0xf46bd={'count':0x0,'rows':[]};var _0x2567bc=_[_0xd50c('0x2c')](db['SalesforceConfiguration'][_0xd50c('0x2d')],function(_0x55089f){return{'name':_0x55089f[_0xd50c('0x2e')],'type':_0x55089f['type'][_0xd50c('0x2f')]};});_0x48489f[_0xd50c('0x30')]=_[_0xd50c('0x2c')](_0x2567bc,'name');_0x48489f[_0xd50c('0x31')]=_[_0xd50c('0x32')](_0x27e247[_0xd50c('0x31')]);_0x48489f[_0xd50c('0x33')]=_[_0xd50c('0x34')](_0x48489f['model'],_0x48489f[_0xd50c('0x31')]);_0x2a9d0a[_0xd50c('0x35')]=_[_0xd50c('0x34')](_0x48489f[_0xd50c('0x30')],qs[_0xd50c('0x36')](_0x27e247['query'][_0xd50c('0x36')]));_0x2a9d0a[_0xd50c('0x35')]=_0x2a9d0a[_0xd50c('0x35')][_0xd50c('0x37')]?_0x2a9d0a[_0xd50c('0x35')]:_0x48489f[_0xd50c('0x30')];if(!_0x27e247[_0xd50c('0x31')][_0xd50c('0x38')](_0xd50c('0x39'))){_0x2a9d0a[_0xd50c('0x1f')]=qs['limit'](_0x27e247[_0xd50c('0x31')][_0xd50c('0x1f')]);_0x2a9d0a[_0xd50c('0x1d')]=qs['offset'](_0x27e247[_0xd50c('0x31')][_0xd50c('0x1d')]);}_0x2a9d0a[_0xd50c('0x3a')]=qs[_0xd50c('0x3b')](_0x27e247[_0xd50c('0x31')]['sort']);_0x2a9d0a['where']=qs[_0xd50c('0x33')](_[_0xd50c('0x3c')](_0x27e247[_0xd50c('0x31')],_0x48489f['filters']),_0x2567bc);if(_0x27e247[_0xd50c('0x31')][_0xd50c('0x3d')]){_0x2a9d0a['where']=_['merge'](_0x2a9d0a['where'],{'$or':_[_0xd50c('0x2c')](_0x2567bc,function(_0xb79f12){if(_0xb79f12[_0xd50c('0x3e')]!=='VIRTUAL'){var _0x26b2dd={};_0x26b2dd[_0xb79f12[_0xd50c('0x2a')]]={'$like':'%'+_0x27e247[_0xd50c('0x31')]['filter']+'%'};return _0x26b2dd;}})});}_0x2a9d0a=_[_0xd50c('0x3f')]({},_0x2a9d0a,_0x27e247[_0xd50c('0x40')]);var _0x537d68={'where':_0x2a9d0a['where']};return db[_0xd50c('0x41')][_0xd50c('0x20')](_0x537d68)['then'](function(_0x187a05){_0xf46bd['count']=_0x187a05;if(_0x27e247[_0xd50c('0x31')][_0xd50c('0x42')]){_0x2a9d0a[_0xd50c('0x43')]=[{'all':!![]}];}return db[_0xd50c('0x41')][_0xd50c('0x44')](_0x2a9d0a);})[_0xd50c('0x27')](function(_0x596c57){_0xf46bd[_0xd50c('0x45')]=_0x596c57;return _0xf46bd;})[_0xd50c('0x27')](respondWithFilteredResult(_0x2ed105,_0x2a9d0a))[_0xd50c('0x46')](handleError(_0x2ed105,null));};exports['show']=function(_0x103402,_0x128b92){var _0x514605={'raw':![],'where':{'id':_0x103402['params']['id']}},_0xe901b5={};_0xe901b5[_0xd50c('0x30')]=_['keys'](db[_0xd50c('0x41')]['rawAttributes']);_0xe901b5[_0xd50c('0x31')]=_[_0xd50c('0x32')](_0x103402['query']);_0xe901b5[_0xd50c('0x33')]=_[_0xd50c('0x34')](_0xe901b5['model'],_0xe901b5[_0xd50c('0x31')]);_0x514605[_0xd50c('0x35')]=_[_0xd50c('0x34')](_0xe901b5[_0xd50c('0x30')],qs[_0xd50c('0x36')](_0x103402['query']['fields']));_0x514605[_0xd50c('0x35')]=_0x514605['attributes'][_0xd50c('0x37')]?_0x514605[_0xd50c('0x35')]:_0xe901b5[_0xd50c('0x30')];if(_0x103402[_0xd50c('0x31')][_0xd50c('0x42')]){_0x514605['include']=[{'all':!![]}];}_0x514605=_['merge']({},_0x514605,_0x103402[_0xd50c('0x40')]);return db[_0xd50c('0x41')][_0xd50c('0x47')](_0x514605)[_0xd50c('0x27')](handleEntityNotFound(_0x128b92,null))[_0xd50c('0x27')](respondWithResult(_0x128b92,null))[_0xd50c('0x46')](handleError(_0x128b92,null));};exports[_0xd50c('0x48')]=function(_0x9dc79e,_0x59acdb){return db[_0xd50c('0x41')][_0xd50c('0x48')](_0x9dc79e[_0xd50c('0x49')],{})[_0xd50c('0x27')](respondWithResult(_0x59acdb,0xc9))[_0xd50c('0x46')](handleError(_0x59acdb,null));};exports[_0xd50c('0x26')]=function(_0x5b0d95,_0x138488){if(_0x5b0d95['body']['id']){delete _0x5b0d95[_0xd50c('0x49')]['id'];}return db[_0xd50c('0x41')][_0xd50c('0x47')]({'where':{'id':_0x5b0d95['params']['id']}})[_0xd50c('0x27')](handleEntityNotFound(_0x138488,null))['then'](saveUpdates(_0x5b0d95['body'],null))[_0xd50c('0x27')](respondWithResult(_0x138488,null))[_0xd50c('0x46')](handleError(_0x138488,null));};exports[_0xd50c('0x28')]=function(_0x1c0e95,_0x2a8f0c){return db[_0xd50c('0x41')][_0xd50c('0x47')]({'where':{'id':_0x1c0e95[_0xd50c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a8f0c,null))['then'](removeEntity(_0x2a8f0c,null))[_0xd50c('0x46')](handleError(_0x2a8f0c,null));};exports[_0xd50c('0x4b')]=function(_0x169001,_0x163e59,_0x4264b6){var _0x5d7ac6={};var _0x1827d2={};var _0x494d7b;var _0x2d8b29;return db['SalesforceConfiguration'][_0xd50c('0x4c')]({'where':{'id':_0x169001[_0xd50c('0x4a')]['id']}})[_0xd50c('0x27')](handleEntityNotFound(_0x163e59,null))['then'](function(_0x35653a){if(_0x35653a){_0x494d7b=_0x35653a;_0x1827d2[_0xd50c('0x30')]=_[_0xd50c('0x32')](db[_0xd50c('0x4d')][_0xd50c('0x2d')]);_0x1827d2[_0xd50c('0x31')]=_[_0xd50c('0x32')](_0x169001[_0xd50c('0x31')]);_0x1827d2[_0xd50c('0x33')]=_[_0xd50c('0x34')](_0x1827d2['model'],_0x1827d2[_0xd50c('0x31')]);_0x5d7ac6[_0xd50c('0x35')]=_[_0xd50c('0x34')](_0x1827d2[_0xd50c('0x30')],qs[_0xd50c('0x36')](_0x169001[_0xd50c('0x31')][_0xd50c('0x36')]));_0x5d7ac6[_0xd50c('0x35')]=_0x5d7ac6[_0xd50c('0x35')][_0xd50c('0x37')]?_0x5d7ac6[_0xd50c('0x35')]:_0x1827d2[_0xd50c('0x30')];_0x5d7ac6[_0xd50c('0x3a')]=qs['sort'](_0x169001[_0xd50c('0x31')][_0xd50c('0x3b')]);_0x5d7ac6['where']=qs['filters'](_[_0xd50c('0x3c')](_0x169001['query'],_0x1827d2[_0xd50c('0x33')]));if(_0x169001[_0xd50c('0x31')][_0xd50c('0x3d')]){_0x5d7ac6[_0xd50c('0x4e')]=_[_0xd50c('0x3f')](_0x5d7ac6['where'],{'$or':_[_0xd50c('0x2c')](_0x5d7ac6[_0xd50c('0x35')],function(_0x2614a8){var _0x1d04c1={};_0x1d04c1[_0x2614a8]={'$like':'%'+_0x169001[_0xd50c('0x31')][_0xd50c('0x3d')]+'%'};return _0x1d04c1;})});}_0x5d7ac6=_[_0xd50c('0x3f')]({},_0x5d7ac6,_0x169001[_0xd50c('0x40')]);return _0x494d7b[_0xd50c('0x4b')](_0x5d7ac6);}})[_0xd50c('0x27')](function(_0x4a9784){if(_0x4a9784){_0x2d8b29=_0x4a9784[_0xd50c('0x37')];if(!_0x169001[_0xd50c('0x31')][_0xd50c('0x38')](_0xd50c('0x39'))){_0x5d7ac6['limit']=qs[_0xd50c('0x1f')](_0x169001['query'][_0xd50c('0x1f')]);_0x5d7ac6[_0xd50c('0x1d')]=qs[_0xd50c('0x1d')](_0x169001[_0xd50c('0x31')][_0xd50c('0x1d')]);}return _0x494d7b[_0xd50c('0x4b')](_0x5d7ac6);}})[_0xd50c('0x27')](function(_0x2f9b4b){if(_0x2f9b4b){return _0x2f9b4b?{'count':_0x2d8b29,'rows':_0x2f9b4b}:null;}})[_0xd50c('0x27')](respondWithResult(_0x163e59,null))[_0xd50c('0x46')](handleError(_0x163e59,null));};exports[_0xd50c('0x4f')]=function(_0x1d166d,_0x5be3cf,_0x34b3d9){var _0x29b4cf={};var _0x329cf1={};var _0x515356;var _0x39d208;return db['SalesforceConfiguration'][_0xd50c('0x4c')]({'where':{'id':_0x1d166d[_0xd50c('0x4a')]['id']}})[_0xd50c('0x27')](handleEntityNotFound(_0x5be3cf,null))[_0xd50c('0x27')](function(_0x3b5e43){if(_0x3b5e43){_0x515356=_0x3b5e43;_0x329cf1[_0xd50c('0x30')]=_[_0xd50c('0x32')](db[_0xd50c('0x4d')][_0xd50c('0x2d')]);_0x329cf1[_0xd50c('0x31')]=_[_0xd50c('0x32')](_0x1d166d['query']);_0x329cf1['filters']=_[_0xd50c('0x34')](_0x329cf1[_0xd50c('0x30')],_0x329cf1[_0xd50c('0x31')]);_0x29b4cf['attributes']=_[_0xd50c('0x34')](_0x329cf1['model'],qs['fields'](_0x1d166d[_0xd50c('0x31')][_0xd50c('0x36')]));_0x29b4cf[_0xd50c('0x35')]=_0x29b4cf[_0xd50c('0x35')]['length']?_0x29b4cf[_0xd50c('0x35')]:_0x329cf1[_0xd50c('0x30')];_0x29b4cf['order']=qs['sort'](_0x1d166d[_0xd50c('0x31')]['sort']);_0x29b4cf[_0xd50c('0x4e')]=qs[_0xd50c('0x33')](_['pick'](_0x1d166d[_0xd50c('0x31')],_0x329cf1['filters']));if(_0x1d166d['query'][_0xd50c('0x3d')]){_0x29b4cf[_0xd50c('0x4e')]=_[_0xd50c('0x3f')](_0x29b4cf[_0xd50c('0x4e')],{'$or':_['map'](_0x29b4cf['attributes'],function(_0x3006bd){var _0x212b55={};_0x212b55[_0x3006bd]={'$like':'%'+_0x1d166d[_0xd50c('0x31')][_0xd50c('0x3d')]+'%'};return _0x212b55;})});}_0x29b4cf=_['merge']({},_0x29b4cf,_0x1d166d['options']);return _0x515356[_0xd50c('0x4f')](_0x29b4cf);}})[_0xd50c('0x27')](function(_0x17be29){if(_0x17be29){_0x39d208=_0x17be29['length'];if(!_0x1d166d[_0xd50c('0x31')][_0xd50c('0x38')](_0xd50c('0x39'))){_0x29b4cf[_0xd50c('0x1f')]=qs['limit'](_0x1d166d['query'][_0xd50c('0x1f')]);_0x29b4cf[_0xd50c('0x1d')]=qs[_0xd50c('0x1d')](_0x1d166d[_0xd50c('0x31')]['offset']);}return _0x515356[_0xd50c('0x4f')](_0x29b4cf);}})[_0xd50c('0x27')](function(_0x6d4f71){if(_0x6d4f71){return _0x6d4f71?{'count':_0x39d208,'rows':_0x6d4f71}:null;}})[_0xd50c('0x27')](respondWithResult(_0x5be3cf,null))[_0xd50c('0x46')](handleError(_0x5be3cf,null));};exports[_0xd50c('0x50')]=function(_0x3e1c4d,_0x505d8f,_0xd82673){var _0x238001={};var _0x13403f={};var _0x5d974e;var _0x228f70;return db['SalesforceConfiguration'][_0xd50c('0x4c')]({'where':{'id':_0x3e1c4d[_0xd50c('0x4a')]['id']}})[_0xd50c('0x27')](handleEntityNotFound(_0x505d8f,null))[_0xd50c('0x27')](function(_0x4ea75b){if(_0x4ea75b){_0x5d974e=_0x4ea75b;_0x13403f[_0xd50c('0x30')]=_[_0xd50c('0x32')](db['SalesforceField'][_0xd50c('0x2d')]);_0x13403f['query']=_[_0xd50c('0x32')](_0x3e1c4d['query']);_0x13403f['filters']=_[_0xd50c('0x34')](_0x13403f[_0xd50c('0x30')],_0x13403f['query']);_0x238001['attributes']=_[_0xd50c('0x34')](_0x13403f['model'],qs[_0xd50c('0x36')](_0x3e1c4d[_0xd50c('0x31')]['fields']));_0x238001['attributes']=_0x238001['attributes'][_0xd50c('0x37')]?_0x238001[_0xd50c('0x35')]:_0x13403f[_0xd50c('0x30')];_0x238001[_0xd50c('0x3a')]=qs['sort'](_0x3e1c4d['query'][_0xd50c('0x3b')]);_0x238001[_0xd50c('0x4e')]=qs[_0xd50c('0x33')](_['pick'](_0x3e1c4d[_0xd50c('0x31')],_0x13403f[_0xd50c('0x33')]));if(_0x3e1c4d['query']['filter']){_0x238001[_0xd50c('0x4e')]=_[_0xd50c('0x3f')](_0x238001[_0xd50c('0x4e')],{'$or':_[_0xd50c('0x2c')](_0x238001[_0xd50c('0x35')],function(_0xc78f61){var _0x1549bc={};_0x1549bc[_0xc78f61]={'$like':'%'+_0x3e1c4d['query'][_0xd50c('0x3d')]+'%'};return _0x1549bc;})});}_0x238001=_[_0xd50c('0x3f')]({},_0x238001,_0x3e1c4d['options']);return _0x5d974e[_0xd50c('0x50')](_0x238001);}})[_0xd50c('0x27')](function(_0x1dc0b2){if(_0x1dc0b2){_0x228f70=_0x1dc0b2[_0xd50c('0x37')];if(!_0x3e1c4d['query']['hasOwnProperty'](_0xd50c('0x39'))){_0x238001[_0xd50c('0x1f')]=qs[_0xd50c('0x1f')](_0x3e1c4d[_0xd50c('0x31')]['limit']);_0x238001[_0xd50c('0x1d')]=qs['offset'](_0x3e1c4d[_0xd50c('0x31')][_0xd50c('0x1d')]);}return _0x5d974e[_0xd50c('0x50')](_0x238001);}})['then'](function(_0x6dfe43){if(_0x6dfe43){return _0x6dfe43?{'count':_0x228f70,'rows':_0x6dfe43}:null;}})[_0xd50c('0x27')](respondWithResult(_0x505d8f,null))[_0xd50c('0x46')](handleError(_0x505d8f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7c451f0..bfadeb5 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 _0x269c=['define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x269c,0x153));var _0xc269=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x269c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc269('0x0'));var util=require(_0xc269('0x1'));var logger=require(_0xc269('0x2'))(_0xc269('0x3'));var moment=require(_0xc269('0x4'));var BPromise=require('bluebird');var rp=require(_0xc269('0x5'));var fs=require('fs');var path=require(_0xc269('0x6'));var rimraf=require(_0xc269('0x7'));var config=require(_0xc269('0x8'));var attributes=require(_0xc269('0x9'));module[_0xc269('0xa')]=function(_0x2f3aa9,_0x16388b){return _0x2f3aa9[_0xc269('0xb')](_0xc269('0xc'),attributes,{'tableName':_0xc269('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3b4=['int_salesforce_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration'];(function(_0x24e713,_0x331e42){var _0x2dc97e=function(_0xb8c750){while(--_0xb8c750){_0x24e713['push'](_0x24e713['shift']());}};_0x2dc97e(++_0x331e42);}(_0xf3b4,0x15d));var _0x4f3b=function(_0x3c2081,_0x1cd2b3){_0x3c2081=_0x3c2081-0x0;var _0x29d6dc=_0xf3b4[_0x3c2081];return _0x29d6dc;};'use strict';var _=require(_0x4f3b('0x0'));var util=require('util');var logger=require(_0x4f3b('0x1'))(_0x4f3b('0x2'));var moment=require(_0x4f3b('0x3'));var BPromise=require(_0x4f3b('0x4'));var rp=require(_0x4f3b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f3b('0x6'));var config=require(_0x4f3b('0x7'));var attributes=require(_0x4f3b('0x8'));module[_0x4f3b('0x9')]=function(_0x4443bb,_0x88e379){return _0x4443bb['define'](_0x4f3b('0xa'),attributes,{'tableName':_0x4f3b('0xb'),'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 c9b3ff5..c715b78 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 _0x8af2=['result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x515315,_0x592e13){var _0x1588ef=function(_0x3f3f83){while(--_0x3f3f83){_0x515315['push'](_0x515315['shift']());}};_0x1588ef(++_0x592e13);}(_0x8af2,0x105));var _0x28af=function(_0x3e7c61,_0xb44529){_0x3e7c61=_0x3e7c61-0x0;var _0x41662f=_0x8af2[_0x3e7c61];return _0x41662f;};'use strict';var _=require(_0x28af('0x0'));var util=require(_0x28af('0x1'));var moment=require('moment');var BPromise=require(_0x28af('0x2'));var rs=require(_0x28af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28af('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x28af('0x5'))(_0x28af('0x6'));var config=require(_0x28af('0x7'));var jayson=require(_0x28af('0x8'));var client=jayson[_0x28af('0x9')][_0x28af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10bf97,_0x4f314b,_0x3d221a){return new BPromise(function(_0x4c5c3b,_0x6bb5a8){return client[_0x28af('0xb')](_0x10bf97,_0x3d221a)['then'](function(_0x4d0547){logger[_0x28af('0xc')](_0x28af('0xd'),_0x4f314b,_0x28af('0xe'));logger[_0x28af('0xf')](_0x28af('0x10'),_0x4f314b,_0x28af('0xe'),JSON['stringify'](_0x4d0547));if(_0x4d0547[_0x28af('0x11')]){if(_0x4d0547[_0x28af('0x11')]['code']===0x1f4){logger[_0x28af('0x11')](_0x28af('0xd'),_0x4f314b,_0x4d0547[_0x28af('0x11')][_0x28af('0x12')]);return _0x6bb5a8(_0x4d0547['error'][_0x28af('0x12')]);}logger[_0x28af('0x11')](_0x28af('0xd'),_0x4f314b,_0x4d0547[_0x28af('0x11')]['message']);return _0x4c5c3b(_0x4d0547[_0x28af('0x11')]['message']);}else{logger[_0x28af('0xc')](_0x28af('0xd'),_0x4f314b,_0x28af('0xe'));_0x4c5c3b(_0x4d0547[_0x28af('0x13')]['message']);}})['catch'](function(_0x5c0d07){logger[_0x28af('0x11')](_0x28af('0xd'),_0x4f314b,_0x5c0d07);_0x6bb5a8(_0x5c0d07);});});} \ No newline at end of file +var _0x5f19=['request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x5a85a6,_0x36c627){var _0x230ae8=function(_0x5042a8){while(--_0x5042a8){_0x5a85a6['push'](_0x5a85a6['shift']());}};_0x230ae8(++_0x36c627);}(_0x5f19,0x7a));var _0x95f1=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x5f19[_0x476c7];return _0x47ae56;};'use strict';var _=require(_0x95f1('0x0'));var util=require('util');var moment=require(_0x95f1('0x1'));var BPromise=require(_0x95f1('0x2'));var rs=require(_0x95f1('0x3'));var fs=require('fs');var Redis=require(_0x95f1('0x4'));var db=require(_0x95f1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x95f1('0x6'));var config=require(_0x95f1('0x7'));var jayson=require(_0x95f1('0x8'));var client=jayson['client'][_0x95f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7c6f48,_0x33782b,_0x15897f){return new BPromise(function(_0x5502ec,_0x3031c7){return client[_0x95f1('0xa')](_0x7c6f48,_0x15897f)[_0x95f1('0xb')](function(_0x104859){logger[_0x95f1('0xc')](_0x95f1('0xd'),_0x33782b,_0x95f1('0xe'));logger[_0x95f1('0xf')](_0x95f1('0x10'),_0x33782b,'request\x20sent',JSON[_0x95f1('0x11')](_0x104859));if(_0x104859[_0x95f1('0x12')]){if(_0x104859['error']['code']===0x1f4){logger[_0x95f1('0x12')](_0x95f1('0xd'),_0x33782b,_0x104859[_0x95f1('0x12')][_0x95f1('0x13')]);return _0x3031c7(_0x104859[_0x95f1('0x12')]['message']);}logger[_0x95f1('0x12')](_0x95f1('0xd'),_0x33782b,_0x104859[_0x95f1('0x12')][_0x95f1('0x13')]);return _0x5502ec(_0x104859[_0x95f1('0x12')]['message']);}else{logger[_0x95f1('0xc')](_0x95f1('0xd'),_0x33782b,_0x95f1('0xe'));_0x5502ec(_0x104859[_0x95f1('0x14')][_0x95f1('0x13')]);}})[_0x95f1('0x15')](function(_0x22322a){logger[_0x95f1('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x33782b,_0x22322a);_0x3031c7(_0x22322a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index e927dfb..2f25d81 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 _0x6704=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','multer','util','path','express'];(function(_0x547817,_0x2e59c2){var _0x190085=function(_0x124049){while(--_0x124049){_0x547817['push'](_0x547817['shift']());}};_0x190085(++_0x2e59c2);}(_0x6704,0x1be));var _0x4670=function(_0x9ec221,_0x2594a6){_0x9ec221=_0x9ec221-0x0;var _0xdbe55e=_0x6704[_0x9ec221];return _0xdbe55e;};'use strict';var multer=require(_0x4670('0x0'));var util=require(_0x4670('0x1'));var path=require(_0x4670('0x2'));var timeout=require('connect-timeout');var express=require(_0x4670('0x3'));var router=express['Router']();var fs_extra=require(_0x4670('0x4'));var auth=require(_0x4670('0x5'));var interaction=require(_0x4670('0x6'));var config=require(_0x4670('0x7'));var controller=require(_0x4670('0x8'));router[_0x4670('0x9')]('/',auth[_0x4670('0xa')](),controller[_0x4670('0xb')]);router['get'](_0x4670('0xc'),auth['isAuthenticated'](),controller[_0x4670('0xd')]);router['post']('/',auth[_0x4670('0xa')](),controller[_0x4670('0xe')]);router[_0x4670('0xf')]('/:id',auth[_0x4670('0xa')](),controller[_0x4670('0x10')]);router['delete'](_0x4670('0xc'),auth['isAuthenticated'](),controller[_0x4670('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3c8a=['../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','path','connect-timeout','fs-extra'];(function(_0x49c580,_0xaec7a1){var _0x4d230e=function(_0x355d30){while(--_0x355d30){_0x49c580['push'](_0x49c580['shift']());}};_0x4d230e(++_0xaec7a1);}(_0x3c8a,0x8d));var _0xa3c8=function(_0x3a8b7c,_0x3e5db2){_0x3a8b7c=_0x3a8b7c-0x0;var _0x40eb80=_0x3c8a[_0x3a8b7c];return _0x40eb80;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa3c8('0x0'));var timeout=require(_0xa3c8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa3c8('0x2'));var auth=require(_0xa3c8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa3c8('0x4'));var controller=require(_0xa3c8('0x5'));router[_0xa3c8('0x6')]('/',auth[_0xa3c8('0x7')](),controller[_0xa3c8('0x8')]);router['get'](_0xa3c8('0x9'),auth[_0xa3c8('0x7')](),controller[_0xa3c8('0xa')]);router[_0xa3c8('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa3c8('0xc')]('/:id',auth[_0xa3c8('0x7')](),controller[_0xa3c8('0xd')]);router[_0xa3c8('0xe')]('/:id',auth[_0xa3c8('0x7')](),controller[_0xa3c8('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 7822da7..741dd01 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 _0x12bb=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x4c8e62,_0x2e8c2b){var _0xcde8a7=function(_0x22930d){while(--_0x22930d){_0x4c8e62['push'](_0x4c8e62['shift']());}};_0xcde8a7(++_0x2e8c2b);}(_0x12bb,0x1cf));var _0xb12b=function(_0x26b93e,_0x50bd66){_0x26b93e=_0x26b93e-0x0;var _0x210a20=_0x12bb[_0x26b93e];return _0x210a20;};'use strict';var Sequelize=require(_0xb12b('0x0'));module['exports']={'type':{'type':Sequelize[_0xb12b('0x1')](_0xb12b('0x2'),_0xb12b('0x3'),_0xb12b('0x4'),_0xb12b('0x5'),_0xb12b('0x6')),'defaultValue':_0xb12b('0x2')},'content':{'type':Sequelize[_0xb12b('0x7')]},'key':{'type':Sequelize[_0xb12b('0x7')]},'keyType':{'type':Sequelize[_0xb12b('0x1')](_0xb12b('0x2'),_0xb12b('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xb12b('0x7')]},'idField':{'type':Sequelize[_0xb12b('0x7')]},'variableName':{'type':Sequelize[_0xb12b('0x7')]}}; \ No newline at end of file +var _0x3fc1=['exports','ENUM','string','customVariable','picklist','STRING','variable','sequelize'];(function(_0x4d0074,_0x333127){var _0x44cc5e=function(_0x4ae899){while(--_0x4ae899){_0x4d0074['push'](_0x4d0074['shift']());}};_0x44cc5e(++_0x333127);}(_0x3fc1,0xaf));var _0x13fc=function(_0xed1070,_0x34a8fa){_0xed1070=_0xed1070-0x0;var _0x36a8bc=_0x3fc1[_0xed1070];return _0x36a8bc;};'use strict';var Sequelize=require(_0x13fc('0x0'));module[_0x13fc('0x1')]={'type':{'type':Sequelize[_0x13fc('0x2')](_0x13fc('0x3'),'variable',_0x13fc('0x4'),'keyValue',_0x13fc('0x5')),'defaultValue':_0x13fc('0x3')},'content':{'type':Sequelize[_0x13fc('0x6')]},'key':{'type':Sequelize[_0x13fc('0x6')]},'keyType':{'type':Sequelize[_0x13fc('0x2')](_0x13fc('0x3'),_0x13fc('0x7'),_0x13fc('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x13fc('0x6')]},'variableName':{'type':Sequelize[_0x13fc('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 5dbe2ba..7ffed9b 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 _0x0bdb=['attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','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/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','error','stack','name','index','map','SalesforceField','rawAttributes','fieldName','key','model','query','keys'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x0bdb,0xf1));var _0xb0bd=function(_0x169091,_0x4b0101){_0x169091=_0x169091-0x0;var _0x7ac8b6=_0x0bdb[_0x169091];return _0x7ac8b6;};'use strict';var emlformat=require(_0xb0bd('0x0'));var rimraf=require(_0xb0bd('0x1'));var zipdir=require(_0xb0bd('0x2'));var jsonpatch=require(_0xb0bd('0x3'));var rp=require(_0xb0bd('0x4'));var moment=require(_0xb0bd('0x5'));var BPromise=require(_0xb0bd('0x6'));var Mustache=require('mustache');var util=require(_0xb0bd('0x7'));var path=require(_0xb0bd('0x8'));var sox=require(_0xb0bd('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0bd('0xa'));var _=require('lodash');var squel=require(_0xb0bd('0xb'));var crypto=require(_0xb0bd('0xc'));var jsforce=require(_0xb0bd('0xd'));var deskjs=require(_0xb0bd('0xe'));var toCsv=require(_0xb0bd('0xf'));var querystring=require(_0xb0bd('0x10'));var Papa=require('papaparse');var Redis=require(_0xb0bd('0x11'));var authService=require(_0xb0bd('0x12'));var qs=require(_0xb0bd('0x13'));var as=require(_0xb0bd('0x14'));var hardwareService=require(_0xb0bd('0x15'));var logger=require(_0xb0bd('0x16'))(_0xb0bd('0x17'));var utils=require('../../config/utils');var config=require(_0xb0bd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb0bd('0x19'))['db'];function respondWithStatusCode(_0x3e5131,_0x257b2c){_0x257b2c=_0x257b2c||0xcc;return function(_0x4b6f9d){if(_0x4b6f9d){return _0x3e5131[_0xb0bd('0x1a')](_0x257b2c);}return _0x3e5131['status'](_0x257b2c)[_0xb0bd('0x1b')]();};}function respondWithResult(_0xac1982,_0x4d0245){_0x4d0245=_0x4d0245||0xc8;return function(_0x42cabb){if(_0x42cabb){return _0xac1982[_0xb0bd('0x1c')](_0x4d0245)[_0xb0bd('0x1d')](_0x42cabb);}};}function respondWithFilteredResult(_0xd1b284,_0x56ea4b){return function(_0x58a313){if(_0x58a313){var _0x3784d9=typeof _0x56ea4b[_0xb0bd('0x1e')]===_0xb0bd('0x1f')&&typeof _0x56ea4b['limit']===_0xb0bd('0x1f');var _0xe1546e=_0x58a313[_0xb0bd('0x20')];var _0x1d0460=_0x3784d9?0x0:_0x56ea4b[_0xb0bd('0x1e')];var _0x5e5eec=_0x3784d9?_0x58a313['count']:_0x56ea4b[_0xb0bd('0x1e')]+_0x56ea4b[_0xb0bd('0x21')];var _0x3e0f6d;if(_0x5e5eec>=_0xe1546e){_0x5e5eec=_0xe1546e;_0x3e0f6d=0xc8;}else{_0x3e0f6d=0xce;}_0xd1b284['status'](_0x3e0f6d);return _0xd1b284['set'](_0xb0bd('0x22'),_0x1d0460+'-'+_0x5e5eec+'/'+_0xe1546e)['json'](_0x58a313);}return null;};}function patchUpdates(_0x3e0b0f){return function(_0x275184){try{jsonpatch[_0xb0bd('0x23')](_0x275184,_0x3e0b0f,!![]);}catch(_0x4de2ef){return BPromise[_0xb0bd('0x24')](_0x4de2ef);}return _0x275184['save']();};}function saveUpdates(_0x50b870,_0x15708d){return function(_0x375c4){if(_0x375c4){return _0x375c4[_0xb0bd('0x25')](_0x50b870)[_0xb0bd('0x26')](function(_0x5f35eb){return _0x5f35eb;});}return null;};}function removeEntity(_0x16dcff,_0x4611c3){return function(_0x55609d){if(_0x55609d){return _0x55609d['destroy']()[_0xb0bd('0x26')](function(){_0x16dcff[_0xb0bd('0x1c')](0xcc)[_0xb0bd('0x1b')]();});}};}function handleEntityNotFound(_0x2ae65d,_0x377599){return function(_0x318b00){if(!_0x318b00){_0x2ae65d['sendStatus'](0x194);}return _0x318b00;};}function handleError(_0x4dbe05,_0x5c8759){_0x5c8759=_0x5c8759||0x1f4;return function(_0x5285ed){logger[_0xb0bd('0x27')](_0x5285ed[_0xb0bd('0x28')]);if(_0x5285ed[_0xb0bd('0x29')]){delete _0x5285ed[_0xb0bd('0x29')];}_0x4dbe05[_0xb0bd('0x1c')](_0x5c8759)['send'](_0x5285ed);};}exports[_0xb0bd('0x2a')]=function(_0x4ba73d,_0x6411e1){var _0x40e207={},_0x4cedf0={},_0x485555={'count':0x0,'rows':[]};var _0x44f9f2=_[_0xb0bd('0x2b')](db[_0xb0bd('0x2c')][_0xb0bd('0x2d')],function(_0x1d8971){return{'name':_0x1d8971[_0xb0bd('0x2e')],'type':_0x1d8971['type'][_0xb0bd('0x2f')]};});_0x4cedf0[_0xb0bd('0x30')]=_[_0xb0bd('0x2b')](_0x44f9f2,_0xb0bd('0x29'));_0x4cedf0[_0xb0bd('0x31')]=_[_0xb0bd('0x32')](_0x4ba73d[_0xb0bd('0x31')]);_0x4cedf0['filters']=_['intersection'](_0x4cedf0[_0xb0bd('0x30')],_0x4cedf0[_0xb0bd('0x31')]);_0x40e207[_0xb0bd('0x33')]=_[_0xb0bd('0x34')](_0x4cedf0[_0xb0bd('0x30')],qs[_0xb0bd('0x35')](_0x4ba73d[_0xb0bd('0x31')][_0xb0bd('0x35')]));_0x40e207[_0xb0bd('0x33')]=_0x40e207['attributes'][_0xb0bd('0x36')]?_0x40e207[_0xb0bd('0x33')]:_0x4cedf0[_0xb0bd('0x30')];if(!_0x4ba73d[_0xb0bd('0x31')][_0xb0bd('0x37')]('nolimit')){_0x40e207[_0xb0bd('0x21')]=qs[_0xb0bd('0x21')](_0x4ba73d[_0xb0bd('0x31')][_0xb0bd('0x21')]);_0x40e207[_0xb0bd('0x1e')]=qs[_0xb0bd('0x1e')](_0x4ba73d[_0xb0bd('0x31')][_0xb0bd('0x1e')]);}_0x40e207[_0xb0bd('0x38')]=qs[_0xb0bd('0x39')](_0x4ba73d[_0xb0bd('0x31')][_0xb0bd('0x39')]);_0x40e207[_0xb0bd('0x3a')]=qs[_0xb0bd('0x3b')](_[_0xb0bd('0x3c')](_0x4ba73d['query'],_0x4cedf0['filters']),_0x44f9f2);if(_0x4ba73d['query'][_0xb0bd('0x3d')]){_0x40e207[_0xb0bd('0x3a')]=_[_0xb0bd('0x3e')](_0x40e207['where'],{'$or':_['map'](_0x44f9f2,function(_0x3b5c08){if(_0x3b5c08['type']!==_0xb0bd('0x3f')){var _0x1f0db6={};_0x1f0db6[_0x3b5c08[_0xb0bd('0x29')]]={'$like':'%'+_0x4ba73d[_0xb0bd('0x31')][_0xb0bd('0x3d')]+'%'};return _0x1f0db6;}})});}_0x40e207=_['merge']({},_0x40e207,_0x4ba73d[_0xb0bd('0x40')]);var _0x4ad74f={'where':_0x40e207[_0xb0bd('0x3a')]};return db[_0xb0bd('0x2c')][_0xb0bd('0x20')](_0x4ad74f)[_0xb0bd('0x26')](function(_0x6e1e11){_0x485555[_0xb0bd('0x20')]=_0x6e1e11;if(_0x4ba73d[_0xb0bd('0x31')][_0xb0bd('0x41')]){_0x40e207['include']=[{'all':!![]}];}return db[_0xb0bd('0x2c')]['findAll'](_0x40e207);})[_0xb0bd('0x26')](function(_0x58cc3a){_0x485555['rows']=_0x58cc3a;return _0x485555;})[_0xb0bd('0x26')](respondWithFilteredResult(_0x6411e1,_0x40e207))[_0xb0bd('0x42')](handleError(_0x6411e1,null));};exports[_0xb0bd('0x43')]=function(_0x2982f0,_0x4ce2e9){var _0x5bdfa6={'raw':!![],'where':{'id':_0x2982f0[_0xb0bd('0x44')]['id']}},_0x7dab6f={};_0x7dab6f[_0xb0bd('0x30')]=_[_0xb0bd('0x32')](db[_0xb0bd('0x2c')]['rawAttributes']);_0x7dab6f[_0xb0bd('0x31')]=_['keys'](_0x2982f0[_0xb0bd('0x31')]);_0x7dab6f[_0xb0bd('0x3b')]=_[_0xb0bd('0x34')](_0x7dab6f[_0xb0bd('0x30')],_0x7dab6f[_0xb0bd('0x31')]);_0x5bdfa6[_0xb0bd('0x33')]=_[_0xb0bd('0x34')](_0x7dab6f[_0xb0bd('0x30')],qs[_0xb0bd('0x35')](_0x2982f0[_0xb0bd('0x31')][_0xb0bd('0x35')]));_0x5bdfa6[_0xb0bd('0x33')]=_0x5bdfa6['attributes'][_0xb0bd('0x36')]?_0x5bdfa6[_0xb0bd('0x33')]:_0x7dab6f[_0xb0bd('0x30')];if(_0x2982f0[_0xb0bd('0x31')][_0xb0bd('0x41')]){_0x5bdfa6[_0xb0bd('0x45')]=[{'all':!![]}];}_0x5bdfa6=_[_0xb0bd('0x3e')]({},_0x5bdfa6,_0x2982f0[_0xb0bd('0x40')]);return db[_0xb0bd('0x2c')]['find'](_0x5bdfa6)[_0xb0bd('0x26')](handleEntityNotFound(_0x4ce2e9,null))['then'](respondWithResult(_0x4ce2e9,null))[_0xb0bd('0x42')](handleError(_0x4ce2e9,null));};exports[_0xb0bd('0x46')]=function(_0x1f615c,_0x5cc1af){return db[_0xb0bd('0x2c')][_0xb0bd('0x46')](_0x1f615c[_0xb0bd('0x47')],{})[_0xb0bd('0x26')](respondWithResult(_0x5cc1af,0xc9))[_0xb0bd('0x42')](handleError(_0x5cc1af,null));};exports['update']=function(_0x59500e,_0x440187){if(_0x59500e[_0xb0bd('0x47')]['id']){delete _0x59500e[_0xb0bd('0x47')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x59500e[_0xb0bd('0x44')]['id']}})[_0xb0bd('0x26')](handleEntityNotFound(_0x440187,null))[_0xb0bd('0x26')](saveUpdates(_0x59500e[_0xb0bd('0x47')],null))[_0xb0bd('0x26')](respondWithResult(_0x440187,null))[_0xb0bd('0x42')](handleError(_0x440187,null));};exports['destroy']=function(_0x40583d,_0x1890dd){return db[_0xb0bd('0x2c')][_0xb0bd('0x48')]({'where':{'id':_0x40583d['params']['id']}})[_0xb0bd('0x26')](handleEntityNotFound(_0x1890dd,null))[_0xb0bd('0x26')](removeEntity(_0x1890dd,null))[_0xb0bd('0x42')](handleError(_0x1890dd,null));}; \ No newline at end of file +var _0xe21f=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SalesforceField','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x20f04d,_0x532d73){var _0x58a0e5=function(_0x273a58){while(--_0x273a58){_0x20f04d['push'](_0x20f04d['shift']());}};_0x58a0e5(++_0x532d73);}(_0xe21f,0x102));var _0xfe21=function(_0x586b6b,_0x4e1aeb){_0x586b6b=_0x586b6b-0x0;var _0x4eb7d4=_0xe21f[_0x586b6b];return _0x4eb7d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe21('0x0'));var zipdir=require(_0xfe21('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe21('0x2'));var moment=require(_0xfe21('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfe21('0x4'));var util=require(_0xfe21('0x5'));var path=require(_0xfe21('0x6'));var sox=require(_0xfe21('0x7'));var csv=require(_0xfe21('0x8'));var ejs=require(_0xfe21('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe21('0xa'));var squel=require(_0xfe21('0xb'));var crypto=require(_0xfe21('0xc'));var jsforce=require(_0xfe21('0xd'));var deskjs=require(_0xfe21('0xe'));var toCsv=require(_0xfe21('0x8'));var querystring=require(_0xfe21('0xf'));var Papa=require(_0xfe21('0x10'));var Redis=require(_0xfe21('0x11'));var authService=require(_0xfe21('0x12'));var qs=require(_0xfe21('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe21('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xfe21('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfe21('0x16'));var db=require(_0xfe21('0x17'))['db'];function respondWithStatusCode(_0x1f8b97,_0x3447fb){_0x3447fb=_0x3447fb||0xcc;return function(_0x34fd96){if(_0x34fd96){return _0x1f8b97['sendStatus'](_0x3447fb);}return _0x1f8b97[_0xfe21('0x18')](_0x3447fb)[_0xfe21('0x19')]();};}function respondWithResult(_0x21a9d0,_0x2eee35){_0x2eee35=_0x2eee35||0xc8;return function(_0x4fb915){if(_0x4fb915){return _0x21a9d0[_0xfe21('0x18')](_0x2eee35)[_0xfe21('0x1a')](_0x4fb915);}};}function respondWithFilteredResult(_0x296c8f,_0x51c8c1){return function(_0x2ad1fb){if(_0x2ad1fb){var _0x5cead4=typeof _0x51c8c1[_0xfe21('0x1b')]==='undefined'&&typeof _0x51c8c1[_0xfe21('0x1c')]===_0xfe21('0x1d');var _0x221881=_0x2ad1fb[_0xfe21('0x1e')];var _0x534d6e=_0x5cead4?0x0:_0x51c8c1[_0xfe21('0x1b')];var _0x97079d=_0x5cead4?_0x2ad1fb[_0xfe21('0x1e')]:_0x51c8c1['offset']+_0x51c8c1[_0xfe21('0x1c')];var _0x732600;if(_0x97079d>=_0x221881){_0x97079d=_0x221881;_0x732600=0xc8;}else{_0x732600=0xce;}_0x296c8f[_0xfe21('0x18')](_0x732600);return _0x296c8f[_0xfe21('0x1f')](_0xfe21('0x20'),_0x534d6e+'-'+_0x97079d+'/'+_0x221881)[_0xfe21('0x1a')](_0x2ad1fb);}return null;};}function patchUpdates(_0x8bbe5d){return function(_0x46d48f){try{jsonpatch[_0xfe21('0x21')](_0x46d48f,_0x8bbe5d,!![]);}catch(_0x3c1f7){return BPromise['reject'](_0x3c1f7);}return _0x46d48f['save']();};}function saveUpdates(_0x63ea51,_0x5bfb8e){return function(_0x1d00e8){if(_0x1d00e8){return _0x1d00e8[_0xfe21('0x22')](_0x63ea51)[_0xfe21('0x23')](function(_0x58bc41){return _0x58bc41;});}return null;};}function removeEntity(_0x17d96d,_0x55baf0){return function(_0x117224){if(_0x117224){return _0x117224[_0xfe21('0x24')]()[_0xfe21('0x23')](function(){_0x17d96d['status'](0xcc)[_0xfe21('0x19')]();});}};}function handleEntityNotFound(_0xa35e39,_0x556e64){return function(_0x5c00a0){if(!_0x5c00a0){_0xa35e39[_0xfe21('0x25')](0x194);}return _0x5c00a0;};}function handleError(_0x4e027e,_0x5bde56){_0x5bde56=_0x5bde56||0x1f4;return function(_0x3649a1){logger[_0xfe21('0x26')](_0x3649a1[_0xfe21('0x27')]);if(_0x3649a1[_0xfe21('0x28')]){delete _0x3649a1['name'];}_0x4e027e[_0xfe21('0x18')](_0x5bde56)[_0xfe21('0x29')](_0x3649a1);};}exports[_0xfe21('0x2a')]=function(_0x4c8aba,_0x311eb0){var _0x5d5d05={},_0x5c7191={},_0x3cfd93={'count':0x0,'rows':[]};var _0x2a983d=_[_0xfe21('0x2b')](db['SalesforceField'][_0xfe21('0x2c')],function(_0x59539e){return{'name':_0x59539e[_0xfe21('0x2d')],'type':_0x59539e[_0xfe21('0x2e')][_0xfe21('0x2f')]};});_0x5c7191[_0xfe21('0x30')]=_['map'](_0x2a983d,'name');_0x5c7191[_0xfe21('0x31')]=_[_0xfe21('0x32')](_0x4c8aba[_0xfe21('0x31')]);_0x5c7191[_0xfe21('0x33')]=_[_0xfe21('0x34')](_0x5c7191[_0xfe21('0x30')],_0x5c7191[_0xfe21('0x31')]);_0x5d5d05['attributes']=_[_0xfe21('0x34')](_0x5c7191[_0xfe21('0x30')],qs[_0xfe21('0x35')](_0x4c8aba[_0xfe21('0x31')][_0xfe21('0x35')]));_0x5d5d05[_0xfe21('0x36')]=_0x5d5d05[_0xfe21('0x36')][_0xfe21('0x37')]?_0x5d5d05['attributes']:_0x5c7191['model'];if(!_0x4c8aba[_0xfe21('0x31')][_0xfe21('0x38')](_0xfe21('0x39'))){_0x5d5d05['limit']=qs[_0xfe21('0x1c')](_0x4c8aba[_0xfe21('0x31')][_0xfe21('0x1c')]);_0x5d5d05['offset']=qs[_0xfe21('0x1b')](_0x4c8aba['query'][_0xfe21('0x1b')]);}_0x5d5d05[_0xfe21('0x3a')]=qs[_0xfe21('0x3b')](_0x4c8aba[_0xfe21('0x31')][_0xfe21('0x3b')]);_0x5d5d05['where']=qs[_0xfe21('0x33')](_[_0xfe21('0x3c')](_0x4c8aba[_0xfe21('0x31')],_0x5c7191[_0xfe21('0x33')]),_0x2a983d);if(_0x4c8aba[_0xfe21('0x31')][_0xfe21('0x3d')]){_0x5d5d05[_0xfe21('0x3e')]=_[_0xfe21('0x3f')](_0x5d5d05['where'],{'$or':_[_0xfe21('0x2b')](_0x2a983d,function(_0x5baeb7){if(_0x5baeb7[_0xfe21('0x2e')]!==_0xfe21('0x40')){var _0x307043={};_0x307043[_0x5baeb7[_0xfe21('0x28')]]={'$like':'%'+_0x4c8aba[_0xfe21('0x31')][_0xfe21('0x3d')]+'%'};return _0x307043;}})});}_0x5d5d05=_[_0xfe21('0x3f')]({},_0x5d5d05,_0x4c8aba['options']);var _0x59dcae={'where':_0x5d5d05['where']};return db[_0xfe21('0x41')]['count'](_0x59dcae)['then'](function(_0x496ea3){_0x3cfd93['count']=_0x496ea3;if(_0x4c8aba['query'][_0xfe21('0x42')]){_0x5d5d05[_0xfe21('0x43')]=[{'all':!![]}];}return db[_0xfe21('0x41')][_0xfe21('0x44')](_0x5d5d05);})[_0xfe21('0x23')](function(_0x3f94bb){_0x3cfd93[_0xfe21('0x45')]=_0x3f94bb;return _0x3cfd93;})[_0xfe21('0x23')](respondWithFilteredResult(_0x311eb0,_0x5d5d05))['catch'](handleError(_0x311eb0,null));};exports[_0xfe21('0x46')]=function(_0x483e41,_0x6b1b5e){var _0x4ce39c={'raw':!![],'where':{'id':_0x483e41[_0xfe21('0x47')]['id']}},_0x1ea12b={};_0x1ea12b[_0xfe21('0x30')]=_[_0xfe21('0x32')](db[_0xfe21('0x41')][_0xfe21('0x2c')]);_0x1ea12b[_0xfe21('0x31')]=_[_0xfe21('0x32')](_0x483e41[_0xfe21('0x31')]);_0x1ea12b[_0xfe21('0x33')]=_[_0xfe21('0x34')](_0x1ea12b[_0xfe21('0x30')],_0x1ea12b['query']);_0x4ce39c['attributes']=_[_0xfe21('0x34')](_0x1ea12b[_0xfe21('0x30')],qs[_0xfe21('0x35')](_0x483e41['query'][_0xfe21('0x35')]));_0x4ce39c[_0xfe21('0x36')]=_0x4ce39c[_0xfe21('0x36')]['length']?_0x4ce39c[_0xfe21('0x36')]:_0x1ea12b[_0xfe21('0x30')];if(_0x483e41['query'][_0xfe21('0x42')]){_0x4ce39c[_0xfe21('0x43')]=[{'all':!![]}];}_0x4ce39c=_[_0xfe21('0x3f')]({},_0x4ce39c,_0x483e41[_0xfe21('0x48')]);return db[_0xfe21('0x41')][_0xfe21('0x49')](_0x4ce39c)[_0xfe21('0x23')](handleEntityNotFound(_0x6b1b5e,null))['then'](respondWithResult(_0x6b1b5e,null))[_0xfe21('0x4a')](handleError(_0x6b1b5e,null));};exports[_0xfe21('0x4b')]=function(_0x4c2b5d,_0xac6346){return db[_0xfe21('0x41')][_0xfe21('0x4b')](_0x4c2b5d[_0xfe21('0x4c')],{})['then'](respondWithResult(_0xac6346,0xc9))['catch'](handleError(_0xac6346,null));};exports[_0xfe21('0x22')]=function(_0x3a08fe,_0x2a3024){if(_0x3a08fe[_0xfe21('0x4c')]['id']){delete _0x3a08fe[_0xfe21('0x4c')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x3a08fe['params']['id']}})[_0xfe21('0x23')](handleEntityNotFound(_0x2a3024,null))[_0xfe21('0x23')](saveUpdates(_0x3a08fe[_0xfe21('0x4c')],null))[_0xfe21('0x23')](respondWithResult(_0x2a3024,null))[_0xfe21('0x4a')](handleError(_0x2a3024,null));};exports['destroy']=function(_0x19e4ea,_0xbfba55){return db[_0xfe21('0x41')]['find']({'where':{'id':_0x19e4ea['params']['id']}})[_0xfe21('0x23')](handleEntityNotFound(_0xbfba55,null))[_0xfe21('0x23')](removeEntity(_0xbfba55,null))[_0xfe21('0x4a')](handleError(_0xbfba55,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index dae42cb..125a43e 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 _0x5568=['FieldId','lodash','util','moment','request-promise','path','rimraf','../../config/environment','define','SalesforceField','salesforce_unique_index'];(function(_0x1820f1,_0x1403e7){var _0x167aed=function(_0x4c89f5){while(--_0x4c89f5){_0x1820f1['push'](_0x1820f1['shift']());}};_0x167aed(++_0x1403e7);}(_0x5568,0x198));var _0x8556=function(_0x592561,_0x421c3c){_0x592561=_0x592561-0x0;var _0x6a5f3a=_0x5568[_0x592561];return _0x6a5f3a;};'use strict';var _=require(_0x8556('0x0'));var util=require(_0x8556('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8556('0x2'));var BPromise=require('bluebird');var rp=require(_0x8556('0x3'));var fs=require('fs');var path=require(_0x8556('0x4'));var rimraf=require(_0x8556('0x5'));var config=require(_0x8556('0x6'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x1bd342,_0x43a222){return _0x1bd342[_0x8556('0x7')](_0x8556('0x8'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x8556('0x9'),'fields':['idField',_0x8556('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0357=['../../config/logger','api','moment','bluebird','path','./intSalesforceField.attributes','exports','define','salesforce_unique_index','idField','FieldId','lodash','util'];(function(_0x4a0086,_0x5b2ad3){var _0x3857f6=function(_0x50186c){while(--_0x50186c){_0x4a0086['push'](_0x4a0086['shift']());}};_0x3857f6(++_0x5b2ad3);}(_0x0357,0x11c));var _0x7035=function(_0x4452f1,_0x5ad396){_0x4452f1=_0x4452f1-0x0;var _0x6cedd0=_0x0357[_0x4452f1];return _0x6cedd0;};'use strict';var _=require(_0x7035('0x0'));var util=require(_0x7035('0x1'));var logger=require(_0x7035('0x2'))(_0x7035('0x3'));var moment=require(_0x7035('0x4'));var BPromise=require(_0x7035('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7035('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7035('0x7'));module[_0x7035('0x8')]=function(_0x3c8142,_0x404702){return _0x3c8142[_0x7035('0x9')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x7035('0xa'),'fields':[_0x7035('0xb'),_0x7035('0xc')],'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 042ed89..b9bd04e 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 _0x5fec=['stringify','error','code','message','catch','lodash','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent'];(function(_0x2fcede,_0x3af44d){var _0x449adc=function(_0x3b5323){while(--_0x3b5323){_0x2fcede['push'](_0x2fcede['shift']());}};_0x449adc(++_0x3af44d);}(_0x5fec,0x194));var _0xc5fe=function(_0x35f41f,_0x3fc9c7){_0x35f41f=_0x35f41f-0x0;var _0x3daafd=_0x5fec[_0x35f41f];return _0x3daafd;};'use strict';var _=require(_0xc5fe('0x0'));var util=require('util');var moment=require(_0xc5fe('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5fe('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5fe('0x3'));var logger=require('../../config/logger')(_0xc5fe('0x4'));var config=require(_0xc5fe('0x5'));var jayson=require(_0xc5fe('0x6'));var client=jayson[_0xc5fe('0x7')][_0xc5fe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4509af,_0x10705c,_0x57b2e9){return new BPromise(function(_0x12215a,_0x48c881){return client[_0xc5fe('0x9')](_0x4509af,_0x57b2e9)[_0xc5fe('0xa')](function(_0x255180){logger[_0xc5fe('0xb')](_0xc5fe('0xc'),_0x10705c,_0xc5fe('0xd'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x10705c,_0xc5fe('0xd'),JSON[_0xc5fe('0xe')](_0x255180));if(_0x255180['error']){if(_0x255180[_0xc5fe('0xf')][_0xc5fe('0x10')]===0x1f4){logger[_0xc5fe('0xf')](_0xc5fe('0xc'),_0x10705c,_0x255180['error'][_0xc5fe('0x11')]);return _0x48c881(_0x255180['error']['message']);}logger['error'](_0xc5fe('0xc'),_0x10705c,_0x255180[_0xc5fe('0xf')][_0xc5fe('0x11')]);return _0x12215a(_0x255180[_0xc5fe('0xf')][_0xc5fe('0x11')]);}else{logger[_0xc5fe('0xb')](_0xc5fe('0xc'),_0x10705c,_0xc5fe('0xd'));_0x12215a(_0x255180['result']['message']);}})[_0xc5fe('0x12')](function(_0x20f5ef){logger[_0xc5fe('0xf')](_0xc5fe('0xc'),_0x10705c,_0x20f5ef);_0x48c881(_0x20f5ef);});});} \ No newline at end of file +var _0x21ad=['client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x517dbd,_0x2bfecb){var _0x4d8ffb=function(_0x213a75){while(--_0x213a75){_0x517dbd['push'](_0x517dbd['shift']());}};_0x4d8ffb(++_0x2bfecb);}(_0x21ad,0x13a));var _0xd21a=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x21ad[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0xd21a('0x0'));var util=require(_0xd21a('0x1'));var moment=require(_0xd21a('0x2'));var BPromise=require(_0xd21a('0x3'));var rs=require(_0xd21a('0x4'));var fs=require('fs');var Redis=require(_0xd21a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd21a('0x6'));var logger=require(_0xd21a('0x7'))(_0xd21a('0x8'));var config=require(_0xd21a('0x9'));var jayson=require(_0xd21a('0xa'));var client=jayson[_0xd21a('0xb')][_0xd21a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b2553,_0x57f2c7,_0x193d12){return new BPromise(function(_0x56ecdd,_0x278ae5){return client[_0xd21a('0xd')](_0x3b2553,_0x193d12)[_0xd21a('0xe')](function(_0x47e56d){logger[_0xd21a('0xf')](_0xd21a('0x10'),_0x57f2c7,_0xd21a('0x11'));logger[_0xd21a('0x12')](_0xd21a('0x13'),_0x57f2c7,_0xd21a('0x11'),JSON[_0xd21a('0x14')](_0x47e56d));if(_0x47e56d['error']){if(_0x47e56d['error'][_0xd21a('0x15')]===0x1f4){logger['error'](_0xd21a('0x10'),_0x57f2c7,_0x47e56d[_0xd21a('0x16')][_0xd21a('0x17')]);return _0x278ae5(_0x47e56d[_0xd21a('0x16')]['message']);}logger[_0xd21a('0x16')](_0xd21a('0x10'),_0x57f2c7,_0x47e56d[_0xd21a('0x16')][_0xd21a('0x17')]);return _0x56ecdd(_0x47e56d[_0xd21a('0x16')][_0xd21a('0x17')]);}else{logger[_0xd21a('0xf')](_0xd21a('0x10'),_0x57f2c7,_0xd21a('0x11'));_0x56ecdd(_0x47e56d[_0xd21a('0x18')][_0xd21a('0x17')]);}})['catch'](function(_0x1c94eb){logger[_0xd21a('0x16')](_0xd21a('0x10'),_0x57f2c7,_0x1c94eb);_0x278ae5(_0x1c94eb);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 47efa91..7ce7238 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 _0xb720=['post','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','getFields'];(function(_0x31a938,_0x4daec6){var _0x1bf341=function(_0x514261){while(--_0x514261){_0x31a938['push'](_0x31a938['shift']());}};_0x1bf341(++_0x4daec6);}(_0xb720,0x191));var _0x0b72=function(_0x5c2e65,_0x20e630){_0x5c2e65=_0x5c2e65-0x0;var _0x445359=_0xb720[_0x5c2e65];return _0x445359;};'use strict';var multer=require(_0x0b72('0x0'));var util=require('util');var path=require(_0x0b72('0x1'));var timeout=require(_0x0b72('0x2'));var express=require(_0x0b72('0x3'));var router=express[_0x0b72('0x4')]();var fs_extra=require(_0x0b72('0x5'));var auth=require(_0x0b72('0x6'));var interaction=require(_0x0b72('0x7'));var config=require(_0x0b72('0x8'));var controller=require(_0x0b72('0x9'));router['get']('/',auth[_0x0b72('0xa')](),controller['index']);router[_0x0b72('0xb')](_0x0b72('0xc'),auth[_0x0b72('0xa')](),controller[_0x0b72('0xd')]);router[_0x0b72('0xb')](_0x0b72('0xe'),auth[_0x0b72('0xa')](),controller[_0x0b72('0xf')]);router[_0x0b72('0xb')]('/:id/fields',auth[_0x0b72('0xa')](),controller[_0x0b72('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0b72('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x0b72('0x12')](_0x0b72('0xc'),auth[_0x0b72('0xa')](),controller[_0x0b72('0x13')]);router[_0x0b72('0x14')](_0x0b72('0xc'),auth[_0x0b72('0xa')](),controller['destroy']);module[_0x0b72('0x15')]=router; \ No newline at end of file +var _0x09d3=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','update','multer','util','path','connect-timeout','express','Router'];(function(_0xf34895,_0x21fb70){var _0x143f44=function(_0x2e7730){while(--_0x2e7730){_0xf34895['push'](_0xf34895['shift']());}};_0x143f44(++_0x21fb70);}(_0x09d3,0xa5));var _0x309d=function(_0x1c64b0,_0x57d581){_0x1c64b0=_0x1c64b0-0x0;var _0x11ac72=_0x09d3[_0x1c64b0];return _0x11ac72;};'use strict';var multer=require(_0x309d('0x0'));var util=require(_0x309d('0x1'));var path=require(_0x309d('0x2'));var timeout=require(_0x309d('0x3'));var express=require(_0x309d('0x4'));var router=express[_0x309d('0x5')]();var fs_extra=require(_0x309d('0x6'));var auth=require(_0x309d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x309d('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x309d('0x9')]('/',auth[_0x309d('0xa')](),controller['index']);router[_0x309d('0x9')](_0x309d('0xb'),auth['isAuthenticated'](),controller[_0x309d('0xc')]);router[_0x309d('0x9')](_0x309d('0xd'),auth[_0x309d('0xa')](),controller[_0x309d('0xe')]);router[_0x309d('0x9')]('/:id/fields',auth[_0x309d('0xa')](),controller[_0x309d('0xf')]);router[_0x309d('0x10')]('/',auth[_0x309d('0xa')](),controller[_0x309d('0x11')]);router[_0x309d('0x10')]('/:id/configurations',auth[_0x309d('0xa')](),controller['addConfiguration']);router['put'](_0x309d('0xb'),auth[_0x309d('0xa')](),controller[_0x309d('0x12')]);router['delete'](_0x309d('0xb'),auth[_0x309d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 09d0e1f..ee56f6f 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 _0x2c7b=['username','remoteUri','STRING'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x2c7b,0x12b));var _0xb2c7=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2c7b[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb2c7('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb2c7('0x0')],'unique':_0xb2c7('0x1')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb2c7('0x0')]},'remoteUri':{'type':Sequelize[_0xb2c7('0x0')],'unique':_0xb2c7('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xa995=['exports','STRING','username','remoteUri','sequelize'];(function(_0x34bf32,_0x3ad851){var _0x4a4036=function(_0x70413a){while(--_0x70413a){_0x34bf32['push'](_0x34bf32['shift']());}};_0x4a4036(++_0x3ad851);}(_0xa995,0x95));var _0x5a99=function(_0x57286f,_0x2f693c){_0x57286f=_0x57286f-0x0;var _0x3fd803=_0xa995[_0x57286f];return _0x3fd803;};'use strict';var Sequelize=require(_0x5a99('0x0'));module[_0x5a99('0x1')]={'name':{'type':Sequelize[_0x5a99('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5a99('0x2')],'unique':_0x5a99('0x3')},'password':{'type':Sequelize[_0x5a99('0x2')]},'email':{'type':Sequelize[_0x5a99('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5a99('0x4')},'serverUrl':{'type':Sequelize[_0x5a99('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 1281181..ce04f44 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 _0xd770=['incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','test','statusCode','Wrong\x20credentials','boolean','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','result','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','ServicenowAccount','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','child_incidents','resolved_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','cmdb_ci','impact','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','business_stc','additional_assignee_list','sys_class_name','follow_up','parent_incident','sys_id','contact_type','reopened_by','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','username','password','email','remoteUri','slice','substring','%s/api/now/doc/table/schema/','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd770,0xcd));var _0x0d77=function(_0x31d7e8,_0x3d4f67){_0x31d7e8=_0x31d7e8-0x0;var _0x1eae7a=_0xd770[_0x31d7e8];return _0x1eae7a;};'use strict';var emlformat=require(_0x0d77('0x0'));var rimraf=require(_0x0d77('0x1'));var zipdir=require(_0x0d77('0x2'));var jsonpatch=require(_0x0d77('0x3'));var rp=require(_0x0d77('0x4'));var moment=require(_0x0d77('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0d77('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0d77('0x7'));var csv=require('to-csv');var ejs=require(_0x0d77('0x8'));var fs=require('fs');var fs_extra=require(_0x0d77('0x9'));var _=require(_0x0d77('0xa'));var squel=require(_0x0d77('0xb'));var crypto=require('crypto');var jsforce=require(_0x0d77('0xc'));var deskjs=require(_0x0d77('0xd'));var toCsv=require(_0x0d77('0xe'));var querystring=require(_0x0d77('0xf'));var Papa=require(_0x0d77('0x10'));var Redis=require(_0x0d77('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0d77('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0d77('0x13'));var utils=require(_0x0d77('0x14'));var config=require(_0x0d77('0x15'));var licenseUtil=require(_0x0d77('0x16'));var db=require(_0x0d77('0x17'))['db'];var integrations=require(_0x0d77('0x18'));function respondWithStatusCode(_0x5105c7,_0x258ffd){_0x258ffd=_0x258ffd||0xcc;return function(_0x137c9e){if(_0x137c9e){return _0x5105c7[_0x0d77('0x19')](_0x258ffd);}return _0x5105c7[_0x0d77('0x1a')](_0x258ffd)[_0x0d77('0x1b')]();};}function respondWithResult(_0x4a3efc,_0x2f73f8){_0x2f73f8=_0x2f73f8||0xc8;return function(_0x49e29a){if(_0x49e29a){return _0x4a3efc[_0x0d77('0x1a')](_0x2f73f8)[_0x0d77('0x1c')](_0x49e29a);}};}function respondWithFilteredResult(_0x5a24cf,_0x54487d){return function(_0x208763){if(_0x208763){var _0x3a7bd5=typeof _0x54487d[_0x0d77('0x1d')]===_0x0d77('0x1e')&&typeof _0x54487d['limit']===_0x0d77('0x1e');var _0x3a895b=_0x208763['count'];var _0x4ee88c=_0x3a7bd5?0x0:_0x54487d[_0x0d77('0x1d')];var _0x408275=_0x3a7bd5?_0x208763['count']:_0x54487d[_0x0d77('0x1d')]+_0x54487d['limit'];var _0x1d2eb4;if(_0x408275>=_0x3a895b){_0x408275=_0x3a895b;_0x1d2eb4=0xc8;}else{_0x1d2eb4=0xce;}_0x5a24cf[_0x0d77('0x1a')](_0x1d2eb4);return _0x5a24cf['set'](_0x0d77('0x1f'),_0x4ee88c+'-'+_0x408275+'/'+_0x3a895b)['json'](_0x208763);}return null;};}function patchUpdates(_0x2c3981){return function(_0x6552b8){try{jsonpatch[_0x0d77('0x20')](_0x6552b8,_0x2c3981,!![]);}catch(_0x169c45){return BPromise[_0x0d77('0x21')](_0x169c45);}return _0x6552b8[_0x0d77('0x22')]();};}function saveUpdates(_0x2926c2,_0x15e4b4){return function(_0x32776b){if(_0x32776b){return _0x32776b[_0x0d77('0x23')](_0x2926c2)[_0x0d77('0x24')](function(_0x475bb0){return _0x475bb0;});}return null;};}function removeEntity(_0x3dfff8,_0x574d0c){return function(_0x346221){if(_0x346221){return _0x346221[_0x0d77('0x25')]()[_0x0d77('0x24')](function(){_0x3dfff8[_0x0d77('0x1a')](0xcc)[_0x0d77('0x1b')]();});}};}function handleEntityNotFound(_0x17fa0e,_0x4975f0){return function(_0x190f56){if(!_0x190f56){_0x17fa0e[_0x0d77('0x19')](0x194);}return _0x190f56;};}function handleError(_0x2f6af6,_0x27ec63){_0x27ec63=_0x27ec63||0x1f4;return function(_0xc6d438){logger[_0x0d77('0x26')](_0xc6d438[_0x0d77('0x27')]);if(_0xc6d438[_0x0d77('0x28')]){delete _0xc6d438[_0x0d77('0x28')];}_0x2f6af6[_0x0d77('0x1a')](_0x27ec63)[_0x0d77('0x29')](_0xc6d438);};}exports[_0x0d77('0x2a')]=function(_0x508243,_0x169ef3){var _0x3064d8={},_0x58c333={},_0x28e344={'count':0x0,'rows':[]};var _0x24d3d1=_['map'](db['ServicenowAccount'][_0x0d77('0x2b')],function(_0x4b77b9){return{'name':_0x4b77b9[_0x0d77('0x2c')],'type':_0x4b77b9[_0x0d77('0x2d')][_0x0d77('0x2e')]};});_0x58c333[_0x0d77('0x2f')]=_[_0x0d77('0x30')](_0x24d3d1,_0x0d77('0x28'));_0x58c333[_0x0d77('0x31')]=_['keys'](_0x508243['query']);_0x58c333[_0x0d77('0x32')]=_['intersection'](_0x58c333[_0x0d77('0x2f')],_0x58c333['query']);_0x3064d8[_0x0d77('0x33')]=_[_0x0d77('0x34')](_0x58c333[_0x0d77('0x2f')],qs[_0x0d77('0x35')](_0x508243[_0x0d77('0x31')][_0x0d77('0x35')]));_0x3064d8[_0x0d77('0x33')]=_0x3064d8[_0x0d77('0x33')][_0x0d77('0x36')]?_0x3064d8[_0x0d77('0x33')]:_0x58c333[_0x0d77('0x2f')];if(!_0x508243[_0x0d77('0x31')][_0x0d77('0x37')](_0x0d77('0x38'))){_0x3064d8[_0x0d77('0x39')]=qs[_0x0d77('0x39')](_0x508243[_0x0d77('0x31')][_0x0d77('0x39')]);_0x3064d8[_0x0d77('0x1d')]=qs[_0x0d77('0x1d')](_0x508243[_0x0d77('0x31')]['offset']);}_0x3064d8[_0x0d77('0x3a')]=qs[_0x0d77('0x3b')](_0x508243[_0x0d77('0x31')]['sort']);_0x3064d8[_0x0d77('0x3c')]=qs[_0x0d77('0x32')](_['pick'](_0x508243[_0x0d77('0x31')],_0x58c333[_0x0d77('0x32')]),_0x24d3d1);if(_0x508243[_0x0d77('0x31')][_0x0d77('0x3d')]){_0x3064d8[_0x0d77('0x3c')]=_[_0x0d77('0x3e')](_0x3064d8['where'],{'$or':_['map'](_0x24d3d1,function(_0x2ee0e2){if(_0x2ee0e2['type']!==_0x0d77('0x3f')){var _0x14f256={};_0x14f256[_0x2ee0e2[_0x0d77('0x28')]]={'$like':'%'+_0x508243[_0x0d77('0x31')][_0x0d77('0x3d')]+'%'};return _0x14f256;}})});}_0x3064d8=_['merge']({},_0x3064d8,_0x508243[_0x0d77('0x40')]);var _0x5f1ef0={'where':_0x3064d8[_0x0d77('0x3c')]};return db[_0x0d77('0x41')][_0x0d77('0x42')](_0x5f1ef0)[_0x0d77('0x24')](function(_0x328ba1){_0x28e344[_0x0d77('0x42')]=_0x328ba1;if(_0x508243[_0x0d77('0x31')][_0x0d77('0x43')]){_0x3064d8[_0x0d77('0x44')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x0d77('0x45')](_0x3064d8);})['then'](function(_0x2bccfd){_0x28e344[_0x0d77('0x46')]=_0x2bccfd;return _0x28e344;})[_0x0d77('0x24')](respondWithFilteredResult(_0x169ef3,_0x3064d8))[_0x0d77('0x47')](handleError(_0x169ef3,null));};exports[_0x0d77('0x48')]=function(_0x4b8992,_0x17788b){var _0x4550b4={'raw':![],'where':{'id':_0x4b8992[_0x0d77('0x49')]['id']}},_0xa62f2={};_0xa62f2[_0x0d77('0x2f')]=_[_0x0d77('0x4a')](db[_0x0d77('0x41')]['rawAttributes']);_0xa62f2[_0x0d77('0x31')]=_[_0x0d77('0x4a')](_0x4b8992[_0x0d77('0x31')]);_0xa62f2['filters']=_['intersection'](_0xa62f2[_0x0d77('0x2f')],_0xa62f2[_0x0d77('0x31')]);_0x4550b4['attributes']=_[_0x0d77('0x34')](_0xa62f2['model'],qs[_0x0d77('0x35')](_0x4b8992[_0x0d77('0x31')][_0x0d77('0x35')]));_0x4550b4[_0x0d77('0x33')]=_0x4550b4['attributes'][_0x0d77('0x36')]?_0x4550b4[_0x0d77('0x33')]:_0xa62f2[_0x0d77('0x2f')];if(_0x4b8992[_0x0d77('0x31')][_0x0d77('0x43')]){_0x4550b4['include']=[{'all':!![]}];}_0x4550b4=_[_0x0d77('0x3e')]({},_0x4550b4,_0x4b8992['options']);return db[_0x0d77('0x41')][_0x0d77('0x4b')](_0x4550b4)[_0x0d77('0x24')](handleEntityNotFound(_0x17788b,null))[_0x0d77('0x24')](respondWithResult(_0x17788b,null))['catch'](handleError(_0x17788b,null));};exports[_0x0d77('0x4c')]=function(_0x2824f4,_0x31242c){return db['ServicenowAccount'][_0x0d77('0x4c')](_0x2824f4[_0x0d77('0x4d')],{})[_0x0d77('0x24')](respondWithResult(_0x31242c,0xc9))[_0x0d77('0x47')](handleError(_0x31242c,null));};exports[_0x0d77('0x23')]=function(_0x3a7974,_0x1a3da6){if(_0x3a7974['body']['id']){delete _0x3a7974[_0x0d77('0x4d')]['id'];}return db[_0x0d77('0x41')]['find']({'where':{'id':_0x3a7974[_0x0d77('0x49')]['id']}})[_0x0d77('0x24')](handleEntityNotFound(_0x1a3da6,null))[_0x0d77('0x24')](saveUpdates(_0x3a7974['body'],null))[_0x0d77('0x24')](respondWithResult(_0x1a3da6,null))[_0x0d77('0x47')](handleError(_0x1a3da6,null));};exports[_0x0d77('0x25')]=function(_0x162e46,_0x2c8cc7){return db['ServicenowAccount']['find']({'where':{'id':_0x162e46['params']['id']}})['then'](handleEntityNotFound(_0x2c8cc7,null))[_0x0d77('0x24')](removeEntity(_0x2c8cc7,null))[_0x0d77('0x47')](handleError(_0x2c8cc7,null));};exports[_0x0d77('0x4e')]=function(_0x1d23e8,_0x39bf77,_0x5b1627){var _0x14f89a={};var _0x1e0491={};var _0x17ded8;var _0x2fe331;return db[_0x0d77('0x41')][_0x0d77('0x4f')]({'where':{'id':_0x1d23e8[_0x0d77('0x49')]['id']}})[_0x0d77('0x24')](handleEntityNotFound(_0x39bf77,null))[_0x0d77('0x24')](function(_0x4d05a5){if(_0x4d05a5){_0x17ded8=_0x4d05a5;_0x1e0491[_0x0d77('0x2f')]=_[_0x0d77('0x4a')](db[_0x0d77('0x50')][_0x0d77('0x2b')]);_0x1e0491['query']=_['keys'](_0x1d23e8['query']);_0x1e0491[_0x0d77('0x32')]=_[_0x0d77('0x34')](_0x1e0491[_0x0d77('0x2f')],_0x1e0491[_0x0d77('0x31')]);_0x14f89a[_0x0d77('0x33')]=_[_0x0d77('0x34')](_0x1e0491['model'],qs[_0x0d77('0x35')](_0x1d23e8[_0x0d77('0x31')][_0x0d77('0x35')]));_0x14f89a[_0x0d77('0x33')]=_0x14f89a[_0x0d77('0x33')][_0x0d77('0x36')]?_0x14f89a['attributes']:_0x1e0491['model'];_0x14f89a[_0x0d77('0x3a')]=qs[_0x0d77('0x3b')](_0x1d23e8[_0x0d77('0x31')][_0x0d77('0x3b')]);_0x14f89a['where']=qs[_0x0d77('0x32')](_['pick'](_0x1d23e8['query'],_0x1e0491[_0x0d77('0x32')]));if(_0x1d23e8[_0x0d77('0x31')][_0x0d77('0x3d')]){_0x14f89a[_0x0d77('0x3c')]=_[_0x0d77('0x3e')](_0x14f89a[_0x0d77('0x3c')],{'$or':_[_0x0d77('0x30')](_0x14f89a[_0x0d77('0x33')],function(_0x7619d){var _0x4ca8d1={};_0x4ca8d1[_0x7619d]={'$like':'%'+_0x1d23e8[_0x0d77('0x31')]['filter']+'%'};return _0x4ca8d1;})});}_0x14f89a=_['merge']({},_0x14f89a,_0x1d23e8['options']);return _0x17ded8[_0x0d77('0x4e')](_0x14f89a);}})[_0x0d77('0x24')](function(_0x42ea31){if(_0x42ea31){_0x2fe331=_0x42ea31['length'];if(!_0x1d23e8[_0x0d77('0x31')]['hasOwnProperty'](_0x0d77('0x38'))){_0x14f89a['limit']=qs[_0x0d77('0x39')](_0x1d23e8[_0x0d77('0x31')][_0x0d77('0x39')]);_0x14f89a[_0x0d77('0x1d')]=qs[_0x0d77('0x1d')](_0x1d23e8[_0x0d77('0x31')][_0x0d77('0x1d')]);}return _0x17ded8[_0x0d77('0x4e')](_0x14f89a);}})['then'](function(_0x4e0c77){if(_0x4e0c77){return _0x4e0c77?{'count':_0x2fe331,'rows':_0x4e0c77}:null;}})[_0x0d77('0x24')](respondWithResult(_0x39bf77,null))[_0x0d77('0x47')](handleError(_0x39bf77,null));};exports[_0x0d77('0x51')]=function(_0x1aed1c,_0x1544d9,_0x30d12a){if(_0x1aed1c[_0x0d77('0x4d')]['id']){delete _0x1aed1c[_0x0d77('0x4d')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x1aed1c['params']['id']}})[_0x0d77('0x24')](handleEntityNotFound(_0x1544d9,null))['then'](function(_0x5be757){if(_0x5be757){_0x1aed1c[_0x0d77('0x4d')][_0x0d77('0x52')]=_0x5be757['id'];_0x1aed1c[_0x0d77('0x4d')]['Subjects']=integrations[_0x0d77('0x53')](_0x1aed1c[_0x0d77('0x4d')]['channel'],_0x1aed1c[_0x0d77('0x4d')][_0x0d77('0x2d')]);_0x1aed1c[_0x0d77('0x4d')][_0x0d77('0x54')]=integrations[_0x0d77('0x55')](_0x1aed1c[_0x0d77('0x4d')][_0x0d77('0x56')],_0x1aed1c[_0x0d77('0x4d')]['type']);return db[_0x0d77('0x50')][_0x0d77('0x4c')](_0x1aed1c['body'],{'include':[{'model':db[_0x0d77('0x57')],'as':_0x0d77('0x58')},{'model':db[_0x0d77('0x57')],'as':_0x0d77('0x54')}]});}return null;})[_0x0d77('0x24')](respondWithResult(_0x1544d9,null))[_0x0d77('0x47')](handleError(_0x1544d9,null));};exports[_0x0d77('0x59')]=function(_0x42c1bd,_0xb0170e,_0x266b9f){var _0x42a019=[_0x0d77('0x5a'),_0x0d77('0x5b'),_0x0d77('0x5c'),_0x0d77('0x5d'),_0x0d77('0x5e'),_0x0d77('0x5f'),_0x0d77('0x60'),'severity',_0x0d77('0x61')];var _0x27bf8a=[_0x0d77('0x62'),_0x0d77('0x5a'),_0x0d77('0x63'),_0x0d77('0x64'),_0x0d77('0x65'),'sys_updated_on',_0x0d77('0x66'),'hold_reason','approval_history','number',_0x0d77('0x67'),'sys_updated_by',_0x0d77('0x68'),_0x0d77('0x69'),_0x0d77('0x6a'),_0x0d77('0x6b'),'state',_0x0d77('0x6c'),_0x0d77('0x5c'),_0x0d77('0x3a'),'calendar_stc','closed_at',_0x0d77('0x6d'),'delivery_plan',_0x0d77('0x6e'),'active',_0x0d77('0x6f'),'business_service',_0x0d77('0x70'),_0x0d77('0x71'),_0x0d77('0x72'),_0x0d77('0x73'),_0x0d77('0x74'),_0x0d77('0x75'),'business_duration',_0x0d77('0x76'),_0x0d77('0x77'),_0x0d77('0x78'),_0x0d77('0x79'),_0x0d77('0x7a'),'approval_set',_0x0d77('0x5d'),_0x0d77('0x7b'),_0x0d77('0x7c'),_0x0d77('0x5e'),_0x0d77('0x7d'),'delivery_task','work_start','assignment_group',_0x0d77('0x7e'),_0x0d77('0x7f'),'description','calendar_duration',_0x0d77('0x5f'),_0x0d77('0x80'),'close_notes','closed_by',_0x0d77('0x81'),_0x0d77('0x82'),_0x0d77('0x83'),_0x0d77('0x84'),_0x0d77('0x85'),'incident_state','urgency','problem_id',_0x0d77('0x86'),_0x0d77('0x87'),_0x0d77('0x88'),_0x0d77('0x89'),'severity',_0x0d77('0x8a'),_0x0d77('0x8b'),_0x0d77('0x8c'),'comments_and_work_notes','due_date',_0x0d77('0x8d'),_0x0d77('0x8e'),_0x0d77('0x8f'),_0x0d77('0x90'),_0x0d77('0x91'),_0x0d77('0x92'),'location',_0x0d77('0x61')];var _0x24b93a='';var _0x32e345='';var _0x26014b=[];var _0x166607='';var _0x5c4f9c='';var _0x2df1c3=[];var _0x407d45='';var _0x37f037='';var _0x58b66e={};var _0x231230='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x42c1bd[_0x0d77('0x49')]['id']},'attributes':['id',_0x0d77('0x93'),_0x0d77('0x94'),_0x0d77('0x95'),'remoteUri','serverUrl']})[_0x0d77('0x24')](handleEntityNotFound(_0xb0170e,null))['then'](function(_0x455e17){if(_0x455e17){_0x231230=_0x455e17[_0x0d77('0x96')];var _0x3b4d82=_0x231230[_0x0d77('0x97')](-0x1);if(_0x3b4d82==='/'){_0x231230=_0x231230[_0x0d77('0x98')](0x0,_0x231230['lastIndexOf'](_0x3b4d82));}_0x37f037=util['format'](_0x0d77('0x99'),_0x231230);_0x407d45=util[_0x0d77('0x9a')]('%s/api/now/table/',_0x231230);_0x58b66e={'user':_0x455e17[_0x0d77('0x93')],'pass':_0x455e17[_0x0d77('0x94')]};var _0x23726b={'method':'GET','uri':_0x37f037+_0x0d77('0x9b'),'auth':_0x58b66e,'json':!![]};return rp(_0x23726b);}})['then'](function(_0x1a3d68){if(_0x1a3d68['result'][_0x0d77('0x36')]>0x0){_0x24b93a=_0x1a3d68['result'];}console[_0x0d77('0x9c')](_0x0d77('0x9d'),_0x24b93a);_0x2df1c3=[];_0x32e345=Object[_0x0d77('0x9e')]([],_0x24b93a);_[_0x0d77('0x9f')](_0x32e345,function(_0x6382d7){return!_0x42a019[_0x0d77('0xa0')](_0x6382d7[_0x0d77('0x28')]);});_0x32e345[_0x0d77('0xa1')](function(_0x426c15){var _0x28648b=createFieldObject(_0x407d45,_0x58b66e,_0x426c15[_0x0d77('0xa2')],_0x426c15[_0x0d77('0x28')],_0x426c15[_0x0d77('0xa3')],![]);_0x2df1c3[_0x0d77('0xa4')](_0x28648b);});return Promise['all'](_0x2df1c3);})['then'](function(_0x434ccf){_0x26014b=_0x434ccf;_0x166607=Object[_0x0d77('0x9e')]([],_0x24b93a);console['log'](_0x0d77('0xa5'),_0x24b93a);_[_0x0d77('0x9f')](_0x166607,function(_0x164891){return _0x27bf8a[_0x0d77('0xa0')](_0x164891[_0x0d77('0x28')]);});console[_0x0d77('0x9c')](_0x0d77('0xa6'),_0x166607);_0x2df1c3=[];_0x166607[_0x0d77('0xa1')](function(_0x300972){var _0x254066=createFieldObject(_0x407d45,_0x58b66e,_0x300972[_0x0d77('0xa2')],_0x300972[_0x0d77('0x28')],_0x300972[_0x0d77('0xa3')],!![]);_0x2df1c3[_0x0d77('0xa4')](_0x254066);});return Promise[_0x0d77('0xa7')](_0x2df1c3);})[_0x0d77('0x24')](function(_0x1ecfbd){_0x5c4f9c=_0x1ecfbd;var _0x1d95e2=_0x26014b[_0x0d77('0xa8')](_0x5c4f9c);return{'count':_0x1d95e2[_0x0d77('0x36')],'rows':_0x1d95e2};})[_0x0d77('0x24')](respondWithResult(_0xb0170e,null))[_0x0d77('0x47')](function(_0x198911){console[_0x0d77('0x9c')]('ServiceNow\x20error:\x20'+_0x198911);var _0x3b84b9=_0x42c1bd[_0x0d77('0x31')][_0x0d77('0xa9')]?0x1f4:_0x198911[_0x0d77('0xaa')]||0x1f4;logger[_0x0d77('0x26')](_0x198911[_0x0d77('0x27')]);delete _0x198911[_0x0d77('0x28')];if(_0x3b84b9===0x191){_0x3b84b9=0x190;}_0xb0170e[_0x0d77('0x1a')](_0x3b84b9)[_0x0d77('0x29')](_0x42c1bd[_0x0d77('0x31')]['test']?{'message':_0x0d77('0xab'),'statusCode':_0x198911['statusCode']}:_0x198911);});};function createFieldObject(_0x56cce8,_0x492f1c,_0x20a737,_0x501f7d,_0x2f7c65,_0x75e0f){return new Promise(function(_0x425bec,_0xeef7cc){var _0x183e6f={'id':_0x501f7d,'name':_0x2f7c65,'custom':_0x75e0f};if(_0x20a737===_0x0d77('0xac')){_0x183e6f['options']=[{'name':'True','value':_0x0d77('0xad')},{'name':_0x0d77('0xae'),'value':_0x0d77('0xaf')}];_0x425bec(_0x183e6f);}else{var _0x5788b4={'method':_0x0d77('0xb0'),'uri':_0x56cce8+_0x0d77('0xb1')+_0x501f7d,'auth':_0x492f1c,'json':!![]};return rp(_0x5788b4)['then'](function(_0x1ad5a5){var _0x12eb35=[];if(_0x1ad5a5[_0x0d77('0xb2')][_0x0d77('0x36')]>0x0){_0x1ad5a5[_0x0d77('0xb2')]['forEach'](function(_0x253b15){if(_0x253b15['inactive']===_0x0d77('0xaf')){var _0x21a0d8={'name':_0x253b15['label'],'value':_0x253b15[_0x0d77('0xb3')]};_0x12eb35['push'](_0x21a0d8);}});}_0x183e6f['options']=_0x12eb35;if(_0x183e6f[_0x0d77('0x40')][_0x0d77('0x36')]>0x0){_0x425bec(_0x183e6f);}else{if(_0x75e0f==![]){_0x425bec();}else{_0x425bec(_0x183e6f);}}});}});} \ No newline at end of file +var _0x47ae=['Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','hold_reason','knowledge','subcategory','close_code','incident_state','category','parent','made_sla','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','sys_id','reopened_by','urgency','company','reassignment_count','assigned_to','severity','comments','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','password','serverUrl','remoteUri','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','all','log','TCL:\x20_object','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','save','then','destroy','error','stack','name','send','map','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ServicenowAccount','includeAll','include','findAll','show','params','rawAttributes','length','options','find','create','body','catch','update','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x47ae,0x11f));var _0xe47a=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0x47ae[_0x510c60];return _0x49c4aa;};'use strict';var emlformat=require(_0xe47a('0x0'));var rimraf=require(_0xe47a('0x1'));var zipdir=require(_0xe47a('0x2'));var jsonpatch=require(_0xe47a('0x3'));var rp=require(_0xe47a('0x4'));var moment=require('moment');var BPromise=require(_0xe47a('0x5'));var Mustache=require('mustache');var util=require(_0xe47a('0x6'));var path=require(_0xe47a('0x7'));var sox=require('sox');var csv=require(_0xe47a('0x8'));var ejs=require(_0xe47a('0x9'));var fs=require('fs');var fs_extra=require(_0xe47a('0xa'));var _=require(_0xe47a('0xb'));var squel=require(_0xe47a('0xc'));var crypto=require(_0xe47a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe47a('0xe'));var toCsv=require(_0xe47a('0x8'));var querystring=require('querystring');var Papa=require(_0xe47a('0xf'));var Redis=require(_0xe47a('0x10'));var authService=require(_0xe47a('0x11'));var qs=require(_0xe47a('0x12'));var as=require(_0xe47a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe47a('0x14'));var utils=require('../../config/utils');var config=require(_0xe47a('0x15'));var licenseUtil=require(_0xe47a('0x16'));var db=require(_0xe47a('0x17'))['db'];var integrations=require(_0xe47a('0x18'));function respondWithStatusCode(_0x3cdbbc,_0x2bb831){_0x2bb831=_0x2bb831||0xcc;return function(_0x79a932){if(_0x79a932){return _0x3cdbbc[_0xe47a('0x19')](_0x2bb831);}return _0x3cdbbc['status'](_0x2bb831)[_0xe47a('0x1a')]();};}function respondWithResult(_0x1d6858,_0x570ba3){_0x570ba3=_0x570ba3||0xc8;return function(_0x119103){if(_0x119103){return _0x1d6858[_0xe47a('0x1b')](_0x570ba3)[_0xe47a('0x1c')](_0x119103);}};}function respondWithFilteredResult(_0x13c6ca,_0x38bf8e){return function(_0x1003d5){if(_0x1003d5){var _0x5d67ae=typeof _0x38bf8e['offset']===_0xe47a('0x1d')&&typeof _0x38bf8e[_0xe47a('0x1e')]===_0xe47a('0x1d');var _0x32a91d=_0x1003d5[_0xe47a('0x1f')];var _0x364452=_0x5d67ae?0x0:_0x38bf8e[_0xe47a('0x20')];var _0x2df864=_0x5d67ae?_0x1003d5[_0xe47a('0x1f')]:_0x38bf8e[_0xe47a('0x20')]+_0x38bf8e[_0xe47a('0x1e')];var _0x4a1d18;if(_0x2df864>=_0x32a91d){_0x2df864=_0x32a91d;_0x4a1d18=0xc8;}else{_0x4a1d18=0xce;}_0x13c6ca[_0xe47a('0x1b')](_0x4a1d18);return _0x13c6ca['set']('Content-Range',_0x364452+'-'+_0x2df864+'/'+_0x32a91d)[_0xe47a('0x1c')](_0x1003d5);}return null;};}function patchUpdates(_0x5e6ab4){return function(_0x5ccc0f){try{jsonpatch[_0xe47a('0x21')](_0x5ccc0f,_0x5e6ab4,!![]);}catch(_0x23516e){return BPromise[_0xe47a('0x22')](_0x23516e);}return _0x5ccc0f[_0xe47a('0x23')]();};}function saveUpdates(_0x4f9d7c,_0x4f009c){return function(_0x5badd2){if(_0x5badd2){return _0x5badd2['update'](_0x4f9d7c)[_0xe47a('0x24')](function(_0x2940a4){return _0x2940a4;});}return null;};}function removeEntity(_0x4e5ce3,_0x109c5f){return function(_0x56eaad){if(_0x56eaad){return _0x56eaad[_0xe47a('0x25')]()['then'](function(){_0x4e5ce3[_0xe47a('0x1b')](0xcc)[_0xe47a('0x1a')]();});}};}function handleEntityNotFound(_0x14efc2,_0x12d5e1){return function(_0x24b50b){if(!_0x24b50b){_0x14efc2['sendStatus'](0x194);}return _0x24b50b;};}function handleError(_0x1877f4,_0x59257e){_0x59257e=_0x59257e||0x1f4;return function(_0x2350d8){logger[_0xe47a('0x26')](_0x2350d8[_0xe47a('0x27')]);if(_0x2350d8[_0xe47a('0x28')]){delete _0x2350d8[_0xe47a('0x28')];}_0x1877f4[_0xe47a('0x1b')](_0x59257e)[_0xe47a('0x29')](_0x2350d8);};}exports['index']=function(_0x1d7be8,_0x17fa85){var _0x6b0c13={},_0x444f5c={},_0xa70ca8={'count':0x0,'rows':[]};var _0xc18430=_[_0xe47a('0x2a')](db['ServicenowAccount']['rawAttributes'],function(_0x244977){return{'name':_0x244977[_0xe47a('0x2b')],'type':_0x244977[_0xe47a('0x2c')][_0xe47a('0x2d')]};});_0x444f5c['model']=_[_0xe47a('0x2a')](_0xc18430,_0xe47a('0x28'));_0x444f5c['query']=_[_0xe47a('0x2e')](_0x1d7be8[_0xe47a('0x2f')]);_0x444f5c[_0xe47a('0x30')]=_[_0xe47a('0x31')](_0x444f5c[_0xe47a('0x32')],_0x444f5c[_0xe47a('0x2f')]);_0x6b0c13[_0xe47a('0x33')]=_[_0xe47a('0x31')](_0x444f5c['model'],qs['fields'](_0x1d7be8[_0xe47a('0x2f')][_0xe47a('0x34')]));_0x6b0c13[_0xe47a('0x33')]=_0x6b0c13[_0xe47a('0x33')]['length']?_0x6b0c13[_0xe47a('0x33')]:_0x444f5c[_0xe47a('0x32')];if(!_0x1d7be8['query'][_0xe47a('0x35')](_0xe47a('0x36'))){_0x6b0c13[_0xe47a('0x1e')]=qs[_0xe47a('0x1e')](_0x1d7be8[_0xe47a('0x2f')][_0xe47a('0x1e')]);_0x6b0c13[_0xe47a('0x20')]=qs['offset'](_0x1d7be8[_0xe47a('0x2f')][_0xe47a('0x20')]);}_0x6b0c13[_0xe47a('0x37')]=qs['sort'](_0x1d7be8[_0xe47a('0x2f')][_0xe47a('0x38')]);_0x6b0c13[_0xe47a('0x39')]=qs['filters'](_[_0xe47a('0x3a')](_0x1d7be8[_0xe47a('0x2f')],_0x444f5c[_0xe47a('0x30')]),_0xc18430);if(_0x1d7be8[_0xe47a('0x2f')][_0xe47a('0x3b')]){_0x6b0c13['where']=_[_0xe47a('0x3c')](_0x6b0c13[_0xe47a('0x39')],{'$or':_['map'](_0xc18430,function(_0x205f6c){if(_0x205f6c['type']!==_0xe47a('0x3d')){var _0x5300e8={};_0x5300e8[_0x205f6c[_0xe47a('0x28')]]={'$like':'%'+_0x1d7be8['query'][_0xe47a('0x3b')]+'%'};return _0x5300e8;}})});}_0x6b0c13=_[_0xe47a('0x3c')]({},_0x6b0c13,_0x1d7be8['options']);var _0x5d9546={'where':_0x6b0c13['where']};return db[_0xe47a('0x3e')][_0xe47a('0x1f')](_0x5d9546)[_0xe47a('0x24')](function(_0x455f28){_0xa70ca8[_0xe47a('0x1f')]=_0x455f28;if(_0x1d7be8[_0xe47a('0x2f')][_0xe47a('0x3f')]){_0x6b0c13[_0xe47a('0x40')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xe47a('0x41')](_0x6b0c13);})[_0xe47a('0x24')](function(_0x5e522c){_0xa70ca8['rows']=_0x5e522c;return _0xa70ca8;})[_0xe47a('0x24')](respondWithFilteredResult(_0x17fa85,_0x6b0c13))['catch'](handleError(_0x17fa85,null));};exports[_0xe47a('0x42')]=function(_0x511c7a,_0x74899e){var _0x1de1e2={'raw':![],'where':{'id':_0x511c7a[_0xe47a('0x43')]['id']}},_0x37a826={};_0x37a826['model']=_['keys'](db[_0xe47a('0x3e')][_0xe47a('0x44')]);_0x37a826[_0xe47a('0x2f')]=_['keys'](_0x511c7a['query']);_0x37a826[_0xe47a('0x30')]=_[_0xe47a('0x31')](_0x37a826[_0xe47a('0x32')],_0x37a826[_0xe47a('0x2f')]);_0x1de1e2['attributes']=_[_0xe47a('0x31')](_0x37a826['model'],qs[_0xe47a('0x34')](_0x511c7a['query']['fields']));_0x1de1e2['attributes']=_0x1de1e2[_0xe47a('0x33')][_0xe47a('0x45')]?_0x1de1e2[_0xe47a('0x33')]:_0x37a826[_0xe47a('0x32')];if(_0x511c7a[_0xe47a('0x2f')]['includeAll']){_0x1de1e2[_0xe47a('0x40')]=[{'all':!![]}];}_0x1de1e2=_[_0xe47a('0x3c')]({},_0x1de1e2,_0x511c7a[_0xe47a('0x46')]);return db['ServicenowAccount'][_0xe47a('0x47')](_0x1de1e2)['then'](handleEntityNotFound(_0x74899e,null))['then'](respondWithResult(_0x74899e,null))['catch'](handleError(_0x74899e,null));};exports['create']=function(_0x35ae1b,_0xcd1859){return db['ServicenowAccount'][_0xe47a('0x48')](_0x35ae1b[_0xe47a('0x49')],{})[_0xe47a('0x24')](respondWithResult(_0xcd1859,0xc9))[_0xe47a('0x4a')](handleError(_0xcd1859,null));};exports[_0xe47a('0x4b')]=function(_0x217411,_0x315c5a){if(_0x217411['body']['id']){delete _0x217411[_0xe47a('0x49')]['id'];}return db['ServicenowAccount'][_0xe47a('0x47')]({'where':{'id':_0x217411['params']['id']}})[_0xe47a('0x24')](handleEntityNotFound(_0x315c5a,null))[_0xe47a('0x24')](saveUpdates(_0x217411['body'],null))[_0xe47a('0x24')](respondWithResult(_0x315c5a,null))['catch'](handleError(_0x315c5a,null));};exports[_0xe47a('0x25')]=function(_0x2fcf41,_0x546ca8){return db['ServicenowAccount'][_0xe47a('0x47')]({'where':{'id':_0x2fcf41['params']['id']}})[_0xe47a('0x24')](handleEntityNotFound(_0x546ca8,null))['then'](removeEntity(_0x546ca8,null))[_0xe47a('0x4a')](handleError(_0x546ca8,null));};exports[_0xe47a('0x4c')]=function(_0x770875,_0x221568,_0x2e4b9f){var _0x3d4a14={};var _0x5f55f2={};var _0x47eb93;var _0x57fe81;return db[_0xe47a('0x3e')][_0xe47a('0x4d')]({'where':{'id':_0x770875[_0xe47a('0x43')]['id']}})['then'](handleEntityNotFound(_0x221568,null))[_0xe47a('0x24')](function(_0x2d98ea){if(_0x2d98ea){_0x47eb93=_0x2d98ea;_0x5f55f2[_0xe47a('0x32')]=_[_0xe47a('0x2e')](db[_0xe47a('0x4e')][_0xe47a('0x44')]);_0x5f55f2['query']=_[_0xe47a('0x2e')](_0x770875[_0xe47a('0x2f')]);_0x5f55f2[_0xe47a('0x30')]=_['intersection'](_0x5f55f2[_0xe47a('0x32')],_0x5f55f2['query']);_0x3d4a14['attributes']=_[_0xe47a('0x31')](_0x5f55f2[_0xe47a('0x32')],qs[_0xe47a('0x34')](_0x770875[_0xe47a('0x2f')][_0xe47a('0x34')]));_0x3d4a14[_0xe47a('0x33')]=_0x3d4a14[_0xe47a('0x33')][_0xe47a('0x45')]?_0x3d4a14[_0xe47a('0x33')]:_0x5f55f2[_0xe47a('0x32')];_0x3d4a14[_0xe47a('0x37')]=qs[_0xe47a('0x38')](_0x770875['query'][_0xe47a('0x38')]);_0x3d4a14[_0xe47a('0x39')]=qs[_0xe47a('0x30')](_['pick'](_0x770875[_0xe47a('0x2f')],_0x5f55f2[_0xe47a('0x30')]));if(_0x770875['query']['filter']){_0x3d4a14[_0xe47a('0x39')]=_['merge'](_0x3d4a14['where'],{'$or':_['map'](_0x3d4a14[_0xe47a('0x33')],function(_0x4f6b38){var _0x19655c={};_0x19655c[_0x4f6b38]={'$like':'%'+_0x770875[_0xe47a('0x2f')][_0xe47a('0x3b')]+'%'};return _0x19655c;})});}_0x3d4a14=_[_0xe47a('0x3c')]({},_0x3d4a14,_0x770875[_0xe47a('0x46')]);return _0x47eb93['getConfigurations'](_0x3d4a14);}})[_0xe47a('0x24')](function(_0x33fb38){if(_0x33fb38){_0x57fe81=_0x33fb38[_0xe47a('0x45')];if(!_0x770875[_0xe47a('0x2f')][_0xe47a('0x35')]('nolimit')){_0x3d4a14[_0xe47a('0x1e')]=qs[_0xe47a('0x1e')](_0x770875['query'][_0xe47a('0x1e')]);_0x3d4a14[_0xe47a('0x20')]=qs[_0xe47a('0x20')](_0x770875['query'][_0xe47a('0x20')]);}return _0x47eb93['getConfigurations'](_0x3d4a14);}})[_0xe47a('0x24')](function(_0x48fa30){if(_0x48fa30){return _0x48fa30?{'count':_0x57fe81,'rows':_0x48fa30}:null;}})[_0xe47a('0x24')](respondWithResult(_0x221568,null))[_0xe47a('0x4a')](handleError(_0x221568,null));};exports[_0xe47a('0x4f')]=function(_0x1c4307,_0x1533c4,_0x593826){if(_0x1c4307['body']['id']){delete _0x1c4307[_0xe47a('0x49')]['id'];}return db[_0xe47a('0x3e')][_0xe47a('0x4d')]({'where':{'id':_0x1c4307['params']['id']}})[_0xe47a('0x24')](handleEntityNotFound(_0x1533c4,null))[_0xe47a('0x24')](function(_0x11ff96){if(_0x11ff96){_0x1c4307[_0xe47a('0x49')][_0xe47a('0x50')]=_0x11ff96['id'];_0x1c4307[_0xe47a('0x49')][_0xe47a('0x51')]=integrations[_0xe47a('0x52')](_0x1c4307[_0xe47a('0x49')][_0xe47a('0x53')],_0x1c4307['body'][_0xe47a('0x2c')]);_0x1c4307[_0xe47a('0x49')][_0xe47a('0x54')]=integrations[_0xe47a('0x55')](_0x1c4307['body'][_0xe47a('0x53')],_0x1c4307['body'][_0xe47a('0x2c')]);return db['ServicenowConfiguration']['create'](_0x1c4307[_0xe47a('0x49')],{'include':[{'model':db['ServicenowField'],'as':_0xe47a('0x51')},{'model':db['ServicenowField'],'as':_0xe47a('0x54')}]});}return null;})[_0xe47a('0x24')](respondWithResult(_0x1533c4,null))[_0xe47a('0x4a')](handleError(_0x1533c4,null));};exports[_0xe47a('0x56')]=function(_0x4e8015,_0x541fb6,_0x3e2e9b){var _0x5c6756=['made_sla',_0xe47a('0x57'),_0xe47a('0x58'),_0xe47a('0x59'),_0xe47a('0x5a'),'notify',_0xe47a('0x5b'),'severity',_0xe47a('0x5c')];var _0x3ad1e0=[_0xe47a('0x5d'),_0xe47a('0x5e'),_0xe47a('0x5f'),_0xe47a('0x60'),'upon_reject',_0xe47a('0x61'),_0xe47a('0x62'),_0xe47a('0x57'),_0xe47a('0x63'),_0xe47a('0x64'),_0xe47a('0x65'),_0xe47a('0x66'),_0xe47a('0x67'),_0xe47a('0x68'),_0xe47a('0x69'),'sys_domain',_0xe47a('0x6a'),_0xe47a('0x6b'),_0xe47a('0x58'),_0xe47a('0x37'),_0xe47a('0x6c'),_0xe47a('0x6d'),'cmdb_ci',_0xe47a('0x6e'),_0xe47a('0x6f'),_0xe47a('0x70'),_0xe47a('0x71'),_0xe47a('0x72'),_0xe47a('0x73'),'sys_domain_path',_0xe47a('0x74'),_0xe47a('0x75'),'expected_start','opened_at',_0xe47a('0x76'),_0xe47a('0x77'),_0xe47a('0x78'),_0xe47a('0x79'),_0xe47a('0x7a'),_0xe47a('0x7b'),_0xe47a('0x7c'),'subcategory',_0xe47a('0x7d'),_0xe47a('0x7e'),_0xe47a('0x5a'),_0xe47a('0x7f'),'delivery_task',_0xe47a('0x80'),_0xe47a('0x81'),_0xe47a('0x82'),_0xe47a('0x83'),_0xe47a('0x84'),_0xe47a('0x85'),'notify',_0xe47a('0x86'),'close_notes',_0xe47a('0x87'),_0xe47a('0x88'),'parent_incident',_0xe47a('0x89'),'contact_type',_0xe47a('0x8a'),_0xe47a('0x5b'),_0xe47a('0x8b'),'problem_id',_0xe47a('0x8c'),_0xe47a('0x8d'),'activity_due',_0xe47a('0x8e'),_0xe47a('0x8f'),_0xe47a('0x90'),'sla_due','approval',_0xe47a('0x91'),'due_date',_0xe47a('0x92'),_0xe47a('0x93'),_0xe47a('0x94'),'escalation',_0xe47a('0x95'),_0xe47a('0x96'),_0xe47a('0x97'),_0xe47a('0x5c')];var _0x167118='';var _0x2335fa='';var _0x4f85b3=[];var _0x5aba73='';var _0x5eedce='';var _0x5121ac=[];var _0x591ebf='';var _0x17a171='';var _0x223eb8={};var _0x5adb14='';return db[_0xe47a('0x3e')][_0xe47a('0x4d')]({'where':{'id':_0x4e8015[_0xe47a('0x43')]['id']},'attributes':['id',_0xe47a('0x98'),_0xe47a('0x99'),'email','remoteUri',_0xe47a('0x9a')]})[_0xe47a('0x24')](handleEntityNotFound(_0x541fb6,null))[_0xe47a('0x24')](function(_0x7a10cc){if(_0x7a10cc){_0x5adb14=_0x7a10cc[_0xe47a('0x9b')];var _0x265910=_0x5adb14[_0xe47a('0x9c')](-0x1);if(_0x265910==='/'){_0x5adb14=_0x5adb14['substring'](0x0,_0x5adb14['lastIndexOf'](_0x265910));}_0x17a171=util[_0xe47a('0x9d')](_0xe47a('0x9e'),_0x5adb14);_0x591ebf=util[_0xe47a('0x9d')](_0xe47a('0x9f'),_0x5adb14);_0x223eb8={'user':_0x7a10cc[_0xe47a('0x98')],'pass':_0x7a10cc[_0xe47a('0x99')]};var _0x11b35f={'method':_0xe47a('0xa0'),'uri':_0x17a171+_0xe47a('0xa1'),'auth':_0x223eb8,'json':!![]};return rp(_0x11b35f);}})['then'](function(_0x10da82){if(_0x10da82[_0xe47a('0xa2')]['length']>0x0){_0x167118=_0x10da82[_0xe47a('0xa2')];}console['log'](_0xe47a('0xa3'),_0x167118);_0x5121ac=[];_0x2335fa=Object['assign']([],_0x167118);_[_0xe47a('0xa4')](_0x2335fa,function(_0x3b4d37){return!_0x5c6756[_0xe47a('0xa5')](_0x3b4d37[_0xe47a('0x28')]);});_0x2335fa[_0xe47a('0xa6')](function(_0x5db042){var _0x5f7fde=createFieldObject(_0x591ebf,_0x223eb8,_0x5db042[_0xe47a('0xa7')],_0x5db042['name'],_0x5db042[_0xe47a('0xa8')],![]);_0x5121ac[_0xe47a('0xa9')](_0x5f7fde);});return Promise[_0xe47a('0xaa')](_0x5121ac);})[_0xe47a('0x24')](function(_0x53439d){_0x4f85b3=_0x53439d;_0x5aba73=Object['assign']([],_0x167118);console[_0xe47a('0xab')](_0xe47a('0xac'),_0x167118);_[_0xe47a('0xa4')](_0x5aba73,function(_0x2a0a3a){return _0x3ad1e0[_0xe47a('0xa5')](_0x2a0a3a['name']);});console[_0xe47a('0xab')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x5aba73);_0x5121ac=[];_0x5aba73[_0xe47a('0xa6')](function(_0x5a3cc4){var _0x3a76c3=createFieldObject(_0x591ebf,_0x223eb8,_0x5a3cc4[_0xe47a('0xa7')],_0x5a3cc4['name'],_0x5a3cc4[_0xe47a('0xa8')],!![]);_0x5121ac[_0xe47a('0xa9')](_0x3a76c3);});return Promise[_0xe47a('0xaa')](_0x5121ac);})['then'](function(_0x4fc5df){_0x5eedce=_0x4fc5df;var _0x27b397=_0x4f85b3['concat'](_0x5eedce);return{'count':_0x27b397['length'],'rows':_0x27b397};})[_0xe47a('0x24')](respondWithResult(_0x541fb6,null))['catch'](function(_0x27ca9d){console['log'](_0xe47a('0xad')+_0x27ca9d);var _0x5953fc=_0x4e8015['query'][_0xe47a('0xae')]?0x1f4:_0x27ca9d[_0xe47a('0xaf')]||0x1f4;logger['error'](_0x27ca9d[_0xe47a('0x27')]);delete _0x27ca9d[_0xe47a('0x28')];if(_0x5953fc===0x191){_0x5953fc=0x190;}_0x541fb6['status'](_0x5953fc)[_0xe47a('0x29')](_0x4e8015[_0xe47a('0x2f')][_0xe47a('0xae')]?{'message':_0xe47a('0xb0'),'statusCode':_0x27ca9d[_0xe47a('0xaf')]}:_0x27ca9d);});};function createFieldObject(_0x1dde8a,_0x2292ab,_0x43a3c1,_0x539fef,_0x23e8df,_0x300c61){return new Promise(function(_0x2bcbd1,_0x2c122d){var _0xb6de8d={'id':_0x539fef,'name':_0x23e8df,'custom':_0x300c61};if(_0x43a3c1===_0xe47a('0xb1')){_0xb6de8d[_0xe47a('0x46')]=[{'name':'True','value':_0xe47a('0xb2')},{'name':_0xe47a('0xb3'),'value':_0xe47a('0xb4')}];_0x2bcbd1(_0xb6de8d);}else{var _0x1e7831={'method':'GET','uri':_0x1dde8a+_0xe47a('0xb5')+_0x539fef,'auth':_0x2292ab,'json':!![]};return rp(_0x1e7831)[_0xe47a('0x24')](function(_0x185a4c){var _0x41b214=[];if(_0x185a4c[_0xe47a('0xa2')][_0xe47a('0x45')]>0x0){_0x185a4c[_0xe47a('0xa2')][_0xe47a('0xa6')](function(_0x207514){if(_0x207514[_0xe47a('0xb6')]===_0xe47a('0xb4')){var _0x500ea1={'name':_0x207514[_0xe47a('0xa8')],'value':_0x207514[_0xe47a('0xb7')]};_0x41b214['push'](_0x500ea1);}});}_0xb6de8d[_0xe47a('0x46')]=_0x41b214;if(_0xb6de8d[_0xe47a('0x46')][_0xe47a('0x45')]>0x0){_0x2bcbd1(_0xb6de8d);}else{if(_0x300c61==![]){_0x2bcbd1();}else{_0x2bcbd1(_0xb6de8d);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f44dc69..7d2f951 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 _0x53ec=['path','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x53ec,0x192));var _0xc53e=function(_0xafe951,_0x366ebd){_0xafe951=_0xafe951-0x0;var _0x3f287b=_0x53ec[_0xafe951];return _0x3f287b;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc53e('0x9')]=function(_0x4f989b,_0x41a9e8){return _0x4f989b[_0xc53e('0xa')]('ServicenowAccount',attributes,{'tableName':_0xc53e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x4c8e4f,_0x397749){var _0x125abf=function(_0x10ab66){while(--_0x10ab66){_0x4c8e4f['push'](_0x4c8e4f['shift']());}};_0x125abf(++_0x397749);}(_0x7217,0x19e));var _0x7721=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7217[_0x3947c9];return _0x2e7871;};'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'));var integrations=require(_0x7721('0x8'));module[_0x7721('0x9')]=function(_0xb239e0,_0xf7ff37){return _0xb239e0[_0x7721('0xa')](_0x7721('0xb'),attributes,{'tableName':_0x7721('0xc'),'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 3f5e62a..ae78547 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 _0xb0ea=['model','catch','ShowServicenowAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xb0ea,0x1a6));var _0xab0e=function(_0x388493,_0x23301e){_0x388493=_0x388493-0x0;var _0x5300a1=_0xb0ea[_0x388493];return _0x5300a1;};'use strict';var _=require(_0xab0e('0x0'));var util=require(_0xab0e('0x1'));var moment=require(_0xab0e('0x2'));var BPromise=require(_0xab0e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab0e('0x4'));var db=require(_0xab0e('0x5'))['db'];var utils=require(_0xab0e('0x6'));var logger=require(_0xab0e('0x7'))(_0xab0e('0x8'));var config=require(_0xab0e('0x9'));var jayson=require(_0xab0e('0xa'));var client=jayson[_0xab0e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3aac0,_0x3d6393,_0x2d8051){return new BPromise(function(_0x41ef6f,_0x3ae6f7){return client[_0xab0e('0xc')](_0xd3aac0,_0x2d8051)[_0xab0e('0xd')](function(_0x2b7203){logger[_0xab0e('0xe')](_0xab0e('0xf'),_0x3d6393,_0xab0e('0x10'));logger[_0xab0e('0x11')](_0xab0e('0x12'),_0x3d6393,_0xab0e('0x10'),JSON[_0xab0e('0x13')](_0x2b7203));if(_0x2b7203[_0xab0e('0x14')]){if(_0x2b7203[_0xab0e('0x14')][_0xab0e('0x15')]===0x1f4){logger[_0xab0e('0x14')](_0xab0e('0xf'),_0x3d6393,_0x2b7203[_0xab0e('0x14')]['message']);return _0x3ae6f7(_0x2b7203[_0xab0e('0x14')][_0xab0e('0x16')]);}logger['error'](_0xab0e('0xf'),_0x3d6393,_0x2b7203[_0xab0e('0x14')][_0xab0e('0x16')]);return _0x41ef6f(_0x2b7203[_0xab0e('0x14')][_0xab0e('0x16')]);}else{logger[_0xab0e('0xe')](_0xab0e('0xf'),_0x3d6393,_0xab0e('0x10'));_0x41ef6f(_0x2b7203[_0xab0e('0x17')][_0xab0e('0x16')]);}})['catch'](function(_0x24659f){logger[_0xab0e('0x14')](_0xab0e('0xf'),_0x3d6393,_0x24659f);_0x3ae6f7(_0x24659f);});});}exports[_0xab0e('0x18')]=function(_0x57183a){var _0x40ebcb=this;return new Promise(function(_0x54f29a,_0x5933ab){return db[_0xab0e('0x19')][_0xab0e('0x1a')]({'raw':_0x57183a[_0xab0e('0x1b')]?_0x57183a[_0xab0e('0x1b')][_0xab0e('0x1c')]===undefined?!![]:![]:!![],'where':_0x57183a[_0xab0e('0x1b')]?_0x57183a[_0xab0e('0x1b')][_0xab0e('0x1d')]||null:null,'attributes':_0x57183a[_0xab0e('0x1b')]?_0x57183a['options'][_0xab0e('0x1e')]||null:null,'limit':_0x57183a['options']?_0x57183a[_0xab0e('0x1b')][_0xab0e('0x1f')]||null:null,'include':_0x57183a['options']?_0x57183a[_0xab0e('0x1b')][_0xab0e('0x20')]?_[_0xab0e('0x21')](_0x57183a[_0xab0e('0x1b')][_0xab0e('0x20')],function(_0x58d964){return{'model':db[_0x58d964[_0xab0e('0x22')]],'as':_0x58d964['as'],'attributes':_0x58d964[_0xab0e('0x1e')],'include':_0x58d964[_0xab0e('0x20')]?_[_0xab0e('0x21')](_0x58d964[_0xab0e('0x20')],function(_0x5f1437){return{'model':db[_0x5f1437[_0xab0e('0x22')]],'as':_0x5f1437['as'],'attributes':_0x5f1437[_0xab0e('0x1e')],'include':_0x5f1437['include']?_[_0xab0e('0x21')](_0x5f1437[_0xab0e('0x20')],function(_0x2938b5){return{'model':db[_0x2938b5[_0xab0e('0x22')]],'as':_0x2938b5['as'],'attributes':_0x2938b5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33abbd){logger[_0xab0e('0xe')](_0xab0e('0x18'),_0x57183a);logger[_0xab0e('0x11')](_0xab0e('0x18'),_0x57183a,JSON[_0xab0e('0x13')](_0x33abbd));_0x54f29a(_0x33abbd);})[_0xab0e('0x23')](function(_0x2aa44f){logger[_0xab0e('0x14')](_0xab0e('0x18'),_0x2aa44f['message'],_0x57183a);_0x5933ab(_0x40ebcb[_0xab0e('0x14')](0x1f4,_0x2aa44f[_0xab0e('0x16')]));});});};exports[_0xab0e('0x24')]=function(_0x26fa14){var _0x4d0ab8=this;return new Promise(function(_0x35b683,_0x14713c){return db[_0xab0e('0x19')][_0xab0e('0x25')]({'raw':_0x26fa14[_0xab0e('0x1b')]?_0x26fa14[_0xab0e('0x1b')][_0xab0e('0x1c')]===undefined?!![]:![]:!![],'where':_0x26fa14[_0xab0e('0x1b')]?_0x26fa14['options'][_0xab0e('0x1d')]||null:null,'attributes':_0x26fa14['options']?_0x26fa14[_0xab0e('0x1b')][_0xab0e('0x1e')]||null:null,'include':_0x26fa14[_0xab0e('0x1b')]?_0x26fa14['options']['include']?_[_0xab0e('0x21')](_0x26fa14[_0xab0e('0x1b')]['include'],function(_0x1cecdd){return{'model':db[_0x1cecdd[_0xab0e('0x22')]],'as':_0x1cecdd['as'],'attributes':_0x1cecdd[_0xab0e('0x1e')],'include':_0x1cecdd[_0xab0e('0x20')]?_[_0xab0e('0x21')](_0x1cecdd[_0xab0e('0x20')],function(_0xce8cc9){return{'model':db[_0xce8cc9[_0xab0e('0x22')]],'as':_0xce8cc9['as'],'attributes':_0xce8cc9[_0xab0e('0x1e')],'include':_0xce8cc9[_0xab0e('0x20')]?_[_0xab0e('0x21')](_0xce8cc9[_0xab0e('0x20')],function(_0xfc5f20){return{'model':db[_0xfc5f20[_0xab0e('0x22')]],'as':_0xfc5f20['as'],'attributes':_0xfc5f20['attributes']};}):[]};}):[]};}):[]:[]})[_0xab0e('0xd')](function(_0x30592d){logger[_0xab0e('0xe')]('ShowServicenowAccount',_0x26fa14);logger[_0xab0e('0x11')](_0xab0e('0x24'),_0x26fa14,JSON[_0xab0e('0x13')](_0x30592d));_0x35b683(_0x30592d);})['catch'](function(_0x5d3fda){logger['error']('ShowServicenowAccount',_0x5d3fda['message'],_0x26fa14);_0x14713c(_0x4d0ab8[_0xab0e('0x14')](0x1f4,_0x5d3fda['message']));});});}; \ No newline at end of file +var _0x2ea0=['code','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','model','map','ShowServicenowAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error'];(function(_0x468e6c,_0x5e150b){var _0x54c64b=function(_0x44559f){while(--_0x44559f){_0x468e6c['push'](_0x468e6c['shift']());}};_0x54c64b(++_0x5e150b);}(_0x2ea0,0xe4));var _0x02ea=function(_0x454db7,_0x19898f){_0x454db7=_0x454db7-0x0;var _0x520d54=_0x2ea0[_0x454db7];return _0x520d54;};'use strict';var _=require('lodash');var util=require(_0x02ea('0x0'));var moment=require('moment');var BPromise=require(_0x02ea('0x1'));var rs=require(_0x02ea('0x2'));var fs=require('fs');var Redis=require(_0x02ea('0x3'));var db=require(_0x02ea('0x4'))['db'];var utils=require(_0x02ea('0x5'));var logger=require(_0x02ea('0x6'))(_0x02ea('0x7'));var config=require(_0x02ea('0x8'));var jayson=require(_0x02ea('0x9'));var client=jayson[_0x02ea('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45cdbc,_0x961d3f,_0x1d56b3){return new BPromise(function(_0x41641c,_0x55c9c6){return client[_0x02ea('0xb')](_0x45cdbc,_0x1d56b3)[_0x02ea('0xc')](function(_0x151fff){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x961d3f,_0x02ea('0xd'));logger[_0x02ea('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x961d3f,_0x02ea('0xd'),JSON[_0x02ea('0xf')](_0x151fff));if(_0x151fff['error']){if(_0x151fff[_0x02ea('0x10')][_0x02ea('0x11')]===0x1f4){logger[_0x02ea('0x10')](_0x02ea('0x12'),_0x961d3f,_0x151fff[_0x02ea('0x10')]['message']);return _0x55c9c6(_0x151fff[_0x02ea('0x10')][_0x02ea('0x13')]);}logger[_0x02ea('0x10')](_0x02ea('0x12'),_0x961d3f,_0x151fff[_0x02ea('0x10')][_0x02ea('0x13')]);return _0x41641c(_0x151fff['error'][_0x02ea('0x13')]);}else{logger[_0x02ea('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x961d3f,'request\x20sent');_0x41641c(_0x151fff[_0x02ea('0x15')][_0x02ea('0x13')]);}})[_0x02ea('0x16')](function(_0x251957){logger[_0x02ea('0x10')](_0x02ea('0x12'),_0x961d3f,_0x251957);_0x55c9c6(_0x251957);});});}exports[_0x02ea('0x17')]=function(_0x47fb0e){var _0x16bbaf=this;return new Promise(function(_0x527d0b,_0x3d13a2){return db[_0x02ea('0x18')]['findAll']({'raw':_0x47fb0e[_0x02ea('0x19')]?_0x47fb0e['options'][_0x02ea('0x1a')]===undefined?!![]:![]:!![],'where':_0x47fb0e[_0x02ea('0x19')]?_0x47fb0e['options'][_0x02ea('0x1b')]||null:null,'attributes':_0x47fb0e[_0x02ea('0x19')]?_0x47fb0e['options'][_0x02ea('0x1c')]||null:null,'limit':_0x47fb0e['options']?_0x47fb0e['options'][_0x02ea('0x1d')]||null:null,'include':_0x47fb0e[_0x02ea('0x19')]?_0x47fb0e[_0x02ea('0x19')][_0x02ea('0x1e')]?_['map'](_0x47fb0e[_0x02ea('0x19')]['include'],function(_0x5f0d29){return{'model':db[_0x5f0d29[_0x02ea('0x1f')]],'as':_0x5f0d29['as'],'attributes':_0x5f0d29[_0x02ea('0x1c')],'include':_0x5f0d29[_0x02ea('0x1e')]?_[_0x02ea('0x20')](_0x5f0d29[_0x02ea('0x1e')],function(_0x53fbe1){return{'model':db[_0x53fbe1[_0x02ea('0x1f')]],'as':_0x53fbe1['as'],'attributes':_0x53fbe1[_0x02ea('0x1c')],'include':_0x53fbe1['include']?_['map'](_0x53fbe1[_0x02ea('0x1e')],function(_0x357bdd){return{'model':db[_0x357bdd['model']],'as':_0x357bdd['as'],'attributes':_0x357bdd[_0x02ea('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e9f3b){logger[_0x02ea('0x14')](_0x02ea('0x17'),_0x47fb0e);logger['debug'](_0x02ea('0x17'),_0x47fb0e,JSON[_0x02ea('0xf')](_0x2e9f3b));_0x527d0b(_0x2e9f3b);})[_0x02ea('0x16')](function(_0x1004a1){logger['error']('GetServicenowAccount',_0x1004a1[_0x02ea('0x13')],_0x47fb0e);_0x3d13a2(_0x16bbaf[_0x02ea('0x10')](0x1f4,_0x1004a1[_0x02ea('0x13')]));});});};exports[_0x02ea('0x21')]=function(_0x38bec9){var _0x5a1df8=this;return new Promise(function(_0x1e319a,_0x259408){return db[_0x02ea('0x18')][_0x02ea('0x22')]({'raw':_0x38bec9['options']?_0x38bec9[_0x02ea('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x38bec9[_0x02ea('0x19')]?_0x38bec9[_0x02ea('0x19')][_0x02ea('0x1b')]||null:null,'attributes':_0x38bec9[_0x02ea('0x19')]?_0x38bec9[_0x02ea('0x19')]['attributes']||null:null,'include':_0x38bec9[_0x02ea('0x19')]?_0x38bec9[_0x02ea('0x19')][_0x02ea('0x1e')]?_[_0x02ea('0x20')](_0x38bec9['options']['include'],function(_0x4ef7d3){return{'model':db[_0x4ef7d3[_0x02ea('0x1f')]],'as':_0x4ef7d3['as'],'attributes':_0x4ef7d3[_0x02ea('0x1c')],'include':_0x4ef7d3[_0x02ea('0x1e')]?_[_0x02ea('0x20')](_0x4ef7d3['include'],function(_0x1ea2ee){return{'model':db[_0x1ea2ee[_0x02ea('0x1f')]],'as':_0x1ea2ee['as'],'attributes':_0x1ea2ee[_0x02ea('0x1c')],'include':_0x1ea2ee['include']?_[_0x02ea('0x20')](_0x1ea2ee[_0x02ea('0x1e')],function(_0xa44925){return{'model':db[_0xa44925[_0x02ea('0x1f')]],'as':_0xa44925['as'],'attributes':_0xa44925[_0x02ea('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x02ea('0xc')](function(_0x8271b1){logger[_0x02ea('0x14')](_0x02ea('0x21'),_0x38bec9);logger[_0x02ea('0xe')](_0x02ea('0x21'),_0x38bec9,JSON[_0x02ea('0xf')](_0x8271b1));_0x1e319a(_0x8271b1);})[_0x02ea('0x16')](function(_0x4df351){logger[_0x02ea('0x10')](_0x02ea('0x21'),_0x4df351[_0x02ea('0x13')],_0x38bec9);_0x259408(_0x5a1df8[_0x02ea('0x10')](0x1f4,_0x4df351[_0x02ea('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 2073f73..37b2fcf 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 _0x45b6=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','destroy','exports','multer','util','Router','fs-extra'];(function(_0xc48502,_0x163b77){var _0x4d4ff8=function(_0x516e5b){while(--_0x516e5b){_0xc48502['push'](_0xc48502['shift']());}};_0x4d4ff8(++_0x163b77);}(_0x45b6,0x1b5));var _0x645b=function(_0x17e087,_0x13c9b1){_0x17e087=_0x17e087-0x0;var _0x254766=_0x45b6[_0x17e087];return _0x254766;};'use strict';var multer=require(_0x645b('0x0'));var util=require(_0x645b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x645b('0x2')]();var fs_extra=require(_0x645b('0x3'));var auth=require(_0x645b('0x4'));var interaction=require(_0x645b('0x5'));var config=require(_0x645b('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x645b('0x7')]('/',auth[_0x645b('0x8')](),controller[_0x645b('0x9')]);router[_0x645b('0x7')](_0x645b('0xa'),auth[_0x645b('0x8')](),controller['show']);router[_0x645b('0x7')](_0x645b('0xb'),auth[_0x645b('0x8')](),controller['getFields']);router[_0x645b('0x7')](_0x645b('0xc'),auth['isAuthenticated'](),controller[_0x645b('0xd')]);router[_0x645b('0x7')]('/:id/descriptions',auth[_0x645b('0x8')](),controller[_0x645b('0xe')]);router[_0x645b('0xf')]('/',auth[_0x645b('0x8')](),controller[_0x645b('0x10')]);router[_0x645b('0x11')](_0x645b('0xa'),auth[_0x645b('0x8')](),controller['update']);router[_0x645b('0x12')](_0x645b('0xa'),auth[_0x645b('0x8')](),controller[_0x645b('0x13')]);module[_0x645b('0x14')]=router; \ No newline at end of file +var _0xb83b=['/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index'];(function(_0x261021,_0x3bff86){var _0x556374=function(_0x3990a7){while(--_0x3990a7){_0x261021['push'](_0x261021['shift']());}};_0x556374(++_0x3bff86);}(_0xb83b,0x178));var _0xbb83=function(_0xe30e59,_0x2d7005){_0xe30e59=_0xe30e59-0x0;var _0x5021d4=_0xb83b[_0xe30e59];return _0x5021d4;};'use strict';var multer=require(_0xbb83('0x0'));var util=require(_0xbb83('0x1'));var path=require(_0xbb83('0x2'));var timeout=require(_0xbb83('0x3'));var express=require(_0xbb83('0x4'));var router=express[_0xbb83('0x5')]();var fs_extra=require(_0xbb83('0x6'));var auth=require(_0xbb83('0x7'));var interaction=require(_0xbb83('0x8'));var config=require(_0xbb83('0x9'));var controller=require(_0xbb83('0xa'));router[_0xbb83('0xb')]('/',auth[_0xbb83('0xc')](),controller[_0xbb83('0xd')]);router['get'](_0xbb83('0xe'),auth[_0xbb83('0xc')](),controller[_0xbb83('0xf')]);router[_0xbb83('0xb')]('/:id/fields',auth[_0xbb83('0xc')](),controller[_0xbb83('0x10')]);router['get'](_0xbb83('0x11'),auth['isAuthenticated'](),controller[_0xbb83('0x12')]);router[_0xbb83('0xb')](_0xbb83('0x13'),auth[_0xbb83('0xc')](),controller[_0xbb83('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbb83('0x15')]);router[_0xbb83('0x16')](_0xbb83('0xe'),auth[_0xbb83('0xc')](),controller['update']);router[_0xbb83('0x17')](_0xbb83('0xe'),auth[_0xbb83('0xc')](),controller[_0xbb83('0x18')]);module[_0xbb83('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 90f292f..93305d4 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 _0x40f1=['exports','STRING'];(function(_0x9234eb,_0x114d75){var _0x214240=function(_0x293ceb){while(--_0x293ceb){_0x9234eb['push'](_0x9234eb['shift']());}};_0x214240(++_0x114d75);}(_0x40f1,0xb2));var _0x140f=function(_0x19b2c3,_0x48a2da){_0x19b2c3=_0x19b2c3-0x0;var _0x4ca337=_0x40f1[_0x19b2c3];return _0x4ca337;};'use strict';var Sequelize=require('sequelize');module[_0x140f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x140f('0x1')]}}; \ No newline at end of file +var _0x7290=['exports','STRING','sequelize'];(function(_0x55cf47,_0x3d037b){var _0x42bf2b=function(_0x2edd84){while(--_0x2edd84){_0x55cf47['push'](_0x55cf47['shift']());}};_0x42bf2b(++_0x3d037b);}(_0x7290,0xda));var _0x0729=function(_0x3b6d58,_0xb29c70){_0x3b6d58=_0x3b6d58-0x0;var _0x64d7dc=_0x7290[_0x3b6d58];return _0x64d7dc;};'use strict';var Sequelize=require(_0x0729('0x0'));module[_0x0729('0x1')]={'name':{'type':Sequelize[_0x0729('0x2')]},'description':{'type':Sequelize[_0x0729('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 4191dd2..a94f8d1 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 _0x97b7=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','ServicenowConfiguration','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','find','body','update','getFields','ServicenowField','pick','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse'];(function(_0xe879e7,_0x3eff6e){var _0x2a744f=function(_0x2a575b){while(--_0x2a575b){_0xe879e7['push'](_0xe879e7['shift']());}};_0x2a744f(++_0x3eff6e);}(_0x97b7,0x123));var _0x797b=function(_0x527d52,_0x326162){_0x527d52=_0x527d52-0x0;var _0x5a8185=_0x97b7[_0x527d52];return _0x5a8185;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x797b('0x0'));var zipdir=require(_0x797b('0x1'));var jsonpatch=require(_0x797b('0x2'));var rp=require(_0x797b('0x3'));var moment=require('moment');var BPromise=require(_0x797b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x797b('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x797b('0x6'));var fs=require('fs');var fs_extra=require(_0x797b('0x7'));var _=require(_0x797b('0x8'));var squel=require('squel');var crypto=require(_0x797b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x797b('0xa'));var toCsv=require(_0x797b('0xb'));var querystring=require('querystring');var Papa=require(_0x797b('0xc'));var Redis=require(_0x797b('0xd'));var authService=require(_0x797b('0xe'));var qs=require(_0x797b('0xf'));var as=require(_0x797b('0x10'));var hardwareService=require(_0x797b('0x11'));var logger=require(_0x797b('0x12'))('api');var utils=require(_0x797b('0x13'));var config=require(_0x797b('0x14'));var licenseUtil=require(_0x797b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x250c3a,_0x1d4028){_0x1d4028=_0x1d4028||0xcc;return function(_0x2cc074){if(_0x2cc074){return _0x250c3a[_0x797b('0x16')](_0x1d4028);}return _0x250c3a['status'](_0x1d4028)['end']();};}function respondWithResult(_0x1b3edc,_0x4f7f1b){_0x4f7f1b=_0x4f7f1b||0xc8;return function(_0x314675){if(_0x314675){return _0x1b3edc[_0x797b('0x17')](_0x4f7f1b)[_0x797b('0x18')](_0x314675);}};}function respondWithFilteredResult(_0x48cbaf,_0x50029c){return function(_0x233c82){if(_0x233c82){var _0x1f0871=typeof _0x50029c[_0x797b('0x19')]===_0x797b('0x1a')&&typeof _0x50029c[_0x797b('0x1b')]===_0x797b('0x1a');var _0x23c040=_0x233c82['count'];var _0x2ed464=_0x1f0871?0x0:_0x50029c[_0x797b('0x19')];var _0x251e16=_0x1f0871?_0x233c82[_0x797b('0x1c')]:_0x50029c[_0x797b('0x19')]+_0x50029c[_0x797b('0x1b')];var _0x47c3f8;if(_0x251e16>=_0x23c040){_0x251e16=_0x23c040;_0x47c3f8=0xc8;}else{_0x47c3f8=0xce;}_0x48cbaf[_0x797b('0x17')](_0x47c3f8);return _0x48cbaf['set']('Content-Range',_0x2ed464+'-'+_0x251e16+'/'+_0x23c040)[_0x797b('0x18')](_0x233c82);}return null;};}function patchUpdates(_0x23de62){return function(_0x4753a2){try{jsonpatch[_0x797b('0x1d')](_0x4753a2,_0x23de62,!![]);}catch(_0x21388e){return BPromise[_0x797b('0x1e')](_0x21388e);}return _0x4753a2[_0x797b('0x1f')]();};}function saveUpdates(_0x295e96,_0x13a141){return function(_0x55cba2){if(_0x55cba2){return _0x55cba2['update'](_0x295e96)[_0x797b('0x20')](function(_0x10bad3){return _0x10bad3;});}return null;};}function removeEntity(_0x2576f0,_0x56c42d){return function(_0xd7d5b8){if(_0xd7d5b8){return _0xd7d5b8[_0x797b('0x21')]()[_0x797b('0x20')](function(){_0x2576f0[_0x797b('0x17')](0xcc)[_0x797b('0x22')]();});}};}function handleEntityNotFound(_0x1f446e,_0x50482a){return function(_0x46c99c){if(!_0x46c99c){_0x1f446e[_0x797b('0x16')](0x194);}return _0x46c99c;};}function handleError(_0x3282af,_0x45f5c3){_0x45f5c3=_0x45f5c3||0x1f4;return function(_0x9da803){logger[_0x797b('0x23')](_0x9da803[_0x797b('0x24')]);if(_0x9da803[_0x797b('0x25')]){delete _0x9da803[_0x797b('0x25')];}_0x3282af[_0x797b('0x17')](_0x45f5c3)[_0x797b('0x26')](_0x9da803);};}exports[_0x797b('0x27')]=function(_0x17c9c1,_0x140e17){var _0x43566f={},_0x3cc8d5={},_0x1b95ba={'count':0x0,'rows':[]};var _0xb4e739=_[_0x797b('0x28')](db[_0x797b('0x29')]['rawAttributes'],function(_0x17e492){return{'name':_0x17e492[_0x797b('0x2a')],'type':_0x17e492[_0x797b('0x2b')][_0x797b('0x2c')]};});_0x3cc8d5[_0x797b('0x2d')]=_[_0x797b('0x28')](_0xb4e739,'name');_0x3cc8d5['query']=_[_0x797b('0x2e')](_0x17c9c1[_0x797b('0x2f')]);_0x3cc8d5[_0x797b('0x30')]=_[_0x797b('0x31')](_0x3cc8d5[_0x797b('0x2d')],_0x3cc8d5['query']);_0x43566f[_0x797b('0x32')]=_['intersection'](_0x3cc8d5[_0x797b('0x2d')],qs['fields'](_0x17c9c1[_0x797b('0x2f')][_0x797b('0x33')]));_0x43566f['attributes']=_0x43566f[_0x797b('0x32')][_0x797b('0x34')]?_0x43566f['attributes']:_0x3cc8d5[_0x797b('0x2d')];if(!_0x17c9c1[_0x797b('0x2f')][_0x797b('0x35')](_0x797b('0x36'))){_0x43566f[_0x797b('0x1b')]=qs[_0x797b('0x1b')](_0x17c9c1[_0x797b('0x2f')]['limit']);_0x43566f[_0x797b('0x19')]=qs[_0x797b('0x19')](_0x17c9c1[_0x797b('0x2f')][_0x797b('0x19')]);}_0x43566f[_0x797b('0x37')]=qs[_0x797b('0x38')](_0x17c9c1['query'][_0x797b('0x38')]);_0x43566f['where']=qs['filters'](_['pick'](_0x17c9c1[_0x797b('0x2f')],_0x3cc8d5[_0x797b('0x30')]),_0xb4e739);if(_0x17c9c1[_0x797b('0x2f')][_0x797b('0x39')]){_0x43566f[_0x797b('0x3a')]=_['merge'](_0x43566f[_0x797b('0x3a')],{'$or':_[_0x797b('0x28')](_0xb4e739,function(_0x44a5e3){if(_0x44a5e3[_0x797b('0x2b')]!=='VIRTUAL'){var _0x25968e={};_0x25968e[_0x44a5e3[_0x797b('0x25')]]={'$like':'%'+_0x17c9c1[_0x797b('0x2f')]['filter']+'%'};return _0x25968e;}})});}_0x43566f=_[_0x797b('0x3b')]({},_0x43566f,_0x17c9c1[_0x797b('0x3c')]);var _0x2cd1f0={'where':_0x43566f[_0x797b('0x3a')]};return db[_0x797b('0x29')]['count'](_0x2cd1f0)[_0x797b('0x20')](function(_0x5d39f3){_0x1b95ba[_0x797b('0x1c')]=_0x5d39f3;if(_0x17c9c1[_0x797b('0x2f')][_0x797b('0x3d')]){_0x43566f['include']=[{'all':!![]}];}return db[_0x797b('0x29')][_0x797b('0x3e')](_0x43566f);})[_0x797b('0x20')](function(_0x50946f){_0x1b95ba[_0x797b('0x3f')]=_0x50946f;return _0x1b95ba;})[_0x797b('0x20')](respondWithFilteredResult(_0x140e17,_0x43566f))[_0x797b('0x40')](handleError(_0x140e17,null));};exports['show']=function(_0x30d5c1,_0x1ad688){var _0x3dafc6={'raw':![],'where':{'id':_0x30d5c1[_0x797b('0x41')]['id']}},_0x4f95ac={};_0x4f95ac[_0x797b('0x2d')]=_[_0x797b('0x2e')](db[_0x797b('0x29')][_0x797b('0x42')]);_0x4f95ac[_0x797b('0x2f')]=_[_0x797b('0x2e')](_0x30d5c1['query']);_0x4f95ac['filters']=_[_0x797b('0x31')](_0x4f95ac[_0x797b('0x2d')],_0x4f95ac[_0x797b('0x2f')]);_0x3dafc6['attributes']=_[_0x797b('0x31')](_0x4f95ac[_0x797b('0x2d')],qs[_0x797b('0x33')](_0x30d5c1[_0x797b('0x2f')]['fields']));_0x3dafc6[_0x797b('0x32')]=_0x3dafc6[_0x797b('0x32')][_0x797b('0x34')]?_0x3dafc6[_0x797b('0x32')]:_0x4f95ac['model'];if(_0x30d5c1[_0x797b('0x2f')][_0x797b('0x3d')]){_0x3dafc6['include']=[{'all':!![]}];}_0x3dafc6=_[_0x797b('0x3b')]({},_0x3dafc6,_0x30d5c1['options']);return db['ServicenowConfiguration'][_0x797b('0x43')](_0x3dafc6)[_0x797b('0x20')](handleEntityNotFound(_0x1ad688,null))[_0x797b('0x20')](respondWithResult(_0x1ad688,null))[_0x797b('0x40')](handleError(_0x1ad688,null));};exports['create']=function(_0x5d17c3,_0x5b5489){return db['ServicenowConfiguration']['create'](_0x5d17c3[_0x797b('0x44')],{})[_0x797b('0x20')](respondWithResult(_0x5b5489,0xc9))[_0x797b('0x40')](handleError(_0x5b5489,null));};exports[_0x797b('0x45')]=function(_0x46d396,_0x4866aa){if(_0x46d396['body']['id']){delete _0x46d396[_0x797b('0x44')]['id'];}return db[_0x797b('0x29')][_0x797b('0x43')]({'where':{'id':_0x46d396[_0x797b('0x41')]['id']}})[_0x797b('0x20')](handleEntityNotFound(_0x4866aa,null))[_0x797b('0x20')](saveUpdates(_0x46d396[_0x797b('0x44')],null))['then'](respondWithResult(_0x4866aa,null))['catch'](handleError(_0x4866aa,null));};exports[_0x797b('0x21')]=function(_0x218757,_0x1b4a95){return db[_0x797b('0x29')][_0x797b('0x43')]({'where':{'id':_0x218757[_0x797b('0x41')]['id']}})[_0x797b('0x20')](handleEntityNotFound(_0x1b4a95,null))[_0x797b('0x20')](removeEntity(_0x1b4a95,null))['catch'](handleError(_0x1b4a95,null));};exports[_0x797b('0x46')]=function(_0x59d044,_0x5a732f,_0x4151e9){var _0x522b4={};var _0x3ee4f8={};var _0x576f6c;var _0x3cfe20;return db[_0x797b('0x29')]['findOne']({'where':{'id':_0x59d044['params']['id']}})['then'](handleEntityNotFound(_0x5a732f,null))[_0x797b('0x20')](function(_0x5d758f){if(_0x5d758f){_0x576f6c=_0x5d758f;_0x3ee4f8[_0x797b('0x2d')]=_[_0x797b('0x2e')](db[_0x797b('0x47')]['rawAttributes']);_0x3ee4f8[_0x797b('0x2f')]=_[_0x797b('0x2e')](_0x59d044['query']);_0x3ee4f8[_0x797b('0x30')]=_[_0x797b('0x31')](_0x3ee4f8['model'],_0x3ee4f8[_0x797b('0x2f')]);_0x522b4[_0x797b('0x32')]=_[_0x797b('0x31')](_0x3ee4f8['model'],qs[_0x797b('0x33')](_0x59d044[_0x797b('0x2f')][_0x797b('0x33')]));_0x522b4[_0x797b('0x32')]=_0x522b4[_0x797b('0x32')][_0x797b('0x34')]?_0x522b4['attributes']:_0x3ee4f8[_0x797b('0x2d')];_0x522b4[_0x797b('0x37')]=qs[_0x797b('0x38')](_0x59d044[_0x797b('0x2f')][_0x797b('0x38')]);_0x522b4[_0x797b('0x3a')]=qs[_0x797b('0x30')](_[_0x797b('0x48')](_0x59d044[_0x797b('0x2f')],_0x3ee4f8[_0x797b('0x30')]));if(_0x59d044['query'][_0x797b('0x39')]){_0x522b4[_0x797b('0x3a')]=_['merge'](_0x522b4[_0x797b('0x3a')],{'$or':_[_0x797b('0x28')](_0x522b4[_0x797b('0x32')],function(_0x245081){var _0x154bb6={};_0x154bb6[_0x245081]={'$like':'%'+_0x59d044[_0x797b('0x2f')][_0x797b('0x39')]+'%'};return _0x154bb6;})});}_0x522b4=_[_0x797b('0x3b')]({},_0x522b4,_0x59d044[_0x797b('0x3c')]);return _0x576f6c[_0x797b('0x46')](_0x522b4);}})[_0x797b('0x20')](function(_0x36351a){if(_0x36351a){_0x3cfe20=_0x36351a['length'];if(!_0x59d044[_0x797b('0x2f')]['hasOwnProperty'](_0x797b('0x36'))){_0x522b4[_0x797b('0x1b')]=qs[_0x797b('0x1b')](_0x59d044[_0x797b('0x2f')][_0x797b('0x1b')]);_0x522b4[_0x797b('0x19')]=qs[_0x797b('0x19')](_0x59d044[_0x797b('0x2f')][_0x797b('0x19')]);}return _0x576f6c[_0x797b('0x46')](_0x522b4);}})['then'](function(_0x4e8f02){if(_0x4e8f02){return _0x4e8f02?{'count':_0x3cfe20,'rows':_0x4e8f02}:null;}})['then'](respondWithResult(_0x5a732f,null))[_0x797b('0x40')](handleError(_0x5a732f,null));};exports[_0x797b('0x49')]=function(_0x5e2262,_0x272ceb,_0x5dcb3d){var _0x3c7cda={};var _0x4aeb94={};var _0x72e301;var _0x12c74e;return db['ServicenowConfiguration'][_0x797b('0x4a')]({'where':{'id':_0x5e2262[_0x797b('0x41')]['id']}})[_0x797b('0x20')](handleEntityNotFound(_0x272ceb,null))[_0x797b('0x20')](function(_0x214cf9){if(_0x214cf9){_0x72e301=_0x214cf9;_0x4aeb94['model']=_['keys'](db[_0x797b('0x47')]['rawAttributes']);_0x4aeb94[_0x797b('0x2f')]=_['keys'](_0x5e2262[_0x797b('0x2f')]);_0x4aeb94['filters']=_[_0x797b('0x31')](_0x4aeb94[_0x797b('0x2d')],_0x4aeb94[_0x797b('0x2f')]);_0x3c7cda[_0x797b('0x32')]=_[_0x797b('0x31')](_0x4aeb94[_0x797b('0x2d')],qs[_0x797b('0x33')](_0x5e2262['query'][_0x797b('0x33')]));_0x3c7cda[_0x797b('0x32')]=_0x3c7cda[_0x797b('0x32')][_0x797b('0x34')]?_0x3c7cda[_0x797b('0x32')]:_0x4aeb94[_0x797b('0x2d')];_0x3c7cda['order']=qs[_0x797b('0x38')](_0x5e2262[_0x797b('0x2f')][_0x797b('0x38')]);_0x3c7cda['where']=qs[_0x797b('0x30')](_[_0x797b('0x48')](_0x5e2262[_0x797b('0x2f')],_0x4aeb94[_0x797b('0x30')]));if(_0x5e2262[_0x797b('0x2f')][_0x797b('0x39')]){_0x3c7cda[_0x797b('0x3a')]=_[_0x797b('0x3b')](_0x3c7cda['where'],{'$or':_[_0x797b('0x28')](_0x3c7cda['attributes'],function(_0x459bb4){var _0x591c5c={};_0x591c5c[_0x459bb4]={'$like':'%'+_0x5e2262['query'][_0x797b('0x39')]+'%'};return _0x591c5c;})});}_0x3c7cda=_[_0x797b('0x3b')]({},_0x3c7cda,_0x5e2262['options']);return _0x72e301[_0x797b('0x49')](_0x3c7cda);}})[_0x797b('0x20')](function(_0x2896e5){if(_0x2896e5){_0x12c74e=_0x2896e5[_0x797b('0x34')];if(!_0x5e2262[_0x797b('0x2f')][_0x797b('0x35')](_0x797b('0x36'))){_0x3c7cda[_0x797b('0x1b')]=qs['limit'](_0x5e2262[_0x797b('0x2f')][_0x797b('0x1b')]);_0x3c7cda['offset']=qs[_0x797b('0x19')](_0x5e2262[_0x797b('0x2f')][_0x797b('0x19')]);}return _0x72e301['getSubjects'](_0x3c7cda);}})[_0x797b('0x20')](function(_0x3c5044){if(_0x3c5044){return _0x3c5044?{'count':_0x12c74e,'rows':_0x3c5044}:null;}})[_0x797b('0x20')](respondWithResult(_0x272ceb,null))[_0x797b('0x40')](handleError(_0x272ceb,null));};exports[_0x797b('0x4b')]=function(_0x4a8ab9,_0x2730d6,_0x130096){var _0x3ade78={};var _0x138802={};var _0x4bc21b;var _0x4304f6;return db[_0x797b('0x29')][_0x797b('0x4a')]({'where':{'id':_0x4a8ab9['params']['id']}})[_0x797b('0x20')](handleEntityNotFound(_0x2730d6,null))[_0x797b('0x20')](function(_0x31183f){if(_0x31183f){_0x4bc21b=_0x31183f;_0x138802[_0x797b('0x2d')]=_[_0x797b('0x2e')](db['ServicenowField']['rawAttributes']);_0x138802[_0x797b('0x2f')]=_[_0x797b('0x2e')](_0x4a8ab9[_0x797b('0x2f')]);_0x138802['filters']=_[_0x797b('0x31')](_0x138802[_0x797b('0x2d')],_0x138802[_0x797b('0x2f')]);_0x3ade78['attributes']=_[_0x797b('0x31')](_0x138802[_0x797b('0x2d')],qs[_0x797b('0x33')](_0x4a8ab9[_0x797b('0x2f')]['fields']));_0x3ade78[_0x797b('0x32')]=_0x3ade78[_0x797b('0x32')][_0x797b('0x34')]?_0x3ade78['attributes']:_0x138802[_0x797b('0x2d')];_0x3ade78['order']=qs['sort'](_0x4a8ab9[_0x797b('0x2f')]['sort']);_0x3ade78['where']=qs[_0x797b('0x30')](_[_0x797b('0x48')](_0x4a8ab9[_0x797b('0x2f')],_0x138802['filters']));if(_0x4a8ab9[_0x797b('0x2f')][_0x797b('0x39')]){_0x3ade78[_0x797b('0x3a')]=_[_0x797b('0x3b')](_0x3ade78['where'],{'$or':_[_0x797b('0x28')](_0x3ade78[_0x797b('0x32')],function(_0x122c70){var _0x30a472={};_0x30a472[_0x122c70]={'$like':'%'+_0x4a8ab9[_0x797b('0x2f')][_0x797b('0x39')]+'%'};return _0x30a472;})});}_0x3ade78=_[_0x797b('0x3b')]({},_0x3ade78,_0x4a8ab9[_0x797b('0x3c')]);return _0x4bc21b[_0x797b('0x4b')](_0x3ade78);}})['then'](function(_0x2c3774){if(_0x2c3774){_0x4304f6=_0x2c3774['length'];if(!_0x4a8ab9[_0x797b('0x2f')]['hasOwnProperty'](_0x797b('0x36'))){_0x3ade78[_0x797b('0x1b')]=qs[_0x797b('0x1b')](_0x4a8ab9[_0x797b('0x2f')][_0x797b('0x1b')]);_0x3ade78[_0x797b('0x19')]=qs['offset'](_0x4a8ab9['query'][_0x797b('0x19')]);}return _0x4bc21b[_0x797b('0x4b')](_0x3ade78);}})[_0x797b('0x20')](function(_0x171e90){if(_0x171e90){return _0x171e90?{'count':_0x4304f6,'rows':_0x171e90}:null;}})['then'](respondWithResult(_0x2730d6,null))[_0x797b('0x40')](handleError(_0x2730d6,null));}; \ No newline at end of file +var _0xaa78=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','getFields','sort','getSubjects','findOne','ServicenowField','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x4565eb,_0x167f79){var _0x67832=function(_0x5322ff){while(--_0x5322ff){_0x4565eb['push'](_0x4565eb['shift']());}};_0x67832(++_0x167f79);}(_0xaa78,0x186));var _0x8aa7=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xaa78[_0x1d24eb];return _0x1dc576;};'use strict';var emlformat=require(_0x8aa7('0x0'));var rimraf=require(_0x8aa7('0x1'));var zipdir=require(_0x8aa7('0x2'));var jsonpatch=require(_0x8aa7('0x3'));var rp=require(_0x8aa7('0x4'));var moment=require(_0x8aa7('0x5'));var BPromise=require(_0x8aa7('0x6'));var Mustache=require(_0x8aa7('0x7'));var util=require(_0x8aa7('0x8'));var path=require('path');var sox=require(_0x8aa7('0x9'));var csv=require(_0x8aa7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa7('0xb'));var _=require(_0x8aa7('0xc'));var squel=require(_0x8aa7('0xd'));var crypto=require(_0x8aa7('0xe'));var jsforce=require(_0x8aa7('0xf'));var deskjs=require(_0x8aa7('0x10'));var toCsv=require(_0x8aa7('0xa'));var querystring=require(_0x8aa7('0x11'));var Papa=require(_0x8aa7('0x12'));var Redis=require(_0x8aa7('0x13'));var authService=require(_0x8aa7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x8aa7('0x15'));var hardwareService=require(_0x8aa7('0x16'));var logger=require(_0x8aa7('0x17'))('api');var utils=require(_0x8aa7('0x18'));var config=require(_0x8aa7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa7('0x1a'))['db'];function respondWithStatusCode(_0x2fd807,_0x4ea65c){_0x4ea65c=_0x4ea65c||0xcc;return function(_0x42ac92){if(_0x42ac92){return _0x2fd807[_0x8aa7('0x1b')](_0x4ea65c);}return _0x2fd807[_0x8aa7('0x1c')](_0x4ea65c)[_0x8aa7('0x1d')]();};}function respondWithResult(_0x10b013,_0x3aacf9){_0x3aacf9=_0x3aacf9||0xc8;return function(_0x40e4eb){if(_0x40e4eb){return _0x10b013[_0x8aa7('0x1c')](_0x3aacf9)[_0x8aa7('0x1e')](_0x40e4eb);}};}function respondWithFilteredResult(_0x2dd069,_0xe0230c){return function(_0x19672d){if(_0x19672d){var _0x411269=typeof _0xe0230c[_0x8aa7('0x1f')]===_0x8aa7('0x20')&&typeof _0xe0230c['limit']===_0x8aa7('0x20');var _0x392135=_0x19672d[_0x8aa7('0x21')];var _0xe26163=_0x411269?0x0:_0xe0230c[_0x8aa7('0x1f')];var _0x413433=_0x411269?_0x19672d[_0x8aa7('0x21')]:_0xe0230c[_0x8aa7('0x1f')]+_0xe0230c[_0x8aa7('0x22')];var _0x3b6432;if(_0x413433>=_0x392135){_0x413433=_0x392135;_0x3b6432=0xc8;}else{_0x3b6432=0xce;}_0x2dd069[_0x8aa7('0x1c')](_0x3b6432);return _0x2dd069['set']('Content-Range',_0xe26163+'-'+_0x413433+'/'+_0x392135)[_0x8aa7('0x1e')](_0x19672d);}return null;};}function patchUpdates(_0x1051b5){return function(_0x21008c){try{jsonpatch[_0x8aa7('0x23')](_0x21008c,_0x1051b5,!![]);}catch(_0x37af80){return BPromise[_0x8aa7('0x24')](_0x37af80);}return _0x21008c[_0x8aa7('0x25')]();};}function saveUpdates(_0x4d6eb6,_0x63edbe){return function(_0x5242f0){if(_0x5242f0){return _0x5242f0[_0x8aa7('0x26')](_0x4d6eb6)[_0x8aa7('0x27')](function(_0x2caef6){return _0x2caef6;});}return null;};}function removeEntity(_0x586f9e,_0x1978d8){return function(_0x4d4dd0){if(_0x4d4dd0){return _0x4d4dd0[_0x8aa7('0x28')]()[_0x8aa7('0x27')](function(){_0x586f9e['status'](0xcc)[_0x8aa7('0x1d')]();});}};}function handleEntityNotFound(_0x5012f0,_0x1b5581){return function(_0x58dd07){if(!_0x58dd07){_0x5012f0[_0x8aa7('0x1b')](0x194);}return _0x58dd07;};}function handleError(_0x37f798,_0x500af9){_0x500af9=_0x500af9||0x1f4;return function(_0x1bfa9f){logger['error'](_0x1bfa9f['stack']);if(_0x1bfa9f['name']){delete _0x1bfa9f[_0x8aa7('0x29')];}_0x37f798[_0x8aa7('0x1c')](_0x500af9)[_0x8aa7('0x2a')](_0x1bfa9f);};}exports[_0x8aa7('0x2b')]=function(_0x401373,_0x35dfb0){var _0x3b0eab={},_0x1eb192={},_0x1679bb={'count':0x0,'rows':[]};var _0x26eea6=_['map'](db[_0x8aa7('0x2c')][_0x8aa7('0x2d')],function(_0x458678){return{'name':_0x458678[_0x8aa7('0x2e')],'type':_0x458678[_0x8aa7('0x2f')][_0x8aa7('0x30')]};});_0x1eb192[_0x8aa7('0x31')]=_[_0x8aa7('0x32')](_0x26eea6,_0x8aa7('0x29'));_0x1eb192[_0x8aa7('0x33')]=_['keys'](_0x401373[_0x8aa7('0x33')]);_0x1eb192[_0x8aa7('0x34')]=_[_0x8aa7('0x35')](_0x1eb192[_0x8aa7('0x31')],_0x1eb192['query']);_0x3b0eab['attributes']=_[_0x8aa7('0x35')](_0x1eb192[_0x8aa7('0x31')],qs[_0x8aa7('0x36')](_0x401373[_0x8aa7('0x33')][_0x8aa7('0x36')]));_0x3b0eab[_0x8aa7('0x37')]=_0x3b0eab[_0x8aa7('0x37')][_0x8aa7('0x38')]?_0x3b0eab[_0x8aa7('0x37')]:_0x1eb192['model'];if(!_0x401373[_0x8aa7('0x33')]['hasOwnProperty'](_0x8aa7('0x39'))){_0x3b0eab[_0x8aa7('0x22')]=qs[_0x8aa7('0x22')](_0x401373[_0x8aa7('0x33')][_0x8aa7('0x22')]);_0x3b0eab[_0x8aa7('0x1f')]=qs[_0x8aa7('0x1f')](_0x401373[_0x8aa7('0x33')][_0x8aa7('0x1f')]);}_0x3b0eab[_0x8aa7('0x3a')]=qs['sort'](_0x401373[_0x8aa7('0x33')]['sort']);_0x3b0eab[_0x8aa7('0x3b')]=qs['filters'](_[_0x8aa7('0x3c')](_0x401373['query'],_0x1eb192['filters']),_0x26eea6);if(_0x401373[_0x8aa7('0x33')]['filter']){_0x3b0eab[_0x8aa7('0x3b')]=_[_0x8aa7('0x3d')](_0x3b0eab[_0x8aa7('0x3b')],{'$or':_[_0x8aa7('0x32')](_0x26eea6,function(_0x5c541a){if(_0x5c541a[_0x8aa7('0x2f')]!==_0x8aa7('0x3e')){var _0x3924af={};_0x3924af[_0x5c541a[_0x8aa7('0x29')]]={'$like':'%'+_0x401373[_0x8aa7('0x33')][_0x8aa7('0x3f')]+'%'};return _0x3924af;}})});}_0x3b0eab=_[_0x8aa7('0x3d')]({},_0x3b0eab,_0x401373[_0x8aa7('0x40')]);var _0x2facd9={'where':_0x3b0eab[_0x8aa7('0x3b')]};return db[_0x8aa7('0x2c')]['count'](_0x2facd9)['then'](function(_0x3389ae){_0x1679bb['count']=_0x3389ae;if(_0x401373[_0x8aa7('0x33')][_0x8aa7('0x41')]){_0x3b0eab[_0x8aa7('0x42')]=[{'all':!![]}];}return db[_0x8aa7('0x2c')][_0x8aa7('0x43')](_0x3b0eab);})[_0x8aa7('0x27')](function(_0x264894){_0x1679bb[_0x8aa7('0x44')]=_0x264894;return _0x1679bb;})['then'](respondWithFilteredResult(_0x35dfb0,_0x3b0eab))['catch'](handleError(_0x35dfb0,null));};exports[_0x8aa7('0x45')]=function(_0x2570ca,_0x5b38bd){var _0x3a0d89={'raw':![],'where':{'id':_0x2570ca[_0x8aa7('0x46')]['id']}},_0x3d5ab5={};_0x3d5ab5[_0x8aa7('0x31')]=_[_0x8aa7('0x47')](db[_0x8aa7('0x2c')][_0x8aa7('0x2d')]);_0x3d5ab5[_0x8aa7('0x33')]=_[_0x8aa7('0x47')](_0x2570ca[_0x8aa7('0x33')]);_0x3d5ab5['filters']=_[_0x8aa7('0x35')](_0x3d5ab5[_0x8aa7('0x31')],_0x3d5ab5[_0x8aa7('0x33')]);_0x3a0d89['attributes']=_[_0x8aa7('0x35')](_0x3d5ab5['model'],qs[_0x8aa7('0x36')](_0x2570ca[_0x8aa7('0x33')]['fields']));_0x3a0d89[_0x8aa7('0x37')]=_0x3a0d89[_0x8aa7('0x37')][_0x8aa7('0x38')]?_0x3a0d89['attributes']:_0x3d5ab5[_0x8aa7('0x31')];if(_0x2570ca[_0x8aa7('0x33')][_0x8aa7('0x41')]){_0x3a0d89[_0x8aa7('0x42')]=[{'all':!![]}];}_0x3a0d89=_[_0x8aa7('0x3d')]({},_0x3a0d89,_0x2570ca['options']);return db['ServicenowConfiguration'][_0x8aa7('0x48')](_0x3a0d89)[_0x8aa7('0x27')](handleEntityNotFound(_0x5b38bd,null))['then'](respondWithResult(_0x5b38bd,null))['catch'](handleError(_0x5b38bd,null));};exports['create']=function(_0x2f65b9,_0x3e04e9){return db['ServicenowConfiguration'][_0x8aa7('0x49')](_0x2f65b9[_0x8aa7('0x4a')],{})[_0x8aa7('0x27')](respondWithResult(_0x3e04e9,0xc9))['catch'](handleError(_0x3e04e9,null));};exports[_0x8aa7('0x26')]=function(_0x34b2ac,_0xb538a0){if(_0x34b2ac[_0x8aa7('0x4a')]['id']){delete _0x34b2ac[_0x8aa7('0x4a')]['id'];}return db[_0x8aa7('0x2c')][_0x8aa7('0x48')]({'where':{'id':_0x34b2ac['params']['id']}})[_0x8aa7('0x27')](handleEntityNotFound(_0xb538a0,null))[_0x8aa7('0x27')](saveUpdates(_0x34b2ac[_0x8aa7('0x4a')],null))[_0x8aa7('0x27')](respondWithResult(_0xb538a0,null))[_0x8aa7('0x4b')](handleError(_0xb538a0,null));};exports[_0x8aa7('0x28')]=function(_0xdfeb1c,_0x4de203){return db['ServicenowConfiguration'][_0x8aa7('0x48')]({'where':{'id':_0xdfeb1c[_0x8aa7('0x46')]['id']}})['then'](handleEntityNotFound(_0x4de203,null))[_0x8aa7('0x27')](removeEntity(_0x4de203,null))[_0x8aa7('0x4b')](handleError(_0x4de203,null));};exports[_0x8aa7('0x4c')]=function(_0x2d9011,_0x2a0135,_0xee2649){var _0x40468f={};var _0x4ec4e3={};var _0x3bc5e3;var _0x5cbfba;return db[_0x8aa7('0x2c')]['findOne']({'where':{'id':_0x2d9011[_0x8aa7('0x46')]['id']}})[_0x8aa7('0x27')](handleEntityNotFound(_0x2a0135,null))[_0x8aa7('0x27')](function(_0x20d0bf){if(_0x20d0bf){_0x3bc5e3=_0x20d0bf;_0x4ec4e3[_0x8aa7('0x31')]=_[_0x8aa7('0x47')](db['ServicenowField']['rawAttributes']);_0x4ec4e3[_0x8aa7('0x33')]=_['keys'](_0x2d9011[_0x8aa7('0x33')]);_0x4ec4e3[_0x8aa7('0x34')]=_['intersection'](_0x4ec4e3['model'],_0x4ec4e3[_0x8aa7('0x33')]);_0x40468f[_0x8aa7('0x37')]=_[_0x8aa7('0x35')](_0x4ec4e3[_0x8aa7('0x31')],qs[_0x8aa7('0x36')](_0x2d9011[_0x8aa7('0x33')]['fields']));_0x40468f['attributes']=_0x40468f['attributes'][_0x8aa7('0x38')]?_0x40468f[_0x8aa7('0x37')]:_0x4ec4e3[_0x8aa7('0x31')];_0x40468f[_0x8aa7('0x3a')]=qs[_0x8aa7('0x4d')](_0x2d9011[_0x8aa7('0x33')][_0x8aa7('0x4d')]);_0x40468f['where']=qs[_0x8aa7('0x34')](_[_0x8aa7('0x3c')](_0x2d9011['query'],_0x4ec4e3['filters']));if(_0x2d9011[_0x8aa7('0x33')]['filter']){_0x40468f[_0x8aa7('0x3b')]=_[_0x8aa7('0x3d')](_0x40468f['where'],{'$or':_[_0x8aa7('0x32')](_0x40468f[_0x8aa7('0x37')],function(_0x4c1640){var _0x2b5027={};_0x2b5027[_0x4c1640]={'$like':'%'+_0x2d9011[_0x8aa7('0x33')][_0x8aa7('0x3f')]+'%'};return _0x2b5027;})});}_0x40468f=_[_0x8aa7('0x3d')]({},_0x40468f,_0x2d9011[_0x8aa7('0x40')]);return _0x3bc5e3[_0x8aa7('0x4c')](_0x40468f);}})[_0x8aa7('0x27')](function(_0x2d9c69){if(_0x2d9c69){_0x5cbfba=_0x2d9c69[_0x8aa7('0x38')];if(!_0x2d9011[_0x8aa7('0x33')]['hasOwnProperty'](_0x8aa7('0x39'))){_0x40468f[_0x8aa7('0x22')]=qs[_0x8aa7('0x22')](_0x2d9011[_0x8aa7('0x33')][_0x8aa7('0x22')]);_0x40468f['offset']=qs[_0x8aa7('0x1f')](_0x2d9011['query'][_0x8aa7('0x1f')]);}return _0x3bc5e3['getFields'](_0x40468f);}})[_0x8aa7('0x27')](function(_0x483241){if(_0x483241){return _0x483241?{'count':_0x5cbfba,'rows':_0x483241}:null;}})['then'](respondWithResult(_0x2a0135,null))[_0x8aa7('0x4b')](handleError(_0x2a0135,null));};exports[_0x8aa7('0x4e')]=function(_0x3e7092,_0xc33f33,_0x2332e1){var _0x5660f1={};var _0xeb209c={};var _0x5c5cb7;var _0x5cce45;return db[_0x8aa7('0x2c')][_0x8aa7('0x4f')]({'where':{'id':_0x3e7092[_0x8aa7('0x46')]['id']}})['then'](handleEntityNotFound(_0xc33f33,null))[_0x8aa7('0x27')](function(_0x576c15){if(_0x576c15){_0x5c5cb7=_0x576c15;_0xeb209c[_0x8aa7('0x31')]=_[_0x8aa7('0x47')](db[_0x8aa7('0x50')][_0x8aa7('0x2d')]);_0xeb209c['query']=_[_0x8aa7('0x47')](_0x3e7092['query']);_0xeb209c[_0x8aa7('0x34')]=_[_0x8aa7('0x35')](_0xeb209c[_0x8aa7('0x31')],_0xeb209c[_0x8aa7('0x33')]);_0x5660f1[_0x8aa7('0x37')]=_['intersection'](_0xeb209c[_0x8aa7('0x31')],qs['fields'](_0x3e7092['query']['fields']));_0x5660f1[_0x8aa7('0x37')]=_0x5660f1[_0x8aa7('0x37')][_0x8aa7('0x38')]?_0x5660f1[_0x8aa7('0x37')]:_0xeb209c[_0x8aa7('0x31')];_0x5660f1[_0x8aa7('0x3a')]=qs[_0x8aa7('0x4d')](_0x3e7092[_0x8aa7('0x33')]['sort']);_0x5660f1['where']=qs['filters'](_[_0x8aa7('0x3c')](_0x3e7092['query'],_0xeb209c['filters']));if(_0x3e7092[_0x8aa7('0x33')]['filter']){_0x5660f1['where']=_['merge'](_0x5660f1[_0x8aa7('0x3b')],{'$or':_[_0x8aa7('0x32')](_0x5660f1['attributes'],function(_0x3b7b1a){var _0x5de160={};_0x5de160[_0x3b7b1a]={'$like':'%'+_0x3e7092[_0x8aa7('0x33')][_0x8aa7('0x3f')]+'%'};return _0x5de160;})});}_0x5660f1=_['merge']({},_0x5660f1,_0x3e7092['options']);return _0x5c5cb7[_0x8aa7('0x4e')](_0x5660f1);}})['then'](function(_0x53bdd8){if(_0x53bdd8){_0x5cce45=_0x53bdd8[_0x8aa7('0x38')];if(!_0x3e7092[_0x8aa7('0x33')]['hasOwnProperty']('nolimit')){_0x5660f1[_0x8aa7('0x22')]=qs[_0x8aa7('0x22')](_0x3e7092['query'][_0x8aa7('0x22')]);_0x5660f1[_0x8aa7('0x1f')]=qs['offset'](_0x3e7092[_0x8aa7('0x33')][_0x8aa7('0x1f')]);}return _0x5c5cb7[_0x8aa7('0x4e')](_0x5660f1);}})[_0x8aa7('0x27')](function(_0x2866a8){if(_0x2866a8){return _0x2866a8?{'count':_0x5cce45,'rows':_0x2866a8}:null;}})['then'](respondWithResult(_0xc33f33,null))[_0x8aa7('0x4b')](handleError(_0xc33f33,null));};exports['getDescriptions']=function(_0x2863ac,_0x2a75f7,_0x3631a1){var _0x2e2950={};var _0x586588={};var _0x399f26;var _0x2d8600;return db['ServicenowConfiguration'][_0x8aa7('0x4f')]({'where':{'id':_0x2863ac[_0x8aa7('0x46')]['id']}})[_0x8aa7('0x27')](handleEntityNotFound(_0x2a75f7,null))[_0x8aa7('0x27')](function(_0x256d50){if(_0x256d50){_0x399f26=_0x256d50;_0x586588[_0x8aa7('0x31')]=_[_0x8aa7('0x47')](db[_0x8aa7('0x50')][_0x8aa7('0x2d')]);_0x586588[_0x8aa7('0x33')]=_[_0x8aa7('0x47')](_0x2863ac[_0x8aa7('0x33')]);_0x586588[_0x8aa7('0x34')]=_['intersection'](_0x586588[_0x8aa7('0x31')],_0x586588['query']);_0x2e2950[_0x8aa7('0x37')]=_[_0x8aa7('0x35')](_0x586588[_0x8aa7('0x31')],qs[_0x8aa7('0x36')](_0x2863ac['query']['fields']));_0x2e2950[_0x8aa7('0x37')]=_0x2e2950['attributes']['length']?_0x2e2950[_0x8aa7('0x37')]:_0x586588['model'];_0x2e2950[_0x8aa7('0x3a')]=qs[_0x8aa7('0x4d')](_0x2863ac[_0x8aa7('0x33')][_0x8aa7('0x4d')]);_0x2e2950[_0x8aa7('0x3b')]=qs[_0x8aa7('0x34')](_[_0x8aa7('0x3c')](_0x2863ac['query'],_0x586588[_0x8aa7('0x34')]));if(_0x2863ac[_0x8aa7('0x33')][_0x8aa7('0x3f')]){_0x2e2950[_0x8aa7('0x3b')]=_['merge'](_0x2e2950[_0x8aa7('0x3b')],{'$or':_[_0x8aa7('0x32')](_0x2e2950['attributes'],function(_0xb35589){var _0x2a5c9c={};_0x2a5c9c[_0xb35589]={'$like':'%'+_0x2863ac['query']['filter']+'%'};return _0x2a5c9c;})});}_0x2e2950=_['merge']({},_0x2e2950,_0x2863ac[_0x8aa7('0x40')]);return _0x399f26[_0x8aa7('0x51')](_0x2e2950);}})[_0x8aa7('0x27')](function(_0x17fc03){if(_0x17fc03){_0x2d8600=_0x17fc03[_0x8aa7('0x38')];if(!_0x2863ac[_0x8aa7('0x33')][_0x8aa7('0x52')](_0x8aa7('0x39'))){_0x2e2950[_0x8aa7('0x22')]=qs[_0x8aa7('0x22')](_0x2863ac[_0x8aa7('0x33')][_0x8aa7('0x22')]);_0x2e2950[_0x8aa7('0x1f')]=qs[_0x8aa7('0x1f')](_0x2863ac[_0x8aa7('0x33')][_0x8aa7('0x1f')]);}return _0x399f26['getDescriptions'](_0x2e2950);}})[_0x8aa7('0x27')](function(_0x256a65){if(_0x256a65){return _0x256a65?{'count':_0x2d8600,'rows':_0x256a65}:null;}})['then'](respondWithResult(_0x2a75f7,null))[_0x8aa7('0x4b')](handleError(_0x2a75f7,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index bda4924..1c36dda 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 _0x7462=['path','rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','moment'];(function(_0x40a9b5,_0x13265e){var _0x314e39=function(_0x59cd07){while(--_0x59cd07){_0x40a9b5['push'](_0x40a9b5['shift']());}};_0x314e39(++_0x13265e);}(_0x7462,0x165));var _0x2746=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7462[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x2746('0x0'));var util=require(_0x2746('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2746('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2746('0x3'));var rimraf=require(_0x2746('0x4'));var config=require('../../config/environment');var attributes=require(_0x2746('0x5'));module[_0x2746('0x6')]=function(_0x1c3371,_0x280dfb){return _0x1c3371[_0x2746('0x7')](_0x2746('0x8'),attributes,{'tableName':_0x2746('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x723c=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0x723c,0x1ad));var _0xc723=function(_0x558ffb,_0x5a93d9){_0x558ffb=_0x558ffb-0x0;var _0x78ab6a=_0x723c[_0x558ffb];return _0x78ab6a;};'use strict';var _=require('lodash');var util=require(_0xc723('0x0'));var logger=require(_0xc723('0x1'))('api');var moment=require(_0xc723('0x2'));var BPromise=require('bluebird');var rp=require(_0xc723('0x3'));var fs=require('fs');var path=require(_0xc723('0x4'));var rimraf=require(_0xc723('0x5'));var config=require(_0xc723('0x6'));var attributes=require(_0xc723('0x7'));module[_0xc723('0x8')]=function(_0xa08b3,_0x4eb5ff){return _0xa08b3[_0xc723('0x9')](_0xc723('0xa'),attributes,{'tableName':'int_servicenow_configurations','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 fd344d5..15b618f 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 _0x2f85=['../../config/logger','rpc','../../config/environment','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x11408b,_0x2e758a){var _0xf16c8d=function(_0x5a706f){while(--_0x5a706f){_0x11408b['push'](_0x11408b['shift']());}};_0xf16c8d(++_0x2e758a);}(_0x2f85,0xdf));var _0x52f8=function(_0x20e829,_0x1cf77a){_0x20e829=_0x20e829-0x0;var _0x2ba213=_0x2f85[_0x20e829];return _0x2ba213;};'use strict';var _=require(_0x52f8('0x0'));var util=require(_0x52f8('0x1'));var moment=require(_0x52f8('0x2'));var BPromise=require(_0x52f8('0x3'));var rs=require(_0x52f8('0x4'));var fs=require('fs');var Redis=require(_0x52f8('0x5'));var db=require(_0x52f8('0x6'))['db'];var utils=require(_0x52f8('0x7'));var logger=require(_0x52f8('0x8'))(_0x52f8('0x9'));var config=require(_0x52f8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x52f8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x455743,_0x324d38,_0x9f7ea6){return new BPromise(function(_0x58fc18,_0x124639){return client[_0x52f8('0xc')](_0x455743,_0x9f7ea6)[_0x52f8('0xd')](function(_0x52c959){logger[_0x52f8('0xe')](_0x52f8('0xf'),_0x324d38,_0x52f8('0x10'));logger['debug'](_0x52f8('0x11'),_0x324d38,_0x52f8('0x10'),JSON['stringify'](_0x52c959));if(_0x52c959[_0x52f8('0x12')]){if(_0x52c959[_0x52f8('0x12')][_0x52f8('0x13')]===0x1f4){logger[_0x52f8('0x12')](_0x52f8('0xf'),_0x324d38,_0x52c959[_0x52f8('0x12')][_0x52f8('0x14')]);return _0x124639(_0x52c959[_0x52f8('0x12')][_0x52f8('0x14')]);}logger[_0x52f8('0x12')](_0x52f8('0xf'),_0x324d38,_0x52c959[_0x52f8('0x12')][_0x52f8('0x14')]);return _0x58fc18(_0x52c959[_0x52f8('0x12')]['message']);}else{logger[_0x52f8('0xe')](_0x52f8('0xf'),_0x324d38,_0x52f8('0x10'));_0x58fc18(_0x52c959['result'][_0x52f8('0x14')]);}})['catch'](function(_0x41bf18){logger[_0x52f8('0x12')](_0x52f8('0xf'),_0x324d38,_0x41bf18);_0x124639(_0x41bf18);});});} \ No newline at end of file +var _0xed9b=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x366e75,_0x533d1d){var _0x3b167b=function(_0x3e9f1d){while(--_0x3e9f1d){_0x366e75['push'](_0x366e75['shift']());}};_0x3b167b(++_0x533d1d);}(_0xed9b,0xd2));var _0xbed9=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0xed9b[_0x382a62];return _0x490a25;};'use strict';var _=require('lodash');var util=require(_0xbed9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbed9('0x1'));var fs=require('fs');var Redis=require(_0xbed9('0x2'));var db=require(_0xbed9('0x3'))['db'];var utils=require(_0xbed9('0x4'));var logger=require(_0xbed9('0x5'))(_0xbed9('0x6'));var config=require(_0xbed9('0x7'));var jayson=require(_0xbed9('0x8'));var client=jayson['client'][_0xbed9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x707232,_0x5d404a,_0x2c7a27){return new BPromise(function(_0x4f65dc,_0x9c3f38){return client[_0xbed9('0xa')](_0x707232,_0x2c7a27)[_0xbed9('0xb')](function(_0x1f807a){logger[_0xbed9('0xc')](_0xbed9('0xd'),_0x5d404a,_0xbed9('0xe'));logger[_0xbed9('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5d404a,'request\x20sent',JSON[_0xbed9('0x10')](_0x1f807a));if(_0x1f807a[_0xbed9('0x11')]){if(_0x1f807a[_0xbed9('0x11')]['code']===0x1f4){logger[_0xbed9('0x11')](_0xbed9('0xd'),_0x5d404a,_0x1f807a[_0xbed9('0x11')][_0xbed9('0x12')]);return _0x9c3f38(_0x1f807a[_0xbed9('0x11')][_0xbed9('0x12')]);}logger[_0xbed9('0x11')](_0xbed9('0xd'),_0x5d404a,_0x1f807a[_0xbed9('0x11')][_0xbed9('0x12')]);return _0x4f65dc(_0x1f807a[_0xbed9('0x11')][_0xbed9('0x12')]);}else{logger[_0xbed9('0xc')](_0xbed9('0xd'),_0x5d404a,_0xbed9('0xe'));_0x4f65dc(_0x1f807a[_0xbed9('0x13')][_0xbed9('0x12')]);}})[_0xbed9('0x14')](function(_0x4f4d19){logger[_0xbed9('0x11')](_0xbed9('0xd'),_0x5d404a,_0x4f4d19);_0x9c3f38(_0x4f4d19);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3f84d90..e18ed8f 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 _0x9a7d=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','show','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x5d7185,_0x31fa85){var _0x2909e9=function(_0x3e927a){while(--_0x3e927a){_0x5d7185['push'](_0x5d7185['shift']());}};_0x2909e9(++_0x31fa85);}(_0x9a7d,0x11a));var _0xd9a7=function(_0x1e0288,_0xf26008){_0x1e0288=_0x1e0288-0x0;var _0x2510d9=_0x9a7d[_0x1e0288];return _0x2510d9;};'use strict';var multer=require(_0xd9a7('0x0'));var util=require(_0xd9a7('0x1'));var path=require(_0xd9a7('0x2'));var timeout=require(_0xd9a7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd9a7('0x4'));var auth=require(_0xd9a7('0x5'));var interaction=require(_0xd9a7('0x6'));var config=require(_0xd9a7('0x7'));var controller=require(_0xd9a7('0x8'));router[_0xd9a7('0x9')]('/',auth[_0xd9a7('0xa')](),controller['index']);router[_0xd9a7('0x9')]('/:id',auth[_0xd9a7('0xa')](),controller[_0xd9a7('0xb')]);router['post']('/',auth[_0xd9a7('0xa')](),controller[_0xd9a7('0xc')]);router['put'](_0xd9a7('0xd'),auth['isAuthenticated'](),controller[_0xd9a7('0xe')]);router[_0xd9a7('0xf')](_0xd9a7('0xd'),auth['isAuthenticated'](),controller[_0xd9a7('0x10')]);module[_0xd9a7('0x11')]=router; \ No newline at end of file +var _0xdfc5=['exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy'];(function(_0x56f43b,_0x12f74b){var _0x2a81de=function(_0x3e22c4){while(--_0x3e22c4){_0x56f43b['push'](_0x56f43b['shift']());}};_0x2a81de(++_0x12f74b);}(_0xdfc5,0x133));var _0x5dfc=function(_0x8eb1b7,_0x38a33b){_0x8eb1b7=_0x8eb1b7-0x0;var _0x39d8a2=_0xdfc5[_0x8eb1b7];return _0x39d8a2;};'use strict';var multer=require(_0x5dfc('0x0'));var util=require('util');var path=require(_0x5dfc('0x1'));var timeout=require(_0x5dfc('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5dfc('0x3'));var auth=require(_0x5dfc('0x4'));var interaction=require(_0x5dfc('0x5'));var config=require(_0x5dfc('0x6'));var controller=require(_0x5dfc('0x7'));router[_0x5dfc('0x8')]('/',auth[_0x5dfc('0x9')](),controller[_0x5dfc('0xa')]);router[_0x5dfc('0x8')](_0x5dfc('0xb'),auth[_0x5dfc('0x9')](),controller['show']);router['post']('/',auth[_0x5dfc('0x9')](),controller[_0x5dfc('0xc')]);router[_0x5dfc('0xd')](_0x5dfc('0xb'),auth[_0x5dfc('0x9')](),controller[_0x5dfc('0xe')]);router[_0x5dfc('0xf')]('/:id',auth[_0x5dfc('0x9')](),controller[_0x5dfc('0x10')]);module[_0x5dfc('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index f10f25f..86935c1 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 _0x2ff5=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0x2ff5,0x1a1));var _0x52ff=function(_0x59250d,_0x3faa07){_0x59250d=_0x59250d-0x0;var _0x7635eb=_0x2ff5[_0x59250d];return _0x7635eb;};'use strict';var Sequelize=require(_0x52ff('0x0'));module[_0x52ff('0x1')]={'type':{'type':Sequelize[_0x52ff('0x2')](_0x52ff('0x3'),_0x52ff('0x4'),_0x52ff('0x5'),_0x52ff('0x6'),_0x52ff('0x7')),'defaultValue':_0x52ff('0x3')},'content':{'type':Sequelize[_0x52ff('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x52ff('0x2')](_0x52ff('0x3'),_0x52ff('0x4'),_0x52ff('0x5'))},'keyContent':{'type':Sequelize[_0x52ff('0x8')]},'idField':{'type':Sequelize[_0x52ff('0x8')]},'nameField':{'type':Sequelize[_0x52ff('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x52ff('0x8')]}}; \ No newline at end of file +var _0xe34d=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xe34d,0x1b0));var _0xde34=function(_0x11b34a,_0x52229a){_0x11b34a=_0x11b34a-0x0;var _0x5fc431=_0xe34d[_0x11b34a];return _0x5fc431;};'use strict';var Sequelize=require('sequelize');module[_0xde34('0x0')]={'type':{'type':Sequelize[_0xde34('0x1')](_0xde34('0x2'),_0xde34('0x3'),_0xde34('0x4'),_0xde34('0x5'),'picklist'),'defaultValue':_0xde34('0x2')},'content':{'type':Sequelize[_0xde34('0x6')]},'key':{'type':Sequelize[_0xde34('0x6')]},'keyType':{'type':Sequelize[_0xde34('0x1')](_0xde34('0x2'),_0xde34('0x3'),_0xde34('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xde34('0x6')]},'nameField':{'type':Sequelize[_0xde34('0x6')]},'customField':{'type':Sequelize[_0xde34('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde34('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index d468d96..7668815 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 _0xc0dd=['show','params','rawAttributes','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','ServicenowField','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch'];(function(_0x38e341,_0x43d7ad){var _0x421d5b=function(_0x1a2b32){while(--_0x1a2b32){_0x38e341['push'](_0x38e341['shift']());}};_0x421d5b(++_0x43d7ad);}(_0xc0dd,0x13b));var _0xdc0d=function(_0x592fb6,_0x3e2218){_0x592fb6=_0x592fb6-0x0;var _0x5c6904=_0xc0dd[_0x592fb6];return _0x5c6904;};'use strict';var emlformat=require(_0xdc0d('0x0'));var rimraf=require(_0xdc0d('0x1'));var zipdir=require(_0xdc0d('0x2'));var jsonpatch=require(_0xdc0d('0x3'));var rp=require(_0xdc0d('0x4'));var moment=require(_0xdc0d('0x5'));var BPromise=require(_0xdc0d('0x6'));var Mustache=require(_0xdc0d('0x7'));var util=require(_0xdc0d('0x8'));var path=require(_0xdc0d('0x9'));var sox=require(_0xdc0d('0xa'));var csv=require(_0xdc0d('0xb'));var ejs=require(_0xdc0d('0xc'));var fs=require('fs');var fs_extra=require(_0xdc0d('0xd'));var _=require('lodash');var squel=require(_0xdc0d('0xe'));var crypto=require(_0xdc0d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xdc0d('0x10'));var toCsv=require(_0xdc0d('0xb'));var querystring=require(_0xdc0d('0x11'));var Papa=require(_0xdc0d('0x12'));var Redis=require(_0xdc0d('0x13'));var authService=require(_0xdc0d('0x14'));var qs=require(_0xdc0d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc0d('0x16'))('api');var utils=require(_0xdc0d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdc0d('0x18'));var db=require(_0xdc0d('0x19'))['db'];function respondWithStatusCode(_0x5815bf,_0x249821){_0x249821=_0x249821||0xcc;return function(_0x5ebd8f){if(_0x5ebd8f){return _0x5815bf['sendStatus'](_0x249821);}return _0x5815bf[_0xdc0d('0x1a')](_0x249821)[_0xdc0d('0x1b')]();};}function respondWithResult(_0xde6d74,_0x45cf7c){_0x45cf7c=_0x45cf7c||0xc8;return function(_0x1b5194){if(_0x1b5194){return _0xde6d74[_0xdc0d('0x1a')](_0x45cf7c)['json'](_0x1b5194);}};}function respondWithFilteredResult(_0x220e08,_0x46973b){return function(_0x2d3c6f){if(_0x2d3c6f){var _0x32f992=typeof _0x46973b[_0xdc0d('0x1c')]==='undefined'&&typeof _0x46973b[_0xdc0d('0x1d')]==='undefined';var _0x5310de=_0x2d3c6f[_0xdc0d('0x1e')];var _0x1017ee=_0x32f992?0x0:_0x46973b[_0xdc0d('0x1c')];var _0x33d743=_0x32f992?_0x2d3c6f[_0xdc0d('0x1e')]:_0x46973b[_0xdc0d('0x1c')]+_0x46973b[_0xdc0d('0x1d')];var _0x567878;if(_0x33d743>=_0x5310de){_0x33d743=_0x5310de;_0x567878=0xc8;}else{_0x567878=0xce;}_0x220e08[_0xdc0d('0x1a')](_0x567878);return _0x220e08['set'](_0xdc0d('0x1f'),_0x1017ee+'-'+_0x33d743+'/'+_0x5310de)[_0xdc0d('0x20')](_0x2d3c6f);}return null;};}function patchUpdates(_0x2f491e){return function(_0x5e0df2){try{jsonpatch[_0xdc0d('0x21')](_0x5e0df2,_0x2f491e,!![]);}catch(_0x2a6e55){return BPromise[_0xdc0d('0x22')](_0x2a6e55);}return _0x5e0df2[_0xdc0d('0x23')]();};}function saveUpdates(_0x4f8bed,_0x1fd164){return function(_0x53cb9e){if(_0x53cb9e){return _0x53cb9e[_0xdc0d('0x24')](_0x4f8bed)[_0xdc0d('0x25')](function(_0x26e51a){return _0x26e51a;});}return null;};}function removeEntity(_0x43caf9,_0x3abcbd){return function(_0x327728){if(_0x327728){return _0x327728[_0xdc0d('0x26')]()[_0xdc0d('0x25')](function(){_0x43caf9[_0xdc0d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a801a,_0x29b333){return function(_0x53dd1a){if(!_0x53dd1a){_0x4a801a[_0xdc0d('0x27')](0x194);}return _0x53dd1a;};}function handleError(_0xbea5ea,_0x19800f){_0x19800f=_0x19800f||0x1f4;return function(_0x82ae4b){logger[_0xdc0d('0x28')](_0x82ae4b[_0xdc0d('0x29')]);if(_0x82ae4b['name']){delete _0x82ae4b[_0xdc0d('0x2a')];}_0xbea5ea[_0xdc0d('0x1a')](_0x19800f)[_0xdc0d('0x2b')](_0x82ae4b);};}exports['index']=function(_0x83376,_0x3f3449){var _0x2f462f={},_0x37ef9e={},_0x397f82={'count':0x0,'rows':[]};var _0x2a29ed=_['map'](db[_0xdc0d('0x2c')]['rawAttributes'],function(_0x40a6ea){return{'name':_0x40a6ea[_0xdc0d('0x2d')],'type':_0x40a6ea[_0xdc0d('0x2e')][_0xdc0d('0x2f')]};});_0x37ef9e['model']=_[_0xdc0d('0x30')](_0x2a29ed,'name');_0x37ef9e[_0xdc0d('0x31')]=_[_0xdc0d('0x32')](_0x83376['query']);_0x37ef9e['filters']=_[_0xdc0d('0x33')](_0x37ef9e[_0xdc0d('0x34')],_0x37ef9e[_0xdc0d('0x31')]);_0x2f462f[_0xdc0d('0x35')]=_[_0xdc0d('0x33')](_0x37ef9e['model'],qs[_0xdc0d('0x36')](_0x83376[_0xdc0d('0x31')][_0xdc0d('0x36')]));_0x2f462f[_0xdc0d('0x35')]=_0x2f462f['attributes'][_0xdc0d('0x37')]?_0x2f462f[_0xdc0d('0x35')]:_0x37ef9e[_0xdc0d('0x34')];if(!_0x83376[_0xdc0d('0x31')][_0xdc0d('0x38')](_0xdc0d('0x39'))){_0x2f462f[_0xdc0d('0x1d')]=qs['limit'](_0x83376[_0xdc0d('0x31')][_0xdc0d('0x1d')]);_0x2f462f[_0xdc0d('0x1c')]=qs[_0xdc0d('0x1c')](_0x83376['query'][_0xdc0d('0x1c')]);}_0x2f462f[_0xdc0d('0x3a')]=qs[_0xdc0d('0x3b')](_0x83376[_0xdc0d('0x31')][_0xdc0d('0x3b')]);_0x2f462f[_0xdc0d('0x3c')]=qs[_0xdc0d('0x3d')](_[_0xdc0d('0x3e')](_0x83376['query'],_0x37ef9e[_0xdc0d('0x3d')]),_0x2a29ed);if(_0x83376['query'][_0xdc0d('0x3f')]){_0x2f462f[_0xdc0d('0x3c')]=_[_0xdc0d('0x40')](_0x2f462f[_0xdc0d('0x3c')],{'$or':_[_0xdc0d('0x30')](_0x2a29ed,function(_0xab9bd2){if(_0xab9bd2[_0xdc0d('0x2e')]!=='VIRTUAL'){var _0x3ec84c={};_0x3ec84c[_0xab9bd2[_0xdc0d('0x2a')]]={'$like':'%'+_0x83376[_0xdc0d('0x31')][_0xdc0d('0x3f')]+'%'};return _0x3ec84c;}})});}_0x2f462f=_['merge']({},_0x2f462f,_0x83376['options']);var _0x43fdbd={'where':_0x2f462f[_0xdc0d('0x3c')]};return db[_0xdc0d('0x2c')][_0xdc0d('0x1e')](_0x43fdbd)[_0xdc0d('0x25')](function(_0x5b0f08){_0x397f82[_0xdc0d('0x1e')]=_0x5b0f08;if(_0x83376['query'][_0xdc0d('0x41')]){_0x2f462f[_0xdc0d('0x42')]=[{'all':!![]}];}return db['ServicenowField'][_0xdc0d('0x43')](_0x2f462f);})[_0xdc0d('0x25')](function(_0x4ea72b){_0x397f82[_0xdc0d('0x44')]=_0x4ea72b;return _0x397f82;})['then'](respondWithFilteredResult(_0x3f3449,_0x2f462f))[_0xdc0d('0x45')](handleError(_0x3f3449,null));};exports[_0xdc0d('0x46')]=function(_0x597db6,_0x1f7601){var _0x171370={'raw':!![],'where':{'id':_0x597db6[_0xdc0d('0x47')]['id']}},_0x2a508c={};_0x2a508c[_0xdc0d('0x34')]=_[_0xdc0d('0x32')](db[_0xdc0d('0x2c')][_0xdc0d('0x48')]);_0x2a508c['query']=_[_0xdc0d('0x32')](_0x597db6['query']);_0x2a508c[_0xdc0d('0x3d')]=_[_0xdc0d('0x33')](_0x2a508c[_0xdc0d('0x34')],_0x2a508c[_0xdc0d('0x31')]);_0x171370[_0xdc0d('0x35')]=_[_0xdc0d('0x33')](_0x2a508c[_0xdc0d('0x34')],qs[_0xdc0d('0x36')](_0x597db6['query'][_0xdc0d('0x36')]));_0x171370[_0xdc0d('0x35')]=_0x171370[_0xdc0d('0x35')][_0xdc0d('0x37')]?_0x171370[_0xdc0d('0x35')]:_0x2a508c[_0xdc0d('0x34')];if(_0x597db6['query'][_0xdc0d('0x41')]){_0x171370[_0xdc0d('0x42')]=[{'all':!![]}];}_0x171370=_[_0xdc0d('0x40')]({},_0x171370,_0x597db6[_0xdc0d('0x49')]);return db['ServicenowField'][_0xdc0d('0x4a')](_0x171370)[_0xdc0d('0x25')](handleEntityNotFound(_0x1f7601,null))['then'](respondWithResult(_0x1f7601,null))[_0xdc0d('0x45')](handleError(_0x1f7601,null));};exports[_0xdc0d('0x4b')]=function(_0x846b79,_0x3646b0){return db[_0xdc0d('0x2c')][_0xdc0d('0x4b')](_0x846b79[_0xdc0d('0x4c')],{})[_0xdc0d('0x25')](respondWithResult(_0x3646b0,0xc9))[_0xdc0d('0x45')](handleError(_0x3646b0,null));};exports['update']=function(_0x1b7dd2,_0x7b795f){if(_0x1b7dd2[_0xdc0d('0x4c')]['id']){delete _0x1b7dd2[_0xdc0d('0x4c')]['id'];}return db['ServicenowField'][_0xdc0d('0x4a')]({'where':{'id':_0x1b7dd2['params']['id']}})['then'](handleEntityNotFound(_0x7b795f,null))[_0xdc0d('0x25')](saveUpdates(_0x1b7dd2[_0xdc0d('0x4c')],null))['then'](respondWithResult(_0x7b795f,null))[_0xdc0d('0x45')](handleError(_0x7b795f,null));};exports[_0xdc0d('0x26')]=function(_0x1979a6,_0x21f9d2){return db[_0xdc0d('0x2c')][_0xdc0d('0x4a')]({'where':{'id':_0x1979a6[_0xdc0d('0x47')]['id']}})['then'](handleEntityNotFound(_0x21f9d2,null))[_0xdc0d('0x25')](removeEntity(_0x21f9d2,null))[_0xdc0d('0x45')](handleError(_0x21f9d2,null));}; \ No newline at end of file +var _0xc57a=['create','update','body','params','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ServicenowField','findAll','catch','show','keys','length','find'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xc57a,0x1ba));var _0xac57=function(_0x5b8685,_0x1a1c28){_0x5b8685=_0x5b8685-0x0;var _0xa3ef57=_0xc57a[_0x5b8685];return _0xa3ef57;};'use strict';var emlformat=require(_0xac57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac57('0x1'));var jsonpatch=require(_0xac57('0x2'));var rp=require('request-promise');var moment=require(_0xac57('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xac57('0x4'));var util=require(_0xac57('0x5'));var path=require(_0xac57('0x6'));var sox=require(_0xac57('0x7'));var csv=require(_0xac57('0x8'));var ejs=require(_0xac57('0x9'));var fs=require('fs');var fs_extra=require(_0xac57('0xa'));var _=require(_0xac57('0xb'));var squel=require(_0xac57('0xc'));var crypto=require(_0xac57('0xd'));var jsforce=require(_0xac57('0xe'));var deskjs=require(_0xac57('0xf'));var toCsv=require(_0xac57('0x8'));var querystring=require(_0xac57('0x10'));var Papa=require(_0xac57('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xac57('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac57('0x13'));var logger=require(_0xac57('0x14'))(_0xac57('0x15'));var utils=require('../../config/utils');var config=require(_0xac57('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xac57('0x17'))['db'];function respondWithStatusCode(_0x974d58,_0x47c0ed){_0x47c0ed=_0x47c0ed||0xcc;return function(_0x26dbbd){if(_0x26dbbd){return _0x974d58['sendStatus'](_0x47c0ed);}return _0x974d58[_0xac57('0x18')](_0x47c0ed)[_0xac57('0x19')]();};}function respondWithResult(_0x58e951,_0x3d7379){_0x3d7379=_0x3d7379||0xc8;return function(_0x28830a){if(_0x28830a){return _0x58e951[_0xac57('0x18')](_0x3d7379)['json'](_0x28830a);}};}function respondWithFilteredResult(_0x3df109,_0x47f560){return function(_0x54f4e7){if(_0x54f4e7){var _0x4b9d97=typeof _0x47f560[_0xac57('0x1a')]===_0xac57('0x1b')&&typeof _0x47f560[_0xac57('0x1c')]===_0xac57('0x1b');var _0xb9e9ed=_0x54f4e7[_0xac57('0x1d')];var _0x37e0d9=_0x4b9d97?0x0:_0x47f560['offset'];var _0x3827c2=_0x4b9d97?_0x54f4e7[_0xac57('0x1d')]:_0x47f560[_0xac57('0x1a')]+_0x47f560['limit'];var _0xcd236c;if(_0x3827c2>=_0xb9e9ed){_0x3827c2=_0xb9e9ed;_0xcd236c=0xc8;}else{_0xcd236c=0xce;}_0x3df109[_0xac57('0x18')](_0xcd236c);return _0x3df109['set'](_0xac57('0x1e'),_0x37e0d9+'-'+_0x3827c2+'/'+_0xb9e9ed)[_0xac57('0x1f')](_0x54f4e7);}return null;};}function patchUpdates(_0x91190c){return function(_0x5a9e74){try{jsonpatch['apply'](_0x5a9e74,_0x91190c,!![]);}catch(_0x4a01c7){return BPromise[_0xac57('0x20')](_0x4a01c7);}return _0x5a9e74[_0xac57('0x21')]();};}function saveUpdates(_0x26cf58,_0x125fca){return function(_0x540b88){if(_0x540b88){return _0x540b88['update'](_0x26cf58)[_0xac57('0x22')](function(_0x47cd7d){return _0x47cd7d;});}return null;};}function removeEntity(_0x548018,_0x38d1b1){return function(_0x20d165){if(_0x20d165){return _0x20d165[_0xac57('0x23')]()[_0xac57('0x22')](function(){_0x548018[_0xac57('0x18')](0xcc)[_0xac57('0x19')]();});}};}function handleEntityNotFound(_0x2e01b2,_0x4566c4){return function(_0x21b9e4){if(!_0x21b9e4){_0x2e01b2[_0xac57('0x24')](0x194);}return _0x21b9e4;};}function handleError(_0x3b73dc,_0xc870e){_0xc870e=_0xc870e||0x1f4;return function(_0x37790e){logger[_0xac57('0x25')](_0x37790e[_0xac57('0x26')]);if(_0x37790e[_0xac57('0x27')]){delete _0x37790e['name'];}_0x3b73dc[_0xac57('0x18')](_0xc870e)['send'](_0x37790e);};}exports[_0xac57('0x28')]=function(_0x190bc9,_0x30aaac){var _0x4c26fd={},_0x4051f6={},_0xde003f={'count':0x0,'rows':[]};var _0x5bd70c=_[_0xac57('0x29')](db['ServicenowField'][_0xac57('0x2a')],function(_0x7999f0){return{'name':_0x7999f0[_0xac57('0x2b')],'type':_0x7999f0[_0xac57('0x2c')]['key']};});_0x4051f6[_0xac57('0x2d')]=_[_0xac57('0x29')](_0x5bd70c,_0xac57('0x27'));_0x4051f6[_0xac57('0x2e')]=_['keys'](_0x190bc9['query']);_0x4051f6[_0xac57('0x2f')]=_[_0xac57('0x30')](_0x4051f6[_0xac57('0x2d')],_0x4051f6[_0xac57('0x2e')]);_0x4c26fd[_0xac57('0x31')]=_[_0xac57('0x30')](_0x4051f6[_0xac57('0x2d')],qs[_0xac57('0x32')](_0x190bc9[_0xac57('0x2e')][_0xac57('0x32')]));_0x4c26fd[_0xac57('0x31')]=_0x4c26fd['attributes']['length']?_0x4c26fd[_0xac57('0x31')]:_0x4051f6['model'];if(!_0x190bc9[_0xac57('0x2e')][_0xac57('0x33')](_0xac57('0x34'))){_0x4c26fd[_0xac57('0x1c')]=qs[_0xac57('0x1c')](_0x190bc9[_0xac57('0x2e')][_0xac57('0x1c')]);_0x4c26fd[_0xac57('0x1a')]=qs[_0xac57('0x1a')](_0x190bc9[_0xac57('0x2e')][_0xac57('0x1a')]);}_0x4c26fd['order']=qs[_0xac57('0x35')](_0x190bc9[_0xac57('0x2e')][_0xac57('0x35')]);_0x4c26fd[_0xac57('0x36')]=qs[_0xac57('0x2f')](_[_0xac57('0x37')](_0x190bc9[_0xac57('0x2e')],_0x4051f6['filters']),_0x5bd70c);if(_0x190bc9[_0xac57('0x2e')][_0xac57('0x38')]){_0x4c26fd[_0xac57('0x36')]=_[_0xac57('0x39')](_0x4c26fd[_0xac57('0x36')],{'$or':_[_0xac57('0x29')](_0x5bd70c,function(_0x2c9ad0){if(_0x2c9ad0[_0xac57('0x2c')]!==_0xac57('0x3a')){var _0x2a32a5={};_0x2a32a5[_0x2c9ad0[_0xac57('0x27')]]={'$like':'%'+_0x190bc9[_0xac57('0x2e')][_0xac57('0x38')]+'%'};return _0x2a32a5;}})});}_0x4c26fd=_[_0xac57('0x39')]({},_0x4c26fd,_0x190bc9[_0xac57('0x3b')]);var _0xa6adb6={'where':_0x4c26fd[_0xac57('0x36')]};return db['ServicenowField']['count'](_0xa6adb6)['then'](function(_0x10d9d8){_0xde003f[_0xac57('0x1d')]=_0x10d9d8;if(_0x190bc9['query'][_0xac57('0x3c')]){_0x4c26fd[_0xac57('0x3d')]=[{'all':!![]}];}return db[_0xac57('0x3e')][_0xac57('0x3f')](_0x4c26fd);})['then'](function(_0xa200f9){_0xde003f['rows']=_0xa200f9;return _0xde003f;})[_0xac57('0x22')](respondWithFilteredResult(_0x30aaac,_0x4c26fd))[_0xac57('0x40')](handleError(_0x30aaac,null));};exports[_0xac57('0x41')]=function(_0x529c44,_0xbd48cb){var _0x232c22={'raw':!![],'where':{'id':_0x529c44['params']['id']}},_0x2b0bd4={};_0x2b0bd4[_0xac57('0x2d')]=_[_0xac57('0x42')](db[_0xac57('0x3e')][_0xac57('0x2a')]);_0x2b0bd4[_0xac57('0x2e')]=_[_0xac57('0x42')](_0x529c44['query']);_0x2b0bd4[_0xac57('0x2f')]=_[_0xac57('0x30')](_0x2b0bd4[_0xac57('0x2d')],_0x2b0bd4[_0xac57('0x2e')]);_0x232c22[_0xac57('0x31')]=_[_0xac57('0x30')](_0x2b0bd4['model'],qs[_0xac57('0x32')](_0x529c44[_0xac57('0x2e')][_0xac57('0x32')]));_0x232c22[_0xac57('0x31')]=_0x232c22[_0xac57('0x31')][_0xac57('0x43')]?_0x232c22[_0xac57('0x31')]:_0x2b0bd4[_0xac57('0x2d')];if(_0x529c44[_0xac57('0x2e')][_0xac57('0x3c')]){_0x232c22['include']=[{'all':!![]}];}_0x232c22=_[_0xac57('0x39')]({},_0x232c22,_0x529c44['options']);return db[_0xac57('0x3e')][_0xac57('0x44')](_0x232c22)[_0xac57('0x22')](handleEntityNotFound(_0xbd48cb,null))['then'](respondWithResult(_0xbd48cb,null))[_0xac57('0x40')](handleError(_0xbd48cb,null));};exports[_0xac57('0x45')]=function(_0x10c84e,_0x1d42d2){return db[_0xac57('0x3e')][_0xac57('0x45')](_0x10c84e['body'],{})[_0xac57('0x22')](respondWithResult(_0x1d42d2,0xc9))[_0xac57('0x40')](handleError(_0x1d42d2,null));};exports[_0xac57('0x46')]=function(_0x4595c2,_0x14c6ca){if(_0x4595c2[_0xac57('0x47')]['id']){delete _0x4595c2[_0xac57('0x47')]['id'];}return db['ServicenowField'][_0xac57('0x44')]({'where':{'id':_0x4595c2[_0xac57('0x48')]['id']}})[_0xac57('0x22')](handleEntityNotFound(_0x14c6ca,null))[_0xac57('0x22')](saveUpdates(_0x4595c2[_0xac57('0x47')],null))[_0xac57('0x22')](respondWithResult(_0x14c6ca,null))['catch'](handleError(_0x14c6ca,null));};exports[_0xac57('0x23')]=function(_0x2d8ffa,_0x70cebe){return db[_0xac57('0x3e')][_0xac57('0x44')]({'where':{'id':_0x2d8ffa['params']['id']}})['then'](handleEntityNotFound(_0x70cebe,null))['then'](removeEntity(_0x70cebe,null))['catch'](handleError(_0x70cebe,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 2092a74..2ac838d 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 _0x6347=['exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','rimraf','./intServicenowField.attributes'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x6347,0x1c9));var _0x7634=function(_0x1700ef,_0x336347){_0x1700ef=_0x1700ef-0x0;var _0xcf98e5=_0x6347[_0x1700ef];return _0xcf98e5;};'use strict';var _=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var logger=require('../../config/logger')(_0x7634('0x2'));var moment=require(_0x7634('0x3'));var BPromise=require(_0x7634('0x4'));var rp=require(_0x7634('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7634('0x6'));var config=require('../../config/environment');var attributes=require(_0x7634('0x7'));module[_0x7634('0x8')]=function(_0x56d2ad,_0x58d043){return _0x56d2ad[_0x7634('0x9')](_0x7634('0xa'),attributes,{'tableName':_0x7634('0xb'),'paranoid':![],'indexes':[{'name':_0x7634('0xc'),'fields':[_0x7634('0xd'),_0x7634('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36f3=['./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3cab38,_0x439e61){var _0x187d60=function(_0x285a14){while(--_0x285a14){_0x3cab38['push'](_0x3cab38['shift']());}};_0x187d60(++_0x439e61);}(_0x36f3,0x180));var _0x336f=function(_0x29a39d,_0x4c9e6c){_0x29a39d=_0x29a39d-0x0;var _0x561210=_0x36f3[_0x29a39d];return _0x561210;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x336f('0x0'))(_0x336f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x336f('0x2'));var fs=require('fs');var path=require(_0x336f('0x3'));var rimraf=require(_0x336f('0x4'));var config=require(_0x336f('0x5'));var attributes=require(_0x336f('0x6'));module[_0x336f('0x7')]=function(_0x2f85c1,_0xd107a7){return _0x2f85c1[_0x336f('0x8')](_0x336f('0x9'),attributes,{'tableName':_0x336f('0xa'),'paranoid':![],'indexes':[{'name':_0x336f('0xb'),'fields':[_0x336f('0xc'),'FieldId'],'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 0c8563f..1f9974e 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 _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x33cece,_0x54b9da){var _0x1a2efd=function(_0x3745e6){while(--_0x3745e6){_0x33cece['push'](_0x33cece['shift']());}};_0x1a2efd(++_0x54b9da);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4d0c91,_0x4a4c4b){_0x4d0c91=_0x4d0c91-0x0;var _0x5e0d45=_0xf4eb[_0x4d0c91];return _0x5e0d45;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x383082,_0x3bfc3b){var _0x86bd64=function(_0x558704){while(--_0x558704){_0x383082['push'](_0x383082['shift']());}};_0x86bd64(++_0x3bfc3b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x143565,_0x54d887){_0x143565=_0x143565-0x0;var _0x4dc1d9=_0xcb91[_0x143565];return _0x4dc1d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index c2efd00..d7ba0ae 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(_0x4eb930,_0x788569){var _0x26c8e5=function(_0x2e6f07){while(--_0x2e6f07){_0x4eb930['push'](_0x4eb930['shift']());}};_0x26c8e5(++_0x788569);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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(_0x5e5e77,_0x7cddb5){var _0x3f0a23=function(_0x112905){while(--_0x112905){_0x5e5e77['push'](_0x5e5e77['shift']());}};_0x3f0a23(++_0x7cddb5);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 094fdf9..3b485f8 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(_0x52b0bb,_0x5821a8){var _0x178df6=function(_0x1a995f){while(--_0x1a995f){_0x52b0bb['push'](_0x52b0bb['shift']());}};_0x178df6(++_0x5821a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0xd8671e,_0x11627b){var _0x2ba27d=function(_0x4bfc9e){while(--_0x4bfc9e){_0xd8671e['push'](_0xd8671e['shift']());}};_0x2ba27d(++_0x11627b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 3307de6..1971eb2 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 _0x4c46=['Descriptions','getDescriptions','create','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','xCALLY\x20Motion\x20Integration','get_module_fields','values','module_fields','remove','includes','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','channel'];(function(_0x313bba,_0x27efee){var _0x4b33e4=function(_0x3d6264){while(--_0x3d6264){_0x313bba['push'](_0x313bba['shift']());}};_0x4b33e4(++_0x27efee);}(_0x4c46,0x111));var _0x64c4=function(_0x5f132f,_0x1347e6){_0x5f132f=_0x5f132f-0x0;var _0xdc3571=_0x4c46[_0x5f132f];return _0xdc3571;};'use strict';var emlformat=require(_0x64c4('0x0'));var rimraf=require(_0x64c4('0x1'));var zipdir=require(_0x64c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x64c4('0x3'));var BPromise=require(_0x64c4('0x4'));var Mustache=require(_0x64c4('0x5'));var util=require(_0x64c4('0x6'));var path=require(_0x64c4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x64c4('0x8'));var _=require(_0x64c4('0x9'));var squel=require(_0x64c4('0xa'));var crypto=require('crypto');var jsforce=require(_0x64c4('0xb'));var deskjs=require(_0x64c4('0xc'));var toCsv=require(_0x64c4('0xd'));var querystring=require(_0x64c4('0xe'));var Papa=require(_0x64c4('0xf'));var Redis=require(_0x64c4('0x10'));var authService=require(_0x64c4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64c4('0x12'));var logger=require(_0x64c4('0x13'))(_0x64c4('0x14'));var utils=require(_0x64c4('0x15'));var config=require(_0x64c4('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x26dd4c,_0x36645f){_0x36645f=_0x36645f||0xcc;return function(_0x1cc828){if(_0x1cc828){return _0x26dd4c[_0x64c4('0x17')](_0x36645f);}return _0x26dd4c[_0x64c4('0x18')](_0x36645f)[_0x64c4('0x19')]();};}function respondWithResult(_0x318bee,_0x54dc8c){_0x54dc8c=_0x54dc8c||0xc8;return function(_0x441c9d){if(_0x441c9d){return _0x318bee[_0x64c4('0x18')](_0x54dc8c)[_0x64c4('0x1a')](_0x441c9d);}};}function respondWithFilteredResult(_0x2e40d7,_0x3f541e){return function(_0x375fc3){if(_0x375fc3){var _0x23434c=typeof _0x3f541e[_0x64c4('0x1b')]===_0x64c4('0x1c')&&typeof _0x3f541e[_0x64c4('0x1d')]===_0x64c4('0x1c');var _0x36942e=_0x375fc3[_0x64c4('0x1e')];var _0x5757c0=_0x23434c?0x0:_0x3f541e[_0x64c4('0x1b')];var _0x447ea4=_0x23434c?_0x375fc3[_0x64c4('0x1e')]:_0x3f541e['offset']+_0x3f541e[_0x64c4('0x1d')];var _0x4c777f;if(_0x447ea4>=_0x36942e){_0x447ea4=_0x36942e;_0x4c777f=0xc8;}else{_0x4c777f=0xce;}_0x2e40d7['status'](_0x4c777f);return _0x2e40d7[_0x64c4('0x1f')](_0x64c4('0x20'),_0x5757c0+'-'+_0x447ea4+'/'+_0x36942e)[_0x64c4('0x1a')](_0x375fc3);}return null;};}function patchUpdates(_0x381ac6){return function(_0x277885){try{jsonpatch['apply'](_0x277885,_0x381ac6,!![]);}catch(_0xc5334e){return BPromise[_0x64c4('0x21')](_0xc5334e);}return _0x277885['save']();};}function saveUpdates(_0x518868,_0x2ea6fd){return function(_0x5da21c){if(_0x5da21c){return _0x5da21c[_0x64c4('0x22')](_0x518868)[_0x64c4('0x23')](function(_0x52e473){return _0x52e473;});}return null;};}function removeEntity(_0x4c816d,_0x9cc7b8){return function(_0x1d7a9d){if(_0x1d7a9d){return _0x1d7a9d[_0x64c4('0x24')]()[_0x64c4('0x23')](function(){_0x4c816d[_0x64c4('0x18')](0xcc)[_0x64c4('0x19')]();});}};}function handleEntityNotFound(_0x4944a8,_0x2c5eee){return function(_0x28ccb5){if(!_0x28ccb5){_0x4944a8[_0x64c4('0x17')](0x194);}return _0x28ccb5;};}function handleError(_0x361f5f,_0x23b22c){_0x23b22c=_0x23b22c||0x1f4;return function(_0xee2877){logger[_0x64c4('0x25')](_0xee2877[_0x64c4('0x26')]);if(_0xee2877['name']){delete _0xee2877[_0x64c4('0x27')];}_0x361f5f['status'](_0x23b22c)['send'](_0xee2877);};}exports[_0x64c4('0x28')]=function(_0x3e258d,_0x1d370e){var _0x2b7db6={},_0x6fb9c8={},_0xace5c0={'count':0x0,'rows':[]};var _0x5d4809=_[_0x64c4('0x29')](db[_0x64c4('0x2a')][_0x64c4('0x2b')],function(_0x1eb732){return{'name':_0x1eb732[_0x64c4('0x2c')],'type':_0x1eb732[_0x64c4('0x2d')][_0x64c4('0x2e')]};});_0x6fb9c8[_0x64c4('0x2f')]=_['map'](_0x5d4809,'name');_0x6fb9c8[_0x64c4('0x30')]=_[_0x64c4('0x31')](_0x3e258d[_0x64c4('0x30')]);_0x6fb9c8['filters']=_[_0x64c4('0x32')](_0x6fb9c8['model'],_0x6fb9c8['query']);_0x2b7db6['attributes']=_['intersection'](_0x6fb9c8[_0x64c4('0x2f')],qs[_0x64c4('0x33')](_0x3e258d[_0x64c4('0x30')]['fields']));_0x2b7db6[_0x64c4('0x34')]=_0x2b7db6['attributes'][_0x64c4('0x35')]?_0x2b7db6[_0x64c4('0x34')]:_0x6fb9c8[_0x64c4('0x2f')];if(!_0x3e258d[_0x64c4('0x30')][_0x64c4('0x36')](_0x64c4('0x37'))){_0x2b7db6['limit']=qs[_0x64c4('0x1d')](_0x3e258d[_0x64c4('0x30')][_0x64c4('0x1d')]);_0x2b7db6['offset']=qs[_0x64c4('0x1b')](_0x3e258d[_0x64c4('0x30')]['offset']);}_0x2b7db6[_0x64c4('0x38')]=qs[_0x64c4('0x39')](_0x3e258d[_0x64c4('0x30')][_0x64c4('0x39')]);_0x2b7db6[_0x64c4('0x3a')]=qs[_0x64c4('0x3b')](_[_0x64c4('0x3c')](_0x3e258d['query'],_0x6fb9c8[_0x64c4('0x3b')]),_0x5d4809);if(_0x3e258d[_0x64c4('0x30')][_0x64c4('0x3d')]){_0x2b7db6[_0x64c4('0x3a')]=_[_0x64c4('0x3e')](_0x2b7db6[_0x64c4('0x3a')],{'$or':_[_0x64c4('0x29')](_0x5d4809,function(_0x3cae11){if(_0x3cae11['type']!==_0x64c4('0x3f')){var _0x2c7411={};_0x2c7411[_0x3cae11[_0x64c4('0x27')]]={'$like':'%'+_0x3e258d[_0x64c4('0x30')][_0x64c4('0x3d')]+'%'};return _0x2c7411;}})});}_0x2b7db6=_[_0x64c4('0x3e')]({},_0x2b7db6,_0x3e258d[_0x64c4('0x40')]);var _0x44a938={'where':_0x2b7db6[_0x64c4('0x3a')]};return db[_0x64c4('0x2a')][_0x64c4('0x1e')](_0x44a938)[_0x64c4('0x23')](function(_0x4fdd93){_0xace5c0[_0x64c4('0x1e')]=_0x4fdd93;if(_0x3e258d[_0x64c4('0x30')][_0x64c4('0x41')]){_0x2b7db6[_0x64c4('0x42')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x64c4('0x43')](_0x2b7db6);})[_0x64c4('0x23')](function(_0x291072){_0xace5c0[_0x64c4('0x44')]=_0x291072;return _0xace5c0;})[_0x64c4('0x23')](respondWithFilteredResult(_0x1d370e,_0x2b7db6))[_0x64c4('0x45')](handleError(_0x1d370e,null));};exports[_0x64c4('0x46')]=function(_0xa0a1dd,_0x3f839c){var _0x40c8e5={'raw':![],'where':{'id':_0xa0a1dd[_0x64c4('0x47')]['id']}},_0xa4fffb={};_0xa4fffb[_0x64c4('0x2f')]=_['keys'](db['SugarcrmAccount'][_0x64c4('0x2b')]);_0xa4fffb[_0x64c4('0x30')]=_[_0x64c4('0x31')](_0xa0a1dd['query']);_0xa4fffb[_0x64c4('0x3b')]=_[_0x64c4('0x32')](_0xa4fffb['model'],_0xa4fffb[_0x64c4('0x30')]);_0x40c8e5[_0x64c4('0x34')]=_[_0x64c4('0x32')](_0xa4fffb[_0x64c4('0x2f')],qs[_0x64c4('0x33')](_0xa0a1dd[_0x64c4('0x30')][_0x64c4('0x33')]));_0x40c8e5[_0x64c4('0x34')]=_0x40c8e5[_0x64c4('0x34')]['length']?_0x40c8e5['attributes']:_0xa4fffb[_0x64c4('0x2f')];if(_0xa0a1dd[_0x64c4('0x30')]['includeAll']){_0x40c8e5['include']=[{'all':!![]}];}_0x40c8e5=_[_0x64c4('0x3e')]({},_0x40c8e5,_0xa0a1dd[_0x64c4('0x40')]);return db[_0x64c4('0x2a')][_0x64c4('0x48')](_0x40c8e5)['then'](handleEntityNotFound(_0x3f839c,null))['then'](respondWithResult(_0x3f839c,null))[_0x64c4('0x45')](handleError(_0x3f839c,null));};exports['create']=function(_0x2e0bea,_0xd581e2){return db['SugarcrmAccount']['create'](_0x2e0bea[_0x64c4('0x49')],{})[_0x64c4('0x23')](respondWithResult(_0xd581e2,0xc9))[_0x64c4('0x45')](handleError(_0xd581e2,null));};exports[_0x64c4('0x22')]=function(_0x2f2123,_0x185ea3){if(_0x2f2123[_0x64c4('0x49')]['id']){delete _0x2f2123[_0x64c4('0x49')]['id'];}return db[_0x64c4('0x2a')][_0x64c4('0x48')]({'where':{'id':_0x2f2123[_0x64c4('0x47')]['id']}})[_0x64c4('0x23')](handleEntityNotFound(_0x185ea3,null))['then'](saveUpdates(_0x2f2123[_0x64c4('0x49')],null))[_0x64c4('0x23')](respondWithResult(_0x185ea3,null))['catch'](handleError(_0x185ea3,null));};exports[_0x64c4('0x24')]=function(_0x3adc62,_0x3c09f1){return db[_0x64c4('0x2a')][_0x64c4('0x48')]({'where':{'id':_0x3adc62['params']['id']}})[_0x64c4('0x23')](handleEntityNotFound(_0x3c09f1,null))[_0x64c4('0x23')](removeEntity(_0x3c09f1,null))[_0x64c4('0x45')](handleError(_0x3c09f1,null));};exports[_0x64c4('0x4a')]=function(_0x39cfbb,_0x147995,_0x1f9185){var _0x2708b6={};var _0x534260={};var _0x22ab25;var _0x397d97;return db[_0x64c4('0x2a')][_0x64c4('0x4b')]({'where':{'id':_0x39cfbb[_0x64c4('0x47')]['id']}})[_0x64c4('0x23')](handleEntityNotFound(_0x147995,null))[_0x64c4('0x23')](function(_0x421e10){if(_0x421e10){_0x22ab25=_0x421e10;_0x534260[_0x64c4('0x2f')]=_[_0x64c4('0x31')](db[_0x64c4('0x4c')][_0x64c4('0x2b')]);_0x534260['query']=_[_0x64c4('0x31')](_0x39cfbb[_0x64c4('0x30')]);_0x534260[_0x64c4('0x3b')]=_[_0x64c4('0x32')](_0x534260['model'],_0x534260['query']);_0x2708b6[_0x64c4('0x34')]=_[_0x64c4('0x32')](_0x534260[_0x64c4('0x2f')],qs['fields'](_0x39cfbb[_0x64c4('0x30')][_0x64c4('0x33')]));_0x2708b6[_0x64c4('0x34')]=_0x2708b6[_0x64c4('0x34')][_0x64c4('0x35')]?_0x2708b6[_0x64c4('0x34')]:_0x534260[_0x64c4('0x2f')];_0x2708b6['order']=qs['sort'](_0x39cfbb[_0x64c4('0x30')][_0x64c4('0x39')]);_0x2708b6[_0x64c4('0x3a')]=qs[_0x64c4('0x3b')](_['pick'](_0x39cfbb[_0x64c4('0x30')],_0x534260[_0x64c4('0x3b')]));if(_0x39cfbb[_0x64c4('0x30')]['filter']){_0x2708b6[_0x64c4('0x3a')]=_[_0x64c4('0x3e')](_0x2708b6[_0x64c4('0x3a')],{'$or':_[_0x64c4('0x29')](_0x2708b6[_0x64c4('0x34')],function(_0x5f192f){var _0x367a25={};_0x367a25[_0x5f192f]={'$like':'%'+_0x39cfbb['query'][_0x64c4('0x3d')]+'%'};return _0x367a25;})});}_0x2708b6=_[_0x64c4('0x3e')]({},_0x2708b6,_0x39cfbb['options']);return _0x22ab25[_0x64c4('0x4a')](_0x2708b6);}})[_0x64c4('0x23')](function(_0xe0dd00){if(_0xe0dd00){_0x397d97=_0xe0dd00['length'];if(!_0x39cfbb[_0x64c4('0x30')][_0x64c4('0x36')](_0x64c4('0x37'))){_0x2708b6['limit']=qs[_0x64c4('0x1d')](_0x39cfbb[_0x64c4('0x30')][_0x64c4('0x1d')]);_0x2708b6['offset']=qs[_0x64c4('0x1b')](_0x39cfbb[_0x64c4('0x30')][_0x64c4('0x1b')]);}return _0x22ab25['getConfigurations'](_0x2708b6);}})[_0x64c4('0x23')](function(_0x4a514e){if(_0x4a514e){return _0x4a514e?{'count':_0x397d97,'rows':_0x4a514e}:null;}})[_0x64c4('0x23')](respondWithResult(_0x147995,null))['catch'](handleError(_0x147995,null));};exports[_0x64c4('0x4d')]=function(_0x50898e,_0x506d73,_0x4c5b79){if(_0x50898e['body']['id']){delete _0x50898e[_0x64c4('0x49')]['id'];}return db[_0x64c4('0x2a')][_0x64c4('0x4b')]({'where':{'id':_0x50898e['params']['id']}})[_0x64c4('0x23')](handleEntityNotFound(_0x506d73,null))[_0x64c4('0x23')](function(_0x50784b){if(_0x50784b){_0x50898e[_0x64c4('0x49')]['AccountId']=_0x50784b['id'];_0x50898e[_0x64c4('0x49')][_0x64c4('0x4e')]=integrations[_0x64c4('0x4f')](_0x50898e['body'][_0x64c4('0x50')],_0x50898e['body'][_0x64c4('0x2d')]);_0x50898e['body'][_0x64c4('0x51')]=integrations[_0x64c4('0x52')](_0x50898e[_0x64c4('0x49')][_0x64c4('0x50')],_0x50898e[_0x64c4('0x49')]['type']);return db[_0x64c4('0x4c')][_0x64c4('0x53')](_0x50898e[_0x64c4('0x49')],{'include':[{'model':db['SugarcrmField'],'as':_0x64c4('0x4e')},{'model':db['SugarcrmField'],'as':_0x64c4('0x51')}]});}return null;})[_0x64c4('0x23')](respondWithResult(_0x506d73,null))[_0x64c4('0x45')](handleError(_0x506d73,null));};exports['getFields']=function(_0x50b9c1,_0x55be3a,_0x22d118){var _0x14be62='';var _0xb45aa1=['id',_0x64c4('0x27'),_0x64c4('0x54'),_0x64c4('0x55'),_0x64c4('0x56'),_0x64c4('0x57'),_0x64c4('0x58'),_0x64c4('0x59'),_0x64c4('0x5a'),_0x64c4('0x5b'),_0x64c4('0x5c'),'direction'];return db[_0x64c4('0x2a')][_0x64c4('0x4b')]({'where':{'id':_0x50b9c1['params']['id']},'attributes':['id',_0x64c4('0x5d'),_0x64c4('0x5e'),'remoteUri']})['then'](handleEntityNotFound(_0x55be3a,null))[_0x64c4('0x23')](function(_0xc4b736){if(_0xc4b736){_0x14be62=_0xc4b736[_0x64c4('0x5f')];var _0x4153d6=_0x14be62[_0x64c4('0x60')](-0x1);if(_0x4153d6==='/'){_0x14be62=_0x14be62[_0x64c4('0x61')](0x0,_0x14be62[_0x64c4('0x62')](_0x4153d6));}return rp({'method':_0x64c4('0x63'),'uri':util[_0x64c4('0x64')](_0x64c4('0x65'),_0x14be62,_0x64c4('0x66')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x64c4('0x67'),'rest_data':JSON[_0x64c4('0x68')]({'user_auth':{'user_name':_0xc4b736[_0x64c4('0x5d')],'password':_0xc4b736[_0x64c4('0x5e')],'encryption':'PLAIN'},'application':_0x64c4('0x69')})}});}})[_0x64c4('0x23')](function(_0x38e17d){if(_0x38e17d&&_0x38e17d['name']!=='Invalid\x20Login'&&_0x38e17d[_0x64c4('0x27')]!=='Password\x20Expired'){return rp({'method':_0x64c4('0x63'),'uri':util['format'](_0x64c4('0x65'),_0x14be62,_0x64c4('0x66')),'json':!![],'form':{'method':_0x64c4('0x6a'),'input_type':_0x64c4('0x67'),'response_type':_0x64c4('0x67'),'rest_data':JSON[_0x64c4('0x68')]({'session':_0x38e17d['id'],'module_name':'Calls'})}})[_0x64c4('0x23')](function(_0x4f14a9){if(_0x4f14a9){var _0x101dc8=_[_0x64c4('0x6b')](_0x4f14a9[_0x64c4('0x6c')]);_[_0x64c4('0x6d')](_0x101dc8,function(_0x1fa41d){return _0xb45aa1[_0x64c4('0x6e')](_0x1fa41d[_0x64c4('0x27')]);});return{'count':_0x101dc8[_0x64c4('0x35')],'rows':_[_0x64c4('0x29')](_0x101dc8,function(_0x112604){return{'id':_0x112604[_0x64c4('0x27')],'name':_0x112604['label'],'custom':_[_0x64c4('0x6f')](_0x112604[_0x64c4('0x27')],'_c')?!![]:![],'options':_0x112604[_0x64c4('0x40')]?_[_0x64c4('0x29')](_[_0x64c4('0x6b')](_0x112604[_0x64c4('0x40')]),function(_0x917bd2){return{'name':_0x917bd2[_0x64c4('0x70')],'value':_0x917bd2['name']};}):[]};})};}})[_0x64c4('0x23')](respondWithResult(_0x55be3a,null))['catch'](function(_0x1afbd8){var _0x1cd4d9=_0x50b9c1[_0x64c4('0x30')][_0x64c4('0x71')]?0x1f4:_0x1afbd8[_0x64c4('0x72')]||0x1f4;logger[_0x64c4('0x25')](_0x64c4('0x73'),'getFields',_0x1cd4d9,JSON['stringify'](_0x1afbd8));delete _0x1afbd8[_0x64c4('0x27')];if(_0x1cd4d9===0x191){_0x1cd4d9=0x190;}_0x55be3a[_0x64c4('0x18')](_0x1cd4d9)[_0x64c4('0x74')](_0x50b9c1[_0x64c4('0x30')]['test']?{'message':_0x64c4('0x75'),'statusCode':_0x1afbd8['statusCode']}:_0x1afbd8);});}else{var _0x4d2495=0x1f4;_0x55be3a['status'](_0x4d2495)[_0x64c4('0x74')]({'message':_0x64c4('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x3bd3=['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/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set','Content-Range','reject','then','destroy','error','name','send','index','map','SugarcrmAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','%s%s','get_module_fields','values','module_fields','remove','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf'];(function(_0x3349bc,_0x5eabf1){var _0x1784cc=function(_0x5f4796){while(--_0x5f4796){_0x3349bc['push'](_0x3349bc['shift']());}};_0x1784cc(++_0x5eabf1);}(_0x3bd3,0x1d6));var _0x33bd=function(_0x1f803d,_0x1c966e){_0x1f803d=_0x1f803d-0x0;var _0x549186=_0x3bd3[_0x1f803d];return _0x549186;};'use strict';var emlformat=require(_0x33bd('0x0'));var rimraf=require(_0x33bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x33bd('0x2'));var moment=require(_0x33bd('0x3'));var BPromise=require(_0x33bd('0x4'));var Mustache=require(_0x33bd('0x5'));var util=require(_0x33bd('0x6'));var path=require(_0x33bd('0x7'));var sox=require(_0x33bd('0x8'));var csv=require(_0x33bd('0x9'));var ejs=require(_0x33bd('0xa'));var fs=require('fs');var fs_extra=require(_0x33bd('0xb'));var _=require(_0x33bd('0xc'));var squel=require(_0x33bd('0xd'));var crypto=require(_0x33bd('0xe'));var jsforce=require(_0x33bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x33bd('0x9'));var querystring=require(_0x33bd('0x10'));var Papa=require(_0x33bd('0x11'));var Redis=require(_0x33bd('0x12'));var authService=require(_0x33bd('0x13'));var qs=require(_0x33bd('0x14'));var as=require(_0x33bd('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x33bd('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x33bd('0x17'));var licenseUtil=require(_0x33bd('0x18'));var db=require(_0x33bd('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x226997,_0x3d7ebe){_0x3d7ebe=_0x3d7ebe||0xcc;return function(_0x58d92b){if(_0x58d92b){return _0x226997[_0x33bd('0x1a')](_0x3d7ebe);}return _0x226997[_0x33bd('0x1b')](_0x3d7ebe)[_0x33bd('0x1c')]();};}function respondWithResult(_0x2c84d9,_0xe2f16c){_0xe2f16c=_0xe2f16c||0xc8;return function(_0xd6cbb4){if(_0xd6cbb4){return _0x2c84d9[_0x33bd('0x1b')](_0xe2f16c)['json'](_0xd6cbb4);}};}function respondWithFilteredResult(_0x2c0932,_0x567141){return function(_0xbaa28e){if(_0xbaa28e){var _0x3d4896=typeof _0x567141['offset']===_0x33bd('0x1d')&&typeof _0x567141['limit']===_0x33bd('0x1d');var _0x91a901=_0xbaa28e[_0x33bd('0x1e')];var _0x3c6c88=_0x3d4896?0x0:_0x567141['offset'];var _0x5574f3=_0x3d4896?_0xbaa28e[_0x33bd('0x1e')]:_0x567141[_0x33bd('0x1f')]+_0x567141['limit'];var _0x1c387d;if(_0x5574f3>=_0x91a901){_0x5574f3=_0x91a901;_0x1c387d=0xc8;}else{_0x1c387d=0xce;}_0x2c0932[_0x33bd('0x1b')](_0x1c387d);return _0x2c0932[_0x33bd('0x20')](_0x33bd('0x21'),_0x3c6c88+'-'+_0x5574f3+'/'+_0x91a901)['json'](_0xbaa28e);}return null;};}function patchUpdates(_0x43b582){return function(_0x9f4c87){try{jsonpatch['apply'](_0x9f4c87,_0x43b582,!![]);}catch(_0x729277){return BPromise[_0x33bd('0x22')](_0x729277);}return _0x9f4c87['save']();};}function saveUpdates(_0x5c2162,_0x108a4a){return function(_0x55d64e){if(_0x55d64e){return _0x55d64e['update'](_0x5c2162)[_0x33bd('0x23')](function(_0xbd46b6){return _0xbd46b6;});}return null;};}function removeEntity(_0x67461d,_0x5e3f7a){return function(_0x502d8b){if(_0x502d8b){return _0x502d8b[_0x33bd('0x24')]()[_0x33bd('0x23')](function(){_0x67461d[_0x33bd('0x1b')](0xcc)[_0x33bd('0x1c')]();});}};}function handleEntityNotFound(_0x1dc63a,_0x2e25db){return function(_0xd53740){if(!_0xd53740){_0x1dc63a['sendStatus'](0x194);}return _0xd53740;};}function handleError(_0x1b2f53,_0x591123){_0x591123=_0x591123||0x1f4;return function(_0x587b3d){logger[_0x33bd('0x25')](_0x587b3d['stack']);if(_0x587b3d['name']){delete _0x587b3d[_0x33bd('0x26')];}_0x1b2f53[_0x33bd('0x1b')](_0x591123)[_0x33bd('0x27')](_0x587b3d);};}exports[_0x33bd('0x28')]=function(_0x362571,_0x276e18){var _0x407703={},_0x480c74={},_0x4161c7={'count':0x0,'rows':[]};var _0x499be6=_[_0x33bd('0x29')](db[_0x33bd('0x2a')][_0x33bd('0x2b')],function(_0x4f323b){return{'name':_0x4f323b['fieldName'],'type':_0x4f323b['type'][_0x33bd('0x2c')]};});_0x480c74[_0x33bd('0x2d')]=_[_0x33bd('0x29')](_0x499be6,_0x33bd('0x26'));_0x480c74[_0x33bd('0x2e')]=_[_0x33bd('0x2f')](_0x362571['query']);_0x480c74[_0x33bd('0x30')]=_[_0x33bd('0x31')](_0x480c74['model'],_0x480c74[_0x33bd('0x2e')]);_0x407703[_0x33bd('0x32')]=_['intersection'](_0x480c74[_0x33bd('0x2d')],qs['fields'](_0x362571[_0x33bd('0x2e')][_0x33bd('0x33')]));_0x407703[_0x33bd('0x32')]=_0x407703[_0x33bd('0x32')][_0x33bd('0x34')]?_0x407703['attributes']:_0x480c74['model'];if(!_0x362571['query']['hasOwnProperty'](_0x33bd('0x35'))){_0x407703['limit']=qs['limit'](_0x362571[_0x33bd('0x2e')][_0x33bd('0x36')]);_0x407703[_0x33bd('0x1f')]=qs['offset'](_0x362571[_0x33bd('0x2e')][_0x33bd('0x1f')]);}_0x407703[_0x33bd('0x37')]=qs['sort'](_0x362571[_0x33bd('0x2e')][_0x33bd('0x38')]);_0x407703['where']=qs[_0x33bd('0x30')](_[_0x33bd('0x39')](_0x362571['query'],_0x480c74[_0x33bd('0x30')]),_0x499be6);if(_0x362571[_0x33bd('0x2e')][_0x33bd('0x3a')]){_0x407703[_0x33bd('0x3b')]=_[_0x33bd('0x3c')](_0x407703[_0x33bd('0x3b')],{'$or':_[_0x33bd('0x29')](_0x499be6,function(_0x17bef1){if(_0x17bef1[_0x33bd('0x3d')]!==_0x33bd('0x3e')){var _0xb1ff6={};_0xb1ff6[_0x17bef1['name']]={'$like':'%'+_0x362571[_0x33bd('0x2e')][_0x33bd('0x3a')]+'%'};return _0xb1ff6;}})});}_0x407703=_[_0x33bd('0x3c')]({},_0x407703,_0x362571[_0x33bd('0x3f')]);var _0x5bc65e={'where':_0x407703[_0x33bd('0x3b')]};return db[_0x33bd('0x2a')]['count'](_0x5bc65e)[_0x33bd('0x23')](function(_0x11f1cc){_0x4161c7[_0x33bd('0x1e')]=_0x11f1cc;if(_0x362571[_0x33bd('0x2e')][_0x33bd('0x40')]){_0x407703[_0x33bd('0x41')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x33bd('0x42')](_0x407703);})['then'](function(_0x1f12ae){_0x4161c7[_0x33bd('0x43')]=_0x1f12ae;return _0x4161c7;})['then'](respondWithFilteredResult(_0x276e18,_0x407703))[_0x33bd('0x44')](handleError(_0x276e18,null));};exports[_0x33bd('0x45')]=function(_0x16e1e7,_0x7268b){var _0x2e4e0d={'raw':![],'where':{'id':_0x16e1e7[_0x33bd('0x46')]['id']}},_0x340a0a={};_0x340a0a[_0x33bd('0x2d')]=_['keys'](db[_0x33bd('0x2a')][_0x33bd('0x2b')]);_0x340a0a['query']=_[_0x33bd('0x2f')](_0x16e1e7['query']);_0x340a0a[_0x33bd('0x30')]=_[_0x33bd('0x31')](_0x340a0a[_0x33bd('0x2d')],_0x340a0a[_0x33bd('0x2e')]);_0x2e4e0d['attributes']=_[_0x33bd('0x31')](_0x340a0a[_0x33bd('0x2d')],qs[_0x33bd('0x33')](_0x16e1e7[_0x33bd('0x2e')][_0x33bd('0x33')]));_0x2e4e0d['attributes']=_0x2e4e0d['attributes'][_0x33bd('0x34')]?_0x2e4e0d['attributes']:_0x340a0a[_0x33bd('0x2d')];if(_0x16e1e7[_0x33bd('0x2e')]['includeAll']){_0x2e4e0d['include']=[{'all':!![]}];}_0x2e4e0d=_[_0x33bd('0x3c')]({},_0x2e4e0d,_0x16e1e7['options']);return db['SugarcrmAccount'][_0x33bd('0x47')](_0x2e4e0d)[_0x33bd('0x23')](handleEntityNotFound(_0x7268b,null))[_0x33bd('0x23')](respondWithResult(_0x7268b,null))[_0x33bd('0x44')](handleError(_0x7268b,null));};exports['create']=function(_0x1ab987,_0x4cc054){return db[_0x33bd('0x2a')][_0x33bd('0x48')](_0x1ab987[_0x33bd('0x49')],{})[_0x33bd('0x23')](respondWithResult(_0x4cc054,0xc9))[_0x33bd('0x44')](handleError(_0x4cc054,null));};exports[_0x33bd('0x4a')]=function(_0x29a6d6,_0x20d212){if(_0x29a6d6[_0x33bd('0x49')]['id']){delete _0x29a6d6['body']['id'];}return db[_0x33bd('0x2a')][_0x33bd('0x47')]({'where':{'id':_0x29a6d6['params']['id']}})[_0x33bd('0x23')](handleEntityNotFound(_0x20d212,null))[_0x33bd('0x23')](saveUpdates(_0x29a6d6[_0x33bd('0x49')],null))[_0x33bd('0x23')](respondWithResult(_0x20d212,null))[_0x33bd('0x44')](handleError(_0x20d212,null));};exports[_0x33bd('0x24')]=function(_0x51400a,_0x414490){return db[_0x33bd('0x2a')][_0x33bd('0x47')]({'where':{'id':_0x51400a['params']['id']}})['then'](handleEntityNotFound(_0x414490,null))[_0x33bd('0x23')](removeEntity(_0x414490,null))['catch'](handleError(_0x414490,null));};exports[_0x33bd('0x4b')]=function(_0xe18f6b,_0x17f0ec,_0x12cc4b){var _0x27ff11={};var _0x346635={};var _0x286770;var _0x43ed17;return db['SugarcrmAccount'][_0x33bd('0x4c')]({'where':{'id':_0xe18f6b[_0x33bd('0x46')]['id']}})[_0x33bd('0x23')](handleEntityNotFound(_0x17f0ec,null))[_0x33bd('0x23')](function(_0x2f4146){if(_0x2f4146){_0x286770=_0x2f4146;_0x346635[_0x33bd('0x2d')]=_[_0x33bd('0x2f')](db[_0x33bd('0x4d')]['rawAttributes']);_0x346635[_0x33bd('0x2e')]=_[_0x33bd('0x2f')](_0xe18f6b[_0x33bd('0x2e')]);_0x346635['filters']=_['intersection'](_0x346635['model'],_0x346635[_0x33bd('0x2e')]);_0x27ff11[_0x33bd('0x32')]=_['intersection'](_0x346635[_0x33bd('0x2d')],qs[_0x33bd('0x33')](_0xe18f6b[_0x33bd('0x2e')][_0x33bd('0x33')]));_0x27ff11['attributes']=_0x27ff11[_0x33bd('0x32')]['length']?_0x27ff11[_0x33bd('0x32')]:_0x346635[_0x33bd('0x2d')];_0x27ff11[_0x33bd('0x37')]=qs['sort'](_0xe18f6b[_0x33bd('0x2e')][_0x33bd('0x38')]);_0x27ff11[_0x33bd('0x3b')]=qs[_0x33bd('0x30')](_[_0x33bd('0x39')](_0xe18f6b['query'],_0x346635[_0x33bd('0x30')]));if(_0xe18f6b[_0x33bd('0x2e')][_0x33bd('0x3a')]){_0x27ff11[_0x33bd('0x3b')]=_[_0x33bd('0x3c')](_0x27ff11[_0x33bd('0x3b')],{'$or':_[_0x33bd('0x29')](_0x27ff11[_0x33bd('0x32')],function(_0x4eaa2c){var _0x41abc8={};_0x41abc8[_0x4eaa2c]={'$like':'%'+_0xe18f6b['query'][_0x33bd('0x3a')]+'%'};return _0x41abc8;})});}_0x27ff11=_[_0x33bd('0x3c')]({},_0x27ff11,_0xe18f6b['options']);return _0x286770[_0x33bd('0x4b')](_0x27ff11);}})['then'](function(_0x48f400){if(_0x48f400){_0x43ed17=_0x48f400[_0x33bd('0x34')];if(!_0xe18f6b['query'][_0x33bd('0x4e')](_0x33bd('0x35'))){_0x27ff11[_0x33bd('0x36')]=qs['limit'](_0xe18f6b[_0x33bd('0x2e')][_0x33bd('0x36')]);_0x27ff11[_0x33bd('0x1f')]=qs[_0x33bd('0x1f')](_0xe18f6b[_0x33bd('0x2e')][_0x33bd('0x1f')]);}return _0x286770[_0x33bd('0x4b')](_0x27ff11);}})[_0x33bd('0x23')](function(_0x35748d){if(_0x35748d){return _0x35748d?{'count':_0x43ed17,'rows':_0x35748d}:null;}})['then'](respondWithResult(_0x17f0ec,null))['catch'](handleError(_0x17f0ec,null));};exports[_0x33bd('0x4f')]=function(_0x2f23d7,_0x335134,_0x49542b){if(_0x2f23d7[_0x33bd('0x49')]['id']){delete _0x2f23d7['body']['id'];}return db[_0x33bd('0x2a')][_0x33bd('0x4c')]({'where':{'id':_0x2f23d7[_0x33bd('0x46')]['id']}})['then'](handleEntityNotFound(_0x335134,null))[_0x33bd('0x23')](function(_0x4ec689){if(_0x4ec689){_0x2f23d7[_0x33bd('0x49')][_0x33bd('0x50')]=_0x4ec689['id'];_0x2f23d7['body'][_0x33bd('0x51')]=integrations['getSubjects'](_0x2f23d7[_0x33bd('0x49')]['channel'],_0x2f23d7[_0x33bd('0x49')][_0x33bd('0x3d')]);_0x2f23d7['body'][_0x33bd('0x52')]=integrations[_0x33bd('0x53')](_0x2f23d7[_0x33bd('0x49')]['channel'],_0x2f23d7[_0x33bd('0x49')][_0x33bd('0x3d')]);return db[_0x33bd('0x4d')][_0x33bd('0x48')](_0x2f23d7['body'],{'include':[{'model':db[_0x33bd('0x54')],'as':_0x33bd('0x51')},{'model':db[_0x33bd('0x54')],'as':_0x33bd('0x52')}]});}return null;})['then'](respondWithResult(_0x335134,null))[_0x33bd('0x44')](handleError(_0x335134,null));};exports[_0x33bd('0x55')]=function(_0x385f12,_0x4700c8,_0xf3af12){var _0x10e697='';var _0x5a1595=['id','name',_0x33bd('0x56'),_0x33bd('0x57'),_0x33bd('0x58'),_0x33bd('0x59'),'duration_hours',_0x33bd('0x5a'),_0x33bd('0x5b'),'parent_type',_0x33bd('0x5c'),_0x33bd('0x5d')];return db[_0x33bd('0x2a')][_0x33bd('0x4c')]({'where':{'id':_0x385f12['params']['id']},'attributes':['id',_0x33bd('0x5e'),_0x33bd('0x5f'),_0x33bd('0x60')]})['then'](handleEntityNotFound(_0x4700c8,null))[_0x33bd('0x23')](function(_0x1dedd0){if(_0x1dedd0){_0x10e697=_0x1dedd0[_0x33bd('0x60')];var _0x376899=_0x10e697[_0x33bd('0x61')](-0x1);if(_0x376899==='/'){_0x10e697=_0x10e697['substring'](0x0,_0x10e697[_0x33bd('0x62')](_0x376899));}return rp({'method':_0x33bd('0x63'),'uri':util['format']('%s%s',_0x10e697,_0x33bd('0x64')),'json':!![],'form':{'method':_0x33bd('0x65'),'input_type':_0x33bd('0x66'),'response_type':_0x33bd('0x66'),'rest_data':JSON[_0x33bd('0x67')]({'user_auth':{'user_name':_0x1dedd0[_0x33bd('0x5e')],'password':_0x1dedd0['password'],'encryption':_0x33bd('0x68')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x467c26){if(_0x467c26&&_0x467c26[_0x33bd('0x26')]!==_0x33bd('0x69')&&_0x467c26['name']!=='Password\x20Expired'){return rp({'method':_0x33bd('0x63'),'uri':util['format'](_0x33bd('0x6a'),_0x10e697,_0x33bd('0x64')),'json':!![],'form':{'method':_0x33bd('0x6b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x33bd('0x67')]({'session':_0x467c26['id'],'module_name':'Calls'})}})[_0x33bd('0x23')](function(_0x107cec){if(_0x107cec){var _0x49dfde=_[_0x33bd('0x6c')](_0x107cec[_0x33bd('0x6d')]);_[_0x33bd('0x6e')](_0x49dfde,function(_0x2178c7){return _0x5a1595['includes'](_0x2178c7['name']);});return{'count':_0x49dfde['length'],'rows':_[_0x33bd('0x29')](_0x49dfde,function(_0xd2c7d1){return{'id':_0xd2c7d1[_0x33bd('0x26')],'name':_0xd2c7d1[_0x33bd('0x6f')],'custom':_[_0x33bd('0x70')](_0xd2c7d1[_0x33bd('0x26')],'_c')?!![]:![],'options':_0xd2c7d1[_0x33bd('0x3f')]?_[_0x33bd('0x29')](_['values'](_0xd2c7d1[_0x33bd('0x3f')]),function(_0x4e7d18){return{'name':_0x4e7d18[_0x33bd('0x71')],'value':_0x4e7d18[_0x33bd('0x26')]};}):[]};})};}})['then'](respondWithResult(_0x4700c8,null))[_0x33bd('0x44')](function(_0x4fafcd){var _0x1f1050=_0x385f12[_0x33bd('0x2e')][_0x33bd('0x72')]?0x1f4:_0x4fafcd[_0x33bd('0x73')]||0x1f4;logger[_0x33bd('0x25')](_0x33bd('0x74'),_0x33bd('0x55'),_0x1f1050,JSON['stringify'](_0x4fafcd));delete _0x4fafcd['name'];if(_0x1f1050===0x191){_0x1f1050=0x190;}_0x4700c8[_0x33bd('0x1b')](_0x1f1050)['send'](_0x385f12[_0x33bd('0x2e')][_0x33bd('0x72')]?{'message':_0x33bd('0x75'),'statusCode':_0x4fafcd[_0x33bd('0x73')]}:_0x4fafcd);});}else{var _0x15f768=0x1f4;_0x4700c8[_0x33bd('0x1b')](_0x15f768)[_0x33bd('0x27')]({'message':_0x33bd('0x75'),'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 b7f1f11..b2a9534 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 _0x30e4=['api','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x30e4,0xa7));var _0x430e=function(_0x5e4e15,_0x40897d){_0x5e4e15=_0x5e4e15-0x0;var _0x40aeb4=_0x30e4[_0x5e4e15];return _0x40aeb4;};'use strict';var _=require('lodash');var util=require(_0x430e('0x0'));var logger=require(_0x430e('0x1'))(_0x430e('0x2'));var moment=require('moment');var BPromise=require(_0x430e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x430e('0x4'));var rimraf=require(_0x430e('0x5'));var config=require(_0x430e('0x6'));var attributes=require(_0x430e('0x7'));var integrations=require(_0x430e('0x8'));module[_0x430e('0x9')]=function(_0x373345,_0x10ae1b){return _0x373345[_0x430e('0xa')](_0x430e('0xb'),attributes,{'tableName':_0x430e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb10=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb10,0x191));var _0x0fb1=function(_0x12f70f,_0x1bf532){_0x12f70f=_0x12f70f-0x0;var _0x1f742c=_0xfb10[_0x12f70f];return _0x1f742c;};'use strict';var _=require('lodash');var util=require(_0x0fb1('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0fb1('0x1'));var BPromise=require(_0x0fb1('0x2'));var rp=require(_0x0fb1('0x3'));var fs=require('fs');var path=require(_0x0fb1('0x4'));var rimraf=require(_0x0fb1('0x5'));var config=require(_0x0fb1('0x6'));var attributes=require(_0x0fb1('0x7'));var integrations=require(_0x0fb1('0x8'));module[_0x0fb1('0x9')]=function(_0x94d0ed,_0x3c55e9){return _0x94d0ed[_0x0fb1('0xa')]('SugarcrmAccount',attributes,{'tableName':_0x0fb1('0xb'),'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 9ec02b1..bd817c8 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 _0x3b66=['stringify','error','message','result','catch','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s'];(function(_0x1d0eaf,_0x46126c){var _0x1a194a=function(_0x358132){while(--_0x358132){_0x1d0eaf['push'](_0x1d0eaf['shift']());}};_0x1a194a(++_0x46126c);}(_0x3b66,0x143));var _0x63b6=function(_0x2ec625,_0x3a7824){_0x2ec625=_0x2ec625-0x0;var _0x30542f=_0x3b66[_0x2ec625];return _0x30542f;};'use strict';var _=require(_0x63b6('0x0'));var util=require(_0x63b6('0x1'));var moment=require(_0x63b6('0x2'));var BPromise=require(_0x63b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63b6('0x4'));var db=require(_0x63b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x63b6('0x6'))(_0x63b6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x63b6('0x8')][_0x63b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x571e9c,_0x542706,_0x41492e){return new BPromise(function(_0x559210,_0x4ac8d9){return client[_0x63b6('0xa')](_0x571e9c,_0x41492e)[_0x63b6('0xb')](function(_0x354e85){logger[_0x63b6('0xc')](_0x63b6('0xd'),_0x542706,_0x63b6('0xe'));logger[_0x63b6('0xf')](_0x63b6('0x10'),_0x542706,'request\x20sent',JSON[_0x63b6('0x11')](_0x354e85));if(_0x354e85['error']){if(_0x354e85[_0x63b6('0x12')]['code']===0x1f4){logger[_0x63b6('0x12')](_0x63b6('0xd'),_0x542706,_0x354e85[_0x63b6('0x12')][_0x63b6('0x13')]);return _0x4ac8d9(_0x354e85['error'][_0x63b6('0x13')]);}logger[_0x63b6('0x12')](_0x63b6('0xd'),_0x542706,_0x354e85['error'][_0x63b6('0x13')]);return _0x559210(_0x354e85[_0x63b6('0x12')][_0x63b6('0x13')]);}else{logger[_0x63b6('0xc')](_0x63b6('0xd'),_0x542706,_0x63b6('0xe'));_0x559210(_0x354e85[_0x63b6('0x14')][_0x63b6('0x13')]);}})[_0x63b6('0x15')](function(_0x19aaef){logger[_0x63b6('0x12')](_0x63b6('0xd'),_0x542706,_0x19aaef);_0x4ac8d9(_0x19aaef);});});}exports['GetSugarcrmAccount']=function(_0x3b5394){var _0x31f26a=this;return new Promise(function(_0x211baa,_0x7e370c){return db[_0x63b6('0x16')]['findAll']({'raw':_0x3b5394[_0x63b6('0x17')]?_0x3b5394[_0x63b6('0x17')][_0x63b6('0x18')]===undefined?!![]:![]:!![],'where':_0x3b5394[_0x63b6('0x17')]?_0x3b5394['options'][_0x63b6('0x19')]||null:null,'attributes':_0x3b5394[_0x63b6('0x17')]?_0x3b5394['options'][_0x63b6('0x1a')]||null:null,'limit':_0x3b5394[_0x63b6('0x17')]?_0x3b5394[_0x63b6('0x17')][_0x63b6('0x1b')]||null:null,'include':_0x3b5394['options']?_0x3b5394[_0x63b6('0x17')][_0x63b6('0x1c')]?_[_0x63b6('0x1d')](_0x3b5394['options'][_0x63b6('0x1c')],function(_0x4da597){return{'model':db[_0x4da597['model']],'as':_0x4da597['as'],'attributes':_0x4da597[_0x63b6('0x1a')],'include':_0x4da597[_0x63b6('0x1c')]?_[_0x63b6('0x1d')](_0x4da597[_0x63b6('0x1c')],function(_0x5ef535){return{'model':db[_0x5ef535[_0x63b6('0x1e')]],'as':_0x5ef535['as'],'attributes':_0x5ef535[_0x63b6('0x1a')],'include':_0x5ef535['include']?_[_0x63b6('0x1d')](_0x5ef535['include'],function(_0x202825){return{'model':db[_0x202825[_0x63b6('0x1e')]],'as':_0x202825['as'],'attributes':_0x202825[_0x63b6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17e548){logger[_0x63b6('0xc')](_0x63b6('0x1f'),_0x3b5394);logger[_0x63b6('0xf')](_0x63b6('0x1f'),_0x3b5394,JSON[_0x63b6('0x11')](_0x17e548));_0x211baa(_0x17e548);})[_0x63b6('0x15')](function(_0x1cbe14){logger[_0x63b6('0x12')](_0x63b6('0x1f'),_0x1cbe14[_0x63b6('0x13')],_0x3b5394);_0x7e370c(_0x31f26a['error'](0x1f4,_0x1cbe14[_0x63b6('0x13')]));});});};exports[_0x63b6('0x20')]=function(_0x2d6773){var _0x1a4508=this;return new Promise(function(_0x250873,_0x3036a7){return db[_0x63b6('0x16')][_0x63b6('0x21')]({'raw':_0x2d6773[_0x63b6('0x17')]?_0x2d6773[_0x63b6('0x17')][_0x63b6('0x18')]===undefined?!![]:![]:!![],'where':_0x2d6773[_0x63b6('0x17')]?_0x2d6773['options'][_0x63b6('0x19')]||null:null,'attributes':_0x2d6773[_0x63b6('0x17')]?_0x2d6773[_0x63b6('0x17')]['attributes']||null:null,'include':_0x2d6773[_0x63b6('0x17')]?_0x2d6773[_0x63b6('0x17')][_0x63b6('0x1c')]?_[_0x63b6('0x1d')](_0x2d6773[_0x63b6('0x17')][_0x63b6('0x1c')],function(_0x599e4d){return{'model':db[_0x599e4d[_0x63b6('0x1e')]],'as':_0x599e4d['as'],'attributes':_0x599e4d['attributes'],'include':_0x599e4d[_0x63b6('0x1c')]?_[_0x63b6('0x1d')](_0x599e4d[_0x63b6('0x1c')],function(_0x366537){return{'model':db[_0x366537[_0x63b6('0x1e')]],'as':_0x366537['as'],'attributes':_0x366537['attributes'],'include':_0x366537[_0x63b6('0x1c')]?_[_0x63b6('0x1d')](_0x366537[_0x63b6('0x1c')],function(_0x271a13){return{'model':db[_0x271a13[_0x63b6('0x1e')]],'as':_0x271a13['as'],'attributes':_0x271a13[_0x63b6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b6c45){logger[_0x63b6('0xc')]('ShowSugarcrmAccount',_0x2d6773);logger[_0x63b6('0xf')](_0x63b6('0x20'),_0x2d6773,JSON[_0x63b6('0x11')](_0x1b6c45));_0x250873(_0x1b6c45);})[_0x63b6('0x15')](function(_0x41aa53){logger[_0x63b6('0x12')](_0x63b6('0x20'),_0x41aa53[_0x63b6('0x13')],_0x2d6773);_0x3036a7(_0x1a4508['error'](0x1f4,_0x41aa53[_0x63b6('0x13')]));});});}; \ No newline at end of file +var _0xe2f3=['SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','map','include','model','debug','ShowSugarcrmAccount','find','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0xe2f3,0x1db));var _0x3e2f=function(_0x5e7e1a,_0x38a7c6){_0x5e7e1a=_0x5e7e1a-0x0;var _0x46b94f=_0xe2f3[_0x5e7e1a];return _0x46b94f;};'use strict';var _=require('lodash');var util=require(_0x3e2f('0x0'));var moment=require('moment');var BPromise=require(_0x3e2f('0x1'));var rs=require(_0x3e2f('0x2'));var fs=require('fs');var Redis=require(_0x3e2f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e2f('0x4'));var logger=require(_0x3e2f('0x5'))(_0x3e2f('0x6'));var config=require(_0x3e2f('0x7'));var jayson=require(_0x3e2f('0x8'));var client=jayson[_0x3e2f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc27986,_0x3a05fe,_0xf79b24){return new BPromise(function(_0xdd0457,_0x2fea4f){return client[_0x3e2f('0xa')](_0xc27986,_0xf79b24)[_0x3e2f('0xb')](function(_0x4a3aa0){logger[_0x3e2f('0xc')](_0x3e2f('0xd'),_0x3a05fe,_0x3e2f('0xe'));logger['debug'](_0x3e2f('0xf'),_0x3a05fe,'request\x20sent',JSON[_0x3e2f('0x10')](_0x4a3aa0));if(_0x4a3aa0[_0x3e2f('0x11')]){if(_0x4a3aa0[_0x3e2f('0x11')][_0x3e2f('0x12')]===0x1f4){logger[_0x3e2f('0x11')](_0x3e2f('0xd'),_0x3a05fe,_0x4a3aa0[_0x3e2f('0x11')][_0x3e2f('0x13')]);return _0x2fea4f(_0x4a3aa0['error']['message']);}logger[_0x3e2f('0x11')](_0x3e2f('0xd'),_0x3a05fe,_0x4a3aa0[_0x3e2f('0x11')]['message']);return _0xdd0457(_0x4a3aa0[_0x3e2f('0x11')][_0x3e2f('0x13')]);}else{logger[_0x3e2f('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x3a05fe,_0x3e2f('0xe'));_0xdd0457(_0x4a3aa0[_0x3e2f('0x14')][_0x3e2f('0x13')]);}})[_0x3e2f('0x15')](function(_0x50a4ee){logger['error'](_0x3e2f('0xd'),_0x3a05fe,_0x50a4ee);_0x2fea4f(_0x50a4ee);});});}exports[_0x3e2f('0x16')]=function(_0x467ad2){var _0x5b1b6b=this;return new Promise(function(_0x568642,_0x17d46c){return db[_0x3e2f('0x17')][_0x3e2f('0x18')]({'raw':_0x467ad2[_0x3e2f('0x19')]?_0x467ad2[_0x3e2f('0x19')][_0x3e2f('0x1a')]===undefined?!![]:![]:!![],'where':_0x467ad2['options']?_0x467ad2[_0x3e2f('0x19')][_0x3e2f('0x1b')]||null:null,'attributes':_0x467ad2[_0x3e2f('0x19')]?_0x467ad2['options'][_0x3e2f('0x1c')]||null:null,'limit':_0x467ad2[_0x3e2f('0x19')]?_0x467ad2[_0x3e2f('0x19')]['limit']||null:null,'include':_0x467ad2['options']?_0x467ad2['options']['include']?_[_0x3e2f('0x1d')](_0x467ad2[_0x3e2f('0x19')][_0x3e2f('0x1e')],function(_0x4d2295){return{'model':db[_0x4d2295['model']],'as':_0x4d2295['as'],'attributes':_0x4d2295['attributes'],'include':_0x4d2295['include']?_['map'](_0x4d2295[_0x3e2f('0x1e')],function(_0x1b8466){return{'model':db[_0x1b8466['model']],'as':_0x1b8466['as'],'attributes':_0x1b8466[_0x3e2f('0x1c')],'include':_0x1b8466['include']?_[_0x3e2f('0x1d')](_0x1b8466[_0x3e2f('0x1e')],function(_0x132b5a){return{'model':db[_0x132b5a[_0x3e2f('0x1f')]],'as':_0x132b5a['as'],'attributes':_0x132b5a['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e2f('0xb')](function(_0xa454f){logger[_0x3e2f('0xc')]('GetSugarcrmAccount',_0x467ad2);logger[_0x3e2f('0x20')](_0x3e2f('0x16'),_0x467ad2,JSON[_0x3e2f('0x10')](_0xa454f));_0x568642(_0xa454f);})['catch'](function(_0x235596){logger[_0x3e2f('0x11')]('GetSugarcrmAccount',_0x235596[_0x3e2f('0x13')],_0x467ad2);_0x17d46c(_0x5b1b6b[_0x3e2f('0x11')](0x1f4,_0x235596['message']));});});};exports[_0x3e2f('0x21')]=function(_0x54838b){var _0x134e93=this;return new Promise(function(_0x2afdf5,_0x40019a){return db[_0x3e2f('0x17')][_0x3e2f('0x22')]({'raw':_0x54838b[_0x3e2f('0x19')]?_0x54838b[_0x3e2f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x54838b[_0x3e2f('0x19')]?_0x54838b['options']['where']||null:null,'attributes':_0x54838b[_0x3e2f('0x19')]?_0x54838b['options'][_0x3e2f('0x1c')]||null:null,'include':_0x54838b['options']?_0x54838b[_0x3e2f('0x19')][_0x3e2f('0x1e')]?_[_0x3e2f('0x1d')](_0x54838b[_0x3e2f('0x19')]['include'],function(_0x4caf46){return{'model':db[_0x4caf46[_0x3e2f('0x1f')]],'as':_0x4caf46['as'],'attributes':_0x4caf46[_0x3e2f('0x1c')],'include':_0x4caf46[_0x3e2f('0x1e')]?_[_0x3e2f('0x1d')](_0x4caf46['include'],function(_0x3a1dd0){return{'model':db[_0x3a1dd0[_0x3e2f('0x1f')]],'as':_0x3a1dd0['as'],'attributes':_0x3a1dd0[_0x3e2f('0x1c')],'include':_0x3a1dd0[_0x3e2f('0x1e')]?_[_0x3e2f('0x1d')](_0x3a1dd0[_0x3e2f('0x1e')],function(_0x5e48ab){return{'model':db[_0x5e48ab[_0x3e2f('0x1f')]],'as':_0x5e48ab['as'],'attributes':_0x5e48ab['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e2f('0xb')](function(_0x361399){logger['info'](_0x3e2f('0x21'),_0x54838b);logger[_0x3e2f('0x20')](_0x3e2f('0x21'),_0x54838b,JSON['stringify'](_0x361399));_0x2afdf5(_0x361399);})[_0x3e2f('0x15')](function(_0x5b0eda){logger[_0x3e2f('0x11')](_0x3e2f('0x21'),_0x5b0eda[_0x3e2f('0x13')],_0x54838b);_0x40019a(_0x134e93[_0x3e2f('0x11')](0x1f4,_0x5b0eda[_0x3e2f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index bf55fe3..a28412a 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 _0xb264=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy'];(function(_0x2169a1,_0x2b4eb1){var _0x41ba88=function(_0x18f6f3){while(--_0x18f6f3){_0x2169a1['push'](_0x2169a1['shift']());}};_0x41ba88(++_0x2b4eb1);}(_0xb264,0xe2));var _0x4b26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb264[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4b26('0x0'));var util=require(_0x4b26('0x1'));var path=require(_0x4b26('0x2'));var timeout=require(_0x4b26('0x3'));var express=require(_0x4b26('0x4'));var router=express['Router']();var fs_extra=require(_0x4b26('0x5'));var auth=require(_0x4b26('0x6'));var interaction=require(_0x4b26('0x7'));var config=require('../../config/environment');var controller=require(_0x4b26('0x8'));router[_0x4b26('0x9')]('/',auth[_0x4b26('0xa')](),controller['index']);router[_0x4b26('0x9')](_0x4b26('0xb'),auth['isAuthenticated'](),controller[_0x4b26('0xc')]);router[_0x4b26('0x9')](_0x4b26('0xd'),auth['isAuthenticated'](),controller[_0x4b26('0xe')]);router[_0x4b26('0x9')](_0x4b26('0xf'),auth[_0x4b26('0xa')](),controller[_0x4b26('0x10')]);router[_0x4b26('0x9')](_0x4b26('0x11'),auth[_0x4b26('0xa')](),controller[_0x4b26('0x12')]);router[_0x4b26('0x13')]('/',auth[_0x4b26('0xa')](),controller['create']);router[_0x4b26('0x14')](_0x4b26('0xb'),auth[_0x4b26('0xa')](),controller[_0x4b26('0x15')]);router[_0x4b26('0x16')](_0x4b26('0xb'),auth['isAuthenticated'](),controller[_0x4b26('0x17')]);module[_0x4b26('0x18')]=router; \ No newline at end of file +var _0x8a82=['getDescriptions','post','create','put','/:id','update','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x8a82,0xc5));var _0x28a8=function(_0x4b01e0,_0x5ef558){_0x4b01e0=_0x4b01e0-0x0;var _0x57b177=_0x8a82[_0x4b01e0];return _0x57b177;};'use strict';var multer=require(_0x28a8('0x0'));var util=require(_0x28a8('0x1'));var path=require(_0x28a8('0x2'));var timeout=require('connect-timeout');var express=require(_0x28a8('0x3'));var router=express['Router']();var fs_extra=require(_0x28a8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x28a8('0x5'));var config=require(_0x28a8('0x6'));var controller=require(_0x28a8('0x7'));router[_0x28a8('0x8')]('/',auth[_0x28a8('0x9')](),controller[_0x28a8('0xa')]);router[_0x28a8('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x28a8('0xb'),auth[_0x28a8('0x9')](),controller[_0x28a8('0xc')]);router[_0x28a8('0x8')]('/:id/subjects',auth[_0x28a8('0x9')](),controller['getSubjects']);router[_0x28a8('0x8')]('/:id/descriptions',auth[_0x28a8('0x9')](),controller[_0x28a8('0xd')]);router[_0x28a8('0xe')]('/',auth[_0x28a8('0x9')](),controller[_0x28a8('0xf')]);router[_0x28a8('0x10')](_0x28a8('0x11'),auth[_0x28a8('0x9')](),controller[_0x28a8('0x12')]);router['delete']('/:id',auth[_0x28a8('0x9')](),controller[_0x28a8('0x13')]);module[_0x28a8('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index f2a4d56..c9eec02 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 _0xa3b3=['STRING','sequelize','exports'];(function(_0x59e30d,_0x564720){var _0x33d0ce=function(_0x3176aa){while(--_0x3176aa){_0x59e30d['push'](_0x59e30d['shift']());}};_0x33d0ce(++_0x564720);}(_0xa3b3,0x12a));var _0x3a3b=function(_0x5b9db1,_0x184cea){_0x5b9db1=_0x5b9db1-0x0;var _0x442c18=_0xa3b3[_0x5b9db1];return _0x442c18;};'use strict';var Sequelize=require(_0x3a3b('0x0'));module[_0x3a3b('0x1')]={'name':{'type':Sequelize[_0x3a3b('0x2')]},'description':{'type':Sequelize[_0x3a3b('0x2')]}}; \ No newline at end of file +var _0x09fb=['STRING','sequelize'];(function(_0x4c93d4,_0x5a17bd){var _0x29caca=function(_0x32f7fa){while(--_0x32f7fa){_0x4c93d4['push'](_0x4c93d4['shift']());}};_0x29caca(++_0x5a17bd);}(_0x09fb,0xd5));var _0xb09f=function(_0x4a2a8c,_0x5ec6d6){_0x4a2a8c=_0x4a2a8c-0x0;var _0x327a89=_0x09fb[_0x4a2a8c];return _0x327a89;};'use strict';var Sequelize=require(_0xb09f('0x0'));module['exports']={'name':{'type':Sequelize[_0xb09f('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 27c0544..9759635 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 _0x3f40=['findAll','rows','catch','params','options','find','create','body','getFields','SugarcrmField','hasOwnProperty','getSubjects','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include'];(function(_0x25ac41,_0x406f5a){var _0x4f629f=function(_0x562c1f){while(--_0x562c1f){_0x25ac41['push'](_0x25ac41['shift']());}};_0x4f629f(++_0x406f5a);}(_0x3f40,0x1f3));var _0x03f4=function(_0x430ba2,_0x4e4b57){_0x430ba2=_0x430ba2-0x0;var _0x13f993=_0x3f40[_0x430ba2];return _0x13f993;};'use strict';var emlformat=require(_0x03f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x03f4('0x1'));var jsonpatch=require(_0x03f4('0x2'));var rp=require(_0x03f4('0x3'));var moment=require(_0x03f4('0x4'));var BPromise=require(_0x03f4('0x5'));var Mustache=require(_0x03f4('0x6'));var util=require('util');var path=require(_0x03f4('0x7'));var sox=require(_0x03f4('0x8'));var csv=require(_0x03f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03f4('0xa'));var _=require(_0x03f4('0xb'));var squel=require(_0x03f4('0xc'));var crypto=require(_0x03f4('0xd'));var jsforce=require(_0x03f4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x03f4('0x9'));var querystring=require(_0x03f4('0xf'));var Papa=require(_0x03f4('0x10'));var Redis=require(_0x03f4('0x11'));var authService=require(_0x03f4('0x12'));var qs=require(_0x03f4('0x13'));var as=require(_0x03f4('0x14'));var hardwareService=require(_0x03f4('0x15'));var logger=require(_0x03f4('0x16'))(_0x03f4('0x17'));var utils=require(_0x03f4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x03f4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fdb19,_0x5078b9){_0x5078b9=_0x5078b9||0xcc;return function(_0x50ea9a){if(_0x50ea9a){return _0x4fdb19['sendStatus'](_0x5078b9);}return _0x4fdb19[_0x03f4('0x1a')](_0x5078b9)['end']();};}function respondWithResult(_0x4edf4b,_0x2eb34c){_0x2eb34c=_0x2eb34c||0xc8;return function(_0x5982b9){if(_0x5982b9){return _0x4edf4b[_0x03f4('0x1a')](_0x2eb34c)[_0x03f4('0x1b')](_0x5982b9);}};}function respondWithFilteredResult(_0x49eca1,_0x4b51e5){return function(_0x713ef5){if(_0x713ef5){var _0x59aa1f=typeof _0x4b51e5[_0x03f4('0x1c')]===_0x03f4('0x1d')&&typeof _0x4b51e5['limit']===_0x03f4('0x1d');var _0xfc4626=_0x713ef5[_0x03f4('0x1e')];var _0x1cd51e=_0x59aa1f?0x0:_0x4b51e5[_0x03f4('0x1c')];var _0x11ba47=_0x59aa1f?_0x713ef5[_0x03f4('0x1e')]:_0x4b51e5['offset']+_0x4b51e5[_0x03f4('0x1f')];var _0x436a16;if(_0x11ba47>=_0xfc4626){_0x11ba47=_0xfc4626;_0x436a16=0xc8;}else{_0x436a16=0xce;}_0x49eca1['status'](_0x436a16);return _0x49eca1[_0x03f4('0x20')]('Content-Range',_0x1cd51e+'-'+_0x11ba47+'/'+_0xfc4626)['json'](_0x713ef5);}return null;};}function patchUpdates(_0xb6ff08){return function(_0x182795){try{jsonpatch[_0x03f4('0x21')](_0x182795,_0xb6ff08,!![]);}catch(_0x782d81){return BPromise[_0x03f4('0x22')](_0x782d81);}return _0x182795[_0x03f4('0x23')]();};}function saveUpdates(_0x667482,_0xdf9a18){return function(_0x3a868a){if(_0x3a868a){return _0x3a868a[_0x03f4('0x24')](_0x667482)[_0x03f4('0x25')](function(_0x697c32){return _0x697c32;});}return null;};}function removeEntity(_0x14a27a,_0xbc3ec9){return function(_0x10ba25){if(_0x10ba25){return _0x10ba25[_0x03f4('0x26')]()[_0x03f4('0x25')](function(){_0x14a27a['status'](0xcc)[_0x03f4('0x27')]();});}};}function handleEntityNotFound(_0x552d97,_0x138bb2){return function(_0x175864){if(!_0x175864){_0x552d97[_0x03f4('0x28')](0x194);}return _0x175864;};}function handleError(_0x44cba7,_0x1cdde2){_0x1cdde2=_0x1cdde2||0x1f4;return function(_0x296d20){logger[_0x03f4('0x29')](_0x296d20[_0x03f4('0x2a')]);if(_0x296d20[_0x03f4('0x2b')]){delete _0x296d20[_0x03f4('0x2b')];}_0x44cba7[_0x03f4('0x1a')](_0x1cdde2)[_0x03f4('0x2c')](_0x296d20);};}exports['index']=function(_0x29eace,_0x349d2f){var _0x48f8eb={},_0x1014b9={},_0x40a1bc={'count':0x0,'rows':[]};var _0x274c66=_[_0x03f4('0x2d')](db[_0x03f4('0x2e')][_0x03f4('0x2f')],function(_0x3b492f){return{'name':_0x3b492f[_0x03f4('0x30')],'type':_0x3b492f[_0x03f4('0x31')][_0x03f4('0x32')]};});_0x1014b9['model']=_[_0x03f4('0x2d')](_0x274c66,_0x03f4('0x2b'));_0x1014b9[_0x03f4('0x33')]=_[_0x03f4('0x34')](_0x29eace[_0x03f4('0x33')]);_0x1014b9[_0x03f4('0x35')]=_[_0x03f4('0x36')](_0x1014b9['model'],_0x1014b9[_0x03f4('0x33')]);_0x48f8eb[_0x03f4('0x37')]=_[_0x03f4('0x36')](_0x1014b9[_0x03f4('0x38')],qs[_0x03f4('0x39')](_0x29eace[_0x03f4('0x33')][_0x03f4('0x39')]));_0x48f8eb['attributes']=_0x48f8eb[_0x03f4('0x37')][_0x03f4('0x3a')]?_0x48f8eb[_0x03f4('0x37')]:_0x1014b9[_0x03f4('0x38')];if(!_0x29eace[_0x03f4('0x33')]['hasOwnProperty'](_0x03f4('0x3b'))){_0x48f8eb[_0x03f4('0x1f')]=qs['limit'](_0x29eace[_0x03f4('0x33')][_0x03f4('0x1f')]);_0x48f8eb[_0x03f4('0x1c')]=qs['offset'](_0x29eace[_0x03f4('0x33')][_0x03f4('0x1c')]);}_0x48f8eb[_0x03f4('0x3c')]=qs['sort'](_0x29eace[_0x03f4('0x33')][_0x03f4('0x3d')]);_0x48f8eb[_0x03f4('0x3e')]=qs[_0x03f4('0x35')](_[_0x03f4('0x3f')](_0x29eace[_0x03f4('0x33')],_0x1014b9[_0x03f4('0x35')]),_0x274c66);if(_0x29eace[_0x03f4('0x33')][_0x03f4('0x40')]){_0x48f8eb['where']=_[_0x03f4('0x41')](_0x48f8eb[_0x03f4('0x3e')],{'$or':_[_0x03f4('0x2d')](_0x274c66,function(_0x1a007e){if(_0x1a007e['type']!=='VIRTUAL'){var _0x4292d0={};_0x4292d0[_0x1a007e[_0x03f4('0x2b')]]={'$like':'%'+_0x29eace['query'][_0x03f4('0x40')]+'%'};return _0x4292d0;}})});}_0x48f8eb=_[_0x03f4('0x41')]({},_0x48f8eb,_0x29eace['options']);var _0x27790f={'where':_0x48f8eb[_0x03f4('0x3e')]};return db[_0x03f4('0x2e')][_0x03f4('0x1e')](_0x27790f)[_0x03f4('0x25')](function(_0x2dd42b){_0x40a1bc['count']=_0x2dd42b;if(_0x29eace[_0x03f4('0x33')][_0x03f4('0x42')]){_0x48f8eb[_0x03f4('0x43')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x03f4('0x44')](_0x48f8eb);})[_0x03f4('0x25')](function(_0x561c01){_0x40a1bc[_0x03f4('0x45')]=_0x561c01;return _0x40a1bc;})[_0x03f4('0x25')](respondWithFilteredResult(_0x349d2f,_0x48f8eb))[_0x03f4('0x46')](handleError(_0x349d2f,null));};exports['show']=function(_0x4c2cbc,_0x4704c5){var _0x2d8bdf={'raw':![],'where':{'id':_0x4c2cbc[_0x03f4('0x47')]['id']}},_0x174868={};_0x174868[_0x03f4('0x38')]=_[_0x03f4('0x34')](db[_0x03f4('0x2e')][_0x03f4('0x2f')]);_0x174868['query']=_[_0x03f4('0x34')](_0x4c2cbc[_0x03f4('0x33')]);_0x174868[_0x03f4('0x35')]=_[_0x03f4('0x36')](_0x174868[_0x03f4('0x38')],_0x174868['query']);_0x2d8bdf[_0x03f4('0x37')]=_[_0x03f4('0x36')](_0x174868[_0x03f4('0x38')],qs[_0x03f4('0x39')](_0x4c2cbc[_0x03f4('0x33')][_0x03f4('0x39')]));_0x2d8bdf[_0x03f4('0x37')]=_0x2d8bdf[_0x03f4('0x37')][_0x03f4('0x3a')]?_0x2d8bdf[_0x03f4('0x37')]:_0x174868['model'];if(_0x4c2cbc[_0x03f4('0x33')][_0x03f4('0x42')]){_0x2d8bdf[_0x03f4('0x43')]=[{'all':!![]}];}_0x2d8bdf=_['merge']({},_0x2d8bdf,_0x4c2cbc[_0x03f4('0x48')]);return db['SugarcrmConfiguration'][_0x03f4('0x49')](_0x2d8bdf)[_0x03f4('0x25')](handleEntityNotFound(_0x4704c5,null))[_0x03f4('0x25')](respondWithResult(_0x4704c5,null))[_0x03f4('0x46')](handleError(_0x4704c5,null));};exports[_0x03f4('0x4a')]=function(_0x3a5632,_0x46ebfb){return db[_0x03f4('0x2e')][_0x03f4('0x4a')](_0x3a5632[_0x03f4('0x4b')],{})[_0x03f4('0x25')](respondWithResult(_0x46ebfb,0xc9))[_0x03f4('0x46')](handleError(_0x46ebfb,null));};exports['update']=function(_0x408434,_0x556b79){if(_0x408434[_0x03f4('0x4b')]['id']){delete _0x408434[_0x03f4('0x4b')]['id'];}return db[_0x03f4('0x2e')]['find']({'where':{'id':_0x408434[_0x03f4('0x47')]['id']}})[_0x03f4('0x25')](handleEntityNotFound(_0x556b79,null))['then'](saveUpdates(_0x408434[_0x03f4('0x4b')],null))['then'](respondWithResult(_0x556b79,null))[_0x03f4('0x46')](handleError(_0x556b79,null));};exports[_0x03f4('0x26')]=function(_0x1dabf1,_0x14561f){return db[_0x03f4('0x2e')][_0x03f4('0x49')]({'where':{'id':_0x1dabf1[_0x03f4('0x47')]['id']}})[_0x03f4('0x25')](handleEntityNotFound(_0x14561f,null))[_0x03f4('0x25')](removeEntity(_0x14561f,null))[_0x03f4('0x46')](handleError(_0x14561f,null));};exports[_0x03f4('0x4c')]=function(_0x7d7597,_0x253773,_0x58ee5c){var _0x48643c={};var _0xa812f9={};var _0x31cbc7;var _0xb176b;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x7d7597[_0x03f4('0x47')]['id']}})[_0x03f4('0x25')](handleEntityNotFound(_0x253773,null))[_0x03f4('0x25')](function(_0x37abdf){if(_0x37abdf){_0x31cbc7=_0x37abdf;_0xa812f9['model']=_['keys'](db[_0x03f4('0x4d')]['rawAttributes']);_0xa812f9[_0x03f4('0x33')]=_[_0x03f4('0x34')](_0x7d7597[_0x03f4('0x33')]);_0xa812f9[_0x03f4('0x35')]=_[_0x03f4('0x36')](_0xa812f9[_0x03f4('0x38')],_0xa812f9[_0x03f4('0x33')]);_0x48643c[_0x03f4('0x37')]=_[_0x03f4('0x36')](_0xa812f9[_0x03f4('0x38')],qs[_0x03f4('0x39')](_0x7d7597[_0x03f4('0x33')]['fields']));_0x48643c['attributes']=_0x48643c['attributes']['length']?_0x48643c['attributes']:_0xa812f9['model'];_0x48643c[_0x03f4('0x3c')]=qs[_0x03f4('0x3d')](_0x7d7597[_0x03f4('0x33')][_0x03f4('0x3d')]);_0x48643c[_0x03f4('0x3e')]=qs['filters'](_[_0x03f4('0x3f')](_0x7d7597['query'],_0xa812f9[_0x03f4('0x35')]));if(_0x7d7597[_0x03f4('0x33')][_0x03f4('0x40')]){_0x48643c[_0x03f4('0x3e')]=_['merge'](_0x48643c['where'],{'$or':_[_0x03f4('0x2d')](_0x48643c[_0x03f4('0x37')],function(_0x2ccc75){var _0x12a258={};_0x12a258[_0x2ccc75]={'$like':'%'+_0x7d7597[_0x03f4('0x33')]['filter']+'%'};return _0x12a258;})});}_0x48643c=_[_0x03f4('0x41')]({},_0x48643c,_0x7d7597[_0x03f4('0x48')]);return _0x31cbc7['getFields'](_0x48643c);}})[_0x03f4('0x25')](function(_0x2b943e){if(_0x2b943e){_0xb176b=_0x2b943e['length'];if(!_0x7d7597['query'][_0x03f4('0x4e')](_0x03f4('0x3b'))){_0x48643c[_0x03f4('0x1f')]=qs['limit'](_0x7d7597[_0x03f4('0x33')][_0x03f4('0x1f')]);_0x48643c[_0x03f4('0x1c')]=qs['offset'](_0x7d7597[_0x03f4('0x33')][_0x03f4('0x1c')]);}return _0x31cbc7['getFields'](_0x48643c);}})[_0x03f4('0x25')](function(_0x247449){if(_0x247449){return _0x247449?{'count':_0xb176b,'rows':_0x247449}:null;}})[_0x03f4('0x25')](respondWithResult(_0x253773,null))['catch'](handleError(_0x253773,null));};exports[_0x03f4('0x4f')]=function(_0x319a93,_0x1b373b,_0x4cda7e){var _0x3d463e={};var _0x2711bc={};var _0x6bafff;var _0x2ebdc0;return db[_0x03f4('0x2e')][_0x03f4('0x50')]({'where':{'id':_0x319a93[_0x03f4('0x47')]['id']}})[_0x03f4('0x25')](handleEntityNotFound(_0x1b373b,null))[_0x03f4('0x25')](function(_0x5b0070){if(_0x5b0070){_0x6bafff=_0x5b0070;_0x2711bc[_0x03f4('0x38')]=_[_0x03f4('0x34')](db['SugarcrmField'][_0x03f4('0x2f')]);_0x2711bc[_0x03f4('0x33')]=_[_0x03f4('0x34')](_0x319a93[_0x03f4('0x33')]);_0x2711bc['filters']=_[_0x03f4('0x36')](_0x2711bc[_0x03f4('0x38')],_0x2711bc[_0x03f4('0x33')]);_0x3d463e[_0x03f4('0x37')]=_['intersection'](_0x2711bc[_0x03f4('0x38')],qs[_0x03f4('0x39')](_0x319a93['query']['fields']));_0x3d463e['attributes']=_0x3d463e[_0x03f4('0x37')][_0x03f4('0x3a')]?_0x3d463e[_0x03f4('0x37')]:_0x2711bc['model'];_0x3d463e[_0x03f4('0x3c')]=qs[_0x03f4('0x3d')](_0x319a93[_0x03f4('0x33')]['sort']);_0x3d463e['where']=qs[_0x03f4('0x35')](_[_0x03f4('0x3f')](_0x319a93['query'],_0x2711bc[_0x03f4('0x35')]));if(_0x319a93[_0x03f4('0x33')][_0x03f4('0x40')]){_0x3d463e[_0x03f4('0x3e')]=_[_0x03f4('0x41')](_0x3d463e[_0x03f4('0x3e')],{'$or':_[_0x03f4('0x2d')](_0x3d463e['attributes'],function(_0x4ab760){var _0x53473a={};_0x53473a[_0x4ab760]={'$like':'%'+_0x319a93['query'][_0x03f4('0x40')]+'%'};return _0x53473a;})});}_0x3d463e=_[_0x03f4('0x41')]({},_0x3d463e,_0x319a93['options']);return _0x6bafff[_0x03f4('0x4f')](_0x3d463e);}})[_0x03f4('0x25')](function(_0x14efa8){if(_0x14efa8){_0x2ebdc0=_0x14efa8[_0x03f4('0x3a')];if(!_0x319a93[_0x03f4('0x33')]['hasOwnProperty'](_0x03f4('0x3b'))){_0x3d463e[_0x03f4('0x1f')]=qs['limit'](_0x319a93[_0x03f4('0x33')]['limit']);_0x3d463e[_0x03f4('0x1c')]=qs[_0x03f4('0x1c')](_0x319a93[_0x03f4('0x33')][_0x03f4('0x1c')]);}return _0x6bafff[_0x03f4('0x4f')](_0x3d463e);}})[_0x03f4('0x25')](function(_0x29f7d6){if(_0x29f7d6){return _0x29f7d6?{'count':_0x2ebdc0,'rows':_0x29f7d6}:null;}})[_0x03f4('0x25')](respondWithResult(_0x1b373b,null))[_0x03f4('0x46')](handleError(_0x1b373b,null));};exports['getDescriptions']=function(_0x104823,_0x5af649,_0x3a290e){var _0x541aae={};var _0x3a682c={};var _0x237bf8;var _0x13ebf0;return db[_0x03f4('0x2e')]['findOne']({'where':{'id':_0x104823[_0x03f4('0x47')]['id']}})[_0x03f4('0x25')](handleEntityNotFound(_0x5af649,null))['then'](function(_0x54abd1){if(_0x54abd1){_0x237bf8=_0x54abd1;_0x3a682c[_0x03f4('0x38')]=_['keys'](db[_0x03f4('0x4d')][_0x03f4('0x2f')]);_0x3a682c['query']=_[_0x03f4('0x34')](_0x104823[_0x03f4('0x33')]);_0x3a682c[_0x03f4('0x35')]=_['intersection'](_0x3a682c['model'],_0x3a682c[_0x03f4('0x33')]);_0x541aae[_0x03f4('0x37')]=_[_0x03f4('0x36')](_0x3a682c[_0x03f4('0x38')],qs[_0x03f4('0x39')](_0x104823['query'][_0x03f4('0x39')]));_0x541aae[_0x03f4('0x37')]=_0x541aae['attributes'][_0x03f4('0x3a')]?_0x541aae[_0x03f4('0x37')]:_0x3a682c[_0x03f4('0x38')];_0x541aae[_0x03f4('0x3c')]=qs['sort'](_0x104823[_0x03f4('0x33')][_0x03f4('0x3d')]);_0x541aae['where']=qs['filters'](_[_0x03f4('0x3f')](_0x104823[_0x03f4('0x33')],_0x3a682c[_0x03f4('0x35')]));if(_0x104823[_0x03f4('0x33')][_0x03f4('0x40')]){_0x541aae['where']=_[_0x03f4('0x41')](_0x541aae[_0x03f4('0x3e')],{'$or':_[_0x03f4('0x2d')](_0x541aae[_0x03f4('0x37')],function(_0x331129){var _0x1e7c7f={};_0x1e7c7f[_0x331129]={'$like':'%'+_0x104823[_0x03f4('0x33')]['filter']+'%'};return _0x1e7c7f;})});}_0x541aae=_[_0x03f4('0x41')]({},_0x541aae,_0x104823['options']);return _0x237bf8['getDescriptions'](_0x541aae);}})[_0x03f4('0x25')](function(_0x56b09e){if(_0x56b09e){_0x13ebf0=_0x56b09e[_0x03f4('0x3a')];if(!_0x104823[_0x03f4('0x33')][_0x03f4('0x4e')](_0x03f4('0x3b'))){_0x541aae[_0x03f4('0x1f')]=qs[_0x03f4('0x1f')](_0x104823[_0x03f4('0x33')][_0x03f4('0x1f')]);_0x541aae[_0x03f4('0x1c')]=qs[_0x03f4('0x1c')](_0x104823[_0x03f4('0x33')]['offset']);}return _0x237bf8['getDescriptions'](_0x541aae);}})[_0x03f4('0x25')](function(_0x53bd04){if(_0x53bd04){return _0x53bd04?{'count':_0x13ebf0,'rows':_0x53bd04}:null;}})[_0x03f4('0x25')](respondWithResult(_0x5af649,null))[_0x03f4('0x46')](handleError(_0x5af649,null));}; \ No newline at end of file +var _0x820e=['status','end','offset','undefined','limit','Content-Range','json','reject','save','destroy','then','error','name','index','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','count','includeAll','include','rows','catch','show','keys','find','create','body','update','params','getFields','findOne','SugarcrmField','filter','options','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3e0b36,_0x3d7bec){var _0x18f252=function(_0x534c22){while(--_0x534c22){_0x3e0b36['push'](_0x3e0b36['shift']());}};_0x18f252(++_0x3d7bec);}(_0x820e,0x80));var _0xe820=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x820e[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe820('0x0'));var zipdir=require(_0xe820('0x1'));var jsonpatch=require(_0xe820('0x2'));var rp=require('request-promise');var moment=require(_0xe820('0x3'));var BPromise=require(_0xe820('0x4'));var Mustache=require(_0xe820('0x5'));var util=require('util');var path=require(_0xe820('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe820('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe820('0x8'));var crypto=require('crypto');var jsforce=require(_0xe820('0x9'));var deskjs=require(_0xe820('0xa'));var toCsv=require(_0xe820('0xb'));var querystring=require(_0xe820('0xc'));var Papa=require(_0xe820('0xd'));var Redis=require(_0xe820('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe820('0xf'));var logger=require(_0xe820('0x10'))('api');var utils=require(_0xe820('0x11'));var config=require(_0xe820('0x12'));var licenseUtil=require(_0xe820('0x13'));var db=require(_0xe820('0x14'))['db'];function respondWithStatusCode(_0x51be01,_0xe883a9){_0xe883a9=_0xe883a9||0xcc;return function(_0x29d296){if(_0x29d296){return _0x51be01[_0xe820('0x15')](_0xe883a9);}return _0x51be01[_0xe820('0x16')](_0xe883a9)[_0xe820('0x17')]();};}function respondWithResult(_0x476f65,_0x1af4ad){_0x1af4ad=_0x1af4ad||0xc8;return function(_0x2aef20){if(_0x2aef20){return _0x476f65['status'](_0x1af4ad)['json'](_0x2aef20);}};}function respondWithFilteredResult(_0x15ee7d,_0x50705b){return function(_0x581d93){if(_0x581d93){var _0xc1dd58=typeof _0x50705b[_0xe820('0x18')]===_0xe820('0x19')&&typeof _0x50705b[_0xe820('0x1a')]==='undefined';var _0x421c35=_0x581d93['count'];var _0xe94749=_0xc1dd58?0x0:_0x50705b[_0xe820('0x18')];var _0x42c340=_0xc1dd58?_0x581d93['count']:_0x50705b[_0xe820('0x18')]+_0x50705b[_0xe820('0x1a')];var _0x439504;if(_0x42c340>=_0x421c35){_0x42c340=_0x421c35;_0x439504=0xc8;}else{_0x439504=0xce;}_0x15ee7d[_0xe820('0x16')](_0x439504);return _0x15ee7d['set'](_0xe820('0x1b'),_0xe94749+'-'+_0x42c340+'/'+_0x421c35)[_0xe820('0x1c')](_0x581d93);}return null;};}function patchUpdates(_0x40eac6){return function(_0x34f226){try{jsonpatch['apply'](_0x34f226,_0x40eac6,!![]);}catch(_0x5fb7fc){return BPromise[_0xe820('0x1d')](_0x5fb7fc);}return _0x34f226[_0xe820('0x1e')]();};}function saveUpdates(_0x10da56,_0x1491dc){return function(_0x3702c6){if(_0x3702c6){return _0x3702c6['update'](_0x10da56)['then'](function(_0x364d78){return _0x364d78;});}return null;};}function removeEntity(_0x1aa486,_0x2c5d40){return function(_0x2dbb4d){if(_0x2dbb4d){return _0x2dbb4d[_0xe820('0x1f')]()[_0xe820('0x20')](function(){_0x1aa486[_0xe820('0x16')](0xcc)[_0xe820('0x17')]();});}};}function handleEntityNotFound(_0x130200,_0x45d87f){return function(_0x32348f){if(!_0x32348f){_0x130200[_0xe820('0x15')](0x194);}return _0x32348f;};}function handleError(_0x29a775,_0x289366){_0x289366=_0x289366||0x1f4;return function(_0x795aa9){logger[_0xe820('0x21')](_0x795aa9['stack']);if(_0x795aa9[_0xe820('0x22')]){delete _0x795aa9[_0xe820('0x22')];}_0x29a775[_0xe820('0x16')](_0x289366)['send'](_0x795aa9);};}exports[_0xe820('0x23')]=function(_0x51731f,_0x27a419){var _0xaf16c5={},_0x50977a={},_0x318c79={'count':0x0,'rows':[]};var _0x53ca5e=_['map'](db[_0xe820('0x24')][_0xe820('0x25')],function(_0x1b1e51){return{'name':_0x1b1e51[_0xe820('0x26')],'type':_0x1b1e51[_0xe820('0x27')][_0xe820('0x28')]};});_0x50977a[_0xe820('0x29')]=_[_0xe820('0x2a')](_0x53ca5e,_0xe820('0x22'));_0x50977a[_0xe820('0x2b')]=_['keys'](_0x51731f[_0xe820('0x2b')]);_0x50977a['filters']=_[_0xe820('0x2c')](_0x50977a[_0xe820('0x29')],_0x50977a['query']);_0xaf16c5['attributes']=_[_0xe820('0x2c')](_0x50977a[_0xe820('0x29')],qs['fields'](_0x51731f[_0xe820('0x2b')][_0xe820('0x2d')]));_0xaf16c5['attributes']=_0xaf16c5['attributes'][_0xe820('0x2e')]?_0xaf16c5[_0xe820('0x2f')]:_0x50977a[_0xe820('0x29')];if(!_0x51731f[_0xe820('0x2b')][_0xe820('0x30')](_0xe820('0x31'))){_0xaf16c5[_0xe820('0x1a')]=qs['limit'](_0x51731f['query']['limit']);_0xaf16c5['offset']=qs[_0xe820('0x18')](_0x51731f['query'][_0xe820('0x18')]);}_0xaf16c5[_0xe820('0x32')]=qs['sort'](_0x51731f[_0xe820('0x2b')][_0xe820('0x33')]);_0xaf16c5['where']=qs[_0xe820('0x34')](_[_0xe820('0x35')](_0x51731f[_0xe820('0x2b')],_0x50977a['filters']),_0x53ca5e);if(_0x51731f[_0xe820('0x2b')]['filter']){_0xaf16c5[_0xe820('0x36')]=_[_0xe820('0x37')](_0xaf16c5[_0xe820('0x36')],{'$or':_[_0xe820('0x2a')](_0x53ca5e,function(_0x4a42b3){if(_0x4a42b3[_0xe820('0x27')]!=='VIRTUAL'){var _0xd0f8d={};_0xd0f8d[_0x4a42b3[_0xe820('0x22')]]={'$like':'%'+_0x51731f[_0xe820('0x2b')]['filter']+'%'};return _0xd0f8d;}})});}_0xaf16c5=_[_0xe820('0x37')]({},_0xaf16c5,_0x51731f['options']);var _0x51bcc2={'where':_0xaf16c5[_0xe820('0x36')]};return db[_0xe820('0x24')]['count'](_0x51bcc2)['then'](function(_0x23efe4){_0x318c79[_0xe820('0x38')]=_0x23efe4;if(_0x51731f['query'][_0xe820('0x39')]){_0xaf16c5[_0xe820('0x3a')]=[{'all':!![]}];}return db[_0xe820('0x24')]['findAll'](_0xaf16c5);})[_0xe820('0x20')](function(_0x38462a){_0x318c79[_0xe820('0x3b')]=_0x38462a;return _0x318c79;})[_0xe820('0x20')](respondWithFilteredResult(_0x27a419,_0xaf16c5))[_0xe820('0x3c')](handleError(_0x27a419,null));};exports[_0xe820('0x3d')]=function(_0x68b3ad,_0x302b39){var _0x3fabec={'raw':![],'where':{'id':_0x68b3ad['params']['id']}},_0x32b0d3={};_0x32b0d3[_0xe820('0x29')]=_[_0xe820('0x3e')](db[_0xe820('0x24')][_0xe820('0x25')]);_0x32b0d3[_0xe820('0x2b')]=_[_0xe820('0x3e')](_0x68b3ad[_0xe820('0x2b')]);_0x32b0d3[_0xe820('0x34')]=_[_0xe820('0x2c')](_0x32b0d3[_0xe820('0x29')],_0x32b0d3['query']);_0x3fabec['attributes']=_[_0xe820('0x2c')](_0x32b0d3['model'],qs[_0xe820('0x2d')](_0x68b3ad[_0xe820('0x2b')][_0xe820('0x2d')]));_0x3fabec[_0xe820('0x2f')]=_0x3fabec[_0xe820('0x2f')][_0xe820('0x2e')]?_0x3fabec[_0xe820('0x2f')]:_0x32b0d3[_0xe820('0x29')];if(_0x68b3ad[_0xe820('0x2b')][_0xe820('0x39')]){_0x3fabec[_0xe820('0x3a')]=[{'all':!![]}];}_0x3fabec=_[_0xe820('0x37')]({},_0x3fabec,_0x68b3ad['options']);return db[_0xe820('0x24')][_0xe820('0x3f')](_0x3fabec)[_0xe820('0x20')](handleEntityNotFound(_0x302b39,null))['then'](respondWithResult(_0x302b39,null))[_0xe820('0x3c')](handleError(_0x302b39,null));};exports[_0xe820('0x40')]=function(_0x173e2b,_0x49c509){return db['SugarcrmConfiguration'][_0xe820('0x40')](_0x173e2b[_0xe820('0x41')],{})['then'](respondWithResult(_0x49c509,0xc9))[_0xe820('0x3c')](handleError(_0x49c509,null));};exports[_0xe820('0x42')]=function(_0x306f93,_0x4d69d1){if(_0x306f93[_0xe820('0x41')]['id']){delete _0x306f93[_0xe820('0x41')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x306f93[_0xe820('0x43')]['id']}})[_0xe820('0x20')](handleEntityNotFound(_0x4d69d1,null))['then'](saveUpdates(_0x306f93[_0xe820('0x41')],null))['then'](respondWithResult(_0x4d69d1,null))[_0xe820('0x3c')](handleError(_0x4d69d1,null));};exports[_0xe820('0x1f')]=function(_0x35adfc,_0x5a725a){return db['SugarcrmConfiguration'][_0xe820('0x3f')]({'where':{'id':_0x35adfc['params']['id']}})[_0xe820('0x20')](handleEntityNotFound(_0x5a725a,null))['then'](removeEntity(_0x5a725a,null))[_0xe820('0x3c')](handleError(_0x5a725a,null));};exports[_0xe820('0x44')]=function(_0xbd03c1,_0x1c2334,_0x583a5a){var _0x4bf07f={};var _0x3486ef={};var _0x30eb64;var _0x49fb4b;return db[_0xe820('0x24')][_0xe820('0x45')]({'where':{'id':_0xbd03c1[_0xe820('0x43')]['id']}})[_0xe820('0x20')](handleEntityNotFound(_0x1c2334,null))[_0xe820('0x20')](function(_0x59c9c6){if(_0x59c9c6){_0x30eb64=_0x59c9c6;_0x3486ef[_0xe820('0x29')]=_['keys'](db[_0xe820('0x46')][_0xe820('0x25')]);_0x3486ef[_0xe820('0x2b')]=_[_0xe820('0x3e')](_0xbd03c1['query']);_0x3486ef[_0xe820('0x34')]=_['intersection'](_0x3486ef[_0xe820('0x29')],_0x3486ef[_0xe820('0x2b')]);_0x4bf07f[_0xe820('0x2f')]=_[_0xe820('0x2c')](_0x3486ef['model'],qs[_0xe820('0x2d')](_0xbd03c1[_0xe820('0x2b')][_0xe820('0x2d')]));_0x4bf07f['attributes']=_0x4bf07f[_0xe820('0x2f')][_0xe820('0x2e')]?_0x4bf07f[_0xe820('0x2f')]:_0x3486ef[_0xe820('0x29')];_0x4bf07f[_0xe820('0x32')]=qs[_0xe820('0x33')](_0xbd03c1[_0xe820('0x2b')][_0xe820('0x33')]);_0x4bf07f[_0xe820('0x36')]=qs[_0xe820('0x34')](_['pick'](_0xbd03c1[_0xe820('0x2b')],_0x3486ef[_0xe820('0x34')]));if(_0xbd03c1['query'][_0xe820('0x47')]){_0x4bf07f[_0xe820('0x36')]=_[_0xe820('0x37')](_0x4bf07f[_0xe820('0x36')],{'$or':_['map'](_0x4bf07f[_0xe820('0x2f')],function(_0x1ba010){var _0x1db302={};_0x1db302[_0x1ba010]={'$like':'%'+_0xbd03c1[_0xe820('0x2b')][_0xe820('0x47')]+'%'};return _0x1db302;})});}_0x4bf07f=_[_0xe820('0x37')]({},_0x4bf07f,_0xbd03c1[_0xe820('0x48')]);return _0x30eb64[_0xe820('0x44')](_0x4bf07f);}})[_0xe820('0x20')](function(_0x5587d8){if(_0x5587d8){_0x49fb4b=_0x5587d8[_0xe820('0x2e')];if(!_0xbd03c1[_0xe820('0x2b')]['hasOwnProperty'](_0xe820('0x31'))){_0x4bf07f[_0xe820('0x1a')]=qs[_0xe820('0x1a')](_0xbd03c1['query']['limit']);_0x4bf07f[_0xe820('0x18')]=qs['offset'](_0xbd03c1[_0xe820('0x2b')][_0xe820('0x18')]);}return _0x30eb64[_0xe820('0x44')](_0x4bf07f);}})[_0xe820('0x20')](function(_0x1087ce){if(_0x1087ce){return _0x1087ce?{'count':_0x49fb4b,'rows':_0x1087ce}:null;}})[_0xe820('0x20')](respondWithResult(_0x1c2334,null))['catch'](handleError(_0x1c2334,null));};exports[_0xe820('0x49')]=function(_0x2c861c,_0x29e710,_0x32a1c7){var _0x559eba={};var _0x57899d={};var _0x35c1e8;var _0x16b447;return db[_0xe820('0x24')][_0xe820('0x45')]({'where':{'id':_0x2c861c[_0xe820('0x43')]['id']}})[_0xe820('0x20')](handleEntityNotFound(_0x29e710,null))[_0xe820('0x20')](function(_0x113769){if(_0x113769){_0x35c1e8=_0x113769;_0x57899d[_0xe820('0x29')]=_[_0xe820('0x3e')](db[_0xe820('0x46')][_0xe820('0x25')]);_0x57899d['query']=_[_0xe820('0x3e')](_0x2c861c['query']);_0x57899d[_0xe820('0x34')]=_['intersection'](_0x57899d[_0xe820('0x29')],_0x57899d[_0xe820('0x2b')]);_0x559eba['attributes']=_[_0xe820('0x2c')](_0x57899d['model'],qs[_0xe820('0x2d')](_0x2c861c['query'][_0xe820('0x2d')]));_0x559eba[_0xe820('0x2f')]=_0x559eba[_0xe820('0x2f')][_0xe820('0x2e')]?_0x559eba[_0xe820('0x2f')]:_0x57899d[_0xe820('0x29')];_0x559eba[_0xe820('0x32')]=qs[_0xe820('0x33')](_0x2c861c['query'][_0xe820('0x33')]);_0x559eba[_0xe820('0x36')]=qs[_0xe820('0x34')](_['pick'](_0x2c861c['query'],_0x57899d['filters']));if(_0x2c861c[_0xe820('0x2b')][_0xe820('0x47')]){_0x559eba['where']=_[_0xe820('0x37')](_0x559eba[_0xe820('0x36')],{'$or':_[_0xe820('0x2a')](_0x559eba[_0xe820('0x2f')],function(_0x31b513){var _0x55f0ed={};_0x55f0ed[_0x31b513]={'$like':'%'+_0x2c861c[_0xe820('0x2b')][_0xe820('0x47')]+'%'};return _0x55f0ed;})});}_0x559eba=_[_0xe820('0x37')]({},_0x559eba,_0x2c861c[_0xe820('0x48')]);return _0x35c1e8['getSubjects'](_0x559eba);}})[_0xe820('0x20')](function(_0x365cba){if(_0x365cba){_0x16b447=_0x365cba['length'];if(!_0x2c861c[_0xe820('0x2b')][_0xe820('0x30')](_0xe820('0x31'))){_0x559eba['limit']=qs[_0xe820('0x1a')](_0x2c861c[_0xe820('0x2b')][_0xe820('0x1a')]);_0x559eba[_0xe820('0x18')]=qs['offset'](_0x2c861c[_0xe820('0x2b')][_0xe820('0x18')]);}return _0x35c1e8[_0xe820('0x49')](_0x559eba);}})['then'](function(_0x4ba500){if(_0x4ba500){return _0x4ba500?{'count':_0x16b447,'rows':_0x4ba500}:null;}})[_0xe820('0x20')](respondWithResult(_0x29e710,null))['catch'](handleError(_0x29e710,null));};exports[_0xe820('0x4a')]=function(_0x45a9f9,_0x42c553,_0x415a55){var _0x3f5e0f={};var _0x92dcba={};var _0x35dd23;var _0x3b611c;return db[_0xe820('0x24')]['findOne']({'where':{'id':_0x45a9f9[_0xe820('0x43')]['id']}})[_0xe820('0x20')](handleEntityNotFound(_0x42c553,null))['then'](function(_0x2e8312){if(_0x2e8312){_0x35dd23=_0x2e8312;_0x92dcba[_0xe820('0x29')]=_[_0xe820('0x3e')](db[_0xe820('0x46')][_0xe820('0x25')]);_0x92dcba[_0xe820('0x2b')]=_[_0xe820('0x3e')](_0x45a9f9[_0xe820('0x2b')]);_0x92dcba[_0xe820('0x34')]=_['intersection'](_0x92dcba[_0xe820('0x29')],_0x92dcba[_0xe820('0x2b')]);_0x3f5e0f[_0xe820('0x2f')]=_[_0xe820('0x2c')](_0x92dcba['model'],qs[_0xe820('0x2d')](_0x45a9f9[_0xe820('0x2b')][_0xe820('0x2d')]));_0x3f5e0f[_0xe820('0x2f')]=_0x3f5e0f['attributes'][_0xe820('0x2e')]?_0x3f5e0f[_0xe820('0x2f')]:_0x92dcba[_0xe820('0x29')];_0x3f5e0f[_0xe820('0x32')]=qs[_0xe820('0x33')](_0x45a9f9[_0xe820('0x2b')][_0xe820('0x33')]);_0x3f5e0f[_0xe820('0x36')]=qs[_0xe820('0x34')](_[_0xe820('0x35')](_0x45a9f9[_0xe820('0x2b')],_0x92dcba['filters']));if(_0x45a9f9[_0xe820('0x2b')][_0xe820('0x47')]){_0x3f5e0f[_0xe820('0x36')]=_[_0xe820('0x37')](_0x3f5e0f[_0xe820('0x36')],{'$or':_[_0xe820('0x2a')](_0x3f5e0f[_0xe820('0x2f')],function(_0x3e0520){var _0x2c0937={};_0x2c0937[_0x3e0520]={'$like':'%'+_0x45a9f9[_0xe820('0x2b')][_0xe820('0x47')]+'%'};return _0x2c0937;})});}_0x3f5e0f=_[_0xe820('0x37')]({},_0x3f5e0f,_0x45a9f9['options']);return _0x35dd23[_0xe820('0x4a')](_0x3f5e0f);}})[_0xe820('0x20')](function(_0x2e12f0){if(_0x2e12f0){_0x3b611c=_0x2e12f0[_0xe820('0x2e')];if(!_0x45a9f9[_0xe820('0x2b')][_0xe820('0x30')]('nolimit')){_0x3f5e0f[_0xe820('0x1a')]=qs['limit'](_0x45a9f9['query'][_0xe820('0x1a')]);_0x3f5e0f[_0xe820('0x18')]=qs[_0xe820('0x18')](_0x45a9f9[_0xe820('0x2b')]['offset']);}return _0x35dd23[_0xe820('0x4a')](_0x3f5e0f);}})[_0xe820('0x20')](function(_0x2f6f2b){if(_0x2f6f2b){return _0x2f6f2b?{'count':_0x3b611c,'rows':_0x2f6f2b}:null;}})[_0xe820('0x20')](respondWithResult(_0x42c553,null))[_0xe820('0x3c')](handleError(_0x42c553,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 4b72769..c05d518 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 _0x0c0b=['rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','lodash','api','moment','bluebird','request-promise','path'];(function(_0x1ae68f,_0x5813d8){var _0x41f57d=function(_0x37ef7d){while(--_0x37ef7d){_0x1ae68f['push'](_0x1ae68f['shift']());}};_0x41f57d(++_0x5813d8);}(_0x0c0b,0x17b));var _0xb0c0=function(_0x48f01d,_0x1d67e7){_0x48f01d=_0x48f01d-0x0;var _0x4db53b=_0x0c0b[_0x48f01d];return _0x4db53b;};'use strict';var _=require(_0xb0c0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb0c0('0x1'));var moment=require(_0xb0c0('0x2'));var BPromise=require(_0xb0c0('0x3'));var rp=require(_0xb0c0('0x4'));var fs=require('fs');var path=require(_0xb0c0('0x5'));var rimraf=require(_0xb0c0('0x6'));var config=require(_0xb0c0('0x7'));var attributes=require(_0xb0c0('0x8'));module['exports']=function(_0xd6c1f6,_0x334772){return _0xd6c1f6[_0xb0c0('0x9')](_0xb0c0('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e48=['bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','../../config/logger','api','moment'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x1e48,0x170));var _0x81e4=function(_0x258919,_0x1754e6){_0x258919=_0x258919-0x0;var _0xfbd68b=_0x1e48[_0x258919];return _0xfbd68b;};'use strict';var _=require(_0x81e4('0x0'));var util=require('util');var logger=require(_0x81e4('0x1'))(_0x81e4('0x2'));var moment=require(_0x81e4('0x3'));var BPromise=require(_0x81e4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81e4('0x5'));var rimraf=require(_0x81e4('0x6'));var config=require(_0x81e4('0x7'));var attributes=require(_0x81e4('0x8'));module[_0x81e4('0x9')]=function(_0x4adf44,_0x171c17){return _0x4adf44[_0x81e4('0xa')](_0x81e4('0xb'),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 7f0ba3b..8cf9399 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 _0x569a=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x21d757,_0x5805ff){var _0x3d62a1=function(_0x19eec1){while(--_0x19eec1){_0x21d757['push'](_0x21d757['shift']());}};_0x3d62a1(++_0x5805ff);}(_0x569a,0xc9));var _0xa569=function(_0x2b2b33,_0x56606f){_0x2b2b33=_0x2b2b33-0x0;var _0x229157=_0x569a[_0x2b2b33];return _0x229157;};'use strict';var _=require(_0xa569('0x0'));var util=require(_0xa569('0x1'));var moment=require(_0xa569('0x2'));var BPromise=require(_0xa569('0x3'));var rs=require(_0xa569('0x4'));var fs=require('fs');var Redis=require(_0xa569('0x5'));var db=require(_0xa569('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa569('0x7'))('rpc');var config=require(_0xa569('0x8'));var jayson=require(_0xa569('0x9'));var client=jayson[_0xa569('0xa')][_0xa569('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb54caf,_0x4e2793,_0xb1f7d0){return new BPromise(function(_0x4f6c2a,_0x15ffd9){return client[_0xa569('0xc')](_0xb54caf,_0xb1f7d0)[_0xa569('0xd')](function(_0x3e77cd){logger[_0xa569('0xe')](_0xa569('0xf'),_0x4e2793,'request\x20sent');logger[_0xa569('0x10')](_0xa569('0x11'),_0x4e2793,_0xa569('0x12'),JSON[_0xa569('0x13')](_0x3e77cd));if(_0x3e77cd[_0xa569('0x14')]){if(_0x3e77cd[_0xa569('0x14')][_0xa569('0x15')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4e2793,_0x3e77cd[_0xa569('0x14')][_0xa569('0x16')]);return _0x15ffd9(_0x3e77cd['error'][_0xa569('0x16')]);}logger[_0xa569('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4e2793,_0x3e77cd[_0xa569('0x14')][_0xa569('0x16')]);return _0x4f6c2a(_0x3e77cd[_0xa569('0x14')]['message']);}else{logger[_0xa569('0xe')](_0xa569('0xf'),_0x4e2793,_0xa569('0x12'));_0x4f6c2a(_0x3e77cd[_0xa569('0x17')]['message']);}})[_0xa569('0x18')](function(_0x2f3920){logger[_0xa569('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4e2793,_0x2f3920);_0x15ffd9(_0x2f3920);});});} \ No newline at end of file +var _0xcf5d=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x517a47,_0x3ced22){var _0x489798=function(_0x159a7f){while(--_0x159a7f){_0x517a47['push'](_0x517a47['shift']());}};_0x489798(++_0x3ced22);}(_0xcf5d,0x139));var _0xdcf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf5d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdcf5('0x0'));var util=require(_0xdcf5('0x1'));var moment=require(_0xdcf5('0x2'));var BPromise=require(_0xdcf5('0x3'));var rs=require(_0xdcf5('0x4'));var fs=require('fs');var Redis=require(_0xdcf5('0x5'));var db=require(_0xdcf5('0x6'))['db'];var utils=require(_0xdcf5('0x7'));var logger=require(_0xdcf5('0x8'))(_0xdcf5('0x9'));var config=require(_0xdcf5('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xdcf5('0xb')][_0xdcf5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x902472,_0x137615,_0x587a07){return new BPromise(function(_0x58539a,_0x5b189b){return client[_0xdcf5('0xd')](_0x902472,_0x587a07)[_0xdcf5('0xe')](function(_0x55e180){logger['info'](_0xdcf5('0xf'),_0x137615,_0xdcf5('0x10'));logger[_0xdcf5('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x137615,'request\x20sent',JSON[_0xdcf5('0x12')](_0x55e180));if(_0x55e180[_0xdcf5('0x13')]){if(_0x55e180[_0xdcf5('0x13')][_0xdcf5('0x14')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x137615,_0x55e180[_0xdcf5('0x13')][_0xdcf5('0x15')]);return _0x5b189b(_0x55e180[_0xdcf5('0x13')][_0xdcf5('0x15')]);}logger[_0xdcf5('0x13')](_0xdcf5('0xf'),_0x137615,_0x55e180[_0xdcf5('0x13')][_0xdcf5('0x15')]);return _0x58539a(_0x55e180[_0xdcf5('0x13')]['message']);}else{logger[_0xdcf5('0x16')](_0xdcf5('0xf'),_0x137615,_0xdcf5('0x10'));_0x58539a(_0x55e180['result'][_0xdcf5('0x15')]);}})[_0xdcf5('0x17')](function(_0x3c6b33){logger[_0xdcf5('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x137615,_0x3c6b33);_0x5b189b(_0x3c6b33);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index f4576ce..287d85e 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 _0x9c5f=['post','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x9c5f,0x135));var _0xf9c5=function(_0x5224b4,_0x355198){_0x5224b4=_0x5224b4-0x0;var _0x4cd0ae=_0x9c5f[_0x5224b4];return _0x4cd0ae;};'use strict';var multer=require(_0xf9c5('0x0'));var util=require(_0xf9c5('0x1'));var path=require(_0xf9c5('0x2'));var timeout=require(_0xf9c5('0x3'));var express=require(_0xf9c5('0x4'));var router=express[_0xf9c5('0x5')]();var fs_extra=require(_0xf9c5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf9c5('0x7'));var config=require(_0xf9c5('0x8'));var controller=require(_0xf9c5('0x9'));router[_0xf9c5('0xa')]('/',auth[_0xf9c5('0xb')](),controller[_0xf9c5('0xc')]);router[_0xf9c5('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xf9c5('0xd')]);router[_0xf9c5('0xe')]('/',auth[_0xf9c5('0xb')](),controller['create']);router[_0xf9c5('0xf')](_0xf9c5('0x10'),auth[_0xf9c5('0xb')](),controller[_0xf9c5('0x11')]);router[_0xf9c5('0x12')]('/:id',auth[_0xf9c5('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0952=['get','isAuthenticated','show','post','put','/:id','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','index'];(function(_0x4e9f29,_0x1bbcbf){var _0x8e1ab3=function(_0x4a4e6b){while(--_0x4a4e6b){_0x4e9f29['push'](_0x4e9f29['shift']());}};_0x8e1ab3(++_0x1bbcbf);}(_0x0952,0x6e));var _0x2095=function(_0x3d07d9,_0x1f673d){_0x3d07d9=_0x3d07d9-0x0;var _0x109509=_0x0952[_0x3d07d9];return _0x109509;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2095('0x0'));var timeout=require(_0x2095('0x1'));var express=require(_0x2095('0x2'));var router=express['Router']();var fs_extra=require(_0x2095('0x3'));var auth=require(_0x2095('0x4'));var interaction=require(_0x2095('0x5'));var config=require(_0x2095('0x6'));var controller=require(_0x2095('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2095('0x8')]);router[_0x2095('0x9')]('/:id',auth[_0x2095('0xa')](),controller[_0x2095('0xb')]);router[_0x2095('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2095('0xd')]('/:id',auth[_0x2095('0xa')](),controller['update']);router['delete'](_0x2095('0xe'),auth[_0x2095('0xa')](),controller[_0x2095('0xf')]);module[_0x2095('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 71b55ec..ed9a41e 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 _0x34c8=['keyValue','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x16caba,_0x1d2d98){var _0x227f25=function(_0x529242){while(--_0x529242){_0x16caba['push'](_0x16caba['shift']());}};_0x227f25(++_0x1d2d98);}(_0x34c8,0xaa));var _0x834c=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x34c8[_0x3070dc];return _0x431489;};'use strict';var Sequelize=require(_0x834c('0x0'));module[_0x834c('0x1')]={'type':{'type':Sequelize[_0x834c('0x2')](_0x834c('0x3'),_0x834c('0x4'),'customVariable',_0x834c('0x5'),'picklist'),'defaultValue':_0x834c('0x3')},'content':{'type':Sequelize[_0x834c('0x6')]},'key':{'type':Sequelize[_0x834c('0x6')]},'keyType':{'type':Sequelize[_0x834c('0x2')](_0x834c('0x3'),_0x834c('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x834c('0x6')]},'idField':{'type':Sequelize[_0x834c('0x6')]},'nameField':{'type':Sequelize[_0x834c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa7c2=['customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0xa7c2,0x182));var _0x2a7c=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xa7c2[_0x39096d];return _0x13da4f;};'use strict';var Sequelize=require(_0x2a7c('0x0'));module[_0x2a7c('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2a7c('0x2'),_0x2a7c('0x3'),_0x2a7c('0x4'),_0x2a7c('0x5'),_0x2a7c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2a7c('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2a7c('0x8')](_0x2a7c('0x2'),_0x2a7c('0x3'),_0x2a7c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2a7c('0x7')]},'nameField':{'type':Sequelize[_0x2a7c('0x7')]},'customField':{'type':Sequelize[_0x2a7c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a7c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 722b988..eb5b6e5 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 _0x09f6=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','create','body'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0x09f6,0xdb));var _0x609f=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x09f6[_0x288f5e];return _0x476cc9;};'use strict';var emlformat=require(_0x609f('0x0'));var rimraf=require(_0x609f('0x1'));var zipdir=require(_0x609f('0x2'));var jsonpatch=require(_0x609f('0x3'));var rp=require('request-promise');var moment=require(_0x609f('0x4'));var BPromise=require(_0x609f('0x5'));var Mustache=require(_0x609f('0x6'));var util=require(_0x609f('0x7'));var path=require(_0x609f('0x8'));var sox=require('sox');var csv=require(_0x609f('0x9'));var ejs=require(_0x609f('0xa'));var fs=require('fs');var fs_extra=require(_0x609f('0xb'));var _=require('lodash');var squel=require(_0x609f('0xc'));var crypto=require(_0x609f('0xd'));var jsforce=require(_0x609f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x609f('0x9'));var querystring=require(_0x609f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x609f('0x10'));var qs=require(_0x609f('0x11'));var as=require(_0x609f('0x12'));var hardwareService=require(_0x609f('0x13'));var logger=require(_0x609f('0x14'))(_0x609f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x609f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1203ae,_0x2e9d81){_0x2e9d81=_0x2e9d81||0xcc;return function(_0x54b120){if(_0x54b120){return _0x1203ae['sendStatus'](_0x2e9d81);}return _0x1203ae[_0x609f('0x17')](_0x2e9d81)[_0x609f('0x18')]();};}function respondWithResult(_0x86493d,_0x1b9900){_0x1b9900=_0x1b9900||0xc8;return function(_0x1a9c45){if(_0x1a9c45){return _0x86493d['status'](_0x1b9900)[_0x609f('0x19')](_0x1a9c45);}};}function respondWithFilteredResult(_0x1bea2e,_0x3375e6){return function(_0x5d0736){if(_0x5d0736){var _0x410918=typeof _0x3375e6[_0x609f('0x1a')]===_0x609f('0x1b')&&typeof _0x3375e6[_0x609f('0x1c')]===_0x609f('0x1b');var _0x3821de=_0x5d0736[_0x609f('0x1d')];var _0x5f00cd=_0x410918?0x0:_0x3375e6[_0x609f('0x1a')];var _0x4502fb=_0x410918?_0x5d0736[_0x609f('0x1d')]:_0x3375e6[_0x609f('0x1a')]+_0x3375e6[_0x609f('0x1c')];var _0x18a502;if(_0x4502fb>=_0x3821de){_0x4502fb=_0x3821de;_0x18a502=0xc8;}else{_0x18a502=0xce;}_0x1bea2e['status'](_0x18a502);return _0x1bea2e[_0x609f('0x1e')](_0x609f('0x1f'),_0x5f00cd+'-'+_0x4502fb+'/'+_0x3821de)[_0x609f('0x19')](_0x5d0736);}return null;};}function patchUpdates(_0x49c82f){return function(_0x29a70f){try{jsonpatch[_0x609f('0x20')](_0x29a70f,_0x49c82f,!![]);}catch(_0x35da2a){return BPromise['reject'](_0x35da2a);}return _0x29a70f[_0x609f('0x21')]();};}function saveUpdates(_0x58e403,_0x4210d8){return function(_0x5e8770){if(_0x5e8770){return _0x5e8770[_0x609f('0x22')](_0x58e403)[_0x609f('0x23')](function(_0x9aa81e){return _0x9aa81e;});}return null;};}function removeEntity(_0x3f7e68,_0x4e399c){return function(_0x4cce7b){if(_0x4cce7b){return _0x4cce7b['destroy']()[_0x609f('0x23')](function(){_0x3f7e68[_0x609f('0x17')](0xcc)[_0x609f('0x18')]();});}};}function handleEntityNotFound(_0x4e67d9,_0x4c3ab5){return function(_0x433c4d){if(!_0x433c4d){_0x4e67d9[_0x609f('0x24')](0x194);}return _0x433c4d;};}function handleError(_0xe52a5d,_0x410a5d){_0x410a5d=_0x410a5d||0x1f4;return function(_0x50d750){logger[_0x609f('0x25')](_0x50d750[_0x609f('0x26')]);if(_0x50d750[_0x609f('0x27')]){delete _0x50d750['name'];}_0xe52a5d[_0x609f('0x17')](_0x410a5d)[_0x609f('0x28')](_0x50d750);};}exports[_0x609f('0x29')]=function(_0x4ac8ed,_0x314cea){var _0x5e96f9={},_0x42645f={},_0x1c7cc1={'count':0x0,'rows':[]};var _0xbd721e=_[_0x609f('0x2a')](db[_0x609f('0x2b')][_0x609f('0x2c')],function(_0x43c956){return{'name':_0x43c956[_0x609f('0x2d')],'type':_0x43c956[_0x609f('0x2e')]['key']};});_0x42645f['model']=_[_0x609f('0x2a')](_0xbd721e,_0x609f('0x27'));_0x42645f[_0x609f('0x2f')]=_['keys'](_0x4ac8ed[_0x609f('0x2f')]);_0x42645f[_0x609f('0x30')]=_[_0x609f('0x31')](_0x42645f[_0x609f('0x32')],_0x42645f[_0x609f('0x2f')]);_0x5e96f9[_0x609f('0x33')]=_[_0x609f('0x31')](_0x42645f['model'],qs[_0x609f('0x34')](_0x4ac8ed[_0x609f('0x2f')][_0x609f('0x34')]));_0x5e96f9['attributes']=_0x5e96f9[_0x609f('0x33')][_0x609f('0x35')]?_0x5e96f9[_0x609f('0x33')]:_0x42645f[_0x609f('0x32')];if(!_0x4ac8ed[_0x609f('0x2f')]['hasOwnProperty']('nolimit')){_0x5e96f9[_0x609f('0x1c')]=qs[_0x609f('0x1c')](_0x4ac8ed[_0x609f('0x2f')][_0x609f('0x1c')]);_0x5e96f9['offset']=qs[_0x609f('0x1a')](_0x4ac8ed[_0x609f('0x2f')][_0x609f('0x1a')]);}_0x5e96f9[_0x609f('0x36')]=qs[_0x609f('0x37')](_0x4ac8ed[_0x609f('0x2f')]['sort']);_0x5e96f9[_0x609f('0x38')]=qs[_0x609f('0x30')](_[_0x609f('0x39')](_0x4ac8ed[_0x609f('0x2f')],_0x42645f[_0x609f('0x30')]),_0xbd721e);if(_0x4ac8ed['query'][_0x609f('0x3a')]){_0x5e96f9['where']=_['merge'](_0x5e96f9[_0x609f('0x38')],{'$or':_[_0x609f('0x2a')](_0xbd721e,function(_0x5b7be4){if(_0x5b7be4[_0x609f('0x2e')]!==_0x609f('0x3b')){var _0x4b56a0={};_0x4b56a0[_0x5b7be4[_0x609f('0x27')]]={'$like':'%'+_0x4ac8ed['query'][_0x609f('0x3a')]+'%'};return _0x4b56a0;}})});}_0x5e96f9=_['merge']({},_0x5e96f9,_0x4ac8ed['options']);var _0xc386ee={'where':_0x5e96f9['where']};return db[_0x609f('0x2b')][_0x609f('0x1d')](_0xc386ee)[_0x609f('0x23')](function(_0x2e9bb0){_0x1c7cc1[_0x609f('0x1d')]=_0x2e9bb0;if(_0x4ac8ed['query'][_0x609f('0x3c')]){_0x5e96f9[_0x609f('0x3d')]=[{'all':!![]}];}return db[_0x609f('0x2b')][_0x609f('0x3e')](_0x5e96f9);})[_0x609f('0x23')](function(_0xbbc28d){_0x1c7cc1[_0x609f('0x3f')]=_0xbbc28d;return _0x1c7cc1;})['then'](respondWithFilteredResult(_0x314cea,_0x5e96f9))[_0x609f('0x40')](handleError(_0x314cea,null));};exports[_0x609f('0x41')]=function(_0xf84b0,_0x282d95){var _0x3cab7f={'raw':!![],'where':{'id':_0xf84b0[_0x609f('0x42')]['id']}},_0x2d2df1={};_0x2d2df1[_0x609f('0x32')]=_[_0x609f('0x43')](db[_0x609f('0x2b')][_0x609f('0x2c')]);_0x2d2df1[_0x609f('0x2f')]=_[_0x609f('0x43')](_0xf84b0['query']);_0x2d2df1[_0x609f('0x30')]=_[_0x609f('0x31')](_0x2d2df1[_0x609f('0x32')],_0x2d2df1[_0x609f('0x2f')]);_0x3cab7f[_0x609f('0x33')]=_['intersection'](_0x2d2df1[_0x609f('0x32')],qs['fields'](_0xf84b0['query']['fields']));_0x3cab7f[_0x609f('0x33')]=_0x3cab7f[_0x609f('0x33')][_0x609f('0x35')]?_0x3cab7f[_0x609f('0x33')]:_0x2d2df1[_0x609f('0x32')];if(_0xf84b0[_0x609f('0x2f')][_0x609f('0x3c')]){_0x3cab7f['include']=[{'all':!![]}];}_0x3cab7f=_[_0x609f('0x44')]({},_0x3cab7f,_0xf84b0[_0x609f('0x45')]);return db['SugarcrmField'][_0x609f('0x46')](_0x3cab7f)[_0x609f('0x23')](handleEntityNotFound(_0x282d95,null))[_0x609f('0x23')](respondWithResult(_0x282d95,null))[_0x609f('0x40')](handleError(_0x282d95,null));};exports['create']=function(_0xc02fb1,_0x5823d3){return db[_0x609f('0x2b')][_0x609f('0x47')](_0xc02fb1[_0x609f('0x48')],{})[_0x609f('0x23')](respondWithResult(_0x5823d3,0xc9))[_0x609f('0x40')](handleError(_0x5823d3,null));};exports[_0x609f('0x22')]=function(_0x249b86,_0x47c433){if(_0x249b86[_0x609f('0x48')]['id']){delete _0x249b86[_0x609f('0x48')]['id'];}return db[_0x609f('0x2b')][_0x609f('0x46')]({'where':{'id':_0x249b86['params']['id']}})['then'](handleEntityNotFound(_0x47c433,null))[_0x609f('0x23')](saveUpdates(_0x249b86['body'],null))[_0x609f('0x23')](respondWithResult(_0x47c433,null))[_0x609f('0x40')](handleError(_0x47c433,null));};exports['destroy']=function(_0x405c25,_0x2961b6){return db[_0x609f('0x2b')]['find']({'where':{'id':_0x405c25[_0x609f('0x42')]['id']}})[_0x609f('0x23')](handleEntityNotFound(_0x2961b6,null))[_0x609f('0x23')](removeEntity(_0x2961b6,null))['catch'](handleError(_0x2961b6,null));}; \ No newline at end of file +var _0x7201=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0xad5fb2,_0x26966e){var _0x3464c6=function(_0x28083e){while(--_0x28083e){_0xad5fb2['push'](_0xad5fb2['shift']());}};_0x3464c6(++_0x26966e);}(_0x7201,0xf6));var _0x1720=function(_0x523118,_0x2636f9){_0x523118=_0x523118-0x0;var _0x56dc93=_0x7201[_0x523118];return _0x56dc93;};'use strict';var emlformat=require(_0x1720('0x0'));var rimraf=require(_0x1720('0x1'));var zipdir=require(_0x1720('0x2'));var jsonpatch=require(_0x1720('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1720('0x4'));var Mustache=require(_0x1720('0x5'));var util=require(_0x1720('0x6'));var path=require(_0x1720('0x7'));var sox=require(_0x1720('0x8'));var csv=require(_0x1720('0x9'));var ejs=require(_0x1720('0xa'));var fs=require('fs');var fs_extra=require(_0x1720('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1720('0xc'));var jsforce=require(_0x1720('0xd'));var deskjs=require(_0x1720('0xe'));var toCsv=require(_0x1720('0x9'));var querystring=require('querystring');var Papa=require(_0x1720('0xf'));var Redis=require(_0x1720('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1720('0x11'));var as=require(_0x1720('0x12'));var hardwareService=require(_0x1720('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1720('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1720('0x15'));var db=require(_0x1720('0x16'))['db'];function respondWithStatusCode(_0x5c4d64,_0x4b4ff9){_0x4b4ff9=_0x4b4ff9||0xcc;return function(_0x4095a9){if(_0x4095a9){return _0x5c4d64[_0x1720('0x17')](_0x4b4ff9);}return _0x5c4d64[_0x1720('0x18')](_0x4b4ff9)[_0x1720('0x19')]();};}function respondWithResult(_0xd54d75,_0xc468c8){_0xc468c8=_0xc468c8||0xc8;return function(_0x3fd009){if(_0x3fd009){return _0xd54d75[_0x1720('0x18')](_0xc468c8)['json'](_0x3fd009);}};}function respondWithFilteredResult(_0x580a6b,_0xfaf74f){return function(_0x28ee9c){if(_0x28ee9c){var _0x4efe08=typeof _0xfaf74f['offset']===_0x1720('0x1a')&&typeof _0xfaf74f[_0x1720('0x1b')]===_0x1720('0x1a');var _0x1688ec=_0x28ee9c[_0x1720('0x1c')];var _0x205968=_0x4efe08?0x0:_0xfaf74f[_0x1720('0x1d')];var _0xb2cf04=_0x4efe08?_0x28ee9c[_0x1720('0x1c')]:_0xfaf74f['offset']+_0xfaf74f[_0x1720('0x1b')];var _0x4ccf05;if(_0xb2cf04>=_0x1688ec){_0xb2cf04=_0x1688ec;_0x4ccf05=0xc8;}else{_0x4ccf05=0xce;}_0x580a6b[_0x1720('0x18')](_0x4ccf05);return _0x580a6b['set'](_0x1720('0x1e'),_0x205968+'-'+_0xb2cf04+'/'+_0x1688ec)[_0x1720('0x1f')](_0x28ee9c);}return null;};}function patchUpdates(_0x5923aa){return function(_0x2145fb){try{jsonpatch[_0x1720('0x20')](_0x2145fb,_0x5923aa,!![]);}catch(_0x172e67){return BPromise[_0x1720('0x21')](_0x172e67);}return _0x2145fb[_0x1720('0x22')]();};}function saveUpdates(_0x589bf5,_0xd414a4){return function(_0x59b0ea){if(_0x59b0ea){return _0x59b0ea['update'](_0x589bf5)[_0x1720('0x23')](function(_0x1666ba){return _0x1666ba;});}return null;};}function removeEntity(_0x3448d6,_0xd5e8cb){return function(_0x1aa4d1){if(_0x1aa4d1){return _0x1aa4d1['destroy']()[_0x1720('0x23')](function(){_0x3448d6[_0x1720('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56dcb7,_0x268892){return function(_0x5a5c34){if(!_0x5a5c34){_0x56dcb7['sendStatus'](0x194);}return _0x5a5c34;};}function handleError(_0x5e3a9e,_0x61f74c){_0x61f74c=_0x61f74c||0x1f4;return function(_0x52d9d4){logger[_0x1720('0x24')](_0x52d9d4[_0x1720('0x25')]);if(_0x52d9d4[_0x1720('0x26')]){delete _0x52d9d4[_0x1720('0x26')];}_0x5e3a9e[_0x1720('0x18')](_0x61f74c)[_0x1720('0x27')](_0x52d9d4);};}exports[_0x1720('0x28')]=function(_0x1f3369,_0x2c32ce){var _0x205c94={},_0x24bbf6={},_0x37096c={'count':0x0,'rows':[]};var _0x213d5f=_[_0x1720('0x29')](db[_0x1720('0x2a')][_0x1720('0x2b')],function(_0x29f7d7){return{'name':_0x29f7d7[_0x1720('0x2c')],'type':_0x29f7d7[_0x1720('0x2d')]['key']};});_0x24bbf6[_0x1720('0x2e')]=_[_0x1720('0x29')](_0x213d5f,'name');_0x24bbf6[_0x1720('0x2f')]=_[_0x1720('0x30')](_0x1f3369[_0x1720('0x2f')]);_0x24bbf6[_0x1720('0x31')]=_[_0x1720('0x32')](_0x24bbf6[_0x1720('0x2e')],_0x24bbf6[_0x1720('0x2f')]);_0x205c94['attributes']=_[_0x1720('0x32')](_0x24bbf6['model'],qs[_0x1720('0x33')](_0x1f3369['query'][_0x1720('0x33')]));_0x205c94[_0x1720('0x34')]=_0x205c94[_0x1720('0x34')][_0x1720('0x35')]?_0x205c94[_0x1720('0x34')]:_0x24bbf6[_0x1720('0x2e')];if(!_0x1f3369['query'][_0x1720('0x36')](_0x1720('0x37'))){_0x205c94['limit']=qs[_0x1720('0x1b')](_0x1f3369[_0x1720('0x2f')][_0x1720('0x1b')]);_0x205c94['offset']=qs[_0x1720('0x1d')](_0x1f3369[_0x1720('0x2f')][_0x1720('0x1d')]);}_0x205c94[_0x1720('0x38')]=qs[_0x1720('0x39')](_0x1f3369[_0x1720('0x2f')][_0x1720('0x39')]);_0x205c94[_0x1720('0x3a')]=qs['filters'](_[_0x1720('0x3b')](_0x1f3369[_0x1720('0x2f')],_0x24bbf6[_0x1720('0x31')]),_0x213d5f);if(_0x1f3369['query'][_0x1720('0x3c')]){_0x205c94[_0x1720('0x3a')]=_[_0x1720('0x3d')](_0x205c94['where'],{'$or':_[_0x1720('0x29')](_0x213d5f,function(_0x5d07a0){if(_0x5d07a0[_0x1720('0x2d')]!==_0x1720('0x3e')){var _0x3fe337={};_0x3fe337[_0x5d07a0[_0x1720('0x26')]]={'$like':'%'+_0x1f3369['query'][_0x1720('0x3c')]+'%'};return _0x3fe337;}})});}_0x205c94=_[_0x1720('0x3d')]({},_0x205c94,_0x1f3369['options']);var _0x5d697a={'where':_0x205c94[_0x1720('0x3a')]};return db[_0x1720('0x2a')][_0x1720('0x1c')](_0x5d697a)[_0x1720('0x23')](function(_0x172174){_0x37096c[_0x1720('0x1c')]=_0x172174;if(_0x1f3369['query'][_0x1720('0x3f')]){_0x205c94[_0x1720('0x40')]=[{'all':!![]}];}return db[_0x1720('0x2a')][_0x1720('0x41')](_0x205c94);})[_0x1720('0x23')](function(_0x230d5b){_0x37096c[_0x1720('0x42')]=_0x230d5b;return _0x37096c;})[_0x1720('0x23')](respondWithFilteredResult(_0x2c32ce,_0x205c94))[_0x1720('0x43')](handleError(_0x2c32ce,null));};exports['show']=function(_0x1a75ff,_0x4b069b){var _0x2e9b70={'raw':!![],'where':{'id':_0x1a75ff[_0x1720('0x44')]['id']}},_0x489dc={};_0x489dc['model']=_[_0x1720('0x30')](db[_0x1720('0x2a')]['rawAttributes']);_0x489dc[_0x1720('0x2f')]=_[_0x1720('0x30')](_0x1a75ff[_0x1720('0x2f')]);_0x489dc[_0x1720('0x31')]=_['intersection'](_0x489dc[_0x1720('0x2e')],_0x489dc[_0x1720('0x2f')]);_0x2e9b70['attributes']=_[_0x1720('0x32')](_0x489dc[_0x1720('0x2e')],qs['fields'](_0x1a75ff[_0x1720('0x2f')][_0x1720('0x33')]));_0x2e9b70[_0x1720('0x34')]=_0x2e9b70[_0x1720('0x34')][_0x1720('0x35')]?_0x2e9b70['attributes']:_0x489dc[_0x1720('0x2e')];if(_0x1a75ff[_0x1720('0x2f')]['includeAll']){_0x2e9b70['include']=[{'all':!![]}];}_0x2e9b70=_[_0x1720('0x3d')]({},_0x2e9b70,_0x1a75ff[_0x1720('0x45')]);return db[_0x1720('0x2a')][_0x1720('0x46')](_0x2e9b70)['then'](handleEntityNotFound(_0x4b069b,null))[_0x1720('0x23')](respondWithResult(_0x4b069b,null))[_0x1720('0x43')](handleError(_0x4b069b,null));};exports[_0x1720('0x47')]=function(_0x2e130a,_0x40dd41){return db[_0x1720('0x2a')]['create'](_0x2e130a[_0x1720('0x48')],{})['then'](respondWithResult(_0x40dd41,0xc9))[_0x1720('0x43')](handleError(_0x40dd41,null));};exports[_0x1720('0x49')]=function(_0x16d0c1,_0x285340){if(_0x16d0c1['body']['id']){delete _0x16d0c1['body']['id'];}return db[_0x1720('0x2a')][_0x1720('0x46')]({'where':{'id':_0x16d0c1[_0x1720('0x44')]['id']}})[_0x1720('0x23')](handleEntityNotFound(_0x285340,null))['then'](saveUpdates(_0x16d0c1[_0x1720('0x48')],null))[_0x1720('0x23')](respondWithResult(_0x285340,null))['catch'](handleError(_0x285340,null));};exports[_0x1720('0x4a')]=function(_0x50b130,_0x577e50){return db['SugarcrmField'][_0x1720('0x46')]({'where':{'id':_0x50b130[_0x1720('0x44')]['id']}})[_0x1720('0x23')](handleEntityNotFound(_0x577e50,null))[_0x1720('0x23')](removeEntity(_0x577e50,null))[_0x1720('0x43')](handleError(_0x577e50,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 61fdc43..6741d83 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 _0x5209=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId'];(function(_0x52a30a,_0x102c2a){var _0x10fa64=function(_0x349b0f){while(--_0x349b0f){_0x52a30a['push'](_0x52a30a['shift']());}};_0x10fa64(++_0x102c2a);}(_0x5209,0x70));var _0x9520=function(_0x46b7ed,_0x211e80){_0x46b7ed=_0x46b7ed-0x0;var _0x25ffb4=_0x5209[_0x46b7ed];return _0x25ffb4;};'use strict';var _=require(_0x9520('0x0'));var util=require(_0x9520('0x1'));var logger=require(_0x9520('0x2'))(_0x9520('0x3'));var moment=require(_0x9520('0x4'));var BPromise=require(_0x9520('0x5'));var rp=require(_0x9520('0x6'));var fs=require('fs');var path=require(_0x9520('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0x9520('0x8')]=function(_0x3e29f7,_0x342f57){return _0x3e29f7[_0x9520('0x9')](_0x9520('0xa'),attributes,{'tableName':_0x9520('0xb'),'paranoid':![],'indexes':[{'name':_0x9520('0xc'),'fields':['idField',_0x9520('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3366=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x46ea96,_0x2ada2a){var _0x23be1a=function(_0x41fe97){while(--_0x41fe97){_0x46ea96['push'](_0x46ea96['shift']());}};_0x23be1a(++_0x2ada2a);}(_0x3366,0x194));var _0x6336=function(_0x7b341f,_0x11e481){_0x7b341f=_0x7b341f-0x0;var _0x46d0a1=_0x3366[_0x7b341f];return _0x46d0a1;};'use strict';var _=require('lodash');var util=require(_0x6336('0x0'));var logger=require(_0x6336('0x1'))(_0x6336('0x2'));var moment=require(_0x6336('0x3'));var BPromise=require(_0x6336('0x4'));var rp=require(_0x6336('0x5'));var fs=require('fs');var path=require(_0x6336('0x6'));var rimraf=require('rimraf');var config=require(_0x6336('0x7'));var attributes=require(_0x6336('0x8'));module[_0x6336('0x9')]=function(_0x561884,_0x2f47c5){return _0x561884[_0x6336('0xa')](_0x6336('0xb'),attributes,{'tableName':_0x6336('0xc'),'paranoid':![],'indexes':[{'name':_0x6336('0xd'),'fields':[_0x6336('0xe'),_0x6336('0xf')],'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 08b7471..4880169 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 _0xb31c=['stringify','error','code','message','info','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x40e0eb,_0x51f9a5){var _0x3b11ee=function(_0x17435d){while(--_0x17435d){_0x40e0eb['push'](_0x40e0eb['shift']());}};_0x3b11ee(++_0x51f9a5);}(_0xb31c,0xf9));var _0xcb31=function(_0x27db98,_0x186748){_0x27db98=_0x27db98-0x0;var _0x55370a=_0xb31c[_0x27db98];return _0x55370a;};'use strict';var _=require('lodash');var util=require(_0xcb31('0x0'));var moment=require(_0xcb31('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb31('0x2'));var db=require(_0xcb31('0x3'))['db'];var utils=require(_0xcb31('0x4'));var logger=require(_0xcb31('0x5'))('rpc');var config=require(_0xcb31('0x6'));var jayson=require(_0xcb31('0x7'));var client=jayson[_0xcb31('0x8')][_0xcb31('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f57bd,_0x5d966b,_0x32fffa){return new BPromise(function(_0x36cbbb,_0xa4ce28){return client[_0xcb31('0xa')](_0x2f57bd,_0x32fffa)[_0xcb31('0xb')](function(_0x5696f9){logger['info'](_0xcb31('0xc'),_0x5d966b,_0xcb31('0xd'));logger['debug'](_0xcb31('0xe'),_0x5d966b,'request\x20sent',JSON[_0xcb31('0xf')](_0x5696f9));if(_0x5696f9[_0xcb31('0x10')]){if(_0x5696f9[_0xcb31('0x10')][_0xcb31('0x11')]===0x1f4){logger[_0xcb31('0x10')](_0xcb31('0xc'),_0x5d966b,_0x5696f9['error'][_0xcb31('0x12')]);return _0xa4ce28(_0x5696f9[_0xcb31('0x10')]['message']);}logger['error'](_0xcb31('0xc'),_0x5d966b,_0x5696f9['error'][_0xcb31('0x12')]);return _0x36cbbb(_0x5696f9[_0xcb31('0x10')][_0xcb31('0x12')]);}else{logger[_0xcb31('0x13')](_0xcb31('0xc'),_0x5d966b,_0xcb31('0xd'));_0x36cbbb(_0x5696f9[_0xcb31('0x14')][_0xcb31('0x12')]);}})[_0xcb31('0x15')](function(_0x37765f){logger[_0xcb31('0x10')](_0xcb31('0xc'),_0x5d966b,_0x37765f);_0xa4ce28(_0x37765f);});});} \ No newline at end of file +var _0x730a=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','SugarcrmField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x730a,0x74));var _0xa730=function(_0x6cf622,_0x146e67){_0x6cf622=_0x6cf622-0x0;var _0x1887fe=_0x730a[_0x6cf622];return _0x1887fe;};'use strict';var _=require(_0xa730('0x0'));var util=require(_0xa730('0x1'));var moment=require(_0xa730('0x2'));var BPromise=require(_0xa730('0x3'));var rs=require(_0xa730('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa730('0x5'))['db'];var utils=require(_0xa730('0x6'));var logger=require(_0xa730('0x7'))(_0xa730('0x8'));var config=require(_0xa730('0x9'));var jayson=require(_0xa730('0xa'));var client=jayson[_0xa730('0xb')][_0xa730('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17ee05,_0x47f879,_0x39cb84){return new BPromise(function(_0x577cb3,_0x2ecbe7){return client[_0xa730('0xd')](_0x17ee05,_0x39cb84)[_0xa730('0xe')](function(_0x4dca3b){logger[_0xa730('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x47f879,_0xa730('0x10'));logger[_0xa730('0x11')](_0xa730('0x12'),_0x47f879,_0xa730('0x10'),JSON['stringify'](_0x4dca3b));if(_0x4dca3b[_0xa730('0x13')]){if(_0x4dca3b['error'][_0xa730('0x14')]===0x1f4){logger['error'](_0xa730('0x15'),_0x47f879,_0x4dca3b[_0xa730('0x13')][_0xa730('0x16')]);return _0x2ecbe7(_0x4dca3b[_0xa730('0x13')]['message']);}logger[_0xa730('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x47f879,_0x4dca3b[_0xa730('0x13')][_0xa730('0x16')]);return _0x577cb3(_0x4dca3b[_0xa730('0x13')][_0xa730('0x16')]);}else{logger['info'](_0xa730('0x15'),_0x47f879,_0xa730('0x10'));_0x577cb3(_0x4dca3b['result'][_0xa730('0x16')]);}})[_0xa730('0x17')](function(_0x290528){logger[_0xa730('0x13')](_0xa730('0x15'),_0x47f879,_0x290528);_0x2ecbe7(_0x290528);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index e35463f..86aee8b 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 _0x938a=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','index','/:id/configurations','isAuthenticated','/:id/fields','getFields','post','create','update','delete','destroy','exports','multer','util'];(function(_0x29fac9,_0x36d676){var _0x47fb74=function(_0x504710){while(--_0x504710){_0x29fac9['push'](_0x29fac9['shift']());}};_0x47fb74(++_0x36d676);}(_0x938a,0x1f2));var _0xa938=function(_0x334ffc,_0x112813){_0x334ffc=_0x334ffc-0x0;var _0xcdf576=_0x938a[_0x334ffc];return _0xcdf576;};'use strict';var multer=require(_0xa938('0x0'));var util=require(_0xa938('0x1'));var path=require(_0xa938('0x2'));var timeout=require(_0xa938('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa938('0x4'));var auth=require(_0xa938('0x5'));var interaction=require(_0xa938('0x6'));var config=require('../../config/environment');var controller=require(_0xa938('0x7'));router[_0xa938('0x8')]('/',auth['isAuthenticated'](),controller[_0xa938('0x9')]);router[_0xa938('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa938('0x8')](_0xa938('0xa'),auth[_0xa938('0xb')](),controller['getConfigurations']);router[_0xa938('0x8')](_0xa938('0xc'),auth[_0xa938('0xb')](),controller[_0xa938('0xd')]);router[_0xa938('0xe')]('/',auth['isAuthenticated'](),controller[_0xa938('0xf')]);router[_0xa938('0xe')](_0xa938('0xa'),auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa938('0x10')]);router[_0xa938('0x11')]('/:id',auth[_0xa938('0xb')](),controller[_0xa938('0x12')]);module[_0xa938('0x13')]=router; \ No newline at end of file +var _0x28aa=['fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x527c6d,_0x48bcc6){var _0x12463a=function(_0x379e03){while(--_0x379e03){_0x527c6d['push'](_0x527c6d['shift']());}};_0x12463a(++_0x48bcc6);}(_0x28aa,0xf8));var _0xa28a=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x28aa[_0x34bc30];return _0x5706de;};'use strict';var multer=require('multer');var util=require(_0xa28a('0x0'));var path=require(_0xa28a('0x1'));var timeout=require(_0xa28a('0x2'));var express=require(_0xa28a('0x3'));var router=express[_0xa28a('0x4')]();var fs_extra=require(_0xa28a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa28a('0x6'));var config=require(_0xa28a('0x7'));var controller=require(_0xa28a('0x8'));router[_0xa28a('0x9')]('/',auth['isAuthenticated'](),controller[_0xa28a('0xa')]);router[_0xa28a('0x9')](_0xa28a('0xb'),auth[_0xa28a('0xc')](),controller[_0xa28a('0xd')]);router[_0xa28a('0x9')](_0xa28a('0xe'),auth[_0xa28a('0xc')](),controller[_0xa28a('0xf')]);router[_0xa28a('0x9')](_0xa28a('0x10'),auth[_0xa28a('0xc')](),controller[_0xa28a('0x11')]);router[_0xa28a('0x12')]('/',auth[_0xa28a('0xc')](),controller['create']);router[_0xa28a('0x12')](_0xa28a('0xe'),auth[_0xa28a('0xc')](),controller[_0xa28a('0x13')]);router['put'](_0xa28a('0xb'),auth[_0xa28a('0xc')](),controller['update']);router[_0xa28a('0x14')](_0xa28a('0xb'),auth[_0xa28a('0xc')](),controller[_0xa28a('0x15')]);module[_0xa28a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index c1575ad..7a2dda0 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 _0x41fe=['STRING','HelpDesk','sequelize','exports'];(function(_0x32dc35,_0x278990){var _0x5accd8=function(_0xe4413a){while(--_0xe4413a){_0x32dc35['push'](_0x32dc35['shift']());}};_0x5accd8(++_0x278990);}(_0x41fe,0x15e));var _0xe41f=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0x41fe[_0xbb9dbf];return _0x30223c;};'use strict';var Sequelize=require(_0xe41f('0x0'));module[_0xe41f('0x1')]={'name':{'type':Sequelize[_0xe41f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe41f('0x2')]},'username':{'type':Sequelize[_0xe41f('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe41f('0x2')],'allowNull':![],'defaultValue':_0xe41f('0x3')},'remoteUri':{'type':Sequelize[_0xe41f('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xe41f('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1a14=['exports','STRING','HelpDesk'];(function(_0x17213c,_0x9e6ff7){var _0x53e5ed=function(_0x560b98){while(--_0x560b98){_0x17213c['push'](_0x17213c['shift']());}};_0x53e5ed(++_0x9e6ff7);}(_0x1a14,0xde));var _0x41a1=function(_0x3b0b2e,_0x21e865){_0x3b0b2e=_0x3b0b2e-0x0;var _0x517bc5=_0x1a14[_0x3b0b2e];return _0x517bc5;};'use strict';var Sequelize=require('sequelize');module[_0x41a1('0x0')]={'name':{'type':Sequelize[_0x41a1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x41a1('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x41a1('0x1')],'allowNull':![],'defaultValue':_0x41a1('0x2')},'remoteUri':{'type':Sequelize[_0x41a1('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x41a1('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 6e93a80..8152509 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 _0xe508=['description','moduleName','serverUrl','accessKey','username','remoteUri','slice','substring','lastIndexOf','format','getchallenge','success','POST','login','result','GET','describe','sessionName','autogenerated','reference','owner','remove','editable','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','VtigerAccount','fieldName','type','query','keys','filters','intersection','attributes','fields','model','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','find','create','body','params','getConfigurations','findOne','length','hasOwnProperty','Subjects','getSubjects','channel','VtigerConfiguration','VtigerField','Descriptions','md5','getFields'];(function(_0x2ee562,_0x248ba0){var _0x31a76d=function(_0x4a8d1c){while(--_0x4a8d1c){_0x2ee562['push'](_0x2ee562['shift']());}};_0x31a76d(++_0x248ba0);}(_0xe508,0x17b));var _0x8e50=function(_0x4144fc,_0x305123){_0x4144fc=_0x4144fc-0x0;var _0x61f819=_0xe508[_0x4144fc];return _0x61f819;};'use strict';var emlformat=require(_0x8e50('0x0'));var rimraf=require(_0x8e50('0x1'));var zipdir=require(_0x8e50('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e50('0x3'));var moment=require(_0x8e50('0x4'));var BPromise=require(_0x8e50('0x5'));var Mustache=require(_0x8e50('0x6'));var util=require(_0x8e50('0x7'));var path=require(_0x8e50('0x8'));var sox=require(_0x8e50('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e50('0xa'));var _=require(_0x8e50('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8e50('0xc'));var querystring=require('querystring');var Papa=require(_0x8e50('0xd'));var Redis=require('ioredis');var authService=require(_0x8e50('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8e50('0xf'));var hardwareService=require(_0x8e50('0x10'));var logger=require(_0x8e50('0x11'))(_0x8e50('0x12'));var utils=require(_0x8e50('0x13'));var config=require(_0x8e50('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x8aace5,_0x10b0c2){_0x10b0c2=_0x10b0c2||0xcc;return function(_0x257b5a){if(_0x257b5a){return _0x8aace5[_0x8e50('0x15')](_0x10b0c2);}return _0x8aace5[_0x8e50('0x16')](_0x10b0c2)[_0x8e50('0x17')]();};}function respondWithResult(_0x106d2b,_0x47fb69){_0x47fb69=_0x47fb69||0xc8;return function(_0x54cffc){if(_0x54cffc){return _0x106d2b[_0x8e50('0x16')](_0x47fb69)[_0x8e50('0x18')](_0x54cffc);}};}function respondWithFilteredResult(_0x324a63,_0x301cd8){return function(_0x4e4bff){if(_0x4e4bff){var _0x4614d7=typeof _0x301cd8[_0x8e50('0x19')]===_0x8e50('0x1a')&&typeof _0x301cd8[_0x8e50('0x1b')]==='undefined';var _0x46b33d=_0x4e4bff['count'];var _0x5dfdcf=_0x4614d7?0x0:_0x301cd8[_0x8e50('0x19')];var _0x64b83=_0x4614d7?_0x4e4bff[_0x8e50('0x1c')]:_0x301cd8['offset']+_0x301cd8[_0x8e50('0x1b')];var _0x1e82fd;if(_0x64b83>=_0x46b33d){_0x64b83=_0x46b33d;_0x1e82fd=0xc8;}else{_0x1e82fd=0xce;}_0x324a63['status'](_0x1e82fd);return _0x324a63[_0x8e50('0x1d')](_0x8e50('0x1e'),_0x5dfdcf+'-'+_0x64b83+'/'+_0x46b33d)[_0x8e50('0x18')](_0x4e4bff);}return null;};}function patchUpdates(_0x32bf66){return function(_0x5d64b7){try{jsonpatch[_0x8e50('0x1f')](_0x5d64b7,_0x32bf66,!![]);}catch(_0xcbeb9f){return BPromise[_0x8e50('0x20')](_0xcbeb9f);}return _0x5d64b7['save']();};}function saveUpdates(_0x51291d,_0x163f68){return function(_0x2056b2){if(_0x2056b2){return _0x2056b2[_0x8e50('0x21')](_0x51291d)[_0x8e50('0x22')](function(_0x4614a2){return _0x4614a2;});}return null;};}function removeEntity(_0x53fda9,_0x364788){return function(_0xa24b7a){if(_0xa24b7a){return _0xa24b7a['destroy']()[_0x8e50('0x22')](function(){_0x53fda9['status'](0xcc)[_0x8e50('0x17')]();});}};}function handleEntityNotFound(_0x193951,_0x189262){return function(_0x431ac6){if(!_0x431ac6){_0x193951['sendStatus'](0x194);}return _0x431ac6;};}function handleError(_0xfaafaf,_0x509466){_0x509466=_0x509466||0x1f4;return function(_0x5ee449){logger[_0x8e50('0x23')](_0x5ee449[_0x8e50('0x24')]);if(_0x5ee449[_0x8e50('0x25')]){delete _0x5ee449[_0x8e50('0x25')];}_0xfaafaf[_0x8e50('0x16')](_0x509466)[_0x8e50('0x26')](_0x5ee449);};}exports[_0x8e50('0x27')]=function(_0x1c96f4,_0x57a9ab){var _0x361b0c={},_0x584f97={},_0x2a6629={'count':0x0,'rows':[]};var _0x21dc3b=_[_0x8e50('0x28')](db[_0x8e50('0x29')]['rawAttributes'],function(_0x4e8ec7){return{'name':_0x4e8ec7[_0x8e50('0x2a')],'type':_0x4e8ec7[_0x8e50('0x2b')]['key']};});_0x584f97['model']=_[_0x8e50('0x28')](_0x21dc3b,_0x8e50('0x25'));_0x584f97[_0x8e50('0x2c')]=_[_0x8e50('0x2d')](_0x1c96f4[_0x8e50('0x2c')]);_0x584f97[_0x8e50('0x2e')]=_[_0x8e50('0x2f')](_0x584f97['model'],_0x584f97['query']);_0x361b0c[_0x8e50('0x30')]=_['intersection'](_0x584f97['model'],qs['fields'](_0x1c96f4['query'][_0x8e50('0x31')]));_0x361b0c[_0x8e50('0x30')]=_0x361b0c[_0x8e50('0x30')]['length']?_0x361b0c[_0x8e50('0x30')]:_0x584f97[_0x8e50('0x32')];if(!_0x1c96f4['query']['hasOwnProperty'](_0x8e50('0x33'))){_0x361b0c[_0x8e50('0x1b')]=qs[_0x8e50('0x1b')](_0x1c96f4[_0x8e50('0x2c')][_0x8e50('0x1b')]);_0x361b0c['offset']=qs['offset'](_0x1c96f4[_0x8e50('0x2c')][_0x8e50('0x19')]);}_0x361b0c[_0x8e50('0x34')]=qs['sort'](_0x1c96f4[_0x8e50('0x2c')][_0x8e50('0x35')]);_0x361b0c[_0x8e50('0x36')]=qs[_0x8e50('0x2e')](_[_0x8e50('0x37')](_0x1c96f4[_0x8e50('0x2c')],_0x584f97[_0x8e50('0x2e')]),_0x21dc3b);if(_0x1c96f4['query'][_0x8e50('0x38')]){_0x361b0c[_0x8e50('0x36')]=_[_0x8e50('0x39')](_0x361b0c[_0x8e50('0x36')],{'$or':_[_0x8e50('0x28')](_0x21dc3b,function(_0x45be84){if(_0x45be84[_0x8e50('0x2b')]!==_0x8e50('0x3a')){var _0x2f5d1d={};_0x2f5d1d[_0x45be84[_0x8e50('0x25')]]={'$like':'%'+_0x1c96f4[_0x8e50('0x2c')]['filter']+'%'};return _0x2f5d1d;}})});}_0x361b0c=_[_0x8e50('0x39')]({},_0x361b0c,_0x1c96f4[_0x8e50('0x3b')]);var _0x2c4385={'where':_0x361b0c[_0x8e50('0x36')]};return db[_0x8e50('0x29')]['count'](_0x2c4385)[_0x8e50('0x22')](function(_0x58351c){_0x2a6629[_0x8e50('0x1c')]=_0x58351c;if(_0x1c96f4['query'][_0x8e50('0x3c')]){_0x361b0c[_0x8e50('0x3d')]=[{'all':!![]}];}return db[_0x8e50('0x29')]['findAll'](_0x361b0c);})[_0x8e50('0x22')](function(_0x185054){_0x2a6629['rows']=_0x185054;return _0x2a6629;})[_0x8e50('0x22')](respondWithFilteredResult(_0x57a9ab,_0x361b0c))[_0x8e50('0x3e')](handleError(_0x57a9ab,null));};exports[_0x8e50('0x3f')]=function(_0x5be6e5,_0x262aa6){var _0x24c4d1={'raw':![],'where':{'id':_0x5be6e5['params']['id']}},_0x49af84={};_0x49af84['model']=_[_0x8e50('0x2d')](db[_0x8e50('0x29')][_0x8e50('0x40')]);_0x49af84[_0x8e50('0x2c')]=_[_0x8e50('0x2d')](_0x5be6e5[_0x8e50('0x2c')]);_0x49af84['filters']=_[_0x8e50('0x2f')](_0x49af84[_0x8e50('0x32')],_0x49af84[_0x8e50('0x2c')]);_0x24c4d1[_0x8e50('0x30')]=_[_0x8e50('0x2f')](_0x49af84['model'],qs['fields'](_0x5be6e5[_0x8e50('0x2c')][_0x8e50('0x31')]));_0x24c4d1[_0x8e50('0x30')]=_0x24c4d1[_0x8e50('0x30')]['length']?_0x24c4d1[_0x8e50('0x30')]:_0x49af84['model'];if(_0x5be6e5['query'][_0x8e50('0x3c')]){_0x24c4d1[_0x8e50('0x3d')]=[{'all':!![]}];}_0x24c4d1=_[_0x8e50('0x39')]({},_0x24c4d1,_0x5be6e5['options']);return db[_0x8e50('0x29')][_0x8e50('0x41')](_0x24c4d1)[_0x8e50('0x22')](handleEntityNotFound(_0x262aa6,null))['then'](respondWithResult(_0x262aa6,null))[_0x8e50('0x3e')](handleError(_0x262aa6,null));};exports[_0x8e50('0x42')]=function(_0x2c715d,_0x59a61c){return db[_0x8e50('0x29')][_0x8e50('0x42')](_0x2c715d['body'],{})[_0x8e50('0x22')](respondWithResult(_0x59a61c,0xc9))[_0x8e50('0x3e')](handleError(_0x59a61c,null));};exports[_0x8e50('0x21')]=function(_0x3025d3,_0x5e1a13){if(_0x3025d3['body']['id']){delete _0x3025d3[_0x8e50('0x43')]['id'];}return db['VtigerAccount'][_0x8e50('0x41')]({'where':{'id':_0x3025d3[_0x8e50('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e1a13,null))['then'](saveUpdates(_0x3025d3[_0x8e50('0x43')],null))[_0x8e50('0x22')](respondWithResult(_0x5e1a13,null))['catch'](handleError(_0x5e1a13,null));};exports['destroy']=function(_0x557796,_0x20a14e){return db[_0x8e50('0x29')][_0x8e50('0x41')]({'where':{'id':_0x557796[_0x8e50('0x44')]['id']}})[_0x8e50('0x22')](handleEntityNotFound(_0x20a14e,null))[_0x8e50('0x22')](removeEntity(_0x20a14e,null))[_0x8e50('0x3e')](handleError(_0x20a14e,null));};exports[_0x8e50('0x45')]=function(_0x60214b,_0x23d6ec,_0x156c1d){var _0x5e0557={};var _0x483822={};var _0x3c52bd;var _0x1aa1e8;return db[_0x8e50('0x29')][_0x8e50('0x46')]({'where':{'id':_0x60214b[_0x8e50('0x44')]['id']}})['then'](handleEntityNotFound(_0x23d6ec,null))[_0x8e50('0x22')](function(_0x11b545){if(_0x11b545){_0x3c52bd=_0x11b545;_0x483822['model']=_[_0x8e50('0x2d')](db['VtigerConfiguration'][_0x8e50('0x40')]);_0x483822[_0x8e50('0x2c')]=_[_0x8e50('0x2d')](_0x60214b[_0x8e50('0x2c')]);_0x483822[_0x8e50('0x2e')]=_[_0x8e50('0x2f')](_0x483822['model'],_0x483822[_0x8e50('0x2c')]);_0x5e0557[_0x8e50('0x30')]=_[_0x8e50('0x2f')](_0x483822['model'],qs[_0x8e50('0x31')](_0x60214b['query']['fields']));_0x5e0557[_0x8e50('0x30')]=_0x5e0557[_0x8e50('0x30')][_0x8e50('0x47')]?_0x5e0557['attributes']:_0x483822[_0x8e50('0x32')];_0x5e0557[_0x8e50('0x34')]=qs[_0x8e50('0x35')](_0x60214b[_0x8e50('0x2c')]['sort']);_0x5e0557[_0x8e50('0x36')]=qs[_0x8e50('0x2e')](_['pick'](_0x60214b[_0x8e50('0x2c')],_0x483822['filters']));if(_0x60214b[_0x8e50('0x2c')][_0x8e50('0x38')]){_0x5e0557[_0x8e50('0x36')]=_['merge'](_0x5e0557[_0x8e50('0x36')],{'$or':_[_0x8e50('0x28')](_0x5e0557[_0x8e50('0x30')],function(_0x20f0d1){var _0x4964c3={};_0x4964c3[_0x20f0d1]={'$like':'%'+_0x60214b[_0x8e50('0x2c')][_0x8e50('0x38')]+'%'};return _0x4964c3;})});}_0x5e0557=_[_0x8e50('0x39')]({},_0x5e0557,_0x60214b[_0x8e50('0x3b')]);return _0x3c52bd[_0x8e50('0x45')](_0x5e0557);}})[_0x8e50('0x22')](function(_0x510d6a){if(_0x510d6a){_0x1aa1e8=_0x510d6a['length'];if(!_0x60214b['query'][_0x8e50('0x48')]('nolimit')){_0x5e0557['limit']=qs['limit'](_0x60214b[_0x8e50('0x2c')][_0x8e50('0x1b')]);_0x5e0557['offset']=qs[_0x8e50('0x19')](_0x60214b['query'][_0x8e50('0x19')]);}return _0x3c52bd[_0x8e50('0x45')](_0x5e0557);}})['then'](function(_0x47ea60){if(_0x47ea60){return _0x47ea60?{'count':_0x1aa1e8,'rows':_0x47ea60}:null;}})[_0x8e50('0x22')](respondWithResult(_0x23d6ec,null))[_0x8e50('0x3e')](handleError(_0x23d6ec,null));};exports['addConfiguration']=function(_0x2ceb28,_0xa5fe40,_0x40beca){if(_0x2ceb28[_0x8e50('0x43')]['id']){delete _0x2ceb28[_0x8e50('0x43')]['id'];}return db['VtigerAccount'][_0x8e50('0x46')]({'where':{'id':_0x2ceb28['params']['id']}})[_0x8e50('0x22')](handleEntityNotFound(_0xa5fe40,null))[_0x8e50('0x22')](function(_0x353c05){if(_0x353c05){_0x2ceb28[_0x8e50('0x43')]['AccountId']=_0x353c05['id'];_0x2ceb28['body'][_0x8e50('0x49')]=integrations[_0x8e50('0x4a')](_0x2ceb28[_0x8e50('0x43')][_0x8e50('0x4b')],_0x2ceb28[_0x8e50('0x43')][_0x8e50('0x2b')]);_0x2ceb28['body']['Descriptions']=integrations['getDescriptions'](_0x2ceb28[_0x8e50('0x43')]['channel'],_0x2ceb28[_0x8e50('0x43')][_0x8e50('0x2b')]);return db[_0x8e50('0x4c')]['create'](_0x2ceb28[_0x8e50('0x43')],{'include':[{'model':db[_0x8e50('0x4d')],'as':_0x8e50('0x49')},{'model':db[_0x8e50('0x4d')],'as':_0x8e50('0x4e')}]});}return null;})[_0x8e50('0x22')](respondWithResult(_0xa5fe40,null))[_0x8e50('0x3e')](handleError(_0xa5fe40,null));};var md5=require(_0x8e50('0x4f'));exports[_0x8e50('0x50')]=function(_0x152cbd,_0xf107c7,_0x19269b){var _0x25e203=null;var _0x5eee9a=null;var _0x5fcfe5=null;var _0x184868=null;var _0x49cfba='';return db['VtigerAccount'][_0x8e50('0x46')]({'where':{'id':_0x152cbd['params']['id']},'attributes':['id',_0x8e50('0x25'),'username',_0x8e50('0x51'),_0x8e50('0x52'),'remoteUri',_0x8e50('0x53'),_0x8e50('0x54')]})['then'](handleEntityNotFound(_0xf107c7,null))[_0x8e50('0x22')](function(_0x1a0b3d){if(_0x1a0b3d){_0x25e203=_0x1a0b3d[_0x8e50('0x55')];_0x5eee9a=_0x1a0b3d[_0x8e50('0x54')];_0x5fcfe5=_0x1a0b3d['moduleName'];_0x49cfba=_0x1a0b3d[_0x8e50('0x56')];var _0x54cd0c=_0x49cfba[_0x8e50('0x57')](-0x1);if(_0x54cd0c==='/'){_0x49cfba=_0x49cfba[_0x8e50('0x58')](0x0,_0x49cfba[_0x8e50('0x59')](_0x54cd0c));}_0x184868=util[_0x8e50('0x5a')]('%s/webservice.php',_0x49cfba);var _0x549f2b={'method':'GET','uri':_0x184868,'qs':{'operation':_0x8e50('0x5b'),'username':_0x1a0b3d[_0x8e50('0x55')]},'json':!![]};return rp(_0x549f2b);}})[_0x8e50('0x22')](function(_0x56873e){if(_0x56873e[_0x8e50('0x5c')]){var _0x46fc01={'method':_0x8e50('0x5d'),'uri':_0x184868,'form':{'operation':_0x8e50('0x5e'),'username':_0x25e203,'accessKey':md5(_0x56873e[_0x8e50('0x5f')]['token']+_0x5eee9a)},'json':!![]};return rp(_0x46fc01);}})[_0x8e50('0x22')](function(_0x2d9e29){if(_0x2d9e29[_0x8e50('0x5c')]){var _0xf61331={'method':_0x8e50('0x60'),'uri':_0x184868,'qs':{'operation':_0x8e50('0x61'),'username':_0x25e203,'sessionName':_0x2d9e29['result'][_0x8e50('0x62')],'elementType':_0x5fcfe5},'json':!![]};return rp(_0xf61331);}})[_0x8e50('0x22')](function(_0x14e0a8){if(_0x14e0a8['success']){var _0x3df3b1=[_0x8e50('0x63'),_0x8e50('0x64'),_0x8e50('0x65')];_[_0x8e50('0x66')](_0x14e0a8[_0x8e50('0x5f')][_0x8e50('0x31')],function(_0x58387a){return _0x3df3b1['includes'](_0x58387a[_0x8e50('0x2b')][_0x8e50('0x25')]);});_[_0x8e50('0x66')](_0x14e0a8['result'][_0x8e50('0x31')],function(_0x414991){return _0x414991[_0x8e50('0x67')]==='false';});return{'count':_0x14e0a8[_0x8e50('0x5f')][_0x8e50('0x31')][_0x8e50('0x47')],'rows':_[_0x8e50('0x28')](_0x14e0a8[_0x8e50('0x5f')][_0x8e50('0x31')],function(_0x59655e){return{'id':_0x59655e[_0x8e50('0x25')],'name':_0x59655e[_0x8e50('0x68')],'custom':_[_0x8e50('0x69')](_0x59655e[_0x8e50('0x25')],_0x8e50('0x6a'))?!![]:![],'options':_0x59655e[_0x8e50('0x2b')][_0x8e50('0x25')]===_0x8e50('0x6b')&&_0x59655e[_0x8e50('0x2b')][_0x8e50('0x6c')][_0x8e50('0x47')]>0x0?_[_0x8e50('0x28')](_0x59655e[_0x8e50('0x2b')][_0x8e50('0x6c')],function(_0x5727d4){return{'name':_0x5727d4[_0x8e50('0x68')],'value':_0x5727d4['value']};}):[]};})};}})[_0x8e50('0x22')](respondWithResult(_0xf107c7,null))['catch'](function(_0x1f26da){console[_0x8e50('0x6d')](_0x8e50('0x6e')+_0x1f26da);var _0x446903=_0x152cbd[_0x8e50('0x2c')][_0x8e50('0x6f')]?0x1f4:_0x1f26da[_0x8e50('0x70')]||0x1f4;logger[_0x8e50('0x23')](_0x8e50('0x71'),_0x8e50('0x50'),_0x446903,JSON[_0x8e50('0x72')](_0x1f26da));delete _0x1f26da['name'];if(_0x446903===0x191){_0x446903=0x190;}_0xf107c7[_0x8e50('0x16')](_0x446903)[_0x8e50('0x26')](_0x152cbd[_0x8e50('0x2c')][_0x8e50('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x1f26da[_0x8e50('0x70')]}:_0x1f26da);});}; \ No newline at end of file +var _0xe989=['filter','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerConfiguration','VtigerField','md5','getFields','username','description','moduleName','serverUrl','accessKey','slice','substring','lastIndexOf','%s/webservice.php','GET','success','POST','result','sessionName','autogenerated','reference','owner','remove','includes','editable','startsWith','cf_','picklist','picklistValues','label','log','test','statusCode','stringify','Wrong\x20credentials','eml-format','request-promise','moment','bluebird','util','path','fs-extra','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','VtigerAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick'];(function(_0x504a01,_0x3e9259){var _0x2fc524=function(_0x288090){while(--_0x288090){_0x504a01['push'](_0x504a01['shift']());}};_0x2fc524(++_0x3e9259);}(_0xe989,0xa6));var _0x9e98=function(_0x575446,_0x1a13fa){_0x575446=_0x575446-0x0;var _0x2fb644=_0xe989[_0x575446];return _0x2fb644;};'use strict';var emlformat=require(_0x9e98('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9e98('0x1'));var moment=require(_0x9e98('0x2'));var BPromise=require(_0x9e98('0x3'));var Mustache=require('mustache');var util=require(_0x9e98('0x4'));var path=require(_0x9e98('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e98('0x6'));var _=require('lodash');var squel=require(_0x9e98('0x7'));var crypto=require('crypto');var jsforce=require(_0x9e98('0x8'));var deskjs=require(_0x9e98('0x9'));var toCsv=require(_0x9e98('0xa'));var querystring=require(_0x9e98('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9e98('0xc'));var qs=require(_0x9e98('0xd'));var as=require(_0x9e98('0xe'));var hardwareService=require(_0x9e98('0xf'));var logger=require(_0x9e98('0x10'))(_0x9e98('0x11'));var utils=require('../../config/utils');var config=require(_0x9e98('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x135948,_0x474a67){_0x474a67=_0x474a67||0xcc;return function(_0x4572da){if(_0x4572da){return _0x135948[_0x9e98('0x13')](_0x474a67);}return _0x135948[_0x9e98('0x14')](_0x474a67)['end']();};}function respondWithResult(_0x155360,_0x5f51f1){_0x5f51f1=_0x5f51f1||0xc8;return function(_0x5686c5){if(_0x5686c5){return _0x155360['status'](_0x5f51f1)[_0x9e98('0x15')](_0x5686c5);}};}function respondWithFilteredResult(_0x587a08,_0x3a4622){return function(_0x4fdb5b){if(_0x4fdb5b){var _0x3dc8c8=typeof _0x3a4622[_0x9e98('0x16')]==='undefined'&&typeof _0x3a4622[_0x9e98('0x17')]===_0x9e98('0x18');var _0x5468fa=_0x4fdb5b[_0x9e98('0x19')];var _0x273778=_0x3dc8c8?0x0:_0x3a4622[_0x9e98('0x16')];var _0x3f628f=_0x3dc8c8?_0x4fdb5b[_0x9e98('0x19')]:_0x3a4622[_0x9e98('0x16')]+_0x3a4622[_0x9e98('0x17')];var _0x41d4a7;if(_0x3f628f>=_0x5468fa){_0x3f628f=_0x5468fa;_0x41d4a7=0xc8;}else{_0x41d4a7=0xce;}_0x587a08[_0x9e98('0x14')](_0x41d4a7);return _0x587a08[_0x9e98('0x1a')](_0x9e98('0x1b'),_0x273778+'-'+_0x3f628f+'/'+_0x5468fa)['json'](_0x4fdb5b);}return null;};}function patchUpdates(_0x4bb134){return function(_0x538a06){try{jsonpatch[_0x9e98('0x1c')](_0x538a06,_0x4bb134,!![]);}catch(_0x10a8e4){return BPromise[_0x9e98('0x1d')](_0x10a8e4);}return _0x538a06[_0x9e98('0x1e')]();};}function saveUpdates(_0x4597f2,_0x21c0c9){return function(_0x55a6b5){if(_0x55a6b5){return _0x55a6b5[_0x9e98('0x1f')](_0x4597f2)[_0x9e98('0x20')](function(_0x9161a6){return _0x9161a6;});}return null;};}function removeEntity(_0x5a4aa0,_0x26c1e3){return function(_0x1f0480){if(_0x1f0480){return _0x1f0480[_0x9e98('0x21')]()[_0x9e98('0x20')](function(){_0x5a4aa0[_0x9e98('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56f331,_0x4f7962){return function(_0x5e8721){if(!_0x5e8721){_0x56f331[_0x9e98('0x13')](0x194);}return _0x5e8721;};}function handleError(_0x5d61e0,_0x5e9724){_0x5e9724=_0x5e9724||0x1f4;return function(_0x460afd){logger['error'](_0x460afd['stack']);if(_0x460afd[_0x9e98('0x22')]){delete _0x460afd[_0x9e98('0x22')];}_0x5d61e0[_0x9e98('0x14')](_0x5e9724)[_0x9e98('0x23')](_0x460afd);};}exports['index']=function(_0x34db69,_0x4c10f5){var _0x5db717={},_0x49742f={},_0x5495c7={'count':0x0,'rows':[]};var _0x2c7fc3=_['map'](db[_0x9e98('0x24')][_0x9e98('0x25')],function(_0x4e76b6){return{'name':_0x4e76b6[_0x9e98('0x26')],'type':_0x4e76b6[_0x9e98('0x27')][_0x9e98('0x28')]};});_0x49742f[_0x9e98('0x29')]=_[_0x9e98('0x2a')](_0x2c7fc3,_0x9e98('0x22'));_0x49742f['query']=_[_0x9e98('0x2b')](_0x34db69[_0x9e98('0x2c')]);_0x49742f[_0x9e98('0x2d')]=_[_0x9e98('0x2e')](_0x49742f[_0x9e98('0x29')],_0x49742f[_0x9e98('0x2c')]);_0x5db717['attributes']=_[_0x9e98('0x2e')](_0x49742f[_0x9e98('0x29')],qs[_0x9e98('0x2f')](_0x34db69[_0x9e98('0x2c')]['fields']));_0x5db717[_0x9e98('0x30')]=_0x5db717[_0x9e98('0x30')]['length']?_0x5db717[_0x9e98('0x30')]:_0x49742f[_0x9e98('0x29')];if(!_0x34db69[_0x9e98('0x2c')][_0x9e98('0x31')]('nolimit')){_0x5db717[_0x9e98('0x17')]=qs[_0x9e98('0x17')](_0x34db69[_0x9e98('0x2c')]['limit']);_0x5db717[_0x9e98('0x16')]=qs[_0x9e98('0x16')](_0x34db69['query'][_0x9e98('0x16')]);}_0x5db717[_0x9e98('0x32')]=qs[_0x9e98('0x33')](_0x34db69[_0x9e98('0x2c')][_0x9e98('0x33')]);_0x5db717[_0x9e98('0x34')]=qs['filters'](_[_0x9e98('0x35')](_0x34db69[_0x9e98('0x2c')],_0x49742f[_0x9e98('0x2d')]),_0x2c7fc3);if(_0x34db69[_0x9e98('0x2c')]['filter']){_0x5db717[_0x9e98('0x34')]=_['merge'](_0x5db717[_0x9e98('0x34')],{'$or':_[_0x9e98('0x2a')](_0x2c7fc3,function(_0x2315ef){if(_0x2315ef[_0x9e98('0x27')]!=='VIRTUAL'){var _0x4195b6={};_0x4195b6[_0x2315ef[_0x9e98('0x22')]]={'$like':'%'+_0x34db69[_0x9e98('0x2c')][_0x9e98('0x36')]+'%'};return _0x4195b6;}})});}_0x5db717=_[_0x9e98('0x37')]({},_0x5db717,_0x34db69[_0x9e98('0x38')]);var _0x509d6e={'where':_0x5db717[_0x9e98('0x34')]};return db[_0x9e98('0x24')][_0x9e98('0x19')](_0x509d6e)[_0x9e98('0x20')](function(_0x2d050b){_0x5495c7[_0x9e98('0x19')]=_0x2d050b;if(_0x34db69[_0x9e98('0x2c')][_0x9e98('0x39')]){_0x5db717[_0x9e98('0x3a')]=[{'all':!![]}];}return db[_0x9e98('0x24')][_0x9e98('0x3b')](_0x5db717);})['then'](function(_0xd01ff1){_0x5495c7['rows']=_0xd01ff1;return _0x5495c7;})[_0x9e98('0x20')](respondWithFilteredResult(_0x4c10f5,_0x5db717))[_0x9e98('0x3c')](handleError(_0x4c10f5,null));};exports[_0x9e98('0x3d')]=function(_0x7eaec9,_0x587dd8){var _0x2b98a6={'raw':![],'where':{'id':_0x7eaec9[_0x9e98('0x3e')]['id']}},_0x154aee={};_0x154aee[_0x9e98('0x29')]=_['keys'](db[_0x9e98('0x24')][_0x9e98('0x25')]);_0x154aee['query']=_[_0x9e98('0x2b')](_0x7eaec9[_0x9e98('0x2c')]);_0x154aee[_0x9e98('0x2d')]=_[_0x9e98('0x2e')](_0x154aee[_0x9e98('0x29')],_0x154aee[_0x9e98('0x2c')]);_0x2b98a6[_0x9e98('0x30')]=_[_0x9e98('0x2e')](_0x154aee['model'],qs[_0x9e98('0x2f')](_0x7eaec9['query'][_0x9e98('0x2f')]));_0x2b98a6['attributes']=_0x2b98a6[_0x9e98('0x30')][_0x9e98('0x3f')]?_0x2b98a6[_0x9e98('0x30')]:_0x154aee[_0x9e98('0x29')];if(_0x7eaec9['query'][_0x9e98('0x39')]){_0x2b98a6[_0x9e98('0x3a')]=[{'all':!![]}];}_0x2b98a6=_[_0x9e98('0x37')]({},_0x2b98a6,_0x7eaec9[_0x9e98('0x38')]);return db[_0x9e98('0x24')][_0x9e98('0x40')](_0x2b98a6)[_0x9e98('0x20')](handleEntityNotFound(_0x587dd8,null))[_0x9e98('0x20')](respondWithResult(_0x587dd8,null))[_0x9e98('0x3c')](handleError(_0x587dd8,null));};exports['create']=function(_0x24b192,_0x2f654f){return db[_0x9e98('0x24')][_0x9e98('0x41')](_0x24b192[_0x9e98('0x42')],{})[_0x9e98('0x20')](respondWithResult(_0x2f654f,0xc9))[_0x9e98('0x3c')](handleError(_0x2f654f,null));};exports['update']=function(_0x4815b8,_0x2fa264){if(_0x4815b8[_0x9e98('0x42')]['id']){delete _0x4815b8[_0x9e98('0x42')]['id'];}return db[_0x9e98('0x24')][_0x9e98('0x40')]({'where':{'id':_0x4815b8[_0x9e98('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2fa264,null))[_0x9e98('0x20')](saveUpdates(_0x4815b8[_0x9e98('0x42')],null))['then'](respondWithResult(_0x2fa264,null))[_0x9e98('0x3c')](handleError(_0x2fa264,null));};exports[_0x9e98('0x21')]=function(_0x5d69b5,_0x340941){return db[_0x9e98('0x24')]['find']({'where':{'id':_0x5d69b5[_0x9e98('0x3e')]['id']}})[_0x9e98('0x20')](handleEntityNotFound(_0x340941,null))['then'](removeEntity(_0x340941,null))['catch'](handleError(_0x340941,null));};exports[_0x9e98('0x43')]=function(_0xc7f56f,_0x4dd8fb,_0x1e2793){var _0x16afd6={};var _0x1c93d2={};var _0xd5cc82;var _0x5820ad;return db['VtigerAccount'][_0x9e98('0x44')]({'where':{'id':_0xc7f56f['params']['id']}})[_0x9e98('0x20')](handleEntityNotFound(_0x4dd8fb,null))[_0x9e98('0x20')](function(_0x3f12f0){if(_0x3f12f0){_0xd5cc82=_0x3f12f0;_0x1c93d2[_0x9e98('0x29')]=_[_0x9e98('0x2b')](db['VtigerConfiguration'][_0x9e98('0x25')]);_0x1c93d2['query']=_[_0x9e98('0x2b')](_0xc7f56f[_0x9e98('0x2c')]);_0x1c93d2['filters']=_[_0x9e98('0x2e')](_0x1c93d2[_0x9e98('0x29')],_0x1c93d2[_0x9e98('0x2c')]);_0x16afd6['attributes']=_[_0x9e98('0x2e')](_0x1c93d2['model'],qs[_0x9e98('0x2f')](_0xc7f56f['query'][_0x9e98('0x2f')]));_0x16afd6[_0x9e98('0x30')]=_0x16afd6[_0x9e98('0x30')]['length']?_0x16afd6[_0x9e98('0x30')]:_0x1c93d2[_0x9e98('0x29')];_0x16afd6['order']=qs['sort'](_0xc7f56f[_0x9e98('0x2c')][_0x9e98('0x33')]);_0x16afd6[_0x9e98('0x34')]=qs[_0x9e98('0x2d')](_[_0x9e98('0x35')](_0xc7f56f[_0x9e98('0x2c')],_0x1c93d2[_0x9e98('0x2d')]));if(_0xc7f56f['query'][_0x9e98('0x36')]){_0x16afd6['where']=_['merge'](_0x16afd6[_0x9e98('0x34')],{'$or':_[_0x9e98('0x2a')](_0x16afd6['attributes'],function(_0x980078){var _0x58d22e={};_0x58d22e[_0x980078]={'$like':'%'+_0xc7f56f[_0x9e98('0x2c')][_0x9e98('0x36')]+'%'};return _0x58d22e;})});}_0x16afd6=_['merge']({},_0x16afd6,_0xc7f56f['options']);return _0xd5cc82[_0x9e98('0x43')](_0x16afd6);}})['then'](function(_0x3d5007){if(_0x3d5007){_0x5820ad=_0x3d5007[_0x9e98('0x3f')];if(!_0xc7f56f[_0x9e98('0x2c')][_0x9e98('0x31')]('nolimit')){_0x16afd6[_0x9e98('0x17')]=qs[_0x9e98('0x17')](_0xc7f56f[_0x9e98('0x2c')][_0x9e98('0x17')]);_0x16afd6['offset']=qs[_0x9e98('0x16')](_0xc7f56f[_0x9e98('0x2c')][_0x9e98('0x16')]);}return _0xd5cc82[_0x9e98('0x43')](_0x16afd6);}})[_0x9e98('0x20')](function(_0x24b1b1){if(_0x24b1b1){return _0x24b1b1?{'count':_0x5820ad,'rows':_0x24b1b1}:null;}})[_0x9e98('0x20')](respondWithResult(_0x4dd8fb,null))[_0x9e98('0x3c')](handleError(_0x4dd8fb,null));};exports[_0x9e98('0x45')]=function(_0x27d3f1,_0x5abd33,_0x4ac1c7){if(_0x27d3f1[_0x9e98('0x42')]['id']){delete _0x27d3f1[_0x9e98('0x42')]['id'];}return db[_0x9e98('0x24')][_0x9e98('0x44')]({'where':{'id':_0x27d3f1[_0x9e98('0x3e')]['id']}})[_0x9e98('0x20')](handleEntityNotFound(_0x5abd33,null))[_0x9e98('0x20')](function(_0x576201){if(_0x576201){_0x27d3f1[_0x9e98('0x42')][_0x9e98('0x46')]=_0x576201['id'];_0x27d3f1['body'][_0x9e98('0x47')]=integrations[_0x9e98('0x48')](_0x27d3f1[_0x9e98('0x42')]['channel'],_0x27d3f1[_0x9e98('0x42')][_0x9e98('0x27')]);_0x27d3f1[_0x9e98('0x42')][_0x9e98('0x49')]=integrations[_0x9e98('0x4a')](_0x27d3f1['body'][_0x9e98('0x4b')],_0x27d3f1[_0x9e98('0x42')][_0x9e98('0x27')]);return db[_0x9e98('0x4c')]['create'](_0x27d3f1[_0x9e98('0x42')],{'include':[{'model':db[_0x9e98('0x4d')],'as':_0x9e98('0x47')},{'model':db[_0x9e98('0x4d')],'as':_0x9e98('0x49')}]});}return null;})[_0x9e98('0x20')](respondWithResult(_0x5abd33,null))[_0x9e98('0x3c')](handleError(_0x5abd33,null));};var md5=require(_0x9e98('0x4e'));exports[_0x9e98('0x4f')]=function(_0x2e9bd7,_0x212016,_0x2baa95){var _0x103ff7=null;var _0x55d13f=null;var _0xb01ad6=null;var _0x242e53=null;var _0x459d5d='';return db[_0x9e98('0x24')][_0x9e98('0x44')]({'where':{'id':_0x2e9bd7[_0x9e98('0x3e')]['id']},'attributes':['id',_0x9e98('0x22'),_0x9e98('0x50'),_0x9e98('0x51'),_0x9e98('0x52'),'remoteUri',_0x9e98('0x53'),_0x9e98('0x54')]})['then'](handleEntityNotFound(_0x212016,null))['then'](function(_0xcad415){if(_0xcad415){_0x103ff7=_0xcad415[_0x9e98('0x50')];_0x55d13f=_0xcad415[_0x9e98('0x54')];_0xb01ad6=_0xcad415[_0x9e98('0x52')];_0x459d5d=_0xcad415['remoteUri'];var _0x5a3357=_0x459d5d[_0x9e98('0x55')](-0x1);if(_0x5a3357==='/'){_0x459d5d=_0x459d5d[_0x9e98('0x56')](0x0,_0x459d5d[_0x9e98('0x57')](_0x5a3357));}_0x242e53=util['format'](_0x9e98('0x58'),_0x459d5d);var _0x149bb8={'method':_0x9e98('0x59'),'uri':_0x242e53,'qs':{'operation':'getchallenge','username':_0xcad415[_0x9e98('0x50')]},'json':!![]};return rp(_0x149bb8);}})[_0x9e98('0x20')](function(_0x3ef45d){if(_0x3ef45d[_0x9e98('0x5a')]){var _0xf77a6f={'method':_0x9e98('0x5b'),'uri':_0x242e53,'form':{'operation':'login','username':_0x103ff7,'accessKey':md5(_0x3ef45d['result']['token']+_0x55d13f)},'json':!![]};return rp(_0xf77a6f);}})['then'](function(_0x206933){if(_0x206933['success']){var _0x5b8c82={'method':_0x9e98('0x59'),'uri':_0x242e53,'qs':{'operation':'describe','username':_0x103ff7,'sessionName':_0x206933[_0x9e98('0x5c')][_0x9e98('0x5d')],'elementType':_0xb01ad6},'json':!![]};return rp(_0x5b8c82);}})[_0x9e98('0x20')](function(_0x59097b){if(_0x59097b[_0x9e98('0x5a')]){var _0x11e5a9=[_0x9e98('0x5e'),_0x9e98('0x5f'),_0x9e98('0x60')];_[_0x9e98('0x61')](_0x59097b[_0x9e98('0x5c')][_0x9e98('0x2f')],function(_0xaa757e){return _0x11e5a9[_0x9e98('0x62')](_0xaa757e[_0x9e98('0x27')][_0x9e98('0x22')]);});_[_0x9e98('0x61')](_0x59097b[_0x9e98('0x5c')][_0x9e98('0x2f')],function(_0x5da0b9){return _0x5da0b9[_0x9e98('0x63')]==='false';});return{'count':_0x59097b[_0x9e98('0x5c')][_0x9e98('0x2f')][_0x9e98('0x3f')],'rows':_[_0x9e98('0x2a')](_0x59097b[_0x9e98('0x5c')][_0x9e98('0x2f')],function(_0x16596c){return{'id':_0x16596c[_0x9e98('0x22')],'name':_0x16596c['label'],'custom':_[_0x9e98('0x64')](_0x16596c[_0x9e98('0x22')],_0x9e98('0x65'))?!![]:![],'options':_0x16596c[_0x9e98('0x27')][_0x9e98('0x22')]===_0x9e98('0x66')&&_0x16596c[_0x9e98('0x27')][_0x9e98('0x67')]['length']>0x0?_[_0x9e98('0x2a')](_0x16596c[_0x9e98('0x27')][_0x9e98('0x67')],function(_0x4fbcdc){return{'name':_0x4fbcdc[_0x9e98('0x68')],'value':_0x4fbcdc['value']};}):[]};})};}})[_0x9e98('0x20')](respondWithResult(_0x212016,null))[_0x9e98('0x3c')](function(_0x38dfff){console[_0x9e98('0x69')]('vTiger\x20error:\x20'+_0x38dfff);var _0x36dc03=_0x2e9bd7[_0x9e98('0x2c')][_0x9e98('0x6a')]?0x1f4:_0x38dfff[_0x9e98('0x6b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x9e98('0x4f'),_0x36dc03,JSON[_0x9e98('0x6c')](_0x38dfff));delete _0x38dfff[_0x9e98('0x22')];if(_0x36dc03===0x191){_0x36dc03=0x190;}_0x212016[_0x9e98('0x14')](_0x36dc03)[_0x9e98('0x23')](_0x2e9bd7[_0x9e98('0x2c')][_0x9e98('0x6a')]?{'message':_0x9e98('0x6d'),'statusCode':_0x38dfff[_0x9e98('0x6b')]}:_0x38dfff);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 50d8afa..ae7446a 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 _0xf383=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','lodash','util','../../config/logger'];(function(_0xe5eb18,_0x52d5e9){var _0x3ccb63=function(_0x3e2320){while(--_0x3e2320){_0xe5eb18['push'](_0xe5eb18['shift']());}};_0x3ccb63(++_0x52d5e9);}(_0xf383,0x135));var _0x3f38=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xf383[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x3f38('0x0'));var util=require(_0x3f38('0x1'));var logger=require(_0x3f38('0x2'))('api');var moment=require(_0x3f38('0x3'));var BPromise=require(_0x3f38('0x4'));var rp=require(_0x3f38('0x5'));var fs=require('fs');var path=require(_0x3f38('0x6'));var rimraf=require(_0x3f38('0x7'));var config=require(_0x3f38('0x8'));var attributes=require(_0x3f38('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x3f38('0xa')]=function(_0x2e7e6b,_0x4e12f5){return _0x2e7e6b[_0x3f38('0xb')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33f8=['int_vtiger_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','VtigerAccount'];(function(_0x2a8d0f,_0x42983b){var _0xf4cc50=function(_0x15f048){while(--_0x15f048){_0x2a8d0f['push'](_0x2a8d0f['shift']());}};_0xf4cc50(++_0x42983b);}(_0x33f8,0x177));var _0x833f=function(_0x5c938f,_0x1e8963){_0x5c938f=_0x5c938f-0x0;var _0x3f51a5=_0x33f8[_0x5c938f];return _0x3f51a5;};'use strict';var _=require(_0x833f('0x0'));var util=require('util');var logger=require(_0x833f('0x1'))(_0x833f('0x2'));var moment=require('moment');var BPromise=require(_0x833f('0x3'));var rp=require(_0x833f('0x4'));var fs=require('fs');var path=require(_0x833f('0x5'));var rimraf=require('rimraf');var config=require(_0x833f('0x6'));var attributes=require(_0x833f('0x7'));var integrations=require(_0x833f('0x8'));module['exports']=function(_0x4736ec,_0x333b99){return _0x4736ec['define'](_0x833f('0x9'),attributes,{'tableName':_0x833f('0xa'),'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 b92985f..1475937 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 _0xa571=['http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','limit','include','map','model','attributes','ShowVtigerAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client'];(function(_0x44c06d,_0x1c1e71){var _0x63a60d=function(_0x12308f){while(--_0x12308f){_0x44c06d['push'](_0x44c06d['shift']());}};_0x63a60d(++_0x1c1e71);}(_0xa571,0x107));var _0x1a57=function(_0x4a944e,_0x194c7f){_0x4a944e=_0x4a944e-0x0;var _0x335e8d=_0xa571[_0x4a944e];return _0x335e8d;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5352,_0x2492f5,_0x924873){return new BPromise(function(_0x5d9f45,_0x3edb40){return client[_0x1a57('0xa')](_0x3c5352,_0x924873)[_0x1a57('0xb')](function(_0x58e266){logger[_0x1a57('0xc')](_0x1a57('0xd'),_0x2492f5,_0x1a57('0xe'));logger[_0x1a57('0xf')](_0x1a57('0x10'),_0x2492f5,_0x1a57('0xe'),JSON[_0x1a57('0x11')](_0x58e266));if(_0x58e266[_0x1a57('0x12')]){if(_0x58e266['error']['code']===0x1f4){logger[_0x1a57('0x12')](_0x1a57('0xd'),_0x2492f5,_0x58e266[_0x1a57('0x12')]['message']);return _0x3edb40(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}logger['error'](_0x1a57('0xd'),_0x2492f5,_0x58e266['error'][_0x1a57('0x13')]);return _0x5d9f45(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}else{logger[_0x1a57('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x2492f5,_0x1a57('0xe'));_0x5d9f45(_0x58e266['result']['message']);}})[_0x1a57('0x14')](function(_0x1c537f){logger[_0x1a57('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x2492f5,_0x1c537f);_0x3edb40(_0x1c537f);});});}exports[_0x1a57('0x15')]=function(_0x1662a3){var _0x80f8c1=this;return new Promise(function(_0x53bb20,_0x3daa66){return db[_0x1a57('0x16')][_0x1a57('0x17')]({'raw':_0x1662a3[_0x1a57('0x18')]?_0x1662a3[_0x1a57('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1662a3['options']?_0x1662a3[_0x1a57('0x18')][_0x1a57('0x19')]||null:null,'attributes':_0x1662a3[_0x1a57('0x18')]?_0x1662a3['options']['attributes']||null:null,'limit':_0x1662a3['options']?_0x1662a3[_0x1a57('0x18')][_0x1a57('0x1a')]||null:null,'include':_0x1662a3[_0x1a57('0x18')]?_0x1662a3[_0x1a57('0x18')][_0x1a57('0x1b')]?_[_0x1a57('0x1c')](_0x1662a3[_0x1a57('0x18')][_0x1a57('0x1b')],function(_0x183ca3){return{'model':db[_0x183ca3[_0x1a57('0x1d')]],'as':_0x183ca3['as'],'attributes':_0x183ca3[_0x1a57('0x1e')],'include':_0x183ca3[_0x1a57('0x1b')]?_[_0x1a57('0x1c')](_0x183ca3[_0x1a57('0x1b')],function(_0x2f9454){return{'model':db[_0x2f9454[_0x1a57('0x1d')]],'as':_0x2f9454['as'],'attributes':_0x2f9454[_0x1a57('0x1e')],'include':_0x2f9454[_0x1a57('0x1b')]?_[_0x1a57('0x1c')](_0x2f9454[_0x1a57('0x1b')],function(_0x26584b){return{'model':db[_0x26584b[_0x1a57('0x1d')]],'as':_0x26584b['as'],'attributes':_0x26584b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x139d8c){logger[_0x1a57('0xc')]('GetVtigerAccount',_0x1662a3);logger[_0x1a57('0xf')]('GetVtigerAccount',_0x1662a3,JSON[_0x1a57('0x11')](_0x139d8c));_0x53bb20(_0x139d8c);})[_0x1a57('0x14')](function(_0x53bf6e){logger[_0x1a57('0x12')](_0x1a57('0x15'),_0x53bf6e[_0x1a57('0x13')],_0x1662a3);_0x3daa66(_0x80f8c1[_0x1a57('0x12')](0x1f4,_0x53bf6e['message']));});});};exports[_0x1a57('0x1f')]=function(_0x396832){var _0x4374f0=this;return new Promise(function(_0x160536,_0x5763ba){return db[_0x1a57('0x16')][_0x1a57('0x20')]({'raw':_0x396832[_0x1a57('0x18')]?_0x396832[_0x1a57('0x18')][_0x1a57('0x21')]===undefined?!![]:![]:!![],'where':_0x396832[_0x1a57('0x18')]?_0x396832[_0x1a57('0x18')][_0x1a57('0x19')]||null:null,'attributes':_0x396832[_0x1a57('0x18')]?_0x396832['options'][_0x1a57('0x1e')]||null:null,'include':_0x396832[_0x1a57('0x18')]?_0x396832['options']['include']?_[_0x1a57('0x1c')](_0x396832[_0x1a57('0x18')][_0x1a57('0x1b')],function(_0x170bf7){return{'model':db[_0x170bf7[_0x1a57('0x1d')]],'as':_0x170bf7['as'],'attributes':_0x170bf7[_0x1a57('0x1e')],'include':_0x170bf7[_0x1a57('0x1b')]?_[_0x1a57('0x1c')](_0x170bf7[_0x1a57('0x1b')],function(_0x2a6feb){return{'model':db[_0x2a6feb[_0x1a57('0x1d')]],'as':_0x2a6feb['as'],'attributes':_0x2a6feb[_0x1a57('0x1e')],'include':_0x2a6feb[_0x1a57('0x1b')]?_[_0x1a57('0x1c')](_0x2a6feb[_0x1a57('0x1b')],function(_0x12102f){return{'model':db[_0x12102f[_0x1a57('0x1d')]],'as':_0x12102f['as'],'attributes':_0x12102f[_0x1a57('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cd160){logger[_0x1a57('0xc')](_0x1a57('0x1f'),_0x396832);logger[_0x1a57('0xf')](_0x1a57('0x1f'),_0x396832,JSON[_0x1a57('0x11')](_0x3cd160));_0x160536(_0x3cd160);})[_0x1a57('0x14')](function(_0x23d087){logger[_0x1a57('0x12')]('ShowVtigerAccount',_0x23d087['message'],_0x396832);_0x5763ba(_0x4374f0['error'](0x1f4,_0x23d087['message']));});});}; \ No newline at end of file +var _0xeffd=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetVtigerAccount','find','ShowVtigerAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xeffd,0x6b));var _0xdeff=function(_0x593b88,_0x2faed9){_0x593b88=_0x593b88-0x0;var _0x4593c2=_0xeffd[_0x593b88];return _0x4593c2;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x281ad7,_0x256323,_0x39878e){return new BPromise(function(_0x12e953,_0x24897a){return client['request'](_0x281ad7,_0x39878e)[_0xdeff('0xd')](function(_0x45a8a6){logger[_0xdeff('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x256323,_0xdeff('0xf'));logger[_0xdeff('0x10')](_0xdeff('0x11'),_0x256323,_0xdeff('0xf'),JSON[_0xdeff('0x12')](_0x45a8a6));if(_0x45a8a6[_0xdeff('0x13')]){if(_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x14')]===0x1f4){logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')]['message']);return _0x24897a(_0x45a8a6[_0xdeff('0x13')]['message']);}logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x16')]);return _0x12e953(_0x45a8a6[_0xdeff('0x13')]['message']);}else{logger[_0xdeff('0xe')](_0xdeff('0x15'),_0x256323,_0xdeff('0xf'));_0x12e953(_0x45a8a6[_0xdeff('0x17')][_0xdeff('0x16')]);}})[_0xdeff('0x18')](function(_0x577244){logger['error'](_0xdeff('0x15'),_0x256323,_0x577244);_0x24897a(_0x577244);});});}exports['GetVtigerAccount']=function(_0x5c9837){var _0x35635f=this;return new Promise(function(_0x369e13,_0x4b14b6){return db[_0xdeff('0x19')][_0xdeff('0x1a')]({'raw':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837[_0xdeff('0x1b')][_0xdeff('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837[_0xdeff('0x1b')][_0xdeff('0x1d')]||null:null,'attributes':_0x5c9837['options']?_0x5c9837['options']['attributes']||null:null,'limit':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837['options'][_0xdeff('0x1e')]||null:null,'include':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837['options'][_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0x5c9837['options']['include'],function(_0x3b2554){return{'model':db[_0x3b2554[_0xdeff('0x21')]],'as':_0x3b2554['as'],'attributes':_0x3b2554[_0xdeff('0x22')],'include':_0x3b2554[_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0x3b2554['include'],function(_0xb08f19){return{'model':db[_0xb08f19[_0xdeff('0x21')]],'as':_0xb08f19['as'],'attributes':_0xb08f19[_0xdeff('0x22')],'include':_0xb08f19[_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0xb08f19[_0xdeff('0x1f')],function(_0x3d0111){return{'model':db[_0x3d0111['model']],'as':_0x3d0111['as'],'attributes':_0x3d0111[_0xdeff('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdeff('0xd')](function(_0x53b168){logger['info'](_0xdeff('0x23'),_0x5c9837);logger[_0xdeff('0x10')](_0xdeff('0x23'),_0x5c9837,JSON[_0xdeff('0x12')](_0x53b168));_0x369e13(_0x53b168);})[_0xdeff('0x18')](function(_0xf9b278){logger[_0xdeff('0x13')]('GetVtigerAccount',_0xf9b278[_0xdeff('0x16')],_0x5c9837);_0x4b14b6(_0x35635f[_0xdeff('0x13')](0x1f4,_0xf9b278[_0xdeff('0x16')]));});});};exports['ShowVtigerAccount']=function(_0x59f7a0){var _0x346743=this;return new Promise(function(_0x505e3f,_0x69842a){return db[_0xdeff('0x19')][_0xdeff('0x24')]({'raw':_0x59f7a0['options']?_0x59f7a0[_0xdeff('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x59f7a0['options']?_0x59f7a0[_0xdeff('0x1b')][_0xdeff('0x1d')]||null:null,'attributes':_0x59f7a0[_0xdeff('0x1b')]?_0x59f7a0[_0xdeff('0x1b')]['attributes']||null:null,'include':_0x59f7a0[_0xdeff('0x1b')]?_0x59f7a0[_0xdeff('0x1b')][_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0x59f7a0[_0xdeff('0x1b')][_0xdeff('0x1f')],function(_0x321ef0){return{'model':db[_0x321ef0['model']],'as':_0x321ef0['as'],'attributes':_0x321ef0[_0xdeff('0x22')],'include':_0x321ef0['include']?_[_0xdeff('0x20')](_0x321ef0[_0xdeff('0x1f')],function(_0x2e1736){return{'model':db[_0x2e1736[_0xdeff('0x21')]],'as':_0x2e1736['as'],'attributes':_0x2e1736[_0xdeff('0x22')],'include':_0x2e1736[_0xdeff('0x1f')]?_['map'](_0x2e1736[_0xdeff('0x1f')],function(_0x3bf462){return{'model':db[_0x3bf462['model']],'as':_0x3bf462['as'],'attributes':_0x3bf462[_0xdeff('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdeff('0xd')](function(_0x1c6d4c){logger[_0xdeff('0xe')](_0xdeff('0x25'),_0x59f7a0);logger[_0xdeff('0x10')](_0xdeff('0x25'),_0x59f7a0,JSON[_0xdeff('0x12')](_0x1c6d4c));_0x505e3f(_0x1c6d4c);})['catch'](function(_0x118752){logger['error'](_0xdeff('0x25'),_0x118752[_0xdeff('0x16')],_0x59f7a0);_0x69842a(_0x346743[_0xdeff('0x13')](0x1f4,_0x118752['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 96c62f7..a754899 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 _0xbdb7=['get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0xcfd89f,_0x106e8f){var _0x59acd4=function(_0x2e187c){while(--_0x2e187c){_0xcfd89f['push'](_0xcfd89f['shift']());}};_0x59acd4(++_0x106e8f);}(_0xbdb7,0xb8));var _0x7bdb=function(_0x339eaa,_0xbc2f72){_0x339eaa=_0x339eaa-0x0;var _0x4985b6=_0xbdb7[_0x339eaa];return _0x4985b6;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7bdb('0x2'));var router=express[_0x7bdb('0x3')]();var fs_extra=require(_0x7bdb('0x4'));var auth=require(_0x7bdb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7bdb('0x6'));var controller=require(_0x7bdb('0x7'));router[_0x7bdb('0x8')]('/',auth[_0x7bdb('0x9')](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0x8')](_0x7bdb('0xb'),auth[_0x7bdb('0x9')](),controller[_0x7bdb('0xc')]);router['get']('/:id/fields',auth[_0x7bdb('0x9')](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0x8')](_0x7bdb('0xe'),auth[_0x7bdb('0x9')](),controller[_0x7bdb('0xf')]);router[_0x7bdb('0x8')](_0x7bdb('0x10'),auth[_0x7bdb('0x9')](),controller[_0x7bdb('0x11')]);router[_0x7bdb('0x12')]('/',auth[_0x7bdb('0x9')](),controller[_0x7bdb('0x13')]);router[_0x7bdb('0x14')](_0x7bdb('0xb'),auth[_0x7bdb('0x9')](),controller[_0x7bdb('0x15')]);router['delete'](_0x7bdb('0xb'),auth[_0x7bdb('0x9')](),controller[_0x7bdb('0x16')]);module[_0x7bdb('0x17')]=router; \ No newline at end of file +var _0x8a8f=['isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','get'];(function(_0x2bfc60,_0xa254ab){var _0x44ea2c=function(_0x57ca7a){while(--_0x57ca7a){_0x2bfc60['push'](_0x2bfc60['shift']());}};_0x44ea2c(++_0xa254ab);}(_0x8a8f,0x134));var _0xf8a8=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x8a8f[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0xf8a8('0x0'));var util=require('util');var path=require(_0xf8a8('0x1'));var timeout=require('connect-timeout');var express=require(_0xf8a8('0x2'));var router=express[_0xf8a8('0x3')]();var fs_extra=require(_0xf8a8('0x4'));var auth=require(_0xf8a8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xf8a8('0x6')]('/',auth[_0xf8a8('0x7')](),controller[_0xf8a8('0x8')]);router[_0xf8a8('0x6')](_0xf8a8('0x9'),auth[_0xf8a8('0x7')](),controller[_0xf8a8('0xa')]);router[_0xf8a8('0x6')](_0xf8a8('0xb'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0xf8a8('0xc'),auth[_0xf8a8('0x7')](),controller[_0xf8a8('0xd')]);router[_0xf8a8('0x6')]('/:id/descriptions',auth[_0xf8a8('0x7')](),controller[_0xf8a8('0xe')]);router[_0xf8a8('0xf')]('/',auth[_0xf8a8('0x7')](),controller[_0xf8a8('0x10')]);router[_0xf8a8('0x11')](_0xf8a8('0x9'),auth[_0xf8a8('0x7')](),controller[_0xf8a8('0x12')]);router[_0xf8a8('0x13')](_0xf8a8('0x9'),auth[_0xf8a8('0x7')](),controller[_0xf8a8('0x14')]);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 e045447..5d7ee4b 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 _0xadc3=['exports','STRING','sequelize'];(function(_0x24f843,_0x1208f6){var _0xe6a8ec=function(_0x2e9ec1){while(--_0x2e9ec1){_0x24f843['push'](_0x24f843['shift']());}};_0xe6a8ec(++_0x1208f6);}(_0xadc3,0x9b));var _0x3adc=function(_0x38706e,_0x5bf3fe){_0x38706e=_0x38706e-0x0;var _0x38935f=_0xadc3[_0x38706e];return _0x38935f;};'use strict';var Sequelize=require(_0x3adc('0x0'));module[_0x3adc('0x1')]={'name':{'type':Sequelize[_0x3adc('0x2')]},'description':{'type':Sequelize[_0x3adc('0x2')]}}; \ No newline at end of file +var _0xe364=['STRING','sequelize','exports'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0xe364,0x190));var _0x4e36=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0xe364[_0x301c34];return _0x1a8c5a;};'use strict';var Sequelize=require(_0x4e36('0x0'));module[_0x4e36('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4e36('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index b0045fe..c9a4ebd 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 _0x9386=['type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','findOne','VtigerField','order','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','reject','update','then','destroy','stack','name','send','index','VtigerConfiguration','fieldName','key','map','keys','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter'];(function(_0x3b751a,_0x691071){var _0x2ce67e=function(_0x41fd3b){while(--_0x41fd3b){_0x3b751a['push'](_0x3b751a['shift']());}};_0x2ce67e(++_0x691071);}(_0x9386,0x6b));var _0x6938=function(_0x2cca79,_0x909faa){_0x2cca79=_0x2cca79-0x0;var _0x17e487=_0x9386[_0x2cca79];return _0x17e487;};'use strict';var emlformat=require(_0x6938('0x0'));var rimraf=require(_0x6938('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6938('0x2'));var rp=require(_0x6938('0x3'));var moment=require(_0x6938('0x4'));var BPromise=require(_0x6938('0x5'));var Mustache=require(_0x6938('0x6'));var util=require(_0x6938('0x7'));var path=require(_0x6938('0x8'));var sox=require(_0x6938('0x9'));var csv=require(_0x6938('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6938('0xb'));var _=require(_0x6938('0xc'));var squel=require(_0x6938('0xd'));var crypto=require(_0x6938('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6938('0xf'));var toCsv=require(_0x6938('0xa'));var querystring=require(_0x6938('0x10'));var Papa=require(_0x6938('0x11'));var Redis=require(_0x6938('0x12'));var authService=require(_0x6938('0x13'));var qs=require(_0x6938('0x14'));var as=require(_0x6938('0x15'));var hardwareService=require(_0x6938('0x16'));var logger=require(_0x6938('0x17'))(_0x6938('0x18'));var utils=require('../../config/utils');var config=require(_0x6938('0x19'));var licenseUtil=require(_0x6938('0x1a'));var db=require(_0x6938('0x1b'))['db'];function respondWithStatusCode(_0x26fdf6,_0x3db8f5){_0x3db8f5=_0x3db8f5||0xcc;return function(_0x5e72fd){if(_0x5e72fd){return _0x26fdf6[_0x6938('0x1c')](_0x3db8f5);}return _0x26fdf6[_0x6938('0x1d')](_0x3db8f5)[_0x6938('0x1e')]();};}function respondWithResult(_0x3595be,_0x1f2924){_0x1f2924=_0x1f2924||0xc8;return function(_0x329017){if(_0x329017){return _0x3595be[_0x6938('0x1d')](_0x1f2924)['json'](_0x329017);}};}function respondWithFilteredResult(_0x188585,_0x59126f){return function(_0xda96ff){if(_0xda96ff){var _0x5bc58d=typeof _0x59126f['offset']===_0x6938('0x1f')&&typeof _0x59126f[_0x6938('0x20')]===_0x6938('0x1f');var _0x5dae0c=_0xda96ff['count'];var _0x367e12=_0x5bc58d?0x0:_0x59126f[_0x6938('0x21')];var _0x1f5094=_0x5bc58d?_0xda96ff['count']:_0x59126f[_0x6938('0x21')]+_0x59126f[_0x6938('0x20')];var _0x50e0fb;if(_0x1f5094>=_0x5dae0c){_0x1f5094=_0x5dae0c;_0x50e0fb=0xc8;}else{_0x50e0fb=0xce;}_0x188585['status'](_0x50e0fb);return _0x188585[_0x6938('0x22')](_0x6938('0x23'),_0x367e12+'-'+_0x1f5094+'/'+_0x5dae0c)['json'](_0xda96ff);}return null;};}function patchUpdates(_0x930519){return function(_0x4bd663){try{jsonpatch['apply'](_0x4bd663,_0x930519,!![]);}catch(_0x2209b6){return BPromise[_0x6938('0x24')](_0x2209b6);}return _0x4bd663['save']();};}function saveUpdates(_0x4ddc96,_0x5574c9){return function(_0x3a8e41){if(_0x3a8e41){return _0x3a8e41[_0x6938('0x25')](_0x4ddc96)[_0x6938('0x26')](function(_0xf0606e){return _0xf0606e;});}return null;};}function removeEntity(_0x3959d1,_0x57a8da){return function(_0x337087){if(_0x337087){return _0x337087[_0x6938('0x27')]()['then'](function(){_0x3959d1[_0x6938('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d2b1c,_0x52366e){return function(_0x1c8a36){if(!_0x1c8a36){_0x4d2b1c[_0x6938('0x1c')](0x194);}return _0x1c8a36;};}function handleError(_0x37e215,_0xf8f4f3){_0xf8f4f3=_0xf8f4f3||0x1f4;return function(_0x5e9bee){logger['error'](_0x5e9bee[_0x6938('0x28')]);if(_0x5e9bee[_0x6938('0x29')]){delete _0x5e9bee['name'];}_0x37e215['status'](_0xf8f4f3)[_0x6938('0x2a')](_0x5e9bee);};}exports[_0x6938('0x2b')]=function(_0x4397fa,_0x547a37){var _0x55ff4f={},_0x47df74={},_0x17f66a={'count':0x0,'rows':[]};var _0x45b0d3=_['map'](db[_0x6938('0x2c')]['rawAttributes'],function(_0x4926c4){return{'name':_0x4926c4[_0x6938('0x2d')],'type':_0x4926c4['type'][_0x6938('0x2e')]};});_0x47df74['model']=_[_0x6938('0x2f')](_0x45b0d3,_0x6938('0x29'));_0x47df74['query']=_[_0x6938('0x30')](_0x4397fa['query']);_0x47df74['filters']=_[_0x6938('0x31')](_0x47df74[_0x6938('0x32')],_0x47df74[_0x6938('0x33')]);_0x55ff4f[_0x6938('0x34')]=_[_0x6938('0x31')](_0x47df74[_0x6938('0x32')],qs[_0x6938('0x35')](_0x4397fa['query'][_0x6938('0x35')]));_0x55ff4f['attributes']=_0x55ff4f['attributes']['length']?_0x55ff4f[_0x6938('0x34')]:_0x47df74[_0x6938('0x32')];if(!_0x4397fa[_0x6938('0x33')][_0x6938('0x36')](_0x6938('0x37'))){_0x55ff4f[_0x6938('0x20')]=qs['limit'](_0x4397fa[_0x6938('0x33')][_0x6938('0x20')]);_0x55ff4f[_0x6938('0x21')]=qs[_0x6938('0x21')](_0x4397fa[_0x6938('0x33')]['offset']);}_0x55ff4f['order']=qs[_0x6938('0x38')](_0x4397fa['query'][_0x6938('0x38')]);_0x55ff4f[_0x6938('0x39')]=qs['filters'](_[_0x6938('0x3a')](_0x4397fa[_0x6938('0x33')],_0x47df74[_0x6938('0x3b')]),_0x45b0d3);if(_0x4397fa['query'][_0x6938('0x3c')]){_0x55ff4f[_0x6938('0x39')]=_['merge'](_0x55ff4f[_0x6938('0x39')],{'$or':_[_0x6938('0x2f')](_0x45b0d3,function(_0x46debf){if(_0x46debf[_0x6938('0x3d')]!==_0x6938('0x3e')){var _0x2efca3={};_0x2efca3[_0x46debf[_0x6938('0x29')]]={'$like':'%'+_0x4397fa['query'][_0x6938('0x3c')]+'%'};return _0x2efca3;}})});}_0x55ff4f=_[_0x6938('0x3f')]({},_0x55ff4f,_0x4397fa[_0x6938('0x40')]);var _0x2acec8={'where':_0x55ff4f[_0x6938('0x39')]};return db['VtigerConfiguration'][_0x6938('0x41')](_0x2acec8)[_0x6938('0x26')](function(_0x147356){_0x17f66a[_0x6938('0x41')]=_0x147356;if(_0x4397fa[_0x6938('0x33')][_0x6938('0x42')]){_0x55ff4f[_0x6938('0x43')]=[{'all':!![]}];}return db[_0x6938('0x2c')][_0x6938('0x44')](_0x55ff4f);})[_0x6938('0x26')](function(_0x4038f7){_0x17f66a[_0x6938('0x45')]=_0x4038f7;return _0x17f66a;})[_0x6938('0x26')](respondWithFilteredResult(_0x547a37,_0x55ff4f))[_0x6938('0x46')](handleError(_0x547a37,null));};exports[_0x6938('0x47')]=function(_0x33b2c4,_0x35a7b1){var _0x70ba64={'raw':![],'where':{'id':_0x33b2c4[_0x6938('0x48')]['id']}},_0x4b2d22={};_0x4b2d22['model']=_[_0x6938('0x30')](db[_0x6938('0x2c')][_0x6938('0x49')]);_0x4b2d22[_0x6938('0x33')]=_[_0x6938('0x30')](_0x33b2c4[_0x6938('0x33')]);_0x4b2d22[_0x6938('0x3b')]=_['intersection'](_0x4b2d22[_0x6938('0x32')],_0x4b2d22[_0x6938('0x33')]);_0x70ba64[_0x6938('0x34')]=_['intersection'](_0x4b2d22[_0x6938('0x32')],qs[_0x6938('0x35')](_0x33b2c4['query'][_0x6938('0x35')]));_0x70ba64[_0x6938('0x34')]=_0x70ba64['attributes'][_0x6938('0x4a')]?_0x70ba64[_0x6938('0x34')]:_0x4b2d22[_0x6938('0x32')];if(_0x33b2c4['query']['includeAll']){_0x70ba64[_0x6938('0x43')]=[{'all':!![]}];}_0x70ba64=_[_0x6938('0x3f')]({},_0x70ba64,_0x33b2c4[_0x6938('0x40')]);return db[_0x6938('0x2c')][_0x6938('0x4b')](_0x70ba64)[_0x6938('0x26')](handleEntityNotFound(_0x35a7b1,null))[_0x6938('0x26')](respondWithResult(_0x35a7b1,null))[_0x6938('0x46')](handleError(_0x35a7b1,null));};exports[_0x6938('0x4c')]=function(_0x208c22,_0x21990a){return db[_0x6938('0x2c')]['create'](_0x208c22[_0x6938('0x4d')],{})['then'](respondWithResult(_0x21990a,0xc9))[_0x6938('0x46')](handleError(_0x21990a,null));};exports[_0x6938('0x25')]=function(_0x4477ea,_0x58d98b){if(_0x4477ea['body']['id']){delete _0x4477ea[_0x6938('0x4d')]['id'];}return db[_0x6938('0x2c')][_0x6938('0x4b')]({'where':{'id':_0x4477ea[_0x6938('0x48')]['id']}})[_0x6938('0x26')](handleEntityNotFound(_0x58d98b,null))[_0x6938('0x26')](saveUpdates(_0x4477ea[_0x6938('0x4d')],null))['then'](respondWithResult(_0x58d98b,null))['catch'](handleError(_0x58d98b,null));};exports[_0x6938('0x27')]=function(_0x12217a,_0xf7a0b4){return db[_0x6938('0x2c')][_0x6938('0x4b')]({'where':{'id':_0x12217a[_0x6938('0x48')]['id']}})[_0x6938('0x26')](handleEntityNotFound(_0xf7a0b4,null))[_0x6938('0x26')](removeEntity(_0xf7a0b4,null))[_0x6938('0x46')](handleError(_0xf7a0b4,null));};exports['getFields']=function(_0x1d1608,_0x22c6e0,_0x1e2b64){var _0x1d45ed={};var _0x8256b2={};var _0x2d88c5;var _0x4fdf44;return db['VtigerConfiguration'][_0x6938('0x4e')]({'where':{'id':_0x1d1608[_0x6938('0x48')]['id']}})['then'](handleEntityNotFound(_0x22c6e0,null))[_0x6938('0x26')](function(_0x16a7f7){if(_0x16a7f7){_0x2d88c5=_0x16a7f7;_0x8256b2[_0x6938('0x32')]=_[_0x6938('0x30')](db[_0x6938('0x4f')]['rawAttributes']);_0x8256b2[_0x6938('0x33')]=_[_0x6938('0x30')](_0x1d1608[_0x6938('0x33')]);_0x8256b2[_0x6938('0x3b')]=_[_0x6938('0x31')](_0x8256b2['model'],_0x8256b2[_0x6938('0x33')]);_0x1d45ed['attributes']=_[_0x6938('0x31')](_0x8256b2[_0x6938('0x32')],qs[_0x6938('0x35')](_0x1d1608[_0x6938('0x33')]['fields']));_0x1d45ed[_0x6938('0x34')]=_0x1d45ed['attributes'][_0x6938('0x4a')]?_0x1d45ed[_0x6938('0x34')]:_0x8256b2[_0x6938('0x32')];_0x1d45ed[_0x6938('0x50')]=qs[_0x6938('0x38')](_0x1d1608['query'][_0x6938('0x38')]);_0x1d45ed[_0x6938('0x39')]=qs[_0x6938('0x3b')](_[_0x6938('0x3a')](_0x1d1608[_0x6938('0x33')],_0x8256b2[_0x6938('0x3b')]));if(_0x1d1608[_0x6938('0x33')]['filter']){_0x1d45ed['where']=_[_0x6938('0x3f')](_0x1d45ed['where'],{'$or':_[_0x6938('0x2f')](_0x1d45ed[_0x6938('0x34')],function(_0x380abc){var _0x5d5abc={};_0x5d5abc[_0x380abc]={'$like':'%'+_0x1d1608[_0x6938('0x33')][_0x6938('0x3c')]+'%'};return _0x5d5abc;})});}_0x1d45ed=_['merge']({},_0x1d45ed,_0x1d1608[_0x6938('0x40')]);return _0x2d88c5[_0x6938('0x51')](_0x1d45ed);}})[_0x6938('0x26')](function(_0x441183){if(_0x441183){_0x4fdf44=_0x441183[_0x6938('0x4a')];if(!_0x1d1608[_0x6938('0x33')]['hasOwnProperty']('nolimit')){_0x1d45ed[_0x6938('0x20')]=qs[_0x6938('0x20')](_0x1d1608[_0x6938('0x33')][_0x6938('0x20')]);_0x1d45ed[_0x6938('0x21')]=qs['offset'](_0x1d1608[_0x6938('0x33')][_0x6938('0x21')]);}return _0x2d88c5[_0x6938('0x51')](_0x1d45ed);}})[_0x6938('0x26')](function(_0xc847c0){if(_0xc847c0){return _0xc847c0?{'count':_0x4fdf44,'rows':_0xc847c0}:null;}})[_0x6938('0x26')](respondWithResult(_0x22c6e0,null))['catch'](handleError(_0x22c6e0,null));};exports[_0x6938('0x52')]=function(_0x22796d,_0x29bc15,_0x25b918){var _0x4e940d={};var _0x4767c1={};var _0x167a08;var _0x34a0ba;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x22796d[_0x6938('0x48')]['id']}})[_0x6938('0x26')](handleEntityNotFound(_0x29bc15,null))['then'](function(_0x3152a9){if(_0x3152a9){_0x167a08=_0x3152a9;_0x4767c1[_0x6938('0x32')]=_[_0x6938('0x30')](db[_0x6938('0x4f')][_0x6938('0x49')]);_0x4767c1[_0x6938('0x33')]=_[_0x6938('0x30')](_0x22796d[_0x6938('0x33')]);_0x4767c1[_0x6938('0x3b')]=_[_0x6938('0x31')](_0x4767c1[_0x6938('0x32')],_0x4767c1[_0x6938('0x33')]);_0x4e940d[_0x6938('0x34')]=_['intersection'](_0x4767c1[_0x6938('0x32')],qs['fields'](_0x22796d['query'][_0x6938('0x35')]));_0x4e940d['attributes']=_0x4e940d['attributes'][_0x6938('0x4a')]?_0x4e940d[_0x6938('0x34')]:_0x4767c1[_0x6938('0x32')];_0x4e940d[_0x6938('0x50')]=qs[_0x6938('0x38')](_0x22796d[_0x6938('0x33')]['sort']);_0x4e940d[_0x6938('0x39')]=qs[_0x6938('0x3b')](_[_0x6938('0x3a')](_0x22796d[_0x6938('0x33')],_0x4767c1[_0x6938('0x3b')]));if(_0x22796d['query'][_0x6938('0x3c')]){_0x4e940d[_0x6938('0x39')]=_['merge'](_0x4e940d[_0x6938('0x39')],{'$or':_[_0x6938('0x2f')](_0x4e940d[_0x6938('0x34')],function(_0x24f30b){var _0x130794={};_0x130794[_0x24f30b]={'$like':'%'+_0x22796d['query'][_0x6938('0x3c')]+'%'};return _0x130794;})});}_0x4e940d=_['merge']({},_0x4e940d,_0x22796d[_0x6938('0x40')]);return _0x167a08[_0x6938('0x52')](_0x4e940d);}})['then'](function(_0xce9a57){if(_0xce9a57){_0x34a0ba=_0xce9a57[_0x6938('0x4a')];if(!_0x22796d[_0x6938('0x33')][_0x6938('0x36')](_0x6938('0x37'))){_0x4e940d[_0x6938('0x20')]=qs[_0x6938('0x20')](_0x22796d['query']['limit']);_0x4e940d[_0x6938('0x21')]=qs['offset'](_0x22796d['query'][_0x6938('0x21')]);}return _0x167a08[_0x6938('0x52')](_0x4e940d);}})[_0x6938('0x26')](function(_0x136598){if(_0x136598){return _0x136598?{'count':_0x34a0ba,'rows':_0x136598}:null;}})[_0x6938('0x26')](respondWithResult(_0x29bc15,null))['catch'](handleError(_0x29bc15,null));};exports[_0x6938('0x53')]=function(_0x41ddcc,_0x978284,_0x567b60){var _0x18c55e={};var _0x22d740={};var _0x1faba0;var _0x1d0369;return db[_0x6938('0x2c')][_0x6938('0x4e')]({'where':{'id':_0x41ddcc[_0x6938('0x48')]['id']}})[_0x6938('0x26')](handleEntityNotFound(_0x978284,null))[_0x6938('0x26')](function(_0x828824){if(_0x828824){_0x1faba0=_0x828824;_0x22d740[_0x6938('0x32')]=_[_0x6938('0x30')](db['VtigerField'][_0x6938('0x49')]);_0x22d740[_0x6938('0x33')]=_[_0x6938('0x30')](_0x41ddcc[_0x6938('0x33')]);_0x22d740[_0x6938('0x3b')]=_[_0x6938('0x31')](_0x22d740['model'],_0x22d740['query']);_0x18c55e['attributes']=_['intersection'](_0x22d740[_0x6938('0x32')],qs[_0x6938('0x35')](_0x41ddcc[_0x6938('0x33')]['fields']));_0x18c55e[_0x6938('0x34')]=_0x18c55e[_0x6938('0x34')][_0x6938('0x4a')]?_0x18c55e[_0x6938('0x34')]:_0x22d740[_0x6938('0x32')];_0x18c55e[_0x6938('0x50')]=qs[_0x6938('0x38')](_0x41ddcc['query']['sort']);_0x18c55e[_0x6938('0x39')]=qs[_0x6938('0x3b')](_[_0x6938('0x3a')](_0x41ddcc[_0x6938('0x33')],_0x22d740[_0x6938('0x3b')]));if(_0x41ddcc[_0x6938('0x33')][_0x6938('0x3c')]){_0x18c55e[_0x6938('0x39')]=_['merge'](_0x18c55e[_0x6938('0x39')],{'$or':_[_0x6938('0x2f')](_0x18c55e[_0x6938('0x34')],function(_0x2d99e6){var _0x421fcd={};_0x421fcd[_0x2d99e6]={'$like':'%'+_0x41ddcc['query']['filter']+'%'};return _0x421fcd;})});}_0x18c55e=_[_0x6938('0x3f')]({},_0x18c55e,_0x41ddcc[_0x6938('0x40')]);return _0x1faba0[_0x6938('0x53')](_0x18c55e);}})[_0x6938('0x26')](function(_0x24bcec){if(_0x24bcec){_0x1d0369=_0x24bcec['length'];if(!_0x41ddcc['query']['hasOwnProperty'](_0x6938('0x37'))){_0x18c55e[_0x6938('0x20')]=qs['limit'](_0x41ddcc[_0x6938('0x33')]['limit']);_0x18c55e[_0x6938('0x21')]=qs[_0x6938('0x21')](_0x41ddcc[_0x6938('0x33')]['offset']);}return _0x1faba0[_0x6938('0x53')](_0x18c55e);}})[_0x6938('0x26')](function(_0x10be0a){if(_0x10be0a){return _0x10be0a?{'count':_0x1d0369,'rows':_0x10be0a}:null;}})[_0x6938('0x26')](respondWithResult(_0x978284,null))[_0x6938('0x46')](handleError(_0x978284,null));}; \ No newline at end of file +var _0x7217=['params','destroy','getFields','VtigerField','order','nolimit','getSubjects','findOne','getDescriptions','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','fields','includeAll','find','catch','create','body'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7217,0xa9));var _0x7721=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x7217[_0x43d11d];return _0x38cd08;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7721('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var BPromise=require(_0x7721('0x3'));var Mustache=require(_0x7721('0x4'));var util=require(_0x7721('0x5'));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('lodash');var squel=require(_0x7721('0xb'));var crypto=require(_0x7721('0xc'));var jsforce=require(_0x7721('0xd'));var deskjs=require(_0x7721('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7721('0xf'));var Papa=require(_0x7721('0x10'));var Redis=require('ioredis');var authService=require(_0x7721('0x11'));var qs=require(_0x7721('0x12'));var as=require(_0x7721('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7721('0x14'))(_0x7721('0x15'));var utils=require(_0x7721('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7721('0x17'));var db=require(_0x7721('0x18'))['db'];function respondWithStatusCode(_0x4db091,_0x290415){_0x290415=_0x290415||0xcc;return function(_0xcbb8d5){if(_0xcbb8d5){return _0x4db091['sendStatus'](_0x290415);}return _0x4db091[_0x7721('0x19')](_0x290415)[_0x7721('0x1a')]();};}function respondWithResult(_0xedb98,_0x36f8a0){_0x36f8a0=_0x36f8a0||0xc8;return function(_0x22a78b){if(_0x22a78b){return _0xedb98['status'](_0x36f8a0)[_0x7721('0x1b')](_0x22a78b);}};}function respondWithFilteredResult(_0x353249,_0x2fdfec){return function(_0x281dfd){if(_0x281dfd){var _0x488c09=typeof _0x2fdfec[_0x7721('0x1c')]==='undefined'&&typeof _0x2fdfec[_0x7721('0x1d')]==='undefined';var _0x378dfb=_0x281dfd['count'];var _0x4b64ab=_0x488c09?0x0:_0x2fdfec[_0x7721('0x1c')];var _0x499b28=_0x488c09?_0x281dfd[_0x7721('0x1e')]:_0x2fdfec['offset']+_0x2fdfec[_0x7721('0x1d')];var _0x19f3b4;if(_0x499b28>=_0x378dfb){_0x499b28=_0x378dfb;_0x19f3b4=0xc8;}else{_0x19f3b4=0xce;}_0x353249['status'](_0x19f3b4);return _0x353249[_0x7721('0x1f')](_0x7721('0x20'),_0x4b64ab+'-'+_0x499b28+'/'+_0x378dfb)[_0x7721('0x1b')](_0x281dfd);}return null;};}function patchUpdates(_0x519768){return function(_0x4083dd){try{jsonpatch['apply'](_0x4083dd,_0x519768,!![]);}catch(_0x49b37b){return BPromise[_0x7721('0x21')](_0x49b37b);}return _0x4083dd[_0x7721('0x22')]();};}function saveUpdates(_0x528664,_0x45c389){return function(_0x16c9c4){if(_0x16c9c4){return _0x16c9c4[_0x7721('0x23')](_0x528664)['then'](function(_0x159117){return _0x159117;});}return null;};}function removeEntity(_0x5b7e03,_0x6ab534){return function(_0x1c5511){if(_0x1c5511){return _0x1c5511['destroy']()[_0x7721('0x24')](function(){_0x5b7e03['status'](0xcc)[_0x7721('0x1a')]();});}};}function handleEntityNotFound(_0x6b932b,_0x179d10){return function(_0x126486){if(!_0x126486){_0x6b932b['sendStatus'](0x194);}return _0x126486;};}function handleError(_0x37cbc7,_0x1f3aff){_0x1f3aff=_0x1f3aff||0x1f4;return function(_0x43fa19){logger[_0x7721('0x25')](_0x43fa19[_0x7721('0x26')]);if(_0x43fa19['name']){delete _0x43fa19[_0x7721('0x27')];}_0x37cbc7[_0x7721('0x19')](_0x1f3aff)[_0x7721('0x28')](_0x43fa19);};}exports[_0x7721('0x29')]=function(_0xbb3ce4,_0x265f6d){var _0x1779cb={},_0x459d1f={},_0x3dca94={'count':0x0,'rows':[]};var _0x5771bb=_[_0x7721('0x2a')](db[_0x7721('0x2b')][_0x7721('0x2c')],function(_0x3903f4){return{'name':_0x3903f4['fieldName'],'type':_0x3903f4[_0x7721('0x2d')][_0x7721('0x2e')]};});_0x459d1f[_0x7721('0x2f')]=_['map'](_0x5771bb,'name');_0x459d1f[_0x7721('0x30')]=_[_0x7721('0x31')](_0xbb3ce4[_0x7721('0x30')]);_0x459d1f[_0x7721('0x32')]=_[_0x7721('0x33')](_0x459d1f[_0x7721('0x2f')],_0x459d1f[_0x7721('0x30')]);_0x1779cb[_0x7721('0x34')]=_['intersection'](_0x459d1f[_0x7721('0x2f')],qs['fields'](_0xbb3ce4[_0x7721('0x30')]['fields']));_0x1779cb[_0x7721('0x34')]=_0x1779cb[_0x7721('0x34')][_0x7721('0x35')]?_0x1779cb[_0x7721('0x34')]:_0x459d1f[_0x7721('0x2f')];if(!_0xbb3ce4[_0x7721('0x30')][_0x7721('0x36')]('nolimit')){_0x1779cb[_0x7721('0x1d')]=qs['limit'](_0xbb3ce4[_0x7721('0x30')][_0x7721('0x1d')]);_0x1779cb[_0x7721('0x1c')]=qs['offset'](_0xbb3ce4[_0x7721('0x30')][_0x7721('0x1c')]);}_0x1779cb['order']=qs[_0x7721('0x37')](_0xbb3ce4[_0x7721('0x30')][_0x7721('0x37')]);_0x1779cb[_0x7721('0x38')]=qs['filters'](_[_0x7721('0x39')](_0xbb3ce4[_0x7721('0x30')],_0x459d1f['filters']),_0x5771bb);if(_0xbb3ce4[_0x7721('0x30')]['filter']){_0x1779cb[_0x7721('0x38')]=_['merge'](_0x1779cb['where'],{'$or':_[_0x7721('0x2a')](_0x5771bb,function(_0x52db52){if(_0x52db52[_0x7721('0x2d')]!==_0x7721('0x3a')){var _0x4cee30={};_0x4cee30[_0x52db52[_0x7721('0x27')]]={'$like':'%'+_0xbb3ce4[_0x7721('0x30')][_0x7721('0x3b')]+'%'};return _0x4cee30;}})});}_0x1779cb=_[_0x7721('0x3c')]({},_0x1779cb,_0xbb3ce4[_0x7721('0x3d')]);var _0x22fee7={'where':_0x1779cb[_0x7721('0x38')]};return db[_0x7721('0x2b')][_0x7721('0x1e')](_0x22fee7)[_0x7721('0x24')](function(_0x5014fb){_0x3dca94[_0x7721('0x1e')]=_0x5014fb;if(_0xbb3ce4[_0x7721('0x30')]['includeAll']){_0x1779cb[_0x7721('0x3e')]=[{'all':!![]}];}return db[_0x7721('0x2b')][_0x7721('0x3f')](_0x1779cb);})[_0x7721('0x24')](function(_0x5d56a9){_0x3dca94[_0x7721('0x40')]=_0x5d56a9;return _0x3dca94;})[_0x7721('0x24')](respondWithFilteredResult(_0x265f6d,_0x1779cb))['catch'](handleError(_0x265f6d,null));};exports['show']=function(_0x2f7f64,_0x5b57dc){var _0x2e8e7b={'raw':![],'where':{'id':_0x2f7f64['params']['id']}},_0x21c9cb={};_0x21c9cb['model']=_['keys'](db[_0x7721('0x2b')][_0x7721('0x2c')]);_0x21c9cb[_0x7721('0x30')]=_[_0x7721('0x31')](_0x2f7f64[_0x7721('0x30')]);_0x21c9cb[_0x7721('0x32')]=_[_0x7721('0x33')](_0x21c9cb[_0x7721('0x2f')],_0x21c9cb[_0x7721('0x30')]);_0x2e8e7b[_0x7721('0x34')]=_[_0x7721('0x33')](_0x21c9cb['model'],qs['fields'](_0x2f7f64[_0x7721('0x30')][_0x7721('0x41')]));_0x2e8e7b[_0x7721('0x34')]=_0x2e8e7b[_0x7721('0x34')][_0x7721('0x35')]?_0x2e8e7b[_0x7721('0x34')]:_0x21c9cb[_0x7721('0x2f')];if(_0x2f7f64[_0x7721('0x30')][_0x7721('0x42')]){_0x2e8e7b[_0x7721('0x3e')]=[{'all':!![]}];}_0x2e8e7b=_[_0x7721('0x3c')]({},_0x2e8e7b,_0x2f7f64[_0x7721('0x3d')]);return db[_0x7721('0x2b')][_0x7721('0x43')](_0x2e8e7b)[_0x7721('0x24')](handleEntityNotFound(_0x5b57dc,null))['then'](respondWithResult(_0x5b57dc,null))[_0x7721('0x44')](handleError(_0x5b57dc,null));};exports[_0x7721('0x45')]=function(_0x4a378e,_0x1eb9b4){return db[_0x7721('0x2b')]['create'](_0x4a378e[_0x7721('0x46')],{})[_0x7721('0x24')](respondWithResult(_0x1eb9b4,0xc9))[_0x7721('0x44')](handleError(_0x1eb9b4,null));};exports[_0x7721('0x23')]=function(_0x26357d,_0x4ac85f){if(_0x26357d['body']['id']){delete _0x26357d[_0x7721('0x46')]['id'];}return db[_0x7721('0x2b')][_0x7721('0x43')]({'where':{'id':_0x26357d[_0x7721('0x47')]['id']}})[_0x7721('0x24')](handleEntityNotFound(_0x4ac85f,null))[_0x7721('0x24')](saveUpdates(_0x26357d[_0x7721('0x46')],null))[_0x7721('0x24')](respondWithResult(_0x4ac85f,null))[_0x7721('0x44')](handleError(_0x4ac85f,null));};exports[_0x7721('0x48')]=function(_0x3ce861,_0x5d8412){return db[_0x7721('0x2b')]['find']({'where':{'id':_0x3ce861[_0x7721('0x47')]['id']}})[_0x7721('0x24')](handleEntityNotFound(_0x5d8412,null))[_0x7721('0x24')](removeEntity(_0x5d8412,null))['catch'](handleError(_0x5d8412,null));};exports[_0x7721('0x49')]=function(_0x1e7b63,_0x2fc121,_0x225f92){var _0x3c1cf9={};var _0x1e0f5b={};var _0xe3c855;var _0x4982e6;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x1e7b63['params']['id']}})[_0x7721('0x24')](handleEntityNotFound(_0x2fc121,null))[_0x7721('0x24')](function(_0x3fbc29){if(_0x3fbc29){_0xe3c855=_0x3fbc29;_0x1e0f5b[_0x7721('0x2f')]=_[_0x7721('0x31')](db[_0x7721('0x4a')][_0x7721('0x2c')]);_0x1e0f5b['query']=_[_0x7721('0x31')](_0x1e7b63[_0x7721('0x30')]);_0x1e0f5b['filters']=_[_0x7721('0x33')](_0x1e0f5b[_0x7721('0x2f')],_0x1e0f5b[_0x7721('0x30')]);_0x3c1cf9['attributes']=_[_0x7721('0x33')](_0x1e0f5b[_0x7721('0x2f')],qs['fields'](_0x1e7b63[_0x7721('0x30')][_0x7721('0x41')]));_0x3c1cf9[_0x7721('0x34')]=_0x3c1cf9[_0x7721('0x34')][_0x7721('0x35')]?_0x3c1cf9['attributes']:_0x1e0f5b['model'];_0x3c1cf9[_0x7721('0x4b')]=qs['sort'](_0x1e7b63[_0x7721('0x30')][_0x7721('0x37')]);_0x3c1cf9[_0x7721('0x38')]=qs[_0x7721('0x32')](_[_0x7721('0x39')](_0x1e7b63[_0x7721('0x30')],_0x1e0f5b['filters']));if(_0x1e7b63[_0x7721('0x30')][_0x7721('0x3b')]){_0x3c1cf9[_0x7721('0x38')]=_[_0x7721('0x3c')](_0x3c1cf9[_0x7721('0x38')],{'$or':_[_0x7721('0x2a')](_0x3c1cf9[_0x7721('0x34')],function(_0x4a54ac){var _0x22acb1={};_0x22acb1[_0x4a54ac]={'$like':'%'+_0x1e7b63['query'][_0x7721('0x3b')]+'%'};return _0x22acb1;})});}_0x3c1cf9=_[_0x7721('0x3c')]({},_0x3c1cf9,_0x1e7b63[_0x7721('0x3d')]);return _0xe3c855[_0x7721('0x49')](_0x3c1cf9);}})[_0x7721('0x24')](function(_0xa97279){if(_0xa97279){_0x4982e6=_0xa97279[_0x7721('0x35')];if(!_0x1e7b63[_0x7721('0x30')][_0x7721('0x36')](_0x7721('0x4c'))){_0x3c1cf9['limit']=qs[_0x7721('0x1d')](_0x1e7b63[_0x7721('0x30')][_0x7721('0x1d')]);_0x3c1cf9[_0x7721('0x1c')]=qs[_0x7721('0x1c')](_0x1e7b63['query'][_0x7721('0x1c')]);}return _0xe3c855['getFields'](_0x3c1cf9);}})[_0x7721('0x24')](function(_0x331ae7){if(_0x331ae7){return _0x331ae7?{'count':_0x4982e6,'rows':_0x331ae7}:null;}})[_0x7721('0x24')](respondWithResult(_0x2fc121,null))['catch'](handleError(_0x2fc121,null));};exports[_0x7721('0x4d')]=function(_0x5b7f27,_0x4c0de6,_0x46a249){var _0x3ed647={};var _0x1697e1={};var _0x2ee874;var _0x562865;return db[_0x7721('0x2b')][_0x7721('0x4e')]({'where':{'id':_0x5b7f27['params']['id']}})[_0x7721('0x24')](handleEntityNotFound(_0x4c0de6,null))['then'](function(_0x4a9b0c){if(_0x4a9b0c){_0x2ee874=_0x4a9b0c;_0x1697e1[_0x7721('0x2f')]=_[_0x7721('0x31')](db[_0x7721('0x4a')]['rawAttributes']);_0x1697e1[_0x7721('0x30')]=_[_0x7721('0x31')](_0x5b7f27[_0x7721('0x30')]);_0x1697e1['filters']=_[_0x7721('0x33')](_0x1697e1['model'],_0x1697e1[_0x7721('0x30')]);_0x3ed647[_0x7721('0x34')]=_[_0x7721('0x33')](_0x1697e1[_0x7721('0x2f')],qs[_0x7721('0x41')](_0x5b7f27[_0x7721('0x30')][_0x7721('0x41')]));_0x3ed647[_0x7721('0x34')]=_0x3ed647[_0x7721('0x34')][_0x7721('0x35')]?_0x3ed647[_0x7721('0x34')]:_0x1697e1[_0x7721('0x2f')];_0x3ed647['order']=qs[_0x7721('0x37')](_0x5b7f27[_0x7721('0x30')][_0x7721('0x37')]);_0x3ed647[_0x7721('0x38')]=qs[_0x7721('0x32')](_[_0x7721('0x39')](_0x5b7f27[_0x7721('0x30')],_0x1697e1[_0x7721('0x32')]));if(_0x5b7f27[_0x7721('0x30')][_0x7721('0x3b')]){_0x3ed647[_0x7721('0x38')]=_[_0x7721('0x3c')](_0x3ed647[_0x7721('0x38')],{'$or':_['map'](_0x3ed647['attributes'],function(_0xe2100a){var _0x8d0821={};_0x8d0821[_0xe2100a]={'$like':'%'+_0x5b7f27[_0x7721('0x30')][_0x7721('0x3b')]+'%'};return _0x8d0821;})});}_0x3ed647=_['merge']({},_0x3ed647,_0x5b7f27[_0x7721('0x3d')]);return _0x2ee874['getSubjects'](_0x3ed647);}})[_0x7721('0x24')](function(_0x58c3f3){if(_0x58c3f3){_0x562865=_0x58c3f3[_0x7721('0x35')];if(!_0x5b7f27[_0x7721('0x30')][_0x7721('0x36')](_0x7721('0x4c'))){_0x3ed647[_0x7721('0x1d')]=qs[_0x7721('0x1d')](_0x5b7f27['query'][_0x7721('0x1d')]);_0x3ed647[_0x7721('0x1c')]=qs[_0x7721('0x1c')](_0x5b7f27[_0x7721('0x30')][_0x7721('0x1c')]);}return _0x2ee874[_0x7721('0x4d')](_0x3ed647);}})['then'](function(_0x265bbd){if(_0x265bbd){return _0x265bbd?{'count':_0x562865,'rows':_0x265bbd}:null;}})['then'](respondWithResult(_0x4c0de6,null))[_0x7721('0x44')](handleError(_0x4c0de6,null));};exports[_0x7721('0x4f')]=function(_0x2b930f,_0x5b4f82,_0x4b836f){var _0x5884a1={};var _0x3cbf76={};var _0x5c6fd8;var _0x233c3d;return db[_0x7721('0x2b')][_0x7721('0x4e')]({'where':{'id':_0x2b930f['params']['id']}})[_0x7721('0x24')](handleEntityNotFound(_0x5b4f82,null))['then'](function(_0x318dfc){if(_0x318dfc){_0x5c6fd8=_0x318dfc;_0x3cbf76[_0x7721('0x2f')]=_[_0x7721('0x31')](db[_0x7721('0x4a')][_0x7721('0x2c')]);_0x3cbf76[_0x7721('0x30')]=_[_0x7721('0x31')](_0x2b930f[_0x7721('0x30')]);_0x3cbf76[_0x7721('0x32')]=_[_0x7721('0x33')](_0x3cbf76[_0x7721('0x2f')],_0x3cbf76[_0x7721('0x30')]);_0x5884a1[_0x7721('0x34')]=_['intersection'](_0x3cbf76[_0x7721('0x2f')],qs[_0x7721('0x41')](_0x2b930f[_0x7721('0x30')][_0x7721('0x41')]));_0x5884a1[_0x7721('0x34')]=_0x5884a1['attributes']['length']?_0x5884a1[_0x7721('0x34')]:_0x3cbf76[_0x7721('0x2f')];_0x5884a1['order']=qs[_0x7721('0x37')](_0x2b930f['query']['sort']);_0x5884a1[_0x7721('0x38')]=qs['filters'](_[_0x7721('0x39')](_0x2b930f[_0x7721('0x30')],_0x3cbf76[_0x7721('0x32')]));if(_0x2b930f[_0x7721('0x30')][_0x7721('0x3b')]){_0x5884a1[_0x7721('0x38')]=_['merge'](_0x5884a1[_0x7721('0x38')],{'$or':_[_0x7721('0x2a')](_0x5884a1[_0x7721('0x34')],function(_0x297787){var _0x2de4dc={};_0x2de4dc[_0x297787]={'$like':'%'+_0x2b930f[_0x7721('0x30')][_0x7721('0x3b')]+'%'};return _0x2de4dc;})});}_0x5884a1=_[_0x7721('0x3c')]({},_0x5884a1,_0x2b930f[_0x7721('0x3d')]);return _0x5c6fd8['getDescriptions'](_0x5884a1);}})['then'](function(_0x74c354){if(_0x74c354){_0x233c3d=_0x74c354[_0x7721('0x35')];if(!_0x2b930f[_0x7721('0x30')]['hasOwnProperty'](_0x7721('0x4c'))){_0x5884a1['limit']=qs[_0x7721('0x1d')](_0x2b930f[_0x7721('0x30')][_0x7721('0x1d')]);_0x5884a1[_0x7721('0x1c')]=qs[_0x7721('0x1c')](_0x2b930f[_0x7721('0x30')]['offset']);}return _0x5c6fd8[_0x7721('0x4f')](_0x5884a1);}})['then'](function(_0x274175){if(_0x274175){return _0x274175?{'count':_0x233c3d,'rows':_0x274175}:null;}})[_0x7721('0x24')](respondWithResult(_0x5b4f82,null))[_0x7721('0x44')](handleError(_0x5b4f82,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index ce5305a..40fb8bd 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 _0x2510=['../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x3b8d74,_0x451c62){var _0x5bdbb6=function(_0x4322c5){while(--_0x4322c5){_0x3b8d74['push'](_0x3b8d74['shift']());}};_0x5bdbb6(++_0x451c62);}(_0x2510,0x186));var _0x0251=function(_0x41cef1,_0x4d42c8){_0x41cef1=_0x41cef1-0x0;var _0x514395=_0x2510[_0x41cef1];return _0x514395;};'use strict';var _=require('lodash');var util=require(_0x0251('0x0'));var logger=require(_0x0251('0x1'))(_0x0251('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0251('0x3'));var fs=require('fs');var path=require(_0x0251('0x4'));var rimraf=require(_0x0251('0x5'));var config=require(_0x0251('0x6'));var attributes=require(_0x0251('0x7'));module['exports']=function(_0x578507,_0x1e6fa0){return _0x578507[_0x0251('0x8')](_0x0251('0x9'),attributes,{'tableName':_0x0251('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3ab=['../../config/logger','moment','path','rimraf','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x5462f1,_0xbf5e1b){var _0x32e8c3=function(_0x33021f){while(--_0x33021f){_0x5462f1['push'](_0x5462f1['shift']());}};_0x32e8c3(++_0xbf5e1b);}(_0xc3ab,0x184));var _0xbc3a=function(_0x2845d1,_0x570fe5){_0x2845d1=_0x2845d1-0x0;var _0x5a20d8=_0xc3ab[_0x2845d1];return _0x5a20d8;};'use strict';var _=require(_0xbc3a('0x0'));var util=require(_0xbc3a('0x1'));var logger=require(_0xbc3a('0x2'))('api');var moment=require(_0xbc3a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc3a('0x4'));var rimraf=require(_0xbc3a('0x5'));var config=require('../../config/environment');var attributes=require(_0xbc3a('0x6'));module['exports']=function(_0x5ebd45,_0x308a33){return _0x5ebd45[_0xbc3a('0x7')](_0xbc3a('0x8'),attributes,{'tableName':_0xbc3a('0x9'),'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 5181157..d762d00 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 _0x70af=['error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x70af,0xce));var _0xf70a=function(_0x5735a5,_0x565e5d){_0x5735a5=_0x5735a5-0x0;var _0x164fb2=_0x70af[_0x5735a5];return _0x164fb2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf70a('0x0'));var BPromise=require(_0xf70a('0x1'));var rs=require(_0xf70a('0x2'));var fs=require('fs');var Redis=require(_0xf70a('0x3'));var db=require(_0xf70a('0x4'))['db'];var utils=require(_0xf70a('0x5'));var logger=require(_0xf70a('0x6'))(_0xf70a('0x7'));var config=require(_0xf70a('0x8'));var jayson=require(_0xf70a('0x9'));var client=jayson[_0xf70a('0xa')][_0xf70a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x525c4b,_0x34f439,_0x410875){return new BPromise(function(_0x5a158b,_0x2683db){return client[_0xf70a('0xc')](_0x525c4b,_0x410875)[_0xf70a('0xd')](function(_0x558a1f){logger[_0xf70a('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x34f439,_0xf70a('0xf'));logger[_0xf70a('0x10')](_0xf70a('0x11'),_0x34f439,'request\x20sent',JSON[_0xf70a('0x12')](_0x558a1f));if(_0x558a1f['error']){if(_0x558a1f[_0xf70a('0x13')][_0xf70a('0x14')]===0x1f4){logger[_0xf70a('0x13')](_0xf70a('0x15'),_0x34f439,_0x558a1f[_0xf70a('0x13')][_0xf70a('0x16')]);return _0x2683db(_0x558a1f['error'][_0xf70a('0x16')]);}logger[_0xf70a('0x13')](_0xf70a('0x15'),_0x34f439,_0x558a1f[_0xf70a('0x13')][_0xf70a('0x16')]);return _0x5a158b(_0x558a1f[_0xf70a('0x13')][_0xf70a('0x16')]);}else{logger[_0xf70a('0xe')](_0xf70a('0x15'),_0x34f439,_0xf70a('0xf'));_0x5a158b(_0x558a1f[_0xf70a('0x17')]['message']);}})[_0xf70a('0x18')](function(_0x14f3cf){logger['error'](_0xf70a('0x15'),_0x34f439,_0x14f3cf);_0x2683db(_0x14f3cf);});});} \ No newline at end of file +var _0xf0d4=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xf0d4,0x15f));var _0x4f0d=function(_0x5eae0c,_0x36d39b){_0x5eae0c=_0x5eae0c-0x0;var _0x1695ed=_0xf0d4[_0x5eae0c];return _0x1695ed;};'use strict';var _=require(_0x4f0d('0x0'));var util=require(_0x4f0d('0x1'));var moment=require(_0x4f0d('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f0d('0x3'));var fs=require('fs');var Redis=require(_0x4f0d('0x4'));var db=require(_0x4f0d('0x5'))['db'];var utils=require(_0x4f0d('0x6'));var logger=require('../../config/logger')(_0x4f0d('0x7'));var config=require(_0x4f0d('0x8'));var jayson=require(_0x4f0d('0x9'));var client=jayson['client'][_0x4f0d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c4c9f,_0x36bcc8,_0x23f457){return new BPromise(function(_0x71c8b4,_0x40c962){return client[_0x4f0d('0xb')](_0x1c4c9f,_0x23f457)['then'](function(_0x395ff2){logger[_0x4f0d('0xc')](_0x4f0d('0xd'),_0x36bcc8,_0x4f0d('0xe'));logger[_0x4f0d('0xf')](_0x4f0d('0x10'),_0x36bcc8,_0x4f0d('0xe'),JSON[_0x4f0d('0x11')](_0x395ff2));if(_0x395ff2['error']){if(_0x395ff2[_0x4f0d('0x12')][_0x4f0d('0x13')]===0x1f4){logger[_0x4f0d('0x12')](_0x4f0d('0xd'),_0x36bcc8,_0x395ff2[_0x4f0d('0x12')][_0x4f0d('0x14')]);return _0x40c962(_0x395ff2[_0x4f0d('0x12')][_0x4f0d('0x14')]);}logger[_0x4f0d('0x12')](_0x4f0d('0xd'),_0x36bcc8,_0x395ff2[_0x4f0d('0x12')]['message']);return _0x71c8b4(_0x395ff2['error'][_0x4f0d('0x14')]);}else{logger[_0x4f0d('0xc')](_0x4f0d('0xd'),_0x36bcc8,_0x4f0d('0xe'));_0x71c8b4(_0x395ff2['result'][_0x4f0d('0x14')]);}})[_0x4f0d('0x15')](function(_0x57f5cb){logger[_0x4f0d('0x12')](_0x4f0d('0xd'),_0x36bcc8,_0x57f5cb);_0x40c962(_0x57f5cb);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index e20670e..ec83746 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 _0xce41=['get','isAuthenticated','index','/:id','show','create','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xce41,0x1cb));var _0x1ce4=function(_0x44d869,_0x49425f){_0x44d869=_0x44d869-0x0;var _0x1ed521=_0xce41[_0x44d869];return _0x1ed521;};'use strict';var multer=require(_0x1ce4('0x0'));var util=require(_0x1ce4('0x1'));var path=require(_0x1ce4('0x2'));var timeout=require(_0x1ce4('0x3'));var express=require('express');var router=express[_0x1ce4('0x4')]();var fs_extra=require(_0x1ce4('0x5'));var auth=require(_0x1ce4('0x6'));var interaction=require(_0x1ce4('0x7'));var config=require('../../config/environment');var controller=require(_0x1ce4('0x8'));router[_0x1ce4('0x9')]('/',auth[_0x1ce4('0xa')](),controller[_0x1ce4('0xb')]);router[_0x1ce4('0x9')](_0x1ce4('0xc'),auth[_0x1ce4('0xa')](),controller[_0x1ce4('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1ce4('0xe')]);router['put'](_0x1ce4('0xc'),auth[_0x1ce4('0xa')](),controller[_0x1ce4('0xf')]);router[_0x1ce4('0x10')](_0x1ce4('0xc'),auth['isAuthenticated'](),controller[_0x1ce4('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8514=['post','create','put','update','delete','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x3b6f58,_0x5870de){var _0x987c61=function(_0x3a9281){while(--_0x3a9281){_0x3b6f58['push'](_0x3b6f58['shift']());}};_0x987c61(++_0x5870de);}(_0x8514,0x1ec));var _0x4851=function(_0x58b61f,_0x2eb440){_0x58b61f=_0x58b61f-0x0;var _0x539372=_0x8514[_0x58b61f];return _0x539372;};'use strict';var multer=require(_0x4851('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4851('0x1'));var express=require('express');var router=express[_0x4851('0x2')]();var fs_extra=require(_0x4851('0x3'));var auth=require(_0x4851('0x4'));var interaction=require(_0x4851('0x5'));var config=require(_0x4851('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x4851('0x7')](),controller[_0x4851('0x8')]);router[_0x4851('0x9')](_0x4851('0xa'),auth[_0x4851('0x7')](),controller[_0x4851('0xb')]);router[_0x4851('0xc')]('/',auth[_0x4851('0x7')](),controller[_0x4851('0xd')]);router[_0x4851('0xe')](_0x4851('0xa'),auth['isAuthenticated'](),controller[_0x4851('0xf')]);router[_0x4851('0x10')](_0x4851('0xa'),auth[_0x4851('0x7')](),controller['destroy']);module[_0x4851('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 81b6334..11795a7 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 _0x24af=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports'];(function(_0x12c37f,_0x516c50){var _0x801bb4=function(_0x33459f){while(--_0x33459f){_0x12c37f['push'](_0x12c37f['shift']());}};_0x801bb4(++_0x516c50);}(_0x24af,0x1ae));var _0xf24a=function(_0x35000d,_0xc8945c){_0x35000d=_0x35000d-0x0;var _0x2b856f=_0x24af[_0x35000d];return _0x2b856f;};'use strict';var Sequelize=require(_0xf24a('0x0'));module[_0xf24a('0x1')]={'type':{'type':Sequelize[_0xf24a('0x2')](_0xf24a('0x3'),_0xf24a('0x4'),_0xf24a('0x5'),_0xf24a('0x6'),_0xf24a('0x7')),'defaultValue':_0xf24a('0x3')},'content':{'type':Sequelize[_0xf24a('0x8')]},'key':{'type':Sequelize[_0xf24a('0x8')]},'keyType':{'type':Sequelize[_0xf24a('0x2')](_0xf24a('0x3'),_0xf24a('0x4'),_0xf24a('0x5'))},'keyContent':{'type':Sequelize[_0xf24a('0x8')]},'idField':{'type':Sequelize[_0xf24a('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf24a('0x8')]}}; \ No newline at end of file +var _0x95fe=['string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x560d66,_0xf86af7){var _0x1a7191=function(_0x47fdbc){while(--_0x47fdbc){_0x560d66['push'](_0x560d66['shift']());}};_0x1a7191(++_0xf86af7);}(_0x95fe,0xcd));var _0xe95f=function(_0x2724e5,_0x229d74){_0x2724e5=_0x2724e5-0x0;var _0x4b6621=_0x95fe[_0x2724e5];return _0x4b6621;};'use strict';var Sequelize=require(_0xe95f('0x0'));module[_0xe95f('0x1')]={'type':{'type':Sequelize[_0xe95f('0x2')]('string',_0xe95f('0x3'),_0xe95f('0x4'),'keyValue','picklist'),'defaultValue':_0xe95f('0x5')},'content':{'type':Sequelize[_0xe95f('0x6')]},'key':{'type':Sequelize[_0xe95f('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xe95f('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xe95f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe95f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 792fd95..8448e58 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 _0x55c6=['fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','VtigerField','then','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','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','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','apply','save','end','error','stack','name','send','map'];(function(_0xd11516,_0x39c153){var _0x524e6b=function(_0x35dab8){while(--_0x35dab8){_0xd11516['push'](_0xd11516['shift']());}};_0x524e6b(++_0x39c153);}(_0x55c6,0x155));var _0x655c=function(_0x4a236a,_0x19d1c0){_0x4a236a=_0x4a236a-0x0;var _0x49002f=_0x55c6[_0x4a236a];return _0x49002f;};'use strict';var emlformat=require(_0x655c('0x0'));var rimraf=require(_0x655c('0x1'));var zipdir=require(_0x655c('0x2'));var jsonpatch=require(_0x655c('0x3'));var rp=require(_0x655c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x655c('0x5'));var util=require(_0x655c('0x6'));var path=require(_0x655c('0x7'));var sox=require('sox');var csv=require(_0x655c('0x8'));var ejs=require(_0x655c('0x9'));var fs=require('fs');var fs_extra=require(_0x655c('0xa'));var _=require(_0x655c('0xb'));var squel=require('squel');var crypto=require(_0x655c('0xc'));var jsforce=require(_0x655c('0xd'));var deskjs=require(_0x655c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x655c('0xf'));var Papa=require(_0x655c('0x10'));var Redis=require(_0x655c('0x11'));var authService=require(_0x655c('0x12'));var qs=require(_0x655c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x655c('0x14'));var logger=require(_0x655c('0x15'))(_0x655c('0x16'));var utils=require(_0x655c('0x17'));var config=require(_0x655c('0x18'));var licenseUtil=require(_0x655c('0x19'));var db=require(_0x655c('0x1a'))['db'];function respondWithStatusCode(_0x50c2d5,_0xb7448d){_0xb7448d=_0xb7448d||0xcc;return function(_0x3c200b){if(_0x3c200b){return _0x50c2d5[_0x655c('0x1b')](_0xb7448d);}return _0x50c2d5[_0x655c('0x1c')](_0xb7448d)['end']();};}function respondWithResult(_0x3ffec6,_0x34a26d){_0x34a26d=_0x34a26d||0xc8;return function(_0xea32df){if(_0xea32df){return _0x3ffec6['status'](_0x34a26d)[_0x655c('0x1d')](_0xea32df);}};}function respondWithFilteredResult(_0x1edbe0,_0x18539d){return function(_0x2c6145){if(_0x2c6145){var _0x1db6f4=typeof _0x18539d['offset']==='undefined'&&typeof _0x18539d[_0x655c('0x1e')]===_0x655c('0x1f');var _0xf23fe4=_0x2c6145['count'];var _0x46fce6=_0x1db6f4?0x0:_0x18539d[_0x655c('0x20')];var _0x2bcb2c=_0x1db6f4?_0x2c6145[_0x655c('0x21')]:_0x18539d[_0x655c('0x20')]+_0x18539d['limit'];var _0x3b1d9c;if(_0x2bcb2c>=_0xf23fe4){_0x2bcb2c=_0xf23fe4;_0x3b1d9c=0xc8;}else{_0x3b1d9c=0xce;}_0x1edbe0[_0x655c('0x1c')](_0x3b1d9c);return _0x1edbe0[_0x655c('0x22')](_0x655c('0x23'),_0x46fce6+'-'+_0x2bcb2c+'/'+_0xf23fe4)['json'](_0x2c6145);}return null;};}function patchUpdates(_0x5983e7){return function(_0x25d183){try{jsonpatch[_0x655c('0x24')](_0x25d183,_0x5983e7,!![]);}catch(_0x3f32d9){return BPromise['reject'](_0x3f32d9);}return _0x25d183[_0x655c('0x25')]();};}function saveUpdates(_0x2d281f,_0x322d94){return function(_0x3a3d3b){if(_0x3a3d3b){return _0x3a3d3b['update'](_0x2d281f)['then'](function(_0x334dad){return _0x334dad;});}return null;};}function removeEntity(_0x2f3223,_0x4499b6){return function(_0x3bf0e8){if(_0x3bf0e8){return _0x3bf0e8['destroy']()['then'](function(){_0x2f3223[_0x655c('0x1c')](0xcc)[_0x655c('0x26')]();});}};}function handleEntityNotFound(_0x137bdb,_0x1a53f0){return function(_0xf3db93){if(!_0xf3db93){_0x137bdb[_0x655c('0x1b')](0x194);}return _0xf3db93;};}function handleError(_0x322692,_0x9dcaf){_0x9dcaf=_0x9dcaf||0x1f4;return function(_0x37f505){logger[_0x655c('0x27')](_0x37f505[_0x655c('0x28')]);if(_0x37f505[_0x655c('0x29')]){delete _0x37f505[_0x655c('0x29')];}_0x322692[_0x655c('0x1c')](_0x9dcaf)[_0x655c('0x2a')](_0x37f505);};}exports['index']=function(_0x2f99ab,_0x48bbed){var _0x38471c={},_0x2ee44a={},_0x599816={'count':0x0,'rows':[]};var _0x6230a=_[_0x655c('0x2b')](db['VtigerField']['rawAttributes'],function(_0x303315){return{'name':_0x303315[_0x655c('0x2c')],'type':_0x303315[_0x655c('0x2d')][_0x655c('0x2e')]};});_0x2ee44a[_0x655c('0x2f')]=_['map'](_0x6230a,'name');_0x2ee44a['query']=_[_0x655c('0x30')](_0x2f99ab['query']);_0x2ee44a[_0x655c('0x31')]=_[_0x655c('0x32')](_0x2ee44a[_0x655c('0x2f')],_0x2ee44a[_0x655c('0x33')]);_0x38471c[_0x655c('0x34')]=_[_0x655c('0x32')](_0x2ee44a[_0x655c('0x2f')],qs[_0x655c('0x35')](_0x2f99ab[_0x655c('0x33')][_0x655c('0x35')]));_0x38471c['attributes']=_0x38471c['attributes'][_0x655c('0x36')]?_0x38471c['attributes']:_0x2ee44a[_0x655c('0x2f')];if(!_0x2f99ab[_0x655c('0x33')]['hasOwnProperty'](_0x655c('0x37'))){_0x38471c[_0x655c('0x1e')]=qs['limit'](_0x2f99ab[_0x655c('0x33')][_0x655c('0x1e')]);_0x38471c[_0x655c('0x20')]=qs[_0x655c('0x20')](_0x2f99ab[_0x655c('0x33')][_0x655c('0x20')]);}_0x38471c[_0x655c('0x38')]=qs[_0x655c('0x39')](_0x2f99ab['query']['sort']);_0x38471c[_0x655c('0x3a')]=qs[_0x655c('0x31')](_['pick'](_0x2f99ab[_0x655c('0x33')],_0x2ee44a[_0x655c('0x31')]),_0x6230a);if(_0x2f99ab[_0x655c('0x33')][_0x655c('0x3b')]){_0x38471c[_0x655c('0x3a')]=_[_0x655c('0x3c')](_0x38471c[_0x655c('0x3a')],{'$or':_[_0x655c('0x2b')](_0x6230a,function(_0x45f293){if(_0x45f293[_0x655c('0x2d')]!==_0x655c('0x3d')){var _0x2e7900={};_0x2e7900[_0x45f293['name']]={'$like':'%'+_0x2f99ab[_0x655c('0x33')][_0x655c('0x3b')]+'%'};return _0x2e7900;}})});}_0x38471c=_[_0x655c('0x3c')]({},_0x38471c,_0x2f99ab['options']);var _0x570537={'where':_0x38471c[_0x655c('0x3a')]};return db[_0x655c('0x3e')][_0x655c('0x21')](_0x570537)[_0x655c('0x3f')](function(_0xbd78e1){_0x599816[_0x655c('0x21')]=_0xbd78e1;if(_0x2f99ab[_0x655c('0x33')]['includeAll']){_0x38471c[_0x655c('0x40')]=[{'all':!![]}];}return db[_0x655c('0x3e')][_0x655c('0x41')](_0x38471c);})[_0x655c('0x3f')](function(_0x20aa98){_0x599816[_0x655c('0x42')]=_0x20aa98;return _0x599816;})[_0x655c('0x3f')](respondWithFilteredResult(_0x48bbed,_0x38471c))[_0x655c('0x43')](handleError(_0x48bbed,null));};exports[_0x655c('0x44')]=function(_0x34ff31,_0xdb59b5){var _0x404256={'raw':!![],'where':{'id':_0x34ff31[_0x655c('0x45')]['id']}},_0x47c359={};_0x47c359['model']=_['keys'](db[_0x655c('0x3e')][_0x655c('0x46')]);_0x47c359[_0x655c('0x33')]=_['keys'](_0x34ff31[_0x655c('0x33')]);_0x47c359[_0x655c('0x31')]=_[_0x655c('0x32')](_0x47c359[_0x655c('0x2f')],_0x47c359[_0x655c('0x33')]);_0x404256[_0x655c('0x34')]=_['intersection'](_0x47c359[_0x655c('0x2f')],qs[_0x655c('0x35')](_0x34ff31[_0x655c('0x33')][_0x655c('0x35')]));_0x404256[_0x655c('0x34')]=_0x404256[_0x655c('0x34')]['length']?_0x404256['attributes']:_0x47c359['model'];if(_0x34ff31[_0x655c('0x33')]['includeAll']){_0x404256[_0x655c('0x40')]=[{'all':!![]}];}_0x404256=_[_0x655c('0x3c')]({},_0x404256,_0x34ff31[_0x655c('0x47')]);return db[_0x655c('0x3e')][_0x655c('0x48')](_0x404256)['then'](handleEntityNotFound(_0xdb59b5,null))['then'](respondWithResult(_0xdb59b5,null))[_0x655c('0x43')](handleError(_0xdb59b5,null));};exports['create']=function(_0x107444,_0x2d9c6a){return db['VtigerField'][_0x655c('0x49')](_0x107444[_0x655c('0x4a')],{})[_0x655c('0x3f')](respondWithResult(_0x2d9c6a,0xc9))['catch'](handleError(_0x2d9c6a,null));};exports[_0x655c('0x4b')]=function(_0x3324a6,_0x428704){if(_0x3324a6[_0x655c('0x4a')]['id']){delete _0x3324a6[_0x655c('0x4a')]['id'];}return db[_0x655c('0x3e')]['find']({'where':{'id':_0x3324a6[_0x655c('0x45')]['id']}})['then'](handleEntityNotFound(_0x428704,null))[_0x655c('0x3f')](saveUpdates(_0x3324a6['body'],null))['then'](respondWithResult(_0x428704,null))['catch'](handleError(_0x428704,null));};exports[_0x655c('0x4c')]=function(_0xfdad25,_0x1bf9d5){return db[_0x655c('0x3e')]['find']({'where':{'id':_0xfdad25[_0x655c('0x45')]['id']}})[_0x655c('0x3f')](handleEntityNotFound(_0x1bf9d5,null))['then'](removeEntity(_0x1bf9d5,null))[_0x655c('0x43')](handleError(_0x1bf9d5,null));}; \ No newline at end of file +var _0x180b=['bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','VtigerField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x42e6ce,_0x511000){var _0xbe41a7=function(_0xb233c0){while(--_0xb233c0){_0x42e6ce['push'](_0x42e6ce['shift']());}};_0xbe41a7(++_0x511000);}(_0x180b,0x185));var _0xb180=function(_0x4ade0d,_0x3bdabd){_0x4ade0d=_0x4ade0d-0x0;var _0x284fd5=_0x180b[_0x4ade0d];return _0x284fd5;};'use strict';var emlformat=require(_0xb180('0x0'));var rimraf=require(_0xb180('0x1'));var zipdir=require(_0xb180('0x2'));var jsonpatch=require(_0xb180('0x3'));var rp=require(_0xb180('0x4'));var moment=require(_0xb180('0x5'));var BPromise=require(_0xb180('0x6'));var Mustache=require(_0xb180('0x7'));var util=require(_0xb180('0x8'));var path=require(_0xb180('0x9'));var sox=require(_0xb180('0xa'));var csv=require('to-csv');var ejs=require(_0xb180('0xb'));var fs=require('fs');var fs_extra=require(_0xb180('0xc'));var _=require('lodash');var squel=require(_0xb180('0xd'));var crypto=require(_0xb180('0xe'));var jsforce=require(_0xb180('0xf'));var deskjs=require(_0xb180('0x10'));var toCsv=require(_0xb180('0x11'));var querystring=require(_0xb180('0x12'));var Papa=require(_0xb180('0x13'));var Redis=require('ioredis');var authService=require(_0xb180('0x14'));var qs=require(_0xb180('0x15'));var as=require(_0xb180('0x16'));var hardwareService=require(_0xb180('0x17'));var logger=require('../../config/logger')(_0xb180('0x18'));var utils=require(_0xb180('0x19'));var config=require(_0xb180('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xb180('0x1b'))['db'];function respondWithStatusCode(_0x12e222,_0x5c8ff6){_0x5c8ff6=_0x5c8ff6||0xcc;return function(_0x3d8b9d){if(_0x3d8b9d){return _0x12e222[_0xb180('0x1c')](_0x5c8ff6);}return _0x12e222['status'](_0x5c8ff6)[_0xb180('0x1d')]();};}function respondWithResult(_0x4e6b44,_0x7524c5){_0x7524c5=_0x7524c5||0xc8;return function(_0x129930){if(_0x129930){return _0x4e6b44['status'](_0x7524c5)['json'](_0x129930);}};}function respondWithFilteredResult(_0x2163af,_0x38666a){return function(_0x3b0ffc){if(_0x3b0ffc){var _0x21d55b=typeof _0x38666a['offset']==='undefined'&&typeof _0x38666a['limit']===_0xb180('0x1e');var _0x51723f=_0x3b0ffc[_0xb180('0x1f')];var _0x51d617=_0x21d55b?0x0:_0x38666a[_0xb180('0x20')];var _0x1effdb=_0x21d55b?_0x3b0ffc['count']:_0x38666a[_0xb180('0x20')]+_0x38666a[_0xb180('0x21')];var _0x166593;if(_0x1effdb>=_0x51723f){_0x1effdb=_0x51723f;_0x166593=0xc8;}else{_0x166593=0xce;}_0x2163af[_0xb180('0x22')](_0x166593);return _0x2163af[_0xb180('0x23')](_0xb180('0x24'),_0x51d617+'-'+_0x1effdb+'/'+_0x51723f)['json'](_0x3b0ffc);}return null;};}function patchUpdates(_0x5814fa){return function(_0x251ed4){try{jsonpatch[_0xb180('0x25')](_0x251ed4,_0x5814fa,!![]);}catch(_0x2f3527){return BPromise[_0xb180('0x26')](_0x2f3527);}return _0x251ed4[_0xb180('0x27')]();};}function saveUpdates(_0x39ee2a,_0xa44711){return function(_0x368d73){if(_0x368d73){return _0x368d73[_0xb180('0x28')](_0x39ee2a)[_0xb180('0x29')](function(_0x52271a){return _0x52271a;});}return null;};}function removeEntity(_0x1c9c3d,_0x4767c8){return function(_0x313202){if(_0x313202){return _0x313202[_0xb180('0x2a')]()[_0xb180('0x29')](function(){_0x1c9c3d[_0xb180('0x22')](0xcc)[_0xb180('0x1d')]();});}};}function handleEntityNotFound(_0x38f557,_0x188be4){return function(_0x1b5af9){if(!_0x1b5af9){_0x38f557[_0xb180('0x1c')](0x194);}return _0x1b5af9;};}function handleError(_0x1080c5,_0x381f81){_0x381f81=_0x381f81||0x1f4;return function(_0x3f6b21){logger[_0xb180('0x2b')](_0x3f6b21[_0xb180('0x2c')]);if(_0x3f6b21[_0xb180('0x2d')]){delete _0x3f6b21['name'];}_0x1080c5[_0xb180('0x22')](_0x381f81)['send'](_0x3f6b21);};}exports[_0xb180('0x2e')]=function(_0xadae40,_0x1e81d0){var _0xad909b={},_0x100d58={},_0x2761c1={'count':0x0,'rows':[]};var _0x5c2385=_['map'](db[_0xb180('0x2f')][_0xb180('0x30')],function(_0x46bc09){return{'name':_0x46bc09[_0xb180('0x31')],'type':_0x46bc09[_0xb180('0x32')][_0xb180('0x33')]};});_0x100d58[_0xb180('0x34')]=_[_0xb180('0x35')](_0x5c2385,'name');_0x100d58[_0xb180('0x36')]=_[_0xb180('0x37')](_0xadae40[_0xb180('0x36')]);_0x100d58[_0xb180('0x38')]=_[_0xb180('0x39')](_0x100d58[_0xb180('0x34')],_0x100d58[_0xb180('0x36')]);_0xad909b[_0xb180('0x3a')]=_[_0xb180('0x39')](_0x100d58[_0xb180('0x34')],qs[_0xb180('0x3b')](_0xadae40[_0xb180('0x36')][_0xb180('0x3b')]));_0xad909b[_0xb180('0x3a')]=_0xad909b[_0xb180('0x3a')][_0xb180('0x3c')]?_0xad909b['attributes']:_0x100d58[_0xb180('0x34')];if(!_0xadae40[_0xb180('0x36')][_0xb180('0x3d')](_0xb180('0x3e'))){_0xad909b['limit']=qs[_0xb180('0x21')](_0xadae40['query'][_0xb180('0x21')]);_0xad909b[_0xb180('0x20')]=qs[_0xb180('0x20')](_0xadae40['query'][_0xb180('0x20')]);}_0xad909b['order']=qs['sort'](_0xadae40[_0xb180('0x36')][_0xb180('0x3f')]);_0xad909b[_0xb180('0x40')]=qs[_0xb180('0x38')](_[_0xb180('0x41')](_0xadae40[_0xb180('0x36')],_0x100d58[_0xb180('0x38')]),_0x5c2385);if(_0xadae40['query'][_0xb180('0x42')]){_0xad909b[_0xb180('0x40')]=_[_0xb180('0x43')](_0xad909b[_0xb180('0x40')],{'$or':_[_0xb180('0x35')](_0x5c2385,function(_0x454095){if(_0x454095[_0xb180('0x32')]!==_0xb180('0x44')){var _0x521e9c={};_0x521e9c[_0x454095[_0xb180('0x2d')]]={'$like':'%'+_0xadae40[_0xb180('0x36')][_0xb180('0x42')]+'%'};return _0x521e9c;}})});}_0xad909b=_[_0xb180('0x43')]({},_0xad909b,_0xadae40['options']);var _0x58d277={'where':_0xad909b['where']};return db[_0xb180('0x2f')][_0xb180('0x1f')](_0x58d277)[_0xb180('0x29')](function(_0x4cf61e){_0x2761c1[_0xb180('0x1f')]=_0x4cf61e;if(_0xadae40[_0xb180('0x36')][_0xb180('0x45')]){_0xad909b['include']=[{'all':!![]}];}return db['VtigerField'][_0xb180('0x46')](_0xad909b);})['then'](function(_0x115afe){_0x2761c1[_0xb180('0x47')]=_0x115afe;return _0x2761c1;})[_0xb180('0x29')](respondWithFilteredResult(_0x1e81d0,_0xad909b))[_0xb180('0x48')](handleError(_0x1e81d0,null));};exports[_0xb180('0x49')]=function(_0x3dc6ee,_0x1fd405){var _0xe14f6f={'raw':!![],'where':{'id':_0x3dc6ee['params']['id']}},_0x41b133={};_0x41b133[_0xb180('0x34')]=_[_0xb180('0x37')](db[_0xb180('0x2f')][_0xb180('0x30')]);_0x41b133[_0xb180('0x36')]=_['keys'](_0x3dc6ee['query']);_0x41b133[_0xb180('0x38')]=_[_0xb180('0x39')](_0x41b133[_0xb180('0x34')],_0x41b133[_0xb180('0x36')]);_0xe14f6f[_0xb180('0x3a')]=_['intersection'](_0x41b133[_0xb180('0x34')],qs[_0xb180('0x3b')](_0x3dc6ee[_0xb180('0x36')][_0xb180('0x3b')]));_0xe14f6f[_0xb180('0x3a')]=_0xe14f6f['attributes'][_0xb180('0x3c')]?_0xe14f6f[_0xb180('0x3a')]:_0x41b133['model'];if(_0x3dc6ee[_0xb180('0x36')]['includeAll']){_0xe14f6f['include']=[{'all':!![]}];}_0xe14f6f=_[_0xb180('0x43')]({},_0xe14f6f,_0x3dc6ee[_0xb180('0x4a')]);return db[_0xb180('0x2f')][_0xb180('0x4b')](_0xe14f6f)[_0xb180('0x29')](handleEntityNotFound(_0x1fd405,null))[_0xb180('0x29')](respondWithResult(_0x1fd405,null))[_0xb180('0x48')](handleError(_0x1fd405,null));};exports[_0xb180('0x4c')]=function(_0x3d3a4a,_0x229c23){return db[_0xb180('0x2f')][_0xb180('0x4c')](_0x3d3a4a[_0xb180('0x4d')],{})[_0xb180('0x29')](respondWithResult(_0x229c23,0xc9))[_0xb180('0x48')](handleError(_0x229c23,null));};exports[_0xb180('0x28')]=function(_0x276cc9,_0x476077){if(_0x276cc9['body']['id']){delete _0x276cc9[_0xb180('0x4d')]['id'];}return db[_0xb180('0x2f')][_0xb180('0x4b')]({'where':{'id':_0x276cc9[_0xb180('0x4e')]['id']}})[_0xb180('0x29')](handleEntityNotFound(_0x476077,null))[_0xb180('0x29')](saveUpdates(_0x276cc9[_0xb180('0x4d')],null))['then'](respondWithResult(_0x476077,null))['catch'](handleError(_0x476077,null));};exports[_0xb180('0x2a')]=function(_0x2b314f,_0x33b51c){return db['VtigerField'][_0xb180('0x4b')]({'where':{'id':_0x2b314f[_0xb180('0x4e')]['id']}})[_0xb180('0x29')](handleEntityNotFound(_0x33b51c,null))['then'](removeEntity(_0x33b51c,null))[_0xb180('0x48')](handleError(_0x33b51c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index bdc0c61..ef15d95 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 _0x53e4=['util','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','idField','lodash'];(function(_0x1564c0,_0x5980c2){var _0x310ae7=function(_0x890a86){while(--_0x890a86){_0x1564c0['push'](_0x1564c0['shift']());}};_0x310ae7(++_0x5980c2);}(_0x53e4,0x1bb));var _0x453e=function(_0x451980,_0x2ad060){_0x451980=_0x451980-0x0;var _0x3a66cf=_0x53e4[_0x451980];return _0x3a66cf;};'use strict';var _=require(_0x453e('0x0'));var util=require(_0x453e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x453e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x453e('0x3'));var rimraf=require(_0x453e('0x4'));var config=require(_0x453e('0x5'));var attributes=require(_0x453e('0x6'));module[_0x453e('0x7')]=function(_0x394fee,_0x35cfe0){return _0x394fee[_0x453e('0x8')]('VtigerField',attributes,{'tableName':_0x453e('0x9'),'paranoid':![],'indexes':[{'name':_0x453e('0xa'),'fields':[_0x453e('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc9b3=['../../config/logger','path','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0x38e5f0,_0x4fedd8){var _0x5b08dc=function(_0x321b77){while(--_0x321b77){_0x38e5f0['push'](_0x38e5f0['shift']());}};_0x5b08dc(++_0x4fedd8);}(_0xc9b3,0x129));var _0x3c9b=function(_0xcf17f8,_0x1eba10){_0xcf17f8=_0xcf17f8-0x0;var _0x354505=_0xc9b3[_0xcf17f8];return _0x354505;};'use strict';var _=require(_0x3c9b('0x0'));var util=require(_0x3c9b('0x1'));var logger=require(_0x3c9b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c9b('0x3'));var rimraf=require(_0x3c9b('0x4'));var config=require(_0x3c9b('0x5'));var attributes=require('./intVtigerField.attributes');module[_0x3c9b('0x6')]=function(_0x50dab3,_0x47d245){return _0x50dab3[_0x3c9b('0x7')](_0x3c9b('0x8'),attributes,{'tableName':_0x3c9b('0x9'),'paranoid':![],'indexes':[{'name':_0x3c9b('0xa'),'fields':[_0x3c9b('0xb'),_0x3c9b('0xc')],'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 5ef7168..4ea1617 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 _0xa920=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment'];(function(_0x129e3d,_0x1f0567){var _0x40c2d5=function(_0x4b76aa){while(--_0x4b76aa){_0x129e3d['push'](_0x129e3d['shift']());}};_0x40c2d5(++_0x1f0567);}(_0xa920,0x7c));var _0x0a92=function(_0xafe986,_0x7675eb){_0xafe986=_0xafe986-0x0;var _0x4a6b41=_0xa920[_0xafe986];return _0x4a6b41;};'use strict';var _=require('lodash');var util=require(_0x0a92('0x0'));var moment=require(_0x0a92('0x1'));var BPromise=require(_0x0a92('0x2'));var rs=require(_0x0a92('0x3'));var fs=require('fs');var Redis=require(_0x0a92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a92('0x5'));var logger=require('../../config/logger')(_0x0a92('0x6'));var config=require(_0x0a92('0x7'));var jayson=require(_0x0a92('0x8'));var client=jayson[_0x0a92('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc5f653,_0x77daf6,_0xc62609){return new BPromise(function(_0x468bb5,_0x4710fd){return client[_0x0a92('0xa')](_0xc5f653,_0xc62609)[_0x0a92('0xb')](function(_0x5c4acb){logger['info'](_0x0a92('0xc'),_0x77daf6,_0x0a92('0xd'));logger[_0x0a92('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x77daf6,'request\x20sent',JSON['stringify'](_0x5c4acb));if(_0x5c4acb[_0x0a92('0xf')]){if(_0x5c4acb['error'][_0x0a92('0x10')]===0x1f4){logger[_0x0a92('0xf')]('VtigerField,\x20%s,\x20%s',_0x77daf6,_0x5c4acb[_0x0a92('0xf')][_0x0a92('0x11')]);return _0x4710fd(_0x5c4acb[_0x0a92('0xf')]['message']);}logger['error']('VtigerField,\x20%s,\x20%s',_0x77daf6,_0x5c4acb[_0x0a92('0xf')][_0x0a92('0x11')]);return _0x468bb5(_0x5c4acb[_0x0a92('0xf')][_0x0a92('0x11')]);}else{logger[_0x0a92('0x12')](_0x0a92('0xc'),_0x77daf6,'request\x20sent');_0x468bb5(_0x5c4acb[_0x0a92('0x13')]['message']);}})[_0x0a92('0x14')](function(_0x2240ef){logger[_0x0a92('0xf')]('VtigerField,\x20%s,\x20%s',_0x77daf6,_0x2240ef);_0x4710fd(_0x2240ef);});});} \ No newline at end of file +var _0x5352=['../../config/environment','jayson/promise','http','request','info','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x43e3f2,_0x4510f6){var _0x9fa1a2=function(_0x18615d){while(--_0x18615d){_0x43e3f2['push'](_0x43e3f2['shift']());}};_0x9fa1a2(++_0x4510f6);}(_0x5352,0x12c));var _0x2535=function(_0x431f91,_0x29f355){_0x431f91=_0x431f91-0x0;var _0x3a1fd8=_0x5352[_0x431f91];return _0x3a1fd8;};'use strict';var _=require(_0x2535('0x0'));var util=require('util');var moment=require(_0x2535('0x1'));var BPromise=require(_0x2535('0x2'));var rs=require(_0x2535('0x3'));var fs=require('fs');var Redis=require(_0x2535('0x4'));var db=require(_0x2535('0x5'))['db'];var utils=require(_0x2535('0x6'));var logger=require(_0x2535('0x7'))('rpc');var config=require(_0x2535('0x8'));var jayson=require(_0x2535('0x9'));var client=jayson['client'][_0x2535('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb60b91,_0x487c1c,_0x8dd936){return new BPromise(function(_0x374da7,_0x3d0770){return client[_0x2535('0xb')](_0xb60b91,_0x8dd936)['then'](function(_0x1dc7f5){logger[_0x2535('0xc')](_0x2535('0xd'),_0x487c1c,'request\x20sent');logger['debug'](_0x2535('0xe'),_0x487c1c,_0x2535('0xf'),JSON[_0x2535('0x10')](_0x1dc7f5));if(_0x1dc7f5[_0x2535('0x11')]){if(_0x1dc7f5['error'][_0x2535('0x12')]===0x1f4){logger[_0x2535('0x11')](_0x2535('0xd'),_0x487c1c,_0x1dc7f5[_0x2535('0x11')]['message']);return _0x3d0770(_0x1dc7f5['error'][_0x2535('0x13')]);}logger[_0x2535('0x11')](_0x2535('0xd'),_0x487c1c,_0x1dc7f5[_0x2535('0x11')][_0x2535('0x13')]);return _0x374da7(_0x1dc7f5[_0x2535('0x11')][_0x2535('0x13')]);}else{logger[_0x2535('0xc')](_0x2535('0xd'),_0x487c1c,'request\x20sent');_0x374da7(_0x1dc7f5[_0x2535('0x14')][_0x2535('0x13')]);}})[_0x2535('0x15')](function(_0x27351a){logger[_0x2535('0x11')](_0x2535('0xd'),_0x487c1c,_0x27351a);_0x3d0770(_0x27351a);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 5148b67..3d29721 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 _0x0e1a=['express','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','util','path','connect-timeout'];(function(_0x53cd4c,_0x52fd51){var _0x38ded1=function(_0x192055){while(--_0x192055){_0x53cd4c['push'](_0x53cd4c['shift']());}};_0x38ded1(++_0x52fd51);}(_0x0e1a,0xef));var _0xa0e1=function(_0x1cf873,_0x5922c0){_0x1cf873=_0x1cf873-0x0;var _0x1669ae=_0x0e1a[_0x1cf873];return _0x1669ae;};'use strict';var multer=require('multer');var util=require(_0xa0e1('0x0'));var path=require(_0xa0e1('0x1'));var timeout=require(_0xa0e1('0x2'));var express=require(_0xa0e1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa0e1('0x4'));var interaction=require(_0xa0e1('0x5'));var config=require('../../config/environment');var controller=require(_0xa0e1('0x6'));router['get']('/',auth[_0xa0e1('0x7')](),controller[_0xa0e1('0x8')]);router[_0xa0e1('0x9')](_0xa0e1('0xa'),auth['isAuthenticated'](),controller[_0xa0e1('0xb')]);router['get'](_0xa0e1('0xc'),auth['isAuthenticated'](),controller[_0xa0e1('0xd')]);router['get'](_0xa0e1('0xe'),auth['isAuthenticated'](),controller[_0xa0e1('0xf')]);router['post']('/',auth[_0xa0e1('0x7')](),controller['create']);router[_0xa0e1('0x10')](_0xa0e1('0xc'),auth[_0xa0e1('0x7')](),controller[_0xa0e1('0x11')]);router[_0xa0e1('0x12')]('/:id',auth[_0xa0e1('0x7')](),controller[_0xa0e1('0x13')]);router[_0xa0e1('0x14')](_0xa0e1('0xa'),auth[_0xa0e1('0x7')](),controller['destroy']);module[_0xa0e1('0x15')]=router; \ No newline at end of file +var _0x97a0=['express','../../components/auth/service','./intZendeskAccount.controller','get','index','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','delete','destroy','exports','multer','util','path'];(function(_0x5ec6d7,_0x1d3878){var _0x503fb3=function(_0x2a8dc4){while(--_0x2a8dc4){_0x5ec6d7['push'](_0x5ec6d7['shift']());}};_0x503fb3(++_0x1d3878);}(_0x97a0,0xc5));var _0x097a=function(_0x1010ff,_0x419fe6){_0x1010ff=_0x1010ff-0x0;var _0x1843b2=_0x97a0[_0x1010ff];return _0x1843b2;};'use strict';var multer=require(_0x097a('0x0'));var util=require(_0x097a('0x1'));var path=require(_0x097a('0x2'));var timeout=require('connect-timeout');var express=require(_0x097a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x097a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x097a('0x5'));router[_0x097a('0x6')]('/',auth['isAuthenticated'](),controller[_0x097a('0x7')]);router[_0x097a('0x6')]('/:id',auth[_0x097a('0x8')](),controller[_0x097a('0x9')]);router['get']('/:id/configurations',auth[_0x097a('0x8')](),controller[_0x097a('0xa')]);router[_0x097a('0x6')](_0x097a('0xb'),auth[_0x097a('0x8')](),controller[_0x097a('0xc')]);router[_0x097a('0xd')]('/',auth[_0x097a('0x8')](),controller[_0x097a('0xe')]);router[_0x097a('0xd')](_0x097a('0xf'),auth[_0x097a('0x8')](),controller['addConfiguration']);router[_0x097a('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x097a('0x11')]('/:id',auth[_0x097a('0x8')](),controller[_0x097a('0x12')]);module[_0x097a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 1d6e930..cf23698 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 _0x5496=['remoteUri','ENUM','password','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x519680,_0x1167eb){var _0xfc5e1=function(_0x1b8bd8){while(--_0x1b8bd8){_0x519680['push'](_0x519680['shift']());}};_0xfc5e1(++_0x1167eb);}(_0x5496,0x175));var _0x6549=function(_0x5236ee,_0x374edb){_0x5236ee=_0x5236ee-0x0;var _0x2365aa=_0x5496[_0x5236ee];return _0x2365aa;};'use strict';var Sequelize=require(_0x6549('0x0'));module[_0x6549('0x1')]={'name':{'type':Sequelize[_0x6549('0x2')]},'description':{'type':Sequelize[_0x6549('0x2')]},'username':{'type':Sequelize[_0x6549('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x6549('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6549('0x2')],'unique':_0x6549('0x3')},'authType':{'type':Sequelize[_0x6549('0x4')]('password','token'),'defaultValue':_0x6549('0x5')},'serverUrl':{'type':Sequelize[_0x6549('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6549('0x6'),_0x6549('0x7')),'defaultValue':_0x6549('0x6')}}; \ No newline at end of file +var _0x7eff=['integrationTab','newTab','exports','STRING','username','password','token','ENUM'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x7eff,0x162));var _0xf7ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eff[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf7ef('0x0')]={'name':{'type':Sequelize[_0xf7ef('0x1')]},'description':{'type':Sequelize[_0xf7ef('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xf7ef('0x2')},'password':{'type':Sequelize[_0xf7ef('0x1')]},'token':{'type':Sequelize[_0xf7ef('0x1')]},'remoteUri':{'type':Sequelize[_0xf7ef('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0xf7ef('0x3'),_0xf7ef('0x4')),'defaultValue':_0xf7ef('0x3')},'serverUrl':{'type':Sequelize[_0xf7ef('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf7ef('0x5')](_0xf7ef('0x6'),_0xf7ef('0x7')),'defaultValue':_0xf7ef('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 1b656b9..661f120 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 _0x1d2d=['position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','send','index','ZendeskAccount','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','filter','options','findAll','catch','includeAll','find','create','body','params','getConfigurations','ZendeskConfiguration','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','ZendeskField','Descriptions','username','token','substring','lastIndexOf','GET','format','%s/%s','authType','password','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','Sequelize','subject','description','group','assignee','ticket_fields','includes'];(function(_0x39b933,_0x5aae2f){var _0x14443e=function(_0x8ae614){while(--_0x8ae614){_0x39b933['push'](_0x39b933['shift']());}};_0x14443e(++_0x5aae2f);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x5306fa,_0x188a9){_0x5306fa=_0x5306fa-0x0;var _0x3f9f35=_0x1d2d[_0x5306fa];return _0x3f9f35;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];var integrations=require(_0xd1d2('0x1b'));function respondWithStatusCode(_0x129d8f,_0xc3ee82){_0xc3ee82=_0xc3ee82||0xcc;return function(_0x2df8a5){if(_0x2df8a5){return _0x129d8f[_0xd1d2('0x1c')](_0xc3ee82);}return _0x129d8f[_0xd1d2('0x1d')](_0xc3ee82)[_0xd1d2('0x1e')]();};}function respondWithResult(_0x4cf702,_0x2e7fec){_0x2e7fec=_0x2e7fec||0xc8;return function(_0x3c0296){if(_0x3c0296){return _0x4cf702[_0xd1d2('0x1d')](_0x2e7fec)['json'](_0x3c0296);}};}function respondWithFilteredResult(_0x35381b,_0xc36ce){return function(_0x208425){if(_0x208425){var _0x2f4cf9=typeof _0xc36ce[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0xc36ce[_0xd1d2('0x21')]==='undefined';var _0x539d5a=_0x208425[_0xd1d2('0x22')];var _0x55320b=_0x2f4cf9?0x0:_0xc36ce[_0xd1d2('0x1f')];var _0x42565b=_0x2f4cf9?_0x208425[_0xd1d2('0x22')]:_0xc36ce[_0xd1d2('0x1f')]+_0xc36ce['limit'];var _0x4f1201;if(_0x42565b>=_0x539d5a){_0x42565b=_0x539d5a;_0x4f1201=0xc8;}else{_0x4f1201=0xce;}_0x35381b[_0xd1d2('0x1d')](_0x4f1201);return _0x35381b['set']('Content-Range',_0x55320b+'-'+_0x42565b+'/'+_0x539d5a)[_0xd1d2('0x23')](_0x208425);}return null;};}function patchUpdates(_0x27e26b){return function(_0x3414ce){try{jsonpatch[_0xd1d2('0x24')](_0x3414ce,_0x27e26b,!![]);}catch(_0x596cd8){return BPromise[_0xd1d2('0x25')](_0x596cd8);}return _0x3414ce[_0xd1d2('0x26')]();};}function saveUpdates(_0x24b8db,_0x4eb082){return function(_0x59e72c){if(_0x59e72c){return _0x59e72c[_0xd1d2('0x27')](_0x24b8db)[_0xd1d2('0x28')](function(_0x19d535){return _0x19d535;});}return null;};}function removeEntity(_0x2f92ee,_0x3f229c){return function(_0x33a171){if(_0x33a171){return _0x33a171[_0xd1d2('0x29')]()['then'](function(){_0x2f92ee[_0xd1d2('0x1d')](0xcc)[_0xd1d2('0x1e')]();});}};}function handleEntityNotFound(_0x41330f,_0x2e1709){return function(_0x5d3ee1){if(!_0x5d3ee1){_0x41330f[_0xd1d2('0x1c')](0x194);}return _0x5d3ee1;};}function handleError(_0x28b8be,_0x34faf7){_0x34faf7=_0x34faf7||0x1f4;return function(_0xe6ef3c){logger[_0xd1d2('0x2a')](_0xe6ef3c[_0xd1d2('0x2b')]);if(_0xe6ef3c['name']){delete _0xe6ef3c['name'];}_0x28b8be[_0xd1d2('0x1d')](_0x34faf7)[_0xd1d2('0x2c')](_0xe6ef3c);};}exports[_0xd1d2('0x2d')]=function(_0x2b4c1f,_0xc815ea){var _0x48ade1={},_0x39d694={},_0x41171c={'count':0x0,'rows':[]};var _0x383947=_['map'](db[_0xd1d2('0x2e')][_0xd1d2('0x2f')],function(_0xbd855a){return{'name':_0xbd855a['fieldName'],'type':_0xbd855a[_0xd1d2('0x30')][_0xd1d2('0x31')]};});_0x39d694[_0xd1d2('0x32')]=_[_0xd1d2('0x33')](_0x383947,_0xd1d2('0x34'));_0x39d694[_0xd1d2('0x35')]=_[_0xd1d2('0x36')](_0x2b4c1f[_0xd1d2('0x35')]);_0x39d694[_0xd1d2('0x37')]=_[_0xd1d2('0x38')](_0x39d694[_0xd1d2('0x32')],_0x39d694[_0xd1d2('0x35')]);_0x48ade1[_0xd1d2('0x39')]=_[_0xd1d2('0x38')](_0x39d694[_0xd1d2('0x32')],qs[_0xd1d2('0x3a')](_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x3a')]));_0x48ade1['attributes']=_0x48ade1[_0xd1d2('0x39')][_0xd1d2('0x3b')]?_0x48ade1[_0xd1d2('0x39')]:_0x39d694['model'];if(!_0x2b4c1f[_0xd1d2('0x35')]['hasOwnProperty']('nolimit')){_0x48ade1[_0xd1d2('0x21')]=qs[_0xd1d2('0x21')](_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x21')]);_0x48ade1[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x2b4c1f['query'][_0xd1d2('0x1f')]);}_0x48ade1[_0xd1d2('0x3c')]=qs['sort'](_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x3d')]);_0x48ade1[_0xd1d2('0x3e')]=qs[_0xd1d2('0x37')](_['pick'](_0x2b4c1f['query'],_0x39d694[_0xd1d2('0x37')]),_0x383947);if(_0x2b4c1f['query']['filter']){_0x48ade1['where']=_[_0xd1d2('0x3f')](_0x48ade1['where'],{'$or':_[_0xd1d2('0x33')](_0x383947,function(_0x4e7640){if(_0x4e7640['type']!=='VIRTUAL'){var _0x2dabfa={};_0x2dabfa[_0x4e7640[_0xd1d2('0x34')]]={'$like':'%'+_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x40')]+'%'};return _0x2dabfa;}})});}_0x48ade1=_[_0xd1d2('0x3f')]({},_0x48ade1,_0x2b4c1f[_0xd1d2('0x41')]);var _0x178f8b={'where':_0x48ade1[_0xd1d2('0x3e')]};return db[_0xd1d2('0x2e')][_0xd1d2('0x22')](_0x178f8b)[_0xd1d2('0x28')](function(_0x1fb5b5){_0x41171c[_0xd1d2('0x22')]=_0x1fb5b5;if(_0x2b4c1f[_0xd1d2('0x35')]['includeAll']){_0x48ade1['include']=[{'all':!![]}];}return db[_0xd1d2('0x2e')][_0xd1d2('0x42')](_0x48ade1);})[_0xd1d2('0x28')](function(_0x4d0fd9){_0x41171c['rows']=_0x4d0fd9;return _0x41171c;})[_0xd1d2('0x28')](respondWithFilteredResult(_0xc815ea,_0x48ade1))[_0xd1d2('0x43')](handleError(_0xc815ea,null));};exports['show']=function(_0x2fe92a,_0x4c5d49){var _0x5a3790={'raw':![],'where':{'id':_0x2fe92a['params']['id']}},_0x21eb24={};_0x21eb24['model']=_[_0xd1d2('0x36')](db[_0xd1d2('0x2e')][_0xd1d2('0x2f')]);_0x21eb24['query']=_[_0xd1d2('0x36')](_0x2fe92a[_0xd1d2('0x35')]);_0x21eb24[_0xd1d2('0x37')]=_[_0xd1d2('0x38')](_0x21eb24['model'],_0x21eb24[_0xd1d2('0x35')]);_0x5a3790[_0xd1d2('0x39')]=_['intersection'](_0x21eb24[_0xd1d2('0x32')],qs['fields'](_0x2fe92a[_0xd1d2('0x35')][_0xd1d2('0x3a')]));_0x5a3790[_0xd1d2('0x39')]=_0x5a3790[_0xd1d2('0x39')][_0xd1d2('0x3b')]?_0x5a3790['attributes']:_0x21eb24['model'];if(_0x2fe92a[_0xd1d2('0x35')][_0xd1d2('0x44')]){_0x5a3790['include']=[{'all':!![]}];}_0x5a3790=_[_0xd1d2('0x3f')]({},_0x5a3790,_0x2fe92a[_0xd1d2('0x41')]);return db[_0xd1d2('0x2e')][_0xd1d2('0x45')](_0x5a3790)[_0xd1d2('0x28')](handleEntityNotFound(_0x4c5d49,null))[_0xd1d2('0x28')](respondWithResult(_0x4c5d49,null))[_0xd1d2('0x43')](handleError(_0x4c5d49,null));};exports['create']=function(_0xed9e9,_0xc10c10){return db['ZendeskAccount'][_0xd1d2('0x46')](_0xed9e9[_0xd1d2('0x47')],{})['then'](respondWithResult(_0xc10c10,0xc9))['catch'](handleError(_0xc10c10,null));};exports[_0xd1d2('0x27')]=function(_0x182ea8,_0x4cb376){if(_0x182ea8[_0xd1d2('0x47')]['id']){delete _0x182ea8[_0xd1d2('0x47')]['id'];}return db[_0xd1d2('0x2e')][_0xd1d2('0x45')]({'where':{'id':_0x182ea8[_0xd1d2('0x48')]['id']}})['then'](handleEntityNotFound(_0x4cb376,null))['then'](saveUpdates(_0x182ea8[_0xd1d2('0x47')],null))['then'](respondWithResult(_0x4cb376,null))[_0xd1d2('0x43')](handleError(_0x4cb376,null));};exports[_0xd1d2('0x29')]=function(_0x4f4cb9,_0x389fcb){return db[_0xd1d2('0x2e')]['find']({'where':{'id':_0x4f4cb9['params']['id']}})[_0xd1d2('0x28')](handleEntityNotFound(_0x389fcb,null))[_0xd1d2('0x28')](removeEntity(_0x389fcb,null))[_0xd1d2('0x43')](handleError(_0x389fcb,null));};exports[_0xd1d2('0x49')]=function(_0xa013ce,_0x34a793,_0x1f6150){var _0x3411c8={};var _0x33e332={};var _0x5e15cb;var _0x1958f3;return db['ZendeskAccount']['findOne']({'where':{'id':_0xa013ce[_0xd1d2('0x48')]['id']}})[_0xd1d2('0x28')](handleEntityNotFound(_0x34a793,null))[_0xd1d2('0x28')](function(_0x47417f){if(_0x47417f){_0x5e15cb=_0x47417f;_0x33e332[_0xd1d2('0x32')]=_[_0xd1d2('0x36')](db[_0xd1d2('0x4a')][_0xd1d2('0x2f')]);_0x33e332[_0xd1d2('0x35')]=_[_0xd1d2('0x36')](_0xa013ce[_0xd1d2('0x35')]);_0x33e332[_0xd1d2('0x37')]=_[_0xd1d2('0x38')](_0x33e332['model'],_0x33e332['query']);_0x3411c8[_0xd1d2('0x39')]=_[_0xd1d2('0x38')](_0x33e332[_0xd1d2('0x32')],qs[_0xd1d2('0x3a')](_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x3a')]));_0x3411c8[_0xd1d2('0x39')]=_0x3411c8[_0xd1d2('0x39')][_0xd1d2('0x3b')]?_0x3411c8[_0xd1d2('0x39')]:_0x33e332[_0xd1d2('0x32')];_0x3411c8['order']=qs['sort'](_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x3d')]);_0x3411c8[_0xd1d2('0x3e')]=qs[_0xd1d2('0x37')](_['pick'](_0xa013ce[_0xd1d2('0x35')],_0x33e332[_0xd1d2('0x37')]));if(_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x40')]){_0x3411c8[_0xd1d2('0x3e')]=_[_0xd1d2('0x3f')](_0x3411c8[_0xd1d2('0x3e')],{'$or':_['map'](_0x3411c8[_0xd1d2('0x39')],function(_0x24d92c){var _0x1d8788={};_0x1d8788[_0x24d92c]={'$like':'%'+_0xa013ce['query']['filter']+'%'};return _0x1d8788;})});}_0x3411c8=_[_0xd1d2('0x3f')]({},_0x3411c8,_0xa013ce[_0xd1d2('0x41')]);return _0x5e15cb[_0xd1d2('0x49')](_0x3411c8);}})[_0xd1d2('0x28')](function(_0x598e6c){if(_0x598e6c){_0x1958f3=_0x598e6c[_0xd1d2('0x3b')];if(!_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x4b')]('nolimit')){_0x3411c8[_0xd1d2('0x21')]=qs[_0xd1d2('0x21')](_0xa013ce['query'][_0xd1d2('0x21')]);_0x3411c8[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0xa013ce[_0xd1d2('0x35')]['offset']);}return _0x5e15cb[_0xd1d2('0x49')](_0x3411c8);}})[_0xd1d2('0x28')](function(_0xd82d10){if(_0xd82d10){return _0xd82d10?{'count':_0x1958f3,'rows':_0xd82d10}:null;}})[_0xd1d2('0x28')](respondWithResult(_0x34a793,null))[_0xd1d2('0x43')](handleError(_0x34a793,null));};exports['addConfiguration']=function(_0x47aa13,_0x500465,_0x541676){if(_0x47aa13['body']['id']){delete _0x47aa13[_0xd1d2('0x47')]['id'];}return db[_0xd1d2('0x2e')][_0xd1d2('0x4c')]({'where':{'id':_0x47aa13['params']['id']}})[_0xd1d2('0x28')](handleEntityNotFound(_0x500465,null))[_0xd1d2('0x28')](function(_0x22d617){if(_0x22d617){_0x47aa13['body'][_0xd1d2('0x4d')]=_0x22d617['id'];_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x4e')]=integrations[_0xd1d2('0x4f')](_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x50')],_0x47aa13['body'][_0xd1d2('0x30')]);_0x47aa13[_0xd1d2('0x47')]['Descriptions']=integrations['getDescriptions'](_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x50')],_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x30')]);return db['ZendeskConfiguration'][_0xd1d2('0x46')](_0x47aa13[_0xd1d2('0x47')],{'include':[{'model':db[_0xd1d2('0x51')],'as':_0xd1d2('0x4e')},{'model':db['ZendeskField'],'as':_0xd1d2('0x52')}]});}return null;})[_0xd1d2('0x28')](respondWithResult(_0x500465,null))[_0xd1d2('0x43')](handleError(_0x500465,null));};exports['getFields']=function(_0x46ff4d,_0x1ae9af,_0x4c35cb){var _0x2175ab='';return db[_0xd1d2('0x2e')][_0xd1d2('0x4c')]({'where':{'id':_0x46ff4d[_0xd1d2('0x48')]['id']},'attributes':['id',_0xd1d2('0x53'),'password',_0xd1d2('0x54'),'authType','remoteUri']})['then'](handleEntityNotFound(_0x1ae9af,null))['then'](function(_0x89ec63){if(_0x89ec63){_0x2175ab=_0x89ec63['remoteUri'];var _0x37591f=_0x2175ab['slice'](-0x1);if(_0x37591f==='/'){_0x2175ab=_0x2175ab[_0xd1d2('0x55')](0x0,_0x2175ab[_0xd1d2('0x56')](_0x37591f));}var _0x16cc6c={'method':_0xd1d2('0x57'),'uri':util[_0xd1d2('0x58')](_0xd1d2('0x59'),_0x2175ab,'ticket_fields'),'json':!![]};switch(_0x89ec63[_0xd1d2('0x5a')]){case _0xd1d2('0x5b'):_0x16cc6c[_0xd1d2('0x5c')]={'Authorization':util[_0xd1d2('0x58')](_0xd1d2('0x5d'),new Buffer(util[_0xd1d2('0x58')](_0xd1d2('0x5e'),_0x89ec63[_0xd1d2('0x53')],_0x89ec63[_0xd1d2('0x5b')]))[_0xd1d2('0x5f')]('base64'))};break;case _0xd1d2('0x54'):_0x16cc6c[_0xd1d2('0x5c')]={'Authorization':util[_0xd1d2('0x58')](_0xd1d2('0x5d'),new Buffer(util['format'](_0xd1d2('0x60'),_0x89ec63[_0xd1d2('0x53')],_0x89ec63[_0xd1d2('0x54')]))['toString'](_0xd1d2('0x61')))};break;default:throw new db[(_0xd1d2('0x62'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x16cc6c);}})[_0xd1d2('0x28')](function(_0x268d6d){if(_0x268d6d){var _0x3fbd87=[_0xd1d2('0x63'),_0xd1d2('0x64'),_0xd1d2('0x65'),_0xd1d2('0x66')];_['remove'](_0x268d6d[_0xd1d2('0x67')],function(_0x9a98d4){return _0x3fbd87[_0xd1d2('0x68')](_0x9a98d4[_0xd1d2('0x30')]);});return{'count':_0x268d6d[_0xd1d2('0x67')][_0xd1d2('0x3b')],'rows':_[_0xd1d2('0x33')](_0x268d6d[_0xd1d2('0x67')],function(_0x44409e){return{'id':_0x44409e['id'],'name':_0x44409e[_0xd1d2('0x69')]>0x7?_0x44409e[_0xd1d2('0x6a')]:_0x44409e[_0xd1d2('0x30')],'custom':_0x44409e[_0xd1d2('0x69')]>0x7?!![]:![],'options':_0x44409e[_0xd1d2('0x6b')]?_0x44409e['system_field_options']:_0x44409e[_0xd1d2('0x6c')]?_0x44409e[_0xd1d2('0x6c')]:[]};})};}})[_0xd1d2('0x28')](respondWithResult(_0x1ae9af,null))[_0xd1d2('0x43')](function(_0x20a3f0){var _0x32c294=_0x46ff4d[_0xd1d2('0x35')][_0xd1d2('0x6d')]?0x1f4:_0x20a3f0[_0xd1d2('0x6e')]||0x1f4;logger[_0xd1d2('0x2a')](_0xd1d2('0x6f'),_0xd1d2('0x70'),_0x32c294,JSON[_0xd1d2('0x71')](_0x20a3f0));delete _0x20a3f0['name'];if(_0x32c294===0x191){_0x32c294=0x190;}_0x1ae9af[_0xd1d2('0x1d')](_0x32c294)[_0xd1d2('0x2c')](_0x46ff4d[_0xd1d2('0x35')][_0xd1d2('0x6d')]?{'message':_0xd1d2('0x72'),'statusCode':_0x20a3f0[_0xd1d2('0x6e')]}:_0x20a3f0);});}; \ No newline at end of file +var _0xb688=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','index','map','ZendeskAccount','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','name','options','findAll','rows','catch','show','includeAll','include','find','create','params','body','findOne','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','ZendeskConfiguration','getFields','username','password','token','remoteUri','slice','substring','%s/%s','authType','format','Basic\x20%s','%s:%s','toString','base64','headers','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','error','stringify','send','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0xb688,0xcf));var _0x8b68=function(_0x120761,_0x8ef4f1){_0x120761=_0x120761-0x0;var _0x28f6f9=_0xb688[_0x120761];return _0x28f6f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];var integrations=require(_0x8b68('0x1b'));function respondWithStatusCode(_0x2f3af4,_0xaa8725){_0xaa8725=_0xaa8725||0xcc;return function(_0x137c8e){if(_0x137c8e){return _0x2f3af4[_0x8b68('0x1c')](_0xaa8725);}return _0x2f3af4['status'](_0xaa8725)[_0x8b68('0x1d')]();};}function respondWithResult(_0x509033,_0x5e3c66){_0x5e3c66=_0x5e3c66||0xc8;return function(_0x22f75b){if(_0x22f75b){return _0x509033[_0x8b68('0x1e')](_0x5e3c66)[_0x8b68('0x1f')](_0x22f75b);}};}function respondWithFilteredResult(_0x5d3468,_0x5c8d0e){return function(_0x23bd52){if(_0x23bd52){var _0x5c1e44=typeof _0x5c8d0e[_0x8b68('0x20')]===_0x8b68('0x21')&&typeof _0x5c8d0e[_0x8b68('0x22')]===_0x8b68('0x21');var _0x491695=_0x23bd52[_0x8b68('0x23')];var _0x203dd4=_0x5c1e44?0x0:_0x5c8d0e['offset'];var _0x42b3bd=_0x5c1e44?_0x23bd52[_0x8b68('0x23')]:_0x5c8d0e[_0x8b68('0x20')]+_0x5c8d0e[_0x8b68('0x22')];var _0x38b7a7;if(_0x42b3bd>=_0x491695){_0x42b3bd=_0x491695;_0x38b7a7=0xc8;}else{_0x38b7a7=0xce;}_0x5d3468['status'](_0x38b7a7);return _0x5d3468[_0x8b68('0x24')](_0x8b68('0x25'),_0x203dd4+'-'+_0x42b3bd+'/'+_0x491695)[_0x8b68('0x1f')](_0x23bd52);}return null;};}function patchUpdates(_0x1a9788){return function(_0x35d055){try{jsonpatch[_0x8b68('0x26')](_0x35d055,_0x1a9788,!![]);}catch(_0x5603d4){return BPromise['reject'](_0x5603d4);}return _0x35d055[_0x8b68('0x27')]();};}function saveUpdates(_0x59cb26,_0x332202){return function(_0x30b6d0){if(_0x30b6d0){return _0x30b6d0[_0x8b68('0x28')](_0x59cb26)[_0x8b68('0x29')](function(_0x32ddc5){return _0x32ddc5;});}return null;};}function removeEntity(_0x173524,_0x59bb8a){return function(_0x1a6fe8){if(_0x1a6fe8){return _0x1a6fe8[_0x8b68('0x2a')]()['then'](function(){_0x173524[_0x8b68('0x1e')](0xcc)[_0x8b68('0x1d')]();});}};}function handleEntityNotFound(_0x240b0b,_0x5590ec){return function(_0x511ccf){if(!_0x511ccf){_0x240b0b['sendStatus'](0x194);}return _0x511ccf;};}function handleError(_0x92d186,_0x448e43){_0x448e43=_0x448e43||0x1f4;return function(_0x2ba2a3){logger['error'](_0x2ba2a3[_0x8b68('0x2b')]);if(_0x2ba2a3['name']){delete _0x2ba2a3['name'];}_0x92d186[_0x8b68('0x1e')](_0x448e43)['send'](_0x2ba2a3);};}exports[_0x8b68('0x2c')]=function(_0x3ac356,_0x48e2c8){var _0x494ce4={},_0x357635={},_0x1cd230={'count':0x0,'rows':[]};var _0x1e7c06=_[_0x8b68('0x2d')](db[_0x8b68('0x2e')][_0x8b68('0x2f')],function(_0x460c37){return{'name':_0x460c37['fieldName'],'type':_0x460c37[_0x8b68('0x30')]['key']};});_0x357635[_0x8b68('0x31')]=_[_0x8b68('0x2d')](_0x1e7c06,'name');_0x357635[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3ac356[_0x8b68('0x32')]);_0x357635['filters']=_['intersection'](_0x357635[_0x8b68('0x31')],_0x357635[_0x8b68('0x32')]);_0x494ce4[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x357635[_0x8b68('0x31')],qs[_0x8b68('0x36')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x36')]));_0x494ce4[_0x8b68('0x34')]=_0x494ce4[_0x8b68('0x34')][_0x8b68('0x37')]?_0x494ce4[_0x8b68('0x34')]:_0x357635[_0x8b68('0x31')];if(!_0x3ac356[_0x8b68('0x32')][_0x8b68('0x38')](_0x8b68('0x39'))){_0x494ce4[_0x8b68('0x22')]=qs[_0x8b68('0x22')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x22')]);_0x494ce4[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x3ac356['query']['offset']);}_0x494ce4[_0x8b68('0x3a')]=qs[_0x8b68('0x3b')](_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3b')]);_0x494ce4[_0x8b68('0x3c')]=qs[_0x8b68('0x3d')](_[_0x8b68('0x3e')](_0x3ac356[_0x8b68('0x32')],_0x357635['filters']),_0x1e7c06);if(_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3f')]){_0x494ce4[_0x8b68('0x3c')]=_[_0x8b68('0x40')](_0x494ce4[_0x8b68('0x3c')],{'$or':_[_0x8b68('0x2d')](_0x1e7c06,function(_0xff4080){if(_0xff4080[_0x8b68('0x30')]!=='VIRTUAL'){var _0x3f874c={};_0x3f874c[_0xff4080[_0x8b68('0x41')]]={'$like':'%'+_0x3ac356[_0x8b68('0x32')][_0x8b68('0x3f')]+'%'};return _0x3f874c;}})});}_0x494ce4=_[_0x8b68('0x40')]({},_0x494ce4,_0x3ac356[_0x8b68('0x42')]);var _0xa748c2={'where':_0x494ce4['where']};return db[_0x8b68('0x2e')][_0x8b68('0x23')](_0xa748c2)['then'](function(_0x14ec40){_0x1cd230[_0x8b68('0x23')]=_0x14ec40;if(_0x3ac356['query']['includeAll']){_0x494ce4['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x8b68('0x43')](_0x494ce4);})[_0x8b68('0x29')](function(_0x515815){_0x1cd230[_0x8b68('0x44')]=_0x515815;return _0x1cd230;})['then'](respondWithFilteredResult(_0x48e2c8,_0x494ce4))[_0x8b68('0x45')](handleError(_0x48e2c8,null));};exports[_0x8b68('0x46')]=function(_0x5a3193,_0x2f90d9){var _0x5ae345={'raw':![],'where':{'id':_0x5a3193['params']['id']}},_0x4a718c={};_0x4a718c[_0x8b68('0x31')]=_[_0x8b68('0x33')](db[_0x8b68('0x2e')][_0x8b68('0x2f')]);_0x4a718c['query']=_[_0x8b68('0x33')](_0x5a3193['query']);_0x4a718c[_0x8b68('0x3d')]=_[_0x8b68('0x35')](_0x4a718c['model'],_0x4a718c[_0x8b68('0x32')]);_0x5ae345[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x4a718c[_0x8b68('0x31')],qs['fields'](_0x5a3193[_0x8b68('0x32')][_0x8b68('0x36')]));_0x5ae345[_0x8b68('0x34')]=_0x5ae345[_0x8b68('0x34')][_0x8b68('0x37')]?_0x5ae345[_0x8b68('0x34')]:_0x4a718c[_0x8b68('0x31')];if(_0x5a3193[_0x8b68('0x32')][_0x8b68('0x47')]){_0x5ae345[_0x8b68('0x48')]=[{'all':!![]}];}_0x5ae345=_[_0x8b68('0x40')]({},_0x5ae345,_0x5a3193[_0x8b68('0x42')]);return db[_0x8b68('0x2e')][_0x8b68('0x49')](_0x5ae345)[_0x8b68('0x29')](handleEntityNotFound(_0x2f90d9,null))[_0x8b68('0x29')](respondWithResult(_0x2f90d9,null))['catch'](handleError(_0x2f90d9,null));};exports[_0x8b68('0x4a')]=function(_0x20681a,_0x5dd099){return db[_0x8b68('0x2e')]['create'](_0x20681a['body'],{})['then'](respondWithResult(_0x5dd099,0xc9))[_0x8b68('0x45')](handleError(_0x5dd099,null));};exports[_0x8b68('0x28')]=function(_0x34047c,_0x6da48b){if(_0x34047c['body']['id']){delete _0x34047c['body']['id'];}return db[_0x8b68('0x2e')][_0x8b68('0x49')]({'where':{'id':_0x34047c[_0x8b68('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6da48b,null))[_0x8b68('0x29')](saveUpdates(_0x34047c[_0x8b68('0x4c')],null))['then'](respondWithResult(_0x6da48b,null))[_0x8b68('0x45')](handleError(_0x6da48b,null));};exports[_0x8b68('0x2a')]=function(_0x595942,_0x18a9ae){return db[_0x8b68('0x2e')]['find']({'where':{'id':_0x595942[_0x8b68('0x4b')]['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x18a9ae,null))['then'](removeEntity(_0x18a9ae,null))['catch'](handleError(_0x18a9ae,null));};exports['getConfigurations']=function(_0x28f82d,_0x42eabd,_0x3718b2){var _0x3d4b4f={};var _0x55aad3={};var _0x5a1711;var _0x4492fd;return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x28f82d['params']['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x42eabd,null))[_0x8b68('0x29')](function(_0x3f9d34){if(_0x3f9d34){_0x5a1711=_0x3f9d34;_0x55aad3['model']=_[_0x8b68('0x33')](db['ZendeskConfiguration'][_0x8b68('0x2f')]);_0x55aad3[_0x8b68('0x32')]=_['keys'](_0x28f82d[_0x8b68('0x32')]);_0x55aad3[_0x8b68('0x3d')]=_[_0x8b68('0x35')](_0x55aad3[_0x8b68('0x31')],_0x55aad3[_0x8b68('0x32')]);_0x3d4b4f['attributes']=_[_0x8b68('0x35')](_0x55aad3[_0x8b68('0x31')],qs[_0x8b68('0x36')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x36')]));_0x3d4b4f[_0x8b68('0x34')]=_0x3d4b4f[_0x8b68('0x34')][_0x8b68('0x37')]?_0x3d4b4f['attributes']:_0x55aad3[_0x8b68('0x31')];_0x3d4b4f[_0x8b68('0x3a')]=qs[_0x8b68('0x3b')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x3b')]);_0x3d4b4f[_0x8b68('0x3c')]=qs[_0x8b68('0x3d')](_[_0x8b68('0x3e')](_0x28f82d[_0x8b68('0x32')],_0x55aad3[_0x8b68('0x3d')]));if(_0x28f82d[_0x8b68('0x32')][_0x8b68('0x3f')]){_0x3d4b4f[_0x8b68('0x3c')]=_[_0x8b68('0x40')](_0x3d4b4f[_0x8b68('0x3c')],{'$or':_[_0x8b68('0x2d')](_0x3d4b4f[_0x8b68('0x34')],function(_0x3da7b4){var _0xae90f0={};_0xae90f0[_0x3da7b4]={'$like':'%'+_0x28f82d[_0x8b68('0x32')]['filter']+'%'};return _0xae90f0;})});}_0x3d4b4f=_[_0x8b68('0x40')]({},_0x3d4b4f,_0x28f82d['options']);return _0x5a1711['getConfigurations'](_0x3d4b4f);}})[_0x8b68('0x29')](function(_0x5d2476){if(_0x5d2476){_0x4492fd=_0x5d2476[_0x8b68('0x37')];if(!_0x28f82d[_0x8b68('0x32')][_0x8b68('0x38')]('nolimit')){_0x3d4b4f[_0x8b68('0x22')]=qs[_0x8b68('0x22')](_0x28f82d[_0x8b68('0x32')][_0x8b68('0x22')]);_0x3d4b4f[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x28f82d[_0x8b68('0x32')]['offset']);}return _0x5a1711['getConfigurations'](_0x3d4b4f);}})[_0x8b68('0x29')](function(_0x4224f5){if(_0x4224f5){return _0x4224f5?{'count':_0x4492fd,'rows':_0x4224f5}:null;}})[_0x8b68('0x29')](respondWithResult(_0x42eabd,null))[_0x8b68('0x45')](handleError(_0x42eabd,null));};exports[_0x8b68('0x4e')]=function(_0x37da34,_0x2d1519,_0x314f1e){if(_0x37da34[_0x8b68('0x4c')]['id']){delete _0x37da34[_0x8b68('0x4c')]['id'];}return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x37da34[_0x8b68('0x4b')]['id']}})[_0x8b68('0x29')](handleEntityNotFound(_0x2d1519,null))[_0x8b68('0x29')](function(_0x414096){if(_0x414096){_0x37da34[_0x8b68('0x4c')][_0x8b68('0x4f')]=_0x414096['id'];_0x37da34['body']['Subjects']=integrations[_0x8b68('0x50')](_0x37da34[_0x8b68('0x4c')]['channel'],_0x37da34['body']['type']);_0x37da34[_0x8b68('0x4c')][_0x8b68('0x51')]=integrations[_0x8b68('0x52')](_0x37da34[_0x8b68('0x4c')][_0x8b68('0x53')],_0x37da34['body'][_0x8b68('0x30')]);return db[_0x8b68('0x54')]['create'](_0x37da34[_0x8b68('0x4c')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x8b68('0x51')}]});}return null;})[_0x8b68('0x29')](respondWithResult(_0x2d1519,null))[_0x8b68('0x45')](handleError(_0x2d1519,null));};exports[_0x8b68('0x55')]=function(_0x864b6b,_0x1fc24c,_0x35b22b){var _0x34456d='';return db[_0x8b68('0x2e')][_0x8b68('0x4d')]({'where':{'id':_0x864b6b['params']['id']},'attributes':['id',_0x8b68('0x56'),_0x8b68('0x57'),_0x8b68('0x58'),'authType','remoteUri']})[_0x8b68('0x29')](handleEntityNotFound(_0x1fc24c,null))[_0x8b68('0x29')](function(_0x525b41){if(_0x525b41){_0x34456d=_0x525b41[_0x8b68('0x59')];var _0x2c1c96=_0x34456d[_0x8b68('0x5a')](-0x1);if(_0x2c1c96==='/'){_0x34456d=_0x34456d[_0x8b68('0x5b')](0x0,_0x34456d['lastIndexOf'](_0x2c1c96));}var _0x96e526={'method':'GET','uri':util['format'](_0x8b68('0x5c'),_0x34456d,'ticket_fields'),'json':!![]};switch(_0x525b41[_0x8b68('0x5d')]){case _0x8b68('0x57'):_0x96e526['headers']={'Authorization':util[_0x8b68('0x5e')](_0x8b68('0x5f'),new Buffer(util[_0x8b68('0x5e')](_0x8b68('0x60'),_0x525b41[_0x8b68('0x56')],_0x525b41['password']))[_0x8b68('0x61')](_0x8b68('0x62')))};break;case _0x8b68('0x58'):_0x96e526[_0x8b68('0x63')]={'Authorization':util[_0x8b68('0x5e')]('Basic\x20%s',new Buffer(util['format'](_0x8b68('0x64'),_0x525b41['username'],_0x525b41[_0x8b68('0x58')]))[_0x8b68('0x61')](_0x8b68('0x62')))};break;default:throw new db[(_0x8b68('0x65'))][(_0x8b68('0x66'))](_0x8b68('0x67'));}return rp(_0x96e526);}})[_0x8b68('0x29')](function(_0x486be8){if(_0x486be8){var _0x3033b4=['subject',_0x8b68('0x68'),_0x8b68('0x69'),_0x8b68('0x6a')];_['remove'](_0x486be8[_0x8b68('0x6b')],function(_0x50d0b9){return _0x3033b4[_0x8b68('0x6c')](_0x50d0b9['type']);});return{'count':_0x486be8[_0x8b68('0x6b')][_0x8b68('0x37')],'rows':_[_0x8b68('0x2d')](_0x486be8['ticket_fields'],function(_0x33b775){return{'id':_0x33b775['id'],'name':_0x33b775[_0x8b68('0x6d')]>0x7?_0x33b775[_0x8b68('0x6e')]:_0x33b775[_0x8b68('0x30')],'custom':_0x33b775[_0x8b68('0x6d')]>0x7?!![]:![],'options':_0x33b775[_0x8b68('0x6f')]?_0x33b775[_0x8b68('0x6f')]:_0x33b775[_0x8b68('0x70')]?_0x33b775[_0x8b68('0x70')]:[]};})};}})['then'](respondWithResult(_0x1fc24c,null))[_0x8b68('0x45')](function(_0x3cb970){var _0x9a5bec=_0x864b6b[_0x8b68('0x32')][_0x8b68('0x71')]?0x1f4:_0x3cb970['statusCode']||0x1f4;logger[_0x8b68('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0x8b68('0x55'),_0x9a5bec,JSON[_0x8b68('0x73')](_0x3cb970));delete _0x3cb970['name'];if(_0x9a5bec===0x191){_0x9a5bec=0x190;}_0x1fc24c[_0x8b68('0x1e')](_0x9a5bec)[_0x8b68('0x74')](_0x864b6b[_0x8b68('0x32')]['test']?{'message':_0x8b68('0x75'),'statusCode':_0x3cb970[_0x8b68('0x76')]}:_0x3cb970);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index c9206aa..fb14b1e 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 _0xe6dc=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','util'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xe6dc,0x1d3));var _0xce6d=function(_0xa07cd8,_0x46b1a4){_0xa07cd8=_0xa07cd8-0x0;var _0x3af7b2=_0xe6dc[_0xa07cd8];return _0x3af7b2;};'use strict';var _=require('lodash');var util=require(_0xce6d('0x0'));var logger=require(_0xce6d('0x1'))(_0xce6d('0x2'));var moment=require(_0xce6d('0x3'));var BPromise=require(_0xce6d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce6d('0x5'));var rimraf=require(_0xce6d('0x6'));var config=require(_0xce6d('0x7'));var attributes=require(_0xce6d('0x8'));var integrations=require(_0xce6d('0x9'));module['exports']=function(_0x25e9d0,_0x41994b){return _0x25e9d0[_0xce6d('0xa')](_0xce6d('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81d8=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount'];(function(_0x3be8ac,_0x10454a){var _0x227ca1=function(_0x471067){while(--_0x471067){_0x3be8ac['push'](_0x3be8ac['shift']());}};_0x227ca1(++_0x10454a);}(_0x81d8,0x11e));var _0x881d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x81d8[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x881d('0x0'));var logger=require('../../config/logger')(_0x881d('0x1'));var moment=require(_0x881d('0x2'));var BPromise=require(_0x881d('0x3'));var rp=require(_0x881d('0x4'));var fs=require('fs');var path=require(_0x881d('0x5'));var rimraf=require(_0x881d('0x6'));var config=require(_0x881d('0x7'));var attributes=require(_0x881d('0x8'));var integrations=require(_0x881d('0x9'));module[_0x881d('0xa')]=function(_0x512e56,_0x58a2d8){return _0x512e56[_0x881d('0xb')](_0x881d('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index fc1f8d3..3219cc9 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 _0x14ae=['client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options','include','model','attributes','map','debug','ShowZendeskAccount','find','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x342085,_0x4d5690){var _0x2168d7=function(_0xbb787f){while(--_0xbb787f){_0x342085['push'](_0x342085['shift']());}};_0x2168d7(++_0x4d5690);}(_0x14ae,0x1b0));var _0xe14a=function(_0x5ca5c0,_0xf5c19a){_0x5ca5c0=_0x5ca5c0-0x0;var _0x284c5a=_0x14ae[_0x5ca5c0];return _0x284c5a;};'use strict';var _=require(_0xe14a('0x0'));var util=require(_0xe14a('0x1'));var moment=require('moment');var BPromise=require(_0xe14a('0x2'));var rs=require(_0xe14a('0x3'));var fs=require('fs');var Redis=require(_0xe14a('0x4'));var db=require(_0xe14a('0x5'))['db'];var utils=require(_0xe14a('0x6'));var logger=require('../../config/logger')(_0xe14a('0x7'));var config=require(_0xe14a('0x8'));var jayson=require(_0xe14a('0x9'));var client=jayson[_0xe14a('0xa')][_0xe14a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x549598,_0x4b7cb8,_0x46deae){return new BPromise(function(_0x1d5514,_0x4f3148){return client['request'](_0x549598,_0x46deae)[_0xe14a('0xc')](function(_0x152539){logger[_0xe14a('0xd')](_0xe14a('0xe'),_0x4b7cb8,_0xe14a('0xf'));logger['debug'](_0xe14a('0x10'),_0x4b7cb8,_0xe14a('0xf'),JSON[_0xe14a('0x11')](_0x152539));if(_0x152539[_0xe14a('0x12')]){if(_0x152539[_0xe14a('0x12')][_0xe14a('0x13')]===0x1f4){logger[_0xe14a('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x4b7cb8,_0x152539['error']['message']);return _0x4f3148(_0x152539[_0xe14a('0x12')][_0xe14a('0x14')]);}logger[_0xe14a('0x12')](_0xe14a('0xe'),_0x4b7cb8,_0x152539[_0xe14a('0x12')][_0xe14a('0x14')]);return _0x1d5514(_0x152539[_0xe14a('0x12')]['message']);}else{logger[_0xe14a('0xd')](_0xe14a('0xe'),_0x4b7cb8,_0xe14a('0xf'));_0x1d5514(_0x152539[_0xe14a('0x15')][_0xe14a('0x14')]);}})[_0xe14a('0x16')](function(_0x33e91b){logger[_0xe14a('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x4b7cb8,_0x33e91b);_0x4f3148(_0x33e91b);});});}exports[_0xe14a('0x17')]=function(_0x337fbb){var _0x45a8bf=this;return new Promise(function(_0x2f2a5e,_0x3b035d){return db[_0xe14a('0x18')]['findAll']({'raw':_0x337fbb['options']?_0x337fbb[_0xe14a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x337fbb[_0xe14a('0x19')]?_0x337fbb['options']['where']||null:null,'attributes':_0x337fbb[_0xe14a('0x19')]?_0x337fbb[_0xe14a('0x19')]['attributes']||null:null,'limit':_0x337fbb[_0xe14a('0x19')]?_0x337fbb[_0xe14a('0x19')]['limit']||null:null,'include':_0x337fbb['options']?_0x337fbb[_0xe14a('0x19')][_0xe14a('0x1a')]?_['map'](_0x337fbb[_0xe14a('0x19')][_0xe14a('0x1a')],function(_0x4a55fb){return{'model':db[_0x4a55fb[_0xe14a('0x1b')]],'as':_0x4a55fb['as'],'attributes':_0x4a55fb[_0xe14a('0x1c')],'include':_0x4a55fb[_0xe14a('0x1a')]?_[_0xe14a('0x1d')](_0x4a55fb['include'],function(_0x527a69){return{'model':db[_0x527a69[_0xe14a('0x1b')]],'as':_0x527a69['as'],'attributes':_0x527a69[_0xe14a('0x1c')],'include':_0x527a69['include']?_[_0xe14a('0x1d')](_0x527a69['include'],function(_0x2ff7e1){return{'model':db[_0x2ff7e1['model']],'as':_0x2ff7e1['as'],'attributes':_0x2ff7e1[_0xe14a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe14a('0xc')](function(_0x4029df){logger[_0xe14a('0xd')](_0xe14a('0x17'),_0x337fbb);logger[_0xe14a('0x1e')](_0xe14a('0x17'),_0x337fbb,JSON[_0xe14a('0x11')](_0x4029df));_0x2f2a5e(_0x4029df);})[_0xe14a('0x16')](function(_0x2f34d3){logger[_0xe14a('0x12')](_0xe14a('0x17'),_0x2f34d3['message'],_0x337fbb);_0x3b035d(_0x45a8bf['error'](0x1f4,_0x2f34d3['message']));});});};exports[_0xe14a('0x1f')]=function(_0x3668ac){var _0x4055ae=this;return new Promise(function(_0x21090b,_0x5e548d){return db[_0xe14a('0x18')][_0xe14a('0x20')]({'raw':_0x3668ac[_0xe14a('0x19')]?_0x3668ac[_0xe14a('0x19')][_0xe14a('0x21')]===undefined?!![]:![]:!![],'where':_0x3668ac['options']?_0x3668ac[_0xe14a('0x19')]['where']||null:null,'attributes':_0x3668ac[_0xe14a('0x19')]?_0x3668ac[_0xe14a('0x19')]['attributes']||null:null,'include':_0x3668ac[_0xe14a('0x19')]?_0x3668ac[_0xe14a('0x19')][_0xe14a('0x1a')]?_[_0xe14a('0x1d')](_0x3668ac[_0xe14a('0x19')]['include'],function(_0x2af5a6){return{'model':db[_0x2af5a6[_0xe14a('0x1b')]],'as':_0x2af5a6['as'],'attributes':_0x2af5a6['attributes'],'include':_0x2af5a6[_0xe14a('0x1a')]?_[_0xe14a('0x1d')](_0x2af5a6['include'],function(_0x472245){return{'model':db[_0x472245['model']],'as':_0x472245['as'],'attributes':_0x472245[_0xe14a('0x1c')],'include':_0x472245[_0xe14a('0x1a')]?_[_0xe14a('0x1d')](_0x472245[_0xe14a('0x1a')],function(_0x2b8d7c){return{'model':db[_0x2b8d7c[_0xe14a('0x1b')]],'as':_0x2b8d7c['as'],'attributes':_0x2b8d7c[_0xe14a('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x373610){logger['info'](_0xe14a('0x1f'),_0x3668ac);logger[_0xe14a('0x1e')]('ShowZendeskAccount',_0x3668ac,JSON['stringify'](_0x373610));_0x21090b(_0x373610);})['catch'](function(_0x4530e7){logger['error'](_0xe14a('0x1f'),_0x4530e7['message'],_0x3668ac);_0x5e548d(_0x4055ae[_0xe14a('0x12')](0x1f4,_0x4530e7[_0xe14a('0x14')]));});});}; \ No newline at end of file +var _0x8a5c=['client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','stringify','ShowZendeskAccount','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x564f04,_0x29ddcf){var _0x3753e7=function(_0x1efb32){while(--_0x1efb32){_0x564f04['push'](_0x564f04['shift']());}};_0x3753e7(++_0x29ddcf);}(_0x8a5c,0x82));var _0xc8a5=function(_0x12b4de,_0xac4ca9){_0x12b4de=_0x12b4de-0x0;var _0x3e21d1=_0x8a5c[_0x12b4de];return _0x3e21d1;};'use strict';var _=require('lodash');var util=require(_0xc8a5('0x0'));var moment=require(_0xc8a5('0x1'));var BPromise=require(_0xc8a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8a5('0x3'));var db=require(_0xc8a5('0x4'))['db'];var utils=require(_0xc8a5('0x5'));var logger=require(_0xc8a5('0x6'))(_0xc8a5('0x7'));var config=require(_0xc8a5('0x8'));var jayson=require(_0xc8a5('0x9'));var client=jayson[_0xc8a5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44e719,_0x456e59,_0x193374){return new BPromise(function(_0x190636,_0x1f92cb){return client[_0xc8a5('0xb')](_0x44e719,_0x193374)[_0xc8a5('0xc')](function(_0x4079c0){logger[_0xc8a5('0xd')](_0xc8a5('0xe'),_0x456e59,_0xc8a5('0xf'));logger[_0xc8a5('0x10')](_0xc8a5('0x11'),_0x456e59,'request\x20sent',JSON['stringify'](_0x4079c0));if(_0x4079c0[_0xc8a5('0x12')]){if(_0x4079c0[_0xc8a5('0x12')][_0xc8a5('0x13')]===0x1f4){logger[_0xc8a5('0x12')](_0xc8a5('0xe'),_0x456e59,_0x4079c0[_0xc8a5('0x12')][_0xc8a5('0x14')]);return _0x1f92cb(_0x4079c0['error'][_0xc8a5('0x14')]);}logger[_0xc8a5('0x12')](_0xc8a5('0xe'),_0x456e59,_0x4079c0[_0xc8a5('0x12')][_0xc8a5('0x14')]);return _0x190636(_0x4079c0['error']['message']);}else{logger[_0xc8a5('0xd')](_0xc8a5('0xe'),_0x456e59,_0xc8a5('0xf'));_0x190636(_0x4079c0[_0xc8a5('0x15')]['message']);}})[_0xc8a5('0x16')](function(_0x431bbf){logger[_0xc8a5('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x456e59,_0x431bbf);_0x1f92cb(_0x431bbf);});});}exports[_0xc8a5('0x17')]=function(_0x32c47a){var _0x5d1809=this;return new Promise(function(_0x4a7fed,_0x4ed446){return db[_0xc8a5('0x18')][_0xc8a5('0x19')]({'raw':_0x32c47a[_0xc8a5('0x1a')]?_0x32c47a[_0xc8a5('0x1a')][_0xc8a5('0x1b')]===undefined?!![]:![]:!![],'where':_0x32c47a[_0xc8a5('0x1a')]?_0x32c47a[_0xc8a5('0x1a')][_0xc8a5('0x1c')]||null:null,'attributes':_0x32c47a[_0xc8a5('0x1a')]?_0x32c47a[_0xc8a5('0x1a')][_0xc8a5('0x1d')]||null:null,'limit':_0x32c47a[_0xc8a5('0x1a')]?_0x32c47a['options']['limit']||null:null,'include':_0x32c47a[_0xc8a5('0x1a')]?_0x32c47a[_0xc8a5('0x1a')][_0xc8a5('0x1e')]?_[_0xc8a5('0x1f')](_0x32c47a['options']['include'],function(_0x1ab936){return{'model':db[_0x1ab936[_0xc8a5('0x20')]],'as':_0x1ab936['as'],'attributes':_0x1ab936[_0xc8a5('0x1d')],'include':_0x1ab936[_0xc8a5('0x1e')]?_[_0xc8a5('0x1f')](_0x1ab936[_0xc8a5('0x1e')],function(_0xbb30fb){return{'model':db[_0xbb30fb[_0xc8a5('0x20')]],'as':_0xbb30fb['as'],'attributes':_0xbb30fb[_0xc8a5('0x1d')],'include':_0xbb30fb[_0xc8a5('0x1e')]?_[_0xc8a5('0x1f')](_0xbb30fb['include'],function(_0x3f882a){return{'model':db[_0x3f882a[_0xc8a5('0x20')]],'as':_0x3f882a['as'],'attributes':_0x3f882a[_0xc8a5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc8a5('0xc')](function(_0x30c8c7){logger[_0xc8a5('0xd')]('GetZendeskAccount',_0x32c47a);logger['debug'](_0xc8a5('0x17'),_0x32c47a,JSON[_0xc8a5('0x21')](_0x30c8c7));_0x4a7fed(_0x30c8c7);})[_0xc8a5('0x16')](function(_0x555528){logger['error'](_0xc8a5('0x17'),_0x555528['message'],_0x32c47a);_0x4ed446(_0x5d1809[_0xc8a5('0x12')](0x1f4,_0x555528['message']));});});};exports[_0xc8a5('0x22')]=function(_0x2dddfb){var _0x37a0e7=this;return new Promise(function(_0x6a14b,_0x28ca0d){return db[_0xc8a5('0x18')]['find']({'raw':_0x2dddfb[_0xc8a5('0x1a')]?_0x2dddfb[_0xc8a5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2dddfb['options']?_0x2dddfb[_0xc8a5('0x1a')][_0xc8a5('0x1c')]||null:null,'attributes':_0x2dddfb['options']?_0x2dddfb[_0xc8a5('0x1a')][_0xc8a5('0x1d')]||null:null,'include':_0x2dddfb[_0xc8a5('0x1a')]?_0x2dddfb[_0xc8a5('0x1a')][_0xc8a5('0x1e')]?_[_0xc8a5('0x1f')](_0x2dddfb[_0xc8a5('0x1a')][_0xc8a5('0x1e')],function(_0x1b1095){return{'model':db[_0x1b1095[_0xc8a5('0x20')]],'as':_0x1b1095['as'],'attributes':_0x1b1095['attributes'],'include':_0x1b1095[_0xc8a5('0x1e')]?_[_0xc8a5('0x1f')](_0x1b1095[_0xc8a5('0x1e')],function(_0x3ec6fa){return{'model':db[_0x3ec6fa[_0xc8a5('0x20')]],'as':_0x3ec6fa['as'],'attributes':_0x3ec6fa[_0xc8a5('0x1d')],'include':_0x3ec6fa[_0xc8a5('0x1e')]?_[_0xc8a5('0x1f')](_0x3ec6fa[_0xc8a5('0x1e')],function(_0x594436){return{'model':db[_0x594436['model']],'as':_0x594436['as'],'attributes':_0x594436[_0xc8a5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52700e){logger[_0xc8a5('0xd')]('ShowZendeskAccount',_0x2dddfb);logger[_0xc8a5('0x10')](_0xc8a5('0x22'),_0x2dddfb,JSON['stringify'](_0x52700e));_0x6a14b(_0x52700e);})[_0xc8a5('0x16')](function(_0x99c008){logger[_0xc8a5('0x12')](_0xc8a5('0x22'),_0x99c008[_0xc8a5('0x14')],_0x2dddfb);_0x28ca0d(_0x37a0e7[_0xc8a5('0x12')](0x1f4,_0x99c008[_0xc8a5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 601e17a..aa9e915 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 _0x5eb8=['getTags','post','/:id/tags','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x2c486d,_0xa90c9c){var _0x20c3bf=function(_0xe82755){while(--_0xe82755){_0x2c486d['push'](_0x2c486d['shift']());}};_0x20c3bf(++_0xa90c9c);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5a7fbc,_0xa081de){_0x5a7fbc=_0x5a7fbc-0x0;var _0xcba0fc=_0x5eb8[_0x5a7fbc];return _0xcba0fc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/tags',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x15')]('/',auth[_0x85eb('0xa')](),controller['create']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);router[_0x85eb('0x18')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x19')]);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x1a')]);module[_0x85eb('0x1b')]=router; \ No newline at end of file +var _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x5b836a,_0x5cefae){var _0x42c01c=function(_0x5b8b31){while(--_0x5b8b31){_0x5b836a['push'](_0x5b836a['shift']());}};_0x42c01c(++_0x5cefae);}(_0xa571,0x107));var _0x1a57=function(_0x17f285,_0x2d5c87){_0x17f285=_0x17f285-0x0;var _0x402d9c=_0xa571[_0x17f285];return _0x402d9c;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 3b4a286..b16da00 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 _0x1f9f=['sequelize','exports','STRING'];(function(_0x1e0a4a,_0x55752e){var _0x352afd=function(_0x579bae){while(--_0x579bae){_0x1e0a4a['push'](_0x1e0a4a['shift']());}};_0x352afd(++_0x55752e);}(_0x1f9f,0xde));var _0xf1f9=function(_0xd39328,_0xc84656){_0xd39328=_0xd39328-0x0;var _0x17aa80=_0x1f9f[_0xd39328];return _0x17aa80;};'use strict';var Sequelize=require(_0xf1f9('0x0'));module[_0xf1f9('0x1')]={'name':{'type':Sequelize[_0xf1f9('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0bf1=['STRING','exports'];(function(_0x23b7e4,_0x1c9417){var _0x40d91b=function(_0x398d53){while(--_0x398d53){_0x23b7e4['push'](_0x23b7e4['shift']());}};_0x40d91b(++_0x1c9417);}(_0x0bf1,0x10b));var _0x10bf=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0bf1[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x10bf('0x0')]={'name':{'type':Sequelize[_0x10bf('0x1')]},'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 20dae38..21cac6f 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 _0xd254=['apply','reject','save','update','then','destroy','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','ZendeskField','getFields','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','limit','count'];(function(_0x4cdf9e,_0x73b17){var _0x30e8f0=function(_0x4150be){while(--_0x4150be){_0x4cdf9e['push'](_0x4cdf9e['shift']());}};_0x30e8f0(++_0x73b17);}(_0xd254,0x120));var _0x4d25=function(_0x153a99,_0x49c7cf){_0x153a99=_0x153a99-0x0;var _0x23e5db=_0xd254[_0x153a99];return _0x23e5db;};'use strict';var emlformat=require(_0x4d25('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4d25('0x1'));var jsonpatch=require(_0x4d25('0x2'));var rp=require(_0x4d25('0x3'));var moment=require(_0x4d25('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4d25('0x5'));var sox=require(_0x4d25('0x6'));var csv=require(_0x4d25('0x7'));var ejs=require(_0x4d25('0x8'));var fs=require('fs');var fs_extra=require(_0x4d25('0x9'));var _=require(_0x4d25('0xa'));var squel=require(_0x4d25('0xb'));var crypto=require('crypto');var jsforce=require(_0x4d25('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4d25('0xd'));var Papa=require(_0x4d25('0xe'));var Redis=require(_0x4d25('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4d25('0x10'));var as=require(_0x4d25('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d25('0x12'))(_0x4d25('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4d25('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x500042,_0x39c762){_0x39c762=_0x39c762||0xcc;return function(_0x47ff0f){if(_0x47ff0f){return _0x500042['sendStatus'](_0x39c762);}return _0x500042[_0x4d25('0x15')](_0x39c762)[_0x4d25('0x16')]();};}function respondWithResult(_0x49cc5b,_0x5a9011){_0x5a9011=_0x5a9011||0xc8;return function(_0x1b8802){if(_0x1b8802){return _0x49cc5b[_0x4d25('0x15')](_0x5a9011)[_0x4d25('0x17')](_0x1b8802);}};}function respondWithFilteredResult(_0x183614,_0x59c5c6){return function(_0x593d2a){if(_0x593d2a){var _0x424dae=typeof _0x59c5c6[_0x4d25('0x18')]===_0x4d25('0x19')&&typeof _0x59c5c6[_0x4d25('0x1a')]==='undefined';var _0x5122a2=_0x593d2a[_0x4d25('0x1b')];var _0x8d1ee2=_0x424dae?0x0:_0x59c5c6[_0x4d25('0x18')];var _0x465231=_0x424dae?_0x593d2a['count']:_0x59c5c6[_0x4d25('0x18')]+_0x59c5c6[_0x4d25('0x1a')];var _0x1d07b8;if(_0x465231>=_0x5122a2){_0x465231=_0x5122a2;_0x1d07b8=0xc8;}else{_0x1d07b8=0xce;}_0x183614['status'](_0x1d07b8);return _0x183614['set']('Content-Range',_0x8d1ee2+'-'+_0x465231+'/'+_0x5122a2)['json'](_0x593d2a);}return null;};}function patchUpdates(_0x720206){return function(_0x5b0133){try{jsonpatch[_0x4d25('0x1c')](_0x5b0133,_0x720206,!![]);}catch(_0x4bf152){return BPromise[_0x4d25('0x1d')](_0x4bf152);}return _0x5b0133[_0x4d25('0x1e')]();};}function saveUpdates(_0x3e1026,_0x3425b8){return function(_0x275f00){if(_0x275f00){return _0x275f00[_0x4d25('0x1f')](_0x3e1026)[_0x4d25('0x20')](function(_0x5cd56f){return _0x5cd56f;});}return null;};}function removeEntity(_0x267963,_0x14f9a7){return function(_0x4551ed){if(_0x4551ed){return _0x4551ed[_0x4d25('0x21')]()[_0x4d25('0x20')](function(){_0x267963[_0x4d25('0x15')](0xcc)[_0x4d25('0x16')]();});}};}function handleEntityNotFound(_0x55e6b1,_0x383f12){return function(_0x3d7b94){if(!_0x3d7b94){_0x55e6b1['sendStatus'](0x194);}return _0x3d7b94;};}function handleError(_0x10ef21,_0x2606a1){_0x2606a1=_0x2606a1||0x1f4;return function(_0x30ddbd){logger[_0x4d25('0x22')](_0x30ddbd['stack']);if(_0x30ddbd[_0x4d25('0x23')]){delete _0x30ddbd[_0x4d25('0x23')];}_0x10ef21[_0x4d25('0x15')](_0x2606a1)[_0x4d25('0x24')](_0x30ddbd);};}exports[_0x4d25('0x25')]=function(_0x2d1094,_0xeea0bd){var _0xdac19f={},_0x3533e0={},_0x206dff={'count':0x0,'rows':[]};var _0x2c10e5=_[_0x4d25('0x26')](db[_0x4d25('0x27')][_0x4d25('0x28')],function(_0x58d807){return{'name':_0x58d807[_0x4d25('0x29')],'type':_0x58d807[_0x4d25('0x2a')][_0x4d25('0x2b')]};});_0x3533e0['model']=_[_0x4d25('0x26')](_0x2c10e5,'name');_0x3533e0[_0x4d25('0x2c')]=_[_0x4d25('0x2d')](_0x2d1094[_0x4d25('0x2c')]);_0x3533e0[_0x4d25('0x2e')]=_['intersection'](_0x3533e0[_0x4d25('0x2f')],_0x3533e0[_0x4d25('0x2c')]);_0xdac19f[_0x4d25('0x30')]=_['intersection'](_0x3533e0['model'],qs[_0x4d25('0x31')](_0x2d1094[_0x4d25('0x2c')]['fields']));_0xdac19f['attributes']=_0xdac19f[_0x4d25('0x30')][_0x4d25('0x32')]?_0xdac19f[_0x4d25('0x30')]:_0x3533e0[_0x4d25('0x2f')];if(!_0x2d1094[_0x4d25('0x2c')][_0x4d25('0x33')](_0x4d25('0x34'))){_0xdac19f[_0x4d25('0x1a')]=qs[_0x4d25('0x1a')](_0x2d1094['query'][_0x4d25('0x1a')]);_0xdac19f[_0x4d25('0x18')]=qs[_0x4d25('0x18')](_0x2d1094[_0x4d25('0x2c')][_0x4d25('0x18')]);}_0xdac19f[_0x4d25('0x35')]=qs[_0x4d25('0x36')](_0x2d1094[_0x4d25('0x2c')][_0x4d25('0x36')]);_0xdac19f['where']=qs[_0x4d25('0x2e')](_[_0x4d25('0x37')](_0x2d1094[_0x4d25('0x2c')],_0x3533e0[_0x4d25('0x2e')]),_0x2c10e5);if(_0x2d1094[_0x4d25('0x2c')][_0x4d25('0x38')]){_0xdac19f['where']=_[_0x4d25('0x39')](_0xdac19f['where'],{'$or':_[_0x4d25('0x26')](_0x2c10e5,function(_0x432e4f){if(_0x432e4f[_0x4d25('0x2a')]!==_0x4d25('0x3a')){var _0x25f3e2={};_0x25f3e2[_0x432e4f['name']]={'$like':'%'+_0x2d1094['query'][_0x4d25('0x38')]+'%'};return _0x25f3e2;}})});}_0xdac19f=_[_0x4d25('0x39')]({},_0xdac19f,_0x2d1094[_0x4d25('0x3b')]);var _0xdf5d13={'where':_0xdac19f[_0x4d25('0x3c')]};return db[_0x4d25('0x27')][_0x4d25('0x1b')](_0xdf5d13)[_0x4d25('0x20')](function(_0x7fd5bf){_0x206dff[_0x4d25('0x1b')]=_0x7fd5bf;if(_0x2d1094[_0x4d25('0x2c')][_0x4d25('0x3d')]){_0xdac19f[_0x4d25('0x3e')]=[{'all':!![]}];}return db[_0x4d25('0x27')][_0x4d25('0x3f')](_0xdac19f);})['then'](function(_0x233f32){_0x206dff[_0x4d25('0x40')]=_0x233f32;return _0x206dff;})[_0x4d25('0x20')](respondWithFilteredResult(_0xeea0bd,_0xdac19f))[_0x4d25('0x41')](handleError(_0xeea0bd,null));};exports['show']=function(_0x894d45,_0x47e580){var _0x2b5d31={'raw':![],'where':{'id':_0x894d45[_0x4d25('0x42')]['id']}},_0x3e858e={};_0x3e858e[_0x4d25('0x2f')]=_['keys'](db[_0x4d25('0x27')][_0x4d25('0x28')]);_0x3e858e['query']=_['keys'](_0x894d45[_0x4d25('0x2c')]);_0x3e858e[_0x4d25('0x2e')]=_[_0x4d25('0x43')](_0x3e858e[_0x4d25('0x2f')],_0x3e858e[_0x4d25('0x2c')]);_0x2b5d31[_0x4d25('0x30')]=_['intersection'](_0x3e858e[_0x4d25('0x2f')],qs[_0x4d25('0x31')](_0x894d45[_0x4d25('0x2c')][_0x4d25('0x31')]));_0x2b5d31[_0x4d25('0x30')]=_0x2b5d31[_0x4d25('0x30')][_0x4d25('0x32')]?_0x2b5d31[_0x4d25('0x30')]:_0x3e858e[_0x4d25('0x2f')];if(_0x894d45[_0x4d25('0x2c')][_0x4d25('0x3d')]){_0x2b5d31['include']=[{'all':!![]}];}_0x2b5d31=_['merge']({},_0x2b5d31,_0x894d45[_0x4d25('0x3b')]);return db[_0x4d25('0x27')][_0x4d25('0x44')](_0x2b5d31)['then'](handleEntityNotFound(_0x47e580,null))['then'](respondWithResult(_0x47e580,null))['catch'](handleError(_0x47e580,null));};exports[_0x4d25('0x45')]=function(_0x367e96,_0x5d6ee7){return db[_0x4d25('0x27')][_0x4d25('0x45')](_0x367e96['body'],{})[_0x4d25('0x20')](respondWithResult(_0x5d6ee7,0xc9))[_0x4d25('0x41')](handleError(_0x5d6ee7,null));};exports[_0x4d25('0x1f')]=function(_0x2d898c,_0x2d227e){if(_0x2d898c[_0x4d25('0x46')]['id']){delete _0x2d898c[_0x4d25('0x46')]['id'];}return db[_0x4d25('0x27')]['find']({'where':{'id':_0x2d898c[_0x4d25('0x42')]['id']}})[_0x4d25('0x20')](handleEntityNotFound(_0x2d227e,null))['then'](saveUpdates(_0x2d898c[_0x4d25('0x46')],null))[_0x4d25('0x20')](respondWithResult(_0x2d227e,null))[_0x4d25('0x41')](handleError(_0x2d227e,null));};exports['destroy']=function(_0x329539,_0x120759){return db[_0x4d25('0x27')][_0x4d25('0x44')]({'where':{'id':_0x329539[_0x4d25('0x42')]['id']}})[_0x4d25('0x20')](handleEntityNotFound(_0x120759,null))[_0x4d25('0x20')](removeEntity(_0x120759,null))[_0x4d25('0x41')](handleError(_0x120759,null));};exports['getFields']=function(_0x1a3755,_0x5b56a1,_0x149c1f){var _0x5bf6f2={};var _0x5e46d5={};var _0xdbd8d6;var _0x12b16d;return db[_0x4d25('0x27')]['findOne']({'where':{'id':_0x1a3755[_0x4d25('0x42')]['id']}})[_0x4d25('0x20')](handleEntityNotFound(_0x5b56a1,null))[_0x4d25('0x20')](function(_0x30a0fb){if(_0x30a0fb){_0xdbd8d6=_0x30a0fb;_0x5e46d5[_0x4d25('0x2f')]=_['keys'](db[_0x4d25('0x47')][_0x4d25('0x28')]);_0x5e46d5[_0x4d25('0x2c')]=_[_0x4d25('0x2d')](_0x1a3755[_0x4d25('0x2c')]);_0x5e46d5[_0x4d25('0x2e')]=_['intersection'](_0x5e46d5['model'],_0x5e46d5['query']);_0x5bf6f2['attributes']=_[_0x4d25('0x43')](_0x5e46d5['model'],qs['fields'](_0x1a3755[_0x4d25('0x2c')][_0x4d25('0x31')]));_0x5bf6f2[_0x4d25('0x30')]=_0x5bf6f2[_0x4d25('0x30')][_0x4d25('0x32')]?_0x5bf6f2['attributes']:_0x5e46d5[_0x4d25('0x2f')];_0x5bf6f2[_0x4d25('0x35')]=qs[_0x4d25('0x36')](_0x1a3755['query'][_0x4d25('0x36')]);_0x5bf6f2[_0x4d25('0x3c')]=qs[_0x4d25('0x2e')](_[_0x4d25('0x37')](_0x1a3755[_0x4d25('0x2c')],_0x5e46d5[_0x4d25('0x2e')]));if(_0x1a3755[_0x4d25('0x2c')][_0x4d25('0x38')]){_0x5bf6f2['where']=_[_0x4d25('0x39')](_0x5bf6f2['where'],{'$or':_[_0x4d25('0x26')](_0x5bf6f2[_0x4d25('0x30')],function(_0x8dfe7e){var _0x408dc3={};_0x408dc3[_0x8dfe7e]={'$like':'%'+_0x1a3755[_0x4d25('0x2c')][_0x4d25('0x38')]+'%'};return _0x408dc3;})});}_0x5bf6f2=_[_0x4d25('0x39')]({},_0x5bf6f2,_0x1a3755[_0x4d25('0x3b')]);return _0xdbd8d6[_0x4d25('0x48')](_0x5bf6f2);}})[_0x4d25('0x20')](function(_0x3f0f2e){if(_0x3f0f2e){_0x12b16d=_0x3f0f2e[_0x4d25('0x32')];if(!_0x1a3755[_0x4d25('0x2c')][_0x4d25('0x33')](_0x4d25('0x34'))){_0x5bf6f2['limit']=qs[_0x4d25('0x1a')](_0x1a3755[_0x4d25('0x2c')][_0x4d25('0x1a')]);_0x5bf6f2['offset']=qs[_0x4d25('0x18')](_0x1a3755[_0x4d25('0x2c')]['offset']);}return _0xdbd8d6[_0x4d25('0x48')](_0x5bf6f2);}})[_0x4d25('0x20')](function(_0x3f974c){if(_0x3f974c){return _0x3f974c?{'count':_0x12b16d,'rows':_0x3f974c}:null;}})[_0x4d25('0x20')](respondWithResult(_0x5b56a1,null))[_0x4d25('0x41')](handleError(_0x5b56a1,null));};exports[_0x4d25('0x49')]=function(_0x1cfb12,_0x11c59c,_0x574ad9){var _0x16d3cf={};var _0x561aa2={};var _0x1e3521;var _0x13e6e1;return db['ZendeskConfiguration'][_0x4d25('0x4a')]({'where':{'id':_0x1cfb12[_0x4d25('0x42')]['id']}})[_0x4d25('0x20')](handleEntityNotFound(_0x11c59c,null))['then'](function(_0x5cb6c0){if(_0x5cb6c0){_0x1e3521=_0x5cb6c0;_0x561aa2['model']=_[_0x4d25('0x2d')](db[_0x4d25('0x47')][_0x4d25('0x28')]);_0x561aa2['query']=_[_0x4d25('0x2d')](_0x1cfb12[_0x4d25('0x2c')]);_0x561aa2[_0x4d25('0x2e')]=_[_0x4d25('0x43')](_0x561aa2['model'],_0x561aa2[_0x4d25('0x2c')]);_0x16d3cf['attributes']=_['intersection'](_0x561aa2['model'],qs[_0x4d25('0x31')](_0x1cfb12['query'][_0x4d25('0x31')]));_0x16d3cf['attributes']=_0x16d3cf['attributes'][_0x4d25('0x32')]?_0x16d3cf[_0x4d25('0x30')]:_0x561aa2[_0x4d25('0x2f')];_0x16d3cf[_0x4d25('0x35')]=qs['sort'](_0x1cfb12[_0x4d25('0x2c')]['sort']);_0x16d3cf[_0x4d25('0x3c')]=qs[_0x4d25('0x2e')](_['pick'](_0x1cfb12[_0x4d25('0x2c')],_0x561aa2['filters']));if(_0x1cfb12[_0x4d25('0x2c')]['filter']){_0x16d3cf[_0x4d25('0x3c')]=_[_0x4d25('0x39')](_0x16d3cf[_0x4d25('0x3c')],{'$or':_[_0x4d25('0x26')](_0x16d3cf['attributes'],function(_0x31dc4a){var _0x2ceb7e={};_0x2ceb7e[_0x31dc4a]={'$like':'%'+_0x1cfb12[_0x4d25('0x2c')][_0x4d25('0x38')]+'%'};return _0x2ceb7e;})});}_0x16d3cf=_['merge']({},_0x16d3cf,_0x1cfb12[_0x4d25('0x3b')]);return _0x1e3521[_0x4d25('0x49')](_0x16d3cf);}})['then'](function(_0x32e463){if(_0x32e463){_0x13e6e1=_0x32e463[_0x4d25('0x32')];if(!_0x1cfb12[_0x4d25('0x2c')][_0x4d25('0x33')](_0x4d25('0x34'))){_0x16d3cf[_0x4d25('0x1a')]=qs['limit'](_0x1cfb12['query']['limit']);_0x16d3cf[_0x4d25('0x18')]=qs[_0x4d25('0x18')](_0x1cfb12['query']['offset']);}return _0x1e3521['getSubjects'](_0x16d3cf);}})[_0x4d25('0x20')](function(_0x262189){if(_0x262189){return _0x262189?{'count':_0x13e6e1,'rows':_0x262189}:null;}})['then'](respondWithResult(_0x11c59c,null))[_0x4d25('0x41')](handleError(_0x11c59c,null));};exports[_0x4d25('0x4b')]=function(_0x1055e9,_0x16b620,_0x4d7ea4){var _0xddd2b6={};var _0x803f00={};var _0x5318d5;var _0x282761;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1055e9[_0x4d25('0x42')]['id']}})['then'](handleEntityNotFound(_0x16b620,null))['then'](function(_0x5dbe44){if(_0x5dbe44){_0x5318d5=_0x5dbe44;_0x803f00[_0x4d25('0x2f')]=_[_0x4d25('0x2d')](db[_0x4d25('0x47')][_0x4d25('0x28')]);_0x803f00[_0x4d25('0x2c')]=_[_0x4d25('0x2d')](_0x1055e9[_0x4d25('0x2c')]);_0x803f00['filters']=_[_0x4d25('0x43')](_0x803f00['model'],_0x803f00['query']);_0xddd2b6[_0x4d25('0x30')]=_[_0x4d25('0x43')](_0x803f00[_0x4d25('0x2f')],qs[_0x4d25('0x31')](_0x1055e9[_0x4d25('0x2c')][_0x4d25('0x31')]));_0xddd2b6['attributes']=_0xddd2b6['attributes'][_0x4d25('0x32')]?_0xddd2b6[_0x4d25('0x30')]:_0x803f00[_0x4d25('0x2f')];_0xddd2b6[_0x4d25('0x35')]=qs[_0x4d25('0x36')](_0x1055e9[_0x4d25('0x2c')][_0x4d25('0x36')]);_0xddd2b6['where']=qs[_0x4d25('0x2e')](_[_0x4d25('0x37')](_0x1055e9['query'],_0x803f00[_0x4d25('0x2e')]));if(_0x1055e9[_0x4d25('0x2c')][_0x4d25('0x38')]){_0xddd2b6[_0x4d25('0x3c')]=_[_0x4d25('0x39')](_0xddd2b6['where'],{'$or':_[_0x4d25('0x26')](_0xddd2b6[_0x4d25('0x30')],function(_0x266eb1){var _0x11502b={};_0x11502b[_0x266eb1]={'$like':'%'+_0x1055e9[_0x4d25('0x2c')]['filter']+'%'};return _0x11502b;})});}_0xddd2b6=_[_0x4d25('0x39')]({},_0xddd2b6,_0x1055e9[_0x4d25('0x3b')]);return _0x5318d5[_0x4d25('0x4b')](_0xddd2b6);}})[_0x4d25('0x20')](function(_0x39a114){if(_0x39a114){_0x282761=_0x39a114[_0x4d25('0x32')];if(!_0x1055e9['query'][_0x4d25('0x33')]('nolimit')){_0xddd2b6[_0x4d25('0x1a')]=qs[_0x4d25('0x1a')](_0x1055e9[_0x4d25('0x2c')][_0x4d25('0x1a')]);_0xddd2b6['offset']=qs[_0x4d25('0x18')](_0x1055e9[_0x4d25('0x2c')][_0x4d25('0x18')]);}return _0x5318d5['getDescriptions'](_0xddd2b6);}})['then'](function(_0x1a43cb){if(_0x1a43cb){return _0x1a43cb?{'count':_0x282761,'rows':_0x1a43cb}:null;}})[_0x4d25('0x20')](respondWithResult(_0x16b620,null))['catch'](handleError(_0x16b620,null));};exports[_0x4d25('0x4c')]=function(_0x286130,_0xc77d76,_0x185934){var _0x4d4b4e={};var _0x59e1c7={};var _0x3e56b5;var _0x3b2a36;return db[_0x4d25('0x27')][_0x4d25('0x4a')]({'where':{'id':_0x286130['params']['id']}})['then'](handleEntityNotFound(_0xc77d76,null))['then'](function(_0xe2f3d7){if(_0xe2f3d7){_0x3e56b5=_0xe2f3d7;_0x59e1c7[_0x4d25('0x2f')]=_[_0x4d25('0x2d')](db[_0x4d25('0x4d')]['rawAttributes']);_0x59e1c7[_0x4d25('0x2c')]=_[_0x4d25('0x2d')](_0x286130[_0x4d25('0x2c')]);_0x59e1c7[_0x4d25('0x2e')]=_[_0x4d25('0x43')](_0x59e1c7['model'],_0x59e1c7[_0x4d25('0x2c')]);_0x4d4b4e[_0x4d25('0x30')]=_[_0x4d25('0x43')](_0x59e1c7[_0x4d25('0x2f')],qs[_0x4d25('0x31')](_0x286130[_0x4d25('0x2c')][_0x4d25('0x31')]));_0x4d4b4e[_0x4d25('0x30')]=_0x4d4b4e[_0x4d25('0x30')][_0x4d25('0x32')]?_0x4d4b4e['attributes']:_0x59e1c7[_0x4d25('0x2f')];_0x4d4b4e[_0x4d25('0x35')]=qs[_0x4d25('0x36')](_0x286130[_0x4d25('0x2c')][_0x4d25('0x36')]);_0x4d4b4e[_0x4d25('0x3c')]=qs['filters'](_[_0x4d25('0x37')](_0x286130[_0x4d25('0x2c')],_0x59e1c7[_0x4d25('0x2e')]));if(_0x286130[_0x4d25('0x2c')][_0x4d25('0x38')]){_0x4d4b4e[_0x4d25('0x3c')]=_[_0x4d25('0x39')](_0x4d4b4e[_0x4d25('0x3c')],{'$or':_['map'](_0x4d4b4e[_0x4d25('0x30')],function(_0x2e4e94){var _0x4ca668={};_0x4ca668[_0x2e4e94]={'$like':'%'+_0x286130[_0x4d25('0x2c')]['filter']+'%'};return _0x4ca668;})});}_0x4d4b4e=_[_0x4d25('0x39')]({},_0x4d4b4e,_0x286130[_0x4d25('0x3b')]);return _0x3e56b5[_0x4d25('0x4c')](_0x4d4b4e);}})['then'](function(_0x3accea){if(_0x3accea){_0x3b2a36=_0x3accea[_0x4d25('0x32')];if(!_0x286130[_0x4d25('0x2c')][_0x4d25('0x33')]('nolimit')){_0x4d4b4e[_0x4d25('0x1a')]=qs[_0x4d25('0x1a')](_0x286130['query'][_0x4d25('0x1a')]);_0x4d4b4e[_0x4d25('0x18')]=qs['offset'](_0x286130[_0x4d25('0x2c')]['offset']);}return _0x3e56b5[_0x4d25('0x4c')](_0x4d4b4e);}})[_0x4d25('0x20')](function(_0x2403f3){if(_0x2403f3){return _0x2403f3?{'count':_0x3b2a36,'rows':_0x2403f3}:null;}})[_0x4d25('0x20')](respondWithResult(_0xc77d76,null))[_0x4d25('0x41')](handleError(_0xc77d76,null));};exports[_0x4d25('0x4e')]=function(_0x1f5568,_0x22be1e,_0x3f9579){if(_0x1f5568['body']['id']){delete _0x1f5568[_0x4d25('0x46')]['id'];}return db['ZendeskConfiguration'][_0x4d25('0x4a')]({'where':{'id':_0x1f5568[_0x4d25('0x42')]['id']}})['then'](handleEntityNotFound(_0x22be1e,null))[_0x4d25('0x20')](function(_0xb8f2ca){if(_0xb8f2ca){return _0xb8f2ca[_0x4d25('0x4e')](_0x1f5568[_0x4d25('0x46')]['ids']||[]);}return null;})['then'](respondWithResult(_0x22be1e,null))[_0x4d25('0x41')](handleError(_0x22be1e,null));}; \ No newline at end of file +var _0x7a30=['json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','ZendeskConfiguration','rawAttributes','length','options','create','body','find','findOne','ZendeskField','sort','pick','nolimit','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end'];(function(_0x50edfa,_0x589b10){var _0x27d98a=function(_0x1f2280){while(--_0x1f2280){_0x50edfa['push'](_0x50edfa['shift']());}};_0x27d98a(++_0x589b10);}(_0x7a30,0x8e));var _0x07a3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7a30[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x07a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x07a3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x07a3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x07a3('0x3'));var util=require(_0x07a3('0x4'));var path=require(_0x07a3('0x5'));var sox=require(_0x07a3('0x6'));var csv=require(_0x07a3('0x7'));var ejs=require(_0x07a3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x07a3('0x9'));var squel=require(_0x07a3('0xa'));var crypto=require(_0x07a3('0xb'));var jsforce=require(_0x07a3('0xc'));var deskjs=require(_0x07a3('0xd'));var toCsv=require(_0x07a3('0x7'));var querystring=require(_0x07a3('0xe'));var Papa=require(_0x07a3('0xf'));var Redis=require(_0x07a3('0x10'));var authService=require(_0x07a3('0x11'));var qs=require(_0x07a3('0x12'));var as=require(_0x07a3('0x13'));var hardwareService=require(_0x07a3('0x14'));var logger=require(_0x07a3('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x07a3('0x16'))['db'];function respondWithStatusCode(_0x366cef,_0xb3e610){_0xb3e610=_0xb3e610||0xcc;return function(_0x35d4ec){if(_0x35d4ec){return _0x366cef[_0x07a3('0x17')](_0xb3e610);}return _0x366cef[_0x07a3('0x18')](_0xb3e610)[_0x07a3('0x19')]();};}function respondWithResult(_0x9b8ab0,_0x17e72c){_0x17e72c=_0x17e72c||0xc8;return function(_0x4b12ec){if(_0x4b12ec){return _0x9b8ab0[_0x07a3('0x18')](_0x17e72c)[_0x07a3('0x1a')](_0x4b12ec);}};}function respondWithFilteredResult(_0x3f09f0,_0xef8c23){return function(_0x2b7143){if(_0x2b7143){var _0x2fa440=typeof _0xef8c23[_0x07a3('0x1b')]===_0x07a3('0x1c')&&typeof _0xef8c23[_0x07a3('0x1d')]==='undefined';var _0x5eaae8=_0x2b7143['count'];var _0x3bb0e3=_0x2fa440?0x0:_0xef8c23['offset'];var _0x3a075d=_0x2fa440?_0x2b7143['count']:_0xef8c23['offset']+_0xef8c23[_0x07a3('0x1d')];var _0x1e3f72;if(_0x3a075d>=_0x5eaae8){_0x3a075d=_0x5eaae8;_0x1e3f72=0xc8;}else{_0x1e3f72=0xce;}_0x3f09f0[_0x07a3('0x18')](_0x1e3f72);return _0x3f09f0[_0x07a3('0x1e')](_0x07a3('0x1f'),_0x3bb0e3+'-'+_0x3a075d+'/'+_0x5eaae8)[_0x07a3('0x1a')](_0x2b7143);}return null;};}function patchUpdates(_0x412460){return function(_0x405061){try{jsonpatch[_0x07a3('0x20')](_0x405061,_0x412460,!![]);}catch(_0x4f3472){return BPromise[_0x07a3('0x21')](_0x4f3472);}return _0x405061[_0x07a3('0x22')]();};}function saveUpdates(_0x266a39,_0x2b5f24){return function(_0x5544a1){if(_0x5544a1){return _0x5544a1[_0x07a3('0x23')](_0x266a39)[_0x07a3('0x24')](function(_0x58a618){return _0x58a618;});}return null;};}function removeEntity(_0x3f8c16,_0x35a75f){return function(_0x5e64a1){if(_0x5e64a1){return _0x5e64a1[_0x07a3('0x25')]()[_0x07a3('0x24')](function(){_0x3f8c16['status'](0xcc)[_0x07a3('0x19')]();});}};}function handleEntityNotFound(_0x5ac2c8,_0x5375bd){return function(_0x2aab21){if(!_0x2aab21){_0x5ac2c8[_0x07a3('0x17')](0x194);}return _0x2aab21;};}function handleError(_0x79d1a0,_0x3212e0){_0x3212e0=_0x3212e0||0x1f4;return function(_0x19b639){logger[_0x07a3('0x26')](_0x19b639[_0x07a3('0x27')]);if(_0x19b639[_0x07a3('0x28')]){delete _0x19b639[_0x07a3('0x28')];}_0x79d1a0[_0x07a3('0x18')](_0x3212e0)[_0x07a3('0x29')](_0x19b639);};}exports['index']=function(_0x1d1972,_0x437175){var _0x22380d={},_0x2bc058={},_0x2c7732={'count':0x0,'rows':[]};var _0x301a28=_[_0x07a3('0x2a')](db['ZendeskConfiguration']['rawAttributes'],function(_0x2b4218){return{'name':_0x2b4218[_0x07a3('0x2b')],'type':_0x2b4218[_0x07a3('0x2c')]['key']};});_0x2bc058[_0x07a3('0x2d')]=_[_0x07a3('0x2a')](_0x301a28,_0x07a3('0x28'));_0x2bc058[_0x07a3('0x2e')]=_[_0x07a3('0x2f')](_0x1d1972['query']);_0x2bc058[_0x07a3('0x30')]=_[_0x07a3('0x31')](_0x2bc058['model'],_0x2bc058[_0x07a3('0x2e')]);_0x22380d['attributes']=_[_0x07a3('0x31')](_0x2bc058['model'],qs[_0x07a3('0x32')](_0x1d1972[_0x07a3('0x2e')][_0x07a3('0x32')]));_0x22380d[_0x07a3('0x33')]=_0x22380d[_0x07a3('0x33')]['length']?_0x22380d[_0x07a3('0x33')]:_0x2bc058[_0x07a3('0x2d')];if(!_0x1d1972['query'][_0x07a3('0x34')]('nolimit')){_0x22380d['limit']=qs[_0x07a3('0x1d')](_0x1d1972['query'][_0x07a3('0x1d')]);_0x22380d[_0x07a3('0x1b')]=qs[_0x07a3('0x1b')](_0x1d1972[_0x07a3('0x2e')][_0x07a3('0x1b')]);}_0x22380d[_0x07a3('0x35')]=qs['sort'](_0x1d1972[_0x07a3('0x2e')]['sort']);_0x22380d[_0x07a3('0x36')]=qs[_0x07a3('0x30')](_['pick'](_0x1d1972['query'],_0x2bc058['filters']),_0x301a28);if(_0x1d1972[_0x07a3('0x2e')][_0x07a3('0x37')]){_0x22380d['where']=_[_0x07a3('0x38')](_0x22380d[_0x07a3('0x36')],{'$or':_[_0x07a3('0x2a')](_0x301a28,function(_0x1e2dff){if(_0x1e2dff[_0x07a3('0x2c')]!==_0x07a3('0x39')){var _0x525acf={};_0x525acf[_0x1e2dff[_0x07a3('0x28')]]={'$like':'%'+_0x1d1972['query'][_0x07a3('0x37')]+'%'};return _0x525acf;}})});}_0x22380d=_[_0x07a3('0x38')]({},_0x22380d,_0x1d1972['options']);var _0x140498={'where':_0x22380d['where']};return db['ZendeskConfiguration'][_0x07a3('0x3a')](_0x140498)[_0x07a3('0x24')](function(_0xd54229){_0x2c7732[_0x07a3('0x3a')]=_0xd54229;if(_0x1d1972[_0x07a3('0x2e')][_0x07a3('0x3b')]){_0x22380d[_0x07a3('0x3c')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x07a3('0x3d')](_0x22380d);})['then'](function(_0x15d476){_0x2c7732[_0x07a3('0x3e')]=_0x15d476;return _0x2c7732;})[_0x07a3('0x24')](respondWithFilteredResult(_0x437175,_0x22380d))[_0x07a3('0x3f')](handleError(_0x437175,null));};exports['show']=function(_0x5a4fe3,_0x207ef9){var _0x331de8={'raw':![],'where':{'id':_0x5a4fe3[_0x07a3('0x40')]['id']}},_0x5e8b36={};_0x5e8b36['model']=_[_0x07a3('0x2f')](db[_0x07a3('0x41')][_0x07a3('0x42')]);_0x5e8b36['query']=_[_0x07a3('0x2f')](_0x5a4fe3[_0x07a3('0x2e')]);_0x5e8b36[_0x07a3('0x30')]=_['intersection'](_0x5e8b36['model'],_0x5e8b36['query']);_0x331de8[_0x07a3('0x33')]=_[_0x07a3('0x31')](_0x5e8b36[_0x07a3('0x2d')],qs[_0x07a3('0x32')](_0x5a4fe3[_0x07a3('0x2e')][_0x07a3('0x32')]));_0x331de8[_0x07a3('0x33')]=_0x331de8[_0x07a3('0x33')][_0x07a3('0x43')]?_0x331de8[_0x07a3('0x33')]:_0x5e8b36[_0x07a3('0x2d')];if(_0x5a4fe3[_0x07a3('0x2e')]['includeAll']){_0x331de8[_0x07a3('0x3c')]=[{'all':!![]}];}_0x331de8=_[_0x07a3('0x38')]({},_0x331de8,_0x5a4fe3[_0x07a3('0x44')]);return db[_0x07a3('0x41')]['find'](_0x331de8)[_0x07a3('0x24')](handleEntityNotFound(_0x207ef9,null))[_0x07a3('0x24')](respondWithResult(_0x207ef9,null))['catch'](handleError(_0x207ef9,null));};exports[_0x07a3('0x45')]=function(_0x2bd08d,_0x354e3b){return db[_0x07a3('0x41')][_0x07a3('0x45')](_0x2bd08d[_0x07a3('0x46')],{})[_0x07a3('0x24')](respondWithResult(_0x354e3b,0xc9))[_0x07a3('0x3f')](handleError(_0x354e3b,null));};exports[_0x07a3('0x23')]=function(_0x12ff70,_0x16dd38){if(_0x12ff70[_0x07a3('0x46')]['id']){delete _0x12ff70[_0x07a3('0x46')]['id'];}return db[_0x07a3('0x41')][_0x07a3('0x47')]({'where':{'id':_0x12ff70[_0x07a3('0x40')]['id']}})[_0x07a3('0x24')](handleEntityNotFound(_0x16dd38,null))[_0x07a3('0x24')](saveUpdates(_0x12ff70[_0x07a3('0x46')],null))['then'](respondWithResult(_0x16dd38,null))[_0x07a3('0x3f')](handleError(_0x16dd38,null));};exports[_0x07a3('0x25')]=function(_0xb861e,_0x191f7a){return db[_0x07a3('0x41')]['find']({'where':{'id':_0xb861e[_0x07a3('0x40')]['id']}})[_0x07a3('0x24')](handleEntityNotFound(_0x191f7a,null))[_0x07a3('0x24')](removeEntity(_0x191f7a,null))[_0x07a3('0x3f')](handleError(_0x191f7a,null));};exports['getFields']=function(_0x3cd7ef,_0x268ac0,_0x247b04){var _0x57702a={};var _0x4eb0bb={};var _0x122306;var _0x551ac5;return db[_0x07a3('0x41')][_0x07a3('0x48')]({'where':{'id':_0x3cd7ef[_0x07a3('0x40')]['id']}})[_0x07a3('0x24')](handleEntityNotFound(_0x268ac0,null))[_0x07a3('0x24')](function(_0xb1e449){if(_0xb1e449){_0x122306=_0xb1e449;_0x4eb0bb[_0x07a3('0x2d')]=_[_0x07a3('0x2f')](db[_0x07a3('0x49')][_0x07a3('0x42')]);_0x4eb0bb['query']=_[_0x07a3('0x2f')](_0x3cd7ef[_0x07a3('0x2e')]);_0x4eb0bb['filters']=_[_0x07a3('0x31')](_0x4eb0bb['model'],_0x4eb0bb[_0x07a3('0x2e')]);_0x57702a[_0x07a3('0x33')]=_[_0x07a3('0x31')](_0x4eb0bb[_0x07a3('0x2d')],qs[_0x07a3('0x32')](_0x3cd7ef[_0x07a3('0x2e')]['fields']));_0x57702a['attributes']=_0x57702a[_0x07a3('0x33')][_0x07a3('0x43')]?_0x57702a[_0x07a3('0x33')]:_0x4eb0bb[_0x07a3('0x2d')];_0x57702a[_0x07a3('0x35')]=qs[_0x07a3('0x4a')](_0x3cd7ef[_0x07a3('0x2e')][_0x07a3('0x4a')]);_0x57702a[_0x07a3('0x36')]=qs['filters'](_[_0x07a3('0x4b')](_0x3cd7ef[_0x07a3('0x2e')],_0x4eb0bb['filters']));if(_0x3cd7ef[_0x07a3('0x2e')][_0x07a3('0x37')]){_0x57702a['where']=_['merge'](_0x57702a[_0x07a3('0x36')],{'$or':_[_0x07a3('0x2a')](_0x57702a[_0x07a3('0x33')],function(_0x109b57){var _0x166427={};_0x166427[_0x109b57]={'$like':'%'+_0x3cd7ef[_0x07a3('0x2e')][_0x07a3('0x37')]+'%'};return _0x166427;})});}_0x57702a=_[_0x07a3('0x38')]({},_0x57702a,_0x3cd7ef[_0x07a3('0x44')]);return _0x122306['getFields'](_0x57702a);}})[_0x07a3('0x24')](function(_0x524f16){if(_0x524f16){_0x551ac5=_0x524f16['length'];if(!_0x3cd7ef[_0x07a3('0x2e')]['hasOwnProperty'](_0x07a3('0x4c'))){_0x57702a['limit']=qs['limit'](_0x3cd7ef[_0x07a3('0x2e')][_0x07a3('0x1d')]);_0x57702a[_0x07a3('0x1b')]=qs[_0x07a3('0x1b')](_0x3cd7ef[_0x07a3('0x2e')][_0x07a3('0x1b')]);}return _0x122306[_0x07a3('0x4d')](_0x57702a);}})[_0x07a3('0x24')](function(_0x5d6056){if(_0x5d6056){return _0x5d6056?{'count':_0x551ac5,'rows':_0x5d6056}:null;}})[_0x07a3('0x24')](respondWithResult(_0x268ac0,null))[_0x07a3('0x3f')](handleError(_0x268ac0,null));};exports[_0x07a3('0x4e')]=function(_0x27197f,_0x26d597,_0x248f1e){var _0x21f917={};var _0x2e505a={};var _0x4cf4f4;var _0x41c7b5;return db[_0x07a3('0x41')][_0x07a3('0x48')]({'where':{'id':_0x27197f[_0x07a3('0x40')]['id']}})[_0x07a3('0x24')](handleEntityNotFound(_0x26d597,null))[_0x07a3('0x24')](function(_0x4eced4){if(_0x4eced4){_0x4cf4f4=_0x4eced4;_0x2e505a[_0x07a3('0x2d')]=_['keys'](db[_0x07a3('0x49')]['rawAttributes']);_0x2e505a[_0x07a3('0x2e')]=_[_0x07a3('0x2f')](_0x27197f[_0x07a3('0x2e')]);_0x2e505a[_0x07a3('0x30')]=_[_0x07a3('0x31')](_0x2e505a[_0x07a3('0x2d')],_0x2e505a[_0x07a3('0x2e')]);_0x21f917['attributes']=_[_0x07a3('0x31')](_0x2e505a[_0x07a3('0x2d')],qs[_0x07a3('0x32')](_0x27197f[_0x07a3('0x2e')][_0x07a3('0x32')]));_0x21f917['attributes']=_0x21f917[_0x07a3('0x33')][_0x07a3('0x43')]?_0x21f917[_0x07a3('0x33')]:_0x2e505a[_0x07a3('0x2d')];_0x21f917['order']=qs[_0x07a3('0x4a')](_0x27197f[_0x07a3('0x2e')][_0x07a3('0x4a')]);_0x21f917[_0x07a3('0x36')]=qs['filters'](_[_0x07a3('0x4b')](_0x27197f['query'],_0x2e505a['filters']));if(_0x27197f['query'][_0x07a3('0x37')]){_0x21f917[_0x07a3('0x36')]=_[_0x07a3('0x38')](_0x21f917[_0x07a3('0x36')],{'$or':_[_0x07a3('0x2a')](_0x21f917[_0x07a3('0x33')],function(_0x4d4e96){var _0xaa20cc={};_0xaa20cc[_0x4d4e96]={'$like':'%'+_0x27197f[_0x07a3('0x2e')][_0x07a3('0x37')]+'%'};return _0xaa20cc;})});}_0x21f917=_[_0x07a3('0x38')]({},_0x21f917,_0x27197f['options']);return _0x4cf4f4['getSubjects'](_0x21f917);}})[_0x07a3('0x24')](function(_0x4751cf){if(_0x4751cf){_0x41c7b5=_0x4751cf[_0x07a3('0x43')];if(!_0x27197f[_0x07a3('0x2e')][_0x07a3('0x34')]('nolimit')){_0x21f917[_0x07a3('0x1d')]=qs[_0x07a3('0x1d')](_0x27197f[_0x07a3('0x2e')][_0x07a3('0x1d')]);_0x21f917[_0x07a3('0x1b')]=qs['offset'](_0x27197f[_0x07a3('0x2e')]['offset']);}return _0x4cf4f4[_0x07a3('0x4e')](_0x21f917);}})[_0x07a3('0x24')](function(_0x4629d4){if(_0x4629d4){return _0x4629d4?{'count':_0x41c7b5,'rows':_0x4629d4}:null;}})[_0x07a3('0x24')](respondWithResult(_0x26d597,null))[_0x07a3('0x3f')](handleError(_0x26d597,null));};exports[_0x07a3('0x4f')]=function(_0x2b935a,_0x419fe6,_0x14f8bb){var _0x1f6cb0={};var _0x3a41c1={};var _0x244345;var _0x32eba9;return db['ZendeskConfiguration'][_0x07a3('0x48')]({'where':{'id':_0x2b935a[_0x07a3('0x40')]['id']}})[_0x07a3('0x24')](handleEntityNotFound(_0x419fe6,null))[_0x07a3('0x24')](function(_0x2d7a33){if(_0x2d7a33){_0x244345=_0x2d7a33;_0x3a41c1[_0x07a3('0x2d')]=_[_0x07a3('0x2f')](db[_0x07a3('0x49')][_0x07a3('0x42')]);_0x3a41c1[_0x07a3('0x2e')]=_[_0x07a3('0x2f')](_0x2b935a['query']);_0x3a41c1[_0x07a3('0x30')]=_['intersection'](_0x3a41c1[_0x07a3('0x2d')],_0x3a41c1['query']);_0x1f6cb0[_0x07a3('0x33')]=_[_0x07a3('0x31')](_0x3a41c1['model'],qs[_0x07a3('0x32')](_0x2b935a[_0x07a3('0x2e')][_0x07a3('0x32')]));_0x1f6cb0[_0x07a3('0x33')]=_0x1f6cb0[_0x07a3('0x33')][_0x07a3('0x43')]?_0x1f6cb0[_0x07a3('0x33')]:_0x3a41c1['model'];_0x1f6cb0['order']=qs[_0x07a3('0x4a')](_0x2b935a[_0x07a3('0x2e')][_0x07a3('0x4a')]);_0x1f6cb0['where']=qs[_0x07a3('0x30')](_['pick'](_0x2b935a[_0x07a3('0x2e')],_0x3a41c1[_0x07a3('0x30')]));if(_0x2b935a[_0x07a3('0x2e')][_0x07a3('0x37')]){_0x1f6cb0[_0x07a3('0x36')]=_[_0x07a3('0x38')](_0x1f6cb0['where'],{'$or':_['map'](_0x1f6cb0[_0x07a3('0x33')],function(_0x1b3111){var _0x23092e={};_0x23092e[_0x1b3111]={'$like':'%'+_0x2b935a['query'][_0x07a3('0x37')]+'%'};return _0x23092e;})});}_0x1f6cb0=_[_0x07a3('0x38')]({},_0x1f6cb0,_0x2b935a['options']);return _0x244345[_0x07a3('0x4f')](_0x1f6cb0);}})[_0x07a3('0x24')](function(_0x16c674){if(_0x16c674){_0x32eba9=_0x16c674[_0x07a3('0x43')];if(!_0x2b935a[_0x07a3('0x2e')]['hasOwnProperty'](_0x07a3('0x4c'))){_0x1f6cb0[_0x07a3('0x1d')]=qs['limit'](_0x2b935a[_0x07a3('0x2e')][_0x07a3('0x1d')]);_0x1f6cb0[_0x07a3('0x1b')]=qs[_0x07a3('0x1b')](_0x2b935a['query'][_0x07a3('0x1b')]);}return _0x244345[_0x07a3('0x4f')](_0x1f6cb0);}})[_0x07a3('0x24')](function(_0x53f97b){if(_0x53f97b){return _0x53f97b?{'count':_0x32eba9,'rows':_0x53f97b}:null;}})[_0x07a3('0x24')](respondWithResult(_0x419fe6,null))['catch'](handleError(_0x419fe6,null));};exports['getTags']=function(_0x3196c6,_0x4210f1,_0x5b9f78){var _0x1347d8={};var _0x47f6a7={};var _0x2cc7c5;var _0x20a90f;return db[_0x07a3('0x41')][_0x07a3('0x48')]({'where':{'id':_0x3196c6[_0x07a3('0x40')]['id']}})[_0x07a3('0x24')](handleEntityNotFound(_0x4210f1,null))[_0x07a3('0x24')](function(_0x123948){if(_0x123948){_0x2cc7c5=_0x123948;_0x47f6a7['model']=_[_0x07a3('0x2f')](db[_0x07a3('0x50')][_0x07a3('0x42')]);_0x47f6a7[_0x07a3('0x2e')]=_[_0x07a3('0x2f')](_0x3196c6[_0x07a3('0x2e')]);_0x47f6a7['filters']=_[_0x07a3('0x31')](_0x47f6a7[_0x07a3('0x2d')],_0x47f6a7['query']);_0x1347d8['attributes']=_[_0x07a3('0x31')](_0x47f6a7[_0x07a3('0x2d')],qs[_0x07a3('0x32')](_0x3196c6[_0x07a3('0x2e')][_0x07a3('0x32')]));_0x1347d8['attributes']=_0x1347d8[_0x07a3('0x33')][_0x07a3('0x43')]?_0x1347d8['attributes']:_0x47f6a7[_0x07a3('0x2d')];_0x1347d8['order']=qs['sort'](_0x3196c6['query'][_0x07a3('0x4a')]);_0x1347d8[_0x07a3('0x36')]=qs['filters'](_[_0x07a3('0x4b')](_0x3196c6[_0x07a3('0x2e')],_0x47f6a7[_0x07a3('0x30')]));if(_0x3196c6[_0x07a3('0x2e')][_0x07a3('0x37')]){_0x1347d8[_0x07a3('0x36')]=_[_0x07a3('0x38')](_0x1347d8[_0x07a3('0x36')],{'$or':_[_0x07a3('0x2a')](_0x1347d8[_0x07a3('0x33')],function(_0x32c965){var _0x42339f={};_0x42339f[_0x32c965]={'$like':'%'+_0x3196c6['query'][_0x07a3('0x37')]+'%'};return _0x42339f;})});}_0x1347d8=_['merge']({},_0x1347d8,_0x3196c6[_0x07a3('0x44')]);return _0x2cc7c5['getTags'](_0x1347d8);}})[_0x07a3('0x24')](function(_0x73ea26){if(_0x73ea26){_0x20a90f=_0x73ea26[_0x07a3('0x43')];if(!_0x3196c6[_0x07a3('0x2e')]['hasOwnProperty'](_0x07a3('0x4c'))){_0x1347d8[_0x07a3('0x1d')]=qs[_0x07a3('0x1d')](_0x3196c6['query'][_0x07a3('0x1d')]);_0x1347d8['offset']=qs[_0x07a3('0x1b')](_0x3196c6[_0x07a3('0x2e')][_0x07a3('0x1b')]);}return _0x2cc7c5[_0x07a3('0x51')](_0x1347d8);}})[_0x07a3('0x24')](function(_0x265706){if(_0x265706){return _0x265706?{'count':_0x20a90f,'rows':_0x265706}:null;}})[_0x07a3('0x24')](respondWithResult(_0x4210f1,null))[_0x07a3('0x3f')](handleError(_0x4210f1,null));};exports['setTags']=function(_0x7d6f70,_0x1b8910,_0xcf0b2c){if(_0x7d6f70[_0x07a3('0x46')]['id']){delete _0x7d6f70[_0x07a3('0x46')]['id'];}return db[_0x07a3('0x41')][_0x07a3('0x48')]({'where':{'id':_0x7d6f70[_0x07a3('0x40')]['id']}})[_0x07a3('0x24')](handleEntityNotFound(_0x1b8910,null))[_0x07a3('0x24')](function(_0x40cfc1){if(_0x40cfc1){return _0x40cfc1[_0x07a3('0x52')](_0x7d6f70[_0x07a3('0x46')][_0x07a3('0x53')]||[]);}return null;})['then'](respondWithResult(_0x1b8910,null))[_0x07a3('0x3f')](handleError(_0x1b8910,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index f751224..54db7e9 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 _0x32b6=['moment','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api'];(function(_0x39c7a5,_0x41a3e8){var _0x3bfd84=function(_0x2616f1){while(--_0x2616f1){_0x39c7a5['push'](_0x39c7a5['shift']());}};_0x3bfd84(++_0x41a3e8);}(_0x32b6,0x1d1));var _0x632b=function(_0x3cd74f,_0x4adb2d){_0x3cd74f=_0x3cd74f-0x0;var _0x65bfe0=_0x32b6[_0x3cd74f];return _0x65bfe0;};'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'));module[_0x632b('0x8')]=function(_0x122768,_0x24ceab){return _0x122768[_0x632b('0x9')](_0x632b('0xa'),attributes,{'tableName':_0x632b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93e9=['moment','bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api'];(function(_0x1f46c0,_0x405b58){var _0x166687=function(_0x59594f){while(--_0x59594f){_0x1f46c0['push'](_0x1f46c0['shift']());}};_0x166687(++_0x405b58);}(_0x93e9,0xcc));var _0x993e=function(_0x5ccb33,_0xa4bcbe){_0x5ccb33=_0x5ccb33-0x0;var _0x4c1db8=_0x93e9[_0x5ccb33];return _0x4c1db8;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var logger=require(_0x993e('0x2'))(_0x993e('0x3'));var moment=require(_0x993e('0x4'));var BPromise=require(_0x993e('0x5'));var rp=require(_0x993e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x993e('0x7'));var attributes=require(_0x993e('0x8'));module[_0x993e('0x9')]=function(_0x45f52e,_0x1da414){return _0x45f52e[_0x993e('0xa')](_0x993e('0xb'),attributes,{'tableName':_0x993e('0xc'),'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 1b02327..b462341 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 _0x3638=['request','then','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x239c2d,_0x350167){var _0x4572eb=function(_0xe1e7ec){while(--_0xe1e7ec){_0x239c2d['push'](_0x239c2d['shift']());}};_0x4572eb(++_0x350167);}(_0x3638,0x13b));var _0x8363=function(_0x3c02db,_0x5aed7a){_0x3c02db=_0x3c02db-0x0;var _0x2dcf0f=_0x3638[_0x3c02db];return _0x2dcf0f;};'use strict';var _=require(_0x8363('0x0'));var util=require(_0x8363('0x1'));var moment=require(_0x8363('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8363('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8363('0x4'));var config=require(_0x8363('0x5'));var jayson=require(_0x8363('0x6'));var client=jayson[_0x8363('0x7')][_0x8363('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a3a06,_0x2fa25e,_0x1c5292){return new BPromise(function(_0x186652,_0xd016a9){return client[_0x8363('0x9')](_0x1a3a06,_0x1c5292)[_0x8363('0xa')](function(_0x1a82c4){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x2fa25e,_0x8363('0xb'));logger['debug'](_0x8363('0xc'),_0x2fa25e,'request\x20sent',JSON['stringify'](_0x1a82c4));if(_0x1a82c4['error']){if(_0x1a82c4[_0x8363('0xd')][_0x8363('0xe')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x2fa25e,_0x1a82c4[_0x8363('0xd')]['message']);return _0xd016a9(_0x1a82c4[_0x8363('0xd')]['message']);}logger[_0x8363('0xd')](_0x8363('0xf'),_0x2fa25e,_0x1a82c4[_0x8363('0xd')][_0x8363('0x10')]);return _0x186652(_0x1a82c4[_0x8363('0xd')]['message']);}else{logger['info'](_0x8363('0xf'),_0x2fa25e,'request\x20sent');_0x186652(_0x1a82c4[_0x8363('0x11')]['message']);}})['catch'](function(_0x2b3548){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x2fa25e,_0x2b3548);_0xd016a9(_0x2b3548);});});} \ No newline at end of file +var _0x944c=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','http','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','error','message','info'];(function(_0x3af704,_0x58486b){var _0x4ac16c=function(_0x1a49b8){while(--_0x1a49b8){_0x3af704['push'](_0x3af704['shift']());}};_0x4ac16c(++_0x58486b);}(_0x944c,0x1c1));var _0xc944=function(_0x3dee2f,_0x4f65d8){_0x3dee2f=_0x3dee2f-0x0;var _0x2acf17=_0x944c[_0x3dee2f];return _0x2acf17;};'use strict';var _=require(_0xc944('0x0'));var util=require(_0xc944('0x1'));var moment=require(_0xc944('0x2'));var BPromise=require(_0xc944('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc944('0x4'));var db=require(_0xc944('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc944('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc944('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x578bc0,_0x21def3,_0x38807c){return new BPromise(function(_0x34dbd6,_0x4dd151){return client['request'](_0x578bc0,_0x38807c)['then'](function(_0x5b83b3){logger['info'](_0xc944('0x8'),_0x21def3,_0xc944('0x9'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x21def3,'request\x20sent',JSON['stringify'](_0x5b83b3));if(_0x5b83b3[_0xc944('0xa')]){if(_0x5b83b3[_0xc944('0xa')]['code']===0x1f4){logger['error'](_0xc944('0x8'),_0x21def3,_0x5b83b3[_0xc944('0xa')]['message']);return _0x4dd151(_0x5b83b3[_0xc944('0xa')]['message']);}logger[_0xc944('0xa')](_0xc944('0x8'),_0x21def3,_0x5b83b3[_0xc944('0xa')][_0xc944('0xb')]);return _0x34dbd6(_0x5b83b3[_0xc944('0xa')]['message']);}else{logger[_0xc944('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x21def3,_0xc944('0x9'));_0x34dbd6(_0x5b83b3[_0xc944('0xd')][_0xc944('0xb')]);}})['catch'](function(_0x2edca8){logger['error'](_0xc944('0x8'),_0x21def3,_0x2edca8);_0x4dd151(_0x2edca8);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 45d6cdc..2acf168 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 _0xdefd=['get','isAuthenticated','index','/:id','show','create','update','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller'];(function(_0x577b4c,_0xbf0f9e){var _0xaccf1e=function(_0x234236){while(--_0x234236){_0x577b4c['push'](_0x577b4c['shift']());}};_0xaccf1e(++_0xbf0f9e);}(_0xdefd,0x1e8));var _0xddef=function(_0x5141d1,_0x33c14f){_0x5141d1=_0x5141d1-0x0;var _0x21977d=_0xdefd[_0x5141d1];return _0x21977d;};'use strict';var multer=require(_0xddef('0x0'));var util=require(_0xddef('0x1'));var path=require(_0xddef('0x2'));var timeout=require(_0xddef('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xddef('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xddef('0x5'));var config=require(_0xddef('0x6'));var controller=require(_0xddef('0x7'));router[_0xddef('0x8')]('/',auth[_0xddef('0x9')](),controller[_0xddef('0xa')]);router['get'](_0xddef('0xb'),auth[_0xddef('0x9')](),controller[_0xddef('0xc')]);router['post']('/',auth[_0xddef('0x9')](),controller[_0xddef('0xd')]);router['put']('/:id',auth[_0xddef('0x9')](),controller[_0xddef('0xe')]);router['delete'](_0xddef('0xb'),auth[_0xddef('0x9')](),controller[_0xddef('0xf')]);module['exports']=router; \ No newline at end of file +var _0x412b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3594e6,_0x93f4e4){var _0x5ad98f=function(_0x9dea4a){while(--_0x9dea4a){_0x3594e6['push'](_0x3594e6['shift']());}};_0x5ad98f(++_0x93f4e4);}(_0x412b,0xb7));var _0xb412=function(_0x184e35,_0x2d7614){_0x184e35=_0x184e35-0x0;var _0x55c5dd=_0x412b[_0x184e35];return _0x55c5dd;};'use strict';var multer=require(_0xb412('0x0'));var util=require('util');var path=require(_0xb412('0x1'));var timeout=require(_0xb412('0x2'));var express=require(_0xb412('0x3'));var router=express[_0xb412('0x4')]();var fs_extra=require(_0xb412('0x5'));var auth=require(_0xb412('0x6'));var interaction=require(_0xb412('0x7'));var config=require(_0xb412('0x8'));var controller=require('./intZendeskField.controller');router[_0xb412('0x9')]('/',auth[_0xb412('0xa')](),controller[_0xb412('0xb')]);router[_0xb412('0x9')]('/:id',auth[_0xb412('0xa')](),controller[_0xb412('0xc')]);router[_0xb412('0xd')]('/',auth[_0xb412('0xa')](),controller[_0xb412('0xe')]);router[_0xb412('0xf')]('/:id',auth[_0xb412('0xa')](),controller[_0xb412('0x10')]);router[_0xb412('0x11')](_0xb412('0x12'),auth[_0xb412('0xa')](),controller[_0xb412('0x13')]);module[_0xb412('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 1cb5607..5c27cea 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 _0x4647=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x5419fc,_0x40e7ce){var _0x55f617=function(_0x103974){while(--_0x103974){_0x5419fc['push'](_0x5419fc['shift']());}};_0x55f617(++_0x40e7ce);}(_0x4647,0x6b));var _0x7464=function(_0x26e406,_0x2efc9a){_0x26e406=_0x26e406-0x0;var _0x3df634=_0x4647[_0x26e406];return _0x3df634;};'use strict';var Sequelize=require(_0x7464('0x0'));module[_0x7464('0x1')]={'type':{'type':Sequelize[_0x7464('0x2')](_0x7464('0x3'),_0x7464('0x4'),_0x7464('0x5'),'keyValue',_0x7464('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7464('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x7464('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7464('0x7')]},'nameField':{'type':Sequelize[_0x7464('0x7')]},'customField':{'type':Sequelize[_0x7464('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7464('0x7')]}}; \ No newline at end of file +var _0xa8dd=['ENUM','customVariable','BOOLEAN','sequelize','exports','string','keyValue','picklist','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa8dd,0x1f2));var _0xda8d=function(_0x59bb17,_0x2a1cc5){_0x59bb17=_0x59bb17-0x0;var _0x57fda3=_0xa8dd[_0x59bb17];return _0x57fda3;};'use strict';var Sequelize=require(_0xda8d('0x0'));module[_0xda8d('0x1')]={'type':{'type':Sequelize['ENUM'](_0xda8d('0x2'),'variable','customVariable',_0xda8d('0x3'),_0xda8d('0x4')),'defaultValue':_0xda8d('0x2')},'content':{'type':Sequelize[_0xda8d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xda8d('0x6')](_0xda8d('0x2'),'variable',_0xda8d('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xda8d('0x5')]},'customField':{'type':Sequelize[_0xda8d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xda8d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 957e424..21da6e0 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 _0x4c73=['ZendeskField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x4c73,0x14c));var _0x34c7=function(_0x444e81,_0x28ac89){_0x444e81=_0x444e81-0x0;var _0x5a1423=_0x4c73[_0x444e81];return _0x5a1423;};'use strict';var emlformat=require(_0x34c7('0x0'));var rimraf=require(_0x34c7('0x1'));var zipdir=require(_0x34c7('0x2'));var jsonpatch=require(_0x34c7('0x3'));var rp=require(_0x34c7('0x4'));var moment=require(_0x34c7('0x5'));var BPromise=require(_0x34c7('0x6'));var Mustache=require(_0x34c7('0x7'));var util=require('util');var path=require(_0x34c7('0x8'));var sox=require(_0x34c7('0x9'));var csv=require(_0x34c7('0xa'));var ejs=require(_0x34c7('0xb'));var fs=require('fs');var fs_extra=require(_0x34c7('0xc'));var _=require(_0x34c7('0xd'));var squel=require('squel');var crypto=require(_0x34c7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x34c7('0xf'));var toCsv=require(_0x34c7('0xa'));var querystring=require('querystring');var Papa=require(_0x34c7('0x10'));var Redis=require('ioredis');var authService=require(_0x34c7('0x11'));var qs=require(_0x34c7('0x12'));var as=require(_0x34c7('0x13'));var hardwareService=require(_0x34c7('0x14'));var logger=require(_0x34c7('0x15'))(_0x34c7('0x16'));var utils=require(_0x34c7('0x17'));var config=require(_0x34c7('0x18'));var licenseUtil=require(_0x34c7('0x19'));var db=require(_0x34c7('0x1a'))['db'];function respondWithStatusCode(_0x36f768,_0x22b321){_0x22b321=_0x22b321||0xcc;return function(_0x36350e){if(_0x36350e){return _0x36f768[_0x34c7('0x1b')](_0x22b321);}return _0x36f768[_0x34c7('0x1c')](_0x22b321)[_0x34c7('0x1d')]();};}function respondWithResult(_0x23ca37,_0x383b19){_0x383b19=_0x383b19||0xc8;return function(_0x4a01c5){if(_0x4a01c5){return _0x23ca37[_0x34c7('0x1c')](_0x383b19)[_0x34c7('0x1e')](_0x4a01c5);}};}function respondWithFilteredResult(_0x539750,_0x2c540e){return function(_0x3ef886){if(_0x3ef886){var _0xa79fed=typeof _0x2c540e[_0x34c7('0x1f')]===_0x34c7('0x20')&&typeof _0x2c540e[_0x34c7('0x21')]===_0x34c7('0x20');var _0x1b8d82=_0x3ef886[_0x34c7('0x22')];var _0x3b8973=_0xa79fed?0x0:_0x2c540e[_0x34c7('0x1f')];var _0x9e0ecb=_0xa79fed?_0x3ef886[_0x34c7('0x22')]:_0x2c540e['offset']+_0x2c540e[_0x34c7('0x21')];var _0x58393d;if(_0x9e0ecb>=_0x1b8d82){_0x9e0ecb=_0x1b8d82;_0x58393d=0xc8;}else{_0x58393d=0xce;}_0x539750['status'](_0x58393d);return _0x539750['set'](_0x34c7('0x23'),_0x3b8973+'-'+_0x9e0ecb+'/'+_0x1b8d82)['json'](_0x3ef886);}return null;};}function patchUpdates(_0x3bee56){return function(_0x44a2d8){try{jsonpatch[_0x34c7('0x24')](_0x44a2d8,_0x3bee56,!![]);}catch(_0x16538c){return BPromise[_0x34c7('0x25')](_0x16538c);}return _0x44a2d8[_0x34c7('0x26')]();};}function saveUpdates(_0x279b81,_0x53c7c4){return function(_0x1e576b){if(_0x1e576b){return _0x1e576b[_0x34c7('0x27')](_0x279b81)[_0x34c7('0x28')](function(_0x558e5f){return _0x558e5f;});}return null;};}function removeEntity(_0xd86576,_0x2403aa){return function(_0xc39437){if(_0xc39437){return _0xc39437[_0x34c7('0x29')]()[_0x34c7('0x28')](function(){_0xd86576[_0x34c7('0x1c')](0xcc)[_0x34c7('0x1d')]();});}};}function handleEntityNotFound(_0x1832ea,_0x3b21c4){return function(_0x13c113){if(!_0x13c113){_0x1832ea[_0x34c7('0x1b')](0x194);}return _0x13c113;};}function handleError(_0x2deda2,_0xaea9da){_0xaea9da=_0xaea9da||0x1f4;return function(_0x325c9f){logger[_0x34c7('0x2a')](_0x325c9f[_0x34c7('0x2b')]);if(_0x325c9f['name']){delete _0x325c9f[_0x34c7('0x2c')];}_0x2deda2[_0x34c7('0x1c')](_0xaea9da)[_0x34c7('0x2d')](_0x325c9f);};}exports[_0x34c7('0x2e')]=function(_0x1c42b7,_0x73d668){var _0x33bd73={},_0x20cd2f={},_0x4e6ce2={'count':0x0,'rows':[]};var _0x561a01=_[_0x34c7('0x2f')](db[_0x34c7('0x30')][_0x34c7('0x31')],function(_0x4b0bbf){return{'name':_0x4b0bbf[_0x34c7('0x32')],'type':_0x4b0bbf['type'][_0x34c7('0x33')]};});_0x20cd2f[_0x34c7('0x34')]=_['map'](_0x561a01,'name');_0x20cd2f['query']=_['keys'](_0x1c42b7[_0x34c7('0x35')]);_0x20cd2f[_0x34c7('0x36')]=_[_0x34c7('0x37')](_0x20cd2f[_0x34c7('0x34')],_0x20cd2f['query']);_0x33bd73[_0x34c7('0x38')]=_[_0x34c7('0x37')](_0x20cd2f[_0x34c7('0x34')],qs[_0x34c7('0x39')](_0x1c42b7[_0x34c7('0x35')][_0x34c7('0x39')]));_0x33bd73['attributes']=_0x33bd73[_0x34c7('0x38')][_0x34c7('0x3a')]?_0x33bd73[_0x34c7('0x38')]:_0x20cd2f[_0x34c7('0x34')];if(!_0x1c42b7[_0x34c7('0x35')][_0x34c7('0x3b')](_0x34c7('0x3c'))){_0x33bd73['limit']=qs['limit'](_0x1c42b7[_0x34c7('0x35')][_0x34c7('0x21')]);_0x33bd73[_0x34c7('0x1f')]=qs[_0x34c7('0x1f')](_0x1c42b7[_0x34c7('0x35')][_0x34c7('0x1f')]);}_0x33bd73['order']=qs[_0x34c7('0x3d')](_0x1c42b7[_0x34c7('0x35')][_0x34c7('0x3d')]);_0x33bd73[_0x34c7('0x3e')]=qs[_0x34c7('0x36')](_['pick'](_0x1c42b7[_0x34c7('0x35')],_0x20cd2f[_0x34c7('0x36')]),_0x561a01);if(_0x1c42b7[_0x34c7('0x35')][_0x34c7('0x3f')]){_0x33bd73[_0x34c7('0x3e')]=_[_0x34c7('0x40')](_0x33bd73['where'],{'$or':_[_0x34c7('0x2f')](_0x561a01,function(_0x4632e4){if(_0x4632e4['type']!=='VIRTUAL'){var _0x3c8581={};_0x3c8581[_0x4632e4['name']]={'$like':'%'+_0x1c42b7[_0x34c7('0x35')][_0x34c7('0x3f')]+'%'};return _0x3c8581;}})});}_0x33bd73=_[_0x34c7('0x40')]({},_0x33bd73,_0x1c42b7[_0x34c7('0x41')]);var _0x3b5b43={'where':_0x33bd73['where']};return db[_0x34c7('0x30')]['count'](_0x3b5b43)['then'](function(_0x3f2608){_0x4e6ce2[_0x34c7('0x22')]=_0x3f2608;if(_0x1c42b7[_0x34c7('0x35')][_0x34c7('0x42')]){_0x33bd73[_0x34c7('0x43')]=[{'all':!![]}];}return db['ZendeskField'][_0x34c7('0x44')](_0x33bd73);})[_0x34c7('0x28')](function(_0x48b127){_0x4e6ce2[_0x34c7('0x45')]=_0x48b127;return _0x4e6ce2;})[_0x34c7('0x28')](respondWithFilteredResult(_0x73d668,_0x33bd73))[_0x34c7('0x46')](handleError(_0x73d668,null));};exports['show']=function(_0x3c618c,_0x3cc156){var _0x79e70d={'raw':!![],'where':{'id':_0x3c618c[_0x34c7('0x47')]['id']}},_0x1e55ac={};_0x1e55ac[_0x34c7('0x34')]=_[_0x34c7('0x48')](db[_0x34c7('0x30')][_0x34c7('0x31')]);_0x1e55ac[_0x34c7('0x35')]=_['keys'](_0x3c618c[_0x34c7('0x35')]);_0x1e55ac['filters']=_['intersection'](_0x1e55ac[_0x34c7('0x34')],_0x1e55ac[_0x34c7('0x35')]);_0x79e70d[_0x34c7('0x38')]=_[_0x34c7('0x37')](_0x1e55ac['model'],qs['fields'](_0x3c618c[_0x34c7('0x35')]['fields']));_0x79e70d[_0x34c7('0x38')]=_0x79e70d[_0x34c7('0x38')]['length']?_0x79e70d[_0x34c7('0x38')]:_0x1e55ac['model'];if(_0x3c618c[_0x34c7('0x35')][_0x34c7('0x42')]){_0x79e70d[_0x34c7('0x43')]=[{'all':!![]}];}_0x79e70d=_[_0x34c7('0x40')]({},_0x79e70d,_0x3c618c[_0x34c7('0x41')]);return db['ZendeskField'][_0x34c7('0x49')](_0x79e70d)[_0x34c7('0x28')](handleEntityNotFound(_0x3cc156,null))[_0x34c7('0x28')](respondWithResult(_0x3cc156,null))[_0x34c7('0x46')](handleError(_0x3cc156,null));};exports[_0x34c7('0x4a')]=function(_0x12e802,_0x3855a1){return db[_0x34c7('0x30')][_0x34c7('0x4a')](_0x12e802['body'],{})[_0x34c7('0x28')](respondWithResult(_0x3855a1,0xc9))[_0x34c7('0x46')](handleError(_0x3855a1,null));};exports[_0x34c7('0x27')]=function(_0x5b49a9,_0x18f29b){if(_0x5b49a9['body']['id']){delete _0x5b49a9[_0x34c7('0x4b')]['id'];}return db['ZendeskField'][_0x34c7('0x49')]({'where':{'id':_0x5b49a9['params']['id']}})[_0x34c7('0x28')](handleEntityNotFound(_0x18f29b,null))['then'](saveUpdates(_0x5b49a9[_0x34c7('0x4b')],null))[_0x34c7('0x28')](respondWithResult(_0x18f29b,null))[_0x34c7('0x46')](handleError(_0x18f29b,null));};exports[_0x34c7('0x29')]=function(_0x1f762e,_0x7ef533){return db['ZendeskField'][_0x34c7('0x49')]({'where':{'id':_0x1f762e[_0x34c7('0x47')]['id']}})[_0x34c7('0x28')](handleEntityNotFound(_0x7ef533,null))[_0x34c7('0x28')](removeEntity(_0x7ef533,null))[_0x34c7('0x46')](handleError(_0x7ef533,null));}; \ No newline at end of file +var _0x99cd=['reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','ZendeskField','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','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','limit','undefined','count','set','Content-Range','json','apply'];(function(_0xc507b7,_0x33044d){var _0x138df1=function(_0x3fd047){while(--_0x3fd047){_0xc507b7['push'](_0xc507b7['shift']());}};_0x138df1(++_0x33044d);}(_0x99cd,0x194));var _0xd99c=function(_0xceb351,_0x2693b0){_0xceb351=_0xceb351-0x0;var _0xf07158=_0x99cd[_0xceb351];return _0xf07158;};'use strict';var emlformat=require(_0xd99c('0x0'));var rimraf=require(_0xd99c('0x1'));var zipdir=require(_0xd99c('0x2'));var jsonpatch=require(_0xd99c('0x3'));var rp=require(_0xd99c('0x4'));var moment=require('moment');var BPromise=require(_0xd99c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd99c('0x6'));var sox=require(_0xd99c('0x7'));var csv=require(_0xd99c('0x8'));var ejs=require(_0xd99c('0x9'));var fs=require('fs');var fs_extra=require(_0xd99c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd99c('0xb'));var toCsv=require(_0xd99c('0x8'));var querystring=require(_0xd99c('0xc'));var Papa=require(_0xd99c('0xd'));var Redis=require('ioredis');var authService=require(_0xd99c('0xe'));var qs=require(_0xd99c('0xf'));var as=require(_0xd99c('0x10'));var hardwareService=require(_0xd99c('0x11'));var logger=require(_0xd99c('0x12'))(_0xd99c('0x13'));var utils=require(_0xd99c('0x14'));var config=require(_0xd99c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd99c('0x16'))['db'];function respondWithStatusCode(_0x4c3659,_0x348c37){_0x348c37=_0x348c37||0xcc;return function(_0x23460c){if(_0x23460c){return _0x4c3659[_0xd99c('0x17')](_0x348c37);}return _0x4c3659[_0xd99c('0x18')](_0x348c37)[_0xd99c('0x19')]();};}function respondWithResult(_0x33695c,_0x2ec005){_0x2ec005=_0x2ec005||0xc8;return function(_0x1454ec){if(_0x1454ec){return _0x33695c[_0xd99c('0x18')](_0x2ec005)['json'](_0x1454ec);}};}function respondWithFilteredResult(_0xb7669a,_0x32fc40){return function(_0x38de40){if(_0x38de40){var _0x27b8a4=typeof _0x32fc40[_0xd99c('0x1a')]==='undefined'&&typeof _0x32fc40[_0xd99c('0x1b')]===_0xd99c('0x1c');var _0x3ca819=_0x38de40[_0xd99c('0x1d')];var _0x35e478=_0x27b8a4?0x0:_0x32fc40[_0xd99c('0x1a')];var _0xaf2092=_0x27b8a4?_0x38de40['count']:_0x32fc40[_0xd99c('0x1a')]+_0x32fc40['limit'];var _0x150277;if(_0xaf2092>=_0x3ca819){_0xaf2092=_0x3ca819;_0x150277=0xc8;}else{_0x150277=0xce;}_0xb7669a[_0xd99c('0x18')](_0x150277);return _0xb7669a[_0xd99c('0x1e')](_0xd99c('0x1f'),_0x35e478+'-'+_0xaf2092+'/'+_0x3ca819)[_0xd99c('0x20')](_0x38de40);}return null;};}function patchUpdates(_0x40c1d2){return function(_0x23d816){try{jsonpatch[_0xd99c('0x21')](_0x23d816,_0x40c1d2,!![]);}catch(_0x365697){return BPromise[_0xd99c('0x22')](_0x365697);}return _0x23d816[_0xd99c('0x23')]();};}function saveUpdates(_0x4443a0,_0xd331c4){return function(_0x19e582){if(_0x19e582){return _0x19e582[_0xd99c('0x24')](_0x4443a0)[_0xd99c('0x25')](function(_0x8382e8){return _0x8382e8;});}return null;};}function removeEntity(_0x6f18b8,_0x316e6f){return function(_0x32fdcf){if(_0x32fdcf){return _0x32fdcf[_0xd99c('0x26')]()[_0xd99c('0x25')](function(){_0x6f18b8[_0xd99c('0x18')](0xcc)[_0xd99c('0x19')]();});}};}function handleEntityNotFound(_0xb83505,_0x5ae22e){return function(_0x44bf91){if(!_0x44bf91){_0xb83505[_0xd99c('0x17')](0x194);}return _0x44bf91;};}function handleError(_0x5dc780,_0xa5982c){_0xa5982c=_0xa5982c||0x1f4;return function(_0x5a58fc){logger[_0xd99c('0x27')](_0x5a58fc[_0xd99c('0x28')]);if(_0x5a58fc[_0xd99c('0x29')]){delete _0x5a58fc[_0xd99c('0x29')];}_0x5dc780['status'](_0xa5982c)[_0xd99c('0x2a')](_0x5a58fc);};}exports[_0xd99c('0x2b')]=function(_0x5c0fb6,_0x314293){var _0x3f2fe0={},_0x364c76={},_0x5bf474={'count':0x0,'rows':[]};var _0x50fcf8=_[_0xd99c('0x2c')](db['ZendeskField'][_0xd99c('0x2d')],function(_0x239cf1){return{'name':_0x239cf1['fieldName'],'type':_0x239cf1[_0xd99c('0x2e')]['key']};});_0x364c76[_0xd99c('0x2f')]=_[_0xd99c('0x2c')](_0x50fcf8,_0xd99c('0x29'));_0x364c76[_0xd99c('0x30')]=_[_0xd99c('0x31')](_0x5c0fb6[_0xd99c('0x30')]);_0x364c76[_0xd99c('0x32')]=_[_0xd99c('0x33')](_0x364c76[_0xd99c('0x2f')],_0x364c76[_0xd99c('0x30')]);_0x3f2fe0[_0xd99c('0x34')]=_[_0xd99c('0x33')](_0x364c76[_0xd99c('0x2f')],qs[_0xd99c('0x35')](_0x5c0fb6[_0xd99c('0x30')][_0xd99c('0x35')]));_0x3f2fe0[_0xd99c('0x34')]=_0x3f2fe0[_0xd99c('0x34')][_0xd99c('0x36')]?_0x3f2fe0[_0xd99c('0x34')]:_0x364c76[_0xd99c('0x2f')];if(!_0x5c0fb6[_0xd99c('0x30')][_0xd99c('0x37')]('nolimit')){_0x3f2fe0[_0xd99c('0x1b')]=qs[_0xd99c('0x1b')](_0x5c0fb6[_0xd99c('0x30')]['limit']);_0x3f2fe0[_0xd99c('0x1a')]=qs[_0xd99c('0x1a')](_0x5c0fb6[_0xd99c('0x30')]['offset']);}_0x3f2fe0['order']=qs[_0xd99c('0x38')](_0x5c0fb6[_0xd99c('0x30')]['sort']);_0x3f2fe0[_0xd99c('0x39')]=qs[_0xd99c('0x32')](_[_0xd99c('0x3a')](_0x5c0fb6[_0xd99c('0x30')],_0x364c76[_0xd99c('0x32')]),_0x50fcf8);if(_0x5c0fb6[_0xd99c('0x30')][_0xd99c('0x3b')]){_0x3f2fe0[_0xd99c('0x39')]=_[_0xd99c('0x3c')](_0x3f2fe0[_0xd99c('0x39')],{'$or':_[_0xd99c('0x2c')](_0x50fcf8,function(_0x16ab1a){if(_0x16ab1a['type']!=='VIRTUAL'){var _0x4f79b4={};_0x4f79b4[_0x16ab1a[_0xd99c('0x29')]]={'$like':'%'+_0x5c0fb6['query'][_0xd99c('0x3b')]+'%'};return _0x4f79b4;}})});}_0x3f2fe0=_[_0xd99c('0x3c')]({},_0x3f2fe0,_0x5c0fb6['options']);var _0x5e9f58={'where':_0x3f2fe0[_0xd99c('0x39')]};return db[_0xd99c('0x3d')][_0xd99c('0x1d')](_0x5e9f58)['then'](function(_0x289be8){_0x5bf474['count']=_0x289be8;if(_0x5c0fb6['query'][_0xd99c('0x3e')]){_0x3f2fe0['include']=[{'all':!![]}];}return db[_0xd99c('0x3d')][_0xd99c('0x3f')](_0x3f2fe0);})[_0xd99c('0x25')](function(_0x1f61e2){_0x5bf474[_0xd99c('0x40')]=_0x1f61e2;return _0x5bf474;})[_0xd99c('0x25')](respondWithFilteredResult(_0x314293,_0x3f2fe0))[_0xd99c('0x41')](handleError(_0x314293,null));};exports[_0xd99c('0x42')]=function(_0x1819a3,_0x550329){var _0x47b16d={'raw':!![],'where':{'id':_0x1819a3['params']['id']}},_0x5cf036={};_0x5cf036[_0xd99c('0x2f')]=_['keys'](db[_0xd99c('0x3d')][_0xd99c('0x2d')]);_0x5cf036[_0xd99c('0x30')]=_['keys'](_0x1819a3[_0xd99c('0x30')]);_0x5cf036[_0xd99c('0x32')]=_[_0xd99c('0x33')](_0x5cf036[_0xd99c('0x2f')],_0x5cf036[_0xd99c('0x30')]);_0x47b16d[_0xd99c('0x34')]=_[_0xd99c('0x33')](_0x5cf036[_0xd99c('0x2f')],qs[_0xd99c('0x35')](_0x1819a3[_0xd99c('0x30')][_0xd99c('0x35')]));_0x47b16d[_0xd99c('0x34')]=_0x47b16d['attributes'][_0xd99c('0x36')]?_0x47b16d[_0xd99c('0x34')]:_0x5cf036['model'];if(_0x1819a3[_0xd99c('0x30')][_0xd99c('0x3e')]){_0x47b16d[_0xd99c('0x43')]=[{'all':!![]}];}_0x47b16d=_[_0xd99c('0x3c')]({},_0x47b16d,_0x1819a3[_0xd99c('0x44')]);return db['ZendeskField'][_0xd99c('0x45')](_0x47b16d)['then'](handleEntityNotFound(_0x550329,null))[_0xd99c('0x25')](respondWithResult(_0x550329,null))[_0xd99c('0x41')](handleError(_0x550329,null));};exports[_0xd99c('0x46')]=function(_0x1fc1c1,_0x5db877){return db[_0xd99c('0x3d')][_0xd99c('0x46')](_0x1fc1c1[_0xd99c('0x47')],{})[_0xd99c('0x25')](respondWithResult(_0x5db877,0xc9))['catch'](handleError(_0x5db877,null));};exports[_0xd99c('0x24')]=function(_0xb7f81b,_0x1f0075){if(_0xb7f81b[_0xd99c('0x47')]['id']){delete _0xb7f81b[_0xd99c('0x47')]['id'];}return db[_0xd99c('0x3d')][_0xd99c('0x45')]({'where':{'id':_0xb7f81b[_0xd99c('0x48')]['id']}})[_0xd99c('0x25')](handleEntityNotFound(_0x1f0075,null))[_0xd99c('0x25')](saveUpdates(_0xb7f81b['body'],null))['then'](respondWithResult(_0x1f0075,null))[_0xd99c('0x41')](handleError(_0x1f0075,null));};exports[_0xd99c('0x26')]=function(_0x22e069,_0x2d1510){return db[_0xd99c('0x3d')][_0xd99c('0x45')]({'where':{'id':_0x22e069[_0xd99c('0x48')]['id']}})[_0xd99c('0x25')](handleEntityNotFound(_0x2d1510,null))['then'](removeEntity(_0x2d1510,null))[_0xd99c('0x41')](handleError(_0x2d1510,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index e5e4420..38f6e66 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 _0x0fae=['../../config/logger','api','moment','bluebird','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField'];(function(_0x403947,_0x3877d9){var _0x2b8e1a=function(_0x2bc7f3){while(--_0x2bc7f3){_0x403947['push'](_0x403947['shift']());}};_0x2b8e1a(++_0x3877d9);}(_0x0fae,0xcc));var _0xe0fa=function(_0x562a6b,_0x2edcd6){_0x562a6b=_0x562a6b-0x0;var _0x24d91c=_0x0fae[_0x562a6b];return _0x24d91c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe0fa('0x0'))(_0xe0fa('0x1'));var moment=require(_0xe0fa('0x2'));var BPromise=require(_0xe0fa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0fa('0x4'));var rimraf=require(_0xe0fa('0x5'));var config=require('../../config/environment');var attributes=require(_0xe0fa('0x6'));module[_0xe0fa('0x7')]=function(_0x122071,_0x149803){return _0x122071[_0xe0fa('0x8')](_0xe0fa('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xe0fa('0xa'),'fields':[_0xe0fa('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4fc9=['api','moment','bluebird','request-promise','path','rimraf','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','util'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x4fc9,0xb5));var _0x94fc=function(_0x512bd3,_0xabe09){_0x512bd3=_0x512bd3-0x0;var _0x212dc8=_0x4fc9[_0x512bd3];return _0x212dc8;};'use strict';var _=require('lodash');var util=require(_0x94fc('0x0'));var logger=require('../../config/logger')(_0x94fc('0x1'));var moment=require(_0x94fc('0x2'));var BPromise=require(_0x94fc('0x3'));var rp=require(_0x94fc('0x4'));var fs=require('fs');var path=require(_0x94fc('0x5'));var rimraf=require(_0x94fc('0x6'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0x94fc('0x7')]=function(_0x3bb28e,_0x251016){return _0x3bb28e[_0x94fc('0x8')]('ZendeskField',attributes,{'tableName':_0x94fc('0x9'),'paranoid':![],'indexes':[{'name':_0x94fc('0xa'),'fields':[_0x94fc('0xb'),_0x94fc('0xc')],'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 7eac2e7..8fbe3fe 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 _0x892f=['info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4b6a4b,_0x271355){var _0xe002d1=function(_0x18882c){while(--_0x18882c){_0x4b6a4b['push'](_0x4b6a4b['shift']());}};_0xe002d1(++_0x271355);}(_0x892f,0x1ee));var _0xf892=function(_0x128e3b,_0x3132a8){_0x128e3b=_0x128e3b-0x0;var _0x4b59b9=_0x892f[_0x128e3b];return _0x4b59b9;};'use strict';var _=require(_0xf892('0x0'));var util=require(_0xf892('0x1'));var moment=require(_0xf892('0x2'));var BPromise=require(_0xf892('0x3'));var rs=require(_0xf892('0x4'));var fs=require('fs');var Redis=require(_0xf892('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf892('0x6'))(_0xf892('0x7'));var config=require(_0xf892('0x8'));var jayson=require(_0xf892('0x9'));var client=jayson[_0xf892('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21874e,_0x524ee0,_0x2cfe08){return new BPromise(function(_0xd45f8d,_0x336b99){return client[_0xf892('0xb')](_0x21874e,_0x2cfe08)['then'](function(_0xe0b11a){logger[_0xf892('0xc')](_0xf892('0xd'),_0x524ee0,_0xf892('0xe'));logger[_0xf892('0xf')](_0xf892('0x10'),_0x524ee0,'request\x20sent',JSON['stringify'](_0xe0b11a));if(_0xe0b11a[_0xf892('0x11')]){if(_0xe0b11a[_0xf892('0x11')][_0xf892('0x12')]===0x1f4){logger[_0xf892('0x11')]('ZendeskField,\x20%s,\x20%s',_0x524ee0,_0xe0b11a[_0xf892('0x11')][_0xf892('0x13')]);return _0x336b99(_0xe0b11a[_0xf892('0x11')][_0xf892('0x13')]);}logger[_0xf892('0x11')](_0xf892('0xd'),_0x524ee0,_0xe0b11a[_0xf892('0x11')][_0xf892('0x13')]);return _0xd45f8d(_0xe0b11a['error'][_0xf892('0x13')]);}else{logger[_0xf892('0xc')]('ZendeskField,\x20%s,\x20%s',_0x524ee0,'request\x20sent');_0xd45f8d(_0xe0b11a[_0xf892('0x14')]['message']);}})[_0xf892('0x15')](function(_0x297812){logger['error'](_0xf892('0xd'),_0x524ee0,_0x297812);_0x336b99(_0x297812);});});} \ No newline at end of file +var _0x983e=['error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c18f8,_0x4d1990){var _0x41102b=function(_0x51a095){while(--_0x51a095){_0x5c18f8['push'](_0x5c18f8['shift']());}};_0x41102b(++_0x4d1990);}(_0x983e,0x100));var _0xe983=function(_0x477411,_0x1b1b92){_0x477411=_0x477411-0x0;var _0x4052b0=_0x983e[_0x477411];return _0x4052b0;};'use strict';var _=require(_0xe983('0x0'));var util=require(_0xe983('0x1'));var moment=require('moment');var BPromise=require(_0xe983('0x2'));var rs=require(_0xe983('0x3'));var fs=require('fs');var Redis=require(_0xe983('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe983('0x5'));var config=require(_0xe983('0x6'));var jayson=require(_0xe983('0x7'));var client=jayson[_0xe983('0x8')][_0xe983('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20c0e3,_0xa5edb0,_0x3c6f13){return new BPromise(function(_0x2a8fe2,_0xa5d35d){return client[_0xe983('0xa')](_0x20c0e3,_0x3c6f13)[_0xe983('0xb')](function(_0x3ab20f){logger[_0xe983('0xc')](_0xe983('0xd'),_0xa5edb0,_0xe983('0xe'));logger['debug'](_0xe983('0xf'),_0xa5edb0,_0xe983('0xe'),JSON[_0xe983('0x10')](_0x3ab20f));if(_0x3ab20f[_0xe983('0x11')]){if(_0x3ab20f[_0xe983('0x11')][_0xe983('0x12')]===0x1f4){logger['error'](_0xe983('0xd'),_0xa5edb0,_0x3ab20f[_0xe983('0x11')][_0xe983('0x13')]);return _0xa5d35d(_0x3ab20f[_0xe983('0x11')][_0xe983('0x13')]);}logger[_0xe983('0x11')](_0xe983('0xd'),_0xa5edb0,_0x3ab20f[_0xe983('0x11')][_0xe983('0x13')]);return _0x2a8fe2(_0x3ab20f['error']['message']);}else{logger[_0xe983('0xc')]('ZendeskField,\x20%s,\x20%s',_0xa5edb0,_0xe983('0xe'));_0x2a8fe2(_0x3ab20f['result'][_0xe983('0x13')]);}})[_0xe983('0x14')](function(_0x453ab7){logger[_0xe983('0x11')](_0xe983('0xd'),_0xa5edb0,_0x453ab7);_0xa5d35d(_0x453ab7);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 59e0c4b..ee74b6a 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 _0x85d3=['./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17bade,_0x10a676){var _0x5c4bba=function(_0x236474){while(--_0x236474){_0x17bade['push'](_0x17bade['shift']());}};_0x5c4bba(++_0x10a676);}(_0x85d3,0x1b1));var _0x385d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x85d3[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x385d('0x0'));var util=require('util');var path=require(_0x385d('0x1'));var timeout=require(_0x385d('0x2'));var express=require(_0x385d('0x3'));var router=express[_0x385d('0x4')]();var fs_extra=require(_0x385d('0x5'));var auth=require(_0x385d('0x6'));var interaction=require(_0x385d('0x7'));var config=require(_0x385d('0x8'));var controller=require(_0x385d('0x9'));router[_0x385d('0xa')]('/',auth[_0x385d('0xb')](),controller[_0x385d('0xc')]);router[_0x385d('0xa')](_0x385d('0xd'),auth['isAuthenticated'](),controller[_0x385d('0xe')]);router[_0x385d('0xa')]('/:id/configurations',auth[_0x385d('0xb')](),controller[_0x385d('0xf')]);router[_0x385d('0xa')](_0x385d('0x10'),auth[_0x385d('0xb')](),controller[_0x385d('0x11')]);router[_0x385d('0x12')]('/',auth[_0x385d('0xb')](),controller[_0x385d('0x13')]);router['post'](_0x385d('0x14'),auth[_0x385d('0xb')](),controller[_0x385d('0x15')]);router[_0x385d('0x16')]('/:id',auth[_0x385d('0xb')](),controller[_0x385d('0x17')]);router[_0x385d('0x18')](_0x385d('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x385d('0x19')]=router; \ No newline at end of file +var _0x1b96=['index','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated'];(function(_0x245275,_0x2e2c4d){var _0x1cdad1=function(_0x4838c4){while(--_0x4838c4){_0x245275['push'](_0x245275['shift']());}};_0x1cdad1(++_0x2e2c4d);}(_0x1b96,0xfe));var _0x61b9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1b96[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x61b9('0x0'));var util=require(_0x61b9('0x1'));var path=require('path');var timeout=require(_0x61b9('0x2'));var express=require('express');var router=express[_0x61b9('0x3')]();var fs_extra=require(_0x61b9('0x4'));var auth=require(_0x61b9('0x5'));var interaction=require(_0x61b9('0x6'));var config=require(_0x61b9('0x7'));var controller=require(_0x61b9('0x8'));router['get']('/',auth[_0x61b9('0x9')](),controller[_0x61b9('0xa')]);router[_0x61b9('0xb')](_0x61b9('0xc'),auth[_0x61b9('0x9')](),controller[_0x61b9('0xd')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x61b9('0xe')]);router['get'](_0x61b9('0xf'),auth['isAuthenticated'](),controller[_0x61b9('0x10')]);router[_0x61b9('0x11')]('/',auth[_0x61b9('0x9')](),controller[_0x61b9('0x12')]);router[_0x61b9('0x11')](_0x61b9('0x13'),auth[_0x61b9('0x9')](),controller['addConfiguration']);router[_0x61b9('0x14')](_0x61b9('0xc'),auth[_0x61b9('0x9')](),controller[_0x61b9('0x15')]);router[_0x61b9('0x16')](_0x61b9('0xc'),auth[_0x61b9('0x9')](),controller['destroy']);module[_0x61b9('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 231b11f..4b2292b 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 _0x91a7=['STRING','exports'];(function(_0x331c23,_0x4cb3ff){var _0x824184=function(_0x29b329){while(--_0x29b329){_0x331c23['push'](_0x331c23['shift']());}};_0x824184(++_0x4cb3ff);}(_0x91a7,0xe7));var _0x791a=function(_0x582bd7,_0xc3c370){_0x582bd7=_0x582bd7-0x0;var _0x188b98=_0x91a7[_0x582bd7];return _0x188b98;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'name':{'type':Sequelize[_0x791a('0x1')]},'description':{'type':Sequelize[_0x791a('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x791a('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x791a('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x791a('0x1')]}}; \ No newline at end of file +var _0x702d=['sequelize','exports','STRING'];(function(_0xdbea9d,_0x14fbf6){var _0x298662=function(_0x4cfe2a){while(--_0x4cfe2a){_0xdbea9d['push'](_0xdbea9d['shift']());}};_0x298662(++_0x14fbf6);}(_0x702d,0x147));var _0xd702=function(_0x35d3bd,_0x5e292b){_0x35d3bd=_0x35d3bd-0x0;var _0x1ca549=_0x702d[_0x35d3bd];return _0x1ca549;};'use strict';var Sequelize=require(_0xd702('0x0'));module[_0xd702('0x1')]={'name':{'type':Sequelize[_0xd702('0x2')]},'description':{'type':Sequelize[_0xd702('0x2')]},'host':{'type':Sequelize[_0xd702('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd702('0x2')]},'clientSecret':{'type':Sequelize[_0xd702('0x2')]},'serverUrl':{'type':Sequelize[_0xd702('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xd702('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5b66127..3219446 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 _0x5d0e=['util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','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','offset','limit','undefined','count','set','reject','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','code','com','serverUrl','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','api_name','push','display_label','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0x1224ea,_0x283e6e){var _0x3a7e55=function(_0x443384){while(--_0x443384){_0x1224ea['push'](_0x1224ea['shift']());}};_0x3a7e55(++_0x283e6e);}(_0x5d0e,0x78));var _0xe5d0=function(_0xc0f020,_0x454913){_0xc0f020=_0xc0f020-0x0;var _0x1b6234=_0x5d0e[_0xc0f020];return _0x1b6234;};'use strict';var emlformat=require(_0xe5d0('0x0'));var rimraf=require(_0xe5d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe5d0('0x2'));var rp=require('request-promise');var moment=require(_0xe5d0('0x3'));var BPromise=require(_0xe5d0('0x4'));var Mustache=require('mustache');var util=require(_0xe5d0('0x5'));var path=require(_0xe5d0('0x6'));var sox=require(_0xe5d0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe5d0('0x8'));var _=require('lodash');var squel=require(_0xe5d0('0x9'));var crypto=require(_0xe5d0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe5d0('0xb'));var toCsv=require(_0xe5d0('0xc'));var querystring=require(_0xe5d0('0xd'));var Papa=require(_0xe5d0('0xe'));var Redis=require(_0xe5d0('0xf'));var authService=require(_0xe5d0('0x10'));var qs=require(_0xe5d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe5d0('0x12'));var logger=require(_0xe5d0('0x13'))(_0xe5d0('0x14'));var utils=require(_0xe5d0('0x15'));var config=require(_0xe5d0('0x16'));var licenseUtil=require(_0xe5d0('0x17'));var db=require(_0xe5d0('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x44f8d5,_0x45aac9){_0x45aac9=_0x45aac9||0xcc;return function(_0x805266){if(_0x805266){return _0x44f8d5['sendStatus'](_0x45aac9);}return _0x44f8d5[_0xe5d0('0x19')](_0x45aac9)[_0xe5d0('0x1a')]();};}function respondWithResult(_0xbbd08a,_0x517f22){_0x517f22=_0x517f22||0xc8;return function(_0xd71ca9){if(_0xd71ca9){return _0xbbd08a['status'](_0x517f22)['json'](_0xd71ca9);}};}function respondWithFilteredResult(_0x26e2ee,_0x2d362d){return function(_0x1fdd7f){if(_0x1fdd7f){var _0x48db84=typeof _0x2d362d[_0xe5d0('0x1b')]==='undefined'&&typeof _0x2d362d[_0xe5d0('0x1c')]===_0xe5d0('0x1d');var _0x373389=_0x1fdd7f[_0xe5d0('0x1e')];var _0x4f0448=_0x48db84?0x0:_0x2d362d[_0xe5d0('0x1b')];var _0x36c839=_0x48db84?_0x1fdd7f[_0xe5d0('0x1e')]:_0x2d362d['offset']+_0x2d362d[_0xe5d0('0x1c')];var _0x1f52a9;if(_0x36c839>=_0x373389){_0x36c839=_0x373389;_0x1f52a9=0xc8;}else{_0x1f52a9=0xce;}_0x26e2ee['status'](_0x1f52a9);return _0x26e2ee[_0xe5d0('0x1f')]('Content-Range',_0x4f0448+'-'+_0x36c839+'/'+_0x373389)['json'](_0x1fdd7f);}return null;};}function patchUpdates(_0x61c9d3){return function(_0x29584a){try{jsonpatch['apply'](_0x29584a,_0x61c9d3,!![]);}catch(_0x1dd95e){return BPromise[_0xe5d0('0x20')](_0x1dd95e);}return _0x29584a['save']();};}function saveUpdates(_0x37ea36,_0x50fccb){return function(_0x595ac5){if(_0x595ac5){return _0x595ac5[_0xe5d0('0x21')](_0x37ea36)[_0xe5d0('0x22')](function(_0x2cc112){return _0x2cc112;});}return null;};}function removeEntity(_0x21b8ba,_0x3c5486){return function(_0x50b0df){if(_0x50b0df){return _0x50b0df[_0xe5d0('0x23')]()[_0xe5d0('0x22')](function(){_0x21b8ba[_0xe5d0('0x19')](0xcc)[_0xe5d0('0x1a')]();});}};}function handleEntityNotFound(_0x4d0f3f,_0x412ef3){return function(_0x80d442){if(!_0x80d442){_0x4d0f3f['sendStatus'](0x194);}return _0x80d442;};}function handleError(_0x580da5,_0x34391c){_0x34391c=_0x34391c||0x1f4;return function(_0x4a6dd7){logger[_0xe5d0('0x24')](_0x4a6dd7[_0xe5d0('0x25')]);if(_0x4a6dd7[_0xe5d0('0x26')]){delete _0x4a6dd7[_0xe5d0('0x26')];}_0x580da5['status'](_0x34391c)[_0xe5d0('0x27')](_0x4a6dd7);};}exports[_0xe5d0('0x28')]=function(_0x49dcb6,_0x3f2860){var _0x533c61={},_0x558c74={},_0x412cb0={'count':0x0,'rows':[]};var _0x272675=_[_0xe5d0('0x29')](db[_0xe5d0('0x2a')][_0xe5d0('0x2b')],function(_0x3da35b){return{'name':_0x3da35b[_0xe5d0('0x2c')],'type':_0x3da35b[_0xe5d0('0x2d')]['key']};});_0x558c74[_0xe5d0('0x2e')]=_[_0xe5d0('0x29')](_0x272675,_0xe5d0('0x26'));_0x558c74[_0xe5d0('0x2f')]=_[_0xe5d0('0x30')](_0x49dcb6[_0xe5d0('0x2f')]);_0x558c74[_0xe5d0('0x31')]=_[_0xe5d0('0x32')](_0x558c74[_0xe5d0('0x2e')],_0x558c74[_0xe5d0('0x2f')]);_0x533c61[_0xe5d0('0x33')]=_['intersection'](_0x558c74[_0xe5d0('0x2e')],qs['fields'](_0x49dcb6[_0xe5d0('0x2f')][_0xe5d0('0x34')]));_0x533c61['attributes']=_0x533c61['attributes'][_0xe5d0('0x35')]?_0x533c61[_0xe5d0('0x33')]:_0x558c74[_0xe5d0('0x2e')];if(!_0x49dcb6[_0xe5d0('0x2f')][_0xe5d0('0x36')](_0xe5d0('0x37'))){_0x533c61[_0xe5d0('0x1c')]=qs[_0xe5d0('0x1c')](_0x49dcb6[_0xe5d0('0x2f')][_0xe5d0('0x1c')]);_0x533c61[_0xe5d0('0x1b')]=qs['offset'](_0x49dcb6[_0xe5d0('0x2f')][_0xe5d0('0x1b')]);}_0x533c61[_0xe5d0('0x38')]=qs['sort'](_0x49dcb6[_0xe5d0('0x2f')][_0xe5d0('0x39')]);_0x533c61['where']=qs['filters'](_[_0xe5d0('0x3a')](_0x49dcb6['query'],_0x558c74['filters']),_0x272675);if(_0x49dcb6[_0xe5d0('0x2f')]['filter']){_0x533c61['where']=_['merge'](_0x533c61[_0xe5d0('0x3b')],{'$or':_['map'](_0x272675,function(_0x5cfe94){if(_0x5cfe94[_0xe5d0('0x2d')]!==_0xe5d0('0x3c')){var _0x57d968={};_0x57d968[_0x5cfe94['name']]={'$like':'%'+_0x49dcb6[_0xe5d0('0x2f')]['filter']+'%'};return _0x57d968;}})});}_0x533c61=_[_0xe5d0('0x3d')]({},_0x533c61,_0x49dcb6[_0xe5d0('0x3e')]);var _0x408d36={'where':_0x533c61[_0xe5d0('0x3b')]};return db[_0xe5d0('0x2a')][_0xe5d0('0x1e')](_0x408d36)[_0xe5d0('0x22')](function(_0x4a9a91){_0x412cb0[_0xe5d0('0x1e')]=_0x4a9a91;if(_0x49dcb6['query'][_0xe5d0('0x3f')]){_0x533c61[_0xe5d0('0x40')]=[{'all':!![]}];}return db['ZohoAccount'][_0xe5d0('0x41')](_0x533c61);})[_0xe5d0('0x22')](function(_0x206bf8){_0x412cb0[_0xe5d0('0x42')]=_0x206bf8;return _0x412cb0;})[_0xe5d0('0x22')](respondWithFilteredResult(_0x3f2860,_0x533c61))[_0xe5d0('0x43')](handleError(_0x3f2860,null));};exports[_0xe5d0('0x44')]=function(_0x53f629,_0x39ddf0){var _0x5415c9={'raw':![],'where':{'id':_0x53f629[_0xe5d0('0x45')]['id']}},_0x4665eb={};_0x4665eb[_0xe5d0('0x2e')]=_[_0xe5d0('0x30')](db[_0xe5d0('0x2a')]['rawAttributes']);_0x4665eb[_0xe5d0('0x2f')]=_[_0xe5d0('0x30')](_0x53f629[_0xe5d0('0x2f')]);_0x4665eb[_0xe5d0('0x31')]=_[_0xe5d0('0x32')](_0x4665eb[_0xe5d0('0x2e')],_0x4665eb[_0xe5d0('0x2f')]);_0x5415c9[_0xe5d0('0x33')]=_[_0xe5d0('0x32')](_0x4665eb[_0xe5d0('0x2e')],qs['fields'](_0x53f629[_0xe5d0('0x2f')][_0xe5d0('0x34')]));_0x5415c9['attributes']=_0x5415c9[_0xe5d0('0x33')][_0xe5d0('0x35')]?_0x5415c9[_0xe5d0('0x33')]:_0x4665eb[_0xe5d0('0x2e')];if(_0x53f629[_0xe5d0('0x2f')]['includeAll']){_0x5415c9['include']=[{'all':!![]}];}_0x5415c9=_[_0xe5d0('0x3d')]({},_0x5415c9,_0x53f629[_0xe5d0('0x3e')]);return db[_0xe5d0('0x2a')]['find'](_0x5415c9)[_0xe5d0('0x22')](handleEntityNotFound(_0x39ddf0,null))['then'](respondWithResult(_0x39ddf0,null))['catch'](handleError(_0x39ddf0,null));};exports[_0xe5d0('0x46')]=function(_0x19ad30,_0x55fa39){return db[_0xe5d0('0x2a')][_0xe5d0('0x46')](_0x19ad30[_0xe5d0('0x47')],{})[_0xe5d0('0x22')](respondWithResult(_0x55fa39,0xc9))[_0xe5d0('0x43')](handleError(_0x55fa39,null));};exports[_0xe5d0('0x21')]=function(_0x2dc8d5,_0x5f4738){if(_0x2dc8d5[_0xe5d0('0x47')]['id']){delete _0x2dc8d5[_0xe5d0('0x47')]['id'];}return db[_0xe5d0('0x2a')][_0xe5d0('0x48')]({'where':{'id':_0x2dc8d5[_0xe5d0('0x45')]['id']}})[_0xe5d0('0x22')](handleEntityNotFound(_0x5f4738,null))[_0xe5d0('0x22')](saveUpdates(_0x2dc8d5[_0xe5d0('0x47')],null))[_0xe5d0('0x22')](respondWithResult(_0x5f4738,null))[_0xe5d0('0x43')](handleError(_0x5f4738,null));};exports['destroy']=function(_0x26aa90,_0x481050){return db[_0xe5d0('0x2a')][_0xe5d0('0x48')]({'where':{'id':_0x26aa90['params']['id']}})[_0xe5d0('0x22')](handleEntityNotFound(_0x481050,null))[_0xe5d0('0x22')](removeEntity(_0x481050,null))['catch'](handleError(_0x481050,null));};exports[_0xe5d0('0x49')]=function(_0x188d6a,_0xf02e1a,_0xcf6370){var _0x39f0c7={};var _0x220282={};var _0x5dac80;var _0x1f2cd7;return db['ZohoAccount'][_0xe5d0('0x4a')]({'where':{'id':_0x188d6a['params']['id']}})[_0xe5d0('0x22')](handleEntityNotFound(_0xf02e1a,null))[_0xe5d0('0x22')](function(_0x48028b){if(_0x48028b){_0x5dac80=_0x48028b;_0x220282['model']=_[_0xe5d0('0x30')](db['ZohoConfiguration'][_0xe5d0('0x2b')]);_0x220282[_0xe5d0('0x2f')]=_[_0xe5d0('0x30')](_0x188d6a[_0xe5d0('0x2f')]);_0x220282[_0xe5d0('0x31')]=_[_0xe5d0('0x32')](_0x220282[_0xe5d0('0x2e')],_0x220282[_0xe5d0('0x2f')]);_0x39f0c7['attributes']=_['intersection'](_0x220282['model'],qs[_0xe5d0('0x34')](_0x188d6a[_0xe5d0('0x2f')][_0xe5d0('0x34')]));_0x39f0c7[_0xe5d0('0x33')]=_0x39f0c7['attributes'][_0xe5d0('0x35')]?_0x39f0c7['attributes']:_0x220282['model'];_0x39f0c7[_0xe5d0('0x38')]=qs['sort'](_0x188d6a[_0xe5d0('0x2f')][_0xe5d0('0x39')]);_0x39f0c7[_0xe5d0('0x3b')]=qs[_0xe5d0('0x31')](_['pick'](_0x188d6a[_0xe5d0('0x2f')],_0x220282[_0xe5d0('0x31')]));if(_0x188d6a[_0xe5d0('0x2f')][_0xe5d0('0x4b')]){_0x39f0c7['where']=_[_0xe5d0('0x3d')](_0x39f0c7['where'],{'$or':_['map'](_0x39f0c7[_0xe5d0('0x33')],function(_0x52bd5d){var _0x292b0e={};_0x292b0e[_0x52bd5d]={'$like':'%'+_0x188d6a['query'][_0xe5d0('0x4b')]+'%'};return _0x292b0e;})});}_0x39f0c7=_[_0xe5d0('0x3d')]({},_0x39f0c7,_0x188d6a[_0xe5d0('0x3e')]);return _0x5dac80['getConfigurations'](_0x39f0c7);}})['then'](function(_0x35fa25){if(_0x35fa25){_0x1f2cd7=_0x35fa25[_0xe5d0('0x35')];if(!_0x188d6a[_0xe5d0('0x2f')]['hasOwnProperty'](_0xe5d0('0x37'))){_0x39f0c7[_0xe5d0('0x1c')]=qs[_0xe5d0('0x1c')](_0x188d6a[_0xe5d0('0x2f')]['limit']);_0x39f0c7[_0xe5d0('0x1b')]=qs['offset'](_0x188d6a[_0xe5d0('0x2f')][_0xe5d0('0x1b')]);}return _0x5dac80['getConfigurations'](_0x39f0c7);}})['then'](function(_0x5b411a){if(_0x5b411a){return _0x5b411a?{'count':_0x1f2cd7,'rows':_0x5b411a}:null;}})['then'](respondWithResult(_0xf02e1a,null))[_0xe5d0('0x43')](handleError(_0xf02e1a,null));};exports[_0xe5d0('0x4c')]=function(_0x5ecbc9,_0x146f9e,_0x4a95ac){if(_0x5ecbc9[_0xe5d0('0x47')]['id']){delete _0x5ecbc9[_0xe5d0('0x47')]['id'];}return db[_0xe5d0('0x2a')]['findOne']({'where':{'id':_0x5ecbc9[_0xe5d0('0x45')]['id']}})[_0xe5d0('0x22')](handleEntityNotFound(_0x146f9e,null))[_0xe5d0('0x22')](function(_0x4f442e){if(_0x4f442e){_0x5ecbc9['body'][_0xe5d0('0x4d')]=_0x4f442e['id'];_0x5ecbc9[_0xe5d0('0x47')][_0xe5d0('0x4e')]=integrations[_0xe5d0('0x4f')](_0x5ecbc9[_0xe5d0('0x47')][_0xe5d0('0x50')],_0x5ecbc9['body'][_0xe5d0('0x2d')]);_0x5ecbc9[_0xe5d0('0x47')]['Descriptions']=integrations[_0xe5d0('0x51')](_0x5ecbc9[_0xe5d0('0x47')][_0xe5d0('0x50')],_0x5ecbc9[_0xe5d0('0x47')][_0xe5d0('0x2d')]);return db[_0xe5d0('0x52')][_0xe5d0('0x46')](_0x5ecbc9[_0xe5d0('0x47')],{'include':[{'model':db[_0xe5d0('0x53')],'as':_0xe5d0('0x4e')},{'model':db[_0xe5d0('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x146f9e,null))[_0xe5d0('0x43')](handleError(_0x146f9e,null));};function getAccessToken(_0x591bb5){return new Promise(function(_0x2b544f,_0x576e28){var _0x44790f;switch(_0x591bb5[_0xe5d0('0x54')]){case'US':_0x44790f='https://accounts.zoho.com';break;case'AU':_0x44790f=_0xe5d0('0x55');break;case'EU':_0x44790f=_0xe5d0('0x56');break;case'IN':_0x44790f=_0xe5d0('0x57');break;case'CN':_0x44790f=_0xe5d0('0x58');break;default:_0x44790f=_0xe5d0('0x56');break;}var _0x389da8={'method':_0xe5d0('0x59'),'uri':_0x44790f+_0xe5d0('0x5a'),'qs':{'refresh_token':_0x591bb5[_0xe5d0('0x5b')],'client_id':_0x591bb5[_0xe5d0('0x5c')],'client_secret':_0x591bb5['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x389da8)[_0xe5d0('0x22')](function(_0x2bfa18){if(_0x2bfa18[_0xe5d0('0x5d')]){_0x2b544f(_0x2bfa18[_0xe5d0('0x5d')]);}else{_0x576e28(_0xe5d0('0x5e'));}})[_0xe5d0('0x43')](function(_0x16b05a){_0x576e28(_0x16b05a);});});}exports['getFields']=function(_0x105a8a,_0x30931b,_0x4028c3){var _0x488db4,_0x134bd1,_0x2774a4,_0x43692f,_0x48925a;return db['ZohoAccount'][_0xe5d0('0x4a')]({'where':{'id':_0x105a8a[_0xe5d0('0x45')]['id']},'attributes':['id',_0xe5d0('0x5f'),'zone',_0xe5d0('0x5c'),'clientSecret','serverUrl',_0xe5d0('0x60'),_0xe5d0('0x5b')]})[_0xe5d0('0x22')](handleEntityNotFound(_0x30931b,null))['then'](function(_0x17cd9d){_0x48925a=_0x17cd9d;_0x488db4=_0x48925a[_0xe5d0('0x5f')];_0x134bd1=_0x488db4==='zoho.eu'?'eu':_0xe5d0('0x61');_0x2774a4=_0x48925a[_0xe5d0('0x62')];var _0x5e9f71=_0x2774a4[_0xe5d0('0x63')](-0x1);if(_0x5e9f71==='/'||_0x5e9f71==='\x5c'||_0x5e9f71===':'){_0x2774a4=_0x2774a4[_0xe5d0('0x64')](0x0,_0x2774a4['lastIndexOf'](_0x5e9f71));}if(!_0x48925a['refreshToken']){throw new Error(_0xe5d0('0x65'));}return getAccessToken(_0x48925a);})['then'](function(_0x18593f){if(_0x18593f){return rp({'method':'GET','uri':util[_0xe5d0('0x66')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x134bd1),'qs':{'module':'Calls'},'headers':{'Authorization':_0xe5d0('0x67')+_0x18593f},'json':!![]});}})['then'](function(_0x47991d){if(_0x47991d){if(_0x47991d[_0xe5d0('0x68')]&&_0x47991d['response']['error']){throw new Error(_0x47991d[_0xe5d0('0x68')][_0xe5d0('0x24')][_0xe5d0('0x69')]);}var _0xfaf01a=[];var _0x13bff8=[];var _0xb4dd67=[_0xe5d0('0x6a'),_0xe5d0('0x6b'),_0xe5d0('0x6c'),_0xe5d0('0x6d'),'Call_Duration',_0xe5d0('0x6e'),_0xe5d0('0x6f'),_0xe5d0('0x70')];_0x13bff8=_[_0xe5d0('0x71')](_0x47991d[_0xe5d0('0x34')],function(_0x14f05e){return _0xb4dd67['includes'](_0x14f05e[_0xe5d0('0x72')]);});for(var _0x5475b0=0x0;_0x5475b0<_0x13bff8[_0xe5d0('0x35')];_0x5475b0++){if(_0x13bff8[_0x5475b0]['system_mandatory']===![]){_0xfaf01a[_0xe5d0('0x73')]({'id':_0x13bff8[_0x5475b0]['id'],'name':_0x13bff8[_0x5475b0][_0xe5d0('0x74')],'custom':_0x13bff8[_0x5475b0]['custom_field'],'options':_0x13bff8[_0x5475b0]['data_type']===_0xe5d0('0x75')&&_0x13bff8[_0x5475b0][_0xe5d0('0x76')]['length']>-0x1?_[_0xe5d0('0x29')](_0x13bff8[_0x5475b0]['pick_list_values'],function(_0x1aa8a1){return{'name':_0x1aa8a1,'value':_0x1aa8a1};}):[]});}}return{'count':_0xfaf01a[_0xe5d0('0x35')],'rows':_0xfaf01a};}else{return{'count':0x0,'rows':[]};}})[_0xe5d0('0x22')](respondWithResult(_0x30931b,null))['catch'](function(_0x178a00){var _0x47a056=_0x105a8a['query'][_0xe5d0('0x77')]?0x1f4:_0x178a00[_0xe5d0('0x78')]||0x1f4;logger[_0xe5d0('0x24')](_0xe5d0('0x79'),_0xe5d0('0x7a'),_0x47a056,JSON[_0xe5d0('0x7b')](_0x178a00));delete _0x178a00['name'];if(_0x47a056===0x191){_0x47a056=0x190;}_0x30931b[_0xe5d0('0x19')](_0x47a056)[_0xe5d0('0x27')](_0x105a8a[_0xe5d0('0x2f')]['test']?{'message':_0xe5d0('0x7c'),'statusCode':_0x178a00[_0xe5d0('0x78')]}:_0x178a00);});}; \ No newline at end of file +var _0x8a33=['status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','create','body','getConfigurations','ZohoConfiguration','length','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','push','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end'];(function(_0x3e7c97,_0x506923){var _0x1310e5=function(_0x44df70){while(--_0x44df70){_0x3e7c97['push'](_0x3e7c97['shift']());}};_0x1310e5(++_0x506923);}(_0x8a33,0x179));var _0x38a3=function(_0x2d4340,_0x14bd7f){_0x2d4340=_0x2d4340-0x0;var _0x5a2e9e=_0x8a33[_0x2d4340];return _0x5a2e9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38a3('0x0'));var zipdir=require(_0x38a3('0x1'));var jsonpatch=require(_0x38a3('0x2'));var rp=require(_0x38a3('0x3'));var moment=require('moment');var BPromise=require(_0x38a3('0x4'));var Mustache=require(_0x38a3('0x5'));var util=require(_0x38a3('0x6'));var path=require(_0x38a3('0x7'));var sox=require(_0x38a3('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38a3('0x9'));var _=require(_0x38a3('0xa'));var squel=require('squel');var crypto=require(_0x38a3('0xb'));var jsforce=require(_0x38a3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x38a3('0xd'));var Papa=require(_0x38a3('0xe'));var Redis=require(_0x38a3('0xf'));var authService=require(_0x38a3('0x10'));var qs=require(_0x38a3('0x11'));var as=require(_0x38a3('0x12'));var hardwareService=require(_0x38a3('0x13'));var logger=require(_0x38a3('0x14'))('api');var utils=require(_0x38a3('0x15'));var config=require(_0x38a3('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x373232,_0x271151){_0x271151=_0x271151||0xcc;return function(_0x3009f6){if(_0x3009f6){return _0x373232[_0x38a3('0x17')](_0x271151);}return _0x373232['status'](_0x271151)[_0x38a3('0x18')]();};}function respondWithResult(_0x502d74,_0x37e4f4){_0x37e4f4=_0x37e4f4||0xc8;return function(_0x249e0a){if(_0x249e0a){return _0x502d74[_0x38a3('0x19')](_0x37e4f4)[_0x38a3('0x1a')](_0x249e0a);}};}function respondWithFilteredResult(_0x31c927,_0x1e516b){return function(_0x2ff045){if(_0x2ff045){var _0x1bee02=typeof _0x1e516b[_0x38a3('0x1b')]===_0x38a3('0x1c')&&typeof _0x1e516b[_0x38a3('0x1d')]===_0x38a3('0x1c');var _0x4fdaa9=_0x2ff045['count'];var _0x3160b0=_0x1bee02?0x0:_0x1e516b[_0x38a3('0x1b')];var _0x32f4b8=_0x1bee02?_0x2ff045[_0x38a3('0x1e')]:_0x1e516b[_0x38a3('0x1b')]+_0x1e516b['limit'];var _0x57847b;if(_0x32f4b8>=_0x4fdaa9){_0x32f4b8=_0x4fdaa9;_0x57847b=0xc8;}else{_0x57847b=0xce;}_0x31c927[_0x38a3('0x19')](_0x57847b);return _0x31c927[_0x38a3('0x1f')]('Content-Range',_0x3160b0+'-'+_0x32f4b8+'/'+_0x4fdaa9)[_0x38a3('0x1a')](_0x2ff045);}return null;};}function patchUpdates(_0x4c8ff9){return function(_0x1e3a1c){try{jsonpatch[_0x38a3('0x20')](_0x1e3a1c,_0x4c8ff9,!![]);}catch(_0x4be72f){return BPromise[_0x38a3('0x21')](_0x4be72f);}return _0x1e3a1c[_0x38a3('0x22')]();};}function saveUpdates(_0x52b784,_0x3e3522){return function(_0x313bbf){if(_0x313bbf){return _0x313bbf[_0x38a3('0x23')](_0x52b784)[_0x38a3('0x24')](function(_0x4cab5d){return _0x4cab5d;});}return null;};}function removeEntity(_0x4441df,_0x470a39){return function(_0x483eac){if(_0x483eac){return _0x483eac[_0x38a3('0x25')]()['then'](function(){_0x4441df[_0x38a3('0x19')](0xcc)[_0x38a3('0x18')]();});}};}function handleEntityNotFound(_0x1a5b9e,_0x4f0e01){return function(_0x5428f3){if(!_0x5428f3){_0x1a5b9e['sendStatus'](0x194);}return _0x5428f3;};}function handleError(_0x4970f7,_0xd8b695){_0xd8b695=_0xd8b695||0x1f4;return function(_0x3fca49){logger[_0x38a3('0x26')](_0x3fca49[_0x38a3('0x27')]);if(_0x3fca49[_0x38a3('0x28')]){delete _0x3fca49[_0x38a3('0x28')];}_0x4970f7['status'](_0xd8b695)[_0x38a3('0x29')](_0x3fca49);};}exports[_0x38a3('0x2a')]=function(_0x1abb91,_0x19d5f8){var _0x358973={},_0x598a5e={},_0x164d01={'count':0x0,'rows':[]};var _0xb9ea26=_[_0x38a3('0x2b')](db[_0x38a3('0x2c')][_0x38a3('0x2d')],function(_0x36631a){return{'name':_0x36631a[_0x38a3('0x2e')],'type':_0x36631a['type']['key']};});_0x598a5e[_0x38a3('0x2f')]=_[_0x38a3('0x2b')](_0xb9ea26,'name');_0x598a5e[_0x38a3('0x30')]=_[_0x38a3('0x31')](_0x1abb91[_0x38a3('0x30')]);_0x598a5e[_0x38a3('0x32')]=_['intersection'](_0x598a5e[_0x38a3('0x2f')],_0x598a5e[_0x38a3('0x30')]);_0x358973['attributes']=_[_0x38a3('0x33')](_0x598a5e[_0x38a3('0x2f')],qs[_0x38a3('0x34')](_0x1abb91[_0x38a3('0x30')]['fields']));_0x358973[_0x38a3('0x35')]=_0x358973[_0x38a3('0x35')]['length']?_0x358973[_0x38a3('0x35')]:_0x598a5e[_0x38a3('0x2f')];if(!_0x1abb91[_0x38a3('0x30')][_0x38a3('0x36')](_0x38a3('0x37'))){_0x358973['limit']=qs['limit'](_0x1abb91[_0x38a3('0x30')]['limit']);_0x358973[_0x38a3('0x1b')]=qs[_0x38a3('0x1b')](_0x1abb91['query'][_0x38a3('0x1b')]);}_0x358973[_0x38a3('0x38')]=qs[_0x38a3('0x39')](_0x1abb91[_0x38a3('0x30')][_0x38a3('0x39')]);_0x358973[_0x38a3('0x3a')]=qs['filters'](_[_0x38a3('0x3b')](_0x1abb91[_0x38a3('0x30')],_0x598a5e[_0x38a3('0x32')]),_0xb9ea26);if(_0x1abb91['query'][_0x38a3('0x3c')]){_0x358973[_0x38a3('0x3a')]=_[_0x38a3('0x3d')](_0x358973[_0x38a3('0x3a')],{'$or':_[_0x38a3('0x2b')](_0xb9ea26,function(_0x2c861e){if(_0x2c861e[_0x38a3('0x3e')]!==_0x38a3('0x3f')){var _0x5405c9={};_0x5405c9[_0x2c861e[_0x38a3('0x28')]]={'$like':'%'+_0x1abb91['query']['filter']+'%'};return _0x5405c9;}})});}_0x358973=_['merge']({},_0x358973,_0x1abb91[_0x38a3('0x40')]);var _0x2a7a8f={'where':_0x358973['where']};return db['ZohoAccount'][_0x38a3('0x1e')](_0x2a7a8f)['then'](function(_0x3e022e){_0x164d01[_0x38a3('0x1e')]=_0x3e022e;if(_0x1abb91['query'][_0x38a3('0x41')]){_0x358973['include']=[{'all':!![]}];}return db[_0x38a3('0x2c')][_0x38a3('0x42')](_0x358973);})['then'](function(_0x4a4e39){_0x164d01[_0x38a3('0x43')]=_0x4a4e39;return _0x164d01;})['then'](respondWithFilteredResult(_0x19d5f8,_0x358973))['catch'](handleError(_0x19d5f8,null));};exports[_0x38a3('0x44')]=function(_0x2faa74,_0x482170){var _0x139037={'raw':![],'where':{'id':_0x2faa74[_0x38a3('0x45')]['id']}},_0x5dbf35={};_0x5dbf35[_0x38a3('0x2f')]=_['keys'](db[_0x38a3('0x2c')]['rawAttributes']);_0x5dbf35[_0x38a3('0x30')]=_[_0x38a3('0x31')](_0x2faa74[_0x38a3('0x30')]);_0x5dbf35[_0x38a3('0x32')]=_[_0x38a3('0x33')](_0x5dbf35[_0x38a3('0x2f')],_0x5dbf35['query']);_0x139037[_0x38a3('0x35')]=_[_0x38a3('0x33')](_0x5dbf35[_0x38a3('0x2f')],qs['fields'](_0x2faa74['query'][_0x38a3('0x34')]));_0x139037[_0x38a3('0x35')]=_0x139037[_0x38a3('0x35')]['length']?_0x139037['attributes']:_0x5dbf35['model'];if(_0x2faa74[_0x38a3('0x30')][_0x38a3('0x41')]){_0x139037['include']=[{'all':!![]}];}_0x139037=_[_0x38a3('0x3d')]({},_0x139037,_0x2faa74['options']);return db[_0x38a3('0x2c')][_0x38a3('0x46')](_0x139037)[_0x38a3('0x24')](handleEntityNotFound(_0x482170,null))[_0x38a3('0x24')](respondWithResult(_0x482170,null))[_0x38a3('0x47')](handleError(_0x482170,null));};exports[_0x38a3('0x48')]=function(_0x275937,_0x3ae304){return db[_0x38a3('0x2c')][_0x38a3('0x48')](_0x275937[_0x38a3('0x49')],{})[_0x38a3('0x24')](respondWithResult(_0x3ae304,0xc9))[_0x38a3('0x47')](handleError(_0x3ae304,null));};exports['update']=function(_0x28ef1d,_0x5c3acc){if(_0x28ef1d['body']['id']){delete _0x28ef1d[_0x38a3('0x49')]['id'];}return db[_0x38a3('0x2c')][_0x38a3('0x46')]({'where':{'id':_0x28ef1d[_0x38a3('0x45')]['id']}})[_0x38a3('0x24')](handleEntityNotFound(_0x5c3acc,null))[_0x38a3('0x24')](saveUpdates(_0x28ef1d[_0x38a3('0x49')],null))[_0x38a3('0x24')](respondWithResult(_0x5c3acc,null))[_0x38a3('0x47')](handleError(_0x5c3acc,null));};exports[_0x38a3('0x25')]=function(_0x1f560a,_0x37038c){return db['ZohoAccount']['find']({'where':{'id':_0x1f560a[_0x38a3('0x45')]['id']}})[_0x38a3('0x24')](handleEntityNotFound(_0x37038c,null))['then'](removeEntity(_0x37038c,null))[_0x38a3('0x47')](handleError(_0x37038c,null));};exports[_0x38a3('0x4a')]=function(_0x51d262,_0x382e0f,_0x440563){var _0x51f55f={};var _0x2281b1={};var _0x5a6f93;var _0x221ba6;return db[_0x38a3('0x2c')]['findOne']({'where':{'id':_0x51d262['params']['id']}})[_0x38a3('0x24')](handleEntityNotFound(_0x382e0f,null))['then'](function(_0x59a583){if(_0x59a583){_0x5a6f93=_0x59a583;_0x2281b1[_0x38a3('0x2f')]=_[_0x38a3('0x31')](db[_0x38a3('0x4b')][_0x38a3('0x2d')]);_0x2281b1[_0x38a3('0x30')]=_[_0x38a3('0x31')](_0x51d262[_0x38a3('0x30')]);_0x2281b1['filters']=_[_0x38a3('0x33')](_0x2281b1[_0x38a3('0x2f')],_0x2281b1['query']);_0x51f55f['attributes']=_['intersection'](_0x2281b1[_0x38a3('0x2f')],qs[_0x38a3('0x34')](_0x51d262[_0x38a3('0x30')][_0x38a3('0x34')]));_0x51f55f[_0x38a3('0x35')]=_0x51f55f[_0x38a3('0x35')][_0x38a3('0x4c')]?_0x51f55f[_0x38a3('0x35')]:_0x2281b1[_0x38a3('0x2f')];_0x51f55f[_0x38a3('0x38')]=qs[_0x38a3('0x39')](_0x51d262[_0x38a3('0x30')][_0x38a3('0x39')]);_0x51f55f[_0x38a3('0x3a')]=qs[_0x38a3('0x32')](_[_0x38a3('0x3b')](_0x51d262['query'],_0x2281b1[_0x38a3('0x32')]));if(_0x51d262[_0x38a3('0x30')][_0x38a3('0x3c')]){_0x51f55f['where']=_[_0x38a3('0x3d')](_0x51f55f[_0x38a3('0x3a')],{'$or':_[_0x38a3('0x2b')](_0x51f55f[_0x38a3('0x35')],function(_0x3103ef){var _0x222c17={};_0x222c17[_0x3103ef]={'$like':'%'+_0x51d262[_0x38a3('0x30')][_0x38a3('0x3c')]+'%'};return _0x222c17;})});}_0x51f55f=_[_0x38a3('0x3d')]({},_0x51f55f,_0x51d262['options']);return _0x5a6f93['getConfigurations'](_0x51f55f);}})[_0x38a3('0x24')](function(_0x122c9d){if(_0x122c9d){_0x221ba6=_0x122c9d[_0x38a3('0x4c')];if(!_0x51d262[_0x38a3('0x30')][_0x38a3('0x36')]('nolimit')){_0x51f55f[_0x38a3('0x1d')]=qs[_0x38a3('0x1d')](_0x51d262['query'][_0x38a3('0x1d')]);_0x51f55f['offset']=qs[_0x38a3('0x1b')](_0x51d262['query'][_0x38a3('0x1b')]);}return _0x5a6f93[_0x38a3('0x4a')](_0x51f55f);}})[_0x38a3('0x24')](function(_0x5ef0fe){if(_0x5ef0fe){return _0x5ef0fe?{'count':_0x221ba6,'rows':_0x5ef0fe}:null;}})[_0x38a3('0x24')](respondWithResult(_0x382e0f,null))[_0x38a3('0x47')](handleError(_0x382e0f,null));};exports[_0x38a3('0x4d')]=function(_0x16a782,_0x30aca1,_0x26f5d6){if(_0x16a782[_0x38a3('0x49')]['id']){delete _0x16a782[_0x38a3('0x49')]['id'];}return db[_0x38a3('0x2c')][_0x38a3('0x4e')]({'where':{'id':_0x16a782[_0x38a3('0x45')]['id']}})['then'](handleEntityNotFound(_0x30aca1,null))[_0x38a3('0x24')](function(_0x414087){if(_0x414087){_0x16a782[_0x38a3('0x49')][_0x38a3('0x4f')]=_0x414087['id'];_0x16a782[_0x38a3('0x49')][_0x38a3('0x50')]=integrations[_0x38a3('0x51')](_0x16a782[_0x38a3('0x49')][_0x38a3('0x52')],_0x16a782[_0x38a3('0x49')]['type']);_0x16a782['body'][_0x38a3('0x53')]=integrations[_0x38a3('0x54')](_0x16a782['body'][_0x38a3('0x52')],_0x16a782['body'][_0x38a3('0x3e')]);return db[_0x38a3('0x4b')][_0x38a3('0x48')](_0x16a782[_0x38a3('0x49')],{'include':[{'model':db[_0x38a3('0x55')],'as':_0x38a3('0x50')},{'model':db[_0x38a3('0x55')],'as':_0x38a3('0x53')}]});}return null;})[_0x38a3('0x24')](respondWithResult(_0x30aca1,null))[_0x38a3('0x47')](handleError(_0x30aca1,null));};function getAccessToken(_0x37a4bb){return new Promise(function(_0x3ef714,_0x200126){var _0x21c247;switch(_0x37a4bb[_0x38a3('0x56')]){case'US':_0x21c247=_0x38a3('0x57');break;case'AU':_0x21c247=_0x38a3('0x58');break;case'EU':_0x21c247='https://accounts.zoho.eu';break;case'IN':_0x21c247='https://accounts.zoho.in';break;case'CN':_0x21c247=_0x38a3('0x59');break;default:_0x21c247=_0x38a3('0x5a');break;}var _0x219c2e={'method':_0x38a3('0x5b'),'uri':_0x21c247+_0x38a3('0x5c'),'qs':{'refresh_token':_0x37a4bb[_0x38a3('0x5d')],'client_id':_0x37a4bb[_0x38a3('0x5e')],'client_secret':_0x37a4bb['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x219c2e)[_0x38a3('0x24')](function(_0x3b2ff6){if(_0x3b2ff6['access_token']){_0x3ef714(_0x3b2ff6[_0x38a3('0x5f')]);}else{_0x200126(_0x38a3('0x60'));}})[_0x38a3('0x47')](function(_0x23e370){_0x200126(_0x23e370);});});}exports[_0x38a3('0x61')]=function(_0x33bca9,_0x4dffa3,_0x6f754f){var _0x4171a9,_0x1cef05,_0x3f0a98,_0x47f291,_0x3a74d9;return db['ZohoAccount'][_0x38a3('0x4e')]({'where':{'id':_0x33bca9[_0x38a3('0x45')]['id']},'attributes':['id',_0x38a3('0x62'),_0x38a3('0x56'),_0x38a3('0x5e'),_0x38a3('0x63'),_0x38a3('0x64'),_0x38a3('0x65'),_0x38a3('0x5d')]})[_0x38a3('0x24')](handleEntityNotFound(_0x4dffa3,null))['then'](function(_0x37f254){_0x3a74d9=_0x37f254;_0x4171a9=_0x3a74d9[_0x38a3('0x62')];_0x1cef05=_0x4171a9===_0x38a3('0x66')?'eu':_0x38a3('0x67');_0x3f0a98=_0x3a74d9['serverUrl'];var _0x12a9bf=_0x3f0a98[_0x38a3('0x68')](-0x1);if(_0x12a9bf==='/'||_0x12a9bf==='\x5c'||_0x12a9bf===':'){_0x3f0a98=_0x3f0a98[_0x38a3('0x69')](0x0,_0x3f0a98[_0x38a3('0x6a')](_0x12a9bf));}if(!_0x3a74d9[_0x38a3('0x5d')]){throw new Error(_0x38a3('0x6b'));}return getAccessToken(_0x3a74d9);})[_0x38a3('0x24')](function(_0x270341){if(_0x270341){return rp({'method':_0x38a3('0x6c'),'uri':util[_0x38a3('0x6d')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x1cef05),'qs':{'module':_0x38a3('0x6e')},'headers':{'Authorization':_0x38a3('0x6f')+_0x270341},'json':!![]});}})['then'](function(_0xde0c61){if(_0xde0c61){if(_0xde0c61[_0x38a3('0x70')]&&_0xde0c61[_0x38a3('0x70')][_0x38a3('0x26')]){throw new Error(_0xde0c61[_0x38a3('0x70')][_0x38a3('0x26')][_0x38a3('0x71')]);}var _0x237103=[];var _0x250f30=[];var _0x57371f=[_0x38a3('0x72'),_0x38a3('0x73'),_0x38a3('0x74'),_0x38a3('0x75'),_0x38a3('0x76'),_0x38a3('0x77'),_0x38a3('0x78'),'Call_Type'];_0x250f30=_[_0x38a3('0x79')](_0xde0c61[_0x38a3('0x34')],function(_0x19f4c6){return _0x57371f[_0x38a3('0x7a')](_0x19f4c6[_0x38a3('0x7b')]);});for(var _0x2f8196=0x0;_0x2f8196<_0x250f30[_0x38a3('0x4c')];_0x2f8196++){if(_0x250f30[_0x2f8196]['system_mandatory']===![]){_0x237103[_0x38a3('0x7c')]({'id':_0x250f30[_0x2f8196]['id'],'name':_0x250f30[_0x2f8196][_0x38a3('0x7d')],'custom':_0x250f30[_0x2f8196]['custom_field'],'options':_0x250f30[_0x2f8196][_0x38a3('0x7e')]===_0x38a3('0x7f')&&_0x250f30[_0x2f8196][_0x38a3('0x80')][_0x38a3('0x4c')]>-0x1?_[_0x38a3('0x2b')](_0x250f30[_0x2f8196][_0x38a3('0x80')],function(_0x211c97){return{'name':_0x211c97,'value':_0x211c97};}):[]});}}return{'count':_0x237103[_0x38a3('0x4c')],'rows':_0x237103};}else{return{'count':0x0,'rows':[]};}})[_0x38a3('0x24')](respondWithResult(_0x4dffa3,null))[_0x38a3('0x47')](function(_0x1bc167){var _0x26ab4d=_0x33bca9[_0x38a3('0x30')][_0x38a3('0x81')]?0x1f4:_0x1bc167[_0x38a3('0x82')]||0x1f4;logger[_0x38a3('0x26')](_0x38a3('0x83'),_0x38a3('0x61'),_0x26ab4d,JSON[_0x38a3('0x84')](_0x1bc167));delete _0x1bc167[_0x38a3('0x28')];if(_0x26ab4d===0x191){_0x26ab4d=0x190;}_0x4dffa3['status'](_0x26ab4d)[_0x38a3('0x29')](_0x33bca9[_0x38a3('0x30')][_0x38a3('0x81')]?{'message':_0x38a3('0x85'),'statusCode':_0x1bc167['statusCode']}:_0x1bc167);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index b714434..000bc87 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 _0x3ee7=['https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','lastIndexOf','https://accounts.zoho.eu','POST','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intZohoAccount.attributes','exports','ZohoAccount','changed','clientId','clientSecret','code','host','serverUrl','slice','substring','zone','https://accounts.zoho.com'];(function(_0x19eee1,_0x437d22){var _0x1e0a04=function(_0x1b9aa7){while(--_0x1b9aa7){_0x19eee1['push'](_0x19eee1['shift']());}};_0x1e0a04(++_0x437d22);}(_0x3ee7,0xbd));var _0x73ee=function(_0xc35608,_0x6f0a34){_0xc35608=_0xc35608-0x0;var _0x4be993=_0x3ee7[_0xc35608];return _0x4be993;};'use strict';var _=require(_0x73ee('0x0'));var util=require(_0x73ee('0x1'));var logger=require(_0x73ee('0x2'))(_0x73ee('0x3'));var moment=require(_0x73ee('0x4'));var BPromise=require(_0x73ee('0x5'));var rp=require(_0x73ee('0x6'));var fs=require('fs');var path=require(_0x73ee('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x73ee('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x73ee('0x9')]=function(_0x3220c8,_0x4d6738){return _0x3220c8['define'](_0x73ee('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x20fc19,_0x4d3f61,_0x5b7580){if(_0x20fc19[_0x73ee('0xb')]('zone')||_0x20fc19[_0x73ee('0xb')]('serverUrl')||_0x20fc19['changed'](_0x73ee('0xc'))||_0x20fc19['changed'](_0x73ee('0xd'))||_0x20fc19[_0x73ee('0xb')](_0x73ee('0xe'))||_0x20fc19[_0x73ee('0xb')](_0x73ee('0xf'))){var _0x502ee1,_0x58d7d5;_0x502ee1=_0x20fc19[_0x73ee('0x10')];var _0x166031=_0x502ee1[_0x73ee('0x11')](-0x1);if(_0x166031==='/'||_0x166031==='\x5c'||_0x166031===':'){_0x502ee1=_0x502ee1[_0x73ee('0x12')](0x0,_0x502ee1['lastIndexOf'](_0x166031));}switch(_0x20fc19[_0x73ee('0x13')]){case'US':_0x58d7d5=_0x73ee('0x14');break;case'AU':_0x58d7d5=_0x73ee('0x15');break;case'IN':_0x58d7d5=_0x73ee('0x16');break;case'CN':_0x58d7d5=_0x73ee('0x17');break;default:_0x58d7d5='https://accounts.zoho.eu';break;}var _0x3915b5={'method':'POST','uri':_0x58d7d5+_0x73ee('0x18'),'form':{'grant_type':_0x73ee('0x19'),'client_id':_0x20fc19[_0x73ee('0xc')],'client_secret':_0x20fc19['clientSecret'],'redirect_uri':_0x20fc19['serverUrl'],'code':_0x20fc19[_0x73ee('0xe')]},'headers':{'Content-Type':_0x73ee('0x1a')}};return rp(_0x3915b5)[_0x73ee('0x1b')](function(_0x2e5f31){var _0x2b8f6f=JSON[_0x73ee('0x1c')](_0x2e5f31);if(_0x2b8f6f[_0x73ee('0x1d')]){_0x20fc19[_0x73ee('0x1e')]=_0x2b8f6f[_0x73ee('0x1d')];logger[_0x73ee('0x1f')](util[_0x73ee('0x20')](_0x73ee('0x21'),_0x20fc19[_0x73ee('0x22')],_0x20fc19['id']));}else{logger[_0x73ee('0x23')](util[_0x73ee('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x20fc19[_0x73ee('0x22')],_0x20fc19['id']),util[_0x73ee('0x24')](_0x2b8f6f,{'showHidden':![],'depth':null}));}return _0x5b7580(null,_0x4d3f61);})[_0x73ee('0x25')](function(_0x47fc6c){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x20fc19[_0x73ee('0x22')],_0x20fc19['id']),util[_0x73ee('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5b7580(_0x47fc6c);});}else{return _0x5b7580(null,_0x4d3f61);}},'beforeUpdate':function(_0x1df7ae,_0x147a91,_0x268d3f){if(_0x1df7ae[_0x73ee('0xb')](_0x73ee('0x13'))||_0x1df7ae[_0x73ee('0xb')]('serverUrl')||_0x1df7ae['changed'](_0x73ee('0xc'))||_0x1df7ae[_0x73ee('0xb')]('clientSecret')||_0x1df7ae['changed'](_0x73ee('0xe'))||_0x1df7ae['changed'](_0x73ee('0xf'))){var _0x222110,_0x37693a;_0x222110=_0x1df7ae[_0x73ee('0x10')];var _0x451a95=_0x222110[_0x73ee('0x11')](-0x1);if(_0x451a95==='/'||_0x451a95==='\x5c'||_0x451a95===':'){_0x222110=_0x222110['substring'](0x0,_0x222110[_0x73ee('0x26')](_0x451a95));}switch(_0x1df7ae[_0x73ee('0x13')]){case'US':_0x37693a='https://accounts.zoho.com';break;case'AU':_0x37693a='https://accounts.zoho.com.au';break;case'IN':_0x37693a=_0x73ee('0x16');break;case'CN':_0x37693a=_0x73ee('0x17');break;default:_0x37693a=_0x73ee('0x27');break;}var _0x4c38fe={'method':_0x73ee('0x28'),'uri':_0x37693a+_0x73ee('0x18'),'form':{'grant_type':_0x73ee('0x19'),'client_id':_0x1df7ae[_0x73ee('0xc')],'client_secret':_0x1df7ae[_0x73ee('0xd')],'redirect_uri':_0x1df7ae[_0x73ee('0x10')],'code':_0x1df7ae['code']},'headers':{'Content-Type':_0x73ee('0x1a')}};return rp(_0x4c38fe)[_0x73ee('0x1b')](function(_0x1d02e7){var _0x1f2d8a=JSON[_0x73ee('0x1c')](_0x1d02e7);if(_0x1f2d8a[_0x73ee('0x1d')]){_0x1df7ae[_0x73ee('0x1e')]=_0x1f2d8a[_0x73ee('0x1d')];logger[_0x73ee('0x1f')](util[_0x73ee('0x20')](_0x73ee('0x21'),_0x1df7ae['name'],_0x1df7ae['id']));}else{logger[_0x73ee('0x23')](util['format'](_0x73ee('0x29'),_0x1df7ae[_0x73ee('0x22')],_0x1df7ae['id']),util[_0x73ee('0x24')](_0x1f2d8a,{'showHidden':![],'depth':null}));}return _0x268d3f(null,_0x147a91);})[_0x73ee('0x25')](function(_0xb22d7c){logger[_0x73ee('0x23')](util[_0x73ee('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1df7ae[_0x73ee('0x22')],_0x1df7ae['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x268d3f(_0xb22d7c);});}else{return _0x268d3f(null,_0x147a91);}}}});}; \ No newline at end of file +var _0x2590=['POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','code','lastIndexOf','zone','https://accounts.zoho.com','lodash','util','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define','ZohoAccount','changed','serverUrl','clientId','host','slice','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu'];(function(_0x70fd53,_0x2a95a6){var _0x4b71c5=function(_0x4b349d){while(--_0x4b349d){_0x70fd53['push'](_0x70fd53['shift']());}};_0x4b71c5(++_0x2a95a6);}(_0x2590,0x90));var _0x0259=function(_0x27c297,_0x41fd5e){_0x27c297=_0x27c297-0x0;var _0x75d5ae=_0x2590[_0x27c297];return _0x75d5ae;};'use strict';var _=require(_0x0259('0x0'));var util=require(_0x0259('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0259('0x2'));var rp=require(_0x0259('0x3'));var fs=require('fs');var path=require(_0x0259('0x4'));var rimraf=require(_0x0259('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x0259('0x6'));module[_0x0259('0x7')]=function(_0x23c971,_0x1e42d1){return _0x23c971[_0x0259('0x8')](_0x0259('0x9'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x32ed89,_0x53d399,_0x311074){if(_0x32ed89['changed']('zone')||_0x32ed89[_0x0259('0xa')](_0x0259('0xb'))||_0x32ed89[_0x0259('0xa')](_0x0259('0xc'))||_0x32ed89[_0x0259('0xa')]('clientSecret')||_0x32ed89['changed']('code')||_0x32ed89[_0x0259('0xa')](_0x0259('0xd'))){var _0x4189a0,_0x5728c9;_0x4189a0=_0x32ed89[_0x0259('0xb')];var _0x34b1dc=_0x4189a0[_0x0259('0xe')](-0x1);if(_0x34b1dc==='/'||_0x34b1dc==='\x5c'||_0x34b1dc===':'){_0x4189a0=_0x4189a0[_0x0259('0xf')](0x0,_0x4189a0['lastIndexOf'](_0x34b1dc));}switch(_0x32ed89['zone']){case'US':_0x5728c9='https://accounts.zoho.com';break;case'AU':_0x5728c9=_0x0259('0x10');break;case'IN':_0x5728c9=_0x0259('0x11');break;case'CN':_0x5728c9=_0x0259('0x12');break;default:_0x5728c9=_0x0259('0x13');break;}var _0x314ec6={'method':_0x0259('0x14'),'uri':_0x5728c9+_0x0259('0x15'),'form':{'grant_type':_0x0259('0x16'),'client_id':_0x32ed89[_0x0259('0xc')],'client_secret':_0x32ed89[_0x0259('0x17')],'redirect_uri':_0x32ed89[_0x0259('0xb')],'code':_0x32ed89['code']},'headers':{'Content-Type':_0x0259('0x18')}};return rp(_0x314ec6)[_0x0259('0x19')](function(_0x255260){var _0xc8da23=JSON[_0x0259('0x1a')](_0x255260);if(_0xc8da23[_0x0259('0x1b')]){_0x32ed89[_0x0259('0x1c')]=_0xc8da23[_0x0259('0x1b')];logger[_0x0259('0x1d')](util['format'](_0x0259('0x1e'),_0x32ed89[_0x0259('0x1f')],_0x32ed89['id']));}else{logger[_0x0259('0x20')](util[_0x0259('0x21')](_0x0259('0x22'),_0x32ed89[_0x0259('0x1f')],_0x32ed89['id']),util[_0x0259('0x23')](_0xc8da23,{'showHidden':![],'depth':null}));}return _0x311074(null,_0x53d399);})[_0x0259('0x24')](function(_0x5e4b64){logger[_0x0259('0x20')](util[_0x0259('0x21')](_0x0259('0x22'),_0x32ed89[_0x0259('0x1f')],_0x32ed89['id']),util[_0x0259('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x311074(_0x5e4b64);});}else{return _0x311074(null,_0x53d399);}},'beforeUpdate':function(_0x1d0978,_0x9a3a71,_0x48c6e2){if(_0x1d0978[_0x0259('0xa')]('zone')||_0x1d0978['changed'](_0x0259('0xb'))||_0x1d0978[_0x0259('0xa')](_0x0259('0xc'))||_0x1d0978[_0x0259('0xa')](_0x0259('0x17'))||_0x1d0978['changed'](_0x0259('0x25'))||_0x1d0978[_0x0259('0xa')]('host')){var _0x58f5a5,_0x48481c;_0x58f5a5=_0x1d0978[_0x0259('0xb')];var _0x2835b5=_0x58f5a5[_0x0259('0xe')](-0x1);if(_0x2835b5==='/'||_0x2835b5==='\x5c'||_0x2835b5===':'){_0x58f5a5=_0x58f5a5[_0x0259('0xf')](0x0,_0x58f5a5[_0x0259('0x26')](_0x2835b5));}switch(_0x1d0978[_0x0259('0x27')]){case'US':_0x48481c=_0x0259('0x28');break;case'AU':_0x48481c=_0x0259('0x10');break;case'IN':_0x48481c='https://accounts.zoho.in';break;case'CN':_0x48481c=_0x0259('0x12');break;default:_0x48481c=_0x0259('0x13');break;}var _0x411d3f={'method':_0x0259('0x14'),'uri':_0x48481c+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x1d0978[_0x0259('0xc')],'client_secret':_0x1d0978[_0x0259('0x17')],'redirect_uri':_0x1d0978['serverUrl'],'code':_0x1d0978[_0x0259('0x25')]},'headers':{'Content-Type':_0x0259('0x18')}};return rp(_0x411d3f)['then'](function(_0x16daab){var _0x1b20bd=JSON[_0x0259('0x1a')](_0x16daab);if(_0x1b20bd[_0x0259('0x1b')]){_0x1d0978[_0x0259('0x1c')]=_0x1b20bd['refresh_token'];logger[_0x0259('0x1d')](util[_0x0259('0x21')](_0x0259('0x1e'),_0x1d0978[_0x0259('0x1f')],_0x1d0978['id']));}else{logger[_0x0259('0x20')](util[_0x0259('0x21')](_0x0259('0x22'),_0x1d0978['name'],_0x1d0978['id']),util['inspect'](_0x1b20bd,{'showHidden':![],'depth':null}));}return _0x48c6e2(null,_0x9a3a71);})[_0x0259('0x24')](function(_0x299954){logger[_0x0259('0x20')](util[_0x0259('0x21')](_0x0259('0x22'),_0x1d0978[_0x0259('0x1f')],_0x1d0978['id']),util[_0x0259('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x48c6e2(_0x299954);});}else{return _0x48c6e2(null,_0x9a3a71);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 8698a46..6e40473 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 _0xf954=['ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xc6e7a4,_0x3ab00b){var _0x5a8d43=function(_0x1dc04b){while(--_0x1dc04b){_0xc6e7a4['push'](_0xc6e7a4['shift']());}};_0x5a8d43(++_0x3ab00b);}(_0xf954,0x10e));var _0x4f95=function(_0x7179ba,_0x37504f){_0x7179ba=_0x7179ba-0x0;var _0x4ad820=_0xf954[_0x7179ba];return _0x4ad820;};'use strict';var _=require(_0x4f95('0x0'));var util=require(_0x4f95('0x1'));var moment=require(_0x4f95('0x2'));var BPromise=require(_0x4f95('0x3'));var rs=require(_0x4f95('0x4'));var fs=require('fs');var Redis=require(_0x4f95('0x5'));var db=require(_0x4f95('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f95('0x7'));var config=require(_0x4f95('0x8'));var jayson=require(_0x4f95('0x9'));var client=jayson[_0x4f95('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9d6129,_0x414fb1,_0x2b4724){return new BPromise(function(_0x3f8c9a,_0x4a61f7){return client['request'](_0x9d6129,_0x2b4724)[_0x4f95('0xb')](function(_0x22ecb1){logger[_0x4f95('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x414fb1,'request\x20sent');logger['debug'](_0x4f95('0xd'),_0x414fb1,_0x4f95('0xe'),JSON[_0x4f95('0xf')](_0x22ecb1));if(_0x22ecb1[_0x4f95('0x10')]){if(_0x22ecb1['error'][_0x4f95('0x11')]===0x1f4){logger[_0x4f95('0x10')](_0x4f95('0x12'),_0x414fb1,_0x22ecb1[_0x4f95('0x10')][_0x4f95('0x13')]);return _0x4a61f7(_0x22ecb1['error'][_0x4f95('0x13')]);}logger[_0x4f95('0x10')](_0x4f95('0x12'),_0x414fb1,_0x22ecb1[_0x4f95('0x10')]['message']);return _0x3f8c9a(_0x22ecb1[_0x4f95('0x10')][_0x4f95('0x13')]);}else{logger[_0x4f95('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x414fb1,_0x4f95('0xe'));_0x3f8c9a(_0x22ecb1[_0x4f95('0x14')][_0x4f95('0x13')]);}})[_0x4f95('0x15')](function(_0x3ea415){logger[_0x4f95('0x10')](_0x4f95('0x12'),_0x414fb1,_0x3ea415);_0x4a61f7(_0x3ea415);});});}exports[_0x4f95('0x16')]=function(_0x235c03){var _0x3a3508=this;return new Promise(function(_0x5918ad,_0x3a46f5){return db[_0x4f95('0x17')][_0x4f95('0x18')]({'raw':_0x235c03[_0x4f95('0x19')]?_0x235c03[_0x4f95('0x19')][_0x4f95('0x1a')]===undefined?!![]:![]:!![],'where':_0x235c03[_0x4f95('0x19')]?_0x235c03[_0x4f95('0x19')][_0x4f95('0x1b')]||null:null,'attributes':_0x235c03['options']?_0x235c03[_0x4f95('0x19')][_0x4f95('0x1c')]||null:null,'limit':_0x235c03[_0x4f95('0x19')]?_0x235c03[_0x4f95('0x19')][_0x4f95('0x1d')]||null:null,'include':_0x235c03[_0x4f95('0x19')]?_0x235c03[_0x4f95('0x19')][_0x4f95('0x1e')]?_[_0x4f95('0x1f')](_0x235c03[_0x4f95('0x19')][_0x4f95('0x1e')],function(_0x27a229){return{'model':db[_0x27a229[_0x4f95('0x20')]],'as':_0x27a229['as'],'attributes':_0x27a229['attributes'],'include':_0x27a229[_0x4f95('0x1e')]?_[_0x4f95('0x1f')](_0x27a229[_0x4f95('0x1e')],function(_0x34a4de){return{'model':db[_0x34a4de[_0x4f95('0x20')]],'as':_0x34a4de['as'],'attributes':_0x34a4de[_0x4f95('0x1c')],'include':_0x34a4de[_0x4f95('0x1e')]?_['map'](_0x34a4de[_0x4f95('0x1e')],function(_0x50996d){return{'model':db[_0x50996d[_0x4f95('0x20')]],'as':_0x50996d['as'],'attributes':_0x50996d[_0x4f95('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4f95('0xb')](function(_0x1079fd){logger[_0x4f95('0xc')]('GetZohoAccount',_0x235c03);logger[_0x4f95('0x21')](_0x4f95('0x16'),_0x235c03,JSON[_0x4f95('0xf')](_0x1079fd));_0x5918ad(_0x1079fd);})[_0x4f95('0x15')](function(_0x1ae268){logger[_0x4f95('0x10')](_0x4f95('0x16'),_0x1ae268[_0x4f95('0x13')],_0x235c03);_0x3a46f5(_0x3a3508['error'](0x1f4,_0x1ae268['message']));});});};exports['ShowZohoAccount']=function(_0x4cb67d){var _0x5515b4=this;return new Promise(function(_0x40d115,_0xc3837a){return db[_0x4f95('0x17')][_0x4f95('0x22')]({'raw':_0x4cb67d[_0x4f95('0x19')]?_0x4cb67d[_0x4f95('0x19')][_0x4f95('0x1a')]===undefined?!![]:![]:!![],'where':_0x4cb67d[_0x4f95('0x19')]?_0x4cb67d['options'][_0x4f95('0x1b')]||null:null,'attributes':_0x4cb67d[_0x4f95('0x19')]?_0x4cb67d[_0x4f95('0x19')][_0x4f95('0x1c')]||null:null,'include':_0x4cb67d[_0x4f95('0x19')]?_0x4cb67d[_0x4f95('0x19')][_0x4f95('0x1e')]?_[_0x4f95('0x1f')](_0x4cb67d['options'][_0x4f95('0x1e')],function(_0xcb8447){return{'model':db[_0xcb8447[_0x4f95('0x20')]],'as':_0xcb8447['as'],'attributes':_0xcb8447[_0x4f95('0x1c')],'include':_0xcb8447[_0x4f95('0x1e')]?_[_0x4f95('0x1f')](_0xcb8447[_0x4f95('0x1e')],function(_0x9fabf4){return{'model':db[_0x9fabf4[_0x4f95('0x20')]],'as':_0x9fabf4['as'],'attributes':_0x9fabf4[_0x4f95('0x1c')],'include':_0x9fabf4[_0x4f95('0x1e')]?_[_0x4f95('0x1f')](_0x9fabf4[_0x4f95('0x1e')],function(_0x56f557){return{'model':db[_0x56f557['model']],'as':_0x56f557['as'],'attributes':_0x56f557[_0x4f95('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4f95('0xb')](function(_0x3c96b0){logger[_0x4f95('0xc')](_0x4f95('0x23'),_0x4cb67d);logger['debug']('ShowZohoAccount',_0x4cb67d,JSON[_0x4f95('0xf')](_0x3c96b0));_0x40d115(_0x3c96b0);})[_0x4f95('0x15')](function(_0x3768ee){logger[_0x4f95('0x10')](_0x4f95('0x23'),_0x3768ee[_0x4f95('0x13')],_0x4cb67d);_0xc3837a(_0x5515b4['error'](0x1f4,_0x3768ee[_0x4f95('0x13')]));});});}; \ No newline at end of file +var _0xe3da=['then','GetZohoAccount','catch','ShowZohoAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ZohoAccount','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x3d039f,_0x2533bd){var _0x1ddddc=function(_0x1def6b){while(--_0x1def6b){_0x3d039f['push'](_0x3d039f['shift']());}};_0x1ddddc(++_0x2533bd);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});}exports['GetZohoAccount']=function(_0x3f8cf9){var _0x4cbe4e=this;return new Promise(function(_0x558e42,_0x4d931d){return db[_0xae3d('0x18')][_0xae3d('0x19')]({'raw':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f8cf9['options']?_0x3f8cf9[_0xae3d('0x1a')]['where']||null:null,'attributes':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1c')]||null:null,'limit':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1d')]||null:null,'include':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1e')],function(_0x37f5ff){return{'model':db[_0x37f5ff[_0xae3d('0x20')]],'as':_0x37f5ff['as'],'attributes':_0x37f5ff[_0xae3d('0x1c')],'include':_0x37f5ff[_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x37f5ff[_0xae3d('0x1e')],function(_0x2131e9){return{'model':db[_0x2131e9[_0xae3d('0x20')]],'as':_0x2131e9['as'],'attributes':_0x2131e9['attributes'],'include':_0x2131e9[_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x2131e9[_0xae3d('0x1e')],function(_0x52df0f){return{'model':db[_0x52df0f[_0xae3d('0x20')]],'as':_0x52df0f['as'],'attributes':_0x52df0f[_0xae3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xae3d('0x21')](function(_0x54c1e1){logger['info'](_0xae3d('0x22'),_0x3f8cf9);logger[_0xae3d('0x11')](_0xae3d('0x22'),_0x3f8cf9,JSON[_0xae3d('0x13')](_0x54c1e1));_0x558e42(_0x54c1e1);})[_0xae3d('0x23')](function(_0x561371){logger[_0xae3d('0x14')](_0xae3d('0x22'),_0x561371['message'],_0x3f8cf9);_0x4d931d(_0x4cbe4e[_0xae3d('0x14')](0x1f4,_0x561371[_0xae3d('0x16')]));});});};exports[_0xae3d('0x24')]=function(_0x46f484){var _0x432c04=this;return new Promise(function(_0x6ef13c,_0x5356d4){return db['ZohoAccount']['find']({'raw':_0x46f484[_0xae3d('0x1a')]?_0x46f484[_0xae3d('0x1a')][_0xae3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x46f484[_0xae3d('0x1a')]?_0x46f484['options'][_0xae3d('0x25')]||null:null,'attributes':_0x46f484[_0xae3d('0x1a')]?_0x46f484[_0xae3d('0x1a')][_0xae3d('0x1c')]||null:null,'include':_0x46f484[_0xae3d('0x1a')]?_0x46f484[_0xae3d('0x1a')][_0xae3d('0x1e')]?_['map'](_0x46f484[_0xae3d('0x1a')]['include'],function(_0x55aae4){return{'model':db[_0x55aae4[_0xae3d('0x20')]],'as':_0x55aae4['as'],'attributes':_0x55aae4['attributes'],'include':_0x55aae4[_0xae3d('0x1e')]?_['map'](_0x55aae4['include'],function(_0x1a28b5){return{'model':db[_0x1a28b5[_0xae3d('0x20')]],'as':_0x1a28b5['as'],'attributes':_0x1a28b5[_0xae3d('0x1c')],'include':_0x1a28b5['include']?_[_0xae3d('0x1f')](_0x1a28b5['include'],function(_0xce647f){return{'model':db[_0xce647f[_0xae3d('0x20')]],'as':_0xce647f['as'],'attributes':_0xce647f[_0xae3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xae3d('0x21')](function(_0x18c469){logger[_0xae3d('0xe')](_0xae3d('0x24'),_0x46f484);logger[_0xae3d('0x11')](_0xae3d('0x24'),_0x46f484,JSON[_0xae3d('0x13')](_0x18c469));_0x6ef13c(_0x18c469);})[_0xae3d('0x23')](function(_0x5543ee){logger['error'](_0xae3d('0x24'),_0x5543ee['message'],_0x46f484);_0x5356d4(_0x432c04[_0xae3d('0x14')](0x1f4,_0x5543ee[_0xae3d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 0851884..c7a5af2 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 _0x20bf=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZohoConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','create','put'];(function(_0x49f584,_0x426fee){var _0x5b8269=function(_0x30fa95){while(--_0x30fa95){_0x49f584['push'](_0x49f584['shift']());}};_0x5b8269(++_0x426fee);}(_0x20bf,0x1d0));var _0xf20b=function(_0x633886,_0x1cd609){_0x633886=_0x633886-0x0;var _0x4246d7=_0x20bf[_0x633886];return _0x4246d7;};'use strict';var multer=require(_0xf20b('0x0'));var util=require(_0xf20b('0x1'));var path=require(_0xf20b('0x2'));var timeout=require(_0xf20b('0x3'));var express=require(_0xf20b('0x4'));var router=express[_0xf20b('0x5')]();var fs_extra=require(_0xf20b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf20b('0x7'));var config=require('../../config/environment');var controller=require(_0xf20b('0x8'));router['get']('/',auth[_0xf20b('0x9')](),controller[_0xf20b('0xa')]);router[_0xf20b('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xf20b('0xc')]);router[_0xf20b('0xb')](_0xf20b('0xd'),auth[_0xf20b('0x9')](),controller['getFields']);router['get'](_0xf20b('0xe'),auth['isAuthenticated'](),controller[_0xf20b('0xf')]);router[_0xf20b('0xb')]('/:id/descriptions',auth[_0xf20b('0x9')](),controller[_0xf20b('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf20b('0x11')]);router[_0xf20b('0x12')]('/:id',auth[_0xf20b('0x9')](),controller['update']);router[_0xf20b('0x13')](_0xf20b('0x14'),auth['isAuthenticated'](),controller[_0xf20b('0x15')]);module[_0xf20b('0x16')]=router; \ No newline at end of file +var _0x1583=['express','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x771f13,_0x3bae19){var _0x4b5a3b=function(_0x4bec6e){while(--_0x4bec6e){_0x771f13['push'](_0x771f13['shift']());}};_0x4b5a3b(++_0x3bae19);}(_0x1583,0x79));var _0x3158=function(_0x563b6a,_0x2a24b1){_0x563b6a=_0x563b6a-0x0;var _0x38c773=_0x1583[_0x563b6a];return _0x38c773;};'use strict';var multer=require(_0x3158('0x0'));var util=require(_0x3158('0x1'));var path=require(_0x3158('0x2'));var timeout=require(_0x3158('0x3'));var express=require(_0x3158('0x4'));var router=express[_0x3158('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3158('0x6'));var config=require(_0x3158('0x7'));var controller=require(_0x3158('0x8'));router[_0x3158('0x9')]('/',auth[_0x3158('0xa')](),controller[_0x3158('0xb')]);router[_0x3158('0x9')]('/:id',auth[_0x3158('0xa')](),controller[_0x3158('0xc')]);router['get']('/:id/fields',auth[_0x3158('0xa')](),controller[_0x3158('0xd')]);router[_0x3158('0x9')](_0x3158('0xe'),auth[_0x3158('0xa')](),controller[_0x3158('0xf')]);router[_0x3158('0x9')](_0x3158('0x10'),auth[_0x3158('0xa')](),controller[_0x3158('0x11')]);router[_0x3158('0x12')]('/',auth['isAuthenticated'](),controller[_0x3158('0x13')]);router[_0x3158('0x14')](_0x3158('0x15'),auth[_0x3158('0xa')](),controller[_0x3158('0x16')]);router[_0x3158('0x17')](_0x3158('0x15'),auth[_0x3158('0xa')](),controller['destroy']);module[_0x3158('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 9fa335b..4f73ee5 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 _0x151d=['ENUM','contact','lead','contact_lead','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x151d,0x1e7));var _0xd151=function(_0x4428de,_0x1c0f4b){_0x4428de=_0x4428de-0x0;var _0x151244=_0x151d[_0x4428de];return _0x151244;};'use strict';var Sequelize=require(_0xd151('0x0'));module[_0xd151('0x1')]={'name':{'type':Sequelize[_0xd151('0x2')]},'moduleCreate':{'type':Sequelize[_0xd151('0x3')]('lead',_0xd151('0x4'),'nothing'),'defaultValue':_0xd151('0x5')},'moduleSearch':{'type':Sequelize[_0xd151('0x3')](_0xd151('0x6'),_0xd151('0x4'),_0xd151('0x5')),'defaultValue':_0xd151('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb6a9=['nothing','lead','contact_lead','STRING','sequelize','exports','ENUM','contact'];(function(_0x1e73d1,_0x3270f9){var _0x2cf4d2=function(_0x5375d7){while(--_0x5375d7){_0x1e73d1['push'](_0x1e73d1['shift']());}};_0x2cf4d2(++_0x3270f9);}(_0xb6a9,0xc4));var _0x9b6a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb6a9[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x9b6a('0x0'));module[_0x9b6a('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x9b6a('0x2')]('lead',_0x9b6a('0x3'),_0x9b6a('0x4')),'defaultValue':_0x9b6a('0x5')},'moduleSearch':{'type':Sequelize[_0x9b6a('0x2')](_0x9b6a('0x6'),'contact',_0x9b6a('0x5')),'defaultValue':_0x9b6a('0x6')},'description':{'type':Sequelize[_0x9b6a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index b985101..dfd155f 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 _0x711d=['params','include','create','body','find','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','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','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','catch'];(function(_0x11b203,_0x53cdb6){var _0x4ddaca=function(_0x3ace6e){while(--_0x3ace6e){_0x11b203['push'](_0x11b203['shift']());}};_0x4ddaca(++_0x53cdb6);}(_0x711d,0x1eb));var _0xd711=function(_0x157eb0,_0x29eb48){_0x157eb0=_0x157eb0-0x0;var _0x1910c4=_0x711d[_0x157eb0];return _0x1910c4;};'use strict';var emlformat=require(_0xd711('0x0'));var rimraf=require(_0xd711('0x1'));var zipdir=require(_0xd711('0x2'));var jsonpatch=require(_0xd711('0x3'));var rp=require('request-promise');var moment=require(_0xd711('0x4'));var BPromise=require(_0xd711('0x5'));var Mustache=require('mustache');var util=require(_0xd711('0x6'));var path=require(_0xd711('0x7'));var sox=require(_0xd711('0x8'));var csv=require(_0xd711('0x9'));var ejs=require(_0xd711('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd711('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd711('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd711('0xd'));var Papa=require(_0xd711('0xe'));var Redis=require(_0xd711('0xf'));var authService=require(_0xd711('0x10'));var qs=require(_0xd711('0x11'));var as=require(_0xd711('0x12'));var hardwareService=require(_0xd711('0x13'));var logger=require(_0xd711('0x14'))(_0xd711('0x15'));var utils=require(_0xd711('0x16'));var config=require(_0xd711('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd711('0x18'))['db'];function respondWithStatusCode(_0x3972af,_0x305f5a){_0x305f5a=_0x305f5a||0xcc;return function(_0x1b3c48){if(_0x1b3c48){return _0x3972af[_0xd711('0x19')](_0x305f5a);}return _0x3972af[_0xd711('0x1a')](_0x305f5a)[_0xd711('0x1b')]();};}function respondWithResult(_0x3a892b,_0x17b99d){_0x17b99d=_0x17b99d||0xc8;return function(_0x10856a){if(_0x10856a){return _0x3a892b[_0xd711('0x1a')](_0x17b99d)['json'](_0x10856a);}};}function respondWithFilteredResult(_0x1b4418,_0x37f56f){return function(_0x49862e){if(_0x49862e){var _0x590ed6=typeof _0x37f56f[_0xd711('0x1c')]===_0xd711('0x1d')&&typeof _0x37f56f[_0xd711('0x1e')]===_0xd711('0x1d');var _0xb844cd=_0x49862e[_0xd711('0x1f')];var _0x29bd45=_0x590ed6?0x0:_0x37f56f[_0xd711('0x1c')];var _0x544795=_0x590ed6?_0x49862e[_0xd711('0x1f')]:_0x37f56f[_0xd711('0x1c')]+_0x37f56f[_0xd711('0x1e')];var _0x5d4dfd;if(_0x544795>=_0xb844cd){_0x544795=_0xb844cd;_0x5d4dfd=0xc8;}else{_0x5d4dfd=0xce;}_0x1b4418[_0xd711('0x1a')](_0x5d4dfd);return _0x1b4418[_0xd711('0x20')](_0xd711('0x21'),_0x29bd45+'-'+_0x544795+'/'+_0xb844cd)[_0xd711('0x22')](_0x49862e);}return null;};}function patchUpdates(_0x17efd2){return function(_0x127f4f){try{jsonpatch[_0xd711('0x23')](_0x127f4f,_0x17efd2,!![]);}catch(_0x2f1d14){return BPromise[_0xd711('0x24')](_0x2f1d14);}return _0x127f4f[_0xd711('0x25')]();};}function saveUpdates(_0x56f931,_0xa018e6){return function(_0x3343d5){if(_0x3343d5){return _0x3343d5['update'](_0x56f931)[_0xd711('0x26')](function(_0x584cd1){return _0x584cd1;});}return null;};}function removeEntity(_0x7d72d7,_0xcc16f0){return function(_0x59877e){if(_0x59877e){return _0x59877e[_0xd711('0x27')]()[_0xd711('0x26')](function(){_0x7d72d7['status'](0xcc)[_0xd711('0x1b')]();});}};}function handleEntityNotFound(_0x3dc074,_0x1be8ec){return function(_0x36620e){if(!_0x36620e){_0x3dc074[_0xd711('0x19')](0x194);}return _0x36620e;};}function handleError(_0x402acd,_0x2aa138){_0x2aa138=_0x2aa138||0x1f4;return function(_0xc3ce6e){logger[_0xd711('0x28')](_0xc3ce6e[_0xd711('0x29')]);if(_0xc3ce6e[_0xd711('0x2a')]){delete _0xc3ce6e['name'];}_0x402acd['status'](_0x2aa138)[_0xd711('0x2b')](_0xc3ce6e);};}exports[_0xd711('0x2c')]=function(_0x1f0cdf,_0x50c114){var _0x31002e={},_0x58411e={},_0x585c54={'count':0x0,'rows':[]};var _0x756a40=_[_0xd711('0x2d')](db[_0xd711('0x2e')][_0xd711('0x2f')],function(_0x29efaa){return{'name':_0x29efaa[_0xd711('0x30')],'type':_0x29efaa[_0xd711('0x31')][_0xd711('0x32')]};});_0x58411e['model']=_[_0xd711('0x2d')](_0x756a40,_0xd711('0x2a'));_0x58411e['query']=_[_0xd711('0x33')](_0x1f0cdf[_0xd711('0x34')]);_0x58411e[_0xd711('0x35')]=_[_0xd711('0x36')](_0x58411e[_0xd711('0x37')],_0x58411e['query']);_0x31002e['attributes']=_[_0xd711('0x36')](_0x58411e['model'],qs[_0xd711('0x38')](_0x1f0cdf[_0xd711('0x34')][_0xd711('0x38')]));_0x31002e[_0xd711('0x39')]=_0x31002e[_0xd711('0x39')][_0xd711('0x3a')]?_0x31002e['attributes']:_0x58411e[_0xd711('0x37')];if(!_0x1f0cdf[_0xd711('0x34')]['hasOwnProperty'](_0xd711('0x3b'))){_0x31002e[_0xd711('0x1e')]=qs[_0xd711('0x1e')](_0x1f0cdf[_0xd711('0x34')]['limit']);_0x31002e['offset']=qs['offset'](_0x1f0cdf['query'][_0xd711('0x1c')]);}_0x31002e[_0xd711('0x3c')]=qs['sort'](_0x1f0cdf[_0xd711('0x34')][_0xd711('0x3d')]);_0x31002e['where']=qs[_0xd711('0x35')](_[_0xd711('0x3e')](_0x1f0cdf['query'],_0x58411e[_0xd711('0x35')]),_0x756a40);if(_0x1f0cdf['query'][_0xd711('0x3f')]){_0x31002e[_0xd711('0x40')]=_['merge'](_0x31002e[_0xd711('0x40')],{'$or':_[_0xd711('0x2d')](_0x756a40,function(_0x30c41d){if(_0x30c41d[_0xd711('0x31')]!=='VIRTUAL'){var _0x2f0736={};_0x2f0736[_0x30c41d[_0xd711('0x2a')]]={'$like':'%'+_0x1f0cdf[_0xd711('0x34')][_0xd711('0x3f')]+'%'};return _0x2f0736;}})});}_0x31002e=_[_0xd711('0x41')]({},_0x31002e,_0x1f0cdf[_0xd711('0x42')]);var _0x4b5718={'where':_0x31002e[_0xd711('0x40')]};return db[_0xd711('0x2e')][_0xd711('0x1f')](_0x4b5718)[_0xd711('0x26')](function(_0x1b1e61){_0x585c54[_0xd711('0x1f')]=_0x1b1e61;if(_0x1f0cdf[_0xd711('0x34')][_0xd711('0x43')]){_0x31002e['include']=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x31002e);})[_0xd711('0x26')](function(_0x3ab63d){_0x585c54['rows']=_0x3ab63d;return _0x585c54;})[_0xd711('0x26')](respondWithFilteredResult(_0x50c114,_0x31002e))[_0xd711('0x44')](handleError(_0x50c114,null));};exports['show']=function(_0x18d3cd,_0x33fbea){var _0x2d3e4a={'raw':![],'where':{'id':_0x18d3cd[_0xd711('0x45')]['id']}},_0x4d6491={};_0x4d6491[_0xd711('0x37')]=_['keys'](db[_0xd711('0x2e')][_0xd711('0x2f')]);_0x4d6491[_0xd711('0x34')]=_[_0xd711('0x33')](_0x18d3cd[_0xd711('0x34')]);_0x4d6491[_0xd711('0x35')]=_[_0xd711('0x36')](_0x4d6491[_0xd711('0x37')],_0x4d6491[_0xd711('0x34')]);_0x2d3e4a[_0xd711('0x39')]=_[_0xd711('0x36')](_0x4d6491[_0xd711('0x37')],qs['fields'](_0x18d3cd[_0xd711('0x34')]['fields']));_0x2d3e4a[_0xd711('0x39')]=_0x2d3e4a[_0xd711('0x39')][_0xd711('0x3a')]?_0x2d3e4a['attributes']:_0x4d6491[_0xd711('0x37')];if(_0x18d3cd[_0xd711('0x34')][_0xd711('0x43')]){_0x2d3e4a[_0xd711('0x46')]=[{'all':!![]}];}_0x2d3e4a=_['merge']({},_0x2d3e4a,_0x18d3cd[_0xd711('0x42')]);return db[_0xd711('0x2e')]['find'](_0x2d3e4a)[_0xd711('0x26')](handleEntityNotFound(_0x33fbea,null))['then'](respondWithResult(_0x33fbea,null))['catch'](handleError(_0x33fbea,null));};exports[_0xd711('0x47')]=function(_0x1560a3,_0x189066){return db[_0xd711('0x2e')]['create'](_0x1560a3[_0xd711('0x48')],{})[_0xd711('0x26')](respondWithResult(_0x189066,0xc9))[_0xd711('0x44')](handleError(_0x189066,null));};exports['update']=function(_0x2adf6c,_0x3fa07e){if(_0x2adf6c[_0xd711('0x48')]['id']){delete _0x2adf6c[_0xd711('0x48')]['id'];}return db[_0xd711('0x2e')][_0xd711('0x49')]({'where':{'id':_0x2adf6c[_0xd711('0x45')]['id']}})[_0xd711('0x26')](handleEntityNotFound(_0x3fa07e,null))[_0xd711('0x26')](saveUpdates(_0x2adf6c[_0xd711('0x48')],null))[_0xd711('0x26')](respondWithResult(_0x3fa07e,null))[_0xd711('0x44')](handleError(_0x3fa07e,null));};exports[_0xd711('0x27')]=function(_0x4f2d14,_0x1a3df1){return db[_0xd711('0x2e')]['find']({'where':{'id':_0x4f2d14['params']['id']}})['then'](handleEntityNotFound(_0x1a3df1,null))[_0xd711('0x26')](removeEntity(_0x1a3df1,null))[_0xd711('0x44')](handleError(_0x1a3df1,null));};exports[_0xd711('0x4a')]=function(_0x2b31cd,_0x520dde,_0x424492){var _0x491c72={};var _0x5ebbd0={};var _0x17d801;var _0x13349c;return db[_0xd711('0x2e')][_0xd711('0x4b')]({'where':{'id':_0x2b31cd[_0xd711('0x45')]['id']}})[_0xd711('0x26')](handleEntityNotFound(_0x520dde,null))['then'](function(_0x271e57){if(_0x271e57){_0x17d801=_0x271e57;_0x5ebbd0[_0xd711('0x37')]=_[_0xd711('0x33')](db[_0xd711('0x4c')][_0xd711('0x2f')]);_0x5ebbd0['query']=_[_0xd711('0x33')](_0x2b31cd['query']);_0x5ebbd0['filters']=_['intersection'](_0x5ebbd0[_0xd711('0x37')],_0x5ebbd0[_0xd711('0x34')]);_0x491c72[_0xd711('0x39')]=_[_0xd711('0x36')](_0x5ebbd0[_0xd711('0x37')],qs[_0xd711('0x38')](_0x2b31cd['query'][_0xd711('0x38')]));_0x491c72[_0xd711('0x39')]=_0x491c72[_0xd711('0x39')]['length']?_0x491c72[_0xd711('0x39')]:_0x5ebbd0[_0xd711('0x37')];_0x491c72[_0xd711('0x3c')]=qs[_0xd711('0x3d')](_0x2b31cd[_0xd711('0x34')][_0xd711('0x3d')]);_0x491c72['where']=qs[_0xd711('0x35')](_[_0xd711('0x3e')](_0x2b31cd[_0xd711('0x34')],_0x5ebbd0[_0xd711('0x35')]));if(_0x2b31cd['query']['filter']){_0x491c72[_0xd711('0x40')]=_[_0xd711('0x41')](_0x491c72[_0xd711('0x40')],{'$or':_['map'](_0x491c72[_0xd711('0x39')],function(_0x548b4c){var _0x490cd0={};_0x490cd0[_0x548b4c]={'$like':'%'+_0x2b31cd[_0xd711('0x34')][_0xd711('0x3f')]+'%'};return _0x490cd0;})});}_0x491c72=_['merge']({},_0x491c72,_0x2b31cd[_0xd711('0x42')]);return _0x17d801[_0xd711('0x4a')](_0x491c72);}})['then'](function(_0x195059){if(_0x195059){_0x13349c=_0x195059[_0xd711('0x3a')];if(!_0x2b31cd[_0xd711('0x34')][_0xd711('0x4d')]('nolimit')){_0x491c72[_0xd711('0x1e')]=qs[_0xd711('0x1e')](_0x2b31cd[_0xd711('0x34')][_0xd711('0x1e')]);_0x491c72[_0xd711('0x1c')]=qs[_0xd711('0x1c')](_0x2b31cd[_0xd711('0x34')][_0xd711('0x1c')]);}return _0x17d801[_0xd711('0x4a')](_0x491c72);}})[_0xd711('0x26')](function(_0xe51d1e){if(_0xe51d1e){return _0xe51d1e?{'count':_0x13349c,'rows':_0xe51d1e}:null;}})[_0xd711('0x26')](respondWithResult(_0x520dde,null))['catch'](handleError(_0x520dde,null));};exports[_0xd711('0x4e')]=function(_0x40ad3c,_0x22f736,_0x172e82){var _0x277c9e={};var _0x5aadf5={};var _0x440791;var _0x57f237;return db[_0xd711('0x2e')]['findOne']({'where':{'id':_0x40ad3c[_0xd711('0x45')]['id']}})[_0xd711('0x26')](handleEntityNotFound(_0x22f736,null))[_0xd711('0x26')](function(_0x4fac69){if(_0x4fac69){_0x440791=_0x4fac69;_0x5aadf5[_0xd711('0x37')]=_[_0xd711('0x33')](db['ZohoField'][_0xd711('0x2f')]);_0x5aadf5[_0xd711('0x34')]=_[_0xd711('0x33')](_0x40ad3c['query']);_0x5aadf5[_0xd711('0x35')]=_[_0xd711('0x36')](_0x5aadf5[_0xd711('0x37')],_0x5aadf5[_0xd711('0x34')]);_0x277c9e[_0xd711('0x39')]=_['intersection'](_0x5aadf5[_0xd711('0x37')],qs[_0xd711('0x38')](_0x40ad3c[_0xd711('0x34')]['fields']));_0x277c9e['attributes']=_0x277c9e[_0xd711('0x39')][_0xd711('0x3a')]?_0x277c9e[_0xd711('0x39')]:_0x5aadf5[_0xd711('0x37')];_0x277c9e[_0xd711('0x3c')]=qs[_0xd711('0x3d')](_0x40ad3c[_0xd711('0x34')][_0xd711('0x3d')]);_0x277c9e[_0xd711('0x40')]=qs[_0xd711('0x35')](_[_0xd711('0x3e')](_0x40ad3c[_0xd711('0x34')],_0x5aadf5[_0xd711('0x35')]));if(_0x40ad3c[_0xd711('0x34')][_0xd711('0x3f')]){_0x277c9e[_0xd711('0x40')]=_[_0xd711('0x41')](_0x277c9e[_0xd711('0x40')],{'$or':_[_0xd711('0x2d')](_0x277c9e[_0xd711('0x39')],function(_0x2b0dc9){var _0x4a8f9e={};_0x4a8f9e[_0x2b0dc9]={'$like':'%'+_0x40ad3c['query'][_0xd711('0x3f')]+'%'};return _0x4a8f9e;})});}_0x277c9e=_[_0xd711('0x41')]({},_0x277c9e,_0x40ad3c['options']);return _0x440791['getSubjects'](_0x277c9e);}})[_0xd711('0x26')](function(_0x30c176){if(_0x30c176){_0x57f237=_0x30c176[_0xd711('0x3a')];if(!_0x40ad3c[_0xd711('0x34')]['hasOwnProperty']('nolimit')){_0x277c9e[_0xd711('0x1e')]=qs['limit'](_0x40ad3c[_0xd711('0x34')][_0xd711('0x1e')]);_0x277c9e[_0xd711('0x1c')]=qs['offset'](_0x40ad3c['query'][_0xd711('0x1c')]);}return _0x440791[_0xd711('0x4e')](_0x277c9e);}})['then'](function(_0x3f1865){if(_0x3f1865){return _0x3f1865?{'count':_0x57f237,'rows':_0x3f1865}:null;}})['then'](respondWithResult(_0x22f736,null))['catch'](handleError(_0x22f736,null));};exports['getDescriptions']=function(_0x43ec5a,_0x40d62c,_0x3a2f00){var _0x33eb7c={};var _0x166a57={};var _0x44a0d0;var _0x53cfa5;return db['ZohoConfiguration'][_0xd711('0x4b')]({'where':{'id':_0x43ec5a[_0xd711('0x45')]['id']}})['then'](handleEntityNotFound(_0x40d62c,null))[_0xd711('0x26')](function(_0x1fedce){if(_0x1fedce){_0x44a0d0=_0x1fedce;_0x166a57['model']=_[_0xd711('0x33')](db[_0xd711('0x4c')]['rawAttributes']);_0x166a57[_0xd711('0x34')]=_[_0xd711('0x33')](_0x43ec5a[_0xd711('0x34')]);_0x166a57[_0xd711('0x35')]=_['intersection'](_0x166a57[_0xd711('0x37')],_0x166a57[_0xd711('0x34')]);_0x33eb7c['attributes']=_[_0xd711('0x36')](_0x166a57[_0xd711('0x37')],qs[_0xd711('0x38')](_0x43ec5a['query']['fields']));_0x33eb7c['attributes']=_0x33eb7c[_0xd711('0x39')][_0xd711('0x3a')]?_0x33eb7c[_0xd711('0x39')]:_0x166a57[_0xd711('0x37')];_0x33eb7c[_0xd711('0x3c')]=qs[_0xd711('0x3d')](_0x43ec5a['query'][_0xd711('0x3d')]);_0x33eb7c['where']=qs[_0xd711('0x35')](_[_0xd711('0x3e')](_0x43ec5a[_0xd711('0x34')],_0x166a57[_0xd711('0x35')]));if(_0x43ec5a[_0xd711('0x34')][_0xd711('0x3f')]){_0x33eb7c[_0xd711('0x40')]=_['merge'](_0x33eb7c[_0xd711('0x40')],{'$or':_['map'](_0x33eb7c[_0xd711('0x39')],function(_0x17fd11){var _0x12036a={};_0x12036a[_0x17fd11]={'$like':'%'+_0x43ec5a[_0xd711('0x34')][_0xd711('0x3f')]+'%'};return _0x12036a;})});}_0x33eb7c=_[_0xd711('0x41')]({},_0x33eb7c,_0x43ec5a[_0xd711('0x42')]);return _0x44a0d0['getDescriptions'](_0x33eb7c);}})[_0xd711('0x26')](function(_0x286a32){if(_0x286a32){_0x53cfa5=_0x286a32[_0xd711('0x3a')];if(!_0x43ec5a[_0xd711('0x34')][_0xd711('0x4d')](_0xd711('0x3b'))){_0x33eb7c[_0xd711('0x1e')]=qs[_0xd711('0x1e')](_0x43ec5a[_0xd711('0x34')][_0xd711('0x1e')]);_0x33eb7c['offset']=qs[_0xd711('0x1c')](_0x43ec5a[_0xd711('0x34')]['offset']);}return _0x44a0d0[_0xd711('0x4f')](_0x33eb7c);}})[_0xd711('0x26')](function(_0x3e91b4){if(_0x3e91b4){return _0x3e91b4?{'count':_0x53cfa5,'rows':_0x3e91b4}:null;}})[_0xd711('0x26')](respondWithResult(_0x40d62c,null))[_0xd711('0x44')](handleError(_0x40d62c,null));}; \ No newline at end of file +var _0x6282=['findAll','catch','show','params','intersection','find','create','body','update','destroy','getFields','findOne','ZohoField','order','pick','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','error','stack','name','send','map','ZohoConfiguration','rawAttributes','key','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','include'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x6282,0x152));var _0x2628=function(_0x24cad0,_0x5df90d){_0x24cad0=_0x24cad0-0x0;var _0xecdecf=_0x6282[_0x24cad0];return _0xecdecf;};'use strict';var emlformat=require(_0x2628('0x0'));var rimraf=require(_0x2628('0x1'));var zipdir=require(_0x2628('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2628('0x3'));var moment=require(_0x2628('0x4'));var BPromise=require(_0x2628('0x5'));var Mustache=require(_0x2628('0x6'));var util=require(_0x2628('0x7'));var path=require(_0x2628('0x8'));var sox=require(_0x2628('0x9'));var csv=require(_0x2628('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2628('0xb'));var _=require(_0x2628('0xc'));var squel=require(_0x2628('0xd'));var crypto=require(_0x2628('0xe'));var jsforce=require(_0x2628('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2628('0x10'));var Redis=require(_0x2628('0x11'));var authService=require(_0x2628('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2628('0x13'));var hardwareService=require(_0x2628('0x14'));var logger=require(_0x2628('0x15'))(_0x2628('0x16'));var utils=require('../../config/utils');var config=require(_0x2628('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2628('0x18'))['db'];function respondWithStatusCode(_0x48bff2,_0x2fb061){_0x2fb061=_0x2fb061||0xcc;return function(_0x3cc410){if(_0x3cc410){return _0x48bff2[_0x2628('0x19')](_0x2fb061);}return _0x48bff2[_0x2628('0x1a')](_0x2fb061)[_0x2628('0x1b')]();};}function respondWithResult(_0x4affcf,_0x28c433){_0x28c433=_0x28c433||0xc8;return function(_0x573845){if(_0x573845){return _0x4affcf[_0x2628('0x1a')](_0x28c433)[_0x2628('0x1c')](_0x573845);}};}function respondWithFilteredResult(_0x11afe8,_0x5a026d){return function(_0x10fd25){if(_0x10fd25){var _0x56757c=typeof _0x5a026d[_0x2628('0x1d')]===_0x2628('0x1e')&&typeof _0x5a026d[_0x2628('0x1f')]===_0x2628('0x1e');var _0x571fee=_0x10fd25['count'];var _0x506e5d=_0x56757c?0x0:_0x5a026d[_0x2628('0x1d')];var _0x20c229=_0x56757c?_0x10fd25[_0x2628('0x20')]:_0x5a026d[_0x2628('0x1d')]+_0x5a026d[_0x2628('0x1f')];var _0x1977f3;if(_0x20c229>=_0x571fee){_0x20c229=_0x571fee;_0x1977f3=0xc8;}else{_0x1977f3=0xce;}_0x11afe8[_0x2628('0x1a')](_0x1977f3);return _0x11afe8[_0x2628('0x21')](_0x2628('0x22'),_0x506e5d+'-'+_0x20c229+'/'+_0x571fee)[_0x2628('0x1c')](_0x10fd25);}return null;};}function patchUpdates(_0x4a3422){return function(_0x4a31c3){try{jsonpatch[_0x2628('0x23')](_0x4a31c3,_0x4a3422,!![]);}catch(_0x43c862){return BPromise['reject'](_0x43c862);}return _0x4a31c3['save']();};}function saveUpdates(_0x6b60c8,_0x4af224){return function(_0x324023){if(_0x324023){return _0x324023['update'](_0x6b60c8)[_0x2628('0x24')](function(_0x5bd2ff){return _0x5bd2ff;});}return null;};}function removeEntity(_0x1684eb,_0x1f727b){return function(_0x5c0627){if(_0x5c0627){return _0x5c0627['destroy']()['then'](function(){_0x1684eb['status'](0xcc)[_0x2628('0x1b')]();});}};}function handleEntityNotFound(_0x1d7a9d,_0x1f9433){return function(_0x4bebd2){if(!_0x4bebd2){_0x1d7a9d[_0x2628('0x19')](0x194);}return _0x4bebd2;};}function handleError(_0x5dc6b8,_0x297ad5){_0x297ad5=_0x297ad5||0x1f4;return function(_0x13efd){logger[_0x2628('0x25')](_0x13efd[_0x2628('0x26')]);if(_0x13efd[_0x2628('0x27')]){delete _0x13efd[_0x2628('0x27')];}_0x5dc6b8[_0x2628('0x1a')](_0x297ad5)[_0x2628('0x28')](_0x13efd);};}exports['index']=function(_0x1ed3ef,_0x43daef){var _0x204c8d={},_0x287f36={},_0x10452e={'count':0x0,'rows':[]};var _0x4e4f95=_[_0x2628('0x29')](db[_0x2628('0x2a')][_0x2628('0x2b')],function(_0x1868de){return{'name':_0x1868de['fieldName'],'type':_0x1868de['type'][_0x2628('0x2c')]};});_0x287f36['model']=_['map'](_0x4e4f95,_0x2628('0x27'));_0x287f36[_0x2628('0x2d')]=_[_0x2628('0x2e')](_0x1ed3ef[_0x2628('0x2d')]);_0x287f36[_0x2628('0x2f')]=_['intersection'](_0x287f36['model'],_0x287f36[_0x2628('0x2d')]);_0x204c8d[_0x2628('0x30')]=_['intersection'](_0x287f36[_0x2628('0x31')],qs[_0x2628('0x32')](_0x1ed3ef[_0x2628('0x2d')]['fields']));_0x204c8d['attributes']=_0x204c8d[_0x2628('0x30')][_0x2628('0x33')]?_0x204c8d[_0x2628('0x30')]:_0x287f36[_0x2628('0x31')];if(!_0x1ed3ef[_0x2628('0x2d')][_0x2628('0x34')](_0x2628('0x35'))){_0x204c8d[_0x2628('0x1f')]=qs['limit'](_0x1ed3ef[_0x2628('0x2d')]['limit']);_0x204c8d['offset']=qs[_0x2628('0x1d')](_0x1ed3ef[_0x2628('0x2d')][_0x2628('0x1d')]);}_0x204c8d['order']=qs[_0x2628('0x36')](_0x1ed3ef[_0x2628('0x2d')]['sort']);_0x204c8d[_0x2628('0x37')]=qs[_0x2628('0x2f')](_['pick'](_0x1ed3ef['query'],_0x287f36['filters']),_0x4e4f95);if(_0x1ed3ef[_0x2628('0x2d')][_0x2628('0x38')]){_0x204c8d['where']=_[_0x2628('0x39')](_0x204c8d[_0x2628('0x37')],{'$or':_['map'](_0x4e4f95,function(_0x43a8bc){if(_0x43a8bc[_0x2628('0x3a')]!==_0x2628('0x3b')){var _0xb2c84f={};_0xb2c84f[_0x43a8bc['name']]={'$like':'%'+_0x1ed3ef[_0x2628('0x2d')][_0x2628('0x38')]+'%'};return _0xb2c84f;}})});}_0x204c8d=_[_0x2628('0x39')]({},_0x204c8d,_0x1ed3ef['options']);var _0x231150={'where':_0x204c8d[_0x2628('0x37')]};return db[_0x2628('0x2a')][_0x2628('0x20')](_0x231150)[_0x2628('0x24')](function(_0x168f2e){_0x10452e[_0x2628('0x20')]=_0x168f2e;if(_0x1ed3ef['query'][_0x2628('0x3c')]){_0x204c8d[_0x2628('0x3d')]=[{'all':!![]}];}return db[_0x2628('0x2a')][_0x2628('0x3e')](_0x204c8d);})['then'](function(_0x2078bd){_0x10452e['rows']=_0x2078bd;return _0x10452e;})[_0x2628('0x24')](respondWithFilteredResult(_0x43daef,_0x204c8d))[_0x2628('0x3f')](handleError(_0x43daef,null));};exports[_0x2628('0x40')]=function(_0x584f06,_0x3aa958){var _0x35e4c4={'raw':![],'where':{'id':_0x584f06[_0x2628('0x41')]['id']}},_0x413643={};_0x413643[_0x2628('0x31')]=_[_0x2628('0x2e')](db[_0x2628('0x2a')][_0x2628('0x2b')]);_0x413643['query']=_[_0x2628('0x2e')](_0x584f06[_0x2628('0x2d')]);_0x413643['filters']=_[_0x2628('0x42')](_0x413643[_0x2628('0x31')],_0x413643[_0x2628('0x2d')]);_0x35e4c4[_0x2628('0x30')]=_['intersection'](_0x413643['model'],qs['fields'](_0x584f06[_0x2628('0x2d')][_0x2628('0x32')]));_0x35e4c4['attributes']=_0x35e4c4['attributes'][_0x2628('0x33')]?_0x35e4c4[_0x2628('0x30')]:_0x413643[_0x2628('0x31')];if(_0x584f06[_0x2628('0x2d')][_0x2628('0x3c')]){_0x35e4c4[_0x2628('0x3d')]=[{'all':!![]}];}_0x35e4c4=_[_0x2628('0x39')]({},_0x35e4c4,_0x584f06['options']);return db[_0x2628('0x2a')][_0x2628('0x43')](_0x35e4c4)[_0x2628('0x24')](handleEntityNotFound(_0x3aa958,null))[_0x2628('0x24')](respondWithResult(_0x3aa958,null))[_0x2628('0x3f')](handleError(_0x3aa958,null));};exports['create']=function(_0x5bc9af,_0x4239c7){return db[_0x2628('0x2a')][_0x2628('0x44')](_0x5bc9af[_0x2628('0x45')],{})['then'](respondWithResult(_0x4239c7,0xc9))['catch'](handleError(_0x4239c7,null));};exports[_0x2628('0x46')]=function(_0x2f0c49,_0x4bd048){if(_0x2f0c49[_0x2628('0x45')]['id']){delete _0x2f0c49[_0x2628('0x45')]['id'];}return db['ZohoConfiguration'][_0x2628('0x43')]({'where':{'id':_0x2f0c49[_0x2628('0x41')]['id']}})['then'](handleEntityNotFound(_0x4bd048,null))[_0x2628('0x24')](saveUpdates(_0x2f0c49[_0x2628('0x45')],null))[_0x2628('0x24')](respondWithResult(_0x4bd048,null))[_0x2628('0x3f')](handleError(_0x4bd048,null));};exports[_0x2628('0x47')]=function(_0x1aedd0,_0x22e1e8){return db[_0x2628('0x2a')][_0x2628('0x43')]({'where':{'id':_0x1aedd0['params']['id']}})[_0x2628('0x24')](handleEntityNotFound(_0x22e1e8,null))[_0x2628('0x24')](removeEntity(_0x22e1e8,null))[_0x2628('0x3f')](handleError(_0x22e1e8,null));};exports[_0x2628('0x48')]=function(_0x4e393b,_0x310c0b,_0x286f41){var _0x444e0c={};var _0x557f50={};var _0xb47580;var _0x3241ff;return db[_0x2628('0x2a')][_0x2628('0x49')]({'where':{'id':_0x4e393b[_0x2628('0x41')]['id']}})[_0x2628('0x24')](handleEntityNotFound(_0x310c0b,null))[_0x2628('0x24')](function(_0x5c38b1){if(_0x5c38b1){_0xb47580=_0x5c38b1;_0x557f50[_0x2628('0x31')]=_[_0x2628('0x2e')](db[_0x2628('0x4a')][_0x2628('0x2b')]);_0x557f50[_0x2628('0x2d')]=_[_0x2628('0x2e')](_0x4e393b['query']);_0x557f50[_0x2628('0x2f')]=_[_0x2628('0x42')](_0x557f50['model'],_0x557f50[_0x2628('0x2d')]);_0x444e0c[_0x2628('0x30')]=_[_0x2628('0x42')](_0x557f50[_0x2628('0x31')],qs[_0x2628('0x32')](_0x4e393b[_0x2628('0x2d')][_0x2628('0x32')]));_0x444e0c[_0x2628('0x30')]=_0x444e0c[_0x2628('0x30')][_0x2628('0x33')]?_0x444e0c[_0x2628('0x30')]:_0x557f50[_0x2628('0x31')];_0x444e0c[_0x2628('0x4b')]=qs[_0x2628('0x36')](_0x4e393b[_0x2628('0x2d')][_0x2628('0x36')]);_0x444e0c['where']=qs[_0x2628('0x2f')](_[_0x2628('0x4c')](_0x4e393b[_0x2628('0x2d')],_0x557f50[_0x2628('0x2f')]));if(_0x4e393b[_0x2628('0x2d')][_0x2628('0x38')]){_0x444e0c['where']=_[_0x2628('0x39')](_0x444e0c['where'],{'$or':_[_0x2628('0x29')](_0x444e0c['attributes'],function(_0x337ff6){var _0x27b3a2={};_0x27b3a2[_0x337ff6]={'$like':'%'+_0x4e393b['query'][_0x2628('0x38')]+'%'};return _0x27b3a2;})});}_0x444e0c=_['merge']({},_0x444e0c,_0x4e393b[_0x2628('0x4d')]);return _0xb47580[_0x2628('0x48')](_0x444e0c);}})[_0x2628('0x24')](function(_0x29337c){if(_0x29337c){_0x3241ff=_0x29337c['length'];if(!_0x4e393b[_0x2628('0x2d')][_0x2628('0x34')](_0x2628('0x35'))){_0x444e0c['limit']=qs['limit'](_0x4e393b['query'][_0x2628('0x1f')]);_0x444e0c[_0x2628('0x1d')]=qs['offset'](_0x4e393b[_0x2628('0x2d')]['offset']);}return _0xb47580['getFields'](_0x444e0c);}})[_0x2628('0x24')](function(_0x3acf51){if(_0x3acf51){return _0x3acf51?{'count':_0x3241ff,'rows':_0x3acf51}:null;}})[_0x2628('0x24')](respondWithResult(_0x310c0b,null))[_0x2628('0x3f')](handleError(_0x310c0b,null));};exports[_0x2628('0x4e')]=function(_0x7981a4,_0x409c62,_0x204db8){var _0x21547a={};var _0x1c7936={};var _0x944c39;var _0x590b54;return db[_0x2628('0x2a')][_0x2628('0x49')]({'where':{'id':_0x7981a4['params']['id']}})[_0x2628('0x24')](handleEntityNotFound(_0x409c62,null))['then'](function(_0x5c0ea1){if(_0x5c0ea1){_0x944c39=_0x5c0ea1;_0x1c7936['model']=_['keys'](db[_0x2628('0x4a')][_0x2628('0x2b')]);_0x1c7936[_0x2628('0x2d')]=_[_0x2628('0x2e')](_0x7981a4[_0x2628('0x2d')]);_0x1c7936[_0x2628('0x2f')]=_['intersection'](_0x1c7936[_0x2628('0x31')],_0x1c7936['query']);_0x21547a['attributes']=_[_0x2628('0x42')](_0x1c7936[_0x2628('0x31')],qs[_0x2628('0x32')](_0x7981a4[_0x2628('0x2d')]['fields']));_0x21547a[_0x2628('0x30')]=_0x21547a[_0x2628('0x30')][_0x2628('0x33')]?_0x21547a[_0x2628('0x30')]:_0x1c7936[_0x2628('0x31')];_0x21547a[_0x2628('0x4b')]=qs['sort'](_0x7981a4[_0x2628('0x2d')][_0x2628('0x36')]);_0x21547a[_0x2628('0x37')]=qs['filters'](_[_0x2628('0x4c')](_0x7981a4[_0x2628('0x2d')],_0x1c7936[_0x2628('0x2f')]));if(_0x7981a4[_0x2628('0x2d')][_0x2628('0x38')]){_0x21547a[_0x2628('0x37')]=_[_0x2628('0x39')](_0x21547a[_0x2628('0x37')],{'$or':_['map'](_0x21547a[_0x2628('0x30')],function(_0x1ebf1b){var _0x52e212={};_0x52e212[_0x1ebf1b]={'$like':'%'+_0x7981a4[_0x2628('0x2d')]['filter']+'%'};return _0x52e212;})});}_0x21547a=_['merge']({},_0x21547a,_0x7981a4[_0x2628('0x4d')]);return _0x944c39[_0x2628('0x4e')](_0x21547a);}})['then'](function(_0x40f169){if(_0x40f169){_0x590b54=_0x40f169[_0x2628('0x33')];if(!_0x7981a4[_0x2628('0x2d')]['hasOwnProperty'](_0x2628('0x35'))){_0x21547a['limit']=qs['limit'](_0x7981a4[_0x2628('0x2d')][_0x2628('0x1f')]);_0x21547a[_0x2628('0x1d')]=qs[_0x2628('0x1d')](_0x7981a4[_0x2628('0x2d')][_0x2628('0x1d')]);}return _0x944c39['getSubjects'](_0x21547a);}})[_0x2628('0x24')](function(_0x22873a){if(_0x22873a){return _0x22873a?{'count':_0x590b54,'rows':_0x22873a}:null;}})[_0x2628('0x24')](respondWithResult(_0x409c62,null))[_0x2628('0x3f')](handleError(_0x409c62,null));};exports['getDescriptions']=function(_0x2c785e,_0x3203d1,_0x7d72d0){var _0x2b8b24={};var _0x9d256a={};var _0x14ce54;var _0x53ddfd;return db[_0x2628('0x2a')][_0x2628('0x49')]({'where':{'id':_0x2c785e[_0x2628('0x41')]['id']}})['then'](handleEntityNotFound(_0x3203d1,null))[_0x2628('0x24')](function(_0x2401fa){if(_0x2401fa){_0x14ce54=_0x2401fa;_0x9d256a[_0x2628('0x31')]=_[_0x2628('0x2e')](db[_0x2628('0x4a')][_0x2628('0x2b')]);_0x9d256a[_0x2628('0x2d')]=_[_0x2628('0x2e')](_0x2c785e[_0x2628('0x2d')]);_0x9d256a[_0x2628('0x2f')]=_['intersection'](_0x9d256a[_0x2628('0x31')],_0x9d256a[_0x2628('0x2d')]);_0x2b8b24[_0x2628('0x30')]=_[_0x2628('0x42')](_0x9d256a[_0x2628('0x31')],qs[_0x2628('0x32')](_0x2c785e[_0x2628('0x2d')][_0x2628('0x32')]));_0x2b8b24[_0x2628('0x30')]=_0x2b8b24[_0x2628('0x30')][_0x2628('0x33')]?_0x2b8b24['attributes']:_0x9d256a['model'];_0x2b8b24[_0x2628('0x4b')]=qs[_0x2628('0x36')](_0x2c785e['query'][_0x2628('0x36')]);_0x2b8b24[_0x2628('0x37')]=qs[_0x2628('0x2f')](_['pick'](_0x2c785e[_0x2628('0x2d')],_0x9d256a[_0x2628('0x2f')]));if(_0x2c785e[_0x2628('0x2d')][_0x2628('0x38')]){_0x2b8b24[_0x2628('0x37')]=_[_0x2628('0x39')](_0x2b8b24[_0x2628('0x37')],{'$or':_[_0x2628('0x29')](_0x2b8b24[_0x2628('0x30')],function(_0x3b3095){var _0x1ec61f={};_0x1ec61f[_0x3b3095]={'$like':'%'+_0x2c785e[_0x2628('0x2d')][_0x2628('0x38')]+'%'};return _0x1ec61f;})});}_0x2b8b24=_[_0x2628('0x39')]({},_0x2b8b24,_0x2c785e[_0x2628('0x4d')]);return _0x14ce54[_0x2628('0x4f')](_0x2b8b24);}})[_0x2628('0x24')](function(_0x4daebe){if(_0x4daebe){_0x53ddfd=_0x4daebe[_0x2628('0x33')];if(!_0x2c785e[_0x2628('0x2d')][_0x2628('0x34')]('nolimit')){_0x2b8b24[_0x2628('0x1f')]=qs['limit'](_0x2c785e[_0x2628('0x2d')][_0x2628('0x1f')]);_0x2b8b24['offset']=qs[_0x2628('0x1d')](_0x2c785e[_0x2628('0x2d')][_0x2628('0x1d')]);}return _0x14ce54['getDescriptions'](_0x2b8b24);}})[_0x2628('0x24')](function(_0x2cf603){if(_0x2cf603){return _0x2cf603?{'count':_0x53ddfd,'rows':_0x2cf603}:null;}})[_0x2628('0x24')](respondWithResult(_0x3203d1,null))[_0x2628('0x3f')](handleError(_0x3203d1,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d1629a9..8fc552e 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 _0xadab=['../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3d22fa,_0x4612af){var _0x312f6f=function(_0x321223){while(--_0x321223){_0x3d22fa['push'](_0x3d22fa['shift']());}};_0x312f6f(++_0x4612af);}(_0xadab,0xd5));var _0xbada=function(_0x171520,_0x1cee8c){_0x171520=_0x171520-0x0;var _0x3cc729=_0xadab[_0x171520];return _0x3cc729;};'use strict';var _=require(_0xbada('0x0'));var util=require(_0xbada('0x1'));var logger=require('../../config/logger')(_0xbada('0x2'));var moment=require(_0xbada('0x3'));var BPromise=require(_0xbada('0x4'));var rp=require(_0xbada('0x5'));var fs=require('fs');var path=require(_0xbada('0x6'));var rimraf=require('rimraf');var config=require(_0xbada('0x7'));var attributes=require(_0xbada('0x8'));module['exports']=function(_0x59e539,_0x140138){return _0x59e539[_0xbada('0x9')](_0xbada('0xa'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd788=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x1d9d4f,_0x504219){var _0x3577cf=function(_0x3f90c8){while(--_0x3f90c8){_0x1d9d4f['push'](_0x1d9d4f['shift']());}};_0x3577cf(++_0x504219);}(_0xd788,0xcd));var _0x8d78=function(_0xf9da15,_0x9a2849){_0xf9da15=_0xf9da15-0x0;var _0x19d973=_0xd788[_0xf9da15];return _0x19d973;};'use strict';var _=require(_0x8d78('0x0'));var util=require(_0x8d78('0x1'));var logger=require(_0x8d78('0x2'))(_0x8d78('0x3'));var moment=require(_0x8d78('0x4'));var BPromise=require(_0x8d78('0x5'));var rp=require(_0x8d78('0x6'));var fs=require('fs');var path=require(_0x8d78('0x7'));var rimraf=require(_0x8d78('0x8'));var config=require(_0x8d78('0x9'));var attributes=require(_0x8d78('0xa'));module[_0x8d78('0xb')]=function(_0x17407b,_0x5dd517){return _0x17407b[_0x8d78('0xc')](_0x8d78('0xd'),attributes,{'tableName':_0x8d78('0xe'),'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 7fb8cb8..ea9f3ae 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 _0x516d=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1912c4,_0x58daaf){var _0x498a28=function(_0x5ce073){while(--_0x5ce073){_0x1912c4['push'](_0x1912c4['shift']());}};_0x498a28(++_0x58daaf);}(_0x516d,0x149));var _0xd516=function(_0x5a58db,_0x2d7f41){_0x5a58db=_0x5a58db-0x0;var _0x42dd9a=_0x516d[_0x5a58db];return _0x42dd9a;};'use strict';var _=require(_0xd516('0x0'));var util=require(_0xd516('0x1'));var moment=require(_0xd516('0x2'));var BPromise=require('bluebird');var rs=require(_0xd516('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd516('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd516('0x5'))(_0xd516('0x6'));var config=require(_0xd516('0x7'));var jayson=require(_0xd516('0x8'));var client=jayson[_0xd516('0x9')][_0xd516('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37cfc8,_0x54c312,_0x5b3910){return new BPromise(function(_0x220de2,_0xdba68e){return client['request'](_0x37cfc8,_0x5b3910)[_0xd516('0xb')](function(_0x4f51f7){logger[_0xd516('0xc')](_0xd516('0xd'),_0x54c312,_0xd516('0xe'));logger[_0xd516('0xf')](_0xd516('0x10'),_0x54c312,_0xd516('0xe'),JSON[_0xd516('0x11')](_0x4f51f7));if(_0x4f51f7[_0xd516('0x12')]){if(_0x4f51f7[_0xd516('0x12')][_0xd516('0x13')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x54c312,_0x4f51f7[_0xd516('0x12')][_0xd516('0x14')]);return _0xdba68e(_0x4f51f7[_0xd516('0x12')]['message']);}logger[_0xd516('0x12')](_0xd516('0xd'),_0x54c312,_0x4f51f7[_0xd516('0x12')][_0xd516('0x14')]);return _0x220de2(_0x4f51f7[_0xd516('0x12')]['message']);}else{logger[_0xd516('0xc')](_0xd516('0xd'),_0x54c312,_0xd516('0xe'));_0x220de2(_0x4f51f7[_0xd516('0x15')][_0xd516('0x14')]);}})[_0xd516('0x16')](function(_0x17d094){logger[_0xd516('0x12')](_0xd516('0xd'),_0x54c312,_0x17d094);_0xdba68e(_0x17d094);});});} \ No newline at end of file +var _0xf411=['util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x5cbd05,_0xcead5){var _0x1b961b=function(_0x583302){while(--_0x583302){_0x5cbd05['push'](_0x5cbd05['shift']());}};_0x1b961b(++_0xcead5);}(_0xf411,0x98));var _0x1f41=function(_0x58df94,_0x4d907b){_0x58df94=_0x58df94-0x0;var _0x4e38a8=_0xf411[_0x58df94];return _0x4e38a8;};'use strict';var _=require('lodash');var util=require(_0x1f41('0x0'));var moment=require(_0x1f41('0x1'));var BPromise=require('bluebird');var rs=require(_0x1f41('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f41('0x3'))['db'];var utils=require(_0x1f41('0x4'));var logger=require('../../config/logger')(_0x1f41('0x5'));var config=require(_0x1f41('0x6'));var jayson=require(_0x1f41('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x439974,_0x210096,_0x1973ec){return new BPromise(function(_0x16e88c,_0x1742ea){return client[_0x1f41('0x8')](_0x439974,_0x1973ec)[_0x1f41('0x9')](function(_0x308d9e){logger[_0x1f41('0xa')](_0x1f41('0xb'),_0x210096,_0x1f41('0xc'));logger[_0x1f41('0xd')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x210096,'request\x20sent',JSON[_0x1f41('0xe')](_0x308d9e));if(_0x308d9e[_0x1f41('0xf')]){if(_0x308d9e[_0x1f41('0xf')][_0x1f41('0x10')]===0x1f4){logger[_0x1f41('0xf')](_0x1f41('0xb'),_0x210096,_0x308d9e[_0x1f41('0xf')]['message']);return _0x1742ea(_0x308d9e['error']['message']);}logger[_0x1f41('0xf')](_0x1f41('0xb'),_0x210096,_0x308d9e[_0x1f41('0xf')][_0x1f41('0x11')]);return _0x16e88c(_0x308d9e['error']['message']);}else{logger[_0x1f41('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x210096,_0x1f41('0xc'));_0x16e88c(_0x308d9e[_0x1f41('0x12')]['message']);}})['catch'](function(_0x32bc97){logger[_0x1f41('0xf')](_0x1f41('0xb'),_0x210096,_0x32bc97);_0x1742ea(_0x32bc97);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 39f49a2..fc03cf1 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 _0xf6f7=['/:id','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index'];(function(_0x5bf400,_0x182b1a){var _0x3f6d56=function(_0x3c1568){while(--_0x3c1568){_0x5bf400['push'](_0x5bf400['shift']());}};_0x3f6d56(++_0x182b1a);}(_0xf6f7,0xaa));var _0x7f6f=function(_0x54e6f5,_0x4f4e99){_0x54e6f5=_0x54e6f5-0x0;var _0x5e8794=_0xf6f7[_0x54e6f5];return _0x5e8794;};'use strict';var multer=require(_0x7f6f('0x0'));var util=require(_0x7f6f('0x1'));var path=require(_0x7f6f('0x2'));var timeout=require(_0x7f6f('0x3'));var express=require(_0x7f6f('0x4'));var router=express[_0x7f6f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7f6f('0x6'));var config=require('../../config/environment');var controller=require(_0x7f6f('0x7'));router['get']('/',auth[_0x7f6f('0x8')](),controller[_0x7f6f('0x9')]);router['get'](_0x7f6f('0xa'),auth[_0x7f6f('0x8')](),controller['show']);router[_0x7f6f('0xb')]('/',auth[_0x7f6f('0x8')](),controller['create']);router[_0x7f6f('0xc')](_0x7f6f('0xa'),auth['isAuthenticated'](),controller[_0x7f6f('0xd')]);router['delete'](_0x7f6f('0xa'),auth[_0x7f6f('0x8')](),controller[_0x7f6f('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa5c3=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa5c3,0x76));var _0x3a5c=function(_0x48774b,_0x177e6b){_0x48774b=_0x48774b-0x0;var _0x24d2cf=_0xa5c3[_0x48774b];return _0x24d2cf;};'use strict';var multer=require(_0x3a5c('0x0'));var util=require(_0x3a5c('0x1'));var path=require(_0x3a5c('0x2'));var timeout=require('connect-timeout');var express=require(_0x3a5c('0x3'));var router=express['Router']();var fs_extra=require(_0x3a5c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3a5c('0x5'));var config=require(_0x3a5c('0x6'));var controller=require(_0x3a5c('0x7'));router[_0x3a5c('0x8')]('/',auth[_0x3a5c('0x9')](),controller[_0x3a5c('0xa')]);router[_0x3a5c('0x8')](_0x3a5c('0xb'),auth[_0x3a5c('0x9')](),controller[_0x3a5c('0xc')]);router[_0x3a5c('0xd')]('/',auth[_0x3a5c('0x9')](),controller[_0x3a5c('0xe')]);router['put'](_0x3a5c('0xb'),auth['isAuthenticated'](),controller[_0x3a5c('0xf')]);router[_0x3a5c('0x10')]('/:id',auth[_0x3a5c('0x9')](),controller[_0x3a5c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index db037e6..2e0ef07 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 _0xcd14=['sequelize','exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xcd14,0x70));var _0x4cd1=function(_0x3298e0,_0x258ae5){_0x3298e0=_0x3298e0-0x0;var _0x334893=_0xcd14[_0x3298e0];return _0x334893;};'use strict';var Sequelize=require(_0x4cd1('0x0'));module[_0x4cd1('0x1')]={'type':{'type':Sequelize[_0x4cd1('0x2')](_0x4cd1('0x3'),_0x4cd1('0x4'),_0x4cd1('0x5'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x4cd1('0x6')]},'key':{'type':Sequelize[_0x4cd1('0x6')]},'keyType':{'type':Sequelize[_0x4cd1('0x2')](_0x4cd1('0x3'),_0x4cd1('0x4'),_0x4cd1('0x5'))},'keyContent':{'type':Sequelize[_0x4cd1('0x6')]},'idField':{'type':Sequelize[_0x4cd1('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4cd1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4cd1('0x6')]}}; \ No newline at end of file +var _0xa970=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x34b02a,_0xc897da){var _0x393178=function(_0x465fbf){while(--_0x465fbf){_0x34b02a['push'](_0x34b02a['shift']());}};_0x393178(++_0xc897da);}(_0xa970,0x1dc));var _0x0a97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa970[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0a97('0x0'));module[_0x0a97('0x1')]={'type':{'type':Sequelize[_0x0a97('0x2')](_0x0a97('0x3'),_0x0a97('0x4'),_0x0a97('0x5'),'keyValue',_0x0a97('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0a97('0x7')]},'key':{'type':Sequelize[_0x0a97('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x0a97('0x4'),_0x0a97('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0a97('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0a97('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 6672dc2..39921fa 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 _0xb35e=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','map','ZohoField','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','rawAttributes','length','include','find','create','body','params'];(function(_0x203bda,_0x17876b){var _0x18799d=function(_0x2e1cbe){while(--_0x2e1cbe){_0x203bda['push'](_0x203bda['shift']());}};_0x18799d(++_0x17876b);}(_0xb35e,0x96));var _0xeb35=function(_0x4c33e8,_0x27181d){_0x4c33e8=_0x4c33e8-0x0;var _0x3c9134=_0xb35e[_0x4c33e8];return _0x3c9134;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb35('0x0'));var zipdir=require(_0xeb35('0x1'));var jsonpatch=require(_0xeb35('0x2'));var rp=require(_0xeb35('0x3'));var moment=require(_0xeb35('0x4'));var BPromise=require(_0xeb35('0x5'));var Mustache=require('mustache');var util=require(_0xeb35('0x6'));var path=require(_0xeb35('0x7'));var sox=require(_0xeb35('0x8'));var csv=require(_0xeb35('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb35('0xa'));var _=require(_0xeb35('0xb'));var squel=require(_0xeb35('0xc'));var crypto=require(_0xeb35('0xd'));var jsforce=require(_0xeb35('0xe'));var deskjs=require(_0xeb35('0xf'));var toCsv=require(_0xeb35('0x9'));var querystring=require(_0xeb35('0x10'));var Papa=require(_0xeb35('0x11'));var Redis=require(_0xeb35('0x12'));var authService=require(_0xeb35('0x13'));var qs=require(_0xeb35('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xeb35('0x15'));var config=require(_0xeb35('0x16'));var licenseUtil=require(_0xeb35('0x17'));var db=require(_0xeb35('0x18'))['db'];function respondWithStatusCode(_0x39b127,_0x4000b7){_0x4000b7=_0x4000b7||0xcc;return function(_0x242f6d){if(_0x242f6d){return _0x39b127['sendStatus'](_0x4000b7);}return _0x39b127[_0xeb35('0x19')](_0x4000b7)[_0xeb35('0x1a')]();};}function respondWithResult(_0x1685a1,_0x393735){_0x393735=_0x393735||0xc8;return function(_0x4f220f){if(_0x4f220f){return _0x1685a1[_0xeb35('0x19')](_0x393735)[_0xeb35('0x1b')](_0x4f220f);}};}function respondWithFilteredResult(_0x47e049,_0x2874bf){return function(_0xe12c30){if(_0xe12c30){var _0x411280=typeof _0x2874bf[_0xeb35('0x1c')]===_0xeb35('0x1d')&&typeof _0x2874bf[_0xeb35('0x1e')]==='undefined';var _0x4cfe65=_0xe12c30[_0xeb35('0x1f')];var _0x3e564b=_0x411280?0x0:_0x2874bf[_0xeb35('0x1c')];var _0x1475f3=_0x411280?_0xe12c30['count']:_0x2874bf[_0xeb35('0x1c')]+_0x2874bf[_0xeb35('0x1e')];var _0x1f82ad;if(_0x1475f3>=_0x4cfe65){_0x1475f3=_0x4cfe65;_0x1f82ad=0xc8;}else{_0x1f82ad=0xce;}_0x47e049[_0xeb35('0x19')](_0x1f82ad);return _0x47e049[_0xeb35('0x20')](_0xeb35('0x21'),_0x3e564b+'-'+_0x1475f3+'/'+_0x4cfe65)['json'](_0xe12c30);}return null;};}function patchUpdates(_0x16619e){return function(_0x278078){try{jsonpatch[_0xeb35('0x22')](_0x278078,_0x16619e,!![]);}catch(_0x1e8a11){return BPromise[_0xeb35('0x23')](_0x1e8a11);}return _0x278078[_0xeb35('0x24')]();};}function saveUpdates(_0x54324b,_0x11f519){return function(_0x3f4394){if(_0x3f4394){return _0x3f4394[_0xeb35('0x25')](_0x54324b)['then'](function(_0xa11d27){return _0xa11d27;});}return null;};}function removeEntity(_0x14fb11,_0x1be403){return function(_0x1edc3f){if(_0x1edc3f){return _0x1edc3f[_0xeb35('0x26')]()[_0xeb35('0x27')](function(){_0x14fb11[_0xeb35('0x19')](0xcc)[_0xeb35('0x1a')]();});}};}function handleEntityNotFound(_0x46b01f,_0x4fe7ca){return function(_0x31ebe5){if(!_0x31ebe5){_0x46b01f[_0xeb35('0x28')](0x194);}return _0x31ebe5;};}function handleError(_0x68a444,_0x4c823c){_0x4c823c=_0x4c823c||0x1f4;return function(_0x2a71bd){logger[_0xeb35('0x29')](_0x2a71bd['stack']);if(_0x2a71bd[_0xeb35('0x2a')]){delete _0x2a71bd['name'];}_0x68a444[_0xeb35('0x19')](_0x4c823c)[_0xeb35('0x2b')](_0x2a71bd);};}exports['index']=function(_0x33e28c,_0x39319e){var _0x5ba229={},_0x2ebdc5={},_0x3f4732={'count':0x0,'rows':[]};var _0x2e95e1=_[_0xeb35('0x2c')](db[_0xeb35('0x2d')]['rawAttributes'],function(_0x44d6ac){return{'name':_0x44d6ac[_0xeb35('0x2e')],'type':_0x44d6ac[_0xeb35('0x2f')]['key']};});_0x2ebdc5[_0xeb35('0x30')]=_['map'](_0x2e95e1,_0xeb35('0x2a'));_0x2ebdc5[_0xeb35('0x31')]=_[_0xeb35('0x32')](_0x33e28c[_0xeb35('0x31')]);_0x2ebdc5[_0xeb35('0x33')]=_[_0xeb35('0x34')](_0x2ebdc5[_0xeb35('0x30')],_0x2ebdc5[_0xeb35('0x31')]);_0x5ba229[_0xeb35('0x35')]=_[_0xeb35('0x34')](_0x2ebdc5[_0xeb35('0x30')],qs[_0xeb35('0x36')](_0x33e28c['query'][_0xeb35('0x36')]));_0x5ba229[_0xeb35('0x35')]=_0x5ba229[_0xeb35('0x35')]['length']?_0x5ba229['attributes']:_0x2ebdc5[_0xeb35('0x30')];if(!_0x33e28c['query']['hasOwnProperty'](_0xeb35('0x37'))){_0x5ba229[_0xeb35('0x1e')]=qs['limit'](_0x33e28c[_0xeb35('0x31')][_0xeb35('0x1e')]);_0x5ba229['offset']=qs[_0xeb35('0x1c')](_0x33e28c[_0xeb35('0x31')][_0xeb35('0x1c')]);}_0x5ba229[_0xeb35('0x38')]=qs[_0xeb35('0x39')](_0x33e28c[_0xeb35('0x31')]['sort']);_0x5ba229['where']=qs[_0xeb35('0x33')](_[_0xeb35('0x3a')](_0x33e28c[_0xeb35('0x31')],_0x2ebdc5['filters']),_0x2e95e1);if(_0x33e28c[_0xeb35('0x31')][_0xeb35('0x3b')]){_0x5ba229[_0xeb35('0x3c')]=_[_0xeb35('0x3d')](_0x5ba229[_0xeb35('0x3c')],{'$or':_[_0xeb35('0x2c')](_0x2e95e1,function(_0x1a0040){if(_0x1a0040['type']!==_0xeb35('0x3e')){var _0x23605c={};_0x23605c[_0x1a0040['name']]={'$like':'%'+_0x33e28c[_0xeb35('0x31')][_0xeb35('0x3b')]+'%'};return _0x23605c;}})});}_0x5ba229=_[_0xeb35('0x3d')]({},_0x5ba229,_0x33e28c[_0xeb35('0x3f')]);var _0xac5907={'where':_0x5ba229[_0xeb35('0x3c')]};return db['ZohoField']['count'](_0xac5907)['then'](function(_0x5340b1){_0x3f4732['count']=_0x5340b1;if(_0x33e28c['query'][_0xeb35('0x40')]){_0x5ba229['include']=[{'all':!![]}];}return db['ZohoField'][_0xeb35('0x41')](_0x5ba229);})['then'](function(_0x379951){_0x3f4732[_0xeb35('0x42')]=_0x379951;return _0x3f4732;})['then'](respondWithFilteredResult(_0x39319e,_0x5ba229))[_0xeb35('0x43')](handleError(_0x39319e,null));};exports['show']=function(_0x4bc940,_0x19311b){var _0x42a160={'raw':!![],'where':{'id':_0x4bc940['params']['id']}},_0x58877d={};_0x58877d['model']=_[_0xeb35('0x32')](db['ZohoField'][_0xeb35('0x44')]);_0x58877d['query']=_[_0xeb35('0x32')](_0x4bc940[_0xeb35('0x31')]);_0x58877d['filters']=_[_0xeb35('0x34')](_0x58877d[_0xeb35('0x30')],_0x58877d[_0xeb35('0x31')]);_0x42a160[_0xeb35('0x35')]=_[_0xeb35('0x34')](_0x58877d['model'],qs[_0xeb35('0x36')](_0x4bc940[_0xeb35('0x31')]['fields']));_0x42a160['attributes']=_0x42a160['attributes'][_0xeb35('0x45')]?_0x42a160[_0xeb35('0x35')]:_0x58877d[_0xeb35('0x30')];if(_0x4bc940[_0xeb35('0x31')]['includeAll']){_0x42a160[_0xeb35('0x46')]=[{'all':!![]}];}_0x42a160=_[_0xeb35('0x3d')]({},_0x42a160,_0x4bc940[_0xeb35('0x3f')]);return db[_0xeb35('0x2d')][_0xeb35('0x47')](_0x42a160)[_0xeb35('0x27')](handleEntityNotFound(_0x19311b,null))[_0xeb35('0x27')](respondWithResult(_0x19311b,null))[_0xeb35('0x43')](handleError(_0x19311b,null));};exports['create']=function(_0x48b76e,_0x33d184){return db['ZohoField'][_0xeb35('0x48')](_0x48b76e['body'],{})['then'](respondWithResult(_0x33d184,0xc9))[_0xeb35('0x43')](handleError(_0x33d184,null));};exports[_0xeb35('0x25')]=function(_0x173d76,_0xdbd562){if(_0x173d76['body']['id']){delete _0x173d76[_0xeb35('0x49')]['id'];}return db['ZohoField'][_0xeb35('0x47')]({'where':{'id':_0x173d76[_0xeb35('0x4a')]['id']}})[_0xeb35('0x27')](handleEntityNotFound(_0xdbd562,null))['then'](saveUpdates(_0x173d76[_0xeb35('0x49')],null))[_0xeb35('0x27')](respondWithResult(_0xdbd562,null))[_0xeb35('0x43')](handleError(_0xdbd562,null));};exports['destroy']=function(_0xc55129,_0x5551d5){return db[_0xeb35('0x2d')]['find']({'where':{'id':_0xc55129[_0xeb35('0x4a')]['id']}})[_0xeb35('0x27')](handleEntityNotFound(_0x5551d5,null))['then'](removeEntity(_0x5551d5,null))[_0xeb35('0x43')](handleError(_0x5551d5,null));}; \ No newline at end of file +var _0x8be9=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','destroy','then','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','type','merge','options','include','rows','show','fields','includeAll','find','update','body','catch','params','eml-format'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0x8be9,0x8f));var _0x98be=function(_0x25b1ec,_0x2341b2){_0x25b1ec=_0x25b1ec-0x0;var _0x366b78=_0x8be9[_0x25b1ec];return _0x366b78;};'use strict';var emlformat=require(_0x98be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98be('0x1'));var jsonpatch=require(_0x98be('0x2'));var rp=require(_0x98be('0x3'));var moment=require(_0x98be('0x4'));var BPromise=require(_0x98be('0x5'));var Mustache=require(_0x98be('0x6'));var util=require('util');var path=require(_0x98be('0x7'));var sox=require('sox');var csv=require(_0x98be('0x8'));var ejs=require(_0x98be('0x9'));var fs=require('fs');var fs_extra=require(_0x98be('0xa'));var _=require('lodash');var squel=require(_0x98be('0xb'));var crypto=require(_0x98be('0xc'));var jsforce=require(_0x98be('0xd'));var deskjs=require(_0x98be('0xe'));var toCsv=require(_0x98be('0x8'));var querystring=require(_0x98be('0xf'));var Papa=require('papaparse');var Redis=require(_0x98be('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x98be('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98be('0x12'));var logger=require('../../config/logger')(_0x98be('0x13'));var utils=require(_0x98be('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x98be('0x15'));var db=require(_0x98be('0x16'))['db'];function respondWithStatusCode(_0x3079b4,_0x29e79a){_0x29e79a=_0x29e79a||0xcc;return function(_0x54a068){if(_0x54a068){return _0x3079b4[_0x98be('0x17')](_0x29e79a);}return _0x3079b4[_0x98be('0x18')](_0x29e79a)[_0x98be('0x19')]();};}function respondWithResult(_0x2ff1a8,_0x498516){_0x498516=_0x498516||0xc8;return function(_0x390821){if(_0x390821){return _0x2ff1a8[_0x98be('0x18')](_0x498516)[_0x98be('0x1a')](_0x390821);}};}function respondWithFilteredResult(_0x340876,_0x48d941){return function(_0x220935){if(_0x220935){var _0x25f877=typeof _0x48d941[_0x98be('0x1b')]===_0x98be('0x1c')&&typeof _0x48d941['limit']===_0x98be('0x1c');var _0x2db17d=_0x220935[_0x98be('0x1d')];var _0x3d894b=_0x25f877?0x0:_0x48d941[_0x98be('0x1b')];var _0x16cd04=_0x25f877?_0x220935[_0x98be('0x1d')]:_0x48d941[_0x98be('0x1b')]+_0x48d941['limit'];var _0x2b717f;if(_0x16cd04>=_0x2db17d){_0x16cd04=_0x2db17d;_0x2b717f=0xc8;}else{_0x2b717f=0xce;}_0x340876[_0x98be('0x18')](_0x2b717f);return _0x340876[_0x98be('0x1e')](_0x98be('0x1f'),_0x3d894b+'-'+_0x16cd04+'/'+_0x2db17d)[_0x98be('0x1a')](_0x220935);}return null;};}function patchUpdates(_0x447816){return function(_0x2af795){try{jsonpatch['apply'](_0x2af795,_0x447816,!![]);}catch(_0x4f46f6){return BPromise[_0x98be('0x20')](_0x4f46f6);}return _0x2af795[_0x98be('0x21')]();};}function saveUpdates(_0x4812ff,_0x4b9d5e){return function(_0x11bdb1){if(_0x11bdb1){return _0x11bdb1['update'](_0x4812ff)['then'](function(_0x2095ef){return _0x2095ef;});}return null;};}function removeEntity(_0x3ddef1,_0x4c1a79){return function(_0x159c42){if(_0x159c42){return _0x159c42[_0x98be('0x22')]()[_0x98be('0x23')](function(){_0x3ddef1['status'](0xcc)[_0x98be('0x19')]();});}};}function handleEntityNotFound(_0x21636f,_0x1f9e35){return function(_0x5eded3){if(!_0x5eded3){_0x21636f['sendStatus'](0x194);}return _0x5eded3;};}function handleError(_0x2e30ff,_0x556c18){_0x556c18=_0x556c18||0x1f4;return function(_0x33f069){logger[_0x98be('0x24')](_0x33f069[_0x98be('0x25')]);if(_0x33f069[_0x98be('0x26')]){delete _0x33f069[_0x98be('0x26')];}_0x2e30ff['status'](_0x556c18)[_0x98be('0x27')](_0x33f069);};}exports['index']=function(_0x19c1e9,_0x48f8fa){var _0x2d6793={},_0x19842a={},_0x2de5c0={'count':0x0,'rows':[]};var _0x433d4f=_[_0x98be('0x28')](db[_0x98be('0x29')][_0x98be('0x2a')],function(_0x2af772){return{'name':_0x2af772[_0x98be('0x2b')],'type':_0x2af772['type'][_0x98be('0x2c')]};});_0x19842a['model']=_[_0x98be('0x28')](_0x433d4f,'name');_0x19842a['query']=_[_0x98be('0x2d')](_0x19c1e9[_0x98be('0x2e')]);_0x19842a[_0x98be('0x2f')]=_[_0x98be('0x30')](_0x19842a[_0x98be('0x31')],_0x19842a[_0x98be('0x2e')]);_0x2d6793[_0x98be('0x32')]=_[_0x98be('0x30')](_0x19842a[_0x98be('0x31')],qs['fields'](_0x19c1e9['query']['fields']));_0x2d6793[_0x98be('0x32')]=_0x2d6793[_0x98be('0x32')][_0x98be('0x33')]?_0x2d6793[_0x98be('0x32')]:_0x19842a[_0x98be('0x31')];if(!_0x19c1e9[_0x98be('0x2e')][_0x98be('0x34')]('nolimit')){_0x2d6793[_0x98be('0x35')]=qs['limit'](_0x19c1e9['query'][_0x98be('0x35')]);_0x2d6793[_0x98be('0x1b')]=qs[_0x98be('0x1b')](_0x19c1e9[_0x98be('0x2e')][_0x98be('0x1b')]);}_0x2d6793[_0x98be('0x36')]=qs['sort'](_0x19c1e9[_0x98be('0x2e')][_0x98be('0x37')]);_0x2d6793[_0x98be('0x38')]=qs[_0x98be('0x2f')](_[_0x98be('0x39')](_0x19c1e9[_0x98be('0x2e')],_0x19842a['filters']),_0x433d4f);if(_0x19c1e9['query'][_0x98be('0x3a')]){_0x2d6793[_0x98be('0x38')]=_['merge'](_0x2d6793['where'],{'$or':_['map'](_0x433d4f,function(_0x5751f1){if(_0x5751f1[_0x98be('0x3b')]!=='VIRTUAL'){var _0x25fb2d={};_0x25fb2d[_0x5751f1[_0x98be('0x26')]]={'$like':'%'+_0x19c1e9[_0x98be('0x2e')][_0x98be('0x3a')]+'%'};return _0x25fb2d;}})});}_0x2d6793=_[_0x98be('0x3c')]({},_0x2d6793,_0x19c1e9[_0x98be('0x3d')]);var _0x4a074d={'where':_0x2d6793[_0x98be('0x38')]};return db[_0x98be('0x29')][_0x98be('0x1d')](_0x4a074d)[_0x98be('0x23')](function(_0x201de3){_0x2de5c0[_0x98be('0x1d')]=_0x201de3;if(_0x19c1e9[_0x98be('0x2e')]['includeAll']){_0x2d6793[_0x98be('0x3e')]=[{'all':!![]}];}return db[_0x98be('0x29')]['findAll'](_0x2d6793);})[_0x98be('0x23')](function(_0x562663){_0x2de5c0[_0x98be('0x3f')]=_0x562663;return _0x2de5c0;})[_0x98be('0x23')](respondWithFilteredResult(_0x48f8fa,_0x2d6793))['catch'](handleError(_0x48f8fa,null));};exports[_0x98be('0x40')]=function(_0x484064,_0x407e57){var _0x451361={'raw':!![],'where':{'id':_0x484064['params']['id']}},_0x575cbf={};_0x575cbf[_0x98be('0x31')]=_[_0x98be('0x2d')](db[_0x98be('0x29')][_0x98be('0x2a')]);_0x575cbf['query']=_[_0x98be('0x2d')](_0x484064[_0x98be('0x2e')]);_0x575cbf[_0x98be('0x2f')]=_[_0x98be('0x30')](_0x575cbf[_0x98be('0x31')],_0x575cbf[_0x98be('0x2e')]);_0x451361[_0x98be('0x32')]=_[_0x98be('0x30')](_0x575cbf[_0x98be('0x31')],qs[_0x98be('0x41')](_0x484064[_0x98be('0x2e')][_0x98be('0x41')]));_0x451361[_0x98be('0x32')]=_0x451361[_0x98be('0x32')][_0x98be('0x33')]?_0x451361[_0x98be('0x32')]:_0x575cbf[_0x98be('0x31')];if(_0x484064[_0x98be('0x2e')][_0x98be('0x42')]){_0x451361[_0x98be('0x3e')]=[{'all':!![]}];}_0x451361=_[_0x98be('0x3c')]({},_0x451361,_0x484064[_0x98be('0x3d')]);return db['ZohoField'][_0x98be('0x43')](_0x451361)['then'](handleEntityNotFound(_0x407e57,null))[_0x98be('0x23')](respondWithResult(_0x407e57,null))['catch'](handleError(_0x407e57,null));};exports['create']=function(_0x226ce9,_0x18fa37){return db[_0x98be('0x29')]['create'](_0x226ce9['body'],{})[_0x98be('0x23')](respondWithResult(_0x18fa37,0xc9))['catch'](handleError(_0x18fa37,null));};exports[_0x98be('0x44')]=function(_0x2f65e2,_0x3b20a5){if(_0x2f65e2[_0x98be('0x45')]['id']){delete _0x2f65e2[_0x98be('0x45')]['id'];}return db[_0x98be('0x29')][_0x98be('0x43')]({'where':{'id':_0x2f65e2['params']['id']}})[_0x98be('0x23')](handleEntityNotFound(_0x3b20a5,null))[_0x98be('0x23')](saveUpdates(_0x2f65e2[_0x98be('0x45')],null))[_0x98be('0x23')](respondWithResult(_0x3b20a5,null))[_0x98be('0x46')](handleError(_0x3b20a5,null));};exports['destroy']=function(_0x5cf654,_0x41592d){return db['ZohoField'][_0x98be('0x43')]({'where':{'id':_0x5cf654[_0x98be('0x47')]['id']}})[_0x98be('0x23')](handleEntityNotFound(_0x41592d,null))['then'](removeEntity(_0x41592d,null))['catch'](handleError(_0x41592d,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 504727a..22c7841 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 _0x7046=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','ZohoField','idField'];(function(_0x41ea9c,_0x3e561d){var _0x3ded39=function(_0x2b99c4){while(--_0x2b99c4){_0x41ea9c['push'](_0x41ea9c['shift']());}};_0x3ded39(++_0x3e561d);}(_0x7046,0x144));var _0x6704=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7046[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x6704('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4888=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','FieldId'];(function(_0x473dce,_0x3050d1){var _0xbf9beb=function(_0xb07cfb){while(--_0xb07cfb){_0x473dce['push'](_0x473dce['shift']());}};_0xbf9beb(++_0x3050d1);}(_0x4888,0x198));var _0x8488=function(_0x204c59,_0x5614ee){_0x204c59=_0x204c59-0x0;var _0x4cd35b=_0x4888[_0x204c59];return _0x4cd35b;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var logger=require(_0x8488('0x1'))(_0x8488('0x2'));var moment=require(_0x8488('0x3'));var BPromise=require(_0x8488('0x4'));var rp=require(_0x8488('0x5'));var fs=require('fs');var path=require(_0x8488('0x6'));var rimraf=require('rimraf');var config=require(_0x8488('0x7'));var attributes=require(_0x8488('0x8'));module[_0x8488('0x9')]=function(_0x421292,_0x326887){return _0x421292[_0x8488('0xa')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x8488('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 7f67d53..6e4ffc6 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 _0xc125=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0xc125,0xe8));var _0x5c12=function(_0x5aeace,_0x547e2d){_0x5aeace=_0x5aeace-0x0;var _0x33a36e=_0xc125[_0x5aeace];return _0x33a36e;};'use strict';var _=require(_0x5c12('0x0'));var util=require(_0x5c12('0x1'));var moment=require(_0x5c12('0x2'));var BPromise=require(_0x5c12('0x3'));var rs=require(_0x5c12('0x4'));var fs=require('fs');var Redis=require(_0x5c12('0x5'));var db=require(_0x5c12('0x6'))['db'];var utils=require(_0x5c12('0x7'));var logger=require(_0x5c12('0x8'))(_0x5c12('0x9'));var config=require(_0x5c12('0xa'));var jayson=require(_0x5c12('0xb'));var client=jayson[_0x5c12('0xc')][_0x5c12('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c9080,_0x5a0a45,_0x4ffe87){return new BPromise(function(_0x5ad46f,_0x1dcefc){return client['request'](_0x4c9080,_0x4ffe87)[_0x5c12('0xe')](function(_0x4e5a52){logger['info'](_0x5c12('0xf'),_0x5a0a45,_0x5c12('0x10'));logger['debug'](_0x5c12('0x11'),_0x5a0a45,_0x5c12('0x10'),JSON[_0x5c12('0x12')](_0x4e5a52));if(_0x4e5a52[_0x5c12('0x13')]){if(_0x4e5a52['error'][_0x5c12('0x14')]===0x1f4){logger[_0x5c12('0x13')](_0x5c12('0xf'),_0x5a0a45,_0x4e5a52['error'][_0x5c12('0x15')]);return _0x1dcefc(_0x4e5a52[_0x5c12('0x13')]['message']);}logger[_0x5c12('0x13')](_0x5c12('0xf'),_0x5a0a45,_0x4e5a52[_0x5c12('0x13')]['message']);return _0x5ad46f(_0x4e5a52[_0x5c12('0x13')][_0x5c12('0x15')]);}else{logger[_0x5c12('0x16')]('ZohoField,\x20%s,\x20%s',_0x5a0a45,'request\x20sent');_0x5ad46f(_0x4e5a52[_0x5c12('0x17')][_0x5c12('0x15')]);}})[_0x5c12('0x18')](function(_0x2c2d3c){logger[_0x5c12('0x13')](_0x5c12('0xf'),_0x5a0a45,_0x2c2d3c);_0x1dcefc(_0x2c2d3c);});});} \ No newline at end of file +var _0x52e3=['rpc','../../config/environment','jayson/promise','client','request','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2050f7,_0x3833c6){var _0x219da1=function(_0x554dc1){while(--_0x554dc1){_0x2050f7['push'](_0x2050f7['shift']());}};_0x219da1(++_0x3833c6);}(_0x52e3,0xca));var _0x352e=function(_0x5934e5,_0x146042){_0x5934e5=_0x5934e5-0x0;var _0x3475b9=_0x52e3[_0x5934e5];return _0x3475b9;};'use strict';var _=require(_0x352e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x352e('0x1'));var rs=require(_0x352e('0x2'));var fs=require('fs');var Redis=require(_0x352e('0x3'));var db=require(_0x352e('0x4'))['db'];var utils=require(_0x352e('0x5'));var logger=require(_0x352e('0x6'))(_0x352e('0x7'));var config=require(_0x352e('0x8'));var jayson=require(_0x352e('0x9'));var client=jayson[_0x352e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5aefb8,_0x4e7a4c,_0xa3c178){return new BPromise(function(_0x3fc227,_0x468372){return client[_0x352e('0xb')](_0x5aefb8,_0xa3c178)['then'](function(_0x22c25e){logger[_0x352e('0xc')](_0x352e('0xd'),_0x4e7a4c,'request\x20sent');logger['debug'](_0x352e('0xe'),_0x4e7a4c,_0x352e('0xf'),JSON['stringify'](_0x22c25e));if(_0x22c25e['error']){if(_0x22c25e[_0x352e('0x10')][_0x352e('0x11')]===0x1f4){logger['error'](_0x352e('0xd'),_0x4e7a4c,_0x22c25e[_0x352e('0x10')][_0x352e('0x12')]);return _0x468372(_0x22c25e[_0x352e('0x10')][_0x352e('0x12')]);}logger[_0x352e('0x10')]('ZohoField,\x20%s,\x20%s',_0x4e7a4c,_0x22c25e[_0x352e('0x10')][_0x352e('0x12')]);return _0x3fc227(_0x22c25e['error']['message']);}else{logger[_0x352e('0xc')](_0x352e('0xd'),_0x4e7a4c,'request\x20sent');_0x3fc227(_0x22c25e['result'][_0x352e('0x12')]);}})['catch'](function(_0x536b1d){logger[_0x352e('0x10')]('ZohoField,\x20%s,\x20%s',_0x4e7a4c,_0x536b1d);_0x468372(_0x536b1d);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 38b4cc2..fc94344 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x27f4e9,_0x2f2f75){var _0x7226e=function(_0x10e4f6){while(--_0x10e4f6){_0x27f4e9['push'](_0x27f4e9['shift']());}};_0x7226e(++_0x2f2f75);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=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(_0x2e5e7f,_0x3518ca){var _0x5d8f7a=function(_0x25a316){while(--_0x25a316){_0x2e5e7f['push'](_0x2e5e7f['shift']());}};_0x5d8f7a(++_0x3518ca);}(_0xe706,0xa3));var _0x6e70=function(_0x17516a,_0x2824c1){_0x17516a=_0x17516a-0x0;var _0x22e61f=_0xe706[_0x17516a];return _0x22e61f;};'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 b65470d..1893391 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 _0x39d6=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x17a8d8,_0x964db2){var _0x552ba3=function(_0xd70c6f){while(--_0xd70c6f){_0x17a8d8['push'](_0x17a8d8['shift']());}};_0x552ba3(++_0x964db2);}(_0x39d6,0x8a));var _0x639d=function(_0x4da749,_0x33272a){_0x4da749=_0x4da749-0x0;var _0x59afaf=_0x39d6[_0x4da749];return _0x59afaf;};'use strict';var Sequelize=require(_0x639d('0x0'));module[_0x639d('0x1')]={'name':{'type':Sequelize[_0x639d('0x2')],'allowNull':![],'unique':_0x639d('0x3')},'version':{'type':Sequelize[_0x639d('0x2')],'allowNull':![],'unique':_0x639d('0x3')},'main':{'type':Sequelize[_0x639d('0x2')],'defaultValue':_0x639d('0x4')},'filename':{'type':Sequelize[_0x639d('0x2')]},'path':{'type':Sequelize[_0x639d('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x639d('0x5')]},'active':{'type':Sequelize[_0x639d('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x639d('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x639d('0x2')]},'title':{'type':Sequelize[_0x639d('0x2')]},'remoteUri':{'type':Sequelize[_0x639d('0x2')]},'link':{'type':Sequelize[_0x639d('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xb67b=['BOOLEAN','state','sequelize','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x2fd445,_0x36e3ac){var _0x37c758=function(_0x2a3c59){while(--_0x2a3c59){_0x2fd445['push'](_0x2fd445['shift']());}};_0x37c758(++_0x36e3ac);}(_0xb67b,0x1f3));var _0xbb67=function(_0x4e9fed,_0x19f4f3){_0x4e9fed=_0x4e9fed-0x0;var _0x5c8cc0=_0xb67b[_0x4e9fed];return _0x5c8cc0;};'use strict';var Sequelize=require(_0xbb67('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb67('0x1')],'allowNull':![],'unique':_0xbb67('0x2')},'version':{'type':Sequelize[_0xbb67('0x1')],'allowNull':![],'unique':_0xbb67('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xbb67('0x3')},'filename':{'type':Sequelize[_0xbb67('0x1')]},'path':{'type':Sequelize[_0xbb67('0x1')]},'type':{'type':Sequelize[_0xbb67('0x1')]},'size':{'type':Sequelize[_0xbb67('0x4')]},'active':{'type':Sequelize[_0xbb67('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xbb67('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xbb67('0x1')],'unique':_0xbb67('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbb67('0x1')]},'link':{'type':Sequelize[_0xbb67('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 5350d72..1041395 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 _0x187d=['body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','Integration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','create'];(function(_0x3ab821,_0xffb575){var _0x4741b9=function(_0x16c0a7){while(--_0x16c0a7){_0x3ab821['push'](_0x3ab821['shift']());}};_0x4741b9(++_0xffb575);}(_0x187d,0x93));var _0xd187=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x187d[_0xbe200f];return _0x192597;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')](_0x3ce4a1[_0xd187('0x48')],{})['then'](respondWithResult(_0x3f5def,0xc9))[_0xd187('0x41')](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x4523c8,_0x1449d7){if(_0x4523c8[_0xd187('0x48')]['id']){delete _0x4523c8['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x4523c8['params']['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x1449d7,null))[_0xd187('0x3f')](saveUpdates(_0x4523c8['body'],null))['then'](respondWithResult(_0x1449d7,null))['catch'](handleError(_0x1449d7,null));};exports['destroy']=function(_0x473bef,_0x22f432){return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x473bef[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x22f432,null))[_0xd187('0x3f')](removeEntity(_0x22f432,null))['catch'](handleError(_0x22f432,null));}; \ No newline at end of file +var _0xb016=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','name','send','index','map','Integration','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body'];(function(_0x3f5079,_0x10074b){var _0x35063f=function(_0x166780){while(--_0x166780){_0x3f5079['push'](_0x3f5079['shift']());}};_0x35063f(++_0x10074b);}(_0xb016,0x159));var _0x6b01=function(_0x406d13,_0x41fad7){_0x406d13=_0x406d13-0x0;var _0xb13030=_0xb016[_0x406d13];return _0xb13030;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['Integration'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 2ee966e..746f5c5 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 _0x0649=['api','bluebird','request-promise','path','rimraf','./integration.attributes','exports','Integration','integrations','lodash','util','../../config/logger'];(function(_0x44fb3d,_0x206053){var _0x3bdaed=function(_0x5a9e96){while(--_0x5a9e96){_0x44fb3d['push'](_0x44fb3d['shift']());}};_0x3bdaed(++_0x206053);}(_0x0649,0x1dd));var _0x9064=function(_0x11d390,_0x5f4742){_0x11d390=_0x11d390-0x0;var _0x2e965b=_0x0649[_0x11d390];return _0x2e965b;};'use strict';var _=require(_0x9064('0x0'));var util=require(_0x9064('0x1'));var logger=require(_0x9064('0x2'))(_0x9064('0x3'));var moment=require('moment');var BPromise=require(_0x9064('0x4'));var rp=require(_0x9064('0x5'));var fs=require('fs');var path=require(_0x9064('0x6'));var rimraf=require(_0x9064('0x7'));var config=require('../../config/environment');var attributes=require(_0x9064('0x8'));module[_0x9064('0x9')]=function(_0x241c84,_0x153221){return _0x241c84['define'](_0x9064('0xa'),attributes,{'tableName':_0x9064('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98b5=['rimraf','./integration.attributes','exports','define','integrations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1931f4,_0x494dfc){var _0x59eb75=function(_0x168db4){while(--_0x168db4){_0x1931f4['push'](_0x1931f4['shift']());}};_0x59eb75(++_0x494dfc);}(_0x98b5,0x191));var _0x598b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x98b5[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x598b('0x0'));var util=require(_0x598b('0x1'));var logger=require(_0x598b('0x2'))(_0x598b('0x3'));var moment=require('moment');var BPromise=require(_0x598b('0x4'));var rp=require(_0x598b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x598b('0x6'));var config=require('../../config/environment');var attributes=require(_0x598b('0x7'));module[_0x598b('0x8')]=function(_0x14f565,_0x5ee66c){return _0x14f565[_0x598b('0x9')]('Integration',attributes,{'tableName':_0x598b('0xa'),'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 2bba933..44dc471 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 _0x1967=['then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x1967,0x173));var _0x7196=function(_0x555799,_0x25c567){_0x555799=_0x555799-0x0;var _0x161657=_0x1967[_0x555799];return _0x161657;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0xd7d1=['info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x53f3ad,_0x39163e){var _0x48b203=function(_0x475ced){while(--_0x475ced){_0x53f3ad['push'](_0x53f3ad['shift']());}};_0x48b203(++_0x39163e);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x24be71,_0x21416c){_0x24be71=_0x24be71-0x0;var _0x1b7644=_0xd7d1[_0x24be71];return _0x1b7644;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('Integration,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('Integration,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 1aecb07..cdd396d 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 _0x187d=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x3a465a,_0x3e8001){var _0x1ed244=function(_0x1349e9){while(--_0x1349e9){_0x3a465a['push'](_0x3a465a['shift']());}};_0x1ed244(++_0x3e8001);}(_0x187d,0x93));var _0xd187=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x187d[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);module[_0xd187('0x16')]=router; \ No newline at end of file +var _0xc6ac=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x46a306,_0x1d65d5){var _0x2b3515=function(_0x3c4d02){while(--_0x3c4d02){_0x46a306['push'](_0x46a306['shift']());}};_0x2b3515(++_0x1d65d5);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4257b5,_0x51679a){_0x4257b5=_0x4257b5-0x0;var _0x1fa5c9=_0xc6ac[_0x4257b5];return _0x1fa5c9;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')]('/',auth[_0xcc6a('0xc')](),controller['create']);router[_0xcc6a('0x13')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 43fec4b..1c5d42d 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 _0xa1e5=['DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','sequelize','exports','STRING','INTEGER'];(function(_0x181b43,_0xc564cd){var _0x190177=function(_0x1e200d){while(--_0x1e200d){_0x181b43['push'](_0x181b43['shift']());}};_0x190177(++_0xc564cd);}(_0xa1e5,0x196));var _0x5a1e=function(_0x25b6d0,_0x81fc22){_0x25b6d0=_0x25b6d0-0x0;var _0x3dbc3d=_0xa1e5[_0x25b6d0];return _0x3dbc3d;};'use strict';var Sequelize=require(_0x5a1e('0x0'));module[_0x5a1e('0x1')]={'integration':{'type':Sequelize[_0x5a1e('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x5a1e('0x2')]},'ticketId':{'type':Sequelize[_0x5a1e('0x2')]},'integrationId':{'type':Sequelize[_0x5a1e('0x3')]},'contacts':{'type':Sequelize[_0x5a1e('0x2')]},'uniqueid':{'type':Sequelize[_0x5a1e('0x2')]},'calleridnum':{'type':Sequelize[_0x5a1e('0x2')]},'calleridname':{'type':Sequelize[_0x5a1e('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x5a1e('0x2')]},'membername':{'type':Sequelize[_0x5a1e('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5a1e('0x4')]},'agentconnectAt':{'type':Sequelize[_0x5a1e('0x4')]},'holdtime':{'type':Sequelize[_0x5a1e('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5a1e('0x4')]},'talktime':{'type':Sequelize[_0x5a1e('0x3')]},'agentacw':{'type':Sequelize[_0x5a1e('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5a1e('0x3')]},'reason':{'type':Sequelize[_0x5a1e('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x5a1e('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x5a1e('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5a1e('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5a1e('0x2')]},'channelstate':{'type':Sequelize[_0x5a1e('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5a1e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5a1e('0x2')]},'connectedlinename':{'type':Sequelize[_0x5a1e('0x2')]},'language':{'type':Sequelize[_0x5a1e('0x2')]},'accountcode':{'type':Sequelize[_0x5a1e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5a1e('0x2')]},'priority':{'type':Sequelize[_0x5a1e('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x5a1e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5a1e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5a1e('0x2')]},'destcalleridname':{'type':Sequelize[_0x5a1e('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x5a1e('0x2')]},'destlanguage':{'type':Sequelize[_0x5a1e('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x5a1e('0x2')]},'destpriority':{'type':Sequelize[_0x5a1e('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x5a1e('0x2')]},'inReplyTo':{'type':Sequelize[_0x5a1e('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x5a1e('0x2')]},'attachment':{'type':Sequelize[_0x5a1e('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x5a1e('0x6')]},'status':{'type':Sequelize[_0x5a1e('0x7')](_0x5a1e('0x8'),'SENDING',_0x5a1e('0x9'),'FAILED')},'url':{'type':Sequelize[_0x5a1e('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x5a1e('0x3')]}}; \ No newline at end of file +var _0x436b=['RECEIVED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','TEXT','ENUM','SENT','SENDING'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x436b,0x114));var _0xb436=function(_0x819e48,_0x430040){_0x819e48=_0x819e48-0x0;var _0x522d4a=_0x436b[_0x819e48];return _0x522d4a;};'use strict';var Sequelize=require(_0xb436('0x0'));module[_0xb436('0x1')]={'integration':{'type':Sequelize[_0xb436('0x2')]},'eventChannel':{'type':Sequelize[_0xb436('0x2')]},'exitStatus':{'type':Sequelize[_0xb436('0x2')]},'ticketId':{'type':Sequelize[_0xb436('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xb436('0x2')]},'uniqueid':{'type':Sequelize[_0xb436('0x2')]},'calleridnum':{'type':Sequelize[_0xb436('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb436('0x2')]},'interface':{'type':Sequelize[_0xb436('0x2')]},'membername':{'type':Sequelize[_0xb436('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb436('0x3')]},'agentconnectAt':{'type':Sequelize[_0xb436('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xb436('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xb436('0x3')]},'talktime':{'type':Sequelize[_0xb436('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb436('0x5')]},'reason':{'type':Sequelize[_0xb436('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xb436('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb436('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb436('0x2')]},'channelstate':{'type':Sequelize[_0xb436('0x5')]},'channelstatedesc':{'type':Sequelize[_0xb436('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb436('0x2')]},'connectedlinename':{'type':Sequelize[_0xb436('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb436('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb436('0x2')]},'priority':{'type':Sequelize[_0xb436('0x2')]},'destchannel':{'type':Sequelize[_0xb436('0x2')]},'destchannelstate':{'type':Sequelize[_0xb436('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xb436('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb436('0x2')]},'destcalleridname':{'type':Sequelize[_0xb436('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xb436('0x2')]},'destlanguage':{'type':Sequelize[_0xb436('0x2')]},'destaccountcode':{'type':Sequelize[_0xb436('0x2')]},'destcontext':{'type':Sequelize[_0xb436('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb436('0x2')]},'destuniqueid':{'type':Sequelize[_0xb436('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xb436('0x2')]},'subject':{'type':Sequelize[_0xb436('0x2')]},'from':{'type':Sequelize[_0xb436('0x2')]},'to':{'type':Sequelize[_0xb436('0x2')]},'cc':{'type':Sequelize[_0xb436('0x2')]},'attachment':{'type':Sequelize[_0xb436('0x6')]},'html':{'type':Sequelize[_0xb436('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xb436('0x7')](_0xb436('0x8'),_0xb436('0x9'),_0xb436('0xa'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xb436('0x2')]},'projectId':{'type':Sequelize[_0xb436('0x5')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 5af151a..7c941af 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 _0x7458=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4db898,_0x53c18a){var _0x284228=function(_0x58cb2d){while(--_0x58cb2d){_0x4db898['push'](_0x4db898['shift']());}};_0x284228(++_0x53c18a);}(_0x7458,0x1b2));var _0x8745=function(_0x2232f5,_0x2625f1){_0x2232f5=_0x2232f5-0x0;var _0x3ffe84=_0x7458[_0x2232f5];return _0x3ffe84;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8745('0x0'));var zipdir=require(_0x8745('0x1'));var jsonpatch=require(_0x8745('0x2'));var rp=require(_0x8745('0x3'));var moment=require(_0x8745('0x4'));var BPromise=require(_0x8745('0x5'));var Mustache=require(_0x8745('0x6'));var util=require(_0x8745('0x7'));var path=require(_0x8745('0x8'));var sox=require(_0x8745('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8745('0xa'));var _=require(_0x8745('0xb'));var squel=require(_0x8745('0xc'));var crypto=require(_0x8745('0xd'));var jsforce=require(_0x8745('0xe'));var deskjs=require(_0x8745('0xf'));var toCsv=require(_0x8745('0x10'));var querystring=require(_0x8745('0x11'));var Papa=require(_0x8745('0x12'));var Redis=require(_0x8745('0x13'));var authService=require(_0x8745('0x14'));var qs=require(_0x8745('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8745('0x16'));var logger=require(_0x8745('0x17'))('api');var utils=require(_0x8745('0x18'));var config=require(_0x8745('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8745('0x1a'))['db'];function respondWithStatusCode(_0x331202,_0x4ee167){_0x4ee167=_0x4ee167||0xcc;return function(_0x28e952){if(_0x28e952){return _0x331202[_0x8745('0x1b')](_0x4ee167);}return _0x331202[_0x8745('0x1c')](_0x4ee167)[_0x8745('0x1d')]();};}function respondWithResult(_0x5cf463,_0x98d725){_0x98d725=_0x98d725||0xc8;return function(_0x721a73){if(_0x721a73){return _0x5cf463[_0x8745('0x1c')](_0x98d725)['json'](_0x721a73);}};}function respondWithFilteredResult(_0x3ba596,_0xf075cf){return function(_0x3ca41d){if(_0x3ca41d){var _0x493fee=typeof _0xf075cf[_0x8745('0x1e')]==='undefined'&&typeof _0xf075cf[_0x8745('0x1f')]==='undefined';var _0x59c094=_0x3ca41d[_0x8745('0x20')];var _0x26e23e=_0x493fee?0x0:_0xf075cf[_0x8745('0x1e')];var _0x56f82f=_0x493fee?_0x3ca41d[_0x8745('0x20')]:_0xf075cf['offset']+_0xf075cf[_0x8745('0x1f')];var _0x20b402;if(_0x56f82f>=_0x59c094){_0x56f82f=_0x59c094;_0x20b402=0xc8;}else{_0x20b402=0xce;}_0x3ba596[_0x8745('0x1c')](_0x20b402);return _0x3ba596[_0x8745('0x21')]('Content-Range',_0x26e23e+'-'+_0x56f82f+'/'+_0x59c094)['json'](_0x3ca41d);}return null;};}function patchUpdates(_0x2187c4){return function(_0x26301d){try{jsonpatch['apply'](_0x26301d,_0x2187c4,!![]);}catch(_0x271912){return BPromise[_0x8745('0x22')](_0x271912);}return _0x26301d[_0x8745('0x23')]();};}function saveUpdates(_0x1240d6,_0x4e4ff1){return function(_0x1edde1){if(_0x1edde1){return _0x1edde1[_0x8745('0x24')](_0x1240d6)[_0x8745('0x25')](function(_0x5be6ca){return _0x5be6ca;});}return null;};}function removeEntity(_0x521b4d,_0x26dd89){return function(_0x488fbe){if(_0x488fbe){return _0x488fbe[_0x8745('0x26')]()[_0x8745('0x25')](function(){_0x521b4d['status'](0xcc)[_0x8745('0x1d')]();});}};}function handleEntityNotFound(_0x563913,_0x2db5cf){return function(_0x545e0b){if(!_0x545e0b){_0x563913[_0x8745('0x1b')](0x194);}return _0x545e0b;};}function handleError(_0x2f5ac4,_0x37f829){_0x37f829=_0x37f829||0x1f4;return function(_0x3891ff){logger[_0x8745('0x27')](_0x3891ff[_0x8745('0x28')]);if(_0x3891ff[_0x8745('0x29')]){delete _0x3891ff[_0x8745('0x29')];}_0x2f5ac4['status'](_0x37f829)[_0x8745('0x2a')](_0x3891ff);};}exports[_0x8745('0x2b')]=function(_0x54c741,_0x4cbbac){var _0x62b8a6={},_0x50b4b9={},_0x33275f={'count':0x0,'rows':[]};var _0x23bf50=_[_0x8745('0x2c')](db[_0x8745('0x2d')][_0x8745('0x2e')],function(_0x5f4895){return{'name':_0x5f4895[_0x8745('0x2f')],'type':_0x5f4895['type']['key']};});_0x50b4b9[_0x8745('0x30')]=_[_0x8745('0x2c')](_0x23bf50,_0x8745('0x29'));_0x50b4b9['query']=_[_0x8745('0x31')](_0x54c741['query']);_0x50b4b9['filters']=_[_0x8745('0x32')](_0x50b4b9[_0x8745('0x30')],_0x50b4b9[_0x8745('0x33')]);_0x62b8a6['attributes']=_[_0x8745('0x32')](_0x50b4b9['model'],qs[_0x8745('0x34')](_0x54c741['query'][_0x8745('0x34')]));_0x62b8a6[_0x8745('0x35')]=_0x62b8a6[_0x8745('0x35')][_0x8745('0x36')]?_0x62b8a6[_0x8745('0x35')]:_0x50b4b9[_0x8745('0x30')];if(!_0x54c741[_0x8745('0x33')][_0x8745('0x37')](_0x8745('0x38'))){_0x62b8a6[_0x8745('0x1f')]=qs['limit'](_0x54c741[_0x8745('0x33')]['limit']);_0x62b8a6[_0x8745('0x1e')]=qs[_0x8745('0x1e')](_0x54c741[_0x8745('0x33')][_0x8745('0x1e')]);}_0x62b8a6['order']=qs[_0x8745('0x39')](_0x54c741[_0x8745('0x33')]['sort']);_0x62b8a6[_0x8745('0x3a')]=qs[_0x8745('0x3b')](_['pick'](_0x54c741[_0x8745('0x33')],_0x50b4b9[_0x8745('0x3b')]),_0x23bf50);if(_0x54c741[_0x8745('0x33')]['filter']){_0x62b8a6[_0x8745('0x3a')]=_[_0x8745('0x3c')](_0x62b8a6[_0x8745('0x3a')],{'$or':_[_0x8745('0x2c')](_0x23bf50,function(_0x896fcc){if(_0x896fcc['type']!==_0x8745('0x3d')){var _0x5980c5={};_0x5980c5[_0x896fcc[_0x8745('0x29')]]={'$like':'%'+_0x54c741[_0x8745('0x33')][_0x8745('0x3e')]+'%'};return _0x5980c5;}})});}_0x62b8a6=_['merge']({},_0x62b8a6,_0x54c741[_0x8745('0x3f')]);var _0xb64242={'where':_0x62b8a6[_0x8745('0x3a')]};return db['IntegrationReport'][_0x8745('0x20')](_0xb64242)[_0x8745('0x25')](function(_0x13ecab){_0x33275f[_0x8745('0x20')]=_0x13ecab;if(_0x54c741['query'][_0x8745('0x40')]){_0x62b8a6[_0x8745('0x41')]=[{'all':!![]}];}return db[_0x8745('0x2d')][_0x8745('0x42')](_0x62b8a6);})[_0x8745('0x25')](function(_0x4b2457){_0x33275f[_0x8745('0x43')]=_0x4b2457;return _0x33275f;})[_0x8745('0x25')](respondWithFilteredResult(_0x4cbbac,_0x62b8a6))[_0x8745('0x44')](handleError(_0x4cbbac,null));};exports[_0x8745('0x45')]=function(_0xee54fc,_0x56a1d2){var _0x5d13fe={'raw':![],'where':{'id':_0xee54fc[_0x8745('0x46')]['id']}},_0x5df470={};_0x5df470[_0x8745('0x30')]=_[_0x8745('0x31')](db[_0x8745('0x2d')][_0x8745('0x2e')]);_0x5df470[_0x8745('0x33')]=_[_0x8745('0x31')](_0xee54fc[_0x8745('0x33')]);_0x5df470['filters']=_[_0x8745('0x32')](_0x5df470[_0x8745('0x30')],_0x5df470[_0x8745('0x33')]);_0x5d13fe[_0x8745('0x35')]=_['intersection'](_0x5df470['model'],qs[_0x8745('0x34')](_0xee54fc[_0x8745('0x33')][_0x8745('0x34')]));_0x5d13fe[_0x8745('0x35')]=_0x5d13fe[_0x8745('0x35')][_0x8745('0x36')]?_0x5d13fe[_0x8745('0x35')]:_0x5df470[_0x8745('0x30')];if(_0xee54fc[_0x8745('0x33')][_0x8745('0x40')]){_0x5d13fe[_0x8745('0x41')]=[{'all':!![]}];}_0x5d13fe=_[_0x8745('0x3c')]({},_0x5d13fe,_0xee54fc['options']);return db[_0x8745('0x2d')]['find'](_0x5d13fe)['then'](handleEntityNotFound(_0x56a1d2,null))[_0x8745('0x25')](respondWithResult(_0x56a1d2,null))['catch'](handleError(_0x56a1d2,null));};exports[_0x8745('0x47')]=function(_0x4b4acb,_0xfeaa09){return db['IntegrationReport']['create'](_0x4b4acb[_0x8745('0x48')],{})[_0x8745('0x25')](respondWithResult(_0xfeaa09,0xc9))[_0x8745('0x44')](handleError(_0xfeaa09,null));};exports[_0x8745('0x24')]=function(_0x199e16,_0x41f5f2){if(_0x199e16[_0x8745('0x48')]['id']){delete _0x199e16[_0x8745('0x48')]['id'];}return db[_0x8745('0x2d')][_0x8745('0x49')]({'where':{'id':_0x199e16[_0x8745('0x46')]['id']}})['then'](handleEntityNotFound(_0x41f5f2,null))[_0x8745('0x25')](saveUpdates(_0x199e16['body'],null))[_0x8745('0x25')](respondWithResult(_0x41f5f2,null))[_0x8745('0x44')](handleError(_0x41f5f2,null));};exports[_0x8745('0x26')]=function(_0x41dbc7,_0x37f6b6){return db[_0x8745('0x2d')]['find']({'where':{'id':_0x41dbc7['params']['id']}})['then'](handleEntityNotFound(_0x37f6b6,null))['then'](removeEntity(_0x37f6b6,null))[_0x8745('0x44')](handleError(_0x37f6b6,null));};exports[_0x8745('0x4a')]=function(_0x211fa4,_0x30bbe8){return db[_0x8745('0x2d')]['describe']()[_0x8745('0x25')](respondWithResult(_0x30bbe8,null))[_0x8745('0x44')](handleError(_0x30bbe8,null));}; \ No newline at end of file +var _0x47d7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','type','VIRTUAL','name','merge','options','includeAll','include','findAll','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x5cf1c,_0x32b079){var _0x1f0764=function(_0x310037){while(--_0x310037){_0x5cf1c['push'](_0x5cf1c['shift']());}};_0x1f0764(++_0x32b079);}(_0x47d7,0x1c3));var _0x747d=function(_0x3fb5d5,_0x2badc0){_0x3fb5d5=_0x3fb5d5-0x0;var _0x2a7616=_0x47d7[_0x3fb5d5];return _0x2a7616;};'use strict';var emlformat=require(_0x747d('0x0'));var rimraf=require(_0x747d('0x1'));var zipdir=require(_0x747d('0x2'));var jsonpatch=require(_0x747d('0x3'));var rp=require(_0x747d('0x4'));var moment=require(_0x747d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x747d('0x6'));var util=require('util');var path=require(_0x747d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x747d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x747d('0x9'));var squel=require(_0x747d('0xa'));var crypto=require(_0x747d('0xb'));var jsforce=require(_0x747d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x747d('0xd'));var querystring=require(_0x747d('0xe'));var Papa=require('papaparse');var Redis=require(_0x747d('0xf'));var authService=require(_0x747d('0x10'));var qs=require(_0x747d('0x11'));var as=require(_0x747d('0x12'));var hardwareService=require(_0x747d('0x13'));var logger=require(_0x747d('0x14'))('api');var utils=require(_0x747d('0x15'));var config=require(_0x747d('0x16'));var licenseUtil=require(_0x747d('0x17'));var db=require(_0x747d('0x18'))['db'];function respondWithStatusCode(_0x566a8c,_0x1c93ac){_0x1c93ac=_0x1c93ac||0xcc;return function(_0x3fc972){if(_0x3fc972){return _0x566a8c['sendStatus'](_0x1c93ac);}return _0x566a8c[_0x747d('0x19')](_0x1c93ac)[_0x747d('0x1a')]();};}function respondWithResult(_0x539626,_0x480a18){_0x480a18=_0x480a18||0xc8;return function(_0xb2bbf9){if(_0xb2bbf9){return _0x539626[_0x747d('0x19')](_0x480a18)[_0x747d('0x1b')](_0xb2bbf9);}};}function respondWithFilteredResult(_0x4a9aad,_0x4ddedc){return function(_0x15877a){if(_0x15877a){var _0x178719=typeof _0x4ddedc['offset']===_0x747d('0x1c')&&typeof _0x4ddedc['limit']===_0x747d('0x1c');var _0x40ae61=_0x15877a[_0x747d('0x1d')];var _0x203a25=_0x178719?0x0:_0x4ddedc[_0x747d('0x1e')];var _0x97edf9=_0x178719?_0x15877a[_0x747d('0x1d')]:_0x4ddedc['offset']+_0x4ddedc[_0x747d('0x1f')];var _0x458ff0;if(_0x97edf9>=_0x40ae61){_0x97edf9=_0x40ae61;_0x458ff0=0xc8;}else{_0x458ff0=0xce;}_0x4a9aad[_0x747d('0x19')](_0x458ff0);return _0x4a9aad[_0x747d('0x20')](_0x747d('0x21'),_0x203a25+'-'+_0x97edf9+'/'+_0x40ae61)[_0x747d('0x1b')](_0x15877a);}return null;};}function patchUpdates(_0x5dcede){return function(_0x5accf1){try{jsonpatch[_0x747d('0x22')](_0x5accf1,_0x5dcede,!![]);}catch(_0x1cfe20){return BPromise[_0x747d('0x23')](_0x1cfe20);}return _0x5accf1[_0x747d('0x24')]();};}function saveUpdates(_0x507ca8,_0x2aab43){return function(_0x3883d1){if(_0x3883d1){return _0x3883d1[_0x747d('0x25')](_0x507ca8)[_0x747d('0x26')](function(_0x15bf53){return _0x15bf53;});}return null;};}function removeEntity(_0x5c096f,_0x5dcb62){return function(_0x1fc3d8){if(_0x1fc3d8){return _0x1fc3d8[_0x747d('0x27')]()[_0x747d('0x26')](function(){_0x5c096f[_0x747d('0x19')](0xcc)[_0x747d('0x1a')]();});}};}function handleEntityNotFound(_0x4477ce,_0x2083dc){return function(_0x311434){if(!_0x311434){_0x4477ce[_0x747d('0x28')](0x194);}return _0x311434;};}function handleError(_0x22814d,_0x2cba6f){_0x2cba6f=_0x2cba6f||0x1f4;return function(_0x2ece3a){logger[_0x747d('0x29')](_0x2ece3a[_0x747d('0x2a')]);if(_0x2ece3a['name']){delete _0x2ece3a['name'];}_0x22814d['status'](_0x2cba6f)[_0x747d('0x2b')](_0x2ece3a);};}exports[_0x747d('0x2c')]=function(_0x12e413,_0x2a343c){var _0x4d092c={},_0x11e949={},_0x595d10={'count':0x0,'rows':[]};var _0x2478ba=_[_0x747d('0x2d')](db[_0x747d('0x2e')][_0x747d('0x2f')],function(_0x699ee4){return{'name':_0x699ee4[_0x747d('0x30')],'type':_0x699ee4['type'][_0x747d('0x31')]};});_0x11e949[_0x747d('0x32')]=_[_0x747d('0x2d')](_0x2478ba,'name');_0x11e949[_0x747d('0x33')]=_[_0x747d('0x34')](_0x12e413[_0x747d('0x33')]);_0x11e949[_0x747d('0x35')]=_[_0x747d('0x36')](_0x11e949[_0x747d('0x32')],_0x11e949[_0x747d('0x33')]);_0x4d092c['attributes']=_['intersection'](_0x11e949['model'],qs['fields'](_0x12e413[_0x747d('0x33')][_0x747d('0x37')]));_0x4d092c['attributes']=_0x4d092c[_0x747d('0x38')]['length']?_0x4d092c['attributes']:_0x11e949[_0x747d('0x32')];if(!_0x12e413[_0x747d('0x33')]['hasOwnProperty'](_0x747d('0x39'))){_0x4d092c[_0x747d('0x1f')]=qs[_0x747d('0x1f')](_0x12e413[_0x747d('0x33')][_0x747d('0x1f')]);_0x4d092c[_0x747d('0x1e')]=qs['offset'](_0x12e413[_0x747d('0x33')][_0x747d('0x1e')]);}_0x4d092c[_0x747d('0x3a')]=qs[_0x747d('0x3b')](_0x12e413[_0x747d('0x33')]['sort']);_0x4d092c[_0x747d('0x3c')]=qs[_0x747d('0x35')](_[_0x747d('0x3d')](_0x12e413[_0x747d('0x33')],_0x11e949[_0x747d('0x35')]),_0x2478ba);if(_0x12e413[_0x747d('0x33')][_0x747d('0x3e')]){_0x4d092c[_0x747d('0x3c')]=_['merge'](_0x4d092c[_0x747d('0x3c')],{'$or':_[_0x747d('0x2d')](_0x2478ba,function(_0x10f041){if(_0x10f041[_0x747d('0x3f')]!==_0x747d('0x40')){var _0x4c381e={};_0x4c381e[_0x10f041[_0x747d('0x41')]]={'$like':'%'+_0x12e413['query'][_0x747d('0x3e')]+'%'};return _0x4c381e;}})});}_0x4d092c=_[_0x747d('0x42')]({},_0x4d092c,_0x12e413[_0x747d('0x43')]);var _0x314c4c={'where':_0x4d092c['where']};return db[_0x747d('0x2e')]['count'](_0x314c4c)['then'](function(_0x34635d){_0x595d10[_0x747d('0x1d')]=_0x34635d;if(_0x12e413[_0x747d('0x33')][_0x747d('0x44')]){_0x4d092c[_0x747d('0x45')]=[{'all':!![]}];}return db[_0x747d('0x2e')][_0x747d('0x46')](_0x4d092c);})['then'](function(_0x28d110){_0x595d10['rows']=_0x28d110;return _0x595d10;})[_0x747d('0x26')](respondWithFilteredResult(_0x2a343c,_0x4d092c))[_0x747d('0x47')](handleError(_0x2a343c,null));};exports[_0x747d('0x48')]=function(_0x27b3bc,_0x469883){var _0x55b5b6={'raw':![],'where':{'id':_0x27b3bc['params']['id']}},_0x145cbe={};_0x145cbe['model']=_[_0x747d('0x34')](db[_0x747d('0x2e')][_0x747d('0x2f')]);_0x145cbe[_0x747d('0x33')]=_[_0x747d('0x34')](_0x27b3bc[_0x747d('0x33')]);_0x145cbe[_0x747d('0x35')]=_[_0x747d('0x36')](_0x145cbe[_0x747d('0x32')],_0x145cbe[_0x747d('0x33')]);_0x55b5b6[_0x747d('0x38')]=_[_0x747d('0x36')](_0x145cbe[_0x747d('0x32')],qs[_0x747d('0x37')](_0x27b3bc[_0x747d('0x33')]['fields']));_0x55b5b6['attributes']=_0x55b5b6[_0x747d('0x38')]['length']?_0x55b5b6[_0x747d('0x38')]:_0x145cbe[_0x747d('0x32')];if(_0x27b3bc[_0x747d('0x33')][_0x747d('0x44')]){_0x55b5b6['include']=[{'all':!![]}];}_0x55b5b6=_[_0x747d('0x42')]({},_0x55b5b6,_0x27b3bc[_0x747d('0x43')]);return db[_0x747d('0x2e')][_0x747d('0x49')](_0x55b5b6)['then'](handleEntityNotFound(_0x469883,null))[_0x747d('0x26')](respondWithResult(_0x469883,null))[_0x747d('0x47')](handleError(_0x469883,null));};exports[_0x747d('0x4a')]=function(_0x31898a,_0x2a6e31){return db[_0x747d('0x2e')][_0x747d('0x4a')](_0x31898a[_0x747d('0x4b')],{})[_0x747d('0x26')](respondWithResult(_0x2a6e31,0xc9))[_0x747d('0x47')](handleError(_0x2a6e31,null));};exports[_0x747d('0x25')]=function(_0x287cc5,_0x223222){if(_0x287cc5[_0x747d('0x4b')]['id']){delete _0x287cc5[_0x747d('0x4b')]['id'];}return db[_0x747d('0x2e')]['find']({'where':{'id':_0x287cc5[_0x747d('0x4c')]['id']}})[_0x747d('0x26')](handleEntityNotFound(_0x223222,null))[_0x747d('0x26')](saveUpdates(_0x287cc5[_0x747d('0x4b')],null))[_0x747d('0x26')](respondWithResult(_0x223222,null))['catch'](handleError(_0x223222,null));};exports[_0x747d('0x27')]=function(_0xd7cdfe,_0x290951){return db[_0x747d('0x2e')][_0x747d('0x49')]({'where':{'id':_0xd7cdfe['params']['id']}})[_0x747d('0x26')](handleEntityNotFound(_0x290951,null))[_0x747d('0x26')](removeEntity(_0x290951,null))['catch'](handleError(_0x290951,null));};exports[_0x747d('0x4d')]=function(_0x261552,_0x368eaa){return db[_0x747d('0x2e')][_0x747d('0x4d')]()[_0x747d('0x26')](respondWithResult(_0x368eaa,null))[_0x747d('0x47')](handleError(_0x368eaa,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 6872683..1633291 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 _0x7afe=['rimraf','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x40b295,_0x5751c3){var _0x2a3397=function(_0x181af6){while(--_0x181af6){_0x40b295['push'](_0x40b295['shift']());}};_0x2a3397(++_0x5751c3);}(_0x7afe,0xc1));var _0xe7af=function(_0x281334,_0x4d8013){_0x281334=_0x281334-0x0;var _0x115f37=_0x7afe[_0x281334];return _0x115f37;};'use strict';var _=require(_0xe7af('0x0'));var util=require(_0xe7af('0x1'));var logger=require(_0xe7af('0x2'))(_0xe7af('0x3'));var moment=require('moment');var BPromise=require(_0xe7af('0x4'));var rp=require(_0xe7af('0x5'));var fs=require('fs');var path=require(_0xe7af('0x6'));var rimraf=require(_0xe7af('0x7'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0xe7af('0x8')]=function(_0x580970,_0x45632c){return _0x580970[_0xe7af('0x9')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23d6=['lodash','../../config/logger','moment','bluebird','path','rimraf','exports','define','IntegrationReport','report_integration'];(function(_0x135176,_0x25f953){var _0x1709e6=function(_0x2fe711){while(--_0x2fe711){_0x135176['push'](_0x135176['shift']());}};_0x1709e6(++_0x25f953);}(_0x23d6,0x96));var _0x623d=function(_0x27621c,_0x33125e){_0x27621c=_0x27621c-0x0;var _0x2e2df5=_0x23d6[_0x27621c];return _0x2e2df5;};'use strict';var _=require(_0x623d('0x0'));var util=require('util');var logger=require(_0x623d('0x1'))('api');var moment=require(_0x623d('0x2'));var BPromise=require(_0x623d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x623d('0x4'));var rimraf=require(_0x623d('0x5'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x623d('0x6')]=function(_0x5efeb7,_0x4687d6){return _0x5efeb7[_0x623d('0x7')](_0x623d('0x8'),attributes,{'tableName':_0x623d('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 641a5b6..f98d91c 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x5a7c45,_0x3bce53){var _0x471a7f=function(_0x39255e){while(--_0x39255e){_0x5a7c45['push'](_0x5a7c45['shift']());}};_0x471a7f(++_0x3bce53);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'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')]('IntegrationReport,\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 _0xe2fe=['then','info','IntegrationReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x49e3b0,_0x5a2cc8){var _0x2592fc=function(_0x1edfd5){while(--_0x1edfd5){_0x49e3b0['push'](_0x49e3b0['shift']());}};_0x2592fc(++_0x5a2cc8);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 937ce43..117c784 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 _0xa29a=['/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./interval.controller','get','index','/:id','isAuthenticated','show'];(function(_0x29b39d,_0x3a8d8b){var _0x5d5fd7=function(_0x22359d){while(--_0x22359d){_0x29b39d['push'](_0x29b39d['shift']());}};_0x5d5fd7(++_0x3a8d8b);}(_0xa29a,0x1ee));var _0xaa29=function(_0x466d0a,_0x4e8fe9){_0x466d0a=_0x466d0a-0x0;var _0x131cc0=_0xa29a[_0x466d0a];return _0x131cc0;};'use strict';var multer=require(_0xaa29('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa29('0x1'));var express=require(_0xaa29('0x2'));var router=express[_0xaa29('0x3')]();var fs_extra=require(_0xaa29('0x4'));var auth=require(_0xaa29('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaa29('0x6'));router[_0xaa29('0x7')]('/',auth['isAuthenticated'](),controller[_0xaa29('0x8')]);router[_0xaa29('0x7')](_0xaa29('0x9'),auth[_0xaa29('0xa')](),controller[_0xaa29('0xb')]);router[_0xaa29('0x7')](_0xaa29('0xc'),auth[_0xaa29('0xa')](),controller[_0xaa29('0xd')]);router['post']('/',auth[_0xaa29('0xa')](),controller[_0xaa29('0xe')]);router[_0xaa29('0xf')]('/:id/sub_intervals',auth[_0xaa29('0xa')](),controller[_0xaa29('0x10')]);router[_0xaa29('0xf')](_0xaa29('0x11'),auth['isAuthenticated'](),controller[_0xaa29('0x12')]);router['put']('/:id',auth[_0xaa29('0xa')](),controller['update']);router[_0xaa29('0x13')](_0xaa29('0x9'),auth[_0xaa29('0xa')](),controller[_0xaa29('0x14')]);module[_0xaa29('0x15')]=router; \ No newline at end of file +var _0x22da=['/:id','show','get','getIntervals','post','create','/:id/sub_intervals','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index'];(function(_0xd32d70,_0x34a41e){var _0x5e8505=function(_0x5d4460){while(--_0x5d4460){_0xd32d70['push'](_0xd32d70['shift']());}};_0x5e8505(++_0x34a41e);}(_0x22da,0x80));var _0xa22d=function(_0x2b6154,_0x464090){_0x2b6154=_0x2b6154-0x0;var _0x2d27a5=_0x22da[_0x2b6154];return _0x2d27a5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa22d('0x0'));var timeout=require(_0xa22d('0x1'));var express=require(_0xa22d('0x2'));var router=express[_0xa22d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa22d('0x4'));var interaction=require(_0xa22d('0x5'));var config=require(_0xa22d('0x6'));var controller=require(_0xa22d('0x7'));router['get']('/',auth[_0xa22d('0x8')](),controller[_0xa22d('0x9')]);router['get'](_0xa22d('0xa'),auth[_0xa22d('0x8')](),controller[_0xa22d('0xb')]);router[_0xa22d('0xc')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xa22d('0xd')]);router[_0xa22d('0xe')]('/',auth['isAuthenticated'](),controller[_0xa22d('0xf')]);router[_0xa22d('0xe')](_0xa22d('0x10'),auth[_0xa22d('0x8')](),controller['addInterval']);router['post'](_0xa22d('0x11'),auth[_0xa22d('0x8')](),controller['addIntervals']);router[_0xa22d('0x12')]('/:id',auth[_0xa22d('0x8')](),controller[_0xa22d('0x13')]);router[_0xa22d('0x14')]('/:id',auth[_0xa22d('0x8')](),controller[_0xa22d('0x15')]);module[_0xa22d('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 5c0f0b0..f4473b7 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 _0x833b=['STRING','exports'];(function(_0xb3275c,_0x2623c3){var _0x58e50b=function(_0x2303a3){while(--_0x2303a3){_0xb3275c['push'](_0xb3275c['shift']());}};_0x58e50b(++_0x2623c3);}(_0x833b,0x153));var _0xb833=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x833b[_0x42bdad];return _0x122626;};'use strict';var Sequelize=require('sequelize');module[_0xb833('0x0')]={'name':{'type':Sequelize[_0xb833('0x1')]},'description':{'type':Sequelize[_0xb833('0x1')]},'interval':{'type':Sequelize[_0xb833('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x8b19=['STRING','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8b19,0x183));var _0x98b1=function(_0x4cdcae,_0x288104){_0x4cdcae=_0x4cdcae-0x0;var _0xedd296=_0x8b19[_0x4cdcae];return _0xedd296;};'use strict';var Sequelize=require(_0x98b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x98b1('0x1')]},'description':{'type':Sequelize[_0x98b1('0x1')]},'interval':{'type':Sequelize[_0x98b1('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index e703fb2..2400390 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 _0xeb07=['destroy','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','bulkCreate','findAll','eml-format','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x5a3fb1,_0x14dbbc){var _0x49e026=function(_0xda57d4){while(--_0xda57d4){_0x5a3fb1['push'](_0x5a3fb1['shift']());}};_0x49e026(++_0x14dbbc);}(_0xeb07,0x68));var _0x7eb0=function(_0x47d79b,_0x11cc23){_0x47d79b=_0x47d79b-0x0;var _0x5ac539=_0xeb07[_0x47d79b];return _0x5ac539;};'use strict';var emlformat=require(_0x7eb0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7eb0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7eb0('0x2'));var util=require(_0x7eb0('0x3'));var path=require(_0x7eb0('0x4'));var sox=require('sox');var csv=require(_0x7eb0('0x5'));var ejs=require(_0x7eb0('0x6'));var fs=require('fs');var fs_extra=require(_0x7eb0('0x7'));var _=require(_0x7eb0('0x8'));var squel=require(_0x7eb0('0x9'));var crypto=require(_0x7eb0('0xa'));var jsforce=require(_0x7eb0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7eb0('0x5'));var querystring=require(_0x7eb0('0xc'));var Papa=require('papaparse');var Redis=require(_0x7eb0('0xd'));var authService=require(_0x7eb0('0xe'));var qs=require(_0x7eb0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7eb0('0x10'));var logger=require(_0x7eb0('0x11'))(_0x7eb0('0x12'));var utils=require(_0x7eb0('0x13'));var config=require(_0x7eb0('0x14'));var licenseUtil=require(_0x7eb0('0x15'));var db=require('../../mysqldb')['db'];var extensions=require(_0x7eb0('0x16'));function respondWithStatusCode(_0x2dcb9a,_0x302628){_0x302628=_0x302628||0xcc;return function(_0x442aa3){if(_0x442aa3){return _0x2dcb9a[_0x7eb0('0x17')](_0x302628);}return _0x2dcb9a[_0x7eb0('0x18')](_0x302628)[_0x7eb0('0x19')]();};}function respondWithResult(_0x5b8323,_0x3a8cad){_0x3a8cad=_0x3a8cad||0xc8;return function(_0x33db44){if(_0x33db44){return _0x5b8323[_0x7eb0('0x18')](_0x3a8cad)[_0x7eb0('0x1a')](_0x33db44);}};}function respondWithFilteredResult(_0x2b4b61,_0x2b258c){return function(_0x3c1115){if(_0x3c1115){var _0x71ab82=typeof _0x2b258c[_0x7eb0('0x1b')]===_0x7eb0('0x1c')&&typeof _0x2b258c['limit']===_0x7eb0('0x1c');var _0x299882=_0x3c1115[_0x7eb0('0x1d')];var _0x7c3a68=_0x71ab82?0x0:_0x2b258c[_0x7eb0('0x1b')];var _0x167e2c=_0x71ab82?_0x3c1115[_0x7eb0('0x1d')]:_0x2b258c[_0x7eb0('0x1b')]+_0x2b258c[_0x7eb0('0x1e')];var _0xe45844;if(_0x167e2c>=_0x299882){_0x167e2c=_0x299882;_0xe45844=0xc8;}else{_0xe45844=0xce;}_0x2b4b61['status'](_0xe45844);return _0x2b4b61[_0x7eb0('0x1f')](_0x7eb0('0x20'),_0x7c3a68+'-'+_0x167e2c+'/'+_0x299882)[_0x7eb0('0x1a')](_0x3c1115);}return null;};}function patchUpdates(_0x3234bb){return function(_0x5370d6){try{jsonpatch[_0x7eb0('0x21')](_0x5370d6,_0x3234bb,!![]);}catch(_0x2e58a0){return BPromise[_0x7eb0('0x22')](_0x2e58a0);}return _0x5370d6[_0x7eb0('0x23')]();};}function saveUpdates(_0x53e597,_0x9604f9){return function(_0x24572b){if(_0x24572b){return _0x24572b[_0x7eb0('0x24')](_0x53e597)['then'](function(_0x592700){return _0x592700;});}return null;};}function removeEntity(_0x357eca,_0x2d7f1d){return function(_0x56e976){if(_0x56e976){return _0x56e976['destroy']()[_0x7eb0('0x25')](function(){var _0x272438=_0x56e976[_0x7eb0('0x26')]({'plain':!![]});var _0x257237=_0x7eb0('0x27');return db[_0x7eb0('0x28')]['destroy']({'where':{'type':_0x257237,'resourceId':_0x272438['id']}})['then'](function(){return _0x56e976;});})[_0x7eb0('0x25')](function(){_0x357eca[_0x7eb0('0x18')](0xcc)[_0x7eb0('0x19')]();});}};}function handleEntityNotFound(_0x56780f,_0x439be7){return function(_0x4640ac){if(!_0x4640ac){_0x56780f[_0x7eb0('0x17')](0x194);}return _0x4640ac;};}function handleError(_0x4839c8,_0x38e2f1){_0x38e2f1=_0x38e2f1||0x1f4;return function(_0x1b9722){logger[_0x7eb0('0x29')](_0x1b9722[_0x7eb0('0x2a')]);if(_0x1b9722['name']){delete _0x1b9722[_0x7eb0('0x2b')];}_0x4839c8['status'](_0x38e2f1)[_0x7eb0('0x2c')](_0x1b9722);};}exports[_0x7eb0('0x2d')]=function(_0xd8d16d,_0x3b6b88){var _0x46d701={},_0x27d0c6={},_0x3450ee={'count':0x0,'rows':[]};var _0x29925d=_[_0x7eb0('0x2e')](db[_0x7eb0('0x2f')][_0x7eb0('0x30')],function(_0x63b13f){return{'name':_0x63b13f[_0x7eb0('0x31')],'type':_0x63b13f['type'][_0x7eb0('0x32')]};});_0x27d0c6[_0x7eb0('0x33')]=_[_0x7eb0('0x2e')](_0x29925d,_0x7eb0('0x2b'));_0x27d0c6[_0x7eb0('0x34')]=_[_0x7eb0('0x35')](_0xd8d16d[_0x7eb0('0x34')]);_0x27d0c6[_0x7eb0('0x36')]=_[_0x7eb0('0x37')](_0x27d0c6[_0x7eb0('0x33')],_0x27d0c6[_0x7eb0('0x34')]);_0x46d701[_0x7eb0('0x38')]=_[_0x7eb0('0x37')](_0x27d0c6[_0x7eb0('0x33')],qs[_0x7eb0('0x39')](_0xd8d16d['query'][_0x7eb0('0x39')]));_0x46d701[_0x7eb0('0x38')]=_0x46d701[_0x7eb0('0x38')][_0x7eb0('0x3a')]?_0x46d701['attributes']:_0x27d0c6[_0x7eb0('0x33')];if(!_0xd8d16d[_0x7eb0('0x34')][_0x7eb0('0x3b')](_0x7eb0('0x3c'))){_0x46d701[_0x7eb0('0x1e')]=qs[_0x7eb0('0x1e')](_0xd8d16d[_0x7eb0('0x34')][_0x7eb0('0x1e')]);_0x46d701[_0x7eb0('0x1b')]=qs[_0x7eb0('0x1b')](_0xd8d16d[_0x7eb0('0x34')][_0x7eb0('0x1b')]);}_0x46d701[_0x7eb0('0x3d')]=qs[_0x7eb0('0x3e')](_0xd8d16d[_0x7eb0('0x34')][_0x7eb0('0x3e')]);_0x46d701[_0x7eb0('0x3f')]=qs[_0x7eb0('0x36')](_[_0x7eb0('0x40')](_0xd8d16d[_0x7eb0('0x34')],_0x27d0c6[_0x7eb0('0x36')]),_0x29925d);if(_0xd8d16d[_0x7eb0('0x34')][_0x7eb0('0x41')]){_0x46d701[_0x7eb0('0x3f')]=_[_0x7eb0('0x42')](_0x46d701[_0x7eb0('0x3f')],{'$or':_[_0x7eb0('0x2e')](_0x29925d,function(_0xdb7d2d){if(_0xdb7d2d['type']!==_0x7eb0('0x43')){var _0xbe5b87={};_0xbe5b87[_0xdb7d2d[_0x7eb0('0x2b')]]={'$like':'%'+_0xd8d16d[_0x7eb0('0x34')][_0x7eb0('0x41')]+'%'};return _0xbe5b87;}})});}_0x46d701=_['merge']({},_0x46d701,_0xd8d16d[_0x7eb0('0x44')]);var _0x2672bb={'where':_0x46d701[_0x7eb0('0x3f')]};return db[_0x7eb0('0x2f')][_0x7eb0('0x1d')](_0x2672bb)['then'](function(_0x4d71a9){_0x3450ee[_0x7eb0('0x1d')]=_0x4d71a9;if(_0xd8d16d[_0x7eb0('0x34')][_0x7eb0('0x45')]){_0x46d701[_0x7eb0('0x46')]=[{'all':!![]}];}return db[_0x7eb0('0x2f')]['findAll'](_0x46d701);})['then'](function(_0x8c7feb){_0x3450ee[_0x7eb0('0x47')]=_0x8c7feb;return _0x3450ee;})['then'](respondWithFilteredResult(_0x3b6b88,_0x46d701))[_0x7eb0('0x48')](handleError(_0x3b6b88,null));};exports[_0x7eb0('0x49')]=function(_0x26f309,_0x3d60eb){var _0x4aec74={'raw':!![],'where':{'id':_0x26f309[_0x7eb0('0x4a')]['id']}},_0x4bc61={};_0x4bc61[_0x7eb0('0x33')]=_[_0x7eb0('0x35')](db[_0x7eb0('0x2f')][_0x7eb0('0x30')]);_0x4bc61[_0x7eb0('0x34')]=_[_0x7eb0('0x35')](_0x26f309[_0x7eb0('0x34')]);_0x4bc61['filters']=_[_0x7eb0('0x37')](_0x4bc61['model'],_0x4bc61[_0x7eb0('0x34')]);_0x4aec74[_0x7eb0('0x38')]=_['intersection'](_0x4bc61[_0x7eb0('0x33')],qs[_0x7eb0('0x39')](_0x26f309[_0x7eb0('0x34')][_0x7eb0('0x39')]));_0x4aec74[_0x7eb0('0x38')]=_0x4aec74[_0x7eb0('0x38')][_0x7eb0('0x3a')]?_0x4aec74[_0x7eb0('0x38')]:_0x4bc61[_0x7eb0('0x33')];if(_0x26f309[_0x7eb0('0x34')]['includeAll']){_0x4aec74[_0x7eb0('0x46')]=[{'all':!![]}];}_0x4aec74=_['merge']({},_0x4aec74,_0x26f309['options']);return db[_0x7eb0('0x2f')][_0x7eb0('0x4b')](_0x4aec74)['then'](handleEntityNotFound(_0x3d60eb,null))[_0x7eb0('0x25')](respondWithResult(_0x3d60eb,null))[_0x7eb0('0x48')](handleError(_0x3d60eb,null));};exports['create']=function(_0x3d108c,_0x3955cc){return db[_0x7eb0('0x2f')][_0x7eb0('0x4c')](_0x3d108c['body'],{})[_0x7eb0('0x25')](function(_0x1dc160){var _0x3f02ba=_0x3d108c[_0x7eb0('0x4d')][_0x7eb0('0x26')]({'plain':!![]});if(!_0x3f02ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f02ba[_0x7eb0('0x4e')]==='user'){var _0x2001af=_0x1dc160[_0x7eb0('0x26')]({'plain':!![]});var _0x59db84='Intervals';return db[_0x7eb0('0x4f')][_0x7eb0('0x4b')]({'where':{'name':_0x59db84,'userProfileId':_0x3f02ba[_0x7eb0('0x50')]},'raw':!![]})['then'](function(_0xc777f5){if(_0xc777f5&&_0xc777f5[_0x7eb0('0x51')]===0x0){return db[_0x7eb0('0x28')][_0x7eb0('0x4c')]({'name':_0x2001af['name'],'resourceId':_0x2001af['id'],'type':_0xc777f5['name'],'sectionId':_0xc777f5['id']},{})['then'](function(){return _0x1dc160;});}else{return _0x1dc160;}})[_0x7eb0('0x48')](function(_0x7b8cf2){logger[_0x7eb0('0x29')](_0x7eb0('0x52'),_0x7b8cf2);throw _0x7b8cf2;});}return _0x1dc160;})['then'](respondWithResult(_0x3955cc,0xc9))['catch'](handleError(_0x3955cc,null));};exports[_0x7eb0('0x24')]=function(_0x3a1824,_0x3c4fcf){if(_0x3a1824[_0x7eb0('0x53')]['id']){delete _0x3a1824[_0x7eb0('0x53')]['id'];}return db[_0x7eb0('0x2f')]['find']({'where':{'id':_0x3a1824[_0x7eb0('0x4a')]['id']}})[_0x7eb0('0x25')](handleEntityNotFound(_0x3c4fcf,null))[_0x7eb0('0x25')](saveUpdates(_0x3a1824[_0x7eb0('0x53')],null))[_0x7eb0('0x25')](respondWithResult(_0x3c4fcf,null))[_0x7eb0('0x48')](handleError(_0x3c4fcf,null));};exports[_0x7eb0('0x54')]=function(_0x3d1888,_0x406492){return db[_0x7eb0('0x2f')][_0x7eb0('0x4b')]({'where':{'id':_0x3d1888[_0x7eb0('0x4a')]['id']}})[_0x7eb0('0x25')](handleEntityNotFound(_0x406492,null))['then'](removeEntity(_0x406492,null))[_0x7eb0('0x48')](handleError(_0x406492,null));};exports[_0x7eb0('0x55')]=function(_0x272418,_0x22be8a,_0x2c985b){if(_0x272418[_0x7eb0('0x53')]['id']){delete _0x272418[_0x7eb0('0x53')]['id'];}return db[_0x7eb0('0x2f')][_0x7eb0('0x4b')]({'where':{'id':_0x272418[_0x7eb0('0x4a')]['id']}})[_0x7eb0('0x25')](handleEntityNotFound(_0x22be8a,null))[_0x7eb0('0x25')](function(_0x1e3866){if(_0x1e3866){_0x272418[_0x7eb0('0x53')][_0x7eb0('0x56')]=_0x1e3866['id'];return db[_0x7eb0('0x2f')][_0x7eb0('0x4c')](_0x272418['body']);}})[_0x7eb0('0x25')](respondWithResult(_0x22be8a,null))[_0x7eb0('0x48')](handleError(_0x22be8a,null));};exports[_0x7eb0('0x57')]=function(_0x156e7a,_0x1ff3d9,_0x7ebf0f){var _0x1bffce={};var _0x517da0={};var _0x4b8142;var _0x332a97;return db[_0x7eb0('0x2f')][_0x7eb0('0x58')]({'where':{'id':_0x156e7a[_0x7eb0('0x4a')]['id']}})[_0x7eb0('0x25')](handleEntityNotFound(_0x1ff3d9,null))[_0x7eb0('0x25')](function(_0x49dee2){if(_0x49dee2){_0x4b8142=_0x49dee2;_0x517da0[_0x7eb0('0x33')]=_[_0x7eb0('0x35')](db[_0x7eb0('0x2f')]['rawAttributes']);_0x517da0[_0x7eb0('0x34')]=_[_0x7eb0('0x35')](_0x156e7a['query']);_0x517da0[_0x7eb0('0x36')]=_[_0x7eb0('0x37')](_0x517da0[_0x7eb0('0x33')],_0x517da0[_0x7eb0('0x34')]);_0x1bffce[_0x7eb0('0x38')]=_[_0x7eb0('0x37')](_0x517da0[_0x7eb0('0x33')],qs[_0x7eb0('0x39')](_0x156e7a['query'][_0x7eb0('0x39')]));_0x1bffce[_0x7eb0('0x38')]=_0x1bffce[_0x7eb0('0x38')]['length']?_0x1bffce[_0x7eb0('0x38')]:_0x517da0[_0x7eb0('0x33')];_0x1bffce[_0x7eb0('0x3d')]=qs[_0x7eb0('0x3e')](_0x156e7a['query'][_0x7eb0('0x3e')]);_0x1bffce[_0x7eb0('0x3f')]=qs[_0x7eb0('0x36')](_[_0x7eb0('0x40')](_0x156e7a[_0x7eb0('0x34')],_0x517da0[_0x7eb0('0x36')]));if(_0x156e7a[_0x7eb0('0x34')][_0x7eb0('0x41')]){_0x1bffce[_0x7eb0('0x3f')]=_[_0x7eb0('0x42')](_0x1bffce[_0x7eb0('0x3f')],{'$or':_[_0x7eb0('0x2e')](_0x1bffce[_0x7eb0('0x38')],function(_0xd2f81a){var _0x2fb2e0={};_0x2fb2e0[_0xd2f81a]={'$like':'%'+_0x156e7a[_0x7eb0('0x34')][_0x7eb0('0x41')]+'%'};return _0x2fb2e0;})});}_0x1bffce=_[_0x7eb0('0x42')]({},_0x1bffce,_0x156e7a[_0x7eb0('0x44')]);return _0x4b8142[_0x7eb0('0x57')](_0x1bffce);}})['then'](function(_0x52da76){if(_0x52da76){_0x332a97=_0x52da76[_0x7eb0('0x3a')];if(!_0x156e7a[_0x7eb0('0x34')][_0x7eb0('0x3b')](_0x7eb0('0x3c'))){_0x1bffce[_0x7eb0('0x1e')]=qs[_0x7eb0('0x1e')](_0x156e7a[_0x7eb0('0x34')][_0x7eb0('0x1e')]);_0x1bffce[_0x7eb0('0x1b')]=qs[_0x7eb0('0x1b')](_0x156e7a['query'][_0x7eb0('0x1b')]);}return _0x4b8142[_0x7eb0('0x57')](_0x1bffce);}})[_0x7eb0('0x25')](function(_0x23fa77){if(_0x23fa77){return _0x23fa77?{'count':_0x332a97,'rows':_0x23fa77}:null;}})[_0x7eb0('0x25')](respondWithResult(_0x1ff3d9,null))['catch'](handleError(_0x1ff3d9,null));};exports[_0x7eb0('0x59')]=function(_0xb6dee5,_0x550828,_0x5e0a8d){return db['Interval']['findOne']({'where':{'id':_0xb6dee5[_0x7eb0('0x4a')]['id']}})[_0x7eb0('0x25')](handleEntityNotFound(_0x550828,null))['then'](function(_0x2ffa09){if(_0x2ffa09){return db[_0x7eb0('0x5a')][_0x7eb0('0x5b')](function(_0x3b7f98){return db['Interval'][_0x7eb0('0x54')]({'where':{'IntervalId':_0xb6dee5[_0x7eb0('0x4a')]['id']},'transaction':_0x3b7f98})[_0x7eb0('0x25')](function(_0xd3efa9){var _0x38e313=_[_0x7eb0('0x2e')](_0xb6dee5[_0x7eb0('0x53')],function(_0x1d7169){delete _0x1d7169['id'];_0x1d7169[_0x7eb0('0x56')]=_0xb6dee5[_0x7eb0('0x4a')]['id'];return _0x1d7169;});return db[_0x7eb0('0x2f')][_0x7eb0('0x5c')](_0x38e313,{'transaction':_0x3b7f98});});})['then'](function(){return db[_0x7eb0('0x2f')][_0x7eb0('0x5d')]({'where':{'IntervalId':_0xb6dee5[_0x7eb0('0x4a')]['id']}});});}})[_0x7eb0('0x25')](respondWithResult(_0x550828,null))[_0x7eb0('0x48')](handleError(_0x550828,null));}; \ No newline at end of file +var _0xc002=['user','Intervals','UserProfileSection','userProfileId','autoAssociation','body','addInterval','IntervalId','findOne','filter','getIntervals','addIntervals','transaction','bulkCreate','findAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','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','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','Interval','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','includeAll','catch','show','params','rawAttributes','fields','include','find','create','get','role'];(function(_0x21f803,_0x34a80a){var _0x22b6ab=function(_0x1d87ba){while(--_0x1d87ba){_0x21f803['push'](_0x21f803['shift']());}};_0x22b6ab(++_0x34a80a);}(_0xc002,0x1db));var _0x2c00=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xc002[_0x411017];return _0x2adeea;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2c00('0x0'));var jsonpatch=require(_0x2c00('0x1'));var rp=require(_0x2c00('0x2'));var moment=require(_0x2c00('0x3'));var BPromise=require(_0x2c00('0x4'));var Mustache=require(_0x2c00('0x5'));var util=require('util');var path=require(_0x2c00('0x6'));var sox=require(_0x2c00('0x7'));var csv=require('to-csv');var ejs=require(_0x2c00('0x8'));var fs=require('fs');var fs_extra=require(_0x2c00('0x9'));var _=require(_0x2c00('0xa'));var squel=require(_0x2c00('0xb'));var crypto=require(_0x2c00('0xc'));var jsforce=require(_0x2c00('0xd'));var deskjs=require(_0x2c00('0xe'));var toCsv=require(_0x2c00('0xf'));var querystring=require(_0x2c00('0x10'));var Papa=require(_0x2c00('0x11'));var Redis=require('ioredis');var authService=require(_0x2c00('0x12'));var qs=require(_0x2c00('0x13'));var as=require(_0x2c00('0x14'));var hardwareService=require(_0x2c00('0x15'));var logger=require('../../config/logger')(_0x2c00('0x16'));var utils=require(_0x2c00('0x17'));var config=require(_0x2c00('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c00('0x19'))['db'];var extensions=require(_0x2c00('0x1a'));function respondWithStatusCode(_0x5dfb0d,_0xfb1996){_0xfb1996=_0xfb1996||0xcc;return function(_0xc054c1){if(_0xc054c1){return _0x5dfb0d[_0x2c00('0x1b')](_0xfb1996);}return _0x5dfb0d[_0x2c00('0x1c')](_0xfb1996)[_0x2c00('0x1d')]();};}function respondWithResult(_0x1ea9eb,_0x16fce8){_0x16fce8=_0x16fce8||0xc8;return function(_0x34acf3){if(_0x34acf3){return _0x1ea9eb[_0x2c00('0x1c')](_0x16fce8)[_0x2c00('0x1e')](_0x34acf3);}};}function respondWithFilteredResult(_0xbd6dfa,_0x33d735){return function(_0xb4cc8){if(_0xb4cc8){var _0x1169de=typeof _0x33d735[_0x2c00('0x1f')]===_0x2c00('0x20')&&typeof _0x33d735[_0x2c00('0x21')]===_0x2c00('0x20');var _0x20055c=_0xb4cc8[_0x2c00('0x22')];var _0x222a79=_0x1169de?0x0:_0x33d735[_0x2c00('0x1f')];var _0x35763f=_0x1169de?_0xb4cc8[_0x2c00('0x22')]:_0x33d735[_0x2c00('0x1f')]+_0x33d735['limit'];var _0x540ce8;if(_0x35763f>=_0x20055c){_0x35763f=_0x20055c;_0x540ce8=0xc8;}else{_0x540ce8=0xce;}_0xbd6dfa[_0x2c00('0x1c')](_0x540ce8);return _0xbd6dfa['set']('Content-Range',_0x222a79+'-'+_0x35763f+'/'+_0x20055c)[_0x2c00('0x1e')](_0xb4cc8);}return null;};}function patchUpdates(_0x44e575){return function(_0x3d9028){try{jsonpatch[_0x2c00('0x23')](_0x3d9028,_0x44e575,!![]);}catch(_0x553402){return BPromise[_0x2c00('0x24')](_0x553402);}return _0x3d9028['save']();};}function saveUpdates(_0x574796,_0x24b5c1){return function(_0x418593){if(_0x418593){return _0x418593[_0x2c00('0x25')](_0x574796)[_0x2c00('0x26')](function(_0x698b2a){return _0x698b2a;});}return null;};}function removeEntity(_0x53eb19,_0x8bbb9a){return function(_0x4bc9c8){if(_0x4bc9c8){return _0x4bc9c8[_0x2c00('0x27')]()[_0x2c00('0x26')](function(){var _0x15f7b9=_0x4bc9c8['get']({'plain':!![]});var _0x5c2ee6='Intervals';return db[_0x2c00('0x28')]['destroy']({'where':{'type':_0x5c2ee6,'resourceId':_0x15f7b9['id']}})[_0x2c00('0x26')](function(){return _0x4bc9c8;});})[_0x2c00('0x26')](function(){_0x53eb19[_0x2c00('0x1c')](0xcc)[_0x2c00('0x1d')]();});}};}function handleEntityNotFound(_0x2e5fdc,_0x2a0203){return function(_0x4ed920){if(!_0x4ed920){_0x2e5fdc['sendStatus'](0x194);}return _0x4ed920;};}function handleError(_0x4316c3,_0x41c0d5){_0x41c0d5=_0x41c0d5||0x1f4;return function(_0x20dc7c){logger[_0x2c00('0x29')](_0x20dc7c[_0x2c00('0x2a')]);if(_0x20dc7c[_0x2c00('0x2b')]){delete _0x20dc7c[_0x2c00('0x2b')];}_0x4316c3['status'](_0x41c0d5)[_0x2c00('0x2c')](_0x20dc7c);};}exports[_0x2c00('0x2d')]=function(_0x3b2848,_0x4ef986){var _0x2e7f75={},_0x5d061a={},_0x34f912={'count':0x0,'rows':[]};var _0x343e51=_[_0x2c00('0x2e')](db[_0x2c00('0x2f')]['rawAttributes'],function(_0x55c068){return{'name':_0x55c068[_0x2c00('0x30')],'type':_0x55c068[_0x2c00('0x31')][_0x2c00('0x32')]};});_0x5d061a[_0x2c00('0x33')]=_[_0x2c00('0x2e')](_0x343e51,_0x2c00('0x2b'));_0x5d061a[_0x2c00('0x34')]=_[_0x2c00('0x35')](_0x3b2848[_0x2c00('0x34')]);_0x5d061a[_0x2c00('0x36')]=_[_0x2c00('0x37')](_0x5d061a['model'],_0x5d061a[_0x2c00('0x34')]);_0x2e7f75[_0x2c00('0x38')]=_[_0x2c00('0x37')](_0x5d061a['model'],qs['fields'](_0x3b2848[_0x2c00('0x34')]['fields']));_0x2e7f75[_0x2c00('0x38')]=_0x2e7f75[_0x2c00('0x38')][_0x2c00('0x39')]?_0x2e7f75[_0x2c00('0x38')]:_0x5d061a[_0x2c00('0x33')];if(!_0x3b2848[_0x2c00('0x34')][_0x2c00('0x3a')](_0x2c00('0x3b'))){_0x2e7f75[_0x2c00('0x21')]=qs[_0x2c00('0x21')](_0x3b2848['query'][_0x2c00('0x21')]);_0x2e7f75[_0x2c00('0x1f')]=qs[_0x2c00('0x1f')](_0x3b2848['query'][_0x2c00('0x1f')]);}_0x2e7f75[_0x2c00('0x3c')]=qs[_0x2c00('0x3d')](_0x3b2848[_0x2c00('0x34')][_0x2c00('0x3d')]);_0x2e7f75['where']=qs[_0x2c00('0x36')](_[_0x2c00('0x3e')](_0x3b2848[_0x2c00('0x34')],_0x5d061a[_0x2c00('0x36')]),_0x343e51);if(_0x3b2848['query']['filter']){_0x2e7f75[_0x2c00('0x3f')]=_[_0x2c00('0x40')](_0x2e7f75['where'],{'$or':_['map'](_0x343e51,function(_0x4645fa){if(_0x4645fa['type']!=='VIRTUAL'){var _0x11c903={};_0x11c903[_0x4645fa['name']]={'$like':'%'+_0x3b2848[_0x2c00('0x34')]['filter']+'%'};return _0x11c903;}})});}_0x2e7f75=_[_0x2c00('0x40')]({},_0x2e7f75,_0x3b2848[_0x2c00('0x41')]);var _0x1cde21={'where':_0x2e7f75['where']};return db[_0x2c00('0x2f')][_0x2c00('0x22')](_0x1cde21)[_0x2c00('0x26')](function(_0x4d56c7){_0x34f912[_0x2c00('0x22')]=_0x4d56c7;if(_0x3b2848[_0x2c00('0x34')][_0x2c00('0x42')]){_0x2e7f75['include']=[{'all':!![]}];}return db[_0x2c00('0x2f')]['findAll'](_0x2e7f75);})[_0x2c00('0x26')](function(_0x41f758){_0x34f912['rows']=_0x41f758;return _0x34f912;})[_0x2c00('0x26')](respondWithFilteredResult(_0x4ef986,_0x2e7f75))[_0x2c00('0x43')](handleError(_0x4ef986,null));};exports[_0x2c00('0x44')]=function(_0x36e523,_0x2f565a){var _0x5c62d1={'raw':!![],'where':{'id':_0x36e523[_0x2c00('0x45')]['id']}},_0x265252={};_0x265252[_0x2c00('0x33')]=_['keys'](db['Interval'][_0x2c00('0x46')]);_0x265252[_0x2c00('0x34')]=_[_0x2c00('0x35')](_0x36e523['query']);_0x265252[_0x2c00('0x36')]=_['intersection'](_0x265252[_0x2c00('0x33')],_0x265252[_0x2c00('0x34')]);_0x5c62d1[_0x2c00('0x38')]=_[_0x2c00('0x37')](_0x265252[_0x2c00('0x33')],qs[_0x2c00('0x47')](_0x36e523[_0x2c00('0x34')]['fields']));_0x5c62d1[_0x2c00('0x38')]=_0x5c62d1[_0x2c00('0x38')]['length']?_0x5c62d1[_0x2c00('0x38')]:_0x265252[_0x2c00('0x33')];if(_0x36e523['query'][_0x2c00('0x42')]){_0x5c62d1[_0x2c00('0x48')]=[{'all':!![]}];}_0x5c62d1=_[_0x2c00('0x40')]({},_0x5c62d1,_0x36e523[_0x2c00('0x41')]);return db[_0x2c00('0x2f')][_0x2c00('0x49')](_0x5c62d1)['then'](handleEntityNotFound(_0x2f565a,null))['then'](respondWithResult(_0x2f565a,null))['catch'](handleError(_0x2f565a,null));};exports[_0x2c00('0x4a')]=function(_0x1c90af,_0x403a7a){return db[_0x2c00('0x2f')][_0x2c00('0x4a')](_0x1c90af['body'],{})['then'](function(_0x4adfe9){var _0x29be30=_0x1c90af['user'][_0x2c00('0x4b')]({'plain':!![]});if(!_0x29be30)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29be30[_0x2c00('0x4c')]===_0x2c00('0x4d')){var _0x2fcb65=_0x4adfe9[_0x2c00('0x4b')]({'plain':!![]});var _0x547a20=_0x2c00('0x4e');return db[_0x2c00('0x4f')][_0x2c00('0x49')]({'where':{'name':_0x547a20,'userProfileId':_0x29be30[_0x2c00('0x50')]},'raw':!![]})[_0x2c00('0x26')](function(_0x11db73){if(_0x11db73&&_0x11db73[_0x2c00('0x51')]===0x0){return db[_0x2c00('0x28')][_0x2c00('0x4a')]({'name':_0x2fcb65[_0x2c00('0x2b')],'resourceId':_0x2fcb65['id'],'type':_0x11db73[_0x2c00('0x2b')],'sectionId':_0x11db73['id']},{})['then'](function(){return _0x4adfe9;});}else{return _0x4adfe9;}})[_0x2c00('0x43')](function(_0x4d91ca){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d91ca);throw _0x4d91ca;});}return _0x4adfe9;})[_0x2c00('0x26')](respondWithResult(_0x403a7a,0xc9))['catch'](handleError(_0x403a7a,null));};exports[_0x2c00('0x25')]=function(_0x4b8811,_0x1f7a9c){if(_0x4b8811['body']['id']){delete _0x4b8811[_0x2c00('0x52')]['id'];}return db[_0x2c00('0x2f')][_0x2c00('0x49')]({'where':{'id':_0x4b8811[_0x2c00('0x45')]['id']}})[_0x2c00('0x26')](handleEntityNotFound(_0x1f7a9c,null))[_0x2c00('0x26')](saveUpdates(_0x4b8811[_0x2c00('0x52')],null))['then'](respondWithResult(_0x1f7a9c,null))[_0x2c00('0x43')](handleError(_0x1f7a9c,null));};exports[_0x2c00('0x27')]=function(_0x434ad5,_0x4001b9){return db[_0x2c00('0x2f')][_0x2c00('0x49')]({'where':{'id':_0x434ad5[_0x2c00('0x45')]['id']}})[_0x2c00('0x26')](handleEntityNotFound(_0x4001b9,null))['then'](removeEntity(_0x4001b9,null))['catch'](handleError(_0x4001b9,null));};exports[_0x2c00('0x53')]=function(_0x395f58,_0x11af56,_0x11a07f){if(_0x395f58['body']['id']){delete _0x395f58['body']['id'];}return db['Interval'][_0x2c00('0x49')]({'where':{'id':_0x395f58[_0x2c00('0x45')]['id']}})[_0x2c00('0x26')](handleEntityNotFound(_0x11af56,null))[_0x2c00('0x26')](function(_0x307cdc){if(_0x307cdc){_0x395f58[_0x2c00('0x52')][_0x2c00('0x54')]=_0x307cdc['id'];return db[_0x2c00('0x2f')]['create'](_0x395f58[_0x2c00('0x52')]);}})[_0x2c00('0x26')](respondWithResult(_0x11af56,null))[_0x2c00('0x43')](handleError(_0x11af56,null));};exports['getIntervals']=function(_0x42ce9a,_0x23916f,_0x5ed8a2){var _0x3c60d9={};var _0x2cc0d2={};var _0x3faf0c;var _0x25daca;return db[_0x2c00('0x2f')][_0x2c00('0x55')]({'where':{'id':_0x42ce9a[_0x2c00('0x45')]['id']}})[_0x2c00('0x26')](handleEntityNotFound(_0x23916f,null))[_0x2c00('0x26')](function(_0x51d103){if(_0x51d103){_0x3faf0c=_0x51d103;_0x2cc0d2[_0x2c00('0x33')]=_[_0x2c00('0x35')](db['Interval']['rawAttributes']);_0x2cc0d2[_0x2c00('0x34')]=_[_0x2c00('0x35')](_0x42ce9a['query']);_0x2cc0d2[_0x2c00('0x36')]=_[_0x2c00('0x37')](_0x2cc0d2['model'],_0x2cc0d2[_0x2c00('0x34')]);_0x3c60d9[_0x2c00('0x38')]=_[_0x2c00('0x37')](_0x2cc0d2['model'],qs['fields'](_0x42ce9a[_0x2c00('0x34')][_0x2c00('0x47')]));_0x3c60d9[_0x2c00('0x38')]=_0x3c60d9[_0x2c00('0x38')][_0x2c00('0x39')]?_0x3c60d9[_0x2c00('0x38')]:_0x2cc0d2[_0x2c00('0x33')];_0x3c60d9[_0x2c00('0x3c')]=qs[_0x2c00('0x3d')](_0x42ce9a[_0x2c00('0x34')][_0x2c00('0x3d')]);_0x3c60d9['where']=qs[_0x2c00('0x36')](_[_0x2c00('0x3e')](_0x42ce9a[_0x2c00('0x34')],_0x2cc0d2['filters']));if(_0x42ce9a[_0x2c00('0x34')][_0x2c00('0x56')]){_0x3c60d9[_0x2c00('0x3f')]=_[_0x2c00('0x40')](_0x3c60d9[_0x2c00('0x3f')],{'$or':_[_0x2c00('0x2e')](_0x3c60d9['attributes'],function(_0x13a476){var _0x56cad7={};_0x56cad7[_0x13a476]={'$like':'%'+_0x42ce9a[_0x2c00('0x34')]['filter']+'%'};return _0x56cad7;})});}_0x3c60d9=_['merge']({},_0x3c60d9,_0x42ce9a[_0x2c00('0x41')]);return _0x3faf0c[_0x2c00('0x57')](_0x3c60d9);}})['then'](function(_0x189fed){if(_0x189fed){_0x25daca=_0x189fed[_0x2c00('0x39')];if(!_0x42ce9a[_0x2c00('0x34')]['hasOwnProperty'](_0x2c00('0x3b'))){_0x3c60d9[_0x2c00('0x21')]=qs['limit'](_0x42ce9a['query'][_0x2c00('0x21')]);_0x3c60d9[_0x2c00('0x1f')]=qs[_0x2c00('0x1f')](_0x42ce9a[_0x2c00('0x34')]['offset']);}return _0x3faf0c[_0x2c00('0x57')](_0x3c60d9);}})[_0x2c00('0x26')](function(_0x760d8c){if(_0x760d8c){return _0x760d8c?{'count':_0x25daca,'rows':_0x760d8c}:null;}})[_0x2c00('0x26')](respondWithResult(_0x23916f,null))[_0x2c00('0x43')](handleError(_0x23916f,null));};exports[_0x2c00('0x58')]=function(_0x5afea9,_0x2ad428,_0x5e0739){return db[_0x2c00('0x2f')]['findOne']({'where':{'id':_0x5afea9[_0x2c00('0x45')]['id']}})[_0x2c00('0x26')](handleEntityNotFound(_0x2ad428,null))[_0x2c00('0x26')](function(_0x870884){if(_0x870884){return db['sequelize'][_0x2c00('0x59')](function(_0x144246){return db[_0x2c00('0x2f')][_0x2c00('0x27')]({'where':{'IntervalId':_0x5afea9['params']['id']},'transaction':_0x144246})[_0x2c00('0x26')](function(_0x2a61af){var _0x15d9ae=_[_0x2c00('0x2e')](_0x5afea9[_0x2c00('0x52')],function(_0x28f450){delete _0x28f450['id'];_0x28f450[_0x2c00('0x54')]=_0x5afea9[_0x2c00('0x45')]['id'];return _0x28f450;});return db[_0x2c00('0x2f')][_0x2c00('0x5a')](_0x15d9ae,{'transaction':_0x144246});});})['then'](function(){return db['Interval'][_0x2c00('0x5b')]({'where':{'IntervalId':_0x5afea9[_0x2c00('0x45')]['id']}});});}})[_0x2c00('0x26')](respondWithResult(_0x2ad428,null))['catch'](handleError(_0x2ad428,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index fdf26b4..6138bcb 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 _0x19b0=['rewrite','interval','string','getIntervals','then','map','ifTime','reduce','./interval.attributes','../../utils/iftime','iftime','define','tools_intervals'];(function(_0x1e6f59,_0x16128c){var _0x2be16b=function(_0x62fd4f){while(--_0x62fd4f){_0x1e6f59['push'](_0x1e6f59['shift']());}};_0x2be16b(++_0x16128c);}(_0x19b0,0x7d));var _0x019b=function(_0x4f1d78,_0x50e35b){_0x4f1d78=_0x4f1d78-0x0;var _0x64fe6=_0x19b0[_0x4f1d78];return _0x64fe6;};'use strict';var attributes=require(_0x019b('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x019b('0x1'))[_0x019b('0x2')];module['exports']=function(_0x3f761f){return _0x3f761f[_0x019b('0x3')]('Interval',attributes,{'tableName':_0x019b('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x226a69){extensions['rewrite'](_0x3f761f,_0x226a69);},'afterBulkCreate':function(_0x4e77ef,_0x54aa66,_0x3aba30){_0x3aba30();extensions[_0x019b('0x5')](_0x3f761f,_0x4e77ef[0x0]);},'afterUpdate':function(_0xb0cb8c){extensions['rewrite'](_0x3f761f,_0xb0cb8c);},'afterDestroy':function(_0x183ea1){extensions[_0x019b('0x5')](_0x3f761f,_0x183ea1);}},'instanceMethods':{'ifTime':function(_0x528d3e=undefined,_0x2cc378=new Date()){if(typeof this[_0x019b('0x6')]===_0x019b('0x7')){return iftime(this['interval'],_0x528d3e,_0x2cc378);}else{return this[_0x019b('0x8')]()[_0x019b('0x9')](function(_0x678340){return Promise['all'](_0x678340[_0x019b('0xa')](function(_0x227e2c){return _0x227e2c[_0x019b('0xb')](_0x528d3e,_0x2cc378);}));})[_0x019b('0x9')](function(_0x4d8d18){return _0x4d8d18[_0x019b('0xc')](function(_0x3d4052,_0x685082){return _0x3d4052||_0x685082;},![]);});}}}});}; \ No newline at end of file +var _0x0e8e=['map','reduce','./interval.attributes','../../components/extensions/rewrite','iftime','exports','Interval','tools_intervals','rewrite','interval','then','all'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0x0e8e,0xce));var _0xe0e8=function(_0x3cbda4,_0xb3c9d9){_0x3cbda4=_0x3cbda4-0x0;var _0x26f859=_0x0e8e[_0x3cbda4];return _0x26f859;};'use strict';var attributes=require(_0xe0e8('0x0'));var extensions=require(_0xe0e8('0x1'));var iftime=require('../../utils/iftime')[_0xe0e8('0x2')];module[_0xe0e8('0x3')]=function(_0x42fdbf){return _0x42fdbf['define'](_0xe0e8('0x4'),attributes,{'tableName':_0xe0e8('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5625f3){extensions[_0xe0e8('0x6')](_0x42fdbf,_0x5625f3);},'afterBulkCreate':function(_0x4b56f1,_0x25ae5c,_0x381bfb){_0x381bfb();extensions[_0xe0e8('0x6')](_0x42fdbf,_0x4b56f1[0x0]);},'afterUpdate':function(_0x1c927e){extensions['rewrite'](_0x42fdbf,_0x1c927e);},'afterDestroy':function(_0x53092f){extensions[_0xe0e8('0x6')](_0x42fdbf,_0x53092f);}},'instanceMethods':{'ifTime':function(_0x4b33b2=undefined,_0x493236=new Date()){if(typeof this[_0xe0e8('0x7')]==='string'){return iftime(this[_0xe0e8('0x7')],_0x4b33b2,_0x493236);}else{return this['getIntervals']()[_0xe0e8('0x8')](function(_0x4f16d9){return Promise[_0xe0e8('0x9')](_0x4f16d9[_0xe0e8('0xa')](function(_0x5f4f69){return _0x5f4f69['ifTime'](_0x4b33b2,_0x493236);}));})[_0xe0e8('0x8')](function(_0x1c8878){return _0x1c8878[_0xe0e8('0xb')](function(_0x24447e,_0x1f1695){return _0x24447e||_0x1f1695;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 97455c0..e115545 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 _0xdcea=['length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','silly','reduce','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','catch','error','message','find','ShowInterval','stringify','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime','intervalIds','isArray','intervals','string','timezone'];(function(_0x578d57,_0x3f3626){var _0x2e944a=function(_0x42a709){while(--_0x42a709){_0x578d57['push'](_0x578d57['shift']());}};_0x2e944a(++_0x3f3626);}(_0xdcea,0x1f2));var _0xadce=function(_0x3cb530,_0x170e8c){_0x3cb530=_0x3cb530-0x0;var _0x4168ea=_0xdcea[_0x3cb530];return _0x4168ea;};'use strict';var _=require('lodash');var util=require(_0xadce('0x0'));var db=require(_0xadce('0x1'))['db'];var iftime=require(_0xadce('0x2'))[_0xadce('0x3')];var logger=require(_0xadce('0x4'))('rpc');exports[_0xadce('0x5')]=function(_0x4bda14){var _0x261ef3=this;return new Promise(function(_0x361f71,_0x2b61e4){return db[_0xadce('0x6')][_0xadce('0x7')]({'raw':_0x4bda14[_0xadce('0x8')]?_0x4bda14[_0xadce('0x8')][_0xadce('0x9')]===undefined?!![]:![]:!![],'where':_0x4bda14[_0xadce('0x8')]?_0x4bda14[_0xadce('0x8')][_0xadce('0xa')]||null:null,'attributes':_0x4bda14[_0xadce('0x8')]?_0x4bda14[_0xadce('0x8')][_0xadce('0xb')]||null:null,'limit':_0x4bda14['options']?_0x4bda14[_0xadce('0x8')][_0xadce('0xc')]||null:null,'include':_0x4bda14[_0xadce('0x8')]?_0x4bda14[_0xadce('0x8')][_0xadce('0xd')]?_[_0xadce('0xe')](_0x4bda14['options'][_0xadce('0xd')],function(_0xaaab3b){return{'model':db[_0xaaab3b['model']],'as':_0xaaab3b['as'],'attributes':_0xaaab3b[_0xadce('0xb')],'include':_0xaaab3b['include']?_[_0xadce('0xe')](_0xaaab3b[_0xadce('0xd')],function(_0x3710a5){return{'model':db[_0x3710a5['model']],'as':_0x3710a5['as'],'attributes':_0x3710a5[_0xadce('0xb')],'include':_0x3710a5['include']?_[_0xadce('0xe')](_0x3710a5[_0xadce('0xd')],function(_0x2bbffe){return{'model':db[_0x2bbffe[_0xadce('0xf')]],'as':_0x2bbffe['as'],'attributes':_0x2bbffe['attributes']};}):[]};}):[]};}):[]:[]})[_0xadce('0x10')](function(_0x4d88dd){logger[_0xadce('0x11')](_0xadce('0x5'),_0x4bda14);logger['debug'](_0xadce('0x5'),_0x4bda14,JSON['stringify'](_0x4d88dd));_0x361f71(_0x4d88dd);})[_0xadce('0x12')](function(_0x117001){logger[_0xadce('0x13')](_0xadce('0x5'),_0x117001[_0xadce('0x14')],_0x4bda14);_0x2b61e4(_0x261ef3[_0xadce('0x13')](0x1f4,_0x117001[_0xadce('0x14')]));});});};exports['ShowInterval']=function(_0xe800b0){var _0x319f86=this;return new Promise(function(_0x44d0fa,_0x4615b0){return db[_0xadce('0x6')][_0xadce('0x15')]({'raw':_0xe800b0[_0xadce('0x8')]?_0xe800b0['options'][_0xadce('0x9')]===undefined?!![]:![]:!![],'where':_0xe800b0[_0xadce('0x8')]?_0xe800b0[_0xadce('0x8')][_0xadce('0xa')]||null:null,'attributes':_0xe800b0[_0xadce('0x8')]?_0xe800b0[_0xadce('0x8')][_0xadce('0xb')]||null:null,'include':_0xe800b0['options']?_0xe800b0[_0xadce('0x8')]['include']?_[_0xadce('0xe')](_0xe800b0[_0xadce('0x8')][_0xadce('0xd')],function(_0x14b0e3){return{'model':db[_0x14b0e3[_0xadce('0xf')]],'as':_0x14b0e3['as'],'attributes':_0x14b0e3[_0xadce('0xb')],'include':_0x14b0e3['include']?_[_0xadce('0xe')](_0x14b0e3[_0xadce('0xd')],function(_0x2bf09d){return{'model':db[_0x2bf09d[_0xadce('0xf')]],'as':_0x2bf09d['as'],'attributes':_0x2bf09d[_0xadce('0xb')],'include':_0x2bf09d['include']?_[_0xadce('0xe')](_0x2bf09d[_0xadce('0xd')],function(_0xca50d3){return{'model':db[_0xca50d3['model']],'as':_0xca50d3['as'],'attributes':_0xca50d3[_0xadce('0xb')]};}):[]};}):[]};}):[]:[]})[_0xadce('0x10')](function(_0x1470c6){logger[_0xadce('0x11')](_0xadce('0x16'),_0xe800b0);logger['debug'](_0xadce('0x16'),_0xe800b0,JSON[_0xadce('0x17')](_0x1470c6));_0x44d0fa(_0x1470c6);})[_0xadce('0x12')](function(_0x17d903){logger[_0xadce('0x13')](_0xadce('0x16'),_0x17d903[_0xadce('0x14')],_0xe800b0);_0x4615b0(_0x319f86[_0xadce('0x13')](0x1f4,_0x17d903['message']));});});};function checkArrayOfIntervals(_0x1d39f8,_0x25a653){var _0x4ba150=[];return db[_0xadce('0x6')]['findAll']({'where':{'id':_0x1d39f8}})[_0xadce('0x10')](function(_0x23de86){_0x4ba150=_0x23de86;return Promise['all'](_0x4ba150['map'](function(_0x832f2b){return _0x832f2b['ifTime'](_0x25a653);}));})['then'](function(_0x277ea1){var _0x1b1b21=_0x277ea1['reduce'](function(_0x5a161e,_0x304ed7){return _0x5a161e||_0x304ed7;},![]);logger[_0xadce('0x11')](util[_0xadce('0x18')](_0xadce('0x19'),_0x4ba150[_0xadce('0xe')](function(_0x561000){return _0x561000[_0xadce('0x1a')];})[_0xadce('0x1b')](',\x20'),_0x4ba150['map'](function(_0x2bb5d8){return _0x2bb5d8['id'];})[_0xadce('0x1b')](',\x20')));return _0x1b1b21;});}function checkSingleInterval(_0x316569,_0x20ddaf){return db[_0xadce('0x6')]['findById'](_0x316569)[_0xadce('0x10')](function(_0x4a7075){if(_0x4a7075){logger['info'](util[_0xadce('0x18')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x4a7075[_0xadce('0x1a')],_0x4a7075['id']));return _0x4a7075['ifTime'](_0x20ddaf);}});}exports[_0xadce('0x1c')]=function(_0x50d866){var _0x1b0efe=_0x50d866[_0xadce('0x1d')];var _0x5dd567=Array[_0xadce('0x1e')](_0x50d866[_0xadce('0x1f')])?_0x50d866['intervals']:typeof _0x50d866[_0xadce('0x1f')]===_0xadce('0x20')?[_0x50d866[_0xadce('0x1f')]]:[];var _0x5d88cb=_0x50d866[_0xadce('0x21')]||undefined;var _0x16d451=![];if(_0x5dd567[_0xadce('0x22')]){logger['info'](util[_0xadce('0x18')](_0xadce('0x23'),_0x5dd567['join'](';\x20')));}if(_0x5d88cb){logger[_0xadce('0x11')](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0x5d88cb));}logger['debug']('Iftime',_0x16d451);logger[_0xadce('0x24')](_0xadce('0x1c'),_0x50d866);return Promise['resolve']()['then'](function(){if(Array[_0xadce('0x1e')](_0x1b0efe)){return checkArrayOfIntervals(_0x1b0efe,_0x5d88cb);}else if(_0x1b0efe){return checkSingleInterval(_0x1b0efe,_0x5d88cb);}})[_0xadce('0x10')](function(_0x2e9f1c){var _0x1e4375=_0x5dd567[_0xadce('0x25')](function(_0x4a7979,_0x571708){return _0x4a7979||iftime(_0x571708,_0x5d88cb);},![]);_0x16d451=_0x2e9f1c||_0x1e4375;return _0x16d451;})['catch'](function(_0x2cdf9a){logger[_0xadce('0x13')](_0xadce('0x1c'),_0x50d866,_0x2cdf9a);throw this[_0xadce('0x13')](0x1f4,_0x2cdf9a[_0xadce('0x14')]);});}; \ No newline at end of file +var _0xf384=['error','message','ShowInterval','debug','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','intervalIds','isArray','intervals','timezone','length','IntervalIftime:\x20timezone\x20=\x20%s','IntervalIftime','resolve','util','../../mysqldb','../../utils/iftime','iftime','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','stringify','catch'];(function(_0x5b0a4a,_0x11a985){var _0x2ce5c6=function(_0x4b3a55){while(--_0x4b3a55){_0x5b0a4a['push'](_0x5b0a4a['shift']());}};_0x2ce5c6(++_0x11a985);}(_0xf384,0x1c1));var _0x4f38=function(_0x2dcb1b,_0x25aec5){_0x2dcb1b=_0x2dcb1b-0x0;var _0x1edcf4=_0xf384[_0x2dcb1b];return _0x1edcf4;};'use strict';var _=require('lodash');var util=require(_0x4f38('0x0'));var db=require(_0x4f38('0x1'))['db'];var iftime=require(_0x4f38('0x2'))[_0x4f38('0x3')];var logger=require('../../config/logger')('rpc');exports[_0x4f38('0x4')]=function(_0x18c8df){var _0x3b386d=this;return new Promise(function(_0x4cfa5c,_0x2b4637){return db[_0x4f38('0x5')][_0x4f38('0x6')]({'raw':_0x18c8df[_0x4f38('0x7')]?_0x18c8df['options'][_0x4f38('0x8')]===undefined?!![]:![]:!![],'where':_0x18c8df[_0x4f38('0x7')]?_0x18c8df['options'][_0x4f38('0x9')]||null:null,'attributes':_0x18c8df[_0x4f38('0x7')]?_0x18c8df[_0x4f38('0x7')][_0x4f38('0xa')]||null:null,'limit':_0x18c8df[_0x4f38('0x7')]?_0x18c8df[_0x4f38('0x7')][_0x4f38('0xb')]||null:null,'include':_0x18c8df[_0x4f38('0x7')]?_0x18c8df[_0x4f38('0x7')][_0x4f38('0xc')]?_[_0x4f38('0xd')](_0x18c8df[_0x4f38('0x7')][_0x4f38('0xc')],function(_0xfbd1c){return{'model':db[_0xfbd1c[_0x4f38('0xe')]],'as':_0xfbd1c['as'],'attributes':_0xfbd1c[_0x4f38('0xa')],'include':_0xfbd1c['include']?_[_0x4f38('0xd')](_0xfbd1c[_0x4f38('0xc')],function(_0x473c70){return{'model':db[_0x473c70[_0x4f38('0xe')]],'as':_0x473c70['as'],'attributes':_0x473c70[_0x4f38('0xa')],'include':_0x473c70[_0x4f38('0xc')]?_[_0x4f38('0xd')](_0x473c70['include'],function(_0x3d3f26){return{'model':db[_0x3d3f26[_0x4f38('0xe')]],'as':_0x3d3f26['as'],'attributes':_0x3d3f26[_0x4f38('0xa')]};}):[]};}):[]};}):[]:[]})[_0x4f38('0xf')](function(_0x45d3ea){logger[_0x4f38('0x10')](_0x4f38('0x4'),_0x18c8df);logger['debug'](_0x4f38('0x4'),_0x18c8df,JSON[_0x4f38('0x11')](_0x45d3ea));_0x4cfa5c(_0x45d3ea);})[_0x4f38('0x12')](function(_0x34c960){logger[_0x4f38('0x13')](_0x4f38('0x4'),_0x34c960[_0x4f38('0x14')],_0x18c8df);_0x2b4637(_0x3b386d[_0x4f38('0x13')](0x1f4,_0x34c960['message']));});});};exports['ShowInterval']=function(_0x2e2e84){var _0x54d42d=this;return new Promise(function(_0xb92466,_0x214e32){return db[_0x4f38('0x5')]['find']({'raw':_0x2e2e84[_0x4f38('0x7')]?_0x2e2e84[_0x4f38('0x7')][_0x4f38('0x8')]===undefined?!![]:![]:!![],'where':_0x2e2e84[_0x4f38('0x7')]?_0x2e2e84['options'][_0x4f38('0x9')]||null:null,'attributes':_0x2e2e84[_0x4f38('0x7')]?_0x2e2e84[_0x4f38('0x7')][_0x4f38('0xa')]||null:null,'include':_0x2e2e84[_0x4f38('0x7')]?_0x2e2e84[_0x4f38('0x7')][_0x4f38('0xc')]?_[_0x4f38('0xd')](_0x2e2e84['options'][_0x4f38('0xc')],function(_0x329905){return{'model':db[_0x329905[_0x4f38('0xe')]],'as':_0x329905['as'],'attributes':_0x329905['attributes'],'include':_0x329905[_0x4f38('0xc')]?_[_0x4f38('0xd')](_0x329905[_0x4f38('0xc')],function(_0x226429){return{'model':db[_0x226429[_0x4f38('0xe')]],'as':_0x226429['as'],'attributes':_0x226429[_0x4f38('0xa')],'include':_0x226429[_0x4f38('0xc')]?_[_0x4f38('0xd')](_0x226429['include'],function(_0x5240d2){return{'model':db[_0x5240d2[_0x4f38('0xe')]],'as':_0x5240d2['as'],'attributes':_0x5240d2[_0x4f38('0xa')]};}):[]};}):[]};}):[]:[]})[_0x4f38('0xf')](function(_0x3bd89c){logger[_0x4f38('0x10')](_0x4f38('0x15'),_0x2e2e84);logger[_0x4f38('0x16')](_0x4f38('0x15'),_0x2e2e84,JSON[_0x4f38('0x11')](_0x3bd89c));_0xb92466(_0x3bd89c);})['catch'](function(_0x130002){logger[_0x4f38('0x13')](_0x4f38('0x15'),_0x130002[_0x4f38('0x14')],_0x2e2e84);_0x214e32(_0x54d42d[_0x4f38('0x13')](0x1f4,_0x130002['message']));});});};function checkArrayOfIntervals(_0xb5544c,_0x1c1f19){var _0x42ec99=[];return db[_0x4f38('0x5')]['findAll']({'where':{'id':_0xb5544c}})[_0x4f38('0xf')](function(_0x32841e){_0x42ec99=_0x32841e;return Promise[_0x4f38('0x17')](_0x42ec99['map'](function(_0x232ce8){return _0x232ce8[_0x4f38('0x18')](_0x1c1f19);}));})[_0x4f38('0xf')](function(_0x1acac1){var _0x436453=_0x1acac1[_0x4f38('0x19')](function(_0x267d93,_0x1f1fed){return _0x267d93||_0x1f1fed;},![]);logger[_0x4f38('0x10')](util[_0x4f38('0x1a')](_0x4f38('0x1b'),_0x42ec99[_0x4f38('0xd')](function(_0x3180c4){return _0x3180c4[_0x4f38('0x1c')];})['join'](',\x20'),_0x42ec99[_0x4f38('0xd')](function(_0x2dff60){return _0x2dff60['id'];})[_0x4f38('0x1d')](',\x20')));return _0x436453;});}function checkSingleInterval(_0x10c78e,_0x12b7d1){return db[_0x4f38('0x5')][_0x4f38('0x1e')](_0x10c78e)['then'](function(_0x54c5e6){if(_0x54c5e6){logger[_0x4f38('0x10')](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x54c5e6['name'],_0x54c5e6['id']));return _0x54c5e6[_0x4f38('0x18')](_0x12b7d1);}});}exports['IntervalIftime']=function(_0xa2a2b1){var _0x24cce4=_0xa2a2b1[_0x4f38('0x1f')];var _0x26e2ed=Array[_0x4f38('0x20')](_0xa2a2b1[_0x4f38('0x21')])?_0xa2a2b1[_0x4f38('0x21')]:typeof _0xa2a2b1['intervals']==='string'?[_0xa2a2b1[_0x4f38('0x21')]]:[];var _0x384751=_0xa2a2b1[_0x4f38('0x22')]||undefined;var _0x2b7b9b=![];if(_0x26e2ed[_0x4f38('0x23')]){logger['info'](util[_0x4f38('0x1a')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x26e2ed[_0x4f38('0x1d')](';\x20')));}if(_0x384751){logger['info'](util[_0x4f38('0x1a')](_0x4f38('0x24'),_0x384751));}logger[_0x4f38('0x16')]('Iftime',_0x2b7b9b);logger['silly'](_0x4f38('0x25'),_0xa2a2b1);return Promise[_0x4f38('0x26')]()[_0x4f38('0xf')](function(){if(Array[_0x4f38('0x20')](_0x24cce4)){return checkArrayOfIntervals(_0x24cce4,_0x384751);}else if(_0x24cce4){return checkSingleInterval(_0x24cce4,_0x384751);}})[_0x4f38('0xf')](function(_0x4fa40c){var _0x407650=_0x26e2ed[_0x4f38('0x19')](function(_0xf4f963,_0x569abb){return _0xf4f963||iftime(_0x569abb,_0x384751);},![]);_0x2b7b9b=_0x4fa40c||_0x407650;return _0x2b7b9b;})[_0x4f38('0x12')](function(_0x578496){logger['error']('IntervalIftime',_0xa2a2b1,_0x578496);throw this[_0x4f38('0x13')](0x1f4,_0x578496[_0x4f38('0x14')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 841a41c..e63dbe1 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x53953e,_0x56a93b){var _0x2c2122=function(_0x5c6043){while(--_0x5c6043){_0x53953e['push'](_0x53953e['shift']());}};_0x2c2122(++_0x56a93b);}(_0x2ef3,0xba));var _0x32ef=function(_0x48dffe,_0x189999){_0x48dffe=_0x48dffe-0x0;var _0x1d0af5=_0x2ef3[_0x48dffe];return _0x1d0af5;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x584cb0,_0x23e468){var _0x1face9=function(_0x2d6562){while(--_0x2d6562){_0x584cb0['push'](_0x584cb0['shift']());}};_0x1face9(++_0x23e468);}(_0xadb5,0xad));var _0x5adb=function(_0x224fe8,_0x26fb39){_0x224fe8=_0x224fe8-0x0;var _0x205682=_0xadb5[_0x224fe8];return _0x205682;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index d7b9fff..e14a638 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 _0xbabf=['parse','error','status','api.jira','write','send','body','headers','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','request','utf8','data','end','statusCode','json'];(function(_0x10d570,_0x2f0220){var _0x3a200e=function(_0x19f564){while(--_0x19f564){_0x10d570['push'](_0x10d570['shift']());}};_0x3a200e(++_0x2f0220);}(_0xbabf,0xf1));var _0xfbab=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xbabf[_0x39d544];return _0x5a5ff2;};'use strict';var BPromise=require(_0xfbab('0x0'));var https=require(_0xfbab('0x1'));var logger=require(_0xfbab('0x2'))(_0xfbab('0x3'));var USERNAME=_0xfbab('0x4');var PASSWORD=_0xfbab('0x5');function openIssue(_0x50724c,_0x547b2d){var _0x3d7c3c={'fields':{'project':{'key':_0x50724c['key']||_0xfbab('0x6')},'summary':(_0x50724c[_0xfbab('0x7')]||_0xfbab('0x8'))+_0xfbab('0x9')+_0x50724c['ip'],'description':_0x50724c[_0xfbab('0xa')]||JSON[_0xfbab('0xb')](_0x50724c),'issuetype':{'name':_0x50724c[_0xfbab('0xc')]||_0xfbab('0xd')}}};_0x3d7c3c[_0xfbab('0xe')][_0xfbab('0xf')]=_0x50724c[_0xfbab('0x10')];_0x3d7c3c['fields']['customfield_11501']=_0x50724c['oldToken'];_0x3d7c3c[_0xfbab('0xe')][_0xfbab('0x11')]=_0x50724c[_0xfbab('0x12')];_0x3d7c3c[_0xfbab('0xe')][_0xfbab('0x13')]=_0x50724c[_0xfbab('0x14')];_0x3d7c3c[_0xfbab('0xe')][_0xfbab('0x15')]=_0x50724c[_0xfbab('0x16')];_0x3d7c3c[_0xfbab('0xe')][_0xfbab('0x17')]=_0x50724c['ip'];var _0x214c4e={'host':_0xfbab('0x18'),'port':0x1bb,'path':_0xfbab('0x19'),'method':_0xfbab('0x1a'),'timeout':0x4e20,'headers':{'Content-Type':_0xfbab('0x1b'),'Authorization':_0xfbab('0x1c')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x6db39c=JSON[_0xfbab('0xb')](_0x3d7c3c);var _0x1d5d80=https[_0xfbab('0x1d')](_0x214c4e,function(_0x4b6e37){_0x4b6e37['setEncoding'](_0xfbab('0x1e'));var _0x39bf20='';_0x4b6e37['on'](_0xfbab('0x1f'),function(_0x5287b7){_0x39bf20+=_0x5287b7;});_0x4b6e37['on'](_0xfbab('0x20'),function(){if(_0x547b2d){return _0x547b2d['status'](_0x4b6e37[_0xfbab('0x21')])[_0xfbab('0x22')](JSON[_0xfbab('0x23')](_0x39bf20));}});});_0x1d5d80['on'](_0xfbab('0x24'),function(_0x5ce6b8){if(_0x547b2d){return _0x547b2d[_0xfbab('0x25')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xfbab('0x26')}]});}});_0x1d5d80[_0xfbab('0x27')](_0x6db39c);_0x1d5d80[_0xfbab('0x20')]();}exports['openIssue']=openIssue;exports[_0xfbab('0x28')]=function(_0x2278db,_0x1f3d96){_0x2278db[_0xfbab('0x29')]['ip']=_0x2278db[_0xfbab('0x2a')]['x-forwarded-for']||_0x2278db[_0xfbab('0x2b')][_0xfbab('0x2c')]||_0x2278db[_0xfbab('0x2d')]['remoteAddress']||_0x2278db[_0xfbab('0x2b')][_0xfbab('0x2d')][_0xfbab('0x2c')];return openIssue(_0x2278db[_0xfbab('0x29')],_0x1f3d96);}; \ No newline at end of file +var _0xa167=['Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503','name','reason','track.xcallymotion.com','POST','Basic\x20','toString','base64','setEncoding','data','end','statusCode','json','parse','error','status','api.jira','write','openIssue','body','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype'];(function(_0x482c8b,_0x61e45e){var _0x734dfa=function(_0x4626d9){while(--_0x4626d9){_0x482c8b['push'](_0x482c8b['shift']());}};_0x734dfa(++_0x61e45e);}(_0xa167,0xf6));var _0x7a16=function(_0x2a5597,_0x4509d0){_0x2a5597=_0x2a5597-0x0;var _0x24b1f2=_0xa167[_0x2a5597];return _0x24b1f2;};'use strict';var BPromise=require('bluebird');var https=require(_0x7a16('0x0'));var logger=require(_0x7a16('0x1'))(_0x7a16('0x2'));var USERNAME=_0x7a16('0x3');var PASSWORD=_0x7a16('0x4');function openIssue(_0x555c69,_0xb3076f){var _0x4b647a={'fields':{'project':{'key':_0x555c69[_0x7a16('0x5')]||_0x7a16('0x6')},'summary':(_0x555c69['summary']||_0x7a16('0x7'))+_0x7a16('0x8')+_0x555c69['ip'],'description':_0x555c69[_0x7a16('0x9')]||JSON[_0x7a16('0xa')](_0x555c69),'issuetype':{'name':_0x555c69[_0x7a16('0xb')]||_0x7a16('0xc')}}};_0x4b647a[_0x7a16('0xd')][_0x7a16('0xe')]=_0x555c69[_0x7a16('0xf')];_0x4b647a[_0x7a16('0xd')]['customfield_11501']=_0x555c69[_0x7a16('0x10')];_0x4b647a[_0x7a16('0xd')][_0x7a16('0x11')]=_0x555c69[_0x7a16('0x12')];_0x4b647a[_0x7a16('0xd')][_0x7a16('0x13')]=_0x555c69[_0x7a16('0x14')];_0x4b647a[_0x7a16('0xd')]['customfield_11504']=_0x555c69[_0x7a16('0x15')];_0x4b647a[_0x7a16('0xd')]['customfield_10102']=_0x555c69['ip'];var _0x2b1982={'host':_0x7a16('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x7a16('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x7a16('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x7a16('0x19')](_0x7a16('0x1a'))}};var _0x22e24d=JSON['stringify'](_0x4b647a);var _0x2752d1=https['request'](_0x2b1982,function(_0x5de12b){_0x5de12b[_0x7a16('0x1b')]('utf8');var _0x5d0e1b='';_0x5de12b['on'](_0x7a16('0x1c'),function(_0x2ac791){_0x5d0e1b+=_0x2ac791;});_0x5de12b['on'](_0x7a16('0x1d'),function(){if(_0xb3076f){return _0xb3076f['status'](_0x5de12b[_0x7a16('0x1e')])[_0x7a16('0x1f')](JSON[_0x7a16('0x20')](_0x5d0e1b));}});});_0x2752d1['on'](_0x7a16('0x21'),function(_0x48a97b){if(_0xb3076f){return _0xb3076f[_0x7a16('0x22')](0x1f4)[_0x7a16('0x1f')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x7a16('0x23')}]});}});_0x2752d1[_0x7a16('0x24')](_0x22e24d);_0x2752d1[_0x7a16('0x1d')]();}exports[_0x7a16('0x25')]=openIssue;exports['send']=function(_0x4c5741,_0x50ab2){_0x4c5741[_0x7a16('0x26')]['ip']=_0x4c5741['headers'][_0x7a16('0x27')]||_0x4c5741[_0x7a16('0x28')][_0x7a16('0x29')]||_0x4c5741[_0x7a16('0x2a')][_0x7a16('0x29')]||_0x4c5741[_0x7a16('0x28')]['socket'][_0x7a16('0x29')];return openIssue(_0x4c5741[_0x7a16('0x26')],_0x50ab2);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index b6d1f08..e65ff66 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 _0x9c44=['update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put'];(function(_0x38414f,_0x41a71d){var _0x4e85b9=function(_0x966c53){while(--_0x966c53){_0x38414f['push'](_0x38414f['shift']());}};_0x4e85b9(++_0x41a71d);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'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');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0xf')]);router['delete']('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0x10')]);module['exports']=router; \ No newline at end of file +var _0xaa88=['/describe','isAuthenticated','describe','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xaa88,0x137));var _0x8aa8=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0xaa88[_0x43941d];return _0x27b82a;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x10')]('/',auth['isAuthenticated'](),controller[_0x8aa8('0x11')]);router[_0x8aa8('0x12')](_0x8aa8('0x13'),auth[_0x8aa8('0xc')](),controller['update']);router[_0x8aa8('0x14')](_0x8aa8('0x13'),auth['isAuthenticated'](),controller[_0x8aa8('0x15')]);module[_0x8aa8('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 874ceec..506dcf7 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x389327,_0x5237ab){_0x389327=_0x389327-0x0;var _0x4c13ed=_0x7a54[_0x389327];return _0x4c13ed;};'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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7a54,0x106));var _0x47a5=function(_0x347614,_0x58ef65){_0x347614=_0x347614-0x0;var _0x2e7867=_0x7a54[_0x347614];return _0x2e7867;};'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 9f164fb..2b03488 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 _0x9a5a=['pick','filter','map','type','merge','options','then','includeAll','include','findAll','rows','params','keys','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','sendStatus','error','stack','name','index','JscriptyAnswerReport','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x9a5a,0x194));var _0xa9a5=function(_0x5ba4b2,_0x4dfdcf){_0x5ba4b2=_0x5ba4b2-0x0;var _0x5e266f=_0x9a5a[_0x5ba4b2];return _0x5e266f;};'use strict';var emlformat=require(_0xa9a5('0x0'));var rimraf=require(_0xa9a5('0x1'));var zipdir=require(_0xa9a5('0x2'));var jsonpatch=require(_0xa9a5('0x3'));var rp=require(_0xa9a5('0x4'));var moment=require('moment');var BPromise=require(_0xa9a5('0x5'));var Mustache=require(_0xa9a5('0x6'));var util=require(_0xa9a5('0x7'));var path=require(_0xa9a5('0x8'));var sox=require(_0xa9a5('0x9'));var csv=require(_0xa9a5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9a5('0xb'));var _=require(_0xa9a5('0xc'));var squel=require(_0xa9a5('0xd'));var crypto=require(_0xa9a5('0xe'));var jsforce=require(_0xa9a5('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa9a5('0x10'));var Redis=require(_0xa9a5('0x11'));var authService=require(_0xa9a5('0x12'));var qs=require(_0xa9a5('0x13'));var as=require(_0xa9a5('0x14'));var hardwareService=require(_0xa9a5('0x15'));var logger=require(_0xa9a5('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa9a5('0x17'));var db=require(_0xa9a5('0x18'))['db'];function respondWithStatusCode(_0x3a5084,_0x3ee424){_0x3ee424=_0x3ee424||0xcc;return function(_0x135279){if(_0x135279){return _0x3a5084['sendStatus'](_0x3ee424);}return _0x3a5084[_0xa9a5('0x19')](_0x3ee424)[_0xa9a5('0x1a')]();};}function respondWithResult(_0x3a7905,_0x453b49){_0x453b49=_0x453b49||0xc8;return function(_0x1819d7){if(_0x1819d7){return _0x3a7905[_0xa9a5('0x19')](_0x453b49)['json'](_0x1819d7);}};}function respondWithFilteredResult(_0x30a479,_0x25c458){return function(_0x476843){if(_0x476843){var _0x1b5d78=typeof _0x25c458['offset']===_0xa9a5('0x1b')&&typeof _0x25c458[_0xa9a5('0x1c')]===_0xa9a5('0x1b');var _0x5967f6=_0x476843[_0xa9a5('0x1d')];var _0x4ba946=_0x1b5d78?0x0:_0x25c458['offset'];var _0x2fb6bc=_0x1b5d78?_0x476843[_0xa9a5('0x1d')]:_0x25c458['offset']+_0x25c458[_0xa9a5('0x1c')];var _0x5d05d5;if(_0x2fb6bc>=_0x5967f6){_0x2fb6bc=_0x5967f6;_0x5d05d5=0xc8;}else{_0x5d05d5=0xce;}_0x30a479[_0xa9a5('0x19')](_0x5d05d5);return _0x30a479[_0xa9a5('0x1e')](_0xa9a5('0x1f'),_0x4ba946+'-'+_0x2fb6bc+'/'+_0x5967f6)[_0xa9a5('0x20')](_0x476843);}return null;};}function patchUpdates(_0x685963){return function(_0x1cc402){try{jsonpatch[_0xa9a5('0x21')](_0x1cc402,_0x685963,!![]);}catch(_0x6bd62d){return BPromise[_0xa9a5('0x22')](_0x6bd62d);}return _0x1cc402[_0xa9a5('0x23')]();};}function saveUpdates(_0x2d9620,_0xfd36cf){return function(_0x50a31a){if(_0x50a31a){return _0x50a31a['update'](_0x2d9620)['then'](function(_0x43017d){return _0x43017d;});}return null;};}function removeEntity(_0x5210c1,_0x1c7ca5){return function(_0x198821){if(_0x198821){return _0x198821[_0xa9a5('0x24')]()['then'](function(){_0x5210c1[_0xa9a5('0x19')](0xcc)[_0xa9a5('0x1a')]();});}};}function handleEntityNotFound(_0x341723,_0x4f1076){return function(_0x5dd641){if(!_0x5dd641){_0x341723[_0xa9a5('0x25')](0x194);}return _0x5dd641;};}function handleError(_0x19ccbd,_0x1b2d6a){_0x1b2d6a=_0x1b2d6a||0x1f4;return function(_0x58c94c){logger[_0xa9a5('0x26')](_0x58c94c[_0xa9a5('0x27')]);if(_0x58c94c['name']){delete _0x58c94c[_0xa9a5('0x28')];}_0x19ccbd[_0xa9a5('0x19')](_0x1b2d6a)['send'](_0x58c94c);};}exports[_0xa9a5('0x29')]=function(_0x52e2ad,_0x11366f){var _0x47ee9e={},_0x1a9832={},_0x3b271d={'count':0x0,'rows':[]};var _0x4a84ad=_['map'](db[_0xa9a5('0x2a')]['rawAttributes'],function(_0x3f5ca8){return{'name':_0x3f5ca8[_0xa9a5('0x2b')],'type':_0x3f5ca8['type'][_0xa9a5('0x2c')]};});_0x1a9832[_0xa9a5('0x2d')]=_['map'](_0x4a84ad,_0xa9a5('0x28'));_0x1a9832[_0xa9a5('0x2e')]=_['keys'](_0x52e2ad['query']);_0x1a9832['filters']=_['intersection'](_0x1a9832[_0xa9a5('0x2d')],_0x1a9832['query']);_0x47ee9e[_0xa9a5('0x2f')]=_[_0xa9a5('0x30')](_0x1a9832['model'],qs[_0xa9a5('0x31')](_0x52e2ad[_0xa9a5('0x2e')][_0xa9a5('0x31')]));_0x47ee9e['attributes']=_0x47ee9e['attributes'][_0xa9a5('0x32')]?_0x47ee9e[_0xa9a5('0x2f')]:_0x1a9832['model'];if(!_0x52e2ad[_0xa9a5('0x2e')][_0xa9a5('0x33')](_0xa9a5('0x34'))){_0x47ee9e[_0xa9a5('0x1c')]=qs[_0xa9a5('0x1c')](_0x52e2ad[_0xa9a5('0x2e')][_0xa9a5('0x1c')]);_0x47ee9e['offset']=qs['offset'](_0x52e2ad[_0xa9a5('0x2e')][_0xa9a5('0x35')]);}_0x47ee9e[_0xa9a5('0x36')]=qs[_0xa9a5('0x37')](_0x52e2ad[_0xa9a5('0x2e')][_0xa9a5('0x37')]);_0x47ee9e[_0xa9a5('0x38')]=qs[_0xa9a5('0x39')](_[_0xa9a5('0x3a')](_0x52e2ad['query'],_0x1a9832[_0xa9a5('0x39')]),_0x4a84ad);if(_0x52e2ad['query'][_0xa9a5('0x3b')]){_0x47ee9e['where']=_['merge'](_0x47ee9e[_0xa9a5('0x38')],{'$or':_[_0xa9a5('0x3c')](_0x4a84ad,function(_0x2f42b9){if(_0x2f42b9[_0xa9a5('0x3d')]!=='VIRTUAL'){var _0x1c06e7={};_0x1c06e7[_0x2f42b9[_0xa9a5('0x28')]]={'$like':'%'+_0x52e2ad[_0xa9a5('0x2e')][_0xa9a5('0x3b')]+'%'};return _0x1c06e7;}})});}_0x47ee9e=_[_0xa9a5('0x3e')]({},_0x47ee9e,_0x52e2ad[_0xa9a5('0x3f')]);var _0x22fd93={'where':_0x47ee9e[_0xa9a5('0x38')]};return db[_0xa9a5('0x2a')][_0xa9a5('0x1d')](_0x22fd93)[_0xa9a5('0x40')](function(_0x4d8cc6){_0x3b271d[_0xa9a5('0x1d')]=_0x4d8cc6;if(_0x52e2ad['query'][_0xa9a5('0x41')]){_0x47ee9e[_0xa9a5('0x42')]=[{'all':!![]}];}return db[_0xa9a5('0x2a')][_0xa9a5('0x43')](_0x47ee9e);})['then'](function(_0x258d6c){_0x3b271d[_0xa9a5('0x44')]=_0x258d6c;return _0x3b271d;})[_0xa9a5('0x40')](respondWithFilteredResult(_0x11366f,_0x47ee9e))['catch'](handleError(_0x11366f,null));};exports['show']=function(_0x3c472d,_0x5b7f01){var _0x4324cd={'raw':!![],'where':{'id':_0x3c472d[_0xa9a5('0x45')]['id']}},_0x1d0d3c={};_0x1d0d3c['model']=_[_0xa9a5('0x46')](db[_0xa9a5('0x2a')][_0xa9a5('0x47')]);_0x1d0d3c['query']=_[_0xa9a5('0x46')](_0x3c472d['query']);_0x1d0d3c[_0xa9a5('0x39')]=_[_0xa9a5('0x30')](_0x1d0d3c['model'],_0x1d0d3c[_0xa9a5('0x2e')]);_0x4324cd['attributes']=_[_0xa9a5('0x30')](_0x1d0d3c[_0xa9a5('0x2d')],qs['fields'](_0x3c472d['query'][_0xa9a5('0x31')]));_0x4324cd[_0xa9a5('0x2f')]=_0x4324cd['attributes'][_0xa9a5('0x32')]?_0x4324cd[_0xa9a5('0x2f')]:_0x1d0d3c[_0xa9a5('0x2d')];if(_0x3c472d['query']['includeAll']){_0x4324cd['include']=[{'all':!![]}];}_0x4324cd=_[_0xa9a5('0x3e')]({},_0x4324cd,_0x3c472d[_0xa9a5('0x3f')]);return db['JscriptyAnswerReport'][_0xa9a5('0x48')](_0x4324cd)['then'](handleEntityNotFound(_0x5b7f01,null))[_0xa9a5('0x40')](respondWithResult(_0x5b7f01,null))[_0xa9a5('0x49')](handleError(_0x5b7f01,null));};exports[_0xa9a5('0x4a')]=function(_0x3a9900,_0x512d6b){return db[_0xa9a5('0x2a')][_0xa9a5('0x4a')](_0x3a9900[_0xa9a5('0x4b')],{})['then'](respondWithResult(_0x512d6b,0xc9))['catch'](handleError(_0x512d6b,null));};exports['update']=function(_0x444f7e,_0x3894af){if(_0x444f7e[_0xa9a5('0x4b')]['id']){delete _0x444f7e['body']['id'];}return db['JscriptyAnswerReport'][_0xa9a5('0x48')]({'where':{'id':_0x444f7e[_0xa9a5('0x45')]['id']}})['then'](handleEntityNotFound(_0x3894af,null))[_0xa9a5('0x40')](saveUpdates(_0x444f7e[_0xa9a5('0x4b')],null))[_0xa9a5('0x40')](respondWithResult(_0x3894af,null))[_0xa9a5('0x49')](handleError(_0x3894af,null));};exports[_0xa9a5('0x24')]=function(_0x4638ed,_0x218a78){return db[_0xa9a5('0x2a')][_0xa9a5('0x48')]({'where':{'id':_0x4638ed[_0xa9a5('0x45')]['id']}})[_0xa9a5('0x40')](handleEntityNotFound(_0x218a78,null))['then'](removeEntity(_0x218a78,null))[_0xa9a5('0x49')](handleError(_0x218a78,null));};exports['describe']=function(_0x4e283b,_0x3afc3f){return db['JscriptyAnswerReport'][_0xa9a5('0x4c')]()[_0xa9a5('0x40')](respondWithResult(_0x3afc3f,null))['catch'](handleError(_0x3afc3f,null));}; \ No newline at end of file +var _0x37c5=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','JscriptyAnswerReport','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','apply','update','then','stack','name','index','map','type'];(function(_0x44dff7,_0xa8d824){var _0x14e851=function(_0x4ea125){while(--_0x4ea125){_0x44dff7['push'](_0x44dff7['shift']());}};_0x14e851(++_0xa8d824);}(_0x37c5,0xa7));var _0x537c=function(_0xbec1a6,_0x20b2d3){_0xbec1a6=_0xbec1a6-0x0;var _0x5a4ebb=_0x37c5[_0xbec1a6];return _0x5a4ebb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x537c('0x0'));var zipdir=require(_0x537c('0x1'));var jsonpatch=require(_0x537c('0x2'));var rp=require(_0x537c('0x3'));var moment=require(_0x537c('0x4'));var BPromise=require(_0x537c('0x5'));var Mustache=require(_0x537c('0x6'));var util=require(_0x537c('0x7'));var path=require(_0x537c('0x8'));var sox=require(_0x537c('0x9'));var csv=require('to-csv');var ejs=require(_0x537c('0xa'));var fs=require('fs');var fs_extra=require(_0x537c('0xb'));var _=require(_0x537c('0xc'));var squel=require('squel');var crypto=require(_0x537c('0xd'));var jsforce=require(_0x537c('0xe'));var deskjs=require(_0x537c('0xf'));var toCsv=require(_0x537c('0x10'));var querystring=require('querystring');var Papa=require(_0x537c('0x11'));var Redis=require(_0x537c('0x12'));var authService=require(_0x537c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x537c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x537c('0x15'));var utils=require('../../config/utils');var config=require(_0x537c('0x16'));var licenseUtil=require(_0x537c('0x17'));var db=require(_0x537c('0x18'))['db'];function respondWithStatusCode(_0x473606,_0x1ecb98){_0x1ecb98=_0x1ecb98||0xcc;return function(_0x4554be){if(_0x4554be){return _0x473606[_0x537c('0x19')](_0x1ecb98);}return _0x473606[_0x537c('0x1a')](_0x1ecb98)[_0x537c('0x1b')]();};}function respondWithResult(_0x577981,_0x8d0c3){_0x8d0c3=_0x8d0c3||0xc8;return function(_0x405e39){if(_0x405e39){return _0x577981[_0x537c('0x1a')](_0x8d0c3)[_0x537c('0x1c')](_0x405e39);}};}function respondWithFilteredResult(_0x116453,_0x392421){return function(_0x2158e2){if(_0x2158e2){var _0x3776c3=typeof _0x392421[_0x537c('0x1d')]==='undefined'&&typeof _0x392421[_0x537c('0x1e')]==='undefined';var _0x55df08=_0x2158e2[_0x537c('0x1f')];var _0x237be8=_0x3776c3?0x0:_0x392421[_0x537c('0x1d')];var _0x5f3776=_0x3776c3?_0x2158e2[_0x537c('0x1f')]:_0x392421[_0x537c('0x1d')]+_0x392421['limit'];var _0x5ca4d5;if(_0x5f3776>=_0x55df08){_0x5f3776=_0x55df08;_0x5ca4d5=0xc8;}else{_0x5ca4d5=0xce;}_0x116453[_0x537c('0x1a')](_0x5ca4d5);return _0x116453['set']('Content-Range',_0x237be8+'-'+_0x5f3776+'/'+_0x55df08)[_0x537c('0x1c')](_0x2158e2);}return null;};}function patchUpdates(_0x32be40){return function(_0x5cfd81){try{jsonpatch[_0x537c('0x20')](_0x5cfd81,_0x32be40,!![]);}catch(_0x259ab2){return BPromise['reject'](_0x259ab2);}return _0x5cfd81['save']();};}function saveUpdates(_0x1a91d1,_0x47bece){return function(_0x5d8b9e){if(_0x5d8b9e){return _0x5d8b9e[_0x537c('0x21')](_0x1a91d1)[_0x537c('0x22')](function(_0x13fd5e){return _0x13fd5e;});}return null;};}function removeEntity(_0x28a35a,_0x3698bc){return function(_0x26ab7d){if(_0x26ab7d){return _0x26ab7d['destroy']()[_0x537c('0x22')](function(){_0x28a35a[_0x537c('0x1a')](0xcc)[_0x537c('0x1b')]();});}};}function handleEntityNotFound(_0xcd7d47,_0x428e5d){return function(_0x4b6af1){if(!_0x4b6af1){_0xcd7d47['sendStatus'](0x194);}return _0x4b6af1;};}function handleError(_0x59442f,_0x403ff6){_0x403ff6=_0x403ff6||0x1f4;return function(_0x1fa0ca){logger['error'](_0x1fa0ca[_0x537c('0x23')]);if(_0x1fa0ca[_0x537c('0x24')]){delete _0x1fa0ca[_0x537c('0x24')];}_0x59442f['status'](_0x403ff6)['send'](_0x1fa0ca);};}exports[_0x537c('0x25')]=function(_0x44cc94,_0x11c11e){var _0x4e5f18={},_0x49d60b={},_0x5ca8f6={'count':0x0,'rows':[]};var _0x22f82e=_[_0x537c('0x26')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x50788a){return{'name':_0x50788a['fieldName'],'type':_0x50788a[_0x537c('0x27')][_0x537c('0x28')]};});_0x49d60b[_0x537c('0x29')]=_['map'](_0x22f82e,_0x537c('0x24'));_0x49d60b[_0x537c('0x2a')]=_[_0x537c('0x2b')](_0x44cc94['query']);_0x49d60b[_0x537c('0x2c')]=_[_0x537c('0x2d')](_0x49d60b[_0x537c('0x29')],_0x49d60b['query']);_0x4e5f18['attributes']=_[_0x537c('0x2d')](_0x49d60b[_0x537c('0x29')],qs[_0x537c('0x2e')](_0x44cc94[_0x537c('0x2a')][_0x537c('0x2e')]));_0x4e5f18[_0x537c('0x2f')]=_0x4e5f18[_0x537c('0x2f')][_0x537c('0x30')]?_0x4e5f18['attributes']:_0x49d60b['model'];if(!_0x44cc94[_0x537c('0x2a')][_0x537c('0x31')]('nolimit')){_0x4e5f18[_0x537c('0x1e')]=qs[_0x537c('0x1e')](_0x44cc94[_0x537c('0x2a')][_0x537c('0x1e')]);_0x4e5f18[_0x537c('0x1d')]=qs['offset'](_0x44cc94[_0x537c('0x2a')]['offset']);}_0x4e5f18['order']=qs['sort'](_0x44cc94['query'][_0x537c('0x32')]);_0x4e5f18[_0x537c('0x33')]=qs[_0x537c('0x2c')](_[_0x537c('0x34')](_0x44cc94[_0x537c('0x2a')],_0x49d60b[_0x537c('0x2c')]),_0x22f82e);if(_0x44cc94[_0x537c('0x2a')][_0x537c('0x35')]){_0x4e5f18[_0x537c('0x33')]=_[_0x537c('0x36')](_0x4e5f18[_0x537c('0x33')],{'$or':_[_0x537c('0x26')](_0x22f82e,function(_0x28b222){if(_0x28b222[_0x537c('0x27')]!=='VIRTUAL'){var _0x42ff20={};_0x42ff20[_0x28b222['name']]={'$like':'%'+_0x44cc94[_0x537c('0x2a')][_0x537c('0x35')]+'%'};return _0x42ff20;}})});}_0x4e5f18=_['merge']({},_0x4e5f18,_0x44cc94[_0x537c('0x37')]);var _0x3a05e1={'where':_0x4e5f18[_0x537c('0x33')]};return db[_0x537c('0x38')]['count'](_0x3a05e1)[_0x537c('0x22')](function(_0x189924){_0x5ca8f6[_0x537c('0x1f')]=_0x189924;if(_0x44cc94['query'][_0x537c('0x39')]){_0x4e5f18[_0x537c('0x3a')]=[{'all':!![]}];}return db[_0x537c('0x38')][_0x537c('0x3b')](_0x4e5f18);})[_0x537c('0x22')](function(_0x3fc07a){_0x5ca8f6['rows']=_0x3fc07a;return _0x5ca8f6;})[_0x537c('0x22')](respondWithFilteredResult(_0x11c11e,_0x4e5f18))[_0x537c('0x3c')](handleError(_0x11c11e,null));};exports[_0x537c('0x3d')]=function(_0x2ce967,_0x1f8350){var _0x2590f={'raw':!![],'where':{'id':_0x2ce967['params']['id']}},_0x2f236e={};_0x2f236e[_0x537c('0x29')]=_['keys'](db[_0x537c('0x38')][_0x537c('0x3e')]);_0x2f236e[_0x537c('0x2a')]=_[_0x537c('0x2b')](_0x2ce967[_0x537c('0x2a')]);_0x2f236e['filters']=_['intersection'](_0x2f236e[_0x537c('0x29')],_0x2f236e[_0x537c('0x2a')]);_0x2590f[_0x537c('0x2f')]=_[_0x537c('0x2d')](_0x2f236e[_0x537c('0x29')],qs[_0x537c('0x2e')](_0x2ce967['query'][_0x537c('0x2e')]));_0x2590f[_0x537c('0x2f')]=_0x2590f[_0x537c('0x2f')][_0x537c('0x30')]?_0x2590f[_0x537c('0x2f')]:_0x2f236e[_0x537c('0x29')];if(_0x2ce967[_0x537c('0x2a')][_0x537c('0x39')]){_0x2590f[_0x537c('0x3a')]=[{'all':!![]}];}_0x2590f=_[_0x537c('0x36')]({},_0x2590f,_0x2ce967[_0x537c('0x37')]);return db[_0x537c('0x38')][_0x537c('0x3f')](_0x2590f)[_0x537c('0x22')](handleEntityNotFound(_0x1f8350,null))['then'](respondWithResult(_0x1f8350,null))[_0x537c('0x3c')](handleError(_0x1f8350,null));};exports[_0x537c('0x40')]=function(_0x5bed3b,_0x2ddc3f){return db[_0x537c('0x38')][_0x537c('0x40')](_0x5bed3b['body'],{})[_0x537c('0x22')](respondWithResult(_0x2ddc3f,0xc9))[_0x537c('0x3c')](handleError(_0x2ddc3f,null));};exports[_0x537c('0x21')]=function(_0x432c00,_0x5b0dad){if(_0x432c00[_0x537c('0x41')]['id']){delete _0x432c00[_0x537c('0x41')]['id'];}return db[_0x537c('0x38')]['find']({'where':{'id':_0x432c00[_0x537c('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b0dad,null))[_0x537c('0x22')](saveUpdates(_0x432c00[_0x537c('0x41')],null))[_0x537c('0x22')](respondWithResult(_0x5b0dad,null))[_0x537c('0x3c')](handleError(_0x5b0dad,null));};exports[_0x537c('0x43')]=function(_0x25f216,_0x420f12){return db[_0x537c('0x38')][_0x537c('0x3f')]({'where':{'id':_0x25f216[_0x537c('0x42')]['id']}})['then'](handleEntityNotFound(_0x420f12,null))['then'](removeEntity(_0x420f12,null))[_0x537c('0x3c')](handleError(_0x420f12,null));};exports[_0x537c('0x44')]=function(_0x1d0bff,_0xfa8d30){return db[_0x537c('0x38')][_0x537c('0x44')]()[_0x537c('0x22')](respondWithResult(_0xfa8d30,null))['catch'](handleError(_0xfa8d30,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index fec5189..7a1416a 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 _0xf6c8=['request-promise','path','rimraf','../../config/environment','JscriptyAnswerReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x41cbef,_0x54367f){var _0x38d929=function(_0x48f0fd){while(--_0x48f0fd){_0x41cbef['push'](_0x41cbef['shift']());}};_0x38d929(++_0x54367f);}(_0xf6c8,0x123));var _0x8f6c=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xf6c8[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x8f6c('0x0'));var util=require(_0x8f6c('0x1'));var logger=require(_0x8f6c('0x2'))(_0x8f6c('0x3'));var moment=require(_0x8f6c('0x4'));var BPromise=require(_0x8f6c('0x5'));var rp=require(_0x8f6c('0x6'));var fs=require('fs');var path=require(_0x8f6c('0x7'));var rimraf=require(_0x8f6c('0x8'));var config=require(_0x8f6c('0x9'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x4d1414,_0x18e3ae){return _0x4d1414['define'](_0x8f6c('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x656e=['report_jscripty_answers','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0x1ca4ea,_0x2e44d4){var _0x2d9acc=function(_0x19f5de){while(--_0x19f5de){_0x1ca4ea['push'](_0x1ca4ea['shift']());}};_0x2d9acc(++_0x2e44d4);}(_0x656e,0x194));var _0xe656=function(_0x44881b,_0x541447){_0x44881b=_0x44881b-0x0;var _0x59b5cf=_0x656e[_0x44881b];return _0x59b5cf;};'use strict';var _=require(_0xe656('0x0'));var util=require(_0xe656('0x1'));var logger=require(_0xe656('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe656('0x3'));var rp=require(_0xe656('0x4'));var fs=require('fs');var path=require(_0xe656('0x5'));var rimraf=require(_0xe656('0x6'));var config=require(_0xe656('0x7'));var attributes=require(_0xe656('0x8'));module[_0xe656('0x9')]=function(_0x407156,_0x3f4a36){return _0x407156[_0xe656('0xa')](_0xe656('0xb'),attributes,{'tableName':_0xe656('0xc'),'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 b095f26..536fc20 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 _0x55b0=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','JscriptyAnswerReport,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','result','catch','lodash','util','bluebird','ioredis'];(function(_0x8c581f,_0x304f41){var _0x5b86ed=function(_0x555779){while(--_0x555779){_0x8c581f['push'](_0x8c581f['shift']());}};_0x5b86ed(++_0x304f41);}(_0x55b0,0x161));var _0x055b=function(_0x586e7c,_0x194435){_0x586e7c=_0x586e7c-0x0;var _0x355ef9=_0x55b0[_0x586e7c];return _0x355ef9;};'use strict';var _=require(_0x055b('0x0'));var util=require(_0x055b('0x1'));var moment=require('moment');var BPromise=require(_0x055b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x055b('0x3'));var db=require(_0x055b('0x4'))['db'];var utils=require(_0x055b('0x5'));var logger=require(_0x055b('0x6'))('rpc');var config=require(_0x055b('0x7'));var jayson=require(_0x055b('0x8'));var client=jayson[_0x055b('0x9')][_0x055b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38953e,_0x1c625f,_0x4e7c40){return new BPromise(function(_0x15cbbc,_0x557d2b){return client['request'](_0x38953e,_0x4e7c40)[_0x055b('0xb')](function(_0x276841){logger['info'](_0x055b('0xc'),_0x1c625f,'request\x20sent');logger[_0x055b('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x1c625f,'request\x20sent',JSON['stringify'](_0x276841));if(_0x276841[_0x055b('0xe')]){if(_0x276841[_0x055b('0xe')][_0x055b('0xf')]===0x1f4){logger[_0x055b('0xe')](_0x055b('0xc'),_0x1c625f,_0x276841['error'][_0x055b('0x10')]);return _0x557d2b(_0x276841[_0x055b('0xe')][_0x055b('0x10')]);}logger['error'](_0x055b('0xc'),_0x1c625f,_0x276841[_0x055b('0xe')][_0x055b('0x10')]);return _0x15cbbc(_0x276841[_0x055b('0xe')][_0x055b('0x10')]);}else{logger[_0x055b('0x11')](_0x055b('0xc'),_0x1c625f,_0x055b('0x12'));_0x15cbbc(_0x276841[_0x055b('0x13')][_0x055b('0x10')]);}})[_0x055b('0x14')](function(_0x346f76){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x1c625f,_0x346f76);_0x557d2b(_0x346f76);});});} \ No newline at end of file +var _0x3c44=['then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x41dee2,_0x1b34ad){var _0x35a3e9=function(_0x8369f1){while(--_0x8369f1){_0x41dee2['push'](_0x41dee2['shift']());}};_0x35a3e9(++_0x1b34ad);}(_0x3c44,0xed));var _0x43c4=function(_0x525bd1,_0x2fa5ce){_0x525bd1=_0x525bd1-0x0;var _0x3a50ab=_0x3c44[_0x525bd1];return _0x3a50ab;};'use strict';var _=require(_0x43c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x43c4('0x1'));var rs=require(_0x43c4('0x2'));var fs=require('fs');var Redis=require(_0x43c4('0x3'));var db=require(_0x43c4('0x4'))['db'];var utils=require(_0x43c4('0x5'));var logger=require(_0x43c4('0x6'))(_0x43c4('0x7'));var config=require(_0x43c4('0x8'));var jayson=require(_0x43c4('0x9'));var client=jayson[_0x43c4('0xa')][_0x43c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd629fa,_0x382fcf,_0x2d9278){return new BPromise(function(_0x21f12c,_0x3ca9b4){return client[_0x43c4('0xc')](_0xd629fa,_0x2d9278)[_0x43c4('0xd')](function(_0x2b7f71){logger[_0x43c4('0xe')](_0x43c4('0xf'),_0x382fcf,_0x43c4('0x10'));logger[_0x43c4('0x11')](_0x43c4('0x12'),_0x382fcf,'request\x20sent',JSON[_0x43c4('0x13')](_0x2b7f71));if(_0x2b7f71[_0x43c4('0x14')]){if(_0x2b7f71[_0x43c4('0x14')][_0x43c4('0x15')]===0x1f4){logger['error'](_0x43c4('0xf'),_0x382fcf,_0x2b7f71['error'][_0x43c4('0x16')]);return _0x3ca9b4(_0x2b7f71[_0x43c4('0x14')][_0x43c4('0x16')]);}logger['error'](_0x43c4('0xf'),_0x382fcf,_0x2b7f71[_0x43c4('0x14')][_0x43c4('0x16')]);return _0x21f12c(_0x2b7f71['error'][_0x43c4('0x16')]);}else{logger[_0x43c4('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x382fcf,_0x43c4('0x10'));_0x21f12c(_0x2b7f71[_0x43c4('0x17')][_0x43c4('0x16')]);}})[_0x43c4('0x18')](function(_0xce3f2f){logger['error'](_0x43c4('0xf'),_0x382fcf,_0xce3f2f);_0x3ca9b4(_0xce3f2f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 4bd7453..fa0d5f1 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 _0xfc58=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','create','post','/:id/clone','clone','put','update','destroy','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xfc58,0x17a));var _0x8fc5=function(_0x3c3a03,_0x3c0da1){_0x3c3a03=_0x3c3a03-0x0;var _0x57ff53=_0xfc58[_0x3c3a03];return _0x57ff53;};'use strict';var multer=require(_0x8fc5('0x0'));var util=require('util');var path=require(_0x8fc5('0x1'));var timeout=require(_0x8fc5('0x2'));var express=require(_0x8fc5('0x3'));var router=express['Router']();var fs_extra=require(_0x8fc5('0x4'));var auth=require(_0x8fc5('0x5'));var interaction=require(_0x8fc5('0x6'));var config=require(_0x8fc5('0x7'));var controller=require(_0x8fc5('0x8'));router[_0x8fc5('0x9')]('/',auth['isAuthenticated'](),controller[_0x8fc5('0xa')]);router['get'](_0x8fc5('0xb'),auth[_0x8fc5('0xc')](),controller[_0x8fc5('0xd')]);router[_0x8fc5('0x9')](_0x8fc5('0xe'),auth[_0x8fc5('0xc')](),controller[_0x8fc5('0xf')]);router[_0x8fc5('0x9')](_0x8fc5('0x10'),auth[_0x8fc5('0xc')](),controller['getAnswers']);router['get'](_0x8fc5('0x11'),auth['isAuthenticated'](),timeout(_0x8fc5('0x12')),controller['getSummary']);router['post']('/',auth[_0x8fc5('0xc')](),controller[_0x8fc5('0x13')]);router[_0x8fc5('0x14')](_0x8fc5('0x15'),auth[_0x8fc5('0xc')](),controller[_0x8fc5('0x16')]);router[_0x8fc5('0x17')](_0x8fc5('0xb'),auth['isAuthenticated'](),controller[_0x8fc5('0x18')]);router['delete'](_0x8fc5('0xb'),auth[_0x8fc5('0xc')](),controller[_0x8fc5('0x19')]);module[_0x8fc5('0x1a')]=router; \ No newline at end of file +var _0x8895=['post','create','/:id/clone','put','delete','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary'];(function(_0x5e909d,_0xcb0787){var _0x4cf7b5=function(_0x4581c6){while(--_0x4581c6){_0x5e909d['push'](_0x5e909d['shift']());}};_0x4cf7b5(++_0xcb0787);}(_0x8895,0x1bb));var _0x5889=function(_0x34decd,_0x1e22da){_0x34decd=_0x34decd-0x0;var _0x269223=_0x8895[_0x34decd];return _0x269223;};'use strict';var multer=require('multer');var util=require(_0x5889('0x0'));var path=require(_0x5889('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5889('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x5889('0x3'));var config=require(_0x5889('0x4'));var controller=require('./jscriptyProject.controller');router[_0x5889('0x5')]('/',auth[_0x5889('0x6')](),controller[_0x5889('0x7')]);router[_0x5889('0x5')](_0x5889('0x8'),auth['isAuthenticated'](),controller[_0x5889('0x9')]);router[_0x5889('0x5')](_0x5889('0xa'),auth[_0x5889('0x6')](),controller[_0x5889('0xb')]);router[_0x5889('0x5')](_0x5889('0xc'),auth[_0x5889('0x6')](),controller[_0x5889('0xd')]);router[_0x5889('0x5')](_0x5889('0xe'),auth['isAuthenticated'](),timeout(_0x5889('0xf')),controller[_0x5889('0x10')]);router[_0x5889('0x11')]('/',auth[_0x5889('0x6')](),controller[_0x5889('0x12')]);router[_0x5889('0x11')](_0x5889('0x13'),auth[_0x5889('0x6')](),controller['clone']);router[_0x5889('0x14')](_0x5889('0x8'),auth[_0x5889('0x6')](),controller['update']);router[_0x5889('0x15')](_0x5889('0x8'),auth[_0x5889('0x6')](),controller['destroy']);module[_0x5889('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index c6028b4..5366197 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 _0x16fe=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString'];(function(_0x123fd2,_0x5d15aa){var _0x28bc06=function(_0x22ac2f){while(--_0x22ac2f){_0x123fd2['push'](_0x123fd2['shift']());}};_0x28bc06(++_0x5d15aa);}(_0x16fe,0x1bf));var _0xe16f=function(_0x1088d7,_0x147306){_0x1088d7=_0x1088d7-0x0;var _0x262a69=_0x16fe[_0x1088d7];return _0x262a69;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe16f('0x0'));var util=require(_0xe16f('0x1'));module[_0xe16f('0x2')]={'name':{'type':Sequelize[_0xe16f('0x3')],'unique':_0xe16f('0x4')},'description':{'type':Sequelize[_0xe16f('0x3')]},'formData':{'type':Sequelize[_0xe16f('0x5')](_0xe16f('0x6')),'set':function(_0x2c4334){if(_[_0xe16f('0x7')](_0x2c4334)){this[_0xe16f('0x8')](_0xe16f('0x9'),JSON[_0xe16f('0xa')](_0x2c4334));}else if(_[_0xe16f('0xb')](_0x2c4334)){this['setDataValue'](_0xe16f('0x9'),_0x2c4334);}else{this['setDataValue'](_0xe16f('0x9'),util[_0xe16f('0xc')](_0xe16f('0xd'),this[_0xe16f('0xe')](_0xe16f('0x4'))||'',this[_0xe16f('0xe')](_0xe16f('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xe16f('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0xff5d=['getDataValue','BOOLEAN','sequelize','lodash','exports','STRING','name','TEXT','long','setDataValue','formData','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xff5d,0x6a));var _0xdff5=function(_0x35df2e,_0x113474){_0x35df2e=_0x35df2e-0x0;var _0x39456f=_0xff5d[_0x35df2e];return _0x39456f;};'use strict';var Sequelize=require(_0xdff5('0x0'));var _=require(_0xdff5('0x1'));var util=require('util');module[_0xdff5('0x2')]={'name':{'type':Sequelize[_0xdff5('0x3')],'unique':_0xdff5('0x4')},'description':{'type':Sequelize[_0xdff5('0x3')]},'formData':{'type':Sequelize[_0xdff5('0x5')](_0xdff5('0x6')),'set':function(_0x28e003){if(_['isObjectLike'](_0x28e003)){this[_0xdff5('0x7')](_0xdff5('0x8'),JSON['stringify'](_0x28e003));}else if(_[_0xdff5('0x9')](_0x28e003)){this[_0xdff5('0x7')](_0xdff5('0x8'),_0x28e003);}else{this['setDataValue']('formData',util['format'](_0xdff5('0xa'),this['getDataValue'](_0xdff5('0x4'))||'',this[_0xdff5('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xdff5('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xdff5('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 6111917..7d189c9 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 _0x2deb=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Projects','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring'];(function(_0x3a73f7,_0x722c17){var _0x393121=function(_0x1b8b50){while(--_0x1b8b50){_0x3a73f7['push'](_0x3a73f7['shift']());}};_0x393121(++_0x722c17);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb2de('0x0'));var rimraf=require(_0xb2de('0x1'));var zipdir=require(_0xb2de('0x2'));var jsonpatch=require(_0xb2de('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb2de('0x4'));var Mustache=require(_0xb2de('0x5'));var util=require(_0xb2de('0x6'));var path=require(_0xb2de('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb2de('0x8'));var fs=require('fs');var fs_extra=require(_0xb2de('0x9'));var _=require(_0xb2de('0xa'));var squel=require('squel');var crypto=require(_0xb2de('0xb'));var jsforce=require(_0xb2de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb2de('0xd'));var querystring=require(_0xb2de('0xe'));var Papa=require(_0xb2de('0xf'));var Redis=require('ioredis');var authService=require(_0xb2de('0x10'));var qs=require(_0xb2de('0x11'));var as=require(_0xb2de('0x12'));var hardwareService=require(_0xb2de('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb2de('0x14'));var config=require(_0xb2de('0x15'));var licenseUtil=require(_0xb2de('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e2237,_0x343024){_0x343024=_0x343024||0xcc;return function(_0xec4373){if(_0xec4373){return _0x1e2237['sendStatus'](_0x343024);}return _0x1e2237[_0xb2de('0x17')](_0x343024)['end']();};}function respondWithResult(_0x160d61,_0x4feb90){_0x4feb90=_0x4feb90||0xc8;return function(_0x10ef21){if(_0x10ef21){return _0x160d61[_0xb2de('0x17')](_0x4feb90)[_0xb2de('0x18')](_0x10ef21);}};}function respondWithFilteredResult(_0x5a1f02,_0x209429){return function(_0x40f29d){if(_0x40f29d){var _0x2dc98f=typeof _0x209429[_0xb2de('0x19')]===_0xb2de('0x1a')&&typeof _0x209429[_0xb2de('0x1b')]===_0xb2de('0x1a');var _0x2db287=_0x40f29d[_0xb2de('0x1c')];var _0x5d06ac=_0x2dc98f?0x0:_0x209429[_0xb2de('0x19')];var _0x53d213=_0x2dc98f?_0x40f29d[_0xb2de('0x1c')]:_0x209429[_0xb2de('0x19')]+_0x209429['limit'];var _0x2fbe63;if(_0x53d213>=_0x2db287){_0x53d213=_0x2db287;_0x2fbe63=0xc8;}else{_0x2fbe63=0xce;}_0x5a1f02[_0xb2de('0x17')](_0x2fbe63);return _0x5a1f02['set'](_0xb2de('0x1d'),_0x5d06ac+'-'+_0x53d213+'/'+_0x2db287)[_0xb2de('0x18')](_0x40f29d);}return null;};}function patchUpdates(_0x34b228){return function(_0x148c91){try{jsonpatch[_0xb2de('0x1e')](_0x148c91,_0x34b228,!![]);}catch(_0x3014b9){return BPromise[_0xb2de('0x1f')](_0x3014b9);}return _0x148c91[_0xb2de('0x20')]();};}function saveUpdates(_0x20d7f8,_0x506a50){return function(_0x280644){if(_0x280644){return _0x280644[_0xb2de('0x21')](_0x20d7f8)[_0xb2de('0x22')](function(_0xa97fb4){return _0xa97fb4;});}return null;};}function removeEntity(_0x521e47,_0x55051f){return function(_0x102da8){if(_0x102da8){return _0x102da8[_0xb2de('0x23')]()[_0xb2de('0x22')](function(){var _0x543ff7=_0x102da8[_0xb2de('0x24')]({'plain':!![]});var _0x1cc2db='Projects';return db[_0xb2de('0x25')]['destroy']({'where':{'type':_0x1cc2db,'resourceId':_0x543ff7['id']}})[_0xb2de('0x22')](function(){return _0x102da8;});})[_0xb2de('0x22')](function(){_0x521e47[_0xb2de('0x17')](0xcc)[_0xb2de('0x26')]();});}};}function handleEntityNotFound(_0xeb4e31,_0x1ad5a2){return function(_0x48675d){if(!_0x48675d){_0xeb4e31[_0xb2de('0x27')](0x194);}return _0x48675d;};}function handleError(_0x5b04ae,_0x38fee9){_0x38fee9=_0x38fee9||0x1f4;return function(_0x5c74e6){logger['error'](_0x5c74e6[_0xb2de('0x28')]);if(_0x5c74e6[_0xb2de('0x29')]){delete _0x5c74e6[_0xb2de('0x29')];}_0x5b04ae[_0xb2de('0x17')](_0x38fee9)[_0xb2de('0x2a')](_0x5c74e6);};}exports[_0xb2de('0x2b')]=function(_0x1e7248,_0x88f02){var _0x1e0f6d={},_0x379e5f={},_0x40c5d7={'count':0x0,'rows':[]};var _0x101878=_['map'](db[_0xb2de('0x2c')][_0xb2de('0x2d')],function(_0x5b8700){return{'name':_0x5b8700[_0xb2de('0x2e')],'type':_0x5b8700[_0xb2de('0x2f')]['key']};});_0x379e5f[_0xb2de('0x30')]=_[_0xb2de('0x31')](_0x101878,_0xb2de('0x29'));_0x379e5f['query']=_[_0xb2de('0x32')](_0x1e7248[_0xb2de('0x33')]);_0x379e5f[_0xb2de('0x34')]=_[_0xb2de('0x35')](_0x379e5f[_0xb2de('0x30')],_0x379e5f[_0xb2de('0x33')]);_0x1e0f6d[_0xb2de('0x36')]=_[_0xb2de('0x35')](_0x379e5f[_0xb2de('0x30')],qs[_0xb2de('0x37')](_0x1e7248[_0xb2de('0x33')]['fields']));_0x1e0f6d[_0xb2de('0x36')]=_0x1e0f6d[_0xb2de('0x36')][_0xb2de('0x38')]?_0x1e0f6d[_0xb2de('0x36')]:_0x379e5f[_0xb2de('0x30')];if(!_0x1e7248[_0xb2de('0x33')][_0xb2de('0x39')](_0xb2de('0x3a'))){_0x1e0f6d[_0xb2de('0x1b')]=qs[_0xb2de('0x1b')](_0x1e7248[_0xb2de('0x33')][_0xb2de('0x1b')]);_0x1e0f6d[_0xb2de('0x19')]=qs[_0xb2de('0x19')](_0x1e7248[_0xb2de('0x33')]['offset']);}_0x1e0f6d[_0xb2de('0x3b')]=qs['sort'](_0x1e7248[_0xb2de('0x33')][_0xb2de('0x3c')]);_0x1e0f6d[_0xb2de('0x3d')]=qs[_0xb2de('0x34')](_[_0xb2de('0x3e')](_0x1e7248[_0xb2de('0x33')],_0x379e5f[_0xb2de('0x34')]),_0x101878);if(_0x1e7248[_0xb2de('0x33')][_0xb2de('0x3f')]){_0x1e0f6d[_0xb2de('0x3d')]=_[_0xb2de('0x40')](_0x1e0f6d[_0xb2de('0x3d')],{'$or':_[_0xb2de('0x31')](_0x101878,function(_0x1e7091){if(_0x1e7091[_0xb2de('0x2f')]!=='VIRTUAL'){var _0x179a92={};_0x179a92[_0x1e7091[_0xb2de('0x29')]]={'$like':'%'+_0x1e7248['query'][_0xb2de('0x3f')]+'%'};return _0x179a92;}})});}_0x1e0f6d=_[_0xb2de('0x40')]({},_0x1e0f6d,_0x1e7248[_0xb2de('0x41')]);var _0x12b5b7={'where':_0x1e0f6d['where']};return db[_0xb2de('0x2c')][_0xb2de('0x1c')](_0x12b5b7)['then'](function(_0x47448a){_0x40c5d7[_0xb2de('0x1c')]=_0x47448a;if(_0x1e7248['query'][_0xb2de('0x42')]){_0x1e0f6d['include']=[{'all':!![]}];}return db['JscriptyProject'][_0xb2de('0x43')](_0x1e0f6d);})['then'](function(_0x514623){_0x40c5d7[_0xb2de('0x44')]=_0x514623;return _0x40c5d7;})[_0xb2de('0x22')](respondWithFilteredResult(_0x88f02,_0x1e0f6d))['catch'](handleError(_0x88f02,null));};exports[_0xb2de('0x45')]=function(_0x1e35a5,_0x14b0b2){var _0x25f7d1={'raw':![],'where':{'id':_0x1e35a5[_0xb2de('0x46')]['id']}},_0x5d447f={};_0x5d447f[_0xb2de('0x30')]=_[_0xb2de('0x32')](db[_0xb2de('0x2c')][_0xb2de('0x2d')]);_0x5d447f[_0xb2de('0x33')]=_[_0xb2de('0x32')](_0x1e35a5['query']);_0x5d447f[_0xb2de('0x34')]=_[_0xb2de('0x35')](_0x5d447f[_0xb2de('0x30')],_0x5d447f['query']);_0x25f7d1[_0xb2de('0x36')]=_['intersection'](_0x5d447f[_0xb2de('0x30')],qs[_0xb2de('0x37')](_0x1e35a5[_0xb2de('0x33')][_0xb2de('0x37')]));_0x25f7d1['attributes']=_0x25f7d1[_0xb2de('0x36')][_0xb2de('0x38')]?_0x25f7d1['attributes']:_0x5d447f['model'];if(_0x1e35a5[_0xb2de('0x33')][_0xb2de('0x42')]){_0x25f7d1[_0xb2de('0x47')]=[{'all':!![]}];}_0x25f7d1=_[_0xb2de('0x40')]({},_0x25f7d1,_0x1e35a5[_0xb2de('0x41')]);return db['JscriptyProject'][_0xb2de('0x48')](_0x25f7d1)['then'](handleEntityNotFound(_0x14b0b2,null))[_0xb2de('0x22')](respondWithResult(_0x14b0b2,null))['catch'](handleError(_0x14b0b2,null));};exports[_0xb2de('0x49')]=function(_0x3dca27,_0x4c52bc){return db[_0xb2de('0x2c')]['create'](_0x3dca27[_0xb2de('0x4a')],{})[_0xb2de('0x22')](function(_0x369ee9){var _0x39a9aa=_0x3dca27['user'][_0xb2de('0x24')]({'plain':!![]});if(!_0x39a9aa)throw new Error(_0xb2de('0x4b'));if(_0x39a9aa[_0xb2de('0x4c')]===_0xb2de('0x4d')){var _0x2a7d51=_0x369ee9['get']({'plain':!![]});var _0x36ab6a=_0xb2de('0x4e');return db[_0xb2de('0x4f')][_0xb2de('0x48')]({'where':{'name':_0x36ab6a,'userProfileId':_0x39a9aa[_0xb2de('0x50')]},'raw':!![]})['then'](function(_0x1c4595){if(_0x1c4595&&_0x1c4595[_0xb2de('0x51')]===0x0){return db['UserProfileResource'][_0xb2de('0x49')]({'name':_0x2a7d51['name'],'resourceId':_0x2a7d51['id'],'type':_0x1c4595[_0xb2de('0x29')],'sectionId':_0x1c4595['id']},{})[_0xb2de('0x22')](function(){return _0x369ee9;});}else{return _0x369ee9;}})[_0xb2de('0x52')](function(_0x42956a){logger['error'](_0xb2de('0x53'),_0x42956a);throw _0x42956a;});}return _0x369ee9;})[_0xb2de('0x22')](respondWithResult(_0x4c52bc,0xc9))['catch'](handleError(_0x4c52bc,null));};exports['clone']=function(_0x41f2c4,_0x42b0f2){var _0x15165f={'where':{'id':_0x41f2c4[_0xb2de('0x46')]['id']}},_0x3ec51d={};_0x3ec51d[_0xb2de('0x30')]=_[_0xb2de('0x32')](db[_0xb2de('0x2c')][_0xb2de('0x2d')]);_0x15165f[_0xb2de('0x36')]=_[_0xb2de('0x35')](_0x3ec51d['model'],qs['fields'](_0x41f2c4[_0xb2de('0x33')][_0xb2de('0x37')]));_0x15165f[_0xb2de('0x36')]=_0x15165f[_0xb2de('0x36')][_0xb2de('0x38')]?_0x15165f[_0xb2de('0x36')]:_0x3ec51d[_0xb2de('0x30')];if(_0x41f2c4['query']['includeAll']){_0x15165f[_0xb2de('0x47')]=[{'all':!![]}];}_0x15165f=_[_0xb2de('0x40')]({},_0x15165f,_0x41f2c4[_0xb2de('0x41')]);return db[_0xb2de('0x2c')]['find'](_0x15165f)['then'](handleEntityNotFound(_0x42b0f2,null))[_0xb2de('0x22')](function(_0x2e9b7c){if(_0x2e9b7c){var _0x1637cc=_0x2e9b7c['get']({'plain':!![]});_0x1637cc=qs[_0xb2de('0x54')](_0x1637cc,['id',_0xb2de('0x55'),_0xb2de('0x56')]);_0x41f2c4[_0xb2de('0x4a')]=_[_0xb2de('0x54')](_0x41f2c4[_0xb2de('0x4a')],['id','createdAt',_0xb2de('0x56')]);return db[_0xb2de('0x2c')][_0xb2de('0x49')](_[_0xb2de('0x40')](_0x1637cc,_0x41f2c4[_0xb2de('0x4a')]),{'include':_0x41f2c4[_0xb2de('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0xb2de('0x22')](function(_0x5c683e){var _0x365724=_0x41f2c4[_0xb2de('0x4d')]['get']({'plain':!![]});if(!_0x365724)throw new Error(_0xb2de('0x4b'));if(_0x365724['role']==='user'){var _0x49349d=_0x5c683e[_0xb2de('0x24')]({'plain':!![]});var _0x5a27b7='Projects';return db['UserProfileSection'][_0xb2de('0x48')]({'where':{'name':_0x5a27b7,'userProfileId':_0x365724[_0xb2de('0x50')]},'raw':!![]})[_0xb2de('0x22')](function(_0x37ec88){if(_0x37ec88&&_0x37ec88[_0xb2de('0x51')]===0x0){return db[_0xb2de('0x25')][_0xb2de('0x49')]({'name':_0x49349d[_0xb2de('0x29')],'resourceId':_0x49349d['id'],'type':_0x37ec88['name'],'sectionId':_0x37ec88['id']},{})['then'](function(){return _0x5c683e;});}else{return _0x5c683e;}})[_0xb2de('0x52')](function(_0x5178c8){logger['error'](_0xb2de('0x53'),_0x5178c8);throw _0x5178c8;});}return _0x5c683e;});}})['then'](respondWithResult(_0x42b0f2,0xc9))[_0xb2de('0x52')](handleError(_0x42b0f2,null));};exports['update']=function(_0x4e036e,_0x276cc6){if(_0x4e036e['body']['id']){delete _0x4e036e[_0xb2de('0x4a')]['id'];}return db[_0xb2de('0x2c')][_0xb2de('0x48')]({'where':{'id':_0x4e036e[_0xb2de('0x46')]['id']}})[_0xb2de('0x22')](handleEntityNotFound(_0x276cc6,null))[_0xb2de('0x22')](saveUpdates(_0x4e036e[_0xb2de('0x4a')],null))[_0xb2de('0x22')](respondWithResult(_0x276cc6,null))[_0xb2de('0x52')](handleError(_0x276cc6,null));};exports[_0xb2de('0x23')]=function(_0x28b960,_0x6e3dc){return db[_0xb2de('0x2c')][_0xb2de('0x48')]({'where':{'id':_0x28b960['params']['id']}})[_0xb2de('0x22')](handleEntityNotFound(_0x6e3dc,null))[_0xb2de('0x22')](removeEntity(_0x6e3dc,null))[_0xb2de('0x52')](handleError(_0x6e3dc,null));};exports[_0xb2de('0x57')]=function(_0x16293e,_0x470a8a,_0x643557){var _0x22df63={'raw':!![],'where':{}};var _0x4faf9d={};var _0x2fbf14={'count':0x0,'rows':[]};return db[_0xb2de('0x2c')][_0xb2de('0x58')]({'where':{'id':_0x16293e[_0xb2de('0x46')]['id']}})[_0xb2de('0x22')](handleEntityNotFound(_0x470a8a,null))[_0xb2de('0x22')](function(_0x3d9844){if(_0x3d9844){_0x4faf9d[_0xb2de('0x30')]=_[_0xb2de('0x32')](db[_0xb2de('0x59')][_0xb2de('0x2d')]);_0x4faf9d[_0xb2de('0x33')]=_['keys'](_0x16293e[_0xb2de('0x33')]);_0x4faf9d[_0xb2de('0x34')]=_[_0xb2de('0x35')](_0x4faf9d['model'],_0x4faf9d['query']);_0x22df63[_0xb2de('0x36')]=_[_0xb2de('0x35')](_0x4faf9d[_0xb2de('0x30')],qs['fields'](_0x16293e[_0xb2de('0x33')][_0xb2de('0x37')]));_0x22df63[_0xb2de('0x36')]=_0x22df63[_0xb2de('0x36')][_0xb2de('0x38')]?_0x22df63[_0xb2de('0x36')]:_0x4faf9d[_0xb2de('0x30')];if(!_0x16293e[_0xb2de('0x33')][_0xb2de('0x39')](_0xb2de('0x3a'))){_0x22df63['limit']=qs['limit'](_0x16293e[_0xb2de('0x33')][_0xb2de('0x1b')]);_0x22df63['offset']=qs[_0xb2de('0x19')](_0x16293e[_0xb2de('0x33')][_0xb2de('0x19')]);}_0x22df63[_0xb2de('0x3b')]=qs['sort'](_0x16293e[_0xb2de('0x33')][_0xb2de('0x3c')]);_0x22df63['where']=qs[_0xb2de('0x34')](_[_0xb2de('0x3e')](_0x16293e[_0xb2de('0x33')],_0x4faf9d[_0xb2de('0x34')]));_0x22df63['where']['ProjectId']=_0x3d9844['id'];if(_0x16293e[_0xb2de('0x33')][_0xb2de('0x3f')]){_0x22df63[_0xb2de('0x3d')]=_[_0xb2de('0x40')](_0x22df63[_0xb2de('0x3d')],{'$or':_[_0xb2de('0x31')](_0x22df63['attributes'],function(_0x5bbedf){var _0x79de58={};_0x79de58[_0x5bbedf]={'$like':'%'+_0x16293e[_0xb2de('0x33')][_0xb2de('0x3f')]+'%'};return _0x79de58;})});}_0x22df63=_[_0xb2de('0x40')]({},_0x22df63,_0x16293e[_0xb2de('0x41')]);return db[_0xb2de('0x59')][_0xb2de('0x1c')]({'where':_0x22df63['where']})['then'](function(_0x5a8f5c){_0x2fbf14[_0xb2de('0x1c')]=_0x5a8f5c;if(_0x16293e[_0xb2de('0x33')][_0xb2de('0x42')]){_0x22df63[_0xb2de('0x47')]=[{'all':!![]}];}return db[_0xb2de('0x59')][_0xb2de('0x43')](_0x22df63);})[_0xb2de('0x22')](function(_0x145ee3){_0x2fbf14[_0xb2de('0x44')]=_0x145ee3;return _0x2fbf14;});}})[_0xb2de('0x22')](respondWithFilteredResult(_0x470a8a,_0x22df63))[_0xb2de('0x52')](handleError(_0x470a8a,null));};exports[_0xb2de('0x5a')]=function(_0x7a8b43,_0x3b99ab,_0x1ccab4){var _0x3f78a4={'raw':!![],'where':{}};var _0x2f9699={};var _0x55f45e={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xb2de('0x58')]({'where':{'id':_0x7a8b43[_0xb2de('0x46')]['id']}})[_0xb2de('0x22')](handleEntityNotFound(_0x3b99ab,null))['then'](function(_0x15855a){if(_0x15855a){_0x2f9699['model']=_[_0xb2de('0x32')](db[_0xb2de('0x5b')][_0xb2de('0x2d')]);_0x2f9699[_0xb2de('0x33')]=_[_0xb2de('0x32')](_0x7a8b43['query']);_0x2f9699[_0xb2de('0x34')]=_[_0xb2de('0x35')](_0x2f9699['model'],_0x2f9699[_0xb2de('0x33')]);_0x3f78a4['attributes']=_[_0xb2de('0x35')](_0x2f9699[_0xb2de('0x30')],qs[_0xb2de('0x37')](_0x7a8b43[_0xb2de('0x33')][_0xb2de('0x37')]));_0x3f78a4[_0xb2de('0x36')]=_0x3f78a4[_0xb2de('0x36')][_0xb2de('0x38')]?_0x3f78a4[_0xb2de('0x36')]:_0x2f9699['model'];if(!_0x7a8b43['query'][_0xb2de('0x39')](_0xb2de('0x3a'))){_0x3f78a4['limit']=qs['limit'](_0x7a8b43[_0xb2de('0x33')][_0xb2de('0x1b')]);_0x3f78a4['offset']=qs[_0xb2de('0x19')](_0x7a8b43[_0xb2de('0x33')]['offset']);}_0x3f78a4['order']=qs[_0xb2de('0x3c')](_0x7a8b43[_0xb2de('0x33')][_0xb2de('0x3c')]);_0x3f78a4[_0xb2de('0x3d')]=qs['filters'](_[_0xb2de('0x3e')](_0x7a8b43[_0xb2de('0x33')],_0x2f9699[_0xb2de('0x34')]));_0x3f78a4[_0xb2de('0x3d')][_0xb2de('0x5c')]=_0x15855a['id'];if(_0x7a8b43[_0xb2de('0x33')]['filter']){_0x3f78a4['where']=_[_0xb2de('0x40')](_0x3f78a4[_0xb2de('0x3d')],{'$or':_[_0xb2de('0x31')](_0x3f78a4[_0xb2de('0x36')],function(_0x7d26a6){var _0x5c251f={};_0x5c251f[_0x7d26a6]={'$like':'%'+_0x7a8b43[_0xb2de('0x33')][_0xb2de('0x3f')]+'%'};return _0x5c251f;})});}_0x3f78a4=_[_0xb2de('0x40')]({},_0x3f78a4,_0x7a8b43[_0xb2de('0x41')]);return db[_0xb2de('0x5b')][_0xb2de('0x1c')]({'where':_0x3f78a4[_0xb2de('0x3d')]})['then'](function(_0x544a32){_0x55f45e['count']=_0x544a32;if(_0x7a8b43[_0xb2de('0x33')][_0xb2de('0x42')]){_0x3f78a4['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x3f78a4);})[_0xb2de('0x22')](function(_0x2c74cb){_0x55f45e['rows']=_0x2c74cb;return _0x55f45e;});}})['then'](respondWithFilteredResult(_0x3b99ab,_0x3f78a4))[_0xb2de('0x52')](handleError(_0x3b99ab,null));};function char(_0x3bbca1){return _0xb2de('0x5d')===typeof _0x3bbca1?String[_0xb2de('0x5e')]['apply'](null,arguments):_0x3bbca1;}function needsEncapsulation(_0xf8075b){return!!_0xf8075b&&(_0xf8075b[_0xb2de('0x5f')]()['indexOf'](char(0xd))>=0x0||_0xf8075b[_0xb2de('0x5f')]()[_0xb2de('0x60')](char(0xa))>=0x0||_0xf8075b[_0xb2de('0x5f')]()['indexOf'](char(0x2c))>=0x0||_0xf8075b[_0xb2de('0x5f')]()[_0xb2de('0x60')](char(0x22))>=0x0);}function encapsulate(_0x28abde){var _0x2ea84b=char(0x22),_0xea3661='\x5c'+char(0x22),_0x4af076=_0x28abde[_0xb2de('0x5f')]()[_0xb2de('0x61')](new RegExp(_0x2ea84b,'g'),_0xea3661);return _0x2ea84b+_0x4af076+_0x2ea84b;}exports[_0xb2de('0x62')]=function(_0x2c770a,_0x242fd3,_0x562484){var _0x50eb1a,_0x42b41d;var _0x52d516={'where':{'ProjectId':_0x2c770a[_0xb2de('0x46')]['id']}};if(_0x2c770a[_0xb2de('0x33')][_0xb2de('0x63')]){_0x52d516['where'][_0xb2de('0x64')]=JSON['parse'](_0x2c770a[_0xb2de('0x33')][_0xb2de('0x63')]);}return db[_0xb2de('0x59')][_0xb2de('0x43')](_0x52d516)[_0xb2de('0x22')](handleEntityNotFound(_0x242fd3,null))[_0xb2de('0x22')](function(_0x3075c7){if(_0x3075c7){_0x50eb1a=_0x3075c7;return db[_0xb2de('0x65')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x50eb1a,'id')},'ProjectId':_0x2c770a[_0xb2de('0x46')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x242fd3,null))['then'](function(_0x5cb350){if(_0x5cb350){_0x42b41d=_0x5cb350;var _0x3bd385={};for(var _0x657765=0x0,_0x35809c=_0x42b41d[_0xb2de('0x38')];_0x657765<_0x35809c;_0x657765++){if(!_0x3bd385[_0xb2de('0x39')](_0x42b41d[_0x657765][_0xb2de('0x66')])){_0x3bd385[_0x42b41d[_0x657765][_0xb2de('0x66')]]=needsEncapsulation(_0x42b41d[_0x657765][_0xb2de('0x67')])?encapsulate(_0x42b41d[_0x657765]['question']):_0x42b41d[_0x657765][_0xb2de('0x67')];}}var _0x4115d3=[],_0x3e2b6d={};for(var _0x24c43e=0x0,_0x1e4974=_0x50eb1a[_0xb2de('0x38')];_0x24c43e<_0x1e4974;_0x24c43e++){_0x3e2b6d={'ProjectId':_0x2c770a[_0xb2de('0x46')]['id'],'SessionId':_0x50eb1a[_0x24c43e]['id'],'StartTime':moment(_0x50eb1a[_0x24c43e][_0xb2de('0x64')])[_0xb2de('0x68')](_0xb2de('0x69'))};for(var _0x36cce6=0x0,_0x1d44fc=_0x42b41d['length'];_0x36cce6<_0x1d44fc;_0x36cce6++){if(_0x42b41d[_0x36cce6]['SessionId']==_0x50eb1a[_0x24c43e]['id']&&_0x3bd385['hasOwnProperty'](_0x42b41d[_0x36cce6][_0xb2de('0x66')])){_0x3e2b6d[_0x3bd385[_0x42b41d[_0x36cce6][_0xb2de('0x66')]]]=_0x42b41d[_0x36cce6][_0xb2de('0x6a')];}}for(var _0x2b71ef in _0x3bd385){if(!_0x3e2b6d[_0xb2de('0x39')](_0x3bd385[_0x2b71ef])){_0x3e2b6d[_0x3bd385[_0x2b71ef]]=null;}}_0x4115d3[_0xb2de('0x6b')](_0x3e2b6d);}return _0x4115d3;}})[_0xb2de('0x22')](function(_0x3f93fe){if(!_[_0xb2de('0x6c')](_0x3f93fe)){var _0xb88e1=toCsv(_0x3f93fe);var _0x353993=Date[_0xb2de('0x6d')]();fs['writeFileSync'](util[_0xb2de('0x68')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2c770a[_0xb2de('0x46')]['id'],_0x353993),_0xb88e1);_0x242fd3[_0xb2de('0x6e')](_0xb2de('0x6f'),_0xb2de('0x70')+util[_0xb2de('0x68')](_0xb2de('0x71'),_0x2c770a[_0xb2de('0x46')]['id'],_0x353993));_0x242fd3[_0xb2de('0x6e')](_0xb2de('0x72'),'text/csv');return _0x242fd3[_0xb2de('0x73')](util[_0xb2de('0x68')](_0xb2de('0x74'),_0x2c770a[_0xb2de('0x46')]['id'],_0x353993));}else{return _0x242fd3[_0xb2de('0x27')](0xcc);}})[_0xb2de('0x52')](handleError(_0x242fd3,null));}; \ No newline at end of file +var _0x3495=['setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','save','update','then','destroy','get','Projects','error','stack','name','send','map','JscriptyProject','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getSessions','JscriptySessionReport','nolimit','sort','ProjectId','getAnswers','findOne','JscriptyAnswerReport','number','apply','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x3495,0x1de));var _0x5349=function(_0x3221e4,_0x1cade6){_0x3221e4=_0x3221e4-0x0;var _0x3c4269=_0x3495[_0x3221e4];return _0x3c4269;};'use strict';var emlformat=require(_0x5349('0x0'));var rimraf=require(_0x5349('0x1'));var zipdir=require(_0x5349('0x2'));var jsonpatch=require(_0x5349('0x3'));var rp=require(_0x5349('0x4'));var moment=require(_0x5349('0x5'));var BPromise=require(_0x5349('0x6'));var Mustache=require(_0x5349('0x7'));var util=require(_0x5349('0x8'));var path=require('path');var sox=require(_0x5349('0x9'));var csv=require(_0x5349('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5349('0xb'));var _=require('lodash');var squel=require(_0x5349('0xc'));var crypto=require('crypto');var jsforce=require(_0x5349('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5349('0xa'));var querystring=require(_0x5349('0xe'));var Papa=require(_0x5349('0xf'));var Redis=require(_0x5349('0x10'));var authService=require(_0x5349('0x11'));var qs=require(_0x5349('0x12'));var as=require(_0x5349('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5349('0x14'))('api');var utils=require(_0x5349('0x15'));var config=require(_0x5349('0x16'));var licenseUtil=require(_0x5349('0x17'));var db=require(_0x5349('0x18'))['db'];function respondWithStatusCode(_0x2f5172,_0x3c592a){_0x3c592a=_0x3c592a||0xcc;return function(_0x642966){if(_0x642966){return _0x2f5172[_0x5349('0x19')](_0x3c592a);}return _0x2f5172[_0x5349('0x1a')](_0x3c592a)[_0x5349('0x1b')]();};}function respondWithResult(_0x534e31,_0x2fde66){_0x2fde66=_0x2fde66||0xc8;return function(_0x367c25){if(_0x367c25){return _0x534e31['status'](_0x2fde66)[_0x5349('0x1c')](_0x367c25);}};}function respondWithFilteredResult(_0x269f7f,_0x2fe611){return function(_0x49bbec){if(_0x49bbec){var _0x5bcb3a=typeof _0x2fe611['offset']===_0x5349('0x1d')&&typeof _0x2fe611['limit']===_0x5349('0x1d');var _0x5f3cfb=_0x49bbec[_0x5349('0x1e')];var _0x2c1f1=_0x5bcb3a?0x0:_0x2fe611[_0x5349('0x1f')];var _0x132639=_0x5bcb3a?_0x49bbec['count']:_0x2fe611[_0x5349('0x1f')]+_0x2fe611[_0x5349('0x20')];var _0x8abbe3;if(_0x132639>=_0x5f3cfb){_0x132639=_0x5f3cfb;_0x8abbe3=0xc8;}else{_0x8abbe3=0xce;}_0x269f7f[_0x5349('0x1a')](_0x8abbe3);return _0x269f7f['set'](_0x5349('0x21'),_0x2c1f1+'-'+_0x132639+'/'+_0x5f3cfb)[_0x5349('0x1c')](_0x49bbec);}return null;};}function patchUpdates(_0x4f2cb6){return function(_0x4c96dc){try{jsonpatch['apply'](_0x4c96dc,_0x4f2cb6,!![]);}catch(_0x423581){return BPromise['reject'](_0x423581);}return _0x4c96dc[_0x5349('0x22')]();};}function saveUpdates(_0x1ff911,_0x164978){return function(_0x6c80cd){if(_0x6c80cd){return _0x6c80cd[_0x5349('0x23')](_0x1ff911)[_0x5349('0x24')](function(_0x303250){return _0x303250;});}return null;};}function removeEntity(_0x43a0c2,_0x2a3258){return function(_0x34353f){if(_0x34353f){return _0x34353f[_0x5349('0x25')]()[_0x5349('0x24')](function(){var _0x57af6c=_0x34353f[_0x5349('0x26')]({'plain':!![]});var _0x187b39=_0x5349('0x27');return db['UserProfileResource'][_0x5349('0x25')]({'where':{'type':_0x187b39,'resourceId':_0x57af6c['id']}})['then'](function(){return _0x34353f;});})[_0x5349('0x24')](function(){_0x43a0c2[_0x5349('0x1a')](0xcc)[_0x5349('0x1b')]();});}};}function handleEntityNotFound(_0x49153e,_0x1b5e87){return function(_0xc3e727){if(!_0xc3e727){_0x49153e[_0x5349('0x19')](0x194);}return _0xc3e727;};}function handleError(_0x339f9a,_0x180bc7){_0x180bc7=_0x180bc7||0x1f4;return function(_0x16edcb){logger[_0x5349('0x28')](_0x16edcb[_0x5349('0x29')]);if(_0x16edcb[_0x5349('0x2a')]){delete _0x16edcb['name'];}_0x339f9a[_0x5349('0x1a')](_0x180bc7)[_0x5349('0x2b')](_0x16edcb);};}exports['index']=function(_0x3cad49,_0x573ee1){var _0x1df8b0={},_0x262f62={},_0x10c284={'count':0x0,'rows':[]};var _0x16dda8=_[_0x5349('0x2c')](db[_0x5349('0x2d')]['rawAttributes'],function(_0x451120){return{'name':_0x451120[_0x5349('0x2e')],'type':_0x451120[_0x5349('0x2f')][_0x5349('0x30')]};});_0x262f62['model']=_['map'](_0x16dda8,_0x5349('0x2a'));_0x262f62[_0x5349('0x31')]=_[_0x5349('0x32')](_0x3cad49['query']);_0x262f62[_0x5349('0x33')]=_['intersection'](_0x262f62[_0x5349('0x34')],_0x262f62[_0x5349('0x31')]);_0x1df8b0[_0x5349('0x35')]=_[_0x5349('0x36')](_0x262f62[_0x5349('0x34')],qs[_0x5349('0x37')](_0x3cad49['query']['fields']));_0x1df8b0[_0x5349('0x35')]=_0x1df8b0[_0x5349('0x35')][_0x5349('0x38')]?_0x1df8b0[_0x5349('0x35')]:_0x262f62[_0x5349('0x34')];if(!_0x3cad49[_0x5349('0x31')][_0x5349('0x39')]('nolimit')){_0x1df8b0['limit']=qs[_0x5349('0x20')](_0x3cad49['query']['limit']);_0x1df8b0[_0x5349('0x1f')]=qs['offset'](_0x3cad49[_0x5349('0x31')][_0x5349('0x1f')]);}_0x1df8b0[_0x5349('0x3a')]=qs['sort'](_0x3cad49[_0x5349('0x31')]['sort']);_0x1df8b0[_0x5349('0x3b')]=qs[_0x5349('0x33')](_[_0x5349('0x3c')](_0x3cad49['query'],_0x262f62['filters']),_0x16dda8);if(_0x3cad49['query'][_0x5349('0x3d')]){_0x1df8b0[_0x5349('0x3b')]=_[_0x5349('0x3e')](_0x1df8b0[_0x5349('0x3b')],{'$or':_[_0x5349('0x2c')](_0x16dda8,function(_0x44715c){if(_0x44715c['type']!=='VIRTUAL'){var _0x2bda71={};_0x2bda71[_0x44715c[_0x5349('0x2a')]]={'$like':'%'+_0x3cad49[_0x5349('0x31')]['filter']+'%'};return _0x2bda71;}})});}_0x1df8b0=_[_0x5349('0x3e')]({},_0x1df8b0,_0x3cad49[_0x5349('0x3f')]);var _0x30faff={'where':_0x1df8b0[_0x5349('0x3b')]};return db['JscriptyProject'][_0x5349('0x1e')](_0x30faff)['then'](function(_0x39a154){_0x10c284[_0x5349('0x1e')]=_0x39a154;if(_0x3cad49['query'][_0x5349('0x40')]){_0x1df8b0[_0x5349('0x41')]=[{'all':!![]}];}return db[_0x5349('0x2d')][_0x5349('0x42')](_0x1df8b0);})[_0x5349('0x24')](function(_0xd29178){_0x10c284[_0x5349('0x43')]=_0xd29178;return _0x10c284;})['then'](respondWithFilteredResult(_0x573ee1,_0x1df8b0))['catch'](handleError(_0x573ee1,null));};exports[_0x5349('0x44')]=function(_0x36e40f,_0x1ce8f1){var _0x41cf4d={'raw':![],'where':{'id':_0x36e40f[_0x5349('0x45')]['id']}},_0x5d589c={};_0x5d589c['model']=_['keys'](db[_0x5349('0x2d')][_0x5349('0x46')]);_0x5d589c[_0x5349('0x31')]=_[_0x5349('0x32')](_0x36e40f['query']);_0x5d589c[_0x5349('0x33')]=_[_0x5349('0x36')](_0x5d589c[_0x5349('0x34')],_0x5d589c[_0x5349('0x31')]);_0x41cf4d[_0x5349('0x35')]=_[_0x5349('0x36')](_0x5d589c[_0x5349('0x34')],qs[_0x5349('0x37')](_0x36e40f[_0x5349('0x31')][_0x5349('0x37')]));_0x41cf4d[_0x5349('0x35')]=_0x41cf4d[_0x5349('0x35')][_0x5349('0x38')]?_0x41cf4d[_0x5349('0x35')]:_0x5d589c['model'];if(_0x36e40f['query'][_0x5349('0x40')]){_0x41cf4d[_0x5349('0x41')]=[{'all':!![]}];}_0x41cf4d=_[_0x5349('0x3e')]({},_0x41cf4d,_0x36e40f[_0x5349('0x3f')]);return db[_0x5349('0x2d')][_0x5349('0x47')](_0x41cf4d)['then'](handleEntityNotFound(_0x1ce8f1,null))[_0x5349('0x24')](respondWithResult(_0x1ce8f1,null))[_0x5349('0x48')](handleError(_0x1ce8f1,null));};exports[_0x5349('0x49')]=function(_0x3652dc,_0x26d06a){return db[_0x5349('0x2d')]['create'](_0x3652dc[_0x5349('0x4a')],{})['then'](function(_0x7374d6){var _0x39c77b=_0x3652dc[_0x5349('0x4b')][_0x5349('0x26')]({'plain':!![]});if(!_0x39c77b)throw new Error(_0x5349('0x4c'));if(_0x39c77b['role']===_0x5349('0x4b')){var _0x3fca72=_0x7374d6[_0x5349('0x26')]({'plain':!![]});var _0x302aab='Projects';return db[_0x5349('0x4d')][_0x5349('0x47')]({'where':{'name':_0x302aab,'userProfileId':_0x39c77b[_0x5349('0x4e')]},'raw':!![]})[_0x5349('0x24')](function(_0x3047c5){if(_0x3047c5&&_0x3047c5[_0x5349('0x4f')]===0x0){return db[_0x5349('0x50')][_0x5349('0x49')]({'name':_0x3fca72[_0x5349('0x2a')],'resourceId':_0x3fca72['id'],'type':_0x3047c5[_0x5349('0x2a')],'sectionId':_0x3047c5['id']},{})[_0x5349('0x24')](function(){return _0x7374d6;});}else{return _0x7374d6;}})[_0x5349('0x48')](function(_0x1286a2){logger[_0x5349('0x28')](_0x5349('0x51'),_0x1286a2);throw _0x1286a2;});}return _0x7374d6;})[_0x5349('0x24')](respondWithResult(_0x26d06a,0xc9))[_0x5349('0x48')](handleError(_0x26d06a,null));};exports[_0x5349('0x52')]=function(_0x55457d,_0x45afcc){var _0x192d1d={'where':{'id':_0x55457d['params']['id']}},_0x59f481={};_0x59f481[_0x5349('0x34')]=_[_0x5349('0x32')](db[_0x5349('0x2d')][_0x5349('0x46')]);_0x192d1d[_0x5349('0x35')]=_[_0x5349('0x36')](_0x59f481[_0x5349('0x34')],qs['fields'](_0x55457d[_0x5349('0x31')][_0x5349('0x37')]));_0x192d1d[_0x5349('0x35')]=_0x192d1d['attributes']['length']?_0x192d1d[_0x5349('0x35')]:_0x59f481[_0x5349('0x34')];if(_0x55457d[_0x5349('0x31')][_0x5349('0x40')]){_0x192d1d[_0x5349('0x41')]=[{'all':!![]}];}_0x192d1d=_[_0x5349('0x3e')]({},_0x192d1d,_0x55457d[_0x5349('0x3f')]);return db[_0x5349('0x2d')]['find'](_0x192d1d)[_0x5349('0x24')](handleEntityNotFound(_0x45afcc,null))['then'](function(_0x1c1371){if(_0x1c1371){var _0x2d3a20=_0x1c1371[_0x5349('0x26')]({'plain':!![]});_0x2d3a20=qs[_0x5349('0x53')](_0x2d3a20,['id','createdAt','updatedAt']);_0x55457d['body']=_[_0x5349('0x53')](_0x55457d['body'],['id',_0x5349('0x54'),_0x5349('0x55')]);return db[_0x5349('0x2d')][_0x5349('0x49')](_[_0x5349('0x3e')](_0x2d3a20,_0x55457d[_0x5349('0x4a')]),{'include':_0x55457d['query'][_0x5349('0x40')]?[{'all':!![]}]:undefined})[_0x5349('0x24')](function(_0x16f6d3){var _0x2779fd=_0x55457d[_0x5349('0x4b')]['get']({'plain':!![]});if(!_0x2779fd)throw new Error(_0x5349('0x4c'));if(_0x2779fd['role']===_0x5349('0x4b')){var _0x48dcd1=_0x16f6d3['get']({'plain':!![]});var _0x33bb59=_0x5349('0x27');return db[_0x5349('0x4d')][_0x5349('0x47')]({'where':{'name':_0x33bb59,'userProfileId':_0x2779fd[_0x5349('0x4e')]},'raw':!![]})[_0x5349('0x24')](function(_0x266fb1){if(_0x266fb1&&_0x266fb1[_0x5349('0x4f')]===0x0){return db['UserProfileResource'][_0x5349('0x49')]({'name':_0x48dcd1[_0x5349('0x2a')],'resourceId':_0x48dcd1['id'],'type':_0x266fb1[_0x5349('0x2a')],'sectionId':_0x266fb1['id']},{})[_0x5349('0x24')](function(){return _0x16f6d3;});}else{return _0x16f6d3;}})[_0x5349('0x48')](function(_0x5c9efe){logger[_0x5349('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c9efe);throw _0x5c9efe;});}return _0x16f6d3;});}})[_0x5349('0x24')](respondWithResult(_0x45afcc,0xc9))[_0x5349('0x48')](handleError(_0x45afcc,null));};exports[_0x5349('0x23')]=function(_0x49511a,_0x9a5857){if(_0x49511a['body']['id']){delete _0x49511a[_0x5349('0x4a')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x49511a[_0x5349('0x45')]['id']}})[_0x5349('0x24')](handleEntityNotFound(_0x9a5857,null))['then'](saveUpdates(_0x49511a[_0x5349('0x4a')],null))[_0x5349('0x24')](respondWithResult(_0x9a5857,null))[_0x5349('0x48')](handleError(_0x9a5857,null));};exports['destroy']=function(_0x16ddc5,_0x247cd4){return db['JscriptyProject']['find']({'where':{'id':_0x16ddc5[_0x5349('0x45')]['id']}})['then'](handleEntityNotFound(_0x247cd4,null))['then'](removeEntity(_0x247cd4,null))['catch'](handleError(_0x247cd4,null));};exports[_0x5349('0x56')]=function(_0xffe718,_0x175d0c,_0x48a56e){var _0x253adb={'raw':!![],'where':{}};var _0xd9b996={};var _0x27271e={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0xffe718[_0x5349('0x45')]['id']}})[_0x5349('0x24')](handleEntityNotFound(_0x175d0c,null))[_0x5349('0x24')](function(_0x3a2738){if(_0x3a2738){_0xd9b996[_0x5349('0x34')]=_[_0x5349('0x32')](db[_0x5349('0x57')][_0x5349('0x46')]);_0xd9b996[_0x5349('0x31')]=_[_0x5349('0x32')](_0xffe718[_0x5349('0x31')]);_0xd9b996[_0x5349('0x33')]=_[_0x5349('0x36')](_0xd9b996[_0x5349('0x34')],_0xd9b996[_0x5349('0x31')]);_0x253adb[_0x5349('0x35')]=_[_0x5349('0x36')](_0xd9b996['model'],qs['fields'](_0xffe718[_0x5349('0x31')][_0x5349('0x37')]));_0x253adb['attributes']=_0x253adb[_0x5349('0x35')][_0x5349('0x38')]?_0x253adb[_0x5349('0x35')]:_0xd9b996['model'];if(!_0xffe718['query']['hasOwnProperty'](_0x5349('0x58'))){_0x253adb['limit']=qs[_0x5349('0x20')](_0xffe718[_0x5349('0x31')][_0x5349('0x20')]);_0x253adb[_0x5349('0x1f')]=qs[_0x5349('0x1f')](_0xffe718[_0x5349('0x31')][_0x5349('0x1f')]);}_0x253adb['order']=qs[_0x5349('0x59')](_0xffe718['query'][_0x5349('0x59')]);_0x253adb[_0x5349('0x3b')]=qs[_0x5349('0x33')](_[_0x5349('0x3c')](_0xffe718[_0x5349('0x31')],_0xd9b996[_0x5349('0x33')]));_0x253adb[_0x5349('0x3b')][_0x5349('0x5a')]=_0x3a2738['id'];if(_0xffe718['query']['filter']){_0x253adb[_0x5349('0x3b')]=_['merge'](_0x253adb['where'],{'$or':_['map'](_0x253adb[_0x5349('0x35')],function(_0x17571f){var _0x30c1c6={};_0x30c1c6[_0x17571f]={'$like':'%'+_0xffe718[_0x5349('0x31')][_0x5349('0x3d')]+'%'};return _0x30c1c6;})});}_0x253adb=_[_0x5349('0x3e')]({},_0x253adb,_0xffe718[_0x5349('0x3f')]);return db[_0x5349('0x57')]['count']({'where':_0x253adb['where']})[_0x5349('0x24')](function(_0x3a28ab){_0x27271e['count']=_0x3a28ab;if(_0xffe718[_0x5349('0x31')][_0x5349('0x40')]){_0x253adb[_0x5349('0x41')]=[{'all':!![]}];}return db[_0x5349('0x57')][_0x5349('0x42')](_0x253adb);})[_0x5349('0x24')](function(_0x5be3c9){_0x27271e[_0x5349('0x43')]=_0x5be3c9;return _0x27271e;});}})['then'](respondWithFilteredResult(_0x175d0c,_0x253adb))[_0x5349('0x48')](handleError(_0x175d0c,null));};exports[_0x5349('0x5b')]=function(_0xc071d,_0x128b71,_0x7702d2){var _0x2bea8d={'raw':!![],'where':{}};var _0x6c54bc={};var _0x570b4f={'count':0x0,'rows':[]};return db[_0x5349('0x2d')][_0x5349('0x5c')]({'where':{'id':_0xc071d[_0x5349('0x45')]['id']}})['then'](handleEntityNotFound(_0x128b71,null))[_0x5349('0x24')](function(_0x455f77){if(_0x455f77){_0x6c54bc[_0x5349('0x34')]=_['keys'](db[_0x5349('0x5d')][_0x5349('0x46')]);_0x6c54bc[_0x5349('0x31')]=_[_0x5349('0x32')](_0xc071d[_0x5349('0x31')]);_0x6c54bc[_0x5349('0x33')]=_[_0x5349('0x36')](_0x6c54bc[_0x5349('0x34')],_0x6c54bc[_0x5349('0x31')]);_0x2bea8d[_0x5349('0x35')]=_[_0x5349('0x36')](_0x6c54bc[_0x5349('0x34')],qs[_0x5349('0x37')](_0xc071d[_0x5349('0x31')]['fields']));_0x2bea8d[_0x5349('0x35')]=_0x2bea8d[_0x5349('0x35')][_0x5349('0x38')]?_0x2bea8d['attributes']:_0x6c54bc['model'];if(!_0xc071d['query'][_0x5349('0x39')](_0x5349('0x58'))){_0x2bea8d['limit']=qs['limit'](_0xc071d[_0x5349('0x31')][_0x5349('0x20')]);_0x2bea8d[_0x5349('0x1f')]=qs[_0x5349('0x1f')](_0xc071d[_0x5349('0x31')][_0x5349('0x1f')]);}_0x2bea8d[_0x5349('0x3a')]=qs[_0x5349('0x59')](_0xc071d['query']['sort']);_0x2bea8d[_0x5349('0x3b')]=qs[_0x5349('0x33')](_[_0x5349('0x3c')](_0xc071d[_0x5349('0x31')],_0x6c54bc[_0x5349('0x33')]));_0x2bea8d[_0x5349('0x3b')]['ProjectId']=_0x455f77['id'];if(_0xc071d[_0x5349('0x31')][_0x5349('0x3d')]){_0x2bea8d[_0x5349('0x3b')]=_['merge'](_0x2bea8d[_0x5349('0x3b')],{'$or':_[_0x5349('0x2c')](_0x2bea8d[_0x5349('0x35')],function(_0x4b5655){var _0x4aad16={};_0x4aad16[_0x4b5655]={'$like':'%'+_0xc071d[_0x5349('0x31')][_0x5349('0x3d')]+'%'};return _0x4aad16;})});}_0x2bea8d=_[_0x5349('0x3e')]({},_0x2bea8d,_0xc071d[_0x5349('0x3f')]);return db[_0x5349('0x5d')][_0x5349('0x1e')]({'where':_0x2bea8d['where']})[_0x5349('0x24')](function(_0x4e5745){_0x570b4f[_0x5349('0x1e')]=_0x4e5745;if(_0xc071d[_0x5349('0x31')]['includeAll']){_0x2bea8d['include']=[{'all':!![]}];}return db[_0x5349('0x5d')][_0x5349('0x42')](_0x2bea8d);})[_0x5349('0x24')](function(_0x520028){_0x570b4f[_0x5349('0x43')]=_0x520028;return _0x570b4f;});}})['then'](respondWithFilteredResult(_0x128b71,_0x2bea8d))[_0x5349('0x48')](handleError(_0x128b71,null));};function char(_0xda7ea6){return _0x5349('0x5e')===typeof _0xda7ea6?String['fromCharCode'][_0x5349('0x5f')](null,arguments):_0xda7ea6;}function needsEncapsulation(_0x415024){return!!_0x415024&&(_0x415024['toString']()[_0x5349('0x60')](char(0xd))>=0x0||_0x415024['toString']()[_0x5349('0x60')](char(0xa))>=0x0||_0x415024[_0x5349('0x61')]()[_0x5349('0x60')](char(0x2c))>=0x0||_0x415024['toString']()[_0x5349('0x60')](char(0x22))>=0x0);}function encapsulate(_0x20e3f6){var _0x21f5c9=char(0x22),_0x315223='\x5c'+char(0x22),_0x3aed99=_0x20e3f6[_0x5349('0x61')]()[_0x5349('0x62')](new RegExp(_0x21f5c9,'g'),_0x315223);return _0x21f5c9+_0x3aed99+_0x21f5c9;}exports[_0x5349('0x63')]=function(_0x182d6b,_0x5e4a78,_0x41da1d){var _0x46f3f2,_0x23d4d2;var _0x5ebddd={'where':{'ProjectId':_0x182d6b[_0x5349('0x45')]['id']}};if(_0x182d6b['query'][_0x5349('0x64')]){_0x5ebddd[_0x5349('0x3b')][_0x5349('0x65')]=JSON[_0x5349('0x66')](_0x182d6b['query'][_0x5349('0x64')]);}return db[_0x5349('0x57')][_0x5349('0x42')](_0x5ebddd)[_0x5349('0x24')](handleEntityNotFound(_0x5e4a78,null))['then'](function(_0x398142){if(_0x398142){_0x46f3f2=_0x398142;return db[_0x5349('0x67')][_0x5349('0x42')]({'where':{'SessionId':{'$in':_[_0x5349('0x2c')](_0x46f3f2,'id')},'ProjectId':_0x182d6b[_0x5349('0x45')]['id']},'order':'-createdAt'});}})[_0x5349('0x24')](handleEntityNotFound(_0x5e4a78,null))[_0x5349('0x24')](function(_0x2860e4){if(_0x2860e4){_0x23d4d2=_0x2860e4;var _0x4602b6={};for(var _0x5d7a22=0x0,_0x251dc1=_0x23d4d2[_0x5349('0x38')];_0x5d7a22<_0x251dc1;_0x5d7a22++){if(!_0x4602b6['hasOwnProperty'](_0x23d4d2[_0x5d7a22]['questionId'])){_0x4602b6[_0x23d4d2[_0x5d7a22][_0x5349('0x68')]]=needsEncapsulation(_0x23d4d2[_0x5d7a22]['question'])?encapsulate(_0x23d4d2[_0x5d7a22][_0x5349('0x69')]):_0x23d4d2[_0x5d7a22]['question'];}}var _0x188df0=[],_0xc2ec62={};for(var _0xff3420=0x0,_0x450b4d=_0x46f3f2['length'];_0xff3420<_0x450b4d;_0xff3420++){_0xc2ec62={'ProjectId':_0x182d6b[_0x5349('0x45')]['id'],'SessionId':_0x46f3f2[_0xff3420]['id'],'StartTime':moment(_0x46f3f2[_0xff3420]['starttime'])[_0x5349('0x6a')](_0x5349('0x6b'))};for(var _0x4a0ba5=0x0,_0x1c55ac=_0x23d4d2[_0x5349('0x38')];_0x4a0ba5<_0x1c55ac;_0x4a0ba5++){if(_0x23d4d2[_0x4a0ba5]['SessionId']==_0x46f3f2[_0xff3420]['id']&&_0x4602b6[_0x5349('0x39')](_0x23d4d2[_0x4a0ba5][_0x5349('0x68')])){_0xc2ec62[_0x4602b6[_0x23d4d2[_0x4a0ba5][_0x5349('0x68')]]]=_0x23d4d2[_0x4a0ba5]['answer'];}}for(var _0x501c62 in _0x4602b6){if(!_0xc2ec62['hasOwnProperty'](_0x4602b6[_0x501c62])){_0xc2ec62[_0x4602b6[_0x501c62]]=null;}}_0x188df0['push'](_0xc2ec62);}return _0x188df0;}})[_0x5349('0x24')](function(_0x8abf04){if(!_[_0x5349('0x6c')](_0x8abf04)){var _0x40bf2c=toCsv(_0x8abf04);var _0x1a6f89=Date[_0x5349('0x6d')]();fs[_0x5349('0x6e')](util[_0x5349('0x6a')](_0x5349('0x6f'),_0x182d6b['params']['id'],_0x1a6f89),_0x40bf2c);_0x5e4a78[_0x5349('0x70')](_0x5349('0x71'),'attachment;\x20filename='+util[_0x5349('0x6a')](_0x5349('0x72'),_0x182d6b['params']['id'],_0x1a6f89));_0x5e4a78[_0x5349('0x70')](_0x5349('0x73'),_0x5349('0x74'));return _0x5e4a78[_0x5349('0x75')](util[_0x5349('0x6a')](_0x5349('0x6f'),_0x182d6b[_0x5349('0x45')]['id'],_0x1a6f89));}else{return _0x5e4a78['sendStatus'](0xcc);}})[_0x5349('0x48')](handleError(_0x5e4a78,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 118c931..94c776a 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 _0x84ab=['request-promise','path','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','lodash','util','../../config/logger','api','moment'];(function(_0x2f7a51,_0x5c01cc){var _0x52ea5d=function(_0x581f00){while(--_0x581f00){_0x2f7a51['push'](_0x2f7a51['shift']());}};_0x52ea5d(++_0x5c01cc);}(_0x84ab,0x12f));var _0xb84a=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x84ab[_0x62c958];return _0x57ec61;};'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':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39b3=['define','JscriptyProject','jscripty_projects','lodash','api','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x42a892,_0x59c528){var _0x504383=function(_0x77d3db){while(--_0x77d3db){_0x42a892['push'](_0x42a892['shift']());}};_0x504383(++_0x59c528);}(_0x39b3,0xc9));var _0x339b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x39b3[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x339b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x339b('0x1'));var moment=require('moment');var BPromise=require(_0x339b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x339b('0x3'));var rimraf=require(_0x339b('0x4'));var config=require(_0x339b('0x5'));var attributes=require(_0x339b('0x6'));module[_0x339b('0x7')]=function(_0x3021b1,_0x2394e2){return _0x3021b1[_0x339b('0x8')](_0x339b('0x9'),attributes,{'tableName':_0x339b('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 8610deb..c5d751c 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 _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3cc3ea,_0x5cf8a8){var _0x1bbb4a=function(_0x3415e4){while(--_0x3415e4){_0x3cc3ea['push'](_0x3cc3ea['shift']());}};_0x1bbb4a(++_0x5cf8a8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x2274e2,_0x3b70b2){var _0x2c73b4=function(_0x98b116){while(--_0x98b116){_0x2274e2['push'](_0x2274e2['shift']());}};_0x2c73b4(++_0x3b70b2);}(_0xe706,0xa3));var _0x6e70=function(_0x9fdd53,_0xd7b5c0){_0x9fdd53=_0x9fdd53-0x0;var _0x4ed380=_0xe706[_0x9fdd53];return _0x4ed380;};'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']('JscriptyProject,\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']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index e55bc19..cfe477c 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 _0x5437=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x1c14ae,_0x25ecce){var _0x24c7cf=function(_0x167c24){while(--_0x167c24){_0x1c14ae['push'](_0x1c14ae['shift']());}};_0x24c7cf(++_0x25ecce);}(_0x5437,0x191));var _0x7543=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x5437[_0x32b542];return _0x554d54;};'use strict';var multer=require(_0x7543('0x0'));var util=require(_0x7543('0x1'));var path=require(_0x7543('0x2'));var timeout=require(_0x7543('0x3'));var express=require(_0x7543('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7543('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7543('0x6'));var controller=require(_0x7543('0x7'));router[_0x7543('0x8')]('/',auth[_0x7543('0x9')](),controller[_0x7543('0xa')]);router[_0x7543('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7543('0xb')]);router[_0x7543('0x8')](_0x7543('0xc'),auth[_0x7543('0x9')](),controller[_0x7543('0xd')]);router[_0x7543('0xe')]('/',auth[_0x7543('0x9')](),controller[_0x7543('0xf')]);router[_0x7543('0x10')](_0x7543('0xc'),auth[_0x7543('0x9')](),controller['update']);router[_0x7543('0x11')](_0x7543('0xc'),auth[_0x7543('0x9')](),controller[_0x7543('0x12')]);module[_0x7543('0x13')]=router; \ No newline at end of file +var _0xb8b8=['../../components/interaction/service','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1c135a,_0x447772){var _0x4e594b=function(_0x4d14b0){while(--_0x4d14b0){_0x1c135a['push'](_0x1c135a['shift']());}};_0x4e594b(++_0x447772);}(_0xb8b8,0xa0));var _0x8b8b=function(_0x2ee046,_0x15c5a0){_0x2ee046=_0x2ee046-0x0;var _0x1576e2=_0xb8b8[_0x2ee046];return _0x1576e2;};'use strict';var multer=require(_0x8b8b('0x0'));var util=require(_0x8b8b('0x1'));var path=require(_0x8b8b('0x2'));var timeout=require(_0x8b8b('0x3'));var express=require(_0x8b8b('0x4'));var router=express[_0x8b8b('0x5')]();var fs_extra=require(_0x8b8b('0x6'));var auth=require(_0x8b8b('0x7'));var interaction=require(_0x8b8b('0x8'));var config=require('../../config/environment');var controller=require(_0x8b8b('0x9'));router['get']('/',auth[_0x8b8b('0xa')](),controller[_0x8b8b('0xb')]);router[_0x8b8b('0xc')](_0x8b8b('0xd'),auth[_0x8b8b('0xa')](),controller[_0x8b8b('0xe')]);router[_0x8b8b('0xc')](_0x8b8b('0xf'),auth[_0x8b8b('0xa')](),controller[_0x8b8b('0x10')]);router[_0x8b8b('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8b8b('0x12')](_0x8b8b('0xf'),auth[_0x8b8b('0xa')](),controller[_0x8b8b('0x13')]);router[_0x8b8b('0x14')](_0x8b8b('0xf'),auth[_0x8b8b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 40186ba..df5cb88 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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x2dbd6b,_0x450b93){_0x2dbd6b=_0x2dbd6b-0x0;var _0x498f1b=_0x7a54[_0x2dbd6b];return _0x498f1b;};'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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7a54,0x106));var _0x47a5=function(_0x74533a,_0x41c3c5){_0x74533a=_0x74533a-0x0;var _0x1cf02c=_0x7a54[_0x74533a];return _0x1cf02c;};'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 b5c5fbf..b5d8e94 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 _0xdf28=['catch','create','body','describe','eml-format','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','merge','map','type','filter','options','includeAll','include','findAll','rows','params','find'];(function(_0x5ce2e3,_0x3dc503){var _0x3b53ab=function(_0x1efe66){while(--_0x1efe66){_0x5ce2e3['push'](_0x5ce2e3['shift']());}};_0x3b53ab(++_0x3dc503);}(_0xdf28,0x124));var _0x8df2=function(_0x19cee7,_0x562ecb){_0x19cee7=_0x19cee7-0x0;var _0x45657b=_0xdf28[_0x19cee7];return _0x45657b;};'use strict';var emlformat=require(_0x8df2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8df2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8df2('0x2'));var BPromise=require(_0x8df2('0x3'));var Mustache=require('mustache');var util=require(_0x8df2('0x4'));var path=require('path');var sox=require(_0x8df2('0x5'));var csv=require(_0x8df2('0x6'));var ejs=require(_0x8df2('0x7'));var fs=require('fs');var fs_extra=require(_0x8df2('0x8'));var _=require(_0x8df2('0x9'));var squel=require(_0x8df2('0xa'));var crypto=require('crypto');var jsforce=require(_0x8df2('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8df2('0xc'));var Papa=require(_0x8df2('0xd'));var Redis=require('ioredis');var authService=require(_0x8df2('0xe'));var qs=require(_0x8df2('0xf'));var as=require(_0x8df2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8df2('0x11'))(_0x8df2('0x12'));var utils=require('../../config/utils');var config=require(_0x8df2('0x13'));var licenseUtil=require(_0x8df2('0x14'));var db=require(_0x8df2('0x15'))['db'];function respondWithStatusCode(_0x402d0d,_0x229c84){_0x229c84=_0x229c84||0xcc;return function(_0x309b56){if(_0x309b56){return _0x402d0d[_0x8df2('0x16')](_0x229c84);}return _0x402d0d['status'](_0x229c84)[_0x8df2('0x17')]();};}function respondWithResult(_0x383fcb,_0x2192dc){_0x2192dc=_0x2192dc||0xc8;return function(_0x2e7116){if(_0x2e7116){return _0x383fcb[_0x8df2('0x18')](_0x2192dc)[_0x8df2('0x19')](_0x2e7116);}};}function respondWithFilteredResult(_0x2b594d,_0x222c3e){return function(_0x76817e){if(_0x76817e){var _0x47cfaa=typeof _0x222c3e[_0x8df2('0x1a')]===_0x8df2('0x1b')&&typeof _0x222c3e['limit']===_0x8df2('0x1b');var _0x5b2b19=_0x76817e['count'];var _0x2c7c31=_0x47cfaa?0x0:_0x222c3e[_0x8df2('0x1a')];var _0x4a2f03=_0x47cfaa?_0x76817e[_0x8df2('0x1c')]:_0x222c3e[_0x8df2('0x1a')]+_0x222c3e['limit'];var _0x77884d;if(_0x4a2f03>=_0x5b2b19){_0x4a2f03=_0x5b2b19;_0x77884d=0xc8;}else{_0x77884d=0xce;}_0x2b594d[_0x8df2('0x18')](_0x77884d);return _0x2b594d[_0x8df2('0x1d')](_0x8df2('0x1e'),_0x2c7c31+'-'+_0x4a2f03+'/'+_0x5b2b19)['json'](_0x76817e);}return null;};}function patchUpdates(_0x52479f){return function(_0x22af5a){try{jsonpatch[_0x8df2('0x1f')](_0x22af5a,_0x52479f,!![]);}catch(_0x2cf28f){return BPromise[_0x8df2('0x20')](_0x2cf28f);}return _0x22af5a[_0x8df2('0x21')]();};}function saveUpdates(_0x29b993,_0xbfb403){return function(_0x524bbb){if(_0x524bbb){return _0x524bbb[_0x8df2('0x22')](_0x29b993)[_0x8df2('0x23')](function(_0xf9bb0a){return _0xf9bb0a;});}return null;};}function removeEntity(_0x1ebbcb,_0xa71b3c){return function(_0x3f7270){if(_0x3f7270){return _0x3f7270[_0x8df2('0x24')]()['then'](function(){_0x1ebbcb[_0x8df2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f46be,_0x153c0f){return function(_0x4f6cb6){if(!_0x4f6cb6){_0x4f46be[_0x8df2('0x16')](0x194);}return _0x4f6cb6;};}function handleError(_0x1044b7,_0x105408){_0x105408=_0x105408||0x1f4;return function(_0x23aa44){logger[_0x8df2('0x25')](_0x23aa44['stack']);if(_0x23aa44[_0x8df2('0x26')]){delete _0x23aa44[_0x8df2('0x26')];}_0x1044b7[_0x8df2('0x18')](_0x105408)[_0x8df2('0x27')](_0x23aa44);};}exports[_0x8df2('0x28')]=function(_0x2888cd,_0x58d6a5){var _0x5e84ac={},_0x527218={},_0x22858b={'count':0x0,'rows':[]};var _0xa9940e=_['map'](db[_0x8df2('0x29')][_0x8df2('0x2a')],function(_0x39579f){return{'name':_0x39579f[_0x8df2('0x2b')],'type':_0x39579f['type']['key']};});_0x527218[_0x8df2('0x2c')]=_['map'](_0xa9940e,_0x8df2('0x26'));_0x527218[_0x8df2('0x2d')]=_[_0x8df2('0x2e')](_0x2888cd[_0x8df2('0x2d')]);_0x527218[_0x8df2('0x2f')]=_[_0x8df2('0x30')](_0x527218[_0x8df2('0x2c')],_0x527218['query']);_0x5e84ac[_0x8df2('0x31')]=_[_0x8df2('0x30')](_0x527218[_0x8df2('0x2c')],qs['fields'](_0x2888cd['query'][_0x8df2('0x32')]));_0x5e84ac[_0x8df2('0x31')]=_0x5e84ac[_0x8df2('0x31')][_0x8df2('0x33')]?_0x5e84ac[_0x8df2('0x31')]:_0x527218[_0x8df2('0x2c')];if(!_0x2888cd[_0x8df2('0x2d')]['hasOwnProperty'](_0x8df2('0x34'))){_0x5e84ac[_0x8df2('0x35')]=qs[_0x8df2('0x35')](_0x2888cd[_0x8df2('0x2d')][_0x8df2('0x35')]);_0x5e84ac[_0x8df2('0x1a')]=qs[_0x8df2('0x1a')](_0x2888cd[_0x8df2('0x2d')][_0x8df2('0x1a')]);}_0x5e84ac[_0x8df2('0x36')]=qs[_0x8df2('0x37')](_0x2888cd['query'][_0x8df2('0x37')]);_0x5e84ac[_0x8df2('0x38')]=qs[_0x8df2('0x2f')](_['pick'](_0x2888cd[_0x8df2('0x2d')],_0x527218[_0x8df2('0x2f')]),_0xa9940e);if(_0x2888cd['query']['filter']){_0x5e84ac[_0x8df2('0x38')]=_[_0x8df2('0x39')](_0x5e84ac[_0x8df2('0x38')],{'$or':_[_0x8df2('0x3a')](_0xa9940e,function(_0x3a25ca){if(_0x3a25ca[_0x8df2('0x3b')]!=='VIRTUAL'){var _0x34ac8b={};_0x34ac8b[_0x3a25ca[_0x8df2('0x26')]]={'$like':'%'+_0x2888cd[_0x8df2('0x2d')][_0x8df2('0x3c')]+'%'};return _0x34ac8b;}})});}_0x5e84ac=_[_0x8df2('0x39')]({},_0x5e84ac,_0x2888cd[_0x8df2('0x3d')]);var _0x305aa7={'where':_0x5e84ac[_0x8df2('0x38')]};return db[_0x8df2('0x29')][_0x8df2('0x1c')](_0x305aa7)[_0x8df2('0x23')](function(_0x58fd17){_0x22858b[_0x8df2('0x1c')]=_0x58fd17;if(_0x2888cd['query'][_0x8df2('0x3e')]){_0x5e84ac[_0x8df2('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x8df2('0x40')](_0x5e84ac);})[_0x8df2('0x23')](function(_0x428312){_0x22858b[_0x8df2('0x41')]=_0x428312;return _0x22858b;})[_0x8df2('0x23')](respondWithFilteredResult(_0x58d6a5,_0x5e84ac))['catch'](handleError(_0x58d6a5,null));};exports['show']=function(_0x39d036,_0x21c00f){var _0x5ccad4={'raw':!![],'where':{'id':_0x39d036[_0x8df2('0x42')]['id']}},_0x3ecdd4={};_0x3ecdd4[_0x8df2('0x2c')]=_[_0x8df2('0x2e')](db[_0x8df2('0x29')]['rawAttributes']);_0x3ecdd4['query']=_['keys'](_0x39d036[_0x8df2('0x2d')]);_0x3ecdd4[_0x8df2('0x2f')]=_[_0x8df2('0x30')](_0x3ecdd4[_0x8df2('0x2c')],_0x3ecdd4[_0x8df2('0x2d')]);_0x5ccad4['attributes']=_[_0x8df2('0x30')](_0x3ecdd4[_0x8df2('0x2c')],qs[_0x8df2('0x32')](_0x39d036['query'][_0x8df2('0x32')]));_0x5ccad4[_0x8df2('0x31')]=_0x5ccad4['attributes'][_0x8df2('0x33')]?_0x5ccad4['attributes']:_0x3ecdd4[_0x8df2('0x2c')];if(_0x39d036[_0x8df2('0x2d')][_0x8df2('0x3e')]){_0x5ccad4['include']=[{'all':!![]}];}_0x5ccad4=_['merge']({},_0x5ccad4,_0x39d036['options']);return db[_0x8df2('0x29')][_0x8df2('0x43')](_0x5ccad4)['then'](handleEntityNotFound(_0x21c00f,null))['then'](respondWithResult(_0x21c00f,null))[_0x8df2('0x44')](handleError(_0x21c00f,null));};exports[_0x8df2('0x45')]=function(_0x3f11cd,_0x10938a){return db[_0x8df2('0x29')][_0x8df2('0x45')](_0x3f11cd[_0x8df2('0x46')],{})[_0x8df2('0x23')](respondWithResult(_0x10938a,0xc9))[_0x8df2('0x44')](handleError(_0x10938a,null));};exports[_0x8df2('0x22')]=function(_0xfb74cf,_0x2b70f9){if(_0xfb74cf[_0x8df2('0x46')]['id']){delete _0xfb74cf['body']['id'];}return db[_0x8df2('0x29')]['find']({'where':{'id':_0xfb74cf['params']['id']}})[_0x8df2('0x23')](handleEntityNotFound(_0x2b70f9,null))[_0x8df2('0x23')](saveUpdates(_0xfb74cf[_0x8df2('0x46')],null))[_0x8df2('0x23')](respondWithResult(_0x2b70f9,null))[_0x8df2('0x44')](handleError(_0x2b70f9,null));};exports[_0x8df2('0x24')]=function(_0x5d74e1,_0x409cea){return db[_0x8df2('0x29')]['find']({'where':{'id':_0x5d74e1[_0x8df2('0x42')]['id']}})[_0x8df2('0x23')](handleEntityNotFound(_0x409cea,null))[_0x8df2('0x23')](removeEntity(_0x409cea,null))[_0x8df2('0x44')](handleError(_0x409cea,null));};exports[_0x8df2('0x47')]=function(_0x55ad09,_0x230e9f){return db[_0x8df2('0x29')][_0x8df2('0x47')]()['then'](respondWithResult(_0x230e9f,null))['catch'](handleError(_0x230e9f,null));}; \ No newline at end of file +var _0x247a=['stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','body','params','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','error'];(function(_0x3bfdde,_0x306be4){var _0x3f752a=function(_0x3b6751){while(--_0x3b6751){_0x3bfdde['push'](_0x3bfdde['shift']());}};_0x3f752a(++_0x306be4);}(_0x247a,0x14b));var _0xa247=function(_0x4cfaca,_0x477428){_0x4cfaca=_0x4cfaca-0x0;var _0x33d40f=_0x247a[_0x4cfaca];return _0x33d40f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa247('0x0'));var zipdir=require(_0xa247('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa247('0x2'));var moment=require(_0xa247('0x3'));var BPromise=require(_0xa247('0x4'));var Mustache=require(_0xa247('0x5'));var util=require(_0xa247('0x6'));var path=require(_0xa247('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa247('0x8'));var fs=require('fs');var fs_extra=require(_0xa247('0x9'));var _=require(_0xa247('0xa'));var squel=require(_0xa247('0xb'));var crypto=require(_0xa247('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa247('0xd'));var toCsv=require(_0xa247('0xe'));var querystring=require(_0xa247('0xf'));var Papa=require(_0xa247('0x10'));var Redis=require('ioredis');var authService=require(_0xa247('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa247('0x12'));var hardwareService=require(_0xa247('0x13'));var logger=require('../../config/logger')(_0xa247('0x14'));var utils=require(_0xa247('0x15'));var config=require(_0xa247('0x16'));var licenseUtil=require(_0xa247('0x17'));var db=require(_0xa247('0x18'))['db'];function respondWithStatusCode(_0x3f7d4,_0x2c0333){_0x2c0333=_0x2c0333||0xcc;return function(_0x59a172){if(_0x59a172){return _0x3f7d4[_0xa247('0x19')](_0x2c0333);}return _0x3f7d4[_0xa247('0x1a')](_0x2c0333)[_0xa247('0x1b')]();};}function respondWithResult(_0x278410,_0x1ec4a8){_0x1ec4a8=_0x1ec4a8||0xc8;return function(_0xa6e589){if(_0xa6e589){return _0x278410[_0xa247('0x1a')](_0x1ec4a8)['json'](_0xa6e589);}};}function respondWithFilteredResult(_0x59371c,_0x572616){return function(_0x4286ab){if(_0x4286ab){var _0x56770c=typeof _0x572616['offset']===_0xa247('0x1c')&&typeof _0x572616[_0xa247('0x1d')]===_0xa247('0x1c');var _0x1f594a=_0x4286ab[_0xa247('0x1e')];var _0x412d78=_0x56770c?0x0:_0x572616[_0xa247('0x1f')];var _0x45697a=_0x56770c?_0x4286ab[_0xa247('0x1e')]:_0x572616['offset']+_0x572616['limit'];var _0x43db1f;if(_0x45697a>=_0x1f594a){_0x45697a=_0x1f594a;_0x43db1f=0xc8;}else{_0x43db1f=0xce;}_0x59371c['status'](_0x43db1f);return _0x59371c['set'](_0xa247('0x20'),_0x412d78+'-'+_0x45697a+'/'+_0x1f594a)[_0xa247('0x21')](_0x4286ab);}return null;};}function patchUpdates(_0x5b0d02){return function(_0x2455e8){try{jsonpatch[_0xa247('0x22')](_0x2455e8,_0x5b0d02,!![]);}catch(_0x3bd727){return BPromise['reject'](_0x3bd727);}return _0x2455e8[_0xa247('0x23')]();};}function saveUpdates(_0x4be5ca,_0x115c86){return function(_0xcc19b8){if(_0xcc19b8){return _0xcc19b8[_0xa247('0x24')](_0x4be5ca)[_0xa247('0x25')](function(_0x1f823d){return _0x1f823d;});}return null;};}function removeEntity(_0x161c76,_0x36a2e8){return function(_0x3d2bcd){if(_0x3d2bcd){return _0x3d2bcd['destroy']()[_0xa247('0x25')](function(){_0x161c76[_0xa247('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f6a76,_0x41c378){return function(_0x553b57){if(!_0x553b57){_0x3f6a76[_0xa247('0x19')](0x194);}return _0x553b57;};}function handleError(_0xc7ba87,_0x4a3b6e){_0x4a3b6e=_0x4a3b6e||0x1f4;return function(_0x2721df){logger[_0xa247('0x26')](_0x2721df[_0xa247('0x27')]);if(_0x2721df[_0xa247('0x28')]){delete _0x2721df[_0xa247('0x28')];}_0xc7ba87['status'](_0x4a3b6e)[_0xa247('0x29')](_0x2721df);};}exports['index']=function(_0x140990,_0x5043e8){var _0x4fe876={},_0x4366b8={},_0x437eba={'count':0x0,'rows':[]};var _0x5c1f72=_[_0xa247('0x2a')](db[_0xa247('0x2b')][_0xa247('0x2c')],function(_0xe5ec8e){return{'name':_0xe5ec8e[_0xa247('0x2d')],'type':_0xe5ec8e[_0xa247('0x2e')][_0xa247('0x2f')]};});_0x4366b8[_0xa247('0x30')]=_[_0xa247('0x2a')](_0x5c1f72,'name');_0x4366b8[_0xa247('0x31')]=_[_0xa247('0x32')](_0x140990[_0xa247('0x31')]);_0x4366b8[_0xa247('0x33')]=_[_0xa247('0x34')](_0x4366b8[_0xa247('0x30')],_0x4366b8[_0xa247('0x31')]);_0x4fe876[_0xa247('0x35')]=_[_0xa247('0x34')](_0x4366b8[_0xa247('0x30')],qs[_0xa247('0x36')](_0x140990[_0xa247('0x31')][_0xa247('0x36')]));_0x4fe876['attributes']=_0x4fe876[_0xa247('0x35')]['length']?_0x4fe876[_0xa247('0x35')]:_0x4366b8[_0xa247('0x30')];if(!_0x140990[_0xa247('0x31')][_0xa247('0x37')](_0xa247('0x38'))){_0x4fe876[_0xa247('0x1d')]=qs['limit'](_0x140990['query']['limit']);_0x4fe876['offset']=qs[_0xa247('0x1f')](_0x140990[_0xa247('0x31')][_0xa247('0x1f')]);}_0x4fe876['order']=qs[_0xa247('0x39')](_0x140990[_0xa247('0x31')][_0xa247('0x39')]);_0x4fe876[_0xa247('0x3a')]=qs[_0xa247('0x33')](_['pick'](_0x140990[_0xa247('0x31')],_0x4366b8[_0xa247('0x33')]),_0x5c1f72);if(_0x140990[_0xa247('0x31')][_0xa247('0x3b')]){_0x4fe876[_0xa247('0x3a')]=_[_0xa247('0x3c')](_0x4fe876[_0xa247('0x3a')],{'$or':_['map'](_0x5c1f72,function(_0x543a49){if(_0x543a49[_0xa247('0x2e')]!==_0xa247('0x3d')){var _0x2cf382={};_0x2cf382[_0x543a49['name']]={'$like':'%'+_0x140990[_0xa247('0x31')][_0xa247('0x3b')]+'%'};return _0x2cf382;}})});}_0x4fe876=_[_0xa247('0x3c')]({},_0x4fe876,_0x140990[_0xa247('0x3e')]);var _0x52db19={'where':_0x4fe876['where']};return db['JscriptyQuestionReport'][_0xa247('0x1e')](_0x52db19)['then'](function(_0x20fe4e){_0x437eba[_0xa247('0x1e')]=_0x20fe4e;if(_0x140990[_0xa247('0x31')][_0xa247('0x3f')]){_0x4fe876[_0xa247('0x40')]=[{'all':!![]}];}return db[_0xa247('0x2b')][_0xa247('0x41')](_0x4fe876);})['then'](function(_0x49eef0){_0x437eba[_0xa247('0x42')]=_0x49eef0;return _0x437eba;})['then'](respondWithFilteredResult(_0x5043e8,_0x4fe876))['catch'](handleError(_0x5043e8,null));};exports['show']=function(_0x18e46b,_0x2baecb){var _0x1a3c42={'raw':!![],'where':{'id':_0x18e46b['params']['id']}},_0x38ddd8={};_0x38ddd8['model']=_[_0xa247('0x32')](db[_0xa247('0x2b')][_0xa247('0x2c')]);_0x38ddd8['query']=_['keys'](_0x18e46b[_0xa247('0x31')]);_0x38ddd8['filters']=_[_0xa247('0x34')](_0x38ddd8[_0xa247('0x30')],_0x38ddd8[_0xa247('0x31')]);_0x1a3c42[_0xa247('0x35')]=_[_0xa247('0x34')](_0x38ddd8[_0xa247('0x30')],qs[_0xa247('0x36')](_0x18e46b[_0xa247('0x31')][_0xa247('0x36')]));_0x1a3c42[_0xa247('0x35')]=_0x1a3c42[_0xa247('0x35')]['length']?_0x1a3c42[_0xa247('0x35')]:_0x38ddd8[_0xa247('0x30')];if(_0x18e46b[_0xa247('0x31')]['includeAll']){_0x1a3c42[_0xa247('0x40')]=[{'all':!![]}];}_0x1a3c42=_[_0xa247('0x3c')]({},_0x1a3c42,_0x18e46b[_0xa247('0x3e')]);return db[_0xa247('0x2b')][_0xa247('0x43')](_0x1a3c42)[_0xa247('0x25')](handleEntityNotFound(_0x2baecb,null))[_0xa247('0x25')](respondWithResult(_0x2baecb,null))[_0xa247('0x44')](handleError(_0x2baecb,null));};exports[_0xa247('0x45')]=function(_0x52fb5d,_0x160495){return db['JscriptyQuestionReport'][_0xa247('0x45')](_0x52fb5d[_0xa247('0x46')],{})[_0xa247('0x25')](respondWithResult(_0x160495,0xc9))['catch'](handleError(_0x160495,null));};exports['update']=function(_0x5b2bc4,_0x5c9313){if(_0x5b2bc4[_0xa247('0x46')]['id']){delete _0x5b2bc4[_0xa247('0x46')]['id'];}return db[_0xa247('0x2b')][_0xa247('0x43')]({'where':{'id':_0x5b2bc4[_0xa247('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c9313,null))[_0xa247('0x25')](saveUpdates(_0x5b2bc4[_0xa247('0x46')],null))[_0xa247('0x25')](respondWithResult(_0x5c9313,null))[_0xa247('0x44')](handleError(_0x5c9313,null));};exports[_0xa247('0x48')]=function(_0x18cc1c,_0x226bee){return db[_0xa247('0x2b')]['find']({'where':{'id':_0x18cc1c[_0xa247('0x47')]['id']}})[_0xa247('0x25')](handleEntityNotFound(_0x226bee,null))[_0xa247('0x25')](removeEntity(_0x226bee,null))['catch'](handleError(_0x226bee,null));};exports[_0xa247('0x49')]=function(_0x18a1f4,_0x450403){return db[_0xa247('0x2b')][_0xa247('0x49')]()[_0xa247('0x25')](respondWithResult(_0x450403,null))[_0xa247('0x44')](handleError(_0x450403,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 29237c2..14713e9 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 _0x89fb=['define','JscriptyQuestionReport','report_jscripty_questions','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x51e07a,_0x27c783){var _0x34e9de=function(_0xc65c6){while(--_0xc65c6){_0x51e07a['push'](_0x51e07a['shift']());}};_0x34e9de(++_0x27c783);}(_0x89fb,0x6b));var _0xb89f=function(_0x495071,_0x223153){_0x495071=_0x495071-0x0;var _0x4f6153=_0x89fb[_0x495071];return _0x4f6153;};'use strict';var _=require('lodash');var util=require(_0xb89f('0x0'));var logger=require('../../config/logger')(_0xb89f('0x1'));var moment=require(_0xb89f('0x2'));var BPromise=require(_0xb89f('0x3'));var rp=require(_0xb89f('0x4'));var fs=require('fs');var path=require(_0xb89f('0x5'));var rimraf=require(_0xb89f('0x6'));var config=require(_0xb89f('0x7'));var attributes=require(_0xb89f('0x8'));module[_0xb89f('0x9')]=function(_0x3724b4,_0x17a187){return _0x3724b4[_0xb89f('0xa')](_0xb89f('0xb'),attributes,{'tableName':_0xb89f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7348=['path','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x495ca4,_0x24e8b4){var _0x5b734d=function(_0x473de2){while(--_0x473de2){_0x495ca4['push'](_0x495ca4['shift']());}};_0x5b734d(++_0x24e8b4);}(_0x7348,0x171));var _0x8734=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7348[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x8734('0x0'));var logger=require(_0x8734('0x1'))('api');var moment=require(_0x8734('0x2'));var BPromise=require(_0x8734('0x3'));var rp=require(_0x8734('0x4'));var fs=require('fs');var path=require(_0x8734('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8734('0x6'));module[_0x8734('0x7')]=function(_0x33b8ac,_0x13657c){return _0x33b8ac[_0x8734('0x8')](_0x8734('0x9'),attributes,{'tableName':_0x8734('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 6d6f9b9..e1fb95b 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 _0x6754=['../../config/utils','rpc','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x282d1b,_0x25287c){var _0x555e8e=function(_0x153efe){while(--_0x153efe){_0x282d1b['push'](_0x282d1b['shift']());}};_0x555e8e(++_0x25287c);}(_0x6754,0x18a));var _0x4675=function(_0x2c08bc,_0x14e814){_0x2c08bc=_0x2c08bc-0x0;var _0x1a8df2=_0x6754[_0x2c08bc];return _0x1a8df2;};'use strict';var _=require(_0x4675('0x0'));var util=require(_0x4675('0x1'));var moment=require(_0x4675('0x2'));var BPromise=require(_0x4675('0x3'));var rs=require(_0x4675('0x4'));var fs=require('fs');var Redis=require(_0x4675('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4675('0x6'));var logger=require('../../config/logger')(_0x4675('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4675('0x8')][_0x4675('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22f88b,_0xb36469,_0x1fec34){return new BPromise(function(_0x1be7b2,_0x4ab7b5){return client[_0x4675('0xa')](_0x22f88b,_0x1fec34)[_0x4675('0xb')](function(_0x439677){logger[_0x4675('0xc')](_0x4675('0xd'),_0xb36469,_0x4675('0xe'));logger['debug'](_0x4675('0xf'),_0xb36469,_0x4675('0xe'),JSON['stringify'](_0x439677));if(_0x439677['error']){if(_0x439677[_0x4675('0x10')][_0x4675('0x11')]===0x1f4){logger[_0x4675('0x10')](_0x4675('0xd'),_0xb36469,_0x439677[_0x4675('0x10')][_0x4675('0x12')]);return _0x4ab7b5(_0x439677[_0x4675('0x10')]['message']);}logger[_0x4675('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xb36469,_0x439677[_0x4675('0x10')]['message']);return _0x1be7b2(_0x439677['error']['message']);}else{logger[_0x4675('0xc')](_0x4675('0xd'),_0xb36469,_0x4675('0xe'));_0x1be7b2(_0x439677[_0x4675('0x13')][_0x4675('0x12')]);}})['catch'](function(_0x4a9bfe){logger[_0x4675('0x10')](_0x4675('0xd'),_0xb36469,_0x4a9bfe);_0x4ab7b5(_0x4a9bfe);});});} \ No newline at end of file +var _0x300f=['request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x32bcbd,_0x8dcabe){var _0x490e25=function(_0x561540){while(--_0x561540){_0x32bcbd['push'](_0x32bcbd['shift']());}};_0x490e25(++_0x8dcabe);}(_0x300f,0xa6));var _0xf300=function(_0x402f9c,_0x2fe940){_0x402f9c=_0x402f9c-0x0;var _0x2ecedc=_0x300f[_0x402f9c];return _0x2ecedc;};'use strict';var _=require(_0xf300('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf300('0x1'));var rs=require(_0xf300('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf300('0x3'))['db'];var utils=require(_0xf300('0x4'));var logger=require('../../config/logger')(_0xf300('0x5'));var config=require(_0xf300('0x6'));var jayson=require(_0xf300('0x7'));var client=jayson[_0xf300('0x8')][_0xf300('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc487d9,_0x1dcbd4,_0x4b8d15){return new BPromise(function(_0x119136,_0x12c128){return client[_0xf300('0xa')](_0xc487d9,_0x4b8d15)[_0xf300('0xb')](function(_0x352e1c){logger[_0xf300('0xc')](_0xf300('0xd'),_0x1dcbd4,_0xf300('0xe'));logger[_0xf300('0xf')](_0xf300('0x10'),_0x1dcbd4,'request\x20sent',JSON[_0xf300('0x11')](_0x352e1c));if(_0x352e1c[_0xf300('0x12')]){if(_0x352e1c[_0xf300('0x12')][_0xf300('0x13')]===0x1f4){logger[_0xf300('0x12')](_0xf300('0xd'),_0x1dcbd4,_0x352e1c['error'][_0xf300('0x14')]);return _0x12c128(_0x352e1c[_0xf300('0x12')]['message']);}logger[_0xf300('0x12')](_0xf300('0xd'),_0x1dcbd4,_0x352e1c[_0xf300('0x12')]['message']);return _0x119136(_0x352e1c[_0xf300('0x12')][_0xf300('0x14')]);}else{logger[_0xf300('0xc')](_0xf300('0xd'),_0x1dcbd4,_0xf300('0xe'));_0x119136(_0x352e1c['result'][_0xf300('0x14')]);}})[_0xf300('0x15')](function(_0x47604d){logger[_0xf300('0x12')](_0xf300('0xd'),_0x1dcbd4,_0x47604d);_0x12c128(_0x47604d);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 6ef0839..a149f6d 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 _0x697e=['multer','util','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','delete'];(function(_0x5827d3,_0x309974){var _0x19059a=function(_0x405a88){while(--_0x405a88){_0x5827d3['push'](_0x5827d3['shift']());}};_0x19059a(++_0x309974);}(_0x697e,0x1b0));var _0xe697=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x697e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe697('0x0'));var util=require(_0xe697('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe697('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe697('0x3'));var config=require(_0xe697('0x4'));var controller=require(_0xe697('0x5'));router[_0xe697('0x6')]('/',auth[_0xe697('0x7')](),controller['index']);router[_0xe697('0x6')](_0xe697('0x8'),auth[_0xe697('0x7')](),controller[_0xe697('0x9')]);router[_0xe697('0x6')](_0xe697('0xa'),auth['isAuthenticated'](),controller[_0xe697('0xb')]);router[_0xe697('0x6')](_0xe697('0xc'),auth['isAuthenticated'](),controller[_0xe697('0xd')]);router[_0xe697('0xe')]('/',auth['isAuthenticated'](),controller[_0xe697('0xf')]);router[_0xe697('0x10')](_0xe697('0xa'),auth[_0xe697('0x7')](),controller['update']);router[_0xe697('0x11')](_0xe697('0xa'),auth[_0xe697('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x182b=['/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/:id/questions','getQuestions','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x182b,0x16a));var _0xb182=function(_0x1a191b,_0x1978de){_0x1a191b=_0x1a191b-0x0;var _0xb94b72=_0x182b[_0x1a191b];return _0xb94b72;};'use strict';var multer=require(_0xb182('0x0'));var util=require(_0xb182('0x1'));var path=require(_0xb182('0x2'));var timeout=require(_0xb182('0x3'));var express=require(_0xb182('0x4'));var router=express[_0xb182('0x5')]();var fs_extra=require(_0xb182('0x6'));var auth=require(_0xb182('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb182('0x8'));var controller=require(_0xb182('0x9'));router['get']('/',auth[_0xb182('0xa')](),controller[_0xb182('0xb')]);router['get']('/describe',auth[_0xb182('0xa')](),controller['describe']);router[_0xb182('0xc')]('/:id',auth[_0xb182('0xa')](),controller['show']);router[_0xb182('0xc')](_0xb182('0xd'),auth[_0xb182('0xa')](),controller[_0xb182('0xe')]);router[_0xb182('0xf')]('/',auth['isAuthenticated'](),controller[_0xb182('0x10')]);router[_0xb182('0x11')](_0xb182('0x12'),auth['isAuthenticated'](),controller[_0xb182('0x13')]);router['delete'](_0xb182('0x12'),auth[_0xb182('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 713a26e..ef3a699 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 _0xe056=['STRING','BOOLEAN','exports','DATE','starttime','endtime','format'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0xe056,0xdb));var _0x6e05=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xe056[_0x350aeb];return _0x3c5273;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x6e05('0x0')]={'starttime':{'type':Sequelize[_0x6e05('0x1')],'set':function(_0x436744){this['setDataValue'](_0x6e05('0x2'),_0x436744);this['setDataValue'](_0x6e05('0x3'),moment()[_0x6e05('0x4')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x6e05('0x5')]},'queue':{'type':Sequelize[_0x6e05('0x5')]},'uniqueid':{'type':Sequelize[_0x6e05('0x5')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6e05('0x5')]},'completed':{'type':Sequelize[_0x6e05('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x9e35=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','DATE','setDataValue','starttime','format'];(function(_0x5a6eb3,_0xae2835){var _0x3d04c5=function(_0x3639a5){while(--_0x3639a5){_0x5a6eb3['push'](_0x5a6eb3['shift']());}};_0x3d04c5(++_0xae2835);}(_0x9e35,0x1f3));var _0x59e3=function(_0x114b06,_0x4957c5){_0x114b06=_0x114b06-0x0;var _0x3b27b9=_0x9e35[_0x114b06];return _0x3b27b9;};'use strict';var moment=require('moment');var Sequelize=require(_0x59e3('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x59e3('0x1')],'set':function(_0xf79a95){this[_0x59e3('0x2')](_0x59e3('0x3'),_0xf79a95);this[_0x59e3('0x2')]('endtime',moment()[_0x59e3('0x4')](_0x59e3('0x5')));}},'endtime':{'type':Sequelize[_0x59e3('0x1')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x59e3('0x6')]},'queue':{'type':Sequelize[_0x59e3('0x6')]},'uniqueid':{'type':Sequelize[_0x59e3('0x6')]},'calleridname':{'type':Sequelize[_0x59e3('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x59e3('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 8516f8e..a81c4fb 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 _0xcd92=['destroy','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','length','SessionId','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then'];(function(_0x1a8ee0,_0x2e466c){var _0x4de3ba=function(_0x8cd945){while(--_0x8cd945){_0x1a8ee0['push'](_0x1a8ee0['shift']());}};_0x4de3ba(++_0x2e466c);}(_0xcd92,0x115));var _0x2cd9=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xcd92[_0x36884e];return _0x1cc367;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2cd9('0x0'));var rp=require(_0x2cd9('0x1'));var moment=require(_0x2cd9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2cd9('0x3'));var util=require(_0x2cd9('0x4'));var path=require('path');var sox=require(_0x2cd9('0x5'));var csv=require(_0x2cd9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2cd9('0x7'));var _=require(_0x2cd9('0x8'));var squel=require('squel');var crypto=require(_0x2cd9('0x9'));var jsforce=require(_0x2cd9('0xa'));var deskjs=require(_0x2cd9('0xb'));var toCsv=require(_0x2cd9('0x6'));var querystring=require(_0x2cd9('0xc'));var Papa=require('papaparse');var Redis=require(_0x2cd9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2cd9('0xe'));var as=require(_0x2cd9('0xf'));var hardwareService=require(_0x2cd9('0x10'));var logger=require(_0x2cd9('0x11'))('api');var utils=require(_0x2cd9('0x12'));var config=require(_0x2cd9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2cd9('0x14'))['db'];function respondWithStatusCode(_0x4f444f,_0x134bfd){_0x134bfd=_0x134bfd||0xcc;return function(_0x351beb){if(_0x351beb){return _0x4f444f[_0x2cd9('0x15')](_0x134bfd);}return _0x4f444f[_0x2cd9('0x16')](_0x134bfd)[_0x2cd9('0x17')]();};}function respondWithResult(_0x5aa2ed,_0x2c2d42){_0x2c2d42=_0x2c2d42||0xc8;return function(_0x1f17cf){if(_0x1f17cf){return _0x5aa2ed['status'](_0x2c2d42)[_0x2cd9('0x18')](_0x1f17cf);}};}function respondWithFilteredResult(_0x5b1587,_0x581a9f){return function(_0x3fa7ba){if(_0x3fa7ba){var _0x5f32ba=typeof _0x581a9f['offset']==='undefined'&&typeof _0x581a9f[_0x2cd9('0x19')]===_0x2cd9('0x1a');var _0x4f29f1=_0x3fa7ba[_0x2cd9('0x1b')];var _0x4ef466=_0x5f32ba?0x0:_0x581a9f[_0x2cd9('0x1c')];var _0x463d11=_0x5f32ba?_0x3fa7ba['count']:_0x581a9f[_0x2cd9('0x1c')]+_0x581a9f[_0x2cd9('0x19')];var _0x21d361;if(_0x463d11>=_0x4f29f1){_0x463d11=_0x4f29f1;_0x21d361=0xc8;}else{_0x21d361=0xce;}_0x5b1587[_0x2cd9('0x16')](_0x21d361);return _0x5b1587[_0x2cd9('0x1d')](_0x2cd9('0x1e'),_0x4ef466+'-'+_0x463d11+'/'+_0x4f29f1)['json'](_0x3fa7ba);}return null;};}function patchUpdates(_0x37b9f3){return function(_0x371d80){try{jsonpatch[_0x2cd9('0x1f')](_0x371d80,_0x37b9f3,!![]);}catch(_0x272500){return BPromise['reject'](_0x272500);}return _0x371d80[_0x2cd9('0x20')]();};}function saveUpdates(_0xdfb424,_0x167485){return function(_0x5e2006){if(_0x5e2006){return _0x5e2006[_0x2cd9('0x21')](_0xdfb424)[_0x2cd9('0x22')](function(_0xc05110){return _0xc05110;});}return null;};}function removeEntity(_0x169533,_0x69ebfd){return function(_0xbf9120){if(_0xbf9120){return _0xbf9120[_0x2cd9('0x23')]()[_0x2cd9('0x22')](function(){_0x169533[_0x2cd9('0x16')](0xcc)[_0x2cd9('0x17')]();});}};}function handleEntityNotFound(_0x5584b0,_0x4c5600){return function(_0x4bf6a0){if(!_0x4bf6a0){_0x5584b0[_0x2cd9('0x15')](0x194);}return _0x4bf6a0;};}function handleError(_0x1669bb,_0x441c1f){_0x441c1f=_0x441c1f||0x1f4;return function(_0x39912f){logger[_0x2cd9('0x24')](_0x39912f['stack']);if(_0x39912f['name']){delete _0x39912f[_0x2cd9('0x25')];}_0x1669bb[_0x2cd9('0x16')](_0x441c1f)[_0x2cd9('0x26')](_0x39912f);};}exports[_0x2cd9('0x27')]=function(_0x3f3e8f,_0x2b1203){var _0x41b5c5={},_0x589374={},_0x4dcbd2={'count':0x0,'rows':[]};var _0x24b493=_[_0x2cd9('0x28')](db[_0x2cd9('0x29')][_0x2cd9('0x2a')],function(_0x5af029){return{'name':_0x5af029[_0x2cd9('0x2b')],'type':_0x5af029['type']['key']};});_0x589374[_0x2cd9('0x2c')]=_['map'](_0x24b493,_0x2cd9('0x25'));_0x589374[_0x2cd9('0x2d')]=_[_0x2cd9('0x2e')](_0x3f3e8f[_0x2cd9('0x2d')]);_0x589374[_0x2cd9('0x2f')]=_[_0x2cd9('0x30')](_0x589374[_0x2cd9('0x2c')],_0x589374['query']);_0x41b5c5[_0x2cd9('0x31')]=_[_0x2cd9('0x30')](_0x589374[_0x2cd9('0x2c')],qs['fields'](_0x3f3e8f[_0x2cd9('0x2d')][_0x2cd9('0x32')]));_0x41b5c5[_0x2cd9('0x31')]=_0x41b5c5[_0x2cd9('0x31')]['length']?_0x41b5c5[_0x2cd9('0x31')]:_0x589374[_0x2cd9('0x2c')];if(!_0x3f3e8f['query'][_0x2cd9('0x33')](_0x2cd9('0x34'))){_0x41b5c5['limit']=qs[_0x2cd9('0x19')](_0x3f3e8f[_0x2cd9('0x2d')]['limit']);_0x41b5c5[_0x2cd9('0x1c')]=qs[_0x2cd9('0x1c')](_0x3f3e8f[_0x2cd9('0x2d')][_0x2cd9('0x1c')]);}_0x41b5c5[_0x2cd9('0x35')]=qs[_0x2cd9('0x36')](_0x3f3e8f['query'][_0x2cd9('0x36')]);_0x41b5c5[_0x2cd9('0x37')]=qs[_0x2cd9('0x2f')](_[_0x2cd9('0x38')](_0x3f3e8f[_0x2cd9('0x2d')],_0x589374['filters']),_0x24b493);if(_0x3f3e8f[_0x2cd9('0x2d')][_0x2cd9('0x39')]){_0x41b5c5['where']=_[_0x2cd9('0x3a')](_0x41b5c5['where'],{'$or':_['map'](_0x24b493,function(_0x5b7aff){if(_0x5b7aff[_0x2cd9('0x3b')]!==_0x2cd9('0x3c')){var _0x34e012={};_0x34e012[_0x5b7aff[_0x2cd9('0x25')]]={'$like':'%'+_0x3f3e8f[_0x2cd9('0x2d')]['filter']+'%'};return _0x34e012;}})});}_0x41b5c5=_['merge']({},_0x41b5c5,_0x3f3e8f[_0x2cd9('0x3d')]);var _0x4d93d2={'where':_0x41b5c5['where']};return db['JscriptySessionReport'][_0x2cd9('0x1b')](_0x4d93d2)[_0x2cd9('0x22')](function(_0x4b1ca1){_0x4dcbd2[_0x2cd9('0x1b')]=_0x4b1ca1;if(_0x3f3e8f['query'][_0x2cd9('0x3e')]){_0x41b5c5[_0x2cd9('0x3f')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x2cd9('0x40')](_0x41b5c5);})['then'](function(_0x18f13b){_0x4dcbd2[_0x2cd9('0x41')]=_0x18f13b;return _0x4dcbd2;})['then'](respondWithFilteredResult(_0x2b1203,_0x41b5c5))[_0x2cd9('0x42')](handleError(_0x2b1203,null));};exports[_0x2cd9('0x43')]=function(_0x3bf776,_0x313875){var _0x158b22={'raw':!![],'where':{'id':_0x3bf776[_0x2cd9('0x44')]['id']}},_0x3ab37d={};_0x3ab37d[_0x2cd9('0x2c')]=_[_0x2cd9('0x2e')](db['JscriptySessionReport'][_0x2cd9('0x2a')]);_0x3ab37d[_0x2cd9('0x2d')]=_[_0x2cd9('0x2e')](_0x3bf776[_0x2cd9('0x2d')]);_0x3ab37d[_0x2cd9('0x2f')]=_[_0x2cd9('0x30')](_0x3ab37d[_0x2cd9('0x2c')],_0x3ab37d[_0x2cd9('0x2d')]);_0x158b22['attributes']=_[_0x2cd9('0x30')](_0x3ab37d[_0x2cd9('0x2c')],qs[_0x2cd9('0x32')](_0x3bf776[_0x2cd9('0x2d')][_0x2cd9('0x32')]));_0x158b22['attributes']=_0x158b22[_0x2cd9('0x31')]['length']?_0x158b22[_0x2cd9('0x31')]:_0x3ab37d[_0x2cd9('0x2c')];if(_0x3bf776[_0x2cd9('0x2d')]['includeAll']){_0x158b22[_0x2cd9('0x3f')]=[{'all':!![]}];}_0x158b22=_['merge']({},_0x158b22,_0x3bf776['options']);return db['JscriptySessionReport'][_0x2cd9('0x45')](_0x158b22)[_0x2cd9('0x22')](handleEntityNotFound(_0x313875,null))['then'](respondWithResult(_0x313875,null))[_0x2cd9('0x42')](handleError(_0x313875,null));};exports['create']=function(_0x1efe6b,_0x2b1fd8){return db[_0x2cd9('0x29')][_0x2cd9('0x46')](_0x1efe6b['body'],{})['then'](respondWithResult(_0x2b1fd8,0xc9))[_0x2cd9('0x42')](handleError(_0x2b1fd8,null));};exports[_0x2cd9('0x21')]=function(_0x31162b,_0x2dc3cb){if(_0x31162b['body']['id']){delete _0x31162b['body']['id'];}return db[_0x2cd9('0x29')]['find']({'where':{'id':_0x31162b[_0x2cd9('0x44')]['id']}})[_0x2cd9('0x22')](handleEntityNotFound(_0x2dc3cb,null))[_0x2cd9('0x22')](saveUpdates(_0x31162b[_0x2cd9('0x47')],null))[_0x2cd9('0x22')](respondWithResult(_0x2dc3cb,null))[_0x2cd9('0x42')](handleError(_0x2dc3cb,null));};exports[_0x2cd9('0x23')]=function(_0x5bb90e,_0x3012df){return db[_0x2cd9('0x29')][_0x2cd9('0x45')]({'where':{'id':_0x5bb90e['params']['id']}})[_0x2cd9('0x22')](handleEntityNotFound(_0x3012df,null))[_0x2cd9('0x22')](removeEntity(_0x3012df,null))[_0x2cd9('0x42')](handleError(_0x3012df,null));};exports['describe']=function(_0x2a807c,_0x2fc728){return db['JscriptySessionReport'][_0x2cd9('0x48')]()[_0x2cd9('0x22')](respondWithResult(_0x2fc728,null))[_0x2cd9('0x42')](handleError(_0x2fc728,null));};exports[_0x2cd9('0x49')]=function(_0x225941,_0x1655b8,_0x1182d2){var _0x4c6435={'raw':!![],'where':{}};var _0x488ddf={};var _0x181c03={'count':0x0,'rows':[]};return db[_0x2cd9('0x29')][_0x2cd9('0x4a')]({'where':{'id':_0x225941[_0x2cd9('0x44')]['id']}})[_0x2cd9('0x22')](handleEntityNotFound(_0x1655b8,null))[_0x2cd9('0x22')](function(_0x1822a7){if(_0x1822a7){_0x488ddf[_0x2cd9('0x2c')]=_[_0x2cd9('0x2e')](db[_0x2cd9('0x4b')][_0x2cd9('0x2a')]);_0x488ddf[_0x2cd9('0x2d')]=_['keys'](_0x225941[_0x2cd9('0x2d')]);_0x488ddf['filters']=_[_0x2cd9('0x30')](_0x488ddf['model'],_0x488ddf['query']);_0x4c6435['attributes']=_[_0x2cd9('0x30')](_0x488ddf[_0x2cd9('0x2c')],qs[_0x2cd9('0x32')](_0x225941[_0x2cd9('0x2d')][_0x2cd9('0x32')]));_0x4c6435[_0x2cd9('0x31')]=_0x4c6435[_0x2cd9('0x31')][_0x2cd9('0x4c')]?_0x4c6435[_0x2cd9('0x31')]:_0x488ddf[_0x2cd9('0x2c')];if(!_0x225941[_0x2cd9('0x2d')][_0x2cd9('0x33')]('nolimit')){_0x4c6435[_0x2cd9('0x19')]=qs[_0x2cd9('0x19')](_0x225941[_0x2cd9('0x2d')][_0x2cd9('0x19')]);_0x4c6435['offset']=qs['offset'](_0x225941[_0x2cd9('0x2d')][_0x2cd9('0x1c')]);}_0x4c6435[_0x2cd9('0x35')]=qs['sort'](_0x225941[_0x2cd9('0x2d')][_0x2cd9('0x36')]);_0x4c6435[_0x2cd9('0x37')]=qs[_0x2cd9('0x2f')](_[_0x2cd9('0x38')](_0x225941[_0x2cd9('0x2d')],_0x488ddf[_0x2cd9('0x2f')]));_0x4c6435[_0x2cd9('0x37')][_0x2cd9('0x4d')]=_0x1822a7['id'];if(_0x225941[_0x2cd9('0x2d')][_0x2cd9('0x39')]){_0x4c6435[_0x2cd9('0x37')]=_['merge'](_0x4c6435[_0x2cd9('0x37')],{'$or':_[_0x2cd9('0x28')](_0x4c6435['attributes'],function(_0x57bb89){var _0xb5518d={};_0xb5518d[_0x57bb89]={'$like':'%'+_0x225941[_0x2cd9('0x2d')][_0x2cd9('0x39')]+'%'};return _0xb5518d;})});}_0x4c6435=_[_0x2cd9('0x3a')]({},_0x4c6435,_0x225941['options']);return db[_0x2cd9('0x4b')][_0x2cd9('0x1b')]({'where':_0x4c6435[_0x2cd9('0x37')]})[_0x2cd9('0x22')](function(_0x240388){_0x181c03[_0x2cd9('0x1b')]=_0x240388;if(_0x225941[_0x2cd9('0x2d')][_0x2cd9('0x3e')]){_0x4c6435[_0x2cd9('0x3f')]=[{'all':!![]}];}return db[_0x2cd9('0x4b')][_0x2cd9('0x40')](_0x4c6435);})['then'](function(_0x2d8384){_0x181c03[_0x2cd9('0x41')]=_0x2d8384;return _0x181c03;});}})['then'](respondWithFilteredResult(_0x1655b8,_0x4c6435))[_0x2cd9('0x42')](handleError(_0x1655b8,null));}; \ No newline at end of file +var _0x48af=['filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','keys','filters','include','options','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','update','then','destroy','sendStatus','stack','name','index','JscriptySessionReport','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x48af,0x148));var _0xf48a=function(_0x571fd6,_0x5223fc){_0x571fd6=_0x571fd6-0x0;var _0x4d6af6=_0x48af[_0x571fd6];return _0x4d6af6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf48a('0x0'));var zipdir=require(_0xf48a('0x1'));var jsonpatch=require(_0xf48a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf48a('0x3'));var Mustache=require(_0xf48a('0x4'));var util=require(_0xf48a('0x5'));var path=require(_0xf48a('0x6'));var sox=require(_0xf48a('0x7'));var csv=require(_0xf48a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf48a('0x9'));var _=require(_0xf48a('0xa'));var squel=require(_0xf48a('0xb'));var crypto=require('crypto');var jsforce=require(_0xf48a('0xc'));var deskjs=require(_0xf48a('0xd'));var toCsv=require(_0xf48a('0x8'));var querystring=require(_0xf48a('0xe'));var Papa=require(_0xf48a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf48a('0x10'));var as=require(_0xf48a('0x11'));var hardwareService=require(_0xf48a('0x12'));var logger=require('../../config/logger')(_0xf48a('0x13'));var utils=require(_0xf48a('0x14'));var config=require(_0xf48a('0x15'));var licenseUtil=require(_0xf48a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x426fb1,_0x4a64e3){_0x4a64e3=_0x4a64e3||0xcc;return function(_0xfe406d){if(_0xfe406d){return _0x426fb1['sendStatus'](_0x4a64e3);}return _0x426fb1[_0xf48a('0x17')](_0x4a64e3)[_0xf48a('0x18')]();};}function respondWithResult(_0x13543e,_0x375cd6){_0x375cd6=_0x375cd6||0xc8;return function(_0x34ead3){if(_0x34ead3){return _0x13543e[_0xf48a('0x17')](_0x375cd6)['json'](_0x34ead3);}};}function respondWithFilteredResult(_0x41d811,_0x2c7c74){return function(_0x35f18d){if(_0x35f18d){var _0x48d723=typeof _0x2c7c74[_0xf48a('0x19')]===_0xf48a('0x1a')&&typeof _0x2c7c74['limit']===_0xf48a('0x1a');var _0x4377d7=_0x35f18d[_0xf48a('0x1b')];var _0x508d60=_0x48d723?0x0:_0x2c7c74[_0xf48a('0x19')];var _0x56d99a=_0x48d723?_0x35f18d[_0xf48a('0x1b')]:_0x2c7c74[_0xf48a('0x19')]+_0x2c7c74[_0xf48a('0x1c')];var _0x5158a5;if(_0x56d99a>=_0x4377d7){_0x56d99a=_0x4377d7;_0x5158a5=0xc8;}else{_0x5158a5=0xce;}_0x41d811[_0xf48a('0x17')](_0x5158a5);return _0x41d811['set'](_0xf48a('0x1d'),_0x508d60+'-'+_0x56d99a+'/'+_0x4377d7)[_0xf48a('0x1e')](_0x35f18d);}return null;};}function patchUpdates(_0x253e92){return function(_0x256b49){try{jsonpatch[_0xf48a('0x1f')](_0x256b49,_0x253e92,!![]);}catch(_0x14d4a6){return BPromise[_0xf48a('0x20')](_0x14d4a6);}return _0x256b49['save']();};}function saveUpdates(_0x2d6af1,_0xe1c625){return function(_0x52e210){if(_0x52e210){return _0x52e210[_0xf48a('0x21')](_0x2d6af1)[_0xf48a('0x22')](function(_0x6f1f93){return _0x6f1f93;});}return null;};}function removeEntity(_0x4bfe9b,_0x46cc91){return function(_0x183680){if(_0x183680){return _0x183680[_0xf48a('0x23')]()[_0xf48a('0x22')](function(){_0x4bfe9b['status'](0xcc)[_0xf48a('0x18')]();});}};}function handleEntityNotFound(_0x1b99c7,_0x27c615){return function(_0x5be301){if(!_0x5be301){_0x1b99c7[_0xf48a('0x24')](0x194);}return _0x5be301;};}function handleError(_0x22ae38,_0x3ea63c){_0x3ea63c=_0x3ea63c||0x1f4;return function(_0x2ce475){logger['error'](_0x2ce475[_0xf48a('0x25')]);if(_0x2ce475[_0xf48a('0x26')]){delete _0x2ce475[_0xf48a('0x26')];}_0x22ae38['status'](_0x3ea63c)['send'](_0x2ce475);};}exports[_0xf48a('0x27')]=function(_0xc3154a,_0xbf78e){var _0x4f9142={},_0x2c5240={},_0x213258={'count':0x0,'rows':[]};var _0x185141=_['map'](db[_0xf48a('0x28')][_0xf48a('0x29')],function(_0x3337fb){return{'name':_0x3337fb['fieldName'],'type':_0x3337fb[_0xf48a('0x2a')][_0xf48a('0x2b')]};});_0x2c5240[_0xf48a('0x2c')]=_[_0xf48a('0x2d')](_0x185141,_0xf48a('0x26'));_0x2c5240['query']=_['keys'](_0xc3154a[_0xf48a('0x2e')]);_0x2c5240['filters']=_[_0xf48a('0x2f')](_0x2c5240[_0xf48a('0x2c')],_0x2c5240['query']);_0x4f9142[_0xf48a('0x30')]=_[_0xf48a('0x2f')](_0x2c5240['model'],qs[_0xf48a('0x31')](_0xc3154a[_0xf48a('0x2e')][_0xf48a('0x31')]));_0x4f9142[_0xf48a('0x30')]=_0x4f9142['attributes'][_0xf48a('0x32')]?_0x4f9142[_0xf48a('0x30')]:_0x2c5240[_0xf48a('0x2c')];if(!_0xc3154a[_0xf48a('0x2e')][_0xf48a('0x33')](_0xf48a('0x34'))){_0x4f9142[_0xf48a('0x1c')]=qs['limit'](_0xc3154a[_0xf48a('0x2e')]['limit']);_0x4f9142[_0xf48a('0x19')]=qs[_0xf48a('0x19')](_0xc3154a['query']['offset']);}_0x4f9142[_0xf48a('0x35')]=qs[_0xf48a('0x36')](_0xc3154a[_0xf48a('0x2e')][_0xf48a('0x36')]);_0x4f9142[_0xf48a('0x37')]=qs['filters'](_[_0xf48a('0x38')](_0xc3154a[_0xf48a('0x2e')],_0x2c5240['filters']),_0x185141);if(_0xc3154a[_0xf48a('0x2e')][_0xf48a('0x39')]){_0x4f9142[_0xf48a('0x37')]=_['merge'](_0x4f9142[_0xf48a('0x37')],{'$or':_[_0xf48a('0x2d')](_0x185141,function(_0x342193){if(_0x342193[_0xf48a('0x2a')]!==_0xf48a('0x3a')){var _0x32dd70={};_0x32dd70[_0x342193[_0xf48a('0x26')]]={'$like':'%'+_0xc3154a[_0xf48a('0x2e')]['filter']+'%'};return _0x32dd70;}})});}_0x4f9142=_[_0xf48a('0x3b')]({},_0x4f9142,_0xc3154a['options']);var _0x39d34e={'where':_0x4f9142['where']};return db[_0xf48a('0x28')][_0xf48a('0x1b')](_0x39d34e)['then'](function(_0x13daec){_0x213258[_0xf48a('0x1b')]=_0x13daec;if(_0xc3154a[_0xf48a('0x2e')][_0xf48a('0x3c')]){_0x4f9142['include']=[{'all':!![]}];}return db[_0xf48a('0x28')][_0xf48a('0x3d')](_0x4f9142);})['then'](function(_0x3b508d){_0x213258[_0xf48a('0x3e')]=_0x3b508d;return _0x213258;})[_0xf48a('0x22')](respondWithFilteredResult(_0xbf78e,_0x4f9142))['catch'](handleError(_0xbf78e,null));};exports[_0xf48a('0x3f')]=function(_0x361594,_0x365f7a){var _0x2219e5={'raw':!![],'where':{'id':_0x361594[_0xf48a('0x40')]['id']}},_0xf43829={};_0xf43829[_0xf48a('0x2c')]=_[_0xf48a('0x41')](db['JscriptySessionReport'][_0xf48a('0x29')]);_0xf43829[_0xf48a('0x2e')]=_['keys'](_0x361594[_0xf48a('0x2e')]);_0xf43829[_0xf48a('0x42')]=_['intersection'](_0xf43829['model'],_0xf43829[_0xf48a('0x2e')]);_0x2219e5['attributes']=_[_0xf48a('0x2f')](_0xf43829[_0xf48a('0x2c')],qs[_0xf48a('0x31')](_0x361594[_0xf48a('0x2e')][_0xf48a('0x31')]));_0x2219e5[_0xf48a('0x30')]=_0x2219e5[_0xf48a('0x30')]['length']?_0x2219e5[_0xf48a('0x30')]:_0xf43829['model'];if(_0x361594[_0xf48a('0x2e')][_0xf48a('0x3c')]){_0x2219e5[_0xf48a('0x43')]=[{'all':!![]}];}_0x2219e5=_['merge']({},_0x2219e5,_0x361594[_0xf48a('0x44')]);return db[_0xf48a('0x28')][_0xf48a('0x45')](_0x2219e5)[_0xf48a('0x22')](handleEntityNotFound(_0x365f7a,null))['then'](respondWithResult(_0x365f7a,null))[_0xf48a('0x46')](handleError(_0x365f7a,null));};exports[_0xf48a('0x47')]=function(_0x16e3cf,_0x462825){return db[_0xf48a('0x28')][_0xf48a('0x47')](_0x16e3cf[_0xf48a('0x48')],{})['then'](respondWithResult(_0x462825,0xc9))[_0xf48a('0x46')](handleError(_0x462825,null));};exports['update']=function(_0x543e64,_0x2f1eee){if(_0x543e64[_0xf48a('0x48')]['id']){delete _0x543e64['body']['id'];}return db[_0xf48a('0x28')][_0xf48a('0x45')]({'where':{'id':_0x543e64[_0xf48a('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f1eee,null))[_0xf48a('0x22')](saveUpdates(_0x543e64[_0xf48a('0x48')],null))[_0xf48a('0x22')](respondWithResult(_0x2f1eee,null))['catch'](handleError(_0x2f1eee,null));};exports['destroy']=function(_0x1ed00f,_0x54981a){return db[_0xf48a('0x28')]['find']({'where':{'id':_0x1ed00f[_0xf48a('0x40')]['id']}})['then'](handleEntityNotFound(_0x54981a,null))['then'](removeEntity(_0x54981a,null))[_0xf48a('0x46')](handleError(_0x54981a,null));};exports[_0xf48a('0x49')]=function(_0x1160cf,_0x1acddb){return db[_0xf48a('0x28')][_0xf48a('0x49')]()['then'](respondWithResult(_0x1acddb,null))[_0xf48a('0x46')](handleError(_0x1acddb,null));};exports[_0xf48a('0x4a')]=function(_0x231ae2,_0x16e62d,_0x62854){var _0x5993a8={'raw':!![],'where':{}};var _0x266940={};var _0x6dd18e={'count':0x0,'rows':[]};return db[_0xf48a('0x28')][_0xf48a('0x4b')]({'where':{'id':_0x231ae2[_0xf48a('0x40')]['id']}})[_0xf48a('0x22')](handleEntityNotFound(_0x16e62d,null))['then'](function(_0x244a0c){if(_0x244a0c){_0x266940[_0xf48a('0x2c')]=_[_0xf48a('0x41')](db['JscriptyQuestionReport']['rawAttributes']);_0x266940['query']=_[_0xf48a('0x41')](_0x231ae2[_0xf48a('0x2e')]);_0x266940['filters']=_['intersection'](_0x266940[_0xf48a('0x2c')],_0x266940[_0xf48a('0x2e')]);_0x5993a8[_0xf48a('0x30')]=_[_0xf48a('0x2f')](_0x266940['model'],qs[_0xf48a('0x31')](_0x231ae2['query'][_0xf48a('0x31')]));_0x5993a8[_0xf48a('0x30')]=_0x5993a8['attributes'][_0xf48a('0x32')]?_0x5993a8[_0xf48a('0x30')]:_0x266940[_0xf48a('0x2c')];if(!_0x231ae2[_0xf48a('0x2e')][_0xf48a('0x33')](_0xf48a('0x34'))){_0x5993a8[_0xf48a('0x1c')]=qs[_0xf48a('0x1c')](_0x231ae2[_0xf48a('0x2e')][_0xf48a('0x1c')]);_0x5993a8['offset']=qs[_0xf48a('0x19')](_0x231ae2[_0xf48a('0x2e')]['offset']);}_0x5993a8[_0xf48a('0x35')]=qs[_0xf48a('0x36')](_0x231ae2[_0xf48a('0x2e')][_0xf48a('0x36')]);_0x5993a8[_0xf48a('0x37')]=qs[_0xf48a('0x42')](_[_0xf48a('0x38')](_0x231ae2[_0xf48a('0x2e')],_0x266940[_0xf48a('0x42')]));_0x5993a8[_0xf48a('0x37')]['SessionId']=_0x244a0c['id'];if(_0x231ae2[_0xf48a('0x2e')][_0xf48a('0x39')]){_0x5993a8[_0xf48a('0x37')]=_[_0xf48a('0x3b')](_0x5993a8[_0xf48a('0x37')],{'$or':_[_0xf48a('0x2d')](_0x5993a8[_0xf48a('0x30')],function(_0x300bbf){var _0x2f6a45={};_0x2f6a45[_0x300bbf]={'$like':'%'+_0x231ae2['query'][_0xf48a('0x39')]+'%'};return _0x2f6a45;})});}_0x5993a8=_['merge']({},_0x5993a8,_0x231ae2[_0xf48a('0x44')]);return db[_0xf48a('0x4c')]['count']({'where':_0x5993a8[_0xf48a('0x37')]})[_0xf48a('0x22')](function(_0x10475c){_0x6dd18e[_0xf48a('0x1b')]=_0x10475c;if(_0x231ae2[_0xf48a('0x2e')][_0xf48a('0x3c')]){_0x5993a8[_0xf48a('0x43')]=[{'all':!![]}];}return db[_0xf48a('0x4c')][_0xf48a('0x3d')](_0x5993a8);})[_0xf48a('0x22')](function(_0x22db1a){_0x6dd18e['rows']=_0x22db1a;return _0x6dd18e;});}})[_0xf48a('0x22')](respondWithFilteredResult(_0x16e62d,_0x5993a8))['catch'](handleError(_0x16e62d,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 5c667b1..81e2115 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 _0xafc4=['path','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xafc4,0x69));var _0x4afc=function(_0x1fef23,_0x3ba06c){_0x1fef23=_0x1fef23-0x0;var _0x3ecd52=_0xafc4[_0x1fef23];return _0x3ecd52;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash'];(function(_0x2dc621,_0x1c3969){var _0x2a1369=function(_0x8a4843){while(--_0x8a4843){_0x2dc621['push'](_0x2dc621['shift']());}};_0x2a1369(++_0x1c3969);}(_0x5496,0x175));var _0x6549=function(_0x3310f7,_0x416a18){_0x3310f7=_0x3310f7-0x0;var _0x15bcd1=_0x5496[_0x3310f7];return _0x15bcd1;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index c799638..6af6b67 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 _0xb44a=['moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch'];(function(_0x11536b,_0x5aee6d){var _0x5136c1=function(_0x1aa83a){while(--_0x1aa83a){_0x11536b['push'](_0x11536b['shift']());}};_0x5136c1(++_0x5aee6d);}(_0xb44a,0x1c2));var _0xab44=function(_0x53b199,_0x38ff21){_0x53b199=_0x53b199-0x0;var _0x1ba42d=_0xb44a[_0x53b199];return _0x1ba42d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3303b1,_0x3ead8d,_0x495825){return new BPromise(function(_0x137a8c,_0x133a6d){return client[_0xab44('0x8')](_0x3303b1,_0x495825)[_0xab44('0x9')](function(_0xa14367){logger['info'](_0xab44('0xa'),_0x3ead8d,'request\x20sent');logger[_0xab44('0xb')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3ead8d,'request\x20sent',JSON[_0xab44('0xc')](_0xa14367));if(_0xa14367[_0xab44('0xd')]){if(_0xa14367[_0xab44('0xd')][_0xab44('0xe')]===0x1f4){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0xa14367['error']['message']);return _0x133a6d(_0xa14367[_0xab44('0xd')]['message']);}logger[_0xab44('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x3ead8d,_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);return _0x137a8c(_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);}else{logger[_0xab44('0x10')](_0xab44('0xa'),_0x3ead8d,'request\x20sent');_0x137a8c(_0xa14367['result'][_0xab44('0xf')]);}})[_0xab44('0x11')](function(_0x14fe36){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0x14fe36);_0x133a6d(_0x14fe36);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xc2c7,0x134));var _0x7c2c=function(_0x161f42,_0x1a7824){_0x161f42=_0x161f42-0x0;var _0x5d8f3e=_0xc2c7[_0x161f42];return _0x5d8f3e;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 1868a37..ec6e9b3 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 _0x468f=['./license.controller','get','index','put','/:id','isAuthenticated','/download_log_file','exports','path','express','Router','../../config/environment'];(function(_0x5556e8,_0x29bc2b){var _0xd928cb=function(_0x5b7ce8){while(--_0x5b7ce8){_0x5556e8['push'](_0x5556e8['shift']());}};_0xd928cb(++_0x29bc2b);}(_0x468f,0xbc));var _0xf468=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0x468f[_0x2440fe];return _0x5cf734;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf468('0x0'));var timeout=require('connect-timeout');var express=require(_0xf468('0x1'));var router=express[_0xf468('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf468('0x3'));var controller=require(_0xf468('0x4'));router[_0xf468('0x5')]('/',controller[_0xf468('0x6')]);router[_0xf468('0x7')](_0xf468('0x8'),auth[_0xf468('0x9')](),controller['update']);router[_0xf468('0x5')](_0xf468('0xa'),auth[_0xf468('0x9')](),controller['downloadLogFile']);module[_0xf468('0xb')]=router; \ No newline at end of file +var _0xec61=['/download_log_file','downloadLogFile','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update'];(function(_0x11eebf,_0x1d996c){var _0xa22847=function(_0x216d30){while(--_0x216d30){_0x11eebf['push'](_0x11eebf['shift']());}};_0xa22847(++_0x1d996c);}(_0xec61,0x16f));var _0x1ec6=function(_0x478df4,_0x369b3e){_0x478df4=_0x478df4-0x0;var _0x48b89e=_0xec61[_0x478df4];return _0x48b89e;};'use strict';var multer=require('multer');var util=require(_0x1ec6('0x0'));var path=require(_0x1ec6('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ec6('0x2'));var router=express['Router']();var fs_extra=require(_0x1ec6('0x3'));var auth=require(_0x1ec6('0x4'));var interaction=require(_0x1ec6('0x5'));var config=require(_0x1ec6('0x6'));var controller=require('./license.controller');router['get']('/',controller['index']);router[_0x1ec6('0x7')](_0x1ec6('0x8'),auth[_0x1ec6('0x9')](),controller[_0x1ec6('0xa')]);router['get'](_0x1ec6('0xb'),auth[_0x1ec6('0x9')](),controller[_0x1ec6('0xc')]);module[_0x1ec6('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 0b8bf8e..4664278 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 _0x4d06=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x4d06,0x1c9));var _0x64d0=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x4d06[_0x2a7b8e];return _0x29b5c8;};'use strict';var Sequelize=require(_0x64d0('0x0'));module[_0x64d0('0x1')]={'license':{'type':Sequelize[_0x64d0('0x2')]},'data1':{'type':Sequelize[_0x64d0('0x3')]},'data2':{'type':Sequelize[_0x64d0('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x64d0('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf05f=['INTEGER','sequelize','TEXT','STRING'];(function(_0x59b63f,_0x47b899){var _0x1ad91a=function(_0x3278a2){while(--_0x3278a2){_0x59b63f['push'](_0x59b63f['shift']());}};_0x1ad91a(++_0x47b899);}(_0xf05f,0x7d));var _0xff05=function(_0x2d85e3,_0x4ea2bf){_0x2d85e3=_0x2d85e3-0x0;var _0x1de29e=_0xf05f[_0x2d85e3];return _0x1de29e;};'use strict';var Sequelize=require(_0xff05('0x0'));module['exports']={'license':{'type':Sequelize[_0xff05('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xff05('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xff05('0x3')],'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 9e12109..a82d9d3 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 _0xa7fa=['end','json','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','merge','options','getLicense','catch','body','License','find','params','get','checkLicense','key','downloadLogFile','license-info.log','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xa7fa,0xb7));var _0xaa7f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa7fa[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa7f('0x0'));var zipdir=require(_0xaa7f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaa7f('0x2'));var BPromise=require(_0xaa7f('0x3'));var Mustache=require(_0xaa7f('0x4'));var util=require('util');var path=require(_0xaa7f('0x5'));var sox=require('sox');var csv=require(_0xaa7f('0x6'));var ejs=require(_0xaa7f('0x7'));var fs=require('fs');var fs_extra=require(_0xaa7f('0x8'));var _=require(_0xaa7f('0x9'));var squel=require(_0xaa7f('0xa'));var crypto=require(_0xaa7f('0xb'));var jsforce=require(_0xaa7f('0xc'));var deskjs=require(_0xaa7f('0xd'));var toCsv=require(_0xaa7f('0x6'));var querystring=require(_0xaa7f('0xe'));var Papa=require(_0xaa7f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaa7f('0x10'));var as=require(_0xaa7f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa7f('0x12'));var utils=require(_0xaa7f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xaa7f('0x14'));var db=require(_0xaa7f('0x15'))['db'];function respondWithStatusCode(_0x2220cc,_0x3b39e2){_0x3b39e2=_0x3b39e2||0xcc;return function(_0x49af07){if(_0x49af07){return _0x2220cc[_0xaa7f('0x16')](_0x3b39e2);}return _0x2220cc[_0xaa7f('0x17')](_0x3b39e2)[_0xaa7f('0x18')]();};}function respondWithResult(_0x5b9a3f,_0x59b556){_0x59b556=_0x59b556||0xc8;return function(_0x547a4b){if(_0x547a4b){return _0x5b9a3f[_0xaa7f('0x17')](_0x59b556)[_0xaa7f('0x19')](_0x547a4b);}};}function respondWithFilteredResult(_0x5bcc15,_0x151b31){return function(_0x471976){if(_0x471976){var _0x5e4110=typeof _0x151b31['offset']===_0xaa7f('0x1a')&&typeof _0x151b31['limit']===_0xaa7f('0x1a');var _0x19ba33=_0x471976[_0xaa7f('0x1b')];var _0x28090d=_0x5e4110?0x0:_0x151b31['offset'];var _0x4b778f=_0x5e4110?_0x471976[_0xaa7f('0x1b')]:_0x151b31[_0xaa7f('0x1c')]+_0x151b31['limit'];var _0x26a02c;if(_0x4b778f>=_0x19ba33){_0x4b778f=_0x19ba33;_0x26a02c=0xc8;}else{_0x26a02c=0xce;}_0x5bcc15[_0xaa7f('0x17')](_0x26a02c);return _0x5bcc15[_0xaa7f('0x1d')](_0xaa7f('0x1e'),_0x28090d+'-'+_0x4b778f+'/'+_0x19ba33)[_0xaa7f('0x19')](_0x471976);}return null;};}function patchUpdates(_0x34dab9){return function(_0x4c2907){try{jsonpatch[_0xaa7f('0x1f')](_0x4c2907,_0x34dab9,!![]);}catch(_0x3df71e){return BPromise[_0xaa7f('0x20')](_0x3df71e);}return _0x4c2907['save']();};}function saveUpdates(_0x4a019c,_0xbef88b){return function(_0x691342){if(_0x691342){return _0x691342['update'](_0x4a019c)[_0xaa7f('0x21')](function(_0x3156c3){return _0x3156c3;});}return null;};}function removeEntity(_0x5123ff,_0x2b7310){return function(_0x289ed1){if(_0x289ed1){return _0x289ed1[_0xaa7f('0x22')]()[_0xaa7f('0x21')](function(){_0x5123ff['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf084d2,_0x591af4){return function(_0xd0b12e){if(!_0xd0b12e){_0xf084d2['sendStatus'](0x194);}return _0xd0b12e;};}function handleError(_0x2db85f,_0x31b06e){_0x31b06e=_0x31b06e||0x1f4;return function(_0x135fb0){logger[_0xaa7f('0x23')](_0x135fb0[_0xaa7f('0x24')]);if(_0x135fb0['name']){delete _0x135fb0[_0xaa7f('0x25')];}_0x2db85f['status'](_0x31b06e)[_0xaa7f('0x26')](_0x135fb0);};}var utilLicense=require(_0xaa7f('0x14'));exports[_0xaa7f('0x27')]=function(_0x3af2eb,_0x45a638){var _0x18483c={'raw':!![],'where':{'id':0x1}},_0x4cba66={};_0x4cba66[_0xaa7f('0x28')]=_[_0xaa7f('0x29')](db['License'][_0xaa7f('0x2a')]);_0x4cba66[_0xaa7f('0x2b')]=_['keys'](_0x3af2eb[_0xaa7f('0x2b')]);_0x4cba66[_0xaa7f('0x2c')]=_[_0xaa7f('0x2d')](_0x4cba66[_0xaa7f('0x28')],_0x4cba66['query']);_0x18483c[_0xaa7f('0x2e')]=_[_0xaa7f('0x2d')](_0x4cba66[_0xaa7f('0x28')],qs[_0xaa7f('0x2f')](_0x3af2eb['query'][_0xaa7f('0x2f')]));_0x18483c[_0xaa7f('0x2e')]=_0x18483c[_0xaa7f('0x2e')]['length']?_0x18483c['attributes']:_0x4cba66[_0xaa7f('0x28')];_0x18483c=_[_0xaa7f('0x30')]({},_0x18483c,_0x3af2eb[_0xaa7f('0x31')]);return utilLicense[_0xaa7f('0x32')](_0x18483c)['then'](respondWithResult(_0x45a638,null))[_0xaa7f('0x33')](handleError(_0x45a638,null));};exports['update']=function(_0xd05510,_0x11c8d6){if(_0xd05510[_0xaa7f('0x34')]['id']){delete _0xd05510[_0xaa7f('0x34')]['id'];}return db[_0xaa7f('0x35')][_0xaa7f('0x36')]({'where':{'id':_0xd05510[_0xaa7f('0x37')]['id']}})['then'](handleEntityNotFound(_0x11c8d6,null))[_0xaa7f('0x21')](function(_0x11d96f){var _0x1184d5=_0x11d96f[_0xaa7f('0x38')]({'plain':!![]});return utilLicense[_0xaa7f('0x39')](_0x1184d5,_0xd05510[_0xaa7f('0x34')][_0xaa7f('0x3a')]);})[_0xaa7f('0x21')](function(_0x2c34a0){if(!_0x2c34a0['demo']){return saveUpdates(_0xd05510[_0xaa7f('0x34')],null);}return _0x2c34a0;})[_0xaa7f('0x21')](respondWithResult(_0x11c8d6,null))['catch'](handleError(_0x11c8d6,null));};exports[_0xaa7f('0x3b')]=function(_0x4a6b4f,_0x131a2e){var _0x392afb=_0xaa7f('0x3c');var _0x46f3fb=path[_0xaa7f('0x3d')]('/var',_0xaa7f('0x3e'),_0xaa7f('0x3f'),_0x392afb);_0x131a2e[_0xaa7f('0x40')](_0xaa7f('0x41'),_0xaa7f('0x42')+_0x392afb);_0x131a2e[_0xaa7f('0x1d')](_0xaa7f('0x43'),_0xaa7f('0x44'));_0x131a2e['download'](_0x46f3fb);}; \ No newline at end of file +var _0x7ca3=['get','key','demo','downloadLogFile','license-info.log','join','log','xcally','attachment;\x20filename=','Content-Type','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','model','License','query','keys','filters','intersection','attributes','fields','merge','options','getLicense','catch','body','find','params'];(function(_0x4a530a,_0x3cf908){var _0x3ab3d4=function(_0x1427c7){while(--_0x1427c7){_0x4a530a['push'](_0x4a530a['shift']());}};_0x3ab3d4(++_0x3cf908);}(_0x7ca3,0x9b));var _0x37ca=function(_0x44f781,_0x1b984e){_0x44f781=_0x44f781-0x0;var _0x1b0b31=_0x7ca3[_0x44f781];return _0x1b0b31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x37ca('0x0'));var zipdir=require(_0x37ca('0x1'));var jsonpatch=require(_0x37ca('0x2'));var rp=require(_0x37ca('0x3'));var moment=require(_0x37ca('0x4'));var BPromise=require(_0x37ca('0x5'));var Mustache=require(_0x37ca('0x6'));var util=require('util');var path=require(_0x37ca('0x7'));var sox=require('sox');var csv=require(_0x37ca('0x8'));var ejs=require(_0x37ca('0x9'));var fs=require('fs');var fs_extra=require(_0x37ca('0xa'));var _=require('lodash');var squel=require(_0x37ca('0xb'));var crypto=require(_0x37ca('0xc'));var jsforce=require(_0x37ca('0xd'));var deskjs=require(_0x37ca('0xe'));var toCsv=require(_0x37ca('0x8'));var querystring=require(_0x37ca('0xf'));var Papa=require('papaparse');var Redis=require(_0x37ca('0x10'));var authService=require(_0x37ca('0x11'));var qs=require(_0x37ca('0x12'));var as=require(_0x37ca('0x13'));var hardwareService=require(_0x37ca('0x14'));var logger=require(_0x37ca('0x15'))(_0x37ca('0x16'));var utils=require(_0x37ca('0x17'));var config=require(_0x37ca('0x18'));var licenseUtil=require(_0x37ca('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x882080,_0x4cdeb1){_0x4cdeb1=_0x4cdeb1||0xcc;return function(_0x5aef8f){if(_0x5aef8f){return _0x882080[_0x37ca('0x1a')](_0x4cdeb1);}return _0x882080[_0x37ca('0x1b')](_0x4cdeb1)[_0x37ca('0x1c')]();};}function respondWithResult(_0x592bd5,_0x47e11c){_0x47e11c=_0x47e11c||0xc8;return function(_0x1b8729){if(_0x1b8729){return _0x592bd5[_0x37ca('0x1b')](_0x47e11c)[_0x37ca('0x1d')](_0x1b8729);}};}function respondWithFilteredResult(_0x4eda6c,_0x48c10f){return function(_0x56d1e0){if(_0x56d1e0){var _0xf8e1fa=typeof _0x48c10f[_0x37ca('0x1e')]===_0x37ca('0x1f')&&typeof _0x48c10f[_0x37ca('0x20')]===_0x37ca('0x1f');var _0x436142=_0x56d1e0[_0x37ca('0x21')];var _0x3d8c18=_0xf8e1fa?0x0:_0x48c10f[_0x37ca('0x1e')];var _0x43769b=_0xf8e1fa?_0x56d1e0['count']:_0x48c10f[_0x37ca('0x1e')]+_0x48c10f[_0x37ca('0x20')];var _0x4ffce5;if(_0x43769b>=_0x436142){_0x43769b=_0x436142;_0x4ffce5=0xc8;}else{_0x4ffce5=0xce;}_0x4eda6c[_0x37ca('0x1b')](_0x4ffce5);return _0x4eda6c[_0x37ca('0x22')](_0x37ca('0x23'),_0x3d8c18+'-'+_0x43769b+'/'+_0x436142)['json'](_0x56d1e0);}return null;};}function patchUpdates(_0x55ffc7){return function(_0x44c02d){try{jsonpatch[_0x37ca('0x24')](_0x44c02d,_0x55ffc7,!![]);}catch(_0x29efd9){return BPromise[_0x37ca('0x25')](_0x29efd9);}return _0x44c02d[_0x37ca('0x26')]();};}function saveUpdates(_0x526197,_0x5e7d37){return function(_0x3fcf67){if(_0x3fcf67){return _0x3fcf67['update'](_0x526197)[_0x37ca('0x27')](function(_0x4b2346){return _0x4b2346;});}return null;};}function removeEntity(_0x147903,_0x2734fd){return function(_0xf06ade){if(_0xf06ade){return _0xf06ade[_0x37ca('0x28')]()['then'](function(){_0x147903[_0x37ca('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6447,_0x37392e){return function(_0x540653){if(!_0x540653){_0x2d6447[_0x37ca('0x1a')](0x194);}return _0x540653;};}function handleError(_0x4d0939,_0xcfa12e){_0xcfa12e=_0xcfa12e||0x1f4;return function(_0x27cce7){logger[_0x37ca('0x29')](_0x27cce7[_0x37ca('0x2a')]);if(_0x27cce7[_0x37ca('0x2b')]){delete _0x27cce7['name'];}_0x4d0939['status'](_0xcfa12e)[_0x37ca('0x2c')](_0x27cce7);};}var utilLicense=require('../../config/license/util');exports[_0x37ca('0x2d')]=function(_0x362603,_0xb6ce34){var _0x368cad={'raw':!![],'where':{'id':0x1}},_0x5c8d29={};_0x5c8d29[_0x37ca('0x2e')]=_['keys'](db[_0x37ca('0x2f')]['rawAttributes']);_0x5c8d29[_0x37ca('0x30')]=_[_0x37ca('0x31')](_0x362603[_0x37ca('0x30')]);_0x5c8d29[_0x37ca('0x32')]=_[_0x37ca('0x33')](_0x5c8d29[_0x37ca('0x2e')],_0x5c8d29[_0x37ca('0x30')]);_0x368cad[_0x37ca('0x34')]=_[_0x37ca('0x33')](_0x5c8d29[_0x37ca('0x2e')],qs[_0x37ca('0x35')](_0x362603['query'][_0x37ca('0x35')]));_0x368cad[_0x37ca('0x34')]=_0x368cad['attributes']['length']?_0x368cad[_0x37ca('0x34')]:_0x5c8d29['model'];_0x368cad=_[_0x37ca('0x36')]({},_0x368cad,_0x362603[_0x37ca('0x37')]);return utilLicense[_0x37ca('0x38')](_0x368cad)['then'](respondWithResult(_0xb6ce34,null))[_0x37ca('0x39')](handleError(_0xb6ce34,null));};exports['update']=function(_0x64c51a,_0x60a540){if(_0x64c51a[_0x37ca('0x3a')]['id']){delete _0x64c51a[_0x37ca('0x3a')]['id'];}return db[_0x37ca('0x2f')][_0x37ca('0x3b')]({'where':{'id':_0x64c51a[_0x37ca('0x3c')]['id']}})['then'](handleEntityNotFound(_0x60a540,null))[_0x37ca('0x27')](function(_0x571022){var _0x6553a0=_0x571022[_0x37ca('0x3d')]({'plain':!![]});return utilLicense['checkLicense'](_0x6553a0,_0x64c51a[_0x37ca('0x3a')][_0x37ca('0x3e')]);})[_0x37ca('0x27')](function(_0x5c5226){if(!_0x5c5226[_0x37ca('0x3f')]){return saveUpdates(_0x64c51a[_0x37ca('0x3a')],null);}return _0x5c5226;})[_0x37ca('0x27')](respondWithResult(_0x60a540,null))[_0x37ca('0x39')](handleError(_0x60a540,null));};exports[_0x37ca('0x40')]=function(_0xe193e7,_0x2eee12){var _0x1ce0f7=_0x37ca('0x41');var _0x155bef=path[_0x37ca('0x42')]('/var',_0x37ca('0x43'),_0x37ca('0x44'),_0x1ce0f7);_0x2eee12['setHeader']('Content-disposition',_0x37ca('0x45')+_0x1ce0f7);_0x2eee12['set'](_0x37ca('0x46'),'text/plain');_0x2eee12[_0x37ca('0x47')](_0x155bef);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 434afee..2b9f654 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 _0xa094=['bluebird','path','./license.attributes','exports','define','license','util','../../config/logger','api','moment'];(function(_0x1e83fb,_0x3cbe21){var _0x1107aa=function(_0x507984){while(--_0x507984){_0x1e83fb['push'](_0x1e83fb['shift']());}};_0x1107aa(++_0x3cbe21);}(_0xa094,0xc4));var _0x4a09=function(_0x35c081,_0x33ba76){_0x35c081=_0x35c081-0x0;var _0x1a992c=_0xa094[_0x35c081];return _0x1a992c;};'use strict';var _=require('lodash');var util=require(_0x4a09('0x0'));var logger=require(_0x4a09('0x1'))(_0x4a09('0x2'));var moment=require(_0x4a09('0x3'));var BPromise=require(_0x4a09('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a09('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4a09('0x6'));module[_0x4a09('0x7')]=function(_0x5b645f,_0x9e9d44){return _0x5b645f[_0x4a09('0x8')]('License',attributes,{'tableName':_0x4a09('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0a5=['moment','request-promise','rimraf','./license.attributes','exports','define','License','license','lodash','../../config/logger','api'];(function(_0x18e1ff,_0x3bbd67){var _0x4a03bb=function(_0x45d21a){while(--_0x45d21a){_0x18e1ff['push'](_0x18e1ff['shift']());}};_0x4a03bb(++_0x3bbd67);}(_0xe0a5,0x1e1));var _0x5e0a=function(_0x46369a,_0x141daa){_0x46369a=_0x46369a-0x0;var _0x59e91d=_0xe0a5[_0x46369a];return _0x59e91d;};'use strict';var _=require(_0x5e0a('0x0'));var util=require('util');var logger=require(_0x5e0a('0x1'))(_0x5e0a('0x2'));var moment=require(_0x5e0a('0x3'));var BPromise=require('bluebird');var rp=require(_0x5e0a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e0a('0x5'));var config=require('../../config/environment');var attributes=require(_0x5e0a('0x6'));module[_0x5e0a('0x7')]=function(_0x42de2c,_0x7d08bb){return _0x42de2c[_0x5e0a('0x8')](_0x5e0a('0x9'),attributes,{'tableName':_0x5e0a('0xa'),'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 6ae0140..e28cb13 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 _0x6694=['result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6694,0x15b));var _0x4669=function(_0x1bc6d1,_0x282364){_0x1bc6d1=_0x1bc6d1-0x0;var _0x305ded=_0x6694[_0x1bc6d1];return _0x305ded;};'use strict';var _=require(_0x4669('0x0'));var util=require(_0x4669('0x1'));var moment=require(_0x4669('0x2'));var BPromise=require(_0x4669('0x3'));var rs=require(_0x4669('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4669('0x5'));var logger=require(_0x4669('0x6'))('rpc');var config=require(_0x4669('0x7'));var jayson=require(_0x4669('0x8'));var client=jayson[_0x4669('0x9')][_0x4669('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x229a3e,_0x592a63,_0x487bca){return new BPromise(function(_0x22d773,_0x1bc680){return client[_0x4669('0xb')](_0x229a3e,_0x487bca)[_0x4669('0xc')](function(_0x16d8ae){logger[_0x4669('0xd')](_0x4669('0xe'),_0x592a63,_0x4669('0xf'));logger[_0x4669('0x10')](_0x4669('0x11'),_0x592a63,_0x4669('0xf'),JSON['stringify'](_0x16d8ae));if(_0x16d8ae[_0x4669('0x12')]){if(_0x16d8ae[_0x4669('0x12')][_0x4669('0x13')]===0x1f4){logger[_0x4669('0x12')](_0x4669('0xe'),_0x592a63,_0x16d8ae[_0x4669('0x12')]['message']);return _0x1bc680(_0x16d8ae['error'][_0x4669('0x14')]);}logger[_0x4669('0x12')](_0x4669('0xe'),_0x592a63,_0x16d8ae[_0x4669('0x12')][_0x4669('0x14')]);return _0x22d773(_0x16d8ae[_0x4669('0x12')]['message']);}else{logger[_0x4669('0xd')](_0x4669('0xe'),_0x592a63,'request\x20sent');_0x22d773(_0x16d8ae[_0x4669('0x15')][_0x4669('0x14')]);}})[_0x4669('0x16')](function(_0xe0e193){logger['error'](_0x4669('0xe'),_0x592a63,_0xe0e193);_0x1bc680(_0xe0e193);});});} \ No newline at end of file +var _0x29ef=['message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x29ef,0x12e));var _0xf29e=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x29ef[_0x324012];return _0x435cf2;};'use strict';var _=require('lodash');var util=require(_0xf29e('0x0'));var moment=require(_0xf29e('0x1'));var BPromise=require(_0xf29e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf29e('0x3'))['db'];var utils=require(_0xf29e('0x4'));var logger=require(_0xf29e('0x5'))(_0xf29e('0x6'));var config=require(_0xf29e('0x7'));var jayson=require(_0xf29e('0x8'));var client=jayson['client'][_0xf29e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x470b02,_0x18c9b5,_0x378cb4){return new BPromise(function(_0x44cc1f,_0x52fa5e){return client[_0xf29e('0xa')](_0x470b02,_0x378cb4)[_0xf29e('0xb')](function(_0x5d1c3a){logger[_0xf29e('0xc')](_0xf29e('0xd'),_0x18c9b5,_0xf29e('0xe'));logger[_0xf29e('0xf')](_0xf29e('0x10'),_0x18c9b5,_0xf29e('0xe'),JSON[_0xf29e('0x11')](_0x5d1c3a));if(_0x5d1c3a['error']){if(_0x5d1c3a['error'][_0xf29e('0x12')]===0x1f4){logger[_0xf29e('0x13')](_0xf29e('0xd'),_0x18c9b5,_0x5d1c3a['error'][_0xf29e('0x14')]);return _0x52fa5e(_0x5d1c3a['error'][_0xf29e('0x14')]);}logger[_0xf29e('0x13')]('License,\x20%s,\x20%s',_0x18c9b5,_0x5d1c3a[_0xf29e('0x13')]['message']);return _0x44cc1f(_0x5d1c3a[_0xf29e('0x13')][_0xf29e('0x14')]);}else{logger[_0xf29e('0xc')](_0xf29e('0xd'),_0x18c9b5,_0xf29e('0xe'));_0x44cc1f(_0x5d1c3a[_0xf29e('0x15')][_0xf29e('0x14')]);}})[_0xf29e('0x16')](function(_0x5e2bf4){logger[_0xf29e('0x13')](_0xf29e('0xd'),_0x18c9b5,_0x5e2bf4);_0x52fa5e(_0x5e2bf4);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index e2d0333..307ad85 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 _0x526c=['send','addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send'];(function(_0x2c50e4,_0x15cd2f){var _0x474118=function(_0xb0201){while(--_0xb0201){_0x2c50e4['push'](_0x2c50e4['shift']());}};_0x474118(++_0x15cd2f);}(_0x526c,0x1bb));var _0xc526=function(_0x1dd8f6,_0x3ea487){_0x1dd8f6=_0x1dd8f6-0x0;var _0xf083b7=_0x526c[_0x1dd8f6];return _0xf083b7;};'use strict';var multer=require('multer');var util=require(_0xc526('0x0'));var path=require(_0xc526('0x1'));var timeout=require(_0xc526('0x2'));var express=require(_0xc526('0x3'));var router=express[_0xc526('0x4')]();var fs_extra=require(_0xc526('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc526('0x6'));var config=require(_0xc526('0x7'));var controller=require('./mailAccount.controller');router[_0xc526('0x8')]('/',auth[_0xc526('0x9')](),controller[_0xc526('0xa')]);router[_0xc526('0x8')](_0xc526('0xb'),auth['isAuthenticated'](),controller[_0xc526('0xc')]);router[_0xc526('0x8')](_0xc526('0xd'),auth[_0xc526('0x9')](),controller['show']);router[_0xc526('0x8')]('/:id/dispositions',auth[_0xc526('0x9')](),controller['getDispositions']);router['get'](_0xc526('0xe'),auth['isAuthenticated'](),controller[_0xc526('0xf')]);router[_0xc526('0x8')](_0xc526('0x10'),auth['isAuthenticated'](),controller[_0xc526('0x11')]);router[_0xc526('0x8')](_0xc526('0x12'),auth[_0xc526('0x9')](),controller[_0xc526('0x13')]);router[_0xc526('0x8')](_0xc526('0x14'),auth[_0xc526('0x9')](),controller[_0xc526('0x15')]);router[_0xc526('0x8')](_0xc526('0x16'),auth['isAuthenticated'](),controller['getApplications']);router[_0xc526('0x8')](_0xc526('0x17'),auth[_0xc526('0x9')](),controller['getMessages']);router[_0xc526('0x8')](_0xc526('0x18'),auth[_0xc526('0x9')](),controller[_0xc526('0x19')]);router['get'](_0xc526('0x1a'),auth[_0xc526('0x9')](),controller[_0xc526('0x1b')]);router[_0xc526('0x1c')](_0xc526('0x1d'),auth[_0xc526('0x9')](),controller['addDisposition']);router[_0xc526('0x1c')](_0xc526('0xe'),auth[_0xc526('0x9')](),controller[_0xc526('0x1e')]);router['post']('/',auth[_0xc526('0x9')](),controller[_0xc526('0x1f')]);router['post'](_0xc526('0x10'),auth[_0xc526('0x9')](),controller[_0xc526('0x20')]);router[_0xc526('0x1c')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xc526('0x21')]);router[_0xc526('0x1c')](_0xc526('0x14'),auth[_0xc526('0x9')](),controller[_0xc526('0x22')]);router['post'](_0xc526('0x16'),auth[_0xc526('0x9')](),controller[_0xc526('0x23')]);router[_0xc526('0x1c')](_0xc526('0x24'),auth[_0xc526('0x9')](),controller[_0xc526('0x25')]);router[_0xc526('0x1c')](_0xc526('0x1a'),auth[_0xc526('0x9')](),controller[_0xc526('0x26')]);router[_0xc526('0x27')](_0xc526('0xd'),auth[_0xc526('0x9')](),controller[_0xc526('0x28')]);router[_0xc526('0x29')](_0xc526('0x1d'),auth[_0xc526('0x9')](),controller['removeDispositions']);router[_0xc526('0x29')](_0xc526('0xe'),auth[_0xc526('0x9')](),controller[_0xc526('0x2a')]);router['delete'](_0xc526('0x10'),auth['isAuthenticated'](),controller[_0xc526('0x2b')]);router['delete'](_0xc526('0x12'),auth[_0xc526('0x9')](),controller[_0xc526('0x2c')]);router[_0xc526('0x29')](_0xc526('0xd'),auth[_0xc526('0x9')](),controller[_0xc526('0x2d')]);router[_0xc526('0x29')]('/:id/users',auth[_0xc526('0x9')](),controller[_0xc526('0x2e')]);module[_0xc526('0x2f')]=router; \ No newline at end of file +var _0x520e=['index','isAuthenticated','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/messages','/:id/verify','verifySmtp','/:id/users','post','/:id/dispositions','addDisposition','create','addImap','addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','put','delete','removeDispositions','removeAnswers','removeSmtp','destroy','multer','util','path','express','Router','./mailAccount.controller','get'];(function(_0x19dd8a,_0x449861){var _0x212ccc=function(_0x4f52b6){while(--_0x4f52b6){_0x19dd8a['push'](_0x19dd8a['shift']());}};_0x212ccc(++_0x449861);}(_0x520e,0x141));var _0xe520=function(_0x3f1710,_0x3877a2){_0x3f1710=_0x3f1710-0x0;var _0x528458=_0x520e[_0x3f1710];return _0x528458;};'use strict';var multer=require(_0xe520('0x0'));var util=require(_0xe520('0x1'));var path=require(_0xe520('0x2'));var timeout=require('connect-timeout');var express=require(_0xe520('0x3'));var router=express[_0xe520('0x4')]();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(_0xe520('0x5'));router[_0xe520('0x6')]('/',auth['isAuthenticated'](),controller[_0xe520('0x7')]);router[_0xe520('0x6')]('/describe',auth[_0xe520('0x8')](),controller[_0xe520('0x9')]);router[_0xe520('0x6')](_0xe520('0xa'),auth[_0xe520('0x8')](),controller[_0xe520('0xb')]);router[_0xe520('0x6')]('/:id/dispositions',auth[_0xe520('0x8')](),controller['getDispositions']);router[_0xe520('0x6')](_0xe520('0xc'),auth[_0xe520('0x8')](),controller[_0xe520('0xd')]);router[_0xe520('0x6')](_0xe520('0xe'),auth[_0xe520('0x8')](),controller[_0xe520('0xf')]);router[_0xe520('0x6')](_0xe520('0x10'),auth[_0xe520('0x8')](),controller[_0xe520('0x11')]);router[_0xe520('0x6')](_0xe520('0x12'),auth[_0xe520('0x8')](),controller[_0xe520('0x13')]);router[_0xe520('0x6')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xe520('0x6')](_0xe520('0x14'),auth[_0xe520('0x8')](),controller['getMessages']);router[_0xe520('0x6')](_0xe520('0x15'),auth[_0xe520('0x8')](),controller[_0xe520('0x16')]);router[_0xe520('0x6')](_0xe520('0x17'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe520('0x18')](_0xe520('0x19'),auth['isAuthenticated'](),controller[_0xe520('0x1a')]);router[_0xe520('0x18')](_0xe520('0xc'),auth[_0xe520('0x8')](),controller['addAnswer']);router[_0xe520('0x18')]('/',auth['isAuthenticated'](),controller[_0xe520('0x1b')]);router[_0xe520('0x18')](_0xe520('0xe'),auth['isAuthenticated'](),controller[_0xe520('0x1c')]);router[_0xe520('0x18')](_0xe520('0x10'),auth['isAuthenticated'](),controller['addSmtp']);router[_0xe520('0x18')](_0xe520('0x12'),auth[_0xe520('0x8')](),controller[_0xe520('0x1d')]);router[_0xe520('0x18')](_0xe520('0x1e'),auth[_0xe520('0x8')](),controller[_0xe520('0x1f')]);router['post'](_0xe520('0x20'),auth[_0xe520('0x8')](),controller[_0xe520('0x21')]);router[_0xe520('0x18')](_0xe520('0x17'),auth[_0xe520('0x8')](),controller[_0xe520('0x22')]);router[_0xe520('0x23')](_0xe520('0xa'),auth[_0xe520('0x8')](),controller['update']);router[_0xe520('0x24')](_0xe520('0x19'),auth[_0xe520('0x8')](),controller[_0xe520('0x25')]);router['delete'](_0xe520('0xc'),auth[_0xe520('0x8')](),controller[_0xe520('0x26')]);router[_0xe520('0x24')]('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router['delete'](_0xe520('0x10'),auth['isAuthenticated'](),controller[_0xe520('0x27')]);router[_0xe520('0x24')](_0xe520('0xa'),auth[_0xe520('0x8')](),controller[_0xe520('0x28')]);router['delete'](_0xe520('0x17'),auth[_0xe520('0x8')](),controller['removeAgents']);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 5f1766d..bc4a11d 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 _0xaba9=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','getDataValue','provider','custom','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xaba9,0x95));var _0x9aba=function(_0x509081,_0x144a1c){_0x509081=_0x509081-0x0;var _0x516423=_0xaba9[_0x509081];return _0x516423;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x9aba('0x0')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9aba('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9aba('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x9aba('0x2')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9aba('0x0')],'allowNull':![],'defaultValue':_0x9aba('0x3')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x9aba('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9aba('0x2')],'defaultValue':function(){return _0x9aba('0x5');}},'notificationSound':{'type':Sequelize[_0x9aba('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9aba('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9aba('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9aba('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9aba('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9aba('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x9aba('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x9aba('0x1')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1cbf0b){if(!_0x1cbf0b)this[_0x9aba('0x8')](_0x9aba('0x9'),null);this[_0x9aba('0x8')](_0x9aba('0xa'),_0x1cbf0b);}},'provider':{'type':Sequelize['ENUM']('gmail','hotmail','yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this[_0x9aba('0xb')](_0x9aba('0xc')))return _0x9aba('0xd');return this[_0x9aba('0xb')]('provider');},'set':function(_0x3ab5bb){if(_0x3ab5bb==='custom')_0x3ab5bb=null;return this[_0x9aba('0x8')](_0x9aba('0xc'),_0x3ab5bb);}}}; \ No newline at end of file +var _0x25f8=['Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','getDataValue','provider','custom','exports','STRING','BOOLEAN'];(function(_0x261d1b,_0x10174c){var _0x1132c1=function(_0x5bf198){while(--_0x5bf198){_0x261d1b['push'](_0x261d1b['shift']());}};_0x1132c1(++_0x10174c);}(_0x25f8,0x141));var _0x825f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x25f8[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x825f('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x825f('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x825f('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x825f('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x825f('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x825f('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x825f('0x1')],'allowNull':![],'defaultValue':_0x825f('0x3')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x825f('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x825f('0x5');}},'notificationSound':{'type':Sequelize[_0x825f('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x825f('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x825f('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x825f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x825f('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x825f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x825f('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x825f('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x825f('0x8'),'set':function(_0xee4fd8){if(!_0xee4fd8)this[_0x825f('0x9')]('mandatoryDispositionPauseId',null);this[_0x825f('0x9')](_0x825f('0xa'),_0xee4fd8);}},'provider':{'type':Sequelize[_0x825f('0xb')]('gmail',_0x825f('0xc'),_0x825f('0xd'),_0x825f('0xe')),'defaultValue':null,'get':function(){if(!this[_0x825f('0xf')](_0x825f('0x10')))return _0x825f('0x11');return this[_0x825f('0xf')]('provider');},'set':function(_0x50464f){if(_0x50464f===_0x825f('0x11'))_0x50464f=null;return this[_0x825f('0x9')](_0x825f('0x10'),_0x50464f);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 2542e8a..25eaedb 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 _0xea4a=['redis','defaults','socket.io-emitter','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','offset','limit','undefined','count','set','update','destroy','stack','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','MailAccount','rows','show','includeAll','include','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','params','MailAccountId','create','getDispositions','findOne','Disposition','nolimit','order','findAll','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','name','email','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailAccounts','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','getInteractions','Contact','Owner','internal','Tag','color','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','CmList','CmContact','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','List','List\x20not\x20found','Contacts','subject','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','User','bluebird','lodash','juice','../../components/parsers/qs','../../config/logger','api'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xea4a,0xb1));var _0xaea4=function(_0x41bea7,_0x261018){_0x41bea7=_0x41bea7-0x0;var _0x50d4b6=_0xea4a[_0x41bea7];return _0x50d4b6;};'use strict';var moment=require('moment');var BPromise=require(_0xaea4('0x0'));var util=require('util');var path=require('path');var _=require(_0xaea4('0x1'));var juice=require(_0xaea4('0x2'));var Redis=require('ioredis');var qs=require(_0xaea4('0x3'));var logger=require(_0xaea4('0x4'))(_0xaea4('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xaea4('0x6')]=_[_0xaea4('0x7')](config[_0xaea4('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xaea4('0x8'))(new Redis(config[_0xaea4('0x6')]));require('./mailAccount.socket')[_0xaea4('0x9')](socket);var jayson=require('jayson/promise');var client=jayson[_0xaea4('0xa')][_0xaea4('0xb')]({'port':0x232b});function respondWithRpcPromise(_0x42fa47,_0x38fe48,_0x3aef2f,_0x1a1993){return new BPromise(function(_0x55ec0a,_0x1848d0){var _0x142e6e=_0x1a1993||client;return _0x142e6e[_0xaea4('0xc')](_0x42fa47,_0x3aef2f)[_0xaea4('0xd')](function(_0x241fd3){logger[_0xaea4('0xe')](_0xaea4('0xf'),_0x38fe48,_0xaea4('0x10'));logger['debug'](_0xaea4('0x11'),_0x38fe48,_0xaea4('0x10'),JSON['stringify'](_0x241fd3));if(_0x241fd3[_0xaea4('0x12')]){if(_0x241fd3['error'][_0xaea4('0x13')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x38fe48,_0x241fd3[_0xaea4('0x12')][_0xaea4('0x14')]);return _0x1848d0(_0x241fd3[_0xaea4('0x12')][_0xaea4('0x14')]);}logger[_0xaea4('0x12')]('MailAccount,\x20%s,\x20%s',_0x38fe48,_0x241fd3['error'][_0xaea4('0x14')]);return _0x55ec0a(_0x241fd3[_0xaea4('0x12')]['message']);}else{logger['info'](_0xaea4('0xf'),_0x38fe48,'request\x20sent');_0x55ec0a(_0x241fd3[_0xaea4('0x15')][_0xaea4('0x14')]);}})[_0xaea4('0x16')](function(_0x1af1c4){logger[_0xaea4('0x12')](_0xaea4('0xf'),_0x38fe48,_0x1af1c4);_0x1848d0(_0x1af1c4);});});}function respondWithStatusCode(_0x39a9f0,_0x22f555){_0x22f555=_0x22f555||0xcc;return function(_0x3f7996){if(_0x3f7996){return _0x39a9f0['sendStatus'](_0x22f555);}return _0x39a9f0['status'](_0x22f555)[_0xaea4('0x17')]();};}function respondWithResult(_0x2a12f9,_0x25f1f7){_0x25f1f7=_0x25f1f7||0xc8;return function(_0x14a449){if(_0x14a449){return _0x2a12f9[_0xaea4('0x18')](_0x25f1f7)[_0xaea4('0x19')](_0x14a449);}};}function respondWithFilteredResult(_0x3df7ec,_0x4fb576){return function(_0x41b991){if(_0x41b991){var _0x24ed6f=typeof _0x4fb576[_0xaea4('0x1a')]==='undefined'&&typeof _0x4fb576[_0xaea4('0x1b')]===_0xaea4('0x1c');var _0x23fe44=_0x41b991[_0xaea4('0x1d')];var _0x180916=_0x24ed6f?0x0:_0x4fb576['offset'];var _0x1d8f3e=_0x24ed6f?_0x41b991['count']:_0x4fb576[_0xaea4('0x1a')]+_0x4fb576[_0xaea4('0x1b')];var _0x1154ec;if(_0x1d8f3e>=_0x23fe44){_0x1d8f3e=_0x23fe44;_0x1154ec=0xc8;}else{_0x1154ec=0xce;}_0x3df7ec[_0xaea4('0x18')](_0x1154ec);return _0x3df7ec[_0xaea4('0x1e')]('Content-Range',_0x180916+'-'+_0x1d8f3e+'/'+_0x23fe44)[_0xaea4('0x19')](_0x41b991);}return null;};}function saveUpdates(_0x400691){return function(_0x1b793d){if(_0x1b793d){return _0x1b793d[_0xaea4('0x1f')](_0x400691)[_0xaea4('0xd')](function(_0x418bd3){return _0x418bd3;});}return null;};}function removeEntity(_0x158c5a){return function(_0x14d440){if(_0x14d440){return _0x14d440[_0xaea4('0x20')]()[_0xaea4('0xd')](function(){var _0x5cce82=_0x14d440['get']({'plain':!![]});var _0x5b8551='MailAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x5b8551,'resourceId':_0x5cce82['id']}})[_0xaea4('0xd')](function(){return _0x14d440;});})[_0xaea4('0xd')](function(){_0x158c5a[_0xaea4('0x18')](0xcc)[_0xaea4('0x17')]();});}};}function handleEntityNotFound(_0x1f1e3c){return function(_0x2b3bbb){if(!_0x2b3bbb){_0x1f1e3c['sendStatus'](0x194);}return _0x2b3bbb;};}function handleError(_0x401b19,_0x2e39fe){_0x2e39fe=_0x2e39fe||0x1f4;return function(_0x98bde0){logger[_0xaea4('0x12')](_0x98bde0[_0xaea4('0x21')]);if(_0x98bde0['name']){delete _0x98bde0['name'];}_0x401b19[_0xaea4('0x18')](_0x2e39fe)[_0xaea4('0x22')](_0x98bde0);};}function getImapHost(_0x55667e){switch(_0x55667e){case _0xaea4('0x23'):return'imap.gmail.com';case _0xaea4('0x24'):return _0xaea4('0x25');case _0xaea4('0x26'):return _0xaea4('0x27');case'outlook365':return'outlook.office365.com';}throw new Error(_0xaea4('0x28'),_0x55667e);}function getSmtpHost(_0x531a07){switch(_0x531a07){case _0xaea4('0x23'):return'smtp.gmail.com';case'yahoo':return _0xaea4('0x29');case _0xaea4('0x26'):return _0xaea4('0x2a');case'outlook365':return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x531a07);}function getAuthenticationOptions(_0x25ec5b,_0x35dc26){var _0x1dca53={};var _0x3789d6={};if(_0x25ec5b){_0x1dca53[_0xaea4('0x2b')]=_0x3789d6[_0xaea4('0x2b')]=_0x35dc26[_0xaea4('0x2c')];_0x1dca53[_0xaea4('0x2d')]=_0x3789d6[_0xaea4('0x2e')]=_0x35dc26['password'];if(_0x35dc26['modernAuthentication']){_0x1dca53[_0xaea4('0x2f')]=_0x3789d6[_0xaea4('0x2f')]=!![];_0x1dca53['CloudProviderId']=_0x3789d6[_0xaea4('0x30')]=_0x35dc26[_0xaea4('0x30')];_0x1dca53[_0xaea4('0x2d')]=_0x3789d6[_0xaea4('0x2e')]=null;}else{_0x1dca53[_0xaea4('0x30')]=_0x3789d6[_0xaea4('0x30')]=null;}_0x1dca53[_0xaea4('0x31')]=getImapHost(_0x25ec5b);_0x1dca53[_0xaea4('0x32')]=0x3e1;_0x3789d6[_0xaea4('0x31')]=getSmtpHost(_0x25ec5b);_0x3789d6[_0xaea4('0x32')]=0x24b;_0x3789d6[_0xaea4('0x33')]=![];_0x1dca53[_0xaea4('0x34')]=_0x3789d6[_0xaea4('0x34')]=null;}else{if(_0x35dc26[_0xaea4('0x35')]){_0x1dca53[_0xaea4('0x2b')]=_0x3789d6['user']=_0x35dc26[_0xaea4('0x2c')];_0x1dca53[_0xaea4('0x2d')]=_0x3789d6[_0xaea4('0x2e')]=_0x35dc26['password'];}else{_0x1dca53[_0xaea4('0x35')]=_0x3789d6['authentication']=![];_0x1dca53[_0xaea4('0x2b')]=_0x3789d6[_0xaea4('0x2b')]=null;_0x1dca53[_0xaea4('0x2d')]=_0x3789d6[_0xaea4('0x2e')]=null;}_0x1dca53['host']=_0x35dc26[_0xaea4('0x36')]['host'];_0x1dca53[_0xaea4('0x32')]=_0x35dc26['Imap'][_0xaea4('0x32')];_0x3789d6[_0xaea4('0x31')]=_0x35dc26['Smtp'][_0xaea4('0x31')];_0x3789d6[_0xaea4('0x32')]=_0x35dc26[_0xaea4('0x37')][_0xaea4('0x32')];}return{'Imap':_0x1dca53,'Smtp':_0x3789d6};}exports[_0xaea4('0x38')]=function(_0x28d227,_0x1f0ff6){var _0x5d8c79={'include':[{'model':db[_0xaea4('0x39')],'as':_0xaea4('0x36')},{'model':db[_0xaea4('0x3a')],'as':_0xaea4('0x37')},{'model':db[_0xaea4('0x3b')],'as':_0xaea4('0x3c')}]},_0x3e95c3={},_0x98ca09={'count':0x0,'rows':[]};var _0x21de70=_[_0xaea4('0x3d')](db['MailAccount'][_0xaea4('0x3e')],function(_0x218d2c){return{'name':_0x218d2c[_0xaea4('0x3f')],'type':_0x218d2c['type'][_0xaea4('0x40')]};});_0x3e95c3[_0xaea4('0x41')]=_['map'](_0x21de70,'name');_0x3e95c3[_0xaea4('0x42')]=_[_0xaea4('0x43')](_0x28d227[_0xaea4('0x42')]);_0x3e95c3[_0xaea4('0x44')]=_[_0xaea4('0x45')](_0x3e95c3[_0xaea4('0x41')],_0x3e95c3['query']);_0x5d8c79[_0xaea4('0x46')]=_[_0xaea4('0x45')](_0x3e95c3[_0xaea4('0x41')],qs[_0xaea4('0x47')](_0x28d227[_0xaea4('0x42')][_0xaea4('0x47')]));_0x5d8c79[_0xaea4('0x46')]=_0x5d8c79[_0xaea4('0x46')][_0xaea4('0x48')]?_0x5d8c79['attributes']:_0x3e95c3[_0xaea4('0x41')];if(!_0x28d227[_0xaea4('0x42')][_0xaea4('0x49')]('nolimit')){_0x5d8c79['limit']=qs[_0xaea4('0x1b')](_0x28d227[_0xaea4('0x42')][_0xaea4('0x1b')]);_0x5d8c79[_0xaea4('0x1a')]=qs[_0xaea4('0x1a')](_0x28d227[_0xaea4('0x42')]['offset']);}_0x5d8c79['order']=qs['sort'](_0x28d227[_0xaea4('0x42')][_0xaea4('0x4a')]);_0x5d8c79[_0xaea4('0x4b')]=qs[_0xaea4('0x44')](_[_0xaea4('0x4c')](_0x28d227['query'],_0x3e95c3[_0xaea4('0x44')]),_0x21de70);if(_0x28d227[_0xaea4('0x42')][_0xaea4('0x4d')]){_0x5d8c79[_0xaea4('0x4b')]=_[_0xaea4('0x4e')](_0x5d8c79['where'],{'$or':_['map'](_0x21de70,function(_0x4825f9){if(_0x4825f9[_0xaea4('0x4f')]!==_0xaea4('0x50')){var _0x479f29={};_0x479f29[_0x4825f9['name']]={'$like':'%'+_0x28d227['query'][_0xaea4('0x4d')]+'%'};return _0x479f29;}})});}_0x5d8c79=_[_0xaea4('0x4e')]({},_0x5d8c79,_0x28d227[_0xaea4('0x51')]);var _0x350bf7={'where':_0x5d8c79[_0xaea4('0x4b')]};return db[_0xaea4('0x52')][_0xaea4('0x1d')](_0x350bf7)['then'](function(_0x1754d9){_0x98ca09[_0xaea4('0x1d')]=_0x1754d9;if(_0x28d227['query']['includeAll']){_0x5d8c79['include']=[{'all':!![]}];}return db[_0xaea4('0x52')]['findAll'](_0x5d8c79);})['then'](function(_0x11df51){_0x98ca09[_0xaea4('0x53')]=_0x11df51;return _0x98ca09;})[_0xaea4('0xd')](respondWithFilteredResult(_0x1f0ff6,_0x5d8c79))['catch'](handleError(_0x1f0ff6,null));};exports[_0xaea4('0x54')]=function(_0x2f3341,_0x3b2e94){var _0x592c4f={'raw':![],'where':{'id':_0x2f3341['params']['id']},'include':[{'model':db[_0xaea4('0x39')],'as':_0xaea4('0x36')},{'model':db[_0xaea4('0x3a')],'as':_0xaea4('0x37')},{'model':db['Pause'],'as':_0xaea4('0x3c')}]},_0x3a15fb={};_0x3a15fb[_0xaea4('0x41')]=_[_0xaea4('0x43')](db[_0xaea4('0x52')]['rawAttributes']);_0x3a15fb[_0xaea4('0x42')]=_[_0xaea4('0x43')](_0x2f3341['query']);_0x3a15fb['filters']=_[_0xaea4('0x45')](_0x3a15fb[_0xaea4('0x41')],_0x3a15fb[_0xaea4('0x42')]);_0x592c4f[_0xaea4('0x46')]=_['intersection'](_0x3a15fb[_0xaea4('0x41')],qs[_0xaea4('0x47')](_0x2f3341['query']['fields']));_0x592c4f[_0xaea4('0x46')]=_0x592c4f[_0xaea4('0x46')]['length']?_0x592c4f[_0xaea4('0x46')]:_0x3a15fb[_0xaea4('0x41')];if(_0x2f3341[_0xaea4('0x42')][_0xaea4('0x55')]){_0x592c4f[_0xaea4('0x56')]=[{'all':!![]}];}_0x592c4f=_[_0xaea4('0x4e')]({},_0x592c4f,_0x2f3341['options']);return db[_0xaea4('0x52')][_0xaea4('0x57')](_0x592c4f)[_0xaea4('0xd')](handleEntityNotFound(_0x3b2e94,null))[_0xaea4('0xd')](respondWithResult(_0x3b2e94,null))[_0xaea4('0x16')](handleError(_0x3b2e94,null));};exports[_0xaea4('0x1f')]=function(_0x3861aa,_0x34f950){if(_0x3861aa[_0xaea4('0x58')]['id']){delete _0x3861aa[_0xaea4('0x58')]['id'];}var _0x1b1c1f=_0x3861aa[_0xaea4('0x58')][_0xaea4('0x59')]===_0xaea4('0x5a')?null:_0x3861aa[_0xaea4('0x58')][_0xaea4('0x59')];var _0x1db690=_0x3861aa['body'][_0xaea4('0x36')]||{};var _0x58785b=_0x3861aa[_0xaea4('0x58')]['Smtp']||{};if(_0x1b1c1f){_0x1db690['host']=getImapHost(_0x1b1c1f);_0x1db690['port']=0x3e1;_0x58785b[_0xaea4('0x31')]=getSmtpHost(_0x1b1c1f);_0x58785b[_0xaea4('0x32')]=0x24b;_0x58785b[_0xaea4('0x33')]=![];}if(_0x58785b['modernAuthentication']){_0x58785b[_0xaea4('0x33')]=![];}else{_0x58785b[_0xaea4('0x30')]=null;}if(!_0x1db690[_0xaea4('0x2f')])_0x1db690[_0xaea4('0x30')]=null;_0x3861aa[_0xaea4('0x58')][_0xaea4('0x36')]=_0x1db690;_0x3861aa[_0xaea4('0x58')][_0xaea4('0x37')]=_0x58785b;return db[_0xaea4('0x52')][_0xaea4('0x57')]({'where':{'id':_0x3861aa['params']['id']},'include':[{'model':db[_0xaea4('0x39')],'as':_0xaea4('0x36')},{'model':db[_0xaea4('0x3a')],'as':_0xaea4('0x37')},{'model':db['Pause'],'as':_0xaea4('0x3c')}]})[_0xaea4('0xd')](handleEntityNotFound(_0x34f950,null))[_0xaea4('0xd')](function(_0x1b1399){if(!_0x1b1399)throw new Error(_0xaea4('0x5b'));if(_0x1b1399[_0xaea4('0x34')])delete _0x3861aa['body'][_0xaea4('0x36')];return _0x1b1399;})['then'](saveUpdates(_0x3861aa[_0xaea4('0x58')],null))[_0xaea4('0xd')](function(_0x46dbe8){if(!_0x3861aa[_0xaea4('0x58')][_0xaea4('0x36')])return _0x46dbe8;return db[_0xaea4('0x39')][_0xaea4('0x1f')](_0x3861aa[_0xaea4('0x58')]['Imap'],{'where':{'MailAccountId':_0x46dbe8['id']}})['then'](function(){return _0x46dbe8;});})[_0xaea4('0xd')](function(_0x22e5d8){if(!_0x3861aa['body'][_0xaea4('0x37')])return _0x22e5d8;return db[_0xaea4('0x3a')]['update'](_0x3861aa[_0xaea4('0x58')][_0xaea4('0x37')],{'where':{'MailAccountId':_0x22e5d8['id']}})[_0xaea4('0xd')](function(){return _0x22e5d8;});})['then'](respondWithResult(_0x34f950,null))[_0xaea4('0x16')](handleError(_0x34f950,null));};exports[_0xaea4('0x5c')]=function(_0x2571cc,_0x417136){return db[_0xaea4('0x52')]['describe']()[_0xaea4('0xd')](respondWithResult(_0x417136,null))[_0xaea4('0x16')](handleError(_0x417136,null));};exports[_0xaea4('0x5d')]=function(_0x2bb648,_0x57134b){if(_0x2bb648[_0xaea4('0x58')]['id']){delete _0x2bb648[_0xaea4('0x58')]['id'];}return db[_0xaea4('0x52')][_0xaea4('0x57')]({'where':{'id':_0x2bb648[_0xaea4('0x5e')]['id']}})[_0xaea4('0xd')](handleEntityNotFound(_0x57134b,null))['then'](function(_0x14d0a3){if(_0x14d0a3){_0x2bb648['body'][_0xaea4('0x5f')]=_0x14d0a3['id'];return db['Disposition'][_0xaea4('0x60')](_0x2bb648['body']);}})['then'](respondWithResult(_0x57134b,null))['catch'](handleError(_0x57134b,null));};exports[_0xaea4('0x61')]=function(_0x4e5452,_0x576ec5){var _0x293e19={'raw':![],'where':{}};var _0x52fca7={};var _0x1aa2b7={'count':0x0,'rows':[]};return db['MailAccount'][_0xaea4('0x62')]({'where':{'id':_0x4e5452[_0xaea4('0x5e')]['id']}})[_0xaea4('0xd')](handleEntityNotFound(_0x576ec5,null))[_0xaea4('0xd')](function(_0x1ce6af){if(_0x1ce6af){_0x52fca7['model']=_[_0xaea4('0x43')](db[_0xaea4('0x63')][_0xaea4('0x3e')]);_0x52fca7[_0xaea4('0x42')]=_[_0xaea4('0x43')](_0x4e5452[_0xaea4('0x42')]);_0x52fca7[_0xaea4('0x44')]=_['intersection'](_0x52fca7[_0xaea4('0x41')],_0x52fca7[_0xaea4('0x42')]);_0x293e19['attributes']=_[_0xaea4('0x45')](_0x52fca7[_0xaea4('0x41')],qs[_0xaea4('0x47')](_0x4e5452['query'][_0xaea4('0x47')]));_0x293e19['attributes']=_0x293e19[_0xaea4('0x46')][_0xaea4('0x48')]?_0x293e19['attributes']:_0x52fca7[_0xaea4('0x41')];if(!_0x4e5452['query'][_0xaea4('0x49')](_0xaea4('0x64'))){_0x293e19[_0xaea4('0x1b')]=qs['limit'](_0x4e5452[_0xaea4('0x42')]['limit']);_0x293e19[_0xaea4('0x1a')]=qs['offset'](_0x4e5452['query']['offset']);}_0x293e19[_0xaea4('0x65')]=qs[_0xaea4('0x4a')](_0x4e5452[_0xaea4('0x42')][_0xaea4('0x4a')]);_0x293e19[_0xaea4('0x4b')]=qs['filters'](_['pick'](_0x4e5452['query'],_0x52fca7[_0xaea4('0x44')]));_0x293e19[_0xaea4('0x4b')][_0xaea4('0x5f')]=_0x1ce6af['id'];if(_0x4e5452['query']['filter']){_0x293e19[_0xaea4('0x4b')]=_[_0xaea4('0x4e')](_0x293e19[_0xaea4('0x4b')],{'$or':_[_0xaea4('0x3d')](_0x293e19['attributes'],function(_0x105213){var _0x4b2155={};_0x4b2155[_0x105213]={'$like':'%'+_0x4e5452[_0xaea4('0x42')][_0xaea4('0x4d')]+'%'};return _0x4b2155;})});}_0x293e19=_[_0xaea4('0x4e')]({},_0x293e19,_0x4e5452[_0xaea4('0x51')]);return db['Disposition'][_0xaea4('0x1d')]({'where':_0x293e19['where']})[_0xaea4('0xd')](function(_0x4e6cfc){_0x1aa2b7['count']=_0x4e6cfc;if(_0x4e5452['query'][_0xaea4('0x55')]){_0x293e19[_0xaea4('0x56')]=[{'all':!![]}];}return db[_0xaea4('0x63')][_0xaea4('0x66')](_0x293e19);})[_0xaea4('0xd')](function(_0x4f9089){_0x1aa2b7[_0xaea4('0x53')]=_0x4f9089;return _0x1aa2b7;});}})[_0xaea4('0xd')](respondWithFilteredResult(_0x576ec5,_0x293e19))[_0xaea4('0x16')](handleError(_0x576ec5,null));};exports[_0xaea4('0x67')]=function(_0x49e60d,_0x2b21ab){return db[_0xaea4('0x52')][_0xaea4('0x57')]({'where':{'id':_0x49e60d[_0xaea4('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2b21ab,null))[_0xaea4('0xd')](function(_0x56f7c2){if(_0x56f7c2){return _0x56f7c2[_0xaea4('0x67')](_0x49e60d[_0xaea4('0x42')][_0xaea4('0x68')]);}})[_0xaea4('0xd')](respondWithStatusCode(_0x2b21ab,null))['catch'](handleError(_0x2b21ab,null));};exports['addAnswer']=function(_0xc3feca,_0x12a622){if(_0xc3feca[_0xaea4('0x58')]['id']){delete _0xc3feca[_0xaea4('0x58')]['id'];}return db[_0xaea4('0x52')]['find']({'where':{'id':_0xc3feca[_0xaea4('0x5e')]['id']}})[_0xaea4('0xd')](handleEntityNotFound(_0x12a622,null))['then'](function(_0x55999f){if(_0x55999f){_0xc3feca['body'][_0xaea4('0x5f')]=_0x55999f['id'];return db['CannedAnswer']['create'](_0xc3feca['body']);}})[_0xaea4('0xd')](respondWithResult(_0x12a622,null))[_0xaea4('0x16')](handleError(_0x12a622,null));};exports[_0xaea4('0x69')]=function(_0x489be2,_0x1d1d62){var _0x166559={'raw':![],'where':{}};var _0x955626={};var _0x596491={'count':0x0,'rows':[]};return db['MailAccount'][_0xaea4('0x62')]({'where':{'id':_0x489be2[_0xaea4('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1d1d62,null))[_0xaea4('0xd')](function(_0x35865d){if(_0x35865d){_0x955626[_0xaea4('0x41')]=_['keys'](db[_0xaea4('0x6a')][_0xaea4('0x3e')]);_0x955626[_0xaea4('0x42')]=_[_0xaea4('0x43')](_0x489be2[_0xaea4('0x42')]);_0x955626[_0xaea4('0x44')]=_['intersection'](_0x955626[_0xaea4('0x41')],_0x955626[_0xaea4('0x42')]);_0x166559['attributes']=_[_0xaea4('0x45')](_0x955626[_0xaea4('0x41')],qs[_0xaea4('0x47')](_0x489be2[_0xaea4('0x42')][_0xaea4('0x47')]));_0x166559['attributes']=_0x166559[_0xaea4('0x46')][_0xaea4('0x48')]?_0x166559[_0xaea4('0x46')]:_0x955626['model'];if(!_0x489be2[_0xaea4('0x42')][_0xaea4('0x49')]('nolimit')){_0x166559['limit']=qs[_0xaea4('0x1b')](_0x489be2[_0xaea4('0x42')]['limit']);_0x166559['offset']=qs[_0xaea4('0x1a')](_0x489be2[_0xaea4('0x42')][_0xaea4('0x1a')]);}_0x166559[_0xaea4('0x65')]=qs[_0xaea4('0x4a')](_0x489be2['query'][_0xaea4('0x4a')]);_0x166559[_0xaea4('0x4b')]=qs[_0xaea4('0x44')](_[_0xaea4('0x4c')](_0x489be2[_0xaea4('0x42')],_0x955626[_0xaea4('0x44')]));_0x166559[_0xaea4('0x4b')]['MailAccountId']=_0x35865d['id'];if(_0x489be2[_0xaea4('0x42')][_0xaea4('0x4d')]){_0x166559[_0xaea4('0x4b')]=_['merge'](_0x166559[_0xaea4('0x4b')],{'$or':_['map'](_0x166559[_0xaea4('0x46')],function(_0x22199f){var _0x1e5106={};_0x1e5106[_0x22199f]={'$like':'%'+_0x489be2[_0xaea4('0x42')]['filter']+'%'};return _0x1e5106;})});}_0x166559=_[_0xaea4('0x4e')]({},_0x166559,_0x489be2['options']);return db[_0xaea4('0x6a')][_0xaea4('0x1d')]({'where':_0x166559['where']})[_0xaea4('0xd')](function(_0x33dbf4){_0x596491[_0xaea4('0x1d')]=_0x33dbf4;if(_0x489be2[_0xaea4('0x42')][_0xaea4('0x55')]){_0x166559[_0xaea4('0x56')]=[{'all':!![]}];}return db[_0xaea4('0x6a')][_0xaea4('0x66')](_0x166559);})[_0xaea4('0xd')](function(_0x5f1297){_0x596491[_0xaea4('0x53')]=_0x5f1297;return _0x596491;});}})[_0xaea4('0xd')](respondWithFilteredResult(_0x1d1d62,_0x166559))[_0xaea4('0x16')](handleError(_0x1d1d62,null));};exports[_0xaea4('0x6b')]=function(_0x96c090,_0x16cbeb){return db[_0xaea4('0x52')][_0xaea4('0x57')]({'where':{'id':_0x96c090[_0xaea4('0x5e')]['id']}})[_0xaea4('0xd')](handleEntityNotFound(_0x16cbeb,null))[_0xaea4('0xd')](function(_0x57c0eb){if(_0x57c0eb){return _0x57c0eb[_0xaea4('0x6b')](_0x96c090[_0xaea4('0x42')][_0xaea4('0x68')]);}})['then'](respondWithStatusCode(_0x16cbeb,null))[_0xaea4('0x16')](handleError(_0x16cbeb,null));};exports[_0xaea4('0x60')]=function(_0x1ed7fc,_0x20b3ef){var _0x435efc={'name':_0x1ed7fc[_0xaea4('0x58')][_0xaea4('0x6c')],'key':_0x1ed7fc[_0xaea4('0x58')][_0xaea4('0x40')],'provider':_0x1ed7fc[_0xaea4('0x58')]['provider']===_0xaea4('0x5a')?null:_0x1ed7fc[_0xaea4('0x58')][_0xaea4('0x59')],'email':_0x1ed7fc[_0xaea4('0x58')][_0xaea4('0x6d')],'ListId':_0x1ed7fc['body'][_0xaea4('0x6e')],'active':!_[_0xaea4('0x6f')](_0x1ed7fc['body']['active'])?_0x1ed7fc['body'][_0xaea4('0x70')]:!![],'description':_0x1ed7fc[_0xaea4('0x58')][_0xaea4('0x71')]||null};var _0x41e8b4=getAuthenticationOptions(_0x435efc[_0xaea4('0x59')],_0x1ed7fc[_0xaea4('0x58')]);_0x435efc[_0xaea4('0x36')]=_0x41e8b4['Imap'];_0x435efc[_0xaea4('0x37')]=_0x41e8b4[_0xaea4('0x37')];return db[_0xaea4('0x52')][_0xaea4('0x60')](_0x435efc,{'include':[{'model':db['MailServerOut'],'as':_0xaea4('0x37')},{'model':db[_0xaea4('0x39')],'as':_0xaea4('0x36')}]})[_0xaea4('0xd')](function(_0x1fbae7){var _0x3627c6=_0x1ed7fc[_0xaea4('0x2b')][_0xaea4('0x72')]({'plain':!![]});if(!_0x3627c6)throw new Error(_0xaea4('0x73'));if(_0x3627c6[_0xaea4('0x74')]===_0xaea4('0x2b')){var _0x4f2319=_0x1fbae7['get']({'plain':!![]});return db['UserProfileSection'][_0xaea4('0x57')]({'where':{'name':_0xaea4('0x75'),'userProfileId':_0x3627c6['userProfileId']},'raw':!![]})[_0xaea4('0xd')](function(_0x117bfd){if(_0x117bfd&&_0x117bfd['autoAssociation']===0x0){return db[_0xaea4('0x76')][_0xaea4('0x60')]({'name':_0x4f2319[_0xaea4('0x6c')],'resourceId':_0x4f2319['id'],'type':_0x117bfd[_0xaea4('0x6c')],'sectionId':_0x117bfd['id']},{})[_0xaea4('0xd')](function(){return _0x1fbae7;});}else{return _0x1fbae7;}})[_0xaea4('0x16')](function(_0x2ec95c){logger['error'](_0xaea4('0x77'),_0x2ec95c);throw _0x2ec95c;});}return _0x1fbae7;})[_0xaea4('0xd')](respondWithResult(_0x20b3ef,0xc9))[_0xaea4('0x16')](handleError(_0x20b3ef,null));};exports[_0xaea4('0x78')]=function(_0xaa628e,_0x564806){return db[_0xaea4('0x52')][_0xaea4('0x62')]({'where':{'id':_0xaa628e[_0xaea4('0x5e')]['id']}})[_0xaea4('0xd')](handleEntityNotFound(_0x564806,null))[_0xaea4('0xd')](function(_0x34f8d2){if(_0x34f8d2){return _0x34f8d2[_0xaea4('0x78')]();}return null;})[_0xaea4('0xd')](respondWithResult(_0x564806,null))['catch'](handleError(_0x564806,null));};exports[_0xaea4('0x79')]=function(_0x254cc3,_0x3350ba){if(_0x254cc3[_0xaea4('0x58')]['id']){delete _0x254cc3[_0xaea4('0x58')]['id'];}return db['MailAccount'][_0xaea4('0x57')]({'where':{'id':_0x254cc3[_0xaea4('0x5e')]['id']}})[_0xaea4('0xd')](handleEntityNotFound(_0x3350ba,null))[_0xaea4('0xd')](function(_0x481d4f){if(_0x481d4f){_0x254cc3[_0xaea4('0x58')][_0xaea4('0x5f')]=_0x481d4f['id'];return db[_0xaea4('0x39')][_0xaea4('0x60')](_0x254cc3[_0xaea4('0x58')]);}})['then'](respondWithResult(_0x3350ba,null))[_0xaea4('0x16')](handleError(_0x3350ba,null));};exports[_0xaea4('0x7a')]=function(_0x1f489c,_0x146481){return db[_0xaea4('0x52')][_0xaea4('0x62')]({'where':{'id':_0x1f489c[_0xaea4('0x5e')]['id']}})[_0xaea4('0xd')](handleEntityNotFound(_0x146481,null))[_0xaea4('0xd')](function(_0x462a34){if(_0x462a34){return _0x462a34[_0xaea4('0x7b')](null);}return null;})[_0xaea4('0xd')](respondWithStatusCode(_0x146481,null))[_0xaea4('0x16')](handleError(_0x146481,null));};exports[_0xaea4('0x7c')]=function(_0x3f39d1,_0x3eda72){return db[_0xaea4('0x52')][_0xaea4('0x62')]({'where':{'id':_0x3f39d1[_0xaea4('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3eda72,null))['then'](function(_0x4c5d3a){if(_0x4c5d3a){return _0x4c5d3a[_0xaea4('0x7c')]();}return null;})[_0xaea4('0xd')](respondWithResult(_0x3eda72,null))['catch'](handleError(_0x3eda72,null));};exports[_0xaea4('0x7d')]=function(_0x7500bc,_0x248b1d){if(_0x7500bc[_0xaea4('0x58')]['id']){delete _0x7500bc[_0xaea4('0x58')]['id'];}return db[_0xaea4('0x52')][_0xaea4('0x57')]({'where':{'id':_0x7500bc[_0xaea4('0x5e')]['id']}})[_0xaea4('0xd')](handleEntityNotFound(_0x248b1d,null))[_0xaea4('0xd')](function(_0x3d1c28){if(_0x3d1c28){_0x7500bc[_0xaea4('0x58')]['MailAccountId']=_0x3d1c28['id'];return db[_0xaea4('0x3a')]['create'](_0x7500bc[_0xaea4('0x58')]);}})[_0xaea4('0xd')](respondWithResult(_0x248b1d,null))[_0xaea4('0x16')](handleError(_0x248b1d,null));};exports[_0xaea4('0x7e')]=function(_0x279b8f,_0x756df4){return db[_0xaea4('0x52')]['findOne']({'where':{'id':_0x279b8f[_0xaea4('0x5e')]['id']}})[_0xaea4('0xd')](handleEntityNotFound(_0x756df4,null))['then'](function(_0x406194){if(_0x406194){return _0x406194[_0xaea4('0x7f')](null);}return null;})[_0xaea4('0xd')](respondWithStatusCode(_0x756df4,null))[_0xaea4('0x16')](handleError(_0x756df4,null));};exports['addInteraction']=function(_0x470d41,_0x30a66a){return db[_0xaea4('0x80')][_0xaea4('0x57')]({'where':{'id':_0x470d41[_0xaea4('0x5e')]['id']}})[_0xaea4('0xd')](handleEntityNotFound(_0x30a66a,null))[_0xaea4('0xd')](function(_0x50a842){if(_0x50a842){return _0x50a842['addInteraction'](_0x470d41[_0xaea4('0x58')][_0xaea4('0x68')],_['omit'](_0x470d41[_0xaea4('0x58')],[_0xaea4('0x68'),'id'])||{});}})[_0xaea4('0xd')](respondWithResult(_0x30a66a,null))['catch'](handleError(_0x30a66a,null));};exports[_0xaea4('0x81')]=function(_0x50ffd9,_0xa4ceac){var _0x3434c7={'raw':![],'where':{}};var _0x361fe8={};var _0x169924={'count':0x0,'rows':[]};return db[_0xaea4('0x52')][_0xaea4('0x62')]({'where':{'id':_0x50ffd9[_0xaea4('0x5e')]['id']}})['then'](handleEntityNotFound(_0xa4ceac,null))[_0xaea4('0xd')](function(_0x336744){if(_0x336744){_0x361fe8[_0xaea4('0x41')]=_[_0xaea4('0x43')](db[_0xaea4('0x80')]['rawAttributes']);_0x361fe8[_0xaea4('0x42')]=_[_0xaea4('0x43')](_0x50ffd9[_0xaea4('0x42')]);_0x361fe8[_0xaea4('0x44')]=_['intersection'](_0x361fe8[_0xaea4('0x41')],_0x361fe8[_0xaea4('0x42')]);_0x3434c7[_0xaea4('0x46')]=_[_0xaea4('0x45')](_0x361fe8['model'],qs['fields'](_0x50ffd9[_0xaea4('0x42')][_0xaea4('0x47')]));_0x3434c7['attributes']=_0x3434c7['attributes'][_0xaea4('0x48')]?_0x3434c7[_0xaea4('0x46')]:_0x361fe8[_0xaea4('0x41')];if(!_0x50ffd9[_0xaea4('0x42')][_0xaea4('0x49')](_0xaea4('0x64'))){_0x3434c7[_0xaea4('0x1b')]=qs[_0xaea4('0x1b')](_0x50ffd9['query'][_0xaea4('0x1b')]);_0x3434c7[_0xaea4('0x1a')]=qs['offset'](_0x50ffd9['query'][_0xaea4('0x1a')]);}_0x3434c7[_0xaea4('0x65')]=qs[_0xaea4('0x4a')](_0x50ffd9['query'][_0xaea4('0x4a')]);_0x3434c7[_0xaea4('0x4b')]=qs[_0xaea4('0x44')](_[_0xaea4('0x4c')](_0x50ffd9[_0xaea4('0x42')],_0x361fe8['filters']));_0x3434c7['where'][_0xaea4('0x5f')]=_0x336744['id'];if(_0x50ffd9[_0xaea4('0x42')][_0xaea4('0x4d')]){_0x3434c7[_0xaea4('0x4b')]=_[_0xaea4('0x4e')](_0x3434c7[_0xaea4('0x4b')],{'$or':_[_0xaea4('0x3d')](_0x3434c7['attributes'],function(_0x5e1d2f){var _0x23109f={};_0x23109f[_0x5e1d2f]={'$like':'%'+_0x50ffd9[_0xaea4('0x42')]['filter']+'%'};return _0x23109f;})});}_0x3434c7=_[_0xaea4('0x4e')]({},_0x3434c7,_0x50ffd9[_0xaea4('0x51')]);return db[_0xaea4('0x80')][_0xaea4('0x1d')]({'where':_0x3434c7[_0xaea4('0x4b')]})['then'](function(_0x40af43){_0x169924[_0xaea4('0x1d')]=_0x40af43;if(_0x50ffd9[_0xaea4('0x42')][_0xaea4('0x55')]){_0x3434c7[_0xaea4('0x56')]=[{'model':db['CmContact'],'as':_0xaea4('0x82'),'required':![]},{'model':db['User'],'as':_0xaea4('0x83'),'attributes':[_0xaea4('0x6c'),'fullname',_0xaea4('0x84')],'required':![]},{'model':db[_0xaea4('0x85')],'as':'Tags','attributes':['id','name',_0xaea4('0x86')],'where':_0x50ffd9[_0xaea4('0x42')]['tag']?{'id':_0x50ffd9['query'][_0xaea4('0x87')]}:undefined,'required':_0x50ffd9[_0xaea4('0x42')]['tag']?!![]:![]}];}return db['MailInteraction'][_0xaea4('0x66')](_0x3434c7);})[_0xaea4('0xd')](function(_0x54018c){_0x169924[_0xaea4('0x53')]=_0x54018c;return _0x169924;});}})['then'](respondWithFilteredResult(_0xa4ceac,_0x3434c7))[_0xaea4('0x16')](handleError(_0xa4ceac,null));};exports['addApplications']=function addApplications(_0x23fcab,_0x1813ac){var _0x39dd63=_0x23fcab[_0xaea4('0x5e')]['id'];var _0x4c8043=_0x23fcab['body'];var _0xf76573=0xc8;var _0x493f11=null;return db[_0xaea4('0x88')]['transaction']({'isolationLevel':db['sequelize'][_0xaea4('0x89')][_0xaea4('0x8a')][_0xaea4('0x8b')]},function(_0x51f6c7){return db[_0xaea4('0x52')][_0xaea4('0x62')]({'where':{'id':_0x39dd63},'transaction':_0x51f6c7})[_0xaea4('0xd')](function(_0x5ae2c){if(_0x5ae2c){return db[_0xaea4('0x8c')][_0xaea4('0x20')]({'where':{'MailAccountId':_0x39dd63},'transaction':_0x51f6c7})[_0xaea4('0xd')](function(){var _0x3562a9=_[_0xaea4('0x3d')](_0x4c8043,function(_0x28ebef){_0x28ebef[_0xaea4('0x5f')]=_0x39dd63;return _0x28ebef;});return db['MailApplication'][_0xaea4('0x8d')](_0x3562a9,{'transaction':_0x51f6c7});});}else{_0xf76573=0x194;_0x493f11=[];}});})[_0xaea4('0xd')](function(){if(_0xf76573!==0x194){return db['MailApplication'][_0xaea4('0x8e')]({'where':{'MailAccountId':_0x39dd63},'order':_0xaea4('0x8f')})[_0xaea4('0xd')](function(_0x13061c){_0x493f11=_0x13061c;});}})[_0xaea4('0x16')](function(_0x429f4f){_0xf76573=0x1f4;logger[_0xaea4('0x12')](_0x429f4f[_0xaea4('0x21')]);if(_0x429f4f[_0xaea4('0x6c')]){delete _0x429f4f[_0xaea4('0x6c')];}_0x493f11=_0x429f4f;})[_0xaea4('0x90')](function(){if(_0x493f11===null){_0x1813ac['sendStatus'](_0xf76573);}else{if(_0xf76573===0x1f4){_0x1813ac[_0xaea4('0x18')](_0xf76573)['send'](_0x493f11);}else{_0x1813ac[_0xaea4('0x18')](_0xf76573)[_0xaea4('0x19')](_0x493f11);}}});};exports['getApplications']=function(_0x104dfa,_0x1cd9c1){var _0x1bd987={};var _0x58d096={};var _0x1370e8;var _0x4e4e0a;return db['MailAccount']['findOne']({'where':{'id':_0x104dfa[_0xaea4('0x5e')]['id']}})[_0xaea4('0xd')](handleEntityNotFound(_0x1cd9c1,null))[_0xaea4('0xd')](function(_0x359012){if(_0x359012){_0x1370e8=_0x359012;_0x58d096[_0xaea4('0x41')]=_['keys'](db['MailApplication'][_0xaea4('0x3e')]);_0x58d096[_0xaea4('0x42')]=_[_0xaea4('0x43')](_0x104dfa[_0xaea4('0x42')]);_0x58d096[_0xaea4('0x44')]=_['intersection'](_0x58d096[_0xaea4('0x41')],_0x58d096[_0xaea4('0x42')]);_0x1bd987[_0xaea4('0x46')]=_[_0xaea4('0x45')](_0x58d096[_0xaea4('0x41')],qs[_0xaea4('0x47')](_0x104dfa[_0xaea4('0x42')][_0xaea4('0x47')]));_0x1bd987[_0xaea4('0x46')]=_0x1bd987[_0xaea4('0x46')]['length']?_0x1bd987[_0xaea4('0x46')]:_0x58d096['model'];_0x1bd987['order']=qs[_0xaea4('0x4a')](_0x104dfa[_0xaea4('0x42')][_0xaea4('0x4a')]);_0x1bd987[_0xaea4('0x4b')]=qs[_0xaea4('0x44')](_[_0xaea4('0x4c')](_0x104dfa[_0xaea4('0x42')],_0x58d096[_0xaea4('0x44')]));if(_0x104dfa[_0xaea4('0x42')][_0xaea4('0x4d')]){_0x1bd987[_0xaea4('0x4b')]=_[_0xaea4('0x4e')](_0x1bd987[_0xaea4('0x4b')],{'$or':_['map'](_0x1bd987['attributes'],function(_0x214806){var _0x8dd4d9={};_0x8dd4d9[_0x214806]={'$like':'%'+_0x104dfa['query']['filter']+'%'};return _0x8dd4d9;})});}_0x1bd987=_[_0xaea4('0x4e')]({},_0x1bd987,_0x104dfa[_0xaea4('0x51')]);return _0x1370e8[_0xaea4('0x91')](_0x1bd987);}})[_0xaea4('0xd')](function(_0x20dbdc){if(_0x20dbdc){_0x4e4e0a=_0x20dbdc[_0xaea4('0x48')];if(!_0x104dfa[_0xaea4('0x42')][_0xaea4('0x49')](_0xaea4('0x64'))){_0x1bd987['limit']=qs[_0xaea4('0x1b')](_0x104dfa[_0xaea4('0x42')][_0xaea4('0x1b')]);_0x1bd987[_0xaea4('0x1a')]=qs['offset'](_0x104dfa['query']['offset']);}return _0x1370e8[_0xaea4('0x91')](_0x1bd987);}})['then'](function(_0x489a88){if(_0x489a88){return _0x489a88?{'count':_0x4e4e0a,'rows':_0x489a88}:null;}})[_0xaea4('0xd')](respondWithResult(_0x1cd9c1,null))[_0xaea4('0x16')](handleError(_0x1cd9c1,null));};exports['getMessages']=function(_0x5876ac,_0x2e6e63){var _0x508bb5={'raw':!![],'where':{}};var _0x23f3c9={};var _0x1331bc={'count':0x0,'rows':[]};return db['MailAccount'][_0xaea4('0x62')]({'where':{'id':_0x5876ac[_0xaea4('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2e6e63,null))[_0xaea4('0xd')](function(_0x29fb97){if(_0x29fb97){_0x23f3c9[_0xaea4('0x41')]=_['keys'](db['MailMessage'][_0xaea4('0x3e')]);_0x23f3c9[_0xaea4('0x42')]=_[_0xaea4('0x43')](_0x5876ac['query']);_0x23f3c9[_0xaea4('0x44')]=_[_0xaea4('0x45')](_0x23f3c9[_0xaea4('0x41')],_0x23f3c9[_0xaea4('0x42')]);_0x508bb5[_0xaea4('0x46')]=_[_0xaea4('0x45')](_0x23f3c9[_0xaea4('0x41')],qs[_0xaea4('0x47')](_0x5876ac[_0xaea4('0x42')]['fields']));_0x508bb5[_0xaea4('0x46')]=_0x508bb5[_0xaea4('0x46')]['length']?_0x508bb5[_0xaea4('0x46')]:_0x23f3c9[_0xaea4('0x41')];if(!_0x5876ac[_0xaea4('0x42')][_0xaea4('0x49')](_0xaea4('0x64'))){_0x508bb5[_0xaea4('0x1b')]=qs['limit'](_0x5876ac[_0xaea4('0x42')][_0xaea4('0x1b')]);_0x508bb5[_0xaea4('0x1a')]=qs['offset'](_0x5876ac[_0xaea4('0x42')][_0xaea4('0x1a')]);}_0x508bb5['order']=qs[_0xaea4('0x4a')](_0x5876ac[_0xaea4('0x42')][_0xaea4('0x4a')]);_0x508bb5[_0xaea4('0x4b')]=qs[_0xaea4('0x44')](_[_0xaea4('0x4c')](_0x5876ac[_0xaea4('0x42')],_0x23f3c9[_0xaea4('0x44')]));_0x508bb5['where'][_0xaea4('0x5f')]=_0x29fb97['id'];if(_0x5876ac[_0xaea4('0x42')]['filter']){_0x508bb5[_0xaea4('0x4b')]=_[_0xaea4('0x4e')](_0x508bb5[_0xaea4('0x4b')],{'$or':_[_0xaea4('0x3d')](_0x508bb5[_0xaea4('0x46')],function(_0x3a0503){var _0x55050e={};_0x55050e[_0x3a0503]={'$like':'%'+_0x5876ac[_0xaea4('0x42')]['filter']+'%'};return _0x55050e;})});}if(_0x5876ac[_0xaea4('0x42')][_0xaea4('0x92')]){var _0x5a59aa=_0x5876ac[_0xaea4('0x42')]['$gte'][_0xaea4('0x93')](',');var _0x320dcd={};_0x320dcd[_0x5a59aa[0x0]]={'$gte':moment(_0x5a59aa[0x1])[_0xaea4('0x94')](_0xaea4('0x95'))};_0x508bb5[_0xaea4('0x4b')]=_['merge'](_0x508bb5['where'],_0x320dcd);}_0x508bb5=_[_0xaea4('0x4e')]({},_0x508bb5,_0x5876ac['options']);return db[_0xaea4('0x96')][_0xaea4('0x1d')]({'where':_0x508bb5[_0xaea4('0x4b')]})[_0xaea4('0xd')](function(_0x12b9f5){_0x1331bc[_0xaea4('0x1d')]=_0x12b9f5;if(_0x5876ac[_0xaea4('0x42')][_0xaea4('0x55')]){_0x508bb5[_0xaea4('0x56')]=[{'all':!![]}];}return db['MailMessage'][_0xaea4('0x66')](_0x508bb5);})[_0xaea4('0xd')](function(_0x2153d8){if(_0x5876ac[_0xaea4('0x42')]['inlineCss']==='true'){for(var _0x2f675c=0x0;_0x2f675c<_0x2153d8[_0xaea4('0x48')];_0x2f675c++){_0x2153d8[_0x2f675c][_0xaea4('0x58')]=juice(_0x2153d8[_0x2f675c][_0xaea4('0x58')]);}}_0x1331bc[_0xaea4('0x53')]=_0x2153d8;return _0x1331bc;});}})[_0xaea4('0xd')](respondWithFilteredResult(_0x2e6e63,_0x508bb5))[_0xaea4('0x16')](handleError(_0x2e6e63,null));};exports[_0xaea4('0x22')]=function(_0x4d796b,_0x2fcc46){var _0x63e847,_0x27aa18={},_0x2317ca;if(_0x4d796b['body']['to']){_0x2317ca=_0x4d796b[_0xaea4('0x58')]['to'][_0xaea4('0x93')](',')[0x0];}return db[_0xaea4('0x52')][_0xaea4('0x57')]({'where':{'id':_0x4d796b['params']['id']},'include':[{'model':db[_0xaea4('0x97')],'as':'List','include':[{'model':db[_0xaea4('0x98')],'as':'Contacts','where':{'email':_0x2317ca},'limit':0x1,'order':[[_0xaea4('0x99'),'DESC']]}]},{'model':db[_0xaea4('0x3a')],'as':_0xaea4('0x37'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xaea4('0x9a'),'raw':!![]}]}]})[_0xaea4('0xd')](handleEntityNotFound(_0x2fcc46,null))['then'](function(_0x3f810b){if(!_0x3f810b)return;_0x63e847=_0x3f810b;if(!_0x3f810b[_0xaea4('0x37')])throw new Error(_0xaea4('0x9b'));if(_[_0xaea4('0x6f')](_0x4d796b[_0xaea4('0x58')][_0xaea4('0x9c')])){_0x4d796b['body'][_0xaea4('0x9c')]=util['format']('%s\x20<%s>',_0x3f810b[_0xaea4('0x6c')],_0x3f810b[_0xaea4('0x6d')]||_0x3f810b[_0xaea4('0x37')][_0xaea4('0x2b')]);}if(_0x4d796b[_0xaea4('0x58')][_0xaea4('0x9d')]&&_0x4d796b[_0xaea4('0x58')][_0xaea4('0x9d')][_0xaea4('0x48')]){for(var _0x5b64d9=0x0;_0x5b64d9<_0x4d796b['body'][_0xaea4('0x9d')][_0xaea4('0x48')];_0x5b64d9+=0x1){_0x4d796b[_0xaea4('0x58')]['attachments'][_0x5b64d9]={'filename':_0x4d796b[_0xaea4('0x58')][_0xaea4('0x9d')][_0x5b64d9][_0xaea4('0x6c')],'path':path[_0xaea4('0x9e')](config[_0xaea4('0x9f')],'server/files/attachments',_0x4d796b['body'][_0xaea4('0x9d')][_0x5b64d9][_0xaea4('0xa0')])};}}var _0x223a05=_0x3f810b[_0xaea4('0xa1')]();return respondWithRpcPromise(_0xaea4('0xa2'),_0xaea4('0xa3'),{'account':_0x223a05,'message':_0x4d796b[_0xaea4('0x58')]});})[_0xaea4('0xd')](function(_0x19c4d2){if(!_0x19c4d2)return;_0x27aa18=_0x19c4d2;if(!_0x63e847[_0xaea4('0xa4')])throw new Error(_0xaea4('0xa5'));if(_0x63e847[_0xaea4('0xa4')]['Contacts']['length'])return _0x63e847[_0xaea4('0xa4')][_0xaea4('0xa6')][0x0];return db[_0xaea4('0x98')]['create'](_[_0xaea4('0x7')](_0x4d796b[_0xaea4('0x58')],{'firstName':_0x4d796b[_0xaea4('0x58')]['to'],'email':_0x4d796b[_0xaea4('0x58')]['to'],'phone':_0x4d796b['body']['to'],'ListId':_0x63e847[_0xaea4('0x6e')]}));})[_0xaea4('0xd')](function(_0x5e81c1){if(!_0x5e81c1)return;var _0x512012={'UserId':_0x4d796b[_0xaea4('0x2b')]['id'],'ContactId':_0x5e81c1['id'],'MailAccountId':_0x63e847['id'],'inReplyTo':_0x27aa18['messageId'],'to':_0x4d796b[_0xaea4('0x58')][_0xaea4('0x9c')],'cc':_0x4d796b[_0xaea4('0x58')]['cc'],'subject':_0x4d796b[_0xaea4('0x58')][_0xaea4('0xa7')],'attach':_0x4d796b[_0xaea4('0x58')][_0xaea4('0xa8')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xaea4('0x94')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xaea4('0xa9'),'Messages':[_[_0xaea4('0x4e')](_0x4d796b[_0xaea4('0x58')],{'messageId':_0x27aa18['messageId'],'sentAt':moment()[_0xaea4('0x94')](_0xaea4('0x95')),'read':!![],'MailAccountId':_0x63e847['id'],'UserId':_0x4d796b['user']['id'],'ContactId':_0x5e81c1['id']})]};if(_0x4d796b['body']['Interaction']){_0x512012=_[_0xaea4('0x4e')](_0x512012,_0x4d796b[_0xaea4('0x58')][_0xaea4('0xaa')]);}return db['MailInteraction'][_0xaea4('0x60')](_0x512012,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0xaea4('0xd')](respondWithResult(_0x2fcc46,null))['catch'](handleError(_0x2fcc46,null));};exports[_0xaea4('0xab')]=function(_0x80f561,_0x474c70){return db[_0xaea4('0x52')][_0xaea4('0x57')]({'where':{'id':_0x80f561[_0xaea4('0x5e')]['id']},'include':[{'model':db[_0xaea4('0x3a')],'as':_0xaea4('0x37'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xaea4('0x9a'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x474c70,null))['then'](function(_0x48550f){if(!_0x48550f['Smtp'])return;var _0x563315=_0x48550f[_0xaea4('0xa1')]();return respondWithRpcPromise(_0xaea4('0xac'),'verifySmtp',{'account':_0x563315});})[_0xaea4('0xd')](respondWithResult(_0x474c70,null))['catch'](handleError(_0x474c70,null));};exports[_0xaea4('0x20')]=function(_0x5642fe,_0x4e50fa){return db['MailAccount'][_0xaea4('0x57')]({'where':{'id':_0x5642fe[_0xaea4('0x5e')]['id']}})[_0xaea4('0xd')](handleEntityNotFound(_0x4e50fa,null))[_0xaea4('0xd')](function(_0x1d7d6d){if(_0x1d7d6d&&_0x1d7d6d['service']){throw new db[(_0xaea4('0xad'))]['ValidationError'](_0xaea4('0xae'));}return _0x1d7d6d;})[_0xaea4('0xd')](removeEntity(_0x4e50fa,null))[_0xaea4('0x16')](handleError(_0x4e50fa,null));};exports[_0xaea4('0xaf')]=function(_0x434708,_0x1f4557){return db[_0xaea4('0x52')]['find']({'where':{'id':_0x434708[_0xaea4('0x5e')]['id']}})[_0xaea4('0xd')](handleEntityNotFound(_0x1f4557,null))[_0xaea4('0xd')](function(_0x51b676){if(_0x51b676){return _0x51b676['addAgents'](_0x434708[_0xaea4('0x58')][_0xaea4('0x68')],_['omit'](_0x434708[_0xaea4('0x58')],[_0xaea4('0x68'),'id'])||{})['spread'](function(_0xce77b3){for(var _0x4bdec0=0x0;_0x4bdec0<_0x434708[_0xaea4('0x58')][_0xaea4('0x68')][_0xaea4('0x48')];_0x4bdec0+=0x1){socket['emit'](_0xaea4('0xb0'),{'UserId':Number(_0x434708[_0xaea4('0x58')][_0xaea4('0x68')][_0x4bdec0]),'MailAccountId':Number(_0x434708['params']['id'])});}return _0xce77b3;});}})['then'](respondWithResult(_0x1f4557,null))[_0xaea4('0x16')](handleError(_0x1f4557,null));};exports['removeAgents']=function(_0x564c31,_0x35b416){return db[_0xaea4('0x52')]['find']({'where':{'id':_0x564c31[_0xaea4('0x5e')]['id']}})['then'](handleEntityNotFound(_0x35b416,null))[_0xaea4('0xd')](function(_0x2fb976){if(_0x2fb976){return _0x2fb976[_0xaea4('0xb1')](_0x564c31[_0xaea4('0x42')]['ids'])[_0xaea4('0xd')](function(){if(_[_0xaea4('0xb2')](_0x564c31[_0xaea4('0x42')]['ids'])){for(var _0x38c8c9=0x0;_0x38c8c9<_0x564c31[_0xaea4('0x42')][_0xaea4('0x68')]['length'];_0x38c8c9+=0x1){socket[_0xaea4('0xb3')](_0xaea4('0xb4'),{'UserId':Number(_0x564c31['query'][_0xaea4('0x68')][_0x38c8c9]),'MailAccountId':Number(_0x564c31[_0xaea4('0x5e')]['id'])});}}else{socket[_0xaea4('0xb3')](_0xaea4('0xb4'),{'UserId':Number(_0x564c31['query'][_0xaea4('0x68')]),'MailAccountId':Number(_0x564c31['params']['id'])});}});}})['then'](respondWithStatusCode(_0x35b416,null))[_0xaea4('0x16')](handleError(_0x35b416,null));};exports[_0xaea4('0xb5')]=function(_0x299116,_0xb56fdc){var _0x3ada07={};var _0x169f89={};var _0x3ed998;var _0x9fd57a;return db[_0xaea4('0x52')][_0xaea4('0x62')]({'where':{'id':_0x299116['params']['id']}})[_0xaea4('0xd')](handleEntityNotFound(_0xb56fdc,null))[_0xaea4('0xd')](function(_0x1a3ccd){if(_0x1a3ccd){_0x3ed998=_0x1a3ccd;_0x169f89[_0xaea4('0x41')]=_[_0xaea4('0x43')](db[_0xaea4('0xb6')][_0xaea4('0x3e')]);_0x169f89[_0xaea4('0x42')]=_[_0xaea4('0x43')](_0x299116[_0xaea4('0x42')]);_0x169f89[_0xaea4('0x44')]=_[_0xaea4('0x45')](_0x169f89['model'],_0x169f89[_0xaea4('0x42')]);_0x3ada07[_0xaea4('0x46')]=_[_0xaea4('0x45')](_0x169f89[_0xaea4('0x41')],qs[_0xaea4('0x47')](_0x299116[_0xaea4('0x42')][_0xaea4('0x47')]));_0x3ada07['attributes']=_0x3ada07[_0xaea4('0x46')]['length']?_0x3ada07[_0xaea4('0x46')]:_0x169f89[_0xaea4('0x41')];_0x3ada07['order']=qs[_0xaea4('0x4a')](_0x299116[_0xaea4('0x42')]['sort']);_0x3ada07['where']=qs[_0xaea4('0x44')](_[_0xaea4('0x4c')](_0x299116['query'],_0x169f89[_0xaea4('0x44')]));if(_0x299116['query'][_0xaea4('0x4d')]){_0x3ada07[_0xaea4('0x4b')]=_[_0xaea4('0x4e')](_0x3ada07[_0xaea4('0x4b')],{'$or':_[_0xaea4('0x3d')](_0x3ada07[_0xaea4('0x46')],function(_0x490ba7){var _0x576984={};_0x576984[_0x490ba7]={'$like':'%'+_0x299116[_0xaea4('0x42')][_0xaea4('0x4d')]+'%'};return _0x576984;})});}_0x3ada07=_[_0xaea4('0x4e')]({},_0x3ada07,_0x299116['options']);return _0x3ed998[_0xaea4('0xb5')](_0x3ada07);}})[_0xaea4('0xd')](function(_0x1b657b){if(_0x1b657b){_0x9fd57a=_0x1b657b[_0xaea4('0x48')];if(!_0x299116[_0xaea4('0x42')][_0xaea4('0x49')]('nolimit')){_0x3ada07[_0xaea4('0x1b')]=qs[_0xaea4('0x1b')](_0x299116[_0xaea4('0x42')][_0xaea4('0x1b')]);_0x3ada07[_0xaea4('0x1a')]=qs[_0xaea4('0x1a')](_0x299116[_0xaea4('0x42')][_0xaea4('0x1a')]);}return _0x3ed998[_0xaea4('0xb5')](_0x3ada07);}})[_0xaea4('0xd')](function(_0x456ebc){if(_0x456ebc){return _0x456ebc?{'count':_0x9fd57a,'rows':_0x456ebc}:null;}})['then'](respondWithResult(_0xb56fdc,null))[_0xaea4('0x16')](handleError(_0xb56fdc,null));}; \ No newline at end of file +var _0xc737=['List\x20not\x20found','messageId','subject','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','User','getAgents','moment','bluebird','path','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','update','destroy','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','port','host','secure','service','authentication','Imap','index','MailServerIn','MailServerOut','Smtp','Pause','map','MailAccount','fieldName','type','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','mandatoryDispositionPause','keys','rawAttributes','length','options','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','params','MailAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','CannedAnswer','create','getAnswers','removeAnswers','key','ListId','isNil','active','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','MailApplication','findAndCountAll','finally','getApplications','getMessages','$gte','split','format','MailMessage','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc737,0xd6));var _0x7c73=function(_0x1f4cf9,_0x5048ed){_0x1f4cf9=_0x1f4cf9-0x0;var _0x147f65=_0xc737[_0x1f4cf9];return _0x147f65;};'use strict';var moment=require(_0x7c73('0x0'));var BPromise=require(_0x7c73('0x1'));var util=require('util');var path=require(_0x7c73('0x2'));var _=require('lodash');var juice=require('juice');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x7c73('0x3'))('api');var config=require(_0x7c73('0x4'));var db=require(_0x7c73('0x5'))['db'];config['redis']=_[_0x7c73('0x6')](config[_0x7c73('0x7')],{'host':_0x7c73('0x8'),'port':0x18eb});var socket=require(_0x7c73('0x9'))(new Redis(config[_0x7c73('0x7')]));require(_0x7c73('0xa'))[_0x7c73('0xb')](socket);var jayson=require(_0x7c73('0xc'));var client=jayson[_0x7c73('0xd')][_0x7c73('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x5ba157,_0x45bc7b,_0x15376a,_0x38d3f9){return new BPromise(function(_0x54e771,_0x44ec2a){var _0x198239=_0x38d3f9||client;return _0x198239[_0x7c73('0xf')](_0x5ba157,_0x15376a)[_0x7c73('0x10')](function(_0x2b4da9){logger[_0x7c73('0x11')](_0x7c73('0x12'),_0x45bc7b,_0x7c73('0x13'));logger[_0x7c73('0x14')](_0x7c73('0x15'),_0x45bc7b,_0x7c73('0x13'),JSON[_0x7c73('0x16')](_0x2b4da9));if(_0x2b4da9[_0x7c73('0x17')]){if(_0x2b4da9[_0x7c73('0x17')][_0x7c73('0x18')]===0x1f4){logger[_0x7c73('0x17')](_0x7c73('0x12'),_0x45bc7b,_0x2b4da9[_0x7c73('0x17')][_0x7c73('0x19')]);return _0x44ec2a(_0x2b4da9[_0x7c73('0x17')]['message']);}logger[_0x7c73('0x17')](_0x7c73('0x12'),_0x45bc7b,_0x2b4da9[_0x7c73('0x17')][_0x7c73('0x19')]);return _0x54e771(_0x2b4da9[_0x7c73('0x17')][_0x7c73('0x19')]);}else{logger[_0x7c73('0x11')]('MailAccount,\x20%s,\x20%s',_0x45bc7b,_0x7c73('0x13'));_0x54e771(_0x2b4da9['result'][_0x7c73('0x19')]);}})['catch'](function(_0x321b7d){logger[_0x7c73('0x17')](_0x7c73('0x12'),_0x45bc7b,_0x321b7d);_0x44ec2a(_0x321b7d);});});}function respondWithStatusCode(_0x55cd1a,_0x542f20){_0x542f20=_0x542f20||0xcc;return function(_0x273310){if(_0x273310){return _0x55cd1a[_0x7c73('0x1a')](_0x542f20);}return _0x55cd1a[_0x7c73('0x1b')](_0x542f20)[_0x7c73('0x1c')]();};}function respondWithResult(_0x477f42,_0x818388){_0x818388=_0x818388||0xc8;return function(_0x6a3c36){if(_0x6a3c36){return _0x477f42[_0x7c73('0x1b')](_0x818388)[_0x7c73('0x1d')](_0x6a3c36);}};}function respondWithFilteredResult(_0x34eba2,_0x29996c){return function(_0x3c17bd){if(_0x3c17bd){var _0x57ec4d=typeof _0x29996c['offset']==='undefined'&&typeof _0x29996c['limit']===_0x7c73('0x1e');var _0x2e6c45=_0x3c17bd[_0x7c73('0x1f')];var _0x2b085e=_0x57ec4d?0x0:_0x29996c[_0x7c73('0x20')];var _0x440c10=_0x57ec4d?_0x3c17bd['count']:_0x29996c[_0x7c73('0x20')]+_0x29996c['limit'];var _0x42e238;if(_0x440c10>=_0x2e6c45){_0x440c10=_0x2e6c45;_0x42e238=0xc8;}else{_0x42e238=0xce;}_0x34eba2[_0x7c73('0x1b')](_0x42e238);return _0x34eba2[_0x7c73('0x21')](_0x7c73('0x22'),_0x2b085e+'-'+_0x440c10+'/'+_0x2e6c45)['json'](_0x3c17bd);}return null;};}function saveUpdates(_0x5e37bb){return function(_0x4296c7){if(_0x4296c7){return _0x4296c7[_0x7c73('0x23')](_0x5e37bb)[_0x7c73('0x10')](function(_0x9ecd0){return _0x9ecd0;});}return null;};}function removeEntity(_0x3de707){return function(_0x1db394){if(_0x1db394){return _0x1db394[_0x7c73('0x24')]()['then'](function(){var _0x39077c=_0x1db394['get']({'plain':!![]});var _0x5db1ed=_0x7c73('0x25');return db[_0x7c73('0x26')][_0x7c73('0x24')]({'where':{'type':_0x5db1ed,'resourceId':_0x39077c['id']}})[_0x7c73('0x10')](function(){return _0x1db394;});})[_0x7c73('0x10')](function(){_0x3de707[_0x7c73('0x1b')](0xcc)[_0x7c73('0x1c')]();});}};}function handleEntityNotFound(_0x16b4b8){return function(_0x264fc2){if(!_0x264fc2){_0x16b4b8[_0x7c73('0x1a')](0x194);}return _0x264fc2;};}function handleError(_0xa21300,_0x237923){_0x237923=_0x237923||0x1f4;return function(_0x4d8123){logger[_0x7c73('0x17')](_0x4d8123[_0x7c73('0x27')]);if(_0x4d8123[_0x7c73('0x28')]){delete _0x4d8123['name'];}_0xa21300[_0x7c73('0x1b')](_0x237923)[_0x7c73('0x29')](_0x4d8123);};}function getImapHost(_0x17d997){switch(_0x17d997){case _0x7c73('0x2a'):return _0x7c73('0x2b');case _0x7c73('0x2c'):return _0x7c73('0x2d');case _0x7c73('0x2e'):return _0x7c73('0x2f');case _0x7c73('0x30'):return _0x7c73('0x31');}throw new Error(_0x7c73('0x32'),_0x17d997);}function getSmtpHost(_0x458e1c){switch(_0x458e1c){case _0x7c73('0x2a'):return _0x7c73('0x33');case _0x7c73('0x2c'):return _0x7c73('0x34');case _0x7c73('0x2e'):return'smtp-mail.outlook.com';case _0x7c73('0x30'):return _0x7c73('0x35');}throw new Error(_0x7c73('0x32'),_0x458e1c);}function getAuthenticationOptions(_0x206b78,_0x2231a8){var _0xba3734={};var _0x26da7e={};if(_0x206b78){_0xba3734['user']=_0x26da7e[_0x7c73('0x36')]=_0x2231a8[_0x7c73('0x37')];_0xba3734[_0x7c73('0x38')]=_0x26da7e['pass']=_0x2231a8[_0x7c73('0x38')];if(_0x2231a8[_0x7c73('0x39')]){_0xba3734[_0x7c73('0x39')]=_0x26da7e['modernAuthentication']=!![];_0xba3734[_0x7c73('0x3a')]=_0x26da7e[_0x7c73('0x3a')]=_0x2231a8[_0x7c73('0x3a')];_0xba3734[_0x7c73('0x38')]=_0x26da7e[_0x7c73('0x3b')]=null;}else{_0xba3734[_0x7c73('0x3a')]=_0x26da7e[_0x7c73('0x3a')]=null;}_0xba3734['host']=getImapHost(_0x206b78);_0xba3734[_0x7c73('0x3c')]=0x3e1;_0x26da7e[_0x7c73('0x3d')]=getSmtpHost(_0x206b78);_0x26da7e[_0x7c73('0x3c')]=0x24b;_0x26da7e[_0x7c73('0x3e')]=![];_0xba3734[_0x7c73('0x3f')]=_0x26da7e[_0x7c73('0x3f')]=null;}else{if(_0x2231a8[_0x7c73('0x40')]){_0xba3734[_0x7c73('0x36')]=_0x26da7e[_0x7c73('0x36')]=_0x2231a8[_0x7c73('0x37')];_0xba3734['password']=_0x26da7e[_0x7c73('0x3b')]=_0x2231a8['password'];}else{_0xba3734[_0x7c73('0x40')]=_0x26da7e[_0x7c73('0x40')]=![];_0xba3734[_0x7c73('0x36')]=_0x26da7e[_0x7c73('0x36')]=null;_0xba3734[_0x7c73('0x38')]=_0x26da7e[_0x7c73('0x3b')]=null;}_0xba3734[_0x7c73('0x3d')]=_0x2231a8[_0x7c73('0x41')][_0x7c73('0x3d')];_0xba3734['port']=_0x2231a8[_0x7c73('0x41')][_0x7c73('0x3c')];_0x26da7e[_0x7c73('0x3d')]=_0x2231a8['Smtp'][_0x7c73('0x3d')];_0x26da7e[_0x7c73('0x3c')]=_0x2231a8['Smtp']['port'];}return{'Imap':_0xba3734,'Smtp':_0x26da7e};}exports[_0x7c73('0x42')]=function(_0x558347,_0x127c51){var _0x505ec1={'include':[{'model':db[_0x7c73('0x43')],'as':_0x7c73('0x41')},{'model':db[_0x7c73('0x44')],'as':_0x7c73('0x45')},{'model':db[_0x7c73('0x46')],'as':'mandatoryDispositionPause'}]},_0x3c20dd={},_0x121b54={'count':0x0,'rows':[]};var _0x78a6bf=_[_0x7c73('0x47')](db[_0x7c73('0x48')]['rawAttributes'],function(_0x30f97){return{'name':_0x30f97[_0x7c73('0x49')],'type':_0x30f97[_0x7c73('0x4a')]['key']};});_0x3c20dd['model']=_['map'](_0x78a6bf,_0x7c73('0x28'));_0x3c20dd[_0x7c73('0x4b')]=_['keys'](_0x558347[_0x7c73('0x4b')]);_0x3c20dd[_0x7c73('0x4c')]=_['intersection'](_0x3c20dd[_0x7c73('0x4d')],_0x3c20dd[_0x7c73('0x4b')]);_0x505ec1['attributes']=_[_0x7c73('0x4e')](_0x3c20dd[_0x7c73('0x4d')],qs[_0x7c73('0x4f')](_0x558347[_0x7c73('0x4b')][_0x7c73('0x4f')]));_0x505ec1['attributes']=_0x505ec1['attributes']['length']?_0x505ec1[_0x7c73('0x50')]:_0x3c20dd[_0x7c73('0x4d')];if(!_0x558347['query'][_0x7c73('0x51')](_0x7c73('0x52'))){_0x505ec1[_0x7c73('0x53')]=qs[_0x7c73('0x53')](_0x558347['query'][_0x7c73('0x53')]);_0x505ec1[_0x7c73('0x20')]=qs[_0x7c73('0x20')](_0x558347[_0x7c73('0x4b')][_0x7c73('0x20')]);}_0x505ec1[_0x7c73('0x54')]=qs[_0x7c73('0x55')](_0x558347['query'][_0x7c73('0x55')]);_0x505ec1[_0x7c73('0x56')]=qs[_0x7c73('0x4c')](_[_0x7c73('0x57')](_0x558347['query'],_0x3c20dd[_0x7c73('0x4c')]),_0x78a6bf);if(_0x558347[_0x7c73('0x4b')][_0x7c73('0x58')]){_0x505ec1[_0x7c73('0x56')]=_[_0x7c73('0x59')](_0x505ec1[_0x7c73('0x56')],{'$or':_[_0x7c73('0x47')](_0x78a6bf,function(_0x52f0ed){if(_0x52f0ed[_0x7c73('0x4a')]!==_0x7c73('0x5a')){var _0x4f4991={};_0x4f4991[_0x52f0ed[_0x7c73('0x28')]]={'$like':'%'+_0x558347[_0x7c73('0x4b')][_0x7c73('0x58')]+'%'};return _0x4f4991;}})});}_0x505ec1=_[_0x7c73('0x59')]({},_0x505ec1,_0x558347['options']);var _0x942785={'where':_0x505ec1[_0x7c73('0x56')]};return db[_0x7c73('0x48')][_0x7c73('0x1f')](_0x942785)[_0x7c73('0x10')](function(_0x51d93d){_0x121b54[_0x7c73('0x1f')]=_0x51d93d;if(_0x558347[_0x7c73('0x4b')][_0x7c73('0x5b')]){_0x505ec1[_0x7c73('0x5c')]=[{'all':!![]}];}return db[_0x7c73('0x48')][_0x7c73('0x5d')](_0x505ec1);})[_0x7c73('0x10')](function(_0x12b825){_0x121b54['rows']=_0x12b825;return _0x121b54;})[_0x7c73('0x10')](respondWithFilteredResult(_0x127c51,_0x505ec1))[_0x7c73('0x5e')](handleError(_0x127c51,null));};exports[_0x7c73('0x5f')]=function(_0x403490,_0x330f44){var _0xb78b4b={'raw':![],'where':{'id':_0x403490['params']['id']},'include':[{'model':db[_0x7c73('0x43')],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x7c73('0x46')],'as':_0x7c73('0x60')}]},_0x409929={};_0x409929[_0x7c73('0x4d')]=_[_0x7c73('0x61')](db['MailAccount'][_0x7c73('0x62')]);_0x409929[_0x7c73('0x4b')]=_[_0x7c73('0x61')](_0x403490[_0x7c73('0x4b')]);_0x409929[_0x7c73('0x4c')]=_[_0x7c73('0x4e')](_0x409929[_0x7c73('0x4d')],_0x409929[_0x7c73('0x4b')]);_0xb78b4b['attributes']=_[_0x7c73('0x4e')](_0x409929[_0x7c73('0x4d')],qs[_0x7c73('0x4f')](_0x403490[_0x7c73('0x4b')]['fields']));_0xb78b4b[_0x7c73('0x50')]=_0xb78b4b[_0x7c73('0x50')][_0x7c73('0x63')]?_0xb78b4b[_0x7c73('0x50')]:_0x409929[_0x7c73('0x4d')];if(_0x403490[_0x7c73('0x4b')]['includeAll']){_0xb78b4b[_0x7c73('0x5c')]=[{'all':!![]}];}_0xb78b4b=_[_0x7c73('0x59')]({},_0xb78b4b,_0x403490[_0x7c73('0x64')]);return db[_0x7c73('0x48')][_0x7c73('0x65')](_0xb78b4b)[_0x7c73('0x10')](handleEntityNotFound(_0x330f44,null))[_0x7c73('0x10')](respondWithResult(_0x330f44,null))[_0x7c73('0x5e')](handleError(_0x330f44,null));};exports[_0x7c73('0x23')]=function(_0x5688b7,_0x7b0c85){if(_0x5688b7[_0x7c73('0x66')]['id']){delete _0x5688b7[_0x7c73('0x66')]['id'];}var _0x4b8acf=_0x5688b7['body'][_0x7c73('0x67')]===_0x7c73('0x68')?null:_0x5688b7[_0x7c73('0x66')][_0x7c73('0x67')];var _0x412415=_0x5688b7[_0x7c73('0x66')][_0x7c73('0x41')]||{};var _0x57dadd=_0x5688b7['body'][_0x7c73('0x45')]||{};if(_0x4b8acf){_0x412415[_0x7c73('0x3d')]=getImapHost(_0x4b8acf);_0x412415['port']=0x3e1;_0x57dadd[_0x7c73('0x3d')]=getSmtpHost(_0x4b8acf);_0x57dadd['port']=0x24b;_0x57dadd[_0x7c73('0x3e')]=![];}if(_0x57dadd[_0x7c73('0x39')]){_0x57dadd[_0x7c73('0x3e')]=![];}else{_0x57dadd[_0x7c73('0x3a')]=null;}if(!_0x412415[_0x7c73('0x39')])_0x412415[_0x7c73('0x3a')]=null;_0x5688b7[_0x7c73('0x66')]['Imap']=_0x412415;_0x5688b7[_0x7c73('0x66')]['Smtp']=_0x57dadd;return db['MailAccount'][_0x7c73('0x65')]({'where':{'id':_0x5688b7['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x7c73('0x41')},{'model':db['MailServerOut'],'as':_0x7c73('0x45')},{'model':db['Pause'],'as':_0x7c73('0x60')}]})[_0x7c73('0x10')](handleEntityNotFound(_0x7b0c85,null))[_0x7c73('0x10')](function(_0x7b07b4){if(!_0x7b07b4)throw new Error(_0x7c73('0x69'));if(_0x7b07b4[_0x7c73('0x3f')])delete _0x5688b7[_0x7c73('0x66')][_0x7c73('0x41')];return _0x7b07b4;})['then'](saveUpdates(_0x5688b7[_0x7c73('0x66')],null))[_0x7c73('0x10')](function(_0x58ba17){if(!_0x5688b7['body'][_0x7c73('0x41')])return _0x58ba17;return db['MailServerIn'][_0x7c73('0x23')](_0x5688b7['body']['Imap'],{'where':{'MailAccountId':_0x58ba17['id']}})[_0x7c73('0x10')](function(){return _0x58ba17;});})[_0x7c73('0x10')](function(_0x37bc51){if(!_0x5688b7['body'][_0x7c73('0x45')])return _0x37bc51;return db[_0x7c73('0x44')]['update'](_0x5688b7[_0x7c73('0x66')]['Smtp'],{'where':{'MailAccountId':_0x37bc51['id']}})['then'](function(){return _0x37bc51;});})[_0x7c73('0x10')](respondWithResult(_0x7b0c85,null))[_0x7c73('0x5e')](handleError(_0x7b0c85,null));};exports[_0x7c73('0x6a')]=function(_0x102e0c,_0x18899a){return db[_0x7c73('0x48')][_0x7c73('0x6a')]()[_0x7c73('0x10')](respondWithResult(_0x18899a,null))[_0x7c73('0x5e')](handleError(_0x18899a,null));};exports['addDisposition']=function(_0x51a64f,_0x4c76f9){if(_0x51a64f[_0x7c73('0x66')]['id']){delete _0x51a64f[_0x7c73('0x66')]['id'];}return db[_0x7c73('0x48')][_0x7c73('0x65')]({'where':{'id':_0x51a64f[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x4c76f9,null))[_0x7c73('0x10')](function(_0x9d0a1b){if(_0x9d0a1b){_0x51a64f['body'][_0x7c73('0x6c')]=_0x9d0a1b['id'];return db[_0x7c73('0x6d')]['create'](_0x51a64f[_0x7c73('0x66')]);}})[_0x7c73('0x10')](respondWithResult(_0x4c76f9,null))['catch'](handleError(_0x4c76f9,null));};exports[_0x7c73('0x6e')]=function(_0x1b7665,_0x4f017c){var _0x11cad1={'raw':![],'where':{}};var _0x53dc78={};var _0x3b8bdf={'count':0x0,'rows':[]};return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x1b7665[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x4f017c,null))[_0x7c73('0x10')](function(_0x413ea2){if(_0x413ea2){_0x53dc78[_0x7c73('0x4d')]=_[_0x7c73('0x61')](db[_0x7c73('0x6d')][_0x7c73('0x62')]);_0x53dc78[_0x7c73('0x4b')]=_[_0x7c73('0x61')](_0x1b7665[_0x7c73('0x4b')]);_0x53dc78[_0x7c73('0x4c')]=_[_0x7c73('0x4e')](_0x53dc78[_0x7c73('0x4d')],_0x53dc78[_0x7c73('0x4b')]);_0x11cad1[_0x7c73('0x50')]=_['intersection'](_0x53dc78[_0x7c73('0x4d')],qs[_0x7c73('0x4f')](_0x1b7665[_0x7c73('0x4b')]['fields']));_0x11cad1[_0x7c73('0x50')]=_0x11cad1['attributes']['length']?_0x11cad1[_0x7c73('0x50')]:_0x53dc78[_0x7c73('0x4d')];if(!_0x1b7665['query'][_0x7c73('0x51')](_0x7c73('0x52'))){_0x11cad1[_0x7c73('0x53')]=qs[_0x7c73('0x53')](_0x1b7665['query'][_0x7c73('0x53')]);_0x11cad1['offset']=qs['offset'](_0x1b7665[_0x7c73('0x4b')][_0x7c73('0x20')]);}_0x11cad1[_0x7c73('0x54')]=qs[_0x7c73('0x55')](_0x1b7665[_0x7c73('0x4b')][_0x7c73('0x55')]);_0x11cad1[_0x7c73('0x56')]=qs['filters'](_[_0x7c73('0x57')](_0x1b7665['query'],_0x53dc78[_0x7c73('0x4c')]));_0x11cad1[_0x7c73('0x56')]['MailAccountId']=_0x413ea2['id'];if(_0x1b7665[_0x7c73('0x4b')][_0x7c73('0x58')]){_0x11cad1[_0x7c73('0x56')]=_[_0x7c73('0x59')](_0x11cad1[_0x7c73('0x56')],{'$or':_[_0x7c73('0x47')](_0x11cad1[_0x7c73('0x50')],function(_0x2dd900){var _0x511431={};_0x511431[_0x2dd900]={'$like':'%'+_0x1b7665[_0x7c73('0x4b')][_0x7c73('0x58')]+'%'};return _0x511431;})});}_0x11cad1=_[_0x7c73('0x59')]({},_0x11cad1,_0x1b7665['options']);return db['Disposition'][_0x7c73('0x1f')]({'where':_0x11cad1[_0x7c73('0x56')]})['then'](function(_0x8516e7){_0x3b8bdf[_0x7c73('0x1f')]=_0x8516e7;if(_0x1b7665[_0x7c73('0x4b')][_0x7c73('0x5b')]){_0x11cad1['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x11cad1);})[_0x7c73('0x10')](function(_0x51f531){_0x3b8bdf[_0x7c73('0x70')]=_0x51f531;return _0x3b8bdf;});}})[_0x7c73('0x10')](respondWithFilteredResult(_0x4f017c,_0x11cad1))[_0x7c73('0x5e')](handleError(_0x4f017c,null));};exports['removeDispositions']=function(_0x56b92b,_0x5b78e3){return db['MailAccount'][_0x7c73('0x65')]({'where':{'id':_0x56b92b[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x5b78e3,null))[_0x7c73('0x10')](function(_0x11e832){if(_0x11e832){return _0x11e832[_0x7c73('0x71')](_0x56b92b[_0x7c73('0x4b')][_0x7c73('0x72')]);}})[_0x7c73('0x10')](respondWithStatusCode(_0x5b78e3,null))[_0x7c73('0x5e')](handleError(_0x5b78e3,null));};exports['addAnswer']=function(_0x4054ee,_0x25403d){if(_0x4054ee['body']['id']){delete _0x4054ee[_0x7c73('0x66')]['id'];}return db[_0x7c73('0x48')][_0x7c73('0x65')]({'where':{'id':_0x4054ee['params']['id']}})['then'](handleEntityNotFound(_0x25403d,null))[_0x7c73('0x10')](function(_0x58bc86){if(_0x58bc86){_0x4054ee['body']['MailAccountId']=_0x58bc86['id'];return db[_0x7c73('0x73')][_0x7c73('0x74')](_0x4054ee['body']);}})[_0x7c73('0x10')](respondWithResult(_0x25403d,null))['catch'](handleError(_0x25403d,null));};exports[_0x7c73('0x75')]=function(_0x3dabba,_0x59cfa3){var _0x2f4332={'raw':![],'where':{}};var _0x56b6e7={};var _0x365c1b={'count':0x0,'rows':[]};return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x3dabba[_0x7c73('0x6b')]['id']}})['then'](handleEntityNotFound(_0x59cfa3,null))[_0x7c73('0x10')](function(_0x3b93d4){if(_0x3b93d4){_0x56b6e7[_0x7c73('0x4d')]=_[_0x7c73('0x61')](db[_0x7c73('0x73')][_0x7c73('0x62')]);_0x56b6e7[_0x7c73('0x4b')]=_['keys'](_0x3dabba[_0x7c73('0x4b')]);_0x56b6e7[_0x7c73('0x4c')]=_['intersection'](_0x56b6e7[_0x7c73('0x4d')],_0x56b6e7[_0x7c73('0x4b')]);_0x2f4332[_0x7c73('0x50')]=_[_0x7c73('0x4e')](_0x56b6e7[_0x7c73('0x4d')],qs[_0x7c73('0x4f')](_0x3dabba[_0x7c73('0x4b')][_0x7c73('0x4f')]));_0x2f4332[_0x7c73('0x50')]=_0x2f4332['attributes']['length']?_0x2f4332[_0x7c73('0x50')]:_0x56b6e7[_0x7c73('0x4d')];if(!_0x3dabba['query']['hasOwnProperty'](_0x7c73('0x52'))){_0x2f4332['limit']=qs['limit'](_0x3dabba['query'][_0x7c73('0x53')]);_0x2f4332['offset']=qs['offset'](_0x3dabba[_0x7c73('0x4b')][_0x7c73('0x20')]);}_0x2f4332[_0x7c73('0x54')]=qs['sort'](_0x3dabba[_0x7c73('0x4b')]['sort']);_0x2f4332[_0x7c73('0x56')]=qs[_0x7c73('0x4c')](_[_0x7c73('0x57')](_0x3dabba[_0x7c73('0x4b')],_0x56b6e7['filters']));_0x2f4332[_0x7c73('0x56')][_0x7c73('0x6c')]=_0x3b93d4['id'];if(_0x3dabba[_0x7c73('0x4b')]['filter']){_0x2f4332['where']=_[_0x7c73('0x59')](_0x2f4332[_0x7c73('0x56')],{'$or':_[_0x7c73('0x47')](_0x2f4332[_0x7c73('0x50')],function(_0x2536df){var _0x40d9f0={};_0x40d9f0[_0x2536df]={'$like':'%'+_0x3dabba['query']['filter']+'%'};return _0x40d9f0;})});}_0x2f4332=_[_0x7c73('0x59')]({},_0x2f4332,_0x3dabba['options']);return db[_0x7c73('0x73')][_0x7c73('0x1f')]({'where':_0x2f4332['where']})[_0x7c73('0x10')](function(_0x5eace5){_0x365c1b[_0x7c73('0x1f')]=_0x5eace5;if(_0x3dabba[_0x7c73('0x4b')][_0x7c73('0x5b')]){_0x2f4332[_0x7c73('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x7c73('0x5d')](_0x2f4332);})[_0x7c73('0x10')](function(_0x3244d6){_0x365c1b[_0x7c73('0x70')]=_0x3244d6;return _0x365c1b;});}})['then'](respondWithFilteredResult(_0x59cfa3,_0x2f4332))['catch'](handleError(_0x59cfa3,null));};exports[_0x7c73('0x76')]=function(_0x4aa539,_0x365148){return db['MailAccount'][_0x7c73('0x65')]({'where':{'id':_0x4aa539[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x365148,null))[_0x7c73('0x10')](function(_0x5a4838){if(_0x5a4838){return _0x5a4838[_0x7c73('0x76')](_0x4aa539['query'][_0x7c73('0x72')]);}})[_0x7c73('0x10')](respondWithStatusCode(_0x365148,null))[_0x7c73('0x5e')](handleError(_0x365148,null));};exports[_0x7c73('0x74')]=function(_0x358f13,_0x17244d){var _0x5867bf={'name':_0x358f13[_0x7c73('0x66')][_0x7c73('0x28')],'key':_0x358f13[_0x7c73('0x66')][_0x7c73('0x77')],'provider':_0x358f13[_0x7c73('0x66')]['provider']==='custom'?null:_0x358f13[_0x7c73('0x66')]['provider'],'email':_0x358f13[_0x7c73('0x66')]['email'],'ListId':_0x358f13[_0x7c73('0x66')][_0x7c73('0x78')],'active':!_[_0x7c73('0x79')](_0x358f13[_0x7c73('0x66')][_0x7c73('0x7a')])?_0x358f13[_0x7c73('0x66')][_0x7c73('0x7a')]:!![],'description':_0x358f13[_0x7c73('0x66')]['description']||null};var _0x335497=getAuthenticationOptions(_0x5867bf['provider'],_0x358f13['body']);_0x5867bf['Imap']=_0x335497[_0x7c73('0x41')];_0x5867bf[_0x7c73('0x45')]=_0x335497[_0x7c73('0x45')];return db[_0x7c73('0x48')][_0x7c73('0x74')](_0x5867bf,{'include':[{'model':db[_0x7c73('0x44')],'as':_0x7c73('0x45')},{'model':db['MailServerIn'],'as':'Imap'}]})['then'](function(_0x133f0a){var _0x42febc=_0x358f13['user'][_0x7c73('0x7b')]({'plain':!![]});if(!_0x42febc)throw new Error(_0x7c73('0x7c'));if(_0x42febc[_0x7c73('0x7d')]==='user'){var _0x4ce750=_0x133f0a[_0x7c73('0x7b')]({'plain':!![]});return db[_0x7c73('0x7e')][_0x7c73('0x65')]({'where':{'name':_0x7c73('0x25'),'userProfileId':_0x42febc[_0x7c73('0x7f')]},'raw':!![]})['then'](function(_0x1e7744){if(_0x1e7744&&_0x1e7744[_0x7c73('0x80')]===0x0){return db[_0x7c73('0x26')][_0x7c73('0x74')]({'name':_0x4ce750[_0x7c73('0x28')],'resourceId':_0x4ce750['id'],'type':_0x1e7744[_0x7c73('0x28')],'sectionId':_0x1e7744['id']},{})[_0x7c73('0x10')](function(){return _0x133f0a;});}else{return _0x133f0a;}})[_0x7c73('0x5e')](function(_0x2a0008){logger[_0x7c73('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a0008);throw _0x2a0008;});}return _0x133f0a;})[_0x7c73('0x10')](respondWithResult(_0x17244d,0xc9))[_0x7c73('0x5e')](handleError(_0x17244d,null));};exports[_0x7c73('0x81')]=function(_0x18c297,_0x48a22f){return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x18c297[_0x7c73('0x6b')]['id']}})['then'](handleEntityNotFound(_0x48a22f,null))[_0x7c73('0x10')](function(_0x4a7e51){if(_0x4a7e51){return _0x4a7e51[_0x7c73('0x81')]();}return null;})['then'](respondWithResult(_0x48a22f,null))[_0x7c73('0x5e')](handleError(_0x48a22f,null));};exports[_0x7c73('0x82')]=function(_0x490127,_0x379d7e){if(_0x490127[_0x7c73('0x66')]['id']){delete _0x490127[_0x7c73('0x66')]['id'];}return db[_0x7c73('0x48')][_0x7c73('0x65')]({'where':{'id':_0x490127['params']['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x379d7e,null))[_0x7c73('0x10')](function(_0x22566e){if(_0x22566e){_0x490127['body'][_0x7c73('0x6c')]=_0x22566e['id'];return db['MailServerIn'][_0x7c73('0x74')](_0x490127[_0x7c73('0x66')]);}})['then'](respondWithResult(_0x379d7e,null))[_0x7c73('0x5e')](handleError(_0x379d7e,null));};exports[_0x7c73('0x83')]=function(_0x3c2e97,_0x4001de){return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x3c2e97[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x4001de,null))[_0x7c73('0x10')](function(_0x291d2){if(_0x291d2){return _0x291d2[_0x7c73('0x84')](null);}return null;})[_0x7c73('0x10')](respondWithStatusCode(_0x4001de,null))[_0x7c73('0x5e')](handleError(_0x4001de,null));};exports[_0x7c73('0x85')]=function(_0x49d454,_0x46eeeb){return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x49d454['params']['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x46eeeb,null))[_0x7c73('0x10')](function(_0x3ade81){if(_0x3ade81){return _0x3ade81[_0x7c73('0x85')]();}return null;})['then'](respondWithResult(_0x46eeeb,null))[_0x7c73('0x5e')](handleError(_0x46eeeb,null));};exports['addSmtp']=function(_0x171e4b,_0x2414f3){if(_0x171e4b[_0x7c73('0x66')]['id']){delete _0x171e4b[_0x7c73('0x66')]['id'];}return db[_0x7c73('0x48')][_0x7c73('0x65')]({'where':{'id':_0x171e4b[_0x7c73('0x6b')]['id']}})['then'](handleEntityNotFound(_0x2414f3,null))['then'](function(_0x3f4a20){if(_0x3f4a20){_0x171e4b['body'][_0x7c73('0x6c')]=_0x3f4a20['id'];return db[_0x7c73('0x44')]['create'](_0x171e4b[_0x7c73('0x66')]);}})['then'](respondWithResult(_0x2414f3,null))[_0x7c73('0x5e')](handleError(_0x2414f3,null));};exports[_0x7c73('0x86')]=function(_0x76cc74,_0x26e48c){return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x76cc74[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x26e48c,null))[_0x7c73('0x10')](function(_0x3e9886){if(_0x3e9886){return _0x3e9886[_0x7c73('0x87')](null);}return null;})[_0x7c73('0x10')](respondWithStatusCode(_0x26e48c,null))[_0x7c73('0x5e')](handleError(_0x26e48c,null));};exports[_0x7c73('0x88')]=function(_0x213a05,_0x40a370){return db[_0x7c73('0x89')][_0x7c73('0x65')]({'where':{'id':_0x213a05['params']['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x40a370,null))[_0x7c73('0x10')](function(_0x83f28e){if(_0x83f28e){return _0x83f28e[_0x7c73('0x88')](_0x213a05[_0x7c73('0x66')]['ids'],_['omit'](_0x213a05['body'],[_0x7c73('0x72'),'id'])||{});}})[_0x7c73('0x10')](respondWithResult(_0x40a370,null))['catch'](handleError(_0x40a370,null));};exports[_0x7c73('0x8a')]=function(_0x19a735,_0xf15e30){var _0x416475={'raw':![],'where':{}};var _0x281007={};var _0x3a955c={'count':0x0,'rows':[]};return db['MailAccount'][_0x7c73('0x6f')]({'where':{'id':_0x19a735[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0xf15e30,null))['then'](function(_0x47db26){if(_0x47db26){_0x281007['model']=_['keys'](db[_0x7c73('0x89')]['rawAttributes']);_0x281007['query']=_[_0x7c73('0x61')](_0x19a735[_0x7c73('0x4b')]);_0x281007[_0x7c73('0x4c')]=_[_0x7c73('0x4e')](_0x281007[_0x7c73('0x4d')],_0x281007[_0x7c73('0x4b')]);_0x416475[_0x7c73('0x50')]=_[_0x7c73('0x4e')](_0x281007[_0x7c73('0x4d')],qs[_0x7c73('0x4f')](_0x19a735['query'][_0x7c73('0x4f')]));_0x416475[_0x7c73('0x50')]=_0x416475[_0x7c73('0x50')][_0x7c73('0x63')]?_0x416475[_0x7c73('0x50')]:_0x281007[_0x7c73('0x4d')];if(!_0x19a735['query'][_0x7c73('0x51')]('nolimit')){_0x416475[_0x7c73('0x53')]=qs[_0x7c73('0x53')](_0x19a735[_0x7c73('0x4b')][_0x7c73('0x53')]);_0x416475['offset']=qs[_0x7c73('0x20')](_0x19a735[_0x7c73('0x4b')][_0x7c73('0x20')]);}_0x416475[_0x7c73('0x54')]=qs['sort'](_0x19a735[_0x7c73('0x4b')][_0x7c73('0x55')]);_0x416475[_0x7c73('0x56')]=qs[_0x7c73('0x4c')](_[_0x7c73('0x57')](_0x19a735[_0x7c73('0x4b')],_0x281007[_0x7c73('0x4c')]));_0x416475['where'][_0x7c73('0x6c')]=_0x47db26['id'];if(_0x19a735['query'][_0x7c73('0x58')]){_0x416475[_0x7c73('0x56')]=_['merge'](_0x416475['where'],{'$or':_[_0x7c73('0x47')](_0x416475['attributes'],function(_0x28a95f){var _0x2482e4={};_0x2482e4[_0x28a95f]={'$like':'%'+_0x19a735[_0x7c73('0x4b')][_0x7c73('0x58')]+'%'};return _0x2482e4;})});}_0x416475=_['merge']({},_0x416475,_0x19a735[_0x7c73('0x64')]);return db['MailInteraction'][_0x7c73('0x1f')]({'where':_0x416475[_0x7c73('0x56')]})[_0x7c73('0x10')](function(_0x4c7e39){_0x3a955c[_0x7c73('0x1f')]=_0x4c7e39;if(_0x19a735[_0x7c73('0x4b')][_0x7c73('0x5b')]){_0x416475[_0x7c73('0x5c')]=[{'model':db[_0x7c73('0x8b')],'as':_0x7c73('0x8c'),'required':![]},{'model':db['User'],'as':_0x7c73('0x8d'),'attributes':[_0x7c73('0x28'),_0x7c73('0x8e'),_0x7c73('0x8f')],'required':![]},{'model':db[_0x7c73('0x90')],'as':'Tags','attributes':['id',_0x7c73('0x28'),_0x7c73('0x91')],'where':_0x19a735['query'][_0x7c73('0x92')]?{'id':_0x19a735[_0x7c73('0x4b')]['tag']}:undefined,'required':_0x19a735[_0x7c73('0x4b')]['tag']?!![]:![]}];}return db[_0x7c73('0x89')]['findAll'](_0x416475);})['then'](function(_0x490e79){_0x3a955c['rows']=_0x490e79;return _0x3a955c;});}})[_0x7c73('0x10')](respondWithFilteredResult(_0xf15e30,_0x416475))[_0x7c73('0x5e')](handleError(_0xf15e30,null));};exports[_0x7c73('0x93')]=function addApplications(_0x5c6207,_0x111663){var _0x4dd850=_0x5c6207[_0x7c73('0x6b')]['id'];var _0x34e001=_0x5c6207[_0x7c73('0x66')];var _0x1933e0=0xc8;var _0x400677=null;return db[_0x7c73('0x94')][_0x7c73('0x95')]({'isolationLevel':db[_0x7c73('0x94')][_0x7c73('0x96')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x52e515){return db['MailAccount'][_0x7c73('0x6f')]({'where':{'id':_0x4dd850},'transaction':_0x52e515})[_0x7c73('0x10')](function(_0xc489){if(_0xc489){return db[_0x7c73('0x97')][_0x7c73('0x24')]({'where':{'MailAccountId':_0x4dd850},'transaction':_0x52e515})[_0x7c73('0x10')](function(){var _0x5bdc95=_['map'](_0x34e001,function(_0x1ae3cb){_0x1ae3cb['MailAccountId']=_0x4dd850;return _0x1ae3cb;});return db['MailApplication']['bulkCreate'](_0x5bdc95,{'transaction':_0x52e515});});}else{_0x1933e0=0x194;_0x400677=[];}});})[_0x7c73('0x10')](function(){if(_0x1933e0!==0x194){return db[_0x7c73('0x97')][_0x7c73('0x98')]({'where':{'MailAccountId':_0x4dd850},'order':'priority'})['then'](function(_0x4c5926){_0x400677=_0x4c5926;});}})[_0x7c73('0x5e')](function(_0x5a1eae){_0x1933e0=0x1f4;logger[_0x7c73('0x17')](_0x5a1eae[_0x7c73('0x27')]);if(_0x5a1eae[_0x7c73('0x28')]){delete _0x5a1eae[_0x7c73('0x28')];}_0x400677=_0x5a1eae;})[_0x7c73('0x99')](function(){if(_0x400677===null){_0x111663['sendStatus'](_0x1933e0);}else{if(_0x1933e0===0x1f4){_0x111663[_0x7c73('0x1b')](_0x1933e0)['send'](_0x400677);}else{_0x111663[_0x7c73('0x1b')](_0x1933e0)[_0x7c73('0x1d')](_0x400677);}}});};exports[_0x7c73('0x9a')]=function(_0x315396,_0x4ad897){var _0x2d442e={};var _0x260fbc={};var _0x3fb609;var _0x5ed787;return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x315396['params']['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x4ad897,null))[_0x7c73('0x10')](function(_0x1532e0){if(_0x1532e0){_0x3fb609=_0x1532e0;_0x260fbc[_0x7c73('0x4d')]=_[_0x7c73('0x61')](db[_0x7c73('0x97')][_0x7c73('0x62')]);_0x260fbc['query']=_[_0x7c73('0x61')](_0x315396[_0x7c73('0x4b')]);_0x260fbc[_0x7c73('0x4c')]=_[_0x7c73('0x4e')](_0x260fbc[_0x7c73('0x4d')],_0x260fbc['query']);_0x2d442e['attributes']=_[_0x7c73('0x4e')](_0x260fbc[_0x7c73('0x4d')],qs['fields'](_0x315396[_0x7c73('0x4b')]['fields']));_0x2d442e['attributes']=_0x2d442e[_0x7c73('0x50')][_0x7c73('0x63')]?_0x2d442e[_0x7c73('0x50')]:_0x260fbc[_0x7c73('0x4d')];_0x2d442e[_0x7c73('0x54')]=qs[_0x7c73('0x55')](_0x315396[_0x7c73('0x4b')]['sort']);_0x2d442e[_0x7c73('0x56')]=qs['filters'](_['pick'](_0x315396[_0x7c73('0x4b')],_0x260fbc[_0x7c73('0x4c')]));if(_0x315396['query'][_0x7c73('0x58')]){_0x2d442e[_0x7c73('0x56')]=_[_0x7c73('0x59')](_0x2d442e['where'],{'$or':_['map'](_0x2d442e['attributes'],function(_0x1b5c23){var _0x436679={};_0x436679[_0x1b5c23]={'$like':'%'+_0x315396[_0x7c73('0x4b')]['filter']+'%'};return _0x436679;})});}_0x2d442e=_[_0x7c73('0x59')]({},_0x2d442e,_0x315396['options']);return _0x3fb609[_0x7c73('0x9a')](_0x2d442e);}})[_0x7c73('0x10')](function(_0x202737){if(_0x202737){_0x5ed787=_0x202737[_0x7c73('0x63')];if(!_0x315396[_0x7c73('0x4b')][_0x7c73('0x51')](_0x7c73('0x52'))){_0x2d442e[_0x7c73('0x53')]=qs['limit'](_0x315396['query'][_0x7c73('0x53')]);_0x2d442e[_0x7c73('0x20')]=qs[_0x7c73('0x20')](_0x315396[_0x7c73('0x4b')][_0x7c73('0x20')]);}return _0x3fb609[_0x7c73('0x9a')](_0x2d442e);}})[_0x7c73('0x10')](function(_0x484bc6){if(_0x484bc6){return _0x484bc6?{'count':_0x5ed787,'rows':_0x484bc6}:null;}})['then'](respondWithResult(_0x4ad897,null))[_0x7c73('0x5e')](handleError(_0x4ad897,null));};exports[_0x7c73('0x9b')]=function(_0x5e7bba,_0x243cb4){var _0x4b0551={'raw':!![],'where':{}};var _0x69dac2={};var _0x54748e={'count':0x0,'rows':[]};return db[_0x7c73('0x48')][_0x7c73('0x6f')]({'where':{'id':_0x5e7bba[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x243cb4,null))['then'](function(_0x33c69f){if(_0x33c69f){_0x69dac2[_0x7c73('0x4d')]=_['keys'](db['MailMessage']['rawAttributes']);_0x69dac2[_0x7c73('0x4b')]=_[_0x7c73('0x61')](_0x5e7bba[_0x7c73('0x4b')]);_0x69dac2[_0x7c73('0x4c')]=_[_0x7c73('0x4e')](_0x69dac2['model'],_0x69dac2[_0x7c73('0x4b')]);_0x4b0551[_0x7c73('0x50')]=_['intersection'](_0x69dac2[_0x7c73('0x4d')],qs[_0x7c73('0x4f')](_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x4f')]));_0x4b0551[_0x7c73('0x50')]=_0x4b0551[_0x7c73('0x50')]['length']?_0x4b0551[_0x7c73('0x50')]:_0x69dac2[_0x7c73('0x4d')];if(!_0x5e7bba['query'][_0x7c73('0x51')](_0x7c73('0x52'))){_0x4b0551[_0x7c73('0x53')]=qs['limit'](_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x53')]);_0x4b0551[_0x7c73('0x20')]=qs[_0x7c73('0x20')](_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x20')]);}_0x4b0551[_0x7c73('0x54')]=qs[_0x7c73('0x55')](_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x55')]);_0x4b0551[_0x7c73('0x56')]=qs[_0x7c73('0x4c')](_[_0x7c73('0x57')](_0x5e7bba[_0x7c73('0x4b')],_0x69dac2[_0x7c73('0x4c')]));_0x4b0551['where'][_0x7c73('0x6c')]=_0x33c69f['id'];if(_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x58')]){_0x4b0551[_0x7c73('0x56')]=_[_0x7c73('0x59')](_0x4b0551[_0x7c73('0x56')],{'$or':_[_0x7c73('0x47')](_0x4b0551[_0x7c73('0x50')],function(_0x29525b){var _0x23a179={};_0x23a179[_0x29525b]={'$like':'%'+_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x58')]+'%'};return _0x23a179;})});}if(_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x9c')]){var _0x32bd10=_0x5e7bba['query'][_0x7c73('0x9c')][_0x7c73('0x9d')](',');var _0x20065c={};_0x20065c[_0x32bd10[0x0]]={'$gte':moment(_0x32bd10[0x1])[_0x7c73('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4b0551[_0x7c73('0x56')]=_[_0x7c73('0x59')](_0x4b0551['where'],_0x20065c);}_0x4b0551=_[_0x7c73('0x59')]({},_0x4b0551,_0x5e7bba['options']);return db[_0x7c73('0x9f')][_0x7c73('0x1f')]({'where':_0x4b0551[_0x7c73('0x56')]})[_0x7c73('0x10')](function(_0x36949c){_0x54748e[_0x7c73('0x1f')]=_0x36949c;if(_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0x5b')]){_0x4b0551[_0x7c73('0x5c')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x4b0551);})[_0x7c73('0x10')](function(_0x57df11){if(_0x5e7bba[_0x7c73('0x4b')][_0x7c73('0xa0')]===_0x7c73('0xa1')){for(var _0x1db3f9=0x0;_0x1db3f9<_0x57df11[_0x7c73('0x63')];_0x1db3f9++){_0x57df11[_0x1db3f9][_0x7c73('0x66')]=juice(_0x57df11[_0x1db3f9][_0x7c73('0x66')]);}}_0x54748e['rows']=_0x57df11;return _0x54748e;});}})[_0x7c73('0x10')](respondWithFilteredResult(_0x243cb4,_0x4b0551))['catch'](handleError(_0x243cb4,null));};exports[_0x7c73('0x29')]=function(_0x3b5f95,_0x26aaf9){var _0x2fd537,_0x4b25c8={},_0x51188c;if(_0x3b5f95[_0x7c73('0x66')]['to']){_0x51188c=_0x3b5f95[_0x7c73('0x66')]['to'][_0x7c73('0x9d')](',')[0x0];}return db[_0x7c73('0x48')][_0x7c73('0x65')]({'where':{'id':_0x3b5f95[_0x7c73('0x6b')]['id']},'include':[{'model':db[_0x7c73('0xa2')],'as':_0x7c73('0xa3'),'include':[{'model':db['CmContact'],'as':_0x7c73('0xa4'),'where':{'email':_0x51188c},'limit':0x1,'order':[[_0x7c73('0xa5'),_0x7c73('0xa6')]]}]},{'model':db[_0x7c73('0x44')],'as':_0x7c73('0x45'),'raw':!![],'include':[{'model':db[_0x7c73('0xa7')],'as':_0x7c73('0xa7'),'raw':!![]}]}]})[_0x7c73('0x10')](handleEntityNotFound(_0x26aaf9,null))[_0x7c73('0x10')](function(_0x2f177a){if(!_0x2f177a)return;_0x2fd537=_0x2f177a;if(!_0x2f177a['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x7c73('0x79')](_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xa8')])){_0x3b5f95[_0x7c73('0x66')]['from']=util[_0x7c73('0x9e')](_0x7c73('0xa9'),_0x2f177a[_0x7c73('0x28')],_0x2f177a[_0x7c73('0xaa')]||_0x2f177a[_0x7c73('0x45')]['user']);}if(_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xab')]&&_0x3b5f95['body'][_0x7c73('0xab')][_0x7c73('0x63')]){for(var _0x5b5694=0x0;_0x5b5694<_0x3b5f95['body'][_0x7c73('0xab')][_0x7c73('0x63')];_0x5b5694+=0x1){_0x3b5f95[_0x7c73('0x66')]['attachments'][_0x5b5694]={'filename':_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xab')][_0x5b5694]['name'],'path':path[_0x7c73('0xac')](config[_0x7c73('0xad')],_0x7c73('0xae'),_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xab')][_0x5b5694][_0x7c73('0xaf')])};}}var _0x39f691=_0x2f177a[_0x7c73('0xb0')]();return respondWithRpcPromise(_0x7c73('0xb1'),'sendMail',{'account':_0x39f691,'message':_0x3b5f95['body']});})['then'](function(_0x188196){if(!_0x188196)return;_0x4b25c8=_0x188196;if(!_0x2fd537['List'])throw new Error(_0x7c73('0xb2'));if(_0x2fd537[_0x7c73('0xa3')][_0x7c73('0xa4')][_0x7c73('0x63')])return _0x2fd537[_0x7c73('0xa3')][_0x7c73('0xa4')][0x0];return db['CmContact'][_0x7c73('0x74')](_['defaults'](_0x3b5f95[_0x7c73('0x66')],{'firstName':_0x3b5f95['body']['to'],'email':_0x3b5f95[_0x7c73('0x66')]['to'],'phone':_0x3b5f95[_0x7c73('0x66')]['to'],'ListId':_0x2fd537[_0x7c73('0x78')]}));})[_0x7c73('0x10')](function(_0x51eaa2){if(!_0x51eaa2)return;var _0x95672={'UserId':_0x3b5f95['user']['id'],'ContactId':_0x51eaa2['id'],'MailAccountId':_0x2fd537['id'],'inReplyTo':_0x4b25c8[_0x7c73('0xb3')],'to':_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xa8')],'cc':_0x3b5f95[_0x7c73('0x66')]['cc'],'subject':_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xb4')],'attach':_0x3b5f95['body']['attach'],'firstMsgDirection':_0x7c73('0xb5'),'lastMsgAt':moment()['format'](_0x7c73('0xb6')),'lastMsgDirection':_0x7c73('0xb5'),'Messages':[_[_0x7c73('0x59')](_0x3b5f95[_0x7c73('0x66')],{'messageId':_0x4b25c8[_0x7c73('0xb3')],'sentAt':moment()[_0x7c73('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x2fd537['id'],'UserId':_0x3b5f95[_0x7c73('0x36')]['id'],'ContactId':_0x51eaa2['id']})]};if(_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xb7')]){_0x95672=_[_0x7c73('0x59')](_0x95672,_0x3b5f95[_0x7c73('0x66')][_0x7c73('0xb7')]);}return db[_0x7c73('0x89')][_0x7c73('0x74')](_0x95672,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0x7c73('0x10')](respondWithResult(_0x26aaf9,null))[_0x7c73('0x5e')](handleError(_0x26aaf9,null));};exports[_0x7c73('0xb8')]=function(_0x27c6ac,_0x4719d4){return db['MailAccount'][_0x7c73('0x65')]({'where':{'id':_0x27c6ac['params']['id']},'include':[{'model':db[_0x7c73('0x44')],'as':_0x7c73('0x45'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x7c73('0x10')](handleEntityNotFound(_0x4719d4,null))['then'](function(_0x12375f){if(!_0x12375f[_0x7c73('0x45')])return;var _0x23dd64=_0x12375f[_0x7c73('0xb0')]();return respondWithRpcPromise('VerifySmtp',_0x7c73('0xb8'),{'account':_0x23dd64});})[_0x7c73('0x10')](respondWithResult(_0x4719d4,null))[_0x7c73('0x5e')](handleError(_0x4719d4,null));};exports[_0x7c73('0x24')]=function(_0x15be21,_0xa436a2){return db['MailAccount']['find']({'where':{'id':_0x15be21[_0x7c73('0x6b')]['id']}})['then'](handleEntityNotFound(_0xa436a2,null))['then'](function(_0x55a47c){if(_0x55a47c&&_0x55a47c['service']){throw new db[(_0x7c73('0xb9'))][(_0x7c73('0xba'))](_0x7c73('0xbb'));}return _0x55a47c;})[_0x7c73('0x10')](removeEntity(_0xa436a2,null))[_0x7c73('0x5e')](handleError(_0xa436a2,null));};exports['addAgents']=function(_0x4578e5,_0x539b61){return db[_0x7c73('0x48')][_0x7c73('0x65')]({'where':{'id':_0x4578e5[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x539b61,null))[_0x7c73('0x10')](function(_0x3458c4){if(_0x3458c4){return _0x3458c4[_0x7c73('0xbc')](_0x4578e5[_0x7c73('0x66')][_0x7c73('0x72')],_['omit'](_0x4578e5['body'],[_0x7c73('0x72'),'id'])||{})[_0x7c73('0xbd')](function(_0x5c1f40){for(var _0x2a7fa5=0x0;_0x2a7fa5<_0x4578e5[_0x7c73('0x66')][_0x7c73('0x72')]['length'];_0x2a7fa5+=0x1){socket[_0x7c73('0xbe')](_0x7c73('0xbf'),{'UserId':Number(_0x4578e5[_0x7c73('0x66')][_0x7c73('0x72')][_0x2a7fa5]),'MailAccountId':Number(_0x4578e5[_0x7c73('0x6b')]['id'])});}return _0x5c1f40;});}})[_0x7c73('0x10')](respondWithResult(_0x539b61,null))[_0x7c73('0x5e')](handleError(_0x539b61,null));};exports[_0x7c73('0xc0')]=function(_0xb92681,_0x285558){return db[_0x7c73('0x48')][_0x7c73('0x65')]({'where':{'id':_0xb92681[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x285558,null))[_0x7c73('0x10')](function(_0x436a74){if(_0x436a74){return _0x436a74['removeAgents'](_0xb92681[_0x7c73('0x4b')][_0x7c73('0x72')])[_0x7c73('0x10')](function(){if(_['isArray'](_0xb92681[_0x7c73('0x4b')]['ids'])){for(var _0x32156a=0x0;_0x32156a<_0xb92681['query']['ids'][_0x7c73('0x63')];_0x32156a+=0x1){socket[_0x7c73('0xbe')]('userMailAccount:remove',{'UserId':Number(_0xb92681[_0x7c73('0x4b')]['ids'][_0x32156a]),'MailAccountId':Number(_0xb92681[_0x7c73('0x6b')]['id'])});}}else{socket['emit'](_0x7c73('0xc1'),{'UserId':Number(_0xb92681[_0x7c73('0x4b')][_0x7c73('0x72')]),'MailAccountId':Number(_0xb92681[_0x7c73('0x6b')]['id'])});}});}})[_0x7c73('0x10')](respondWithStatusCode(_0x285558,null))['catch'](handleError(_0x285558,null));};exports['getAgents']=function(_0x45c190,_0x3929b7){var _0x4c3231={};var _0x3af422={};var _0x21d0d0;var _0x3e5ce4;return db['MailAccount'][_0x7c73('0x6f')]({'where':{'id':_0x45c190[_0x7c73('0x6b')]['id']}})[_0x7c73('0x10')](handleEntityNotFound(_0x3929b7,null))[_0x7c73('0x10')](function(_0x54d70c){if(_0x54d70c){_0x21d0d0=_0x54d70c;_0x3af422['model']=_[_0x7c73('0x61')](db[_0x7c73('0xc2')][_0x7c73('0x62')]);_0x3af422['query']=_[_0x7c73('0x61')](_0x45c190[_0x7c73('0x4b')]);_0x3af422[_0x7c73('0x4c')]=_['intersection'](_0x3af422[_0x7c73('0x4d')],_0x3af422['query']);_0x4c3231['attributes']=_['intersection'](_0x3af422['model'],qs[_0x7c73('0x4f')](_0x45c190[_0x7c73('0x4b')][_0x7c73('0x4f')]));_0x4c3231['attributes']=_0x4c3231[_0x7c73('0x50')][_0x7c73('0x63')]?_0x4c3231['attributes']:_0x3af422[_0x7c73('0x4d')];_0x4c3231['order']=qs['sort'](_0x45c190[_0x7c73('0x4b')][_0x7c73('0x55')]);_0x4c3231['where']=qs['filters'](_['pick'](_0x45c190[_0x7c73('0x4b')],_0x3af422[_0x7c73('0x4c')]));if(_0x45c190[_0x7c73('0x4b')][_0x7c73('0x58')]){_0x4c3231['where']=_[_0x7c73('0x59')](_0x4c3231[_0x7c73('0x56')],{'$or':_[_0x7c73('0x47')](_0x4c3231[_0x7c73('0x50')],function(_0x4c0537){var _0x38a352={};_0x38a352[_0x4c0537]={'$like':'%'+_0x45c190[_0x7c73('0x4b')][_0x7c73('0x58')]+'%'};return _0x38a352;})});}_0x4c3231=_[_0x7c73('0x59')]({},_0x4c3231,_0x45c190['options']);return _0x21d0d0[_0x7c73('0xc3')](_0x4c3231);}})[_0x7c73('0x10')](function(_0x493807){if(_0x493807){_0x3e5ce4=_0x493807[_0x7c73('0x63')];if(!_0x45c190[_0x7c73('0x4b')][_0x7c73('0x51')](_0x7c73('0x52'))){_0x4c3231['limit']=qs[_0x7c73('0x53')](_0x45c190['query']['limit']);_0x4c3231[_0x7c73('0x20')]=qs['offset'](_0x45c190[_0x7c73('0x4b')]['offset']);}return _0x21d0d0[_0x7c73('0xc3')](_0x4c3231);}})['then'](function(_0x490b87){if(_0x490b87){return _0x490b87?{'count':_0x3e5ce4,'rows':_0x490b87}:null;}})[_0x7c73('0x10')](respondWithResult(_0x3929b7,null))[_0x7c73('0x5e')](handleError(_0x3929b7,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 0fbf2c8..eec8a6d 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 _0x3759=['../../mysqldb','MailAccount','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3759,0x131));var _0x9375=function(_0x29e8fc,_0x50ec06){_0x29e8fc=_0x29e8fc-0x0;var _0xbc2043=_0x3759[_0x29e8fc];return _0xbc2043;};'use strict';var EventEmitter=require(_0x9375('0x0'));var MailAccount=require(_0x9375('0x1'))['db'][_0x9375('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9375('0x3')](0x0);var events={'afterCreate':_0x9375('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4153b7){return function(_0x1a4f37,_0x593f50,_0x1ec343){MailAccountEvents[_0x9375('0x5')](_0x4153b7+':'+_0x1a4f37['id'],_0x1a4f37);MailAccountEvents['emit'](_0x4153b7,_0x1a4f37);_0x1ec343(null);};}for(var e in events){if(events[_0x9375('0x6')](e)){var event=events[e];MailAccount[_0x9375('0x7')](e,emitEvent(event));}}module[_0x9375('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x8200=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x3fbc13,_0x56ed2c){var _0x5a9089=function(_0x1e94d8){while(--_0x1e94d8){_0x3fbc13['push'](_0x3fbc13['shift']());}};_0x5a9089(++_0x56ed2c);}(_0x8200,0x11f));var _0x0820=function(_0x5c5eff,_0x39ce44){_0x5c5eff=_0x5c5eff-0x0;var _0x1adfd8=_0x8200[_0x5c5eff];return _0x1adfd8;};'use strict';var EventEmitter=require(_0x0820('0x0'));var MailAccount=require(_0x0820('0x1'))['db'][_0x0820('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0820('0x3'),'afterUpdate':_0x0820('0x4'),'afterDestroy':_0x0820('0x5')};function emitEvent(_0x509e4c){return function(_0x163dd1,_0x48b5ea,_0x59cf3b){MailAccountEvents[_0x0820('0x6')](_0x509e4c+':'+_0x163dd1['id'],_0x163dd1);MailAccountEvents['emit'](_0x509e4c,_0x163dd1);_0x59cf3b(null);};}for(var e in events){if(events[_0x0820('0x7')](e)){var event=events[e];MailAccount[_0x0820('0x8')](e,emitEvent(event));}}module[_0x0820('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 fde4a72..e0dfc7b 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 _0x089b=['host','Smtp','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','data5','user','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','service'];(function(_0x55e4f8,_0x313ff9){var _0xe6a0b1=function(_0xf783b3){while(--_0xf783b3){_0x55e4f8['push'](_0x55e4f8['shift']());}};_0xe6a0b1(++_0x313ff9);}(_0x089b,0x70));var _0xb089=function(_0x72bade,_0x28f741){_0x72bade=_0x72bade-0x0;var _0x27f1c0=_0x089b[_0x72bade];return _0x27f1c0;};'use strict';var attributes=require(_0xb089('0x0'));module[_0xb089('0x1')]=function(_0x37ede3){return _0x37ede3[_0xb089('0x2')](_0xb089('0x3'),attributes,{'tableName':_0xb089('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x12d93a=this;var _0x7eea5d={'id':_0x12d93a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x12d93a[_0xb089('0x5')]!=='custom'){_0x7eea5d[_0xb089('0x6')]=_0x12d93a[_0xb089('0x5')];}else{_0x7eea5d[_0xb089('0x7')]=_0x12d93a[_0xb089('0x8')][_0xb089('0x7')];_0x7eea5d[_0xb089('0x9')]=_0x12d93a[_0xb089('0x8')][_0xb089('0x9')];_0x7eea5d[_0xb089('0xa')]=_0x12d93a[_0xb089('0x8')][_0xb089('0xa')];}if(_0x12d93a[_0xb089('0x8')]['authentication']){if(_0x12d93a[_0xb089('0x8')][_0xb089('0xb')]){if(!_0x12d93a[_0xb089('0x8')][_0xb089('0xc')])throw new Error(_0xb089('0xd'));_0x7eea5d['auth']={'type':_0xb089('0xe'),'user':_0x12d93a[_0xb089('0x8')]['user'],'accessToken':_0x12d93a[_0xb089('0x8')][_0xb089('0xc')][_0xb089('0xf')]};}else{_0x7eea5d['auth']={'user':_0x12d93a['Smtp'][_0xb089('0x10')],'pass':_0x12d93a[_0xb089('0x8')]['pass']};}}return _0x7eea5d;}}});}; \ No newline at end of file +var _0x75c9=['CloudProvider','auth','user','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','provider','custom','host','Smtp','port','secure','authentication'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x75c9,0xd6));var _0x975c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x75c9[_0xbca1b1];return _0x4e1686;};'use strict';var attributes=require(_0x975c('0x0'));module['exports']=function(_0x3ca783){return _0x3ca783[_0x975c('0x1')](_0x975c('0x2'),attributes,{'tableName':_0x975c('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x25c62f=this;var _0x2c103c={'id':_0x25c62f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x25c62f[_0x975c('0x4')]!==_0x975c('0x5')){_0x2c103c['service']=_0x25c62f[_0x975c('0x4')];}else{_0x2c103c[_0x975c('0x6')]=_0x25c62f[_0x975c('0x7')][_0x975c('0x6')];_0x2c103c[_0x975c('0x8')]=_0x25c62f[_0x975c('0x7')]['port'];_0x2c103c['secure']=_0x25c62f['Smtp'][_0x975c('0x9')];}if(_0x25c62f['Smtp'][_0x975c('0xa')]){if(_0x25c62f[_0x975c('0x7')]['modernAuthentication']){if(!_0x25c62f[_0x975c('0x7')][_0x975c('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x2c103c[_0x975c('0xc')]={'type':'OAuth2','user':_0x25c62f['Smtp'][_0x975c('0xd')],'accessToken':_0x25c62f[_0x975c('0x7')][_0x975c('0xb')]['data5']};}else{_0x2c103c[_0x975c('0xc')]={'user':_0x25c62f[_0x975c('0x7')]['user'],'pass':_0x25c62f[_0x975c('0x7')][_0x975c('0xe')]};}}return _0x2c103c;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 2d8159d..d25f049 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 _0x1967=['getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmContact','updatedAt','Applications','CloudProvider','List','get','applications','list','priority','asc','autoclose','push','close','*,*,*,*','Contacts','length','create','messageId','generate','subject','attach','format','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','contact','attachments','originTo','originCc','bcc','ChatOfflineMessageId','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailAccount','findAll','options','where','attributes','limit','map','include','model','ShowMailAccount','MailAccount','find','smtp','setDataValue','smtpOptions'];(function(_0x414f67,_0x861aed){var _0x338537=function(_0x4696fd){while(--_0x4696fd){_0x414f67['push'](_0x414f67['shift']());}};_0x338537(++_0x861aed);}(_0x1967,0x173));var _0x7196=function(_0x4cb443,_0xdfa09c){_0x4cb443=_0x4cb443-0x0;var _0x50db0e=_0x1967[_0x4cb443];return _0x50db0e;};'use strict';var _=require('lodash');var moment=require(_0x7196('0x0'));var BPromise=require(_0x7196('0x1'));var rs=require(_0x7196('0x2'));var Redis=require(_0x7196('0x3'));var db=require(_0x7196('0x4'))['db'];var logger=require(_0x7196('0x5'))(_0x7196('0x6'));var config=require(_0x7196('0x7'));var jayson=require(_0x7196('0x8'));var client=jayson[_0x7196('0x9')]['http']({'port':0x232c});config[_0x7196('0xa')]=_[_0x7196('0xb')](config[_0x7196('0xa')],{'host':_0x7196('0xc'),'port':0x18eb});var socket=require(_0x7196('0xd'))(new Redis(config[_0x7196('0xa')]));require('./mailAccount.socket')[_0x7196('0xe')](socket);function respondWithRpcPromise(_0xc6366f,_0x3f846e,_0x259b18){return new BPromise(function(_0x1e862d,_0x503070){return client['request'](_0xc6366f,_0x259b18)[_0x7196('0xf')](function(_0x10459b){logger[_0x7196('0x10')](_0x7196('0x11'),_0x3f846e,_0x7196('0x12'));logger[_0x7196('0x13')](_0x7196('0x14'),_0x3f846e,_0x7196('0x12'),JSON[_0x7196('0x15')](_0x10459b));if(_0x10459b[_0x7196('0x16')]){if(_0x10459b[_0x7196('0x16')]['code']===0x1f4){logger[_0x7196('0x16')](_0x7196('0x11'),_0x3f846e,_0x10459b[_0x7196('0x16')][_0x7196('0x17')]);return _0x503070(_0x10459b['error'][_0x7196('0x17')]);}logger['error'](_0x7196('0x11'),_0x3f846e,_0x10459b[_0x7196('0x16')][_0x7196('0x17')]);return _0x1e862d(_0x10459b[_0x7196('0x16')][_0x7196('0x17')]);}else{logger[_0x7196('0x10')](_0x7196('0x11'),_0x3f846e,_0x7196('0x12'));_0x1e862d(_0x10459b[_0x7196('0x18')][_0x7196('0x17')]);}})[_0x7196('0x19')](function(_0x5b716a){logger['error'](_0x7196('0x11'),_0x3f846e,_0x5b716a);_0x503070(_0x5b716a);});});}exports[_0x7196('0x1a')]=function(_0x40418d){var _0x517a3e=this;return new Promise(function(_0x39b944,_0x539d8b){return db['MailAccount'][_0x7196('0x1b')]({'raw':_0x40418d[_0x7196('0x1c')]?_0x40418d[_0x7196('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x40418d['options']?_0x40418d[_0x7196('0x1c')][_0x7196('0x1d')]||null:null,'attributes':_0x40418d['options']?_0x40418d[_0x7196('0x1c')][_0x7196('0x1e')]||null:null,'limit':_0x40418d[_0x7196('0x1c')]?_0x40418d[_0x7196('0x1c')][_0x7196('0x1f')]||null:null,'include':_0x40418d['options']?_0x40418d[_0x7196('0x1c')]['include']?_[_0x7196('0x20')](_0x40418d[_0x7196('0x1c')][_0x7196('0x21')],function(_0xa69810){return{'model':db[_0xa69810[_0x7196('0x22')]],'as':_0xa69810['as'],'attributes':_0xa69810[_0x7196('0x1e')],'include':_0xa69810['include']?_['map'](_0xa69810[_0x7196('0x21')],function(_0x2d284f){return{'model':db[_0x2d284f[_0x7196('0x22')]],'as':_0x2d284f['as'],'attributes':_0x2d284f['attributes'],'include':_0x2d284f['include']?_[_0x7196('0x20')](_0x2d284f[_0x7196('0x21')],function(_0x675e64){return{'model':db[_0x675e64['model']],'as':_0x675e64['as'],'attributes':_0x675e64[_0x7196('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fd339){logger['info'](_0x7196('0x1a'),_0x40418d);logger[_0x7196('0x13')](_0x7196('0x1a'),_0x40418d,JSON['stringify'](_0x4fd339));_0x39b944(_0x4fd339);})[_0x7196('0x19')](function(_0x45d567){logger[_0x7196('0x16')](_0x7196('0x1a'),_0x45d567['message'],_0x40418d);_0x539d8b(_0x517a3e[_0x7196('0x16')](0x1f4,_0x45d567[_0x7196('0x17')]));});});};exports[_0x7196('0x23')]=function(_0x651d7e){var _0x4780e1=this;return new Promise(function(_0x2786f3,_0x15c5f0){return db[_0x7196('0x24')][_0x7196('0x25')]({'raw':_0x651d7e[_0x7196('0x1c')]?_0x651d7e[_0x7196('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x651d7e[_0x7196('0x1c')]?_0x651d7e['options'][_0x7196('0x1d')]||null:null,'attributes':_0x651d7e['options']?_0x651d7e[_0x7196('0x1c')][_0x7196('0x1e')]||null:null,'include':_0x651d7e['options']?_0x651d7e[_0x7196('0x1c')][_0x7196('0x21')]?_[_0x7196('0x20')](_0x651d7e[_0x7196('0x1c')][_0x7196('0x21')],function(_0x4a8580){return{'model':db[_0x4a8580[_0x7196('0x22')]],'as':_0x4a8580['as'],'attributes':_0x4a8580[_0x7196('0x1e')],'include':_0x4a8580[_0x7196('0x21')]?_[_0x7196('0x20')](_0x4a8580[_0x7196('0x21')],function(_0x123cad){return{'model':db[_0x123cad['model']],'as':_0x123cad['as'],'attributes':_0x123cad[_0x7196('0x1e')],'include':_0x123cad[_0x7196('0x21')]?_[_0x7196('0x20')](_0x123cad['include'],function(_0x33831a){return{'model':db[_0x33831a[_0x7196('0x22')]],'as':_0x33831a['as'],'attributes':_0x33831a[_0x7196('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7196('0xf')](function(_0x11d4ec){if(_0x651d7e[_0x7196('0x1c')][_0x7196('0x26')]===!![])_0x11d4ec[_0x7196('0x27')](_0x7196('0x28'),_0x11d4ec[_0x7196('0x29')]());logger['info'](_0x7196('0x23'),_0x651d7e);logger[_0x7196('0x13')]('ShowMailAccount',_0x651d7e,JSON[_0x7196('0x15')](_0x11d4ec));_0x2786f3(_0x11d4ec);})['catch'](function(_0x5bd701){logger[_0x7196('0x16')](_0x7196('0x23'),_0x5bd701['message'],_0x651d7e);_0x15c5f0(_0x4780e1['error'](0x1f4,_0x5bd701[_0x7196('0x17')]));});});};exports[_0x7196('0x2a')]=function(_0xed32cd){var _0x4c2341=this;return new Promise(function(_0x36a990,_0x2d13a5){var _0x29ba1c={'body':_0xed32cd[_0x7196('0x2b')],'channel':_0x7196('0x2c')};var _0x428d76=_[_0x7196('0x2d')](_[_0x7196('0x2e')](db['CmContact'][_0x7196('0x2f')]),[_0x7196('0x30'),'updatedAt',_0x7196('0x31'),_0x7196('0x32')]);var _0x48178f=![];if(_0xed32cd[_0x7196('0x2b')]['id']){delete _0xed32cd[_0x7196('0x2b')]['id'];}if(_[_0x7196('0x33')](_0xed32cd['body'][_0x7196('0x34')])){return _0x2d13a5(_0x4c2341[_0x7196('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x7196('0x33')](_0xed32cd[_0x7196('0x2b')]['body'])||_0xed32cd[_0x7196('0x2b')]['body']===''){return _0x2d13a5(_0x4c2341['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0xed32cd['body'][_0x7196('0x35')])){return _0x2d13a5(_0x4c2341['error'](0x1f4,_0x7196('0x36')+_0x428d76));}if(!_[_0x7196('0x37')](_0x428d76,_0xed32cd[_0x7196('0x2b')][_0x7196('0x35')])){return _0x2d13a5(_0x4c2341['error'](0x1f4,_0x7196('0x38')+_0x428d76));}var _0x56ffdd={};_0x56ffdd[_0xed32cd[_0x7196('0x2b')][_0x7196('0x35')]]=_0xed32cd[_0x7196('0x2b')]['from'];return db[_0x7196('0x24')][_0x7196('0x25')]({'where':{'id':_0xed32cd[_0x7196('0x39')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7196('0x3a')],'as':'Contacts','where':_0x56ffdd,'limit':0x1,'order':[[_0x7196('0x3b'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x7196('0x3c')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x7196('0x3d')}]}]})['then'](function(_0x48e3b5){if(_0x48e3b5&&_0x48e3b5[_0x7196('0x3e')]){var _0x182c8b=_0x48e3b5[_0x7196('0x3f')]({'plain':!![]});_0x29ba1c[_0x7196('0x39')]=_['omit'](_0x182c8b,[_0x7196('0x3c'),'List']);_0x29ba1c[_0x7196('0x39')][_0x7196('0x28')]=_0x48e3b5['getSmtpOptions']();_0x29ba1c[_0x7196('0x40')]=_0x182c8b[_0x7196('0x3c')];_0x29ba1c[_0x7196('0x41')]=_0x182c8b['List'];_0x29ba1c[_0x7196('0x40')]=_['orderBy'](_0x29ba1c[_0x7196('0x40')],[_0x7196('0x42')],[_0x7196('0x43')]);if(_0x29ba1c[_0x7196('0x39')]&&_0x29ba1c[_0x7196('0x39')][_0x7196('0x44')]){_0x29ba1c[_0x7196('0x40')][_0x7196('0x45')]({'id':0x0,'priority':_0x29ba1c['applications']['length']+0x1,'app':_0x7196('0x46'),'appdata':_0x7196('0x44'),'interval':_0x7196('0x47')});}if(_0x29ba1c[_0x7196('0x39')]['Applications']){delete _0x29ba1c[_0x7196('0x39')][_0x7196('0x3c')];}if(_0x29ba1c[_0x7196('0x39')][_0x7196('0x3e')]){delete _0x29ba1c[_0x7196('0x39')][_0x7196('0x3e')];}if(_0x182c8b[_0x7196('0x3e')][_0x7196('0x48')][_0x7196('0x49')]){return _0x182c8b[_0x7196('0x3e')][_0x7196('0x48')][0x0];}var _0x4940a2=_[_0x7196('0xb')](_0xed32cd[_0x7196('0x2b')],{'firstName':_0xed32cd[_0x7196('0x2b')]['from'],'ListId':_0x182c8b[_0x7196('0x32')]});_0x4940a2[_0xed32cd['body'][_0x7196('0x35')]]=_0xed32cd[_0x7196('0x2b')][_0x7196('0x34')];return db[_0x7196('0x3a')][_0x7196('0x4a')](_0x4940a2);}else{throw new Error('List\x20not\x20found');}})[_0x7196('0xf')](function(_0x5b77fc){_0x29ba1c['contact']=_0x5b77fc;if(_0x5b77fc){if(!_0xed32cd['body'][_0x7196('0x17')][_0x7196('0x4b')]){_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4b')]=rs[_0x7196('0x4c')]()+'\x20'+_0xed32cd[_0x7196('0x2b')]['message'][_0x7196('0x34')];}var _0x14dc43={'ContactId':_0x5b77fc['id'],'MailAccountId':_0xed32cd[_0x7196('0x39')]['id'],'inReplyTo':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['messageId'],'to':_0xed32cd['body'][_0x7196('0x17')][_0x7196('0x34')],'cc':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['cc'],'subject':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4d')],'attach':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4e')],'lastMsgAt':moment()[_0x7196('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x7196('0x50')][_0x7196('0x25')]({'where':{'closed':![],'MailAccountId':_0xed32cd[_0x7196('0x39')]['id']},'include':[{'model':db[_0x7196('0x51')],'as':'Messages','attributes':[_0x7196('0x4b')],'where':{'messageId':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x52')]}}]})[_0x7196('0xf')](function(_0x3c3d64){if(_0x3c3d64){return[_0x3c3d64,![]];}return db[_0x7196('0x50')]['create'](_0x14dc43)[_0x7196('0xf')](function(_0x2c5cba){return[_0x2c5cba,!![]];});});}else{throw new Error(_0x7196('0x53'));}})[_0x7196('0x54')](function(_0x52827f,_0x418a7a){if(_0x52827f){_0x48178f=_0x418a7a;if(!_0x418a7a){return _0x52827f[_0x7196('0x55')]({'inReplyTo':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4b')],'to':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['from'],'cc':_0xed32cd['body']['message']['cc'],'subject':_0xed32cd[_0x7196('0x2b')]['message'][_0x7196('0x4d')],'attach':_0x52827f[_0x7196('0x4e')]?_0x52827f[_0x7196('0x4e')]:_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4e')],'substatus':null,'substatusAt':moment()[_0x7196('0x4f')](_0x7196('0x56')),'lastMsgAt':moment()[_0x7196('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x52827f;}}})['then'](function(_0x4542c1){_0x29ba1c[_0x7196('0x57')]=_0x4542c1[_0x7196('0x3f')]({'plain':!![]});_0x29ba1c[_0x7196('0x57')][_0x7196('0x58')]=_0x48178f;return db[_0x7196('0x51')][_0x7196('0x4a')]({'body':_0xed32cd[_0x7196('0x2b')]['body'],'MailAccountId':_0xed32cd['account']['id'],'MailInteractionId':_0x4542c1['id'],'direction':'in','ContactId':_0x29ba1c[_0x7196('0x59')]['id'],'messageId':_0xed32cd['body'][_0x7196('0x17')]['messageId'],'from':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x34')],'to':_0xed32cd[_0x7196('0x2b')]['message']['to'],'cc':_0xed32cd['body'][_0x7196('0x17')]['cc'],'subject':_0xed32cd['body'][_0x7196('0x17')][_0x7196('0x4d')],'attach':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4e')],'Attachments':_0xed32cd[_0x7196('0x2b')]['message'][_0x7196('0x5a')],'originTo':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x5b')],'originCc':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x5c')],'bcc':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x5d')],'ChatWebsiteId':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['ChatWebsiteId']||null,'originChannel':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['originChannel']||'Email','ChatOfflineMessageId':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x5e')]||null},{'include':[{'model':db['Attachment'],'as':_0x7196('0x5f')}]});})['then'](function(_0x218396){_0x29ba1c[_0x7196('0x17')]=_0x218396;if(_0x29ba1c['interaction'][_0x7196('0x60')]){return db['User']['find']({'attributes':['id',_0x7196('0x61')],'where':{'id':_0x29ba1c[_0x7196('0x57')][_0x7196('0x60')]}})['then'](function(_0x423b83){if(_0x423b83){_0x29ba1c['applications'][_0x7196('0x62')]({'id':0x0,'priority':0x0,'app':_0x7196('0x63'),'appdata':_0x423b83[_0x7196('0x61')]+','+(_0x29ba1c[_0x7196('0x39')][_0x7196('0x64')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7196('0x65'),_0x7196('0x66'),_0x29ba1c);});}return respondWithRpcPromise(_0x7196('0x65'),_0x7196('0x66'),_0x29ba1c);})[_0x7196('0xf')](function(_0x29bafd){_0x36a990(_0x29bafd);})[_0x7196('0x19')](function(_0x34633a){_0x2d13a5(_0x4c2341['error'](0x1f4,_0x34633a[_0x7196('0x17')]));});});}; \ No newline at end of file +var _0x524e=['ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','CloudProvider','get','Applications','applications','orderBy','priority','asc','autoclose','push','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','MailMessage','attachments','originTo','originCc','bcc'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x524e,0x15e));var _0xe524=function(_0x46b665,_0xfab071){_0x46b665=_0x46b665-0x0;var _0x29f1f5=_0x524e[_0x46b665];return _0x29f1f5;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xe524('0x0'));var rs=require(_0xe524('0x1'));var Redis=require(_0xe524('0x2'));var db=require(_0xe524('0x3'))['db'];var logger=require(_0xe524('0x4'))(_0xe524('0x5'));var config=require(_0xe524('0x6'));var jayson=require(_0xe524('0x7'));var client=jayson[_0xe524('0x8')][_0xe524('0x9')]({'port':0x232c});config['redis']=_[_0xe524('0xa')](config[_0xe524('0xb')],{'host':_0xe524('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe524('0xb')]));require(_0xe524('0xd'))[_0xe524('0xe')](socket);function respondWithRpcPromise(_0x1f36e5,_0x991924,_0x4082b1){return new BPromise(function(_0x1a08e2,_0xb3eb9f){return client[_0xe524('0xf')](_0x1f36e5,_0x4082b1)[_0xe524('0x10')](function(_0x1e4459){logger[_0xe524('0x11')](_0xe524('0x12'),_0x991924,_0xe524('0x13'));logger[_0xe524('0x14')](_0xe524('0x15'),_0x991924,'request\x20sent',JSON['stringify'](_0x1e4459));if(_0x1e4459[_0xe524('0x16')]){if(_0x1e4459[_0xe524('0x16')][_0xe524('0x17')]===0x1f4){logger[_0xe524('0x16')](_0xe524('0x12'),_0x991924,_0x1e4459['error'][_0xe524('0x18')]);return _0xb3eb9f(_0x1e4459['error'][_0xe524('0x18')]);}logger[_0xe524('0x16')]('MailAccount,\x20%s,\x20%s',_0x991924,_0x1e4459[_0xe524('0x16')]['message']);return _0x1a08e2(_0x1e4459[_0xe524('0x16')]['message']);}else{logger[_0xe524('0x11')]('MailAccount,\x20%s,\x20%s',_0x991924,'request\x20sent');_0x1a08e2(_0x1e4459['result'][_0xe524('0x18')]);}})['catch'](function(_0x11b2a1){logger[_0xe524('0x16')](_0xe524('0x12'),_0x991924,_0x11b2a1);_0xb3eb9f(_0x11b2a1);});});}exports[_0xe524('0x19')]=function(_0x5d7b17){var _0x1fd93a=this;return new Promise(function(_0x3ccb3f,_0x49d104){return db[_0xe524('0x1a')][_0xe524('0x1b')]({'raw':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17[_0xe524('0x1c')][_0xe524('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17[_0xe524('0x1c')][_0xe524('0x1e')]||null:null,'attributes':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17['options'][_0xe524('0x1f')]||null:null,'limit':_0x5d7b17['options']?_0x5d7b17['options'][_0xe524('0x20')]||null:null,'include':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17[_0xe524('0x1c')][_0xe524('0x21')]?_['map'](_0x5d7b17[_0xe524('0x1c')]['include'],function(_0x17e245){return{'model':db[_0x17e245[_0xe524('0x22')]],'as':_0x17e245['as'],'attributes':_0x17e245[_0xe524('0x1f')],'include':_0x17e245[_0xe524('0x21')]?_[_0xe524('0x23')](_0x17e245[_0xe524('0x21')],function(_0x2141db){return{'model':db[_0x2141db['model']],'as':_0x2141db['as'],'attributes':_0x2141db['attributes'],'include':_0x2141db[_0xe524('0x21')]?_[_0xe524('0x23')](_0x2141db[_0xe524('0x21')],function(_0x109a96){return{'model':db[_0x109a96[_0xe524('0x22')]],'as':_0x109a96['as'],'attributes':_0x109a96['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b1ff){logger[_0xe524('0x11')](_0xe524('0x19'),_0x5d7b17);logger[_0xe524('0x14')](_0xe524('0x19'),_0x5d7b17,JSON['stringify'](_0x4b1ff));_0x3ccb3f(_0x4b1ff);})[_0xe524('0x24')](function(_0x9a7e98){logger['error']('GetMailAccount',_0x9a7e98[_0xe524('0x18')],_0x5d7b17);_0x49d104(_0x1fd93a[_0xe524('0x16')](0x1f4,_0x9a7e98['message']));});});};exports[_0xe524('0x25')]=function(_0x535354){var _0x3fec06=this;return new Promise(function(_0x54af2a,_0x315e56){return db[_0xe524('0x1a')][_0xe524('0x26')]({'raw':_0x535354['options']?_0x535354[_0xe524('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x535354[_0xe524('0x1c')]?_0x535354[_0xe524('0x1c')][_0xe524('0x1e')]||null:null,'attributes':_0x535354['options']?_0x535354[_0xe524('0x1c')][_0xe524('0x1f')]||null:null,'include':_0x535354['options']?_0x535354[_0xe524('0x1c')][_0xe524('0x21')]?_[_0xe524('0x23')](_0x535354[_0xe524('0x1c')]['include'],function(_0x415450){return{'model':db[_0x415450[_0xe524('0x22')]],'as':_0x415450['as'],'attributes':_0x415450[_0xe524('0x1f')],'include':_0x415450[_0xe524('0x21')]?_[_0xe524('0x23')](_0x415450[_0xe524('0x21')],function(_0x2741e8){return{'model':db[_0x2741e8[_0xe524('0x22')]],'as':_0x2741e8['as'],'attributes':_0x2741e8['attributes'],'include':_0x2741e8[_0xe524('0x21')]?_['map'](_0x2741e8[_0xe524('0x21')],function(_0x53eeee){return{'model':db[_0x53eeee['model']],'as':_0x53eeee['as'],'attributes':_0x53eeee[_0xe524('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c3aae){if(_0x535354[_0xe524('0x1c')][_0xe524('0x27')]===!![])_0x1c3aae[_0xe524('0x28')](_0xe524('0x29'),_0x1c3aae[_0xe524('0x2a')]());logger[_0xe524('0x11')](_0xe524('0x25'),_0x535354);logger['debug'](_0xe524('0x25'),_0x535354,JSON[_0xe524('0x2b')](_0x1c3aae));_0x54af2a(_0x1c3aae);})[_0xe524('0x24')](function(_0x3fd023){logger[_0xe524('0x16')](_0xe524('0x25'),_0x3fd023[_0xe524('0x18')],_0x535354);_0x315e56(_0x3fec06[_0xe524('0x16')](0x1f4,_0x3fd023['message']));});});};exports[_0xe524('0x2c')]=function(_0x849307){var _0x2e4a13=this;return new Promise(function(_0x59781b,_0x238673){var _0x5213ed={'body':_0x849307[_0xe524('0x2d')],'channel':_0xe524('0x2e')};var _0x43c314=_[_0xe524('0x2f')](_[_0xe524('0x30')](db[_0xe524('0x31')][_0xe524('0x32')]),['createdAt',_0xe524('0x33'),_0xe524('0x34'),_0xe524('0x35')]);var _0x376505=![];if(_0x849307[_0xe524('0x2d')]['id']){delete _0x849307[_0xe524('0x2d')]['id'];}if(_['isNil'](_0x849307[_0xe524('0x2d')][_0xe524('0x36')])){return _0x238673(_0x2e4a13[_0xe524('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xe524('0x37')](_0x849307['body']['body'])||_0x849307[_0xe524('0x2d')][_0xe524('0x2d')]===''){return _0x238673(_0x2e4a13['error'](0x1f4,_0xe524('0x38')));}if(_[_0xe524('0x37')](_0x849307[_0xe524('0x2d')][_0xe524('0x39')])){return _0x238673(_0x2e4a13['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43c314));}if(!_[_0xe524('0x3a')](_0x43c314,_0x849307[_0xe524('0x2d')]['mapKey'])){return _0x238673(_0x2e4a13[_0xe524('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43c314));}var _0x472519={};_0x472519[_0x849307[_0xe524('0x2d')][_0xe524('0x39')]]=_0x849307[_0xe524('0x2d')][_0xe524('0x36')];return db[_0xe524('0x1a')][_0xe524('0x26')]({'where':{'id':_0x849307[_0xe524('0x3b')]['id']},'include':[{'model':db[_0xe524('0x3c')],'as':_0xe524('0x3d'),'include':[{'model':db[_0xe524('0x31')],'as':_0xe524('0x3e'),'where':_0x472519,'limit':0x1,'order':[[_0xe524('0x33'),_0xe524('0x3f')]]}]},{'model':db[_0xe524('0x40')],'as':'Applications'},{'model':db[_0xe524('0x41')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xe524('0x42')}]}]})['then'](function(_0x232cf0){if(_0x232cf0&&_0x232cf0[_0xe524('0x3d')]){var _0x561107=_0x232cf0[_0xe524('0x43')]({'plain':!![]});_0x5213ed['account']=_['omit'](_0x561107,[_0xe524('0x44'),_0xe524('0x3d')]);_0x5213ed[_0xe524('0x3b')]['smtpOptions']=_0x232cf0['getSmtpOptions']();_0x5213ed['applications']=_0x561107['Applications'];_0x5213ed['list']=_0x561107['List'];_0x5213ed[_0xe524('0x45')]=_[_0xe524('0x46')](_0x5213ed['applications'],[_0xe524('0x47')],[_0xe524('0x48')]);if(_0x5213ed[_0xe524('0x3b')]&&_0x5213ed[_0xe524('0x3b')][_0xe524('0x49')]){_0x5213ed['applications'][_0xe524('0x4a')]({'id':0x0,'priority':_0x5213ed[_0xe524('0x45')][_0xe524('0x4b')]+0x1,'app':'close','appdata':_0xe524('0x49'),'interval':'*,*,*,*'});}if(_0x5213ed[_0xe524('0x3b')][_0xe524('0x44')]){delete _0x5213ed[_0xe524('0x3b')][_0xe524('0x44')];}if(_0x5213ed[_0xe524('0x3b')][_0xe524('0x3d')]){delete _0x5213ed[_0xe524('0x3b')][_0xe524('0x3d')];}if(_0x561107[_0xe524('0x3d')][_0xe524('0x3e')][_0xe524('0x4b')]){return _0x561107[_0xe524('0x3d')]['Contacts'][0x0];}var _0x4dac0f=_['defaults'](_0x849307[_0xe524('0x2d')],{'firstName':_0x849307[_0xe524('0x2d')][_0xe524('0x36')],'ListId':_0x561107[_0xe524('0x35')]});_0x4dac0f[_0x849307[_0xe524('0x2d')][_0xe524('0x39')]]=_0x849307[_0xe524('0x2d')][_0xe524('0x36')];return db[_0xe524('0x31')][_0xe524('0x4c')](_0x4dac0f);}else{throw new Error(_0xe524('0x4d'));}})['then'](function(_0x5012fc){_0x5213ed[_0xe524('0x4e')]=_0x5012fc;if(_0x5012fc){if(!_0x849307['body']['message']['messageId']){_0x849307['body'][_0xe524('0x18')][_0xe524('0x4f')]=rs[_0xe524('0x50')]()+'\x20'+_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x36')];}var _0x244f08={'ContactId':_0x5012fc['id'],'MailAccountId':_0x849307[_0xe524('0x3b')]['id'],'inReplyTo':_0x849307[_0xe524('0x2d')]['message']['messageId'],'to':_0x849307['body'][_0xe524('0x18')]['from'],'cc':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['cc'],'subject':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x51')],'attach':_0x849307['body']['message'][_0xe524('0x52')],'lastMsgAt':moment()[_0xe524('0x53')](_0xe524('0x54')),'lastMsgDirection':'in'};return db[_0xe524('0x55')][_0xe524('0x26')]({'where':{'closed':![],'MailAccountId':_0x849307[_0xe524('0x3b')]['id']},'include':[{'model':db['MailMessage'],'as':_0xe524('0x56'),'attributes':[_0xe524('0x4f')],'where':{'messageId':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x57')]}}]})[_0xe524('0x10')](function(_0x3bd9f9){if(_0x3bd9f9){return[_0x3bd9f9,![]];}return db['MailInteraction']['create'](_0x244f08)[_0xe524('0x10')](function(_0x35cbe9){return[_0x35cbe9,!![]];});});}else{throw new Error(_0xe524('0x58'));}})[_0xe524('0x59')](function(_0x139a0a,_0x4c6869){if(_0x139a0a){_0x376505=_0x4c6869;if(!_0x4c6869){return _0x139a0a[_0xe524('0x5a')]({'inReplyTo':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x4f')],'to':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x36')],'cc':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['cc'],'subject':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['subject'],'attach':_0x139a0a[_0xe524('0x52')]?_0x139a0a[_0xe524('0x52')]:_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x52')],'substatus':null,'substatusAt':moment()['format'](_0xe524('0x54')),'lastMsgAt':moment()[_0xe524('0x53')](_0xe524('0x54')),'lastMsgDirection':'in'});}else{return _0x139a0a;}}})[_0xe524('0x10')](function(_0x387c4b){_0x5213ed[_0xe524('0x5b')]=_0x387c4b[_0xe524('0x43')]({'plain':!![]});_0x5213ed['interaction'][_0xe524('0x5c')]=_0x376505;return db[_0xe524('0x5d')][_0xe524('0x4c')]({'body':_0x849307[_0xe524('0x2d')]['body'],'MailAccountId':_0x849307[_0xe524('0x3b')]['id'],'MailInteractionId':_0x387c4b['id'],'direction':'in','ContactId':_0x5213ed['contact']['id'],'messageId':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x4f')],'from':_0x849307['body'][_0xe524('0x18')][_0xe524('0x36')],'to':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['to'],'cc':_0x849307[_0xe524('0x2d')]['message']['cc'],'subject':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x51')],'attach':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['attach'],'Attachments':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x5e')],'originTo':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x5f')],'originCc':_0x849307['body'][_0xe524('0x18')][_0xe524('0x60')],'bcc':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x61')],'ChatWebsiteId':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x62')]||null,'originChannel':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x63')]||_0xe524('0x64'),'ChatOfflineMessageId':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x65')]||null},{'include':[{'model':db[_0xe524('0x66')],'as':_0xe524('0x67')}]});})[_0xe524('0x10')](function(_0x19b28a){_0x5213ed[_0xe524('0x18')]=_0x19b28a;if(_0x5213ed[_0xe524('0x5b')][_0xe524('0x68')]){return db[_0xe524('0x69')][_0xe524('0x26')]({'attributes':['id',_0xe524('0x6a')],'where':{'id':_0x5213ed[_0xe524('0x5b')][_0xe524('0x68')]}})[_0xe524('0x10')](function(_0x23425c){if(_0x23425c){_0x5213ed['applications'][_0xe524('0x6b')]({'id':0x0,'priority':0x0,'app':_0xe524('0x6c'),'appdata':_0x23425c[_0xe524('0x6a')]+','+(_0x5213ed['account'][_0xe524('0x6d')]||0xa),'interval':_0xe524('0x6e')});}return respondWithRpcPromise('Start','startRouting',_0x5213ed);});}return respondWithRpcPromise(_0xe524('0x6f'),'startRouting',_0x5213ed);})[_0xe524('0x10')](function(_0x5a6a07){_0x59781b(_0x5a6a07);})[_0xe524('0x24')](function(_0x1ed60b){_0x238673(_0x2e4a13[_0xe524('0x16')](0x1f4,_0x1ed60b[_0xe524('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 81d6ef6..fc60831 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 _0x5717=['./mailAccount.events','save','remove','emit','removeListener'];(function(_0x184ea4,_0x234f8f){var _0x100538=function(_0x11b7d3){while(--_0x11b7d3){_0x184ea4['push'](_0x184ea4['shift']());}};_0x100538(++_0x234f8f);}(_0x5717,0x140));var _0x7571=function(_0x24e659,_0x4758dc){_0x24e659=_0x24e659-0x0;var _0x3a76f1=_0x5717[_0x24e659];return _0x3a76f1;};'use strict';var MailAccountEvents=require(_0x7571('0x0'));var events=[_0x7571('0x1'),_0x7571('0x2'),'update'];function createListener(_0x5a96d0,_0x18a46c){return function(_0x3c82e7){_0x18a46c[_0x7571('0x3')](_0x5a96d0,_0x3c82e7);};}function removeListener(_0x47b975,_0x38c741){return function(){MailAccountEvents[_0x7571('0x4')](_0x47b975,_0x38c741);};}exports['register']=function(_0x299a92){for(var _0x1ce94a=0x0,_0x3431a0=events['length'];_0x1ce94a<_0x3431a0;_0x1ce94a++){var _0xccbae1=events[_0x1ce94a];var _0x19f787=createListener('mailAccount:'+_0xccbae1,_0x299a92);MailAccountEvents['on'](_0xccbae1,_0x19f787);}}; \ No newline at end of file +var _0x6738=['length','./mailAccount.events','remove','update','emit','removeListener'];(function(_0x5964c3,_0x44169d){var _0x188e7d=function(_0x182fc8){while(--_0x182fc8){_0x5964c3['push'](_0x5964c3['shift']());}};_0x188e7d(++_0x44169d);}(_0x6738,0x16f));var _0x8673=function(_0x1a78db,_0x10512){_0x1a78db=_0x1a78db-0x0;var _0x5715c9=_0x6738[_0x1a78db];return _0x5715c9;};'use strict';var MailAccountEvents=require(_0x8673('0x0'));var events=['save',_0x8673('0x1'),_0x8673('0x2')];function createListener(_0xc6e6c9,_0x230bbe){return function(_0x1c26a8){_0x230bbe[_0x8673('0x3')](_0xc6e6c9,_0x1c26a8);};}function removeListener(_0x3396ea,_0x387de3){return function(){MailAccountEvents[_0x8673('0x4')](_0x3396ea,_0x387de3);};}exports['register']=function(_0x33b762){for(var _0x487a5e=0x0,_0x205205=events[_0x8673('0x5')];_0x487a5e<_0x205205;_0x487a5e++){var _0xb0dd89=events[_0x487a5e];var _0xa06381=createListener('mailAccount:'+_0xb0dd89,_0x33b762);MailAccountEvents['on'](_0xb0dd89,_0xa06381);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 2d3037a..6467507 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 _0xc8d4=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','put','/:id','update','delete','exports'];(function(_0x4ae3be,_0x40b92d){var _0x52e919=function(_0x10a813){while(--_0x10a813){_0x4ae3be['push'](_0x4ae3be['shift']());}};_0x52e919(++_0x40b92d);}(_0xc8d4,0xc0));var _0x4c8d=function(_0x80db6,_0x271594){_0x80db6=_0x80db6-0x0;var _0x5737c6=_0xc8d4[_0x80db6];return _0x5737c6;};'use strict';var multer=require(_0x4c8d('0x0'));var util=require(_0x4c8d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4c8d('0x2'));var router=express[_0x4c8d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4c8d('0x4'));var interaction=require(_0x4c8d('0x5'));var config=require(_0x4c8d('0x6'));var controller=require(_0x4c8d('0x7'));router[_0x4c8d('0x8')]('/:id',auth[_0x4c8d('0x9')](),controller[_0x4c8d('0xa')]);router[_0x4c8d('0xb')](_0x4c8d('0xc'),auth[_0x4c8d('0x9')](),controller[_0x4c8d('0xd')]);router[_0x4c8d('0xe')]('/:id',auth[_0x4c8d('0x9')](),controller['destroy']);module[_0x4c8d('0xf')]=router; \ No newline at end of file +var _0x5f7e=['get','isAuthenticated','show','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailApplication.controller'];(function(_0x4a2b30,_0xcf6333){var _0x3a787f=function(_0x5082ff){while(--_0x5082ff){_0x4a2b30['push'](_0x4a2b30['shift']());}};_0x3a787f(++_0xcf6333);}(_0x5f7e,0x87));var _0xe5f7=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x5f7e[_0x4bb66f];return _0xf2772f;};'use strict';var multer=require(_0xe5f7('0x0'));var util=require(_0xe5f7('0x1'));var path=require(_0xe5f7('0x2'));var timeout=require(_0xe5f7('0x3'));var express=require(_0xe5f7('0x4'));var router=express[_0xe5f7('0x5')]();var fs_extra=require(_0xe5f7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe5f7('0x7'));var config=require('../../config/environment');var controller=require(_0xe5f7('0x8'));router[_0xe5f7('0x9')]('/:id',auth[_0xe5f7('0xa')](),controller[_0xe5f7('0xb')]);router[_0xe5f7('0xc')](_0xe5f7('0xd'),auth[_0xe5f7('0xa')](),controller['update']);router[_0xe5f7('0xe')](_0xe5f7('0xd'),auth[_0xe5f7('0xa')](),controller[_0xe5f7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 12af591..0e021d2 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 _0xa099=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x274dd7,_0x2e6051){var _0x148829=function(_0x4cec98){while(--_0x4cec98){_0x274dd7['push'](_0x274dd7['shift']());}};_0x148829(++_0x2e6051);}(_0xa099,0x1b8));var _0x9a09=function(_0x2a1e5e,_0x4d74b2){_0x2a1e5e=_0x2a1e5e-0x0;var _0xa4a8c7=_0xa099[_0x2a1e5e];return _0xa4a8c7;};'use strict';var Sequelize=require(_0x9a09('0x0'));module[_0x9a09('0x1')]={'priority':{'type':Sequelize[_0x9a09('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9a09('0x3')],'allowNull':![],'defaultValue':_0x9a09('0x4')},'appdata':{'type':Sequelize[_0x9a09('0x5')]()},'description':{'type':Sequelize[_0x9a09('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5489=['STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x6b888e,_0x420fed){var _0x17d0f6=function(_0x42675a){while(--_0x42675a){_0x6b888e['push'](_0x6b888e['shift']());}};_0x17d0f6(++_0x420fed);}(_0x5489,0xb3));var _0x9548=function(_0x5d70e1,_0x38239c){_0x5d70e1=_0x5d70e1-0x0;var _0x1fdd9a=_0x5489[_0x5d70e1];return _0x1fdd9a;};'use strict';var Sequelize=require('sequelize');module[_0x9548('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9548('0x1')],'allowNull':![],'defaultValue':_0x9548('0x2')},'appdata':{'type':Sequelize[_0x9548('0x3')]()},'description':{'type':Sequelize[_0x9548('0x1')]},'interval':{'type':Sequelize[_0x9548('0x1')],'defaultValue':_0x9548('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 4224095..0aad8cd 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 _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x70e0,0x17b));var _0x070e=function(_0x321c33,_0x492910){_0x321c33=_0x321c33-0x0;var _0x4b9e9a=_0x70e0[_0x321c33];return _0x4b9e9a;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file +var _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x5cc7af,_0x9570d8){var _0x165552=function(_0x7b47a6){while(--_0x7b47a6){_0x5cc7af['push'](_0x5cc7af['shift']());}};_0x165552(++_0x9570d8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index bca84e1..1f4ca07 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 _0xa4b5=['api','moment','bluebird','path','../../config/environment','./mailApplication.attributes','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa4b5,0x14d));var _0x5a4b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa4b5[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x5a4b('0x0'));var util=require(_0x5a4b('0x1'));var logger=require(_0x5a4b('0x2'))(_0x5a4b('0x3'));var moment=require(_0x5a4b('0x4'));var BPromise=require(_0x5a4b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a4b('0x6'));var rimraf=require('rimraf');var config=require(_0x5a4b('0x7'));var attributes=require(_0x5a4b('0x8'));module['exports']=function(_0x15491b,_0x581e04){return _0x15491b[_0x5a4b('0x9')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5a4b('0xa'),'collate':_0x5a4b('0xb')});}; \ No newline at end of file +var _0xe7a1=['request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7a1,0xa5));var _0x1e7a=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xe7a1[_0x5cb1af];return _0x8d7940;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1e7a('0x0'))(_0x1e7a('0x1'));var moment=require(_0x1e7a('0x2'));var BPromise=require(_0x1e7a('0x3'));var rp=require(_0x1e7a('0x4'));var fs=require('fs');var path=require(_0x1e7a('0x5'));var rimraf=require(_0x1e7a('0x6'));var config=require(_0x1e7a('0x7'));var attributes=require(_0x1e7a('0x8'));module[_0x1e7a('0x9')]=function(_0x2c3d35,_0x49d258){return _0x2c3d35[_0x1e7a('0xa')](_0x1e7a('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1e7a('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 8934b80..c20a93d 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 _0x74a4=['update','options','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','MailApplication'];(function(_0x1d5ba7,_0x1c006c){var _0xe46668=function(_0x44e4dd){while(--_0x44e4dd){_0x1d5ba7['push'](_0x1d5ba7['shift']());}};_0xe46668(++_0x1c006c);}(_0x74a4,0x166));var _0x474a=function(_0x4e1782,_0x51aff2){_0x4e1782=_0x4e1782-0x0;var _0x126d25=_0x74a4[_0x4e1782];return _0x126d25;};'use strict';var _=require(_0x474a('0x0'));var util=require(_0x474a('0x1'));var moment=require(_0x474a('0x2'));var BPromise=require(_0x474a('0x3'));var rs=require(_0x474a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x474a('0x5'))['db'];var utils=require(_0x474a('0x6'));var logger=require(_0x474a('0x7'))(_0x474a('0x8'));var config=require(_0x474a('0x9'));var jayson=require(_0x474a('0xa'));var client=jayson[_0x474a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c3606,_0x197680,_0x46ac4f){return new BPromise(function(_0x488c51,_0x1118e1){return client[_0x474a('0xc')](_0x5c3606,_0x46ac4f)[_0x474a('0xd')](function(_0x306e7c){logger[_0x474a('0xe')](_0x474a('0xf'),_0x197680,_0x474a('0x10'));logger[_0x474a('0x11')](_0x474a('0x12'),_0x197680,_0x474a('0x10'),JSON['stringify'](_0x306e7c));if(_0x306e7c['error']){if(_0x306e7c[_0x474a('0x13')][_0x474a('0x14')]===0x1f4){logger[_0x474a('0x13')](_0x474a('0xf'),_0x197680,_0x306e7c[_0x474a('0x13')][_0x474a('0x15')]);return _0x1118e1(_0x306e7c[_0x474a('0x13')][_0x474a('0x15')]);}logger[_0x474a('0x13')](_0x474a('0xf'),_0x197680,_0x306e7c[_0x474a('0x13')][_0x474a('0x15')]);return _0x488c51(_0x306e7c['error']['message']);}else{logger[_0x474a('0xe')]('MailApplication,\x20%s,\x20%s',_0x197680,_0x474a('0x10'));_0x488c51(_0x306e7c[_0x474a('0x16')]['message']);}})[_0x474a('0x17')](function(_0x16f9f9){logger[_0x474a('0x13')]('MailApplication,\x20%s,\x20%s',_0x197680,_0x16f9f9);_0x1118e1(_0x16f9f9);});});}exports[_0x474a('0x18')]=function(_0x553582){var _0x2a6a1a=this;return new Promise(function(_0x22c21e,_0x41f1dc){return db[_0x474a('0x19')][_0x474a('0x1a')](_0x553582['body'],{'raw':_0x553582[_0x474a('0x1b')]?_0x553582[_0x474a('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x553582[_0x474a('0x1b')]?_0x553582[_0x474a('0x1b')][_0x474a('0x1c')]||null:null,'attributes':_0x553582[_0x474a('0x1b')]?_0x553582[_0x474a('0x1b')][_0x474a('0x1d')]||null:null,'limit':_0x553582[_0x474a('0x1b')]?_0x553582[_0x474a('0x1b')][_0x474a('0x1e')]||null:null})['then'](function(_0x2ef940){logger[_0x474a('0xe')](_0x474a('0x18'),_0x553582);logger[_0x474a('0x11')](_0x474a('0x18'),_0x553582,JSON[_0x474a('0x1f')](_0x2ef940));_0x22c21e(_0x2ef940);})['catch'](function(_0x3340ea){logger[_0x474a('0x13')](_0x474a('0x18'),_0x3340ea[_0x474a('0x15')],_0x553582);_0x41f1dc(_0x2a6a1a['error'](0x1f4,_0x3340ea['message']));});});}; \ No newline at end of file +var _0x25d3=['stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','update','body','options','raw','where','limit'];(function(_0x2de621,_0x552e2b){var _0x56ad37=function(_0x31df1b){while(--_0x31df1b){_0x2de621['push'](_0x2de621['shift']());}};_0x56ad37(++_0x552e2b);}(_0x25d3,0xc5));var _0x325d=function(_0xfb9f45,_0x3d943b){_0xfb9f45=_0xfb9f45-0x0;var _0x1eca9d=_0x25d3[_0xfb9f45];return _0x1eca9d;};'use strict';var _=require(_0x325d('0x0'));var util=require('util');var moment=require(_0x325d('0x1'));var BPromise=require('bluebird');var rs=require(_0x325d('0x2'));var fs=require('fs');var Redis=require(_0x325d('0x3'));var db=require(_0x325d('0x4'))['db'];var utils=require(_0x325d('0x5'));var logger=require('../../config/logger')(_0x325d('0x6'));var config=require('../../config/environment');var jayson=require(_0x325d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a5668,_0xf90a14,_0x21d9fb){return new BPromise(function(_0x191bd6,_0x319c93){return client[_0x325d('0x8')](_0x3a5668,_0x21d9fb)[_0x325d('0x9')](function(_0x14ec3f){logger[_0x325d('0xa')]('MailApplication,\x20%s,\x20%s',_0xf90a14,_0x325d('0xb'));logger[_0x325d('0xc')](_0x325d('0xd'),_0xf90a14,'request\x20sent',JSON['stringify'](_0x14ec3f));if(_0x14ec3f[_0x325d('0xe')]){if(_0x14ec3f[_0x325d('0xe')][_0x325d('0xf')]===0x1f4){logger['error'](_0x325d('0x10'),_0xf90a14,_0x14ec3f[_0x325d('0xe')][_0x325d('0x11')]);return _0x319c93(_0x14ec3f[_0x325d('0xe')]['message']);}logger[_0x325d('0xe')](_0x325d('0x10'),_0xf90a14,_0x14ec3f['error'][_0x325d('0x11')]);return _0x191bd6(_0x14ec3f[_0x325d('0xe')][_0x325d('0x11')]);}else{logger[_0x325d('0xa')](_0x325d('0x10'),_0xf90a14,_0x325d('0xb'));_0x191bd6(_0x14ec3f[_0x325d('0x12')][_0x325d('0x11')]);}})[_0x325d('0x13')](function(_0x31c412){logger[_0x325d('0xe')]('MailApplication,\x20%s,\x20%s',_0xf90a14,_0x31c412);_0x319c93(_0x31c412);});});}exports[_0x325d('0x14')]=function(_0xd81de3){var _0x4ca6c3=this;return new Promise(function(_0x44328a,_0x252ce0){return db['MailApplication'][_0x325d('0x15')](_0xd81de3[_0x325d('0x16')],{'raw':_0xd81de3[_0x325d('0x17')]?_0xd81de3[_0x325d('0x17')][_0x325d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd81de3[_0x325d('0x17')]?_0xd81de3[_0x325d('0x17')][_0x325d('0x19')]||null:null,'attributes':_0xd81de3[_0x325d('0x17')]?_0xd81de3[_0x325d('0x17')]['attributes']||null:null,'limit':_0xd81de3[_0x325d('0x17')]?_0xd81de3[_0x325d('0x17')][_0x325d('0x1a')]||null:null})['then'](function(_0x7437c4){logger[_0x325d('0xa')](_0x325d('0x14'),_0xd81de3);logger[_0x325d('0xc')](_0x325d('0x14'),_0xd81de3,JSON[_0x325d('0x1b')](_0x7437c4));_0x44328a(_0x7437c4);})['catch'](function(_0x1c2939){logger[_0x325d('0xe')](_0x325d('0x14'),_0x1c2939[_0x325d('0x11')],_0xd81de3);_0x252ce0(_0x4ca6c3[_0x325d('0xe')](0x1f4,_0x1c2939[_0x325d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 7e3e9d5..9e3688c 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 _0xc72d=['mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','./mailInteraction.controller','isAuthenticated','index','get','describe','/:id','show','download','post','create','/:id/messages','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked'];(function(_0x1005d4,_0x5199ab){var _0x421977=function(_0x30c727){while(--_0x30c727){_0x1005d4['push'](_0x1005d4['shift']());}};_0x421977(++_0x5199ab);}(_0xc72d,0xa2));var _0xdc72=function(_0x3496ae,_0x4f33fd){_0x3496ae=_0x3496ae-0x0;var _0x4badff=_0xc72d[_0x3496ae];return _0x4badff;};'use strict';var express=require(_0xdc72('0x0'));var router=express['Router']();var auth=require(_0xdc72('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0xdc72('0x2'));router['get']('/',auth[_0xdc72('0x3')](),controller[_0xdc72('0x4')]);router[_0xdc72('0x5')]('/describe',auth[_0xdc72('0x3')](),controller[_0xdc72('0x6')]);router[_0xdc72('0x5')](_0xdc72('0x7'),auth[_0xdc72('0x3')](),controller[_0xdc72('0x8')]);router['get']('/:id/messages',auth[_0xdc72('0x3')](),controller['getMessages']);router['get']('/:id/download',auth[_0xdc72('0x3')](),controller[_0xdc72('0x9')]);router[_0xdc72('0xa')]('/',auth['isAuthenticated'](),controller[_0xdc72('0xb')]);router[_0xdc72('0xa')](_0xdc72('0xc'),auth['isAuthenticated'](),controller[_0xdc72('0xd')]);router[_0xdc72('0xa')](_0xdc72('0xe'),auth[_0xdc72('0x3')](),interaction['tracked'](_0xdc72('0xf'),_0xdc72('0x10')),controller[_0xdc72('0x11')]);router[_0xdc72('0x12')](_0xdc72('0x7'),auth[_0xdc72('0x3')](),interaction[_0xdc72('0x13')](_0xdc72('0xf'),_0xdc72('0x14')),controller['update']);router[_0xdc72('0x15')]('/:id',auth[_0xdc72('0x3')](),interaction['tracked'](_0xdc72('0xf'),_0xdc72('0x16')),controller[_0xdc72('0x17')]);router[_0xdc72('0x15')](_0xdc72('0xe'),auth['isAuthenticated'](),controller[_0xdc72('0x18')]);module[_0xdc72('0x19')]=router; \ No newline at end of file +var _0x8a28=['download','create','post','addMessage','tracked','mail','addTags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','/:id/tags','removeTags','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','/:id/download'];(function(_0x3d5779,_0x54da57){var _0x15437c=function(_0x3317dc){while(--_0x3317dc){_0x3d5779['push'](_0x3d5779['shift']());}};_0x15437c(++_0x54da57);}(_0x8a28,0x7c));var _0x88a2=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8a28[_0x550d12];return _0x12103d;};'use strict';var express=require('express');var router=express[_0x88a2('0x0')]();var auth=require(_0x88a2('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x88a2('0x2'));router[_0x88a2('0x3')]('/',auth[_0x88a2('0x4')](),controller['index']);router[_0x88a2('0x3')](_0x88a2('0x5'),auth[_0x88a2('0x4')](),controller[_0x88a2('0x6')]);router[_0x88a2('0x3')]('/:id',auth[_0x88a2('0x4')](),controller[_0x88a2('0x7')]);router[_0x88a2('0x3')](_0x88a2('0x8'),auth['isAuthenticated'](),controller[_0x88a2('0x9')]);router['get'](_0x88a2('0xa'),auth['isAuthenticated'](),controller[_0x88a2('0xb')]);router['post']('/',auth[_0x88a2('0x4')](),controller[_0x88a2('0xc')]);router[_0x88a2('0xd')](_0x88a2('0x8'),auth[_0x88a2('0x4')](),controller[_0x88a2('0xe')]);router[_0x88a2('0xd')]('/:id/tags',auth[_0x88a2('0x4')](),interaction[_0x88a2('0xf')](_0x88a2('0x10'),'mailinteraction:addtags'),controller[_0x88a2('0x11')]);router[_0x88a2('0x12')](_0x88a2('0x13'),auth[_0x88a2('0x4')](),interaction['tracked']('mail',_0x88a2('0x14')),controller[_0x88a2('0x15')]);router[_0x88a2('0x16')](_0x88a2('0x13'),auth[_0x88a2('0x4')](),interaction['tracked'](_0x88a2('0x10'),_0x88a2('0x17')),controller[_0x88a2('0x18')]);router[_0x88a2('0x16')](_0x88a2('0x19'),auth[_0x88a2('0x4')](),controller[_0x88a2('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 9281e65..5806937 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 _0x0717=['STRING','TEXT','long','DATE','ENUM','out','iconv','exports','BOOLEAN'];(function(_0x1ea6c6,_0xeaa372){var _0x3c04e3=function(_0x3da708){while(--_0x3da708){_0x1ea6c6['push'](_0x1ea6c6['shift']());}};_0x3c04e3(++_0xeaa372);}(_0x0717,0x72));var _0x7071=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x0717[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x7071('0x0'));module[_0x7071('0x1')]={'closed':{'type':Sequelize[_0x7071('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7071('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7071('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x7071('0x3')]},'cc':{'type':Sequelize[_0x7071('0x4')](_0x7071('0x5'))},'subject':{'type':Sequelize[_0x7071('0x4')]()},'attach':{'type':Sequelize[_0x7071('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x7071('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x7071('0x6')]},'firstMsgDirection':{'type':Sequelize[_0x7071('0x7')]('in',_0x7071('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7071('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7071('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7071('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb26c=['out','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x306d49,_0x43ba77){var _0x1ab180=function(_0x48ee40){while(--_0x48ee40){_0x306d49['push'](_0x306d49['shift']());}};_0x1ab180(++_0x43ba77);}(_0xb26c,0x1ba));var _0xcb26=function(_0x2ce1c4,_0x2b3579){_0x2ce1c4=_0x2ce1c4-0x0;var _0x424785=_0xb26c[_0x2ce1c4];return _0x424785;};'use strict';var Sequelize=require(_0xcb26('0x0'));var iconv=require(_0xcb26('0x1'));module['exports']={'closed':{'type':Sequelize[_0xcb26('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcb26('0x3')]},'disposition':{'type':Sequelize[_0xcb26('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcb26('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xcb26('0x4')](0x1fe)},'to':{'type':Sequelize[_0xcb26('0x4')]},'cc':{'type':Sequelize[_0xcb26('0x5')](_0xcb26('0x6'))},'subject':{'type':Sequelize[_0xcb26('0x5')]()},'attach':{'type':Sequelize[_0xcb26('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xcb26('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xcb26('0x7')]('in',_0xcb26('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcb26('0x7')]('in',_0xcb26('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 0fa2bb9..09c836d 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 _0x6f82=['body','destroy','params','describe','addMessage','MailMessage','omit','ids','getMessages','findOne','hasOwnProperty','order','sort','where','MailInteractionId','$gte','format','true','rows','addTags','setTags','spread','findAll','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','subject','createdAt','get','mkdirSync','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','existsSync','build','writeFileSync','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','getOptions','mail','query','user','catch','show','model','keys','MailInteraction','filters','attributes','intersection','fields','length','includeAll','merge','options','find','create'];(function(_0x32e94b,_0x38c7a7){var _0x3b1567=function(_0x282670){while(--_0x282670){_0x32e94b['push'](_0x32e94b['shift']());}};_0x3b1567(++_0x38c7a7);}(_0x6f82,0xa5));var _0x26f8=function(_0x15f3c0,_0x165a64){_0x15f3c0=_0x15f3c0-0x0;var _0x1adfe0=_0x6f82[_0x15f3c0];return _0x1adfe0;};'use strict';var emlformat=require(_0x26f8('0x0'));var rimraf=require(_0x26f8('0x1'));var zipdir=require(_0x26f8('0x2'));var moment=require('moment');var BPromise=require(_0x26f8('0x3'));var util=require(_0x26f8('0x4'));var path=require(_0x26f8('0x5'));var fs=require('fs');var _=require(_0x26f8('0x6'));var juice=require(_0x26f8('0x7'));var Redis=require(_0x26f8('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0x26f8('0x9'));var logger=require(_0x26f8('0xa'))(_0x26f8('0xb'));var config=require(_0x26f8('0xc'));var db=require(_0x26f8('0xd'))['db'];var htmlEntities=require(_0x26f8('0xe'));config['redis']=_[_0x26f8('0xf')](config[_0x26f8('0x10')],{'host':_0x26f8('0x11'),'port':0x18eb});var socket=require(_0x26f8('0x12'))(new Redis(config[_0x26f8('0x10')]));require(_0x26f8('0x13'))[_0x26f8('0x14')](socket);function respondWithStatusCode(_0x48e674,_0x21728d){_0x21728d=_0x21728d||0xcc;return function(_0x1a7781){if(_0x1a7781){return _0x48e674[_0x26f8('0x15')](_0x21728d);}return _0x48e674[_0x26f8('0x16')](_0x21728d)[_0x26f8('0x17')]();};}function respondWithResult(_0xeca690,_0x4598db){_0x4598db=_0x4598db||0xc8;return function(_0x943e50){if(_0x943e50){return _0xeca690[_0x26f8('0x16')](_0x4598db)[_0x26f8('0x18')](_0x943e50);}};}function respondWithFilteredResult(_0x2cdbdd,_0x41e7e8){return function(_0x4fdec1){if(_0x4fdec1){var _0xb7bda1=typeof _0x41e7e8[_0x26f8('0x19')]===_0x26f8('0x1a')&&typeof _0x41e7e8[_0x26f8('0x1b')]===_0x26f8('0x1a');var _0x15f300=_0x4fdec1['count'];var _0x47107e=_0xb7bda1?0x0:_0x41e7e8[_0x26f8('0x19')];var _0x2e34ea=_0xb7bda1?_0x4fdec1[_0x26f8('0x1c')]:_0x41e7e8[_0x26f8('0x19')]+_0x41e7e8['limit'];var _0xd6f54b;if(_0x2e34ea>=_0x15f300){_0x2e34ea=_0x15f300;_0xd6f54b=0xc8;}else{_0xd6f54b=0xce;}_0x2cdbdd[_0x26f8('0x16')](_0xd6f54b);return _0x2cdbdd[_0x26f8('0x1d')](_0x26f8('0x1e'),_0x47107e+'-'+_0x2e34ea+'/'+_0x15f300)['json'](_0x4fdec1);}return null;};}function saveUpdates(_0xda2498){return function(_0x5d7425){if(_0x5d7425){return _0x5d7425[_0x26f8('0x1f')](_0xda2498)[_0x26f8('0x20')](function(_0x1e7323){return _0x1e7323;});}return null;};}function removeEntity(_0x4445cd){return function(_0x3a81d7){if(_0x3a81d7){return _0x3a81d7['destroy']()['then'](function(){_0x4445cd[_0x26f8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb73b85){return function(_0x47d8a3){if(!_0x47d8a3){_0xb73b85['sendStatus'](0x194);}return _0x47d8a3;};}function handleError(_0x20e5b5,_0x18e69e){_0x18e69e=_0x18e69e||0x1f4;return function(_0x3fd72a){logger[_0x26f8('0x21')](_0x3fd72a[_0x26f8('0x22')]);if(_0x3fd72a[_0x26f8('0x23')]){delete _0x3fd72a[_0x26f8('0x23')];}_0x20e5b5[_0x26f8('0x16')](_0x18e69e)[_0x26f8('0x24')](_0x3fd72a);};}exports[_0x26f8('0x25')]=function(_0x1e01f4,_0x24f227){var _0x5ad97f={};var _0x47a7cb=_[_0x26f8('0x26')](db['MailInteraction'][_0x26f8('0x27')],function(_0xf89a57){return{'name':_0xf89a57[_0x26f8('0x28')],'type':_0xf89a57[_0x26f8('0x29')]['key']};});_0x5ad97f=qs[_0x26f8('0x2a')](_0x47a7cb,_0x1e01f4);return interaction['findAll'](_0x26f8('0x2b'),_0x1e01f4[_0x26f8('0x2c')],_0x1e01f4[_0x26f8('0x2d')],_0x5ad97f,_0x47a7cb)['then'](respondWithFilteredResult(_0x24f227,_0x5ad97f))[_0x26f8('0x2e')](handleError(_0x24f227,null));};exports[_0x26f8('0x2f')]=function(_0x22484e,_0x2cd71e){var _0x51ac51={'raw':![],'where':{'id':_0x22484e['params']['id']}},_0x20cdae={};_0x20cdae[_0x26f8('0x30')]=_[_0x26f8('0x31')](db[_0x26f8('0x32')][_0x26f8('0x27')]);_0x20cdae[_0x26f8('0x2c')]=_['keys'](_0x22484e['query']);_0x20cdae[_0x26f8('0x33')]=_['intersection'](_0x20cdae['model'],_0x20cdae['query']);_0x51ac51[_0x26f8('0x34')]=_[_0x26f8('0x35')](_0x20cdae[_0x26f8('0x30')],qs[_0x26f8('0x36')](_0x22484e['query'][_0x26f8('0x36')]));_0x51ac51[_0x26f8('0x34')]=_0x51ac51[_0x26f8('0x34')][_0x26f8('0x37')]?_0x51ac51[_0x26f8('0x34')]:_0x20cdae[_0x26f8('0x30')];if(_0x22484e[_0x26f8('0x2c')][_0x26f8('0x38')]){_0x51ac51['include']=[{'all':!![]}];}_0x51ac51=_[_0x26f8('0x39')]({},_0x51ac51,_0x22484e[_0x26f8('0x3a')]);return db[_0x26f8('0x32')][_0x26f8('0x3b')](_0x51ac51)[_0x26f8('0x20')](handleEntityNotFound(_0x2cd71e,null))[_0x26f8('0x20')](respondWithResult(_0x2cd71e,null))[_0x26f8('0x2e')](handleError(_0x2cd71e,null));};exports[_0x26f8('0x3c')]=function(_0x30a32f,_0x160a9c){return db['MailInteraction'][_0x26f8('0x3c')](_0x30a32f[_0x26f8('0x3d')],{})[_0x26f8('0x20')](respondWithResult(_0x160a9c,0xc9))['catch'](handleError(_0x160a9c,null));};exports['update']=function(_0x39f53c,_0x4376b2){if(_0x39f53c[_0x26f8('0x3d')]['id']){delete _0x39f53c['body']['id'];}return db[_0x26f8('0x32')][_0x26f8('0x3b')]({'where':{'id':_0x39f53c['params']['id']}})[_0x26f8('0x20')](handleEntityNotFound(_0x4376b2,null))['then'](saveUpdates(_0x39f53c['body'],null))[_0x26f8('0x20')](respondWithResult(_0x4376b2,null))[_0x26f8('0x2e')](handleError(_0x4376b2,null));};exports[_0x26f8('0x3e')]=function(_0x51f8b5,_0x47d7a5){return db[_0x26f8('0x32')][_0x26f8('0x3b')]({'where':{'id':_0x51f8b5[_0x26f8('0x3f')]['id']}})[_0x26f8('0x20')](handleEntityNotFound(_0x47d7a5,null))[_0x26f8('0x20')](removeEntity(_0x47d7a5,null))[_0x26f8('0x2e')](handleError(_0x47d7a5,null));};exports['describe']=function(_0x4d74ac,_0x18ed36){return db[_0x26f8('0x32')][_0x26f8('0x40')]()[_0x26f8('0x20')](respondWithResult(_0x18ed36,null))['catch'](handleError(_0x18ed36,null));};exports[_0x26f8('0x41')]=function(_0x281e66,_0x52cda9){return db[_0x26f8('0x42')]['find']({'where':{'id':_0x281e66['params']['id']}})[_0x26f8('0x20')](handleEntityNotFound(_0x52cda9,null))[_0x26f8('0x20')](function(_0x19f373){if(_0x19f373){return _0x19f373[_0x26f8('0x41')](_0x281e66[_0x26f8('0x3d')]['ids'],_[_0x26f8('0x43')](_0x281e66['body'],[_0x26f8('0x44'),'id'])||{});}})['then'](respondWithResult(_0x52cda9,null))['catch'](handleError(_0x52cda9,null));};exports[_0x26f8('0x45')]=function(_0xcdd530,_0x2db6e5){var _0x3bb627={'raw':![],'where':{}};var _0x3ad4a4={};var _0x124dd={'count':0x0,'rows':[]};return db['MailInteraction'][_0x26f8('0x46')]({'where':{'id':_0xcdd530[_0x26f8('0x3f')]['id']}})[_0x26f8('0x20')](handleEntityNotFound(_0x2db6e5,null))[_0x26f8('0x20')](function(_0x46b2fa){if(_0x46b2fa){_0x3ad4a4[_0x26f8('0x30')]=_['keys'](db['MailMessage'][_0x26f8('0x27')]);_0x3ad4a4[_0x26f8('0x2c')]=_[_0x26f8('0x31')](_0xcdd530[_0x26f8('0x2c')]);_0x3ad4a4['filters']=_[_0x26f8('0x35')](_0x3ad4a4[_0x26f8('0x30')],_0x3ad4a4[_0x26f8('0x2c')]);_0x3bb627['attributes']=_[_0x26f8('0x35')](_0x3ad4a4[_0x26f8('0x30')],qs[_0x26f8('0x36')](_0xcdd530[_0x26f8('0x2c')][_0x26f8('0x36')]));_0x3bb627[_0x26f8('0x34')]=_0x3bb627[_0x26f8('0x34')][_0x26f8('0x37')]?_0x3bb627[_0x26f8('0x34')]:_0x3ad4a4[_0x26f8('0x30')];if(!_0xcdd530[_0x26f8('0x2c')][_0x26f8('0x47')]('nolimit')){_0x3bb627[_0x26f8('0x1b')]=qs[_0x26f8('0x1b')](_0xcdd530[_0x26f8('0x2c')]['limit']);_0x3bb627[_0x26f8('0x19')]=qs[_0x26f8('0x19')](_0xcdd530[_0x26f8('0x2c')]['offset']);}_0x3bb627[_0x26f8('0x48')]=qs[_0x26f8('0x49')](_0xcdd530[_0x26f8('0x2c')][_0x26f8('0x49')]);_0x3bb627['where']=qs[_0x26f8('0x33')](_['pick'](_0xcdd530[_0x26f8('0x2c')],_0x3ad4a4[_0x26f8('0x33')]));_0x3bb627[_0x26f8('0x4a')][_0x26f8('0x4b')]=_0x46b2fa['id'];if(_0xcdd530['query']['filter']){_0x3bb627[_0x26f8('0x4a')]=_[_0x26f8('0x39')](_0x3bb627['where'],{'$or':_[_0x26f8('0x26')](_0x3bb627[_0x26f8('0x34')],function(_0x174ea4){var _0x3409c2={};_0x3409c2[_0x174ea4]={'$like':'%'+_0xcdd530[_0x26f8('0x2c')]['filter']+'%'};return _0x3409c2;})});}if(_0xcdd530[_0x26f8('0x2c')][_0x26f8('0x4c')]){var _0x519a9a=_0xcdd530[_0x26f8('0x2c')][_0x26f8('0x4c')]['split'](',');var _0x2fb1d2={};_0x2fb1d2[_0x519a9a[0x0]]={'$gte':moment(_0x519a9a[0x1])[_0x26f8('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3bb627[_0x26f8('0x4a')]=_['merge'](_0x3bb627[_0x26f8('0x4a')],_0x2fb1d2);}_0x3bb627=_[_0x26f8('0x39')]({},_0x3bb627,_0xcdd530[_0x26f8('0x3a')]);return db['MailMessage'][_0x26f8('0x1c')]({'where':_0x3bb627['where']})[_0x26f8('0x20')](function(_0xa6016b){_0x124dd[_0x26f8('0x1c')]=_0xa6016b;if(_0xcdd530[_0x26f8('0x2c')][_0x26f8('0x38')]){_0x3bb627['include']=[{'all':!![]}];}return db[_0x26f8('0x42')]['findAll'](_0x3bb627);})[_0x26f8('0x20')](function(_0x1abf6a){if(_0xcdd530[_0x26f8('0x2c')]['inlineCss']===_0x26f8('0x4e')){for(var _0x274781=0x0;_0x274781<_0x1abf6a[_0x26f8('0x37')];_0x274781++){_0x1abf6a[_0x274781]['body']=juice(_0x1abf6a[_0x274781][_0x26f8('0x3d')]);}}_0x124dd[_0x26f8('0x4f')]=_0x1abf6a;return _0x124dd;});}})['then'](respondWithFilteredResult(_0x2db6e5,_0x3bb627))[_0x26f8('0x2e')](handleError(_0x2db6e5,null));};exports[_0x26f8('0x50')]=function(_0x3309c1,_0x2e82c4){return db[_0x26f8('0x32')]['find']({'where':{'id':_0x3309c1[_0x26f8('0x3f')]['id']}})[_0x26f8('0x20')](handleEntityNotFound(_0x2e82c4,null))[_0x26f8('0x20')](function(_0x5aa499){if(_0x5aa499){return _0x5aa499[_0x26f8('0x51')](_0x3309c1[_0x26f8('0x3d')]['ids'],_[_0x26f8('0x43')](_0x3309c1[_0x26f8('0x3d')],[_0x26f8('0x44'),'id'])||{})[_0x26f8('0x52')](function(){return db['Tag'][_0x26f8('0x53')]({'attributes':['id',_0x26f8('0x23'),'color'],'where':{'id':_0x3309c1[_0x26f8('0x3d')][_0x26f8('0x44')]}});})[_0x26f8('0x20')](function(_0x186a8c){socket[_0x26f8('0x54')](_0x26f8('0x55'),{'id':Number(_0x3309c1[_0x26f8('0x3f')]['id']),'tags':_0x186a8c||[]});return{'id':Number(_0x3309c1[_0x26f8('0x3f')]['id']),'tags':_0x186a8c||[]};});}})['then'](respondWithResult(_0x2e82c4,null))[_0x26f8('0x2e')](handleError(_0x2e82c4,null));};exports[_0x26f8('0x56')]=function(_0x388563,_0x424765){return db[_0x26f8('0x32')][_0x26f8('0x3b')]({'where':{'id':_0x388563[_0x26f8('0x3f')]['id']}})[_0x26f8('0x20')](handleEntityNotFound(_0x424765,null))[_0x26f8('0x20')](function(_0x218c38){if(_0x218c38){return _0x218c38[_0x26f8('0x56')](_0x388563[_0x26f8('0x2c')][_0x26f8('0x44')]);}})[_0x26f8('0x20')](respondWithStatusCode(_0x424765,null))[_0x26f8('0x2e')](handleError(_0x424765,null));};exports[_0x26f8('0x57')]=function(_0x423f70,_0x4ff075){var _0x80c6a4=moment()[_0x26f8('0x58')]()[_0x26f8('0x59')]();var _0x1e7700=path['join'](config[_0x26f8('0x5a')],_0x26f8('0x5b'),_0x26f8('0x5c'),_0x26f8('0x5d'));var _0x993045=path[_0x26f8('0x5e')](config[_0x26f8('0x5a')],_0x26f8('0x5b'),_0x26f8('0x5c'),_0x26f8('0x5f'));var _0x458cbc=path[_0x26f8('0x5e')](_0x1e7700,_0x80c6a4);var _0xaf238e=util[_0x26f8('0x4d')](_0x26f8('0x60'),_0x423f70[_0x26f8('0x3f')]['id'],_0x80c6a4);var _0x53f5e1=path[_0x26f8('0x5e')](_0x1e7700,_0xaf238e);var _0x342dba=[];if(_0x423f70[_0x26f8('0x2c')][_0x26f8('0x5f')]){_0x342dba[_0x26f8('0x61')]({'model':db[_0x26f8('0x62')],'as':_0x26f8('0x63'),'raw':!![]});}var _0x1b11a3=[{'model':db[_0x26f8('0x42')],'as':_0x26f8('0x64'),'attributes':['id',_0x26f8('0x3d'),_0x26f8('0x65'),'to','cc','bcc',_0x26f8('0x66'),_0x26f8('0x67')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x342dba}];return db['MailInteraction'][_0x26f8('0x3b')]({'where':{'id':_0x423f70[_0x26f8('0x3f')]['id']},'include':_0x1b11a3})['then'](handleEntityNotFound(_0x4ff075,null))['then'](function(_0x7f7779){if(_0x7f7779&&_0x7f7779[_0x26f8('0x64')]){var _0x2a1d25=_0x7f7779[_0x26f8('0x68')]({'plain':!![]});fs[_0x26f8('0x69')](_0x458cbc);return BPromise['each'](_0x2a1d25['Messages'],function(_0x5d6ad9,_0x96ff8f){var _0x2d9dd5={'from':_0x5d6ad9[_0x26f8('0x65')],'to':_0x5d6ad9['to']||_0x26f8('0x6a'),'subject':_0x5d6ad9[_0x26f8('0x66')],'html':htmlEntities['decode'](_0x5d6ad9[_0x26f8('0x3d')]),'headers':{'Date':moment(_0x5d6ad9[_0x26f8('0x67')])['format'](_0x26f8('0x6b'))},'attachments':[]};if(_0x5d6ad9['cc']){_0x2d9dd5['headers']['Cc']=_0x5d6ad9['cc'];}if(_0x5d6ad9[_0x26f8('0x6c')]){_0x2d9dd5['headers']['Bcc']=_0x5d6ad9[_0x26f8('0x6c')];}return new BPromise(function(_0x7ef4ab,_0x56834b){if(_0x5d6ad9[_0x26f8('0x63')]){for(var _0x10182f=0x0;_0x10182f<_0x5d6ad9[_0x26f8('0x63')]['length'];_0x10182f++){var _0x507854=_0x5d6ad9['Attachments'][_0x10182f];var _0x21388c=path[_0x26f8('0x5e')](_0x993045,_0x507854['basename']);if(fs[_0x26f8('0x6d')](_0x21388c)){_0x2d9dd5[_0x26f8('0x5f')]['push']({'name':_0x507854[_0x26f8('0x23')],'contentType':_0x507854[_0x26f8('0x29')],'data':fs['readFileSync'](_0x21388c)});}}}emlformat[_0x26f8('0x6e')](_0x2d9dd5,function(_0x564d89,_0x27fa4d){if(_0x564d89)return _0x56834b(_0x564d89);fs[_0x26f8('0x6f')](path['join'](_0x458cbc,util[_0x26f8('0x4d')]('message%d.eml',_0x96ff8f)),_0x27fa4d);return _0x7ef4ab(_0x27fa4d);});});})[_0x26f8('0x20')](function(){return new BPromise(function(_0x14e08b,_0x5dd274){zipdir(_0x458cbc,{'saveTo':_0x53f5e1},function(_0x387b89,_0x249cbf){if(_0x387b89)return _0x5dd274(_0x387b89);return _0x14e08b(_0x249cbf);});})[_0x26f8('0x20')](function(){return new BPromise(function(_0x28f764,_0x4d5802){rimraf(_0x458cbc,function(_0x2aef5a){if(_0x2aef5a)_0x4d5802(_0x2aef5a);return _0x28f764();});});})[_0x26f8('0x20')](function(){return _0x4ff075[_0x26f8('0x57')](_0x53f5e1,_0xaf238e,function(_0x408184){if(!_0x408184)fs[_0x26f8('0x70')](_0x53f5e1);});});});}else{return _0x4ff075[_0x26f8('0x15')](0xc8);}})['catch'](handleError(_0x4ff075,null));}; \ No newline at end of file +var _0xca9e=['status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','MailInteraction','rawAttributes','type','key','getOptions','findAll','mail','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','addMessage','MailMessage','findOne','hasOwnProperty','nolimit','sort','where','MailInteractionId','filter','merge','$gte','split','format','inlineCss','true','setTags','ids','omit','Tag','color','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','get','each','missing.recipient@your.company.com','subject','createdAt','headers','bcc','Bcc','basename','existsSync','readFileSync','build','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','lodash','juice','../../components/interaction/service','../../config/logger','api','redis','defaults','localhost','register','sendStatus'];(function(_0x36e1cf,_0x4d54d7){var _0x3aec73=function(_0x218d84){while(--_0x218d84){_0x36e1cf['push'](_0x36e1cf['shift']());}};_0x3aec73(++_0x4d54d7);}(_0xca9e,0xcb));var _0xeca9=function(_0x59a167,_0x398d1c){_0x59a167=_0x59a167-0x0;var _0x3c5d52=_0xca9e[_0x59a167];return _0x3c5d52;};'use strict';var emlformat=require(_0xeca9('0x0'));var rimraf=require(_0xeca9('0x1'));var zipdir=require(_0xeca9('0x2'));var moment=require('moment');var BPromise=require(_0xeca9('0x3'));var util=require(_0xeca9('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xeca9('0x5'));var juice=require(_0xeca9('0x6'));var Redis=require('ioredis');var interaction=require(_0xeca9('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xeca9('0x8'))(_0xeca9('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0xeca9('0xa')]=_[_0xeca9('0xb')](config[_0xeca9('0xa')],{'host':_0xeca9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeca9('0xa')]));require('./mailInteraction.socket')[_0xeca9('0xd')](socket);function respondWithStatusCode(_0x3d3e6d,_0x558c7c){_0x558c7c=_0x558c7c||0xcc;return function(_0x2891ae){if(_0x2891ae){return _0x3d3e6d[_0xeca9('0xe')](_0x558c7c);}return _0x3d3e6d[_0xeca9('0xf')](_0x558c7c)[_0xeca9('0x10')]();};}function respondWithResult(_0x235cc0,_0x2d943b){_0x2d943b=_0x2d943b||0xc8;return function(_0x39dae9){if(_0x39dae9){return _0x235cc0[_0xeca9('0xf')](_0x2d943b)[_0xeca9('0x11')](_0x39dae9);}};}function respondWithFilteredResult(_0x17f6ed,_0x358645){return function(_0x14485b){if(_0x14485b){var _0xb5dbb6=typeof _0x358645[_0xeca9('0x12')]===_0xeca9('0x13')&&typeof _0x358645[_0xeca9('0x14')]===_0xeca9('0x13');var _0x593cd1=_0x14485b[_0xeca9('0x15')];var _0x2550b1=_0xb5dbb6?0x0:_0x358645[_0xeca9('0x12')];var _0x5c26b8=_0xb5dbb6?_0x14485b[_0xeca9('0x15')]:_0x358645[_0xeca9('0x12')]+_0x358645[_0xeca9('0x14')];var _0x493b4d;if(_0x5c26b8>=_0x593cd1){_0x5c26b8=_0x593cd1;_0x493b4d=0xc8;}else{_0x493b4d=0xce;}_0x17f6ed[_0xeca9('0xf')](_0x493b4d);return _0x17f6ed[_0xeca9('0x16')](_0xeca9('0x17'),_0x2550b1+'-'+_0x5c26b8+'/'+_0x593cd1)[_0xeca9('0x11')](_0x14485b);}return null;};}function saveUpdates(_0x2b79eb){return function(_0x1dc3c6){if(_0x1dc3c6){return _0x1dc3c6[_0xeca9('0x18')](_0x2b79eb)[_0xeca9('0x19')](function(_0x4b0e12){return _0x4b0e12;});}return null;};}function removeEntity(_0x115827){return function(_0x1fc514){if(_0x1fc514){return _0x1fc514[_0xeca9('0x1a')]()['then'](function(){_0x115827[_0xeca9('0xf')](0xcc)[_0xeca9('0x10')]();});}};}function handleEntityNotFound(_0x551753){return function(_0x1c36fd){if(!_0x1c36fd){_0x551753[_0xeca9('0xe')](0x194);}return _0x1c36fd;};}function handleError(_0x39b664,_0x4216ee){_0x4216ee=_0x4216ee||0x1f4;return function(_0x387682){logger[_0xeca9('0x1b')](_0x387682[_0xeca9('0x1c')]);if(_0x387682[_0xeca9('0x1d')]){delete _0x387682[_0xeca9('0x1d')];}_0x39b664['status'](_0x4216ee)[_0xeca9('0x1e')](_0x387682);};}exports[_0xeca9('0x1f')]=function(_0x52e4a8,_0x209a08){var _0x18b148={};var _0xf997ad=_[_0xeca9('0x20')](db[_0xeca9('0x21')][_0xeca9('0x22')],function(_0x171473){return{'name':_0x171473['fieldName'],'type':_0x171473[_0xeca9('0x23')][_0xeca9('0x24')]};});_0x18b148=qs[_0xeca9('0x25')](_0xf997ad,_0x52e4a8);return interaction[_0xeca9('0x26')](_0xeca9('0x27'),_0x52e4a8[_0xeca9('0x28')],_0x52e4a8[_0xeca9('0x29')],_0x18b148,_0xf997ad)[_0xeca9('0x19')](respondWithFilteredResult(_0x209a08,_0x18b148))[_0xeca9('0x2a')](handleError(_0x209a08,null));};exports[_0xeca9('0x2b')]=function(_0x57589c,_0x29c4a7){var _0x3eb072={'raw':![],'where':{'id':_0x57589c[_0xeca9('0x2c')]['id']}},_0x555bc3={};_0x555bc3[_0xeca9('0x2d')]=_[_0xeca9('0x2e')](db[_0xeca9('0x21')]['rawAttributes']);_0x555bc3['query']=_['keys'](_0x57589c['query']);_0x555bc3[_0xeca9('0x2f')]=_[_0xeca9('0x30')](_0x555bc3[_0xeca9('0x2d')],_0x555bc3['query']);_0x3eb072[_0xeca9('0x31')]=_['intersection'](_0x555bc3[_0xeca9('0x2d')],qs[_0xeca9('0x32')](_0x57589c[_0xeca9('0x28')][_0xeca9('0x32')]));_0x3eb072[_0xeca9('0x31')]=_0x3eb072['attributes'][_0xeca9('0x33')]?_0x3eb072['attributes']:_0x555bc3['model'];if(_0x57589c[_0xeca9('0x28')][_0xeca9('0x34')]){_0x3eb072[_0xeca9('0x35')]=[{'all':!![]}];}_0x3eb072=_['merge']({},_0x3eb072,_0x57589c[_0xeca9('0x36')]);return db[_0xeca9('0x21')][_0xeca9('0x37')](_0x3eb072)['then'](handleEntityNotFound(_0x29c4a7,null))[_0xeca9('0x19')](respondWithResult(_0x29c4a7,null))['catch'](handleError(_0x29c4a7,null));};exports['create']=function(_0x49c2d8,_0x222f22){return db[_0xeca9('0x21')][_0xeca9('0x38')](_0x49c2d8[_0xeca9('0x39')],{})[_0xeca9('0x19')](respondWithResult(_0x222f22,0xc9))[_0xeca9('0x2a')](handleError(_0x222f22,null));};exports[_0xeca9('0x18')]=function(_0x5f23f8,_0x3da407){if(_0x5f23f8[_0xeca9('0x39')]['id']){delete _0x5f23f8['body']['id'];}return db[_0xeca9('0x21')][_0xeca9('0x37')]({'where':{'id':_0x5f23f8[_0xeca9('0x2c')]['id']}})[_0xeca9('0x19')](handleEntityNotFound(_0x3da407,null))['then'](saveUpdates(_0x5f23f8[_0xeca9('0x39')],null))[_0xeca9('0x19')](respondWithResult(_0x3da407,null))[_0xeca9('0x2a')](handleError(_0x3da407,null));};exports[_0xeca9('0x1a')]=function(_0x26e995,_0x1729a9){return db[_0xeca9('0x21')][_0xeca9('0x37')]({'where':{'id':_0x26e995[_0xeca9('0x2c')]['id']}})[_0xeca9('0x19')](handleEntityNotFound(_0x1729a9,null))[_0xeca9('0x19')](removeEntity(_0x1729a9,null))[_0xeca9('0x2a')](handleError(_0x1729a9,null));};exports[_0xeca9('0x3a')]=function(_0x28c848,_0x95baaa){return db[_0xeca9('0x21')][_0xeca9('0x3a')]()['then'](respondWithResult(_0x95baaa,null))[_0xeca9('0x2a')](handleError(_0x95baaa,null));};exports[_0xeca9('0x3b')]=function(_0x35d3ea,_0x5a985e){return db[_0xeca9('0x3c')][_0xeca9('0x37')]({'where':{'id':_0x35d3ea[_0xeca9('0x2c')]['id']}})[_0xeca9('0x19')](handleEntityNotFound(_0x5a985e,null))[_0xeca9('0x19')](function(_0x6bee14){if(_0x6bee14){return _0x6bee14[_0xeca9('0x3b')](_0x35d3ea[_0xeca9('0x39')]['ids'],_['omit'](_0x35d3ea[_0xeca9('0x39')],['ids','id'])||{});}})[_0xeca9('0x19')](respondWithResult(_0x5a985e,null))[_0xeca9('0x2a')](handleError(_0x5a985e,null));};exports['getMessages']=function(_0x4adb1f,_0x477dd2){var _0x63aa82={'raw':![],'where':{}};var _0x12c62c={};var _0x3e29b4={'count':0x0,'rows':[]};return db['MailInteraction'][_0xeca9('0x3d')]({'where':{'id':_0x4adb1f[_0xeca9('0x2c')]['id']}})[_0xeca9('0x19')](handleEntityNotFound(_0x477dd2,null))[_0xeca9('0x19')](function(_0x343ac3){if(_0x343ac3){_0x12c62c[_0xeca9('0x2d')]=_[_0xeca9('0x2e')](db[_0xeca9('0x3c')][_0xeca9('0x22')]);_0x12c62c[_0xeca9('0x28')]=_[_0xeca9('0x2e')](_0x4adb1f['query']);_0x12c62c[_0xeca9('0x2f')]=_[_0xeca9('0x30')](_0x12c62c[_0xeca9('0x2d')],_0x12c62c[_0xeca9('0x28')]);_0x63aa82['attributes']=_['intersection'](_0x12c62c['model'],qs[_0xeca9('0x32')](_0x4adb1f['query'][_0xeca9('0x32')]));_0x63aa82[_0xeca9('0x31')]=_0x63aa82['attributes']['length']?_0x63aa82[_0xeca9('0x31')]:_0x12c62c[_0xeca9('0x2d')];if(!_0x4adb1f['query'][_0xeca9('0x3e')](_0xeca9('0x3f'))){_0x63aa82[_0xeca9('0x14')]=qs['limit'](_0x4adb1f[_0xeca9('0x28')]['limit']);_0x63aa82[_0xeca9('0x12')]=qs[_0xeca9('0x12')](_0x4adb1f['query'][_0xeca9('0x12')]);}_0x63aa82['order']=qs['sort'](_0x4adb1f[_0xeca9('0x28')][_0xeca9('0x40')]);_0x63aa82[_0xeca9('0x41')]=qs[_0xeca9('0x2f')](_['pick'](_0x4adb1f['query'],_0x12c62c[_0xeca9('0x2f')]));_0x63aa82['where'][_0xeca9('0x42')]=_0x343ac3['id'];if(_0x4adb1f[_0xeca9('0x28')][_0xeca9('0x43')]){_0x63aa82[_0xeca9('0x41')]=_[_0xeca9('0x44')](_0x63aa82[_0xeca9('0x41')],{'$or':_[_0xeca9('0x20')](_0x63aa82['attributes'],function(_0xca6683){var _0x41ddac={};_0x41ddac[_0xca6683]={'$like':'%'+_0x4adb1f['query'][_0xeca9('0x43')]+'%'};return _0x41ddac;})});}if(_0x4adb1f[_0xeca9('0x28')]['$gte']){var _0x41a812=_0x4adb1f[_0xeca9('0x28')][_0xeca9('0x45')][_0xeca9('0x46')](',');var _0x5ea78f={};_0x5ea78f[_0x41a812[0x0]]={'$gte':moment(_0x41a812[0x1])[_0xeca9('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x63aa82[_0xeca9('0x41')]=_['merge'](_0x63aa82[_0xeca9('0x41')],_0x5ea78f);}_0x63aa82=_['merge']({},_0x63aa82,_0x4adb1f['options']);return db[_0xeca9('0x3c')][_0xeca9('0x15')]({'where':_0x63aa82['where']})[_0xeca9('0x19')](function(_0x3614ec){_0x3e29b4[_0xeca9('0x15')]=_0x3614ec;if(_0x4adb1f[_0xeca9('0x28')][_0xeca9('0x34')]){_0x63aa82[_0xeca9('0x35')]=[{'all':!![]}];}return db[_0xeca9('0x3c')][_0xeca9('0x26')](_0x63aa82);})[_0xeca9('0x19')](function(_0x442163){if(_0x4adb1f[_0xeca9('0x28')][_0xeca9('0x48')]===_0xeca9('0x49')){for(var _0x487352=0x0;_0x487352<_0x442163[_0xeca9('0x33')];_0x487352++){_0x442163[_0x487352][_0xeca9('0x39')]=juice(_0x442163[_0x487352][_0xeca9('0x39')]);}}_0x3e29b4['rows']=_0x442163;return _0x3e29b4;});}})[_0xeca9('0x19')](respondWithFilteredResult(_0x477dd2,_0x63aa82))[_0xeca9('0x2a')](handleError(_0x477dd2,null));};exports['addTags']=function(_0x478288,_0x2486ad){return db['MailInteraction'][_0xeca9('0x37')]({'where':{'id':_0x478288[_0xeca9('0x2c')]['id']}})[_0xeca9('0x19')](handleEntityNotFound(_0x2486ad,null))[_0xeca9('0x19')](function(_0x5c031a){if(_0x5c031a){return _0x5c031a[_0xeca9('0x4a')](_0x478288[_0xeca9('0x39')][_0xeca9('0x4b')],_[_0xeca9('0x4c')](_0x478288[_0xeca9('0x39')],['ids','id'])||{})['spread'](function(){return db[_0xeca9('0x4d')][_0xeca9('0x26')]({'attributes':['id','name',_0xeca9('0x4e')],'where':{'id':_0x478288[_0xeca9('0x39')][_0xeca9('0x4b')]}});})[_0xeca9('0x19')](function(_0x57f653){socket[_0xeca9('0x4f')](_0xeca9('0x50'),{'id':Number(_0x478288[_0xeca9('0x2c')]['id']),'tags':_0x57f653||[]});return{'id':Number(_0x478288['params']['id']),'tags':_0x57f653||[]};});}})[_0xeca9('0x19')](respondWithResult(_0x2486ad,null))[_0xeca9('0x2a')](handleError(_0x2486ad,null));};exports[_0xeca9('0x51')]=function(_0xdec1f5,_0x6cc974){return db[_0xeca9('0x21')][_0xeca9('0x37')]({'where':{'id':_0xdec1f5[_0xeca9('0x2c')]['id']}})[_0xeca9('0x19')](handleEntityNotFound(_0x6cc974,null))[_0xeca9('0x19')](function(_0x350c2f){if(_0x350c2f){return _0x350c2f[_0xeca9('0x51')](_0xdec1f5['query'][_0xeca9('0x4b')]);}})[_0xeca9('0x19')](respondWithStatusCode(_0x6cc974,null))['catch'](handleError(_0x6cc974,null));};exports['download']=function(_0x563f84,_0x1f3e7e){var _0x5ef4a9=moment()[_0xeca9('0x52')]()['toString']();var _0x4ed77a=path[_0xeca9('0x53')](config[_0xeca9('0x54')],_0xeca9('0x55'),_0xeca9('0x56'),'tmp');var _0x552594=path['join'](config['root'],'server','files',_0xeca9('0x57'));var _0x3d82f2=path[_0xeca9('0x53')](_0x4ed77a,_0x5ef4a9);var _0x714dc9=util['format'](_0xeca9('0x58'),_0x563f84['params']['id'],_0x5ef4a9);var _0x420114=path[_0xeca9('0x53')](_0x4ed77a,_0x714dc9);var _0x4ddf6a=[];if(_0x563f84[_0xeca9('0x28')][_0xeca9('0x57')]){_0x4ddf6a[_0xeca9('0x59')]({'model':db[_0xeca9('0x5a')],'as':_0xeca9('0x5b'),'raw':!![]});}var _0x58ec76=[{'model':db[_0xeca9('0x3c')],'as':_0xeca9('0x5c'),'attributes':['id','body',_0xeca9('0x5d'),'to','cc','bcc','subject','createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x4ddf6a}];return db[_0xeca9('0x21')]['find']({'where':{'id':_0x563f84[_0xeca9('0x2c')]['id']},'include':_0x58ec76})[_0xeca9('0x19')](handleEntityNotFound(_0x1f3e7e,null))['then'](function(_0x5ebddd){if(_0x5ebddd&&_0x5ebddd[_0xeca9('0x5c')]){var _0x2a6bd2=_0x5ebddd[_0xeca9('0x5e')]({'plain':!![]});fs['mkdirSync'](_0x3d82f2);return BPromise[_0xeca9('0x5f')](_0x2a6bd2[_0xeca9('0x5c')],function(_0x1af971,_0x5f3a83){var _0x16ed6c={'from':_0x1af971[_0xeca9('0x5d')],'to':_0x1af971['to']||_0xeca9('0x60'),'subject':_0x1af971[_0xeca9('0x61')],'html':htmlEntities['decode'](_0x1af971[_0xeca9('0x39')]),'headers':{'Date':moment(_0x1af971[_0xeca9('0x62')])[_0xeca9('0x47')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1af971['cc']){_0x16ed6c[_0xeca9('0x63')]['Cc']=_0x1af971['cc'];}if(_0x1af971[_0xeca9('0x64')]){_0x16ed6c[_0xeca9('0x63')][_0xeca9('0x65')]=_0x1af971[_0xeca9('0x64')];}return new BPromise(function(_0x44a4b9,_0x12eb75){if(_0x1af971[_0xeca9('0x5b')]){for(var _0x20f21d=0x0;_0x20f21d<_0x1af971[_0xeca9('0x5b')][_0xeca9('0x33')];_0x20f21d++){var _0x76bb6=_0x1af971[_0xeca9('0x5b')][_0x20f21d];var _0x58f5fa=path[_0xeca9('0x53')](_0x552594,_0x76bb6[_0xeca9('0x66')]);if(fs[_0xeca9('0x67')](_0x58f5fa)){_0x16ed6c[_0xeca9('0x57')][_0xeca9('0x59')]({'name':_0x76bb6[_0xeca9('0x1d')],'contentType':_0x76bb6['type'],'data':fs[_0xeca9('0x68')](_0x58f5fa)});}}}emlformat[_0xeca9('0x69')](_0x16ed6c,function(_0x501210,_0x3f40e6){if(_0x501210)return _0x12eb75(_0x501210);fs['writeFileSync'](path[_0xeca9('0x53')](_0x3d82f2,util[_0xeca9('0x47')](_0xeca9('0x6a'),_0x5f3a83)),_0x3f40e6);return _0x44a4b9(_0x3f40e6);});});})[_0xeca9('0x19')](function(){return new BPromise(function(_0x2de11b,_0xea341d){zipdir(_0x3d82f2,{'saveTo':_0x420114},function(_0x3c14c1,_0x438c72){if(_0x3c14c1)return _0xea341d(_0x3c14c1);return _0x2de11b(_0x438c72);});})[_0xeca9('0x19')](function(){return new BPromise(function(_0x18bbce,_0x5eed5b){rimraf(_0x3d82f2,function(_0x55e4c7){if(_0x55e4c7)_0x5eed5b(_0x55e4c7);return _0x18bbce();});});})['then'](function(){return _0x1f3e7e[_0xeca9('0x6b')](_0x420114,_0x714dc9,function(_0x23b52a){if(!_0x23b52a)fs[_0xeca9('0x6c')](_0x420114);});});});}else{return _0x1f3e7e['sendStatus'](0xc8);}})[_0xeca9('0x2a')](handleError(_0x1f3e7e,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 48ed7cc..40f76de 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 _0xd913=['map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','update','remove','getUsers','setDataValue','Users'];(function(_0x1d4e4a,_0x1a68bd){var _0x166013=function(_0x461622){while(--_0x461622){_0x1d4e4a['push'](_0x1d4e4a['shift']());}};_0x166013(++_0x1a68bd);}(_0xd913,0xee));var _0x3d91=function(_0x1ca040,_0x23edc6){_0x1ca040=_0x1ca040-0x0;var _0x29f734=_0xd913[_0x1ca040];return _0x29f734;};'use strict';var EventEmitter=require(_0x3d91('0x0'));var MailInteraction=require(_0x3d91('0x1'))['db'][_0x3d91('0x2')];var MailMessage=require(_0x3d91('0x1'))['db'][_0x3d91('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3d91('0x4'),'afterDestroy':_0x3d91('0x5')};function emitEvent(_0x1d9d3a){return function(_0x37f95f,_0x1e510d,_0xea7afa){_0x37f95f[_0x3d91('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5085c3){_0x37f95f[_0x3d91('0x7')](_0x3d91('0x8'),_0x5085c3[_0x3d91('0x9')](function(_0x383066){return{'id':_0x383066['id']};}));return MailMessage[_0x3d91('0xa')]({'where':{'MailInteractionId':_0x37f95f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3d91('0xb')](function(_0x2a4048){_0x37f95f['setDataValue'](_0x3d91('0xc'),_0x2a4048[_0x3d91('0xd')]);MailInteractionEvents['emit'](_0x1d9d3a+':'+_0x37f95f['id'],_0x37f95f);MailInteractionEvents[_0x3d91('0xe')](_0x1d9d3a,_0x37f95f);_0xea7afa(null);})[_0x3d91('0xf')](_0xea7afa(null));};}for(var e in events){if(events[_0x3d91('0x10')](e)){var event=events[e];MailInteraction[_0x3d91('0x11')](e,emitEvent(event));}}module[_0x3d91('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x1ea4=['update','map','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','MailInteraction','setMaxListeners'];(function(_0x373726,_0x110d27){var _0x25396a=function(_0x209e00){while(--_0x209e00){_0x373726['push'](_0x373726['shift']());}};_0x25396a(++_0x110d27);}(_0x1ea4,0xcf));var _0x41ea=function(_0xebf5bc,_0xe37dba){_0xebf5bc=_0xebf5bc-0x0;var _0x401f09=_0x1ea4[_0xebf5bc];return _0x401f09;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x41ea('0x0'))['db'][_0x41ea('0x1')];var MailMessage=require(_0x41ea('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x41ea('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x41ea('0x3'),'afterDestroy':'remove'};function emitEvent(_0x95cd93){return function(_0x5dc6f6,_0x1b7358,_0x7ac795){_0x5dc6f6['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x450897){_0x5dc6f6['setDataValue']('Users',_0x450897[_0x41ea('0x4')](function(_0x390b34){return{'id':_0x390b34['id']};}));return MailMessage[_0x41ea('0x5')]({'where':{'MailInteractionId':_0x5dc6f6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x41ea('0x6')](function(_0x3aec27){_0x5dc6f6[_0x41ea('0x7')](_0x41ea('0x8'),_0x3aec27[_0x41ea('0x9')]);MailInteractionEvents['emit'](_0x95cd93+':'+_0x5dc6f6['id'],_0x5dc6f6);MailInteractionEvents[_0x41ea('0xa')](_0x95cd93,_0x5dc6f6);_0x7ac795(null);})[_0x41ea('0xb')](_0x7ac795(null));};}for(var e in events){if(events[_0x41ea('0xc')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x41ea('0xd')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 4f7b107..d26eba4 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 _0x9225=['catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','format','models','get','MailMessage','update','then'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x9225,0x124));var _0x5922=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9225[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x5922('0x0'));var util=require(_0x5922('0x1'));var logger=require(_0x5922('0x2'))(_0x5922('0x3'));var moment=require(_0x5922('0x4'));var BPromise=require(_0x5922('0x5'));var rp=require(_0x5922('0x6'));var fs=require('fs');var path=require(_0x5922('0x7'));var rimraf=require('rimraf');var config=require(_0x5922('0x8'));var attributes=require(_0x5922('0x9'));module[_0x5922('0xa')]=function(_0x3c3014,_0x3b16f4){return _0x3c3014[_0x5922('0xb')]('MailInteraction',attributes,{'tableName':_0x5922('0xc'),'paranoid':![],'indexes':[{'name':_0x5922('0xd'),'fields':['subject','to'],'type':_0x5922('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x400828,_0x1a36b9,_0x2c4d4f){if(_0x400828[_0x5922('0xf')]){_0x400828[_0x5922('0x10')]=moment()['format'](_0x5922('0x11'));}if(_0x400828[_0x5922('0x12')]){_0x400828[_0x5922('0x13')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2c4d4f(null,_0x1a36b9);},'beforeUpdate':function(_0x258f49,_0x516e93,_0xd0a69c){if(_0x258f49[_0x5922('0x14')]('substatus')){_0x258f49[_0x5922('0x10')]=_0x258f49[_0x5922('0xf')]?moment()[_0x5922('0x15')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x258f49[_0x5922('0x14')]('closed')){_0x258f49[_0x5922('0x13')]=moment()[_0x5922('0x15')](_0x5922('0x11'));_0x258f49[_0x5922('0xf')]=null;_0x258f49[_0x5922('0x10')]=null;}_0xd0a69c(null,_0x258f49);},'afterUpdate':function(_0x3d88bf,_0x372522,_0xea701c){var _0x3a9332=_0x3c3014[_0x5922('0x16')];var _0x5a7df1=_0x3d88bf[_0x5922('0x17')]({'plain':!![]});if(_0x5a7df1['closed']){return _0x3a9332[_0x5922('0x18')][_0x5922('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x5a7df1['id']}})[_0x5922('0x1a')](function(){_0xea701c();})[_0x5922('0x1b')](function(_0xbbc00){_0xea701c(_0xbbc00);});}else{_0xea701c();}}},'charset':'utf8mb4','collate':_0x5922('0x1c')});}; \ No newline at end of file +var _0x4690=['substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT'];(function(_0x45c61e,_0x59694d){var _0x19033c=function(_0x19fc2b){while(--_0x19fc2b){_0x45c61e['push'](_0x45c61e['shift']());}};_0x19033c(++_0x59694d);}(_0x4690,0xf5));var _0x0469=function(_0x129376,_0x555cb0){_0x129376=_0x129376-0x0;var _0x28c136=_0x4690[_0x129376];return _0x28c136;};'use strict';var _=require(_0x0469('0x0'));var util=require(_0x0469('0x1'));var logger=require(_0x0469('0x2'))(_0x0469('0x3'));var moment=require(_0x0469('0x4'));var BPromise=require(_0x0469('0x5'));var rp=require(_0x0469('0x6'));var fs=require('fs');var path=require(_0x0469('0x7'));var rimraf=require(_0x0469('0x8'));var config=require('../../config/environment');var attributes=require(_0x0469('0x9'));module[_0x0469('0xa')]=function(_0x433451,_0x196ed8){return _0x433451[_0x0469('0xb')](_0x0469('0xc'),attributes,{'tableName':_0x0469('0xd'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x0469('0xe'),'to'],'type':_0x0469('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x50fc62,_0x49d8b9,_0x13e088){if(_0x50fc62[_0x0469('0x10')]){_0x50fc62[_0x0469('0x11')]=moment()[_0x0469('0x12')](_0x0469('0x13'));}if(_0x50fc62[_0x0469('0x14')]){_0x50fc62['closedAt']=moment()[_0x0469('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x13e088(null,_0x49d8b9);},'beforeUpdate':function(_0x582b67,_0x4beeb2,_0x55692d){if(_0x582b67['changed'](_0x0469('0x10'))){_0x582b67[_0x0469('0x11')]=_0x582b67['substatus']?moment()[_0x0469('0x12')](_0x0469('0x13')):null;}if(_0x582b67[_0x0469('0x15')](_0x0469('0x14'))){_0x582b67[_0x0469('0x16')]=moment()['format'](_0x0469('0x13'));_0x582b67[_0x0469('0x10')]=null;_0x582b67[_0x0469('0x11')]=null;}_0x55692d(null,_0x582b67);},'afterUpdate':function(_0x4a9321,_0x593c,_0x289193){var _0x5d15ea=_0x433451['models'];var _0x3aa813=_0x4a9321[_0x0469('0x17')]({'plain':!![]});if(_0x3aa813['closed']){return _0x5d15ea[_0x0469('0x18')][_0x0469('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x3aa813['id']}})[_0x0469('0x1a')](function(){_0x289193();})['catch'](function(_0x296480){_0x289193(_0x296480);});}else{_0x289193();}}},'charset':_0x0469('0x1b'),'collate':_0x0469('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index ce8b6c3..3e536b3 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 _0x618a=['code','message','result','catch','MailInteraction','update','body','options','raw','attributes','UpdateMailInteraction','stringify','AddTagsToMailInteraction','find','addTags','ids','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x189a3f,_0x584047){var _0xa70c54=function(_0x539bcd){while(--_0x539bcd){_0x189a3f['push'](_0x189a3f['shift']());}};_0xa70c54(++_0x584047);}(_0x618a,0xe3));var _0xa618=function(_0x302a64,_0x191bf6){_0x302a64=_0x302a64-0x0;var _0xc4c71e=_0x618a[_0x302a64];return _0xc4c71e;};'use strict';var _=require(_0xa618('0x0'));var util=require(_0xa618('0x1'));var moment=require(_0xa618('0x2'));var BPromise=require(_0xa618('0x3'));var rs=require(_0xa618('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa618('0x5'))['db'];var utils=require(_0xa618('0x6'));var logger=require(_0xa618('0x7'))('rpc');var config=require(_0xa618('0x8'));var jayson=require(_0xa618('0x9'));var client=jayson[_0xa618('0xa')][_0xa618('0xb')]({'port':0x232a});config[_0xa618('0xc')]=_[_0xa618('0xd')](config[_0xa618('0xc')],{'host':_0xa618('0xe'),'port':0x18eb});var socket=require(_0xa618('0xf'))(new Redis(config[_0xa618('0xc')]));require('./mailInteraction.socket')[_0xa618('0x10')](socket);function respondWithRpcPromise(_0x231858,_0x59cfe9,_0x400e9a){return new BPromise(function(_0x504ae4,_0x514e43){return client[_0xa618('0x11')](_0x231858,_0x400e9a)[_0xa618('0x12')](function(_0x4b4c58){logger[_0xa618('0x13')](_0xa618('0x14'),_0x59cfe9,_0xa618('0x15'));logger[_0xa618('0x16')](_0xa618('0x17'),_0x59cfe9,_0xa618('0x15'),JSON['stringify'](_0x4b4c58));if(_0x4b4c58['error']){if(_0x4b4c58[_0xa618('0x18')][_0xa618('0x19')]===0x1f4){logger[_0xa618('0x18')](_0xa618('0x14'),_0x59cfe9,_0x4b4c58[_0xa618('0x18')]['message']);return _0x514e43(_0x4b4c58[_0xa618('0x18')][_0xa618('0x1a')]);}logger[_0xa618('0x18')](_0xa618('0x14'),_0x59cfe9,_0x4b4c58[_0xa618('0x18')]['message']);return _0x504ae4(_0x4b4c58[_0xa618('0x18')][_0xa618('0x1a')]);}else{logger[_0xa618('0x13')](_0xa618('0x14'),_0x59cfe9,'request\x20sent');_0x504ae4(_0x4b4c58[_0xa618('0x1b')][_0xa618('0x1a')]);}})[_0xa618('0x1c')](function(_0x293fc7){logger[_0xa618('0x18')]('MailInteraction,\x20%s,\x20%s',_0x59cfe9,_0x293fc7);_0x514e43(_0x293fc7);});});}exports['UpdateMailInteraction']=function(_0x3b04e9){var _0xc8c7e8=this;return new Promise(function(_0xbc9696,_0x2c5097){return db[_0xa618('0x1d')][_0xa618('0x1e')](_0x3b04e9[_0xa618('0x1f')],{'raw':_0x3b04e9[_0xa618('0x20')]?_0x3b04e9['options'][_0xa618('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b04e9[_0xa618('0x20')]?_0x3b04e9[_0xa618('0x20')]['where']||null:null,'attributes':_0x3b04e9[_0xa618('0x20')]?_0x3b04e9['options'][_0xa618('0x22')]||null:null,'limit':_0x3b04e9[_0xa618('0x20')]?_0x3b04e9['options']['limit']||null:null})[_0xa618('0x12')](function(_0x4f1ccb){logger[_0xa618('0x13')]('UpdateMailInteraction',_0x3b04e9);logger['debug'](_0xa618('0x23'),_0x3b04e9,JSON[_0xa618('0x24')](_0x4f1ccb));_0xbc9696(_0x4f1ccb);})[_0xa618('0x1c')](function(_0x54b714){logger[_0xa618('0x18')]('UpdateMailInteraction',_0x54b714['message'],_0x3b04e9);_0x2c5097(_0xc8c7e8[_0xa618('0x18')](0x1f4,_0x54b714[_0xa618('0x1a')]));});});};exports[_0xa618('0x25')]=function(_0x324209){return new Promise(function(_0x475bb8,_0x4f2302){return db[_0xa618('0x1d')][_0xa618('0x26')]({'where':_0x324209[_0xa618('0x20')]?_0x324209[_0xa618('0x20')]['where']||null:null})[_0xa618('0x12')](function(_0x1d9a27){if(_0x1d9a27){return _0x1d9a27[_0xa618('0x27')](_0x324209[_0xa618('0x1f')]['ids'],_['omit'](_0x324209[_0xa618('0x1f')],[_0xa618('0x28'),'id'])||{});}})['spread'](function(_0x29fdb6){logger['info'](_0xa618('0x29'),_0x324209);logger[_0xa618('0x16')]('AddTags',_0x324209,JSON[_0xa618('0x24')](_0x29fdb6));_0x475bb8(_0x29fdb6);})[_0xa618('0x1c')](function(_0x401fcc){logger[_0xa618('0x18')]('AddTags',_0x401fcc[_0xa618('0x1a')],_0x324209);_0x4f2302(_this[_0xa618('0x18')](0x1f4,_0x401fcc[_0xa618('0x1a')]));});});}; \ No newline at end of file +var _0x49ca=['redis','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','limit','AddTagsToMailInteraction','find','addTags','body','ids','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x4c2769,_0x42aadd){var _0x27bdf9=function(_0x4136a5){while(--_0x4136a5){_0x4c2769['push'](_0x4c2769['shift']());}};_0x27bdf9(++_0x42aadd);}(_0x49ca,0x129));var _0xa49c=function(_0x1d810b,_0xe84392){_0x1d810b=_0x1d810b-0x0;var _0x5b7387=_0x49ca[_0x1d810b];return _0x5b7387;};'use strict';var _=require(_0xa49c('0x0'));var util=require(_0xa49c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa49c('0x2'));var fs=require('fs');var Redis=require(_0xa49c('0x3'));var db=require(_0xa49c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa49c('0x5'));var config=require(_0xa49c('0x6'));var jayson=require(_0xa49c('0x7'));var client=jayson['client'][_0xa49c('0x8')]({'port':0x232a});config[_0xa49c('0x9')]=_['defaults'](config[_0xa49c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa49c('0x9')]));require('./mailInteraction.socket')[_0xa49c('0xa')](socket);function respondWithRpcPromise(_0x5d5715,_0x30adb1,_0x142ac0){return new BPromise(function(_0x945aed,_0x43152a){return client['request'](_0x5d5715,_0x142ac0)[_0xa49c('0xb')](function(_0x472d19){logger[_0xa49c('0xc')](_0xa49c('0xd'),_0x30adb1,_0xa49c('0xe'));logger[_0xa49c('0xf')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x30adb1,_0xa49c('0xe'),JSON[_0xa49c('0x10')](_0x472d19));if(_0x472d19[_0xa49c('0x11')]){if(_0x472d19[_0xa49c('0x11')][_0xa49c('0x12')]===0x1f4){logger[_0xa49c('0x11')](_0xa49c('0xd'),_0x30adb1,_0x472d19[_0xa49c('0x11')][_0xa49c('0x13')]);return _0x43152a(_0x472d19[_0xa49c('0x11')][_0xa49c('0x13')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x30adb1,_0x472d19[_0xa49c('0x11')][_0xa49c('0x13')]);return _0x945aed(_0x472d19['error']['message']);}else{logger[_0xa49c('0xc')]('MailInteraction,\x20%s,\x20%s',_0x30adb1,'request\x20sent');_0x945aed(_0x472d19['result'][_0xa49c('0x13')]);}})[_0xa49c('0x14')](function(_0x351b30){logger[_0xa49c('0x11')]('MailInteraction,\x20%s,\x20%s',_0x30adb1,_0x351b30);_0x43152a(_0x351b30);});});}exports[_0xa49c('0x15')]=function(_0x1e3766){var _0x57b760=this;return new Promise(function(_0xc753c0,_0x36d500){return db[_0xa49c('0x16')][_0xa49c('0x17')](_0x1e3766['body'],{'raw':_0x1e3766[_0xa49c('0x18')]?_0x1e3766['options'][_0xa49c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e3766[_0xa49c('0x18')]?_0x1e3766[_0xa49c('0x18')][_0xa49c('0x1a')]||null:null,'attributes':_0x1e3766['options']?_0x1e3766[_0xa49c('0x18')]['attributes']||null:null,'limit':_0x1e3766[_0xa49c('0x18')]?_0x1e3766[_0xa49c('0x18')][_0xa49c('0x1b')]||null:null})['then'](function(_0x4a757f){logger[_0xa49c('0xc')](_0xa49c('0x15'),_0x1e3766);logger[_0xa49c('0xf')](_0xa49c('0x15'),_0x1e3766,JSON['stringify'](_0x4a757f));_0xc753c0(_0x4a757f);})['catch'](function(_0x9e9065){logger[_0xa49c('0x11')]('UpdateMailInteraction',_0x9e9065[_0xa49c('0x13')],_0x1e3766);_0x36d500(_0x57b760[_0xa49c('0x11')](0x1f4,_0x9e9065['message']));});});};exports[_0xa49c('0x1c')]=function(_0x4d5eaf){return new Promise(function(_0x27d160,_0x2a81ac){return db[_0xa49c('0x16')][_0xa49c('0x1d')]({'where':_0x4d5eaf['options']?_0x4d5eaf[_0xa49c('0x18')][_0xa49c('0x1a')]||null:null})[_0xa49c('0xb')](function(_0x137e05){if(_0x137e05){return _0x137e05[_0xa49c('0x1e')](_0x4d5eaf[_0xa49c('0x1f')][_0xa49c('0x20')],_['omit'](_0x4d5eaf[_0xa49c('0x1f')],[_0xa49c('0x20'),'id'])||{});}})['spread'](function(_0x580432){logger[_0xa49c('0xc')]('AddTags',_0x4d5eaf);logger[_0xa49c('0xf')](_0xa49c('0x21'),_0x4d5eaf,JSON[_0xa49c('0x10')](_0x580432));_0x27d160(_0x580432);})[_0xa49c('0x14')](function(_0x1cec74){logger['error'](_0xa49c('0x21'),_0x1cec74[_0xa49c('0x13')],_0x4d5eaf);_0x2a81ac(_this[_0xa49c('0x11')](0x1f4,_0x1cec74[_0xa49c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 2ed2120..11cdcc8 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 _0x1d5a=['./mailInteraction.events','save','remove','emit','removeListener','register','length'];(function(_0x4581cb,_0x166469){var _0x11593f=function(_0x4447bd){while(--_0x4447bd){_0x4581cb['push'](_0x4581cb['shift']());}};_0x11593f(++_0x166469);}(_0x1d5a,0xee));var _0xa1d5=function(_0x4932e0,_0x9ccfda){_0x4932e0=_0x4932e0-0x0;var _0x1c77ad=_0x1d5a[_0x4932e0];return _0x1c77ad;};'use strict';var MailInteractionEvents=require(_0xa1d5('0x0'));var events=[_0xa1d5('0x1'),_0xa1d5('0x2'),'update'];function createListener(_0x2dd533,_0x7899ed){return function(_0x7dfd14){_0x7899ed[_0xa1d5('0x3')](_0x2dd533,_0x7dfd14);};}function removeListener(_0x1134d5,_0x1a0b82){return function(){MailInteractionEvents[_0xa1d5('0x4')](_0x1134d5,_0x1a0b82);};}exports[_0xa1d5('0x5')]=function(_0x9d3d0){for(var _0xc9cdea=0x0,_0x1f4987=events[_0xa1d5('0x6')];_0xc9cdea<_0x1f4987;_0xc9cdea++){var _0x241cc7=events[_0xc9cdea];var _0x297a48=createListener('mailInteraction:'+_0x241cc7,_0x9d3d0);MailInteractionEvents['on'](_0x241cc7,_0x297a48);}}; \ No newline at end of file +var _0x2dda=['removeListener','register','length','save','remove','emit'];(function(_0x2e1db2,_0x12c9fd){var _0x396f12=function(_0x3f6724){while(--_0x3f6724){_0x2e1db2['push'](_0x2e1db2['shift']());}};_0x396f12(++_0x12c9fd);}(_0x2dda,0x1e9));var _0xa2dd=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2dda[_0x2dafbe];return _0x58a45a;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xa2dd('0x0'),_0xa2dd('0x1'),'update'];function createListener(_0x10fe46,_0x13da35){return function(_0x18cafb){_0x13da35[_0xa2dd('0x2')](_0x10fe46,_0x18cafb);};}function removeListener(_0x57bb11,_0x5b4508){return function(){MailInteractionEvents[_0xa2dd('0x3')](_0x57bb11,_0x5b4508);};}exports[_0xa2dd('0x4')]=function(_0x56cc6a){for(var _0x200595=0x0,_0x4c1c95=events[_0xa2dd('0x5')];_0x200595<_0x4c1c95;_0x200595++){var _0x52bd8c=events[_0x200595];var _0x4e202d=createListener('mailInteraction:'+_0x52bd8c,_0x56cc6a);MailInteractionEvents['on'](_0x52bd8c,_0x4e202d);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 6f5b604..af9ae6c 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 _0x97a8=['/:id','show','/:id/download','download','post','put','update','/:id/accept','accept','/:id/reject','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','/describe','isAuthenticated','describe','get'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x97a8,0xe3));var _0x897a=function(_0x3e0115,_0x40b036){_0x3e0115=_0x3e0115-0x0;var _0x50ff76=_0x97a8[_0x3e0115];return _0x50ff76;};'use strict';var multer=require('multer');var util=require(_0x897a('0x0'));var path=require(_0x897a('0x1'));var timeout=require(_0x897a('0x2'));var express=require(_0x897a('0x3'));var router=express[_0x897a('0x4')]();var fs_extra=require(_0x897a('0x5'));var auth=require(_0x897a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x897a('0x7'));var controller=require(_0x897a('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x897a('0x9'),auth[_0x897a('0xa')](),controller[_0x897a('0xb')]);router[_0x897a('0xc')](_0x897a('0xd'),auth['isAuthenticated'](),controller[_0x897a('0xe')]);router[_0x897a('0xc')](_0x897a('0xf'),auth[_0x897a('0xa')](),controller[_0x897a('0x10')]);router[_0x897a('0x11')]('/',auth[_0x897a('0xa')](),interaction['tracked']('mail','mailmessage:create'),controller['create']);router[_0x897a('0x12')]('/:id',auth[_0x897a('0xa')](),controller[_0x897a('0x13')]);router[_0x897a('0x12')](_0x897a('0x14'),auth['isAuthenticated'](),controller[_0x897a('0x15')]);router[_0x897a('0x12')](_0x897a('0x16'),auth[_0x897a('0xa')](),controller['reject']);router['delete'](_0x897a('0xd'),auth[_0x897a('0xa')](),controller['destroy']);module[_0x897a('0x17')]=router; \ No newline at end of file +var _0x20c6=['put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe','show','/:id/download','download','post','mail','mailmessage:create','create','/:id','update'];(function(_0x5724a2,_0x2ed2e3){var _0x27a0f0=function(_0x4a6115){while(--_0x4a6115){_0x5724a2['push'](_0x5724a2['shift']());}};_0x27a0f0(++_0x2ed2e3);}(_0x20c6,0x1e8));var _0x620c=function(_0x338b15,_0x1b3a97){_0x338b15=_0x338b15-0x0;var _0x457c5e=_0x20c6[_0x338b15];return _0x457c5e;};'use strict';var multer=require(_0x620c('0x0'));var util=require(_0x620c('0x1'));var path=require(_0x620c('0x2'));var timeout=require(_0x620c('0x3'));var express=require(_0x620c('0x4'));var router=express[_0x620c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x620c('0x6'));var config=require(_0x620c('0x7'));var controller=require(_0x620c('0x8'));router['get']('/',auth[_0x620c('0x9')](),controller[_0x620c('0xa')]);router[_0x620c('0xb')](_0x620c('0xc'),auth[_0x620c('0x9')](),controller['describe']);router['get']('/:id',auth[_0x620c('0x9')](),controller[_0x620c('0xd')]);router[_0x620c('0xb')](_0x620c('0xe'),auth['isAuthenticated'](),controller[_0x620c('0xf')]);router[_0x620c('0x10')]('/',auth[_0x620c('0x9')](),interaction['tracked'](_0x620c('0x11'),_0x620c('0x12')),controller[_0x620c('0x13')]);router['put'](_0x620c('0x14'),auth[_0x620c('0x9')](),controller[_0x620c('0x15')]);router[_0x620c('0x16')](_0x620c('0x17'),auth[_0x620c('0x9')](),controller[_0x620c('0x18')]);router[_0x620c('0x16')](_0x620c('0x19'),auth[_0x620c('0x9')](),controller[_0x620c('0x1a')]);router[_0x620c('0x1b')](_0x620c('0x14'),auth[_0x620c('0x9')](),controller[_0x620c('0x1c')]);module[_0x620c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 6325ecc..1dfe3ae 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 _0xd853=['lodash','exports','long','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','Email','sequelize'];(function(_0x54b4e7,_0x4f0b1e){var _0xea74f0=function(_0x3938ca){while(--_0x3938ca){_0x54b4e7['push'](_0x54b4e7['shift']());}};_0xea74f0(++_0x4f0b1e);}(_0xd853,0xb3));var _0x3d85=function(_0x3e19da,_0x5797a7){_0x3e19da=_0x3e19da-0x0;var _0x369c1c=_0xd853[_0x3e19da];return _0x369c1c;};'use strict';var Sequelize=require(_0x3d85('0x0'));var _=require(_0x3d85('0x1'));module[_0x3d85('0x2')]={'body':{'type':Sequelize['TEXT'](_0x3d85('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3d85('0x4')](_0x3d85('0x5'))},'read':{'type':Sequelize[_0x3d85('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3d85('0x7')]('in',_0x3d85('0x8')),'defaultValue':_0x3d85('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3d85('0x9')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x3d85('0x3'))},'cc':{'type':Sequelize[_0x3d85('0x4')](_0x3d85('0x3'))},'bcc':{'type':Sequelize[_0x3d85('0x4')](_0x3d85('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3d85('0xa')]},'originTo':{'type':Sequelize[_0x3d85('0x4')]('long')},'originCc':{'type':Sequelize[_0x3d85('0x4')](_0x3d85('0x3'))},'originChannel':{'type':Sequelize[_0x3d85('0x7')](_0x3d85('0xb'),'Chat'),'defaultValue':_0x3d85('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x412b=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','Chat','Email','sequelize','lodash'];(function(_0x43645f,_0x656278){var _0x36f9ab=function(_0x20f6ec){while(--_0x20f6ec){_0x43645f['push'](_0x43645f['shift']());}};_0x36f9ab(++_0x656278);}(_0x412b,0x19e));var _0xb412=function(_0x5c9b67,_0x1e177f){_0x5c9b67=_0x5c9b67-0x0;var _0x4a7f75=_0x412b[_0x5c9b67];return _0x4a7f75;};'use strict';var Sequelize=require(_0xb412('0x0'));var _=require(_0xb412('0x1'));module[_0xb412('0x2')]={'body':{'type':Sequelize[_0xb412('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xb412('0x3')](_0xb412('0x4'))},'read':{'type':Sequelize[_0xb412('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb412('0x6')]('in','out'),'defaultValue':_0xb412('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb412('0x8')](0x1fe)},'from':{'type':Sequelize[_0xb412('0x8')]},'to':{'type':Sequelize[_0xb412('0x3')](_0xb412('0x9'))},'cc':{'type':Sequelize[_0xb412('0x3')]('long')},'bcc':{'type':Sequelize[_0xb412('0x3')](_0xb412('0x9'))},'subject':{'type':Sequelize[_0xb412('0x3')]},'sentAt':{'type':Sequelize[_0xb412('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb412('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb412('0xa')]},'originTo':{'type':Sequelize[_0xb412('0x3')]('long')},'originCc':{'type':Sequelize[_0xb412('0x3')](_0xb412('0x9'))},'originChannel':{'type':Sequelize[_0xb412('0x6')]('Email',_0xb412('0xb')),'defaultValue':_0xb412('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 6998e16..1e1b8b4 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 _0x327a=['count','includeAll','include','findAll','show','params','keys','length','options','find','body','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','internal','rejectmessage','toString','server','files','join','message-%s.eml','from','subject','createdAt','Attachment','Attachments','decode','bcc','headers','basename','existsSync','push','readFileSync','build','writeFileSync','download','unlinkSync','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','catch','status','json','offset','limit','set','update','destroy','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','nolimit','sort','where','filters','filter','merge','MailMessage'];(function(_0x5ed7cd,_0x5b57cb){var _0x2c8c9e=function(_0xe4e51d){while(--_0xe4e51d){_0x5ed7cd['push'](_0x5ed7cd['shift']());}};_0x2c8c9e(++_0x5b57cb);}(_0x327a,0x1ac));var _0xa327=function(_0x2cccc3,_0x507419){_0x2cccc3=_0x2cccc3-0x0;var _0x279671=_0x327a[_0x2cccc3];return _0x279671;};'use strict';var emlformat=require('eml-format');var moment=require(_0xa327('0x0'));var BPromise=require(_0xa327('0x1'));var util=require(_0xa327('0x2'));var path=require(_0xa327('0x3'));var fs=require('fs');var _=require(_0xa327('0x4'));var Redis=require(_0xa327('0x5'));var htmlToText=require(_0xa327('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xa327('0x7'))(_0xa327('0x8'));var interaction_log=require(_0xa327('0x7'))('mail-interactions');var config=require(_0xa327('0x9'));var db=require(_0xa327('0xa'))['db'];config[_0xa327('0xb')]=_[_0xa327('0xc')](config['redis'],{'host':_0xa327('0xd'),'port':0x18eb});var socket=require(_0xa327('0xe'))(new Redis(config['redis']));var htmlEntities=require(_0xa327('0xf'));require(_0xa327('0x10'))[_0xa327('0x11')](socket);var jayson=require(_0xa327('0x12'));var client=jayson[_0xa327('0x13')]['http']({'port':0x232c});var client9003=jayson['client'][_0xa327('0x14')]({'port':0x232b});var client9002=jayson[_0xa327('0x13')][_0xa327('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x3daca0,_0x10ebb7,_0x136829,_0x309910){return new BPromise(function(_0x21abcb,_0x4ad1ed){var _0x5a3cdc=_0x309910||client;return _0x5a3cdc[_0xa327('0x15')](_0x3daca0,_0x136829)[_0xa327('0x16')](function(_0x42169a){logger[_0xa327('0x17')]('MailMessage,\x20%s,\x20%s',_0x10ebb7,_0xa327('0x18'));logger[_0xa327('0x19')](_0xa327('0x1a'),_0x10ebb7,_0xa327('0x18'),JSON[_0xa327('0x1b')](_0x42169a));if(_0x42169a[_0xa327('0x1c')]){if(_0x42169a[_0xa327('0x1c')][_0xa327('0x1d')]===0x1f4){logger[_0xa327('0x1c')]('MailMessage,\x20%s,\x20%s',_0x10ebb7,_0x42169a[_0xa327('0x1c')][_0xa327('0x1e')]);return _0x4ad1ed(_0x42169a[_0xa327('0x1c')][_0xa327('0x1e')]);}logger[_0xa327('0x1c')](_0xa327('0x1f'),_0x10ebb7,_0x42169a['error'][_0xa327('0x1e')]);return _0x21abcb(_0x42169a[_0xa327('0x1c')][_0xa327('0x1e')]);}else{logger[_0xa327('0x17')](_0xa327('0x1f'),_0x10ebb7,_0xa327('0x18'));_0x21abcb(_0x42169a[_0xa327('0x20')][_0xa327('0x1e')]);}})[_0xa327('0x21')](function(_0x41b019){logger['error']('MailMessage,\x20%s,\x20%s',_0x10ebb7,_0x41b019);_0x4ad1ed(_0x41b019);});});}function respondWithResult(_0x4de75d,_0x43b8db){_0x43b8db=_0x43b8db||0xc8;return function(_0x2e2f45){if(_0x2e2f45){return _0x4de75d[_0xa327('0x22')](_0x43b8db)[_0xa327('0x23')](_0x2e2f45);}};}function respondWithFilteredResult(_0x3870de,_0x1573ec){return function(_0x5b966f){if(_0x5b966f){var _0xc62cd=typeof _0x1573ec[_0xa327('0x24')]==='undefined'&&typeof _0x1573ec['limit']==='undefined';var _0x1cb7b0=_0x5b966f['count'];var _0x4daeb5=_0xc62cd?0x0:_0x1573ec[_0xa327('0x24')];var _0x1b18a6=_0xc62cd?_0x5b966f['count']:_0x1573ec['offset']+_0x1573ec[_0xa327('0x25')];var _0x1e3800;if(_0x1b18a6>=_0x1cb7b0){_0x1b18a6=_0x1cb7b0;_0x1e3800=0xc8;}else{_0x1e3800=0xce;}_0x3870de[_0xa327('0x22')](_0x1e3800);return _0x3870de[_0xa327('0x26')]('Content-Range',_0x4daeb5+'-'+_0x1b18a6+'/'+_0x1cb7b0)[_0xa327('0x23')](_0x5b966f);}return null;};}function saveUpdates(_0x45d47e){return function(_0x3b2746){if(_0x3b2746){return _0x3b2746[_0xa327('0x27')](_0x45d47e)[_0xa327('0x16')](function(_0xb989c9){return _0xb989c9;});}return null;};}function removeEntity(_0x5d99fe){return function(_0x348f3e){if(_0x348f3e){return _0x348f3e[_0xa327('0x28')]()[_0xa327('0x16')](function(){_0x5d99fe[_0xa327('0x22')](0xcc)[_0xa327('0x29')]();});}};}function handleEntityNotFound(_0x2898a3){return function(_0x225938){if(!_0x225938){_0x2898a3[_0xa327('0x2a')](0x194);}return _0x225938;};}function handleError(_0x3e767e,_0xc42359){_0xc42359=_0xc42359||0x1f4;return function(_0x2b2d8c){logger['error'](_0x2b2d8c[_0xa327('0x2b')]);if(_0x2b2d8c[_0xa327('0x2c')]){delete _0x2b2d8c['name'];}_0x3e767e['status'](_0xc42359)[_0xa327('0x2d')](_0x2b2d8c);};}exports[_0xa327('0x2e')]=function(_0x2cecf7,_0x204360){var _0x55b70a={},_0x36ba43={},_0x591088={'count':0x0,'rows':[]};var _0x482769=_['map'](db['MailMessage'][_0xa327('0x2f')],function(_0x457dd6){return{'name':_0x457dd6[_0xa327('0x30')],'type':_0x457dd6[_0xa327('0x31')][_0xa327('0x32')]};});_0x36ba43[_0xa327('0x33')]=_[_0xa327('0x34')](_0x482769,'name');_0x36ba43['query']=_['keys'](_0x2cecf7[_0xa327('0x35')]);_0x36ba43['filters']=_[_0xa327('0x36')](_0x36ba43[_0xa327('0x33')],_0x36ba43[_0xa327('0x35')]);_0x55b70a[_0xa327('0x37')]=_[_0xa327('0x36')](_0x36ba43[_0xa327('0x33')],qs['fields'](_0x2cecf7[_0xa327('0x35')][_0xa327('0x38')]));_0x55b70a['attributes']=_0x55b70a['attributes']['length']?_0x55b70a[_0xa327('0x37')]:_0x36ba43[_0xa327('0x33')];if(!_0x2cecf7[_0xa327('0x35')]['hasOwnProperty'](_0xa327('0x39'))){_0x55b70a[_0xa327('0x25')]=qs[_0xa327('0x25')](_0x2cecf7[_0xa327('0x35')]['limit']);_0x55b70a[_0xa327('0x24')]=qs[_0xa327('0x24')](_0x2cecf7[_0xa327('0x35')]['offset']);}_0x55b70a['order']=qs[_0xa327('0x3a')](_0x2cecf7[_0xa327('0x35')]['sort']);_0x55b70a[_0xa327('0x3b')]=qs['filters'](_['pick'](_0x2cecf7[_0xa327('0x35')],_0x36ba43[_0xa327('0x3c')]),_0x482769);if(_0x2cecf7[_0xa327('0x35')][_0xa327('0x3d')]){_0x55b70a[_0xa327('0x3b')]=_[_0xa327('0x3e')](_0x55b70a[_0xa327('0x3b')],{'$or':_['map'](_0x482769,function(_0x5d0437){if(_0x5d0437[_0xa327('0x31')]!=='VIRTUAL'){var _0x2db67a={};_0x2db67a[_0x5d0437[_0xa327('0x2c')]]={'$like':'%'+_0x2cecf7[_0xa327('0x35')][_0xa327('0x3d')]+'%'};return _0x2db67a;}})});}_0x55b70a=_['merge']({},_0x55b70a,_0x2cecf7['options']);var _0x1bd756={'where':_0x55b70a[_0xa327('0x3b')]};return db[_0xa327('0x3f')][_0xa327('0x40')](_0x1bd756)['then'](function(_0x2f16da){_0x591088[_0xa327('0x40')]=_0x2f16da;if(_0x2cecf7[_0xa327('0x35')][_0xa327('0x41')]){_0x55b70a[_0xa327('0x42')]=[{'all':!![]}];}return db[_0xa327('0x3f')][_0xa327('0x43')](_0x55b70a);})[_0xa327('0x16')](function(_0x193135){_0x591088['rows']=_0x193135;return _0x591088;})[_0xa327('0x16')](respondWithFilteredResult(_0x204360,_0x55b70a))[_0xa327('0x21')](handleError(_0x204360,null));};exports[_0xa327('0x44')]=function(_0x19e1d6,_0x3713a4){var _0x276585={'raw':!![],'where':{'id':_0x19e1d6[_0xa327('0x45')]['id']}},_0x5d74fc={};_0x5d74fc[_0xa327('0x33')]=_['keys'](db[_0xa327('0x3f')][_0xa327('0x2f')]);_0x5d74fc[_0xa327('0x35')]=_[_0xa327('0x46')](_0x19e1d6[_0xa327('0x35')]);_0x5d74fc['filters']=_[_0xa327('0x36')](_0x5d74fc['model'],_0x5d74fc[_0xa327('0x35')]);_0x276585[_0xa327('0x37')]=_[_0xa327('0x36')](_0x5d74fc['model'],qs[_0xa327('0x38')](_0x19e1d6[_0xa327('0x35')][_0xa327('0x38')]));_0x276585[_0xa327('0x37')]=_0x276585[_0xa327('0x37')][_0xa327('0x47')]?_0x276585[_0xa327('0x37')]:_0x5d74fc['model'];if(_0x19e1d6[_0xa327('0x35')][_0xa327('0x41')]){_0x276585[_0xa327('0x42')]=[{'all':!![]}];}_0x276585=_['merge']({},_0x276585,_0x19e1d6[_0xa327('0x48')]);return db[_0xa327('0x3f')][_0xa327('0x49')](_0x276585)[_0xa327('0x16')](handleEntityNotFound(_0x3713a4,null))[_0xa327('0x16')](respondWithResult(_0x3713a4,null))[_0xa327('0x21')](handleError(_0x3713a4,null));};exports['update']=function(_0x1b28ab,_0x4f08aa){if(_0x1b28ab[_0xa327('0x4a')]['id']){delete _0x1b28ab[_0xa327('0x4a')]['id'];}return db[_0xa327('0x3f')][_0xa327('0x49')]({'where':{'id':_0x1b28ab[_0xa327('0x45')]['id']}})[_0xa327('0x16')](handleEntityNotFound(_0x4f08aa,null))[_0xa327('0x16')](saveUpdates(_0x1b28ab[_0xa327('0x4a')],null))[_0xa327('0x16')](respondWithResult(_0x4f08aa,null))[_0xa327('0x21')](handleError(_0x4f08aa,null));};exports[_0xa327('0x28')]=function(_0x10eac9,_0x3f58c9){return db[_0xa327('0x3f')]['find']({'where':{'id':_0x10eac9[_0xa327('0x45')]['id']}})[_0xa327('0x16')](handleEntityNotFound(_0x3f58c9,null))['then'](removeEntity(_0x3f58c9,null))[_0xa327('0x21')](handleError(_0x3f58c9,null));};exports['describe']=function(_0x136151,_0x1b1f7c){return db[_0xa327('0x3f')]['describe']()[_0xa327('0x16')](respondWithResult(_0x1b1f7c,null))[_0xa327('0x21')](handleError(_0x1b1f7c,null));};exports[_0xa327('0x4b')]=function(_0x2d53a5,_0x19ce06){return db[_0xa327('0x3f')][_0xa327('0x4b')](_0x2d53a5['body'])[_0xa327('0x16')](function(_0x5ce357){if(_0x5ce357){if(_0x5ce357[_0xa327('0x4c')]===_0xa327('0x4d')&&!_0x5ce357[_0xa327('0x4e')]){var _0x37a030,_0x2f7e95,_0x42341c;if(_0x2d53a5[_0xa327('0x4a')]['to']){_0x2f7e95=_0x2d53a5['body']['to'][_0xa327('0x4f')](',')[0x0];}return db[_0xa327('0x50')][_0xa327('0x51')]({'where':{'id':_0x5ce357[_0xa327('0x52')]},'include':[{'model':db[_0xa327('0x53')],'as':_0xa327('0x54'),'include':[{'model':db[_0xa327('0x55')],'as':_0xa327('0x56'),'where':{'email':_0x2f7e95},'limit':0x1,'order':[[_0xa327('0x57'),'DESC']]}]},{'model':db[_0xa327('0x58')],'as':_0xa327('0x59'),'raw':!![],'include':[{'model':db[_0xa327('0x5a')],'as':_0xa327('0x5a'),'raw':!![]}]}]})[_0xa327('0x16')](function(_0x10a17d){_0x37a030=_0x10a17d;if(!_0x37a030||!_0x37a030['Smtp'])return;var _0x2ce6e2=_0x37a030[_0xa327('0x5b')]();if(_0x2d53a5['body'][_0xa327('0x5c')]&&_0x2d53a5[_0xa327('0x4a')][_0xa327('0x5c')][_0xa327('0x47')]){for(var _0x4e7737=0x0;_0x4e7737<_0x2d53a5[_0xa327('0x4a')][_0xa327('0x5c')][_0xa327('0x47')];_0x4e7737+=0x1){_0x2d53a5[_0xa327('0x4a')]['attachments'][_0x4e7737]={'filename':_0x2d53a5[_0xa327('0x4a')][_0xa327('0x5c')][_0x4e7737][_0xa327('0x2c')],'path':path['join'](config[_0xa327('0x5d')],_0xa327('0x5e'),_0x2d53a5['body'][_0xa327('0x5c')][_0x4e7737]['basename'])};}}_0x42341c={'account':_0x2ce6e2,'message':_0x2d53a5['body']};return;})[_0xa327('0x16')](function(){if(_0x37a030['List']){if(_0x37a030[_0xa327('0x54')][_0xa327('0x56')]['length']){return _0x37a030[_0xa327('0x54')][_0xa327('0x56')][0x0];}else{return db[_0xa327('0x55')][_0xa327('0x4b')](_[_0xa327('0xc')](_0x2d53a5[_0xa327('0x4a')],{'firstName':_0x2d53a5[_0xa327('0x4a')]['to'],'email':_0x2d53a5[_0xa327('0x4a')]['to'],'phone':_0x2d53a5[_0xa327('0x4a')]['to'],'ListId':_0x37a030[_0xa327('0x5f')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x42341c){return respondWithRpcPromise(_0xa327('0x60'),_0xa327('0x61'),_0x42341c,client9003)[_0xa327('0x16')](function(_0x2fae48){return _0x5ce357[_0xa327('0x27')]({'read':!![],'messageId':_0x2fae48[_0xa327('0x62')],'sentAt':moment()[_0xa327('0x63')](_0xa327('0x64'))});})[_0xa327('0x21')](function(_0x4f90e0){logger['error']('%s',JSON['stringify'](_0x4f90e0));return _0x5ce357;});}return _0x5ce357;});}return _0x5ce357;}})[_0xa327('0x16')](respondWithResult(_0x19ce06,0xc9))['catch'](handleError(_0x19ce06,null));};exports[_0xa327('0x65')]=function(_0x7e2669,_0x441343){var _0x2f0f77={'agent':{},'channel':'mail'};if(_0x7e2669[_0xa327('0x4a')]['id']){delete _0x7e2669[_0xa327('0x4a')]['id'];}_0x7e2669[_0xa327('0x4a')][_0xa327('0x66')]=!![];_0x7e2669[_0xa327('0x4a')][_0xa327('0x67')]=moment()[_0xa327('0x63')](_0xa327('0x64'));_0x7e2669['body']['UserId']=_0x7e2669[_0xa327('0x4a')][_0xa327('0x68')]||_0x7e2669['user']['id'];_0x2f0f77['agent']['id']=_0x7e2669[_0xa327('0x4a')][_0xa327('0x68')];return db[_0xa327('0x3f')][_0xa327('0x49')]({'where':{'id':_0x7e2669[_0xa327('0x45')]['id'],'UserId':null}})[_0xa327('0x16')](handleEntityNotFound(_0x441343,null))['then'](saveUpdates(_0x7e2669[_0xa327('0x4a')],null))['then'](function(_0x4528bf){if(_0x4528bf){_0x2f0f77[_0xa327('0x1e')]=_0x4528bf[_0xa327('0x69')]({'plain':!![]});return db[_0xa327('0x6a')][_0xa327('0x49')]({'where':{'id':_0x4528bf[_0xa327('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x441343,null))[_0xa327('0x16')](function(_0x1cd4c8){if(_0x1cd4c8){return _0x1cd4c8[_0xa327('0x27')]({'UserId':_0x7e2669['body'][_0xa327('0x68')],'read1stAt':_[_0xa327('0x6c')](_0x1cd4c8[_0xa327('0x6d')])?moment()['format'](_0xa327('0x64')):undefined});}return null;})[_0xa327('0x16')](function(_0xda7de){if(_0xda7de){_0x2f0f77[_0xa327('0x6e')]=_0xda7de[_0xa327('0x69')]({'plain':!![]});interaction_log[_0xa327('0x17')](_0xa327('0x6f'),_0x7e2669[_0xa327('0x70')]['id'],_0x7e2669[_0xa327('0x70')]['name'],_0x7e2669['user'][_0xa327('0x71')],_0x2f0f77['interaction']['id'],_0x7e2669[_0xa327('0x4a')]?JSON[_0xa327('0x1b')](_0x7e2669['body']):_0xa327('0x72'));return respondWithRpcPromise(_0xa327('0x73'),_0xa327('0x74'),_0x2f0f77);}return null;})[_0xa327('0x16')](function(_0x514e38){var _0x1f2a50=_0xa327('0x75')+_0x514e38[_0xa327('0x1e')][_0xa327('0x76')];return db[_0xa327('0x77')][_0xa327('0x35')](_0x1f2a50,{'type':db[_0xa327('0x78')][_0xa327('0x79')][_0xa327('0x7a')],'raw':!![]})[_0xa327('0x16')](function(_0x2fffcd){return _0x2fffcd;});})[_0xa327('0x16')](function(_0x534749){if(_0x534749){_0x2f0f77['message'][_0xa327('0x7b')]=_0x534749[0x0];if(!_0x7e2669[_0xa327('0x4a')][_0xa327('0x68')])return;return db[_0xa327('0x7c')][_0xa327('0x49')]({'where':{'id':_0x7e2669[_0xa327('0x4a')]['UserId'],'role':_0xa327('0x7d')},'attributes':['id','name',_0xa327('0x7e'),_0xa327('0x7f'),'internal'],'raw':!![]});}return null;})[_0xa327('0x16')](function(_0x50d42e){if(!_0x50d42e)return null;_0x2f0f77[_0xa327('0x1e')][_0xa327('0x7d')]=_0x50d42e;return _0x2f0f77;})[_0xa327('0x16')](function(_0x42927a){if(_0x42927a){if(_0x7e2669['body'][_0xa327('0x80')]){_0x2f0f77[_0xa327('0x1e')][_0xa327('0x81')]=util[_0xa327('0x63')](_0xa327('0x82'),_0x7e2669[_0xa327('0x70')][_0xa327('0x2c')]);_0x2f0f77[_0xa327('0x1e')][_0xa327('0x83')]=_0x2f0f77[_0xa327('0x83')];_0x2f0f77['message'][_0xa327('0x84')]=_0x2f0f77[_0xa327('0x83')];_0x2f0f77[_0xa327('0x1e')][_0xa327('0x85')]=_0xa327('0x65');_0x2f0f77[_0xa327('0x1e')][_0xa327('0x4a')]=htmlToText[_0xa327('0x86')](_0x2f0f77['message'][_0xa327('0x4a')]);return respondWithRpcPromise(_0xa327('0x87'),'EventManager',{'event':_0xa327('0x88'),'message':_0x2f0f77[_0xa327('0x1e')]},client9002)['then'](function(){return _0x2f0f77;});}return _0x2f0f77;}return null;})[_0xa327('0x16')](respondWithResult(_0x441343,null))['catch'](handleError(_0x441343,null));};exports[_0xa327('0x89')]=function(_0x106430,_0x4aafe3){var _0x348dc3={'agent':{},'channel':_0xa327('0x8a')};if(_0x106430[_0xa327('0x4a')]['id']){delete _0x106430[_0xa327('0x4a')]['id'];}_0x106430[_0xa327('0x4a')][_0xa327('0x68')]=_0x106430['body'][_0xa327('0x68')]||_0x106430['user']['id'];_0x348dc3[_0xa327('0x7d')]['id']=_0x106430[_0xa327('0x4a')][_0xa327('0x68')];return db[_0xa327('0x3f')][_0xa327('0x49')]({'where':{'id':_0x106430[_0xa327('0x45')]['id'],'UserId':null}})[_0xa327('0x16')](handleEntityNotFound(_0x4aafe3,null))[_0xa327('0x16')](function(_0x402f70){if(_0x402f70){_0x348dc3[_0xa327('0x1e')]=_0x402f70[_0xa327('0x69')]({'plain':!![]});return db[_0xa327('0x6a')][_0xa327('0x49')]({'where':{'id':_0x402f70[_0xa327('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x4aafe3,null))['then'](function(_0xd08c5b){if(_0xd08c5b){_0x348dc3[_0xa327('0x6e')]=_0xd08c5b[_0xa327('0x69')]({'plain':!![]});interaction_log[_0xa327('0x17')](_0xa327('0x8b'),_0x106430[_0xa327('0x70')]['id'],_0x106430['user'][_0xa327('0x2c')],_0x106430[_0xa327('0x70')][_0xa327('0x71')],_0x348dc3[_0xa327('0x6e')]['id'],_0x106430['body']?JSON[_0xa327('0x1b')](_0x106430[_0xa327('0x4a')]):_0xa327('0x72'));return respondWithRpcPromise(_0xa327('0x8c'),'rejectMessage',_0x348dc3);}return null;})[_0xa327('0x16')](function(_0x474425){var _0x431783=_0xa327('0x75')+_0x474425[_0xa327('0x1e')][_0xa327('0x76')];return db[_0xa327('0x77')][_0xa327('0x35')](_0x431783,{'type':db[_0xa327('0x78')][_0xa327('0x79')][_0xa327('0x7a')],'raw':!![]})[_0xa327('0x16')](function(_0xd0eff7){return _0xd0eff7;});})[_0xa327('0x16')](function(_0x5665f2){if(_0x5665f2){_0x348dc3[_0xa327('0x1e')][_0xa327('0x7b')]=_0x5665f2[0x0];if(!_0x106430[_0xa327('0x4a')]['UserId'])return;return db[_0xa327('0x7c')][_0xa327('0x49')]({'where':{'id':_0x106430[_0xa327('0x4a')][_0xa327('0x68')],'role':_0xa327('0x7d')},'attributes':['id',_0xa327('0x2c'),_0xa327('0x7e'),'email',_0xa327('0x8d')],'raw':!![]});}return null;})['then'](function(_0x30b651){if(!_0x30b651)return null;_0x348dc3[_0xa327('0x1e')][_0xa327('0x7d')]=_0x30b651;return _0x348dc3;})['then'](function(_0x4e3ae0){if(_0x4e3ae0){_0x4e3ae0['message'][_0xa327('0x81')]=util[_0xa327('0x63')](_0xa327('0x82'),_0x106430['user'][_0xa327('0x2c')]);_0x4e3ae0[_0xa327('0x1e')][_0xa327('0x83')]=_0x348dc3['channel'];_0x4e3ae0[_0xa327('0x1e')][_0xa327('0x84')]=_0x348dc3['channel'];_0x4e3ae0[_0xa327('0x1e')][_0xa327('0x85')]=_0xa327('0x89');_0x4e3ae0[_0xa327('0x1e')][_0xa327('0x4a')]=htmlToText[_0xa327('0x86')](_0x348dc3[_0xa327('0x1e')][_0xa327('0x4a')]);respondWithRpcPromise('EventManager',_0xa327('0x87'),{'event':_0xa327('0x8e'),'message':_0x4e3ae0[_0xa327('0x1e')]},client9002);return _0x348dc3;}return null;})[_0xa327('0x16')](respondWithResult(_0x4aafe3,null))[_0xa327('0x21')](handleError(_0x4aafe3,null));};exports['download']=function(_0x364ee0,_0x1939fe){var _0x3f2a2f=moment()['unix']()[_0xa327('0x8f')]();var _0x59434f=path['join'](config[_0xa327('0x5d')],_0xa327('0x90'),_0xa327('0x91'),'tmp');var _0x3bdd49=path[_0xa327('0x92')](config[_0xa327('0x5d')],_0xa327('0x90'),'files',_0xa327('0x5c'));var _0x45311e=util[_0xa327('0x63')](_0xa327('0x93'),_0x3f2a2f);return db['MailMessage']['find']({'where':{'id':_0x364ee0['params']['id']},'attributes':['id','body',_0xa327('0x94'),'to','cc','bcc',_0xa327('0x95'),_0xa327('0x96')],'include':_0x364ee0['query']['attachments']?[{'model':db[_0xa327('0x97')],'as':_0xa327('0x98')}]:undefined})[_0xa327('0x16')](handleEntityNotFound(_0x1939fe,null))[_0xa327('0x16')](function(_0x28c683){if(_0x28c683){var _0x24a096=_0x28c683;var _0x2b485d={'from':_0x24a096[_0xa327('0x94')],'to':_0x24a096['to'],'subject':_0x24a096['subject'],'html':htmlEntities[_0xa327('0x99')](_0x24a096[_0xa327('0x4a')]),'headers':{'Date':moment(_0x24a096['createdAt'])[_0xa327('0x63')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x28c683['cc']){_0x2b485d['headers']['Cc']=_0x28c683['cc'];}if(_0x28c683[_0xa327('0x9a')]){_0x2b485d[_0xa327('0x9b')]['Bcc']=_0x28c683[_0xa327('0x9a')];}return new BPromise(function(_0x417c68,_0x438f8e){if(_0x28c683[_0xa327('0x98')]){for(var _0x54c759=0x0;_0x54c759<_0x28c683[_0xa327('0x98')][_0xa327('0x47')];_0x54c759++){var _0x9c2559=_0x28c683[_0xa327('0x98')][_0x54c759];var _0x361c06=path['join'](_0x3bdd49,_0x9c2559[_0xa327('0x9c')]);if(fs[_0xa327('0x9d')](_0x361c06)){_0x2b485d['attachments'][_0xa327('0x9e')]({'name':_0x9c2559[_0xa327('0x2c')],'contentType':_0x9c2559[_0xa327('0x31')],'data':fs[_0xa327('0x9f')](_0x361c06)});}}}emlformat[_0xa327('0xa0')](_0x2b485d,function(_0x31b114,_0x326a47){if(_0x31b114)return _0x438f8e(_0x31b114);fs[_0xa327('0xa1')](path[_0xa327('0x92')](_0x59434f,_0x45311e),_0x326a47);return _0x417c68(_0x326a47);});});}})[_0xa327('0x16')](function(_0x52feea){if(_0x52feea){return _0x1939fe[_0xa327('0xa2')](path[_0xa327('0x92')](_0x59434f,_0x45311e),_0x45311e,function(_0x316584){if(!_0x316584)fs[_0xa327('0xa3')](path['join'](_0x59434f,_0x45311e));});}})[_0xa327('0x21')](handleError(_0x1939fe,null));}; \ No newline at end of file +var _0xc22b=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','offset','undefined','limit','set','json','destroy','end','sendStatus','name','send','index','map','MailMessage','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','show','params','rawAttributes','options','update','body','find','describe','direction','out','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','create','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','UserId','user','agent','MailInteraction','MailInteractionId','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','mail','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','User','fullname','interface','fromString','unix','toString','server','files','message-%s.eml','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','Bcc','existsSync','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','register','jayson/promise','client','http','request','then'];(function(_0x5c68ed,_0x139fd3){var _0x5cb923=function(_0x4de5b6){while(--_0x4de5b6){_0x5c68ed['push'](_0x5c68ed['shift']());}};_0x5cb923(++_0x139fd3);}(_0xc22b,0x8a));var _0xbc22=function(_0x142acd,_0x2e71fe){_0x142acd=_0x142acd-0x0;var _0x497c02=_0xc22b[_0x142acd];return _0x497c02;};'use strict';var emlformat=require(_0xbc22('0x0'));var moment=require(_0xbc22('0x1'));var BPromise=require(_0xbc22('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xbc22('0x3'));var Redis=require(_0xbc22('0x4'));var htmlToText=require(_0xbc22('0x5'));var qs=require(_0xbc22('0x6'));var logger=require('../../config/logger')(_0xbc22('0x7'));var interaction_log=require(_0xbc22('0x8'))('mail-interactions');var config=require(_0xbc22('0x9'));var db=require(_0xbc22('0xa'))['db'];config['redis']=_[_0xbc22('0xb')](config['redis'],{'host':_0xbc22('0xc'),'port':0x18eb});var socket=require(_0xbc22('0xd'))(new Redis(config[_0xbc22('0xe')]));var htmlEntities=require('html-entities');require(_0xbc22('0xf'))[_0xbc22('0x10')](socket);var jayson=require(_0xbc22('0x11'));var client=jayson[_0xbc22('0x12')][_0xbc22('0x13')]({'port':0x232c});var client9003=jayson[_0xbc22('0x12')][_0xbc22('0x13')]({'port':0x232b});var client9002=jayson[_0xbc22('0x12')][_0xbc22('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x30d59f,_0x144f44,_0x403939,_0x1cfa48){return new BPromise(function(_0x15b1d2,_0x49a91b){var _0x3ac6dc=_0x1cfa48||client;return _0x3ac6dc[_0xbc22('0x14')](_0x30d59f,_0x403939)[_0xbc22('0x15')](function(_0x112adb){logger['info'](_0xbc22('0x16'),_0x144f44,_0xbc22('0x17'));logger[_0xbc22('0x18')](_0xbc22('0x19'),_0x144f44,'request\x20sent',JSON[_0xbc22('0x1a')](_0x112adb));if(_0x112adb[_0xbc22('0x1b')]){if(_0x112adb['error'][_0xbc22('0x1c')]===0x1f4){logger[_0xbc22('0x1b')](_0xbc22('0x16'),_0x144f44,_0x112adb['error'][_0xbc22('0x1d')]);return _0x49a91b(_0x112adb[_0xbc22('0x1b')][_0xbc22('0x1d')]);}logger[_0xbc22('0x1b')](_0xbc22('0x16'),_0x144f44,_0x112adb['error'][_0xbc22('0x1d')]);return _0x15b1d2(_0x112adb[_0xbc22('0x1b')][_0xbc22('0x1d')]);}else{logger[_0xbc22('0x1e')](_0xbc22('0x16'),_0x144f44,_0xbc22('0x17'));_0x15b1d2(_0x112adb[_0xbc22('0x1f')][_0xbc22('0x1d')]);}})[_0xbc22('0x20')](function(_0x25d4df){logger[_0xbc22('0x1b')](_0xbc22('0x16'),_0x144f44,_0x25d4df);_0x49a91b(_0x25d4df);});});}function respondWithResult(_0x314f89,_0xc32f31){_0xc32f31=_0xc32f31||0xc8;return function(_0x37e5a8){if(_0x37e5a8){return _0x314f89[_0xbc22('0x21')](_0xc32f31)['json'](_0x37e5a8);}};}function respondWithFilteredResult(_0x4c25d1,_0x3bca7e){return function(_0x40b2b0){if(_0x40b2b0){var _0x1cc44d=typeof _0x3bca7e[_0xbc22('0x22')]===_0xbc22('0x23')&&typeof _0x3bca7e[_0xbc22('0x24')]===_0xbc22('0x23');var _0x3888a0=_0x40b2b0['count'];var _0x4ac7b6=_0x1cc44d?0x0:_0x3bca7e[_0xbc22('0x22')];var _0x59b164=_0x1cc44d?_0x40b2b0['count']:_0x3bca7e['offset']+_0x3bca7e[_0xbc22('0x24')];var _0x47528e;if(_0x59b164>=_0x3888a0){_0x59b164=_0x3888a0;_0x47528e=0xc8;}else{_0x47528e=0xce;}_0x4c25d1[_0xbc22('0x21')](_0x47528e);return _0x4c25d1[_0xbc22('0x25')]('Content-Range',_0x4ac7b6+'-'+_0x59b164+'/'+_0x3888a0)[_0xbc22('0x26')](_0x40b2b0);}return null;};}function saveUpdates(_0x27be38){return function(_0x40c889){if(_0x40c889){return _0x40c889['update'](_0x27be38)[_0xbc22('0x15')](function(_0x20b374){return _0x20b374;});}return null;};}function removeEntity(_0x1d2ad6){return function(_0x19c2f4){if(_0x19c2f4){return _0x19c2f4[_0xbc22('0x27')]()[_0xbc22('0x15')](function(){_0x1d2ad6['status'](0xcc)[_0xbc22('0x28')]();});}};}function handleEntityNotFound(_0x5ad831){return function(_0x14a2b5){if(!_0x14a2b5){_0x5ad831[_0xbc22('0x29')](0x194);}return _0x14a2b5;};}function handleError(_0xa86dd,_0x11c27f){_0x11c27f=_0x11c27f||0x1f4;return function(_0xaa1713){logger[_0xbc22('0x1b')](_0xaa1713['stack']);if(_0xaa1713[_0xbc22('0x2a')]){delete _0xaa1713[_0xbc22('0x2a')];}_0xa86dd[_0xbc22('0x21')](_0x11c27f)[_0xbc22('0x2b')](_0xaa1713);};}exports[_0xbc22('0x2c')]=function(_0x4a7887,_0x50e81a){var _0x3480af={},_0x1a13c4={},_0x27f973={'count':0x0,'rows':[]};var _0x12131a=_[_0xbc22('0x2d')](db[_0xbc22('0x2e')]['rawAttributes'],function(_0x1ca2a8){return{'name':_0x1ca2a8['fieldName'],'type':_0x1ca2a8[_0xbc22('0x2f')]['key']};});_0x1a13c4['model']=_['map'](_0x12131a,_0xbc22('0x2a'));_0x1a13c4[_0xbc22('0x30')]=_[_0xbc22('0x31')](_0x4a7887[_0xbc22('0x30')]);_0x1a13c4[_0xbc22('0x32')]=_[_0xbc22('0x33')](_0x1a13c4[_0xbc22('0x34')],_0x1a13c4[_0xbc22('0x30')]);_0x3480af['attributes']=_[_0xbc22('0x33')](_0x1a13c4['model'],qs[_0xbc22('0x35')](_0x4a7887[_0xbc22('0x30')][_0xbc22('0x35')]));_0x3480af[_0xbc22('0x36')]=_0x3480af['attributes'][_0xbc22('0x37')]?_0x3480af[_0xbc22('0x36')]:_0x1a13c4['model'];if(!_0x4a7887[_0xbc22('0x30')][_0xbc22('0x38')](_0xbc22('0x39'))){_0x3480af[_0xbc22('0x24')]=qs['limit'](_0x4a7887[_0xbc22('0x30')][_0xbc22('0x24')]);_0x3480af[_0xbc22('0x22')]=qs['offset'](_0x4a7887[_0xbc22('0x30')]['offset']);}_0x3480af[_0xbc22('0x3a')]=qs['sort'](_0x4a7887['query'][_0xbc22('0x3b')]);_0x3480af[_0xbc22('0x3c')]=qs[_0xbc22('0x32')](_[_0xbc22('0x3d')](_0x4a7887[_0xbc22('0x30')],_0x1a13c4[_0xbc22('0x32')]),_0x12131a);if(_0x4a7887['query'][_0xbc22('0x3e')]){_0x3480af[_0xbc22('0x3c')]=_[_0xbc22('0x3f')](_0x3480af[_0xbc22('0x3c')],{'$or':_['map'](_0x12131a,function(_0x6208e8){if(_0x6208e8['type']!==_0xbc22('0x40')){var _0x2a707b={};_0x2a707b[_0x6208e8['name']]={'$like':'%'+_0x4a7887[_0xbc22('0x30')]['filter']+'%'};return _0x2a707b;}})});}_0x3480af=_[_0xbc22('0x3f')]({},_0x3480af,_0x4a7887['options']);var _0x400b15={'where':_0x3480af[_0xbc22('0x3c')]};return db[_0xbc22('0x2e')]['count'](_0x400b15)[_0xbc22('0x15')](function(_0x1df003){_0x27f973[_0xbc22('0x41')]=_0x1df003;if(_0x4a7887[_0xbc22('0x30')][_0xbc22('0x42')]){_0x3480af[_0xbc22('0x43')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x3480af);})[_0xbc22('0x15')](function(_0x4760f0){_0x27f973['rows']=_0x4760f0;return _0x27f973;})['then'](respondWithFilteredResult(_0x50e81a,_0x3480af))[_0xbc22('0x20')](handleError(_0x50e81a,null));};exports[_0xbc22('0x44')]=function(_0x56bc07,_0x220a32){var _0x44c3ee={'raw':!![],'where':{'id':_0x56bc07[_0xbc22('0x45')]['id']}},_0x214a95={};_0x214a95['model']=_[_0xbc22('0x31')](db['MailMessage'][_0xbc22('0x46')]);_0x214a95[_0xbc22('0x30')]=_[_0xbc22('0x31')](_0x56bc07['query']);_0x214a95[_0xbc22('0x32')]=_[_0xbc22('0x33')](_0x214a95[_0xbc22('0x34')],_0x214a95['query']);_0x44c3ee[_0xbc22('0x36')]=_[_0xbc22('0x33')](_0x214a95['model'],qs[_0xbc22('0x35')](_0x56bc07[_0xbc22('0x30')][_0xbc22('0x35')]));_0x44c3ee['attributes']=_0x44c3ee[_0xbc22('0x36')]['length']?_0x44c3ee['attributes']:_0x214a95[_0xbc22('0x34')];if(_0x56bc07[_0xbc22('0x30')][_0xbc22('0x42')]){_0x44c3ee['include']=[{'all':!![]}];}_0x44c3ee=_['merge']({},_0x44c3ee,_0x56bc07[_0xbc22('0x47')]);return db[_0xbc22('0x2e')]['find'](_0x44c3ee)['then'](handleEntityNotFound(_0x220a32,null))[_0xbc22('0x15')](respondWithResult(_0x220a32,null))[_0xbc22('0x20')](handleError(_0x220a32,null));};exports[_0xbc22('0x48')]=function(_0x3ddbe3,_0x100bd7){if(_0x3ddbe3['body']['id']){delete _0x3ddbe3['body']['id'];}return db['MailMessage']['find']({'where':{'id':_0x3ddbe3[_0xbc22('0x45')]['id']}})[_0xbc22('0x15')](handleEntityNotFound(_0x100bd7,null))['then'](saveUpdates(_0x3ddbe3[_0xbc22('0x49')],null))['then'](respondWithResult(_0x100bd7,null))[_0xbc22('0x20')](handleError(_0x100bd7,null));};exports[_0xbc22('0x27')]=function(_0x232207,_0x58a3ab){return db[_0xbc22('0x2e')][_0xbc22('0x4a')]({'where':{'id':_0x232207[_0xbc22('0x45')]['id']}})['then'](handleEntityNotFound(_0x58a3ab,null))[_0xbc22('0x15')](removeEntity(_0x58a3ab,null))[_0xbc22('0x20')](handleError(_0x58a3ab,null));};exports['describe']=function(_0x319896,_0x5ccfba){return db['MailMessage'][_0xbc22('0x4b')]()[_0xbc22('0x15')](respondWithResult(_0x5ccfba,null))['catch'](handleError(_0x5ccfba,null));};exports['create']=function(_0x1bb0c9,_0x2c591d){return db[_0xbc22('0x2e')]['create'](_0x1bb0c9['body'])[_0xbc22('0x15')](function(_0x30fc8c){if(_0x30fc8c){if(_0x30fc8c[_0xbc22('0x4c')]===_0xbc22('0x4d')&&!_0x30fc8c['secret']){var _0x4267bd,_0x12e4b8,_0x1e4e9e;if(_0x1bb0c9[_0xbc22('0x49')]['to']){_0x12e4b8=_0x1bb0c9['body']['to'][_0xbc22('0x4e')](',')[0x0];}return db[_0xbc22('0x4f')][_0xbc22('0x50')]({'where':{'id':_0x30fc8c[_0xbc22('0x51')]},'include':[{'model':db[_0xbc22('0x52')],'as':_0xbc22('0x53'),'include':[{'model':db[_0xbc22('0x54')],'as':_0xbc22('0x55'),'where':{'email':_0x12e4b8},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xbc22('0x56')],'as':_0xbc22('0x57'),'raw':!![],'include':[{'model':db[_0xbc22('0x58')],'as':_0xbc22('0x58'),'raw':!![]}]}]})[_0xbc22('0x15')](function(_0x4b4ac9){_0x4267bd=_0x4b4ac9;if(!_0x4267bd||!_0x4267bd[_0xbc22('0x57')])return;var _0x5df02f=_0x4267bd[_0xbc22('0x59')]();if(_0x1bb0c9[_0xbc22('0x49')][_0xbc22('0x5a')]&&_0x1bb0c9[_0xbc22('0x49')][_0xbc22('0x5a')][_0xbc22('0x37')]){for(var _0x1b0799=0x0;_0x1b0799<_0x1bb0c9[_0xbc22('0x49')]['attachments'][_0xbc22('0x37')];_0x1b0799+=0x1){_0x1bb0c9[_0xbc22('0x49')][_0xbc22('0x5a')][_0x1b0799]={'filename':_0x1bb0c9[_0xbc22('0x49')][_0xbc22('0x5a')][_0x1b0799][_0xbc22('0x2a')],'path':path[_0xbc22('0x5b')](config[_0xbc22('0x5c')],_0xbc22('0x5d'),_0x1bb0c9[_0xbc22('0x49')][_0xbc22('0x5a')][_0x1b0799][_0xbc22('0x5e')])};}}_0x1e4e9e={'account':_0x5df02f,'message':_0x1bb0c9[_0xbc22('0x49')]};return;})[_0xbc22('0x15')](function(){if(_0x4267bd[_0xbc22('0x53')]){if(_0x4267bd[_0xbc22('0x53')][_0xbc22('0x55')]['length']){return _0x4267bd[_0xbc22('0x53')][_0xbc22('0x55')][0x0];}else{return db[_0xbc22('0x54')][_0xbc22('0x5f')](_[_0xbc22('0xb')](_0x1bb0c9[_0xbc22('0x49')],{'firstName':_0x1bb0c9[_0xbc22('0x49')]['to'],'email':_0x1bb0c9['body']['to'],'phone':_0x1bb0c9[_0xbc22('0x49')]['to'],'ListId':_0x4267bd['ListId']}));}}else{throw new Error(_0xbc22('0x60'));}})['then'](function(){if(_0x1e4e9e){return respondWithRpcPromise(_0xbc22('0x61'),_0xbc22('0x62'),_0x1e4e9e,client9003)['then'](function(_0xe85b80){return _0x30fc8c['update']({'read':!![],'messageId':_0xe85b80[_0xbc22('0x63')],'sentAt':moment()[_0xbc22('0x64')](_0xbc22('0x65'))});})[_0xbc22('0x20')](function(_0x52b90b){logger['error']('%s',JSON[_0xbc22('0x1a')](_0x52b90b));return _0x30fc8c;});}return _0x30fc8c;});}return _0x30fc8c;}})[_0xbc22('0x15')](respondWithResult(_0x2c591d,0xc9))[_0xbc22('0x20')](handleError(_0x2c591d,null));};exports[_0xbc22('0x66')]=function(_0x42673d,_0x21d37a){var _0x2f6ed2={'agent':{},'channel':'mail'};if(_0x42673d[_0xbc22('0x49')]['id']){delete _0x42673d[_0xbc22('0x49')]['id'];}_0x42673d[_0xbc22('0x49')][_0xbc22('0x67')]=!![];_0x42673d[_0xbc22('0x49')]['readAt']=moment()[_0xbc22('0x64')](_0xbc22('0x65'));_0x42673d[_0xbc22('0x49')][_0xbc22('0x68')]=_0x42673d[_0xbc22('0x49')][_0xbc22('0x68')]||_0x42673d[_0xbc22('0x69')]['id'];_0x2f6ed2[_0xbc22('0x6a')]['id']=_0x42673d[_0xbc22('0x49')][_0xbc22('0x68')];return db['MailMessage']['find']({'where':{'id':_0x42673d[_0xbc22('0x45')]['id'],'UserId':null}})[_0xbc22('0x15')](handleEntityNotFound(_0x21d37a,null))[_0xbc22('0x15')](saveUpdates(_0x42673d['body'],null))['then'](function(_0x540b8e){if(_0x540b8e){_0x2f6ed2[_0xbc22('0x1d')]=_0x540b8e['get']({'plain':!![]});return db[_0xbc22('0x6b')][_0xbc22('0x4a')]({'where':{'id':_0x540b8e[_0xbc22('0x6c')]}});}return null;})[_0xbc22('0x15')](handleEntityNotFound(_0x21d37a,null))[_0xbc22('0x15')](function(_0xb2d678){if(_0xb2d678){return _0xb2d678[_0xbc22('0x48')]({'UserId':_0x42673d['body'][_0xbc22('0x68')],'read1stAt':_[_0xbc22('0x6d')](_0xb2d678['read1stAt'])?moment()[_0xbc22('0x64')](_0xbc22('0x65')):undefined});}return null;})[_0xbc22('0x15')](function(_0x1a361a){if(_0x1a361a){_0x2f6ed2[_0xbc22('0x6e')]=_0x1a361a['get']({'plain':!![]});interaction_log['info'](_0xbc22('0x6f'),_0x42673d['user']['id'],_0x42673d['user']['name'],_0x42673d[_0xbc22('0x69')]['role'],_0x2f6ed2['interaction']['id'],_0x42673d[_0xbc22('0x49')]?JSON['stringify'](_0x42673d[_0xbc22('0x49')]):_0xbc22('0x70'));return respondWithRpcPromise(_0xbc22('0x71'),'acceptMessage',_0x2f6ed2);}return null;})[_0xbc22('0x15')](function(_0x107123){var _0x5e6b66=_0xbc22('0x72')+_0x107123[_0xbc22('0x1d')]['ContactId'];return db['sequelize'][_0xbc22('0x30')](_0x5e6b66,{'type':db[_0xbc22('0x73')][_0xbc22('0x74')][_0xbc22('0x75')],'raw':!![]})[_0xbc22('0x15')](function(_0x19795e){return _0x19795e;});})[_0xbc22('0x15')](function(_0x2f1948){if(_0x2f1948){_0x2f6ed2['message'][_0xbc22('0x76')]=_0x2f1948[0x0];if(!_0x42673d[_0xbc22('0x49')][_0xbc22('0x68')])return;return db['User'][_0xbc22('0x4a')]({'where':{'id':_0x42673d[_0xbc22('0x49')][_0xbc22('0x68')],'role':'agent'},'attributes':['id','name','fullname',_0xbc22('0x77'),_0xbc22('0x78')],'raw':!![]});}return null;})[_0xbc22('0x15')](function(_0x12781c){if(!_0x12781c)return null;_0x2f6ed2['message'][_0xbc22('0x6a')]=_0x12781c;return _0x2f6ed2;})[_0xbc22('0x15')](function(_0x586baa){if(_0x586baa){if(_0x42673d[_0xbc22('0x49')][_0xbc22('0x79')]){_0x2f6ed2[_0xbc22('0x1d')]['interface']=util[_0xbc22('0x64')](_0xbc22('0x7a'),_0x42673d[_0xbc22('0x69')][_0xbc22('0x2a')]);_0x2f6ed2[_0xbc22('0x1d')][_0xbc22('0x7b')]=_0x2f6ed2['channel'];_0x2f6ed2['message'][_0xbc22('0x7c')]=_0x2f6ed2[_0xbc22('0x7b')];_0x2f6ed2[_0xbc22('0x1d')][_0xbc22('0x7d')]=_0xbc22('0x66');_0x2f6ed2[_0xbc22('0x1d')]['body']=htmlToText['fromString'](_0x2f6ed2['message'][_0xbc22('0x49')]);return respondWithRpcPromise(_0xbc22('0x7e'),'EventManager',{'event':_0xbc22('0x7f'),'message':_0x2f6ed2[_0xbc22('0x1d')]},client9002)[_0xbc22('0x15')](function(){return _0x2f6ed2;});}return _0x2f6ed2;}return null;})[_0xbc22('0x15')](respondWithResult(_0x21d37a,null))[_0xbc22('0x20')](handleError(_0x21d37a,null));};exports[_0xbc22('0x80')]=function(_0x29fa67,_0x337969){var _0x487b88={'agent':{},'channel':_0xbc22('0x81')};if(_0x29fa67['body']['id']){delete _0x29fa67['body']['id'];}_0x29fa67['body'][_0xbc22('0x68')]=_0x29fa67['body'][_0xbc22('0x68')]||_0x29fa67['user']['id'];_0x487b88[_0xbc22('0x6a')]['id']=_0x29fa67[_0xbc22('0x49')][_0xbc22('0x68')];return db[_0xbc22('0x2e')][_0xbc22('0x4a')]({'where':{'id':_0x29fa67[_0xbc22('0x45')]['id'],'UserId':null}})[_0xbc22('0x15')](handleEntityNotFound(_0x337969,null))[_0xbc22('0x15')](function(_0x2dbfe9){if(_0x2dbfe9){_0x487b88['message']=_0x2dbfe9[_0xbc22('0x82')]({'plain':!![]});return db[_0xbc22('0x6b')][_0xbc22('0x4a')]({'where':{'id':_0x2dbfe9[_0xbc22('0x6c')]}});}return null;})[_0xbc22('0x15')](handleEntityNotFound(_0x337969,null))[_0xbc22('0x15')](function(_0x35287f){if(_0x35287f){_0x487b88[_0xbc22('0x6e')]=_0x35287f['get']({'plain':!![]});interaction_log[_0xbc22('0x1e')](_0xbc22('0x83'),_0x29fa67['user']['id'],_0x29fa67[_0xbc22('0x69')][_0xbc22('0x2a')],_0x29fa67[_0xbc22('0x69')][_0xbc22('0x84')],_0x487b88['interaction']['id'],_0x29fa67[_0xbc22('0x49')]?JSON[_0xbc22('0x1a')](_0x29fa67['body']):_0xbc22('0x70'));return respondWithRpcPromise(_0xbc22('0x85'),_0xbc22('0x86'),_0x487b88);}return null;})[_0xbc22('0x15')](function(_0x52d0a2){var _0x4f2876='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x52d0a2[_0xbc22('0x1d')][_0xbc22('0x87')];return db['sequelize'][_0xbc22('0x30')](_0x4f2876,{'type':db[_0xbc22('0x73')][_0xbc22('0x74')][_0xbc22('0x75')],'raw':!![]})['then'](function(_0x37e9a8){return _0x37e9a8;});})[_0xbc22('0x15')](function(_0x3ce214){if(_0x3ce214){_0x487b88[_0xbc22('0x1d')][_0xbc22('0x76')]=_0x3ce214[0x0];if(!_0x29fa67[_0xbc22('0x49')][_0xbc22('0x68')])return;return db[_0xbc22('0x88')][_0xbc22('0x4a')]({'where':{'id':_0x29fa67[_0xbc22('0x49')][_0xbc22('0x68')],'role':_0xbc22('0x6a')},'attributes':['id',_0xbc22('0x2a'),_0xbc22('0x89'),'email','internal'],'raw':!![]});}return null;})[_0xbc22('0x15')](function(_0x1536d7){if(!_0x1536d7)return null;_0x487b88[_0xbc22('0x1d')][_0xbc22('0x6a')]=_0x1536d7;return _0x487b88;})[_0xbc22('0x15')](function(_0x4a1af2){if(_0x4a1af2){_0x4a1af2['message'][_0xbc22('0x8a')]=util[_0xbc22('0x64')](_0xbc22('0x7a'),_0x29fa67[_0xbc22('0x69')][_0xbc22('0x2a')]);_0x4a1af2[_0xbc22('0x1d')][_0xbc22('0x7b')]=_0x487b88[_0xbc22('0x7b')];_0x4a1af2[_0xbc22('0x1d')][_0xbc22('0x7c')]=_0x487b88[_0xbc22('0x7b')];_0x4a1af2[_0xbc22('0x1d')][_0xbc22('0x7d')]=_0xbc22('0x80');_0x4a1af2[_0xbc22('0x1d')][_0xbc22('0x49')]=htmlToText[_0xbc22('0x8b')](_0x487b88[_0xbc22('0x1d')][_0xbc22('0x49')]);respondWithRpcPromise(_0xbc22('0x7e'),_0xbc22('0x7e'),{'event':'rejectmessage','message':_0x4a1af2['message']},client9002);return _0x487b88;}return null;})[_0xbc22('0x15')](respondWithResult(_0x337969,null))[_0xbc22('0x20')](handleError(_0x337969,null));};exports['download']=function(_0x5553ea,_0x312626){var _0x4d828e=moment()[_0xbc22('0x8c')]()[_0xbc22('0x8d')]();var _0x234f8b=path[_0xbc22('0x5b')](config[_0xbc22('0x5c')],_0xbc22('0x8e'),_0xbc22('0x8f'),'tmp');var _0x3be361=path[_0xbc22('0x5b')](config[_0xbc22('0x5c')],_0xbc22('0x8e'),'files',_0xbc22('0x5a'));var _0x42fcba=util[_0xbc22('0x64')](_0xbc22('0x90'),_0x4d828e);return db[_0xbc22('0x2e')]['find']({'where':{'id':_0x5553ea[_0xbc22('0x45')]['id']},'attributes':['id',_0xbc22('0x49'),_0xbc22('0x91'),'to','cc','bcc',_0xbc22('0x92'),_0xbc22('0x93')],'include':_0x5553ea[_0xbc22('0x30')][_0xbc22('0x5a')]?[{'model':db[_0xbc22('0x94')],'as':_0xbc22('0x95')}]:undefined})[_0xbc22('0x15')](handleEntityNotFound(_0x312626,null))['then'](function(_0x1b6d9b){if(_0x1b6d9b){var _0x7c3f98=_0x1b6d9b;var _0x48bb6b={'from':_0x7c3f98[_0xbc22('0x91')],'to':_0x7c3f98['to'],'subject':_0x7c3f98[_0xbc22('0x92')],'html':htmlEntities[_0xbc22('0x96')](_0x7c3f98['body']),'headers':{'Date':moment(_0x7c3f98[_0xbc22('0x93')])[_0xbc22('0x64')](_0xbc22('0x97'))},'attachments':[]};if(_0x1b6d9b['cc']){_0x48bb6b['headers']['Cc']=_0x1b6d9b['cc'];}if(_0x1b6d9b[_0xbc22('0x98')]){_0x48bb6b[_0xbc22('0x99')][_0xbc22('0x9a')]=_0x1b6d9b[_0xbc22('0x98')];}return new BPromise(function(_0x2b0f24,_0x194ad9){if(_0x1b6d9b['Attachments']){for(var _0xc2f631=0x0;_0xc2f631<_0x1b6d9b[_0xbc22('0x95')][_0xbc22('0x37')];_0xc2f631++){var _0x37fa00=_0x1b6d9b[_0xbc22('0x95')][_0xc2f631];var _0x484cc3=path['join'](_0x3be361,_0x37fa00[_0xbc22('0x5e')]);if(fs[_0xbc22('0x9b')](_0x484cc3)){_0x48bb6b[_0xbc22('0x5a')][_0xbc22('0x9c')]({'name':_0x37fa00[_0xbc22('0x2a')],'contentType':_0x37fa00[_0xbc22('0x2f')],'data':fs[_0xbc22('0x9d')](_0x484cc3)});}}}emlformat['build'](_0x48bb6b,function(_0x3a8428,_0x46e6fc){if(_0x3a8428)return _0x194ad9(_0x3a8428);fs[_0xbc22('0x9e')](path[_0xbc22('0x5b')](_0x234f8b,_0x42fcba),_0x46e6fc);return _0x2b0f24(_0x46e6fc);});});}})[_0xbc22('0x15')](function(_0x4c6798){if(_0x4c6798){return _0x312626['download'](path[_0xbc22('0x5b')](_0x234f8b,_0x42fcba),_0x42fcba,function(_0x4a0a10){if(!_0x4a0a10)fs[_0xbc22('0x9f')](path[_0xbc22('0x5b')](_0x234f8b,_0x42fcba));});}})[_0xbc22('0x20')](handleError(_0x312626,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f7a89a0..8837ed4 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 _0x8e46=['emit','hook','exports','events','../../mysqldb','MailMessage','save','update','remove'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0x8e46,0x186));var _0x68e4=function(_0x73b80e,_0x4daa4a){_0x73b80e=_0x73b80e-0x0;var _0x4c31cd=_0x8e46[_0x73b80e];return _0x4c31cd;};'use strict';var EventEmitter=require(_0x68e4('0x0'));var MailMessage=require(_0x68e4('0x1'))['db'][_0x68e4('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x68e4('0x3'),'afterUpdate':_0x68e4('0x4'),'afterDestroy':_0x68e4('0x5')};function emitEvent(_0x24f0c0){return function(_0x3ef839,_0x3ea694,_0x15786a){MailMessageEvents['emit'](_0x24f0c0+':'+_0x3ef839['id'],_0x3ef839);MailMessageEvents[_0x68e4('0x6')](_0x24f0c0,_0x3ef839);_0x15786a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x68e4('0x7')](e,emitEvent(event));}}module[_0x68e4('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x9819=['MailMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x408864,_0x3eb97b){var _0x4dc0cd=function(_0x11cabd){while(--_0x11cabd){_0x408864['push'](_0x408864['shift']());}};_0x4dc0cd(++_0x3eb97b);}(_0x9819,0xf8));var _0x9981=function(_0x525e60,_0x5f2c7b){_0x525e60=_0x525e60-0x0;var _0x47fd49=_0x9819[_0x525e60];return _0x47fd49;};'use strict';var EventEmitter=require(_0x9981('0x0'));var MailMessage=require(_0x9981('0x1'))['db'][_0x9981('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9981('0x3')](0x0);var events={'afterCreate':_0x9981('0x4'),'afterUpdate':_0x9981('0x5'),'afterDestroy':'remove'};function emitEvent(_0x17e29b){return function(_0x34db4d,_0x583eec,_0x5441ba){MailMessageEvents['emit'](_0x17e29b+':'+_0x34db4d['id'],_0x34db4d);MailMessageEvents[_0x9981('0x6')](_0x17e29b,_0x34db4d);_0x5441ba(null);};}for(var e in events){if(events[_0x9981('0x7')](e)){var event=events[e];MailMessage[_0x9981('0x8')](e,emitEvent(event));}}module[_0x9981('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 2aded5f..228d49b 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 _0x7eb2=['body','plainBody','models','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','MailInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT'];(function(_0x27b158,_0x16fcfc){var _0x317116=function(_0x1e4665){while(--_0x1e4665){_0x27b158['push'](_0x27b158['shift']());}};_0x317116(++_0x16fcfc);}(_0x7eb2,0x120));var _0x27eb=function(_0x331b40,_0x3e45b4){_0x331b40=_0x331b40-0x0;var _0x286dbf=_0x7eb2[_0x331b40];return _0x286dbf;};'use strict';var _=require(_0x27eb('0x0'));var util=require('util');var logger=require(_0x27eb('0x1'))(_0x27eb('0x2'));var moment=require(_0x27eb('0x3'));var BPromise=require(_0x27eb('0x4'));var rp=require(_0x27eb('0x5'));var htmlToText=require(_0x27eb('0x6'));var fs=require('fs');var path=require(_0x27eb('0x7'));var rimraf=require(_0x27eb('0x8'));var config=require(_0x27eb('0x9'));var attributes=require(_0x27eb('0xa'));module['exports']=function(_0x484c12,_0x5bb57a){return _0x484c12[_0x27eb('0xb')](_0x27eb('0xc'),attributes,{'tableName':_0x27eb('0xd'),'paranoid':![],'indexes':[{'name':_0x27eb('0xe'),'fields':[_0x27eb('0xe')]},{'name':_0x27eb('0xf'),'fields':['plainBody',_0x27eb('0x10')],'type':_0x27eb('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x10071a,_0x35425c,_0x5a18ee){if(_0x10071a[_0x27eb('0x12')]){_0x10071a[_0x27eb('0x13')]=htmlToText['fromString'](_0x10071a['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5a18ee(null,_0x35425c);},'afterCreate':function(_0x46717f,_0x565fa9,_0x44b561){var _0x32728b=_0x484c12[_0x27eb('0x14')];var _0x2e83a2=_0x46717f[_0x27eb('0x15')]({'plain':!![]});if(_0x2e83a2[_0x27eb('0x16')][_0x27eb('0x17')]()==='in'||_0x2e83a2['direction'][_0x27eb('0x17')]()==='out'&&!_0x2e83a2[_0x27eb('0x18')]&&!_[_0x27eb('0x19')](_0x2e83a2[_0x27eb('0x1a')])){_0x32728b[_0x27eb('0x1b')]['findOne']({'where':{'id':_0x2e83a2[_0x27eb('0x1c')]}})[_0x27eb('0x1d')](function(_0x246262){if(_0x246262){_0x246262['update']({'lastMsgAt':_0x2e83a2[_0x27eb('0x1e')],'lastMsgDirection':_0x2e83a2[_0x27eb('0x16')][_0x27eb('0x17')]()});}})['catch'](function(_0x3761c2){console[_0x27eb('0x1f')](_0x3761c2);});}_0x44b561();}},'charset':_0x27eb('0x20'),'collate':_0x27eb('0x21')});}; \ No newline at end of file +var _0x0d72=['isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','error','utf8mb4','../../config/logger','api','bluebird','html-to-text','path','rimraf','../../config/environment','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','models','get','direction','toLowerCase','out','secret'];(function(_0xfd1fcd,_0x3182b7){var _0x1e0646=function(_0x4f4fa4){while(--_0x4f4fa4){_0xfd1fcd['push'](_0xfd1fcd['shift']());}};_0x1e0646(++_0x3182b7);}(_0x0d72,0x1e5));var _0x20d7=function(_0x4ba798,_0x76a8b2){_0x4ba798=_0x4ba798-0x0;var _0x1238a9=_0x0d72[_0x4ba798];return _0x1238a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x20d7('0x0'))(_0x20d7('0x1'));var moment=require('moment');var BPromise=require(_0x20d7('0x2'));var rp=require('request-promise');var htmlToText=require(_0x20d7('0x3'));var fs=require('fs');var path=require(_0x20d7('0x4'));var rimraf=require(_0x20d7('0x5'));var config=require(_0x20d7('0x6'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x5252c9,_0x463b2e){return _0x5252c9['define']('MailMessage',attributes,{'tableName':_0x20d7('0x7'),'paranoid':![],'indexes':[{'name':_0x20d7('0x8'),'fields':['messageId']},{'name':_0x20d7('0x9'),'fields':[_0x20d7('0xa'),'subject'],'type':_0x20d7('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x375730,_0x246d6f,_0x31f1c3){if(_0x375730[_0x20d7('0xc')]){_0x375730['plainBody']=htmlToText['fromString'](_0x375730['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x31f1c3(null,_0x246d6f);},'afterCreate':function(_0x498fda,_0x1e2453,_0x51a0b1){var _0x4ad3ba=_0x5252c9[_0x20d7('0xd')];var _0x5bc46f=_0x498fda[_0x20d7('0xe')]({'plain':!![]});if(_0x5bc46f[_0x20d7('0xf')][_0x20d7('0x10')]()==='in'||_0x5bc46f['direction']['toLowerCase']()===_0x20d7('0x11')&&!_0x5bc46f[_0x20d7('0x12')]&&!_[_0x20d7('0x13')](_0x5bc46f[_0x20d7('0x14')])){_0x4ad3ba[_0x20d7('0x15')][_0x20d7('0x16')]({'where':{'id':_0x5bc46f[_0x20d7('0x17')]}})[_0x20d7('0x18')](function(_0x2161fc){if(_0x2161fc){_0x2161fc['update']({'lastMsgAt':_0x5bc46f[_0x20d7('0x19')],'lastMsgDirection':_0x5bc46f[_0x20d7('0xf')]['toLowerCase']()});}})['catch'](function(_0xa644d2){console[_0x20d7('0x1a')](_0xa644d2);});}_0x51a0b1();}},'charset':_0x20d7('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index f7d12d4..bd26961 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 _0x3de3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','CreateMailMessage','MailMessage','create','options','catch','lodash','moment','bluebird'];(function(_0x51dbb2,_0x14879e){var _0x505741=function(_0x3cad96){while(--_0x3cad96){_0x51dbb2['push'](_0x51dbb2['shift']());}};_0x505741(++_0x14879e);}(_0x3de3,0x1ce));var _0x33de=function(_0x1b1107,_0x32d735){_0x1b1107=_0x1b1107-0x0;var _0x4a2723=_0x3de3[_0x1b1107];return _0x4a2723;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});config['redis']=_[_0x33de('0xa')](config[_0x33de('0xb')],{'host':_0x33de('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x33de('0xb')]));require(_0x33de('0xd'))[_0x33de('0xe')](socket);function respondWithRpcPromise(_0x5e1be7,_0x2cbf35,_0x348720){return new BPromise(function(_0x8b655d,_0x241211){return client[_0x33de('0xf')](_0x5e1be7,_0x348720)[_0x33de('0x10')](function(_0x8dfa3b){logger[_0x33de('0x11')](_0x33de('0x12'),_0x2cbf35,_0x33de('0x13'));logger[_0x33de('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2cbf35,_0x33de('0x13'),JSON[_0x33de('0x15')](_0x8dfa3b));if(_0x8dfa3b['error']){if(_0x8dfa3b['error'][_0x33de('0x16')]===0x1f4){logger[_0x33de('0x17')](_0x33de('0x12'),_0x2cbf35,_0x8dfa3b[_0x33de('0x17')]['message']);return _0x241211(_0x8dfa3b[_0x33de('0x17')][_0x33de('0x18')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2cbf35,_0x8dfa3b[_0x33de('0x17')][_0x33de('0x18')]);return _0x8b655d(_0x8dfa3b[_0x33de('0x17')]['message']);}else{logger[_0x33de('0x11')](_0x33de('0x12'),_0x2cbf35,'request\x20sent');_0x8b655d(_0x8dfa3b[_0x33de('0x19')][_0x33de('0x18')]);}})['catch'](function(_0x5bb74e){logger[_0x33de('0x17')]('MailMessage,\x20%s,\x20%s',_0x2cbf35,_0x5bb74e);_0x241211(_0x5bb74e);});});}exports[_0x33de('0x1a')]=function(_0x2f0529){var _0x3810b5=this;return new Promise(function(_0x315c9b,_0xc4f1a4){return db[_0x33de('0x1b')][_0x33de('0x1c')](_0x2f0529['body'],{'raw':_0x2f0529['options']?_0x2f0529[_0x33de('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x33de('0x10')](function(_0x4cd8db){logger[_0x33de('0x11')](_0x33de('0x1a'),_0x2f0529);logger['debug'](_0x33de('0x1a'),_0x2f0529,JSON['stringify'](_0x4cd8db));_0x315c9b(_0x4cd8db);})[_0x33de('0x1e')](function(_0x5c602d){logger[_0x33de('0x17')](_0x33de('0x1a'),_0x5c602d[_0x33de('0x18')],_0x2f0529);_0xc4f1a4(_0x3810b5['error'](0x1f4,_0x5c602d[_0x33de('0x18')]));});});}; \ No newline at end of file +var _0x1a85=['info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x1a85,0x178));var _0x51a8=function(_0x77d76e,_0x106ed2){_0x77d76e=_0x77d76e-0x0;var _0x5620c8=_0x1a85[_0x77d76e];return _0x5620c8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});config['redis']=_[_0x51a8('0x8')](config[_0x51a8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x51a8('0xa'))(new Redis(config['redis']));require('./mailMessage.socket')[_0x51a8('0xb')](socket);function respondWithRpcPromise(_0x2f276b,_0x1a476d,_0x45a3f4){return new BPromise(function(_0x418f06,_0x421fa4){return client[_0x51a8('0xc')](_0x2f276b,_0x45a3f4)[_0x51a8('0xd')](function(_0x34c887){logger[_0x51a8('0xe')](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));logger[_0x51a8('0x11')](_0x51a8('0x12'),_0x1a476d,_0x51a8('0x10'),JSON[_0x51a8('0x13')](_0x34c887));if(_0x34c887[_0x51a8('0x14')]){if(_0x34c887['error'][_0x51a8('0x15')]===0x1f4){logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887['error'][_0x51a8('0x16')]);return _0x421fa4(_0x34c887['error'][_0x51a8('0x16')]);}logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);return _0x418f06(_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);}else{logger['info'](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));_0x418f06(_0x34c887[_0x51a8('0x17')][_0x51a8('0x16')]);}})[_0x51a8('0x18')](function(_0x544886){logger['error'](_0x51a8('0xf'),_0x1a476d,_0x544886);_0x421fa4(_0x544886);});});}exports[_0x51a8('0x19')]=function(_0x2217ce){var _0x2f2681=this;return new Promise(function(_0x2a4c4c,_0x3bc044){return db[_0x51a8('0x1a')][_0x51a8('0x1b')](_0x2217ce['body'],{'raw':_0x2217ce[_0x51a8('0x1c')]?_0x2217ce['options'][_0x51a8('0x1d')]===undefined?!![]:![]:!![]})[_0x51a8('0xd')](function(_0x8bda40){logger[_0x51a8('0xe')]('CreateMailMessage',_0x2217ce);logger[_0x51a8('0x11')]('CreateMailMessage',_0x2217ce,JSON['stringify'](_0x8bda40));_0x2a4c4c(_0x8bda40);})[_0x51a8('0x18')](function(_0x52e503){logger[_0x51a8('0x14')](_0x51a8('0x19'),_0x52e503[_0x51a8('0x16')],_0x2217ce);_0x3bc044(_0x2f2681[_0x51a8('0x14')](0x1f4,_0x52e503[_0x51a8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 35e386c..9cc9f1d 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 _0xebec=['length','./mailMessage.events','save','remove','emit','removeListener','register'];(function(_0x1ea73c,_0xdbc112){var _0x55eff4=function(_0x3bf789){while(--_0x3bf789){_0x1ea73c['push'](_0x1ea73c['shift']());}};_0x55eff4(++_0xdbc112);}(_0xebec,0x135));var _0xcebe=function(_0x53d1f5,_0x7a2fb0){_0x53d1f5=_0x53d1f5-0x0;var _0x2a0ccd=_0xebec[_0x53d1f5];return _0x2a0ccd;};'use strict';var MailMessageEvents=require(_0xcebe('0x0'));var events=[_0xcebe('0x1'),_0xcebe('0x2'),'update'];function createListener(_0x259b31,_0xb36411){return function(_0x15a8e9){_0xb36411[_0xcebe('0x3')](_0x259b31,_0x15a8e9);};}function removeListener(_0x570695,_0x34bf7d){return function(){MailMessageEvents[_0xcebe('0x4')](_0x570695,_0x34bf7d);};}exports[_0xcebe('0x5')]=function(_0x348d0c){for(var _0x45c7c9=0x0,_0x2c5b0a=events[_0xcebe('0x6')];_0x45c7c9<_0x2c5b0a;_0x45c7c9++){var _0x645689=events[_0x45c7c9];var _0x2e7adb=createListener('mailMessage:'+_0x645689,_0x348d0c);MailMessageEvents['on'](_0x645689,_0x2e7adb);}}; \ No newline at end of file +var _0x25ad=['mailMessage:','./mailMessage.events','remove','update','emit','removeListener','register','length'];(function(_0x504c84,_0xa6355){var _0x28bfdf=function(_0xfd14f){while(--_0xfd14f){_0x504c84['push'](_0x504c84['shift']());}};_0x28bfdf(++_0xa6355);}(_0x25ad,0x1b1));var _0xd25a=function(_0x465be6,_0x2668de){_0x465be6=_0x465be6-0x0;var _0x45f7b1=_0x25ad[_0x465be6];return _0x45f7b1;};'use strict';var MailMessageEvents=require(_0xd25a('0x0'));var events=['save',_0xd25a('0x1'),_0xd25a('0x2')];function createListener(_0x2acd3a,_0x538e36){return function(_0x26b892){_0x538e36[_0xd25a('0x3')](_0x2acd3a,_0x26b892);};}function removeListener(_0x1532c5,_0x6a6a0d){return function(){MailMessageEvents[_0xd25a('0x4')](_0x1532c5,_0x6a6a0d);};}exports[_0xd25a('0x5')]=function(_0x544053){for(var _0x4ca0db=0x0,_0x3694c6=events[_0xd25a('0x6')];_0x4ca0db<_0x3694c6;_0x4ca0db++){var _0x5cf769=events[_0x4ca0db];var _0x237c8b=createListener(_0xd25a('0x7')+_0x5cf769,_0x544053);MailMessageEvents['on'](_0x5cf769,_0x237c8b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index a29589b..bd95350 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 _0xd62e=['removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams'];(function(_0x4f8502,_0x277ec6){var _0x287bc8=function(_0xdf3715){while(--_0xdf3715){_0x4f8502['push'](_0x4f8502['shift']());}};_0x287bc8(++_0x277ec6);}(_0xd62e,0x162));var _0xed62=function(_0x35ef0e,_0x24ed3a){_0x35ef0e=_0x35ef0e-0x0;var _0x4b2eef=_0xd62e[_0x35ef0e];return _0x4b2eef;};'use strict';var multer=require(_0xed62('0x0'));var util=require(_0xed62('0x1'));var path=require(_0xed62('0x2'));var timeout=require('connect-timeout');var express=require(_0xed62('0x3'));var router=express[_0xed62('0x4')]();var fs_extra=require(_0xed62('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xed62('0x6'));var config=require(_0xed62('0x7'));var controller=require(_0xed62('0x8'));router[_0xed62('0x9')]('/',auth['isAuthenticated'](),controller[_0xed62('0xa')]);router['get'](_0xed62('0xb'),auth['isAuthenticated'](),controller[_0xed62('0xc')]);router['get'](_0xed62('0xd'),auth[_0xed62('0xe')](),controller[_0xed62('0xf')]);router[_0xed62('0x9')](_0xed62('0x10'),auth[_0xed62('0xe')](),controller[_0xed62('0x11')]);router[_0xed62('0x9')](_0xed62('0x12'),auth[_0xed62('0xe')](),controller[_0xed62('0x13')]);router['get'](_0xed62('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0xed62('0x15')]('/',auth['isAuthenticated'](),controller[_0xed62('0x16')]);router[_0xed62('0x15')](_0xed62('0x12'),auth[_0xed62('0xe')](),controller[_0xed62('0x17')]);router['post'](_0xed62('0x14'),auth['isAuthenticated'](),controller[_0xed62('0x18')]);router[_0xed62('0x19')](_0xed62('0xd'),auth['isAuthenticated'](),controller[_0xed62('0x1a')]);router[_0xed62('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xed62('0x1c')]);router[_0xed62('0x1b')](_0xed62('0x12'),auth[_0xed62('0xe')](),controller[_0xed62('0x1d')]);router['delete'](_0xed62('0x14'),auth[_0xed62('0xe')](),controller[_0xed62('0x1e')]);module[_0xed62('0x1f')]=router; \ No newline at end of file +var _0xffa9=['update','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','describe','/:id','isAuthenticated','show','/:id/members','/:id/teams','getTeams','/:id/users','create','addTeams','post','addAgents','put'];(function(_0x1a16b1,_0x292d9a){var _0x4c07b6=function(_0x3cb9d9){while(--_0x3cb9d9){_0x1a16b1['push'](_0x1a16b1['shift']());}};_0x4c07b6(++_0x292d9a);}(_0xffa9,0x13b));var _0x9ffa=function(_0x5a4b16,_0x294bb1){_0x5a4b16=_0x5a4b16-0x0;var _0x5236dc=_0xffa9[_0x5a4b16];return _0x5236dc;};'use strict';var multer=require(_0x9ffa('0x0'));var util=require('util');var path=require(_0x9ffa('0x1'));var timeout=require('connect-timeout');var express=require(_0x9ffa('0x2'));var router=express[_0x9ffa('0x3')]();var fs_extra=require(_0x9ffa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9ffa('0x5'));var config=require(_0x9ffa('0x6'));var controller=require('./mailQueue.controller');router[_0x9ffa('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9ffa('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x9ffa('0x8')]);router['get'](_0x9ffa('0x9'),auth[_0x9ffa('0xa')](),controller[_0x9ffa('0xb')]);router['get'](_0x9ffa('0xc'),auth[_0x9ffa('0xa')](),controller['getMembers']);router[_0x9ffa('0x7')](_0x9ffa('0xd'),auth[_0x9ffa('0xa')](),controller[_0x9ffa('0xe')]);router[_0x9ffa('0x7')](_0x9ffa('0xf'),auth[_0x9ffa('0xa')](),controller['getAgents']);router['post']('/',auth[_0x9ffa('0xa')](),controller[_0x9ffa('0x10')]);router['post'](_0x9ffa('0xd'),auth[_0x9ffa('0xa')](),controller[_0x9ffa('0x11')]);router[_0x9ffa('0x12')]('/:id/users',auth[_0x9ffa('0xa')](),controller[_0x9ffa('0x13')]);router[_0x9ffa('0x14')](_0x9ffa('0x9'),auth[_0x9ffa('0xa')](),controller[_0x9ffa('0x15')]);router['delete'](_0x9ffa('0x9'),auth[_0x9ffa('0xa')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x9ffa('0xf'),auth['isAuthenticated'](),controller[_0x9ffa('0x16')]);module[_0x9ffa('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 5370310..bdf2b45 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 _0xfffc=['name','ENUM','beepall','sequelize','exports','STRING'];(function(_0x4835e8,_0x386810){var _0x3bf91d=function(_0x4304b4){while(--_0x4304b4){_0x4835e8['push'](_0x4835e8['shift']());}};_0x3bf91d(++_0x386810);}(_0xfffc,0x1e9));var _0xcfff=function(_0x5b6d1b,_0x12eac6){_0x5b6d1b=_0x5b6d1b-0x0;var _0x5496a8=_0xfffc[_0x5b6d1b];return _0x5496a8;};'use strict';var Sequelize=require(_0xcfff('0x0'));module[_0xcfff('0x1')]={'name':{'type':Sequelize[_0xcfff('0x2')],'unique':_0xcfff('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcfff('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcfff('0x4')]('rrmemory',_0xcfff('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xd65c=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x54ba3f,_0x27c0ec){var _0x20dd75=function(_0x32d38b){while(--_0x32d38b){_0x54ba3f['push'](_0x54ba3f['shift']());}};_0x20dd75(++_0x27c0ec);}(_0xd65c,0xee));var _0xcd65=function(_0x273f3a,_0x3c3708){_0x273f3a=_0x273f3a-0x0;var _0x3272ab=_0xd65c[_0x273f3a];return _0x3272ab;};'use strict';var Sequelize=require(_0xcd65('0x0'));module[_0xcd65('0x1')]={'name':{'type':Sequelize[_0xcd65('0x2')],'unique':_0xcd65('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xcd65('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcd65('0x5')](_0xcd65('0x6'),_0xcd65('0x7'),_0xcd65('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 8e4428e..ea213b8 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 _0x1752=['each','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','SELECT','TeamId','all','union','compact','value','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../mysqldb','defaults','redis','socket.io-emitter','./mailQueue.socket','register','sendStatus','undefined','limit','count','offset','status','Content-Range','json','apply','save','destroy','get','MailQueues','UserProfileResource','then','end','error','name','index','MailQueue','rawAttributes','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','options','findAll','rows','catch','show','find','create','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','pick','MailQueueId','User','findAndCountAll','agent','mailPause','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction'];(function(_0xa09385,_0x4375e8){var _0x1d8f02=function(_0x5862a7){while(--_0x5862a7){_0xa09385['push'](_0xa09385['shift']());}};_0x1d8f02(++_0x4375e8);}(_0x1752,0xa5));var _0x2175=function(_0x262593,_0x1398c1){_0x262593=_0x262593-0x0;var _0x26d232=_0x1752[_0x262593];return _0x26d232;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2175('0x0'));var zipdir=require(_0x2175('0x1'));var jsonpatch=require(_0x2175('0x2'));var rp=require(_0x2175('0x3'));var moment=require(_0x2175('0x4'));var BPromise=require(_0x2175('0x5'));var Mustache=require('mustache');var util=require(_0x2175('0x6'));var path=require(_0x2175('0x7'));var sox=require(_0x2175('0x8'));var csv=require(_0x2175('0x9'));var ejs=require(_0x2175('0xa'));var fs=require('fs');var fs_extra=require(_0x2175('0xb'));var _=require(_0x2175('0xc'));var squel=require(_0x2175('0xd'));var crypto=require(_0x2175('0xe'));var jsforce=require(_0x2175('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2175('0x9'));var querystring=require(_0x2175('0x10'));var Papa=require(_0x2175('0x11'));var Redis=require(_0x2175('0x12'));var authService=require(_0x2175('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2175('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2175('0x15'))['db'];config['redis']=_[_0x2175('0x16')](config[_0x2175('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2175('0x18'))(new Redis(config[_0x2175('0x17')]));require(_0x2175('0x19'))[_0x2175('0x1a')](socket);function respondWithStatusCode(_0x21d4cd,_0xab5db9){_0xab5db9=_0xab5db9||0xcc;return function(_0x41b4ce){if(_0x41b4ce){return _0x21d4cd[_0x2175('0x1b')](_0xab5db9);}return _0x21d4cd['status'](_0xab5db9)['end']();};}function respondWithResult(_0x371b42,_0x22cd42){_0x22cd42=_0x22cd42||0xc8;return function(_0x22fde9){if(_0x22fde9){return _0x371b42['status'](_0x22cd42)['json'](_0x22fde9);}};}function respondWithFilteredResult(_0x588b0b,_0x366e37){return function(_0x377586){if(_0x377586){var _0x4cb089=typeof _0x366e37['offset']===_0x2175('0x1c')&&typeof _0x366e37[_0x2175('0x1d')]===_0x2175('0x1c');var _0x51628d=_0x377586[_0x2175('0x1e')];var _0x5e60ee=_0x4cb089?0x0:_0x366e37[_0x2175('0x1f')];var _0x49ee8e=_0x4cb089?_0x377586[_0x2175('0x1e')]:_0x366e37['offset']+_0x366e37['limit'];var _0x5344af;if(_0x49ee8e>=_0x51628d){_0x49ee8e=_0x51628d;_0x5344af=0xc8;}else{_0x5344af=0xce;}_0x588b0b[_0x2175('0x20')](_0x5344af);return _0x588b0b['set'](_0x2175('0x21'),_0x5e60ee+'-'+_0x49ee8e+'/'+_0x51628d)[_0x2175('0x22')](_0x377586);}return null;};}function patchUpdates(_0x2dd77b){return function(_0x428166){try{jsonpatch[_0x2175('0x23')](_0x428166,_0x2dd77b,!![]);}catch(_0x12d150){return BPromise['reject'](_0x12d150);}return _0x428166[_0x2175('0x24')]();};}function saveUpdates(_0x3d849e,_0xa6ef48){return function(_0x140032){if(_0x140032){return _0x140032['update'](_0x3d849e)['then'](function(_0x9c6374){return _0x9c6374;});}return null;};}function removeEntity(_0xe252f0,_0x2204cd){return function(_0x542273){if(_0x542273){return _0x542273[_0x2175('0x25')]()['then'](function(){var _0x5e696c=_0x542273[_0x2175('0x26')]({'plain':!![]});var _0x183221=_0x2175('0x27');return db[_0x2175('0x28')][_0x2175('0x25')]({'where':{'type':_0x183221,'resourceId':_0x5e696c['id']}})[_0x2175('0x29')](function(){return _0x542273;});})[_0x2175('0x29')](function(){_0xe252f0[_0x2175('0x20')](0xcc)[_0x2175('0x2a')]();});}};}function handleEntityNotFound(_0x1c721d,_0x7b6edb){return function(_0x56dcf9){if(!_0x56dcf9){_0x1c721d[_0x2175('0x1b')](0x194);}return _0x56dcf9;};}function handleError(_0x1e91a6,_0x4a41f1){_0x4a41f1=_0x4a41f1||0x1f4;return function(_0x4ae1a9){logger[_0x2175('0x2b')](_0x4ae1a9['stack']);if(_0x4ae1a9[_0x2175('0x2c')]){delete _0x4ae1a9['name'];}_0x1e91a6['status'](_0x4a41f1)['send'](_0x4ae1a9);};}exports[_0x2175('0x2d')]=function(_0x2811b6,_0x3ba86e){var _0x614ab7={},_0x582712={},_0x31493d={'count':0x0,'rows':[]};var _0x2d9526=_['map'](db[_0x2175('0x2e')][_0x2175('0x2f')],function(_0x5b1e72){return{'name':_0x5b1e72['fieldName'],'type':_0x5b1e72['type']['key']};});_0x582712[_0x2175('0x30')]=_[_0x2175('0x31')](_0x2d9526,_0x2175('0x2c'));_0x582712[_0x2175('0x32')]=_[_0x2175('0x33')](_0x2811b6[_0x2175('0x32')]);_0x582712[_0x2175('0x34')]=_[_0x2175('0x35')](_0x582712['model'],_0x582712['query']);_0x614ab7['attributes']=_['intersection'](_0x582712['model'],qs[_0x2175('0x36')](_0x2811b6[_0x2175('0x32')]['fields']));_0x614ab7[_0x2175('0x37')]=_0x614ab7[_0x2175('0x37')][_0x2175('0x38')]?_0x614ab7[_0x2175('0x37')]:_0x582712[_0x2175('0x30')];if(!_0x2811b6[_0x2175('0x32')]['hasOwnProperty'](_0x2175('0x39'))){_0x614ab7[_0x2175('0x1d')]=qs[_0x2175('0x1d')](_0x2811b6[_0x2175('0x32')][_0x2175('0x1d')]);_0x614ab7[_0x2175('0x1f')]=qs[_0x2175('0x1f')](_0x2811b6[_0x2175('0x32')][_0x2175('0x1f')]);}_0x614ab7[_0x2175('0x3a')]=qs[_0x2175('0x3b')](_0x2811b6['query'][_0x2175('0x3b')]);_0x614ab7[_0x2175('0x3c')]=qs[_0x2175('0x34')](_['pick'](_0x2811b6['query'],_0x582712[_0x2175('0x34')]),_0x2d9526);if(_0x2811b6['query'][_0x2175('0x3d')]){_0x614ab7[_0x2175('0x3c')]=_[_0x2175('0x3e')](_0x614ab7['where'],{'$or':_['map'](_0x2d9526,function(_0x2d6100){if(_0x2d6100[_0x2175('0x3f')]!=='VIRTUAL'){var _0x49c383={};_0x49c383[_0x2d6100[_0x2175('0x2c')]]={'$like':'%'+_0x2811b6[_0x2175('0x32')][_0x2175('0x3d')]+'%'};return _0x49c383;}})});}_0x614ab7=_['merge']({},_0x614ab7,_0x2811b6[_0x2175('0x40')]);var _0x4343f9={'where':_0x614ab7[_0x2175('0x3c')]};return db['MailQueue']['count'](_0x4343f9)[_0x2175('0x29')](function(_0x47f60d){_0x31493d[_0x2175('0x1e')]=_0x47f60d;if(_0x2811b6[_0x2175('0x32')]['includeAll']){_0x614ab7['include']=[{'all':!![]}];}return db['MailQueue'][_0x2175('0x41')](_0x614ab7);})['then'](function(_0x48688c){_0x31493d[_0x2175('0x42')]=_0x48688c;return _0x31493d;})['then'](respondWithFilteredResult(_0x3ba86e,_0x614ab7))[_0x2175('0x43')](handleError(_0x3ba86e,null));};exports[_0x2175('0x44')]=function(_0x246e16,_0x3827a5){var _0x257566={'raw':!![],'where':{'id':_0x246e16['params']['id']}},_0x3e8896={};_0x3e8896[_0x2175('0x30')]=_[_0x2175('0x33')](db[_0x2175('0x2e')][_0x2175('0x2f')]);_0x3e8896[_0x2175('0x32')]=_[_0x2175('0x33')](_0x246e16['query']);_0x3e8896[_0x2175('0x34')]=_[_0x2175('0x35')](_0x3e8896[_0x2175('0x30')],_0x3e8896['query']);_0x257566[_0x2175('0x37')]=_['intersection'](_0x3e8896['model'],qs[_0x2175('0x36')](_0x246e16[_0x2175('0x32')][_0x2175('0x36')]));_0x257566['attributes']=_0x257566[_0x2175('0x37')][_0x2175('0x38')]?_0x257566[_0x2175('0x37')]:_0x3e8896[_0x2175('0x30')];if(_0x246e16[_0x2175('0x32')]['includeAll']){_0x257566['include']=[{'all':!![]}];}_0x257566=_[_0x2175('0x3e')]({},_0x257566,_0x246e16[_0x2175('0x40')]);return db[_0x2175('0x2e')][_0x2175('0x45')](_0x257566)[_0x2175('0x29')](handleEntityNotFound(_0x3827a5,null))['then'](respondWithResult(_0x3827a5,null))[_0x2175('0x43')](handleError(_0x3827a5,null));};exports[_0x2175('0x46')]=function(_0x1db433,_0x565136){return db['MailQueue'][_0x2175('0x46')](_0x1db433['body'],{})['then'](function(_0x5bab81){var _0x4dfe47=_0x1db433[_0x2175('0x47')][_0x2175('0x26')]({'plain':!![]});if(!_0x4dfe47)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4dfe47['role']==='user'){var _0x56b87c=_0x5bab81[_0x2175('0x26')]({'plain':!![]});var _0x7c2c1f='MailQueues';return db['UserProfileSection'][_0x2175('0x45')]({'where':{'name':_0x7c2c1f,'userProfileId':_0x4dfe47[_0x2175('0x48')]},'raw':!![]})[_0x2175('0x29')](function(_0xce807c){if(_0xce807c&&_0xce807c[_0x2175('0x49')]===0x0){return db['UserProfileResource'][_0x2175('0x46')]({'name':_0x56b87c['name'],'resourceId':_0x56b87c['id'],'type':_0xce807c[_0x2175('0x2c')],'sectionId':_0xce807c['id']},{})[_0x2175('0x29')](function(){return _0x5bab81;});}else{return _0x5bab81;}})[_0x2175('0x43')](function(_0x297b4d){logger[_0x2175('0x2b')](_0x2175('0x4a'),_0x297b4d);throw _0x297b4d;});}return _0x5bab81;})[_0x2175('0x29')](respondWithResult(_0x565136,0xc9))[_0x2175('0x43')](handleError(_0x565136,null));};exports[_0x2175('0x4b')]=function(_0x470dde,_0x1f967d){if(_0x470dde[_0x2175('0x4c')]['id']){delete _0x470dde[_0x2175('0x4c')]['id'];}return db[_0x2175('0x2e')][_0x2175('0x45')]({'where':{'id':_0x470dde['params']['id']}})[_0x2175('0x29')](handleEntityNotFound(_0x1f967d,null))[_0x2175('0x29')](saveUpdates(_0x470dde[_0x2175('0x4c')],null))[_0x2175('0x29')](respondWithResult(_0x1f967d,null))['catch'](handleError(_0x1f967d,null));};exports[_0x2175('0x25')]=function(_0x49a8f2,_0xeab00){return db[_0x2175('0x2e')][_0x2175('0x45')]({'where':{'id':_0x49a8f2[_0x2175('0x4d')]['id']}})[_0x2175('0x29')](handleEntityNotFound(_0xeab00,null))[_0x2175('0x29')](removeEntity(_0xeab00,null))[_0x2175('0x43')](handleError(_0xeab00,null));};exports[_0x2175('0x4e')]=function(_0x5dfcf2,_0x4f138b){return db[_0x2175('0x2e')][_0x2175('0x4e')]()['then'](respondWithResult(_0x4f138b,null))['catch'](handleError(_0x4f138b,null));};exports[_0x2175('0x4f')]=function(_0x8b0f22,_0x1b5452,_0x139778){var _0x480132={'raw':!![],'where':{}},_0x3368be={},_0x5a93b7;return db[_0x2175('0x2e')][_0x2175('0x50')]({'where':{'id':_0x8b0f22['params']['id']}})[_0x2175('0x29')](handleEntityNotFound(_0x1b5452,null))[_0x2175('0x29')](function(_0x1bcd5f){if(_0x1bcd5f){_0x5a93b7=_0x1bcd5f[_0x2175('0x26')]({'plain':!![]});_0x3368be[_0x2175('0x30')]=_['keys'](db[_0x2175('0x51')][_0x2175('0x2f')]);_0x3368be['query']=_[_0x2175('0x33')](_0x8b0f22['query']);_0x3368be[_0x2175('0x34')]=_['intersection'](_0x3368be[_0x2175('0x30')],_0x3368be[_0x2175('0x32')]);_0x480132[_0x2175('0x37')]=_[_0x2175('0x35')](_0x3368be[_0x2175('0x30')],qs['fields'](_0x8b0f22[_0x2175('0x32')][_0x2175('0x36')]));_0x480132[_0x2175('0x37')]=_0x480132[_0x2175('0x37')][_0x2175('0x38')]?_0x480132[_0x2175('0x37')]:_0x3368be['model'];if(!_0x8b0f22['query'][_0x2175('0x52')](_0x2175('0x39'))){_0x480132[_0x2175('0x1d')]=qs[_0x2175('0x1d')](_0x8b0f22[_0x2175('0x32')][_0x2175('0x1d')]);_0x480132[_0x2175('0x1f')]=qs[_0x2175('0x1f')](_0x8b0f22['query'][_0x2175('0x1f')]);}_0x480132[_0x2175('0x3a')]=qs[_0x2175('0x3b')](_0x8b0f22['query'][_0x2175('0x3b')]);_0x480132['where']=qs['filters'](_[_0x2175('0x53')](_0x8b0f22[_0x2175('0x32')],_0x3368be[_0x2175('0x34')]));_0x480132[_0x2175('0x3c')][_0x2175('0x54')]=_0x1bcd5f['id'];if(_0x8b0f22[_0x2175('0x32')][_0x2175('0x3d')]){_0x480132[_0x2175('0x3c')]=_[_0x2175('0x3e')](_0x480132['where'],{'$or':_['map'](_0x480132[_0x2175('0x37')],function(_0x99cdb9){var _0x4a10f0={};_0x4a10f0[_0x99cdb9]={'$like':'%'+_0x8b0f22[_0x2175('0x32')][_0x2175('0x3d')]+'%'};return _0x4a10f0;})});}_0x480132=_[_0x2175('0x3e')]({},_0x480132,_0x8b0f22['options']);return db['UserMailQueue'][_0x2175('0x41')](_0x480132);}})['then'](function(_0x53a035){if(_0x53a035){return db[_0x2175('0x55')][_0x2175('0x56')]({'where':{'id':_['map'](_0x53a035,'UserId'),'role':_0x2175('0x57')},'attributes':['id',_0x2175('0x2c'),_0x2175('0x58'),'updatedAt','createdAt']});}})['then'](function(_0x2028ab){if(_0x2028ab){return{'count':_0x2028ab['count'],'rows':_[_0x2175('0x31')](_0x2028ab['rows'],function(_0xa4b5b0){return{'membername':_0xa4b5b0['name'],'UserId':_0xa4b5b0['id'],'queue_name':_0x5a93b7['name'],'MailQueueId':_0x5a93b7['id'],'interface':util[_0x2175('0x59')](_0x2175('0x5a'),_0x2175('0x5b'),_0xa4b5b0['name']),'penalty':0x0,'paused':_0xa4b5b0[_0x2175('0x58')],'createdAt':_0xa4b5b0['createdAt'],'updatedAt':_0xa4b5b0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1b5452,_0x480132))[_0x2175('0x43')](handleError(_0x1b5452,null));};exports[_0x2175('0x5c')]=function(_0x50e118,_0x29c53e,_0x36075e){var _0x4f2b89={};var _0x316757={};var _0x2d3291;var _0x54e93a;return db[_0x2175('0x2e')]['findOne']({'where':{'id':_0x50e118[_0x2175('0x4d')]['id']}})[_0x2175('0x29')](handleEntityNotFound(_0x29c53e,null))['then'](function(_0x410edf){if(_0x410edf){_0x2d3291=_0x410edf;_0x316757[_0x2175('0x30')]=_[_0x2175('0x33')](db['Team'][_0x2175('0x2f')]);_0x316757[_0x2175('0x32')]=_['keys'](_0x50e118['query']);_0x316757['filters']=_[_0x2175('0x35')](_0x316757[_0x2175('0x30')],_0x316757[_0x2175('0x32')]);_0x4f2b89[_0x2175('0x37')]=_['intersection'](_0x316757[_0x2175('0x30')],qs[_0x2175('0x36')](_0x50e118[_0x2175('0x32')][_0x2175('0x36')]));_0x4f2b89[_0x2175('0x37')]=_0x4f2b89[_0x2175('0x37')]['length']?_0x4f2b89['attributes']:_0x316757['model'];_0x4f2b89[_0x2175('0x3a')]=qs['sort'](_0x50e118[_0x2175('0x32')][_0x2175('0x3b')]);_0x4f2b89[_0x2175('0x3c')]=qs[_0x2175('0x34')](_['pick'](_0x50e118[_0x2175('0x32')],_0x316757[_0x2175('0x34')]));if(_0x50e118['query']['filter']){_0x4f2b89['where']=_[_0x2175('0x3e')](_0x4f2b89[_0x2175('0x3c')],{'$or':_[_0x2175('0x31')](_0x4f2b89['attributes'],function(_0x3f308a){var _0x325922={};_0x325922[_0x3f308a]={'$like':'%'+_0x50e118[_0x2175('0x32')][_0x2175('0x3d')]+'%'};return _0x325922;})});}_0x4f2b89=_[_0x2175('0x3e')]({},_0x4f2b89,_0x50e118[_0x2175('0x40')]);return _0x2d3291[_0x2175('0x5c')](_0x4f2b89);}})[_0x2175('0x29')](function(_0x52e3d2){if(_0x52e3d2){_0x54e93a=_0x52e3d2[_0x2175('0x38')];if(!_0x50e118['query'][_0x2175('0x52')](_0x2175('0x39'))){_0x4f2b89['limit']=qs[_0x2175('0x1d')](_0x50e118['query'][_0x2175('0x1d')]);_0x4f2b89[_0x2175('0x1f')]=qs[_0x2175('0x1f')](_0x50e118['query'][_0x2175('0x1f')]);}return _0x2d3291[_0x2175('0x5c')](_0x4f2b89);}})['then'](function(_0x5078ae){if(_0x5078ae){return _0x5078ae?{'count':_0x54e93a,'rows':_0x5078ae}:null;}})[_0x2175('0x29')](respondWithResult(_0x29c53e,null))[_0x2175('0x43')](handleError(_0x29c53e,null));};exports[_0x2175('0x5d')]=function(_0x2a147a,_0xe292ce,_0x1aa662){var _0x43daf3=_0x2a147a[_0x2175('0x4c')][_0x2175('0x5e')];return db[_0x2175('0x5f')]['findAll']({'where':{'id':_0x43daf3},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2175('0x60'),'attributes':['id',_0x2175('0x2c'),_0x2175('0x61'),_0x2175('0x62'),_0x2175('0x63')],'raw':!![]}]})['then'](function(_0xbb968b){if(_0xbb968b){var _0x3b83a9=_[_0x2175('0x64')](_0xbb968b,function(_0x6192e1){var _0x54f5d9=_0x6192e1[_0x2175('0x26')]({'plain':!![]});return _0x54f5d9[_0x2175('0x60')];});return db['MailQueue'][_0x2175('0x45')]({'where':{'id':_0x2a147a[_0x2175('0x4d')]['id']}})[_0x2175('0x29')](function(_0x18659f){return db[_0x2175('0x65')][_0x2175('0x66')](function(_0x3f233f){return _0x18659f['addTeams'](_0x43daf3,{'transaction':_0x3f233f})[_0x2175('0x29')](function(){return BPromise[_0x2175('0x67')](_0x3b83a9,function(_0x6b67ad){return db[_0x2175('0x51')][_0x2175('0x68')]({'where':{'UserId':_0x6b67ad['id'],'MailQueueId':_0x2a147a[_0x2175('0x4d')]['id']},'transaction':_0x3f233f});});})[_0x2175('0x29')](function(){_0x3b83a9[_0x2175('0x69')](function(_0x119ee5){socket[_0x2175('0x6a')](_0x2175('0x6b'),{'UserId':_0x119ee5['id'],'MailQueueId':_0x18659f['id']});});});});});}})[_0x2175('0x29')](respondWithStatusCode(_0xe292ce,null))[_0x2175('0x43')](handleError(_0xe292ce,null));};exports['removeTeams']=function(_0x27b831,_0x1bfaa5,_0x220ae6){return db['Team'][_0x2175('0x41')]({'where':{'id':_0x27b831[_0x2175('0x32')][_0x2175('0x5e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2175('0x60'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1bfaa5,null))[_0x2175('0x29')](function(_0x15cc38){var _0x339887=_[_0x2175('0x31')](_0x15cc38,'id');var _0x4265b6=[];var _0x5f45b4=[];var _0x298051=squel[_0x2175('0x6c')]();_0x298051[_0x2175('0x6d')](_0x2175('0x6e'))[_0x2175('0x6f')](_0x2175('0x70'),'tq')[_0x2175('0x71')](_0x2175('0x72'),'ut',_0x2175('0x73'))[_0x2175('0x3c')](_0x2175('0x74'),_0x27b831[_0x2175('0x4d')]['id']);for(var _0x167506=0x0;_0x167506<_0x15cc38[_0x2175('0x38')];_0x167506+=0x1){let _0x30078d=_0x15cc38[_0x167506];for(var _0xa169a9=0x0;_0xa169a9<_0x30078d[_0x2175('0x60')][_0x2175('0x38')];_0xa169a9+=0x1){let _0x449339=_0x30078d[_0x2175('0x60')][_0xa169a9];var _0x47442b=_0x298051[_0x2175('0x75')]();_0x47442b[_0x2175('0x3c')]('ut.UserId\x20=\x20?',_0x449339['id']);_0x5f45b4[_0x2175('0x76')](db[_0x2175('0x65')][_0x2175('0x32')](_0x47442b[_0x2175('0x77')](),{'type':db[_0x2175('0x65')]['QueryTypes'][_0x2175('0x78')]})[_0x2175('0x29')](function(_0x20b2d2){if(_0x20b2d2[_0x2175('0x38')]===0x1){return _0x449339['id'];}else{var _0x1aa4b4=_['every'](_[_0x2175('0x31')](_0x20b2d2,_0x2175('0x79')),function(_0x3d0c70){return _['includes'](_0x339887,_0x3d0c70);});if(_0x1aa4b4){return _0x449339['id'];}}}));}}return BPromise[_0x2175('0x7a')](_0x5f45b4)['then'](function(_0xb3dc81){_0x4265b6=_(_0x4265b6)[_0x2175('0x7b')](_0xb3dc81)[_0x2175('0x7c')]()[_0x2175('0x7d')]();return db[_0x2175('0x2e')][_0x2175('0x45')]({'where':{'id':_0x27b831['params']['id']}})['then'](function(_0x399a7a){return db[_0x2175('0x65')][_0x2175('0x66')](function(_0x3d0e9e){return _0x399a7a[_0x2175('0x7e')](_0x27b831['query'][_0x2175('0x5e')],{'transaction':_0x3d0e9e})['then'](function(){if(!_[_0x2175('0x7f')](_0x4265b6)){return _0x399a7a[_0x2175('0x80')](_0x4265b6,{'transaction':_0x3d0e9e});}})[_0x2175('0x29')](function(){_0x4265b6[_0x2175('0x69')](function(_0x1b26d4){socket[_0x2175('0x6a')](_0x2175('0x81'),{'UserId':_0x1b26d4,'MailQueueId':_0x399a7a['id']});});});});});});})[_0x2175('0x29')](respondWithStatusCode(_0x1bfaa5,null))[_0x2175('0x43')](handleError(_0x1bfaa5,null));};exports[_0x2175('0x82')]=function(_0x177a81,_0x4e8c82,_0x1120ec){return db[_0x2175('0x2e')]['find']({'where':{'id':_0x177a81[_0x2175('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4e8c82,null))[_0x2175('0x29')](function(_0x4b2d03){if(_0x4b2d03){return _0x4b2d03[_0x2175('0x82')](_0x177a81[_0x2175('0x4c')][_0x2175('0x5e')],_['omit'](_0x177a81['body'],[_0x2175('0x5e'),'id'])||{})[_0x2175('0x83')](function(_0x501c61){for(var _0x1799fe=0x0;_0x1799fe<_0x177a81[_0x2175('0x4c')][_0x2175('0x5e')]['length'];_0x1799fe+=0x1){socket[_0x2175('0x6a')](_0x2175('0x6b'),{'UserId':Number(_0x177a81[_0x2175('0x4c')]['ids'][_0x1799fe]),'MailQueueId':Number(_0x177a81[_0x2175('0x4d')]['id'])});}return _0x501c61;});}})['then'](respondWithResult(_0x4e8c82,null))[_0x2175('0x43')](handleError(_0x4e8c82,null));};exports[_0x2175('0x80')]=function(_0x42c484,_0x57a336,_0x5a4682){return db[_0x2175('0x2e')][_0x2175('0x45')]({'where':{'id':_0x42c484[_0x2175('0x4d')]['id']}})[_0x2175('0x29')](handleEntityNotFound(_0x57a336,null))[_0x2175('0x29')](function(_0x3b5543){if(_0x3b5543){return _0x3b5543[_0x2175('0x80')](_0x42c484[_0x2175('0x32')][_0x2175('0x5e')])[_0x2175('0x29')](function(){if(_[_0x2175('0x84')](_0x42c484[_0x2175('0x32')][_0x2175('0x5e')])){for(var _0xa09c6e=0x0;_0xa09c6e<_0x42c484[_0x2175('0x32')]['ids']['length'];_0xa09c6e+=0x1){socket[_0x2175('0x6a')](_0x2175('0x81'),{'UserId':Number(_0x42c484[_0x2175('0x32')][_0x2175('0x5e')][_0xa09c6e]),'MailQueueId':Number(_0x42c484[_0x2175('0x4d')]['id'])});}}else{socket[_0x2175('0x6a')](_0x2175('0x81'),{'UserId':Number(_0x42c484['query'][_0x2175('0x5e')]),'MailQueueId':Number(_0x42c484[_0x2175('0x4d')]['id'])});}});}})[_0x2175('0x29')](respondWithStatusCode(_0x57a336,null))[_0x2175('0x43')](handleError(_0x57a336,null));};exports[_0x2175('0x85')]=function(_0xefbe4,_0x264333,_0x44fb10){var _0x1acaf2={};var _0x1514cc={};var _0x15fa91;var _0x5785f2;return db[_0x2175('0x2e')][_0x2175('0x50')]({'where':{'id':_0xefbe4[_0x2175('0x4d')]['id']}})['then'](handleEntityNotFound(_0x264333,null))['then'](function(_0x5caa8d){if(_0x5caa8d){_0x15fa91=_0x5caa8d;_0x1514cc[_0x2175('0x30')]=_['keys'](db[_0x2175('0x55')][_0x2175('0x2f')]);_0x1514cc[_0x2175('0x32')]=_['keys'](_0xefbe4[_0x2175('0x32')]);_0x1514cc['filters']=_['intersection'](_0x1514cc[_0x2175('0x30')],_0x1514cc[_0x2175('0x32')]);_0x1acaf2[_0x2175('0x37')]=_[_0x2175('0x35')](_0x1514cc[_0x2175('0x30')],qs['fields'](_0xefbe4['query'][_0x2175('0x36')]));_0x1acaf2[_0x2175('0x37')]=_0x1acaf2[_0x2175('0x37')]['length']?_0x1acaf2['attributes']:_0x1514cc[_0x2175('0x30')];_0x1acaf2[_0x2175('0x3a')]=qs[_0x2175('0x3b')](_0xefbe4[_0x2175('0x32')]['sort']);_0x1acaf2[_0x2175('0x3c')]=qs[_0x2175('0x34')](_[_0x2175('0x53')](_0xefbe4['query'],_0x1514cc['filters']));if(_0xefbe4['query'][_0x2175('0x3d')]){_0x1acaf2[_0x2175('0x3c')]=_[_0x2175('0x3e')](_0x1acaf2['where'],{'$or':_[_0x2175('0x31')](_0x1acaf2[_0x2175('0x37')],function(_0xe706d3){var _0x55bd0c={};_0x55bd0c[_0xe706d3]={'$like':'%'+_0xefbe4['query'][_0x2175('0x3d')]+'%'};return _0x55bd0c;})});}_0x1acaf2=_['merge']({},_0x1acaf2,_0xefbe4[_0x2175('0x40')]);return _0x15fa91[_0x2175('0x85')](_0x1acaf2);}})[_0x2175('0x29')](function(_0x33764a){if(_0x33764a){_0x5785f2=_0x33764a[_0x2175('0x38')];if(!_0xefbe4[_0x2175('0x32')][_0x2175('0x52')](_0x2175('0x39'))){_0x1acaf2[_0x2175('0x1d')]=qs[_0x2175('0x1d')](_0xefbe4[_0x2175('0x32')][_0x2175('0x1d')]);_0x1acaf2[_0x2175('0x1f')]=qs['offset'](_0xefbe4['query'][_0x2175('0x1f')]);}return _0x15fa91[_0x2175('0x85')](_0x1acaf2);}})[_0x2175('0x29')](function(_0x874ec6){if(_0x874ec6){return _0x874ec6?{'count':_0x5785f2,'rows':_0x874ec6}:null;}})[_0x2175('0x29')](respondWithResult(_0x264333,null))['catch'](handleError(_0x264333,null));}; \ No newline at end of file +var _0x500f=['findOne','UserMailQueue','hasOwnProperty','order','MailQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','SIP','mailPause','getTeams','addTeams','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','compact','removeAgents','addAgents','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','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','../../config/license/util','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','destroy','get','then','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','intersection','include','options','find','create','body','user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers'];(function(_0x5edf79,_0x330111){var _0x5750cd=function(_0x3d4515){while(--_0x3d4515){_0x5edf79['push'](_0x5edf79['shift']());}};_0x5750cd(++_0x330111);}(_0x500f,0x1d5));var _0xf500=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x500f[_0x289a67];return _0x572b49;};'use strict';var emlformat=require(_0xf500('0x0'));var rimraf=require(_0xf500('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf500('0x2'));var rp=require(_0xf500('0x3'));var moment=require(_0xf500('0x4'));var BPromise=require(_0xf500('0x5'));var Mustache=require(_0xf500('0x6'));var util=require(_0xf500('0x7'));var path=require('path');var sox=require(_0xf500('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf500('0x9'));var _=require(_0xf500('0xa'));var squel=require(_0xf500('0xb'));var crypto=require(_0xf500('0xc'));var jsforce=require(_0xf500('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf500('0xe'));var Papa=require(_0xf500('0xf'));var Redis=require(_0xf500('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf500('0x11'));var as=require(_0xf500('0x12'));var hardwareService=require(_0xf500('0x13'));var logger=require(_0xf500('0x14'))(_0xf500('0x15'));var utils=require(_0xf500('0x16'));var config=require(_0xf500('0x17'));var licenseUtil=require(_0xf500('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xf500('0x19')],{'host':_0xf500('0x1a'),'port':0x18eb});var socket=require(_0xf500('0x1b'))(new Redis(config[_0xf500('0x19')]));require(_0xf500('0x1c'))[_0xf500('0x1d')](socket);function respondWithStatusCode(_0x3a4467,_0xfe2e24){_0xfe2e24=_0xfe2e24||0xcc;return function(_0x4c99c8){if(_0x4c99c8){return _0x3a4467[_0xf500('0x1e')](_0xfe2e24);}return _0x3a4467[_0xf500('0x1f')](_0xfe2e24)[_0xf500('0x20')]();};}function respondWithResult(_0x788563,_0x5f1848){_0x5f1848=_0x5f1848||0xc8;return function(_0x455542){if(_0x455542){return _0x788563[_0xf500('0x1f')](_0x5f1848)[_0xf500('0x21')](_0x455542);}};}function respondWithFilteredResult(_0x55b2a4,_0x2ca4fb){return function(_0x32a187){if(_0x32a187){var _0x204cf3=typeof _0x2ca4fb['offset']===_0xf500('0x22')&&typeof _0x2ca4fb[_0xf500('0x23')]===_0xf500('0x22');var _0xb654=_0x32a187[_0xf500('0x24')];var _0x5dfe4f=_0x204cf3?0x0:_0x2ca4fb[_0xf500('0x25')];var _0x5bc84c=_0x204cf3?_0x32a187[_0xf500('0x24')]:_0x2ca4fb[_0xf500('0x25')]+_0x2ca4fb['limit'];var _0x3117cb;if(_0x5bc84c>=_0xb654){_0x5bc84c=_0xb654;_0x3117cb=0xc8;}else{_0x3117cb=0xce;}_0x55b2a4['status'](_0x3117cb);return _0x55b2a4[_0xf500('0x26')]('Content-Range',_0x5dfe4f+'-'+_0x5bc84c+'/'+_0xb654)['json'](_0x32a187);}return null;};}function patchUpdates(_0x437e96){return function(_0x3c6f78){try{jsonpatch[_0xf500('0x27')](_0x3c6f78,_0x437e96,!![]);}catch(_0x159f22){return BPromise[_0xf500('0x28')](_0x159f22);}return _0x3c6f78['save']();};}function saveUpdates(_0x45c8f5,_0x4728aa){return function(_0x13fafd){if(_0x13fafd){return _0x13fafd[_0xf500('0x29')](_0x45c8f5)['then'](function(_0x22f6ae){return _0x22f6ae;});}return null;};}function removeEntity(_0x3029be,_0x4627c4){return function(_0x1311dc){if(_0x1311dc){return _0x1311dc[_0xf500('0x2a')]()['then'](function(){var _0x5e4240=_0x1311dc[_0xf500('0x2b')]({'plain':!![]});var _0x489334='MailQueues';return db['UserProfileResource'][_0xf500('0x2a')]({'where':{'type':_0x489334,'resourceId':_0x5e4240['id']}})[_0xf500('0x2c')](function(){return _0x1311dc;});})[_0xf500('0x2c')](function(){_0x3029be[_0xf500('0x1f')](0xcc)[_0xf500('0x20')]();});}};}function handleEntityNotFound(_0x6139e8,_0xc5664f){return function(_0x2c9de7){if(!_0x2c9de7){_0x6139e8[_0xf500('0x1e')](0x194);}return _0x2c9de7;};}function handleError(_0x23b1f4,_0xd63943){_0xd63943=_0xd63943||0x1f4;return function(_0x37cb64){logger[_0xf500('0x2d')](_0x37cb64[_0xf500('0x2e')]);if(_0x37cb64[_0xf500('0x2f')]){delete _0x37cb64['name'];}_0x23b1f4[_0xf500('0x1f')](_0xd63943)[_0xf500('0x30')](_0x37cb64);};}exports[_0xf500('0x31')]=function(_0x50551f,_0x4608ef){var _0x6d750={},_0x1924d5={},_0xd4ae8b={'count':0x0,'rows':[]};var _0x2ce9c5=_[_0xf500('0x32')](db[_0xf500('0x33')][_0xf500('0x34')],function(_0x229476){return{'name':_0x229476[_0xf500('0x35')],'type':_0x229476[_0xf500('0x36')][_0xf500('0x37')]};});_0x1924d5[_0xf500('0x38')]=_[_0xf500('0x32')](_0x2ce9c5,_0xf500('0x2f'));_0x1924d5[_0xf500('0x39')]=_[_0xf500('0x3a')](_0x50551f[_0xf500('0x39')]);_0x1924d5['filters']=_['intersection'](_0x1924d5[_0xf500('0x38')],_0x1924d5[_0xf500('0x39')]);_0x6d750[_0xf500('0x3b')]=_['intersection'](_0x1924d5['model'],qs[_0xf500('0x3c')](_0x50551f[_0xf500('0x39')][_0xf500('0x3c')]));_0x6d750[_0xf500('0x3b')]=_0x6d750[_0xf500('0x3b')][_0xf500('0x3d')]?_0x6d750[_0xf500('0x3b')]:_0x1924d5['model'];if(!_0x50551f['query']['hasOwnProperty'](_0xf500('0x3e'))){_0x6d750['limit']=qs['limit'](_0x50551f[_0xf500('0x39')][_0xf500('0x23')]);_0x6d750[_0xf500('0x25')]=qs[_0xf500('0x25')](_0x50551f[_0xf500('0x39')][_0xf500('0x25')]);}_0x6d750['order']=qs[_0xf500('0x3f')](_0x50551f[_0xf500('0x39')][_0xf500('0x3f')]);_0x6d750[_0xf500('0x40')]=qs[_0xf500('0x41')](_[_0xf500('0x42')](_0x50551f['query'],_0x1924d5[_0xf500('0x41')]),_0x2ce9c5);if(_0x50551f[_0xf500('0x39')][_0xf500('0x43')]){_0x6d750[_0xf500('0x40')]=_[_0xf500('0x44')](_0x6d750[_0xf500('0x40')],{'$or':_['map'](_0x2ce9c5,function(_0x23aa75){if(_0x23aa75[_0xf500('0x36')]!==_0xf500('0x45')){var _0x3b91c3={};_0x3b91c3[_0x23aa75[_0xf500('0x2f')]]={'$like':'%'+_0x50551f['query'][_0xf500('0x43')]+'%'};return _0x3b91c3;}})});}_0x6d750=_['merge']({},_0x6d750,_0x50551f['options']);var _0x1cdb8b={'where':_0x6d750['where']};return db[_0xf500('0x33')][_0xf500('0x24')](_0x1cdb8b)[_0xf500('0x2c')](function(_0x1e0f37){_0xd4ae8b[_0xf500('0x24')]=_0x1e0f37;if(_0x50551f[_0xf500('0x39')][_0xf500('0x46')]){_0x6d750['include']=[{'all':!![]}];}return db[_0xf500('0x33')][_0xf500('0x47')](_0x6d750);})[_0xf500('0x2c')](function(_0x5e2019){_0xd4ae8b[_0xf500('0x48')]=_0x5e2019;return _0xd4ae8b;})[_0xf500('0x2c')](respondWithFilteredResult(_0x4608ef,_0x6d750))[_0xf500('0x49')](handleError(_0x4608ef,null));};exports['show']=function(_0x3525f1,_0x21885b){var _0x2e25c9={'raw':!![],'where':{'id':_0x3525f1['params']['id']}},_0x1d0734={};_0x1d0734[_0xf500('0x38')]=_['keys'](db[_0xf500('0x33')]['rawAttributes']);_0x1d0734['query']=_[_0xf500('0x3a')](_0x3525f1[_0xf500('0x39')]);_0x1d0734[_0xf500('0x41')]=_[_0xf500('0x4a')](_0x1d0734['model'],_0x1d0734[_0xf500('0x39')]);_0x2e25c9[_0xf500('0x3b')]=_[_0xf500('0x4a')](_0x1d0734[_0xf500('0x38')],qs[_0xf500('0x3c')](_0x3525f1[_0xf500('0x39')][_0xf500('0x3c')]));_0x2e25c9[_0xf500('0x3b')]=_0x2e25c9[_0xf500('0x3b')][_0xf500('0x3d')]?_0x2e25c9[_0xf500('0x3b')]:_0x1d0734[_0xf500('0x38')];if(_0x3525f1['query']['includeAll']){_0x2e25c9[_0xf500('0x4b')]=[{'all':!![]}];}_0x2e25c9=_[_0xf500('0x44')]({},_0x2e25c9,_0x3525f1[_0xf500('0x4c')]);return db[_0xf500('0x33')][_0xf500('0x4d')](_0x2e25c9)[_0xf500('0x2c')](handleEntityNotFound(_0x21885b,null))[_0xf500('0x2c')](respondWithResult(_0x21885b,null))['catch'](handleError(_0x21885b,null));};exports[_0xf500('0x4e')]=function(_0x5973c5,_0x9a7376){return db[_0xf500('0x33')][_0xf500('0x4e')](_0x5973c5[_0xf500('0x4f')],{})[_0xf500('0x2c')](function(_0x1106e0){var _0x4cca44=_0x5973c5[_0xf500('0x50')]['get']({'plain':!![]});if(!_0x4cca44)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4cca44[_0xf500('0x51')]===_0xf500('0x50')){var _0x1bd48d=_0x1106e0[_0xf500('0x2b')]({'plain':!![]});var _0x5b64b5=_0xf500('0x52');return db[_0xf500('0x53')]['find']({'where':{'name':_0x5b64b5,'userProfileId':_0x4cca44[_0xf500('0x54')]},'raw':!![]})[_0xf500('0x2c')](function(_0x39bf62){if(_0x39bf62&&_0x39bf62[_0xf500('0x55')]===0x0){return db[_0xf500('0x56')][_0xf500('0x4e')]({'name':_0x1bd48d[_0xf500('0x2f')],'resourceId':_0x1bd48d['id'],'type':_0x39bf62['name'],'sectionId':_0x39bf62['id']},{})[_0xf500('0x2c')](function(){return _0x1106e0;});}else{return _0x1106e0;}})['catch'](function(_0x21bfdd){logger[_0xf500('0x2d')](_0xf500('0x57'),_0x21bfdd);throw _0x21bfdd;});}return _0x1106e0;})['then'](respondWithResult(_0x9a7376,0xc9))['catch'](handleError(_0x9a7376,null));};exports[_0xf500('0x29')]=function(_0x9f628b,_0x51aea9){if(_0x9f628b[_0xf500('0x4f')]['id']){delete _0x9f628b[_0xf500('0x4f')]['id'];}return db[_0xf500('0x33')]['find']({'where':{'id':_0x9f628b[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](handleEntityNotFound(_0x51aea9,null))[_0xf500('0x2c')](saveUpdates(_0x9f628b['body'],null))[_0xf500('0x2c')](respondWithResult(_0x51aea9,null))[_0xf500('0x49')](handleError(_0x51aea9,null));};exports[_0xf500('0x2a')]=function(_0x114825,_0x47eca6){return db['MailQueue'][_0xf500('0x4d')]({'where':{'id':_0x114825[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](handleEntityNotFound(_0x47eca6,null))[_0xf500('0x2c')](removeEntity(_0x47eca6,null))[_0xf500('0x49')](handleError(_0x47eca6,null));};exports[_0xf500('0x59')]=function(_0x4693d4,_0x19367f){return db[_0xf500('0x33')][_0xf500('0x59')]()[_0xf500('0x2c')](respondWithResult(_0x19367f,null))[_0xf500('0x49')](handleError(_0x19367f,null));};exports[_0xf500('0x5a')]=function(_0x2a23f8,_0x482f27,_0x225810){var _0x1ccd65={'raw':!![],'where':{}},_0x370842={},_0xe53320;return db['MailQueue'][_0xf500('0x5b')]({'where':{'id':_0x2a23f8[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](handleEntityNotFound(_0x482f27,null))['then'](function(_0x32c552){if(_0x32c552){_0xe53320=_0x32c552[_0xf500('0x2b')]({'plain':!![]});_0x370842[_0xf500('0x38')]=_['keys'](db[_0xf500('0x5c')][_0xf500('0x34')]);_0x370842['query']=_[_0xf500('0x3a')](_0x2a23f8[_0xf500('0x39')]);_0x370842[_0xf500('0x41')]=_['intersection'](_0x370842[_0xf500('0x38')],_0x370842['query']);_0x1ccd65['attributes']=_[_0xf500('0x4a')](_0x370842[_0xf500('0x38')],qs[_0xf500('0x3c')](_0x2a23f8['query'][_0xf500('0x3c')]));_0x1ccd65[_0xf500('0x3b')]=_0x1ccd65['attributes']['length']?_0x1ccd65[_0xf500('0x3b')]:_0x370842[_0xf500('0x38')];if(!_0x2a23f8[_0xf500('0x39')][_0xf500('0x5d')](_0xf500('0x3e'))){_0x1ccd65[_0xf500('0x23')]=qs[_0xf500('0x23')](_0x2a23f8[_0xf500('0x39')][_0xf500('0x23')]);_0x1ccd65[_0xf500('0x25')]=qs['offset'](_0x2a23f8['query'][_0xf500('0x25')]);}_0x1ccd65[_0xf500('0x5e')]=qs[_0xf500('0x3f')](_0x2a23f8[_0xf500('0x39')][_0xf500('0x3f')]);_0x1ccd65[_0xf500('0x40')]=qs[_0xf500('0x41')](_[_0xf500('0x42')](_0x2a23f8[_0xf500('0x39')],_0x370842[_0xf500('0x41')]));_0x1ccd65[_0xf500('0x40')][_0xf500('0x5f')]=_0x32c552['id'];if(_0x2a23f8[_0xf500('0x39')][_0xf500('0x43')]){_0x1ccd65[_0xf500('0x40')]=_[_0xf500('0x44')](_0x1ccd65[_0xf500('0x40')],{'$or':_[_0xf500('0x32')](_0x1ccd65[_0xf500('0x3b')],function(_0x478fd2){var _0x436497={};_0x436497[_0x478fd2]={'$like':'%'+_0x2a23f8[_0xf500('0x39')][_0xf500('0x43')]+'%'};return _0x436497;})});}_0x1ccd65=_['merge']({},_0x1ccd65,_0x2a23f8[_0xf500('0x4c')]);return db[_0xf500('0x5c')][_0xf500('0x47')](_0x1ccd65);}})[_0xf500('0x2c')](function(_0x50d8f7){if(_0x50d8f7){return db[_0xf500('0x60')][_0xf500('0x61')]({'where':{'id':_[_0xf500('0x32')](_0x50d8f7,_0xf500('0x62')),'role':_0xf500('0x63')},'attributes':['id',_0xf500('0x2f'),'mailPause',_0xf500('0x64'),_0xf500('0x65')]});}})[_0xf500('0x2c')](function(_0x30cf9a){if(_0x30cf9a){return{'count':_0x30cf9a['count'],'rows':_[_0xf500('0x32')](_0x30cf9a[_0xf500('0x48')],function(_0x3da3b7){return{'membername':_0x3da3b7[_0xf500('0x2f')],'UserId':_0x3da3b7['id'],'queue_name':_0xe53320[_0xf500('0x2f')],'MailQueueId':_0xe53320['id'],'interface':util['format']('%s/%s',_0xf500('0x66'),_0x3da3b7['name']),'penalty':0x0,'paused':_0x3da3b7[_0xf500('0x67')],'createdAt':_0x3da3b7['createdAt'],'updatedAt':_0x3da3b7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf500('0x2c')](respondWithFilteredResult(_0x482f27,_0x1ccd65))[_0xf500('0x49')](handleError(_0x482f27,null));};exports[_0xf500('0x68')]=function(_0x327f4c,_0x176c40,_0x4a8366){var _0x2d2a9e={};var _0x27a95e={};var _0x33e1f3;var _0x1a90bc;return db[_0xf500('0x33')]['findOne']({'where':{'id':_0x327f4c[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](handleEntityNotFound(_0x176c40,null))[_0xf500('0x2c')](function(_0x32b6d8){if(_0x32b6d8){_0x33e1f3=_0x32b6d8;_0x27a95e['model']=_['keys'](db['Team'][_0xf500('0x34')]);_0x27a95e[_0xf500('0x39')]=_[_0xf500('0x3a')](_0x327f4c[_0xf500('0x39')]);_0x27a95e['filters']=_[_0xf500('0x4a')](_0x27a95e['model'],_0x27a95e[_0xf500('0x39')]);_0x2d2a9e[_0xf500('0x3b')]=_['intersection'](_0x27a95e[_0xf500('0x38')],qs[_0xf500('0x3c')](_0x327f4c[_0xf500('0x39')][_0xf500('0x3c')]));_0x2d2a9e[_0xf500('0x3b')]=_0x2d2a9e[_0xf500('0x3b')][_0xf500('0x3d')]?_0x2d2a9e[_0xf500('0x3b')]:_0x27a95e[_0xf500('0x38')];_0x2d2a9e[_0xf500('0x5e')]=qs[_0xf500('0x3f')](_0x327f4c['query'][_0xf500('0x3f')]);_0x2d2a9e['where']=qs[_0xf500('0x41')](_[_0xf500('0x42')](_0x327f4c[_0xf500('0x39')],_0x27a95e[_0xf500('0x41')]));if(_0x327f4c[_0xf500('0x39')]['filter']){_0x2d2a9e[_0xf500('0x40')]=_[_0xf500('0x44')](_0x2d2a9e['where'],{'$or':_[_0xf500('0x32')](_0x2d2a9e[_0xf500('0x3b')],function(_0x5afb5d){var _0x25deb7={};_0x25deb7[_0x5afb5d]={'$like':'%'+_0x327f4c[_0xf500('0x39')][_0xf500('0x43')]+'%'};return _0x25deb7;})});}_0x2d2a9e=_[_0xf500('0x44')]({},_0x2d2a9e,_0x327f4c[_0xf500('0x4c')]);return _0x33e1f3[_0xf500('0x68')](_0x2d2a9e);}})[_0xf500('0x2c')](function(_0xbe9890){if(_0xbe9890){_0x1a90bc=_0xbe9890[_0xf500('0x3d')];if(!_0x327f4c[_0xf500('0x39')][_0xf500('0x5d')](_0xf500('0x3e'))){_0x2d2a9e[_0xf500('0x23')]=qs[_0xf500('0x23')](_0x327f4c['query'][_0xf500('0x23')]);_0x2d2a9e['offset']=qs[_0xf500('0x25')](_0x327f4c[_0xf500('0x39')][_0xf500('0x25')]);}return _0x33e1f3[_0xf500('0x68')](_0x2d2a9e);}})[_0xf500('0x2c')](function(_0x1203cf){if(_0x1203cf){return _0x1203cf?{'count':_0x1a90bc,'rows':_0x1203cf}:null;}})[_0xf500('0x2c')](respondWithResult(_0x176c40,null))['catch'](handleError(_0x176c40,null));};exports[_0xf500('0x69')]=function(_0x595229,_0x4369c8,_0x437425){var _0x38bae3=_0x595229[_0xf500('0x4f')]['ids'];return db['Team'][_0xf500('0x47')]({'where':{'id':_0x38bae3},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xf500('0x2f'),'online',_0xf500('0x6a'),_0xf500('0x6b')],'raw':!![]}]})['then'](function(_0x3c409e){if(_0x3c409e){var _0x2f969f=_[_0xf500('0x6c')](_0x3c409e,function(_0x4674c4){var _0x1c5b37=_0x4674c4['get']({'plain':!![]});return _0x1c5b37['Agents'];});return db[_0xf500('0x33')][_0xf500('0x4d')]({'where':{'id':_0x595229[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](function(_0x225a63){return db[_0xf500('0x6d')][_0xf500('0x6e')](function(_0x5e72aa){return _0x225a63['addTeams'](_0x38bae3,{'transaction':_0x5e72aa})[_0xf500('0x2c')](function(){return BPromise[_0xf500('0x6f')](_0x2f969f,function(_0x4ca784){return db[_0xf500('0x5c')][_0xf500('0x70')]({'where':{'UserId':_0x4ca784['id'],'MailQueueId':_0x595229[_0xf500('0x58')]['id']},'transaction':_0x5e72aa});});})[_0xf500('0x2c')](function(){_0x2f969f[_0xf500('0x71')](function(_0x4655ae){socket[_0xf500('0x72')](_0xf500('0x73'),{'UserId':_0x4655ae['id'],'MailQueueId':_0x225a63['id']});});});});});}})['then'](respondWithStatusCode(_0x4369c8,null))['catch'](handleError(_0x4369c8,null));};exports[_0xf500('0x74')]=function(_0x553fdc,_0x49e455,_0x59da1e){return db['Team'][_0xf500('0x47')]({'where':{'id':_0x553fdc[_0xf500('0x39')][_0xf500('0x75')]},'attributes':['id'],'include':[{'model':db[_0xf500('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf500('0x2c')](handleEntityNotFound(_0x49e455,null))[_0xf500('0x2c')](function(_0x2acb08){var _0x4615f8=_['map'](_0x2acb08,'id');var _0x2ee33d=[];var _0x2459c4=[];var _0x2829f3=squel[_0xf500('0x76')]();_0x2829f3[_0xf500('0x77')]('tq.TeamId')['from'](_0xf500('0x78'),'tq')[_0xf500('0x79')](_0xf500('0x7a'),'ut',_0xf500('0x7b'))['where'](_0xf500('0x7c'),_0x553fdc[_0xf500('0x58')]['id']);for(var _0x12b100=0x0;_0x12b100<_0x2acb08[_0xf500('0x3d')];_0x12b100+=0x1){let _0x20ac5a=_0x2acb08[_0x12b100];for(var _0x2b2e71=0x0;_0x2b2e71<_0x20ac5a[_0xf500('0x7d')][_0xf500('0x3d')];_0x2b2e71+=0x1){let _0x1e3036=_0x20ac5a['Agents'][_0x2b2e71];var _0x1c0ee6=_0x2829f3[_0xf500('0x7e')]();_0x1c0ee6[_0xf500('0x40')](_0xf500('0x7f'),_0x1e3036['id']);_0x2459c4[_0xf500('0x80')](db[_0xf500('0x6d')][_0xf500('0x39')](_0x1c0ee6[_0xf500('0x81')](),{'type':db[_0xf500('0x6d')][_0xf500('0x82')][_0xf500('0x83')]})['then'](function(_0x271ce7){if(_0x271ce7[_0xf500('0x3d')]===0x1){return _0x1e3036['id'];}else{var _0x1afe3c=_[_0xf500('0x84')](_[_0xf500('0x32')](_0x271ce7,_0xf500('0x85')),function(_0x5abe80){return _['includes'](_0x4615f8,_0x5abe80);});if(_0x1afe3c){return _0x1e3036['id'];}}}));}}return BPromise['all'](_0x2459c4)['then'](function(_0x3f4a5b){_0x2ee33d=_(_0x2ee33d)['union'](_0x3f4a5b)[_0xf500('0x86')]()['value']();return db[_0xf500('0x33')][_0xf500('0x4d')]({'where':{'id':_0x553fdc[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](function(_0x20869c){return db[_0xf500('0x6d')][_0xf500('0x6e')](function(_0x2277b3){return _0x20869c[_0xf500('0x74')](_0x553fdc['query'][_0xf500('0x75')],{'transaction':_0x2277b3})[_0xf500('0x2c')](function(){if(!_['isEmpty'](_0x2ee33d)){return _0x20869c[_0xf500('0x87')](_0x2ee33d,{'transaction':_0x2277b3});}})[_0xf500('0x2c')](function(){_0x2ee33d[_0xf500('0x71')](function(_0x235c09){socket['emit']('userMailQueue:remove',{'UserId':_0x235c09,'MailQueueId':_0x20869c['id']});});});});});});})[_0xf500('0x2c')](respondWithStatusCode(_0x49e455,null))['catch'](handleError(_0x49e455,null));};exports[_0xf500('0x88')]=function(_0x2acb54,_0x4a9580,_0x570f1e){return db[_0xf500('0x33')][_0xf500('0x4d')]({'where':{'id':_0x2acb54[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](handleEntityNotFound(_0x4a9580,null))[_0xf500('0x2c')](function(_0x762bbc){if(_0x762bbc){return _0x762bbc[_0xf500('0x88')](_0x2acb54[_0xf500('0x4f')][_0xf500('0x75')],_['omit'](_0x2acb54['body'],[_0xf500('0x75'),'id'])||{})['spread'](function(_0x2b1097){for(var _0x414bee=0x0;_0x414bee<_0x2acb54[_0xf500('0x4f')][_0xf500('0x75')][_0xf500('0x3d')];_0x414bee+=0x1){socket['emit'](_0xf500('0x73'),{'UserId':Number(_0x2acb54[_0xf500('0x4f')][_0xf500('0x75')][_0x414bee]),'MailQueueId':Number(_0x2acb54[_0xf500('0x58')]['id'])});}return _0x2b1097;});}})[_0xf500('0x2c')](respondWithResult(_0x4a9580,null))[_0xf500('0x49')](handleError(_0x4a9580,null));};exports['removeAgents']=function(_0x42be15,_0x1f4ca3,_0x15c330){return db[_0xf500('0x33')][_0xf500('0x4d')]({'where':{'id':_0x42be15[_0xf500('0x58')]['id']}})['then'](handleEntityNotFound(_0x1f4ca3,null))[_0xf500('0x2c')](function(_0x4947e5){if(_0x4947e5){return _0x4947e5['removeAgents'](_0x42be15[_0xf500('0x39')][_0xf500('0x75')])[_0xf500('0x2c')](function(){if(_[_0xf500('0x89')](_0x42be15[_0xf500('0x39')][_0xf500('0x75')])){for(var _0x9c2eea=0x0;_0x9c2eea<_0x42be15['query'][_0xf500('0x75')][_0xf500('0x3d')];_0x9c2eea+=0x1){socket[_0xf500('0x72')](_0xf500('0x8a'),{'UserId':Number(_0x42be15[_0xf500('0x39')][_0xf500('0x75')][_0x9c2eea]),'MailQueueId':Number(_0x42be15[_0xf500('0x58')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x42be15[_0xf500('0x39')][_0xf500('0x75')]),'MailQueueId':Number(_0x42be15['params']['id'])});}});}})[_0xf500('0x2c')](respondWithStatusCode(_0x1f4ca3,null))[_0xf500('0x49')](handleError(_0x1f4ca3,null));};exports[_0xf500('0x8b')]=function(_0x21f57a,_0x384939,_0x1c7e29){var _0x37b1e9={};var _0x4fe29a={};var _0x2ec5d9;var _0x457acf;return db[_0xf500('0x33')][_0xf500('0x5b')]({'where':{'id':_0x21f57a[_0xf500('0x58')]['id']}})[_0xf500('0x2c')](handleEntityNotFound(_0x384939,null))[_0xf500('0x2c')](function(_0x37a899){if(_0x37a899){_0x2ec5d9=_0x37a899;_0x4fe29a[_0xf500('0x38')]=_[_0xf500('0x3a')](db[_0xf500('0x60')]['rawAttributes']);_0x4fe29a[_0xf500('0x39')]=_[_0xf500('0x3a')](_0x21f57a[_0xf500('0x39')]);_0x4fe29a[_0xf500('0x41')]=_[_0xf500('0x4a')](_0x4fe29a['model'],_0x4fe29a[_0xf500('0x39')]);_0x37b1e9['attributes']=_['intersection'](_0x4fe29a['model'],qs[_0xf500('0x3c')](_0x21f57a[_0xf500('0x39')][_0xf500('0x3c')]));_0x37b1e9[_0xf500('0x3b')]=_0x37b1e9['attributes']['length']?_0x37b1e9[_0xf500('0x3b')]:_0x4fe29a[_0xf500('0x38')];_0x37b1e9[_0xf500('0x5e')]=qs[_0xf500('0x3f')](_0x21f57a[_0xf500('0x39')][_0xf500('0x3f')]);_0x37b1e9[_0xf500('0x40')]=qs['filters'](_[_0xf500('0x42')](_0x21f57a[_0xf500('0x39')],_0x4fe29a[_0xf500('0x41')]));if(_0x21f57a[_0xf500('0x39')][_0xf500('0x43')]){_0x37b1e9[_0xf500('0x40')]=_[_0xf500('0x44')](_0x37b1e9[_0xf500('0x40')],{'$or':_[_0xf500('0x32')](_0x37b1e9[_0xf500('0x3b')],function(_0x8b745a){var _0x564339={};_0x564339[_0x8b745a]={'$like':'%'+_0x21f57a[_0xf500('0x39')][_0xf500('0x43')]+'%'};return _0x564339;})});}_0x37b1e9=_['merge']({},_0x37b1e9,_0x21f57a[_0xf500('0x4c')]);return _0x2ec5d9[_0xf500('0x8b')](_0x37b1e9);}})[_0xf500('0x2c')](function(_0x264b36){if(_0x264b36){_0x457acf=_0x264b36[_0xf500('0x3d')];if(!_0x21f57a[_0xf500('0x39')][_0xf500('0x5d')]('nolimit')){_0x37b1e9[_0xf500('0x23')]=qs[_0xf500('0x23')](_0x21f57a['query'][_0xf500('0x23')]);_0x37b1e9[_0xf500('0x25')]=qs[_0xf500('0x25')](_0x21f57a['query']['offset']);}return _0x2ec5d9[_0xf500('0x8b')](_0x37b1e9);}})[_0xf500('0x2c')](function(_0x4316a2){if(_0x4316a2){return _0x4316a2?{'count':_0x457acf,'rows':_0x4316a2}:null;}})[_0xf500('0x2c')](respondWithResult(_0x384939,null))['catch'](handleError(_0x384939,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 04fedaf..d3ef14b 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 _0xb980=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove'];(function(_0x253cb0,_0x1bdd2d){var _0x7be9d6=function(_0x2ffe4c){while(--_0x2ffe4c){_0x253cb0['push'](_0x253cb0['shift']());}};_0x7be9d6(++_0x1bdd2d);}(_0xb980,0xca));var _0x0b98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb980[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x0b98('0x0'));var MailQueue=require(_0x0b98('0x1'))['db'][_0x0b98('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0b98('0x3')](0x0);var events={'afterCreate':_0x0b98('0x4'),'afterUpdate':_0x0b98('0x5'),'afterDestroy':_0x0b98('0x6')};function emitEvent(_0x2554a5){return function(_0xbfb22f,_0x1f5a37,_0x106750){MailQueueEvents[_0x0b98('0x7')](_0x2554a5+':'+_0xbfb22f['id'],_0xbfb22f);MailQueueEvents[_0x0b98('0x7')](_0x2554a5,_0xbfb22f);_0x106750(null);};}for(var e in events){if(events[_0x0b98('0x8')](e)){var event=events[e];MailQueue[_0x0b98('0x9')](e,emitEvent(event));}}module[_0x0b98('0xa')]=MailQueueEvents; \ No newline at end of file +var _0xd7f1=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x17788a,_0x150887){var _0x33f47c=function(_0x120fcb){while(--_0x120fcb){_0x17788a['push'](_0x17788a['shift']());}};_0x33f47c(++_0x150887);}(_0xd7f1,0x160));var _0x1d7f=function(_0x19d4ad,_0x2a7c03){_0x19d4ad=_0x19d4ad-0x0;var _0x11c5bc=_0xd7f1[_0x19d4ad];return _0x11c5bc;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x1d7f('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1d7f('0x1')](0x0);var events={'afterCreate':_0x1d7f('0x2'),'afterUpdate':'update','afterDestroy':_0x1d7f('0x3')};function emitEvent(_0x1508d2){return function(_0x4e99c,_0x5cab00,_0x5b851b){MailQueueEvents[_0x1d7f('0x4')](_0x1508d2+':'+_0x4e99c['id'],_0x4e99c);MailQueueEvents[_0x1d7f('0x4')](_0x1508d2,_0x4e99c);_0x5b851b(null);};}for(var e in events){if(events[_0x1d7f('0x5')](e)){var event=events[e];MailQueue[_0x1d7f('0x6')](e,emitEvent(event));}}module[_0x1d7f('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 60c3c1d..0c9d41a 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 _0xb09d=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define','mail_queues'];(function(_0x86ce09,_0x2c3244){var _0x5c00ef=function(_0x40794f){while(--_0x40794f){_0x86ce09['push'](_0x86ce09['shift']());}};_0x5c00ef(++_0x2c3244);}(_0xb09d,0x108));var _0xdb09=function(_0x19b5fc,_0x2c2465){_0x19b5fc=_0x19b5fc-0x0;var _0xbf3146=_0xb09d[_0x19b5fc];return _0xbf3146;};'use strict';var _=require(_0xdb09('0x0'));var util=require(_0xdb09('0x1'));var logger=require('../../config/logger')(_0xdb09('0x2'));var moment=require(_0xdb09('0x3'));var BPromise=require(_0xdb09('0x4'));var rp=require(_0xdb09('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb09('0x6'));var config=require(_0xdb09('0x7'));var attributes=require(_0xdb09('0x8'));module[_0xdb09('0x9')]=function(_0x52c055,_0x64429c){return _0x52c055[_0xdb09('0xa')]('MailQueue',attributes,{'tableName':_0xdb09('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a1b=['exports','define','MailQueue','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes'];(function(_0x210d9a,_0x2a1b7c){var _0x34a2ee=function(_0x3581e5){while(--_0x3581e5){_0x210d9a['push'](_0x210d9a['shift']());}};_0x34a2ee(++_0x2a1b7c);}(_0x0a1b,0x142));var _0xb0a1=function(_0x2c808c,_0x1b9845){_0x2c808c=_0x2c808c-0x0;var _0x2969ff=_0x0a1b[_0x2c808c];return _0x2969ff;};'use strict';var _=require('lodash');var util=require(_0xb0a1('0x0'));var logger=require(_0xb0a1('0x1'))('api');var moment=require(_0xb0a1('0x2'));var BPromise=require(_0xb0a1('0x3'));var rp=require(_0xb0a1('0x4'));var fs=require('fs');var path=require(_0xb0a1('0x5'));var rimraf=require('rimraf');var config=require(_0xb0a1('0x6'));var attributes=require(_0xb0a1('0x7'));module[_0xb0a1('0x8')]=function(_0x2910cc,_0x4f817d){return _0x2910cc[_0xb0a1('0x9')](_0xb0a1('0xa'),attributes,{'tableName':'mail_queues','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 8c315fa..fa72ffa 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 _0xed26=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','where','limit','include','model','attributes','map','ShowMailQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4fbcff,_0x5ae332){var _0x506f5c=function(_0x2eb939){while(--_0x2eb939){_0x4fbcff['push'](_0x4fbcff['shift']());}};_0x506f5c(++_0x5ae332);}(_0xed26,0xf8));var _0x6ed2=function(_0x24703b,_0x520a13){_0x24703b=_0x24703b-0x0;var _0x5c3152=_0xed26[_0x24703b];return _0x5c3152;};'use strict';var _=require(_0x6ed2('0x0'));var util=require(_0x6ed2('0x1'));var moment=require(_0x6ed2('0x2'));var BPromise=require(_0x6ed2('0x3'));var rs=require(_0x6ed2('0x4'));var fs=require('fs');var Redis=require(_0x6ed2('0x5'));var db=require(_0x6ed2('0x6'))['db'];var utils=require(_0x6ed2('0x7'));var logger=require(_0x6ed2('0x8'))(_0x6ed2('0x9'));var config=require(_0x6ed2('0xa'));var jayson=require(_0x6ed2('0xb'));var client=jayson[_0x6ed2('0xc')][_0x6ed2('0xd')]({'port':0x232a});config[_0x6ed2('0xe')]=_['defaults'](config[_0x6ed2('0xe')],{'host':_0x6ed2('0xf'),'port':0x18eb});var socket=require(_0x6ed2('0x10'))(new Redis(config[_0x6ed2('0xe')]));require('./mailQueue.socket')[_0x6ed2('0x11')](socket);function respondWithRpcPromise(_0x555696,_0x174f90,_0x1ff3ac){return new BPromise(function(_0x40bf61,_0x231bb0){return client[_0x6ed2('0x12')](_0x555696,_0x1ff3ac)[_0x6ed2('0x13')](function(_0x5c773b){logger[_0x6ed2('0x14')](_0x6ed2('0x15'),_0x174f90,_0x6ed2('0x16'));logger[_0x6ed2('0x17')](_0x6ed2('0x18'),_0x174f90,_0x6ed2('0x16'),JSON[_0x6ed2('0x19')](_0x5c773b));if(_0x5c773b[_0x6ed2('0x1a')]){if(_0x5c773b[_0x6ed2('0x1a')][_0x6ed2('0x1b')]===0x1f4){logger[_0x6ed2('0x1a')](_0x6ed2('0x15'),_0x174f90,_0x5c773b[_0x6ed2('0x1a')][_0x6ed2('0x1c')]);return _0x231bb0(_0x5c773b[_0x6ed2('0x1a')][_0x6ed2('0x1c')]);}logger[_0x6ed2('0x1a')](_0x6ed2('0x15'),_0x174f90,_0x5c773b[_0x6ed2('0x1a')][_0x6ed2('0x1c')]);return _0x40bf61(_0x5c773b[_0x6ed2('0x1a')][_0x6ed2('0x1c')]);}else{logger[_0x6ed2('0x14')](_0x6ed2('0x15'),_0x174f90,_0x6ed2('0x16'));_0x40bf61(_0x5c773b['result']['message']);}})[_0x6ed2('0x1d')](function(_0x54c0a5){logger['error'](_0x6ed2('0x15'),_0x174f90,_0x54c0a5);_0x231bb0(_0x54c0a5);});});}exports[_0x6ed2('0x1e')]=function(_0x3d5fd6){var _0x7b9010=this;return new Promise(function(_0x4db4e4,_0x1a292f){return db[_0x6ed2('0x1f')][_0x6ed2('0x20')]({'raw':_0x3d5fd6[_0x6ed2('0x21')]?_0x3d5fd6[_0x6ed2('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x3d5fd6[_0x6ed2('0x21')]?_0x3d5fd6['options'][_0x6ed2('0x22')]||null:null,'attributes':_0x3d5fd6[_0x6ed2('0x21')]?_0x3d5fd6['options']['attributes']||null:null,'limit':_0x3d5fd6[_0x6ed2('0x21')]?_0x3d5fd6[_0x6ed2('0x21')][_0x6ed2('0x23')]||null:null,'include':_0x3d5fd6[_0x6ed2('0x21')]?_0x3d5fd6[_0x6ed2('0x21')][_0x6ed2('0x24')]?_['map'](_0x3d5fd6[_0x6ed2('0x21')][_0x6ed2('0x24')],function(_0x82553d){return{'model':db[_0x82553d[_0x6ed2('0x25')]],'as':_0x82553d['as'],'attributes':_0x82553d[_0x6ed2('0x26')],'include':_0x82553d[_0x6ed2('0x24')]?_[_0x6ed2('0x27')](_0x82553d['include'],function(_0x322cf0){return{'model':db[_0x322cf0[_0x6ed2('0x25')]],'as':_0x322cf0['as'],'attributes':_0x322cf0[_0x6ed2('0x26')],'include':_0x322cf0[_0x6ed2('0x24')]?_[_0x6ed2('0x27')](_0x322cf0[_0x6ed2('0x24')],function(_0x189aa5){return{'model':db[_0x189aa5[_0x6ed2('0x25')]],'as':_0x189aa5['as'],'attributes':_0x189aa5[_0x6ed2('0x26')]};}):[]};}):[]};}):[]:[]})[_0x6ed2('0x13')](function(_0x17f591){logger[_0x6ed2('0x14')](_0x6ed2('0x1e'),_0x3d5fd6);logger[_0x6ed2('0x17')](_0x6ed2('0x1e'),_0x3d5fd6,JSON[_0x6ed2('0x19')](_0x17f591));_0x4db4e4(_0x17f591);})[_0x6ed2('0x1d')](function(_0x487f8b){logger[_0x6ed2('0x1a')](_0x6ed2('0x1e'),_0x487f8b[_0x6ed2('0x1c')],_0x3d5fd6);_0x1a292f(_0x7b9010[_0x6ed2('0x1a')](0x1f4,_0x487f8b[_0x6ed2('0x1c')]));});});};exports[_0x6ed2('0x28')]=function(_0x604f36){var _0x446e15=this;return new Promise(function(_0x5c2915,_0x5c831d){return db[_0x6ed2('0x1f')][_0x6ed2('0x29')]({'raw':_0x604f36['options']?_0x604f36[_0x6ed2('0x21')][_0x6ed2('0x2a')]===undefined?!![]:![]:!![],'where':_0x604f36[_0x6ed2('0x21')]?_0x604f36['options'][_0x6ed2('0x22')]||null:null,'attributes':_0x604f36[_0x6ed2('0x21')]?_0x604f36[_0x6ed2('0x21')][_0x6ed2('0x26')]||null:null,'include':_0x604f36[_0x6ed2('0x21')]?_0x604f36['options'][_0x6ed2('0x24')]?_['map'](_0x604f36['options'][_0x6ed2('0x24')],function(_0x45c06c){return{'model':db[_0x45c06c[_0x6ed2('0x25')]],'as':_0x45c06c['as'],'attributes':_0x45c06c[_0x6ed2('0x26')],'include':_0x45c06c[_0x6ed2('0x24')]?_['map'](_0x45c06c[_0x6ed2('0x24')],function(_0xcbc30f){return{'model':db[_0xcbc30f[_0x6ed2('0x25')]],'as':_0xcbc30f['as'],'attributes':_0xcbc30f['attributes'],'include':_0xcbc30f[_0x6ed2('0x24')]?_['map'](_0xcbc30f[_0x6ed2('0x24')],function(_0x54c950){return{'model':db[_0x54c950['model']],'as':_0x54c950['as'],'attributes':_0x54c950[_0x6ed2('0x26')]};}):[]};}):[]};}):[]:[]})[_0x6ed2('0x13')](function(_0x5a57c8){logger[_0x6ed2('0x14')]('ShowMailQueue',_0x604f36);logger['debug']('ShowMailQueue',_0x604f36,JSON[_0x6ed2('0x19')](_0x5a57c8));_0x5c2915(_0x5a57c8);})[_0x6ed2('0x1d')](function(_0x5efaef){logger['error'](_0x6ed2('0x28'),_0x5efaef[_0x6ed2('0x1c')],_0x604f36);_0x5c831d(_0x446e15[_0x6ed2('0x1a')](0x1f4,_0x5efaef['message']));});});}; \ No newline at end of file +var _0x005d=['jayson/promise','client','http','localhost','socket.io-emitter','redis','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','options','where','attributes','limit','map','include','model','stringify','raw','ShowMailQueue','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1accf6,_0x4a9854){var _0x24e446=function(_0x487f51){while(--_0x487f51){_0x1accf6['push'](_0x1accf6['shift']());}};_0x24e446(++_0x4a9854);}(_0x005d,0x64));var _0xd005=function(_0x1d7cd5,_0x554473){_0x1d7cd5=_0x1d7cd5-0x0;var _0x99c39e=_0x005d[_0x1d7cd5];return _0x99c39e;};'use strict';var _=require(_0xd005('0x0'));var util=require('util');var moment=require(_0xd005('0x1'));var BPromise=require(_0xd005('0x2'));var rs=require(_0xd005('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd005('0x4'));var logger=require(_0xd005('0x5'))(_0xd005('0x6'));var config=require(_0xd005('0x7'));var jayson=require(_0xd005('0x8'));var client=jayson[_0xd005('0x9')][_0xd005('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xd005('0xb'),'port':0x18eb});var socket=require(_0xd005('0xc'))(new Redis(config[_0xd005('0xd')]));require('./mailQueue.socket')[_0xd005('0xe')](socket);function respondWithRpcPromise(_0x11e369,_0x1aad8d,_0x993a4e){return new BPromise(function(_0x34d4cf,_0x415a12){return client[_0xd005('0xf')](_0x11e369,_0x993a4e)[_0xd005('0x10')](function(_0x5a368d){logger[_0xd005('0x11')](_0xd005('0x12'),_0x1aad8d,_0xd005('0x13'));logger[_0xd005('0x14')](_0xd005('0x15'),_0x1aad8d,'request\x20sent',JSON['stringify'](_0x5a368d));if(_0x5a368d['error']){if(_0x5a368d[_0xd005('0x16')]['code']===0x1f4){logger[_0xd005('0x16')](_0xd005('0x12'),_0x1aad8d,_0x5a368d[_0xd005('0x16')]['message']);return _0x415a12(_0x5a368d[_0xd005('0x16')][_0xd005('0x17')]);}logger[_0xd005('0x16')](_0xd005('0x12'),_0x1aad8d,_0x5a368d['error']['message']);return _0x34d4cf(_0x5a368d[_0xd005('0x16')]['message']);}else{logger['info'](_0xd005('0x12'),_0x1aad8d,_0xd005('0x13'));_0x34d4cf(_0x5a368d[_0xd005('0x18')][_0xd005('0x17')]);}})[_0xd005('0x19')](function(_0x4defa7){logger[_0xd005('0x16')](_0xd005('0x12'),_0x1aad8d,_0x4defa7);_0x415a12(_0x4defa7);});});}exports['GetMailQueue']=function(_0x461dc3){var _0xe08666=this;return new Promise(function(_0x5e8cd8,_0x38fcd3){return db['MailQueue']['findAll']({'raw':_0x461dc3[_0xd005('0x1a')]?_0x461dc3[_0xd005('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x461dc3[_0xd005('0x1a')]?_0x461dc3['options'][_0xd005('0x1b')]||null:null,'attributes':_0x461dc3[_0xd005('0x1a')]?_0x461dc3['options'][_0xd005('0x1c')]||null:null,'limit':_0x461dc3['options']?_0x461dc3[_0xd005('0x1a')][_0xd005('0x1d')]||null:null,'include':_0x461dc3[_0xd005('0x1a')]?_0x461dc3[_0xd005('0x1a')]['include']?_[_0xd005('0x1e')](_0x461dc3[_0xd005('0x1a')][_0xd005('0x1f')],function(_0x2be2c3){return{'model':db[_0x2be2c3[_0xd005('0x20')]],'as':_0x2be2c3['as'],'attributes':_0x2be2c3[_0xd005('0x1c')],'include':_0x2be2c3[_0xd005('0x1f')]?_['map'](_0x2be2c3['include'],function(_0x6df192){return{'model':db[_0x6df192['model']],'as':_0x6df192['as'],'attributes':_0x6df192[_0xd005('0x1c')],'include':_0x6df192[_0xd005('0x1f')]?_[_0xd005('0x1e')](_0x6df192['include'],function(_0x40c52e){return{'model':db[_0x40c52e['model']],'as':_0x40c52e['as'],'attributes':_0x40c52e['attributes']};}):[]};}):[]};}):[]:[]})[_0xd005('0x10')](function(_0x181b39){logger['info']('GetMailQueue',_0x461dc3);logger[_0xd005('0x14')]('GetMailQueue',_0x461dc3,JSON[_0xd005('0x21')](_0x181b39));_0x5e8cd8(_0x181b39);})[_0xd005('0x19')](function(_0x371a14){logger[_0xd005('0x16')]('GetMailQueue',_0x371a14[_0xd005('0x17')],_0x461dc3);_0x38fcd3(_0xe08666['error'](0x1f4,_0x371a14[_0xd005('0x17')]));});});};exports['ShowMailQueue']=function(_0x15a471){var _0x54aa26=this;return new Promise(function(_0x14b381,_0x5cae34){return db['MailQueue']['find']({'raw':_0x15a471[_0xd005('0x1a')]?_0x15a471[_0xd005('0x1a')][_0xd005('0x22')]===undefined?!![]:![]:!![],'where':_0x15a471['options']?_0x15a471[_0xd005('0x1a')][_0xd005('0x1b')]||null:null,'attributes':_0x15a471['options']?_0x15a471[_0xd005('0x1a')][_0xd005('0x1c')]||null:null,'include':_0x15a471[_0xd005('0x1a')]?_0x15a471[_0xd005('0x1a')][_0xd005('0x1f')]?_['map'](_0x15a471['options'][_0xd005('0x1f')],function(_0x3e0556){return{'model':db[_0x3e0556['model']],'as':_0x3e0556['as'],'attributes':_0x3e0556[_0xd005('0x1c')],'include':_0x3e0556[_0xd005('0x1f')]?_['map'](_0x3e0556[_0xd005('0x1f')],function(_0x1a83c8){return{'model':db[_0x1a83c8['model']],'as':_0x1a83c8['as'],'attributes':_0x1a83c8[_0xd005('0x1c')],'include':_0x1a83c8[_0xd005('0x1f')]?_[_0xd005('0x1e')](_0x1a83c8[_0xd005('0x1f')],function(_0x3428e9){return{'model':db[_0x3428e9['model']],'as':_0x3428e9['as'],'attributes':_0x3428e9[_0xd005('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12d5b9){logger[_0xd005('0x11')]('ShowMailQueue',_0x15a471);logger[_0xd005('0x14')](_0xd005('0x23'),_0x15a471,JSON['stringify'](_0x12d5b9));_0x14b381(_0x12d5b9);})[_0xd005('0x19')](function(_0x138603){logger[_0xd005('0x16')](_0xd005('0x23'),_0x138603[_0xd005('0x17')],_0x15a471);_0x5cae34(_0x54aa26[_0xd005('0x16')](0x1f4,_0x138603[_0xd005('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 0cf5090..9ca170b 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 _0x2e98=['save','remove','update','removeListener','length','mailQueue:','./mailQueue.events'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x2e98,0x110));var _0x82e9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2e98[_0x3ab51d];return _0x29a04e;};'use strict';var MailQueueEvents=require(_0x82e9('0x0'));var events=[_0x82e9('0x1'),_0x82e9('0x2'),_0x82e9('0x3')];function createListener(_0x4c3fa0,_0x510c15){return function(_0x1dc2b4){_0x510c15['emit'](_0x4c3fa0,_0x1dc2b4);};}function removeListener(_0x3cfea2,_0x30ff0c){return function(){MailQueueEvents[_0x82e9('0x4')](_0x3cfea2,_0x30ff0c);};}exports['register']=function(_0x491f25){for(var _0x2f0de4=0x0,_0x2c695e=events[_0x82e9('0x5')];_0x2f0de4<_0x2c695e;_0x2f0de4++){var _0x1a864d=events[_0x2f0de4];var _0x517e13=createListener(_0x82e9('0x6')+_0x1a864d,_0x491f25);MailQueueEvents['on'](_0x1a864d,_0x517e13);}}; \ No newline at end of file +var _0x7cdc=['save','remove','register','length'];(function(_0x190203,_0x1d48aa){var _0x1fa41b=function(_0x197a34){while(--_0x197a34){_0x190203['push'](_0x190203['shift']());}};_0x1fa41b(++_0x1d48aa);}(_0x7cdc,0x190));var _0xc7cd=function(_0x5b81df,_0x29ae06){_0x5b81df=_0x5b81df-0x0;var _0x530245=_0x7cdc[_0x5b81df];return _0x530245;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xc7cd('0x0'),_0xc7cd('0x1'),'update'];function createListener(_0x1e4571,_0x333626){return function(_0x2d9828){_0x333626['emit'](_0x1e4571,_0x2d9828);};}function removeListener(_0xfa4d29,_0x3800f5){return function(){MailQueueEvents['removeListener'](_0xfa4d29,_0x3800f5);};}exports[_0xc7cd('0x2')]=function(_0x26603f){for(var _0x18bb1b=0x0,_0x2c168c=events[_0xc7cd('0x3')];_0x18bb1b<_0x2c168c;_0x18bb1b++){var _0x30089e=events[_0x18bb1b];var _0x42a4b8=createListener('mailQueue:'+_0x30089e,_0x26603f);MailQueueEvents['on'](_0x30089e,_0x42a4b8);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 6da3848..7d7c746 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 _0xf589=['index','/describe','describe','/:id','show','post','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated'];(function(_0x3e0aec,_0x3fa166){var _0x31d60e=function(_0x4e7efa){while(--_0x4e7efa){_0x3e0aec['push'](_0x3e0aec['shift']());}};_0x31d60e(++_0x3fa166);}(_0xf589,0x145));var _0x9f58=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf589[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x9f58('0x0'));var path=require(_0x9f58('0x1'));var timeout=require(_0x9f58('0x2'));var express=require(_0x9f58('0x3'));var router=express[_0x9f58('0x4')]();var fs_extra=require(_0x9f58('0x5'));var auth=require(_0x9f58('0x6'));var interaction=require(_0x9f58('0x7'));var config=require('../../config/environment');var controller=require(_0x9f58('0x8'));router[_0x9f58('0x9')]('/',auth[_0x9f58('0xa')](),controller[_0x9f58('0xb')]);router[_0x9f58('0x9')](_0x9f58('0xc'),auth[_0x9f58('0xa')](),controller[_0x9f58('0xd')]);router[_0x9f58('0x9')](_0x9f58('0xe'),auth[_0x9f58('0xa')](),controller[_0x9f58('0xf')]);router[_0x9f58('0x10')]('/',auth[_0x9f58('0xa')](),controller['create']);router[_0x9f58('0x11')]('/:id',auth[_0x9f58('0xa')](),controller[_0x9f58('0x12')]);router[_0x9f58('0x13')](_0x9f58('0xe'),auth[_0x9f58('0xa')](),controller['destroy']);module[_0x9f58('0x14')]=router; \ No newline at end of file +var _0x77c5=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x77c5,0x18d));var _0x577c=function(_0x5f3acd,_0x17e943){_0x5f3acd=_0x5f3acd-0x0;var _0x5033ea=_0x77c5[_0x5f3acd];return _0x5033ea;};'use strict';var multer=require(_0x577c('0x0'));var util=require(_0x577c('0x1'));var path=require(_0x577c('0x2'));var timeout=require(_0x577c('0x3'));var express=require(_0x577c('0x4'));var router=express[_0x577c('0x5')]();var fs_extra=require(_0x577c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x577c('0x7'));var config=require(_0x577c('0x8'));var controller=require(_0x577c('0x9'));router[_0x577c('0xa')]('/',auth[_0x577c('0xb')](),controller[_0x577c('0xc')]);router[_0x577c('0xa')](_0x577c('0xd'),auth[_0x577c('0xb')](),controller[_0x577c('0xe')]);router[_0x577c('0xa')]('/:id',auth[_0x577c('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x577c('0xf')]);router[_0x577c('0x10')](_0x577c('0x11'),auth[_0x577c('0xb')](),controller[_0x577c('0x12')]);router[_0x577c('0x13')](_0x577c('0x11'),auth['isAuthenticated'](),controller[_0x577c('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index a1a7473..e5798aa 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 _0x7f00=['exports','STRING','DATE','moment','sequelize'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x7f00,0x161));var _0x07f0=function(_0x6da7fd,_0x194362){_0x6da7fd=_0x6da7fd-0x0;var _0x4a37cc=_0x7f00[_0x6da7fd];return _0x4a37cc;};'use strict';var moment=require(_0x07f0('0x0'));var Sequelize=require(_0x07f0('0x1'));module[_0x07f0('0x2')]={'uniqueid':{'type':Sequelize[_0x07f0('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x07f0('0x4')]},'acceptAt':{'type':Sequelize[_0x07f0('0x4')]},'exitAt':{'type':Sequelize[_0x07f0('0x4')]},'reason':{'type':Sequelize[_0x07f0('0x3')]}}; \ No newline at end of file +var _0x9826=['DATE','moment','sequelize','exports','STRING'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x9826,0xa1));var _0x6982=function(_0x570134,_0x2dfc8d){_0x570134=_0x570134-0x0;var _0x5d849c=_0x9826[_0x570134];return _0x5d849c;};'use strict';var moment=require(_0x6982('0x0'));var Sequelize=require(_0x6982('0x1'));module[_0x6982('0x2')]={'uniqueid':{'type':Sequelize[_0x6982('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6982('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6982('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6982('0x4')]},'reason':{'type':Sequelize[_0x6982('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 19b35b5..2e2b00e 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 _0xc1c6=['filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','MailQueueReport','rawAttributes','type','key','model','query'];(function(_0xf948e7,_0x23219a){var _0x2f7ab4=function(_0x10782b){while(--_0x10782b){_0xf948e7['push'](_0xf948e7['shift']());}};_0x2f7ab4(++_0x23219a);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x5bed8d,_0x418dd7){_0x5bed8d=_0x5bed8d-0x0;var _0x310f6f=_0xc1c6[_0x5bed8d];return _0x310f6f;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['MailQueueReport']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['MailQueueReport'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':!![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['MailQueueReport'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['MailQueueReport']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));};exports[_0x6c1c('0x49')]=function(_0x2450ab,_0x5489ac){return db['MailQueueReport'][_0x6c1c('0x49')]()[_0x6c1c('0x25')](respondWithResult(_0x5489ac,null))['catch'](handleError(_0x5489ac,null));}; \ No newline at end of file +var _0x6d11=['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','apply','reject','then','destroy','stack','name','send','index','map','MailQueueReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','length','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','fields','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x6d11,0xbf));var _0x16d1=function(_0x13a0af,_0x480e4e){_0x13a0af=_0x13a0af-0x0;var _0x1649f3=_0x6d11[_0x13a0af];return _0x1649f3;};'use strict';var emlformat=require(_0x16d1('0x0'));var rimraf=require(_0x16d1('0x1'));var zipdir=require(_0x16d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16d1('0x3'));var moment=require('moment');var BPromise=require(_0x16d1('0x4'));var Mustache=require(_0x16d1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x16d1('0x6'));var csv=require(_0x16d1('0x7'));var ejs=require(_0x16d1('0x8'));var fs=require('fs');var fs_extra=require(_0x16d1('0x9'));var _=require(_0x16d1('0xa'));var squel=require(_0x16d1('0xb'));var crypto=require(_0x16d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x16d1('0xd'));var Papa=require(_0x16d1('0xe'));var Redis=require(_0x16d1('0xf'));var authService=require(_0x16d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16d1('0x11'));var hardwareService=require(_0x16d1('0x12'));var logger=require(_0x16d1('0x13'))(_0x16d1('0x14'));var utils=require(_0x16d1('0x15'));var config=require(_0x16d1('0x16'));var licenseUtil=require(_0x16d1('0x17'));var db=require(_0x16d1('0x18'))['db'];function respondWithStatusCode(_0x4de260,_0x32fa68){_0x32fa68=_0x32fa68||0xcc;return function(_0x2e71fa){if(_0x2e71fa){return _0x4de260[_0x16d1('0x19')](_0x32fa68);}return _0x4de260[_0x16d1('0x1a')](_0x32fa68)[_0x16d1('0x1b')]();};}function respondWithResult(_0x5a1429,_0xc034b7){_0xc034b7=_0xc034b7||0xc8;return function(_0x1b71d3){if(_0x1b71d3){return _0x5a1429[_0x16d1('0x1a')](_0xc034b7)[_0x16d1('0x1c')](_0x1b71d3);}};}function respondWithFilteredResult(_0x29ebba,_0x173e16){return function(_0x2d7e8a){if(_0x2d7e8a){var _0x4ee46c=typeof _0x173e16[_0x16d1('0x1d')]===_0x16d1('0x1e')&&typeof _0x173e16['limit']==='undefined';var _0x1a9ec8=_0x2d7e8a['count'];var _0x46a25e=_0x4ee46c?0x0:_0x173e16['offset'];var _0x1da1b8=_0x4ee46c?_0x2d7e8a['count']:_0x173e16[_0x16d1('0x1d')]+_0x173e16[_0x16d1('0x1f')];var _0x48cd70;if(_0x1da1b8>=_0x1a9ec8){_0x1da1b8=_0x1a9ec8;_0x48cd70=0xc8;}else{_0x48cd70=0xce;}_0x29ebba['status'](_0x48cd70);return _0x29ebba['set']('Content-Range',_0x46a25e+'-'+_0x1da1b8+'/'+_0x1a9ec8)[_0x16d1('0x1c')](_0x2d7e8a);}return null;};}function patchUpdates(_0x55a0e0){return function(_0x34b88f){try{jsonpatch[_0x16d1('0x20')](_0x34b88f,_0x55a0e0,!![]);}catch(_0x1f6add){return BPromise[_0x16d1('0x21')](_0x1f6add);}return _0x34b88f['save']();};}function saveUpdates(_0x2c7825,_0x58a03b){return function(_0x2a897d){if(_0x2a897d){return _0x2a897d['update'](_0x2c7825)[_0x16d1('0x22')](function(_0x8c7266){return _0x8c7266;});}return null;};}function removeEntity(_0x17e038,_0x47cad4){return function(_0x215c23){if(_0x215c23){return _0x215c23[_0x16d1('0x23')]()[_0x16d1('0x22')](function(){_0x17e038[_0x16d1('0x1a')](0xcc)[_0x16d1('0x1b')]();});}};}function handleEntityNotFound(_0x335c24,_0x4b2b5c){return function(_0x15203b){if(!_0x15203b){_0x335c24[_0x16d1('0x19')](0x194);}return _0x15203b;};}function handleError(_0x262f89,_0x346b69){_0x346b69=_0x346b69||0x1f4;return function(_0x2b8403){logger['error'](_0x2b8403[_0x16d1('0x24')]);if(_0x2b8403[_0x16d1('0x25')]){delete _0x2b8403[_0x16d1('0x25')];}_0x262f89['status'](_0x346b69)[_0x16d1('0x26')](_0x2b8403);};}exports[_0x16d1('0x27')]=function(_0x364bf7,_0x22e5b3){var _0x6396fc={},_0x462e5b={},_0x1dd574={'count':0x0,'rows':[]};var _0x562908=_[_0x16d1('0x28')](db[_0x16d1('0x29')][_0x16d1('0x2a')],function(_0x30cd8f){return{'name':_0x30cd8f['fieldName'],'type':_0x30cd8f['type'][_0x16d1('0x2b')]};});_0x462e5b[_0x16d1('0x2c')]=_[_0x16d1('0x28')](_0x562908,_0x16d1('0x25'));_0x462e5b[_0x16d1('0x2d')]=_[_0x16d1('0x2e')](_0x364bf7[_0x16d1('0x2d')]);_0x462e5b[_0x16d1('0x2f')]=_[_0x16d1('0x30')](_0x462e5b[_0x16d1('0x2c')],_0x462e5b[_0x16d1('0x2d')]);_0x6396fc[_0x16d1('0x31')]=_[_0x16d1('0x30')](_0x462e5b[_0x16d1('0x2c')],qs['fields'](_0x364bf7[_0x16d1('0x2d')]['fields']));_0x6396fc[_0x16d1('0x31')]=_0x6396fc[_0x16d1('0x31')][_0x16d1('0x32')]?_0x6396fc[_0x16d1('0x31')]:_0x462e5b[_0x16d1('0x2c')];if(!_0x364bf7[_0x16d1('0x2d')]['hasOwnProperty']('nolimit')){_0x6396fc['limit']=qs[_0x16d1('0x1f')](_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x1f')]);_0x6396fc[_0x16d1('0x1d')]=qs['offset'](_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x1d')]);}_0x6396fc['order']=qs['sort'](_0x364bf7['query'][_0x16d1('0x33')]);_0x6396fc[_0x16d1('0x34')]=qs[_0x16d1('0x2f')](_['pick'](_0x364bf7[_0x16d1('0x2d')],_0x462e5b[_0x16d1('0x2f')]),_0x562908);if(_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x35')]){_0x6396fc[_0x16d1('0x34')]=_[_0x16d1('0x36')](_0x6396fc[_0x16d1('0x34')],{'$or':_['map'](_0x562908,function(_0x50267b){if(_0x50267b['type']!==_0x16d1('0x37')){var _0x2306d3={};_0x2306d3[_0x50267b[_0x16d1('0x25')]]={'$like':'%'+_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x35')]+'%'};return _0x2306d3;}})});}_0x6396fc=_[_0x16d1('0x36')]({},_0x6396fc,_0x364bf7[_0x16d1('0x38')]);var _0x369b1c={'where':_0x6396fc['where']};return db[_0x16d1('0x29')]['count'](_0x369b1c)['then'](function(_0x352c5b){_0x1dd574[_0x16d1('0x39')]=_0x352c5b;if(_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x3a')]){_0x6396fc[_0x16d1('0x3b')]=[{'all':!![]}];}return db[_0x16d1('0x29')]['findAll'](_0x6396fc);})[_0x16d1('0x22')](function(_0x525212){_0x1dd574['rows']=_0x525212;return _0x1dd574;})['then'](respondWithFilteredResult(_0x22e5b3,_0x6396fc))['catch'](handleError(_0x22e5b3,null));};exports[_0x16d1('0x3c')]=function(_0x168e14,_0x24038b){var _0x1eb761={'raw':!![],'where':{'id':_0x168e14[_0x16d1('0x3d')]['id']}},_0x53de06={};_0x53de06['model']=_[_0x16d1('0x2e')](db[_0x16d1('0x29')][_0x16d1('0x2a')]);_0x53de06[_0x16d1('0x2d')]=_[_0x16d1('0x2e')](_0x168e14[_0x16d1('0x2d')]);_0x53de06[_0x16d1('0x2f')]=_[_0x16d1('0x30')](_0x53de06[_0x16d1('0x2c')],_0x53de06[_0x16d1('0x2d')]);_0x1eb761[_0x16d1('0x31')]=_[_0x16d1('0x30')](_0x53de06[_0x16d1('0x2c')],qs[_0x16d1('0x3e')](_0x168e14[_0x16d1('0x2d')]['fields']));_0x1eb761['attributes']=_0x1eb761[_0x16d1('0x31')][_0x16d1('0x32')]?_0x1eb761[_0x16d1('0x31')]:_0x53de06[_0x16d1('0x2c')];if(_0x168e14[_0x16d1('0x2d')][_0x16d1('0x3a')]){_0x1eb761['include']=[{'all':!![]}];}_0x1eb761=_[_0x16d1('0x36')]({},_0x1eb761,_0x168e14[_0x16d1('0x38')]);return db[_0x16d1('0x29')]['find'](_0x1eb761)['then'](handleEntityNotFound(_0x24038b,null))[_0x16d1('0x22')](respondWithResult(_0x24038b,null))[_0x16d1('0x3f')](handleError(_0x24038b,null));};exports['create']=function(_0x1cc137,_0x583151){return db[_0x16d1('0x29')][_0x16d1('0x40')](_0x1cc137[_0x16d1('0x41')],{})[_0x16d1('0x22')](respondWithResult(_0x583151,0xc9))['catch'](handleError(_0x583151,null));};exports['update']=function(_0x1d92cd,_0x8bb0c1){if(_0x1d92cd['body']['id']){delete _0x1d92cd[_0x16d1('0x41')]['id'];}return db[_0x16d1('0x29')][_0x16d1('0x42')]({'where':{'id':_0x1d92cd[_0x16d1('0x3d')]['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0x8bb0c1,null))['then'](saveUpdates(_0x1d92cd[_0x16d1('0x41')],null))['then'](respondWithResult(_0x8bb0c1,null))[_0x16d1('0x3f')](handleError(_0x8bb0c1,null));};exports[_0x16d1('0x23')]=function(_0x5d384c,_0x413acd){return db[_0x16d1('0x29')][_0x16d1('0x42')]({'where':{'id':_0x5d384c[_0x16d1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x413acd,null))['then'](removeEntity(_0x413acd,null))['catch'](handleError(_0x413acd,null));};exports[_0x16d1('0x43')]=function(_0xbf100f,_0x39fd41){return db[_0x16d1('0x29')]['describe']()[_0x16d1('0x22')](respondWithResult(_0x39fd41,null))[_0x16d1('0x3f')](handleError(_0x39fd41,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 7fdebcf..d1a0aa3 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 _0x0350=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','report_mail_queue'];(function(_0x556b4c,_0x43f1af){var _0x20b878=function(_0x2e876e){while(--_0x2e876e){_0x556b4c['push'](_0x556b4c['shift']());}};_0x20b878(++_0x43f1af);}(_0x0350,0xc4));var _0x0035=function(_0x4a40bb,_0x2b9c74){_0x4a40bb=_0x4a40bb-0x0;var _0x1f7ec1=_0x0350[_0x4a40bb];return _0x1f7ec1;};'use strict';var _=require(_0x0035('0x0'));var util=require(_0x0035('0x1'));var logger=require(_0x0035('0x2'))(_0x0035('0x3'));var moment=require(_0x0035('0x4'));var BPromise=require('bluebird');var rp=require(_0x0035('0x5'));var fs=require('fs');var path=require(_0x0035('0x6'));var rimraf=require(_0x0035('0x7'));var config=require(_0x0035('0x8'));var attributes=require(_0x0035('0x9'));module['exports']=function(_0xa1935b,_0x2bbecc){return _0xa1935b[_0x0035('0xa')]('MailQueueReport',attributes,{'tableName':_0x0035('0xb'),'paranoid':![],'indexes':[{'name':_0x0035('0xc'),'fields':[_0x0035('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7e10=['bluebird','path','rimraf','../../config/environment','exports','define','MailQueueReport','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x555e89,_0x116bce){var _0xdee237=function(_0x41a889){while(--_0x41a889){_0x555e89['push'](_0x555e89['shift']());}};_0xdee237(++_0x116bce);}(_0x7e10,0x1b8));var _0x07e1=function(_0x13511f,_0x2d8426){_0x13511f=_0x13511f-0x0;var _0x598d33=_0x7e10[_0x13511f];return _0x598d33;};'use strict';var _=require(_0x07e1('0x0'));var util=require(_0x07e1('0x1'));var logger=require(_0x07e1('0x2'))('api');var moment=require(_0x07e1('0x3'));var BPromise=require(_0x07e1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07e1('0x5'));var rimraf=require(_0x07e1('0x6'));var config=require(_0x07e1('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0x07e1('0x8')]=function(_0x232a42,_0x34ec6e){return _0x232a42[_0x07e1('0x9')](_0x07e1('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x07e1('0xb'),'fields':[_0x07e1('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 94515f3..462a246 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 _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(_0x46f659,_0x3c2c9d){var _0xbf5e5c=function(_0x6ff5ea){while(--_0x6ff5ea){_0x46f659['push'](_0x46f659['shift']());}};_0xbf5e5c(++_0x3c2c9d);}(_0xdb28,0x106));var _0x8db2=function(_0xa38a44,_0x4f847d){_0xa38a44=_0xa38a44-0x0;var _0x49dbf1=_0xdb28[_0xa38a44];return _0x49dbf1;};'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 +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(_0xe0525f,_0x2e1584){var _0x510ae1=function(_0x3da752){while(--_0x3da752){_0xe0525f['push'](_0xe0525f['shift']());}};_0x510ae1(++_0x2e1584);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 40a2024..4877b88 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x17b6fd,_0x1626ef){var _0x5f1089=function(_0x5db2b0){while(--_0x5db2b0){_0x17b6fd['push'](_0x17b6fd['shift']());}};_0x5f1089(++_0x1626ef);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1b3937,_0x5be3a0){var _0x248779=function(_0x3d6375){while(--_0x3d6375){_0x1b3937['push'](_0x1b3937['shift']());}};_0x248779(++_0x5be3a0);}(_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 7df5315..101763e 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 _0x1d7c=['exports','STRING','INTEGER','BOOLEAN','INBOX','sequelize'];(function(_0x96c979,_0x1f5e28){var _0x3e3e15=function(_0x35447c){while(--_0x35447c){_0x96c979['push'](_0x96c979['shift']());}};_0x3e3e15(++_0x1f5e28);}(_0x1d7c,0xdd));var _0xc1d7=function(_0x2d2bcb,_0x3051fc){_0x2d2bcb=_0x2d2bcb-0x0;var _0x303f0f=_0x1d7c[_0x2d2bcb];return _0x303f0f;};'use strict';var Sequelize=require(_0xc1d7('0x0'));module[_0xc1d7('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xc1d7('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xc1d7('0x2')]},'password':{'type':Sequelize[_0xc1d7('0x2')]},'port':{'type':Sequelize[_0xc1d7('0x3')]},'tls':{'type':Sequelize[_0xc1d7('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xc1d7('0x2')],'defaultValue':_0xc1d7('0x5')},'connTimeout':{'type':Sequelize[_0xc1d7('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xc1d7('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xc1d7('0x2')]},'modernAuthentication':{'type':Sequelize[_0xc1d7('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x7b92=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x1346a2,_0xc5f09a){var _0x5d13a5=function(_0x444e10){while(--_0x444e10){_0x1346a2['push'](_0x1346a2['shift']());}};_0x5d13a5(++_0xc5f09a);}(_0x7b92,0x1a2));var _0x27b9=function(_0x4fa489,_0x4cba6b){_0x4fa489=_0x4fa489-0x0;var _0x41d2ce=_0x7b92[_0x4fa489];return _0x41d2ce;};'use strict';var Sequelize=require(_0x27b9('0x0'));module[_0x27b9('0x1')]={'description':{'type':Sequelize[_0x27b9('0x2')]},'host':{'type':Sequelize[_0x27b9('0x2')]},'authentication':{'type':Sequelize[_0x27b9('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x27b9('0x2')]},'password':{'type':Sequelize[_0x27b9('0x2')]},'port':{'type':Sequelize[_0x27b9('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x27b9('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x27b9('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x27b9('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index d1c7a63..b721816 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 _0x17bc=['util','api','moment','bluebird','request-promise','path','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash'];(function(_0x427fc5,_0x53d869){var _0x5aec99=function(_0x12e0d6){while(--_0x12e0d6){_0x427fc5['push'](_0x427fc5['shift']());}};_0x5aec99(++_0x53d869);}(_0x17bc,0x8f));var _0xc17b=function(_0x7a608a,_0x154c2d){_0x7a608a=_0x7a608a-0x0;var _0x3dcda2=_0x17bc[_0x7a608a];return _0x3dcda2;};'use strict';var _=require(_0xc17b('0x0'));var util=require(_0xc17b('0x1'));var logger=require('../../config/logger')(_0xc17b('0x2'));var moment=require(_0xc17b('0x3'));var BPromise=require(_0xc17b('0x4'));var rp=require(_0xc17b('0x5'));var fs=require('fs');var path=require(_0xc17b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc17b('0x7'));module[_0xc17b('0x8')]=function(_0xf07a57,_0x53bb07){return _0xf07a57[_0xc17b('0x9')](_0xc17b('0xa'),attributes,{'tableName':_0xc17b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6162=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','./mailServerIn.attributes','define','MailServerIn','mail_servers_in'];(function(_0x453fc0,_0x10e8c0){var _0x124971=function(_0x229fbd){while(--_0x229fbd){_0x453fc0['push'](_0x453fc0['shift']());}};_0x124971(++_0x10e8c0);}(_0x6162,0x84));var _0x2616=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6162[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x2616('0x0'));var util=require(_0x2616('0x1'));var logger=require(_0x2616('0x2'))('api');var moment=require(_0x2616('0x3'));var BPromise=require(_0x2616('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2616('0x5'));var rimraf=require(_0x2616('0x6'));var config=require('../../config/environment');var attributes=require(_0x2616('0x7'));module['exports']=function(_0x9131d1,_0xd4b93f){return _0x9131d1[_0x2616('0x8')](_0x2616('0x9'),attributes,{'tableName':_0x2616('0xa'),'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 59810b2..ee3e755 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 _0x8093=['options','raw','where','attributes','limit','include','map','model','GetMailServerIn','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x5972d2,_0xfdc77a){var _0x297240=function(_0x7bc728){while(--_0x7bc728){_0x5972d2['push'](_0x5972d2['shift']());}};_0x297240(++_0xfdc77a);}(_0x8093,0xa9));var _0x3809=function(_0x1bee7a,_0xacfa2a){_0x1bee7a=_0x1bee7a-0x0;var _0x5d69d7=_0x8093[_0x1bee7a];return _0x5d69d7;};'use strict';var _=require(_0x3809('0x0'));var util=require(_0x3809('0x1'));var moment=require(_0x3809('0x2'));var BPromise=require(_0x3809('0x3'));var rs=require(_0x3809('0x4'));var fs=require('fs');var Redis=require(_0x3809('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3809('0x6'));var logger=require(_0x3809('0x7'))(_0x3809('0x8'));var config=require(_0x3809('0x9'));var jayson=require(_0x3809('0xa'));var client=jayson[_0x3809('0xb')][_0x3809('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x195cc8,_0x32d72d,_0x31db08){return new BPromise(function(_0x38aa21,_0x156d98){return client['request'](_0x195cc8,_0x31db08)[_0x3809('0xd')](function(_0xb90209){logger[_0x3809('0xe')](_0x3809('0xf'),_0x32d72d,'request\x20sent');logger['debug'](_0x3809('0x10'),_0x32d72d,'request\x20sent',JSON[_0x3809('0x11')](_0xb90209));if(_0xb90209['error']){if(_0xb90209['error'][_0x3809('0x12')]===0x1f4){logger[_0x3809('0x13')](_0x3809('0xf'),_0x32d72d,_0xb90209['error'][_0x3809('0x14')]);return _0x156d98(_0xb90209[_0x3809('0x13')][_0x3809('0x14')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x32d72d,_0xb90209['error'][_0x3809('0x14')]);return _0x38aa21(_0xb90209[_0x3809('0x13')][_0x3809('0x14')]);}else{logger['info'](_0x3809('0xf'),_0x32d72d,'request\x20sent');_0x38aa21(_0xb90209[_0x3809('0x15')][_0x3809('0x14')]);}})[_0x3809('0x16')](function(_0x190271){logger[_0x3809('0x13')](_0x3809('0xf'),_0x32d72d,_0x190271);_0x156d98(_0x190271);});});}exports['GetMailServerIn']=function(_0x5d2b34){var _0x53b283=this;return new Promise(function(_0x5e4c12,_0x56711d){return db['MailServerIn']['findAll']({'raw':_0x5d2b34[_0x3809('0x17')]?_0x5d2b34['options'][_0x3809('0x18')]===undefined?!![]:![]:!![],'where':_0x5d2b34['options']?_0x5d2b34[_0x3809('0x17')][_0x3809('0x19')]||null:null,'attributes':_0x5d2b34[_0x3809('0x17')]?_0x5d2b34[_0x3809('0x17')][_0x3809('0x1a')]||null:null,'limit':_0x5d2b34['options']?_0x5d2b34[_0x3809('0x17')][_0x3809('0x1b')]||null:null,'include':_0x5d2b34[_0x3809('0x17')]?_0x5d2b34[_0x3809('0x17')][_0x3809('0x1c')]?_[_0x3809('0x1d')](_0x5d2b34[_0x3809('0x17')][_0x3809('0x1c')],function(_0x5c79d1){return{'model':db[_0x5c79d1['model']],'as':_0x5c79d1['as'],'attributes':_0x5c79d1['attributes'],'include':_0x5c79d1[_0x3809('0x1c')]?_[_0x3809('0x1d')](_0x5c79d1[_0x3809('0x1c')],function(_0x583cb1){return{'model':db[_0x583cb1[_0x3809('0x1e')]],'as':_0x583cb1['as'],'attributes':_0x583cb1['attributes'],'include':_0x583cb1[_0x3809('0x1c')]?_[_0x3809('0x1d')](_0x583cb1[_0x3809('0x1c')],function(_0x294d56){return{'model':db[_0x294d56[_0x3809('0x1e')]],'as':_0x294d56['as'],'attributes':_0x294d56['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x470c17){logger['info'](_0x3809('0x1f'),_0x5d2b34);logger['debug']('GetMailServerIn',_0x5d2b34,JSON[_0x3809('0x11')](_0x470c17));_0x5e4c12(_0x470c17);})[_0x3809('0x16')](function(_0x296827){logger[_0x3809('0x13')](_0x3809('0x1f'),_0x296827[_0x3809('0x14')],_0x5d2b34);_0x56711d(_0x53b283['error'](0x1f4,_0x296827[_0x3809('0x14')]));});});}; \ No newline at end of file +var _0xad36=['where','attributes','include','model','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw'];(function(_0x16a5af,_0x234650){var _0xfa1bd4=function(_0x23792c){while(--_0x23792c){_0x16a5af['push'](_0x16a5af['shift']());}};_0xfa1bd4(++_0x234650);}(_0xad36,0x1c6));var _0x6ad3=function(_0x339702,_0x209fe8){_0x339702=_0x339702-0x0;var _0x492877=_0xad36[_0x339702];return _0x492877;};'use strict';var _=require(_0x6ad3('0x0'));var util=require(_0x6ad3('0x1'));var moment=require(_0x6ad3('0x2'));var BPromise=require(_0x6ad3('0x3'));var rs=require(_0x6ad3('0x4'));var fs=require('fs');var Redis=require(_0x6ad3('0x5'));var db=require(_0x6ad3('0x6'))['db'];var utils=require(_0x6ad3('0x7'));var logger=require(_0x6ad3('0x8'))(_0x6ad3('0x9'));var config=require('../../config/environment');var jayson=require(_0x6ad3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x118c7f,_0x4056ba,_0x904fc6){return new BPromise(function(_0x386e71,_0x36e256){return client['request'](_0x118c7f,_0x904fc6)['then'](function(_0x53cc18){logger[_0x6ad3('0xb')]('MailServerIn,\x20%s,\x20%s',_0x4056ba,'request\x20sent');logger[_0x6ad3('0xc')](_0x6ad3('0xd'),_0x4056ba,_0x6ad3('0xe'),JSON['stringify'](_0x53cc18));if(_0x53cc18['error']){if(_0x53cc18['error'][_0x6ad3('0xf')]===0x1f4){logger[_0x6ad3('0x10')](_0x6ad3('0x11'),_0x4056ba,_0x53cc18[_0x6ad3('0x10')][_0x6ad3('0x12')]);return _0x36e256(_0x53cc18[_0x6ad3('0x10')][_0x6ad3('0x12')]);}logger[_0x6ad3('0x10')](_0x6ad3('0x11'),_0x4056ba,_0x53cc18['error'][_0x6ad3('0x12')]);return _0x386e71(_0x53cc18[_0x6ad3('0x10')][_0x6ad3('0x12')]);}else{logger['info'](_0x6ad3('0x11'),_0x4056ba,_0x6ad3('0xe'));_0x386e71(_0x53cc18[_0x6ad3('0x13')][_0x6ad3('0x12')]);}})[_0x6ad3('0x14')](function(_0x88bd5f){logger[_0x6ad3('0x10')](_0x6ad3('0x11'),_0x4056ba,_0x88bd5f);_0x36e256(_0x88bd5f);});});}exports[_0x6ad3('0x15')]=function(_0x3ecf8e){var _0x147649=this;return new Promise(function(_0x18d648,_0x16e55c){return db[_0x6ad3('0x16')][_0x6ad3('0x17')]({'raw':_0x3ecf8e[_0x6ad3('0x18')]?_0x3ecf8e[_0x6ad3('0x18')][_0x6ad3('0x19')]===undefined?!![]:![]:!![],'where':_0x3ecf8e[_0x6ad3('0x18')]?_0x3ecf8e[_0x6ad3('0x18')][_0x6ad3('0x1a')]||null:null,'attributes':_0x3ecf8e[_0x6ad3('0x18')]?_0x3ecf8e[_0x6ad3('0x18')][_0x6ad3('0x1b')]||null:null,'limit':_0x3ecf8e['options']?_0x3ecf8e['options']['limit']||null:null,'include':_0x3ecf8e[_0x6ad3('0x18')]?_0x3ecf8e['options']['include']?_['map'](_0x3ecf8e[_0x6ad3('0x18')][_0x6ad3('0x1c')],function(_0x4d5fa0){return{'model':db[_0x4d5fa0[_0x6ad3('0x1d')]],'as':_0x4d5fa0['as'],'attributes':_0x4d5fa0[_0x6ad3('0x1b')],'include':_0x4d5fa0[_0x6ad3('0x1c')]?_['map'](_0x4d5fa0[_0x6ad3('0x1c')],function(_0x1cc6d8){return{'model':db[_0x1cc6d8[_0x6ad3('0x1d')]],'as':_0x1cc6d8['as'],'attributes':_0x1cc6d8[_0x6ad3('0x1b')],'include':_0x1cc6d8[_0x6ad3('0x1c')]?_['map'](_0x1cc6d8[_0x6ad3('0x1c')],function(_0x56c0af){return{'model':db[_0x56c0af[_0x6ad3('0x1d')]],'as':_0x56c0af['as'],'attributes':_0x56c0af[_0x6ad3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ad3('0x1e')](function(_0x4ed478){logger['info'](_0x6ad3('0x15'),_0x3ecf8e);logger[_0x6ad3('0xc')](_0x6ad3('0x15'),_0x3ecf8e,JSON[_0x6ad3('0x1f')](_0x4ed478));_0x18d648(_0x4ed478);})['catch'](function(_0x595c90){logger[_0x6ad3('0x10')](_0x6ad3('0x15'),_0x595c90[_0x6ad3('0x12')],_0x3ecf8e);_0x16e55c(_0x147649[_0x6ad3('0x10')](0x1f4,_0x595c90[_0x6ad3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index f1bb128..844d726 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 _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(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 +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(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x7a54,0x106));var _0x47a5=function(_0x1a7ade,_0x124086){_0x1a7ade=_0x1a7ade-0x0;var _0x1373d0=_0x7a54[_0x1a7ade];return _0x1373d0;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 93fb0ce..46bb1ef 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 _0xae60=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x191c53,_0x10bcdf){var _0x19de58=function(_0x37d67a){while(--_0x37d67a){_0x191c53['push'](_0x191c53['shift']());}};_0x19de58(++_0x10bcdf);}(_0xae60,0x1c7));var _0x0ae6=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xae60[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0x0ae6('0x0'));module[_0x0ae6('0x1')]={'description':{'type':Sequelize[_0x0ae6('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x0ae6('0x2')]},'pass':{'type':Sequelize[_0x0ae6('0x2')]},'port':{'type':Sequelize[_0x0ae6('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x0ae6('0x2')]},'authentication':{'type':Sequelize[_0x0ae6('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6b20=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x49b737,_0x40e7bc){var _0x2c4b06=function(_0x2e8ccf){while(--_0x2e8ccf){_0x49b737['push'](_0x49b737['shift']());}};_0x2c4b06(++_0x40e7bc);}(_0x6b20,0xd1));var _0x06b2=function(_0x1cc208,_0x3b076c){_0x1cc208=_0x1cc208-0x0;var _0x334cb5=_0x6b20[_0x1cc208];return _0x334cb5;};'use strict';var Sequelize=require(_0x06b2('0x0'));module[_0x06b2('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x06b2('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x06b2('0x2')]},'port':{'type':Sequelize[_0x06b2('0x3')]},'secure':{'type':Sequelize[_0x06b2('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x06b2('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x06b2('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 9e47e4a..28de6aa 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 _0x4ebd=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','MailServerOut','include','findAll','rows','catch','show','rawAttributes','includeAll','create','body','find','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x4da3b6,_0x233aff){var _0x574d38=function(_0x4fa45b){while(--_0x4fa45b){_0x4da3b6['push'](_0x4da3b6['shift']());}};_0x574d38(++_0x233aff);}(_0x4ebd,0x16b));var _0xd4eb=function(_0x32b78c,_0x1d5f68){_0x32b78c=_0x32b78c-0x0;var _0x44a6c5=_0x4ebd[_0x32b78c];return _0x44a6c5;};'use strict';var emlformat=require(_0xd4eb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd4eb('0x1'));var jsonpatch=require(_0xd4eb('0x2'));var rp=require('request-promise');var moment=require(_0xd4eb('0x3'));var BPromise=require(_0xd4eb('0x4'));var Mustache=require(_0xd4eb('0x5'));var util=require(_0xd4eb('0x6'));var path=require(_0xd4eb('0x7'));var sox=require(_0xd4eb('0x8'));var csv=require(_0xd4eb('0x9'));var ejs=require(_0xd4eb('0xa'));var fs=require('fs');var fs_extra=require(_0xd4eb('0xb'));var _=require(_0xd4eb('0xc'));var squel=require(_0xd4eb('0xd'));var crypto=require(_0xd4eb('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd4eb('0xf'));var toCsv=require(_0xd4eb('0x9'));var querystring=require(_0xd4eb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd4eb('0x11'));var qs=require(_0xd4eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4eb('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd4eb('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd4eb('0x15'));var db=require(_0xd4eb('0x16'))['db'];function respondWithStatusCode(_0x21de4a,_0x30bbb0){_0x30bbb0=_0x30bbb0||0xcc;return function(_0x1a0e1b){if(_0x1a0e1b){return _0x21de4a[_0xd4eb('0x17')](_0x30bbb0);}return _0x21de4a[_0xd4eb('0x18')](_0x30bbb0)[_0xd4eb('0x19')]();};}function respondWithResult(_0x2f1095,_0x4b55e1){_0x4b55e1=_0x4b55e1||0xc8;return function(_0x2d1343){if(_0x2d1343){return _0x2f1095[_0xd4eb('0x18')](_0x4b55e1)[_0xd4eb('0x1a')](_0x2d1343);}};}function respondWithFilteredResult(_0x40ed97,_0x503e5c){return function(_0x5d2b09){if(_0x5d2b09){var _0x526d2e=typeof _0x503e5c[_0xd4eb('0x1b')]===_0xd4eb('0x1c')&&typeof _0x503e5c['limit']==='undefined';var _0x562f40=_0x5d2b09[_0xd4eb('0x1d')];var _0x34a58e=_0x526d2e?0x0:_0x503e5c[_0xd4eb('0x1b')];var _0x4efc9d=_0x526d2e?_0x5d2b09[_0xd4eb('0x1d')]:_0x503e5c[_0xd4eb('0x1b')]+_0x503e5c['limit'];var _0x3ac56e;if(_0x4efc9d>=_0x562f40){_0x4efc9d=_0x562f40;_0x3ac56e=0xc8;}else{_0x3ac56e=0xce;}_0x40ed97['status'](_0x3ac56e);return _0x40ed97[_0xd4eb('0x1e')](_0xd4eb('0x1f'),_0x34a58e+'-'+_0x4efc9d+'/'+_0x562f40)[_0xd4eb('0x1a')](_0x5d2b09);}return null;};}function patchUpdates(_0xb06258){return function(_0x508008){try{jsonpatch[_0xd4eb('0x20')](_0x508008,_0xb06258,!![]);}catch(_0x39ea03){return BPromise[_0xd4eb('0x21')](_0x39ea03);}return _0x508008['save']();};}function saveUpdates(_0x37134c,_0x3982a9){return function(_0x8837f4){if(_0x8837f4){return _0x8837f4[_0xd4eb('0x22')](_0x37134c)[_0xd4eb('0x23')](function(_0x363e3e){return _0x363e3e;});}return null;};}function removeEntity(_0xe4bd26,_0x2d5be6){return function(_0x4bef19){if(_0x4bef19){return _0x4bef19[_0xd4eb('0x24')]()[_0xd4eb('0x23')](function(){_0xe4bd26['status'](0xcc)[_0xd4eb('0x19')]();});}};}function handleEntityNotFound(_0x47b4dd,_0x2e5949){return function(_0x13cd00){if(!_0x13cd00){_0x47b4dd['sendStatus'](0x194);}return _0x13cd00;};}function handleError(_0x3ec1a0,_0x79dd){_0x79dd=_0x79dd||0x1f4;return function(_0x3b4f55){logger[_0xd4eb('0x25')](_0x3b4f55[_0xd4eb('0x26')]);if(_0x3b4f55[_0xd4eb('0x27')]){delete _0x3b4f55[_0xd4eb('0x27')];}_0x3ec1a0[_0xd4eb('0x18')](_0x79dd)[_0xd4eb('0x28')](_0x3b4f55);};}exports['index']=function(_0x17fe93,_0x51c1b2){var _0x1edd69={},_0x29db19={},_0x1d9271={'count':0x0,'rows':[]};var _0x39e1d3=_[_0xd4eb('0x29')](db['MailServerOut']['rawAttributes'],function(_0x3e8c8b){return{'name':_0x3e8c8b['fieldName'],'type':_0x3e8c8b['type'][_0xd4eb('0x2a')]};});_0x29db19[_0xd4eb('0x2b')]=_['map'](_0x39e1d3,_0xd4eb('0x27'));_0x29db19[_0xd4eb('0x2c')]=_[_0xd4eb('0x2d')](_0x17fe93['query']);_0x29db19[_0xd4eb('0x2e')]=_[_0xd4eb('0x2f')](_0x29db19['model'],_0x29db19[_0xd4eb('0x2c')]);_0x1edd69[_0xd4eb('0x30')]=_[_0xd4eb('0x2f')](_0x29db19[_0xd4eb('0x2b')],qs[_0xd4eb('0x31')](_0x17fe93[_0xd4eb('0x2c')]['fields']));_0x1edd69['attributes']=_0x1edd69['attributes'][_0xd4eb('0x32')]?_0x1edd69['attributes']:_0x29db19[_0xd4eb('0x2b')];if(!_0x17fe93[_0xd4eb('0x2c')][_0xd4eb('0x33')]('nolimit')){_0x1edd69[_0xd4eb('0x34')]=qs[_0xd4eb('0x34')](_0x17fe93[_0xd4eb('0x2c')][_0xd4eb('0x34')]);_0x1edd69[_0xd4eb('0x1b')]=qs['offset'](_0x17fe93[_0xd4eb('0x2c')][_0xd4eb('0x1b')]);}_0x1edd69[_0xd4eb('0x35')]=qs[_0xd4eb('0x36')](_0x17fe93[_0xd4eb('0x2c')]['sort']);_0x1edd69[_0xd4eb('0x37')]=qs[_0xd4eb('0x2e')](_[_0xd4eb('0x38')](_0x17fe93[_0xd4eb('0x2c')],_0x29db19['filters']),_0x39e1d3);if(_0x17fe93['query'][_0xd4eb('0x39')]){_0x1edd69[_0xd4eb('0x37')]=_['merge'](_0x1edd69[_0xd4eb('0x37')],{'$or':_[_0xd4eb('0x29')](_0x39e1d3,function(_0x5cdc38){if(_0x5cdc38[_0xd4eb('0x3a')]!==_0xd4eb('0x3b')){var _0x1ba7b9={};_0x1ba7b9[_0x5cdc38[_0xd4eb('0x27')]]={'$like':'%'+_0x17fe93[_0xd4eb('0x2c')]['filter']+'%'};return _0x1ba7b9;}})});}_0x1edd69=_[_0xd4eb('0x3c')]({},_0x1edd69,_0x17fe93[_0xd4eb('0x3d')]);var _0x14ee10={'where':_0x1edd69[_0xd4eb('0x37')]};return db[_0xd4eb('0x3e')]['count'](_0x14ee10)[_0xd4eb('0x23')](function(_0x3ac0b2){_0x1d9271[_0xd4eb('0x1d')]=_0x3ac0b2;if(_0x17fe93[_0xd4eb('0x2c')]['includeAll']){_0x1edd69[_0xd4eb('0x3f')]=[{'all':!![]}];}return db[_0xd4eb('0x3e')][_0xd4eb('0x40')](_0x1edd69);})[_0xd4eb('0x23')](function(_0x316696){_0x1d9271[_0xd4eb('0x41')]=_0x316696;return _0x1d9271;})['then'](respondWithFilteredResult(_0x51c1b2,_0x1edd69))[_0xd4eb('0x42')](handleError(_0x51c1b2,null));};exports[_0xd4eb('0x43')]=function(_0x4380d1,_0x321d63){var _0x593d82={'raw':!![],'where':{'id':_0x4380d1['params']['id']}},_0x48185b={};_0x48185b[_0xd4eb('0x2b')]=_[_0xd4eb('0x2d')](db[_0xd4eb('0x3e')][_0xd4eb('0x44')]);_0x48185b['query']=_[_0xd4eb('0x2d')](_0x4380d1[_0xd4eb('0x2c')]);_0x48185b[_0xd4eb('0x2e')]=_[_0xd4eb('0x2f')](_0x48185b[_0xd4eb('0x2b')],_0x48185b[_0xd4eb('0x2c')]);_0x593d82[_0xd4eb('0x30')]=_['intersection'](_0x48185b[_0xd4eb('0x2b')],qs[_0xd4eb('0x31')](_0x4380d1[_0xd4eb('0x2c')][_0xd4eb('0x31')]));_0x593d82[_0xd4eb('0x30')]=_0x593d82['attributes'][_0xd4eb('0x32')]?_0x593d82[_0xd4eb('0x30')]:_0x48185b[_0xd4eb('0x2b')];if(_0x4380d1[_0xd4eb('0x2c')][_0xd4eb('0x45')]){_0x593d82[_0xd4eb('0x3f')]=[{'all':!![]}];}_0x593d82=_[_0xd4eb('0x3c')]({},_0x593d82,_0x4380d1[_0xd4eb('0x3d')]);return db[_0xd4eb('0x3e')]['find'](_0x593d82)['then'](handleEntityNotFound(_0x321d63,null))[_0xd4eb('0x23')](respondWithResult(_0x321d63,null))[_0xd4eb('0x42')](handleError(_0x321d63,null));};exports[_0xd4eb('0x46')]=function(_0x5a1cac,_0x278631){return db[_0xd4eb('0x3e')]['create'](_0x5a1cac['body'],{})[_0xd4eb('0x23')](respondWithResult(_0x278631,0xc9))['catch'](handleError(_0x278631,null));};exports[_0xd4eb('0x22')]=function(_0x1f858c,_0xc53f21){if(_0x1f858c[_0xd4eb('0x47')]['id']){delete _0x1f858c[_0xd4eb('0x47')]['id'];}return db['MailServerOut'][_0xd4eb('0x48')]({'where':{'id':_0x1f858c[_0xd4eb('0x49')]['id']}})[_0xd4eb('0x23')](handleEntityNotFound(_0xc53f21,null))['then'](saveUpdates(_0x1f858c[_0xd4eb('0x47')],null))[_0xd4eb('0x23')](respondWithResult(_0xc53f21,null))['catch'](handleError(_0xc53f21,null));};exports['destroy']=function(_0x3dfc0a,_0x46a475){return db[_0xd4eb('0x3e')][_0xd4eb('0x48')]({'where':{'id':_0x3dfc0a['params']['id']}})[_0xd4eb('0x23')](handleEntityNotFound(_0x46a475,null))[_0xd4eb('0x23')](removeEntity(_0x46a475,null))['catch'](handleError(_0x46a475,null));}; \ No newline at end of file +var _0x213d=['stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','end','sendStatus','error'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x213d,0x70));var _0xd213=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x213d[_0x42245d];return _0x4b211a;};'use strict';var emlformat=require(_0xd213('0x0'));var rimraf=require(_0xd213('0x1'));var zipdir=require(_0xd213('0x2'));var jsonpatch=require(_0xd213('0x3'));var rp=require(_0xd213('0x4'));var moment=require(_0xd213('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd213('0x6'));var util=require(_0xd213('0x7'));var path=require(_0xd213('0x8'));var sox=require(_0xd213('0x9'));var csv=require(_0xd213('0xa'));var ejs=require(_0xd213('0xb'));var fs=require('fs');var fs_extra=require(_0xd213('0xc'));var _=require(_0xd213('0xd'));var squel=require(_0xd213('0xe'));var crypto=require('crypto');var jsforce=require(_0xd213('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd213('0x10'));var Papa=require(_0xd213('0x11'));var Redis=require(_0xd213('0x12'));var authService=require(_0xd213('0x13'));var qs=require(_0xd213('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd213('0x15'))(_0xd213('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd213('0x17'));var db=require(_0xd213('0x18'))['db'];function respondWithStatusCode(_0x33fe1c,_0x2487e2){_0x2487e2=_0x2487e2||0xcc;return function(_0x101677){if(_0x101677){return _0x33fe1c['sendStatus'](_0x2487e2);}return _0x33fe1c[_0xd213('0x19')](_0x2487e2)['end']();};}function respondWithResult(_0x55c5fa,_0x4f40b8){_0x4f40b8=_0x4f40b8||0xc8;return function(_0x137d91){if(_0x137d91){return _0x55c5fa[_0xd213('0x19')](_0x4f40b8)[_0xd213('0x1a')](_0x137d91);}};}function respondWithFilteredResult(_0x2a996c,_0x1f9755){return function(_0x573df1){if(_0x573df1){var _0x7a1688=typeof _0x1f9755[_0xd213('0x1b')]===_0xd213('0x1c')&&typeof _0x1f9755[_0xd213('0x1d')]===_0xd213('0x1c');var _0x13e08f=_0x573df1[_0xd213('0x1e')];var _0x2220ff=_0x7a1688?0x0:_0x1f9755[_0xd213('0x1b')];var _0x526385=_0x7a1688?_0x573df1[_0xd213('0x1e')]:_0x1f9755[_0xd213('0x1b')]+_0x1f9755[_0xd213('0x1d')];var _0x25166d;if(_0x526385>=_0x13e08f){_0x526385=_0x13e08f;_0x25166d=0xc8;}else{_0x25166d=0xce;}_0x2a996c[_0xd213('0x19')](_0x25166d);return _0x2a996c['set'](_0xd213('0x1f'),_0x2220ff+'-'+_0x526385+'/'+_0x13e08f)[_0xd213('0x1a')](_0x573df1);}return null;};}function patchUpdates(_0x5798c9){return function(_0x401ba5){try{jsonpatch[_0xd213('0x20')](_0x401ba5,_0x5798c9,!![]);}catch(_0x8856d4){return BPromise[_0xd213('0x21')](_0x8856d4);}return _0x401ba5[_0xd213('0x22')]();};}function saveUpdates(_0x536168,_0x4fad10){return function(_0x1ced4b){if(_0x1ced4b){return _0x1ced4b['update'](_0x536168)['then'](function(_0x2d5abb){return _0x2d5abb;});}return null;};}function removeEntity(_0x3fcff0,_0x50fe53){return function(_0x188d49){if(_0x188d49){return _0x188d49[_0xd213('0x23')]()[_0xd213('0x24')](function(){_0x3fcff0['status'](0xcc)[_0xd213('0x25')]();});}};}function handleEntityNotFound(_0x31681c,_0x33f41c){return function(_0x4c5ee6){if(!_0x4c5ee6){_0x31681c[_0xd213('0x26')](0x194);}return _0x4c5ee6;};}function handleError(_0x1748c2,_0x1c0c75){_0x1c0c75=_0x1c0c75||0x1f4;return function(_0x350e0f){logger[_0xd213('0x27')](_0x350e0f[_0xd213('0x28')]);if(_0x350e0f['name']){delete _0x350e0f[_0xd213('0x29')];}_0x1748c2[_0xd213('0x19')](_0x1c0c75)[_0xd213('0x2a')](_0x350e0f);};}exports[_0xd213('0x2b')]=function(_0x366fd6,_0x3d2083){var _0x36a761={},_0xde5de6={},_0x176b4f={'count':0x0,'rows':[]};var _0x3c68be=_['map'](db[_0xd213('0x2c')][_0xd213('0x2d')],function(_0x4fa3cb){return{'name':_0x4fa3cb[_0xd213('0x2e')],'type':_0x4fa3cb[_0xd213('0x2f')][_0xd213('0x30')]};});_0xde5de6[_0xd213('0x31')]=_[_0xd213('0x32')](_0x3c68be,'name');_0xde5de6[_0xd213('0x33')]=_[_0xd213('0x34')](_0x366fd6['query']);_0xde5de6['filters']=_['intersection'](_0xde5de6[_0xd213('0x31')],_0xde5de6[_0xd213('0x33')]);_0x36a761[_0xd213('0x35')]=_[_0xd213('0x36')](_0xde5de6[_0xd213('0x31')],qs[_0xd213('0x37')](_0x366fd6['query']['fields']));_0x36a761[_0xd213('0x35')]=_0x36a761[_0xd213('0x35')][_0xd213('0x38')]?_0x36a761[_0xd213('0x35')]:_0xde5de6[_0xd213('0x31')];if(!_0x366fd6[_0xd213('0x33')][_0xd213('0x39')]('nolimit')){_0x36a761[_0xd213('0x1d')]=qs['limit'](_0x366fd6[_0xd213('0x33')]['limit']);_0x36a761[_0xd213('0x1b')]=qs[_0xd213('0x1b')](_0x366fd6['query']['offset']);}_0x36a761['order']=qs[_0xd213('0x3a')](_0x366fd6['query'][_0xd213('0x3a')]);_0x36a761[_0xd213('0x3b')]=qs[_0xd213('0x3c')](_[_0xd213('0x3d')](_0x366fd6['query'],_0xde5de6[_0xd213('0x3c')]),_0x3c68be);if(_0x366fd6['query'][_0xd213('0x3e')]){_0x36a761[_0xd213('0x3b')]=_[_0xd213('0x3f')](_0x36a761[_0xd213('0x3b')],{'$or':_['map'](_0x3c68be,function(_0x179d43){if(_0x179d43[_0xd213('0x2f')]!==_0xd213('0x40')){var _0x3e7a94={};_0x3e7a94[_0x179d43[_0xd213('0x29')]]={'$like':'%'+_0x366fd6[_0xd213('0x33')]['filter']+'%'};return _0x3e7a94;}})});}_0x36a761=_['merge']({},_0x36a761,_0x366fd6[_0xd213('0x41')]);var _0x3623d3={'where':_0x36a761[_0xd213('0x3b')]};return db[_0xd213('0x2c')][_0xd213('0x1e')](_0x3623d3)[_0xd213('0x24')](function(_0x3fe623){_0x176b4f[_0xd213('0x1e')]=_0x3fe623;if(_0x366fd6[_0xd213('0x33')]['includeAll']){_0x36a761[_0xd213('0x42')]=[{'all':!![]}];}return db[_0xd213('0x2c')][_0xd213('0x43')](_0x36a761);})[_0xd213('0x24')](function(_0x4d9b3c){_0x176b4f['rows']=_0x4d9b3c;return _0x176b4f;})['then'](respondWithFilteredResult(_0x3d2083,_0x36a761))[_0xd213('0x44')](handleError(_0x3d2083,null));};exports[_0xd213('0x45')]=function(_0x34156c,_0x4344ee){var _0x129739={'raw':!![],'where':{'id':_0x34156c['params']['id']}},_0x4180e5={};_0x4180e5[_0xd213('0x31')]=_[_0xd213('0x34')](db[_0xd213('0x2c')][_0xd213('0x2d')]);_0x4180e5[_0xd213('0x33')]=_[_0xd213('0x34')](_0x34156c['query']);_0x4180e5[_0xd213('0x3c')]=_[_0xd213('0x36')](_0x4180e5[_0xd213('0x31')],_0x4180e5[_0xd213('0x33')]);_0x129739[_0xd213('0x35')]=_[_0xd213('0x36')](_0x4180e5[_0xd213('0x31')],qs[_0xd213('0x37')](_0x34156c['query'][_0xd213('0x37')]));_0x129739[_0xd213('0x35')]=_0x129739[_0xd213('0x35')][_0xd213('0x38')]?_0x129739[_0xd213('0x35')]:_0x4180e5[_0xd213('0x31')];if(_0x34156c[_0xd213('0x33')][_0xd213('0x46')]){_0x129739[_0xd213('0x42')]=[{'all':!![]}];}_0x129739=_[_0xd213('0x3f')]({},_0x129739,_0x34156c[_0xd213('0x41')]);return db[_0xd213('0x2c')][_0xd213('0x47')](_0x129739)[_0xd213('0x24')](handleEntityNotFound(_0x4344ee,null))[_0xd213('0x24')](respondWithResult(_0x4344ee,null))[_0xd213('0x44')](handleError(_0x4344ee,null));};exports['create']=function(_0x195915,_0x3ce59d){return db[_0xd213('0x2c')][_0xd213('0x48')](_0x195915['body'],{})['then'](respondWithResult(_0x3ce59d,0xc9))['catch'](handleError(_0x3ce59d,null));};exports[_0xd213('0x49')]=function(_0x223673,_0x5ed1b6){if(_0x223673[_0xd213('0x4a')]['id']){delete _0x223673['body']['id'];}return db[_0xd213('0x2c')][_0xd213('0x47')]({'where':{'id':_0x223673[_0xd213('0x4b')]['id']}})[_0xd213('0x24')](handleEntityNotFound(_0x5ed1b6,null))['then'](saveUpdates(_0x223673[_0xd213('0x4a')],null))[_0xd213('0x24')](respondWithResult(_0x5ed1b6,null))[_0xd213('0x44')](handleError(_0x5ed1b6,null));};exports[_0xd213('0x23')]=function(_0x579c0a,_0x30ae1d){return db[_0xd213('0x2c')]['find']({'where':{'id':_0x579c0a['params']['id']}})[_0xd213('0x24')](handleEntityNotFound(_0x30ae1d,null))['then'](removeEntity(_0x30ae1d,null))['catch'](handleError(_0x30ae1d,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 7ad161f..a2da7f4 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 _0x6e40=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','util'];(function(_0x166eda,_0x613da7){var _0x3c37d7=function(_0x3d2ddf){while(--_0x3d2ddf){_0x166eda['push'](_0x166eda['shift']());}};_0x3c37d7(++_0x613da7);}(_0x6e40,0x14f));var _0x06e4=function(_0x291fb0,_0x234279){_0x291fb0=_0x291fb0-0x0;var _0x1e35c6=_0x6e40[_0x291fb0];return _0x1e35c6;};'use strict';var _=require('lodash');var util=require(_0x06e4('0x0'));var logger=require(_0x06e4('0x1'))(_0x06e4('0x2'));var moment=require(_0x06e4('0x3'));var BPromise=require(_0x06e4('0x4'));var rp=require(_0x06e4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06e4('0x6'));var config=require('../../config/environment');var attributes=require(_0x06e4('0x7'));module[_0x06e4('0x8')]=function(_0x4a5d3f,_0x8b19b9){return _0x4a5d3f[_0x06e4('0x9')](_0x06e4('0xa'),attributes,{'tableName':_0x06e4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb841=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0xb841,0x168));var _0x1b84=function(_0x54098f,_0x357703){_0x54098f=_0x54098f-0x0;var _0x549d40=_0xb841[_0x54098f];return _0x549d40;};'use strict';var _=require(_0x1b84('0x0'));var util=require(_0x1b84('0x1'));var logger=require(_0x1b84('0x2'))(_0x1b84('0x3'));var moment=require(_0x1b84('0x4'));var BPromise=require(_0x1b84('0x5'));var rp=require(_0x1b84('0x6'));var fs=require('fs');var path=require(_0x1b84('0x7'));var rimraf=require(_0x1b84('0x8'));var config=require(_0x1b84('0x9'));var attributes=require('./mailServerOut.attributes');module[_0x1b84('0xa')]=function(_0x1f1c71,_0x4ac748){return _0x1f1c71[_0x1b84('0xb')](_0x1b84('0xc'),attributes,{'tableName':_0x1b84('0xd'),'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 92042c0..ced5701 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 _0x7a54=['info','MailServerOut,\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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x443741,_0x1fc037){_0x443741=_0x443741-0x0;var _0x2d62bc=_0x7a54[_0x443741];return _0x2d62bc;};'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')]('MailServerOut,\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 _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x9d0ca0,_0x534e5f){var _0x61f8bf=function(_0x1fabdc){while(--_0x1fabdc){_0x9d0ca0['push'](_0x9d0ca0['shift']());}};_0x61f8bf(++_0x534e5f);}(_0x1261,0x144));var _0x1126=function(_0x1f244d,_0x19e830){_0x1f244d=_0x1f244d-0x0;var _0x16003a=_0x1261[_0x1f244d];return _0x16003a;};'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});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index e2621e7..fb1ed8f 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 _0x71bf=['post','put','delete','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x3c2758,_0x482370){var _0x53f68f=function(_0x17f81f){while(--_0x17f81f){_0x3c2758['push'](_0x3c2758['shift']());}};_0x53f68f(++_0x482370);}(_0x71bf,0x1df));var _0xf71b=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x71bf[_0x77d310];return _0x2cdce4;};'use strict';var multer=require(_0xf71b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf71b('0x1'));var router=express[_0xf71b('0x2')]();var fs_extra=require(_0xf71b('0x3'));var auth=require(_0xf71b('0x4'));var interaction=require(_0xf71b('0x5'));var config=require(_0xf71b('0x6'));var controller=require(_0xf71b('0x7'));router[_0xf71b('0x8')]('/',auth[_0xf71b('0x9')](),controller['index']);router['get'](_0xf71b('0xa'),auth[_0xf71b('0x9')](),controller[_0xf71b('0xb')]);router['get'](_0xf71b('0xc'),auth[_0xf71b('0x9')](),controller[_0xf71b('0xd')]);router[_0xf71b('0xe')]('/',auth[_0xf71b('0x9')](),controller['create']);router[_0xf71b('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf71b('0x10')](_0xf71b('0xc'),auth[_0xf71b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x053d=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','describe','get','/:id','show','post','put','update','destroy'];(function(_0x45c60c,_0xda29da){var _0x24e87c=function(_0x44bf48){while(--_0x44bf48){_0x45c60c['push'](_0x45c60c['shift']());}};_0x24e87c(++_0xda29da);}(_0x053d,0x99));var _0xd053=function(_0x46d38a,_0x4002b2){_0x46d38a=_0x46d38a-0x0;var _0x569bc0=_0x053d[_0x46d38a];return _0x569bc0;};'use strict';var multer=require(_0xd053('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd053('0x1'));var express=require(_0xd053('0x2'));var router=express[_0xd053('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd053('0x4'));var interaction=require(_0xd053('0x5'));var config=require(_0xd053('0x6'));var controller=require(_0xd053('0x7'));router['get']('/',auth[_0xd053('0x8')](),controller['index']);router['get']('/describe',auth[_0xd053('0x8')](),controller[_0xd053('0x9')]);router[_0xd053('0xa')](_0xd053('0xb'),auth[_0xd053('0x8')](),controller[_0xd053('0xc')]);router[_0xd053('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd053('0xe')](_0xd053('0xb'),auth['isAuthenticated'](),controller[_0xd053('0xf')]);router['delete'](_0xd053('0xb'),auth[_0xd053('0x8')](),controller[_0xd053('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 1bfd43c..02e6874 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 _0x90b5=['name','sequelize','STRING'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x90b5,0x139));var _0x590b=function(_0x3330c,_0x3bd322){_0x3330c=_0x3330c-0x0;var _0x345555=_0x90b5[_0x3330c];return _0x345555;};'use strict';var Sequelize=require(_0x590b('0x0'));module['exports']={'name':{'type':Sequelize[_0x590b('0x1')],'unique':_0x590b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x590b('0x1')]}}; \ No newline at end of file +var _0x938d=['name','STRING','sequelize','exports'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd938('0x0'));module[_0xd938('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd938('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd938('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d7ad67f..265ffba 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 _0x3734=['mustache','util','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','MailSubstatus','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3734,0xd7));var _0x4373=function(_0x3326a6,_0x561910){_0x3326a6=_0x3326a6-0x0;var _0x2b0298=_0x3734[_0x3326a6];return _0x2b0298;};'use strict';var emlformat=require(_0x4373('0x0'));var rimraf=require(_0x4373('0x1'));var zipdir=require(_0x4373('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4373('0x3'));var Mustache=require(_0x4373('0x4'));var util=require(_0x4373('0x5'));var path=require('path');var sox=require(_0x4373('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4373('0x7'));var squel=require(_0x4373('0x8'));var crypto=require('crypto');var jsforce=require(_0x4373('0x9'));var deskjs=require(_0x4373('0xa'));var toCsv=require(_0x4373('0xb'));var querystring=require(_0x4373('0xc'));var Papa=require(_0x4373('0xd'));var Redis=require('ioredis');var authService=require(_0x4373('0xe'));var qs=require(_0x4373('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4373('0x10'));var logger=require(_0x4373('0x11'))(_0x4373('0x12'));var utils=require('../../config/utils');var config=require(_0x4373('0x13'));var licenseUtil=require(_0x4373('0x14'));var db=require(_0x4373('0x15'))['db'];function respondWithStatusCode(_0x52db4f,_0x123ecb){_0x123ecb=_0x123ecb||0xcc;return function(_0x214eed){if(_0x214eed){return _0x52db4f[_0x4373('0x16')](_0x123ecb);}return _0x52db4f[_0x4373('0x17')](_0x123ecb)[_0x4373('0x18')]();};}function respondWithResult(_0x50bf94,_0x38e7e7){_0x38e7e7=_0x38e7e7||0xc8;return function(_0x423401){if(_0x423401){return _0x50bf94[_0x4373('0x17')](_0x38e7e7)['json'](_0x423401);}};}function respondWithFilteredResult(_0x133fc4,_0x16df9d){return function(_0x2a3ed5){if(_0x2a3ed5){var _0x46c690=typeof _0x16df9d[_0x4373('0x19')]===_0x4373('0x1a')&&typeof _0x16df9d[_0x4373('0x1b')]==='undefined';var _0x5503be=_0x2a3ed5[_0x4373('0x1c')];var _0x5053aa=_0x46c690?0x0:_0x16df9d[_0x4373('0x19')];var _0x51fc67=_0x46c690?_0x2a3ed5[_0x4373('0x1c')]:_0x16df9d[_0x4373('0x19')]+_0x16df9d[_0x4373('0x1b')];var _0x7697c2;if(_0x51fc67>=_0x5503be){_0x51fc67=_0x5503be;_0x7697c2=0xc8;}else{_0x7697c2=0xce;}_0x133fc4[_0x4373('0x17')](_0x7697c2);return _0x133fc4[_0x4373('0x1d')](_0x4373('0x1e'),_0x5053aa+'-'+_0x51fc67+'/'+_0x5503be)[_0x4373('0x1f')](_0x2a3ed5);}return null;};}function patchUpdates(_0x2c21ab){return function(_0x276ce9){try{jsonpatch[_0x4373('0x20')](_0x276ce9,_0x2c21ab,!![]);}catch(_0x3c8882){return BPromise[_0x4373('0x21')](_0x3c8882);}return _0x276ce9[_0x4373('0x22')]();};}function saveUpdates(_0x129037,_0x3b6110){return function(_0x2acb25){if(_0x2acb25){return _0x2acb25[_0x4373('0x23')](_0x129037)[_0x4373('0x24')](function(_0x701e1d){return _0x701e1d;});}return null;};}function removeEntity(_0x139586,_0x1c3323){return function(_0x464c90){if(_0x464c90){return _0x464c90[_0x4373('0x25')]()['then'](function(){_0x139586['status'](0xcc)[_0x4373('0x18')]();});}};}function handleEntityNotFound(_0x5ac734,_0x10cbbb){return function(_0x90499c){if(!_0x90499c){_0x5ac734[_0x4373('0x16')](0x194);}return _0x90499c;};}function handleError(_0x549530,_0x2995f7){_0x2995f7=_0x2995f7||0x1f4;return function(_0x3244a6){logger['error'](_0x3244a6[_0x4373('0x26')]);if(_0x3244a6['name']){delete _0x3244a6[_0x4373('0x27')];}_0x549530[_0x4373('0x17')](_0x2995f7)['send'](_0x3244a6);};}exports[_0x4373('0x28')]=function(_0x2e50f9,_0x16140a){var _0x425492={},_0x2cbbd6={},_0x3110b9={'count':0x0,'rows':[]};var _0x4ecd64=_[_0x4373('0x29')](db['MailSubstatus'][_0x4373('0x2a')],function(_0x1e4307){return{'name':_0x1e4307[_0x4373('0x2b')],'type':_0x1e4307[_0x4373('0x2c')][_0x4373('0x2d')]};});_0x2cbbd6[_0x4373('0x2e')]=_[_0x4373('0x29')](_0x4ecd64,_0x4373('0x27'));_0x2cbbd6[_0x4373('0x2f')]=_[_0x4373('0x30')](_0x2e50f9['query']);_0x2cbbd6[_0x4373('0x31')]=_[_0x4373('0x32')](_0x2cbbd6[_0x4373('0x2e')],_0x2cbbd6[_0x4373('0x2f')]);_0x425492['attributes']=_[_0x4373('0x32')](_0x2cbbd6[_0x4373('0x2e')],qs[_0x4373('0x33')](_0x2e50f9[_0x4373('0x2f')][_0x4373('0x33')]));_0x425492[_0x4373('0x34')]=_0x425492[_0x4373('0x34')]['length']?_0x425492['attributes']:_0x2cbbd6[_0x4373('0x2e')];if(!_0x2e50f9[_0x4373('0x2f')][_0x4373('0x35')]('nolimit')){_0x425492[_0x4373('0x1b')]=qs['limit'](_0x2e50f9[_0x4373('0x2f')][_0x4373('0x1b')]);_0x425492[_0x4373('0x19')]=qs[_0x4373('0x19')](_0x2e50f9[_0x4373('0x2f')][_0x4373('0x19')]);}_0x425492['order']=qs[_0x4373('0x36')](_0x2e50f9[_0x4373('0x2f')][_0x4373('0x36')]);_0x425492['where']=qs[_0x4373('0x31')](_['pick'](_0x2e50f9[_0x4373('0x2f')],_0x2cbbd6[_0x4373('0x31')]),_0x4ecd64);if(_0x2e50f9['query']['filter']){_0x425492[_0x4373('0x37')]=_[_0x4373('0x38')](_0x425492[_0x4373('0x37')],{'$or':_[_0x4373('0x29')](_0x4ecd64,function(_0x355b07){if(_0x355b07['type']!==_0x4373('0x39')){var _0xfdb096={};_0xfdb096[_0x355b07[_0x4373('0x27')]]={'$like':'%'+_0x2e50f9[_0x4373('0x2f')][_0x4373('0x3a')]+'%'};return _0xfdb096;}})});}_0x425492=_['merge']({},_0x425492,_0x2e50f9[_0x4373('0x3b')]);var _0x3d72dc={'where':_0x425492['where']};return db['MailSubstatus'][_0x4373('0x1c')](_0x3d72dc)['then'](function(_0x37bee9){_0x3110b9[_0x4373('0x1c')]=_0x37bee9;if(_0x2e50f9['query'][_0x4373('0x3c')]){_0x425492[_0x4373('0x3d')]=[{'all':!![]}];}return db[_0x4373('0x3e')][_0x4373('0x3f')](_0x425492);})[_0x4373('0x24')](function(_0x40474f){_0x3110b9[_0x4373('0x40')]=_0x40474f;return _0x3110b9;})[_0x4373('0x24')](respondWithFilteredResult(_0x16140a,_0x425492))[_0x4373('0x41')](handleError(_0x16140a,null));};exports[_0x4373('0x42')]=function(_0x3330a3,_0x4af6cc){var _0x1db938={'raw':!![],'where':{'id':_0x3330a3[_0x4373('0x43')]['id']}},_0x7badef={};_0x7badef[_0x4373('0x2e')]=_[_0x4373('0x30')](db[_0x4373('0x3e')]['rawAttributes']);_0x7badef['query']=_[_0x4373('0x30')](_0x3330a3['query']);_0x7badef[_0x4373('0x31')]=_[_0x4373('0x32')](_0x7badef[_0x4373('0x2e')],_0x7badef[_0x4373('0x2f')]);_0x1db938[_0x4373('0x34')]=_[_0x4373('0x32')](_0x7badef[_0x4373('0x2e')],qs[_0x4373('0x33')](_0x3330a3['query'][_0x4373('0x33')]));_0x1db938[_0x4373('0x34')]=_0x1db938[_0x4373('0x34')][_0x4373('0x44')]?_0x1db938[_0x4373('0x34')]:_0x7badef[_0x4373('0x2e')];if(_0x3330a3[_0x4373('0x2f')]['includeAll']){_0x1db938[_0x4373('0x3d')]=[{'all':!![]}];}_0x1db938=_[_0x4373('0x38')]({},_0x1db938,_0x3330a3[_0x4373('0x3b')]);return db[_0x4373('0x3e')][_0x4373('0x45')](_0x1db938)[_0x4373('0x24')](handleEntityNotFound(_0x4af6cc,null))[_0x4373('0x24')](respondWithResult(_0x4af6cc,null))[_0x4373('0x41')](handleError(_0x4af6cc,null));};exports[_0x4373('0x46')]=function(_0x2d921f,_0x2a7dff){return db[_0x4373('0x3e')][_0x4373('0x46')](_0x2d921f[_0x4373('0x47')],{})[_0x4373('0x24')](respondWithResult(_0x2a7dff,0xc9))[_0x4373('0x41')](handleError(_0x2a7dff,null));};exports[_0x4373('0x23')]=function(_0x43b5e1,_0x1e9570){if(_0x43b5e1[_0x4373('0x47')]['id']){delete _0x43b5e1[_0x4373('0x47')]['id'];}return db[_0x4373('0x3e')]['find']({'where':{'id':_0x43b5e1[_0x4373('0x43')]['id']}})[_0x4373('0x24')](handleEntityNotFound(_0x1e9570,null))[_0x4373('0x24')](saveUpdates(_0x43b5e1[_0x4373('0x47')],null))[_0x4373('0x24')](respondWithResult(_0x1e9570,null))[_0x4373('0x41')](handleError(_0x1e9570,null));};exports[_0x4373('0x25')]=function(_0x5e9fb2,_0x4b486f){return db['MailSubstatus']['find']({'where':{'id':_0x5e9fb2[_0x4373('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b486f,null))[_0x4373('0x24')](removeEntity(_0x4b486f,null))['catch'](handleError(_0x4b486f,null));};exports[_0x4373('0x48')]=function(_0x3c4b6d,_0x25091f){return db['MailSubstatus'][_0x4373('0x48')]()['then'](respondWithResult(_0x25091f,null))[_0x4373('0x41')](handleError(_0x25091f,null));}; \ No newline at end of file +var _0x1880=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','sort','where','pick','filter','merge','include','catch','show','params','options','find','create','body','update','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x258b8c,_0x432d66){var _0x551264=function(_0x53fd4e){while(--_0x53fd4e){_0x258b8c['push'](_0x258b8c['shift']());}};_0x551264(++_0x432d66);}(_0x1880,0x1d9));var _0x0188=function(_0x38231c,_0x1a5931){_0x38231c=_0x38231c-0x0;var _0x5be4e8=_0x1880[_0x38231c];return _0x5be4e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0188('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0188('0x1'));var rp=require(_0x0188('0x2'));var moment=require('moment');var BPromise=require(_0x0188('0x3'));var Mustache=require(_0x0188('0x4'));var util=require(_0x0188('0x5'));var path=require(_0x0188('0x6'));var sox=require(_0x0188('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0188('0x8'));var squel=require('squel');var crypto=require(_0x0188('0x9'));var jsforce=require(_0x0188('0xa'));var deskjs=require(_0x0188('0xb'));var toCsv=require(_0x0188('0xc'));var querystring=require(_0x0188('0xd'));var Papa=require('papaparse');var Redis=require(_0x0188('0xe'));var authService=require(_0x0188('0xf'));var qs=require(_0x0188('0x10'));var as=require(_0x0188('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0188('0x12'))('api');var utils=require(_0x0188('0x13'));var config=require(_0x0188('0x14'));var licenseUtil=require(_0x0188('0x15'));var db=require(_0x0188('0x16'))['db'];function respondWithStatusCode(_0x540183,_0x240d55){_0x240d55=_0x240d55||0xcc;return function(_0x2fd1a6){if(_0x2fd1a6){return _0x540183['sendStatus'](_0x240d55);}return _0x540183[_0x0188('0x17')](_0x240d55)[_0x0188('0x18')]();};}function respondWithResult(_0x277841,_0x14a4b2){_0x14a4b2=_0x14a4b2||0xc8;return function(_0x232d6a){if(_0x232d6a){return _0x277841[_0x0188('0x17')](_0x14a4b2)[_0x0188('0x19')](_0x232d6a);}};}function respondWithFilteredResult(_0x3a86e3,_0x286ca4){return function(_0x2c68fd){if(_0x2c68fd){var _0x498e5f=typeof _0x286ca4[_0x0188('0x1a')]===_0x0188('0x1b')&&typeof _0x286ca4[_0x0188('0x1c')]===_0x0188('0x1b');var _0x23ccb6=_0x2c68fd[_0x0188('0x1d')];var _0x3cf071=_0x498e5f?0x0:_0x286ca4['offset'];var _0x3dff3f=_0x498e5f?_0x2c68fd[_0x0188('0x1d')]:_0x286ca4[_0x0188('0x1a')]+_0x286ca4[_0x0188('0x1c')];var _0x575f2e;if(_0x3dff3f>=_0x23ccb6){_0x3dff3f=_0x23ccb6;_0x575f2e=0xc8;}else{_0x575f2e=0xce;}_0x3a86e3[_0x0188('0x17')](_0x575f2e);return _0x3a86e3[_0x0188('0x1e')](_0x0188('0x1f'),_0x3cf071+'-'+_0x3dff3f+'/'+_0x23ccb6)[_0x0188('0x19')](_0x2c68fd);}return null;};}function patchUpdates(_0x590d2c){return function(_0x9edb74){try{jsonpatch[_0x0188('0x20')](_0x9edb74,_0x590d2c,!![]);}catch(_0x3471da){return BPromise[_0x0188('0x21')](_0x3471da);}return _0x9edb74[_0x0188('0x22')]();};}function saveUpdates(_0x49c265,_0x202896){return function(_0x43b9b2){if(_0x43b9b2){return _0x43b9b2['update'](_0x49c265)[_0x0188('0x23')](function(_0x4824fa){return _0x4824fa;});}return null;};}function removeEntity(_0x67ace4,_0x8f00b4){return function(_0x256a64){if(_0x256a64){return _0x256a64[_0x0188('0x24')]()['then'](function(){_0x67ace4[_0x0188('0x17')](0xcc)[_0x0188('0x18')]();});}};}function handleEntityNotFound(_0x284828,_0x522fb3){return function(_0x3bc277){if(!_0x3bc277){_0x284828[_0x0188('0x25')](0x194);}return _0x3bc277;};}function handleError(_0x14f4e9,_0x15f0b8){_0x15f0b8=_0x15f0b8||0x1f4;return function(_0x55e8a3){logger[_0x0188('0x26')](_0x55e8a3[_0x0188('0x27')]);if(_0x55e8a3[_0x0188('0x28')]){delete _0x55e8a3[_0x0188('0x28')];}_0x14f4e9['status'](_0x15f0b8)[_0x0188('0x29')](_0x55e8a3);};}exports[_0x0188('0x2a')]=function(_0x324835,_0x1402e3){var _0x29d41b={},_0x519517={},_0x2eacf6={'count':0x0,'rows':[]};var _0x3633f7=_['map'](db[_0x0188('0x2b')][_0x0188('0x2c')],function(_0x1d118a){return{'name':_0x1d118a[_0x0188('0x2d')],'type':_0x1d118a[_0x0188('0x2e')][_0x0188('0x2f')]};});_0x519517['model']=_[_0x0188('0x30')](_0x3633f7,_0x0188('0x28'));_0x519517[_0x0188('0x31')]=_[_0x0188('0x32')](_0x324835[_0x0188('0x31')]);_0x519517[_0x0188('0x33')]=_[_0x0188('0x34')](_0x519517['model'],_0x519517[_0x0188('0x31')]);_0x29d41b['attributes']=_[_0x0188('0x34')](_0x519517[_0x0188('0x35')],qs['fields'](_0x324835[_0x0188('0x31')][_0x0188('0x36')]));_0x29d41b[_0x0188('0x37')]=_0x29d41b[_0x0188('0x37')][_0x0188('0x38')]?_0x29d41b[_0x0188('0x37')]:_0x519517[_0x0188('0x35')];if(!_0x324835[_0x0188('0x31')]['hasOwnProperty']('nolimit')){_0x29d41b[_0x0188('0x1c')]=qs['limit'](_0x324835['query'][_0x0188('0x1c')]);_0x29d41b['offset']=qs[_0x0188('0x1a')](_0x324835['query'][_0x0188('0x1a')]);}_0x29d41b['order']=qs[_0x0188('0x39')](_0x324835[_0x0188('0x31')]['sort']);_0x29d41b[_0x0188('0x3a')]=qs[_0x0188('0x33')](_[_0x0188('0x3b')](_0x324835[_0x0188('0x31')],_0x519517[_0x0188('0x33')]),_0x3633f7);if(_0x324835[_0x0188('0x31')][_0x0188('0x3c')]){_0x29d41b[_0x0188('0x3a')]=_[_0x0188('0x3d')](_0x29d41b[_0x0188('0x3a')],{'$or':_['map'](_0x3633f7,function(_0x3c18ad){if(_0x3c18ad[_0x0188('0x2e')]!=='VIRTUAL'){var _0x4722b7={};_0x4722b7[_0x3c18ad['name']]={'$like':'%'+_0x324835[_0x0188('0x31')][_0x0188('0x3c')]+'%'};return _0x4722b7;}})});}_0x29d41b=_['merge']({},_0x29d41b,_0x324835['options']);var _0x352258={'where':_0x29d41b[_0x0188('0x3a')]};return db[_0x0188('0x2b')][_0x0188('0x1d')](_0x352258)[_0x0188('0x23')](function(_0x1c1a5f){_0x2eacf6['count']=_0x1c1a5f;if(_0x324835['query']['includeAll']){_0x29d41b[_0x0188('0x3e')]=[{'all':!![]}];}return db[_0x0188('0x2b')]['findAll'](_0x29d41b);})[_0x0188('0x23')](function(_0x30f54b){_0x2eacf6['rows']=_0x30f54b;return _0x2eacf6;})[_0x0188('0x23')](respondWithFilteredResult(_0x1402e3,_0x29d41b))[_0x0188('0x3f')](handleError(_0x1402e3,null));};exports[_0x0188('0x40')]=function(_0x210b11,_0x15a400){var _0x3b93d1={'raw':!![],'where':{'id':_0x210b11[_0x0188('0x41')]['id']}},_0x3f95bf={};_0x3f95bf[_0x0188('0x35')]=_['keys'](db[_0x0188('0x2b')][_0x0188('0x2c')]);_0x3f95bf[_0x0188('0x31')]=_['keys'](_0x210b11['query']);_0x3f95bf[_0x0188('0x33')]=_[_0x0188('0x34')](_0x3f95bf[_0x0188('0x35')],_0x3f95bf[_0x0188('0x31')]);_0x3b93d1[_0x0188('0x37')]=_[_0x0188('0x34')](_0x3f95bf['model'],qs['fields'](_0x210b11[_0x0188('0x31')][_0x0188('0x36')]));_0x3b93d1['attributes']=_0x3b93d1[_0x0188('0x37')]['length']?_0x3b93d1[_0x0188('0x37')]:_0x3f95bf[_0x0188('0x35')];if(_0x210b11[_0x0188('0x31')]['includeAll']){_0x3b93d1[_0x0188('0x3e')]=[{'all':!![]}];}_0x3b93d1=_['merge']({},_0x3b93d1,_0x210b11[_0x0188('0x42')]);return db['MailSubstatus'][_0x0188('0x43')](_0x3b93d1)[_0x0188('0x23')](handleEntityNotFound(_0x15a400,null))['then'](respondWithResult(_0x15a400,null))[_0x0188('0x3f')](handleError(_0x15a400,null));};exports[_0x0188('0x44')]=function(_0x39b93b,_0x4914d8){return db['MailSubstatus']['create'](_0x39b93b[_0x0188('0x45')],{})[_0x0188('0x23')](respondWithResult(_0x4914d8,0xc9))['catch'](handleError(_0x4914d8,null));};exports[_0x0188('0x46')]=function(_0x1c8786,_0x699c6f){if(_0x1c8786[_0x0188('0x45')]['id']){delete _0x1c8786['body']['id'];}return db[_0x0188('0x2b')][_0x0188('0x43')]({'where':{'id':_0x1c8786[_0x0188('0x41')]['id']}})['then'](handleEntityNotFound(_0x699c6f,null))[_0x0188('0x23')](saveUpdates(_0x1c8786[_0x0188('0x45')],null))['then'](respondWithResult(_0x699c6f,null))[_0x0188('0x3f')](handleError(_0x699c6f,null));};exports[_0x0188('0x24')]=function(_0x525f01,_0x43973f){return db[_0x0188('0x2b')][_0x0188('0x43')]({'where':{'id':_0x525f01[_0x0188('0x41')]['id']}})[_0x0188('0x23')](handleEntityNotFound(_0x43973f,null))[_0x0188('0x23')](removeEntity(_0x43973f,null))[_0x0188('0x3f')](handleError(_0x43973f,null));};exports[_0x0188('0x47')]=function(_0x5f5b08,_0x39b52d){return db[_0x0188('0x2b')][_0x0188('0x47')]()[_0x0188('0x23')](respondWithResult(_0x39b52d,null))[_0x0188('0x3f')](handleError(_0x39b52d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index dd8bd8a..62cf599 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6c7=['exports','events','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x4369ef,_0x55cfbc){var _0x5b6913=function(_0x7a7436){while(--_0x7a7436){_0x4369ef['push'](_0x4369ef['shift']());}};_0x5b6913(++_0x55cfbc);}(_0xd6c7,0xc9));var _0x7d6c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xd6c7[_0x2b4411];return _0x8e41ef;};'use strict';var EventEmitter=require(_0x7d6c('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x7d6c('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x7d6c('0x2')](0x0);var events={'afterUpdate':_0x7d6c('0x3')};function emitEvent(_0x297c7a){return function(_0x4ae403,_0x32f190,_0x1c3cae){MailSubstatusEvents[_0x7d6c('0x4')](_0x297c7a+':'+_0x4ae403['id'],_0x4ae403);MailSubstatusEvents[_0x7d6c('0x4')](_0x297c7a,_0x4ae403);_0x1c3cae(null);};}for(var e in events){if(events[_0x7d6c('0x5')](e)){var event=events[e];MailSubstatus[_0x7d6c('0x6')](e,emitEvent(event));}}module[_0x7d6c('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0xa802=['exports','events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x2888a4,_0x1fc157){var _0x7f650c=function(_0x5e1880){while(--_0x5e1880){_0x2888a4['push'](_0x2888a4['shift']());}};_0x7f650c(++_0x1fc157);}(_0xa802,0xb0));var _0x2a80=function(_0xe10364,_0x4b5504){_0xe10364=_0xe10364-0x0;var _0xa04c9c=_0xa802[_0xe10364];return _0xa04c9c;};'use strict';var EventEmitter=require(_0x2a80('0x0'));var MailSubstatus=require(_0x2a80('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x2a80('0x2')](0x0);var events={'afterUpdate':_0x2a80('0x3')};function emitEvent(_0x3b93ea){return function(_0x4b7531,_0x167d42,_0x57c4fb){MailSubstatusEvents['emit'](_0x3b93ea+':'+_0x4b7531['id'],_0x4b7531);MailSubstatusEvents[_0x2a80('0x4')](_0x3b93ea,_0x4b7531);_0x57c4fb(null);};}for(var e in events){if(events[_0x2a80('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x2a80('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 2dcc79e..11cf072 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 _0xda90=['then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','update','name','mailSubstatus','_previousDataValues'];(function(_0x11392d,_0x2336c9){var _0x478fa8=function(_0x336c67){while(--_0x336c67){_0x11392d['push'](_0x11392d['shift']());}};_0x478fa8(++_0x2336c9);}(_0xda90,0x152));var _0x0da9=function(_0x5a8e60,_0x370212){_0x5a8e60=_0x5a8e60-0x0;var _0x4cdb3b=_0xda90[_0x5a8e60];return _0x4cdb3b;};'use strict';var attributes=require(_0x0da9('0x0'));module[_0x0da9('0x1')]=function(_0x2427d4){var _0x4b3d59=_0x2427d4[_0x0da9('0x2')];return _0x2427d4[_0x0da9('0x3')](_0x0da9('0x4'),attributes,{'tableName':_0x0da9('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x583517,_0x493fdf,_0x39cd2d){return _0x4b3d59['Condition'][_0x0da9('0x6')]({'value':_0x583517[_0x0da9('0x7')]},{'where':{'field':_0x0da9('0x8'),'value':_0x583517[_0x0da9('0x9')][_0x0da9('0x7')]}})[_0x0da9('0xa')](function(){_0x39cd2d();})[_0x0da9('0xb')](function(_0x43a9a0){_0x39cd2d(_0x43a9a0);});}}});}; \ No newline at end of file +var _0xc8f8=['mail_substatuses','Condition','update','name','_previousDataValues','then','catch','./mailSubstatus.attributes','models','define'];(function(_0x21f61a,_0x2bdcfc){var _0x413c32=function(_0x11a493){while(--_0x11a493){_0x21f61a['push'](_0x21f61a['shift']());}};_0x413c32(++_0x2bdcfc);}(_0xc8f8,0xf7));var _0x8c8f=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xc8f8[_0x9cd4c3];return _0x4c9025;};'use strict';var attributes=require(_0x8c8f('0x0'));module['exports']=function(_0x22b8fe){var _0x528532=_0x22b8fe[_0x8c8f('0x1')];return _0x22b8fe[_0x8c8f('0x2')]('MailSubstatus',attributes,{'tableName':_0x8c8f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x424583,_0x459bee,_0x1907d3){return _0x528532[_0x8c8f('0x4')][_0x8c8f('0x5')]({'value':_0x424583[_0x8c8f('0x6')]},{'where':{'field':'mailSubstatus','value':_0x424583[_0x8c8f('0x7')][_0x8c8f('0x6')]}})[_0x8c8f('0x8')](function(){_0x1907d3();})[_0x8c8f('0x9')](function(_0x3f0186){_0x1907d3(_0x3f0186);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 7af4f90..450af73 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 _0x082d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xe664d8,_0x383bb7){var _0x578f54=function(_0xa21d20){while(--_0xa21d20){_0xe664d8['push'](_0xe664d8['shift']());}};_0x578f54(++_0x383bb7);}(_0x082d,0x192));var _0xd082=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x082d[_0x74892f];return _0x10ee61;};'use strict';var _=require(_0xd082('0x0'));var util=require('util');var moment=require(_0xd082('0x1'));var BPromise=require(_0xd082('0x2'));var rs=require(_0xd082('0x3'));var fs=require('fs');var Redis=require(_0xd082('0x4'));var db=require(_0xd082('0x5'))['db'];var utils=require(_0xd082('0x6'));var logger=require(_0xd082('0x7'))(_0xd082('0x8'));var config=require(_0xd082('0x9'));var jayson=require(_0xd082('0xa'));var client=jayson[_0xd082('0xb')][_0xd082('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57b412,_0x7022d4,_0x546026){return new BPromise(function(_0x7064dc,_0x1a27df){return client[_0xd082('0xd')](_0x57b412,_0x546026)[_0xd082('0xe')](function(_0x4da752){logger['info'](_0xd082('0xf'),_0x7022d4,_0xd082('0x10'));logger[_0xd082('0x11')](_0xd082('0x12'),_0x7022d4,_0xd082('0x10'),JSON[_0xd082('0x13')](_0x4da752));if(_0x4da752[_0xd082('0x14')]){if(_0x4da752[_0xd082('0x14')]['code']===0x1f4){logger['error'](_0xd082('0xf'),_0x7022d4,_0x4da752[_0xd082('0x14')]['message']);return _0x1a27df(_0x4da752[_0xd082('0x14')][_0xd082('0x15')]);}logger['error'](_0xd082('0xf'),_0x7022d4,_0x4da752['error'][_0xd082('0x15')]);return _0x7064dc(_0x4da752[_0xd082('0x14')][_0xd082('0x15')]);}else{logger[_0xd082('0x16')](_0xd082('0xf'),_0x7022d4,'request\x20sent');_0x7064dc(_0x4da752['result'][_0xd082('0x15')]);}})[_0xd082('0x17')](function(_0x225643){logger[_0xd082('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x7022d4,_0x225643);_0x1a27df(_0x225643);});});} \ No newline at end of file +var _0x7faa=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x285ce2,_0x4a05f4){var _0x1f9750=function(_0x2daf86){while(--_0x2daf86){_0x285ce2['push'](_0x285ce2['shift']());}};_0x1f9750(++_0x4a05f4);}(_0x7faa,0x156));var _0xa7fa=function(_0x392f1b,_0x164b99){_0x392f1b=_0x392f1b-0x0;var _0x4dfb58=_0x7faa[_0x392f1b];return _0x4dfb58;};'use strict';var _=require(_0xa7fa('0x0'));var util=require(_0xa7fa('0x1'));var moment=require(_0xa7fa('0x2'));var BPromise=require(_0xa7fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7fa('0x5'));var logger=require(_0xa7fa('0x6'))(_0xa7fa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a5cf1,_0x4c3780,_0x3e24e8){return new BPromise(function(_0x166338,_0x262823){return client['request'](_0x1a5cf1,_0x3e24e8)[_0xa7fa('0x8')](function(_0x4fa044){logger[_0xa7fa('0x9')](_0xa7fa('0xa'),_0x4c3780,_0xa7fa('0xb'));logger[_0xa7fa('0xc')](_0xa7fa('0xd'),_0x4c3780,_0xa7fa('0xb'),JSON[_0xa7fa('0xe')](_0x4fa044));if(_0x4fa044[_0xa7fa('0xf')]){if(_0x4fa044[_0xa7fa('0xf')][_0xa7fa('0x10')]===0x1f4){logger[_0xa7fa('0xf')](_0xa7fa('0xa'),_0x4c3780,_0x4fa044[_0xa7fa('0xf')][_0xa7fa('0x11')]);return _0x262823(_0x4fa044[_0xa7fa('0xf')][_0xa7fa('0x11')]);}logger[_0xa7fa('0xf')](_0xa7fa('0xa'),_0x4c3780,_0x4fa044[_0xa7fa('0xf')][_0xa7fa('0x11')]);return _0x166338(_0x4fa044['error'][_0xa7fa('0x11')]);}else{logger[_0xa7fa('0x9')]('MailSubstatus,\x20%s,\x20%s',_0x4c3780,_0xa7fa('0xb'));_0x166338(_0x4fa044[_0xa7fa('0x12')]['message']);}})[_0xa7fa('0x13')](function(_0x435200){logger[_0xa7fa('0xf')](_0xa7fa('0xa'),_0x4c3780,_0x435200);_0x262823(_0x435200);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 0b015f5..36ed01f 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 _0x2d06=['/describe','describe','show','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x317fd7,_0x190898){var _0xb229a6=function(_0x5dc0d3){while(--_0x5dc0d3){_0x317fd7['push'](_0x317fd7['shift']());}};_0xb229a6(++_0x190898);}(_0x2d06,0x199));var _0x62d0=function(_0x3aa177,_0x42c18f){_0x3aa177=_0x3aa177-0x0;var _0xf1e359=_0x2d06[_0x3aa177];return _0xf1e359;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x62d0('0x0'));var timeout=require(_0x62d0('0x1'));var express=require(_0x62d0('0x2'));var router=express[_0x62d0('0x3')]();var fs_extra=require(_0x62d0('0x4'));var auth=require(_0x62d0('0x5'));var interaction=require(_0x62d0('0x6'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x62d0('0x7')]('/',auth[_0x62d0('0x8')](),controller['index']);router[_0x62d0('0x7')](_0x62d0('0x9'),auth[_0x62d0('0x8')](),controller[_0x62d0('0xa')]);router[_0x62d0('0x7')]('/:id',auth[_0x62d0('0x8')](),controller[_0x62d0('0xb')]);router['post']('/',auth[_0x62d0('0x8')](),controller[_0x62d0('0xc')]);router[_0x62d0('0xd')](_0x62d0('0xe'),auth[_0x62d0('0x8')](),controller[_0x62d0('0xf')]);router[_0x62d0('0x10')]('/:id',auth[_0x62d0('0x8')](),controller[_0x62d0('0x11')]);module[_0x62d0('0x12')]=router; \ No newline at end of file +var _0xc155=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','exports','multer','path','express','Router'];(function(_0x234564,_0x2bb623){var _0x4af1ac=function(_0x1bba8a){while(--_0x1bba8a){_0x234564['push'](_0x234564['shift']());}};_0x4af1ac(++_0x2bb623);}(_0xc155,0xa4));var _0x5c15=function(_0x4bc20a,_0x5d3439){_0x4bc20a=_0x4bc20a-0x0;var _0x58ee79=_0xc155[_0x4bc20a];return _0x58ee79;};'use strict';var multer=require(_0x5c15('0x0'));var util=require('util');var path=require(_0x5c15('0x1'));var timeout=require('connect-timeout');var express=require(_0x5c15('0x2'));var router=express[_0x5c15('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5c15('0x4'));var interaction=require(_0x5c15('0x5'));var config=require(_0x5c15('0x6'));var controller=require(_0x5c15('0x7'));router[_0x5c15('0x8')]('/',auth[_0x5c15('0x9')](),controller[_0x5c15('0xa')]);router[_0x5c15('0x8')](_0x5c15('0xb'),auth[_0x5c15('0x9')](),controller[_0x5c15('0xc')]);router[_0x5c15('0x8')]('/:id',auth[_0x5c15('0x9')](),controller[_0x5c15('0xd')]);router[_0x5c15('0xe')]('/',auth[_0x5c15('0x9')](),controller[_0x5c15('0xf')]);router[_0x5c15('0x10')](_0x5c15('0x11'),auth[_0x5c15('0x9')](),controller[_0x5c15('0x12')]);router[_0x5c15('0x13')](_0x5c15('0x11'),auth[_0x5c15('0x9')](),controller['destroy']);module[_0x5c15('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index c087664..aa79cc0 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x2ab09c,_0x3399d5){var _0x16de1a=function(_0x22a2ef){while(--_0x22a2ef){_0x2ab09c['push'](_0x2ab09c['shift']());}};_0x16de1a(++_0x3399d5);}(_0x70e0,0x17b));var _0x070e=function(_0x358aba,_0x3b2d09){_0x358aba=_0x358aba-0x0;var _0x2ce14e=_0x70e0[_0x358aba];return _0x2ce14e;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x466bc5,_0x3a0f2a){var _0x138952=function(_0x392fa2){while(--_0x392fa2){_0x466bc5['push'](_0x466bc5['shift']());}};_0x138952(++_0x3a0f2a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x192028,_0x345ab3){_0x192028=_0x192028-0x0;var _0x56f85f=_0x9bde[_0x192028];return _0x56f85f;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index c8a79eb..faf7356 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 _0x21dd=['fs-extra','lodash','crypto','jsforce','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','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','MailTransferReport','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','find','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','ejs'];(function(_0x428537,_0x3b46c0){var _0x515764=function(_0x1aea45){while(--_0x1aea45){_0x428537['push'](_0x428537['shift']());}};_0x515764(++_0x3b46c0);}(_0x21dd,0xe2));var _0xd21d=function(_0x2c7cc8,_0x21a85f){_0x2c7cc8=_0x2c7cc8-0x0;var _0x5f1302=_0x21dd[_0x2c7cc8];return _0x5f1302;};'use strict';var emlformat=require(_0xd21d('0x0'));var rimraf=require(_0xd21d('0x1'));var zipdir=require(_0xd21d('0x2'));var jsonpatch=require(_0xd21d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd21d('0x4'));var path=require(_0xd21d('0x5'));var sox=require(_0xd21d('0x6'));var csv=require('to-csv');var ejs=require(_0xd21d('0x7'));var fs=require('fs');var fs_extra=require(_0xd21d('0x8'));var _=require(_0xd21d('0x9'));var squel=require('squel');var crypto=require(_0xd21d('0xa'));var jsforce=require(_0xd21d('0xb'));var deskjs=require(_0xd21d('0xc'));var toCsv=require(_0xd21d('0xd'));var querystring=require(_0xd21d('0xe'));var Papa=require(_0xd21d('0xf'));var Redis=require(_0xd21d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd21d('0x11'));var as=require(_0xd21d('0x12'));var hardwareService=require(_0xd21d('0x13'));var logger=require(_0xd21d('0x14'))(_0xd21d('0x15'));var utils=require(_0xd21d('0x16'));var config=require(_0xd21d('0x17'));var licenseUtil=require(_0xd21d('0x18'));var db=require(_0xd21d('0x19'))['db'];function respondWithStatusCode(_0x13dbf8,_0x375964){_0x375964=_0x375964||0xcc;return function(_0x2a63b6){if(_0x2a63b6){return _0x13dbf8[_0xd21d('0x1a')](_0x375964);}return _0x13dbf8[_0xd21d('0x1b')](_0x375964)[_0xd21d('0x1c')]();};}function respondWithResult(_0x3bc91e,_0x5a18cc){_0x5a18cc=_0x5a18cc||0xc8;return function(_0x433290){if(_0x433290){return _0x3bc91e[_0xd21d('0x1b')](_0x5a18cc)[_0xd21d('0x1d')](_0x433290);}};}function respondWithFilteredResult(_0x2e361e,_0x2fa277){return function(_0x266174){if(_0x266174){var _0x21052f=typeof _0x2fa277[_0xd21d('0x1e')]===_0xd21d('0x1f')&&typeof _0x2fa277[_0xd21d('0x20')]===_0xd21d('0x1f');var _0x460ee1=_0x266174['count'];var _0x167671=_0x21052f?0x0:_0x2fa277[_0xd21d('0x1e')];var _0x1d5fb7=_0x21052f?_0x266174[_0xd21d('0x21')]:_0x2fa277[_0xd21d('0x1e')]+_0x2fa277[_0xd21d('0x20')];var _0x27d9ff;if(_0x1d5fb7>=_0x460ee1){_0x1d5fb7=_0x460ee1;_0x27d9ff=0xc8;}else{_0x27d9ff=0xce;}_0x2e361e[_0xd21d('0x1b')](_0x27d9ff);return _0x2e361e[_0xd21d('0x22')](_0xd21d('0x23'),_0x167671+'-'+_0x1d5fb7+'/'+_0x460ee1)['json'](_0x266174);}return null;};}function patchUpdates(_0x57fa00){return function(_0x851982){try{jsonpatch[_0xd21d('0x24')](_0x851982,_0x57fa00,!![]);}catch(_0x29ae74){return BPromise[_0xd21d('0x25')](_0x29ae74);}return _0x851982['save']();};}function saveUpdates(_0x36993e,_0x5c3290){return function(_0x5bba24){if(_0x5bba24){return _0x5bba24['update'](_0x36993e)[_0xd21d('0x26')](function(_0x1bb35a){return _0x1bb35a;});}return null;};}function removeEntity(_0x452080,_0x1cd1ec){return function(_0x2354ba){if(_0x2354ba){return _0x2354ba[_0xd21d('0x27')]()['then'](function(){_0x452080[_0xd21d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208c94,_0x3da23e){return function(_0x317516){if(!_0x317516){_0x208c94['sendStatus'](0x194);}return _0x317516;};}function handleError(_0x5581bb,_0x37c4e4){_0x37c4e4=_0x37c4e4||0x1f4;return function(_0x43a859){logger[_0xd21d('0x28')](_0x43a859[_0xd21d('0x29')]);if(_0x43a859[_0xd21d('0x2a')]){delete _0x43a859[_0xd21d('0x2a')];}_0x5581bb[_0xd21d('0x1b')](_0x37c4e4)[_0xd21d('0x2b')](_0x43a859);};}exports[_0xd21d('0x2c')]=function(_0xdcbabe,_0x4d0186){var _0x3b545d={},_0x49424e={},_0x2f5f4e={'count':0x0,'rows':[]};var _0x2c8259=_[_0xd21d('0x2d')](db[_0xd21d('0x2e')]['rawAttributes'],function(_0x36c624){return{'name':_0x36c624[_0xd21d('0x2f')],'type':_0x36c624['type']['key']};});_0x49424e[_0xd21d('0x30')]=_['map'](_0x2c8259,_0xd21d('0x2a'));_0x49424e[_0xd21d('0x31')]=_[_0xd21d('0x32')](_0xdcbabe['query']);_0x49424e[_0xd21d('0x33')]=_['intersection'](_0x49424e['model'],_0x49424e[_0xd21d('0x31')]);_0x3b545d[_0xd21d('0x34')]=_['intersection'](_0x49424e[_0xd21d('0x30')],qs[_0xd21d('0x35')](_0xdcbabe['query'][_0xd21d('0x35')]));_0x3b545d[_0xd21d('0x34')]=_0x3b545d['attributes'][_0xd21d('0x36')]?_0x3b545d[_0xd21d('0x34')]:_0x49424e['model'];if(!_0xdcbabe['query'][_0xd21d('0x37')](_0xd21d('0x38'))){_0x3b545d[_0xd21d('0x20')]=qs[_0xd21d('0x20')](_0xdcbabe[_0xd21d('0x31')][_0xd21d('0x20')]);_0x3b545d[_0xd21d('0x1e')]=qs[_0xd21d('0x1e')](_0xdcbabe[_0xd21d('0x31')][_0xd21d('0x1e')]);}_0x3b545d[_0xd21d('0x39')]=qs[_0xd21d('0x3a')](_0xdcbabe['query']['sort']);_0x3b545d[_0xd21d('0x3b')]=qs[_0xd21d('0x33')](_[_0xd21d('0x3c')](_0xdcbabe[_0xd21d('0x31')],_0x49424e['filters']),_0x2c8259);if(_0xdcbabe[_0xd21d('0x31')][_0xd21d('0x3d')]){_0x3b545d[_0xd21d('0x3b')]=_[_0xd21d('0x3e')](_0x3b545d['where'],{'$or':_['map'](_0x2c8259,function(_0x44a8af){if(_0x44a8af[_0xd21d('0x3f')]!==_0xd21d('0x40')){var _0x3c00a5={};_0x3c00a5[_0x44a8af[_0xd21d('0x2a')]]={'$like':'%'+_0xdcbabe[_0xd21d('0x31')][_0xd21d('0x3d')]+'%'};return _0x3c00a5;}})});}_0x3b545d=_[_0xd21d('0x3e')]({},_0x3b545d,_0xdcbabe['options']);var _0x21f02d={'where':_0x3b545d[_0xd21d('0x3b')]};return db[_0xd21d('0x2e')][_0xd21d('0x21')](_0x21f02d)[_0xd21d('0x26')](function(_0x8f0322){_0x2f5f4e[_0xd21d('0x21')]=_0x8f0322;if(_0xdcbabe[_0xd21d('0x31')][_0xd21d('0x41')]){_0x3b545d[_0xd21d('0x42')]=[{'all':!![]}];}return db['MailTransferReport'][_0xd21d('0x43')](_0x3b545d);})['then'](function(_0x5d491a){_0x2f5f4e[_0xd21d('0x44')]=_0x5d491a;return _0x2f5f4e;})[_0xd21d('0x26')](respondWithFilteredResult(_0x4d0186,_0x3b545d))['catch'](handleError(_0x4d0186,null));};exports[_0xd21d('0x45')]=function(_0x38c87e,_0x1e3358){var _0x189db5={'raw':!![],'where':{'id':_0x38c87e[_0xd21d('0x46')]['id']}},_0xa14c75={};_0xa14c75[_0xd21d('0x30')]=_[_0xd21d('0x32')](db['MailTransferReport'][_0xd21d('0x47')]);_0xa14c75[_0xd21d('0x31')]=_[_0xd21d('0x32')](_0x38c87e['query']);_0xa14c75[_0xd21d('0x33')]=_[_0xd21d('0x48')](_0xa14c75['model'],_0xa14c75[_0xd21d('0x31')]);_0x189db5[_0xd21d('0x34')]=_['intersection'](_0xa14c75['model'],qs[_0xd21d('0x35')](_0x38c87e[_0xd21d('0x31')][_0xd21d('0x35')]));_0x189db5['attributes']=_0x189db5[_0xd21d('0x34')][_0xd21d('0x36')]?_0x189db5[_0xd21d('0x34')]:_0xa14c75[_0xd21d('0x30')];if(_0x38c87e[_0xd21d('0x31')]['includeAll']){_0x189db5[_0xd21d('0x42')]=[{'all':!![]}];}_0x189db5=_[_0xd21d('0x3e')]({},_0x189db5,_0x38c87e['options']);return db[_0xd21d('0x2e')][_0xd21d('0x49')](_0x189db5)['then'](handleEntityNotFound(_0x1e3358,null))['then'](respondWithResult(_0x1e3358,null))['catch'](handleError(_0x1e3358,null));};exports[_0xd21d('0x4a')]=function(_0x4b12d7,_0x3b3088){return db[_0xd21d('0x2e')][_0xd21d('0x4a')](_0x4b12d7[_0xd21d('0x4b')],{})[_0xd21d('0x26')](respondWithResult(_0x3b3088,0xc9))[_0xd21d('0x4c')](handleError(_0x3b3088,null));};exports[_0xd21d('0x4d')]=function(_0x126fc1,_0x192e32){if(_0x126fc1[_0xd21d('0x4b')]['id']){delete _0x126fc1[_0xd21d('0x4b')]['id'];}return db[_0xd21d('0x2e')]['find']({'where':{'id':_0x126fc1[_0xd21d('0x46')]['id']}})[_0xd21d('0x26')](handleEntityNotFound(_0x192e32,null))[_0xd21d('0x26')](saveUpdates(_0x126fc1[_0xd21d('0x4b')],null))[_0xd21d('0x26')](respondWithResult(_0x192e32,null))['catch'](handleError(_0x192e32,null));};exports[_0xd21d('0x27')]=function(_0x3275d6,_0x1ecf2f){return db[_0xd21d('0x2e')][_0xd21d('0x49')]({'where':{'id':_0x3275d6['params']['id']}})['then'](handleEntityNotFound(_0x1ecf2f,null))[_0xd21d('0x26')](removeEntity(_0x1ecf2f,null))[_0xd21d('0x4c')](handleError(_0x1ecf2f,null));};exports['describe']=function(_0x12aee8,_0x3e2d53){return db[_0xd21d('0x2e')]['describe']()[_0xd21d('0x26')](respondWithResult(_0x3e2d53,null))[_0xd21d('0x4c')](handleError(_0x3e2d53,null));}; \ No newline at end of file +var _0x91b4=['update','destroy','then','error','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','MailTransferReport','findAll','rows','catch','show','options','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','reject'];(function(_0x200d3f,_0x223401){var _0x581e51=function(_0x4e1816){while(--_0x4e1816){_0x200d3f['push'](_0x200d3f['shift']());}};_0x581e51(++_0x223401);}(_0x91b4,0x104));var _0x491b=function(_0x41d044,_0x39af7e){_0x41d044=_0x41d044-0x0;var _0x43da3=_0x91b4[_0x41d044];return _0x43da3;};'use strict';var emlformat=require(_0x491b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x491b('0x1'));var jsonpatch=require(_0x491b('0x2'));var rp=require(_0x491b('0x3'));var moment=require(_0x491b('0x4'));var BPromise=require(_0x491b('0x5'));var Mustache=require('mustache');var util=require(_0x491b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x491b('0x7'));var fs=require('fs');var fs_extra=require(_0x491b('0x8'));var _=require(_0x491b('0x9'));var squel=require('squel');var crypto=require(_0x491b('0xa'));var jsforce=require(_0x491b('0xb'));var deskjs=require(_0x491b('0xc'));var toCsv=require(_0x491b('0xd'));var querystring=require(_0x491b('0xe'));var Papa=require(_0x491b('0xf'));var Redis=require(_0x491b('0x10'));var authService=require(_0x491b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x491b('0x12'));var hardwareService=require(_0x491b('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x491b('0x14'));var db=require(_0x491b('0x15'))['db'];function respondWithStatusCode(_0x5e2595,_0xff415c){_0xff415c=_0xff415c||0xcc;return function(_0x2ed647){if(_0x2ed647){return _0x5e2595[_0x491b('0x16')](_0xff415c);}return _0x5e2595[_0x491b('0x17')](_0xff415c)[_0x491b('0x18')]();};}function respondWithResult(_0x34e91d,_0x2624de){_0x2624de=_0x2624de||0xc8;return function(_0x247316){if(_0x247316){return _0x34e91d['status'](_0x2624de)[_0x491b('0x19')](_0x247316);}};}function respondWithFilteredResult(_0x192b92,_0x8b5563){return function(_0x122b38){if(_0x122b38){var _0x233262=typeof _0x8b5563['offset']==='undefined'&&typeof _0x8b5563[_0x491b('0x1a')]===_0x491b('0x1b');var _0x417195=_0x122b38[_0x491b('0x1c')];var _0x3772b2=_0x233262?0x0:_0x8b5563['offset'];var _0x277f01=_0x233262?_0x122b38[_0x491b('0x1c')]:_0x8b5563[_0x491b('0x1d')]+_0x8b5563[_0x491b('0x1a')];var _0x4c0ace;if(_0x277f01>=_0x417195){_0x277f01=_0x417195;_0x4c0ace=0xc8;}else{_0x4c0ace=0xce;}_0x192b92[_0x491b('0x17')](_0x4c0ace);return _0x192b92[_0x491b('0x1e')]('Content-Range',_0x3772b2+'-'+_0x277f01+'/'+_0x417195)[_0x491b('0x19')](_0x122b38);}return null;};}function patchUpdates(_0x188aad){return function(_0x32d7a1){try{jsonpatch['apply'](_0x32d7a1,_0x188aad,!![]);}catch(_0x3d8338){return BPromise[_0x491b('0x1f')](_0x3d8338);}return _0x32d7a1['save']();};}function saveUpdates(_0x5212ef,_0xce31ee){return function(_0x1c4284){if(_0x1c4284){return _0x1c4284[_0x491b('0x20')](_0x5212ef)['then'](function(_0x8d1a05){return _0x8d1a05;});}return null;};}function removeEntity(_0x5ea92a,_0x1ca0b9){return function(_0x873aed){if(_0x873aed){return _0x873aed[_0x491b('0x21')]()[_0x491b('0x22')](function(){_0x5ea92a[_0x491b('0x17')](0xcc)[_0x491b('0x18')]();});}};}function handleEntityNotFound(_0x23ac9f,_0x194ba4){return function(_0x254616){if(!_0x254616){_0x23ac9f['sendStatus'](0x194);}return _0x254616;};}function handleError(_0x5bb1d0,_0x348690){_0x348690=_0x348690||0x1f4;return function(_0x5ba7db){logger[_0x491b('0x23')](_0x5ba7db[_0x491b('0x24')]);if(_0x5ba7db['name']){delete _0x5ba7db[_0x491b('0x25')];}_0x5bb1d0['status'](_0x348690)['send'](_0x5ba7db);};}exports[_0x491b('0x26')]=function(_0x2f9557,_0x111b72){var _0x1ca48b={},_0x49b32b={},_0x2b6cb5={'count':0x0,'rows':[]};var _0x4b2221=_['map'](db['MailTransferReport'][_0x491b('0x27')],function(_0x34722f){return{'name':_0x34722f[_0x491b('0x28')],'type':_0x34722f[_0x491b('0x29')][_0x491b('0x2a')]};});_0x49b32b['model']=_[_0x491b('0x2b')](_0x4b2221,_0x491b('0x25'));_0x49b32b[_0x491b('0x2c')]=_[_0x491b('0x2d')](_0x2f9557[_0x491b('0x2c')]);_0x49b32b[_0x491b('0x2e')]=_[_0x491b('0x2f')](_0x49b32b[_0x491b('0x30')],_0x49b32b[_0x491b('0x2c')]);_0x1ca48b[_0x491b('0x31')]=_[_0x491b('0x2f')](_0x49b32b['model'],qs[_0x491b('0x32')](_0x2f9557[_0x491b('0x2c')]['fields']));_0x1ca48b[_0x491b('0x31')]=_0x1ca48b[_0x491b('0x31')][_0x491b('0x33')]?_0x1ca48b[_0x491b('0x31')]:_0x49b32b[_0x491b('0x30')];if(!_0x2f9557[_0x491b('0x2c')]['hasOwnProperty'](_0x491b('0x34'))){_0x1ca48b[_0x491b('0x1a')]=qs[_0x491b('0x1a')](_0x2f9557[_0x491b('0x2c')]['limit']);_0x1ca48b[_0x491b('0x1d')]=qs[_0x491b('0x1d')](_0x2f9557[_0x491b('0x2c')]['offset']);}_0x1ca48b[_0x491b('0x35')]=qs['sort'](_0x2f9557['query'][_0x491b('0x36')]);_0x1ca48b['where']=qs[_0x491b('0x2e')](_[_0x491b('0x37')](_0x2f9557[_0x491b('0x2c')],_0x49b32b[_0x491b('0x2e')]),_0x4b2221);if(_0x2f9557['query'][_0x491b('0x38')]){_0x1ca48b[_0x491b('0x39')]=_[_0x491b('0x3a')](_0x1ca48b[_0x491b('0x39')],{'$or':_[_0x491b('0x2b')](_0x4b2221,function(_0x419063){if(_0x419063[_0x491b('0x29')]!==_0x491b('0x3b')){var _0x182aa9={};_0x182aa9[_0x419063[_0x491b('0x25')]]={'$like':'%'+_0x2f9557['query'][_0x491b('0x38')]+'%'};return _0x182aa9;}})});}_0x1ca48b=_[_0x491b('0x3a')]({},_0x1ca48b,_0x2f9557['options']);var _0x1e0b86={'where':_0x1ca48b[_0x491b('0x39')]};return db['MailTransferReport'][_0x491b('0x1c')](_0x1e0b86)[_0x491b('0x22')](function(_0x21c921){_0x2b6cb5['count']=_0x21c921;if(_0x2f9557[_0x491b('0x2c')][_0x491b('0x3c')]){_0x1ca48b[_0x491b('0x3d')]=[{'all':!![]}];}return db[_0x491b('0x3e')][_0x491b('0x3f')](_0x1ca48b);})[_0x491b('0x22')](function(_0x3bb7a7){_0x2b6cb5[_0x491b('0x40')]=_0x3bb7a7;return _0x2b6cb5;})[_0x491b('0x22')](respondWithFilteredResult(_0x111b72,_0x1ca48b))[_0x491b('0x41')](handleError(_0x111b72,null));};exports[_0x491b('0x42')]=function(_0x4c4914,_0x35d4b3){var _0x46ec9a={'raw':!![],'where':{'id':_0x4c4914['params']['id']}},_0xe765a1={};_0xe765a1[_0x491b('0x30')]=_[_0x491b('0x2d')](db[_0x491b('0x3e')][_0x491b('0x27')]);_0xe765a1[_0x491b('0x2c')]=_[_0x491b('0x2d')](_0x4c4914[_0x491b('0x2c')]);_0xe765a1['filters']=_['intersection'](_0xe765a1[_0x491b('0x30')],_0xe765a1[_0x491b('0x2c')]);_0x46ec9a[_0x491b('0x31')]=_[_0x491b('0x2f')](_0xe765a1[_0x491b('0x30')],qs[_0x491b('0x32')](_0x4c4914[_0x491b('0x2c')][_0x491b('0x32')]));_0x46ec9a['attributes']=_0x46ec9a['attributes'][_0x491b('0x33')]?_0x46ec9a['attributes']:_0xe765a1[_0x491b('0x30')];if(_0x4c4914[_0x491b('0x2c')][_0x491b('0x3c')]){_0x46ec9a[_0x491b('0x3d')]=[{'all':!![]}];}_0x46ec9a=_['merge']({},_0x46ec9a,_0x4c4914[_0x491b('0x43')]);return db['MailTransferReport'][_0x491b('0x44')](_0x46ec9a)[_0x491b('0x22')](handleEntityNotFound(_0x35d4b3,null))[_0x491b('0x22')](respondWithResult(_0x35d4b3,null))[_0x491b('0x41')](handleError(_0x35d4b3,null));};exports['create']=function(_0x554c16,_0x1a18d2){return db['MailTransferReport'][_0x491b('0x45')](_0x554c16[_0x491b('0x46')],{})[_0x491b('0x22')](respondWithResult(_0x1a18d2,0xc9))[_0x491b('0x41')](handleError(_0x1a18d2,null));};exports['update']=function(_0xb8d65,_0x3be0be){if(_0xb8d65['body']['id']){delete _0xb8d65['body']['id'];}return db[_0x491b('0x3e')][_0x491b('0x44')]({'where':{'id':_0xb8d65[_0x491b('0x47')]['id']}})[_0x491b('0x22')](handleEntityNotFound(_0x3be0be,null))[_0x491b('0x22')](saveUpdates(_0xb8d65[_0x491b('0x46')],null))[_0x491b('0x22')](respondWithResult(_0x3be0be,null))[_0x491b('0x41')](handleError(_0x3be0be,null));};exports[_0x491b('0x21')]=function(_0x183d39,_0x38ec72){return db[_0x491b('0x3e')][_0x491b('0x44')]({'where':{'id':_0x183d39[_0x491b('0x47')]['id']}})[_0x491b('0x22')](handleEntityNotFound(_0x38ec72,null))[_0x491b('0x22')](removeEntity(_0x38ec72,null))[_0x491b('0x41')](handleError(_0x38ec72,null));};exports[_0x491b('0x48')]=function(_0x32aaa1,_0x196fa0){return db['MailTransferReport'][_0x491b('0x48')]()[_0x491b('0x22')](respondWithResult(_0x196fa0,null))[_0x491b('0x41')](handleError(_0x196fa0,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 7c5aa56..e38fecd 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 _0xf25a=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','report_mail_transfer','uniqueid','lodash','util'];(function(_0x5a27fe,_0x43993b){var _0x121c88=function(_0x2aff1f){while(--_0x2aff1f){_0x5a27fe['push'](_0x5a27fe['shift']());}};_0x121c88(++_0x43993b);}(_0xf25a,0x195));var _0xaf25=function(_0x46672e,_0x276152){_0x46672e=_0x46672e-0x0;var _0xb0f8d1=_0xf25a[_0x46672e];return _0xb0f8d1;};'use strict';var _=require(_0xaf25('0x0'));var util=require(_0xaf25('0x1'));var logger=require(_0xaf25('0x2'))('api');var moment=require(_0xaf25('0x3'));var BPromise=require(_0xaf25('0x4'));var rp=require(_0xaf25('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf25('0x6'));var config=require(_0xaf25('0x7'));var attributes=require(_0xaf25('0x8'));module['exports']=function(_0x49281b,_0x30eaae){return _0x49281b['define']('MailTransferReport',attributes,{'tableName':_0xaf25('0x9'),'paranoid':![],'indexes':[{'name':_0xaf25('0xa'),'fields':[_0xaf25('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x10eb=['../../config/environment','define','MailTransferReport','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10eb,0x71));var _0xb10e=function(_0x5d3f8d,_0x2e5fef){_0x5d3f8d=_0x5d3f8d-0x0;var _0x3a3e38=_0x10eb[_0x5d3f8d];return _0x3a3e38;};'use strict';var _=require(_0xb10e('0x0'));var util=require('util');var logger=require(_0xb10e('0x1'))(_0xb10e('0x2'));var moment=require(_0xb10e('0x3'));var BPromise=require(_0xb10e('0x4'));var rp=require(_0xb10e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb10e('0x6'));var config=require(_0xb10e('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x2ffe69,_0x40decd){return _0x2ffe69[_0xb10e('0x8')](_0xb10e('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','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 e91977f..193a951 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 _0x9308=['../../config/logger','rpc','jayson/promise','client','http','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../config/utils'];(function(_0x4142b5,_0x5a5246){var _0xf3d86c=function(_0x2f2393){while(--_0x2f2393){_0x4142b5['push'](_0x4142b5['shift']());}};_0xf3d86c(++_0x5a5246);}(_0x9308,0xcd));var _0x8930=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9308[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x8930('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8930('0x1'));var fs=require('fs');var Redis=require(_0x8930('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8930('0x3'));var logger=require(_0x8930('0x4'))(_0x8930('0x5'));var config=require('../../config/environment');var jayson=require(_0x8930('0x6'));var client=jayson[_0x8930('0x7')][_0x8930('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x357f8a,_0x578009,_0x555ff1){return new BPromise(function(_0x43b325,_0x3f67bd){return client['request'](_0x357f8a,_0x555ff1)['then'](function(_0x921b47){logger[_0x8930('0x9')](_0x8930('0xa'),_0x578009,_0x8930('0xb'));logger[_0x8930('0xc')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x578009,_0x8930('0xb'),JSON[_0x8930('0xd')](_0x921b47));if(_0x921b47['error']){if(_0x921b47[_0x8930('0xe')][_0x8930('0xf')]===0x1f4){logger[_0x8930('0xe')](_0x8930('0xa'),_0x578009,_0x921b47[_0x8930('0xe')][_0x8930('0x10')]);return _0x3f67bd(_0x921b47[_0x8930('0xe')]['message']);}logger[_0x8930('0xe')](_0x8930('0xa'),_0x578009,_0x921b47[_0x8930('0xe')]['message']);return _0x43b325(_0x921b47[_0x8930('0xe')][_0x8930('0x10')]);}else{logger[_0x8930('0x9')]('MailTransferReport,\x20%s,\x20%s',_0x578009,_0x8930('0xb'));_0x43b325(_0x921b47[_0x8930('0x11')][_0x8930('0x10')]);}})[_0x8930('0x12')](function(_0x2d9e01){logger[_0x8930('0xe')](_0x8930('0xa'),_0x578009,_0x2d9e01);_0x3f67bd(_0x2d9e01);});});} \ No newline at end of file +var _0x2a48=['stringify','error','result','message','catch','lodash','ioredis','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x2aa3cf,_0x14f628){var _0x54f10c=function(_0x1de61e){while(--_0x1de61e){_0x2aa3cf['push'](_0x2aa3cf['shift']());}};_0x54f10c(++_0x14f628);}(_0x2a48,0x137));var _0x82a4=function(_0x3bc6da,_0x387879){_0x3bc6da=_0x3bc6da-0x0;var _0x1c9da=_0x2a48[_0x3bc6da];return _0x1c9da;};'use strict';var _=require(_0x82a4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82a4('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x82a4('0x2'));var jayson=require('jayson/promise');var client=jayson[_0x82a4('0x3')][_0x82a4('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x1792a4,_0x3aa97b,_0x95f78e){return new BPromise(function(_0x232803,_0x4d7f7c){return client[_0x82a4('0x5')](_0x1792a4,_0x95f78e)[_0x82a4('0x6')](function(_0x55add8){logger[_0x82a4('0x7')](_0x82a4('0x8'),_0x3aa97b,_0x82a4('0x9'));logger[_0x82a4('0xa')](_0x82a4('0xb'),_0x3aa97b,_0x82a4('0x9'),JSON[_0x82a4('0xc')](_0x55add8));if(_0x55add8[_0x82a4('0xd')]){if(_0x55add8[_0x82a4('0xd')]['code']===0x1f4){logger[_0x82a4('0xd')](_0x82a4('0x8'),_0x3aa97b,_0x55add8['error']['message']);return _0x4d7f7c(_0x55add8['error']['message']);}logger[_0x82a4('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x3aa97b,_0x55add8[_0x82a4('0xd')]['message']);return _0x232803(_0x55add8['error']['message']);}else{logger[_0x82a4('0x7')](_0x82a4('0x8'),_0x3aa97b,'request\x20sent');_0x232803(_0x55add8[_0x82a4('0xe')][_0x82a4('0xf')]);}})[_0x82a4('0x10')](function(_0x1595e3){logger[_0x82a4('0xd')](_0x82a4('0x8'),_0x3aa97b,_0x1595e3);_0x4d7f7c(_0x1595e3);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index cda0338..a44b5f1 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 _0xf274=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','put','update','delete','destroy'];(function(_0x457926,_0x4cbe37){var _0x1d3878=function(_0x18596a){while(--_0x18596a){_0x457926['push'](_0x457926['shift']());}};_0x1d3878(++_0x4cbe37);}(_0xf274,0x104));var _0x4f27=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xf274[_0x5627e1];return _0x2f013f;};'use strict';var multer=require(_0x4f27('0x0'));var util=require(_0x4f27('0x1'));var path=require(_0x4f27('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f27('0x3'));var router=express[_0x4f27('0x4')]();var fs_extra=require(_0x4f27('0x5'));var auth=require(_0x4f27('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f27('0x7'));var controller=require(_0x4f27('0x8'));router['get']('/',auth[_0x4f27('0x9')](),controller['index']);router[_0x4f27('0xa')](_0x4f27('0xb'),auth['isAuthenticated'](),controller[_0x4f27('0xc')]);router[_0x4f27('0xa')](_0x4f27('0xd'),auth[_0x4f27('0x9')](),controller[_0x4f27('0xe')]);router[_0x4f27('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f27('0x10')](_0x4f27('0xd'),auth[_0x4f27('0x9')](),controller[_0x4f27('0x11')]);router[_0x4f27('0x12')](_0x4f27('0xd'),auth[_0x4f27('0x9')](),controller[_0x4f27('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8f0d=['isAuthenticated','/describe','/:id','show','put','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get'];(function(_0x8704c7,_0x4d78ac){var _0x19f81e=function(_0x18b63a){while(--_0x18b63a){_0x8704c7['push'](_0x8704c7['shift']());}};_0x19f81e(++_0x4d78ac);}(_0x8f0d,0x197));var _0xd8f0=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x8f0d[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0xd8f0('0x0'));var util=require(_0xd8f0('0x1'));var path=require('path');var timeout=require(_0xd8f0('0x2'));var express=require(_0xd8f0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd8f0('0x4'));var interaction=require(_0xd8f0('0x5'));var config=require(_0xd8f0('0x6'));var controller=require(_0xd8f0('0x7'));router[_0xd8f0('0x8')]('/',auth[_0xd8f0('0x9')](),controller['index']);router[_0xd8f0('0x8')](_0xd8f0('0xa'),auth[_0xd8f0('0x9')](),controller['describe']);router[_0xd8f0('0x8')](_0xd8f0('0xb'),auth[_0xd8f0('0x9')](),controller[_0xd8f0('0xc')]);router['post']('/',auth[_0xd8f0('0x9')](),controller['create']);router[_0xd8f0('0xd')](_0xd8f0('0xb'),auth[_0xd8f0('0x9')](),controller['update']);router[_0xd8f0('0xe')](_0xd8f0('0xb'),auth[_0xd8f0('0x9')](),controller['destroy']);module[_0xd8f0('0xf')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 24e29e4..58b313b 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 _0xbed1=['getDataValue','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x5bc95c,_0xfed759){var _0x3721fc=function(_0x49fca7){while(--_0x49fca7){_0x5bc95c['push'](_0x5bc95c['shift']());}};_0x3721fc(++_0xfed759);}(_0xbed1,0x112));var _0x1bed=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0xbed1[_0x2b4448];return _0xb4b465;};'use strict';var Sequelize=require(_0x1bed('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1bed('0x1')],'defaultValue':_0x1bed('0x2'),'comment':_0x1bed('0x3')},'duration':{'type':Sequelize[_0x1bed('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1bed('0x5')],'set':function(_0x72227d){var _0x3c1ea4=moment(_0x72227d);var _0x1c04f9=moment(this[_0x1bed('0x6')]('enterAt'));var _0xf3e0d6=_0x3c1ea4['diff'](_0x1c04f9,_0x1bed('0x7'));this[_0x1bed('0x8')]('exitAt',_0x72227d);this['setDataValue'](_0x1bed('0x9'),_0xf3e0d6>=0x0?_0xf3e0d6:null);}},'data1':{'type':Sequelize[_0x1bed('0x1')],'comment':_0x1bed('0xa')},'data2':{'type':Sequelize[_0x1bed('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x1bed('0x1')],'comment':_0x1bed('0xb')},'data4':{'type':Sequelize[_0x1bed('0x1')],'comment':_0x1bed('0xc')},'data5':{'type':Sequelize[_0x1bed('0x1')],'comment':_0x1bed('0xd')},'role':{'type':Sequelize[_0x1bed('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x1bed('0x1')]}}; \ No newline at end of file +var _0xeeb4=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','INTEGER','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','diff','seconds','setDataValue','exitAt','duration'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeeb4,0x6d));var _0x4eeb=function(_0x3d11ed,_0x47a4b8){_0x3d11ed=_0x3d11ed-0x0;var _0xbbd56c=_0xeeb4[_0x3d11ed];return _0xbbd56c;};'use strict';var Sequelize=require(_0x4eeb('0x0'));var moment=require(_0x4eeb('0x1'));module['exports']={'channel':{'type':Sequelize[_0x4eeb('0x2')]},'membername':{'type':Sequelize[_0x4eeb('0x2')]},'interface':{'type':Sequelize[_0x4eeb('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x4eeb('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4eeb('0x4')],'set':function(_0x321164){var _0x34f7b4=moment(_0x321164);var _0x4f32bc=moment(this[_0x4eeb('0x5')]('enterAt'));var _0x39f17c=_0x34f7b4[_0x4eeb('0x6')](_0x4f32bc,_0x4eeb('0x7'));this[_0x4eeb('0x8')](_0x4eeb('0x9'),_0x321164);this[_0x4eeb('0x8')](_0x4eeb('0xa'),_0x39f17c>=0x0?_0x39f17c:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x4eeb('0xb')},'data2':{'type':Sequelize[_0x4eeb('0x2')],'comment':_0x4eeb('0xc')},'data3':{'type':Sequelize[_0x4eeb('0x2')],'comment':_0x4eeb('0xd')},'data4':{'type':Sequelize[_0x4eeb('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x4eeb('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x4eeb('0x2')]},'internal':{'type':Sequelize[_0x4eeb('0xe')]},'uniqueid':{'type':Sequelize[_0x4eeb('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 81a3c97..6d71826 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 _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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x55ca,0x126));var _0xa55c=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x55ca[_0x246148];return _0x453d94;};'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 +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x34e8,0x12c));var _0x834e=function(_0x197367,_0x2768a2){_0x197367=_0x197367-0x0;var _0x424ba2=_0x34e8[_0x197367];return _0x424ba2;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 118daec..0f4c923 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 _0x6838=['report_member','membername_interface','membername','interface','util','moment','path','rimraf','../../config/environment','./memberReport.attributes','define'];(function(_0x207fb7,_0x24b535){var _0x7617f=function(_0x5e4afe){while(--_0x5e4afe){_0x207fb7['push'](_0x207fb7['shift']());}};_0x7617f(++_0x24b535);}(_0x6838,0x67));var _0x8683=function(_0x290181,_0x46db3e){_0x290181=_0x290181-0x0;var _0x2dc9dc=_0x6838[_0x290181];return _0x2dc9dc;};'use strict';var _=require('lodash');var util=require(_0x8683('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8683('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8683('0x2'));var rimraf=require(_0x8683('0x3'));var config=require(_0x8683('0x4'));var attributes=require(_0x8683('0x5'));module['exports']=function(_0x1b3874,_0x26d2fa){return _0x1b3874[_0x8683('0x6')]('MemberReport',attributes,{'tableName':_0x8683('0x7'),'paranoid':![],'indexes':[{'name':_0x8683('0x8'),'fields':[_0x8683('0x9'),_0x8683('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb288=['rimraf','../../config/environment','exports','define','report_member','membername','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x502329,_0x4bd4e2){var _0x16ef34=function(_0x138396){while(--_0x138396){_0x502329['push'](_0x502329['shift']());}};_0x16ef34(++_0x4bd4e2);}(_0xb288,0x1b3));var _0x8b28=function(_0x598e92,_0x544197){_0x598e92=_0x598e92-0x0;var _0x2b7ad4=_0xb288[_0x598e92];return _0x2b7ad4;};'use strict';var _=require(_0x8b28('0x0'));var util=require(_0x8b28('0x1'));var logger=require(_0x8b28('0x2'))('api');var moment=require(_0x8b28('0x3'));var BPromise=require(_0x8b28('0x4'));var rp=require(_0x8b28('0x5'));var fs=require('fs');var path=require(_0x8b28('0x6'));var rimraf=require(_0x8b28('0x7'));var config=require(_0x8b28('0x8'));var attributes=require('./memberReport.attributes');module[_0x8b28('0x9')]=function(_0x670c4e,_0x237d61){return _0x670c4e[_0x8b28('0xa')]('MemberReport',attributes,{'tableName':_0x8b28('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x8b28('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index afef54d..74a380c 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 _0xd47f=['GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','model','map','catch','CreateMemberReport','body','UpdateMemberReport','update','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','message','error','result'];(function(_0x10e429,_0x3b3fed){var _0x5c9b76=function(_0x26d647){while(--_0x26d647){_0x10e429['push'](_0x10e429['shift']());}};_0x5c9b76(++_0x3b3fed);}(_0xd47f,0x1bd));var _0xfd47=function(_0x11fcba,_0x46ac13){_0x11fcba=_0x11fcba-0x0;var _0x2c792a=_0xd47f[_0x11fcba];return _0x2c792a;};'use strict';var _=require(_0xfd47('0x0'));var util=require('util');var moment=require(_0xfd47('0x1'));var BPromise=require(_0xfd47('0x2'));var rs=require(_0xfd47('0x3'));var fs=require('fs');var Redis=require(_0xfd47('0x4'));var db=require(_0xfd47('0x5'))['db'];var utils=require(_0xfd47('0x6'));var logger=require(_0xfd47('0x7'))(_0xfd47('0x8'));var config=require(_0xfd47('0x9'));var jayson=require(_0xfd47('0xa'));var client=jayson[_0xfd47('0xb')][_0xfd47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55fd0b,_0x53420b,_0x2a69b5){return new BPromise(function(_0x5859f6,_0x5cfba2){return client['request'](_0x55fd0b,_0x2a69b5)[_0xfd47('0xd')](function(_0x1d67e7){logger[_0xfd47('0xe')](_0xfd47('0xf'),_0x53420b,_0xfd47('0x10'));logger[_0xfd47('0x11')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x53420b,'request\x20sent',JSON[_0xfd47('0x12')](_0x1d67e7));if(_0x1d67e7['error']){if(_0x1d67e7['error'][_0xfd47('0x13')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x53420b,_0x1d67e7['error'][_0xfd47('0x14')]);return _0x5cfba2(_0x1d67e7['error'][_0xfd47('0x14')]);}logger[_0xfd47('0x15')](_0xfd47('0xf'),_0x53420b,_0x1d67e7['error'][_0xfd47('0x14')]);return _0x5859f6(_0x1d67e7[_0xfd47('0x15')][_0xfd47('0x14')]);}else{logger[_0xfd47('0xe')]('MemberReport,\x20%s,\x20%s',_0x53420b,_0xfd47('0x10'));_0x5859f6(_0x1d67e7[_0xfd47('0x16')][_0xfd47('0x14')]);}})['catch'](function(_0x59f36e){logger[_0xfd47('0x15')](_0xfd47('0xf'),_0x53420b,_0x59f36e);_0x5cfba2(_0x59f36e);});});}exports[_0xfd47('0x17')]=function(_0xf1bbb){var _0x1903c8=this;return new Promise(function(_0x4d2d27,_0x2b3fa4){return db[_0xfd47('0x18')][_0xfd47('0x19')]({'raw':_0xf1bbb[_0xfd47('0x1a')]?_0xf1bbb[_0xfd47('0x1a')][_0xfd47('0x1b')]===undefined?!![]:![]:!![],'where':_0xf1bbb['options']?_0xf1bbb[_0xfd47('0x1a')]['where']||null:null,'attributes':_0xf1bbb[_0xfd47('0x1a')]?_0xf1bbb[_0xfd47('0x1a')][_0xfd47('0x1c')]||null:null,'limit':_0xf1bbb[_0xfd47('0x1a')]?_0xf1bbb['options'][_0xfd47('0x1d')]||null:null,'include':_0xf1bbb[_0xfd47('0x1a')]?_0xf1bbb[_0xfd47('0x1a')][_0xfd47('0x1e')]?_['map'](_0xf1bbb['options'][_0xfd47('0x1e')],function(_0xc06999){return{'model':db[_0xc06999[_0xfd47('0x1f')]],'as':_0xc06999['as'],'attributes':_0xc06999[_0xfd47('0x1c')],'include':_0xc06999[_0xfd47('0x1e')]?_['map'](_0xc06999[_0xfd47('0x1e')],function(_0x5ca823){return{'model':db[_0x5ca823[_0xfd47('0x1f')]],'as':_0x5ca823['as'],'attributes':_0x5ca823[_0xfd47('0x1c')],'include':_0x5ca823[_0xfd47('0x1e')]?_[_0xfd47('0x20')](_0x5ca823[_0xfd47('0x1e')],function(_0xcce2e3){return{'model':db[_0xcce2e3[_0xfd47('0x1f')]],'as':_0xcce2e3['as'],'attributes':_0xcce2e3['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd47('0xd')](function(_0x33072e){logger[_0xfd47('0xe')](_0xfd47('0x17'),_0xf1bbb);logger[_0xfd47('0x11')](_0xfd47('0x17'),_0xf1bbb,JSON[_0xfd47('0x12')](_0x33072e));_0x4d2d27(_0x33072e);})[_0xfd47('0x21')](function(_0x3dfd47){logger[_0xfd47('0x15')](_0xfd47('0x17'),_0x3dfd47[_0xfd47('0x14')],_0xf1bbb);_0x2b3fa4(_0x1903c8['error'](0x1f4,_0x3dfd47[_0xfd47('0x14')]));});});};exports[_0xfd47('0x22')]=function(_0x148b9f){var _0x55bc70=this;return new Promise(function(_0x2e40fa,_0x543efa){return db[_0xfd47('0x18')]['create'](_0x148b9f[_0xfd47('0x23')],{'raw':_0x148b9f[_0xfd47('0x1a')]?_0x148b9f['options'][_0xfd47('0x1b')]===undefined?!![]:![]:!![]})[_0xfd47('0xd')](function(_0x3d95bc){logger[_0xfd47('0xe')](_0xfd47('0x22'),_0x148b9f);logger[_0xfd47('0x11')](_0xfd47('0x22'),_0x148b9f,JSON['stringify'](_0x3d95bc));_0x2e40fa(_0x3d95bc);})[_0xfd47('0x21')](function(_0x28942d){logger['error'](_0xfd47('0x22'),_0x28942d[_0xfd47('0x14')],_0x148b9f);_0x543efa(_0x55bc70[_0xfd47('0x15')](0x1f4,_0x28942d['message']));});});};exports[_0xfd47('0x24')]=function(_0x5be1b2){var _0x179e41=this;return new Promise(function(_0x2fb3b3,_0x548939){return db[_0xfd47('0x18')][_0xfd47('0x25')](_0x5be1b2[_0xfd47('0x23')],{'raw':_0x5be1b2['options']?_0x5be1b2[_0xfd47('0x1a')][_0xfd47('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5be1b2[_0xfd47('0x1a')]?_0x5be1b2['options'][_0xfd47('0x26')]||null:null,'attributes':_0x5be1b2[_0xfd47('0x1a')]?_0x5be1b2['options'][_0xfd47('0x1c')]||null:null,'limit':_0x5be1b2[_0xfd47('0x1a')]?_0x5be1b2['options']['limit']||null:null})[_0xfd47('0xd')](function(_0x55fcdf){logger[_0xfd47('0xe')]('UpdateMemberReport',_0x5be1b2);logger[_0xfd47('0x11')](_0xfd47('0x24'),_0x5be1b2,JSON['stringify'](_0x55fcdf));_0x2fb3b3(_0x55fcdf);})[_0xfd47('0x21')](function(_0x5193de){logger[_0xfd47('0x15')]('UpdateMemberReport',_0x5193de[_0xfd47('0x14')],_0x5be1b2);_0x548939(_0x179e41['error'](0x1f4,_0x5193de[_0xfd47('0x14')]));});});}; \ No newline at end of file +var _0x8458=['where','attributes','limit','include','map','model','catch','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetMemberReport','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8458,0x1a5));var _0x8845=function(_0x42dce1,_0x2402ec){_0x42dce1=_0x42dce1-0x0;var _0x9d8d5e=_0x8458[_0x42dce1];return _0x9d8d5e;};'use strict';var _=require(_0x8845('0x0'));var util=require('util');var moment=require(_0x8845('0x1'));var BPromise=require(_0x8845('0x2'));var rs=require(_0x8845('0x3'));var fs=require('fs');var Redis=require(_0x8845('0x4'));var db=require(_0x8845('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8845('0x6'))(_0x8845('0x7'));var config=require(_0x8845('0x8'));var jayson=require(_0x8845('0x9'));var client=jayson[_0x8845('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c4099,_0x59d900,_0x2a91b4){return new BPromise(function(_0x3067d1,_0xd94398){return client['request'](_0x3c4099,_0x2a91b4)[_0x8845('0xb')](function(_0x33b0dc){logger['info'](_0x8845('0xc'),_0x59d900,_0x8845('0xd'));logger['debug'](_0x8845('0xe'),_0x59d900,_0x8845('0xd'),JSON[_0x8845('0xf')](_0x33b0dc));if(_0x33b0dc[_0x8845('0x10')]){if(_0x33b0dc[_0x8845('0x10')][_0x8845('0x11')]===0x1f4){logger[_0x8845('0x10')](_0x8845('0xc'),_0x59d900,_0x33b0dc[_0x8845('0x10')][_0x8845('0x12')]);return _0xd94398(_0x33b0dc[_0x8845('0x10')][_0x8845('0x12')]);}logger[_0x8845('0x10')](_0x8845('0xc'),_0x59d900,_0x33b0dc['error'][_0x8845('0x12')]);return _0x3067d1(_0x33b0dc[_0x8845('0x10')]['message']);}else{logger[_0x8845('0x13')](_0x8845('0xc'),_0x59d900,_0x8845('0xd'));_0x3067d1(_0x33b0dc['result']['message']);}})['catch'](function(_0x3c3864){logger[_0x8845('0x10')](_0x8845('0xc'),_0x59d900,_0x3c3864);_0xd94398(_0x3c3864);});});}exports[_0x8845('0x14')]=function(_0x10f1d5){var _0x27761f=this;return new Promise(function(_0x433170,_0x49c56a){return db['MemberReport']['findAll']({'raw':_0x10f1d5[_0x8845('0x15')]?_0x10f1d5[_0x8845('0x15')][_0x8845('0x16')]===undefined?!![]:![]:!![],'where':_0x10f1d5[_0x8845('0x15')]?_0x10f1d5['options'][_0x8845('0x17')]||null:null,'attributes':_0x10f1d5['options']?_0x10f1d5['options'][_0x8845('0x18')]||null:null,'limit':_0x10f1d5[_0x8845('0x15')]?_0x10f1d5['options'][_0x8845('0x19')]||null:null,'include':_0x10f1d5[_0x8845('0x15')]?_0x10f1d5['options'][_0x8845('0x1a')]?_[_0x8845('0x1b')](_0x10f1d5[_0x8845('0x15')][_0x8845('0x1a')],function(_0x4e48b1){return{'model':db[_0x4e48b1['model']],'as':_0x4e48b1['as'],'attributes':_0x4e48b1[_0x8845('0x18')],'include':_0x4e48b1[_0x8845('0x1a')]?_[_0x8845('0x1b')](_0x4e48b1[_0x8845('0x1a')],function(_0x3d2fca){return{'model':db[_0x3d2fca[_0x8845('0x1c')]],'as':_0x3d2fca['as'],'attributes':_0x3d2fca[_0x8845('0x18')],'include':_0x3d2fca[_0x8845('0x1a')]?_[_0x8845('0x1b')](_0x3d2fca[_0x8845('0x1a')],function(_0x3e1e6e){return{'model':db[_0x3e1e6e[_0x8845('0x1c')]],'as':_0x3e1e6e['as'],'attributes':_0x3e1e6e[_0x8845('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8845('0xb')](function(_0xe997a6){logger[_0x8845('0x13')](_0x8845('0x14'),_0x10f1d5);logger['debug']('GetMemberReport',_0x10f1d5,JSON[_0x8845('0xf')](_0xe997a6));_0x433170(_0xe997a6);})[_0x8845('0x1d')](function(_0x26cae2){logger[_0x8845('0x10')](_0x8845('0x14'),_0x26cae2[_0x8845('0x12')],_0x10f1d5);_0x49c56a(_0x27761f[_0x8845('0x10')](0x1f4,_0x26cae2['message']));});});};exports[_0x8845('0x1e')]=function(_0x3fa3f0){var _0x501362=this;return new Promise(function(_0x3e3fbe,_0x4de264){return db[_0x8845('0x1f')][_0x8845('0x20')](_0x3fa3f0[_0x8845('0x21')],{'raw':_0x3fa3f0[_0x8845('0x15')]?_0x3fa3f0[_0x8845('0x15')][_0x8845('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x519a35){logger[_0x8845('0x13')](_0x8845('0x1e'),_0x3fa3f0);logger['debug'](_0x8845('0x1e'),_0x3fa3f0,JSON[_0x8845('0xf')](_0x519a35));_0x3e3fbe(_0x519a35);})[_0x8845('0x1d')](function(_0x58a8c6){logger['error'](_0x8845('0x1e'),_0x58a8c6['message'],_0x3fa3f0);_0x4de264(_0x501362[_0x8845('0x10')](0x1f4,_0x58a8c6[_0x8845('0x12')]));});});};exports[_0x8845('0x22')]=function(_0x4a2ee0){var _0x367b8e=this;return new Promise(function(_0x28daab,_0x22a6e4){return db['MemberReport'][_0x8845('0x23')](_0x4a2ee0['body'],{'raw':_0x4a2ee0[_0x8845('0x15')]?_0x4a2ee0[_0x8845('0x15')][_0x8845('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a2ee0[_0x8845('0x15')]?_0x4a2ee0[_0x8845('0x15')][_0x8845('0x17')]||null:null,'attributes':_0x4a2ee0[_0x8845('0x15')]?_0x4a2ee0[_0x8845('0x15')]['attributes']||null:null,'limit':_0x4a2ee0[_0x8845('0x15')]?_0x4a2ee0['options'][_0x8845('0x19')]||null:null})['then'](function(_0x146125){logger[_0x8845('0x13')]('UpdateMemberReport',_0x4a2ee0);logger[_0x8845('0x24')]('UpdateMemberReport',_0x4a2ee0,JSON[_0x8845('0xf')](_0x146125));_0x28daab(_0x146125);})[_0x8845('0x1d')](function(_0x24d5ce){logger[_0x8845('0x10')](_0x8845('0x22'),_0x24d5ce[_0x8845('0x12')],_0x4a2ee0);_0x22a6e4(_0x367b8e[_0x8845('0x10')](0x1f4,_0x24d5ce[_0x8845('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 19272f9..07503ad 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 _0x8f5d=['express','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','path','connect-timeout'];(function(_0x1417c6,_0x194309){var _0x44db97=function(_0xa2a293){while(--_0xa2a293){_0x1417c6['push'](_0x1417c6['shift']());}};_0x44db97(++_0x194309);}(_0x8f5d,0xb8));var _0xd8f5=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x8f5d[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require(_0xd8f5('0x0'));var util=require('util');var path=require(_0xd8f5('0x1'));var timeout=require(_0xd8f5('0x2'));var express=require(_0xd8f5('0x3'));var router=express['Router']();var fs_extra=require(_0xd8f5('0x4'));var auth=require(_0xd8f5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd8f5('0x6'));var controller=require(_0xd8f5('0x7'));router[_0xd8f5('0x8')]('/',controller[_0xd8f5('0x9')]);module[_0xd8f5('0xa')]=router; \ No newline at end of file +var _0xe80e=['index','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./migration.controller'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe80e,0x1d8));var _0xee80=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe80e[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0xee80('0x0'));var util=require(_0xee80('0x1'));var path=require(_0xee80('0x2'));var timeout=require(_0xee80('0x3'));var express=require(_0xee80('0x4'));var router=express['Router']();var fs_extra=require(_0xee80('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xee80('0x6'));var config=require('../../config/environment');var controller=require(_0xee80('0x7'));router['get']('/',controller[_0xee80('0x8')]);module[_0xee80('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 988e1ef..0151079 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 _0x74cf=['exports','STRING','version','sequelize'];(function(_0xf23f7f,_0x32ef80){var _0x17793b=function(_0x39bdb9){while(--_0x39bdb9){_0xf23f7f['push'](_0xf23f7f['shift']());}};_0x17793b(++_0x32ef80);}(_0x74cf,0xaf));var _0xf74c=function(_0x57fa5c,_0x22d1e7){_0x57fa5c=_0x57fa5c-0x0;var _0x270ebe=_0x74cf[_0x57fa5c];return _0x270ebe;};'use strict';var Sequelize=require(_0xf74c('0x0'));module[_0xf74c('0x1')]={'version':{'type':Sequelize[_0xf74c('0x2')],'unique':_0xf74c('0x3')}}; \ No newline at end of file +var _0x01a3=['STRING','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x01a3,0x1a1));var _0x301a=function(_0x274b16,_0x5d7ef1){_0x274b16=_0x274b16-0x0;var _0x32e340=_0x01a3[_0x274b16];return _0x32e340;};'use strict';var Sequelize=require('sequelize');module[_0x301a('0x0')]={'version':{'type':Sequelize[_0x301a('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 70d966c..2de875e 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 _0x1d16=['hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','includeAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','Migration','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length'];(function(_0x73a549,_0x2afdbb){var _0x2a35ce=function(_0x50a62e){while(--_0x50a62e){_0x73a549['push'](_0x73a549['shift']());}};_0x2a35ce(++_0x2afdbb);}(_0x1d16,0x102));var _0x61d1=function(_0x3a33ff,_0x431390){_0x3a33ff=_0x3a33ff-0x0;var _0x214ba7=_0x1d16[_0x3a33ff];return _0x214ba7;};'use strict';var emlformat=require(_0x61d1('0x0'));var rimraf=require(_0x61d1('0x1'));var zipdir=require(_0x61d1('0x2'));var jsonpatch=require(_0x61d1('0x3'));var rp=require('request-promise');var moment=require(_0x61d1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x61d1('0x5'));var path=require('path');var sox=require(_0x61d1('0x6'));var csv=require('to-csv');var ejs=require(_0x61d1('0x7'));var fs=require('fs');var fs_extra=require(_0x61d1('0x8'));var _=require(_0x61d1('0x9'));var squel=require(_0x61d1('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x61d1('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x61d1('0xc'));var Redis=require(_0x61d1('0xd'));var authService=require(_0x61d1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x61d1('0xf'));var hardwareService=require(_0x61d1('0x10'));var logger=require(_0x61d1('0x11'))(_0x61d1('0x12'));var utils=require(_0x61d1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x61d1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47a388,_0xe3aae7){_0xe3aae7=_0xe3aae7||0xcc;return function(_0x7afd1d){if(_0x7afd1d){return _0x47a388[_0x61d1('0x15')](_0xe3aae7);}return _0x47a388[_0x61d1('0x16')](_0xe3aae7)[_0x61d1('0x17')]();};}function respondWithResult(_0x3a5c12,_0x552938){_0x552938=_0x552938||0xc8;return function(_0x418096){if(_0x418096){return _0x3a5c12[_0x61d1('0x16')](_0x552938)[_0x61d1('0x18')](_0x418096);}};}function respondWithFilteredResult(_0x341132,_0x42e287){return function(_0x217f77){if(_0x217f77){var _0x5101f1=typeof _0x42e287[_0x61d1('0x19')]===_0x61d1('0x1a')&&typeof _0x42e287[_0x61d1('0x1b')]===_0x61d1('0x1a');var _0x4220be=_0x217f77[_0x61d1('0x1c')];var _0x4b7f1e=_0x5101f1?0x0:_0x42e287['offset'];var _0x5a604a=_0x5101f1?_0x217f77['count']:_0x42e287[_0x61d1('0x19')]+_0x42e287[_0x61d1('0x1b')];var _0x2b2c10;if(_0x5a604a>=_0x4220be){_0x5a604a=_0x4220be;_0x2b2c10=0xc8;}else{_0x2b2c10=0xce;}_0x341132[_0x61d1('0x16')](_0x2b2c10);return _0x341132[_0x61d1('0x1d')](_0x61d1('0x1e'),_0x4b7f1e+'-'+_0x5a604a+'/'+_0x4220be)[_0x61d1('0x18')](_0x217f77);}return null;};}function patchUpdates(_0x2a6b29){return function(_0x3b9d45){try{jsonpatch[_0x61d1('0x1f')](_0x3b9d45,_0x2a6b29,!![]);}catch(_0x42f138){return BPromise[_0x61d1('0x20')](_0x42f138);}return _0x3b9d45[_0x61d1('0x21')]();};}function saveUpdates(_0x31972c,_0x41edae){return function(_0x21eab4){if(_0x21eab4){return _0x21eab4['update'](_0x31972c)[_0x61d1('0x22')](function(_0x2ec8a4){return _0x2ec8a4;});}return null;};}function removeEntity(_0x119245,_0x125dc6){return function(_0x37eb9e){if(_0x37eb9e){return _0x37eb9e[_0x61d1('0x23')]()[_0x61d1('0x22')](function(){_0x119245[_0x61d1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1065e1,_0xfaec14){return function(_0x2f13cc){if(!_0x2f13cc){_0x1065e1['sendStatus'](0x194);}return _0x2f13cc;};}function handleError(_0x10224f,_0x56a58a){_0x56a58a=_0x56a58a||0x1f4;return function(_0x46de88){logger[_0x61d1('0x24')](_0x46de88[_0x61d1('0x25')]);if(_0x46de88[_0x61d1('0x26')]){delete _0x46de88[_0x61d1('0x26')];}_0x10224f[_0x61d1('0x16')](_0x56a58a)['send'](_0x46de88);};}exports[_0x61d1('0x27')]=function(_0x58ad75,_0x130fa7){var _0x27fe7a={},_0x2bb43b={},_0x25ca6b={'count':0x0,'rows':[]};var _0x5342f7=_[_0x61d1('0x28')](db[_0x61d1('0x29')][_0x61d1('0x2a')],function(_0x45993d){return{'name':_0x45993d[_0x61d1('0x2b')],'type':_0x45993d[_0x61d1('0x2c')][_0x61d1('0x2d')]};});_0x2bb43b[_0x61d1('0x2e')]=_[_0x61d1('0x28')](_0x5342f7,_0x61d1('0x26'));_0x2bb43b[_0x61d1('0x2f')]=_['keys'](_0x58ad75[_0x61d1('0x2f')]);_0x2bb43b[_0x61d1('0x30')]=_['intersection'](_0x2bb43b[_0x61d1('0x2e')],_0x2bb43b['query']);_0x27fe7a[_0x61d1('0x31')]=_['intersection'](_0x2bb43b[_0x61d1('0x2e')],qs[_0x61d1('0x32')](_0x58ad75[_0x61d1('0x2f')][_0x61d1('0x32')]));_0x27fe7a[_0x61d1('0x31')]=_0x27fe7a['attributes'][_0x61d1('0x33')]?_0x27fe7a[_0x61d1('0x31')]:_0x2bb43b['model'];if(!_0x58ad75[_0x61d1('0x2f')][_0x61d1('0x34')](_0x61d1('0x35'))){_0x27fe7a[_0x61d1('0x1b')]=qs[_0x61d1('0x1b')](_0x58ad75[_0x61d1('0x2f')][_0x61d1('0x1b')]);_0x27fe7a[_0x61d1('0x19')]=qs[_0x61d1('0x19')](_0x58ad75[_0x61d1('0x2f')][_0x61d1('0x19')]);}_0x27fe7a['order']=qs[_0x61d1('0x36')](_0x58ad75[_0x61d1('0x2f')][_0x61d1('0x36')]);_0x27fe7a['where']=qs['filters'](_[_0x61d1('0x37')](_0x58ad75[_0x61d1('0x2f')],_0x2bb43b[_0x61d1('0x30')]),_0x5342f7);if(_0x58ad75[_0x61d1('0x2f')]['filter']){_0x27fe7a[_0x61d1('0x38')]=_[_0x61d1('0x39')](_0x27fe7a[_0x61d1('0x38')],{'$or':_[_0x61d1('0x28')](_0x5342f7,function(_0x42c8fa){if(_0x42c8fa[_0x61d1('0x2c')]!==_0x61d1('0x3a')){var _0x4fe7d1={};_0x4fe7d1[_0x42c8fa[_0x61d1('0x26')]]={'$like':'%'+_0x58ad75[_0x61d1('0x2f')]['filter']+'%'};return _0x4fe7d1;}})});}_0x27fe7a=_[_0x61d1('0x39')]({},_0x27fe7a,_0x58ad75[_0x61d1('0x3b')]);var _0x5964a1={'where':_0x27fe7a['where']};return db[_0x61d1('0x29')][_0x61d1('0x1c')](_0x5964a1)[_0x61d1('0x22')](function(_0x1917f3){_0x25ca6b[_0x61d1('0x1c')]=_0x1917f3;if(_0x58ad75[_0x61d1('0x2f')][_0x61d1('0x3c')]){_0x27fe7a['include']=[{'all':!![]}];}return db[_0x61d1('0x29')]['findAll'](_0x27fe7a);})[_0x61d1('0x22')](function(_0x42fa0f){_0x25ca6b['rows']=_0x42fa0f;return _0x25ca6b;})[_0x61d1('0x22')](respondWithFilteredResult(_0x130fa7,_0x27fe7a))[_0x61d1('0x3d')](handleError(_0x130fa7,null));}; \ No newline at end of file +var _0x34bf=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','Migration','rawAttributes','fieldName','type','key','keys','filters','model','attributes','intersection','fields','query','length','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x56a073,_0x4e18a0){var _0x5dbc06=function(_0x173091){while(--_0x173091){_0x56a073['push'](_0x56a073['shift']());}};_0x5dbc06(++_0x4e18a0);}(_0x34bf,0x188));var _0xf34b=function(_0xa861aa,_0x2895a4){_0xa861aa=_0xa861aa-0x0;var _0x1e34de=_0x34bf[_0xa861aa];return _0x1e34de;};'use strict';var emlformat=require(_0xf34b('0x0'));var rimraf=require(_0xf34b('0x1'));var zipdir=require(_0xf34b('0x2'));var jsonpatch=require(_0xf34b('0x3'));var rp=require(_0xf34b('0x4'));var moment=require(_0xf34b('0x5'));var BPromise=require(_0xf34b('0x6'));var Mustache=require(_0xf34b('0x7'));var util=require(_0xf34b('0x8'));var path=require(_0xf34b('0x9'));var sox=require(_0xf34b('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf34b('0xb'));var _=require(_0xf34b('0xc'));var squel=require(_0xf34b('0xd'));var crypto=require(_0xf34b('0xe'));var jsforce=require(_0xf34b('0xf'));var deskjs=require(_0xf34b('0x10'));var toCsv=require(_0xf34b('0x11'));var querystring=require(_0xf34b('0x12'));var Papa=require('papaparse');var Redis=require(_0xf34b('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf34b('0x14'));var logger=require(_0xf34b('0x15'))(_0xf34b('0x16'));var utils=require(_0xf34b('0x17'));var config=require(_0xf34b('0x18'));var licenseUtil=require(_0xf34b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36bbd8,_0x46d270){_0x46d270=_0x46d270||0xcc;return function(_0x44a0bf){if(_0x44a0bf){return _0x36bbd8[_0xf34b('0x1a')](_0x46d270);}return _0x36bbd8[_0xf34b('0x1b')](_0x46d270)['end']();};}function respondWithResult(_0x5a40bb,_0x148dde){_0x148dde=_0x148dde||0xc8;return function(_0x38657a){if(_0x38657a){return _0x5a40bb[_0xf34b('0x1b')](_0x148dde)[_0xf34b('0x1c')](_0x38657a);}};}function respondWithFilteredResult(_0x32a19a,_0x8d9694){return function(_0x3c28ce){if(_0x3c28ce){var _0x50511c=typeof _0x8d9694[_0xf34b('0x1d')]===_0xf34b('0x1e')&&typeof _0x8d9694[_0xf34b('0x1f')]===_0xf34b('0x1e');var _0x3bcbdf=_0x3c28ce[_0xf34b('0x20')];var _0x154674=_0x50511c?0x0:_0x8d9694[_0xf34b('0x1d')];var _0x5d6788=_0x50511c?_0x3c28ce[_0xf34b('0x20')]:_0x8d9694[_0xf34b('0x1d')]+_0x8d9694['limit'];var _0x252252;if(_0x5d6788>=_0x3bcbdf){_0x5d6788=_0x3bcbdf;_0x252252=0xc8;}else{_0x252252=0xce;}_0x32a19a[_0xf34b('0x1b')](_0x252252);return _0x32a19a[_0xf34b('0x21')](_0xf34b('0x22'),_0x154674+'-'+_0x5d6788+'/'+_0x3bcbdf)[_0xf34b('0x1c')](_0x3c28ce);}return null;};}function patchUpdates(_0x11bf80){return function(_0x193a2d){try{jsonpatch[_0xf34b('0x23')](_0x193a2d,_0x11bf80,!![]);}catch(_0x76d6da){return BPromise[_0xf34b('0x24')](_0x76d6da);}return _0x193a2d[_0xf34b('0x25')]();};}function saveUpdates(_0x4761d8,_0x97e92e){return function(_0x38d44d){if(_0x38d44d){return _0x38d44d[_0xf34b('0x26')](_0x4761d8)[_0xf34b('0x27')](function(_0x4e07db){return _0x4e07db;});}return null;};}function removeEntity(_0x4a937a,_0x31fa8d){return function(_0x41b8b1){if(_0x41b8b1){return _0x41b8b1[_0xf34b('0x28')]()[_0xf34b('0x27')](function(){_0x4a937a[_0xf34b('0x1b')](0xcc)[_0xf34b('0x29')]();});}};}function handleEntityNotFound(_0x5b9479,_0x3708ed){return function(_0x56a0f7){if(!_0x56a0f7){_0x5b9479[_0xf34b('0x1a')](0x194);}return _0x56a0f7;};}function handleError(_0x2cfd20,_0x1b7fc9){_0x1b7fc9=_0x1b7fc9||0x1f4;return function(_0x115f2a){logger[_0xf34b('0x2a')](_0x115f2a['stack']);if(_0x115f2a[_0xf34b('0x2b')]){delete _0x115f2a['name'];}_0x2cfd20[_0xf34b('0x1b')](_0x1b7fc9)[_0xf34b('0x2c')](_0x115f2a);};}exports['index']=function(_0x1e20da,_0x300b31){var _0x204700={},_0x58d925={},_0x1624f7={'count':0x0,'rows':[]};var _0x28084c=_[_0xf34b('0x2d')](db[_0xf34b('0x2e')][_0xf34b('0x2f')],function(_0x481149){return{'name':_0x481149[_0xf34b('0x30')],'type':_0x481149[_0xf34b('0x31')][_0xf34b('0x32')]};});_0x58d925['model']=_[_0xf34b('0x2d')](_0x28084c,_0xf34b('0x2b'));_0x58d925['query']=_[_0xf34b('0x33')](_0x1e20da['query']);_0x58d925[_0xf34b('0x34')]=_['intersection'](_0x58d925[_0xf34b('0x35')],_0x58d925['query']);_0x204700[_0xf34b('0x36')]=_[_0xf34b('0x37')](_0x58d925[_0xf34b('0x35')],qs[_0xf34b('0x38')](_0x1e20da[_0xf34b('0x39')][_0xf34b('0x38')]));_0x204700[_0xf34b('0x36')]=_0x204700[_0xf34b('0x36')][_0xf34b('0x3a')]?_0x204700['attributes']:_0x58d925[_0xf34b('0x35')];if(!_0x1e20da['query']['hasOwnProperty']('nolimit')){_0x204700[_0xf34b('0x1f')]=qs[_0xf34b('0x1f')](_0x1e20da[_0xf34b('0x39')]['limit']);_0x204700[_0xf34b('0x1d')]=qs[_0xf34b('0x1d')](_0x1e20da['query'][_0xf34b('0x1d')]);}_0x204700[_0xf34b('0x3b')]=qs[_0xf34b('0x3c')](_0x1e20da[_0xf34b('0x39')][_0xf34b('0x3c')]);_0x204700[_0xf34b('0x3d')]=qs[_0xf34b('0x34')](_[_0xf34b('0x3e')](_0x1e20da[_0xf34b('0x39')],_0x58d925[_0xf34b('0x34')]),_0x28084c);if(_0x1e20da[_0xf34b('0x39')][_0xf34b('0x3f')]){_0x204700[_0xf34b('0x3d')]=_[_0xf34b('0x40')](_0x204700['where'],{'$or':_[_0xf34b('0x2d')](_0x28084c,function(_0x1b5bc){if(_0x1b5bc['type']!=='VIRTUAL'){var _0x2bdf62={};_0x2bdf62[_0x1b5bc[_0xf34b('0x2b')]]={'$like':'%'+_0x1e20da['query'][_0xf34b('0x3f')]+'%'};return _0x2bdf62;}})});}_0x204700=_[_0xf34b('0x40')]({},_0x204700,_0x1e20da[_0xf34b('0x41')]);var _0x450b81={'where':_0x204700[_0xf34b('0x3d')]};return db[_0xf34b('0x2e')][_0xf34b('0x20')](_0x450b81)[_0xf34b('0x27')](function(_0x448f77){_0x1624f7[_0xf34b('0x20')]=_0x448f77;if(_0x1e20da[_0xf34b('0x39')][_0xf34b('0x42')]){_0x204700['include']=[{'all':!![]}];}return db[_0xf34b('0x2e')][_0xf34b('0x43')](_0x204700);})['then'](function(_0x5e777f){_0x1624f7[_0xf34b('0x44')]=_0x5e777f;return _0x1624f7;})[_0xf34b('0x27')](respondWithFilteredResult(_0x300b31,_0x204700))[_0xf34b('0x45')](handleError(_0x300b31,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 6a81c5b..157eef2 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 _0x7d0e=['./migration.attributes','Migration','migrations','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x39f5ec,_0xa273b6){var _0x490214=function(_0x535a1d){while(--_0x535a1d){_0x39f5ec['push'](_0x39f5ec['shift']());}};_0x490214(++_0xa273b6);}(_0x7d0e,0x12c));var _0xe7d0=function(_0x342f9d,_0x941466){_0x342f9d=_0x342f9d-0x0;var _0x2c9f5c=_0x7d0e[_0x342f9d];return _0x2c9f5c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7d0('0x0'))(_0xe7d0('0x1'));var moment=require('moment');var BPromise=require(_0xe7d0('0x2'));var rp=require(_0xe7d0('0x3'));var fs=require('fs');var path=require(_0xe7d0('0x4'));var rimraf=require('rimraf');var config=require(_0xe7d0('0x5'));var attributes=require(_0xe7d0('0x6'));module['exports']=function(_0x3cdfe2,_0x5a8046){return _0x3cdfe2['define'](_0xe7d0('0x7'),attributes,{'tableName':_0xe7d0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6665=['Migration','migrations','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x782be4,_0x1d1934){var _0x44e515=function(_0x4a1823){while(--_0x4a1823){_0x782be4['push'](_0x782be4['shift']());}};_0x44e515(++_0x1d1934);}(_0x6665,0x120));var _0x5666=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x6665[_0x37bd26];return _0xe83dc4;};'use strict';var _=require('lodash');var util=require(_0x5666('0x0'));var logger=require(_0x5666('0x1'))(_0x5666('0x2'));var moment=require(_0x5666('0x3'));var BPromise=require('bluebird');var rp=require(_0x5666('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5666('0x5'));var config=require(_0x5666('0x6'));var attributes=require('./migration.attributes');module[_0x5666('0x7')]=function(_0x4bf177,_0x2d21b8){return _0x4bf177[_0x5666('0x8')](_0x5666('0x9'),attributes,{'tableName':_0x5666('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index cfc71b2..0d4ab7f 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 _0xbf6e=['Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','debug'];(function(_0x411cd1,_0x4930e2){var _0x547854=function(_0x27e6d9){while(--_0x27e6d9){_0x411cd1['push'](_0x411cd1['shift']());}};_0x547854(++_0x4930e2);}(_0xbf6e,0x149));var _0xebf6=function(_0x535fe2,_0x1386c1){_0x535fe2=_0x535fe2-0x0;var _0x3dbe45=_0xbf6e[_0x535fe2];return _0x3dbe45;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebf6('0x0'));var BPromise=require(_0xebf6('0x1'));var rs=require(_0xebf6('0x2'));var fs=require('fs');var Redis=require(_0xebf6('0x3'));var db=require(_0xebf6('0x4'))['db'];var utils=require(_0xebf6('0x5'));var logger=require(_0xebf6('0x6'))('rpc');var config=require(_0xebf6('0x7'));var jayson=require(_0xebf6('0x8'));var client=jayson[_0xebf6('0x9')][_0xebf6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x143344,_0x1e02b3,_0x137e39){return new BPromise(function(_0x548e9e,_0x1d8035){return client[_0xebf6('0xb')](_0x143344,_0x137e39)[_0xebf6('0xc')](function(_0x591132){logger[_0xebf6('0xd')](_0xebf6('0xe'),_0x1e02b3,'request\x20sent');logger[_0xebf6('0xf')](_0xebf6('0x10'),_0x1e02b3,_0xebf6('0x11'),JSON[_0xebf6('0x12')](_0x591132));if(_0x591132[_0xebf6('0x13')]){if(_0x591132[_0xebf6('0x13')]['code']===0x1f4){logger[_0xebf6('0x13')](_0xebf6('0xe'),_0x1e02b3,_0x591132['error'][_0xebf6('0x14')]);return _0x1d8035(_0x591132[_0xebf6('0x13')][_0xebf6('0x14')]);}logger[_0xebf6('0x13')](_0xebf6('0xe'),_0x1e02b3,_0x591132['error']['message']);return _0x548e9e(_0x591132['error'][_0xebf6('0x14')]);}else{logger[_0xebf6('0xd')]('Migration,\x20%s,\x20%s',_0x1e02b3,_0xebf6('0x11'));_0x548e9e(_0x591132[_0xebf6('0x15')][_0xebf6('0x14')]);}})[_0xebf6('0x16')](function(_0x3100ee){logger[_0xebf6('0x13')](_0xebf6('0xe'),_0x1e02b3,_0x3100ee);_0x1d8035(_0x3100ee);});});} \ No newline at end of file +var _0x2182=['debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x561528,_0x4dbb45){var _0x31456b=function(_0x35642e){while(--_0x35642e){_0x561528['push'](_0x561528['shift']());}};_0x31456b(++_0x4dbb45);}(_0x2182,0xea));var _0x2218=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2182[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x2218('0x0'));var util=require(_0x2218('0x1'));var moment=require(_0x2218('0x2'));var BPromise=require(_0x2218('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2218('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2218('0x5'));var logger=require(_0x2218('0x6'))(_0x2218('0x7'));var config=require(_0x2218('0x8'));var jayson=require(_0x2218('0x9'));var client=jayson[_0x2218('0xa')][_0x2218('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22eab9,_0x142d1d,_0x29e762){return new BPromise(function(_0x4b3bd1,_0x1197d1){return client[_0x2218('0xc')](_0x22eab9,_0x29e762)[_0x2218('0xd')](function(_0x5bd041){logger['info'](_0x2218('0xe'),_0x142d1d,_0x2218('0xf'));logger[_0x2218('0x10')](_0x2218('0x11'),_0x142d1d,'request\x20sent',JSON[_0x2218('0x12')](_0x5bd041));if(_0x5bd041[_0x2218('0x13')]){if(_0x5bd041[_0x2218('0x13')][_0x2218('0x14')]===0x1f4){logger[_0x2218('0x13')]('Migration,\x20%s,\x20%s',_0x142d1d,_0x5bd041[_0x2218('0x13')]['message']);return _0x1197d1(_0x5bd041[_0x2218('0x13')][_0x2218('0x15')]);}logger[_0x2218('0x13')](_0x2218('0xe'),_0x142d1d,_0x5bd041[_0x2218('0x13')][_0x2218('0x15')]);return _0x4b3bd1(_0x5bd041[_0x2218('0x13')][_0x2218('0x15')]);}else{logger[_0x2218('0x16')](_0x2218('0xe'),_0x142d1d,_0x2218('0xf'));_0x4b3bd1(_0x5bd041[_0x2218('0x17')][_0x2218('0x15')]);}})[_0x2218('0x18')](function(_0x21a612){logger[_0x2218('0x13')](_0x2218('0xe'),_0x142d1d,_0x21a612);_0x1197d1(_0x21a612);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 74d2e85..afc49af 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 _0x544f=['post','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show'];(function(_0x4d26f3,_0x3e1615){var _0x3accb7=function(_0x53c769){while(--_0x53c769){_0x4d26f3['push'](_0x4d26f3['shift']());}};_0x3accb7(++_0x3e1615);}(_0x544f,0x104));var _0xf544=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x544f[_0x2b9b7f];return _0x4ed19a;};'use strict';var multer=require('multer');var util=require(_0xf544('0x0'));var path=require('path');var timeout=require(_0xf544('0x1'));var express=require(_0xf544('0x2'));var router=express[_0xf544('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf544('0x4'));var interaction=require(_0xf544('0x5'));var config=require(_0xf544('0x6'));var controller=require('./network.controller');router[_0xf544('0x7')]('/',auth[_0xf544('0x8')](),controller['index']);router['get']('/:id',auth[_0xf544('0x8')](),controller[_0xf544('0x9')]);router[_0xf544('0xa')]('/',auth['isAuthenticated'](),controller[_0xf544('0xb')]);router[_0xf544('0xc')](_0xf544('0xd'),auth[_0xf544('0x8')](),controller[_0xf544('0xe')]);router[_0xf544('0xf')](_0xf544('0xd'),auth[_0xf544('0x8')](),controller[_0xf544('0x10')]);module[_0xf544('0x11')]=router; \ No newline at end of file +var _0xa49e=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','put'];(function(_0x51ff81,_0x17b4ab){var _0x47dd46=function(_0x25537f){while(--_0x25537f){_0x51ff81['push'](_0x51ff81['shift']());}};_0x47dd46(++_0x17b4ab);}(_0xa49e,0x1de));var _0xea49=function(_0x44606e,_0x2bf244){_0x44606e=_0x44606e-0x0;var _0xe68388=_0xa49e[_0x44606e];return _0xe68388;};'use strict';var multer=require(_0xea49('0x0'));var util=require(_0xea49('0x1'));var path=require(_0xea49('0x2'));var timeout=require(_0xea49('0x3'));var express=require(_0xea49('0x4'));var router=express[_0xea49('0x5')]();var fs_extra=require(_0xea49('0x6'));var auth=require(_0xea49('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xea49('0x8'));var controller=require(_0xea49('0x9'));router[_0xea49('0xa')]('/',auth['isAuthenticated'](),controller[_0xea49('0xb')]);router[_0xea49('0xa')](_0xea49('0xc'),auth[_0xea49('0xd')](),controller[_0xea49('0xe')]);router['post']('/',auth[_0xea49('0xd')](),controller['create']);router[_0xea49('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xea49('0x10')](_0xea49('0xc'),auth[_0xea49('0xd')](),controller[_0xea49('0x11')]);module[_0xea49('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 8ecc01d..f00fa9b 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 _0xb707=['sequelize','exports','ENUM','localnet','stun','turn','STRING'];(function(_0x2acc4d,_0x1b67fb){var _0x3288e1=function(_0xf2f1a2){while(--_0xf2f1a2){_0x2acc4d['push'](_0x2acc4d['shift']());}};_0x3288e1(++_0x1b67fb);}(_0xb707,0x9a));var _0x7b70=function(_0x480d44,_0x25caa9){_0x480d44=_0x480d44-0x0;var _0x3d6d4b=_0xb707[_0x480d44];return _0x3d6d4b;};'use strict';var Sequelize=require(_0x7b70('0x0'));module[_0x7b70('0x1')]={'type':{'type':Sequelize[_0x7b70('0x2')](_0x7b70('0x3'),'externip',_0x7b70('0x4'),_0x7b70('0x5'))},'value':{'type':Sequelize[_0x7b70('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7b70('0x6')]}}; \ No newline at end of file +var _0x07dd=['localnet','externip','stun','turn','STRING','sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x07dd,0x178));var _0xd07d=function(_0x319480,_0x17c055){_0x319480=_0x319480-0x0;var _0x51d66a=_0x07dd[_0x319480];return _0x51d66a;};'use strict';var Sequelize=require(_0xd07d('0x0'));module[_0xd07d('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd07d('0x2'),_0xd07d('0x3'),_0xd07d('0x4'),_0xd07d('0x5'))},'value':{'type':Sequelize[_0xd07d('0x6')]},'username':{'type':Sequelize[_0xd07d('0x6')]},'password':{'type':Sequelize[_0xd07d('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 1428019..f229292 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 _0xd269=['limit','count','set','update','destroy','then','status','end','sendStatus','name','index','map','Network','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','filter','where','merge','includeAll','include','findAll','rows','show','params','length','options','find','create','body','toUpperCase','STUN','join','root','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','utf8','format','chan_sip.so','res_stun_monitor.so','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','util','path','ejs','../../components/parsers/qs','../../config/logger','api','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','json','offset','undefined'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xd269,0x1d0));var _0x9d26=function(_0x4b0d64,_0x52e77b){_0x4b0d64=_0x4b0d64-0x0;var _0x30e7fc=_0xd269[_0x4b0d64];return _0x30e7fc;};'use strict';var util=require(_0x9d26('0x0'));var path=require(_0x9d26('0x1'));var ejs=require(_0x9d26('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0x9d26('0x3'));var logger=require(_0x9d26('0x4'))(_0x9d26('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x9d26('0x6'));var client=jayson[_0x9d26('0x7')][_0x9d26('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9c10e5,_0x58d86b,_0x3bbfa1,_0x24e5be){return new Promise(function(_0x4c7765,_0x27a859){var _0x45b6d9=_0x24e5be||client;return _0x45b6d9[_0x9d26('0x9')](_0x9c10e5,_0x3bbfa1)['then'](function(_0x1ddb9f){logger[_0x9d26('0xa')](_0x9d26('0xb'),_0x58d86b,'request\x20sent');logger[_0x9d26('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x58d86b,_0x9d26('0xd'),JSON[_0x9d26('0xe')](_0x1ddb9f));if(_0x1ddb9f[_0x9d26('0xf')]){if(_0x1ddb9f[_0x9d26('0xf')]['code']===0x1f4){logger[_0x9d26('0xf')](_0x9d26('0xb'),_0x58d86b,_0x1ddb9f[_0x9d26('0xf')][_0x9d26('0x10')]);return _0x27a859(_0x1ddb9f['error']['message']);}logger['error'](_0x9d26('0xb'),_0x58d86b,_0x1ddb9f[_0x9d26('0xf')][_0x9d26('0x10')]);return _0x4c7765(_0x1ddb9f[_0x9d26('0xf')][_0x9d26('0x10')]);}else{logger['info'](_0x9d26('0xb'),_0x58d86b,_0x9d26('0xd'));_0x4c7765(_0x1ddb9f[_0x9d26('0x11')][_0x9d26('0x10')]);}})[_0x9d26('0x12')](function(_0x558c13){logger[_0x9d26('0xf')](_0x9d26('0xb'),_0x58d86b,_0x558c13);_0x27a859(_0x558c13);});});}function respondWithResult(_0x13513e,_0x374823){_0x374823=_0x374823||0xc8;return function(_0x500f32){if(_0x500f32){return _0x13513e['status'](_0x374823)[_0x9d26('0x13')](_0x500f32);}};}function respondWithFilteredResult(_0x9e3b71,_0x3c4cbf){return function(_0xc06fe1){if(_0xc06fe1){var _0x555162=typeof _0x3c4cbf[_0x9d26('0x14')]===_0x9d26('0x15')&&typeof _0x3c4cbf[_0x9d26('0x16')]===_0x9d26('0x15');var _0x1a8093=_0xc06fe1[_0x9d26('0x17')];var _0x5c3785=_0x555162?0x0:_0x3c4cbf[_0x9d26('0x14')];var _0xf6fa8d=_0x555162?_0xc06fe1[_0x9d26('0x17')]:_0x3c4cbf['offset']+_0x3c4cbf['limit'];var _0x4fd573;if(_0xf6fa8d>=_0x1a8093){_0xf6fa8d=_0x1a8093;_0x4fd573=0xc8;}else{_0x4fd573=0xce;}_0x9e3b71['status'](_0x4fd573);return _0x9e3b71[_0x9d26('0x18')]('Content-Range',_0x5c3785+'-'+_0xf6fa8d+'/'+_0x1a8093)[_0x9d26('0x13')](_0xc06fe1);}return null;};}function saveUpdates(_0x1c4906){return function(_0x7ed582){if(_0x7ed582){return _0x7ed582[_0x9d26('0x19')](_0x1c4906)['then'](function(_0x1c097d){return _0x1c097d;});}return null;};}function removeEntity(_0x1b66e8){return function(_0x2d8409){if(_0x2d8409){return _0x2d8409[_0x9d26('0x1a')]()[_0x9d26('0x1b')](function(){_0x1b66e8[_0x9d26('0x1c')](0xcc)[_0x9d26('0x1d')]();});}};}function handleEntityNotFound(_0x1e69cf){return function(_0x44b55f){if(!_0x44b55f){_0x1e69cf[_0x9d26('0x1e')](0x194);}return _0x44b55f;};}function handleError(_0x33f448,_0x11a6d0){_0x11a6d0=_0x11a6d0||0x1f4;return function(_0x1e2089){logger['error'](_0x1e2089['stack']);if(_0x1e2089[_0x9d26('0x1f')]){delete _0x1e2089[_0x9d26('0x1f')];}_0x33f448['status'](_0x11a6d0)['send'](_0x1e2089);};}exports[_0x9d26('0x20')]=function(_0x5f3256,_0x7246bc){var _0xcf1c2f={},_0x19405c={},_0x199393={'count':0x0,'rows':[]};var _0x4d799a=_[_0x9d26('0x21')](db[_0x9d26('0x22')][_0x9d26('0x23')],function(_0x117765){return{'name':_0x117765[_0x9d26('0x24')],'type':_0x117765[_0x9d26('0x25')]['key']};});_0x19405c[_0x9d26('0x26')]=_['map'](_0x4d799a,_0x9d26('0x1f'));_0x19405c[_0x9d26('0x27')]=_[_0x9d26('0x28')](_0x5f3256[_0x9d26('0x27')]);_0x19405c[_0x9d26('0x29')]=_[_0x9d26('0x2a')](_0x19405c['model'],_0x19405c['query']);_0xcf1c2f['attributes']=_[_0x9d26('0x2a')](_0x19405c[_0x9d26('0x26')],qs[_0x9d26('0x2b')](_0x5f3256[_0x9d26('0x27')][_0x9d26('0x2b')]));_0xcf1c2f[_0x9d26('0x2c')]=_0xcf1c2f['attributes']['length']?_0xcf1c2f['attributes']:_0x19405c[_0x9d26('0x26')];if(!_0x5f3256[_0x9d26('0x27')][_0x9d26('0x2d')]('nolimit')){_0xcf1c2f['limit']=qs[_0x9d26('0x16')](_0x5f3256[_0x9d26('0x27')][_0x9d26('0x16')]);_0xcf1c2f['offset']=qs['offset'](_0x5f3256[_0x9d26('0x27')][_0x9d26('0x14')]);}_0xcf1c2f[_0x9d26('0x2e')]=qs['sort'](_0x5f3256[_0x9d26('0x27')][_0x9d26('0x2f')]);_0xcf1c2f['where']=qs[_0x9d26('0x29')](_['pick'](_0x5f3256[_0x9d26('0x27')],_0x19405c[_0x9d26('0x29')]),_0x4d799a);if(_0x5f3256['query'][_0x9d26('0x30')]){_0xcf1c2f[_0x9d26('0x31')]=_[_0x9d26('0x32')](_0xcf1c2f[_0x9d26('0x31')],{'$or':_[_0x9d26('0x21')](_0x4d799a,function(_0x42c0c6){if(_0x42c0c6[_0x9d26('0x25')]!=='VIRTUAL'){var _0x11760f={};_0x11760f[_0x42c0c6['name']]={'$like':'%'+_0x5f3256['query'][_0x9d26('0x30')]+'%'};return _0x11760f;}})});}_0xcf1c2f=_['merge']({},_0xcf1c2f,_0x5f3256['options']);var _0x561ba2={'where':_0xcf1c2f[_0x9d26('0x31')]};return db[_0x9d26('0x22')][_0x9d26('0x17')](_0x561ba2)[_0x9d26('0x1b')](function(_0x5330b2){_0x199393[_0x9d26('0x17')]=_0x5330b2;if(_0x5f3256[_0x9d26('0x27')][_0x9d26('0x33')]){_0xcf1c2f[_0x9d26('0x34')]=[{'all':!![]}];}return db['Network'][_0x9d26('0x35')](_0xcf1c2f);})['then'](function(_0x2507d1){_0x199393[_0x9d26('0x36')]=_0x2507d1;return _0x199393;})['then'](respondWithFilteredResult(_0x7246bc,_0xcf1c2f))['catch'](handleError(_0x7246bc,null));};exports[_0x9d26('0x37')]=function(_0x140069,_0x1c0325){var _0x124af3={'raw':!![],'where':{'id':_0x140069[_0x9d26('0x38')]['id']}},_0x922cfb={};_0x922cfb[_0x9d26('0x26')]=_[_0x9d26('0x28')](db[_0x9d26('0x22')][_0x9d26('0x23')]);_0x922cfb[_0x9d26('0x27')]=_[_0x9d26('0x28')](_0x140069[_0x9d26('0x27')]);_0x922cfb[_0x9d26('0x29')]=_[_0x9d26('0x2a')](_0x922cfb[_0x9d26('0x26')],_0x922cfb[_0x9d26('0x27')]);_0x124af3[_0x9d26('0x2c')]=_[_0x9d26('0x2a')](_0x922cfb[_0x9d26('0x26')],qs[_0x9d26('0x2b')](_0x140069[_0x9d26('0x27')][_0x9d26('0x2b')]));_0x124af3['attributes']=_0x124af3[_0x9d26('0x2c')][_0x9d26('0x39')]?_0x124af3['attributes']:_0x922cfb[_0x9d26('0x26')];if(_0x140069['query'][_0x9d26('0x33')]){_0x124af3[_0x9d26('0x34')]=[{'all':!![]}];}_0x124af3=_[_0x9d26('0x32')]({},_0x124af3,_0x140069[_0x9d26('0x3a')]);return db[_0x9d26('0x22')][_0x9d26('0x3b')](_0x124af3)['then'](handleEntityNotFound(_0x1c0325,null))[_0x9d26('0x1b')](respondWithResult(_0x1c0325,null))['catch'](handleError(_0x1c0325,null));};exports[_0x9d26('0x3c')]=function(_0x51bbde,_0x235953){var _0x4cfc03;return db[_0x9d26('0x22')][_0x9d26('0x3c')](_0x51bbde['body'],{'raw':!![]})[_0x9d26('0x1b')](function(_0xd043e){_0x4cfc03=_0xd043e;return db[_0x9d26('0x22')][_0x9d26('0x35')]({'where':{'type':_0x51bbde[_0x9d26('0x3d')][_0x9d26('0x25')]},'raw':!![]});})[_0x9d26('0x1b')](function(_0x53abcf){if(_0x4cfc03['type'][_0x9d26('0x3e')]()==_0x9d26('0x3f')){var _0x998706=fs['readFileSync'](path[_0x9d26('0x40')](config[_0x9d26('0x41')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x5ae6f4=ejs[_0x9d26('0x42')](_0x998706,{'networks':_0x53abcf||[]});fs[_0x9d26('0x43')](_0x9d26('0x44'),_0x5ae6f4);return respondWithRpcPromise(_0x9d26('0x45'),_0x9d26('0x3c'),{'module':'res_stun_monitor.so'});}else if(_0x4cfc03['type'][_0x9d26('0x3e')]()==_0x9d26('0x46')){var _0x2b742b=fs[_0x9d26('0x47')](path['join'](config['root'],_0x9d26('0x48')),'utf8');var _0x25a5e5=ejs[_0x9d26('0x42')](_0x2b742b,{'networks':_0x53abcf||[]});fs['writeFileSync'](_0x9d26('0x49'),_0x25a5e5);return respondWithRpcPromise(_0x9d26('0x45'),'create',{'module':'res_stun_monitor.so'});}else{var _0x4d8049=fs[_0x9d26('0x47')](path[_0x9d26('0x40')](config['root'],_0x9d26('0x4a')),_0x9d26('0x4b'));var _0x134671=ejs[_0x9d26('0x42')](_0x4d8049,{'networks':_0x53abcf||[]});fs[_0x9d26('0x43')](util[_0x9d26('0x4c')]('/etc/asterisk/sip_xcally_%s.conf',_0x51bbde[_0x9d26('0x3d')]['type']['toLowerCase']()),_0x134671);return respondWithRpcPromise(_0x9d26('0x45'),'create',{'module':_0x9d26('0x4d')});}})[_0x9d26('0x1b')](function(){return _0x4cfc03;})[_0x9d26('0x1b')](respondWithResult(_0x235953,0xc9))[_0x9d26('0x12')](handleError(_0x235953,null));};exports['update']=function(_0x4e1295,_0x1fb62c){var _0x3b34b2;return db[_0x9d26('0x22')][_0x9d26('0x3b')]({'where':{'id':_0x4e1295['params']['id']}})[_0x9d26('0x1b')](handleEntityNotFound(_0x1fb62c,null))[_0x9d26('0x1b')](saveUpdates(_0x4e1295['body'],null))[_0x9d26('0x1b')](function(_0x4d9f17){if(_0x4d9f17){_0x3b34b2=_0x4d9f17;return db[_0x9d26('0x22')][_0x9d26('0x35')]({'where':{'type':_0x3b34b2[_0x9d26('0x25')]},'raw':!![]});}return null;})[_0x9d26('0x1b')](function(_0x3c99c7){if(_0x3b34b2[_0x9d26('0x25')][_0x9d26('0x3e')]()==_0x9d26('0x3f')){var _0x3b737f=fs[_0x9d26('0x47')](path[_0x9d26('0x40')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x9d26('0x4b'));var _0x58d77d=ejs['render'](_0x3b737f,{'networks':_0x3c99c7||[]});fs[_0x9d26('0x43')](_0x9d26('0x44'),_0x58d77d);return respondWithRpcPromise(_0x9d26('0x45'),'update',{'module':_0x9d26('0x4e')});}else if(_0x3b34b2['type'][_0x9d26('0x3e')]()=='TURN'){var _0x6260ad=fs['readFileSync'](path[_0x9d26('0x40')](config[_0x9d26('0x41')],_0x9d26('0x48')),_0x9d26('0x4b'));var _0x4e1ab3=ejs['render'](_0x6260ad,{'networks':_0x3c99c7||[]});fs['writeFileSync'](_0x9d26('0x49'),_0x4e1ab3);return respondWithRpcPromise(_0x9d26('0x45'),'update',{'module':'res_stun_monitor.so'});}else{var _0x52b6c3=fs['readFileSync'](path[_0x9d26('0x40')](config[_0x9d26('0x41')],_0x9d26('0x4a')),'utf8');var _0xa86377=ejs['render'](_0x52b6c3,{'networks':_0x3c99c7||[]});fs[_0x9d26('0x43')](util[_0x9d26('0x4c')](_0x9d26('0x4f'),_0x4e1295[_0x9d26('0x3d')][_0x9d26('0x25')][_0x9d26('0x50')]()),_0xa86377);return respondWithRpcPromise(_0x9d26('0x45'),'update',{'module':_0x9d26('0x4d')});}})[_0x9d26('0x1b')](function(_0x465513){if(_0x465513){return _0x3b34b2;}return null;})[_0x9d26('0x1b')](respondWithResult(_0x1fb62c,null))['catch'](handleError(_0x1fb62c,null));};exports[_0x9d26('0x1a')]=function(_0x170ef4,_0x4f1636){var _0x40ae2a;return db['Network'][_0x9d26('0x3b')]({'where':{'id':_0x170ef4[_0x9d26('0x38')]['id']}})['then'](function(_0x1b034f){_0x40ae2a=_0x1b034f;return _0x1b034f;})[_0x9d26('0x1b')](handleEntityNotFound(_0x4f1636,null))[_0x9d26('0x1b')](removeEntity(_0x4f1636,null))[_0x9d26('0x1b')](function(){if(_0x40ae2a){return db['Network'][_0x9d26('0x35')]({'where':{'type':_0x40ae2a['type']},'raw':!![]});}})[_0x9d26('0x1b')](function(_0x4253e2){if(_0x40ae2a[_0x9d26('0x25')]['toUpperCase']()==_0x9d26('0x3f')){var _0x40262e=fs[_0x9d26('0x47')](path['join'](config[_0x9d26('0x41')],'server/files/templates/stun_multiple.ejs'),_0x9d26('0x4b'));var _0x222e50=ejs['render'](_0x40262e,{'networks':_0x4253e2||[]});fs['writeFileSync'](_0x9d26('0x44'),_0x222e50);return respondWithRpcPromise('Reload',_0x9d26('0x1a'),{'module':_0x9d26('0x4e')});}else if(_0x40ae2a[_0x9d26('0x25')][_0x9d26('0x3e')]()==_0x9d26('0x46')){var _0x14a9e7=fs[_0x9d26('0x47')](path[_0x9d26('0x40')](config['root'],_0x9d26('0x48')),_0x9d26('0x4b'));var _0xa6484c=ejs[_0x9d26('0x42')](_0x14a9e7,{'networks':_0x4253e2||[]});fs[_0x9d26('0x43')]('/etc/asterisk/turn_xcally.conf',_0xa6484c);return respondWithRpcPromise('Reload','destroy',{'module':_0x9d26('0x4e')});}else{var _0x579073=fs[_0x9d26('0x47')](path[_0x9d26('0x40')](config[_0x9d26('0x41')],_0x9d26('0x4a')),'utf8');var _0x2f04a1=ejs[_0x9d26('0x42')](_0x579073,{'networks':_0x4253e2||[]});fs[_0x9d26('0x43')](util['format'](_0x9d26('0x4f'),_0x40ae2a[_0x9d26('0x25')][_0x9d26('0x50')]()),_0x2f04a1);return respondWithRpcPromise('Reload',_0x9d26('0x1a'),{'module':_0x9d26('0x4d')});}})[_0x9d26('0x12')](handleError(_0x4f1636,null));}; \ No newline at end of file +var _0x06f9=['result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','Network','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','create','body','toUpperCase','STUN','readFileSync','join','root','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','server/files/templates/stun_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','util','path','ejs','lodash','../../components/parsers/qs','api','jayson/promise','http','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x06f9,0xeb));var _0x906f=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x06f9[_0x1caf6a];return _0x1bf493;};'use strict';var util=require(_0x906f('0x0'));var path=require(_0x906f('0x1'));var ejs=require(_0x906f('0x2'));var fs=require('fs');var _=require(_0x906f('0x3'));var qs=require(_0x906f('0x4'));var logger=require('../../config/logger')(_0x906f('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x906f('0x6'));var client=jayson['client'][_0x906f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f4754,_0x1579ea,_0xdb6fc4,_0x4b5b7a){return new Promise(function(_0x20c138,_0x362200){var _0x5dc963=_0x4b5b7a||client;return _0x5dc963['request'](_0x4f4754,_0xdb6fc4)['then'](function(_0x10ba48){logger[_0x906f('0x8')](_0x906f('0x9'),_0x1579ea,_0x906f('0xa'));logger[_0x906f('0xb')](_0x906f('0xc'),_0x1579ea,_0x906f('0xa'),JSON[_0x906f('0xd')](_0x10ba48));if(_0x10ba48[_0x906f('0xe')]){if(_0x10ba48[_0x906f('0xe')][_0x906f('0xf')]===0x1f4){logger[_0x906f('0xe')](_0x906f('0x9'),_0x1579ea,_0x10ba48['error'][_0x906f('0x10')]);return _0x362200(_0x10ba48[_0x906f('0xe')]['message']);}logger[_0x906f('0xe')]('Network,\x20%s,\x20%s',_0x1579ea,_0x10ba48[_0x906f('0xe')][_0x906f('0x10')]);return _0x20c138(_0x10ba48[_0x906f('0xe')][_0x906f('0x10')]);}else{logger['info'](_0x906f('0x9'),_0x1579ea,_0x906f('0xa'));_0x20c138(_0x10ba48[_0x906f('0x11')]['message']);}})[_0x906f('0x12')](function(_0x3d97d9){logger[_0x906f('0xe')](_0x906f('0x9'),_0x1579ea,_0x3d97d9);_0x362200(_0x3d97d9);});});}function respondWithResult(_0x5ba5de,_0x1b6574){_0x1b6574=_0x1b6574||0xc8;return function(_0x37626e){if(_0x37626e){return _0x5ba5de['status'](_0x1b6574)[_0x906f('0x13')](_0x37626e);}};}function respondWithFilteredResult(_0x48f496,_0xdbe8e4){return function(_0x4d4bb2){if(_0x4d4bb2){var _0x459d15=typeof _0xdbe8e4[_0x906f('0x14')]===_0x906f('0x15')&&typeof _0xdbe8e4[_0x906f('0x16')]===_0x906f('0x15');var _0x359451=_0x4d4bb2[_0x906f('0x17')];var _0x108445=_0x459d15?0x0:_0xdbe8e4[_0x906f('0x14')];var _0x2f16ec=_0x459d15?_0x4d4bb2[_0x906f('0x17')]:_0xdbe8e4['offset']+_0xdbe8e4[_0x906f('0x16')];var _0x145133;if(_0x2f16ec>=_0x359451){_0x2f16ec=_0x359451;_0x145133=0xc8;}else{_0x145133=0xce;}_0x48f496[_0x906f('0x18')](_0x145133);return _0x48f496[_0x906f('0x19')](_0x906f('0x1a'),_0x108445+'-'+_0x2f16ec+'/'+_0x359451)['json'](_0x4d4bb2);}return null;};}function saveUpdates(_0x4e4d47){return function(_0x1902cd){if(_0x1902cd){return _0x1902cd[_0x906f('0x1b')](_0x4e4d47)['then'](function(_0x40ca97){return _0x40ca97;});}return null;};}function removeEntity(_0x160427){return function(_0x3dc458){if(_0x3dc458){return _0x3dc458[_0x906f('0x1c')]()[_0x906f('0x1d')](function(){_0x160427[_0x906f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x154ef6){return function(_0x29c3eb){if(!_0x29c3eb){_0x154ef6[_0x906f('0x1e')](0x194);}return _0x29c3eb;};}function handleError(_0x9b580a,_0x5862ff){_0x5862ff=_0x5862ff||0x1f4;return function(_0x4ce871){logger[_0x906f('0xe')](_0x4ce871[_0x906f('0x1f')]);if(_0x4ce871[_0x906f('0x20')]){delete _0x4ce871['name'];}_0x9b580a['status'](_0x5862ff)[_0x906f('0x21')](_0x4ce871);};}exports[_0x906f('0x22')]=function(_0x4df8e1,_0x46ac65){var _0x2901ab={},_0x238ce2={},_0x44f3e6={'count':0x0,'rows':[]};var _0x4265aa=_[_0x906f('0x23')](db[_0x906f('0x24')][_0x906f('0x25')],function(_0x1a9632){return{'name':_0x1a9632['fieldName'],'type':_0x1a9632[_0x906f('0x26')][_0x906f('0x27')]};});_0x238ce2[_0x906f('0x28')]=_[_0x906f('0x23')](_0x4265aa,_0x906f('0x20'));_0x238ce2[_0x906f('0x29')]=_[_0x906f('0x2a')](_0x4df8e1[_0x906f('0x29')]);_0x238ce2[_0x906f('0x2b')]=_[_0x906f('0x2c')](_0x238ce2[_0x906f('0x28')],_0x238ce2['query']);_0x2901ab[_0x906f('0x2d')]=_[_0x906f('0x2c')](_0x238ce2[_0x906f('0x28')],qs[_0x906f('0x2e')](_0x4df8e1[_0x906f('0x29')][_0x906f('0x2e')]));_0x2901ab['attributes']=_0x2901ab[_0x906f('0x2d')][_0x906f('0x2f')]?_0x2901ab[_0x906f('0x2d')]:_0x238ce2[_0x906f('0x28')];if(!_0x4df8e1[_0x906f('0x29')][_0x906f('0x30')](_0x906f('0x31'))){_0x2901ab[_0x906f('0x16')]=qs[_0x906f('0x16')](_0x4df8e1[_0x906f('0x29')][_0x906f('0x16')]);_0x2901ab['offset']=qs[_0x906f('0x14')](_0x4df8e1[_0x906f('0x29')][_0x906f('0x14')]);}_0x2901ab['order']=qs['sort'](_0x4df8e1[_0x906f('0x29')]['sort']);_0x2901ab[_0x906f('0x32')]=qs[_0x906f('0x2b')](_[_0x906f('0x33')](_0x4df8e1['query'],_0x238ce2[_0x906f('0x2b')]),_0x4265aa);if(_0x4df8e1[_0x906f('0x29')]['filter']){_0x2901ab[_0x906f('0x32')]=_[_0x906f('0x34')](_0x2901ab[_0x906f('0x32')],{'$or':_['map'](_0x4265aa,function(_0x209a8b){if(_0x209a8b[_0x906f('0x26')]!=='VIRTUAL'){var _0x378fea={};_0x378fea[_0x209a8b[_0x906f('0x20')]]={'$like':'%'+_0x4df8e1['query'][_0x906f('0x35')]+'%'};return _0x378fea;}})});}_0x2901ab=_[_0x906f('0x34')]({},_0x2901ab,_0x4df8e1[_0x906f('0x36')]);var _0x527cb9={'where':_0x2901ab[_0x906f('0x32')]};return db[_0x906f('0x24')]['count'](_0x527cb9)[_0x906f('0x1d')](function(_0x2fa443){_0x44f3e6[_0x906f('0x17')]=_0x2fa443;if(_0x4df8e1[_0x906f('0x29')][_0x906f('0x37')]){_0x2901ab[_0x906f('0x38')]=[{'all':!![]}];}return db[_0x906f('0x24')][_0x906f('0x39')](_0x2901ab);})[_0x906f('0x1d')](function(_0x29ef38){_0x44f3e6[_0x906f('0x3a')]=_0x29ef38;return _0x44f3e6;})[_0x906f('0x1d')](respondWithFilteredResult(_0x46ac65,_0x2901ab))['catch'](handleError(_0x46ac65,null));};exports[_0x906f('0x3b')]=function(_0x4e03bc,_0x28f8e3){var _0x493907={'raw':!![],'where':{'id':_0x4e03bc[_0x906f('0x3c')]['id']}},_0x2aa718={};_0x2aa718[_0x906f('0x28')]=_[_0x906f('0x2a')](db[_0x906f('0x24')][_0x906f('0x25')]);_0x2aa718[_0x906f('0x29')]=_[_0x906f('0x2a')](_0x4e03bc[_0x906f('0x29')]);_0x2aa718[_0x906f('0x2b')]=_[_0x906f('0x2c')](_0x2aa718[_0x906f('0x28')],_0x2aa718[_0x906f('0x29')]);_0x493907[_0x906f('0x2d')]=_[_0x906f('0x2c')](_0x2aa718[_0x906f('0x28')],qs['fields'](_0x4e03bc[_0x906f('0x29')][_0x906f('0x2e')]));_0x493907[_0x906f('0x2d')]=_0x493907[_0x906f('0x2d')]['length']?_0x493907[_0x906f('0x2d')]:_0x2aa718[_0x906f('0x28')];if(_0x4e03bc['query'][_0x906f('0x37')]){_0x493907[_0x906f('0x38')]=[{'all':!![]}];}_0x493907=_[_0x906f('0x34')]({},_0x493907,_0x4e03bc[_0x906f('0x36')]);return db['Network']['find'](_0x493907)[_0x906f('0x1d')](handleEntityNotFound(_0x28f8e3,null))[_0x906f('0x1d')](respondWithResult(_0x28f8e3,null))[_0x906f('0x12')](handleError(_0x28f8e3,null));};exports[_0x906f('0x3d')]=function(_0x3d8faf,_0x5b0852){var _0x52e5f6;return db[_0x906f('0x24')][_0x906f('0x3d')](_0x3d8faf[_0x906f('0x3e')],{'raw':!![]})[_0x906f('0x1d')](function(_0x23c265){_0x52e5f6=_0x23c265;return db[_0x906f('0x24')]['findAll']({'where':{'type':_0x3d8faf[_0x906f('0x3e')][_0x906f('0x26')]},'raw':!![]});})[_0x906f('0x1d')](function(_0x5184c1){if(_0x52e5f6[_0x906f('0x26')][_0x906f('0x3f')]()==_0x906f('0x40')){var _0x4292bc=fs[_0x906f('0x41')](path[_0x906f('0x42')](config[_0x906f('0x43')],'server/files/templates/stun_multiple.ejs'),_0x906f('0x44'));var _0x1ff166=ejs['render'](_0x4292bc,{'networks':_0x5184c1||[]});fs[_0x906f('0x45')](_0x906f('0x46'),_0x1ff166);return respondWithRpcPromise(_0x906f('0x47'),_0x906f('0x3d'),{'module':_0x906f('0x48')});}else if(_0x52e5f6['type'][_0x906f('0x3f')]()==_0x906f('0x49')){var _0x3ad1c3=fs['readFileSync'](path[_0x906f('0x42')](config[_0x906f('0x43')],_0x906f('0x4a')),'utf8');var _0x1cb060=ejs[_0x906f('0x4b')](_0x3ad1c3,{'networks':_0x5184c1||[]});fs[_0x906f('0x45')](_0x906f('0x4c'),_0x1cb060);return respondWithRpcPromise(_0x906f('0x47'),_0x906f('0x3d'),{'module':_0x906f('0x48')});}else{var _0x223b54=fs[_0x906f('0x41')](path[_0x906f('0x42')](config[_0x906f('0x43')],_0x906f('0x4d')),'utf8');var _0x2d71dd=ejs[_0x906f('0x4b')](_0x223b54,{'networks':_0x5184c1||[]});fs[_0x906f('0x45')](util[_0x906f('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x3d8faf[_0x906f('0x3e')][_0x906f('0x26')]['toLowerCase']()),_0x2d71dd);return respondWithRpcPromise(_0x906f('0x47'),_0x906f('0x3d'),{'module':'chan_sip.so'});}})[_0x906f('0x1d')](function(){return _0x52e5f6;})['then'](respondWithResult(_0x5b0852,0xc9))['catch'](handleError(_0x5b0852,null));};exports[_0x906f('0x1b')]=function(_0x34d3dd,_0x757eb5){var _0x561edc;return db['Network']['find']({'where':{'id':_0x34d3dd['params']['id']}})[_0x906f('0x1d')](handleEntityNotFound(_0x757eb5,null))[_0x906f('0x1d')](saveUpdates(_0x34d3dd[_0x906f('0x3e')],null))[_0x906f('0x1d')](function(_0x1ea984){if(_0x1ea984){_0x561edc=_0x1ea984;return db[_0x906f('0x24')][_0x906f('0x39')]({'where':{'type':_0x561edc[_0x906f('0x26')]},'raw':!![]});}return null;})[_0x906f('0x1d')](function(_0x27168f){if(_0x561edc[_0x906f('0x26')][_0x906f('0x3f')]()=='STUN'){var _0x591a6c=fs[_0x906f('0x41')](path[_0x906f('0x42')](config[_0x906f('0x43')],_0x906f('0x4f')),_0x906f('0x44'));var _0x48d97b=ejs[_0x906f('0x4b')](_0x591a6c,{'networks':_0x27168f||[]});fs['writeFileSync'](_0x906f('0x46'),_0x48d97b);return respondWithRpcPromise(_0x906f('0x47'),_0x906f('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x561edc['type'][_0x906f('0x3f')]()==_0x906f('0x49')){var _0x264f17=fs[_0x906f('0x41')](path[_0x906f('0x42')](config[_0x906f('0x43')],_0x906f('0x4a')),_0x906f('0x44'));var _0x19a03a=ejs['render'](_0x264f17,{'networks':_0x27168f||[]});fs[_0x906f('0x45')]('/etc/asterisk/turn_xcally.conf',_0x19a03a);return respondWithRpcPromise(_0x906f('0x47'),_0x906f('0x1b'),{'module':_0x906f('0x48')});}else{var _0x2b734e=fs['readFileSync'](path['join'](config[_0x906f('0x43')],_0x906f('0x4d')),_0x906f('0x44'));var _0x446dad=ejs[_0x906f('0x4b')](_0x2b734e,{'networks':_0x27168f||[]});fs[_0x906f('0x45')](util['format'](_0x906f('0x50'),_0x34d3dd[_0x906f('0x3e')]['type'][_0x906f('0x51')]()),_0x446dad);return respondWithRpcPromise(_0x906f('0x47'),'update',{'module':_0x906f('0x52')});}})[_0x906f('0x1d')](function(_0x40cfd6){if(_0x40cfd6){return _0x561edc;}return null;})[_0x906f('0x1d')](respondWithResult(_0x757eb5,null))[_0x906f('0x12')](handleError(_0x757eb5,null));};exports['destroy']=function(_0x3d85c6,_0x168f7a){var _0x5d1d2c;return db[_0x906f('0x24')][_0x906f('0x53')]({'where':{'id':_0x3d85c6[_0x906f('0x3c')]['id']}})['then'](function(_0x10856b){_0x5d1d2c=_0x10856b;return _0x10856b;})[_0x906f('0x1d')](handleEntityNotFound(_0x168f7a,null))[_0x906f('0x1d')](removeEntity(_0x168f7a,null))[_0x906f('0x1d')](function(){if(_0x5d1d2c){return db['Network']['findAll']({'where':{'type':_0x5d1d2c[_0x906f('0x26')]},'raw':!![]});}})[_0x906f('0x1d')](function(_0x1faf21){if(_0x5d1d2c['type'][_0x906f('0x3f')]()==_0x906f('0x40')){var _0x1881c9=fs[_0x906f('0x41')](path[_0x906f('0x42')](config[_0x906f('0x43')],'server/files/templates/stun_multiple.ejs'),_0x906f('0x44'));var _0x1d85cb=ejs['render'](_0x1881c9,{'networks':_0x1faf21||[]});fs[_0x906f('0x45')](_0x906f('0x46'),_0x1d85cb);return respondWithRpcPromise(_0x906f('0x47'),'destroy',{'module':_0x906f('0x48')});}else if(_0x5d1d2c['type'][_0x906f('0x3f')]()==_0x906f('0x49')){var _0x5a23f4=fs[_0x906f('0x41')](path[_0x906f('0x42')](config['root'],_0x906f('0x4a')),_0x906f('0x44'));var _0x50f1a3=ejs['render'](_0x5a23f4,{'networks':_0x1faf21||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x50f1a3);return respondWithRpcPromise(_0x906f('0x47'),'destroy',{'module':_0x906f('0x48')});}else{var _0x27be7e=fs[_0x906f('0x41')](path[_0x906f('0x42')](config['root'],_0x906f('0x4d')),_0x906f('0x44'));var _0x575ad3=ejs[_0x906f('0x4b')](_0x27be7e,{'networks':_0x1faf21||[]});fs[_0x906f('0x45')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x5d1d2c[_0x906f('0x26')][_0x906f('0x51')]()),_0x575ad3);return respondWithRpcPromise('Reload',_0x906f('0x1c'),{'module':'chan_sip.so'});}})[_0x906f('0x12')](handleError(_0x168f7a,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index ad1dc40..a291a66 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 _0x2547=['rimraf','./network.attributes','exports','Network','network','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1f4f41,_0x4e0e7a){var _0x5e51c4=function(_0x5a8b27){while(--_0x5a8b27){_0x1f4f41['push'](_0x1f4f41['shift']());}};_0x5e51c4(++_0x4e0e7a);}(_0x2547,0x1cd));var _0x7254=function(_0x217621,_0x89ea30){_0x217621=_0x217621-0x0;var _0x5772b1=_0x2547[_0x217621];return _0x5772b1;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var logger=require(_0x7254('0x1'))(_0x7254('0x2'));var moment=require(_0x7254('0x3'));var BPromise=require(_0x7254('0x4'));var rp=require(_0x7254('0x5'));var fs=require('fs');var path=require(_0x7254('0x6'));var rimraf=require(_0x7254('0x7'));var config=require('../../config/environment');var attributes=require(_0x7254('0x8'));module[_0x7254('0x9')]=function(_0x67f427,_0x119f66){return _0x67f427['define'](_0x7254('0xa'),attributes,{'tableName':_0x7254('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4058=['api','moment','bluebird','request-promise','path','rimraf','define','Network','network','lodash','util','../../config/logger'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x4058,0x129));var _0x8405=function(_0x23f98f,_0xcf4c1c){_0x23f98f=_0x23f98f-0x0;var _0x3b4758=_0x4058[_0x23f98f];return _0x3b4758;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var logger=require(_0x8405('0x2'))(_0x8405('0x3'));var moment=require(_0x8405('0x4'));var BPromise=require(_0x8405('0x5'));var rp=require(_0x8405('0x6'));var fs=require('fs');var path=require(_0x8405('0x7'));var rimraf=require(_0x8405('0x8'));var config=require('../../config/environment');var attributes=require('./network.attributes');module['exports']=function(_0x1db7ea,_0x257d43){return _0x1db7ea[_0x8405('0x9')](_0x8405('0xa'),attributes,{'tableName':_0x8405('0xb'),'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 3a34865..8b94848 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3b9df1,_0xa9ac64){var _0x5d7db7=function(_0x5059ac){while(--_0x5059ac){_0x3b9df1['push'](_0x3b9df1['shift']());}};_0x5d7db7(++_0xa9ac64);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4f80ea,_0x5ba92b){var _0x304ef0=function(_0xbb24fa){while(--_0xbb24fa){_0x4f80ea['push'](_0x4f80ea['shift']());}};_0x304ef0(++_0x5ba92b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 74f9e6c..1f95d38 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 _0x91f4=['Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/users','/:id/send','send','/:id','update','destroy','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express'];(function(_0x52bbc9,_0xb342e0){var _0x5909d0=function(_0x24370d){while(--_0x24370d){_0x52bbc9['push'](_0x52bbc9['shift']());}};_0x5909d0(++_0xb342e0);}(_0x91f4,0x10d));var _0x491f=function(_0x136801,_0x2ac715){_0x136801=_0x136801-0x0;var _0x2e2fb5=_0x91f4[_0x136801];return _0x2e2fb5;};'use strict';var multer=require(_0x491f('0x0'));var util=require('util');var path=require(_0x491f('0x1'));var timeout=require(_0x491f('0x2'));var express=require(_0x491f('0x3'));var router=express[_0x491f('0x4')]();var fs_extra=require(_0x491f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x491f('0x6'));var config=require(_0x491f('0x7'));var controller=require(_0x491f('0x8'));router[_0x491f('0x9')]('/',auth[_0x491f('0xa')](),controller[_0x491f('0xb')]);router['get'](_0x491f('0xc'),auth['isAuthenticated'](),controller[_0x491f('0xd')]);router[_0x491f('0x9')]('/:id',auth[_0x491f('0xa')](),controller[_0x491f('0xe')]);router[_0x491f('0x9')](_0x491f('0xf'),auth[_0x491f('0xa')](),controller[_0x491f('0x10')]);router[_0x491f('0x9')](_0x491f('0x11'),auth[_0x491f('0xa')](),controller[_0x491f('0x12')]);router[_0x491f('0x9')](_0x491f('0x13'),auth[_0x491f('0xa')](),controller[_0x491f('0x14')]);router[_0x491f('0x9')](_0x491f('0x15'),auth[_0x491f('0xa')](),controller[_0x491f('0x16')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x491f('0x17')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x491f('0x18')](_0x491f('0xf'),auth[_0x491f('0xa')](),controller[_0x491f('0x19')]);router[_0x491f('0x18')](_0x491f('0x11'),auth[_0x491f('0xa')](),controller[_0x491f('0x1a')]);router[_0x491f('0x18')](_0x491f('0x1b'),controller[_0x491f('0x1c')]);router[_0x491f('0x18')](_0x491f('0x13'),auth[_0x491f('0xa')](),controller[_0x491f('0x1d')]);router['post'](_0x491f('0x1e'),auth['isAuthenticated'](),controller['addAgents']);router[_0x491f('0x18')](_0x491f('0x1f'),auth['isAuthenticated'](),controller[_0x491f('0x20')]);router['put'](_0x491f('0x21'),auth[_0x491f('0xa')](),controller[_0x491f('0x22')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x491f('0x23')]);router[_0x491f('0x24')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x491f('0x25')]);router['delete'](_0x491f('0x11'),auth[_0x491f('0xa')](),controller[_0x491f('0x26')]);router[_0x491f('0x24')](_0x491f('0x1e'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xd821=['/:id/send','send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','index','get','/describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0xd821,0x1ab));var _0x1d82=function(_0x292c49,_0xca2005){_0x292c49=_0x292c49-0x0;var _0x3c2078=_0xd821[_0x292c49];return _0x3c2078;};'use strict';var multer=require('multer');var util=require(_0x1d82('0x0'));var path=require(_0x1d82('0x1'));var timeout=require('connect-timeout');var express=require(_0x1d82('0x2'));var router=express[_0x1d82('0x3')]();var fs_extra=require(_0x1d82('0x4'));var auth=require(_0x1d82('0x5'));var interaction=require(_0x1d82('0x6'));var config=require('../../config/environment');var controller=require(_0x1d82('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1d82('0x8')]);router[_0x1d82('0x9')](_0x1d82('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1d82('0x9')](_0x1d82('0xb'),auth[_0x1d82('0xc')](),controller[_0x1d82('0xd')]);router[_0x1d82('0x9')](_0x1d82('0xe'),auth[_0x1d82('0xc')](),controller[_0x1d82('0xf')]);router[_0x1d82('0x9')](_0x1d82('0x10'),auth[_0x1d82('0xc')](),controller[_0x1d82('0x11')]);router['get'](_0x1d82('0x12'),auth['isAuthenticated'](),controller[_0x1d82('0x13')]);router['get']('/:id/interactions',auth[_0x1d82('0xc')](),controller[_0x1d82('0x14')]);router[_0x1d82('0x9')](_0x1d82('0x15'),auth[_0x1d82('0xc')](),controller['getAgents']);router[_0x1d82('0x16')]('/',auth[_0x1d82('0xc')](),controller[_0x1d82('0x17')]);router[_0x1d82('0x16')](_0x1d82('0xe'),auth[_0x1d82('0xc')](),controller[_0x1d82('0x18')]);router[_0x1d82('0x16')](_0x1d82('0x10'),auth[_0x1d82('0xc')](),controller[_0x1d82('0x19')]);router[_0x1d82('0x16')](_0x1d82('0x1a'),controller[_0x1d82('0x1b')]);router[_0x1d82('0x16')](_0x1d82('0x12'),auth[_0x1d82('0xc')](),controller[_0x1d82('0x1c')]);router[_0x1d82('0x16')](_0x1d82('0x15'),auth[_0x1d82('0xc')](),controller['addAgents']);router[_0x1d82('0x16')](_0x1d82('0x1d'),auth[_0x1d82('0xc')](),controller[_0x1d82('0x1e')]);router['put']('/:id',auth[_0x1d82('0xc')](),controller[_0x1d82('0x1f')]);router[_0x1d82('0x20')](_0x1d82('0xb'),auth[_0x1d82('0xc')](),controller[_0x1d82('0x21')]);router['delete'](_0x1d82('0xe'),auth['isAuthenticated'](),controller[_0x1d82('0x22')]);router['delete'](_0x1d82('0x10'),auth[_0x1d82('0xc')](),controller[_0x1d82('0x23')]);router[_0x1d82('0x20')](_0x1d82('0x15'),auth['isAuthenticated'](),controller[_0x1d82('0x24')]);module[_0x1d82('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 9d75ba2..5e25ade 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 _0xcf12=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x520ce8,_0x445e56){var _0x64369e=function(_0x3861e4){while(--_0x3861e4){_0x520ce8['push'](_0x520ce8['shift']());}};_0x64369e(++_0x445e56);}(_0xcf12,0x10d));var _0x2cf1=function(_0x538be0,_0x4926f3){_0x538be0=_0x538be0-0x0;var _0x18ca1e=_0xcf12[_0x538be0];return _0x18ca1e;};'use strict';var Sequelize=require(_0x2cf1('0x0'));var rs=require(_0x2cf1('0x1'));module['exports']={'name':{'type':Sequelize[_0x2cf1('0x2')],'unique':_0x2cf1('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2cf1('0x2')],'defaultValue':function(){return rs[_0x2cf1('0x4')]();}},'replyUri':{'type':Sequelize[_0x2cf1('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2cf1('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2cf1('0x5')],'defaultValue':function(){return _0x2cf1('0x6');}},'notificationSound':{'type':Sequelize[_0x2cf1('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2cf1('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2cf1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2cf1('0x2')]},'queueTransfer':{'type':Sequelize[_0x2cf1('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2cf1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2cf1('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2cf1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2cf1('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2cf1('0x9'),'set':function(_0x2d4152){if(!_0x2d4152)this['setDataValue'](_0x2cf1('0xa'),null);this['setDataValue'](_0x2cf1('0xb'),_0x2d4152);}}}; \ No newline at end of file +var _0x7e09=['exports','name','STRING','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x302ac5,_0x3a1bf1){var _0x4ab101=function(_0x1ae339){while(--_0x1ae339){_0x302ac5['push'](_0x302ac5['shift']());}};_0x4ab101(++_0x3a1bf1);}(_0x7e09,0x143));var _0x97e0=function(_0x17817d,_0x527bf8){_0x17817d=_0x17817d-0x0;var _0x219d9e=_0x7e09[_0x17817d];return _0x219d9e;};'use strict';var Sequelize=require(_0x97e0('0x0'));var rs=require(_0x97e0('0x1'));module[_0x97e0('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x97e0('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x97e0('0x4')]},'token':{'type':Sequelize[_0x97e0('0x4')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x97e0('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x97e0('0x5')],'defaultValue':function(){return _0x97e0('0x6');}},'notificationSound':{'type':Sequelize[_0x97e0('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x97e0('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x97e0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x97e0('0x4')]},'queueTransfer':{'type':Sequelize[_0x97e0('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x97e0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x97e0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x97e0('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x97e0('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x97e0('0x7')],'defaultValue':![],'comment':_0x97e0('0xa'),'set':function(_0x39032c){if(!_0x39032c)this['setDataValue'](_0x97e0('0xb'),null);this['setDataValue'](_0x97e0('0xc'),_0x39032c);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index a698a73..8aadf15 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 _0xdd0c=['info','request\x20sent','debug','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','get','OpenchannelAccounts','destroy','stack','name','index','Pause','OpenchannelAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','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','CmList','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','findAndCountAll','getApplications','nolimit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','emit','getAgents','send','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','request','then'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0xdd0c,0x165));var _0xcdd0=function(_0x4e1892,_0x562176){_0x4e1892=_0x4e1892-0x0;var _0x2a5af5=_0xdd0c[_0x4e1892];return _0x2a5af5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdd0('0x0'));var zipdir=require(_0xcdd0('0x1'));var jsonpatch=require(_0xcdd0('0x2'));var rp=require('request-promise');var moment=require(_0xcdd0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcdd0('0x4'));var util=require(_0xcdd0('0x5'));var path=require(_0xcdd0('0x6'));var sox=require(_0xcdd0('0x7'));var csv=require(_0xcdd0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdd0('0x9'));var _=require(_0xcdd0('0xa'));var squel=require(_0xcdd0('0xb'));var crypto=require(_0xcdd0('0xc'));var jsforce=require(_0xcdd0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcdd0('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcdd0('0xe'));var authService=require(_0xcdd0('0xf'));var qs=require(_0xcdd0('0x10'));var as=require(_0xcdd0('0x11'));var hardwareService=require(_0xcdd0('0x12'));var logger=require(_0xcdd0('0x13'))(_0xcdd0('0x14'));var utils=require(_0xcdd0('0x15'));var config=require(_0xcdd0('0x16'));var licenseUtil=require(_0xcdd0('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xcdd0('0x18')](config[_0xcdd0('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xcdd0('0x1a'))(new Redis(config[_0xcdd0('0x19')]));require('./openchannelAccount.socket')[_0xcdd0('0x1b')](socket);var jayson=require(_0xcdd0('0x1c'));var client=jayson[_0xcdd0('0x1d')][_0xcdd0('0x1e')]({'port':0x232c});var client9002=jayson[_0xcdd0('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5c06,_0x189f54,_0x1cd478,_0xf2ca58){return new BPromise(function(_0xf7af04,_0x2efe0a){var _0x3b07a1=_0xf2ca58||client;return _0x3b07a1[_0xcdd0('0x1f')](_0x5b5c06,_0x1cd478)[_0xcdd0('0x20')](function(_0x7bb156){logger[_0xcdd0('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x189f54,_0xcdd0('0x22'));logger[_0xcdd0('0x23')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x189f54,'request\x20sent',JSON[_0xcdd0('0x24')](_0x7bb156));if(_0x7bb156[_0xcdd0('0x25')]){if(_0x7bb156['error'][_0xcdd0('0x26')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x189f54,_0x7bb156['error'][_0xcdd0('0x27')]);return _0x2efe0a(_0x7bb156[_0xcdd0('0x25')]['message']);}logger[_0xcdd0('0x25')](_0xcdd0('0x28'),_0x189f54,_0x7bb156[_0xcdd0('0x25')]['message']);return _0xf7af04(_0x7bb156[_0xcdd0('0x25')][_0xcdd0('0x27')]);}else{logger['info'](_0xcdd0('0x28'),_0x189f54,_0xcdd0('0x22'));_0xf7af04(_0x7bb156['result'][_0xcdd0('0x27')]);}})['catch'](function(_0x3797c2){logger[_0xcdd0('0x25')](_0xcdd0('0x28'),_0x189f54,_0x3797c2);_0x2efe0a(_0x3797c2);});});}function respondWithStatusCode(_0x53a0a0,_0x22fd47){_0x22fd47=_0x22fd47||0xcc;return function(_0x10cba2){if(_0x10cba2){return _0x53a0a0[_0xcdd0('0x29')](_0x22fd47);}return _0x53a0a0[_0xcdd0('0x2a')](_0x22fd47)[_0xcdd0('0x2b')]();};}function respondWithResult(_0x15fb76,_0x99d3c1){_0x99d3c1=_0x99d3c1||0xc8;return function(_0x39ff27){if(_0x39ff27){return _0x15fb76[_0xcdd0('0x2a')](_0x99d3c1)[_0xcdd0('0x2c')](_0x39ff27);}};}function respondWithFilteredResult(_0x4074e0,_0x49cfe0){return function(_0x28084c){if(_0x28084c){var _0xd6d64f=typeof _0x49cfe0[_0xcdd0('0x2d')]==='undefined'&&typeof _0x49cfe0[_0xcdd0('0x2e')]===_0xcdd0('0x2f');var _0x1a51c6=_0x28084c[_0xcdd0('0x30')];var _0x2cb760=_0xd6d64f?0x0:_0x49cfe0['offset'];var _0x3b431f=_0xd6d64f?_0x28084c[_0xcdd0('0x30')]:_0x49cfe0[_0xcdd0('0x2d')]+_0x49cfe0['limit'];var _0x5eb0cb;if(_0x3b431f>=_0x1a51c6){_0x3b431f=_0x1a51c6;_0x5eb0cb=0xc8;}else{_0x5eb0cb=0xce;}_0x4074e0[_0xcdd0('0x2a')](_0x5eb0cb);return _0x4074e0[_0xcdd0('0x31')](_0xcdd0('0x32'),_0x2cb760+'-'+_0x3b431f+'/'+_0x1a51c6)['json'](_0x28084c);}return null;};}function patchUpdates(_0x328b38){return function(_0xc497){try{jsonpatch['apply'](_0xc497,_0x328b38,!![]);}catch(_0x42170f){return BPromise[_0xcdd0('0x33')](_0x42170f);}return _0xc497[_0xcdd0('0x34')]();};}function saveUpdates(_0x1aa3d8,_0x5dc8ec){return function(_0x300c2e){if(_0x300c2e){return _0x300c2e[_0xcdd0('0x35')](_0x1aa3d8)['then'](function(_0x356843){return _0x356843;});}return null;};}function removeEntity(_0x3ceeb8,_0x40f30c){return function(_0x2c83c1){if(_0x2c83c1){return _0x2c83c1['destroy']()[_0xcdd0('0x20')](function(){var _0x358139=_0x2c83c1[_0xcdd0('0x36')]({'plain':!![]});var _0x1a72b5=_0xcdd0('0x37');return db['UserProfileResource'][_0xcdd0('0x38')]({'where':{'type':_0x1a72b5,'resourceId':_0x358139['id']}})['then'](function(){return _0x2c83c1;});})['then'](function(){_0x3ceeb8['status'](0xcc)[_0xcdd0('0x2b')]();});}};}function handleEntityNotFound(_0x25ffba,_0x39a9a3){return function(_0x33fbec){if(!_0x33fbec){_0x25ffba[_0xcdd0('0x29')](0x194);}return _0x33fbec;};}function handleError(_0x439798,_0x3b801d){_0x3b801d=_0x3b801d||0x1f4;return function(_0x49ab04){logger[_0xcdd0('0x25')](_0x49ab04[_0xcdd0('0x39')]);if(_0x49ab04[_0xcdd0('0x3a')]){delete _0x49ab04[_0xcdd0('0x3a')];}_0x439798['status'](_0x3b801d)['send'](_0x49ab04);};}exports[_0xcdd0('0x3b')]=function(_0x181b30,_0x47a5f5){var _0x45d67c={'include':[{'model':db[_0xcdd0('0x3c')],'as':'mandatoryDispositionPause'}]},_0x1ebb28={},_0x5e7751={'count':0x0,'rows':[]};var _0x41ce22=_['map'](db[_0xcdd0('0x3d')][_0xcdd0('0x3e')],function(_0x10833a){return{'name':_0x10833a[_0xcdd0('0x3f')],'type':_0x10833a['type'][_0xcdd0('0x40')]};});_0x1ebb28[_0xcdd0('0x41')]=_['map'](_0x41ce22,_0xcdd0('0x3a'));_0x1ebb28[_0xcdd0('0x42')]=_[_0xcdd0('0x43')](_0x181b30[_0xcdd0('0x42')]);_0x1ebb28[_0xcdd0('0x44')]=_[_0xcdd0('0x45')](_0x1ebb28[_0xcdd0('0x41')],_0x1ebb28[_0xcdd0('0x42')]);_0x45d67c[_0xcdd0('0x46')]=_[_0xcdd0('0x45')](_0x1ebb28['model'],qs[_0xcdd0('0x47')](_0x181b30['query']['fields']));_0x45d67c[_0xcdd0('0x46')]=_0x45d67c['attributes'][_0xcdd0('0x48')]?_0x45d67c[_0xcdd0('0x46')]:_0x1ebb28[_0xcdd0('0x41')];if(!_0x181b30[_0xcdd0('0x42')][_0xcdd0('0x49')]('nolimit')){_0x45d67c[_0xcdd0('0x2e')]=qs['limit'](_0x181b30['query'][_0xcdd0('0x2e')]);_0x45d67c[_0xcdd0('0x2d')]=qs['offset'](_0x181b30['query']['offset']);}_0x45d67c[_0xcdd0('0x4a')]=qs[_0xcdd0('0x4b')](_0x181b30[_0xcdd0('0x42')]['sort']);_0x45d67c[_0xcdd0('0x4c')]=qs[_0xcdd0('0x44')](_[_0xcdd0('0x4d')](_0x181b30[_0xcdd0('0x42')],_0x1ebb28[_0xcdd0('0x44')]),_0x41ce22);if(_0x181b30['query'][_0xcdd0('0x4e')]){_0x45d67c['where']=_[_0xcdd0('0x4f')](_0x45d67c[_0xcdd0('0x4c')],{'$or':_[_0xcdd0('0x50')](_0x41ce22,function(_0x2f5a1a){if(_0x2f5a1a[_0xcdd0('0x51')]!==_0xcdd0('0x52')){var _0x25f842={};_0x25f842[_0x2f5a1a[_0xcdd0('0x3a')]]={'$like':'%'+_0x181b30[_0xcdd0('0x42')][_0xcdd0('0x4e')]+'%'};return _0x25f842;}})});}_0x45d67c=_[_0xcdd0('0x4f')]({},_0x45d67c,_0x181b30[_0xcdd0('0x53')]);var _0x3afae8={'where':_0x45d67c[_0xcdd0('0x4c')]};return db[_0xcdd0('0x3d')]['count'](_0x3afae8)[_0xcdd0('0x20')](function(_0x346a06){_0x5e7751[_0xcdd0('0x30')]=_0x346a06;if(_0x181b30[_0xcdd0('0x42')][_0xcdd0('0x54')]){_0x45d67c[_0xcdd0('0x55')]=[{'all':!![]}];}return db[_0xcdd0('0x3d')][_0xcdd0('0x56')](_0x45d67c);})[_0xcdd0('0x20')](function(_0x214cdd){_0x5e7751[_0xcdd0('0x57')]=_0x214cdd;return _0x5e7751;})[_0xcdd0('0x20')](respondWithFilteredResult(_0x47a5f5,_0x45d67c))[_0xcdd0('0x58')](handleError(_0x47a5f5,null));};exports[_0xcdd0('0x59')]=function(_0x4909da,_0x40f3c6){var _0x153be8={'raw':![],'where':{'id':_0x4909da[_0xcdd0('0x5a')]['id']},'include':[{'model':db[_0xcdd0('0x3c')],'as':_0xcdd0('0x5b')}]},_0x69ba70={};_0x69ba70[_0xcdd0('0x41')]=_['keys'](db[_0xcdd0('0x3d')][_0xcdd0('0x3e')]);_0x69ba70[_0xcdd0('0x42')]=_[_0xcdd0('0x43')](_0x4909da[_0xcdd0('0x42')]);_0x69ba70[_0xcdd0('0x44')]=_[_0xcdd0('0x45')](_0x69ba70[_0xcdd0('0x41')],_0x69ba70['query']);_0x153be8['attributes']=_['intersection'](_0x69ba70[_0xcdd0('0x41')],qs['fields'](_0x4909da[_0xcdd0('0x42')]['fields']));_0x153be8[_0xcdd0('0x46')]=_0x153be8[_0xcdd0('0x46')][_0xcdd0('0x48')]?_0x153be8[_0xcdd0('0x46')]:_0x69ba70['model'];if(_0x4909da[_0xcdd0('0x42')][_0xcdd0('0x54')]){_0x153be8['include']=[{'all':!![]}];}_0x153be8=_['merge']({},_0x153be8,_0x4909da[_0xcdd0('0x53')]);return db[_0xcdd0('0x3d')][_0xcdd0('0x5c')](_0x153be8)[_0xcdd0('0x20')](handleEntityNotFound(_0x40f3c6,null))['then'](respondWithResult(_0x40f3c6,null))['catch'](handleError(_0x40f3c6,null));};exports['create']=function(_0x28306b,_0x4e0248){return db['OpenchannelAccount'][_0xcdd0('0x5d')](_0x28306b[_0xcdd0('0x5e')],{})[_0xcdd0('0x20')](function(_0x3bb4f6){var _0x38ef1f=_0x28306b[_0xcdd0('0x5f')][_0xcdd0('0x36')]({'plain':!![]});if(!_0x38ef1f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38ef1f['role']===_0xcdd0('0x5f')){var _0x452e53=_0x3bb4f6[_0xcdd0('0x36')]({'plain':!![]});var _0x30a57e=_0xcdd0('0x37');return db[_0xcdd0('0x60')][_0xcdd0('0x5c')]({'where':{'name':_0x30a57e,'userProfileId':_0x38ef1f[_0xcdd0('0x61')]},'raw':!![]})[_0xcdd0('0x20')](function(_0x5c3773){if(_0x5c3773&&_0x5c3773[_0xcdd0('0x62')]===0x0){return db[_0xcdd0('0x63')][_0xcdd0('0x5d')]({'name':_0x452e53[_0xcdd0('0x3a')],'resourceId':_0x452e53['id'],'type':_0x5c3773[_0xcdd0('0x3a')],'sectionId':_0x5c3773['id']},{})['then'](function(){return _0x3bb4f6;});}else{return _0x3bb4f6;}})[_0xcdd0('0x58')](function(_0x5c5eb0){logger['error'](_0xcdd0('0x64'),_0x5c5eb0);throw _0x5c5eb0;});}return _0x3bb4f6;})[_0xcdd0('0x20')](respondWithResult(_0x4e0248,0xc9))[_0xcdd0('0x58')](handleError(_0x4e0248,null));};exports[_0xcdd0('0x35')]=function(_0x44c296,_0x4a97ff){if(_0x44c296[_0xcdd0('0x5e')]['id']){delete _0x44c296[_0xcdd0('0x5e')]['id'];}return db[_0xcdd0('0x3d')][_0xcdd0('0x5c')]({'where':{'id':_0x44c296[_0xcdd0('0x5a')]['id']},'include':[{'model':db[_0xcdd0('0x3c')],'as':'mandatoryDispositionPause'}]})[_0xcdd0('0x20')](handleEntityNotFound(_0x4a97ff,null))[_0xcdd0('0x20')](saveUpdates(_0x44c296['body'],null))[_0xcdd0('0x20')](respondWithResult(_0x4a97ff,null))[_0xcdd0('0x58')](handleError(_0x4a97ff,null));};exports[_0xcdd0('0x38')]=function(_0x56618d,_0x4b425a){return db[_0xcdd0('0x3d')]['find']({'where':{'id':_0x56618d[_0xcdd0('0x5a')]['id']}})[_0xcdd0('0x20')](handleEntityNotFound(_0x4b425a,null))[_0xcdd0('0x20')](removeEntity(_0x4b425a,null))[_0xcdd0('0x58')](handleError(_0x4b425a,null));};exports[_0xcdd0('0x65')]=function(_0x58ec2d,_0x413f5f){return db[_0xcdd0('0x3d')][_0xcdd0('0x65')]()[_0xcdd0('0x20')](respondWithResult(_0x413f5f,null))[_0xcdd0('0x58')](handleError(_0x413f5f,null));};exports[_0xcdd0('0x66')]=function(_0x16b687,_0xfb13f9,_0x293e9b){if(_0x16b687[_0xcdd0('0x5e')]['id']){delete _0x16b687[_0xcdd0('0x5e')]['id'];}return db[_0xcdd0('0x3d')]['find']({'where':{'id':_0x16b687[_0xcdd0('0x5a')]['id']}})['then'](handleEntityNotFound(_0xfb13f9,null))[_0xcdd0('0x20')](function(_0x5ced72){if(_0x5ced72){_0x16b687[_0xcdd0('0x5e')][_0xcdd0('0x67')]=_0x5ced72['id'];return db['Disposition'][_0xcdd0('0x5d')](_0x16b687[_0xcdd0('0x5e')]);}})[_0xcdd0('0x20')](respondWithResult(_0xfb13f9,null))[_0xcdd0('0x58')](handleError(_0xfb13f9,null));};exports['getDispositions']=function(_0x475b14,_0x21f7a4,_0x2123b4){var _0x369e7={'raw':![],'where':{}};var _0x2ddf7f={};var _0x57f99d={'count':0x0,'rows':[]};return db[_0xcdd0('0x3d')]['findOne']({'where':{'id':_0x475b14[_0xcdd0('0x5a')]['id']}})[_0xcdd0('0x20')](handleEntityNotFound(_0x21f7a4,null))[_0xcdd0('0x20')](function(_0x162d02){if(_0x162d02){_0x2ddf7f[_0xcdd0('0x41')]=_[_0xcdd0('0x43')](db['Disposition'][_0xcdd0('0x3e')]);_0x2ddf7f['query']=_[_0xcdd0('0x43')](_0x475b14['query']);_0x2ddf7f['filters']=_[_0xcdd0('0x45')](_0x2ddf7f['model'],_0x2ddf7f[_0xcdd0('0x42')]);_0x369e7['attributes']=_[_0xcdd0('0x45')](_0x2ddf7f[_0xcdd0('0x41')],qs[_0xcdd0('0x47')](_0x475b14['query'][_0xcdd0('0x47')]));_0x369e7[_0xcdd0('0x46')]=_0x369e7['attributes'][_0xcdd0('0x48')]?_0x369e7[_0xcdd0('0x46')]:_0x2ddf7f[_0xcdd0('0x41')];if(!_0x475b14[_0xcdd0('0x42')][_0xcdd0('0x49')]('nolimit')){_0x369e7[_0xcdd0('0x2e')]=qs[_0xcdd0('0x2e')](_0x475b14[_0xcdd0('0x42')][_0xcdd0('0x2e')]);_0x369e7[_0xcdd0('0x2d')]=qs['offset'](_0x475b14[_0xcdd0('0x42')][_0xcdd0('0x2d')]);}_0x369e7[_0xcdd0('0x4a')]=qs[_0xcdd0('0x4b')](_0x475b14['query'][_0xcdd0('0x4b')]);_0x369e7[_0xcdd0('0x4c')]=qs[_0xcdd0('0x44')](_['pick'](_0x475b14[_0xcdd0('0x42')],_0x2ddf7f[_0xcdd0('0x44')]));_0x369e7[_0xcdd0('0x4c')]['OpenchannelAccountId']=_0x162d02['id'];if(_0x475b14[_0xcdd0('0x42')][_0xcdd0('0x4e')]){_0x369e7[_0xcdd0('0x4c')]=_[_0xcdd0('0x4f')](_0x369e7[_0xcdd0('0x4c')],{'$or':_[_0xcdd0('0x50')](_0x369e7[_0xcdd0('0x46')],function(_0x4dd932){var _0x13b160={};_0x13b160[_0x4dd932]={'$like':'%'+_0x475b14[_0xcdd0('0x42')][_0xcdd0('0x4e')]+'%'};return _0x13b160;})});}_0x369e7=_[_0xcdd0('0x4f')]({},_0x369e7,_0x475b14[_0xcdd0('0x53')]);return db['Disposition']['count']({'where':_0x369e7[_0xcdd0('0x4c')]})['then'](function(_0x2ff93b){_0x57f99d[_0xcdd0('0x30')]=_0x2ff93b;if(_0x475b14[_0xcdd0('0x42')][_0xcdd0('0x54')]){_0x369e7[_0xcdd0('0x55')]=[{'all':!![]}];}return db['Disposition'][_0xcdd0('0x56')](_0x369e7);})[_0xcdd0('0x20')](function(_0x345548){_0x57f99d[_0xcdd0('0x57')]=_0x345548;return _0x57f99d;});}})[_0xcdd0('0x20')](respondWithFilteredResult(_0x21f7a4,_0x369e7))[_0xcdd0('0x58')](handleError(_0x21f7a4,null));};exports[_0xcdd0('0x68')]=function(_0xebde96,_0x21e7c0,_0x56c77d){return db[_0xcdd0('0x3d')][_0xcdd0('0x5c')]({'where':{'id':_0xebde96['params']['id']}})['then'](handleEntityNotFound(_0x21e7c0,null))['then'](function(_0x26c97f){if(_0x26c97f){return _0x26c97f[_0xcdd0('0x68')](_0xebde96[_0xcdd0('0x42')][_0xcdd0('0x69')]);}})[_0xcdd0('0x20')](respondWithStatusCode(_0x21e7c0,null))[_0xcdd0('0x58')](handleError(_0x21e7c0,null));};exports[_0xcdd0('0x6a')]=function(_0x4adf5a,_0x30076e,_0x5c150d){if(_0x4adf5a[_0xcdd0('0x5e')]['id']){delete _0x4adf5a['body']['id'];}return db['OpenchannelAccount'][_0xcdd0('0x5c')]({'where':{'id':_0x4adf5a[_0xcdd0('0x5a')]['id']}})[_0xcdd0('0x20')](handleEntityNotFound(_0x30076e,null))[_0xcdd0('0x20')](function(_0x5c5912){if(_0x5c5912){_0x4adf5a['body'][_0xcdd0('0x67')]=_0x5c5912['id'];return db[_0xcdd0('0x6b')][_0xcdd0('0x5d')](_0x4adf5a['body']);}})[_0xcdd0('0x20')](respondWithResult(_0x30076e,null))[_0xcdd0('0x58')](handleError(_0x30076e,null));};exports[_0xcdd0('0x6c')]=function(_0x4cb845,_0x521d21,_0x4b7b12){var _0x101e62={'raw':![],'where':{}};var _0x5f2d89={};var _0x1b7abd={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xcdd0('0x6d')]({'where':{'id':_0x4cb845['params']['id']}})[_0xcdd0('0x20')](handleEntityNotFound(_0x521d21,null))[_0xcdd0('0x20')](function(_0xf8eab2){if(_0xf8eab2){_0x5f2d89[_0xcdd0('0x41')]=_['keys'](db[_0xcdd0('0x6b')]['rawAttributes']);_0x5f2d89[_0xcdd0('0x42')]=_['keys'](_0x4cb845['query']);_0x5f2d89[_0xcdd0('0x44')]=_[_0xcdd0('0x45')](_0x5f2d89[_0xcdd0('0x41')],_0x5f2d89[_0xcdd0('0x42')]);_0x101e62[_0xcdd0('0x46')]=_['intersection'](_0x5f2d89[_0xcdd0('0x41')],qs['fields'](_0x4cb845[_0xcdd0('0x42')][_0xcdd0('0x47')]));_0x101e62['attributes']=_0x101e62[_0xcdd0('0x46')][_0xcdd0('0x48')]?_0x101e62[_0xcdd0('0x46')]:_0x5f2d89[_0xcdd0('0x41')];if(!_0x4cb845[_0xcdd0('0x42')][_0xcdd0('0x49')]('nolimit')){_0x101e62['limit']=qs[_0xcdd0('0x2e')](_0x4cb845['query'][_0xcdd0('0x2e')]);_0x101e62[_0xcdd0('0x2d')]=qs[_0xcdd0('0x2d')](_0x4cb845[_0xcdd0('0x42')]['offset']);}_0x101e62[_0xcdd0('0x4a')]=qs[_0xcdd0('0x4b')](_0x4cb845[_0xcdd0('0x42')][_0xcdd0('0x4b')]);_0x101e62[_0xcdd0('0x4c')]=qs[_0xcdd0('0x44')](_['pick'](_0x4cb845['query'],_0x5f2d89[_0xcdd0('0x44')]));_0x101e62[_0xcdd0('0x4c')][_0xcdd0('0x67')]=_0xf8eab2['id'];if(_0x4cb845[_0xcdd0('0x42')][_0xcdd0('0x4e')]){_0x101e62[_0xcdd0('0x4c')]=_[_0xcdd0('0x4f')](_0x101e62[_0xcdd0('0x4c')],{'$or':_[_0xcdd0('0x50')](_0x101e62[_0xcdd0('0x46')],function(_0xc8e0ea){var _0x429431={};_0x429431[_0xc8e0ea]={'$like':'%'+_0x4cb845[_0xcdd0('0x42')][_0xcdd0('0x4e')]+'%'};return _0x429431;})});}_0x101e62=_[_0xcdd0('0x4f')]({},_0x101e62,_0x4cb845[_0xcdd0('0x53')]);return db['CannedAnswer'][_0xcdd0('0x30')]({'where':_0x101e62['where']})[_0xcdd0('0x20')](function(_0x2a6e5c){_0x1b7abd[_0xcdd0('0x30')]=_0x2a6e5c;if(_0x4cb845[_0xcdd0('0x42')]['includeAll']){_0x101e62['include']=[{'all':!![]}];}return db[_0xcdd0('0x6b')]['findAll'](_0x101e62);})[_0xcdd0('0x20')](function(_0x236b4a){_0x1b7abd[_0xcdd0('0x57')]=_0x236b4a;return _0x1b7abd;});}})[_0xcdd0('0x20')](respondWithFilteredResult(_0x521d21,_0x101e62))[_0xcdd0('0x58')](handleError(_0x521d21,null));};exports[_0xcdd0('0x6e')]=function(_0x53f003,_0x17b3f7,_0x5e5914){return db['OpenchannelAccount'][_0xcdd0('0x5c')]({'where':{'id':_0x53f003[_0xcdd0('0x5a')]['id']}})[_0xcdd0('0x20')](handleEntityNotFound(_0x17b3f7,null))[_0xcdd0('0x20')](function(_0x5b75ee){if(_0x5b75ee){return _0x5b75ee[_0xcdd0('0x6e')](_0x53f003[_0xcdd0('0x42')][_0xcdd0('0x69')]);}})[_0xcdd0('0x20')](respondWithStatusCode(_0x17b3f7,null))['catch'](handleError(_0x17b3f7,null));};exports['notify']=function(_0x41740c,_0x4e775b,_0x275f6f){var _0x5df78b={'body':_0x41740c[_0xcdd0('0x5e')],'channel':'openchannel'};var _0x50d2dc=[];var _0x4c7ff5=[];var _0x23f380={};var _0x48215a=![];return db[_0xcdd0('0x6f')][_0xcdd0('0x65')]()[_0xcdd0('0x20')](function(_0x4fd43a){if(!_0x4fd43a){throw new db[(_0xcdd0('0x70'))][(_0xcdd0('0x71'))](_0xcdd0('0x72'));}_0x50d2dc=_[_0xcdd0('0x73')](_[_0xcdd0('0x43')](_0x4fd43a),[_0xcdd0('0x74'),_0xcdd0('0x75')]);_0x4c7ff5=_[_0xcdd0('0x73')](_[_0xcdd0('0x43')](_0x4fd43a),[_0xcdd0('0x74'),'updatedAt',_0xcdd0('0x76'),_0xcdd0('0x77')]);if(_0x41740c[_0xcdd0('0x5e')]['id']){delete _0x41740c[_0xcdd0('0x5e')]['id'];}if(_[_0xcdd0('0x78')](_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x79')])){throw new db['Sequelize'][(_0xcdd0('0x71'))](_0xcdd0('0x7a'));}if(_[_0xcdd0('0x78')](_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x5e')])||_0x41740c[_0xcdd0('0x5e')]['body']===''){throw new db['Sequelize'][(_0xcdd0('0x71'))](_0xcdd0('0x7b'));}if(_['isNil'](_0x41740c['body'][_0xcdd0('0x7c')])){throw new db[(_0xcdd0('0x70'))]['ValidationError'](_0xcdd0('0x7d')+_0x4c7ff5);}if(!_[_0xcdd0('0x7e')](_0x4c7ff5,_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x7c')])){throw new db[(_0xcdd0('0x70'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4c7ff5);}_0x23f380[_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x7c')]]=_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x79')];})['then'](function(){return db['OpenchannelAccount'][_0xcdd0('0x5c')]({'where':{'id':_0x41740c[_0xcdd0('0x5a')]['id']},'include':[{'model':db[_0xcdd0('0x7f')],'as':_0xcdd0('0x80'),'include':[{'model':db[_0xcdd0('0x6f')],'as':_0xcdd0('0x81'),'where':_0x23f380,'limit':0x1,'order':[['updatedAt',_0xcdd0('0x82')]]}]},{'model':db['OpenchannelApplication'],'as':_0xcdd0('0x83')}]});})[_0xcdd0('0x20')](handleEntityNotFound(_0x4e775b,null))[_0xcdd0('0x20')](function(_0x27246a){if(_0x27246a&&_0x27246a[_0xcdd0('0x80')]){_0x5df78b[_0xcdd0('0x84')]=_0x27246a;_0x5df78b[_0xcdd0('0x85')]=_0x27246a[_0xcdd0('0x83')];_0x5df78b[_0xcdd0('0x86')]=_0x27246a[_0xcdd0('0x80')];_0x5df78b['applications']=_[_0xcdd0('0x87')](_0x5df78b['applications'],[_0xcdd0('0x88')],[_0xcdd0('0x89')]);if(_0x5df78b[_0xcdd0('0x84')][_0xcdd0('0x83')]){delete _0x5df78b[_0xcdd0('0x84')][_0xcdd0('0x83')];}if(_0x5df78b[_0xcdd0('0x84')][_0xcdd0('0x80')]&&_0x5df78b[_0xcdd0('0x84')][_0xcdd0('0x80')][_0xcdd0('0x81')]['length']){return _0x5df78b[_0xcdd0('0x84')]['List'][_0xcdd0('0x81')][0x0];}var _0x19cb72=_['defaults'](_0x41740c[_0xcdd0('0x5e')],{'firstName':_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x79')],'ListId':_0x27246a[_0xcdd0('0x77')]});_0x19cb72[_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x7c')]]=_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x79')];return db[_0xcdd0('0x6f')][_0xcdd0('0x5d')](_0x19cb72,{'fields':_0x50d2dc,'raw':!![]});}})[_0xcdd0('0x20')](handleEntityNotFound(_0x4e775b,null))[_0xcdd0('0x20')](function(_0x1f932f){_0x5df78b[_0xcdd0('0x8a')]=_0x1f932f;if(_0x1f932f){var _0x923208={'ContactId':_0x1f932f['id'],'OpenchannelAccountId':_0x41740c[_0xcdd0('0x5a')]['id'],'from':(_0x1f932f[_0xcdd0('0x8b')]||'')+'\x20'+(_0x1f932f['lastName']||'')};var _0x1b8f66={'OpenchannelAccountId':_0x41740c['params']['id'],'closed':![]};if(_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x8c')]){_0x1b8f66[_0xcdd0('0x8c')]=_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x8c')];return db[_0xcdd0('0x8d')][_0xcdd0('0x5c')]({'where':_0x1b8f66})[_0xcdd0('0x20')](function(_0x2499eb){if(_0x2499eb){return[_0x2499eb,![]];}_0x923208['threadId']=_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x8c')];_0x923208[_0xcdd0('0x8e')]=_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x8e')];return db[_0xcdd0('0x8d')][_0xcdd0('0x5d')](_0x923208)[_0xcdd0('0x20')](function(_0x25d9b7){return[_0x25d9b7,!![]];});});}else{_0x1b8f66[_0xcdd0('0x8c')]=null;}_0x1b8f66[_0xcdd0('0x8f')]=_0x1f932f['id'];return db[_0xcdd0('0x8d')][_0xcdd0('0x5c')]({'where':_0x1b8f66})[_0xcdd0('0x20')](function(_0x49a0ee){if(_0x49a0ee){return[_0x49a0ee,![]];}return db[_0xcdd0('0x8d')][_0xcdd0('0x5d')](_0x923208)[_0xcdd0('0x20')](function(_0x35de52){return[_0x35de52,!![]];});});}})[_0xcdd0('0x90')](function(_0x231d30,_0x344841){if(_0x231d30){_0x48215a=_0x344841;if(!_0x344841){var _0x4dc0c4={'from':(_0x5df78b[_0xcdd0('0x8a')][_0xcdd0('0x8b')]||'')+'\x20'+(_0x5df78b[_0xcdd0('0x8a')]['lastName']||'')};if(_0x41740c['body'][_0xcdd0('0x8c')]&&_0x41740c['body']['messageId']&&_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x8c')]!=_0x41740c['body'][_0xcdd0('0x91')]){_0x4dc0c4['threadId']=_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x91')];}return _0x231d30['update'](_0x4dc0c4);}else{return _0x231d30;}}})[_0xcdd0('0x20')](function(_0x7f9036){_0x5df78b[_0xcdd0('0x92')]=_0x7f9036['get']({'plain':!![]});_0x5df78b[_0xcdd0('0x92')][_0xcdd0('0x93')]=_0x48215a;if(_0x5df78b[_0xcdd0('0x92')][_0xcdd0('0x93')]){if(_0x5df78b[_0xcdd0('0x84')][_0xcdd0('0x94')]){_0x5df78b[_0xcdd0('0x85')][_0xcdd0('0x95')]({'id':0x0,'priority':_0x5df78b[_0xcdd0('0x85')][_0xcdd0('0x48')]+0x1,'app':_0xcdd0('0x96'),'appdata':_0xcdd0('0x97'),'interval':_0xcdd0('0x98')});}}return db[_0xcdd0('0x99')][_0xcdd0('0x5d')]({'body':_0x41740c['body'][_0xcdd0('0x5e')],'OpenchannelAccountId':_0x41740c['params']['id'],'OpenchannelInteractionId':_0x7f9036['id'],'direction':'in','ContactId':_0x5df78b['contact']['id'],'AttachmentId':_0x41740c[_0xcdd0('0x5e')][_0xcdd0('0x9a')]});})[_0xcdd0('0x20')](function(_0x310c37){_0x5df78b[_0xcdd0('0x27')]=_0x310c37;if(_0x5df78b[_0xcdd0('0x92')][_0xcdd0('0x9b')]){return db['User']['find']({'attributes':['id',_0xcdd0('0x3a')],'where':{'id':_0x5df78b[_0xcdd0('0x92')][_0xcdd0('0x9b')]}})['then'](function(_0x5deab9){if(_0x5deab9){_0x5df78b[_0xcdd0('0x85')][_0xcdd0('0x9c')]({'id':0x0,'priority':0x0,'app':_0xcdd0('0x9d'),'appdata':_0x5deab9['name']+','+(_0x5df78b[_0xcdd0('0x84')][_0xcdd0('0x9e')]||0xa),'interval':'*,*,*,*'});_0x5df78b[_0xcdd0('0x9f')]=![];}return respondWithRpcPromise(_0xcdd0('0xa0'),_0xcdd0('0xa1'),_0x5df78b);});}return respondWithRpcPromise(_0xcdd0('0xa0'),_0xcdd0('0xa1'),_0x5df78b);})[_0xcdd0('0x20')](function(_0x183dc5){respondWithRpcPromise('EventManager',_0xcdd0('0xa2'),{'event':_0xcdd0('0xa3'),'message':_0x183dc5},client9002);return _0x183dc5;})[_0xcdd0('0x20')](respondWithResult(_0x4e775b,null))[_0xcdd0('0x58')](handleError(_0x4e775b,null));};exports[_0xcdd0('0xa4')]=function(_0x2667eb,_0xfdfafd){var _0x13e8c8=_0x2667eb[_0xcdd0('0x5a')]['id'];var _0x1bb5c4=_0x2667eb['body'];var _0x4f6b45=0xc8;var _0xa0309d=null;return db[_0xcdd0('0xa5')]['transaction']({'isolationLevel':db[_0xcdd0('0xa5')][_0xcdd0('0xa6')][_0xcdd0('0xa7')][_0xcdd0('0xa8')]},function(_0x11bfab){return db['OpenchannelAccount'][_0xcdd0('0x6d')]({'where':{'id':_0x13e8c8},'transaction':_0x11bfab})['then'](function(_0x832856){if(_0x832856){return db[_0xcdd0('0xa9')][_0xcdd0('0x38')]({'where':{'OpenchannelAccountId':_0x13e8c8},'transaction':_0x11bfab})[_0xcdd0('0x20')](function(){var _0xf7c3c2=_[_0xcdd0('0x50')](_0x1bb5c4,function(_0x4c5b1d){_0x4c5b1d['OpenchannelAccountId']=_0x13e8c8;return _0x4c5b1d;});return db['OpenchannelApplication']['bulkCreate'](_0xf7c3c2,{'transaction':_0x11bfab});});}else{_0x4f6b45=0x194;_0xa0309d=[];}});})[_0xcdd0('0x20')](function(){if(_0x4f6b45!==0x194){return db[_0xcdd0('0xa9')][_0xcdd0('0xaa')]({'where':{'OpenchannelAccountId':_0x13e8c8},'order':_0xcdd0('0x88')})[_0xcdd0('0x20')](function(_0x3d7b9b){_0xa0309d=_0x3d7b9b;});}})[_0xcdd0('0x58')](function(_0x46d378){_0x4f6b45=0x1f4;logger[_0xcdd0('0x25')](_0x46d378[_0xcdd0('0x39')]);if(_0x46d378[_0xcdd0('0x3a')]){delete _0x46d378[_0xcdd0('0x3a')];}_0xa0309d=_0x46d378;})['finally'](function(){if(_0xa0309d===null){_0xfdfafd['sendStatus'](_0x4f6b45);}else{if(_0x4f6b45===0x1f4){_0xfdfafd[_0xcdd0('0x2a')](_0x4f6b45)['send'](_0xa0309d);}else{_0xfdfafd[_0xcdd0('0x2a')](_0x4f6b45)[_0xcdd0('0x2c')](_0xa0309d);}}});};exports['getApplications']=function(_0x22f7b4,_0x276d76,_0x3fc09b){var _0x24e24f={};var _0x1a304f={};var _0x1029e1;var _0x311484;return db[_0xcdd0('0x3d')][_0xcdd0('0x6d')]({'where':{'id':_0x22f7b4[_0xcdd0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x276d76,null))[_0xcdd0('0x20')](function(_0x378fd3){if(_0x378fd3){_0x1029e1=_0x378fd3;_0x1a304f[_0xcdd0('0x41')]=_[_0xcdd0('0x43')](db[_0xcdd0('0xa9')][_0xcdd0('0x3e')]);_0x1a304f[_0xcdd0('0x42')]=_[_0xcdd0('0x43')](_0x22f7b4[_0xcdd0('0x42')]);_0x1a304f['filters']=_[_0xcdd0('0x45')](_0x1a304f[_0xcdd0('0x41')],_0x1a304f['query']);_0x24e24f['attributes']=_[_0xcdd0('0x45')](_0x1a304f[_0xcdd0('0x41')],qs['fields'](_0x22f7b4['query'][_0xcdd0('0x47')]));_0x24e24f[_0xcdd0('0x46')]=_0x24e24f[_0xcdd0('0x46')]['length']?_0x24e24f[_0xcdd0('0x46')]:_0x1a304f[_0xcdd0('0x41')];_0x24e24f['order']=qs['sort'](_0x22f7b4['query'][_0xcdd0('0x4b')]);_0x24e24f[_0xcdd0('0x4c')]=qs[_0xcdd0('0x44')](_[_0xcdd0('0x4d')](_0x22f7b4[_0xcdd0('0x42')],_0x1a304f['filters']));if(_0x22f7b4[_0xcdd0('0x42')][_0xcdd0('0x4e')]){_0x24e24f[_0xcdd0('0x4c')]=_[_0xcdd0('0x4f')](_0x24e24f[_0xcdd0('0x4c')],{'$or':_[_0xcdd0('0x50')](_0x24e24f[_0xcdd0('0x46')],function(_0x19b8ab){var _0x555053={};_0x555053[_0x19b8ab]={'$like':'%'+_0x22f7b4['query'][_0xcdd0('0x4e')]+'%'};return _0x555053;})});}_0x24e24f=_['merge']({},_0x24e24f,_0x22f7b4[_0xcdd0('0x53')]);return _0x1029e1[_0xcdd0('0xab')](_0x24e24f);}})[_0xcdd0('0x20')](function(_0x513fca){if(_0x513fca){_0x311484=_0x513fca[_0xcdd0('0x48')];if(!_0x22f7b4[_0xcdd0('0x42')]['hasOwnProperty'](_0xcdd0('0xac'))){_0x24e24f[_0xcdd0('0x2e')]=qs[_0xcdd0('0x2e')](_0x22f7b4[_0xcdd0('0x42')][_0xcdd0('0x2e')]);_0x24e24f['offset']=qs[_0xcdd0('0x2d')](_0x22f7b4[_0xcdd0('0x42')]['offset']);}return _0x1029e1['getApplications'](_0x24e24f);}})[_0xcdd0('0x20')](function(_0x54ed08){if(_0x54ed08){return _0x54ed08?{'count':_0x311484,'rows':_0x54ed08}:null;}})[_0xcdd0('0x20')](respondWithResult(_0x276d76,null))[_0xcdd0('0x58')](handleError(_0x276d76,null));};exports[_0xcdd0('0xad')]=function(_0xe8a070,_0x1a9812,_0x412408){var _0x207c8c={'raw':![],'where':{}};var _0x30d797={};var _0x55e429={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xcdd0('0x6d')]({'where':{'id':_0xe8a070[_0xcdd0('0x5a')]['id']}})[_0xcdd0('0x20')](handleEntityNotFound(_0x1a9812,null))['then'](function(_0x49b338){if(_0x49b338){_0x30d797[_0xcdd0('0x41')]=_[_0xcdd0('0x43')](db[_0xcdd0('0x8d')][_0xcdd0('0x3e')]);_0x30d797[_0xcdd0('0x42')]=_[_0xcdd0('0x43')](_0xe8a070[_0xcdd0('0x42')]);_0x30d797[_0xcdd0('0x44')]=_['intersection'](_0x30d797['model'],_0x30d797['query']);_0x207c8c[_0xcdd0('0x46')]=_[_0xcdd0('0x45')](_0x30d797[_0xcdd0('0x41')],qs[_0xcdd0('0x47')](_0xe8a070[_0xcdd0('0x42')][_0xcdd0('0x47')]));_0x207c8c[_0xcdd0('0x46')]=_0x207c8c[_0xcdd0('0x46')][_0xcdd0('0x48')]?_0x207c8c[_0xcdd0('0x46')]:_0x30d797['model'];if(!_0xe8a070[_0xcdd0('0x42')]['hasOwnProperty']('nolimit')){_0x207c8c['limit']=qs['limit'](_0xe8a070[_0xcdd0('0x42')][_0xcdd0('0x2e')]);_0x207c8c[_0xcdd0('0x2d')]=qs[_0xcdd0('0x2d')](_0xe8a070[_0xcdd0('0x42')][_0xcdd0('0x2d')]);}_0x207c8c[_0xcdd0('0x4a')]=qs['sort'](_0xe8a070[_0xcdd0('0x42')][_0xcdd0('0x4b')]);_0x207c8c[_0xcdd0('0x4c')]=qs[_0xcdd0('0x44')](_['pick'](_0xe8a070['query'],_0x30d797['filters']));_0x207c8c['where'][_0xcdd0('0x67')]=_0x49b338['id'];if(_0xe8a070[_0xcdd0('0x42')][_0xcdd0('0x4e')]){_0x207c8c[_0xcdd0('0x4c')]=_[_0xcdd0('0x4f')](_0x207c8c[_0xcdd0('0x4c')],{'$or':_[_0xcdd0('0x50')](_0x207c8c['attributes'],function(_0x4542e3){var _0x290103={};_0x290103[_0x4542e3]={'$like':'%'+_0xe8a070[_0xcdd0('0x42')][_0xcdd0('0x4e')]+'%'};return _0x290103;})});}_0x207c8c=_['merge']({},_0x207c8c,_0xe8a070[_0xcdd0('0x53')]);return db['OpenchannelInteraction'][_0xcdd0('0x30')]({'where':_0x207c8c['where']})[_0xcdd0('0x20')](function(_0x432f24){_0x55e429[_0xcdd0('0x30')]=_0x432f24;if(_0xe8a070['query']['includeAll']){_0x207c8c['include']=[{'model':db[_0xcdd0('0x6f')],'as':_0xcdd0('0xae'),'required':![]},{'model':db[_0xcdd0('0xaf')],'as':_0xcdd0('0xb0'),'attributes':['name',_0xcdd0('0xb1'),_0xcdd0('0xb2')],'required':![]},{'model':db[_0xcdd0('0xb3')],'as':_0xcdd0('0xb4'),'attributes':['id',_0xcdd0('0x3a'),_0xcdd0('0xb5')],'where':_0xe8a070[_0xcdd0('0x42')][_0xcdd0('0xb6')]?{'id':_0xe8a070[_0xcdd0('0x42')][_0xcdd0('0xb6')]}:undefined,'required':_0xe8a070[_0xcdd0('0x42')]['tag']?!![]:![]}];}return db[_0xcdd0('0x8d')]['findAll'](_0x207c8c);})['then'](function(_0x4935d9){_0x55e429[_0xcdd0('0x57')]=_0x4935d9;return _0x55e429;});}})[_0xcdd0('0x20')](respondWithFilteredResult(_0x1a9812,_0x207c8c))[_0xcdd0('0x58')](handleError(_0x1a9812,null));};exports[_0xcdd0('0xb7')]=function(_0x16fc55,_0x5519a9,_0x50a9cc){return db[_0xcdd0('0x3d')][_0xcdd0('0x5c')]({'where':{'id':_0x16fc55[_0xcdd0('0x5a')]['id']}})[_0xcdd0('0x20')](handleEntityNotFound(_0x5519a9,null))['then'](function(_0x5afc14){if(_0x5afc14){return _0x5afc14['addAgents'](_0x16fc55[_0xcdd0('0x5e')][_0xcdd0('0x69')],_[_0xcdd0('0xb8')](_0x16fc55['body'],['ids','id'])||{})[_0xcdd0('0x90')](function(_0x5d4226){for(var _0x2a23ec=0x0;_0x2a23ec<_0x16fc55[_0xcdd0('0x5e')][_0xcdd0('0x69')][_0xcdd0('0x48')];_0x2a23ec+=0x1){socket['emit'](_0xcdd0('0xb9'),{'UserId':Number(_0x16fc55[_0xcdd0('0x5e')][_0xcdd0('0x69')][_0x2a23ec]),'OpenchannelAccountId':Number(_0x16fc55['params']['id'])});}return _0x5d4226;});}})[_0xcdd0('0x20')](respondWithResult(_0x5519a9,null))[_0xcdd0('0x58')](handleError(_0x5519a9,null));};exports[_0xcdd0('0xba')]=function(_0x4e54d0,_0x1a89a4,_0x39cff3){return db[_0xcdd0('0x3d')][_0xcdd0('0x5c')]({'where':{'id':_0x4e54d0[_0xcdd0('0x5a')]['id']}})[_0xcdd0('0x20')](handleEntityNotFound(_0x1a89a4,null))[_0xcdd0('0x20')](function(_0x56fa74){if(_0x56fa74){return _0x56fa74['removeAgents'](_0x4e54d0[_0xcdd0('0x42')][_0xcdd0('0x69')])['then'](function(){if(_[_0xcdd0('0xbb')](_0x4e54d0[_0xcdd0('0x42')][_0xcdd0('0x69')])){for(var _0x31b544=0x0;_0x31b544<_0x4e54d0['query'][_0xcdd0('0x69')][_0xcdd0('0x48')];_0x31b544+=0x1){socket['emit'](_0xcdd0('0xbc'),{'UserId':Number(_0x4e54d0[_0xcdd0('0x42')][_0xcdd0('0x69')][_0x31b544]),'OpenchannelAccountId':Number(_0x4e54d0[_0xcdd0('0x5a')]['id'])});}}else{socket[_0xcdd0('0xbd')]('userOpenchannelAccount:remove',{'UserId':Number(_0x4e54d0[_0xcdd0('0x42')][_0xcdd0('0x69')]),'OpenchannelAccountId':Number(_0x4e54d0[_0xcdd0('0x5a')]['id'])});}});}})[_0xcdd0('0x20')](respondWithStatusCode(_0x1a89a4,null))[_0xcdd0('0x58')](handleError(_0x1a89a4,null));};exports['getAgents']=function(_0x296dca,_0x2a6918,_0x46e089){var _0xdfaada={};var _0x50c410={};var _0x148bb9;var _0x5f5234;return db[_0xcdd0('0x3d')][_0xcdd0('0x6d')]({'where':{'id':_0x296dca['params']['id']}})[_0xcdd0('0x20')](handleEntityNotFound(_0x2a6918,null))[_0xcdd0('0x20')](function(_0x328b1a){if(_0x328b1a){_0x148bb9=_0x328b1a;_0x50c410[_0xcdd0('0x41')]=_[_0xcdd0('0x43')](db[_0xcdd0('0xaf')][_0xcdd0('0x3e')]);_0x50c410[_0xcdd0('0x42')]=_[_0xcdd0('0x43')](_0x296dca[_0xcdd0('0x42')]);_0x50c410[_0xcdd0('0x44')]=_[_0xcdd0('0x45')](_0x50c410['model'],_0x50c410[_0xcdd0('0x42')]);_0xdfaada[_0xcdd0('0x46')]=_[_0xcdd0('0x45')](_0x50c410[_0xcdd0('0x41')],qs[_0xcdd0('0x47')](_0x296dca[_0xcdd0('0x42')][_0xcdd0('0x47')]));_0xdfaada['attributes']=_0xdfaada[_0xcdd0('0x46')][_0xcdd0('0x48')]?_0xdfaada[_0xcdd0('0x46')]:_0x50c410[_0xcdd0('0x41')];_0xdfaada[_0xcdd0('0x4a')]=qs['sort'](_0x296dca['query'][_0xcdd0('0x4b')]);_0xdfaada[_0xcdd0('0x4c')]=qs[_0xcdd0('0x44')](_[_0xcdd0('0x4d')](_0x296dca['query'],_0x50c410[_0xcdd0('0x44')]));if(_0x296dca[_0xcdd0('0x42')][_0xcdd0('0x4e')]){_0xdfaada[_0xcdd0('0x4c')]=_['merge'](_0xdfaada['where'],{'$or':_[_0xcdd0('0x50')](_0xdfaada[_0xcdd0('0x46')],function(_0x442258){var _0x481c6b={};_0x481c6b[_0x442258]={'$like':'%'+_0x296dca[_0xcdd0('0x42')]['filter']+'%'};return _0x481c6b;})});}_0xdfaada=_[_0xcdd0('0x4f')]({},_0xdfaada,_0x296dca[_0xcdd0('0x53')]);return _0x148bb9[_0xcdd0('0xbe')](_0xdfaada);}})[_0xcdd0('0x20')](function(_0x5230b8){if(_0x5230b8){_0x5f5234=_0x5230b8[_0xcdd0('0x48')];if(!_0x296dca[_0xcdd0('0x42')][_0xcdd0('0x49')](_0xcdd0('0xac'))){_0xdfaada[_0xcdd0('0x2e')]=qs[_0xcdd0('0x2e')](_0x296dca['query']['limit']);_0xdfaada[_0xcdd0('0x2d')]=qs[_0xcdd0('0x2d')](_0x296dca[_0xcdd0('0x42')][_0xcdd0('0x2d')]);}return _0x148bb9['getAgents'](_0xdfaada);}})['then'](function(_0x37bd02){if(_0x37bd02){return _0x37bd02?{'count':_0x5f5234,'rows':_0x37bd02}:null;}})[_0xcdd0('0x20')](respondWithResult(_0x2a6918,null))['catch'](handleError(_0x2a6918,null));};exports[_0xcdd0('0xbf')]=function(_0x157a48,_0x14a602,_0x1a5dd2){var _0x5858f1,_0x21a994,_0x1790b;if(_[_0xcdd0('0x78')](_0x157a48[_0xcdd0('0x5e')][_0xcdd0('0x5e')])||_0x157a48[_0xcdd0('0x5e')]['body']===''){throw new db[(_0xcdd0('0x70'))][(_0xcdd0('0x71'))](_0xcdd0('0x7b'));}if(_['isNil'](_0x157a48[_0xcdd0('0x5e')]['to'])){}_0x5858f1=_0x157a48['body']['to'];return db[_0xcdd0('0x3d')][_0xcdd0('0x6d')]({'where':{'id':_0x157a48['params']['id']}})[_0xcdd0('0x20')](handleEntityNotFound(_0x14a602,null))[_0xcdd0('0x20')](function(_0x332f17){if(_0x332f17){return db[_0xcdd0('0x3d')][_0xcdd0('0x5c')]({'where':{'id':_0x332f17['id']},'include':[{'model':db[_0xcdd0('0x7f')],'as':_0xcdd0('0x80'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x332f17['mapKey']]:_0x5858f1},'limit':0x1,'order':[[_0xcdd0('0x75'),_0xcdd0('0x82')]]}]}]})[_0xcdd0('0x20')](handleEntityNotFound(_0x14a602,null))['then'](function(_0x3037c1){if(_0x3037c1&&_0x3037c1[_0xcdd0('0x80')]){_0x21a994=_0x3037c1['get']({'plain':!![]});if(_0x21a994[_0xcdd0('0x80')]&&_0x21a994[_0xcdd0('0x80')][_0xcdd0('0x81')][_0xcdd0('0x48')]){return _0x21a994[_0xcdd0('0x80')][_0xcdd0('0x81')][0x0];}return db[_0xcdd0('0x6f')][_0xcdd0('0x5d')](_['defaults'](_0x157a48['body'],{'firstName':_0x5858f1,[_0x3037c1['mapKey']]:_0x5858f1,'phone':_0x5858f1,'ListId':_0x21a994[_0xcdd0('0x77')]}));}})[_0xcdd0('0x20')](handleEntityNotFound(_0x14a602,null))[_0xcdd0('0x20')](function(_0x4d950e){if(_0x4d950e){_0x1790b=_0x4d950e;return db[_0xcdd0('0x8d')]['find']({'where':{'ContactId':_0x1790b['id'],'closed':![],'OpenchannelAccountId':_0x21a994['id']}})['then'](function(_0x1ae329){if(_0x1ae329){return[_0x1ae329,![]];}return db[_0xcdd0('0x8d')]['create']({'UserId':_0x157a48[_0xcdd0('0x5f')]['id'],'ContactId':_0x1790b['id'],'OpenchannelAccountId':_0x21a994['id'],'lastMsgDirection':_0xcdd0('0xc0'),'firstMsgDirection':_0xcdd0('0xc0'),'Messages':[_['merge'](_0x157a48['body'],{'read':![],'body':_0x157a48[_0xcdd0('0x5e')]['body'],'OpenchannelAccountId':_0x21a994['id'],'UserId':_0x157a48[_0xcdd0('0x5f')]['id'],'ContactId':_0x1790b['id']})]},{'include':[{'model':db[_0xcdd0('0x99')],'as':_0xcdd0('0xc1')}]})[_0xcdd0('0x20')](function(_0x2c9307){return[_0x2c9307,!![]];});});}})[_0xcdd0('0x90')](function(_0x15a384,_0x5d232a){if(_0x5d232a){return _0x15a384;}return db[_0xcdd0('0x99')][_0xcdd0('0x5d')](_[_0xcdd0('0x4f')](_0x157a48[_0xcdd0('0x5e')],{'read':![],'body':_0x157a48[_0xcdd0('0x5e')][_0xcdd0('0x5e')],'OpenchannelAccountId':_0x21a994['id'],'OpenchannelInteractionId':_0x15a384['id'],'UserId':_0x157a48[_0xcdd0('0x5f')]['id'],'ContactId':_0x1790b['id']}))[_0xcdd0('0x20')](function(_0x510e9f){_0x15a384[_0xcdd0('0xc2')][_0xcdd0('0xc1')]=[];_0x15a384[_0xcdd0('0xc2')]['Messages'][_0xcdd0('0x95')](_0x510e9f[_0xcdd0('0xc2')]);return _0x15a384;});});}})['then'](respondWithResult(_0x14a602,null))[_0xcdd0('0x58')](handleError(_0x14a602,null));}; \ No newline at end of file +var _0xb19f=['sendStatus','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','keys','query','intersection','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','rows','params','fields','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','hasOwnProperty','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','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','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','addApplications','sequelize','ISOLATION_LEVELS','OpenchannelApplication','bulkCreate','findAndCountAll','stack','getApplications','Owner','internal','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','dataValues','Messages','eml-format','rimraf','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','http','client','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','end'];(function(_0x242a81,_0x5ad269){var _0x34dae1=function(_0x5c4554){while(--_0x5c4554){_0x242a81['push'](_0x242a81['shift']());}};_0x34dae1(++_0x5ad269);}(_0xb19f,0x7d));var _0xfb19=function(_0x550a61,_0x1c5d8c){_0x550a61=_0x550a61-0x0;var _0x248bfc=_0xb19f[_0x550a61];return _0x248bfc;};'use strict';var emlformat=require(_0xfb19('0x0'));var rimraf=require(_0xfb19('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfb19('0x2'));var moment=require(_0xfb19('0x3'));var BPromise=require(_0xfb19('0x4'));var Mustache=require('mustache');var util=require(_0xfb19('0x5'));var path=require('path');var sox=require(_0xfb19('0x6'));var csv=require('to-csv');var ejs=require(_0xfb19('0x7'));var fs=require('fs');var fs_extra=require(_0xfb19('0x8'));var _=require('lodash');var squel=require(_0xfb19('0x9'));var crypto=require('crypto');var jsforce=require(_0xfb19('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfb19('0xb'));var querystring=require('querystring');var Papa=require(_0xfb19('0xc'));var Redis=require('ioredis');var authService=require(_0xfb19('0xd'));var qs=require(_0xfb19('0xe'));var as=require(_0xfb19('0xf'));var hardwareService=require(_0xfb19('0x10'));var logger=require(_0xfb19('0x11'))(_0xfb19('0x12'));var utils=require(_0xfb19('0x13'));var config=require(_0xfb19('0x14'));var licenseUtil=require(_0xfb19('0x15'));var db=require(_0xfb19('0x16'))['db'];config[_0xfb19('0x17')]=_[_0xfb19('0x18')](config[_0xfb19('0x17')],{'host':_0xfb19('0x19'),'port':0x18eb});var socket=require(_0xfb19('0x1a'))(new Redis(config[_0xfb19('0x17')]));require(_0xfb19('0x1b'))['register'](socket);var jayson=require(_0xfb19('0x1c'));var client=jayson['client'][_0xfb19('0x1d')]({'port':0x232c});var client9002=jayson[_0xfb19('0x1e')][_0xfb19('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5de532,_0x4427e2,_0x379fda,_0x17c238){return new BPromise(function(_0x29fb85,_0x4d3192){var _0x15500a=_0x17c238||client;return _0x15500a[_0xfb19('0x1f')](_0x5de532,_0x379fda)[_0xfb19('0x20')](function(_0x2f8208){logger['info'](_0xfb19('0x21'),_0x4427e2,_0xfb19('0x22'));logger[_0xfb19('0x23')](_0xfb19('0x24'),_0x4427e2,'request\x20sent',JSON['stringify'](_0x2f8208));if(_0x2f8208[_0xfb19('0x25')]){if(_0x2f8208[_0xfb19('0x25')][_0xfb19('0x26')]===0x1f4){logger[_0xfb19('0x25')](_0xfb19('0x21'),_0x4427e2,_0x2f8208['error'][_0xfb19('0x27')]);return _0x4d3192(_0x2f8208['error'][_0xfb19('0x27')]);}logger[_0xfb19('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x4427e2,_0x2f8208[_0xfb19('0x25')]['message']);return _0x29fb85(_0x2f8208[_0xfb19('0x25')][_0xfb19('0x27')]);}else{logger[_0xfb19('0x28')](_0xfb19('0x21'),_0x4427e2,_0xfb19('0x22'));_0x29fb85(_0x2f8208[_0xfb19('0x29')][_0xfb19('0x27')]);}})['catch'](function(_0x28ab71){logger['error'](_0xfb19('0x21'),_0x4427e2,_0x28ab71);_0x4d3192(_0x28ab71);});});}function respondWithStatusCode(_0x369a19,_0x3d9d69){_0x3d9d69=_0x3d9d69||0xcc;return function(_0x4561fa){if(_0x4561fa){return _0x369a19['sendStatus'](_0x3d9d69);}return _0x369a19[_0xfb19('0x2a')](_0x3d9d69)['end']();};}function respondWithResult(_0x5de22d,_0x2bd35a){_0x2bd35a=_0x2bd35a||0xc8;return function(_0x36b058){if(_0x36b058){return _0x5de22d[_0xfb19('0x2a')](_0x2bd35a)[_0xfb19('0x2b')](_0x36b058);}};}function respondWithFilteredResult(_0x58c3f4,_0x40038c){return function(_0xfd3168){if(_0xfd3168){var _0x6d79e5=typeof _0x40038c[_0xfb19('0x2c')]==='undefined'&&typeof _0x40038c[_0xfb19('0x2d')]===_0xfb19('0x2e');var _0x2a310f=_0xfd3168[_0xfb19('0x2f')];var _0x46384a=_0x6d79e5?0x0:_0x40038c[_0xfb19('0x2c')];var _0x222e68=_0x6d79e5?_0xfd3168[_0xfb19('0x2f')]:_0x40038c[_0xfb19('0x2c')]+_0x40038c[_0xfb19('0x2d')];var _0x1b4ac0;if(_0x222e68>=_0x2a310f){_0x222e68=_0x2a310f;_0x1b4ac0=0xc8;}else{_0x1b4ac0=0xce;}_0x58c3f4[_0xfb19('0x2a')](_0x1b4ac0);return _0x58c3f4[_0xfb19('0x30')](_0xfb19('0x31'),_0x46384a+'-'+_0x222e68+'/'+_0x2a310f)[_0xfb19('0x2b')](_0xfd3168);}return null;};}function patchUpdates(_0x697b6f){return function(_0x59db8f){try{jsonpatch[_0xfb19('0x32')](_0x59db8f,_0x697b6f,!![]);}catch(_0x389157){return BPromise[_0xfb19('0x33')](_0x389157);}return _0x59db8f[_0xfb19('0x34')]();};}function saveUpdates(_0xbac46b,_0x107394){return function(_0x4335d5){if(_0x4335d5){return _0x4335d5[_0xfb19('0x35')](_0xbac46b)[_0xfb19('0x20')](function(_0x233518){return _0x233518;});}return null;};}function removeEntity(_0xbd5d45,_0x5590f6){return function(_0x57af45){if(_0x57af45){return _0x57af45[_0xfb19('0x36')]()['then'](function(){var _0x3d1dbe=_0x57af45[_0xfb19('0x37')]({'plain':!![]});var _0x517164=_0xfb19('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x517164,'resourceId':_0x3d1dbe['id']}})[_0xfb19('0x20')](function(){return _0x57af45;});})[_0xfb19('0x20')](function(){_0xbd5d45[_0xfb19('0x2a')](0xcc)[_0xfb19('0x39')]();});}};}function handleEntityNotFound(_0x3f337e,_0x118e80){return function(_0x4d84c2){if(!_0x4d84c2){_0x3f337e[_0xfb19('0x3a')](0x194);}return _0x4d84c2;};}function handleError(_0x190078,_0x36cfb5){_0x36cfb5=_0x36cfb5||0x1f4;return function(_0x50cafe){logger[_0xfb19('0x25')](_0x50cafe['stack']);if(_0x50cafe['name']){delete _0x50cafe[_0xfb19('0x3b')];}_0x190078['status'](_0x36cfb5)[_0xfb19('0x3c')](_0x50cafe);};}exports['index']=function(_0x3620f5,_0x519f6f){var _0x5d1668={'include':[{'model':db[_0xfb19('0x3d')],'as':_0xfb19('0x3e')}]},_0x218f5a={},_0x5b65e3={'count':0x0,'rows':[]};var _0x597014=_[_0xfb19('0x3f')](db[_0xfb19('0x40')][_0xfb19('0x41')],function(_0x558321){return{'name':_0x558321['fieldName'],'type':_0x558321[_0xfb19('0x42')][_0xfb19('0x43')]};});_0x218f5a[_0xfb19('0x44')]=_[_0xfb19('0x3f')](_0x597014,_0xfb19('0x3b'));_0x218f5a['query']=_[_0xfb19('0x45')](_0x3620f5[_0xfb19('0x46')]);_0x218f5a['filters']=_[_0xfb19('0x47')](_0x218f5a['model'],_0x218f5a[_0xfb19('0x46')]);_0x5d1668[_0xfb19('0x48')]=_[_0xfb19('0x47')](_0x218f5a['model'],qs['fields'](_0x3620f5['query']['fields']));_0x5d1668[_0xfb19('0x48')]=_0x5d1668[_0xfb19('0x48')][_0xfb19('0x49')]?_0x5d1668[_0xfb19('0x48')]:_0x218f5a['model'];if(!_0x3620f5[_0xfb19('0x46')]['hasOwnProperty'](_0xfb19('0x4a'))){_0x5d1668[_0xfb19('0x2d')]=qs[_0xfb19('0x2d')](_0x3620f5[_0xfb19('0x46')][_0xfb19('0x2d')]);_0x5d1668[_0xfb19('0x2c')]=qs['offset'](_0x3620f5['query'][_0xfb19('0x2c')]);}_0x5d1668[_0xfb19('0x4b')]=qs[_0xfb19('0x4c')](_0x3620f5['query'][_0xfb19('0x4c')]);_0x5d1668['where']=qs[_0xfb19('0x4d')](_[_0xfb19('0x4e')](_0x3620f5['query'],_0x218f5a[_0xfb19('0x4d')]),_0x597014);if(_0x3620f5[_0xfb19('0x46')][_0xfb19('0x4f')]){_0x5d1668[_0xfb19('0x50')]=_[_0xfb19('0x51')](_0x5d1668[_0xfb19('0x50')],{'$or':_[_0xfb19('0x3f')](_0x597014,function(_0x537ddd){if(_0x537ddd[_0xfb19('0x42')]!=='VIRTUAL'){var _0x36c022={};_0x36c022[_0x537ddd['name']]={'$like':'%'+_0x3620f5[_0xfb19('0x46')][_0xfb19('0x4f')]+'%'};return _0x36c022;}})});}_0x5d1668=_[_0xfb19('0x51')]({},_0x5d1668,_0x3620f5[_0xfb19('0x52')]);var _0x1d3a1f={'where':_0x5d1668['where']};return db[_0xfb19('0x40')][_0xfb19('0x2f')](_0x1d3a1f)[_0xfb19('0x20')](function(_0x52c7fd){_0x5b65e3['count']=_0x52c7fd;if(_0x3620f5[_0xfb19('0x46')][_0xfb19('0x53')]){_0x5d1668[_0xfb19('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x5d1668);})[_0xfb19('0x20')](function(_0x58f38c){_0x5b65e3[_0xfb19('0x55')]=_0x58f38c;return _0x5b65e3;})[_0xfb19('0x20')](respondWithFilteredResult(_0x519f6f,_0x5d1668))['catch'](handleError(_0x519f6f,null));};exports['show']=function(_0x9a64db,_0x447e88){var _0x27d48d={'raw':![],'where':{'id':_0x9a64db[_0xfb19('0x56')]['id']},'include':[{'model':db[_0xfb19('0x3d')],'as':_0xfb19('0x3e')}]},_0x36cac5={};_0x36cac5['model']=_[_0xfb19('0x45')](db[_0xfb19('0x40')]['rawAttributes']);_0x36cac5[_0xfb19('0x46')]=_[_0xfb19('0x45')](_0x9a64db[_0xfb19('0x46')]);_0x36cac5[_0xfb19('0x4d')]=_['intersection'](_0x36cac5['model'],_0x36cac5[_0xfb19('0x46')]);_0x27d48d[_0xfb19('0x48')]=_[_0xfb19('0x47')](_0x36cac5[_0xfb19('0x44')],qs[_0xfb19('0x57')](_0x9a64db[_0xfb19('0x46')]['fields']));_0x27d48d['attributes']=_0x27d48d[_0xfb19('0x48')][_0xfb19('0x49')]?_0x27d48d[_0xfb19('0x48')]:_0x36cac5[_0xfb19('0x44')];if(_0x9a64db[_0xfb19('0x46')][_0xfb19('0x53')]){_0x27d48d[_0xfb19('0x54')]=[{'all':!![]}];}_0x27d48d=_[_0xfb19('0x51')]({},_0x27d48d,_0x9a64db[_0xfb19('0x52')]);return db[_0xfb19('0x40')]['find'](_0x27d48d)[_0xfb19('0x20')](handleEntityNotFound(_0x447e88,null))['then'](respondWithResult(_0x447e88,null))[_0xfb19('0x58')](handleError(_0x447e88,null));};exports[_0xfb19('0x59')]=function(_0x16650b,_0x1593b7){return db['OpenchannelAccount'][_0xfb19('0x59')](_0x16650b[_0xfb19('0x5a')],{})['then'](function(_0x5849fb){var _0x5f012f=_0x16650b[_0xfb19('0x5b')][_0xfb19('0x37')]({'plain':!![]});if(!_0x5f012f)throw new Error(_0xfb19('0x5c'));if(_0x5f012f['role']===_0xfb19('0x5b')){var _0x33b698=_0x5849fb['get']({'plain':!![]});var _0x1c2b9f=_0xfb19('0x38');return db['UserProfileSection'][_0xfb19('0x5d')]({'where':{'name':_0x1c2b9f,'userProfileId':_0x5f012f['userProfileId']},'raw':!![]})[_0xfb19('0x20')](function(_0x1d90df){if(_0x1d90df&&_0x1d90df[_0xfb19('0x5e')]===0x0){return db[_0xfb19('0x5f')][_0xfb19('0x59')]({'name':_0x33b698[_0xfb19('0x3b')],'resourceId':_0x33b698['id'],'type':_0x1d90df[_0xfb19('0x3b')],'sectionId':_0x1d90df['id']},{})[_0xfb19('0x20')](function(){return _0x5849fb;});}else{return _0x5849fb;}})[_0xfb19('0x58')](function(_0xb0a923){logger['error'](_0xfb19('0x60'),_0xb0a923);throw _0xb0a923;});}return _0x5849fb;})['then'](respondWithResult(_0x1593b7,0xc9))['catch'](handleError(_0x1593b7,null));};exports[_0xfb19('0x35')]=function(_0x23bbf0,_0x278674){if(_0x23bbf0[_0xfb19('0x5a')]['id']){delete _0x23bbf0[_0xfb19('0x5a')]['id'];}return db[_0xfb19('0x40')][_0xfb19('0x5d')]({'where':{'id':_0x23bbf0[_0xfb19('0x56')]['id']},'include':[{'model':db[_0xfb19('0x3d')],'as':_0xfb19('0x3e')}]})[_0xfb19('0x20')](handleEntityNotFound(_0x278674,null))['then'](saveUpdates(_0x23bbf0[_0xfb19('0x5a')],null))[_0xfb19('0x20')](respondWithResult(_0x278674,null))[_0xfb19('0x58')](handleError(_0x278674,null));};exports[_0xfb19('0x36')]=function(_0x48f7e0,_0x53a4ee){return db[_0xfb19('0x40')][_0xfb19('0x5d')]({'where':{'id':_0x48f7e0['params']['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x53a4ee,null))['then'](removeEntity(_0x53a4ee,null))['catch'](handleError(_0x53a4ee,null));};exports['describe']=function(_0x3878b3,_0x2ecb17){return db[_0xfb19('0x40')][_0xfb19('0x61')]()[_0xfb19('0x20')](respondWithResult(_0x2ecb17,null))[_0xfb19('0x58')](handleError(_0x2ecb17,null));};exports[_0xfb19('0x62')]=function(_0x56bd97,_0x4901ee,_0x5be39c){if(_0x56bd97[_0xfb19('0x5a')]['id']){delete _0x56bd97['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x56bd97[_0xfb19('0x56')]['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x4901ee,null))['then'](function(_0x3d701c){if(_0x3d701c){_0x56bd97['body'][_0xfb19('0x63')]=_0x3d701c['id'];return db[_0xfb19('0x64')][_0xfb19('0x59')](_0x56bd97[_0xfb19('0x5a')]);}})[_0xfb19('0x20')](respondWithResult(_0x4901ee,null))['catch'](handleError(_0x4901ee,null));};exports['getDispositions']=function(_0x3e7449,_0x31840c,_0x1e9eb3){var _0x414e86={'raw':![],'where':{}};var _0x27cbbc={};var _0x212b2c={'count':0x0,'rows':[]};return db[_0xfb19('0x40')][_0xfb19('0x65')]({'where':{'id':_0x3e7449['params']['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x31840c,null))[_0xfb19('0x20')](function(_0x4db66a){if(_0x4db66a){_0x27cbbc['model']=_[_0xfb19('0x45')](db[_0xfb19('0x64')][_0xfb19('0x41')]);_0x27cbbc[_0xfb19('0x46')]=_[_0xfb19('0x45')](_0x3e7449[_0xfb19('0x46')]);_0x27cbbc[_0xfb19('0x4d')]=_[_0xfb19('0x47')](_0x27cbbc[_0xfb19('0x44')],_0x27cbbc[_0xfb19('0x46')]);_0x414e86[_0xfb19('0x48')]=_[_0xfb19('0x47')](_0x27cbbc[_0xfb19('0x44')],qs[_0xfb19('0x57')](_0x3e7449[_0xfb19('0x46')][_0xfb19('0x57')]));_0x414e86[_0xfb19('0x48')]=_0x414e86[_0xfb19('0x48')]['length']?_0x414e86[_0xfb19('0x48')]:_0x27cbbc[_0xfb19('0x44')];if(!_0x3e7449[_0xfb19('0x46')][_0xfb19('0x66')](_0xfb19('0x4a'))){_0x414e86[_0xfb19('0x2d')]=qs['limit'](_0x3e7449[_0xfb19('0x46')][_0xfb19('0x2d')]);_0x414e86['offset']=qs[_0xfb19('0x2c')](_0x3e7449[_0xfb19('0x46')][_0xfb19('0x2c')]);}_0x414e86[_0xfb19('0x4b')]=qs[_0xfb19('0x4c')](_0x3e7449[_0xfb19('0x46')][_0xfb19('0x4c')]);_0x414e86['where']=qs['filters'](_[_0xfb19('0x4e')](_0x3e7449[_0xfb19('0x46')],_0x27cbbc[_0xfb19('0x4d')]));_0x414e86['where'][_0xfb19('0x63')]=_0x4db66a['id'];if(_0x3e7449[_0xfb19('0x46')][_0xfb19('0x4f')]){_0x414e86['where']=_['merge'](_0x414e86[_0xfb19('0x50')],{'$or':_['map'](_0x414e86[_0xfb19('0x48')],function(_0x466fe2){var _0x3da55b={};_0x3da55b[_0x466fe2]={'$like':'%'+_0x3e7449['query']['filter']+'%'};return _0x3da55b;})});}_0x414e86=_['merge']({},_0x414e86,_0x3e7449[_0xfb19('0x52')]);return db[_0xfb19('0x64')]['count']({'where':_0x414e86[_0xfb19('0x50')]})[_0xfb19('0x20')](function(_0x11762d){_0x212b2c[_0xfb19('0x2f')]=_0x11762d;if(_0x3e7449['query'][_0xfb19('0x53')]){_0x414e86[_0xfb19('0x54')]=[{'all':!![]}];}return db[_0xfb19('0x64')][_0xfb19('0x67')](_0x414e86);})[_0xfb19('0x20')](function(_0x4ded59){_0x212b2c[_0xfb19('0x55')]=_0x4ded59;return _0x212b2c;});}})[_0xfb19('0x20')](respondWithFilteredResult(_0x31840c,_0x414e86))['catch'](handleError(_0x31840c,null));};exports['removeDispositions']=function(_0x4c22a2,_0x1afcf8,_0x530468){return db['OpenchannelAccount'][_0xfb19('0x5d')]({'where':{'id':_0x4c22a2[_0xfb19('0x56')]['id']}})['then'](handleEntityNotFound(_0x1afcf8,null))[_0xfb19('0x20')](function(_0x545d16){if(_0x545d16){return _0x545d16[_0xfb19('0x68')](_0x4c22a2[_0xfb19('0x46')][_0xfb19('0x69')]);}})['then'](respondWithStatusCode(_0x1afcf8,null))['catch'](handleError(_0x1afcf8,null));};exports[_0xfb19('0x6a')]=function(_0x2db7ed,_0x32f69c,_0xd5e130){if(_0x2db7ed[_0xfb19('0x5a')]['id']){delete _0x2db7ed['body']['id'];}return db[_0xfb19('0x40')][_0xfb19('0x5d')]({'where':{'id':_0x2db7ed[_0xfb19('0x56')]['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x32f69c,null))[_0xfb19('0x20')](function(_0x376c4a){if(_0x376c4a){_0x2db7ed[_0xfb19('0x5a')][_0xfb19('0x63')]=_0x376c4a['id'];return db[_0xfb19('0x6b')][_0xfb19('0x59')](_0x2db7ed['body']);}})['then'](respondWithResult(_0x32f69c,null))[_0xfb19('0x58')](handleError(_0x32f69c,null));};exports['getAnswers']=function(_0x21ad82,_0x180d06,_0xac294b){var _0x204e88={'raw':![],'where':{}};var _0x1291b0={};var _0xf2974a={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xfb19('0x65')]({'where':{'id':_0x21ad82[_0xfb19('0x56')]['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x180d06,null))[_0xfb19('0x20')](function(_0x2aa611){if(_0x2aa611){_0x1291b0[_0xfb19('0x44')]=_[_0xfb19('0x45')](db[_0xfb19('0x6b')][_0xfb19('0x41')]);_0x1291b0[_0xfb19('0x46')]=_['keys'](_0x21ad82['query']);_0x1291b0['filters']=_['intersection'](_0x1291b0[_0xfb19('0x44')],_0x1291b0['query']);_0x204e88[_0xfb19('0x48')]=_[_0xfb19('0x47')](_0x1291b0['model'],qs[_0xfb19('0x57')](_0x21ad82[_0xfb19('0x46')][_0xfb19('0x57')]));_0x204e88[_0xfb19('0x48')]=_0x204e88['attributes'][_0xfb19('0x49')]?_0x204e88[_0xfb19('0x48')]:_0x1291b0[_0xfb19('0x44')];if(!_0x21ad82[_0xfb19('0x46')]['hasOwnProperty']('nolimit')){_0x204e88[_0xfb19('0x2d')]=qs[_0xfb19('0x2d')](_0x21ad82[_0xfb19('0x46')]['limit']);_0x204e88[_0xfb19('0x2c')]=qs[_0xfb19('0x2c')](_0x21ad82[_0xfb19('0x46')][_0xfb19('0x2c')]);}_0x204e88[_0xfb19('0x4b')]=qs[_0xfb19('0x4c')](_0x21ad82[_0xfb19('0x46')][_0xfb19('0x4c')]);_0x204e88['where']=qs[_0xfb19('0x4d')](_[_0xfb19('0x4e')](_0x21ad82['query'],_0x1291b0[_0xfb19('0x4d')]));_0x204e88[_0xfb19('0x50')][_0xfb19('0x63')]=_0x2aa611['id'];if(_0x21ad82[_0xfb19('0x46')]['filter']){_0x204e88[_0xfb19('0x50')]=_[_0xfb19('0x51')](_0x204e88[_0xfb19('0x50')],{'$or':_[_0xfb19('0x3f')](_0x204e88['attributes'],function(_0x5e54ac){var _0x36514d={};_0x36514d[_0x5e54ac]={'$like':'%'+_0x21ad82[_0xfb19('0x46')][_0xfb19('0x4f')]+'%'};return _0x36514d;})});}_0x204e88=_[_0xfb19('0x51')]({},_0x204e88,_0x21ad82[_0xfb19('0x52')]);return db[_0xfb19('0x6b')][_0xfb19('0x2f')]({'where':_0x204e88[_0xfb19('0x50')]})[_0xfb19('0x20')](function(_0xa9c551){_0xf2974a[_0xfb19('0x2f')]=_0xa9c551;if(_0x21ad82['query'][_0xfb19('0x53')]){_0x204e88[_0xfb19('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0xfb19('0x67')](_0x204e88);})[_0xfb19('0x20')](function(_0x2ffc59){_0xf2974a[_0xfb19('0x55')]=_0x2ffc59;return _0xf2974a;});}})[_0xfb19('0x20')](respondWithFilteredResult(_0x180d06,_0x204e88))[_0xfb19('0x58')](handleError(_0x180d06,null));};exports[_0xfb19('0x6c')]=function(_0x149b0d,_0x27d63f,_0x30b5be){return db[_0xfb19('0x40')][_0xfb19('0x5d')]({'where':{'id':_0x149b0d[_0xfb19('0x56')]['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x27d63f,null))[_0xfb19('0x20')](function(_0x21a9fa){if(_0x21a9fa){return _0x21a9fa[_0xfb19('0x6c')](_0x149b0d[_0xfb19('0x46')]['ids']);}})[_0xfb19('0x20')](respondWithStatusCode(_0x27d63f,null))[_0xfb19('0x58')](handleError(_0x27d63f,null));};exports[_0xfb19('0x6d')]=function(_0x3b5490,_0x38f8ae,_0x2e1746){var _0x445e3c={'body':_0x3b5490[_0xfb19('0x5a')],'channel':_0xfb19('0x6e')};var _0x10f3f1=[];var _0x2a0a6c=[];var _0x2933d6={};var _0x4e2ff6=![];return db[_0xfb19('0x6f')][_0xfb19('0x61')]()[_0xfb19('0x20')](function(_0x3c54be){if(!_0x3c54be){throw new db[(_0xfb19('0x70'))][(_0xfb19('0x71'))](_0xfb19('0x72'));}_0x10f3f1=_['difference'](_['keys'](_0x3c54be),[_0xfb19('0x73'),_0xfb19('0x74')]);_0x2a0a6c=_[_0xfb19('0x75')](_['keys'](_0x3c54be),['createdAt',_0xfb19('0x74'),_0xfb19('0x76'),_0xfb19('0x77')]);if(_0x3b5490[_0xfb19('0x5a')]['id']){delete _0x3b5490['body']['id'];}if(_[_0xfb19('0x78')](_0x3b5490['body'][_0xfb19('0x79')])){throw new db[(_0xfb19('0x70'))]['ValidationError'](_0xfb19('0x7a'));}if(_['isNil'](_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x5a')])||_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x5a')]===''){throw new db[(_0xfb19('0x70'))][(_0xfb19('0x71'))](_0xfb19('0x7b'));}if(_['isNil'](_0x3b5490['body']['mapKey'])){throw new db[(_0xfb19('0x70'))][(_0xfb19('0x71'))](_0xfb19('0x7c')+_0x2a0a6c);}if(!_[_0xfb19('0x7d')](_0x2a0a6c,_0x3b5490['body'][_0xfb19('0x7e')])){throw new db['Sequelize'][(_0xfb19('0x71'))](_0xfb19('0x7f')+_0x2a0a6c);}_0x2933d6[_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x7e')]]=_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x79')];})[_0xfb19('0x20')](function(){return db[_0xfb19('0x40')][_0xfb19('0x5d')]({'where':{'id':_0x3b5490['params']['id']},'include':[{'model':db[_0xfb19('0x80')],'as':_0xfb19('0x81'),'include':[{'model':db['CmContact'],'as':_0xfb19('0x82'),'where':_0x2933d6,'limit':0x1,'order':[[_0xfb19('0x74'),_0xfb19('0x83')]]}]},{'model':db['OpenchannelApplication'],'as':_0xfb19('0x84')}]});})[_0xfb19('0x20')](handleEntityNotFound(_0x38f8ae,null))['then'](function(_0x53eaee){if(_0x53eaee&&_0x53eaee['List']){_0x445e3c[_0xfb19('0x85')]=_0x53eaee;_0x445e3c[_0xfb19('0x86')]=_0x53eaee[_0xfb19('0x84')];_0x445e3c[_0xfb19('0x87')]=_0x53eaee['List'];_0x445e3c['applications']=_[_0xfb19('0x88')](_0x445e3c[_0xfb19('0x86')],[_0xfb19('0x89')],['asc']);if(_0x445e3c[_0xfb19('0x85')][_0xfb19('0x84')]){delete _0x445e3c[_0xfb19('0x85')]['Applications'];}if(_0x445e3c[_0xfb19('0x85')]['List']&&_0x445e3c[_0xfb19('0x85')][_0xfb19('0x81')][_0xfb19('0x82')][_0xfb19('0x49')]){return _0x445e3c[_0xfb19('0x85')]['List'][_0xfb19('0x82')][0x0];}var _0x50a13c=_[_0xfb19('0x18')](_0x3b5490['body'],{'firstName':_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x79')],'ListId':_0x53eaee[_0xfb19('0x77')]});_0x50a13c[_0x3b5490['body'][_0xfb19('0x7e')]]=_0x3b5490[_0xfb19('0x5a')]['from'];return db[_0xfb19('0x6f')][_0xfb19('0x59')](_0x50a13c,{'fields':_0x10f3f1,'raw':!![]});}})['then'](handleEntityNotFound(_0x38f8ae,null))['then'](function(_0x514208){_0x445e3c[_0xfb19('0x8a')]=_0x514208;if(_0x514208){var _0x27689f={'ContactId':_0x514208['id'],'OpenchannelAccountId':_0x3b5490[_0xfb19('0x56')]['id'],'from':(_0x514208[_0xfb19('0x8b')]||'')+'\x20'+(_0x514208['lastName']||'')};var _0x5d1b21={'OpenchannelAccountId':_0x3b5490[_0xfb19('0x56')]['id'],'closed':![]};if(_0x3b5490['body'][_0xfb19('0x8c')]){_0x5d1b21[_0xfb19('0x8c')]=_0x3b5490[_0xfb19('0x5a')]['threadId'];return db[_0xfb19('0x8d')][_0xfb19('0x5d')]({'where':_0x5d1b21})['then'](function(_0x7b3042){if(_0x7b3042){return[_0x7b3042,![]];}_0x27689f['threadId']=_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x8c')];_0x27689f[_0xfb19('0x8e')]=_0x3b5490['body'][_0xfb19('0x8e')];return db[_0xfb19('0x8d')][_0xfb19('0x59')](_0x27689f)[_0xfb19('0x20')](function(_0x311a21){return[_0x311a21,!![]];});});}else{_0x5d1b21[_0xfb19('0x8c')]=null;}_0x5d1b21[_0xfb19('0x8f')]=_0x514208['id'];return db['OpenchannelInteraction'][_0xfb19('0x5d')]({'where':_0x5d1b21})[_0xfb19('0x20')](function(_0x264308){if(_0x264308){return[_0x264308,![]];}return db['OpenchannelInteraction'][_0xfb19('0x59')](_0x27689f)[_0xfb19('0x20')](function(_0x4f1c27){return[_0x4f1c27,!![]];});});}})[_0xfb19('0x90')](function(_0x5c78c8,_0x714e06){if(_0x5c78c8){_0x4e2ff6=_0x714e06;if(!_0x714e06){var _0x110fbb={'from':(_0x445e3c[_0xfb19('0x8a')][_0xfb19('0x8b')]||'')+'\x20'+(_0x445e3c['contact']['lastName']||'')};if(_0x3b5490['body'][_0xfb19('0x8c')]&&_0x3b5490['body']['messageId']&&_0x3b5490['body']['threadId']!=_0x3b5490[_0xfb19('0x5a')]['messageId']){_0x110fbb[_0xfb19('0x8c')]=_0x3b5490['body'][_0xfb19('0x91')];}return _0x5c78c8[_0xfb19('0x35')](_0x110fbb);}else{return _0x5c78c8;}}})[_0xfb19('0x20')](function(_0x121ff4){_0x445e3c[_0xfb19('0x92')]=_0x121ff4[_0xfb19('0x37')]({'plain':!![]});_0x445e3c[_0xfb19('0x92')][_0xfb19('0x93')]=_0x4e2ff6;if(_0x445e3c[_0xfb19('0x92')][_0xfb19('0x93')]){if(_0x445e3c[_0xfb19('0x85')][_0xfb19('0x94')]){_0x445e3c[_0xfb19('0x86')][_0xfb19('0x95')]({'id':0x0,'priority':_0x445e3c['applications'][_0xfb19('0x49')]+0x1,'app':'close','appdata':_0xfb19('0x96'),'interval':_0xfb19('0x97')});}}return db[_0xfb19('0x98')]['create']({'body':_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x5a')],'OpenchannelAccountId':_0x3b5490[_0xfb19('0x56')]['id'],'OpenchannelInteractionId':_0x121ff4['id'],'direction':'in','ContactId':_0x445e3c['contact']['id'],'AttachmentId':_0x3b5490[_0xfb19('0x5a')][_0xfb19('0x99')]});})['then'](function(_0x4d6f84){_0x445e3c[_0xfb19('0x27')]=_0x4d6f84;if(_0x445e3c['interaction'][_0xfb19('0x9a')]){return db[_0xfb19('0x9b')][_0xfb19('0x5d')]({'attributes':['id',_0xfb19('0x3b')],'where':{'id':_0x445e3c[_0xfb19('0x92')][_0xfb19('0x9a')]}})[_0xfb19('0x20')](function(_0x5c0507){if(_0x5c0507){_0x445e3c['applications'][_0xfb19('0x9c')]({'id':0x0,'priority':0x0,'app':_0xfb19('0x9d'),'appdata':_0x5c0507['name']+','+(_0x445e3c[_0xfb19('0x85')][_0xfb19('0x9e')]||0xa),'interval':_0xfb19('0x97')});_0x445e3c[_0xfb19('0x9f')]=![];}return respondWithRpcPromise(_0xfb19('0xa0'),_0xfb19('0xa1'),_0x445e3c);});}return respondWithRpcPromise(_0xfb19('0xa0'),_0xfb19('0xa1'),_0x445e3c);})['then'](function(_0x182272){respondWithRpcPromise('EventManager','EventManager',{'event':_0xfb19('0x6d'),'message':_0x182272},client9002);return _0x182272;})[_0xfb19('0x20')](respondWithResult(_0x38f8ae,null))['catch'](handleError(_0x38f8ae,null));};exports[_0xfb19('0xa2')]=function(_0x1f1cba,_0x108fc9){var _0x13d954=_0x1f1cba[_0xfb19('0x56')]['id'];var _0x30280b=_0x1f1cba['body'];var _0x29f7a5=0xc8;var _0x4f080e=null;return db[_0xfb19('0xa3')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0xfb19('0xa4')]['READ_COMMITTED']},function(_0x573223){return db[_0xfb19('0x40')][_0xfb19('0x65')]({'where':{'id':_0x13d954},'transaction':_0x573223})[_0xfb19('0x20')](function(_0x3e4a22){if(_0x3e4a22){return db[_0xfb19('0xa5')][_0xfb19('0x36')]({'where':{'OpenchannelAccountId':_0x13d954},'transaction':_0x573223})[_0xfb19('0x20')](function(){var _0x23ace6=_[_0xfb19('0x3f')](_0x30280b,function(_0x2f3670){_0x2f3670[_0xfb19('0x63')]=_0x13d954;return _0x2f3670;});return db['OpenchannelApplication'][_0xfb19('0xa6')](_0x23ace6,{'transaction':_0x573223});});}else{_0x29f7a5=0x194;_0x4f080e=[];}});})[_0xfb19('0x20')](function(){if(_0x29f7a5!==0x194){return db[_0xfb19('0xa5')][_0xfb19('0xa7')]({'where':{'OpenchannelAccountId':_0x13d954},'order':_0xfb19('0x89')})[_0xfb19('0x20')](function(_0x1f83fd){_0x4f080e=_0x1f83fd;});}})[_0xfb19('0x58')](function(_0x38896d){_0x29f7a5=0x1f4;logger[_0xfb19('0x25')](_0x38896d[_0xfb19('0xa8')]);if(_0x38896d[_0xfb19('0x3b')]){delete _0x38896d[_0xfb19('0x3b')];}_0x4f080e=_0x38896d;})['finally'](function(){if(_0x4f080e===null){_0x108fc9['sendStatus'](_0x29f7a5);}else{if(_0x29f7a5===0x1f4){_0x108fc9['status'](_0x29f7a5)[_0xfb19('0x3c')](_0x4f080e);}else{_0x108fc9[_0xfb19('0x2a')](_0x29f7a5)[_0xfb19('0x2b')](_0x4f080e);}}});};exports[_0xfb19('0xa9')]=function(_0x51991,_0x37368d,_0x36905e){var _0x393eba={};var _0x3bb708={};var _0x38943f;var _0x2ec7eb;return db[_0xfb19('0x40')][_0xfb19('0x65')]({'where':{'id':_0x51991[_0xfb19('0x56')]['id']}})['then'](handleEntityNotFound(_0x37368d,null))[_0xfb19('0x20')](function(_0x17c392){if(_0x17c392){_0x38943f=_0x17c392;_0x3bb708[_0xfb19('0x44')]=_[_0xfb19('0x45')](db['OpenchannelApplication'][_0xfb19('0x41')]);_0x3bb708[_0xfb19('0x46')]=_[_0xfb19('0x45')](_0x51991[_0xfb19('0x46')]);_0x3bb708[_0xfb19('0x4d')]=_[_0xfb19('0x47')](_0x3bb708[_0xfb19('0x44')],_0x3bb708[_0xfb19('0x46')]);_0x393eba[_0xfb19('0x48')]=_[_0xfb19('0x47')](_0x3bb708[_0xfb19('0x44')],qs['fields'](_0x51991[_0xfb19('0x46')]['fields']));_0x393eba[_0xfb19('0x48')]=_0x393eba[_0xfb19('0x48')][_0xfb19('0x49')]?_0x393eba[_0xfb19('0x48')]:_0x3bb708[_0xfb19('0x44')];_0x393eba[_0xfb19('0x4b')]=qs['sort'](_0x51991['query'][_0xfb19('0x4c')]);_0x393eba[_0xfb19('0x50')]=qs['filters'](_['pick'](_0x51991['query'],_0x3bb708['filters']));if(_0x51991['query'][_0xfb19('0x4f')]){_0x393eba['where']=_['merge'](_0x393eba['where'],{'$or':_[_0xfb19('0x3f')](_0x393eba[_0xfb19('0x48')],function(_0x221d97){var _0x44ebb8={};_0x44ebb8[_0x221d97]={'$like':'%'+_0x51991[_0xfb19('0x46')][_0xfb19('0x4f')]+'%'};return _0x44ebb8;})});}_0x393eba=_[_0xfb19('0x51')]({},_0x393eba,_0x51991['options']);return _0x38943f['getApplications'](_0x393eba);}})['then'](function(_0x4a8b4f){if(_0x4a8b4f){_0x2ec7eb=_0x4a8b4f['length'];if(!_0x51991[_0xfb19('0x46')][_0xfb19('0x66')](_0xfb19('0x4a'))){_0x393eba[_0xfb19('0x2d')]=qs[_0xfb19('0x2d')](_0x51991[_0xfb19('0x46')][_0xfb19('0x2d')]);_0x393eba[_0xfb19('0x2c')]=qs[_0xfb19('0x2c')](_0x51991[_0xfb19('0x46')][_0xfb19('0x2c')]);}return _0x38943f[_0xfb19('0xa9')](_0x393eba);}})['then'](function(_0x3a2a83){if(_0x3a2a83){return _0x3a2a83?{'count':_0x2ec7eb,'rows':_0x3a2a83}:null;}})[_0xfb19('0x20')](respondWithResult(_0x37368d,null))[_0xfb19('0x58')](handleError(_0x37368d,null));};exports['getInteractions']=function(_0x421c89,_0x3131bd,_0x1f889f){var _0x52be19={'raw':![],'where':{}};var _0x4bab23={};var _0x447fca={'count':0x0,'rows':[]};return db[_0xfb19('0x40')][_0xfb19('0x65')]({'where':{'id':_0x421c89[_0xfb19('0x56')]['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x3131bd,null))[_0xfb19('0x20')](function(_0x247ab1){if(_0x247ab1){_0x4bab23[_0xfb19('0x44')]=_[_0xfb19('0x45')](db[_0xfb19('0x8d')][_0xfb19('0x41')]);_0x4bab23[_0xfb19('0x46')]=_[_0xfb19('0x45')](_0x421c89[_0xfb19('0x46')]);_0x4bab23[_0xfb19('0x4d')]=_[_0xfb19('0x47')](_0x4bab23[_0xfb19('0x44')],_0x4bab23[_0xfb19('0x46')]);_0x52be19[_0xfb19('0x48')]=_[_0xfb19('0x47')](_0x4bab23[_0xfb19('0x44')],qs[_0xfb19('0x57')](_0x421c89[_0xfb19('0x46')]['fields']));_0x52be19[_0xfb19('0x48')]=_0x52be19['attributes'][_0xfb19('0x49')]?_0x52be19['attributes']:_0x4bab23[_0xfb19('0x44')];if(!_0x421c89['query'][_0xfb19('0x66')](_0xfb19('0x4a'))){_0x52be19[_0xfb19('0x2d')]=qs[_0xfb19('0x2d')](_0x421c89[_0xfb19('0x46')][_0xfb19('0x2d')]);_0x52be19['offset']=qs[_0xfb19('0x2c')](_0x421c89[_0xfb19('0x46')]['offset']);}_0x52be19[_0xfb19('0x4b')]=qs['sort'](_0x421c89[_0xfb19('0x46')][_0xfb19('0x4c')]);_0x52be19['where']=qs['filters'](_[_0xfb19('0x4e')](_0x421c89[_0xfb19('0x46')],_0x4bab23[_0xfb19('0x4d')]));_0x52be19['where'][_0xfb19('0x63')]=_0x247ab1['id'];if(_0x421c89[_0xfb19('0x46')]['filter']){_0x52be19[_0xfb19('0x50')]=_['merge'](_0x52be19['where'],{'$or':_['map'](_0x52be19[_0xfb19('0x48')],function(_0x44fa92){var _0x55c614={};_0x55c614[_0x44fa92]={'$like':'%'+_0x421c89[_0xfb19('0x46')][_0xfb19('0x4f')]+'%'};return _0x55c614;})});}_0x52be19=_[_0xfb19('0x51')]({},_0x52be19,_0x421c89['options']);return db[_0xfb19('0x8d')][_0xfb19('0x2f')]({'where':_0x52be19['where']})['then'](function(_0x21cff2){_0x447fca[_0xfb19('0x2f')]=_0x21cff2;if(_0x421c89[_0xfb19('0x46')][_0xfb19('0x53')]){_0x52be19[_0xfb19('0x54')]=[{'model':db[_0xfb19('0x6f')],'as':'Contact','required':![]},{'model':db[_0xfb19('0x9b')],'as':_0xfb19('0xaa'),'attributes':[_0xfb19('0x3b'),'fullname',_0xfb19('0xab')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0x421c89[_0xfb19('0x46')][_0xfb19('0xac')]?{'id':_0x421c89[_0xfb19('0x46')]['tag']}:undefined,'required':_0x421c89[_0xfb19('0x46')]['tag']?!![]:![]}];}return db[_0xfb19('0x8d')]['findAll'](_0x52be19);})['then'](function(_0x27fded){_0x447fca[_0xfb19('0x55')]=_0x27fded;return _0x447fca;});}})[_0xfb19('0x20')](respondWithFilteredResult(_0x3131bd,_0x52be19))[_0xfb19('0x58')](handleError(_0x3131bd,null));};exports[_0xfb19('0xad')]=function(_0x5df668,_0x27a04b,_0xa63c54){return db[_0xfb19('0x40')][_0xfb19('0x5d')]({'where':{'id':_0x5df668[_0xfb19('0x56')]['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x27a04b,null))[_0xfb19('0x20')](function(_0x4a1728){if(_0x4a1728){return _0x4a1728[_0xfb19('0xad')](_0x5df668[_0xfb19('0x5a')][_0xfb19('0x69')],_['omit'](_0x5df668[_0xfb19('0x5a')],[_0xfb19('0x69'),'id'])||{})['spread'](function(_0x5336e1){for(var _0x56aef5=0x0;_0x56aef5<_0x5df668[_0xfb19('0x5a')]['ids'][_0xfb19('0x49')];_0x56aef5+=0x1){socket[_0xfb19('0xae')](_0xfb19('0xaf'),{'UserId':Number(_0x5df668[_0xfb19('0x5a')][_0xfb19('0x69')][_0x56aef5]),'OpenchannelAccountId':Number(_0x5df668[_0xfb19('0x56')]['id'])});}return _0x5336e1;});}})[_0xfb19('0x20')](respondWithResult(_0x27a04b,null))[_0xfb19('0x58')](handleError(_0x27a04b,null));};exports[_0xfb19('0xb0')]=function(_0x35bdae,_0x1bc07f,_0xf884ff){return db[_0xfb19('0x40')][_0xfb19('0x5d')]({'where':{'id':_0x35bdae[_0xfb19('0x56')]['id']}})['then'](handleEntityNotFound(_0x1bc07f,null))['then'](function(_0x2d73eb){if(_0x2d73eb){return _0x2d73eb[_0xfb19('0xb0')](_0x35bdae[_0xfb19('0x46')][_0xfb19('0x69')])[_0xfb19('0x20')](function(){if(_[_0xfb19('0xb1')](_0x35bdae[_0xfb19('0x46')][_0xfb19('0x69')])){for(var _0x4fba79=0x0;_0x4fba79<_0x35bdae['query'][_0xfb19('0x69')][_0xfb19('0x49')];_0x4fba79+=0x1){socket[_0xfb19('0xae')]('userOpenchannelAccount:remove',{'UserId':Number(_0x35bdae['query'][_0xfb19('0x69')][_0x4fba79]),'OpenchannelAccountId':Number(_0x35bdae[_0xfb19('0x56')]['id'])});}}else{socket[_0xfb19('0xae')](_0xfb19('0xb2'),{'UserId':Number(_0x35bdae[_0xfb19('0x46')][_0xfb19('0x69')]),'OpenchannelAccountId':Number(_0x35bdae['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1bc07f,null))[_0xfb19('0x58')](handleError(_0x1bc07f,null));};exports[_0xfb19('0xb3')]=function(_0x5a38d3,_0x58724f,_0x13d3e5){var _0xac7ed7={};var _0x9fb537={};var _0x1f1355;var _0x4b4cde;return db[_0xfb19('0x40')][_0xfb19('0x65')]({'where':{'id':_0x5a38d3[_0xfb19('0x56')]['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x58724f,null))[_0xfb19('0x20')](function(_0x592f53){if(_0x592f53){_0x1f1355=_0x592f53;_0x9fb537[_0xfb19('0x44')]=_[_0xfb19('0x45')](db[_0xfb19('0x9b')][_0xfb19('0x41')]);_0x9fb537[_0xfb19('0x46')]=_[_0xfb19('0x45')](_0x5a38d3[_0xfb19('0x46')]);_0x9fb537[_0xfb19('0x4d')]=_[_0xfb19('0x47')](_0x9fb537['model'],_0x9fb537[_0xfb19('0x46')]);_0xac7ed7[_0xfb19('0x48')]=_['intersection'](_0x9fb537[_0xfb19('0x44')],qs[_0xfb19('0x57')](_0x5a38d3[_0xfb19('0x46')][_0xfb19('0x57')]));_0xac7ed7[_0xfb19('0x48')]=_0xac7ed7[_0xfb19('0x48')]['length']?_0xac7ed7['attributes']:_0x9fb537[_0xfb19('0x44')];_0xac7ed7[_0xfb19('0x4b')]=qs[_0xfb19('0x4c')](_0x5a38d3[_0xfb19('0x46')][_0xfb19('0x4c')]);_0xac7ed7[_0xfb19('0x50')]=qs[_0xfb19('0x4d')](_[_0xfb19('0x4e')](_0x5a38d3['query'],_0x9fb537[_0xfb19('0x4d')]));if(_0x5a38d3[_0xfb19('0x46')][_0xfb19('0x4f')]){_0xac7ed7[_0xfb19('0x50')]=_[_0xfb19('0x51')](_0xac7ed7['where'],{'$or':_['map'](_0xac7ed7['attributes'],function(_0x2ad1d5){var _0x4ce38f={};_0x4ce38f[_0x2ad1d5]={'$like':'%'+_0x5a38d3[_0xfb19('0x46')]['filter']+'%'};return _0x4ce38f;})});}_0xac7ed7=_[_0xfb19('0x51')]({},_0xac7ed7,_0x5a38d3['options']);return _0x1f1355[_0xfb19('0xb3')](_0xac7ed7);}})[_0xfb19('0x20')](function(_0x3ec321){if(_0x3ec321){_0x4b4cde=_0x3ec321[_0xfb19('0x49')];if(!_0x5a38d3[_0xfb19('0x46')]['hasOwnProperty'](_0xfb19('0x4a'))){_0xac7ed7[_0xfb19('0x2d')]=qs[_0xfb19('0x2d')](_0x5a38d3[_0xfb19('0x46')][_0xfb19('0x2d')]);_0xac7ed7[_0xfb19('0x2c')]=qs['offset'](_0x5a38d3['query'][_0xfb19('0x2c')]);}return _0x1f1355[_0xfb19('0xb3')](_0xac7ed7);}})['then'](function(_0x548d9f){if(_0x548d9f){return _0x548d9f?{'count':_0x4b4cde,'rows':_0x548d9f}:null;}})['then'](respondWithResult(_0x58724f,null))['catch'](handleError(_0x58724f,null));};exports['send']=function(_0x43a8c5,_0x208792,_0x4c7968){var _0x8054d6,_0x4efdbe,_0xf4f99f;if(_[_0xfb19('0x78')](_0x43a8c5[_0xfb19('0x5a')][_0xfb19('0x5a')])||_0x43a8c5[_0xfb19('0x5a')]['body']===''){throw new db[(_0xfb19('0x70'))][(_0xfb19('0x71'))](_0xfb19('0x7b'));}if(_[_0xfb19('0x78')](_0x43a8c5[_0xfb19('0x5a')]['to'])){}_0x8054d6=_0x43a8c5[_0xfb19('0x5a')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x43a8c5['params']['id']}})[_0xfb19('0x20')](handleEntityNotFound(_0x208792,null))['then'](function(_0x524d83){if(_0x524d83){return db['OpenchannelAccount'][_0xfb19('0x5d')]({'where':{'id':_0x524d83['id']},'include':[{'model':db[_0xfb19('0x80')],'as':_0xfb19('0x81'),'include':[{'model':db['CmContact'],'as':_0xfb19('0x82'),'where':{[_0x524d83[_0xfb19('0x7e')]]:_0x8054d6},'limit':0x1,'order':[[_0xfb19('0x74'),_0xfb19('0x83')]]}]}]})[_0xfb19('0x20')](handleEntityNotFound(_0x208792,null))[_0xfb19('0x20')](function(_0x16e983){if(_0x16e983&&_0x16e983[_0xfb19('0x81')]){_0x4efdbe=_0x16e983[_0xfb19('0x37')]({'plain':!![]});if(_0x4efdbe[_0xfb19('0x81')]&&_0x4efdbe['List'][_0xfb19('0x82')]['length']){return _0x4efdbe[_0xfb19('0x81')][_0xfb19('0x82')][0x0];}return db[_0xfb19('0x6f')][_0xfb19('0x59')](_['defaults'](_0x43a8c5[_0xfb19('0x5a')],{'firstName':_0x8054d6,[_0x16e983[_0xfb19('0x7e')]]:_0x8054d6,'phone':_0x8054d6,'ListId':_0x4efdbe[_0xfb19('0x77')]}));}})[_0xfb19('0x20')](handleEntityNotFound(_0x208792,null))['then'](function(_0x5d4f74){if(_0x5d4f74){_0xf4f99f=_0x5d4f74;return db[_0xfb19('0x8d')][_0xfb19('0x5d')]({'where':{'ContactId':_0xf4f99f['id'],'closed':![],'OpenchannelAccountId':_0x4efdbe['id']}})[_0xfb19('0x20')](function(_0x2abe28){if(_0x2abe28){return[_0x2abe28,![]];}return db[_0xfb19('0x8d')][_0xfb19('0x59')]({'UserId':_0x43a8c5[_0xfb19('0x5b')]['id'],'ContactId':_0xf4f99f['id'],'OpenchannelAccountId':_0x4efdbe['id'],'lastMsgDirection':'out','firstMsgDirection':_0xfb19('0xb4'),'Messages':[_['merge'](_0x43a8c5[_0xfb19('0x5a')],{'read':![],'body':_0x43a8c5[_0xfb19('0x5a')][_0xfb19('0x5a')],'OpenchannelAccountId':_0x4efdbe['id'],'UserId':_0x43a8c5['user']['id'],'ContactId':_0xf4f99f['id']})]},{'include':[{'model':db[_0xfb19('0x98')],'as':'Messages'}]})[_0xfb19('0x20')](function(_0x4c2b33){return[_0x4c2b33,!![]];});});}})[_0xfb19('0x90')](function(_0x3fe5ee,_0x9a1add){if(_0x9a1add){return _0x3fe5ee;}return db[_0xfb19('0x98')]['create'](_[_0xfb19('0x51')](_0x43a8c5[_0xfb19('0x5a')],{'read':![],'body':_0x43a8c5[_0xfb19('0x5a')][_0xfb19('0x5a')],'OpenchannelAccountId':_0x4efdbe['id'],'OpenchannelInteractionId':_0x3fe5ee['id'],'UserId':_0x43a8c5[_0xfb19('0x5b')]['id'],'ContactId':_0xf4f99f['id']}))[_0xfb19('0x20')](function(_0x17c607){_0x3fe5ee[_0xfb19('0xb5')]['Messages']=[];_0x3fe5ee[_0xfb19('0xb5')][_0xfb19('0xb6')][_0xfb19('0x95')](_0x17c607['dataValues']);return _0x3fe5ee;});});}})[_0xfb19('0x20')](respondWithResult(_0x208792,null))['catch'](handleError(_0x208792,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b91ef87..e4efae8 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 _0x153f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount'];(function(_0x2cb5d3,_0x3f6213){var _0x325368=function(_0x303417){while(--_0x303417){_0x2cb5d3['push'](_0x2cb5d3['shift']());}};_0x325368(++_0x3f6213);}(_0x153f,0x15b));var _0xf153=function(_0x42b00c,_0x27fb71){_0x42b00c=_0x42b00c-0x0;var _0x341013=_0x153f[_0x42b00c];return _0x341013;};'use strict';var EventEmitter=require(_0xf153('0x0'));var OpenchannelAccount=require(_0xf153('0x1'))['db'][_0xf153('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf153('0x3')](0x0);var events={'afterCreate':_0xf153('0x4'),'afterUpdate':_0xf153('0x5'),'afterDestroy':_0xf153('0x6')};function emitEvent(_0x59757c){return function(_0x364e65,_0x5c49c7,_0x1f9ead){OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c+':'+_0x364e65['id'],_0x364e65);OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c,_0x364e65);_0x1f9ead(null);};}for(var e in events){if(events[_0xf153('0x8')](e)){var event=events[e];OpenchannelAccount[_0xf153('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x6e6c=['../../mysqldb','setMaxListeners','save','emit','hook','exports','events'];(function(_0x486536,_0x5116a4){var _0x2d1a0c=function(_0x4b188c){while(--_0x4b188c){_0x486536['push'](_0x486536['shift']());}};_0x2d1a0c(++_0x5116a4);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0xc6e6('0x0'));var OpenchannelAccount=require(_0xc6e6('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xc6e6('0x2')](0x0);var events={'afterCreate':_0xc6e6('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e97f5){return function(_0x5a9e2b,_0x40b7e1,_0x4b13f0){OpenchannelAccountEvents[_0xc6e6('0x4')](_0x2e97f5+':'+_0x5a9e2b['id'],_0x5a9e2b);OpenchannelAccountEvents[_0xc6e6('0x4')](_0x2e97f5,_0x5a9e2b);_0x4b13f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xc6e6('0x5')](e,emitEvent(event));}}module[_0xc6e6('0x6')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 2335fad..051bf8b 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(_0x15ec11,_0x569c5d){var _0x27f5e7=function(_0x3d72e8){while(--_0x3d72e8){_0x15ec11['push'](_0x15ec11['shift']());}};_0x27f5e7(++_0x569c5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x24d107,_0x3b09dd){var _0x308060=function(_0x51a111){while(--_0x51a111){_0x24d107['push'](_0x24d107['shift']());}};_0x308060(++_0x3b09dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 af44177..eb72ecb 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 _0x98e5=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x2e7f25,_0x152535){var _0x193a96=function(_0x828183){while(--_0x828183){_0x2e7f25['push'](_0x2e7f25['shift']());}};_0x193a96(++_0x152535);}(_0x98e5,0x8a));var _0x598e=function(_0x7085dc,_0x5e16de){_0x7085dc=_0x7085dc-0x0;var _0x5b9862=_0x98e5[_0x7085dc];return _0x5b9862;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x598e('0x0'));var rs=require(_0x598e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x598e('0x2'))['db'];var utils=require(_0x598e('0x3'));var logger=require('../../config/logger')(_0x598e('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x598e('0x5')]['http']({'port':0x232a});config[_0x598e('0x6')]=_[_0x598e('0x7')](config[_0x598e('0x6')],{'host':_0x598e('0x8'),'port':0x18eb});var socket=require(_0x598e('0x9'))(new Redis(config[_0x598e('0x6')]));require(_0x598e('0xa'))[_0x598e('0xb')](socket);function respondWithRpcPromise(_0x2e8f07,_0x12a9f4,_0x28dee7){return new BPromise(function(_0x4883b1,_0x44e441){return client[_0x598e('0xc')](_0x2e8f07,_0x28dee7)['then'](function(_0x299521){logger['info'](_0x598e('0xd'),_0x12a9f4,_0x598e('0xe'));logger[_0x598e('0xf')](_0x598e('0x10'),_0x12a9f4,_0x598e('0xe'),JSON['stringify'](_0x299521));if(_0x299521[_0x598e('0x11')]){if(_0x299521['error'][_0x598e('0x12')]===0x1f4){logger[_0x598e('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x12a9f4,_0x299521[_0x598e('0x11')][_0x598e('0x13')]);return _0x44e441(_0x299521[_0x598e('0x11')][_0x598e('0x13')]);}logger[_0x598e('0x11')](_0x598e('0xd'),_0x12a9f4,_0x299521[_0x598e('0x11')]['message']);return _0x4883b1(_0x299521[_0x598e('0x11')][_0x598e('0x13')]);}else{logger[_0x598e('0x14')](_0x598e('0xd'),_0x12a9f4,'request\x20sent');_0x4883b1(_0x299521[_0x598e('0x15')][_0x598e('0x13')]);}})[_0x598e('0x16')](function(_0x31846e){logger[_0x598e('0x11')](_0x598e('0xd'),_0x12a9f4,_0x31846e);_0x44e441(_0x31846e);});});} \ No newline at end of file +var _0x1b32=['http','redis','defaults','localhost','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x187df4,_0x114bef){var _0x29363d=function(_0x3d9bf2){while(--_0x3d9bf2){_0x187df4['push'](_0x187df4['shift']());}};_0x29363d(++_0x114bef);}(_0x1b32,0x85));var _0x21b3=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x1b32[_0x500419];return _0x241c1a;};'use strict';var _=require('lodash');var util=require(_0x21b3('0x0'));var moment=require(_0x21b3('0x1'));var BPromise=require(_0x21b3('0x2'));var rs=require(_0x21b3('0x3'));var fs=require('fs');var Redis=require(_0x21b3('0x4'));var db=require(_0x21b3('0x5'))['db'];var utils=require(_0x21b3('0x6'));var logger=require(_0x21b3('0x7'))(_0x21b3('0x8'));var config=require(_0x21b3('0x9'));var jayson=require(_0x21b3('0xa'));var client=jayson[_0x21b3('0xb')][_0x21b3('0xc')]({'port':0x232a});config[_0x21b3('0xd')]=_[_0x21b3('0xe')](config['redis'],{'host':_0x21b3('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x21b3('0x10')](socket);function respondWithRpcPromise(_0x36b2a1,_0x56009d,_0x4aa0d7){return new BPromise(function(_0x253f2b,_0x270969){return client[_0x21b3('0x11')](_0x36b2a1,_0x4aa0d7)['then'](function(_0x370338){logger[_0x21b3('0x12')](_0x21b3('0x13'),_0x56009d,_0x21b3('0x14'));logger[_0x21b3('0x15')](_0x21b3('0x16'),_0x56009d,_0x21b3('0x14'),JSON[_0x21b3('0x17')](_0x370338));if(_0x370338[_0x21b3('0x18')]){if(_0x370338['error'][_0x21b3('0x19')]===0x1f4){logger[_0x21b3('0x18')](_0x21b3('0x13'),_0x56009d,_0x370338['error'][_0x21b3('0x1a')]);return _0x270969(_0x370338['error'][_0x21b3('0x1a')]);}logger['error'](_0x21b3('0x13'),_0x56009d,_0x370338[_0x21b3('0x18')][_0x21b3('0x1a')]);return _0x253f2b(_0x370338[_0x21b3('0x18')]['message']);}else{logger[_0x21b3('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x56009d,_0x21b3('0x14'));_0x253f2b(_0x370338[_0x21b3('0x1b')][_0x21b3('0x1a')]);}})[_0x21b3('0x1c')](function(_0x513c32){logger[_0x21b3('0x18')](_0x21b3('0x13'),_0x56009d,_0x513c32);_0x270969(_0x513c32);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 2a10c56..023950d 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 _0xa900=['length','./openchannelAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x359e64,_0x270b2a){var _0x12b95e=function(_0x15262a){while(--_0x15262a){_0x359e64['push'](_0x359e64['shift']());}};_0x12b95e(++_0x270b2a);}(_0xa900,0x101));var _0x0a90=function(_0x1329eb,_0x486a85){_0x1329eb=_0x1329eb-0x0;var _0x7a2e77=_0xa900[_0x1329eb];return _0x7a2e77;};'use strict';var OpenchannelAccountEvents=require(_0x0a90('0x0'));var events=[_0x0a90('0x1'),_0x0a90('0x2'),_0x0a90('0x3')];function createListener(_0x2a9b60,_0x4e133b){return function(_0x55f0b7){_0x4e133b[_0x0a90('0x4')](_0x2a9b60,_0x55f0b7);};}function removeListener(_0x5872bf,_0x4f5b00){return function(){OpenchannelAccountEvents[_0x0a90('0x5')](_0x5872bf,_0x4f5b00);};}exports[_0x0a90('0x6')]=function(_0x461b32){for(var _0x34ee43=0x0,_0x56a1e5=events[_0x0a90('0x7')];_0x34ee43<_0x56a1e5;_0x34ee43++){var _0x4718e9=events[_0x34ee43];var _0x33e3cf=createListener('openchannelAccount:'+_0x4718e9,_0x461b32);OpenchannelAccountEvents['on'](_0x4718e9,_0x33e3cf);}}; \ No newline at end of file +var _0x9224=['update','removeListener','length','save','remove'];(function(_0x571852,_0x34ae1f){var _0x1ec365=function(_0x398fe5){while(--_0x398fe5){_0x571852['push'](_0x571852['shift']());}};_0x1ec365(++_0x34ae1f);}(_0x9224,0xa3));var _0x4922=function(_0x2061ce,_0x170c6d){_0x2061ce=_0x2061ce-0x0;var _0x58d748=_0x9224[_0x2061ce];return _0x58d748;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x4922('0x0'),_0x4922('0x1'),_0x4922('0x2')];function createListener(_0x472129,_0x3517a1){return function(_0x3c8757){_0x3517a1['emit'](_0x472129,_0x3c8757);};}function removeListener(_0x582640,_0x572f8f){return function(){OpenchannelAccountEvents[_0x4922('0x3')](_0x582640,_0x572f8f);};}exports['register']=function(_0x12601a){for(var _0x1b7fc7=0x0,_0x4216c0=events[_0x4922('0x4')];_0x1b7fc7<_0x4216c0;_0x1b7fc7++){var _0x7a8bd1=events[_0x1b7fc7];var _0x245562=createListener('openchannelAccount:'+_0x7a8bd1,_0x12601a);OpenchannelAccountEvents['on'](_0x7a8bd1,_0x245562);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index de872aa..da18cea 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 _0xcb50=['fs-extra','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','connect-timeout','express','Router'];(function(_0x27681a,_0x553d23){var _0x48ab0f=function(_0x198099){while(--_0x198099){_0x27681a['push'](_0x27681a['shift']());}};_0x48ab0f(++_0x553d23);}(_0xcb50,0xed));var _0x0cb5=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0xcb50[_0x1399d6];return _0x4a9db4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0cb5('0x0'));var express=require(_0x0cb5('0x1'));var router=express[_0x0cb5('0x2')]();var fs_extra=require(_0x0cb5('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0cb5('0x4'));var controller=require(_0x0cb5('0x5'));router[_0x0cb5('0x6')]('/',auth[_0x0cb5('0x7')](),controller[_0x0cb5('0x8')]);router[_0x0cb5('0x6')](_0x0cb5('0x9'),auth[_0x0cb5('0x7')](),controller['show']);router[_0x0cb5('0xa')]('/',auth[_0x0cb5('0x7')](),controller['create']);router[_0x0cb5('0xb')]('/:id',auth[_0x0cb5('0x7')](),controller[_0x0cb5('0xc')]);router[_0x0cb5('0xd')](_0x0cb5('0x9'),auth[_0x0cb5('0x7')](),controller[_0x0cb5('0xe')]);module[_0x0cb5('0xf')]=router; \ No newline at end of file +var _0xe68c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','create','put','/:id','update','delete','destroy'];(function(_0x64bc5c,_0x559812){var _0x25e8fb=function(_0x124d39){while(--_0x124d39){_0x64bc5c['push'](_0x64bc5c['shift']());}};_0x25e8fb(++_0x559812);}(_0xe68c,0xd8));var _0xce68=function(_0x338391,_0x4d5e84){_0x338391=_0x338391-0x0;var _0x363e1c=_0xe68c[_0x338391];return _0x363e1c;};'use strict';var multer=require(_0xce68('0x0'));var util=require(_0xce68('0x1'));var path=require(_0xce68('0x2'));var timeout=require(_0xce68('0x3'));var express=require(_0xce68('0x4'));var router=express[_0xce68('0x5')]();var fs_extra=require(_0xce68('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xce68('0x7'));var config=require(_0xce68('0x8'));var controller=require('./openchannelApplication.controller');router[_0xce68('0x9')]('/',auth[_0xce68('0xa')](),controller[_0xce68('0xb')]);router['get']('/:id',auth[_0xce68('0xa')](),controller['show']);router['post']('/',auth[_0xce68('0xa')](),controller[_0xce68('0xc')]);router[_0xce68('0xd')](_0xce68('0xe'),auth[_0xce68('0xa')](),controller[_0xce68('0xf')]);router[_0xce68('0x10')](_0xce68('0xe'),auth[_0xce68('0xa')](),controller[_0xce68('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index ca6bbea..33d53ee 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 _0xb71d=['INTEGER','noop','TEXT','STRING','sequelize','exports'];(function(_0x232eb7,_0x199b07){var _0xd7fb8=function(_0x149ed6){while(--_0x149ed6){_0x232eb7['push'](_0x232eb7['shift']());}};_0xd7fb8(++_0x199b07);}(_0xb71d,0xdc));var _0xdb71=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb71d[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xdb71('0x0'));module[_0xdb71('0x1')]={'priority':{'type':Sequelize[_0xdb71('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdb71('0x3')},'appdata':{'type':Sequelize[_0xdb71('0x4')]()},'description':{'type':Sequelize[_0xdb71('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd0b9=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x18d209,_0x1a199e){var _0x278526=function(_0x3a5249){while(--_0x3a5249){_0x18d209['push'](_0x18d209['shift']());}};_0x278526(++_0x1a199e);}(_0xd0b9,0xe9));var _0x9d0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0b9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9d0b('0x0'));module[_0x9d0b('0x1')]={'priority':{'type':Sequelize[_0x9d0b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9d0b('0x3')],'allowNull':![],'defaultValue':_0x9d0b('0x4')},'appdata':{'type':Sequelize[_0x9d0b('0x5')]()},'description':{'type':Sequelize[_0x9d0b('0x3')]},'interval':{'type':Sequelize[_0x9d0b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 9f212fb..865612a 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 _0xc8ee=['path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','stack','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','map','VIRTUAL','options','where','OpenchannelApplication','includeAll','catch','show','params','rawAttributes','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc8ee,0x8b));var _0xec8e=function(_0x495bfb,_0xa0b775){_0x495bfb=_0x495bfb-0x0;var _0x5df197=_0xc8ee[_0x495bfb];return _0x5df197;};'use strict';var emlformat=require(_0xec8e('0x0'));var rimraf=require(_0xec8e('0x1'));var zipdir=require(_0xec8e('0x2'));var jsonpatch=require(_0xec8e('0x3'));var rp=require('request-promise');var moment=require(_0xec8e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xec8e('0x5'));var util=require(_0xec8e('0x6'));var path=require(_0xec8e('0x7'));var sox=require('sox');var csv=require(_0xec8e('0x8'));var ejs=require(_0xec8e('0x9'));var fs=require('fs');var fs_extra=require(_0xec8e('0xa'));var _=require('lodash');var squel=require(_0xec8e('0xb'));var crypto=require(_0xec8e('0xc'));var jsforce=require(_0xec8e('0xd'));var deskjs=require(_0xec8e('0xe'));var toCsv=require(_0xec8e('0x8'));var querystring=require('querystring');var Papa=require(_0xec8e('0xf'));var Redis=require(_0xec8e('0x10'));var authService=require(_0xec8e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xec8e('0x12'))(_0xec8e('0x13'));var utils=require(_0xec8e('0x14'));var config=require(_0xec8e('0x15'));var licenseUtil=require(_0xec8e('0x16'));var db=require(_0xec8e('0x17'))['db'];function respondWithStatusCode(_0x4f0164,_0x15ca89){_0x15ca89=_0x15ca89||0xcc;return function(_0x2141cc){if(_0x2141cc){return _0x4f0164[_0xec8e('0x18')](_0x15ca89);}return _0x4f0164[_0xec8e('0x19')](_0x15ca89)[_0xec8e('0x1a')]();};}function respondWithResult(_0x11f711,_0x4b7d3a){_0x4b7d3a=_0x4b7d3a||0xc8;return function(_0x3c869e){if(_0x3c869e){return _0x11f711[_0xec8e('0x19')](_0x4b7d3a)[_0xec8e('0x1b')](_0x3c869e);}};}function respondWithFilteredResult(_0x47149b,_0x45d76e){return function(_0x30c738){if(_0x30c738){var _0x2f747f=typeof _0x45d76e[_0xec8e('0x1c')]===_0xec8e('0x1d')&&typeof _0x45d76e['limit']===_0xec8e('0x1d');var _0x41b257=_0x30c738[_0xec8e('0x1e')];var _0x369567=_0x2f747f?0x0:_0x45d76e[_0xec8e('0x1c')];var _0x5c8503=_0x2f747f?_0x30c738[_0xec8e('0x1e')]:_0x45d76e['offset']+_0x45d76e[_0xec8e('0x1f')];var _0x2ae5c3;if(_0x5c8503>=_0x41b257){_0x5c8503=_0x41b257;_0x2ae5c3=0xc8;}else{_0x2ae5c3=0xce;}_0x47149b[_0xec8e('0x19')](_0x2ae5c3);return _0x47149b[_0xec8e('0x20')](_0xec8e('0x21'),_0x369567+'-'+_0x5c8503+'/'+_0x41b257)[_0xec8e('0x1b')](_0x30c738);}return null;};}function patchUpdates(_0x5ed99b){return function(_0x538ad0){try{jsonpatch['apply'](_0x538ad0,_0x5ed99b,!![]);}catch(_0x517324){return BPromise[_0xec8e('0x22')](_0x517324);}return _0x538ad0[_0xec8e('0x23')]();};}function saveUpdates(_0x519fd6,_0x457d7f){return function(_0x304b53){if(_0x304b53){return _0x304b53['update'](_0x519fd6)[_0xec8e('0x24')](function(_0x3a6f85){return _0x3a6f85;});}return null;};}function removeEntity(_0x302d99,_0x43a634){return function(_0x2dff67){if(_0x2dff67){return _0x2dff67[_0xec8e('0x25')]()[_0xec8e('0x24')](function(){_0x302d99[_0xec8e('0x19')](0xcc)[_0xec8e('0x1a')]();});}};}function handleEntityNotFound(_0x15f2a5,_0x5650bd){return function(_0x49c20e){if(!_0x49c20e){_0x15f2a5[_0xec8e('0x18')](0x194);}return _0x49c20e;};}function handleError(_0x5c0189,_0x48e177){_0x48e177=_0x48e177||0x1f4;return function(_0x456c0d){logger['error'](_0x456c0d[_0xec8e('0x26')]);if(_0x456c0d[_0xec8e('0x27')]){delete _0x456c0d[_0xec8e('0x27')];}_0x5c0189[_0xec8e('0x19')](_0x48e177)[_0xec8e('0x28')](_0x456c0d);};}exports[_0xec8e('0x29')]=function(_0x3a2e12,_0x4a2736){var _0x2c150a={},_0x112e26={},_0x1930ff={'count':0x0,'rows':[]};var _0x242b94=_['map'](db['OpenchannelApplication']['rawAttributes'],function(_0x21a31a){return{'name':_0x21a31a[_0xec8e('0x2a')],'type':_0x21a31a[_0xec8e('0x2b')][_0xec8e('0x2c')]};});_0x112e26[_0xec8e('0x2d')]=_['map'](_0x242b94,_0xec8e('0x27'));_0x112e26[_0xec8e('0x2e')]=_[_0xec8e('0x2f')](_0x3a2e12[_0xec8e('0x2e')]);_0x112e26[_0xec8e('0x30')]=_[_0xec8e('0x31')](_0x112e26['model'],_0x112e26[_0xec8e('0x2e')]);_0x2c150a[_0xec8e('0x32')]=_[_0xec8e('0x31')](_0x112e26['model'],qs[_0xec8e('0x33')](_0x3a2e12[_0xec8e('0x2e')]['fields']));_0x2c150a[_0xec8e('0x32')]=_0x2c150a[_0xec8e('0x32')][_0xec8e('0x34')]?_0x2c150a[_0xec8e('0x32')]:_0x112e26['model'];if(!_0x3a2e12[_0xec8e('0x2e')][_0xec8e('0x35')](_0xec8e('0x36'))){_0x2c150a[_0xec8e('0x1f')]=qs[_0xec8e('0x1f')](_0x3a2e12[_0xec8e('0x2e')]['limit']);_0x2c150a[_0xec8e('0x1c')]=qs[_0xec8e('0x1c')](_0x3a2e12[_0xec8e('0x2e')][_0xec8e('0x1c')]);}_0x2c150a['order']=qs[_0xec8e('0x37')](_0x3a2e12[_0xec8e('0x2e')][_0xec8e('0x37')]);_0x2c150a['where']=qs[_0xec8e('0x30')](_['pick'](_0x3a2e12[_0xec8e('0x2e')],_0x112e26['filters']),_0x242b94);if(_0x3a2e12[_0xec8e('0x2e')][_0xec8e('0x38')]){_0x2c150a['where']=_[_0xec8e('0x39')](_0x2c150a['where'],{'$or':_[_0xec8e('0x3a')](_0x242b94,function(_0x5635c7){if(_0x5635c7[_0xec8e('0x2b')]!==_0xec8e('0x3b')){var _0x12d1fd={};_0x12d1fd[_0x5635c7['name']]={'$like':'%'+_0x3a2e12[_0xec8e('0x2e')]['filter']+'%'};return _0x12d1fd;}})});}_0x2c150a=_[_0xec8e('0x39')]({},_0x2c150a,_0x3a2e12[_0xec8e('0x3c')]);var _0x1310b5={'where':_0x2c150a[_0xec8e('0x3d')]};return db[_0xec8e('0x3e')][_0xec8e('0x1e')](_0x1310b5)[_0xec8e('0x24')](function(_0x14f15d){_0x1930ff[_0xec8e('0x1e')]=_0x14f15d;if(_0x3a2e12['query'][_0xec8e('0x3f')]){_0x2c150a['include']=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x2c150a);})[_0xec8e('0x24')](function(_0x12505e){_0x1930ff['rows']=_0x12505e;return _0x1930ff;})[_0xec8e('0x24')](respondWithFilteredResult(_0x4a2736,_0x2c150a))[_0xec8e('0x40')](handleError(_0x4a2736,null));};exports[_0xec8e('0x41')]=function(_0x1fe273,_0x3ebaf0){var _0x539cd0={'raw':!![],'where':{'id':_0x1fe273[_0xec8e('0x42')]['id']}},_0xb36b80={};_0xb36b80[_0xec8e('0x2d')]=_[_0xec8e('0x2f')](db[_0xec8e('0x3e')][_0xec8e('0x43')]);_0xb36b80['query']=_[_0xec8e('0x2f')](_0x1fe273['query']);_0xb36b80[_0xec8e('0x30')]=_[_0xec8e('0x31')](_0xb36b80[_0xec8e('0x2d')],_0xb36b80['query']);_0x539cd0[_0xec8e('0x32')]=_[_0xec8e('0x31')](_0xb36b80[_0xec8e('0x2d')],qs['fields'](_0x1fe273[_0xec8e('0x2e')]['fields']));_0x539cd0[_0xec8e('0x32')]=_0x539cd0[_0xec8e('0x32')][_0xec8e('0x34')]?_0x539cd0[_0xec8e('0x32')]:_0xb36b80['model'];if(_0x1fe273[_0xec8e('0x2e')][_0xec8e('0x3f')]){_0x539cd0[_0xec8e('0x44')]=[{'all':!![]}];}_0x539cd0=_[_0xec8e('0x39')]({},_0x539cd0,_0x1fe273[_0xec8e('0x3c')]);return db[_0xec8e('0x3e')][_0xec8e('0x45')](_0x539cd0)[_0xec8e('0x24')](handleEntityNotFound(_0x3ebaf0,null))[_0xec8e('0x24')](respondWithResult(_0x3ebaf0,null))[_0xec8e('0x40')](handleError(_0x3ebaf0,null));};exports[_0xec8e('0x46')]=function(_0x3f46d5,_0x5c1c2b){return db[_0xec8e('0x3e')][_0xec8e('0x46')](_0x3f46d5[_0xec8e('0x47')],{})['then'](respondWithResult(_0x5c1c2b,0xc9))[_0xec8e('0x40')](handleError(_0x5c1c2b,null));};exports[_0xec8e('0x48')]=function(_0xfee44c,_0x4d809b){if(_0xfee44c['body']['id']){delete _0xfee44c[_0xec8e('0x47')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0xfee44c[_0xec8e('0x42')]['id']}})[_0xec8e('0x24')](handleEntityNotFound(_0x4d809b,null))[_0xec8e('0x24')](saveUpdates(_0xfee44c[_0xec8e('0x47')],null))[_0xec8e('0x24')](respondWithResult(_0x4d809b,null))[_0xec8e('0x40')](handleError(_0x4d809b,null));};exports[_0xec8e('0x25')]=function(_0x43b49a,_0x20c466){return db[_0xec8e('0x3e')][_0xec8e('0x45')]({'where':{'id':_0x43b49a[_0xec8e('0x42')]['id']}})[_0xec8e('0x24')](handleEntityNotFound(_0x20c466,null))[_0xec8e('0x24')](removeEntity(_0x20c466,null))['catch'](handleError(_0x20c466,null));}; \ No newline at end of file +var _0x60ac=['set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','OpenchannelApplication','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','show','params','include','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x564242,_0x4159f7){var _0x2906fb=function(_0xed2acc){while(--_0xed2acc){_0x564242['push'](_0x564242['shift']());}};_0x2906fb(++_0x4159f7);}(_0x60ac,0x19c));var _0xc60a=function(_0x27cf7d,_0x377515){_0x27cf7d=_0x27cf7d-0x0;var _0x9b13ac=_0x60ac[_0x27cf7d];return _0x9b13ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc60a('0x0'));var zipdir=require(_0xc60a('0x1'));var jsonpatch=require(_0xc60a('0x2'));var rp=require(_0xc60a('0x3'));var moment=require('moment');var BPromise=require(_0xc60a('0x4'));var Mustache=require(_0xc60a('0x5'));var util=require('util');var path=require(_0xc60a('0x6'));var sox=require(_0xc60a('0x7'));var csv=require(_0xc60a('0x8'));var ejs=require(_0xc60a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc60a('0xa'));var crypto=require(_0xc60a('0xb'));var jsforce=require(_0xc60a('0xc'));var deskjs=require(_0xc60a('0xd'));var toCsv=require(_0xc60a('0x8'));var querystring=require(_0xc60a('0xe'));var Papa=require('papaparse');var Redis=require(_0xc60a('0xf'));var authService=require(_0xc60a('0x10'));var qs=require(_0xc60a('0x11'));var as=require(_0xc60a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc60a('0x13'))(_0xc60a('0x14'));var utils=require(_0xc60a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc60a('0x16'));var db=require(_0xc60a('0x17'))['db'];function respondWithStatusCode(_0x6a1057,_0x3fab60){_0x3fab60=_0x3fab60||0xcc;return function(_0x48514d){if(_0x48514d){return _0x6a1057[_0xc60a('0x18')](_0x3fab60);}return _0x6a1057[_0xc60a('0x19')](_0x3fab60)[_0xc60a('0x1a')]();};}function respondWithResult(_0x25f809,_0x4006a4){_0x4006a4=_0x4006a4||0xc8;return function(_0x15ec99){if(_0x15ec99){return _0x25f809[_0xc60a('0x19')](_0x4006a4)[_0xc60a('0x1b')](_0x15ec99);}};}function respondWithFilteredResult(_0x30acbc,_0x12ac25){return function(_0x276b37){if(_0x276b37){var _0x1e69fe=typeof _0x12ac25[_0xc60a('0x1c')]===_0xc60a('0x1d')&&typeof _0x12ac25['limit']==='undefined';var _0x5b5bfe=_0x276b37[_0xc60a('0x1e')];var _0x4c3537=_0x1e69fe?0x0:_0x12ac25[_0xc60a('0x1c')];var _0x91e37d=_0x1e69fe?_0x276b37['count']:_0x12ac25[_0xc60a('0x1c')]+_0x12ac25[_0xc60a('0x1f')];var _0xd6ee65;if(_0x91e37d>=_0x5b5bfe){_0x91e37d=_0x5b5bfe;_0xd6ee65=0xc8;}else{_0xd6ee65=0xce;}_0x30acbc[_0xc60a('0x19')](_0xd6ee65);return _0x30acbc[_0xc60a('0x20')](_0xc60a('0x21'),_0x4c3537+'-'+_0x91e37d+'/'+_0x5b5bfe)['json'](_0x276b37);}return null;};}function patchUpdates(_0x3eb5e1){return function(_0x335b5e){try{jsonpatch[_0xc60a('0x22')](_0x335b5e,_0x3eb5e1,!![]);}catch(_0x5da350){return BPromise['reject'](_0x5da350);}return _0x335b5e[_0xc60a('0x23')]();};}function saveUpdates(_0x2b1615,_0x1f05c9){return function(_0x297a69){if(_0x297a69){return _0x297a69[_0xc60a('0x24')](_0x2b1615)[_0xc60a('0x25')](function(_0xc1215b){return _0xc1215b;});}return null;};}function removeEntity(_0x2cabbd,_0xdbcddb){return function(_0x30a5f7){if(_0x30a5f7){return _0x30a5f7[_0xc60a('0x26')]()[_0xc60a('0x25')](function(){_0x2cabbd[_0xc60a('0x19')](0xcc)[_0xc60a('0x1a')]();});}};}function handleEntityNotFound(_0x35b4ec,_0x28734c){return function(_0x3fe233){if(!_0x3fe233){_0x35b4ec[_0xc60a('0x18')](0x194);}return _0x3fe233;};}function handleError(_0x2348e7,_0x2fa745){_0x2fa745=_0x2fa745||0x1f4;return function(_0x2152e0){logger[_0xc60a('0x27')](_0x2152e0[_0xc60a('0x28')]);if(_0x2152e0[_0xc60a('0x29')]){delete _0x2152e0[_0xc60a('0x29')];}_0x2348e7[_0xc60a('0x19')](_0x2fa745)[_0xc60a('0x2a')](_0x2152e0);};}exports['index']=function(_0x90db0a,_0x55d6b4){var _0x42ccd7={},_0x5db13b={},_0x2d2653={'count':0x0,'rows':[]};var _0x22591a=_[_0xc60a('0x2b')](db[_0xc60a('0x2c')]['rawAttributes'],function(_0x59b5a8){return{'name':_0x59b5a8[_0xc60a('0x2d')],'type':_0x59b5a8[_0xc60a('0x2e')][_0xc60a('0x2f')]};});_0x5db13b[_0xc60a('0x30')]=_[_0xc60a('0x2b')](_0x22591a,'name');_0x5db13b[_0xc60a('0x31')]=_[_0xc60a('0x32')](_0x90db0a[_0xc60a('0x31')]);_0x5db13b[_0xc60a('0x33')]=_['intersection'](_0x5db13b[_0xc60a('0x30')],_0x5db13b[_0xc60a('0x31')]);_0x42ccd7[_0xc60a('0x34')]=_[_0xc60a('0x35')](_0x5db13b[_0xc60a('0x30')],qs[_0xc60a('0x36')](_0x90db0a[_0xc60a('0x31')][_0xc60a('0x36')]));_0x42ccd7[_0xc60a('0x34')]=_0x42ccd7[_0xc60a('0x34')][_0xc60a('0x37')]?_0x42ccd7['attributes']:_0x5db13b[_0xc60a('0x30')];if(!_0x90db0a[_0xc60a('0x31')][_0xc60a('0x38')](_0xc60a('0x39'))){_0x42ccd7['limit']=qs[_0xc60a('0x1f')](_0x90db0a['query']['limit']);_0x42ccd7[_0xc60a('0x1c')]=qs['offset'](_0x90db0a[_0xc60a('0x31')][_0xc60a('0x1c')]);}_0x42ccd7[_0xc60a('0x3a')]=qs[_0xc60a('0x3b')](_0x90db0a[_0xc60a('0x31')][_0xc60a('0x3b')]);_0x42ccd7[_0xc60a('0x3c')]=qs[_0xc60a('0x33')](_['pick'](_0x90db0a['query'],_0x5db13b[_0xc60a('0x33')]),_0x22591a);if(_0x90db0a[_0xc60a('0x31')]['filter']){_0x42ccd7[_0xc60a('0x3c')]=_[_0xc60a('0x3d')](_0x42ccd7['where'],{'$or':_[_0xc60a('0x2b')](_0x22591a,function(_0x1bd356){if(_0x1bd356['type']!==_0xc60a('0x3e')){var _0x1d32af={};_0x1d32af[_0x1bd356['name']]={'$like':'%'+_0x90db0a[_0xc60a('0x31')][_0xc60a('0x3f')]+'%'};return _0x1d32af;}})});}_0x42ccd7=_[_0xc60a('0x3d')]({},_0x42ccd7,_0x90db0a[_0xc60a('0x40')]);var _0x2faddf={'where':_0x42ccd7['where']};return db[_0xc60a('0x2c')][_0xc60a('0x1e')](_0x2faddf)['then'](function(_0x35ced2){_0x2d2653['count']=_0x35ced2;if(_0x90db0a['query'][_0xc60a('0x41')]){_0x42ccd7['include']=[{'all':!![]}];}return db[_0xc60a('0x2c')]['findAll'](_0x42ccd7);})[_0xc60a('0x25')](function(_0x512316){_0x2d2653[_0xc60a('0x42')]=_0x512316;return _0x2d2653;})[_0xc60a('0x25')](respondWithFilteredResult(_0x55d6b4,_0x42ccd7))['catch'](handleError(_0x55d6b4,null));};exports[_0xc60a('0x43')]=function(_0x498e48,_0x386a01){var _0x44d172={'raw':!![],'where':{'id':_0x498e48[_0xc60a('0x44')]['id']}},_0x60e0d9={};_0x60e0d9[_0xc60a('0x30')]=_[_0xc60a('0x32')](db[_0xc60a('0x2c')]['rawAttributes']);_0x60e0d9[_0xc60a('0x31')]=_[_0xc60a('0x32')](_0x498e48[_0xc60a('0x31')]);_0x60e0d9['filters']=_[_0xc60a('0x35')](_0x60e0d9['model'],_0x60e0d9[_0xc60a('0x31')]);_0x44d172['attributes']=_[_0xc60a('0x35')](_0x60e0d9[_0xc60a('0x30')],qs['fields'](_0x498e48[_0xc60a('0x31')][_0xc60a('0x36')]));_0x44d172[_0xc60a('0x34')]=_0x44d172[_0xc60a('0x34')]['length']?_0x44d172[_0xc60a('0x34')]:_0x60e0d9[_0xc60a('0x30')];if(_0x498e48[_0xc60a('0x31')][_0xc60a('0x41')]){_0x44d172[_0xc60a('0x45')]=[{'all':!![]}];}_0x44d172=_[_0xc60a('0x3d')]({},_0x44d172,_0x498e48[_0xc60a('0x40')]);return db[_0xc60a('0x2c')][_0xc60a('0x46')](_0x44d172)['then'](handleEntityNotFound(_0x386a01,null))[_0xc60a('0x25')](respondWithResult(_0x386a01,null))[_0xc60a('0x47')](handleError(_0x386a01,null));};exports[_0xc60a('0x48')]=function(_0x33b10c,_0x52a9a7){return db[_0xc60a('0x2c')][_0xc60a('0x48')](_0x33b10c[_0xc60a('0x49')],{})['then'](respondWithResult(_0x52a9a7,0xc9))[_0xc60a('0x47')](handleError(_0x52a9a7,null));};exports['update']=function(_0x51b277,_0x13ba5c){if(_0x51b277[_0xc60a('0x49')]['id']){delete _0x51b277[_0xc60a('0x49')]['id'];}return db[_0xc60a('0x2c')][_0xc60a('0x46')]({'where':{'id':_0x51b277[_0xc60a('0x44')]['id']}})[_0xc60a('0x25')](handleEntityNotFound(_0x13ba5c,null))[_0xc60a('0x25')](saveUpdates(_0x51b277[_0xc60a('0x49')],null))[_0xc60a('0x25')](respondWithResult(_0x13ba5c,null))[_0xc60a('0x47')](handleError(_0x13ba5c,null));};exports[_0xc60a('0x26')]=function(_0x2d31ee,_0x3e5037){return db[_0xc60a('0x2c')]['find']({'where':{'id':_0x2d31ee['params']['id']}})[_0xc60a('0x25')](handleEntityNotFound(_0x3e5037,null))[_0xc60a('0x25')](removeEntity(_0x3e5037,null))[_0xc60a('0x47')](handleError(_0x3e5037,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 8360358..1b33548 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 _0x5fe8=['define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','exports'];(function(_0x5acb75,_0x24f6ba){var _0x469a34=function(_0x7aa699){while(--_0x7aa699){_0x5acb75['push'](_0x5acb75['shift']());}};_0x469a34(++_0x24f6ba);}(_0x5fe8,0xd6));var _0x85fe=function(_0x1aa099,_0x18d212){_0x1aa099=_0x1aa099-0x0;var _0x4341db=_0x5fe8[_0x1aa099];return _0x4341db;};'use strict';var _=require(_0x85fe('0x0'));var util=require(_0x85fe('0x1'));var logger=require(_0x85fe('0x2'))(_0x85fe('0x3'));var moment=require('moment');var BPromise=require(_0x85fe('0x4'));var rp=require(_0x85fe('0x5'));var fs=require('fs');var path=require(_0x85fe('0x6'));var rimraf=require(_0x85fe('0x7'));var config=require('../../config/environment');var attributes=require(_0x85fe('0x8'));module[_0x85fe('0x9')]=function(_0x3ef494,_0x4e550c){return _0x3ef494[_0x85fe('0xa')](_0x85fe('0xb'),attributes,{'tableName':_0x85fe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x85fe('0xd')});}; \ No newline at end of file +var _0x7a48=['bluebird','request-promise','path','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x2bda2f,_0x56582f){var _0x585013=function(_0x22c9c8){while(--_0x22c9c8){_0x2bda2f['push'](_0x2bda2f['shift']());}};_0x585013(++_0x56582f);}(_0x7a48,0x80));var _0x87a4=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x7a48[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x87a4('0x0'));var util=require(_0x87a4('0x1'));var logger=require('../../config/logger')(_0x87a4('0x2'));var moment=require(_0x87a4('0x3'));var BPromise=require(_0x87a4('0x4'));var rp=require(_0x87a4('0x5'));var fs=require('fs');var path=require(_0x87a4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0x87a4('0x7')]=function(_0x221e24,_0x1e30e5){return _0x221e24[_0x87a4('0x8')](_0x87a4('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x87a4('0xa'),'collate':_0x87a4('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 56c82e5..c6fcab2 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 _0xa47e=['OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','options','raw','where','attributes','limit','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s'];(function(_0x13ea36,_0x2abcf9){var _0x5cee46=function(_0xd23013){while(--_0xd23013){_0x13ea36['push'](_0x13ea36['shift']());}};_0x5cee46(++_0x2abcf9);}(_0xa47e,0x183));var _0xea47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa47e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xea47('0x0'));var util=require(_0xea47('0x1'));var moment=require('moment');var BPromise=require(_0xea47('0x2'));var rs=require(_0xea47('0x3'));var fs=require('fs');var Redis=require(_0xea47('0x4'));var db=require(_0xea47('0x5'))['db'];var utils=require(_0xea47('0x6'));var logger=require(_0xea47('0x7'))(_0xea47('0x8'));var config=require(_0xea47('0x9'));var jayson=require(_0xea47('0xa'));var client=jayson['client'][_0xea47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x264720,_0x34d112,_0x560d20){return new BPromise(function(_0x416740,_0x3c219e){return client[_0xea47('0xc')](_0x264720,_0x560d20)[_0xea47('0xd')](function(_0x8442a5){logger[_0xea47('0xe')](_0xea47('0xf'),_0x34d112,'request\x20sent');logger['debug'](_0xea47('0x10'),_0x34d112,_0xea47('0x11'),JSON['stringify'](_0x8442a5));if(_0x8442a5[_0xea47('0x12')]){if(_0x8442a5[_0xea47('0x12')]['code']===0x1f4){logger[_0xea47('0x12')](_0xea47('0xf'),_0x34d112,_0x8442a5[_0xea47('0x12')][_0xea47('0x13')]);return _0x3c219e(_0x8442a5['error']['message']);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x34d112,_0x8442a5[_0xea47('0x12')][_0xea47('0x13')]);return _0x416740(_0x8442a5['error']['message']);}else{logger[_0xea47('0xe')](_0xea47('0xf'),_0x34d112,_0xea47('0x11'));_0x416740(_0x8442a5[_0xea47('0x14')][_0xea47('0x13')]);}})[_0xea47('0x15')](function(_0x233dfe){logger['error'](_0xea47('0xf'),_0x34d112,_0x233dfe);_0x3c219e(_0x233dfe);});});}exports[_0xea47('0x16')]=function(_0x38b98c){var _0x539b53=this;return new Promise(function(_0x2d1c6f,_0xad382){return db[_0xea47('0x17')]['update'](_0x38b98c['body'],{'raw':_0x38b98c[_0xea47('0x18')]?_0x38b98c['options'][_0xea47('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38b98c[_0xea47('0x18')]?_0x38b98c['options'][_0xea47('0x1a')]||null:null,'attributes':_0x38b98c[_0xea47('0x18')]?_0x38b98c['options'][_0xea47('0x1b')]||null:null,'limit':_0x38b98c[_0xea47('0x18')]?_0x38b98c[_0xea47('0x18')][_0xea47('0x1c')]||null:null})[_0xea47('0xd')](function(_0x13395d){logger[_0xea47('0xe')](_0xea47('0x16'),_0x38b98c);logger[_0xea47('0x1d')](_0xea47('0x16'),_0x38b98c,JSON[_0xea47('0x1e')](_0x13395d));_0x2d1c6f(_0x13395d);})[_0xea47('0x15')](function(_0x1a7d7d){logger[_0xea47('0x12')](_0xea47('0x16'),_0x1a7d7d['message'],_0x38b98c);_0xad382(_0x539b53[_0xea47('0x12')](0x1f4,_0x1a7d7d[_0xea47('0x13')]));});});}; \ No newline at end of file +var _0xd018=['body','raw','options','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x2eea9a,_0x368daf){var _0x1ec61e=function(_0x1fc2fc){while(--_0x1fc2fc){_0x2eea9a['push'](_0x2eea9a['shift']());}};_0x1ec61e(++_0x368daf);}(_0xd018,0x16e));var _0x8d01=function(_0x576099,_0xe7962e){_0x576099=_0x576099-0x0;var _0x461cf9=_0xd018[_0x576099];return _0x461cf9;};'use strict';var _=require(_0x8d01('0x0'));var util=require(_0x8d01('0x1'));var moment=require(_0x8d01('0x2'));var BPromise=require(_0x8d01('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d01('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d01('0x5'));var logger=require(_0x8d01('0x6'))(_0x8d01('0x7'));var config=require(_0x8d01('0x8'));var jayson=require(_0x8d01('0x9'));var client=jayson[_0x8d01('0xa')][_0x8d01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52808c,_0x21c64c,_0x1a6a36){return new BPromise(function(_0x3c6f30,_0x21bc7b){return client['request'](_0x52808c,_0x1a6a36)[_0x8d01('0xc')](function(_0x42bb09){logger[_0x8d01('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x21c64c,_0x8d01('0xe'));logger[_0x8d01('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x21c64c,_0x8d01('0xe'),JSON[_0x8d01('0x10')](_0x42bb09));if(_0x42bb09['error']){if(_0x42bb09[_0x8d01('0x11')]['code']===0x1f4){logger[_0x8d01('0x11')](_0x8d01('0x12'),_0x21c64c,_0x42bb09[_0x8d01('0x11')][_0x8d01('0x13')]);return _0x21bc7b(_0x42bb09[_0x8d01('0x11')][_0x8d01('0x13')]);}logger[_0x8d01('0x11')](_0x8d01('0x12'),_0x21c64c,_0x42bb09[_0x8d01('0x11')]['message']);return _0x3c6f30(_0x42bb09[_0x8d01('0x11')][_0x8d01('0x13')]);}else{logger['info'](_0x8d01('0x12'),_0x21c64c,'request\x20sent');_0x3c6f30(_0x42bb09[_0x8d01('0x14')][_0x8d01('0x13')]);}})[_0x8d01('0x15')](function(_0x45cc01){logger['error'](_0x8d01('0x12'),_0x21c64c,_0x45cc01);_0x21bc7b(_0x45cc01);});});}exports[_0x8d01('0x16')]=function(_0x5d54eb){var _0x46ac43=this;return new Promise(function(_0x468058,_0x1d5366){return db[_0x8d01('0x17')]['update'](_0x5d54eb[_0x8d01('0x18')],{'raw':_0x5d54eb['options']?_0x5d54eb['options'][_0x8d01('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d54eb[_0x8d01('0x1a')]?_0x5d54eb[_0x8d01('0x1a')][_0x8d01('0x1b')]||null:null,'attributes':_0x5d54eb[_0x8d01('0x1a')]?_0x5d54eb[_0x8d01('0x1a')][_0x8d01('0x1c')]||null:null,'limit':_0x5d54eb[_0x8d01('0x1a')]?_0x5d54eb[_0x8d01('0x1a')][_0x8d01('0x1d')]||null:null})['then'](function(_0x37e409){logger[_0x8d01('0xd')](_0x8d01('0x16'),_0x5d54eb);logger[_0x8d01('0xf')](_0x8d01('0x16'),_0x5d54eb,JSON[_0x8d01('0x10')](_0x37e409));_0x468058(_0x37e409);})['catch'](function(_0x3613bb){logger[_0x8d01('0x11')](_0x8d01('0x16'),_0x3613bb['message'],_0x5d54eb);_0x1d5366(_0x46ac43['error'](0x1f4,_0x3613bb['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index bf96048..59277aa 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 _0xb09f=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','show','get','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','/:id','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path'];(function(_0x4da1be,_0x473112){var _0x1eddf8=function(_0xb7ef10){while(--_0xb7ef10){_0x4da1be['push'](_0x4da1be['shift']());}};_0x1eddf8(++_0x473112);}(_0xb09f,0xbd));var _0xfb09=function(_0x59bfc3,_0x94c082){_0x59bfc3=_0x59bfc3-0x0;var _0x533788=_0xb09f[_0x59bfc3];return _0x533788;};'use strict';var multer=require(_0xfb09('0x0'));var util=require(_0xfb09('0x1'));var path=require(_0xfb09('0x2'));var timeout=require(_0xfb09('0x3'));var express=require('express');var router=express[_0xfb09('0x4')]();var fs_extra=require(_0xfb09('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfb09('0x6'));var config=require(_0xfb09('0x7'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0xfb09('0x8')](),controller['index']);router['get'](_0xfb09('0x9'),auth[_0xfb09('0x8')](),controller[_0xfb09('0xa')]);router['get']('/:id',auth[_0xfb09('0x8')](),controller[_0xfb09('0xb')]);router[_0xfb09('0xc')](_0xfb09('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0xfb09('0xc')](_0xfb09('0xe'),auth[_0xfb09('0x8')](),controller[_0xfb09('0xf')]);router[_0xfb09('0x10')]('/',auth[_0xfb09('0x8')](),controller[_0xfb09('0x11')]);router[_0xfb09('0x10')](_0xfb09('0xd'),auth[_0xfb09('0x8')](),controller[_0xfb09('0x12')]);router[_0xfb09('0x10')](_0xfb09('0x13'),auth[_0xfb09('0x8')](),interaction[_0xfb09('0x14')](_0xfb09('0x15'),_0xfb09('0x16')),controller['addTags']);router[_0xfb09('0x17')](_0xfb09('0x18'),auth[_0xfb09('0x8')](),interaction[_0xfb09('0x14')](_0xfb09('0x15'),_0xfb09('0x19')),controller[_0xfb09('0x1a')]);router[_0xfb09('0x1b')]('/:id',auth[_0xfb09('0x8')](),interaction[_0xfb09('0x14')](_0xfb09('0x15'),_0xfb09('0x1c')),controller[_0xfb09('0x1d')]);router[_0xfb09('0x1b')](_0xfb09('0x13'),auth[_0xfb09('0x8')](),controller[_0xfb09('0x1e')]);module[_0xfb09('0x1f')]=router; \ No newline at end of file +var _0x33b5=['/:id/download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','getMessages'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0x33b5,0xe9));var _0x533b=function(_0x4911bd,_0x496ddb){_0x4911bd=_0x4911bd-0x0;var _0x27af33=_0x33b5[_0x4911bd];return _0x27af33;};'use strict';var multer=require(_0x533b('0x0'));var util=require(_0x533b('0x1'));var path=require('path');var timeout=require(_0x533b('0x2'));var express=require(_0x533b('0x3'));var router=express[_0x533b('0x4')]();var fs_extra=require(_0x533b('0x5'));var auth=require(_0x533b('0x6'));var interaction=require(_0x533b('0x7'));var config=require(_0x533b('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x533b('0x9')]('/',auth[_0x533b('0xa')](),controller[_0x533b('0xb')]);router[_0x533b('0x9')](_0x533b('0xc'),auth[_0x533b('0xa')](),controller['describe']);router[_0x533b('0x9')]('/:id',auth[_0x533b('0xa')](),controller[_0x533b('0xd')]);router[_0x533b('0x9')]('/:id/messages',auth[_0x533b('0xa')](),controller[_0x533b('0xe')]);router[_0x533b('0x9')](_0x533b('0xf'),auth[_0x533b('0xa')](),controller['download']);router[_0x533b('0x10')]('/',auth[_0x533b('0xa')](),controller['create']);router['post']('/:id/messages',auth[_0x533b('0xa')](),controller[_0x533b('0x11')]);router[_0x533b('0x10')](_0x533b('0x12'),auth[_0x533b('0xa')](),interaction[_0x533b('0x13')](_0x533b('0x14'),_0x533b('0x15')),controller[_0x533b('0x16')]);router['put'](_0x533b('0x17'),auth[_0x533b('0xa')](),interaction[_0x533b('0x13')]('openchannel',_0x533b('0x18')),controller[_0x533b('0x19')]);router[_0x533b('0x1a')](_0x533b('0x17'),auth['isAuthenticated'](),interaction[_0x533b('0x13')](_0x533b('0x14'),_0x533b('0x1b')),controller[_0x533b('0x1c')]);router[_0x533b('0x1a')](_0x533b('0x12'),auth[_0x533b('0xa')](),controller[_0x533b('0x1d')]);module[_0x533b('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 737fd07..d2ef87b 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 _0xe13a=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x519637,_0x444a15){var _0x49210f=function(_0x22fd04){while(--_0x22fd04){_0x519637['push'](_0x519637['shift']());}};_0x49210f(++_0x444a15);}(_0xe13a,0x178));var _0xae13=function(_0x2c57cd,_0x1d443d){_0x2c57cd=_0x2c57cd-0x0;var _0x17c9e7=_0xe13a[_0x2c57cd];return _0x17c9e7;};'use strict';var Sequelize=require('sequelize');module[_0xae13('0x0')]={'closed':{'type':Sequelize[_0xae13('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xae13('0x2')]},'disposition':{'type':Sequelize[_0xae13('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xae13('0x3')]},'note':{'type':Sequelize[_0xae13('0x3')]},'read1stAt':{'type':Sequelize[_0xae13('0x2')]},'threadId':{'type':Sequelize[_0xae13('0x3')]},'externalUrl':{'type':Sequelize[_0xae13('0x3')]},'lastMsgAt':{'type':Sequelize[_0xae13('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xae13('0x4')]('in',_0xae13('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xae13('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xae13('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xae13('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x43fd=['sequelize','exports','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x43fd,0x150));var _0xd43f=function(_0x26a8e4,_0x3e40d2){_0x26a8e4=_0x26a8e4-0x0;var _0xc072bf=_0x43fd[_0x26a8e4];return _0xc072bf;};'use strict';var Sequelize=require(_0xd43f('0x0'));module[_0xd43f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd43f('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd43f('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd43f('0x3')]},'note':{'type':Sequelize[_0xd43f('0x3')]},'read1stAt':{'type':Sequelize[_0xd43f('0x2')]},'threadId':{'type':Sequelize[_0xd43f('0x3')]},'externalUrl':{'type':Sequelize[_0xd43f('0x3')]},'lastMsgAt':{'type':Sequelize[_0xd43f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xd43f('0x4')]('in',_0xd43f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xd43f('0x4')]('in',_0xd43f('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd43f('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xd43f('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 984b8e2..4625995 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 _0x030d=['direction','secret','Owner','get','Openchannel','N.A.','closed','closedAt','disposition','threadId','Private','existsSync','createReadStream','pipe','basename','out','System','Contact','value','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','getOptions','findAll','openchannel','query','user','show','from','params','model','keys','OpenchannelInteraction','filters','intersection','attributes','length','includeAll','include','merge','options','find','catch','create','body','update','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','fullname','CmContact','lastName','push','Attachment','createdAt'];(function(_0x54f6aa,_0x3705b4){var _0x21f5d1=function(_0x599669){while(--_0x599669){_0x54f6aa['push'](_0x54f6aa['shift']());}};_0x21f5d1(++_0x3705b4);}(_0x030d,0x113));var _0xd030=function(_0x290e14,_0x53d210){_0x290e14=_0x290e14-0x0;var _0x2533ec=_0x030d[_0x290e14];return _0x2533ec;};'use strict';var rimraf=require(_0xd030('0x0'));var zipdir=require(_0xd030('0x1'));var moment=require('moment');var util=require(_0xd030('0x2'));var path=require('path');var ejs=require(_0xd030('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xd030('0x4'));var interaction=require(_0xd030('0x5'));var qs=require(_0xd030('0x6'));var pdf=require(_0xd030('0x7'));var logger=require(_0xd030('0x8'))(_0xd030('0x9'));var config=require('../../config/environment');var db=require(_0xd030('0xa'))['db'];config[_0xd030('0xb')]=_[_0xd030('0xc')](config[_0xd030('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd030('0xd'))(new Redis(config[_0xd030('0xb')]));require(_0xd030('0xe'))[_0xd030('0xf')](socket);function respondWithStatusCode(_0x3f879e,_0xa5c98e){_0xa5c98e=_0xa5c98e||0xcc;return function(_0x22a0d8){if(_0x22a0d8){return _0x3f879e[_0xd030('0x10')](_0xa5c98e);}return _0x3f879e[_0xd030('0x11')](_0xa5c98e)[_0xd030('0x12')]();};}function respondWithResult(_0x58b4a8,_0x36adaf){_0x36adaf=_0x36adaf||0xc8;return function(_0x3ea697){if(_0x3ea697){return _0x58b4a8['status'](_0x36adaf)['json'](_0x3ea697);}};}function respondWithFilteredResult(_0x5089ed,_0x55787c){return function(_0x269d31){if(_0x269d31){var _0x4e34d2=typeof _0x55787c[_0xd030('0x13')]===_0xd030('0x14')&&typeof _0x55787c[_0xd030('0x15')]===_0xd030('0x14');var _0x127506=_0x269d31[_0xd030('0x16')];var _0x3b2f6d=_0x4e34d2?0x0:_0x55787c[_0xd030('0x13')];var _0xfd7bc=_0x4e34d2?_0x269d31[_0xd030('0x16')]:_0x55787c[_0xd030('0x13')]+_0x55787c[_0xd030('0x15')];var _0x314201;if(_0xfd7bc>=_0x127506){_0xfd7bc=_0x127506;_0x314201=0xc8;}else{_0x314201=0xce;}_0x5089ed[_0xd030('0x11')](_0x314201);return _0x5089ed[_0xd030('0x17')](_0xd030('0x18'),_0x3b2f6d+'-'+_0xfd7bc+'/'+_0x127506)['json'](_0x269d31);}return null;};}function saveUpdates(_0x1d575a){return function(_0x41ead4){if(_0x41ead4){return _0x41ead4['update'](_0x1d575a)[_0xd030('0x19')](function(_0x65f66e){return _0x65f66e;});}return null;};}function removeEntity(_0x1dd3aa){return function(_0x46147b){if(_0x46147b){return _0x46147b[_0xd030('0x1a')]()[_0xd030('0x19')](function(){_0x1dd3aa['status'](0xcc)[_0xd030('0x12')]();});}};}function handleEntityNotFound(_0x489089){return function(_0x5259ea){if(!_0x5259ea){_0x489089[_0xd030('0x10')](0x194);}return _0x5259ea;};}function handleError(_0x3c6f72,_0x5e8419){_0x5e8419=_0x5e8419||0x1f4;return function(_0x5570a7){logger[_0xd030('0x1b')](_0x5570a7[_0xd030('0x1c')]);if(_0x5570a7[_0xd030('0x1d')]){delete _0x5570a7[_0xd030('0x1d')];}_0x3c6f72[_0xd030('0x11')](_0x5e8419)['send'](_0x5570a7);};}exports['index']=function(_0xa4f482,_0x4101aa){var _0x901223={};var _0x17fac8=_[_0xd030('0x1e')](db['OpenchannelInteraction'][_0xd030('0x1f')],function(_0x581c0e){return{'name':_0x581c0e[_0xd030('0x20')],'type':_0x581c0e[_0xd030('0x21')]['key']};});_0x901223=qs[_0xd030('0x22')](_0x17fac8,_0xa4f482);return interaction[_0xd030('0x23')](_0xd030('0x24'),_0xa4f482[_0xd030('0x25')],_0xa4f482[_0xd030('0x26')],_0x901223,_0x17fac8)[_0xd030('0x19')](respondWithFilteredResult(_0x4101aa,_0x901223))['catch'](handleError(_0x4101aa,null));};exports[_0xd030('0x27')]=function(_0x4b219f,_0x36ed34){var _0x424a1c={};if(_0x4b219f['query'][_0xd030('0x21')]&&_0x4b219f['query'][_0xd030('0x21')]===_0xd030('0x28')){_0x424a1c['from']=_0x4b219f['params']['id'];}else{_0x424a1c['id']=_0x4b219f[_0xd030('0x29')]['id'];}var _0x4203b0={'raw':![],'where':_0x424a1c},_0x42ef14={};_0x42ef14[_0xd030('0x2a')]=_[_0xd030('0x2b')](db[_0xd030('0x2c')][_0xd030('0x1f')]);_0x42ef14['query']=_['keys'](_0x4b219f[_0xd030('0x25')]);_0x42ef14[_0xd030('0x2d')]=_[_0xd030('0x2e')](_0x42ef14[_0xd030('0x2a')],_0x42ef14[_0xd030('0x25')]);_0x4203b0['attributes']=_[_0xd030('0x2e')](_0x42ef14[_0xd030('0x2a')],qs['fields'](_0x4b219f[_0xd030('0x25')]['fields']));_0x4203b0[_0xd030('0x2f')]=_0x4203b0[_0xd030('0x2f')][_0xd030('0x30')]?_0x4203b0[_0xd030('0x2f')]:_0x42ef14[_0xd030('0x2a')];if(_0x4b219f[_0xd030('0x25')][_0xd030('0x31')]){_0x4203b0[_0xd030('0x32')]=[{'all':!![]}];}_0x4203b0=_[_0xd030('0x33')]({},_0x4203b0,_0x4b219f[_0xd030('0x34')]);return db[_0xd030('0x2c')][_0xd030('0x35')](_0x4203b0)[_0xd030('0x19')](handleEntityNotFound(_0x36ed34,null))[_0xd030('0x19')](respondWithResult(_0x36ed34,null))[_0xd030('0x36')](handleError(_0x36ed34,null));};exports[_0xd030('0x37')]=function(_0x535646,_0x3c7231){return db[_0xd030('0x2c')][_0xd030('0x37')](_0x535646[_0xd030('0x38')],{})[_0xd030('0x19')](respondWithResult(_0x3c7231,0xc9))['catch'](handleError(_0x3c7231,null));};exports[_0xd030('0x39')]=function(_0x20365e,_0x3eaba9){if(_0x20365e[_0xd030('0x38')]['id']){delete _0x20365e[_0xd030('0x38')]['id'];}return db[_0xd030('0x2c')][_0xd030('0x35')]({'where':{'id':_0x20365e[_0xd030('0x29')]['id']}})['then'](handleEntityNotFound(_0x3eaba9,null))[_0xd030('0x19')](saveUpdates(_0x20365e[_0xd030('0x38')],null))['then'](respondWithResult(_0x3eaba9,null))[_0xd030('0x36')](handleError(_0x3eaba9,null));};exports['destroy']=function(_0x1fa9e6,_0x2944d6){return db[_0xd030('0x2c')]['find']({'where':{'id':_0x1fa9e6[_0xd030('0x29')]['id']}})[_0xd030('0x19')](handleEntityNotFound(_0x2944d6,null))[_0xd030('0x19')](removeEntity(_0x2944d6,null))[_0xd030('0x36')](handleError(_0x2944d6,null));};exports[_0xd030('0x3a')]=function(_0x4e0471,_0x3f1d6a){return db[_0xd030('0x2c')][_0xd030('0x3a')]()[_0xd030('0x19')](respondWithResult(_0x3f1d6a,null))[_0xd030('0x36')](handleError(_0x3f1d6a,null));};exports[_0xd030('0x3b')]=function(_0x1bd633,_0x45a1e9){return db[_0xd030('0x3c')][_0xd030('0x35')]({'where':{'id':_0x1bd633[_0xd030('0x29')]['id']}})['then'](handleEntityNotFound(_0x45a1e9,null))[_0xd030('0x19')](function(_0x318c9b){if(_0x318c9b){return _0x318c9b[_0xd030('0x3b')](_0x1bd633[_0xd030('0x38')][_0xd030('0x3d')],_[_0xd030('0x3e')](_0x1bd633[_0xd030('0x38')],[_0xd030('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x45a1e9,null))[_0xd030('0x36')](handleError(_0x45a1e9,null));};exports[_0xd030('0x3f')]=function(_0x3ff77a,_0xa98886){var _0x205433={'raw':![],'where':{}};var _0x177ba3={};var _0xaf4f52={'count':0x0,'rows':[]};return db[_0xd030('0x2c')][_0xd030('0x40')]({'where':{'id':_0x3ff77a[_0xd030('0x29')]['id']}})[_0xd030('0x19')](handleEntityNotFound(_0xa98886,null))['then'](function(_0x1890ab){if(_0x1890ab){_0x177ba3['model']=_['keys'](db[_0xd030('0x3c')]['rawAttributes']);_0x177ba3[_0xd030('0x25')]=_[_0xd030('0x2b')](_0x3ff77a[_0xd030('0x25')]);_0x177ba3[_0xd030('0x2d')]=_[_0xd030('0x2e')](_0x177ba3[_0xd030('0x2a')],_0x177ba3[_0xd030('0x25')]);_0x205433[_0xd030('0x2f')]=_[_0xd030('0x2e')](_0x177ba3[_0xd030('0x2a')],qs[_0xd030('0x41')](_0x3ff77a[_0xd030('0x25')][_0xd030('0x41')]));_0x205433[_0xd030('0x2f')]=_0x205433[_0xd030('0x2f')][_0xd030('0x30')]?_0x205433['attributes']:_0x177ba3[_0xd030('0x2a')];if(!_0x3ff77a[_0xd030('0x25')][_0xd030('0x42')](_0xd030('0x43'))){_0x205433[_0xd030('0x15')]=qs[_0xd030('0x15')](_0x3ff77a['query'][_0xd030('0x15')]);_0x205433[_0xd030('0x13')]=qs[_0xd030('0x13')](_0x3ff77a['query'][_0xd030('0x13')]);}_0x205433[_0xd030('0x44')]=qs[_0xd030('0x45')](_0x3ff77a[_0xd030('0x25')][_0xd030('0x45')]);_0x205433[_0xd030('0x46')]=qs[_0xd030('0x2d')](_[_0xd030('0x47')](_0x3ff77a[_0xd030('0x25')],_0x177ba3['filters']));_0x205433[_0xd030('0x46')]['OpenchannelInteractionId']=_0x1890ab['id'];if(_0x3ff77a[_0xd030('0x25')]['filter']){_0x205433[_0xd030('0x46')]=_['merge'](_0x205433['where'],{'$or':_['map'](_0x205433[_0xd030('0x2f')],function(_0x5d6d59){var _0x3ec8ef={};_0x3ec8ef[_0x5d6d59]={'$like':'%'+_0x3ff77a['query'][_0xd030('0x48')]+'%'};return _0x3ec8ef;})});}if(_0x3ff77a['query'][_0xd030('0x49')]){var _0x25f53c=_0x3ff77a['query']['$gte']['split'](',');var _0x11c6b7={};_0x11c6b7[_0x25f53c[0x0]]={'$gte':moment(_0x25f53c[0x1])[_0xd030('0x4a')](_0xd030('0x4b'))};_0x205433[_0xd030('0x46')]=_['merge'](_0x205433['where'],_0x11c6b7);}_0x205433=_[_0xd030('0x33')]({},_0x205433,_0x3ff77a[_0xd030('0x34')]);return db[_0xd030('0x3c')][_0xd030('0x16')]({'where':_0x205433['where']})[_0xd030('0x19')](function(_0x340916){_0xaf4f52[_0xd030('0x16')]=_0x340916;if(_0x3ff77a['query']['includeAll']){_0x205433[_0xd030('0x32')]=[{'all':!![]}];}return db[_0xd030('0x3c')][_0xd030('0x23')](_0x205433);})[_0xd030('0x19')](function(_0x5a7f2d){_0xaf4f52[_0xd030('0x4c')]=_0x5a7f2d;return _0xaf4f52;});}})[_0xd030('0x19')](respondWithFilteredResult(_0xa98886,_0x205433))[_0xd030('0x36')](handleError(_0xa98886,null));};exports['addTags']=function(_0x41dd61,_0x32a358){return db[_0xd030('0x2c')][_0xd030('0x35')]({'where':{'id':_0x41dd61[_0xd030('0x29')]['id']}})[_0xd030('0x19')](handleEntityNotFound(_0x32a358,null))[_0xd030('0x19')](function(_0x256024){if(_0x256024){return _0x256024[_0xd030('0x4d')](_0x41dd61[_0xd030('0x38')]['ids'],_[_0xd030('0x3e')](_0x41dd61['body'],[_0xd030('0x3d'),'id'])||{})[_0xd030('0x4e')](function(){return db[_0xd030('0x4f')][_0xd030('0x23')]({'attributes':['id',_0xd030('0x1d'),'color'],'where':{'id':_0x41dd61[_0xd030('0x38')][_0xd030('0x3d')]}});})[_0xd030('0x19')](function(_0x5d79fb){socket[_0xd030('0x50')](_0xd030('0x51'),{'id':Number(_0x41dd61[_0xd030('0x29')]['id']),'tags':_0x5d79fb||[]});return{'id':Number(_0x41dd61[_0xd030('0x29')]['id']),'tags':_0x5d79fb||[]};});}})[_0xd030('0x19')](respondWithResult(_0x32a358,null))[_0xd030('0x36')](handleError(_0x32a358,null));};exports[_0xd030('0x52')]=function(_0x5211e3,_0x47000a){return db[_0xd030('0x2c')][_0xd030('0x35')]({'where':{'id':_0x5211e3[_0xd030('0x29')]['id']}})['then'](handleEntityNotFound(_0x47000a,null))[_0xd030('0x19')](function(_0xb5ed58){if(_0xb5ed58){return _0xb5ed58[_0xd030('0x52')](_0x5211e3[_0xd030('0x25')]['ids']);}})[_0xd030('0x19')](respondWithStatusCode(_0x47000a,null))[_0xd030('0x36')](handleError(_0x47000a,null));};exports[_0xd030('0x53')]=function(_0x538467,_0x29fef7){var _0x297f34=moment()[_0xd030('0x54')]()[_0xd030('0x55')]();var _0x1f8368=path[_0xd030('0x56')](config[_0xd030('0x57')],_0xd030('0x58'),_0xd030('0x59'),_0xd030('0x5a'));var _0x13bccf=path[_0xd030('0x56')](config[_0xd030('0x57')],'server',_0xd030('0x59'),_0xd030('0x5b'));var _0x1fabc9=path[_0xd030('0x56')](_0x1f8368,_0x297f34);var _0x5f2ccd=util[_0xd030('0x4a')](_0xd030('0x5c'),_0x538467[_0xd030('0x29')]['id'],_0x297f34);var _0x43c89e=path[_0xd030('0x56')](_0x1f8368,_0x5f2ccd);var _0x2b21ea=[];_0x2b21ea['push']({'model':db[_0xd030('0x5d')],'as':_0xd030('0x5d'),'attributes':['id',_0xd030('0x5e')],'raw':!![]});_0x2b21ea['push']({'model':db[_0xd030('0x5f')],'as':'Contact','attributes':['id','firstName',_0xd030('0x60')],'raw':!![]});if(_0x538467['query'][_0xd030('0x5b')]){_0x2b21ea[_0xd030('0x61')]({'model':db['Attachment'],'as':_0xd030('0x62'),'raw':!![]});}var _0x113f1d=[{'model':db[_0xd030('0x3c')],'as':'Messages','attributes':['id',_0xd030('0x38'),_0xd030('0x63'),_0xd030('0x64'),_0xd030('0x65'),'read'],'include':_0x2b21ea}];_0x113f1d[_0xd030('0x61')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id',_0xd030('0x1d')]});_0x113f1d['push']({'model':db[_0xd030('0x5d')],'as':_0xd030('0x66'),'attributes':['id',_0xd030('0x5e')]});return db[_0xd030('0x2c')][_0xd030('0x35')]({'where':{'id':_0x538467[_0xd030('0x29')]['id']},'include':_0x113f1d})[_0xd030('0x19')](handleEntityNotFound(_0x29fef7,null))[_0xd030('0x19')](function(_0x4e55b0){if(_0x4e55b0){var _0x2ec5dd=_0x4e55b0[_0xd030('0x67')]({'plain':!![]});fs['mkdirSync'](_0x1fabc9);var _0x549ea0={'channel':_0xd030('0x68'),'account':_0x2ec5dd['Account'][_0xd030('0x1d')],'agent':_0x2ec5dd[_0xd030('0x66')]?_0x2ec5dd[_0xd030('0x66')][_0xd030('0x5e')]:_0xd030('0x69'),'createdAt':moment(_0x2ec5dd['createdAt'])['format'](_0xd030('0x4b'))[_0xd030('0x55')](),'closedAt':_0x2ec5dd[_0xd030('0x6a')]?moment(_0x2ec5dd[_0xd030('0x6b')])['format'](_0xd030('0x4b'))[_0xd030('0x55')]():'','disposition':_0x2ec5dd[_0xd030('0x6c')],'visibility':_0x2ec5dd[_0xd030('0x6d')]?'Public':_0xd030('0x6e'),'messages':_(_0x2ec5dd['Messages'])[_0xd030('0x48')]({'secret':![]})['map'](function(_0x36012c){if(_0x36012c[_0xd030('0x62')]){var _0x5e5034=path[_0xd030('0x56')](_0x13bccf,_0x36012c[_0xd030('0x62')]['basename']);if(fs[_0xd030('0x6f')](_0x5e5034)){fs[_0xd030('0x70')](_0x5e5034)[_0xd030('0x71')](fs['createWriteStream'](path[_0xd030('0x56')](_0x1fabc9,_0x36012c[_0xd030('0x62')][_0xd030('0x72')])));}}return{'date':moment(_0x36012c['createdAt'])[_0xd030('0x4a')](_0xd030('0x4b'))[_0xd030('0x55')](),'sender':_0x36012c['direction']===_0xd030('0x73')?_0x36012c[_0xd030('0x5d')]?_0x36012c[_0xd030('0x5d')][_0xd030('0x5e')]:_0xd030('0x74'):_0x36012c['Contact']['firstName']+(_0x36012c[_0xd030('0x75')][_0xd030('0x60')]?'\x20'+_0x36012c['Contact'][_0xd030('0x60')]:''),'body':_0x36012c[_0xd030('0x62')]?_0x36012c[_0xd030('0x62')][_0xd030('0x72')]:_0x36012c[_0xd030('0x38')],'direction':_0x36012c[_0xd030('0x64')]===_0xd030('0x73')?'A':'C','secret':_0x36012c[_0xd030('0x65')],'read':_0x36012c['read'],'attachment':_0x36012c[_0xd030('0x62')]};})[_0xd030('0x76')]()};return ejs[_0xd030('0x77')](path[_0xd030('0x56')](config[_0xd030('0x57')],'server',_0xd030('0x78'),_0xd030('0x79')),{'interaction':_0x549ea0})[_0xd030('0x19')](function(_0x50befe){var _0x350685=path[_0xd030('0x56')](_0x1fabc9,'transcript-'+_0x2ec5dd['id']+'-'+_0x297f34+'.pdf');var _0x953cd2={'path':_0x350685,'channel':_0xd030('0x68'),'interactionId':_0x2ec5dd['id']};return pdf[_0xd030('0x7a')](_0x50befe,_0x953cd2);})['then'](function(){return new Promise(function(_0x3fff61,_0x5a191c){zipdir(_0x1fabc9,{'saveTo':_0x43c89e},function(_0x2a56d1,_0x2a8972){if(_0x2a56d1)return _0x5a191c(_0x2a56d1);return _0x3fff61(_0x2a8972);});})[_0xd030('0x19')](function(){return new Promise(function(_0x2827e4,_0x119416){rimraf(_0x1fabc9,function(_0x5e440d){if(_0x5e440d)_0x119416(_0x5e440d);return _0x2827e4();});});})[_0xd030('0x19')](function(){return _0x29fef7['download'](_0x43c89e,_0x5f2ccd,function(_0x1a5ffc){if(_0x1a5ffc){logger[_0xd030('0x1b')](_0xd030('0x7b'),_0x1a5ffc);}else{fs[_0xd030('0x7c')](_0x43c89e);}});});});}else{return _0x29fef7[_0xd030('0x10')](0xc8);}})[_0xd030('0x36')](handleError(_0x29fef7,null));}; \ No newline at end of file +var _0x5345=['from','params','OpenchannelInteraction','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','findOne','rawAttributes','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','disposition','threadId','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','moment','util','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','fieldName','type','findAll','user','catch','show','query'];(function(_0x58ddd1,_0x58c480){var _0x596924=function(_0x1f3138){while(--_0x1f3138){_0x58ddd1['push'](_0x58ddd1['shift']());}};_0x596924(++_0x58c480);}(_0x5345,0xdf));var _0x5534=function(_0x19db35,_0x935ad2){_0x19db35=_0x19db35-0x0;var _0x187b19=_0x5345[_0x19db35];return _0x187b19;};'use strict';var rimraf=require(_0x5534('0x0'));var zipdir=require('zip-dir');var moment=require(_0x5534('0x1'));var util=require(_0x5534('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5534('0x3'));var Redis=require(_0x5534('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x5534('0x5'));var pdf=require(_0x5534('0x6'));var logger=require(_0x5534('0x7'))('api');var config=require('../../config/environment');var db=require(_0x5534('0x8'))['db'];config[_0x5534('0x9')]=_['defaults'](config['redis'],{'host':_0x5534('0xa'),'port':0x18eb});var socket=require(_0x5534('0xb'))(new Redis(config[_0x5534('0x9')]));require(_0x5534('0xc'))[_0x5534('0xd')](socket);function respondWithStatusCode(_0x36049b,_0x2fed0d){_0x2fed0d=_0x2fed0d||0xcc;return function(_0x4b4ad9){if(_0x4b4ad9){return _0x36049b[_0x5534('0xe')](_0x2fed0d);}return _0x36049b[_0x5534('0xf')](_0x2fed0d)['end']();};}function respondWithResult(_0x16b2da,_0x3d03b2){_0x3d03b2=_0x3d03b2||0xc8;return function(_0x582352){if(_0x582352){return _0x16b2da['status'](_0x3d03b2)[_0x5534('0x10')](_0x582352);}};}function respondWithFilteredResult(_0x407ba8,_0x5b54e2){return function(_0x22cc08){if(_0x22cc08){var _0x569e86=typeof _0x5b54e2[_0x5534('0x11')]==='undefined'&&typeof _0x5b54e2[_0x5534('0x12')]===_0x5534('0x13');var _0x488674=_0x22cc08[_0x5534('0x14')];var _0x2bed1f=_0x569e86?0x0:_0x5b54e2[_0x5534('0x11')];var _0x2e5425=_0x569e86?_0x22cc08['count']:_0x5b54e2[_0x5534('0x11')]+_0x5b54e2['limit'];var _0x340b68;if(_0x2e5425>=_0x488674){_0x2e5425=_0x488674;_0x340b68=0xc8;}else{_0x340b68=0xce;}_0x407ba8[_0x5534('0xf')](_0x340b68);return _0x407ba8[_0x5534('0x15')](_0x5534('0x16'),_0x2bed1f+'-'+_0x2e5425+'/'+_0x488674)['json'](_0x22cc08);}return null;};}function saveUpdates(_0x3e7f00){return function(_0xa4f810){if(_0xa4f810){return _0xa4f810[_0x5534('0x17')](_0x3e7f00)[_0x5534('0x18')](function(_0x2854ec){return _0x2854ec;});}return null;};}function removeEntity(_0x452322){return function(_0x3b0f1e){if(_0x3b0f1e){return _0x3b0f1e[_0x5534('0x19')]()[_0x5534('0x18')](function(){_0x452322[_0x5534('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31841a){return function(_0x4b3d3a){if(!_0x4b3d3a){_0x31841a[_0x5534('0xe')](0x194);}return _0x4b3d3a;};}function handleError(_0x32f6b2,_0x37fd30){_0x37fd30=_0x37fd30||0x1f4;return function(_0x986ccf){logger[_0x5534('0x1a')](_0x986ccf[_0x5534('0x1b')]);if(_0x986ccf[_0x5534('0x1c')]){delete _0x986ccf[_0x5534('0x1c')];}_0x32f6b2['status'](_0x37fd30)[_0x5534('0x1d')](_0x986ccf);};}exports[_0x5534('0x1e')]=function(_0x473f01,_0x2d202d){var _0x38dc63={};var _0x28b023=_[_0x5534('0x1f')](db['OpenchannelInteraction']['rawAttributes'],function(_0x3b2ae5){return{'name':_0x3b2ae5[_0x5534('0x20')],'type':_0x3b2ae5[_0x5534('0x21')]['key']};});_0x38dc63=qs['getOptions'](_0x28b023,_0x473f01);return interaction[_0x5534('0x22')]('openchannel',_0x473f01['query'],_0x473f01[_0x5534('0x23')],_0x38dc63,_0x28b023)[_0x5534('0x18')](respondWithFilteredResult(_0x2d202d,_0x38dc63))[_0x5534('0x24')](handleError(_0x2d202d,null));};exports[_0x5534('0x25')]=function(_0x358f52,_0x5e37d5){var _0x1dbd18={};if(_0x358f52[_0x5534('0x26')]['type']&&_0x358f52[_0x5534('0x26')][_0x5534('0x21')]===_0x5534('0x27')){_0x1dbd18[_0x5534('0x27')]=_0x358f52[_0x5534('0x28')]['id'];}else{_0x1dbd18['id']=_0x358f52['params']['id'];}var _0x51cd78={'raw':![],'where':_0x1dbd18},_0x40fb97={};_0x40fb97['model']=_['keys'](db[_0x5534('0x29')]['rawAttributes']);_0x40fb97[_0x5534('0x26')]=_[_0x5534('0x2a')](_0x358f52[_0x5534('0x26')]);_0x40fb97[_0x5534('0x2b')]=_[_0x5534('0x2c')](_0x40fb97[_0x5534('0x2d')],_0x40fb97[_0x5534('0x26')]);_0x51cd78[_0x5534('0x2e')]=_[_0x5534('0x2c')](_0x40fb97[_0x5534('0x2d')],qs[_0x5534('0x2f')](_0x358f52[_0x5534('0x26')]['fields']));_0x51cd78[_0x5534('0x2e')]=_0x51cd78['attributes'][_0x5534('0x30')]?_0x51cd78[_0x5534('0x2e')]:_0x40fb97[_0x5534('0x2d')];if(_0x358f52['query'][_0x5534('0x31')]){_0x51cd78['include']=[{'all':!![]}];}_0x51cd78=_[_0x5534('0x32')]({},_0x51cd78,_0x358f52[_0x5534('0x33')]);return db['OpenchannelInteraction'][_0x5534('0x34')](_0x51cd78)[_0x5534('0x18')](handleEntityNotFound(_0x5e37d5,null))['then'](respondWithResult(_0x5e37d5,null))[_0x5534('0x24')](handleError(_0x5e37d5,null));};exports[_0x5534('0x35')]=function(_0x19513c,_0x5c5956){return db[_0x5534('0x29')][_0x5534('0x35')](_0x19513c[_0x5534('0x36')],{})['then'](respondWithResult(_0x5c5956,0xc9))[_0x5534('0x24')](handleError(_0x5c5956,null));};exports[_0x5534('0x17')]=function(_0x4a418c,_0x2bcc8e){if(_0x4a418c[_0x5534('0x36')]['id']){delete _0x4a418c['body']['id'];}return db[_0x5534('0x29')][_0x5534('0x34')]({'where':{'id':_0x4a418c[_0x5534('0x28')]['id']}})[_0x5534('0x18')](handleEntityNotFound(_0x2bcc8e,null))['then'](saveUpdates(_0x4a418c[_0x5534('0x36')],null))[_0x5534('0x18')](respondWithResult(_0x2bcc8e,null))[_0x5534('0x24')](handleError(_0x2bcc8e,null));};exports[_0x5534('0x19')]=function(_0x5cd14e,_0x5a1c30){return db[_0x5534('0x29')][_0x5534('0x34')]({'where':{'id':_0x5cd14e[_0x5534('0x28')]['id']}})[_0x5534('0x18')](handleEntityNotFound(_0x5a1c30,null))[_0x5534('0x18')](removeEntity(_0x5a1c30,null))[_0x5534('0x24')](handleError(_0x5a1c30,null));};exports['describe']=function(_0x3441f2,_0x274ad1){return db['OpenchannelInteraction'][_0x5534('0x37')]()[_0x5534('0x18')](respondWithResult(_0x274ad1,null))[_0x5534('0x24')](handleError(_0x274ad1,null));};exports[_0x5534('0x38')]=function(_0x289bca,_0x551bec){return db[_0x5534('0x39')]['find']({'where':{'id':_0x289bca[_0x5534('0x28')]['id']}})[_0x5534('0x18')](handleEntityNotFound(_0x551bec,null))[_0x5534('0x18')](function(_0x4b612){if(_0x4b612){return _0x4b612['addMessage'](_0x289bca[_0x5534('0x36')][_0x5534('0x3a')],_[_0x5534('0x3b')](_0x289bca[_0x5534('0x36')],[_0x5534('0x3a'),'id'])||{});}})[_0x5534('0x18')](respondWithResult(_0x551bec,null))['catch'](handleError(_0x551bec,null));};exports['getMessages']=function(_0x373004,_0x5cbf0b){var _0x3aefea={'raw':![],'where':{}};var _0x165018={};var _0x42e736={'count':0x0,'rows':[]};return db[_0x5534('0x29')][_0x5534('0x3c')]({'where':{'id':_0x373004[_0x5534('0x28')]['id']}})[_0x5534('0x18')](handleEntityNotFound(_0x5cbf0b,null))[_0x5534('0x18')](function(_0x1e3706){if(_0x1e3706){_0x165018[_0x5534('0x2d')]=_['keys'](db[_0x5534('0x39')][_0x5534('0x3d')]);_0x165018['query']=_[_0x5534('0x2a')](_0x373004[_0x5534('0x26')]);_0x165018['filters']=_['intersection'](_0x165018[_0x5534('0x2d')],_0x165018[_0x5534('0x26')]);_0x3aefea[_0x5534('0x2e')]=_[_0x5534('0x2c')](_0x165018['model'],qs[_0x5534('0x2f')](_0x373004['query'][_0x5534('0x2f')]));_0x3aefea[_0x5534('0x2e')]=_0x3aefea['attributes'][_0x5534('0x30')]?_0x3aefea['attributes']:_0x165018[_0x5534('0x2d')];if(!_0x373004[_0x5534('0x26')][_0x5534('0x3e')](_0x5534('0x3f'))){_0x3aefea[_0x5534('0x12')]=qs[_0x5534('0x12')](_0x373004[_0x5534('0x26')][_0x5534('0x12')]);_0x3aefea[_0x5534('0x11')]=qs[_0x5534('0x11')](_0x373004[_0x5534('0x26')][_0x5534('0x11')]);}_0x3aefea[_0x5534('0x40')]=qs[_0x5534('0x41')](_0x373004['query'][_0x5534('0x41')]);_0x3aefea[_0x5534('0x42')]=qs['filters'](_[_0x5534('0x43')](_0x373004[_0x5534('0x26')],_0x165018['filters']));_0x3aefea[_0x5534('0x42')][_0x5534('0x44')]=_0x1e3706['id'];if(_0x373004['query'][_0x5534('0x45')]){_0x3aefea[_0x5534('0x42')]=_['merge'](_0x3aefea[_0x5534('0x42')],{'$or':_[_0x5534('0x1f')](_0x3aefea[_0x5534('0x2e')],function(_0x2486a9){var _0x252080={};_0x252080[_0x2486a9]={'$like':'%'+_0x373004[_0x5534('0x26')]['filter']+'%'};return _0x252080;})});}if(_0x373004[_0x5534('0x26')]['$gte']){var _0x3cc599=_0x373004[_0x5534('0x26')]['$gte']['split'](',');var _0x1e8ea4={};_0x1e8ea4[_0x3cc599[0x0]]={'$gte':moment(_0x3cc599[0x1])[_0x5534('0x46')](_0x5534('0x47'))};_0x3aefea[_0x5534('0x42')]=_[_0x5534('0x32')](_0x3aefea[_0x5534('0x42')],_0x1e8ea4);}_0x3aefea=_[_0x5534('0x32')]({},_0x3aefea,_0x373004[_0x5534('0x33')]);return db[_0x5534('0x39')][_0x5534('0x14')]({'where':_0x3aefea[_0x5534('0x42')]})[_0x5534('0x18')](function(_0x5def09){_0x42e736[_0x5534('0x14')]=_0x5def09;if(_0x373004[_0x5534('0x26')][_0x5534('0x31')]){_0x3aefea[_0x5534('0x48')]=[{'all':!![]}];}return db[_0x5534('0x39')][_0x5534('0x22')](_0x3aefea);})[_0x5534('0x18')](function(_0x2f5f4c){_0x42e736[_0x5534('0x49')]=_0x2f5f4c;return _0x42e736;});}})['then'](respondWithFilteredResult(_0x5cbf0b,_0x3aefea))[_0x5534('0x24')](handleError(_0x5cbf0b,null));};exports['addTags']=function(_0x5ead98,_0x44daee){return db[_0x5534('0x29')]['find']({'where':{'id':_0x5ead98[_0x5534('0x28')]['id']}})[_0x5534('0x18')](handleEntityNotFound(_0x44daee,null))['then'](function(_0x4aed57){if(_0x4aed57){return _0x4aed57[_0x5534('0x4a')](_0x5ead98[_0x5534('0x36')][_0x5534('0x3a')],_[_0x5534('0x3b')](_0x5ead98[_0x5534('0x36')],['ids','id'])||{})[_0x5534('0x4b')](function(){return db[_0x5534('0x4c')]['findAll']({'attributes':['id',_0x5534('0x1c'),_0x5534('0x4d')],'where':{'id':_0x5ead98[_0x5534('0x36')][_0x5534('0x3a')]}});})[_0x5534('0x18')](function(_0x5eb6da){socket[_0x5534('0x4e')](_0x5534('0x4f'),{'id':Number(_0x5ead98[_0x5534('0x28')]['id']),'tags':_0x5eb6da||[]});return{'id':Number(_0x5ead98[_0x5534('0x28')]['id']),'tags':_0x5eb6da||[]};});}})['then'](respondWithResult(_0x44daee,null))[_0x5534('0x24')](handleError(_0x44daee,null));};exports[_0x5534('0x50')]=function(_0x33cd53,_0x3d1ef3){return db[_0x5534('0x29')][_0x5534('0x34')]({'where':{'id':_0x33cd53[_0x5534('0x28')]['id']}})[_0x5534('0x18')](handleEntityNotFound(_0x3d1ef3,null))[_0x5534('0x18')](function(_0x2c22a1){if(_0x2c22a1){return _0x2c22a1['removeTags'](_0x33cd53[_0x5534('0x26')][_0x5534('0x3a')]);}})[_0x5534('0x18')](respondWithStatusCode(_0x3d1ef3,null))[_0x5534('0x24')](handleError(_0x3d1ef3,null));};exports[_0x5534('0x51')]=function(_0x2f40e1,_0x13f66b){var _0x23d4c1=moment()[_0x5534('0x52')]()[_0x5534('0x53')]();var _0x586de2=path[_0x5534('0x54')](config['root'],_0x5534('0x55'),_0x5534('0x56'),_0x5534('0x57'));var _0x24eea9=path[_0x5534('0x54')](config[_0x5534('0x58')],_0x5534('0x55'),'files',_0x5534('0x59'));var _0x30c1e7=path[_0x5534('0x54')](_0x586de2,_0x23d4c1);var _0x42e117=util[_0x5534('0x46')](_0x5534('0x5a'),_0x2f40e1[_0x5534('0x28')]['id'],_0x23d4c1);var _0x37242e=path[_0x5534('0x54')](_0x586de2,_0x42e117);var _0x172566=[];_0x172566['push']({'model':db['User'],'as':_0x5534('0x5b'),'attributes':['id',_0x5534('0x5c')],'raw':!![]});_0x172566[_0x5534('0x5d')]({'model':db[_0x5534('0x5e')],'as':_0x5534('0x5f'),'attributes':['id',_0x5534('0x60'),'lastName'],'raw':!![]});if(_0x2f40e1[_0x5534('0x26')][_0x5534('0x59')]){_0x172566[_0x5534('0x5d')]({'model':db[_0x5534('0x61')],'as':'Attachment','raw':!![]});}var _0x56c455=[{'model':db[_0x5534('0x39')],'as':_0x5534('0x62'),'attributes':['id',_0x5534('0x36'),_0x5534('0x63'),_0x5534('0x64'),_0x5534('0x65'),_0x5534('0x66')],'include':_0x172566}];_0x56c455['push']({'model':db[_0x5534('0x67')],'as':_0x5534('0x68'),'attributes':['id',_0x5534('0x1c')]});_0x56c455[_0x5534('0x5d')]({'model':db[_0x5534('0x5b')],'as':_0x5534('0x69'),'attributes':['id',_0x5534('0x5c')]});return db[_0x5534('0x29')][_0x5534('0x34')]({'where':{'id':_0x2f40e1[_0x5534('0x28')]['id']},'include':_0x56c455})[_0x5534('0x18')](handleEntityNotFound(_0x13f66b,null))[_0x5534('0x18')](function(_0x31a446){if(_0x31a446){var _0x2eb7d9=_0x31a446[_0x5534('0x6a')]({'plain':!![]});fs[_0x5534('0x6b')](_0x30c1e7);var _0x22b031={'channel':_0x5534('0x6c'),'account':_0x2eb7d9['Account'][_0x5534('0x1c')],'agent':_0x2eb7d9[_0x5534('0x69')]?_0x2eb7d9[_0x5534('0x69')][_0x5534('0x5c')]:_0x5534('0x6d'),'createdAt':moment(_0x2eb7d9[_0x5534('0x63')])[_0x5534('0x46')](_0x5534('0x47'))[_0x5534('0x53')](),'closedAt':_0x2eb7d9[_0x5534('0x6e')]?moment(_0x2eb7d9[_0x5534('0x6f')])[_0x5534('0x46')](_0x5534('0x47'))[_0x5534('0x53')]():'','disposition':_0x2eb7d9[_0x5534('0x70')],'visibility':_0x2eb7d9[_0x5534('0x71')]?'Public':_0x5534('0x72'),'messages':_(_0x2eb7d9[_0x5534('0x62')])['filter']({'secret':![]})['map'](function(_0x2642ce){if(_0x2642ce['Attachment']){var _0x3af121=path[_0x5534('0x54')](_0x24eea9,_0x2642ce[_0x5534('0x61')][_0x5534('0x73')]);if(fs[_0x5534('0x74')](_0x3af121)){fs[_0x5534('0x75')](_0x3af121)[_0x5534('0x76')](fs[_0x5534('0x77')](path[_0x5534('0x54')](_0x30c1e7,_0x2642ce[_0x5534('0x61')][_0x5534('0x73')])));}}return{'date':moment(_0x2642ce[_0x5534('0x63')])[_0x5534('0x46')](_0x5534('0x47'))[_0x5534('0x53')](),'sender':_0x2642ce[_0x5534('0x64')]===_0x5534('0x78')?_0x2642ce['User']?_0x2642ce['User'][_0x5534('0x5c')]:_0x5534('0x79'):_0x2642ce['Contact'][_0x5534('0x60')]+(_0x2642ce[_0x5534('0x5f')]['lastName']?'\x20'+_0x2642ce[_0x5534('0x5f')][_0x5534('0x7a')]:''),'body':_0x2642ce['Attachment']?_0x2642ce[_0x5534('0x61')][_0x5534('0x73')]:_0x2642ce[_0x5534('0x36')],'direction':_0x2642ce[_0x5534('0x64')]===_0x5534('0x78')?'A':'C','secret':_0x2642ce[_0x5534('0x65')],'read':_0x2642ce['read'],'attachment':_0x2642ce[_0x5534('0x61')]};})[_0x5534('0x7b')]()};return ejs[_0x5534('0x7c')](path[_0x5534('0x54')](config[_0x5534('0x58')],_0x5534('0x55'),_0x5534('0x7d'),_0x5534('0x7e')),{'interaction':_0x22b031})[_0x5534('0x18')](function(_0x25e8b9){var _0x470030=path[_0x5534('0x54')](_0x30c1e7,_0x5534('0x7f')+_0x2eb7d9['id']+'-'+_0x23d4c1+_0x5534('0x80'));var _0x3e2831={'path':_0x470030,'channel':_0x5534('0x6c'),'interactionId':_0x2eb7d9['id']};return pdf[_0x5534('0x81')](_0x25e8b9,_0x3e2831);})[_0x5534('0x18')](function(){return new Promise(function(_0x27e9a5,_0x3af18e){zipdir(_0x30c1e7,{'saveTo':_0x37242e},function(_0x59d4c5,_0x2fe2b5){if(_0x59d4c5)return _0x3af18e(_0x59d4c5);return _0x27e9a5(_0x2fe2b5);});})['then'](function(){return new Promise(function(_0x5d1b46,_0x42cfba){rimraf(_0x30c1e7,function(_0x31bb90){if(_0x31bb90)_0x42cfba(_0x31bb90);return _0x5d1b46();});});})[_0x5534('0x18')](function(){return _0x13f66b['download'](_0x37242e,_0x42e117,function(_0x3a6e8c){if(_0x3a6e8c){logger[_0x5534('0x1a')](_0x5534('0x82'),_0x3a6e8c);}else{fs['unlinkSync'](_0x37242e);}});});});}else{return _0x13f66b[_0x5534('0xe')](0xc8);}})[_0x5534('0x24')](handleError(_0x13f66b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f073426..cdf5ba0 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 _0xee8f=['catch','hasOwnProperty','hook','../../mysqldb','OpenchannelMessage','setMaxListeners','save','then','map','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xee8f,0x1ed));var _0xfee8=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xee8f[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xfee8('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xfee8('0x0'))['db'][_0xfee8('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xfee8('0x2')](0x0);var events={'afterCreate':_0xfee8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x55be8b){return function(_0x1652fc,_0x32ac18,_0x42dfba){_0x1652fc['getUsers']({'attributes':['id'],'raw':!![]})[_0xfee8('0x4')](function(_0x38d68c){_0x1652fc['setDataValue']('Users',_0x38d68c[_0xfee8('0x5')](function(_0x1a3966){return{'id':_0x1a3966['id']};}));return OpenchannelMessage[_0xfee8('0x6')]({'where':{'OpenchannelInteractionId':_0x1652fc['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4fc2e8){_0x1652fc[_0xfee8('0x7')](_0xfee8('0x8'),_0x4fc2e8[_0xfee8('0x9')]);OpenchannelInteractionEvents[_0xfee8('0xa')](_0x55be8b+':'+_0x1652fc['id'],_0x1652fc);OpenchannelInteractionEvents[_0xfee8('0xa')](_0x55be8b,_0x1652fc);_0x42dfba(null);})[_0xfee8('0xb')](_0x42dfba(null));};}for(var e in events){if(events[_0xfee8('0xc')](e)){var event=events[e];OpenchannelInteraction[_0xfee8('0xd')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4529=['length','emit','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','setDataValue','Users','map','then','unreadMessages'];(function(_0x385dd3,_0xae08ac){var _0x3abc7e=function(_0xa33f7d){while(--_0xa33f7d){_0x385dd3['push'](_0x385dd3['shift']());}};_0x3abc7e(++_0xae08ac);}(_0x4529,0x199));var _0x9452=function(_0x8c358f,_0x442bc7){_0x8c358f=_0x8c358f-0x0;var _0x4ca01d=_0x4529[_0x8c358f];return _0x4ca01d;};'use strict';var EventEmitter=require(_0x9452('0x0'));var OpenchannelInteraction=require(_0x9452('0x1'))['db'][_0x9452('0x2')];var OpenchannelMessage=require(_0x9452('0x1'))['db'][_0x9452('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x9452('0x4')](0x0);var events={'afterCreate':_0x9452('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x457b64){return function(_0x4f107f,_0x4595da,_0x2c5dbb){_0x4f107f['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2d0961){_0x4f107f[_0x9452('0x6')](_0x9452('0x7'),_0x2d0961[_0x9452('0x8')](function(_0x264010){return{'id':_0x264010['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4f107f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9452('0x9')](function(_0x40c704){_0x4f107f[_0x9452('0x6')](_0x9452('0xa'),_0x40c704[_0x9452('0xb')]);OpenchannelInteractionEvents[_0x9452('0xc')](_0x457b64+':'+_0x4f107f['id'],_0x4f107f);OpenchannelInteractionEvents['emit'](_0x457b64,_0x4f107f);_0x2c5dbb(null);})['catch'](_0x2c5dbb(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x9452('0xd')](e,emitEvent(event));}}module[_0x9452('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index b2b61b8..96a694b 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 _0x891b=['rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x3a5c57,_0x6782d0){var _0x207cf0=function(_0x5a7b3e){while(--_0x5a7b3e){_0x3a5c57['push'](_0x3a5c57['shift']());}};_0x207cf0(++_0x6782d0);}(_0x891b,0xfe));var _0xb891=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x891b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb891('0x0'));var util=require(_0xb891('0x1'));var logger=require(_0xb891('0x2'))('api');var moment=require(_0xb891('0x3'));var BPromise=require('bluebird');var rp=require(_0xb891('0x4'));var fs=require('fs');var path=require(_0xb891('0x5'));var rimraf=require(_0xb891('0x6'));var config=require(_0xb891('0x7'));var attributes=require(_0xb891('0x8'));module[_0xb891('0x9')]=function(_0x1be320,_0x21f757){return _0x1be320[_0xb891('0xa')](_0xb891('0xb'),attributes,{'tableName':_0xb891('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb891('0xd'),'collate':_0xb891('0xe'),'hooks':{'beforeUpdate':function(_0x436d42,_0x4ec9c0,_0x34847d){if(_0x436d42[_0xb891('0xf')](_0xb891('0x10'))){_0x436d42[_0xb891('0x11')]=moment()[_0xb891('0x12')](_0xb891('0x13'));}_0x34847d(null,_0x436d42);}}});}; \ No newline at end of file +var _0x4a5a=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','util'];(function(_0x58075c,_0x3e786f){var _0x3b96b0=function(_0x4d73bb){while(--_0x4d73bb){_0x58075c['push'](_0x58075c['shift']());}};_0x3b96b0(++_0x3e786f);}(_0x4a5a,0xe0));var _0xa4a5=function(_0x22ba7c,_0x254e46){_0x22ba7c=_0x22ba7c-0x0;var _0x3047b5=_0x4a5a[_0x22ba7c];return _0x3047b5;};'use strict';var _=require('lodash');var util=require(_0xa4a5('0x0'));var logger=require(_0xa4a5('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa4a5('0x2'));var rp=require(_0xa4a5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4a5('0x4'));var config=require(_0xa4a5('0x5'));var attributes=require(_0xa4a5('0x6'));module[_0xa4a5('0x7')]=function(_0x3d2837,_0x9670ce){return _0x3d2837['define']('OpenchannelInteraction',attributes,{'tableName':_0xa4a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa4a5('0x9'),'collate':_0xa4a5('0xa'),'hooks':{'beforeUpdate':function(_0x5bd3d2,_0x5d39db,_0x5bc7fa){if(_0x5bd3d2[_0xa4a5('0xb')](_0xa4a5('0xc'))){_0x5bd3d2[_0xa4a5('0xd')]=moment()[_0xa4a5('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5bc7fa(null,_0x5bd3d2);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index fa23765..969a827 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 _0x90e4=['OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','OpenchannelInteraction','options','where','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','debug'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x90e4,0x1ce));var _0x490e=function(_0x12e73c,_0x2cbe1d){_0x12e73c=_0x12e73c-0x0;var _0x4c41cb=_0x90e4[_0x12e73c];return _0x4c41cb;};'use strict';var _=require(_0x490e('0x0'));var util=require(_0x490e('0x1'));var moment=require(_0x490e('0x2'));var BPromise=require(_0x490e('0x3'));var rs=require(_0x490e('0x4'));var fs=require('fs');var Redis=require(_0x490e('0x5'));var db=require(_0x490e('0x6'))['db'];var utils=require(_0x490e('0x7'));var logger=require(_0x490e('0x8'))(_0x490e('0x9'));var config=require(_0x490e('0xa'));var jayson=require(_0x490e('0xb'));var client=jayson['client'][_0x490e('0xc')]({'port':0x232a});config[_0x490e('0xd')]=_[_0x490e('0xe')](config[_0x490e('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x490e('0xf'))(new Redis(config[_0x490e('0xd')]));require(_0x490e('0x10'))[_0x490e('0x11')](socket);function respondWithRpcPromise(_0x469a24,_0x3089a8,_0x756ac9){return new BPromise(function(_0xdd11d6,_0x407cd6){return client[_0x490e('0x12')](_0x469a24,_0x756ac9)[_0x490e('0x13')](function(_0x2c7c6e){logger[_0x490e('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3089a8,'request\x20sent');logger[_0x490e('0x15')](_0x490e('0x16'),_0x3089a8,_0x490e('0x17'),JSON[_0x490e('0x18')](_0x2c7c6e));if(_0x2c7c6e[_0x490e('0x19')]){if(_0x2c7c6e[_0x490e('0x19')][_0x490e('0x1a')]===0x1f4){logger[_0x490e('0x19')](_0x490e('0x1b'),_0x3089a8,_0x2c7c6e[_0x490e('0x19')][_0x490e('0x1c')]);return _0x407cd6(_0x2c7c6e['error'][_0x490e('0x1c')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3089a8,_0x2c7c6e['error'][_0x490e('0x1c')]);return _0xdd11d6(_0x2c7c6e[_0x490e('0x19')]['message']);}else{logger[_0x490e('0x14')](_0x490e('0x1b'),_0x3089a8,_0x490e('0x17'));_0xdd11d6(_0x2c7c6e[_0x490e('0x1d')][_0x490e('0x1c')]);}})[_0x490e('0x1e')](function(_0x21f933){logger[_0x490e('0x19')](_0x490e('0x1b'),_0x3089a8,_0x21f933);_0x407cd6(_0x21f933);});});}exports['UpdateOpenchannelInteraction']=function(_0x39ec6b){var _0x67dc64=this;return new Promise(function(_0x1db409,_0x78a15e){return db[_0x490e('0x1f')]['update'](_0x39ec6b['body'],{'raw':_0x39ec6b[_0x490e('0x20')]?_0x39ec6b[_0x490e('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39ec6b['options']?_0x39ec6b[_0x490e('0x20')][_0x490e('0x21')]||null:null,'attributes':_0x39ec6b['options']?_0x39ec6b[_0x490e('0x20')]['attributes']||null:null,'limit':_0x39ec6b[_0x490e('0x20')]?_0x39ec6b[_0x490e('0x20')][_0x490e('0x22')]||null:null})[_0x490e('0x13')](function(_0x1e376a){logger[_0x490e('0x14')](_0x490e('0x23'),_0x39ec6b);logger[_0x490e('0x15')](_0x490e('0x23'),_0x39ec6b,JSON[_0x490e('0x18')](_0x1e376a));_0x1db409(_0x1e376a);})[_0x490e('0x1e')](function(_0x26d8d6){logger[_0x490e('0x19')]('UpdateOpenchannelInteraction',_0x26d8d6[_0x490e('0x1c')],_0x39ec6b);_0x78a15e(_0x67dc64[_0x490e('0x19')](0x1f4,_0x26d8d6[_0x490e('0x1c')]));});});};exports[_0x490e('0x24')]=function(_0x3993d7){return new Promise(function(_0xaefa64,_0x54afb5){return db['OpenchannelInteraction'][_0x490e('0x25')]({'where':_0x3993d7[_0x490e('0x20')]?_0x3993d7['options'][_0x490e('0x21')]||null:null})[_0x490e('0x13')](function(_0x2a7937){if(_0x2a7937){return _0x2a7937[_0x490e('0x26')](_0x3993d7[_0x490e('0x27')][_0x490e('0x28')],_[_0x490e('0x29')](_0x3993d7[_0x490e('0x27')],[_0x490e('0x28'),'id'])||{});}})[_0x490e('0x2a')](function(_0x4c5dd9){logger[_0x490e('0x14')](_0x490e('0x2b'),_0x3993d7);logger[_0x490e('0x15')](_0x490e('0x2b'),_0x3993d7,JSON[_0x490e('0x18')](_0x4c5dd9));_0xaefa64(_0x4c5dd9);})[_0x490e('0x1e')](function(_0x2c6057){logger[_0x490e('0x19')]('AddTags',_0x2c6057[_0x490e('0x1c')],_0x3993d7);_0x54afb5(_this[_0x490e('0x19')](0x1f4,_0x2c6057[_0x490e('0x1c')]));});});}; \ No newline at end of file +var _0xaa8d=['ids','omit','spread','AddTags','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','register','request','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','debug','AddTagsToOpenchannelInteraction','then','addTags'];(function(_0x2b25fe,_0x3bac50){var _0x3b82dd=function(_0x28df3b){while(--_0x28df3b){_0x2b25fe['push'](_0x2b25fe['shift']());}};_0x3b82dd(++_0x3bac50);}(_0xaa8d,0x116));var _0xdaa8=function(_0x552551,_0x2203d5){_0x552551=_0x552551-0x0;var _0x35b31c=_0xaa8d[_0x552551];return _0x35b31c;};'use strict';var _=require('lodash');var util=require(_0xdaa8('0x0'));var moment=require('moment');var BPromise=require(_0xdaa8('0x1'));var rs=require(_0xdaa8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdaa8('0x3'))['db'];var utils=require(_0xdaa8('0x4'));var logger=require(_0xdaa8('0x5'))(_0xdaa8('0x6'));var config=require(_0xdaa8('0x7'));var jayson=require(_0xdaa8('0x8'));var client=jayson['client'][_0xdaa8('0x9')]({'port':0x232a});config[_0xdaa8('0xa')]=_['defaults'](config[_0xdaa8('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0xdaa8('0xb')](socket);function respondWithRpcPromise(_0x27ecf5,_0xce7260,_0x1aa76b){return new BPromise(function(_0x5c9eae,_0x8dffda){return client[_0xdaa8('0xc')](_0x27ecf5,_0x1aa76b)['then'](function(_0x467873){logger['info'](_0xdaa8('0xd'),_0xce7260,_0xdaa8('0xe'));logger['debug'](_0xdaa8('0xf'),_0xce7260,'request\x20sent',JSON[_0xdaa8('0x10')](_0x467873));if(_0x467873[_0xdaa8('0x11')]){if(_0x467873[_0xdaa8('0x11')][_0xdaa8('0x12')]===0x1f4){logger[_0xdaa8('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0xce7260,_0x467873[_0xdaa8('0x11')][_0xdaa8('0x13')]);return _0x8dffda(_0x467873[_0xdaa8('0x11')][_0xdaa8('0x13')]);}logger[_0xdaa8('0x11')](_0xdaa8('0xd'),_0xce7260,_0x467873[_0xdaa8('0x11')][_0xdaa8('0x13')]);return _0x5c9eae(_0x467873[_0xdaa8('0x11')][_0xdaa8('0x13')]);}else{logger[_0xdaa8('0x14')](_0xdaa8('0xd'),_0xce7260,_0xdaa8('0xe'));_0x5c9eae(_0x467873[_0xdaa8('0x15')]['message']);}})['catch'](function(_0x3d2fa1){logger[_0xdaa8('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0xce7260,_0x3d2fa1);_0x8dffda(_0x3d2fa1);});});}exports[_0xdaa8('0x16')]=function(_0x1e0b1f){var _0x12b453=this;return new Promise(function(_0x5600e5,_0x59cedf){return db[_0xdaa8('0x17')][_0xdaa8('0x18')](_0x1e0b1f[_0xdaa8('0x19')],{'raw':_0x1e0b1f[_0xdaa8('0x1a')]?_0x1e0b1f[_0xdaa8('0x1a')][_0xdaa8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e0b1f['options']?_0x1e0b1f['options'][_0xdaa8('0x1c')]||null:null,'attributes':_0x1e0b1f[_0xdaa8('0x1a')]?_0x1e0b1f[_0xdaa8('0x1a')][_0xdaa8('0x1d')]||null:null,'limit':_0x1e0b1f[_0xdaa8('0x1a')]?_0x1e0b1f[_0xdaa8('0x1a')]['limit']||null:null})['then'](function(_0x50a5db){logger[_0xdaa8('0x14')]('UpdateOpenchannelInteraction',_0x1e0b1f);logger[_0xdaa8('0x1e')]('UpdateOpenchannelInteraction',_0x1e0b1f,JSON['stringify'](_0x50a5db));_0x5600e5(_0x50a5db);})['catch'](function(_0x5b340f){logger[_0xdaa8('0x11')](_0xdaa8('0x16'),_0x5b340f[_0xdaa8('0x13')],_0x1e0b1f);_0x59cedf(_0x12b453['error'](0x1f4,_0x5b340f[_0xdaa8('0x13')]));});});};exports[_0xdaa8('0x1f')]=function(_0x7b1ac9){return new Promise(function(_0x5744a6,_0xc2e655){return db[_0xdaa8('0x17')]['find']({'where':_0x7b1ac9[_0xdaa8('0x1a')]?_0x7b1ac9[_0xdaa8('0x1a')]['where']||null:null})[_0xdaa8('0x20')](function(_0x502f22){if(_0x502f22){return _0x502f22[_0xdaa8('0x21')](_0x7b1ac9[_0xdaa8('0x19')][_0xdaa8('0x22')],_[_0xdaa8('0x23')](_0x7b1ac9[_0xdaa8('0x19')],[_0xdaa8('0x22'),'id'])||{});}})[_0xdaa8('0x24')](function(_0x841fd0){logger[_0xdaa8('0x14')](_0xdaa8('0x25'),_0x7b1ac9);logger[_0xdaa8('0x1e')](_0xdaa8('0x25'),_0x7b1ac9,JSON['stringify'](_0x841fd0));_0x5744a6(_0x841fd0);})[_0xdaa8('0x26')](function(_0x232077){logger[_0xdaa8('0x11')](_0xdaa8('0x25'),_0x232077[_0xdaa8('0x13')],_0x7b1ac9);_0xc2e655(_this[_0xdaa8('0x11')](0x1f4,_0x232077[_0xdaa8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index da9b293..199c597 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 _0x6c3a=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','remove','update','emit'];(function(_0xbb1c4e,_0x531396){var _0x4bb55f=function(_0x1d22d1){while(--_0x1d22d1){_0xbb1c4e['push'](_0xbb1c4e['shift']());}};_0x4bb55f(++_0x531396);}(_0x6c3a,0x18c));var _0xa6c3=function(_0x4e170e,_0x207e58){_0x4e170e=_0x4e170e-0x0;var _0x338291=_0x6c3a[_0x4e170e];return _0x338291;};'use strict';var OpenchannelInteractionEvents=require(_0xa6c3('0x0'));var events=['save',_0xa6c3('0x1'),_0xa6c3('0x2')];function createListener(_0x14a5d3,_0x3510e5){return function(_0x60b4ac){_0x3510e5[_0xa6c3('0x3')](_0x14a5d3,_0x60b4ac);};}function removeListener(_0x185374,_0x5d593a){return function(){OpenchannelInteractionEvents[_0xa6c3('0x4')](_0x185374,_0x5d593a);};}exports[_0xa6c3('0x5')]=function(_0x115ba3){for(var _0x2f4547=0x0,_0x5832cd=events[_0xa6c3('0x6')];_0x2f4547<_0x5832cd;_0x2f4547++){var _0x5e1976=events[_0x2f4547];var _0xa05575=createListener(_0xa6c3('0x7')+_0x5e1976,_0x115ba3);OpenchannelInteractionEvents['on'](_0x5e1976,_0xa05575);}}; \ No newline at end of file +var _0x9a41=['removeListener','register','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x3d7909,_0x2f0095){var _0x414ad3=function(_0x2d954a){while(--_0x2d954a){_0x3d7909['push'](_0x3d7909['shift']());}};_0x414ad3(++_0x2f0095);}(_0x9a41,0x8b));var _0x19a4=function(_0x594a57,_0x53bce6){_0x594a57=_0x594a57-0x0;var _0x149294=_0x9a41[_0x594a57];return _0x149294;};'use strict';var OpenchannelInteractionEvents=require(_0x19a4('0x0'));var events=[_0x19a4('0x1'),_0x19a4('0x2'),_0x19a4('0x3')];function createListener(_0x339139,_0x3d62c2){return function(_0x2156a3){_0x3d62c2[_0x19a4('0x4')](_0x339139,_0x2156a3);};}function removeListener(_0x4adbba,_0x569dbd){return function(){OpenchannelInteractionEvents[_0x19a4('0x5')](_0x4adbba,_0x569dbd);};}exports[_0x19a4('0x6')]=function(_0x3b52ff){for(var _0x2be36b=0x0,_0x22aae9=events['length'];_0x2be36b<_0x22aae9;_0x2be36b++){var _0x123a54=events[_0x2be36b];var _0x476ba6=createListener(_0x19a4('0x7')+_0x123a54,_0x3b52ff);OpenchannelInteractionEvents['on'](_0x123a54,_0x476ba6);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 991ee1a..8735164 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x7d3039,_0x63151b){var _0x24031e=function(_0xe3939e){while(--_0xe3939e){_0x7d3039['push'](_0x7d3039['shift']());}};_0x24031e(++_0x63151b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xcb91[_0x53abe5];return _0xc1c37e;};'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');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x1b27ff,_0x34070b){var _0x1ff114=function(_0xb5b137){while(--_0xb5b137){_0x1b27ff['push'](_0x1b27ff['shift']());}};_0x1ff114(++_0x34070b);}(_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('./openchannelMessage.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')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index b420c20..965da59 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 _0x93e6=['BOOLEAN','out','DATE','TEXT','sequelize','medium'];(function(_0x363e1d,_0x3ba3d9){var _0x531e8a=function(_0x452589){while(--_0x452589){_0x363e1d['push'](_0x363e1d['shift']());}};_0x531e8a(++_0x3ba3d9);}(_0x93e6,0x11e));var _0x693e=function(_0x517c7c,_0x32f634){_0x517c7c=_0x517c7c-0x0;var _0x1a9832=_0x93e6[_0x517c7c];return _0x1a9832;};'use strict';var Sequelize=require(_0x693e('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x693e('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x693e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x693e('0x3')),'defaultValue':_0x693e('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x693e('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x693e('0x5')]}}; \ No newline at end of file +var _0x9c02=['DATE','sequelize','exports','TEXT','out'];(function(_0x43d394,_0x33a215){var _0x57f4df=function(_0x6d6f20){while(--_0x6d6f20){_0x43d394['push'](_0x43d394['shift']());}};_0x57f4df(++_0x33a215);}(_0x9c02,0x196));var _0x29c0=function(_0x21e1f5,_0x2fe735){_0x21e1f5=_0x21e1f5-0x0;var _0x1fba90=_0x9c02[_0x21e1f5];return _0x1fba90;};'use strict';var Sequelize=require(_0x29c0('0x0'));module[_0x29c0('0x1')]={'body':{'type':Sequelize[_0x29c0('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x29c0('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x29c0('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x29c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 8562ad3..20b491f 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 _0xa9fe=['describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','info','[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','SELECT','User','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','reject','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','QueryTypes','contact','fullname','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','./openchannelMessage.socket','register','jayson/promise','client','request','then','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','json','undefined','limit','count','offset','set','save','destroy','status','end','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','length','find','create','body'];(function(_0x59b79a,_0x45ade0){var _0x2b493b=function(_0x178e84){while(--_0x178e84){_0x59b79a['push'](_0x59b79a['shift']());}};_0x2b493b(++_0x45ade0);}(_0xa9fe,0xb6));var _0xea9f=function(_0xd5c1c0,_0x5bc310){_0xd5c1c0=_0xd5c1c0-0x0;var _0x4ab773=_0xa9fe[_0xd5c1c0];return _0x4ab773;};'use strict';var emlformat=require(_0xea9f('0x0'));var rimraf=require(_0xea9f('0x1'));var zipdir=require(_0xea9f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea9f('0x3'));var moment=require(_0xea9f('0x4'));var BPromise=require(_0xea9f('0x5'));var Mustache=require(_0xea9f('0x6'));var util=require(_0xea9f('0x7'));var path=require(_0xea9f('0x8'));var sox=require(_0xea9f('0x9'));var csv=require(_0xea9f('0xa'));var ejs=require(_0xea9f('0xb'));var fs=require('fs');var fs_extra=require(_0xea9f('0xc'));var _=require(_0xea9f('0xd'));var squel=require(_0xea9f('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xea9f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xea9f('0x10'));var Papa=require(_0xea9f('0x11'));var Redis=require(_0xea9f('0x12'));var authService=require(_0xea9f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xea9f('0x14'));var hardwareService=require(_0xea9f('0x15'));var logger=require(_0xea9f('0x16'))(_0xea9f('0x17'));var utils=require(_0xea9f('0x18'));var config=require(_0xea9f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xea9f('0x1a'))['db'];config[_0xea9f('0x1b')]=_[_0xea9f('0x1c')](config[_0xea9f('0x1b')],{'host':_0xea9f('0x1d'),'port':0x18eb});var socket=require(_0xea9f('0x1e'))(new Redis(config[_0xea9f('0x1b')]));require(_0xea9f('0x1f'))[_0xea9f('0x20')](socket);var jayson=require(_0xea9f('0x21'));var client=jayson[_0xea9f('0x22')]['http']({'port':0x232c});var client9002=jayson[_0xea9f('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f78b7,_0x53d52f,_0x34f7b1,_0x58b8d9){return new BPromise(function(_0x44ad6c,_0x5cd19a){var _0xea4c36=_0x58b8d9||client;return _0xea4c36[_0xea9f('0x23')](_0x3f78b7,_0x34f7b1)[_0xea9f('0x24')](function(_0x45959c){logger['info'](_0xea9f('0x25'),_0x53d52f,'request\x20sent');logger['debug'](_0xea9f('0x26'),_0x53d52f,_0xea9f('0x27'),JSON[_0xea9f('0x28')](_0x45959c));if(_0x45959c[_0xea9f('0x29')]){if(_0x45959c[_0xea9f('0x29')][_0xea9f('0x2a')]===0x1f4){logger[_0xea9f('0x29')](_0xea9f('0x25'),_0x53d52f,_0x45959c[_0xea9f('0x29')][_0xea9f('0x2b')]);return _0x5cd19a(_0x45959c[_0xea9f('0x29')][_0xea9f('0x2b')]);}logger['error'](_0xea9f('0x25'),_0x53d52f,_0x45959c[_0xea9f('0x29')][_0xea9f('0x2b')]);return _0x44ad6c(_0x45959c[_0xea9f('0x29')][_0xea9f('0x2b')]);}else{logger['info'](_0xea9f('0x25'),_0x53d52f,_0xea9f('0x27'));_0x44ad6c(_0x45959c[_0xea9f('0x2c')][_0xea9f('0x2b')]);}})[_0xea9f('0x2d')](function(_0x39944b){logger[_0xea9f('0x29')](_0xea9f('0x25'),_0x53d52f,_0x39944b);_0x5cd19a(_0x39944b);});});}function respondWithStatusCode(_0x4ebf8f,_0x2b4b11){_0x2b4b11=_0x2b4b11||0xcc;return function(_0x440605){if(_0x440605){return _0x4ebf8f[_0xea9f('0x2e')](_0x2b4b11);}return _0x4ebf8f['status'](_0x2b4b11)['end']();};}function respondWithResult(_0x2647fa,_0x1d81ae){_0x1d81ae=_0x1d81ae||0xc8;return function(_0x3163af){if(_0x3163af){return _0x2647fa['status'](_0x1d81ae)[_0xea9f('0x2f')](_0x3163af);}};}function respondWithFilteredResult(_0x530b87,_0x12a06a){return function(_0x5c5bd1){if(_0x5c5bd1){var _0x3a0051=typeof _0x12a06a['offset']===_0xea9f('0x30')&&typeof _0x12a06a[_0xea9f('0x31')]==='undefined';var _0x5dce4d=_0x5c5bd1[_0xea9f('0x32')];var _0xd45959=_0x3a0051?0x0:_0x12a06a['offset'];var _0x444fa0=_0x3a0051?_0x5c5bd1[_0xea9f('0x32')]:_0x12a06a[_0xea9f('0x33')]+_0x12a06a[_0xea9f('0x31')];var _0x236d36;if(_0x444fa0>=_0x5dce4d){_0x444fa0=_0x5dce4d;_0x236d36=0xc8;}else{_0x236d36=0xce;}_0x530b87['status'](_0x236d36);return _0x530b87[_0xea9f('0x34')]('Content-Range',_0xd45959+'-'+_0x444fa0+'/'+_0x5dce4d)[_0xea9f('0x2f')](_0x5c5bd1);}return null;};}function patchUpdates(_0x40dad1){return function(_0x354438){try{jsonpatch['apply'](_0x354438,_0x40dad1,!![]);}catch(_0x1f8742){return BPromise['reject'](_0x1f8742);}return _0x354438[_0xea9f('0x35')]();};}function saveUpdates(_0x24f2cd,_0x52ce78){return function(_0x525ac8){if(_0x525ac8){return _0x525ac8['update'](_0x24f2cd)[_0xea9f('0x24')](function(_0x5ef501){return _0x5ef501;});}return null;};}function removeEntity(_0x54d2f3,_0x1e9308){return function(_0x427e70){if(_0x427e70){return _0x427e70[_0xea9f('0x36')]()[_0xea9f('0x24')](function(){_0x54d2f3[_0xea9f('0x37')](0xcc)[_0xea9f('0x38')]();});}};}function handleEntityNotFound(_0x32b5ce,_0x4d11a6){return function(_0x38f406){if(!_0x38f406){_0x32b5ce[_0xea9f('0x2e')](0x194);}return _0x38f406;};}function handleError(_0x12b510,_0x2850ab){_0x2850ab=_0x2850ab||0x1f4;return function(_0x596118){logger[_0xea9f('0x29')](_0x596118[_0xea9f('0x39')]);if(_0x596118[_0xea9f('0x3a')]){delete _0x596118[_0xea9f('0x3a')];}_0x12b510[_0xea9f('0x37')](_0x2850ab)[_0xea9f('0x3b')](_0x596118);};}exports[_0xea9f('0x3c')]=function(_0x290d78,_0x20bed7){var _0x2b825b={},_0x416fa6={},_0x411760={'count':0x0,'rows':[]};var _0x2809fd=_[_0xea9f('0x3d')](db[_0xea9f('0x3e')][_0xea9f('0x3f')],function(_0x5aef31){return{'name':_0x5aef31[_0xea9f('0x40')],'type':_0x5aef31[_0xea9f('0x41')][_0xea9f('0x42')]};});_0x416fa6[_0xea9f('0x43')]=_[_0xea9f('0x3d')](_0x2809fd,_0xea9f('0x3a'));_0x416fa6['query']=_['keys'](_0x290d78[_0xea9f('0x44')]);_0x416fa6[_0xea9f('0x45')]=_[_0xea9f('0x46')](_0x416fa6[_0xea9f('0x43')],_0x416fa6[_0xea9f('0x44')]);_0x2b825b[_0xea9f('0x47')]=_['intersection'](_0x416fa6['model'],qs['fields'](_0x290d78[_0xea9f('0x44')][_0xea9f('0x48')]));_0x2b825b[_0xea9f('0x47')]=_0x2b825b[_0xea9f('0x47')]['length']?_0x2b825b[_0xea9f('0x47')]:_0x416fa6[_0xea9f('0x43')];if(!_0x290d78[_0xea9f('0x44')][_0xea9f('0x49')](_0xea9f('0x4a'))){_0x2b825b['limit']=qs[_0xea9f('0x31')](_0x290d78[_0xea9f('0x44')][_0xea9f('0x31')]);_0x2b825b[_0xea9f('0x33')]=qs['offset'](_0x290d78['query']['offset']);}_0x2b825b['order']=qs[_0xea9f('0x4b')](_0x290d78[_0xea9f('0x44')][_0xea9f('0x4b')]);_0x2b825b[_0xea9f('0x4c')]=qs[_0xea9f('0x45')](_[_0xea9f('0x4d')](_0x290d78[_0xea9f('0x44')],_0x416fa6[_0xea9f('0x45')]),_0x2809fd);if(_0x290d78['query'][_0xea9f('0x4e')]){_0x2b825b[_0xea9f('0x4c')]=_[_0xea9f('0x4f')](_0x2b825b[_0xea9f('0x4c')],{'$or':_['map'](_0x2809fd,function(_0x5830d0){if(_0x5830d0[_0xea9f('0x41')]!==_0xea9f('0x50')){var _0x4f4115={};_0x4f4115[_0x5830d0[_0xea9f('0x3a')]]={'$like':'%'+_0x290d78[_0xea9f('0x44')]['filter']+'%'};return _0x4f4115;}})});}_0x2b825b=_[_0xea9f('0x4f')]({},_0x2b825b,_0x290d78[_0xea9f('0x51')]);var _0x45505c={'where':_0x2b825b['where']};return db[_0xea9f('0x3e')][_0xea9f('0x32')](_0x45505c)[_0xea9f('0x24')](function(_0x42c412){_0x411760[_0xea9f('0x32')]=_0x42c412;if(_0x290d78[_0xea9f('0x44')][_0xea9f('0x52')]){_0x2b825b[_0xea9f('0x53')]=[{'all':!![]}];}return db[_0xea9f('0x3e')][_0xea9f('0x54')](_0x2b825b);})[_0xea9f('0x24')](function(_0x24053b){_0x411760['rows']=_0x24053b;return _0x411760;})[_0xea9f('0x24')](respondWithFilteredResult(_0x20bed7,_0x2b825b))[_0xea9f('0x2d')](handleError(_0x20bed7,null));};exports[_0xea9f('0x55')]=function(_0x273e2f,_0x5e4ede){var _0x2a8750={'raw':!![],'where':{'id':_0x273e2f[_0xea9f('0x56')]['id']}},_0x3183d9={};_0x3183d9['model']=_[_0xea9f('0x57')](db['OpenchannelMessage'][_0xea9f('0x3f')]);_0x3183d9[_0xea9f('0x44')]=_[_0xea9f('0x57')](_0x273e2f['query']);_0x3183d9[_0xea9f('0x45')]=_[_0xea9f('0x46')](_0x3183d9[_0xea9f('0x43')],_0x3183d9['query']);_0x2a8750[_0xea9f('0x47')]=_[_0xea9f('0x46')](_0x3183d9[_0xea9f('0x43')],qs[_0xea9f('0x48')](_0x273e2f[_0xea9f('0x44')]['fields']));_0x2a8750[_0xea9f('0x47')]=_0x2a8750['attributes'][_0xea9f('0x58')]?_0x2a8750[_0xea9f('0x47')]:_0x3183d9[_0xea9f('0x43')];if(_0x273e2f[_0xea9f('0x44')][_0xea9f('0x52')]){_0x2a8750[_0xea9f('0x53')]=[{'all':!![]}];}_0x2a8750=_[_0xea9f('0x4f')]({},_0x2a8750,_0x273e2f['options']);return db['OpenchannelMessage'][_0xea9f('0x59')](_0x2a8750)[_0xea9f('0x24')](handleEntityNotFound(_0x5e4ede,null))[_0xea9f('0x24')](respondWithResult(_0x5e4ede,null))['catch'](handleError(_0x5e4ede,null));};exports['create']=function(_0x37ed51,_0x291111){return db['OpenchannelMessage'][_0xea9f('0x5a')](_0x37ed51['body'],{})[_0xea9f('0x24')](respondWithResult(_0x291111,0xc9))[_0xea9f('0x2d')](handleError(_0x291111,null));};exports['update']=function(_0x3e6b37,_0xf89d9a){if(_0x3e6b37[_0xea9f('0x5b')]['id']){delete _0x3e6b37[_0xea9f('0x5b')]['id'];}return db['OpenchannelMessage'][_0xea9f('0x59')]({'where':{'id':_0x3e6b37[_0xea9f('0x56')]['id']}})['then'](handleEntityNotFound(_0xf89d9a,null))['then'](saveUpdates(_0x3e6b37[_0xea9f('0x5b')],null))[_0xea9f('0x24')](respondWithResult(_0xf89d9a,null))[_0xea9f('0x2d')](handleError(_0xf89d9a,null));};exports[_0xea9f('0x36')]=function(_0x28b266,_0x956304){return db['OpenchannelMessage']['find']({'where':{'id':_0x28b266[_0xea9f('0x56')]['id']}})['then'](handleEntityNotFound(_0x956304,null))[_0xea9f('0x24')](removeEntity(_0x956304,null))[_0xea9f('0x2d')](handleError(_0x956304,null));};exports['describe']=function(_0x34871f,_0x2f1f31){return db[_0xea9f('0x3e')][_0xea9f('0x5c')]()[_0xea9f('0x24')](respondWithResult(_0x2f1f31,null))[_0xea9f('0x2d')](handleError(_0x2f1f31,null));};var interaction_log=require(_0xea9f('0x16'))('openchannel-interactions');exports[_0xea9f('0x5d')]=function(_0x4b71df,_0x1e61f5,_0x1facae){var _0x4a2fa6={'agent':{},'channel':'openchannel'};if(_0x4b71df['body']['id']){delete _0x4b71df['body']['id'];}_0x4b71df[_0xea9f('0x5b')][_0xea9f('0x5e')]=!![];_0x4b71df['body'][_0xea9f('0x5f')]=moment()[_0xea9f('0x60')](_0xea9f('0x61'));_0x4b71df[_0xea9f('0x5b')][_0xea9f('0x62')]=_0x4b71df[_0xea9f('0x5b')]['UserId']||_0x4b71df[_0xea9f('0x63')]['id'];_0x4a2fa6[_0xea9f('0x64')]['id']=_0x4b71df[_0xea9f('0x5b')][_0xea9f('0x62')];return db[_0xea9f('0x3e')][_0xea9f('0x59')]({'where':{'id':_0x4b71df[_0xea9f('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1e61f5,null))['then'](saveUpdates(_0x4b71df[_0xea9f('0x5b')],null))[_0xea9f('0x24')](function(_0x208c3a){if(_0x208c3a){_0x4a2fa6['message']=_0x208c3a[_0xea9f('0x65')]({'plain':!![]});return db[_0xea9f('0x66')]['find']({'where':{'id':_0x208c3a[_0xea9f('0x67')]}});}return null;})[_0xea9f('0x24')](handleEntityNotFound(_0x1e61f5,null))[_0xea9f('0x24')](function(_0x5ab679){if(_0x5ab679){return _0x5ab679['update']({'UserId':_0x4b71df['body'][_0xea9f('0x62')],'read1stAt':_[_0xea9f('0x68')](_0x5ab679[_0xea9f('0x69')])?moment()[_0xea9f('0x60')](_0xea9f('0x61')):undefined});}return null;})[_0xea9f('0x24')](function(_0x274c42){if(_0x274c42){_0x4a2fa6['interaction']=_0x274c42[_0xea9f('0x65')]({'plain':!![]});interaction_log[_0xea9f('0x6a')](_0xea9f('0x6b'),_0x4b71df[_0xea9f('0x63')]['id'],_0x4b71df['user'][_0xea9f('0x3a')],_0x4b71df[_0xea9f('0x63')][_0xea9f('0x6c')],_0x4a2fa6[_0xea9f('0x6d')]['id'],_0x4b71df[_0xea9f('0x5b')]?JSON[_0xea9f('0x28')](_0x4b71df[_0xea9f('0x5b')]):_0xea9f('0x6e'));return respondWithRpcPromise(_0xea9f('0x6f'),'acceptMessage',_0x4a2fa6);}return null;})[_0xea9f('0x24')](function(_0x57e8b4){var _0x23def9=_0xea9f('0x70')+_0x57e8b4[_0xea9f('0x2b')][_0xea9f('0x71')];return db['sequelize']['query'](_0x23def9,{'type':db[_0xea9f('0x72')]['QueryTypes'][_0xea9f('0x73')],'raw':!![]})[_0xea9f('0x24')](function(_0x2a0726){return _0x2a0726;});})[_0xea9f('0x24')](function(_0x21dc43){if(_0x21dc43){_0x4a2fa6[_0xea9f('0x2b')]['contact']=_0x21dc43[0x0];if(!_0x4b71df[_0xea9f('0x5b')][_0xea9f('0x62')])return;return db[_0xea9f('0x74')][_0xea9f('0x59')]({'where':{'id':_0x4b71df[_0xea9f('0x5b')][_0xea9f('0x62')],'role':_0xea9f('0x64')},'attributes':['id',_0xea9f('0x3a'),'fullname',_0xea9f('0x75'),_0xea9f('0x76')],'raw':!![]});}return null;})[_0xea9f('0x24')](function(_0x2bec9d){if(!_0x2bec9d)return null;_0x4a2fa6[_0xea9f('0x2b')][_0xea9f('0x64')]=_0x2bec9d;return _0x4a2fa6;})['then'](function(_0x3ddb88){if(_0x3ddb88){if(_0x4b71df['body'][_0xea9f('0x77')]){_0x4a2fa6[_0xea9f('0x2b')][_0xea9f('0x78')]=util[_0xea9f('0x60')]('SIP/%s',_0x4b71df[_0xea9f('0x63')][_0xea9f('0x3a')]);_0x4a2fa6[_0xea9f('0x2b')]['channel']=_0x4a2fa6[_0xea9f('0x79')];_0x4a2fa6[_0xea9f('0x2b')][_0xea9f('0x7a')]=_0x4a2fa6[_0xea9f('0x79')];_0x4a2fa6[_0xea9f('0x2b')][_0xea9f('0x7b')]=_0xea9f('0x5d');return respondWithRpcPromise(_0xea9f('0x7c'),_0xea9f('0x7c'),{'event':_0xea9f('0x7d'),'message':_0x4a2fa6[_0xea9f('0x2b')]},client9002)[_0xea9f('0x24')](function(){return _0x4a2fa6;});}return _0x4a2fa6;}return null;})[_0xea9f('0x24')](respondWithResult(_0x1e61f5,null))[_0xea9f('0x2d')](handleError(_0x1e61f5,null));};var interaction_log=require('../../config/logger')(_0xea9f('0x7e'));exports[_0xea9f('0x7f')]=function(_0x372e90,_0x18230e,_0x66976){var _0x3e20e3={'agent':{},'channel':_0xea9f('0x80')};if(_0x372e90[_0xea9f('0x5b')]['id']){delete _0x372e90['body']['id'];}_0x372e90[_0xea9f('0x5b')][_0xea9f('0x62')]=_0x372e90[_0xea9f('0x5b')][_0xea9f('0x62')]||_0x372e90[_0xea9f('0x63')]['id'];_0x3e20e3['agent']['id']=_0x372e90[_0xea9f('0x5b')][_0xea9f('0x62')];return db[_0xea9f('0x3e')][_0xea9f('0x59')]({'where':{'id':_0x372e90[_0xea9f('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x18230e,null))[_0xea9f('0x24')](function(_0x45093d){if(_0x45093d){_0x3e20e3[_0xea9f('0x2b')]=_0x45093d[_0xea9f('0x65')]({'plain':!![]});return db[_0xea9f('0x66')][_0xea9f('0x59')]({'where':{'id':_0x45093d[_0xea9f('0x67')]}});}return null;})[_0xea9f('0x24')](handleEntityNotFound(_0x18230e,null))[_0xea9f('0x24')](function(_0x1bdd31){if(_0x1bdd31){_0x3e20e3['interaction']=_0x1bdd31[_0xea9f('0x65')]({'plain':!![]});interaction_log[_0xea9f('0x6a')](_0xea9f('0x81'),_0x372e90[_0xea9f('0x63')]['id'],_0x372e90[_0xea9f('0x63')][_0xea9f('0x3a')],_0x372e90['user'][_0xea9f('0x6c')],_0x3e20e3[_0xea9f('0x6d')]['id'],_0x372e90[_0xea9f('0x5b')]?JSON[_0xea9f('0x28')](_0x372e90[_0xea9f('0x5b')]):_0xea9f('0x6e'));return respondWithRpcPromise(_0xea9f('0x82'),_0xea9f('0x83'),_0x3e20e3);}return null;})['then'](function(_0x7c8d04){var _0x514531='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x7c8d04[_0xea9f('0x2b')][_0xea9f('0x71')];return db[_0xea9f('0x84')][_0xea9f('0x44')](_0x514531,{'type':db['Sequelize'][_0xea9f('0x85')][_0xea9f('0x73')],'raw':!![]})[_0xea9f('0x24')](function(_0x3dc392){return _0x3dc392;});})[_0xea9f('0x24')](function(_0x40f410){if(_0x40f410){_0x3e20e3['message'][_0xea9f('0x86')]=_0x40f410[0x0];if(!_0x372e90['body'][_0xea9f('0x62')])return;return db[_0xea9f('0x74')]['find']({'where':{'id':_0x372e90['body'][_0xea9f('0x62')],'role':_0xea9f('0x64')},'attributes':['id',_0xea9f('0x3a'),_0xea9f('0x87'),_0xea9f('0x75'),_0xea9f('0x76')],'raw':!![]});}return null;})['then'](function(_0x11abdc){if(!_0x11abdc)return null;_0x3e20e3[_0xea9f('0x2b')][_0xea9f('0x64')]=_0x11abdc;return _0x3e20e3;})['then'](function(_0x2cdb76){if(_0x2cdb76){_0x2cdb76[_0xea9f('0x2b')][_0xea9f('0x78')]=util['format']('SIP/%s',_0x372e90[_0xea9f('0x63')]['name']);_0x2cdb76['message']['channel']=_0x3e20e3['channel'];_0x2cdb76[_0xea9f('0x2b')]['motionChannel']=_0x3e20e3[_0xea9f('0x79')];_0x2cdb76['message']['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xea9f('0x88'),'message':_0x2cdb76[_0xea9f('0x2b')]},client9002);return _0x3e20e3;}return null;})[_0xea9f('0x24')](respondWithResult(_0x18230e,null))['catch'](handleError(_0x18230e,null));}; \ No newline at end of file +var _0x709d=['EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','email','SIP/%s','rejectmessage','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','destroy','end','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','update','params','describe','../../config/logger','accept','openchannel','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','role','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','internal','manual','interface','format','channel','motionChannel','event'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x709d,0x116));var _0xd709=function(_0x321059,_0x29a023){_0x321059=_0x321059-0x0;var _0x8487b4=_0x709d[_0x321059];return _0x8487b4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd709('0x0'));var jsonpatch=require(_0xd709('0x1'));var rp=require(_0xd709('0x2'));var moment=require(_0xd709('0x3'));var BPromise=require(_0xd709('0x4'));var Mustache=require(_0xd709('0x5'));var util=require(_0xd709('0x6'));var path=require(_0xd709('0x7'));var sox=require(_0xd709('0x8'));var csv=require(_0xd709('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd709('0xa'));var _=require(_0xd709('0xb'));var squel=require('squel');var crypto=require(_0xd709('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd709('0xd'));var toCsv=require(_0xd709('0x9'));var querystring=require(_0xd709('0xe'));var Papa=require(_0xd709('0xf'));var Redis=require(_0xd709('0x10'));var authService=require(_0xd709('0x11'));var qs=require(_0xd709('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd709('0x13'));var utils=require(_0xd709('0x14'));var config=require(_0xd709('0x15'));var licenseUtil=require(_0xd709('0x16'));var db=require(_0xd709('0x17'))['db'];config[_0xd709('0x18')]=_[_0xd709('0x19')](config[_0xd709('0x18')],{'host':_0xd709('0x1a'),'port':0x18eb});var socket=require(_0xd709('0x1b'))(new Redis(config['redis']));require(_0xd709('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xd709('0x1d')]({'port':0x232c});var client9002=jayson[_0xd709('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47f3d2,_0x594a99,_0x346654,_0xfe6b0b){return new BPromise(function(_0x4fd735,_0x4ac9ae){var _0x674e08=_0xfe6b0b||client;return _0x674e08[_0xd709('0x1f')](_0x47f3d2,_0x346654)[_0xd709('0x20')](function(_0x4022cc){logger[_0xd709('0x21')](_0xd709('0x22'),_0x594a99,_0xd709('0x23'));logger[_0xd709('0x24')](_0xd709('0x25'),_0x594a99,_0xd709('0x23'),JSON['stringify'](_0x4022cc));if(_0x4022cc[_0xd709('0x26')]){if(_0x4022cc[_0xd709('0x26')][_0xd709('0x27')]===0x1f4){logger[_0xd709('0x26')](_0xd709('0x22'),_0x594a99,_0x4022cc[_0xd709('0x26')]['message']);return _0x4ac9ae(_0x4022cc[_0xd709('0x26')]['message']);}logger[_0xd709('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x594a99,_0x4022cc[_0xd709('0x26')][_0xd709('0x28')]);return _0x4fd735(_0x4022cc[_0xd709('0x26')][_0xd709('0x28')]);}else{logger[_0xd709('0x21')](_0xd709('0x22'),_0x594a99,_0xd709('0x23'));_0x4fd735(_0x4022cc[_0xd709('0x29')][_0xd709('0x28')]);}})[_0xd709('0x2a')](function(_0x45f54d){logger['error'](_0xd709('0x22'),_0x594a99,_0x45f54d);_0x4ac9ae(_0x45f54d);});});}function respondWithStatusCode(_0x599f6d,_0x3dace8){_0x3dace8=_0x3dace8||0xcc;return function(_0x162f0e){if(_0x162f0e){return _0x599f6d[_0xd709('0x2b')](_0x3dace8);}return _0x599f6d[_0xd709('0x2c')](_0x3dace8)['end']();};}function respondWithResult(_0x9e162e,_0x466d44){_0x466d44=_0x466d44||0xc8;return function(_0x599e96){if(_0x599e96){return _0x9e162e[_0xd709('0x2c')](_0x466d44)[_0xd709('0x2d')](_0x599e96);}};}function respondWithFilteredResult(_0x4432d9,_0x415148){return function(_0x2fca73){if(_0x2fca73){var _0x1dbb6c=typeof _0x415148[_0xd709('0x2e')]===_0xd709('0x2f')&&typeof _0x415148[_0xd709('0x30')]==='undefined';var _0x5d13cb=_0x2fca73[_0xd709('0x31')];var _0x31eaa3=_0x1dbb6c?0x0:_0x415148[_0xd709('0x2e')];var _0x1ea978=_0x1dbb6c?_0x2fca73[_0xd709('0x31')]:_0x415148[_0xd709('0x2e')]+_0x415148[_0xd709('0x30')];var _0x38b529;if(_0x1ea978>=_0x5d13cb){_0x1ea978=_0x5d13cb;_0x38b529=0xc8;}else{_0x38b529=0xce;}_0x4432d9['status'](_0x38b529);return _0x4432d9[_0xd709('0x32')]('Content-Range',_0x31eaa3+'-'+_0x1ea978+'/'+_0x5d13cb)[_0xd709('0x2d')](_0x2fca73);}return null;};}function patchUpdates(_0xf05b1c){return function(_0x40070b){try{jsonpatch[_0xd709('0x33')](_0x40070b,_0xf05b1c,!![]);}catch(_0x55f333){return BPromise[_0xd709('0x34')](_0x55f333);}return _0x40070b['save']();};}function saveUpdates(_0x320d25,_0x14c296){return function(_0x1737da){if(_0x1737da){return _0x1737da['update'](_0x320d25)[_0xd709('0x20')](function(_0x435fd4){return _0x435fd4;});}return null;};}function removeEntity(_0x566c21,_0x34a765){return function(_0x5f0152){if(_0x5f0152){return _0x5f0152[_0xd709('0x35')]()[_0xd709('0x20')](function(){_0x566c21[_0xd709('0x2c')](0xcc)[_0xd709('0x36')]();});}};}function handleEntityNotFound(_0x22ac28,_0x2e6b61){return function(_0x1cc7d7){if(!_0x1cc7d7){_0x22ac28[_0xd709('0x2b')](0x194);}return _0x1cc7d7;};}function handleError(_0x52415d,_0xd55913){_0xd55913=_0xd55913||0x1f4;return function(_0x3c536b){logger[_0xd709('0x26')](_0x3c536b[_0xd709('0x37')]);if(_0x3c536b['name']){delete _0x3c536b[_0xd709('0x38')];}_0x52415d[_0xd709('0x2c')](_0xd55913)[_0xd709('0x39')](_0x3c536b);};}exports[_0xd709('0x3a')]=function(_0x2f5be9,_0x4c5ae2){var _0x198dd7={},_0x48684d={},_0x3e1131={'count':0x0,'rows':[]};var _0x41bc4=_[_0xd709('0x3b')](db[_0xd709('0x3c')][_0xd709('0x3d')],function(_0x447ac1){return{'name':_0x447ac1[_0xd709('0x3e')],'type':_0x447ac1[_0xd709('0x3f')][_0xd709('0x40')]};});_0x48684d[_0xd709('0x41')]=_[_0xd709('0x3b')](_0x41bc4,_0xd709('0x38'));_0x48684d['query']=_[_0xd709('0x42')](_0x2f5be9[_0xd709('0x43')]);_0x48684d[_0xd709('0x44')]=_[_0xd709('0x45')](_0x48684d[_0xd709('0x41')],_0x48684d[_0xd709('0x43')]);_0x198dd7['attributes']=_[_0xd709('0x45')](_0x48684d['model'],qs[_0xd709('0x46')](_0x2f5be9[_0xd709('0x43')][_0xd709('0x46')]));_0x198dd7['attributes']=_0x198dd7['attributes'][_0xd709('0x47')]?_0x198dd7[_0xd709('0x48')]:_0x48684d['model'];if(!_0x2f5be9[_0xd709('0x43')]['hasOwnProperty'](_0xd709('0x49'))){_0x198dd7[_0xd709('0x30')]=qs[_0xd709('0x30')](_0x2f5be9[_0xd709('0x43')][_0xd709('0x30')]);_0x198dd7[_0xd709('0x2e')]=qs[_0xd709('0x2e')](_0x2f5be9[_0xd709('0x43')]['offset']);}_0x198dd7[_0xd709('0x4a')]=qs[_0xd709('0x4b')](_0x2f5be9['query'][_0xd709('0x4b')]);_0x198dd7[_0xd709('0x4c')]=qs[_0xd709('0x44')](_[_0xd709('0x4d')](_0x2f5be9[_0xd709('0x43')],_0x48684d[_0xd709('0x44')]),_0x41bc4);if(_0x2f5be9[_0xd709('0x43')][_0xd709('0x4e')]){_0x198dd7[_0xd709('0x4c')]=_[_0xd709('0x4f')](_0x198dd7[_0xd709('0x4c')],{'$or':_['map'](_0x41bc4,function(_0x61919){if(_0x61919[_0xd709('0x3f')]!==_0xd709('0x50')){var _0x306d14={};_0x306d14[_0x61919[_0xd709('0x38')]]={'$like':'%'+_0x2f5be9[_0xd709('0x43')][_0xd709('0x4e')]+'%'};return _0x306d14;}})});}_0x198dd7=_['merge']({},_0x198dd7,_0x2f5be9[_0xd709('0x51')]);var _0x69d8d2={'where':_0x198dd7['where']};return db[_0xd709('0x3c')]['count'](_0x69d8d2)[_0xd709('0x20')](function(_0x536c7a){_0x3e1131['count']=_0x536c7a;if(_0x2f5be9[_0xd709('0x43')][_0xd709('0x52')]){_0x198dd7[_0xd709('0x53')]=[{'all':!![]}];}return db[_0xd709('0x3c')][_0xd709('0x54')](_0x198dd7);})[_0xd709('0x20')](function(_0x427f58){_0x3e1131[_0xd709('0x55')]=_0x427f58;return _0x3e1131;})['then'](respondWithFilteredResult(_0x4c5ae2,_0x198dd7))[_0xd709('0x2a')](handleError(_0x4c5ae2,null));};exports[_0xd709('0x56')]=function(_0x527e1f,_0x373bb9){var _0x2a8a63={'raw':!![],'where':{'id':_0x527e1f['params']['id']}},_0x4a28b7={};_0x4a28b7[_0xd709('0x41')]=_[_0xd709('0x42')](db['OpenchannelMessage'][_0xd709('0x3d')]);_0x4a28b7[_0xd709('0x43')]=_[_0xd709('0x42')](_0x527e1f[_0xd709('0x43')]);_0x4a28b7[_0xd709('0x44')]=_[_0xd709('0x45')](_0x4a28b7[_0xd709('0x41')],_0x4a28b7[_0xd709('0x43')]);_0x2a8a63[_0xd709('0x48')]=_['intersection'](_0x4a28b7['model'],qs['fields'](_0x527e1f['query']['fields']));_0x2a8a63[_0xd709('0x48')]=_0x2a8a63[_0xd709('0x48')][_0xd709('0x47')]?_0x2a8a63[_0xd709('0x48')]:_0x4a28b7[_0xd709('0x41')];if(_0x527e1f[_0xd709('0x43')]['includeAll']){_0x2a8a63[_0xd709('0x53')]=[{'all':!![]}];}_0x2a8a63=_[_0xd709('0x4f')]({},_0x2a8a63,_0x527e1f[_0xd709('0x51')]);return db['OpenchannelMessage'][_0xd709('0x57')](_0x2a8a63)[_0xd709('0x20')](handleEntityNotFound(_0x373bb9,null))[_0xd709('0x20')](respondWithResult(_0x373bb9,null))[_0xd709('0x2a')](handleError(_0x373bb9,null));};exports[_0xd709('0x58')]=function(_0x1371de,_0x33e121){return db['OpenchannelMessage']['create'](_0x1371de[_0xd709('0x59')],{})['then'](respondWithResult(_0x33e121,0xc9))[_0xd709('0x2a')](handleError(_0x33e121,null));};exports[_0xd709('0x5a')]=function(_0x3f1a6f,_0x28fca2){if(_0x3f1a6f[_0xd709('0x59')]['id']){delete _0x3f1a6f[_0xd709('0x59')]['id'];}return db[_0xd709('0x3c')][_0xd709('0x57')]({'where':{'id':_0x3f1a6f[_0xd709('0x5b')]['id']}})['then'](handleEntityNotFound(_0x28fca2,null))[_0xd709('0x20')](saveUpdates(_0x3f1a6f[_0xd709('0x59')],null))['then'](respondWithResult(_0x28fca2,null))['catch'](handleError(_0x28fca2,null));};exports['destroy']=function(_0x55b2e8,_0x2510fc){return db[_0xd709('0x3c')][_0xd709('0x57')]({'where':{'id':_0x55b2e8[_0xd709('0x5b')]['id']}})[_0xd709('0x20')](handleEntityNotFound(_0x2510fc,null))[_0xd709('0x20')](removeEntity(_0x2510fc,null))[_0xd709('0x2a')](handleError(_0x2510fc,null));};exports[_0xd709('0x5c')]=function(_0x5556f4,_0x4e1027){return db['OpenchannelMessage'][_0xd709('0x5c')]()[_0xd709('0x20')](respondWithResult(_0x4e1027,null))['catch'](handleError(_0x4e1027,null));};var interaction_log=require(_0xd709('0x5d'))('openchannel-interactions');exports[_0xd709('0x5e')]=function(_0x37497a,_0x40f5e5,_0x4cd829){var _0x5a4440={'agent':{},'channel':_0xd709('0x5f')};if(_0x37497a[_0xd709('0x59')]['id']){delete _0x37497a['body']['id'];}_0x37497a[_0xd709('0x59')]['read']=!![];_0x37497a['body']['readAt']=moment()['format'](_0xd709('0x60'));_0x37497a[_0xd709('0x59')][_0xd709('0x61')]=_0x37497a[_0xd709('0x59')][_0xd709('0x61')]||_0x37497a[_0xd709('0x62')]['id'];_0x5a4440['agent']['id']=_0x37497a[_0xd709('0x59')][_0xd709('0x61')];return db[_0xd709('0x3c')]['find']({'where':{'id':_0x37497a['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x40f5e5,null))[_0xd709('0x20')](saveUpdates(_0x37497a[_0xd709('0x59')],null))[_0xd709('0x20')](function(_0xacf049){if(_0xacf049){_0x5a4440[_0xd709('0x28')]=_0xacf049[_0xd709('0x63')]({'plain':!![]});return db[_0xd709('0x64')][_0xd709('0x57')]({'where':{'id':_0xacf049[_0xd709('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x40f5e5,null))['then'](function(_0xb28374){if(_0xb28374){return _0xb28374['update']({'UserId':_0x37497a[_0xd709('0x59')][_0xd709('0x61')],'read1stAt':_[_0xd709('0x66')](_0xb28374[_0xd709('0x67')])?moment()['format'](_0xd709('0x60')):undefined});}return null;})[_0xd709('0x20')](function(_0x5a7d07){if(_0x5a7d07){_0x5a4440[_0xd709('0x68')]=_0x5a7d07['get']({'plain':!![]});interaction_log[_0xd709('0x21')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x37497a['user']['id'],_0x37497a['user'][_0xd709('0x38')],_0x37497a[_0xd709('0x62')][_0xd709('0x69')],_0x5a4440['interaction']['id'],_0x37497a[_0xd709('0x59')]?JSON[_0xd709('0x6a')](_0x37497a[_0xd709('0x59')]):'null');return respondWithRpcPromise('AcceptMessage',_0xd709('0x6b'),_0x5a4440);}return null;})[_0xd709('0x20')](function(_0x33aea3){var _0x8e8bc3=_0xd709('0x6c')+_0x33aea3[_0xd709('0x28')][_0xd709('0x6d')];return db[_0xd709('0x6e')]['query'](_0x8e8bc3,{'type':db[_0xd709('0x6f')][_0xd709('0x70')][_0xd709('0x71')],'raw':!![]})[_0xd709('0x20')](function(_0x464ef7){return _0x464ef7;});})[_0xd709('0x20')](function(_0x25b108){if(_0x25b108){_0x5a4440[_0xd709('0x28')][_0xd709('0x72')]=_0x25b108[0x0];if(!_0x37497a[_0xd709('0x59')]['UserId'])return;return db[_0xd709('0x73')][_0xd709('0x57')]({'where':{'id':_0x37497a[_0xd709('0x59')][_0xd709('0x61')],'role':_0xd709('0x74')},'attributes':['id',_0xd709('0x38'),'fullname','email',_0xd709('0x75')],'raw':!![]});}return null;})[_0xd709('0x20')](function(_0x12afd9){if(!_0x12afd9)return null;_0x5a4440[_0xd709('0x28')][_0xd709('0x74')]=_0x12afd9;return _0x5a4440;})[_0xd709('0x20')](function(_0x5d09f1){if(_0x5d09f1){if(_0x37497a[_0xd709('0x59')][_0xd709('0x76')]){_0x5a4440[_0xd709('0x28')][_0xd709('0x77')]=util[_0xd709('0x78')]('SIP/%s',_0x37497a['user']['name']);_0x5a4440[_0xd709('0x28')][_0xd709('0x79')]=_0x5a4440[_0xd709('0x79')];_0x5a4440[_0xd709('0x28')][_0xd709('0x7a')]=_0x5a4440[_0xd709('0x79')];_0x5a4440[_0xd709('0x28')][_0xd709('0x7b')]=_0xd709('0x5e');return respondWithRpcPromise(_0xd709('0x7c'),_0xd709('0x7c'),{'event':_0xd709('0x7d'),'message':_0x5a4440['message']},client9002)['then'](function(){return _0x5a4440;});}return _0x5a4440;}return null;})['then'](respondWithResult(_0x40f5e5,null))[_0xd709('0x2a')](handleError(_0x40f5e5,null));};var interaction_log=require(_0xd709('0x5d'))(_0xd709('0x7e'));exports[_0xd709('0x34')]=function(_0x59689a,_0x597290,_0x49144c){var _0x5f12db={'agent':{},'channel':_0xd709('0x5f')};if(_0x59689a[_0xd709('0x59')]['id']){delete _0x59689a[_0xd709('0x59')]['id'];}_0x59689a[_0xd709('0x59')][_0xd709('0x61')]=_0x59689a[_0xd709('0x59')]['UserId']||_0x59689a[_0xd709('0x62')]['id'];_0x5f12db['agent']['id']=_0x59689a[_0xd709('0x59')][_0xd709('0x61')];return db['OpenchannelMessage'][_0xd709('0x57')]({'where':{'id':_0x59689a[_0xd709('0x5b')]['id'],'UserId':null}})[_0xd709('0x20')](handleEntityNotFound(_0x597290,null))[_0xd709('0x20')](function(_0x594181){if(_0x594181){_0x5f12db['message']=_0x594181[_0xd709('0x63')]({'plain':!![]});return db[_0xd709('0x64')]['find']({'where':{'id':_0x594181[_0xd709('0x65')]}});}return null;})[_0xd709('0x20')](handleEntityNotFound(_0x597290,null))[_0xd709('0x20')](function(_0x49b4ca){if(_0x49b4ca){_0x5f12db[_0xd709('0x68')]=_0x49b4ca[_0xd709('0x63')]({'plain':!![]});interaction_log['info'](_0xd709('0x7f'),_0x59689a[_0xd709('0x62')]['id'],_0x59689a['user'][_0xd709('0x38')],_0x59689a['user']['role'],_0x5f12db[_0xd709('0x68')]['id'],_0x59689a[_0xd709('0x59')]?JSON['stringify'](_0x59689a['body']):'null');return respondWithRpcPromise(_0xd709('0x80'),_0xd709('0x81'),_0x5f12db);}return null;})['then'](function(_0x308558){var _0x5867cc=_0xd709('0x6c')+_0x308558[_0xd709('0x28')]['ContactId'];return db['sequelize']['query'](_0x5867cc,{'type':db['Sequelize'][_0xd709('0x70')][_0xd709('0x71')],'raw':!![]})[_0xd709('0x20')](function(_0x25a8b7){return _0x25a8b7;});})[_0xd709('0x20')](function(_0x47c076){if(_0x47c076){_0x5f12db[_0xd709('0x28')][_0xd709('0x72')]=_0x47c076[0x0];if(!_0x59689a['body'][_0xd709('0x61')])return;return db[_0xd709('0x73')][_0xd709('0x57')]({'where':{'id':_0x59689a[_0xd709('0x59')][_0xd709('0x61')],'role':_0xd709('0x74')},'attributes':['id','name',_0xd709('0x82'),_0xd709('0x83'),'internal'],'raw':!![]});}return null;})[_0xd709('0x20')](function(_0x54fc1b){if(!_0x54fc1b)return null;_0x5f12db[_0xd709('0x28')][_0xd709('0x74')]=_0x54fc1b;return _0x5f12db;})[_0xd709('0x20')](function(_0x349b5b){if(_0x349b5b){_0x349b5b[_0xd709('0x28')][_0xd709('0x77')]=util[_0xd709('0x78')](_0xd709('0x84'),_0x59689a['user']['name']);_0x349b5b[_0xd709('0x28')][_0xd709('0x79')]=_0x5f12db['channel'];_0x349b5b[_0xd709('0x28')][_0xd709('0x7a')]=_0x5f12db[_0xd709('0x79')];_0x349b5b[_0xd709('0x28')][_0xd709('0x7b')]=_0xd709('0x34');respondWithRpcPromise(_0xd709('0x7c'),_0xd709('0x7c'),{'event':_0xd709('0x85'),'message':_0x349b5b[_0xd709('0x28')]},client9002);return _0x5f12db;}return null;})[_0xd709('0x20')](respondWithResult(_0x597290,null))['catch'](handleError(_0x597290,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 11af54f..f8596a4 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 _0x7f4a=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','save'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7f4a,0xc3));var _0xa7f4=function(_0x4454c3,_0x24c130){_0x4454c3=_0x4454c3-0x0;var _0x195fa6=_0x7f4a[_0x4454c3];return _0x195fa6;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xa7f4('0x0'))['db'][_0xa7f4('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa7f4('0x2'),'afterUpdate':_0xa7f4('0x3'),'afterDestroy':_0xa7f4('0x4')};function emitEvent(_0x99bb87){return function(_0x2d9c07,_0x436848,_0x4864d7){OpenchannelMessageEvents[_0xa7f4('0x5')](_0x99bb87+':'+_0x2d9c07['id'],_0x2d9c07);OpenchannelMessageEvents[_0xa7f4('0x5')](_0x99bb87,_0x2d9c07);_0x4864d7(null);};}for(var e in events){if(events[_0xa7f4('0x6')](e)){var event=events[e];OpenchannelMessage[_0xa7f4('0x7')](e,emitEvent(event));}}module[_0xa7f4('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xa0df=['hook','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa0df,0x10b));var _0xfa0d=function(_0x3e6ad5,_0x4a90ae){_0x3e6ad5=_0x3e6ad5-0x0;var _0x17f73c=_0xa0df[_0x3e6ad5];return _0x17f73c;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xfa0d('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xfa0d('0x1')](0x0);var events={'afterCreate':_0xfa0d('0x2'),'afterUpdate':_0xfa0d('0x3'),'afterDestroy':'remove'};function emitEvent(_0xcbe45b){return function(_0x34eca4,_0x4f84c0,_0x50c444){OpenchannelMessageEvents[_0xfa0d('0x4')](_0xcbe45b+':'+_0x34eca4['id'],_0x34eca4);OpenchannelMessageEvents[_0xfa0d('0x4')](_0xcbe45b,_0x34eca4);_0x50c444(null);};}for(var e in events){if(events[_0xfa0d('0x5')](e)){var event=events[e];OpenchannelMessage[_0xfa0d('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 6bf134b..50b8ae7 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 _0x5fbe=['keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','POST','GET','afterCreate','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteractionId','Contact'];(function(_0x401620,_0x167d34){var _0x124c74=function(_0x280938){while(--_0x280938){_0x401620['push'](_0x401620['shift']());}};_0x124c74(++_0x167d34);}(_0x5fbe,0x18c));var _0xe5fb=function(_0x46aaf4,_0x20fcbc){_0x46aaf4=_0x46aaf4-0x0;var _0x4f361f=_0x5fbe[_0x46aaf4];return _0x4f361f;};'use strict';var _=require(_0xe5fb('0x0'));var util=require(_0xe5fb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe5fb('0x2'));var BPromise=require(_0xe5fb('0x3'));var rp=require(_0xe5fb('0x4'));var fs=require('fs');var path=require(_0xe5fb('0x5'));var rimraf=require(_0xe5fb('0x6'));var config=require(_0xe5fb('0x7'));var attributes=require(_0xe5fb('0x8'));module[_0xe5fb('0x9')]=function(_0x411b87,_0x4c0afa){return _0x411b87['define'](_0xe5fb('0xa'),attributes,{'tableName':_0xe5fb('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xe5fb('0xc')],'type':_0xe5fb('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x34d3af,_0x326fda,_0x2ae470){var _0x2be8cd=_0x411b87[_0xe5fb('0xe')];var _0x5ab1e1=_0x34d3af[_0xe5fb('0xf')]({'plain':!![]});if(_0x5ab1e1[_0xe5fb('0x10')][_0xe5fb('0x11')]()==='in'||_0x5ab1e1[_0xe5fb('0x10')][_0xe5fb('0x11')]()===_0xe5fb('0x12')&&!_0x5ab1e1[_0xe5fb('0x13')]&&!_[_0xe5fb('0x14')](_0x5ab1e1[_0xe5fb('0x15')])){_0x2be8cd[_0xe5fb('0x16')][_0xe5fb('0x17')]({'where':{'id':_0x5ab1e1['OpenchannelInteractionId']}})['then'](function(_0x3efd25){if(_0x3efd25){_0x3efd25[_0xe5fb('0x18')]({'lastMsgAt':_0x5ab1e1[_0xe5fb('0x19')],'lastMsgDirection':_0x5ab1e1[_0xe5fb('0x10')]['toLowerCase']()});}})[_0xe5fb('0x1a')](function(_0x53c98a){console[_0xe5fb('0x1b')](_0x53c98a);});}if(_0x5ab1e1[_0xe5fb('0x10')]===_0xe5fb('0x12')&&!_0x5ab1e1[_0xe5fb('0x13')]){var _0x11099c;_0x2be8cd[_0xe5fb('0x1c')][_0xe5fb('0x1d')]()[_0xe5fb('0x1e')](function(_0xde6b43){return _0x2be8cd[_0xe5fb('0x1f')][_0xe5fb('0x20')]({'where':{'id':_0x5ab1e1[_0xe5fb('0x21')]},'include':[{'model':_0x2be8cd[_0xe5fb('0x16')],'as':'Interactions','where':{'id':_0x5ab1e1[_0xe5fb('0x22')]},'limit':0x1,'include':[{'model':_0x2be8cd[_0xe5fb('0x1c')],'as':_0xe5fb('0x23'),'attributes':_[_0xe5fb('0x24')](_0xde6b43)}]}]});})[_0xe5fb('0x1e')](function(_0x312156){_0x11099c=_0x312156[_0xe5fb('0xf')]({'plain':!![]});if(_0x11099c&&_0x11099c[_0xe5fb('0x25')]){logger[_0xe5fb('0x26')](_0xe5fb('0x27'),'afterCreate',util['format'](_0xe5fb('0x28'),_0x5ab1e1['id'],_0x11099c['replyUri']));if(_0x11099c[_0xe5fb('0x29')]&&_0x11099c[_0xe5fb('0x29')][_0xe5fb('0x2a')]){_0x5ab1e1[_0xe5fb('0x2b')]=_[_0xe5fb('0x2c')](_0x11099c[_0xe5fb('0x29')][0x0],_0xe5fb('0x23'));_0x5ab1e1[_0xe5fb('0x23')]=_0x11099c[_0xe5fb('0x29')][0x0][_0xe5fb('0x23')];}var _0x326fda={'method':_0xe5fb('0x2d'),'uri':encodeURI(_0x11099c[_0xe5fb('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x326fda['method']){case _0xe5fb('0x2e'):_0x326fda['qs']=_0x5ab1e1;break;case _0xe5fb('0x2d'):_0x326fda[_0xe5fb('0xc')]=_0x5ab1e1;break;}return rp(_0x326fda)[_0xe5fb('0x1e')](function(_0x1227da){logger[_0xe5fb('0x26')](_0xe5fb('0x27'),_0xe5fb('0x2f'),util[_0xe5fb('0x30')](_0xe5fb('0x31'),_0x5ab1e1['id'],_0x11099c['replyUri']));if(_0x1227da['body']['threadId']&&_0x1227da[_0xe5fb('0xc')][_0xe5fb('0x32')]!=_0x5ab1e1[_0xe5fb('0x2b')][_0xe5fb('0x32')]){return _0x2be8cd[_0xe5fb('0x16')][_0xe5fb('0x18')]({'threadId':_0x1227da[_0xe5fb('0xc')][_0xe5fb('0x32')]},{'where':{'id':_0x5ab1e1[_0xe5fb('0x2b')]['id']}});}else{return;}})[_0xe5fb('0x1e')](function(){return _0x34d3af[_0xe5fb('0x18')]({'read':!![]});})['catch'](function(_0x65a2ec){logger[_0xe5fb('0x1b')](_0xe5fb('0x27'),'afterCreate',util['inspect'](_0x65a2ec,{'showHidden':![],'depth':null}));_0x2ae470();});}else{_0x2ae470();}})[_0xe5fb('0x33')](function(){_0x2ae470();});}else{_0x2ae470();}}},'charset':_0xe5fb('0x34'),'collate':_0xe5fb('0x35')});}; \ No newline at end of file +var _0x8e87=['then','catch','error','CmContact','OpenchannelAccount','find','Contact','keys','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','length','Interaction','omit','POST','method','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x8e87,0x1e6));var _0x78e8=function(_0x4677d0,_0x3236c6){_0x4677d0=_0x4677d0-0x0;var _0x183350=_0x8e87[_0x4677d0];return _0x183350;};'use strict';var _=require(_0x78e8('0x0'));var util=require(_0x78e8('0x1'));var logger=require(_0x78e8('0x2'))('api');var moment=require(_0x78e8('0x3'));var BPromise=require(_0x78e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x78e8('0x5'));var config=require(_0x78e8('0x6'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x1d7479,_0x2a2ef2){return _0x1d7479[_0x78e8('0x7')](_0x78e8('0x8'),attributes,{'tableName':_0x78e8('0x9'),'paranoid':![],'indexes':[{'name':_0x78e8('0xa'),'fields':[_0x78e8('0xb')],'type':_0x78e8('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fac12,_0x5ba002,_0x1b03b9){var _0x322d85=_0x1d7479[_0x78e8('0xd')];var _0x3fb5a6=_0x3fac12[_0x78e8('0xe')]({'plain':!![]});if(_0x3fb5a6[_0x78e8('0xf')][_0x78e8('0x10')]()==='in'||_0x3fb5a6['direction']['toLowerCase']()===_0x78e8('0x11')&&!_0x3fb5a6[_0x78e8('0x12')]&&!_[_0x78e8('0x13')](_0x3fb5a6[_0x78e8('0x14')])){_0x322d85[_0x78e8('0x15')][_0x78e8('0x16')]({'where':{'id':_0x3fb5a6[_0x78e8('0x17')]}})[_0x78e8('0x18')](function(_0x33ad51){if(_0x33ad51){_0x33ad51['update']({'lastMsgAt':_0x3fb5a6['createdAt'],'lastMsgDirection':_0x3fb5a6[_0x78e8('0xf')][_0x78e8('0x10')]()});}})[_0x78e8('0x19')](function(_0x1339f0){console[_0x78e8('0x1a')](_0x1339f0);});}if(_0x3fb5a6[_0x78e8('0xf')]===_0x78e8('0x11')&&!_0x3fb5a6['secret']){var _0x51fed0;_0x322d85[_0x78e8('0x1b')]['describe']()['then'](function(_0x5abc4e){return _0x322d85[_0x78e8('0x1c')][_0x78e8('0x1d')]({'where':{'id':_0x3fb5a6['OpenchannelAccountId']},'include':[{'model':_0x322d85[_0x78e8('0x15')],'as':'Interactions','where':{'id':_0x3fb5a6['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x322d85['CmContact'],'as':_0x78e8('0x1e'),'attributes':_[_0x78e8('0x1f')](_0x5abc4e)}]}]});})[_0x78e8('0x18')](function(_0x572266){_0x51fed0=_0x572266['get']({'plain':!![]});if(_0x51fed0&&_0x51fed0['replyUri']){logger[_0x78e8('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x78e8('0x21'),util[_0x78e8('0x22')](_0x78e8('0x23'),_0x3fb5a6['id'],_0x51fed0[_0x78e8('0x24')]));if(_0x51fed0[_0x78e8('0x25')]&&_0x51fed0[_0x78e8('0x25')][_0x78e8('0x26')]){_0x3fb5a6[_0x78e8('0x27')]=_[_0x78e8('0x28')](_0x51fed0['Interactions'][0x0],_0x78e8('0x1e'));_0x3fb5a6[_0x78e8('0x1e')]=_0x51fed0[_0x78e8('0x25')][0x0]['Contact'];}var _0x5ba002={'method':_0x78e8('0x29'),'uri':encodeURI(_0x51fed0['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5ba002[_0x78e8('0x2a')]){case'GET':_0x5ba002['qs']=_0x3fb5a6;break;case'POST':_0x5ba002[_0x78e8('0xb')]=_0x3fb5a6;break;}return rp(_0x5ba002)[_0x78e8('0x18')](function(_0x569940){logger[_0x78e8('0x20')](_0x78e8('0x2b'),'afterCreate',util[_0x78e8('0x22')](_0x78e8('0x2c'),_0x3fb5a6['id'],_0x51fed0[_0x78e8('0x24')]));if(_0x569940[_0x78e8('0xb')][_0x78e8('0x2d')]&&_0x569940[_0x78e8('0xb')][_0x78e8('0x2d')]!=_0x3fb5a6[_0x78e8('0x27')][_0x78e8('0x2d')]){return _0x322d85['OpenchannelInteraction']['update']({'threadId':_0x569940[_0x78e8('0xb')][_0x78e8('0x2d')]},{'where':{'id':_0x3fb5a6[_0x78e8('0x27')]['id']}});}else{return;}})['then'](function(){return _0x3fac12[_0x78e8('0x2e')]({'read':!![]});})[_0x78e8('0x19')](function(_0x4d73e9){logger[_0x78e8('0x1a')](_0x78e8('0x2b'),_0x78e8('0x21'),util[_0x78e8('0x2f')](_0x4d73e9,{'showHidden':![],'depth':null}));_0x1b03b9();});}else{_0x1b03b9();}})[_0x78e8('0x30')](function(){_0x1b03b9();});}else{_0x1b03b9();}}},'charset':_0x78e8('0x31'),'collate':_0x78e8('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index cb80c70..1a2cc12 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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x40b723,_0x118b22){var _0x1981ad=function(_0x1dbe18){while(--_0x1dbe18){_0x40b723['push'](_0x40b723['shift']());}};_0x1981ad(++_0x118b22);}(_0xdb28,0x106));var _0x8db2=function(_0x52526d,_0x11c758){_0x52526d=_0x52526d-0x0;var _0x136297=_0xdb28[_0x52526d];return _0x136297;};'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});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ 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(_0x4c3280,_0x26a10e){var _0x3086a7=function(_0xf399d6){while(--_0xf399d6){_0x4c3280['push'](_0x4c3280['shift']());}};_0x3086a7(++_0x26a10e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var 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 3e9db90..b2e8ca2 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 _0xb33b=['update','emit','removeListener','register','openchannelMessage:','save','remove'];(function(_0x534aa9,_0x5b7265){var _0x1a779c=function(_0x5e521d){while(--_0x5e521d){_0x534aa9['push'](_0x534aa9['shift']());}};_0x1a779c(++_0x5b7265);}(_0xb33b,0x1a2));var _0xbb33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb33b[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xbb33('0x0'),_0xbb33('0x1'),_0xbb33('0x2')];function createListener(_0x583d9,_0x2c3c4d){return function(_0x57aa56){_0x2c3c4d[_0xbb33('0x3')](_0x583d9,_0x57aa56);};}function removeListener(_0x4acb24,_0x400a6f){return function(){OpenchannelMessageEvents[_0xbb33('0x4')](_0x4acb24,_0x400a6f);};}exports[_0xbb33('0x5')]=function(_0x25449e){for(var _0x4430a3=0x0,_0x59bf58=events['length'];_0x4430a3<_0x59bf58;_0x4430a3++){var _0x38f9ed=events[_0x4430a3];var _0xf148d4=createListener(_0xbb33('0x6')+_0x38f9ed,_0x25449e);OpenchannelMessageEvents['on'](_0x38f9ed,_0xf148d4);}}; \ No newline at end of file +var _0xb353=['emit','removeListener','register','length','./openchannelMessage.events','save','remove'];(function(_0x4c87c7,_0x4bb7a4){var _0x65a9d1=function(_0x4c5fda){while(--_0x4c5fda){_0x4c87c7['push'](_0x4c87c7['shift']());}};_0x65a9d1(++_0x4bb7a4);}(_0xb353,0xdd));var _0x3b35=function(_0x240e42,_0x48e094){_0x240e42=_0x240e42-0x0;var _0xfebf05=_0xb353[_0x240e42];return _0xfebf05;};'use strict';var OpenchannelMessageEvents=require(_0x3b35('0x0'));var events=[_0x3b35('0x1'),_0x3b35('0x2'),'update'];function createListener(_0x72e594,_0xf793dd){return function(_0x263555){_0xf793dd[_0x3b35('0x3')](_0x72e594,_0x263555);};}function removeListener(_0x22509f,_0x172980){return function(){OpenchannelMessageEvents[_0x3b35('0x4')](_0x22509f,_0x172980);};}exports[_0x3b35('0x5')]=function(_0x4e3bbe){for(var _0x28638f=0x0,_0x48611f=events[_0x3b35('0x6')];_0x28638f<_0x48611f;_0x28638f++){var _0x37d4c9=events[_0x28638f];var _0x16a7c9=createListener('openchannelMessage:'+_0x37d4c9,_0x4e3bbe);OpenchannelMessageEvents['on'](_0x37d4c9,_0x16a7c9);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 09a2e19..6af94d2 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 _0xf5fe=['express','Router','../../components/auth/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x532757,_0x2f42f9){var _0x5bc417=function(_0x1e14b3){while(--_0x1e14b3){_0x532757['push'](_0x532757['shift']());}};_0x5bc417(++_0x2f42f9);}(_0xf5fe,0xc7));var _0xef5f=function(_0x41ba75,_0x6faea2){_0x41ba75=_0x41ba75-0x0;var _0x42b0dd=_0xf5fe[_0x41ba75];return _0x42b0dd;};'use strict';var multer=require(_0xef5f('0x0'));var util=require(_0xef5f('0x1'));var path=require(_0xef5f('0x2'));var timeout=require(_0xef5f('0x3'));var express=require(_0xef5f('0x4'));var router=express[_0xef5f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xef5f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xef5f('0x7'));router[_0xef5f('0x8')]('/',auth[_0xef5f('0x9')](),controller[_0xef5f('0xa')]);router[_0xef5f('0x8')](_0xef5f('0xb'),auth[_0xef5f('0x9')](),controller[_0xef5f('0xc')]);router['get'](_0xef5f('0xd'),auth['isAuthenticated'](),controller[_0xef5f('0xe')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0xef5f('0xf')]);router[_0xef5f('0x8')](_0xef5f('0x10'),auth[_0xef5f('0x9')](),controller['getTeams']);router[_0xef5f('0x8')](_0xef5f('0x11'),auth['isAuthenticated'](),controller['getAgents']);router[_0xef5f('0x12')]('/',auth[_0xef5f('0x9')](),controller[_0xef5f('0x13')]);router[_0xef5f('0x12')](_0xef5f('0x10'),auth[_0xef5f('0x9')](),controller[_0xef5f('0x14')]);router[_0xef5f('0x12')](_0xef5f('0x11'),auth['isAuthenticated'](),controller[_0xef5f('0x15')]);router[_0xef5f('0x16')]('/:id',auth[_0xef5f('0x9')](),controller[_0xef5f('0x17')]);router[_0xef5f('0x18')](_0xef5f('0xd'),auth[_0xef5f('0x9')](),controller[_0xef5f('0x19')]);router['delete']('/:id/teams',auth[_0xef5f('0x9')](),controller[_0xef5f('0x1a')]);router[_0xef5f('0x18')](_0xef5f('0x11'),auth[_0xef5f('0x9')](),controller[_0xef5f('0x1b')]);module[_0xef5f('0x1c')]=router; \ No newline at end of file +var _0x2d2a=['create','/:id/teams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/users','getAgents','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d2a,0x19d));var _0xa2d2=function(_0x31d1ee,_0x2d0b85){_0x31d1ee=_0x31d1ee-0x0;var _0x410ecd=_0x2d2a[_0x31d1ee];return _0x410ecd;};'use strict';var multer=require(_0xa2d2('0x0'));var util=require(_0xa2d2('0x1'));var path=require(_0xa2d2('0x2'));var timeout=require(_0xa2d2('0x3'));var express=require('express');var router=express[_0xa2d2('0x4')]();var fs_extra=require(_0xa2d2('0x5'));var auth=require(_0xa2d2('0x6'));var interaction=require(_0xa2d2('0x7'));var config=require(_0xa2d2('0x8'));var controller=require(_0xa2d2('0x9'));router[_0xa2d2('0xa')]('/',auth['isAuthenticated'](),controller[_0xa2d2('0xb')]);router['get'](_0xa2d2('0xc'),auth[_0xa2d2('0xd')](),controller[_0xa2d2('0xe')]);router['get']('/:id',auth[_0xa2d2('0xd')](),controller[_0xa2d2('0xf')]);router['get'](_0xa2d2('0x10'),auth[_0xa2d2('0xd')](),controller[_0xa2d2('0x11')]);router[_0xa2d2('0xa')]('/:id/teams',auth[_0xa2d2('0xd')](),controller['getTeams']);router['get'](_0xa2d2('0x12'),auth[_0xa2d2('0xd')](),controller[_0xa2d2('0x13')]);router[_0xa2d2('0x14')]('/',auth[_0xa2d2('0xd')](),controller[_0xa2d2('0x15')]);router[_0xa2d2('0x14')](_0xa2d2('0x16'),auth[_0xa2d2('0xd')](),controller['addTeams']);router[_0xa2d2('0x14')](_0xa2d2('0x12'),auth[_0xa2d2('0xd')](),controller[_0xa2d2('0x17')]);router[_0xa2d2('0x18')](_0xa2d2('0x19'),auth[_0xa2d2('0xd')](),controller[_0xa2d2('0x1a')]);router[_0xa2d2('0x1b')](_0xa2d2('0x19'),auth['isAuthenticated'](),controller[_0xa2d2('0x1c')]);router[_0xa2d2('0x1b')](_0xa2d2('0x16'),auth[_0xa2d2('0xd')](),controller[_0xa2d2('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xa2d2('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 38c445e..490b0cd 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 _0xfdd2=['beepall','roundrobin','exports','STRING','name','ENUM'];(function(_0x596224,_0x3ee7c6){var _0x59ef5f=function(_0x166f10){while(--_0x166f10){_0x596224['push'](_0x596224['shift']());}};_0x59ef5f(++_0x3ee7c6);}(_0xfdd2,0xce));var _0x2fdd=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0xfdd2[_0x22e9fe];return _0x47cd19;};'use strict';var Sequelize=require('sequelize');module[_0x2fdd('0x0')]={'name':{'type':Sequelize[_0x2fdd('0x1')],'unique':_0x2fdd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2fdd('0x3')]('rrmemory',_0x2fdd('0x4'),_0x2fdd('0x5'))}}; \ No newline at end of file +var _0xf32e=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x2f2898,_0x4b21c7){var _0x46a507=function(_0x3ebfdd){while(--_0x3ebfdd){_0x2f2898['push'](_0x2f2898['shift']());}};_0x46a507(++_0x4b21c7);}(_0xf32e,0x19c));var _0xef32=function(_0xd8eb50,_0x3db9a6){_0xd8eb50=_0xd8eb50-0x0;var _0x239bbd=_0xf32e[_0xd8eb50];return _0x239bbd;};'use strict';var Sequelize=require(_0xef32('0x0'));module[_0xef32('0x1')]={'name':{'type':Sequelize[_0xef32('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xef32('0x2')]},'timeout':{'type':Sequelize[_0xef32('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xef32('0x4')](_0xef32('0x5'),'beepall',_0xef32('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 1109a0c..d818930 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 _0x326e=['intersection','attributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','order','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','removeTeams','select','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','removeAgents','forEach','emit','userOpenchannelQueue:remove','addAgents','omit','userOpenchannelQueue:save','isArray','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','error','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type','key','query','keys','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params'];(function(_0x49c011,_0x50c182){var _0x2e9634=function(_0x267254){while(--_0x267254){_0x49c011['push'](_0x49c011['shift']());}};_0x2e9634(++_0x50c182);}(_0x326e,0xc5));var _0xe326=function(_0x4d92b2,_0x4df9a9){_0x4d92b2=_0x4d92b2-0x0;var _0x35706c=_0x326e[_0x4d92b2];return _0x35706c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe326('0x0'));var zipdir=require(_0xe326('0x1'));var jsonpatch=require(_0xe326('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe326('0x3'));var Mustache=require(_0xe326('0x4'));var util=require('util');var path=require(_0xe326('0x5'));var sox=require(_0xe326('0x6'));var csv=require(_0xe326('0x7'));var ejs=require(_0xe326('0x8'));var fs=require('fs');var fs_extra=require(_0xe326('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe326('0xa'));var jsforce=require(_0xe326('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe326('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe326('0xd'));var qs=require(_0xe326('0xe'));var as=require(_0xe326('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe326('0x10'))(_0xe326('0x11'));var utils=require(_0xe326('0x12'));var config=require(_0xe326('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe326('0x14'))['db'];config[_0xe326('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe326('0x16'))(new Redis(config[_0xe326('0x15')]));require('./openchannelQueue.socket')[_0xe326('0x17')](socket);function respondWithStatusCode(_0x35b36b,_0x1a937e){_0x1a937e=_0x1a937e||0xcc;return function(_0x88d2bb){if(_0x88d2bb){return _0x35b36b[_0xe326('0x18')](_0x1a937e);}return _0x35b36b[_0xe326('0x19')](_0x1a937e)[_0xe326('0x1a')]();};}function respondWithResult(_0x1e4c27,_0x1cfecc){_0x1cfecc=_0x1cfecc||0xc8;return function(_0x361eb4){if(_0x361eb4){return _0x1e4c27['status'](_0x1cfecc)[_0xe326('0x1b')](_0x361eb4);}};}function respondWithFilteredResult(_0x33f615,_0x1856c3){return function(_0x3c4573){if(_0x3c4573){var _0x36709a=typeof _0x1856c3['offset']===_0xe326('0x1c')&&typeof _0x1856c3[_0xe326('0x1d')]===_0xe326('0x1c');var _0x46660a=_0x3c4573[_0xe326('0x1e')];var _0x160156=_0x36709a?0x0:_0x1856c3[_0xe326('0x1f')];var _0x222f9f=_0x36709a?_0x3c4573[_0xe326('0x1e')]:_0x1856c3[_0xe326('0x1f')]+_0x1856c3[_0xe326('0x1d')];var _0x5aa627;if(_0x222f9f>=_0x46660a){_0x222f9f=_0x46660a;_0x5aa627=0xc8;}else{_0x5aa627=0xce;}_0x33f615[_0xe326('0x19')](_0x5aa627);return _0x33f615[_0xe326('0x20')](_0xe326('0x21'),_0x160156+'-'+_0x222f9f+'/'+_0x46660a)[_0xe326('0x1b')](_0x3c4573);}return null;};}function patchUpdates(_0x1a7613){return function(_0x5b285c){try{jsonpatch[_0xe326('0x22')](_0x5b285c,_0x1a7613,!![]);}catch(_0xf65fe2){return BPromise[_0xe326('0x23')](_0xf65fe2);}return _0x5b285c[_0xe326('0x24')]();};}function saveUpdates(_0xa91f95,_0x466f70){return function(_0x425c4f){if(_0x425c4f){return _0x425c4f[_0xe326('0x25')](_0xa91f95)[_0xe326('0x26')](function(_0x51604e){return _0x51604e;});}return null;};}function removeEntity(_0x22cb65,_0x28461c){return function(_0x4851ea){if(_0x4851ea){return _0x4851ea[_0xe326('0x27')]()[_0xe326('0x26')](function(){var _0x33a7b5=_0x4851ea[_0xe326('0x28')]({'plain':!![]});var _0x3f45e3=_0xe326('0x29');return db['UserProfileResource'][_0xe326('0x27')]({'where':{'type':_0x3f45e3,'resourceId':_0x33a7b5['id']}})[_0xe326('0x26')](function(){return _0x4851ea;});})[_0xe326('0x26')](function(){_0x22cb65[_0xe326('0x19')](0xcc)[_0xe326('0x1a')]();});}};}function handleEntityNotFound(_0x4a22d7,_0x47f6cd){return function(_0x386215){if(!_0x386215){_0x4a22d7[_0xe326('0x18')](0x194);}return _0x386215;};}function handleError(_0x1d4209,_0x3ee8a5){_0x3ee8a5=_0x3ee8a5||0x1f4;return function(_0x2f2c65){logger[_0xe326('0x2a')](_0x2f2c65[_0xe326('0x2b')]);if(_0x2f2c65[_0xe326('0x2c')]){delete _0x2f2c65[_0xe326('0x2c')];}_0x1d4209[_0xe326('0x19')](_0x3ee8a5)[_0xe326('0x2d')](_0x2f2c65);};}exports['index']=function(_0x4c7195,_0x318f9b){var _0x3cfbe1={},_0x43b3b7={},_0x241141={'count':0x0,'rows':[]};var _0x3997bf=_[_0xe326('0x2e')](db[_0xe326('0x2f')][_0xe326('0x30')],function(_0x6362c2){return{'name':_0x6362c2[_0xe326('0x31')],'type':_0x6362c2[_0xe326('0x32')][_0xe326('0x33')]};});_0x43b3b7['model']=_[_0xe326('0x2e')](_0x3997bf,_0xe326('0x2c'));_0x43b3b7[_0xe326('0x34')]=_[_0xe326('0x35')](_0x4c7195[_0xe326('0x34')]);_0x43b3b7['filters']=_['intersection'](_0x43b3b7[_0xe326('0x36')],_0x43b3b7[_0xe326('0x34')]);_0x3cfbe1['attributes']=_['intersection'](_0x43b3b7[_0xe326('0x36')],qs[_0xe326('0x37')](_0x4c7195['query'][_0xe326('0x37')]));_0x3cfbe1['attributes']=_0x3cfbe1['attributes'][_0xe326('0x38')]?_0x3cfbe1['attributes']:_0x43b3b7['model'];if(!_0x4c7195[_0xe326('0x34')][_0xe326('0x39')](_0xe326('0x3a'))){_0x3cfbe1[_0xe326('0x1d')]=qs['limit'](_0x4c7195[_0xe326('0x34')][_0xe326('0x1d')]);_0x3cfbe1[_0xe326('0x1f')]=qs[_0xe326('0x1f')](_0x4c7195['query'][_0xe326('0x1f')]);}_0x3cfbe1['order']=qs[_0xe326('0x3b')](_0x4c7195[_0xe326('0x34')]['sort']);_0x3cfbe1[_0xe326('0x3c')]=qs['filters'](_[_0xe326('0x3d')](_0x4c7195[_0xe326('0x34')],_0x43b3b7[_0xe326('0x3e')]),_0x3997bf);if(_0x4c7195[_0xe326('0x34')][_0xe326('0x3f')]){_0x3cfbe1[_0xe326('0x3c')]=_['merge'](_0x3cfbe1[_0xe326('0x3c')],{'$or':_['map'](_0x3997bf,function(_0x4524fb){if(_0x4524fb[_0xe326('0x32')]!==_0xe326('0x40')){var _0x823384={};_0x823384[_0x4524fb[_0xe326('0x2c')]]={'$like':'%'+_0x4c7195[_0xe326('0x34')][_0xe326('0x3f')]+'%'};return _0x823384;}})});}_0x3cfbe1=_[_0xe326('0x41')]({},_0x3cfbe1,_0x4c7195[_0xe326('0x42')]);var _0x290036={'where':_0x3cfbe1[_0xe326('0x3c')]};return db[_0xe326('0x2f')][_0xe326('0x1e')](_0x290036)[_0xe326('0x26')](function(_0x3ef896){_0x241141[_0xe326('0x1e')]=_0x3ef896;if(_0x4c7195[_0xe326('0x34')][_0xe326('0x43')]){_0x3cfbe1[_0xe326('0x44')]=[{'all':!![]}];}return db[_0xe326('0x2f')][_0xe326('0x45')](_0x3cfbe1);})['then'](function(_0x5436d8){_0x241141['rows']=_0x5436d8;return _0x241141;})[_0xe326('0x26')](respondWithFilteredResult(_0x318f9b,_0x3cfbe1))[_0xe326('0x46')](handleError(_0x318f9b,null));};exports[_0xe326('0x47')]=function(_0x224c0a,_0x3f54d5){var _0xb0f9a4={'raw':!![],'where':{'id':_0x224c0a[_0xe326('0x48')]['id']}},_0x3ef4c1={};_0x3ef4c1['model']=_[_0xe326('0x35')](db[_0xe326('0x2f')]['rawAttributes']);_0x3ef4c1[_0xe326('0x34')]=_[_0xe326('0x35')](_0x224c0a[_0xe326('0x34')]);_0x3ef4c1[_0xe326('0x3e')]=_[_0xe326('0x49')](_0x3ef4c1['model'],_0x3ef4c1[_0xe326('0x34')]);_0xb0f9a4[_0xe326('0x4a')]=_[_0xe326('0x49')](_0x3ef4c1[_0xe326('0x36')],qs[_0xe326('0x37')](_0x224c0a[_0xe326('0x34')][_0xe326('0x37')]));_0xb0f9a4['attributes']=_0xb0f9a4[_0xe326('0x4a')][_0xe326('0x38')]?_0xb0f9a4[_0xe326('0x4a')]:_0x3ef4c1[_0xe326('0x36')];if(_0x224c0a[_0xe326('0x34')][_0xe326('0x43')]){_0xb0f9a4[_0xe326('0x44')]=[{'all':!![]}];}_0xb0f9a4=_['merge']({},_0xb0f9a4,_0x224c0a[_0xe326('0x42')]);return db[_0xe326('0x2f')]['find'](_0xb0f9a4)[_0xe326('0x26')](handleEntityNotFound(_0x3f54d5,null))[_0xe326('0x26')](respondWithResult(_0x3f54d5,null))[_0xe326('0x46')](handleError(_0x3f54d5,null));};exports['create']=function(_0x35d158,_0x23eb42){return db[_0xe326('0x2f')][_0xe326('0x4b')](_0x35d158[_0xe326('0x4c')],{})[_0xe326('0x26')](function(_0x2163e9){var _0x42af16=_0x35d158[_0xe326('0x4d')]['get']({'plain':!![]});if(!_0x42af16)throw new Error(_0xe326('0x4e'));if(_0x42af16['role']===_0xe326('0x4d')){var _0x3d84b6=_0x2163e9[_0xe326('0x28')]({'plain':!![]});var _0x5a63f4=_0xe326('0x29');return db['UserProfileSection'][_0xe326('0x4f')]({'where':{'name':_0x5a63f4,'userProfileId':_0x42af16[_0xe326('0x50')]},'raw':!![]})[_0xe326('0x26')](function(_0x17742b){if(_0x17742b&&_0x17742b[_0xe326('0x51')]===0x0){return db[_0xe326('0x52')][_0xe326('0x4b')]({'name':_0x3d84b6[_0xe326('0x2c')],'resourceId':_0x3d84b6['id'],'type':_0x17742b[_0xe326('0x2c')],'sectionId':_0x17742b['id']},{})[_0xe326('0x26')](function(){return _0x2163e9;});}else{return _0x2163e9;}})['catch'](function(_0x3ebe70){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ebe70);throw _0x3ebe70;});}return _0x2163e9;})[_0xe326('0x26')](respondWithResult(_0x23eb42,0xc9))['catch'](handleError(_0x23eb42,null));};exports[_0xe326('0x25')]=function(_0x53feb0,_0x506e40){if(_0x53feb0[_0xe326('0x4c')]['id']){delete _0x53feb0[_0xe326('0x4c')]['id'];}return db['OpenchannelQueue'][_0xe326('0x4f')]({'where':{'id':_0x53feb0['params']['id']}})[_0xe326('0x26')](handleEntityNotFound(_0x506e40,null))[_0xe326('0x26')](saveUpdates(_0x53feb0['body'],null))[_0xe326('0x26')](respondWithResult(_0x506e40,null))[_0xe326('0x46')](handleError(_0x506e40,null));};exports[_0xe326('0x27')]=function(_0x4a3fcf,_0x277b7a){return db[_0xe326('0x2f')]['find']({'where':{'id':_0x4a3fcf[_0xe326('0x48')]['id']}})[_0xe326('0x26')](handleEntityNotFound(_0x277b7a,null))[_0xe326('0x26')](removeEntity(_0x277b7a,null))[_0xe326('0x46')](handleError(_0x277b7a,null));};exports['describe']=function(_0x3e3a34,_0x5800c9){return db[_0xe326('0x2f')][_0xe326('0x53')]()[_0xe326('0x26')](respondWithResult(_0x5800c9,null))[_0xe326('0x46')](handleError(_0x5800c9,null));};exports[_0xe326('0x54')]=function(_0x4eef94,_0x297592,_0x87ffd6){var _0x5b621a={'raw':!![],'where':{}},_0x52a30f={},_0x3bff75;return db[_0xe326('0x2f')][_0xe326('0x55')]({'where':{'id':_0x4eef94['params']['id']}})[_0xe326('0x26')](handleEntityNotFound(_0x297592,null))[_0xe326('0x26')](function(_0x55ca78){if(_0x55ca78){_0x3bff75=_0x55ca78[_0xe326('0x28')]({'plain':!![]});_0x52a30f[_0xe326('0x36')]=_[_0xe326('0x35')](db['UserOpenchannelQueue'][_0xe326('0x30')]);_0x52a30f[_0xe326('0x34')]=_['keys'](_0x4eef94[_0xe326('0x34')]);_0x52a30f['filters']=_[_0xe326('0x49')](_0x52a30f[_0xe326('0x36')],_0x52a30f[_0xe326('0x34')]);_0x5b621a[_0xe326('0x4a')]=_[_0xe326('0x49')](_0x52a30f[_0xe326('0x36')],qs[_0xe326('0x37')](_0x4eef94[_0xe326('0x34')][_0xe326('0x37')]));_0x5b621a[_0xe326('0x4a')]=_0x5b621a[_0xe326('0x4a')][_0xe326('0x38')]?_0x5b621a['attributes']:_0x52a30f[_0xe326('0x36')];if(!_0x4eef94[_0xe326('0x34')][_0xe326('0x39')](_0xe326('0x3a'))){_0x5b621a[_0xe326('0x1d')]=qs[_0xe326('0x1d')](_0x4eef94['query'][_0xe326('0x1d')]);_0x5b621a[_0xe326('0x1f')]=qs[_0xe326('0x1f')](_0x4eef94['query']['offset']);}_0x5b621a[_0xe326('0x56')]=qs[_0xe326('0x3b')](_0x4eef94[_0xe326('0x34')][_0xe326('0x3b')]);_0x5b621a['where']=qs[_0xe326('0x3e')](_[_0xe326('0x3d')](_0x4eef94[_0xe326('0x34')],_0x52a30f[_0xe326('0x3e')]));_0x5b621a[_0xe326('0x3c')][_0xe326('0x57')]=_0x55ca78['id'];if(_0x4eef94['query'][_0xe326('0x3f')]){_0x5b621a[_0xe326('0x3c')]=_[_0xe326('0x41')](_0x5b621a[_0xe326('0x3c')],{'$or':_['map'](_0x5b621a[_0xe326('0x4a')],function(_0x1c9287){var _0x9c1d5d={};_0x9c1d5d[_0x1c9287]={'$like':'%'+_0x4eef94[_0xe326('0x34')][_0xe326('0x3f')]+'%'};return _0x9c1d5d;})});}_0x5b621a=_[_0xe326('0x41')]({},_0x5b621a,_0x4eef94[_0xe326('0x42')]);return db[_0xe326('0x58')]['findAll'](_0x5b621a);}})[_0xe326('0x26')](function(_0x2cede0){if(_0x2cede0){return db[_0xe326('0x59')][_0xe326('0x5a')]({'where':{'id':_[_0xe326('0x2e')](_0x2cede0,_0xe326('0x5b')),'role':_0xe326('0x5c')},'attributes':['id',_0xe326('0x2c'),_0xe326('0x5d'),_0xe326('0x5e'),'createdAt']});}})[_0xe326('0x26')](function(_0x3aea70){if(_0x3aea70){return{'count':_0x3aea70['count'],'rows':_['map'](_0x3aea70['rows'],function(_0x2eee1c){return{'membername':_0x2eee1c[_0xe326('0x2c')],'UserId':_0x2eee1c['id'],'queue_name':_0x3bff75[_0xe326('0x2c')],'OpenchannelQueueId':_0x3bff75['id'],'interface':util[_0xe326('0x5f')](_0xe326('0x60'),'SIP',_0x2eee1c[_0xe326('0x2c')]),'penalty':0x0,'paused':_0x2eee1c[_0xe326('0x5d')],'createdAt':_0x2eee1c[_0xe326('0x61')],'updatedAt':_0x2eee1c[_0xe326('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe326('0x26')](respondWithFilteredResult(_0x297592,_0x5b621a))[_0xe326('0x46')](handleError(_0x297592,null));};exports[_0xe326('0x62')]=function(_0xc9ede8,_0x3debd9,_0x267841){var _0x4f1edf={};var _0x323682={};var _0x1e3a3c;var _0xda7483;return db[_0xe326('0x2f')][_0xe326('0x55')]({'where':{'id':_0xc9ede8[_0xe326('0x48')]['id']}})[_0xe326('0x26')](handleEntityNotFound(_0x3debd9,null))['then'](function(_0x50e03d){if(_0x50e03d){_0x1e3a3c=_0x50e03d;_0x323682[_0xe326('0x36')]=_[_0xe326('0x35')](db[_0xe326('0x63')][_0xe326('0x30')]);_0x323682[_0xe326('0x34')]=_[_0xe326('0x35')](_0xc9ede8[_0xe326('0x34')]);_0x323682[_0xe326('0x3e')]=_[_0xe326('0x49')](_0x323682[_0xe326('0x36')],_0x323682[_0xe326('0x34')]);_0x4f1edf[_0xe326('0x4a')]=_[_0xe326('0x49')](_0x323682[_0xe326('0x36')],qs[_0xe326('0x37')](_0xc9ede8[_0xe326('0x34')]['fields']));_0x4f1edf[_0xe326('0x4a')]=_0x4f1edf[_0xe326('0x4a')][_0xe326('0x38')]?_0x4f1edf[_0xe326('0x4a')]:_0x323682[_0xe326('0x36')];_0x4f1edf[_0xe326('0x56')]=qs[_0xe326('0x3b')](_0xc9ede8[_0xe326('0x34')][_0xe326('0x3b')]);_0x4f1edf[_0xe326('0x3c')]=qs[_0xe326('0x3e')](_[_0xe326('0x3d')](_0xc9ede8['query'],_0x323682[_0xe326('0x3e')]));if(_0xc9ede8[_0xe326('0x34')]['filter']){_0x4f1edf[_0xe326('0x3c')]=_[_0xe326('0x41')](_0x4f1edf['where'],{'$or':_[_0xe326('0x2e')](_0x4f1edf[_0xe326('0x4a')],function(_0x263199){var _0x504e78={};_0x504e78[_0x263199]={'$like':'%'+_0xc9ede8[_0xe326('0x34')][_0xe326('0x3f')]+'%'};return _0x504e78;})});}_0x4f1edf=_['merge']({},_0x4f1edf,_0xc9ede8[_0xe326('0x42')]);return _0x1e3a3c['getTeams'](_0x4f1edf);}})[_0xe326('0x26')](function(_0x32a08c){if(_0x32a08c){_0xda7483=_0x32a08c[_0xe326('0x38')];if(!_0xc9ede8[_0xe326('0x34')][_0xe326('0x39')](_0xe326('0x3a'))){_0x4f1edf[_0xe326('0x1d')]=qs[_0xe326('0x1d')](_0xc9ede8[_0xe326('0x34')][_0xe326('0x1d')]);_0x4f1edf[_0xe326('0x1f')]=qs[_0xe326('0x1f')](_0xc9ede8[_0xe326('0x34')]['offset']);}return _0x1e3a3c['getTeams'](_0x4f1edf);}})['then'](function(_0x43ff0e){if(_0x43ff0e){return _0x43ff0e?{'count':_0xda7483,'rows':_0x43ff0e}:null;}})[_0xe326('0x26')](respondWithResult(_0x3debd9,null))[_0xe326('0x46')](handleError(_0x3debd9,null));};exports[_0xe326('0x64')]=function(_0x5570bc,_0x5d3938,_0x3b32b4){var _0x1596e1=_0x5570bc[_0xe326('0x4c')][_0xe326('0x65')];return db[_0xe326('0x63')]['findAll']({'where':{'id':_0x1596e1},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe326('0x66'),'attributes':['id',_0xe326('0x2c'),_0xe326('0x67'),_0xe326('0x68'),_0xe326('0x69')],'raw':!![]}]})['then'](function(_0x18c7bf){if(_0x18c7bf){var _0x3dca8b=_['flatMap'](_0x18c7bf,function(_0x2f033f){var _0x35efdb=_0x2f033f['get']({'plain':!![]});return _0x35efdb['Agents'];});return db[_0xe326('0x2f')][_0xe326('0x4f')]({'where':{'id':_0x5570bc[_0xe326('0x48')]['id']}})['then'](function(_0xb42074){return db[_0xe326('0x6a')][_0xe326('0x6b')](function(_0x33a04a){return _0xb42074['addTeams'](_0x1596e1,{'transaction':_0x33a04a})[_0xe326('0x26')](function(){return BPromise[_0xe326('0x6c')](_0x3dca8b,function(_0x3a41bd){return db[_0xe326('0x58')]['findOrCreate']({'where':{'UserId':_0x3a41bd['id'],'OpenchannelQueueId':_0x5570bc[_0xe326('0x48')]['id']},'transaction':_0x33a04a});});})[_0xe326('0x26')](function(){_0x3dca8b['forEach'](function(_0x2098d3){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x2098d3['id'],'OpenchannelQueueId':_0xb42074['id']});});});});});}})[_0xe326('0x26')](respondWithStatusCode(_0x5d3938,null))[_0xe326('0x46')](handleError(_0x5d3938,null));};exports[_0xe326('0x6d')]=function(_0x4edd1c,_0x384130,_0x176c07){return db[_0xe326('0x63')][_0xe326('0x45')]({'where':{'id':_0x4edd1c[_0xe326('0x34')][_0xe326('0x65')]},'attributes':['id'],'include':[{'model':db[_0xe326('0x59')],'as':_0xe326('0x66'),'attributes':['id'],'raw':!![]}]})[_0xe326('0x26')](handleEntityNotFound(_0x384130,null))[_0xe326('0x26')](function(_0x3d9f97){var _0x164ffd=_['map'](_0x3d9f97,'id');var _0x5de313=[];var _0x57dfd0=[];var _0x2951c2=squel[_0xe326('0x6e')]();_0x2951c2['field']('tq.TeamId')[_0xe326('0x6f')](_0xe326('0x70'),'tq')[_0xe326('0x71')](_0xe326('0x72'),'ut',_0xe326('0x73'))[_0xe326('0x3c')](_0xe326('0x74'),_0x4edd1c[_0xe326('0x48')]['id']);for(var _0x18549c=0x0;_0x18549c<_0x3d9f97[_0xe326('0x38')];_0x18549c+=0x1){let _0x495ab3=_0x3d9f97[_0x18549c];for(var _0x5ba450=0x0;_0x5ba450<_0x495ab3[_0xe326('0x66')][_0xe326('0x38')];_0x5ba450+=0x1){let _0xb10a51=_0x495ab3[_0xe326('0x66')][_0x5ba450];var _0x405ee3=_0x2951c2[_0xe326('0x75')]();_0x405ee3['where'](_0xe326('0x76'),_0xb10a51['id']);_0x57dfd0[_0xe326('0x77')](db[_0xe326('0x6a')][_0xe326('0x34')](_0x405ee3['toString'](),{'type':db[_0xe326('0x6a')][_0xe326('0x78')]['SELECT']})[_0xe326('0x26')](function(_0x5b3db8){if(_0x5b3db8[_0xe326('0x38')]===0x1){return _0xb10a51['id'];}else{var _0x5682b3=_[_0xe326('0x79')](_[_0xe326('0x2e')](_0x5b3db8,_0xe326('0x7a')),function(_0x5798d5){return _[_0xe326('0x7b')](_0x164ffd,_0x5798d5);});if(_0x5682b3){return _0xb10a51['id'];}}}));}}return BPromise[_0xe326('0x7c')](_0x57dfd0)[_0xe326('0x26')](function(_0x4db4ca){_0x5de313=_(_0x5de313)[_0xe326('0x7d')](_0x4db4ca)['compact']()['value']();return db[_0xe326('0x2f')][_0xe326('0x4f')]({'where':{'id':_0x4edd1c[_0xe326('0x48')]['id']}})[_0xe326('0x26')](function(_0x43411b){return db[_0xe326('0x6a')][_0xe326('0x6b')](function(_0x3b1726){return _0x43411b['removeTeams'](_0x4edd1c[_0xe326('0x34')]['ids'],{'transaction':_0x3b1726})[_0xe326('0x26')](function(){if(!_['isEmpty'](_0x5de313)){return _0x43411b[_0xe326('0x7e')](_0x5de313,{'transaction':_0x3b1726});}})[_0xe326('0x26')](function(){_0x5de313[_0xe326('0x7f')](function(_0x2a6f09){socket[_0xe326('0x80')](_0xe326('0x81'),{'UserId':_0x2a6f09,'OpenchannelQueueId':_0x43411b['id']});});});});});});})[_0xe326('0x26')](respondWithStatusCode(_0x384130,null))[_0xe326('0x46')](handleError(_0x384130,null));};exports[_0xe326('0x82')]=function(_0x507865,_0x21cb1b,_0x30e328){return db[_0xe326('0x2f')][_0xe326('0x4f')]({'where':{'id':_0x507865[_0xe326('0x48')]['id']}})[_0xe326('0x26')](handleEntityNotFound(_0x21cb1b,null))[_0xe326('0x26')](function(_0x4dd46d){if(_0x4dd46d){return _0x4dd46d[_0xe326('0x82')](_0x507865[_0xe326('0x4c')]['ids'],_[_0xe326('0x83')](_0x507865['body'],['ids','id'])||{})['spread'](function(_0x3a4531){for(var _0x529937=0x0;_0x529937<_0x507865[_0xe326('0x4c')][_0xe326('0x65')]['length'];_0x529937+=0x1){socket[_0xe326('0x80')](_0xe326('0x84'),{'UserId':Number(_0x507865[_0xe326('0x4c')][_0xe326('0x65')][_0x529937]),'OpenchannelQueueId':Number(_0x507865['params']['id'])});}return _0x3a4531;});}})[_0xe326('0x26')](respondWithResult(_0x21cb1b,null))[_0xe326('0x46')](handleError(_0x21cb1b,null));};exports['removeAgents']=function(_0x16a842,_0x4551e4,_0x45391b){return db[_0xe326('0x2f')][_0xe326('0x4f')]({'where':{'id':_0x16a842[_0xe326('0x48')]['id']}})[_0xe326('0x26')](handleEntityNotFound(_0x4551e4,null))[_0xe326('0x26')](function(_0x50c643){if(_0x50c643){return _0x50c643['removeAgents'](_0x16a842[_0xe326('0x34')]['ids'])[_0xe326('0x26')](function(){if(_[_0xe326('0x85')](_0x16a842['query']['ids'])){for(var _0x3a79c2=0x0;_0x3a79c2<_0x16a842[_0xe326('0x34')]['ids'][_0xe326('0x38')];_0x3a79c2+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x16a842[_0xe326('0x34')][_0xe326('0x65')][_0x3a79c2]),'OpenchannelQueueId':Number(_0x16a842['params']['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x16a842['query'][_0xe326('0x65')]),'OpenchannelQueueId':Number(_0x16a842[_0xe326('0x48')]['id'])});}});}})[_0xe326('0x26')](respondWithStatusCode(_0x4551e4,null))['catch'](handleError(_0x4551e4,null));};exports[_0xe326('0x86')]=function(_0x2d4218,_0x145140,_0x336952){var _0x37433a={};var _0x1e2771={};var _0x3d6078;var _0x5db63f;return db[_0xe326('0x2f')][_0xe326('0x55')]({'where':{'id':_0x2d4218[_0xe326('0x48')]['id']}})['then'](handleEntityNotFound(_0x145140,null))[_0xe326('0x26')](function(_0x5f58e2){if(_0x5f58e2){_0x3d6078=_0x5f58e2;_0x1e2771['model']=_[_0xe326('0x35')](db[_0xe326('0x59')][_0xe326('0x30')]);_0x1e2771['query']=_[_0xe326('0x35')](_0x2d4218['query']);_0x1e2771[_0xe326('0x3e')]=_[_0xe326('0x49')](_0x1e2771['model'],_0x1e2771[_0xe326('0x34')]);_0x37433a['attributes']=_[_0xe326('0x49')](_0x1e2771[_0xe326('0x36')],qs[_0xe326('0x37')](_0x2d4218['query'][_0xe326('0x37')]));_0x37433a[_0xe326('0x4a')]=_0x37433a['attributes'][_0xe326('0x38')]?_0x37433a[_0xe326('0x4a')]:_0x1e2771[_0xe326('0x36')];_0x37433a[_0xe326('0x56')]=qs['sort'](_0x2d4218[_0xe326('0x34')][_0xe326('0x3b')]);_0x37433a['where']=qs[_0xe326('0x3e')](_['pick'](_0x2d4218['query'],_0x1e2771[_0xe326('0x3e')]));if(_0x2d4218['query']['filter']){_0x37433a[_0xe326('0x3c')]=_[_0xe326('0x41')](_0x37433a['where'],{'$or':_['map'](_0x37433a[_0xe326('0x4a')],function(_0x5bb564){var _0x1a2efc={};_0x1a2efc[_0x5bb564]={'$like':'%'+_0x2d4218[_0xe326('0x34')][_0xe326('0x3f')]+'%'};return _0x1a2efc;})});}_0x37433a=_[_0xe326('0x41')]({},_0x37433a,_0x2d4218['options']);return _0x3d6078[_0xe326('0x86')](_0x37433a);}})[_0xe326('0x26')](function(_0x5785b){if(_0x5785b){_0x5db63f=_0x5785b[_0xe326('0x38')];if(!_0x2d4218[_0xe326('0x34')][_0xe326('0x39')](_0xe326('0x3a'))){_0x37433a[_0xe326('0x1d')]=qs[_0xe326('0x1d')](_0x2d4218[_0xe326('0x34')][_0xe326('0x1d')]);_0x37433a[_0xe326('0x1f')]=qs['offset'](_0x2d4218[_0xe326('0x34')][_0xe326('0x1f')]);}return _0x3d6078[_0xe326('0x86')](_0x37433a);}})[_0xe326('0x26')](function(_0x3d2fe7){if(_0x3d2fe7){return _0x3d2fe7?{'count':_0x5db63f,'rows':_0x3d2fe7}:null;}})[_0xe326('0x26')](respondWithResult(_0x145140,null))[_0xe326('0x46')](handleError(_0x145140,null));}; \ No newline at end of file +var _0xfd74=['getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','fieldName','model','map','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueue','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','hasOwnProperty','order','OpenchannelQueueId','UserOpenchannelQueue','User','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','getTeams','Team','addTeams','ids','Agents','online','interface','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','compact','isEmpty','forEach','omit','spread','removeAgents','isArray'];(function(_0x5baec5,_0x1ef2e9){var _0x46db04=function(_0x2172c6){while(--_0x2172c6){_0x5baec5['push'](_0x5baec5['shift']());}};_0x46db04(++_0x1ef2e9);}(_0xfd74,0x91));var _0x4fd7=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0xfd74[_0x1314d4];return _0x584ba5;};'use strict';var emlformat=require(_0x4fd7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fd7('0x1'));var jsonpatch=require(_0x4fd7('0x2'));var rp=require(_0x4fd7('0x3'));var moment=require(_0x4fd7('0x4'));var BPromise=require(_0x4fd7('0x5'));var Mustache=require(_0x4fd7('0x6'));var util=require(_0x4fd7('0x7'));var path=require(_0x4fd7('0x8'));var sox=require(_0x4fd7('0x9'));var csv=require(_0x4fd7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4fd7('0xb'));var _=require(_0x4fd7('0xc'));var squel=require(_0x4fd7('0xd'));var crypto=require(_0x4fd7('0xe'));var jsforce=require(_0x4fd7('0xf'));var deskjs=require(_0x4fd7('0x10'));var toCsv=require(_0x4fd7('0xa'));var querystring=require(_0x4fd7('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4fd7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4fd7('0x13'));var hardwareService=require(_0x4fd7('0x14'));var logger=require(_0x4fd7('0x15'))(_0x4fd7('0x16'));var utils=require(_0x4fd7('0x17'));var config=require(_0x4fd7('0x18'));var licenseUtil=require(_0x4fd7('0x19'));var db=require(_0x4fd7('0x1a'))['db'];config[_0x4fd7('0x1b')]=_[_0x4fd7('0x1c')](config[_0x4fd7('0x1b')],{'host':_0x4fd7('0x1d'),'port':0x18eb});var socket=require(_0x4fd7('0x1e'))(new Redis(config[_0x4fd7('0x1b')]));require(_0x4fd7('0x1f'))[_0x4fd7('0x20')](socket);function respondWithStatusCode(_0x4ee2b8,_0xcda06){_0xcda06=_0xcda06||0xcc;return function(_0x2648e1){if(_0x2648e1){return _0x4ee2b8['sendStatus'](_0xcda06);}return _0x4ee2b8[_0x4fd7('0x21')](_0xcda06)[_0x4fd7('0x22')]();};}function respondWithResult(_0x121d26,_0x32e2a8){_0x32e2a8=_0x32e2a8||0xc8;return function(_0x52ce3b){if(_0x52ce3b){return _0x121d26[_0x4fd7('0x21')](_0x32e2a8)[_0x4fd7('0x23')](_0x52ce3b);}};}function respondWithFilteredResult(_0x5b3302,_0x545fad){return function(_0x1f1ab0){if(_0x1f1ab0){var _0x2ddb2c=typeof _0x545fad[_0x4fd7('0x24')]===_0x4fd7('0x25')&&typeof _0x545fad[_0x4fd7('0x26')]===_0x4fd7('0x25');var _0x19a267=_0x1f1ab0[_0x4fd7('0x27')];var _0x1f51c9=_0x2ddb2c?0x0:_0x545fad['offset'];var _0x4280e3=_0x2ddb2c?_0x1f1ab0['count']:_0x545fad[_0x4fd7('0x24')]+_0x545fad['limit'];var _0x1f1ce5;if(_0x4280e3>=_0x19a267){_0x4280e3=_0x19a267;_0x1f1ce5=0xc8;}else{_0x1f1ce5=0xce;}_0x5b3302[_0x4fd7('0x21')](_0x1f1ce5);return _0x5b3302[_0x4fd7('0x28')](_0x4fd7('0x29'),_0x1f51c9+'-'+_0x4280e3+'/'+_0x19a267)[_0x4fd7('0x23')](_0x1f1ab0);}return null;};}function patchUpdates(_0x20ad93){return function(_0xaf44db){try{jsonpatch['apply'](_0xaf44db,_0x20ad93,!![]);}catch(_0x122fc7){return BPromise[_0x4fd7('0x2a')](_0x122fc7);}return _0xaf44db[_0x4fd7('0x2b')]();};}function saveUpdates(_0x46ca98,_0x3f8e81){return function(_0xfee644){if(_0xfee644){return _0xfee644['update'](_0x46ca98)['then'](function(_0x110857){return _0x110857;});}return null;};}function removeEntity(_0x1ce6ac,_0x2497d7){return function(_0x5d3ada){if(_0x5d3ada){return _0x5d3ada[_0x4fd7('0x2c')]()[_0x4fd7('0x2d')](function(){var _0x17e0af=_0x5d3ada['get']({'plain':!![]});var _0x374ad0=_0x4fd7('0x2e');return db[_0x4fd7('0x2f')][_0x4fd7('0x2c')]({'where':{'type':_0x374ad0,'resourceId':_0x17e0af['id']}})[_0x4fd7('0x2d')](function(){return _0x5d3ada;});})[_0x4fd7('0x2d')](function(){_0x1ce6ac[_0x4fd7('0x21')](0xcc)[_0x4fd7('0x22')]();});}};}function handleEntityNotFound(_0x2be61f,_0x13d10f){return function(_0x1ff3c3){if(!_0x1ff3c3){_0x2be61f[_0x4fd7('0x30')](0x194);}return _0x1ff3c3;};}function handleError(_0x2992da,_0x2459f9){_0x2459f9=_0x2459f9||0x1f4;return function(_0x1df7c1){logger[_0x4fd7('0x31')](_0x1df7c1[_0x4fd7('0x32')]);if(_0x1df7c1[_0x4fd7('0x33')]){delete _0x1df7c1[_0x4fd7('0x33')];}_0x2992da[_0x4fd7('0x21')](_0x2459f9)[_0x4fd7('0x34')](_0x1df7c1);};}exports[_0x4fd7('0x35')]=function(_0x2bebd9,_0x2a048a){var _0x2b422b={},_0xa82d0c={},_0x316fa2={'count':0x0,'rows':[]};var _0x3f5b83=_['map'](db['OpenchannelQueue']['rawAttributes'],function(_0x274a60){return{'name':_0x274a60[_0x4fd7('0x36')],'type':_0x274a60['type']['key']};});_0xa82d0c[_0x4fd7('0x37')]=_[_0x4fd7('0x38')](_0x3f5b83,_0x4fd7('0x33'));_0xa82d0c[_0x4fd7('0x39')]=_[_0x4fd7('0x3a')](_0x2bebd9['query']);_0xa82d0c[_0x4fd7('0x3b')]=_[_0x4fd7('0x3c')](_0xa82d0c[_0x4fd7('0x37')],_0xa82d0c[_0x4fd7('0x39')]);_0x2b422b['attributes']=_[_0x4fd7('0x3c')](_0xa82d0c[_0x4fd7('0x37')],qs['fields'](_0x2bebd9[_0x4fd7('0x39')][_0x4fd7('0x3d')]));_0x2b422b[_0x4fd7('0x3e')]=_0x2b422b[_0x4fd7('0x3e')]['length']?_0x2b422b[_0x4fd7('0x3e')]:_0xa82d0c[_0x4fd7('0x37')];if(!_0x2bebd9[_0x4fd7('0x39')]['hasOwnProperty'](_0x4fd7('0x3f'))){_0x2b422b[_0x4fd7('0x26')]=qs[_0x4fd7('0x26')](_0x2bebd9[_0x4fd7('0x39')][_0x4fd7('0x26')]);_0x2b422b['offset']=qs[_0x4fd7('0x24')](_0x2bebd9[_0x4fd7('0x39')][_0x4fd7('0x24')]);}_0x2b422b['order']=qs[_0x4fd7('0x40')](_0x2bebd9[_0x4fd7('0x39')]['sort']);_0x2b422b[_0x4fd7('0x41')]=qs['filters'](_[_0x4fd7('0x42')](_0x2bebd9['query'],_0xa82d0c[_0x4fd7('0x3b')]),_0x3f5b83);if(_0x2bebd9['query'][_0x4fd7('0x43')]){_0x2b422b['where']=_[_0x4fd7('0x44')](_0x2b422b[_0x4fd7('0x41')],{'$or':_['map'](_0x3f5b83,function(_0x2222b4){if(_0x2222b4['type']!==_0x4fd7('0x45')){var _0x2afa32={};_0x2afa32[_0x2222b4[_0x4fd7('0x33')]]={'$like':'%'+_0x2bebd9[_0x4fd7('0x39')]['filter']+'%'};return _0x2afa32;}})});}_0x2b422b=_[_0x4fd7('0x44')]({},_0x2b422b,_0x2bebd9[_0x4fd7('0x46')]);var _0x1aa2cb={'where':_0x2b422b[_0x4fd7('0x41')]};return db[_0x4fd7('0x47')][_0x4fd7('0x27')](_0x1aa2cb)[_0x4fd7('0x2d')](function(_0xaa01fa){_0x316fa2[_0x4fd7('0x27')]=_0xaa01fa;if(_0x2bebd9['query']['includeAll']){_0x2b422b[_0x4fd7('0x48')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x4fd7('0x49')](_0x2b422b);})[_0x4fd7('0x2d')](function(_0x38b204){_0x316fa2[_0x4fd7('0x4a')]=_0x38b204;return _0x316fa2;})[_0x4fd7('0x2d')](respondWithFilteredResult(_0x2a048a,_0x2b422b))[_0x4fd7('0x4b')](handleError(_0x2a048a,null));};exports[_0x4fd7('0x4c')]=function(_0x23a632,_0x5465e6){var _0x59e980={'raw':!![],'where':{'id':_0x23a632[_0x4fd7('0x4d')]['id']}},_0x582d1c={};_0x582d1c[_0x4fd7('0x37')]=_[_0x4fd7('0x3a')](db[_0x4fd7('0x47')][_0x4fd7('0x4e')]);_0x582d1c[_0x4fd7('0x39')]=_['keys'](_0x23a632['query']);_0x582d1c[_0x4fd7('0x3b')]=_['intersection'](_0x582d1c[_0x4fd7('0x37')],_0x582d1c[_0x4fd7('0x39')]);_0x59e980['attributes']=_[_0x4fd7('0x3c')](_0x582d1c[_0x4fd7('0x37')],qs['fields'](_0x23a632[_0x4fd7('0x39')]['fields']));_0x59e980[_0x4fd7('0x3e')]=_0x59e980['attributes'][_0x4fd7('0x4f')]?_0x59e980['attributes']:_0x582d1c['model'];if(_0x23a632[_0x4fd7('0x39')][_0x4fd7('0x50')]){_0x59e980[_0x4fd7('0x48')]=[{'all':!![]}];}_0x59e980=_[_0x4fd7('0x44')]({},_0x59e980,_0x23a632['options']);return db['OpenchannelQueue']['find'](_0x59e980)[_0x4fd7('0x2d')](handleEntityNotFound(_0x5465e6,null))[_0x4fd7('0x2d')](respondWithResult(_0x5465e6,null))['catch'](handleError(_0x5465e6,null));};exports[_0x4fd7('0x51')]=function(_0x21a462,_0x5b1544){return db[_0x4fd7('0x47')]['create'](_0x21a462[_0x4fd7('0x52')],{})[_0x4fd7('0x2d')](function(_0x2a1d9c){var _0x2a7764=_0x21a462[_0x4fd7('0x53')][_0x4fd7('0x54')]({'plain':!![]});if(!_0x2a7764)throw new Error(_0x4fd7('0x55'));if(_0x2a7764['role']===_0x4fd7('0x53')){var _0xaa14b6=_0x2a1d9c[_0x4fd7('0x54')]({'plain':!![]});var _0x22b1e7=_0x4fd7('0x2e');return db[_0x4fd7('0x56')][_0x4fd7('0x57')]({'where':{'name':_0x22b1e7,'userProfileId':_0x2a7764[_0x4fd7('0x58')]},'raw':!![]})['then'](function(_0x352ed1){if(_0x352ed1&&_0x352ed1[_0x4fd7('0x59')]===0x0){return db[_0x4fd7('0x2f')][_0x4fd7('0x51')]({'name':_0xaa14b6[_0x4fd7('0x33')],'resourceId':_0xaa14b6['id'],'type':_0x352ed1[_0x4fd7('0x33')],'sectionId':_0x352ed1['id']},{})['then'](function(){return _0x2a1d9c;});}else{return _0x2a1d9c;}})['catch'](function(_0x28f53c){logger[_0x4fd7('0x31')](_0x4fd7('0x5a'),_0x28f53c);throw _0x28f53c;});}return _0x2a1d9c;})[_0x4fd7('0x2d')](respondWithResult(_0x5b1544,0xc9))[_0x4fd7('0x4b')](handleError(_0x5b1544,null));};exports[_0x4fd7('0x5b')]=function(_0x57d3a5,_0x1e1b35){if(_0x57d3a5[_0x4fd7('0x52')]['id']){delete _0x57d3a5['body']['id'];}return db[_0x4fd7('0x47')]['find']({'where':{'id':_0x57d3a5[_0x4fd7('0x4d')]['id']}})[_0x4fd7('0x2d')](handleEntityNotFound(_0x1e1b35,null))[_0x4fd7('0x2d')](saveUpdates(_0x57d3a5[_0x4fd7('0x52')],null))['then'](respondWithResult(_0x1e1b35,null))[_0x4fd7('0x4b')](handleError(_0x1e1b35,null));};exports[_0x4fd7('0x2c')]=function(_0x45a788,_0x13ca1d){return db[_0x4fd7('0x47')][_0x4fd7('0x57')]({'where':{'id':_0x45a788['params']['id']}})[_0x4fd7('0x2d')](handleEntityNotFound(_0x13ca1d,null))['then'](removeEntity(_0x13ca1d,null))['catch'](handleError(_0x13ca1d,null));};exports[_0x4fd7('0x5c')]=function(_0x3eac20,_0x3bd378){return db[_0x4fd7('0x47')][_0x4fd7('0x5c')]()['then'](respondWithResult(_0x3bd378,null))[_0x4fd7('0x4b')](handleError(_0x3bd378,null));};exports[_0x4fd7('0x5d')]=function(_0x161284,_0x48f033,_0x27fc7d){var _0x11f35b={'raw':!![],'where':{}},_0x2f159a={},_0x3de429;return db['OpenchannelQueue'][_0x4fd7('0x5e')]({'where':{'id':_0x161284[_0x4fd7('0x4d')]['id']}})[_0x4fd7('0x2d')](handleEntityNotFound(_0x48f033,null))[_0x4fd7('0x2d')](function(_0x4b7a54){if(_0x4b7a54){_0x3de429=_0x4b7a54[_0x4fd7('0x54')]({'plain':!![]});_0x2f159a[_0x4fd7('0x37')]=_[_0x4fd7('0x3a')](db['UserOpenchannelQueue'][_0x4fd7('0x4e')]);_0x2f159a[_0x4fd7('0x39')]=_[_0x4fd7('0x3a')](_0x161284[_0x4fd7('0x39')]);_0x2f159a[_0x4fd7('0x3b')]=_[_0x4fd7('0x3c')](_0x2f159a['model'],_0x2f159a['query']);_0x11f35b[_0x4fd7('0x3e')]=_['intersection'](_0x2f159a[_0x4fd7('0x37')],qs[_0x4fd7('0x3d')](_0x161284[_0x4fd7('0x39')][_0x4fd7('0x3d')]));_0x11f35b['attributes']=_0x11f35b[_0x4fd7('0x3e')][_0x4fd7('0x4f')]?_0x11f35b[_0x4fd7('0x3e')]:_0x2f159a[_0x4fd7('0x37')];if(!_0x161284[_0x4fd7('0x39')][_0x4fd7('0x5f')](_0x4fd7('0x3f'))){_0x11f35b[_0x4fd7('0x26')]=qs[_0x4fd7('0x26')](_0x161284['query'][_0x4fd7('0x26')]);_0x11f35b[_0x4fd7('0x24')]=qs['offset'](_0x161284[_0x4fd7('0x39')]['offset']);}_0x11f35b[_0x4fd7('0x60')]=qs[_0x4fd7('0x40')](_0x161284['query'][_0x4fd7('0x40')]);_0x11f35b[_0x4fd7('0x41')]=qs[_0x4fd7('0x3b')](_[_0x4fd7('0x42')](_0x161284['query'],_0x2f159a['filters']));_0x11f35b[_0x4fd7('0x41')][_0x4fd7('0x61')]=_0x4b7a54['id'];if(_0x161284[_0x4fd7('0x39')][_0x4fd7('0x43')]){_0x11f35b['where']=_[_0x4fd7('0x44')](_0x11f35b[_0x4fd7('0x41')],{'$or':_[_0x4fd7('0x38')](_0x11f35b[_0x4fd7('0x3e')],function(_0x2c6dae){var _0x388890={};_0x388890[_0x2c6dae]={'$like':'%'+_0x161284[_0x4fd7('0x39')][_0x4fd7('0x43')]+'%'};return _0x388890;})});}_0x11f35b=_[_0x4fd7('0x44')]({},_0x11f35b,_0x161284[_0x4fd7('0x46')]);return db[_0x4fd7('0x62')][_0x4fd7('0x49')](_0x11f35b);}})[_0x4fd7('0x2d')](function(_0x12e30d){if(_0x12e30d){return db[_0x4fd7('0x63')]['findAndCountAll']({'where':{'id':_[_0x4fd7('0x38')](_0x12e30d,_0x4fd7('0x64')),'role':_0x4fd7('0x65')},'attributes':['id',_0x4fd7('0x33'),_0x4fd7('0x66'),_0x4fd7('0x67'),_0x4fd7('0x68')]});}})[_0x4fd7('0x2d')](function(_0x711055){if(_0x711055){return{'count':_0x711055[_0x4fd7('0x27')],'rows':_['map'](_0x711055[_0x4fd7('0x4a')],function(_0x5cf75e){return{'membername':_0x5cf75e['name'],'UserId':_0x5cf75e['id'],'queue_name':_0x3de429[_0x4fd7('0x33')],'OpenchannelQueueId':_0x3de429['id'],'interface':util['format'](_0x4fd7('0x69'),'SIP',_0x5cf75e[_0x4fd7('0x33')]),'penalty':0x0,'paused':_0x5cf75e[_0x4fd7('0x66')],'createdAt':_0x5cf75e['createdAt'],'updatedAt':_0x5cf75e[_0x4fd7('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x48f033,_0x11f35b))[_0x4fd7('0x4b')](handleError(_0x48f033,null));};exports[_0x4fd7('0x6a')]=function(_0x263626,_0x3bb041,_0x5a27aa){var _0x11a462={};var _0x2e0eb3={};var _0x4c389f;var _0x5ca773;return db[_0x4fd7('0x47')]['findOne']({'where':{'id':_0x263626[_0x4fd7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3bb041,null))[_0x4fd7('0x2d')](function(_0x470ae0){if(_0x470ae0){_0x4c389f=_0x470ae0;_0x2e0eb3[_0x4fd7('0x37')]=_['keys'](db[_0x4fd7('0x6b')][_0x4fd7('0x4e')]);_0x2e0eb3['query']=_['keys'](_0x263626[_0x4fd7('0x39')]);_0x2e0eb3[_0x4fd7('0x3b')]=_[_0x4fd7('0x3c')](_0x2e0eb3['model'],_0x2e0eb3[_0x4fd7('0x39')]);_0x11a462[_0x4fd7('0x3e')]=_[_0x4fd7('0x3c')](_0x2e0eb3[_0x4fd7('0x37')],qs[_0x4fd7('0x3d')](_0x263626[_0x4fd7('0x39')]['fields']));_0x11a462[_0x4fd7('0x3e')]=_0x11a462[_0x4fd7('0x3e')][_0x4fd7('0x4f')]?_0x11a462[_0x4fd7('0x3e')]:_0x2e0eb3[_0x4fd7('0x37')];_0x11a462['order']=qs['sort'](_0x263626['query'][_0x4fd7('0x40')]);_0x11a462[_0x4fd7('0x41')]=qs['filters'](_[_0x4fd7('0x42')](_0x263626['query'],_0x2e0eb3[_0x4fd7('0x3b')]));if(_0x263626[_0x4fd7('0x39')][_0x4fd7('0x43')]){_0x11a462[_0x4fd7('0x41')]=_[_0x4fd7('0x44')](_0x11a462[_0x4fd7('0x41')],{'$or':_[_0x4fd7('0x38')](_0x11a462[_0x4fd7('0x3e')],function(_0x5939bd){var _0x182516={};_0x182516[_0x5939bd]={'$like':'%'+_0x263626['query'][_0x4fd7('0x43')]+'%'};return _0x182516;})});}_0x11a462=_[_0x4fd7('0x44')]({},_0x11a462,_0x263626['options']);return _0x4c389f[_0x4fd7('0x6a')](_0x11a462);}})['then'](function(_0x4bf0b4){if(_0x4bf0b4){_0x5ca773=_0x4bf0b4[_0x4fd7('0x4f')];if(!_0x263626[_0x4fd7('0x39')][_0x4fd7('0x5f')](_0x4fd7('0x3f'))){_0x11a462[_0x4fd7('0x26')]=qs[_0x4fd7('0x26')](_0x263626[_0x4fd7('0x39')][_0x4fd7('0x26')]);_0x11a462['offset']=qs[_0x4fd7('0x24')](_0x263626[_0x4fd7('0x39')][_0x4fd7('0x24')]);}return _0x4c389f['getTeams'](_0x11a462);}})[_0x4fd7('0x2d')](function(_0x2a0058){if(_0x2a0058){return _0x2a0058?{'count':_0x5ca773,'rows':_0x2a0058}:null;}})['then'](respondWithResult(_0x3bb041,null))[_0x4fd7('0x4b')](handleError(_0x3bb041,null));};exports[_0x4fd7('0x6c')]=function(_0x11e1d9,_0x59bb76,_0x5e10a1){var _0xfdeb2b=_0x11e1d9[_0x4fd7('0x52')][_0x4fd7('0x6d')];return db[_0x4fd7('0x6b')][_0x4fd7('0x49')]({'where':{'id':_0xfdeb2b},'attributes':['id'],'include':[{'model':db[_0x4fd7('0x63')],'as':_0x4fd7('0x6e'),'attributes':['id',_0x4fd7('0x33'),_0x4fd7('0x6f'),'voicePause',_0x4fd7('0x70')],'raw':!![]}]})[_0x4fd7('0x2d')](function(_0x565e85){if(_0x565e85){var _0x36f391=_['flatMap'](_0x565e85,function(_0x558638){var _0x4e56aa=_0x558638[_0x4fd7('0x54')]({'plain':!![]});return _0x4e56aa['Agents'];});return db[_0x4fd7('0x47')]['find']({'where':{'id':_0x11e1d9[_0x4fd7('0x4d')]['id']}})[_0x4fd7('0x2d')](function(_0x202de4){return db[_0x4fd7('0x71')][_0x4fd7('0x72')](function(_0x5dac5a){return _0x202de4[_0x4fd7('0x6c')](_0xfdeb2b,{'transaction':_0x5dac5a})[_0x4fd7('0x2d')](function(){return BPromise[_0x4fd7('0x73')](_0x36f391,function(_0x2391cf){return db[_0x4fd7('0x62')][_0x4fd7('0x74')]({'where':{'UserId':_0x2391cf['id'],'OpenchannelQueueId':_0x11e1d9[_0x4fd7('0x4d')]['id']},'transaction':_0x5dac5a});});})[_0x4fd7('0x2d')](function(){_0x36f391['forEach'](function(_0x49e702){socket[_0x4fd7('0x75')]('userOpenchannelQueue:save',{'UserId':_0x49e702['id'],'OpenchannelQueueId':_0x202de4['id']});});});});});}})['then'](respondWithStatusCode(_0x59bb76,null))[_0x4fd7('0x4b')](handleError(_0x59bb76,null));};exports[_0x4fd7('0x76')]=function(_0x2bce3a,_0x4469ff,_0x429b9c){return db[_0x4fd7('0x6b')][_0x4fd7('0x49')]({'where':{'id':_0x2bce3a[_0x4fd7('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4fd7('0x63')],'as':_0x4fd7('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x4fd7('0x2d')](handleEntityNotFound(_0x4469ff,null))[_0x4fd7('0x2d')](function(_0x1f79f3){var _0x51f929=_[_0x4fd7('0x38')](_0x1f79f3,'id');var _0x1e82e6=[];var _0x2d77e6=[];var _0x23c37e=squel[_0x4fd7('0x77')]();_0x23c37e[_0x4fd7('0x78')](_0x4fd7('0x79'))[_0x4fd7('0x7a')](_0x4fd7('0x7b'),'tq')[_0x4fd7('0x7c')](_0x4fd7('0x7d'),'ut',_0x4fd7('0x7e'))[_0x4fd7('0x41')](_0x4fd7('0x7f'),_0x2bce3a[_0x4fd7('0x4d')]['id']);for(var _0x26d034=0x0;_0x26d034<_0x1f79f3[_0x4fd7('0x4f')];_0x26d034+=0x1){let _0x13b1f9=_0x1f79f3[_0x26d034];for(var _0xbb3a8=0x0;_0xbb3a8<_0x13b1f9['Agents'][_0x4fd7('0x4f')];_0xbb3a8+=0x1){let _0x22c100=_0x13b1f9['Agents'][_0xbb3a8];var _0x20dcbf=_0x23c37e['clone']();_0x20dcbf['where'](_0x4fd7('0x80'),_0x22c100['id']);_0x2d77e6[_0x4fd7('0x81')](db[_0x4fd7('0x71')][_0x4fd7('0x39')](_0x20dcbf[_0x4fd7('0x82')](),{'type':db[_0x4fd7('0x71')][_0x4fd7('0x83')][_0x4fd7('0x84')]})[_0x4fd7('0x2d')](function(_0x1faef9){if(_0x1faef9[_0x4fd7('0x4f')]===0x1){return _0x22c100['id'];}else{var _0x2d7dca=_[_0x4fd7('0x85')](_[_0x4fd7('0x38')](_0x1faef9,'TeamId'),function(_0x3e2ef3){return _['includes'](_0x51f929,_0x3e2ef3);});if(_0x2d7dca){return _0x22c100['id'];}}}));}}return BPromise[_0x4fd7('0x86')](_0x2d77e6)[_0x4fd7('0x2d')](function(_0x38ae16){_0x1e82e6=_(_0x1e82e6)[_0x4fd7('0x87')](_0x38ae16)[_0x4fd7('0x88')]()['value']();return db['OpenchannelQueue']['find']({'where':{'id':_0x2bce3a[_0x4fd7('0x4d')]['id']}})[_0x4fd7('0x2d')](function(_0x3d04f9){return db['sequelize'][_0x4fd7('0x72')](function(_0x4bdddf){return _0x3d04f9['removeTeams'](_0x2bce3a['query'][_0x4fd7('0x6d')],{'transaction':_0x4bdddf})[_0x4fd7('0x2d')](function(){if(!_[_0x4fd7('0x89')](_0x1e82e6)){return _0x3d04f9['removeAgents'](_0x1e82e6,{'transaction':_0x4bdddf});}})[_0x4fd7('0x2d')](function(){_0x1e82e6[_0x4fd7('0x8a')](function(_0x301431){socket[_0x4fd7('0x75')]('userOpenchannelQueue:remove',{'UserId':_0x301431,'OpenchannelQueueId':_0x3d04f9['id']});});});});});});})['then'](respondWithStatusCode(_0x4469ff,null))[_0x4fd7('0x4b')](handleError(_0x4469ff,null));};exports['addAgents']=function(_0x5ec3bc,_0x41b9fa,_0x544081){return db[_0x4fd7('0x47')][_0x4fd7('0x57')]({'where':{'id':_0x5ec3bc['params']['id']}})[_0x4fd7('0x2d')](handleEntityNotFound(_0x41b9fa,null))[_0x4fd7('0x2d')](function(_0x5cfe37){if(_0x5cfe37){return _0x5cfe37['addAgents'](_0x5ec3bc[_0x4fd7('0x52')]['ids'],_[_0x4fd7('0x8b')](_0x5ec3bc[_0x4fd7('0x52')],[_0x4fd7('0x6d'),'id'])||{})[_0x4fd7('0x8c')](function(_0x37a1e6){for(var _0x365cfa=0x0;_0x365cfa<_0x5ec3bc[_0x4fd7('0x52')]['ids']['length'];_0x365cfa+=0x1){socket[_0x4fd7('0x75')]('userOpenchannelQueue:save',{'UserId':Number(_0x5ec3bc[_0x4fd7('0x52')][_0x4fd7('0x6d')][_0x365cfa]),'OpenchannelQueueId':Number(_0x5ec3bc[_0x4fd7('0x4d')]['id'])});}return _0x37a1e6;});}})['then'](respondWithResult(_0x41b9fa,null))[_0x4fd7('0x4b')](handleError(_0x41b9fa,null));};exports[_0x4fd7('0x8d')]=function(_0x4a2899,_0x57625c,_0x15986c){return db[_0x4fd7('0x47')]['find']({'where':{'id':_0x4a2899[_0x4fd7('0x4d')]['id']}})[_0x4fd7('0x2d')](handleEntityNotFound(_0x57625c,null))[_0x4fd7('0x2d')](function(_0x7e4453){if(_0x7e4453){return _0x7e4453[_0x4fd7('0x8d')](_0x4a2899['query'][_0x4fd7('0x6d')])['then'](function(){if(_[_0x4fd7('0x8e')](_0x4a2899[_0x4fd7('0x39')][_0x4fd7('0x6d')])){for(var _0x11b3da=0x0;_0x11b3da<_0x4a2899[_0x4fd7('0x39')]['ids'][_0x4fd7('0x4f')];_0x11b3da+=0x1){socket[_0x4fd7('0x75')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4a2899['query'][_0x4fd7('0x6d')][_0x11b3da]),'OpenchannelQueueId':Number(_0x4a2899[_0x4fd7('0x4d')]['id'])});}}else{socket[_0x4fd7('0x75')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4a2899[_0x4fd7('0x39')][_0x4fd7('0x6d')]),'OpenchannelQueueId':Number(_0x4a2899[_0x4fd7('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x57625c,null))[_0x4fd7('0x4b')](handleError(_0x57625c,null));};exports[_0x4fd7('0x8f')]=function(_0x354462,_0x4788e9,_0x230b35){var _0x409703={};var _0xc6fe3e={};var _0x3f97c4;var _0x2cabe1;return db[_0x4fd7('0x47')][_0x4fd7('0x5e')]({'where':{'id':_0x354462[_0x4fd7('0x4d')]['id']}})[_0x4fd7('0x2d')](handleEntityNotFound(_0x4788e9,null))[_0x4fd7('0x2d')](function(_0x3bd5e1){if(_0x3bd5e1){_0x3f97c4=_0x3bd5e1;_0xc6fe3e[_0x4fd7('0x37')]=_[_0x4fd7('0x3a')](db['User'][_0x4fd7('0x4e')]);_0xc6fe3e[_0x4fd7('0x39')]=_[_0x4fd7('0x3a')](_0x354462[_0x4fd7('0x39')]);_0xc6fe3e['filters']=_[_0x4fd7('0x3c')](_0xc6fe3e[_0x4fd7('0x37')],_0xc6fe3e['query']);_0x409703[_0x4fd7('0x3e')]=_[_0x4fd7('0x3c')](_0xc6fe3e['model'],qs['fields'](_0x354462[_0x4fd7('0x39')][_0x4fd7('0x3d')]));_0x409703['attributes']=_0x409703['attributes'][_0x4fd7('0x4f')]?_0x409703['attributes']:_0xc6fe3e[_0x4fd7('0x37')];_0x409703['order']=qs['sort'](_0x354462[_0x4fd7('0x39')]['sort']);_0x409703['where']=qs[_0x4fd7('0x3b')](_['pick'](_0x354462[_0x4fd7('0x39')],_0xc6fe3e[_0x4fd7('0x3b')]));if(_0x354462[_0x4fd7('0x39')]['filter']){_0x409703[_0x4fd7('0x41')]=_[_0x4fd7('0x44')](_0x409703[_0x4fd7('0x41')],{'$or':_[_0x4fd7('0x38')](_0x409703[_0x4fd7('0x3e')],function(_0x367aa8){var _0x2c0270={};_0x2c0270[_0x367aa8]={'$like':'%'+_0x354462[_0x4fd7('0x39')][_0x4fd7('0x43')]+'%'};return _0x2c0270;})});}_0x409703=_[_0x4fd7('0x44')]({},_0x409703,_0x354462[_0x4fd7('0x46')]);return _0x3f97c4[_0x4fd7('0x8f')](_0x409703);}})[_0x4fd7('0x2d')](function(_0x105e45){if(_0x105e45){_0x2cabe1=_0x105e45['length'];if(!_0x354462['query'][_0x4fd7('0x5f')](_0x4fd7('0x3f'))){_0x409703[_0x4fd7('0x26')]=qs[_0x4fd7('0x26')](_0x354462['query'][_0x4fd7('0x26')]);_0x409703[_0x4fd7('0x24')]=qs[_0x4fd7('0x24')](_0x354462[_0x4fd7('0x39')][_0x4fd7('0x24')]);}return _0x3f97c4[_0x4fd7('0x8f')](_0x409703);}})['then'](function(_0x1ae869){if(_0x1ae869){return _0x1ae869?{'count':_0x2cabe1,'rows':_0x1ae869}:null;}})[_0x4fd7('0x2d')](respondWithResult(_0x4788e9,null))[_0x4fd7('0x4b')](handleError(_0x4788e9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 6da638c..8c98527 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 _0x6b6b=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x168765,_0x534f44){var _0x3ee3a0=function(_0x274d2d){while(--_0x274d2d){_0x168765['push'](_0x168765['shift']());}};_0x3ee3a0(++_0x534f44);}(_0x6b6b,0x13b));var _0xb6b6=function(_0x680be8,_0x27ad4f){_0x680be8=_0x680be8-0x0;var _0x5ef590=_0x6b6b[_0x680be8];return _0x5ef590;};'use strict';var EventEmitter=require(_0xb6b6('0x0'));var OpenchannelQueue=require(_0xb6b6('0x1'))['db'][_0xb6b6('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xb6b6('0x3')](0x0);var events={'afterCreate':_0xb6b6('0x4'),'afterUpdate':_0xb6b6('0x5'),'afterDestroy':_0xb6b6('0x6')};function emitEvent(_0x13d0cc){return function(_0x48dccf,_0x59117d,_0x3237b8){OpenchannelQueueEvents[_0xb6b6('0x7')](_0x13d0cc+':'+_0x48dccf['id'],_0x48dccf);OpenchannelQueueEvents['emit'](_0x13d0cc,_0x48dccf);_0x3237b8(null);};}for(var e in events){if(events[_0xb6b6('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x12f3=['remove','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x38c28d,_0x184e8e){var _0x177400=function(_0x1a59f7){while(--_0x1a59f7){_0x38c28d['push'](_0x38c28d['shift']());}};_0x177400(++_0x184e8e);}(_0x12f3,0x1a2));var _0x312f=function(_0x4be46d,_0x48e9f1){_0x4be46d=_0x4be46d-0x0;var _0x269e43=_0x12f3[_0x4be46d];return _0x269e43;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x312f('0x0'))['db'][_0x312f('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x312f('0x2')](0x0);var events={'afterCreate':_0x312f('0x3'),'afterUpdate':_0x312f('0x4'),'afterDestroy':_0x312f('0x5')};function emitEvent(_0x3418c7){return function(_0xc08e38,_0x398b0b,_0x4ca9b5){OpenchannelQueueEvents['emit'](_0x3418c7+':'+_0xc08e38['id'],_0xc08e38);OpenchannelQueueEvents['emit'](_0x3418c7,_0xc08e38);_0x4ca9b5(null);};}for(var e in events){if(events[_0x312f('0x6')](e)){var event=events[e];OpenchannelQueue[_0x312f('0x7')](e,emitEvent(event));}}module[_0x312f('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 79ba8df..70115ee 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 _0x51f1=['define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x51f1,0x10b));var _0x151f=function(_0x421752,_0x20f492){_0x421752=_0x421752-0x0;var _0x23ed3e=_0x51f1[_0x421752];return _0x23ed3e;};'use strict';var _=require(_0x151f('0x0'));var util=require('util');var logger=require(_0x151f('0x1'))('api');var moment=require(_0x151f('0x2'));var BPromise=require(_0x151f('0x3'));var rp=require(_0x151f('0x4'));var fs=require('fs');var path=require(_0x151f('0x5'));var rimraf=require('rimraf');var config=require(_0x151f('0x6'));var attributes=require(_0x151f('0x7'));module[_0x151f('0x8')]=function(_0x3807bb,_0x1525c1){return _0x3807bb[_0x151f('0x9')](_0x151f('0xa'),attributes,{'tableName':_0x151f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16c5=['path','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x279841,_0x4e9e3b){var _0x4d3a9f=function(_0x261c2d){while(--_0x261c2d){_0x279841['push'](_0x279841['shift']());}};_0x4d3a9f(++_0x4e9e3b);}(_0x16c5,0x8a));var _0x516c=function(_0x2bbaac,_0x2c5b14){_0x2bbaac=_0x2bbaac-0x0;var _0x2dcdd8=_0x16c5[_0x2bbaac];return _0x2dcdd8;};'use strict';var _=require(_0x516c('0x0'));var util=require('util');var logger=require(_0x516c('0x1'))(_0x516c('0x2'));var moment=require(_0x516c('0x3'));var BPromise=require(_0x516c('0x4'));var rp=require(_0x516c('0x5'));var fs=require('fs');var path=require(_0x516c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x516c('0x7'));module[_0x516c('0x8')]=function(_0x3dae1e,_0x56f2aa){return _0x3dae1e[_0x516c('0x9')](_0x516c('0xa'),attributes,{'tableName':_0x516c('0xb'),'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 6378ad6..9093ef4 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 _0x3a67=['client','http','redis','socket.io-emitter','register','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','options','where','attributes','limit','include','model','map','GetOpenchannelQueue','ShowOpenchannelQueue','OpenchannelQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x191ab7,_0x1a0cae){var _0x32c2d3=function(_0x2c7906){while(--_0x2c7906){_0x191ab7['push'](_0x191ab7['shift']());}};_0x32c2d3(++_0x1a0cae);}(_0x3a67,0x89));var _0x73a6=function(_0x27b5b0,_0x2ec988){_0x27b5b0=_0x27b5b0-0x0;var _0x4fb973=_0x3a67[_0x27b5b0];return _0x4fb973;};'use strict';var _=require(_0x73a6('0x0'));var util=require(_0x73a6('0x1'));var moment=require('moment');var BPromise=require(_0x73a6('0x2'));var rs=require(_0x73a6('0x3'));var fs=require('fs');var Redis=require(_0x73a6('0x4'));var db=require(_0x73a6('0x5'))['db'];var utils=require(_0x73a6('0x6'));var logger=require(_0x73a6('0x7'))(_0x73a6('0x8'));var config=require(_0x73a6('0x9'));var jayson=require(_0x73a6('0xa'));var client=jayson[_0x73a6('0xb')][_0x73a6('0xc')]({'port':0x232a});config[_0x73a6('0xd')]=_['defaults'](config[_0x73a6('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x73a6('0xe'))(new Redis(config[_0x73a6('0xd')]));require('./openchannelQueue.socket')[_0x73a6('0xf')](socket);function respondWithRpcPromise(_0x1300a2,_0x2fb687,_0x55a935){return new BPromise(function(_0x54904b,_0x464501){return client['request'](_0x1300a2,_0x55a935)[_0x73a6('0x10')](function(_0x186d7d){logger[_0x73a6('0x11')](_0x73a6('0x12'),_0x2fb687,'request\x20sent');logger[_0x73a6('0x13')](_0x73a6('0x14'),_0x2fb687,_0x73a6('0x15'),JSON[_0x73a6('0x16')](_0x186d7d));if(_0x186d7d[_0x73a6('0x17')]){if(_0x186d7d[_0x73a6('0x17')][_0x73a6('0x18')]===0x1f4){logger[_0x73a6('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x2fb687,_0x186d7d[_0x73a6('0x17')][_0x73a6('0x19')]);return _0x464501(_0x186d7d[_0x73a6('0x17')]['message']);}logger[_0x73a6('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x2fb687,_0x186d7d[_0x73a6('0x17')][_0x73a6('0x19')]);return _0x54904b(_0x186d7d['error']['message']);}else{logger[_0x73a6('0x11')](_0x73a6('0x12'),_0x2fb687,_0x73a6('0x15'));_0x54904b(_0x186d7d['result'][_0x73a6('0x19')]);}})[_0x73a6('0x1a')](function(_0x18042f){logger[_0x73a6('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x2fb687,_0x18042f);_0x464501(_0x18042f);});});}exports['GetOpenchannelQueue']=function(_0x5b04b4){var _0x4b40fe=this;return new Promise(function(_0x5ac028,_0x46014e){return db['OpenchannelQueue']['findAll']({'raw':_0x5b04b4[_0x73a6('0x1b')]?_0x5b04b4[_0x73a6('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5b04b4[_0x73a6('0x1b')]?_0x5b04b4[_0x73a6('0x1b')][_0x73a6('0x1c')]||null:null,'attributes':_0x5b04b4[_0x73a6('0x1b')]?_0x5b04b4[_0x73a6('0x1b')][_0x73a6('0x1d')]||null:null,'limit':_0x5b04b4[_0x73a6('0x1b')]?_0x5b04b4[_0x73a6('0x1b')][_0x73a6('0x1e')]||null:null,'include':_0x5b04b4[_0x73a6('0x1b')]?_0x5b04b4[_0x73a6('0x1b')][_0x73a6('0x1f')]?_['map'](_0x5b04b4[_0x73a6('0x1b')][_0x73a6('0x1f')],function(_0x5a2198){return{'model':db[_0x5a2198[_0x73a6('0x20')]],'as':_0x5a2198['as'],'attributes':_0x5a2198[_0x73a6('0x1d')],'include':_0x5a2198[_0x73a6('0x1f')]?_[_0x73a6('0x21')](_0x5a2198[_0x73a6('0x1f')],function(_0x41acd2){return{'model':db[_0x41acd2[_0x73a6('0x20')]],'as':_0x41acd2['as'],'attributes':_0x41acd2[_0x73a6('0x1d')],'include':_0x41acd2['include']?_[_0x73a6('0x21')](_0x41acd2[_0x73a6('0x1f')],function(_0x4da683){return{'model':db[_0x4da683['model']],'as':_0x4da683['as'],'attributes':_0x4da683[_0x73a6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x73a6('0x10')](function(_0x394113){logger[_0x73a6('0x11')](_0x73a6('0x22'),_0x5b04b4);logger['debug'](_0x73a6('0x22'),_0x5b04b4,JSON['stringify'](_0x394113));_0x5ac028(_0x394113);})[_0x73a6('0x1a')](function(_0x1af1dd){logger[_0x73a6('0x17')](_0x73a6('0x22'),_0x1af1dd[_0x73a6('0x19')],_0x5b04b4);_0x46014e(_0x4b40fe[_0x73a6('0x17')](0x1f4,_0x1af1dd[_0x73a6('0x19')]));});});};exports[_0x73a6('0x23')]=function(_0x3f7d82){var _0x5e1016=this;return new Promise(function(_0x3fdd27,_0x40123d){return db[_0x73a6('0x24')]['find']({'raw':_0x3f7d82[_0x73a6('0x1b')]?_0x3f7d82[_0x73a6('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3f7d82[_0x73a6('0x1b')]?_0x3f7d82[_0x73a6('0x1b')][_0x73a6('0x1c')]||null:null,'attributes':_0x3f7d82[_0x73a6('0x1b')]?_0x3f7d82[_0x73a6('0x1b')][_0x73a6('0x1d')]||null:null,'include':_0x3f7d82[_0x73a6('0x1b')]?_0x3f7d82[_0x73a6('0x1b')][_0x73a6('0x1f')]?_[_0x73a6('0x21')](_0x3f7d82[_0x73a6('0x1b')]['include'],function(_0x2bad8e){return{'model':db[_0x2bad8e[_0x73a6('0x20')]],'as':_0x2bad8e['as'],'attributes':_0x2bad8e[_0x73a6('0x1d')],'include':_0x2bad8e['include']?_['map'](_0x2bad8e[_0x73a6('0x1f')],function(_0x16700e){return{'model':db[_0x16700e[_0x73a6('0x20')]],'as':_0x16700e['as'],'attributes':_0x16700e[_0x73a6('0x1d')],'include':_0x16700e[_0x73a6('0x1f')]?_[_0x73a6('0x21')](_0x16700e[_0x73a6('0x1f')],function(_0x2af196){return{'model':db[_0x2af196[_0x73a6('0x20')]],'as':_0x2af196['as'],'attributes':_0x2af196[_0x73a6('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8c8791){logger[_0x73a6('0x11')](_0x73a6('0x23'),_0x3f7d82);logger[_0x73a6('0x13')]('ShowOpenchannelQueue',_0x3f7d82,JSON['stringify'](_0x8c8791));_0x3fdd27(_0x8c8791);})[_0x73a6('0x1a')](function(_0x542a57){logger[_0x73a6('0x17')](_0x73a6('0x23'),_0x542a57[_0x73a6('0x19')],_0x3f7d82);_0x40123d(_0x5e1016[_0x73a6('0x17')](0x1f4,_0x542a57[_0x73a6('0x19')]));});});}; \ No newline at end of file +var _0x71ad=['socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','map','include','model','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x19bf9c,_0xa5ef2){var _0x2fd6a6=function(_0x1662fc){while(--_0x1662fc){_0x19bf9c['push'](_0x19bf9c['shift']());}};_0x2fd6a6(++_0xa5ef2);}(_0x71ad,0xf3));var _0xd71a=function(_0x5aceef,_0x4cc744){_0x5aceef=_0x5aceef-0x0;var _0x14c135=_0x71ad[_0x5aceef];return _0x14c135;};'use strict';var _=require(_0xd71a('0x0'));var util=require(_0xd71a('0x1'));var moment=require(_0xd71a('0x2'));var BPromise=require(_0xd71a('0x3'));var rs=require(_0xd71a('0x4'));var fs=require('fs');var Redis=require(_0xd71a('0x5'));var db=require(_0xd71a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd71a('0x7'))(_0xd71a('0x8'));var config=require(_0xd71a('0x9'));var jayson=require(_0xd71a('0xa'));var client=jayson[_0xd71a('0xb')][_0xd71a('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd71a('0xd')],{'host':_0xd71a('0xe'),'port':0x18eb});var socket=require(_0xd71a('0xf'))(new Redis(config[_0xd71a('0xd')]));require(_0xd71a('0x10'))[_0xd71a('0x11')](socket);function respondWithRpcPromise(_0x394c0b,_0x2f47c2,_0x38664b){return new BPromise(function(_0x4fb4aa,_0x56612e){return client[_0xd71a('0x12')](_0x394c0b,_0x38664b)[_0xd71a('0x13')](function(_0x56e974){logger['info'](_0xd71a('0x14'),_0x2f47c2,_0xd71a('0x15'));logger[_0xd71a('0x16')](_0xd71a('0x17'),_0x2f47c2,_0xd71a('0x15'),JSON[_0xd71a('0x18')](_0x56e974));if(_0x56e974[_0xd71a('0x19')]){if(_0x56e974[_0xd71a('0x19')][_0xd71a('0x1a')]===0x1f4){logger['error'](_0xd71a('0x14'),_0x2f47c2,_0x56e974[_0xd71a('0x19')][_0xd71a('0x1b')]);return _0x56612e(_0x56e974[_0xd71a('0x19')]['message']);}logger['error'](_0xd71a('0x14'),_0x2f47c2,_0x56e974[_0xd71a('0x19')][_0xd71a('0x1b')]);return _0x4fb4aa(_0x56e974[_0xd71a('0x19')][_0xd71a('0x1b')]);}else{logger[_0xd71a('0x1c')]('OpenchannelQueue,\x20%s,\x20%s',_0x2f47c2,_0xd71a('0x15'));_0x4fb4aa(_0x56e974[_0xd71a('0x1d')][_0xd71a('0x1b')]);}})[_0xd71a('0x1e')](function(_0x1cc927){logger[_0xd71a('0x19')](_0xd71a('0x14'),_0x2f47c2,_0x1cc927);_0x56612e(_0x1cc927);});});}exports[_0xd71a('0x1f')]=function(_0x1c5d26){var _0x36543a=this;return new Promise(function(_0x3fc253,_0x500129){return db[_0xd71a('0x20')][_0xd71a('0x21')]({'raw':_0x1c5d26[_0xd71a('0x22')]?_0x1c5d26[_0xd71a('0x22')][_0xd71a('0x23')]===undefined?!![]:![]:!![],'where':_0x1c5d26[_0xd71a('0x22')]?_0x1c5d26['options'][_0xd71a('0x24')]||null:null,'attributes':_0x1c5d26[_0xd71a('0x22')]?_0x1c5d26[_0xd71a('0x22')][_0xd71a('0x25')]||null:null,'limit':_0x1c5d26['options']?_0x1c5d26[_0xd71a('0x22')]['limit']||null:null,'include':_0x1c5d26[_0xd71a('0x22')]?_0x1c5d26[_0xd71a('0x22')]['include']?_[_0xd71a('0x26')](_0x1c5d26[_0xd71a('0x22')][_0xd71a('0x27')],function(_0x3c7ec0){return{'model':db[_0x3c7ec0[_0xd71a('0x28')]],'as':_0x3c7ec0['as'],'attributes':_0x3c7ec0['attributes'],'include':_0x3c7ec0[_0xd71a('0x27')]?_[_0xd71a('0x26')](_0x3c7ec0[_0xd71a('0x27')],function(_0x5b3deb){return{'model':db[_0x5b3deb[_0xd71a('0x28')]],'as':_0x5b3deb['as'],'attributes':_0x5b3deb['attributes'],'include':_0x5b3deb[_0xd71a('0x27')]?_[_0xd71a('0x26')](_0x5b3deb[_0xd71a('0x27')],function(_0x51f436){return{'model':db[_0x51f436[_0xd71a('0x28')]],'as':_0x51f436['as'],'attributes':_0x51f436[_0xd71a('0x25')]};}):[]};}):[]};}):[]:[]})[_0xd71a('0x13')](function(_0x268689){logger[_0xd71a('0x1c')](_0xd71a('0x1f'),_0x1c5d26);logger['debug'](_0xd71a('0x1f'),_0x1c5d26,JSON['stringify'](_0x268689));_0x3fc253(_0x268689);})[_0xd71a('0x1e')](function(_0x397195){logger[_0xd71a('0x19')](_0xd71a('0x1f'),_0x397195[_0xd71a('0x1b')],_0x1c5d26);_0x500129(_0x36543a['error'](0x1f4,_0x397195[_0xd71a('0x1b')]));});});};exports[_0xd71a('0x29')]=function(_0xbce4c6){var _0x539b3e=this;return new Promise(function(_0x371bdd,_0x26dbda){return db[_0xd71a('0x20')][_0xd71a('0x2a')]({'raw':_0xbce4c6[_0xd71a('0x22')]?_0xbce4c6[_0xd71a('0x22')][_0xd71a('0x23')]===undefined?!![]:![]:!![],'where':_0xbce4c6[_0xd71a('0x22')]?_0xbce4c6['options']['where']||null:null,'attributes':_0xbce4c6[_0xd71a('0x22')]?_0xbce4c6['options'][_0xd71a('0x25')]||null:null,'include':_0xbce4c6[_0xd71a('0x22')]?_0xbce4c6['options'][_0xd71a('0x27')]?_[_0xd71a('0x26')](_0xbce4c6[_0xd71a('0x22')]['include'],function(_0x211862){return{'model':db[_0x211862[_0xd71a('0x28')]],'as':_0x211862['as'],'attributes':_0x211862[_0xd71a('0x25')],'include':_0x211862[_0xd71a('0x27')]?_['map'](_0x211862['include'],function(_0x376d81){return{'model':db[_0x376d81['model']],'as':_0x376d81['as'],'attributes':_0x376d81['attributes'],'include':_0x376d81['include']?_[_0xd71a('0x26')](_0x376d81['include'],function(_0x296858){return{'model':db[_0x296858[_0xd71a('0x28')]],'as':_0x296858['as'],'attributes':_0x296858[_0xd71a('0x25')]};}):[]};}):[]};}):[]:[]})[_0xd71a('0x13')](function(_0x3f9dab){logger[_0xd71a('0x1c')](_0xd71a('0x29'),_0xbce4c6);logger['debug'](_0xd71a('0x29'),_0xbce4c6,JSON[_0xd71a('0x18')](_0x3f9dab));_0x371bdd(_0x3f9dab);})[_0xd71a('0x1e')](function(_0x282f5f){logger[_0xd71a('0x19')](_0xd71a('0x29'),_0x282f5f[_0xd71a('0x1b')],_0xbce4c6);_0x26dbda(_0x539b3e[_0xd71a('0x19')](0x1f4,_0x282f5f[_0xd71a('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index a8917a4..27bd970 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 _0x4d71=['update','removeListener','register','length','openchannelQueue:','save','remove'];(function(_0x5053e6,_0x347ed5){var _0x5b9866=function(_0x95d907){while(--_0x95d907){_0x5053e6['push'](_0x5053e6['shift']());}};_0x5b9866(++_0x347ed5);}(_0x4d71,0x194));var _0x14d7=function(_0x284e5f,_0x130a54){_0x284e5f=_0x284e5f-0x0;var _0x86d83=_0x4d71[_0x284e5f];return _0x86d83;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x14d7('0x0'),_0x14d7('0x1'),_0x14d7('0x2')];function createListener(_0x3d6823,_0x443f6c){return function(_0x25af80){_0x443f6c['emit'](_0x3d6823,_0x25af80);};}function removeListener(_0x194414,_0x4d58eb){return function(){OpenchannelQueueEvents[_0x14d7('0x3')](_0x194414,_0x4d58eb);};}exports[_0x14d7('0x4')]=function(_0x283bb6){for(var _0xf20c8c=0x0,_0x43b28e=events[_0x14d7('0x5')];_0xf20c8c<_0x43b28e;_0xf20c8c++){var _0x43eb4d=events[_0xf20c8c];var _0x21233d=createListener(_0x14d7('0x6')+_0x43eb4d,_0x283bb6);OpenchannelQueueEvents['on'](_0x43eb4d,_0x21233d);}}; \ No newline at end of file +var _0xa97f=['emit','removeListener','save','remove','update'];(function(_0x5d9afe,_0x5d7a53){var _0x461609=function(_0x28549e){while(--_0x28549e){_0x5d9afe['push'](_0x5d9afe['shift']());}};_0x461609(++_0x5d7a53);}(_0xa97f,0x1b5));var _0xfa97=function(_0x12b173,_0x32429a){_0x12b173=_0x12b173-0x0;var _0x1c7197=_0xa97f[_0x12b173];return _0x1c7197;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xfa97('0x0'),_0xfa97('0x1'),_0xfa97('0x2')];function createListener(_0x4d2262,_0x163b32){return function(_0x1a33f7){_0x163b32[_0xfa97('0x3')](_0x4d2262,_0x1a33f7);};}function removeListener(_0x441b00,_0x25bf80){return function(){OpenchannelQueueEvents[_0xfa97('0x4')](_0x441b00,_0x25bf80);};}exports['register']=function(_0x4fab53){for(var _0x37ebfa=0x0,_0x5b4ae5=events['length'];_0x37ebfa<_0x5b4ae5;_0x37ebfa++){var _0x1fca01=events[_0x37ebfa];var _0x56bcd1=createListener('openchannelQueue:'+_0x1fca01,_0x4fab53);OpenchannelQueueEvents['on'](_0x1fca01,_0x56bcd1);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index e0eaa34..d219f10 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 _0x0055=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','post','create','put','/:id','update','delete'];(function(_0x258bd8,_0x3cf0b1){var _0x2f43a4=function(_0x57a5bf){while(--_0x57a5bf){_0x258bd8['push'](_0x258bd8['shift']());}};_0x2f43a4(++_0x3cf0b1);}(_0x0055,0x80));var _0x5005=function(_0x1fbcf5,_0x34fd7f){_0x1fbcf5=_0x1fbcf5-0x0;var _0x1f8261=_0x0055[_0x1fbcf5];return _0x1f8261;};'use strict';var multer=require(_0x5005('0x0'));var util=require(_0x5005('0x1'));var path=require('path');var timeout=require(_0x5005('0x2'));var express=require(_0x5005('0x3'));var router=express[_0x5005('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5005('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5005('0x6'));var controller=require(_0x5005('0x7'));router['get']('/',auth[_0x5005('0x8')](),controller[_0x5005('0x9')]);router[_0x5005('0xa')](_0x5005('0xb'),auth['isAuthenticated'](),controller[_0x5005('0xc')]);router[_0x5005('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5005('0xd')]('/',auth['isAuthenticated'](),controller[_0x5005('0xe')]);router[_0x5005('0xf')](_0x5005('0x10'),auth[_0x5005('0x8')](),controller[_0x5005('0x11')]);router[_0x5005('0x12')](_0x5005('0x10'),auth['isAuthenticated'](),controller[_0x5005('0x13')]);module[_0x5005('0x14')]=router; \ No newline at end of file +var _0xef39=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xef39,0xec));var _0x9ef3=function(_0x336a0c,_0x5a5af8){_0x336a0c=_0x336a0c-0x0;var _0x5e09b0=_0xef39[_0x336a0c];return _0x5e09b0;};'use strict';var multer=require(_0x9ef3('0x0'));var util=require(_0x9ef3('0x1'));var path=require(_0x9ef3('0x2'));var timeout=require(_0x9ef3('0x3'));var express=require('express');var router=express[_0x9ef3('0x4')]();var fs_extra=require(_0x9ef3('0x5'));var auth=require(_0x9ef3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9ef3('0x7'));var controller=require(_0x9ef3('0x8'));router[_0x9ef3('0x9')]('/',auth[_0x9ef3('0xa')](),controller[_0x9ef3('0xb')]);router['get'](_0x9ef3('0xc'),auth[_0x9ef3('0xa')](),controller[_0x9ef3('0xd')]);router[_0x9ef3('0x9')](_0x9ef3('0xe'),auth[_0x9ef3('0xa')](),controller[_0x9ef3('0xf')]);router['post']('/',auth[_0x9ef3('0xa')](),controller[_0x9ef3('0x10')]);router[_0x9ef3('0x11')](_0x9ef3('0xe'),auth[_0x9ef3('0xa')](),controller['update']);router[_0x9ef3('0x12')](_0x9ef3('0xe'),auth[_0x9ef3('0xa')](),controller[_0x9ef3('0x13')]);module[_0x9ef3('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 4790309..cf4d959 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 _0xa8de=['STRING','DATE','moment','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8de,0x17e));var _0xea8d=function(_0x1f1755,_0xbadc91){_0x1f1755=_0x1f1755-0x0;var _0xceeaf6=_0xa8de[_0x1f1755];return _0xceeaf6;};'use strict';var moment=require(_0xea8d('0x0'));var Sequelize=require(_0xea8d('0x1'));module[_0xea8d('0x2')]={'uniqueid':{'type':Sequelize[_0xea8d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xea8d('0x3')]},'joinAt':{'type':Sequelize[_0xea8d('0x4')]},'leaveAt':{'type':Sequelize[_0xea8d('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xea8d('0x4')]},'reason':{'type':Sequelize[_0xea8d('0x3')]}}; \ No newline at end of file +var _0x467a=['sequelize','exports','STRING','DATE','moment'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x467a,0x117));var _0xa467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x467a[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0xa467('0x0'));var Sequelize=require(_0xa467('0x1'));module[_0xa467('0x2')]={'uniqueid':{'type':Sequelize[_0xa467('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa467('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa467('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa467('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 2eb59ff..0a42cf1 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 _0xdcaf=['OpenchannelQueueReport','count','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','limit','offset','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdcaf,0x1f0));var _0xfdca=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdcaf[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xfdca('0x0'));var rimraf=require(_0xfdca('0x1'));var zipdir=require(_0xfdca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfdca('0x3'));var moment=require(_0xfdca('0x4'));var BPromise=require(_0xfdca('0x5'));var Mustache=require(_0xfdca('0x6'));var util=require(_0xfdca('0x7'));var path=require(_0xfdca('0x8'));var sox=require(_0xfdca('0x9'));var csv=require(_0xfdca('0xa'));var ejs=require(_0xfdca('0xb'));var fs=require('fs');var fs_extra=require(_0xfdca('0xc'));var _=require(_0xfdca('0xd'));var squel=require('squel');var crypto=require(_0xfdca('0xe'));var jsforce=require(_0xfdca('0xf'));var deskjs=require(_0xfdca('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfdca('0x11'));var Papa=require(_0xfdca('0x12'));var Redis=require(_0xfdca('0x13'));var authService=require(_0xfdca('0x14'));var qs=require(_0xfdca('0x15'));var as=require(_0xfdca('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfdca('0x17'));var utils=require('../../config/utils');var config=require(_0xfdca('0x18'));var licenseUtil=require(_0xfdca('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb412d9,_0x311705){_0x311705=_0x311705||0xcc;return function(_0x18b1a5){if(_0x18b1a5){return _0xb412d9[_0xfdca('0x1a')](_0x311705);}return _0xb412d9[_0xfdca('0x1b')](_0x311705)[_0xfdca('0x1c')]();};}function respondWithResult(_0x1b09a5,_0x3ccf7b){_0x3ccf7b=_0x3ccf7b||0xc8;return function(_0x38faf3){if(_0x38faf3){return _0x1b09a5['status'](_0x3ccf7b)['json'](_0x38faf3);}};}function respondWithFilteredResult(_0x5c9473,_0x3025b1){return function(_0x123773){if(_0x123773){var _0xd05704=typeof _0x3025b1['offset']==='undefined'&&typeof _0x3025b1[_0xfdca('0x1d')]==='undefined';var _0x19e259=_0x123773['count'];var _0xa39139=_0xd05704?0x0:_0x3025b1[_0xfdca('0x1e')];var _0x3eb404=_0xd05704?_0x123773['count']:_0x3025b1[_0xfdca('0x1e')]+_0x3025b1['limit'];var _0x53068d;if(_0x3eb404>=_0x19e259){_0x3eb404=_0x19e259;_0x53068d=0xc8;}else{_0x53068d=0xce;}_0x5c9473['status'](_0x53068d);return _0x5c9473['set'](_0xfdca('0x1f'),_0xa39139+'-'+_0x3eb404+'/'+_0x19e259)[_0xfdca('0x20')](_0x123773);}return null;};}function patchUpdates(_0x57c356){return function(_0x4d455e){try{jsonpatch[_0xfdca('0x21')](_0x4d455e,_0x57c356,!![]);}catch(_0x4ee1e3){return BPromise[_0xfdca('0x22')](_0x4ee1e3);}return _0x4d455e[_0xfdca('0x23')]();};}function saveUpdates(_0x481826,_0x543bb8){return function(_0x149b4f){if(_0x149b4f){return _0x149b4f['update'](_0x481826)[_0xfdca('0x24')](function(_0x218b55){return _0x218b55;});}return null;};}function removeEntity(_0x323c5d,_0x3fe27c){return function(_0x13e3b5){if(_0x13e3b5){return _0x13e3b5[_0xfdca('0x25')]()[_0xfdca('0x24')](function(){_0x323c5d[_0xfdca('0x1b')](0xcc)[_0xfdca('0x1c')]();});}};}function handleEntityNotFound(_0x58bf2a,_0x2fe5f1){return function(_0x232f53){if(!_0x232f53){_0x58bf2a[_0xfdca('0x1a')](0x194);}return _0x232f53;};}function handleError(_0x149364,_0x12fdd2){_0x12fdd2=_0x12fdd2||0x1f4;return function(_0x3f392b){logger[_0xfdca('0x26')](_0x3f392b[_0xfdca('0x27')]);if(_0x3f392b['name']){delete _0x3f392b[_0xfdca('0x28')];}_0x149364['status'](_0x12fdd2)[_0xfdca('0x29')](_0x3f392b);};}exports[_0xfdca('0x2a')]=function(_0x2ce9ae,_0x463fdd){var _0x336613={},_0x2c5829={},_0x320db3={'count':0x0,'rows':[]};var _0x4f1224=_[_0xfdca('0x2b')](db['OpenchannelQueueReport'][_0xfdca('0x2c')],function(_0x4f8e60){return{'name':_0x4f8e60[_0xfdca('0x2d')],'type':_0x4f8e60['type'][_0xfdca('0x2e')]};});_0x2c5829['model']=_['map'](_0x4f1224,'name');_0x2c5829['query']=_['keys'](_0x2ce9ae[_0xfdca('0x2f')]);_0x2c5829[_0xfdca('0x30')]=_[_0xfdca('0x31')](_0x2c5829[_0xfdca('0x32')],_0x2c5829[_0xfdca('0x2f')]);_0x336613[_0xfdca('0x33')]=_['intersection'](_0x2c5829[_0xfdca('0x32')],qs[_0xfdca('0x34')](_0x2ce9ae[_0xfdca('0x2f')][_0xfdca('0x34')]));_0x336613[_0xfdca('0x33')]=_0x336613[_0xfdca('0x33')]['length']?_0x336613[_0xfdca('0x33')]:_0x2c5829[_0xfdca('0x32')];if(!_0x2ce9ae[_0xfdca('0x2f')][_0xfdca('0x35')](_0xfdca('0x36'))){_0x336613['limit']=qs['limit'](_0x2ce9ae[_0xfdca('0x2f')][_0xfdca('0x1d')]);_0x336613[_0xfdca('0x1e')]=qs[_0xfdca('0x1e')](_0x2ce9ae[_0xfdca('0x2f')]['offset']);}_0x336613[_0xfdca('0x37')]=qs[_0xfdca('0x38')](_0x2ce9ae[_0xfdca('0x2f')][_0xfdca('0x38')]);_0x336613['where']=qs[_0xfdca('0x30')](_[_0xfdca('0x39')](_0x2ce9ae[_0xfdca('0x2f')],_0x2c5829[_0xfdca('0x30')]),_0x4f1224);if(_0x2ce9ae[_0xfdca('0x2f')]['filter']){_0x336613[_0xfdca('0x3a')]=_[_0xfdca('0x3b')](_0x336613[_0xfdca('0x3a')],{'$or':_['map'](_0x4f1224,function(_0x177b2f){if(_0x177b2f[_0xfdca('0x3c')]!==_0xfdca('0x3d')){var _0x4ab679={};_0x4ab679[_0x177b2f[_0xfdca('0x28')]]={'$like':'%'+_0x2ce9ae[_0xfdca('0x2f')][_0xfdca('0x3e')]+'%'};return _0x4ab679;}})});}_0x336613=_[_0xfdca('0x3b')]({},_0x336613,_0x2ce9ae[_0xfdca('0x3f')]);var _0x1ad55d={'where':_0x336613[_0xfdca('0x3a')]};return db[_0xfdca('0x40')]['count'](_0x1ad55d)['then'](function(_0x555fe5){_0x320db3[_0xfdca('0x41')]=_0x555fe5;if(_0x2ce9ae[_0xfdca('0x2f')][_0xfdca('0x42')]){_0x336613[_0xfdca('0x43')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xfdca('0x44')](_0x336613);})[_0xfdca('0x24')](function(_0xd79183){_0x320db3[_0xfdca('0x45')]=_0xd79183;return _0x320db3;})[_0xfdca('0x24')](respondWithFilteredResult(_0x463fdd,_0x336613))[_0xfdca('0x46')](handleError(_0x463fdd,null));};exports[_0xfdca('0x47')]=function(_0x4ce21e,_0x4f63b5){var _0x8979c2={'raw':!![],'where':{'id':_0x4ce21e[_0xfdca('0x48')]['id']}},_0x33b000={};_0x33b000['model']=_['keys'](db[_0xfdca('0x40')][_0xfdca('0x2c')]);_0x33b000[_0xfdca('0x2f')]=_[_0xfdca('0x49')](_0x4ce21e[_0xfdca('0x2f')]);_0x33b000[_0xfdca('0x30')]=_[_0xfdca('0x31')](_0x33b000[_0xfdca('0x32')],_0x33b000[_0xfdca('0x2f')]);_0x8979c2[_0xfdca('0x33')]=_['intersection'](_0x33b000[_0xfdca('0x32')],qs[_0xfdca('0x34')](_0x4ce21e['query'][_0xfdca('0x34')]));_0x8979c2[_0xfdca('0x33')]=_0x8979c2[_0xfdca('0x33')][_0xfdca('0x4a')]?_0x8979c2[_0xfdca('0x33')]:_0x33b000['model'];if(_0x4ce21e[_0xfdca('0x2f')][_0xfdca('0x42')]){_0x8979c2[_0xfdca('0x43')]=[{'all':!![]}];}_0x8979c2=_[_0xfdca('0x3b')]({},_0x8979c2,_0x4ce21e['options']);return db[_0xfdca('0x40')][_0xfdca('0x4b')](_0x8979c2)[_0xfdca('0x24')](handleEntityNotFound(_0x4f63b5,null))[_0xfdca('0x24')](respondWithResult(_0x4f63b5,null))[_0xfdca('0x46')](handleError(_0x4f63b5,null));};exports[_0xfdca('0x4c')]=function(_0x4e41e4,_0x54924f){return db[_0xfdca('0x40')]['create'](_0x4e41e4['body'],{})[_0xfdca('0x24')](respondWithResult(_0x54924f,0xc9))[_0xfdca('0x46')](handleError(_0x54924f,null));};exports[_0xfdca('0x4d')]=function(_0x51a459,_0x5db922){if(_0x51a459[_0xfdca('0x4e')]['id']){delete _0x51a459['body']['id'];}return db['OpenchannelQueueReport'][_0xfdca('0x4b')]({'where':{'id':_0x51a459[_0xfdca('0x48')]['id']}})[_0xfdca('0x24')](handleEntityNotFound(_0x5db922,null))[_0xfdca('0x24')](saveUpdates(_0x51a459['body'],null))['then'](respondWithResult(_0x5db922,null))[_0xfdca('0x46')](handleError(_0x5db922,null));};exports[_0xfdca('0x25')]=function(_0x1b2c56,_0x4f7446){return db[_0xfdca('0x40')]['find']({'where':{'id':_0x1b2c56[_0xfdca('0x48')]['id']}})[_0xfdca('0x24')](handleEntityNotFound(_0x4f7446,null))['then'](removeEntity(_0x4f7446,null))['catch'](handleError(_0x4f7446,null));};exports[_0xfdca('0x4f')]=function(_0x15c551,_0x571fcb){return db[_0xfdca('0x40')][_0xfdca('0x4f')]()[_0xfdca('0x24')](respondWithResult(_0x571fcb,null))[_0xfdca('0x46')](handleError(_0x571fcb,null));}; \ No newline at end of file +var _0x5553=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','OpenchannelQueueReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','destroy'];(function(_0x4742f1,_0x1edaca){var _0x13538f=function(_0x3e99de){while(--_0x3e99de){_0x4742f1['push'](_0x4742f1['shift']());}};_0x13538f(++_0x1edaca);}(_0x5553,0x191));var _0x3555=function(_0x7ca9c7,_0x51a58b){_0x7ca9c7=_0x7ca9c7-0x0;var _0x35f64f=_0x5553[_0x7ca9c7];return _0x35f64f;};'use strict';var emlformat=require(_0x3555('0x0'));var rimraf=require(_0x3555('0x1'));var zipdir=require(_0x3555('0x2'));var jsonpatch=require(_0x3555('0x3'));var rp=require(_0x3555('0x4'));var moment=require(_0x3555('0x5'));var BPromise=require(_0x3555('0x6'));var Mustache=require(_0x3555('0x7'));var util=require(_0x3555('0x8'));var path=require(_0x3555('0x9'));var sox=require(_0x3555('0xa'));var csv=require(_0x3555('0xb'));var ejs=require(_0x3555('0xc'));var fs=require('fs');var fs_extra=require(_0x3555('0xd'));var _=require(_0x3555('0xe'));var squel=require(_0x3555('0xf'));var crypto=require(_0x3555('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3555('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3555('0x12'));var Redis=require(_0x3555('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3555('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3555('0x15'));var logger=require('../../config/logger')(_0x3555('0x16'));var utils=require(_0x3555('0x17'));var config=require(_0x3555('0x18'));var licenseUtil=require(_0x3555('0x19'));var db=require(_0x3555('0x1a'))['db'];function respondWithStatusCode(_0x17c050,_0x2ec409){_0x2ec409=_0x2ec409||0xcc;return function(_0x485eb){if(_0x485eb){return _0x17c050[_0x3555('0x1b')](_0x2ec409);}return _0x17c050[_0x3555('0x1c')](_0x2ec409)[_0x3555('0x1d')]();};}function respondWithResult(_0x52c823,_0x29db1c){_0x29db1c=_0x29db1c||0xc8;return function(_0x524c1c){if(_0x524c1c){return _0x52c823[_0x3555('0x1c')](_0x29db1c)[_0x3555('0x1e')](_0x524c1c);}};}function respondWithFilteredResult(_0x36585f,_0x445b09){return function(_0x17a5ba){if(_0x17a5ba){var _0x47aa13=typeof _0x445b09[_0x3555('0x1f')]===_0x3555('0x20')&&typeof _0x445b09[_0x3555('0x21')]===_0x3555('0x20');var _0x141b72=_0x17a5ba[_0x3555('0x22')];var _0x2c1ce1=_0x47aa13?0x0:_0x445b09[_0x3555('0x1f')];var _0x3b462f=_0x47aa13?_0x17a5ba[_0x3555('0x22')]:_0x445b09['offset']+_0x445b09[_0x3555('0x21')];var _0x5292e3;if(_0x3b462f>=_0x141b72){_0x3b462f=_0x141b72;_0x5292e3=0xc8;}else{_0x5292e3=0xce;}_0x36585f[_0x3555('0x1c')](_0x5292e3);return _0x36585f[_0x3555('0x23')]('Content-Range',_0x2c1ce1+'-'+_0x3b462f+'/'+_0x141b72)[_0x3555('0x1e')](_0x17a5ba);}return null;};}function patchUpdates(_0x2ef4e9){return function(_0x259c5f){try{jsonpatch[_0x3555('0x24')](_0x259c5f,_0x2ef4e9,!![]);}catch(_0x2614d5){return BPromise['reject'](_0x2614d5);}return _0x259c5f[_0x3555('0x25')]();};}function saveUpdates(_0x3333aa,_0x5f4e70){return function(_0x25f687){if(_0x25f687){return _0x25f687[_0x3555('0x26')](_0x3333aa)[_0x3555('0x27')](function(_0x350171){return _0x350171;});}return null;};}function removeEntity(_0x5b79ee,_0xcd8595){return function(_0x3acfcb){if(_0x3acfcb){return _0x3acfcb['destroy']()[_0x3555('0x27')](function(){_0x5b79ee[_0x3555('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e00aa,_0x24e395){return function(_0x1ed378){if(!_0x1ed378){_0x1e00aa[_0x3555('0x1b')](0x194);}return _0x1ed378;};}function handleError(_0x493da0,_0x2e703c){_0x2e703c=_0x2e703c||0x1f4;return function(_0x3b8a3d){logger[_0x3555('0x28')](_0x3b8a3d[_0x3555('0x29')]);if(_0x3b8a3d[_0x3555('0x2a')]){delete _0x3b8a3d[_0x3555('0x2a')];}_0x493da0[_0x3555('0x1c')](_0x2e703c)[_0x3555('0x2b')](_0x3b8a3d);};}exports['index']=function(_0x441d04,_0x299634){var _0x25ffc2={},_0xee2ad3={},_0x375092={'count':0x0,'rows':[]};var _0x10ba46=_[_0x3555('0x2c')](db[_0x3555('0x2d')]['rawAttributes'],function(_0x476b7d){return{'name':_0x476b7d[_0x3555('0x2e')],'type':_0x476b7d[_0x3555('0x2f')][_0x3555('0x30')]};});_0xee2ad3[_0x3555('0x31')]=_['map'](_0x10ba46,'name');_0xee2ad3['query']=_[_0x3555('0x32')](_0x441d04[_0x3555('0x33')]);_0xee2ad3[_0x3555('0x34')]=_[_0x3555('0x35')](_0xee2ad3[_0x3555('0x31')],_0xee2ad3[_0x3555('0x33')]);_0x25ffc2[_0x3555('0x36')]=_[_0x3555('0x35')](_0xee2ad3[_0x3555('0x31')],qs[_0x3555('0x37')](_0x441d04[_0x3555('0x33')][_0x3555('0x37')]));_0x25ffc2[_0x3555('0x36')]=_0x25ffc2[_0x3555('0x36')][_0x3555('0x38')]?_0x25ffc2['attributes']:_0xee2ad3[_0x3555('0x31')];if(!_0x441d04['query'][_0x3555('0x39')](_0x3555('0x3a'))){_0x25ffc2['limit']=qs[_0x3555('0x21')](_0x441d04[_0x3555('0x33')][_0x3555('0x21')]);_0x25ffc2[_0x3555('0x1f')]=qs[_0x3555('0x1f')](_0x441d04[_0x3555('0x33')]['offset']);}_0x25ffc2[_0x3555('0x3b')]=qs[_0x3555('0x3c')](_0x441d04[_0x3555('0x33')][_0x3555('0x3c')]);_0x25ffc2['where']=qs[_0x3555('0x34')](_[_0x3555('0x3d')](_0x441d04[_0x3555('0x33')],_0xee2ad3['filters']),_0x10ba46);if(_0x441d04['query'][_0x3555('0x3e')]){_0x25ffc2[_0x3555('0x3f')]=_[_0x3555('0x40')](_0x25ffc2[_0x3555('0x3f')],{'$or':_[_0x3555('0x2c')](_0x10ba46,function(_0x26ad46){if(_0x26ad46[_0x3555('0x2f')]!==_0x3555('0x41')){var _0x40c5c5={};_0x40c5c5[_0x26ad46[_0x3555('0x2a')]]={'$like':'%'+_0x441d04[_0x3555('0x33')][_0x3555('0x3e')]+'%'};return _0x40c5c5;}})});}_0x25ffc2=_['merge']({},_0x25ffc2,_0x441d04[_0x3555('0x42')]);var _0x21c353={'where':_0x25ffc2['where']};return db['OpenchannelQueueReport'][_0x3555('0x22')](_0x21c353)[_0x3555('0x27')](function(_0x21c939){_0x375092[_0x3555('0x22')]=_0x21c939;if(_0x441d04[_0x3555('0x33')][_0x3555('0x43')]){_0x25ffc2[_0x3555('0x44')]=[{'all':!![]}];}return db[_0x3555('0x2d')][_0x3555('0x45')](_0x25ffc2);})[_0x3555('0x27')](function(_0x4461db){_0x375092[_0x3555('0x46')]=_0x4461db;return _0x375092;})[_0x3555('0x27')](respondWithFilteredResult(_0x299634,_0x25ffc2))[_0x3555('0x47')](handleError(_0x299634,null));};exports[_0x3555('0x48')]=function(_0xf65ecf,_0x809bf3){var _0x24df82={'raw':!![],'where':{'id':_0xf65ecf[_0x3555('0x49')]['id']}},_0x59f98c={};_0x59f98c['model']=_[_0x3555('0x32')](db[_0x3555('0x2d')][_0x3555('0x4a')]);_0x59f98c[_0x3555('0x33')]=_[_0x3555('0x32')](_0xf65ecf['query']);_0x59f98c[_0x3555('0x34')]=_[_0x3555('0x35')](_0x59f98c['model'],_0x59f98c[_0x3555('0x33')]);_0x24df82[_0x3555('0x36')]=_[_0x3555('0x35')](_0x59f98c[_0x3555('0x31')],qs[_0x3555('0x37')](_0xf65ecf[_0x3555('0x33')][_0x3555('0x37')]));_0x24df82[_0x3555('0x36')]=_0x24df82['attributes'][_0x3555('0x38')]?_0x24df82['attributes']:_0x59f98c[_0x3555('0x31')];if(_0xf65ecf[_0x3555('0x33')][_0x3555('0x43')]){_0x24df82[_0x3555('0x44')]=[{'all':!![]}];}_0x24df82=_[_0x3555('0x40')]({},_0x24df82,_0xf65ecf[_0x3555('0x42')]);return db['OpenchannelQueueReport']['find'](_0x24df82)['then'](handleEntityNotFound(_0x809bf3,null))['then'](respondWithResult(_0x809bf3,null))[_0x3555('0x47')](handleError(_0x809bf3,null));};exports[_0x3555('0x4b')]=function(_0x46248e,_0x2ace5e){return db[_0x3555('0x2d')]['create'](_0x46248e[_0x3555('0x4c')],{})[_0x3555('0x27')](respondWithResult(_0x2ace5e,0xc9))[_0x3555('0x47')](handleError(_0x2ace5e,null));};exports[_0x3555('0x26')]=function(_0x34a273,_0x5d7987){if(_0x34a273[_0x3555('0x4c')]['id']){delete _0x34a273[_0x3555('0x4c')]['id'];}return db[_0x3555('0x2d')][_0x3555('0x4d')]({'where':{'id':_0x34a273[_0x3555('0x49')]['id']}})[_0x3555('0x27')](handleEntityNotFound(_0x5d7987,null))[_0x3555('0x27')](saveUpdates(_0x34a273[_0x3555('0x4c')],null))[_0x3555('0x27')](respondWithResult(_0x5d7987,null))[_0x3555('0x47')](handleError(_0x5d7987,null));};exports[_0x3555('0x4e')]=function(_0x3cdac1,_0x127d2f){return db[_0x3555('0x2d')][_0x3555('0x4d')]({'where':{'id':_0x3cdac1['params']['id']}})[_0x3555('0x27')](handleEntityNotFound(_0x127d2f,null))[_0x3555('0x27')](removeEntity(_0x127d2f,null))[_0x3555('0x47')](handleError(_0x127d2f,null));};exports[_0x3555('0x4f')]=function(_0x325750,_0x1b0f0d){return db[_0x3555('0x2d')]['describe']()[_0x3555('0x27')](respondWithResult(_0x1b0f0d,null))[_0x3555('0x47')](handleError(_0x1b0f0d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 8c4479a..63e6122 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(_0x38d550,_0xfda336){var _0x4e6cc8=function(_0x3029e7){while(--_0x3029e7){_0x38d550['push'](_0x38d550['shift']());}};_0x4e6cc8(++_0xfda336);}(_0x2ef3,0xba));var _0x32ef=function(_0x551cf8,_0x5b5621){_0x551cf8=_0x551cf8-0x0;var _0x2931c8=_0x2ef3[_0x551cf8];return _0x2931c8;};'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(_0x2fc691,_0x2fc68c){var _0x3cdb8d=function(_0x2e56eb){while(--_0x2e56eb){_0x2fc691['push'](_0x2fc691['shift']());}};_0x3cdb8d(++_0x2fc68c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0x5fc3[_0x4f431d];return _0x4f31e1;};'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 56d0434..3f426f3 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 _0x0e56=['OpenchannelQueueReport','update','raw','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','body','options'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x0e56,0xf5));var _0x60e5=function(_0x481366,_0x41e46b){_0x481366=_0x481366-0x0;var _0x229649=_0x0e56[_0x481366];return _0x229649;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var moment=require('moment');var BPromise=require(_0x60e5('0x2'));var rs=require(_0x60e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60e5('0x4'))['db'];var utils=require(_0x60e5('0x5'));var logger=require(_0x60e5('0x6'))(_0x60e5('0x7'));var config=require(_0x60e5('0x8'));var jayson=require(_0x60e5('0x9'));var client=jayson[_0x60e5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b44b9,_0x5513f2,_0x31765c){return new BPromise(function(_0x3083a0,_0x59389e){return client[_0x60e5('0xb')](_0x1b44b9,_0x31765c)[_0x60e5('0xc')](function(_0x46d531){logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,_0x60e5('0xf'));logger[_0x60e5('0x10')](_0x60e5('0x11'),_0x5513f2,_0x60e5('0xf'),JSON[_0x60e5('0x12')](_0x46d531));if(_0x46d531[_0x60e5('0x13')]){if(_0x46d531[_0x60e5('0x13')][_0x60e5('0x14')]===0x1f4){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x59389e(_0x46d531[_0x60e5('0x13')]['message']);}logger['error'](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x3083a0(_0x46d531[_0x60e5('0x13')][_0x60e5('0x15')]);}else{logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,'request\x20sent');_0x3083a0(_0x46d531[_0x60e5('0x16')][_0x60e5('0x15')]);}})[_0x60e5('0x17')](function(_0x1ed08d){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x1ed08d);_0x59389e(_0x1ed08d);});});}exports[_0x60e5('0x18')]=function(_0x12aee7){var _0x3060b6=this;return new Promise(function(_0x51688a,_0x599dc4){return db['OpenchannelQueueReport']['create'](_0x12aee7[_0x60e5('0x19')],{'raw':_0x12aee7[_0x60e5('0x1a')]?_0x12aee7[_0x60e5('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x60e5('0xc')](function(_0x68c78){logger[_0x60e5('0xd')](_0x60e5('0x18'),_0x12aee7);logger[_0x60e5('0x10')](_0x60e5('0x18'),_0x12aee7,JSON[_0x60e5('0x12')](_0x68c78));_0x51688a(_0x68c78);})[_0x60e5('0x17')](function(_0x443665){logger[_0x60e5('0x13')](_0x60e5('0x18'),_0x443665['message'],_0x12aee7);_0x599dc4(_0x3060b6['error'](0x1f4,_0x443665[_0x60e5('0x15')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x5a2b4d){var _0x2c692d=this;return new Promise(function(_0x58e43b,_0x200da3){return db[_0x60e5('0x1b')][_0x60e5('0x1c')](_0x5a2b4d[_0x60e5('0x19')],{'raw':_0x5a2b4d[_0x60e5('0x1a')]?_0x5a2b4d['options'][_0x60e5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a2b4d['options']?_0x5a2b4d[_0x60e5('0x1a')][_0x60e5('0x1e')]||null:null,'attributes':_0x5a2b4d[_0x60e5('0x1a')]?_0x5a2b4d['options'][_0x60e5('0x1f')]||null:null,'limit':_0x5a2b4d[_0x60e5('0x1a')]?_0x5a2b4d['options'][_0x60e5('0x20')]||null:null})[_0x60e5('0xc')](function(_0x46ebed){logger['info'](_0x60e5('0x21'),_0x5a2b4d);logger[_0x60e5('0x10')](_0x60e5('0x21'),_0x5a2b4d,JSON[_0x60e5('0x12')](_0x46ebed));_0x58e43b(_0x46ebed);})[_0x60e5('0x17')](function(_0x40ce94){logger[_0x60e5('0x13')](_0x60e5('0x21'),_0x40ce94[_0x60e5('0x15')],_0x5a2b4d);_0x200da3(_0x2c692d[_0x60e5('0x13')](0x1f4,_0x40ce94[_0x60e5('0x15')]));});});}; \ No newline at end of file +var _0xf4f4=['body','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','stringify','UpdateOpenchannelQueueReport','update'];(function(_0x2f8d4a,_0x456abd){var _0x4aa7e6=function(_0x9b1ea9){while(--_0x9b1ea9){_0x2f8d4a['push'](_0x2f8d4a['shift']());}};_0x4aa7e6(++_0x456abd);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x342465,_0x3aa51b){_0x342465=_0x342465-0x0;var _0x4a4da7=_0xf4f4[_0x342465];return _0x4a4da7;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var moment=require('moment');var BPromise=require(_0x4f4f('0x2'));var rs=require(_0x4f4f('0x3'));var fs=require('fs');var Redis=require(_0x4f4f('0x4'));var db=require(_0x4f4f('0x5'))['db'];var utils=require(_0x4f4f('0x6'));var logger=require('../../config/logger')(_0x4f4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f4f('0x8'));var client=jayson[_0x4f4f('0x9')][_0x4f4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ff75a,_0x3c4877,_0x249f8a){return new BPromise(function(_0x2faba9,_0x3768d7){return client['request'](_0x1ff75a,_0x249f8a)[_0x4f4f('0xb')](function(_0x38d110){logger[_0x4f4f('0xc')](_0x4f4f('0xd'),_0x3c4877,_0x4f4f('0xe'));logger[_0x4f4f('0xf')](_0x4f4f('0x10'),_0x3c4877,_0x4f4f('0xe'),JSON['stringify'](_0x38d110));if(_0x38d110['error']){if(_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x12')]===0x1f4){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x3768d7(_0x38d110['error'][_0x4f4f('0x13')]);}logger['error'](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x2faba9(_0x38d110[_0x4f4f('0x11')]['message']);}else{logger[_0x4f4f('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3c4877,'request\x20sent');_0x2faba9(_0x38d110['result'][_0x4f4f('0x13')]);}})[_0x4f4f('0x14')](function(_0x2d21ed){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x2d21ed);_0x3768d7(_0x2d21ed);});});}exports[_0x4f4f('0x15')]=function(_0x1245c4){var _0x60ce2=this;return new Promise(function(_0x929a0b,_0x2f9397){return db[_0x4f4f('0x16')][_0x4f4f('0x17')](_0x1245c4['body'],{'raw':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x19')]===undefined?!![]:![]:!![]})[_0x4f4f('0xb')](function(_0x302a79){logger[_0x4f4f('0xc')](_0x4f4f('0x15'),_0x1245c4);logger[_0x4f4f('0xf')](_0x4f4f('0x15'),_0x1245c4,JSON[_0x4f4f('0x1a')](_0x302a79));_0x929a0b(_0x302a79);})[_0x4f4f('0x14')](function(_0x17832f){logger[_0x4f4f('0x11')](_0x4f4f('0x15'),_0x17832f['message'],_0x1245c4);_0x2f9397(_0x60ce2['error'](0x1f4,_0x17832f['message']));});});};exports[_0x4f4f('0x1b')]=function(_0x43e661){var _0x5186ac=this;return new Promise(function(_0x3960ae,_0x15859c){return db[_0x4f4f('0x16')][_0x4f4f('0x1c')](_0x43e661[_0x4f4f('0x1d')],{'raw':_0x43e661[_0x4f4f('0x18')]?_0x43e661[_0x4f4f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e661[_0x4f4f('0x18')]?_0x43e661[_0x4f4f('0x18')][_0x4f4f('0x1e')]||null:null,'attributes':_0x43e661[_0x4f4f('0x18')]?_0x43e661[_0x4f4f('0x18')]['attributes']||null:null,'limit':_0x43e661[_0x4f4f('0x18')]?_0x43e661[_0x4f4f('0x18')][_0x4f4f('0x1f')]||null:null})['then'](function(_0x534075){logger['info'](_0x4f4f('0x1b'),_0x43e661);logger['debug'](_0x4f4f('0x1b'),_0x43e661,JSON[_0x4f4f('0x1a')](_0x534075));_0x3960ae(_0x534075);})[_0x4f4f('0x14')](function(_0x5eb7c9){logger[_0x4f4f('0x11')](_0x4f4f('0x1b'),_0x5eb7c9['message'],_0x43e661);_0x15859c(_0x5186ac[_0x4f4f('0x11')](0x1f4,_0x5eb7c9[_0x4f4f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 59124fb..d9b20a8 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 _0x1c4a=['/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3e2843,_0x5863b1){var _0xc00513=function(_0x331ac8){while(--_0x331ac8){_0x3e2843['push'](_0x3e2843['shift']());}};_0xc00513(++_0x5863b1);}(_0x1c4a,0x1ab));var _0xa1c4=function(_0x21d532,_0x4552a4){_0x21d532=_0x21d532-0x0;var _0x37bda1=_0x1c4a[_0x21d532];return _0x37bda1;};'use strict';var multer=require(_0xa1c4('0x0'));var util=require(_0xa1c4('0x1'));var path=require(_0xa1c4('0x2'));var timeout=require(_0xa1c4('0x3'));var express=require('express');var router=express[_0xa1c4('0x4')]();var fs_extra=require(_0xa1c4('0x5'));var auth=require(_0xa1c4('0x6'));var interaction=require(_0xa1c4('0x7'));var config=require('../../config/environment');var controller=require(_0xa1c4('0x8'));router[_0xa1c4('0x9')]('/',auth[_0xa1c4('0xa')](),controller[_0xa1c4('0xb')]);router[_0xa1c4('0x9')](_0xa1c4('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa1c4('0xd'),auth[_0xa1c4('0xa')](),controller[_0xa1c4('0xe')]);router[_0xa1c4('0xf')]('/',auth['isAuthenticated'](),controller[_0xa1c4('0x10')]);router[_0xa1c4('0x11')]('/:id',auth[_0xa1c4('0xa')](),controller['update']);router[_0xa1c4('0x12')](_0xa1c4('0xd'),auth[_0xa1c4('0xa')](),controller[_0xa1c4('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7e16=['/describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x1d3c4b,_0x3918c4){var _0x1acd5c=function(_0x4b8d90){while(--_0x4b8d90){_0x1d3c4b['push'](_0x1d3c4b['shift']());}};_0x1acd5c(++_0x3918c4);}(_0x7e16,0x13d));var _0x67e1=function(_0x5e3e62,_0x2319f4){_0x5e3e62=_0x5e3e62-0x0;var _0x4f2738=_0x7e16[_0x5e3e62];return _0x4f2738;};'use strict';var multer=require(_0x67e1('0x0'));var util=require(_0x67e1('0x1'));var path=require(_0x67e1('0x2'));var timeout=require(_0x67e1('0x3'));var express=require(_0x67e1('0x4'));var router=express[_0x67e1('0x5')]();var fs_extra=require(_0x67e1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x67e1('0x7'));var config=require(_0x67e1('0x8'));var controller=require(_0x67e1('0x9'));router[_0x67e1('0xa')]('/',auth[_0x67e1('0xb')](),controller[_0x67e1('0xc')]);router[_0x67e1('0xa')](_0x67e1('0xd'),auth[_0x67e1('0xb')](),controller['describe']);router[_0x67e1('0xa')](_0x67e1('0xe'),auth[_0x67e1('0xb')](),controller['show']);router[_0x67e1('0xf')]('/',auth[_0x67e1('0xb')](),controller[_0x67e1('0x10')]);router[_0x67e1('0x11')](_0x67e1('0xe'),auth['isAuthenticated'](),controller[_0x67e1('0x12')]);router[_0x67e1('0x13')](_0x67e1('0xe'),auth[_0x67e1('0xb')](),controller[_0x67e1('0x14')]);module[_0x67e1('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index bcdb693..d4e09a7 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x2d2f11,_0x1a80bd){var _0x27502b=function(_0x1bffe7){while(--_0x1bffe7){_0x2d2f11['push'](_0x2d2f11['shift']());}};_0x27502b(++_0x1a80bd);}(_0x70e0,0x17b));var _0x070e=function(_0x313215,_0x2a48ac){_0x313215=_0x313215-0x0;var _0x5d25d1=_0x70e0[_0x313215];return _0x5d25d1;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x283af2,_0x3adf1e){var _0x4c8c9f=function(_0xc6c110){while(--_0xc6c110){_0x283af2['push'](_0x283af2['shift']());}};_0x4c8c9f(++_0x3adf1e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x00bb[_0x110c3d];return _0x226d67;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index d6cb46e..6b9d133 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 _0x34e2=['send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','show','params','includeAll','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name'];(function(_0x5b3df3,_0x1f78dc){var _0x30e54d=function(_0xe8ef03){while(--_0xe8ef03){_0x5b3df3['push'](_0x5b3df3['shift']());}};_0x30e54d(++_0x1f78dc);}(_0x34e2,0x151));var _0x234e=function(_0x17c20e,_0x51355a){_0x17c20e=_0x17c20e-0x0;var _0x26ed4c=_0x34e2[_0x17c20e];return _0x26ed4c;};'use strict';var emlformat=require(_0x234e('0x0'));var rimraf=require(_0x234e('0x1'));var zipdir=require(_0x234e('0x2'));var jsonpatch=require(_0x234e('0x3'));var rp=require(_0x234e('0x4'));var moment=require(_0x234e('0x5'));var BPromise=require(_0x234e('0x6'));var Mustache=require(_0x234e('0x7'));var util=require(_0x234e('0x8'));var path=require(_0x234e('0x9'));var sox=require('sox');var csv=require(_0x234e('0xa'));var ejs=require(_0x234e('0xb'));var fs=require('fs');var fs_extra=require(_0x234e('0xc'));var _=require('lodash');var squel=require(_0x234e('0xd'));var crypto=require(_0x234e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x234e('0xf'));var toCsv=require(_0x234e('0xa'));var querystring=require(_0x234e('0x10'));var Papa=require(_0x234e('0x11'));var Redis=require('ioredis');var authService=require(_0x234e('0x12'));var qs=require(_0x234e('0x13'));var as=require(_0x234e('0x14'));var hardwareService=require(_0x234e('0x15'));var logger=require('../../config/logger')(_0x234e('0x16'));var utils=require(_0x234e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x234e('0x18'));var db=require(_0x234e('0x19'))['db'];function respondWithStatusCode(_0x4a80a1,_0x1a54c){_0x1a54c=_0x1a54c||0xcc;return function(_0x3f10ed){if(_0x3f10ed){return _0x4a80a1[_0x234e('0x1a')](_0x1a54c);}return _0x4a80a1[_0x234e('0x1b')](_0x1a54c)['end']();};}function respondWithResult(_0x5e4eed,_0x4f405c){_0x4f405c=_0x4f405c||0xc8;return function(_0x1f25fd){if(_0x1f25fd){return _0x5e4eed[_0x234e('0x1b')](_0x4f405c)[_0x234e('0x1c')](_0x1f25fd);}};}function respondWithFilteredResult(_0x4091ef,_0x2bed36){return function(_0x11b93c){if(_0x11b93c){var _0x440ab7=typeof _0x2bed36[_0x234e('0x1d')]===_0x234e('0x1e')&&typeof _0x2bed36['limit']==='undefined';var _0x29db9f=_0x11b93c[_0x234e('0x1f')];var _0x588759=_0x440ab7?0x0:_0x2bed36[_0x234e('0x1d')];var _0x449502=_0x440ab7?_0x11b93c[_0x234e('0x1f')]:_0x2bed36[_0x234e('0x1d')]+_0x2bed36[_0x234e('0x20')];var _0x42a0be;if(_0x449502>=_0x29db9f){_0x449502=_0x29db9f;_0x42a0be=0xc8;}else{_0x42a0be=0xce;}_0x4091ef[_0x234e('0x1b')](_0x42a0be);return _0x4091ef[_0x234e('0x21')](_0x234e('0x22'),_0x588759+'-'+_0x449502+'/'+_0x29db9f)[_0x234e('0x1c')](_0x11b93c);}return null;};}function patchUpdates(_0x13abe0){return function(_0x2ec892){try{jsonpatch[_0x234e('0x23')](_0x2ec892,_0x13abe0,!![]);}catch(_0x75e1e){return BPromise[_0x234e('0x24')](_0x75e1e);}return _0x2ec892['save']();};}function saveUpdates(_0x1cd5d7,_0x50c68b){return function(_0x465db6){if(_0x465db6){return _0x465db6[_0x234e('0x25')](_0x1cd5d7)['then'](function(_0x242566){return _0x242566;});}return null;};}function removeEntity(_0x53235b,_0x28eb3c){return function(_0xd1fbca){if(_0xd1fbca){return _0xd1fbca[_0x234e('0x26')]()[_0x234e('0x27')](function(){_0x53235b[_0x234e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d5bb4,_0xca76b0){return function(_0x13bd5d){if(!_0x13bd5d){_0x2d5bb4[_0x234e('0x1a')](0x194);}return _0x13bd5d;};}function handleError(_0x1e2bc,_0x184372){_0x184372=_0x184372||0x1f4;return function(_0x498b96){logger[_0x234e('0x28')](_0x498b96[_0x234e('0x29')]);if(_0x498b96['name']){delete _0x498b96[_0x234e('0x2a')];}_0x1e2bc['status'](_0x184372)[_0x234e('0x2b')](_0x498b96);};}exports[_0x234e('0x2c')]=function(_0x65b57d,_0x2989df){var _0x12b4a7={},_0x28a570={},_0x1d3821={'count':0x0,'rows':[]};var _0x4de897=_[_0x234e('0x2d')](db[_0x234e('0x2e')][_0x234e('0x2f')],function(_0x121426){return{'name':_0x121426['fieldName'],'type':_0x121426[_0x234e('0x30')][_0x234e('0x31')]};});_0x28a570[_0x234e('0x32')]=_['map'](_0x4de897,_0x234e('0x2a'));_0x28a570[_0x234e('0x33')]=_[_0x234e('0x34')](_0x65b57d[_0x234e('0x33')]);_0x28a570[_0x234e('0x35')]=_['intersection'](_0x28a570[_0x234e('0x32')],_0x28a570[_0x234e('0x33')]);_0x12b4a7['attributes']=_[_0x234e('0x36')](_0x28a570[_0x234e('0x32')],qs[_0x234e('0x37')](_0x65b57d['query'][_0x234e('0x37')]));_0x12b4a7[_0x234e('0x38')]=_0x12b4a7['attributes'][_0x234e('0x39')]?_0x12b4a7[_0x234e('0x38')]:_0x28a570['model'];if(!_0x65b57d[_0x234e('0x33')]['hasOwnProperty'](_0x234e('0x3a'))){_0x12b4a7[_0x234e('0x20')]=qs[_0x234e('0x20')](_0x65b57d[_0x234e('0x33')][_0x234e('0x20')]);_0x12b4a7[_0x234e('0x1d')]=qs[_0x234e('0x1d')](_0x65b57d[_0x234e('0x33')]['offset']);}_0x12b4a7[_0x234e('0x3b')]=qs[_0x234e('0x3c')](_0x65b57d[_0x234e('0x33')][_0x234e('0x3c')]);_0x12b4a7['where']=qs[_0x234e('0x35')](_[_0x234e('0x3d')](_0x65b57d[_0x234e('0x33')],_0x28a570[_0x234e('0x35')]),_0x4de897);if(_0x65b57d[_0x234e('0x33')][_0x234e('0x3e')]){_0x12b4a7[_0x234e('0x3f')]=_[_0x234e('0x40')](_0x12b4a7[_0x234e('0x3f')],{'$or':_[_0x234e('0x2d')](_0x4de897,function(_0x4080a5){if(_0x4080a5[_0x234e('0x30')]!==_0x234e('0x41')){var _0x45e1d9={};_0x45e1d9[_0x4080a5[_0x234e('0x2a')]]={'$like':'%'+_0x65b57d['query'][_0x234e('0x3e')]+'%'};return _0x45e1d9;}})});}_0x12b4a7=_[_0x234e('0x40')]({},_0x12b4a7,_0x65b57d[_0x234e('0x42')]);var _0x23032a={'where':_0x12b4a7[_0x234e('0x3f')]};return db[_0x234e('0x2e')][_0x234e('0x1f')](_0x23032a)[_0x234e('0x27')](function(_0x5799df){_0x1d3821[_0x234e('0x1f')]=_0x5799df;if(_0x65b57d['query']['includeAll']){_0x12b4a7[_0x234e('0x43')]=[{'all':!![]}];}return db[_0x234e('0x2e')]['findAll'](_0x12b4a7);})[_0x234e('0x27')](function(_0x3d0167){_0x1d3821['rows']=_0x3d0167;return _0x1d3821;})[_0x234e('0x27')](respondWithFilteredResult(_0x2989df,_0x12b4a7))['catch'](handleError(_0x2989df,null));};exports[_0x234e('0x44')]=function(_0x4aaff7,_0x18e96d){var _0x5acff1={'raw':!![],'where':{'id':_0x4aaff7[_0x234e('0x45')]['id']}},_0x393711={};_0x393711[_0x234e('0x32')]=_[_0x234e('0x34')](db[_0x234e('0x2e')][_0x234e('0x2f')]);_0x393711[_0x234e('0x33')]=_[_0x234e('0x34')](_0x4aaff7[_0x234e('0x33')]);_0x393711[_0x234e('0x35')]=_['intersection'](_0x393711[_0x234e('0x32')],_0x393711[_0x234e('0x33')]);_0x5acff1[_0x234e('0x38')]=_[_0x234e('0x36')](_0x393711[_0x234e('0x32')],qs[_0x234e('0x37')](_0x4aaff7[_0x234e('0x33')][_0x234e('0x37')]));_0x5acff1[_0x234e('0x38')]=_0x5acff1['attributes'][_0x234e('0x39')]?_0x5acff1['attributes']:_0x393711[_0x234e('0x32')];if(_0x4aaff7[_0x234e('0x33')][_0x234e('0x46')]){_0x5acff1[_0x234e('0x43')]=[{'all':!![]}];}_0x5acff1=_['merge']({},_0x5acff1,_0x4aaff7[_0x234e('0x42')]);return db[_0x234e('0x2e')]['find'](_0x5acff1)[_0x234e('0x27')](handleEntityNotFound(_0x18e96d,null))['then'](respondWithResult(_0x18e96d,null))['catch'](handleError(_0x18e96d,null));};exports[_0x234e('0x47')]=function(_0x482585,_0x2f3e7a){return db['OpenchannelTransferReport'][_0x234e('0x47')](_0x482585[_0x234e('0x48')],{})[_0x234e('0x27')](respondWithResult(_0x2f3e7a,0xc9))['catch'](handleError(_0x2f3e7a,null));};exports[_0x234e('0x25')]=function(_0x34adb2,_0xd84c11){if(_0x34adb2[_0x234e('0x48')]['id']){delete _0x34adb2[_0x234e('0x48')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x34adb2[_0x234e('0x45')]['id']}})[_0x234e('0x27')](handleEntityNotFound(_0xd84c11,null))['then'](saveUpdates(_0x34adb2[_0x234e('0x48')],null))[_0x234e('0x27')](respondWithResult(_0xd84c11,null))[_0x234e('0x49')](handleError(_0xd84c11,null));};exports[_0x234e('0x26')]=function(_0x4e146d,_0x33278c){return db[_0x234e('0x2e')][_0x234e('0x4a')]({'where':{'id':_0x4e146d[_0x234e('0x45')]['id']}})[_0x234e('0x27')](handleEntityNotFound(_0x33278c,null))[_0x234e('0x27')](removeEntity(_0x33278c,null))[_0x234e('0x49')](handleError(_0x33278c,null));};exports[_0x234e('0x4b')]=function(_0x1f90c6,_0x4ea4c7){return db[_0x234e('0x2e')]['describe']()[_0x234e('0x27')](respondWithResult(_0x4ea4c7,null))[_0x234e('0x49')](handleError(_0x4ea4c7,null));}; \ No newline at end of file +var _0x9a86=['rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','count','limit','set','Content-Range','reject','update','then','sendStatus','stack','name','send','index','map','OpenchannelTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params'];(function(_0x3af7b0,_0x5beae9){var _0x255154=function(_0xb5262c){while(--_0xb5262c){_0x3af7b0['push'](_0x3af7b0['shift']());}};_0x255154(++_0x5beae9);}(_0x9a86,0x1ce));var _0x69a8=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x9a86[_0x4bd06e];return _0x85ebb;};'use strict';var emlformat=require(_0x69a8('0x0'));var rimraf=require(_0x69a8('0x1'));var zipdir=require(_0x69a8('0x2'));var jsonpatch=require(_0x69a8('0x3'));var rp=require(_0x69a8('0x4'));var moment=require(_0x69a8('0x5'));var BPromise=require(_0x69a8('0x6'));var Mustache=require(_0x69a8('0x7'));var util=require(_0x69a8('0x8'));var path=require(_0x69a8('0x9'));var sox=require(_0x69a8('0xa'));var csv=require(_0x69a8('0xb'));var ejs=require(_0x69a8('0xc'));var fs=require('fs');var fs_extra=require(_0x69a8('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x69a8('0xe'));var deskjs=require(_0x69a8('0xf'));var toCsv=require(_0x69a8('0xb'));var querystring=require(_0x69a8('0x10'));var Papa=require(_0x69a8('0x11'));var Redis=require(_0x69a8('0x12'));var authService=require(_0x69a8('0x13'));var qs=require(_0x69a8('0x14'));var as=require(_0x69a8('0x15'));var hardwareService=require(_0x69a8('0x16'));var logger=require(_0x69a8('0x17'))('api');var utils=require(_0x69a8('0x18'));var config=require(_0x69a8('0x19'));var licenseUtil=require(_0x69a8('0x1a'));var db=require(_0x69a8('0x1b'))['db'];function respondWithStatusCode(_0x2a7d09,_0x4ef881){_0x4ef881=_0x4ef881||0xcc;return function(_0xfc61a8){if(_0xfc61a8){return _0x2a7d09['sendStatus'](_0x4ef881);}return _0x2a7d09[_0x69a8('0x1c')](_0x4ef881)[_0x69a8('0x1d')]();};}function respondWithResult(_0x3a347d,_0x24b715){_0x24b715=_0x24b715||0xc8;return function(_0x2afdea){if(_0x2afdea){return _0x3a347d[_0x69a8('0x1c')](_0x24b715)[_0x69a8('0x1e')](_0x2afdea);}};}function respondWithFilteredResult(_0x554612,_0x34bac4){return function(_0x5c8e0b){if(_0x5c8e0b){var _0x3c6725=typeof _0x34bac4[_0x69a8('0x1f')]==='undefined'&&typeof _0x34bac4['limit']==='undefined';var _0x4bd347=_0x5c8e0b[_0x69a8('0x20')];var _0xa8946e=_0x3c6725?0x0:_0x34bac4[_0x69a8('0x1f')];var _0xa7f9f9=_0x3c6725?_0x5c8e0b[_0x69a8('0x20')]:_0x34bac4[_0x69a8('0x1f')]+_0x34bac4[_0x69a8('0x21')];var _0x7c07c6;if(_0xa7f9f9>=_0x4bd347){_0xa7f9f9=_0x4bd347;_0x7c07c6=0xc8;}else{_0x7c07c6=0xce;}_0x554612[_0x69a8('0x1c')](_0x7c07c6);return _0x554612[_0x69a8('0x22')](_0x69a8('0x23'),_0xa8946e+'-'+_0xa7f9f9+'/'+_0x4bd347)['json'](_0x5c8e0b);}return null;};}function patchUpdates(_0x2c2324){return function(_0x51e85f){try{jsonpatch['apply'](_0x51e85f,_0x2c2324,!![]);}catch(_0x1262ca){return BPromise[_0x69a8('0x24')](_0x1262ca);}return _0x51e85f['save']();};}function saveUpdates(_0xe725e1,_0x69d599){return function(_0xce6ff0){if(_0xce6ff0){return _0xce6ff0[_0x69a8('0x25')](_0xe725e1)['then'](function(_0x1d9c90){return _0x1d9c90;});}return null;};}function removeEntity(_0x205a29,_0x3dadde){return function(_0x46089f){if(_0x46089f){return _0x46089f['destroy']()[_0x69a8('0x26')](function(){_0x205a29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fcd27,_0x3cbd85){return function(_0x2c6d03){if(!_0x2c6d03){_0x4fcd27[_0x69a8('0x27')](0x194);}return _0x2c6d03;};}function handleError(_0x561212,_0x5e19df){_0x5e19df=_0x5e19df||0x1f4;return function(_0x274cb3){logger['error'](_0x274cb3[_0x69a8('0x28')]);if(_0x274cb3[_0x69a8('0x29')]){delete _0x274cb3[_0x69a8('0x29')];}_0x561212['status'](_0x5e19df)[_0x69a8('0x2a')](_0x274cb3);};}exports[_0x69a8('0x2b')]=function(_0x450d9a,_0x528ce8){var _0xac3a23={},_0x2aae9c={},_0x5e95fd={'count':0x0,'rows':[]};var _0x39d3b3=_[_0x69a8('0x2c')](db[_0x69a8('0x2d')]['rawAttributes'],function(_0x16f995){return{'name':_0x16f995[_0x69a8('0x2e')],'type':_0x16f995[_0x69a8('0x2f')][_0x69a8('0x30')]};});_0x2aae9c[_0x69a8('0x31')]=_[_0x69a8('0x2c')](_0x39d3b3,'name');_0x2aae9c[_0x69a8('0x32')]=_[_0x69a8('0x33')](_0x450d9a['query']);_0x2aae9c[_0x69a8('0x34')]=_[_0x69a8('0x35')](_0x2aae9c[_0x69a8('0x31')],_0x2aae9c[_0x69a8('0x32')]);_0xac3a23[_0x69a8('0x36')]=_['intersection'](_0x2aae9c[_0x69a8('0x31')],qs[_0x69a8('0x37')](_0x450d9a['query'][_0x69a8('0x37')]));_0xac3a23[_0x69a8('0x36')]=_0xac3a23[_0x69a8('0x36')][_0x69a8('0x38')]?_0xac3a23['attributes']:_0x2aae9c[_0x69a8('0x31')];if(!_0x450d9a[_0x69a8('0x32')][_0x69a8('0x39')]('nolimit')){_0xac3a23['limit']=qs[_0x69a8('0x21')](_0x450d9a[_0x69a8('0x32')][_0x69a8('0x21')]);_0xac3a23[_0x69a8('0x1f')]=qs[_0x69a8('0x1f')](_0x450d9a[_0x69a8('0x32')]['offset']);}_0xac3a23[_0x69a8('0x3a')]=qs[_0x69a8('0x3b')](_0x450d9a[_0x69a8('0x32')][_0x69a8('0x3b')]);_0xac3a23[_0x69a8('0x3c')]=qs[_0x69a8('0x34')](_['pick'](_0x450d9a[_0x69a8('0x32')],_0x2aae9c[_0x69a8('0x34')]),_0x39d3b3);if(_0x450d9a[_0x69a8('0x32')][_0x69a8('0x3d')]){_0xac3a23[_0x69a8('0x3c')]=_[_0x69a8('0x3e')](_0xac3a23[_0x69a8('0x3c')],{'$or':_['map'](_0x39d3b3,function(_0x472808){if(_0x472808[_0x69a8('0x2f')]!=='VIRTUAL'){var _0xfd0c15={};_0xfd0c15[_0x472808[_0x69a8('0x29')]]={'$like':'%'+_0x450d9a['query'][_0x69a8('0x3d')]+'%'};return _0xfd0c15;}})});}_0xac3a23=_[_0x69a8('0x3e')]({},_0xac3a23,_0x450d9a[_0x69a8('0x3f')]);var _0x1a64f4={'where':_0xac3a23[_0x69a8('0x3c')]};return db['OpenchannelTransferReport'][_0x69a8('0x20')](_0x1a64f4)[_0x69a8('0x26')](function(_0x419ae3){_0x5e95fd[_0x69a8('0x20')]=_0x419ae3;if(_0x450d9a[_0x69a8('0x32')][_0x69a8('0x40')]){_0xac3a23[_0x69a8('0x41')]=[{'all':!![]}];}return db[_0x69a8('0x2d')]['findAll'](_0xac3a23);})[_0x69a8('0x26')](function(_0x21c583){_0x5e95fd[_0x69a8('0x42')]=_0x21c583;return _0x5e95fd;})[_0x69a8('0x26')](respondWithFilteredResult(_0x528ce8,_0xac3a23))[_0x69a8('0x43')](handleError(_0x528ce8,null));};exports[_0x69a8('0x44')]=function(_0x1a712e,_0x3c9f38){var _0x291f2a={'raw':!![],'where':{'id':_0x1a712e[_0x69a8('0x45')]['id']}},_0x58ce51={};_0x58ce51[_0x69a8('0x31')]=_['keys'](db[_0x69a8('0x2d')][_0x69a8('0x46')]);_0x58ce51[_0x69a8('0x32')]=_[_0x69a8('0x33')](_0x1a712e[_0x69a8('0x32')]);_0x58ce51[_0x69a8('0x34')]=_['intersection'](_0x58ce51[_0x69a8('0x31')],_0x58ce51[_0x69a8('0x32')]);_0x291f2a[_0x69a8('0x36')]=_['intersection'](_0x58ce51['model'],qs[_0x69a8('0x37')](_0x1a712e[_0x69a8('0x32')][_0x69a8('0x37')]));_0x291f2a[_0x69a8('0x36')]=_0x291f2a[_0x69a8('0x36')]['length']?_0x291f2a[_0x69a8('0x36')]:_0x58ce51[_0x69a8('0x31')];if(_0x1a712e['query'][_0x69a8('0x40')]){_0x291f2a['include']=[{'all':!![]}];}_0x291f2a=_['merge']({},_0x291f2a,_0x1a712e['options']);return db[_0x69a8('0x2d')][_0x69a8('0x47')](_0x291f2a)[_0x69a8('0x26')](handleEntityNotFound(_0x3c9f38,null))[_0x69a8('0x26')](respondWithResult(_0x3c9f38,null))[_0x69a8('0x43')](handleError(_0x3c9f38,null));};exports[_0x69a8('0x48')]=function(_0x598f93,_0x44783a){return db[_0x69a8('0x2d')][_0x69a8('0x48')](_0x598f93[_0x69a8('0x49')],{})[_0x69a8('0x26')](respondWithResult(_0x44783a,0xc9))[_0x69a8('0x43')](handleError(_0x44783a,null));};exports[_0x69a8('0x25')]=function(_0x505afe,_0x273618){if(_0x505afe[_0x69a8('0x49')]['id']){delete _0x505afe[_0x69a8('0x49')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x505afe['params']['id']}})[_0x69a8('0x26')](handleEntityNotFound(_0x273618,null))[_0x69a8('0x26')](saveUpdates(_0x505afe[_0x69a8('0x49')],null))['then'](respondWithResult(_0x273618,null))[_0x69a8('0x43')](handleError(_0x273618,null));};exports[_0x69a8('0x4a')]=function(_0x4f5356,_0x564215){return db[_0x69a8('0x2d')][_0x69a8('0x47')]({'where':{'id':_0x4f5356[_0x69a8('0x45')]['id']}})[_0x69a8('0x26')](handleEntityNotFound(_0x564215,null))['then'](removeEntity(_0x564215,null))[_0x69a8('0x43')](handleError(_0x564215,null));};exports[_0x69a8('0x4b')]=function(_0x2d83b0,_0x3d06ee){return db['OpenchannelTransferReport'][_0x69a8('0x4b')]()['then'](respondWithResult(_0x3d06ee,null))['catch'](handleError(_0x3d06ee,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 975b2fa..f90c74b 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 _0xb239=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x216d9d,_0x4e9708){var _0x3fbfb6=function(_0x5e88d6){while(--_0x5e88d6){_0x216d9d['push'](_0x216d9d['shift']());}};_0x3fbfb6(++_0x4e9708);}(_0xb239,0x85));var _0x9b23=function(_0x1c7f2b,_0x1fca59){_0x1c7f2b=_0x1c7f2b-0x0;var _0x575629=_0xb239[_0x1c7f2b];return _0x575629;};'use strict';var _=require(_0x9b23('0x0'));var util=require('util');var logger=require(_0x9b23('0x1'))(_0x9b23('0x2'));var moment=require(_0x9b23('0x3'));var BPromise=require('bluebird');var rp=require(_0x9b23('0x4'));var fs=require('fs');var path=require(_0x9b23('0x5'));var rimraf=require(_0x9b23('0x6'));var config=require(_0x9b23('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0x9b23('0x8')]=function(_0x2f4d91,_0x35105f){return _0x2f4d91[_0x9b23('0x9')](_0x9b23('0xa'),attributes,{'tableName':_0x9b23('0xb'),'paranoid':![],'indexes':[{'name':_0x9b23('0xc'),'fields':[_0x9b23('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d3f=['report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','OpenchannelTransferReport'];(function(_0x19f80c,_0x3a283c){var _0x5bc5d9=function(_0x3381dd){while(--_0x3381dd){_0x19f80c['push'](_0x19f80c['shift']());}};_0x5bc5d9(++_0x3a283c);}(_0x4d3f,0xfe));var _0xf4d3=function(_0x51a4a6,_0x369184){_0x51a4a6=_0x51a4a6-0x0;var _0x4d16fb=_0x4d3f[_0x51a4a6];return _0x4d16fb;};'use strict';var _=require('lodash');var util=require(_0xf4d3('0x0'));var logger=require(_0xf4d3('0x1'))(_0xf4d3('0x2'));var moment=require(_0xf4d3('0x3'));var BPromise=require(_0xf4d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4d3('0x5'));var rimraf=require(_0xf4d3('0x6'));var config=require(_0xf4d3('0x7'));var attributes=require(_0xf4d3('0x8'));module['exports']=function(_0x52662d,_0x107833){return _0x52662d['define'](_0xf4d3('0x9'),attributes,{'tableName':_0xf4d3('0xa'),'paranoid':![],'indexes':[{'name':_0xf4d3('0xb'),'fields':[_0xf4d3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 8aaf40e..b1f2605 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 _0xac31=['code','OpenchannelTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3820dd,_0xcf327e){var _0x31dcd4=function(_0x307dd0){while(--_0x307dd0){_0x3820dd['push'](_0x3820dd['shift']());}};_0x31dcd4(++_0xcf327e);}(_0xac31,0xca));var _0x1ac3=function(_0x32ef95,_0x47027e){_0x32ef95=_0x32ef95-0x0;var _0x30c679=_0xac31[_0x32ef95];return _0x30c679;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bf9b1,_0x1be223,_0x157604){return new BPromise(function(_0x57893c,_0x2d17de){return client['request'](_0x2bf9b1,_0x157604)[_0x1ac3('0xb')](function(_0x40b64c){logger[_0x1ac3('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1be223,_0x1ac3('0xd'));logger[_0x1ac3('0xe')](_0x1ac3('0xf'),_0x1be223,_0x1ac3('0xd'),JSON[_0x1ac3('0x10')](_0x40b64c));if(_0x40b64c[_0x1ac3('0x11')]){if(_0x40b64c['error'][_0x1ac3('0x12')]===0x1f4){logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c[_0x1ac3('0x11')]['message']);return _0x2d17de(_0x40b64c[_0x1ac3('0x11')][_0x1ac3('0x14')]);}logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c['error'][_0x1ac3('0x14')]);return _0x57893c(_0x40b64c[_0x1ac3('0x11')]['message']);}else{logger[_0x1ac3('0xc')](_0x1ac3('0x13'),_0x1be223,_0x1ac3('0xd'));_0x57893c(_0x40b64c['result'][_0x1ac3('0x14')]);}})[_0x1ac3('0x15')](function(_0x23e6e9){logger['error'](_0x1ac3('0x13'),_0x1be223,_0x23e6e9);_0x2d17de(_0x23e6e9);});});} \ No newline at end of file +var _0x0958=['moment','randomstring','ioredis','../../config/logger','rpc','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util'];(function(_0x1431ef,_0x865f44){var _0x110131=function(_0x1d47d2){while(--_0x1d47d2){_0x1431ef['push'](_0x1431ef['shift']());}};_0x110131(++_0x865f44);}(_0x0958,0x7c));var _0x8095=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0958[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8095('0x0'));var util=require(_0x8095('0x1'));var moment=require(_0x8095('0x2'));var BPromise=require('bluebird');var rs=require(_0x8095('0x3'));var fs=require('fs');var Redis=require(_0x8095('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8095('0x5'))(_0x8095('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8095('0x7')][_0x8095('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x439ecc,_0x1dac39,_0x1fac84){return new BPromise(function(_0x4d5ee3,_0x5a19ef){return client[_0x8095('0x9')](_0x439ecc,_0x1fac84)[_0x8095('0xa')](function(_0x4967a5){logger['info'](_0x8095('0xb'),_0x1dac39,'request\x20sent');logger[_0x8095('0xc')](_0x8095('0xd'),_0x1dac39,_0x8095('0xe'),JSON[_0x8095('0xf')](_0x4967a5));if(_0x4967a5[_0x8095('0x10')]){if(_0x4967a5['error'][_0x8095('0x11')]===0x1f4){logger['error'](_0x8095('0xb'),_0x1dac39,_0x4967a5[_0x8095('0x10')][_0x8095('0x12')]);return _0x5a19ef(_0x4967a5[_0x8095('0x10')][_0x8095('0x12')]);}logger[_0x8095('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1dac39,_0x4967a5[_0x8095('0x10')][_0x8095('0x12')]);return _0x4d5ee3(_0x4967a5[_0x8095('0x10')]['message']);}else{logger[_0x8095('0x13')](_0x8095('0xb'),_0x1dac39,_0x8095('0xe'));_0x4d5ee3(_0x4967a5[_0x8095('0x14')][_0x8095('0x12')]);}})['catch'](function(_0x1b1ca3){logger[_0x8095('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1dac39,_0x1b1ca3);_0x5a19ef(_0x1b1ca3);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 8da5f42..1e41d54 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 _0x3029=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','show','put'];(function(_0x16765f,_0x3dd736){var _0x1326d4=function(_0x523c1a){while(--_0x523c1a){_0x16765f['push'](_0x16765f['shift']());}};_0x1326d4(++_0x3dd736);}(_0x3029,0x130));var _0x9302=function(_0x279645,_0x2ed6c5){_0x279645=_0x279645-0x0;var _0x1b6272=_0x3029[_0x279645];return _0x1b6272;};'use strict';var multer=require(_0x9302('0x0'));var util=require(_0x9302('0x1'));var path=require(_0x9302('0x2'));var timeout=require(_0x9302('0x3'));var express=require(_0x9302('0x4'));var router=express[_0x9302('0x5')]();var fs_extra=require(_0x9302('0x6'));var auth=require(_0x9302('0x7'));var interaction=require(_0x9302('0x8'));var config=require(_0x9302('0x9'));var controller=require(_0x9302('0xa'));router[_0x9302('0xb')]('/',auth[_0x9302('0xc')](),controller['index']);router[_0x9302('0xb')](_0x9302('0xd'),auth[_0x9302('0xc')](),controller[_0x9302('0xe')]);router['post']('/',auth[_0x9302('0xc')](),controller['create']);router[_0x9302('0xf')](_0x9302('0xd'),auth[_0x9302('0xc')](),controller[_0x9302('0x10')]);router[_0x9302('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9302('0x12')]);module[_0x9302('0x13')]=router; \ No newline at end of file +var _0x1648=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout'];(function(_0x5f2e95,_0x3684bb){var _0x158621=function(_0x1929b7){while(--_0x1929b7){_0x5f2e95['push'](_0x5f2e95['shift']());}};_0x158621(++_0x3684bb);}(_0x1648,0xa7));var _0x8164=function(_0x346923,_0x460e97){_0x346923=_0x346923-0x0;var _0x3b0ca7=_0x1648[_0x346923];return _0x3b0ca7;};'use strict';var multer=require(_0x8164('0x0'));var util=require(_0x8164('0x1'));var path=require(_0x8164('0x2'));var timeout=require(_0x8164('0x3'));var express=require(_0x8164('0x4'));var router=express[_0x8164('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8164('0x6'));var interaction=require(_0x8164('0x7'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x8164('0x8')]('/',auth[_0x8164('0x9')](),controller[_0x8164('0xa')]);router[_0x8164('0x8')]('/:id',auth[_0x8164('0x9')](),controller[_0x8164('0xb')]);router[_0x8164('0xc')]('/',auth[_0x8164('0x9')](),controller[_0x8164('0xd')]);router[_0x8164('0xe')]('/:id',auth[_0x8164('0x9')](),controller[_0x8164('0xf')]);router[_0x8164('0x10')](_0x8164('0x11'),auth[_0x8164('0x9')](),controller[_0x8164('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 753317f..8bc2a54 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 _0xd71a=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd71a,0x12c));var _0xad71=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd71a[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xad71('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xad71('0x1')]}}; \ No newline at end of file +var _0x51c5=['STRING','name','sequelize','exports'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x51c5,0x16e));var _0x551c=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x51c5[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require(_0x551c('0x0'));module[_0x551c('0x1')]={'name':{'type':Sequelize[_0x551c('0x2')],'unique':_0x551c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x551c('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 0638bbb..c7a368b 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 _0x3272=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Pauses','error','stack','name','send','index','map','Pause','fieldName','type','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','eml-format','fast-json-patch','request-promise','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','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x31f274,_0x5d8e66){var _0x4e724e=function(_0x343621){while(--_0x343621){_0x31f274['push'](_0x31f274['shift']());}};_0x4e724e(++_0x5d8e66);}(_0x3272,0x96));var _0x2327=function(_0x1db18a,_0x49ffd6){_0x1db18a=_0x1db18a-0x0;var _0x702cf3=_0x3272[_0x1db18a];return _0x702cf3;};'use strict';var emlformat=require(_0x2327('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2327('0x1'));var rp=require(_0x2327('0x2'));var moment=require(_0x2327('0x3'));var BPromise=require(_0x2327('0x4'));var Mustache=require(_0x2327('0x5'));var util=require(_0x2327('0x6'));var path=require('path');var sox=require(_0x2327('0x7'));var csv=require(_0x2327('0x8'));var ejs=require(_0x2327('0x9'));var fs=require('fs');var fs_extra=require(_0x2327('0xa'));var _=require(_0x2327('0xb'));var squel=require(_0x2327('0xc'));var crypto=require('crypto');var jsforce=require(_0x2327('0xd'));var deskjs=require(_0x2327('0xe'));var toCsv=require(_0x2327('0x8'));var querystring=require(_0x2327('0xf'));var Papa=require(_0x2327('0x10'));var Redis=require(_0x2327('0x11'));var authService=require(_0x2327('0x12'));var qs=require(_0x2327('0x13'));var as=require(_0x2327('0x14'));var hardwareService=require(_0x2327('0x15'));var logger=require(_0x2327('0x16'))(_0x2327('0x17'));var utils=require('../../config/utils');var config=require(_0x2327('0x18'));var licenseUtil=require(_0x2327('0x19'));var db=require(_0x2327('0x1a'))['db'];function respondWithStatusCode(_0x2b2ab0,_0x1d7e70){_0x1d7e70=_0x1d7e70||0xcc;return function(_0x427b56){if(_0x427b56){return _0x2b2ab0[_0x2327('0x1b')](_0x1d7e70);}return _0x2b2ab0[_0x2327('0x1c')](_0x1d7e70)[_0x2327('0x1d')]();};}function respondWithResult(_0x160988,_0x439b32){_0x439b32=_0x439b32||0xc8;return function(_0x5222e6){if(_0x5222e6){return _0x160988['status'](_0x439b32)[_0x2327('0x1e')](_0x5222e6);}};}function respondWithFilteredResult(_0x421965,_0x415a96){return function(_0x3fe699){if(_0x3fe699){var _0x1a15c9=typeof _0x415a96[_0x2327('0x1f')]===_0x2327('0x20')&&typeof _0x415a96[_0x2327('0x21')]===_0x2327('0x20');var _0x1e698e=_0x3fe699[_0x2327('0x22')];var _0x6fee72=_0x1a15c9?0x0:_0x415a96['offset'];var _0x5bff9e=_0x1a15c9?_0x3fe699[_0x2327('0x22')]:_0x415a96[_0x2327('0x1f')]+_0x415a96[_0x2327('0x21')];var _0x50e786;if(_0x5bff9e>=_0x1e698e){_0x5bff9e=_0x1e698e;_0x50e786=0xc8;}else{_0x50e786=0xce;}_0x421965[_0x2327('0x1c')](_0x50e786);return _0x421965[_0x2327('0x23')](_0x2327('0x24'),_0x6fee72+'-'+_0x5bff9e+'/'+_0x1e698e)['json'](_0x3fe699);}return null;};}function patchUpdates(_0x4fcad2){return function(_0x5dfe44){try{jsonpatch[_0x2327('0x25')](_0x5dfe44,_0x4fcad2,!![]);}catch(_0x3fec93){return BPromise[_0x2327('0x26')](_0x3fec93);}return _0x5dfe44['save']();};}function saveUpdates(_0x2b0cac,_0x2813bd){return function(_0x2ed766){if(_0x2ed766){return _0x2ed766[_0x2327('0x27')](_0x2b0cac)[_0x2327('0x28')](function(_0x1e2e88){return _0x1e2e88;});}return null;};}function removeEntity(_0x1c75b4,_0x29a60d){return function(_0x530c09){if(_0x530c09){return _0x530c09[_0x2327('0x29')]()[_0x2327('0x28')](function(){var _0x1ec5b3=_0x530c09[_0x2327('0x2a')]({'plain':!![]});var _0x239dc7=_0x2327('0x2b');return db['UserProfileResource'][_0x2327('0x29')]({'where':{'type':_0x239dc7,'resourceId':_0x1ec5b3['id']}})[_0x2327('0x28')](function(){return _0x530c09;});})['then'](function(){_0x1c75b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2cbf,_0x2b4342){return function(_0x5d6e81){if(!_0x5d6e81){_0x4c2cbf['sendStatus'](0x194);}return _0x5d6e81;};}function handleError(_0x556beb,_0x32cfa4){_0x32cfa4=_0x32cfa4||0x1f4;return function(_0x227c76){logger[_0x2327('0x2c')](_0x227c76[_0x2327('0x2d')]);if(_0x227c76[_0x2327('0x2e')]){delete _0x227c76[_0x2327('0x2e')];}_0x556beb[_0x2327('0x1c')](_0x32cfa4)[_0x2327('0x2f')](_0x227c76);};}exports[_0x2327('0x30')]=function(_0x1767a8,_0x1d6031){var _0xcc4256={},_0x1699de={},_0x36b4e3={'count':0x0,'rows':[]};var _0x2752dd=_[_0x2327('0x31')](db[_0x2327('0x32')]['rawAttributes'],function(_0x2650b8){return{'name':_0x2650b8[_0x2327('0x33')],'type':_0x2650b8[_0x2327('0x34')]['key']};});_0x1699de['model']=_[_0x2327('0x31')](_0x2752dd,_0x2327('0x2e'));_0x1699de['query']=_[_0x2327('0x35')](_0x1767a8[_0x2327('0x36')]);_0x1699de['filters']=_['intersection'](_0x1699de[_0x2327('0x37')],_0x1699de[_0x2327('0x36')]);_0xcc4256[_0x2327('0x38')]=_[_0x2327('0x39')](_0x1699de['model'],qs[_0x2327('0x3a')](_0x1767a8['query'][_0x2327('0x3a')]));_0xcc4256[_0x2327('0x38')]=_0xcc4256[_0x2327('0x38')][_0x2327('0x3b')]?_0xcc4256[_0x2327('0x38')]:_0x1699de['model'];if(!_0x1767a8['query'][_0x2327('0x3c')](_0x2327('0x3d'))){_0xcc4256[_0x2327('0x21')]=qs[_0x2327('0x21')](_0x1767a8[_0x2327('0x36')][_0x2327('0x21')]);_0xcc4256[_0x2327('0x1f')]=qs[_0x2327('0x1f')](_0x1767a8[_0x2327('0x36')][_0x2327('0x1f')]);}_0xcc4256[_0x2327('0x3e')]=qs[_0x2327('0x3f')](_0x1767a8['query'][_0x2327('0x3f')]);_0xcc4256[_0x2327('0x40')]=qs[_0x2327('0x41')](_[_0x2327('0x42')](_0x1767a8['query'],_0x1699de['filters']),_0x2752dd);if(_0x1767a8['query'][_0x2327('0x43')]){_0xcc4256[_0x2327('0x40')]=_[_0x2327('0x44')](_0xcc4256[_0x2327('0x40')],{'$or':_['map'](_0x2752dd,function(_0xded1a1){if(_0xded1a1[_0x2327('0x34')]!==_0x2327('0x45')){var _0x4fb382={};_0x4fb382[_0xded1a1[_0x2327('0x2e')]]={'$like':'%'+_0x1767a8[_0x2327('0x36')][_0x2327('0x43')]+'%'};return _0x4fb382;}})});}_0xcc4256=_['merge']({},_0xcc4256,_0x1767a8['options']);var _0x48825d={'where':_0xcc4256[_0x2327('0x40')]};return db[_0x2327('0x32')][_0x2327('0x22')](_0x48825d)[_0x2327('0x28')](function(_0xf6182c){_0x36b4e3[_0x2327('0x22')]=_0xf6182c;if(_0x1767a8[_0x2327('0x36')][_0x2327('0x46')]){_0xcc4256[_0x2327('0x47')]=[{'all':!![]}];}return db['Pause'][_0x2327('0x48')](_0xcc4256);})[_0x2327('0x28')](function(_0x14879a){_0x36b4e3[_0x2327('0x49')]=_0x14879a;return _0x36b4e3;})[_0x2327('0x28')](respondWithFilteredResult(_0x1d6031,_0xcc4256))[_0x2327('0x4a')](handleError(_0x1d6031,null));};exports[_0x2327('0x4b')]=function(_0x24738f,_0x201c46){var _0x6d3406={'raw':!![],'where':{'id':_0x24738f['params']['id']}},_0x2574b4={};_0x2574b4['model']=_[_0x2327('0x35')](db[_0x2327('0x32')][_0x2327('0x4c')]);_0x2574b4[_0x2327('0x36')]=_[_0x2327('0x35')](_0x24738f[_0x2327('0x36')]);_0x2574b4[_0x2327('0x41')]=_[_0x2327('0x39')](_0x2574b4[_0x2327('0x37')],_0x2574b4['query']);_0x6d3406['attributes']=_[_0x2327('0x39')](_0x2574b4[_0x2327('0x37')],qs[_0x2327('0x3a')](_0x24738f[_0x2327('0x36')]['fields']));_0x6d3406[_0x2327('0x38')]=_0x6d3406[_0x2327('0x38')]['length']?_0x6d3406[_0x2327('0x38')]:_0x2574b4['model'];if(_0x24738f[_0x2327('0x36')][_0x2327('0x46')]){_0x6d3406['include']=[{'all':!![]}];}_0x6d3406=_[_0x2327('0x44')]({},_0x6d3406,_0x24738f[_0x2327('0x4d')]);return db['Pause'][_0x2327('0x4e')](_0x6d3406)[_0x2327('0x28')](handleEntityNotFound(_0x201c46,null))[_0x2327('0x28')](respondWithResult(_0x201c46,null))[_0x2327('0x4a')](handleError(_0x201c46,null));};exports[_0x2327('0x4f')]=function(_0x38105e,_0x5092ed){return db[_0x2327('0x32')][_0x2327('0x4f')](_0x38105e[_0x2327('0x50')],{})[_0x2327('0x28')](function(_0x18af42){var _0x4f6922=_0x38105e['user']['get']({'plain':!![]});if(!_0x4f6922)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f6922[_0x2327('0x51')]===_0x2327('0x52')){var _0x18efc=_0x18af42[_0x2327('0x2a')]({'plain':!![]});var _0x38aa55='Pauses';return db[_0x2327('0x53')][_0x2327('0x4e')]({'where':{'name':_0x38aa55,'userProfileId':_0x4f6922[_0x2327('0x54')]},'raw':!![]})[_0x2327('0x28')](function(_0x40e39b){if(_0x40e39b&&_0x40e39b[_0x2327('0x55')]===0x0){return db[_0x2327('0x56')]['create']({'name':_0x18efc[_0x2327('0x2e')],'resourceId':_0x18efc['id'],'type':_0x40e39b[_0x2327('0x2e')],'sectionId':_0x40e39b['id']},{})[_0x2327('0x28')](function(){return _0x18af42;});}else{return _0x18af42;}})[_0x2327('0x4a')](function(_0x5357f9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5357f9);throw _0x5357f9;});}return _0x18af42;})['then'](respondWithResult(_0x5092ed,0xc9))[_0x2327('0x4a')](handleError(_0x5092ed,null));};exports['update']=function(_0x5393e3,_0x7714e){if(_0x5393e3[_0x2327('0x50')]['id']){delete _0x5393e3[_0x2327('0x50')]['id'];}return db[_0x2327('0x32')][_0x2327('0x4e')]({'where':{'id':_0x5393e3['params']['id']}})[_0x2327('0x28')](handleEntityNotFound(_0x7714e,null))['then'](saveUpdates(_0x5393e3[_0x2327('0x50')],null))[_0x2327('0x28')](respondWithResult(_0x7714e,null))[_0x2327('0x4a')](handleError(_0x7714e,null));};exports[_0x2327('0x29')]=function(_0x571013,_0x34c549){return db[_0x2327('0x32')]['find']({'where':{'id':_0x571013[_0x2327('0x57')]['id']}})[_0x2327('0x28')](handleEntityNotFound(_0x34c549,null))[_0x2327('0x28')](removeEntity(_0x34c549,null))[_0x2327('0x4a')](handleError(_0x34c549,null));}; \ No newline at end of file +var _0x247a=['../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','get','Pauses','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Pause','includeAll','include','catch','show','params','find','create','body','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x247a,0x123));var _0xa247=function(_0x3a8b2d,_0x4ea870){_0x3a8b2d=_0x3a8b2d-0x0;var _0x54f1be=_0x247a[_0x3a8b2d];return _0x54f1be;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa247('0x0'));var jsonpatch=require(_0xa247('0x1'));var rp=require(_0xa247('0x2'));var moment=require(_0xa247('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa247('0x4'));var util=require('util');var path=require(_0xa247('0x5'));var sox=require(_0xa247('0x6'));var csv=require(_0xa247('0x7'));var ejs=require(_0xa247('0x8'));var fs=require('fs');var fs_extra=require(_0xa247('0x9'));var _=require(_0xa247('0xa'));var squel=require('squel');var crypto=require(_0xa247('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa247('0x7'));var querystring=require(_0xa247('0xc'));var Papa=require(_0xa247('0xd'));var Redis=require(_0xa247('0xe'));var authService=require(_0xa247('0xf'));var qs=require(_0xa247('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa247('0x11'));var logger=require(_0xa247('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa247('0x13'));var licenseUtil=require(_0xa247('0x14'));var db=require(_0xa247('0x15'))['db'];function respondWithStatusCode(_0x4e6d97,_0x4efc2a){_0x4efc2a=_0x4efc2a||0xcc;return function(_0x3774b4){if(_0x3774b4){return _0x4e6d97[_0xa247('0x16')](_0x4efc2a);}return _0x4e6d97[_0xa247('0x17')](_0x4efc2a)['end']();};}function respondWithResult(_0x53dbb0,_0x596eed){_0x596eed=_0x596eed||0xc8;return function(_0x146560){if(_0x146560){return _0x53dbb0[_0xa247('0x17')](_0x596eed)['json'](_0x146560);}};}function respondWithFilteredResult(_0x53891c,_0x34d6d9){return function(_0x516786){if(_0x516786){var _0x3ad8de=typeof _0x34d6d9[_0xa247('0x18')]===_0xa247('0x19')&&typeof _0x34d6d9[_0xa247('0x1a')]===_0xa247('0x19');var _0x3c45db=_0x516786[_0xa247('0x1b')];var _0x103532=_0x3ad8de?0x0:_0x34d6d9['offset'];var _0x59f332=_0x3ad8de?_0x516786['count']:_0x34d6d9[_0xa247('0x18')]+_0x34d6d9[_0xa247('0x1a')];var _0x56517f;if(_0x59f332>=_0x3c45db){_0x59f332=_0x3c45db;_0x56517f=0xc8;}else{_0x56517f=0xce;}_0x53891c[_0xa247('0x17')](_0x56517f);return _0x53891c['set'](_0xa247('0x1c'),_0x103532+'-'+_0x59f332+'/'+_0x3c45db)[_0xa247('0x1d')](_0x516786);}return null;};}function patchUpdates(_0x3b4886){return function(_0x116540){try{jsonpatch['apply'](_0x116540,_0x3b4886,!![]);}catch(_0x28e0b7){return BPromise[_0xa247('0x1e')](_0x28e0b7);}return _0x116540[_0xa247('0x1f')]();};}function saveUpdates(_0x3d85a2,_0x31a031){return function(_0x274aad){if(_0x274aad){return _0x274aad[_0xa247('0x20')](_0x3d85a2)[_0xa247('0x21')](function(_0xcaf894){return _0xcaf894;});}return null;};}function removeEntity(_0x149e48,_0x12be85){return function(_0x3219dc){if(_0x3219dc){return _0x3219dc[_0xa247('0x22')]()[_0xa247('0x21')](function(){var _0x4d6784=_0x3219dc[_0xa247('0x23')]({'plain':!![]});var _0x2f0cc2=_0xa247('0x24');return db['UserProfileResource'][_0xa247('0x22')]({'where':{'type':_0x2f0cc2,'resourceId':_0x4d6784['id']}})[_0xa247('0x21')](function(){return _0x3219dc;});})[_0xa247('0x21')](function(){_0x149e48[_0xa247('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aee63,_0xe0ce9a){return function(_0x40d2dc){if(!_0x40d2dc){_0x5aee63[_0xa247('0x16')](0x194);}return _0x40d2dc;};}function handleError(_0x194ebd,_0x519325){_0x519325=_0x519325||0x1f4;return function(_0x5ed9aa){logger[_0xa247('0x25')](_0x5ed9aa['stack']);if(_0x5ed9aa['name']){delete _0x5ed9aa[_0xa247('0x26')];}_0x194ebd[_0xa247('0x17')](_0x519325)[_0xa247('0x27')](_0x5ed9aa);};}exports[_0xa247('0x28')]=function(_0x29bbba,_0x2bb8de){var _0x2cd02e={},_0x3b7b96={},_0x46016b={'count':0x0,'rows':[]};var _0x25c75e=_[_0xa247('0x29')](db['Pause'][_0xa247('0x2a')],function(_0x3b7158){return{'name':_0x3b7158[_0xa247('0x2b')],'type':_0x3b7158[_0xa247('0x2c')][_0xa247('0x2d')]};});_0x3b7b96[_0xa247('0x2e')]=_[_0xa247('0x29')](_0x25c75e,_0xa247('0x26'));_0x3b7b96[_0xa247('0x2f')]=_[_0xa247('0x30')](_0x29bbba['query']);_0x3b7b96[_0xa247('0x31')]=_[_0xa247('0x32')](_0x3b7b96[_0xa247('0x2e')],_0x3b7b96[_0xa247('0x2f')]);_0x2cd02e['attributes']=_[_0xa247('0x32')](_0x3b7b96['model'],qs[_0xa247('0x33')](_0x29bbba[_0xa247('0x2f')][_0xa247('0x33')]));_0x2cd02e[_0xa247('0x34')]=_0x2cd02e['attributes'][_0xa247('0x35')]?_0x2cd02e['attributes']:_0x3b7b96[_0xa247('0x2e')];if(!_0x29bbba[_0xa247('0x2f')][_0xa247('0x36')]('nolimit')){_0x2cd02e[_0xa247('0x1a')]=qs[_0xa247('0x1a')](_0x29bbba[_0xa247('0x2f')][_0xa247('0x1a')]);_0x2cd02e[_0xa247('0x18')]=qs[_0xa247('0x18')](_0x29bbba[_0xa247('0x2f')][_0xa247('0x18')]);}_0x2cd02e[_0xa247('0x37')]=qs[_0xa247('0x38')](_0x29bbba[_0xa247('0x2f')][_0xa247('0x38')]);_0x2cd02e[_0xa247('0x39')]=qs[_0xa247('0x31')](_[_0xa247('0x3a')](_0x29bbba['query'],_0x3b7b96[_0xa247('0x31')]),_0x25c75e);if(_0x29bbba['query'][_0xa247('0x3b')]){_0x2cd02e['where']=_[_0xa247('0x3c')](_0x2cd02e[_0xa247('0x39')],{'$or':_[_0xa247('0x29')](_0x25c75e,function(_0x51ebdc){if(_0x51ebdc[_0xa247('0x2c')]!==_0xa247('0x3d')){var _0x243897={};_0x243897[_0x51ebdc[_0xa247('0x26')]]={'$like':'%'+_0x29bbba[_0xa247('0x2f')][_0xa247('0x3b')]+'%'};return _0x243897;}})});}_0x2cd02e=_[_0xa247('0x3c')]({},_0x2cd02e,_0x29bbba[_0xa247('0x3e')]);var _0x6b7255={'where':_0x2cd02e[_0xa247('0x39')]};return db[_0xa247('0x3f')][_0xa247('0x1b')](_0x6b7255)[_0xa247('0x21')](function(_0x5a5401){_0x46016b['count']=_0x5a5401;if(_0x29bbba['query'][_0xa247('0x40')]){_0x2cd02e[_0xa247('0x41')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x2cd02e);})['then'](function(_0x2a8e81){_0x46016b['rows']=_0x2a8e81;return _0x46016b;})['then'](respondWithFilteredResult(_0x2bb8de,_0x2cd02e))[_0xa247('0x42')](handleError(_0x2bb8de,null));};exports[_0xa247('0x43')]=function(_0x1206a8,_0x231515){var _0x173b26={'raw':!![],'where':{'id':_0x1206a8[_0xa247('0x44')]['id']}},_0x1f541b={};_0x1f541b['model']=_[_0xa247('0x30')](db[_0xa247('0x3f')][_0xa247('0x2a')]);_0x1f541b[_0xa247('0x2f')]=_[_0xa247('0x30')](_0x1206a8['query']);_0x1f541b[_0xa247('0x31')]=_[_0xa247('0x32')](_0x1f541b['model'],_0x1f541b[_0xa247('0x2f')]);_0x173b26[_0xa247('0x34')]=_[_0xa247('0x32')](_0x1f541b['model'],qs[_0xa247('0x33')](_0x1206a8['query'][_0xa247('0x33')]));_0x173b26[_0xa247('0x34')]=_0x173b26[_0xa247('0x34')][_0xa247('0x35')]?_0x173b26[_0xa247('0x34')]:_0x1f541b[_0xa247('0x2e')];if(_0x1206a8[_0xa247('0x2f')][_0xa247('0x40')]){_0x173b26[_0xa247('0x41')]=[{'all':!![]}];}_0x173b26=_[_0xa247('0x3c')]({},_0x173b26,_0x1206a8[_0xa247('0x3e')]);return db[_0xa247('0x3f')][_0xa247('0x45')](_0x173b26)[_0xa247('0x21')](handleEntityNotFound(_0x231515,null))[_0xa247('0x21')](respondWithResult(_0x231515,null))[_0xa247('0x42')](handleError(_0x231515,null));};exports[_0xa247('0x46')]=function(_0x5d2b80,_0x169a0e){return db[_0xa247('0x3f')][_0xa247('0x46')](_0x5d2b80[_0xa247('0x47')],{})['then'](function(_0x20d309){var _0x3f2c08=_0x5d2b80['user']['get']({'plain':!![]});if(!_0x3f2c08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f2c08['role']===_0xa247('0x48')){var _0x322d16=_0x20d309[_0xa247('0x23')]({'plain':!![]});var _0x1fff95='Pauses';return db['UserProfileSection']['find']({'where':{'name':_0x1fff95,'userProfileId':_0x3f2c08[_0xa247('0x49')]},'raw':!![]})[_0xa247('0x21')](function(_0x39a5a6){if(_0x39a5a6&&_0x39a5a6[_0xa247('0x4a')]===0x0){return db[_0xa247('0x4b')]['create']({'name':_0x322d16[_0xa247('0x26')],'resourceId':_0x322d16['id'],'type':_0x39a5a6[_0xa247('0x26')],'sectionId':_0x39a5a6['id']},{})[_0xa247('0x21')](function(){return _0x20d309;});}else{return _0x20d309;}})['catch'](function(_0x59f76d){logger['error'](_0xa247('0x4c'),_0x59f76d);throw _0x59f76d;});}return _0x20d309;})[_0xa247('0x21')](respondWithResult(_0x169a0e,0xc9))['catch'](handleError(_0x169a0e,null));};exports[_0xa247('0x20')]=function(_0x1cee86,_0x403139){if(_0x1cee86[_0xa247('0x47')]['id']){delete _0x1cee86['body']['id'];}return db[_0xa247('0x3f')]['find']({'where':{'id':_0x1cee86[_0xa247('0x44')]['id']}})['then'](handleEntityNotFound(_0x403139,null))[_0xa247('0x21')](saveUpdates(_0x1cee86[_0xa247('0x47')],null))[_0xa247('0x21')](respondWithResult(_0x403139,null))['catch'](handleError(_0x403139,null));};exports['destroy']=function(_0x5cf0bb,_0x15cd34){return db['Pause'][_0xa247('0x45')]({'where':{'id':_0x5cf0bb[_0xa247('0x44')]['id']}})['then'](handleEntityNotFound(_0x15cd34,null))[_0xa247('0x21')](removeEntity(_0x15cd34,null))[_0xa247('0x42')](handleError(_0x15cd34,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 0f35807..a459a7f 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x1a2eab,_0x38733f){var _0x35114f=function(_0x5a2d50){while(--_0x5a2d50){_0x1a2eab['push'](_0x1a2eab['shift']());}};_0x35114f(++_0x38733f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x5fc3[_0x59c301];return _0x3866b9;};'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')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x52977d,_0x59726e){var _0x18cf88=function(_0x3d11be){while(--_0x3d11be){_0x52977d['push'](_0x52977d['shift']());}};_0x18cf88(++_0x59726e);}(_0xabce,0x103));var _0xeabc=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xabce[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'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 7cecb69..b554cfb 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 _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(_0x6b9d2,_0xbfc1c9){var _0x4c1e9f=function(_0x25bb8e){while(--_0x25bb8e){_0x6b9d2['push'](_0x6b9d2['shift']());}};_0x4c1e9f(++_0xbfc1c9);}(_0x7a54,0x106));var _0x47a5=function(_0x1079ba,_0xeff8d9){_0x1079ba=_0x1079ba-0x0;var _0x453b7c=_0x7a54[_0x1079ba];return _0x453b7c;};'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 +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(_0xa862e,_0xae16bc){var _0x276c3c=function(_0x11c606){while(--_0x11c606){_0xa862e['push'](_0xa862e['shift']());}};_0x276c3c(++_0xae16bc);}(_0xb10b,0x12a));var _0xbb10=function(_0x2335e6,_0x1bade8){_0x2335e6=_0x2335e6-0x0;var _0x370a50=_0xb10b[_0x2335e6];return _0x370a50;};'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 diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 9bf1829..52ea2c5 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 _0xdace=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','show','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','upload','post','webhookPost','update','delete','/:id','exports','multer'];(function(_0x29df30,_0x58d097){var _0x4c9d4f=function(_0xbc5fcd){while(--_0xbc5fcd){_0x29df30['push'](_0x29df30['shift']());}};_0x4c9d4f(++_0x58d097);}(_0xdace,0xc5));var _0xedac=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xdace[_0x5834bc];return _0x3e183a;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./plugin.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),controller[_0xedac('0xc')]);router[_0xedac('0x8')]('/:id',auth[_0xedac('0x9')](),controller[_0xedac('0xd')]);router[_0xedac('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xedac('0xe')]);var upload=multer({'storage':multer[_0xedac('0xf')]({'destination':function(_0x57e1bf,_0x4d6a29,_0x4db2ad){_0x4db2ad(null,path[_0xedac('0x10')](config['root'],_0xedac('0x11')));},'filename':function(_0x4fa1ac,_0x21c6ae,_0x1b0503){_0x21c6ae[_0xedac('0x12')]=_0x21c6ae[_0xedac('0x12')][_0xedac('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1b0503(null,util[_0xedac('0x14')](_0xedac('0x15'),path[_0xedac('0x16')](_0x21c6ae['originalname'],path[_0xedac('0x17')](_0x21c6ae[_0xedac('0x12')])),Date[_0xedac('0x18')](),path[_0xedac('0x17')](_0x21c6ae[_0xedac('0x12')])));}})});router['post']('/',upload[_0xedac('0x19')]('file'),controller[_0xedac('0x1a')]);router[_0xedac('0x1b')](_0xedac('0xb'),controller[_0xedac('0x1c')]);router['put']('/:id',auth[_0xedac('0x9')](),controller[_0xedac('0x1d')]);router[_0xedac('0x1e')](_0xedac('0x1f'),auth['isAuthenticated'](),controller['delete']);module[_0xedac('0x20')]=router; \ No newline at end of file +var _0xe107=['get','/webhook','webhookGet','show','isAuthenticated','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','upload','post','webhookPost','/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./plugin.controller'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe107,0xb3));var _0x7e10=function(_0x4c9629,_0x4b5997){_0x4c9629=_0x4c9629-0x0;var _0x4aaf60=_0xe107[_0x4c9629];return _0x4aaf60;};'use strict';var multer=require(_0x7e10('0x0'));var util=require('util');var path=require(_0x7e10('0x1'));var timeout=require(_0x7e10('0x2'));var express=require(_0x7e10('0x3'));var router=express['Router']();var fs_extra=require(_0x7e10('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7e10('0x5'));var controller=require(_0x7e10('0x6'));router[_0x7e10('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7e10('0x7')](_0x7e10('0x8'),controller[_0x7e10('0x9')]);router[_0x7e10('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7e10('0xa')]);router['get']('/:id/download',auth[_0x7e10('0xb')](),controller[_0x7e10('0xc')]);var upload=multer({'storage':multer[_0x7e10('0xd')]({'destination':function(_0x2bd58a,_0x256cb1,_0x52ba74){_0x52ba74(null,path[_0x7e10('0xe')](config['root'],_0x7e10('0xf')));},'filename':function(_0x2ca84c,_0x2f4d72,_0x5434dd){_0x2f4d72[_0x7e10('0x10')]=_0x2f4d72[_0x7e10('0x10')][_0x7e10('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5434dd(null,util[_0x7e10('0x12')](_0x7e10('0x13'),path[_0x7e10('0x14')](_0x2f4d72[_0x7e10('0x10')],path[_0x7e10('0x15')](_0x2f4d72['originalname'])),Date[_0x7e10('0x16')](),path[_0x7e10('0x15')](_0x2f4d72['originalname'])));}})});router['post']('/',upload[_0x7e10('0x17')]('file'),controller[_0x7e10('0x18')]);router[_0x7e10('0x19')](_0x7e10('0x8'),controller[_0x7e10('0x1a')]);router['put'](_0x7e10('0x1b'),auth[_0x7e10('0xb')](),controller[_0x7e10('0x1c')]);router['delete'](_0x7e10('0x1b'),auth[_0x7e10('0xb')](),controller[_0x7e10('0x1d')]);module[_0x7e10('0x1e')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 2489666..5fd8e0c 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 _0x1773=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always','never','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x2636ee,_0xa2019b){var _0x5be81e=function(_0x2093a4){while(--_0x2093a4){_0x2636ee['push'](_0x2636ee['shift']());}};_0x5be81e(++_0xa2019b);}(_0x1773,0x96));var _0x3177=function(_0x322d17,_0x574293){_0x322d17=_0x322d17-0x0;var _0x2c5679=_0x1773[_0x322d17];return _0x2c5679;};'use strict';var Sequelize=require('sequelize');module[_0x3177('0x0')]={'name':{'type':Sequelize[_0x3177('0x1')]},'type':{'type':Sequelize['ENUM'](_0x3177('0x2'),_0x3177('0x3'))},'description':{'type':Sequelize[_0x3177('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x3177('0x1')],'comment':_0x3177('0x5')},'active':{'type':Sequelize[_0x3177('0x6')],'defaultValue':0x0,'comment':_0x3177('0x7')},'sidebar':{'type':Sequelize[_0x3177('0x8')](_0x3177('0x9'),_0x3177('0xa'),_0x3177('0xb'),_0x3177('0xc')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x3177('0x1')]},'adminUrl':{'type':Sequelize[_0x3177('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x3177('0x1')]},'scriptPath':{'type':Sequelize[_0x3177('0x1')]}}; \ No newline at end of file +var _0x90d6=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','BOOLEAN','adminOnly','agentOnly','always'];(function(_0x2a870e,_0x2ab4eb){var _0x4d9f28=function(_0x3877bd){while(--_0x3877bd){_0x2a870e['push'](_0x2a870e['shift']());}};_0x4d9f28(++_0x2ab4eb);}(_0x90d6,0x6d));var _0x690d=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x90d6[_0x3de8a4];return _0x4635cf;};'use strict';var Sequelize=require(_0x690d('0x0'));module[_0x690d('0x1')]={'name':{'type':Sequelize[_0x690d('0x2')]},'type':{'type':Sequelize[_0x690d('0x3')](_0x690d('0x4'),_0x690d('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x690d('0x6')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x690d('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x690d('0x3')](_0x690d('0x8'),_0x690d('0x9'),_0x690d('0xa'),'never'),'defaultValue':_0x690d('0xa'),'comment':_0x690d('0xb')},'icon':{'type':Sequelize[_0x690d('0x2')]},'adminUrl':{'type':Sequelize[_0x690d('0x2')]},'agentUrl':{'type':Sequelize[_0x690d('0x2')]},'scriptName':{'type':Sequelize[_0x690d('0x2')]},'scriptPath':{'type':Sequelize[_0x690d('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index f70ab2e..dbf89f8 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 _0xfa54=['request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Plugins','UserProfileResource','destroy','end','error','stack','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','includeAll','findAll','rows','catch','show','params','keys','include','download','find','path','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','close','Plugin\x20not\x20found','unlinkSync','Download\x20completed','info','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','lstatSync','isFile','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','agent','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','endsWith','statusCode','webhookPost','http://localhost:','content-type','rimraf','zip-dir','fast-json-patch'];(function(_0x392537,_0x28d64f){var _0x578581=function(_0x383237){while(--_0x383237){_0x392537['push'](_0x392537['shift']());}};_0x578581(++_0x28d64f);}(_0xfa54,0xa9));var _0x4fa5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfa54[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4fa5('0x0'));var zipdir=require(_0x4fa5('0x1'));var jsonpatch=require(_0x4fa5('0x2'));var rp=require(_0x4fa5('0x3'));var moment=require(_0x4fa5('0x4'));var BPromise=require(_0x4fa5('0x5'));var Mustache=require(_0x4fa5('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4fa5('0x7'));var ejs=require(_0x4fa5('0x8'));var fs=require('fs');var fs_extra=require(_0x4fa5('0x9'));var _=require(_0x4fa5('0xa'));var squel=require(_0x4fa5('0xb'));var crypto=require(_0x4fa5('0xc'));var jsforce=require(_0x4fa5('0xd'));var deskjs=require(_0x4fa5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4fa5('0xf'));var Papa=require('papaparse');var extract=require(_0x4fa5('0x10'));var rimraf=require(_0x4fa5('0x0'));var archiver=require('archiver');var Redis=require(_0x4fa5('0x11'));var authService=require(_0x4fa5('0x12'));var qs=require(_0x4fa5('0x13'));var as=require(_0x4fa5('0x14'));var hardwareService=require(_0x4fa5('0x15'));var logger=require('../../config/logger')(_0x4fa5('0x16'));var utils=require('../../config/utils');var config=require(_0x4fa5('0x17'));var licenseUtil=require(_0x4fa5('0x18'));var db=require(_0x4fa5('0x19'))['db'];config['redis']=_['defaults'](config[_0x4fa5('0x1a')],{'host':_0x4fa5('0x1b'),'port':0x18eb});var socket=require(_0x4fa5('0x1c'))(new Redis(config[_0x4fa5('0x1a')]));require(_0x4fa5('0x1d'))[_0x4fa5('0x1e')](socket);function respondWithStatusCode(_0x401ef1,_0x48a730){_0x48a730=_0x48a730||0xcc;return function(_0x1d94e2){if(_0x1d94e2){return _0x401ef1[_0x4fa5('0x1f')](_0x48a730);}return _0x401ef1['status'](_0x48a730)['end']();};}function respondWithResult(_0x4e00c9,_0x353c84){_0x353c84=_0x353c84||0xc8;return function(_0x5c8681){if(_0x5c8681){return _0x4e00c9[_0x4fa5('0x20')](_0x353c84)[_0x4fa5('0x21')](_0x5c8681);}};}function respondWithFilteredResult(_0xea90ef,_0x4a5a4f){return function(_0x100a12){if(_0x100a12){var _0xa946bf=typeof _0x4a5a4f[_0x4fa5('0x22')]===_0x4fa5('0x23')&&typeof _0x4a5a4f[_0x4fa5('0x24')]===_0x4fa5('0x23');var _0x45f9ad=_0x100a12[_0x4fa5('0x25')];var _0x35899d=_0xa946bf?0x0:_0x4a5a4f['offset'];var _0xd4d320=_0xa946bf?_0x100a12[_0x4fa5('0x25')]:_0x4a5a4f[_0x4fa5('0x22')]+_0x4a5a4f[_0x4fa5('0x24')];var _0x1866d1;if(_0xd4d320>=_0x45f9ad){_0xd4d320=_0x45f9ad;_0x1866d1=0xc8;}else{_0x1866d1=0xce;}_0xea90ef[_0x4fa5('0x20')](_0x1866d1);return _0xea90ef[_0x4fa5('0x26')](_0x4fa5('0x27'),_0x35899d+'-'+_0xd4d320+'/'+_0x45f9ad)[_0x4fa5('0x21')](_0x100a12);}return null;};}function patchUpdates(_0x5b5ab6){return function(_0x2cbd8e){try{jsonpatch[_0x4fa5('0x28')](_0x2cbd8e,_0x5b5ab6,!![]);}catch(_0x5f8382){return BPromise['reject'](_0x5f8382);}return _0x2cbd8e[_0x4fa5('0x29')]();};}function saveUpdates(_0x377f2d,_0x2fcfa8){return function(_0x2f9088){if(_0x2f9088){return _0x2f9088[_0x4fa5('0x2a')](_0x377f2d)[_0x4fa5('0x2b')](function(_0x5127d6){return _0x5127d6;});}return null;};}function removeEntity(_0x2aa507,_0x3d713a){return function(_0x23595f){if(_0x23595f){return _0x23595f['destroy']()[_0x4fa5('0x2b')](function(){var _0x12723c=_0x23595f[_0x4fa5('0x2c')]({'plain':!![]});var _0x18f40f=_0x4fa5('0x2d');return db[_0x4fa5('0x2e')][_0x4fa5('0x2f')]({'where':{'type':_0x18f40f,'resourceId':_0x12723c['id']}})[_0x4fa5('0x2b')](function(){return _0x23595f;});})[_0x4fa5('0x2b')](function(){_0x2aa507[_0x4fa5('0x20')](0xcc)[_0x4fa5('0x30')]();});}};}function handleEntityNotFound(_0x3a64ee,_0x1883d9){return function(_0x1868bf){if(!_0x1868bf){_0x3a64ee[_0x4fa5('0x1f')](0x194);}return _0x1868bf;};}function handleError(_0x4f5b63,_0x266a38){_0x266a38=_0x266a38||0x1f4;return function(_0xd8d19e){logger[_0x4fa5('0x31')](_0xd8d19e[_0x4fa5('0x32')]);if(_0xd8d19e['name']){delete _0xd8d19e['name'];}_0x4f5b63['status'](_0x266a38)[_0x4fa5('0x33')](_0xd8d19e);};}exports[_0x4fa5('0x34')]=function(_0x47aede,_0x31c7f8){var _0x2a1a19={},_0x1c03fc={},_0x56ff5f={'count':0x0,'rows':[]};var _0x397cd8=_[_0x4fa5('0x35')](db[_0x4fa5('0x36')][_0x4fa5('0x37')],function(_0x1e60a8){return{'name':_0x1e60a8[_0x4fa5('0x38')],'type':_0x1e60a8[_0x4fa5('0x39')][_0x4fa5('0x3a')]};});_0x1c03fc[_0x4fa5('0x3b')]=_['map'](_0x397cd8,'name');_0x1c03fc[_0x4fa5('0x3c')]=_['keys'](_0x47aede[_0x4fa5('0x3c')]);_0x1c03fc['filters']=_[_0x4fa5('0x3d')](_0x1c03fc['model'],_0x1c03fc[_0x4fa5('0x3c')]);_0x2a1a19[_0x4fa5('0x3e')]=_['intersection'](_0x1c03fc[_0x4fa5('0x3b')],qs[_0x4fa5('0x3f')](_0x47aede['query'][_0x4fa5('0x3f')]));_0x2a1a19[_0x4fa5('0x3e')]=_0x2a1a19[_0x4fa5('0x3e')][_0x4fa5('0x40')]?_0x2a1a19[_0x4fa5('0x3e')]:_0x1c03fc[_0x4fa5('0x3b')];if(!_0x47aede[_0x4fa5('0x3c')]['hasOwnProperty'](_0x4fa5('0x41'))){_0x2a1a19['limit']=qs[_0x4fa5('0x24')](_0x47aede['query'][_0x4fa5('0x24')]);_0x2a1a19['offset']=qs['offset'](_0x47aede[_0x4fa5('0x3c')][_0x4fa5('0x22')]);}_0x2a1a19[_0x4fa5('0x42')]=qs[_0x4fa5('0x43')](_0x47aede['query'][_0x4fa5('0x43')]);_0x2a1a19[_0x4fa5('0x44')]=qs[_0x4fa5('0x45')](_[_0x4fa5('0x46')](_0x47aede['query'],_0x1c03fc[_0x4fa5('0x45')]),_0x397cd8);if(_0x47aede['query'][_0x4fa5('0x47')]){_0x2a1a19[_0x4fa5('0x44')]=_[_0x4fa5('0x48')](_0x2a1a19[_0x4fa5('0x44')],{'$or':_[_0x4fa5('0x35')](_0x397cd8,function(_0x42178e){if(_0x42178e['type']!==_0x4fa5('0x49')){var _0x46b281={};_0x46b281[_0x42178e[_0x4fa5('0x4a')]]={'$like':'%'+_0x47aede[_0x4fa5('0x3c')][_0x4fa5('0x47')]+'%'};return _0x46b281;}})});}_0x2a1a19=_['merge']({},_0x2a1a19,_0x47aede[_0x4fa5('0x4b')]);var _0x1c1d24={'where':_0x2a1a19[_0x4fa5('0x44')]};return db[_0x4fa5('0x36')]['count'](_0x1c1d24)[_0x4fa5('0x2b')](function(_0x8b1224){_0x56ff5f[_0x4fa5('0x25')]=_0x8b1224;if(_0x47aede[_0x4fa5('0x3c')][_0x4fa5('0x4c')]){_0x2a1a19['include']=[{'all':!![]}];}return db['Plugin'][_0x4fa5('0x4d')](_0x2a1a19);})['then'](function(_0x14844f){_0x56ff5f[_0x4fa5('0x4e')]=_0x14844f;return _0x56ff5f;})['then'](respondWithFilteredResult(_0x31c7f8,_0x2a1a19))[_0x4fa5('0x4f')](handleError(_0x31c7f8,null));};exports[_0x4fa5('0x50')]=function(_0x21de9c,_0x478d8a){var _0x13448b={'raw':!![],'where':{'id':_0x21de9c[_0x4fa5('0x51')]['id']}},_0x2a4b87={};_0x2a4b87[_0x4fa5('0x3b')]=_[_0x4fa5('0x52')](db[_0x4fa5('0x36')][_0x4fa5('0x37')]);_0x2a4b87[_0x4fa5('0x3c')]=_[_0x4fa5('0x52')](_0x21de9c[_0x4fa5('0x3c')]);_0x2a4b87[_0x4fa5('0x45')]=_['intersection'](_0x2a4b87[_0x4fa5('0x3b')],_0x2a4b87[_0x4fa5('0x3c')]);_0x13448b[_0x4fa5('0x3e')]=_[_0x4fa5('0x3d')](_0x2a4b87[_0x4fa5('0x3b')],qs[_0x4fa5('0x3f')](_0x21de9c[_0x4fa5('0x3c')][_0x4fa5('0x3f')]));_0x13448b[_0x4fa5('0x3e')]=_0x13448b['attributes']['length']?_0x13448b[_0x4fa5('0x3e')]:_0x2a4b87[_0x4fa5('0x3b')];if(_0x21de9c['query']['includeAll']){_0x13448b[_0x4fa5('0x53')]=[{'all':!![]}];}_0x13448b=_['merge']({},_0x13448b,_0x21de9c['options']);return db[_0x4fa5('0x36')]['find'](_0x13448b)[_0x4fa5('0x2b')](handleEntityNotFound(_0x478d8a,null))['then'](respondWithResult(_0x478d8a,null))['catch'](handleError(_0x478d8a,null));};exports[_0x4fa5('0x54')]=function(_0x3c4393,_0x43dd86,_0x2987dc){return db[_0x4fa5('0x36')][_0x4fa5('0x55')]({'where':{'id':_0x3c4393[_0x4fa5('0x51')]['id']},'attributes':[_0x4fa5('0x4a'),_0x4fa5('0x56')],'raw':!![]})[_0x4fa5('0x2b')](handleEntityNotFound(_0x43dd86,null))[_0x4fa5('0x2b')](function(_0x2f9b28){if(_0x2f9b28){var _0xec5b0d=path[_0x4fa5('0x57')](config[_0x4fa5('0x58')],_0x4fa5('0x59'),util[_0x4fa5('0x5a')](_0x4fa5('0x5b'),path[_0x4fa5('0x5c')](_0x2f9b28[_0x4fa5('0x56')])));var _0x35ed97=fs[_0x4fa5('0x5d')](_0xec5b0d);var _0x24cffc=archiver('zip',{'zlib':{'level':0x9}});_0x24cffc['on']('warning',function(_0x4852d1){if(_0x4852d1[_0x4fa5('0x5e')]==='ENOENT'){logger[_0x4fa5('0x31')](_0x4852d1);}else{throw new db[(_0x4fa5('0x5f'))][(_0x4fa5('0x60'))](_0x4fa5('0x61'));}});_0x24cffc['on']('error',function(_0x29bf0c){throw new db['Sequelize'][(_0x4fa5('0x60'))](_0x4fa5('0x61'));});_0x24cffc[_0x4fa5('0x62')](_0x35ed97);_0x24cffc[_0x4fa5('0x63')](_0x4fa5('0x64'),{'cwd':path[_0x4fa5('0x57')](config[_0x4fa5('0x58')],'server/files/plugins',path[_0x4fa5('0x65')](_0x2f9b28[_0x4fa5('0x56')])),'ignore':[path['join'](path[_0x4fa5('0x5c')](_0x2f9b28[_0x4fa5('0x56')]),_0x4fa5('0x66')),path[_0x4fa5('0x57')](path[_0x4fa5('0x5c')](_0x2f9b28[_0x4fa5('0x56')]),_0x4fa5('0x67'))],'nodir':!![]})['finalize']();_0x35ed97['on'](_0x4fa5('0x68'),function(){if(!fs['existsSync'](_0xec5b0d)){throw new db['Sequelize'][(_0x4fa5('0x60'))](_0x4fa5('0x69'));}return _0x43dd86[_0x4fa5('0x54')](_0xec5b0d,util[_0x4fa5('0x5a')](_0x4fa5('0x5b'),path[_0x4fa5('0x5c')](_0x2f9b28[_0x4fa5('0x56')])),function(_0x9ade84){if(_0x9ade84){throw new db[(_0x4fa5('0x5f'))][(_0x4fa5('0x60'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x4fa5('0x6a')](_0xec5b0d);logger['info'](_0x4fa5('0x6b'));logger[_0x4fa5('0x6c')]('Temporary\x20file\x20removed');});});}return null;})[_0x4fa5('0x4f')](handleError(_0x43dd86,null));};exports['upload']=function(_0xfc0e4c,_0x52cb93,_0x3c6a3b){var _0x2906ae=path[_0x4fa5('0x5c')](_0xfc0e4c['file']['filename'],path[_0x4fa5('0x6d')](_0xfc0e4c[_0x4fa5('0x6e')]['filename']));var _0x55b14d=path[_0x4fa5('0x57')](config[_0x4fa5('0x58')],'server/files/plugins',_0xfc0e4c[_0x4fa5('0x6e')][_0x4fa5('0x6f')]);var _0x1dab67=path[_0x4fa5('0x57')](config['root'],'server/files/plugins',_0x2906ae);logger[_0x4fa5('0x6c')](_0x4fa5('0x70'),_0x55b14d);logger[_0x4fa5('0x6c')](_0x4fa5('0x71'),_0x1dab67);try{fs['chmodSync'](_0x55b14d,parseInt(_0x4fa5('0x72'),0x8));extract(_0x55b14d,{'dir':_0x1dab67},function(_0x1e09ab){if(_0x1e09ab){logger['error'](_0x1e09ab);handleError(_0x1e09ab,!![]);};var _0x1d66c6=fs[_0x4fa5('0x73')](_0x1dab67);if(_0x1d66c6['length']>0x1){removeReferences(_0x55b14d,_0x1dab67);logger['error']('Invalid\x20plugin\x20structure');return _0x3c6a3b(new Error('Invalid\x20plugin\x20structure'));}var _0x549397=fs[_0x4fa5('0x74')](path[_0x4fa5('0x57')](_0x1dab67,_0x1d66c6[0x0]));if(_0x549397[_0x4fa5('0x75')]()){removeReferences(_0x55b14d,_0x1dab67);logger[_0x4fa5('0x31')](_0x4fa5('0x76'));return _0x3c6a3b(new Error(_0x4fa5('0x76')));}if(_0x549397[_0x4fa5('0x77')]()){var _0x4901d3=fs[_0x4fa5('0x73')](path[_0x4fa5('0x57')](_0x1dab67,_0x1d66c6[0x0]));if(_0x4901d3[_0x4fa5('0x40')]===0x0){removeReferences(_0x55b14d,_0x1dab67);logger[_0x4fa5('0x31')](_0x4fa5('0x76'));return _0x3c6a3b(new Error(_0x4fa5('0x76')));}var _0x2219db=_0x4901d3[_0x4fa5('0x78')](function(_0x5da4ac){return _0x5da4ac===_0x4fa5('0x79');});if(!_0x2219db){return _0x3c6a3b(new Error(_0x4fa5('0x7a')));}var _0x4558e2=fs['readFileSync'](path[_0x4fa5('0x57')](_0x1dab67,_0x1d66c6[0x0],_0x4fa5('0x79')));var _0x39a395=JSON[_0x4fa5('0x7b')](_0x4558e2);if(_0x4fa5('0x23')==typeof _0x39a395['name']){return _0x3c6a3b(new Error(_0x4fa5('0x7c')));}if(_0x4fa5('0x23')==typeof _0x39a395[_0x4fa5('0x39')]){return _0x3c6a3b(new Error(_0x4fa5('0x7d')));}if(_0x4fa5('0x23')==typeof _0x39a395[_0x4fa5('0x7e')]){return _0x3c6a3b(new Error(_0x4fa5('0x7f')));}if(_0x4fa5('0x23')==typeof _0x39a395[_0x4fa5('0x80')]){return _0x3c6a3b(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x39a395[_0x4fa5('0x39')]===_0x4fa5('0x81')){if('undefined'==typeof _0x39a395['parameters'][_0x4fa5('0x82')]){return _0x3c6a3b(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x4fa5('0x23')==typeof _0x39a395[_0x4fa5('0x80')][_0x4fa5('0x82')][_0x4fa5('0x83')]&&_0x4fa5('0x23')==typeof _0x39a395[_0x4fa5('0x80')][_0x4fa5('0x82')]['agent']){return _0x3c6a3b(new Error(_0x4fa5('0x84')));}}else if(_0x39a395[_0x4fa5('0x39')]===_0x4fa5('0x85')){if(_0x4fa5('0x23')==typeof _0x39a395[_0x4fa5('0x80')][_0x4fa5('0x86')]){return _0x3c6a3b(new Error(_0x4fa5('0x87')));}if(_0x4fa5('0x23')==typeof _0x39a395[_0x4fa5('0x80')][_0x4fa5('0x88')]){return _0x3c6a3b(new Error(_0x4fa5('0x89')));}}else{return _0x3c6a3b(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x14b876=_0x39a395[_0x4fa5('0x4a')];var _0x4f50d5=_0x39a395['description'];var _0x1d9895=_0x39a395[_0x4fa5('0x39')];var _0x738aba=_0x39a395[_0x4fa5('0x8a')]?_0x39a395[_0x4fa5('0x8a')]:_0x4fa5('0x8b');var _0x1cc874=_0x39a395[_0x4fa5('0x8c')]?_0x39a395[_0x4fa5('0x8c')]:_0x4fa5('0x8d');var _0x3afebc='';var _0x52df03='';var _0x5371e3='';var _0x1f3935='';var _0x206717=_0x39a395[_0x4fa5('0x7e')];if(_0x1d9895===_0x4fa5('0x81')){if('undefined'!=typeof _0x39a395['parameters'][_0x4fa5('0x82')][_0x4fa5('0x83')]){var _0x47dc9e=_0x39a395[_0x4fa5('0x80')][_0x4fa5('0x82')][_0x4fa5('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x4fa5('0x8e')](_0x47dc9e)){_0x3afebc=path['join'](_0x4fa5('0x8f'),_0x2906ae,_0x1d66c6[0x0],_0x47dc9e);}else{_0x3afebc=_0x47dc9e;}}else{logger[_0x4fa5('0x6c')](_0x4fa5('0x90'));}if(_0x4fa5('0x23')!=typeof _0x39a395[_0x4fa5('0x80')][_0x4fa5('0x82')]['agent']){var _0x3d71ca=_0x39a395['parameters']['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x4fa5('0x8e')](_0x3d71ca)){_0x52df03=path['join'](_0x4fa5('0x8f'),_0x2906ae,_0x1d66c6[0x0],_0x3d71ca);}else{_0x52df03=_0x3d71ca;}}else{logger[_0x4fa5('0x6c')](_0x4fa5('0x91'));}}else if(_0x1d9895===_0x4fa5('0x85')){_0x5371e3=_0x39a395['parameters']['scriptName'];_0x1f3935=_0x39a395[_0x4fa5('0x80')][_0x4fa5('0x88')];if('undefined'!=typeof _0x39a395[_0x4fa5('0x80')][_0x4fa5('0x82')]){if(_0x4fa5('0x23')!=typeof _0x39a395['parameters'][_0x4fa5('0x82')]['admin']){var _0x47dc9e=_0x39a395[_0x4fa5('0x80')][_0x4fa5('0x82')][_0x4fa5('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x4fa5('0x8e')](_0x47dc9e)){_0x3afebc=path['join']('plugins',_0x2906ae,_0x1d66c6[0x0],_0x47dc9e);}else{_0x3afebc=_0x47dc9e;}}if(_0x4fa5('0x23')!=typeof _0x39a395[_0x4fa5('0x80')][_0x4fa5('0x82')][_0x4fa5('0x92')]){var _0x3d71ca=_0x39a395[_0x4fa5('0x80')][_0x4fa5('0x82')][_0x4fa5('0x92')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3d71ca)){_0x52df03=path[_0x4fa5('0x57')](_0x4fa5('0x8f'),_0x2906ae,_0x1d66c6[0x0],_0x3d71ca);}else{_0x52df03=_0x3d71ca;}}}}var _0x1f6d62={'name':_0x14b876,'description':_0x4f50d5,'path':path[_0x4fa5('0x57')](_0x2906ae,_0x1d66c6[0x0]),'type':_0x1d9895,'sidebar':_0x738aba,'icon':_0x1cc874,'adminUrl':_0x3afebc,'agentUrl':_0x52df03,'scriptName':_0x5371e3,'scriptPath':_0x1f3935,'version':_0x206717};removeReferences(_0x55b14d,null);return db[_0x4fa5('0x36')]['create'](_0x1f6d62)[_0x4fa5('0x2b')](function(_0x381139){var _0x24ca43={'role':_0xfc0e4c[_0x4fa5('0x93')]['role'],'userProfileId':_0xfc0e4c[_0x4fa5('0x93')][_0x4fa5('0x94')]};if(!_0x24ca43)throw new Error(_0x4fa5('0x95'));if(_0x24ca43['role']===_0x4fa5('0x96')){var _0x28a414=_0x381139['get']({'plain':!![]});return db[_0x4fa5('0x97')]['find']({'where':{'name':_0x4fa5('0x2d'),'userProfileId':_0x24ca43[_0x4fa5('0x94')]},'raw':!![]})[_0x4fa5('0x2b')](function(_0x1a4eb0){if(_0x1a4eb0&&_0x1a4eb0[_0x4fa5('0x98')]===0x0){return db[_0x4fa5('0x2e')]['create']({'name':_0x28a414[_0x4fa5('0x4a')],'resourceId':_0x28a414['id'],'type':_0x1a4eb0[_0x4fa5('0x4a')],'sectionId':_0x1a4eb0['id']},{})[_0x4fa5('0x2b')](function(){return _0x381139;});}else{return _0x381139;}})[_0x4fa5('0x4f')](function(_0x805977){logger[_0x4fa5('0x31')](_0x4fa5('0x99'),_0x805977);throw _0x805977;});}return _0x381139;})[_0x4fa5('0x2b')](respondWithResult(_0x52cb93,null))[_0x4fa5('0x4f')](handleError(_0x52cb93,null));}});}catch(_0x17c1d2){_0x52cb93['status'](0x1f4)[_0x4fa5('0x33')](_0x17c1d2);}};function removeReferences(_0x866ac,_0x5ad51d){try{if(_0x866ac){fs[_0x4fa5('0x6a')](_0x866ac);logger[_0x4fa5('0x6c')]('Zip\x20archive\x20removed');}if(_0x5ad51d){rimraf(_0x5ad51d,function(){});logger[_0x4fa5('0x6c')](_0x4fa5('0x9a'));}}catch(_0x3fd03a){logger[_0x4fa5('0x31')](_0x3fd03a);}}exports['update']=function(_0x3ab006,_0x5246b3,_0x315321){return db[_0x4fa5('0x36')][_0x4fa5('0x55')]({'where':{'id':_0x3ab006[_0x4fa5('0x51')]['id']}})[_0x4fa5('0x2b')](handleEntityNotFound(_0x5246b3,null))[_0x4fa5('0x2b')](saveUpdates(_0x3ab006[_0x4fa5('0x93')],null))[_0x4fa5('0x2b')](respondWithResult(_0x5246b3,null))[_0x4fa5('0x4f')](handleError(_0x5246b3,null));};exports[_0x4fa5('0x9b')]=function(_0x418278,_0x2a7467,_0x38d53c){return db['Plugin'][_0x4fa5('0x55')]({'where':{'id':_0x418278[_0x4fa5('0x51')]['id']}})[_0x4fa5('0x2b')](function(_0x643c67){if(_0x643c67){return _0x643c67['destroy']();}})[_0x4fa5('0x2b')](function(_0x5c36f3){rimraf(path[_0x4fa5('0x57')](config[_0x4fa5('0x58')],'server/files/plugins',path[_0x4fa5('0x65')](_0x5c36f3[_0x4fa5('0x56')])),function(){});return _0x5c36f3;})[_0x4fa5('0x2b')](handleEntityNotFound(_0x2a7467,null))[_0x4fa5('0x2b')](respondWithStatusCode(_0x2a7467,null))[_0x4fa5('0x4f')](handleError(_0x2a7467,null));};exports[_0x4fa5('0x9c')]=function(_0x488ad0,_0x322f4e,_0x4fec2e){return BPromise[_0x4fa5('0x9d')]()[_0x4fa5('0x2b')](function(){if(!_0x488ad0['query']['path']){throw new Error(_0x4fa5('0x9e'));}if(!_0x488ad0[_0x4fa5('0x3c')][_0x4fa5('0x9f')]){throw new Error(_0x4fa5('0xa0'));}var _0x7ca833=_0x488ad0[_0x4fa5('0x3c')][_0x4fa5('0xa1')]?_0x488ad0[_0x4fa5('0x3c')]['hostname']+':'+_0x488ad0['query'][_0x4fa5('0x9f')]:'http://localhost:'+_0x488ad0[_0x4fa5('0x3c')][_0x4fa5('0x9f')];var _0x26d235=_0x488ad0['query'][_0x4fa5('0x21')]?_0x488ad0['query'][_0x4fa5('0x21')]:!![];var _0x523822=_0x488ad0['query']['encoding']?_0x488ad0['query'][_0x4fa5('0xa2')]:null;var _0x5c0ef4={'method':_0x488ad0[_0x4fa5('0xa3')],'uri':util[_0x4fa5('0x5a')](_0x4fa5('0xa4'),_0x7ca833,_0x488ad0['query'][_0x4fa5('0x56')]),'json':_0x26d235,'resolveWithFullResponse':!![],'encoding':_0x523822,'qs':_0x488ad0['query']};if(_0x488ad0[_0x4fa5('0xa5')]){_0x5c0ef4[_0x4fa5('0xa5')]=_0x488ad0[_0x4fa5('0xa5')];if(_0x5c0ef4[_0x4fa5('0xa5')][_0x4fa5('0xa6')]){delete _0x5c0ef4[_0x4fa5('0xa5')][_0x4fa5('0xa6')];}}if(_0x5c0ef4['headers']['content-type']){delete _0x5c0ef4[_0x4fa5('0xa5')]['content-type'];}return rp(_0x5c0ef4);})['then'](function(_0xcd585c){if(_0xcd585c){_0x322f4e[_0x4fa5('0x26')](_0xcd585c['headers']);logger[_0x4fa5('0x6c')](_0xcd585c[_0x4fa5('0x93')]);if(_[_0x4fa5('0xa7')](_0x488ad0[_0x4fa5('0x3c')][_0x4fa5('0x56')],_0x4fa5('0x54'))&&_0xcd585c[_0x4fa5('0xa8')]==0x1f4){return _0x322f4e[_0x4fa5('0x1f')](_0xcd585c[_0x4fa5('0xa8')]);}else{return _0x322f4e[_0x4fa5('0x20')](_0xcd585c['statusCode'])[_0x4fa5('0x33')](_0xcd585c[_0x4fa5('0x93')]);}}else{return _0x322f4e[_0x4fa5('0x1f')](0xc8);}})[_0x4fa5('0x4f')](handleError(_0x322f4e,null));};exports[_0x4fa5('0xa9')]=function(_0x4b3cae,_0x579b24,_0x1e1a35){return BPromise[_0x4fa5('0x9d')]()[_0x4fa5('0x2b')](function(){if(!_0x4b3cae[_0x4fa5('0x3c')]['path']){throw new Error(_0x4fa5('0x9e'));}if(!_0x4b3cae['query']['port']){throw new Error(_0x4fa5('0xa0'));}var _0x4117df=_0x4b3cae[_0x4fa5('0x3c')][_0x4fa5('0xa1')]?_0x4b3cae[_0x4fa5('0x3c')][_0x4fa5('0xa1')]+':'+_0x4b3cae[_0x4fa5('0x3c')][_0x4fa5('0x9f')]:_0x4fa5('0xaa')+_0x4b3cae[_0x4fa5('0x3c')][_0x4fa5('0x9f')];var _0x3aedfa=_0x4b3cae[_0x4fa5('0x3c')][_0x4fa5('0x21')]?_0x4b3cae[_0x4fa5('0x3c')][_0x4fa5('0x21')]:!![];var _0x26b5d1=_0x4b3cae[_0x4fa5('0x3c')]['encoding']?_0x4b3cae[_0x4fa5('0x3c')][_0x4fa5('0xa2')]:null;var _0x57d97b={'method':_0x4b3cae[_0x4fa5('0xa3')],'uri':util[_0x4fa5('0x5a')](_0x4fa5('0xa4'),_0x4117df,_0x4b3cae[_0x4fa5('0x3c')][_0x4fa5('0x56')]),'json':_0x3aedfa,'resolveWithFullResponse':!![],'encoding':_0x26b5d1,'body':_0x4b3cae[_0x4fa5('0x93')]};if(_0x4b3cae['headers']){_0x57d97b[_0x4fa5('0xa5')]=_0x4b3cae[_0x4fa5('0xa5')];if(_0x57d97b['headers'][_0x4fa5('0xa6')]){delete _0x57d97b['headers'][_0x4fa5('0xa6')];}}if(_0x57d97b[_0x4fa5('0xa5')]['content-type']){delete _0x57d97b[_0x4fa5('0xa5')][_0x4fa5('0xab')];}return rp(_0x57d97b);})[_0x4fa5('0x2b')](function(_0x37987f){if(_0x37987f){_0x579b24[_0x4fa5('0x26')](_0x37987f['headers']);logger[_0x4fa5('0x6c')](_0x37987f[_0x4fa5('0x93')]);return _0x579b24[_0x4fa5('0x20')](_0x37987f[_0x4fa5('0xa8')])[_0x4fa5('0x33')](_0x37987f['body']);}else{return _0x579b24[_0x4fa5('0x1f')](0xc8);}})[_0x4fa5('0x4f')](handleError(_0x579b24,null));}; \ No newline at end of file +var _0x234c=['then','destroy','get','Plugins','sendStatus','stack','name','send','index','map','Plugin','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','params','join','root','server/files/plugins','format','%s.zip','zip','warning','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','node_modules/**/*','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','%s%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','extract-zip','rimraf','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','end','status','json','undefined','limit','count','offset','set','Content-Range','update'];(function(_0x15b1a1,_0x664b8f){var _0x391507=function(_0x3547d8){while(--_0x3547d8){_0x15b1a1['push'](_0x15b1a1['shift']());}};_0x391507(++_0x664b8f);}(_0x234c,0x1e1));var _0xc234=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x234c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc234('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc234('0x1'));var jsonpatch=require(_0xc234('0x2'));var rp=require(_0xc234('0x3'));var moment=require('moment');var BPromise=require(_0xc234('0x4'));var Mustache=require(_0xc234('0x5'));var util=require(_0xc234('0x6'));var path=require(_0xc234('0x7'));var sox=require(_0xc234('0x8'));var csv=require(_0xc234('0x9'));var ejs=require(_0xc234('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc234('0xb'));var squel=require(_0xc234('0xc'));var crypto=require(_0xc234('0xd'));var jsforce=require(_0xc234('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc234('0x9'));var querystring=require('querystring');var Papa=require(_0xc234('0xf'));var extract=require(_0xc234('0x10'));var rimraf=require(_0xc234('0x11'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xc234('0x12'));var qs=require(_0xc234('0x13'));var as=require(_0xc234('0x14'));var hardwareService=require(_0xc234('0x15'));var logger=require(_0xc234('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc234('0x17'));var db=require(_0xc234('0x18'))['db'];config[_0xc234('0x19')]=_[_0xc234('0x1a')](config[_0xc234('0x19')],{'host':_0xc234('0x1b'),'port':0x18eb});var socket=require(_0xc234('0x1c'))(new Redis(config['redis']));require(_0xc234('0x1d'))[_0xc234('0x1e')](socket);function respondWithStatusCode(_0xb596c7,_0x43e863){_0x43e863=_0x43e863||0xcc;return function(_0x30f883){if(_0x30f883){return _0xb596c7['sendStatus'](_0x43e863);}return _0xb596c7['status'](_0x43e863)[_0xc234('0x1f')]();};}function respondWithResult(_0x3582da,_0x43b07f){_0x43b07f=_0x43b07f||0xc8;return function(_0x44782d){if(_0x44782d){return _0x3582da[_0xc234('0x20')](_0x43b07f)[_0xc234('0x21')](_0x44782d);}};}function respondWithFilteredResult(_0x4df2f3,_0x2bf0d7){return function(_0x2a5f39){if(_0x2a5f39){var _0x255d3c=typeof _0x2bf0d7['offset']===_0xc234('0x22')&&typeof _0x2bf0d7[_0xc234('0x23')]==='undefined';var _0x5f0f4d=_0x2a5f39[_0xc234('0x24')];var _0x1a62fb=_0x255d3c?0x0:_0x2bf0d7[_0xc234('0x25')];var _0x315a24=_0x255d3c?_0x2a5f39[_0xc234('0x24')]:_0x2bf0d7[_0xc234('0x25')]+_0x2bf0d7[_0xc234('0x23')];var _0x4c0529;if(_0x315a24>=_0x5f0f4d){_0x315a24=_0x5f0f4d;_0x4c0529=0xc8;}else{_0x4c0529=0xce;}_0x4df2f3[_0xc234('0x20')](_0x4c0529);return _0x4df2f3[_0xc234('0x26')](_0xc234('0x27'),_0x1a62fb+'-'+_0x315a24+'/'+_0x5f0f4d)[_0xc234('0x21')](_0x2a5f39);}return null;};}function patchUpdates(_0x3a886c){return function(_0x1ffe16){try{jsonpatch['apply'](_0x1ffe16,_0x3a886c,!![]);}catch(_0x4ccf6f){return BPromise['reject'](_0x4ccf6f);}return _0x1ffe16['save']();};}function saveUpdates(_0x4c64cf,_0x320ffe){return function(_0x2c9116){if(_0x2c9116){return _0x2c9116[_0xc234('0x28')](_0x4c64cf)[_0xc234('0x29')](function(_0x13df8e){return _0x13df8e;});}return null;};}function removeEntity(_0x50eb9a,_0x53aead){return function(_0x298f9e){if(_0x298f9e){return _0x298f9e[_0xc234('0x2a')]()[_0xc234('0x29')](function(){var _0x167537=_0x298f9e[_0xc234('0x2b')]({'plain':!![]});var _0x44ecf3=_0xc234('0x2c');return db['UserProfileResource'][_0xc234('0x2a')]({'where':{'type':_0x44ecf3,'resourceId':_0x167537['id']}})[_0xc234('0x29')](function(){return _0x298f9e;});})[_0xc234('0x29')](function(){_0x50eb9a[_0xc234('0x20')](0xcc)[_0xc234('0x1f')]();});}};}function handleEntityNotFound(_0x1bfdbc,_0x49910e){return function(_0x30a11e){if(!_0x30a11e){_0x1bfdbc[_0xc234('0x2d')](0x194);}return _0x30a11e;};}function handleError(_0x559b39,_0xcca1ad){_0xcca1ad=_0xcca1ad||0x1f4;return function(_0x251f73){logger['error'](_0x251f73[_0xc234('0x2e')]);if(_0x251f73[_0xc234('0x2f')]){delete _0x251f73[_0xc234('0x2f')];}_0x559b39['status'](_0xcca1ad)[_0xc234('0x30')](_0x251f73);};}exports[_0xc234('0x31')]=function(_0x42ec7e,_0x1ad4b4){var _0x4b6624={},_0x4c9757={},_0x4c0671={'count':0x0,'rows':[]};var _0x4f2df2=_[_0xc234('0x32')](db[_0xc234('0x33')]['rawAttributes'],function(_0x55ebe5){return{'name':_0x55ebe5[_0xc234('0x34')],'type':_0x55ebe5[_0xc234('0x35')][_0xc234('0x36')]};});_0x4c9757[_0xc234('0x37')]=_[_0xc234('0x32')](_0x4f2df2,_0xc234('0x2f'));_0x4c9757[_0xc234('0x38')]=_[_0xc234('0x39')](_0x42ec7e[_0xc234('0x38')]);_0x4c9757[_0xc234('0x3a')]=_[_0xc234('0x3b')](_0x4c9757['model'],_0x4c9757['query']);_0x4b6624['attributes']=_[_0xc234('0x3b')](_0x4c9757[_0xc234('0x37')],qs[_0xc234('0x3c')](_0x42ec7e[_0xc234('0x38')][_0xc234('0x3c')]));_0x4b6624[_0xc234('0x3d')]=_0x4b6624[_0xc234('0x3d')][_0xc234('0x3e')]?_0x4b6624[_0xc234('0x3d')]:_0x4c9757[_0xc234('0x37')];if(!_0x42ec7e[_0xc234('0x38')][_0xc234('0x3f')](_0xc234('0x40'))){_0x4b6624[_0xc234('0x23')]=qs['limit'](_0x42ec7e['query'][_0xc234('0x23')]);_0x4b6624[_0xc234('0x25')]=qs['offset'](_0x42ec7e[_0xc234('0x38')][_0xc234('0x25')]);}_0x4b6624[_0xc234('0x41')]=qs['sort'](_0x42ec7e[_0xc234('0x38')][_0xc234('0x42')]);_0x4b6624[_0xc234('0x43')]=qs[_0xc234('0x3a')](_[_0xc234('0x44')](_0x42ec7e[_0xc234('0x38')],_0x4c9757[_0xc234('0x3a')]),_0x4f2df2);if(_0x42ec7e[_0xc234('0x38')][_0xc234('0x45')]){_0x4b6624[_0xc234('0x43')]=_[_0xc234('0x46')](_0x4b6624[_0xc234('0x43')],{'$or':_[_0xc234('0x32')](_0x4f2df2,function(_0x187055){if(_0x187055[_0xc234('0x35')]!==_0xc234('0x47')){var _0x5b4e2b={};_0x5b4e2b[_0x187055[_0xc234('0x2f')]]={'$like':'%'+_0x42ec7e['query'][_0xc234('0x45')]+'%'};return _0x5b4e2b;}})});}_0x4b6624=_[_0xc234('0x46')]({},_0x4b6624,_0x42ec7e[_0xc234('0x48')]);var _0xb50c7b={'where':_0x4b6624['where']};return db[_0xc234('0x33')][_0xc234('0x24')](_0xb50c7b)[_0xc234('0x29')](function(_0x588113){_0x4c0671[_0xc234('0x24')]=_0x588113;if(_0x42ec7e[_0xc234('0x38')][_0xc234('0x49')]){_0x4b6624[_0xc234('0x4a')]=[{'all':!![]}];}return db[_0xc234('0x33')][_0xc234('0x4b')](_0x4b6624);})[_0xc234('0x29')](function(_0x2fadf3){_0x4c0671[_0xc234('0x4c')]=_0x2fadf3;return _0x4c0671;})[_0xc234('0x29')](respondWithFilteredResult(_0x1ad4b4,_0x4b6624))[_0xc234('0x4d')](handleError(_0x1ad4b4,null));};exports[_0xc234('0x4e')]=function(_0x5489f0,_0x39bdc4){var _0x269558={'raw':!![],'where':{'id':_0x5489f0['params']['id']}},_0x4ca303={};_0x4ca303['model']=_['keys'](db['Plugin'][_0xc234('0x4f')]);_0x4ca303['query']=_[_0xc234('0x39')](_0x5489f0[_0xc234('0x38')]);_0x4ca303[_0xc234('0x3a')]=_[_0xc234('0x3b')](_0x4ca303[_0xc234('0x37')],_0x4ca303[_0xc234('0x38')]);_0x269558[_0xc234('0x3d')]=_[_0xc234('0x3b')](_0x4ca303[_0xc234('0x37')],qs[_0xc234('0x3c')](_0x5489f0[_0xc234('0x38')]['fields']));_0x269558[_0xc234('0x3d')]=_0x269558['attributes']['length']?_0x269558[_0xc234('0x3d')]:_0x4ca303['model'];if(_0x5489f0['query'][_0xc234('0x49')]){_0x269558[_0xc234('0x4a')]=[{'all':!![]}];}_0x269558=_[_0xc234('0x46')]({},_0x269558,_0x5489f0[_0xc234('0x48')]);return db['Plugin'][_0xc234('0x50')](_0x269558)['then'](handleEntityNotFound(_0x39bdc4,null))[_0xc234('0x29')](respondWithResult(_0x39bdc4,null))['catch'](handleError(_0x39bdc4,null));};exports['download']=function(_0x310277,_0x41f54c,_0x405b05){return db[_0xc234('0x33')][_0xc234('0x50')]({'where':{'id':_0x310277[_0xc234('0x51')]['id']},'attributes':[_0xc234('0x2f'),'path'],'raw':!![]})[_0xc234('0x29')](handleEntityNotFound(_0x41f54c,null))['then'](function(_0x2c0049){if(_0x2c0049){var _0x9a66=path[_0xc234('0x52')](config[_0xc234('0x53')],_0xc234('0x54'),util[_0xc234('0x55')](_0xc234('0x56'),path['basename'](_0x2c0049[_0xc234('0x7')])));var _0x3c8811=fs['createWriteStream'](_0x9a66);var _0x30d465=archiver(_0xc234('0x57'),{'zlib':{'level':0x9}});_0x30d465['on'](_0xc234('0x58'),function(_0x42953b){if(_0x42953b['code']===_0xc234('0x59')){logger[_0xc234('0x5a')](_0x42953b);}else{throw new db[(_0xc234('0x5b'))][(_0xc234('0x5c'))](_0xc234('0x5d'));}});_0x30d465['on'](_0xc234('0x5a'),function(_0x1d1959){throw new db[(_0xc234('0x5b'))][(_0xc234('0x5c'))](_0xc234('0x5d'));});_0x30d465['pipe'](_0x3c8811);_0x30d465[_0xc234('0x5e')](_0xc234('0x5f'),{'cwd':path['join'](config['root'],_0xc234('0x54'),path['dirname'](_0x2c0049[_0xc234('0x7')])),'ignore':[path[_0xc234('0x52')](path['basename'](_0x2c0049['path']),_0xc234('0x60')),path['join'](path[_0xc234('0x61')](_0x2c0049[_0xc234('0x7')]),_0xc234('0x62'))],'nodir':!![]})[_0xc234('0x63')]();_0x3c8811['on'](_0xc234('0x64'),function(){if(!fs[_0xc234('0x65')](_0x9a66)){throw new db[(_0xc234('0x5b'))][(_0xc234('0x5c'))](_0xc234('0x66'));}return _0x41f54c[_0xc234('0x67')](_0x9a66,util[_0xc234('0x55')](_0xc234('0x56'),path[_0xc234('0x61')](_0x2c0049[_0xc234('0x7')])),function(_0xc4e484){if(_0xc4e484){throw new db[(_0xc234('0x5b'))][(_0xc234('0x5c'))](_0xc234('0x68'));}fs[_0xc234('0x69')](_0x9a66);logger[_0xc234('0x6a')](_0xc234('0x6b'));logger['info'](_0xc234('0x6c'));});});}return null;})[_0xc234('0x4d')](handleError(_0x41f54c,null));};exports[_0xc234('0x6d')]=function(_0x1b35be,_0x4ddf46,_0x14605c){var _0x51b9fa=path[_0xc234('0x61')](_0x1b35be[_0xc234('0x6e')][_0xc234('0x6f')],path[_0xc234('0x70')](_0x1b35be[_0xc234('0x6e')][_0xc234('0x6f')]));var _0x3a2f48=path[_0xc234('0x52')](config[_0xc234('0x53')],_0xc234('0x54'),_0x1b35be[_0xc234('0x6e')][_0xc234('0x6f')]);var _0x24097b=path[_0xc234('0x52')](config['root'],_0xc234('0x54'),_0x51b9fa);logger['info'](_0xc234('0x71'),_0x3a2f48);logger[_0xc234('0x6a')](_0xc234('0x72'),_0x24097b);try{fs[_0xc234('0x73')](_0x3a2f48,parseInt(_0xc234('0x74'),0x8));extract(_0x3a2f48,{'dir':_0x24097b},function(_0x3922d8){if(_0x3922d8){logger[_0xc234('0x5a')](_0x3922d8);handleError(_0x3922d8,!![]);};var _0x133f9b=fs['readdirSync'](_0x24097b);if(_0x133f9b[_0xc234('0x3e')]>0x1){removeReferences(_0x3a2f48,_0x24097b);logger['error'](_0xc234('0x75'));return _0x14605c(new Error(_0xc234('0x75')));}var _0x5daa7b=fs['lstatSync'](path[_0xc234('0x52')](_0x24097b,_0x133f9b[0x0]));if(_0x5daa7b[_0xc234('0x76')]()){removeReferences(_0x3a2f48,_0x24097b);logger[_0xc234('0x5a')]('Invalid\x20plugin\x20structure');return _0x14605c(new Error(_0xc234('0x75')));}if(_0x5daa7b[_0xc234('0x77')]()){var _0x238052=fs['readdirSync'](path[_0xc234('0x52')](_0x24097b,_0x133f9b[0x0]));if(_0x238052[_0xc234('0x3e')]===0x0){removeReferences(_0x3a2f48,_0x24097b);logger[_0xc234('0x5a')](_0xc234('0x75'));return _0x14605c(new Error(_0xc234('0x75')));}var _0x435052=_0x238052[_0xc234('0x78')](function(_0xe7a4d9){return _0xe7a4d9==='manifest.json';});if(!_0x435052){return _0x14605c(new Error(_0xc234('0x79')));}var _0x29bbf5=fs[_0xc234('0x7a')](path[_0xc234('0x52')](_0x24097b,_0x133f9b[0x0],_0xc234('0x7b')));var _0x37eeb0=JSON['parse'](_0x29bbf5);if(_0xc234('0x22')==typeof _0x37eeb0['name']){return _0x14605c(new Error(_0xc234('0x7c')));}if(_0xc234('0x22')==typeof _0x37eeb0['type']){return _0x14605c(new Error(_0xc234('0x7d')));}if(_0xc234('0x22')==typeof _0x37eeb0[_0xc234('0x7e')]){return _0x14605c(new Error(_0xc234('0x7f')));}if(_0xc234('0x22')==typeof _0x37eeb0['parameters']){return _0x14605c(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x37eeb0[_0xc234('0x35')]===_0xc234('0x80')){if('undefined'==typeof _0x37eeb0[_0xc234('0x81')]['views']){return _0x14605c(new Error(_0xc234('0x82')));}if(_0xc234('0x22')==typeof _0x37eeb0['parameters'][_0xc234('0x83')]['admin']&&_0xc234('0x22')==typeof _0x37eeb0[_0xc234('0x81')][_0xc234('0x83')][_0xc234('0x84')]){return _0x14605c(new Error(_0xc234('0x85')));}}else if(_0x37eeb0['type']===_0xc234('0x86')){if(_0xc234('0x22')==typeof _0x37eeb0['parameters'][_0xc234('0x87')]){return _0x14605c(new Error(_0xc234('0x88')));}if('undefined'==typeof _0x37eeb0[_0xc234('0x81')][_0xc234('0x89')]){return _0x14605c(new Error(_0xc234('0x8a')));}}else{return _0x14605c(new Error(_0xc234('0x8b')));}var _0x5e4449=_0x37eeb0[_0xc234('0x2f')];var _0x5bd1f5=_0x37eeb0[_0xc234('0x8c')];var _0x1da048=_0x37eeb0[_0xc234('0x35')];var _0x194773=_0x37eeb0[_0xc234('0x8d')]?_0x37eeb0[_0xc234('0x8d')]:'always';var _0x58472c=_0x37eeb0[_0xc234('0x8e')]?_0x37eeb0[_0xc234('0x8e')]:_0xc234('0x8f');var _0x469b8c='';var _0x5b3098='';var _0x41ebff='';var _0x127e2c='';var _0x2b716e=_0x37eeb0[_0xc234('0x7e')];if(_0x1da048===_0xc234('0x80')){if(_0xc234('0x22')!=typeof _0x37eeb0[_0xc234('0x81')][_0xc234('0x83')][_0xc234('0x90')]){var _0x86a52e=_0x37eeb0[_0xc234('0x81')][_0xc234('0x83')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xc234('0x91')](_0x86a52e)){_0x469b8c=path['join']('plugins',_0x51b9fa,_0x133f9b[0x0],_0x86a52e);}else{_0x469b8c=_0x86a52e;}}else{logger[_0xc234('0x6a')](_0xc234('0x92'));}if(_0xc234('0x22')!=typeof _0x37eeb0[_0xc234('0x81')][_0xc234('0x83')][_0xc234('0x84')]){var _0x46427f=_0x37eeb0[_0xc234('0x81')][_0xc234('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xc234('0x91')](_0x46427f)){_0x5b3098=path[_0xc234('0x52')](_0xc234('0x93'),_0x51b9fa,_0x133f9b[0x0],_0x46427f);}else{_0x5b3098=_0x46427f;}}else{logger[_0xc234('0x6a')](_0xc234('0x94'));}}else if(_0x1da048===_0xc234('0x86')){_0x41ebff=_0x37eeb0['parameters'][_0xc234('0x87')];_0x127e2c=_0x37eeb0[_0xc234('0x81')][_0xc234('0x89')];if('undefined'!=typeof _0x37eeb0[_0xc234('0x81')]['views']){if(_0xc234('0x22')!=typeof _0x37eeb0[_0xc234('0x81')]['views'][_0xc234('0x90')]){var _0x86a52e=_0x37eeb0[_0xc234('0x81')][_0xc234('0x83')][_0xc234('0x90')];if(!/^(f|ht)tps?:\/\//i[_0xc234('0x91')](_0x86a52e)){_0x469b8c=path[_0xc234('0x52')](_0xc234('0x93'),_0x51b9fa,_0x133f9b[0x0],_0x86a52e);}else{_0x469b8c=_0x86a52e;}}if(_0xc234('0x22')!=typeof _0x37eeb0[_0xc234('0x81')][_0xc234('0x83')][_0xc234('0x84')]){var _0x46427f=_0x37eeb0['parameters'][_0xc234('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xc234('0x91')](_0x46427f)){_0x5b3098=path[_0xc234('0x52')]('plugins',_0x51b9fa,_0x133f9b[0x0],_0x46427f);}else{_0x5b3098=_0x46427f;}}}}var _0x20894a={'name':_0x5e4449,'description':_0x5bd1f5,'path':path[_0xc234('0x52')](_0x51b9fa,_0x133f9b[0x0]),'type':_0x1da048,'sidebar':_0x194773,'icon':_0x58472c,'adminUrl':_0x469b8c,'agentUrl':_0x5b3098,'scriptName':_0x41ebff,'scriptPath':_0x127e2c,'version':_0x2b716e};removeReferences(_0x3a2f48,null);return db[_0xc234('0x33')][_0xc234('0x95')](_0x20894a)[_0xc234('0x29')](function(_0x36fba9){var _0x539f08={'role':_0x1b35be[_0xc234('0x96')]['role'],'userProfileId':_0x1b35be['body']['userProfileId']};if(!_0x539f08)throw new Error(_0xc234('0x97'));if(_0x539f08['role']===_0xc234('0x98')){var _0x5e8725=_0x36fba9[_0xc234('0x2b')]({'plain':!![]});return db[_0xc234('0x99')]['find']({'where':{'name':_0xc234('0x2c'),'userProfileId':_0x539f08[_0xc234('0x9a')]},'raw':!![]})[_0xc234('0x29')](function(_0x3515cf){if(_0x3515cf&&_0x3515cf['autoAssociation']===0x0){return db['UserProfileResource'][_0xc234('0x95')]({'name':_0x5e8725[_0xc234('0x2f')],'resourceId':_0x5e8725['id'],'type':_0x3515cf[_0xc234('0x2f')],'sectionId':_0x3515cf['id']},{})[_0xc234('0x29')](function(){return _0x36fba9;});}else{return _0x36fba9;}})[_0xc234('0x4d')](function(_0x54fe93){logger['error'](_0xc234('0x9b'),_0x54fe93);throw _0x54fe93;});}return _0x36fba9;})[_0xc234('0x29')](respondWithResult(_0x4ddf46,null))[_0xc234('0x4d')](handleError(_0x4ddf46,null));}});}catch(_0x5ab97b){_0x4ddf46[_0xc234('0x20')](0x1f4)['send'](_0x5ab97b);}};function removeReferences(_0x1330f5,_0x4cc698){try{if(_0x1330f5){fs[_0xc234('0x69')](_0x1330f5);logger[_0xc234('0x6a')](_0xc234('0x9c'));}if(_0x4cc698){rimraf(_0x4cc698,function(){});logger[_0xc234('0x6a')](_0xc234('0x9d'));}}catch(_0x45f1f1){logger[_0xc234('0x5a')](_0x45f1f1);}}exports['update']=function(_0x47cd26,_0x2a7566,_0x397bc4){return db['Plugin'][_0xc234('0x50')]({'where':{'id':_0x47cd26[_0xc234('0x51')]['id']}})[_0xc234('0x29')](handleEntityNotFound(_0x2a7566,null))[_0xc234('0x29')](saveUpdates(_0x47cd26[_0xc234('0x96')],null))[_0xc234('0x29')](respondWithResult(_0x2a7566,null))[_0xc234('0x4d')](handleError(_0x2a7566,null));};exports['delete']=function(_0xa7074b,_0x415fd0,_0x13ba1f){return db[_0xc234('0x33')][_0xc234('0x50')]({'where':{'id':_0xa7074b[_0xc234('0x51')]['id']}})[_0xc234('0x29')](function(_0x47eec5){if(_0x47eec5){return _0x47eec5[_0xc234('0x2a')]();}})[_0xc234('0x29')](function(_0x39d8f4){rimraf(path[_0xc234('0x52')](config[_0xc234('0x53')],'server/files/plugins',path['dirname'](_0x39d8f4[_0xc234('0x7')])),function(){});return _0x39d8f4;})[_0xc234('0x29')](handleEntityNotFound(_0x415fd0,null))[_0xc234('0x29')](respondWithStatusCode(_0x415fd0,null))['catch'](handleError(_0x415fd0,null));};exports[_0xc234('0x9e')]=function(_0x2c7116,_0x57f22f,_0x14ef6c){return BPromise['resolve']()[_0xc234('0x29')](function(){if(!_0x2c7116[_0xc234('0x38')]['path']){throw new Error(_0xc234('0x9f'));}if(!_0x2c7116[_0xc234('0x38')][_0xc234('0xa0')]){throw new Error(_0xc234('0xa1'));}var _0x13714c=_0x2c7116[_0xc234('0x38')]['hostname']?_0x2c7116[_0xc234('0x38')][_0xc234('0xa2')]+':'+_0x2c7116['query'][_0xc234('0xa0')]:_0xc234('0xa3')+_0x2c7116[_0xc234('0x38')]['port'];var _0x42c90b=_0x2c7116['query'][_0xc234('0x21')]?_0x2c7116[_0xc234('0x38')][_0xc234('0x21')]:!![];var _0x132f04=_0x2c7116['query'][_0xc234('0xa4')]?_0x2c7116[_0xc234('0x38')]['encoding']:null;var _0x5757a5={'method':_0x2c7116[_0xc234('0xa5')],'uri':util['format']('%s%s',_0x13714c,_0x2c7116['query'][_0xc234('0x7')]),'json':_0x42c90b,'resolveWithFullResponse':!![],'encoding':_0x132f04,'qs':_0x2c7116['query']};if(_0x2c7116['headers']){_0x5757a5[_0xc234('0xa6')]=_0x2c7116['headers'];if(_0x5757a5[_0xc234('0xa6')]['content-length']){delete _0x5757a5[_0xc234('0xa6')][_0xc234('0xa7')];}}if(_0x5757a5['headers'][_0xc234('0xa8')]){delete _0x5757a5[_0xc234('0xa6')][_0xc234('0xa8')];}return rp(_0x5757a5);})['then'](function(_0x17a188){if(_0x17a188){_0x57f22f[_0xc234('0x26')](_0x17a188[_0xc234('0xa6')]);logger[_0xc234('0x6a')](_0x17a188[_0xc234('0x96')]);if(_[_0xc234('0xa9')](_0x2c7116[_0xc234('0x38')][_0xc234('0x7')],_0xc234('0x67'))&&_0x17a188['statusCode']==0x1f4){return _0x57f22f[_0xc234('0x2d')](_0x17a188[_0xc234('0xaa')]);}else{return _0x57f22f['status'](_0x17a188['statusCode'])['send'](_0x17a188['body']);}}else{return _0x57f22f['sendStatus'](0xc8);}})[_0xc234('0x4d')](handleError(_0x57f22f,null));};exports[_0xc234('0xab')]=function(_0x228342,_0x435534,_0x21b1cb){return BPromise[_0xc234('0xac')]()['then'](function(){if(!_0x228342['query'][_0xc234('0x7')]){throw new Error(_0xc234('0x9f'));}if(!_0x228342[_0xc234('0x38')]['port']){throw new Error(_0xc234('0xa1'));}var _0x165df1=_0x228342[_0xc234('0x38')][_0xc234('0xa2')]?_0x228342[_0xc234('0x38')]['hostname']+':'+_0x228342[_0xc234('0x38')][_0xc234('0xa0')]:_0xc234('0xa3')+_0x228342['query'][_0xc234('0xa0')];var _0x2b5728=_0x228342[_0xc234('0x38')][_0xc234('0x21')]?_0x228342[_0xc234('0x38')][_0xc234('0x21')]:!![];var _0x279f47=_0x228342[_0xc234('0x38')]['encoding']?_0x228342[_0xc234('0x38')][_0xc234('0xa4')]:null;var _0x4a3e8d={'method':_0x228342['method'],'uri':util[_0xc234('0x55')](_0xc234('0xad'),_0x165df1,_0x228342[_0xc234('0x38')][_0xc234('0x7')]),'json':_0x2b5728,'resolveWithFullResponse':!![],'encoding':_0x279f47,'body':_0x228342[_0xc234('0x96')]};if(_0x228342[_0xc234('0xa6')]){_0x4a3e8d[_0xc234('0xa6')]=_0x228342[_0xc234('0xa6')];if(_0x4a3e8d[_0xc234('0xa6')][_0xc234('0xa7')]){delete _0x4a3e8d[_0xc234('0xa6')][_0xc234('0xa7')];}}if(_0x4a3e8d[_0xc234('0xa6')][_0xc234('0xa8')]){delete _0x4a3e8d[_0xc234('0xa6')][_0xc234('0xa8')];}return rp(_0x4a3e8d);})[_0xc234('0x29')](function(_0x42f1ed){if(_0x42f1ed){_0x435534[_0xc234('0x26')](_0x42f1ed[_0xc234('0xa6')]);logger[_0xc234('0x6a')](_0x42f1ed[_0xc234('0x96')]);return _0x435534['status'](_0x42f1ed[_0xc234('0xaa')])[_0xc234('0x30')](_0x42f1ed['body']);}else{return _0x435534['sendStatus'](0xc8);}})[_0xc234('0x4d')](handleError(_0x435534,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 8809c74..1912aff 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 _0xfd87=['Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x425fb9,_0x53b90b){var _0x46b88d=function(_0x47aada){while(--_0x47aada){_0x425fb9['push'](_0x425fb9['shift']());}};_0x46b88d(++_0x53b90b);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x7fd8('0x0'));var Plugin=require(_0x7fd8('0x1'))['db'][_0x7fd8('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x7fd8('0x3')](0x0);var events={'afterCreate':_0x7fd8('0x4'),'afterUpdate':_0x7fd8('0x5'),'afterDestroy':_0x7fd8('0x6')};function emitEvent(_0x42b06c){return function(_0x4429f2,_0x43b442,_0x3bd037){PluginEvents['emit'](_0x42b06c+':'+_0x4429f2['id'],_0x4429f2);PluginEvents[_0x7fd8('0x7')](_0x42b06c,_0x4429f2);_0x3bd037(null);};}for(var e in events){if(events[_0x7fd8('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x7fd8('0x9')]=PluginEvents; \ No newline at end of file +var _0xed20=['../../mysqldb','Plugin','save','update','remove','emit','hook','exports','events'];(function(_0x2e9ded,_0x235e2b){var _0xc88a61=function(_0x1baa4b){while(--_0x1baa4b){_0x2e9ded['push'](_0x2e9ded['shift']());}};_0xc88a61(++_0x235e2b);}(_0xed20,0xce));var _0x0ed2=function(_0xe55d53,_0x4f4313){_0xe55d53=_0xe55d53-0x0;var _0x3e62f5=_0xed20[_0xe55d53];return _0x3e62f5;};'use strict';var EventEmitter=require(_0x0ed2('0x0'));var Plugin=require(_0x0ed2('0x1'))['db'][_0x0ed2('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0ed2('0x3'),'afterUpdate':_0x0ed2('0x4'),'afterDestroy':_0x0ed2('0x5')};function emitEvent(_0x2a6405){return function(_0x395e2d,_0x20cac9,_0x5693ea){PluginEvents[_0x0ed2('0x6')](_0x2a6405+':'+_0x395e2d['id'],_0x395e2d);PluginEvents[_0x0ed2('0x6')](_0x2a6405,_0x395e2d);_0x5693ea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x0ed2('0x7')](e,emitEvent(event));}}module[_0x0ed2('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 4996135..f4177ca 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 _0x54a9=['rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x34ace1,_0x2a472d){var _0x2d8c70=function(_0x11dcf6){while(--_0x11dcf6){_0x34ace1['push'](_0x34ace1['shift']());}};_0x2d8c70(++_0x2a472d);}(_0x54a9,0x186));var _0x954a=function(_0x338371,_0x363bdd){_0x338371=_0x338371-0x0;var _0x23fade=_0x54a9[_0x338371];return _0x23fade;};'use strict';var _=require(_0x954a('0x0'));var util=require('util');var logger=require(_0x954a('0x1'))('api');var moment=require(_0x954a('0x2'));var BPromise=require(_0x954a('0x3'));var rp=require(_0x954a('0x4'));var fs=require('fs');var path=require(_0x954a('0x5'));var rimraf=require(_0x954a('0x6'));var config=require(_0x954a('0x7'));var attributes=require(_0x954a('0x8'));module['exports']=function(_0x2066b6,_0x5634fc){return _0x2066b6[_0x954a('0x9')](_0x954a('0xa'),attributes,{'tableName':_0x954a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ead=['plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','Plugin'];(function(_0x3bea39,_0x50c5d3){var _0x20535e=function(_0x6fd0e7){while(--_0x6fd0e7){_0x3bea39['push'](_0x3bea39['shift']());}};_0x20535e(++_0x50c5d3);}(_0x8ead,0xc4));var _0xd8ea=function(_0x2e82c2,_0x3ca803){_0x2e82c2=_0x2e82c2-0x0;var _0x9af733=_0x8ead[_0x2e82c2];return _0x9af733;};'use strict';var _=require(_0xd8ea('0x0'));var util=require(_0xd8ea('0x1'));var logger=require(_0xd8ea('0x2'))(_0xd8ea('0x3'));var moment=require(_0xd8ea('0x4'));var BPromise=require(_0xd8ea('0x5'));var rp=require(_0xd8ea('0x6'));var fs=require('fs');var path=require(_0xd8ea('0x7'));var rimraf=require(_0xd8ea('0x8'));var config=require(_0xd8ea('0x9'));var attributes=require(_0xd8ea('0xa'));module['exports']=function(_0x29d31b,_0x2f7e0b){return _0x29d31b['define'](_0xd8ea('0xb'),attributes,{'tableName':_0xd8ea('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 7369e53..c07cad5 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 _0x8dab=['options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','./plugin.socket','register','request','then','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Plugin,\x20%s,\x20%s','message','info','result','catch','CreatePlugin','Plugin','create','body'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8dab,0x1ec));var _0xb8da=function(_0x2fe9d3,_0x2fcde6){_0x2fe9d3=_0x2fe9d3-0x0;var _0x16f31b=_0x8dab[_0x2fe9d3];return _0x16f31b;};'use strict';var _=require(_0xb8da('0x0'));var util=require(_0xb8da('0x1'));var moment=require(_0xb8da('0x2'));var BPromise=require(_0xb8da('0x3'));var rs=require(_0xb8da('0x4'));var fs=require('fs');var Redis=require(_0xb8da('0x5'));var db=require(_0xb8da('0x6'))['db'];var utils=require(_0xb8da('0x7'));var logger=require(_0xb8da('0x8'))(_0xb8da('0x9'));var config=require(_0xb8da('0xa'));var jayson=require(_0xb8da('0xb'));var client=jayson[_0xb8da('0xc')][_0xb8da('0xd')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xb8da('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb8da('0xf'))[_0xb8da('0x10')](socket);function respondWithRpcPromise(_0x49315a,_0x4ce09a,_0x376887){return new BPromise(function(_0x49754e,_0x440f9d){return client[_0xb8da('0x11')](_0x49315a,_0x376887)[_0xb8da('0x12')](function(_0x3ffd5f){logger['info']('Plugin,\x20%s,\x20%s',_0x4ce09a,'request\x20sent');logger[_0xb8da('0x13')](_0xb8da('0x14'),_0x4ce09a,_0xb8da('0x15'),JSON[_0xb8da('0x16')](_0x3ffd5f));if(_0x3ffd5f['error']){if(_0x3ffd5f[_0xb8da('0x17')]['code']===0x1f4){logger['error'](_0xb8da('0x18'),_0x4ce09a,_0x3ffd5f['error'][_0xb8da('0x19')]);return _0x440f9d(_0x3ffd5f['error'][_0xb8da('0x19')]);}logger[_0xb8da('0x17')](_0xb8da('0x18'),_0x4ce09a,_0x3ffd5f[_0xb8da('0x17')]['message']);return _0x49754e(_0x3ffd5f[_0xb8da('0x17')][_0xb8da('0x19')]);}else{logger[_0xb8da('0x1a')](_0xb8da('0x18'),_0x4ce09a,'request\x20sent');_0x49754e(_0x3ffd5f[_0xb8da('0x1b')][_0xb8da('0x19')]);}})[_0xb8da('0x1c')](function(_0x2a86eb){logger[_0xb8da('0x17')](_0xb8da('0x18'),_0x4ce09a,_0x2a86eb);_0x440f9d(_0x2a86eb);});});}exports[_0xb8da('0x1d')]=function(_0xdc3925){var _0x29a73a=this;return new Promise(function(_0x173a6b,_0x54c95e){return db[_0xb8da('0x1e')][_0xb8da('0x1f')](_0xdc3925[_0xb8da('0x20')],{'raw':_0xdc3925[_0xb8da('0x21')]?_0xdc3925[_0xb8da('0x21')][_0xb8da('0x22')]===undefined?!![]:![]:!![]})[_0xb8da('0x12')](function(_0x57b88a){logger['info'](_0xb8da('0x1d'),_0xdc3925);logger['debug'](_0xb8da('0x1d'),_0xdc3925,JSON[_0xb8da('0x16')](_0x57b88a));_0x173a6b(_0x57b88a);})[_0xb8da('0x1c')](function(_0x29ab2a){logger[_0xb8da('0x17')](_0xb8da('0x1d'),_0x29ab2a[_0xb8da('0x19')],_0xdc3925);_0x54c95e(_0x29a73a[_0xb8da('0x17')](0x1f4,_0x29ab2a['message']));});});}; \ No newline at end of file +var _0xd775=['info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','CreatePlugin','Plugin','create','body','options','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x1d292b,_0x514402){var _0x4c492e=function(_0x3af064){while(--_0x3af064){_0x1d292b['push'](_0x1d292b['shift']());}};_0x4c492e(++_0x514402);}(_0xd775,0xa2));var _0x5d77=function(_0x4a89f9,_0x49d3ba){_0x4a89f9=_0x4a89f9-0x0;var _0x19556c=_0xd775[_0x4a89f9];return _0x19556c;};'use strict';var _=require(_0x5d77('0x0'));var util=require('util');var moment=require(_0x5d77('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d77('0x2'));var fs=require('fs');var Redis=require(_0x5d77('0x3'));var db=require(_0x5d77('0x4'))['db'];var utils=require(_0x5d77('0x5'));var logger=require(_0x5d77('0x6'))(_0x5d77('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d77('0x8'));var client=jayson[_0x5d77('0x9')][_0x5d77('0xa')]({'port':0x232a});config['redis']=_[_0x5d77('0xb')](config[_0x5d77('0xc')],{'host':_0x5d77('0xd'),'port':0x18eb});var socket=require(_0x5d77('0xe'))(new Redis(config[_0x5d77('0xc')]));require('./plugin.socket')[_0x5d77('0xf')](socket);function respondWithRpcPromise(_0x519f0e,_0x352acc,_0x50057d){return new BPromise(function(_0x4fe26f,_0x1bd356){return client[_0x5d77('0x10')](_0x519f0e,_0x50057d)[_0x5d77('0x11')](function(_0xe9787c){logger[_0x5d77('0x12')](_0x5d77('0x13'),_0x352acc,_0x5d77('0x14'));logger[_0x5d77('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x352acc,_0x5d77('0x14'),JSON[_0x5d77('0x16')](_0xe9787c));if(_0xe9787c[_0x5d77('0x17')]){if(_0xe9787c[_0x5d77('0x17')]['code']===0x1f4){logger[_0x5d77('0x17')](_0x5d77('0x13'),_0x352acc,_0xe9787c[_0x5d77('0x17')][_0x5d77('0x18')]);return _0x1bd356(_0xe9787c[_0x5d77('0x17')]['message']);}logger[_0x5d77('0x17')]('Plugin,\x20%s,\x20%s',_0x352acc,_0xe9787c[_0x5d77('0x17')][_0x5d77('0x18')]);return _0x4fe26f(_0xe9787c['error'][_0x5d77('0x18')]);}else{logger[_0x5d77('0x12')](_0x5d77('0x13'),_0x352acc,'request\x20sent');_0x4fe26f(_0xe9787c['result']['message']);}})['catch'](function(_0x3aebba){logger[_0x5d77('0x17')]('Plugin,\x20%s,\x20%s',_0x352acc,_0x3aebba);_0x1bd356(_0x3aebba);});});}exports[_0x5d77('0x19')]=function(_0x2ed828){var _0x5a9b1f=this;return new Promise(function(_0x4b0369,_0x5bcdd3){return db[_0x5d77('0x1a')][_0x5d77('0x1b')](_0x2ed828[_0x5d77('0x1c')],{'raw':_0x2ed828[_0x5d77('0x1d')]?_0x2ed828[_0x5d77('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x5d77('0x11')](function(_0x2a8271){logger[_0x5d77('0x12')](_0x5d77('0x19'),_0x2ed828);logger[_0x5d77('0x15')](_0x5d77('0x19'),_0x2ed828,JSON[_0x5d77('0x16')](_0x2a8271));_0x4b0369(_0x2a8271);})['catch'](function(_0x5a4478){logger[_0x5d77('0x17')](_0x5d77('0x19'),_0x5a4478[_0x5d77('0x18')],_0x2ed828);_0x5bcdd3(_0x5a9b1f[_0x5d77('0x17')](0x1f4,_0x5a4478[_0x5d77('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 658d96c..9439ce6 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 _0xcd14=['save','emit','removeListener','register','length','plugin:','./plugin.events'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xcd14,0xd8));var _0x4cd1=function(_0x4bc94b,_0x203e7d){_0x4bc94b=_0x4bc94b-0x0;var _0x5cedc4=_0xcd14[_0x4bc94b];return _0x5cedc4;};'use strict';var PluginEvents=require(_0x4cd1('0x0'));var events=[_0x4cd1('0x1'),'remove','update'];function createListener(_0xa1292d,_0xeca061){return function(_0x2384fe){_0xeca061[_0x4cd1('0x2')](_0xa1292d,_0x2384fe);};}function removeListener(_0x2d8e8c,_0x19b41c){return function(){PluginEvents[_0x4cd1('0x3')](_0x2d8e8c,_0x19b41c);};}exports[_0x4cd1('0x4')]=function(_0x2b2bf6){for(var _0x3150e2=0x0,_0x571e46=events[_0x4cd1('0x5')];_0x3150e2<_0x571e46;_0x3150e2++){var _0x53aba7=events[_0x3150e2];var _0x3d95d7=createListener(_0x4cd1('0x6')+_0x53aba7,_0x2b2bf6);PluginEvents['on'](_0x53aba7,_0x3d95d7);}}; \ No newline at end of file +var _0xed4a=['save','update','emit','removeListener','register','length','./plugin.events'];(function(_0x3af767,_0x120b51){var _0x3d269b=function(_0x507550){while(--_0x507550){_0x3af767['push'](_0x3af767['shift']());}};_0x3d269b(++_0x120b51);}(_0xed4a,0x14f));var _0xaed4=function(_0x19fb4e,_0x272daa){_0x19fb4e=_0x19fb4e-0x0;var _0x596d79=_0xed4a[_0x19fb4e];return _0x596d79;};'use strict';var PluginEvents=require(_0xaed4('0x0'));var events=[_0xaed4('0x1'),'remove',_0xaed4('0x2')];function createListener(_0x42731e,_0x3f6727){return function(_0x1ee4ed){_0x3f6727[_0xaed4('0x3')](_0x42731e,_0x1ee4ed);};}function removeListener(_0xa3742c,_0x161b21){return function(){PluginEvents[_0xaed4('0x4')](_0xa3742c,_0x161b21);};}exports[_0xaed4('0x5')]=function(_0x9bd725){for(var _0x254823=0x0,_0x31efcd=events[_0xaed4('0x6')];_0x254823<_0x31efcd;_0x254823++){var _0x323ab1=events[_0x254823];var _0x36b602=createListener('plugin:'+_0x323ab1,_0x9bd725);PluginEvents['on'](_0x323ab1,_0x36b602);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 969e81c..8c496d0 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(_0x3cb22b,_0x339778){var _0x377ea4=function(_0x38f824){while(--_0x38f824){_0x3cb22b['push'](_0x3cb22b['shift']());}};_0x377ea4(++_0x339778);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0xd308f,_0x3d0a33){var _0x24595c=function(_0x3e51b9){while(--_0x3e51b9){_0xd308f['push'](_0xd308f['shift']());}};_0x24595c(++_0x3d0a33);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 b8698e8..fe14af5 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 _0x9aea=['join','../../files/plugins','start','dump','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','path','child_process','bluebird','sendStatus','status','error','stack','name','send','info','index','list','then','express','motion2','length','catch','show','params','create','body','script'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x9aea,0xdd));var _0xa9ae=function(_0x1ad3b2,_0x1bc73d){_0x1ad3b2=_0x1ad3b2-0x0;var _0xc28fbd=_0x9aea[_0x1ad3b2];return _0xc28fbd;};'use strict';var _=require(_0xa9ae('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xa9ae('0x1'))('api');var path=require(_0xa9ae('0x2'));var exec=require(_0xa9ae('0x3'))['exec'];var BPromise=require(_0xa9ae('0x4'));function handleEntityNotFound(_0x115593,_0x41fb71){return function(_0x10f91d){if(!_0x10f91d){_0x115593[_0xa9ae('0x5')](0x194);;}return _0x10f91d;};}function respondWithResult(_0x56f942,_0x1aa3b9){_0x1aa3b9=_0x1aa3b9||0xc8;return function(_0x22734b){if(_0x22734b){return _0x56f942[_0xa9ae('0x6')](_0x1aa3b9)['json'](_0x22734b);}return null;};}function handleError(_0x1f2e4b,_0x3917f0){_0x3917f0=_0x3917f0||0x1f4;return function(_0x465bd2){logger[_0xa9ae('0x7')](_0x465bd2[_0xa9ae('0x8')]);if(_0x465bd2[_0xa9ae('0x9')]){delete _0x465bd2[_0xa9ae('0x9')];}_0x1f2e4b[_0xa9ae('0x6')](_0x3917f0)[_0xa9ae('0xa')](_0x465bd2);};}function execChildProcess(){return new BPromise(function(_0x5a8178,_0x3d400c){exec('npm\x20install',function(_0x2addd2,_0x226cf7,_0x112ab5){logger[_0xa9ae('0xb')](_0x226cf7);logger[_0xa9ae('0xb')](_0x112ab5);if(_0x2addd2){logger[_0xa9ae('0x7')](_0x2addd2);return _0x3d400c(_0x2addd2);}return _0x5a8178(_0x226cf7);});});}exports[_0xa9ae('0xc')]=function(_0x2b511a,_0x56de45){return pm2[_0xa9ae('0xd')]()[_0xa9ae('0xe')](function(_0x10882e){if(_0x10882e){var _0x3f7f61=_['reject'](_0x10882e,function(_0x28ce2d){return _0x28ce2d[_0xa9ae('0x9')]===_0xa9ae('0xf')||_0x28ce2d[_0xa9ae('0x9')]===_0xa9ae('0x10');});return{'rows':_0x3f7f61,'count':_0x3f7f61[_0xa9ae('0x11')]};}return null;})['then'](respondWithResult(_0x56de45,null))[_0xa9ae('0x12')](handleError(_0x56de45,null));};exports[_0xa9ae('0x13')]=function(_0x3e31d9,_0x4ac5a6){return pm2['describe'](_0x3e31d9[_0xa9ae('0x14')]['id'])['then'](respondWithResult(_0x4ac5a6,null))['then'](handleEntityNotFound(_0x4ac5a6,null))[_0xa9ae('0x12')](handleError(_0x4ac5a6,null));};exports[_0xa9ae('0x15')]=function(_0xbfd2ff,_0x42f961){if(_0xbfd2ff['body'][_0xa9ae('0x9')]&&_0xbfd2ff[_0xa9ae('0x16')][_0xa9ae('0x17')]){var _0x688153=path[_0xa9ae('0x18')](__dirname,_0xa9ae('0x19'),_0xbfd2ff[_0xa9ae('0x16')]['script']);var _0xc021cf=process['cwd']();process['chdir'](path['dirname'](_0x688153));return execChildProcess()['then'](function(_0x1afd07){process['chdir'](_0xc021cf);return pm2[_0xa9ae('0x1a')]({'name':_0xbfd2ff['body'][_0xa9ae('0x9')],'script':_0x688153});})[_0xa9ae('0xe')](function(_0x93d637){pm2[_0xa9ae('0x1b')]();return _0x93d637[0x0];})[_0xa9ae('0xe')](respondWithResult(_0x42f961,0xc9))[_0xa9ae('0x12')](handleError(_0x42f961,null));}else{return _0x42f961[_0xa9ae('0x6')](0x1f4)['send']({'message':_0xa9ae('0x1c')});}};exports[_0xa9ae('0x1d')]=function(_0x2aac9e,_0xfe9ef1){if(_0x2aac9e[_0xa9ae('0x16')]['id']){delete _0x2aac9e[_0xa9ae('0x16')]['id'];}var _0xb12fa8={'online':'restart','stopped':'stop'};if(_0xb12fa8[_0xa9ae('0x1e')](_0x2aac9e[_0xa9ae('0x16')][_0xa9ae('0x6')])){return pm2[_0xb12fa8[_0x2aac9e[_0xa9ae('0x16')][_0xa9ae('0x6')]]](_0x2aac9e['params']['id'])['then'](respondWithResult(_0xfe9ef1,0xc8))[_0xa9ae('0x12')](handleError(_0xfe9ef1,null));}else{return _0xfe9ef1[_0xa9ae('0x6')](0x1f4)[_0xa9ae('0xa')]({'message':_0xa9ae('0x1f')});}};exports[_0xa9ae('0x20')]=function(_0x36bc28,_0x5d0c84){if(_0x36bc28['body']['id']){delete _0x36bc28[_0xa9ae('0x16')]['id'];}if(_0x36bc28[_0xa9ae('0x14')]['id']){return pm2[_0xa9ae('0x21')](_0x36bc28[_0xa9ae('0x14')]['id'])[_0xa9ae('0xe')](function(_0x231152){pm2[_0xa9ae('0x1b')]();return _0x231152[0x0];})[_0xa9ae('0xe')](respondWithResult(_0x5d0c84,null))['catch'](handleError(_0x5d0c84,null));}else{return _0x5d0c84[_0xa9ae('0x6')](0x1f4)['send']({'message':_0xa9ae('0x22')});}}; \ No newline at end of file +var _0xb43b=['stack','name','send','npm\x20install','info','index','list','express','then','describe','catch','create','body','script','join','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','bluebird','status','json'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x493dca,_0x2a50a4){_0x493dca=_0x493dca-0x0;var _0x28e711=_0xb43b[_0x493dca];return _0x28e711;};'use strict';var _=require(_0xbb43('0x0'));var pm2=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var path=require(_0xbb43('0x3'));var exec=require(_0xbb43('0x4'))['exec'];var BPromise=require(_0xbb43('0x5'));function handleEntityNotFound(_0x41aff6,_0x351254){return function(_0x16432a){if(!_0x16432a){_0x41aff6['sendStatus'](0x194);;}return _0x16432a;};}function respondWithResult(_0x491fb9,_0x378df5){_0x378df5=_0x378df5||0xc8;return function(_0x553520){if(_0x553520){return _0x491fb9[_0xbb43('0x6')](_0x378df5)[_0xbb43('0x7')](_0x553520);}return null;};}function handleError(_0x2a2f11,_0x29ae1a){_0x29ae1a=_0x29ae1a||0x1f4;return function(_0x364718){logger['error'](_0x364718[_0xbb43('0x8')]);if(_0x364718[_0xbb43('0x9')]){delete _0x364718['name'];}_0x2a2f11[_0xbb43('0x6')](_0x29ae1a)[_0xbb43('0xa')](_0x364718);};}function execChildProcess(){return new BPromise(function(_0xd37cdf,_0x5e3611){exec(_0xbb43('0xb'),function(_0x2bef86,_0x480cc2,_0x36a473){logger[_0xbb43('0xc')](_0x480cc2);logger['info'](_0x36a473);if(_0x2bef86){logger['error'](_0x2bef86);return _0x5e3611(_0x2bef86);}return _0xd37cdf(_0x480cc2);});});}exports[_0xbb43('0xd')]=function(_0x4a3714,_0x593d0b){return pm2[_0xbb43('0xe')]()['then'](function(_0x68d45d){if(_0x68d45d){var _0x43021d=_['reject'](_0x68d45d,function(_0x4a6e18){return _0x4a6e18['name']===_0xbb43('0xf')||_0x4a6e18[_0xbb43('0x9')]==='motion2';});return{'rows':_0x43021d,'count':_0x43021d['length']};}return null;})[_0xbb43('0x10')](respondWithResult(_0x593d0b,null))['catch'](handleError(_0x593d0b,null));};exports['show']=function(_0x2b0797,_0x8242ab){return pm2[_0xbb43('0x11')](_0x2b0797['params']['id'])[_0xbb43('0x10')](respondWithResult(_0x8242ab,null))['then'](handleEntityNotFound(_0x8242ab,null))[_0xbb43('0x12')](handleError(_0x8242ab,null));};exports[_0xbb43('0x13')]=function(_0x4dfc54,_0x5d765b){if(_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x9')]&&_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x15')]){var _0x5bcce7=path[_0xbb43('0x16')](__dirname,'../../files/plugins',_0x4dfc54[_0xbb43('0x14')]['script']);var _0x2f5e31=process['cwd']();process[_0xbb43('0x17')](path[_0xbb43('0x18')](_0x5bcce7));return execChildProcess()['then'](function(_0x1d0768){process['chdir'](_0x2f5e31);return pm2[_0xbb43('0x19')]({'name':_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x9')],'script':_0x5bcce7});})['then'](function(_0x53f0d5){pm2['dump']();return _0x53f0d5[0x0];})[_0xbb43('0x10')](respondWithResult(_0x5d765b,0xc9))[_0xbb43('0x12')](handleError(_0x5d765b,null));}else{return _0x5d765b['status'](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x1a')});}};exports[_0xbb43('0x1b')]=function(_0x3874fb,_0x4ed43f){if(_0x3874fb['body']['id']){delete _0x3874fb[_0xbb43('0x14')]['id'];}var _0x42800f={'online':_0xbb43('0x1c'),'stopped':_0xbb43('0x1d')};if(_0x42800f[_0xbb43('0x1e')](_0x3874fb[_0xbb43('0x14')][_0xbb43('0x6')])){return pm2[_0x42800f[_0x3874fb[_0xbb43('0x14')]['status']]](_0x3874fb[_0xbb43('0x1f')]['id'])['then'](respondWithResult(_0x4ed43f,0xc8))[_0xbb43('0x12')](handleError(_0x4ed43f,null));}else{return _0x4ed43f[_0xbb43('0x6')](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x20')});}};exports['destroy']=function(_0x157d62,_0x547a6f){if(_0x157d62['body']['id']){delete _0x157d62['body']['id'];}if(_0x157d62[_0xbb43('0x1f')]['id']){return pm2['delete'](_0x157d62[_0xbb43('0x1f')]['id'])[_0xbb43('0x10')](function(_0xc577ac){pm2['dump']();return _0xc577ac[0x0];})[_0xbb43('0x10')](respondWithResult(_0x547a6f,null))[_0xbb43('0x12')](handleError(_0x547a6f,null));}else{return _0x547a6f[_0xbb43('0x6')](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x21')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 5abc263..ef1a734 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 _0x509a=['exports','express','../../components/auth/service','get','/agents','getAgents','/queues','isAuthenticated'];(function(_0x35a265,_0x3c8043){var _0x26fb71=function(_0x69959e){while(--_0x69959e){_0x35a265['push'](_0x35a265['shift']());}};_0x26fb71(++_0x3c8043);}(_0x509a,0x69));var _0xa509=function(_0x50059a,_0x2dc1bd){_0x50059a=_0x50059a-0x0;var _0x516305=_0x509a[_0x50059a];return _0x516305;};'use strict';var express=require(_0xa509('0x0'));var router=express['Router']();var auth=require(_0xa509('0x1'));var controller=require('./realtime.controller');router[_0xa509('0x2')](_0xa509('0x3'),auth['isAuthenticated'](),controller[_0xa509('0x4')]);router[_0xa509('0x2')](_0xa509('0x5'),auth[_0xa509('0x6')](),controller['getQueues']);module[_0xa509('0x7')]=router; \ No newline at end of file +var _0x4019=['/agents','isAuthenticated','getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0x4019,0xc1));var _0x9401=function(_0x3ac8df,_0x148795){_0x3ac8df=_0x3ac8df-0x0;var _0x136a3f=_0x4019[_0x3ac8df];return _0x136a3f;};'use strict';var express=require(_0x9401('0x0'));var router=express[_0x9401('0x1')]();var auth=require(_0x9401('0x2'));var controller=require(_0x9401('0x3'));router[_0x9401('0x4')](_0x9401('0x5'),auth[_0x9401('0x6')](),controller[_0x9401('0x7')]);router['get'](_0x9401('0x8'),auth[_0x9401('0x6')](),controller[_0x9401('0x9')]);module[_0x9401('0xa')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 114cb7a..32dd05b 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 _0x0c02=['validateSortParameter','getUpdatedSortOptions','fields','join','order','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','sequelize','literal','FIELD(id,','forEach','Pause','push','where','user','userProfileId','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','filterAgentAttributes','globalStatus','getAgentStatus','Status','split','format','Channel\x20parameter\x20%s\x20is\x20invalid','Queue','voice','outbound','dialActive','dialMethod','QueueCampaigns','startCase','Queues','filter','initializeQueues','catch','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','undefined','count','offset','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','resolve','then','isValidChannel','channel','toLowerCase','sort','includes'];(function(_0x47778f,_0x4bf1a3){var _0x449af6=function(_0x2ec6fe){while(--_0x2ec6fe){_0x47778f['push'](_0x47778f['shift']());}};_0x449af6(++_0x4bf1a3);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x20c0('0x0'));var rta=require(_0x20c0('0x1'));var rtq=require('../../components/realtime/queues');var qs=require(_0x20c0('0x2'));var utils=require(_0x20c0('0x3'));var db=require(_0x20c0('0x4'))['db'];var APIBadRequestError=require(_0x20c0('0x5'))[_0x20c0('0x6')];var APIHandleError=require(_0x20c0('0x5'))[_0x20c0('0x7')];function respondWithFilteredResult(_0x1474f7,_0x13312d){return function(_0xd25ee8){if(_0xd25ee8){var _0x5d6408=typeof _0x13312d['offset']==='undefined'&&typeof _0x13312d['limit']===_0x20c0('0x8');var _0x276e9b=_0xd25ee8[_0x20c0('0x9')];var _0x41a4af=_0x5d6408?0x0:_0x13312d[_0x20c0('0xa')];var _0xedd21d=_0x5d6408?_0xd25ee8['count']:_0x13312d['offset']+_0x13312d['limit'];var _0x578592;if(_0xedd21d>=_0x276e9b){_0xedd21d=_0x276e9b;_0x578592=0xc8;}else{_0x578592=0xce;}_0x1474f7['status'](_0x578592);return _0x1474f7[_0x20c0('0xb')](_0x20c0('0xc'),_0x41a4af+'-'+_0xedd21d+'/'+_0x276e9b)[_0x20c0('0xd')](_0xd25ee8);}return null;};}exports[_0x20c0('0xe')]=function(_0x4ed79e,_0x56fa09){var _0x55854e={'count':0x0,'rows':[]};var _0x5c9ee6={};var _0x34a930;var _0xfc2d9c=utils[_0x20c0('0xf')]();var _0x3b2bba;var _0x37f4e0;var _0x1e6662=_0x4ed79e[_0x20c0('0x10')][_0x20c0('0x11')];var _0x280aff=_0x4ed79e['query'][_0x20c0('0x12')];var _0xc78626=_0x4ed79e[_0x20c0('0x10')][_0x20c0('0x13')];var _0xfb962=_0x280aff===_0x20c0('0x14')||_0x280aff==='*pause'?!![]:![];var _0x55de3b=[];var _0x529cad;var _0x10a921;Promise[_0x20c0('0x15')]()[_0x20c0('0x16')](function(){if(_0x4ed79e[_0x20c0('0x10')]['channel']){if(!utils[_0x20c0('0x17')](_0x4ed79e[_0x20c0('0x10')][_0x20c0('0x18')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x4ed79e[_0x20c0('0x10')][_0x20c0('0x18')]));}_0x34a930=_0x4ed79e[_0x20c0('0x10')][_0x20c0('0x18')][_0x20c0('0x19')]();}if(!_0x4ed79e['query'][_0x20c0('0x1a')]||!_0x4ed79e[_0x20c0('0x10')][_0x20c0('0x1a')][_0x20c0('0x1b')]('globalStatus')){_0x4ed79e[_0x20c0('0x10')][_0x20c0('0x1a')]=rta[_0x20c0('0x1c')](_0x4ed79e[_0x20c0('0x10')][_0x20c0('0x1a')]);return;}var _0x41ab51=rta[_0x20c0('0x1d')](_0x4ed79e['query'][_0x20c0('0x1a')]);_0x4ed79e[_0x20c0('0x10')][_0x20c0('0x1a')]=_0x41ab51[_0x20c0('0x1e')][_0x20c0('0x1f')](',');_0x529cad=_0x41ab51[_0x20c0('0x20')];})['then'](function(){if(!_0x1e6662){return[];}return rta['getAgentIdsByQueues'](_0x1e6662,_0x34a930);})[_0x20c0('0x16')](function(_0x198bdd){_0x55de3b=_0x198bdd;return rta[_0x20c0('0x21')]();})['then'](function(_0xa24196){_0x37f4e0=_0xa24196[_0x20c0('0x22')];if((!_0x280aff||_0xfb962)&&!_0x529cad){return _0x55de3b;}if(_0x529cad&&!_0x280aff){return rta[_0x20c0('0x23')](_0x37f4e0,_0x55de3b,_0x529cad);}else{return rta[_0x20c0('0x24')](_0x37f4e0,_0x55de3b,_0x280aff);}})['then'](function(_0x49b738){_0x55de3b=_0x49b738;var _0x29d8ee=![];if(_0x55de3b[_0x20c0('0x25')]===0x0){if(_0x1e6662||_0x280aff){_0x29d8ee=!![];}if(_0xfb962){_0x29d8ee=![];}}if(_0x29d8ee){return _0x55854e;}var _0x3edc22=_[_0x20c0('0x26')](db[_0x20c0('0x27')][_0x20c0('0x28')],function(_0x3b97a5){return{'name':_0x3b97a5[_0x20c0('0x29')],'type':_0x3b97a5[_0x20c0('0x2a')][_0x20c0('0x2b')]};});_0x4ed79e[_0x20c0('0x10')][_0x20c0('0x2c')]=_0x20c0('0x2d');_0x4ed79e[_0x20c0('0x10')]['online']=!![];_0x5c9ee6=qs[_0x20c0('0x2e')](_0x3edc22,_0x4ed79e);_0x5c9ee6[_0x20c0('0x2f')]=!![];var _0x341076=[];if(_0x55de3b[_0x20c0('0x25')]>0x0){_0x341076['push']({'id':{'$in':_0x55de3b}});if(_0x529cad&&!_0x280aff){_0x10a921=[db[_0x20c0('0x30')][_0x20c0('0x31')](_0x20c0('0x32')+_0x55de3b+')')];_0x5c9ee6[_0x20c0('0x20')]=_0x10a921;}}if(_0xfb962){_0xfc2d9c[_0x20c0('0x33')](function(_0x5550b7){var _0x3484ea=!![];if(_0x280aff==='*pause'&&_0x34a930!==_0x5550b7){_0x3484ea=![];}_0x341076['push']({[_0x5550b7+_0x20c0('0x34')]:_0x3484ea});});if(_0xc78626){_0x341076[_0x20c0('0x35')]({'pauseType':_0xc78626});}}else if(_0x280aff){_0xfc2d9c[_0x20c0('0x33')](function(_0x37714d){_0x341076[_0x20c0('0x35')]({[_0x37714d+_0x20c0('0x34')]:![]});});}_0x5c9ee6[_0x20c0('0x36')]=_['merge'](_0x5c9ee6['where'],{'$and':_0x341076});if(_0x4ed79e['user'][_0x20c0('0x2c')]===_0x20c0('0x37')){var _0x545b39={'params':{'id':_0x4ed79e[_0x20c0('0x37')][_0x20c0('0x38')]},'query':{'section':'Agents','role':'agent','online':!![],'raw':!![],'ids':_0x55de3b,'customSorting':_0x10a921}};if(_0xfb962){_0x545b39[_0x20c0('0x10')][_0x20c0('0x39')]=_0x341076;}_0x545b39['query']=Object[_0x20c0('0x3a')](_0x545b39['query'],_0x4ed79e[_0x20c0('0x10')]);delete _0x545b39[_0x20c0('0x10')]['id'];return db[_0x20c0('0x3b')][_0x20c0('0x3c')](_0x545b39);}return db['User'][_0x20c0('0x3d')](_0x5c9ee6);})[_0x20c0('0x16')](function(_0x21fd67){_0x55854e[_0x20c0('0x9')]=_0x21fd67[_0x20c0('0x9')];_0x3b2bba=_0x21fd67[_0x20c0('0x22')];return _0x3b2bba[_0x20c0('0x26')](function(_0x40dcfe){var _0x57bb71=_['find'](_0x37f4e0,['id',_0x40dcfe['id']]);if(_0x57bb71){var _0x581fe4=rta[_0x20c0('0x3e')](_0x57bb71);_['merge'](_0x40dcfe,_0x581fe4);}_0x40dcfe[_0x20c0('0x3f')]=rta[_0x20c0('0x40')](_0x40dcfe);if(_0x40dcfe[_0x20c0('0x3f')][_0x20c0('0x1b')]('pause')){_0xfc2d9c[_0x20c0('0x33')](function(_0x5bf7b8){if(_0x40dcfe[_0x5bf7b8+'Pause']){_0x40dcfe[_0x5bf7b8+_0x20c0('0x41')]=_0x20c0('0x14');}});}return _0x40dcfe;});})[_0x20c0('0x16')](function(_0x446c89){if(!_0x529cad||_0x10a921){return _0x446c89;}return rta['sortAgentsByStatus'](_0x446c89,_0x529cad);})[_0x20c0('0x16')](function(_0x251e1c){var _0x39852a=null;if(_0x4ed79e[_0x20c0('0x10')]['fields']){var _0x44a142=_0x4ed79e[_0x20c0('0x10')]['fields'][_0x20c0('0x42')](',');_0x39852a=_0x251e1c[_0x20c0('0x26')](function(_0x327e83){return _['pick'](_0x327e83,_0x44a142);});}_0x55854e[_0x20c0('0x22')]=_0x39852a||_0x251e1c;return _0x55854e;})['then'](respondWithFilteredResult(_0x56fa09,_0x5c9ee6))['catch'](APIHandleError(_0x56fa09));};exports['getQueues']=function(_0x36ccf2,_0x4a8ba4){var _0x12945c={'count':0x0,'rows':[]};var _0x324737={};var _0x220d5e;var _0x3e5c62;var _0x15f299;Promise[_0x20c0('0x15')]()[_0x20c0('0x16')](function(){if(_0x36ccf2['query'][_0x20c0('0x18')]){if(!utils[_0x20c0('0x17')](_0x36ccf2[_0x20c0('0x10')][_0x20c0('0x18')])){throw new APIBadRequestError(util[_0x20c0('0x43')](_0x20c0('0x44'),_0x36ccf2['query']['channel']));}_0x220d5e=_0x36ccf2[_0x20c0('0x10')][_0x20c0('0x18')][_0x20c0('0x19')]();}var _0x47da2c=_['startCase'](_0x220d5e)+_0x20c0('0x45');var _0x3b5163=_[_0x20c0('0x26')](db[_0x47da2c]['rawAttributes'],function(_0x293323){return{'name':_0x293323[_0x20c0('0x29')],'type':_0x293323['type']['key']};});if(!_0x36ccf2[_0x20c0('0x10')]['fields']){var _0xdd2a3b=['id','name'];if(_0x220d5e===_0x20c0('0x46')){_0xdd2a3b[_0x20c0('0x35')]('type');if(_0x36ccf2['query'][_0x20c0('0x2a')]===_0x20c0('0x47')){_0xdd2a3b[_0x20c0('0x35')]([_0x20c0('0x48'),_0x20c0('0x49')]);}}_0x36ccf2[_0x20c0('0x10')][_0x20c0('0x1e')]=_0xdd2a3b[_0x20c0('0x1f')](',');}_0x324737=qs['getOptions'](_0x3b5163,_0x36ccf2);if(_0x36ccf2[_0x20c0('0x37')][_0x20c0('0x2c')]===_0x20c0('0x37')){var _0xe50137={'params':{'id':_0x36ccf2[_0x20c0('0x37')]['userProfileId']},'query':{'section':_0x220d5e==='voice'&&_0x36ccf2[_0x20c0('0x10')][_0x20c0('0x2a')]===_0x20c0('0x47')?_0x20c0('0x4a'):_[_0x20c0('0x4b')](_0x220d5e)+_0x20c0('0x4c'),'type':_0x36ccf2[_0x20c0('0x10')]['type'],'nolimit':!![],'sort':'name','filter':_0x36ccf2[_0x20c0('0x10')][_0x20c0('0x4d')]}};_0xe50137[_0x20c0('0x10')]=Object['assign'](_0xe50137[_0x20c0('0x10')],_0x36ccf2['query']);delete _0xe50137[_0x20c0('0x10')]['id'];return db[_0x20c0('0x3b')][_0x20c0('0x3c')](_0xe50137);}return db[_0x47da2c]['findAndCountAll'](_0x324737);})[_0x20c0('0x16')](function(_0x28bc98){_0x12945c[_0x20c0('0x9')]=_0x28bc98[_0x20c0('0x9')];_0x3e5c62=_0x28bc98[_0x20c0('0x22')];return rtq['getRealtimeQueues'](_0x36ccf2,_0x220d5e);})[_0x20c0('0x16')](function(_0x439717){_0x15f299=_0x439717[_0x20c0('0x22')];return rtq[_0x20c0('0x4e')](_0x3e5c62,_0x15f299,_0x220d5e,_0x36ccf2['query'][_0x20c0('0x2a')]);})['then'](function(_0x36545c){_0x12945c['rows']=_0x36545c;return _0x12945c;})[_0x20c0('0x16')](respondWithFilteredResult(_0x4a8ba4,_0x324737))[_0x20c0('0x4f')](APIHandleError(_0x4a8ba4));}; \ No newline at end of file +var _0xb651=['isValidChannel','format','channel','toLowerCase','sort','validateSortParameter','getUpdatedSortOptions','fields','join','getRealtimeAgents','getSortedAgentsIdsByStatus','length','map','rawAttributes','fieldName','type','role','agent','online','getOptions','raw','push','sequelize','literal','FIELD(id,','order','forEach','merge','where','user','userProfileId','Agents','assign','UserProfile','getResources','User','findAndCountAll','rows','find','filterAgentAttributes','getAgentStatus','globalStatus','includes','Pause','voice','voiceStatus','sortAgentsByStatus','split','pick','catch','key','name','outbound','dialMethod','QueueCampaigns','startCase','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','json','getChannels','query','globalQueueFilter','globalStatusFilter','pause','*pause','resolve','then'];(function(_0x226934,_0xe02df){var _0x4cef9b=function(_0x5cf11a){while(--_0x5cf11a){_0x226934['push'](_0x226934['shift']());}};_0x4cef9b(++_0xe02df);}(_0xb651,0x1ca));var _0x1b65=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb651[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1b65('0x0'));var util=require(_0x1b65('0x1'));var rta=require(_0x1b65('0x2'));var rtq=require(_0x1b65('0x3'));var qs=require(_0x1b65('0x4'));var utils=require(_0x1b65('0x5'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x1b65('0x6'))[_0x1b65('0x7')];var APIHandleError=require(_0x1b65('0x6'))['handleError'];function respondWithFilteredResult(_0x18c438,_0x181bb0){return function(_0x3cba53){if(_0x3cba53){var _0x226eaa=typeof _0x181bb0[_0x1b65('0x8')]===_0x1b65('0x9')&&typeof _0x181bb0[_0x1b65('0xa')]===_0x1b65('0x9');var _0x57c6d5=_0x3cba53[_0x1b65('0xb')];var _0xfb0ad0=_0x226eaa?0x0:_0x181bb0[_0x1b65('0x8')];var _0x305969=_0x226eaa?_0x3cba53[_0x1b65('0xb')]:_0x181bb0['offset']+_0x181bb0[_0x1b65('0xa')];var _0x11ba5d;if(_0x305969>=_0x57c6d5){_0x305969=_0x57c6d5;_0x11ba5d=0xc8;}else{_0x11ba5d=0xce;}_0x18c438[_0x1b65('0xc')](_0x11ba5d);return _0x18c438['set']('Content-Range',_0xfb0ad0+'-'+_0x305969+'/'+_0x57c6d5)[_0x1b65('0xd')](_0x3cba53);}return null;};}exports['getAgents']=function(_0x4c2aba,_0x225e43){var _0x2c101a={'count':0x0,'rows':[]};var _0x29c0ea={};var _0x52900d;var _0xccdb77=utils[_0x1b65('0xe')]();var _0x3a7d70;var _0x141a98;var _0x564658=_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x10')];var _0x3b5075=_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x11')];var _0x1cc2b7=_0x4c2aba['query']['pauseTypeFilter'];var _0x28edd7=_0x3b5075===_0x1b65('0x12')||_0x3b5075===_0x1b65('0x13')?!![]:![];var _0x51af4a=[];var _0x4efad7;var _0x4bf9b1;Promise[_0x1b65('0x14')]()[_0x1b65('0x15')](function(){if(_0x4c2aba['query']['channel']){if(!utils[_0x1b65('0x16')](_0x4c2aba[_0x1b65('0xf')]['channel'])){throw new APIBadRequestError(util[_0x1b65('0x17')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x18')]));}_0x52900d=_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x18')][_0x1b65('0x19')]();}if(!_0x4c2aba['query'][_0x1b65('0x1a')]||!_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x1a')]['includes']('globalStatus')){_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x1a')]=rta[_0x1b65('0x1b')](_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x1a')]);return;}var _0x1ca83f=rta[_0x1b65('0x1c')](_0x4c2aba['query']['sort']);_0x4c2aba['query'][_0x1b65('0x1a')]=_0x1ca83f[_0x1b65('0x1d')][_0x1b65('0x1e')](',');_0x4efad7=_0x1ca83f['order'];})[_0x1b65('0x15')](function(){if(!_0x564658){return[];}return rta['getAgentIdsByQueues'](_0x564658,_0x52900d);})[_0x1b65('0x15')](function(_0x2ea12d){_0x51af4a=_0x2ea12d;return rta[_0x1b65('0x1f')]();})[_0x1b65('0x15')](function(_0x334f99){_0x141a98=_0x334f99['rows'];if((!_0x3b5075||_0x28edd7)&&!_0x4efad7){return _0x51af4a;}if(_0x4efad7&&!_0x3b5075){return rta[_0x1b65('0x20')](_0x141a98,_0x51af4a,_0x4efad7);}else{return rta['getAgentIdsByStatus'](_0x141a98,_0x51af4a,_0x3b5075);}})['then'](function(_0xf000){_0x51af4a=_0xf000;var _0x282f49=![];if(_0x51af4a[_0x1b65('0x21')]===0x0){if(_0x564658||_0x3b5075){_0x282f49=!![];}if(_0x28edd7){_0x282f49=![];}}if(_0x282f49){return _0x2c101a;}var _0x56cb17=_[_0x1b65('0x22')](db['User'][_0x1b65('0x23')],function(_0x3fc669){return{'name':_0x3fc669[_0x1b65('0x24')],'type':_0x3fc669[_0x1b65('0x25')]['key']};});_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x26')]=_0x1b65('0x27');_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x28')]=!![];_0x29c0ea=qs[_0x1b65('0x29')](_0x56cb17,_0x4c2aba);_0x29c0ea[_0x1b65('0x2a')]=!![];var _0x4e58ef=[];if(_0x51af4a['length']>0x0){_0x4e58ef[_0x1b65('0x2b')]({'id':{'$in':_0x51af4a}});if(_0x4efad7&&!_0x3b5075){_0x4bf9b1=[db[_0x1b65('0x2c')][_0x1b65('0x2d')](_0x1b65('0x2e')+_0x51af4a+')')];_0x29c0ea[_0x1b65('0x2f')]=_0x4bf9b1;}}if(_0x28edd7){_0xccdb77[_0x1b65('0x30')](function(_0x23e614){var _0x16cb0c=!![];if(_0x3b5075==='*pause'&&_0x52900d!==_0x23e614){_0x16cb0c=![];}_0x4e58ef[_0x1b65('0x2b')]({[_0x23e614+'Pause']:_0x16cb0c});});if(_0x1cc2b7){_0x4e58ef['push']({'pauseType':_0x1cc2b7});}}else if(_0x3b5075){_0xccdb77['forEach'](function(_0x402d09){_0x4e58ef[_0x1b65('0x2b')]({[_0x402d09+'Pause']:![]});});}_0x29c0ea['where']=_[_0x1b65('0x31')](_0x29c0ea[_0x1b65('0x32')],{'$and':_0x4e58ef});if(_0x4c2aba[_0x1b65('0x33')][_0x1b65('0x26')]==='user'){var _0x298876={'params':{'id':_0x4c2aba[_0x1b65('0x33')][_0x1b65('0x34')]},'query':{'section':_0x1b65('0x35'),'role':_0x1b65('0x27'),'online':!![],'raw':!![],'ids':_0x51af4a,'customSorting':_0x4bf9b1}};if(_0x28edd7){_0x298876[_0x1b65('0xf')]['extraQueryConditions']=_0x4e58ef;}_0x298876[_0x1b65('0xf')]=Object[_0x1b65('0x36')](_0x298876['query'],_0x4c2aba[_0x1b65('0xf')]);delete _0x298876[_0x1b65('0xf')]['id'];return db[_0x1b65('0x37')][_0x1b65('0x38')](_0x298876);}return db[_0x1b65('0x39')][_0x1b65('0x3a')](_0x29c0ea);})['then'](function(_0x5d02ba){_0x2c101a[_0x1b65('0xb')]=_0x5d02ba[_0x1b65('0xb')];_0x3a7d70=_0x5d02ba[_0x1b65('0x3b')];return _0x3a7d70['map'](function(_0xe9fca8){var _0x18d45e=_[_0x1b65('0x3c')](_0x141a98,['id',_0xe9fca8['id']]);if(_0x18d45e){var _0x3bcf9c=rta[_0x1b65('0x3d')](_0x18d45e);_[_0x1b65('0x31')](_0xe9fca8,_0x3bcf9c);}_0xe9fca8['globalStatus']=rta[_0x1b65('0x3e')](_0xe9fca8);if(_0xe9fca8[_0x1b65('0x3f')][_0x1b65('0x40')](_0x1b65('0x12'))){_0xccdb77[_0x1b65('0x30')](function(_0x10aa89){if(_0xe9fca8[_0x10aa89+_0x1b65('0x41')]){if(_0x10aa89===_0x1b65('0x42')){if(_0xe9fca8[_0x1b65('0x43')]!=='talking'){_0xe9fca8[_0x1b65('0x43')]=_0x1b65('0x12');}}else{_0xe9fca8[_0x10aa89+'Status']=_0x1b65('0x12');}}});}return _0xe9fca8;});})[_0x1b65('0x15')](function(_0x36f522){if(!_0x4efad7||_0x4bf9b1){return _0x36f522;}return rta[_0x1b65('0x44')](_0x36f522,_0x4efad7);})[_0x1b65('0x15')](function(_0x29e484){var _0x53aa3d=null;if(_0x4c2aba[_0x1b65('0xf')][_0x1b65('0x1d')]){var _0x51de35=_0x4c2aba[_0x1b65('0xf')]['fields'][_0x1b65('0x45')](',');_0x53aa3d=_0x29e484[_0x1b65('0x22')](function(_0x219f85){return _[_0x1b65('0x46')](_0x219f85,_0x51de35);});}_0x2c101a[_0x1b65('0x3b')]=_0x53aa3d||_0x29e484;return _0x2c101a;})[_0x1b65('0x15')](respondWithFilteredResult(_0x225e43,_0x29c0ea))[_0x1b65('0x47')](APIHandleError(_0x225e43));};exports['getQueues']=function(_0xc94861,_0x5326ad){var _0x2b2ae7={'count':0x0,'rows':[]};var _0x10f5fb={};var _0x281a58;var _0x524fe8;var _0x1fb2c8;Promise[_0x1b65('0x14')]()[_0x1b65('0x15')](function(){if(_0xc94861[_0x1b65('0xf')][_0x1b65('0x18')]){if(!utils['isValidChannel'](_0xc94861['query']['channel'])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0xc94861[_0x1b65('0xf')]['channel']));}_0x281a58=_0xc94861['query'][_0x1b65('0x18')][_0x1b65('0x19')]();}var _0x42e208=_['startCase'](_0x281a58)+'Queue';var _0x383294=_['map'](db[_0x42e208][_0x1b65('0x23')],function(_0x3111e4){return{'name':_0x3111e4[_0x1b65('0x24')],'type':_0x3111e4['type'][_0x1b65('0x48')]};});if(!_0xc94861[_0x1b65('0xf')][_0x1b65('0x1d')]){var _0x2f4947=['id',_0x1b65('0x49')];if(_0x281a58==='voice'){_0x2f4947[_0x1b65('0x2b')](_0x1b65('0x25'));if(_0xc94861[_0x1b65('0xf')][_0x1b65('0x25')]===_0x1b65('0x4a')){_0x2f4947['push'](['dialActive',_0x1b65('0x4b')]);}}_0xc94861[_0x1b65('0xf')][_0x1b65('0x1d')]=_0x2f4947[_0x1b65('0x1e')](',');}_0x10f5fb=qs['getOptions'](_0x383294,_0xc94861);if(_0xc94861[_0x1b65('0x33')][_0x1b65('0x26')]===_0x1b65('0x33')){var _0x5d144b={'params':{'id':_0xc94861[_0x1b65('0x33')][_0x1b65('0x34')]},'query':{'section':_0x281a58===_0x1b65('0x42')&&_0xc94861['query'][_0x1b65('0x25')]===_0x1b65('0x4a')?_0x1b65('0x4c'):_[_0x1b65('0x4d')](_0x281a58)+'Queues','type':_0xc94861[_0x1b65('0xf')]['type'],'nolimit':!![],'sort':_0x1b65('0x49'),'filter':_0xc94861['query']['filter']}};_0x5d144b[_0x1b65('0xf')]=Object[_0x1b65('0x36')](_0x5d144b[_0x1b65('0xf')],_0xc94861[_0x1b65('0xf')]);delete _0x5d144b[_0x1b65('0xf')]['id'];return db['UserProfile'][_0x1b65('0x38')](_0x5d144b);}return db[_0x42e208]['findAndCountAll'](_0x10f5fb);})[_0x1b65('0x15')](function(_0x2ca799){_0x2b2ae7[_0x1b65('0xb')]=_0x2ca799[_0x1b65('0xb')];_0x524fe8=_0x2ca799['rows'];return rtq[_0x1b65('0x4e')](_0xc94861,_0x281a58);})[_0x1b65('0x15')](function(_0x5346d4){_0x1fb2c8=_0x5346d4[_0x1b65('0x3b')];return rtq[_0x1b65('0x4f')](_0x524fe8,_0x1fb2c8,_0x281a58,_0xc94861[_0x1b65('0xf')]['type']);})[_0x1b65('0x15')](function(_0x322a1b){_0x2b2ae7['rows']=_0x322a1b;return _0x2b2ae7;})['then'](respondWithFilteredResult(_0x5326ad,_0x10f5fb))[_0x1b65('0x47')](APIHandleError(_0x5326ad));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index c3e91f4..451b51c 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x359caf,_0x2d0d3f){var _0x23405f=function(_0x31ff7e){while(--_0x31ff7e){_0x359caf['push'](_0x359caf['shift']());}};_0x23405f(++_0x2d0d3f);}(_0xe706,0xa3));var _0x6e70=function(_0x147497,_0x43e433){_0x147497=_0x147497-0x0;var _0x35f45=_0xe706[_0x147497];return _0x35f45;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x16d3fe,_0xd75c0c){var _0x70c182=function(_0x5e6d18){while(--_0x5e6d18){_0x16d3fe['push'](_0x16d3fe['shift']());}};_0x70c182(++_0xd75c0c);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index bb4503a..703213f 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 _0x2bae=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x2bae,0x164));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe2ba('0x0'));module[_0xe2ba('0x1')]={'state':{'type':Sequelize[_0xe2ba('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe2ba('0x3')]},'scheduledat':{'type':Sequelize[_0xe2ba('0x4')]},'uniqueid':{'type':Sequelize[_0xe2ba('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xe2ba('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xe2ba('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe2ba('0x3')]}}; \ No newline at end of file +var _0x0024=['exports','STRING','INTEGER'];(function(_0x2b776d,_0x20b72a){var _0x170f1c=function(_0x39d08b){while(--_0x39d08b){_0x2b776d['push'](_0x2b776d['shift']());}};_0x170f1c(++_0x20b72a);}(_0x0024,0xa8));var _0x4002=function(_0xd09fa2,_0x152402){_0xd09fa2=_0xd09fa2-0x0;var _0xb1178c=_0x0024[_0xd09fa2];return _0xb1178c;};'use strict';var Sequelize=require('sequelize');module[_0x4002('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x4002('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x4002('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x4002('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4002('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index f95a7de..eefd500 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 _0xa2db=['./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x446737,_0x411246){var _0x575b95=function(_0x388fc6){while(--_0x388fc6){_0x446737['push'](_0x446737['shift']());}};_0x575b95(++_0x411246);}(_0xa2db,0x149));var _0xba2d=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0xa2db[_0x195577];return _0x13c367;};'use strict';var _=require(_0xba2d('0x0'));var util=require(_0xba2d('0x1'));var logger=require(_0xba2d('0x2'))(_0xba2d('0x3'));var moment=require(_0xba2d('0x4'));var BPromise=require(_0xba2d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba2d('0x6'));var rimraf=require(_0xba2d('0x7'));var config=require(_0xba2d('0x8'));var attributes=require(_0xba2d('0x9'));module['exports']=function(_0x3705ac,_0x519b0d){return _0x3705ac[_0xba2d('0xa')](_0xba2d('0xb'),attributes,{'tableName':_0xba2d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0b=['api','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','../../config/logger'];(function(_0x36acb3,_0x204e94){var _0x13976c=function(_0x4371dd){while(--_0x4371dd){_0x36acb3['push'](_0x36acb3['shift']());}};_0x13976c(++_0x204e94);}(_0x6f0b,0x6d));var _0xb6f0=function(_0x5f0377,_0x310371){_0x5f0377=_0x5f0377-0x0;var _0x16c6cb=_0x6f0b[_0x5f0377];return _0x16c6cb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb6f0('0x0'))(_0xb6f0('0x1'));var moment=require('moment');var BPromise=require(_0xb6f0('0x2'));var rp=require(_0xb6f0('0x3'));var fs=require('fs');var path=require(_0xb6f0('0x4'));var rimraf=require(_0xb6f0('0x5'));var config=require(_0xb6f0('0x6'));var attributes=require(_0xb6f0('0x7'));module[_0xb6f0('0x8')]=function(_0x3e1720,_0x18952f){return _0x3e1720['define'](_0xb6f0('0x9'),attributes,{'tableName':_0xb6f0('0xa'),'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 fd6fc65..8a0a7a3 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 _0x61db=['client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0x61db,0x198));var _0xb61d=function(_0x4e9e82,_0x3144a4){_0x4e9e82=_0x4e9e82-0x0;var _0x57e451=_0x61db[_0x4e9e82];return _0x57e451;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb61d('0x0'));var BPromise=require(_0xb61d('0x1'));var rs=require(_0xb61d('0x2'));var fs=require('fs');var Redis=require(_0xb61d('0x3'));var db=require(_0xb61d('0x4'))['db'];var utils=require(_0xb61d('0x5'));var logger=require(_0xb61d('0x6'))('rpc');var config=require(_0xb61d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb61d('0x8')][_0xb61d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x590c4e,_0x22ded9,_0x2834da){return new BPromise(function(_0x5428ae,_0x5bc03a){return client[_0xb61d('0xa')](_0x590c4e,_0x2834da)[_0xb61d('0xb')](function(_0x5400b1){logger[_0xb61d('0xc')](_0xb61d('0xd'),_0x22ded9,_0xb61d('0xe'));logger[_0xb61d('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x22ded9,'request\x20sent',JSON['stringify'](_0x5400b1));if(_0x5400b1[_0xb61d('0x10')]){if(_0x5400b1[_0xb61d('0x10')][_0xb61d('0x11')]===0x1f4){logger[_0xb61d('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x22ded9,_0x5400b1[_0xb61d('0x10')][_0xb61d('0x12')]);return _0x5bc03a(_0x5400b1[_0xb61d('0x10')][_0xb61d('0x12')]);}logger[_0xb61d('0x10')](_0xb61d('0xd'),_0x22ded9,_0x5400b1[_0xb61d('0x10')]['message']);return _0x5428ae(_0x5400b1[_0xb61d('0x10')][_0xb61d('0x12')]);}else{logger[_0xb61d('0xc')](_0xb61d('0xd'),_0x22ded9,_0xb61d('0xe'));_0x5428ae(_0x5400b1['result'][_0xb61d('0x12')]);}})[_0xb61d('0x13')](function(_0x4548fe){logger['error'](_0xb61d('0xd'),_0x22ded9,_0x4548fe);_0x5bc03a(_0x4548fe);});});}exports[_0xb61d('0x14')]=function(_0x36612a){var _0x54c148=this;return new Promise(function(_0x5905dd,_0x577b5e){return db[_0xb61d('0x15')][_0xb61d('0x16')](_0x36612a[_0xb61d('0x17')],{'raw':_0x36612a[_0xb61d('0x18')]?_0x36612a['options'][_0xb61d('0x19')]===undefined?!![]:![]:!![]})[_0xb61d('0xb')](function(_0x3c3939){logger['info']('CreateReportAgentPreview',_0x36612a);logger[_0xb61d('0xf')](_0xb61d('0x14'),_0x36612a,JSON['stringify'](_0x3c3939));_0x5905dd(_0x3c3939);})[_0xb61d('0x13')](function(_0x5d2592){logger[_0xb61d('0x10')]('CreateReportAgentPreview',_0x5d2592[_0xb61d('0x12')],_0x36612a);_0x577b5e(_0x54c148[_0xb61d('0x10')](0x1f4,_0x5d2592[_0xb61d('0x12')]));});});}; \ No newline at end of file +var _0x3e6e=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x531fb6,_0x197966){var _0x4387de=function(_0x52cda8){while(--_0x52cda8){_0x531fb6['push'](_0x531fb6['shift']());}};_0x4387de(++_0x197966);}(_0x3e6e,0x1dd));var _0xe3e6=function(_0x128057,_0xb42eb5){_0x128057=_0x128057-0x0;var _0x1a64d4=_0x3e6e[_0x128057];return _0x1a64d4;};'use strict';var _=require(_0xe3e6('0x0'));var util=require('util');var moment=require(_0xe3e6('0x1'));var BPromise=require(_0xe3e6('0x2'));var rs=require(_0xe3e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe3e6('0x4'));var logger=require(_0xe3e6('0x5'))('rpc');var config=require(_0xe3e6('0x6'));var jayson=require(_0xe3e6('0x7'));var client=jayson[_0xe3e6('0x8')][_0xe3e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x291a1a,_0x28bb31,_0xff633f){return new BPromise(function(_0x7953b2,_0x2bef6a){return client[_0xe3e6('0xa')](_0x291a1a,_0xff633f)[_0xe3e6('0xb')](function(_0x36b35e){logger[_0xe3e6('0xc')](_0xe3e6('0xd'),_0x28bb31,_0xe3e6('0xe'));logger[_0xe3e6('0xf')](_0xe3e6('0x10'),_0x28bb31,_0xe3e6('0xe'),JSON[_0xe3e6('0x11')](_0x36b35e));if(_0x36b35e[_0xe3e6('0x12')]){if(_0x36b35e[_0xe3e6('0x12')][_0xe3e6('0x13')]===0x1f4){logger[_0xe3e6('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x28bb31,_0x36b35e[_0xe3e6('0x12')][_0xe3e6('0x14')]);return _0x2bef6a(_0x36b35e['error']['message']);}logger['error'](_0xe3e6('0xd'),_0x28bb31,_0x36b35e['error'][_0xe3e6('0x14')]);return _0x7953b2(_0x36b35e[_0xe3e6('0x12')]['message']);}else{logger[_0xe3e6('0xc')](_0xe3e6('0xd'),_0x28bb31,_0xe3e6('0xe'));_0x7953b2(_0x36b35e[_0xe3e6('0x15')][_0xe3e6('0x14')]);}})['catch'](function(_0x44e11a){logger[_0xe3e6('0x12')](_0xe3e6('0xd'),_0x28bb31,_0x44e11a);_0x2bef6a(_0x44e11a);});});}exports[_0xe3e6('0x16')]=function(_0x2f5de0){var _0x4f0bd4=this;return new Promise(function(_0x12cfc4,_0x78a1fb){return db[_0xe3e6('0x17')][_0xe3e6('0x18')](_0x2f5de0[_0xe3e6('0x19')],{'raw':_0x2f5de0[_0xe3e6('0x1a')]?_0x2f5de0[_0xe3e6('0x1a')][_0xe3e6('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x489eba){logger[_0xe3e6('0xc')](_0xe3e6('0x16'),_0x2f5de0);logger[_0xe3e6('0xf')](_0xe3e6('0x16'),_0x2f5de0,JSON['stringify'](_0x489eba));_0x12cfc4(_0x489eba);})[_0xe3e6('0x1c')](function(_0x1bc36e){logger[_0xe3e6('0x12')](_0xe3e6('0x16'),_0x1bc36e[_0xe3e6('0x14')],_0x2f5de0);_0x78a1fb(_0x4f0bd4[_0xe3e6('0x12')](0x1f4,_0x1bc36e['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 20bd355..0525c3f 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 _0xaed4=['post','mail','/mail/queues/:id','showMailQueues','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','multer','path','express','Router','../../components/auth/service','./rpc.controller','get','voiceChannels','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','put','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions'];(function(_0x1d3c85,_0xa843e6){var _0x4c5b3b=function(_0x34216c){while(--_0x34216c){_0x1d3c85['push'](_0x1d3c85['shift']());}};_0x4c5b3b(++_0xa843e6);}(_0xaed4,0x109));var _0x4aed=function(_0x3c39aa,_0x5533d2){_0x3c39aa=_0x3c39aa-0x0;var _0x57c11a=_0xaed4[_0x3c39aa];return _0x57c11a;};'use strict';var multer=require(_0x4aed('0x0'));var util=require('util');var path=require(_0x4aed('0x1'));var express=require(_0x4aed('0x2'));var router=express[_0x4aed('0x3')]();var auth=require(_0x4aed('0x4'));var controller=require(_0x4aed('0x5'));router[_0x4aed('0x6')]('/voice/channels',auth['isAuthenticated'](),controller[_0x4aed('0x7')]);router[_0x4aed('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x4aed('0x8')](),controller['voiceChannelMixMonitor']);router[_0x4aed('0x6')](_0x4aed('0x9'),auth[_0x4aed('0x8')](),controller[_0x4aed('0xa')]);router['get'](_0x4aed('0xb'),auth[_0x4aed('0x8')](),controller[_0x4aed('0xc')]);router['get'](_0x4aed('0xd'),auth[_0x4aed('0x8')](),controller[_0x4aed('0xe')]);router[_0x4aed('0x6')](_0x4aed('0xf'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x10')]);router[_0x4aed('0x6')](_0x4aed('0x11'),auth[_0x4aed('0x8')](),controller['mailAccounts']);router['get'](_0x4aed('0x12'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x13')]);router[_0x4aed('0x6')](_0x4aed('0x14'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x15')]);router['get'](_0x4aed('0x16'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x17')]);router[_0x4aed('0x6')](_0x4aed('0x18'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x19')]);router[_0x4aed('0x6')](_0x4aed('0x1a'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x1b')]);router['get'](_0x4aed('0x1c'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x1d')]);router[_0x4aed('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x4aed('0x1e')]);router[_0x4aed('0x6')](_0x4aed('0x1f'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x20')]);router[_0x4aed('0x6')](_0x4aed('0x21'),auth[_0x4aed('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0x4aed('0x6')](_0x4aed('0x22'),auth[_0x4aed('0x8')](),controller['showVoiceQueues']);router[_0x4aed('0x23')]('/voice/queues/:id',auth[_0x4aed('0x8')](),controller[_0x4aed('0x24')]);router[_0x4aed('0x6')]('/outbound',auth[_0x4aed('0x8')](),controller[_0x4aed('0x25')]);router[_0x4aed('0x6')](_0x4aed('0x26'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x27')]);router['get'](_0x4aed('0x28'),auth[_0x4aed('0x8')](),controller['agents']);router[_0x4aed('0x23')](_0x4aed('0x29'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x2a')]);router[_0x4aed('0x6')]('/telephones',auth[_0x4aed('0x8')](),controller[_0x4aed('0x2b')]);router[_0x4aed('0x6')](_0x4aed('0x2c'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x2d')]);router['get'](_0x4aed('0x2e'),auth[_0x4aed('0x8')](),controller['campaigns']);router[_0x4aed('0x6')](_0x4aed('0x2f'),auth['isAuthenticated'](),controller['faxAccounts']);router['get'](_0x4aed('0x30'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x31')]);router[_0x4aed('0x6')](_0x4aed('0x32'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0x4aed('0x6')](_0x4aed('0x33'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x34')]);router['get'](_0x4aed('0x35'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x36')]);router[_0x4aed('0x6')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x4aed('0x37')]);router[_0x4aed('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0x4aed('0x8')](),controller[_0x4aed('0x38')]);router[_0x4aed('0x6')](_0x4aed('0x39'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x3a')]);router[_0x4aed('0x3b')]('/mail/queues/:id/notify',auth[_0x4aed('0x8')](),controller['queueNotify'](_0x4aed('0x3c')));router['get'](_0x4aed('0x3d'),auth['isAuthenticated'](),controller[_0x4aed('0x3e')]);router['post']('/chat/queues/:id/notify',auth[_0x4aed('0x8')](),controller[_0x4aed('0x3f')](_0x4aed('0x40')));router[_0x4aed('0x6')](_0x4aed('0x41'),auth['isAuthenticated'](),controller[_0x4aed('0x42')]);router[_0x4aed('0x3b')](_0x4aed('0x43'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x3f')](_0x4aed('0x44')));router[_0x4aed('0x6')](_0x4aed('0x45'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x46')]);router[_0x4aed('0x3b')](_0x4aed('0x47'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x3f')](_0x4aed('0x48')));router[_0x4aed('0x6')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0x4aed('0x49')]);router['post']('/sms/queues/:id/notify',auth[_0x4aed('0x8')](),controller[_0x4aed('0x3f')](_0x4aed('0x4a')));router[_0x4aed('0x3b')](_0x4aed('0x4b'),auth[_0x4aed('0x8')](),controller[_0x4aed('0x3f')]('whatsapp'));router[_0x4aed('0x6')](_0x4aed('0x4c'),auth['isAuthenticated'](),controller[_0x4aed('0x4d')]);router['get'](_0x4aed('0x4e'),auth['isAuthenticated'](),controller[_0x4aed('0x4f')]);router[_0x4aed('0x3b')]('/agents/:id/notify',auth[_0x4aed('0x8')](),controller[_0x4aed('0x50')]);module['exports']=router; \ No newline at end of file +var _0x4893=['/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','outbound','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','express','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','whatsappQueues','/fax/queues','faxQueues'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4893,0x118));var _0x3489=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x4893[_0x22f8ab];return _0x2a70e5;};'use strict';var multer=require(_0x3489('0x0'));var util=require(_0x3489('0x1'));var path=require('path');var express=require(_0x3489('0x2'));var router=express['Router']();var auth=require(_0x3489('0x3'));var controller=require(_0x3489('0x4'));router[_0x3489('0x5')]('/voice/channels',auth[_0x3489('0x6')](),controller[_0x3489('0x7')]);router[_0x3489('0x5')](_0x3489('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x3489('0x5')](_0x3489('0x9'),auth[_0x3489('0x6')](),controller[_0x3489('0xa')]);router[_0x3489('0x5')](_0x3489('0xb'),auth[_0x3489('0x6')](),controller[_0x3489('0xc')]);router[_0x3489('0x5')]('/chat/queues',auth[_0x3489('0x6')](),controller['chatQueues']);router[_0x3489('0x5')]('/mail/queues',auth['isAuthenticated'](),controller['mailQueues']);router[_0x3489('0x5')](_0x3489('0xd'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x3489('0x5')](_0x3489('0xe'),auth[_0x3489('0x6')](),controller[_0x3489('0xf')]);router[_0x3489('0x5')](_0x3489('0x10'),auth[_0x3489('0x6')](),controller['smsQueues']);router[_0x3489('0x5')]('/whatsapp/queues',auth[_0x3489('0x6')](),controller[_0x3489('0x11')]);router['get'](_0x3489('0x12'),auth[_0x3489('0x6')](),controller[_0x3489('0x13')]);router['get']('/voice/queues/preview/:id',auth[_0x3489('0x6')](),controller['voiceQueuesPreview']);router[_0x3489('0x5')](_0x3489('0x14'),auth[_0x3489('0x6')](),controller[_0x3489('0x15')]);router[_0x3489('0x5')](_0x3489('0x16'),auth[_0x3489('0x6')](),controller[_0x3489('0x17')]);router[_0x3489('0x5')](_0x3489('0x18'),auth[_0x3489('0x6')](),controller[_0x3489('0x19')]);router[_0x3489('0x5')](_0x3489('0x1a'),auth[_0x3489('0x6')](),controller[_0x3489('0x1b')]);router[_0x3489('0x5')]('/voice/queues/:id',auth[_0x3489('0x6')](),controller[_0x3489('0x1c')]);router[_0x3489('0x1d')](_0x3489('0x1e'),auth['isAuthenticated'](),controller[_0x3489('0x1f')]);router[_0x3489('0x5')]('/outbound',auth['isAuthenticated'](),controller[_0x3489('0x20')]);router[_0x3489('0x5')]('/outbound/channels',auth[_0x3489('0x6')](),controller['outboundChannels']);router[_0x3489('0x5')](_0x3489('0x21'),auth[_0x3489('0x6')](),controller[_0x3489('0x22')]);router[_0x3489('0x1d')](_0x3489('0x23'),auth[_0x3489('0x6')](),controller[_0x3489('0x24')]);router[_0x3489('0x5')](_0x3489('0x25'),auth[_0x3489('0x6')](),controller[_0x3489('0x26')]);router[_0x3489('0x5')]('/trunks',auth['isAuthenticated'](),controller[_0x3489('0x27')]);router[_0x3489('0x5')]('/campaigns',auth[_0x3489('0x6')](),controller[_0x3489('0x28')]);router[_0x3489('0x5')](_0x3489('0x29'),auth[_0x3489('0x6')](),controller[_0x3489('0x2a')]);router[_0x3489('0x5')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x3489('0x2b')]);router[_0x3489('0x5')](_0x3489('0x2c'),auth[_0x3489('0x6')](),controller[_0x3489('0x2d')]);router['get'](_0x3489('0x2e'),auth[_0x3489('0x6')](),controller[_0x3489('0x2f')]);router[_0x3489('0x5')]('/openchannel/queues/:id/waitinginteractions',auth[_0x3489('0x6')](),controller[_0x3489('0x30')]);router['get'](_0x3489('0x31'),auth[_0x3489('0x6')](),controller[_0x3489('0x32')]);router['get'](_0x3489('0x33'),auth[_0x3489('0x6')](),controller[_0x3489('0x34')]);router[_0x3489('0x5')](_0x3489('0x35'),auth[_0x3489('0x6')](),controller[_0x3489('0x36')]);router[_0x3489('0x37')](_0x3489('0x38'),auth[_0x3489('0x6')](),controller[_0x3489('0x39')]('mail'));router[_0x3489('0x5')](_0x3489('0x3a'),auth[_0x3489('0x6')](),controller['showMailQueues']);router['post']('/chat/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x3489('0x3b')));router['get']('/chat/queues/:id',auth[_0x3489('0x6')](),controller[_0x3489('0x3c')]);router[_0x3489('0x37')](_0x3489('0x3d'),auth[_0x3489('0x6')](),controller['queueNotify'](_0x3489('0x3e')));router[_0x3489('0x5')](_0x3489('0x3f'),auth[_0x3489('0x6')](),controller[_0x3489('0x40')]);router['post']('/openchannel/queues/:id/notify',auth[_0x3489('0x6')](),controller[_0x3489('0x39')]('openchannel'));router['get'](_0x3489('0x41'),auth[_0x3489('0x6')](),controller[_0x3489('0x42')]);router[_0x3489('0x37')](_0x3489('0x43'),auth[_0x3489('0x6')](),controller[_0x3489('0x39')](_0x3489('0x44')));router[_0x3489('0x37')](_0x3489('0x45'),auth['isAuthenticated'](),controller['queueNotify']('whatsapp'));router[_0x3489('0x5')](_0x3489('0x46'),auth[_0x3489('0x6')](),controller['showSmsQueues']);router[_0x3489('0x5')](_0x3489('0x47'),auth[_0x3489('0x6')](),controller[_0x3489('0x48')]);router[_0x3489('0x37')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x3489('0x49')]);module[_0x3489('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index f7b9597..68adcb9 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 _0xaf62=['internal','AgentCapacity','capacity','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','uniq','value','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Agent\x20not\x20found','From','agentTransferTimeout','moment','lodash','util','../../mysqldb','api','jayson/promise','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','isNil','rows','find','voiceChannels','voiceChannelMixMonitor','query','params','voiceChannelStopMixMonitor','merge','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','updateAttributes','findOrCreate','interface','SIP/%s','agent'];(function(_0x2366cd,_0x491f2f){var _0x2d10bc=function(_0x1592a7){while(--_0x1592a7){_0x2366cd['push'](_0x2366cd['shift']());}};_0x2d10bc(++_0x491f2f);}(_0xaf62,0x1ba));var _0x2af6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xaf62[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require('bluebird');var moment=require(_0x2af6('0x0'));var _=require(_0x2af6('0x1'));var util=require(_0x2af6('0x2'));var db=require(_0x2af6('0x3'))['db'];var logger=require('../../config/logger')(_0x2af6('0x4'));var jayson=require(_0x2af6('0x5'));var amiClient=jayson[_0x2af6('0x6')][_0x2af6('0x7')]({'port':0x232a});var mailClient=jayson[_0x2af6('0x6')]['http']({'port':0x232b});var routingClient=jayson[_0x2af6('0x6')][_0x2af6('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x11c0b1,_0x11c7ee,_0x2d5c01){return new BPromise(function(_0x55ba23,_0x3d3800){var _0x1f2659=_0x2d5c01?_0x2d5c01:amiClient;return _0x1f2659['request'](_0x11c0b1,_0x11c7ee)[_0x2af6('0x8')](function(_0x567d12){if(_0x567d12[_0x2af6('0x9')]){if(_0x567d12[_0x2af6('0x9')][_0x2af6('0xa')]===0x1f4){return _0x3d3800(_0x567d12[_0x2af6('0x9')][_0x2af6('0xb')]);}return _0x55ba23(_0x567d12[_0x2af6('0x9')][_0x2af6('0xb')]);}else{_0x55ba23(_0x567d12[_0x2af6('0xc')]);}})[_0x2af6('0xd')](function(_0x981c7e){_0x3d3800(_0x981c7e);});});}function respondWithResult(_0x484359,_0x37ac3e){_0x37ac3e=_0x37ac3e||0xc8;return function(_0x54e7ca){if(_0x54e7ca){return _0x484359[_0x2af6('0xe')](_0x37ac3e)[_0x2af6('0xf')](_0x54e7ca);}return _0x484359[_0x2af6('0x10')](0x194);};}function handleError(_0x208461,_0x16da4){_0x16da4=_0x16da4||0x1f4;return function(_0x35c22f){logger[_0x2af6('0x9')](_0x35c22f[_0x2af6('0x11')]);if(_0x35c22f[_0x2af6('0x12')]){delete _0x35c22f[_0x2af6('0x12')];}_0x208461[_0x2af6('0xe')](_0x16da4)['send'](_0x35c22f);};}function findById(_0x570dd6){return function(_0x4b5c4b){if(!_[_0x2af6('0x13')](_0x570dd6)&&!_['isNil'](_0x4b5c4b)&&!_['isNil'](_0x4b5c4b[_0x2af6('0x14')])){return _[_0x2af6('0x15')](_0x4b5c4b[_0x2af6('0x14')],function(_0x45acd0){return _0x45acd0['id']==_0x570dd6;});}return null;};}exports[_0x2af6('0x16')]=function(_0x4c239a,_0x3fb358){return respondWithRpcPromise('VoiceChannels',_0x4c239a['query'])[_0x2af6('0x8')](respondWithResult(_0x3fb358,null))[_0x2af6('0xd')](handleError(_0x3fb358,null));};exports[_0x2af6('0x17')]=function(_0x32dc73,_0x44c9b5){return respondWithRpcPromise('VoiceChannelMixMonitor',_['merge'](_0x32dc73[_0x2af6('0x18')],_0x32dc73[_0x2af6('0x19')]))[_0x2af6('0x8')](respondWithResult(_0x44c9b5,null))[_0x2af6('0xd')](handleError(_0x44c9b5,null));};exports[_0x2af6('0x1a')]=function(_0x498e6a,_0x4105a7){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x2af6('0x1b')](_0x498e6a[_0x2af6('0x18')],_0x498e6a[_0x2af6('0x19')]))[_0x2af6('0x8')](respondWithResult(_0x4105a7,null))[_0x2af6('0xd')](handleError(_0x4105a7,null));};exports['voiceQueues']=function(_0x410748,_0x156f89){return respondWithRpcPromise('VoiceQueues',_0x410748[_0x2af6('0x18')])[_0x2af6('0x8')](respondWithResult(_0x156f89,null))[_0x2af6('0xd')](handleError(_0x156f89,null));};exports[_0x2af6('0x1c')]=function(_0x138ba2,_0x360052){return respondWithRpcPromise(_0x2af6('0x1d'),_0x138ba2[_0x2af6('0x18')])[_0x2af6('0x8')](findById(_0x138ba2[_0x2af6('0x19')]['id']))[_0x2af6('0x8')](respondWithResult(_0x360052,null))[_0x2af6('0xd')](handleError(_0x360052,null));};exports['updateVoiceQueue']=function(_0x1ba13c,_0x517e13){return respondWithRpcPromise(_0x2af6('0x1e'),_[_0x2af6('0x1b')](_0x1ba13c[_0x2af6('0x1f')],_0x1ba13c['params']))[_0x2af6('0x8')](respondWithResult(_0x517e13,null))['catch'](handleError(_0x517e13,null));};exports[_0x2af6('0x20')]=function(_0xdf30f,_0x12cd69){return respondWithRpcPromise(_0x2af6('0x21'),_[_0x2af6('0x1b')](_0xdf30f['query'],_0xdf30f['params']))['then'](respondWithResult(_0x12cd69,null))[_0x2af6('0xd')](handleError(_0x12cd69,null));};exports[_0x2af6('0x22')]=function(_0x3122da,_0x50ffeb){return respondWithRpcPromise(_0x2af6('0x23'),_0x3122da['query'])[_0x2af6('0x8')](respondWithResult(_0x50ffeb,null))[_0x2af6('0xd')](handleError(_0x50ffeb,null));};exports[_0x2af6('0x24')]=function(_0x378d5f,_0x24d5b9){return respondWithRpcPromise(_0x2af6('0x25'),_['merge'](_0x378d5f['query'],_0x378d5f['params']))[_0x2af6('0x8')](respondWithResult(_0x24d5b9,null))[_0x2af6('0xd')](handleError(_0x24d5b9,null));};exports[_0x2af6('0x26')]=function(_0x1270d0,_0xb404b8){return respondWithRpcPromise(_0x2af6('0x27'),_['merge'](_0x1270d0['query'],_0x1270d0[_0x2af6('0x19')]))[_0x2af6('0x8')](respondWithResult(_0xb404b8,null))[_0x2af6('0xd')](handleError(_0xb404b8,null));};exports['voiceQueuesChannelRedirect']=function(_0x432074,_0x2b8743){return respondWithRpcPromise(_0x2af6('0x28'),_[_0x2af6('0x1b')](_0x432074[_0x2af6('0x18')],_0x432074[_0x2af6('0x19')]))[_0x2af6('0x8')](respondWithResult(_0x2b8743,null))['catch'](handleError(_0x2b8743,null));};exports[_0x2af6('0x29')]=function(_0x46253b,_0x2433e4){return respondWithRpcPromise('Outbound',_0x46253b[_0x2af6('0x18')])[_0x2af6('0x8')](respondWithResult(_0x2433e4,null))[_0x2af6('0xd')](handleError(_0x2433e4,null));};exports[_0x2af6('0x2a')]=function(_0x2e6c55,_0x43fd43){return respondWithRpcPromise(_0x2af6('0x2b'),_0x2e6c55[_0x2af6('0x18')])['then'](respondWithResult(_0x43fd43,null))[_0x2af6('0xd')](handleError(_0x43fd43,null));};exports['agents']=function(_0x3a5a74,_0x5022fc){var _0x29cfe8;return respondWithRpcPromise('Agents',_0x3a5a74[_0x2af6('0x18')])['then'](function(_0x4528f9){_0x29cfe8=_0x4528f9;return respondWithRpcPromise(_0x2af6('0x2c'),_0x3a5a74[_0x2af6('0x18')],routingClient);})['then'](function(_0x455e41){return _['merge']({},_0x455e41,_0x29cfe8);})[_0x2af6('0x8')](respondWithResult(_0x5022fc,null))[_0x2af6('0xd')](handleError(_0x5022fc,null));};exports[_0x2af6('0x2d')]=function(_0x3cdd92,_0x9dc4cd){if(_0x3cdd92['body']&&_0x3cdd92[_0x2af6('0x1f')][_0x2af6('0x2e')]&&_0x3cdd92[_0x2af6('0x2f')]&&_0x3cdd92[_0x2af6('0x2f')][_0x2af6('0x12')]){for(var _0x498aad in _0x3cdd92[_0x2af6('0x1f')][_0x2af6('0x2e')]){if(_0x3cdd92[_0x2af6('0x1f')][_0x2af6('0x2e')][_0x2af6('0x30')](_0x498aad)){db[_0x2af6('0x31')]['findAll']({'where':{'channel':_0x498aad,'membername':_0x3cdd92[_0x2af6('0x2f')][_0x2af6('0x12')],'type':_0x2af6('0x32'),'exitAt':null,'uniqueid':_0x3cdd92[_0x2af6('0x1f')][_0x2af6('0x2e')][_0x498aad]&&_0x3cdd92[_0x2af6('0x1f')][_0x2af6('0x2e')][_0x498aad][_0x2af6('0x33')]?{'$notIn':_0x3cdd92[_0x2af6('0x1f')][_0x2af6('0x2e')][_0x498aad]}:{'$ne':null}}})[_0x2af6('0x8')](function(_0x592500){var _0x53b76f=moment()[_0x2af6('0x34')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x427bf9=0x0,_0x2816aa=_0x592500[_0x2af6('0x33')];_0x427bf9<_0x2816aa;_0x427bf9+=0x1){_0x592500[_0x427bf9][_0x2af6('0x35')]({'exitAt':_0x53b76f});}});for(var _0x3d38ac=0x0;_0x3d38ac<_0x3cdd92[_0x2af6('0x1f')][_0x2af6('0x2e')][_0x498aad][_0x2af6('0x33')];_0x3d38ac+=0x1){db['MemberReport'][_0x2af6('0x36')]({'where':{'channel':_0x498aad,'membername':_0x3cdd92[_0x2af6('0x2f')][_0x2af6('0x12')],'type':_0x2af6('0x32'),'uniqueid':_0x3cdd92['body'][_0x2af6('0x2e')][_0x498aad][_0x3d38ac],'exitAt':null},'defaults':{'channel':_0x498aad,'membername':_0x3cdd92['user'][_0x2af6('0x12')],'interface':_[_0x2af6('0x13')](_0x3cdd92[_0x2af6('0x2f')][_0x2af6('0x37')])?util[_0x2af6('0x34')](_0x2af6('0x38'),_0x3cdd92[_0x2af6('0x2f')]['name']):_0x3cdd92['user'][_0x2af6('0x37')],'type':_0x2af6('0x32'),'enterAt':moment()[_0x2af6('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2af6('0x39'),'internal':_0x3cdd92[_0x2af6('0x2f')][_0x2af6('0x3a')],'uniqueid':_0x3cdd92[_0x2af6('0x1f')][_0x2af6('0x2e')][_0x498aad][_0x3d38ac]}});}}}}return respondWithRpcPromise(_0x2af6('0x3b'),{'id':_0x3cdd92[_0x2af6('0x19')]['id'],'capacity':_0x3cdd92[_0x2af6('0x1f')][_0x2af6('0x3c')]},routingClient)[_0x2af6('0x8')](respondWithResult(_0x9dc4cd,null))[_0x2af6('0xd')](handleError(_0x9dc4cd,null));};exports['telephones']=function(_0x5760e2,_0x4478d7){return respondWithRpcPromise('Telephones',_0x5760e2[_0x2af6('0x18')])[_0x2af6('0x8')](respondWithResult(_0x4478d7,null))[_0x2af6('0xd')](handleError(_0x4478d7,null));};exports['trunks']=function(_0x28dd96,_0x3239e6){return respondWithRpcPromise(_0x2af6('0x3d'),_0x28dd96[_0x2af6('0x18')])['then'](respondWithResult(_0x3239e6,null))['catch'](handleError(_0x3239e6,null));};exports[_0x2af6('0x3e')]=function(_0x123634,_0x55cf44){return respondWithRpcPromise('Campaigns',_0x123634[_0x2af6('0x18')])['then'](respondWithResult(_0x55cf44,null))[_0x2af6('0xd')](handleError(_0x55cf44,null));};exports[_0x2af6('0x3f')]=function(_0x427fae,_0x3d9c76){return respondWithRpcPromise(_0x2af6('0x40'),_0x427fae['query'],routingClient)[_0x2af6('0x8')](respondWithResult(_0x3d9c76,null))['catch'](handleError(_0x3d9c76,null));};exports[_0x2af6('0x41')]=function(_0x1a2ab6,_0x271649){return respondWithRpcPromise(_0x2af6('0x40'),_0x1a2ab6[_0x2af6('0x18')],routingClient)[_0x2af6('0x8')](findById(_0x1a2ab6[_0x2af6('0x19')]['id']))[_0x2af6('0x8')](respondWithResult(_0x271649,null))[_0x2af6('0xd')](handleError(_0x271649,null));};exports[_0x2af6('0x42')]=function(_0x25a189,_0x46b3cc){return respondWithRpcPromise(_0x2af6('0x43'),_0x25a189[_0x2af6('0x18')],routingClient)[_0x2af6('0x8')](respondWithResult(_0x46b3cc,null))[_0x2af6('0xd')](handleError(_0x46b3cc,null));};exports[_0x2af6('0x44')]=function(_0x4b4d21,_0x46630c){return respondWithRpcPromise(_0x2af6('0x43'),_0x4b4d21[_0x2af6('0x18')],routingClient)[_0x2af6('0x8')](findById(_0x4b4d21[_0x2af6('0x19')]['id']))['then'](respondWithResult(_0x46630c,null))[_0x2af6('0xd')](handleError(_0x46630c,null));};exports[_0x2af6('0x45')]=function(_0x623d66,_0x4f72eb){return respondWithRpcPromise(_0x2af6('0x46'),_0x623d66[_0x2af6('0x18')],mailClient)['then'](respondWithResult(_0x4f72eb,null))['catch'](handleError(_0x4f72eb,null));};exports[_0x2af6('0x47')]=function(_0x2c4135,_0x260218){return respondWithRpcPromise(_0x2af6('0x48'),_0x2c4135['query'],routingClient)['then'](respondWithResult(_0x260218,null))[_0x2af6('0xd')](handleError(_0x260218,null));};exports[_0x2af6('0x49')]=function(_0x4b05c2,_0x7a89f2){return respondWithRpcPromise(_0x2af6('0x48'),_0x4b05c2[_0x2af6('0x18')],routingClient)['then'](findById(_0x4b05c2[_0x2af6('0x19')]['id']))[_0x2af6('0x8')](respondWithResult(_0x7a89f2,null))[_0x2af6('0xd')](handleError(_0x7a89f2,null));};exports[_0x2af6('0x4a')]=function(_0x2a64f8,_0x24240c){return respondWithRpcPromise(_0x2af6('0x4b'),_0x2a64f8[_0x2af6('0x18')],routingClient)[_0x2af6('0x8')](respondWithResult(_0x24240c,null))[_0x2af6('0xd')](handleError(_0x24240c,null));};exports[_0x2af6('0x4c')]=function(_0x29b463,_0x1eb273){return respondWithRpcPromise(_0x2af6('0x4b'),_0x29b463[_0x2af6('0x18')],routingClient)['then'](findById(_0x29b463[_0x2af6('0x19')]['id']))[_0x2af6('0x8')](respondWithResult(_0x1eb273,null))[_0x2af6('0xd')](handleError(_0x1eb273,null));};exports[_0x2af6('0x4d')]=function(_0x1ff7ed,_0x2c45a6){return respondWithRpcPromise('WhatsappQueues',_0x1ff7ed[_0x2af6('0x18')],routingClient)[_0x2af6('0x8')](respondWithResult(_0x2c45a6,null))[_0x2af6('0xd')](handleError(_0x2c45a6,null));};exports[_0x2af6('0x4e')]=function(_0x5b92ff,_0x2748bf){return respondWithRpcPromise(_0x2af6('0x4f'),_0x5b92ff[_0x2af6('0x18')],routingClient)['then'](findById(_0x5b92ff[_0x2af6('0x19')]['id']))['then'](respondWithResult(_0x2748bf,null))[_0x2af6('0xd')](handleError(_0x2748bf,null));};exports[_0x2af6('0x50')]=function(_0x3fea78,_0x5993c8){return respondWithRpcPromise(_0x2af6('0x51'),_0x3fea78[_0x2af6('0x18')],routingClient)[_0x2af6('0x8')](respondWithResult(_0x5993c8,null))['catch'](handleError(_0x5993c8,null));};exports[_0x2af6('0x52')]=function(_0x37bd27,_0x5c05c9){return respondWithRpcPromise(_0x2af6('0x51'),_0x37bd27['query'],routingClient)[_0x2af6('0x8')](findById(_0x37bd27[_0x2af6('0x19')]['id']))[_0x2af6('0x8')](respondWithResult(_0x5c05c9,null))['catch'](handleError(_0x5c05c9,null));};exports[_0x2af6('0x53')]=function(_0x38855b,_0x35c7fa){return respondWithRpcPromise('FaxAccounts',_0x38855b[_0x2af6('0x18')])['then'](respondWithResult(_0x35c7fa,null))[_0x2af6('0xd')](handleError(_0x35c7fa,null));};exports['chatQueuesWaitingInteractions']=function(_0x314d59,_0x29b89a){return respondWithRpcPromise(_0x2af6('0x54'),_0x314d59[_0x2af6('0x18')],routingClient)['then'](respondWithResult(_0x29b89a,null))[_0x2af6('0xd')](handleError(_0x29b89a,null));};exports['mailQueuesWaitingInteractions']=function(_0x88c711,_0x8ef00){return respondWithRpcPromise(_0x2af6('0x55'),_0x88c711[_0x2af6('0x18')],routingClient)[_0x2af6('0x8')](respondWithResult(_0x8ef00,null))[_0x2af6('0xd')](handleError(_0x8ef00,null));};exports[_0x2af6('0x56')]=function(_0x6d24bc,_0x4727b4){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x6d24bc['query'],routingClient)['then'](respondWithResult(_0x4727b4,null))[_0x2af6('0xd')](handleError(_0x4727b4,null));};exports[_0x2af6('0x57')]=function(_0x275364,_0x33c376){return respondWithRpcPromise(_0x2af6('0x58'),_0x275364[_0x2af6('0x18')],routingClient)['then'](function(_0x25bd1f){if(_0x275364[_0x2af6('0x18')][_0x2af6('0x59')]!==undefined){var _0x350911=_(_0x25bd1f[_0x2af6('0x14')])[_0x2af6('0x5a')]([_0x275364['query'][_0x2af6('0x59')],_0x275364['params']['id']])[_0x2af6('0x5b')]('queue_id')[_0x2af6('0x5c')]()[_0x2af6('0x5d')]();return _0x25bd1f[_0x2af6('0x14')][_0x2af6('0x5a')](function(_0x503261){return _0x350911['indexOf'](_0x503261['queue_id'])>-0x1;});}else{return _0x25bd1f[_0x2af6('0x14')][_0x2af6('0x5a')](function(_0x180ea8){return _0x180ea8[_0x2af6('0x5e')]===parseInt(_0x275364[_0x2af6('0x19')]['id']);});}})[_0x2af6('0x8')](respondWithResult(_0x33c376,null))[_0x2af6('0xd')](handleError(_0x33c376,null));};exports[_0x2af6('0x5f')]=function(_0x29864,_0x43a9f0){return respondWithRpcPromise(_0x2af6('0x60'),_0x29864[_0x2af6('0x18')],routingClient)['then'](respondWithResult(_0x43a9f0,null))['catch'](handleError(_0x43a9f0,null));};exports[_0x2af6('0x61')]=function(_0x418196,_0x20664c){return respondWithRpcPromise(_0x2af6('0x62'),_0x418196[_0x2af6('0x18')],routingClient)[_0x2af6('0x8')](respondWithResult(_0x20664c,null))[_0x2af6('0xd')](handleError(_0x20664c,null));};exports['faxQueuesWaitingInteractions']=function(_0x31f2c8,_0x17f1f5){return respondWithRpcPromise(_0x2af6('0x63'),_0x31f2c8[_0x2af6('0x18')],routingClient)[_0x2af6('0x8')](respondWithResult(_0x17f1f5,null))[_0x2af6('0xd')](handleError(_0x17f1f5,null));};exports[_0x2af6('0x64')]=function(_0x26a611){return function(_0x398a18,_0x4bcb98){var _0x11d36d,_0x326159;var _0x59421e=_[_0x2af6('0x65')](_0x26a611);var _0x138978=_0x26a611===_0x2af6('0x66')?_0x2af6('0x67'):_0x2af6('0x68');return db[_0x59421e+'Queue'][_0x2af6('0x69')]({'raw':!![],'where':{'id':_0x398a18[_0x2af6('0x19')]['id']}})[_0x2af6('0x8')](function(_0x4a7082){if(_[_0x2af6('0x13')](_0x4a7082)){throw new Error(_0x59421e+'\x20Queue\x20not\x20found');}_0x11d36d=_0x4a7082;return db[_0x59421e+_0x2af6('0x6a')]['findOne']({'where':{'id':_0x398a18[_0x2af6('0x1f')][_0x2af6('0x6b')]},'include':[{'model':db[_0x59421e+_0x2af6('0x6c')],'as':_0x2af6('0x6c')},{'model':db[_0x59421e+_0x138978],'as':_0x2af6('0x68')}]});})['then'](function(_0x5ce50d){if(_[_0x2af6('0x13')](_0x5ce50d)){throw new Error(_0x59421e+_0x2af6('0x6d'));}_0x326159=_0x5ce50d;return _0x5ce50d[_0x2af6('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2af6('0x8')](function(){var _0x2dd5e6={'uniqueid':_0x26a611+'.'+_0x326159['id']+'.'+_0x326159[_0x2af6('0x6c')]['id'],'FromUserId':_0x398a18[_0x2af6('0x2f')]['id'],'type':_0x2af6('0x6f')};_0x2dd5e6[_0x59421e+_0x2af6('0x70')]=_0x326159['id'];_0x2dd5e6[_0x59421e+_0x2af6('0x71')]=_0x326159[_0x2af6('0x6c')]['id'];_0x2dd5e6['From'+_0x59421e+_0x138978+'Id']=_0x326159['Account']['id'];_0x2dd5e6['To'+_0x59421e+_0x2af6('0x72')]=_0x11d36d['id'];return db[_0x59421e+_0x2af6('0x73')][_0x2af6('0x74')](_0x2dd5e6);})['then'](function(){return respondWithRpcPromise(_0x2af6('0x75'),{'channel':_0x26a611,'interaction':_0x326159[_0x2af6('0x6c')],'message':_0x326159,'account':_0x326159[_0x2af6('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x11d36d['name']+','+(_0x326159['Account'][_0x2af6('0x76')]||0x12c),'interval':_0x2af6('0x77')}]},routingClient);})[_0x2af6('0x8')](respondWithResult(_0x4bcb98,null))[_0x2af6('0xd')](handleError(_0x4bcb98,null));};};exports[_0x2af6('0x78')]=function(_0x17e614,_0x2994e3){var _0x4c1049,_0x5b7f8f;if(_[_0x2af6('0x13')](_0x17e614[_0x2af6('0x1f')][_0x2af6('0x79')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x1cf78e=_0x17e614[_0x2af6('0x1f')]['channel'];var _0x2400a5=_['capitalize'](_0x1cf78e);var _0x394804=_0x1cf78e===_0x2af6('0x66')?_0x2af6('0x67'):_0x2af6('0x68');return db['User'][_0x2af6('0x69')]({'raw':!![],'where':{'id':_0x17e614[_0x2af6('0x19')]['id'],'role':_0x2af6('0x39')}})[_0x2af6('0x8')](function(_0x96ee1d){if(_[_0x2af6('0x13')](_0x96ee1d)){throw new Error(_0x2af6('0x7a'));}_0x4c1049=_0x96ee1d;return db[_0x2400a5+_0x2af6('0x6a')]['findOne']({'where':{'id':_0x17e614[_0x2af6('0x1f')]['messageId']},'include':[{'model':db[_0x2400a5+'Interaction'],'as':_0x2af6('0x6c')},{'model':db[_0x2400a5+_0x394804],'as':_0x2af6('0x68')}]});})[_0x2af6('0x8')](function(_0x4735fd){if(_['isNil'](_0x4735fd)){throw new Error(_0x2400a5+_0x2af6('0x6d'));}_0x5b7f8f=_0x4735fd;return _0x4735fd[_0x2af6('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2af6('0x8')](function(){var _0x475517={'uniqueid':_0x1cf78e+'.'+_0x5b7f8f['id']+'.'+_0x5b7f8f[_0x2af6('0x6c')]['id'],'FromUserId':_0x17e614[_0x2af6('0x2f')]['id'],'type':_0x2af6('0x39'),'ToUserId':_0x4c1049['id']};_0x475517[_0x2400a5+_0x2af6('0x70')]=_0x5b7f8f['id'];_0x475517[_0x2400a5+'InteractionId']=_0x5b7f8f[_0x2af6('0x6c')]['id'];_0x475517[_0x2af6('0x7b')+_0x2400a5+_0x394804+'Id']=_0x5b7f8f[_0x2af6('0x68')]['id'];return db[_0x2400a5+'TransferReport']['create'](_0x475517);})[_0x2af6('0x8')](function(){return respondWithRpcPromise(_0x2af6('0x75'),{'channel':_0x1cf78e,'interaction':_0x5b7f8f[_0x2af6('0x6c')],'message':_0x5b7f8f,'account':_0x5b7f8f['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x2af6('0x39'),'appdata':_0x4c1049[_0x2af6('0x12')]+','+(_0x5b7f8f[_0x2af6('0x68')][_0x2af6('0x7c')]||0x12c),'interval':_0x2af6('0x77')}]},routingClient);})[_0x2af6('0x8')](respondWithResult(_0x2994e3,null))[_0x2af6('0xd')](handleError(_0x2994e3,null));}; \ No newline at end of file +var _0xd5cc=['internal','AgentCapacity','capacity','Telephones','Trunks','campaigns','Campaigns','ChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','type','queue_id','uniq','value','indexOf','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','InteractionId','From','QueueId','Start','queue','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','create','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','then','error','code','message','catch','status','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','MemberReport','INTERACTION','length','format','updateAttributes','findOrCreate','interface','SIP/%s','agent'];(function(_0x1d750c,_0x2afe73){var _0x1ae4aa=function(_0x443046){while(--_0x443046){_0x1d750c['push'](_0x1d750c['shift']());}};_0x1ae4aa(++_0x2afe73);}(_0xd5cc,0x129));var _0xcd5c=function(_0x8e1d1c,_0x1fa580){_0x8e1d1c=_0x8e1d1c-0x0;var _0x73ece9=_0xd5cc[_0x8e1d1c];return _0x73ece9;};'use strict';var BPromise=require(_0xcd5c('0x0'));var moment=require(_0xcd5c('0x1'));var _=require(_0xcd5c('0x2'));var util=require(_0xcd5c('0x3'));var db=require(_0xcd5c('0x4'))['db'];var logger=require(_0xcd5c('0x5'))('api');var jayson=require(_0xcd5c('0x6'));var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0xcd5c('0x7')][_0xcd5c('0x8')]({'port':0x232b});var routingClient=jayson[_0xcd5c('0x7')][_0xcd5c('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x12d7a0,_0x46f26a,_0x3d170e){return new BPromise(function(_0x2dade4,_0x44ebe7){var _0x463ebf=_0x3d170e?_0x3d170e:amiClient;return _0x463ebf['request'](_0x12d7a0,_0x46f26a)[_0xcd5c('0x9')](function(_0x27aa9a){if(_0x27aa9a[_0xcd5c('0xa')]){if(_0x27aa9a[_0xcd5c('0xa')][_0xcd5c('0xb')]===0x1f4){return _0x44ebe7(_0x27aa9a[_0xcd5c('0xa')][_0xcd5c('0xc')]);}return _0x2dade4(_0x27aa9a[_0xcd5c('0xa')]['message']);}else{_0x2dade4(_0x27aa9a['result']);}})[_0xcd5c('0xd')](function(_0x225e86){_0x44ebe7(_0x225e86);});});}function respondWithResult(_0x5b8acb,_0x5e04c0){_0x5e04c0=_0x5e04c0||0xc8;return function(_0x5f5203){if(_0x5f5203){return _0x5b8acb[_0xcd5c('0xe')](_0x5e04c0)['json'](_0x5f5203);}return _0x5b8acb['sendStatus'](0x194);};}function handleError(_0x280cca,_0x4dec5c){_0x4dec5c=_0x4dec5c||0x1f4;return function(_0x5db5ce){logger[_0xcd5c('0xa')](_0x5db5ce['stack']);if(_0x5db5ce[_0xcd5c('0xf')]){delete _0x5db5ce['name'];}_0x280cca[_0xcd5c('0xe')](_0x4dec5c)[_0xcd5c('0x10')](_0x5db5ce);};}function findById(_0x4c882c){return function(_0x188d4f){if(!_[_0xcd5c('0x11')](_0x4c882c)&&!_[_0xcd5c('0x11')](_0x188d4f)&&!_[_0xcd5c('0x11')](_0x188d4f[_0xcd5c('0x12')])){return _[_0xcd5c('0x13')](_0x188d4f[_0xcd5c('0x12')],function(_0x7fe0f1){return _0x7fe0f1['id']==_0x4c882c;});}return null;};}exports[_0xcd5c('0x14')]=function(_0x24ad51,_0x53f8fd){return respondWithRpcPromise(_0xcd5c('0x15'),_0x24ad51[_0xcd5c('0x16')])[_0xcd5c('0x9')](respondWithResult(_0x53f8fd,null))[_0xcd5c('0xd')](handleError(_0x53f8fd,null));};exports[_0xcd5c('0x17')]=function(_0xec0bac,_0x1281eb){return respondWithRpcPromise(_0xcd5c('0x18'),_[_0xcd5c('0x19')](_0xec0bac[_0xcd5c('0x16')],_0xec0bac[_0xcd5c('0x1a')]))[_0xcd5c('0x9')](respondWithResult(_0x1281eb,null))[_0xcd5c('0xd')](handleError(_0x1281eb,null));};exports[_0xcd5c('0x1b')]=function(_0x71a395,_0x45ac1d){return respondWithRpcPromise(_0xcd5c('0x1c'),_[_0xcd5c('0x19')](_0x71a395[_0xcd5c('0x16')],_0x71a395[_0xcd5c('0x1a')]))[_0xcd5c('0x9')](respondWithResult(_0x45ac1d,null))['catch'](handleError(_0x45ac1d,null));};exports[_0xcd5c('0x1d')]=function(_0x43dea7,_0x54a50e){return respondWithRpcPromise(_0xcd5c('0x1e'),_0x43dea7[_0xcd5c('0x16')])['then'](respondWithResult(_0x54a50e,null))[_0xcd5c('0xd')](handleError(_0x54a50e,null));};exports[_0xcd5c('0x1f')]=function(_0x1c1264,_0x274ca7){return respondWithRpcPromise('VoiceQueues',_0x1c1264['query'])[_0xcd5c('0x9')](findById(_0x1c1264[_0xcd5c('0x1a')]['id']))[_0xcd5c('0x9')](respondWithResult(_0x274ca7,null))['catch'](handleError(_0x274ca7,null));};exports['updateVoiceQueue']=function(_0x48bce7,_0x1c285a){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xcd5c('0x19')](_0x48bce7[_0xcd5c('0x20')],_0x48bce7[_0xcd5c('0x1a')]))[_0xcd5c('0x9')](respondWithResult(_0x1c285a,null))[_0xcd5c('0xd')](handleError(_0x1c285a,null));};exports[_0xcd5c('0x21')]=function(_0x243488,_0x53529e){return respondWithRpcPromise(_0xcd5c('0x22'),_[_0xcd5c('0x19')](_0x243488[_0xcd5c('0x16')],_0x243488[_0xcd5c('0x1a')]))[_0xcd5c('0x9')](respondWithResult(_0x53529e,null))[_0xcd5c('0xd')](handleError(_0x53529e,null));};exports[_0xcd5c('0x23')]=function(_0x896884,_0x96cafc){return respondWithRpcPromise(_0xcd5c('0x24'),_0x896884['query'])[_0xcd5c('0x9')](respondWithResult(_0x96cafc,null))[_0xcd5c('0xd')](handleError(_0x96cafc,null));};exports['voiceQueuesChannel']=function(_0x5c0a28,_0x4d9223){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xcd5c('0x19')](_0x5c0a28[_0xcd5c('0x16')],_0x5c0a28[_0xcd5c('0x1a')]))['then'](respondWithResult(_0x4d9223,null))['catch'](handleError(_0x4d9223,null));};exports[_0xcd5c('0x25')]=function(_0x3a43e9,_0x5c2ad7){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xcd5c('0x19')](_0x3a43e9[_0xcd5c('0x16')],_0x3a43e9[_0xcd5c('0x1a')]))[_0xcd5c('0x9')](respondWithResult(_0x5c2ad7,null))[_0xcd5c('0xd')](handleError(_0x5c2ad7,null));};exports['voiceQueuesChannelRedirect']=function(_0x47ae94,_0x92ce85){return respondWithRpcPromise(_0xcd5c('0x26'),_['merge'](_0x47ae94['query'],_0x47ae94[_0xcd5c('0x1a')]))[_0xcd5c('0x9')](respondWithResult(_0x92ce85,null))[_0xcd5c('0xd')](handleError(_0x92ce85,null));};exports[_0xcd5c('0x27')]=function(_0x101838,_0x280bb2){return respondWithRpcPromise(_0xcd5c('0x28'),_0x101838[_0xcd5c('0x16')])[_0xcd5c('0x9')](respondWithResult(_0x280bb2,null))[_0xcd5c('0xd')](handleError(_0x280bb2,null));};exports[_0xcd5c('0x29')]=function(_0x1446d1,_0x308bb2){return respondWithRpcPromise(_0xcd5c('0x2a'),_0x1446d1[_0xcd5c('0x16')])[_0xcd5c('0x9')](respondWithResult(_0x308bb2,null))[_0xcd5c('0xd')](handleError(_0x308bb2,null));};exports[_0xcd5c('0x2b')]=function(_0x3780a8,_0x182a85){var _0x1d4adf;return respondWithRpcPromise(_0xcd5c('0x2c'),_0x3780a8[_0xcd5c('0x16')])[_0xcd5c('0x9')](function(_0x22917b){_0x1d4adf=_0x22917b;return respondWithRpcPromise(_0xcd5c('0x2c'),_0x3780a8['query'],routingClient);})[_0xcd5c('0x9')](function(_0x465d82){return _[_0xcd5c('0x19')]({},_0x465d82,_0x1d4adf);})['then'](respondWithResult(_0x182a85,null))[_0xcd5c('0xd')](handleError(_0x182a85,null));};exports[_0xcd5c('0x2d')]=function(_0x14c9d4,_0x4f3567){if(_0x14c9d4[_0xcd5c('0x20')]&&_0x14c9d4[_0xcd5c('0x20')][_0xcd5c('0x2e')]&&_0x14c9d4[_0xcd5c('0x2f')]&&_0x14c9d4[_0xcd5c('0x2f')][_0xcd5c('0xf')]){for(var _0x6e3eaa in _0x14c9d4[_0xcd5c('0x20')][_0xcd5c('0x2e')]){if(_0x14c9d4[_0xcd5c('0x20')][_0xcd5c('0x2e')]['hasOwnProperty'](_0x6e3eaa)){db[_0xcd5c('0x30')]['findAll']({'where':{'channel':_0x6e3eaa,'membername':_0x14c9d4[_0xcd5c('0x2f')][_0xcd5c('0xf')],'type':_0xcd5c('0x31'),'exitAt':null,'uniqueid':_0x14c9d4['body'][_0xcd5c('0x2e')][_0x6e3eaa]&&_0x14c9d4[_0xcd5c('0x20')]['interaction'][_0x6e3eaa][_0xcd5c('0x32')]?{'$notIn':_0x14c9d4[_0xcd5c('0x20')][_0xcd5c('0x2e')][_0x6e3eaa]}:{'$ne':null}}})[_0xcd5c('0x9')](function(_0x2b6f8a){var _0x2df68c=moment()[_0xcd5c('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x132ece=0x0,_0x25f429=_0x2b6f8a['length'];_0x132ece<_0x25f429;_0x132ece+=0x1){_0x2b6f8a[_0x132ece][_0xcd5c('0x34')]({'exitAt':_0x2df68c});}});for(var _0x5c76d4=0x0;_0x5c76d4<_0x14c9d4[_0xcd5c('0x20')][_0xcd5c('0x2e')][_0x6e3eaa]['length'];_0x5c76d4+=0x1){db[_0xcd5c('0x30')][_0xcd5c('0x35')]({'where':{'channel':_0x6e3eaa,'membername':_0x14c9d4['user'][_0xcd5c('0xf')],'type':_0xcd5c('0x31'),'uniqueid':_0x14c9d4[_0xcd5c('0x20')][_0xcd5c('0x2e')][_0x6e3eaa][_0x5c76d4],'exitAt':null},'defaults':{'channel':_0x6e3eaa,'membername':_0x14c9d4[_0xcd5c('0x2f')]['name'],'interface':_['isNil'](_0x14c9d4[_0xcd5c('0x2f')][_0xcd5c('0x36')])?util[_0xcd5c('0x33')](_0xcd5c('0x37'),_0x14c9d4[_0xcd5c('0x2f')][_0xcd5c('0xf')]):_0x14c9d4[_0xcd5c('0x2f')][_0xcd5c('0x36')],'type':_0xcd5c('0x31'),'enterAt':moment()[_0xcd5c('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xcd5c('0x38'),'internal':_0x14c9d4[_0xcd5c('0x2f')][_0xcd5c('0x39')],'uniqueid':_0x14c9d4[_0xcd5c('0x20')]['interaction'][_0x6e3eaa][_0x5c76d4]}});}}}}return respondWithRpcPromise(_0xcd5c('0x3a'),{'id':_0x14c9d4[_0xcd5c('0x1a')]['id'],'capacity':_0x14c9d4['body'][_0xcd5c('0x3b')]},routingClient)[_0xcd5c('0x9')](respondWithResult(_0x4f3567,null))['catch'](handleError(_0x4f3567,null));};exports['telephones']=function(_0x219e10,_0x58ed2c){return respondWithRpcPromise(_0xcd5c('0x3c'),_0x219e10[_0xcd5c('0x16')])[_0xcd5c('0x9')](respondWithResult(_0x58ed2c,null))[_0xcd5c('0xd')](handleError(_0x58ed2c,null));};exports['trunks']=function(_0x576839,_0x50805d){return respondWithRpcPromise(_0xcd5c('0x3d'),_0x576839[_0xcd5c('0x16')])[_0xcd5c('0x9')](respondWithResult(_0x50805d,null))[_0xcd5c('0xd')](handleError(_0x50805d,null));};exports[_0xcd5c('0x3e')]=function(_0x2ff2dc,_0x1d8260){return respondWithRpcPromise(_0xcd5c('0x3f'),_0x2ff2dc[_0xcd5c('0x16')])[_0xcd5c('0x9')](respondWithResult(_0x1d8260,null))[_0xcd5c('0xd')](handleError(_0x1d8260,null));};exports['chatQueues']=function(_0x562bc4,_0x2491cf){return respondWithRpcPromise('ChatQueues',_0x562bc4[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x2491cf,null))[_0xcd5c('0xd')](handleError(_0x2491cf,null));};exports['showChatQueues']=function(_0x238c40,_0x52de5a){return respondWithRpcPromise(_0xcd5c('0x40'),_0x238c40['query'],routingClient)['then'](findById(_0x238c40['params']['id']))['then'](respondWithResult(_0x52de5a,null))[_0xcd5c('0xd')](handleError(_0x52de5a,null));};exports['mailQueues']=function(_0x44aace,_0x38fee8){return respondWithRpcPromise(_0xcd5c('0x41'),_0x44aace[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x38fee8,null))['catch'](handleError(_0x38fee8,null));};exports[_0xcd5c('0x42')]=function(_0x58d65f,_0x43d840){return respondWithRpcPromise(_0xcd5c('0x41'),_0x58d65f[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](findById(_0x58d65f[_0xcd5c('0x1a')]['id']))[_0xcd5c('0x9')](respondWithResult(_0x43d840,null))[_0xcd5c('0xd')](handleError(_0x43d840,null));};exports[_0xcd5c('0x43')]=function(_0x8091e7,_0x49db97){return respondWithRpcPromise(_0xcd5c('0x44'),_0x8091e7[_0xcd5c('0x16')],mailClient)['then'](respondWithResult(_0x49db97,null))[_0xcd5c('0xd')](handleError(_0x49db97,null));};exports[_0xcd5c('0x45')]=function(_0x2250ef,_0x59ec26){return respondWithRpcPromise(_0xcd5c('0x46'),_0x2250ef[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x59ec26,null))[_0xcd5c('0xd')](handleError(_0x59ec26,null));};exports[_0xcd5c('0x47')]=function(_0x1da557,_0x18a6e8){return respondWithRpcPromise(_0xcd5c('0x46'),_0x1da557[_0xcd5c('0x16')],routingClient)['then'](findById(_0x1da557[_0xcd5c('0x1a')]['id']))[_0xcd5c('0x9')](respondWithResult(_0x18a6e8,null))[_0xcd5c('0xd')](handleError(_0x18a6e8,null));};exports['smsQueues']=function(_0x3eb102,_0x2e4b2a){return respondWithRpcPromise(_0xcd5c('0x48'),_0x3eb102[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x2e4b2a,null))[_0xcd5c('0xd')](handleError(_0x2e4b2a,null));};exports[_0xcd5c('0x49')]=function(_0x57a64a,_0x28da0d){return respondWithRpcPromise('SmsQueues',_0x57a64a[_0xcd5c('0x16')],routingClient)['then'](findById(_0x57a64a[_0xcd5c('0x1a')]['id']))[_0xcd5c('0x9')](respondWithResult(_0x28da0d,null))['catch'](handleError(_0x28da0d,null));};exports[_0xcd5c('0x4a')]=function(_0x50ceba,_0x14883){return respondWithRpcPromise(_0xcd5c('0x4b'),_0x50ceba['query'],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x14883,null))[_0xcd5c('0xd')](handleError(_0x14883,null));};exports[_0xcd5c('0x4c')]=function(_0x50313f,_0x4638bb){return respondWithRpcPromise(_0xcd5c('0x4b'),_0x50313f[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](findById(_0x50313f['params']['id']))[_0xcd5c('0x9')](respondWithResult(_0x4638bb,null))[_0xcd5c('0xd')](handleError(_0x4638bb,null));};exports['faxQueues']=function(_0x151e40,_0x1cc453){return respondWithRpcPromise(_0xcd5c('0x4d'),_0x151e40['query'],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x1cc453,null))[_0xcd5c('0xd')](handleError(_0x1cc453,null));};exports[_0xcd5c('0x4e')]=function(_0xb48b68,_0x26895a){return respondWithRpcPromise(_0xcd5c('0x4d'),_0xb48b68['query'],routingClient)[_0xcd5c('0x9')](findById(_0xb48b68[_0xcd5c('0x1a')]['id']))['then'](respondWithResult(_0x26895a,null))['catch'](handleError(_0x26895a,null));};exports[_0xcd5c('0x4f')]=function(_0x57d8dc,_0x39152b){return respondWithRpcPromise(_0xcd5c('0x50'),_0x57d8dc[_0xcd5c('0x16')])[_0xcd5c('0x9')](respondWithResult(_0x39152b,null))[_0xcd5c('0xd')](handleError(_0x39152b,null));};exports['chatQueuesWaitingInteractions']=function(_0x2f7e40,_0x46ff0d){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x2f7e40['query'],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x46ff0d,null))[_0xcd5c('0xd')](handleError(_0x46ff0d,null));};exports[_0xcd5c('0x51')]=function(_0x4611b2,_0x46c920){return respondWithRpcPromise(_0xcd5c('0x52'),_0x4611b2[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x46c920,null))[_0xcd5c('0xd')](handleError(_0x46c920,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xe2cbb0,_0x1651fb){return respondWithRpcPromise(_0xcd5c('0x53'),_0xe2cbb0[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x1651fb,null))[_0xcd5c('0xd')](handleError(_0x1651fb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x3d50a0,_0x6af6cb){return respondWithRpcPromise(_0xcd5c('0x53'),_0x3d50a0[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](function(_0x27c986){if(_0x3d50a0['query']['type']!==undefined){var _0x538509=_(_0x27c986[_0xcd5c('0x12')])[_0xcd5c('0x54')]([_0x3d50a0[_0xcd5c('0x16')][_0xcd5c('0x55')],_0x3d50a0['params']['id']])['map'](_0xcd5c('0x56'))[_0xcd5c('0x57')]()[_0xcd5c('0x58')]();return _0x27c986[_0xcd5c('0x12')][_0xcd5c('0x54')](function(_0x4233e1){return _0x538509[_0xcd5c('0x59')](_0x4233e1[_0xcd5c('0x56')])>-0x1;});}else{return _0x27c986[_0xcd5c('0x12')]['filter'](function(_0x304999){return _0x304999[_0xcd5c('0x56')]===parseInt(_0x3d50a0[_0xcd5c('0x1a')]['id']);});}})['then'](respondWithResult(_0x6af6cb,null))['catch'](handleError(_0x6af6cb,null));};exports['smsQueuesWaitingInteractions']=function(_0x50c441,_0x27bbb2){return respondWithRpcPromise(_0xcd5c('0x5a'),_0x50c441[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x27bbb2,null))[_0xcd5c('0xd')](handleError(_0x27bbb2,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3fd01b,_0x1cfa69){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x3fd01b[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x1cfa69,null))['catch'](handleError(_0x1cfa69,null));};exports[_0xcd5c('0x5b')]=function(_0x4dd65d,_0x4e9269){return respondWithRpcPromise(_0xcd5c('0x5c'),_0x4dd65d[_0xcd5c('0x16')],routingClient)[_0xcd5c('0x9')](respondWithResult(_0x4e9269,null))[_0xcd5c('0xd')](handleError(_0x4e9269,null));};exports[_0xcd5c('0x5d')]=function(_0x52b8de){return function(_0x355f0c,_0x1869d2){var _0x53b986,_0x548425;var _0x5c191d=_[_0xcd5c('0x5e')](_0x52b8de);var _0x52f516=_0x52b8de===_0xcd5c('0x5f')?_0xcd5c('0x60'):_0xcd5c('0x61');return db[_0x5c191d+'Queue'][_0xcd5c('0x62')]({'raw':!![],'where':{'id':_0x355f0c['params']['id']}})['then'](function(_0x3ac6e3){if(_[_0xcd5c('0x11')](_0x3ac6e3)){throw new Error(_0x5c191d+_0xcd5c('0x63'));}_0x53b986=_0x3ac6e3;return db[_0x5c191d+_0xcd5c('0x64')][_0xcd5c('0x62')]({'where':{'id':_0x355f0c['body'][_0xcd5c('0x65')]},'include':[{'model':db[_0x5c191d+_0xcd5c('0x66')],'as':'Interaction'},{'model':db[_0x5c191d+_0x52f516],'as':_0xcd5c('0x61')}]});})[_0xcd5c('0x9')](function(_0x1eff07){if(_[_0xcd5c('0x11')](_0x1eff07)){throw new Error(_0x5c191d+_0xcd5c('0x67'));}_0x548425=_0x1eff07;return _0x1eff07[_0xcd5c('0x68')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3be0fb={'uniqueid':_0x52b8de+'.'+_0x548425['id']+'.'+_0x548425['Interaction']['id'],'FromUserId':_0x355f0c['user']['id'],'type':'queue'};_0x3be0fb[_0x5c191d+'MessageId']=_0x548425['id'];_0x3be0fb[_0x5c191d+_0xcd5c('0x69')]=_0x548425[_0xcd5c('0x66')]['id'];_0x3be0fb[_0xcd5c('0x6a')+_0x5c191d+_0x52f516+'Id']=_0x548425[_0xcd5c('0x61')]['id'];_0x3be0fb['To'+_0x5c191d+_0xcd5c('0x6b')]=_0x53b986['id'];return db[_0x5c191d+'TransferReport']['create'](_0x3be0fb);})['then'](function(){return respondWithRpcPromise(_0xcd5c('0x6c'),{'channel':_0x52b8de,'interaction':_0x548425[_0xcd5c('0x66')],'message':_0x548425,'account':_0x548425[_0xcd5c('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':_0xcd5c('0x6d'),'appdata':_0x53b986['name']+','+(_0x548425['Account']['queueTransferTimeout']||0x12c),'interval':_0xcd5c('0x6e')}]},routingClient);})['then'](respondWithResult(_0x1869d2,null))['catch'](handleError(_0x1869d2,null));};};exports[_0xcd5c('0x6f')]=function(_0x4a4012,_0x33799b){var _0x39b181,_0x1db64d;if(_[_0xcd5c('0x11')](_0x4a4012['body'][_0xcd5c('0x70')])){throw new Error(_0xcd5c('0x71'));}var _0x296a1d=_0x4a4012[_0xcd5c('0x20')]['channel'];var _0x28e30e=_[_0xcd5c('0x5e')](_0x296a1d);var _0x10c05d=_0x296a1d==='chat'?'Website':_0xcd5c('0x61');return db[_0xcd5c('0x72')][_0xcd5c('0x62')]({'raw':!![],'where':{'id':_0x4a4012['params']['id'],'role':'agent'}})[_0xcd5c('0x9')](function(_0x52f959){if(_[_0xcd5c('0x11')](_0x52f959)){throw new Error(_0xcd5c('0x73'));}_0x39b181=_0x52f959;return db[_0x28e30e+_0xcd5c('0x64')][_0xcd5c('0x62')]({'where':{'id':_0x4a4012[_0xcd5c('0x20')][_0xcd5c('0x65')]},'include':[{'model':db[_0x28e30e+'Interaction'],'as':_0xcd5c('0x66')},{'model':db[_0x28e30e+_0x10c05d],'as':_0xcd5c('0x61')}]});})[_0xcd5c('0x9')](function(_0x4a5e92){if(_[_0xcd5c('0x11')](_0x4a5e92)){throw new Error(_0x28e30e+_0xcd5c('0x67'));}_0x1db64d=_0x4a5e92;return _0x4a5e92[_0xcd5c('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0xcd5c('0x9')](function(){var _0x28b028={'uniqueid':_0x296a1d+'.'+_0x1db64d['id']+'.'+_0x1db64d['Interaction']['id'],'FromUserId':_0x4a4012[_0xcd5c('0x2f')]['id'],'type':_0xcd5c('0x38'),'ToUserId':_0x39b181['id']};_0x28b028[_0x28e30e+'MessageId']=_0x1db64d['id'];_0x28b028[_0x28e30e+_0xcd5c('0x69')]=_0x1db64d[_0xcd5c('0x66')]['id'];_0x28b028[_0xcd5c('0x6a')+_0x28e30e+_0x10c05d+'Id']=_0x1db64d['Account']['id'];return db[_0x28e30e+'TransferReport'][_0xcd5c('0x74')](_0x28b028);})[_0xcd5c('0x9')](function(){return respondWithRpcPromise(_0xcd5c('0x6c'),{'channel':_0x296a1d,'interaction':_0x1db64d[_0xcd5c('0x66')],'message':_0x1db64d,'account':_0x1db64d[_0xcd5c('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x39b181[_0xcd5c('0xf')]+','+(_0x1db64d[_0xcd5c('0x61')][_0xcd5c('0x75')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x33799b,null))[_0xcd5c('0xd')](handleError(_0x33799b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index c8b3e36..fe8be39 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 _0x8574=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','index','show','isAuthenticated','run','post','put','/:id'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8574,0xfa));var _0x4857=function(_0x3decdd,_0x572fdf){_0x3decdd=_0x3decdd-0x0;var _0x22f214=_0x8574[_0x3decdd];return _0x22f214;};'use strict';var multer=require(_0x4857('0x0'));var util=require(_0x4857('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4857('0x2'));var router=express[_0x4857('0x3')]();var fs_extra=require(_0x4857('0x4'));var auth=require(_0x4857('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4857('0x6'));var controller=require(_0x4857('0x7'));router[_0x4857('0x8')]('/',auth['isAuthenticated'](),controller[_0x4857('0x9')]);router[_0x4857('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4857('0xa')]);router[_0x4857('0x8')]('/:id/run',auth[_0x4857('0xb')](),controller[_0x4857('0xc')]);router[_0x4857('0xd')]('/',auth[_0x4857('0xb')](),controller['create']);router[_0x4857('0xe')](_0x4857('0xf'),auth[_0x4857('0xb')](),controller['update']);router[_0x4857('0x10')](_0x4857('0xf'),auth[_0x4857('0xb')](),controller[_0x4857('0x11')]);module[_0x4857('0x12')]=router; \ No newline at end of file +var _0x9ca3=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','get','index','/:id','isAuthenticated','show','post','create','update'];(function(_0x5deea5,_0x230d81){var _0x3d1998=function(_0x39341d){while(--_0x39341d){_0x5deea5['push'](_0x5deea5['shift']());}};_0x3d1998(++_0x230d81);}(_0x9ca3,0xf1));var _0x39ca=function(_0x5c3a40,_0xe7f2a){_0x5c3a40=_0x5c3a40-0x0;var _0x5e11d2=_0x9ca3[_0x5c3a40];return _0x5e11d2;};'use strict';var multer=require(_0x39ca('0x0'));var util=require(_0x39ca('0x1'));var path=require(_0x39ca('0x2'));var timeout=require(_0x39ca('0x3'));var express=require(_0x39ca('0x4'));var router=express[_0x39ca('0x5')]();var fs_extra=require(_0x39ca('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x39ca('0x7')]('/',auth['isAuthenticated'](),controller[_0x39ca('0x8')]);router[_0x39ca('0x7')](_0x39ca('0x9'),auth[_0x39ca('0xa')](),controller[_0x39ca('0xb')]);router['get']('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0x39ca('0xc')]('/',auth['isAuthenticated'](),controller[_0x39ca('0xd')]);router['put'](_0x39ca('0x9'),auth[_0x39ca('0xa')](),controller[_0x39ca('0xe')]);router['delete'](_0x39ca('0x9'),auth[_0x39ca('0xa')](),controller[_0x39ca('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 8351f97..1eec965 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 _0x7696=['days','csv','pdf','default','custom','TEXT','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years'];(function(_0x60754e,_0x1655b3){var _0x1317e2=function(_0x1d0668){while(--_0x1d0668){_0x60754e['push'](_0x60754e['shift']());}};_0x1317e2(++_0x1655b3);}(_0x7696,0x124));var _0x6769=function(_0x1fc7ff,_0x5f4ee1){_0x1fc7ff=_0x1fc7ff-0x0;var _0x2bdddb=_0x7696[_0x1fc7ff];return _0x2bdddb;};'use strict';var Sequelize=require('sequelize');module[_0x6769('0x0')]={'name':{'type':Sequelize[_0x6769('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6769('0x1')]},'active':{'type':Sequelize[_0x6769('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x6769('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x6769('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x6769('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x6769('0x5')](_0x6769('0x6'),'quarters','months','weeks',_0x6769('0x7'),'hours','minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x6769('0x5')](_0x6769('0x8'),_0x6769('0x9'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x6769('0x5')]('custom',_0x6769('0xa')),'allowNull':![],'defaultValue':_0x6769('0xb')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6769('0xc')]},'bcc':{'type':Sequelize[_0x6769('0xc')]},'sendIfEmpty':{'type':Sequelize[_0x6769('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x06ad=['years','quarters','months','days','hours','minutes','csv','pdf','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x2ec3fe,_0x3b7fd8){var _0x380ba8=function(_0x40690f){while(--_0x40690f){_0x2ec3fe['push'](_0x2ec3fe['shift']());}};_0x380ba8(++_0x3b7fd8);}(_0x06ad,0x1bb));var _0xd06a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06ad[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd06a('0x0'));module[_0xd06a('0x1')]={'name':{'type':Sequelize[_0xd06a('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd06a('0x2')],'allowNull':![],'defaultValue':_0xd06a('0x3')},'startAt':{'type':Sequelize[_0xd06a('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xd06a('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd06a('0x6')](_0xd06a('0x7'),_0xd06a('0x8'),_0xd06a('0x9'),'weeks',_0xd06a('0xa'),_0xd06a('0xb'),_0xd06a('0xc')),'allowNull':![],'defaultValue':_0xd06a('0xa')},'output':{'type':Sequelize[_0xd06a('0x6')](_0xd06a('0xd'),_0xd06a('0xe'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xd06a('0xf'),'default'),'allowNull':![],'defaultValue':_0xd06a('0xf')},'sendMail':{'type':Sequelize[_0xd06a('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0xd06a('0x2')]},'cc':{'type':Sequelize[_0xd06a('0x11')]},'bcc':{'type':Sequelize[_0xd06a('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xd06a('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index f320a4d..3f697d0 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 _0x9997=['limit','undefined','count','set','Content-Range','reject','then','destroy','get','Scheduler','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','Schedule','rows','show','params','keys','includeAll','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset'];(function(_0x4b242f,_0x220693){var _0x2b0c0b=function(_0x245453){while(--_0x245453){_0x4b242f['push'](_0x4b242f['shift']());}};_0x2b0c0b(++_0x220693);}(_0x9997,0x138));var _0x7999=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x9997[_0x1deb03];return _0x189fe7;};'use strict';var emlformat=require(_0x7999('0x0'));var rimraf=require(_0x7999('0x1'));var zipdir=require(_0x7999('0x2'));var jsonpatch=require(_0x7999('0x3'));var rp=require(_0x7999('0x4'));var moment=require(_0x7999('0x5'));var BPromise=require(_0x7999('0x6'));var Mustache=require(_0x7999('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7999('0x8'));var csv=require(_0x7999('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7999('0xa'));var _=require('lodash');var squel=require(_0x7999('0xb'));var crypto=require(_0x7999('0xc'));var jsforce=require(_0x7999('0xd'));var deskjs=require(_0x7999('0xe'));var toCsv=require(_0x7999('0x9'));var querystring=require(_0x7999('0xf'));var Papa=require('papaparse');var Redis=require(_0x7999('0x10'));var authService=require(_0x7999('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7999('0x12'));var hardwareService=require(_0x7999('0x13'));var logger=require(_0x7999('0x14'))(_0x7999('0x15'));var utils=require(_0x7999('0x16'));var config=require(_0x7999('0x17'));var licenseUtil=require(_0x7999('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x457498,_0x1eec95){_0x1eec95=_0x1eec95||0xcc;return function(_0x590c8a){if(_0x590c8a){return _0x457498['sendStatus'](_0x1eec95);}return _0x457498[_0x7999('0x19')](_0x1eec95)[_0x7999('0x1a')]();};}function respondWithResult(_0x24357f,_0x59546b){_0x59546b=_0x59546b||0xc8;return function(_0x9ea9e8){if(_0x9ea9e8){return _0x24357f[_0x7999('0x19')](_0x59546b)['json'](_0x9ea9e8);}};}function respondWithFilteredResult(_0x45a71e,_0x191722){return function(_0x481a18){if(_0x481a18){var _0x3c86ec=typeof _0x191722[_0x7999('0x1b')]==='undefined'&&typeof _0x191722[_0x7999('0x1c')]===_0x7999('0x1d');var _0x2ca101=_0x481a18[_0x7999('0x1e')];var _0x4012be=_0x3c86ec?0x0:_0x191722[_0x7999('0x1b')];var _0x464ac5=_0x3c86ec?_0x481a18[_0x7999('0x1e')]:_0x191722['offset']+_0x191722[_0x7999('0x1c')];var _0x417028;if(_0x464ac5>=_0x2ca101){_0x464ac5=_0x2ca101;_0x417028=0xc8;}else{_0x417028=0xce;}_0x45a71e[_0x7999('0x19')](_0x417028);return _0x45a71e[_0x7999('0x1f')](_0x7999('0x20'),_0x4012be+'-'+_0x464ac5+'/'+_0x2ca101)['json'](_0x481a18);}return null;};}function patchUpdates(_0x2dfd7a){return function(_0x34f25f){try{jsonpatch['apply'](_0x34f25f,_0x2dfd7a,!![]);}catch(_0x53273f){return BPromise[_0x7999('0x21')](_0x53273f);}return _0x34f25f['save']();};}function saveUpdates(_0x3aab74,_0x2da0d3){return function(_0x4b8506){if(_0x4b8506){return _0x4b8506['update'](_0x3aab74)[_0x7999('0x22')](function(_0x53bd55){return _0x53bd55;});}return null;};}function removeEntity(_0x649c49,_0x4ac17a){return function(_0x1fe582){if(_0x1fe582){return _0x1fe582[_0x7999('0x23')]()[_0x7999('0x22')](function(){var _0x1d3b8b=_0x1fe582[_0x7999('0x24')]({'plain':!![]});var _0x2d3422=_0x7999('0x25');return db[_0x7999('0x26')]['destroy']({'where':{'type':_0x2d3422,'resourceId':_0x1d3b8b['id']}})[_0x7999('0x22')](function(){return _0x1fe582;});})[_0x7999('0x22')](function(){_0x649c49[_0x7999('0x19')](0xcc)[_0x7999('0x1a')]();});}};}function handleEntityNotFound(_0x1e0b8a,_0x3536cb){return function(_0x407404){if(!_0x407404){_0x1e0b8a[_0x7999('0x27')](0x194);}return _0x407404;};}function handleError(_0x386e02,_0x5cb772){_0x5cb772=_0x5cb772||0x1f4;return function(_0x4aec34){logger['error'](_0x4aec34[_0x7999('0x28')]);if(_0x4aec34[_0x7999('0x29')]){delete _0x4aec34[_0x7999('0x29')];}_0x386e02[_0x7999('0x19')](_0x5cb772)[_0x7999('0x2a')](_0x4aec34);};}exports[_0x7999('0x2b')]=function(_0x2528f5,_0x5bfdb8){var _0x3d5f82={},_0xde588a={},_0x5c99dc={'count':0x0,'rows':[]};var _0x41309d=_[_0x7999('0x2c')](db['Schedule'][_0x7999('0x2d')],function(_0x39b273){return{'name':_0x39b273['fieldName'],'type':_0x39b273[_0x7999('0x2e')][_0x7999('0x2f')]};});_0xde588a[_0x7999('0x30')]=_[_0x7999('0x2c')](_0x41309d,_0x7999('0x29'));_0xde588a[_0x7999('0x31')]=_['keys'](_0x2528f5[_0x7999('0x31')]);_0xde588a[_0x7999('0x32')]=_[_0x7999('0x33')](_0xde588a[_0x7999('0x30')],_0xde588a['query']);_0x3d5f82[_0x7999('0x34')]=_[_0x7999('0x33')](_0xde588a[_0x7999('0x30')],qs[_0x7999('0x35')](_0x2528f5[_0x7999('0x31')]['fields']));_0x3d5f82[_0x7999('0x34')]=_0x3d5f82[_0x7999('0x34')][_0x7999('0x36')]?_0x3d5f82[_0x7999('0x34')]:_0xde588a[_0x7999('0x30')];if(!_0x2528f5[_0x7999('0x31')][_0x7999('0x37')]('nolimit')){_0x3d5f82[_0x7999('0x1c')]=qs[_0x7999('0x1c')](_0x2528f5['query']['limit']);_0x3d5f82[_0x7999('0x1b')]=qs[_0x7999('0x1b')](_0x2528f5[_0x7999('0x31')]['offset']);}_0x3d5f82[_0x7999('0x38')]=qs[_0x7999('0x39')](_0x2528f5[_0x7999('0x31')][_0x7999('0x39')]);_0x3d5f82['where']=qs[_0x7999('0x32')](_['pick'](_0x2528f5[_0x7999('0x31')],_0xde588a[_0x7999('0x32')]),_0x41309d);if(_0x2528f5[_0x7999('0x31')]['filter']){_0x3d5f82[_0x7999('0x3a')]=_[_0x7999('0x3b')](_0x3d5f82[_0x7999('0x3a')],{'$or':_[_0x7999('0x2c')](_0x41309d,function(_0x3c43dc){if(_0x3c43dc[_0x7999('0x2e')]!==_0x7999('0x3c')){var _0x5a3840={};_0x5a3840[_0x3c43dc[_0x7999('0x29')]]={'$like':'%'+_0x2528f5[_0x7999('0x31')][_0x7999('0x3d')]+'%'};return _0x5a3840;}})});}_0x3d5f82=_[_0x7999('0x3b')]({},_0x3d5f82,_0x2528f5[_0x7999('0x3e')]);var _0x3918dc={'where':_0x3d5f82[_0x7999('0x3a')]};return db[_0x7999('0x3f')][_0x7999('0x1e')](_0x3918dc)['then'](function(_0x2c63d3){_0x5c99dc[_0x7999('0x1e')]=_0x2c63d3;if(_0x2528f5['query']['includeAll']){_0x3d5f82['include']=[{'all':!![]}];}return db[_0x7999('0x3f')]['findAll'](_0x3d5f82);})['then'](function(_0x1d567d){_0x5c99dc[_0x7999('0x40')]=_0x1d567d;return _0x5c99dc;})[_0x7999('0x22')](respondWithFilteredResult(_0x5bfdb8,_0x3d5f82))['catch'](handleError(_0x5bfdb8,null));};exports[_0x7999('0x41')]=function(_0xef78a7,_0x588c1e){var _0x13e431={'raw':![],'where':{'id':_0xef78a7[_0x7999('0x42')]['id']}},_0x46728f={};_0x46728f[_0x7999('0x30')]=_[_0x7999('0x43')](db[_0x7999('0x3f')][_0x7999('0x2d')]);_0x46728f[_0x7999('0x31')]=_[_0x7999('0x43')](_0xef78a7[_0x7999('0x31')]);_0x46728f[_0x7999('0x32')]=_[_0x7999('0x33')](_0x46728f[_0x7999('0x30')],_0x46728f[_0x7999('0x31')]);_0x13e431[_0x7999('0x34')]=_[_0x7999('0x33')](_0x46728f[_0x7999('0x30')],qs[_0x7999('0x35')](_0xef78a7[_0x7999('0x31')][_0x7999('0x35')]));_0x13e431[_0x7999('0x34')]=_0x13e431[_0x7999('0x34')][_0x7999('0x36')]?_0x13e431[_0x7999('0x34')]:_0x46728f[_0x7999('0x30')];if(_0xef78a7[_0x7999('0x31')][_0x7999('0x44')]){_0x13e431[_0x7999('0x45')]=[{'all':!![]}];}_0x13e431=_[_0x7999('0x3b')]({},_0x13e431,_0xef78a7[_0x7999('0x3e')]);return db[_0x7999('0x3f')][_0x7999('0x46')](_0x13e431)[_0x7999('0x22')](handleEntityNotFound(_0x588c1e,null))['then'](respondWithResult(_0x588c1e,null))[_0x7999('0x47')](handleError(_0x588c1e,null));};exports[_0x7999('0x48')]=function(_0x294494,_0x8c5614){return db[_0x7999('0x3f')][_0x7999('0x48')](_0x294494[_0x7999('0x49')],{})[_0x7999('0x22')](function(_0x23cecf){var _0x5cde2a=_0x294494['user'][_0x7999('0x24')]({'plain':!![]});if(!_0x5cde2a)throw new Error(_0x7999('0x4a'));if(_0x5cde2a[_0x7999('0x4b')]===_0x7999('0x4c')){var _0x43db50=_0x23cecf[_0x7999('0x24')]({'plain':!![]});var _0x5da82d=_0x7999('0x25');return db[_0x7999('0x4d')][_0x7999('0x46')]({'where':{'name':_0x5da82d,'userProfileId':_0x5cde2a[_0x7999('0x4e')]},'raw':!![]})[_0x7999('0x22')](function(_0x393c00){if(_0x393c00&&_0x393c00[_0x7999('0x4f')]===0x0){return db[_0x7999('0x26')]['create']({'name':_0x43db50[_0x7999('0x29')],'resourceId':_0x43db50['id'],'type':_0x393c00[_0x7999('0x29')],'sectionId':_0x393c00['id']},{})['then'](function(){return _0x23cecf;});}else{return _0x23cecf;}})[_0x7999('0x47')](function(_0x5b8ae0){logger[_0x7999('0x50')](_0x7999('0x51'),_0x5b8ae0);throw _0x5b8ae0;});}return _0x23cecf;})[_0x7999('0x22')](respondWithResult(_0x8c5614,0xc9))['catch'](handleError(_0x8c5614,null));};exports[_0x7999('0x52')]=function(_0x5258ab,_0x382307){if(_0x5258ab['body']['id']){delete _0x5258ab['body']['id'];}return db[_0x7999('0x3f')]['find']({'where':{'id':_0x5258ab[_0x7999('0x42')]['id']}})[_0x7999('0x22')](handleEntityNotFound(_0x382307,null))['then'](saveUpdates(_0x5258ab[_0x7999('0x49')],null))[_0x7999('0x22')](respondWithResult(_0x382307,null))['catch'](handleError(_0x382307,null));};exports['destroy']=function(_0x54bd11,_0x250e0c){return db['Schedule']['find']({'where':{'id':_0x54bd11[_0x7999('0x42')]['id']}})[_0x7999('0x22')](handleEntityNotFound(_0x250e0c,null))[_0x7999('0x22')](removeEntity(_0x250e0c,null))['catch'](handleError(_0x250e0c,null));};exports['run']=function(_0x5566e6,_0xee1d87,_0x5c0526){var _0x296e0f=require(_0x7999('0x53'));return db[_0x7999('0x3f')][_0x7999('0x46')]({'where':{'id':_0x5566e6['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0xee1d87,null))[_0x7999('0x22')](function(){_0x296e0f[_0x7999('0x54')](_0x5566e6[_0x7999('0x42')]['id']);})[_0x7999('0x22')](respondWithStatusCode(_0xee1d87,null))['catch'](handleError(_0xee1d87,null));}; \ No newline at end of file +var _0x6be8=['rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','json','save','update','destroy','get','Scheduler','UserProfileResource','then','error','stack','name','send','index','map','Schedule'];(function(_0x4fbe76,_0x1b7645){var _0x72a29b=function(_0x293702){while(--_0x293702){_0x4fbe76['push'](_0x4fbe76['shift']());}};_0x72a29b(++_0x1b7645);}(_0x6be8,0x1a5));var _0x86be=function(_0x141e5b,_0x44b460){_0x141e5b=_0x141e5b-0x0;var _0x1ce0ee=_0x6be8[_0x141e5b];return _0x1ce0ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86be('0x0'));var zipdir=require(_0x86be('0x1'));var jsonpatch=require(_0x86be('0x2'));var rp=require('request-promise');var moment=require(_0x86be('0x3'));var BPromise=require(_0x86be('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x86be('0x5'));var sox=require('sox');var csv=require(_0x86be('0x6'));var ejs=require(_0x86be('0x7'));var fs=require('fs');var fs_extra=require(_0x86be('0x8'));var _=require(_0x86be('0x9'));var squel=require(_0x86be('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86be('0xb'));var toCsv=require(_0x86be('0x6'));var querystring=require('querystring');var Papa=require(_0x86be('0xc'));var Redis=require('ioredis');var authService=require(_0x86be('0xd'));var qs=require(_0x86be('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86be('0xf'));var logger=require(_0x86be('0x10'))(_0x86be('0x11'));var utils=require(_0x86be('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x86be('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2df2e0,_0x468741){_0x468741=_0x468741||0xcc;return function(_0x295654){if(_0x295654){return _0x2df2e0['sendStatus'](_0x468741);}return _0x2df2e0[_0x86be('0x14')](_0x468741)[_0x86be('0x15')]();};}function respondWithResult(_0x5355bc,_0x8fbcbf){_0x8fbcbf=_0x8fbcbf||0xc8;return function(_0x294abd){if(_0x294abd){return _0x5355bc[_0x86be('0x14')](_0x8fbcbf)['json'](_0x294abd);}};}function respondWithFilteredResult(_0x2cca19,_0x3b772b){return function(_0x413121){if(_0x413121){var _0x2056d4=typeof _0x3b772b[_0x86be('0x16')]===_0x86be('0x17')&&typeof _0x3b772b[_0x86be('0x18')]===_0x86be('0x17');var _0x1bafc6=_0x413121['count'];var _0x4516f4=_0x2056d4?0x0:_0x3b772b['offset'];var _0x517546=_0x2056d4?_0x413121[_0x86be('0x19')]:_0x3b772b[_0x86be('0x16')]+_0x3b772b[_0x86be('0x18')];var _0x565198;if(_0x517546>=_0x1bafc6){_0x517546=_0x1bafc6;_0x565198=0xc8;}else{_0x565198=0xce;}_0x2cca19[_0x86be('0x14')](_0x565198);return _0x2cca19['set']('Content-Range',_0x4516f4+'-'+_0x517546+'/'+_0x1bafc6)[_0x86be('0x1a')](_0x413121);}return null;};}function patchUpdates(_0x1a8f62){return function(_0x1537c3){try{jsonpatch['apply'](_0x1537c3,_0x1a8f62,!![]);}catch(_0x267f0a){return BPromise['reject'](_0x267f0a);}return _0x1537c3[_0x86be('0x1b')]();};}function saveUpdates(_0x1731ed,_0x13cbaf){return function(_0x596624){if(_0x596624){return _0x596624[_0x86be('0x1c')](_0x1731ed)['then'](function(_0x3b7dd5){return _0x3b7dd5;});}return null;};}function removeEntity(_0x262f73,_0x160ca0){return function(_0x5dfb6a){if(_0x5dfb6a){return _0x5dfb6a[_0x86be('0x1d')]()['then'](function(){var _0x33ca65=_0x5dfb6a[_0x86be('0x1e')]({'plain':!![]});var _0x2983de=_0x86be('0x1f');return db[_0x86be('0x20')][_0x86be('0x1d')]({'where':{'type':_0x2983de,'resourceId':_0x33ca65['id']}})[_0x86be('0x21')](function(){return _0x5dfb6a;});})[_0x86be('0x21')](function(){_0x262f73[_0x86be('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bfa8b,_0x365144){return function(_0x338327){if(!_0x338327){_0x2bfa8b['sendStatus'](0x194);}return _0x338327;};}function handleError(_0x27678c,_0x5b1a70){_0x5b1a70=_0x5b1a70||0x1f4;return function(_0x43c9e1){logger[_0x86be('0x22')](_0x43c9e1[_0x86be('0x23')]);if(_0x43c9e1['name']){delete _0x43c9e1[_0x86be('0x24')];}_0x27678c[_0x86be('0x14')](_0x5b1a70)[_0x86be('0x25')](_0x43c9e1);};}exports[_0x86be('0x26')]=function(_0x10b864,_0x5e5107){var _0x234444={},_0xb9d6c5={},_0x1c1ffa={'count':0x0,'rows':[]};var _0x5dd3c6=_[_0x86be('0x27')](db[_0x86be('0x28')][_0x86be('0x29')],function(_0x4057cd){return{'name':_0x4057cd[_0x86be('0x2a')],'type':_0x4057cd['type'][_0x86be('0x2b')]};});_0xb9d6c5[_0x86be('0x2c')]=_[_0x86be('0x27')](_0x5dd3c6,_0x86be('0x24'));_0xb9d6c5[_0x86be('0x2d')]=_[_0x86be('0x2e')](_0x10b864['query']);_0xb9d6c5['filters']=_[_0x86be('0x2f')](_0xb9d6c5['model'],_0xb9d6c5[_0x86be('0x2d')]);_0x234444[_0x86be('0x30')]=_[_0x86be('0x2f')](_0xb9d6c5['model'],qs['fields'](_0x10b864[_0x86be('0x2d')][_0x86be('0x31')]));_0x234444[_0x86be('0x30')]=_0x234444[_0x86be('0x30')][_0x86be('0x32')]?_0x234444['attributes']:_0xb9d6c5['model'];if(!_0x10b864[_0x86be('0x2d')][_0x86be('0x33')](_0x86be('0x34'))){_0x234444[_0x86be('0x18')]=qs[_0x86be('0x18')](_0x10b864[_0x86be('0x2d')][_0x86be('0x18')]);_0x234444[_0x86be('0x16')]=qs[_0x86be('0x16')](_0x10b864['query'][_0x86be('0x16')]);}_0x234444[_0x86be('0x35')]=qs[_0x86be('0x36')](_0x10b864[_0x86be('0x2d')][_0x86be('0x36')]);_0x234444[_0x86be('0x37')]=qs[_0x86be('0x38')](_[_0x86be('0x39')](_0x10b864[_0x86be('0x2d')],_0xb9d6c5[_0x86be('0x38')]),_0x5dd3c6);if(_0x10b864[_0x86be('0x2d')]['filter']){_0x234444[_0x86be('0x37')]=_[_0x86be('0x3a')](_0x234444[_0x86be('0x37')],{'$or':_['map'](_0x5dd3c6,function(_0x5b78dc){if(_0x5b78dc[_0x86be('0x3b')]!==_0x86be('0x3c')){var _0x15808b={};_0x15808b[_0x5b78dc['name']]={'$like':'%'+_0x10b864['query']['filter']+'%'};return _0x15808b;}})});}_0x234444=_[_0x86be('0x3a')]({},_0x234444,_0x10b864[_0x86be('0x3d')]);var _0x107aa0={'where':_0x234444[_0x86be('0x37')]};return db['Schedule'][_0x86be('0x19')](_0x107aa0)[_0x86be('0x21')](function(_0x506341){_0x1c1ffa['count']=_0x506341;if(_0x10b864[_0x86be('0x2d')][_0x86be('0x3e')]){_0x234444[_0x86be('0x3f')]=[{'all':!![]}];}return db[_0x86be('0x28')]['findAll'](_0x234444);})[_0x86be('0x21')](function(_0x5ee7de){_0x1c1ffa[_0x86be('0x40')]=_0x5ee7de;return _0x1c1ffa;})[_0x86be('0x21')](respondWithFilteredResult(_0x5e5107,_0x234444))[_0x86be('0x41')](handleError(_0x5e5107,null));};exports['show']=function(_0xf0379,_0x3cb8ce){var _0x1bda87={'raw':![],'where':{'id':_0xf0379[_0x86be('0x42')]['id']}},_0x5c27b8={};_0x5c27b8[_0x86be('0x2c')]=_[_0x86be('0x2e')](db[_0x86be('0x28')][_0x86be('0x29')]);_0x5c27b8[_0x86be('0x2d')]=_[_0x86be('0x2e')](_0xf0379[_0x86be('0x2d')]);_0x5c27b8[_0x86be('0x38')]=_[_0x86be('0x2f')](_0x5c27b8[_0x86be('0x2c')],_0x5c27b8[_0x86be('0x2d')]);_0x1bda87[_0x86be('0x30')]=_[_0x86be('0x2f')](_0x5c27b8['model'],qs[_0x86be('0x31')](_0xf0379['query'][_0x86be('0x31')]));_0x1bda87[_0x86be('0x30')]=_0x1bda87['attributes']['length']?_0x1bda87[_0x86be('0x30')]:_0x5c27b8[_0x86be('0x2c')];if(_0xf0379['query'][_0x86be('0x3e')]){_0x1bda87['include']=[{'all':!![]}];}_0x1bda87=_['merge']({},_0x1bda87,_0xf0379[_0x86be('0x3d')]);return db[_0x86be('0x28')][_0x86be('0x43')](_0x1bda87)['then'](handleEntityNotFound(_0x3cb8ce,null))['then'](respondWithResult(_0x3cb8ce,null))[_0x86be('0x41')](handleError(_0x3cb8ce,null));};exports['create']=function(_0x406bd1,_0x8148d7){return db[_0x86be('0x28')][_0x86be('0x44')](_0x406bd1['body'],{})[_0x86be('0x21')](function(_0x67ccce){var _0x2f68de=_0x406bd1[_0x86be('0x45')][_0x86be('0x1e')]({'plain':!![]});if(!_0x2f68de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f68de[_0x86be('0x46')]===_0x86be('0x45')){var _0xd51343=_0x67ccce[_0x86be('0x1e')]({'plain':!![]});var _0x30bef1=_0x86be('0x1f');return db[_0x86be('0x47')][_0x86be('0x43')]({'where':{'name':_0x30bef1,'userProfileId':_0x2f68de[_0x86be('0x48')]},'raw':!![]})['then'](function(_0x4ba84c){if(_0x4ba84c&&_0x4ba84c['autoAssociation']===0x0){return db[_0x86be('0x20')]['create']({'name':_0xd51343[_0x86be('0x24')],'resourceId':_0xd51343['id'],'type':_0x4ba84c[_0x86be('0x24')],'sectionId':_0x4ba84c['id']},{})['then'](function(){return _0x67ccce;});}else{return _0x67ccce;}})[_0x86be('0x41')](function(_0xb77117){logger[_0x86be('0x22')](_0x86be('0x49'),_0xb77117);throw _0xb77117;});}return _0x67ccce;})[_0x86be('0x21')](respondWithResult(_0x8148d7,0xc9))[_0x86be('0x41')](handleError(_0x8148d7,null));};exports[_0x86be('0x1c')]=function(_0x2b70c3,_0x3ad915){if(_0x2b70c3['body']['id']){delete _0x2b70c3['body']['id'];}return db[_0x86be('0x28')][_0x86be('0x43')]({'where':{'id':_0x2b70c3[_0x86be('0x42')]['id']}})[_0x86be('0x21')](handleEntityNotFound(_0x3ad915,null))[_0x86be('0x21')](saveUpdates(_0x2b70c3[_0x86be('0x4a')],null))['then'](respondWithResult(_0x3ad915,null))[_0x86be('0x41')](handleError(_0x3ad915,null));};exports[_0x86be('0x1d')]=function(_0x1b0538,_0x46574c){return db[_0x86be('0x28')][_0x86be('0x43')]({'where':{'id':_0x1b0538[_0x86be('0x42')]['id']}})[_0x86be('0x21')](handleEntityNotFound(_0x46574c,null))['then'](removeEntity(_0x46574c,null))[_0x86be('0x41')](handleError(_0x46574c,null));};exports[_0x86be('0x4b')]=function(_0x53aa82,_0x1ac074,_0x105973){var _0x4cb8ff=require(_0x86be('0x4c'));return db[_0x86be('0x28')][_0x86be('0x43')]({'where':{'id':_0x53aa82['params']['id']},'raw':!![]})[_0x86be('0x21')](handleEntityNotFound(_0x1ac074,null))[_0x86be('0x21')](function(){_0x4cb8ff[_0x86be('0x4b')](_0x53aa82['params']['id']);})['then'](respondWithStatusCode(_0x1ac074,null))[_0x86be('0x41')](handleError(_0x1ac074,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index a660822..8be5820 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 _0x149f=['bluebird','rimraf','../../config/environment','exports','Schedule','util','../../config/logger','api','moment'];(function(_0x23eaf2,_0x465cfb){var _0x54efb4=function(_0x5f3727){while(--_0x5f3727){_0x23eaf2['push'](_0x23eaf2['shift']());}};_0x54efb4(++_0x465cfb);}(_0x149f,0x17f));var _0xf149=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x149f[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require(_0xf149('0x0'));var logger=require(_0xf149('0x1'))(_0xf149('0x2'));var moment=require(_0xf149('0x3'));var BPromise=require(_0xf149('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf149('0x5'));var config=require(_0xf149('0x6'));var attributes=require('./schedule.attributes');module[_0xf149('0x7')]=function(_0x381afe,_0x3fc606){return _0x381afe['define'](_0xf149('0x8'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe04e=['../../config/environment','./schedule.attributes','exports','Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4d02ab,_0x59b910){var _0x373bb3=function(_0x37d240){while(--_0x37d240){_0x4d02ab['push'](_0x4d02ab['shift']());}};_0x373bb3(++_0x59b910);}(_0xe04e,0xa1));var _0xee04=function(_0x2dc780,_0x49f34d){_0x2dc780=_0x2dc780-0x0;var _0x562171=_0xe04e[_0x2dc780];return _0x562171;};'use strict';var _=require(_0xee04('0x0'));var util=require(_0xee04('0x1'));var logger=require(_0xee04('0x2'))(_0xee04('0x3'));var moment=require('moment');var BPromise=require(_0xee04('0x4'));var rp=require(_0xee04('0x5'));var fs=require('fs');var path=require(_0xee04('0x6'));var rimraf=require(_0xee04('0x7'));var config=require(_0xee04('0x8'));var attributes=require(_0xee04('0x9'));module[_0xee04('0xa')]=function(_0xd1f7fd,_0x2ffe5c){return _0xd1f7fd['define'](_0xee04('0xb'),attributes,{'tableName':_0xee04('0xc'),'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 5590814..05d4b58 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 _0x28dd=['message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x58b44a,_0x1a7aa6){var _0xd6779d=function(_0x40d8f3){while(--_0x40d8f3){_0x58b44a['push'](_0x58b44a['shift']());}};_0xd6779d(++_0x1a7aa6);}(_0x28dd,0xf3));var _0xd28d=function(_0x57c380,_0x4cdaae){_0x57c380=_0x57c380-0x0;var _0x201cbf=_0x28dd[_0x57c380];return _0x201cbf;};'use strict';var _=require(_0xd28d('0x0'));var util=require(_0xd28d('0x1'));var moment=require(_0xd28d('0x2'));var BPromise=require(_0xd28d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd28d('0x4'))['db'];var utils=require(_0xd28d('0x5'));var logger=require(_0xd28d('0x6'))(_0xd28d('0x7'));var config=require(_0xd28d('0x8'));var jayson=require(_0xd28d('0x9'));var client=jayson['client'][_0xd28d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4250f7,_0x44cc22,_0x3c099f){return new BPromise(function(_0x2cbbba,_0x5a780d){return client['request'](_0x4250f7,_0x3c099f)['then'](function(_0x14e8fe){logger[_0xd28d('0xb')](_0xd28d('0xc'),_0x44cc22,_0xd28d('0xd'));logger['debug'](_0xd28d('0xe'),_0x44cc22,_0xd28d('0xd'),JSON[_0xd28d('0xf')](_0x14e8fe));if(_0x14e8fe[_0xd28d('0x10')]){if(_0x14e8fe['error']['code']===0x1f4){logger[_0xd28d('0x10')](_0xd28d('0xc'),_0x44cc22,_0x14e8fe[_0xd28d('0x10')][_0xd28d('0x11')]);return _0x5a780d(_0x14e8fe[_0xd28d('0x10')][_0xd28d('0x11')]);}logger[_0xd28d('0x10')](_0xd28d('0xc'),_0x44cc22,_0x14e8fe[_0xd28d('0x10')]['message']);return _0x2cbbba(_0x14e8fe[_0xd28d('0x10')][_0xd28d('0x11')]);}else{logger[_0xd28d('0xb')](_0xd28d('0xc'),_0x44cc22,'request\x20sent');_0x2cbbba(_0x14e8fe[_0xd28d('0x12')][_0xd28d('0x11')]);}})[_0xd28d('0x13')](function(_0x233c59){logger[_0xd28d('0x10')](_0xd28d('0xc'),_0x44cc22,_0x233c59);_0x5a780d(_0x233c59);});});} \ No newline at end of file +var _0xbf19=['request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x1a5946,_0x426991){var _0x25e9d5=function(_0x44e1ce){while(--_0x44e1ce){_0x1a5946['push'](_0x1a5946['shift']());}};_0x25e9d5(++_0x426991);}(_0xbf19,0x16d));var _0x9bf1=function(_0x48b0ff,_0x56819a){_0x48b0ff=_0x48b0ff-0x0;var _0x4b0e82=_0xbf19[_0x48b0ff];return _0x4b0e82;};'use strict';var _=require(_0x9bf1('0x0'));var util=require(_0x9bf1('0x1'));var moment=require('moment');var BPromise=require(_0x9bf1('0x2'));var rs=require(_0x9bf1('0x3'));var fs=require('fs');var Redis=require(_0x9bf1('0x4'));var db=require(_0x9bf1('0x5'))['db'];var utils=require(_0x9bf1('0x6'));var logger=require(_0x9bf1('0x7'))(_0x9bf1('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9bf1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f1c68,_0x3baf40,_0x5ad61e){return new BPromise(function(_0x2580ab,_0xf4f1ed){return client[_0x9bf1('0xa')](_0x1f1c68,_0x5ad61e)['then'](function(_0x350889){logger[_0x9bf1('0xb')](_0x9bf1('0xc'),_0x3baf40,'request\x20sent');logger[_0x9bf1('0xd')](_0x9bf1('0xe'),_0x3baf40,_0x9bf1('0xf'),JSON['stringify'](_0x350889));if(_0x350889['error']){if(_0x350889[_0x9bf1('0x10')][_0x9bf1('0x11')]===0x1f4){logger[_0x9bf1('0x10')](_0x9bf1('0xc'),_0x3baf40,_0x350889['error'][_0x9bf1('0x12')]);return _0xf4f1ed(_0x350889[_0x9bf1('0x10')][_0x9bf1('0x12')]);}logger[_0x9bf1('0x10')](_0x9bf1('0xc'),_0x3baf40,_0x350889[_0x9bf1('0x10')][_0x9bf1('0x12')]);return _0x2580ab(_0x350889[_0x9bf1('0x10')][_0x9bf1('0x12')]);}else{logger[_0x9bf1('0xb')]('Schedule,\x20%s,\x20%s',_0x3baf40,'request\x20sent');_0x2580ab(_0x350889[_0x9bf1('0x13')][_0x9bf1('0x12')]);}})['catch'](function(_0x4ea8bd){logger['error']('Schedule,\x20%s,\x20%s',_0x3baf40,_0x4ea8bd);_0xf4f1ed(_0x4ea8bd);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 0bb8427..fac9316 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 _0x633a=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','download','post','put','destroy','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x1c3273,_0x49410a){var _0xaf78e2=function(_0x5ded0a){while(--_0x5ded0a){_0x1c3273['push'](_0x1c3273['shift']());}};_0xaf78e2(++_0x49410a);}(_0x633a,0xd7));var _0xa633=function(_0xeb88a4,_0x60ceb1){_0xeb88a4=_0xeb88a4-0x0;var _0x2c4b98=_0x633a[_0xeb88a4];return _0x2c4b98;};'use strict';var multer=require(_0xa633('0x0'));var util=require(_0xa633('0x1'));var path=require('path');var timeout=require(_0xa633('0x2'));var express=require(_0xa633('0x3'));var router=express['Router']();var fs_extra=require(_0xa633('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa633('0x5'));var config=require(_0xa633('0x6'));var controller=require('./screenRecording.controller');router[_0xa633('0x7')]('/',auth[_0xa633('0x8')](),controller['index']);router[_0xa633('0x7')](_0xa633('0x9'),auth['isAuthenticated'](),controller[_0xa633('0xa')]);router[_0xa633('0x7')](_0xa633('0xb'),auth[_0xa633('0x8')](),controller[_0xa633('0xc')]);router[_0xa633('0x7')]('/:id/download',auth[_0xa633('0x8')](),controller[_0xa633('0xd')]);router[_0xa633('0xe')]('/',auth[_0xa633('0x8')](),controller['create']);router[_0xa633('0xf')](_0xa633('0xb'),auth[_0xa633('0x8')](),controller['update']);router['delete'](_0xa633('0xb'),auth[_0xa633('0x8')](),controller[_0xa633('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe15a=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./screenRecording.controller','isAuthenticated','get','/describe','/:id','show','/:id/download','download','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe15a,0x12c));var _0xae15=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0xe15a[_0x183b97];return _0x629cf7;};'use strict';var multer=require(_0xae15('0x0'));var util=require(_0xae15('0x1'));var path=require('path');var timeout=require(_0xae15('0x2'));var express=require(_0xae15('0x3'));var router=express[_0xae15('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xae15('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xae15('0x6'));router['get']('/',auth[_0xae15('0x7')](),controller['index']);router[_0xae15('0x8')](_0xae15('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xae15('0xa'),auth['isAuthenticated'](),controller[_0xae15('0xb')]);router['get'](_0xae15('0xc'),auth[_0xae15('0x7')](),controller[_0xae15('0xd')]);router[_0xae15('0xe')]('/',auth[_0xae15('0x7')](),controller[_0xae15('0xf')]);router[_0xae15('0x10')](_0xae15('0xa'),auth['isAuthenticated'](),controller[_0xae15('0x11')]);router[_0xae15('0x12')](_0xae15('0xa'),auth[_0xae15('0x7')](),controller[_0xae15('0x13')]);module[_0xae15('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index d38188a..c23de76 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 _0xd3c8=['updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt'];(function(_0x3a3f1d,_0x124b63){var _0x280e0d=function(_0x432cee){while(--_0x432cee){_0x3a3f1d['push'](_0x3a3f1d['shift']());}};_0x280e0d(++_0x124b63);}(_0xd3c8,0x161));var _0x8d3c=function(_0x5b1b89,_0x5f3e08){_0x5b1b89=_0x5b1b89-0x0;var _0x1f3e2e=_0xd3c8[_0x5b1b89];return _0x1f3e2e;};'use strict';var Sequelize=require(_0x8d3c('0x0'));var moment=require(_0x8d3c('0x1'));var path=require(_0x8d3c('0x2'));var config=require(_0x8d3c('0x3'));module[_0x8d3c('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8d3c('0x5')](_0x8d3c('0x6'))?path[_0x8d3c('0x7')](this[_0x8d3c('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x8d3c('0x8')]},'channel':{'type':Sequelize[_0x8d3c('0x8')]},'value':{'type':Sequelize[_0x8d3c('0x8')],'set':function(_0x37d7b4){var _0x87e7bf=_0x37d7b4[_0x8d3c('0x9')](/\\/g,'/');this[_0x8d3c('0xa')](_0x8d3c('0x6'),_0x87e7bf);}},'rating':{'type':Sequelize[_0x8d3c('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8d3c('0xb')],'set':function(_0x55d4dd){this['setDataValue']('startedAt',moment()[_0x8d3c('0xc')](_0x55d4dd,'ms'));this[_0x8d3c('0xa')](_0x8d3c('0xd'),moment());this[_0x8d3c('0xa')](_0x8d3c('0xe'),_0x55d4dd);}},'startedAt':{'type':Sequelize[_0x8d3c('0xf')],'get':function(){return moment(this[_0x8d3c('0x5')](_0x8d3c('0x10')))[_0x8d3c('0x11')](_0x8d3c('0x12'))[_0x8d3c('0x13')]();}},'closedAt':{'type':Sequelize[_0x8d3c('0xf')],'get':function(){return moment(this[_0x8d3c('0x5')](_0x8d3c('0xd')))[_0x8d3c('0x11')](_0x8d3c('0x12'))[_0x8d3c('0x13')]();}},'createdAt':{'type':Sequelize[_0x8d3c('0xf')],'get':function(){return moment(this[_0x8d3c('0x5')](_0x8d3c('0x14')))['format'](_0x8d3c('0x12'))[_0x8d3c('0x13')]();}},'updatedAt':{'type':Sequelize[_0x8d3c('0xf')],'get':function(){return moment(this[_0x8d3c('0x5')](_0x8d3c('0x15')))[_0x8d3c('0x11')](_0x8d3c('0x12'))[_0x8d3c('0x13')]();}}}; \ No newline at end of file +var _0xdb7e=['startedAt','subtract','closedAt','duration','DATE','toString','format','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER'];(function(_0xebadef,_0x3c67e5){var _0x3f6015=function(_0x3044e5){while(--_0x3044e5){_0xebadef['push'](_0xebadef['shift']());}};_0x3f6015(++_0x3c67e5);}(_0xdb7e,0x11a));var _0xedb7=function(_0x5d7901,_0x336344){_0x5d7901=_0x5d7901-0x0;var _0x2a6afa=_0xdb7e[_0x5d7901];return _0x2a6afa;};'use strict';var Sequelize=require(_0xedb7('0x0'));var moment=require(_0xedb7('0x1'));var path=require(_0xedb7('0x2'));var config=require('../../config/environment');module[_0xedb7('0x3')]={'format':{'type':Sequelize[_0xedb7('0x4')],'get':function(){return this[_0xedb7('0x5')]('value')?path[_0xedb7('0x6')](this[_0xedb7('0x5')](_0xedb7('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xedb7('0x8')]},'channel':{'type':Sequelize[_0xedb7('0x8')]},'value':{'type':Sequelize[_0xedb7('0x8')],'set':function(_0x87bf4b){var _0x20a7c7=_0x87bf4b[_0xedb7('0x9')](/\\/g,'/');this[_0xedb7('0xa')]('value',_0x20a7c7);}},'rating':{'type':Sequelize[_0xedb7('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xedb7('0xb')],'set':function(_0x12c7ba){this[_0xedb7('0xa')](_0xedb7('0xc'),moment()[_0xedb7('0xd')](_0x12c7ba,'ms'));this[_0xedb7('0xa')](_0xedb7('0xe'),moment());this[_0xedb7('0xa')](_0xedb7('0xf'),_0x12c7ba);}},'startedAt':{'type':Sequelize[_0xedb7('0x10')],'get':function(){return moment(this[_0xedb7('0x5')](_0xedb7('0xc')))['format']('MM-DD-YYYY\x20HH:mm')[_0xedb7('0x11')]();}},'closedAt':{'type':Sequelize[_0xedb7('0x10')],'get':function(){return moment(this[_0xedb7('0x5')](_0xedb7('0xe')))[_0xedb7('0x12')](_0xedb7('0x13'))[_0xedb7('0x11')]();}},'createdAt':{'type':Sequelize[_0xedb7('0x10')],'get':function(){return moment(this[_0xedb7('0x5')]('createdAt'))['format'](_0xedb7('0x13'))[_0xedb7('0x11')]();}},'updatedAt':{'type':Sequelize[_0xedb7('0x10')],'get':function(){return moment(this['getDataValue'](_0xedb7('0x14')))[_0xedb7('0x12')](_0xedb7('0x13'))[_0xedb7('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 1c115f7..9b8330d 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 _0x008c=['papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','sendStatus','send','index','ScreenRecording','rawAttributes','key','model','differenceBy','map','name','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','duration','createdAt','closedAt','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x008c,0x188));var _0xc008=function(_0x30f030,_0xd03b7a){_0x30f030=_0x30f030-0x0;var _0xf7614f=_0x008c[_0x30f030];return _0xf7614f;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_[_0xc008('0x2b')](_0x2a7d4f,_0xc008('0x2c')),[_0xc008('0x2d')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x25eae4[_0xc008('0x2e')]);_0x32390d[_0xc008('0x30')]=_[_0xc008('0x31')](_0x32390d[_0xc008('0x29')],_0x32390d['query']);_0x24c14c[_0xc008('0x32')]=_[_0xc008('0x31')](_0x32390d['model'],qs[_0xc008('0x33')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x33')]));_0x24c14c[_0xc008('0x32')]=_0x24c14c[_0xc008('0x32')][_0xc008('0x34')]?_0x24c14c[_0xc008('0x32')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2e')]['hasOwnProperty'](_0xc008('0x35'))){_0x24c14c[_0xc008('0x1d')]=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4['query'][_0xc008('0x1b')]);}_0x24c14c[_0xc008('0x36')]=qs['sort'](_0x25eae4[_0xc008('0x2e')][_0xc008('0x37')]);_0x24c14c['where']=qs[_0xc008('0x30')](_[_0xc008('0x38')](_0x25eae4[_0xc008('0x2e')],_0x32390d['filters']),_0x2a7d4f);if(_0x25eae4['query']['filter']){_0x24c14c[_0xc008('0x39')]=_['merge'](_0x24c14c[_0xc008('0x39')],{'$or':_[_0xc008('0x2b')](_0x2a7d4f,function(_0x6a4ccb){if(_0x6a4ccb[_0xc008('0x3a')]!==_0xc008('0x3b')){var _0xa381d1={};_0xa381d1[_0x6a4ccb[_0xc008('0x2c')]]={'$like':'%'+_0x25eae4[_0xc008('0x2e')][_0xc008('0x3c')]+'%'};return _0xa381d1;}})});}_0x24c14c=_[_0xc008('0x3d')]({},_0x24c14c,_0x25eae4[_0xc008('0x3e')]);var _0xdfca2e={'where':_0x24c14c[_0xc008('0x39')]};return db[_0xc008('0x26')]['count'](_0xdfca2e)[_0xc008('0x21')](function(_0x23c4db){_0x209591[_0xc008('0x1e')]=_0x23c4db;if(_0x25eae4[_0xc008('0x2e')]['includeAll']){_0x24c14c[_0xc008('0x3f')]=[{'all':!![]}];}return db[_0xc008('0x26')][_0xc008('0x40')](_0x24c14c);})[_0xc008('0x21')](function(_0x2d142d){_0x209591['rows']=_0x2d142d;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))[_0xc008('0x41')](handleError(_0x529961,null));};exports[_0xc008('0x42')]=function(_0x3e9a99,_0x7279e8){var _0x4f93a4={'raw':![],'where':{'id':_0x3e9a99[_0xc008('0x43')]['id']}},_0xf4cc4b={};_0xf4cc4b[_0xc008('0x29')]=_[_0xc008('0x2f')](db['ScreenRecording'][_0xc008('0x27')]);_0xf4cc4b[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x3e9a99['query']);_0xf4cc4b[_0xc008('0x30')]=_['intersection'](_0xf4cc4b[_0xc008('0x29')],_0xf4cc4b['query']);_0x4f93a4[_0xc008('0x32')]=_[_0xc008('0x31')](_0xf4cc4b['model'],qs[_0xc008('0x33')](_0x3e9a99[_0xc008('0x2e')][_0xc008('0x33')]));_0x4f93a4['attributes']=_0x4f93a4[_0xc008('0x32')][_0xc008('0x34')]?_0x4f93a4[_0xc008('0x32')]:_0xf4cc4b[_0xc008('0x29')];if(_0x3e9a99[_0xc008('0x2e')][_0xc008('0x44')]){_0x4f93a4['include']=[{'all':!![]}];}_0x4f93a4=_['merge']({},_0x4f93a4,_0x3e9a99['options']);return db[_0xc008('0x26')][_0xc008('0x45')](_0x4f93a4)[_0xc008('0x21')](handleEntityNotFound(_0x7279e8,null))[_0xc008('0x21')](respondWithResult(_0x7279e8,null))[_0xc008('0x41')](handleError(_0x7279e8,null));};exports[_0xc008('0x46')]=function(_0x2cf641,_0x33be4f){return db['ScreenRecording']['create'](_0x2cf641['body'],{})[_0xc008('0x21')](respondWithResult(_0x33be4f,0xc9))[_0xc008('0x41')](handleError(_0x33be4f,null));};exports[_0xc008('0x20')]=function(_0x511383,_0x28bc33){if(_0x511383[_0xc008('0x47')]['id']){delete _0x511383[_0xc008('0x47')]['id'];}delete _0x511383[_0xc008('0x47')][_0xc008('0x48')];delete _0x511383[_0xc008('0x47')][_0xc008('0x49')];delete _0x511383[_0xc008('0x47')][_0xc008('0x4a')];delete _0x511383[_0xc008('0x47')]['value'];return db['ScreenRecording'][_0xc008('0x45')]({'where':{'id':_0x511383['params']['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x28bc33,null))[_0xc008('0x21')](saveUpdates(_0x511383[_0xc008('0x47')],null))['then'](respondWithResult(_0x28bc33,null))[_0xc008('0x41')](handleError(_0x28bc33,null));};exports[_0xc008('0x4b')]=function(_0xee64,_0x8b9775){return db[_0xc008('0x26')]['describe']()[_0xc008('0x21')](respondWithResult(_0x8b9775,null))[_0xc008('0x41')](handleError(_0x8b9775,null));};exports['download']=function(_0x24f775,_0xfd6d1d,_0x5b5fbf){var _0x51d3dc=require(_0xc008('0x4c'));var _0xd47b74=![];var _0x20947b={};if(_0x24f775[_0xc008('0x2e')][_0xc008('0x3a')]&&_0x24f775['query']['type']===_0xc008('0x4d')){_0x20947b['uniqueid']=_0x24f775[_0xc008('0x43')]['id'];}else{_0x20947b['id']=_0x24f775[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x45')]({'where':_0x20947b,'attributes':['id',_0xc008('0x4e')],'raw':!![]})[_0xc008('0x21')](handleEntityNotFound(_0xfd6d1d,null))['then'](function(_0x2ea742){if(_0x2ea742){var _0xbd7422=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x2ea742['value']);var _0x41fae3=util['format']('%s.cypher',_0xbd7422);if(fs['existsSync'](_0x41fae3)){_0xd47b74=!![];return _0x51d3dc[_0xc008('0x52')](_0x41fae3,_0xbd7422,config[_0xc008('0x53')][_0xc008('0x54')])['then'](function(){return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x21')](function(_0x2d8361){if(_0x2d8361){var _0x3dda82=path['join'](config[_0xc008('0x50')],_0xc008('0x51'),_0x2d8361[_0xc008('0x4e')]);if(!fs[_0xc008('0x55')](_0x3dda82)){throw new db['Sequelize'][(_0xc008('0x56'))]('ScreenRecording\x20not\x20found');}if(_0x2d8361[_0xc008('0x57')]){return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,_0x2d8361[_0xc008('0x57')]+path[_0xc008('0x59')](_0x3dda82),function(){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}else{return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,function(_0x4818c7){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}}})['catch'](function(_0x5bf4a9){if(_0x5bf4a9[_0xc008('0x5b')]===_0xc008('0x5c')){_0xfd6d1d['status'](0x194)[_0xc008('0x24')](_0xc008('0x5d'));}else{return handleError(_0xfd6d1d,null);}});};exports[_0xc008('0x22')]=function(_0x4517c0,_0x21ee6d){return db[_0xc008('0x26')][_0xc008('0x45')]({'where':{'id':_0x4517c0['params']['id']}})[_0xc008('0x21')](function(_0x462e1e){if(_[_0xc008('0x5e')](_0x462e1e)){throw new ReferenceError(_0xc008('0x5f'));}return _0x462e1e;})[_0xc008('0x21')](function(_0x167425){var _0x249898=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x167425[_0xc008('0x4e')]);logger[_0xc008('0x60')](_0xc008('0x61'),_0x249898);if(!_[_0xc008('0x5e')](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc008('0x63')](_0x249898);}_0x249898=_0x249898+_0xc008('0x64');if(!_['isNil'](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+_0xc008('0x65'));fs[_0xc008('0x63')](_0x249898);}return _0x167425;})[_0xc008('0x21')](function(_0x238852){if(!_0x238852)throw new InternalError();return _0x238852[_0xc008('0x22')]();})[_0xc008('0x21')](function(){_0x21ee6d[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();})['catch'](handleError(_0x21ee6d,null));}; \ No newline at end of file +var _0xa630=['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','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','intersection','fields','attributes','length','order','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','createdAt','value','describe','../../components/encryptor','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','ScreenRecording\x20not\x20found','filename','extname','download','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa630,0xbe));var _0x0a63=function(_0x28958d,_0xfa5f9f){_0x28958d=_0x28958d-0x0;var _0x439c72=_0xa630[_0x28958d];return _0x439c72;};'use strict';var emlformat=require(_0x0a63('0x0'));var rimraf=require(_0x0a63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a63('0x2'));var moment=require('moment');var BPromise=require(_0x0a63('0x3'));var Mustache=require('mustache');var util=require(_0x0a63('0x4'));var path=require(_0x0a63('0x5'));var sox=require(_0x0a63('0x6'));var csv=require(_0x0a63('0x7'));var ejs=require(_0x0a63('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a63('0x9'));var squel=require(_0x0a63('0xa'));var crypto=require(_0x0a63('0xb'));var jsforce=require(_0x0a63('0xc'));var deskjs=require(_0x0a63('0xd'));var toCsv=require(_0x0a63('0x7'));var querystring=require('querystring');var Papa=require(_0x0a63('0xe'));var Redis=require(_0x0a63('0xf'));var authService=require(_0x0a63('0x10'));var qs=require(_0x0a63('0x11'));var as=require(_0x0a63('0x12'));var hardwareService=require(_0x0a63('0x13'));var logger=require(_0x0a63('0x14'))(_0x0a63('0x15'));var utils=require(_0x0a63('0x16'));var config=require(_0x0a63('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a63('0x18'))['db'];function respondWithStatusCode(_0x420043,_0x2fce86){_0x2fce86=_0x2fce86||0xcc;return function(_0x3d6323){if(_0x3d6323){return _0x420043['sendStatus'](_0x2fce86);}return _0x420043[_0x0a63('0x19')](_0x2fce86)['end']();};}function respondWithResult(_0x331e99,_0x19e922){_0x19e922=_0x19e922||0xc8;return function(_0x26b2bc){if(_0x26b2bc){return _0x331e99[_0x0a63('0x19')](_0x19e922)[_0x0a63('0x1a')](_0x26b2bc);}};}function respondWithFilteredResult(_0x23b49d,_0x552b1f){return function(_0x1e3251){if(_0x1e3251){var _0x524a98=typeof _0x552b1f[_0x0a63('0x1b')]==='undefined'&&typeof _0x552b1f[_0x0a63('0x1c')]===_0x0a63('0x1d');var _0x36a9e8=_0x1e3251[_0x0a63('0x1e')];var _0x1f7481=_0x524a98?0x0:_0x552b1f[_0x0a63('0x1b')];var _0x30f292=_0x524a98?_0x1e3251[_0x0a63('0x1e')]:_0x552b1f[_0x0a63('0x1b')]+_0x552b1f[_0x0a63('0x1c')];var _0x2ad167;if(_0x30f292>=_0x36a9e8){_0x30f292=_0x36a9e8;_0x2ad167=0xc8;}else{_0x2ad167=0xce;}_0x23b49d['status'](_0x2ad167);return _0x23b49d['set'](_0x0a63('0x1f'),_0x1f7481+'-'+_0x30f292+'/'+_0x36a9e8)['json'](_0x1e3251);}return null;};}function patchUpdates(_0x2fc87c){return function(_0x5937df){try{jsonpatch[_0x0a63('0x20')](_0x5937df,_0x2fc87c,!![]);}catch(_0x41d6b8){return BPromise[_0x0a63('0x21')](_0x41d6b8);}return _0x5937df[_0x0a63('0x22')]();};}function saveUpdates(_0x5da46b,_0x398a16){return function(_0x4c225a){if(_0x4c225a){return _0x4c225a[_0x0a63('0x23')](_0x5da46b)[_0x0a63('0x24')](function(_0x1bf64a){return _0x1bf64a;});}return null;};}function removeEntity(_0x20c114,_0x343273){return function(_0x1f929f){if(_0x1f929f){return _0x1f929f[_0x0a63('0x25')]()[_0x0a63('0x24')](function(){_0x20c114['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55fb70,_0x4c8637){return function(_0xeacfc9){if(!_0xeacfc9){_0x55fb70['sendStatus'](0x194);}return _0xeacfc9;};}function handleError(_0x496c93,_0x2133cf){_0x2133cf=_0x2133cf||0x1f4;return function(_0x1d5448){logger[_0x0a63('0x26')](_0x1d5448[_0x0a63('0x27')]);if(_0x1d5448['name']){delete _0x1d5448[_0x0a63('0x28')];}_0x496c93[_0x0a63('0x19')](_0x2133cf)[_0x0a63('0x29')](_0x1d5448);};}exports['index']=function(_0x34239b,_0xcf409){var _0x1b7bdb={},_0x145090={},_0x32a52b={'count':0x0,'rows':[]};var _0x4577b6=_[_0x0a63('0x2a')](db[_0x0a63('0x2b')]['rawAttributes'],function(_0x58cc71){return{'name':_0x58cc71['fieldName'],'type':_0x58cc71[_0x0a63('0x2c')][_0x0a63('0x2d')]};});_0x145090[_0x0a63('0x2e')]=_[_0x0a63('0x2f')](_[_0x0a63('0x2a')](_0x4577b6,'name'),[_0x0a63('0x30')]);_0x145090[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x34239b[_0x0a63('0x31')]);_0x145090['filters']=_[_0x0a63('0x33')](_0x145090[_0x0a63('0x2e')],_0x145090['query']);_0x1b7bdb['attributes']=_[_0x0a63('0x33')](_0x145090['model'],qs['fields'](_0x34239b[_0x0a63('0x31')][_0x0a63('0x34')]));_0x1b7bdb['attributes']=_0x1b7bdb[_0x0a63('0x35')][_0x0a63('0x36')]?_0x1b7bdb[_0x0a63('0x35')]:_0x145090[_0x0a63('0x2e')];if(!_0x34239b[_0x0a63('0x31')]['hasOwnProperty']('nolimit')){_0x1b7bdb[_0x0a63('0x1c')]=qs[_0x0a63('0x1c')](_0x34239b[_0x0a63('0x31')][_0x0a63('0x1c')]);_0x1b7bdb[_0x0a63('0x1b')]=qs[_0x0a63('0x1b')](_0x34239b['query'][_0x0a63('0x1b')]);}_0x1b7bdb[_0x0a63('0x37')]=qs['sort'](_0x34239b[_0x0a63('0x31')]['sort']);_0x1b7bdb['where']=qs[_0x0a63('0x38')](_[_0x0a63('0x39')](_0x34239b[_0x0a63('0x31')],_0x145090['filters']),_0x4577b6);if(_0x34239b[_0x0a63('0x31')][_0x0a63('0x3a')]){_0x1b7bdb[_0x0a63('0x3b')]=_[_0x0a63('0x3c')](_0x1b7bdb[_0x0a63('0x3b')],{'$or':_[_0x0a63('0x2a')](_0x4577b6,function(_0x604a45){if(_0x604a45['type']!==_0x0a63('0x3d')){var _0x1c7e67={};_0x1c7e67[_0x604a45[_0x0a63('0x28')]]={'$like':'%'+_0x34239b['query']['filter']+'%'};return _0x1c7e67;}})});}_0x1b7bdb=_[_0x0a63('0x3c')]({},_0x1b7bdb,_0x34239b['options']);var _0x1a01f4={'where':_0x1b7bdb[_0x0a63('0x3b')]};return db[_0x0a63('0x2b')]['count'](_0x1a01f4)[_0x0a63('0x24')](function(_0x14c737){_0x32a52b[_0x0a63('0x1e')]=_0x14c737;if(_0x34239b[_0x0a63('0x31')]['includeAll']){_0x1b7bdb[_0x0a63('0x3e')]=[{'all':!![]}];}return db[_0x0a63('0x2b')][_0x0a63('0x3f')](_0x1b7bdb);})[_0x0a63('0x24')](function(_0xf18ace){_0x32a52b[_0x0a63('0x40')]=_0xf18ace;return _0x32a52b;})['then'](respondWithFilteredResult(_0xcf409,_0x1b7bdb))[_0x0a63('0x41')](handleError(_0xcf409,null));};exports[_0x0a63('0x42')]=function(_0x347a0b,_0x793502){var _0x20fa0d={'raw':![],'where':{'id':_0x347a0b[_0x0a63('0x43')]['id']}},_0x2482ca={};_0x2482ca[_0x0a63('0x2e')]=_[_0x0a63('0x32')](db[_0x0a63('0x2b')][_0x0a63('0x44')]);_0x2482ca[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x347a0b[_0x0a63('0x31')]);_0x2482ca[_0x0a63('0x38')]=_[_0x0a63('0x33')](_0x2482ca[_0x0a63('0x2e')],_0x2482ca[_0x0a63('0x31')]);_0x20fa0d['attributes']=_[_0x0a63('0x33')](_0x2482ca['model'],qs['fields'](_0x347a0b[_0x0a63('0x31')][_0x0a63('0x34')]));_0x20fa0d[_0x0a63('0x35')]=_0x20fa0d[_0x0a63('0x35')][_0x0a63('0x36')]?_0x20fa0d[_0x0a63('0x35')]:_0x2482ca[_0x0a63('0x2e')];if(_0x347a0b[_0x0a63('0x31')][_0x0a63('0x45')]){_0x20fa0d[_0x0a63('0x3e')]=[{'all':!![]}];}_0x20fa0d=_[_0x0a63('0x3c')]({},_0x20fa0d,_0x347a0b[_0x0a63('0x46')]);return db[_0x0a63('0x2b')][_0x0a63('0x47')](_0x20fa0d)[_0x0a63('0x24')](handleEntityNotFound(_0x793502,null))[_0x0a63('0x24')](respondWithResult(_0x793502,null))[_0x0a63('0x41')](handleError(_0x793502,null));};exports[_0x0a63('0x48')]=function(_0x366887,_0x148e0a){return db['ScreenRecording'][_0x0a63('0x48')](_0x366887[_0x0a63('0x49')],{})['then'](respondWithResult(_0x148e0a,0xc9))['catch'](handleError(_0x148e0a,null));};exports['update']=function(_0x485f20,_0x36d066){if(_0x485f20[_0x0a63('0x49')]['id']){delete _0x485f20['body']['id'];}delete _0x485f20[_0x0a63('0x49')]['duration'];delete _0x485f20[_0x0a63('0x49')][_0x0a63('0x4a')];delete _0x485f20['body']['closedAt'];delete _0x485f20['body'][_0x0a63('0x4b')];return db[_0x0a63('0x2b')][_0x0a63('0x47')]({'where':{'id':_0x485f20[_0x0a63('0x43')]['id']}})[_0x0a63('0x24')](handleEntityNotFound(_0x36d066,null))['then'](saveUpdates(_0x485f20[_0x0a63('0x49')],null))[_0x0a63('0x24')](respondWithResult(_0x36d066,null))[_0x0a63('0x41')](handleError(_0x36d066,null));};exports[_0x0a63('0x4c')]=function(_0x3575ae,_0x4a5b6e){return db[_0x0a63('0x2b')][_0x0a63('0x4c')]()[_0x0a63('0x24')](respondWithResult(_0x4a5b6e,null))[_0x0a63('0x41')](handleError(_0x4a5b6e,null));};exports['download']=function(_0x35b688,_0x3bd10c,_0x337bef){var _0x330550=require(_0x0a63('0x4d'));var _0x258ed3=![];var _0x4d4e20={};if(_0x35b688[_0x0a63('0x31')][_0x0a63('0x2c')]&&_0x35b688[_0x0a63('0x31')][_0x0a63('0x2c')]==='uniqueid'){_0x4d4e20['uniqueid']=_0x35b688[_0x0a63('0x43')]['id'];}else{_0x4d4e20['id']=_0x35b688[_0x0a63('0x43')]['id'];}return db[_0x0a63('0x2b')][_0x0a63('0x47')]({'where':_0x4d4e20,'attributes':['id',_0x0a63('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x3bd10c,null))['then'](function(_0x58b3a8){if(_0x58b3a8){var _0x42c1bb=path['join'](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0x58b3a8[_0x0a63('0x4b')]);var _0x5d77e3=util['format'](_0x0a63('0x50'),_0x42c1bb);if(fs[_0x0a63('0x51')](_0x5d77e3)){_0x258ed3=!![];return _0x330550[_0x0a63('0x52')](_0x5d77e3,_0x42c1bb,config[_0x0a63('0x53')][_0x0a63('0x54')])[_0x0a63('0x24')](function(){return _0x58b3a8;});}return _0x58b3a8;}})[_0x0a63('0x24')](function(_0xc3415c){if(_0xc3415c){var _0xe454ef=path[_0x0a63('0x55')](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0xc3415c[_0x0a63('0x4b')]);if(!fs[_0x0a63('0x51')](_0xe454ef)){throw new db['Sequelize']['ValidationError'](_0x0a63('0x56'));}if(_0xc3415c[_0x0a63('0x57')]){return _0x3bd10c['download'](_0xe454ef,_0xc3415c[_0x0a63('0x57')]+path[_0x0a63('0x58')](_0xe454ef),function(){if(_0x258ed3){fs['unlink'](_0xe454ef);}});}else{return _0x3bd10c[_0x0a63('0x59')](_0xe454ef,function(_0x3053e4){if(_0x258ed3){fs['unlink'](_0xe454ef);}});}}})['catch'](function(_0x3b395a){if(_0x3b395a[_0x0a63('0x5a')]===_0x0a63('0x56')){_0x3bd10c['status'](0x194)[_0x0a63('0x29')](_0x0a63('0x5b'));}else{return handleError(_0x3bd10c,null);}});};exports[_0x0a63('0x25')]=function(_0x284dca,_0x15fc2e){return db['ScreenRecording'][_0x0a63('0x47')]({'where':{'id':_0x284dca[_0x0a63('0x43')]['id']}})[_0x0a63('0x24')](function(_0x1fa9cd){if(_[_0x0a63('0x5c')](_0x1fa9cd)){throw new ReferenceError(_0x0a63('0x5d'));}return _0x1fa9cd;})[_0x0a63('0x24')](function(_0x57313b){var _0x4571e7=path[_0x0a63('0x55')](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0x57313b[_0x0a63('0x4b')]);logger[_0x0a63('0x5e')](_0x0a63('0x5f'),_0x4571e7);if(!_[_0x0a63('0x5c')](_0x57313b['value'])&&fs['existsSync'](_0x4571e7)){logger[_0x0a63('0x5e')](_0x0a63('0x60')+_0x4571e7+_0x0a63('0x61'));fs[_0x0a63('0x62')](_0x4571e7);}_0x4571e7=_0x4571e7+_0x0a63('0x63');if(!_['isNil'](_0x57313b[_0x0a63('0x4b')])&&fs[_0x0a63('0x51')](_0x4571e7)){logger[_0x0a63('0x5e')](_0x0a63('0x60')+_0x4571e7+_0x0a63('0x61'));fs[_0x0a63('0x62')](_0x4571e7);}return _0x57313b;})[_0x0a63('0x24')](function(_0xe52dfd){if(!_0xe52dfd)throw new InternalError();return _0xe52dfd[_0x0a63('0x25')]();})[_0x0a63('0x24')](function(){_0x15fc2e[_0x0a63('0x19')](0xcc)['end']();})[_0x0a63('0x41')](handleError(_0x15fc2e,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index d6f278e..a482217 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 _0x11ea=['screen_recordings','interactionid','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./screenRecording.attributes','exports','define'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0x11ea,0x10a));var _0xa11e=function(_0xcfd779,_0x880a96){_0xcfd779=_0xcfd779-0x0;var _0x5f4cee=_0x11ea[_0xcfd779];return _0x5f4cee;};'use strict';var _=require(_0xa11e('0x0'));var util=require(_0xa11e('0x1'));var logger=require(_0xa11e('0x2'))('api');var moment=require(_0xa11e('0x3'));var BPromise=require(_0xa11e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa11e('0x5'));var config=require(_0xa11e('0x6'));var attributes=require(_0xa11e('0x7'));module[_0xa11e('0x8')]=function(_0x556865,_0x476809){return _0x556865[_0xa11e('0x9')]('ScreenRecording',attributes,{'tableName':_0xa11e('0xa'),'paranoid':![],'indexes':[{'name':_0xa11e('0xb'),'fields':[_0xa11e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa4a0=['../../config/logger','api','moment','request-promise','path','rimraf','./screenRecording.attributes','ScreenRecording','interactionid','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa4a0,0xdb));var _0x0a4a=function(_0x424076,_0x5b4170){_0x424076=_0x424076-0x0;var _0xcbfb1d=_0xa4a0[_0x424076];return _0xcbfb1d;};'use strict';var _=require(_0x0a4a('0x0'));var util=require('util');var logger=require(_0x0a4a('0x1'))(_0x0a4a('0x2'));var moment=require(_0x0a4a('0x3'));var BPromise=require('bluebird');var rp=require(_0x0a4a('0x4'));var fs=require('fs');var path=require(_0x0a4a('0x5'));var rimraf=require(_0x0a4a('0x6'));var config=require('../../config/environment');var attributes=require(_0x0a4a('0x7'));module['exports']=function(_0x1e0b83,_0x5ea940){return _0x1e0b83['define'](_0x0a4a('0x8'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x0a4a('0x9'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index c773eac..923792a 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 _0x30dd=['debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x4d86d4,_0x10cbee){var _0x30f0f2=function(_0x148e51){while(--_0x148e51){_0x4d86d4['push'](_0x4d86d4['shift']());}};_0x30f0f2(++_0x10cbee);}(_0x30dd,0x124));var _0xd30d=function(_0x1d08f3,_0x3acdd7){_0x1d08f3=_0x1d08f3-0x0;var _0x465c79=_0x30dd[_0x1d08f3];return _0x465c79;};'use strict';var _=require(_0xd30d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd30d('0x1'));var db=require(_0xd30d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xd30d('0x3'))(_0xd30d('0x4'));var config=require('../../config/environment');var jayson=require(_0xd30d('0x5'));var client=jayson[_0xd30d('0x6')][_0xd30d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x41debf,_0x2134f2,_0x4406d4){return new BPromise(function(_0x14717f,_0x57173d){return client['request'](_0x41debf,_0x4406d4)[_0xd30d('0x8')](function(_0x9c8154){logger[_0xd30d('0x9')](_0xd30d('0xa'),_0x2134f2,_0xd30d('0xb'));logger[_0xd30d('0xc')](_0xd30d('0xd'),_0x2134f2,_0xd30d('0xb'),JSON[_0xd30d('0xe')](_0x9c8154));if(_0x9c8154[_0xd30d('0xf')]){if(_0x9c8154[_0xd30d('0xf')][_0xd30d('0x10')]===0x1f4){logger[_0xd30d('0xf')](_0xd30d('0xa'),_0x2134f2,_0x9c8154[_0xd30d('0xf')][_0xd30d('0x11')]);return _0x57173d(_0x9c8154[_0xd30d('0xf')][_0xd30d('0x11')]);}logger[_0xd30d('0xf')](_0xd30d('0xa'),_0x2134f2,_0x9c8154[_0xd30d('0xf')][_0xd30d('0x11')]);return _0x14717f(_0x9c8154[_0xd30d('0xf')][_0xd30d('0x11')]);}else{logger['info'](_0xd30d('0xa'),_0x2134f2,'request\x20sent');_0x14717f(_0x9c8154[_0xd30d('0x12')][_0xd30d('0x11')]);}})['catch'](function(_0x2bc2de){logger[_0xd30d('0xf')](_0xd30d('0xa'),_0x2134f2,_0x2bc2de);_0x57173d(_0x2bc2de);});});} \ No newline at end of file +var _0x3afd=['message','ScreenRecording,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2be532,_0x232e63){var _0x193d9a=function(_0x166e6b){while(--_0x166e6b){_0x2be532['push'](_0x2be532['shift']());}};_0x193d9a(++_0x232e63);}(_0x3afd,0x90));var _0xd3af=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0x3afd[_0x9b5bb2];return _0x2e1e92;};'use strict';var _=require(_0xd3af('0x0'));var util=require(_0xd3af('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd3af('0x2'));var fs=require('fs');var Redis=require(_0xd3af('0x3'));var db=require(_0xd3af('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd3af('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd3af('0x6')][_0xd3af('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1bc643,_0x4b1787,_0xd05a4b){return new BPromise(function(_0x4418b0,_0x3fa057){return client[_0xd3af('0x8')](_0x1bc643,_0xd05a4b)[_0xd3af('0x9')](function(_0x2e6624){logger[_0xd3af('0xa')]('ScreenRecording,\x20%s,\x20%s',_0x4b1787,_0xd3af('0xb'));logger[_0xd3af('0xc')](_0xd3af('0xd'),_0x4b1787,'request\x20sent',JSON['stringify'](_0x2e6624));if(_0x2e6624[_0xd3af('0xe')]){if(_0x2e6624[_0xd3af('0xe')][_0xd3af('0xf')]===0x1f4){logger[_0xd3af('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x4b1787,_0x2e6624[_0xd3af('0xe')]['message']);return _0x3fa057(_0x2e6624[_0xd3af('0xe')][_0xd3af('0x10')]);}logger[_0xd3af('0xe')](_0xd3af('0x11'),_0x4b1787,_0x2e6624[_0xd3af('0xe')][_0xd3af('0x10')]);return _0x4418b0(_0x2e6624[_0xd3af('0xe')][_0xd3af('0x10')]);}else{logger[_0xd3af('0xa')]('ScreenRecording,\x20%s,\x20%s',_0x4b1787,'request\x20sent');_0x4418b0(_0x2e6624[_0xd3af('0x12')][_0xd3af('0x10')]);}})[_0xd3af('0x13')](function(_0x348c1c){logger[_0xd3af('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x4b1787,_0x348c1c);_0x3fa057(_0x348c1c);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 646935e..d2a1527 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 _0xeee7=['addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','root','format','%s%s','logo','originalname','post','file','addLogo','diskStorage','server/files/images/logos/','logologin','single','addLogoLogin','join','preferred','extname','addPreferred'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeee7,0x13f));var _0x7eee=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xeee7[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x7eee('0x0'));var util=require(_0x7eee('0x1'));var path=require(_0x7eee('0x2'));var timeout=require(_0x7eee('0x3'));var express=require(_0x7eee('0x4'));var router=express[_0x7eee('0x5')]();var fs_extra=require(_0x7eee('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7eee('0x7'));var config=require(_0x7eee('0x8'));var controller=require(_0x7eee('0x9'));router['get']('/',auth[_0x7eee('0xa')](),controller[_0x7eee('0xb')]);router[_0x7eee('0xc')](_0x7eee('0xd'),controller['getDate']);router[_0x7eee('0xc')](_0x7eee('0xe'),controller[_0x7eee('0xf')]);router[_0x7eee('0xc')](_0x7eee('0x10'),controller[_0x7eee('0x11')]);router[_0x7eee('0xc')](_0x7eee('0x12'),controller[_0x7eee('0x13')]);router[_0x7eee('0xc')](_0x7eee('0x14'),controller[_0x7eee('0x15')]);router[_0x7eee('0xc')](_0x7eee('0x16'),controller['getPreferred']);router['get'](_0x7eee('0x17'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x51cae5,_0x57c7ed,_0x5218dc){_0x5218dc(null,path['join'](config[_0x7eee('0x18')],'server/files/images/logos/'));},'filename':function(_0x17f484,_0x540192,_0x61c350){_0x61c350(null,util[_0x7eee('0x19')](_0x7eee('0x1a'),_0x7eee('0x1b'),path['extname'](_0x540192[_0x7eee('0x1c')])));}})});router[_0x7eee('0x1d')](_0x7eee('0x10'),upload['single'](_0x7eee('0x1e')),controller[_0x7eee('0x1f')]);var upload=multer({'storage':multer[_0x7eee('0x20')]({'destination':function(_0x422c97,_0x1fa8b2,_0x259178){_0x259178(null,path['join'](config[_0x7eee('0x18')],_0x7eee('0x21')));},'filename':function(_0x570c4d,_0x59beaf,_0x14eb25){_0x14eb25(null,util[_0x7eee('0x19')]('%s%s',_0x7eee('0x22'),path['extname'](_0x59beaf[_0x7eee('0x1c')])));}})});router['post']('/:id/logo_login',upload[_0x7eee('0x23')](_0x7eee('0x1e')),controller[_0x7eee('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4ac720,_0x498bb0,_0x4056be){_0x4056be(null,path[_0x7eee('0x25')](config['root'],_0x7eee('0x21')));},'filename':function(_0x2fd590,_0x21e27f,_0x247cce){_0x247cce(null,util['format'](_0x7eee('0x1a'),_0x7eee('0x26'),path[_0x7eee('0x27')](_0x21e27f[_0x7eee('0x1c')])));}})});router[_0x7eee('0x1d')](_0x7eee('0x16'),upload['single'](_0x7eee('0x1e')),controller[_0x7eee('0x28')]);var upload=multer({'storage':multer[_0x7eee('0x20')]({'destination':function(_0x4c1ca4,_0xfe527,_0x15c95c){_0x15c95c(null,path['join'](config[_0x7eee('0x18')],_0x7eee('0x21')));},'filename':function(_0x529509,_0x2d1542,_0x303e11){_0x303e11(null,util['format']('%s%s','favicon',path[_0x7eee('0x27')](_0x2d1542['originalname'])));}})});router[_0x7eee('0x1d')](_0x7eee('0x17'),upload[_0x7eee('0x23')](_0x7eee('0x1e')),controller[_0x7eee('0x29')]);router[_0x7eee('0x2a')](_0x7eee('0xe'),auth[_0x7eee('0xa')](),controller[_0x7eee('0x2b')]);module[_0x7eee('0x2c')]=router; \ No newline at end of file +var _0xcfa6=['file','addLogo','single','addLogoLogin','diskStorage','preferred','/:id/preferred','addPreferred','favicon','addFavicon','update','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post'];(function(_0x9a1f7b,_0x3e9bc4){var _0x5851f5=function(_0xb822a6){while(--_0xb822a6){_0x9a1f7b['push'](_0x9a1f7b['shift']());}};_0x5851f5(++_0x3e9bc4);}(_0xcfa6,0x1ec));var _0x6cfa=function(_0x45c8f1,_0x1d6a1b){_0x45c8f1=_0x45c8f1-0x0;var _0x3104bb=_0xcfa6[_0x45c8f1];return _0x3104bb;};'use strict';var multer=require(_0x6cfa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6cfa('0x1'));var express=require(_0x6cfa('0x2'));var router=express[_0x6cfa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6cfa('0x4'));var interaction=require(_0x6cfa('0x5'));var config=require(_0x6cfa('0x6'));var controller=require('./setting.controller');router[_0x6cfa('0x7')]('/',auth[_0x6cfa('0x8')](),controller[_0x6cfa('0x9')]);router[_0x6cfa('0x7')]('/now',controller['getDate']);router[_0x6cfa('0x7')](_0x6cfa('0xa'),controller['show']);router[_0x6cfa('0x7')](_0x6cfa('0xb'),controller[_0x6cfa('0xc')]);router['get'](_0x6cfa('0xd'),controller[_0x6cfa('0xe')]);router[_0x6cfa('0x7')]('/:id/gdpr',controller[_0x6cfa('0xf')]);router[_0x6cfa('0x7')]('/:id/preferred',controller[_0x6cfa('0x10')]);router[_0x6cfa('0x7')](_0x6cfa('0x11'),controller[_0x6cfa('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x529028,_0x14de46,_0x243eaa){_0x243eaa(null,path[_0x6cfa('0x13')](config[_0x6cfa('0x14')],_0x6cfa('0x15')));},'filename':function(_0x4ff020,_0x2ab821,_0x446dc4){_0x446dc4(null,util[_0x6cfa('0x16')](_0x6cfa('0x17'),_0x6cfa('0x18'),path[_0x6cfa('0x19')](_0x2ab821[_0x6cfa('0x1a')])));}})});router[_0x6cfa('0x1b')](_0x6cfa('0xb'),upload['single'](_0x6cfa('0x1c')),controller[_0x6cfa('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x6e77ac,_0x47bf1e,_0x4341bc){_0x4341bc(null,path[_0x6cfa('0x13')](config[_0x6cfa('0x14')],_0x6cfa('0x15')));},'filename':function(_0x62845b,_0x1c3974,_0xd2e5a3){_0xd2e5a3(null,util[_0x6cfa('0x16')](_0x6cfa('0x17'),'logologin',path[_0x6cfa('0x19')](_0x1c3974[_0x6cfa('0x1a')])));}})});router[_0x6cfa('0x1b')]('/:id/logo_login',upload[_0x6cfa('0x1e')](_0x6cfa('0x1c')),controller[_0x6cfa('0x1f')]);var upload=multer({'storage':multer[_0x6cfa('0x20')]({'destination':function(_0x407939,_0x1d2735,_0x27a649){_0x27a649(null,path[_0x6cfa('0x13')](config[_0x6cfa('0x14')],_0x6cfa('0x15')));},'filename':function(_0xa154e1,_0x1e7c68,_0x4ff1d0){_0x4ff1d0(null,util['format']('%s%s',_0x6cfa('0x21'),path[_0x6cfa('0x19')](_0x1e7c68[_0x6cfa('0x1a')])));}})});router['post'](_0x6cfa('0x22'),upload[_0x6cfa('0x1e')](_0x6cfa('0x1c')),controller[_0x6cfa('0x23')]);var upload=multer({'storage':multer[_0x6cfa('0x20')]({'destination':function(_0x3bc460,_0x5a9847,_0x1896bc){_0x1896bc(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x54ddbf,_0xf03dcb,_0x96862e){_0x96862e(null,util[_0x6cfa('0x16')]('%s%s',_0x6cfa('0x24'),path[_0x6cfa('0x19')](_0xf03dcb[_0x6cfa('0x1a')])));}})});router[_0x6cfa('0x1b')]('/:id/favicon',upload['single'](_0x6cfa('0x1c')),controller[_0x6cfa('0x25')]);router['put'](_0x6cfa('0xa'),auth[_0x6cfa('0x8')](),controller[_0x6cfa('0x26')]);module[_0x6cfa('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 35b4f71..a93b34d 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 _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3ab382,_0x1c2b39){var _0xdeb5fa=function(_0xff3e64){while(--_0xff3e64){_0x3ab382['push'](_0x3ab382['shift']());}};_0xdeb5fa(++_0x1c2b39);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x57baed,_0x8d29b1){var _0x50cbb4=function(_0x5d9193){while(--_0x5d9193){_0x57baed['push'](_0x57baed['shift']());}};_0x50cbb4(++_0x8d29b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index d22992e..cef2dba 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 _0x8c77=['api','../../config/utils','../../config/environment','../../config/license/util','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','send','map','Setting','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','findAll','show','options','update','body','find','params','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default','upperFirst','custom','Sequelize','ValidationError','download','getLogoLogin','getLicense','defaultLogo','default_loginLogo.svg','\x20not\x20found','gdpr','securePassword','addPreferred','preferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4fe204,_0x2c2f07){var _0x29e532=function(_0x25c782){while(--_0x25c782){_0x4fe204['push'](_0x4fe204['shift']());}};_0x29e532(++_0x2c2f07);}(_0x8c77,0x1d6));var _0x78c7=function(_0x4f712c,_0x37bc8d){_0x4f712c=_0x4f712c-0x0;var _0x374298=_0x8c77[_0x4f712c];return _0x374298;};'use strict';var emlformat=require(_0x78c7('0x0'));var rimraf=require(_0x78c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x78c7('0x2'));var rp=require(_0x78c7('0x3'));var moment=require(_0x78c7('0x4'));var BPromise=require(_0x78c7('0x5'));var Mustache=require(_0x78c7('0x6'));var util=require(_0x78c7('0x7'));var path=require(_0x78c7('0x8'));var sox=require(_0x78c7('0x9'));var csv=require(_0x78c7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78c7('0xb'));var _=require(_0x78c7('0xc'));var squel=require(_0x78c7('0xd'));var crypto=require(_0x78c7('0xe'));var jsforce=require(_0x78c7('0xf'));var deskjs=require(_0x78c7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x78c7('0x11'));var Papa=require('papaparse');var Redis=require(_0x78c7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x78c7('0x13'));var hardwareService=require(_0x78c7('0x14'));var logger=require(_0x78c7('0x15'))(_0x78c7('0x16'));var utils=require(_0x78c7('0x17'));var config=require(_0x78c7('0x18'));var licenseUtil=require(_0x78c7('0x19'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x78c7('0x1a')][_0x78c7('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4b4060,_0x3708c0,_0x4589ae,_0x5a8700){return new BPromise(function(_0x55df5b,_0x571302){var _0x72324d=_0x5a8700||client;return _0x72324d[_0x78c7('0x1c')](_0x4b4060,_0x4589ae)['then'](function(_0x15797a){logger[_0x78c7('0x1d')](_0x78c7('0x1e'),_0x3708c0,_0x78c7('0x1f'));logger[_0x78c7('0x20')](_0x78c7('0x21'),_0x3708c0,_0x78c7('0x1f'),JSON[_0x78c7('0x22')](_0x15797a));if(_0x15797a[_0x78c7('0x23')]){if(_0x15797a['error'][_0x78c7('0x24')]===0x1f4){logger[_0x78c7('0x23')]('Setting,\x20%s,\x20%s',_0x3708c0,_0x15797a[_0x78c7('0x23')][_0x78c7('0x25')]);return _0x571302(_0x15797a[_0x78c7('0x23')][_0x78c7('0x25')]);}logger['error'](_0x78c7('0x1e'),_0x3708c0,_0x15797a['error'][_0x78c7('0x25')]);return _0x55df5b(_0x15797a[_0x78c7('0x23')]['message']);}else{logger[_0x78c7('0x1d')](_0x78c7('0x1e'),_0x3708c0,_0x78c7('0x1f'));_0x55df5b(_0x15797a['result'][_0x78c7('0x25')]);}})[_0x78c7('0x26')](function(_0x264d31){logger[_0x78c7('0x23')](_0x78c7('0x1e'),_0x3708c0,_0x264d31);_0x571302(_0x264d31);});});}function respondWithStatusCode(_0x1bf774,_0x51a461){_0x51a461=_0x51a461||0xcc;return function(_0x937ad5){if(_0x937ad5){return _0x1bf774['sendStatus'](_0x51a461);}return _0x1bf774['status'](_0x51a461)[_0x78c7('0x27')]();};}function respondWithResult(_0x4a6c1b,_0x3e5d34){_0x3e5d34=_0x3e5d34||0xc8;return function(_0x5bf39b){if(_0x5bf39b){return _0x4a6c1b['status'](_0x3e5d34)['json'](_0x5bf39b);}};}function respondWithFilteredResult(_0x1a5ae5,_0x2c0a4e){return function(_0x1b5a7a){if(_0x1b5a7a){var _0x3354bc=typeof _0x2c0a4e[_0x78c7('0x28')]===_0x78c7('0x29')&&typeof _0x2c0a4e['limit']===_0x78c7('0x29');var _0x4d8d73=_0x1b5a7a[_0x78c7('0x2a')];var _0x3f4103=_0x3354bc?0x0:_0x2c0a4e[_0x78c7('0x28')];var _0x5f1aba=_0x3354bc?_0x1b5a7a[_0x78c7('0x2a')]:_0x2c0a4e[_0x78c7('0x28')]+_0x2c0a4e[_0x78c7('0x2b')];var _0x3f0a83;if(_0x5f1aba>=_0x4d8d73){_0x5f1aba=_0x4d8d73;_0x3f0a83=0xc8;}else{_0x3f0a83=0xce;}_0x1a5ae5[_0x78c7('0x2c')](_0x3f0a83);return _0x1a5ae5[_0x78c7('0x2d')](_0x78c7('0x2e'),_0x3f4103+'-'+_0x5f1aba+'/'+_0x4d8d73)[_0x78c7('0x2f')](_0x1b5a7a);}return null;};}function patchUpdates(_0x106483){return function(_0x2a687e){try{jsonpatch[_0x78c7('0x30')](_0x2a687e,_0x106483,!![]);}catch(_0x187447){return BPromise[_0x78c7('0x31')](_0x187447);}return _0x2a687e[_0x78c7('0x32')]();};}function saveUpdates(_0x5d756c,_0x3fe316){return function(_0x20b006){if(_0x20b006){return _0x20b006['update'](_0x5d756c)[_0x78c7('0x33')](function(_0x35bead){return _0x35bead;});}return null;};}function removeEntity(_0x3b45c4,_0x44cf52){return function(_0x35cec6){if(_0x35cec6){return _0x35cec6[_0x78c7('0x34')]()[_0x78c7('0x33')](function(){_0x3b45c4[_0x78c7('0x2c')](0xcc)[_0x78c7('0x27')]();});}};}function handleEntityNotFound(_0x55de1c,_0x43858d){return function(_0x311b7d){if(!_0x311b7d){_0x55de1c[_0x78c7('0x35')](0x194);}return _0x311b7d;};}function handleError(_0x29f8a4,_0xcbd41f){_0xcbd41f=_0xcbd41f||0x1f4;return function(_0xa4ed8f){logger['error'](_0xa4ed8f[_0x78c7('0x36')]);if(_0xa4ed8f['name']){delete _0xa4ed8f[_0x78c7('0x37')];}_0x29f8a4[_0x78c7('0x2c')](_0xcbd41f)[_0x78c7('0x38')](_0xa4ed8f);};}exports['index']=function(_0x1122c5,_0x5962f9){var _0x290bfd={},_0x423e52={},_0x5c5669={'count':0x0,'rows':[]};var _0xc5ff76=_[_0x78c7('0x39')](db[_0x78c7('0x3a')][_0x78c7('0x3b')],function(_0x1e2b71){return{'name':_0x1e2b71['fieldName'],'type':_0x1e2b71[_0x78c7('0x3c')]['key']};});_0x423e52[_0x78c7('0x3d')]=_[_0x78c7('0x39')](_0xc5ff76,_0x78c7('0x37'));_0x423e52['query']=_[_0x78c7('0x3e')](_0x1122c5[_0x78c7('0x3f')]);_0x423e52[_0x78c7('0x40')]=_[_0x78c7('0x41')](_0x423e52[_0x78c7('0x3d')],_0x423e52['query']);_0x290bfd[_0x78c7('0x42')]=_[_0x78c7('0x41')](_0x423e52[_0x78c7('0x3d')],qs[_0x78c7('0x43')](_0x1122c5[_0x78c7('0x3f')][_0x78c7('0x43')]));_0x290bfd[_0x78c7('0x42')]=_0x290bfd['attributes'][_0x78c7('0x44')]?_0x290bfd[_0x78c7('0x42')]:_0x423e52['model'];if(!_0x1122c5[_0x78c7('0x3f')][_0x78c7('0x45')](_0x78c7('0x46'))){_0x290bfd[_0x78c7('0x2b')]=qs[_0x78c7('0x2b')](_0x1122c5[_0x78c7('0x3f')]['limit']);_0x290bfd[_0x78c7('0x28')]=qs[_0x78c7('0x28')](_0x1122c5['query'][_0x78c7('0x28')]);}_0x290bfd[_0x78c7('0x47')]=qs[_0x78c7('0x48')](_0x1122c5[_0x78c7('0x3f')][_0x78c7('0x48')]);_0x290bfd['where']=qs[_0x78c7('0x40')](_[_0x78c7('0x49')](_0x1122c5[_0x78c7('0x3f')],_0x423e52[_0x78c7('0x40')]),_0xc5ff76);if(_0x1122c5[_0x78c7('0x3f')][_0x78c7('0x4a')]){_0x290bfd[_0x78c7('0x4b')]=_[_0x78c7('0x4c')](_0x290bfd[_0x78c7('0x4b')],{'$or':_[_0x78c7('0x39')](_0xc5ff76,function(_0x1d1457){if(_0x1d1457['type']!=='VIRTUAL'){var _0x299064={};_0x299064[_0x1d1457[_0x78c7('0x37')]]={'$like':'%'+_0x1122c5['query']['filter']+'%'};return _0x299064;}})});}_0x290bfd=_[_0x78c7('0x4c')]({},_0x290bfd,_0x1122c5['options']);var _0x192bd0={'where':_0x290bfd[_0x78c7('0x4b')]};return db[_0x78c7('0x3a')][_0x78c7('0x2a')](_0x192bd0)[_0x78c7('0x33')](function(_0x1a96b0){_0x5c5669[_0x78c7('0x2a')]=_0x1a96b0;if(_0x1122c5[_0x78c7('0x3f')][_0x78c7('0x4d')]){_0x290bfd['include']=[{'all':!![]}];}return db[_0x78c7('0x3a')][_0x78c7('0x4e')](_0x290bfd);})[_0x78c7('0x33')](function(_0x26d241){_0x5c5669['rows']=_0x26d241;return _0x5c5669;})[_0x78c7('0x33')](respondWithFilteredResult(_0x5962f9,_0x290bfd))[_0x78c7('0x26')](handleError(_0x5962f9,null));};exports[_0x78c7('0x4f')]=function(_0x47837c,_0x253190){var _0x250475={'raw':![],'where':{'id':_0x47837c['params']['id']}},_0x4d87c5={};_0x4d87c5[_0x78c7('0x3d')]=_[_0x78c7('0x3e')](db[_0x78c7('0x3a')][_0x78c7('0x3b')]);_0x4d87c5[_0x78c7('0x3f')]=_[_0x78c7('0x3e')](_0x47837c[_0x78c7('0x3f')]);_0x4d87c5[_0x78c7('0x40')]=_[_0x78c7('0x41')](_0x4d87c5[_0x78c7('0x3d')],_0x4d87c5[_0x78c7('0x3f')]);_0x250475[_0x78c7('0x42')]=_[_0x78c7('0x41')](_0x4d87c5[_0x78c7('0x3d')],qs[_0x78c7('0x43')](_0x47837c[_0x78c7('0x3f')][_0x78c7('0x43')]));_0x250475[_0x78c7('0x42')]=_0x250475[_0x78c7('0x42')]['length']?_0x250475[_0x78c7('0x42')]:_0x4d87c5[_0x78c7('0x3d')];if(_0x47837c[_0x78c7('0x3f')][_0x78c7('0x4d')]){_0x250475['include']=[{'all':!![]}];}_0x250475=_['merge']({},_0x250475,_0x47837c[_0x78c7('0x50')]);return db[_0x78c7('0x3a')]['find'](_0x250475)[_0x78c7('0x33')](handleEntityNotFound(_0x253190,null))[_0x78c7('0x33')](respondWithResult(_0x253190,null))[_0x78c7('0x26')](handleError(_0x253190,null));};exports[_0x78c7('0x51')]=function(_0x428e48,_0x5dbd7e){if(_0x428e48[_0x78c7('0x52')]['id']){delete _0x428e48['body']['id'];}return db[_0x78c7('0x3a')][_0x78c7('0x53')]({'where':{'id':_0x428e48[_0x78c7('0x54')]['id']}})[_0x78c7('0x33')](handleEntityNotFound(_0x5dbd7e,null))[_0x78c7('0x33')](saveUpdates(_0x428e48['body'],null))[_0x78c7('0x33')](respondWithResult(_0x5dbd7e,null))['catch'](handleError(_0x5dbd7e,null));};exports['addLogo']=function(_0x4ec35f,_0x4ad779,_0x24067c){if(_0x4ec35f[_0x78c7('0x55')]&&_0x4ec35f[_0x78c7('0x55')]['filename']){_0x4ec35f[_0x78c7('0x52')][_0x78c7('0x56')]=_0x4ec35f[_0x78c7('0x55')][_0x78c7('0x57')];}return db[_0x78c7('0x3a')][_0x78c7('0x53')]({'where':{'id':_0x4ec35f['params']['id']}})[_0x78c7('0x33')](handleEntityNotFound(_0x4ad779,null))[_0x78c7('0x33')](saveUpdates(_0x4ec35f[_0x78c7('0x52')],null))[_0x78c7('0x33')](respondWithResult(_0x4ad779,null))[_0x78c7('0x26')](handleError(_0x4ad779,null));};exports[_0x78c7('0x58')]=function(_0x53acee,_0x4536c9,_0x457bee){if(_0x53acee[_0x78c7('0x55')]&&_0x53acee['file'][_0x78c7('0x57')]){_0x53acee[_0x78c7('0x52')][_0x78c7('0x59')]=_0x53acee[_0x78c7('0x55')][_0x78c7('0x57')];}return db[_0x78c7('0x3a')]['find']({'where':{'id':_0x53acee[_0x78c7('0x54')]['id']}})[_0x78c7('0x33')](handleEntityNotFound(_0x4536c9,null))[_0x78c7('0x33')](saveUpdates(_0x53acee[_0x78c7('0x52')],null))[_0x78c7('0x33')](respondWithResult(_0x4536c9,null))[_0x78c7('0x26')](handleError(_0x4536c9,null));};var utilLicense=require('../../config/license/util');exports[_0x78c7('0x5a')]=function(_0x4d0dd9,_0x25b0a0,_0x12a7c3){var _0x9eff1b=_0x78c7('0x5b');var _0x4571f1={'custom':![]};return utilLicense['getLicense']()[_0x78c7('0x33')](function(_0x4f9c90){if(_0x4f9c90){_0x4571f1=_0x4f9c90;}return db[_0x78c7('0x3a')][_0x78c7('0x53')]({'where':{'id':_0x4d0dd9['params']['id']},'attributes':['logo',_0x78c7('0x59'),'preferred',_0x78c7('0x5c'),'defaultLogo',_0x78c7('0x5d'),_0x78c7('0x5e'),_0x78c7('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x25b0a0,null))['then'](function(_0x730df0){if(_0x730df0){var _0x270142=_0x730df0[_0x78c7('0x56')]&&fs[_0x78c7('0x60')](path[_0x78c7('0x61')](config['root'],_0x9eff1b,_[_0x78c7('0x62')](_0x730df0['logo'])))?path[_0x78c7('0x61')](config[_0x78c7('0x63')],_0x9eff1b,_[_0x78c7('0x62')](_0x730df0[_0x78c7('0x56')])):path[_0x78c7('0x61')](config[_0x78c7('0x63')],_0x9eff1b,_[_0x78c7('0x62')]('default_logo.svg'));var _0x15b7f4=_0x78c7('0x64')+_[_0x78c7('0x65')](_0x78c7('0x56'));if(_0x730df0[_0x15b7f4]||!_0x4571f1[_0x78c7('0x66')]){_0x270142=path[_0x78c7('0x61')](config['root'],_0x9eff1b,_[_0x78c7('0x62')]('default_logo.svg'));}if(!fs[_0x78c7('0x60')](_0x270142)){throw new db[(_0x78c7('0x67'))][(_0x78c7('0x68'))](_[_0x78c7('0x65')]('logo')+'\x20not\x20found');}return _0x25b0a0[_0x78c7('0x69')](_0x270142);}})[_0x78c7('0x26')](handleError(_0x25b0a0,null));};var utilLicense=require('../../config/license/util');exports[_0x78c7('0x6a')]=function(_0x2eafb2,_0x32fe1c,_0x107935){var _0x1a134f='server/files/images/logos';var _0x538ebf={'custom':![]};return utilLicense[_0x78c7('0x6b')]()[_0x78c7('0x33')](function(_0x5756e8){if(_0x5756e8){_0x538ebf=_0x5756e8;}return db[_0x78c7('0x3a')][_0x78c7('0x53')]({'where':{'id':_0x2eafb2[_0x78c7('0x54')]['id']},'attributes':[_0x78c7('0x56'),_0x78c7('0x59'),'preferred','favicon',_0x78c7('0x6c'),_0x78c7('0x5d'),_0x78c7('0x5e'),_0x78c7('0x5f')],'raw':!![]});})[_0x78c7('0x33')](handleEntityNotFound(_0x32fe1c,null))[_0x78c7('0x33')](function(_0x354434){if(_0x354434){var _0x441443=_0x354434['loginLogo']&&fs[_0x78c7('0x60')](path[_0x78c7('0x61')](config[_0x78c7('0x63')],_0x1a134f,_[_0x78c7('0x62')](_0x354434['loginLogo'])))?path['join'](config['root'],_0x1a134f,_['toLower'](_0x354434[_0x78c7('0x59')])):path[_0x78c7('0x61')](config['root'],_0x1a134f,_['toLower'](_0x78c7('0x6d')));var _0x579a3a=_0x78c7('0x64')+_['upperFirst']('loginLogo');if(_0x354434[_0x579a3a]||!_0x538ebf[_0x78c7('0x66')]){_0x441443=path[_0x78c7('0x61')](config[_0x78c7('0x63')],_0x1a134f,_['toLower'](_0x78c7('0x6d')));}if(!fs['existsSync'](_0x441443)){throw new db[(_0x78c7('0x67'))][(_0x78c7('0x68'))](_[_0x78c7('0x65')](_0x78c7('0x59'))+_0x78c7('0x6e'));}return _0x32fe1c[_0x78c7('0x69')](_0x441443);}})[_0x78c7('0x26')](handleError(_0x32fe1c,null));};exports[_0x78c7('0x6f')]=function(_0x5a742b,_0x1fadb2){return db[_0x78c7('0x3a')][_0x78c7('0x53')]({'where':{'id':_0x5a742b[_0x78c7('0x54')]['id']},'attributes':[_0x78c7('0x70')]})[_0x78c7('0x33')](respondWithResult(_0x1fadb2,null))[_0x78c7('0x26')](handleError(_0x1fadb2,null));};exports[_0x78c7('0x71')]=function(_0x23925e,_0x3be1f8,_0x4f6618){if(_0x23925e[_0x78c7('0x55')]&&_0x23925e['file'][_0x78c7('0x57')]){_0x23925e['body']['preferred']=_0x23925e[_0x78c7('0x55')][_0x78c7('0x57')];}return db[_0x78c7('0x3a')]['find']({'where':{'id':_0x23925e[_0x78c7('0x54')]['id']}})[_0x78c7('0x33')](handleEntityNotFound(_0x3be1f8,null))['then'](saveUpdates(_0x23925e['body'],null))['then'](respondWithResult(_0x3be1f8,null))['catch'](handleError(_0x3be1f8,null));};var utilLicense=require(_0x78c7('0x19'));exports['getPreferred']=function(_0x508f71,_0x10e8e1,_0x227ceb){var _0x295a82=_0x78c7('0x5b');var _0x35493a={'custom':![]};return utilLicense[_0x78c7('0x6b')]()[_0x78c7('0x33')](function(_0x2cd76e){if(_0x2cd76e){_0x35493a=_0x2cd76e;}return db[_0x78c7('0x3a')][_0x78c7('0x53')]({'where':{'id':_0x508f71[_0x78c7('0x54')]['id']},'attributes':['logo',_0x78c7('0x59'),_0x78c7('0x72'),_0x78c7('0x5c'),_0x78c7('0x6c'),_0x78c7('0x5d'),'defaultPreferred',_0x78c7('0x5f')],'raw':!![]});})[_0x78c7('0x33')](handleEntityNotFound(_0x10e8e1,null))[_0x78c7('0x33')](function(_0x15b31d){if(_0x15b31d){var _0x458bee=_0x15b31d['preferred']&&fs[_0x78c7('0x60')](path[_0x78c7('0x61')](config['root'],_0x295a82,_[_0x78c7('0x62')](_0x15b31d[_0x78c7('0x72')])))?path['join'](config[_0x78c7('0x63')],_0x295a82,_[_0x78c7('0x62')](_0x15b31d[_0x78c7('0x72')])):path['join'](config['root'],_0x295a82,_[_0x78c7('0x62')](_0x78c7('0x73')));var _0xe15daa=_0x78c7('0x64')+_[_0x78c7('0x65')](_0x78c7('0x72'));if(_0x15b31d[_0xe15daa]||!_0x35493a[_0x78c7('0x66')]||!_0x35493a[_0x78c7('0x72')]){_0x458bee=path[_0x78c7('0x61')](config[_0x78c7('0x63')],_0x295a82,_['toLower'](_0x78c7('0x73')));}if(!fs['existsSync'](_0x458bee)){throw new db[(_0x78c7('0x67'))][(_0x78c7('0x68'))](_[_0x78c7('0x65')](_0x78c7('0x72'))+'\x20not\x20found');}return _0x10e8e1[_0x78c7('0x69')](_0x458bee);}})[_0x78c7('0x26')](handleError(_0x10e8e1,null));};exports[_0x78c7('0x74')]=function(_0x2af4c9,_0x244ce5,_0x1f9383){if(_0x2af4c9[_0x78c7('0x55')]&&_0x2af4c9['file'][_0x78c7('0x57')]){_0x2af4c9[_0x78c7('0x52')][_0x78c7('0x5c')]=_0x2af4c9[_0x78c7('0x55')][_0x78c7('0x57')];}return db['Setting'][_0x78c7('0x53')]({'where':{'id':_0x2af4c9[_0x78c7('0x54')]['id']}})[_0x78c7('0x33')](handleEntityNotFound(_0x244ce5,null))[_0x78c7('0x33')](saveUpdates(_0x2af4c9[_0x78c7('0x52')],null))[_0x78c7('0x33')](respondWithResult(_0x244ce5,null))['catch'](handleError(_0x244ce5,null));};var utilLicense=require(_0x78c7('0x19'));exports['getFavicon']=function(_0xada3b1,_0x265206,_0x27d3ce){var _0x492ad5=_0x78c7('0x5b');var _0x68d0f8={'custom':![]};return utilLicense[_0x78c7('0x6b')]()[_0x78c7('0x33')](function(_0x24c2ad){if(_0x24c2ad){_0x68d0f8=_0x24c2ad;}return db[_0x78c7('0x3a')][_0x78c7('0x53')]({'where':{'id':_0xada3b1[_0x78c7('0x54')]['id']},'attributes':[_0x78c7('0x56'),_0x78c7('0x59'),_0x78c7('0x72'),_0x78c7('0x5c'),_0x78c7('0x6c'),_0x78c7('0x5d'),_0x78c7('0x5e'),_0x78c7('0x5f')],'raw':!![]});})[_0x78c7('0x33')](handleEntityNotFound(_0x265206,null))[_0x78c7('0x33')](function(_0x54ce2e){if(_0x54ce2e){var _0x12eed0=_0x54ce2e[_0x78c7('0x5c')]&&fs[_0x78c7('0x60')](path[_0x78c7('0x61')](config[_0x78c7('0x63')],_0x492ad5,_[_0x78c7('0x62')](_0x54ce2e[_0x78c7('0x5c')])))?path[_0x78c7('0x61')](config['root'],_0x492ad5,_[_0x78c7('0x62')](_0x54ce2e[_0x78c7('0x5c')])):path[_0x78c7('0x61')](config[_0x78c7('0x63')],_0x492ad5,_[_0x78c7('0x62')](_0x78c7('0x75')));var _0x30a608=_0x78c7('0x64')+_[_0x78c7('0x65')](_0x78c7('0x5c'));if(_0x54ce2e[_0x30a608]||!_0x68d0f8[_0x78c7('0x66')]){_0x12eed0=path['join'](config[_0x78c7('0x63')],_0x492ad5,_[_0x78c7('0x62')](_0x78c7('0x75')));}if(!fs[_0x78c7('0x60')](_0x12eed0)){throw new db[(_0x78c7('0x67'))][(_0x78c7('0x68'))](_[_0x78c7('0x65')](_0x78c7('0x5c'))+_0x78c7('0x6e'));}return _0x265206[_0x78c7('0x69')](_0x12eed0);}})[_0x78c7('0x26')](handleError(_0x265206,null));};exports[_0x78c7('0x76')]=function(_0x538fd7,_0x48ca49){var _0x515d1a={'offset':moment()[_0x78c7('0x77')]()};_0x515d1a[_0x78c7('0x78')]=moment()[_0x78c7('0x77')](_0x515d1a[_0x78c7('0x28')])[_0x78c7('0x79')](_0x78c7('0x7a'));return _0x48ca49[_0x78c7('0x2c')](0xc8)['send'](_0x515d1a);}; \ No newline at end of file +var _0xb871=['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','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','stack','name','index','map','Setting','fieldName','type','key','keys','query','filters','model','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','show','params','fields','find','body','file','filename','logo','getLogo','server/files/images/logos','getLicense','preferred','defaultFavicon','join','toLower','root','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','getLogoLogin','favicon','defaultLogo','defaultPreferred','loginLogo','existsSync','default_loginLogo.svg','default','\x20not\x20found','download','gdpr','securePassword','addPreferred','defaultLoginLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x4d9bb2,_0x3db50d){var _0x3179fe=function(_0x5272f3){while(--_0x5272f3){_0x4d9bb2['push'](_0x4d9bb2['shift']());}};_0x3179fe(++_0x3db50d);}(_0xb871,0x6b));var _0x1b87=function(_0xac53d2,_0x121075){_0xac53d2=_0xac53d2-0x0;var _0x2e5759=_0xb871[_0xac53d2];return _0x2e5759;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b87('0x0'));var zipdir=require(_0x1b87('0x1'));var jsonpatch=require(_0x1b87('0x2'));var rp=require(_0x1b87('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b87('0x4'));var util=require(_0x1b87('0x5'));var path=require(_0x1b87('0x6'));var sox=require(_0x1b87('0x7'));var csv=require(_0x1b87('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b87('0x9'));var squel=require(_0x1b87('0xa'));var crypto=require(_0x1b87('0xb'));var jsforce=require(_0x1b87('0xc'));var deskjs=require(_0x1b87('0xd'));var toCsv=require(_0x1b87('0x8'));var querystring=require(_0x1b87('0xe'));var Papa=require(_0x1b87('0xf'));var Redis=require(_0x1b87('0x10'));var authService=require(_0x1b87('0x11'));var qs=require(_0x1b87('0x12'));var as=require(_0x1b87('0x13'));var hardwareService=require(_0x1b87('0x14'));var logger=require(_0x1b87('0x15'))(_0x1b87('0x16'));var utils=require(_0x1b87('0x17'));var config=require(_0x1b87('0x18'));var licenseUtil=require(_0x1b87('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1b87('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38c1b7,_0x1398e3,_0x3b0e74,_0x519833){return new BPromise(function(_0x27a538,_0x5eb657){var _0x33b428=_0x519833||client;return _0x33b428[_0x1b87('0x1b')](_0x38c1b7,_0x3b0e74)[_0x1b87('0x1c')](function(_0xd0d763){logger[_0x1b87('0x1d')](_0x1b87('0x1e'),_0x1398e3,_0x1b87('0x1f'));logger['debug'](_0x1b87('0x20'),_0x1398e3,'request\x20sent',JSON['stringify'](_0xd0d763));if(_0xd0d763[_0x1b87('0x21')]){if(_0xd0d763['error']['code']===0x1f4){logger[_0x1b87('0x21')]('Setting,\x20%s,\x20%s',_0x1398e3,_0xd0d763['error'][_0x1b87('0x22')]);return _0x5eb657(_0xd0d763[_0x1b87('0x21')][_0x1b87('0x22')]);}logger[_0x1b87('0x21')](_0x1b87('0x1e'),_0x1398e3,_0xd0d763[_0x1b87('0x21')][_0x1b87('0x22')]);return _0x27a538(_0xd0d763[_0x1b87('0x21')][_0x1b87('0x22')]);}else{logger[_0x1b87('0x1d')](_0x1b87('0x1e'),_0x1398e3,_0x1b87('0x1f'));_0x27a538(_0xd0d763[_0x1b87('0x23')][_0x1b87('0x22')]);}})[_0x1b87('0x24')](function(_0x52cefe){logger['error'](_0x1b87('0x1e'),_0x1398e3,_0x52cefe);_0x5eb657(_0x52cefe);});});}function respondWithStatusCode(_0x38c341,_0x400405){_0x400405=_0x400405||0xcc;return function(_0xb5959d){if(_0xb5959d){return _0x38c341[_0x1b87('0x25')](_0x400405);}return _0x38c341[_0x1b87('0x26')](_0x400405)[_0x1b87('0x27')]();};}function respondWithResult(_0x35cbbc,_0x4c732e){_0x4c732e=_0x4c732e||0xc8;return function(_0x23714f){if(_0x23714f){return _0x35cbbc[_0x1b87('0x26')](_0x4c732e)[_0x1b87('0x28')](_0x23714f);}};}function respondWithFilteredResult(_0x11388b,_0x4da1fd){return function(_0x145420){if(_0x145420){var _0x2d4317=typeof _0x4da1fd[_0x1b87('0x29')]==='undefined'&&typeof _0x4da1fd[_0x1b87('0x2a')]===_0x1b87('0x2b');var _0x28bb96=_0x145420[_0x1b87('0x2c')];var _0x395f79=_0x2d4317?0x0:_0x4da1fd[_0x1b87('0x29')];var _0x51cc00=_0x2d4317?_0x145420[_0x1b87('0x2c')]:_0x4da1fd[_0x1b87('0x29')]+_0x4da1fd['limit'];var _0x2cb299;if(_0x51cc00>=_0x28bb96){_0x51cc00=_0x28bb96;_0x2cb299=0xc8;}else{_0x2cb299=0xce;}_0x11388b[_0x1b87('0x26')](_0x2cb299);return _0x11388b[_0x1b87('0x2d')](_0x1b87('0x2e'),_0x395f79+'-'+_0x51cc00+'/'+_0x28bb96)[_0x1b87('0x28')](_0x145420);}return null;};}function patchUpdates(_0x2fb7b3){return function(_0x329b72){try{jsonpatch[_0x1b87('0x2f')](_0x329b72,_0x2fb7b3,!![]);}catch(_0x58e843){return BPromise[_0x1b87('0x30')](_0x58e843);}return _0x329b72['save']();};}function saveUpdates(_0x2fd156,_0x5880e5){return function(_0x102fb9){if(_0x102fb9){return _0x102fb9[_0x1b87('0x31')](_0x2fd156)['then'](function(_0x493465){return _0x493465;});}return null;};}function removeEntity(_0x21bf8e,_0x72fca6){return function(_0x37877e){if(_0x37877e){return _0x37877e['destroy']()['then'](function(){_0x21bf8e[_0x1b87('0x26')](0xcc)[_0x1b87('0x27')]();});}};}function handleEntityNotFound(_0x4eae9f,_0x4ee2fb){return function(_0x1efa6d){if(!_0x1efa6d){_0x4eae9f['sendStatus'](0x194);}return _0x1efa6d;};}function handleError(_0x1a2cb6,_0x253a2f){_0x253a2f=_0x253a2f||0x1f4;return function(_0x53a901){logger[_0x1b87('0x21')](_0x53a901[_0x1b87('0x32')]);if(_0x53a901['name']){delete _0x53a901[_0x1b87('0x33')];}_0x1a2cb6['status'](_0x253a2f)['send'](_0x53a901);};}exports[_0x1b87('0x34')]=function(_0x5afadd,_0x15257c){var _0x7e72a7={},_0x16bfd6={},_0x4f3aae={'count':0x0,'rows':[]};var _0x120f40=_[_0x1b87('0x35')](db[_0x1b87('0x36')]['rawAttributes'],function(_0x37ea04){return{'name':_0x37ea04[_0x1b87('0x37')],'type':_0x37ea04[_0x1b87('0x38')][_0x1b87('0x39')]};});_0x16bfd6['model']=_[_0x1b87('0x35')](_0x120f40,_0x1b87('0x33'));_0x16bfd6['query']=_[_0x1b87('0x3a')](_0x5afadd[_0x1b87('0x3b')]);_0x16bfd6[_0x1b87('0x3c')]=_['intersection'](_0x16bfd6[_0x1b87('0x3d')],_0x16bfd6[_0x1b87('0x3b')]);_0x7e72a7['attributes']=_[_0x1b87('0x3e')](_0x16bfd6[_0x1b87('0x3d')],qs['fields'](_0x5afadd[_0x1b87('0x3b')]['fields']));_0x7e72a7[_0x1b87('0x3f')]=_0x7e72a7[_0x1b87('0x3f')][_0x1b87('0x40')]?_0x7e72a7['attributes']:_0x16bfd6[_0x1b87('0x3d')];if(!_0x5afadd['query']['hasOwnProperty']('nolimit')){_0x7e72a7['limit']=qs['limit'](_0x5afadd[_0x1b87('0x3b')][_0x1b87('0x2a')]);_0x7e72a7['offset']=qs[_0x1b87('0x29')](_0x5afadd['query'][_0x1b87('0x29')]);}_0x7e72a7[_0x1b87('0x41')]=qs['sort'](_0x5afadd[_0x1b87('0x3b')][_0x1b87('0x42')]);_0x7e72a7[_0x1b87('0x43')]=qs[_0x1b87('0x3c')](_[_0x1b87('0x44')](_0x5afadd[_0x1b87('0x3b')],_0x16bfd6[_0x1b87('0x3c')]),_0x120f40);if(_0x5afadd[_0x1b87('0x3b')][_0x1b87('0x45')]){_0x7e72a7['where']=_[_0x1b87('0x46')](_0x7e72a7['where'],{'$or':_[_0x1b87('0x35')](_0x120f40,function(_0x3b68d8){if(_0x3b68d8['type']!==_0x1b87('0x47')){var _0x1d3a22={};_0x1d3a22[_0x3b68d8[_0x1b87('0x33')]]={'$like':'%'+_0x5afadd[_0x1b87('0x3b')][_0x1b87('0x45')]+'%'};return _0x1d3a22;}})});}_0x7e72a7=_[_0x1b87('0x46')]({},_0x7e72a7,_0x5afadd[_0x1b87('0x48')]);var _0x1700c9={'where':_0x7e72a7[_0x1b87('0x43')]};return db['Setting'][_0x1b87('0x2c')](_0x1700c9)['then'](function(_0x45a781){_0x4f3aae['count']=_0x45a781;if(_0x5afadd[_0x1b87('0x3b')]['includeAll']){_0x7e72a7['include']=[{'all':!![]}];}return db[_0x1b87('0x36')]['findAll'](_0x7e72a7);})[_0x1b87('0x1c')](function(_0x239c1a){_0x4f3aae[_0x1b87('0x49')]=_0x239c1a;return _0x4f3aae;})[_0x1b87('0x1c')](respondWithFilteredResult(_0x15257c,_0x7e72a7))[_0x1b87('0x24')](handleError(_0x15257c,null));};exports[_0x1b87('0x4a')]=function(_0xaa730d,_0x1da5f7){var _0x420c67={'raw':![],'where':{'id':_0xaa730d[_0x1b87('0x4b')]['id']}},_0x436624={};_0x436624[_0x1b87('0x3d')]=_['keys'](db['Setting']['rawAttributes']);_0x436624[_0x1b87('0x3b')]=_[_0x1b87('0x3a')](_0xaa730d['query']);_0x436624[_0x1b87('0x3c')]=_[_0x1b87('0x3e')](_0x436624[_0x1b87('0x3d')],_0x436624[_0x1b87('0x3b')]);_0x420c67[_0x1b87('0x3f')]=_['intersection'](_0x436624[_0x1b87('0x3d')],qs[_0x1b87('0x4c')](_0xaa730d['query'][_0x1b87('0x4c')]));_0x420c67[_0x1b87('0x3f')]=_0x420c67[_0x1b87('0x3f')][_0x1b87('0x40')]?_0x420c67[_0x1b87('0x3f')]:_0x436624[_0x1b87('0x3d')];if(_0xaa730d[_0x1b87('0x3b')]['includeAll']){_0x420c67['include']=[{'all':!![]}];}_0x420c67=_[_0x1b87('0x46')]({},_0x420c67,_0xaa730d[_0x1b87('0x48')]);return db[_0x1b87('0x36')][_0x1b87('0x4d')](_0x420c67)[_0x1b87('0x1c')](handleEntityNotFound(_0x1da5f7,null))[_0x1b87('0x1c')](respondWithResult(_0x1da5f7,null))['catch'](handleError(_0x1da5f7,null));};exports[_0x1b87('0x31')]=function(_0x44f7f0,_0x2d8d8c){if(_0x44f7f0['body']['id']){delete _0x44f7f0[_0x1b87('0x4e')]['id'];}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0x44f7f0[_0x1b87('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2d8d8c,null))[_0x1b87('0x1c')](saveUpdates(_0x44f7f0['body'],null))[_0x1b87('0x1c')](respondWithResult(_0x2d8d8c,null))[_0x1b87('0x24')](handleError(_0x2d8d8c,null));};exports['addLogo']=function(_0x11908e,_0x16cabc,_0x59f313){if(_0x11908e[_0x1b87('0x4f')]&&_0x11908e[_0x1b87('0x4f')][_0x1b87('0x50')]){_0x11908e[_0x1b87('0x4e')][_0x1b87('0x51')]=_0x11908e[_0x1b87('0x4f')][_0x1b87('0x50')];}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0x11908e[_0x1b87('0x4b')]['id']}})[_0x1b87('0x1c')](handleEntityNotFound(_0x16cabc,null))['then'](saveUpdates(_0x11908e['body'],null))[_0x1b87('0x1c')](respondWithResult(_0x16cabc,null))[_0x1b87('0x24')](handleError(_0x16cabc,null));};exports['addLogoLogin']=function(_0xc1e163,_0x9ed4ce,_0x2d2cc9){if(_0xc1e163[_0x1b87('0x4f')]&&_0xc1e163[_0x1b87('0x4f')]['filename']){_0xc1e163[_0x1b87('0x4e')]['loginLogo']=_0xc1e163[_0x1b87('0x4f')][_0x1b87('0x50')];}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0xc1e163['params']['id']}})['then'](handleEntityNotFound(_0x9ed4ce,null))[_0x1b87('0x1c')](saveUpdates(_0xc1e163['body'],null))['then'](respondWithResult(_0x9ed4ce,null))[_0x1b87('0x24')](handleError(_0x9ed4ce,null));};var utilLicense=require(_0x1b87('0x19'));exports[_0x1b87('0x52')]=function(_0x1bf22a,_0x2a6c72,_0x442f52){var _0x68033e=_0x1b87('0x53');var _0x3e7901={'custom':![]};return utilLicense[_0x1b87('0x54')]()[_0x1b87('0x1c')](function(_0x218d90){if(_0x218d90){_0x3e7901=_0x218d90;}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0x1bf22a[_0x1b87('0x4b')]['id']},'attributes':[_0x1b87('0x51'),'loginLogo',_0x1b87('0x55'),'favicon','defaultLogo','defaultLoginLogo','defaultPreferred',_0x1b87('0x56')],'raw':!![]});})['then'](handleEntityNotFound(_0x2a6c72,null))[_0x1b87('0x1c')](function(_0x414721){if(_0x414721){var _0xcb4350=_0x414721['logo']&&fs['existsSync'](path[_0x1b87('0x57')](config['root'],_0x68033e,_[_0x1b87('0x58')](_0x414721[_0x1b87('0x51')])))?path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x68033e,_[_0x1b87('0x58')](_0x414721[_0x1b87('0x51')])):path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x68033e,_['toLower'](_0x1b87('0x5a')));var _0x45450d='default'+_[_0x1b87('0x5b')]('logo');if(_0x414721[_0x45450d]||!_0x3e7901[_0x1b87('0x5c')]){_0xcb4350=path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x68033e,_[_0x1b87('0x58')](_0x1b87('0x5a')));}if(!fs['existsSync'](_0xcb4350)){throw new db[(_0x1b87('0x5d'))][(_0x1b87('0x5e'))](_['upperFirst'](_0x1b87('0x51'))+'\x20not\x20found');}return _0x2a6c72['download'](_0xcb4350);}})['catch'](handleError(_0x2a6c72,null));};var utilLicense=require('../../config/license/util');exports[_0x1b87('0x5f')]=function(_0x55530c,_0x5a4090,_0x57b56a){var _0x46973d=_0x1b87('0x53');var _0x477d77={'custom':![]};return utilLicense['getLicense']()[_0x1b87('0x1c')](function(_0x5d7cd0){if(_0x5d7cd0){_0x477d77=_0x5d7cd0;}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0x55530c['params']['id']},'attributes':[_0x1b87('0x51'),'loginLogo',_0x1b87('0x55'),_0x1b87('0x60'),_0x1b87('0x61'),'defaultLoginLogo',_0x1b87('0x62'),_0x1b87('0x56')],'raw':!![]});})[_0x1b87('0x1c')](handleEntityNotFound(_0x5a4090,null))[_0x1b87('0x1c')](function(_0x549ecb){if(_0x549ecb){var _0x2b6a7b=_0x549ecb[_0x1b87('0x63')]&&fs[_0x1b87('0x64')](path[_0x1b87('0x57')](config['root'],_0x46973d,_[_0x1b87('0x58')](_0x549ecb[_0x1b87('0x63')])))?path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x46973d,_['toLower'](_0x549ecb[_0x1b87('0x63')])):path['join'](config[_0x1b87('0x59')],_0x46973d,_[_0x1b87('0x58')](_0x1b87('0x65')));var _0x3cb430=_0x1b87('0x66')+_[_0x1b87('0x5b')](_0x1b87('0x63'));if(_0x549ecb[_0x3cb430]||!_0x477d77['custom']){_0x2b6a7b=path[_0x1b87('0x57')](config['root'],_0x46973d,_[_0x1b87('0x58')](_0x1b87('0x65')));}if(!fs['existsSync'](_0x2b6a7b)){throw new db[(_0x1b87('0x5d'))][(_0x1b87('0x5e'))](_[_0x1b87('0x5b')](_0x1b87('0x63'))+_0x1b87('0x67'));}return _0x5a4090[_0x1b87('0x68')](_0x2b6a7b);}})[_0x1b87('0x24')](handleError(_0x5a4090,null));};exports[_0x1b87('0x69')]=function(_0x5e65c0,_0x3ac406){return db['Setting']['find']({'where':{'id':_0x5e65c0[_0x1b87('0x4b')]['id']},'attributes':[_0x1b87('0x6a')]})['then'](respondWithResult(_0x3ac406,null))[_0x1b87('0x24')](handleError(_0x3ac406,null));};exports[_0x1b87('0x6b')]=function(_0xeaa293,_0x85e949,_0xa8335f){if(_0xeaa293[_0x1b87('0x4f')]&&_0xeaa293[_0x1b87('0x4f')]['filename']){_0xeaa293['body'][_0x1b87('0x55')]=_0xeaa293[_0x1b87('0x4f')][_0x1b87('0x50')];}return db['Setting'][_0x1b87('0x4d')]({'where':{'id':_0xeaa293[_0x1b87('0x4b')]['id']}})['then'](handleEntityNotFound(_0x85e949,null))[_0x1b87('0x1c')](saveUpdates(_0xeaa293[_0x1b87('0x4e')],null))[_0x1b87('0x1c')](respondWithResult(_0x85e949,null))['catch'](handleError(_0x85e949,null));};var utilLicense=require(_0x1b87('0x19'));exports['getPreferred']=function(_0x48bc01,_0x10264f,_0x2d1888){var _0x2d827a=_0x1b87('0x53');var _0x332752={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x309f83){if(_0x309f83){_0x332752=_0x309f83;}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0x48bc01['params']['id']},'attributes':[_0x1b87('0x51'),_0x1b87('0x63'),'preferred',_0x1b87('0x60'),'defaultLogo',_0x1b87('0x6c'),_0x1b87('0x62'),_0x1b87('0x56')],'raw':!![]});})[_0x1b87('0x1c')](handleEntityNotFound(_0x10264f,null))['then'](function(_0x332966){if(_0x332966){var _0x290580=_0x332966[_0x1b87('0x55')]&&fs[_0x1b87('0x64')](path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x2d827a,_['toLower'](_0x332966['preferred'])))?path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x2d827a,_[_0x1b87('0x58')](_0x332966[_0x1b87('0x55')])):path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x2d827a,_[_0x1b87('0x58')](_0x1b87('0x6d')));var _0x2c2019=_0x1b87('0x66')+_[_0x1b87('0x5b')](_0x1b87('0x55'));if(_0x332966[_0x2c2019]||!_0x332752[_0x1b87('0x5c')]||!_0x332752['preferred']){_0x290580=path['join'](config[_0x1b87('0x59')],_0x2d827a,_[_0x1b87('0x58')](_0x1b87('0x6d')));}if(!fs['existsSync'](_0x290580)){throw new db[(_0x1b87('0x5d'))][(_0x1b87('0x5e'))](_[_0x1b87('0x5b')](_0x1b87('0x55'))+_0x1b87('0x67'));}return _0x10264f[_0x1b87('0x68')](_0x290580);}})['catch'](handleError(_0x10264f,null));};exports[_0x1b87('0x6e')]=function(_0x18725a,_0x4a1828,_0x22519b){if(_0x18725a[_0x1b87('0x4f')]&&_0x18725a[_0x1b87('0x4f')][_0x1b87('0x50')]){_0x18725a[_0x1b87('0x4e')]['favicon']=_0x18725a[_0x1b87('0x4f')][_0x1b87('0x50')];}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0x18725a[_0x1b87('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a1828,null))[_0x1b87('0x1c')](saveUpdates(_0x18725a[_0x1b87('0x4e')],null))[_0x1b87('0x1c')](respondWithResult(_0x4a1828,null))[_0x1b87('0x24')](handleError(_0x4a1828,null));};var utilLicense=require(_0x1b87('0x19'));exports[_0x1b87('0x6f')]=function(_0x44b84a,_0x22ef4e,_0x4e13f4){var _0x2c823f='server/files/images/logos';var _0x17aeb0={'custom':![]};return utilLicense[_0x1b87('0x54')]()[_0x1b87('0x1c')](function(_0x27028a){if(_0x27028a){_0x17aeb0=_0x27028a;}return db[_0x1b87('0x36')][_0x1b87('0x4d')]({'where':{'id':_0x44b84a[_0x1b87('0x4b')]['id']},'attributes':['logo',_0x1b87('0x63'),_0x1b87('0x55'),'favicon','defaultLogo',_0x1b87('0x6c'),_0x1b87('0x62'),_0x1b87('0x56')],'raw':!![]});})[_0x1b87('0x1c')](handleEntityNotFound(_0x22ef4e,null))[_0x1b87('0x1c')](function(_0x1577e6){if(_0x1577e6){var _0x53422d=_0x1577e6[_0x1b87('0x60')]&&fs['existsSync'](path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x2c823f,_[_0x1b87('0x58')](_0x1577e6[_0x1b87('0x60')])))?path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x2c823f,_[_0x1b87('0x58')](_0x1577e6[_0x1b87('0x60')])):path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x2c823f,_[_0x1b87('0x58')](_0x1b87('0x70')));var _0x4a97cd='default'+_[_0x1b87('0x5b')](_0x1b87('0x60'));if(_0x1577e6[_0x4a97cd]||!_0x17aeb0['custom']){_0x53422d=path[_0x1b87('0x57')](config[_0x1b87('0x59')],_0x2c823f,_['toLower'](_0x1b87('0x70')));}if(!fs[_0x1b87('0x64')](_0x53422d)){throw new db[(_0x1b87('0x5d'))][(_0x1b87('0x5e'))](_[_0x1b87('0x5b')]('favicon')+_0x1b87('0x67'));}return _0x22ef4e[_0x1b87('0x68')](_0x53422d);}})[_0x1b87('0x24')](handleError(_0x22ef4e,null));};exports[_0x1b87('0x71')]=function(_0x124aa7,_0xf141ca){var _0x55652f={'offset':moment()['utcOffset']()};_0x55652f[_0x1b87('0x72')]=moment()[_0x1b87('0x73')](_0x55652f[_0x1b87('0x29')])[_0x1b87('0x74')](_0x1b87('0x75'));return _0xf141ca[_0x1b87('0x26')](0xc8)['send'](_0x55652f);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index ce693e1..5b5d94a 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 _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x1c0230,_0x150414){var _0x2cbafb=function(_0xddb317){while(--_0xddb317){_0x1c0230['push'](_0x1c0230['shift']());}};_0x2cbafb(++_0x150414);}(_0xe14b,0x93));var _0xbe14=function(_0x5b3c44,_0xd8335a){_0x5b3c44=_0x5b3c44-0x0;var _0x2d7211=_0xe14b[_0x5b3c44];return _0x2d7211;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2a238a,_0x1d5054){var _0xeef802=function(_0x583637){while(--_0x583637){_0x2a238a['push'](_0x2a238a['shift']());}};_0xeef802(++_0x1d5054);}(_0x55ca,0x126));var _0xa55c=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0x55ca[_0x5f0501];return _0x3c2c45;};'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')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'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 d1a19d0..c8579e1 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 _0xb601=['error','code','message','result','catch','Setting','find','options','where','attributes','map','include','model','then','ShowSetting','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x34abbc,_0x1105be){var _0x7cdd55=function(_0x2b0b81){while(--_0x2b0b81){_0x34abbc['push'](_0x34abbc['shift']());}};_0x7cdd55(++_0x1105be);}(_0xb601,0x1d0));var _0x1b60=function(_0x52fd3d,_0x3af718){_0x52fd3d=_0x52fd3d-0x0;var _0x49b06d=_0xb601[_0x52fd3d];return _0x49b06d;};'use strict';var _=require(_0x1b60('0x0'));var util=require(_0x1b60('0x1'));var moment=require(_0x1b60('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b60('0x3'));var fs=require('fs');var Redis=require(_0x1b60('0x4'));var db=require(_0x1b60('0x5'))['db'];var utils=require(_0x1b60('0x6'));var logger=require(_0x1b60('0x7'))(_0x1b60('0x8'));var config=require(_0x1b60('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1b60('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57c703,_0x5b17e6,_0x28e1b6){return new BPromise(function(_0x350ea9,_0x2cf82c){return client[_0x1b60('0xb')](_0x57c703,_0x28e1b6)['then'](function(_0x2f6203){logger[_0x1b60('0xc')](_0x1b60('0xd'),_0x5b17e6,_0x1b60('0xe'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x5b17e6,'request\x20sent',JSON[_0x1b60('0xf')](_0x2f6203));if(_0x2f6203[_0x1b60('0x10')]){if(_0x2f6203[_0x1b60('0x10')][_0x1b60('0x11')]===0x1f4){logger[_0x1b60('0x10')](_0x1b60('0xd'),_0x5b17e6,_0x2f6203['error'][_0x1b60('0x12')]);return _0x2cf82c(_0x2f6203[_0x1b60('0x10')][_0x1b60('0x12')]);}logger[_0x1b60('0x10')](_0x1b60('0xd'),_0x5b17e6,_0x2f6203['error']['message']);return _0x350ea9(_0x2f6203[_0x1b60('0x10')][_0x1b60('0x12')]);}else{logger[_0x1b60('0xc')](_0x1b60('0xd'),_0x5b17e6,_0x1b60('0xe'));_0x350ea9(_0x2f6203[_0x1b60('0x13')][_0x1b60('0x12')]);}})[_0x1b60('0x14')](function(_0x58d5f1){logger[_0x1b60('0x10')](_0x1b60('0xd'),_0x5b17e6,_0x58d5f1);_0x2cf82c(_0x58d5f1);});});}exports['ShowSetting']=function(_0x385271){var _0x2e2577=this;return new Promise(function(_0x3a52fc,_0x5bd5d4){return db[_0x1b60('0x15')][_0x1b60('0x16')]({'raw':_0x385271[_0x1b60('0x17')]?_0x385271[_0x1b60('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x385271[_0x1b60('0x17')]?_0x385271[_0x1b60('0x17')][_0x1b60('0x18')]||null:null,'attributes':_0x385271[_0x1b60('0x17')]?_0x385271[_0x1b60('0x17')][_0x1b60('0x19')]||null:null,'include':_0x385271[_0x1b60('0x17')]?_0x385271[_0x1b60('0x17')]['include']?_[_0x1b60('0x1a')](_0x385271[_0x1b60('0x17')][_0x1b60('0x1b')],function(_0x2818d1){return{'model':db[_0x2818d1[_0x1b60('0x1c')]],'as':_0x2818d1['as'],'attributes':_0x2818d1['attributes'],'include':_0x2818d1['include']?_[_0x1b60('0x1a')](_0x2818d1['include'],function(_0x564276){return{'model':db[_0x564276['model']],'as':_0x564276['as'],'attributes':_0x564276[_0x1b60('0x19')],'include':_0x564276[_0x1b60('0x1b')]?_[_0x1b60('0x1a')](_0x564276['include'],function(_0x17a419){return{'model':db[_0x17a419[_0x1b60('0x1c')]],'as':_0x17a419['as'],'attributes':_0x17a419[_0x1b60('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1b60('0x1d')](function(_0x1d20c0){logger[_0x1b60('0xc')](_0x1b60('0x1e'),_0x385271);logger[_0x1b60('0x1f')](_0x1b60('0x1e'),_0x385271,JSON[_0x1b60('0xf')](_0x1d20c0));_0x3a52fc(_0x1d20c0);})['catch'](function(_0x96f8f5){logger[_0x1b60('0x10')](_0x1b60('0x1e'),_0x96f8f5[_0x1b60('0x12')],_0x385271);_0x5bd5d4(_0x2e2577[_0x1b60('0x10')](0x1f4,_0x96f8f5['message']));});});}; \ No newline at end of file +var _0x4708=['find','options','raw','where','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting','Setting'];(function(_0x1dcc3b,_0x18bae2){var _0x26c155=function(_0x125b8b){while(--_0x125b8b){_0x1dcc3b['push'](_0x1dcc3b['shift']());}};_0x26c155(++_0x18bae2);}(_0x4708,0x120));var _0x8470=function(_0x35163f,_0x33d9ee){_0x35163f=_0x35163f-0x0;var _0x44bceb=_0x4708[_0x35163f];return _0x44bceb;};'use strict';var _=require(_0x8470('0x0'));var util=require(_0x8470('0x1'));var moment=require(_0x8470('0x2'));var BPromise=require(_0x8470('0x3'));var rs=require(_0x8470('0x4'));var fs=require('fs');var Redis=require(_0x8470('0x5'));var db=require(_0x8470('0x6'))['db'];var utils=require(_0x8470('0x7'));var logger=require(_0x8470('0x8'))(_0x8470('0x9'));var config=require(_0x8470('0xa'));var jayson=require(_0x8470('0xb'));var client=jayson[_0x8470('0xc')][_0x8470('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1a5cb4,_0x56beb4,_0x3eef2d){return new BPromise(function(_0x3dfc43,_0x2c049a){return client['request'](_0x1a5cb4,_0x3eef2d)[_0x8470('0xe')](function(_0x429b55){logger[_0x8470('0xf')](_0x8470('0x10'),_0x56beb4,_0x8470('0x11'));logger[_0x8470('0x12')](_0x8470('0x13'),_0x56beb4,_0x8470('0x11'),JSON[_0x8470('0x14')](_0x429b55));if(_0x429b55['error']){if(_0x429b55[_0x8470('0x15')]['code']===0x1f4){logger[_0x8470('0x15')](_0x8470('0x10'),_0x56beb4,_0x429b55[_0x8470('0x15')][_0x8470('0x16')]);return _0x2c049a(_0x429b55[_0x8470('0x15')][_0x8470('0x16')]);}logger[_0x8470('0x15')](_0x8470('0x10'),_0x56beb4,_0x429b55[_0x8470('0x15')]['message']);return _0x3dfc43(_0x429b55[_0x8470('0x15')][_0x8470('0x16')]);}else{logger['info'](_0x8470('0x10'),_0x56beb4,_0x8470('0x11'));_0x3dfc43(_0x429b55[_0x8470('0x17')][_0x8470('0x16')]);}})[_0x8470('0x18')](function(_0xc9bf2e){logger[_0x8470('0x15')](_0x8470('0x10'),_0x56beb4,_0xc9bf2e);_0x2c049a(_0xc9bf2e);});});}exports[_0x8470('0x19')]=function(_0x48134d){var _0x1483b6=this;return new Promise(function(_0x2a5ff4,_0x6fa910){return db[_0x8470('0x1a')][_0x8470('0x1b')]({'raw':_0x48134d[_0x8470('0x1c')]?_0x48134d[_0x8470('0x1c')][_0x8470('0x1d')]===undefined?!![]:![]:!![],'where':_0x48134d[_0x8470('0x1c')]?_0x48134d['options'][_0x8470('0x1e')]||null:null,'attributes':_0x48134d[_0x8470('0x1c')]?_0x48134d[_0x8470('0x1c')]['attributes']||null:null,'include':_0x48134d['options']?_0x48134d[_0x8470('0x1c')][_0x8470('0x1f')]?_[_0x8470('0x20')](_0x48134d[_0x8470('0x1c')][_0x8470('0x1f')],function(_0x27f38e){return{'model':db[_0x27f38e[_0x8470('0x21')]],'as':_0x27f38e['as'],'attributes':_0x27f38e['attributes'],'include':_0x27f38e[_0x8470('0x1f')]?_[_0x8470('0x20')](_0x27f38e[_0x8470('0x1f')],function(_0x1dc9cb){return{'model':db[_0x1dc9cb[_0x8470('0x21')]],'as':_0x1dc9cb['as'],'attributes':_0x1dc9cb[_0x8470('0x22')],'include':_0x1dc9cb[_0x8470('0x1f')]?_[_0x8470('0x20')](_0x1dc9cb[_0x8470('0x1f')],function(_0x361a55){return{'model':db[_0x361a55[_0x8470('0x21')]],'as':_0x361a55['as'],'attributes':_0x361a55[_0x8470('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8470('0xe')](function(_0x2abbf4){logger['info']('ShowSetting',_0x48134d);logger[_0x8470('0x12')](_0x8470('0x19'),_0x48134d,JSON[_0x8470('0x14')](_0x2abbf4));_0x2a5ff4(_0x2abbf4);})[_0x8470('0x18')](function(_0x1320e3){logger[_0x8470('0x15')]('ShowSetting',_0x1320e3[_0x8470('0x16')],_0x48134d);_0x6fa910(_0x1483b6[_0x8470('0x15')](0x1f4,_0x1320e3[_0x8470('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 7b749ca..aae6050 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 _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x5880ad,_0x4da2dc){var _0x5b3222=function(_0x4d59d8){while(--_0x4d59d8){_0x5880ad['push'](_0x5880ad['shift']());}};_0x5b3222(++_0x4da2dc);}(_0x326f,0xd1));var _0xf326=function(_0x279510,_0x505715){_0x279510=_0x279510-0x0;var _0x3cecd1=_0x326f[_0x279510];return _0x3cecd1;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x9')]('/:id/interactions',auth[_0xf326('0xa')](),controller[_0xf326('0x14')]);router[_0xf326('0x9')](_0xf326('0x15'),controller['statusGet']);router[_0xf326('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x16')]);router[_0xf326('0x17')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0x18')]);router[_0xf326('0x17')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router['post'](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x1a')]);router[_0xf326('0x17')](_0xf326('0x1b'),controller[_0xf326('0x1c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf326('0x1d')]);router[_0xf326('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xf326('0x1e')]);router['post']('/:id/status',controller[_0xf326('0x1f')]);router[_0xf326('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x20')]);router[_0xf326('0x21')]('/:id',auth[_0xf326('0xa')](),controller[_0xf326('0x22')]);router[_0xf326('0x23')](_0xf326('0x24'),auth[_0xf326('0xa')](),controller[_0xf326('0x25')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf326('0x26')]);router[_0xf326('0x23')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x27')]);router[_0xf326('0x23')]('/:id/users',auth[_0xf326('0xa')](),controller[_0xf326('0x28')]);module[_0xf326('0x29')]=router; \ No newline at end of file +var _0x5fab=['create','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','status','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0x284c4a,_0x314b94){var _0x1e94ce=function(_0x193744){while(--_0x193744){_0x284c4a['push'](_0x284c4a['shift']());}};_0x1e94ce(++_0x314b94);}(_0x5fab,0x177));var _0xb5fa=function(_0x4a7193,_0x556c6a){_0x4a7193=_0x4a7193-0x0;var _0xc33d94=_0x5fab[_0x4a7193];return _0xc33d94;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/dispositions',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0xa')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['getApplications']);router[_0xb5fa('0xa')](_0xb5fa('0x14'),auth['isAuthenticated'](),controller[_0xb5fa('0x15')]);router['get'](_0xb5fa('0x16'),controller[_0xb5fa('0x17')]);router[_0xb5fa('0xa')](_0xb5fa('0x18'),auth[_0xb5fa('0xb')](),controller['getAgents']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x19')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1b'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb5fa('0x1a')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1c')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1d'),controller[_0xb5fa('0x1e')]);router[_0xb5fa('0x1a')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);router[_0xb5fa('0x1a')]('/:id/send',auth[_0xb5fa('0xb')](),controller['send']);router[_0xb5fa('0x1a')]('/:id/status',controller[_0xb5fa('0x20')]);router[_0xb5fa('0x1a')]('/:id/users',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x21')]);router[_0xb5fa('0x22')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x23')]);router[_0xb5fa('0x24')]('/:id',auth[_0xb5fa('0xb')](),controller['destroy']);router[_0xb5fa('0x24')](_0xb5fa('0x1b'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x25')]);router[_0xb5fa('0x24')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xb5fa('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 b22b5e8..85f0854 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 _0x84a0=['setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','name','STRING','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x4b0e54,_0x4df39e){var _0x2347e5=function(_0x296591){while(--_0x296591){_0x4b0e54['push'](_0x4b0e54['shift']());}};_0x2347e5(++_0x4df39e);}(_0x84a0,0x128));var _0x084a=function(_0x5a3b94,_0x2aa9c4){_0x5a3b94=_0x5a3b94-0x0;var _0x2151de=_0x84a0[_0x5a3b94];return _0x2151de;};'use strict';var Sequelize=require(_0x084a('0x0'));var rs=require(_0x084a('0x1'));module[_0x084a('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x084a('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x084a('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x084a('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x084a('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x084a('0x5')](_0x084a('0x6'),'skebby',_0x084a('0x7'),_0x084a('0x8'),_0x084a('0x9'),_0x084a('0xa'),_0x084a('0xb'),_0x084a('0xc'),'infobip',_0x084a('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x084a('0x4')]},'authToken':{'type':Sequelize[_0x084a('0x4')]},'smsMethod':{'type':Sequelize[_0x084a('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x084a('0x4')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x084a('0x4')]},'applicationId':{'type':Sequelize[_0x084a('0x4')]},'accountId':{'type':Sequelize[_0x084a('0x4')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x084a('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x084a('0x4')]},'notificationTemplate':{'type':Sequelize[_0x084a('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x084a('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x084a('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x084a('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x084a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x084a('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x084a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x084a('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x084a('0x10')],'comment':_0x084a('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x084a('0x12'),'set':function(_0x48ac7a){if(!_0x48ac7a)this[_0x084a('0x13')](_0x084a('0x14'),null);this[_0x084a('0x13')]('mandatoryDisposition',_0x48ac7a);}}}; \ No newline at end of file +var _0x3eb8=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','connectel','plivo','clickatell','bandwidth','csc','infobip','intelepeer','TEXT','BOOLEAN'];(function(_0x21ccce,_0x8cf90d){var _0x1d2351=function(_0x18be00){while(--_0x18be00){_0x21ccce['push'](_0x21ccce['shift']());}};_0x1d2351(++_0x8cf90d);}(_0x3eb8,0x16a));var _0x83eb=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x3eb8[_0x172747];return _0x509692;};'use strict';var Sequelize=require(_0x83eb('0x0'));var rs=require(_0x83eb('0x1'));module[_0x83eb('0x2')]={'name':{'type':Sequelize[_0x83eb('0x3')],'unique':_0x83eb('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x83eb('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x83eb('0x5')]();}},'phone':{'type':Sequelize[_0x83eb('0x3')]},'type':{'type':Sequelize[_0x83eb('0x6')]('twilio','skebby',_0x83eb('0x7'),'clicksend',_0x83eb('0x8'),_0x83eb('0x9'),_0x83eb('0xa'),_0x83eb('0xb'),_0x83eb('0xc'),_0x83eb('0xd'))},'accountSid':{'type':Sequelize[_0x83eb('0x3')]},'authId':{'type':Sequelize[_0x83eb('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x83eb('0x3')]},'password':{'type':Sequelize[_0x83eb('0x3')]},'apiKey':{'type':Sequelize[_0x83eb('0x3')]},'applicationId':{'type':Sequelize[_0x83eb('0x3')]},'accountId':{'type':Sequelize[_0x83eb('0x3')]},'senderString':{'type':Sequelize[_0x83eb('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x83eb('0x3')]},'notificationTemplate':{'type':Sequelize[_0x83eb('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x83eb('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x83eb('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x83eb('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x83eb('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x83eb('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x83eb('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x83eb('0xf')],'defaultValue':![],'comment':_0x83eb('0x11'),'set':function(_0x20b47b){if(!_0x20b47b)this[_0x83eb('0x12')](_0x83eb('0x13'),null);this[_0x83eb('0x12')](_0x83eb('0x14'),_0x20b47b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 5952c3f..777dc5b 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 _0x3a83=['skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','clickatell','redif','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','csc','state','addAgents','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','client','http','request','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','where','filters','filter','merge','VIRTUAL','includeAll','include','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','Disposition','findOne','order','sort','pick','options','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','notify','sms','account','applications','orderBy','priority','asc','Applications','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','infobip','results','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','text/xml','send','\x0a','addApplications','transaction','sequelize','ISOLATION_LEVELS','SmsApplication','bulkCreate','findAndCountAll','stack','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','isNil','to\x20is\x20mandatory','List','user','Messages','dataValues','inspect'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x3a83,0x1e4));var _0x33a8=function(_0x20ce7a,_0x106f2d){_0x20ce7a=_0x20ce7a-0x0;var _0x192d90=_0x3a83[_0x20ce7a];return _0x192d90;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x33a8('0x0'));var jsonpatch=require(_0x33a8('0x1'));var rp=require(_0x33a8('0x2'));var moment=require(_0x33a8('0x3'));var BPromise=require(_0x33a8('0x4'));var Mustache=require('mustache');var util=require(_0x33a8('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x33a8('0x6'));var ejs=require(_0x33a8('0x7'));var fs=require('fs');var fs_extra=require(_0x33a8('0x8'));var _=require(_0x33a8('0x9'));var squel=require(_0x33a8('0xa'));var crypto=require(_0x33a8('0xb'));var jsforce=require(_0x33a8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33a8('0x6'));var querystring=require(_0x33a8('0xd'));var Papa=require(_0x33a8('0xe'));var Redis=require(_0x33a8('0xf'));var authService=require(_0x33a8('0x10'));var qs=require(_0x33a8('0x11'));var as=require(_0x33a8('0x12'));var hardwareService=require(_0x33a8('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x33a8('0x14'));var config=require(_0x33a8('0x15'));var licenseUtil=require(_0x33a8('0x16'));var db=require(_0x33a8('0x17'))['db'];config[_0x33a8('0x18')]=_[_0x33a8('0x19')](config[_0x33a8('0x18')],{'host':_0x33a8('0x1a'),'port':0x18eb});var socket=require(_0x33a8('0x1b'))(new Redis(config[_0x33a8('0x18')]));require(_0x33a8('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x33a8('0x1d')][_0x33a8('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0xc47a34,_0x5569ea,_0x78c19d,_0x22186d){return new BPromise(function(_0x35db9b,_0x3c2e23){var _0x3efc57=_0x22186d||client;return _0x3efc57[_0x33a8('0x1f')](_0xc47a34,_0x78c19d)['then'](function(_0x449f83){logger[_0x33a8('0x20')](_0x33a8('0x21'),_0x5569ea,'request\x20sent');logger['debug'](_0x33a8('0x22'),_0x5569ea,_0x33a8('0x23'),JSON['stringify'](_0x449f83));if(_0x449f83[_0x33a8('0x24')]){if(_0x449f83[_0x33a8('0x24')][_0x33a8('0x25')]===0x1f4){logger[_0x33a8('0x24')](_0x33a8('0x21'),_0x5569ea,_0x449f83[_0x33a8('0x24')]['message']);return _0x3c2e23(_0x449f83[_0x33a8('0x24')]['message']);}logger[_0x33a8('0x24')](_0x33a8('0x21'),_0x5569ea,_0x449f83[_0x33a8('0x24')][_0x33a8('0x26')]);return _0x35db9b(_0x449f83[_0x33a8('0x24')][_0x33a8('0x26')]);}else{logger[_0x33a8('0x20')]('SmsAccount,\x20%s,\x20%s',_0x5569ea,_0x33a8('0x23'));_0x35db9b(_0x449f83['result'][_0x33a8('0x26')]);}})[_0x33a8('0x27')](function(_0x35d126){logger[_0x33a8('0x24')](_0x33a8('0x21'),_0x5569ea,_0x35d126);_0x3c2e23(_0x35d126);});});}function respondWithStatusCode(_0x272522,_0x20bd8a){_0x20bd8a=_0x20bd8a||0xcc;return function(_0x372542){if(_0x372542){return _0x272522[_0x33a8('0x28')](_0x20bd8a);}return _0x272522[_0x33a8('0x29')](_0x20bd8a)[_0x33a8('0x2a')]();};}function respondWithResult(_0x5ce579,_0x11854a){_0x11854a=_0x11854a||0xc8;return function(_0x4bae03){if(_0x4bae03){return _0x5ce579[_0x33a8('0x29')](_0x11854a)[_0x33a8('0x2b')](_0x4bae03);}};}function respondWithFilteredResult(_0x1395ae,_0x18a03c){return function(_0x53c247){if(_0x53c247){var _0x53a034=typeof _0x18a03c[_0x33a8('0x2c')]===_0x33a8('0x2d')&&typeof _0x18a03c[_0x33a8('0x2e')]==='undefined';var _0x3f0e97=_0x53c247[_0x33a8('0x2f')];var _0x2e4590=_0x53a034?0x0:_0x18a03c[_0x33a8('0x2c')];var _0x30f588=_0x53a034?_0x53c247[_0x33a8('0x2f')]:_0x18a03c[_0x33a8('0x2c')]+_0x18a03c[_0x33a8('0x2e')];var _0x47e21b;if(_0x30f588>=_0x3f0e97){_0x30f588=_0x3f0e97;_0x47e21b=0xc8;}else{_0x47e21b=0xce;}_0x1395ae[_0x33a8('0x29')](_0x47e21b);return _0x1395ae[_0x33a8('0x30')](_0x33a8('0x31'),_0x2e4590+'-'+_0x30f588+'/'+_0x3f0e97)['json'](_0x53c247);}return null;};}function patchUpdates(_0x4c01e9){return function(_0x4f1677){try{jsonpatch[_0x33a8('0x32')](_0x4f1677,_0x4c01e9,!![]);}catch(_0xdf49f6){return BPromise[_0x33a8('0x33')](_0xdf49f6);}return _0x4f1677[_0x33a8('0x34')]();};}function saveUpdates(_0x460665,_0x22b0c4){return function(_0x2e10a4){if(_0x2e10a4){return _0x2e10a4[_0x33a8('0x35')](_0x460665)['then'](function(_0x20894c){return _0x20894c;});}return null;};}function removeEntity(_0xe846d8,_0x3f3674){return function(_0x302f3c){if(_0x302f3c){return _0x302f3c[_0x33a8('0x36')]()[_0x33a8('0x37')](function(){var _0x1a7055=_0x302f3c[_0x33a8('0x38')]({'plain':!![]});var _0x47e471='SmsAccounts';return db['UserProfileResource'][_0x33a8('0x36')]({'where':{'type':_0x47e471,'resourceId':_0x1a7055['id']}})[_0x33a8('0x37')](function(){return _0x302f3c;});})['then'](function(){_0xe846d8[_0x33a8('0x29')](0xcc)[_0x33a8('0x2a')]();});}};}function handleEntityNotFound(_0x38e0c1,_0x46b37f){return function(_0x44ed4a){if(!_0x44ed4a){_0x38e0c1['sendStatus'](0x194);}return _0x44ed4a;};}function handleError(_0x295d8,_0x47d88d){_0x47d88d=_0x47d88d||0x1f4;return function(_0x3bd456){logger[_0x33a8('0x24')](_0x3bd456['stack']);if(_0x3bd456[_0x33a8('0x39')]){delete _0x3bd456['name'];}_0x295d8[_0x33a8('0x29')](_0x47d88d)['send'](_0x3bd456);};}exports[_0x33a8('0x3a')]=function(_0x26b283,_0x29e5c0){var _0x3f7d2f={'include':[{'model':db[_0x33a8('0x3b')],'as':_0x33a8('0x3c')}]},_0x3d8a32={},_0xf0530f={'count':0x0,'rows':[]};var _0x34f31b=_[_0x33a8('0x3d')](db[_0x33a8('0x3e')][_0x33a8('0x3f')],function(_0x32590a){return{'name':_0x32590a['fieldName'],'type':_0x32590a[_0x33a8('0x40')][_0x33a8('0x41')]};});_0x3d8a32['model']=_[_0x33a8('0x3d')](_0x34f31b,_0x33a8('0x39'));_0x3d8a32[_0x33a8('0x42')]=_[_0x33a8('0x43')](_0x26b283['query']);_0x3d8a32['filters']=_[_0x33a8('0x44')](_0x3d8a32['model'],_0x3d8a32[_0x33a8('0x42')]);_0x3f7d2f['attributes']=_[_0x33a8('0x44')](_0x3d8a32[_0x33a8('0x45')],qs[_0x33a8('0x46')](_0x26b283['query'][_0x33a8('0x46')]));_0x3f7d2f[_0x33a8('0x47')]=_0x3f7d2f[_0x33a8('0x47')][_0x33a8('0x48')]?_0x3f7d2f[_0x33a8('0x47')]:_0x3d8a32[_0x33a8('0x45')];if(!_0x26b283[_0x33a8('0x42')][_0x33a8('0x49')](_0x33a8('0x4a'))){_0x3f7d2f[_0x33a8('0x2e')]=qs[_0x33a8('0x2e')](_0x26b283[_0x33a8('0x42')][_0x33a8('0x2e')]);_0x3f7d2f[_0x33a8('0x2c')]=qs[_0x33a8('0x2c')](_0x26b283[_0x33a8('0x42')][_0x33a8('0x2c')]);}_0x3f7d2f['order']=qs['sort'](_0x26b283[_0x33a8('0x42')]['sort']);_0x3f7d2f[_0x33a8('0x4b')]=qs[_0x33a8('0x4c')](_['pick'](_0x26b283[_0x33a8('0x42')],_0x3d8a32[_0x33a8('0x4c')]),_0x34f31b);if(_0x26b283[_0x33a8('0x42')][_0x33a8('0x4d')]){_0x3f7d2f[_0x33a8('0x4b')]=_[_0x33a8('0x4e')](_0x3f7d2f[_0x33a8('0x4b')],{'$or':_['map'](_0x34f31b,function(_0x4d29c7){if(_0x4d29c7['type']!==_0x33a8('0x4f')){var _0x15d436={};_0x15d436[_0x4d29c7['name']]={'$like':'%'+_0x26b283[_0x33a8('0x42')]['filter']+'%'};return _0x15d436;}})});}_0x3f7d2f=_[_0x33a8('0x4e')]({},_0x3f7d2f,_0x26b283['options']);var _0x416999={'where':_0x3f7d2f['where']};return db[_0x33a8('0x3e')]['count'](_0x416999)[_0x33a8('0x37')](function(_0x55166c){_0xf0530f[_0x33a8('0x2f')]=_0x55166c;if(_0x26b283[_0x33a8('0x42')][_0x33a8('0x50')]){_0x3f7d2f[_0x33a8('0x51')]=[{'all':!![]}];}return db[_0x33a8('0x3e')]['findAll'](_0x3f7d2f);})[_0x33a8('0x37')](function(_0x3b2b38){_0xf0530f['rows']=_0x3b2b38;return _0xf0530f;})[_0x33a8('0x37')](respondWithFilteredResult(_0x29e5c0,_0x3f7d2f))['catch'](handleError(_0x29e5c0,null));};exports[_0x33a8('0x52')]=function(_0x56c192,_0x3903b8){var _0x53ef2a={'raw':![],'where':{'id':_0x56c192['params']['id']},'include':[{'model':db['Pause'],'as':_0x33a8('0x3c')}]},_0x4b6173={};_0x4b6173[_0x33a8('0x45')]=_[_0x33a8('0x43')](db['SmsAccount'][_0x33a8('0x3f')]);_0x4b6173['query']=_['keys'](_0x56c192[_0x33a8('0x42')]);_0x4b6173[_0x33a8('0x4c')]=_['intersection'](_0x4b6173[_0x33a8('0x45')],_0x4b6173[_0x33a8('0x42')]);_0x53ef2a[_0x33a8('0x47')]=_[_0x33a8('0x44')](_0x4b6173[_0x33a8('0x45')],qs[_0x33a8('0x46')](_0x56c192[_0x33a8('0x42')][_0x33a8('0x46')]));_0x53ef2a[_0x33a8('0x47')]=_0x53ef2a[_0x33a8('0x47')][_0x33a8('0x48')]?_0x53ef2a['attributes']:_0x4b6173[_0x33a8('0x45')];if(_0x56c192[_0x33a8('0x42')]['includeAll']){_0x53ef2a['include']=[{'all':!![]}];}_0x53ef2a=_[_0x33a8('0x4e')]({},_0x53ef2a,_0x56c192['options']);return db[_0x33a8('0x3e')][_0x33a8('0x53')](_0x53ef2a)['then'](handleEntityNotFound(_0x3903b8,null))[_0x33a8('0x37')](respondWithResult(_0x3903b8,null))['catch'](handleError(_0x3903b8,null));};exports[_0x33a8('0x54')]=function(_0x45d093,_0x4086ec){return db[_0x33a8('0x3e')][_0x33a8('0x54')](_0x45d093[_0x33a8('0x55')],{})[_0x33a8('0x37')](function(_0x37e8cd){var _0x512d69=_0x45d093['user'][_0x33a8('0x38')]({'plain':!![]});if(!_0x512d69)throw new Error(_0x33a8('0x56'));if(_0x512d69[_0x33a8('0x57')]==='user'){var _0x375014=_0x37e8cd[_0x33a8('0x38')]({'plain':!![]});var _0x1ee00f=_0x33a8('0x58');return db[_0x33a8('0x59')][_0x33a8('0x53')]({'where':{'name':_0x1ee00f,'userProfileId':_0x512d69['userProfileId']},'raw':!![]})['then'](function(_0x2857ba){if(_0x2857ba&&_0x2857ba[_0x33a8('0x5a')]===0x0){return db['UserProfileResource'][_0x33a8('0x54')]({'name':_0x375014[_0x33a8('0x39')],'resourceId':_0x375014['id'],'type':_0x2857ba[_0x33a8('0x39')],'sectionId':_0x2857ba['id']},{})[_0x33a8('0x37')](function(){return _0x37e8cd;});}else{return _0x37e8cd;}})[_0x33a8('0x27')](function(_0x27f141){logger['error'](_0x33a8('0x5b'),_0x27f141);throw _0x27f141;});}return _0x37e8cd;})[_0x33a8('0x37')](respondWithResult(_0x4086ec,0xc9))['catch'](handleError(_0x4086ec,null));};exports[_0x33a8('0x35')]=function(_0x35077b,_0x490a79){if(_0x35077b['body']['id']){delete _0x35077b[_0x33a8('0x55')]['id'];}return db[_0x33a8('0x3e')]['find']({'where':{'id':_0x35077b[_0x33a8('0x5c')]['id']},'include':[{'model':db[_0x33a8('0x3b')],'as':_0x33a8('0x3c')}]})[_0x33a8('0x37')](handleEntityNotFound(_0x490a79,null))[_0x33a8('0x37')](saveUpdates(_0x35077b['body'],null))[_0x33a8('0x37')](respondWithResult(_0x490a79,null))[_0x33a8('0x27')](handleError(_0x490a79,null));};exports[_0x33a8('0x36')]=function(_0x5b1813,_0x372c8f){return db[_0x33a8('0x3e')]['find']({'where':{'id':_0x5b1813[_0x33a8('0x5c')]['id']}})[_0x33a8('0x37')](handleEntityNotFound(_0x372c8f,null))[_0x33a8('0x37')](removeEntity(_0x372c8f,null))[_0x33a8('0x27')](handleError(_0x372c8f,null));};exports[_0x33a8('0x5d')]=function(_0x9ffb9e,_0x27983d){return db[_0x33a8('0x3e')]['describe']()[_0x33a8('0x37')](respondWithResult(_0x27983d,null))[_0x33a8('0x27')](handleError(_0x27983d,null));};exports[_0x33a8('0x5e')]=function(_0xd43f8a,_0x105760,_0x24bdb2){if(_0xd43f8a[_0x33a8('0x55')]['id']){delete _0xd43f8a['body']['id'];}return db[_0x33a8('0x3e')][_0x33a8('0x53')]({'where':{'id':_0xd43f8a[_0x33a8('0x5c')]['id']}})[_0x33a8('0x37')](handleEntityNotFound(_0x105760,null))['then'](function(_0x15749a){if(_0x15749a){_0xd43f8a[_0x33a8('0x55')][_0x33a8('0x5f')]=_0x15749a['id'];return db[_0x33a8('0x60')][_0x33a8('0x54')](_0xd43f8a['body']);}})['then'](respondWithResult(_0x105760,null))[_0x33a8('0x27')](handleError(_0x105760,null));};exports['getDispositions']=function(_0x15411e,_0x42b97c,_0x55794a){var _0x5a1668={'raw':![],'where':{}};var _0x4493dd={};var _0x4eb078={'count':0x0,'rows':[]};return db['SmsAccount'][_0x33a8('0x61')]({'where':{'id':_0x15411e[_0x33a8('0x5c')]['id']}})[_0x33a8('0x37')](handleEntityNotFound(_0x42b97c,null))[_0x33a8('0x37')](function(_0x1fb5a5){if(_0x1fb5a5){_0x4493dd['model']=_[_0x33a8('0x43')](db[_0x33a8('0x60')][_0x33a8('0x3f')]);_0x4493dd['query']=_['keys'](_0x15411e['query']);_0x4493dd['filters']=_[_0x33a8('0x44')](_0x4493dd['model'],_0x4493dd[_0x33a8('0x42')]);_0x5a1668[_0x33a8('0x47')]=_[_0x33a8('0x44')](_0x4493dd[_0x33a8('0x45')],qs['fields'](_0x15411e[_0x33a8('0x42')]['fields']));_0x5a1668[_0x33a8('0x47')]=_0x5a1668[_0x33a8('0x47')]['length']?_0x5a1668[_0x33a8('0x47')]:_0x4493dd[_0x33a8('0x45')];if(!_0x15411e[_0x33a8('0x42')][_0x33a8('0x49')](_0x33a8('0x4a'))){_0x5a1668[_0x33a8('0x2e')]=qs[_0x33a8('0x2e')](_0x15411e[_0x33a8('0x42')][_0x33a8('0x2e')]);_0x5a1668['offset']=qs[_0x33a8('0x2c')](_0x15411e[_0x33a8('0x42')][_0x33a8('0x2c')]);}_0x5a1668[_0x33a8('0x62')]=qs[_0x33a8('0x63')](_0x15411e[_0x33a8('0x42')][_0x33a8('0x63')]);_0x5a1668[_0x33a8('0x4b')]=qs[_0x33a8('0x4c')](_[_0x33a8('0x64')](_0x15411e[_0x33a8('0x42')],_0x4493dd['filters']));_0x5a1668[_0x33a8('0x4b')]['SmsAccountId']=_0x1fb5a5['id'];if(_0x15411e[_0x33a8('0x42')][_0x33a8('0x4d')]){_0x5a1668[_0x33a8('0x4b')]=_[_0x33a8('0x4e')](_0x5a1668[_0x33a8('0x4b')],{'$or':_['map'](_0x5a1668[_0x33a8('0x47')],function(_0x3d9dbd){var _0x13501a={};_0x13501a[_0x3d9dbd]={'$like':'%'+_0x15411e[_0x33a8('0x42')][_0x33a8('0x4d')]+'%'};return _0x13501a;})});}_0x5a1668=_[_0x33a8('0x4e')]({},_0x5a1668,_0x15411e[_0x33a8('0x65')]);return db[_0x33a8('0x60')][_0x33a8('0x2f')]({'where':_0x5a1668[_0x33a8('0x4b')]})['then'](function(_0x31756e){_0x4eb078[_0x33a8('0x2f')]=_0x31756e;if(_0x15411e[_0x33a8('0x42')]['includeAll']){_0x5a1668['include']=[{'all':!![]}];}return db[_0x33a8('0x60')][_0x33a8('0x66')](_0x5a1668);})[_0x33a8('0x37')](function(_0x30e699){_0x4eb078['rows']=_0x30e699;return _0x4eb078;});}})[_0x33a8('0x37')](respondWithFilteredResult(_0x42b97c,_0x5a1668))['catch'](handleError(_0x42b97c,null));};exports[_0x33a8('0x67')]=function(_0x26eca8,_0x40a585,_0x37e8f2){return db['SmsAccount'][_0x33a8('0x53')]({'where':{'id':_0x26eca8['params']['id']}})[_0x33a8('0x37')](handleEntityNotFound(_0x40a585,null))[_0x33a8('0x37')](function(_0xcf378c){if(_0xcf378c){return _0xcf378c[_0x33a8('0x67')](_0x26eca8[_0x33a8('0x42')][_0x33a8('0x68')]);}})['then'](respondWithStatusCode(_0x40a585,null))[_0x33a8('0x27')](handleError(_0x40a585,null));};exports[_0x33a8('0x69')]=function(_0x408ffb,_0x2623a6,_0x4bad57){if(_0x408ffb[_0x33a8('0x55')]['id']){delete _0x408ffb['body']['id'];}return db[_0x33a8('0x3e')][_0x33a8('0x53')]({'where':{'id':_0x408ffb[_0x33a8('0x5c')]['id']}})[_0x33a8('0x37')](handleEntityNotFound(_0x2623a6,null))[_0x33a8('0x37')](function(_0x215cf8){if(_0x215cf8){_0x408ffb[_0x33a8('0x55')][_0x33a8('0x5f')]=_0x215cf8['id'];return db[_0x33a8('0x6a')][_0x33a8('0x54')](_0x408ffb[_0x33a8('0x55')]);}})[_0x33a8('0x37')](respondWithResult(_0x2623a6,null))[_0x33a8('0x27')](handleError(_0x2623a6,null));};exports[_0x33a8('0x6b')]=function(_0x152a64,_0x1eb47e,_0xee153a){var _0x45f6cf={'raw':![],'where':{}};var _0xb875bb={};var _0x1a6e90={'count':0x0,'rows':[]};return db[_0x33a8('0x3e')]['findOne']({'where':{'id':_0x152a64['params']['id']}})[_0x33a8('0x37')](handleEntityNotFound(_0x1eb47e,null))[_0x33a8('0x37')](function(_0x5c42b2){if(_0x5c42b2){_0xb875bb[_0x33a8('0x45')]=_[_0x33a8('0x43')](db[_0x33a8('0x6a')][_0x33a8('0x3f')]);_0xb875bb[_0x33a8('0x42')]=_[_0x33a8('0x43')](_0x152a64[_0x33a8('0x42')]);_0xb875bb[_0x33a8('0x4c')]=_[_0x33a8('0x44')](_0xb875bb[_0x33a8('0x45')],_0xb875bb[_0x33a8('0x42')]);_0x45f6cf[_0x33a8('0x47')]=_['intersection'](_0xb875bb[_0x33a8('0x45')],qs['fields'](_0x152a64[_0x33a8('0x42')][_0x33a8('0x46')]));_0x45f6cf['attributes']=_0x45f6cf['attributes'][_0x33a8('0x48')]?_0x45f6cf[_0x33a8('0x47')]:_0xb875bb[_0x33a8('0x45')];if(!_0x152a64[_0x33a8('0x42')][_0x33a8('0x49')](_0x33a8('0x4a'))){_0x45f6cf[_0x33a8('0x2e')]=qs[_0x33a8('0x2e')](_0x152a64[_0x33a8('0x42')][_0x33a8('0x2e')]);_0x45f6cf[_0x33a8('0x2c')]=qs[_0x33a8('0x2c')](_0x152a64[_0x33a8('0x42')][_0x33a8('0x2c')]);}_0x45f6cf[_0x33a8('0x62')]=qs[_0x33a8('0x63')](_0x152a64[_0x33a8('0x42')][_0x33a8('0x63')]);_0x45f6cf['where']=qs[_0x33a8('0x4c')](_[_0x33a8('0x64')](_0x152a64['query'],_0xb875bb[_0x33a8('0x4c')]));_0x45f6cf[_0x33a8('0x4b')][_0x33a8('0x5f')]=_0x5c42b2['id'];if(_0x152a64[_0x33a8('0x42')][_0x33a8('0x4d')]){_0x45f6cf[_0x33a8('0x4b')]=_['merge'](_0x45f6cf[_0x33a8('0x4b')],{'$or':_[_0x33a8('0x3d')](_0x45f6cf[_0x33a8('0x47')],function(_0x42e4ef){var _0x5b93c1={};_0x5b93c1[_0x42e4ef]={'$like':'%'+_0x152a64[_0x33a8('0x42')][_0x33a8('0x4d')]+'%'};return _0x5b93c1;})});}_0x45f6cf=_['merge']({},_0x45f6cf,_0x152a64[_0x33a8('0x65')]);return db[_0x33a8('0x6a')][_0x33a8('0x2f')]({'where':_0x45f6cf['where']})[_0x33a8('0x37')](function(_0x2591ee){_0x1a6e90[_0x33a8('0x2f')]=_0x2591ee;if(_0x152a64['query'][_0x33a8('0x50')]){_0x45f6cf[_0x33a8('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0x33a8('0x66')](_0x45f6cf);})['then'](function(_0x2c691a){_0x1a6e90[_0x33a8('0x6c')]=_0x2c691a;return _0x1a6e90;});}})[_0x33a8('0x37')](respondWithFilteredResult(_0x1eb47e,_0x45f6cf))[_0x33a8('0x27')](handleError(_0x1eb47e,null));};exports[_0x33a8('0x6d')]=function(_0x1918fb,_0x50d4c5,_0x4896d6){return db['SmsAccount'][_0x33a8('0x53')]({'where':{'id':_0x1918fb[_0x33a8('0x5c')]['id']}})[_0x33a8('0x37')](handleEntityNotFound(_0x50d4c5,null))[_0x33a8('0x37')](function(_0x287a4b){if(_0x287a4b){return _0x287a4b[_0x33a8('0x6d')](_0x1918fb['query']['ids']);}})[_0x33a8('0x37')](respondWithStatusCode(_0x50d4c5,null))['catch'](handleError(_0x50d4c5,null));};exports[_0x33a8('0x6e')]=function(_0x283aba,_0x1f8512,_0x44980e){var _0x4141ec={'channel':_0x33a8('0x6f')};var _0x41c241=[];var _0x165234=[];var _0x3503ad={};return db['SmsAccount'][_0x33a8('0x53')]({'where':{'id':_0x283aba['params']['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x1f8512,null))['then'](function(_0x506794){_0x4141ec[_0x33a8('0x70')]=_0x506794;_0x4141ec[_0x33a8('0x71')]=_[_0x33a8('0x72')](_0x506794['Applications'],[_0x33a8('0x73')],[_0x33a8('0x74')]);if(_0x4141ec['account'][_0x33a8('0x75')]){delete _0x4141ec[_0x33a8('0x70')][_0x33a8('0x75')];}return db[_0x33a8('0x76')][_0x33a8('0x5d')]();})[_0x33a8('0x37')](function(_0x1ce5d0){if(!_0x1ce5d0){throw new db[(_0x33a8('0x77'))][(_0x33a8('0x78'))]('no\x20available\x20attributes');}_0x41c241=_[_0x33a8('0x79')](_[_0x33a8('0x43')](_0x1ce5d0),[_0x33a8('0x7a'),_0x33a8('0x7b')]);_0x165234=_['difference'](_[_0x33a8('0x43')](_0x1ce5d0),[_0x33a8('0x7a'),'updatedAt',_0x33a8('0x7c'),_0x33a8('0x7d')]);_0x4141ec['body']={'mapKey':_0x33a8('0x7e')};if(_0x4141ec['account'][_0x33a8('0x40')]){switch(_0x4141ec[_0x33a8('0x70')]['type']){case _0x33a8('0x7f'):_0x4141ec[_0x33a8('0x55')][_0x33a8('0x80')]=_0x283aba['body'][_0x33a8('0x81')];_0x4141ec[_0x33a8('0x55')]['body']=_0x283aba[_0x33a8('0x55')][_0x33a8('0x82')];_0x4141ec['body'][_0x33a8('0x83')]=_0x283aba[_0x33a8('0x55')][_0x33a8('0x84')];break;case _0x33a8('0x85'):_0x4141ec['body'][_0x33a8('0x80')]='+'+_0x283aba[_0x33a8('0x55')][_0x33a8('0x86')];_0x4141ec[_0x33a8('0x55')]['body']=_0x283aba[_0x33a8('0x55')][_0x33a8('0x87')];break;case _0x33a8('0x88'):_0x4141ec['body'][_0x33a8('0x80')]=_0x283aba['body'][_0x33a8('0x80')];_0x4141ec['body']['body']=_0x283aba[_0x33a8('0x55')][_0x33a8('0x26')];break;case _0x33a8('0x89'):_0x4141ec[_0x33a8('0x55')][_0x33a8('0x80')]=_0x283aba[_0x33a8('0x55')][_0x33a8('0x80')];_0x4141ec['body']['body']=_0x283aba[_0x33a8('0x55')][_0x33a8('0x55')];_0x4141ec[_0x33a8('0x55')][_0x33a8('0x83')]=_0x283aba[_0x33a8('0x55')]['message_id'];break;case'plivo':_0x4141ec[_0x33a8('0x55')][_0x33a8('0x80')]=_0x283aba[_0x33a8('0x55')][_0x33a8('0x81')];_0x4141ec['body'][_0x33a8('0x55')]=_0x283aba[_0x33a8('0x55')]['Text'];_0x4141ec[_0x33a8('0x55')]['messageId']=_0x283aba[_0x33a8('0x55')]['MessageUUID'];break;case _0x33a8('0x8a'):_0x4141ec[_0x33a8('0x55')][_0x33a8('0x80')]='+'+_0x283aba['body'][_0x33a8('0x8b')][0x0][_0x33a8('0x80')];_0x4141ec[_0x33a8('0x55')][_0x33a8('0x55')]=_0x283aba[_0x33a8('0x55')][_0x33a8('0x8b')][0x0]['text'];_0x4141ec[_0x33a8('0x55')][_0x33a8('0x83')]=_0x283aba[_0x33a8('0x55')][_0x33a8('0x8b')][0x0][_0x33a8('0x83')];break;case'csc':_0x4141ec[_0x33a8('0x55')][_0x33a8('0x80')]=_0x283aba[_0x33a8('0x55')][_0x33a8('0x8c')];_0x4141ec['body'][_0x33a8('0x55')]=_0x283aba[_0x33a8('0x55')][_0x33a8('0x8d')][_0x33a8('0x26')];break;case'clickatell':_0x4141ec[_0x33a8('0x55')][_0x33a8('0x80')]=_0x283aba[_0x33a8('0x55')][_0x33a8('0x8e')];_0x4141ec[_0x33a8('0x55')]['body']=_0x283aba[_0x33a8('0x55')][_0x33a8('0x87')];_0x4141ec[_0x33a8('0x55')][_0x33a8('0x83')]=_0x283aba[_0x33a8('0x55')][_0x33a8('0x8f')];break;case _0x33a8('0x90'):_0x4141ec[_0x33a8('0x55')]['messageId']=_0x283aba[_0x33a8('0x55')][0x0]['message']['id'];_0x4141ec[_0x33a8('0x55')][_0x33a8('0x80')]=_0x283aba[_0x33a8('0x55')][0x0][_0x33a8('0x26')][_0x33a8('0x80')];_0x4141ec[_0x33a8('0x55')][_0x33a8('0x55')]=_0x283aba[_0x33a8('0x55')][0x0][_0x33a8('0x26')][_0x33a8('0x87')];break;case _0x33a8('0x91'):_0x4141ec[_0x33a8('0x55')][_0x33a8('0x80')]=_0x283aba[_0x33a8('0x55')][_0x33a8('0x80')];_0x4141ec[_0x33a8('0x55')][_0x33a8('0x55')]=_0x283aba[_0x33a8('0x55')][_0x33a8('0x26')];_0x4141ec[_0x33a8('0x55')][_0x33a8('0x83')]=_0x283aba[_0x33a8('0x55')]['refid'];break;}}if(_0x4141ec[_0x33a8('0x55')]['id']){delete _0x4141ec['body']['id'];}if(_['isNil'](_0x4141ec[_0x33a8('0x55')][_0x33a8('0x80')])){throw new db[(_0x33a8('0x77'))][(_0x33a8('0x78'))](_0x33a8('0x92'));}if(_['isNil'](_0x4141ec[_0x33a8('0x55')][_0x33a8('0x55')])||_0x4141ec[_0x33a8('0x55')][_0x33a8('0x55')]===''){throw new db[(_0x33a8('0x77'))][(_0x33a8('0x78'))](_0x33a8('0x93'));}if(_['isNil'](_0x4141ec[_0x33a8('0x55')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x33a8('0x94')+_0x165234);}if(!_[_0x33a8('0x95')](_0x165234,_0x4141ec[_0x33a8('0x55')][_0x33a8('0x96')])){throw new db['Sequelize'][(_0x33a8('0x78'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x165234);}_0x3503ad[_0x4141ec['body'][_0x33a8('0x96')]]=_0x4141ec['body'][_0x33a8('0x80')];return db[_0x33a8('0x97')]['find']({'where':{'id':_0x4141ec[_0x33a8('0x70')]['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3503ad,'limit':0x1,'order':[[_0x33a8('0x7b'),_0x33a8('0x98')]]}]});})[_0x33a8('0x37')](handleEntityNotFound(_0x1f8512,null))['then'](function(_0x51e573){if(_0x51e573){_0x4141ec[_0x33a8('0x99')]=_[_0x33a8('0x9a')](_0x51e573,[_0x33a8('0x9b')]);if(_0x51e573['Contacts']['length']){return _0x51e573[_0x33a8('0x9b')][0x0];}var _0x1f7e81=_['defaults'](_0x4141ec[_0x33a8('0x55')],{'firstName':_0x4141ec[_0x33a8('0x55')][_0x33a8('0x80')],'ListId':_0x51e573['id']});_0x1f7e81[_0x4141ec['body'][_0x33a8('0x96')]]=_0x4141ec['body'][_0x33a8('0x80')];return db['CmContact'][_0x33a8('0x54')](_0x1f7e81,{'fields':_0x41c241,'raw':!![]});}})['then'](handleEntityNotFound(_0x1f8512,null))[_0x33a8('0x37')](function(_0x4dfaf5){if(_0x4dfaf5){_0x4141ec[_0x33a8('0x9c')]=_0x4dfaf5;var _0x324e23={'ContactId':_0x4dfaf5['id'],'phone':_0x4141ec[_0x33a8('0x55')][_0x33a8('0x80')],'SmsAccountId':_0x283aba[_0x33a8('0x5c')]['id']};var _0x314c80={'ContactId':_0x4dfaf5['id'],'SmsAccountId':_0x283aba[_0x33a8('0x5c')]['id'],'closed':![]};return db[_0x33a8('0x9d')][_0x33a8('0x53')]({'where':_0x314c80})[_0x33a8('0x37')](function(_0x209cd1){if(_0x209cd1){return[_0x209cd1,![]];}return db['SmsInteraction'][_0x33a8('0x54')](_0x324e23)[_0x33a8('0x37')](function(_0x505271){return[_0x505271,!![]];});});}})[_0x33a8('0x9e')](function(_0x5e96e1,_0x4d9066){_0x4141ec[_0x33a8('0x9f')]=_0x5e96e1[_0x33a8('0x38')]({'plain':!![]});_0x4141ec[_0x33a8('0x9f')][_0x33a8('0xa0')]=![];if(_0x4d9066){if(_0x4141ec[_0x33a8('0x70')][_0x33a8('0xa1')]){_0x4141ec[_0x33a8('0x71')][_0x33a8('0xa2')]({'id':0x0,'priority':_0x4141ec[_0x33a8('0x71')][_0x33a8('0x48')]+0x1,'app':_0x33a8('0xa3'),'appdata':_0x33a8('0xa4'),'interval':'*,*,*,*'});}_0x4141ec[_0x33a8('0x9f')]['created']=!![];}return db[_0x33a8('0xa5')][_0x33a8('0x54')]({'phone':_0x4141ec[_0x33a8('0x55')][_0x33a8('0x80')],'messageId':_0x4141ec[_0x33a8('0x55')][_0x33a8('0x83')],'body':_0x4141ec[_0x33a8('0x55')][_0x33a8('0x55')],'SmsAccountId':_0x283aba['params']['id'],'SmsInteractionId':_0x5e96e1['id'],'direction':'in','ContactId':_0x5e96e1[_0x33a8('0xa6')],'AttachmentId':_0x4141ec['body'][_0x33a8('0xa7')]});})[_0x33a8('0x37')](function(_0x3a1e8e){_0x4141ec[_0x33a8('0x26')]=_0x3a1e8e;if(_0x4141ec[_0x33a8('0x9f')][_0x33a8('0xa8')]){return db[_0x33a8('0xa9')][_0x33a8('0x53')]({'attributes':['id',_0x33a8('0x39')],'where':{'id':_0x4141ec['interaction']['UserId']}})[_0x33a8('0x37')](function(_0xd91c0c){if(_0xd91c0c){_0x4141ec[_0x33a8('0x71')]['unshift']({'id':0x0,'priority':0x0,'app':_0x33a8('0xaa'),'appdata':_0xd91c0c[_0x33a8('0x39')]+','+(_0x4141ec['account'][_0x33a8('0xab')]||0xa),'interval':_0x33a8('0xac')});}return respondWithRpcPromise('Start','startRouting',_0x4141ec);});}return respondWithRpcPromise(_0x33a8('0xad'),_0x33a8('0xae'),_0x4141ec);})[_0x33a8('0x37')](function(_0x12094d){if(_0x12094d){var _0x234f81=0xc8;var _0x427612=_0x33a8('0xaf');logger[_0x33a8('0x20')](_0x33a8('0x22'),_0x427612,_0x234f81,_0x33a8('0xb0'));logger[_0x33a8('0xb1')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x427612,_0x234f81,_0x33a8('0xb0'),JSON['stringify'](_0x12094d));if(_0x4141ec[_0x33a8('0x70')][_0x33a8('0x40')]===_0x33a8('0x7f')){return _0x1f8512['status'](_0x234f81)[_0x33a8('0x30')]('Content-Type',_0x33a8('0xb2'))[_0x33a8('0xb3')](_0x33a8('0xb4'));}else{return _0x1f8512['status'](_0x234f81)['json'](_0x12094d);}}})[_0x33a8('0x27')](handleError(_0x1f8512,null));};exports[_0x33a8('0xb5')]=function(_0xba2cf8,_0x1b1b02){var _0x21e43d=_0xba2cf8[_0x33a8('0x5c')]['id'];var _0x53c2c1=_0xba2cf8['body'];var _0x24b239=0xc8;var _0x16e0bb=null;return db['sequelize'][_0x33a8('0xb6')]({'isolationLevel':db[_0x33a8('0xb7')]['Transaction'][_0x33a8('0xb8')]['READ_COMMITTED']},function(_0x1eb3b0){return db[_0x33a8('0x3e')]['findOne']({'where':{'id':_0x21e43d},'transaction':_0x1eb3b0})[_0x33a8('0x37')](function(_0x3467fe){if(_0x3467fe){return db[_0x33a8('0xb9')][_0x33a8('0x36')]({'where':{'SmsAccountId':_0x21e43d},'transaction':_0x1eb3b0})[_0x33a8('0x37')](function(){var _0x45639b=_['map'](_0x53c2c1,function(_0x396c00){_0x396c00[_0x33a8('0x5f')]=_0x21e43d;return _0x396c00;});return db[_0x33a8('0xb9')][_0x33a8('0xba')](_0x45639b,{'transaction':_0x1eb3b0});});}else{_0x24b239=0x194;_0x16e0bb=[];}});})['then'](function(){if(_0x24b239!==0x194){return db[_0x33a8('0xb9')][_0x33a8('0xbb')]({'where':{'SmsAccountId':_0x21e43d},'order':'priority'})[_0x33a8('0x37')](function(_0x42ab0b){_0x16e0bb=_0x42ab0b;});}})[_0x33a8('0x27')](function(_0x4f1d27){_0x24b239=0x1f4;logger[_0x33a8('0x24')](_0x4f1d27[_0x33a8('0xbc')]);if(_0x4f1d27['name']){delete _0x4f1d27[_0x33a8('0x39')];}_0x16e0bb=_0x4f1d27;})['finally'](function(){if(_0x16e0bb===null){_0x1b1b02[_0x33a8('0x28')](_0x24b239);}else{if(_0x24b239===0x1f4){_0x1b1b02[_0x33a8('0x29')](_0x24b239)[_0x33a8('0xb3')](_0x16e0bb);}else{_0x1b1b02['status'](_0x24b239)[_0x33a8('0x2b')](_0x16e0bb);}}});};exports['getApplications']=function(_0x2c4e62,_0x8e73f3,_0x5cd2f5){var _0x4a6949={};var _0x2548de={};var _0x14631f;var _0x8d7940;return db['SmsAccount'][_0x33a8('0x61')]({'where':{'id':_0x2c4e62[_0x33a8('0x5c')]['id']}})[_0x33a8('0x37')](handleEntityNotFound(_0x8e73f3,null))[_0x33a8('0x37')](function(_0x2842c8){if(_0x2842c8){_0x14631f=_0x2842c8;_0x2548de[_0x33a8('0x45')]=_[_0x33a8('0x43')](db[_0x33a8('0xb9')][_0x33a8('0x3f')]);_0x2548de[_0x33a8('0x42')]=_[_0x33a8('0x43')](_0x2c4e62[_0x33a8('0x42')]);_0x2548de['filters']=_['intersection'](_0x2548de[_0x33a8('0x45')],_0x2548de['query']);_0x4a6949['attributes']=_['intersection'](_0x2548de[_0x33a8('0x45')],qs[_0x33a8('0x46')](_0x2c4e62['query'][_0x33a8('0x46')]));_0x4a6949[_0x33a8('0x47')]=_0x4a6949[_0x33a8('0x47')]['length']?_0x4a6949[_0x33a8('0x47')]:_0x2548de[_0x33a8('0x45')];_0x4a6949[_0x33a8('0x62')]=qs['sort'](_0x2c4e62[_0x33a8('0x42')][_0x33a8('0x63')]);_0x4a6949[_0x33a8('0x4b')]=qs[_0x33a8('0x4c')](_[_0x33a8('0x64')](_0x2c4e62[_0x33a8('0x42')],_0x2548de[_0x33a8('0x4c')]));if(_0x2c4e62[_0x33a8('0x42')]['filter']){_0x4a6949[_0x33a8('0x4b')]=_[_0x33a8('0x4e')](_0x4a6949[_0x33a8('0x4b')],{'$or':_[_0x33a8('0x3d')](_0x4a6949[_0x33a8('0x47')],function(_0x4f3a71){var _0x19d1c1={};_0x19d1c1[_0x4f3a71]={'$like':'%'+_0x2c4e62[_0x33a8('0x42')][_0x33a8('0x4d')]+'%'};return _0x19d1c1;})});}_0x4a6949=_[_0x33a8('0x4e')]({},_0x4a6949,_0x2c4e62['options']);return _0x14631f['getApplications'](_0x4a6949);}})['then'](function(_0x3f7d6e){if(_0x3f7d6e){_0x8d7940=_0x3f7d6e[_0x33a8('0x48')];if(!_0x2c4e62[_0x33a8('0x42')][_0x33a8('0x49')](_0x33a8('0x4a'))){_0x4a6949[_0x33a8('0x2e')]=qs['limit'](_0x2c4e62[_0x33a8('0x42')][_0x33a8('0x2e')]);_0x4a6949[_0x33a8('0x2c')]=qs[_0x33a8('0x2c')](_0x2c4e62['query'][_0x33a8('0x2c')]);}return _0x14631f[_0x33a8('0xbd')](_0x4a6949);}})[_0x33a8('0x37')](function(_0x3f18b1){if(_0x3f18b1){return _0x3f18b1?{'count':_0x8d7940,'rows':_0x3f18b1}:null;}})[_0x33a8('0x37')](respondWithResult(_0x8e73f3,null))['catch'](handleError(_0x8e73f3,null));};exports[_0x33a8('0xbe')]=function(_0x3a20e2,_0x1a66c6,_0x158ac8){var _0x14dd40={'raw':![],'where':{}};var _0x5a24b5={};var _0x1cce86={'count':0x0,'rows':[]};return db[_0x33a8('0x3e')][_0x33a8('0x61')]({'where':{'id':_0x3a20e2[_0x33a8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1a66c6,null))[_0x33a8('0x37')](function(_0x4e2337){if(_0x4e2337){_0x5a24b5[_0x33a8('0x45')]=_['keys'](db[_0x33a8('0x9d')]['rawAttributes']);_0x5a24b5[_0x33a8('0x42')]=_['keys'](_0x3a20e2[_0x33a8('0x42')]);_0x5a24b5[_0x33a8('0x4c')]=_[_0x33a8('0x44')](_0x5a24b5['model'],_0x5a24b5[_0x33a8('0x42')]);_0x14dd40[_0x33a8('0x47')]=_[_0x33a8('0x44')](_0x5a24b5[_0x33a8('0x45')],qs[_0x33a8('0x46')](_0x3a20e2[_0x33a8('0x42')][_0x33a8('0x46')]));_0x14dd40['attributes']=_0x14dd40[_0x33a8('0x47')][_0x33a8('0x48')]?_0x14dd40[_0x33a8('0x47')]:_0x5a24b5[_0x33a8('0x45')];if(!_0x3a20e2[_0x33a8('0x42')][_0x33a8('0x49')]('nolimit')){_0x14dd40[_0x33a8('0x2e')]=qs[_0x33a8('0x2e')](_0x3a20e2[_0x33a8('0x42')][_0x33a8('0x2e')]);_0x14dd40[_0x33a8('0x2c')]=qs[_0x33a8('0x2c')](_0x3a20e2[_0x33a8('0x42')][_0x33a8('0x2c')]);}_0x14dd40[_0x33a8('0x62')]=qs['sort'](_0x3a20e2[_0x33a8('0x42')]['sort']);_0x14dd40[_0x33a8('0x4b')]=qs[_0x33a8('0x4c')](_['pick'](_0x3a20e2[_0x33a8('0x42')],_0x5a24b5[_0x33a8('0x4c')]));_0x14dd40[_0x33a8('0x4b')]['SmsAccountId']=_0x4e2337['id'];if(_0x3a20e2['query'][_0x33a8('0x4d')]){_0x14dd40[_0x33a8('0x4b')]=_[_0x33a8('0x4e')](_0x14dd40['where'],{'$or':_['map'](_0x14dd40['attributes'],function(_0x267799){var _0x4da3aa={};_0x4da3aa[_0x267799]={'$like':'%'+_0x3a20e2['query'][_0x33a8('0x4d')]+'%'};return _0x4da3aa;})});}_0x14dd40=_[_0x33a8('0x4e')]({},_0x14dd40,_0x3a20e2[_0x33a8('0x65')]);return db[_0x33a8('0x9d')][_0x33a8('0x2f')]({'where':_0x14dd40[_0x33a8('0x4b')]})[_0x33a8('0x37')](function(_0x4fd346){_0x1cce86[_0x33a8('0x2f')]=_0x4fd346;if(_0x3a20e2['query'][_0x33a8('0x50')]){_0x14dd40[_0x33a8('0x51')]=[{'model':db[_0x33a8('0x76')],'as':_0x33a8('0xbf'),'required':![]},{'model':db[_0x33a8('0xa9')],'as':_0x33a8('0xc0'),'attributes':[_0x33a8('0x39'),_0x33a8('0xc1'),_0x33a8('0xc2')],'required':![]},{'model':db[_0x33a8('0xc3')],'as':_0x33a8('0xc4'),'attributes':['id',_0x33a8('0x39'),_0x33a8('0xc5')],'where':_0x3a20e2[_0x33a8('0x42')][_0x33a8('0xc6')]?{'id':_0x3a20e2[_0x33a8('0x42')]['tag']}:undefined,'required':_0x3a20e2[_0x33a8('0x42')]['tag']?!![]:![]}];}return db[_0x33a8('0x9d')][_0x33a8('0x66')](_0x14dd40);})[_0x33a8('0x37')](function(_0x20dc55){_0x1cce86[_0x33a8('0x6c')]=_0x20dc55;return _0x1cce86;});}})['then'](respondWithFilteredResult(_0x1a66c6,_0x14dd40))['catch'](handleError(_0x1a66c6,null));};exports[_0x33a8('0xb3')]=function(_0x5f2783,_0x50667b,_0x3e6a39){var _0x220f4c,_0x4a32ac,_0x393ef3;if(_[_0x33a8('0xc7')](_0x5f2783['body'][_0x33a8('0x55')])||_0x5f2783['body'][_0x33a8('0x55')]===''){throw new db[(_0x33a8('0x77'))][(_0x33a8('0x78'))](_0x33a8('0x93'));}if(_[_0x33a8('0xc7')](_0x5f2783[_0x33a8('0x55')]['to'])){throw new db[(_0x33a8('0x77'))][(_0x33a8('0x78'))](_0x33a8('0xc8'));}_0x220f4c=_0x5f2783['body']['to'];return db['SmsAccount'][_0x33a8('0x53')]({'where':{'id':_0x5f2783[_0x33a8('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x33a8('0xc9'),'include':[{'model':db[_0x33a8('0x76')],'as':_0x33a8('0x9b'),'where':{'mobile':_0x220f4c},'limit':0x1,'order':[[_0x33a8('0x7b'),_0x33a8('0x98')]]}]}]})[_0x33a8('0x37')](handleEntityNotFound(_0x50667b,null))['then'](function(_0x1cc67a){if(_0x1cc67a&&_0x1cc67a[_0x33a8('0xc9')]){_0x4a32ac=_0x1cc67a[_0x33a8('0x38')]({'plain':!![]});if(_0x4a32ac[_0x33a8('0xc9')]&&_0x4a32ac[_0x33a8('0xc9')][_0x33a8('0x9b')][_0x33a8('0x48')]){return _0x4a32ac['List']['Contacts'][0x0];}return db['CmContact'][_0x33a8('0x54')](_[_0x33a8('0x19')](_0x5f2783['body'],{'firstName':_0x220f4c,'mobile':_0x220f4c,'phone':_0x220f4c,'ListId':_0x4a32ac[_0x33a8('0x7d')]}));}})[_0x33a8('0x37')](handleEntityNotFound(_0x50667b,null))[_0x33a8('0x37')](function(_0xabd09c){if(_0xabd09c){_0x393ef3=_0xabd09c;return db[_0x33a8('0x9d')][_0x33a8('0x53')]({'where':{'ContactId':_0x393ef3['id'],'closed':![],'SmsAccountId':_0x4a32ac['id']}})[_0x33a8('0x37')](function(_0x5bc3c7){if(_0x5bc3c7){return[_0x5bc3c7,![]];}return db[_0x33a8('0x9d')]['create']({'UserId':_0x5f2783[_0x33a8('0xca')]['id'],'ContactId':_0x393ef3['id'],'SmsAccountId':_0x4a32ac['id'],'phone':_0x220f4c,'firstMsgDirection':'out','Messages':[_['merge'](_0x5f2783[_0x33a8('0x55')],{'read':![],'body':_0x5f2783['body'][_0x33a8('0x55')],'phone':_0x220f4c,'SmsAccountId':_0x4a32ac['id'],'UserId':_0x5f2783[_0x33a8('0xca')]['id'],'ContactId':_0x393ef3['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x33a8('0xcb')}]})[_0x33a8('0x37')](function(_0x307d45){return[_0x307d45,!![]];});});}})[_0x33a8('0x9e')](function(_0x492cf2,_0x3ea053){if(_0x3ea053){return _0x492cf2;}return db[_0x33a8('0xa5')][_0x33a8('0x54')](_[_0x33a8('0x4e')](_0x5f2783[_0x33a8('0x55')],{'read':![],'body':_0x5f2783['body'][_0x33a8('0x55')],'phone':_0x220f4c,'SmsAccountId':_0x4a32ac['id'],'SmsInteractionId':_0x492cf2['id'],'UserId':_0x5f2783[_0x33a8('0xca')]['id'],'ContactId':_0x393ef3['id']}))[_0x33a8('0x37')](function(_0x52b3d3){_0x492cf2[_0x33a8('0xcc')][_0x33a8('0xcb')]=[];_0x492cf2[_0x33a8('0xcc')]['Messages']['push'](_0x52b3d3[_0x33a8('0xcc')]);return _0x492cf2;});})[_0x33a8('0x37')](respondWithResult(_0x50667b,null))[_0x33a8('0x27')](handleError(_0x50667b,null));};exports[_0x33a8('0x29')]=function(_0x49b99b,_0x147d17,_0x56ddaa){if(_0x49b99b[_0x33a8('0x55')]['id']){delete _0x49b99b[_0x33a8('0x55')]['id'];}var _0xad7169,_0x52a0d8,_0x5d7455;return db['SmsAccount'][_0x33a8('0x53')]({'where':{'id':_0x49b99b[_0x33a8('0x5c')]['id']}})[_0x33a8('0x37')](handleEntityNotFound(_0x147d17,null))['then'](function(_0x38e750){if(_0x38e750){_0x5d7455=_0x38e750;logger[_0x33a8('0xb1')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x33a8('0x29'),'received\x20delivery\x20report\x20from',_0x38e750[_0x33a8('0x40')],util[_0x33a8('0xcd')](_0x49b99b['body'],{'showHidden':![],'depth':null}));switch(_0x38e750[_0x33a8('0x40')]){case _0x33a8('0x85'):if(_0x49b99b[_0x33a8('0x55')]['skebby_dispatch_id']&&_0x49b99b['body'][_0x33a8('0x29')]){_0x52a0d8=_0x49b99b[_0x33a8('0x55')][_0x33a8('0x29')];return db['SmsMessage']['find']({'where':{'messageId':_0x49b99b[_0x33a8('0x55')][_0x33a8('0xce')]}});}break;case'connectel':if(_0x49b99b[_0x33a8('0x55')][_0x33a8('0xcf')]&&_0x49b99b['body'][_0x33a8('0xd0')]){_0x52a0d8=_0x49b99b[_0x33a8('0x55')][_0x33a8('0xd0')];return db[_0x33a8('0xa5')][_0x33a8('0x53')]({'where':{'messageId':_0x49b99b['body'][_0x33a8('0xcf')]}});}break;case _0x33a8('0x89'):if(_0x49b99b[_0x33a8('0x55')][_0x33a8('0xd1')]&&_0x49b99b[_0x33a8('0x55')][_0x33a8('0xd2')]){_0x52a0d8=_0x49b99b[_0x33a8('0x55')][_0x33a8('0xd2')];return db[_0x33a8('0xa5')]['find']({'where':{'messageId':_0x49b99b[_0x33a8('0x55')][_0x33a8('0xd1')]}});}break;case _0x33a8('0x8a'):var _0x3adcb6=_0x49b99b[_0x33a8('0x55')]['results'][0x0];if(_0x3adcb6[_0x33a8('0x83')]&&_0x3adcb6[_0x33a8('0x29')][_0x33a8('0xd3')]===_0x33a8('0xd4')){_0x52a0d8=_0x3adcb6[_0x33a8('0x29')]['groupName'];return db[_0x33a8('0xa5')][_0x33a8('0x53')]({'where':{'messageId':_0x3adcb6[_0x33a8('0x83')]}});}break;case _0x33a8('0xd5'):if(_0x49b99b[_0x33a8('0x55')][_0x33a8('0x83')]&&_0x49b99b[_0x33a8('0x55')][_0x33a8('0x29')]){_0x52a0d8=_0x49b99b[_0x33a8('0x55')]['status'];return db[_0x33a8('0xa5')][_0x33a8('0x53')]({'where':{'messageId':_0x49b99b['body'][_0x33a8('0x83')]}});}break;case'bandwidth':if(_0x49b99b[_0x33a8('0x55')][0x0]['message']['id']){_0x52a0d8=_0x49b99b[_0x33a8('0x55')][0x0][_0x33a8('0x40')];return db['SmsMessage'][_0x33a8('0x53')]({'where':{'messageId':_0x49b99b[_0x33a8('0x55')][0x0][_0x33a8('0x26')]['id']}});}break;case _0x33a8('0x91'):if(_0x49b99b['body'][_0x33a8('0xd6')]&&_0x49b99b[_0x33a8('0x55')][_0x33a8('0x29')]){_0x52a0d8=_0x49b99b[_0x33a8('0x55')][_0x33a8('0x29')];return db[_0x33a8('0xa5')][_0x33a8('0x53')]({'where':{'messageId':_0x49b99b['body'][_0x33a8('0xd6')]}});}break;}}})[_0x33a8('0x37')](handleEntityNotFound(_0x147d17,null))[_0x33a8('0x37')](function(_0xdbe81){if(_0xdbe81){_0xad7169=_0xdbe81;switch(_0x5d7455['type']){case'skebby':if(_0x52a0d8===_0x33a8('0xd4')){return _0xad7169[_0x33a8('0x35')]({'read':!![]});}else{logger[_0x33a8('0x24')](_0x33a8('0x22'),_0x33a8('0x29'),'skebby',util[_0x33a8('0xcd')](_0x49b99b['body'],{'showHidden':![],'depth':null}));}break;case _0x33a8('0x88'):if(_0x52a0d8==='1'){return _0xad7169[_0x33a8('0x35')]({'read':!![]});}else{logger[_0x33a8('0x24')](_0x33a8('0x22'),'status','skebby',util[_0x33a8('0xcd')](_0x49b99b[_0x33a8('0x55')],{'showHidden':![],'depth':null}));}break;case _0x33a8('0x89'):if(!_0x49b99b[_0x33a8('0x55')]['error_code']&&_0x52a0d8>=0xc8&&_0x52a0d8<=0xce){return _0xad7169['update']({'read':!![]});}else{logger[_0x33a8('0x24')](_0x33a8('0x22'),_0x33a8('0x29'),_0x33a8('0x89'),util[_0x33a8('0xcd')](_0x49b99b[_0x33a8('0x55')],{'showHidden':![],'depth':null}));}break;case _0x33a8('0x8a'):var _0xf34b6c=_0x49b99b[_0x33a8('0x55')][_0x33a8('0x8b')][0x0];if(_0xf34b6c['status'][_0x33a8('0xd3')]===_0x33a8('0xd4')){return _0xad7169[_0x33a8('0x35')]({'read':!![]});}else{logger[_0x33a8('0x24')](_0x33a8('0x22'),'status',_0x33a8('0x8a'),util[_0x33a8('0xcd')](_0x49b99b[_0x33a8('0x55')],{'showHidden':![],'depth':null}));}break;case _0x33a8('0xd5'):if(_0x52a0d8==_0x33a8('0xd7')||_0x52a0d8=='RECEIVED_BY_RECIPIENT'){return _0xad7169['update']({'read':!![]});}else{logger[_0x33a8('0x24')](_0x33a8('0x22'),_0x33a8('0x29'),_0x33a8('0xd5'),util[_0x33a8('0xcd')](_0x49b99b[_0x33a8('0x55')],{'showHidden':![],'depth':null}));}break;case _0x33a8('0x90'):if(_0x52a0d8==_0x33a8('0xd8')){return _0xad7169[_0x33a8('0x35')]({'read':!![]});}else{logger[_0x33a8('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x33a8('0x29'),_0x33a8('0x90'),util[_0x33a8('0xcd')](_0x49b99b['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x52a0d8===_0x33a8('0xd9')||_0x52a0d8===_0x33a8('0xda')){return _0xad7169[_0x33a8('0x35')]({'read':!![]});}else{logger[_0x33a8('0x24')](_0x33a8('0x22'),_0x33a8('0x29'),'intelepeer',util[_0x33a8('0xcd')](_0x49b99b['body'],{'showHidden':![],'depth':null}));}break;}return _0xad7169;}})[_0x33a8('0x37')](respondWithResult(_0x147d17,null))[_0x33a8('0x27')](handleError(_0x147d17,null));};exports[_0x33a8('0xdb')]=function(_0x15885a,_0x2952a3,_0x4fe989){var _0x1772ba,_0x178b69,_0x100334;return db[_0x33a8('0x3e')][_0x33a8('0x53')]({'where':{'id':_0x15885a[_0x33a8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2952a3,null))['then'](function(_0x5e54f8){if(_0x5e54f8){_0x100334=_0x5e54f8;logger[_0x33a8('0xb1')](_0x33a8('0x22'),'status',_0x33a8('0xdc'),_0x5e54f8['type'],util['inspect'](_0x15885a['query'],{'showHidden':![],'depth':null}));switch(_0x5e54f8[_0x33a8('0x40')]){case _0x33a8('0xdd'):if(_0x15885a[_0x33a8('0x42')]['message-id']&&_0x15885a[_0x33a8('0x42')]['state']){_0x178b69=_0x15885a[_0x33a8('0x42')][_0x33a8('0xde')];return db[_0x33a8('0xa5')][_0x33a8('0x53')]({'where':{'messageId':_0x15885a[_0x33a8('0x42')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x2952a3,null))[_0x33a8('0x37')](function(_0x253f79){if(_0x253f79){_0x1772ba=_0x253f79;switch(_0x100334[_0x33a8('0x40')]){case _0x33a8('0xdd'):if(_0x178b69==='2'||_0x178b69==='6'){return _0x1772ba[_0x33a8('0x35')]({'read':!![]});}else{logger[_0x33a8('0x24')](_0x33a8('0x22'),_0x33a8('0x29'),'csc',util['inspect'](_0x15885a['query'],{'showHidden':![],'depth':null}));};break;}return _0x1772ba;}})[_0x33a8('0x37')](respondWithResult(_0x2952a3,null))['catch'](handleError(_0x2952a3,null));};exports[_0x33a8('0xdf')]=function(_0x1bc2e7,_0x168b4d,_0x207dbb){return db['SmsAccount'][_0x33a8('0x53')]({'where':{'id':_0x1bc2e7['params']['id']}})[_0x33a8('0x37')](handleEntityNotFound(_0x168b4d,null))[_0x33a8('0x37')](function(_0x24be88){if(_0x24be88){return _0x24be88[_0x33a8('0xdf')](_0x1bc2e7[_0x33a8('0x55')][_0x33a8('0x68')],_['omit'](_0x1bc2e7['body'],[_0x33a8('0x68'),'id'])||{})['spread'](function(_0x35392d){for(var _0x10d43d=0x0;_0x10d43d<_0x1bc2e7['body'][_0x33a8('0x68')][_0x33a8('0x48')];_0x10d43d+=0x1){socket['emit'](_0x33a8('0xe0'),{'UserId':Number(_0x1bc2e7[_0x33a8('0x55')][_0x33a8('0x68')][_0x10d43d]),'SmsAccountId':Number(_0x1bc2e7[_0x33a8('0x5c')]['id'])});}return _0x35392d;});}})['then'](respondWithResult(_0x168b4d,null))['catch'](handleError(_0x168b4d,null));};exports['removeAgents']=function(_0x117803,_0x61edec,_0x20fe21){return db['SmsAccount'][_0x33a8('0x53')]({'where':{'id':_0x117803['params']['id']}})[_0x33a8('0x37')](handleEntityNotFound(_0x61edec,null))[_0x33a8('0x37')](function(_0x1594d3){if(_0x1594d3){return _0x1594d3[_0x33a8('0xe1')](_0x117803[_0x33a8('0x42')][_0x33a8('0x68')])[_0x33a8('0x37')](function(){if(_[_0x33a8('0xe2')](_0x117803[_0x33a8('0x42')][_0x33a8('0x68')])){for(var _0x562cc1=0x0;_0x562cc1<_0x117803[_0x33a8('0x42')][_0x33a8('0x68')]['length'];_0x562cc1+=0x1){socket['emit'](_0x33a8('0xe3'),{'UserId':Number(_0x117803['query'][_0x33a8('0x68')][_0x562cc1]),'SmsAccountId':Number(_0x117803[_0x33a8('0x5c')]['id'])});}}else{socket[_0x33a8('0xe4')](_0x33a8('0xe3'),{'UserId':Number(_0x117803['query']['ids']),'SmsAccountId':Number(_0x117803[_0x33a8('0x5c')]['id'])});}});}})[_0x33a8('0x37')](respondWithStatusCode(_0x61edec,null))[_0x33a8('0x27')](handleError(_0x61edec,null));};exports[_0x33a8('0xe5')]=function(_0x78fca4,_0x1eda12,_0xb39c64){var _0x4b6d2a={};var _0x36e8d4={};var _0x21ece0;var _0x549b6c;return db[_0x33a8('0x3e')]['findOne']({'where':{'id':_0x78fca4['params']['id']}})['then'](handleEntityNotFound(_0x1eda12,null))[_0x33a8('0x37')](function(_0x3a873a){if(_0x3a873a){_0x21ece0=_0x3a873a;_0x36e8d4[_0x33a8('0x45')]=_[_0x33a8('0x43')](db[_0x33a8('0xa9')][_0x33a8('0x3f')]);_0x36e8d4[_0x33a8('0x42')]=_[_0x33a8('0x43')](_0x78fca4['query']);_0x36e8d4[_0x33a8('0x4c')]=_[_0x33a8('0x44')](_0x36e8d4['model'],_0x36e8d4[_0x33a8('0x42')]);_0x4b6d2a[_0x33a8('0x47')]=_[_0x33a8('0x44')](_0x36e8d4[_0x33a8('0x45')],qs[_0x33a8('0x46')](_0x78fca4[_0x33a8('0x42')][_0x33a8('0x46')]));_0x4b6d2a['attributes']=_0x4b6d2a['attributes']['length']?_0x4b6d2a['attributes']:_0x36e8d4[_0x33a8('0x45')];_0x4b6d2a[_0x33a8('0x62')]=qs[_0x33a8('0x63')](_0x78fca4[_0x33a8('0x42')][_0x33a8('0x63')]);_0x4b6d2a[_0x33a8('0x4b')]=qs['filters'](_[_0x33a8('0x64')](_0x78fca4[_0x33a8('0x42')],_0x36e8d4[_0x33a8('0x4c')]));if(_0x78fca4[_0x33a8('0x42')][_0x33a8('0x4d')]){_0x4b6d2a[_0x33a8('0x4b')]=_['merge'](_0x4b6d2a[_0x33a8('0x4b')],{'$or':_[_0x33a8('0x3d')](_0x4b6d2a[_0x33a8('0x47')],function(_0x32b9b1){var _0x1da2af={};_0x1da2af[_0x32b9b1]={'$like':'%'+_0x78fca4[_0x33a8('0x42')][_0x33a8('0x4d')]+'%'};return _0x1da2af;})});}_0x4b6d2a=_[_0x33a8('0x4e')]({},_0x4b6d2a,_0x78fca4[_0x33a8('0x65')]);return _0x21ece0['getAgents'](_0x4b6d2a);}})[_0x33a8('0x37')](function(_0x4d5889){if(_0x4d5889){_0x549b6c=_0x4d5889['length'];if(!_0x78fca4[_0x33a8('0x42')][_0x33a8('0x49')]('nolimit')){_0x4b6d2a['limit']=qs[_0x33a8('0x2e')](_0x78fca4['query']['limit']);_0x4b6d2a[_0x33a8('0x2c')]=qs[_0x33a8('0x2c')](_0x78fca4['query'][_0x33a8('0x2c')]);}return _0x21ece0[_0x33a8('0xe5')](_0x4b6d2a);}})[_0x33a8('0x37')](function(_0x4f3609){if(_0x4f3609){return _0x4f3609?{'count':_0x549b6c,'rows':_0x4f3609}:null;}})[_0x33a8('0x37')](respondWithResult(_0x1eda12,null))[_0x33a8('0x27')](handleError(_0x1eda12,null));}; \ No newline at end of file +var _0xbcc6=['rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','nolimit','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','CmContact','ValidationError','createdAt','updatedAt','difference','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','sender','text','MessageUUID','infobip','results','originatingAddress','clickatell','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','contact','interaction','created','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','addApplications','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','SmsInteraction','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','dataValues','Messages','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','clicksend','message_id','status_code','groupName','redif','DELIVERED','update','error_code','DELIVERED_TO_GATEWAY','DELIVRD','csc','message-id','state','addAgents','spread','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','SmsAccounts','UserProfileResource','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition'];(function(_0x326492,_0x34425e){var _0x1175b6=function(_0x3c1ca6){while(--_0x3c1ca6){_0x326492['push'](_0x326492['shift']());}};_0x1175b6(++_0x34425e);}(_0xbcc6,0x75));var _0x6bcc=function(_0x39783a,_0x3d1895){_0x39783a=_0x39783a-0x0;var _0xaf7db5=_0xbcc6[_0x39783a];return _0xaf7db5;};'use strict';var emlformat=require(_0x6bcc('0x0'));var rimraf=require(_0x6bcc('0x1'));var zipdir=require(_0x6bcc('0x2'));var jsonpatch=require(_0x6bcc('0x3'));var rp=require(_0x6bcc('0x4'));var moment=require(_0x6bcc('0x5'));var BPromise=require(_0x6bcc('0x6'));var Mustache=require(_0x6bcc('0x7'));var util=require(_0x6bcc('0x8'));var path=require(_0x6bcc('0x9'));var sox=require(_0x6bcc('0xa'));var csv=require(_0x6bcc('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6bcc('0xc'));var _=require(_0x6bcc('0xd'));var squel=require(_0x6bcc('0xe'));var crypto=require('crypto');var jsforce=require(_0x6bcc('0xf'));var deskjs=require(_0x6bcc('0x10'));var toCsv=require(_0x6bcc('0xb'));var querystring=require(_0x6bcc('0x11'));var Papa=require(_0x6bcc('0x12'));var Redis=require(_0x6bcc('0x13'));var authService=require(_0x6bcc('0x14'));var qs=require(_0x6bcc('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bcc('0x16'))('api');var utils=require(_0x6bcc('0x17'));var config=require(_0x6bcc('0x18'));var licenseUtil=require(_0x6bcc('0x19'));var db=require(_0x6bcc('0x1a'))['db'];config['redis']=_['defaults'](config[_0x6bcc('0x1b')],{'host':_0x6bcc('0x1c'),'port':0x18eb});var socket=require(_0x6bcc('0x1d'))(new Redis(config['redis']));require(_0x6bcc('0x1e'))[_0x6bcc('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x6bcc('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1e8c76,_0x5b2734,_0x2f2b0c,_0x18125c){return new BPromise(function(_0x2adc51,_0xa95241){var _0x22e456=_0x18125c||client;return _0x22e456[_0x6bcc('0x21')](_0x1e8c76,_0x2f2b0c)[_0x6bcc('0x22')](function(_0x2441e9){logger['info'](_0x6bcc('0x23'),_0x5b2734,_0x6bcc('0x24'));logger[_0x6bcc('0x25')](_0x6bcc('0x26'),_0x5b2734,_0x6bcc('0x24'),JSON[_0x6bcc('0x27')](_0x2441e9));if(_0x2441e9[_0x6bcc('0x28')]){if(_0x2441e9[_0x6bcc('0x28')][_0x6bcc('0x29')]===0x1f4){logger['error'](_0x6bcc('0x23'),_0x5b2734,_0x2441e9[_0x6bcc('0x28')]['message']);return _0xa95241(_0x2441e9[_0x6bcc('0x28')][_0x6bcc('0x2a')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x5b2734,_0x2441e9[_0x6bcc('0x28')][_0x6bcc('0x2a')]);return _0x2adc51(_0x2441e9[_0x6bcc('0x28')][_0x6bcc('0x2a')]);}else{logger['info'](_0x6bcc('0x23'),_0x5b2734,_0x6bcc('0x24'));_0x2adc51(_0x2441e9[_0x6bcc('0x2b')]['message']);}})[_0x6bcc('0x2c')](function(_0x5661d4){logger[_0x6bcc('0x28')](_0x6bcc('0x23'),_0x5b2734,_0x5661d4);_0xa95241(_0x5661d4);});});}function respondWithStatusCode(_0x54310a,_0x5860dc){_0x5860dc=_0x5860dc||0xcc;return function(_0x244511){if(_0x244511){return _0x54310a[_0x6bcc('0x2d')](_0x5860dc);}return _0x54310a[_0x6bcc('0x2e')](_0x5860dc)['end']();};}function respondWithResult(_0x3ba518,_0x28c73a){_0x28c73a=_0x28c73a||0xc8;return function(_0x411bec){if(_0x411bec){return _0x3ba518[_0x6bcc('0x2e')](_0x28c73a)['json'](_0x411bec);}};}function respondWithFilteredResult(_0x23ea28,_0xd45ae5){return function(_0xdcb904){if(_0xdcb904){var _0x2566b4=typeof _0xd45ae5[_0x6bcc('0x2f')]==='undefined'&&typeof _0xd45ae5[_0x6bcc('0x30')]===_0x6bcc('0x31');var _0x287169=_0xdcb904[_0x6bcc('0x32')];var _0x413622=_0x2566b4?0x0:_0xd45ae5[_0x6bcc('0x2f')];var _0x1eb0cc=_0x2566b4?_0xdcb904[_0x6bcc('0x32')]:_0xd45ae5['offset']+_0xd45ae5[_0x6bcc('0x30')];var _0x26dcf4;if(_0x1eb0cc>=_0x287169){_0x1eb0cc=_0x287169;_0x26dcf4=0xc8;}else{_0x26dcf4=0xce;}_0x23ea28[_0x6bcc('0x2e')](_0x26dcf4);return _0x23ea28[_0x6bcc('0x33')](_0x6bcc('0x34'),_0x413622+'-'+_0x1eb0cc+'/'+_0x287169)[_0x6bcc('0x35')](_0xdcb904);}return null;};}function patchUpdates(_0x35be84){return function(_0x1a95bf){try{jsonpatch[_0x6bcc('0x36')](_0x1a95bf,_0x35be84,!![]);}catch(_0x57dea6){return BPromise[_0x6bcc('0x37')](_0x57dea6);}return _0x1a95bf[_0x6bcc('0x38')]();};}function saveUpdates(_0x53b0e7,_0x595081){return function(_0x3de2c0){if(_0x3de2c0){return _0x3de2c0['update'](_0x53b0e7)['then'](function(_0x2ba049){return _0x2ba049;});}return null;};}function removeEntity(_0xac8f87,_0x1d50c5){return function(_0x3730c7){if(_0x3730c7){return _0x3730c7['destroy']()['then'](function(){var _0x419c34=_0x3730c7['get']({'plain':!![]});var _0x40e693=_0x6bcc('0x39');return db[_0x6bcc('0x3a')][_0x6bcc('0x3b')]({'where':{'type':_0x40e693,'resourceId':_0x419c34['id']}})[_0x6bcc('0x22')](function(){return _0x3730c7;});})[_0x6bcc('0x22')](function(){_0xac8f87[_0x6bcc('0x2e')](0xcc)[_0x6bcc('0x3c')]();});}};}function handleEntityNotFound(_0x299c87,_0xb7b83b){return function(_0x867bb8){if(!_0x867bb8){_0x299c87[_0x6bcc('0x2d')](0x194);}return _0x867bb8;};}function handleError(_0x23ae11,_0x27a268){_0x27a268=_0x27a268||0x1f4;return function(_0x544e6f){logger[_0x6bcc('0x28')](_0x544e6f[_0x6bcc('0x3d')]);if(_0x544e6f[_0x6bcc('0x3e')]){delete _0x544e6f[_0x6bcc('0x3e')];}_0x23ae11['status'](_0x27a268)[_0x6bcc('0x3f')](_0x544e6f);};}exports[_0x6bcc('0x40')]=function(_0xc438cb,_0x1eccf9){var _0x286c35={'include':[{'model':db[_0x6bcc('0x41')],'as':_0x6bcc('0x42')}]},_0x50812c={},_0x53b42b={'count':0x0,'rows':[]};var _0x5c222f=_['map'](db[_0x6bcc('0x43')][_0x6bcc('0x44')],function(_0x596bb0){return{'name':_0x596bb0['fieldName'],'type':_0x596bb0['type'][_0x6bcc('0x45')]};});_0x50812c[_0x6bcc('0x46')]=_[_0x6bcc('0x47')](_0x5c222f,_0x6bcc('0x3e'));_0x50812c[_0x6bcc('0x48')]=_[_0x6bcc('0x49')](_0xc438cb[_0x6bcc('0x48')]);_0x50812c[_0x6bcc('0x4a')]=_[_0x6bcc('0x4b')](_0x50812c[_0x6bcc('0x46')],_0x50812c[_0x6bcc('0x48')]);_0x286c35[_0x6bcc('0x4c')]=_['intersection'](_0x50812c[_0x6bcc('0x46')],qs[_0x6bcc('0x4d')](_0xc438cb[_0x6bcc('0x48')][_0x6bcc('0x4d')]));_0x286c35[_0x6bcc('0x4c')]=_0x286c35[_0x6bcc('0x4c')][_0x6bcc('0x4e')]?_0x286c35[_0x6bcc('0x4c')]:_0x50812c['model'];if(!_0xc438cb[_0x6bcc('0x48')][_0x6bcc('0x4f')]('nolimit')){_0x286c35[_0x6bcc('0x30')]=qs[_0x6bcc('0x30')](_0xc438cb[_0x6bcc('0x48')]['limit']);_0x286c35['offset']=qs[_0x6bcc('0x2f')](_0xc438cb[_0x6bcc('0x48')][_0x6bcc('0x2f')]);}_0x286c35[_0x6bcc('0x50')]=qs[_0x6bcc('0x51')](_0xc438cb[_0x6bcc('0x48')][_0x6bcc('0x51')]);_0x286c35[_0x6bcc('0x52')]=qs[_0x6bcc('0x4a')](_[_0x6bcc('0x53')](_0xc438cb[_0x6bcc('0x48')],_0x50812c['filters']),_0x5c222f);if(_0xc438cb['query'][_0x6bcc('0x54')]){_0x286c35[_0x6bcc('0x52')]=_[_0x6bcc('0x55')](_0x286c35[_0x6bcc('0x52')],{'$or':_[_0x6bcc('0x47')](_0x5c222f,function(_0x323e96){if(_0x323e96[_0x6bcc('0x56')]!=='VIRTUAL'){var _0x36feb9={};_0x36feb9[_0x323e96[_0x6bcc('0x3e')]]={'$like':'%'+_0xc438cb[_0x6bcc('0x48')][_0x6bcc('0x54')]+'%'};return _0x36feb9;}})});}_0x286c35=_['merge']({},_0x286c35,_0xc438cb[_0x6bcc('0x57')]);var _0x24d157={'where':_0x286c35[_0x6bcc('0x52')]};return db[_0x6bcc('0x43')][_0x6bcc('0x32')](_0x24d157)[_0x6bcc('0x22')](function(_0x6cab0e){_0x53b42b['count']=_0x6cab0e;if(_0xc438cb[_0x6bcc('0x48')][_0x6bcc('0x58')]){_0x286c35[_0x6bcc('0x59')]=[{'all':!![]}];}return db[_0x6bcc('0x43')][_0x6bcc('0x5a')](_0x286c35);})[_0x6bcc('0x22')](function(_0x3e237a){_0x53b42b['rows']=_0x3e237a;return _0x53b42b;})[_0x6bcc('0x22')](respondWithFilteredResult(_0x1eccf9,_0x286c35))[_0x6bcc('0x2c')](handleError(_0x1eccf9,null));};exports[_0x6bcc('0x5b')]=function(_0x310050,_0xf4f8e2){var _0x3c25f2={'raw':![],'where':{'id':_0x310050['params']['id']},'include':[{'model':db[_0x6bcc('0x41')],'as':_0x6bcc('0x42')}]},_0x447520={};_0x447520[_0x6bcc('0x46')]=_['keys'](db[_0x6bcc('0x43')][_0x6bcc('0x44')]);_0x447520[_0x6bcc('0x48')]=_[_0x6bcc('0x49')](_0x310050[_0x6bcc('0x48')]);_0x447520[_0x6bcc('0x4a')]=_[_0x6bcc('0x4b')](_0x447520['model'],_0x447520[_0x6bcc('0x48')]);_0x3c25f2[_0x6bcc('0x4c')]=_[_0x6bcc('0x4b')](_0x447520[_0x6bcc('0x46')],qs['fields'](_0x310050['query'][_0x6bcc('0x4d')]));_0x3c25f2[_0x6bcc('0x4c')]=_0x3c25f2[_0x6bcc('0x4c')]['length']?_0x3c25f2[_0x6bcc('0x4c')]:_0x447520[_0x6bcc('0x46')];if(_0x310050['query'][_0x6bcc('0x58')]){_0x3c25f2[_0x6bcc('0x59')]=[{'all':!![]}];}_0x3c25f2=_[_0x6bcc('0x55')]({},_0x3c25f2,_0x310050[_0x6bcc('0x57')]);return db[_0x6bcc('0x43')][_0x6bcc('0x5c')](_0x3c25f2)[_0x6bcc('0x22')](handleEntityNotFound(_0xf4f8e2,null))[_0x6bcc('0x22')](respondWithResult(_0xf4f8e2,null))['catch'](handleError(_0xf4f8e2,null));};exports['create']=function(_0x19ed6b,_0xe50d2a){return db['SmsAccount'][_0x6bcc('0x5d')](_0x19ed6b[_0x6bcc('0x5e')],{})[_0x6bcc('0x22')](function(_0x2520e7){var _0x594ab2=_0x19ed6b[_0x6bcc('0x5f')][_0x6bcc('0x60')]({'plain':!![]});if(!_0x594ab2)throw new Error(_0x6bcc('0x61'));if(_0x594ab2[_0x6bcc('0x62')]===_0x6bcc('0x5f')){var _0x1f81b8=_0x2520e7[_0x6bcc('0x60')]({'plain':!![]});var _0x1ed696=_0x6bcc('0x39');return db['UserProfileSection'][_0x6bcc('0x5c')]({'where':{'name':_0x1ed696,'userProfileId':_0x594ab2[_0x6bcc('0x63')]},'raw':!![]})[_0x6bcc('0x22')](function(_0x1f7341){if(_0x1f7341&&_0x1f7341[_0x6bcc('0x64')]===0x0){return db[_0x6bcc('0x3a')][_0x6bcc('0x5d')]({'name':_0x1f81b8[_0x6bcc('0x3e')],'resourceId':_0x1f81b8['id'],'type':_0x1f7341[_0x6bcc('0x3e')],'sectionId':_0x1f7341['id']},{})['then'](function(){return _0x2520e7;});}else{return _0x2520e7;}})[_0x6bcc('0x2c')](function(_0x2e7ebf){logger[_0x6bcc('0x28')](_0x6bcc('0x65'),_0x2e7ebf);throw _0x2e7ebf;});}return _0x2520e7;})[_0x6bcc('0x22')](respondWithResult(_0xe50d2a,0xc9))[_0x6bcc('0x2c')](handleError(_0xe50d2a,null));};exports['update']=function(_0x547bf0,_0x58c8fb){if(_0x547bf0['body']['id']){delete _0x547bf0[_0x6bcc('0x5e')]['id'];}return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x547bf0[_0x6bcc('0x66')]['id']},'include':[{'model':db['Pause'],'as':_0x6bcc('0x42')}]})[_0x6bcc('0x22')](handleEntityNotFound(_0x58c8fb,null))[_0x6bcc('0x22')](saveUpdates(_0x547bf0[_0x6bcc('0x5e')],null))[_0x6bcc('0x22')](respondWithResult(_0x58c8fb,null))[_0x6bcc('0x2c')](handleError(_0x58c8fb,null));};exports[_0x6bcc('0x3b')]=function(_0x4832b6,_0x4f6224){return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x4832b6[_0x6bcc('0x66')]['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x4f6224,null))['then'](removeEntity(_0x4f6224,null))[_0x6bcc('0x2c')](handleError(_0x4f6224,null));};exports[_0x6bcc('0x67')]=function(_0x42b2c8,_0x50ebde){return db[_0x6bcc('0x43')][_0x6bcc('0x67')]()[_0x6bcc('0x22')](respondWithResult(_0x50ebde,null))[_0x6bcc('0x2c')](handleError(_0x50ebde,null));};exports[_0x6bcc('0x68')]=function(_0x327b0d,_0x184d1c,_0x3174c5){if(_0x327b0d['body']['id']){delete _0x327b0d['body']['id'];}return db['SmsAccount'][_0x6bcc('0x5c')]({'where':{'id':_0x327b0d[_0x6bcc('0x66')]['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x184d1c,null))['then'](function(_0x5487e2){if(_0x5487e2){_0x327b0d[_0x6bcc('0x5e')][_0x6bcc('0x69')]=_0x5487e2['id'];return db['Disposition'][_0x6bcc('0x5d')](_0x327b0d[_0x6bcc('0x5e')]);}})[_0x6bcc('0x22')](respondWithResult(_0x184d1c,null))[_0x6bcc('0x2c')](handleError(_0x184d1c,null));};exports[_0x6bcc('0x6a')]=function(_0x192f02,_0x32def8,_0x1ea97e){var _0x282f6c={'raw':![],'where':{}};var _0x2c6db4={};var _0x32cb88={'count':0x0,'rows':[]};return db[_0x6bcc('0x43')][_0x6bcc('0x6b')]({'where':{'id':_0x192f02['params']['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x32def8,null))['then'](function(_0x4580ca){if(_0x4580ca){_0x2c6db4['model']=_['keys'](db[_0x6bcc('0x6c')][_0x6bcc('0x44')]);_0x2c6db4['query']=_[_0x6bcc('0x49')](_0x192f02[_0x6bcc('0x48')]);_0x2c6db4[_0x6bcc('0x4a')]=_[_0x6bcc('0x4b')](_0x2c6db4[_0x6bcc('0x46')],_0x2c6db4['query']);_0x282f6c[_0x6bcc('0x4c')]=_[_0x6bcc('0x4b')](_0x2c6db4['model'],qs[_0x6bcc('0x4d')](_0x192f02[_0x6bcc('0x48')]['fields']));_0x282f6c['attributes']=_0x282f6c[_0x6bcc('0x4c')]['length']?_0x282f6c[_0x6bcc('0x4c')]:_0x2c6db4[_0x6bcc('0x46')];if(!_0x192f02['query'][_0x6bcc('0x4f')]('nolimit')){_0x282f6c[_0x6bcc('0x30')]=qs['limit'](_0x192f02[_0x6bcc('0x48')][_0x6bcc('0x30')]);_0x282f6c[_0x6bcc('0x2f')]=qs[_0x6bcc('0x2f')](_0x192f02[_0x6bcc('0x48')]['offset']);}_0x282f6c[_0x6bcc('0x50')]=qs[_0x6bcc('0x51')](_0x192f02['query'][_0x6bcc('0x51')]);_0x282f6c[_0x6bcc('0x52')]=qs[_0x6bcc('0x4a')](_[_0x6bcc('0x53')](_0x192f02[_0x6bcc('0x48')],_0x2c6db4[_0x6bcc('0x4a')]));_0x282f6c[_0x6bcc('0x52')][_0x6bcc('0x69')]=_0x4580ca['id'];if(_0x192f02[_0x6bcc('0x48')][_0x6bcc('0x54')]){_0x282f6c[_0x6bcc('0x52')]=_[_0x6bcc('0x55')](_0x282f6c['where'],{'$or':_[_0x6bcc('0x47')](_0x282f6c['attributes'],function(_0x8049e8){var _0x26fa10={};_0x26fa10[_0x8049e8]={'$like':'%'+_0x192f02[_0x6bcc('0x48')][_0x6bcc('0x54')]+'%'};return _0x26fa10;})});}_0x282f6c=_['merge']({},_0x282f6c,_0x192f02[_0x6bcc('0x57')]);return db[_0x6bcc('0x6c')][_0x6bcc('0x32')]({'where':_0x282f6c[_0x6bcc('0x52')]})[_0x6bcc('0x22')](function(_0x147867){_0x32cb88[_0x6bcc('0x32')]=_0x147867;if(_0x192f02[_0x6bcc('0x48')][_0x6bcc('0x58')]){_0x282f6c['include']=[{'all':!![]}];}return db[_0x6bcc('0x6c')]['findAll'](_0x282f6c);})[_0x6bcc('0x22')](function(_0xac9098){_0x32cb88[_0x6bcc('0x6d')]=_0xac9098;return _0x32cb88;});}})[_0x6bcc('0x22')](respondWithFilteredResult(_0x32def8,_0x282f6c))[_0x6bcc('0x2c')](handleError(_0x32def8,null));};exports[_0x6bcc('0x6e')]=function(_0x65752e,_0x293c41,_0x3f8fa5){return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x65752e['params']['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x293c41,null))[_0x6bcc('0x22')](function(_0x5bb9a9){if(_0x5bb9a9){return _0x5bb9a9[_0x6bcc('0x6e')](_0x65752e[_0x6bcc('0x48')][_0x6bcc('0x6f')]);}})[_0x6bcc('0x22')](respondWithStatusCode(_0x293c41,null))[_0x6bcc('0x2c')](handleError(_0x293c41,null));};exports[_0x6bcc('0x70')]=function(_0x50baf5,_0x2d73fd,_0x348d19){if(_0x50baf5[_0x6bcc('0x5e')]['id']){delete _0x50baf5[_0x6bcc('0x5e')]['id'];}return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x50baf5['params']['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x2d73fd,null))[_0x6bcc('0x22')](function(_0x30bd56){if(_0x30bd56){_0x50baf5[_0x6bcc('0x5e')][_0x6bcc('0x69')]=_0x30bd56['id'];return db['CannedAnswer']['create'](_0x50baf5[_0x6bcc('0x5e')]);}})[_0x6bcc('0x22')](respondWithResult(_0x2d73fd,null))[_0x6bcc('0x2c')](handleError(_0x2d73fd,null));};exports[_0x6bcc('0x71')]=function(_0x19c609,_0x2ee659,_0x5c1937){var _0x5252ca={'raw':![],'where':{}};var _0x4c1f8f={};var _0x4aa14a={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x19c609['params']['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x2ee659,null))[_0x6bcc('0x22')](function(_0x170008){if(_0x170008){_0x4c1f8f[_0x6bcc('0x46')]=_[_0x6bcc('0x49')](db[_0x6bcc('0x72')][_0x6bcc('0x44')]);_0x4c1f8f[_0x6bcc('0x48')]=_[_0x6bcc('0x49')](_0x19c609[_0x6bcc('0x48')]);_0x4c1f8f[_0x6bcc('0x4a')]=_[_0x6bcc('0x4b')](_0x4c1f8f[_0x6bcc('0x46')],_0x4c1f8f[_0x6bcc('0x48')]);_0x5252ca[_0x6bcc('0x4c')]=_[_0x6bcc('0x4b')](_0x4c1f8f['model'],qs['fields'](_0x19c609[_0x6bcc('0x48')][_0x6bcc('0x4d')]));_0x5252ca[_0x6bcc('0x4c')]=_0x5252ca[_0x6bcc('0x4c')]['length']?_0x5252ca[_0x6bcc('0x4c')]:_0x4c1f8f[_0x6bcc('0x46')];if(!_0x19c609['query']['hasOwnProperty'](_0x6bcc('0x73'))){_0x5252ca[_0x6bcc('0x30')]=qs[_0x6bcc('0x30')](_0x19c609[_0x6bcc('0x48')][_0x6bcc('0x30')]);_0x5252ca[_0x6bcc('0x2f')]=qs[_0x6bcc('0x2f')](_0x19c609[_0x6bcc('0x48')]['offset']);}_0x5252ca[_0x6bcc('0x50')]=qs['sort'](_0x19c609['query'][_0x6bcc('0x51')]);_0x5252ca[_0x6bcc('0x52')]=qs[_0x6bcc('0x4a')](_[_0x6bcc('0x53')](_0x19c609[_0x6bcc('0x48')],_0x4c1f8f[_0x6bcc('0x4a')]));_0x5252ca['where'][_0x6bcc('0x69')]=_0x170008['id'];if(_0x19c609[_0x6bcc('0x48')][_0x6bcc('0x54')]){_0x5252ca[_0x6bcc('0x52')]=_[_0x6bcc('0x55')](_0x5252ca[_0x6bcc('0x52')],{'$or':_['map'](_0x5252ca['attributes'],function(_0x584b48){var _0x34b399={};_0x34b399[_0x584b48]={'$like':'%'+_0x19c609[_0x6bcc('0x48')][_0x6bcc('0x54')]+'%'};return _0x34b399;})});}_0x5252ca=_[_0x6bcc('0x55')]({},_0x5252ca,_0x19c609[_0x6bcc('0x57')]);return db[_0x6bcc('0x72')][_0x6bcc('0x32')]({'where':_0x5252ca[_0x6bcc('0x52')]})[_0x6bcc('0x22')](function(_0x189b65){_0x4aa14a[_0x6bcc('0x32')]=_0x189b65;if(_0x19c609[_0x6bcc('0x48')][_0x6bcc('0x58')]){_0x5252ca[_0x6bcc('0x59')]=[{'all':!![]}];}return db[_0x6bcc('0x72')][_0x6bcc('0x5a')](_0x5252ca);})[_0x6bcc('0x22')](function(_0x28f62a){_0x4aa14a[_0x6bcc('0x6d')]=_0x28f62a;return _0x4aa14a;});}})['then'](respondWithFilteredResult(_0x2ee659,_0x5252ca))[_0x6bcc('0x2c')](handleError(_0x2ee659,null));};exports[_0x6bcc('0x74')]=function(_0x34746b,_0x8984c7,_0x1d31b1){return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x34746b[_0x6bcc('0x66')]['id']}})['then'](handleEntityNotFound(_0x8984c7,null))['then'](function(_0x36b2ec){if(_0x36b2ec){return _0x36b2ec[_0x6bcc('0x74')](_0x34746b[_0x6bcc('0x48')][_0x6bcc('0x6f')]);}})[_0x6bcc('0x22')](respondWithStatusCode(_0x8984c7,null))[_0x6bcc('0x2c')](handleError(_0x8984c7,null));};exports[_0x6bcc('0x75')]=function(_0x30209a,_0x3a6007,_0x3d94dc){var _0x25c57f={'channel':_0x6bcc('0x76')};var _0x738865=[];var _0x33e2e8=[];var _0x2446c1={};return db['SmsAccount']['find']({'where':{'id':_0x30209a[_0x6bcc('0x66')]['id']},'include':[{'model':db[_0x6bcc('0x77')],'as':_0x6bcc('0x78')}]})[_0x6bcc('0x22')](handleEntityNotFound(_0x3a6007,null))[_0x6bcc('0x22')](function(_0x5def45){_0x25c57f[_0x6bcc('0x79')]=_0x5def45;_0x25c57f[_0x6bcc('0x7a')]=_['orderBy'](_0x5def45[_0x6bcc('0x78')],[_0x6bcc('0x7b')],['asc']);if(_0x25c57f[_0x6bcc('0x79')][_0x6bcc('0x78')]){delete _0x25c57f['account'][_0x6bcc('0x78')];}return db[_0x6bcc('0x7c')][_0x6bcc('0x67')]();})['then'](function(_0x3bf184){if(!_0x3bf184){throw new db['Sequelize'][(_0x6bcc('0x7d'))]('no\x20available\x20attributes');}_0x738865=_['difference'](_['keys'](_0x3bf184),[_0x6bcc('0x7e'),_0x6bcc('0x7f')]);_0x33e2e8=_[_0x6bcc('0x80')](_[_0x6bcc('0x49')](_0x3bf184),[_0x6bcc('0x7e'),_0x6bcc('0x7f'),'CompanyId',_0x6bcc('0x81')]);_0x25c57f['body']={'mapKey':_0x6bcc('0x82')};if(_0x25c57f[_0x6bcc('0x79')][_0x6bcc('0x56')]){switch(_0x25c57f[_0x6bcc('0x79')][_0x6bcc('0x56')]){case _0x6bcc('0x83'):_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x85')];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')]['Body'];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x86')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x87')];break;case _0x6bcc('0x88'):_0x25c57f['body'][_0x6bcc('0x84')]='+'+_0x30209a['body'][_0x6bcc('0x89')];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x8a')];break;case'connectel':_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')]=_0x30209a[_0x6bcc('0x5e')]['from'];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')]['message'];break;case'clicksend':_0x25c57f[_0x6bcc('0x5e')]['from']=_0x30209a['body'][_0x6bcc('0x84')];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x5e')];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x86')]=_0x30209a[_0x6bcc('0x5e')]['message_id'];break;case'plivo':_0x25c57f['body'][_0x6bcc('0x84')]=_0x30209a['body'][_0x6bcc('0x85')];_0x25c57f[_0x6bcc('0x5e')]['body']=_0x30209a[_0x6bcc('0x5e')]['Text'];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x86')]=_0x30209a['body'][_0x6bcc('0x8b')];break;case _0x6bcc('0x8c'):_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')]='+'+_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x8d')][0x0]['from'];_0x25c57f['body'][_0x6bcc('0x5e')]=_0x30209a['body'][_0x6bcc('0x8d')][0x0][_0x6bcc('0x8a')];_0x25c57f['body']['messageId']=_0x30209a[_0x6bcc('0x5e')]['results'][0x0]['messageId'];break;case'csc':_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x8e')];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')]['segmentedMessage']['message'];break;case _0x6bcc('0x8f'):_0x25c57f[_0x6bcc('0x5e')]['from']=_0x30209a[_0x6bcc('0x5e')]['fromNumber'];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')]['text'];_0x25c57f['body'][_0x6bcc('0x86')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x90')];break;case _0x6bcc('0x91'):_0x25c57f['body'][_0x6bcc('0x86')]=_0x30209a[_0x6bcc('0x5e')][0x0][_0x6bcc('0x2a')]['id'];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')]=_0x30209a[_0x6bcc('0x5e')][0x0][_0x6bcc('0x2a')]['from'];_0x25c57f['body'][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')][0x0]['message']['text'];break;case _0x6bcc('0x92'):_0x25c57f['body']['from']=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x84')];_0x25c57f['body'][_0x6bcc('0x5e')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x2a')];_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x86')]=_0x30209a[_0x6bcc('0x5e')][_0x6bcc('0x93')];break;}}if(_0x25c57f['body']['id']){delete _0x25c57f['body']['id'];}if(_[_0x6bcc('0x94')](_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')])){throw new db[(_0x6bcc('0x95'))][(_0x6bcc('0x7d'))](_0x6bcc('0x96'));}if(_[_0x6bcc('0x94')](_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x5e')])||_0x25c57f[_0x6bcc('0x5e')]['body']===''){throw new db[(_0x6bcc('0x95'))]['ValidationError'](_0x6bcc('0x97'));}if(_['isNil'](_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x98')])){throw new db[(_0x6bcc('0x95'))][(_0x6bcc('0x7d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x33e2e8);}if(!_[_0x6bcc('0x99')](_0x33e2e8,_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x98')])){throw new db[(_0x6bcc('0x95'))][(_0x6bcc('0x7d'))](_0x6bcc('0x9a')+_0x33e2e8);}_0x2446c1[_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x98')]]=_0x25c57f[_0x6bcc('0x5e')]['from'];return db[_0x6bcc('0x9b')]['find']({'where':{'id':_0x25c57f['account'][_0x6bcc('0x81')]},'include':[{'model':db[_0x6bcc('0x7c')],'as':_0x6bcc('0x9c'),'where':_0x2446c1,'limit':0x1,'order':[[_0x6bcc('0x7f'),_0x6bcc('0x9d')]]}]});})['then'](handleEntityNotFound(_0x3a6007,null))[_0x6bcc('0x22')](function(_0x3d8fb7){if(_0x3d8fb7){_0x25c57f[_0x6bcc('0x9e')]=_[_0x6bcc('0x9f')](_0x3d8fb7,[_0x6bcc('0x9c')]);if(_0x3d8fb7['Contacts'][_0x6bcc('0x4e')]){return _0x3d8fb7[_0x6bcc('0x9c')][0x0];}var _0x1bc914=_[_0x6bcc('0xa0')](_0x25c57f[_0x6bcc('0x5e')],{'firstName':_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')],'ListId':_0x3d8fb7['id']});_0x1bc914[_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x98')]]=_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')];return db['CmContact'][_0x6bcc('0x5d')](_0x1bc914,{'fields':_0x738865,'raw':!![]});}})['then'](handleEntityNotFound(_0x3a6007,null))[_0x6bcc('0x22')](function(_0x53e625){if(_0x53e625){_0x25c57f[_0x6bcc('0xa1')]=_0x53e625;var _0x26b2eb={'ContactId':_0x53e625['id'],'phone':_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x84')],'SmsAccountId':_0x30209a['params']['id']};var _0x41ab3d={'ContactId':_0x53e625['id'],'SmsAccountId':_0x30209a[_0x6bcc('0x66')]['id'],'closed':![]};return db['SmsInteraction'][_0x6bcc('0x5c')]({'where':_0x41ab3d})[_0x6bcc('0x22')](function(_0xdee287){if(_0xdee287){return[_0xdee287,![]];}return db['SmsInteraction'][_0x6bcc('0x5d')](_0x26b2eb)['then'](function(_0x59071a){return[_0x59071a,!![]];});});}})['spread'](function(_0x531ada,_0x3db38e){_0x25c57f[_0x6bcc('0xa2')]=_0x531ada['get']({'plain':!![]});_0x25c57f['interaction'][_0x6bcc('0xa3')]=![];if(_0x3db38e){if(_0x25c57f['account']['autoclose']){_0x25c57f[_0x6bcc('0x7a')]['push']({'id':0x0,'priority':_0x25c57f[_0x6bcc('0x7a')]['length']+0x1,'app':_0x6bcc('0xa4'),'appdata':'unmanaged','interval':_0x6bcc('0xa5')});}_0x25c57f['interaction'][_0x6bcc('0xa3')]=!![];}return db[_0x6bcc('0xa6')]['create']({'phone':_0x25c57f['body']['from'],'messageId':_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0x86')],'body':_0x25c57f['body']['body'],'SmsAccountId':_0x30209a[_0x6bcc('0x66')]['id'],'SmsInteractionId':_0x531ada['id'],'direction':'in','ContactId':_0x531ada[_0x6bcc('0xa7')],'AttachmentId':_0x25c57f[_0x6bcc('0x5e')][_0x6bcc('0xa8')]});})[_0x6bcc('0x22')](function(_0x28dc0e){_0x25c57f['message']=_0x28dc0e;if(_0x25c57f[_0x6bcc('0xa2')]['UserId']){return db[_0x6bcc('0xa9')][_0x6bcc('0x5c')]({'attributes':['id',_0x6bcc('0x3e')],'where':{'id':_0x25c57f[_0x6bcc('0xa2')][_0x6bcc('0xaa')]}})[_0x6bcc('0x22')](function(_0xe04a77){if(_0xe04a77){_0x25c57f[_0x6bcc('0x7a')][_0x6bcc('0xab')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xe04a77[_0x6bcc('0x3e')]+','+(_0x25c57f[_0x6bcc('0x79')][_0x6bcc('0xac')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x6bcc('0xad'),_0x6bcc('0xae'),_0x25c57f);});}return respondWithRpcPromise(_0x6bcc('0xad'),_0x6bcc('0xae'),_0x25c57f);})[_0x6bcc('0x22')](function(_0x5d9205){if(_0x5d9205){var _0x5e6ecd=0xc8;var _0x2960a9=_0x6bcc('0xaf');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2960a9,_0x5e6ecd,_0x6bcc('0xb0'));logger[_0x6bcc('0x25')](_0x6bcc('0xb1'),_0x2960a9,_0x5e6ecd,_0x6bcc('0xb0'),JSON['stringify'](_0x5d9205));if(_0x25c57f[_0x6bcc('0x79')][_0x6bcc('0x56')]==='twilio'){return _0x3a6007[_0x6bcc('0x2e')](_0x5e6ecd)[_0x6bcc('0x33')]('Content-Type','text/xml')['send'](_0x6bcc('0xb2'));}else{return _0x3a6007[_0x6bcc('0x2e')](_0x5e6ecd)[_0x6bcc('0x35')](_0x5d9205);}}})[_0x6bcc('0x2c')](handleError(_0x3a6007,null));};exports[_0x6bcc('0xb3')]=function(_0x5e1472,_0x1d4bc1){var _0x58ec0c=_0x5e1472[_0x6bcc('0x66')]['id'];var _0x2fd226=_0x5e1472[_0x6bcc('0x5e')];var _0x202ef1=0xc8;var _0x379fe2=null;return db[_0x6bcc('0xb4')]['transaction']({'isolationLevel':db[_0x6bcc('0xb4')][_0x6bcc('0xb5')]['ISOLATION_LEVELS'][_0x6bcc('0xb6')]},function(_0x59885b){return db[_0x6bcc('0x43')]['findOne']({'where':{'id':_0x58ec0c},'transaction':_0x59885b})[_0x6bcc('0x22')](function(_0x261cce){if(_0x261cce){return db[_0x6bcc('0x77')][_0x6bcc('0x3b')]({'where':{'SmsAccountId':_0x58ec0c},'transaction':_0x59885b})['then'](function(){var _0x8d907a=_[_0x6bcc('0x47')](_0x2fd226,function(_0x5b5aa8){_0x5b5aa8['SmsAccountId']=_0x58ec0c;return _0x5b5aa8;});return db[_0x6bcc('0x77')][_0x6bcc('0xb7')](_0x8d907a,{'transaction':_0x59885b});});}else{_0x202ef1=0x194;_0x379fe2=[];}});})[_0x6bcc('0x22')](function(){if(_0x202ef1!==0x194){return db[_0x6bcc('0x77')][_0x6bcc('0xb8')]({'where':{'SmsAccountId':_0x58ec0c},'order':_0x6bcc('0x7b')})['then'](function(_0x434921){_0x379fe2=_0x434921;});}})[_0x6bcc('0x2c')](function(_0x59f782){_0x202ef1=0x1f4;logger['error'](_0x59f782['stack']);if(_0x59f782[_0x6bcc('0x3e')]){delete _0x59f782[_0x6bcc('0x3e')];}_0x379fe2=_0x59f782;})[_0x6bcc('0xb9')](function(){if(_0x379fe2===null){_0x1d4bc1['sendStatus'](_0x202ef1);}else{if(_0x202ef1===0x1f4){_0x1d4bc1[_0x6bcc('0x2e')](_0x202ef1)[_0x6bcc('0x3f')](_0x379fe2);}else{_0x1d4bc1[_0x6bcc('0x2e')](_0x202ef1)[_0x6bcc('0x35')](_0x379fe2);}}});};exports[_0x6bcc('0xba')]=function(_0x18431b,_0x148359,_0x5d1073){var _0xfe9aa0={};var _0x2e60b1={};var _0x2db096;var _0x58c42a;return db['SmsAccount']['findOne']({'where':{'id':_0x18431b[_0x6bcc('0x66')]['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x148359,null))[_0x6bcc('0x22')](function(_0x239b28){if(_0x239b28){_0x2db096=_0x239b28;_0x2e60b1[_0x6bcc('0x46')]=_['keys'](db[_0x6bcc('0x77')]['rawAttributes']);_0x2e60b1[_0x6bcc('0x48')]=_[_0x6bcc('0x49')](_0x18431b[_0x6bcc('0x48')]);_0x2e60b1[_0x6bcc('0x4a')]=_['intersection'](_0x2e60b1[_0x6bcc('0x46')],_0x2e60b1[_0x6bcc('0x48')]);_0xfe9aa0['attributes']=_[_0x6bcc('0x4b')](_0x2e60b1[_0x6bcc('0x46')],qs[_0x6bcc('0x4d')](_0x18431b['query'][_0x6bcc('0x4d')]));_0xfe9aa0[_0x6bcc('0x4c')]=_0xfe9aa0[_0x6bcc('0x4c')][_0x6bcc('0x4e')]?_0xfe9aa0[_0x6bcc('0x4c')]:_0x2e60b1[_0x6bcc('0x46')];_0xfe9aa0[_0x6bcc('0x50')]=qs[_0x6bcc('0x51')](_0x18431b['query'][_0x6bcc('0x51')]);_0xfe9aa0['where']=qs[_0x6bcc('0x4a')](_['pick'](_0x18431b['query'],_0x2e60b1[_0x6bcc('0x4a')]));if(_0x18431b['query'][_0x6bcc('0x54')]){_0xfe9aa0[_0x6bcc('0x52')]=_[_0x6bcc('0x55')](_0xfe9aa0[_0x6bcc('0x52')],{'$or':_[_0x6bcc('0x47')](_0xfe9aa0[_0x6bcc('0x4c')],function(_0x228b75){var _0xc0cc49={};_0xc0cc49[_0x228b75]={'$like':'%'+_0x18431b[_0x6bcc('0x48')][_0x6bcc('0x54')]+'%'};return _0xc0cc49;})});}_0xfe9aa0=_[_0x6bcc('0x55')]({},_0xfe9aa0,_0x18431b['options']);return _0x2db096[_0x6bcc('0xba')](_0xfe9aa0);}})['then'](function(_0x29687a){if(_0x29687a){_0x58c42a=_0x29687a['length'];if(!_0x18431b['query'][_0x6bcc('0x4f')](_0x6bcc('0x73'))){_0xfe9aa0[_0x6bcc('0x30')]=qs['limit'](_0x18431b[_0x6bcc('0x48')][_0x6bcc('0x30')]);_0xfe9aa0[_0x6bcc('0x2f')]=qs[_0x6bcc('0x2f')](_0x18431b[_0x6bcc('0x48')]['offset']);}return _0x2db096['getApplications'](_0xfe9aa0);}})[_0x6bcc('0x22')](function(_0xe78fc2){if(_0xe78fc2){return _0xe78fc2?{'count':_0x58c42a,'rows':_0xe78fc2}:null;}})['then'](respondWithResult(_0x148359,null))[_0x6bcc('0x2c')](handleError(_0x148359,null));};exports[_0x6bcc('0xbb')]=function(_0x533cc9,_0x59ba0a,_0x587d85){var _0x4a8c2a={'raw':![],'where':{}};var _0x253344={};var _0x55f229={'count':0x0,'rows':[]};return db[_0x6bcc('0x43')][_0x6bcc('0x6b')]({'where':{'id':_0x533cc9[_0x6bcc('0x66')]['id']}})['then'](handleEntityNotFound(_0x59ba0a,null))[_0x6bcc('0x22')](function(_0x444349){if(_0x444349){_0x253344['model']=_['keys'](db[_0x6bcc('0xbc')][_0x6bcc('0x44')]);_0x253344[_0x6bcc('0x48')]=_[_0x6bcc('0x49')](_0x533cc9[_0x6bcc('0x48')]);_0x253344[_0x6bcc('0x4a')]=_[_0x6bcc('0x4b')](_0x253344[_0x6bcc('0x46')],_0x253344[_0x6bcc('0x48')]);_0x4a8c2a[_0x6bcc('0x4c')]=_[_0x6bcc('0x4b')](_0x253344[_0x6bcc('0x46')],qs[_0x6bcc('0x4d')](_0x533cc9['query'][_0x6bcc('0x4d')]));_0x4a8c2a[_0x6bcc('0x4c')]=_0x4a8c2a[_0x6bcc('0x4c')][_0x6bcc('0x4e')]?_0x4a8c2a[_0x6bcc('0x4c')]:_0x253344[_0x6bcc('0x46')];if(!_0x533cc9[_0x6bcc('0x48')][_0x6bcc('0x4f')](_0x6bcc('0x73'))){_0x4a8c2a[_0x6bcc('0x30')]=qs['limit'](_0x533cc9[_0x6bcc('0x48')][_0x6bcc('0x30')]);_0x4a8c2a[_0x6bcc('0x2f')]=qs[_0x6bcc('0x2f')](_0x533cc9[_0x6bcc('0x48')]['offset']);}_0x4a8c2a[_0x6bcc('0x50')]=qs['sort'](_0x533cc9[_0x6bcc('0x48')][_0x6bcc('0x51')]);_0x4a8c2a[_0x6bcc('0x52')]=qs[_0x6bcc('0x4a')](_[_0x6bcc('0x53')](_0x533cc9['query'],_0x253344[_0x6bcc('0x4a')]));_0x4a8c2a[_0x6bcc('0x52')][_0x6bcc('0x69')]=_0x444349['id'];if(_0x533cc9[_0x6bcc('0x48')][_0x6bcc('0x54')]){_0x4a8c2a[_0x6bcc('0x52')]=_[_0x6bcc('0x55')](_0x4a8c2a[_0x6bcc('0x52')],{'$or':_[_0x6bcc('0x47')](_0x4a8c2a[_0x6bcc('0x4c')],function(_0x2e914d){var _0x365fe7={};_0x365fe7[_0x2e914d]={'$like':'%'+_0x533cc9[_0x6bcc('0x48')][_0x6bcc('0x54')]+'%'};return _0x365fe7;})});}_0x4a8c2a=_[_0x6bcc('0x55')]({},_0x4a8c2a,_0x533cc9[_0x6bcc('0x57')]);return db[_0x6bcc('0xbc')][_0x6bcc('0x32')]({'where':_0x4a8c2a[_0x6bcc('0x52')]})['then'](function(_0x25809e){_0x55f229[_0x6bcc('0x32')]=_0x25809e;if(_0x533cc9['query'][_0x6bcc('0x58')]){_0x4a8c2a[_0x6bcc('0x59')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x6bcc('0x3e'),_0x6bcc('0xbd'),'internal'],'required':![]},{'model':db[_0x6bcc('0xbe')],'as':_0x6bcc('0xbf'),'attributes':['id','name',_0x6bcc('0xc0')],'where':_0x533cc9[_0x6bcc('0x48')][_0x6bcc('0xc1')]?{'id':_0x533cc9[_0x6bcc('0x48')]['tag']}:undefined,'required':_0x533cc9[_0x6bcc('0x48')][_0x6bcc('0xc1')]?!![]:![]}];}return db['SmsInteraction'][_0x6bcc('0x5a')](_0x4a8c2a);})[_0x6bcc('0x22')](function(_0x4a8dd2){_0x55f229[_0x6bcc('0x6d')]=_0x4a8dd2;return _0x55f229;});}})[_0x6bcc('0x22')](respondWithFilteredResult(_0x59ba0a,_0x4a8c2a))['catch'](handleError(_0x59ba0a,null));};exports[_0x6bcc('0x3f')]=function(_0x4de6db,_0x2f8d85,_0x54e3b2){var _0x4c428e,_0x1409d4,_0x145289;if(_['isNil'](_0x4de6db['body'][_0x6bcc('0x5e')])||_0x4de6db[_0x6bcc('0x5e')][_0x6bcc('0x5e')]===''){throw new db[(_0x6bcc('0x95'))][(_0x6bcc('0x7d'))](_0x6bcc('0x97'));}if(_[_0x6bcc('0x94')](_0x4de6db[_0x6bcc('0x5e')]['to'])){throw new db[(_0x6bcc('0x95'))][(_0x6bcc('0x7d'))](_0x6bcc('0xc2'));}_0x4c428e=_0x4de6db[_0x6bcc('0x5e')]['to'];return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x4de6db[_0x6bcc('0x66')]['id']},'include':[{'model':db['CmList'],'as':_0x6bcc('0xc3'),'include':[{'model':db[_0x6bcc('0x7c')],'as':_0x6bcc('0x9c'),'where':{'mobile':_0x4c428e},'limit':0x1,'order':[[_0x6bcc('0x7f'),'DESC']]}]}]})[_0x6bcc('0x22')](handleEntityNotFound(_0x2f8d85,null))[_0x6bcc('0x22')](function(_0x1f8a24){if(_0x1f8a24&&_0x1f8a24[_0x6bcc('0xc3')]){_0x1409d4=_0x1f8a24['get']({'plain':!![]});if(_0x1409d4[_0x6bcc('0xc3')]&&_0x1409d4[_0x6bcc('0xc3')][_0x6bcc('0x9c')][_0x6bcc('0x4e')]){return _0x1409d4['List'][_0x6bcc('0x9c')][0x0];}return db[_0x6bcc('0x7c')][_0x6bcc('0x5d')](_[_0x6bcc('0xa0')](_0x4de6db[_0x6bcc('0x5e')],{'firstName':_0x4c428e,'mobile':_0x4c428e,'phone':_0x4c428e,'ListId':_0x1409d4[_0x6bcc('0x81')]}));}})[_0x6bcc('0x22')](handleEntityNotFound(_0x2f8d85,null))[_0x6bcc('0x22')](function(_0xae40e2){if(_0xae40e2){_0x145289=_0xae40e2;return db['SmsInteraction']['find']({'where':{'ContactId':_0x145289['id'],'closed':![],'SmsAccountId':_0x1409d4['id']}})['then'](function(_0x1b647a){if(_0x1b647a){return[_0x1b647a,![]];}return db[_0x6bcc('0xbc')]['create']({'UserId':_0x4de6db[_0x6bcc('0x5f')]['id'],'ContactId':_0x145289['id'],'SmsAccountId':_0x1409d4['id'],'phone':_0x4c428e,'firstMsgDirection':'out','Messages':[_[_0x6bcc('0x55')](_0x4de6db[_0x6bcc('0x5e')],{'read':![],'body':_0x4de6db[_0x6bcc('0x5e')]['body'],'phone':_0x4c428e,'SmsAccountId':_0x1409d4['id'],'UserId':_0x4de6db[_0x6bcc('0x5f')]['id'],'ContactId':_0x145289['id']})]},{'include':[{'model':db[_0x6bcc('0xa6')],'as':'Messages'}]})[_0x6bcc('0x22')](function(_0x6293bb){return[_0x6293bb,!![]];});});}})['spread'](function(_0x51482a,_0x22abc3){if(_0x22abc3){return _0x51482a;}return db[_0x6bcc('0xa6')][_0x6bcc('0x5d')](_[_0x6bcc('0x55')](_0x4de6db[_0x6bcc('0x5e')],{'read':![],'body':_0x4de6db[_0x6bcc('0x5e')][_0x6bcc('0x5e')],'phone':_0x4c428e,'SmsAccountId':_0x1409d4['id'],'SmsInteractionId':_0x51482a['id'],'UserId':_0x4de6db[_0x6bcc('0x5f')]['id'],'ContactId':_0x145289['id']}))[_0x6bcc('0x22')](function(_0x368ab9){_0x51482a[_0x6bcc('0xc4')][_0x6bcc('0xc5')]=[];_0x51482a[_0x6bcc('0xc4')][_0x6bcc('0xc5')][_0x6bcc('0xc6')](_0x368ab9[_0x6bcc('0xc4')]);return _0x51482a;});})[_0x6bcc('0x22')](respondWithResult(_0x2f8d85,null))['catch'](handleError(_0x2f8d85,null));};exports['status']=function(_0x5a12e8,_0xcf47df,_0xe3de8){if(_0x5a12e8[_0x6bcc('0x5e')]['id']){delete _0x5a12e8[_0x6bcc('0x5e')]['id'];}var _0x2dd022,_0x58e4dd,_0x562415;return db['SmsAccount'][_0x6bcc('0x5c')]({'where':{'id':_0x5a12e8[_0x6bcc('0x66')]['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0xcf47df,null))['then'](function(_0x723ca9){if(_0x723ca9){_0x562415=_0x723ca9;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x6bcc('0xc7'),_0x723ca9['type'],util[_0x6bcc('0xc8')](_0x5a12e8[_0x6bcc('0x5e')],{'showHidden':![],'depth':null}));switch(_0x723ca9[_0x6bcc('0x56')]){case _0x6bcc('0x88'):if(_0x5a12e8['body']['skebby_dispatch_id']&&_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0x2e')]){_0x58e4dd=_0x5a12e8[_0x6bcc('0x5e')]['status'];return db[_0x6bcc('0xa6')][_0x6bcc('0x5c')]({'where':{'messageId':_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xc9')]}});}break;case _0x6bcc('0xca'):if(_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xcb')]&&_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xcc')]){_0x58e4dd=_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xcc')];return db[_0x6bcc('0xa6')][_0x6bcc('0x5c')]({'where':{'messageId':_0x5a12e8['body'][_0x6bcc('0xcb')]}});}break;case _0x6bcc('0xcd'):if(_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xce')]&&_0x5a12e8[_0x6bcc('0x5e')]['status_code']){_0x58e4dd=_0x5a12e8['body'][_0x6bcc('0xcf')];return db['SmsMessage'][_0x6bcc('0x5c')]({'where':{'messageId':_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xce')]}});}break;case'infobip':var _0x3ec983=_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0x8d')][0x0];if(_0x3ec983[_0x6bcc('0x86')]&&_0x3ec983[_0x6bcc('0x2e')][_0x6bcc('0xd0')]==='DELIVERED'){_0x58e4dd=_0x3ec983[_0x6bcc('0x2e')]['groupName'];return db[_0x6bcc('0xa6')][_0x6bcc('0x5c')]({'where':{'messageId':_0x3ec983['messageId']}});}break;case'clickatell':if(_0x5a12e8[_0x6bcc('0x5e')]['messageId']&&_0x5a12e8['body'][_0x6bcc('0x2e')]){_0x58e4dd=_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0x2e')];return db[_0x6bcc('0xa6')][_0x6bcc('0x5c')]({'where':{'messageId':_0x5a12e8['body']['messageId']}});}break;case _0x6bcc('0x91'):if(_0x5a12e8[_0x6bcc('0x5e')][0x0][_0x6bcc('0x2a')]['id']){_0x58e4dd=_0x5a12e8[_0x6bcc('0x5e')][0x0][_0x6bcc('0x56')];return db[_0x6bcc('0xa6')][_0x6bcc('0x5c')]({'where':{'messageId':_0x5a12e8[_0x6bcc('0x5e')][0x0][_0x6bcc('0x2a')]['id']}});}break;case _0x6bcc('0x92'):if(_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xd1')]&&_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0x2e')]){_0x58e4dd=_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0x2e')];return db['SmsMessage'][_0x6bcc('0x5c')]({'where':{'messageId':_0x5a12e8[_0x6bcc('0x5e')]['redif']}});}break;}}})[_0x6bcc('0x22')](handleEntityNotFound(_0xcf47df,null))[_0x6bcc('0x22')](function(_0x38cf64){if(_0x38cf64){_0x2dd022=_0x38cf64;switch(_0x562415['type']){case _0x6bcc('0x88'):if(_0x58e4dd===_0x6bcc('0xd2')){return _0x2dd022[_0x6bcc('0xd3')]({'read':!![]});}else{logger[_0x6bcc('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6bcc('0x2e'),_0x6bcc('0x88'),util['inspect'](_0x5a12e8['body'],{'showHidden':![],'depth':null}));}break;case _0x6bcc('0xca'):if(_0x58e4dd==='1'){return _0x2dd022[_0x6bcc('0xd3')]({'read':!![]});}else{logger['error'](_0x6bcc('0x26'),_0x6bcc('0x2e'),_0x6bcc('0x88'),util['inspect'](_0x5a12e8['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5a12e8[_0x6bcc('0x5e')][_0x6bcc('0xd4')]&&_0x58e4dd>=0xc8&&_0x58e4dd<=0xce){return _0x2dd022[_0x6bcc('0xd3')]({'read':!![]});}else{logger[_0x6bcc('0x28')](_0x6bcc('0x26'),_0x6bcc('0x2e'),_0x6bcc('0xcd'),util[_0x6bcc('0xc8')](_0x5a12e8[_0x6bcc('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x6bcc('0x8c'):var _0x4835d6=_0x5a12e8['body'][_0x6bcc('0x8d')][0x0];if(_0x4835d6[_0x6bcc('0x2e')][_0x6bcc('0xd0')]===_0x6bcc('0xd2')){return _0x2dd022[_0x6bcc('0xd3')]({'read':!![]});}else{logger[_0x6bcc('0x28')](_0x6bcc('0x26'),'status',_0x6bcc('0x8c'),util[_0x6bcc('0xc8')](_0x5a12e8[_0x6bcc('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x6bcc('0x8f'):if(_0x58e4dd==_0x6bcc('0xd5')||_0x58e4dd=='RECEIVED_BY_RECIPIENT'){return _0x2dd022[_0x6bcc('0xd3')]({'read':!![]});}else{logger[_0x6bcc('0x28')](_0x6bcc('0x26'),_0x6bcc('0x2e'),_0x6bcc('0x8f'),util[_0x6bcc('0xc8')](_0x5a12e8['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x58e4dd=='message-delivered'){return _0x2dd022[_0x6bcc('0xd3')]({'read':!![]});}else{logger[_0x6bcc('0x28')](_0x6bcc('0x26'),'status',_0x6bcc('0x91'),util['inspect'](_0x5a12e8[_0x6bcc('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x6bcc('0x92'):if(_0x58e4dd===_0x6bcc('0xd6')||_0x58e4dd==='ACCEPTD'){return _0x2dd022[_0x6bcc('0xd3')]({'read':!![]});}else{logger[_0x6bcc('0x28')](_0x6bcc('0x26'),'status',_0x6bcc('0x92'),util[_0x6bcc('0xc8')](_0x5a12e8[_0x6bcc('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x2dd022;}})[_0x6bcc('0x22')](respondWithResult(_0xcf47df,null))['catch'](handleError(_0xcf47df,null));};exports['statusGet']=function(_0x1a6722,_0x37e9cb,_0x41e215){var _0x58f0c7,_0x5c3356,_0xe83707;return db[_0x6bcc('0x43')]['find']({'where':{'id':_0x1a6722['params']['id']}})['then'](handleEntityNotFound(_0x37e9cb,null))['then'](function(_0x5dd4b6){if(_0x5dd4b6){_0xe83707=_0x5dd4b6;logger[_0x6bcc('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6bcc('0x2e'),_0x6bcc('0xc7'),_0x5dd4b6[_0x6bcc('0x56')],util[_0x6bcc('0xc8')](_0x1a6722['query'],{'showHidden':![],'depth':null}));switch(_0x5dd4b6[_0x6bcc('0x56')]){case _0x6bcc('0xd7'):if(_0x1a6722[_0x6bcc('0x48')][_0x6bcc('0xd8')]&&_0x1a6722[_0x6bcc('0x48')][_0x6bcc('0xd9')]){_0x5c3356=_0x1a6722['query']['state'];return db[_0x6bcc('0xa6')]['find']({'where':{'messageId':_0x1a6722[_0x6bcc('0x48')]['message-id']}});}break;}}})[_0x6bcc('0x22')](handleEntityNotFound(_0x37e9cb,null))[_0x6bcc('0x22')](function(_0x5ea1e5){if(_0x5ea1e5){_0x58f0c7=_0x5ea1e5;switch(_0xe83707['type']){case _0x6bcc('0xd7'):if(_0x5c3356==='2'||_0x5c3356==='6'){return _0x58f0c7[_0x6bcc('0xd3')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6bcc('0x2e'),_0x6bcc('0xd7'),util[_0x6bcc('0xc8')](_0x1a6722[_0x6bcc('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x58f0c7;}})[_0x6bcc('0x22')](respondWithResult(_0x37e9cb,null))[_0x6bcc('0x2c')](handleError(_0x37e9cb,null));};exports[_0x6bcc('0xda')]=function(_0x2d0baf,_0x321b8b,_0x1e69f1){return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x2d0baf[_0x6bcc('0x66')]['id']}})[_0x6bcc('0x22')](handleEntityNotFound(_0x321b8b,null))[_0x6bcc('0x22')](function(_0x18951b){if(_0x18951b){return _0x18951b[_0x6bcc('0xda')](_0x2d0baf[_0x6bcc('0x5e')]['ids'],_[_0x6bcc('0x9f')](_0x2d0baf[_0x6bcc('0x5e')],[_0x6bcc('0x6f'),'id'])||{})[_0x6bcc('0xdb')](function(_0x47ac6e){for(var _0x468ca1=0x0;_0x468ca1<_0x2d0baf['body']['ids'][_0x6bcc('0x4e')];_0x468ca1+=0x1){socket[_0x6bcc('0xdc')](_0x6bcc('0xdd'),{'UserId':Number(_0x2d0baf[_0x6bcc('0x5e')][_0x6bcc('0x6f')][_0x468ca1]),'SmsAccountId':Number(_0x2d0baf[_0x6bcc('0x66')]['id'])});}return _0x47ac6e;});}})[_0x6bcc('0x22')](respondWithResult(_0x321b8b,null))['catch'](handleError(_0x321b8b,null));};exports[_0x6bcc('0xde')]=function(_0x990613,_0x386e5b,_0x39252d){return db[_0x6bcc('0x43')][_0x6bcc('0x5c')]({'where':{'id':_0x990613['params']['id']}})['then'](handleEntityNotFound(_0x386e5b,null))[_0x6bcc('0x22')](function(_0x17c976){if(_0x17c976){return _0x17c976[_0x6bcc('0xde')](_0x990613['query'][_0x6bcc('0x6f')])[_0x6bcc('0x22')](function(){if(_[_0x6bcc('0xdf')](_0x990613['query'][_0x6bcc('0x6f')])){for(var _0x3c31e0=0x0;_0x3c31e0<_0x990613[_0x6bcc('0x48')][_0x6bcc('0x6f')][_0x6bcc('0x4e')];_0x3c31e0+=0x1){socket[_0x6bcc('0xdc')](_0x6bcc('0xe0'),{'UserId':Number(_0x990613['query'][_0x6bcc('0x6f')][_0x3c31e0]),'SmsAccountId':Number(_0x990613[_0x6bcc('0x66')]['id'])});}}else{socket[_0x6bcc('0xdc')](_0x6bcc('0xe0'),{'UserId':Number(_0x990613[_0x6bcc('0x48')][_0x6bcc('0x6f')]),'SmsAccountId':Number(_0x990613[_0x6bcc('0x66')]['id'])});}});}})[_0x6bcc('0x22')](respondWithStatusCode(_0x386e5b,null))['catch'](handleError(_0x386e5b,null));};exports[_0x6bcc('0xe1')]=function(_0x12a18f,_0x4a041b,_0x4d79f5){var _0x59fbf3={};var _0xd90962={};var _0x1d9c27;var _0x427c43;return db[_0x6bcc('0x43')][_0x6bcc('0x6b')]({'where':{'id':_0x12a18f[_0x6bcc('0x66')]['id']}})['then'](handleEntityNotFound(_0x4a041b,null))[_0x6bcc('0x22')](function(_0x2dccf9){if(_0x2dccf9){_0x1d9c27=_0x2dccf9;_0xd90962[_0x6bcc('0x46')]=_[_0x6bcc('0x49')](db['User'][_0x6bcc('0x44')]);_0xd90962[_0x6bcc('0x48')]=_['keys'](_0x12a18f[_0x6bcc('0x48')]);_0xd90962[_0x6bcc('0x4a')]=_[_0x6bcc('0x4b')](_0xd90962[_0x6bcc('0x46')],_0xd90962['query']);_0x59fbf3[_0x6bcc('0x4c')]=_['intersection'](_0xd90962[_0x6bcc('0x46')],qs[_0x6bcc('0x4d')](_0x12a18f[_0x6bcc('0x48')][_0x6bcc('0x4d')]));_0x59fbf3[_0x6bcc('0x4c')]=_0x59fbf3[_0x6bcc('0x4c')]['length']?_0x59fbf3[_0x6bcc('0x4c')]:_0xd90962[_0x6bcc('0x46')];_0x59fbf3[_0x6bcc('0x50')]=qs['sort'](_0x12a18f['query']['sort']);_0x59fbf3[_0x6bcc('0x52')]=qs[_0x6bcc('0x4a')](_[_0x6bcc('0x53')](_0x12a18f[_0x6bcc('0x48')],_0xd90962[_0x6bcc('0x4a')]));if(_0x12a18f[_0x6bcc('0x48')][_0x6bcc('0x54')]){_0x59fbf3['where']=_['merge'](_0x59fbf3[_0x6bcc('0x52')],{'$or':_[_0x6bcc('0x47')](_0x59fbf3[_0x6bcc('0x4c')],function(_0x52e214){var _0x511c7a={};_0x511c7a[_0x52e214]={'$like':'%'+_0x12a18f[_0x6bcc('0x48')][_0x6bcc('0x54')]+'%'};return _0x511c7a;})});}_0x59fbf3=_[_0x6bcc('0x55')]({},_0x59fbf3,_0x12a18f[_0x6bcc('0x57')]);return _0x1d9c27[_0x6bcc('0xe1')](_0x59fbf3);}})[_0x6bcc('0x22')](function(_0x18bd4c){if(_0x18bd4c){_0x427c43=_0x18bd4c[_0x6bcc('0x4e')];if(!_0x12a18f[_0x6bcc('0x48')][_0x6bcc('0x4f')](_0x6bcc('0x73'))){_0x59fbf3['limit']=qs[_0x6bcc('0x30')](_0x12a18f[_0x6bcc('0x48')][_0x6bcc('0x30')]);_0x59fbf3[_0x6bcc('0x2f')]=qs[_0x6bcc('0x2f')](_0x12a18f[_0x6bcc('0x48')][_0x6bcc('0x2f')]);}return _0x1d9c27['getAgents'](_0x59fbf3);}})[_0x6bcc('0x22')](function(_0xf94047){if(_0xf94047){return _0xf94047?{'count':_0x427c43,'rows':_0xf94047}:null;}})[_0x6bcc('0x22')](respondWithResult(_0x4a041b,null))[_0x6bcc('0x2c')](handleError(_0x4a041b,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 5cd0c14..824b9a1 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 _0x8985=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit'];(function(_0x2bbdde,_0x1fbb00){var _0x388c15=function(_0x3dfc9a){while(--_0x3dfc9a){_0x2bbdde['push'](_0x2bbdde['shift']());}};_0x388c15(++_0x1fbb00);}(_0x8985,0x87));var _0x5898=function(_0x32e2bb,_0x16c34d){_0x32e2bb=_0x32e2bb-0x0;var _0x2113e8=_0x8985[_0x32e2bb];return _0x2113e8;};'use strict';var EventEmitter=require(_0x5898('0x0'));var SmsAccount=require(_0x5898('0x1'))['db'][_0x5898('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5898('0x3')](0x0);var events={'afterCreate':_0x5898('0x4'),'afterUpdate':_0x5898('0x5'),'afterDestroy':_0x5898('0x6')};function emitEvent(_0x47e62d){return function(_0x30799e,_0x515bf7,_0x1713e5){SmsAccountEvents['emit'](_0x47e62d+':'+_0x30799e['id'],_0x30799e);SmsAccountEvents[_0x5898('0x7')](_0x47e62d,_0x30799e);_0x1713e5(null);};}for(var e in events){if(events[_0x5898('0x8')](e)){var event=events[e];SmsAccount[_0x5898('0x9')](e,emitEvent(event));}}module[_0x5898('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0xd16e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4d8d4d,_0x20cb34){var _0x23ec42=function(_0x3876b7){while(--_0x3876b7){_0x4d8d4d['push'](_0x4d8d4d['shift']());}};_0x23ec42(++_0x20cb34);}(_0xd16e,0xd7));var _0xed16=function(_0x2c0397,_0x3bcfd9){_0x2c0397=_0x2c0397-0x0;var _0x2002eb=_0xd16e[_0x2c0397];return _0x2002eb;};'use strict';var EventEmitter=require(_0xed16('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xed16('0x1')](0x0);var events={'afterCreate':_0xed16('0x2'),'afterUpdate':_0xed16('0x3'),'afterDestroy':_0xed16('0x4')};function emitEvent(_0x15a8ef){return function(_0x32cb83,_0x2941d5,_0x2ad134){SmsAccountEvents[_0xed16('0x5')](_0x15a8ef+':'+_0x32cb83['id'],_0x32cb83);SmsAccountEvents['emit'](_0x15a8ef,_0x32cb83);_0x2ad134(null);};}for(var e in events){if(events[_0xed16('0x6')](e)){var event=events[e];SmsAccount[_0xed16('0x7')](e,emitEvent(event));}}module[_0xed16('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index b5f6c7c..bc41749 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 _0x235a=['bluebird','request-promise','path','./smsAccount.attributes','define','sms_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x133c5a,_0xc74e31){var _0x6f7cae=function(_0x87ae01){while(--_0x87ae01){_0x133c5a['push'](_0x133c5a['shift']());}};_0x6f7cae(++_0xc74e31);}(_0x235a,0xf8));var _0xa235=function(_0x368d89,_0x594580){_0x368d89=_0x368d89-0x0;var _0x2e39ab=_0x235a[_0x368d89];return _0x2e39ab;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var logger=require(_0xa235('0x2'))(_0xa235('0x3'));var moment=require(_0xa235('0x4'));var BPromise=require(_0xa235('0x5'));var rp=require(_0xa235('0x6'));var fs=require('fs');var path=require(_0xa235('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa235('0x8'));module['exports']=function(_0x3dd26d,_0x3161b5){return _0x3dd26d[_0xa235('0x9')]('SmsAccount',attributes,{'tableName':_0xa235('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ef9=['sms_accounts','lodash','util','../../config/logger','moment','bluebird','rimraf','exports','SmsAccount'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7ef9,0x9a));var _0x97ef=function(_0x20b260,_0x5e028e){_0x20b260=_0x20b260-0x0;var _0x41aec8=_0x7ef9[_0x20b260];return _0x41aec8;};'use strict';var _=require(_0x97ef('0x0'));var util=require(_0x97ef('0x1'));var logger=require(_0x97ef('0x2'))('api');var moment=require(_0x97ef('0x3'));var BPromise=require(_0x97ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x97ef('0x5'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0x97ef('0x6')]=function(_0x3f5c22,_0x3a82b0){return _0x3f5c22['define'](_0x97ef('0x7'),attributes,{'tableName':_0x97ef('0x8'),'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 4f5c43f..42c981e 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 _0x563a=['find','options','raw','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSmsAccount'];(function(_0xe4343b,_0x4f6891){var _0x281085=function(_0x4ea8e0){while(--_0x4ea8e0){_0xe4343b['push'](_0xe4343b['shift']());}};_0x281085(++_0x4f6891);}(_0x563a,0x15b));var _0xa563=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x563a[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0xa563('0x0'));var util=require(_0xa563('0x1'));var moment=require(_0xa563('0x2'));var BPromise=require(_0xa563('0x3'));var rs=require(_0xa563('0x4'));var fs=require('fs');var Redis=require(_0xa563('0x5'));var db=require(_0xa563('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa563('0x7'));var config=require(_0xa563('0x8'));var jayson=require(_0xa563('0x9'));var client=jayson[_0xa563('0xa')]['http']({'port':0x232a});config[_0xa563('0xb')]=_[_0xa563('0xc')](config[_0xa563('0xb')],{'host':_0xa563('0xd'),'port':0x18eb});var socket=require(_0xa563('0xe'))(new Redis(config[_0xa563('0xb')]));require(_0xa563('0xf'))['register'](socket);function respondWithRpcPromise(_0x1f21d4,_0x367dd0,_0x496756){return new BPromise(function(_0x4de467,_0x4db1ba){return client['request'](_0x1f21d4,_0x496756)['then'](function(_0x396f0d){logger[_0xa563('0x10')](_0xa563('0x11'),_0x367dd0,_0xa563('0x12'));logger[_0xa563('0x13')](_0xa563('0x14'),_0x367dd0,_0xa563('0x12'),JSON[_0xa563('0x15')](_0x396f0d));if(_0x396f0d[_0xa563('0x16')]){if(_0x396f0d[_0xa563('0x16')][_0xa563('0x17')]===0x1f4){logger[_0xa563('0x16')](_0xa563('0x11'),_0x367dd0,_0x396f0d['error'][_0xa563('0x18')]);return _0x4db1ba(_0x396f0d[_0xa563('0x16')]['message']);}logger['error'](_0xa563('0x11'),_0x367dd0,_0x396f0d[_0xa563('0x16')][_0xa563('0x18')]);return _0x4de467(_0x396f0d[_0xa563('0x16')][_0xa563('0x18')]);}else{logger[_0xa563('0x10')]('SmsAccount,\x20%s,\x20%s',_0x367dd0,_0xa563('0x12'));_0x4de467(_0x396f0d['result'][_0xa563('0x18')]);}})[_0xa563('0x19')](function(_0x211a7b){logger[_0xa563('0x16')](_0xa563('0x11'),_0x367dd0,_0x211a7b);_0x4db1ba(_0x211a7b);});});}exports[_0xa563('0x1a')]=function(_0x57a08b){var _0x15c3a5=this;return new Promise(function(_0x56dea1,_0x5f226b){return db['SmsAccount'][_0xa563('0x1b')]({'raw':_0x57a08b[_0xa563('0x1c')]?_0x57a08b[_0xa563('0x1c')][_0xa563('0x1d')]===undefined?!![]:![]:!![],'where':_0x57a08b[_0xa563('0x1c')]?_0x57a08b[_0xa563('0x1c')]['where']||null:null,'attributes':_0x57a08b[_0xa563('0x1c')]?_0x57a08b[_0xa563('0x1c')][_0xa563('0x1e')]||null:null,'include':_0x57a08b[_0xa563('0x1c')]?_0x57a08b[_0xa563('0x1c')]['include']?_['map'](_0x57a08b['options'][_0xa563('0x1f')],function(_0x499c59){return{'model':db[_0x499c59[_0xa563('0x20')]],'as':_0x499c59['as'],'attributes':_0x499c59[_0xa563('0x1e')],'include':_0x499c59[_0xa563('0x1f')]?_['map'](_0x499c59['include'],function(_0x581a3f){return{'model':db[_0x581a3f['model']],'as':_0x581a3f['as'],'attributes':_0x581a3f[_0xa563('0x1e')],'include':_0x581a3f[_0xa563('0x1f')]?_[_0xa563('0x21')](_0x581a3f[_0xa563('0x1f')],function(_0x5885e7){return{'model':db[_0x5885e7[_0xa563('0x20')]],'as':_0x5885e7['as'],'attributes':_0x5885e7[_0xa563('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13138c){logger[_0xa563('0x10')]('ShowSmsAccount',_0x57a08b);logger[_0xa563('0x13')](_0xa563('0x1a'),_0x57a08b,JSON['stringify'](_0x13138c));_0x56dea1(_0x13138c);})[_0xa563('0x19')](function(_0x569e7c){logger[_0xa563('0x16')](_0xa563('0x1a'),_0x569e7c[_0xa563('0x18')],_0x57a08b);_0x5f226b(_0x15c3a5['error'](0x1f4,_0x569e7c[_0xa563('0x18')]));});});}; \ No newline at end of file +var _0x0922=['options','raw','attributes','map','model','include','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSmsAccount','SmsAccount','find'];(function(_0x157e8a,_0x4836a9){var _0x6c7475=function(_0x4fbfd2){while(--_0x4fbfd2){_0x157e8a['push'](_0x157e8a['shift']());}};_0x6c7475(++_0x4836a9);}(_0x0922,0xab));var _0x2092=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x0922[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x2092('0x0'));var util=require(_0x2092('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2092('0x2'));var fs=require('fs');var Redis=require(_0x2092('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2092('0x4'));var logger=require(_0x2092('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2092('0x6'));var client=jayson[_0x2092('0x7')]['http']({'port':0x232a});config[_0x2092('0x8')]=_[_0x2092('0x9')](config['redis'],{'host':_0x2092('0xa'),'port':0x18eb});var socket=require(_0x2092('0xb'))(new Redis(config['redis']));require(_0x2092('0xc'))['register'](socket);function respondWithRpcPromise(_0x23de5a,_0x5d85f6,_0x388e78){return new BPromise(function(_0x3e329e,_0x5ba95b){return client[_0x2092('0xd')](_0x23de5a,_0x388e78)[_0x2092('0xe')](function(_0x18a548){logger[_0x2092('0xf')](_0x2092('0x10'),_0x5d85f6,_0x2092('0x11'));logger[_0x2092('0x12')](_0x2092('0x13'),_0x5d85f6,'request\x20sent',JSON['stringify'](_0x18a548));if(_0x18a548[_0x2092('0x14')]){if(_0x18a548[_0x2092('0x14')][_0x2092('0x15')]===0x1f4){logger['error'](_0x2092('0x10'),_0x5d85f6,_0x18a548['error'][_0x2092('0x16')]);return _0x5ba95b(_0x18a548[_0x2092('0x14')][_0x2092('0x16')]);}logger[_0x2092('0x14')](_0x2092('0x10'),_0x5d85f6,_0x18a548['error']['message']);return _0x3e329e(_0x18a548[_0x2092('0x14')]['message']);}else{logger[_0x2092('0xf')](_0x2092('0x10'),_0x5d85f6,_0x2092('0x11'));_0x3e329e(_0x18a548['result'][_0x2092('0x16')]);}})[_0x2092('0x17')](function(_0x201ead){logger[_0x2092('0x14')](_0x2092('0x10'),_0x5d85f6,_0x201ead);_0x5ba95b(_0x201ead);});});}exports[_0x2092('0x18')]=function(_0x1bd41d){var _0x8a806c=this;return new Promise(function(_0x2f434d,_0x95cb83){return db[_0x2092('0x19')][_0x2092('0x1a')]({'raw':_0x1bd41d[_0x2092('0x1b')]?_0x1bd41d[_0x2092('0x1b')][_0x2092('0x1c')]===undefined?!![]:![]:!![],'where':_0x1bd41d[_0x2092('0x1b')]?_0x1bd41d['options']['where']||null:null,'attributes':_0x1bd41d['options']?_0x1bd41d['options'][_0x2092('0x1d')]||null:null,'include':_0x1bd41d['options']?_0x1bd41d['options']['include']?_[_0x2092('0x1e')](_0x1bd41d[_0x2092('0x1b')]['include'],function(_0x5a5536){return{'model':db[_0x5a5536[_0x2092('0x1f')]],'as':_0x5a5536['as'],'attributes':_0x5a5536[_0x2092('0x1d')],'include':_0x5a5536[_0x2092('0x20')]?_['map'](_0x5a5536[_0x2092('0x20')],function(_0x15e90d){return{'model':db[_0x15e90d[_0x2092('0x1f')]],'as':_0x15e90d['as'],'attributes':_0x15e90d[_0x2092('0x1d')],'include':_0x15e90d['include']?_[_0x2092('0x1e')](_0x15e90d[_0x2092('0x20')],function(_0x5c9e46){return{'model':db[_0x5c9e46['model']],'as':_0x5c9e46['as'],'attributes':_0x5c9e46[_0x2092('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fd5b7){logger[_0x2092('0xf')](_0x2092('0x18'),_0x1bd41d);logger[_0x2092('0x12')](_0x2092('0x18'),_0x1bd41d,JSON['stringify'](_0x2fd5b7));_0x2f434d(_0x2fd5b7);})['catch'](function(_0x90251f){logger[_0x2092('0x14')](_0x2092('0x18'),_0x90251f['message'],_0x1bd41d);_0x95cb83(_0x8a806c['error'](0x1f4,_0x90251f[_0x2092('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 1661405..5a2752b 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_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 2f71f06..12482db 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(_0x3f0f01,_0x25120e){var _0x6267e5=function(_0x1a1dc6){while(--_0x1a1dc6){_0x3f0f01['push'](_0x3f0f01['shift']());}};_0x6267e5(++_0x25120e);}(_0x008c,0x188));var _0xc008=function(_0x216d45,_0x4989fe){_0x216d45=_0x216d45-0x0;var _0xbaac0b=_0x008c[_0x216d45];return _0xbaac0b;};'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 _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(_0x2537bf,_0x5db4ed){var _0x4cd7ab=function(_0x43b314){while(--_0x43b314){_0x2537bf['push'](_0x2537bf['shift']());}};_0x4cd7ab(++_0x5db4ed);}(_0x008c,0x188));var _0xc008=function(_0x54abae,_0x154d8f){_0x54abae=_0x54abae-0x0;var _0x297e50=_0x008c[_0x54abae];return _0x297e50;};'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 diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 33ad111..ed49c17 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 _0x071e=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x18baf9,_0x1a51b3){var _0x116727=function(_0xd01a4a){while(--_0xd01a4a){_0x18baf9['push'](_0x18baf9['shift']());}};_0x116727(++_0x1a51b3);}(_0x071e,0x13e));var _0xe071=function(_0x1999bf,_0x358411){_0x1999bf=_0x1999bf-0x0;var _0x2cbcc6=_0x071e[_0x1999bf];return _0x2cbcc6;};'use strict';var Sequelize=require(_0xe071('0x0'));module[_0xe071('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe071('0x2')],'allowNull':![],'defaultValue':_0xe071('0x3')},'appdata':{'type':Sequelize[_0xe071('0x4')]()},'description':{'type':Sequelize[_0xe071('0x2')]},'interval':{'type':Sequelize[_0xe071('0x2')],'defaultValue':_0xe071('0x5')}}; \ No newline at end of file +var _0x67c5=['STRING','noop','TEXT','INTEGER'];(function(_0x5cd10f,_0x4d2a70){var _0x29f1b4=function(_0x2686a6){while(--_0x2686a6){_0x5cd10f['push'](_0x5cd10f['shift']());}};_0x29f1b4(++_0x4d2a70);}(_0x67c5,0x9f));var _0x567c=function(_0x1fa853,_0xa3d5a5){_0x1fa853=_0x1fa853-0x0;var _0x4791cd=_0x67c5[_0x1fa853];return _0x4791cd;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x567c('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x567c('0x1')],'allowNull':![],'defaultValue':_0x567c('0x2')},'appdata':{'type':Sequelize[_0x567c('0x3')]()},'description':{'type':Sequelize[_0x567c('0x1')]},'interval':{'type':Sequelize[_0x567c('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 1fdb2fe..1dae43f 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 _0x00b8=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','fs-extra'];(function(_0x44c898,_0x4e5f76){var _0x5d46b7=function(_0x7c4aae){while(--_0x7c4aae){_0x44c898['push'](_0x44c898['shift']());}};_0x5d46b7(++_0x4e5f76);}(_0x00b8,0x115));var _0x800b=function(_0x150b90,_0x357ac9){_0x150b90=_0x150b90-0x0;var _0x3593d8=_0x00b8[_0x150b90];return _0x3593d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x800b('0x0'));var zipdir=require(_0x800b('0x1'));var jsonpatch=require(_0x800b('0x2'));var rp=require('request-promise');var moment=require(_0x800b('0x3'));var BPromise=require(_0x800b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x800b('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x800b('0x6'));var _=require(_0x800b('0x7'));var squel=require(_0x800b('0x8'));var crypto=require(_0x800b('0x9'));var jsforce=require(_0x800b('0xa'));var deskjs=require(_0x800b('0xb'));var toCsv=require(_0x800b('0xc'));var querystring=require(_0x800b('0xd'));var Papa=require(_0x800b('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('../../config/license/hardware');var logger=require(_0x800b('0xf'))(_0x800b('0x10'));var utils=require(_0x800b('0x11'));var config=require(_0x800b('0x12'));var licenseUtil=require(_0x800b('0x13'));var db=require(_0x800b('0x14'))['db'];function respondWithStatusCode(_0x5a5f04,_0x33bc05){_0x33bc05=_0x33bc05||0xcc;return function(_0x49193c){if(_0x49193c){return _0x5a5f04['sendStatus'](_0x33bc05);}return _0x5a5f04[_0x800b('0x15')](_0x33bc05)[_0x800b('0x16')]();};}function respondWithResult(_0x46ebb9,_0x17e4d9){_0x17e4d9=_0x17e4d9||0xc8;return function(_0xf49fc8){if(_0xf49fc8){return _0x46ebb9[_0x800b('0x15')](_0x17e4d9)[_0x800b('0x17')](_0xf49fc8);}};}function respondWithFilteredResult(_0x22368a,_0x5a305c){return function(_0x4304d1){if(_0x4304d1){var _0x47b29e=typeof _0x5a305c['offset']===_0x800b('0x18')&&typeof _0x5a305c[_0x800b('0x19')]===_0x800b('0x18');var _0x2e6ce0=_0x4304d1['count'];var _0x50846e=_0x47b29e?0x0:_0x5a305c['offset'];var _0x583161=_0x47b29e?_0x4304d1[_0x800b('0x1a')]:_0x5a305c[_0x800b('0x1b')]+_0x5a305c[_0x800b('0x19')];var _0x5cd50f;if(_0x583161>=_0x2e6ce0){_0x583161=_0x2e6ce0;_0x5cd50f=0xc8;}else{_0x5cd50f=0xce;}_0x22368a[_0x800b('0x15')](_0x5cd50f);return _0x22368a[_0x800b('0x1c')](_0x800b('0x1d'),_0x50846e+'-'+_0x583161+'/'+_0x2e6ce0)[_0x800b('0x17')](_0x4304d1);}return null;};}function patchUpdates(_0x4b9a2c){return function(_0x28ee90){try{jsonpatch[_0x800b('0x1e')](_0x28ee90,_0x4b9a2c,!![]);}catch(_0x538833){return BPromise[_0x800b('0x1f')](_0x538833);}return _0x28ee90[_0x800b('0x20')]();};}function saveUpdates(_0x2a1c35,_0x92d5ab){return function(_0x514f03){if(_0x514f03){return _0x514f03[_0x800b('0x21')](_0x2a1c35)[_0x800b('0x22')](function(_0x66ef1f){return _0x66ef1f;});}return null;};}function removeEntity(_0x89e009,_0x3bb015){return function(_0xfdbbf3){if(_0xfdbbf3){return _0xfdbbf3[_0x800b('0x23')]()[_0x800b('0x22')](function(){_0x89e009[_0x800b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x97c30e,_0x4ebb21){return function(_0x19c1f8){if(!_0x19c1f8){_0x97c30e[_0x800b('0x24')](0x194);}return _0x19c1f8;};}function handleError(_0x3af43e,_0x233878){_0x233878=_0x233878||0x1f4;return function(_0x1c1a18){logger['error'](_0x1c1a18['stack']);if(_0x1c1a18[_0x800b('0x25')]){delete _0x1c1a18[_0x800b('0x25')];}_0x3af43e[_0x800b('0x15')](_0x233878)[_0x800b('0x26')](_0x1c1a18);};}exports[_0x800b('0x27')]=function(_0x5a39d1,_0x35df2a){var _0x57174e={},_0x36bf31={},_0x4d6ac1={'count':0x0,'rows':[]};var _0x4bd824=_['map'](db[_0x800b('0x28')][_0x800b('0x29')],function(_0x2471fd){return{'name':_0x2471fd[_0x800b('0x2a')],'type':_0x2471fd[_0x800b('0x2b')][_0x800b('0x2c')]};});_0x36bf31[_0x800b('0x2d')]=_[_0x800b('0x2e')](_0x4bd824,'name');_0x36bf31[_0x800b('0x2f')]=_['keys'](_0x5a39d1[_0x800b('0x2f')]);_0x36bf31[_0x800b('0x30')]=_[_0x800b('0x31')](_0x36bf31[_0x800b('0x2d')],_0x36bf31[_0x800b('0x2f')]);_0x57174e[_0x800b('0x32')]=_[_0x800b('0x31')](_0x36bf31[_0x800b('0x2d')],qs[_0x800b('0x33')](_0x5a39d1[_0x800b('0x2f')]['fields']));_0x57174e[_0x800b('0x32')]=_0x57174e[_0x800b('0x32')][_0x800b('0x34')]?_0x57174e[_0x800b('0x32')]:_0x36bf31[_0x800b('0x2d')];if(!_0x5a39d1[_0x800b('0x2f')]['hasOwnProperty']('nolimit')){_0x57174e['limit']=qs['limit'](_0x5a39d1[_0x800b('0x2f')][_0x800b('0x19')]);_0x57174e[_0x800b('0x1b')]=qs[_0x800b('0x1b')](_0x5a39d1['query'][_0x800b('0x1b')]);}_0x57174e[_0x800b('0x35')]=qs[_0x800b('0x36')](_0x5a39d1['query'][_0x800b('0x36')]);_0x57174e[_0x800b('0x37')]=qs[_0x800b('0x30')](_[_0x800b('0x38')](_0x5a39d1[_0x800b('0x2f')],_0x36bf31[_0x800b('0x30')]),_0x4bd824);if(_0x5a39d1[_0x800b('0x2f')][_0x800b('0x39')]){_0x57174e[_0x800b('0x37')]=_[_0x800b('0x3a')](_0x57174e['where'],{'$or':_[_0x800b('0x2e')](_0x4bd824,function(_0x395952){if(_0x395952[_0x800b('0x2b')]!==_0x800b('0x3b')){var _0x423559={};_0x423559[_0x395952[_0x800b('0x25')]]={'$like':'%'+_0x5a39d1['query'][_0x800b('0x39')]+'%'};return _0x423559;}})});}_0x57174e=_[_0x800b('0x3a')]({},_0x57174e,_0x5a39d1[_0x800b('0x3c')]);var _0xb6980e={'where':_0x57174e[_0x800b('0x37')]};return db[_0x800b('0x28')][_0x800b('0x1a')](_0xb6980e)[_0x800b('0x22')](function(_0x368e15){_0x4d6ac1['count']=_0x368e15;if(_0x5a39d1[_0x800b('0x2f')][_0x800b('0x3d')]){_0x57174e[_0x800b('0x3e')]=[{'all':!![]}];}return db[_0x800b('0x28')][_0x800b('0x3f')](_0x57174e);})[_0x800b('0x22')](function(_0x38917c){_0x4d6ac1[_0x800b('0x40')]=_0x38917c;return _0x4d6ac1;})['then'](respondWithFilteredResult(_0x35df2a,_0x57174e))[_0x800b('0x41')](handleError(_0x35df2a,null));};exports['show']=function(_0x84d827,_0x227f0c){var _0x416c29={'raw':!![],'where':{'id':_0x84d827[_0x800b('0x42')]['id']}},_0x3b9f64={};_0x3b9f64[_0x800b('0x2d')]=_['keys'](db['SmsApplication']['rawAttributes']);_0x3b9f64['query']=_[_0x800b('0x43')](_0x84d827[_0x800b('0x2f')]);_0x3b9f64['filters']=_[_0x800b('0x31')](_0x3b9f64[_0x800b('0x2d')],_0x3b9f64['query']);_0x416c29['attributes']=_[_0x800b('0x31')](_0x3b9f64[_0x800b('0x2d')],qs[_0x800b('0x33')](_0x84d827[_0x800b('0x2f')][_0x800b('0x33')]));_0x416c29['attributes']=_0x416c29[_0x800b('0x32')][_0x800b('0x34')]?_0x416c29[_0x800b('0x32')]:_0x3b9f64[_0x800b('0x2d')];if(_0x84d827[_0x800b('0x2f')][_0x800b('0x3d')]){_0x416c29[_0x800b('0x3e')]=[{'all':!![]}];}_0x416c29=_[_0x800b('0x3a')]({},_0x416c29,_0x84d827[_0x800b('0x3c')]);return db['SmsApplication'][_0x800b('0x44')](_0x416c29)[_0x800b('0x22')](handleEntityNotFound(_0x227f0c,null))[_0x800b('0x22')](respondWithResult(_0x227f0c,null))[_0x800b('0x41')](handleError(_0x227f0c,null));};exports[_0x800b('0x45')]=function(_0x14f208,_0x2543d9){return db[_0x800b('0x28')][_0x800b('0x45')](_0x14f208['body'],{})['then'](respondWithResult(_0x2543d9,0xc9))[_0x800b('0x41')](handleError(_0x2543d9,null));};exports['update']=function(_0x5191ed,_0x4e04d2){if(_0x5191ed['body']['id']){delete _0x5191ed['body']['id'];}return db[_0x800b('0x28')][_0x800b('0x44')]({'where':{'id':_0x5191ed['params']['id']}})[_0x800b('0x22')](handleEntityNotFound(_0x4e04d2,null))[_0x800b('0x22')](saveUpdates(_0x5191ed[_0x800b('0x46')],null))[_0x800b('0x22')](respondWithResult(_0x4e04d2,null))[_0x800b('0x41')](handleError(_0x4e04d2,null));};exports['destroy']=function(_0x4d8c51,_0x2303ec){return db['SmsApplication'][_0x800b('0x44')]({'where':{'id':_0x4d8c51[_0x800b('0x42')]['id']}})[_0x800b('0x22')](handleEntityNotFound(_0x2303ec,null))['then'](removeEntity(_0x2303ec,null))[_0x800b('0x41')](handleError(_0x2303ec,null));}; \ No newline at end of file +var _0xe8b7=['SmsApplication','includeAll','rows','catch','params','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','pick','where','merge'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0xe8b7,0x92));var _0x7e8b=function(_0x55d22f,_0x2296db){_0x55d22f=_0x55d22f-0x0;var _0x45fb5e=_0xe8b7[_0x55d22f];return _0x45fb5e;};'use strict';var emlformat=require(_0x7e8b('0x0'));var rimraf=require(_0x7e8b('0x1'));var zipdir=require(_0x7e8b('0x2'));var jsonpatch=require(_0x7e8b('0x3'));var rp=require(_0x7e8b('0x4'));var moment=require(_0x7e8b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7e8b('0x6'));var path=require(_0x7e8b('0x7'));var sox=require(_0x7e8b('0x8'));var csv=require('to-csv');var ejs=require(_0x7e8b('0x9'));var fs=require('fs');var fs_extra=require(_0x7e8b('0xa'));var _=require(_0x7e8b('0xb'));var squel=require(_0x7e8b('0xc'));var crypto=require('crypto');var jsforce=require(_0x7e8b('0xd'));var deskjs=require(_0x7e8b('0xe'));var toCsv=require(_0x7e8b('0xf'));var querystring=require(_0x7e8b('0x10'));var Papa=require(_0x7e8b('0x11'));var Redis=require(_0x7e8b('0x12'));var authService=require(_0x7e8b('0x13'));var qs=require(_0x7e8b('0x14'));var as=require(_0x7e8b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e8b('0x16'))('api');var utils=require(_0x7e8b('0x17'));var config=require(_0x7e8b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1083ca,_0x3adbc4){_0x3adbc4=_0x3adbc4||0xcc;return function(_0x476c1f){if(_0x476c1f){return _0x1083ca[_0x7e8b('0x19')](_0x3adbc4);}return _0x1083ca[_0x7e8b('0x1a')](_0x3adbc4)[_0x7e8b('0x1b')]();};}function respondWithResult(_0x5b295c,_0x2bd232){_0x2bd232=_0x2bd232||0xc8;return function(_0x2c05c7){if(_0x2c05c7){return _0x5b295c[_0x7e8b('0x1a')](_0x2bd232)[_0x7e8b('0x1c')](_0x2c05c7);}};}function respondWithFilteredResult(_0x780de,_0x2f5e49){return function(_0x59aa74){if(_0x59aa74){var _0x4eaa7e=typeof _0x2f5e49[_0x7e8b('0x1d')]===_0x7e8b('0x1e')&&typeof _0x2f5e49[_0x7e8b('0x1f')]==='undefined';var _0x377e23=_0x59aa74['count'];var _0x155b79=_0x4eaa7e?0x0:_0x2f5e49[_0x7e8b('0x1d')];var _0x2beb79=_0x4eaa7e?_0x59aa74[_0x7e8b('0x20')]:_0x2f5e49[_0x7e8b('0x1d')]+_0x2f5e49[_0x7e8b('0x1f')];var _0x5d7523;if(_0x2beb79>=_0x377e23){_0x2beb79=_0x377e23;_0x5d7523=0xc8;}else{_0x5d7523=0xce;}_0x780de['status'](_0x5d7523);return _0x780de['set']('Content-Range',_0x155b79+'-'+_0x2beb79+'/'+_0x377e23)[_0x7e8b('0x1c')](_0x59aa74);}return null;};}function patchUpdates(_0xdc97ad){return function(_0x10cd0a){try{jsonpatch[_0x7e8b('0x21')](_0x10cd0a,_0xdc97ad,!![]);}catch(_0xa74bbe){return BPromise['reject'](_0xa74bbe);}return _0x10cd0a[_0x7e8b('0x22')]();};}function saveUpdates(_0x203702,_0x5e8173){return function(_0x1986df){if(_0x1986df){return _0x1986df[_0x7e8b('0x23')](_0x203702)[_0x7e8b('0x24')](function(_0x1d3106){return _0x1d3106;});}return null;};}function removeEntity(_0x544357,_0x3625e8){return function(_0x19d824){if(_0x19d824){return _0x19d824[_0x7e8b('0x25')]()[_0x7e8b('0x24')](function(){_0x544357[_0x7e8b('0x1a')](0xcc)[_0x7e8b('0x1b')]();});}};}function handleEntityNotFound(_0x8219f1,_0xf3dd45){return function(_0x52bfdf){if(!_0x52bfdf){_0x8219f1[_0x7e8b('0x19')](0x194);}return _0x52bfdf;};}function handleError(_0x2ece3d,_0x54906e){_0x54906e=_0x54906e||0x1f4;return function(_0x6f7d9d){logger['error'](_0x6f7d9d[_0x7e8b('0x26')]);if(_0x6f7d9d[_0x7e8b('0x27')]){delete _0x6f7d9d[_0x7e8b('0x27')];}_0x2ece3d['status'](_0x54906e)[_0x7e8b('0x28')](_0x6f7d9d);};}exports['index']=function(_0x49ac86,_0x14e4ae){var _0x1252f0={},_0x58c15d={},_0x42d2b2={'count':0x0,'rows':[]};var _0x4a3389=_[_0x7e8b('0x29')](db['SmsApplication'][_0x7e8b('0x2a')],function(_0x3c707c){return{'name':_0x3c707c['fieldName'],'type':_0x3c707c[_0x7e8b('0x2b')][_0x7e8b('0x2c')]};});_0x58c15d[_0x7e8b('0x2d')]=_[_0x7e8b('0x29')](_0x4a3389,_0x7e8b('0x27'));_0x58c15d[_0x7e8b('0x2e')]=_[_0x7e8b('0x2f')](_0x49ac86['query']);_0x58c15d[_0x7e8b('0x30')]=_[_0x7e8b('0x31')](_0x58c15d['model'],_0x58c15d[_0x7e8b('0x2e')]);_0x1252f0['attributes']=_['intersection'](_0x58c15d[_0x7e8b('0x2d')],qs[_0x7e8b('0x32')](_0x49ac86[_0x7e8b('0x2e')][_0x7e8b('0x32')]));_0x1252f0[_0x7e8b('0x33')]=_0x1252f0[_0x7e8b('0x33')][_0x7e8b('0x34')]?_0x1252f0[_0x7e8b('0x33')]:_0x58c15d[_0x7e8b('0x2d')];if(!_0x49ac86[_0x7e8b('0x2e')][_0x7e8b('0x35')]('nolimit')){_0x1252f0['limit']=qs[_0x7e8b('0x1f')](_0x49ac86[_0x7e8b('0x2e')][_0x7e8b('0x1f')]);_0x1252f0[_0x7e8b('0x1d')]=qs[_0x7e8b('0x1d')](_0x49ac86[_0x7e8b('0x2e')][_0x7e8b('0x1d')]);}_0x1252f0[_0x7e8b('0x36')]=qs['sort'](_0x49ac86[_0x7e8b('0x2e')]['sort']);_0x1252f0['where']=qs['filters'](_[_0x7e8b('0x37')](_0x49ac86['query'],_0x58c15d[_0x7e8b('0x30')]),_0x4a3389);if(_0x49ac86['query']['filter']){_0x1252f0['where']=_['merge'](_0x1252f0[_0x7e8b('0x38')],{'$or':_[_0x7e8b('0x29')](_0x4a3389,function(_0x445526){if(_0x445526[_0x7e8b('0x2b')]!=='VIRTUAL'){var _0x59ec3e={};_0x59ec3e[_0x445526['name']]={'$like':'%'+_0x49ac86[_0x7e8b('0x2e')]['filter']+'%'};return _0x59ec3e;}})});}_0x1252f0=_[_0x7e8b('0x39')]({},_0x1252f0,_0x49ac86['options']);var _0x4c930f={'where':_0x1252f0[_0x7e8b('0x38')]};return db[_0x7e8b('0x3a')][_0x7e8b('0x20')](_0x4c930f)[_0x7e8b('0x24')](function(_0x486119){_0x42d2b2['count']=_0x486119;if(_0x49ac86[_0x7e8b('0x2e')][_0x7e8b('0x3b')]){_0x1252f0['include']=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x1252f0);})['then'](function(_0x649584){_0x42d2b2[_0x7e8b('0x3c')]=_0x649584;return _0x42d2b2;})['then'](respondWithFilteredResult(_0x14e4ae,_0x1252f0))[_0x7e8b('0x3d')](handleError(_0x14e4ae,null));};exports['show']=function(_0x20d078,_0x543f9a){var _0x3c0445={'raw':!![],'where':{'id':_0x20d078[_0x7e8b('0x3e')]['id']}},_0x201a48={};_0x201a48[_0x7e8b('0x2d')]=_['keys'](db[_0x7e8b('0x3a')][_0x7e8b('0x2a')]);_0x201a48[_0x7e8b('0x2e')]=_[_0x7e8b('0x2f')](_0x20d078[_0x7e8b('0x2e')]);_0x201a48['filters']=_[_0x7e8b('0x31')](_0x201a48['model'],_0x201a48[_0x7e8b('0x2e')]);_0x3c0445[_0x7e8b('0x33')]=_['intersection'](_0x201a48[_0x7e8b('0x2d')],qs[_0x7e8b('0x32')](_0x20d078[_0x7e8b('0x2e')]['fields']));_0x3c0445[_0x7e8b('0x33')]=_0x3c0445[_0x7e8b('0x33')]['length']?_0x3c0445[_0x7e8b('0x33')]:_0x201a48[_0x7e8b('0x2d')];if(_0x20d078[_0x7e8b('0x2e')][_0x7e8b('0x3b')]){_0x3c0445[_0x7e8b('0x3f')]=[{'all':!![]}];}_0x3c0445=_[_0x7e8b('0x39')]({},_0x3c0445,_0x20d078[_0x7e8b('0x40')]);return db[_0x7e8b('0x3a')][_0x7e8b('0x41')](_0x3c0445)[_0x7e8b('0x24')](handleEntityNotFound(_0x543f9a,null))[_0x7e8b('0x24')](respondWithResult(_0x543f9a,null))['catch'](handleError(_0x543f9a,null));};exports[_0x7e8b('0x42')]=function(_0x2d72e0,_0x32f81c){return db[_0x7e8b('0x3a')][_0x7e8b('0x42')](_0x2d72e0[_0x7e8b('0x43')],{})['then'](respondWithResult(_0x32f81c,0xc9))[_0x7e8b('0x3d')](handleError(_0x32f81c,null));};exports[_0x7e8b('0x23')]=function(_0x364da6,_0x3b5c6f){if(_0x364da6['body']['id']){delete _0x364da6[_0x7e8b('0x43')]['id'];}return db[_0x7e8b('0x3a')][_0x7e8b('0x41')]({'where':{'id':_0x364da6['params']['id']}})[_0x7e8b('0x24')](handleEntityNotFound(_0x3b5c6f,null))[_0x7e8b('0x24')](saveUpdates(_0x364da6['body'],null))['then'](respondWithResult(_0x3b5c6f,null))['catch'](handleError(_0x3b5c6f,null));};exports[_0x7e8b('0x25')]=function(_0x1ab8da,_0x111d77){return db[_0x7e8b('0x3a')][_0x7e8b('0x41')]({'where':{'id':_0x1ab8da[_0x7e8b('0x3e')]['id']}})[_0x7e8b('0x24')](handleEntityNotFound(_0x111d77,null))[_0x7e8b('0x24')](removeEntity(_0x111d77,null))[_0x7e8b('0x3d')](handleError(_0x111d77,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 044af8d..e2cbe1a 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 _0xc95f=['exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0xc95f,0xe2));var _0xfc95=function(_0x18b2a3,_0x2a639b){_0x18b2a3=_0x18b2a3-0x0;var _0x50659f=_0xc95f[_0x18b2a3];return _0x50659f;};'use strict';var _=require(_0xfc95('0x0'));var util=require(_0xfc95('0x1'));var logger=require(_0xfc95('0x2'))(_0xfc95('0x3'));var moment=require(_0xfc95('0x4'));var BPromise=require(_0xfc95('0x5'));var rp=require(_0xfc95('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc95('0x7'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0xfc95('0x8')]=function(_0x4923f7,_0x543cf4){return _0x4923f7['define'](_0xfc95('0x9'),attributes,{'tableName':_0xfc95('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfc95('0xb'),'collate':_0xfc95('0xc')});}; \ No newline at end of file +var _0xd0ee=['lodash','util','../../config/logger','moment','request-promise','path','./smsApplication.attributes','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5c1df6,_0x5d1e5d){var _0x16c8a4=function(_0xf4deca){while(--_0xf4deca){_0x5c1df6['push'](_0x5c1df6['shift']());}};_0x16c8a4(++_0x5d1e5d);}(_0xd0ee,0x18c));var _0xed0e=function(_0x21371c,_0xe442f6){_0x21371c=_0x21371c-0x0;var _0x237894=_0xd0ee[_0x21371c];return _0x237894;};'use strict';var _=require(_0xed0e('0x0'));var util=require(_0xed0e('0x1'));var logger=require(_0xed0e('0x2'))('api');var moment=require(_0xed0e('0x3'));var BPromise=require('bluebird');var rp=require(_0xed0e('0x4'));var fs=require('fs');var path=require(_0xed0e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed0e('0x6'));module['exports']=function(_0x110f38,_0x2d4bf7){return _0x110f38[_0xed0e('0x7')](_0xed0e('0x8'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xed0e('0x9'),'collate':_0xed0e('0xa')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 2bf62ea..08e28e2 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 _0xe056=['code','message','info','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3e443c,_0x5e8497){var _0x330cff=function(_0x4da026){while(--_0x4da026){_0x3e443c['push'](_0x3e443c['shift']());}};_0x330cff(++_0x5e8497);}(_0xe056,0xdb));var _0x6e05=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0xe056[_0x33a694];return _0x41ff01;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e05('0x0'));var BPromise=require(_0x6e05('0x1'));var rs=require(_0x6e05('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e05('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e05('0x4'))(_0x6e05('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6e05('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x390bb6,_0x1c78eb,_0x5dacb2){return new BPromise(function(_0x1a54b7,_0x177b2c){return client[_0x6e05('0x7')](_0x390bb6,_0x5dacb2)[_0x6e05('0x8')](function(_0x13af56){logger['info'](_0x6e05('0x9'),_0x1c78eb,_0x6e05('0xa'));logger[_0x6e05('0xb')](_0x6e05('0xc'),_0x1c78eb,_0x6e05('0xa'),JSON[_0x6e05('0xd')](_0x13af56));if(_0x13af56['error']){if(_0x13af56[_0x6e05('0xe')][_0x6e05('0xf')]===0x1f4){logger[_0x6e05('0xe')]('SmsApplication,\x20%s,\x20%s',_0x1c78eb,_0x13af56[_0x6e05('0xe')][_0x6e05('0x10')]);return _0x177b2c(_0x13af56[_0x6e05('0xe')][_0x6e05('0x10')]);}logger[_0x6e05('0xe')]('SmsApplication,\x20%s,\x20%s',_0x1c78eb,_0x13af56[_0x6e05('0xe')][_0x6e05('0x10')]);return _0x1a54b7(_0x13af56['error']['message']);}else{logger[_0x6e05('0x11')](_0x6e05('0x9'),_0x1c78eb,_0x6e05('0xa'));_0x1a54b7(_0x13af56['result'][_0x6e05('0x10')]);}})['catch'](function(_0x3c3ef0){logger[_0x6e05('0xe')]('SmsApplication,\x20%s,\x20%s',_0x1c78eb,_0x3c3ef0);_0x177b2c(_0x3c3ef0);});});} \ No newline at end of file +var _0x431b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x431b,0x18d));var _0xb431=function(_0x2338fa,_0x80579a){_0x2338fa=_0x2338fa-0x0;var _0x42df9b=_0x431b[_0x2338fa];return _0x42df9b;};'use strict';var _=require(_0xb431('0x0'));var util=require(_0xb431('0x1'));var moment=require(_0xb431('0x2'));var BPromise=require('bluebird');var rs=require(_0xb431('0x3'));var fs=require('fs');var Redis=require(_0xb431('0x4'));var db=require(_0xb431('0x5'))['db'];var utils=require(_0xb431('0x6'));var logger=require(_0xb431('0x7'))(_0xb431('0x8'));var config=require(_0xb431('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb431('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fefc5,_0x58eb22,_0x5151a2){return new BPromise(function(_0x45adf2,_0x4a21dd){return client['request'](_0x2fefc5,_0x5151a2)[_0xb431('0xb')](function(_0x34cdb1){logger[_0xb431('0xc')](_0xb431('0xd'),_0x58eb22,_0xb431('0xe'));logger[_0xb431('0xf')](_0xb431('0x10'),_0x58eb22,'request\x20sent',JSON[_0xb431('0x11')](_0x34cdb1));if(_0x34cdb1[_0xb431('0x12')]){if(_0x34cdb1[_0xb431('0x12')]['code']===0x1f4){logger[_0xb431('0x12')](_0xb431('0xd'),_0x58eb22,_0x34cdb1[_0xb431('0x12')][_0xb431('0x13')]);return _0x4a21dd(_0x34cdb1[_0xb431('0x12')][_0xb431('0x13')]);}logger['error'](_0xb431('0xd'),_0x58eb22,_0x34cdb1['error'][_0xb431('0x13')]);return _0x45adf2(_0x34cdb1[_0xb431('0x12')][_0xb431('0x13')]);}else{logger[_0xb431('0xc')](_0xb431('0xd'),_0x58eb22,_0xb431('0xe'));_0x45adf2(_0x34cdb1['result'][_0xb431('0x13')]);}})['catch'](function(_0xc73c8a){logger[_0xb431('0x12')](_0xb431('0xd'),_0x58eb22,_0xc73c8a);_0x4a21dd(_0xc73c8a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index a7cc774..b7fe985 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 _0x3c81=['express','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','addTags','tracked','sms','update','delete','smsinteraction:destroy','destroy','/:id/tags','exports','multer','util','connect-timeout'];(function(_0x250a08,_0xd5dda4){var _0x4811e3=function(_0xf2ca59){while(--_0xf2ca59){_0x250a08['push'](_0x250a08['shift']());}};_0x4811e3(++_0xd5dda4);}(_0x3c81,0x102));var _0x13c8=function(_0x59eb70,_0x5b01ed){_0x59eb70=_0x59eb70-0x0;var _0x1b5442=_0x3c81[_0x59eb70];return _0x1b5442;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));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(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0x6')](_0x13c8('0xf'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0x11')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);router['post'](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x13')]);router[_0x13c8('0x11')]('/:id/tags',auth[_0x13c8('0x7')](),interaction['tracked']('sms','smsinteraction:addtags'),controller[_0x13c8('0x14')]);router['put'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),'smsinteraction:update'),controller[_0x13c8('0x17')]);router[_0x13c8('0x18')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),_0x13c8('0x19')),controller[_0x13c8('0x1a')]);router[_0x13c8('0x18')](_0x13c8('0x1b'),auth[_0x13c8('0x7')](),controller['removeTags']);module[_0x13c8('0x1c')]=router; \ No newline at end of file +var _0x087b=['sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x2886e2,_0x95fe23){var _0x267ec6=function(_0x539da4){while(--_0x539da4){_0x2886e2['push'](_0x2886e2['shift']());}};_0x267ec6(++_0x95fe23);}(_0x087b,0x11a));var _0xb087=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x087b[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/messages',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x12')]('/',auth['isAuthenticated'](),controller[_0xb087('0x13')]);router[_0xb087('0x12')](_0xb087('0x14'),auth['isAuthenticated'](),controller[_0xb087('0x15')]);router[_0xb087('0x12')](_0xb087('0x16'),auth[_0xb087('0x9')](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x19')),controller[_0xb087('0x1a')]);router[_0xb087('0x1b')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),'smsinteraction:update'),controller[_0xb087('0x1c')]);router[_0xb087('0x1d')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x1e')),controller[_0xb087('0x1f')]);router['delete'](_0xb087('0x16'),auth[_0xb087('0x9')](),controller[_0xb087('0x20')]);module[_0xb087('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 5fc1812..93ae953 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 _0x3bd7=['BOOLEAN','DATE','STRING','out','exports'];(function(_0xf1b134,_0xb399dd){var _0x139dbb=function(_0xe7a88d){while(--_0xe7a88d){_0xf1b134['push'](_0xf1b134['shift']());}};_0x139dbb(++_0xb399dd);}(_0x3bd7,0x199));var _0x73bd=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x3bd7[_0x454e6d];return _0x4bc294;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x73bd('0x0')]={'closed':{'type':Sequelize[_0x73bd('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x73bd('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x73bd('0x3')]},'thirdDisposition':{'type':Sequelize[_0x73bd('0x3')]},'note':{'type':Sequelize[_0x73bd('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x73bd('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x73bd('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x73bd('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x73bd('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2171=['out','moment','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x2171,0x143));var _0x1217=function(_0x4396f7,_0x4b098c){_0x4396f7=_0x4396f7-0x0;var _0x3160cb=_0x2171[_0x4396f7];return _0x3160cb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1217('0x0'));module[_0x1217('0x1')]={'closed':{'type':Sequelize[_0x1217('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1217('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1217('0x3')]},'phone':{'type':Sequelize[_0x1217('0x3')]},'read1stAt':{'type':Sequelize[_0x1217('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1217('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1217('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1217('0x5')]('in',_0x1217('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 6786db0..7e06528 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 _0xfcd2=['CmContact','firstName','Messages','read','Account','get','mkdirSync','Sms','Owner','createdAt','closed','closedAt','disposition','direction','out','Contact','lastName','value','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','moment','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','stack','name','send','map','rawAttributes','type','key','getOptions','findAll','sms','query','catch','show','params','model','keys','SmsInteraction','intersection','fields','attributes','includeAll','merge','find','create','body','destroy','describe','addMessage','SmsMessage','ids','getMessages','filters','nolimit','order','where','filter','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','toString','join','server','tmp','transcript-%d-%s.zip','push','User','fullname'];(function(_0x560971,_0xc9034d){var _0x4565fa=function(_0x3a5394){while(--_0x3a5394){_0x560971['push'](_0x560971['shift']());}};_0x4565fa(++_0xc9034d);}(_0xfcd2,0x1d8));var _0x2fcd=function(_0x14f585,_0x4bae8c){_0x14f585=_0x14f585-0x0;var _0x3003de=_0xfcd2[_0x14f585];return _0x3003de;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x2fcd('0x0'));var BPromise=require('bluebird');var util=require(_0x2fcd('0x1'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2fcd('0x2'));var Redis=require(_0x2fcd('0x3'));var interaction=require(_0x2fcd('0x4'));var qs=require(_0x2fcd('0x5'));var pdf=require(_0x2fcd('0x6'));var logger=require('../../config/logger')(_0x2fcd('0x7'));var config=require(_0x2fcd('0x8'));var db=require(_0x2fcd('0x9'))['db'];config[_0x2fcd('0xa')]=_[_0x2fcd('0xb')](config[_0x2fcd('0xa')],{'host':_0x2fcd('0xc'),'port':0x18eb});var socket=require(_0x2fcd('0xd'))(new Redis(config[_0x2fcd('0xa')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x5bb7d6,_0x402667){_0x402667=_0x402667||0xcc;return function(_0x826315){if(_0x826315){return _0x5bb7d6[_0x2fcd('0xe')](_0x402667);}return _0x5bb7d6[_0x2fcd('0xf')](_0x402667)['end']();};}function respondWithResult(_0x38458c,_0x5726db){_0x5726db=_0x5726db||0xc8;return function(_0x8279){if(_0x8279){return _0x38458c[_0x2fcd('0xf')](_0x5726db)[_0x2fcd('0x10')](_0x8279);}};}function respondWithFilteredResult(_0x3e97d7,_0x26d59b){return function(_0x11abdc){if(_0x11abdc){var _0x4f2fce=typeof _0x26d59b[_0x2fcd('0x11')]===_0x2fcd('0x12')&&typeof _0x26d59b[_0x2fcd('0x13')]===_0x2fcd('0x12');var _0x2dc214=_0x11abdc[_0x2fcd('0x14')];var _0x42916e=_0x4f2fce?0x0:_0x26d59b['offset'];var _0x52b56c=_0x4f2fce?_0x11abdc[_0x2fcd('0x14')]:_0x26d59b['offset']+_0x26d59b[_0x2fcd('0x13')];var _0x28e4b5;if(_0x52b56c>=_0x2dc214){_0x52b56c=_0x2dc214;_0x28e4b5=0xc8;}else{_0x28e4b5=0xce;}_0x3e97d7[_0x2fcd('0xf')](_0x28e4b5);return _0x3e97d7[_0x2fcd('0x15')](_0x2fcd('0x16'),_0x42916e+'-'+_0x52b56c+'/'+_0x2dc214)['json'](_0x11abdc);}return null;};}function saveUpdates(_0x51ef8a){return function(_0x43ca77){if(_0x43ca77){return _0x43ca77[_0x2fcd('0x17')](_0x51ef8a)['then'](function(_0x308b84){return _0x308b84;});}return null;};}function removeEntity(_0x170714){return function(_0x2d291c){if(_0x2d291c){return _0x2d291c['destroy']()[_0x2fcd('0x18')](function(){_0x170714[_0x2fcd('0xf')](0xcc)[_0x2fcd('0x19')]();});}};}function handleEntityNotFound(_0x3d1d3e){return function(_0x1e64c3){if(!_0x1e64c3){_0x3d1d3e[_0x2fcd('0xe')](0x194);}return _0x1e64c3;};}function handleError(_0x328c4c,_0x4f2d85){_0x4f2d85=_0x4f2d85||0x1f4;return function(_0x18fa5c){logger['error'](_0x18fa5c[_0x2fcd('0x1a')]);if(_0x18fa5c[_0x2fcd('0x1b')]){delete _0x18fa5c['name'];}_0x328c4c[_0x2fcd('0xf')](_0x4f2d85)[_0x2fcd('0x1c')](_0x18fa5c);};}exports['index']=function(_0x39ce8d,_0x1391ca){var _0x4fe7f7={};var _0x1fca7e=_[_0x2fcd('0x1d')](db['SmsInteraction'][_0x2fcd('0x1e')],function(_0x36d760){return{'name':_0x36d760['fieldName'],'type':_0x36d760[_0x2fcd('0x1f')][_0x2fcd('0x20')]};});_0x4fe7f7=qs[_0x2fcd('0x21')](_0x1fca7e,_0x39ce8d);return interaction[_0x2fcd('0x22')](_0x2fcd('0x23'),_0x39ce8d[_0x2fcd('0x24')],_0x39ce8d['user'],_0x4fe7f7,_0x1fca7e)['then'](respondWithFilteredResult(_0x1391ca,_0x4fe7f7))[_0x2fcd('0x25')](handleError(_0x1391ca,null));};exports[_0x2fcd('0x26')]=function(_0x5cb943,_0x4e1d63){var _0x5d5c8c={'raw':![],'where':{'id':_0x5cb943[_0x2fcd('0x27')]['id']}},_0x5be025={};_0x5be025[_0x2fcd('0x28')]=_[_0x2fcd('0x29')](db[_0x2fcd('0x2a')]['rawAttributes']);_0x5be025[_0x2fcd('0x24')]=_['keys'](_0x5cb943[_0x2fcd('0x24')]);_0x5be025['filters']=_[_0x2fcd('0x2b')](_0x5be025[_0x2fcd('0x28')],_0x5be025['query']);_0x5d5c8c['attributes']=_[_0x2fcd('0x2b')](_0x5be025[_0x2fcd('0x28')],qs[_0x2fcd('0x2c')](_0x5cb943[_0x2fcd('0x24')][_0x2fcd('0x2c')]));_0x5d5c8c[_0x2fcd('0x2d')]=_0x5d5c8c['attributes']['length']?_0x5d5c8c[_0x2fcd('0x2d')]:_0x5be025[_0x2fcd('0x28')];if(_0x5cb943[_0x2fcd('0x24')][_0x2fcd('0x2e')]){_0x5d5c8c['include']=[{'all':!![]}];}_0x5d5c8c=_[_0x2fcd('0x2f')]({},_0x5d5c8c,_0x5cb943['options']);return db[_0x2fcd('0x2a')][_0x2fcd('0x30')](_0x5d5c8c)['then'](handleEntityNotFound(_0x4e1d63,null))[_0x2fcd('0x18')](respondWithResult(_0x4e1d63,null))[_0x2fcd('0x25')](handleError(_0x4e1d63,null));};exports['create']=function(_0x5ebc76,_0x56fbc1){return db[_0x2fcd('0x2a')][_0x2fcd('0x31')](_0x5ebc76['body'],{})[_0x2fcd('0x18')](respondWithResult(_0x56fbc1,0xc9))[_0x2fcd('0x25')](handleError(_0x56fbc1,null));};exports[_0x2fcd('0x17')]=function(_0x444848,_0x1ec67d){if(_0x444848[_0x2fcd('0x32')]['id']){delete _0x444848[_0x2fcd('0x32')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x444848['params']['id']}})['then'](handleEntityNotFound(_0x1ec67d,null))['then'](saveUpdates(_0x444848[_0x2fcd('0x32')],null))[_0x2fcd('0x18')](respondWithResult(_0x1ec67d,null))['catch'](handleError(_0x1ec67d,null));};exports[_0x2fcd('0x33')]=function(_0x109ca9,_0x15eb79){return db[_0x2fcd('0x2a')][_0x2fcd('0x30')]({'where':{'id':_0x109ca9['params']['id']}})[_0x2fcd('0x18')](handleEntityNotFound(_0x15eb79,null))[_0x2fcd('0x18')](removeEntity(_0x15eb79,null))['catch'](handleError(_0x15eb79,null));};exports[_0x2fcd('0x34')]=function(_0x4f00d8,_0x2f10da){return db[_0x2fcd('0x2a')]['describe']()[_0x2fcd('0x18')](respondWithResult(_0x2f10da,null))[_0x2fcd('0x25')](handleError(_0x2f10da,null));};exports[_0x2fcd('0x35')]=function(_0x1a7b2e,_0x2fc109){return db[_0x2fcd('0x36')][_0x2fcd('0x30')]({'where':{'id':_0x1a7b2e[_0x2fcd('0x27')]['id']}})[_0x2fcd('0x18')](handleEntityNotFound(_0x2fc109,null))[_0x2fcd('0x18')](function(_0x25a0a0){if(_0x25a0a0){return _0x25a0a0[_0x2fcd('0x35')](_0x1a7b2e[_0x2fcd('0x32')][_0x2fcd('0x37')],_['omit'](_0x1a7b2e['body'],[_0x2fcd('0x37'),'id'])||{});}})[_0x2fcd('0x18')](respondWithResult(_0x2fc109,null))[_0x2fcd('0x25')](handleError(_0x2fc109,null));};exports[_0x2fcd('0x38')]=function(_0x4055a9,_0xe7009b){var _0x353ce1={'raw':![],'where':{}};var _0x3b396d={};var _0x93b15f={'count':0x0,'rows':[]};return db[_0x2fcd('0x2a')]['findOne']({'where':{'id':_0x4055a9[_0x2fcd('0x27')]['id']}})[_0x2fcd('0x18')](handleEntityNotFound(_0xe7009b,null))['then'](function(_0x5ef8e0){if(_0x5ef8e0){_0x3b396d[_0x2fcd('0x28')]=_[_0x2fcd('0x29')](db[_0x2fcd('0x36')][_0x2fcd('0x1e')]);_0x3b396d[_0x2fcd('0x24')]=_[_0x2fcd('0x29')](_0x4055a9[_0x2fcd('0x24')]);_0x3b396d[_0x2fcd('0x39')]=_[_0x2fcd('0x2b')](_0x3b396d[_0x2fcd('0x28')],_0x3b396d[_0x2fcd('0x24')]);_0x353ce1[_0x2fcd('0x2d')]=_[_0x2fcd('0x2b')](_0x3b396d['model'],qs['fields'](_0x4055a9[_0x2fcd('0x24')][_0x2fcd('0x2c')]));_0x353ce1[_0x2fcd('0x2d')]=_0x353ce1[_0x2fcd('0x2d')]['length']?_0x353ce1[_0x2fcd('0x2d')]:_0x3b396d['model'];if(!_0x4055a9[_0x2fcd('0x24')]['hasOwnProperty'](_0x2fcd('0x3a'))){_0x353ce1[_0x2fcd('0x13')]=qs[_0x2fcd('0x13')](_0x4055a9[_0x2fcd('0x24')][_0x2fcd('0x13')]);_0x353ce1[_0x2fcd('0x11')]=qs[_0x2fcd('0x11')](_0x4055a9[_0x2fcd('0x24')][_0x2fcd('0x11')]);}_0x353ce1[_0x2fcd('0x3b')]=qs['sort'](_0x4055a9['query']['sort']);_0x353ce1['where']=qs[_0x2fcd('0x39')](_['pick'](_0x4055a9[_0x2fcd('0x24')],_0x3b396d['filters']));_0x353ce1[_0x2fcd('0x3c')]['SmsInteractionId']=_0x5ef8e0['id'];if(_0x4055a9['query'][_0x2fcd('0x3d')]){_0x353ce1['where']=_[_0x2fcd('0x2f')](_0x353ce1[_0x2fcd('0x3c')],{'$or':_[_0x2fcd('0x1d')](_0x353ce1[_0x2fcd('0x2d')],function(_0x1b0591){var _0xb2a4a6={};_0xb2a4a6[_0x1b0591]={'$like':'%'+_0x4055a9[_0x2fcd('0x24')][_0x2fcd('0x3d')]+'%'};return _0xb2a4a6;})});}if(_0x4055a9['query']['$gte']){var _0x1d9070=_0x4055a9['query']['$gte'][_0x2fcd('0x3e')](',');var _0x44d371={};_0x44d371[_0x1d9070[0x0]]={'$gte':moment(_0x1d9070[0x1])[_0x2fcd('0x3f')](_0x2fcd('0x40'))};_0x353ce1[_0x2fcd('0x3c')]=_[_0x2fcd('0x2f')](_0x353ce1['where'],_0x44d371);}_0x353ce1=_['merge']({},_0x353ce1,_0x4055a9['options']);return db['SmsMessage'][_0x2fcd('0x14')]({'where':_0x353ce1['where']})['then'](function(_0x2fc7b1){_0x93b15f[_0x2fcd('0x14')]=_0x2fc7b1;if(_0x4055a9['query'][_0x2fcd('0x2e')]){_0x353ce1[_0x2fcd('0x41')]=[{'all':!![]}];}return db[_0x2fcd('0x36')]['findAll'](_0x353ce1);})[_0x2fcd('0x18')](function(_0x585d3e){_0x93b15f[_0x2fcd('0x42')]=_0x585d3e;return _0x93b15f;});}})['then'](respondWithFilteredResult(_0xe7009b,_0x353ce1))[_0x2fcd('0x25')](handleError(_0xe7009b,null));};exports['addTags']=function(_0x1d64b2,_0x2ef744){return db[_0x2fcd('0x2a')][_0x2fcd('0x30')]({'where':{'id':_0x1d64b2[_0x2fcd('0x27')]['id']}})[_0x2fcd('0x18')](handleEntityNotFound(_0x2ef744,null))[_0x2fcd('0x18')](function(_0x251d4a){if(_0x251d4a){return _0x251d4a[_0x2fcd('0x43')](_0x1d64b2['body'][_0x2fcd('0x37')],_['omit'](_0x1d64b2[_0x2fcd('0x32')],['ids','id'])||{})[_0x2fcd('0x44')](function(){return db[_0x2fcd('0x45')]['findAll']({'attributes':['id',_0x2fcd('0x1b'),_0x2fcd('0x46')],'where':{'id':_0x1d64b2[_0x2fcd('0x32')][_0x2fcd('0x37')]}});})[_0x2fcd('0x18')](function(_0x5efaf8){socket[_0x2fcd('0x47')](_0x2fcd('0x48'),{'id':Number(_0x1d64b2['params']['id']),'tags':_0x5efaf8||[]});return{'id':Number(_0x1d64b2['params']['id']),'tags':_0x5efaf8||[]};});}})[_0x2fcd('0x18')](respondWithResult(_0x2ef744,null))[_0x2fcd('0x25')](handleError(_0x2ef744,null));};exports[_0x2fcd('0x49')]=function(_0x221036,_0xd50511){return db['SmsInteraction'][_0x2fcd('0x30')]({'where':{'id':_0x221036['params']['id']}})[_0x2fcd('0x18')](handleEntityNotFound(_0xd50511,null))[_0x2fcd('0x18')](function(_0x13a720){if(_0x13a720){return _0x13a720[_0x2fcd('0x49')](_0x221036[_0x2fcd('0x24')][_0x2fcd('0x37')]);}})[_0x2fcd('0x18')](respondWithStatusCode(_0xd50511,null))[_0x2fcd('0x25')](handleError(_0xd50511,null));};exports[_0x2fcd('0x4a')]=function(_0x5d28af,_0x44e03c){var _0x59291b=moment()['unix']()[_0x2fcd('0x4b')]();var _0x6c9482=path[_0x2fcd('0x4c')](config['root'],_0x2fcd('0x4d'),'files',_0x2fcd('0x4e'));var _0x5ed949=path[_0x2fcd('0x4c')](_0x6c9482,_0x59291b);var _0x3b7a38=util[_0x2fcd('0x3f')](_0x2fcd('0x4f'),_0x5d28af[_0x2fcd('0x27')]['id'],_0x59291b);var _0x3e6662=path[_0x2fcd('0x4c')](_0x6c9482,_0x3b7a38);var _0x41bff8=[];_0x41bff8[_0x2fcd('0x50')]({'model':db[_0x2fcd('0x51')],'as':'User','attributes':['id',_0x2fcd('0x52')],'raw':!![]});_0x41bff8[_0x2fcd('0x50')]({'model':db[_0x2fcd('0x53')],'as':'Contact','attributes':['id',_0x2fcd('0x54'),'lastName'],'raw':!![]});var _0x5e8eed=[{'model':db[_0x2fcd('0x36')],'as':_0x2fcd('0x55'),'attributes':['id','body','createdAt','direction','secret',_0x2fcd('0x56')],'include':_0x41bff8}];_0x5e8eed[_0x2fcd('0x50')]({'model':db['SmsAccount'],'as':_0x2fcd('0x57'),'attributes':['id',_0x2fcd('0x1b')]});_0x5e8eed[_0x2fcd('0x50')]({'model':db[_0x2fcd('0x51')],'as':'Owner','attributes':['id',_0x2fcd('0x52')]});return db[_0x2fcd('0x2a')][_0x2fcd('0x30')]({'where':{'id':_0x5d28af[_0x2fcd('0x27')]['id']},'include':_0x5e8eed})['then'](handleEntityNotFound(_0x44e03c,null))['then'](function(_0x5d6f65){if(_0x5d6f65){var _0x496f92=_0x5d6f65[_0x2fcd('0x58')]({'plain':!![]});fs[_0x2fcd('0x59')](_0x5ed949);var _0x3848c0={'channel':_0x2fcd('0x5a'),'account':_0x496f92[_0x2fcd('0x57')][_0x2fcd('0x1b')],'agent':_0x496f92[_0x2fcd('0x5b')]?_0x496f92[_0x2fcd('0x5b')][_0x2fcd('0x52')]:'N.A.','createdAt':moment(_0x496f92[_0x2fcd('0x5c')])[_0x2fcd('0x3f')](_0x2fcd('0x40'))[_0x2fcd('0x4b')](),'closedAt':_0x496f92[_0x2fcd('0x5d')]?moment(_0x496f92[_0x2fcd('0x5e')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x496f92[_0x2fcd('0x5f')],'messages':_(_0x496f92[_0x2fcd('0x55')])['filter']({'secret':![]})[_0x2fcd('0x1d')](function(_0x57ad45){return{'date':moment(_0x57ad45[_0x2fcd('0x5c')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x2fcd('0x4b')](),'sender':_0x57ad45[_0x2fcd('0x60')]===_0x2fcd('0x61')?_0x57ad45['User']?_0x57ad45[_0x2fcd('0x51')][_0x2fcd('0x52')]:'System':_0x57ad45[_0x2fcd('0x62')][_0x2fcd('0x54')]+(_0x57ad45['Contact'][_0x2fcd('0x63')]?'\x20'+_0x57ad45[_0x2fcd('0x62')][_0x2fcd('0x63')]:''),'body':_0x57ad45[_0x2fcd('0x32')],'direction':_0x57ad45[_0x2fcd('0x60')]===_0x2fcd('0x61')?'A':'C','secret':_0x57ad45['secret'],'read':_0x57ad45[_0x2fcd('0x56')]};})[_0x2fcd('0x64')]()};return ejs[_0x2fcd('0x65')](path[_0x2fcd('0x4c')](config[_0x2fcd('0x66')],'server',_0x2fcd('0x67'),_0x2fcd('0x68')),{'interaction':_0x3848c0})[_0x2fcd('0x18')](function(_0x26ab5c){var _0x448e2d=path['join'](_0x5ed949,_0x2fcd('0x69')+_0x496f92['id']+'-'+_0x59291b+_0x2fcd('0x6a'));var _0x934792={'path':_0x448e2d,'channel':'Sms','interactionId':_0x496f92['id']};return pdf[_0x2fcd('0x6b')](_0x26ab5c,_0x934792);})[_0x2fcd('0x18')](function(){return new BPromise(function(_0x47f8d,_0x3d468e){zipdir(_0x5ed949,{'saveTo':_0x3e6662},function(_0x1efab5,_0x1bdfee){if(_0x1efab5)return _0x3d468e(_0x1efab5);return _0x47f8d(_0x1bdfee);});})[_0x2fcd('0x18')](function(){return new BPromise(function(_0x6f56aa,_0x507d10){rimraf(_0x5ed949,function(_0x30efe9){if(_0x30efe9)_0x507d10(_0x30efe9);return _0x6f56aa();});});})[_0x2fcd('0x18')](function(){return _0x44e03c[_0x2fcd('0x4a')](_0x3e6662,_0x3b7a38,function(_0x222813){if(_0x222813){console[_0x2fcd('0x6c')](_0x2fcd('0x6d'),_0x222813);}else{fs[_0x2fcd('0x6e')](_0x3e6662);}});});});}else{return _0x44e03c[_0x2fcd('0xe')](0xc8);}})['catch'](handleError(_0x44e03c,null));}; \ No newline at end of file +var _0x4aeb=['fields','includeAll','include','merge','options','body','find','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','filters','length','nolimit','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','color','smsInteractionTags:save','removeTags','unix','toString','join','files','tmp','push','User','fullname','lastName','Messages','secret','read','SmsAccount','Owner','mkdirSync','Sms','Account','N.A.','closed','closedAt','disposition','createdAt','direction','out','System','Contact','firstName','value','renderFile','root','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','../../components/interaction/service','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','limit','count','offset','set','update','then','destroy','error','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','query','catch','show','params','model','keys','intersection','attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4aeb,0x131));var _0xb4ae=function(_0x41b49d,_0x2379c4){_0x41b49d=_0x41b49d-0x0;var _0x158c70=_0x4aeb[_0x41b49d];return _0x158c70;};'use strict';var rimraf=require(_0xb4ae('0x0'));var zipdir=require(_0xb4ae('0x1'));var moment=require(_0xb4ae('0x2'));var BPromise=require(_0xb4ae('0x3'));var util=require('util');var path=require(_0xb4ae('0x4'));var ejs=require(_0xb4ae('0x5'));var fs=require('fs');var _=require(_0xb4ae('0x6'));var Redis=require('ioredis');var interaction=require(_0xb4ae('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')('api');var config=require(_0xb4ae('0x8'));var db=require(_0xb4ae('0x9'))['db'];config['redis']=_[_0xb4ae('0xa')](config[_0xb4ae('0xb')],{'host':_0xb4ae('0xc'),'port':0x18eb});var socket=require(_0xb4ae('0xd'))(new Redis(config[_0xb4ae('0xb')]));require(_0xb4ae('0xe'))[_0xb4ae('0xf')](socket);function respondWithStatusCode(_0x88e036,_0x25b46d){_0x25b46d=_0x25b46d||0xcc;return function(_0x401087){if(_0x401087){return _0x88e036[_0xb4ae('0x10')](_0x25b46d);}return _0x88e036[_0xb4ae('0x11')](_0x25b46d)[_0xb4ae('0x12')]();};}function respondWithResult(_0x2084c1,_0x5eadd5){_0x5eadd5=_0x5eadd5||0xc8;return function(_0x520399){if(_0x520399){return _0x2084c1[_0xb4ae('0x11')](_0x5eadd5)[_0xb4ae('0x13')](_0x520399);}};}function respondWithFilteredResult(_0x545b5b,_0x109779){return function(_0x492253){if(_0x492253){var _0x6ce4fc=typeof _0x109779['offset']==='undefined'&&typeof _0x109779[_0xb4ae('0x14')]==='undefined';var _0x230ea6=_0x492253[_0xb4ae('0x15')];var _0x171e44=_0x6ce4fc?0x0:_0x109779[_0xb4ae('0x16')];var _0x33f028=_0x6ce4fc?_0x492253[_0xb4ae('0x15')]:_0x109779['offset']+_0x109779[_0xb4ae('0x14')];var _0x1d6207;if(_0x33f028>=_0x230ea6){_0x33f028=_0x230ea6;_0x1d6207=0xc8;}else{_0x1d6207=0xce;}_0x545b5b[_0xb4ae('0x11')](_0x1d6207);return _0x545b5b[_0xb4ae('0x17')]('Content-Range',_0x171e44+'-'+_0x33f028+'/'+_0x230ea6)['json'](_0x492253);}return null;};}function saveUpdates(_0x52d8a6){return function(_0x5288a5){if(_0x5288a5){return _0x5288a5[_0xb4ae('0x18')](_0x52d8a6)[_0xb4ae('0x19')](function(_0x25d486){return _0x25d486;});}return null;};}function removeEntity(_0x31cdac){return function(_0x1c2adf){if(_0x1c2adf){return _0x1c2adf[_0xb4ae('0x1a')]()[_0xb4ae('0x19')](function(){_0x31cdac[_0xb4ae('0x11')](0xcc)[_0xb4ae('0x12')]();});}};}function handleEntityNotFound(_0x21f49e){return function(_0x51ea32){if(!_0x51ea32){_0x21f49e[_0xb4ae('0x10')](0x194);}return _0x51ea32;};}function handleError(_0x5e5985,_0x3533ce){_0x3533ce=_0x3533ce||0x1f4;return function(_0x487cd5){logger[_0xb4ae('0x1b')](_0x487cd5['stack']);if(_0x487cd5['name']){delete _0x487cd5[_0xb4ae('0x1c')];}_0x5e5985[_0xb4ae('0x11')](_0x3533ce)[_0xb4ae('0x1d')](_0x487cd5);};}exports[_0xb4ae('0x1e')]=function(_0xf74443,_0x128a7d){var _0x3b9931={};var _0x3eb670=_[_0xb4ae('0x1f')](db[_0xb4ae('0x20')][_0xb4ae('0x21')],function(_0x343437){return{'name':_0x343437[_0xb4ae('0x22')],'type':_0x343437[_0xb4ae('0x23')]['key']};});_0x3b9931=qs[_0xb4ae('0x24')](_0x3eb670,_0xf74443);return interaction[_0xb4ae('0x25')]('sms',_0xf74443[_0xb4ae('0x26')],_0xf74443['user'],_0x3b9931,_0x3eb670)[_0xb4ae('0x19')](respondWithFilteredResult(_0x128a7d,_0x3b9931))[_0xb4ae('0x27')](handleError(_0x128a7d,null));};exports[_0xb4ae('0x28')]=function(_0xfbf65c,_0x76efd8){var _0x3f76c3={'raw':![],'where':{'id':_0xfbf65c[_0xb4ae('0x29')]['id']}},_0x4c5d18={};_0x4c5d18[_0xb4ae('0x2a')]=_['keys'](db[_0xb4ae('0x20')][_0xb4ae('0x21')]);_0x4c5d18[_0xb4ae('0x26')]=_[_0xb4ae('0x2b')](_0xfbf65c['query']);_0x4c5d18['filters']=_[_0xb4ae('0x2c')](_0x4c5d18[_0xb4ae('0x2a')],_0x4c5d18[_0xb4ae('0x26')]);_0x3f76c3[_0xb4ae('0x2d')]=_[_0xb4ae('0x2c')](_0x4c5d18[_0xb4ae('0x2a')],qs[_0xb4ae('0x2e')](_0xfbf65c['query']['fields']));_0x3f76c3[_0xb4ae('0x2d')]=_0x3f76c3['attributes']['length']?_0x3f76c3[_0xb4ae('0x2d')]:_0x4c5d18['model'];if(_0xfbf65c['query'][_0xb4ae('0x2f')]){_0x3f76c3[_0xb4ae('0x30')]=[{'all':!![]}];}_0x3f76c3=_[_0xb4ae('0x31')]({},_0x3f76c3,_0xfbf65c[_0xb4ae('0x32')]);return db[_0xb4ae('0x20')]['find'](_0x3f76c3)[_0xb4ae('0x19')](handleEntityNotFound(_0x76efd8,null))['then'](respondWithResult(_0x76efd8,null))[_0xb4ae('0x27')](handleError(_0x76efd8,null));};exports['create']=function(_0xc1ce5,_0x3d4d6c){return db['SmsInteraction']['create'](_0xc1ce5['body'],{})['then'](respondWithResult(_0x3d4d6c,0xc9))[_0xb4ae('0x27')](handleError(_0x3d4d6c,null));};exports['update']=function(_0x51a664,_0x5831bd){if(_0x51a664['body']['id']){delete _0x51a664[_0xb4ae('0x33')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x51a664[_0xb4ae('0x29')]['id']}})[_0xb4ae('0x19')](handleEntityNotFound(_0x5831bd,null))[_0xb4ae('0x19')](saveUpdates(_0x51a664[_0xb4ae('0x33')],null))['then'](respondWithResult(_0x5831bd,null))['catch'](handleError(_0x5831bd,null));};exports[_0xb4ae('0x1a')]=function(_0x5667e7,_0x4974e5){return db[_0xb4ae('0x20')][_0xb4ae('0x34')]({'where':{'id':_0x5667e7['params']['id']}})[_0xb4ae('0x19')](handleEntityNotFound(_0x4974e5,null))[_0xb4ae('0x19')](removeEntity(_0x4974e5,null))['catch'](handleError(_0x4974e5,null));};exports[_0xb4ae('0x35')]=function(_0xf2dc14,_0x7d13b1){return db['SmsInteraction'][_0xb4ae('0x35')]()['then'](respondWithResult(_0x7d13b1,null))[_0xb4ae('0x27')](handleError(_0x7d13b1,null));};exports[_0xb4ae('0x36')]=function(_0x4d685d,_0x3d1cbd){return db[_0xb4ae('0x37')][_0xb4ae('0x34')]({'where':{'id':_0x4d685d[_0xb4ae('0x29')]['id']}})[_0xb4ae('0x19')](handleEntityNotFound(_0x3d1cbd,null))['then'](function(_0xd359da){if(_0xd359da){return _0xd359da['addMessage'](_0x4d685d[_0xb4ae('0x33')][_0xb4ae('0x38')],_[_0xb4ae('0x39')](_0x4d685d['body'],[_0xb4ae('0x38'),'id'])||{});}})[_0xb4ae('0x19')](respondWithResult(_0x3d1cbd,null))[_0xb4ae('0x27')](handleError(_0x3d1cbd,null));};exports[_0xb4ae('0x3a')]=function(_0x544952,_0x1e8e3f){var _0x1e7cc4={'raw':![],'where':{}};var _0x687eb4={};var _0x51b301={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xb4ae('0x3b')]({'where':{'id':_0x544952[_0xb4ae('0x29')]['id']}})['then'](handleEntityNotFound(_0x1e8e3f,null))[_0xb4ae('0x19')](function(_0x10c28a){if(_0x10c28a){_0x687eb4[_0xb4ae('0x2a')]=_['keys'](db[_0xb4ae('0x37')]['rawAttributes']);_0x687eb4['query']=_['keys'](_0x544952[_0xb4ae('0x26')]);_0x687eb4[_0xb4ae('0x3c')]=_[_0xb4ae('0x2c')](_0x687eb4[_0xb4ae('0x2a')],_0x687eb4[_0xb4ae('0x26')]);_0x1e7cc4['attributes']=_[_0xb4ae('0x2c')](_0x687eb4[_0xb4ae('0x2a')],qs[_0xb4ae('0x2e')](_0x544952[_0xb4ae('0x26')][_0xb4ae('0x2e')]));_0x1e7cc4['attributes']=_0x1e7cc4[_0xb4ae('0x2d')][_0xb4ae('0x3d')]?_0x1e7cc4[_0xb4ae('0x2d')]:_0x687eb4[_0xb4ae('0x2a')];if(!_0x544952[_0xb4ae('0x26')]['hasOwnProperty'](_0xb4ae('0x3e'))){_0x1e7cc4['limit']=qs[_0xb4ae('0x14')](_0x544952[_0xb4ae('0x26')][_0xb4ae('0x14')]);_0x1e7cc4[_0xb4ae('0x16')]=qs[_0xb4ae('0x16')](_0x544952['query'][_0xb4ae('0x16')]);}_0x1e7cc4['order']=qs['sort'](_0x544952[_0xb4ae('0x26')][_0xb4ae('0x3f')]);_0x1e7cc4[_0xb4ae('0x40')]=qs[_0xb4ae('0x3c')](_[_0xb4ae('0x41')](_0x544952[_0xb4ae('0x26')],_0x687eb4[_0xb4ae('0x3c')]));_0x1e7cc4['where']['SmsInteractionId']=_0x10c28a['id'];if(_0x544952[_0xb4ae('0x26')][_0xb4ae('0x42')]){_0x1e7cc4[_0xb4ae('0x40')]=_[_0xb4ae('0x31')](_0x1e7cc4['where'],{'$or':_[_0xb4ae('0x1f')](_0x1e7cc4[_0xb4ae('0x2d')],function(_0x456f6d){var _0x65e7ed={};_0x65e7ed[_0x456f6d]={'$like':'%'+_0x544952[_0xb4ae('0x26')]['filter']+'%'};return _0x65e7ed;})});}if(_0x544952[_0xb4ae('0x26')][_0xb4ae('0x43')]){var _0x59b9f5=_0x544952[_0xb4ae('0x26')][_0xb4ae('0x43')][_0xb4ae('0x44')](',');var _0x4d7bc4={};_0x4d7bc4[_0x59b9f5[0x0]]={'$gte':moment(_0x59b9f5[0x1])[_0xb4ae('0x45')](_0xb4ae('0x46'))};_0x1e7cc4[_0xb4ae('0x40')]=_['merge'](_0x1e7cc4[_0xb4ae('0x40')],_0x4d7bc4);}_0x1e7cc4=_[_0xb4ae('0x31')]({},_0x1e7cc4,_0x544952[_0xb4ae('0x32')]);return db[_0xb4ae('0x37')][_0xb4ae('0x15')]({'where':_0x1e7cc4['where']})[_0xb4ae('0x19')](function(_0x7e2a47){_0x51b301['count']=_0x7e2a47;if(_0x544952[_0xb4ae('0x26')][_0xb4ae('0x2f')]){_0x1e7cc4['include']=[{'all':!![]}];}return db[_0xb4ae('0x37')][_0xb4ae('0x25')](_0x1e7cc4);})[_0xb4ae('0x19')](function(_0x1dd16c){_0x51b301[_0xb4ae('0x47')]=_0x1dd16c;return _0x51b301;});}})[_0xb4ae('0x19')](respondWithFilteredResult(_0x1e8e3f,_0x1e7cc4))[_0xb4ae('0x27')](handleError(_0x1e8e3f,null));};exports['addTags']=function(_0x19946c,_0x2f8c5e){return db['SmsInteraction'][_0xb4ae('0x34')]({'where':{'id':_0x19946c['params']['id']}})[_0xb4ae('0x19')](handleEntityNotFound(_0x2f8c5e,null))[_0xb4ae('0x19')](function(_0x47323e){if(_0x47323e){return _0x47323e[_0xb4ae('0x48')](_0x19946c[_0xb4ae('0x33')][_0xb4ae('0x38')],_['omit'](_0x19946c[_0xb4ae('0x33')],[_0xb4ae('0x38'),'id'])||{})[_0xb4ae('0x49')](function(){return db['Tag'][_0xb4ae('0x25')]({'attributes':['id',_0xb4ae('0x1c'),_0xb4ae('0x4a')],'where':{'id':_0x19946c[_0xb4ae('0x33')][_0xb4ae('0x38')]}});})[_0xb4ae('0x19')](function(_0x4ed103){socket['emit'](_0xb4ae('0x4b'),{'id':Number(_0x19946c[_0xb4ae('0x29')]['id']),'tags':_0x4ed103||[]});return{'id':Number(_0x19946c[_0xb4ae('0x29')]['id']),'tags':_0x4ed103||[]};});}})[_0xb4ae('0x19')](respondWithResult(_0x2f8c5e,null))[_0xb4ae('0x27')](handleError(_0x2f8c5e,null));};exports['removeTags']=function(_0x15727b,_0x56f0a4){return db[_0xb4ae('0x20')][_0xb4ae('0x34')]({'where':{'id':_0x15727b[_0xb4ae('0x29')]['id']}})['then'](handleEntityNotFound(_0x56f0a4,null))[_0xb4ae('0x19')](function(_0x3f6f52){if(_0x3f6f52){return _0x3f6f52[_0xb4ae('0x4c')](_0x15727b[_0xb4ae('0x26')]['ids']);}})[_0xb4ae('0x19')](respondWithStatusCode(_0x56f0a4,null))[_0xb4ae('0x27')](handleError(_0x56f0a4,null));};exports['download']=function(_0x219b4d,_0x4deff9){var _0x4446da=moment()[_0xb4ae('0x4d')]()[_0xb4ae('0x4e')]();var _0x1ff7ad=path[_0xb4ae('0x4f')](config['root'],'server',_0xb4ae('0x50'),_0xb4ae('0x51'));var _0x4801ba=path[_0xb4ae('0x4f')](_0x1ff7ad,_0x4446da);var _0x3cbb94=util[_0xb4ae('0x45')]('transcript-%d-%s.zip',_0x219b4d['params']['id'],_0x4446da);var _0xfb988c=path['join'](_0x1ff7ad,_0x3cbb94);var _0x1058fd=[];_0x1058fd[_0xb4ae('0x52')]({'model':db[_0xb4ae('0x53')],'as':'User','attributes':['id',_0xb4ae('0x54')],'raw':!![]});_0x1058fd[_0xb4ae('0x52')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0xb4ae('0x55')],'raw':!![]});var _0x1b4116=[{'model':db[_0xb4ae('0x37')],'as':_0xb4ae('0x56'),'attributes':['id','body','createdAt','direction',_0xb4ae('0x57'),_0xb4ae('0x58')],'include':_0x1058fd}];_0x1b4116[_0xb4ae('0x52')]({'model':db[_0xb4ae('0x59')],'as':'Account','attributes':['id',_0xb4ae('0x1c')]});_0x1b4116[_0xb4ae('0x52')]({'model':db[_0xb4ae('0x53')],'as':_0xb4ae('0x5a'),'attributes':['id',_0xb4ae('0x54')]});return db[_0xb4ae('0x20')][_0xb4ae('0x34')]({'where':{'id':_0x219b4d['params']['id']},'include':_0x1b4116})['then'](handleEntityNotFound(_0x4deff9,null))[_0xb4ae('0x19')](function(_0x27ff27){if(_0x27ff27){var _0x32a798=_0x27ff27['get']({'plain':!![]});fs[_0xb4ae('0x5b')](_0x4801ba);var _0x3621ad={'channel':_0xb4ae('0x5c'),'account':_0x32a798[_0xb4ae('0x5d')]['name'],'agent':_0x32a798[_0xb4ae('0x5a')]?_0x32a798[_0xb4ae('0x5a')]['fullname']:_0xb4ae('0x5e'),'createdAt':moment(_0x32a798['createdAt'])['format'](_0xb4ae('0x46'))[_0xb4ae('0x4e')](),'closedAt':_0x32a798[_0xb4ae('0x5f')]?moment(_0x32a798[_0xb4ae('0x60')])[_0xb4ae('0x45')](_0xb4ae('0x46'))[_0xb4ae('0x4e')]():'','disposition':_0x32a798[_0xb4ae('0x61')],'messages':_(_0x32a798[_0xb4ae('0x56')])['filter']({'secret':![]})[_0xb4ae('0x1f')](function(_0x112554){return{'date':moment(_0x112554[_0xb4ae('0x62')])[_0xb4ae('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb4ae('0x4e')](),'sender':_0x112554[_0xb4ae('0x63')]===_0xb4ae('0x64')?_0x112554[_0xb4ae('0x53')]?_0x112554['User']['fullname']:_0xb4ae('0x65'):_0x112554[_0xb4ae('0x66')][_0xb4ae('0x67')]+(_0x112554[_0xb4ae('0x66')][_0xb4ae('0x55')]?'\x20'+_0x112554[_0xb4ae('0x66')][_0xb4ae('0x55')]:''),'body':_0x112554[_0xb4ae('0x33')],'direction':_0x112554[_0xb4ae('0x63')]===_0xb4ae('0x64')?'A':'C','secret':_0x112554[_0xb4ae('0x57')],'read':_0x112554[_0xb4ae('0x58')]};})[_0xb4ae('0x68')]()};return ejs[_0xb4ae('0x69')](path[_0xb4ae('0x4f')](config[_0xb4ae('0x6a')],_0xb4ae('0x6b'),_0xb4ae('0x6c'),_0xb4ae('0x6d')),{'interaction':_0x3621ad})[_0xb4ae('0x19')](function(_0x3f7faa){var _0x2713a6=path[_0xb4ae('0x4f')](_0x4801ba,_0xb4ae('0x6e')+_0x32a798['id']+'-'+_0x4446da+_0xb4ae('0x6f'));var _0x195a59={'path':_0x2713a6,'channel':_0xb4ae('0x5c'),'interactionId':_0x32a798['id']};return pdf[_0xb4ae('0x70')](_0x3f7faa,_0x195a59);})[_0xb4ae('0x19')](function(){return new BPromise(function(_0x44a712,_0x310ce9){zipdir(_0x4801ba,{'saveTo':_0xfb988c},function(_0x38701c,_0x503b3e){if(_0x38701c)return _0x310ce9(_0x38701c);return _0x44a712(_0x503b3e);});})[_0xb4ae('0x19')](function(){return new BPromise(function(_0x36e627,_0x4ff474){rimraf(_0x4801ba,function(_0x384532){if(_0x384532)_0x4ff474(_0x384532);return _0x36e627();});});})['then'](function(){return _0x4deff9[_0xb4ae('0x71')](_0xfb988c,_0x3cbb94,function(_0x280d32){if(_0x280d32){console[_0xb4ae('0x72')](_0xb4ae('0x73'),_0x280d32);}else{fs[_0xb4ae('0x74')](_0xfb988c);}});});});}else{return _0x4deff9[_0xb4ae('0x10')](0xc8);}})['catch'](handleError(_0x4deff9,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index ce272a4..e39ada9 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 _0xea28=['Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xea28,0x13a));var _0x8ea2=function(_0x5b644d,_0x20be33){_0x5b644d=_0x5b644d-0x0;var _0x50168e=_0xea28[_0x5b644d];return _0x50168e;};'use strict';var EventEmitter=require(_0x8ea2('0x0'));var SmsInteraction=require(_0x8ea2('0x1'))['db'][_0x8ea2('0x2')];var SmsMessage=require(_0x8ea2('0x1'))['db'][_0x8ea2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8ea2('0x4')](0x0);var events={'afterCreate':_0x8ea2('0x5'),'afterUpdate':_0x8ea2('0x6'),'afterDestroy':'remove'};function emitEvent(_0x9b45ab){return function(_0x23aaf1,_0x1ccf12,_0x513a0d){_0x23aaf1[_0x8ea2('0x7')]({'attributes':['id'],'raw':!![]})[_0x8ea2('0x8')](function(_0xb7f278){_0x23aaf1[_0x8ea2('0x9')](_0x8ea2('0xa'),_0xb7f278[_0x8ea2('0xb')](function(_0x19bd6c){return{'id':_0x19bd6c['id']};}));return SmsMessage[_0x8ea2('0xc')]({'where':{'SmsInteractionId':_0x23aaf1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8ea2('0x8')](function(_0x3000f9){_0x23aaf1[_0x8ea2('0x9')](_0x8ea2('0xd'),_0x3000f9['length']);SmsInteractionEvents['emit'](_0x9b45ab+':'+_0x23aaf1['id'],_0x23aaf1);SmsInteractionEvents[_0x8ea2('0xe')](_0x9b45ab,_0x23aaf1);_0x513a0d(null);})[_0x8ea2('0xf')](_0x513a0d(null));};}for(var e in events){if(events[_0x8ea2('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x8ea2('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0xb03e=['SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction'];(function(_0x18847a,_0xd6898e){var _0x5b68ca=function(_0xf333b){while(--_0xf333b){_0x18847a['push'](_0x18847a['shift']());}};_0x5b68ca(++_0xd6898e);}(_0xb03e,0x1eb));var _0xeb03=function(_0x95b1e8,_0x46c4b7){_0x95b1e8=_0x95b1e8-0x0;var _0x5f27a4=_0xb03e[_0x95b1e8];return _0x5f27a4;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xeb03('0x0'))['db'][_0xeb03('0x1')];var SmsMessage=require(_0xeb03('0x0'))['db'][_0xeb03('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xeb03('0x3')](0x0);var events={'afterCreate':_0xeb03('0x4'),'afterUpdate':_0xeb03('0x5'),'afterDestroy':_0xeb03('0x6')};function emitEvent(_0x474450){return function(_0x3ba4b0,_0x88925b,_0xee2291){_0x3ba4b0['getUsers']({'attributes':['id'],'raw':!![]})[_0xeb03('0x7')](function(_0x3d3322){_0x3ba4b0[_0xeb03('0x8')](_0xeb03('0x9'),_0x3d3322[_0xeb03('0xa')](function(_0x28c772){return{'id':_0x28c772['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3ba4b0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeb03('0x7')](function(_0x99f4e2){_0x3ba4b0[_0xeb03('0x8')]('unreadMessages',_0x99f4e2[_0xeb03('0xb')]);SmsInteractionEvents['emit'](_0x474450+':'+_0x3ba4b0['id'],_0x3ba4b0);SmsInteractionEvents[_0xeb03('0xc')](_0x474450,_0x3ba4b0);_0xee2291(null);})[_0xeb03('0xd')](_0xee2291(null));};}for(var e in events){if(events[_0xeb03('0xe')](e)){var event=events[e];SmsInteraction[_0xeb03('0xf')](e,emitEvent(event));}}module[_0xeb03('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2aa21c5..ccbf3a1 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 _0xbfe1=['request-promise','path','../../config/environment','SmsInteraction','sms_interactions','closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xaa90f,_0x53d33e){var _0x5bc68a=function(_0x750150){while(--_0x750150){_0xaa90f['push'](_0xaa90f['shift']());}};_0x5bc68a(++_0x53d33e);}(_0xbfe1,0x174));var _0x1bfe=function(_0x5b87b3,_0x4d7207){_0x5b87b3=_0x5b87b3-0x0;var _0x2aa13c=_0xbfe1[_0x5b87b3];return _0x2aa13c;};'use strict';var _=require(_0x1bfe('0x0'));var util=require(_0x1bfe('0x1'));var logger=require(_0x1bfe('0x2'))(_0x1bfe('0x3'));var moment=require(_0x1bfe('0x4'));var BPromise=require(_0x1bfe('0x5'));var rp=require(_0x1bfe('0x6'));var fs=require('fs');var path=require(_0x1bfe('0x7'));var rimraf=require('rimraf');var config=require(_0x1bfe('0x8'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x3196b8,_0x436538){return _0x3196b8['define'](_0x1bfe('0x9'),attributes,{'tableName':_0x1bfe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x62dd2d,_0x5199cc,_0x616362){if(_0x62dd2d['changed'](_0x1bfe('0xb'))){_0x62dd2d[_0x1bfe('0xc')]=moment()[_0x1bfe('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x616362(null,_0x62dd2d);}}});}; \ No newline at end of file +var _0xf78f=['path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','bluebird','request-promise'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xf78f,0xa1));var _0xff78=function(_0x1b279d,_0x572947){_0x1b279d=_0x1b279d-0x0;var _0x483ef8=_0xf78f[_0x1b279d];return _0x483ef8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xff78('0x0'))(_0xff78('0x1'));var moment=require('moment');var BPromise=require(_0xff78('0x2'));var rp=require(_0xff78('0x3'));var fs=require('fs');var path=require(_0xff78('0x4'));var rimraf=require(_0xff78('0x5'));var config=require(_0xff78('0x6'));var attributes=require(_0xff78('0x7'));module[_0xff78('0x8')]=function(_0xc622ef,_0x2a8217){return _0xc622ef[_0xff78('0x9')](_0xff78('0xa'),attributes,{'tableName':_0xff78('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e6aaf,_0x26af83,_0x4058aa){if(_0x1e6aaf['changed']('closed')){_0x1e6aaf[_0xff78('0xc')]=moment()[_0xff78('0xd')](_0xff78('0xe'));}_0x4058aa(null,_0x1e6aaf);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 6904b9b..21d04d3 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 _0xc87a=['update','body','options','where','limit','UpdateSmsInteraction','find','addTags','ids','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','SmsInteraction'];(function(_0x67ae45,_0x2ee1cc){var _0x1804d5=function(_0x4a09ce){while(--_0x4a09ce){_0x67ae45['push'](_0x67ae45['shift']());}};_0x1804d5(++_0x2ee1cc);}(_0xc87a,0x82));var _0xac87=function(_0x520d97,_0x423cd3){_0x520d97=_0x520d97-0x0;var _0x1c843b=_0xc87a[_0x520d97];return _0x1c843b;};'use strict';var _=require(_0xac87('0x0'));var util=require(_0xac87('0x1'));var moment=require('moment');var BPromise=require(_0xac87('0x2'));var rs=require(_0xac87('0x3'));var fs=require('fs');var Redis=require(_0xac87('0x4'));var db=require(_0xac87('0x5'))['db'];var utils=require(_0xac87('0x6'));var logger=require(_0xac87('0x7'))(_0xac87('0x8'));var config=require(_0xac87('0x9'));var jayson=require(_0xac87('0xa'));var client=jayson['client'][_0xac87('0xb')]({'port':0x232a});config[_0xac87('0xc')]=_[_0xac87('0xd')](config['redis'],{'host':_0xac87('0xe'),'port':0x18eb});var socket=require(_0xac87('0xf'))(new Redis(config[_0xac87('0xc')]));require(_0xac87('0x10'))[_0xac87('0x11')](socket);function respondWithRpcPromise(_0x1b2dd2,_0x410c8c,_0x13cb32){return new BPromise(function(_0x47c30a,_0x206cad){return client[_0xac87('0x12')](_0x1b2dd2,_0x13cb32)[_0xac87('0x13')](function(_0x1cf58c){logger[_0xac87('0x14')](_0xac87('0x15'),_0x410c8c,'request\x20sent');logger[_0xac87('0x16')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x410c8c,_0xac87('0x17'),JSON[_0xac87('0x18')](_0x1cf58c));if(_0x1cf58c[_0xac87('0x19')]){if(_0x1cf58c['error'][_0xac87('0x1a')]===0x1f4){logger[_0xac87('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x410c8c,_0x1cf58c[_0xac87('0x19')]['message']);return _0x206cad(_0x1cf58c[_0xac87('0x19')][_0xac87('0x1b')]);}logger[_0xac87('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x410c8c,_0x1cf58c[_0xac87('0x19')][_0xac87('0x1b')]);return _0x47c30a(_0x1cf58c[_0xac87('0x19')]['message']);}else{logger[_0xac87('0x14')](_0xac87('0x15'),_0x410c8c,_0xac87('0x17'));_0x47c30a(_0x1cf58c['result'][_0xac87('0x1b')]);}})[_0xac87('0x1c')](function(_0x3e99b1){logger['error'](_0xac87('0x15'),_0x410c8c,_0x3e99b1);_0x206cad(_0x3e99b1);});});}exports['UpdateSmsInteraction']=function(_0x30fd56){var _0x203a0b=this;return new Promise(function(_0x2f50c1,_0x1331bf){return db[_0xac87('0x1d')][_0xac87('0x1e')](_0x30fd56[_0xac87('0x1f')],{'raw':_0x30fd56[_0xac87('0x20')]?_0x30fd56[_0xac87('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30fd56[_0xac87('0x20')]?_0x30fd56[_0xac87('0x20')][_0xac87('0x21')]||null:null,'attributes':_0x30fd56['options']?_0x30fd56[_0xac87('0x20')]['attributes']||null:null,'limit':_0x30fd56[_0xac87('0x20')]?_0x30fd56['options'][_0xac87('0x22')]||null:null})[_0xac87('0x13')](function(_0x5010de){logger[_0xac87('0x14')]('UpdateSmsInteraction',_0x30fd56);logger[_0xac87('0x16')](_0xac87('0x23'),_0x30fd56,JSON[_0xac87('0x18')](_0x5010de));_0x2f50c1(_0x5010de);})[_0xac87('0x1c')](function(_0x17e14b){logger['error'](_0xac87('0x23'),_0x17e14b[_0xac87('0x1b')],_0x30fd56);_0x1331bf(_0x203a0b[_0xac87('0x19')](0x1f4,_0x17e14b[_0xac87('0x1b')]));});});};exports['AddTagsToSmsInteraction']=function(_0x3729e1){return new Promise(function(_0x253cf3,_0x4f34f8){return db[_0xac87('0x1d')][_0xac87('0x24')]({'where':_0x3729e1[_0xac87('0x20')]?_0x3729e1[_0xac87('0x20')][_0xac87('0x21')]||null:null})[_0xac87('0x13')](function(_0x48317){if(_0x48317){return _0x48317[_0xac87('0x25')](_0x3729e1['body'][_0xac87('0x26')],_['omit'](_0x3729e1[_0xac87('0x1f')],['ids','id'])||{});}})['spread'](function(_0xdd9dc3){logger[_0xac87('0x14')](_0xac87('0x27'),_0x3729e1);logger['debug'](_0xac87('0x27'),_0x3729e1,JSON[_0xac87('0x18')](_0xdd9dc3));_0x253cf3(_0xdd9dc3);})['catch'](function(_0xfaefe1){logger['error'](_0xac87('0x27'),_0xfaefe1['message'],_0x3729e1);_0x4f34f8(_this[_0xac87('0x19')](0x1f4,_0xfaefe1['message']));});});}; \ No newline at end of file +var _0x799c=['request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','info','catch','SmsInteraction','update','body','options','attributes','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','find','where','addTags','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','./smsInteraction.socket','register','request'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x799c,0x8e));var _0xc799=function(_0x5457c4,_0x35417d){_0x5457c4=_0x5457c4-0x0;var _0x305d0f=_0x799c[_0x5457c4];return _0x305d0f;};'use strict';var _=require(_0xc799('0x0'));var util=require('util');var moment=require(_0xc799('0x1'));var BPromise=require(_0xc799('0x2'));var rs=require(_0xc799('0x3'));var fs=require('fs');var Redis=require(_0xc799('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc799('0x5'));var logger=require(_0xc799('0x6'))(_0xc799('0x7'));var config=require(_0xc799('0x8'));var jayson=require(_0xc799('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xc799('0xa')]=_['defaults'](config[_0xc799('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc799('0xa')]));require(_0xc799('0xb'))[_0xc799('0xc')](socket);function respondWithRpcPromise(_0x1edbfd,_0x4e897b,_0xcbf012){return new BPromise(function(_0x9b3f3,_0x106058){return client[_0xc799('0xd')](_0x1edbfd,_0xcbf012)['then'](function(_0x2d01a2){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x4e897b,_0xc799('0xe'));logger[_0xc799('0xf')](_0xc799('0x10'),_0x4e897b,_0xc799('0xe'),JSON[_0xc799('0x11')](_0x2d01a2));if(_0x2d01a2[_0xc799('0x12')]){if(_0x2d01a2['error'][_0xc799('0x13')]===0x1f4){logger[_0xc799('0x12')](_0xc799('0x14'),_0x4e897b,_0x2d01a2[_0xc799('0x12')][_0xc799('0x15')]);return _0x106058(_0x2d01a2[_0xc799('0x12')][_0xc799('0x15')]);}logger[_0xc799('0x12')](_0xc799('0x14'),_0x4e897b,_0x2d01a2[_0xc799('0x12')][_0xc799('0x15')]);return _0x9b3f3(_0x2d01a2['error']['message']);}else{logger[_0xc799('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x4e897b,_0xc799('0xe'));_0x9b3f3(_0x2d01a2['result'][_0xc799('0x15')]);}})[_0xc799('0x17')](function(_0x247d09){logger['error'](_0xc799('0x14'),_0x4e897b,_0x247d09);_0x106058(_0x247d09);});});}exports['UpdateSmsInteraction']=function(_0x4cb8d0){var _0x1d6264=this;return new Promise(function(_0x2a10bb,_0xb3dbb7){return db[_0xc799('0x18')][_0xc799('0x19')](_0x4cb8d0[_0xc799('0x1a')],{'raw':_0x4cb8d0['options']?_0x4cb8d0[_0xc799('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cb8d0[_0xc799('0x1b')]?_0x4cb8d0['options']['where']||null:null,'attributes':_0x4cb8d0[_0xc799('0x1b')]?_0x4cb8d0[_0xc799('0x1b')][_0xc799('0x1c')]||null:null,'limit':_0x4cb8d0['options']?_0x4cb8d0[_0xc799('0x1b')][_0xc799('0x1d')]||null:null})[_0xc799('0x1e')](function(_0x411285){logger[_0xc799('0x16')]('UpdateSmsInteraction',_0x4cb8d0);logger[_0xc799('0xf')](_0xc799('0x1f'),_0x4cb8d0,JSON[_0xc799('0x11')](_0x411285));_0x2a10bb(_0x411285);})['catch'](function(_0x25c259){logger[_0xc799('0x12')]('UpdateSmsInteraction',_0x25c259[_0xc799('0x15')],_0x4cb8d0);_0xb3dbb7(_0x1d6264['error'](0x1f4,_0x25c259[_0xc799('0x15')]));});});};exports[_0xc799('0x20')]=function(_0x4be317){return new Promise(function(_0x4aeeda,_0x3fecf2){return db[_0xc799('0x18')][_0xc799('0x21')]({'where':_0x4be317[_0xc799('0x1b')]?_0x4be317['options'][_0xc799('0x22')]||null:null})[_0xc799('0x1e')](function(_0x1a47a5){if(_0x1a47a5){return _0x1a47a5[_0xc799('0x23')](_0x4be317[_0xc799('0x1a')]['ids'],_[_0xc799('0x24')](_0x4be317[_0xc799('0x1a')],['ids','id'])||{});}})[_0xc799('0x25')](function(_0x8cf70c){logger[_0xc799('0x16')](_0xc799('0x26'),_0x4be317);logger[_0xc799('0xf')](_0xc799('0x26'),_0x4be317,JSON[_0xc799('0x11')](_0x8cf70c));_0x4aeeda(_0x8cf70c);})['catch'](function(_0x26e4e0){logger[_0xc799('0x12')](_0xc799('0x26'),_0x26e4e0[_0xc799('0x15')],_0x4be317);_0x3fecf2(_this[_0xc799('0x12')](0x1f4,_0x26e4e0[_0xc799('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 012ce13..805ebe4 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 _0xebc4=['emit','removeListener','register','length','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xebc4,0x1d5));var _0x4ebc=function(_0x937506,_0x32072c){_0x937506=_0x937506-0x0;var _0x5d6d09=_0xebc4[_0x937506];return _0x5d6d09;};'use strict';var SmsInteractionEvents=require(_0x4ebc('0x0'));var events=[_0x4ebc('0x1'),_0x4ebc('0x2'),'update'];function createListener(_0x335fc5,_0x13aca9){return function(_0x63bc96){_0x13aca9[_0x4ebc('0x3')](_0x335fc5,_0x63bc96);};}function removeListener(_0x369d68,_0x2ed3d4){return function(){SmsInteractionEvents[_0x4ebc('0x4')](_0x369d68,_0x2ed3d4);};}exports[_0x4ebc('0x5')]=function(_0x4eaf1b){for(var _0x588265=0x0,_0x51e478=events[_0x4ebc('0x6')];_0x588265<_0x51e478;_0x588265++){var _0x8a4d1a=events[_0x588265];var _0x267f28=createListener(_0x4ebc('0x7')+_0x8a4d1a,_0x4eaf1b);SmsInteractionEvents['on'](_0x8a4d1a,_0x267f28);}}; \ No newline at end of file +var _0x13ba=['removeListener','length','smsInteraction:','./smsInteraction.events','update'];(function(_0x42d12a,_0x29d7fd){var _0x297edf=function(_0x225e98){while(--_0x225e98){_0x42d12a['push'](_0x42d12a['shift']());}};_0x297edf(++_0x29d7fd);}(_0x13ba,0x184));var _0xa13b=function(_0x455abf,_0x4ae86d){_0x455abf=_0x455abf-0x0;var _0x3ab136=_0x13ba[_0x455abf];return _0x3ab136;};'use strict';var SmsInteractionEvents=require(_0xa13b('0x0'));var events=['save','remove',_0xa13b('0x1')];function createListener(_0x4b9c63,_0x13bebc){return function(_0x3248b4){_0x13bebc['emit'](_0x4b9c63,_0x3248b4);};}function removeListener(_0x316daa,_0x3fbf84){return function(){SmsInteractionEvents[_0xa13b('0x2')](_0x316daa,_0x3fbf84);};}exports['register']=function(_0x355f85){for(var _0x563364=0x0,_0x89a7b7=events[_0xa13b('0x3')];_0x563364<_0x89a7b7;_0x563364++){var _0xda072b=events[_0x563364];var _0x23b633=createListener(_0xa13b('0x4')+_0xda072b,_0x355f85);SmsInteractionEvents['on'](_0xda072b,_0x23b633);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index e18bd7c..1304879 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 _0x326b=['smsmessage:create','create','status','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','tracked','sms'];(function(_0x2085f2,_0x1e38f0){var _0xcfd532=function(_0x4d497a){while(--_0x4d497a){_0x2085f2['push'](_0x2085f2['shift']());}};_0xcfd532(++_0x1e38f0);}(_0x326b,0x1dc));var _0xb326=function(_0x110d59,_0x50c4fb){_0x110d59=_0x110d59-0x0;var _0x2fce64=_0x326b[_0x110d59];return _0x2fce64;};'use strict';var multer=require(_0xb326('0x0'));var util=require(_0xb326('0x1'));var path=require(_0xb326('0x2'));var timeout=require(_0xb326('0x3'));var express=require(_0xb326('0x4'));var router=express[_0xb326('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb326('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb326('0x7'));var controller=require('./smsMessage.controller');router[_0xb326('0x8')]('/',auth['isAuthenticated'](),controller[_0xb326('0x9')]);router[_0xb326('0x8')](_0xb326('0xa'),auth[_0xb326('0xb')](),controller[_0xb326('0xc')]);router['get']('/:id',auth[_0xb326('0xb')](),controller[_0xb326('0xd')]);router[_0xb326('0xe')]('/',auth[_0xb326('0xb')](),interaction[_0xb326('0xf')](_0xb326('0x10'),_0xb326('0x11')),controller[_0xb326('0x12')]);router[_0xb326('0xe')]('/:id/status',controller[_0xb326('0x13')]);router[_0xb326('0x14')](_0xb326('0x15'),auth[_0xb326('0xb')](),controller['update']);router[_0xb326('0x14')](_0xb326('0x16'),auth[_0xb326('0xb')](),controller[_0xb326('0x17')]);router[_0xb326('0x14')](_0xb326('0x18'),auth[_0xb326('0xb')](),controller[_0xb326('0x19')]);router[_0xb326('0x1a')](_0xb326('0x15'),auth[_0xb326('0xb')](),controller[_0xb326('0x1b')]);module[_0xb326('0x1c')]=router; \ No newline at end of file +var _0x96be=['/:id/status','put','/:id','update','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','describe','post','tracked','sms','smsmessage:create','create'];(function(_0x2d13db,_0x59a64d){var _0x37ba6f=function(_0x353ec7){while(--_0x353ec7){_0x2d13db['push'](_0x2d13db['shift']());}};_0x37ba6f(++_0x59a64d);}(_0x96be,0x1c9));var _0xe96b=function(_0x13c994,_0x8c94eb){_0x13c994=_0x13c994-0x0;var _0x374872=_0x96be[_0x13c994];return _0x374872;};'use strict';var multer=require(_0xe96b('0x0'));var util=require(_0xe96b('0x1'));var path=require(_0xe96b('0x2'));var timeout=require(_0xe96b('0x3'));var express=require(_0xe96b('0x4'));var router=express[_0xe96b('0x5')]();var fs_extra=require(_0xe96b('0x6'));var auth=require(_0xe96b('0x7'));var interaction=require(_0xe96b('0x8'));var config=require(_0xe96b('0x9'));var controller=require(_0xe96b('0xa'));router[_0xe96b('0xb')]('/',auth[_0xe96b('0xc')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe96b('0xd')]);router[_0xe96b('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe96b('0xe')]('/',auth[_0xe96b('0xc')](),interaction[_0xe96b('0xf')](_0xe96b('0x10'),_0xe96b('0x11')),controller[_0xe96b('0x12')]);router[_0xe96b('0xe')](_0xe96b('0x13'),controller['status']);router[_0xe96b('0x14')](_0xe96b('0x15'),auth[_0xe96b('0xc')](),controller[_0xe96b('0x16')]);router[_0xe96b('0x14')]('/:id/accept',auth[_0xe96b('0xc')](),controller[_0xe96b('0x17')]);router['put'](_0xe96b('0x18'),auth[_0xe96b('0xc')](),controller[_0xe96b('0x19')]);router[_0xe96b('0x1a')](_0xe96b('0x15'),auth[_0xe96b('0xc')](),controller['destroy']);module[_0xe96b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 5dc89ff..e20d46c 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 _0xd3e3=['DATE','STRING','exports','TEXT','medium','ENUM','out'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xd3e3,0x1c9));var _0x3d3e=function(_0x4c0d98,_0x2ad90b){_0x4c0d98=_0x4c0d98-0x0;var _0x113b95=_0xd3e3[_0x4c0d98];return _0x113b95;};'use strict';var Sequelize=require('sequelize');module[_0x3d3e('0x0')]={'body':{'type':Sequelize[_0x3d3e('0x1')](_0x3d3e('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3d3e('0x3')]('in',_0x3d3e('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x3d3e('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3d3e('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa58e=['STRING','DATE','sequelize','exports','out'];(function(_0x5776af,_0xda8dd6){var _0x3b03f8=function(_0x407d88){while(--_0x407d88){_0x5776af['push'](_0x5776af['shift']());}};_0x3b03f8(++_0xda8dd6);}(_0xa58e,0x1d3));var _0xea58=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xa58e[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0xea58('0x0'));module[_0xea58('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xea58('0x2')),'defaultValue':_0xea58('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0xea58('0x3')](0xbe)},'phone':{'type':Sequelize[_0xea58('0x3')]},'readAt':{'type':Sequelize[_0xea58('0x4')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xea58('0x3')]},'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 28d27ad..3abb3eb 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 _0x8163=['infobip','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','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','defaults','localhost','socket.io-emitter','redis','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','offset','limit','undefined','count','set','apply','reject','update','destroy','sendStatus','name','send','index','map','SmsMessage','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','params','include','find','create','body','describe','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteractionId','role','interaction','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','interface','channel','motionChannel','event','accept','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','email','SIP/%s','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','groupName','DELIVERED'];(function(_0xba8347,_0x593459){var _0x17b761=function(_0x450e40){while(--_0x450e40){_0xba8347['push'](_0xba8347['shift']());}};_0x17b761(++_0x593459);}(_0x8163,0x11b));var _0x3816=function(_0x372527,_0x342d6c){_0x372527=_0x372527-0x0;var _0x2a191d=_0x8163[_0x372527];return _0x2a191d;};'use strict';var emlformat=require(_0x3816('0x0'));var rimraf=require(_0x3816('0x1'));var zipdir=require(_0x3816('0x2'));var jsonpatch=require(_0x3816('0x3'));var rp=require(_0x3816('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3816('0x5'));var util=require('util');var path=require(_0x3816('0x6'));var sox=require(_0x3816('0x7'));var csv=require(_0x3816('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3816('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3816('0xa'));var jsforce=require(_0x3816('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3816('0x8'));var querystring=require(_0x3816('0xc'));var Papa=require(_0x3816('0xd'));var Redis=require(_0x3816('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3816('0xf'));var as=require(_0x3816('0x10'));var hardwareService=require(_0x3816('0x11'));var logger=require(_0x3816('0x12'))(_0x3816('0x13'));var utils=require(_0x3816('0x14'));var config=require(_0x3816('0x15'));var licenseUtil=require(_0x3816('0x16'));var db=require(_0x3816('0x17'))['db'];config['redis']=_[_0x3816('0x18')](config['redis'],{'host':_0x3816('0x19'),'port':0x18eb});var socket=require(_0x3816('0x1a'))(new Redis(config[_0x3816('0x1b')]));require('./smsMessage.socket')[_0x3816('0x1c')](socket);var jayson=require(_0x3816('0x1d'));var client=jayson[_0x3816('0x1e')][_0x3816('0x1f')]({'port':0x232c});var client9002=jayson[_0x3816('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28c987,_0x226502,_0x4c370f,_0x1b1397){return new BPromise(function(_0x50265f,_0x43c807){var _0x598acb=_0x1b1397||client;return _0x598acb[_0x3816('0x20')](_0x28c987,_0x4c370f)[_0x3816('0x21')](function(_0x2487d3){logger[_0x3816('0x22')](_0x3816('0x23'),_0x226502,_0x3816('0x24'));logger[_0x3816('0x25')](_0x3816('0x26'),_0x226502,_0x3816('0x24'),JSON['stringify'](_0x2487d3));if(_0x2487d3[_0x3816('0x27')]){if(_0x2487d3[_0x3816('0x27')]['code']===0x1f4){logger['error'](_0x3816('0x23'),_0x226502,_0x2487d3[_0x3816('0x27')][_0x3816('0x28')]);return _0x43c807(_0x2487d3['error'][_0x3816('0x28')]);}logger[_0x3816('0x27')](_0x3816('0x23'),_0x226502,_0x2487d3[_0x3816('0x27')][_0x3816('0x28')]);return _0x50265f(_0x2487d3['error']['message']);}else{logger[_0x3816('0x22')](_0x3816('0x23'),_0x226502,_0x3816('0x24'));_0x50265f(_0x2487d3[_0x3816('0x29')][_0x3816('0x28')]);}})[_0x3816('0x2a')](function(_0x507c0b){logger[_0x3816('0x27')]('SmsMessage,\x20%s,\x20%s',_0x226502,_0x507c0b);_0x43c807(_0x507c0b);});});}function respondWithStatusCode(_0x22fd51,_0x2f90c1){_0x2f90c1=_0x2f90c1||0xcc;return function(_0x35f594){if(_0x35f594){return _0x22fd51['sendStatus'](_0x2f90c1);}return _0x22fd51[_0x3816('0x2b')](_0x2f90c1)[_0x3816('0x2c')]();};}function respondWithResult(_0x2fa9a3,_0x2c39c9){_0x2c39c9=_0x2c39c9||0xc8;return function(_0x22c522){if(_0x22c522){return _0x2fa9a3[_0x3816('0x2b')](_0x2c39c9)['json'](_0x22c522);}};}function respondWithFilteredResult(_0x37c487,_0x1c7e17){return function(_0x48457a){if(_0x48457a){var _0x33555f=typeof _0x1c7e17[_0x3816('0x2d')]==='undefined'&&typeof _0x1c7e17[_0x3816('0x2e')]===_0x3816('0x2f');var _0x4da3c0=_0x48457a[_0x3816('0x30')];var _0x2da018=_0x33555f?0x0:_0x1c7e17[_0x3816('0x2d')];var _0xf9c9d8=_0x33555f?_0x48457a[_0x3816('0x30')]:_0x1c7e17[_0x3816('0x2d')]+_0x1c7e17[_0x3816('0x2e')];var _0x4d0743;if(_0xf9c9d8>=_0x4da3c0){_0xf9c9d8=_0x4da3c0;_0x4d0743=0xc8;}else{_0x4d0743=0xce;}_0x37c487[_0x3816('0x2b')](_0x4d0743);return _0x37c487[_0x3816('0x31')]('Content-Range',_0x2da018+'-'+_0xf9c9d8+'/'+_0x4da3c0)['json'](_0x48457a);}return null;};}function patchUpdates(_0x69f3fc){return function(_0x2e9d9c){try{jsonpatch[_0x3816('0x32')](_0x2e9d9c,_0x69f3fc,!![]);}catch(_0x2fde20){return BPromise[_0x3816('0x33')](_0x2fde20);}return _0x2e9d9c['save']();};}function saveUpdates(_0x424193,_0x5cc8c6){return function(_0x5f04d8){if(_0x5f04d8){return _0x5f04d8[_0x3816('0x34')](_0x424193)['then'](function(_0x535959){return _0x535959;});}return null;};}function removeEntity(_0x530ebb,_0x330c88){return function(_0x17e700){if(_0x17e700){return _0x17e700[_0x3816('0x35')]()[_0x3816('0x21')](function(){_0x530ebb[_0x3816('0x2b')](0xcc)[_0x3816('0x2c')]();});}};}function handleEntityNotFound(_0x3eaaad,_0x4f5752){return function(_0x5b0ac0){if(!_0x5b0ac0){_0x3eaaad[_0x3816('0x36')](0x194);}return _0x5b0ac0;};}function handleError(_0x353405,_0x22a5cb){_0x22a5cb=_0x22a5cb||0x1f4;return function(_0x2dadea){logger['error'](_0x2dadea['stack']);if(_0x2dadea[_0x3816('0x37')]){delete _0x2dadea[_0x3816('0x37')];}_0x353405['status'](_0x22a5cb)[_0x3816('0x38')](_0x2dadea);};}exports[_0x3816('0x39')]=function(_0x45f636,_0x166503){var _0x349fb0={},_0x41b3d9={},_0x3feb0f={'count':0x0,'rows':[]};var _0x4be826=_[_0x3816('0x3a')](db[_0x3816('0x3b')][_0x3816('0x3c')],function(_0x45800f){return{'name':_0x45800f[_0x3816('0x3d')],'type':_0x45800f['type']['key']};});_0x41b3d9[_0x3816('0x3e')]=_[_0x3816('0x3a')](_0x4be826,_0x3816('0x37'));_0x41b3d9['query']=_[_0x3816('0x3f')](_0x45f636[_0x3816('0x40')]);_0x41b3d9[_0x3816('0x41')]=_[_0x3816('0x42')](_0x41b3d9[_0x3816('0x3e')],_0x41b3d9[_0x3816('0x40')]);_0x349fb0[_0x3816('0x43')]=_[_0x3816('0x42')](_0x41b3d9[_0x3816('0x3e')],qs[_0x3816('0x44')](_0x45f636[_0x3816('0x40')][_0x3816('0x44')]));_0x349fb0[_0x3816('0x43')]=_0x349fb0[_0x3816('0x43')][_0x3816('0x45')]?_0x349fb0['attributes']:_0x41b3d9['model'];if(!_0x45f636['query']['hasOwnProperty'](_0x3816('0x46'))){_0x349fb0['limit']=qs[_0x3816('0x2e')](_0x45f636[_0x3816('0x40')][_0x3816('0x2e')]);_0x349fb0[_0x3816('0x2d')]=qs[_0x3816('0x2d')](_0x45f636['query']['offset']);}_0x349fb0[_0x3816('0x47')]=qs[_0x3816('0x48')](_0x45f636[_0x3816('0x40')]['sort']);_0x349fb0[_0x3816('0x49')]=qs['filters'](_[_0x3816('0x4a')](_0x45f636[_0x3816('0x40')],_0x41b3d9['filters']),_0x4be826);if(_0x45f636[_0x3816('0x40')][_0x3816('0x4b')]){_0x349fb0[_0x3816('0x49')]=_[_0x3816('0x4c')](_0x349fb0['where'],{'$or':_['map'](_0x4be826,function(_0x1d4818){if(_0x1d4818[_0x3816('0x4d')]!==_0x3816('0x4e')){var _0x3569b1={};_0x3569b1[_0x1d4818[_0x3816('0x37')]]={'$like':'%'+_0x45f636[_0x3816('0x40')]['filter']+'%'};return _0x3569b1;}})});}_0x349fb0=_[_0x3816('0x4c')]({},_0x349fb0,_0x45f636[_0x3816('0x4f')]);var _0x57f0dc={'where':_0x349fb0[_0x3816('0x49')]};return db[_0x3816('0x3b')][_0x3816('0x30')](_0x57f0dc)[_0x3816('0x21')](function(_0xdf000d){_0x3feb0f[_0x3816('0x30')]=_0xdf000d;if(_0x45f636['query'][_0x3816('0x50')]){_0x349fb0['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x349fb0);})[_0x3816('0x21')](function(_0x3ad802){_0x3feb0f[_0x3816('0x51')]=_0x3ad802;return _0x3feb0f;})[_0x3816('0x21')](respondWithFilteredResult(_0x166503,_0x349fb0))['catch'](handleError(_0x166503,null));};exports['show']=function(_0x1bc526,_0x122bb1){var _0x176d00={'raw':!![],'where':{'id':_0x1bc526[_0x3816('0x52')]['id']}},_0x28fa7b={};_0x28fa7b['model']=_[_0x3816('0x3f')](db['SmsMessage'][_0x3816('0x3c')]);_0x28fa7b['query']=_[_0x3816('0x3f')](_0x1bc526['query']);_0x28fa7b[_0x3816('0x41')]=_[_0x3816('0x42')](_0x28fa7b[_0x3816('0x3e')],_0x28fa7b[_0x3816('0x40')]);_0x176d00[_0x3816('0x43')]=_[_0x3816('0x42')](_0x28fa7b[_0x3816('0x3e')],qs[_0x3816('0x44')](_0x1bc526[_0x3816('0x40')]['fields']));_0x176d00[_0x3816('0x43')]=_0x176d00[_0x3816('0x43')][_0x3816('0x45')]?_0x176d00[_0x3816('0x43')]:_0x28fa7b[_0x3816('0x3e')];if(_0x1bc526[_0x3816('0x40')][_0x3816('0x50')]){_0x176d00[_0x3816('0x53')]=[{'all':!![]}];}_0x176d00=_[_0x3816('0x4c')]({},_0x176d00,_0x1bc526[_0x3816('0x4f')]);return db['SmsMessage'][_0x3816('0x54')](_0x176d00)[_0x3816('0x21')](handleEntityNotFound(_0x122bb1,null))[_0x3816('0x21')](respondWithResult(_0x122bb1,null))[_0x3816('0x2a')](handleError(_0x122bb1,null));};exports[_0x3816('0x55')]=function(_0x5b5891,_0x35377b){return db[_0x3816('0x3b')][_0x3816('0x55')](_0x5b5891[_0x3816('0x56')],{})['then'](respondWithResult(_0x35377b,0xc9))['catch'](handleError(_0x35377b,null));};exports[_0x3816('0x34')]=function(_0x2aaf96,_0x34a771){if(_0x2aaf96['body']['id']){delete _0x2aaf96[_0x3816('0x56')]['id'];}return db[_0x3816('0x3b')][_0x3816('0x54')]({'where':{'id':_0x2aaf96[_0x3816('0x52')]['id']}})[_0x3816('0x21')](handleEntityNotFound(_0x34a771,null))[_0x3816('0x21')](saveUpdates(_0x2aaf96[_0x3816('0x56')],null))['then'](respondWithResult(_0x34a771,null))['catch'](handleError(_0x34a771,null));};exports[_0x3816('0x35')]=function(_0x1206a0,_0x1ae203){return db[_0x3816('0x3b')][_0x3816('0x54')]({'where':{'id':_0x1206a0[_0x3816('0x52')]['id']}})[_0x3816('0x21')](handleEntityNotFound(_0x1ae203,null))[_0x3816('0x21')](removeEntity(_0x1ae203,null))[_0x3816('0x2a')](handleError(_0x1ae203,null));};exports[_0x3816('0x57')]=function(_0xa27d76,_0x208af8){return db['SmsMessage'][_0x3816('0x57')]()['then'](respondWithResult(_0x208af8,null))[_0x3816('0x2a')](handleError(_0x208af8,null));};var interaction_log=require(_0x3816('0x12'))(_0x3816('0x58'));exports['accept']=function(_0x22155a,_0x1f4367,_0x184eab){var _0x4b3b1c={'agent':{},'channel':_0x3816('0x59')};if(_0x22155a[_0x3816('0x56')]['id']){delete _0x22155a['body']['id'];}_0x22155a[_0x3816('0x56')][_0x3816('0x5a')]=!![];_0x22155a['body']['readAt']=moment()[_0x3816('0x5b')](_0x3816('0x5c'));_0x22155a[_0x3816('0x56')][_0x3816('0x5d')]=_0x22155a[_0x3816('0x56')][_0x3816('0x5d')]||_0x22155a[_0x3816('0x5e')]['id'];_0x4b3b1c[_0x3816('0x5f')]['id']=_0x22155a[_0x3816('0x56')][_0x3816('0x5d')];return db[_0x3816('0x3b')][_0x3816('0x54')]({'where':{'id':_0x22155a['params']['id'],'UserId':null}})[_0x3816('0x21')](handleEntityNotFound(_0x1f4367,null))[_0x3816('0x21')](saveUpdates(_0x22155a[_0x3816('0x56')],null))[_0x3816('0x21')](function(_0x5dd36e){if(_0x5dd36e){_0x4b3b1c[_0x3816('0x28')]=_0x5dd36e[_0x3816('0x60')]({'plain':!![]});return db['SmsInteraction'][_0x3816('0x54')]({'where':{'id':_0x5dd36e[_0x3816('0x61')]}});}return null;})[_0x3816('0x21')](handleEntityNotFound(_0x1f4367,null))['then'](function(_0x27cad6){if(_0x27cad6){return _0x27cad6[_0x3816('0x34')]({'UserId':_0x22155a['body'][_0x3816('0x5d')],'read1stAt':_['isNil'](_0x27cad6['read1stAt'])?moment()[_0x3816('0x5b')](_0x3816('0x5c')):undefined});}return null;})['then'](function(_0x310c05){if(_0x310c05){_0x4b3b1c['interaction']=_0x310c05['get']({'plain':!![]});interaction_log[_0x3816('0x22')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x22155a[_0x3816('0x5e')]['id'],_0x22155a[_0x3816('0x5e')]['name'],_0x22155a[_0x3816('0x5e')][_0x3816('0x62')],_0x4b3b1c[_0x3816('0x63')]['id'],_0x22155a[_0x3816('0x56')]?JSON[_0x3816('0x64')](_0x22155a[_0x3816('0x56')]):_0x3816('0x65'));return respondWithRpcPromise(_0x3816('0x66'),'acceptMessage',_0x4b3b1c);}return null;})['then'](function(_0x31a843){var _0x584345=_0x3816('0x67')+_0x31a843[_0x3816('0x28')][_0x3816('0x68')];return db[_0x3816('0x69')][_0x3816('0x40')](_0x584345,{'type':db[_0x3816('0x6a')][_0x3816('0x6b')][_0x3816('0x6c')],'raw':!![]})[_0x3816('0x21')](function(_0x1e47d4){return _0x1e47d4;});})[_0x3816('0x21')](function(_0x3b3b53){if(_0x3b3b53){_0x4b3b1c[_0x3816('0x28')][_0x3816('0x6d')]=_0x3b3b53[0x0];if(!_0x22155a[_0x3816('0x56')][_0x3816('0x5d')])return;return db[_0x3816('0x6e')][_0x3816('0x54')]({'where':{'id':_0x22155a[_0x3816('0x56')][_0x3816('0x5d')],'role':_0x3816('0x5f')},'attributes':['id','name',_0x3816('0x6f'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x21e528){if(!_0x21e528)return null;_0x4b3b1c['message'][_0x3816('0x5f')]=_0x21e528;return _0x4b3b1c;})['then'](function(_0x257aac){if(_0x257aac){if(_0x22155a[_0x3816('0x56')]['manual']){_0x4b3b1c[_0x3816('0x28')][_0x3816('0x70')]=util[_0x3816('0x5b')]('SIP/%s',_0x22155a[_0x3816('0x5e')][_0x3816('0x37')]);_0x4b3b1c[_0x3816('0x28')]['channel']=_0x4b3b1c[_0x3816('0x71')];_0x4b3b1c[_0x3816('0x28')][_0x3816('0x72')]=_0x4b3b1c[_0x3816('0x71')];_0x4b3b1c[_0x3816('0x28')][_0x3816('0x73')]=_0x3816('0x74');return respondWithRpcPromise(_0x3816('0x75'),_0x3816('0x75'),{'event':_0x3816('0x76'),'message':_0x4b3b1c[_0x3816('0x28')]},client9002)[_0x3816('0x21')](function(){return _0x4b3b1c;});}return _0x4b3b1c;}return null;})['then'](respondWithResult(_0x1f4367,null))['catch'](handleError(_0x1f4367,null));};var interaction_log=require(_0x3816('0x12'))('sms-interactions');exports[_0x3816('0x33')]=function(_0x14bfe8,_0x2cc037,_0x1f50b6){var _0xf67a4={'agent':{},'channel':_0x3816('0x59')};if(_0x14bfe8[_0x3816('0x56')]['id']){delete _0x14bfe8[_0x3816('0x56')]['id'];}_0x14bfe8[_0x3816('0x56')][_0x3816('0x5d')]=_0x14bfe8[_0x3816('0x56')][_0x3816('0x5d')]||_0x14bfe8[_0x3816('0x5e')]['id'];_0xf67a4[_0x3816('0x5f')]['id']=_0x14bfe8[_0x3816('0x56')][_0x3816('0x5d')];return db[_0x3816('0x3b')][_0x3816('0x54')]({'where':{'id':_0x14bfe8[_0x3816('0x52')]['id'],'UserId':null}})[_0x3816('0x21')](handleEntityNotFound(_0x2cc037,null))['then'](function(_0x1483b1){if(_0x1483b1){_0xf67a4['message']=_0x1483b1[_0x3816('0x60')]({'plain':!![]});return db[_0x3816('0x77')]['find']({'where':{'id':_0x1483b1[_0x3816('0x61')]}});}return null;})[_0x3816('0x21')](handleEntityNotFound(_0x2cc037,null))[_0x3816('0x21')](function(_0x347a1d){if(_0x347a1d){_0xf67a4['interaction']=_0x347a1d[_0x3816('0x60')]({'plain':!![]});interaction_log['info'](_0x3816('0x78'),_0x14bfe8[_0x3816('0x5e')]['id'],_0x14bfe8[_0x3816('0x5e')][_0x3816('0x37')],_0x14bfe8[_0x3816('0x5e')]['role'],_0xf67a4[_0x3816('0x63')]['id'],_0x14bfe8[_0x3816('0x56')]?JSON['stringify'](_0x14bfe8[_0x3816('0x56')]):_0x3816('0x65'));return respondWithRpcPromise(_0x3816('0x79'),_0x3816('0x7a'),_0xf67a4);}return null;})[_0x3816('0x21')](function(_0x20a80f){var _0x56f9ba=_0x3816('0x67')+_0x20a80f['message'][_0x3816('0x68')];return db[_0x3816('0x69')][_0x3816('0x40')](_0x56f9ba,{'type':db[_0x3816('0x6a')][_0x3816('0x6b')][_0x3816('0x6c')],'raw':!![]})[_0x3816('0x21')](function(_0x17fe95){return _0x17fe95;});})[_0x3816('0x21')](function(_0xe51e9f){if(_0xe51e9f){_0xf67a4[_0x3816('0x28')]['contact']=_0xe51e9f[0x0];if(!_0x14bfe8[_0x3816('0x56')][_0x3816('0x5d')])return;return db['User'][_0x3816('0x54')]({'where':{'id':_0x14bfe8[_0x3816('0x56')][_0x3816('0x5d')],'role':_0x3816('0x5f')},'attributes':['id',_0x3816('0x37'),_0x3816('0x6f'),_0x3816('0x7b'),'internal'],'raw':!![]});}return null;})[_0x3816('0x21')](function(_0x47f111){if(!_0x47f111)return null;_0xf67a4['message']['agent']=_0x47f111;return _0xf67a4;})[_0x3816('0x21')](function(_0x1b1541){if(_0x1b1541){_0x1b1541[_0x3816('0x28')][_0x3816('0x70')]=util[_0x3816('0x5b')](_0x3816('0x7c'),_0x14bfe8[_0x3816('0x5e')]['name']);_0x1b1541[_0x3816('0x28')][_0x3816('0x71')]=_0xf67a4[_0x3816('0x71')];_0x1b1541[_0x3816('0x28')][_0x3816('0x72')]=_0xf67a4[_0x3816('0x71')];_0x1b1541['message'][_0x3816('0x73')]=_0x3816('0x33');respondWithRpcPromise(_0x3816('0x75'),_0x3816('0x75'),{'event':_0x3816('0x7d'),'message':_0x1b1541[_0x3816('0x28')]},client9002);return _0xf67a4;}return null;})[_0x3816('0x21')](respondWithResult(_0x2cc037,null))[_0x3816('0x2a')](handleError(_0x2cc037,null));};exports[_0x3816('0x2b')]=function(_0x2e314d,_0x1d9cb7,_0x564555){if(_0x2e314d[_0x3816('0x56')]['id']){delete _0x2e314d['body']['id'];}var _0x1babc7;return db['SmsMessage'][_0x3816('0x54')]({'where':{'id':_0x2e314d['params']['id']}})['then'](handleEntityNotFound(_0x1d9cb7,null))['then'](function(_0x360e68){if(_0x360e68){_0x1babc7=_0x360e68;return db[_0x3816('0x7e')]['find']({'where':{'id':_0x360e68['SmsAccountId']}});}})[_0x3816('0x21')](handleEntityNotFound(_0x1d9cb7,null))['then'](function(_0x3e0fe3){if(_0x3e0fe3){logger[_0x3816('0x25')](_0x3816('0x26'),_0x3816('0x2b'),_0x3816('0x7f'),_0x3e0fe3[_0x3816('0x4d')],util[_0x3816('0x80')](_0x2e314d[_0x3816('0x56')],{'showHidden':![],'depth':null}));switch(_0x3e0fe3[_0x3816('0x4d')]){case _0x3816('0x81'):if(_0x2e314d[_0x3816('0x56')][_0x3816('0x82')]&&_0x2e314d[_0x3816('0x56')]['MessageSid']===_0x1babc7[_0x3816('0x83')]){return _0x1babc7[_0x3816('0x34')]({'read':!![]});}else{logger[_0x3816('0x27')](_0x3816('0x84'),_0x3816('0x2b'),'twilio',util[_0x3816('0x80')](_0x2e314d['body'],{'showHidden':![],'depth':null}));}break;case _0x3816('0x85'):if(_0x2e314d[_0x3816('0x56')]['MessageUUID']&&_0x2e314d['body'][_0x3816('0x86')]===_0x1babc7['messageId']&&_['indexOf']([_0x3816('0x87'),_0x3816('0x88')],_0x2e314d[_0x3816('0x56')][_0x3816('0x89')])>=0x0){return _0x1babc7[_0x3816('0x34')]({'read':!![]});}else{logger['error'](_0x3816('0x84'),_0x3816('0x2b'),'plivio',util[_0x3816('0x80')](_0x2e314d['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x589cf8=_0x2e314d[_0x3816('0x56')]['results'][0x0];if(_0x589cf8[_0x3816('0x2b')][_0x3816('0x8a')]===_0x3816('0x8b')){return _0x1babc7[_0x3816('0x34')]({'read':!![]});}else{logger[_0x3816('0x27')](_0x3816('0x84'),_0x3816('0x2b'),_0x3816('0x8c'),util[_0x3816('0x80')](_0x2e314d[_0x3816('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x1babc7;}})[_0x3816('0x21')](respondWithResult(_0x1d9cb7,null))[_0x3816('0x2a')](handleError(_0x1d9cb7,null));}; \ No newline at end of file +var _0x7add=['debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','SmsMessage','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','intersection','find','create','body','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','User','fullname','email','interface','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','Status','plivio','infobip','results','groupName','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','fs-extra','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7add,0x72));var _0xd7ad=function(_0x5a2267,_0xdd61e1){_0x5a2267=_0x5a2267-0x0;var _0x57c221=_0x7add[_0x5a2267];return _0x57c221;};'use strict';var emlformat=require(_0xd7ad('0x0'));var rimraf=require(_0xd7ad('0x1'));var zipdir=require(_0xd7ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd7ad('0x3'));var moment=require(_0xd7ad('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd7ad('0x5'));var util=require('util');var path=require(_0xd7ad('0x6'));var sox=require(_0xd7ad('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd7ad('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd7ad('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd7ad('0xa'));var toCsv=require(_0xd7ad('0xb'));var querystring=require(_0xd7ad('0xc'));var Papa=require('papaparse');var Redis=require(_0xd7ad('0xd'));var authService=require(_0xd7ad('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd7ad('0xf'));var hardwareService=require(_0xd7ad('0x10'));var logger=require('../../config/logger')(_0xd7ad('0x11'));var utils=require(_0xd7ad('0x12'));var config=require(_0xd7ad('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd7ad('0x14')]=_[_0xd7ad('0x15')](config['redis'],{'host':_0xd7ad('0x16'),'port':0x18eb});var socket=require(_0xd7ad('0x17'))(new Redis(config[_0xd7ad('0x14')]));require(_0xd7ad('0x18'))[_0xd7ad('0x19')](socket);var jayson=require(_0xd7ad('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a0c28,_0x3c5240,_0x73742,_0x385af4){return new BPromise(function(_0x44872e,_0xf2fcbd){var _0x3ab531=_0x385af4||client;return _0x3ab531[_0xd7ad('0x1b')](_0x3a0c28,_0x73742)['then'](function(_0x41f9a7){logger[_0xd7ad('0x1c')](_0xd7ad('0x1d'),_0x3c5240,_0xd7ad('0x1e'));logger[_0xd7ad('0x1f')](_0xd7ad('0x20'),_0x3c5240,_0xd7ad('0x1e'),JSON[_0xd7ad('0x21')](_0x41f9a7));if(_0x41f9a7['error']){if(_0x41f9a7['error'][_0xd7ad('0x22')]===0x1f4){logger[_0xd7ad('0x23')](_0xd7ad('0x1d'),_0x3c5240,_0x41f9a7[_0xd7ad('0x23')]['message']);return _0xf2fcbd(_0x41f9a7['error'][_0xd7ad('0x24')]);}logger[_0xd7ad('0x23')]('SmsMessage,\x20%s,\x20%s',_0x3c5240,_0x41f9a7[_0xd7ad('0x23')][_0xd7ad('0x24')]);return _0x44872e(_0x41f9a7['error'][_0xd7ad('0x24')]);}else{logger[_0xd7ad('0x1c')](_0xd7ad('0x1d'),_0x3c5240,_0xd7ad('0x1e'));_0x44872e(_0x41f9a7[_0xd7ad('0x25')]['message']);}})[_0xd7ad('0x26')](function(_0x4e8a31){logger[_0xd7ad('0x23')]('SmsMessage,\x20%s,\x20%s',_0x3c5240,_0x4e8a31);_0xf2fcbd(_0x4e8a31);});});}function respondWithStatusCode(_0x4cd9a3,_0x10caf2){_0x10caf2=_0x10caf2||0xcc;return function(_0x70be59){if(_0x70be59){return _0x4cd9a3[_0xd7ad('0x27')](_0x10caf2);}return _0x4cd9a3[_0xd7ad('0x28')](_0x10caf2)[_0xd7ad('0x29')]();};}function respondWithResult(_0x26a7f6,_0x1afd13){_0x1afd13=_0x1afd13||0xc8;return function(_0x417d2e){if(_0x417d2e){return _0x26a7f6['status'](_0x1afd13)[_0xd7ad('0x2a')](_0x417d2e);}};}function respondWithFilteredResult(_0x1fde2a,_0x38b9ba){return function(_0x30ec1e){if(_0x30ec1e){var _0x40e436=typeof _0x38b9ba['offset']==='undefined'&&typeof _0x38b9ba[_0xd7ad('0x2b')]===_0xd7ad('0x2c');var _0x13920c=_0x30ec1e[_0xd7ad('0x2d')];var _0x454f1e=_0x40e436?0x0:_0x38b9ba[_0xd7ad('0x2e')];var _0x3be2a2=_0x40e436?_0x30ec1e[_0xd7ad('0x2d')]:_0x38b9ba[_0xd7ad('0x2e')]+_0x38b9ba['limit'];var _0x8680a4;if(_0x3be2a2>=_0x13920c){_0x3be2a2=_0x13920c;_0x8680a4=0xc8;}else{_0x8680a4=0xce;}_0x1fde2a[_0xd7ad('0x28')](_0x8680a4);return _0x1fde2a[_0xd7ad('0x2f')](_0xd7ad('0x30'),_0x454f1e+'-'+_0x3be2a2+'/'+_0x13920c)[_0xd7ad('0x2a')](_0x30ec1e);}return null;};}function patchUpdates(_0x30192f){return function(_0x2671b3){try{jsonpatch[_0xd7ad('0x31')](_0x2671b3,_0x30192f,!![]);}catch(_0xcf754c){return BPromise[_0xd7ad('0x32')](_0xcf754c);}return _0x2671b3[_0xd7ad('0x33')]();};}function saveUpdates(_0x6cb67e,_0x3f20bc){return function(_0x24ed99){if(_0x24ed99){return _0x24ed99[_0xd7ad('0x34')](_0x6cb67e)[_0xd7ad('0x35')](function(_0x3e00f2){return _0x3e00f2;});}return null;};}function removeEntity(_0x38550e,_0x3bed9b){return function(_0x80f13){if(_0x80f13){return _0x80f13[_0xd7ad('0x36')]()[_0xd7ad('0x35')](function(){_0x38550e[_0xd7ad('0x28')](0xcc)[_0xd7ad('0x29')]();});}};}function handleEntityNotFound(_0x10b845,_0x3d8be8){return function(_0x5e4da9){if(!_0x5e4da9){_0x10b845[_0xd7ad('0x27')](0x194);}return _0x5e4da9;};}function handleError(_0x443deb,_0x2ede8b){_0x2ede8b=_0x2ede8b||0x1f4;return function(_0x2cd7e){logger['error'](_0x2cd7e[_0xd7ad('0x37')]);if(_0x2cd7e[_0xd7ad('0x38')]){delete _0x2cd7e[_0xd7ad('0x38')];}_0x443deb[_0xd7ad('0x28')](_0x2ede8b)[_0xd7ad('0x39')](_0x2cd7e);};}exports['index']=function(_0x17e5ec,_0xbf430a){var _0x516773={},_0x1e397c={},_0x31a0ff={'count':0x0,'rows':[]};var _0xe3fc12=_['map'](db[_0xd7ad('0x3a')][_0xd7ad('0x3b')],function(_0x1ad1c3){return{'name':_0x1ad1c3['fieldName'],'type':_0x1ad1c3[_0xd7ad('0x3c')][_0xd7ad('0x3d')]};});_0x1e397c[_0xd7ad('0x3e')]=_[_0xd7ad('0x3f')](_0xe3fc12,_0xd7ad('0x38'));_0x1e397c[_0xd7ad('0x40')]=_[_0xd7ad('0x41')](_0x17e5ec[_0xd7ad('0x40')]);_0x1e397c[_0xd7ad('0x42')]=_['intersection'](_0x1e397c[_0xd7ad('0x3e')],_0x1e397c[_0xd7ad('0x40')]);_0x516773[_0xd7ad('0x43')]=_['intersection'](_0x1e397c['model'],qs[_0xd7ad('0x44')](_0x17e5ec[_0xd7ad('0x40')][_0xd7ad('0x44')]));_0x516773[_0xd7ad('0x43')]=_0x516773['attributes'][_0xd7ad('0x45')]?_0x516773[_0xd7ad('0x43')]:_0x1e397c[_0xd7ad('0x3e')];if(!_0x17e5ec['query']['hasOwnProperty'](_0xd7ad('0x46'))){_0x516773[_0xd7ad('0x2b')]=qs[_0xd7ad('0x2b')](_0x17e5ec[_0xd7ad('0x40')][_0xd7ad('0x2b')]);_0x516773[_0xd7ad('0x2e')]=qs['offset'](_0x17e5ec['query'][_0xd7ad('0x2e')]);}_0x516773[_0xd7ad('0x47')]=qs[_0xd7ad('0x48')](_0x17e5ec[_0xd7ad('0x40')][_0xd7ad('0x48')]);_0x516773[_0xd7ad('0x49')]=qs[_0xd7ad('0x42')](_[_0xd7ad('0x4a')](_0x17e5ec[_0xd7ad('0x40')],_0x1e397c[_0xd7ad('0x42')]),_0xe3fc12);if(_0x17e5ec['query']['filter']){_0x516773[_0xd7ad('0x49')]=_[_0xd7ad('0x4b')](_0x516773[_0xd7ad('0x49')],{'$or':_['map'](_0xe3fc12,function(_0x123382){if(_0x123382[_0xd7ad('0x3c')]!==_0xd7ad('0x4c')){var _0x4deccd={};_0x4deccd[_0x123382[_0xd7ad('0x38')]]={'$like':'%'+_0x17e5ec['query'][_0xd7ad('0x4d')]+'%'};return _0x4deccd;}})});}_0x516773=_[_0xd7ad('0x4b')]({},_0x516773,_0x17e5ec['options']);var _0x55c99e={'where':_0x516773['where']};return db[_0xd7ad('0x3a')]['count'](_0x55c99e)['then'](function(_0x508874){_0x31a0ff['count']=_0x508874;if(_0x17e5ec['query'][_0xd7ad('0x4e')]){_0x516773[_0xd7ad('0x4f')]=[{'all':!![]}];}return db[_0xd7ad('0x3a')][_0xd7ad('0x50')](_0x516773);})[_0xd7ad('0x35')](function(_0x4b81e5){_0x31a0ff[_0xd7ad('0x51')]=_0x4b81e5;return _0x31a0ff;})[_0xd7ad('0x35')](respondWithFilteredResult(_0xbf430a,_0x516773))['catch'](handleError(_0xbf430a,null));};exports[_0xd7ad('0x52')]=function(_0xba297c,_0x3109c4){var _0x5ac1c5={'raw':!![],'where':{'id':_0xba297c[_0xd7ad('0x53')]['id']}},_0x40a4dd={};_0x40a4dd[_0xd7ad('0x3e')]=_[_0xd7ad('0x41')](db[_0xd7ad('0x3a')][_0xd7ad('0x3b')]);_0x40a4dd[_0xd7ad('0x40')]=_[_0xd7ad('0x41')](_0xba297c[_0xd7ad('0x40')]);_0x40a4dd['filters']=_[_0xd7ad('0x54')](_0x40a4dd[_0xd7ad('0x3e')],_0x40a4dd[_0xd7ad('0x40')]);_0x5ac1c5['attributes']=_[_0xd7ad('0x54')](_0x40a4dd['model'],qs['fields'](_0xba297c[_0xd7ad('0x40')][_0xd7ad('0x44')]));_0x5ac1c5['attributes']=_0x5ac1c5['attributes'][_0xd7ad('0x45')]?_0x5ac1c5['attributes']:_0x40a4dd['model'];if(_0xba297c['query'][_0xd7ad('0x4e')]){_0x5ac1c5[_0xd7ad('0x4f')]=[{'all':!![]}];}_0x5ac1c5=_[_0xd7ad('0x4b')]({},_0x5ac1c5,_0xba297c['options']);return db[_0xd7ad('0x3a')][_0xd7ad('0x55')](_0x5ac1c5)[_0xd7ad('0x35')](handleEntityNotFound(_0x3109c4,null))[_0xd7ad('0x35')](respondWithResult(_0x3109c4,null))['catch'](handleError(_0x3109c4,null));};exports[_0xd7ad('0x56')]=function(_0x3bd786,_0x597a02){return db['SmsMessage']['create'](_0x3bd786['body'],{})[_0xd7ad('0x35')](respondWithResult(_0x597a02,0xc9))[_0xd7ad('0x26')](handleError(_0x597a02,null));};exports[_0xd7ad('0x34')]=function(_0xc2b847,_0x22d604){if(_0xc2b847['body']['id']){delete _0xc2b847[_0xd7ad('0x57')]['id'];}return db['SmsMessage'][_0xd7ad('0x55')]({'where':{'id':_0xc2b847['params']['id']}})[_0xd7ad('0x35')](handleEntityNotFound(_0x22d604,null))[_0xd7ad('0x35')](saveUpdates(_0xc2b847['body'],null))['then'](respondWithResult(_0x22d604,null))[_0xd7ad('0x26')](handleError(_0x22d604,null));};exports['destroy']=function(_0x195d90,_0x42d990){return db[_0xd7ad('0x3a')][_0xd7ad('0x55')]({'where':{'id':_0x195d90[_0xd7ad('0x53')]['id']}})[_0xd7ad('0x35')](handleEntityNotFound(_0x42d990,null))['then'](removeEntity(_0x42d990,null))['catch'](handleError(_0x42d990,null));};exports['describe']=function(_0x34214a,_0x51c1d8){return db[_0xd7ad('0x3a')]['describe']()[_0xd7ad('0x35')](respondWithResult(_0x51c1d8,null))[_0xd7ad('0x26')](handleError(_0x51c1d8,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports['accept']=function(_0x3f1e4b,_0x463f4b,_0x312162){var _0x3f655a={'agent':{},'channel':_0xd7ad('0x58')};if(_0x3f1e4b[_0xd7ad('0x57')]['id']){delete _0x3f1e4b[_0xd7ad('0x57')]['id'];}_0x3f1e4b[_0xd7ad('0x57')][_0xd7ad('0x59')]=!![];_0x3f1e4b[_0xd7ad('0x57')][_0xd7ad('0x5a')]=moment()[_0xd7ad('0x5b')](_0xd7ad('0x5c'));_0x3f1e4b[_0xd7ad('0x57')][_0xd7ad('0x5d')]=_0x3f1e4b['body']['UserId']||_0x3f1e4b['user']['id'];_0x3f655a[_0xd7ad('0x5e')]['id']=_0x3f1e4b[_0xd7ad('0x57')]['UserId'];return db[_0xd7ad('0x3a')]['find']({'where':{'id':_0x3f1e4b[_0xd7ad('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x463f4b,null))['then'](saveUpdates(_0x3f1e4b[_0xd7ad('0x57')],null))[_0xd7ad('0x35')](function(_0x21bf37){if(_0x21bf37){_0x3f655a[_0xd7ad('0x24')]=_0x21bf37[_0xd7ad('0x5f')]({'plain':!![]});return db[_0xd7ad('0x60')][_0xd7ad('0x55')]({'where':{'id':_0x21bf37[_0xd7ad('0x61')]}});}return null;})[_0xd7ad('0x35')](handleEntityNotFound(_0x463f4b,null))[_0xd7ad('0x35')](function(_0x53397f){if(_0x53397f){return _0x53397f['update']({'UserId':_0x3f1e4b[_0xd7ad('0x57')]['UserId'],'read1stAt':_[_0xd7ad('0x62')](_0x53397f[_0xd7ad('0x63')])?moment()[_0xd7ad('0x5b')](_0xd7ad('0x5c')):undefined});}return null;})['then'](function(_0x4973e2){if(_0x4973e2){_0x3f655a[_0xd7ad('0x64')]=_0x4973e2['get']({'plain':!![]});interaction_log[_0xd7ad('0x1c')](_0xd7ad('0x65'),_0x3f1e4b[_0xd7ad('0x66')]['id'],_0x3f1e4b[_0xd7ad('0x66')]['name'],_0x3f1e4b['user'][_0xd7ad('0x67')],_0x3f655a[_0xd7ad('0x64')]['id'],_0x3f1e4b[_0xd7ad('0x57')]?JSON[_0xd7ad('0x21')](_0x3f1e4b[_0xd7ad('0x57')]):_0xd7ad('0x68'));return respondWithRpcPromise(_0xd7ad('0x69'),'acceptMessage',_0x3f655a);}return null;})[_0xd7ad('0x35')](function(_0x5176b1){var _0x5d3ab9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5176b1[_0xd7ad('0x24')][_0xd7ad('0x6a')];return db['sequelize'][_0xd7ad('0x40')](_0x5d3ab9,{'type':db[_0xd7ad('0x6b')][_0xd7ad('0x6c')][_0xd7ad('0x6d')],'raw':!![]})[_0xd7ad('0x35')](function(_0x2259ea){return _0x2259ea;});})['then'](function(_0x538bae){if(_0x538bae){_0x3f655a[_0xd7ad('0x24')][_0xd7ad('0x6e')]=_0x538bae[0x0];if(!_0x3f1e4b[_0xd7ad('0x57')][_0xd7ad('0x5d')])return;return db['User'][_0xd7ad('0x55')]({'where':{'id':_0x3f1e4b[_0xd7ad('0x57')][_0xd7ad('0x5d')],'role':_0xd7ad('0x5e')},'attributes':['id',_0xd7ad('0x38'),'fullname','email',_0xd7ad('0x6f')],'raw':!![]});}return null;})['then'](function(_0x3ad169){if(!_0x3ad169)return null;_0x3f655a[_0xd7ad('0x24')][_0xd7ad('0x5e')]=_0x3ad169;return _0x3f655a;})[_0xd7ad('0x35')](function(_0x3b01de){if(_0x3b01de){if(_0x3f1e4b[_0xd7ad('0x57')][_0xd7ad('0x70')]){_0x3f655a[_0xd7ad('0x24')]['interface']=util[_0xd7ad('0x5b')](_0xd7ad('0x71'),_0x3f1e4b[_0xd7ad('0x66')]['name']);_0x3f655a[_0xd7ad('0x24')][_0xd7ad('0x72')]=_0x3f655a['channel'];_0x3f655a['message'][_0xd7ad('0x73')]=_0x3f655a[_0xd7ad('0x72')];_0x3f655a['message'][_0xd7ad('0x74')]='accept';return respondWithRpcPromise(_0xd7ad('0x75'),_0xd7ad('0x75'),{'event':_0xd7ad('0x76'),'message':_0x3f655a[_0xd7ad('0x24')]},client9002)[_0xd7ad('0x35')](function(){return _0x3f655a;});}return _0x3f655a;}return null;})['then'](respondWithResult(_0x463f4b,null))[_0xd7ad('0x26')](handleError(_0x463f4b,null));};var interaction_log=require(_0xd7ad('0x77'))(_0xd7ad('0x78'));exports[_0xd7ad('0x32')]=function(_0xbd2a1d,_0x43271f,_0x49cb48){var _0x44e30b={'agent':{},'channel':'sms'};if(_0xbd2a1d[_0xd7ad('0x57')]['id']){delete _0xbd2a1d['body']['id'];}_0xbd2a1d[_0xd7ad('0x57')][_0xd7ad('0x5d')]=_0xbd2a1d[_0xd7ad('0x57')][_0xd7ad('0x5d')]||_0xbd2a1d['user']['id'];_0x44e30b['agent']['id']=_0xbd2a1d['body'][_0xd7ad('0x5d')];return db[_0xd7ad('0x3a')][_0xd7ad('0x55')]({'where':{'id':_0xbd2a1d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x43271f,null))[_0xd7ad('0x35')](function(_0x2565dd){if(_0x2565dd){_0x44e30b[_0xd7ad('0x24')]=_0x2565dd[_0xd7ad('0x5f')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x2565dd[_0xd7ad('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x43271f,null))['then'](function(_0x119c62){if(_0x119c62){_0x44e30b[_0xd7ad('0x64')]=_0x119c62['get']({'plain':!![]});interaction_log[_0xd7ad('0x1c')](_0xd7ad('0x79'),_0xbd2a1d[_0xd7ad('0x66')]['id'],_0xbd2a1d[_0xd7ad('0x66')][_0xd7ad('0x38')],_0xbd2a1d[_0xd7ad('0x66')]['role'],_0x44e30b[_0xd7ad('0x64')]['id'],_0xbd2a1d[_0xd7ad('0x57')]?JSON[_0xd7ad('0x21')](_0xbd2a1d[_0xd7ad('0x57')]):'null');return respondWithRpcPromise('RejectMessage',_0xd7ad('0x7a'),_0x44e30b);}return null;})['then'](function(_0xc00f48){var _0x3998f8=_0xd7ad('0x7b')+_0xc00f48[_0xd7ad('0x24')][_0xd7ad('0x6a')];return db[_0xd7ad('0x7c')]['query'](_0x3998f8,{'type':db[_0xd7ad('0x6b')][_0xd7ad('0x6c')][_0xd7ad('0x6d')],'raw':!![]})['then'](function(_0x32c196){return _0x32c196;});})[_0xd7ad('0x35')](function(_0x36f9ce){if(_0x36f9ce){_0x44e30b[_0xd7ad('0x24')]['contact']=_0x36f9ce[0x0];if(!_0xbd2a1d[_0xd7ad('0x57')][_0xd7ad('0x5d')])return;return db[_0xd7ad('0x7d')][_0xd7ad('0x55')]({'where':{'id':_0xbd2a1d[_0xd7ad('0x57')]['UserId'],'role':_0xd7ad('0x5e')},'attributes':['id',_0xd7ad('0x38'),_0xd7ad('0x7e'),_0xd7ad('0x7f'),_0xd7ad('0x6f')],'raw':!![]});}return null;})[_0xd7ad('0x35')](function(_0x2e7aff){if(!_0x2e7aff)return null;_0x44e30b[_0xd7ad('0x24')][_0xd7ad('0x5e')]=_0x2e7aff;return _0x44e30b;})[_0xd7ad('0x35')](function(_0x6ee6a){if(_0x6ee6a){_0x6ee6a['message'][_0xd7ad('0x80')]=util[_0xd7ad('0x5b')]('SIP/%s',_0xbd2a1d[_0xd7ad('0x66')]['name']);_0x6ee6a[_0xd7ad('0x24')]['channel']=_0x44e30b[_0xd7ad('0x72')];_0x6ee6a['message'][_0xd7ad('0x73')]=_0x44e30b[_0xd7ad('0x72')];_0x6ee6a[_0xd7ad('0x24')][_0xd7ad('0x74')]='reject';respondWithRpcPromise(_0xd7ad('0x75'),_0xd7ad('0x75'),{'event':_0xd7ad('0x81'),'message':_0x6ee6a[_0xd7ad('0x24')]},client9002);return _0x44e30b;}return null;})[_0xd7ad('0x35')](respondWithResult(_0x43271f,null))['catch'](handleError(_0x43271f,null));};exports['status']=function(_0xa6cd4c,_0x158d06,_0x19c5f8){if(_0xa6cd4c[_0xd7ad('0x57')]['id']){delete _0xa6cd4c['body']['id'];}var _0x562847;return db[_0xd7ad('0x3a')]['find']({'where':{'id':_0xa6cd4c[_0xd7ad('0x53')]['id']}})[_0xd7ad('0x35')](handleEntityNotFound(_0x158d06,null))[_0xd7ad('0x35')](function(_0x479ea1){if(_0x479ea1){_0x562847=_0x479ea1;return db[_0xd7ad('0x82')][_0xd7ad('0x55')]({'where':{'id':_0x479ea1['SmsAccountId']}});}})[_0xd7ad('0x35')](handleEntityNotFound(_0x158d06,null))[_0xd7ad('0x35')](function(_0x55db32){if(_0x55db32){logger[_0xd7ad('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xd7ad('0x83'),_0x55db32[_0xd7ad('0x3c')],util[_0xd7ad('0x84')](_0xa6cd4c[_0xd7ad('0x57')],{'showHidden':![],'depth':null}));switch(_0x55db32[_0xd7ad('0x3c')]){case _0xd7ad('0x85'):if(_0xa6cd4c[_0xd7ad('0x57')][_0xd7ad('0x86')]&&_0xa6cd4c[_0xd7ad('0x57')]['MessageSid']===_0x562847[_0xd7ad('0x87')]){return _0x562847[_0xd7ad('0x34')]({'read':!![]});}else{logger[_0xd7ad('0x23')](_0xd7ad('0x88'),_0xd7ad('0x28'),'twilio',util[_0xd7ad('0x84')](_0xa6cd4c['body'],{'showHidden':![],'depth':null}));}break;case _0xd7ad('0x89'):if(_0xa6cd4c['body'][_0xd7ad('0x8a')]&&_0xa6cd4c[_0xd7ad('0x57')]['MessageUUID']===_0x562847[_0xd7ad('0x87')]&&_[_0xd7ad('0x8b')](['sent','delivered'],_0xa6cd4c[_0xd7ad('0x57')][_0xd7ad('0x8c')])>=0x0){return _0x562847[_0xd7ad('0x34')]({'read':!![]});}else{logger[_0xd7ad('0x23')](_0xd7ad('0x88'),_0xd7ad('0x28'),_0xd7ad('0x8d'),util[_0xd7ad('0x84')](_0xa6cd4c[_0xd7ad('0x57')],{'showHidden':![],'depth':null}));}break;case _0xd7ad('0x8e'):var _0x25cf92=_0xa6cd4c['body'][_0xd7ad('0x8f')][0x0];if(_0x25cf92[_0xd7ad('0x28')][_0xd7ad('0x90')]==='DELIVERED'){return _0x562847[_0xd7ad('0x34')]({'read':!![]});}else{logger[_0xd7ad('0x23')](_0xd7ad('0x88'),_0xd7ad('0x28'),_0xd7ad('0x8e'),util['inspect'](_0xa6cd4c[_0xd7ad('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x562847;}})[_0xd7ad('0x35')](respondWithResult(_0x158d06,null))[_0xd7ad('0x26')](handleError(_0x158d06,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7b159c9..c60fbdc 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 _0xad60=['save','remove','emit','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad60,0x101));var _0x0ad6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xad60[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require(_0x0ad6('0x0'));var SmsMessage=require(_0x0ad6('0x1'))['db'][_0x0ad6('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0ad6('0x3')](0x0);var events={'afterCreate':_0x0ad6('0x4'),'afterUpdate':'update','afterDestroy':_0x0ad6('0x5')};function emitEvent(_0x5a9420){return function(_0x5b8b41,_0x54a56d,_0x437b07){SmsMessageEvents['emit'](_0x5a9420+':'+_0x5b8b41['id'],_0x5b8b41);SmsMessageEvents[_0x0ad6('0x6')](_0x5a9420,_0x5b8b41);_0x437b07(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x0ad6('0x7')](e,emitEvent(event));}}module[_0x0ad6('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x932d=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0x23353d,_0x2e6d2a){var _0x24e1d7=function(_0x1186c7){while(--_0x1186c7){_0x23353d['push'](_0x23353d['shift']());}};_0x24e1d7(++_0x2e6d2a);}(_0x932d,0xab));var _0xd932=function(_0x2a9340,_0x4fb2da){_0x2a9340=_0x2a9340-0x0;var _0x3cdf4c=_0x932d[_0x2a9340];return _0x3cdf4c;};'use strict';var EventEmitter=require(_0xd932('0x0'));var SmsMessage=require(_0xd932('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd932('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd932('0x3'),'afterDestroy':'remove'};function emitEvent(_0x37a834){return function(_0xfc4dad,_0x8b08be,_0x4a586a){SmsMessageEvents[_0xd932('0x4')](_0x37a834+':'+_0xfc4dad['id'],_0xfc4dad);SmsMessageEvents[_0xd932('0x4')](_0x37a834,_0xfc4dad);_0x4a586a(null);};}for(var e in events){if(events[_0xd932('0x5')](e)){var event=events[e];SmsMessage[_0xd932('0x6')](e,emitEvent(event));}}module[_0xd932('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 706782e..b01d7bf 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 _0x3661=['SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','twilio','accountSid','phone','messages','create','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','authToken','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','xCALLY\x20Motion','senderString','%s:%s','password','https://rest.clicksend.com/v3/sms/send','format','toString','base64','http_code','data','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','text','sort','apiKey','md5','digest','hex','/external/get/send.php?','keys','id_sms','csc','clickatell','https://platform.clickatell.com/messages','uuid','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','Basic\x20%s','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','bluebird','request-promise','path','rimraf','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','SmsInteraction','findOne'];(function(_0x3a36fb,_0x5124c1){var _0x3742e2=function(_0x5602e8){while(--_0x5602e8){_0x3a36fb['push'](_0x3a36fb['shift']());}};_0x3742e2(++_0x5124c1);}(_0x3661,0x1cf));var _0x1366=function(_0x53871c,_0x5a7a3b){_0x53871c=_0x53871c-0x0;var _0x5ead1a=_0x3661[_0x53871c];return _0x5ead1a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1366('0x0'));var rp=require(_0x1366('0x1'));var fs=require('fs');var path=require(_0x1366('0x2'));var rimraf=require(_0x1366('0x3'));var config=require('../../config/environment');var attributes=require(_0x1366('0x4'));module['exports']=function(_0x10ee6f,_0x22f90e){return _0x10ee6f[_0x1366('0x5')](_0x1366('0x6'),attributes,{'tableName':_0x1366('0x7'),'paranoid':![],'indexes':[{'name':_0x1366('0x8'),'fields':[_0x1366('0x8')]},{'name':_0x1366('0x9'),'fields':[_0x1366('0xa')],'type':_0x1366('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x518a76,_0x4ae2cf,_0x508b01){var _0x1d59ac=_0x10ee6f[_0x1366('0xc')];var _0x535ea4=_0x518a76[_0x1366('0xd')]({'plain':!![]});if(_0x535ea4[_0x1366('0xe')]['toLowerCase']()==='in'||_0x535ea4[_0x1366('0xe')][_0x1366('0xf')]()===_0x1366('0x10')&&!_0x535ea4[_0x1366('0x11')]&&!_[_0x1366('0x12')](_0x535ea4['UserId'])&&!_[_0x1366('0x12')](_0x535ea4['SmsInteractionId'])){_0x1d59ac[_0x1366('0x13')][_0x1366('0x14')]({'where':{'id':_0x535ea4[_0x1366('0x15')]}})[_0x1366('0x16')](function(_0x1b836c){if(_0x1b836c){_0x1b836c[_0x1366('0x17')]({'lastMsgAt':_0x535ea4[_0x1366('0x18')],'lastMsgDirection':_0x535ea4['direction'][_0x1366('0xf')]()});}})[_0x1366('0x19')](function(_0x1d3c9b){console[_0x1366('0x1a')](_0x1d3c9b);});}if(_0x535ea4[_0x1366('0xe')]==='out'&&!_0x535ea4[_0x1366('0x11')]){var _0x3b7ed9;_0x1d59ac[_0x1366('0x1b')][_0x1366('0x1c')]({'where':{'id':_0x535ea4[_0x1366('0x1d')]},'raw':!![]})['then'](function(_0x1fdd63){_0x3b7ed9=_0x1fdd63;if(_0x3b7ed9&&_0x3b7ed9['type']){switch(_0x3b7ed9['type']){case _0x1366('0x1e'):var _0xbc7649=require('twilio');if(_0x3b7ed9[_0x1366('0x1f')]&&_0x3b7ed9['authToken']&&_0x3b7ed9[_0x1366('0x20')]){var _0x14e35c=new _0xbc7649(_0x3b7ed9[_0x1366('0x1f')],_0x3b7ed9['authToken']);_0x14e35c[_0x1366('0x21')][_0x1366('0x22')]({'body':_0x535ea4[_0x1366('0xa')],'to':_0x535ea4[_0x1366('0x20')],'from':_0x3b7ed9[_0x1366('0x20')],'statusCallback':_0x3b7ed9[_0x1366('0x23')]+_0x1366('0x24')+_0x535ea4['id']+'/status?token='+_0x3b7ed9[_0x1366('0x25')]})[_0x1366('0x16')](function(_0x3095f0){if(_0x3095f0[_0x1366('0x26')]){return _0x518a76['update']({'messageId':_0x3095f0[_0x1366('0x26')]});}})[_0x1366('0x19')](function(_0x2ffe3e){logger[_0x1366('0x1a')](_0x1366('0x27'),'afterCreate',_0x1366('0x1e'),util[_0x1366('0x28')](_0x2ffe3e,{'showHidden':![],'depth':null}));});}else{logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x1366('0x2a'):var _0x4475b5=_0x1366('0x2b');if(_0x3b7ed9[_0x1366('0x2c')]&&_0x3b7ed9['password']){var _0x1b938c={'recipient':[_0x535ea4['phone']],'message':_0x535ea4[_0x1366('0xa')],'message_type':_0x3b7ed9[_0x1366('0x2d')]};if(_0x3b7ed9['smsMethod']&&_0x3b7ed9['smsMethod']!=='SI'){_0x1b938c[_0x1366('0x2e')]=_0x3b7ed9[_0x1366('0x20')];}var _0x2cd11b={'url':_0x4475b5+_0x1366('0x2f')+_0x3b7ed9[_0x1366('0x2c')]+_0x1366('0x30')+_0x3b7ed9['password'],'method':_0x1366('0x31')};rp(_0x2cd11b)[_0x1366('0x16')](function(_0x5d42e5){var _0x443040=_0x5d42e5[_0x1366('0x32')](';');var _0xcea793={'user_key':_0x443040[0x0],'session_key':_0x443040[0x1]};_0x2cd11b={'url':_0x4475b5+_0x1366('0x33'),'method':_0x1366('0x34'),'headers':{'user_key':_0xcea793[_0x1366('0x35')],'Session_key':_0xcea793[_0x1366('0x36')]},'json':!![],'body':_0x1b938c};return rp(_0x2cd11b);})[_0x1366('0x16')](function(_0x38544e){if(_0x38544e[_0x1366('0x37')]>=0x1){var _0x44a2d0={'messageId':_0x38544e[_0x1366('0x38')]};if(_0x3b7ed9[_0x1366('0x2d')]!=='GP'||!_0x3b7ed9[_0x1366('0x39')]){_0x44a2d0[_0x1366('0x3a')]=!![];}return _0x518a76[_0x1366('0x17')](_0x44a2d0);}else{return logger[_0x1366('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1366('0x29'),'skebby',util[_0x1366('0x28')](_0x38544e,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5e547b){return logger[_0x1366('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1366('0x29'),_0x1366('0x2a'),util[_0x1366('0x28')](_0x5e547b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1366('0x27'),'afterCreate','skebby',_0x1366('0x3b'));}break;case'connectel':if(_0x3b7ed9[_0x1366('0x3c')]){var _0x5a84b1={'recipient':_0x535ea4['phone'],'message':_0x535ea4[_0x1366('0xa')],'sender':_0x3b7ed9['senderString']||_0x3b7ed9['phone'],'authorization':_0x3b7ed9[_0x1366('0x3c')]};var _0x4ae2cf={'method':_0x1366('0x34'),'uri':_0x1366('0x3d'),'body':_0x5a84b1,'json':!![]};rp(_0x4ae2cf)[_0x1366('0x16')](function(_0x98f446){var _0x5ba4ce={'messageId':_0x98f446[_0x1366('0x3e')]};if(!_0x3b7ed9[_0x1366('0x39')]){_0x5ba4ce[_0x1366('0x3a')]=!![];}return _0x518a76['update'](_0x5ba4ce);})[_0x1366('0x19')](function(_0x15e0b7){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1366('0x3f'),util[_0x1366('0x28')](_0x15e0b7,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1366('0x3f'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x3b7ed9[_0x1366('0x2c')]&&_0x3b7ed9['password']){var _0x5a84b1={'messages':[{'source':_0x1366('0x40'),'to':_0x535ea4[_0x1366('0x20')],'body':_0x535ea4[_0x1366('0xa')],'from':_0x3b7ed9[_0x1366('0x41')]||_0x3b7ed9['phone']}]};var _0x8b5bfa=util['format'](_0x1366('0x42'),_0x3b7ed9[_0x1366('0x2c')],_0x3b7ed9[_0x1366('0x43')]);var _0x4ae2cf={'method':_0x1366('0x34'),'uri':_0x1366('0x44'),'body':_0x5a84b1,'headers':{'Authorization':util[_0x1366('0x45')]('Basic\x20%s',new Buffer(_0x8b5bfa)[_0x1366('0x46')](_0x1366('0x47')))},'json':!![]};rp(_0x4ae2cf)[_0x1366('0x16')](function(_0x299707){if(_0x299707[_0x1366('0x48')]>=0xc8&&_0x299707[_0x1366('0x48')]<=0xce){if(_0x299707[_0x1366('0x49')]&&_0x299707['data']['queued_count']>0x0){var _0x305bbd=_[_0x1366('0x4a')](_0x299707['data'][_0x1366('0x21')]);var _0x224624={'messageId':_0x305bbd[_0x1366('0x4b')]};if(!_0x3b7ed9[_0x1366('0x39')]){_0x224624['read']=!![];}return _0x518a76[_0x1366('0x17')](_0x224624);}else{logger[_0x1366('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1366('0x29'),_0x1366('0x4c'),util[_0x1366('0x28')](_0x299707,{'showHidden':![],'depth':null}));}}else{logger[_0x1366('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1366('0x29'),_0x1366('0x4c'),util[_0x1366('0x28')](_0x299707,{'showHidden':![],'depth':null}));}})[_0x1366('0x19')](function(_0x5780b8){logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),_0x1366('0x4c'),util[_0x1366('0x28')](_0x5780b8,{'showHidden':![],'depth':null}));});}else{logger[_0x1366('0x1a')](_0x1366('0x27'),'afterCreate',_0x1366('0x4c'),_0x1366('0x3b'));}break;case _0x1366('0x4d'):if(_0x3b7ed9[_0x1366('0x4e')]&&_0x3b7ed9[_0x1366('0x3c')]){var _0x5a84b1={'dst':_0x535ea4['phone'],'text':_0x535ea4[_0x1366('0xa')],'src':_0x3b7ed9[_0x1366('0x41')]||_0x3b7ed9[_0x1366('0x20')],'url':_0x3b7ed9['remote']+_0x1366('0x24')+_0x535ea4['id']+'/status?token='+_0x3b7ed9['token']};var _0x8b5bfa=util[_0x1366('0x45')](_0x1366('0x42'),_0x3b7ed9[_0x1366('0x4e')],_0x3b7ed9[_0x1366('0x3c')]);var _0x4ae2cf={'method':_0x1366('0x34'),'uri':util[_0x1366('0x45')](_0x1366('0x4f'),_0x3b7ed9[_0x1366('0x4e')]),'body':_0x5a84b1,'headers':{'Authorization':util[_0x1366('0x45')]('Basic\x20%s',new Buffer(_0x8b5bfa)[_0x1366('0x46')](_0x1366('0x47')))},'json':!![]};rp(_0x4ae2cf)[_0x1366('0x16')](function(_0x31d868){var _0x179644={'messageId':_0x31d868['message_uuid'][0x0]};return _0x518a76[_0x1366('0x17')](_0x179644);})[_0x1366('0x19')](function(_0x354f61){logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),'plivo',util['inspect'](_0x354f61,{'showHidden':![],'depth':null}));});}else{logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),_0x1366('0x4d'),_0x1366('0x50'));}break;case _0x1366('0x51'):if(_0x3b7ed9[_0x1366('0x2c')]&&_0x3b7ed9[_0x1366('0x43')]){if(_0x3b7ed9[_0x1366('0x52')]){var _0x447628={'method':_0x1366('0x34'),'uri':_0x3b7ed9['baseUrl']+_0x1366('0x53'),'body':{'username':_0x3b7ed9['username'],'password':_0x3b7ed9[_0x1366('0x43')]},'json':!![]};return rp(_0x447628)[_0x1366('0x16')](function(_0x2e112f){var _0x484564={'method':_0x1366('0x34'),'uri':_0x3b7ed9[_0x1366('0x52')]+_0x1366('0x54'),'body':{'messages':[{'from':_0x3b7ed9['phone'],'destinations':[{'to':_0x535ea4[_0x1366('0x20')]}],'text':_0x535ea4[_0x1366('0xa')],'notifyUrl':_0x3b7ed9[_0x1366('0x23')]+_0x1366('0x24')+_0x535ea4['id']+_0x1366('0x55')+_0x3b7ed9['token'],'notifyContentType':'application/json','callbackData':_0x3b7ed9['phone']+';'+_0x535ea4[_0x1366('0xa')]}]},'headers':{'Authorization':_0x1366('0x56')+_0x2e112f[_0x1366('0x25')]},'json':!![]};return rp(_0x484564)['then'](function(_0x1e18b3){if(_0x1e18b3[_0x1366('0x21')]){var _0x401207={'messageId':_0x1e18b3[_0x1366('0x21')][0x0][_0x1366('0x8')]};if(!_0x3b7ed9[_0x1366('0x39')]){_0x401207[_0x1366('0x3a')]=!![];}return _0x518a76[_0x1366('0x17')](_0x401207);}else{return logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),_0x1366('0x51'),util[_0x1366('0x28')](_0x1e18b3,{'showHidden':![],'depth':null}));}});})[_0x1366('0x19')](function(_0x4a20b4){return logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),_0x1366('0x51'),util[_0x1366('0x28')](_0x4a20b4,{'showHidden':![],'depth':null}));});}else{logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),_0x1366('0x51'),_0x1366('0x57'));}}else{logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),_0x1366('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x385d91=require(_0x1366('0x58'));if(_0x3b7ed9['apiKey']){var _0x247343={};_0x247343['login']=_0x3b7ed9['username'];_0x247343[_0x1366('0x20')]=_0x535ea4['phone'];_0x247343[_0x1366('0x2e')]=_0x3b7ed9[_0x1366('0x20')];_0x247343[_0x1366('0x59')]=_0x535ea4[_0x1366('0xa')];_0x247343['timestamp']=+new Date();var _0x24eae4='';var _0x24dd52='';var _0x558c92=Object['keys'](_0x247343);_0x558c92[_0x1366('0x5a')]();for(var _0x3366d3=0x0;_0x3366d3<_0x558c92['length'];_0x3366d3++){if(_0x24eae4!=''){_0x24eae4+='&';}_0x24eae4+=_0x558c92[_0x3366d3]+'='+encodeURIComponent(_0x247343[_0x558c92[_0x3366d3]]);_0x24dd52+=_0x247343[_0x558c92[_0x3366d3]];}_0x24dd52+=_0x3b7ed9[_0x1366('0x5b')];_0x24dd52=_0x385d91['createHash'](_0x1366('0x5c'))[_0x1366('0x17')](_0x24dd52)[_0x1366('0x5d')](_0x1366('0x5e'));if(_0x24eae4!==''){_0x24eae4+='&';}_0x24eae4+='signature='+_0x24dd52;var _0x2cd11b={'method':_0x1366('0x31'),'uri':_0x3b7ed9[_0x1366('0x52')]+_0x1366('0x5f')+_0x24eae4,'json':!![]};return rp(_0x2cd11b)['then'](function(_0x2c54af){var _0x87499f=Object[_0x1366('0x60')](_0x2c54af);if(_0x2c54af[_0x87499f[0x0]]['error']&&parseInt(_0x2c54af[_0x87499f[0x0]][_0x1366('0x1a')])===0x0){var _0x10f9de={'messageId':_0x2c54af[_0x87499f[0x0]][_0x1366('0x61')]};if(!_0x3b7ed9[_0x1366('0x39')]){_0x10f9de['read']=!![];}return _0x518a76[_0x1366('0x17')](_0x10f9de);}else{return logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),_0x1366('0x62'),util[_0x1366('0x28')](_0x2c54af['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x40627f){return logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),_0x1366('0x62'),util[_0x1366('0x28')](_0x40627f,{'showHidden':![],'depth':null}));});}else{logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),_0x1366('0x62'),'Missing\x20parameters:\x20apiKey');}break;case _0x1366('0x63'):if(_0x3b7ed9['apiKey']){var _0x4ed09f={'method':_0x1366('0x34'),'uri':_0x1366('0x64'),'headers':{'Authorization':_0x3b7ed9['apiKey']},'body':{'content':_0x535ea4[_0x1366('0xa')],'to':[_0x535ea4[_0x1366('0x20')]],'from':_0x3b7ed9[_0x1366('0x20')],'binary':![],'clientMessageId':_0x1366('0x65'),'charset':'UTF-8'},'json':!![]};rp(_0x4ed09f)['then'](function(_0x519294){if(!_0x519294[_0x1366('0x1a')]){var _0x58eca8={'messageId':_0x519294[_0x1366('0x21')][0x0]['apiMessageId']};if(!_0x3b7ed9[_0x1366('0x39')]){_0x58eca8[_0x1366('0x3a')]=!![];}return _0x518a76['update'](_0x58eca8);}else{return logger[_0x1366('0x1a')](_0x1366('0x27'),'afterCreate',_0x1366('0x63'),util[_0x1366('0x28')](_0x519294[_0x1366('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x588ba8){return logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),'clickatell',util[_0x1366('0x28')](_0x588ba8,{'showHidden':![],'depth':null}));});}else{logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),_0x1366('0x63'),_0x1366('0x66'));}break;case _0x1366('0x67'):if(_0x3b7ed9[_0x1366('0x2c')]&&_0x3b7ed9[_0x1366('0x43')]){var _0x8b5bfa=util['format'](_0x1366('0x42'),_0x3b7ed9[_0x1366('0x2c')],_0x3b7ed9[_0x1366('0x43')]);var _0x4ae2cf={'method':'POST','uri':_0x1366('0x68')+_0x3b7ed9[_0x1366('0x69')]+_0x1366('0x6a'),'body':{'to':[_0x535ea4[_0x1366('0x20')]],'text':_0x535ea4[_0x1366('0xa')],'from':_0x3b7ed9[_0x1366('0x20')],'applicationId':_0x3b7ed9[_0x1366('0x6b')]},'headers':{'Authorization':util[_0x1366('0x45')](_0x1366('0x6c'),new Buffer(_0x8b5bfa)[_0x1366('0x46')](_0x1366('0x47')))},'json':!![]};rp(_0x4ae2cf)[_0x1366('0x16')](function(_0x3530dc){if(_0x3530dc['id']){var _0x1e7fa={'messageId':_0x3530dc['id']};return _0x518a76[_0x1366('0x17')](_0x1e7fa);}else{logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),'bandwidth',util['inspect'](_0x3530dc,{'showHidden':![],'depth':null}));}})[_0x1366('0x19')](function(_0x4a7602){logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),_0x1366('0x67'),util['inspect'](_0x4a7602,{'showHidden':![],'depth':null}));});}else{logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),'bandwidth',_0x1366('0x3b'));}break;case _0x1366('0x6d'):if(_0x3b7ed9[_0x1366('0x5b')]){var _0x5bd2cc={};var _0x2cd11b={'method':'POST','uri':_0x1366('0x6e'),'headers':{'Authorization':'Bearer\x20'+_0x3b7ed9[_0x1366('0x5b')],'Content-Type':_0x1366('0x6f')},'body':{'from':_0x3b7ed9[_0x1366('0x20')],'to':_0x535ea4[_0x1366('0x20')],'text':_0x535ea4[_0x1366('0xa')]},'json':!![]};return rp(_0x2cd11b)[_0x1366('0x16')](function(_0x535298){if(_0x535298[_0x1366('0x70')]==0xca){_0x5bd2cc[_0x1366('0x71')]=_0x535298;var _0x1e364e={'method':_0x1366('0x34'),'uri':_0x1366('0x72'),'headers':{'Authorization':_0x1366('0x73')+_0x3b7ed9['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x5bd2cc[_0x1366('0x71')][_0x1366('0x74')]},'json':!![]};return rp(_0x1e364e)[_0x1366('0x16')](function(_0x397887){_0x5bd2cc['status']=_0x397887;var _0x237200={'messageId':_0x5bd2cc[_0x1366('0x71')][_0x1366('0x74')],'read':!![]};return _0x518a76['update'](_0x237200);});}else{return logger['error'](_0x1366('0x27'),_0x1366('0x29'),_0x1366('0x6d'),util[_0x1366('0x28')](_0x535298,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a6886){return logger['error'](_0x1366('0x27'),_0x1366('0x29'),_0x1366('0x6d'),util[_0x1366('0x28')](_0x2a6886,{'showHidden':![],'depth':null}));});}else{return logger[_0x1366('0x1a')](_0x1366('0x27'),_0x1366('0x29'),'intelepeer',_0x1366('0x75'));}break;}}})[_0x1366('0x76')](function(){_0x508b01();});}else{_0x508b01();}}},'charset':_0x1366('0x77'),'collate':_0x1366('0x78')});}; \ No newline at end of file +var _0x108d=['message','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','sms_messages','messageId','body','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','findOne','then','update','createdAt','error','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/status?token=','token','sid','catch','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','GET','split','sms','POST','session_key','total_sent','internal_order_id','read','skebby','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','login','text','timestamp','keys','createHash','md5','digest','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiKey','https://platform.clickatell.com/messages','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr'];(function(_0x302f55,_0x31872f){var _0x55ca94=function(_0x477ac3){while(--_0x477ac3){_0x302f55['push'](_0x302f55['shift']());}};_0x55ca94(++_0x31872f);}(_0x108d,0x7b));var _0xd108=function(_0x2c847c,_0x1087b7){_0x2c847c=_0x2c847c-0x0;var _0x4483bb=_0x108d[_0x2c847c];return _0x4483bb;};'use strict';var _=require('lodash');var util=require(_0xd108('0x0'));var logger=require(_0xd108('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd108('0x2'));var rp=require(_0xd108('0x3'));var fs=require('fs');var path=require(_0xd108('0x4'));var rimraf=require(_0xd108('0x5'));var config=require(_0xd108('0x6'));var attributes=require(_0xd108('0x7'));module[_0xd108('0x8')]=function(_0x4f2431,_0x13afd0){return _0x4f2431['define']('SmsMessage',attributes,{'tableName':_0xd108('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd108('0xa')]},{'name':'fti_sms_messages','fields':[_0xd108('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28a12d,_0x23299e,_0x17ff51){var _0x216d1e=_0x4f2431['models'];var _0x4b3dc2=_0x28a12d[_0xd108('0xc')]({'plain':!![]});if(_0x4b3dc2[_0xd108('0xd')][_0xd108('0xe')]()==='in'||_0x4b3dc2[_0xd108('0xd')]['toLowerCase']()===_0xd108('0xf')&&!_0x4b3dc2[_0xd108('0x10')]&&!_[_0xd108('0x11')](_0x4b3dc2[_0xd108('0x12')])&&!_[_0xd108('0x11')](_0x4b3dc2[_0xd108('0x13')])){_0x216d1e['SmsInteraction'][_0xd108('0x14')]({'where':{'id':_0x4b3dc2['SmsInteractionId']}})[_0xd108('0x15')](function(_0x4fde24){if(_0x4fde24){_0x4fde24[_0xd108('0x16')]({'lastMsgAt':_0x4b3dc2[_0xd108('0x17')],'lastMsgDirection':_0x4b3dc2['direction'][_0xd108('0xe')]()});}})['catch'](function(_0x4aec0d){console[_0xd108('0x18')](_0x4aec0d);});}if(_0x4b3dc2['direction']===_0xd108('0xf')&&!_0x4b3dc2[_0xd108('0x10')]){var _0xcdb26d;_0x216d1e['SmsAccount']['find']({'where':{'id':_0x4b3dc2[_0xd108('0x19')]},'raw':!![]})[_0xd108('0x15')](function(_0xc9b229){_0xcdb26d=_0xc9b229;if(_0xcdb26d&&_0xcdb26d['type']){switch(_0xcdb26d[_0xd108('0x1a')]){case _0xd108('0x1b'):var _0x284d37=require(_0xd108('0x1b'));if(_0xcdb26d[_0xd108('0x1c')]&&_0xcdb26d[_0xd108('0x1d')]&&_0xcdb26d[_0xd108('0x1e')]){var _0x286b60=new _0x284d37(_0xcdb26d['accountSid'],_0xcdb26d[_0xd108('0x1d')]);_0x286b60[_0xd108('0x1f')]['create']({'body':_0x4b3dc2[_0xd108('0xb')],'to':_0x4b3dc2[_0xd108('0x1e')],'from':_0xcdb26d[_0xd108('0x1e')],'statusCallback':_0xcdb26d[_0xd108('0x20')]+'/api/sms/messages/'+_0x4b3dc2['id']+_0xd108('0x21')+_0xcdb26d[_0xd108('0x22')]})['then'](function(_0x3f98dc){if(_0x3f98dc[_0xd108('0x23')]){return _0x28a12d[_0xd108('0x16')]({'messageId':_0x3f98dc[_0xd108('0x23')]});}})[_0xd108('0x24')](function(_0x1957bb){logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x1b'),util[_0xd108('0x26')](_0x1957bb,{'showHidden':![],'depth':null}));});}else{logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x1b'),_0xd108('0x28'));}break;case'skebby':var _0x208b8f=_0xd108('0x29');if(_0xcdb26d[_0xd108('0x2a')]&&_0xcdb26d[_0xd108('0x2b')]){var _0x4752dd={'recipient':[_0x4b3dc2[_0xd108('0x1e')]],'message':_0x4b3dc2[_0xd108('0xb')],'message_type':_0xcdb26d[_0xd108('0x2c')]};if(_0xcdb26d['smsMethod']&&_0xcdb26d['smsMethod']!=='SI'){_0x4752dd[_0xd108('0x2d')]=_0xcdb26d[_0xd108('0x1e')];}var _0x522ac1={'url':_0x208b8f+_0xd108('0x2e')+_0xcdb26d[_0xd108('0x2a')]+'&password='+_0xcdb26d[_0xd108('0x2b')],'method':_0xd108('0x2f')};rp(_0x522ac1)[_0xd108('0x15')](function(_0x5bef30){var _0x1bb08f=_0x5bef30[_0xd108('0x30')](';');var _0x18e490={'user_key':_0x1bb08f[0x0],'session_key':_0x1bb08f[0x1]};_0x522ac1={'url':_0x208b8f+_0xd108('0x31'),'method':_0xd108('0x32'),'headers':{'user_key':_0x18e490['user_key'],'Session_key':_0x18e490[_0xd108('0x33')]},'json':!![],'body':_0x4752dd};return rp(_0x522ac1);})[_0xd108('0x15')](function(_0x1f1246){if(_0x1f1246[_0xd108('0x34')]>=0x1){var _0x2e0306={'messageId':_0x1f1246[_0xd108('0x35')]};if(_0xcdb26d['smsMethod']!=='GP'||!_0xcdb26d['deliveryReport']){_0x2e0306[_0xd108('0x36')]=!![];}return _0x28a12d[_0xd108('0x16')](_0x2e0306);}else{return logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x37'),util[_0xd108('0x26')](_0x1f1246,{'showHidden':![],'depth':null}));}})['catch'](function(_0x519ccb){return logger[_0xd108('0x18')](_0xd108('0x27'),'afterCreate',_0xd108('0x37'),util[_0xd108('0x26')](_0x519ccb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd108('0x27'),'afterCreate','skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0xd108('0x38'):if(_0xcdb26d[_0xd108('0x1d')]){var _0x315382={'recipient':_0x4b3dc2[_0xd108('0x1e')],'message':_0x4b3dc2[_0xd108('0xb')],'sender':_0xcdb26d[_0xd108('0x39')]||_0xcdb26d['phone'],'authorization':_0xcdb26d[_0xd108('0x1d')]};var _0x23299e={'method':_0xd108('0x32'),'uri':_0xd108('0x3a'),'body':_0x315382,'json':!![]};rp(_0x23299e)[_0xd108('0x15')](function(_0x253ef9){var _0xbe5bfa={'messageId':_0x253ef9[_0xd108('0x3b')]};if(!_0xcdb26d[_0xd108('0x3c')]){_0xbe5bfa[_0xd108('0x36')]=!![];}return _0x28a12d['update'](_0xbe5bfa);})[_0xd108('0x24')](function(_0x4e9dd3){logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x38'),util['inspect'](_0x4e9dd3,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x38'),_0xd108('0x3d'));}break;case _0xd108('0x3e'):if(_0xcdb26d[_0xd108('0x2a')]&&_0xcdb26d['password']){var _0x315382={'messages':[{'source':'xCALLY\x20Motion','to':_0x4b3dc2[_0xd108('0x1e')],'body':_0x4b3dc2[_0xd108('0xb')],'from':_0xcdb26d[_0xd108('0x39')]||_0xcdb26d['phone']}]};var _0x4f868e=util[_0xd108('0x3f')](_0xd108('0x40'),_0xcdb26d[_0xd108('0x2a')],_0xcdb26d[_0xd108('0x2b')]);var _0x23299e={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x315382,'headers':{'Authorization':util[_0xd108('0x3f')](_0xd108('0x41'),new Buffer(_0x4f868e)[_0xd108('0x42')](_0xd108('0x43')))},'json':!![]};rp(_0x23299e)[_0xd108('0x15')](function(_0x239d37){if(_0x239d37[_0xd108('0x44')]>=0xc8&&_0x239d37['http_code']<=0xce){if(_0x239d37[_0xd108('0x45')]&&_0x239d37[_0xd108('0x45')][_0xd108('0x46')]>0x0){var _0x28696a=_['head'](_0x239d37['data'][_0xd108('0x1f')]);var _0x341bfb={'messageId':_0x28696a[_0xd108('0x47')]};if(!_0xcdb26d['deliveryReport']){_0x341bfb['read']=!![];}return _0x28a12d[_0xd108('0x16')](_0x341bfb);}else{logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x48'),util[_0xd108('0x26')](_0x239d37,{'showHidden':![],'depth':null}));}}else{logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x48'),util['inspect'](_0x239d37,{'showHidden':![],'depth':null}));}})[_0xd108('0x24')](function(_0x34d44c){logger['error'](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x48'),util[_0xd108('0x26')](_0x34d44c,{'showHidden':![],'depth':null}));});}else{logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd108('0x48'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xd108('0x49'):if(_0xcdb26d[_0xd108('0x4a')]&&_0xcdb26d['authToken']){var _0x315382={'dst':_0x4b3dc2[_0xd108('0x1e')],'text':_0x4b3dc2[_0xd108('0xb')],'src':_0xcdb26d[_0xd108('0x39')]||_0xcdb26d[_0xd108('0x1e')],'url':_0xcdb26d['remote']+_0xd108('0x4b')+_0x4b3dc2['id']+_0xd108('0x21')+_0xcdb26d[_0xd108('0x22')]};var _0x4f868e=util[_0xd108('0x3f')](_0xd108('0x40'),_0xcdb26d[_0xd108('0x4a')],_0xcdb26d[_0xd108('0x1d')]);var _0x23299e={'method':_0xd108('0x32'),'uri':util[_0xd108('0x3f')](_0xd108('0x4c'),_0xcdb26d['authId']),'body':_0x315382,'headers':{'Authorization':util[_0xd108('0x3f')](_0xd108('0x41'),new Buffer(_0x4f868e)[_0xd108('0x42')](_0xd108('0x43')))},'json':!![]};rp(_0x23299e)[_0xd108('0x15')](function(_0x3dcd72){var _0x1b5a30={'messageId':_0x3dcd72[_0xd108('0x4d')][0x0]};return _0x28a12d['update'](_0x1b5a30);})[_0xd108('0x24')](function(_0x4bc4c6){logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x49'),util[_0xd108('0x26')](_0x4bc4c6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x49'),_0xd108('0x4e'));}break;case'infobip':if(_0xcdb26d[_0xd108('0x2a')]&&_0xcdb26d['password']){if(_0xcdb26d['baseUrl']){var _0x2bdca8={'method':_0xd108('0x32'),'uri':_0xcdb26d[_0xd108('0x4f')]+_0xd108('0x50'),'body':{'username':_0xcdb26d[_0xd108('0x2a')],'password':_0xcdb26d[_0xd108('0x2b')]},'json':!![]};return rp(_0x2bdca8)[_0xd108('0x15')](function(_0x355363){var _0x394f13={'method':_0xd108('0x32'),'uri':_0xcdb26d[_0xd108('0x4f')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0xcdb26d[_0xd108('0x1e')],'destinations':[{'to':_0x4b3dc2[_0xd108('0x1e')]}],'text':_0x4b3dc2[_0xd108('0xb')],'notifyUrl':_0xcdb26d[_0xd108('0x20')]+_0xd108('0x4b')+_0x4b3dc2['id']+_0xd108('0x21')+_0xcdb26d[_0xd108('0x22')],'notifyContentType':'application/json','callbackData':_0xcdb26d[_0xd108('0x1e')]+';'+_0x4b3dc2[_0xd108('0xb')]}]},'headers':{'Authorization':_0xd108('0x51')+_0x355363[_0xd108('0x22')]},'json':!![]};return rp(_0x394f13)[_0xd108('0x15')](function(_0x565133){if(_0x565133[_0xd108('0x1f')]){var _0x241231={'messageId':_0x565133[_0xd108('0x1f')][0x0][_0xd108('0xa')]};if(!_0xcdb26d[_0xd108('0x3c')]){_0x241231[_0xd108('0x36')]=!![];}return _0x28a12d['update'](_0x241231);}else{return logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x52'),util[_0xd108('0x26')](_0x565133,{'showHidden':![],'depth':null}));}});})[_0xd108('0x24')](function(_0x43588d){return logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x52'),util[_0xd108('0x26')](_0x43588d,{'showHidden':![],'depth':null}));});}else{logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),'infobip',_0xd108('0x53'));}}else{logger['error'](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x52'),_0xd108('0x54'));}break;case _0xd108('0x55'):var _0x38b23d=require(_0xd108('0x56'));if(_0xcdb26d['apiKey']){var _0x10f37c={};_0x10f37c[_0xd108('0x57')]=_0xcdb26d[_0xd108('0x2a')];_0x10f37c[_0xd108('0x1e')]=_0x4b3dc2[_0xd108('0x1e')];_0x10f37c[_0xd108('0x2d')]=_0xcdb26d[_0xd108('0x1e')];_0x10f37c[_0xd108('0x58')]=_0x4b3dc2[_0xd108('0xb')];_0x10f37c[_0xd108('0x59')]=+new Date();var _0x599b77='';var _0x5b8024='';var _0x599b41=Object[_0xd108('0x5a')](_0x10f37c);_0x599b41['sort']();for(var _0x1145f0=0x0;_0x1145f0<_0x599b41['length'];_0x1145f0++){if(_0x599b77!=''){_0x599b77+='&';}_0x599b77+=_0x599b41[_0x1145f0]+'='+encodeURIComponent(_0x10f37c[_0x599b41[_0x1145f0]]);_0x5b8024+=_0x10f37c[_0x599b41[_0x1145f0]];}_0x5b8024+=_0xcdb26d['apiKey'];_0x5b8024=_0x38b23d[_0xd108('0x5b')](_0xd108('0x5c'))[_0xd108('0x16')](_0x5b8024)[_0xd108('0x5d')]('hex');if(_0x599b77!==''){_0x599b77+='&';}_0x599b77+=_0xd108('0x5e')+_0x5b8024;var _0x522ac1={'method':_0xd108('0x2f'),'uri':_0xcdb26d['baseUrl']+'/external/get/send.php?'+_0x599b77,'json':!![]};return rp(_0x522ac1)['then'](function(_0x121fc7){var _0x5dcc21=Object[_0xd108('0x5a')](_0x121fc7);if(_0x121fc7[_0x5dcc21[0x0]][_0xd108('0x18')]&&parseInt(_0x121fc7[_0x5dcc21[0x0]][_0xd108('0x18')])===0x0){var _0xb8bce9={'messageId':_0x121fc7[_0x5dcc21[0x0]][_0xd108('0x5f')]};if(!_0xcdb26d[_0xd108('0x3c')]){_0xb8bce9[_0xd108('0x36')]=!![];}return _0x28a12d[_0xd108('0x16')](_0xb8bce9);}else{return logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),'csc',util['inspect'](_0x121fc7[_0xd108('0x18')],{'showHidden':![],'depth':null}));}})[_0xd108('0x24')](function(_0x54117d){return logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x55'),util[_0xd108('0x26')](_0x54117d,{'showHidden':![],'depth':null}));});}else{logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x55'),_0xd108('0x60'));}break;case _0xd108('0x61'):if(_0xcdb26d[_0xd108('0x62')]){var _0x203399={'method':_0xd108('0x32'),'uri':_0xd108('0x63'),'headers':{'Authorization':_0xcdb26d[_0xd108('0x62')]},'body':{'content':_0x4b3dc2[_0xd108('0xb')],'to':[_0x4b3dc2[_0xd108('0x1e')]],'from':_0xcdb26d[_0xd108('0x1e')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x203399)[_0xd108('0x15')](function(_0x3f02a8){if(!_0x3f02a8[_0xd108('0x18')]){var _0x3a3e23={'messageId':_0x3f02a8['messages'][0x0][_0xd108('0x64')]};if(!_0xcdb26d[_0xd108('0x3c')]){_0x3a3e23[_0xd108('0x36')]=!![];}return _0x28a12d['update'](_0x3a3e23);}else{return logger['error'](_0xd108('0x27'),'afterCreate',_0xd108('0x61'),util['inspect'](_0x3f02a8[_0xd108('0x18')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2d65cd){return logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),'clickatell',util[_0xd108('0x26')](_0x2d65cd,{'showHidden':![],'depth':null}));});}else{logger[_0xd108('0x18')](_0xd108('0x27'),'afterCreate',_0xd108('0x61'),_0xd108('0x60'));}break;case _0xd108('0x65'):if(_0xcdb26d[_0xd108('0x2a')]&&_0xcdb26d['password']){var _0x4f868e=util[_0xd108('0x3f')](_0xd108('0x40'),_0xcdb26d['username'],_0xcdb26d[_0xd108('0x2b')]);var _0x23299e={'method':_0xd108('0x32'),'uri':_0xd108('0x66')+_0xcdb26d[_0xd108('0x67')]+'/messages','body':{'to':[_0x4b3dc2[_0xd108('0x1e')]],'text':_0x4b3dc2[_0xd108('0xb')],'from':_0xcdb26d[_0xd108('0x1e')],'applicationId':_0xcdb26d[_0xd108('0x68')]},'headers':{'Authorization':util[_0xd108('0x3f')]('Basic\x20%s',new Buffer(_0x4f868e)[_0xd108('0x42')](_0xd108('0x43')))},'json':!![]};rp(_0x23299e)[_0xd108('0x15')](function(_0x1eeeb0){if(_0x1eeeb0['id']){var _0x7fdc73={'messageId':_0x1eeeb0['id']};return _0x28a12d[_0xd108('0x16')](_0x7fdc73);}else{logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x65'),util[_0xd108('0x26')](_0x1eeeb0,{'showHidden':![],'depth':null}));}})[_0xd108('0x24')](function(_0x4b35ef){logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x65'),util[_0xd108('0x26')](_0x4b35ef,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x65'),_0xd108('0x54'));}break;case _0xd108('0x69'):if(_0xcdb26d[_0xd108('0x62')]){var _0x15861d={};var _0x522ac1={'method':_0xd108('0x32'),'uri':_0xd108('0x6a'),'headers':{'Authorization':_0xd108('0x6b')+_0xcdb26d[_0xd108('0x62')],'Content-Type':_0xd108('0x6c')},'body':{'from':_0xcdb26d[_0xd108('0x1e')],'to':_0x4b3dc2[_0xd108('0x1e')],'text':_0x4b3dc2['body']},'json':!![]};return rp(_0x522ac1)[_0xd108('0x15')](function(_0x2f8619){if(_0x2f8619[_0xd108('0x6d')]==0xca){_0x15861d['message']=_0x2f8619;var _0x51fc88={'method':_0xd108('0x32'),'uri':_0xd108('0x6e'),'headers':{'Authorization':_0xd108('0x6b')+_0xcdb26d[_0xd108('0x62')],'Content-Type':_0xd108('0x6c')},'body':{'refid':_0x15861d[_0xd108('0x6f')]['refid']},'json':!![]};return rp(_0x51fc88)[_0xd108('0x15')](function(_0x135600){_0x15861d[_0xd108('0x70')]=_0x135600;var _0x472bc9={'messageId':_0x15861d[_0xd108('0x6f')]['refid'],'read':!![]};return _0x28a12d[_0xd108('0x16')](_0x472bc9);});}else{return logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x69'),util[_0xd108('0x26')](_0x2f8619,{'showHidden':![],'depth':null}));}})[_0xd108('0x24')](function(_0x5f001e){return logger[_0xd108('0x18')](_0xd108('0x27'),_0xd108('0x25'),_0xd108('0x69'),util['inspect'](_0x5f001e,{'showHidden':![],'depth':null}));});}else{return logger[_0xd108('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd108('0x25'),_0xd108('0x69'),_0xd108('0x71'));}break;}}})[_0xd108('0x72')](function(){_0x17ff51();});}else{_0x17ff51();}}},'charset':_0xd108('0x73'),'collate':_0xd108('0x74')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index cc4ae2d..7de6459 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 _0x8726=['CreateSmsMessage','SmsMessage','body','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8726,0x70));var _0x6872=function(_0x1f89c4,_0xc23f76){_0x1f89c4=_0x1f89c4-0x0;var _0x57cbc8=_0x8726[_0x1f89c4];return _0x57cbc8;};'use strict';var _=require(_0x6872('0x0'));var util=require(_0x6872('0x1'));var moment=require(_0x6872('0x2'));var BPromise=require(_0x6872('0x3'));var rs=require(_0x6872('0x4'));var fs=require('fs');var Redis=require(_0x6872('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6872('0x6'));var logger=require(_0x6872('0x7'))(_0x6872('0x8'));var config=require(_0x6872('0x9'));var jayson=require(_0x6872('0xa'));var client=jayson[_0x6872('0xb')][_0x6872('0xc')]({'port':0x232a});config[_0x6872('0xd')]=_[_0x6872('0xe')](config[_0x6872('0xd')],{'host':_0x6872('0xf'),'port':0x18eb});var socket=require(_0x6872('0x10'))(new Redis(config['redis']));require(_0x6872('0x11'))['register'](socket);function respondWithRpcPromise(_0xdc9d79,_0x270280,_0x473803){return new BPromise(function(_0x116b8e,_0x6882d9){return client['request'](_0xdc9d79,_0x473803)[_0x6872('0x12')](function(_0x589166){logger[_0x6872('0x13')](_0x6872('0x14'),_0x270280,_0x6872('0x15'));logger['debug'](_0x6872('0x16'),_0x270280,'request\x20sent',JSON[_0x6872('0x17')](_0x589166));if(_0x589166[_0x6872('0x18')]){if(_0x589166['error'][_0x6872('0x19')]===0x1f4){logger[_0x6872('0x18')](_0x6872('0x14'),_0x270280,_0x589166[_0x6872('0x18')][_0x6872('0x1a')]);return _0x6882d9(_0x589166[_0x6872('0x18')][_0x6872('0x1a')]);}logger[_0x6872('0x18')](_0x6872('0x14'),_0x270280,_0x589166[_0x6872('0x18')][_0x6872('0x1a')]);return _0x116b8e(_0x589166[_0x6872('0x18')][_0x6872('0x1a')]);}else{logger[_0x6872('0x13')](_0x6872('0x14'),_0x270280,_0x6872('0x15'));_0x116b8e(_0x589166[_0x6872('0x1b')][_0x6872('0x1a')]);}})['catch'](function(_0x1b33b6){logger[_0x6872('0x18')]('SmsMessage,\x20%s,\x20%s',_0x270280,_0x1b33b6);_0x6882d9(_0x1b33b6);});});}exports[_0x6872('0x1c')]=function(_0x55aab5){var _0x37d65b=this;return new Promise(function(_0x3cad4e,_0x8d0d8b){return db[_0x6872('0x1d')]['create'](_0x55aab5[_0x6872('0x1e')],{'raw':_0x55aab5[_0x6872('0x1f')]?_0x55aab5[_0x6872('0x1f')][_0x6872('0x20')]===undefined?!![]:![]:!![]})[_0x6872('0x12')](function(_0x4d6ac0){logger[_0x6872('0x13')]('CreateSmsMessage',_0x55aab5);logger[_0x6872('0x21')](_0x6872('0x1c'),_0x55aab5,JSON[_0x6872('0x17')](_0x4d6ac0));_0x3cad4e(_0x4d6ac0);})[_0x6872('0x22')](function(_0x2354a9){logger[_0x6872('0x18')](_0x6872('0x1c'),_0x2354a9[_0x6872('0x1a')],_0x55aab5);_0x8d0d8b(_0x37d65b[_0x6872('0x18')](0x1f4,_0x2354a9['message']));});});}; \ No newline at end of file +var _0x1096=['error','code','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x11db94,_0x3c15d6){var _0x34a03e=function(_0x1c16d8){while(--_0x1c16d8){_0x11db94['push'](_0x11db94['shift']());}};_0x34a03e(++_0x3c15d6);}(_0x1096,0x1ab));var _0x6109=function(_0x28a59c,_0x37bd9f){_0x28a59c=_0x28a59c-0x0;var _0x14cbba=_0x1096[_0x28a59c];return _0x14cbba;};'use strict';var _=require('lodash');var util=require(_0x6109('0x0'));var moment=require(_0x6109('0x1'));var BPromise=require(_0x6109('0x2'));var rs=require(_0x6109('0x3'));var fs=require('fs');var Redis=require(_0x6109('0x4'));var db=require(_0x6109('0x5'))['db'];var utils=require(_0x6109('0x6'));var logger=require(_0x6109('0x7'))(_0x6109('0x8'));var config=require(_0x6109('0x9'));var jayson=require(_0x6109('0xa'));var client=jayson[_0x6109('0xb')]['http']({'port':0x232a});config[_0x6109('0xc')]=_['defaults'](config['redis'],{'host':_0x6109('0xd'),'port':0x18eb});var socket=require(_0x6109('0xe'))(new Redis(config['redis']));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3366ed,_0xbd81fc,_0x14a92b){return new BPromise(function(_0x5cd438,_0x5c4969){return client['request'](_0x3366ed,_0x14a92b)[_0x6109('0xf')](function(_0x326078){logger[_0x6109('0x10')](_0x6109('0x11'),_0xbd81fc,_0x6109('0x12'));logger[_0x6109('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbd81fc,_0x6109('0x12'),JSON[_0x6109('0x14')](_0x326078));if(_0x326078[_0x6109('0x15')]){if(_0x326078[_0x6109('0x15')][_0x6109('0x16')]===0x1f4){logger[_0x6109('0x15')](_0x6109('0x11'),_0xbd81fc,_0x326078['error'][_0x6109('0x17')]);return _0x5c4969(_0x326078[_0x6109('0x15')]['message']);}logger[_0x6109('0x15')](_0x6109('0x11'),_0xbd81fc,_0x326078[_0x6109('0x15')]['message']);return _0x5cd438(_0x326078['error'][_0x6109('0x17')]);}else{logger[_0x6109('0x10')](_0x6109('0x11'),_0xbd81fc,'request\x20sent');_0x5cd438(_0x326078[_0x6109('0x18')][_0x6109('0x17')]);}})[_0x6109('0x19')](function(_0x5072f8){logger['error'](_0x6109('0x11'),_0xbd81fc,_0x5072f8);_0x5c4969(_0x5072f8);});});}exports['CreateSmsMessage']=function(_0x195385){var _0x57fb8b=this;return new Promise(function(_0x3f5eb9,_0x3a9f9c){return db[_0x6109('0x1a')][_0x6109('0x1b')](_0x195385[_0x6109('0x1c')],{'raw':_0x195385[_0x6109('0x1d')]?_0x195385[_0x6109('0x1d')][_0x6109('0x1e')]===undefined?!![]:![]:!![]})[_0x6109('0xf')](function(_0x240b78){logger[_0x6109('0x10')](_0x6109('0x1f'),_0x195385);logger[_0x6109('0x13')](_0x6109('0x1f'),_0x195385,JSON[_0x6109('0x14')](_0x240b78));_0x3f5eb9(_0x240b78);})['catch'](function(_0x1f96b5){logger[_0x6109('0x15')](_0x6109('0x1f'),_0x1f96b5[_0x6109('0x17')],_0x195385);_0x3a9f9c(_0x57fb8b[_0x6109('0x15')](0x1f4,_0x1f96b5['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 64afa30..7299ebe 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 _0xd811=['removeListener','register','smsMessage:','emit'];(function(_0x570116,_0x4896e0){var _0x42c61a=function(_0x18c4fd){while(--_0x18c4fd){_0x570116['push'](_0x570116['shift']());}};_0x42c61a(++_0x4896e0);}(_0xd811,0x1f3));var _0x1d81=function(_0x58fa7f,_0x4ed6e3){_0x58fa7f=_0x58fa7f-0x0;var _0x526007=_0xd811[_0x58fa7f];return _0x526007;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save','remove','update'];function createListener(_0x8ea114,_0x58ae2b){return function(_0x5a8e3e){_0x58ae2b[_0x1d81('0x0')](_0x8ea114,_0x5a8e3e);};}function removeListener(_0x3130d1,_0x1c976d){return function(){SmsMessageEvents[_0x1d81('0x1')](_0x3130d1,_0x1c976d);};}exports[_0x1d81('0x2')]=function(_0x48e99e){for(var _0x50aff1=0x0,_0x185d7a=events['length'];_0x50aff1<_0x185d7a;_0x50aff1++){var _0x823007=events[_0x50aff1];var _0x311967=createListener(_0x1d81('0x3')+_0x823007,_0x48e99e);SmsMessageEvents['on'](_0x823007,_0x311967);}}; \ No newline at end of file +var _0xc7b7=['register','length','smsMessage:','./smsMessage.events','save','remove','emit'];(function(_0x3d8e64,_0x19f06a){var _0x29c501=function(_0x5e7978){while(--_0x5e7978){_0x3d8e64['push'](_0x3d8e64['shift']());}};_0x29c501(++_0x19f06a);}(_0xc7b7,0x1e6));var _0x7c7b=function(_0x1c0c7c,_0x2ede87){_0x1c0c7c=_0x1c0c7c-0x0;var _0x1eeae0=_0xc7b7[_0x1c0c7c];return _0x1eeae0;};'use strict';var SmsMessageEvents=require(_0x7c7b('0x0'));var events=[_0x7c7b('0x1'),_0x7c7b('0x2'),'update'];function createListener(_0xd822e3,_0x52a9e1){return function(_0x22e423){_0x52a9e1[_0x7c7b('0x3')](_0xd822e3,_0x22e423);};}function removeListener(_0x541c01,_0x3e1e35){return function(){SmsMessageEvents['removeListener'](_0x541c01,_0x3e1e35);};}exports[_0x7c7b('0x4')]=function(_0x4578a7){for(var _0x2e6e25=0x0,_0x5a748f=events[_0x7c7b('0x5')];_0x2e6e25<_0x5a748f;_0x2e6e25++){var _0x44a151=events[_0x2e6e25];var _0xc34fa4=createListener(_0x7c7b('0x6')+_0x44a151,_0x4578a7);SmsMessageEvents['on'](_0x44a151,_0xc34fa4);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index da06794..b344851 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 _0x2924=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path'];(function(_0x32c52e,_0x43e804){var _0x2c4f5=function(_0x2169fd){while(--_0x2169fd){_0x32c52e['push'](_0x32c52e['shift']());}};_0x2c4f5(++_0x43e804);}(_0x2924,0x132));var _0x4292=function(_0x307bf6,_0x55bdd5){_0x307bf6=_0x307bf6-0x0;var _0x2878fc=_0x2924[_0x307bf6];return _0x2878fc;};'use strict';var multer=require('multer');var util=require(_0x4292('0x0'));var path=require(_0x4292('0x1'));var timeout=require(_0x4292('0x2'));var express=require('express');var router=express[_0x4292('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4292('0x4'));var interaction=require(_0x4292('0x5'));var config=require('../../config/environment');var controller=require(_0x4292('0x6'));router[_0x4292('0x7')]('/',auth[_0x4292('0x8')](),controller[_0x4292('0x9')]);router[_0x4292('0x7')]('/describe',auth[_0x4292('0x8')](),controller[_0x4292('0xa')]);router[_0x4292('0x7')](_0x4292('0xb'),auth[_0x4292('0x8')](),controller[_0x4292('0xc')]);router['get'](_0x4292('0xd'),auth[_0x4292('0x8')](),controller[_0x4292('0xe')]);router[_0x4292('0x7')]('/:id/teams',auth[_0x4292('0x8')](),controller[_0x4292('0xf')]);router[_0x4292('0x7')](_0x4292('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x4292('0x11')]('/',auth[_0x4292('0x8')](),controller['create']);router['post'](_0x4292('0x12'),auth[_0x4292('0x8')](),controller[_0x4292('0x13')]);router[_0x4292('0x11')](_0x4292('0x10'),auth[_0x4292('0x8')](),controller[_0x4292('0x14')]);router[_0x4292('0x15')](_0x4292('0xb'),auth[_0x4292('0x8')](),controller[_0x4292('0x16')]);router[_0x4292('0x17')](_0x4292('0xb'),auth[_0x4292('0x8')](),controller[_0x4292('0x18')]);router[_0x4292('0x17')]('/:id/teams',auth[_0x4292('0x8')](),controller[_0x4292('0x19')]);router[_0x4292('0x17')]('/:id/users',auth[_0x4292('0x8')](),controller[_0x4292('0x1a')]);module[_0x4292('0x1b')]=router; \ No newline at end of file +var _0xe2f6=['Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0x2e4cbf,_0x8763d3){var _0x52840f=function(_0x31b93f){while(--_0x31b93f){_0x2e4cbf['push'](_0x2e4cbf['shift']());}};_0x52840f(++_0x8763d3);}(_0xe2f6,0x164));var _0x6e2f=function(_0x32fe6b,_0x42b856){_0x32fe6b=_0x32fe6b-0x0;var _0x9f032a=_0xe2f6[_0x32fe6b];return _0x9f032a;};'use strict';var multer=require(_0x6e2f('0x0'));var util=require(_0x6e2f('0x1'));var path=require('path');var timeout=require(_0x6e2f('0x2'));var express=require(_0x6e2f('0x3'));var router=express[_0x6e2f('0x4')]();var fs_extra=require(_0x6e2f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6e2f('0x6'));var config=require(_0x6e2f('0x7'));var controller=require(_0x6e2f('0x8'));router[_0x6e2f('0x9')]('/',auth[_0x6e2f('0xa')](),controller[_0x6e2f('0xb')]);router['get'](_0x6e2f('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6e2f('0x9')](_0x6e2f('0xd'),auth[_0x6e2f('0xa')](),controller[_0x6e2f('0xe')]);router['get'](_0x6e2f('0xf'),auth[_0x6e2f('0xa')](),controller[_0x6e2f('0x10')]);router[_0x6e2f('0x9')](_0x6e2f('0x11'),auth[_0x6e2f('0xa')](),controller[_0x6e2f('0x12')]);router[_0x6e2f('0x9')]('/:id/users',auth[_0x6e2f('0xa')](),controller[_0x6e2f('0x13')]);router['post']('/',auth[_0x6e2f('0xa')](),controller['create']);router[_0x6e2f('0x14')](_0x6e2f('0x11'),auth['isAuthenticated'](),controller[_0x6e2f('0x15')]);router[_0x6e2f('0x14')](_0x6e2f('0x16'),auth[_0x6e2f('0xa')](),controller[_0x6e2f('0x17')]);router['put'](_0x6e2f('0xd'),auth['isAuthenticated'](),controller[_0x6e2f('0x18')]);router[_0x6e2f('0x19')](_0x6e2f('0xd'),auth['isAuthenticated'](),controller[_0x6e2f('0x1a')]);router[_0x6e2f('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6e2f('0x1b')]);router[_0x6e2f('0x19')](_0x6e2f('0x16'),auth['isAuthenticated'](),controller[_0x6e2f('0x1c')]);module[_0x6e2f('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 1a18973..7bf188a 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 _0xb0b1=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x10e65b,_0x51cd12){var _0xef7e32=function(_0x5c37c8){while(--_0x5c37c8){_0x10e65b['push'](_0x10e65b['shift']());}};_0xef7e32(++_0x51cd12);}(_0xb0b1,0x15f));var _0x1b0b=function(_0x59e82e,_0x5aff03){_0x59e82e=_0x59e82e-0x0;var _0x390f3f=_0xb0b1[_0x59e82e];return _0x390f3f;};'use strict';var Sequelize=require(_0x1b0b('0x0'));module[_0x1b0b('0x1')]={'name':{'type':Sequelize[_0x1b0b('0x2')],'unique':_0x1b0b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1b0b('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1b0b('0x4')](_0x1b0b('0x5'),_0x1b0b('0x6'),_0x1b0b('0x7'))}}; \ No newline at end of file +var _0x45e1=['rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM'];(function(_0x541e38,_0x5e5392){var _0x544a34=function(_0x7a9af1){while(--_0x7a9af1){_0x541e38['push'](_0x541e38['shift']());}};_0x544a34(++_0x5e5392);}(_0x45e1,0xe4));var _0x145e=function(_0x430b22,_0x36200b){_0x430b22=_0x430b22-0x0;var _0x50d4e1=_0x45e1[_0x430b22];return _0x50d4e1;};'use strict';var Sequelize=require(_0x145e('0x0'));module[_0x145e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x145e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x145e('0x3')]},'timeout':{'type':Sequelize[_0x145e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x145e('0x5')](_0x145e('0x6'),_0x145e('0x7'),_0x145e('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f4c1812..1031621 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 _0x7ebf=['includes','union','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./smsQueue.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','SmsQueues','UserProfileResource','destroy','name','send','map','SmsQueue','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','show','params','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','describe','findOne','UserSmsQueue','SmsQueueId','findAll','User','UserId','agent','smsPause','createdAt','rows','%s/%s','updatedAt','getTeams','Team','addTeams','Agents','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','select','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId'];(function(_0x469a3c,_0x1b41d2){var _0x4a43cc=function(_0x3e03ec){while(--_0x3e03ec){_0x469a3c['push'](_0x469a3c['shift']());}};_0x4a43cc(++_0x1b41d2);}(_0x7ebf,0x119));var _0xf7eb=function(_0x22a312,_0x5a3e88){_0x22a312=_0x22a312-0x0;var _0x5b6a50=_0x7ebf[_0x22a312];return _0x5b6a50;};'use strict';var emlformat=require(_0xf7eb('0x0'));var rimraf=require(_0xf7eb('0x1'));var zipdir=require(_0xf7eb('0x2'));var jsonpatch=require(_0xf7eb('0x3'));var rp=require(_0xf7eb('0x4'));var moment=require(_0xf7eb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf7eb('0x6'));var util=require(_0xf7eb('0x7'));var path=require('path');var sox=require(_0xf7eb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7eb('0x9'));var _=require(_0xf7eb('0xa'));var squel=require(_0xf7eb('0xb'));var crypto=require(_0xf7eb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf7eb('0xd'));var toCsv=require(_0xf7eb('0xe'));var querystring=require(_0xf7eb('0xf'));var Papa=require(_0xf7eb('0x10'));var Redis=require(_0xf7eb('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7eb('0x12'));var logger=require(_0xf7eb('0x13'))(_0xf7eb('0x14'));var utils=require(_0xf7eb('0x15'));var config=require(_0xf7eb('0x16'));var licenseUtil=require(_0xf7eb('0x17'));var db=require(_0xf7eb('0x18'))['db'];config[_0xf7eb('0x19')]=_['defaults'](config['redis'],{'host':_0xf7eb('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf7eb('0x19')]));require(_0xf7eb('0x1b'))[_0xf7eb('0x1c')](socket);function respondWithStatusCode(_0x42a56e,_0x3bc12b){_0x3bc12b=_0x3bc12b||0xcc;return function(_0x225172){if(_0x225172){return _0x42a56e[_0xf7eb('0x1d')](_0x3bc12b);}return _0x42a56e[_0xf7eb('0x1e')](_0x3bc12b)[_0xf7eb('0x1f')]();};}function respondWithResult(_0x39d8c3,_0x166b9a){_0x166b9a=_0x166b9a||0xc8;return function(_0x47f29f){if(_0x47f29f){return _0x39d8c3['status'](_0x166b9a)['json'](_0x47f29f);}};}function respondWithFilteredResult(_0x3eea5e,_0x2e6585){return function(_0xe44067){if(_0xe44067){var _0x31af7f=typeof _0x2e6585[_0xf7eb('0x20')]===_0xf7eb('0x21')&&typeof _0x2e6585['limit']===_0xf7eb('0x21');var _0x3856a3=_0xe44067[_0xf7eb('0x22')];var _0x2ff551=_0x31af7f?0x0:_0x2e6585[_0xf7eb('0x20')];var _0x1f3c0f=_0x31af7f?_0xe44067[_0xf7eb('0x22')]:_0x2e6585[_0xf7eb('0x20')]+_0x2e6585[_0xf7eb('0x23')];var _0x222487;if(_0x1f3c0f>=_0x3856a3){_0x1f3c0f=_0x3856a3;_0x222487=0xc8;}else{_0x222487=0xce;}_0x3eea5e['status'](_0x222487);return _0x3eea5e[_0xf7eb('0x24')](_0xf7eb('0x25'),_0x2ff551+'-'+_0x1f3c0f+'/'+_0x3856a3)['json'](_0xe44067);}return null;};}function patchUpdates(_0x4817d5){return function(_0x17828f){try{jsonpatch[_0xf7eb('0x26')](_0x17828f,_0x4817d5,!![]);}catch(_0x11f40b){return BPromise[_0xf7eb('0x27')](_0x11f40b);}return _0x17828f[_0xf7eb('0x28')]();};}function saveUpdates(_0x21edc6,_0x482d0f){return function(_0x511c47){if(_0x511c47){return _0x511c47[_0xf7eb('0x29')](_0x21edc6)[_0xf7eb('0x2a')](function(_0x3130b5){return _0x3130b5;});}return null;};}function removeEntity(_0x1f43aa,_0x14a643){return function(_0x251e37){if(_0x251e37){return _0x251e37['destroy']()[_0xf7eb('0x2a')](function(){var _0x1f5918=_0x251e37[_0xf7eb('0x2b')]({'plain':!![]});var _0x45db04=_0xf7eb('0x2c');return db[_0xf7eb('0x2d')][_0xf7eb('0x2e')]({'where':{'type':_0x45db04,'resourceId':_0x1f5918['id']}})[_0xf7eb('0x2a')](function(){return _0x251e37;});})['then'](function(){_0x1f43aa[_0xf7eb('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d8614,_0x29fdce){return function(_0x5c5891){if(!_0x5c5891){_0x5d8614[_0xf7eb('0x1d')](0x194);}return _0x5c5891;};}function handleError(_0x9b430b,_0x5d1329){_0x5d1329=_0x5d1329||0x1f4;return function(_0x5a0c44){logger['error'](_0x5a0c44['stack']);if(_0x5a0c44[_0xf7eb('0x2f')]){delete _0x5a0c44['name'];}_0x9b430b[_0xf7eb('0x1e')](_0x5d1329)[_0xf7eb('0x30')](_0x5a0c44);};}exports['index']=function(_0x59486b,_0x4336fb){var _0x581ae7={},_0x389c6e={},_0x196590={'count':0x0,'rows':[]};var _0x40d921=_[_0xf7eb('0x31')](db[_0xf7eb('0x32')][_0xf7eb('0x33')],function(_0x1a77a0){return{'name':_0x1a77a0[_0xf7eb('0x34')],'type':_0x1a77a0[_0xf7eb('0x35')][_0xf7eb('0x36')]};});_0x389c6e['model']=_['map'](_0x40d921,_0xf7eb('0x2f'));_0x389c6e[_0xf7eb('0x37')]=_['keys'](_0x59486b['query']);_0x389c6e['filters']=_[_0xf7eb('0x38')](_0x389c6e[_0xf7eb('0x39')],_0x389c6e[_0xf7eb('0x37')]);_0x581ae7[_0xf7eb('0x3a')]=_['intersection'](_0x389c6e[_0xf7eb('0x39')],qs[_0xf7eb('0x3b')](_0x59486b[_0xf7eb('0x37')][_0xf7eb('0x3b')]));_0x581ae7[_0xf7eb('0x3a')]=_0x581ae7[_0xf7eb('0x3a')][_0xf7eb('0x3c')]?_0x581ae7['attributes']:_0x389c6e[_0xf7eb('0x39')];if(!_0x59486b['query'][_0xf7eb('0x3d')](_0xf7eb('0x3e'))){_0x581ae7[_0xf7eb('0x23')]=qs[_0xf7eb('0x23')](_0x59486b['query'][_0xf7eb('0x23')]);_0x581ae7[_0xf7eb('0x20')]=qs[_0xf7eb('0x20')](_0x59486b[_0xf7eb('0x37')][_0xf7eb('0x20')]);}_0x581ae7[_0xf7eb('0x3f')]=qs[_0xf7eb('0x40')](_0x59486b['query'][_0xf7eb('0x40')]);_0x581ae7[_0xf7eb('0x41')]=qs[_0xf7eb('0x42')](_[_0xf7eb('0x43')](_0x59486b[_0xf7eb('0x37')],_0x389c6e[_0xf7eb('0x42')]),_0x40d921);if(_0x59486b[_0xf7eb('0x37')][_0xf7eb('0x44')]){_0x581ae7[_0xf7eb('0x41')]=_[_0xf7eb('0x45')](_0x581ae7[_0xf7eb('0x41')],{'$or':_[_0xf7eb('0x31')](_0x40d921,function(_0xac09dd){if(_0xac09dd['type']!==_0xf7eb('0x46')){var _0x4301f5={};_0x4301f5[_0xac09dd[_0xf7eb('0x2f')]]={'$like':'%'+_0x59486b[_0xf7eb('0x37')][_0xf7eb('0x44')]+'%'};return _0x4301f5;}})});}_0x581ae7=_[_0xf7eb('0x45')]({},_0x581ae7,_0x59486b[_0xf7eb('0x47')]);var _0x58481e={'where':_0x581ae7[_0xf7eb('0x41')]};return db['SmsQueue'][_0xf7eb('0x22')](_0x58481e)[_0xf7eb('0x2a')](function(_0xfc1b5e){_0x196590[_0xf7eb('0x22')]=_0xfc1b5e;if(_0x59486b[_0xf7eb('0x37')]['includeAll']){_0x581ae7[_0xf7eb('0x48')]=[{'all':!![]}];}return db[_0xf7eb('0x32')]['findAll'](_0x581ae7);})[_0xf7eb('0x2a')](function(_0x175ac4){_0x196590['rows']=_0x175ac4;return _0x196590;})[_0xf7eb('0x2a')](respondWithFilteredResult(_0x4336fb,_0x581ae7))['catch'](handleError(_0x4336fb,null));};exports[_0xf7eb('0x49')]=function(_0x520138,_0x4a3448){var _0x1e1048={'raw':!![],'where':{'id':_0x520138[_0xf7eb('0x4a')]['id']}},_0x48884a={};_0x48884a[_0xf7eb('0x39')]=_['keys'](db['SmsQueue'][_0xf7eb('0x33')]);_0x48884a[_0xf7eb('0x37')]=_[_0xf7eb('0x4b')](_0x520138['query']);_0x48884a[_0xf7eb('0x42')]=_[_0xf7eb('0x38')](_0x48884a[_0xf7eb('0x39')],_0x48884a[_0xf7eb('0x37')]);_0x1e1048['attributes']=_[_0xf7eb('0x38')](_0x48884a[_0xf7eb('0x39')],qs[_0xf7eb('0x3b')](_0x520138['query'][_0xf7eb('0x3b')]));_0x1e1048[_0xf7eb('0x3a')]=_0x1e1048[_0xf7eb('0x3a')]['length']?_0x1e1048[_0xf7eb('0x3a')]:_0x48884a[_0xf7eb('0x39')];if(_0x520138[_0xf7eb('0x37')][_0xf7eb('0x4c')]){_0x1e1048[_0xf7eb('0x48')]=[{'all':!![]}];}_0x1e1048=_['merge']({},_0x1e1048,_0x520138[_0xf7eb('0x47')]);return db[_0xf7eb('0x32')][_0xf7eb('0x4d')](_0x1e1048)[_0xf7eb('0x2a')](handleEntityNotFound(_0x4a3448,null))[_0xf7eb('0x2a')](respondWithResult(_0x4a3448,null))[_0xf7eb('0x4e')](handleError(_0x4a3448,null));};exports[_0xf7eb('0x4f')]=function(_0x40f31c,_0xc20ae3){return db[_0xf7eb('0x32')]['create'](_0x40f31c[_0xf7eb('0x50')],{})[_0xf7eb('0x2a')](function(_0x32156d){var _0x37016b=_0x40f31c[_0xf7eb('0x51')][_0xf7eb('0x2b')]({'plain':!![]});if(!_0x37016b)throw new Error(_0xf7eb('0x52'));if(_0x37016b[_0xf7eb('0x53')]===_0xf7eb('0x51')){var _0x247643=_0x32156d[_0xf7eb('0x2b')]({'plain':!![]});var _0x7ffc7d='SmsQueues';return db['UserProfileSection'][_0xf7eb('0x4d')]({'where':{'name':_0x7ffc7d,'userProfileId':_0x37016b[_0xf7eb('0x54')]},'raw':!![]})[_0xf7eb('0x2a')](function(_0x2770dc){if(_0x2770dc&&_0x2770dc[_0xf7eb('0x55')]===0x0){return db[_0xf7eb('0x2d')][_0xf7eb('0x4f')]({'name':_0x247643[_0xf7eb('0x2f')],'resourceId':_0x247643['id'],'type':_0x2770dc['name'],'sectionId':_0x2770dc['id']},{})[_0xf7eb('0x2a')](function(){return _0x32156d;});}else{return _0x32156d;}})[_0xf7eb('0x4e')](function(_0x4a24d1){logger[_0xf7eb('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a24d1);throw _0x4a24d1;});}return _0x32156d;})[_0xf7eb('0x2a')](respondWithResult(_0xc20ae3,0xc9))['catch'](handleError(_0xc20ae3,null));};exports['update']=function(_0x36bdef,_0xe2912f){if(_0x36bdef[_0xf7eb('0x50')]['id']){delete _0x36bdef[_0xf7eb('0x50')]['id'];}return db['SmsQueue'][_0xf7eb('0x4d')]({'where':{'id':_0x36bdef[_0xf7eb('0x4a')]['id']}})['then'](handleEntityNotFound(_0xe2912f,null))[_0xf7eb('0x2a')](saveUpdates(_0x36bdef[_0xf7eb('0x50')],null))[_0xf7eb('0x2a')](respondWithResult(_0xe2912f,null))[_0xf7eb('0x4e')](handleError(_0xe2912f,null));};exports[_0xf7eb('0x2e')]=function(_0x11d8dc,_0x5463d6){return db[_0xf7eb('0x32')][_0xf7eb('0x4d')]({'where':{'id':_0x11d8dc[_0xf7eb('0x4a')]['id']}})[_0xf7eb('0x2a')](handleEntityNotFound(_0x5463d6,null))[_0xf7eb('0x2a')](removeEntity(_0x5463d6,null))[_0xf7eb('0x4e')](handleError(_0x5463d6,null));};exports[_0xf7eb('0x57')]=function(_0x3ddfc3,_0x89fbae){return db[_0xf7eb('0x32')][_0xf7eb('0x57')]()[_0xf7eb('0x2a')](respondWithResult(_0x89fbae,null))[_0xf7eb('0x4e')](handleError(_0x89fbae,null));};exports['getMembers']=function(_0x145e83,_0x3dc68a,_0x445406){var _0x3ffa1f={'raw':!![],'where':{}},_0x146cae={},_0x56c7bf;return db[_0xf7eb('0x32')][_0xf7eb('0x58')]({'where':{'id':_0x145e83[_0xf7eb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3dc68a,null))[_0xf7eb('0x2a')](function(_0x21c6d0){if(_0x21c6d0){_0x56c7bf=_0x21c6d0[_0xf7eb('0x2b')]({'plain':!![]});_0x146cae['model']=_['keys'](db[_0xf7eb('0x59')]['rawAttributes']);_0x146cae['query']=_[_0xf7eb('0x4b')](_0x145e83[_0xf7eb('0x37')]);_0x146cae[_0xf7eb('0x42')]=_[_0xf7eb('0x38')](_0x146cae[_0xf7eb('0x39')],_0x146cae['query']);_0x3ffa1f[_0xf7eb('0x3a')]=_[_0xf7eb('0x38')](_0x146cae[_0xf7eb('0x39')],qs[_0xf7eb('0x3b')](_0x145e83['query']['fields']));_0x3ffa1f[_0xf7eb('0x3a')]=_0x3ffa1f[_0xf7eb('0x3a')][_0xf7eb('0x3c')]?_0x3ffa1f['attributes']:_0x146cae[_0xf7eb('0x39')];if(!_0x145e83[_0xf7eb('0x37')][_0xf7eb('0x3d')](_0xf7eb('0x3e'))){_0x3ffa1f['limit']=qs[_0xf7eb('0x23')](_0x145e83[_0xf7eb('0x37')][_0xf7eb('0x23')]);_0x3ffa1f[_0xf7eb('0x20')]=qs[_0xf7eb('0x20')](_0x145e83['query'][_0xf7eb('0x20')]);}_0x3ffa1f[_0xf7eb('0x3f')]=qs[_0xf7eb('0x40')](_0x145e83['query'][_0xf7eb('0x40')]);_0x3ffa1f[_0xf7eb('0x41')]=qs['filters'](_[_0xf7eb('0x43')](_0x145e83[_0xf7eb('0x37')],_0x146cae[_0xf7eb('0x42')]));_0x3ffa1f[_0xf7eb('0x41')][_0xf7eb('0x5a')]=_0x21c6d0['id'];if(_0x145e83[_0xf7eb('0x37')][_0xf7eb('0x44')]){_0x3ffa1f[_0xf7eb('0x41')]=_[_0xf7eb('0x45')](_0x3ffa1f[_0xf7eb('0x41')],{'$or':_[_0xf7eb('0x31')](_0x3ffa1f['attributes'],function(_0x130231){var _0x53a014={};_0x53a014[_0x130231]={'$like':'%'+_0x145e83[_0xf7eb('0x37')][_0xf7eb('0x44')]+'%'};return _0x53a014;})});}_0x3ffa1f=_[_0xf7eb('0x45')]({},_0x3ffa1f,_0x145e83['options']);return db[_0xf7eb('0x59')][_0xf7eb('0x5b')](_0x3ffa1f);}})[_0xf7eb('0x2a')](function(_0x154ba3){if(_0x154ba3){return db[_0xf7eb('0x5c')]['findAndCountAll']({'where':{'id':_[_0xf7eb('0x31')](_0x154ba3,_0xf7eb('0x5d')),'role':_0xf7eb('0x5e')},'attributes':['id','name',_0xf7eb('0x5f'),'updatedAt',_0xf7eb('0x60')]});}})[_0xf7eb('0x2a')](function(_0x584f11){if(_0x584f11){return{'count':_0x584f11[_0xf7eb('0x22')],'rows':_[_0xf7eb('0x31')](_0x584f11[_0xf7eb('0x61')],function(_0x374d70){return{'membername':_0x374d70['name'],'UserId':_0x374d70['id'],'queue_name':_0x56c7bf[_0xf7eb('0x2f')],'SmsQueueId':_0x56c7bf['id'],'interface':util['format'](_0xf7eb('0x62'),'SIP',_0x374d70[_0xf7eb('0x2f')]),'penalty':0x0,'paused':_0x374d70['smsPause'],'createdAt':_0x374d70[_0xf7eb('0x60')],'updatedAt':_0x374d70[_0xf7eb('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf7eb('0x2a')](respondWithFilteredResult(_0x3dc68a,_0x3ffa1f))[_0xf7eb('0x4e')](handleError(_0x3dc68a,null));};exports[_0xf7eb('0x64')]=function(_0x3693a7,_0x24b5a5,_0x1507a9){var _0x5251f3={};var _0x5c5800={};var _0x3bee05;var _0x4c41db;return db['SmsQueue']['findOne']({'where':{'id':_0x3693a7[_0xf7eb('0x4a')]['id']}})[_0xf7eb('0x2a')](handleEntityNotFound(_0x24b5a5,null))['then'](function(_0x8f7948){if(_0x8f7948){_0x3bee05=_0x8f7948;_0x5c5800[_0xf7eb('0x39')]=_[_0xf7eb('0x4b')](db[_0xf7eb('0x65')]['rawAttributes']);_0x5c5800[_0xf7eb('0x37')]=_[_0xf7eb('0x4b')](_0x3693a7[_0xf7eb('0x37')]);_0x5c5800[_0xf7eb('0x42')]=_[_0xf7eb('0x38')](_0x5c5800[_0xf7eb('0x39')],_0x5c5800[_0xf7eb('0x37')]);_0x5251f3[_0xf7eb('0x3a')]=_[_0xf7eb('0x38')](_0x5c5800[_0xf7eb('0x39')],qs['fields'](_0x3693a7[_0xf7eb('0x37')][_0xf7eb('0x3b')]));_0x5251f3[_0xf7eb('0x3a')]=_0x5251f3[_0xf7eb('0x3a')]['length']?_0x5251f3[_0xf7eb('0x3a')]:_0x5c5800[_0xf7eb('0x39')];_0x5251f3['order']=qs[_0xf7eb('0x40')](_0x3693a7[_0xf7eb('0x37')]['sort']);_0x5251f3[_0xf7eb('0x41')]=qs['filters'](_[_0xf7eb('0x43')](_0x3693a7[_0xf7eb('0x37')],_0x5c5800[_0xf7eb('0x42')]));if(_0x3693a7[_0xf7eb('0x37')][_0xf7eb('0x44')]){_0x5251f3['where']=_['merge'](_0x5251f3[_0xf7eb('0x41')],{'$or':_[_0xf7eb('0x31')](_0x5251f3[_0xf7eb('0x3a')],function(_0x2d5de6){var _0x15532b={};_0x15532b[_0x2d5de6]={'$like':'%'+_0x3693a7[_0xf7eb('0x37')][_0xf7eb('0x44')]+'%'};return _0x15532b;})});}_0x5251f3=_[_0xf7eb('0x45')]({},_0x5251f3,_0x3693a7[_0xf7eb('0x47')]);return _0x3bee05['getTeams'](_0x5251f3);}})[_0xf7eb('0x2a')](function(_0x3703c5){if(_0x3703c5){_0x4c41db=_0x3703c5[_0xf7eb('0x3c')];if(!_0x3693a7[_0xf7eb('0x37')][_0xf7eb('0x3d')]('nolimit')){_0x5251f3[_0xf7eb('0x23')]=qs['limit'](_0x3693a7[_0xf7eb('0x37')][_0xf7eb('0x23')]);_0x5251f3['offset']=qs[_0xf7eb('0x20')](_0x3693a7['query'][_0xf7eb('0x20')]);}return _0x3bee05[_0xf7eb('0x64')](_0x5251f3);}})[_0xf7eb('0x2a')](function(_0x88b8e8){if(_0x88b8e8){return _0x88b8e8?{'count':_0x4c41db,'rows':_0x88b8e8}:null;}})['then'](respondWithResult(_0x24b5a5,null))['catch'](handleError(_0x24b5a5,null));};exports[_0xf7eb('0x66')]=function(_0x5515b1,_0x223181,_0x45aca7){var _0x5ec337=_0x5515b1['body']['ids'];return db['Team'][_0xf7eb('0x5b')]({'where':{'id':_0x5ec337},'attributes':['id'],'include':[{'model':db[_0xf7eb('0x5c')],'as':_0xf7eb('0x67'),'attributes':['id',_0xf7eb('0x2f'),'online','voicePause','interface'],'raw':!![]}]})[_0xf7eb('0x2a')](function(_0x14c21f){if(_0x14c21f){var _0x40c4ac=_[_0xf7eb('0x68')](_0x14c21f,function(_0x47942b){var _0x1e8ef0=_0x47942b['get']({'plain':!![]});return _0x1e8ef0[_0xf7eb('0x67')];});return db[_0xf7eb('0x32')]['find']({'where':{'id':_0x5515b1[_0xf7eb('0x4a')]['id']}})[_0xf7eb('0x2a')](function(_0x5acbc7){return db[_0xf7eb('0x69')][_0xf7eb('0x6a')](function(_0x1b346b){return _0x5acbc7[_0xf7eb('0x66')](_0x5ec337,{'transaction':_0x1b346b})[_0xf7eb('0x2a')](function(){return BPromise['each'](_0x40c4ac,function(_0x3bf328){return db[_0xf7eb('0x59')][_0xf7eb('0x6b')]({'where':{'UserId':_0x3bf328['id'],'SmsQueueId':_0x5515b1['params']['id']},'transaction':_0x1b346b});});})[_0xf7eb('0x2a')](function(){_0x40c4ac[_0xf7eb('0x6c')](function(_0x3507dd){socket[_0xf7eb('0x6d')](_0xf7eb('0x6e'),{'UserId':_0x3507dd['id'],'SmsQueueId':_0x5acbc7['id']});});});});});}})[_0xf7eb('0x2a')](respondWithStatusCode(_0x223181,null))['catch'](handleError(_0x223181,null));};exports[_0xf7eb('0x6f')]=function(_0x23fb1b,_0x15c8ac,_0x1af57f){return db[_0xf7eb('0x65')][_0xf7eb('0x5b')]({'where':{'id':_0x23fb1b[_0xf7eb('0x37')][_0xf7eb('0x70')]},'attributes':['id'],'include':[{'model':db[_0xf7eb('0x5c')],'as':_0xf7eb('0x67'),'attributes':['id'],'raw':!![]}]})[_0xf7eb('0x2a')](handleEntityNotFound(_0x15c8ac,null))[_0xf7eb('0x2a')](function(_0x2ee674){var _0x17a878=_[_0xf7eb('0x31')](_0x2ee674,'id');var _0x505f76=[];var _0x27e2a2=[];var _0x571885=squel[_0xf7eb('0x71')]();_0x571885['field']('tq.TeamId')[_0xf7eb('0x72')](_0xf7eb('0x73'),'tq')[_0xf7eb('0x74')](_0xf7eb('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf7eb('0x41')](_0xf7eb('0x76'),_0x23fb1b[_0xf7eb('0x4a')]['id']);for(var _0x175689=0x0;_0x175689<_0x2ee674[_0xf7eb('0x3c')];_0x175689+=0x1){let _0x3f7c98=_0x2ee674[_0x175689];for(var _0x13011a=0x0;_0x13011a<_0x3f7c98[_0xf7eb('0x67')][_0xf7eb('0x3c')];_0x13011a+=0x1){let _0x4e97bf=_0x3f7c98[_0xf7eb('0x67')][_0x13011a];var _0xfeedfe=_0x571885[_0xf7eb('0x77')]();_0xfeedfe[_0xf7eb('0x41')](_0xf7eb('0x78'),_0x4e97bf['id']);_0x27e2a2[_0xf7eb('0x79')](db['sequelize'][_0xf7eb('0x37')](_0xfeedfe[_0xf7eb('0x7a')](),{'type':db[_0xf7eb('0x69')][_0xf7eb('0x7b')][_0xf7eb('0x7c')]})['then'](function(_0x189fb5){if(_0x189fb5[_0xf7eb('0x3c')]===0x1){return _0x4e97bf['id'];}else{var _0x69fc8e=_[_0xf7eb('0x7d')](_[_0xf7eb('0x31')](_0x189fb5,_0xf7eb('0x7e')),function(_0x136ae5){return _[_0xf7eb('0x7f')](_0x17a878,_0x136ae5);});if(_0x69fc8e){return _0x4e97bf['id'];}}}));}}return BPromise['all'](_0x27e2a2)[_0xf7eb('0x2a')](function(_0x437f2c){_0x505f76=_(_0x505f76)[_0xf7eb('0x80')](_0x437f2c)['compact']()[_0xf7eb('0x81')]();return db[_0xf7eb('0x32')][_0xf7eb('0x4d')]({'where':{'id':_0x23fb1b[_0xf7eb('0x4a')]['id']}})[_0xf7eb('0x2a')](function(_0x52d546){return db[_0xf7eb('0x69')]['transaction'](function(_0x401b70){return _0x52d546[_0xf7eb('0x6f')](_0x23fb1b[_0xf7eb('0x37')]['ids'],{'transaction':_0x401b70})['then'](function(){if(!_[_0xf7eb('0x82')](_0x505f76)){return _0x52d546[_0xf7eb('0x83')](_0x505f76,{'transaction':_0x401b70});}})[_0xf7eb('0x2a')](function(){_0x505f76[_0xf7eb('0x6c')](function(_0x298e1f){socket['emit'](_0xf7eb('0x84'),{'UserId':_0x298e1f,'SmsQueueId':_0x52d546['id']});});});});});});})[_0xf7eb('0x2a')](respondWithStatusCode(_0x15c8ac,null))[_0xf7eb('0x4e')](handleError(_0x15c8ac,null));};exports[_0xf7eb('0x85')]=function(_0x1101b7,_0x76ba96,_0x581355){return db[_0xf7eb('0x32')]['find']({'where':{'id':_0x1101b7[_0xf7eb('0x4a')]['id']}})[_0xf7eb('0x2a')](handleEntityNotFound(_0x76ba96,null))[_0xf7eb('0x2a')](function(_0x1ac2a3){if(_0x1ac2a3){return _0x1ac2a3[_0xf7eb('0x85')](_0x1101b7['body']['ids'],_[_0xf7eb('0x86')](_0x1101b7[_0xf7eb('0x50')],['ids','id'])||{})['spread'](function(_0x175ea1){for(var _0x43a859=0x0;_0x43a859<_0x1101b7['body']['ids'][_0xf7eb('0x3c')];_0x43a859+=0x1){socket['emit'](_0xf7eb('0x6e'),{'UserId':Number(_0x1101b7[_0xf7eb('0x50')][_0xf7eb('0x70')][_0x43a859]),'SmsQueueId':Number(_0x1101b7[_0xf7eb('0x4a')]['id'])});}return _0x175ea1;});}})['then'](respondWithResult(_0x76ba96,null))[_0xf7eb('0x4e')](handleError(_0x76ba96,null));};exports['removeAgents']=function(_0x184633,_0x1e1258,_0x5241cb){return db[_0xf7eb('0x32')][_0xf7eb('0x4d')]({'where':{'id':_0x184633['params']['id']}})['then'](handleEntityNotFound(_0x1e1258,null))[_0xf7eb('0x2a')](function(_0x58ca3c){if(_0x58ca3c){return _0x58ca3c[_0xf7eb('0x83')](_0x184633['query'][_0xf7eb('0x70')])['then'](function(){if(_['isArray'](_0x184633['query'][_0xf7eb('0x70')])){for(var _0x224ec0=0x0;_0x224ec0<_0x184633[_0xf7eb('0x37')][_0xf7eb('0x70')][_0xf7eb('0x3c')];_0x224ec0+=0x1){socket[_0xf7eb('0x6d')](_0xf7eb('0x84'),{'UserId':Number(_0x184633['query'][_0xf7eb('0x70')][_0x224ec0]),'SmsQueueId':Number(_0x184633[_0xf7eb('0x4a')]['id'])});}}else{socket['emit'](_0xf7eb('0x84'),{'UserId':Number(_0x184633[_0xf7eb('0x37')][_0xf7eb('0x70')]),'SmsQueueId':Number(_0x184633[_0xf7eb('0x4a')]['id'])});}});}})[_0xf7eb('0x2a')](respondWithStatusCode(_0x1e1258,null))[_0xf7eb('0x4e')](handleError(_0x1e1258,null));};exports['getAgents']=function(_0xa5ef71,_0xd3ebc8,_0x3c3ab8){var _0x453c06={};var _0x349174={};var _0x392138;var _0x3b605e;return db['SmsQueue'][_0xf7eb('0x58')]({'where':{'id':_0xa5ef71['params']['id']}})[_0xf7eb('0x2a')](handleEntityNotFound(_0xd3ebc8,null))[_0xf7eb('0x2a')](function(_0x180403){if(_0x180403){_0x392138=_0x180403;_0x349174[_0xf7eb('0x39')]=_['keys'](db[_0xf7eb('0x5c')]['rawAttributes']);_0x349174[_0xf7eb('0x37')]=_[_0xf7eb('0x4b')](_0xa5ef71[_0xf7eb('0x37')]);_0x349174[_0xf7eb('0x42')]=_[_0xf7eb('0x38')](_0x349174[_0xf7eb('0x39')],_0x349174['query']);_0x453c06[_0xf7eb('0x3a')]=_[_0xf7eb('0x38')](_0x349174[_0xf7eb('0x39')],qs[_0xf7eb('0x3b')](_0xa5ef71[_0xf7eb('0x37')][_0xf7eb('0x3b')]));_0x453c06[_0xf7eb('0x3a')]=_0x453c06['attributes']['length']?_0x453c06[_0xf7eb('0x3a')]:_0x349174[_0xf7eb('0x39')];_0x453c06['order']=qs[_0xf7eb('0x40')](_0xa5ef71[_0xf7eb('0x37')]['sort']);_0x453c06[_0xf7eb('0x41')]=qs[_0xf7eb('0x42')](_[_0xf7eb('0x43')](_0xa5ef71['query'],_0x349174[_0xf7eb('0x42')]));if(_0xa5ef71[_0xf7eb('0x37')][_0xf7eb('0x44')]){_0x453c06[_0xf7eb('0x41')]=_[_0xf7eb('0x45')](_0x453c06['where'],{'$or':_[_0xf7eb('0x31')](_0x453c06[_0xf7eb('0x3a')],function(_0x20c195){var _0x305f49={};_0x305f49[_0x20c195]={'$like':'%'+_0xa5ef71[_0xf7eb('0x37')][_0xf7eb('0x44')]+'%'};return _0x305f49;})});}_0x453c06=_[_0xf7eb('0x45')]({},_0x453c06,_0xa5ef71[_0xf7eb('0x47')]);return _0x392138['getAgents'](_0x453c06);}})[_0xf7eb('0x2a')](function(_0x39d225){if(_0x39d225){_0x3b605e=_0x39d225[_0xf7eb('0x3c')];if(!_0xa5ef71[_0xf7eb('0x37')][_0xf7eb('0x3d')](_0xf7eb('0x3e'))){_0x453c06[_0xf7eb('0x23')]=qs[_0xf7eb('0x23')](_0xa5ef71['query'][_0xf7eb('0x23')]);_0x453c06[_0xf7eb('0x20')]=qs[_0xf7eb('0x20')](_0xa5ef71['query'][_0xf7eb('0x20')]);}return _0x392138[_0xf7eb('0x87')](_0x453c06);}})[_0xf7eb('0x2a')](function(_0x38b9b0){if(_0x38b9b0){return _0x38b9b0?{'count':_0x3b605e,'rows':_0x38b9b0}:null;}})[_0xf7eb('0x2a')](respondWithResult(_0xd3ebc8,null))['catch'](handleError(_0xd3ebc8,null));}; \ No newline at end of file +var _0xd1c9=['get','SmsQueues','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','params','UserSmsQueue','length','filter','options','User','UserId','updatedAt','createdAt','%s/%s','SIP','smsPause','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','sequelize','QueryTypes','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then'];(function(_0x4461de,_0x9f2aa6){var _0x2d4a50=function(_0x27058f){while(--_0x27058f){_0x4461de['push'](_0x4461de['shift']());}};_0x2d4a50(++_0x9f2aa6);}(_0xd1c9,0xeb));var _0x9d1c=function(_0x2b36f5,_0x5732dc){_0x2b36f5=_0x2b36f5-0x0;var _0x5f06b6=_0xd1c9[_0x2b36f5];return _0x5f06b6;};'use strict';var emlformat=require(_0x9d1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9d1c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9d1c('0x2'));var BPromise=require(_0x9d1c('0x3'));var Mustache=require(_0x9d1c('0x4'));var util=require(_0x9d1c('0x5'));var path=require(_0x9d1c('0x6'));var sox=require(_0x9d1c('0x7'));var csv=require(_0x9d1c('0x8'));var ejs=require(_0x9d1c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d1c('0xa'));var squel=require(_0x9d1c('0xb'));var crypto=require(_0x9d1c('0xc'));var jsforce=require(_0x9d1c('0xd'));var deskjs=require(_0x9d1c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9d1c('0xf'));var Papa=require(_0x9d1c('0x10'));var Redis=require(_0x9d1c('0x11'));var authService=require(_0x9d1c('0x12'));var qs=require(_0x9d1c('0x13'));var as=require(_0x9d1c('0x14'));var hardwareService=require(_0x9d1c('0x15'));var logger=require(_0x9d1c('0x16'))(_0x9d1c('0x17'));var utils=require(_0x9d1c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9d1c('0x19'));var db=require(_0x9d1c('0x1a'))['db'];config[_0x9d1c('0x1b')]=_['defaults'](config['redis'],{'host':_0x9d1c('0x1c'),'port':0x18eb});var socket=require(_0x9d1c('0x1d'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x9d1c('0x1e')](socket);function respondWithStatusCode(_0x522700,_0x19b2ed){_0x19b2ed=_0x19b2ed||0xcc;return function(_0x291107){if(_0x291107){return _0x522700[_0x9d1c('0x1f')](_0x19b2ed);}return _0x522700[_0x9d1c('0x20')](_0x19b2ed)[_0x9d1c('0x21')]();};}function respondWithResult(_0x1a9350,_0x595b25){_0x595b25=_0x595b25||0xc8;return function(_0xcbf48d){if(_0xcbf48d){return _0x1a9350[_0x9d1c('0x20')](_0x595b25)[_0x9d1c('0x22')](_0xcbf48d);}};}function respondWithFilteredResult(_0x3da96a,_0x31b2a3){return function(_0x34d738){if(_0x34d738){var _0x5f0f05=typeof _0x31b2a3[_0x9d1c('0x23')]===_0x9d1c('0x24')&&typeof _0x31b2a3['limit']==='undefined';var _0x370818=_0x34d738['count'];var _0x1eef73=_0x5f0f05?0x0:_0x31b2a3[_0x9d1c('0x23')];var _0x47b045=_0x5f0f05?_0x34d738[_0x9d1c('0x25')]:_0x31b2a3[_0x9d1c('0x23')]+_0x31b2a3[_0x9d1c('0x26')];var _0xe14203;if(_0x47b045>=_0x370818){_0x47b045=_0x370818;_0xe14203=0xc8;}else{_0xe14203=0xce;}_0x3da96a[_0x9d1c('0x20')](_0xe14203);return _0x3da96a[_0x9d1c('0x27')](_0x9d1c('0x28'),_0x1eef73+'-'+_0x47b045+'/'+_0x370818)[_0x9d1c('0x22')](_0x34d738);}return null;};}function patchUpdates(_0x1af0db){return function(_0x302610){try{jsonpatch[_0x9d1c('0x29')](_0x302610,_0x1af0db,!![]);}catch(_0x409eee){return BPromise['reject'](_0x409eee);}return _0x302610[_0x9d1c('0x2a')]();};}function saveUpdates(_0xbada54,_0x1c2574){return function(_0x50d551){if(_0x50d551){return _0x50d551[_0x9d1c('0x2b')](_0xbada54)[_0x9d1c('0x2c')](function(_0x129534){return _0x129534;});}return null;};}function removeEntity(_0x52a393,_0x3814fb){return function(_0x4ed2f0){if(_0x4ed2f0){return _0x4ed2f0['destroy']()['then'](function(){var _0x376aae=_0x4ed2f0[_0x9d1c('0x2d')]({'plain':!![]});var _0x18d371=_0x9d1c('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x18d371,'resourceId':_0x376aae['id']}})['then'](function(){return _0x4ed2f0;});})[_0x9d1c('0x2c')](function(){_0x52a393['status'](0xcc)[_0x9d1c('0x21')]();});}};}function handleEntityNotFound(_0x1741fc,_0x40c06a){return function(_0x10c4e4){if(!_0x10c4e4){_0x1741fc[_0x9d1c('0x1f')](0x194);}return _0x10c4e4;};}function handleError(_0x78861b,_0x5aee22){_0x5aee22=_0x5aee22||0x1f4;return function(_0x31bcd6){logger[_0x9d1c('0x2f')](_0x31bcd6[_0x9d1c('0x30')]);if(_0x31bcd6[_0x9d1c('0x31')]){delete _0x31bcd6['name'];}_0x78861b[_0x9d1c('0x20')](_0x5aee22)[_0x9d1c('0x32')](_0x31bcd6);};}exports[_0x9d1c('0x33')]=function(_0x1093ee,_0x1b77e4){var _0x35ac25={},_0x372a31={},_0x48748b={'count':0x0,'rows':[]};var _0x187f84=_[_0x9d1c('0x34')](db[_0x9d1c('0x35')][_0x9d1c('0x36')],function(_0x647851){return{'name':_0x647851[_0x9d1c('0x37')],'type':_0x647851['type'][_0x9d1c('0x38')]};});_0x372a31[_0x9d1c('0x39')]=_[_0x9d1c('0x34')](_0x187f84,_0x9d1c('0x31'));_0x372a31[_0x9d1c('0x3a')]=_[_0x9d1c('0x3b')](_0x1093ee[_0x9d1c('0x3a')]);_0x372a31[_0x9d1c('0x3c')]=_['intersection'](_0x372a31[_0x9d1c('0x39')],_0x372a31['query']);_0x35ac25[_0x9d1c('0x3d')]=_[_0x9d1c('0x3e')](_0x372a31[_0x9d1c('0x39')],qs[_0x9d1c('0x3f')](_0x1093ee[_0x9d1c('0x3a')]['fields']));_0x35ac25[_0x9d1c('0x3d')]=_0x35ac25[_0x9d1c('0x3d')]['length']?_0x35ac25[_0x9d1c('0x3d')]:_0x372a31[_0x9d1c('0x39')];if(!_0x1093ee[_0x9d1c('0x3a')][_0x9d1c('0x40')](_0x9d1c('0x41'))){_0x35ac25['limit']=qs[_0x9d1c('0x26')](_0x1093ee['query'][_0x9d1c('0x26')]);_0x35ac25[_0x9d1c('0x23')]=qs[_0x9d1c('0x23')](_0x1093ee[_0x9d1c('0x3a')][_0x9d1c('0x23')]);}_0x35ac25[_0x9d1c('0x42')]=qs[_0x9d1c('0x43')](_0x1093ee[_0x9d1c('0x3a')][_0x9d1c('0x43')]);_0x35ac25[_0x9d1c('0x44')]=qs[_0x9d1c('0x3c')](_[_0x9d1c('0x45')](_0x1093ee[_0x9d1c('0x3a')],_0x372a31['filters']),_0x187f84);if(_0x1093ee['query']['filter']){_0x35ac25['where']=_['merge'](_0x35ac25[_0x9d1c('0x44')],{'$or':_['map'](_0x187f84,function(_0x5469fe){if(_0x5469fe[_0x9d1c('0x46')]!==_0x9d1c('0x47')){var _0x3d5138={};_0x3d5138[_0x5469fe[_0x9d1c('0x31')]]={'$like':'%'+_0x1093ee[_0x9d1c('0x3a')]['filter']+'%'};return _0x3d5138;}})});}_0x35ac25=_[_0x9d1c('0x48')]({},_0x35ac25,_0x1093ee['options']);var _0x130384={'where':_0x35ac25['where']};return db[_0x9d1c('0x35')][_0x9d1c('0x25')](_0x130384)['then'](function(_0x1be8a0){_0x48748b[_0x9d1c('0x25')]=_0x1be8a0;if(_0x1093ee[_0x9d1c('0x3a')][_0x9d1c('0x49')]){_0x35ac25[_0x9d1c('0x4a')]=[{'all':!![]}];}return db[_0x9d1c('0x35')][_0x9d1c('0x4b')](_0x35ac25);})[_0x9d1c('0x2c')](function(_0x595746){_0x48748b[_0x9d1c('0x4c')]=_0x595746;return _0x48748b;})[_0x9d1c('0x2c')](respondWithFilteredResult(_0x1b77e4,_0x35ac25))[_0x9d1c('0x4d')](handleError(_0x1b77e4,null));};exports[_0x9d1c('0x4e')]=function(_0x16b33a,_0x1491e3){var _0x1a4254={'raw':!![],'where':{'id':_0x16b33a['params']['id']}},_0x51f6c7={};_0x51f6c7[_0x9d1c('0x39')]=_[_0x9d1c('0x3b')](db[_0x9d1c('0x35')][_0x9d1c('0x36')]);_0x51f6c7[_0x9d1c('0x3a')]=_[_0x9d1c('0x3b')](_0x16b33a[_0x9d1c('0x3a')]);_0x51f6c7[_0x9d1c('0x3c')]=_[_0x9d1c('0x3e')](_0x51f6c7[_0x9d1c('0x39')],_0x51f6c7[_0x9d1c('0x3a')]);_0x1a4254[_0x9d1c('0x3d')]=_[_0x9d1c('0x3e')](_0x51f6c7[_0x9d1c('0x39')],qs['fields'](_0x16b33a[_0x9d1c('0x3a')]['fields']));_0x1a4254[_0x9d1c('0x3d')]=_0x1a4254[_0x9d1c('0x3d')]['length']?_0x1a4254[_0x9d1c('0x3d')]:_0x51f6c7['model'];if(_0x16b33a[_0x9d1c('0x3a')][_0x9d1c('0x49')]){_0x1a4254[_0x9d1c('0x4a')]=[{'all':!![]}];}_0x1a4254=_[_0x9d1c('0x48')]({},_0x1a4254,_0x16b33a['options']);return db[_0x9d1c('0x35')][_0x9d1c('0x4f')](_0x1a4254)['then'](handleEntityNotFound(_0x1491e3,null))[_0x9d1c('0x2c')](respondWithResult(_0x1491e3,null))[_0x9d1c('0x4d')](handleError(_0x1491e3,null));};exports[_0x9d1c('0x50')]=function(_0xd09e2d,_0x292825){return db[_0x9d1c('0x35')][_0x9d1c('0x50')](_0xd09e2d['body'],{})['then'](function(_0x5a60a5){var _0x58da46=_0xd09e2d[_0x9d1c('0x51')][_0x9d1c('0x2d')]({'plain':!![]});if(!_0x58da46)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58da46[_0x9d1c('0x52')]===_0x9d1c('0x51')){var _0x1c4002=_0x5a60a5['get']({'plain':!![]});var _0x6c4d42=_0x9d1c('0x2e');return db[_0x9d1c('0x53')]['find']({'where':{'name':_0x6c4d42,'userProfileId':_0x58da46[_0x9d1c('0x54')]},'raw':!![]})['then'](function(_0x134677){if(_0x134677&&_0x134677[_0x9d1c('0x55')]===0x0){return db[_0x9d1c('0x56')][_0x9d1c('0x50')]({'name':_0x1c4002[_0x9d1c('0x31')],'resourceId':_0x1c4002['id'],'type':_0x134677[_0x9d1c('0x31')],'sectionId':_0x134677['id']},{})[_0x9d1c('0x2c')](function(){return _0x5a60a5;});}else{return _0x5a60a5;}})[_0x9d1c('0x4d')](function(_0x5332f7){logger[_0x9d1c('0x2f')](_0x9d1c('0x57'),_0x5332f7);throw _0x5332f7;});}return _0x5a60a5;})[_0x9d1c('0x2c')](respondWithResult(_0x292825,0xc9))['catch'](handleError(_0x292825,null));};exports[_0x9d1c('0x2b')]=function(_0xa5557d,_0x5cab82){if(_0xa5557d[_0x9d1c('0x58')]['id']){delete _0xa5557d[_0x9d1c('0x58')]['id'];}return db[_0x9d1c('0x35')]['find']({'where':{'id':_0xa5557d['params']['id']}})['then'](handleEntityNotFound(_0x5cab82,null))[_0x9d1c('0x2c')](saveUpdates(_0xa5557d[_0x9d1c('0x58')],null))[_0x9d1c('0x2c')](respondWithResult(_0x5cab82,null))[_0x9d1c('0x4d')](handleError(_0x5cab82,null));};exports['destroy']=function(_0x23ccfb,_0x5bf165){return db[_0x9d1c('0x35')][_0x9d1c('0x4f')]({'where':{'id':_0x23ccfb['params']['id']}})[_0x9d1c('0x2c')](handleEntityNotFound(_0x5bf165,null))[_0x9d1c('0x2c')](removeEntity(_0x5bf165,null))['catch'](handleError(_0x5bf165,null));};exports[_0x9d1c('0x59')]=function(_0x566b3d,_0x2a4f65){return db['SmsQueue'][_0x9d1c('0x59')]()['then'](respondWithResult(_0x2a4f65,null))['catch'](handleError(_0x2a4f65,null));};exports[_0x9d1c('0x5a')]=function(_0xdcc01a,_0xf351db,_0x49ef91){var _0xe5a504={'raw':!![],'where':{}},_0x1945f4={},_0x53d847;return db[_0x9d1c('0x35')][_0x9d1c('0x5b')]({'where':{'id':_0xdcc01a[_0x9d1c('0x5c')]['id']}})[_0x9d1c('0x2c')](handleEntityNotFound(_0xf351db,null))[_0x9d1c('0x2c')](function(_0x3d9c6d){if(_0x3d9c6d){_0x53d847=_0x3d9c6d[_0x9d1c('0x2d')]({'plain':!![]});_0x1945f4[_0x9d1c('0x39')]=_['keys'](db[_0x9d1c('0x5d')][_0x9d1c('0x36')]);_0x1945f4[_0x9d1c('0x3a')]=_[_0x9d1c('0x3b')](_0xdcc01a['query']);_0x1945f4['filters']=_[_0x9d1c('0x3e')](_0x1945f4[_0x9d1c('0x39')],_0x1945f4['query']);_0xe5a504[_0x9d1c('0x3d')]=_['intersection'](_0x1945f4[_0x9d1c('0x39')],qs[_0x9d1c('0x3f')](_0xdcc01a[_0x9d1c('0x3a')][_0x9d1c('0x3f')]));_0xe5a504[_0x9d1c('0x3d')]=_0xe5a504[_0x9d1c('0x3d')][_0x9d1c('0x5e')]?_0xe5a504[_0x9d1c('0x3d')]:_0x1945f4['model'];if(!_0xdcc01a[_0x9d1c('0x3a')][_0x9d1c('0x40')]('nolimit')){_0xe5a504[_0x9d1c('0x26')]=qs['limit'](_0xdcc01a[_0x9d1c('0x3a')][_0x9d1c('0x26')]);_0xe5a504[_0x9d1c('0x23')]=qs[_0x9d1c('0x23')](_0xdcc01a[_0x9d1c('0x3a')][_0x9d1c('0x23')]);}_0xe5a504[_0x9d1c('0x42')]=qs[_0x9d1c('0x43')](_0xdcc01a[_0x9d1c('0x3a')]['sort']);_0xe5a504[_0x9d1c('0x44')]=qs[_0x9d1c('0x3c')](_['pick'](_0xdcc01a[_0x9d1c('0x3a')],_0x1945f4[_0x9d1c('0x3c')]));_0xe5a504['where']['SmsQueueId']=_0x3d9c6d['id'];if(_0xdcc01a[_0x9d1c('0x3a')]['filter']){_0xe5a504[_0x9d1c('0x44')]=_['merge'](_0xe5a504[_0x9d1c('0x44')],{'$or':_[_0x9d1c('0x34')](_0xe5a504['attributes'],function(_0x3c7ac2){var _0x26f982={};_0x26f982[_0x3c7ac2]={'$like':'%'+_0xdcc01a['query'][_0x9d1c('0x5f')]+'%'};return _0x26f982;})});}_0xe5a504=_['merge']({},_0xe5a504,_0xdcc01a[_0x9d1c('0x60')]);return db['UserSmsQueue'][_0x9d1c('0x4b')](_0xe5a504);}})[_0x9d1c('0x2c')](function(_0x2bd2eb){if(_0x2bd2eb){return db[_0x9d1c('0x61')]['findAndCountAll']({'where':{'id':_[_0x9d1c('0x34')](_0x2bd2eb,_0x9d1c('0x62')),'role':'agent'},'attributes':['id','name','smsPause',_0x9d1c('0x63'),_0x9d1c('0x64')]});}})[_0x9d1c('0x2c')](function(_0x340cec){if(_0x340cec){return{'count':_0x340cec[_0x9d1c('0x25')],'rows':_[_0x9d1c('0x34')](_0x340cec['rows'],function(_0x36f28d){return{'membername':_0x36f28d[_0x9d1c('0x31')],'UserId':_0x36f28d['id'],'queue_name':_0x53d847[_0x9d1c('0x31')],'SmsQueueId':_0x53d847['id'],'interface':util['format'](_0x9d1c('0x65'),_0x9d1c('0x66'),_0x36f28d['name']),'penalty':0x0,'paused':_0x36f28d[_0x9d1c('0x67')],'createdAt':_0x36f28d['createdAt'],'updatedAt':_0x36f28d[_0x9d1c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9d1c('0x2c')](respondWithFilteredResult(_0xf351db,_0xe5a504))[_0x9d1c('0x4d')](handleError(_0xf351db,null));};exports[_0x9d1c('0x68')]=function(_0x3ae98c,_0x48351a,_0x146de5){var _0x379576={};var _0x566815={};var _0x29204f;var _0x45de15;return db['SmsQueue']['findOne']({'where':{'id':_0x3ae98c['params']['id']}})[_0x9d1c('0x2c')](handleEntityNotFound(_0x48351a,null))[_0x9d1c('0x2c')](function(_0x109d9e){if(_0x109d9e){_0x29204f=_0x109d9e;_0x566815[_0x9d1c('0x39')]=_[_0x9d1c('0x3b')](db['Team'][_0x9d1c('0x36')]);_0x566815['query']=_['keys'](_0x3ae98c['query']);_0x566815[_0x9d1c('0x3c')]=_['intersection'](_0x566815[_0x9d1c('0x39')],_0x566815['query']);_0x379576[_0x9d1c('0x3d')]=_[_0x9d1c('0x3e')](_0x566815[_0x9d1c('0x39')],qs['fields'](_0x3ae98c[_0x9d1c('0x3a')][_0x9d1c('0x3f')]));_0x379576[_0x9d1c('0x3d')]=_0x379576[_0x9d1c('0x3d')]['length']?_0x379576[_0x9d1c('0x3d')]:_0x566815[_0x9d1c('0x39')];_0x379576[_0x9d1c('0x42')]=qs['sort'](_0x3ae98c[_0x9d1c('0x3a')]['sort']);_0x379576[_0x9d1c('0x44')]=qs[_0x9d1c('0x3c')](_['pick'](_0x3ae98c[_0x9d1c('0x3a')],_0x566815[_0x9d1c('0x3c')]));if(_0x3ae98c[_0x9d1c('0x3a')][_0x9d1c('0x5f')]){_0x379576[_0x9d1c('0x44')]=_['merge'](_0x379576['where'],{'$or':_[_0x9d1c('0x34')](_0x379576[_0x9d1c('0x3d')],function(_0x7f0d3d){var _0x47adbb={};_0x47adbb[_0x7f0d3d]={'$like':'%'+_0x3ae98c['query']['filter']+'%'};return _0x47adbb;})});}_0x379576=_[_0x9d1c('0x48')]({},_0x379576,_0x3ae98c['options']);return _0x29204f[_0x9d1c('0x68')](_0x379576);}})[_0x9d1c('0x2c')](function(_0x20af03){if(_0x20af03){_0x45de15=_0x20af03[_0x9d1c('0x5e')];if(!_0x3ae98c[_0x9d1c('0x3a')]['hasOwnProperty'](_0x9d1c('0x41'))){_0x379576[_0x9d1c('0x26')]=qs[_0x9d1c('0x26')](_0x3ae98c[_0x9d1c('0x3a')][_0x9d1c('0x26')]);_0x379576[_0x9d1c('0x23')]=qs['offset'](_0x3ae98c['query']['offset']);}return _0x29204f[_0x9d1c('0x68')](_0x379576);}})[_0x9d1c('0x2c')](function(_0x3cf190){if(_0x3cf190){return _0x3cf190?{'count':_0x45de15,'rows':_0x3cf190}:null;}})['then'](respondWithResult(_0x48351a,null))[_0x9d1c('0x4d')](handleError(_0x48351a,null));};exports[_0x9d1c('0x69')]=function(_0x95ed87,_0x459277,_0x54297e){var _0x555c94=_0x95ed87[_0x9d1c('0x58')][_0x9d1c('0x6a')];return db[_0x9d1c('0x6b')][_0x9d1c('0x4b')]({'where':{'id':_0x555c94},'attributes':['id'],'include':[{'model':db[_0x9d1c('0x61')],'as':_0x9d1c('0x6c'),'attributes':['id',_0x9d1c('0x31'),_0x9d1c('0x6d'),_0x9d1c('0x6e'),'interface'],'raw':!![]}]})[_0x9d1c('0x2c')](function(_0x4877ca){if(_0x4877ca){var _0x1b119e=_[_0x9d1c('0x6f')](_0x4877ca,function(_0x59839d){var _0x1e753d=_0x59839d[_0x9d1c('0x2d')]({'plain':!![]});return _0x1e753d[_0x9d1c('0x6c')];});return db[_0x9d1c('0x35')][_0x9d1c('0x4f')]({'where':{'id':_0x95ed87[_0x9d1c('0x5c')]['id']}})[_0x9d1c('0x2c')](function(_0x9e3079){return db['sequelize'][_0x9d1c('0x70')](function(_0x3ef65b){return _0x9e3079['addTeams'](_0x555c94,{'transaction':_0x3ef65b})[_0x9d1c('0x2c')](function(){return BPromise[_0x9d1c('0x71')](_0x1b119e,function(_0x5cea88){return db[_0x9d1c('0x5d')][_0x9d1c('0x72')]({'where':{'UserId':_0x5cea88['id'],'SmsQueueId':_0x95ed87[_0x9d1c('0x5c')]['id']},'transaction':_0x3ef65b});});})[_0x9d1c('0x2c')](function(){_0x1b119e[_0x9d1c('0x73')](function(_0x21dc48){socket[_0x9d1c('0x74')](_0x9d1c('0x75'),{'UserId':_0x21dc48['id'],'SmsQueueId':_0x9e3079['id']});});});});});}})[_0x9d1c('0x2c')](respondWithStatusCode(_0x459277,null))['catch'](handleError(_0x459277,null));};exports[_0x9d1c('0x76')]=function(_0x4f38cf,_0x3c640b,_0x54a44f){return db['Team'][_0x9d1c('0x4b')]({'where':{'id':_0x4f38cf[_0x9d1c('0x3a')][_0x9d1c('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x9d1c('0x61')],'as':_0x9d1c('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x9d1c('0x2c')](handleEntityNotFound(_0x3c640b,null))[_0x9d1c('0x2c')](function(_0x1c0082){var _0x4998ed=_[_0x9d1c('0x34')](_0x1c0082,'id');var _0x14e980=[];var _0x3584c8=[];var _0xd53d18=squel[_0x9d1c('0x77')]();_0xd53d18['field']('tq.TeamId')['from']('team_has_sms_queues','tq')[_0x9d1c('0x78')]('user_has_teams','ut',_0x9d1c('0x79'))[_0x9d1c('0x44')](_0x9d1c('0x7a'),_0x4f38cf[_0x9d1c('0x5c')]['id']);for(var _0x503526=0x0;_0x503526<_0x1c0082[_0x9d1c('0x5e')];_0x503526+=0x1){let _0x551077=_0x1c0082[_0x503526];for(var _0x1e87a4=0x0;_0x1e87a4<_0x551077['Agents']['length'];_0x1e87a4+=0x1){let _0x19e3c5=_0x551077[_0x9d1c('0x6c')][_0x1e87a4];var _0x1b692c=_0xd53d18[_0x9d1c('0x7b')]();_0x1b692c[_0x9d1c('0x44')]('ut.UserId\x20=\x20?',_0x19e3c5['id']);_0x3584c8['push'](db[_0x9d1c('0x7c')][_0x9d1c('0x3a')](_0x1b692c['toString'](),{'type':db[_0x9d1c('0x7c')][_0x9d1c('0x7d')]['SELECT']})[_0x9d1c('0x2c')](function(_0x59e2eb){if(_0x59e2eb[_0x9d1c('0x5e')]===0x1){return _0x19e3c5['id'];}else{var _0x1f9763=_['every'](_['map'](_0x59e2eb,_0x9d1c('0x7e')),function(_0x2ee39a){return _[_0x9d1c('0x7f')](_0x4998ed,_0x2ee39a);});if(_0x1f9763){return _0x19e3c5['id'];}}}));}}return BPromise[_0x9d1c('0x80')](_0x3584c8)[_0x9d1c('0x2c')](function(_0x567124){_0x14e980=_(_0x14e980)[_0x9d1c('0x81')](_0x567124)[_0x9d1c('0x82')]()[_0x9d1c('0x83')]();return db[_0x9d1c('0x35')][_0x9d1c('0x4f')]({'where':{'id':_0x4f38cf[_0x9d1c('0x5c')]['id']}})[_0x9d1c('0x2c')](function(_0x416c30){return db[_0x9d1c('0x7c')][_0x9d1c('0x70')](function(_0x335e0d){return _0x416c30['removeTeams'](_0x4f38cf[_0x9d1c('0x3a')][_0x9d1c('0x6a')],{'transaction':_0x335e0d})[_0x9d1c('0x2c')](function(){if(!_[_0x9d1c('0x84')](_0x14e980)){return _0x416c30[_0x9d1c('0x85')](_0x14e980,{'transaction':_0x335e0d});}})[_0x9d1c('0x2c')](function(){_0x14e980[_0x9d1c('0x73')](function(_0x2da73d){socket[_0x9d1c('0x74')](_0x9d1c('0x86'),{'UserId':_0x2da73d,'SmsQueueId':_0x416c30['id']});});});});});});})['then'](respondWithStatusCode(_0x3c640b,null))[_0x9d1c('0x4d')](handleError(_0x3c640b,null));};exports[_0x9d1c('0x87')]=function(_0x116aba,_0x2dcaba,_0xcdf598){return db[_0x9d1c('0x35')]['find']({'where':{'id':_0x116aba[_0x9d1c('0x5c')]['id']}})[_0x9d1c('0x2c')](handleEntityNotFound(_0x2dcaba,null))[_0x9d1c('0x2c')](function(_0x21b27e){if(_0x21b27e){return _0x21b27e['addAgents'](_0x116aba['body'][_0x9d1c('0x6a')],_[_0x9d1c('0x88')](_0x116aba[_0x9d1c('0x58')],[_0x9d1c('0x6a'),'id'])||{})[_0x9d1c('0x89')](function(_0x5b1851){for(var _0x1ed479=0x0;_0x1ed479<_0x116aba[_0x9d1c('0x58')][_0x9d1c('0x6a')]['length'];_0x1ed479+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x116aba[_0x9d1c('0x58')][_0x9d1c('0x6a')][_0x1ed479]),'SmsQueueId':Number(_0x116aba[_0x9d1c('0x5c')]['id'])});}return _0x5b1851;});}})['then'](respondWithResult(_0x2dcaba,null))['catch'](handleError(_0x2dcaba,null));};exports[_0x9d1c('0x85')]=function(_0x3d7643,_0x5449ef,_0x1bd0b8){return db['SmsQueue']['find']({'where':{'id':_0x3d7643['params']['id']}})[_0x9d1c('0x2c')](handleEntityNotFound(_0x5449ef,null))['then'](function(_0x235580){if(_0x235580){return _0x235580[_0x9d1c('0x85')](_0x3d7643[_0x9d1c('0x3a')][_0x9d1c('0x6a')])[_0x9d1c('0x2c')](function(){if(_[_0x9d1c('0x8a')](_0x3d7643['query']['ids'])){for(var _0x381108=0x0;_0x381108<_0x3d7643['query'][_0x9d1c('0x6a')]['length'];_0x381108+=0x1){socket['emit'](_0x9d1c('0x86'),{'UserId':Number(_0x3d7643[_0x9d1c('0x3a')][_0x9d1c('0x6a')][_0x381108]),'SmsQueueId':Number(_0x3d7643['params']['id'])});}}else{socket[_0x9d1c('0x74')](_0x9d1c('0x86'),{'UserId':Number(_0x3d7643['query'][_0x9d1c('0x6a')]),'SmsQueueId':Number(_0x3d7643[_0x9d1c('0x5c')]['id'])});}});}})[_0x9d1c('0x2c')](respondWithStatusCode(_0x5449ef,null))[_0x9d1c('0x4d')](handleError(_0x5449ef,null));};exports[_0x9d1c('0x8b')]=function(_0x31b87c,_0x32cdf1,_0x478f75){var _0x55e0b0={};var _0x526016={};var _0x376f79;var _0x9ac30a;return db[_0x9d1c('0x35')][_0x9d1c('0x5b')]({'where':{'id':_0x31b87c[_0x9d1c('0x5c')]['id']}})[_0x9d1c('0x2c')](handleEntityNotFound(_0x32cdf1,null))['then'](function(_0x3445ce){if(_0x3445ce){_0x376f79=_0x3445ce;_0x526016['model']=_['keys'](db[_0x9d1c('0x61')]['rawAttributes']);_0x526016[_0x9d1c('0x3a')]=_[_0x9d1c('0x3b')](_0x31b87c[_0x9d1c('0x3a')]);_0x526016[_0x9d1c('0x3c')]=_[_0x9d1c('0x3e')](_0x526016[_0x9d1c('0x39')],_0x526016[_0x9d1c('0x3a')]);_0x55e0b0[_0x9d1c('0x3d')]=_[_0x9d1c('0x3e')](_0x526016[_0x9d1c('0x39')],qs['fields'](_0x31b87c[_0x9d1c('0x3a')][_0x9d1c('0x3f')]));_0x55e0b0['attributes']=_0x55e0b0['attributes'][_0x9d1c('0x5e')]?_0x55e0b0[_0x9d1c('0x3d')]:_0x526016[_0x9d1c('0x39')];_0x55e0b0['order']=qs['sort'](_0x31b87c[_0x9d1c('0x3a')][_0x9d1c('0x43')]);_0x55e0b0[_0x9d1c('0x44')]=qs[_0x9d1c('0x3c')](_[_0x9d1c('0x45')](_0x31b87c[_0x9d1c('0x3a')],_0x526016['filters']));if(_0x31b87c[_0x9d1c('0x3a')][_0x9d1c('0x5f')]){_0x55e0b0[_0x9d1c('0x44')]=_[_0x9d1c('0x48')](_0x55e0b0[_0x9d1c('0x44')],{'$or':_[_0x9d1c('0x34')](_0x55e0b0[_0x9d1c('0x3d')],function(_0x29f148){var _0x48a7c2={};_0x48a7c2[_0x29f148]={'$like':'%'+_0x31b87c[_0x9d1c('0x3a')][_0x9d1c('0x5f')]+'%'};return _0x48a7c2;})});}_0x55e0b0=_[_0x9d1c('0x48')]({},_0x55e0b0,_0x31b87c[_0x9d1c('0x60')]);return _0x376f79[_0x9d1c('0x8b')](_0x55e0b0);}})[_0x9d1c('0x2c')](function(_0x1adb97){if(_0x1adb97){_0x9ac30a=_0x1adb97[_0x9d1c('0x5e')];if(!_0x31b87c[_0x9d1c('0x3a')][_0x9d1c('0x40')](_0x9d1c('0x41'))){_0x55e0b0[_0x9d1c('0x26')]=qs['limit'](_0x31b87c['query'][_0x9d1c('0x26')]);_0x55e0b0[_0x9d1c('0x23')]=qs[_0x9d1c('0x23')](_0x31b87c['query']['offset']);}return _0x376f79[_0x9d1c('0x8b')](_0x55e0b0);}})[_0x9d1c('0x2c')](function(_0xa839db){if(_0xa839db){return _0xa839db?{'count':_0x9ac30a,'rows':_0xa839db}:null;}})[_0x9d1c('0x2c')](respondWithResult(_0x32cdf1,null))['catch'](handleError(_0x32cdf1,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 5de3c2b..2946b76 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 _0xae61=['hook','events','../../mysqldb','setMaxListeners','emit','hasOwnProperty'];(function(_0xda0fb4,_0x385300){var _0x4c5fb7=function(_0x4d1214){while(--_0x4d1214){_0xda0fb4['push'](_0xda0fb4['shift']());}};_0x4c5fb7(++_0x385300);}(_0xae61,0x1a5));var _0x1ae6=function(_0x42744c,_0xdb19d9){_0x42744c=_0x42744c-0x0;var _0x5251cd=_0xae61[_0x42744c];return _0x5251cd;};'use strict';var EventEmitter=require(_0x1ae6('0x0'));var SmsQueue=require(_0x1ae6('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1ae6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1f63ff){return function(_0xd39b19,_0x5adca7,_0x1d703e){SmsQueueEvents['emit'](_0x1f63ff+':'+_0xd39b19['id'],_0xd39b19);SmsQueueEvents[_0x1ae6('0x3')](_0x1f63ff,_0xd39b19);_0x1d703e(null);};}for(var e in events){if(events[_0x1ae6('0x4')](e)){var event=events[e];SmsQueue[_0x1ae6('0x5')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x26bc=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','update','remove'];(function(_0x75c507,_0x43e3bc){var _0x3054f7=function(_0x12f75c){while(--_0x12f75c){_0x75c507['push'](_0x75c507['shift']());}};_0x3054f7(++_0x43e3bc);}(_0x26bc,0x1ea));var _0xc26b=function(_0x2bd693,_0x3fd337){_0x2bd693=_0x2bd693-0x0;var _0x481d3a=_0x26bc[_0x2bd693];return _0x481d3a;};'use strict';var EventEmitter=require(_0xc26b('0x0'));var SmsQueue=require(_0xc26b('0x1'))['db'][_0xc26b('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc26b('0x3'),'afterDestroy':_0xc26b('0x4')};function emitEvent(_0x2ad9af){return function(_0x517e8d,_0x5a54ef,_0x3a97b0){SmsQueueEvents[_0xc26b('0x5')](_0x2ad9af+':'+_0x517e8d['id'],_0x517e8d);SmsQueueEvents[_0xc26b('0x5')](_0x2ad9af,_0x517e8d);_0x3a97b0(null);};}for(var e in events){if(events[_0xc26b('0x6')](e)){var event=events[e];SmsQueue[_0xc26b('0x7')](e,emitEvent(event));}}module[_0xc26b('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 1510d9c..77f06f9 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 _0x630c=['SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsQueue.attributes','define'];(function(_0x2418b5,_0x4e599b){var _0x45a3d0=function(_0x1c80b8){while(--_0x1c80b8){_0x2418b5['push'](_0x2418b5['shift']());}};_0x45a3d0(++_0x4e599b);}(_0x630c,0x1a6));var _0xc630=function(_0x40a061,_0x38133f){_0x40a061=_0x40a061-0x0;var _0x376e4b=_0x630c[_0x40a061];return _0x376e4b;};'use strict';var _=require(_0xc630('0x0'));var util=require(_0xc630('0x1'));var logger=require(_0xc630('0x2'))(_0xc630('0x3'));var moment=require(_0xc630('0x4'));var BPromise=require(_0xc630('0x5'));var rp=require(_0xc630('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc630('0x7'));var attributes=require(_0xc630('0x8'));module['exports']=function(_0x51e0b4,_0x1a98a6){return _0x51e0b4[_0xc630('0x9')](_0xc630('0xa'),attributes,{'tableName':_0xc630('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39b0=['moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','../../config/logger','api'];(function(_0x1370bd,_0x3f36ca){var _0x1b3e89=function(_0x21d83d){while(--_0x21d83d){_0x1370bd['push'](_0x1370bd['shift']());}};_0x1b3e89(++_0x3f36ca);}(_0x39b0,0xf0));var _0x039b=function(_0x39f54d,_0x2da2c1){_0x39f54d=_0x39f54d-0x0;var _0x15471d=_0x39b0[_0x39f54d];return _0x15471d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x039b('0x0'))(_0x039b('0x1'));var moment=require(_0x039b('0x2'));var BPromise=require(_0x039b('0x3'));var rp=require(_0x039b('0x4'));var fs=require('fs');var path=require(_0x039b('0x5'));var rimraf=require('rimraf');var config=require(_0x039b('0x6'));var attributes=require(_0x039b('0x7'));module[_0x039b('0x8')]=function(_0x423d87,_0x2999d9){return _0x423d87['define'](_0x039b('0x9'),attributes,{'tableName':_0x039b('0xa'),'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 5ce7513..52c28b2 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 _0xaf6b=['options','raw','where','attributes','limit','include','map','model','debug','ShowSmsQueue','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetSmsQueue','findAll'];(function(_0x1508e9,_0x5dfaec){var _0x5a0bf5=function(_0x1e2a64){while(--_0x1e2a64){_0x1508e9['push'](_0x1508e9['shift']());}};_0x5a0bf5(++_0x5dfaec);}(_0xaf6b,0x1ba));var _0xbaf6=function(_0x17dfc9,_0x4a5a60){_0x17dfc9=_0x17dfc9-0x0;var _0xbfe571=_0xaf6b[_0x17dfc9];return _0xbfe571;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbaf6('0x0'));var BPromise=require('bluebird');var rs=require(_0xbaf6('0x1'));var fs=require('fs');var Redis=require(_0xbaf6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbaf6('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xbaf6('0x4'));var jayson=require(_0xbaf6('0x5'));var client=jayson[_0xbaf6('0x6')][_0xbaf6('0x7')]({'port':0x232a});config[_0xbaf6('0x8')]=_[_0xbaf6('0x9')](config[_0xbaf6('0x8')],{'host':_0xbaf6('0xa'),'port':0x18eb});var socket=require(_0xbaf6('0xb'))(new Redis(config[_0xbaf6('0x8')]));require(_0xbaf6('0xc'))[_0xbaf6('0xd')](socket);function respondWithRpcPromise(_0x1356f5,_0x5a51f4,_0x3af4b7){return new BPromise(function(_0x29cc8c,_0x38c7b0){return client[_0xbaf6('0xe')](_0x1356f5,_0x3af4b7)[_0xbaf6('0xf')](function(_0x2cf4ec){logger['info'](_0xbaf6('0x10'),_0x5a51f4,_0xbaf6('0x11'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x5a51f4,_0xbaf6('0x11'),JSON[_0xbaf6('0x12')](_0x2cf4ec));if(_0x2cf4ec[_0xbaf6('0x13')]){if(_0x2cf4ec[_0xbaf6('0x13')][_0xbaf6('0x14')]===0x1f4){logger[_0xbaf6('0x13')](_0xbaf6('0x10'),_0x5a51f4,_0x2cf4ec['error'][_0xbaf6('0x15')]);return _0x38c7b0(_0x2cf4ec[_0xbaf6('0x13')][_0xbaf6('0x15')]);}logger['error'](_0xbaf6('0x10'),_0x5a51f4,_0x2cf4ec[_0xbaf6('0x13')][_0xbaf6('0x15')]);return _0x29cc8c(_0x2cf4ec[_0xbaf6('0x13')][_0xbaf6('0x15')]);}else{logger[_0xbaf6('0x16')](_0xbaf6('0x10'),_0x5a51f4,'request\x20sent');_0x29cc8c(_0x2cf4ec['result'][_0xbaf6('0x15')]);}})[_0xbaf6('0x17')](function(_0x23ecc8){logger[_0xbaf6('0x13')](_0xbaf6('0x10'),_0x5a51f4,_0x23ecc8);_0x38c7b0(_0x23ecc8);});});}exports[_0xbaf6('0x18')]=function(_0x209f1e){var _0x2a7cc9=this;return new Promise(function(_0x1852f3,_0x1130c7){return db['SmsQueue'][_0xbaf6('0x19')]({'raw':_0x209f1e[_0xbaf6('0x1a')]?_0x209f1e['options'][_0xbaf6('0x1b')]===undefined?!![]:![]:!![],'where':_0x209f1e[_0xbaf6('0x1a')]?_0x209f1e[_0xbaf6('0x1a')][_0xbaf6('0x1c')]||null:null,'attributes':_0x209f1e[_0xbaf6('0x1a')]?_0x209f1e[_0xbaf6('0x1a')][_0xbaf6('0x1d')]||null:null,'limit':_0x209f1e['options']?_0x209f1e['options'][_0xbaf6('0x1e')]||null:null,'include':_0x209f1e[_0xbaf6('0x1a')]?_0x209f1e[_0xbaf6('0x1a')][_0xbaf6('0x1f')]?_[_0xbaf6('0x20')](_0x209f1e['options'][_0xbaf6('0x1f')],function(_0x54b78a){return{'model':db[_0x54b78a[_0xbaf6('0x21')]],'as':_0x54b78a['as'],'attributes':_0x54b78a[_0xbaf6('0x1d')],'include':_0x54b78a[_0xbaf6('0x1f')]?_[_0xbaf6('0x20')](_0x54b78a['include'],function(_0x238bbd){return{'model':db[_0x238bbd[_0xbaf6('0x21')]],'as':_0x238bbd['as'],'attributes':_0x238bbd[_0xbaf6('0x1d')],'include':_0x238bbd[_0xbaf6('0x1f')]?_[_0xbaf6('0x20')](_0x238bbd['include'],function(_0x34a3ea){return{'model':db[_0x34a3ea[_0xbaf6('0x21')]],'as':_0x34a3ea['as'],'attributes':_0x34a3ea[_0xbaf6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbaf6('0xf')](function(_0x2a824a){logger[_0xbaf6('0x16')]('GetSmsQueue',_0x209f1e);logger[_0xbaf6('0x22')]('GetSmsQueue',_0x209f1e,JSON['stringify'](_0x2a824a));_0x1852f3(_0x2a824a);})[_0xbaf6('0x17')](function(_0x50efbf){logger[_0xbaf6('0x13')](_0xbaf6('0x18'),_0x50efbf['message'],_0x209f1e);_0x1130c7(_0x2a7cc9['error'](0x1f4,_0x50efbf[_0xbaf6('0x15')]));});});};exports[_0xbaf6('0x23')]=function(_0x1b538f){var _0x14b8e4=this;return new Promise(function(_0x2f86bd,_0x2301e8){return db['SmsQueue']['find']({'raw':_0x1b538f[_0xbaf6('0x1a')]?_0x1b538f[_0xbaf6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1b538f[_0xbaf6('0x1a')]?_0x1b538f[_0xbaf6('0x1a')]['where']||null:null,'attributes':_0x1b538f[_0xbaf6('0x1a')]?_0x1b538f[_0xbaf6('0x1a')][_0xbaf6('0x1d')]||null:null,'include':_0x1b538f[_0xbaf6('0x1a')]?_0x1b538f['options'][_0xbaf6('0x1f')]?_['map'](_0x1b538f[_0xbaf6('0x1a')][_0xbaf6('0x1f')],function(_0x39371f){return{'model':db[_0x39371f[_0xbaf6('0x21')]],'as':_0x39371f['as'],'attributes':_0x39371f[_0xbaf6('0x1d')],'include':_0x39371f[_0xbaf6('0x1f')]?_['map'](_0x39371f[_0xbaf6('0x1f')],function(_0x3e5356){return{'model':db[_0x3e5356[_0xbaf6('0x21')]],'as':_0x3e5356['as'],'attributes':_0x3e5356[_0xbaf6('0x1d')],'include':_0x3e5356['include']?_['map'](_0x3e5356[_0xbaf6('0x1f')],function(_0x463355){return{'model':db[_0x463355[_0xbaf6('0x21')]],'as':_0x463355['as'],'attributes':_0x463355[_0xbaf6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbaf6('0xf')](function(_0x413a8a){logger[_0xbaf6('0x16')](_0xbaf6('0x23'),_0x1b538f);logger['debug']('ShowSmsQueue',_0x1b538f,JSON[_0xbaf6('0x12')](_0x413a8a));_0x2f86bd(_0x413a8a);})[_0xbaf6('0x17')](function(_0x1681d0){logger[_0xbaf6('0x13')](_0xbaf6('0x23'),_0x1681d0[_0xbaf6('0x15')],_0x1b538f);_0x2301e8(_0x14b8e4[_0xbaf6('0x13')](0x1f4,_0x1681d0['message']));});});}; \ No newline at end of file +var _0xd01b=['register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','catch','ShowSmsQueue','find','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./smsQueue.socket'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0xd01b,0x6c));var _0xbd01=function(_0x1b0250,_0x350260){_0x1b0250=_0x1b0250-0x0;var _0x1cec7b=_0xd01b[_0x1b0250];return _0x1cec7b;};'use strict';var _=require('lodash');var util=require(_0xbd01('0x0'));var moment=require(_0xbd01('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd01('0x2'));var fs=require('fs');var Redis=require(_0xbd01('0x3'));var db=require(_0xbd01('0x4'))['db'];var utils=require(_0xbd01('0x5'));var logger=require(_0xbd01('0x6'))(_0xbd01('0x7'));var config=require(_0xbd01('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbd01('0x9')][_0xbd01('0xa')]({'port':0x232a});config[_0xbd01('0xb')]=_['defaults'](config[_0xbd01('0xb')],{'host':_0xbd01('0xc'),'port':0x18eb});var socket=require(_0xbd01('0xd'))(new Redis(config[_0xbd01('0xb')]));require(_0xbd01('0xe'))[_0xbd01('0xf')](socket);function respondWithRpcPromise(_0x2268d3,_0x5963b6,_0x12f0cc){return new BPromise(function(_0xe833ce,_0x3f344e){return client[_0xbd01('0x10')](_0x2268d3,_0x12f0cc)[_0xbd01('0x11')](function(_0x337ef2){logger[_0xbd01('0x12')]('SmsQueue,\x20%s,\x20%s',_0x5963b6,_0xbd01('0x13'));logger[_0xbd01('0x14')](_0xbd01('0x15'),_0x5963b6,_0xbd01('0x13'),JSON[_0xbd01('0x16')](_0x337ef2));if(_0x337ef2[_0xbd01('0x17')]){if(_0x337ef2[_0xbd01('0x17')]['code']===0x1f4){logger[_0xbd01('0x17')](_0xbd01('0x18'),_0x5963b6,_0x337ef2[_0xbd01('0x17')]['message']);return _0x3f344e(_0x337ef2[_0xbd01('0x17')][_0xbd01('0x19')]);}logger[_0xbd01('0x17')](_0xbd01('0x18'),_0x5963b6,_0x337ef2['error']['message']);return _0xe833ce(_0x337ef2[_0xbd01('0x17')][_0xbd01('0x19')]);}else{logger['info'](_0xbd01('0x18'),_0x5963b6,'request\x20sent');_0xe833ce(_0x337ef2[_0xbd01('0x1a')][_0xbd01('0x19')]);}})['catch'](function(_0x466330){logger[_0xbd01('0x17')]('SmsQueue,\x20%s,\x20%s',_0x5963b6,_0x466330);_0x3f344e(_0x466330);});});}exports[_0xbd01('0x1b')]=function(_0x731e5e){var _0x3f0c3b=this;return new Promise(function(_0xdc97bc,_0x40eb8d){return db[_0xbd01('0x1c')][_0xbd01('0x1d')]({'raw':_0x731e5e['options']?_0x731e5e[_0xbd01('0x1e')][_0xbd01('0x1f')]===undefined?!![]:![]:!![],'where':_0x731e5e['options']?_0x731e5e['options']['where']||null:null,'attributes':_0x731e5e['options']?_0x731e5e[_0xbd01('0x1e')][_0xbd01('0x20')]||null:null,'limit':_0x731e5e[_0xbd01('0x1e')]?_0x731e5e[_0xbd01('0x1e')][_0xbd01('0x21')]||null:null,'include':_0x731e5e[_0xbd01('0x1e')]?_0x731e5e['options'][_0xbd01('0x22')]?_[_0xbd01('0x23')](_0x731e5e['options'][_0xbd01('0x22')],function(_0x4b37b4){return{'model':db[_0x4b37b4['model']],'as':_0x4b37b4['as'],'attributes':_0x4b37b4['attributes'],'include':_0x4b37b4[_0xbd01('0x22')]?_[_0xbd01('0x23')](_0x4b37b4[_0xbd01('0x22')],function(_0x30e52f){return{'model':db[_0x30e52f[_0xbd01('0x24')]],'as':_0x30e52f['as'],'attributes':_0x30e52f[_0xbd01('0x20')],'include':_0x30e52f[_0xbd01('0x22')]?_[_0xbd01('0x23')](_0x30e52f[_0xbd01('0x22')],function(_0x3cdc18){return{'model':db[_0x3cdc18[_0xbd01('0x24')]],'as':_0x3cdc18['as'],'attributes':_0x3cdc18['attributes']};}):[]};}):[]};}):[]:[]})[_0xbd01('0x11')](function(_0x3c0b50){logger[_0xbd01('0x12')](_0xbd01('0x1b'),_0x731e5e);logger['debug'](_0xbd01('0x1b'),_0x731e5e,JSON['stringify'](_0x3c0b50));_0xdc97bc(_0x3c0b50);})[_0xbd01('0x25')](function(_0x51f1c1){logger[_0xbd01('0x17')](_0xbd01('0x1b'),_0x51f1c1[_0xbd01('0x19')],_0x731e5e);_0x40eb8d(_0x3f0c3b[_0xbd01('0x17')](0x1f4,_0x51f1c1[_0xbd01('0x19')]));});});};exports[_0xbd01('0x26')]=function(_0x432dd8){var _0x55960e=this;return new Promise(function(_0x4b5daa,_0x36205c){return db[_0xbd01('0x1c')][_0xbd01('0x27')]({'raw':_0x432dd8[_0xbd01('0x1e')]?_0x432dd8[_0xbd01('0x1e')][_0xbd01('0x1f')]===undefined?!![]:![]:!![],'where':_0x432dd8['options']?_0x432dd8[_0xbd01('0x1e')][_0xbd01('0x28')]||null:null,'attributes':_0x432dd8[_0xbd01('0x1e')]?_0x432dd8[_0xbd01('0x1e')][_0xbd01('0x20')]||null:null,'include':_0x432dd8[_0xbd01('0x1e')]?_0x432dd8[_0xbd01('0x1e')][_0xbd01('0x22')]?_[_0xbd01('0x23')](_0x432dd8['options']['include'],function(_0x26746e){return{'model':db[_0x26746e['model']],'as':_0x26746e['as'],'attributes':_0x26746e[_0xbd01('0x20')],'include':_0x26746e[_0xbd01('0x22')]?_[_0xbd01('0x23')](_0x26746e[_0xbd01('0x22')],function(_0x1e50ed){return{'model':db[_0x1e50ed[_0xbd01('0x24')]],'as':_0x1e50ed['as'],'attributes':_0x1e50ed[_0xbd01('0x20')],'include':_0x1e50ed[_0xbd01('0x22')]?_[_0xbd01('0x23')](_0x1e50ed['include'],function(_0x731b9c){return{'model':db[_0x731b9c[_0xbd01('0x24')]],'as':_0x731b9c['as'],'attributes':_0x731b9c[_0xbd01('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbd01('0x11')](function(_0x690271){logger['info'](_0xbd01('0x26'),_0x432dd8);logger[_0xbd01('0x14')](_0xbd01('0x26'),_0x432dd8,JSON['stringify'](_0x690271));_0x4b5daa(_0x690271);})['catch'](function(_0x20348){logger['error'](_0xbd01('0x26'),_0x20348[_0xbd01('0x19')],_0x432dd8);_0x36205c(_0x55960e[_0xbd01('0x17')](0x1f4,_0x20348[_0xbd01('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index a3ff6d0..2e4680a 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 _0xfa92=['register','length','smsQueue:','./smsQueue.events','remove','update','emit','removeListener'];(function(_0x56347a,_0xb45e5){var _0x3e0c9f=function(_0x1e21a5){while(--_0x1e21a5){_0x56347a['push'](_0x56347a['shift']());}};_0x3e0c9f(++_0xb45e5);}(_0xfa92,0xdb));var _0x2fa9=function(_0x23d4c0,_0x555b53){_0x23d4c0=_0x23d4c0-0x0;var _0xdd6bd=_0xfa92[_0x23d4c0];return _0xdd6bd;};'use strict';var SmsQueueEvents=require(_0x2fa9('0x0'));var events=['save',_0x2fa9('0x1'),_0x2fa9('0x2')];function createListener(_0x22137d,_0xaf2a09){return function(_0x54db30){_0xaf2a09[_0x2fa9('0x3')](_0x22137d,_0x54db30);};}function removeListener(_0x4bfdd3,_0x470f2b){return function(){SmsQueueEvents[_0x2fa9('0x4')](_0x4bfdd3,_0x470f2b);};}exports[_0x2fa9('0x5')]=function(_0x2c0cc1){for(var _0x35dd06=0x0,_0x48727d=events[_0x2fa9('0x6')];_0x35dd06<_0x48727d;_0x35dd06++){var _0x482644=events[_0x35dd06];var _0x4db872=createListener(_0x2fa9('0x7')+_0x482644,_0x2c0cc1);SmsQueueEvents['on'](_0x482644,_0x4db872);}}; \ No newline at end of file +var _0xcabf=['./smsQueue.events','update','removeListener','register','length','smsQueue:'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xcabf,0x1ec));var _0xfcab=function(_0xa9077e,_0x4c0c18){_0xa9077e=_0xa9077e-0x0;var _0x5ef44a=_0xcabf[_0xa9077e];return _0x5ef44a;};'use strict';var SmsQueueEvents=require(_0xfcab('0x0'));var events=['save','remove',_0xfcab('0x1')];function createListener(_0x52404a,_0x4812ba){return function(_0x3ea54d){_0x4812ba['emit'](_0x52404a,_0x3ea54d);};}function removeListener(_0x5054ff,_0x43776b){return function(){SmsQueueEvents[_0xfcab('0x2')](_0x5054ff,_0x43776b);};}exports[_0xfcab('0x3')]=function(_0x381336){for(var _0x217390=0x0,_0x1dd8be=events[_0xfcab('0x4')];_0x217390<_0x1dd8be;_0x217390++){var _0x262881=events[_0x217390];var _0x41410d=createListener(_0xfcab('0x5')+_0x262881,_0x381336);SmsQueueEvents['on'](_0x262881,_0x41410d);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 93e080a..58802d4 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 _0xab9c=['./smsQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c921c,_0x3c6a85){var _0x440bf2=function(_0x4db0df){while(--_0x4db0df){_0x2c921c['push'](_0x2c921c['shift']());}};_0x440bf2(++_0x3c6a85);}(_0xab9c,0x122));var _0xcab9=function(_0x27b647,_0xf5f81c){_0x27b647=_0x27b647-0x0;var _0x3309e0=_0xab9c[_0x27b647];return _0x3309e0;};'use strict';var multer=require(_0xcab9('0x0'));var util=require('util');var path=require(_0xcab9('0x1'));var timeout=require(_0xcab9('0x2'));var express=require(_0xcab9('0x3'));var router=express[_0xcab9('0x4')]();var fs_extra=require(_0xcab9('0x5'));var auth=require(_0xcab9('0x6'));var interaction=require(_0xcab9('0x7'));var config=require(_0xcab9('0x8'));var controller=require(_0xcab9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xcab9('0xa')]);router[_0xcab9('0xb')](_0xcab9('0xc'),auth[_0xcab9('0xd')](),controller[_0xcab9('0xe')]);router['get'](_0xcab9('0xf'),auth[_0xcab9('0xd')](),controller[_0xcab9('0x10')]);router[_0xcab9('0x11')]('/',auth[_0xcab9('0xd')](),controller[_0xcab9('0x12')]);router[_0xcab9('0x13')](_0xcab9('0xf'),auth[_0xcab9('0xd')](),controller[_0xcab9('0x14')]);router[_0xcab9('0x15')](_0xcab9('0xf'),auth[_0xcab9('0xd')](),controller[_0xcab9('0x16')]);module['exports']=router; \ No newline at end of file +var _0x4da5=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','update','delete','/:id','destroy','exports','util','path'];(function(_0x2f83ac,_0x3afd86){var _0x4e5a99=function(_0x925a7){while(--_0x925a7){_0x2f83ac['push'](_0x2f83ac['shift']());}};_0x4e5a99(++_0x3afd86);}(_0x4da5,0x1b7));var _0x54da=function(_0x2c967d,_0x33bd4b){_0x2c967d=_0x2c967d-0x0;var _0x15c3c2=_0x4da5[_0x2c967d];return _0x15c3c2;};'use strict';var multer=require('multer');var util=require(_0x54da('0x0'));var path=require(_0x54da('0x1'));var timeout=require(_0x54da('0x2'));var express=require('express');var router=express[_0x54da('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x54da('0x4'));var interaction=require(_0x54da('0x5'));var config=require(_0x54da('0x6'));var controller=require(_0x54da('0x7'));router['get']('/',auth[_0x54da('0x8')](),controller[_0x54da('0x9')]);router[_0x54da('0xa')](_0x54da('0xb'),auth[_0x54da('0x8')](),controller[_0x54da('0xc')]);router[_0x54da('0xa')]('/:id',auth[_0x54da('0x8')](),controller[_0x54da('0xd')]);router[_0x54da('0xe')]('/',auth['isAuthenticated'](),controller[_0x54da('0xf')]);router['put']('/:id',auth[_0x54da('0x8')](),controller[_0x54da('0x10')]);router[_0x54da('0x11')](_0x54da('0x12'),auth[_0x54da('0x8')](),controller[_0x54da('0x13')]);module[_0x54da('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index d810308..085c049 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 _0x77e5=['moment','sequelize','exports','STRING','DATE'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x77e5,0xc8));var _0x577e=function(_0x55fc0d,_0x360a03){_0x55fc0d=_0x55fc0d-0x0;var _0xca57be=_0x77e5[_0x55fc0d];return _0xca57be;};'use strict';var moment=require(_0x577e('0x0'));var Sequelize=require(_0x577e('0x1'));module[_0x577e('0x2')]={'uniqueid':{'type':Sequelize[_0x577e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x577e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x577e('0x4')]},'acceptAt':{'type':Sequelize[_0x577e('0x4')]},'exitAt':{'type':Sequelize[_0x577e('0x4')]},'reason':{'type':Sequelize[_0x577e('0x3')]}}; \ No newline at end of file +var _0x680b=['STRING','DATE','sequelize'];(function(_0x5f4b6e,_0x2a5a1c){var _0x29cdb3=function(_0x24bbc4){while(--_0x24bbc4){_0x5f4b6e['push'](_0x5f4b6e['shift']());}};_0x29cdb3(++_0x2a5a1c);}(_0x680b,0x140));var _0xb680=function(_0x111dfa,_0x270b82){_0x111dfa=_0x111dfa-0x0;var _0x1c6c16=_0x680b[_0x111dfa];return _0x1c6c16;};'use strict';var moment=require('moment');var Sequelize=require(_0xb680('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb680('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xb680('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb680('0x2')]},'acceptAt':{'type':Sequelize[_0xb680('0x2')]},'exitAt':{'type':Sequelize[_0xb680('0x2')]},'reason':{'type':Sequelize[_0xb680('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b228302..421728f 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 _0xca58=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','name','send','map','SmsQueueReport','fieldName','type','query','keys','filters'];(function(_0x298303,_0x1bf44e){var _0x1e66a0=function(_0x112954){while(--_0x112954){_0x298303['push'](_0x298303['shift']());}};_0x1e66a0(++_0x1bf44e);}(_0xca58,0xb6));var _0x8ca5=function(_0x3b8b4e,_0x48e4df){_0x3b8b4e=_0x3b8b4e-0x0;var _0x120b4d=_0xca58[_0x3b8b4e];return _0x120b4d;};'use strict';var emlformat=require(_0x8ca5('0x0'));var rimraf=require(_0x8ca5('0x1'));var zipdir=require(_0x8ca5('0x2'));var jsonpatch=require(_0x8ca5('0x3'));var rp=require(_0x8ca5('0x4'));var moment=require(_0x8ca5('0x5'));var BPromise=require(_0x8ca5('0x6'));var Mustache=require(_0x8ca5('0x7'));var util=require(_0x8ca5('0x8'));var path=require('path');var sox=require(_0x8ca5('0x9'));var csv=require(_0x8ca5('0xa'));var ejs=require(_0x8ca5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8ca5('0xc'));var crypto=require(_0x8ca5('0xd'));var jsforce=require(_0x8ca5('0xe'));var deskjs=require(_0x8ca5('0xf'));var toCsv=require(_0x8ca5('0xa'));var querystring=require(_0x8ca5('0x10'));var Papa=require(_0x8ca5('0x11'));var Redis=require(_0x8ca5('0x12'));var authService=require(_0x8ca5('0x13'));var qs=require(_0x8ca5('0x14'));var as=require(_0x8ca5('0x15'));var hardwareService=require(_0x8ca5('0x16'));var logger=require(_0x8ca5('0x17'))(_0x8ca5('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8ca5('0x19'))['db'];function respondWithStatusCode(_0x46a020,_0xd3540f){_0xd3540f=_0xd3540f||0xcc;return function(_0x2f3479){if(_0x2f3479){return _0x46a020[_0x8ca5('0x1a')](_0xd3540f);}return _0x46a020[_0x8ca5('0x1b')](_0xd3540f)[_0x8ca5('0x1c')]();};}function respondWithResult(_0x1ca9f2,_0x2df892){_0x2df892=_0x2df892||0xc8;return function(_0x1390c3){if(_0x1390c3){return _0x1ca9f2['status'](_0x2df892)[_0x8ca5('0x1d')](_0x1390c3);}};}function respondWithFilteredResult(_0x33a7ed,_0x295897){return function(_0x3a34f0){if(_0x3a34f0){var _0x50c50d=typeof _0x295897[_0x8ca5('0x1e')]===_0x8ca5('0x1f')&&typeof _0x295897['limit']===_0x8ca5('0x1f');var _0x2dbecf=_0x3a34f0[_0x8ca5('0x20')];var _0x522033=_0x50c50d?0x0:_0x295897[_0x8ca5('0x1e')];var _0x3b9675=_0x50c50d?_0x3a34f0[_0x8ca5('0x20')]:_0x295897[_0x8ca5('0x1e')]+_0x295897[_0x8ca5('0x21')];var _0x23bf15;if(_0x3b9675>=_0x2dbecf){_0x3b9675=_0x2dbecf;_0x23bf15=0xc8;}else{_0x23bf15=0xce;}_0x33a7ed[_0x8ca5('0x1b')](_0x23bf15);return _0x33a7ed[_0x8ca5('0x22')]('Content-Range',_0x522033+'-'+_0x3b9675+'/'+_0x2dbecf)['json'](_0x3a34f0);}return null;};}function patchUpdates(_0x461ede){return function(_0x2e2075){try{jsonpatch[_0x8ca5('0x23')](_0x2e2075,_0x461ede,!![]);}catch(_0x1921dc){return BPromise[_0x8ca5('0x24')](_0x1921dc);}return _0x2e2075[_0x8ca5('0x25')]();};}function saveUpdates(_0x819a75,_0x570145){return function(_0xe050e0){if(_0xe050e0){return _0xe050e0[_0x8ca5('0x26')](_0x819a75)[_0x8ca5('0x27')](function(_0x1be304){return _0x1be304;});}return null;};}function removeEntity(_0x2f6887,_0x381286){return function(_0x5141ef){if(_0x5141ef){return _0x5141ef['destroy']()[_0x8ca5('0x27')](function(){_0x2f6887[_0x8ca5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52ca58,_0x3d43c9){return function(_0x328531){if(!_0x328531){_0x52ca58[_0x8ca5('0x1a')](0x194);}return _0x328531;};}function handleError(_0x5a894a,_0x5156ad){_0x5156ad=_0x5156ad||0x1f4;return function(_0x59f25a){logger['error'](_0x59f25a['stack']);if(_0x59f25a[_0x8ca5('0x28')]){delete _0x59f25a[_0x8ca5('0x28')];}_0x5a894a[_0x8ca5('0x1b')](_0x5156ad)[_0x8ca5('0x29')](_0x59f25a);};}exports['index']=function(_0x342039,_0x5d0993){var _0x340ea5={},_0x255b89={},_0x3f0185={'count':0x0,'rows':[]};var _0xeca093=_[_0x8ca5('0x2a')](db[_0x8ca5('0x2b')]['rawAttributes'],function(_0x1946f3){return{'name':_0x1946f3[_0x8ca5('0x2c')],'type':_0x1946f3[_0x8ca5('0x2d')]['key']};});_0x255b89['model']=_[_0x8ca5('0x2a')](_0xeca093,'name');_0x255b89[_0x8ca5('0x2e')]=_[_0x8ca5('0x2f')](_0x342039[_0x8ca5('0x2e')]);_0x255b89[_0x8ca5('0x30')]=_[_0x8ca5('0x31')](_0x255b89[_0x8ca5('0x32')],_0x255b89['query']);_0x340ea5[_0x8ca5('0x33')]=_['intersection'](_0x255b89[_0x8ca5('0x32')],qs['fields'](_0x342039[_0x8ca5('0x2e')][_0x8ca5('0x34')]));_0x340ea5[_0x8ca5('0x33')]=_0x340ea5['attributes'][_0x8ca5('0x35')]?_0x340ea5[_0x8ca5('0x33')]:_0x255b89[_0x8ca5('0x32')];if(!_0x342039['query'][_0x8ca5('0x36')](_0x8ca5('0x37'))){_0x340ea5['limit']=qs['limit'](_0x342039[_0x8ca5('0x2e')][_0x8ca5('0x21')]);_0x340ea5[_0x8ca5('0x1e')]=qs['offset'](_0x342039[_0x8ca5('0x2e')][_0x8ca5('0x1e')]);}_0x340ea5[_0x8ca5('0x38')]=qs[_0x8ca5('0x39')](_0x342039[_0x8ca5('0x2e')]['sort']);_0x340ea5[_0x8ca5('0x3a')]=qs['filters'](_[_0x8ca5('0x3b')](_0x342039['query'],_0x255b89['filters']),_0xeca093);if(_0x342039[_0x8ca5('0x2e')][_0x8ca5('0x3c')]){_0x340ea5[_0x8ca5('0x3a')]=_[_0x8ca5('0x3d')](_0x340ea5[_0x8ca5('0x3a')],{'$or':_['map'](_0xeca093,function(_0x289ac9){if(_0x289ac9['type']!==_0x8ca5('0x3e')){var _0x206667={};_0x206667[_0x289ac9['name']]={'$like':'%'+_0x342039['query'][_0x8ca5('0x3c')]+'%'};return _0x206667;}})});}_0x340ea5=_[_0x8ca5('0x3d')]({},_0x340ea5,_0x342039[_0x8ca5('0x3f')]);var _0x23d706={'where':_0x340ea5[_0x8ca5('0x3a')]};return db[_0x8ca5('0x2b')][_0x8ca5('0x20')](_0x23d706)['then'](function(_0x5074c1){_0x3f0185[_0x8ca5('0x20')]=_0x5074c1;if(_0x342039[_0x8ca5('0x2e')][_0x8ca5('0x40')]){_0x340ea5[_0x8ca5('0x41')]=[{'all':!![]}];}return db[_0x8ca5('0x2b')][_0x8ca5('0x42')](_0x340ea5);})[_0x8ca5('0x27')](function(_0x434635){_0x3f0185[_0x8ca5('0x43')]=_0x434635;return _0x3f0185;})[_0x8ca5('0x27')](respondWithFilteredResult(_0x5d0993,_0x340ea5))['catch'](handleError(_0x5d0993,null));};exports[_0x8ca5('0x44')]=function(_0x23e057,_0x390d45){var _0x30439b={'raw':!![],'where':{'id':_0x23e057[_0x8ca5('0x45')]['id']}},_0x1e695a={};_0x1e695a[_0x8ca5('0x32')]=_[_0x8ca5('0x2f')](db[_0x8ca5('0x2b')][_0x8ca5('0x46')]);_0x1e695a[_0x8ca5('0x2e')]=_['keys'](_0x23e057[_0x8ca5('0x2e')]);_0x1e695a[_0x8ca5('0x30')]=_['intersection'](_0x1e695a[_0x8ca5('0x32')],_0x1e695a[_0x8ca5('0x2e')]);_0x30439b['attributes']=_[_0x8ca5('0x31')](_0x1e695a[_0x8ca5('0x32')],qs[_0x8ca5('0x34')](_0x23e057[_0x8ca5('0x2e')][_0x8ca5('0x34')]));_0x30439b['attributes']=_0x30439b[_0x8ca5('0x33')]['length']?_0x30439b[_0x8ca5('0x33')]:_0x1e695a[_0x8ca5('0x32')];if(_0x23e057['query'][_0x8ca5('0x40')]){_0x30439b[_0x8ca5('0x41')]=[{'all':!![]}];}_0x30439b=_[_0x8ca5('0x3d')]({},_0x30439b,_0x23e057['options']);return db[_0x8ca5('0x2b')][_0x8ca5('0x47')](_0x30439b)[_0x8ca5('0x27')](handleEntityNotFound(_0x390d45,null))[_0x8ca5('0x27')](respondWithResult(_0x390d45,null))[_0x8ca5('0x48')](handleError(_0x390d45,null));};exports['create']=function(_0x2b8d99,_0x4c81da){return db[_0x8ca5('0x2b')][_0x8ca5('0x49')](_0x2b8d99[_0x8ca5('0x4a')],{})['then'](respondWithResult(_0x4c81da,0xc9))['catch'](handleError(_0x4c81da,null));};exports[_0x8ca5('0x26')]=function(_0x3f8c7b,_0x1edb8c){if(_0x3f8c7b[_0x8ca5('0x4a')]['id']){delete _0x3f8c7b['body']['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x3f8c7b[_0x8ca5('0x45')]['id']}})[_0x8ca5('0x27')](handleEntityNotFound(_0x1edb8c,null))[_0x8ca5('0x27')](saveUpdates(_0x3f8c7b[_0x8ca5('0x4a')],null))[_0x8ca5('0x27')](respondWithResult(_0x1edb8c,null))['catch'](handleError(_0x1edb8c,null));};exports[_0x8ca5('0x4b')]=function(_0x4b34fd,_0x1a2db8){return db[_0x8ca5('0x2b')][_0x8ca5('0x47')]({'where':{'id':_0x4b34fd[_0x8ca5('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a2db8,null))[_0x8ca5('0x27')](removeEntity(_0x1a2db8,null))[_0x8ca5('0x48')](handleError(_0x1a2db8,null));};exports[_0x8ca5('0x4c')]=function(_0x32926d,_0x3cb8c4){return db[_0x8ca5('0x2b')]['describe']()[_0x8ca5('0x27')](respondWithResult(_0x3cb8c4,null))[_0x8ca5('0x48')](handleError(_0x3cb8c4,null));}; \ No newline at end of file +var _0xac19=['catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','update','then','name','send','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','SmsQueueReport','count','findAll','rows','params','keys','intersection','length','includeAll','options','find'];(function(_0x52164e,_0x10dfc1){var _0x5820c5=function(_0x478e7f){while(--_0x478e7f){_0x52164e['push'](_0x52164e['shift']());}};_0x5820c5(++_0x10dfc1);}(_0xac19,0x8a));var _0x9ac1=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0xac19[_0x2a67fe];return _0x57e726;};'use strict';var emlformat=require(_0x9ac1('0x0'));var rimraf=require(_0x9ac1('0x1'));var zipdir=require(_0x9ac1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ac1('0x3'));var moment=require(_0x9ac1('0x4'));var BPromise=require(_0x9ac1('0x5'));var Mustache=require(_0x9ac1('0x6'));var util=require('util');var path=require(_0x9ac1('0x7'));var sox=require('sox');var csv=require(_0x9ac1('0x8'));var ejs=require(_0x9ac1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ac1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ac1('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ac1('0xc'));var Papa=require(_0x9ac1('0xd'));var Redis=require('ioredis');var authService=require(_0x9ac1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9ac1('0xf'));var hardwareService=require(_0x9ac1('0x10'));var logger=require(_0x9ac1('0x11'))(_0x9ac1('0x12'));var utils=require(_0x9ac1('0x13'));var config=require(_0x9ac1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ac1('0x15'))['db'];function respondWithStatusCode(_0x5305c9,_0x79dc8){_0x79dc8=_0x79dc8||0xcc;return function(_0x5c1dc6){if(_0x5c1dc6){return _0x5305c9[_0x9ac1('0x16')](_0x79dc8);}return _0x5305c9[_0x9ac1('0x17')](_0x79dc8)[_0x9ac1('0x18')]();};}function respondWithResult(_0x1f808d,_0x427ee5){_0x427ee5=_0x427ee5||0xc8;return function(_0xb97d60){if(_0xb97d60){return _0x1f808d[_0x9ac1('0x17')](_0x427ee5)[_0x9ac1('0x19')](_0xb97d60);}};}function respondWithFilteredResult(_0x1162ea,_0x364d2b){return function(_0x59cd58){if(_0x59cd58){var _0x167577=typeof _0x364d2b[_0x9ac1('0x1a')]===_0x9ac1('0x1b')&&typeof _0x364d2b[_0x9ac1('0x1c')]===_0x9ac1('0x1b');var _0x34dfa3=_0x59cd58['count'];var _0x456b9f=_0x167577?0x0:_0x364d2b['offset'];var _0x1d77ae=_0x167577?_0x59cd58['count']:_0x364d2b[_0x9ac1('0x1a')]+_0x364d2b[_0x9ac1('0x1c')];var _0x330045;if(_0x1d77ae>=_0x34dfa3){_0x1d77ae=_0x34dfa3;_0x330045=0xc8;}else{_0x330045=0xce;}_0x1162ea[_0x9ac1('0x17')](_0x330045);return _0x1162ea[_0x9ac1('0x1d')]('Content-Range',_0x456b9f+'-'+_0x1d77ae+'/'+_0x34dfa3)['json'](_0x59cd58);}return null;};}function patchUpdates(_0x1dbb1a){return function(_0x23decd){try{jsonpatch[_0x9ac1('0x1e')](_0x23decd,_0x1dbb1a,!![]);}catch(_0x1e35ec){return BPromise['reject'](_0x1e35ec);}return _0x23decd[_0x9ac1('0x1f')]();};}function saveUpdates(_0x4cd3b8,_0x207c66){return function(_0x3f04ab){if(_0x3f04ab){return _0x3f04ab[_0x9ac1('0x20')](_0x4cd3b8)[_0x9ac1('0x21')](function(_0x3a8196){return _0x3a8196;});}return null;};}function removeEntity(_0x21141c,_0x46173a){return function(_0x2a3bf4){if(_0x2a3bf4){return _0x2a3bf4['destroy']()[_0x9ac1('0x21')](function(){_0x21141c[_0x9ac1('0x17')](0xcc)[_0x9ac1('0x18')]();});}};}function handleEntityNotFound(_0x5702b5,_0x4fd751){return function(_0x113175){if(!_0x113175){_0x5702b5[_0x9ac1('0x16')](0x194);}return _0x113175;};}function handleError(_0x3a276a,_0x490edb){_0x490edb=_0x490edb||0x1f4;return function(_0x386776){logger['error'](_0x386776['stack']);if(_0x386776[_0x9ac1('0x22')]){delete _0x386776[_0x9ac1('0x22')];}_0x3a276a[_0x9ac1('0x17')](_0x490edb)[_0x9ac1('0x23')](_0x386776);};}exports['index']=function(_0x1b917a,_0x1ef229){var _0x5e7007={},_0x56d251={},_0x19f0e8={'count':0x0,'rows':[]};var _0x27d2e8=_[_0x9ac1('0x24')](db['SmsQueueReport'][_0x9ac1('0x25')],function(_0x1dbed9){return{'name':_0x1dbed9[_0x9ac1('0x26')],'type':_0x1dbed9['type'][_0x9ac1('0x27')]};});_0x56d251[_0x9ac1('0x28')]=_[_0x9ac1('0x24')](_0x27d2e8,'name');_0x56d251[_0x9ac1('0x29')]=_['keys'](_0x1b917a[_0x9ac1('0x29')]);_0x56d251[_0x9ac1('0x2a')]=_['intersection'](_0x56d251['model'],_0x56d251[_0x9ac1('0x29')]);_0x5e7007[_0x9ac1('0x2b')]=_['intersection'](_0x56d251[_0x9ac1('0x28')],qs[_0x9ac1('0x2c')](_0x1b917a[_0x9ac1('0x29')][_0x9ac1('0x2c')]));_0x5e7007['attributes']=_0x5e7007[_0x9ac1('0x2b')]['length']?_0x5e7007[_0x9ac1('0x2b')]:_0x56d251[_0x9ac1('0x28')];if(!_0x1b917a['query'][_0x9ac1('0x2d')](_0x9ac1('0x2e'))){_0x5e7007[_0x9ac1('0x1c')]=qs['limit'](_0x1b917a['query'][_0x9ac1('0x1c')]);_0x5e7007['offset']=qs['offset'](_0x1b917a[_0x9ac1('0x29')][_0x9ac1('0x1a')]);}_0x5e7007['order']=qs['sort'](_0x1b917a[_0x9ac1('0x29')][_0x9ac1('0x2f')]);_0x5e7007[_0x9ac1('0x30')]=qs['filters'](_['pick'](_0x1b917a[_0x9ac1('0x29')],_0x56d251['filters']),_0x27d2e8);if(_0x1b917a['query'][_0x9ac1('0x31')]){_0x5e7007[_0x9ac1('0x30')]=_[_0x9ac1('0x32')](_0x5e7007[_0x9ac1('0x30')],{'$or':_[_0x9ac1('0x24')](_0x27d2e8,function(_0x648fe2){if(_0x648fe2[_0x9ac1('0x33')]!=='VIRTUAL'){var _0x38b960={};_0x38b960[_0x648fe2['name']]={'$like':'%'+_0x1b917a[_0x9ac1('0x29')][_0x9ac1('0x31')]+'%'};return _0x38b960;}})});}_0x5e7007=_[_0x9ac1('0x32')]({},_0x5e7007,_0x1b917a['options']);var _0x28d03d={'where':_0x5e7007[_0x9ac1('0x30')]};return db[_0x9ac1('0x34')][_0x9ac1('0x35')](_0x28d03d)[_0x9ac1('0x21')](function(_0x1bfa95){_0x19f0e8[_0x9ac1('0x35')]=_0x1bfa95;if(_0x1b917a[_0x9ac1('0x29')]['includeAll']){_0x5e7007['include']=[{'all':!![]}];}return db[_0x9ac1('0x34')][_0x9ac1('0x36')](_0x5e7007);})[_0x9ac1('0x21')](function(_0x3495b3){_0x19f0e8[_0x9ac1('0x37')]=_0x3495b3;return _0x19f0e8;})['then'](respondWithFilteredResult(_0x1ef229,_0x5e7007))['catch'](handleError(_0x1ef229,null));};exports['show']=function(_0x119687,_0xfadb0c){var _0x35d826={'raw':!![],'where':{'id':_0x119687[_0x9ac1('0x38')]['id']}},_0x56ace={};_0x56ace['model']=_[_0x9ac1('0x39')](db['SmsQueueReport']['rawAttributes']);_0x56ace[_0x9ac1('0x29')]=_['keys'](_0x119687[_0x9ac1('0x29')]);_0x56ace[_0x9ac1('0x2a')]=_[_0x9ac1('0x3a')](_0x56ace['model'],_0x56ace['query']);_0x35d826['attributes']=_['intersection'](_0x56ace[_0x9ac1('0x28')],qs[_0x9ac1('0x2c')](_0x119687['query'][_0x9ac1('0x2c')]));_0x35d826['attributes']=_0x35d826[_0x9ac1('0x2b')][_0x9ac1('0x3b')]?_0x35d826[_0x9ac1('0x2b')]:_0x56ace[_0x9ac1('0x28')];if(_0x119687[_0x9ac1('0x29')][_0x9ac1('0x3c')]){_0x35d826['include']=[{'all':!![]}];}_0x35d826=_[_0x9ac1('0x32')]({},_0x35d826,_0x119687[_0x9ac1('0x3d')]);return db[_0x9ac1('0x34')][_0x9ac1('0x3e')](_0x35d826)[_0x9ac1('0x21')](handleEntityNotFound(_0xfadb0c,null))[_0x9ac1('0x21')](respondWithResult(_0xfadb0c,null))[_0x9ac1('0x3f')](handleError(_0xfadb0c,null));};exports[_0x9ac1('0x40')]=function(_0x14c38c,_0x5003f4){return db[_0x9ac1('0x34')]['create'](_0x14c38c[_0x9ac1('0x41')],{})[_0x9ac1('0x21')](respondWithResult(_0x5003f4,0xc9))['catch'](handleError(_0x5003f4,null));};exports['update']=function(_0x132cff,_0x4e655b){if(_0x132cff[_0x9ac1('0x41')]['id']){delete _0x132cff[_0x9ac1('0x41')]['id'];}return db[_0x9ac1('0x34')]['find']({'where':{'id':_0x132cff['params']['id']}})[_0x9ac1('0x21')](handleEntityNotFound(_0x4e655b,null))[_0x9ac1('0x21')](saveUpdates(_0x132cff['body'],null))[_0x9ac1('0x21')](respondWithResult(_0x4e655b,null))[_0x9ac1('0x3f')](handleError(_0x4e655b,null));};exports['destroy']=function(_0x1dcf42,_0x3cd9db){return db[_0x9ac1('0x34')][_0x9ac1('0x3e')]({'where':{'id':_0x1dcf42[_0x9ac1('0x38')]['id']}})['then'](handleEntityNotFound(_0x3cd9db,null))[_0x9ac1('0x21')](removeEntity(_0x3cd9db,null))[_0x9ac1('0x3f')](handleError(_0x3cd9db,null));};exports[_0x9ac1('0x42')]=function(_0x2b2367,_0x19598f){return db[_0x9ac1('0x34')][_0x9ac1('0x42')]()['then'](respondWithResult(_0x19598f,null))[_0x9ac1('0x3f')](handleError(_0x19598f,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 7cc6917..46da780 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0xe6729b,_0x2f2954){var _0x1fa263=function(_0x2ae741){while(--_0x2ae741){_0xe6729b['push'](_0xe6729b['shift']());}};_0x1fa263(++_0x2f2954);}(_0xb7e7,0x121));var _0x7b7e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xb7e7[_0x164eca];return _0x2ce562;};'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_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x5e7467,_0x33457e){var _0x2e3752=function(_0x3de01e){while(--_0x3de01e){_0x5e7467['push'](_0x5e7467['shift']());}};_0x2e3752(++_0x33457e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0xcb91[_0x23be51];return _0x47a26d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'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 da7a6f0..df7f594 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 _0x65a5=['UpdateSmsQueueReport','update','body','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueueReport,\x20%s,\x20%s','message','info','catch','SmsQueueReport','create','options','raw','CreateSmsQueueReport'];(function(_0x304292,_0xcb4fb6){var _0x1b5918=function(_0x5a4c4d){while(--_0x5a4c4d){_0x304292['push'](_0x304292['shift']());}};_0x1b5918(++_0xcb4fb6);}(_0x65a5,0x13b));var _0x565a=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0x65a5[_0x5e8c32];return _0x595f7b;};'use strict';var _=require(_0x565a('0x0'));var util=require(_0x565a('0x1'));var moment=require(_0x565a('0x2'));var BPromise=require('bluebird');var rs=require(_0x565a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x565a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x565a('0x5'))('rpc');var config=require(_0x565a('0x6'));var jayson=require(_0x565a('0x7'));var client=jayson[_0x565a('0x8')][_0x565a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42fad1,_0x4ddae8,_0x4bd13e){return new BPromise(function(_0x3558af,_0x482dd2){return client[_0x565a('0xa')](_0x42fad1,_0x4bd13e)[_0x565a('0xb')](function(_0x50359c){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x4ddae8,_0x565a('0xc'));logger[_0x565a('0xd')](_0x565a('0xe'),_0x4ddae8,_0x565a('0xc'),JSON[_0x565a('0xf')](_0x50359c));if(_0x50359c[_0x565a('0x10')]){if(_0x50359c[_0x565a('0x10')]['code']===0x1f4){logger['error'](_0x565a('0x11'),_0x4ddae8,_0x50359c[_0x565a('0x10')][_0x565a('0x12')]);return _0x482dd2(_0x50359c['error']['message']);}logger[_0x565a('0x10')](_0x565a('0x11'),_0x4ddae8,_0x50359c[_0x565a('0x10')][_0x565a('0x12')]);return _0x3558af(_0x50359c[_0x565a('0x10')]['message']);}else{logger[_0x565a('0x13')](_0x565a('0x11'),_0x4ddae8,_0x565a('0xc'));_0x3558af(_0x50359c['result'][_0x565a('0x12')]);}})[_0x565a('0x14')](function(_0x1f795e){logger[_0x565a('0x10')](_0x565a('0x11'),_0x4ddae8,_0x1f795e);_0x482dd2(_0x1f795e);});});}exports['CreateSmsQueueReport']=function(_0x200c86){var _0x47f887=this;return new Promise(function(_0xd1ab33,_0x4afcc9){return db[_0x565a('0x15')][_0x565a('0x16')](_0x200c86['body'],{'raw':_0x200c86[_0x565a('0x17')]?_0x200c86[_0x565a('0x17')][_0x565a('0x18')]===undefined?!![]:![]:!![]})[_0x565a('0xb')](function(_0x1259b2){logger[_0x565a('0x13')](_0x565a('0x19'),_0x200c86);logger[_0x565a('0xd')]('CreateSmsQueueReport',_0x200c86,JSON[_0x565a('0xf')](_0x1259b2));_0xd1ab33(_0x1259b2);})[_0x565a('0x14')](function(_0x323c54){logger[_0x565a('0x10')]('CreateSmsQueueReport',_0x323c54[_0x565a('0x12')],_0x200c86);_0x4afcc9(_0x47f887[_0x565a('0x10')](0x1f4,_0x323c54['message']));});});};exports[_0x565a('0x1a')]=function(_0x4a1e02){var _0x12d57e=this;return new Promise(function(_0x2410f1,_0x14a529){return db[_0x565a('0x15')][_0x565a('0x1b')](_0x4a1e02[_0x565a('0x1c')],{'raw':_0x4a1e02[_0x565a('0x17')]?_0x4a1e02[_0x565a('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a1e02[_0x565a('0x17')]?_0x4a1e02['options']['where']||null:null,'attributes':_0x4a1e02[_0x565a('0x17')]?_0x4a1e02[_0x565a('0x17')][_0x565a('0x1d')]||null:null,'limit':_0x4a1e02[_0x565a('0x17')]?_0x4a1e02[_0x565a('0x17')][_0x565a('0x1e')]||null:null})[_0x565a('0xb')](function(_0x3b4bca){logger[_0x565a('0x13')](_0x565a('0x1a'),_0x4a1e02);logger[_0x565a('0xd')]('UpdateSmsQueueReport',_0x4a1e02,JSON[_0x565a('0xf')](_0x3b4bca));_0x2410f1(_0x3b4bca);})[_0x565a('0x14')](function(_0x19a1cb){logger[_0x565a('0x10')](_0x565a('0x1a'),_0x19a1cb[_0x565a('0x12')],_0x4a1e02);_0x14a529(_0x12d57e[_0x565a('0x10')](0x1f4,_0x19a1cb[_0x565a('0x12')]));});});}; \ No newline at end of file +var _0x7c6f=['request','info','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','CreateSmsQueueReport','create','body','options','raw','debug','catch','where','attributes','then','UpdateSmsQueueReport','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x1d4cac,_0x2145a5){var _0x26ecdb=function(_0x3b32b3){while(--_0x3b32b3){_0x1d4cac['push'](_0x1d4cac['shift']());}};_0x26ecdb(++_0x2145a5);}(_0x7c6f,0x1b5));var _0xf7c6=function(_0x3b837c,_0x1bd1e7){_0x3b837c=_0x3b837c-0x0;var _0x3a0fb8=_0x7c6f[_0x3b837c];return _0x3a0fb8;};'use strict';var _=require(_0xf7c6('0x0'));var util=require(_0xf7c6('0x1'));var moment=require(_0xf7c6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7c6('0x3'));var db=require(_0xf7c6('0x4'))['db'];var utils=require(_0xf7c6('0x5'));var logger=require(_0xf7c6('0x6'))(_0xf7c6('0x7'));var config=require('../../config/environment');var jayson=require(_0xf7c6('0x8'));var client=jayson[_0xf7c6('0x9')][_0xf7c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ba6e0,_0x5cc8a6,_0x11da64){return new BPromise(function(_0x598fc6,_0x3c7c30){return client[_0xf7c6('0xb')](_0x2ba6e0,_0x11da64)['then'](function(_0x431191){logger[_0xf7c6('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x5cc8a6,'request\x20sent');logger['debug'](_0xf7c6('0xd'),_0x5cc8a6,_0xf7c6('0xe'),JSON[_0xf7c6('0xf')](_0x431191));if(_0x431191[_0xf7c6('0x10')]){if(_0x431191['error'][_0xf7c6('0x11')]===0x1f4){logger[_0xf7c6('0x10')](_0xf7c6('0x12'),_0x5cc8a6,_0x431191[_0xf7c6('0x10')]['message']);return _0x3c7c30(_0x431191[_0xf7c6('0x10')][_0xf7c6('0x13')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x5cc8a6,_0x431191[_0xf7c6('0x10')][_0xf7c6('0x13')]);return _0x598fc6(_0x431191['error'][_0xf7c6('0x13')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x5cc8a6,_0xf7c6('0xe'));_0x598fc6(_0x431191[_0xf7c6('0x14')][_0xf7c6('0x13')]);}})['catch'](function(_0x2ad20c){logger[_0xf7c6('0x10')](_0xf7c6('0x12'),_0x5cc8a6,_0x2ad20c);_0x3c7c30(_0x2ad20c);});});}exports[_0xf7c6('0x15')]=function(_0x234647){var _0x34ba32=this;return new Promise(function(_0x4a8f84,_0x38b425){return db['SmsQueueReport'][_0xf7c6('0x16')](_0x234647[_0xf7c6('0x17')],{'raw':_0x234647[_0xf7c6('0x18')]?_0x234647[_0xf7c6('0x18')][_0xf7c6('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x101797){logger[_0xf7c6('0xc')](_0xf7c6('0x15'),_0x234647);logger[_0xf7c6('0x1a')](_0xf7c6('0x15'),_0x234647,JSON[_0xf7c6('0xf')](_0x101797));_0x4a8f84(_0x101797);})[_0xf7c6('0x1b')](function(_0x1e8033){logger[_0xf7c6('0x10')](_0xf7c6('0x15'),_0x1e8033['message'],_0x234647);_0x38b425(_0x34ba32[_0xf7c6('0x10')](0x1f4,_0x1e8033['message']));});});};exports['UpdateSmsQueueReport']=function(_0x5621c7){var _0x59676e=this;return new Promise(function(_0x530487,_0x56489f){return db['SmsQueueReport']['update'](_0x5621c7[_0xf7c6('0x17')],{'raw':_0x5621c7[_0xf7c6('0x18')]?_0x5621c7[_0xf7c6('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5621c7[_0xf7c6('0x18')]?_0x5621c7[_0xf7c6('0x18')][_0xf7c6('0x1c')]||null:null,'attributes':_0x5621c7[_0xf7c6('0x18')]?_0x5621c7[_0xf7c6('0x18')][_0xf7c6('0x1d')]||null:null,'limit':_0x5621c7['options']?_0x5621c7[_0xf7c6('0x18')]['limit']||null:null})[_0xf7c6('0x1e')](function(_0x1ec70e){logger[_0xf7c6('0xc')](_0xf7c6('0x1f'),_0x5621c7);logger['debug'](_0xf7c6('0x1f'),_0x5621c7,JSON[_0xf7c6('0xf')](_0x1ec70e));_0x530487(_0x1ec70e);})['catch'](function(_0x2c4916){logger[_0xf7c6('0x10')]('UpdateSmsQueueReport',_0x2c4916['message'],_0x5621c7);_0x56489f(_0x59676e['error'](0x1f4,_0x2c4916['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 7352d94..a5e5ab2 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 _0x25fa=['isAuthenticated','index','get','/describe','describe','/:id','post','put','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./smsTransferReport.controller'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x25fa,0x109));var _0xa25f=function(_0x2d69e0,_0x18394b){_0x2d69e0=_0x2d69e0-0x0;var _0x32fe16=_0x25fa[_0x2d69e0];return _0x32fe16;};'use strict';var multer=require(_0xa25f('0x0'));var util=require('util');var path=require(_0xa25f('0x1'));var timeout=require(_0xa25f('0x2'));var express=require('express');var router=express[_0xa25f('0x3')]();var fs_extra=require(_0xa25f('0x4'));var auth=require(_0xa25f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa25f('0x6'));router['get']('/',auth[_0xa25f('0x7')](),controller[_0xa25f('0x8')]);router[_0xa25f('0x9')](_0xa25f('0xa'),auth[_0xa25f('0x7')](),controller[_0xa25f('0xb')]);router[_0xa25f('0x9')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller['show']);router[_0xa25f('0xd')]('/',auth[_0xa25f('0x7')](),controller['create']);router[_0xa25f('0xe')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller[_0xa25f('0xf')]);router['delete'](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller['destroy']);module[_0xa25f('0x10')]=router; \ No newline at end of file +var _0x7118=['post','update','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x2ea753,_0x3e9487){var _0x1d3676=function(_0x23f53d){while(--_0x23f53d){_0x2ea753['push'](_0x2ea753['shift']());}};_0x1d3676(++_0x3e9487);}(_0x7118,0x159));var _0x8711=function(_0x3816d4,_0x118648){_0x3816d4=_0x3816d4-0x0;var _0x154e01=_0x7118[_0x3816d4];return _0x154e01;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8711('0x0'));var timeout=require(_0x8711('0x1'));var express=require('express');var router=express[_0x8711('0x2')]();var fs_extra=require(_0x8711('0x3'));var auth=require(_0x8711('0x4'));var interaction=require(_0x8711('0x5'));var config=require(_0x8711('0x6'));var controller=require(_0x8711('0x7'));router[_0x8711('0x8')]('/',auth['isAuthenticated'](),controller[_0x8711('0x9')]);router[_0x8711('0x8')](_0x8711('0xa'),auth[_0x8711('0xb')](),controller[_0x8711('0xc')]);router[_0x8711('0x8')](_0x8711('0xd'),auth[_0x8711('0xb')](),controller[_0x8711('0xe')]);router[_0x8711('0xf')]('/',auth[_0x8711('0xb')](),controller['create']);router['put'](_0x8711('0xd'),auth[_0x8711('0xb')](),controller[_0x8711('0x10')]);router['delete']('/:id',auth[_0x8711('0xb')](),controller[_0x8711('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 fc5b354..746ce4b 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x21b762,_0xc8ef11){var _0x2ea6d4=function(_0x22bd14){while(--_0x22bd14){_0x21b762['push'](_0x21b762['shift']());}};_0x2ea6d4(++_0xc8ef11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x2ef542,_0x194c8e){var _0x2c242e=function(_0xab89d3){while(--_0xab89d3){_0x2ef542['push'](_0x2ef542['shift']());}};_0x2c242e(++_0x194c8e);}(_0x70e0,0x17b));var _0x070e=function(_0x229c1c,_0x64e084){_0x229c1c=_0x229c1c-0x0;var _0x10f2cc=_0x70e0[_0x229c1c];return _0x10f2cc;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 552217e..a998c82 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 _0xa2ce=['fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','options','include','findAll','rows','show','params','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','SmsTransferReport','rawAttributes','key','model','query','keys','filters','intersection'];(function(_0x10f728,_0x88463a){var _0x4c78d3=function(_0x50dda3){while(--_0x50dda3){_0x10f728['push'](_0x10f728['shift']());}};_0x4c78d3(++_0x88463a);}(_0xa2ce,0xa2));var _0xea2c=function(_0x273b97,_0x37c97b){_0x273b97=_0x273b97-0x0;var _0x1708ee=_0xa2ce[_0x273b97];return _0x1708ee;};'use strict';var emlformat=require(_0xea2c('0x0'));var rimraf=require(_0xea2c('0x1'));var zipdir=require(_0xea2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea2c('0x3'));var moment=require(_0xea2c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xea2c('0x5'));var path=require(_0xea2c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xea2c('0x7'));var fs=require('fs');var fs_extra=require(_0xea2c('0x8'));var _=require(_0xea2c('0x9'));var squel=require(_0xea2c('0xa'));var crypto=require(_0xea2c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xea2c('0xc'));var querystring=require(_0xea2c('0xd'));var Papa=require(_0xea2c('0xe'));var Redis=require(_0xea2c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xea2c('0x10'));var as=require(_0xea2c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea2c('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xea2c('0x13'));var db=require(_0xea2c('0x14'))['db'];function respondWithStatusCode(_0x2236c3,_0x33d44b){_0x33d44b=_0x33d44b||0xcc;return function(_0x3186af){if(_0x3186af){return _0x2236c3[_0xea2c('0x15')](_0x33d44b);}return _0x2236c3[_0xea2c('0x16')](_0x33d44b)[_0xea2c('0x17')]();};}function respondWithResult(_0x5d4bde,_0x47255b){_0x47255b=_0x47255b||0xc8;return function(_0x546b36){if(_0x546b36){return _0x5d4bde['status'](_0x47255b)['json'](_0x546b36);}};}function respondWithFilteredResult(_0x27b890,_0x1b97b0){return function(_0x3bbb1c){if(_0x3bbb1c){var _0x48ae86=typeof _0x1b97b0['offset']===_0xea2c('0x18')&&typeof _0x1b97b0['limit']===_0xea2c('0x18');var _0x4fb0e1=_0x3bbb1c['count'];var _0x197374=_0x48ae86?0x0:_0x1b97b0[_0xea2c('0x19')];var _0x200b39=_0x48ae86?_0x3bbb1c[_0xea2c('0x1a')]:_0x1b97b0[_0xea2c('0x19')]+_0x1b97b0[_0xea2c('0x1b')];var _0x33d3b3;if(_0x200b39>=_0x4fb0e1){_0x200b39=_0x4fb0e1;_0x33d3b3=0xc8;}else{_0x33d3b3=0xce;}_0x27b890[_0xea2c('0x16')](_0x33d3b3);return _0x27b890['set'](_0xea2c('0x1c'),_0x197374+'-'+_0x200b39+'/'+_0x4fb0e1)[_0xea2c('0x1d')](_0x3bbb1c);}return null;};}function patchUpdates(_0x19d2e6){return function(_0x48f3dd){try{jsonpatch['apply'](_0x48f3dd,_0x19d2e6,!![]);}catch(_0x629a92){return BPromise[_0xea2c('0x1e')](_0x629a92);}return _0x48f3dd[_0xea2c('0x1f')]();};}function saveUpdates(_0xc6ed95,_0x2e01e2){return function(_0x104f9a){if(_0x104f9a){return _0x104f9a[_0xea2c('0x20')](_0xc6ed95)[_0xea2c('0x21')](function(_0x5a25b8){return _0x5a25b8;});}return null;};}function removeEntity(_0x313648,_0x6a0040){return function(_0x7bda9b){if(_0x7bda9b){return _0x7bda9b[_0xea2c('0x22')]()[_0xea2c('0x21')](function(){_0x313648[_0xea2c('0x16')](0xcc)[_0xea2c('0x17')]();});}};}function handleEntityNotFound(_0x17b376,_0x14ad8e){return function(_0x64f0e6){if(!_0x64f0e6){_0x17b376['sendStatus'](0x194);}return _0x64f0e6;};}function handleError(_0x107a49,_0x2c49af){_0x2c49af=_0x2c49af||0x1f4;return function(_0x46e446){logger[_0xea2c('0x23')](_0x46e446[_0xea2c('0x24')]);if(_0x46e446[_0xea2c('0x25')]){delete _0x46e446['name'];}_0x107a49[_0xea2c('0x16')](_0x2c49af)['send'](_0x46e446);};}exports[_0xea2c('0x26')]=function(_0x24dffa,_0x34d616){var _0x18b724={},_0x6a9179={},_0x3170fe={'count':0x0,'rows':[]};var _0x3523ad=_[_0xea2c('0x27')](db[_0xea2c('0x28')][_0xea2c('0x29')],function(_0x25531e){return{'name':_0x25531e['fieldName'],'type':_0x25531e['type'][_0xea2c('0x2a')]};});_0x6a9179[_0xea2c('0x2b')]=_[_0xea2c('0x27')](_0x3523ad,_0xea2c('0x25'));_0x6a9179[_0xea2c('0x2c')]=_[_0xea2c('0x2d')](_0x24dffa[_0xea2c('0x2c')]);_0x6a9179[_0xea2c('0x2e')]=_[_0xea2c('0x2f')](_0x6a9179[_0xea2c('0x2b')],_0x6a9179['query']);_0x18b724['attributes']=_['intersection'](_0x6a9179[_0xea2c('0x2b')],qs[_0xea2c('0x30')](_0x24dffa['query'][_0xea2c('0x30')]));_0x18b724[_0xea2c('0x31')]=_0x18b724['attributes'][_0xea2c('0x32')]?_0x18b724['attributes']:_0x6a9179[_0xea2c('0x2b')];if(!_0x24dffa[_0xea2c('0x2c')][_0xea2c('0x33')](_0xea2c('0x34'))){_0x18b724['limit']=qs[_0xea2c('0x1b')](_0x24dffa[_0xea2c('0x2c')][_0xea2c('0x1b')]);_0x18b724[_0xea2c('0x19')]=qs[_0xea2c('0x19')](_0x24dffa[_0xea2c('0x2c')][_0xea2c('0x19')]);}_0x18b724['order']=qs[_0xea2c('0x35')](_0x24dffa['query'][_0xea2c('0x35')]);_0x18b724['where']=qs[_0xea2c('0x2e')](_[_0xea2c('0x36')](_0x24dffa[_0xea2c('0x2c')],_0x6a9179[_0xea2c('0x2e')]),_0x3523ad);if(_0x24dffa[_0xea2c('0x2c')][_0xea2c('0x37')]){_0x18b724['where']=_[_0xea2c('0x38')](_0x18b724[_0xea2c('0x39')],{'$or':_[_0xea2c('0x27')](_0x3523ad,function(_0xebd51a){if(_0xebd51a[_0xea2c('0x3a')]!=='VIRTUAL'){var _0x13c156={};_0x13c156[_0xebd51a[_0xea2c('0x25')]]={'$like':'%'+_0x24dffa[_0xea2c('0x2c')]['filter']+'%'};return _0x13c156;}})});}_0x18b724=_[_0xea2c('0x38')]({},_0x18b724,_0x24dffa[_0xea2c('0x3b')]);var _0x20f440={'where':_0x18b724['where']};return db['SmsTransferReport'][_0xea2c('0x1a')](_0x20f440)[_0xea2c('0x21')](function(_0x1594e0){_0x3170fe[_0xea2c('0x1a')]=_0x1594e0;if(_0x24dffa['query']['includeAll']){_0x18b724[_0xea2c('0x3c')]=[{'all':!![]}];}return db[_0xea2c('0x28')][_0xea2c('0x3d')](_0x18b724);})[_0xea2c('0x21')](function(_0x3c74e6){_0x3170fe[_0xea2c('0x3e')]=_0x3c74e6;return _0x3170fe;})[_0xea2c('0x21')](respondWithFilteredResult(_0x34d616,_0x18b724))['catch'](handleError(_0x34d616,null));};exports[_0xea2c('0x3f')]=function(_0x57b6d8,_0x264c2d){var _0x4f0b69={'raw':!![],'where':{'id':_0x57b6d8[_0xea2c('0x40')]['id']}},_0x24f693={};_0x24f693[_0xea2c('0x2b')]=_[_0xea2c('0x2d')](db[_0xea2c('0x28')][_0xea2c('0x29')]);_0x24f693[_0xea2c('0x2c')]=_[_0xea2c('0x2d')](_0x57b6d8[_0xea2c('0x2c')]);_0x24f693[_0xea2c('0x2e')]=_[_0xea2c('0x2f')](_0x24f693[_0xea2c('0x2b')],_0x24f693['query']);_0x4f0b69[_0xea2c('0x31')]=_[_0xea2c('0x2f')](_0x24f693[_0xea2c('0x2b')],qs[_0xea2c('0x30')](_0x57b6d8['query'][_0xea2c('0x30')]));_0x4f0b69[_0xea2c('0x31')]=_0x4f0b69[_0xea2c('0x31')]['length']?_0x4f0b69[_0xea2c('0x31')]:_0x24f693[_0xea2c('0x2b')];if(_0x57b6d8['query']['includeAll']){_0x4f0b69['include']=[{'all':!![]}];}_0x4f0b69=_['merge']({},_0x4f0b69,_0x57b6d8[_0xea2c('0x3b')]);return db[_0xea2c('0x28')]['find'](_0x4f0b69)[_0xea2c('0x21')](handleEntityNotFound(_0x264c2d,null))['then'](respondWithResult(_0x264c2d,null))[_0xea2c('0x41')](handleError(_0x264c2d,null));};exports['create']=function(_0xbba405,_0x117ffb){return db[_0xea2c('0x28')][_0xea2c('0x42')](_0xbba405[_0xea2c('0x43')],{})[_0xea2c('0x21')](respondWithResult(_0x117ffb,0xc9))[_0xea2c('0x41')](handleError(_0x117ffb,null));};exports[_0xea2c('0x20')]=function(_0x3e092b,_0x3dea29){if(_0x3e092b[_0xea2c('0x43')]['id']){delete _0x3e092b[_0xea2c('0x43')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x3e092b[_0xea2c('0x40')]['id']}})[_0xea2c('0x21')](handleEntityNotFound(_0x3dea29,null))['then'](saveUpdates(_0x3e092b[_0xea2c('0x43')],null))['then'](respondWithResult(_0x3dea29,null))[_0xea2c('0x41')](handleError(_0x3dea29,null));};exports['destroy']=function(_0x542915,_0x4e7fe4){return db[_0xea2c('0x28')][_0xea2c('0x44')]({'where':{'id':_0x542915[_0xea2c('0x40')]['id']}})['then'](handleEntityNotFound(_0x4e7fe4,null))[_0xea2c('0x21')](removeEntity(_0x4e7fe4,null))['catch'](handleError(_0x4e7fe4,null));};exports[_0xea2c('0x45')]=function(_0x4603de,_0x2433ef){return db[_0xea2c('0x28')][_0xea2c('0x45')]()[_0xea2c('0x21')](respondWithResult(_0x2433ef,null))[_0xea2c('0x41')](handleError(_0x2433ef,null));}; \ No newline at end of file +var _0x0112=['status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','map','SmsTransferReport','rawAttributes','fieldName','type','query','keys','filters','model','fields','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','catch','params','intersection','find','create','body','describe','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','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4e536b,_0x4719dc){var _0x15d06e=function(_0x578b61){while(--_0x578b61){_0x4e536b['push'](_0x4e536b['shift']());}};_0x15d06e(++_0x4719dc);}(_0x0112,0x1e4));var _0x2011=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x0112[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0x2011('0x0'));var rimraf=require(_0x2011('0x1'));var zipdir=require(_0x2011('0x2'));var jsonpatch=require(_0x2011('0x3'));var rp=require(_0x2011('0x4'));var moment=require(_0x2011('0x5'));var BPromise=require(_0x2011('0x6'));var Mustache=require(_0x2011('0x7'));var util=require(_0x2011('0x8'));var path=require(_0x2011('0x9'));var sox=require(_0x2011('0xa'));var csv=require(_0x2011('0xb'));var ejs=require(_0x2011('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2011('0xd'));var squel=require(_0x2011('0xe'));var crypto=require(_0x2011('0xf'));var jsforce=require(_0x2011('0x10'));var deskjs=require(_0x2011('0x11'));var toCsv=require(_0x2011('0xb'));var querystring=require('querystring');var Papa=require(_0x2011('0x12'));var Redis=require(_0x2011('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2011('0x14'));var hardwareService=require(_0x2011('0x15'));var logger=require(_0x2011('0x16'))(_0x2011('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2011('0x18'));var db=require(_0x2011('0x19'))['db'];function respondWithStatusCode(_0x2ce445,_0x325cac){_0x325cac=_0x325cac||0xcc;return function(_0x3e1a35){if(_0x3e1a35){return _0x2ce445[_0x2011('0x1a')](_0x325cac);}return _0x2ce445[_0x2011('0x1b')](_0x325cac)['end']();};}function respondWithResult(_0x369a60,_0x3c27f5){_0x3c27f5=_0x3c27f5||0xc8;return function(_0x49c8fb){if(_0x49c8fb){return _0x369a60[_0x2011('0x1b')](_0x3c27f5)[_0x2011('0x1c')](_0x49c8fb);}};}function respondWithFilteredResult(_0x7b44d3,_0x181901){return function(_0x11a4f8){if(_0x11a4f8){var _0x234503=typeof _0x181901['offset']===_0x2011('0x1d')&&typeof _0x181901[_0x2011('0x1e')]===_0x2011('0x1d');var _0x52cf6b=_0x11a4f8[_0x2011('0x1f')];var _0x7ecad1=_0x234503?0x0:_0x181901['offset'];var _0x303e7a=_0x234503?_0x11a4f8[_0x2011('0x1f')]:_0x181901[_0x2011('0x20')]+_0x181901[_0x2011('0x1e')];var _0x461fa4;if(_0x303e7a>=_0x52cf6b){_0x303e7a=_0x52cf6b;_0x461fa4=0xc8;}else{_0x461fa4=0xce;}_0x7b44d3[_0x2011('0x1b')](_0x461fa4);return _0x7b44d3['set'](_0x2011('0x21'),_0x7ecad1+'-'+_0x303e7a+'/'+_0x52cf6b)[_0x2011('0x1c')](_0x11a4f8);}return null;};}function patchUpdates(_0x25123c){return function(_0x372eb3){try{jsonpatch[_0x2011('0x22')](_0x372eb3,_0x25123c,!![]);}catch(_0x294dee){return BPromise[_0x2011('0x23')](_0x294dee);}return _0x372eb3[_0x2011('0x24')]();};}function saveUpdates(_0x393033,_0x56d191){return function(_0x3ba077){if(_0x3ba077){return _0x3ba077[_0x2011('0x25')](_0x393033)[_0x2011('0x26')](function(_0x5a3056){return _0x5a3056;});}return null;};}function removeEntity(_0x5ae801,_0x121b99){return function(_0x58faf9){if(_0x58faf9){return _0x58faf9[_0x2011('0x27')]()[_0x2011('0x26')](function(){_0x5ae801[_0x2011('0x1b')](0xcc)[_0x2011('0x28')]();});}};}function handleEntityNotFound(_0x281157,_0x3435a0){return function(_0x3c3843){if(!_0x3c3843){_0x281157['sendStatus'](0x194);}return _0x3c3843;};}function handleError(_0x252b3d,_0x40819b){_0x40819b=_0x40819b||0x1f4;return function(_0x554563){logger[_0x2011('0x29')](_0x554563[_0x2011('0x2a')]);if(_0x554563['name']){delete _0x554563['name'];}_0x252b3d[_0x2011('0x1b')](_0x40819b)[_0x2011('0x2b')](_0x554563);};}exports['index']=function(_0x5a6d47,_0x474560){var _0x47a9ce={},_0x4c3872={},_0x12b128={'count':0x0,'rows':[]};var _0x5eb693=_[_0x2011('0x2c')](db[_0x2011('0x2d')][_0x2011('0x2e')],function(_0x3b1086){return{'name':_0x3b1086[_0x2011('0x2f')],'type':_0x3b1086[_0x2011('0x30')]['key']};});_0x4c3872['model']=_[_0x2011('0x2c')](_0x5eb693,'name');_0x4c3872[_0x2011('0x31')]=_[_0x2011('0x32')](_0x5a6d47[_0x2011('0x31')]);_0x4c3872[_0x2011('0x33')]=_['intersection'](_0x4c3872[_0x2011('0x34')],_0x4c3872['query']);_0x47a9ce['attributes']=_['intersection'](_0x4c3872['model'],qs[_0x2011('0x35')](_0x5a6d47[_0x2011('0x31')][_0x2011('0x35')]));_0x47a9ce['attributes']=_0x47a9ce[_0x2011('0x36')][_0x2011('0x37')]?_0x47a9ce[_0x2011('0x36')]:_0x4c3872[_0x2011('0x34')];if(!_0x5a6d47['query']['hasOwnProperty'](_0x2011('0x38'))){_0x47a9ce[_0x2011('0x1e')]=qs[_0x2011('0x1e')](_0x5a6d47[_0x2011('0x31')][_0x2011('0x1e')]);_0x47a9ce['offset']=qs[_0x2011('0x20')](_0x5a6d47[_0x2011('0x31')][_0x2011('0x20')]);}_0x47a9ce[_0x2011('0x39')]=qs['sort'](_0x5a6d47[_0x2011('0x31')][_0x2011('0x3a')]);_0x47a9ce[_0x2011('0x3b')]=qs[_0x2011('0x33')](_['pick'](_0x5a6d47[_0x2011('0x31')],_0x4c3872[_0x2011('0x33')]),_0x5eb693);if(_0x5a6d47[_0x2011('0x31')][_0x2011('0x3c')]){_0x47a9ce[_0x2011('0x3b')]=_['merge'](_0x47a9ce[_0x2011('0x3b')],{'$or':_[_0x2011('0x2c')](_0x5eb693,function(_0xb5042b){if(_0xb5042b[_0x2011('0x30')]!==_0x2011('0x3d')){var _0x117048={};_0x117048[_0xb5042b['name']]={'$like':'%'+_0x5a6d47[_0x2011('0x31')][_0x2011('0x3c')]+'%'};return _0x117048;}})});}_0x47a9ce=_[_0x2011('0x3e')]({},_0x47a9ce,_0x5a6d47[_0x2011('0x3f')]);var _0x23894e={'where':_0x47a9ce['where']};return db[_0x2011('0x2d')][_0x2011('0x1f')](_0x23894e)[_0x2011('0x26')](function(_0x1ab544){_0x12b128['count']=_0x1ab544;if(_0x5a6d47[_0x2011('0x31')][_0x2011('0x40')]){_0x47a9ce[_0x2011('0x41')]=[{'all':!![]}];}return db[_0x2011('0x2d')]['findAll'](_0x47a9ce);})[_0x2011('0x26')](function(_0x370667){_0x12b128['rows']=_0x370667;return _0x12b128;})['then'](respondWithFilteredResult(_0x474560,_0x47a9ce))[_0x2011('0x42')](handleError(_0x474560,null));};exports['show']=function(_0x415516,_0x24029d){var _0x4a90d5={'raw':!![],'where':{'id':_0x415516[_0x2011('0x43')]['id']}},_0x52d3b5={};_0x52d3b5[_0x2011('0x34')]=_[_0x2011('0x32')](db[_0x2011('0x2d')][_0x2011('0x2e')]);_0x52d3b5[_0x2011('0x31')]=_[_0x2011('0x32')](_0x415516[_0x2011('0x31')]);_0x52d3b5[_0x2011('0x33')]=_[_0x2011('0x44')](_0x52d3b5[_0x2011('0x34')],_0x52d3b5[_0x2011('0x31')]);_0x4a90d5['attributes']=_['intersection'](_0x52d3b5[_0x2011('0x34')],qs[_0x2011('0x35')](_0x415516[_0x2011('0x31')]['fields']));_0x4a90d5['attributes']=_0x4a90d5['attributes']['length']?_0x4a90d5[_0x2011('0x36')]:_0x52d3b5[_0x2011('0x34')];if(_0x415516[_0x2011('0x31')][_0x2011('0x40')]){_0x4a90d5[_0x2011('0x41')]=[{'all':!![]}];}_0x4a90d5=_[_0x2011('0x3e')]({},_0x4a90d5,_0x415516[_0x2011('0x3f')]);return db[_0x2011('0x2d')][_0x2011('0x45')](_0x4a90d5)['then'](handleEntityNotFound(_0x24029d,null))[_0x2011('0x26')](respondWithResult(_0x24029d,null))['catch'](handleError(_0x24029d,null));};exports['create']=function(_0x44bdcb,_0x45bcb1){return db[_0x2011('0x2d')][_0x2011('0x46')](_0x44bdcb[_0x2011('0x47')],{})[_0x2011('0x26')](respondWithResult(_0x45bcb1,0xc9))[_0x2011('0x42')](handleError(_0x45bcb1,null));};exports[_0x2011('0x25')]=function(_0x2e672c,_0x4f829d){if(_0x2e672c[_0x2011('0x47')]['id']){delete _0x2e672c[_0x2011('0x47')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x2e672c[_0x2011('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f829d,null))[_0x2011('0x26')](saveUpdates(_0x2e672c[_0x2011('0x47')],null))[_0x2011('0x26')](respondWithResult(_0x4f829d,null))['catch'](handleError(_0x4f829d,null));};exports[_0x2011('0x27')]=function(_0x224688,_0x14219e){return db['SmsTransferReport']['find']({'where':{'id':_0x224688[_0x2011('0x43')]['id']}})[_0x2011('0x26')](handleEntityNotFound(_0x14219e,null))[_0x2011('0x26')](removeEntity(_0x14219e,null))[_0x2011('0x42')](handleError(_0x14219e,null));};exports[_0x2011('0x48')]=function(_0x356b2a,_0x111a06){return db[_0x2011('0x2d')][_0x2011('0x48')]()[_0x2011('0x26')](respondWithResult(_0x111a06,null))[_0x2011('0x42')](handleError(_0x111a06,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 234d615..2e69bf5 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 _0x4ed0=['uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer'];(function(_0x189882,_0x33c3bb){var _0x43d16c=function(_0x514462){while(--_0x514462){_0x189882['push'](_0x189882['shift']());}};_0x43d16c(++_0x33c3bb);}(_0x4ed0,0x79));var _0x04ed=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4ed0[_0x432682];return _0x463d05;};'use strict';var _=require(_0x04ed('0x0'));var util=require('util');var logger=require(_0x04ed('0x1'))('api');var moment=require(_0x04ed('0x2'));var BPromise=require(_0x04ed('0x3'));var rp=require(_0x04ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x04ed('0x5'));var config=require(_0x04ed('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x04ed('0x7')]=function(_0x2481b6,_0x11fa59){return _0x2481b6[_0x04ed('0x8')](_0x04ed('0x9'),attributes,{'tableName':_0x04ed('0xa'),'paranoid':![],'indexes':[{'name':_0x04ed('0xb'),'fields':[_0x04ed('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa6e7=['rimraf','../../config/environment','./smsTransferReport.attributes','define','uniqueid','lodash','../../config/logger','api','path'];(function(_0x3e725a,_0x5bdf0e){var _0x38f869=function(_0x39f45c){while(--_0x39f45c){_0x3e725a['push'](_0x3e725a['shift']());}};_0x38f869(++_0x5bdf0e);}(_0xa6e7,0xb0));var _0x7a6e=function(_0xbe31d1,_0x126345){_0xbe31d1=_0xbe31d1-0x0;var _0x7bd03=_0xa6e7[_0xbe31d1];return _0x7bd03;};'use strict';var _=require(_0x7a6e('0x0'));var util=require('util');var logger=require(_0x7a6e('0x1'))(_0x7a6e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a6e('0x3'));var rimraf=require(_0x7a6e('0x4'));var config=require(_0x7a6e('0x5'));var attributes=require(_0x7a6e('0x6'));module['exports']=function(_0x2e32bd,_0x2911ec){return _0x2e32bd[_0x7a6e('0x7')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7a6e('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 0a626dd..8b1c4cf 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 _0x98d5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x579728,_0x10d16a){var _0x2dd404=function(_0x49e2de){while(--_0x49e2de){_0x579728['push'](_0x579728['shift']());}};_0x2dd404(++_0x10d16a);}(_0x98d5,0xfb));var _0x598d=function(_0x217710,_0x1f50e1){_0x217710=_0x217710-0x0;var _0x1ea834=_0x98d5[_0x217710];return _0x1ea834;};'use strict';var _=require(_0x598d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x598d('0x1'));var rs=require(_0x598d('0x2'));var fs=require('fs');var Redis=require(_0x598d('0x3'));var db=require(_0x598d('0x4'))['db'];var utils=require(_0x598d('0x5'));var logger=require(_0x598d('0x6'))(_0x598d('0x7'));var config=require(_0x598d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x598d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x286d2a,_0x507285,_0x4de6f3){return new BPromise(function(_0x26d1cb,_0x2fa217){return client['request'](_0x286d2a,_0x4de6f3)[_0x598d('0xa')](function(_0x27653b){logger[_0x598d('0xb')](_0x598d('0xc'),_0x507285,_0x598d('0xd'));logger[_0x598d('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x507285,'request\x20sent',JSON[_0x598d('0xf')](_0x27653b));if(_0x27653b[_0x598d('0x10')]){if(_0x27653b[_0x598d('0x10')][_0x598d('0x11')]===0x1f4){logger[_0x598d('0x10')](_0x598d('0xc'),_0x507285,_0x27653b[_0x598d('0x10')][_0x598d('0x12')]);return _0x2fa217(_0x27653b[_0x598d('0x10')][_0x598d('0x12')]);}logger[_0x598d('0x10')](_0x598d('0xc'),_0x507285,_0x27653b['error'][_0x598d('0x12')]);return _0x26d1cb(_0x27653b['error'][_0x598d('0x12')]);}else{logger[_0x598d('0xb')](_0x598d('0xc'),_0x507285,_0x598d('0xd'));_0x26d1cb(_0x27653b[_0x598d('0x13')]['message']);}})[_0x598d('0x14')](function(_0x18cbd2){logger['error'](_0x598d('0xc'),_0x507285,_0x18cbd2);_0x2fa217(_0x18cbd2);});});} \ No newline at end of file +var _0xa7dc=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x3799dc,_0x4c3aa1){var _0x462026=function(_0x5113b9){while(--_0x5113b9){_0x3799dc['push'](_0x3799dc['shift']());}};_0x462026(++_0x4c3aa1);}(_0xa7dc,0x11d));var _0xca7d=function(_0x3887c1,_0x15b4be){_0x3887c1=_0x3887c1-0x0;var _0x485673=_0xa7dc[_0x3887c1];return _0x485673;};'use strict';var _=require(_0xca7d('0x0'));var util=require(_0xca7d('0x1'));var moment=require(_0xca7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xca7d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca7d('0x4'))['db'];var utils=require(_0xca7d('0x5'));var logger=require(_0xca7d('0x6'))(_0xca7d('0x7'));var config=require(_0xca7d('0x8'));var jayson=require(_0xca7d('0x9'));var client=jayson[_0xca7d('0xa')][_0xca7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5073dd,_0x22223d,_0x820afa){return new BPromise(function(_0x4d5bc7,_0x2920bd){return client[_0xca7d('0xc')](_0x5073dd,_0x820afa)[_0xca7d('0xd')](function(_0x5236ce){logger[_0xca7d('0xe')](_0xca7d('0xf'),_0x22223d,_0xca7d('0x10'));logger[_0xca7d('0x11')](_0xca7d('0x12'),_0x22223d,'request\x20sent',JSON[_0xca7d('0x13')](_0x5236ce));if(_0x5236ce['error']){if(_0x5236ce[_0xca7d('0x14')]['code']===0x1f4){logger[_0xca7d('0x14')](_0xca7d('0xf'),_0x22223d,_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);return _0x2920bd(_0x5236ce['error']['message']);}logger['error'](_0xca7d('0xf'),_0x22223d,_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);return _0x4d5bc7(_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);}else{logger[_0xca7d('0xe')](_0xca7d('0xf'),_0x22223d,_0xca7d('0x10'));_0x4d5bc7(_0x5236ce[_0xca7d('0x16')][_0xca7d('0x15')]);}})[_0xca7d('0x17')](function(_0x245c7c){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x22223d,_0x245c7c);_0x2920bd(_0x245c7c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 4c0fe8c..818a4ff 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 _0xf0a2=['/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','now','extname','post','single','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./sound.controller','isAuthenticated','get'];(function(_0x1c92b,_0x1cc8ee){var _0x5085f8=function(_0x46a033){while(--_0x46a033){_0x1c92b['push'](_0x1c92b['shift']());}};_0x5085f8(++_0x1cc8ee);}(_0xf0a2,0x1ca));var _0x2f0a=function(_0x398489,_0x38a162){_0x398489=_0x398489-0x0;var _0x3895a0=_0xf0a2[_0x398489];return _0x3895a0;};'use strict';var multer=require(_0x2f0a('0x0'));var util=require(_0x2f0a('0x1'));var path=require(_0x2f0a('0x2'));var timeout=require(_0x2f0a('0x3'));var express=require(_0x2f0a('0x4'));var router=express['Router']();var fs_extra=require(_0x2f0a('0x5'));var auth=require(_0x2f0a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2f0a('0x7'));router['get']('/',auth[_0x2f0a('0x8')](),controller['index']);router[_0x2f0a('0x9')]('/:id',auth[_0x2f0a('0x8')](),controller['show']);router[_0x2f0a('0x9')](_0x2f0a('0xa'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x2f0a('0xb')]({'destination':function(_0x1679c0,_0x3c0831,_0xb541b5){_0xb541b5(null,path[_0x2f0a('0xc')](config[_0x2f0a('0xd')],_0x2f0a('0xe')));},'filename':function(_0x196550,_0x5a522f,_0xa2eca3){_0x5a522f['originalname']=_0x5a522f[_0x2f0a('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xa2eca3(null,util[_0x2f0a('0x10')](_0x2f0a('0x11'),path['basename'](_0x5a522f[_0x2f0a('0xf')],path['extname'](_0x5a522f[_0x2f0a('0xf')])),Date[_0x2f0a('0x12')](),path[_0x2f0a('0x13')](_0x5a522f[_0x2f0a('0xf')])));}})});router[_0x2f0a('0x14')]('/',upload[_0x2f0a('0x15')]('file'),controller['create']);router['put'](_0x2f0a('0x16'),auth['isAuthenticated'](),controller[_0x2f0a('0x17')]);router[_0x2f0a('0x18')](_0x2f0a('0x16'),auth[_0x2f0a('0x8')](),controller[_0x2f0a('0x18')]);module[_0x2f0a('0x19')]=router; \ No newline at end of file +var _0xab2e=['diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','extname','now','post','create','put','update','delete','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','download'];(function(_0x26d26f,_0x302cce){var _0x5c8c0e=function(_0x519b9d){while(--_0x519b9d){_0x26d26f['push'](_0x26d26f['shift']());}};_0x5c8c0e(++_0x302cce);}(_0xab2e,0x90));var _0xeab2=function(_0x2a0ab3,_0x2b527c){_0x2a0ab3=_0x2a0ab3-0x0;var _0x5413ba=_0xab2e[_0x2a0ab3];return _0x5413ba;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeab2('0x0'));var router=express[_0xeab2('0x1')]();var fs_extra=require(_0xeab2('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xeab2('0x3'));var config=require(_0xeab2('0x4'));var controller=require(_0xeab2('0x5'));router[_0xeab2('0x6')]('/',auth[_0xeab2('0x7')](),controller['index']);router['get'](_0xeab2('0x8'),auth[_0xeab2('0x7')](),controller[_0xeab2('0x9')]);router[_0xeab2('0x6')](_0xeab2('0xa'),auth[_0xeab2('0x7')](),controller[_0xeab2('0xb')]);var upload=multer({'storage':multer[_0xeab2('0xc')]({'destination':function(_0x4e5286,_0x2bc192,_0x1568f5){_0x1568f5(null,path[_0xeab2('0xd')](config[_0xeab2('0xe')],_0xeab2('0xf')));},'filename':function(_0x4fec33,_0x5cabca,_0x48cc2c){_0x5cabca[_0xeab2('0x10')]=_0x5cabca[_0xeab2('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x48cc2c(null,util[_0xeab2('0x11')](_0xeab2('0x12'),path['basename'](_0x5cabca[_0xeab2('0x10')],path[_0xeab2('0x13')](_0x5cabca[_0xeab2('0x10')])),Date[_0xeab2('0x14')](),path[_0xeab2('0x13')](_0x5cabca[_0xeab2('0x10')])));}})});router[_0xeab2('0x15')]('/',upload['single']('file'),controller[_0xeab2('0x16')]);router[_0xeab2('0x17')](_0xeab2('0x8'),auth['isAuthenticated'](),controller[_0xeab2('0x18')]);router[_0xeab2('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xeab2('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 77ec6c4..7780e65 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 _0xde17=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x2642a3,_0x53f903){var _0x12f73b=function(_0xca6b31){while(--_0xca6b31){_0x2642a3['push'](_0x2642a3['shift']());}};_0x12f73b(++_0x53f903);}(_0xde17,0x186));var _0x7de1=function(_0x5f429f,_0x46d5cd){_0x5f429f=_0x5f429f-0x0;var _0x3e8d26=_0xde17[_0x5f429f];return _0x3e8d26;};'use strict';var Sequelize=require(_0x7de1('0x0'));module[_0x7de1('0x1')]={'name':{'type':Sequelize[_0x7de1('0x2')],'unique':_0x7de1('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x7de1('0x2')]},'display_name':{'type':Sequelize[_0x7de1('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x7de1('0x2')]},'original_format':{'type':Sequelize[_0x7de1('0x2')]},'original_duration':{'type':Sequelize[_0x7de1('0x4')]},'original_sampleCount':{'type':Sequelize[_0x7de1('0x5')]},'original_channelCount':{'type':Sequelize[_0x7de1('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x7de1('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x7de1('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x7de1('0x5')]},'converted_channelCount':{'type':Sequelize[_0x7de1('0x6')]},'converted_bitRate':{'type':Sequelize[_0x7de1('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x7de1('0x6')]}}; \ No newline at end of file +var _0x99be=['INTEGER','FLOAT','sequelize','STRING','name','BIGINT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x99be,0x104));var _0xe99b=function(_0x3f58bb,_0x1560e1){_0x3f58bb=_0x3f58bb-0x0;var _0x23ddc5=_0x99be[_0x3f58bb];return _0x23ddc5;};'use strict';var Sequelize=require(_0xe99b('0x0'));module['exports']={'name':{'type':Sequelize[_0xe99b('0x1')],'unique':_0xe99b('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xe99b('0x1')]},'display_name':{'type':Sequelize[_0xe99b('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xe99b('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xe99b('0x3')]},'original_channelCount':{'type':Sequelize[_0xe99b('0x4')]},'original_bitRate':{'type':Sequelize[_0xe99b('0x3')]},'original_sampleRate':{'type':Sequelize[_0xe99b('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xe99b('0x5')]},'converted_sampleCount':{'type':Sequelize[_0xe99b('0x3')]},'converted_channelCount':{'type':Sequelize[_0xe99b('0x4')]},'converted_bitRate':{'type':Sequelize[_0xe99b('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xe99b('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index a9347e1..04d123b 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 _0xfff8=['path','sox','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','save','then','destroy','Sounds','UserProfileResource','error','stack','name','send','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','format','%s.%s','create','basename','originalname','extname','file','filename','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','update','delete','original_format','eml-format','request-promise','moment','bluebird','mustache','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfff8,0x1ce));var _0x8fff=function(_0x581750,_0x1e0bd2){_0x581750=_0x581750-0x0;var _0x3ad5c4=_0xfff8[_0x581750];return _0x3ad5c4;};'use strict';var emlformat=require(_0x8fff('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8fff('0x1'));var moment=require(_0x8fff('0x2'));var BPromise=require(_0x8fff('0x3'));var Mustache=require(_0x8fff('0x4'));var util=require(_0x8fff('0x5'));var path=require(_0x8fff('0x6'));var sox=require(_0x8fff('0x7'));var csv=require('to-csv');var ejs=require(_0x8fff('0x8'));var fs=require('fs');var fs_extra=require(_0x8fff('0x9'));var _=require('lodash');var squel=require(_0x8fff('0xa'));var crypto=require(_0x8fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8fff('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8fff('0xd'));var Redis=require(_0x8fff('0xe'));var authService=require(_0x8fff('0xf'));var qs=require(_0x8fff('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8fff('0x11'))('api');var utils=require(_0x8fff('0x12'));var config=require(_0x8fff('0x13'));var licenseUtil=require(_0x8fff('0x14'));var db=require(_0x8fff('0x15'))['db'];function respondWithStatusCode(_0x539d95,_0x3429c0){_0x3429c0=_0x3429c0||0xcc;return function(_0x21fe4a){if(_0x21fe4a){return _0x539d95[_0x8fff('0x16')](_0x3429c0);}return _0x539d95[_0x8fff('0x17')](_0x3429c0)[_0x8fff('0x18')]();};}function respondWithResult(_0x35fc12,_0x3b1d0c){_0x3b1d0c=_0x3b1d0c||0xc8;return function(_0x535891){if(_0x535891){return _0x35fc12['status'](_0x3b1d0c)[_0x8fff('0x19')](_0x535891);}};}function respondWithFilteredResult(_0x1edd36,_0x490add){return function(_0x417815){if(_0x417815){var _0x13cf47=typeof _0x490add[_0x8fff('0x1a')]==='undefined'&&typeof _0x490add[_0x8fff('0x1b')]===_0x8fff('0x1c');var _0x310a76=_0x417815[_0x8fff('0x1d')];var _0xff7290=_0x13cf47?0x0:_0x490add[_0x8fff('0x1a')];var _0x5b4d27=_0x13cf47?_0x417815['count']:_0x490add[_0x8fff('0x1a')]+_0x490add[_0x8fff('0x1b')];var _0x66972d;if(_0x5b4d27>=_0x310a76){_0x5b4d27=_0x310a76;_0x66972d=0xc8;}else{_0x66972d=0xce;}_0x1edd36[_0x8fff('0x17')](_0x66972d);return _0x1edd36[_0x8fff('0x1e')]('Content-Range',_0xff7290+'-'+_0x5b4d27+'/'+_0x310a76)[_0x8fff('0x19')](_0x417815);}return null;};}function patchUpdates(_0x3b969b){return function(_0x4dc075){try{jsonpatch['apply'](_0x4dc075,_0x3b969b,!![]);}catch(_0x11541e){return BPromise['reject'](_0x11541e);}return _0x4dc075[_0x8fff('0x1f')]();};}function saveUpdates(_0x302b42,_0x3df1ec){return function(_0x2ae729){if(_0x2ae729){return _0x2ae729['update'](_0x302b42)[_0x8fff('0x20')](function(_0x439aa6){return _0x439aa6;});}return null;};}function removeEntity(_0x187798,_0x5b7fd2){return function(_0x4568ed){if(_0x4568ed){return _0x4568ed[_0x8fff('0x21')]()[_0x8fff('0x20')](function(){var _0x56719f=_0x4568ed['get']({'plain':!![]});var _0x19c802=_0x8fff('0x22');return db[_0x8fff('0x23')][_0x8fff('0x21')]({'where':{'type':_0x19c802,'resourceId':_0x56719f['id']}})[_0x8fff('0x20')](function(){return _0x4568ed;});})[_0x8fff('0x20')](function(){_0x187798['status'](0xcc)[_0x8fff('0x18')]();});}};}function handleEntityNotFound(_0x17da08,_0xf3e386){return function(_0x53688a){if(!_0x53688a){_0x17da08['sendStatus'](0x194);}return _0x53688a;};}function handleError(_0x5e9f72,_0x14f3b7){_0x14f3b7=_0x14f3b7||0x1f4;return function(_0x19cf8d){logger[_0x8fff('0x24')](_0x19cf8d[_0x8fff('0x25')]);if(_0x19cf8d['name']){delete _0x19cf8d[_0x8fff('0x26')];}_0x5e9f72[_0x8fff('0x17')](_0x14f3b7)[_0x8fff('0x27')](_0x19cf8d);};}exports['index']=function(_0x178dca,_0x32fd18){var _0x1f05cf={},_0x1ff9d3={},_0x2d46b3={'count':0x0,'rows':[]};var _0x32f865=_[_0x8fff('0x28')](db[_0x8fff('0x29')][_0x8fff('0x2a')],function(_0x29d7a1){return{'name':_0x29d7a1[_0x8fff('0x2b')],'type':_0x29d7a1[_0x8fff('0x2c')][_0x8fff('0x2d')]};});_0x1ff9d3[_0x8fff('0x2e')]=_[_0x8fff('0x28')](_0x32f865,_0x8fff('0x26'));_0x1ff9d3[_0x8fff('0x2f')]=_[_0x8fff('0x30')](_0x178dca[_0x8fff('0x2f')]);_0x1ff9d3[_0x8fff('0x31')]=_[_0x8fff('0x32')](_0x1ff9d3[_0x8fff('0x2e')],_0x1ff9d3[_0x8fff('0x2f')]);_0x1f05cf[_0x8fff('0x33')]=_['intersection'](_0x1ff9d3[_0x8fff('0x2e')],qs[_0x8fff('0x34')](_0x178dca[_0x8fff('0x2f')]['fields']));_0x1f05cf[_0x8fff('0x33')]=_0x1f05cf[_0x8fff('0x33')][_0x8fff('0x35')]?_0x1f05cf[_0x8fff('0x33')]:_0x1ff9d3[_0x8fff('0x2e')];if(!_0x178dca[_0x8fff('0x2f')][_0x8fff('0x36')](_0x8fff('0x37'))){_0x1f05cf[_0x8fff('0x1b')]=qs[_0x8fff('0x1b')](_0x178dca[_0x8fff('0x2f')][_0x8fff('0x1b')]);_0x1f05cf[_0x8fff('0x1a')]=qs[_0x8fff('0x1a')](_0x178dca['query'][_0x8fff('0x1a')]);}_0x1f05cf['order']=qs['sort'](_0x178dca[_0x8fff('0x2f')][_0x8fff('0x38')]);_0x1f05cf['where']=qs[_0x8fff('0x31')](_[_0x8fff('0x39')](_0x178dca[_0x8fff('0x2f')],_0x1ff9d3['filters']),_0x32f865);if(_0x178dca[_0x8fff('0x2f')][_0x8fff('0x3a')]){_0x1f05cf[_0x8fff('0x3b')]=_['merge'](_0x1f05cf['where'],{'$or':_[_0x8fff('0x28')](_0x32f865,function(_0x26cfee){if(_0x26cfee[_0x8fff('0x2c')]!=='VIRTUAL'){var _0x53c742={};_0x53c742[_0x26cfee['name']]={'$like':'%'+_0x178dca[_0x8fff('0x2f')][_0x8fff('0x3a')]+'%'};return _0x53c742;}})});}_0x1f05cf=_[_0x8fff('0x3c')]({},_0x1f05cf,_0x178dca[_0x8fff('0x3d')]);var _0x54477b={'where':_0x1f05cf['where']};return db[_0x8fff('0x29')][_0x8fff('0x1d')](_0x54477b)[_0x8fff('0x20')](function(_0x346875){_0x2d46b3['count']=_0x346875;if(_0x178dca[_0x8fff('0x2f')][_0x8fff('0x3e')]){_0x1f05cf[_0x8fff('0x3f')]=[{'all':!![]}];}return db[_0x8fff('0x29')][_0x8fff('0x40')](_0x1f05cf);})[_0x8fff('0x20')](function(_0x3286ce){_0x2d46b3[_0x8fff('0x41')]=_0x3286ce;return _0x2d46b3;})['then'](respondWithFilteredResult(_0x32fd18,_0x1f05cf))[_0x8fff('0x42')](handleError(_0x32fd18,null));};exports['show']=function(_0x4b57a6,_0x28cb50){var _0x57cabb={'raw':!![],'where':{'id':_0x4b57a6[_0x8fff('0x43')]['id']}},_0x5af5df={};_0x5af5df[_0x8fff('0x2e')]=_['keys'](db['Sound'][_0x8fff('0x2a')]);_0x5af5df[_0x8fff('0x2f')]=_['keys'](_0x4b57a6[_0x8fff('0x2f')]);_0x5af5df[_0x8fff('0x31')]=_['intersection'](_0x5af5df[_0x8fff('0x2e')],_0x5af5df['query']);_0x57cabb['attributes']=_[_0x8fff('0x32')](_0x5af5df[_0x8fff('0x2e')],qs[_0x8fff('0x34')](_0x4b57a6['query'][_0x8fff('0x34')]));_0x57cabb[_0x8fff('0x33')]=_0x57cabb[_0x8fff('0x33')][_0x8fff('0x35')]?_0x57cabb[_0x8fff('0x33')]:_0x5af5df[_0x8fff('0x2e')];if(_0x4b57a6['query']['includeAll']){_0x57cabb[_0x8fff('0x3f')]=[{'all':!![]}];}_0x57cabb=_[_0x8fff('0x3c')]({},_0x57cabb,_0x4b57a6[_0x8fff('0x3d')]);return db[_0x8fff('0x29')]['find'](_0x57cabb)[_0x8fff('0x20')](handleEntityNotFound(_0x28cb50,null))[_0x8fff('0x20')](respondWithResult(_0x28cb50,null))[_0x8fff('0x42')](handleError(_0x28cb50,null));};exports['download']=function(_0xbea4a9,_0x321511,_0xf570b4){return db[_0x8fff('0x29')][_0x8fff('0x44')]({'where':{'id':_0xbea4a9[_0x8fff('0x43')]['id']},'attributes':['name',_0x8fff('0x45'),_0x8fff('0x46')],'raw':!![]})[_0x8fff('0x20')](handleEntityNotFound(_0x321511,null))[_0x8fff('0x20')](function(_0x392097){if(_0x392097){if(!fs[_0x8fff('0x47')](path[_0x8fff('0x48')](config[_0x8fff('0x49')],_0x8fff('0x4a'),_0x392097[_0x8fff('0x45')]+'.'+_0x392097[_0x8fff('0x46')]))){throw new db[(_0x8fff('0x4b'))][(_0x8fff('0x4c'))](_0x8fff('0x4d'));}return _0x321511[_0x8fff('0x4e')](path[_0x8fff('0x48')](config[_0x8fff('0x49')],'server/files/sounds/converted',util[_0x8fff('0x4f')](_0x8fff('0x50'),_0x392097[_0x8fff('0x45')],_0x392097['converted_format'])),util[_0x8fff('0x4f')](_0x8fff('0x50'),_0x392097[_0x8fff('0x26')],_0x392097['converted_format']));}return null;})[_0x8fff('0x42')](handleError(_0x321511,null));};exports[_0x8fff('0x51')]=function(_0x135bde,_0xd47ce5,_0x4cfbfb){var _0x16bfa6={'name':path[_0x8fff('0x52')](_0x135bde['file'][_0x8fff('0x53')],path[_0x8fff('0x54')](_0x135bde[_0x8fff('0x55')]['originalname'])),'save_name':path[_0x8fff('0x52')](_0x135bde[_0x8fff('0x55')]['filename'],path[_0x8fff('0x54')](_0x135bde[_0x8fff('0x55')][_0x8fff('0x56')])),'original_format':path['extname'](_0x135bde[_0x8fff('0x55')][_0x8fff('0x53')])['substring'](0x1),'converted_format':_0x8fff('0x57')};var _0x321c40=path[_0x8fff('0x48')](config[_0x8fff('0x49')],_0x8fff('0x58'),_0x135bde[_0x8fff('0x55')][_0x8fff('0x56')]);var _0x2a9fa5=path['join'](config[_0x8fff('0x49')],'server/files/sounds/converted',util[_0x8fff('0x4f')](_0x8fff('0x50'),path['basename'](_0x135bde[_0x8fff('0x55')][_0x8fff('0x56')],path[_0x8fff('0x54')](_0x135bde[_0x8fff('0x55')][_0x8fff('0x56')])),_0x16bfa6[_0x8fff('0x46')]));logger['info'](_0x8fff('0x59'),_0x321c40);logger['info'](_0x8fff('0x5a'),_0x2a9fa5);try{fs[_0x8fff('0x5b')](_0x321c40,parseInt(_0x8fff('0x5c'),0x8));var _0x2d1d6b=sox['transcode'](_0x321c40,_0x2a9fa5,{'sampleRate':0x1f40,'format':_0x8fff('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2d1d6b['on']('error',function(_0x290d60){fs[_0x8fff('0x5d')](_0x321c40);_0xd47ce5['status'](0x1f4)[_0x8fff('0x27')](_0x290d60);});_0x2d1d6b['on'](_0x8fff('0x5e'),function(_0x53b994){_0x16bfa6[_0x8fff('0x5f')]=isNaN(_0x53b994[_0x8fff('0x60')])?null:_0x53b994[_0x8fff('0x60')]*0x3e8;_0x16bfa6[_0x8fff('0x61')]=isNaN(_0x53b994[_0x8fff('0x62')])?null:_0x53b994[_0x8fff('0x62')];_0x16bfa6[_0x8fff('0x63')]=isNaN(_0x53b994[_0x8fff('0x64')])?null:_0x53b994[_0x8fff('0x64')];_0x16bfa6['original_bitRate']=isNaN(_0x53b994[_0x8fff('0x65')])?null:_0x53b994[_0x8fff('0x65')];_0x16bfa6['original_sampleRate']=isNaN(_0x53b994['sampleRate'])?null:_0x53b994[_0x8fff('0x66')];});_0x2d1d6b['on'](_0x8fff('0x67'),function(_0x1be2a0){_0x16bfa6['converted_duration']=isNaN(_0x1be2a0[_0x8fff('0x60')])?null:_0x1be2a0[_0x8fff('0x60')]*0x3e8;_0x16bfa6[_0x8fff('0x68')]=isNaN(_0x1be2a0[_0x8fff('0x62')])?null:_0x1be2a0[_0x8fff('0x62')];_0x16bfa6[_0x8fff('0x69')]=isNaN(_0x1be2a0[_0x8fff('0x64')])?null:_0x1be2a0[_0x8fff('0x64')];_0x16bfa6[_0x8fff('0x6a')]=isNaN(_0x1be2a0[_0x8fff('0x65')])?null:_0x1be2a0['bitRate'];_0x16bfa6[_0x8fff('0x6b')]=isNaN(_0x1be2a0[_0x8fff('0x66')])?null:_0x1be2a0[_0x8fff('0x66')];});_0x2d1d6b['on'](_0x8fff('0x18'),function(){fs[_0x8fff('0x5b')](_0x2a9fa5,parseInt(_0x8fff('0x5c'),0x8));return db['Sound'][_0x8fff('0x51')](_0x16bfa6)[_0x8fff('0x20')](function(_0x1839d6){var _0x24d6f1={'role':_0x135bde[_0x8fff('0x6c')][_0x8fff('0x6d')],'userProfileId':_0x135bde[_0x8fff('0x6c')][_0x8fff('0x6e')]};if(!_0x24d6f1)throw new Error(_0x8fff('0x6f'));if(_0x24d6f1['role']===_0x8fff('0x70')){var _0x4ecd25=_0x1839d6[_0x8fff('0x71')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x8fff('0x22'),'userProfileId':_0x24d6f1[_0x8fff('0x6e')]},'raw':!![]})['then'](function(_0x1804ef){if(_0x1804ef&&_0x1804ef['autoAssociation']===0x0){return db[_0x8fff('0x23')][_0x8fff('0x51')]({'name':_0x4ecd25[_0x8fff('0x26')],'resourceId':_0x4ecd25['id'],'type':_0x1804ef[_0x8fff('0x26')],'sectionId':_0x1804ef['id']},{})[_0x8fff('0x20')](function(){return _0x1839d6;});}else{return _0x1839d6;}})[_0x8fff('0x42')](function(_0x36ff2d){logger[_0x8fff('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36ff2d);throw _0x36ff2d;});}return _0x1839d6;})[_0x8fff('0x20')](respondWithResult(_0xd47ce5,null))[_0x8fff('0x42')](handleError(_0xd47ce5,null));});_0x2d1d6b['start']();}catch(_0x35d6a2){_0xd47ce5['status'](0x1f4)['send'](_0x35d6a2);}};exports[_0x8fff('0x72')]=function(_0x23c8f7,_0x6a1801,_0x338fc7){return db[_0x8fff('0x29')][_0x8fff('0x44')]({'where':{'id':_0x23c8f7[_0x8fff('0x43')]['id']}})[_0x8fff('0x20')](handleEntityNotFound(_0x6a1801,null))['then'](saveUpdates(_[_0x8fff('0x39')](_0x23c8f7[_0x8fff('0x6c')],['name','description']),null))[_0x8fff('0x20')](respondWithResult(_0x6a1801,null))['catch'](handleError(_0x6a1801,null));};exports[_0x8fff('0x73')]=function(_0x475aa5,_0x2c9864,_0x832556){return db[_0x8fff('0x29')]['find']({'where':{'id':_0x475aa5[_0x8fff('0x43')]['id']}})[_0x8fff('0x20')](function(_0x453142){if(_0x453142){return _0x453142[_0x8fff('0x21')]();}})[_0x8fff('0x20')](function(_0x2e40dc){var _0x19caee=path[_0x8fff('0x48')](config[_0x8fff('0x49')],'server/files/sounds/original',util[_0x8fff('0x4f')](_0x8fff('0x50'),_0x2e40dc['save_name'],_0x2e40dc[_0x8fff('0x74')]));var _0x89f660=path[_0x8fff('0x48')](config['root'],_0x8fff('0x4a'),util[_0x8fff('0x4f')](_0x8fff('0x50'),_0x2e40dc[_0x8fff('0x45')],_0x2e40dc[_0x8fff('0x46')]));fs[_0x8fff('0x5d')](_0x19caee);fs[_0x8fff('0x5d')](_0x89f660);return _0x2e40dc;})[_0x8fff('0x20')](function(_0x508155){if(_0x508155){return _0x2c9864[_0x8fff('0x17')](0xcc)[_0x8fff('0x18')]();}})[_0x8fff('0x20')](handleEntityNotFound(_0x2c9864,null))[_0x8fff('0x42')](handleError(_0x2c9864,null));}; \ No newline at end of file +var _0xbd8e=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','end','stack','send','map','Sound','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','download','format','%s.%s','basename','originalname','extname','file','filename','wav','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','error','unlinkSync','src','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','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'];(function(_0x3f784e,_0x175406){var _0x14fe30=function(_0x539143){while(--_0x539143){_0x3f784e['push'](_0x3f784e['shift']());}};_0x14fe30(++_0x175406);}(_0xbd8e,0x1d9));var _0xebd8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbd8e[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xebd8('0x0'));var rimraf=require(_0xebd8('0x1'));var zipdir=require(_0xebd8('0x2'));var jsonpatch=require(_0xebd8('0x3'));var rp=require(_0xebd8('0x4'));var moment=require('moment');var BPromise=require(_0xebd8('0x5'));var Mustache=require('mustache');var util=require(_0xebd8('0x6'));var path=require('path');var sox=require(_0xebd8('0x7'));var csv=require('to-csv');var ejs=require(_0xebd8('0x8'));var fs=require('fs');var fs_extra=require(_0xebd8('0x9'));var _=require(_0xebd8('0xa'));var squel=require(_0xebd8('0xb'));var crypto=require(_0xebd8('0xc'));var jsforce=require(_0xebd8('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebd8('0xe'));var Papa=require(_0xebd8('0xf'));var Redis=require(_0xebd8('0x10'));var authService=require(_0xebd8('0x11'));var qs=require(_0xebd8('0x12'));var as=require(_0xebd8('0x13'));var hardwareService=require(_0xebd8('0x14'));var logger=require(_0xebd8('0x15'))(_0xebd8('0x16'));var utils=require('../../config/utils');var config=require(_0xebd8('0x17'));var licenseUtil=require(_0xebd8('0x18'));var db=require(_0xebd8('0x19'))['db'];function respondWithStatusCode(_0x47d466,_0x42034f){_0x42034f=_0x42034f||0xcc;return function(_0x42db6b){if(_0x42db6b){return _0x47d466[_0xebd8('0x1a')](_0x42034f);}return _0x47d466[_0xebd8('0x1b')](_0x42034f)['end']();};}function respondWithResult(_0x354250,_0x3d5abf){_0x3d5abf=_0x3d5abf||0xc8;return function(_0x2aa11d){if(_0x2aa11d){return _0x354250[_0xebd8('0x1b')](_0x3d5abf)['json'](_0x2aa11d);}};}function respondWithFilteredResult(_0x1594c0,_0x352f09){return function(_0x12bcc9){if(_0x12bcc9){var _0x42fd67=typeof _0x352f09[_0xebd8('0x1c')]==='undefined'&&typeof _0x352f09[_0xebd8('0x1d')]==='undefined';var _0x42627e=_0x12bcc9[_0xebd8('0x1e')];var _0x37b723=_0x42fd67?0x0:_0x352f09[_0xebd8('0x1c')];var _0x4f5d00=_0x42fd67?_0x12bcc9[_0xebd8('0x1e')]:_0x352f09['offset']+_0x352f09['limit'];var _0x3e41df;if(_0x4f5d00>=_0x42627e){_0x4f5d00=_0x42627e;_0x3e41df=0xc8;}else{_0x3e41df=0xce;}_0x1594c0[_0xebd8('0x1b')](_0x3e41df);return _0x1594c0[_0xebd8('0x1f')](_0xebd8('0x20'),_0x37b723+'-'+_0x4f5d00+'/'+_0x42627e)[_0xebd8('0x21')](_0x12bcc9);}return null;};}function patchUpdates(_0x1e4411){return function(_0xd1cf06){try{jsonpatch[_0xebd8('0x22')](_0xd1cf06,_0x1e4411,!![]);}catch(_0x481133){return BPromise[_0xebd8('0x23')](_0x481133);}return _0xd1cf06[_0xebd8('0x24')]();};}function saveUpdates(_0x206382,_0xf7dedb){return function(_0x2e3b9d){if(_0x2e3b9d){return _0x2e3b9d[_0xebd8('0x25')](_0x206382)[_0xebd8('0x26')](function(_0x41538d){return _0x41538d;});}return null;};}function removeEntity(_0x424558,_0x2331d9){return function(_0x18545b){if(_0x18545b){return _0x18545b[_0xebd8('0x27')]()[_0xebd8('0x26')](function(){var _0x3ba174=_0x18545b[_0xebd8('0x28')]({'plain':!![]});var _0x41e241=_0xebd8('0x29');return db[_0xebd8('0x2a')][_0xebd8('0x27')]({'where':{'type':_0x41e241,'resourceId':_0x3ba174['id']}})[_0xebd8('0x26')](function(){return _0x18545b;});})['then'](function(){_0x424558['status'](0xcc)[_0xebd8('0x2b')]();});}};}function handleEntityNotFound(_0x350eff,_0x1ab1bd){return function(_0x80cac4){if(!_0x80cac4){_0x350eff[_0xebd8('0x1a')](0x194);}return _0x80cac4;};}function handleError(_0x1704c0,_0x59aec8){_0x59aec8=_0x59aec8||0x1f4;return function(_0x2f6bb5){logger['error'](_0x2f6bb5[_0xebd8('0x2c')]);if(_0x2f6bb5['name']){delete _0x2f6bb5['name'];}_0x1704c0[_0xebd8('0x1b')](_0x59aec8)[_0xebd8('0x2d')](_0x2f6bb5);};}exports['index']=function(_0x1c9de6,_0x20a6b5){var _0x4ca6cb={},_0x2f2b7b={},_0x5e345e={'count':0x0,'rows':[]};var _0x2b4795=_[_0xebd8('0x2e')](db[_0xebd8('0x2f')]['rawAttributes'],function(_0x57bfd1){return{'name':_0x57bfd1[_0xebd8('0x30')],'type':_0x57bfd1[_0xebd8('0x31')][_0xebd8('0x32')]};});_0x2f2b7b[_0xebd8('0x33')]=_['map'](_0x2b4795,_0xebd8('0x34'));_0x2f2b7b[_0xebd8('0x35')]=_['keys'](_0x1c9de6[_0xebd8('0x35')]);_0x2f2b7b[_0xebd8('0x36')]=_[_0xebd8('0x37')](_0x2f2b7b['model'],_0x2f2b7b[_0xebd8('0x35')]);_0x4ca6cb[_0xebd8('0x38')]=_[_0xebd8('0x37')](_0x2f2b7b['model'],qs[_0xebd8('0x39')](_0x1c9de6[_0xebd8('0x35')][_0xebd8('0x39')]));_0x4ca6cb[_0xebd8('0x38')]=_0x4ca6cb['attributes']['length']?_0x4ca6cb['attributes']:_0x2f2b7b['model'];if(!_0x1c9de6[_0xebd8('0x35')]['hasOwnProperty'](_0xebd8('0x3a'))){_0x4ca6cb[_0xebd8('0x1d')]=qs[_0xebd8('0x1d')](_0x1c9de6['query']['limit']);_0x4ca6cb[_0xebd8('0x1c')]=qs['offset'](_0x1c9de6['query']['offset']);}_0x4ca6cb['order']=qs['sort'](_0x1c9de6['query'][_0xebd8('0x3b')]);_0x4ca6cb[_0xebd8('0x3c')]=qs[_0xebd8('0x36')](_[_0xebd8('0x3d')](_0x1c9de6[_0xebd8('0x35')],_0x2f2b7b[_0xebd8('0x36')]),_0x2b4795);if(_0x1c9de6[_0xebd8('0x35')][_0xebd8('0x3e')]){_0x4ca6cb['where']=_[_0xebd8('0x3f')](_0x4ca6cb[_0xebd8('0x3c')],{'$or':_['map'](_0x2b4795,function(_0x721711){if(_0x721711[_0xebd8('0x31')]!==_0xebd8('0x40')){var _0x5cec6f={};_0x5cec6f[_0x721711['name']]={'$like':'%'+_0x1c9de6[_0xebd8('0x35')][_0xebd8('0x3e')]+'%'};return _0x5cec6f;}})});}_0x4ca6cb=_[_0xebd8('0x3f')]({},_0x4ca6cb,_0x1c9de6[_0xebd8('0x41')]);var _0x50d0c0={'where':_0x4ca6cb[_0xebd8('0x3c')]};return db[_0xebd8('0x2f')][_0xebd8('0x1e')](_0x50d0c0)[_0xebd8('0x26')](function(_0x524e48){_0x5e345e[_0xebd8('0x1e')]=_0x524e48;if(_0x1c9de6[_0xebd8('0x35')][_0xebd8('0x42')]){_0x4ca6cb[_0xebd8('0x43')]=[{'all':!![]}];}return db[_0xebd8('0x2f')][_0xebd8('0x44')](_0x4ca6cb);})[_0xebd8('0x26')](function(_0x21f90d){_0x5e345e[_0xebd8('0x45')]=_0x21f90d;return _0x5e345e;})['then'](respondWithFilteredResult(_0x20a6b5,_0x4ca6cb))[_0xebd8('0x46')](handleError(_0x20a6b5,null));};exports[_0xebd8('0x47')]=function(_0x397cd5,_0x3a3962){var _0x157b57={'raw':!![],'where':{'id':_0x397cd5[_0xebd8('0x48')]['id']}},_0xe7b14a={};_0xe7b14a[_0xebd8('0x33')]=_[_0xebd8('0x49')](db[_0xebd8('0x2f')][_0xebd8('0x4a')]);_0xe7b14a[_0xebd8('0x35')]=_['keys'](_0x397cd5[_0xebd8('0x35')]);_0xe7b14a['filters']=_[_0xebd8('0x37')](_0xe7b14a[_0xebd8('0x33')],_0xe7b14a['query']);_0x157b57['attributes']=_[_0xebd8('0x37')](_0xe7b14a['model'],qs[_0xebd8('0x39')](_0x397cd5[_0xebd8('0x35')][_0xebd8('0x39')]));_0x157b57[_0xebd8('0x38')]=_0x157b57[_0xebd8('0x38')][_0xebd8('0x4b')]?_0x157b57['attributes']:_0xe7b14a['model'];if(_0x397cd5[_0xebd8('0x35')]['includeAll']){_0x157b57[_0xebd8('0x43')]=[{'all':!![]}];}_0x157b57=_[_0xebd8('0x3f')]({},_0x157b57,_0x397cd5[_0xebd8('0x41')]);return db[_0xebd8('0x2f')][_0xebd8('0x4c')](_0x157b57)['then'](handleEntityNotFound(_0x3a3962,null))[_0xebd8('0x26')](respondWithResult(_0x3a3962,null))['catch'](handleError(_0x3a3962,null));};exports['download']=function(_0x2e571d,_0x159acc,_0x5399ad){return db[_0xebd8('0x2f')][_0xebd8('0x4c')]({'where':{'id':_0x2e571d[_0xebd8('0x48')]['id']},'attributes':[_0xebd8('0x34'),_0xebd8('0x4d'),_0xebd8('0x4e')],'raw':!![]})[_0xebd8('0x26')](handleEntityNotFound(_0x159acc,null))['then'](function(_0x350092){if(_0x350092){if(!fs[_0xebd8('0x4f')](path[_0xebd8('0x50')](config['root'],_0xebd8('0x51'),_0x350092[_0xebd8('0x4d')]+'.'+_0x350092[_0xebd8('0x4e')]))){throw new db[(_0xebd8('0x52'))]['ValidationError'](_0xebd8('0x53'));}return _0x159acc[_0xebd8('0x54')](path['join'](config['root'],'server/files/sounds/converted',util[_0xebd8('0x55')](_0xebd8('0x56'),_0x350092[_0xebd8('0x4d')],_0x350092['converted_format'])),util[_0xebd8('0x55')](_0xebd8('0x56'),_0x350092[_0xebd8('0x34')],_0x350092[_0xebd8('0x4e')]));}return null;})[_0xebd8('0x46')](handleError(_0x159acc,null));};exports['create']=function(_0x575aef,_0x1a3b55,_0x21222a){var _0x423337={'name':path[_0xebd8('0x57')](_0x575aef['file'][_0xebd8('0x58')],path[_0xebd8('0x59')](_0x575aef['file'][_0xebd8('0x58')])),'save_name':path['basename'](_0x575aef[_0xebd8('0x5a')][_0xebd8('0x5b')],path[_0xebd8('0x59')](_0x575aef['file'][_0xebd8('0x5b')])),'original_format':path['extname'](_0x575aef[_0xebd8('0x5a')]['originalname'])['substring'](0x1),'converted_format':_0xebd8('0x5c')};var _0x248df9=path['join'](config[_0xebd8('0x5d')],_0xebd8('0x5e'),_0x575aef[_0xebd8('0x5a')][_0xebd8('0x5b')]);var _0xf70fa2=path['join'](config[_0xebd8('0x5d')],_0xebd8('0x51'),util[_0xebd8('0x55')](_0xebd8('0x56'),path[_0xebd8('0x57')](_0x575aef['file'][_0xebd8('0x5b')],path[_0xebd8('0x59')](_0x575aef[_0xebd8('0x5a')]['filename'])),_0x423337['converted_format']));logger[_0xebd8('0x5f')](_0xebd8('0x60'),_0x248df9);logger['info'](_0xebd8('0x61'),_0xf70fa2);try{fs[_0xebd8('0x62')](_0x248df9,parseInt(_0xebd8('0x63'),0x8));var _0x4b94f6=sox['transcode'](_0x248df9,_0xf70fa2,{'sampleRate':0x1f40,'format':_0xebd8('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4b94f6['on'](_0xebd8('0x64'),function(_0x2ddaa4){fs[_0xebd8('0x65')](_0x248df9);_0x1a3b55[_0xebd8('0x1b')](0x1f4)[_0xebd8('0x2d')](_0x2ddaa4);});_0x4b94f6['on'](_0xebd8('0x66'),function(_0x2d764c){_0x423337['original_duration']=isNaN(_0x2d764c[_0xebd8('0x67')])?null:_0x2d764c[_0xebd8('0x67')]*0x3e8;_0x423337[_0xebd8('0x68')]=isNaN(_0x2d764c['sampleCount'])?null:_0x2d764c[_0xebd8('0x69')];_0x423337['original_channelCount']=isNaN(_0x2d764c[_0xebd8('0x6a')])?null:_0x2d764c['channelCount'];_0x423337[_0xebd8('0x6b')]=isNaN(_0x2d764c['bitRate'])?null:_0x2d764c['bitRate'];_0x423337[_0xebd8('0x6c')]=isNaN(_0x2d764c['sampleRate'])?null:_0x2d764c[_0xebd8('0x6d')];});_0x4b94f6['on'](_0xebd8('0x6e'),function(_0x2a65e2){_0x423337['converted_duration']=isNaN(_0x2a65e2['duration'])?null:_0x2a65e2[_0xebd8('0x67')]*0x3e8;_0x423337[_0xebd8('0x6f')]=isNaN(_0x2a65e2['sampleCount'])?null:_0x2a65e2[_0xebd8('0x69')];_0x423337[_0xebd8('0x70')]=isNaN(_0x2a65e2[_0xebd8('0x6a')])?null:_0x2a65e2[_0xebd8('0x6a')];_0x423337['converted_bitRate']=isNaN(_0x2a65e2[_0xebd8('0x71')])?null:_0x2a65e2[_0xebd8('0x71')];_0x423337[_0xebd8('0x72')]=isNaN(_0x2a65e2[_0xebd8('0x6d')])?null:_0x2a65e2[_0xebd8('0x6d')];});_0x4b94f6['on'](_0xebd8('0x2b'),function(){fs[_0xebd8('0x62')](_0xf70fa2,parseInt('0777',0x8));return db[_0xebd8('0x2f')]['create'](_0x423337)[_0xebd8('0x26')](function(_0x14bfd0){var _0xbaa603={'role':_0x575aef[_0xebd8('0x73')]['role'],'userProfileId':_0x575aef['body'][_0xebd8('0x74')]};if(!_0xbaa603)throw new Error(_0xebd8('0x75'));if(_0xbaa603[_0xebd8('0x76')]==='user'){var _0x2fc60a=_0x14bfd0['get']({'plain':!![]});return db[_0xebd8('0x77')][_0xebd8('0x4c')]({'where':{'name':_0xebd8('0x29'),'userProfileId':_0xbaa603[_0xebd8('0x74')]},'raw':!![]})[_0xebd8('0x26')](function(_0x273702){if(_0x273702&&_0x273702[_0xebd8('0x78')]===0x0){return db[_0xebd8('0x2a')][_0xebd8('0x79')]({'name':_0x2fc60a['name'],'resourceId':_0x2fc60a['id'],'type':_0x273702['name'],'sectionId':_0x273702['id']},{})[_0xebd8('0x26')](function(){return _0x14bfd0;});}else{return _0x14bfd0;}})[_0xebd8('0x46')](function(_0x15483e){logger['error'](_0xebd8('0x7a'),_0x15483e);throw _0x15483e;});}return _0x14bfd0;})['then'](respondWithResult(_0x1a3b55,null))[_0xebd8('0x46')](handleError(_0x1a3b55,null));});_0x4b94f6['start']();}catch(_0x50c521){_0x1a3b55[_0xebd8('0x1b')](0x1f4)[_0xebd8('0x2d')](_0x50c521);}};exports[_0xebd8('0x25')]=function(_0x37304f,_0x575588,_0xa2b556){return db[_0xebd8('0x2f')][_0xebd8('0x4c')]({'where':{'id':_0x37304f['params']['id']}})['then'](handleEntityNotFound(_0x575588,null))[_0xebd8('0x26')](saveUpdates(_[_0xebd8('0x3d')](_0x37304f[_0xebd8('0x73')],[_0xebd8('0x34'),'description']),null))[_0xebd8('0x26')](respondWithResult(_0x575588,null))[_0xebd8('0x46')](handleError(_0x575588,null));};exports[_0xebd8('0x7b')]=function(_0x383da4,_0xccbf4b,_0x5188e7){return db[_0xebd8('0x2f')]['find']({'where':{'id':_0x383da4['params']['id']}})[_0xebd8('0x26')](function(_0x1f53e){if(_0x1f53e){return _0x1f53e['destroy']();}})[_0xebd8('0x26')](function(_0x53e97b){var _0x227724=path[_0xebd8('0x50')](config[_0xebd8('0x5d')],_0xebd8('0x5e'),util[_0xebd8('0x55')](_0xebd8('0x56'),_0x53e97b[_0xebd8('0x4d')],_0x53e97b['original_format']));var _0x27250c=path[_0xebd8('0x50')](config[_0xebd8('0x5d')],_0xebd8('0x51'),util[_0xebd8('0x55')]('%s.%s',_0x53e97b['save_name'],_0x53e97b[_0xebd8('0x4e')]));fs[_0xebd8('0x65')](_0x227724);fs[_0xebd8('0x65')](_0x27250c);return _0x53e97b;})[_0xebd8('0x26')](function(_0x358336){if(_0x358336){return _0xccbf4b[_0xebd8('0x1b')](0xcc)['end']();}})['then'](handleEntityNotFound(_0xccbf4b,null))[_0xebd8('0x46')](handleError(_0xccbf4b,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 4138236..80d9d5c 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 _0x314a=['rimraf','../../config/environment','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x314a,0xd2));var _0xa314=function(_0x569fef,_0x49c37a){_0x569fef=_0x569fef-0x0;var _0x11f20b=_0x314a[_0x569fef];return _0x11f20b;};'use strict';var _=require(_0xa314('0x0'));var util=require(_0xa314('0x1'));var logger=require(_0xa314('0x2'))(_0xa314('0x3'));var moment=require('moment');var BPromise=require(_0xa314('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa314('0x5'));var rimraf=require(_0xa314('0x6'));var config=require(_0xa314('0x7'));var attributes=require('./sound.attributes');module[_0xa314('0x8')]=function(_0x5b166c,_0x556b1b){return _0x5b166c[_0xa314('0x9')](_0xa314('0xa'),attributes,{'tableName':_0xa314('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1ca=['exports','Sound','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe1ca,0x183));var _0xae1c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe1ca[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xae1c('0x0'));var util=require(_0xae1c('0x1'));var logger=require(_0xae1c('0x2'))(_0xae1c('0x3'));var moment=require('moment');var BPromise=require(_0xae1c('0x4'));var rp=require(_0xae1c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae1c('0x6'));var config=require(_0xae1c('0x7'));var attributes=require(_0xae1c('0x8'));module[_0xae1c('0x9')]=function(_0x2d2753,_0x486066){return _0x2d2753['define'](_0xae1c('0xa'),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 0433f09..9f97a41 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 _0x6451=['then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSound','Sound','options','where','include','map','model','attributes'];(function(_0x492221,_0x9e2521){var _0x398bf9=function(_0x303c5b){while(--_0x303c5b){_0x492221['push'](_0x492221['shift']());}};_0x398bf9(++_0x9e2521);}(_0x6451,0x1f1));var _0x1645=function(_0x184772,_0x169901){_0x184772=_0x184772-0x0;var _0x27b6fa=_0x6451[_0x184772];return _0x27b6fa;};'use strict';var _=require(_0x1645('0x0'));var util=require(_0x1645('0x1'));var moment=require(_0x1645('0x2'));var BPromise=require(_0x1645('0x3'));var rs=require(_0x1645('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1645('0x5'))['db'];var utils=require(_0x1645('0x6'));var logger=require(_0x1645('0x7'))('rpc');var config=require(_0x1645('0x8'));var jayson=require(_0x1645('0x9'));var client=jayson['client'][_0x1645('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x455050,_0x2c84c1,_0x507671){return new BPromise(function(_0x47adc7,_0x25988a){return client[_0x1645('0xb')](_0x455050,_0x507671)['then'](function(_0xdfc509){logger[_0x1645('0xc')](_0x1645('0xd'),_0x2c84c1,_0x1645('0xe'));logger[_0x1645('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x2c84c1,'request\x20sent',JSON[_0x1645('0x10')](_0xdfc509));if(_0xdfc509[_0x1645('0x11')]){if(_0xdfc509[_0x1645('0x11')][_0x1645('0x12')]===0x1f4){logger[_0x1645('0x11')](_0x1645('0xd'),_0x2c84c1,_0xdfc509[_0x1645('0x11')][_0x1645('0x13')]);return _0x25988a(_0xdfc509[_0x1645('0x11')][_0x1645('0x13')]);}logger[_0x1645('0x11')](_0x1645('0xd'),_0x2c84c1,_0xdfc509[_0x1645('0x11')]['message']);return _0x47adc7(_0xdfc509['error']['message']);}else{logger[_0x1645('0xc')](_0x1645('0xd'),_0x2c84c1,'request\x20sent');_0x47adc7(_0xdfc509[_0x1645('0x14')][_0x1645('0x13')]);}})[_0x1645('0x15')](function(_0x1082d1){logger[_0x1645('0x11')](_0x1645('0xd'),_0x2c84c1,_0x1082d1);_0x25988a(_0x1082d1);});});}exports[_0x1645('0x16')]=function(_0x3ff9bf){var _0x2d6bc2=this;return new Promise(function(_0x8071df,_0x2c4e24){return db[_0x1645('0x17')]['find']({'raw':_0x3ff9bf[_0x1645('0x18')]?_0x3ff9bf[_0x1645('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3ff9bf['options']?_0x3ff9bf[_0x1645('0x18')][_0x1645('0x19')]||null:null,'attributes':_0x3ff9bf['options']?_0x3ff9bf[_0x1645('0x18')]['attributes']||null:null,'include':_0x3ff9bf[_0x1645('0x18')]?_0x3ff9bf[_0x1645('0x18')][_0x1645('0x1a')]?_[_0x1645('0x1b')](_0x3ff9bf[_0x1645('0x18')]['include'],function(_0x501303){return{'model':db[_0x501303[_0x1645('0x1c')]],'as':_0x501303['as'],'attributes':_0x501303[_0x1645('0x1d')],'include':_0x501303[_0x1645('0x1a')]?_['map'](_0x501303['include'],function(_0x48749b){return{'model':db[_0x48749b['model']],'as':_0x48749b['as'],'attributes':_0x48749b['attributes'],'include':_0x48749b[_0x1645('0x1a')]?_['map'](_0x48749b[_0x1645('0x1a')],function(_0x1eff84){return{'model':db[_0x1eff84[_0x1645('0x1c')]],'as':_0x1eff84['as'],'attributes':_0x1eff84[_0x1645('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1645('0x1e')](function(_0x5be352){logger[_0x1645('0xc')](_0x1645('0x16'),_0x3ff9bf);logger['debug'](_0x1645('0x16'),_0x3ff9bf,JSON[_0x1645('0x10')](_0x5be352));_0x8071df(_0x5be352);})[_0x1645('0x15')](function(_0x37d6f2){logger[_0x1645('0x11')](_0x1645('0x16'),_0x37d6f2[_0x1645('0x13')],_0x3ff9bf);_0x2c4e24(_0x2d6bc2[_0x1645('0x11')](0x1f4,_0x37d6f2[_0x1645('0x13')]));});});}; \ No newline at end of file +var _0xb5bb=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSound','Sound','find','options','raw','where','include','model','attributes','map','lodash','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','Sound,\x20%s,\x20%s'];(function(_0x429406,_0x1c946a){var _0x48b6e9=function(_0x6a50bc){while(--_0x6a50bc){_0x429406['push'](_0x429406['shift']());}};_0x48b6e9(++_0x1c946a);}(_0xb5bb,0x1ee));var _0xbb5b=function(_0x573751,_0x2f7311){_0x573751=_0x573751-0x0;var _0x49cb9b=_0xb5bb[_0x573751];return _0x49cb9b;};'use strict';var _=require(_0xbb5b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb5b('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbb5b('0x2'))(_0xbb5b('0x3'));var config=require(_0xbb5b('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb5b('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x3b1c6e,_0xcbf9d0,_0x462763){return new BPromise(function(_0x497115,_0x2e695b){return client[_0xbb5b('0x6')](_0x3b1c6e,_0x462763)[_0xbb5b('0x7')](function(_0x3942ba){logger[_0xbb5b('0x8')](_0xbb5b('0x9'),_0xcbf9d0,_0xbb5b('0xa'));logger[_0xbb5b('0xb')](_0xbb5b('0xc'),_0xcbf9d0,_0xbb5b('0xa'),JSON[_0xbb5b('0xd')](_0x3942ba));if(_0x3942ba[_0xbb5b('0xe')]){if(_0x3942ba[_0xbb5b('0xe')]['code']===0x1f4){logger[_0xbb5b('0xe')](_0xbb5b('0x9'),_0xcbf9d0,_0x3942ba[_0xbb5b('0xe')]['message']);return _0x2e695b(_0x3942ba[_0xbb5b('0xe')][_0xbb5b('0xf')]);}logger['error']('Sound,\x20%s,\x20%s',_0xcbf9d0,_0x3942ba[_0xbb5b('0xe')]['message']);return _0x497115(_0x3942ba[_0xbb5b('0xe')][_0xbb5b('0xf')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0xcbf9d0,_0xbb5b('0xa'));_0x497115(_0x3942ba[_0xbb5b('0x10')][_0xbb5b('0xf')]);}})[_0xbb5b('0x11')](function(_0x2da7e9){logger[_0xbb5b('0xe')](_0xbb5b('0x9'),_0xcbf9d0,_0x2da7e9);_0x2e695b(_0x2da7e9);});});}exports[_0xbb5b('0x12')]=function(_0x5ee722){var _0x5eafcb=this;return new Promise(function(_0x5c4c3a,_0x3e232e){return db[_0xbb5b('0x13')][_0xbb5b('0x14')]({'raw':_0x5ee722['options']?_0x5ee722[_0xbb5b('0x15')][_0xbb5b('0x16')]===undefined?!![]:![]:!![],'where':_0x5ee722['options']?_0x5ee722[_0xbb5b('0x15')][_0xbb5b('0x17')]||null:null,'attributes':_0x5ee722[_0xbb5b('0x15')]?_0x5ee722[_0xbb5b('0x15')]['attributes']||null:null,'include':_0x5ee722['options']?_0x5ee722[_0xbb5b('0x15')]['include']?_['map'](_0x5ee722['options'][_0xbb5b('0x18')],function(_0x35f179){return{'model':db[_0x35f179[_0xbb5b('0x19')]],'as':_0x35f179['as'],'attributes':_0x35f179[_0xbb5b('0x1a')],'include':_0x35f179[_0xbb5b('0x18')]?_[_0xbb5b('0x1b')](_0x35f179[_0xbb5b('0x18')],function(_0x4667d8){return{'model':db[_0x4667d8['model']],'as':_0x4667d8['as'],'attributes':_0x4667d8[_0xbb5b('0x1a')],'include':_0x4667d8[_0xbb5b('0x18')]?_[_0xbb5b('0x1b')](_0x4667d8[_0xbb5b('0x18')],function(_0x544ffe){return{'model':db[_0x544ffe[_0xbb5b('0x19')]],'as':_0x544ffe['as'],'attributes':_0x544ffe[_0xbb5b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x226482){logger[_0xbb5b('0x8')](_0xbb5b('0x12'),_0x5ee722);logger[_0xbb5b('0xb')](_0xbb5b('0x12'),_0x5ee722,JSON[_0xbb5b('0xd')](_0x226482));_0x5c4c3a(_0x226482);})['catch'](function(_0x4dfb3b){logger[_0xbb5b('0xe')](_0xbb5b('0x12'),_0x4dfb3b[_0xbb5b('0xf')],_0x5ee722);_0x3e232e(_0x5eafcb['error'](0x1f4,_0x4dfb3b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index cbec18d..bbdcc85 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x2f91a6,_0x4e44ff){var _0x324cb5=function(_0x452102){while(--_0x452102){_0x2f91a6['push'](_0x2f91a6['shift']());}};_0x324cb5(++_0x4e44ff);}(_0xda3f,0xec));var _0xfda3=function(_0x58d90e,_0x3454b2){_0x58d90e=_0x58d90e-0x0;var _0x596bec=_0xda3f[_0x58d90e];return _0x596bec;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0xea4f3a,_0x46d2e6){var _0x88e3dd=function(_0x3470de){while(--_0x3470de){_0xea4f3a['push'](_0xea4f3a['shift']());}};_0x88e3dd(++_0x46d2e6);}(_0x2032,0xd9));var _0x2203=function(_0x26d8fd,_0x5793a4){_0x26d8fd=_0x26d8fd-0x0;var _0x30bed3=_0x2032[_0x26d8fd];return _0x30bed3;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 4368bfe..476440b 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 _0x855c=['TEXT','sequelize','exports','ENUM','out'];(function(_0x16a4b5,_0x3a020b){var _0x1e2bf0=function(_0xc6cba9){while(--_0xc6cba9){_0x16a4b5['push'](_0x16a4b5['shift']());}};_0x1e2bf0(++_0x3a020b);}(_0x855c,0x88));var _0xc855=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x855c[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xc855('0x0'));module[_0xc855('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xc855('0x2')]('in',_0xc855('0x3')),'defaultValue':_0xc855('0x3'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc855('0x4')]}}; \ No newline at end of file +var _0xf5df=['STRING','TEXT','ENUM','out','sequelize','exports'];(function(_0x2730cc,_0x457ebd){var _0x28b23b=function(_0x360ffa){while(--_0x360ffa){_0x2730cc['push'](_0x2730cc['shift']());}};_0x28b23b(++_0x457ebd);}(_0xf5df,0x70));var _0xff5d=function(_0x47b32d,_0x3f56da){_0x47b32d=_0x47b32d-0x0;var _0x3daf85=_0xf5df[_0x47b32d];return _0x3daf85;};'use strict';var Sequelize=require(_0xff5d('0x0'));module[_0xff5d('0x1')]={'uniqueid':{'type':Sequelize[_0xff5d('0x2')]},'body':{'type':Sequelize[_0xff5d('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xff5d('0x4')]('in',_0xff5d('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xff5d('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index d3935b2..1f8ccfa 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 _0xace6=['util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','body','find','destroy','eml-format','rimraf','request-promise','moment','bluebird','mustache'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xace6,0xd5));var _0x6ace=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xace6[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x6ace('0x0'));var rimraf=require(_0x6ace('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6ace('0x2'));var moment=require(_0x6ace('0x3'));var BPromise=require(_0x6ace('0x4'));var Mustache=require(_0x6ace('0x5'));var util=require(_0x6ace('0x6'));var path=require(_0x6ace('0x7'));var sox=require(_0x6ace('0x8'));var csv=require(_0x6ace('0x9'));var ejs=require(_0x6ace('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ace('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6ace('0xc'));var deskjs=require(_0x6ace('0xd'));var toCsv=require(_0x6ace('0x9'));var querystring=require(_0x6ace('0xe'));var Papa=require(_0x6ace('0xf'));var Redis=require(_0x6ace('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6ace('0x11'));var hardwareService=require(_0x6ace('0x12'));var logger=require(_0x6ace('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x6ace('0x14'));var licenseUtil=require(_0x6ace('0x15'));var db=require(_0x6ace('0x16'))['db'];function respondWithStatusCode(_0x1c53eb,_0x53d458){_0x53d458=_0x53d458||0xcc;return function(_0x3fc0e8){if(_0x3fc0e8){return _0x1c53eb['sendStatus'](_0x53d458);}return _0x1c53eb[_0x6ace('0x17')](_0x53d458)[_0x6ace('0x18')]();};}function respondWithResult(_0x320002,_0x11119b){_0x11119b=_0x11119b||0xc8;return function(_0x3bf0eb){if(_0x3bf0eb){return _0x320002[_0x6ace('0x17')](_0x11119b)['json'](_0x3bf0eb);}};}function respondWithFilteredResult(_0x36602d,_0x4e25cd){return function(_0x2fab0b){if(_0x2fab0b){var _0x38ae67=typeof _0x4e25cd[_0x6ace('0x19')]===_0x6ace('0x1a')&&typeof _0x4e25cd[_0x6ace('0x1b')]===_0x6ace('0x1a');var _0x4d0e26=_0x2fab0b[_0x6ace('0x1c')];var _0x81ae6=_0x38ae67?0x0:_0x4e25cd[_0x6ace('0x19')];var _0x4d97c0=_0x38ae67?_0x2fab0b[_0x6ace('0x1c')]:_0x4e25cd[_0x6ace('0x19')]+_0x4e25cd[_0x6ace('0x1b')];var _0x468257;if(_0x4d97c0>=_0x4d0e26){_0x4d97c0=_0x4d0e26;_0x468257=0xc8;}else{_0x468257=0xce;}_0x36602d[_0x6ace('0x17')](_0x468257);return _0x36602d[_0x6ace('0x1d')]('Content-Range',_0x81ae6+'-'+_0x4d97c0+'/'+_0x4d0e26)[_0x6ace('0x1e')](_0x2fab0b);}return null;};}function patchUpdates(_0x32f122){return function(_0x3d0893){try{jsonpatch[_0x6ace('0x1f')](_0x3d0893,_0x32f122,!![]);}catch(_0x4dbeb3){return BPromise[_0x6ace('0x20')](_0x4dbeb3);}return _0x3d0893[_0x6ace('0x21')]();};}function saveUpdates(_0x5ef992,_0x5d7477){return function(_0x4d5e49){if(_0x4d5e49){return _0x4d5e49[_0x6ace('0x22')](_0x5ef992)[_0x6ace('0x23')](function(_0x3cccc3){return _0x3cccc3;});}return null;};}function removeEntity(_0x417b32,_0x45e73a){return function(_0x1badd6){if(_0x1badd6){return _0x1badd6['destroy']()[_0x6ace('0x23')](function(){_0x417b32['status'](0xcc)[_0x6ace('0x18')]();});}};}function handleEntityNotFound(_0x10d811,_0x56e5ae){return function(_0x45ca14){if(!_0x45ca14){_0x10d811[_0x6ace('0x24')](0x194);}return _0x45ca14;};}function handleError(_0x435cfa,_0x5d162d){_0x5d162d=_0x5d162d||0x1f4;return function(_0xc5bb6){logger[_0x6ace('0x25')](_0xc5bb6[_0x6ace('0x26')]);if(_0xc5bb6[_0x6ace('0x27')]){delete _0xc5bb6[_0x6ace('0x27')];}_0x435cfa[_0x6ace('0x17')](_0x5d162d)[_0x6ace('0x28')](_0xc5bb6);};}exports[_0x6ace('0x29')]=function(_0x2ac2d9,_0x45511f){var _0x46e35d={},_0x22bb75={},_0xf8ab6a={'count':0x0,'rows':[]};var _0x4c191f=_[_0x6ace('0x2a')](db[_0x6ace('0x2b')][_0x6ace('0x2c')],function(_0x2994be){return{'name':_0x2994be[_0x6ace('0x2d')],'type':_0x2994be[_0x6ace('0x2e')][_0x6ace('0x2f')]};});_0x22bb75[_0x6ace('0x30')]=_['map'](_0x4c191f,_0x6ace('0x27'));_0x22bb75['query']=_['keys'](_0x2ac2d9[_0x6ace('0x31')]);_0x22bb75[_0x6ace('0x32')]=_[_0x6ace('0x33')](_0x22bb75[_0x6ace('0x30')],_0x22bb75[_0x6ace('0x31')]);_0x46e35d[_0x6ace('0x34')]=_['intersection'](_0x22bb75[_0x6ace('0x30')],qs[_0x6ace('0x35')](_0x2ac2d9[_0x6ace('0x31')][_0x6ace('0x35')]));_0x46e35d[_0x6ace('0x34')]=_0x46e35d[_0x6ace('0x34')]['length']?_0x46e35d[_0x6ace('0x34')]:_0x22bb75[_0x6ace('0x30')];if(!_0x2ac2d9[_0x6ace('0x31')][_0x6ace('0x36')]('nolimit')){_0x46e35d[_0x6ace('0x1b')]=qs[_0x6ace('0x1b')](_0x2ac2d9['query'][_0x6ace('0x1b')]);_0x46e35d['offset']=qs[_0x6ace('0x19')](_0x2ac2d9[_0x6ace('0x31')][_0x6ace('0x19')]);}_0x46e35d[_0x6ace('0x37')]=qs[_0x6ace('0x38')](_0x2ac2d9[_0x6ace('0x31')]['sort']);_0x46e35d[_0x6ace('0x39')]=qs[_0x6ace('0x32')](_[_0x6ace('0x3a')](_0x2ac2d9['query'],_0x22bb75['filters']),_0x4c191f);if(_0x2ac2d9[_0x6ace('0x31')][_0x6ace('0x3b')]){_0x46e35d[_0x6ace('0x39')]=_['merge'](_0x46e35d[_0x6ace('0x39')],{'$or':_['map'](_0x4c191f,function(_0x94be53){if(_0x94be53['type']!=='VIRTUAL'){var _0x424deb={};_0x424deb[_0x94be53[_0x6ace('0x27')]]={'$like':'%'+_0x2ac2d9[_0x6ace('0x31')][_0x6ace('0x3b')]+'%'};return _0x424deb;}})});}_0x46e35d=_[_0x6ace('0x3c')]({},_0x46e35d,_0x2ac2d9[_0x6ace('0x3d')]);var _0x3f77c5={'where':_0x46e35d['where']};return db[_0x6ace('0x2b')][_0x6ace('0x1c')](_0x3f77c5)['then'](function(_0x1b81fa){_0xf8ab6a['count']=_0x1b81fa;if(_0x2ac2d9['query'][_0x6ace('0x3e')]){_0x46e35d['include']=[{'all':!![]}];}return db['SquareMessage'][_0x6ace('0x3f')](_0x46e35d);})[_0x6ace('0x23')](function(_0x49cfd7){_0xf8ab6a[_0x6ace('0x40')]=_0x49cfd7;return _0xf8ab6a;})[_0x6ace('0x23')](respondWithFilteredResult(_0x45511f,_0x46e35d))[_0x6ace('0x41')](handleError(_0x45511f,null));};exports[_0x6ace('0x42')]=function(_0x49fd82,_0x2d8537){var _0x967488={'raw':!![],'where':{'id':_0x49fd82[_0x6ace('0x43')]['id']}},_0x10f5f9={};_0x10f5f9[_0x6ace('0x30')]=_[_0x6ace('0x44')](db['SquareMessage'][_0x6ace('0x2c')]);_0x10f5f9[_0x6ace('0x31')]=_[_0x6ace('0x44')](_0x49fd82[_0x6ace('0x31')]);_0x10f5f9[_0x6ace('0x32')]=_[_0x6ace('0x33')](_0x10f5f9[_0x6ace('0x30')],_0x10f5f9[_0x6ace('0x31')]);_0x967488['attributes']=_[_0x6ace('0x33')](_0x10f5f9[_0x6ace('0x30')],qs[_0x6ace('0x35')](_0x49fd82[_0x6ace('0x31')]['fields']));_0x967488[_0x6ace('0x34')]=_0x967488['attributes'][_0x6ace('0x45')]?_0x967488['attributes']:_0x10f5f9['model'];if(_0x49fd82[_0x6ace('0x31')][_0x6ace('0x3e')]){_0x967488['include']=[{'all':!![]}];}_0x967488=_[_0x6ace('0x3c')]({},_0x967488,_0x49fd82['options']);return db[_0x6ace('0x2b')]['find'](_0x967488)[_0x6ace('0x23')](handleEntityNotFound(_0x2d8537,null))['then'](respondWithResult(_0x2d8537,null))['catch'](handleError(_0x2d8537,null));};exports['create']=function(_0x4d2d3b,_0x358a7b){return db[_0x6ace('0x2b')]['create'](_0x4d2d3b[_0x6ace('0x46')],{})[_0x6ace('0x23')](respondWithResult(_0x358a7b,0xc9))['catch'](handleError(_0x358a7b,null));};exports['update']=function(_0x34706f,_0x1243a2){if(_0x34706f['body']['id']){delete _0x34706f['body']['id'];}return db['SquareMessage'][_0x6ace('0x47')]({'where':{'id':_0x34706f['params']['id']}})[_0x6ace('0x23')](handleEntityNotFound(_0x1243a2,null))[_0x6ace('0x23')](saveUpdates(_0x34706f[_0x6ace('0x46')],null))['then'](respondWithResult(_0x1243a2,null))['catch'](handleError(_0x1243a2,null));};exports[_0x6ace('0x48')]=function(_0x3376aa,_0x36e95e){return db[_0x6ace('0x2b')][_0x6ace('0x47')]({'where':{'id':_0x3376aa[_0x6ace('0x43')]['id']}})[_0x6ace('0x23')](handleEntityNotFound(_0x36e95e,null))[_0x6ace('0x23')](removeEntity(_0x36e95e,null))[_0x6ace('0x41')](handleError(_0x36e95e,null));}; \ No newline at end of file +var _0x829e=['offset','set','apply','reject','save','destroy','then','end','error','stack','send','map','SquareMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','where','filter','merge','includeAll','include','findAll','show','params','length','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count'];(function(_0x291cb2,_0x45ec6e){var _0x568eee=function(_0x2202cf){while(--_0x2202cf){_0x291cb2['push'](_0x291cb2['shift']());}};_0x568eee(++_0x45ec6e);}(_0x829e,0xaa));var _0xe829=function(_0x4a7b0d,_0x349a5e){_0x4a7b0d=_0x4a7b0d-0x0;var _0x4586a2=_0x829e[_0x4a7b0d];return _0x4586a2;};'use strict';var emlformat=require(_0xe829('0x0'));var rimraf=require(_0xe829('0x1'));var zipdir=require(_0xe829('0x2'));var jsonpatch=require(_0xe829('0x3'));var rp=require(_0xe829('0x4'));var moment=require('moment');var BPromise=require(_0xe829('0x5'));var Mustache=require('mustache');var util=require(_0xe829('0x6'));var path=require(_0xe829('0x7'));var sox=require(_0xe829('0x8'));var csv=require('to-csv');var ejs=require(_0xe829('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe829('0xa'));var crypto=require('crypto');var jsforce=require(_0xe829('0xb'));var deskjs=require(_0xe829('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe829('0xd'));var Redis=require('ioredis');var authService=require(_0xe829('0xe'));var qs=require(_0xe829('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe829('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe829('0x11'));var db=require(_0xe829('0x12'))['db'];function respondWithStatusCode(_0x594afa,_0x226ae7){_0x226ae7=_0x226ae7||0xcc;return function(_0x35b3ac){if(_0x35b3ac){return _0x594afa[_0xe829('0x13')](_0x226ae7);}return _0x594afa[_0xe829('0x14')](_0x226ae7)['end']();};}function respondWithResult(_0x420e3d,_0x42cf79){_0x42cf79=_0x42cf79||0xc8;return function(_0x568ed7){if(_0x568ed7){return _0x420e3d[_0xe829('0x14')](_0x42cf79)[_0xe829('0x15')](_0x568ed7);}};}function respondWithFilteredResult(_0xcfcd3,_0x1a9507){return function(_0x4e40be){if(_0x4e40be){var _0x533aac=typeof _0x1a9507['offset']===_0xe829('0x16')&&typeof _0x1a9507[_0xe829('0x17')]===_0xe829('0x16');var _0x4e7f36=_0x4e40be[_0xe829('0x18')];var _0xa130f9=_0x533aac?0x0:_0x1a9507[_0xe829('0x19')];var _0x117efc=_0x533aac?_0x4e40be[_0xe829('0x18')]:_0x1a9507[_0xe829('0x19')]+_0x1a9507[_0xe829('0x17')];var _0x5c7f69;if(_0x117efc>=_0x4e7f36){_0x117efc=_0x4e7f36;_0x5c7f69=0xc8;}else{_0x5c7f69=0xce;}_0xcfcd3[_0xe829('0x14')](_0x5c7f69);return _0xcfcd3[_0xe829('0x1a')]('Content-Range',_0xa130f9+'-'+_0x117efc+'/'+_0x4e7f36)[_0xe829('0x15')](_0x4e40be);}return null;};}function patchUpdates(_0x27a582){return function(_0x5e5a01){try{jsonpatch[_0xe829('0x1b')](_0x5e5a01,_0x27a582,!![]);}catch(_0x445c18){return BPromise[_0xe829('0x1c')](_0x445c18);}return _0x5e5a01[_0xe829('0x1d')]();};}function saveUpdates(_0x100162,_0x563bdc){return function(_0x1fbd95){if(_0x1fbd95){return _0x1fbd95['update'](_0x100162)['then'](function(_0x109e82){return _0x109e82;});}return null;};}function removeEntity(_0x36b192,_0x48ed79){return function(_0x56a4c5){if(_0x56a4c5){return _0x56a4c5[_0xe829('0x1e')]()[_0xe829('0x1f')](function(){_0x36b192[_0xe829('0x14')](0xcc)[_0xe829('0x20')]();});}};}function handleEntityNotFound(_0x492b96,_0x116d5a){return function(_0x3133f4){if(!_0x3133f4){_0x492b96[_0xe829('0x13')](0x194);}return _0x3133f4;};}function handleError(_0x2bb0ac,_0x27c5fb){_0x27c5fb=_0x27c5fb||0x1f4;return function(_0x45f563){logger[_0xe829('0x21')](_0x45f563[_0xe829('0x22')]);if(_0x45f563['name']){delete _0x45f563['name'];}_0x2bb0ac[_0xe829('0x14')](_0x27c5fb)[_0xe829('0x23')](_0x45f563);};}exports['index']=function(_0xb41b80,_0x36fb2a){var _0x3aa86b={},_0x107412={},_0x1ee6eb={'count':0x0,'rows':[]};var _0x526fa1=_[_0xe829('0x24')](db[_0xe829('0x25')][_0xe829('0x26')],function(_0x2fb560){return{'name':_0x2fb560[_0xe829('0x27')],'type':_0x2fb560[_0xe829('0x28')][_0xe829('0x29')]};});_0x107412[_0xe829('0x2a')]=_['map'](_0x526fa1,_0xe829('0x2b'));_0x107412[_0xe829('0x2c')]=_[_0xe829('0x2d')](_0xb41b80[_0xe829('0x2c')]);_0x107412[_0xe829('0x2e')]=_['intersection'](_0x107412[_0xe829('0x2a')],_0x107412[_0xe829('0x2c')]);_0x3aa86b[_0xe829('0x2f')]=_[_0xe829('0x30')](_0x107412[_0xe829('0x2a')],qs[_0xe829('0x31')](_0xb41b80['query'][_0xe829('0x31')]));_0x3aa86b[_0xe829('0x2f')]=_0x3aa86b['attributes']['length']?_0x3aa86b[_0xe829('0x2f')]:_0x107412[_0xe829('0x2a')];if(!_0xb41b80['query'][_0xe829('0x32')]('nolimit')){_0x3aa86b[_0xe829('0x17')]=qs['limit'](_0xb41b80[_0xe829('0x2c')][_0xe829('0x17')]);_0x3aa86b[_0xe829('0x19')]=qs['offset'](_0xb41b80[_0xe829('0x2c')][_0xe829('0x19')]);}_0x3aa86b['order']=qs['sort'](_0xb41b80[_0xe829('0x2c')]['sort']);_0x3aa86b[_0xe829('0x33')]=qs[_0xe829('0x2e')](_['pick'](_0xb41b80[_0xe829('0x2c')],_0x107412[_0xe829('0x2e')]),_0x526fa1);if(_0xb41b80['query'][_0xe829('0x34')]){_0x3aa86b[_0xe829('0x33')]=_[_0xe829('0x35')](_0x3aa86b[_0xe829('0x33')],{'$or':_[_0xe829('0x24')](_0x526fa1,function(_0x18c342){if(_0x18c342[_0xe829('0x28')]!=='VIRTUAL'){var _0x3e4c83={};_0x3e4c83[_0x18c342['name']]={'$like':'%'+_0xb41b80[_0xe829('0x2c')][_0xe829('0x34')]+'%'};return _0x3e4c83;}})});}_0x3aa86b=_[_0xe829('0x35')]({},_0x3aa86b,_0xb41b80['options']);var _0x4068ba={'where':_0x3aa86b[_0xe829('0x33')]};return db[_0xe829('0x25')][_0xe829('0x18')](_0x4068ba)[_0xe829('0x1f')](function(_0x526ff7){_0x1ee6eb[_0xe829('0x18')]=_0x526ff7;if(_0xb41b80[_0xe829('0x2c')][_0xe829('0x36')]){_0x3aa86b[_0xe829('0x37')]=[{'all':!![]}];}return db[_0xe829('0x25')][_0xe829('0x38')](_0x3aa86b);})[_0xe829('0x1f')](function(_0x111731){_0x1ee6eb['rows']=_0x111731;return _0x1ee6eb;})[_0xe829('0x1f')](respondWithFilteredResult(_0x36fb2a,_0x3aa86b))['catch'](handleError(_0x36fb2a,null));};exports[_0xe829('0x39')]=function(_0x424acb,_0x352354){var _0x1f4235={'raw':!![],'where':{'id':_0x424acb[_0xe829('0x3a')]['id']}},_0x47a637={};_0x47a637['model']=_[_0xe829('0x2d')](db[_0xe829('0x25')][_0xe829('0x26')]);_0x47a637['query']=_['keys'](_0x424acb[_0xe829('0x2c')]);_0x47a637[_0xe829('0x2e')]=_[_0xe829('0x30')](_0x47a637[_0xe829('0x2a')],_0x47a637['query']);_0x1f4235[_0xe829('0x2f')]=_[_0xe829('0x30')](_0x47a637['model'],qs[_0xe829('0x31')](_0x424acb['query'][_0xe829('0x31')]));_0x1f4235[_0xe829('0x2f')]=_0x1f4235[_0xe829('0x2f')][_0xe829('0x3b')]?_0x1f4235[_0xe829('0x2f')]:_0x47a637['model'];if(_0x424acb['query']['includeAll']){_0x1f4235[_0xe829('0x37')]=[{'all':!![]}];}_0x1f4235=_[_0xe829('0x35')]({},_0x1f4235,_0x424acb[_0xe829('0x3c')]);return db[_0xe829('0x25')][_0xe829('0x3d')](_0x1f4235)[_0xe829('0x1f')](handleEntityNotFound(_0x352354,null))[_0xe829('0x1f')](respondWithResult(_0x352354,null))[_0xe829('0x3e')](handleError(_0x352354,null));};exports[_0xe829('0x3f')]=function(_0x450944,_0x50b57e){return db[_0xe829('0x25')][_0xe829('0x3f')](_0x450944[_0xe829('0x40')],{})[_0xe829('0x1f')](respondWithResult(_0x50b57e,0xc9))[_0xe829('0x3e')](handleError(_0x50b57e,null));};exports['update']=function(_0x2828da,_0xf577e0){if(_0x2828da[_0xe829('0x40')]['id']){delete _0x2828da[_0xe829('0x40')]['id'];}return db[_0xe829('0x25')][_0xe829('0x3d')]({'where':{'id':_0x2828da[_0xe829('0x3a')]['id']}})['then'](handleEntityNotFound(_0xf577e0,null))[_0xe829('0x1f')](saveUpdates(_0x2828da[_0xe829('0x40')],null))[_0xe829('0x1f')](respondWithResult(_0xf577e0,null))[_0xe829('0x3e')](handleError(_0xf577e0,null));};exports['destroy']=function(_0x43416a,_0x144c7e){return db[_0xe829('0x25')][_0xe829('0x3d')]({'where':{'id':_0x43416a['params']['id']}})[_0xe829('0x1f')](handleEntityNotFound(_0x144c7e,null))['then'](removeEntity(_0x144c7e,null))[_0xe829('0x3e')](handleError(_0x144c7e,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index d2e16d9..c1e9888 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 _0x95d2=['./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x15843c,_0x4312ad){var _0x50468f=function(_0x3e816d){while(--_0x3e816d){_0x15843c['push'](_0x15843c['shift']());}};_0x50468f(++_0x4312ad);}(_0x95d2,0x108));var _0x295d=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x95d2[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x295d('0x0'));var util=require(_0x295d('0x1'));var logger=require(_0x295d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x295d('0x3'));var fs=require('fs');var path=require(_0x295d('0x4'));var rimraf=require(_0x295d('0x5'));var config=require('../../config/environment');var attributes=require(_0x295d('0x6'));module[_0x295d('0x7')]=function(_0x1de214,_0x4a1297){return _0x1de214['define'](_0x295d('0x8'),attributes,{'tableName':_0x295d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4055=['../../config/environment','./squareMessage.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x2d01df,_0x429d33){var _0x56e944=function(_0x538aad){while(--_0x538aad){_0x2d01df['push'](_0x2d01df['shift']());}};_0x56e944(++_0x429d33);}(_0x4055,0x1e8));var _0x5405=function(_0x292891,_0x426567){_0x292891=_0x292891-0x0;var _0x5913aa=_0x4055[_0x292891];return _0x5913aa;};'use strict';var _=require(_0x5405('0x0'));var util=require(_0x5405('0x1'));var logger=require(_0x5405('0x2'))(_0x5405('0x3'));var moment=require(_0x5405('0x4'));var BPromise=require(_0x5405('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5405('0x6'));var config=require(_0x5405('0x7'));var attributes=require(_0x5405('0x8'));module[_0x5405('0x9')]=function(_0x1a8771,_0x2dbcb3){return _0x1a8771[_0x5405('0xa')]('SquareMessage',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 6e6c535..1e37b9b 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 _0x1864=['then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','body','options','raw'];(function(_0xf0330b,_0x814253){var _0x538518=function(_0x9c7d43){while(--_0x9c7d43){_0xf0330b['push'](_0xf0330b['shift']());}};_0x538518(++_0x814253);}(_0x1864,0x169));var _0x4186=function(_0x48ba96,_0x2780f0){_0x48ba96=_0x48ba96-0x0;var _0x371a65=_0x1864[_0x48ba96];return _0x371a65;};'use strict';var _=require(_0x4186('0x0'));var util=require('util');var moment=require(_0x4186('0x1'));var BPromise=require(_0x4186('0x2'));var rs=require(_0x4186('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4186('0x4'))['db'];var utils=require(_0x4186('0x5'));var logger=require(_0x4186('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4186('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc09e2b,_0x489f25,_0x14bbbb){return new BPromise(function(_0x570a6f,_0x27feeb){return client['request'](_0xc09e2b,_0x14bbbb)['then'](function(_0x5e45ea){logger[_0x4186('0x8')]('SquareMessage,\x20%s,\x20%s',_0x489f25,_0x4186('0x9'));logger[_0x4186('0xa')](_0x4186('0xb'),_0x489f25,'request\x20sent',JSON[_0x4186('0xc')](_0x5e45ea));if(_0x5e45ea[_0x4186('0xd')]){if(_0x5e45ea[_0x4186('0xd')][_0x4186('0xe')]===0x1f4){logger['error'](_0x4186('0xf'),_0x489f25,_0x5e45ea[_0x4186('0xd')][_0x4186('0x10')]);return _0x27feeb(_0x5e45ea[_0x4186('0xd')]['message']);}logger[_0x4186('0xd')](_0x4186('0xf'),_0x489f25,_0x5e45ea[_0x4186('0xd')][_0x4186('0x10')]);return _0x570a6f(_0x5e45ea['error'][_0x4186('0x10')]);}else{logger[_0x4186('0x8')](_0x4186('0xf'),_0x489f25,'request\x20sent');_0x570a6f(_0x5e45ea[_0x4186('0x11')][_0x4186('0x10')]);}})[_0x4186('0x12')](function(_0x3f31f2){logger['error'](_0x4186('0xf'),_0x489f25,_0x3f31f2);_0x27feeb(_0x3f31f2);});});}exports[_0x4186('0x13')]=function(_0x94105f){var _0x1ce27d=this;return new Promise(function(_0x5ed5e1,_0x499e6c){return db['SquareMessage']['create'](_0x94105f[_0x4186('0x14')],{'raw':_0x94105f['options']?_0x94105f[_0x4186('0x15')][_0x4186('0x16')]===undefined?!![]:![]:!![]})[_0x4186('0x17')](function(_0x21e97f){logger[_0x4186('0x8')]('CreateSquareMessage',_0x94105f);logger['debug']('CreateSquareMessage',_0x94105f,JSON[_0x4186('0xc')](_0x21e97f));_0x5ed5e1(_0x21e97f);})['catch'](function(_0x294eae){logger[_0x4186('0xd')](_0x4186('0x13'),_0x294eae[_0x4186('0x10')],_0x94105f);_0x499e6c(_0x1ce27d[_0x4186('0xd')](0x1f4,_0x294eae['message']));});});}; \ No newline at end of file +var _0x3f57=['request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareMessage,\x20%s,\x20%s','result','CreateSquareMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x4ae9d0,_0xcd7641){var _0x590870=function(_0x263f99){while(--_0x263f99){_0x4ae9d0['push'](_0x4ae9d0['shift']());}};_0x590870(++_0xcd7641);}(_0x3f57,0xf0));var _0x73f5=function(_0x416446,_0x2a85bb){_0x416446=_0x416446-0x0;var _0x1fe97e=_0x3f57[_0x416446];return _0x1fe97e;};'use strict';var _=require(_0x73f5('0x0'));var util=require(_0x73f5('0x1'));var moment=require(_0x73f5('0x2'));var BPromise=require(_0x73f5('0x3'));var rs=require(_0x73f5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73f5('0x5'))['db'];var utils=require(_0x73f5('0x6'));var logger=require(_0x73f5('0x7'))('rpc');var config=require(_0x73f5('0x8'));var jayson=require(_0x73f5('0x9'));var client=jayson[_0x73f5('0xa')][_0x73f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x417a68,_0x19fc33,_0x578963){return new BPromise(function(_0x518d45,_0x573c64){return client[_0x73f5('0xc')](_0x417a68,_0x578963)[_0x73f5('0xd')](function(_0x28209a){logger[_0x73f5('0xe')]('SquareMessage,\x20%s,\x20%s',_0x19fc33,_0x73f5('0xf'));logger[_0x73f5('0x10')](_0x73f5('0x11'),_0x19fc33,'request\x20sent',JSON[_0x73f5('0x12')](_0x28209a));if(_0x28209a[_0x73f5('0x13')]){if(_0x28209a[_0x73f5('0x13')][_0x73f5('0x14')]===0x1f4){logger[_0x73f5('0x13')]('SquareMessage,\x20%s,\x20%s',_0x19fc33,_0x28209a['error'][_0x73f5('0x15')]);return _0x573c64(_0x28209a['error'][_0x73f5('0x15')]);}logger[_0x73f5('0x13')](_0x73f5('0x16'),_0x19fc33,_0x28209a[_0x73f5('0x13')][_0x73f5('0x15')]);return _0x518d45(_0x28209a[_0x73f5('0x13')][_0x73f5('0x15')]);}else{logger['info'](_0x73f5('0x16'),_0x19fc33,'request\x20sent');_0x518d45(_0x28209a[_0x73f5('0x17')]['message']);}})['catch'](function(_0x1d11ac){logger[_0x73f5('0x13')](_0x73f5('0x16'),_0x19fc33,_0x1d11ac);_0x573c64(_0x1d11ac);});});}exports[_0x73f5('0x18')]=function(_0x41d73e){var _0x2df084=this;return new Promise(function(_0x3e5b36,_0x213bbc){return db['SquareMessage'][_0x73f5('0x19')](_0x41d73e['body'],{'raw':_0x41d73e[_0x73f5('0x1a')]?_0x41d73e[_0x73f5('0x1a')][_0x73f5('0x1b')]===undefined?!![]:![]:!![]})[_0x73f5('0xd')](function(_0x383302){logger[_0x73f5('0xe')](_0x73f5('0x18'),_0x41d73e);logger[_0x73f5('0x10')](_0x73f5('0x18'),_0x41d73e,JSON[_0x73f5('0x12')](_0x383302));_0x3e5b36(_0x383302);})['catch'](function(_0x42a8b9){logger[_0x73f5('0x13')]('CreateSquareMessage',_0x42a8b9[_0x73f5('0x15')],_0x41d73e);_0x213bbc(_0x2df084[_0x73f5('0x13')](0x1f4,_0x42a8b9[_0x73f5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index b864dc9..6fd6a36 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 _0xf89e=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','show','/:id/test','15s','post','put','/:id','update','destroy','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf89e,0xe7));var _0xef89=function(_0x4753c0,_0xfe8d06){_0x4753c0=_0x4753c0-0x0;var _0x5a1120=_0xf89e[_0x4753c0];return _0x5a1120;};'use strict';var multer=require('multer');var util=require(_0xef89('0x0'));var path=require(_0xef89('0x1'));var timeout=require('connect-timeout');var express=require(_0xef89('0x2'));var router=express[_0xef89('0x3')]();var fs_extra=require(_0xef89('0x4'));var auth=require(_0xef89('0x5'));var interaction=require(_0xef89('0x6'));var config=require(_0xef89('0x7'));var controller=require(_0xef89('0x8'));router['get']('/',auth[_0xef89('0x9')](),controller[_0xef89('0xa')]);router[_0xef89('0xb')]('/:id',auth[_0xef89('0x9')](),controller[_0xef89('0xc')]);router['get'](_0xef89('0xd'),auth[_0xef89('0x9')](),timeout(_0xef89('0xe')),controller['test']);router[_0xef89('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xef89('0x10')](_0xef89('0x11'),auth['isAuthenticated'](),controller[_0xef89('0x12')]);router['delete']('/:id',auth[_0xef89('0x9')](),controller[_0xef89('0x13')]);module[_0xef89('0x14')]=router; \ No newline at end of file +var _0xc7f7=['/:id/test','test','post','create','put','delete','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','isAuthenticated','show'];(function(_0x169ca0,_0x48d215){var _0x2ce4df=function(_0x2721ca){while(--_0x2721ca){_0x169ca0['push'](_0x169ca0['shift']());}};_0x2ce4df(++_0x48d215);}(_0xc7f7,0x153));var _0x7c7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7f7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7c7f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7c7f('0x1'));var express=require(_0x7c7f('0x2'));var router=express[_0x7c7f('0x3')]();var fs_extra=require(_0x7c7f('0x4'));var auth=require(_0x7c7f('0x5'));var interaction=require(_0x7c7f('0x6'));var config=require(_0x7c7f('0x7'));var controller=require(_0x7c7f('0x8'));router[_0x7c7f('0x9')]('/',auth['isAuthenticated'](),controller[_0x7c7f('0xa')]);router[_0x7c7f('0x9')]('/:id',auth[_0x7c7f('0xb')](),controller[_0x7c7f('0xc')]);router['get'](_0x7c7f('0xd'),auth[_0x7c7f('0xb')](),timeout('15s'),controller[_0x7c7f('0xe')]);router[_0x7c7f('0xf')]('/',auth[_0x7c7f('0xb')](),controller[_0x7c7f('0x10')]);router[_0x7c7f('0x11')]('/:id',auth[_0x7c7f('0xb')](),controller['update']);router[_0x7c7f('0x12')](_0x7c7f('0x13'),auth['isAuthenticated'](),controller[_0x7c7f('0x14')]);module[_0x7c7f('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 9218344..bc2d68b 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 _0xc67f=['name','sequelize','exports','STRING'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xc67f,0x11d));var _0xfc67=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc67f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfc67('0x0'));module[_0xfc67('0x1')]={'name':{'type':Sequelize[_0xfc67('0x2')],'unique':_0xfc67('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xfc67('0x2')]},'description':{'type':Sequelize[_0xfc67('0x2')]}}; \ No newline at end of file +var _0xa4ff=['STRING','sequelize','exports','name'];(function(_0xd40135,_0x4d8539){var _0x41a721=function(_0xe996f3){while(--_0xe996f3){_0xd40135['push'](_0xd40135['shift']());}};_0x41a721(++_0x4d8539);}(_0xa4ff,0xb5));var _0xfa4f=function(_0x2a8bbd,_0x2d998b){_0x2a8bbd=_0x2a8bbd-0x0;var _0x276e9c=_0xa4ff[_0x2a8bbd];return _0x276e9c;};'use strict';var Sequelize=require(_0xfa4f('0x0'));module[_0xfa4f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfa4f('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfa4f('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 6dca0b1..8b987d7 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 _0x77ee=['length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','test','odbc','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','reject','save','update','then','destroy','ODBC','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','SquareOdbc'];(function(_0x34fbd7,_0x2ab805){var _0x21c8d9=function(_0x43ef14){while(--_0x43ef14){_0x34fbd7['push'](_0x34fbd7['shift']());}};_0x21c8d9(++_0x2ab805);}(_0x77ee,0x1d6));var _0xe77e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x77ee[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xe77e('0x0'));var rimraf=require(_0xe77e('0x1'));var zipdir=require(_0xe77e('0x2'));var jsonpatch=require(_0xe77e('0x3'));var rp=require(_0xe77e('0x4'));var moment=require(_0xe77e('0x5'));var BPromise=require(_0xe77e('0x6'));var Mustache=require(_0xe77e('0x7'));var util=require('util');var path=require(_0xe77e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe77e('0x9'));var fs=require('fs');var fs_extra=require(_0xe77e('0xa'));var _=require('lodash');var squel=require(_0xe77e('0xb'));var crypto=require(_0xe77e('0xc'));var jsforce=require(_0xe77e('0xd'));var deskjs=require(_0xe77e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe77e('0xf'));var Papa=require(_0xe77e('0x10'));var Redis=require(_0xe77e('0x11'));var authService=require(_0xe77e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe77e('0x13'));var hardwareService=require(_0xe77e('0x14'));var logger=require(_0xe77e('0x15'))(_0xe77e('0x16'));var utils=require(_0xe77e('0x17'));var config=require(_0xe77e('0x18'));var licenseUtil=require(_0xe77e('0x19'));var db=require(_0xe77e('0x1a'))['db'];function respondWithStatusCode(_0xe514e2,_0x3f535b){_0x3f535b=_0x3f535b||0xcc;return function(_0x17a36d){if(_0x17a36d){return _0xe514e2[_0xe77e('0x1b')](_0x3f535b);}return _0xe514e2[_0xe77e('0x1c')](_0x3f535b)[_0xe77e('0x1d')]();};}function respondWithResult(_0x46e664,_0x3e4568){_0x3e4568=_0x3e4568||0xc8;return function(_0x1f4ca8){if(_0x1f4ca8){return _0x46e664[_0xe77e('0x1c')](_0x3e4568)['json'](_0x1f4ca8);}};}function respondWithFilteredResult(_0x45e99e,_0x574e7a){return function(_0x4669be){if(_0x4669be){var _0x44e203=typeof _0x574e7a[_0xe77e('0x1e')]==='undefined'&&typeof _0x574e7a[_0xe77e('0x1f')]===_0xe77e('0x20');var _0x25b8e0=_0x4669be[_0xe77e('0x21')];var _0x5d4728=_0x44e203?0x0:_0x574e7a['offset'];var _0x370146=_0x44e203?_0x4669be[_0xe77e('0x21')]:_0x574e7a['offset']+_0x574e7a[_0xe77e('0x1f')];var _0x1db3f0;if(_0x370146>=_0x25b8e0){_0x370146=_0x25b8e0;_0x1db3f0=0xc8;}else{_0x1db3f0=0xce;}_0x45e99e['status'](_0x1db3f0);return _0x45e99e[_0xe77e('0x22')]('Content-Range',_0x5d4728+'-'+_0x370146+'/'+_0x25b8e0)[_0xe77e('0x23')](_0x4669be);}return null;};}function patchUpdates(_0x19d2df){return function(_0x43e7a8){try{jsonpatch['apply'](_0x43e7a8,_0x19d2df,!![]);}catch(_0xaf230f){return BPromise[_0xe77e('0x24')](_0xaf230f);}return _0x43e7a8[_0xe77e('0x25')]();};}function saveUpdates(_0x21ec24,_0x4baec8){return function(_0x235fa1){if(_0x235fa1){return _0x235fa1[_0xe77e('0x26')](_0x21ec24)[_0xe77e('0x27')](function(_0x23ccfc){return _0x23ccfc;});}return null;};}function removeEntity(_0x2f02ee,_0x4f6c4f){return function(_0x4b1c99){if(_0x4b1c99){return _0x4b1c99[_0xe77e('0x28')]()['then'](function(){var _0x24f74c=_0x4b1c99['get']({'plain':!![]});var _0xdd0b90=_0xe77e('0x29');return db[_0xe77e('0x2a')][_0xe77e('0x28')]({'where':{'type':_0xdd0b90,'resourceId':_0x24f74c['id']}})[_0xe77e('0x27')](function(){return _0x4b1c99;});})[_0xe77e('0x27')](function(){_0x2f02ee[_0xe77e('0x1c')](0xcc)[_0xe77e('0x1d')]();});}};}function handleEntityNotFound(_0x2fd2cf,_0x57d7ab){return function(_0xa5b0f6){if(!_0xa5b0f6){_0x2fd2cf[_0xe77e('0x1b')](0x194);}return _0xa5b0f6;};}function handleError(_0x1b84f8,_0x40fc2f){_0x40fc2f=_0x40fc2f||0x1f4;return function(_0x37e390){logger[_0xe77e('0x2b')](_0x37e390[_0xe77e('0x2c')]);if(_0x37e390[_0xe77e('0x2d')]){delete _0x37e390[_0xe77e('0x2d')];}_0x1b84f8[_0xe77e('0x1c')](_0x40fc2f)['send'](_0x37e390);};}exports[_0xe77e('0x2e')]=function(_0x10553c,_0x2a0d71){var _0x5becca={},_0x5afc39={},_0x38585c={'count':0x0,'rows':[]};var _0xe50524=_[_0xe77e('0x2f')](db['SquareOdbc'][_0xe77e('0x30')],function(_0x58c55f){return{'name':_0x58c55f[_0xe77e('0x31')],'type':_0x58c55f[_0xe77e('0x32')][_0xe77e('0x33')]};});_0x5afc39[_0xe77e('0x34')]=_[_0xe77e('0x2f')](_0xe50524,_0xe77e('0x2d'));_0x5afc39[_0xe77e('0x35')]=_[_0xe77e('0x36')](_0x10553c[_0xe77e('0x35')]);_0x5afc39[_0xe77e('0x37')]=_[_0xe77e('0x38')](_0x5afc39[_0xe77e('0x34')],_0x5afc39[_0xe77e('0x35')]);_0x5becca['attributes']=_['intersection'](_0x5afc39[_0xe77e('0x34')],qs['fields'](_0x10553c[_0xe77e('0x35')][_0xe77e('0x39')]));_0x5becca['attributes']=_0x5becca['attributes']['length']?_0x5becca[_0xe77e('0x3a')]:_0x5afc39[_0xe77e('0x34')];if(!_0x10553c[_0xe77e('0x35')][_0xe77e('0x3b')](_0xe77e('0x3c'))){_0x5becca[_0xe77e('0x1f')]=qs[_0xe77e('0x1f')](_0x10553c['query'][_0xe77e('0x1f')]);_0x5becca['offset']=qs[_0xe77e('0x1e')](_0x10553c[_0xe77e('0x35')]['offset']);}_0x5becca[_0xe77e('0x3d')]=qs[_0xe77e('0x3e')](_0x10553c[_0xe77e('0x35')][_0xe77e('0x3e')]);_0x5becca[_0xe77e('0x3f')]=qs[_0xe77e('0x37')](_[_0xe77e('0x40')](_0x10553c[_0xe77e('0x35')],_0x5afc39['filters']),_0xe50524);if(_0x10553c[_0xe77e('0x35')][_0xe77e('0x41')]){_0x5becca[_0xe77e('0x3f')]=_[_0xe77e('0x42')](_0x5becca[_0xe77e('0x3f')],{'$or':_[_0xe77e('0x2f')](_0xe50524,function(_0x584702){if(_0x584702['type']!==_0xe77e('0x43')){var _0x27fe8a={};_0x27fe8a[_0x584702['name']]={'$like':'%'+_0x10553c[_0xe77e('0x35')][_0xe77e('0x41')]+'%'};return _0x27fe8a;}})});}_0x5becca=_[_0xe77e('0x42')]({},_0x5becca,_0x10553c[_0xe77e('0x44')]);var _0x4907c4={'where':_0x5becca[_0xe77e('0x3f')]};return db['SquareOdbc']['count'](_0x4907c4)[_0xe77e('0x27')](function(_0x4db968){_0x38585c[_0xe77e('0x21')]=_0x4db968;if(_0x10553c['query'][_0xe77e('0x45')]){_0x5becca[_0xe77e('0x46')]=[{'all':!![]}];}return db['SquareOdbc'][_0xe77e('0x47')](_0x5becca);})['then'](function(_0x3d8b88){_0x38585c[_0xe77e('0x48')]=_0x3d8b88;return _0x38585c;})[_0xe77e('0x27')](respondWithFilteredResult(_0x2a0d71,_0x5becca))['catch'](handleError(_0x2a0d71,null));};exports[_0xe77e('0x49')]=function(_0x13269d,_0x5787b6){var _0x25c87a={'raw':!![],'where':{'id':_0x13269d[_0xe77e('0x4a')]['id']}},_0x56dfbe={};_0x56dfbe[_0xe77e('0x34')]=_[_0xe77e('0x36')](db[_0xe77e('0x4b')][_0xe77e('0x30')]);_0x56dfbe[_0xe77e('0x35')]=_[_0xe77e('0x36')](_0x13269d[_0xe77e('0x35')]);_0x56dfbe[_0xe77e('0x37')]=_['intersection'](_0x56dfbe[_0xe77e('0x34')],_0x56dfbe[_0xe77e('0x35')]);_0x25c87a[_0xe77e('0x3a')]=_[_0xe77e('0x38')](_0x56dfbe[_0xe77e('0x34')],qs[_0xe77e('0x39')](_0x13269d[_0xe77e('0x35')][_0xe77e('0x39')]));_0x25c87a['attributes']=_0x25c87a[_0xe77e('0x3a')][_0xe77e('0x4c')]?_0x25c87a['attributes']:_0x56dfbe[_0xe77e('0x34')];if(_0x13269d[_0xe77e('0x35')][_0xe77e('0x45')]){_0x25c87a[_0xe77e('0x46')]=[{'all':!![]}];}_0x25c87a=_[_0xe77e('0x42')]({},_0x25c87a,_0x13269d[_0xe77e('0x44')]);return db[_0xe77e('0x4b')][_0xe77e('0x4d')](_0x25c87a)[_0xe77e('0x27')](handleEntityNotFound(_0x5787b6,null))[_0xe77e('0x27')](respondWithResult(_0x5787b6,null))[_0xe77e('0x4e')](handleError(_0x5787b6,null));};exports[_0xe77e('0x4f')]=function(_0x4437af,_0x3a09e8){return db['SquareOdbc'][_0xe77e('0x4f')](_0x4437af[_0xe77e('0x50')],{})[_0xe77e('0x27')](function(_0x477973){var _0x4b599a=_0x4437af[_0xe77e('0x51')]['get']({'plain':!![]});if(!_0x4b599a)throw new Error(_0xe77e('0x52'));if(_0x4b599a[_0xe77e('0x53')]===_0xe77e('0x51')){var _0x24470d=_0x477973[_0xe77e('0x54')]({'plain':!![]});var _0xd9e74=_0xe77e('0x29');return db['UserProfileSection'][_0xe77e('0x4d')]({'where':{'name':_0xd9e74,'userProfileId':_0x4b599a[_0xe77e('0x55')]},'raw':!![]})['then'](function(_0x1db9f5){if(_0x1db9f5&&_0x1db9f5[_0xe77e('0x56')]===0x0){return db[_0xe77e('0x2a')]['create']({'name':_0x24470d[_0xe77e('0x2d')],'resourceId':_0x24470d['id'],'type':_0x1db9f5[_0xe77e('0x2d')],'sectionId':_0x1db9f5['id']},{})['then'](function(){return _0x477973;});}else{return _0x477973;}})[_0xe77e('0x4e')](function(_0x43989b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43989b);throw _0x43989b;});}return _0x477973;})[_0xe77e('0x27')](respondWithResult(_0x3a09e8,0xc9))[_0xe77e('0x4e')](handleError(_0x3a09e8,null));};exports['update']=function(_0x16430e,_0x272b5d){if(_0x16430e['body']['id']){delete _0x16430e[_0xe77e('0x50')]['id'];}return db[_0xe77e('0x4b')][_0xe77e('0x4d')]({'where':{'id':_0x16430e['params']['id']}})[_0xe77e('0x27')](handleEntityNotFound(_0x272b5d,null))[_0xe77e('0x27')](saveUpdates(_0x16430e['body'],null))[_0xe77e('0x27')](respondWithResult(_0x272b5d,null))['catch'](handleError(_0x272b5d,null));};exports[_0xe77e('0x28')]=function(_0x271f04,_0x49c91e){return db[_0xe77e('0x4b')][_0xe77e('0x4d')]({'where':{'id':_0x271f04[_0xe77e('0x4a')]['id']}})[_0xe77e('0x27')](handleEntityNotFound(_0x49c91e,null))[_0xe77e('0x27')](removeEntity(_0x49c91e,null))[_0xe77e('0x4e')](handleError(_0x49c91e,null));};exports[_0xe77e('0x57')]=function(_0x3f4aba,_0x237015,_0x353ef6){var _0xf4d7bc;return db[_0xe77e('0x4b')][_0xe77e('0x4d')]({'where':{'id':_0x3f4aba[_0xe77e('0x4a')]['id']},'attributes':['id','dsn']})[_0xe77e('0x27')](handleEntityNotFound(_0x237015,null))[_0xe77e('0x27')](function(_0x24e6a3){if(_0x24e6a3){var _0x40e0d2=require(_0xe77e('0x58'))();_0x40e0d2['openSync'](_0x24e6a3[_0xe77e('0x59')]);_0x40e0d2[_0xe77e('0x5a')]();return _0x24e6a3;}})[_0xe77e('0x27')](respondWithResult(_0x237015,null))[_0xe77e('0x4e')](handleError(_0x237015,null));}; \ No newline at end of file +var _0x36c4=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','merge','where','VIRTUAL','filter','options','SquareOdbc','includeAll','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','dsn','openSync','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','then','get','ODBC','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection'];(function(_0x195c1f,_0x384a6c){var _0x240233=function(_0x385cdc){while(--_0x385cdc){_0x195c1f['push'](_0x195c1f['shift']());}};_0x240233(++_0x384a6c);}(_0x36c4,0x73));var _0x436c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36c4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x436c('0x0'));var jsonpatch=require(_0x436c('0x1'));var rp=require(_0x436c('0x2'));var moment=require('moment');var BPromise=require(_0x436c('0x3'));var Mustache=require(_0x436c('0x4'));var util=require(_0x436c('0x5'));var path=require(_0x436c('0x6'));var sox=require('sox');var csv=require(_0x436c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x436c('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x436c('0x9'));var toCsv=require('to-csv');var querystring=require(_0x436c('0xa'));var Papa=require(_0x436c('0xb'));var Redis=require(_0x436c('0xc'));var authService=require(_0x436c('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x436c('0xe'));var logger=require('../../config/logger')(_0x436c('0xf'));var utils=require(_0x436c('0x10'));var config=require(_0x436c('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x436c('0x12'))['db'];function respondWithStatusCode(_0x3ee4ac,_0x2c2e82){_0x2c2e82=_0x2c2e82||0xcc;return function(_0x1c3cbb){if(_0x1c3cbb){return _0x3ee4ac[_0x436c('0x13')](_0x2c2e82);}return _0x3ee4ac[_0x436c('0x14')](_0x2c2e82)[_0x436c('0x15')]();};}function respondWithResult(_0x3e851c,_0x41a9b4){_0x41a9b4=_0x41a9b4||0xc8;return function(_0x5301e7){if(_0x5301e7){return _0x3e851c[_0x436c('0x14')](_0x41a9b4)['json'](_0x5301e7);}};}function respondWithFilteredResult(_0x1d7476,_0x18d050){return function(_0x5b9d3f){if(_0x5b9d3f){var _0x5c948c=typeof _0x18d050[_0x436c('0x16')]===_0x436c('0x17')&&typeof _0x18d050[_0x436c('0x18')]==='undefined';var _0x2c23bd=_0x5b9d3f['count'];var _0x1b121a=_0x5c948c?0x0:_0x18d050[_0x436c('0x16')];var _0x44a3e8=_0x5c948c?_0x5b9d3f[_0x436c('0x19')]:_0x18d050[_0x436c('0x16')]+_0x18d050[_0x436c('0x18')];var _0x2e75cb;if(_0x44a3e8>=_0x2c23bd){_0x44a3e8=_0x2c23bd;_0x2e75cb=0xc8;}else{_0x2e75cb=0xce;}_0x1d7476['status'](_0x2e75cb);return _0x1d7476[_0x436c('0x1a')](_0x436c('0x1b'),_0x1b121a+'-'+_0x44a3e8+'/'+_0x2c23bd)[_0x436c('0x1c')](_0x5b9d3f);}return null;};}function patchUpdates(_0x18c48f){return function(_0x1af220){try{jsonpatch[_0x436c('0x1d')](_0x1af220,_0x18c48f,!![]);}catch(_0x3ea1c3){return BPromise[_0x436c('0x1e')](_0x3ea1c3);}return _0x1af220['save']();};}function saveUpdates(_0x43641e,_0x484167){return function(_0x58b196){if(_0x58b196){return _0x58b196['update'](_0x43641e)['then'](function(_0x197b3a){return _0x197b3a;});}return null;};}function removeEntity(_0x406ae1,_0x29f3a5){return function(_0x57c982){if(_0x57c982){return _0x57c982[_0x436c('0x1f')]()[_0x436c('0x20')](function(){var _0x25d354=_0x57c982[_0x436c('0x21')]({'plain':!![]});var _0x247070=_0x436c('0x22');return db[_0x436c('0x23')][_0x436c('0x1f')]({'where':{'type':_0x247070,'resourceId':_0x25d354['id']}})[_0x436c('0x20')](function(){return _0x57c982;});})[_0x436c('0x20')](function(){_0x406ae1[_0x436c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b4f08,_0x51c6c3){return function(_0x259111){if(!_0x259111){_0x5b4f08[_0x436c('0x13')](0x194);}return _0x259111;};}function handleError(_0x3b0b21,_0x314ee5){_0x314ee5=_0x314ee5||0x1f4;return function(_0x4e9d11){logger[_0x436c('0x24')](_0x4e9d11[_0x436c('0x25')]);if(_0x4e9d11[_0x436c('0x26')]){delete _0x4e9d11['name'];}_0x3b0b21['status'](_0x314ee5)[_0x436c('0x27')](_0x4e9d11);};}exports[_0x436c('0x28')]=function(_0x3b0e74,_0x2dd054){var _0x49f7d8={},_0x22f358={},_0x5c0533={'count':0x0,'rows':[]};var _0x4b65ef=_[_0x436c('0x29')](db['SquareOdbc'][_0x436c('0x2a')],function(_0x53a95f){return{'name':_0x53a95f['fieldName'],'type':_0x53a95f[_0x436c('0x2b')][_0x436c('0x2c')]};});_0x22f358[_0x436c('0x2d')]=_[_0x436c('0x29')](_0x4b65ef,_0x436c('0x26'));_0x22f358[_0x436c('0x2e')]=_[_0x436c('0x2f')](_0x3b0e74[_0x436c('0x2e')]);_0x22f358['filters']=_[_0x436c('0x30')](_0x22f358['model'],_0x22f358[_0x436c('0x2e')]);_0x49f7d8[_0x436c('0x31')]=_['intersection'](_0x22f358[_0x436c('0x2d')],qs[_0x436c('0x32')](_0x3b0e74[_0x436c('0x2e')][_0x436c('0x32')]));_0x49f7d8[_0x436c('0x31')]=_0x49f7d8[_0x436c('0x31')][_0x436c('0x33')]?_0x49f7d8[_0x436c('0x31')]:_0x22f358[_0x436c('0x2d')];if(!_0x3b0e74['query'][_0x436c('0x34')](_0x436c('0x35'))){_0x49f7d8[_0x436c('0x18')]=qs[_0x436c('0x18')](_0x3b0e74[_0x436c('0x2e')]['limit']);_0x49f7d8[_0x436c('0x16')]=qs['offset'](_0x3b0e74['query']['offset']);}_0x49f7d8[_0x436c('0x36')]=qs[_0x436c('0x37')](_0x3b0e74[_0x436c('0x2e')][_0x436c('0x37')]);_0x49f7d8['where']=qs[_0x436c('0x38')](_['pick'](_0x3b0e74[_0x436c('0x2e')],_0x22f358[_0x436c('0x38')]),_0x4b65ef);if(_0x3b0e74[_0x436c('0x2e')]['filter']){_0x49f7d8['where']=_[_0x436c('0x39')](_0x49f7d8[_0x436c('0x3a')],{'$or':_[_0x436c('0x29')](_0x4b65ef,function(_0x2ae11d){if(_0x2ae11d[_0x436c('0x2b')]!==_0x436c('0x3b')){var _0x4e477b={};_0x4e477b[_0x2ae11d['name']]={'$like':'%'+_0x3b0e74[_0x436c('0x2e')][_0x436c('0x3c')]+'%'};return _0x4e477b;}})});}_0x49f7d8=_['merge']({},_0x49f7d8,_0x3b0e74[_0x436c('0x3d')]);var _0x1468ff={'where':_0x49f7d8[_0x436c('0x3a')]};return db[_0x436c('0x3e')][_0x436c('0x19')](_0x1468ff)[_0x436c('0x20')](function(_0x306b7e){_0x5c0533[_0x436c('0x19')]=_0x306b7e;if(_0x3b0e74[_0x436c('0x2e')][_0x436c('0x3f')]){_0x49f7d8[_0x436c('0x40')]=[{'all':!![]}];}return db[_0x436c('0x3e')][_0x436c('0x41')](_0x49f7d8);})[_0x436c('0x20')](function(_0x1929dd){_0x5c0533[_0x436c('0x42')]=_0x1929dd;return _0x5c0533;})[_0x436c('0x20')](respondWithFilteredResult(_0x2dd054,_0x49f7d8))[_0x436c('0x43')](handleError(_0x2dd054,null));};exports[_0x436c('0x44')]=function(_0x35754e,_0x4645ce){var _0x4f722c={'raw':!![],'where':{'id':_0x35754e['params']['id']}},_0x593c8f={};_0x593c8f[_0x436c('0x2d')]=_[_0x436c('0x2f')](db[_0x436c('0x3e')]['rawAttributes']);_0x593c8f['query']=_[_0x436c('0x2f')](_0x35754e[_0x436c('0x2e')]);_0x593c8f[_0x436c('0x38')]=_['intersection'](_0x593c8f[_0x436c('0x2d')],_0x593c8f['query']);_0x4f722c[_0x436c('0x31')]=_[_0x436c('0x30')](_0x593c8f['model'],qs[_0x436c('0x32')](_0x35754e[_0x436c('0x2e')][_0x436c('0x32')]));_0x4f722c[_0x436c('0x31')]=_0x4f722c[_0x436c('0x31')]['length']?_0x4f722c['attributes']:_0x593c8f[_0x436c('0x2d')];if(_0x35754e[_0x436c('0x2e')][_0x436c('0x3f')]){_0x4f722c['include']=[{'all':!![]}];}_0x4f722c=_['merge']({},_0x4f722c,_0x35754e[_0x436c('0x3d')]);return db[_0x436c('0x3e')][_0x436c('0x45')](_0x4f722c)[_0x436c('0x20')](handleEntityNotFound(_0x4645ce,null))[_0x436c('0x20')](respondWithResult(_0x4645ce,null))[_0x436c('0x43')](handleError(_0x4645ce,null));};exports[_0x436c('0x46')]=function(_0x4faba2,_0x51d3e1){return db[_0x436c('0x3e')][_0x436c('0x46')](_0x4faba2['body'],{})[_0x436c('0x20')](function(_0x3461fd){var _0x4bdb35=_0x4faba2[_0x436c('0x47')][_0x436c('0x21')]({'plain':!![]});if(!_0x4bdb35)throw new Error(_0x436c('0x48'));if(_0x4bdb35['role']===_0x436c('0x47')){var _0x13832f=_0x3461fd[_0x436c('0x21')]({'plain':!![]});var _0x364f53='ODBC';return db[_0x436c('0x49')][_0x436c('0x45')]({'where':{'name':_0x364f53,'userProfileId':_0x4bdb35[_0x436c('0x4a')]},'raw':!![]})['then'](function(_0x26bc63){if(_0x26bc63&&_0x26bc63[_0x436c('0x4b')]===0x0){return db[_0x436c('0x23')]['create']({'name':_0x13832f[_0x436c('0x26')],'resourceId':_0x13832f['id'],'type':_0x26bc63[_0x436c('0x26')],'sectionId':_0x26bc63['id']},{})['then'](function(){return _0x3461fd;});}else{return _0x3461fd;}})[_0x436c('0x43')](function(_0x3ffc28){logger[_0x436c('0x24')](_0x436c('0x4c'),_0x3ffc28);throw _0x3ffc28;});}return _0x3461fd;})[_0x436c('0x20')](respondWithResult(_0x51d3e1,0xc9))['catch'](handleError(_0x51d3e1,null));};exports[_0x436c('0x4d')]=function(_0x465316,_0x4b96ad){if(_0x465316[_0x436c('0x4e')]['id']){delete _0x465316['body']['id'];}return db[_0x436c('0x3e')]['find']({'where':{'id':_0x465316[_0x436c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4b96ad,null))['then'](saveUpdates(_0x465316['body'],null))[_0x436c('0x20')](respondWithResult(_0x4b96ad,null))['catch'](handleError(_0x4b96ad,null));};exports[_0x436c('0x1f')]=function(_0xc150c6,_0x2b1e40){return db[_0x436c('0x3e')][_0x436c('0x45')]({'where':{'id':_0xc150c6['params']['id']}})[_0x436c('0x20')](handleEntityNotFound(_0x2b1e40,null))[_0x436c('0x20')](removeEntity(_0x2b1e40,null))[_0x436c('0x43')](handleError(_0x2b1e40,null));};exports['test']=function(_0x7d4cf,_0x12c1fc,_0x25b6f6){var _0x204d46;return db['SquareOdbc'][_0x436c('0x45')]({'where':{'id':_0x7d4cf[_0x436c('0x4f')]['id']},'attributes':['id',_0x436c('0x50')]})[_0x436c('0x20')](handleEntityNotFound(_0x12c1fc,null))[_0x436c('0x20')](function(_0x515699){if(_0x515699){var _0x741e63=require('odbc')();_0x741e63[_0x436c('0x51')](_0x515699[_0x436c('0x50')]);_0x741e63['closeSync']();return _0x515699;}})[_0x436c('0x20')](respondWithResult(_0x12c1fc,null))[_0x436c('0x43')](handleError(_0x12c1fc,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 95b14f7..3ca235f 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 _0x91cc=['square_odbc','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','SquareOdbc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x91cc,0x169));var _0xc91c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x91cc[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xc91c('0x0'));var util=require(_0xc91c('0x1'));var logger=require(_0xc91c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc91c('0x3'));var rp=require(_0xc91c('0x4'));var fs=require('fs');var path=require(_0xc91c('0x5'));var rimraf=require('rimraf');var config=require(_0xc91c('0x6'));var attributes=require(_0xc91c('0x7'));module['exports']=function(_0x383062,_0x10e069){return _0x383062['define'](_0xc91c('0x8'),attributes,{'tableName':_0xc91c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb51=['./squareOdbc.attributes','define','square_odbc','util','../../config/logger','api','path','rimraf'];(function(_0xc631b,_0x200733){var _0x2cab97=function(_0x4e704d){while(--_0x4e704d){_0xc631b['push'](_0xc631b['shift']());}};_0x2cab97(++_0x200733);}(_0xfb51,0xc3));var _0x1fb5=function(_0x13f5d1,_0x12e3f7){_0x13f5d1=_0x13f5d1-0x0;var _0x5621f3=_0xfb51[_0x13f5d1];return _0x5621f3;};'use strict';var _=require('lodash');var util=require(_0x1fb5('0x0'));var logger=require(_0x1fb5('0x1'))(_0x1fb5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb5('0x3'));var rimraf=require(_0x1fb5('0x4'));var config=require('../../config/environment');var attributes=require(_0x1fb5('0x5'));module['exports']=function(_0x3b6061,_0x39aca7){return _0x3b6061[_0x1fb5('0x6')]('SquareOdbc',attributes,{'tableName':_0x1fb5('0x7'),'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 9cbd971..0f2438b 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 _0xc4bc=['ShowSquareOdbc','SquareOdbc','find','options','where','include','map','model','attributes','then','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4a7dcd,_0x1fb0b7){var _0x4e2c46=function(_0x26fcd2){while(--_0x26fcd2){_0x4a7dcd['push'](_0x4a7dcd['shift']());}};_0x4e2c46(++_0x1fb0b7);}(_0xc4bc,0x8c));var _0xcc4b=function(_0x3f6434,_0x35f420){_0x3f6434=_0x3f6434-0x0;var _0x3454f6=_0xc4bc[_0x3f6434];return _0x3454f6;};'use strict';var _=require(_0xcc4b('0x0'));var util=require(_0xcc4b('0x1'));var moment=require(_0xcc4b('0x2'));var BPromise=require(_0xcc4b('0x3'));var rs=require(_0xcc4b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc4b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc4b('0x6'))(_0xcc4b('0x7'));var config=require(_0xcc4b('0x8'));var jayson=require(_0xcc4b('0x9'));var client=jayson[_0xcc4b('0xa')][_0xcc4b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cf67a,_0x590727,_0xadc4d7){return new BPromise(function(_0x31ea82,_0x1e6085){return client['request'](_0x4cf67a,_0xadc4d7)['then'](function(_0x586c8e){logger['info'](_0xcc4b('0xc'),_0x590727,_0xcc4b('0xd'));logger['debug'](_0xcc4b('0xe'),_0x590727,_0xcc4b('0xd'),JSON[_0xcc4b('0xf')](_0x586c8e));if(_0x586c8e['error']){if(_0x586c8e[_0xcc4b('0x10')][_0xcc4b('0x11')]===0x1f4){logger[_0xcc4b('0x10')](_0xcc4b('0xc'),_0x590727,_0x586c8e[_0xcc4b('0x10')][_0xcc4b('0x12')]);return _0x1e6085(_0x586c8e[_0xcc4b('0x10')][_0xcc4b('0x12')]);}logger['error'](_0xcc4b('0xc'),_0x590727,_0x586c8e['error']['message']);return _0x31ea82(_0x586c8e[_0xcc4b('0x10')][_0xcc4b('0x12')]);}else{logger['info'](_0xcc4b('0xc'),_0x590727,'request\x20sent');_0x31ea82(_0x586c8e[_0xcc4b('0x13')][_0xcc4b('0x12')]);}})['catch'](function(_0xc47dbe){logger['error'](_0xcc4b('0xc'),_0x590727,_0xc47dbe);_0x1e6085(_0xc47dbe);});});}exports[_0xcc4b('0x14')]=function(_0x3e7084){var _0xeaa094=this;return new Promise(function(_0x5c5b09,_0x5774a5){return db[_0xcc4b('0x15')][_0xcc4b('0x16')]({'raw':_0x3e7084['options']?_0x3e7084[_0xcc4b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3e7084[_0xcc4b('0x17')]?_0x3e7084[_0xcc4b('0x17')][_0xcc4b('0x18')]||null:null,'attributes':_0x3e7084[_0xcc4b('0x17')]?_0x3e7084[_0xcc4b('0x17')]['attributes']||null:null,'include':_0x3e7084['options']?_0x3e7084[_0xcc4b('0x17')][_0xcc4b('0x19')]?_[_0xcc4b('0x1a')](_0x3e7084[_0xcc4b('0x17')][_0xcc4b('0x19')],function(_0x44167d){return{'model':db[_0x44167d['model']],'as':_0x44167d['as'],'attributes':_0x44167d['attributes'],'include':_0x44167d['include']?_[_0xcc4b('0x1a')](_0x44167d['include'],function(_0x525cd3){return{'model':db[_0x525cd3[_0xcc4b('0x1b')]],'as':_0x525cd3['as'],'attributes':_0x525cd3[_0xcc4b('0x1c')],'include':_0x525cd3[_0xcc4b('0x19')]?_[_0xcc4b('0x1a')](_0x525cd3['include'],function(_0x38c949){return{'model':db[_0x38c949['model']],'as':_0x38c949['as'],'attributes':_0x38c949[_0xcc4b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcc4b('0x1d')](function(_0x30c177){logger['info'](_0xcc4b('0x14'),_0x3e7084);logger[_0xcc4b('0x1e')]('ShowSquareOdbc',_0x3e7084,JSON['stringify'](_0x30c177));_0x5c5b09(_0x30c177);})[_0xcc4b('0x1f')](function(_0x1ae31d){logger['error'](_0xcc4b('0x14'),_0x1ae31d[_0xcc4b('0x12')],_0x3e7084);_0x5774a5(_0xeaa094[_0xcc4b('0x10')](0x1f4,_0x1ae31d[_0xcc4b('0x12')]));});});}; \ No newline at end of file +var _0x7073=['request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','SquareOdbc','options','where','attributes','include','model','map','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x580ee0,_0x467385){var _0x29ff29=function(_0x3660eb){while(--_0x3660eb){_0x580ee0['push'](_0x580ee0['shift']());}};_0x29ff29(++_0x467385);}(_0x7073,0x194));var _0x3707=function(_0x86f1f,_0x486f2a){_0x86f1f=_0x86f1f-0x0;var _0x53809f=_0x7073[_0x86f1f];return _0x53809f;};'use strict';var _=require(_0x3707('0x0'));var util=require(_0x3707('0x1'));var moment=require(_0x3707('0x2'));var BPromise=require(_0x3707('0x3'));var rs=require(_0x3707('0x4'));var fs=require('fs');var Redis=require(_0x3707('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3707('0x6'));var logger=require(_0x3707('0x7'))('rpc');var config=require(_0x3707('0x8'));var jayson=require(_0x3707('0x9'));var client=jayson[_0x3707('0xa')][_0x3707('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x202947,_0x305da7,_0x5612d4){return new BPromise(function(_0x4a9194,_0x4928bf){return client[_0x3707('0xc')](_0x202947,_0x5612d4)[_0x3707('0xd')](function(_0x34d97b){logger['info'](_0x3707('0xe'),_0x305da7,_0x3707('0xf'));logger[_0x3707('0x10')](_0x3707('0x11'),_0x305da7,_0x3707('0xf'),JSON[_0x3707('0x12')](_0x34d97b));if(_0x34d97b[_0x3707('0x13')]){if(_0x34d97b[_0x3707('0x13')][_0x3707('0x14')]===0x1f4){logger[_0x3707('0x13')](_0x3707('0xe'),_0x305da7,_0x34d97b[_0x3707('0x13')][_0x3707('0x15')]);return _0x4928bf(_0x34d97b[_0x3707('0x13')][_0x3707('0x15')]);}logger[_0x3707('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x305da7,_0x34d97b['error']['message']);return _0x4a9194(_0x34d97b['error'][_0x3707('0x15')]);}else{logger[_0x3707('0x16')](_0x3707('0xe'),_0x305da7,_0x3707('0xf'));_0x4a9194(_0x34d97b['result'][_0x3707('0x15')]);}})[_0x3707('0x17')](function(_0x50eaee){logger[_0x3707('0x13')](_0x3707('0xe'),_0x305da7,_0x50eaee);_0x4928bf(_0x50eaee);});});}exports['ShowSquareOdbc']=function(_0xba4da1){var _0x139e2c=this;return new Promise(function(_0xffd845,_0x36c88b){return db[_0x3707('0x18')]['find']({'raw':_0xba4da1[_0x3707('0x19')]?_0xba4da1[_0x3707('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xba4da1[_0x3707('0x19')]?_0xba4da1['options'][_0x3707('0x1a')]||null:null,'attributes':_0xba4da1[_0x3707('0x19')]?_0xba4da1[_0x3707('0x19')][_0x3707('0x1b')]||null:null,'include':_0xba4da1[_0x3707('0x19')]?_0xba4da1['options'][_0x3707('0x1c')]?_['map'](_0xba4da1[_0x3707('0x19')][_0x3707('0x1c')],function(_0x37c73e){return{'model':db[_0x37c73e[_0x3707('0x1d')]],'as':_0x37c73e['as'],'attributes':_0x37c73e[_0x3707('0x1b')],'include':_0x37c73e[_0x3707('0x1c')]?_[_0x3707('0x1e')](_0x37c73e[_0x3707('0x1c')],function(_0x5304fd){return{'model':db[_0x5304fd[_0x3707('0x1d')]],'as':_0x5304fd['as'],'attributes':_0x5304fd[_0x3707('0x1b')],'include':_0x5304fd[_0x3707('0x1c')]?_[_0x3707('0x1e')](_0x5304fd['include'],function(_0x1ce5b1){return{'model':db[_0x1ce5b1['model']],'as':_0x1ce5b1['as'],'attributes':_0x1ce5b1[_0x3707('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3707('0xd')](function(_0x27f611){logger[_0x3707('0x16')](_0x3707('0x1f'),_0xba4da1);logger[_0x3707('0x10')](_0x3707('0x1f'),_0xba4da1,JSON['stringify'](_0x27f611));_0xffd845(_0x27f611);})['catch'](function(_0x805da7){logger['error'](_0x3707('0x1f'),_0x805da7[_0x3707('0x15')],_0xba4da1);_0x36c88b(_0x139e2c[_0x3707('0x13')](0x1f4,_0x805da7['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index ff1c49f..3902e3b 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 _0xd65f=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x25d4c9,_0x2c4568){var _0x447fe2=function(_0x849586){while(--_0x849586){_0x25d4c9['push'](_0x25d4c9['shift']());}};_0x447fe2(++_0x2c4568);}(_0xd65f,0x105));var _0xfd65=function(_0x50f288,_0xfecd76){_0x50f288=_0x50f288-0x0;var _0x2a0755=_0xd65f[_0x50f288];return _0x2a0755;};'use strict';var multer=require(_0xfd65('0x0'));var util=require('util');var path=require(_0xfd65('0x1'));var timeout=require(_0xfd65('0x2'));var express=require(_0xfd65('0x3'));var router=express[_0xfd65('0x4')]();var fs_extra=require(_0xfd65('0x5'));var auth=require(_0xfd65('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfd65('0x7'));var controller=require(_0xfd65('0x8'));router[_0xfd65('0x9')]('/',auth[_0xfd65('0xa')](),controller[_0xfd65('0xb')]);router['get'](_0xfd65('0xc'),auth[_0xfd65('0xa')](),controller[_0xfd65('0xd')]);router[_0xfd65('0xe')]('/',auth['isAuthenticated'](),controller[_0xfd65('0xf')]);router[_0xfd65('0x10')](_0xfd65('0xc'),auth[_0xfd65('0xa')](),controller[_0xfd65('0x11')]);router[_0xfd65('0x12')](_0xfd65('0xc'),auth[_0xfd65('0xa')](),controller[_0xfd65('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe14b=['isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0xe14b,0x14c));var _0xbe14=function(_0x2edcfc,_0x5f465a){_0x2edcfc=_0x2edcfc-0x0;var _0xfd5dc3=_0xe14b[_0x2edcfc];return _0xfd5dc3;};'use strict';var multer=require(_0xbe14('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbe14('0x1'));var express=require(_0xbe14('0x2'));var router=express['Router']();var fs_extra=require(_0xbe14('0x3'));var auth=require(_0xbe14('0x4'));var interaction=require(_0xbe14('0x5'));var config=require(_0xbe14('0x6'));var controller=require('./squareProject.controller');router[_0xbe14('0x7')]('/',auth[_0xbe14('0x8')](),controller[_0xbe14('0x9')]);router[_0xbe14('0x7')](_0xbe14('0xa'),auth['isAuthenticated'](),controller[_0xbe14('0xb')]);router['post']('/',auth[_0xbe14('0x8')](),controller[_0xbe14('0xc')]);router['put'](_0xbe14('0xa'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0xe')](_0xbe14('0xa'),auth['isAuthenticated'](),controller[_0xbe14('0xf')]);module[_0xbe14('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 06df446..af904b6 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 _0x9c84=['getDataValue','preproduction','production','toString','utf8','DATE','exports','name','STRING','TEXT','BLOB','long'];(function(_0x20f526,_0xa5262){var _0x103ae9=function(_0x53025f){while(--_0x53025f){_0x20f526['push'](_0x20f526['shift']());}};_0x103ae9(++_0xa5262);}(_0x9c84,0x192));var _0x49c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9c84[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x49c8('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x49c8('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x49c8('0x2')]},'notes':{'type':Sequelize[_0x49c8('0x3')]},'preproduction':{'type':Sequelize[_0x49c8('0x4')](_0x49c8('0x5')),'get':function(){if(this[_0x49c8('0x6')](_0x49c8('0x7'))){return this[_0x49c8('0x6')](_0x49c8('0x7'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x49c8('0x4')](_0x49c8('0x5')),'get':function(){if(this[_0x49c8('0x6')](_0x49c8('0x8'))){return this['getDataValue'](_0x49c8('0x8'))[_0x49c8('0x9')](_0x49c8('0xa'));}}},'savedAt':{'type':Sequelize[_0x49c8('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb606=['DATE','exports','STRING','TEXT','BLOB','long','preproduction','getDataValue','production','utf8'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb606,0xfb));var _0x6b60=function(_0x541260,_0x4c7f2e){_0x541260=_0x541260-0x0;var _0x1dd2b5=_0xb606[_0x541260];return _0x1dd2b5;};'use strict';var Sequelize=require('sequelize');module[_0x6b60('0x0')]={'name':{'type':Sequelize[_0x6b60('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6b60('0x1')]},'notes':{'type':Sequelize[_0x6b60('0x2')]},'preproduction':{'type':Sequelize[_0x6b60('0x3')](_0x6b60('0x4')),'get':function(){if(this['getDataValue'](_0x6b60('0x5'))){return this[_0x6b60('0x6')](_0x6b60('0x5'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x6b60('0x3')](_0x6b60('0x4')),'get':function(){if(this[_0x6b60('0x6')](_0x6b60('0x7'))){return this[_0x6b60('0x6')](_0x6b60('0x7'))['toString'](_0x6b60('0x8'));}}},'savedAt':{'type':Sequelize[_0x6b60('0x9')]},'publishedAt':{'type':Sequelize[_0x6b60('0x9')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 702d7c1..2a39edc 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 _0x2644=['body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','ioredis','../../components/parsers/qs','api','redis','localhost','socket.io-emitter','register','status','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','publish','agi','end','sendStatus','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','SquareProject','includeAll','include','findAll','catch','show','params','find','create'];(function(_0xabb9d2,_0x3e9eee){var _0x2e2565=function(_0x41d108){while(--_0x41d108){_0xabb9d2['push'](_0xabb9d2['shift']());}};_0x2e2565(++_0x3e9eee);}(_0x2644,0xd7));var _0x4264=function(_0x507597,_0x412525){_0x507597=_0x507597-0x0;var _0x110a0f=_0x2644[_0x507597];return _0x110a0f;};'use strict';var _=require(_0x4264('0x0'));var Redis=require(_0x4264('0x1'));var qs=require(_0x4264('0x2'));var logger=require('../../config/logger')(_0x4264('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4264('0x4')]=_['defaults'](config['redis'],{'host':_0x4264('0x5'),'port':0x18eb});var socket=require(_0x4264('0x6'))(new Redis(config[_0x4264('0x4')]));require('./squareProject.socket')[_0x4264('0x7')](socket);function respondWithResult(_0x2609a1,_0x29845e){_0x29845e=_0x29845e||0xc8;return function(_0x3f6105){if(_0x3f6105){return _0x2609a1[_0x4264('0x8')](_0x29845e)['json'](_0x3f6105);}};}function respondWithFilteredResult(_0xbbdda2,_0xd24b6e){return function(_0x4cbe84){if(_0x4cbe84){var _0x18e9fe=typeof _0xd24b6e['offset']===_0x4264('0x9')&&typeof _0xd24b6e[_0x4264('0xa')]==='undefined';var _0x111f82=_0x4cbe84[_0x4264('0xb')];var _0x324daf=_0x18e9fe?0x0:_0xd24b6e[_0x4264('0xc')];var _0x281dba=_0x18e9fe?_0x4cbe84[_0x4264('0xb')]:_0xd24b6e[_0x4264('0xc')]+_0xd24b6e['limit'];var _0x71d73;if(_0x281dba>=_0x111f82){_0x281dba=_0x111f82;_0x71d73=0xc8;}else{_0x71d73=0xce;}_0xbbdda2['status'](_0x71d73);return _0xbbdda2[_0x4264('0xd')](_0x4264('0xe'),_0x324daf+'-'+_0x281dba+'/'+_0x111f82)[_0x4264('0xf')](_0x4cbe84);}return null;};}function saveUpdates(_0x1e0a61){return function(_0x37acdb){if(_0x37acdb){return _0x37acdb[_0x4264('0x10')](_0x1e0a61)[_0x4264('0x11')](function(_0x43662f){return _0x43662f;});}return null;};}function removeEntity(_0x16b48b){return function(_0x119d0d){if(_0x119d0d){return _0x119d0d[_0x4264('0x12')]()[_0x4264('0x11')](function(){var _0x4a28d8=_0x119d0d['get']({'plain':!![]});var _0x5d012e='SquareProjects';return db['UserProfileResource']['destroy']({'where':{'type':_0x5d012e,'resourceId':_0x4a28d8['id']}})[_0x4264('0x11')](function(){return _0x119d0d;});})[_0x4264('0x11')](function(){var _0x4cfd1f=new Redis(config[_0x4264('0x4')]);_0x4cfd1f[_0x4264('0x13')](_0x4264('0x14'),JSON['stringify']({'id':_0x119d0d['id'],'deleted':!![]}));})[_0x4264('0x11')](function(){_0x16b48b[_0x4264('0x8')](0xcc)[_0x4264('0x15')]();});}};}function handleEntityNotFound(_0x2b6dbd){return function(_0x3423d1){if(!_0x3423d1){_0x2b6dbd[_0x4264('0x16')](0x194);}return _0x3423d1;};}function handleError(_0x3d1c0d,_0x38853a){_0x38853a=_0x38853a||0x1f4;return function(_0x25c0f7){logger['error'](_0x25c0f7[_0x4264('0x17')]);if(_0x25c0f7['name']){delete _0x25c0f7['name'];}_0x3d1c0d['status'](_0x38853a)[_0x4264('0x18')](_0x25c0f7);};}exports[_0x4264('0x19')]=function(_0x54c4d3,_0x275120){var _0x28b6da={},_0x5a7529={},_0x3c3fc1={'count':0x0,'rows':[]};var _0x421165=_[_0x4264('0x1a')](db['SquareProject'][_0x4264('0x1b')],function(_0x1ddc74){return{'name':_0x1ddc74[_0x4264('0x1c')],'type':_0x1ddc74[_0x4264('0x1d')][_0x4264('0x1e')]};});_0x5a7529[_0x4264('0x1f')]=_[_0x4264('0x1a')](_0x421165,_0x4264('0x20'));_0x5a7529[_0x4264('0x21')]=_[_0x4264('0x22')](_0x54c4d3[_0x4264('0x21')]);_0x5a7529[_0x4264('0x23')]=_[_0x4264('0x24')](_0x5a7529[_0x4264('0x1f')],_0x5a7529[_0x4264('0x21')]);_0x28b6da['attributes']=_[_0x4264('0x24')](_0x5a7529['model'],qs[_0x4264('0x25')](_0x54c4d3[_0x4264('0x21')]['fields']));_0x28b6da['attributes']=_0x28b6da[_0x4264('0x26')][_0x4264('0x27')]?_0x28b6da[_0x4264('0x26')]:_0x5a7529['model'];if(!_0x54c4d3[_0x4264('0x21')][_0x4264('0x28')]('nolimit')){_0x28b6da[_0x4264('0xa')]=qs[_0x4264('0xa')](_0x54c4d3['query'][_0x4264('0xa')]);_0x28b6da[_0x4264('0xc')]=qs[_0x4264('0xc')](_0x54c4d3[_0x4264('0x21')]['offset']);}_0x28b6da[_0x4264('0x29')]=qs[_0x4264('0x2a')](_0x54c4d3[_0x4264('0x21')][_0x4264('0x2a')]);_0x28b6da[_0x4264('0x2b')]=qs['filters'](_['pick'](_0x54c4d3[_0x4264('0x21')],_0x5a7529[_0x4264('0x23')]),_0x421165);if(_0x54c4d3['query'][_0x4264('0x2c')]){_0x28b6da['where']=_['merge'](_0x28b6da['where'],{'$or':_[_0x4264('0x1a')](_0x421165,function(_0x18edda){if(_0x18edda[_0x4264('0x1d')]!==_0x4264('0x2d')){var _0x3c972b={};_0x3c972b[_0x18edda['name']]={'$like':'%'+_0x54c4d3[_0x4264('0x21')][_0x4264('0x2c')]+'%'};return _0x3c972b;}})});}_0x28b6da=_[_0x4264('0x2e')]({},_0x28b6da,_0x54c4d3[_0x4264('0x2f')]);var _0x118349={'where':_0x28b6da[_0x4264('0x2b')]};return db[_0x4264('0x30')][_0x4264('0xb')](_0x118349)[_0x4264('0x11')](function(_0x4c589d){_0x3c3fc1[_0x4264('0xb')]=_0x4c589d;if(_0x54c4d3[_0x4264('0x21')][_0x4264('0x31')]){_0x28b6da[_0x4264('0x32')]=[{'all':!![]}];}return db[_0x4264('0x30')][_0x4264('0x33')](_0x28b6da);})[_0x4264('0x11')](function(_0x21f438){_0x3c3fc1['rows']=_0x21f438;return _0x3c3fc1;})[_0x4264('0x11')](respondWithFilteredResult(_0x275120,_0x28b6da))[_0x4264('0x34')](handleError(_0x275120,null));};exports[_0x4264('0x35')]=function(_0x3c7380,_0x584c18){var _0x265f02={'raw':![],'where':{'id':_0x3c7380[_0x4264('0x36')]['id']}},_0x46812b={};_0x46812b[_0x4264('0x1f')]=_[_0x4264('0x22')](db[_0x4264('0x30')][_0x4264('0x1b')]);_0x46812b[_0x4264('0x21')]=_[_0x4264('0x22')](_0x3c7380[_0x4264('0x21')]);_0x46812b[_0x4264('0x23')]=_[_0x4264('0x24')](_0x46812b[_0x4264('0x1f')],_0x46812b[_0x4264('0x21')]);_0x265f02[_0x4264('0x26')]=_[_0x4264('0x24')](_0x46812b[_0x4264('0x1f')],qs[_0x4264('0x25')](_0x3c7380['query'][_0x4264('0x25')]));_0x265f02['attributes']=_0x265f02[_0x4264('0x26')][_0x4264('0x27')]?_0x265f02[_0x4264('0x26')]:_0x46812b['model'];if(_0x3c7380['query'][_0x4264('0x31')]){_0x265f02['include']=[{'all':!![]}];}_0x265f02=_[_0x4264('0x2e')]({},_0x265f02,_0x3c7380[_0x4264('0x2f')]);return db[_0x4264('0x30')][_0x4264('0x37')](_0x265f02)['then'](handleEntityNotFound(_0x584c18,null))[_0x4264('0x11')](respondWithResult(_0x584c18,null))[_0x4264('0x34')](handleError(_0x584c18,null));};exports['create']=function(_0xf8728e,_0x36b77b){return db[_0x4264('0x30')][_0x4264('0x38')](_0xf8728e[_0x4264('0x39')],{})[_0x4264('0x11')](function(_0x1eb1b3){var _0x59e529=_0xf8728e[_0x4264('0x3a')][_0x4264('0x3b')]({'plain':!![]});if(!_0x59e529)throw new Error(_0x4264('0x3c'));if(_0x59e529['role']===_0x4264('0x3a')){var _0x3f96e2=_0x1eb1b3['get']({'plain':!![]});var _0x35060c=_0x4264('0x3d');return db[_0x4264('0x3e')][_0x4264('0x37')]({'where':{'name':_0x35060c,'userProfileId':_0x59e529[_0x4264('0x3f')]},'raw':!![]})[_0x4264('0x11')](function(_0x1f5889){if(_0x1f5889&&_0x1f5889[_0x4264('0x40')]===0x0){return db[_0x4264('0x41')]['create']({'name':_0x3f96e2[_0x4264('0x20')],'resourceId':_0x3f96e2['id'],'type':_0x1f5889[_0x4264('0x20')],'sectionId':_0x1f5889['id']},{})['then'](function(){return _0x1eb1b3;});}else{return _0x1eb1b3;}})[_0x4264('0x34')](function(_0x4d5b8f){logger['error'](_0x4264('0x42'),_0x4d5b8f);throw _0x4d5b8f;});}return _0x1eb1b3;})[_0x4264('0x11')](respondWithResult(_0x36b77b,0xc9))[_0x4264('0x34')](handleError(_0x36b77b,null));};exports[_0x4264('0x10')]=function(_0x5c2ae0,_0xd4607b){if(_0x5c2ae0[_0x4264('0x39')]['id']){delete _0x5c2ae0[_0x4264('0x39')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x5c2ae0['params']['id']}})['then'](handleEntityNotFound(_0xd4607b,null))['then'](saveUpdates(_0x5c2ae0['body'],null))['then'](function(_0x268c13){if(!_0x268c13)return;var _0x5512ae=_0x268c13[_0x4264('0x3b')]({'plain':!![]});return _0x5512ae;})[_0x4264('0x11')](function(_0x167abf){var _0x354c07=new Redis(config[_0x4264('0x4')]);_0x354c07['publish']('agi',JSON['stringify'](_['pick'](_0x167abf,['id',_0x4264('0x20'),_0x4264('0x43')])));return _0x167abf;})[_0x4264('0x11')](respondWithResult(_0xd4607b,null))['catch'](handleError(_0xd4607b,null));};exports[_0x4264('0x12')]=function(_0x1dac3b,_0x2b3815){return db[_0x4264('0x30')][_0x4264('0x37')]({'where':{'id':_0x1dac3b[_0x4264('0x36')]['id']}})[_0x4264('0x11')](handleEntityNotFound(_0x2b3815,null))['then'](removeEntity(_0x2b3815,null))[_0x4264('0x34')](handleError(_0x2b3815,null));}; \ No newline at end of file +var _0x104a=['keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','options','includeAll','rows','include','merge','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','agi','production','lodash','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','destroy','then','get','UserProfileResource','publish','stringify','sendStatus','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','key','model','map','query'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x104a,0x130));var _0xa104=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x104a[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0xa104('0x0'));var Redis=require('ioredis');var qs=require(_0xa104('0x1'));var logger=require('../../config/logger')(_0xa104('0x2'));var config=require(_0xa104('0x3'));var db=require('../../mysqldb')['db'];config[_0xa104('0x4')]=_[_0xa104('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa104('0x6'))(new Redis(config['redis']));require(_0xa104('0x7'))[_0xa104('0x8')](socket);function respondWithResult(_0x2732bf,_0x523829){_0x523829=_0x523829||0xc8;return function(_0x2b872d){if(_0x2b872d){return _0x2732bf[_0xa104('0x9')](_0x523829)[_0xa104('0xa')](_0x2b872d);}};}function respondWithFilteredResult(_0x144b18,_0x156167){return function(_0x414c0f){if(_0x414c0f){var _0x2b7a74=typeof _0x156167[_0xa104('0xb')]==='undefined'&&typeof _0x156167[_0xa104('0xc')]===_0xa104('0xd');var _0x3eff9d=_0x414c0f['count'];var _0x1fd5f7=_0x2b7a74?0x0:_0x156167[_0xa104('0xb')];var _0x19018e=_0x2b7a74?_0x414c0f[_0xa104('0xe')]:_0x156167[_0xa104('0xb')]+_0x156167['limit'];var _0x25f2ab;if(_0x19018e>=_0x3eff9d){_0x19018e=_0x3eff9d;_0x25f2ab=0xc8;}else{_0x25f2ab=0xce;}_0x144b18[_0xa104('0x9')](_0x25f2ab);return _0x144b18[_0xa104('0xf')](_0xa104('0x10'),_0x1fd5f7+'-'+_0x19018e+'/'+_0x3eff9d)[_0xa104('0xa')](_0x414c0f);}return null;};}function saveUpdates(_0x283386){return function(_0x2b807b){if(_0x2b807b){return _0x2b807b['update'](_0x283386)['then'](function(_0x5369d3){return _0x5369d3;});}return null;};}function removeEntity(_0x3ba6ee){return function(_0x2f4c6c){if(_0x2f4c6c){return _0x2f4c6c[_0xa104('0x11')]()[_0xa104('0x12')](function(){var _0x343cf4=_0x2f4c6c[_0xa104('0x13')]({'plain':!![]});var _0x597b60='SquareProjects';return db[_0xa104('0x14')][_0xa104('0x11')]({'where':{'type':_0x597b60,'resourceId':_0x343cf4['id']}})[_0xa104('0x12')](function(){return _0x2f4c6c;});})[_0xa104('0x12')](function(){var _0x6ded8d=new Redis(config['redis']);_0x6ded8d[_0xa104('0x15')]('agi',JSON[_0xa104('0x16')]({'id':_0x2f4c6c['id'],'deleted':!![]}));})['then'](function(){_0x3ba6ee[_0xa104('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd94920){return function(_0xc0105a){if(!_0xc0105a){_0xd94920[_0xa104('0x17')](0x194);}return _0xc0105a;};}function handleError(_0x5c566c,_0x1298f0){_0x1298f0=_0x1298f0||0x1f4;return function(_0x423886){logger[_0xa104('0x18')](_0x423886[_0xa104('0x19')]);if(_0x423886[_0xa104('0x1a')]){delete _0x423886[_0xa104('0x1a')];}_0x5c566c['status'](_0x1298f0)[_0xa104('0x1b')](_0x423886);};}exports[_0xa104('0x1c')]=function(_0x3e74dc,_0x566fc9){var _0x110683={},_0x3f68ae={},_0x163450={'count':0x0,'rows':[]};var _0x3cc203=_['map'](db[_0xa104('0x1d')][_0xa104('0x1e')],function(_0x19c7b6){return{'name':_0x19c7b6[_0xa104('0x1f')],'type':_0x19c7b6['type'][_0xa104('0x20')]};});_0x3f68ae[_0xa104('0x21')]=_[_0xa104('0x22')](_0x3cc203,_0xa104('0x1a'));_0x3f68ae[_0xa104('0x23')]=_[_0xa104('0x24')](_0x3e74dc[_0xa104('0x23')]);_0x3f68ae['filters']=_[_0xa104('0x25')](_0x3f68ae[_0xa104('0x21')],_0x3f68ae[_0xa104('0x23')]);_0x110683[_0xa104('0x26')]=_[_0xa104('0x25')](_0x3f68ae[_0xa104('0x21')],qs[_0xa104('0x27')](_0x3e74dc[_0xa104('0x23')][_0xa104('0x27')]));_0x110683[_0xa104('0x26')]=_0x110683[_0xa104('0x26')][_0xa104('0x28')]?_0x110683['attributes']:_0x3f68ae[_0xa104('0x21')];if(!_0x3e74dc['query']['hasOwnProperty'](_0xa104('0x29'))){_0x110683[_0xa104('0xc')]=qs['limit'](_0x3e74dc['query'][_0xa104('0xc')]);_0x110683[_0xa104('0xb')]=qs[_0xa104('0xb')](_0x3e74dc[_0xa104('0x23')][_0xa104('0xb')]);}_0x110683[_0xa104('0x2a')]=qs[_0xa104('0x2b')](_0x3e74dc[_0xa104('0x23')][_0xa104('0x2b')]);_0x110683['where']=qs[_0xa104('0x2c')](_[_0xa104('0x2d')](_0x3e74dc['query'],_0x3f68ae[_0xa104('0x2c')]),_0x3cc203);if(_0x3e74dc[_0xa104('0x23')][_0xa104('0x2e')]){_0x110683[_0xa104('0x2f')]=_['merge'](_0x110683[_0xa104('0x2f')],{'$or':_['map'](_0x3cc203,function(_0x44d9de){if(_0x44d9de[_0xa104('0x30')]!==_0xa104('0x31')){var _0x5eb7cb={};_0x5eb7cb[_0x44d9de['name']]={'$like':'%'+_0x3e74dc[_0xa104('0x23')]['filter']+'%'};return _0x5eb7cb;}})});}_0x110683=_['merge']({},_0x110683,_0x3e74dc[_0xa104('0x32')]);var _0x448920={'where':_0x110683[_0xa104('0x2f')]};return db['SquareProject'][_0xa104('0xe')](_0x448920)[_0xa104('0x12')](function(_0xd464b1){_0x163450[_0xa104('0xe')]=_0xd464b1;if(_0x3e74dc[_0xa104('0x23')][_0xa104('0x33')]){_0x110683['include']=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x110683);})[_0xa104('0x12')](function(_0x7a7b92){_0x163450[_0xa104('0x34')]=_0x7a7b92;return _0x163450;})[_0xa104('0x12')](respondWithFilteredResult(_0x566fc9,_0x110683))['catch'](handleError(_0x566fc9,null));};exports['show']=function(_0x2aa408,_0x407105){var _0x1cf6fb={'raw':![],'where':{'id':_0x2aa408['params']['id']}},_0x350fa2={};_0x350fa2[_0xa104('0x21')]=_[_0xa104('0x24')](db[_0xa104('0x1d')][_0xa104('0x1e')]);_0x350fa2[_0xa104('0x23')]=_['keys'](_0x2aa408['query']);_0x350fa2['filters']=_['intersection'](_0x350fa2[_0xa104('0x21')],_0x350fa2[_0xa104('0x23')]);_0x1cf6fb[_0xa104('0x26')]=_[_0xa104('0x25')](_0x350fa2[_0xa104('0x21')],qs[_0xa104('0x27')](_0x2aa408['query'][_0xa104('0x27')]));_0x1cf6fb[_0xa104('0x26')]=_0x1cf6fb[_0xa104('0x26')][_0xa104('0x28')]?_0x1cf6fb['attributes']:_0x350fa2[_0xa104('0x21')];if(_0x2aa408[_0xa104('0x23')]['includeAll']){_0x1cf6fb[_0xa104('0x35')]=[{'all':!![]}];}_0x1cf6fb=_[_0xa104('0x36')]({},_0x1cf6fb,_0x2aa408[_0xa104('0x32')]);return db['SquareProject'][_0xa104('0x37')](_0x1cf6fb)['then'](handleEntityNotFound(_0x407105,null))['then'](respondWithResult(_0x407105,null))[_0xa104('0x38')](handleError(_0x407105,null));};exports[_0xa104('0x39')]=function(_0x4c78e6,_0x3618b5){return db[_0xa104('0x1d')][_0xa104('0x39')](_0x4c78e6[_0xa104('0x3a')],{})[_0xa104('0x12')](function(_0x177c3f){var _0x219ab9=_0x4c78e6[_0xa104('0x3b')][_0xa104('0x13')]({'plain':!![]});if(!_0x219ab9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x219ab9[_0xa104('0x3c')]===_0xa104('0x3b')){var _0x36adec=_0x177c3f[_0xa104('0x13')]({'plain':!![]});var _0x2057a9='SquareProjects';return db[_0xa104('0x3d')]['find']({'where':{'name':_0x2057a9,'userProfileId':_0x219ab9[_0xa104('0x3e')]},'raw':!![]})[_0xa104('0x12')](function(_0x7ea273){if(_0x7ea273&&_0x7ea273[_0xa104('0x3f')]===0x0){return db[_0xa104('0x14')][_0xa104('0x39')]({'name':_0x36adec['name'],'resourceId':_0x36adec['id'],'type':_0x7ea273[_0xa104('0x1a')],'sectionId':_0x7ea273['id']},{})[_0xa104('0x12')](function(){return _0x177c3f;});}else{return _0x177c3f;}})['catch'](function(_0xd15c67){logger['error'](_0xa104('0x40'),_0xd15c67);throw _0xd15c67;});}return _0x177c3f;})[_0xa104('0x12')](respondWithResult(_0x3618b5,0xc9))[_0xa104('0x38')](handleError(_0x3618b5,null));};exports['update']=function(_0x42718a,_0x334871){if(_0x42718a['body']['id']){delete _0x42718a[_0xa104('0x3a')]['id'];}return db['SquareProject'][_0xa104('0x37')]({'where':{'id':_0x42718a[_0xa104('0x41')]['id']}})[_0xa104('0x12')](handleEntityNotFound(_0x334871,null))[_0xa104('0x12')](saveUpdates(_0x42718a[_0xa104('0x3a')],null))['then'](function(_0x5dc524){if(!_0x5dc524)return;var _0x47cd1d=_0x5dc524[_0xa104('0x13')]({'plain':!![]});return _0x47cd1d;})[_0xa104('0x12')](function(_0x4e4cb7){var _0x5d5ea6=new Redis(config[_0xa104('0x4')]);_0x5d5ea6[_0xa104('0x15')](_0xa104('0x42'),JSON[_0xa104('0x16')](_[_0xa104('0x2d')](_0x4e4cb7,['id',_0xa104('0x1a'),_0xa104('0x43')])));return _0x4e4cb7;})['then'](respondWithResult(_0x334871,null))[_0xa104('0x38')](handleError(_0x334871,null));};exports[_0xa104('0x11')]=function(_0x219084,_0x3f68c6){return db[_0xa104('0x1d')][_0xa104('0x37')]({'where':{'id':_0x219084[_0xa104('0x41')]['id']}})['then'](handleEntityNotFound(_0x3f68c6,null))[_0xa104('0x12')](removeEntity(_0x3f68c6,null))['catch'](handleError(_0x3f68c6,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index fe757c7..222a8ab 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 _0x5be6=['hasOwnProperty','exports','events','SquareProject','setMaxListeners','save','update','emit'];(function(_0xc5c4fd,_0x1464e6){var _0x25247e=function(_0x3d782b){while(--_0x3d782b){_0xc5c4fd['push'](_0xc5c4fd['shift']());}};_0x25247e(++_0x1464e6);}(_0x5be6,0x16a));var _0x65be=function(_0x286d63,_0x3d7163){_0x286d63=_0x286d63-0x0;var _0x5cb94c=_0x5be6[_0x286d63];return _0x5cb94c;};'use strict';var EventEmitter=require(_0x65be('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x65be('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x65be('0x2')](0x0);var events={'afterCreate':_0x65be('0x3'),'afterUpdate':_0x65be('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3bb045){return function(_0x106f0c,_0x59f641,_0x5d5787){SquareProjectEvents[_0x65be('0x5')](_0x3bb045+':'+_0x106f0c['id'],_0x106f0c);SquareProjectEvents[_0x65be('0x5')](_0x3bb045,_0x106f0c);_0x5d5787(null);};}for(var e in events){if(events[_0x65be('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x65be('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x6431=['hook','exports','events','SquareProject','setMaxListeners','save','update','emit'];(function(_0x4c8dd1,_0x12b118){var _0x23f5a0=function(_0x2187b8){while(--_0x2187b8){_0x4c8dd1['push'](_0x4c8dd1['shift']());}};_0x23f5a0(++_0x12b118);}(_0x6431,0x12a));var _0x1643=function(_0x2e4434,_0x3d027a){_0x2e4434=_0x2e4434-0x0;var _0x37fdf3=_0x6431[_0x2e4434];return _0x37fdf3;};'use strict';var EventEmitter=require(_0x1643('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x1643('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1643('0x2')](0x0);var events={'afterCreate':_0x1643('0x3'),'afterUpdate':_0x1643('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2c0d65){return function(_0x7989d0,_0x40ab06,_0x49a6f7){SquareProjectEvents[_0x1643('0x5')](_0x2c0d65+':'+_0x7989d0['id'],_0x7989d0);SquareProjectEvents['emit'](_0x2c0d65,_0x7989d0);_0x49a6f7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x1643('0x6')](e,emitEvent(event));}}module[_0x1643('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 feeb01b..cf84fa0 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 _0x2abe=['../../config/environment','exports','SquareProject','changed','preproduction','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4e5bed,_0xbb5c18){var _0x20cefa=function(_0x252dec){while(--_0x252dec){_0x4e5bed['push'](_0x4e5bed['shift']());}};_0x20cefa(++_0xbb5c18);}(_0x2abe,0x92));var _0xe2ab=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x2abe[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0xe2ab('0x0'));var logger=require(_0xe2ab('0x1'))(_0xe2ab('0x2'));var moment=require(_0xe2ab('0x3'));var BPromise=require(_0xe2ab('0x4'));var rp=require(_0xe2ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2ab('0x6'));var config=require(_0xe2ab('0x7'));var attributes=require('./squareProject.attributes');module[_0xe2ab('0x8')]=function(_0x3df75c,_0x67308d){return _0x3df75c['define'](_0xe2ab('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x22101a,_0x28a7e3,_0x70446e){if(_0x22101a[_0xe2ab('0xa')](_0xe2ab('0xb'))){_0x22101a[_0xe2ab('0xc')]=moment()[_0xe2ab('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x22101a[_0xe2ab('0xa')](_0xe2ab('0xe'))){_0x22101a[_0xe2ab('0xf')]=moment()[_0xe2ab('0xd')](_0xe2ab('0x10'));}_0x70446e(null,_0x22101a);}}});}; \ No newline at end of file +var _0xf9c9=['define','changed','savedAt','format','production','publishedAt','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x2187de,_0x5399c1){var _0x57f95c=function(_0x3d4d2b){while(--_0x3d4d2b){_0x2187de['push'](_0x2187de['shift']());}};_0x57f95c(++_0x5399c1);}(_0xf9c9,0x18d));var _0x9f9c=function(_0x25bbd6,_0x18f6d3){_0x25bbd6=_0x25bbd6-0x0;var _0x3a4c78=_0xf9c9[_0x25bbd6];return _0x3a4c78;};'use strict';var _=require('lodash');var util=require(_0x9f9c('0x0'));var logger=require(_0x9f9c('0x1'))(_0x9f9c('0x2'));var moment=require(_0x9f9c('0x3'));var BPromise=require(_0x9f9c('0x4'));var rp=require(_0x9f9c('0x5'));var fs=require('fs');var path=require(_0x9f9c('0x6'));var rimraf=require(_0x9f9c('0x7'));var config=require(_0x9f9c('0x8'));var attributes=require(_0x9f9c('0x9'));module[_0x9f9c('0xa')]=function(_0x47149e,_0x253da7){return _0x47149e[_0x9f9c('0xb')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1504ec,_0x4bd7b9,_0xaf15c9){if(_0x1504ec[_0x9f9c('0xc')]('preproduction')){_0x1504ec[_0x9f9c('0xd')]=moment()[_0x9f9c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1504ec['changed'](_0x9f9c('0xf'))){_0x1504ec[_0x9f9c('0x10')]=moment()[_0x9f9c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0xaf15c9(null,_0x1504ec);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 1b0a740..5d1efdd 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 _0x576d=['stringify','catch','message','find','raw','ShowSquareProject','error','lodash','ioredis','../../mysqldb','../../config/logger','rpc','redis','localhost','register','SquareProject','findAll','options','attributes','limit','include','map','model','then','info','GetSquareProjects','debug'];(function(_0x3b79aa,_0x58e34c){var _0x6e4c5e=function(_0x1de622){while(--_0x1de622){_0x3b79aa['push'](_0x3b79aa['shift']());}};_0x6e4c5e(++_0x58e34c);}(_0x576d,0x19c));var _0xd576=function(_0x34e552,_0x940083){_0x34e552=_0x34e552-0x0;var _0x49c39a=_0x576d[_0x34e552];return _0x49c39a;};'use strict';var _=require(_0xd576('0x0'));var Redis=require(_0xd576('0x1'));var db=require(_0xd576('0x2'))['db'];var logger=require(_0xd576('0x3'))(_0xd576('0x4'));var config=require('../../config/environment');config[_0xd576('0x5')]=_['defaults'](config[_0xd576('0x5')],{'host':_0xd576('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd576('0x5')]));require('./squareProject.socket')[_0xd576('0x7')](socket);exports['GetSquareProjects']=function(_0x30c67e){var _0x370eb0=this;return new Promise(function(_0x3d25d6,_0x4a6785){return db[_0xd576('0x8')][_0xd576('0x9')]({'raw':_0x30c67e[_0xd576('0xa')]?_0x30c67e[_0xd576('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x30c67e[_0xd576('0xa')]?_0x30c67e[_0xd576('0xa')]['where']||null:null,'attributes':_0x30c67e[_0xd576('0xa')]?_0x30c67e[_0xd576('0xa')][_0xd576('0xb')]||null:null,'limit':_0x30c67e['options']?_0x30c67e['options'][_0xd576('0xc')]||null:null,'include':_0x30c67e[_0xd576('0xa')]?_0x30c67e[_0xd576('0xa')][_0xd576('0xd')]?_[_0xd576('0xe')](_0x30c67e['options']['include'],function(_0x186bcb){return{'model':db[_0x186bcb[_0xd576('0xf')]],'as':_0x186bcb['as'],'attributes':_0x186bcb[_0xd576('0xb')],'include':_0x186bcb[_0xd576('0xd')]?_[_0xd576('0xe')](_0x186bcb[_0xd576('0xd')],function(_0x2e010a){return{'model':db[_0x2e010a[_0xd576('0xf')]],'as':_0x2e010a['as'],'attributes':_0x2e010a['attributes'],'include':_0x2e010a[_0xd576('0xd')]?_['map'](_0x2e010a[_0xd576('0xd')],function(_0x16e8fb){return{'model':db[_0x16e8fb['model']],'as':_0x16e8fb['as'],'attributes':_0x16e8fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xd576('0x10')](function(_0x479467){logger[_0xd576('0x11')](_0xd576('0x12'),_0x30c67e);logger[_0xd576('0x13')]('GetSquareProjects',_0x30c67e,JSON[_0xd576('0x14')](_0x479467));_0x3d25d6(_0x479467);})[_0xd576('0x15')](function(_0x53f434){logger['error'](_0xd576('0x12'),_0x53f434[_0xd576('0x16')],_0x30c67e);_0x4a6785(_0x370eb0['error'](0x1f4,_0x53f434[_0xd576('0x16')]));});});};exports['ShowSquareProject']=function(_0x55496c){var _0x3adafb=this;return new Promise(function(_0x2e8045,_0x15863c){return db[_0xd576('0x8')][_0xd576('0x17')]({'raw':_0x55496c[_0xd576('0xa')]?_0x55496c['options'][_0xd576('0x18')]===undefined?!![]:![]:!![],'where':_0x55496c['options']?_0x55496c[_0xd576('0xa')]['where']||null:null,'attributes':_0x55496c[_0xd576('0xa')]?_0x55496c[_0xd576('0xa')][_0xd576('0xb')]||null:null,'include':_0x55496c[_0xd576('0xa')]?_0x55496c[_0xd576('0xa')][_0xd576('0xd')]?_[_0xd576('0xe')](_0x55496c[_0xd576('0xa')][_0xd576('0xd')],function(_0x1b9a6a){return{'model':db[_0x1b9a6a[_0xd576('0xf')]],'as':_0x1b9a6a['as'],'attributes':_0x1b9a6a[_0xd576('0xb')],'include':_0x1b9a6a[_0xd576('0xd')]?_[_0xd576('0xe')](_0x1b9a6a[_0xd576('0xd')],function(_0xdf51ad){return{'model':db[_0xdf51ad[_0xd576('0xf')]],'as':_0xdf51ad['as'],'attributes':_0xdf51ad[_0xd576('0xb')],'include':_0xdf51ad[_0xd576('0xd')]?_['map'](_0xdf51ad[_0xd576('0xd')],function(_0x21947){return{'model':db[_0x21947[_0xd576('0xf')]],'as':_0x21947['as'],'attributes':_0x21947['attributes']};}):[]};}):[]};}):[]:[]})[_0xd576('0x10')](function(_0x175df8){logger[_0xd576('0x11')](_0xd576('0x19'),_0x55496c);logger[_0xd576('0x13')](_0xd576('0x19'),_0x55496c,JSON[_0xd576('0x14')](_0x175df8));_0x2e8045(_0x175df8);})['catch'](function(_0x9fd967){logger[_0xd576('0x1a')](_0xd576('0x19'),_0x9fd967['message'],_0x55496c);_0x15863c(_0x3adafb[_0xd576('0x1a')](0x1f4,_0x9fd967[_0xd576('0x16')]));});});}; \ No newline at end of file +var _0x72c6=['stringify','error','message','ShowSquareProject','find','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','GetSquareProjects','SquareProject','findAll','options','where','include','map','model','attributes','then','info','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72c6,0x92));var _0x672c=function(_0x7a263c,_0x1716a3){_0x7a263c=_0x7a263c-0x0;var _0x4712e4=_0x72c6[_0x7a263c];return _0x4712e4;};'use strict';var _=require(_0x672c('0x0'));var Redis=require(_0x672c('0x1'));var db=require(_0x672c('0x2'))['db'];var logger=require(_0x672c('0x3'))(_0x672c('0x4'));var config=require(_0x672c('0x5'));config['redis']=_[_0x672c('0x6')](config[_0x672c('0x7')],{'host':_0x672c('0x8'),'port':0x18eb});var socket=require(_0x672c('0x9'))(new Redis(config[_0x672c('0x7')]));require('./squareProject.socket')['register'](socket);exports[_0x672c('0xa')]=function(_0x1ce4fe){var _0x3c7c0e=this;return new Promise(function(_0x3ea065,_0x4329dc){return db[_0x672c('0xb')][_0x672c('0xc')]({'raw':_0x1ce4fe[_0x672c('0xd')]?_0x1ce4fe[_0x672c('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x1ce4fe[_0x672c('0xd')]?_0x1ce4fe[_0x672c('0xd')][_0x672c('0xe')]||null:null,'attributes':_0x1ce4fe['options']?_0x1ce4fe[_0x672c('0xd')]['attributes']||null:null,'limit':_0x1ce4fe[_0x672c('0xd')]?_0x1ce4fe[_0x672c('0xd')]['limit']||null:null,'include':_0x1ce4fe[_0x672c('0xd')]?_0x1ce4fe['options'][_0x672c('0xf')]?_[_0x672c('0x10')](_0x1ce4fe['options'][_0x672c('0xf')],function(_0x5f1eb7){return{'model':db[_0x5f1eb7[_0x672c('0x11')]],'as':_0x5f1eb7['as'],'attributes':_0x5f1eb7[_0x672c('0x12')],'include':_0x5f1eb7['include']?_[_0x672c('0x10')](_0x5f1eb7[_0x672c('0xf')],function(_0x219d50){return{'model':db[_0x219d50[_0x672c('0x11')]],'as':_0x219d50['as'],'attributes':_0x219d50[_0x672c('0x12')],'include':_0x219d50[_0x672c('0xf')]?_[_0x672c('0x10')](_0x219d50[_0x672c('0xf')],function(_0x4f9c6f){return{'model':db[_0x4f9c6f[_0x672c('0x11')]],'as':_0x4f9c6f['as'],'attributes':_0x4f9c6f[_0x672c('0x12')]};}):[]};}):[]};}):[]:[]})[_0x672c('0x13')](function(_0x573691){logger[_0x672c('0x14')](_0x672c('0xa'),_0x1ce4fe);logger[_0x672c('0x15')](_0x672c('0xa'),_0x1ce4fe,JSON[_0x672c('0x16')](_0x573691));_0x3ea065(_0x573691);})['catch'](function(_0xaeadb1){logger[_0x672c('0x17')](_0x672c('0xa'),_0xaeadb1['message'],_0x1ce4fe);_0x4329dc(_0x3c7c0e[_0x672c('0x17')](0x1f4,_0xaeadb1[_0x672c('0x18')]));});});};exports[_0x672c('0x19')]=function(_0x3c0f28){var _0x143c54=this;return new Promise(function(_0x13a484,_0x4b22d6){return db[_0x672c('0xb')][_0x672c('0x1a')]({'raw':_0x3c0f28[_0x672c('0xd')]?_0x3c0f28['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c0f28[_0x672c('0xd')]?_0x3c0f28[_0x672c('0xd')][_0x672c('0xe')]||null:null,'attributes':_0x3c0f28[_0x672c('0xd')]?_0x3c0f28['options'][_0x672c('0x12')]||null:null,'include':_0x3c0f28[_0x672c('0xd')]?_0x3c0f28[_0x672c('0xd')]['include']?_[_0x672c('0x10')](_0x3c0f28['options'][_0x672c('0xf')],function(_0x1675a9){return{'model':db[_0x1675a9['model']],'as':_0x1675a9['as'],'attributes':_0x1675a9[_0x672c('0x12')],'include':_0x1675a9[_0x672c('0xf')]?_[_0x672c('0x10')](_0x1675a9[_0x672c('0xf')],function(_0x5aafed){return{'model':db[_0x5aafed[_0x672c('0x11')]],'as':_0x5aafed['as'],'attributes':_0x5aafed[_0x672c('0x12')],'include':_0x5aafed['include']?_[_0x672c('0x10')](_0x5aafed[_0x672c('0xf')],function(_0x1bf65d){return{'model':db[_0x1bf65d['model']],'as':_0x1bf65d['as'],'attributes':_0x1bf65d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x219d8e){logger['info']('ShowSquareProject',_0x3c0f28);logger[_0x672c('0x15')](_0x672c('0x19'),_0x3c0f28,JSON[_0x672c('0x16')](_0x219d8e));_0x13a484(_0x219d8e);})[_0x672c('0x1b')](function(_0x37ea89){logger[_0x672c('0x17')](_0x672c('0x19'),_0x37ea89['message'],_0x3c0f28);_0x4b22d6(_0x143c54[_0x672c('0x17')](0x1f4,_0x37ea89['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 92a76d0..f698be8 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 _0x57ce=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0x57ce,0x141));var _0xe57c=function(_0x1d130d,_0x3b9345){_0x1d130d=_0x1d130d-0x0;var _0x22f511=_0x57ce[_0x1d130d];return _0x22f511;};'use strict';var SquareProjectEvents=require(_0xe57c('0x0'));var events=[_0xe57c('0x1'),_0xe57c('0x2'),_0xe57c('0x3')];function createListener(_0xdb811,_0xa37302){return function(_0x3632ee){_0xa37302[_0xe57c('0x4')](_0xdb811,_0x3632ee);};}function removeListener(_0x53915b,_0x9a138e){return function(){SquareProjectEvents[_0xe57c('0x5')](_0x53915b,_0x9a138e);};}exports[_0xe57c('0x6')]=function(_0x515f30){for(var _0x33bd52=0x0,_0x3c76aa=events['length'];_0x33bd52<_0x3c76aa;_0x33bd52++){var _0x3c692a=events[_0x33bd52];var _0x17196c=createListener(_0xe57c('0x7')+_0x3c692a,_0x515f30);SquareProjectEvents['on'](_0x3c692a,_0x17196c);}}; \ No newline at end of file +var _0x14f3=['remove','emit','removeListener','length','./squareProject.events','save'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x14f3,0xa0));var _0x314f=function(_0x11df5d,_0x331839){_0x11df5d=_0x11df5d-0x0;var _0x49f45b=_0x14f3[_0x11df5d];return _0x49f45b;};'use strict';var SquareProjectEvents=require(_0x314f('0x0'));var events=[_0x314f('0x1'),_0x314f('0x2'),'update'];function createListener(_0x4f1c67,_0x278e63){return function(_0x46e9fd){_0x278e63[_0x314f('0x3')](_0x4f1c67,_0x46e9fd);};}function removeListener(_0x546fdf,_0xd3cbf){return function(){SquareProjectEvents[_0x314f('0x4')](_0x546fdf,_0xd3cbf);};}exports['register']=function(_0x3fb700){for(var _0x3fe25c=0x0,_0x2971f3=events[_0x314f('0x5')];_0x3fe25c<_0x2971f3;_0x3fe25c++){var _0xb2af8f=events[_0x3fe25c];var _0x27d922=createListener('squareProject:'+_0xb2af8f,_0x3fb700);SquareProjectEvents['on'](_0xb2af8f,_0x27d922);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 567c61b..38b4894 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0xb57d7d,_0x548180){var _0x8b88=function(_0x55673e){while(--_0x55673e){_0xb57d7d['push'](_0xb57d7d['shift']());}};_0x8b88(++_0x548180);}(_0x4975,0x86));var _0x5497=function(_0x4f5639,_0x1bf33a){_0x4f5639=_0x4f5639-0x0;var _0x910e09=_0x4975[_0x4f5639];return _0x910e09;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0x326f,0xd1));var _0xf326=function(_0x3a6349,_0x3426cc){_0x3a6349=_0x3a6349-0x0;var _0xb38b8a=_0x326f[_0x3a6349];return _0xb38b8a;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 3ad6ed3..98f7b77 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 _0x7c09=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x1d83ee,_0x88b4b1){var _0x2eacc7=function(_0x5c4778){while(--_0x5c4778){_0x1d83ee['push'](_0x1d83ee['shift']());}};_0x2eacc7(++_0x88b4b1);}(_0x7c09,0x102));var _0x97c0=function(_0x36f27a,_0x572bf9){_0x36f27a=_0x36f27a-0x0;var _0x139ffa=_0x7c09[_0x36f27a];return _0x139ffa;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'uniqueid':{'type':Sequelize[_0x97c0('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'extension':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'dnid':{'type':Sequelize[_0x97c0('0x1')]},'projectName':{'type':Sequelize[_0x97c0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x97c0('0x2')],'get':function(){var _0x42c6c7='';var _0x2c19fa=this[_0x97c0('0x3')](_0x97c0('0x4'));if(_0x2c19fa){_0x42c6c7=_0x2c19fa['substring'](_0x2c19fa[_0x97c0('0x5')]('.'));}return _0x42c6c7;}}}; \ No newline at end of file +var _0xd8fb=['STRING','getDataValue','savePath','sequelize','exports'];(function(_0x3c276b,_0x1e5946){var _0x4e09f5=function(_0x2d01aa){while(--_0x2d01aa){_0x3c276b['push'](_0x3c276b['shift']());}};_0x4e09f5(++_0x1e5946);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3fee3e,_0x3a85b2){_0x3fee3e=_0x3fee3e-0x0;var _0x28e284=_0xd8fb[_0x3fee3e];return _0x28e284;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'uniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'callerid':{'type':Sequelize[_0xbd8f('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbd8f('0x2')]},'accountcode':{'type':Sequelize[_0xbd8f('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbd8f('0x2')]},'saveName':{'type':Sequelize[_0xbd8f('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xbd8f('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0xf503c4='';var _0x578499=this[_0xbd8f('0x3')](_0xbd8f('0x4'));if(_0x578499){_0xf503c4=_0x578499['substring'](_0x578499['lastIndexOf']('.'));}return _0xf503c4;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index ec8114f..29ef4e1 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 _0xe169=['squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','SquareRecording','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','body','download','uniqueid','savePath','filename','format','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','extname','unlink','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash'];(function(_0x519847,_0x1addf2){var _0x3bdda1=function(_0x58419d){while(--_0x58419d){_0x519847['push'](_0x519847['shift']());}};_0x3bdda1(++_0x1addf2);}(_0xe169,0x171));var _0x9e16=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe169[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e16('0x0'));var zipdir=require(_0x9e16('0x1'));var jsonpatch=require(_0x9e16('0x2'));var rp=require(_0x9e16('0x3'));var moment=require(_0x9e16('0x4'));var BPromise=require(_0x9e16('0x5'));var Mustache=require('mustache');var util=require(_0x9e16('0x6'));var path=require(_0x9e16('0x7'));var sox=require(_0x9e16('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e16('0x9'));var _=require(_0x9e16('0xa'));var squel=require(_0x9e16('0xb'));var crypto=require(_0x9e16('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9e16('0xd'));var querystring=require(_0x9e16('0xe'));var Papa=require(_0x9e16('0xf'));var Redis=require('ioredis');var authService=require(_0x9e16('0x10'));var qs=require(_0x9e16('0x11'));var as=require(_0x9e16('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9e16('0x13'));var utils=require(_0x9e16('0x14'));var config=require(_0x9e16('0x15'));var licenseUtil=require(_0x9e16('0x16'));var db=require(_0x9e16('0x17'))['db'];function respondWithStatusCode(_0x2bc042,_0x20666f){_0x20666f=_0x20666f||0xcc;return function(_0x1e622c){if(_0x1e622c){return _0x2bc042[_0x9e16('0x18')](_0x20666f);}return _0x2bc042[_0x9e16('0x19')](_0x20666f)['end']();};}function respondWithResult(_0x249e29,_0x3e6c43){_0x3e6c43=_0x3e6c43||0xc8;return function(_0x2eaca2){if(_0x2eaca2){return _0x249e29['status'](_0x3e6c43)['json'](_0x2eaca2);}};}function respondWithFilteredResult(_0x41acd2,_0x5d6b69){return function(_0x2447fa){if(_0x2447fa){var _0x4b24bf=typeof _0x5d6b69[_0x9e16('0x1a')]===_0x9e16('0x1b')&&typeof _0x5d6b69['limit']===_0x9e16('0x1b');var _0x236c0b=_0x2447fa['count'];var _0x15e29e=_0x4b24bf?0x0:_0x5d6b69['offset'];var _0x54a806=_0x4b24bf?_0x2447fa[_0x9e16('0x1c')]:_0x5d6b69['offset']+_0x5d6b69[_0x9e16('0x1d')];var _0x1c7bd1;if(_0x54a806>=_0x236c0b){_0x54a806=_0x236c0b;_0x1c7bd1=0xc8;}else{_0x1c7bd1=0xce;}_0x41acd2[_0x9e16('0x19')](_0x1c7bd1);return _0x41acd2[_0x9e16('0x1e')](_0x9e16('0x1f'),_0x15e29e+'-'+_0x54a806+'/'+_0x236c0b)[_0x9e16('0x20')](_0x2447fa);}return null;};}function patchUpdates(_0x546487){return function(_0x23f118){try{jsonpatch['apply'](_0x23f118,_0x546487,!![]);}catch(_0x144b4a){return BPromise[_0x9e16('0x21')](_0x144b4a);}return _0x23f118[_0x9e16('0x22')]();};}function saveUpdates(_0x4df0a3,_0x5b22e0){return function(_0x5130ad){if(_0x5130ad){return _0x5130ad[_0x9e16('0x23')](_0x4df0a3)[_0x9e16('0x24')](function(_0x3ecba1){return _0x3ecba1;});}return null;};}function removeEntity(_0xb1b2d4,_0x3cdd84){return function(_0x597ed2){if(_0x597ed2){return _0x597ed2[_0x9e16('0x25')]()['then'](function(){_0xb1b2d4[_0x9e16('0x19')](0xcc)[_0x9e16('0x26')]();});}};}function handleEntityNotFound(_0xb9033,_0x457043){return function(_0x2f0a2d){if(!_0x2f0a2d){_0xb9033[_0x9e16('0x18')](0x194);}return _0x2f0a2d;};}function handleError(_0x377fa7,_0x2a56ea){_0x2a56ea=_0x2a56ea||0x1f4;return function(_0x5cb400){logger[_0x9e16('0x27')](_0x5cb400[_0x9e16('0x28')]);if(_0x5cb400['name']){delete _0x5cb400[_0x9e16('0x29')];}_0x377fa7[_0x9e16('0x19')](_0x2a56ea)[_0x9e16('0x2a')](_0x5cb400);};}exports['index']=function(_0x1e75a1,_0xa27429){var _0x358891={},_0x537820={},_0x4edf8d={'count':0x0,'rows':[]};var _0x761855=_['map'](db[_0x9e16('0x2b')]['rawAttributes'],function(_0x3ccce9){return{'name':_0x3ccce9[_0x9e16('0x2c')],'type':_0x3ccce9[_0x9e16('0x2d')][_0x9e16('0x2e')]};});_0x537820[_0x9e16('0x2f')]=_[_0x9e16('0x30')](_0x761855,_0x9e16('0x29'));_0x537820[_0x9e16('0x31')]=_[_0x9e16('0x32')](_0x1e75a1[_0x9e16('0x31')]);_0x537820[_0x9e16('0x33')]=_[_0x9e16('0x34')](_0x537820[_0x9e16('0x2f')],_0x537820[_0x9e16('0x31')]);_0x358891[_0x9e16('0x35')]=_[_0x9e16('0x34')](_0x537820[_0x9e16('0x2f')],qs[_0x9e16('0x36')](_0x1e75a1['query'][_0x9e16('0x36')]));_0x358891[_0x9e16('0x35')]=_0x358891[_0x9e16('0x35')]['length']?_0x358891[_0x9e16('0x35')]:_0x537820['model'];if(!_0x1e75a1['query'][_0x9e16('0x37')](_0x9e16('0x38'))){_0x358891[_0x9e16('0x1d')]=qs[_0x9e16('0x1d')](_0x1e75a1['query']['limit']);_0x358891['offset']=qs[_0x9e16('0x1a')](_0x1e75a1['query'][_0x9e16('0x1a')]);}_0x358891[_0x9e16('0x39')]=qs['sort'](_0x1e75a1['query'][_0x9e16('0x3a')]);_0x358891[_0x9e16('0x3b')]=qs[_0x9e16('0x33')](_[_0x9e16('0x3c')](_0x1e75a1[_0x9e16('0x31')],_0x537820['filters']),_0x761855);if(_0x1e75a1['query'][_0x9e16('0x3d')]){_0x358891[_0x9e16('0x3b')]=_[_0x9e16('0x3e')](_0x358891[_0x9e16('0x3b')],{'$or':_[_0x9e16('0x30')](_0x761855,function(_0x58ea33){if(_0x58ea33[_0x9e16('0x2d')]!==_0x9e16('0x3f')){var _0x29c33f={};_0x29c33f[_0x58ea33['name']]={'$like':'%'+_0x1e75a1['query'][_0x9e16('0x3d')]+'%'};return _0x29c33f;}})});}_0x358891=_[_0x9e16('0x3e')]({},_0x358891,_0x1e75a1['options']);var _0x5b034c={'where':_0x358891[_0x9e16('0x3b')]};return db[_0x9e16('0x2b')][_0x9e16('0x1c')](_0x5b034c)[_0x9e16('0x24')](function(_0x42c53e){_0x4edf8d[_0x9e16('0x1c')]=_0x42c53e;if(_0x1e75a1[_0x9e16('0x31')][_0x9e16('0x40')]){_0x358891[_0x9e16('0x41')]=[{'all':!![]}];}return db[_0x9e16('0x2b')][_0x9e16('0x42')](_0x358891);})[_0x9e16('0x24')](function(_0x41ca9e){_0x4edf8d['rows']=_0x41ca9e;return _0x4edf8d;})[_0x9e16('0x24')](respondWithFilteredResult(_0xa27429,_0x358891))[_0x9e16('0x43')](handleError(_0xa27429,null));};exports[_0x9e16('0x44')]=function(_0x3a201f,_0x512f9d){var _0x11c69d={'raw':!![],'where':{'id':_0x3a201f[_0x9e16('0x45')]['id']}},_0x43f5ed={};_0x43f5ed[_0x9e16('0x2f')]=_['keys'](db[_0x9e16('0x2b')][_0x9e16('0x46')]);_0x43f5ed[_0x9e16('0x31')]=_[_0x9e16('0x32')](_0x3a201f['query']);_0x43f5ed[_0x9e16('0x33')]=_[_0x9e16('0x34')](_0x43f5ed[_0x9e16('0x2f')],_0x43f5ed[_0x9e16('0x31')]);_0x11c69d[_0x9e16('0x35')]=_['intersection'](_0x43f5ed[_0x9e16('0x2f')],qs[_0x9e16('0x36')](_0x3a201f[_0x9e16('0x31')][_0x9e16('0x36')]));_0x11c69d[_0x9e16('0x35')]=_0x11c69d[_0x9e16('0x35')]['length']?_0x11c69d['attributes']:_0x43f5ed['model'];if(_0x3a201f[_0x9e16('0x31')][_0x9e16('0x40')]){_0x11c69d[_0x9e16('0x41')]=[{'all':!![]}];}_0x11c69d=_[_0x9e16('0x3e')]({},_0x11c69d,_0x3a201f[_0x9e16('0x47')]);return db[_0x9e16('0x2b')][_0x9e16('0x48')](_0x11c69d)[_0x9e16('0x24')](handleEntityNotFound(_0x512f9d,null))[_0x9e16('0x24')](respondWithResult(_0x512f9d,null))['catch'](handleError(_0x512f9d,null));};exports['create']=function(_0x3d5bf2,_0x4cb164){return db[_0x9e16('0x2b')]['create'](_0x3d5bf2[_0x9e16('0x49')],{})['then'](respondWithResult(_0x4cb164,0xc9))[_0x9e16('0x43')](handleError(_0x4cb164,null));};exports[_0x9e16('0x23')]=function(_0x1a87c4,_0x71502c){if(_0x1a87c4[_0x9e16('0x49')]['id']){delete _0x1a87c4[_0x9e16('0x49')]['id'];}return db[_0x9e16('0x2b')][_0x9e16('0x48')]({'where':{'id':_0x1a87c4['params']['id']}})[_0x9e16('0x24')](handleEntityNotFound(_0x71502c,null))['then'](saveUpdates(_0x1a87c4[_0x9e16('0x49')],null))[_0x9e16('0x24')](respondWithResult(_0x71502c,null))[_0x9e16('0x43')](handleError(_0x71502c,null));};exports[_0x9e16('0x4a')]=function(_0x1f74ff,_0x5255b5,_0x5f0054){var _0x337f7f=require('../../components/encryptor');var _0x34de98=![];var _0x41a92c={};if(_0x1f74ff[_0x9e16('0x31')][_0x9e16('0x2d')]&&_0x1f74ff['query'][_0x9e16('0x2d')]===_0x9e16('0x4b')){_0x41a92c[_0x9e16('0x4b')]=_0x1f74ff[_0x9e16('0x45')]['id'];}else{_0x41a92c['id']=_0x1f74ff[_0x9e16('0x45')]['id'];}return db[_0x9e16('0x2b')][_0x9e16('0x48')]({'where':_0x41a92c,'attributes':['id',_0x9e16('0x4c'),_0x9e16('0x4d')],'raw':!![]})[_0x9e16('0x24')](handleEntityNotFound(_0x5255b5,null))[_0x9e16('0x24')](function(_0x3b0909){if(_0x3b0909){var _0x539197=_0x3b0909[_0x9e16('0x4c')];var _0x2d0990=util[_0x9e16('0x4e')]('%s.cypher',_0x539197);if(fs[_0x9e16('0x4f')](_0x2d0990)){_0x34de98=!![];return _0x337f7f[_0x9e16('0x50')](_0x2d0990,_0x539197,config[_0x9e16('0x51')][_0x9e16('0x52')])[_0x9e16('0x24')](function(){return _0x3b0909;});}return _0x3b0909;}})[_0x9e16('0x24')](function(_0x36fdf7){if(_0x36fdf7){var _0x5f0055=_0x36fdf7[_0x9e16('0x4c')];if(!fs[_0x9e16('0x4f')](_0x5f0055)){throw new db['Sequelize'][(_0x9e16('0x53'))](_0x9e16('0x54'));}if(_0x36fdf7[_0x9e16('0x4d')]){return _0x5255b5['download'](_0x5f0055,_0x36fdf7[_0x9e16('0x4d')]+path[_0x9e16('0x55')](_0x5f0055),function(){if(_0x34de98){fs[_0x9e16('0x56')](_0x5f0055);}});}else{return _0x5255b5[_0x9e16('0x4a')](_0x5f0055,function(_0x2dd4b7){if(_0x34de98){fs['unlink'](_0x5f0055);}});}}})[_0x9e16('0x43')](function(_0x17c171){if(_0x17c171['message']===_0x9e16('0x54')){_0x5255b5[_0x9e16('0x19')](0x194)[_0x9e16('0x2a')]('Not\x20found');}else{return handleError(_0x5255b5,null);}});};exports[_0x9e16('0x25')]=function(_0x499eef,_0x16ba2e){return db[_0x9e16('0x2b')][_0x9e16('0x48')]({'where':{'id':_0x499eef[_0x9e16('0x45')]['id']}})[_0x9e16('0x24')](function(_0x4398c2){if(_[_0x9e16('0x57')](_0x4398c2)){throw new ReferenceError(_0x9e16('0x58'));}return _0x4398c2;})[_0x9e16('0x24')](function(_0xfe3cee){var _0x297eec=_0xfe3cee[_0x9e16('0x4c')];logger['info'](_0x9e16('0x59'),_0x297eec);if(!_[_0x9e16('0x57')](_0xfe3cee[_0x9e16('0x4c')])&&fs[_0x9e16('0x4f')](_0x297eec)){logger[_0x9e16('0x5a')](_0x9e16('0x5b')+_0x297eec+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x9e16('0x5c')](_0x297eec);}_0x297eec=_0x297eec+_0x9e16('0x5d');if(!_[_0x9e16('0x57')](_0xfe3cee['savePath'])&&fs[_0x9e16('0x4f')](_0x297eec)){logger[_0x9e16('0x5a')]('File:\x20\x22'+_0x297eec+_0x9e16('0x5e'));fs[_0x9e16('0x5c')](_0x297eec);}return _0xfe3cee;})[_0x9e16('0x24')](function(_0x1660d9){if(!_0x1660d9)throw new InternalError();return _0x1660d9[_0x9e16('0x25')]();})[_0x9e16('0x24')](function(){_0x16ba2e['status'](0xcc)[_0x9e16('0x26')]();})['catch'](handleError(_0x16ba2e,null));}; \ No newline at end of file +var _0xf67f=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','map','SquareRecording','rawAttributes','type','name','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','length','create','body','download','../../components/encryptor','uniqueid','params','find','savePath','filename','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','extname','message','SquareRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status'];(function(_0x27209b,_0x13f886){var _0x219e6a=function(_0x217acc){while(--_0x217acc){_0x27209b['push'](_0x27209b['shift']());}};_0x219e6a(++_0x13f886);}(_0xf67f,0x1b9));var _0xff67=function(_0x67c7e2,_0x5f02ee){_0x67c7e2=_0x67c7e2-0x0;var _0x52b665=_0xf67f[_0x67c7e2];return _0x52b665;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff67('0x0'));var zipdir=require(_0xff67('0x1'));var jsonpatch=require(_0xff67('0x2'));var rp=require('request-promise');var moment=require(_0xff67('0x3'));var BPromise=require(_0xff67('0x4'));var Mustache=require(_0xff67('0x5'));var util=require(_0xff67('0x6'));var path=require('path');var sox=require(_0xff67('0x7'));var csv=require(_0xff67('0x8'));var ejs=require(_0xff67('0x9'));var fs=require('fs');var fs_extra=require(_0xff67('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xff67('0xb'));var jsforce=require(_0xff67('0xc'));var deskjs=require(_0xff67('0xd'));var toCsv=require(_0xff67('0x8'));var querystring=require(_0xff67('0xe'));var Papa=require('papaparse');var Redis=require(_0xff67('0xf'));var authService=require(_0xff67('0x10'));var qs=require(_0xff67('0x11'));var as=require(_0xff67('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff67('0x13'))(_0xff67('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xff67('0x15'))['db'];function respondWithStatusCode(_0x4148a1,_0x2a309a){_0x2a309a=_0x2a309a||0xcc;return function(_0x5e8b34){if(_0x5e8b34){return _0x4148a1[_0xff67('0x16')](_0x2a309a);}return _0x4148a1[_0xff67('0x17')](_0x2a309a)['end']();};}function respondWithResult(_0x3eda98,_0x236649){_0x236649=_0x236649||0xc8;return function(_0x52d46d){if(_0x52d46d){return _0x3eda98[_0xff67('0x17')](_0x236649)['json'](_0x52d46d);}};}function respondWithFilteredResult(_0x42fc78,_0x4f39c5){return function(_0x13093c){if(_0x13093c){var _0x1a869f=typeof _0x4f39c5['offset']===_0xff67('0x18')&&typeof _0x4f39c5[_0xff67('0x19')]===_0xff67('0x18');var _0x1f9051=_0x13093c[_0xff67('0x1a')];var _0x114618=_0x1a869f?0x0:_0x4f39c5[_0xff67('0x1b')];var _0xd886ca=_0x1a869f?_0x13093c[_0xff67('0x1a')]:_0x4f39c5[_0xff67('0x1b')]+_0x4f39c5[_0xff67('0x19')];var _0xb9f3fc;if(_0xd886ca>=_0x1f9051){_0xd886ca=_0x1f9051;_0xb9f3fc=0xc8;}else{_0xb9f3fc=0xce;}_0x42fc78[_0xff67('0x17')](_0xb9f3fc);return _0x42fc78[_0xff67('0x1c')](_0xff67('0x1d'),_0x114618+'-'+_0xd886ca+'/'+_0x1f9051)['json'](_0x13093c);}return null;};}function patchUpdates(_0x310d95){return function(_0x2dbf65){try{jsonpatch[_0xff67('0x1e')](_0x2dbf65,_0x310d95,!![]);}catch(_0x5889d2){return BPromise[_0xff67('0x1f')](_0x5889d2);}return _0x2dbf65[_0xff67('0x20')]();};}function saveUpdates(_0x3f9cc7,_0x8f2166){return function(_0xbc3482){if(_0xbc3482){return _0xbc3482[_0xff67('0x21')](_0x3f9cc7)[_0xff67('0x22')](function(_0x34f6b1){return _0x34f6b1;});}return null;};}function removeEntity(_0x306355,_0x47ab3f){return function(_0x57d089){if(_0x57d089){return _0x57d089[_0xff67('0x23')]()[_0xff67('0x22')](function(){_0x306355['status'](0xcc)[_0xff67('0x24')]();});}};}function handleEntityNotFound(_0x4956b1,_0x2e4632){return function(_0x545fd3){if(!_0x545fd3){_0x4956b1['sendStatus'](0x194);}return _0x545fd3;};}function handleError(_0xeb97f6,_0xadcb6a){_0xadcb6a=_0xadcb6a||0x1f4;return function(_0x77d812){logger[_0xff67('0x25')](_0x77d812[_0xff67('0x26')]);if(_0x77d812['name']){delete _0x77d812['name'];}_0xeb97f6['status'](_0xadcb6a)[_0xff67('0x27')](_0x77d812);};}exports[_0xff67('0x28')]=function(_0x21f114,_0x270ad3){var _0x953ebc={},_0x5e57df={},_0x33ada4={'count':0x0,'rows':[]};var _0x4cabf0=_[_0xff67('0x29')](db[_0xff67('0x2a')][_0xff67('0x2b')],function(_0x555eb6){return{'name':_0x555eb6['fieldName'],'type':_0x555eb6[_0xff67('0x2c')]['key']};});_0x5e57df['model']=_['map'](_0x4cabf0,_0xff67('0x2d'));_0x5e57df[_0xff67('0x2e')]=_[_0xff67('0x2f')](_0x21f114['query']);_0x5e57df[_0xff67('0x30')]=_['intersection'](_0x5e57df['model'],_0x5e57df[_0xff67('0x2e')]);_0x953ebc[_0xff67('0x31')]=_[_0xff67('0x32')](_0x5e57df[_0xff67('0x33')],qs[_0xff67('0x34')](_0x21f114[_0xff67('0x2e')][_0xff67('0x34')]));_0x953ebc['attributes']=_0x953ebc[_0xff67('0x31')]['length']?_0x953ebc[_0xff67('0x31')]:_0x5e57df[_0xff67('0x33')];if(!_0x21f114[_0xff67('0x2e')][_0xff67('0x35')](_0xff67('0x36'))){_0x953ebc[_0xff67('0x19')]=qs['limit'](_0x21f114[_0xff67('0x2e')][_0xff67('0x19')]);_0x953ebc[_0xff67('0x1b')]=qs[_0xff67('0x1b')](_0x21f114[_0xff67('0x2e')]['offset']);}_0x953ebc[_0xff67('0x37')]=qs[_0xff67('0x38')](_0x21f114[_0xff67('0x2e')][_0xff67('0x38')]);_0x953ebc['where']=qs['filters'](_[_0xff67('0x39')](_0x21f114[_0xff67('0x2e')],_0x5e57df[_0xff67('0x30')]),_0x4cabf0);if(_0x21f114[_0xff67('0x2e')]['filter']){_0x953ebc[_0xff67('0x3a')]=_[_0xff67('0x3b')](_0x953ebc[_0xff67('0x3a')],{'$or':_['map'](_0x4cabf0,function(_0xe6b1a0){if(_0xe6b1a0[_0xff67('0x2c')]!==_0xff67('0x3c')){var _0x26fbf8={};_0x26fbf8[_0xe6b1a0['name']]={'$like':'%'+_0x21f114[_0xff67('0x2e')][_0xff67('0x3d')]+'%'};return _0x26fbf8;}})});}_0x953ebc=_[_0xff67('0x3b')]({},_0x953ebc,_0x21f114['options']);var _0x58be43={'where':_0x953ebc[_0xff67('0x3a')]};return db[_0xff67('0x2a')][_0xff67('0x1a')](_0x58be43)[_0xff67('0x22')](function(_0x2a8ca8){_0x33ada4[_0xff67('0x1a')]=_0x2a8ca8;if(_0x21f114['query'][_0xff67('0x3e')]){_0x953ebc[_0xff67('0x3f')]=[{'all':!![]}];}return db[_0xff67('0x2a')][_0xff67('0x40')](_0x953ebc);})['then'](function(_0x223c47){_0x33ada4['rows']=_0x223c47;return _0x33ada4;})['then'](respondWithFilteredResult(_0x270ad3,_0x953ebc))[_0xff67('0x41')](handleError(_0x270ad3,null));};exports['show']=function(_0x11e8ab,_0x22e4bc){var _0x13d396={'raw':!![],'where':{'id':_0x11e8ab['params']['id']}},_0x5eaa50={};_0x5eaa50[_0xff67('0x33')]=_['keys'](db[_0xff67('0x2a')][_0xff67('0x2b')]);_0x5eaa50[_0xff67('0x2e')]=_['keys'](_0x11e8ab[_0xff67('0x2e')]);_0x5eaa50['filters']=_[_0xff67('0x32')](_0x5eaa50[_0xff67('0x33')],_0x5eaa50[_0xff67('0x2e')]);_0x13d396[_0xff67('0x31')]=_['intersection'](_0x5eaa50[_0xff67('0x33')],qs[_0xff67('0x34')](_0x11e8ab['query'][_0xff67('0x34')]));_0x13d396[_0xff67('0x31')]=_0x13d396['attributes'][_0xff67('0x42')]?_0x13d396[_0xff67('0x31')]:_0x5eaa50['model'];if(_0x11e8ab['query'][_0xff67('0x3e')]){_0x13d396['include']=[{'all':!![]}];}_0x13d396=_['merge']({},_0x13d396,_0x11e8ab['options']);return db[_0xff67('0x2a')]['find'](_0x13d396)[_0xff67('0x22')](handleEntityNotFound(_0x22e4bc,null))[_0xff67('0x22')](respondWithResult(_0x22e4bc,null))['catch'](handleError(_0x22e4bc,null));};exports[_0xff67('0x43')]=function(_0x4a73e9,_0x111f1f){return db[_0xff67('0x2a')]['create'](_0x4a73e9[_0xff67('0x44')],{})[_0xff67('0x22')](respondWithResult(_0x111f1f,0xc9))[_0xff67('0x41')](handleError(_0x111f1f,null));};exports[_0xff67('0x21')]=function(_0x4894e7,_0x3dc320){if(_0x4894e7[_0xff67('0x44')]['id']){delete _0x4894e7[_0xff67('0x44')]['id'];}return db[_0xff67('0x2a')]['find']({'where':{'id':_0x4894e7['params']['id']}})[_0xff67('0x22')](handleEntityNotFound(_0x3dc320,null))[_0xff67('0x22')](saveUpdates(_0x4894e7[_0xff67('0x44')],null))['then'](respondWithResult(_0x3dc320,null))[_0xff67('0x41')](handleError(_0x3dc320,null));};exports[_0xff67('0x45')]=function(_0x496b57,_0x25347c,_0x15dd58){var _0x28923e=require(_0xff67('0x46'));var _0x338afa=![];var _0xf22429={};if(_0x496b57['query'][_0xff67('0x2c')]&&_0x496b57[_0xff67('0x2e')][_0xff67('0x2c')]===_0xff67('0x47')){_0xf22429[_0xff67('0x47')]=_0x496b57[_0xff67('0x48')]['id'];}else{_0xf22429['id']=_0x496b57['params']['id'];}return db['SquareRecording'][_0xff67('0x49')]({'where':_0xf22429,'attributes':['id',_0xff67('0x4a'),_0xff67('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x25347c,null))[_0xff67('0x22')](function(_0x190467){if(_0x190467){var _0x1fbbaa=_0x190467[_0xff67('0x4a')];var _0x414401=util['format']('%s.cypher',_0x1fbbaa);if(fs['existsSync'](_0x414401)){_0x338afa=!![];return _0x28923e[_0xff67('0x4c')](_0x414401,_0x1fbbaa,config[_0xff67('0x4d')][_0xff67('0x4e')])['then'](function(){return _0x190467;});}return _0x190467;}})[_0xff67('0x22')](function(_0x181b6e){if(_0x181b6e){var _0x186805=_0x181b6e['savePath'];if(!fs[_0xff67('0x4f')](_0x186805)){throw new db[(_0xff67('0x50'))][(_0xff67('0x51'))]('SquareRecording\x20not\x20found');}if(_0x181b6e[_0xff67('0x4b')]){return _0x25347c[_0xff67('0x45')](_0x186805,_0x181b6e[_0xff67('0x4b')]+path[_0xff67('0x52')](_0x186805),function(){if(_0x338afa){fs['unlink'](_0x186805);}});}else{return _0x25347c[_0xff67('0x45')](_0x186805,function(_0x46e357){if(_0x338afa){fs['unlink'](_0x186805);}});}}})['catch'](function(_0xc883a8){if(_0xc883a8[_0xff67('0x53')]===_0xff67('0x54')){_0x25347c['status'](0x194)['send'](_0xff67('0x55'));}else{return handleError(_0x25347c,null);}});};exports[_0xff67('0x23')]=function(_0x22abdd,_0x2e835c){return db['SquareRecording'][_0xff67('0x49')]({'where':{'id':_0x22abdd[_0xff67('0x48')]['id']}})['then'](function(_0x2106e2){if(_['isNil'](_0x2106e2)){throw new ReferenceError(_0xff67('0x56'));}return _0x2106e2;})[_0xff67('0x22')](function(_0x3fb516){var _0x4b8315=_0x3fb516[_0xff67('0x4a')];logger[_0xff67('0x57')](_0xff67('0x58'),_0x4b8315);if(!_[_0xff67('0x59')](_0x3fb516[_0xff67('0x4a')])&&fs[_0xff67('0x4f')](_0x4b8315)){logger['info'](_0xff67('0x5a')+_0x4b8315+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xff67('0x5b')](_0x4b8315);}_0x4b8315=_0x4b8315+'.cypher';if(!_[_0xff67('0x59')](_0x3fb516[_0xff67('0x4a')])&&fs[_0xff67('0x4f')](_0x4b8315)){logger[_0xff67('0x57')](_0xff67('0x5a')+_0x4b8315+_0xff67('0x5c'));fs['unlinkSync'](_0x4b8315);}return _0x3fb516;})[_0xff67('0x22')](function(_0x1cd17f){if(!_0x1cd17f)throw new InternalError();return _0x1cd17f[_0xff67('0x23')]();})['then'](function(){_0x2e835c[_0xff67('0x17')](0xcc)[_0xff67('0x24')]();})[_0xff67('0x41')](handleError(_0x2e835c,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1785672..1ae84e9 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 _0x62cf=['bluebird','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','moment'];(function(_0xbeb8cc,_0x6508e0){var _0x268a1d=function(_0x33218b){while(--_0x33218b){_0xbeb8cc['push'](_0xbeb8cc['shift']());}};_0x268a1d(++_0x6508e0);}(_0x62cf,0x81));var _0xf62c=function(_0x91674f,_0x53a636){_0x91674f=_0x91674f-0x0;var _0x498908=_0x62cf[_0x91674f];return _0x498908;};'use strict';var _=require(_0xf62c('0x0'));var util=require('util');var logger=require(_0xf62c('0x1'))('api');var moment=require(_0xf62c('0x2'));var BPromise=require(_0xf62c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf62c('0x4'));var config=require(_0xf62c('0x5'));var attributes=require(_0xf62c('0x6'));module[_0xf62c('0x7')]=function(_0x3604f0,_0x40487e){return _0x3604f0[_0xf62c('0x8')](_0xf62c('0x9'),attributes,{'tableName':_0xf62c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3914=['path','rimraf','./squareRecording.attributes','exports','SquareRecording','lodash','util','api','moment','request-promise'];(function(_0x1e3077,_0x9b9b52){var _0x378418=function(_0x19ea91){while(--_0x19ea91){_0x1e3077['push'](_0x1e3077['shift']());}};_0x378418(++_0x9b9b52);}(_0x3914,0xeb));var _0x4391=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x3914[_0x284bc3];return _0x41ac81;};'use strict';var _=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var logger=require('../../config/logger')(_0x4391('0x2'));var moment=require(_0x4391('0x3'));var BPromise=require('bluebird');var rp=require(_0x4391('0x4'));var fs=require('fs');var path=require(_0x4391('0x5'));var rimraf=require(_0x4391('0x6'));var config=require('../../config/environment');var attributes=require(_0x4391('0x7'));module[_0x4391('0x8')]=function(_0x540b62,_0x3717d5){return _0x540b62['define'](_0x4391('0x9'),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 320f809..6cc21f1 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 _0x9464=['../../config/environment','client','http','request','then','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','create','body','options','raw','info','moment','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0xa72cf,_0x24a05c){var _0x263735=function(_0x21b2ae){while(--_0x21b2ae){_0xa72cf['push'](_0xa72cf['shift']());}};_0x263735(++_0x24a05c);}(_0x9464,0x11b));var _0x4946=function(_0x1505e5,_0x5cc291){_0x1505e5=_0x1505e5-0x0;var _0x5b1dcd=_0x9464[_0x1505e5];return _0x5b1dcd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4946('0x0'));var BPromise=require(_0x4946('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4946('0x2'))['db'];var utils=require(_0x4946('0x3'));var logger=require('../../config/logger')(_0x4946('0x4'));var config=require(_0x4946('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4946('0x6')][_0x4946('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f69a5,_0x53584d,_0x12ddea){return new BPromise(function(_0x5356ae,_0x2a58ff){return client[_0x4946('0x8')](_0x4f69a5,_0x12ddea)[_0x4946('0x9')](function(_0x1e0dcf){logger['info']('SquareRecording,\x20%s,\x20%s',_0x53584d,'request\x20sent');logger[_0x4946('0xa')](_0x4946('0xb'),_0x53584d,_0x4946('0xc'),JSON[_0x4946('0xd')](_0x1e0dcf));if(_0x1e0dcf[_0x4946('0xe')]){if(_0x1e0dcf[_0x4946('0xe')]['code']===0x1f4){logger[_0x4946('0xe')](_0x4946('0xf'),_0x53584d,_0x1e0dcf[_0x4946('0xe')][_0x4946('0x10')]);return _0x2a58ff(_0x1e0dcf[_0x4946('0xe')]['message']);}logger[_0x4946('0xe')]('SquareRecording,\x20%s,\x20%s',_0x53584d,_0x1e0dcf[_0x4946('0xe')][_0x4946('0x10')]);return _0x5356ae(_0x1e0dcf['error'][_0x4946('0x10')]);}else{logger['info'](_0x4946('0xf'),_0x53584d,_0x4946('0xc'));_0x5356ae(_0x1e0dcf['result'][_0x4946('0x10')]);}})[_0x4946('0x11')](function(_0x2a4aa0){logger[_0x4946('0xe')](_0x4946('0xf'),_0x53584d,_0x2a4aa0);_0x2a58ff(_0x2a4aa0);});});}exports[_0x4946('0x12')]=function(_0x4de490){var _0x54fd83=this;return new Promise(function(_0x2ccc83,_0x187f0c){return db['SquareRecording'][_0x4946('0x13')](_0x4de490[_0x4946('0x14')],{'raw':_0x4de490[_0x4946('0x15')]?_0x4de490[_0x4946('0x15')][_0x4946('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x5b6fd8){logger[_0x4946('0x17')](_0x4946('0x12'),_0x4de490);logger['debug'](_0x4946('0x12'),_0x4de490,JSON[_0x4946('0xd')](_0x5b6fd8));_0x2ccc83(_0x5b6fd8);})[_0x4946('0x11')](function(_0x40ddeb){logger[_0x4946('0xe')](_0x4946('0x12'),_0x40ddeb[_0x4946('0x10')],_0x4de490);_0x187f0c(_0x54fd83[_0x4946('0xe')](0x1f4,_0x40ddeb[_0x4946('0x10')]));});});}; \ No newline at end of file +var _0x8f8a=['error','code','message','catch','CreateSquareRecording','SquareRecording','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x52bcb8,_0x5e7536){var _0x1e26f2=function(_0x2eab38){while(--_0x2eab38){_0x52bcb8['push'](_0x52bcb8['shift']());}};_0x1e26f2(++_0x5e7536);}(_0x8f8a,0x1e4));var _0xa8f8=function(_0x90c911,_0x1df1c1){_0x90c911=_0x90c911-0x0;var _0x830ac6=_0x8f8a[_0x90c911];return _0x830ac6;};'use strict';var _=require(_0xa8f8('0x0'));var util=require(_0xa8f8('0x1'));var moment=require(_0xa8f8('0x2'));var BPromise=require(_0xa8f8('0x3'));var rs=require(_0xa8f8('0x4'));var fs=require('fs');var Redis=require(_0xa8f8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8f8('0x6'));var logger=require(_0xa8f8('0x7'))(_0xa8f8('0x8'));var config=require(_0xa8f8('0x9'));var jayson=require(_0xa8f8('0xa'));var client=jayson[_0xa8f8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7aac4d,_0x304e2a,_0x5822d6){return new BPromise(function(_0x5df5d4,_0x83ade4){return client[_0xa8f8('0xc')](_0x7aac4d,_0x5822d6)[_0xa8f8('0xd')](function(_0x31e6c5){logger[_0xa8f8('0xe')](_0xa8f8('0xf'),_0x304e2a,'request\x20sent');logger[_0xa8f8('0x10')](_0xa8f8('0x11'),_0x304e2a,_0xa8f8('0x12'),JSON[_0xa8f8('0x13')](_0x31e6c5));if(_0x31e6c5['error']){if(_0x31e6c5[_0xa8f8('0x14')][_0xa8f8('0x15')]===0x1f4){logger[_0xa8f8('0x14')](_0xa8f8('0xf'),_0x304e2a,_0x31e6c5[_0xa8f8('0x14')][_0xa8f8('0x16')]);return _0x83ade4(_0x31e6c5['error'][_0xa8f8('0x16')]);}logger[_0xa8f8('0x14')](_0xa8f8('0xf'),_0x304e2a,_0x31e6c5[_0xa8f8('0x14')][_0xa8f8('0x16')]);return _0x5df5d4(_0x31e6c5[_0xa8f8('0x14')][_0xa8f8('0x16')]);}else{logger[_0xa8f8('0xe')]('SquareRecording,\x20%s,\x20%s',_0x304e2a,_0xa8f8('0x12'));_0x5df5d4(_0x31e6c5['result']['message']);}})[_0xa8f8('0x17')](function(_0x2415a5){logger[_0xa8f8('0x14')](_0xa8f8('0xf'),_0x304e2a,_0x2415a5);_0x83ade4(_0x2415a5);});});}exports[_0xa8f8('0x18')]=function(_0x2499eb){var _0x23aec3=this;return new Promise(function(_0x4a2c1c,_0x4bcb4e){return db[_0xa8f8('0x19')]['create'](_0x2499eb[_0xa8f8('0x1a')],{'raw':_0x2499eb[_0xa8f8('0x1b')]?_0x2499eb[_0xa8f8('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x43e62a){logger[_0xa8f8('0xe')](_0xa8f8('0x18'),_0x2499eb);logger['debug']('CreateSquareRecording',_0x2499eb,JSON[_0xa8f8('0x13')](_0x43e62a));_0x4a2c1c(_0x43e62a);})[_0xa8f8('0x17')](function(_0x5bad94){logger['error'](_0xa8f8('0x18'),_0x5bad94['message'],_0x2499eb);_0x4bcb4e(_0x23aec3['error'](0x1f4,_0x5bad94['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index e2a7ab9..482cee0 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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x43eee3,_0xb26f30){var _0x325ccc=function(_0x12a59a){while(--_0x12a59a){_0x43eee3['push'](_0x43eee3['shift']());}};_0x325ccc(++_0xb26f30);}(_0xe706,0xa3));var _0x6e70=function(_0x7dda42,_0x31357d){_0x7dda42=_0x7dda42-0x0;var _0x3d413c=_0xe706[_0x7dda42];return _0x3d413c;};'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')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x3feb63,_0xf830eb){var _0x16be45=function(_0xd9fd89){while(--_0xd9fd89){_0x3feb63['push'](_0x3feb63['shift']());}};_0x16be45(++_0xf830eb);}(_0xe706,0xa3));var _0x6e70=function(_0x29af39,_0x343c56){_0x29af39=_0x29af39-0x0;var _0x3ab715=_0xe706[_0x29af39];return _0x3ab715;};'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')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 8fb0225..b1cd5b0 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 _0x24d9=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x150fa2,_0x156632){var _0x88e6ba=function(_0x23536e){while(--_0x23536e){_0x150fa2['push'](_0x150fa2['shift']());}};_0x88e6ba(++_0x156632);}(_0x24d9,0xb9));var _0x924d=function(_0x4af33d,_0x4f1b2d){_0x4af33d=_0x4af33d-0x0;var _0x13888e=_0x24d9[_0x4af33d];return _0x13888e;};'use strict';var Sequelize=require(_0x924d('0x0'));module[_0x924d('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x924d('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x924d('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x924d('0x2')]},'calleridname':{'type':Sequelize[_0x924d('0x2')]},'callingpres':{'type':Sequelize[_0x924d('0x2')]},'callingani2':{'type':Sequelize[_0x924d('0x2')]},'callington':{'type':Sequelize[_0x924d('0x2')]},'callingtns':{'type':Sequelize[_0x924d('0x2')]},'dnid':{'type':Sequelize[_0x924d('0x2')]},'rdnis':{'type':Sequelize[_0x924d('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x924d('0x2')]},'enhanced':{'type':Sequelize[_0x924d('0x2')]},'accountcode':{'type':Sequelize[_0x924d('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x924d('0x2')]},'joinAt':{'type':Sequelize[_0x924d('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x924d('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x6e91=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x3bea96,_0x3c740f){var _0x40f13f=function(_0xbd7ecb){while(--_0xbd7ecb){_0x3bea96['push'](_0x3bea96['shift']());}};_0x40f13f(++_0x3c740f);}(_0x6e91,0x15e));var _0x16e9=function(_0x1e8074,_0x363645){_0x1e8074=_0x1e8074-0x0;var _0x3f7da2=_0x6e91[_0x1e8074];return _0x3f7da2;};'use strict';var Sequelize=require(_0x16e9('0x0'));module[_0x16e9('0x1')]={'network':{'type':Sequelize[_0x16e9('0x2')]},'network_script':{'type':Sequelize[_0x16e9('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x16e9('0x2')]},'type':{'type':Sequelize[_0x16e9('0x2')]},'uniqueid':{'type':Sequelize[_0x16e9('0x2')]},'version':{'type':Sequelize[_0x16e9('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x16e9('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x16e9('0x2')]},'callington':{'type':Sequelize[_0x16e9('0x2')]},'callingtns':{'type':Sequelize[_0x16e9('0x2')]},'dnid':{'type':Sequelize[_0x16e9('0x2')]},'rdnis':{'type':Sequelize[_0x16e9('0x2')]},'context':{'type':Sequelize[_0x16e9('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x16e9('0x2')]},'enhanced':{'type':Sequelize[_0x16e9('0x2')]},'accountcode':{'type':Sequelize[_0x16e9('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x16e9('0x3')]},'leaveAt':{'type':Sequelize[_0x16e9('0x3')]},'bot':{'type':Sequelize[_0x16e9('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 db5387e..2842186 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 _0x81ff=['rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','SquareReport','findAll','rows','catch','show','params','options','create','update','body','find','describe','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','destroy','then','stack','name','map'];(function(_0x141570,_0x522ca0){var _0x337242=function(_0x395664){while(--_0x395664){_0x141570['push'](_0x141570['shift']());}};_0x337242(++_0x522ca0);}(_0x81ff,0x15d));var _0xf81f=function(_0x10ce85,_0x19276d){_0x10ce85=_0x10ce85-0x0;var _0x52ac42=_0x81ff[_0x10ce85];return _0x52ac42;};'use strict';var emlformat=require(_0xf81f('0x0'));var rimraf=require(_0xf81f('0x1'));var zipdir=require(_0xf81f('0x2'));var jsonpatch=require(_0xf81f('0x3'));var rp=require(_0xf81f('0x4'));var moment=require(_0xf81f('0x5'));var BPromise=require(_0xf81f('0x6'));var Mustache=require(_0xf81f('0x7'));var util=require(_0xf81f('0x8'));var path=require(_0xf81f('0x9'));var sox=require(_0xf81f('0xa'));var csv=require(_0xf81f('0xb'));var ejs=require(_0xf81f('0xc'));var fs=require('fs');var fs_extra=require(_0xf81f('0xd'));var _=require(_0xf81f('0xe'));var squel=require(_0xf81f('0xf'));var crypto=require(_0xf81f('0x10'));var jsforce=require(_0xf81f('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf81f('0x12'));var Redis=require(_0xf81f('0x13'));var authService=require(_0xf81f('0x14'));var qs=require(_0xf81f('0x15'));var as=require(_0xf81f('0x16'));var hardwareService=require(_0xf81f('0x17'));var logger=require(_0xf81f('0x18'))(_0xf81f('0x19'));var utils=require(_0xf81f('0x1a'));var config=require(_0xf81f('0x1b'));var licenseUtil=require(_0xf81f('0x1c'));var db=require(_0xf81f('0x1d'))['db'];function respondWithStatusCode(_0x4f4996,_0x9b34b0){_0x9b34b0=_0x9b34b0||0xcc;return function(_0x2e3174){if(_0x2e3174){return _0x4f4996[_0xf81f('0x1e')](_0x9b34b0);}return _0x4f4996['status'](_0x9b34b0)[_0xf81f('0x1f')]();};}function respondWithResult(_0x2da484,_0x11189d){_0x11189d=_0x11189d||0xc8;return function(_0xa8da33){if(_0xa8da33){return _0x2da484[_0xf81f('0x20')](_0x11189d)[_0xf81f('0x21')](_0xa8da33);}};}function respondWithFilteredResult(_0x560e5f,_0x97c382){return function(_0x1d3bad){if(_0x1d3bad){var _0x13bb4d=typeof _0x97c382[_0xf81f('0x22')]===_0xf81f('0x23')&&typeof _0x97c382[_0xf81f('0x24')]===_0xf81f('0x23');var _0x36ca74=_0x1d3bad[_0xf81f('0x25')];var _0x414489=_0x13bb4d?0x0:_0x97c382['offset'];var _0x40cf89=_0x13bb4d?_0x1d3bad[_0xf81f('0x25')]:_0x97c382[_0xf81f('0x22')]+_0x97c382[_0xf81f('0x24')];var _0x2acf1e;if(_0x40cf89>=_0x36ca74){_0x40cf89=_0x36ca74;_0x2acf1e=0xc8;}else{_0x2acf1e=0xce;}_0x560e5f[_0xf81f('0x20')](_0x2acf1e);return _0x560e5f[_0xf81f('0x26')]('Content-Range',_0x414489+'-'+_0x40cf89+'/'+_0x36ca74)[_0xf81f('0x21')](_0x1d3bad);}return null;};}function patchUpdates(_0x4cd5dd){return function(_0x9b0235){try{jsonpatch[_0xf81f('0x27')](_0x9b0235,_0x4cd5dd,!![]);}catch(_0x19c01f){return BPromise[_0xf81f('0x28')](_0x19c01f);}return _0x9b0235['save']();};}function saveUpdates(_0x38cfb7,_0x220102){return function(_0x4fc67c){if(_0x4fc67c){return _0x4fc67c['update'](_0x38cfb7)['then'](function(_0x25d422){return _0x25d422;});}return null;};}function removeEntity(_0x3acefa,_0x949252){return function(_0x347558){if(_0x347558){return _0x347558[_0xf81f('0x29')]()[_0xf81f('0x2a')](function(){_0x3acefa[_0xf81f('0x20')](0xcc)[_0xf81f('0x1f')]();});}};}function handleEntityNotFound(_0x2511f6,_0x16f669){return function(_0x1eab83){if(!_0x1eab83){_0x2511f6[_0xf81f('0x1e')](0x194);}return _0x1eab83;};}function handleError(_0x37adb1,_0x229cf0){_0x229cf0=_0x229cf0||0x1f4;return function(_0x5a062f){logger['error'](_0x5a062f[_0xf81f('0x2b')]);if(_0x5a062f[_0xf81f('0x2c')]){delete _0x5a062f[_0xf81f('0x2c')];}_0x37adb1[_0xf81f('0x20')](_0x229cf0)['send'](_0x5a062f);};}exports['index']=function(_0x5e57ba,_0xc7ba99){var _0xcd6f5f={},_0x222d45={},_0x27e357={'count':0x0,'rows':[]};var _0x5f0021=_[_0xf81f('0x2d')](db['SquareReport'][_0xf81f('0x2e')],function(_0x4d4632){return{'name':_0x4d4632['fieldName'],'type':_0x4d4632['type'][_0xf81f('0x2f')]};});_0x222d45[_0xf81f('0x30')]=_[_0xf81f('0x2d')](_0x5f0021,_0xf81f('0x2c'));_0x222d45[_0xf81f('0x31')]=_[_0xf81f('0x32')](_0x5e57ba[_0xf81f('0x31')]);_0x222d45[_0xf81f('0x33')]=_[_0xf81f('0x34')](_0x222d45['model'],_0x222d45[_0xf81f('0x31')]);_0xcd6f5f['attributes']=_[_0xf81f('0x34')](_0x222d45[_0xf81f('0x30')],qs[_0xf81f('0x35')](_0x5e57ba[_0xf81f('0x31')][_0xf81f('0x35')]));_0xcd6f5f[_0xf81f('0x36')]=_0xcd6f5f[_0xf81f('0x36')][_0xf81f('0x37')]?_0xcd6f5f[_0xf81f('0x36')]:_0x222d45[_0xf81f('0x30')];if(!_0x5e57ba[_0xf81f('0x31')][_0xf81f('0x38')](_0xf81f('0x39'))){_0xcd6f5f['limit']=qs[_0xf81f('0x24')](_0x5e57ba[_0xf81f('0x31')][_0xf81f('0x24')]);_0xcd6f5f[_0xf81f('0x22')]=qs['offset'](_0x5e57ba[_0xf81f('0x31')][_0xf81f('0x22')]);}_0xcd6f5f[_0xf81f('0x3a')]=qs[_0xf81f('0x3b')](_0x5e57ba[_0xf81f('0x31')][_0xf81f('0x3b')]);_0xcd6f5f[_0xf81f('0x3c')]=qs[_0xf81f('0x33')](_[_0xf81f('0x3d')](_0x5e57ba['query'],_0x222d45['filters']),_0x5f0021);if(_0x5e57ba[_0xf81f('0x31')][_0xf81f('0x3e')]){_0xcd6f5f[_0xf81f('0x3c')]=_['merge'](_0xcd6f5f['where'],{'$or':_[_0xf81f('0x2d')](_0x5f0021,function(_0x58a019){if(_0x58a019['type']!==_0xf81f('0x3f')){var _0x915ac3={};_0x915ac3[_0x58a019[_0xf81f('0x2c')]]={'$like':'%'+_0x5e57ba[_0xf81f('0x31')][_0xf81f('0x3e')]+'%'};return _0x915ac3;}})});}_0xcd6f5f=_[_0xf81f('0x40')]({},_0xcd6f5f,_0x5e57ba['options']);var _0x4a1995={'where':_0xcd6f5f[_0xf81f('0x3c')]};return db['SquareReport'][_0xf81f('0x25')](_0x4a1995)[_0xf81f('0x2a')](function(_0x2ea7a7){_0x27e357[_0xf81f('0x25')]=_0x2ea7a7;if(_0x5e57ba['query'][_0xf81f('0x41')]){_0xcd6f5f[_0xf81f('0x42')]=[{'all':!![]}];}return db[_0xf81f('0x43')][_0xf81f('0x44')](_0xcd6f5f);})[_0xf81f('0x2a')](function(_0x3a01c3){_0x27e357[_0xf81f('0x45')]=_0x3a01c3;return _0x27e357;})[_0xf81f('0x2a')](respondWithFilteredResult(_0xc7ba99,_0xcd6f5f))[_0xf81f('0x46')](handleError(_0xc7ba99,null));};exports[_0xf81f('0x47')]=function(_0xb3f870,_0x5490bc){var _0x41b135={'raw':!![],'where':{'id':_0xb3f870[_0xf81f('0x48')]['id']}},_0x5810a1={};_0x5810a1[_0xf81f('0x30')]=_[_0xf81f('0x32')](db[_0xf81f('0x43')][_0xf81f('0x2e')]);_0x5810a1[_0xf81f('0x31')]=_[_0xf81f('0x32')](_0xb3f870[_0xf81f('0x31')]);_0x5810a1[_0xf81f('0x33')]=_[_0xf81f('0x34')](_0x5810a1[_0xf81f('0x30')],_0x5810a1[_0xf81f('0x31')]);_0x41b135[_0xf81f('0x36')]=_[_0xf81f('0x34')](_0x5810a1['model'],qs[_0xf81f('0x35')](_0xb3f870[_0xf81f('0x31')][_0xf81f('0x35')]));_0x41b135[_0xf81f('0x36')]=_0x41b135[_0xf81f('0x36')][_0xf81f('0x37')]?_0x41b135[_0xf81f('0x36')]:_0x5810a1[_0xf81f('0x30')];if(_0xb3f870[_0xf81f('0x31')][_0xf81f('0x41')]){_0x41b135[_0xf81f('0x42')]=[{'all':!![]}];}_0x41b135=_[_0xf81f('0x40')]({},_0x41b135,_0xb3f870[_0xf81f('0x49')]);return db['SquareReport']['find'](_0x41b135)[_0xf81f('0x2a')](handleEntityNotFound(_0x5490bc,null))[_0xf81f('0x2a')](respondWithResult(_0x5490bc,null))[_0xf81f('0x46')](handleError(_0x5490bc,null));};exports[_0xf81f('0x4a')]=function(_0x28278f,_0xb22704){return db[_0xf81f('0x43')][_0xf81f('0x4a')](_0x28278f['body'],{})[_0xf81f('0x2a')](respondWithResult(_0xb22704,0xc9))['catch'](handleError(_0xb22704,null));};exports[_0xf81f('0x4b')]=function(_0x5e86b6,_0x88827e){if(_0x5e86b6[_0xf81f('0x4c')]['id']){delete _0x5e86b6[_0xf81f('0x4c')]['id'];}return db['SquareReport'][_0xf81f('0x4d')]({'where':{'id':_0x5e86b6[_0xf81f('0x48')]['id']}})[_0xf81f('0x2a')](handleEntityNotFound(_0x88827e,null))[_0xf81f('0x2a')](saveUpdates(_0x5e86b6[_0xf81f('0x4c')],null))[_0xf81f('0x2a')](respondWithResult(_0x88827e,null))['catch'](handleError(_0x88827e,null));};exports['destroy']=function(_0x46d6a3,_0x597925){return db[_0xf81f('0x43')]['find']({'where':{'id':_0x46d6a3['params']['id']}})['then'](handleEntityNotFound(_0x597925,null))[_0xf81f('0x2a')](removeEntity(_0x597925,null))[_0xf81f('0x46')](handleError(_0x597925,null));};exports['describe']=function(_0x194412,_0x7ad313){return db[_0xf81f('0x43')][_0xf81f('0x4e')]()['then'](respondWithResult(_0x7ad313,null))[_0xf81f('0x46')](handleError(_0x7ad313,null));}; \ No newline at end of file +var _0xf98d=['save','then','error','stack','name','send','index','map','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','type','filter','merge','options','includeAll','rows','show','keys','include','catch','create','SquareReport','body','update','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range'];(function(_0x5b129f,_0x26183f){var _0x43b93d=function(_0x56d68d){while(--_0x56d68d){_0x5b129f['push'](_0x5b129f['shift']());}};_0x43b93d(++_0x26183f);}(_0xf98d,0x1dc));var _0xdf98=function(_0x229c10,_0xf06473){_0x229c10=_0x229c10-0x0;var _0xee5e8b=_0xf98d[_0x229c10];return _0xee5e8b;};'use strict';var emlformat=require(_0xdf98('0x0'));var rimraf=require(_0xdf98('0x1'));var zipdir=require(_0xdf98('0x2'));var jsonpatch=require(_0xdf98('0x3'));var rp=require(_0xdf98('0x4'));var moment=require(_0xdf98('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf98('0x6'));var util=require(_0xdf98('0x7'));var path=require(_0xdf98('0x8'));var sox=require(_0xdf98('0x9'));var csv=require(_0xdf98('0xa'));var ejs=require(_0xdf98('0xb'));var fs=require('fs');var fs_extra=require(_0xdf98('0xc'));var _=require(_0xdf98('0xd'));var squel=require(_0xdf98('0xe'));var crypto=require('crypto');var jsforce=require(_0xdf98('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdf98('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdf98('0x10'));var authService=require(_0xdf98('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdf98('0x12'));var hardwareService=require(_0xdf98('0x13'));var logger=require(_0xdf98('0x14'))(_0xdf98('0x15'));var utils=require(_0xdf98('0x16'));var config=require(_0xdf98('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf98('0x18'))['db'];function respondWithStatusCode(_0x16e8e6,_0xeacc78){_0xeacc78=_0xeacc78||0xcc;return function(_0x3c4c52){if(_0x3c4c52){return _0x16e8e6[_0xdf98('0x19')](_0xeacc78);}return _0x16e8e6['status'](_0xeacc78)[_0xdf98('0x1a')]();};}function respondWithResult(_0x5a7c37,_0x55dc10){_0x55dc10=_0x55dc10||0xc8;return function(_0x598720){if(_0x598720){return _0x5a7c37['status'](_0x55dc10)[_0xdf98('0x1b')](_0x598720);}};}function respondWithFilteredResult(_0x3ae05b,_0x19e089){return function(_0x3f6b5a){if(_0x3f6b5a){var _0x2dbb80=typeof _0x19e089[_0xdf98('0x1c')]===_0xdf98('0x1d')&&typeof _0x19e089[_0xdf98('0x1e')]===_0xdf98('0x1d');var _0x3331a6=_0x3f6b5a[_0xdf98('0x1f')];var _0x15960c=_0x2dbb80?0x0:_0x19e089[_0xdf98('0x1c')];var _0x539e5b=_0x2dbb80?_0x3f6b5a[_0xdf98('0x1f')]:_0x19e089[_0xdf98('0x1c')]+_0x19e089[_0xdf98('0x1e')];var _0x2d9046;if(_0x539e5b>=_0x3331a6){_0x539e5b=_0x3331a6;_0x2d9046=0xc8;}else{_0x2d9046=0xce;}_0x3ae05b[_0xdf98('0x20')](_0x2d9046);return _0x3ae05b[_0xdf98('0x21')](_0xdf98('0x22'),_0x15960c+'-'+_0x539e5b+'/'+_0x3331a6)[_0xdf98('0x1b')](_0x3f6b5a);}return null;};}function patchUpdates(_0x551fdb){return function(_0x2cb21a){try{jsonpatch['apply'](_0x2cb21a,_0x551fdb,!![]);}catch(_0x4b81e9){return BPromise['reject'](_0x4b81e9);}return _0x2cb21a[_0xdf98('0x23')]();};}function saveUpdates(_0x5b6c9d,_0x2151e7){return function(_0x587511){if(_0x587511){return _0x587511['update'](_0x5b6c9d)[_0xdf98('0x24')](function(_0x4346af){return _0x4346af;});}return null;};}function removeEntity(_0xa3158f,_0x4ea3b5){return function(_0x53f750){if(_0x53f750){return _0x53f750['destroy']()[_0xdf98('0x24')](function(){_0xa3158f[_0xdf98('0x20')](0xcc)[_0xdf98('0x1a')]();});}};}function handleEntityNotFound(_0x52ffee,_0xcea17){return function(_0xf875bb){if(!_0xf875bb){_0x52ffee[_0xdf98('0x19')](0x194);}return _0xf875bb;};}function handleError(_0x3485aa,_0x4e85d1){_0x4e85d1=_0x4e85d1||0x1f4;return function(_0x523c2f){logger[_0xdf98('0x25')](_0x523c2f[_0xdf98('0x26')]);if(_0x523c2f[_0xdf98('0x27')]){delete _0x523c2f[_0xdf98('0x27')];}_0x3485aa['status'](_0x4e85d1)[_0xdf98('0x28')](_0x523c2f);};}exports[_0xdf98('0x29')]=function(_0x23982d,_0x377720){var _0xe23750={},_0x10edff={},_0x28d870={'count':0x0,'rows':[]};var _0xa00357=_[_0xdf98('0x2a')](db['SquareReport']['rawAttributes'],function(_0x146d96){return{'name':_0x146d96[_0xdf98('0x2b')],'type':_0x146d96['type'][_0xdf98('0x2c')]};});_0x10edff[_0xdf98('0x2d')]=_[_0xdf98('0x2a')](_0xa00357,_0xdf98('0x27'));_0x10edff[_0xdf98('0x2e')]=_['keys'](_0x23982d[_0xdf98('0x2e')]);_0x10edff['filters']=_[_0xdf98('0x2f')](_0x10edff['model'],_0x10edff[_0xdf98('0x2e')]);_0xe23750[_0xdf98('0x30')]=_[_0xdf98('0x2f')](_0x10edff['model'],qs['fields'](_0x23982d[_0xdf98('0x2e')][_0xdf98('0x31')]));_0xe23750[_0xdf98('0x30')]=_0xe23750[_0xdf98('0x30')][_0xdf98('0x32')]?_0xe23750['attributes']:_0x10edff['model'];if(!_0x23982d[_0xdf98('0x2e')]['hasOwnProperty'](_0xdf98('0x33'))){_0xe23750['limit']=qs['limit'](_0x23982d[_0xdf98('0x2e')][_0xdf98('0x1e')]);_0xe23750[_0xdf98('0x1c')]=qs[_0xdf98('0x1c')](_0x23982d[_0xdf98('0x2e')][_0xdf98('0x1c')]);}_0xe23750['order']=qs[_0xdf98('0x34')](_0x23982d['query'][_0xdf98('0x34')]);_0xe23750[_0xdf98('0x35')]=qs[_0xdf98('0x36')](_[_0xdf98('0x37')](_0x23982d[_0xdf98('0x2e')],_0x10edff['filters']),_0xa00357);if(_0x23982d[_0xdf98('0x2e')]['filter']){_0xe23750[_0xdf98('0x35')]=_['merge'](_0xe23750['where'],{'$or':_['map'](_0xa00357,function(_0x80f829){if(_0x80f829[_0xdf98('0x38')]!=='VIRTUAL'){var _0x559738={};_0x559738[_0x80f829['name']]={'$like':'%'+_0x23982d[_0xdf98('0x2e')][_0xdf98('0x39')]+'%'};return _0x559738;}})});}_0xe23750=_[_0xdf98('0x3a')]({},_0xe23750,_0x23982d[_0xdf98('0x3b')]);var _0x562d71={'where':_0xe23750['where']};return db['SquareReport']['count'](_0x562d71)[_0xdf98('0x24')](function(_0x4ed56c){_0x28d870[_0xdf98('0x1f')]=_0x4ed56c;if(_0x23982d[_0xdf98('0x2e')][_0xdf98('0x3c')]){_0xe23750['include']=[{'all':!![]}];}return db['SquareReport']['findAll'](_0xe23750);})[_0xdf98('0x24')](function(_0x1bbb94){_0x28d870[_0xdf98('0x3d')]=_0x1bbb94;return _0x28d870;})[_0xdf98('0x24')](respondWithFilteredResult(_0x377720,_0xe23750))['catch'](handleError(_0x377720,null));};exports[_0xdf98('0x3e')]=function(_0x151e95,_0x2360f6){var _0x6ba96f={'raw':!![],'where':{'id':_0x151e95['params']['id']}},_0x3bc219={};_0x3bc219['model']=_[_0xdf98('0x3f')](db['SquareReport']['rawAttributes']);_0x3bc219[_0xdf98('0x2e')]=_[_0xdf98('0x3f')](_0x151e95[_0xdf98('0x2e')]);_0x3bc219['filters']=_['intersection'](_0x3bc219[_0xdf98('0x2d')],_0x3bc219[_0xdf98('0x2e')]);_0x6ba96f[_0xdf98('0x30')]=_[_0xdf98('0x2f')](_0x3bc219[_0xdf98('0x2d')],qs[_0xdf98('0x31')](_0x151e95['query'][_0xdf98('0x31')]));_0x6ba96f[_0xdf98('0x30')]=_0x6ba96f['attributes'][_0xdf98('0x32')]?_0x6ba96f[_0xdf98('0x30')]:_0x3bc219['model'];if(_0x151e95[_0xdf98('0x2e')]['includeAll']){_0x6ba96f[_0xdf98('0x40')]=[{'all':!![]}];}_0x6ba96f=_[_0xdf98('0x3a')]({},_0x6ba96f,_0x151e95[_0xdf98('0x3b')]);return db['SquareReport']['find'](_0x6ba96f)[_0xdf98('0x24')](handleEntityNotFound(_0x2360f6,null))[_0xdf98('0x24')](respondWithResult(_0x2360f6,null))[_0xdf98('0x41')](handleError(_0x2360f6,null));};exports[_0xdf98('0x42')]=function(_0x2ce9c5,_0x577b53){return db[_0xdf98('0x43')][_0xdf98('0x42')](_0x2ce9c5[_0xdf98('0x44')],{})[_0xdf98('0x24')](respondWithResult(_0x577b53,0xc9))[_0xdf98('0x41')](handleError(_0x577b53,null));};exports[_0xdf98('0x45')]=function(_0x309b97,_0x189365){if(_0x309b97[_0xdf98('0x44')]['id']){delete _0x309b97[_0xdf98('0x44')]['id'];}return db[_0xdf98('0x43')][_0xdf98('0x46')]({'where':{'id':_0x309b97[_0xdf98('0x47')]['id']}})[_0xdf98('0x24')](handleEntityNotFound(_0x189365,null))[_0xdf98('0x24')](saveUpdates(_0x309b97[_0xdf98('0x44')],null))[_0xdf98('0x24')](respondWithResult(_0x189365,null))['catch'](handleError(_0x189365,null));};exports['destroy']=function(_0x31e90e,_0x335fc9){return db[_0xdf98('0x43')][_0xdf98('0x46')]({'where':{'id':_0x31e90e[_0xdf98('0x47')]['id']}})['then'](handleEntityNotFound(_0x335fc9,null))['then'](removeEntity(_0x335fc9,null))[_0xdf98('0x41')](handleError(_0x335fc9,null));};exports[_0xdf98('0x48')]=function(_0xabeab,_0x179aad){return db[_0xdf98('0x43')][_0xdf98('0x48')]()[_0xdf98('0x24')](respondWithResult(_0x179aad,null))[_0xdf98('0x41')](handleError(_0x179aad,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a26d08b..7e58610 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 _0x5371=['request-promise','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','api','bluebird'];(function(_0x418767,_0x32ee0e){var _0x5e17c1=function(_0x2fe09f){while(--_0x2fe09f){_0x418767['push'](_0x418767['shift']());}};_0x5e17c1(++_0x32ee0e);}(_0x5371,0xce));var _0x1537=function(_0xc37b9d,_0x2c179a){_0xc37b9d=_0xc37b9d-0x0;var _0x445cbc=_0x5371[_0xc37b9d];return _0x445cbc;};'use strict';var _=require(_0x1537('0x0'));var util=require(_0x1537('0x1'));var logger=require('../../config/logger')(_0x1537('0x2'));var moment=require('moment');var BPromise=require(_0x1537('0x3'));var rp=require(_0x1537('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1537('0x5'));var config=require(_0x1537('0x6'));var attributes=require(_0x1537('0x7'));module['exports']=function(_0x5636f3,_0x561c35){return _0x5636f3[_0x1537('0x8')](_0x1537('0x9'),attributes,{'tableName':_0x1537('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x1537('0xb'),_0x1537('0xc')]},{'name':_0x1537('0xd'),'fields':[_0x1537('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe194=['rimraf','../../config/environment','define','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x16286a,_0x11e9cf){var _0x5b6524=function(_0x5b6b9a){while(--_0x5b6b9a){_0x16286a['push'](_0x16286a['shift']());}};_0x5b6524(++_0x11e9cf);}(_0xe194,0xe6));var _0x4e19=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0xe194[_0x2dc343];return _0x51eac5;};'use strict';var _=require(_0x4e19('0x0'));var util=require(_0x4e19('0x1'));var logger=require(_0x4e19('0x2'))(_0x4e19('0x3'));var moment=require(_0x4e19('0x4'));var BPromise=require(_0x4e19('0x5'));var rp=require(_0x4e19('0x6'));var fs=require('fs');var path=require(_0x4e19('0x7'));var rimraf=require(_0x4e19('0x8'));var config=require(_0x4e19('0x9'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x1fe936,_0x3fd8ab){return _0x1fe936[_0x4e19('0xa')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x4e19('0xb'),'fields':[_0x4e19('0xc'),'project_name']},{'name':_0x4e19('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 f9836fb..4e3f13a 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 _0x1e39=['CreateSquareReport','body','options','raw','UpdateSquareReport','SquareReport','update','where','limit','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x132451,_0x23d4ce){var _0x2838ac=function(_0x4ed18e){while(--_0x4ed18e){_0x132451['push'](_0x132451['shift']());}};_0x2838ac(++_0x23d4ce);}(_0x1e39,0xe3));var _0x91e3=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x1e39[_0xadde88];return _0x3b8eb6;};'use strict';var _=require(_0x91e3('0x0'));var util=require(_0x91e3('0x1'));var moment=require(_0x91e3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x91e3('0x3'));var db=require(_0x91e3('0x4'))['db'];var utils=require(_0x91e3('0x5'));var logger=require(_0x91e3('0x6'))('rpc');var config=require(_0x91e3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x91e3('0x8')][_0x91e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd2f4a7,_0xf32d00,_0x3d5e8c){return new BPromise(function(_0xb884bd,_0x30b56d){return client['request'](_0xd2f4a7,_0x3d5e8c)[_0x91e3('0xa')](function(_0x542186){logger[_0x91e3('0xb')](_0x91e3('0xc'),_0xf32d00,_0x91e3('0xd'));logger['debug'](_0x91e3('0xe'),_0xf32d00,_0x91e3('0xd'),JSON[_0x91e3('0xf')](_0x542186));if(_0x542186[_0x91e3('0x10')]){if(_0x542186[_0x91e3('0x10')][_0x91e3('0x11')]===0x1f4){logger[_0x91e3('0x10')](_0x91e3('0xc'),_0xf32d00,_0x542186[_0x91e3('0x10')][_0x91e3('0x12')]);return _0x30b56d(_0x542186[_0x91e3('0x10')][_0x91e3('0x12')]);}logger['error'](_0x91e3('0xc'),_0xf32d00,_0x542186[_0x91e3('0x10')][_0x91e3('0x12')]);return _0xb884bd(_0x542186[_0x91e3('0x10')][_0x91e3('0x12')]);}else{logger['info'](_0x91e3('0xc'),_0xf32d00,'request\x20sent');_0xb884bd(_0x542186[_0x91e3('0x13')][_0x91e3('0x12')]);}})[_0x91e3('0x14')](function(_0x2d7635){logger['error'](_0x91e3('0xc'),_0xf32d00,_0x2d7635);_0x30b56d(_0x2d7635);});});}exports[_0x91e3('0x15')]=function(_0x9dc8cb){var _0x43d263=this;return new Promise(function(_0x49d1e2,_0x35ef9a){return db['SquareReport']['create'](_0x9dc8cb[_0x91e3('0x16')],{'raw':_0x9dc8cb[_0x91e3('0x17')]?_0x9dc8cb['options'][_0x91e3('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5768f9){logger[_0x91e3('0xb')](_0x91e3('0x15'),_0x9dc8cb);logger['debug'](_0x91e3('0x15'),_0x9dc8cb,JSON['stringify'](_0x5768f9));_0x49d1e2(_0x5768f9);})['catch'](function(_0x1e8f7c){logger[_0x91e3('0x10')](_0x91e3('0x15'),_0x1e8f7c[_0x91e3('0x12')],_0x9dc8cb);_0x35ef9a(_0x43d263[_0x91e3('0x10')](0x1f4,_0x1e8f7c[_0x91e3('0x12')]));});});};exports[_0x91e3('0x19')]=function(_0x3bba44){var _0x292bcc=this;return new Promise(function(_0x310e2a,_0x374ffd){return db[_0x91e3('0x1a')][_0x91e3('0x1b')](_0x3bba44[_0x91e3('0x16')],{'raw':_0x3bba44['options']?_0x3bba44[_0x91e3('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bba44[_0x91e3('0x17')]?_0x3bba44[_0x91e3('0x17')][_0x91e3('0x1c')]||null:null,'attributes':_0x3bba44[_0x91e3('0x17')]?_0x3bba44[_0x91e3('0x17')]['attributes']||null:null,'limit':_0x3bba44[_0x91e3('0x17')]?_0x3bba44[_0x91e3('0x17')][_0x91e3('0x1d')]||null:null})[_0x91e3('0xa')](function(_0x38a901){logger[_0x91e3('0xb')]('UpdateSquareReport',_0x3bba44);logger[_0x91e3('0x1e')](_0x91e3('0x19'),_0x3bba44,JSON[_0x91e3('0xf')](_0x38a901));_0x310e2a(_0x38a901);})[_0x91e3('0x14')](function(_0x17c18b){logger['error'](_0x91e3('0x19'),_0x17c18b[_0x91e3('0x12')],_0x3bba44);_0x374ffd(_0x292bcc[_0x91e3('0x10')](0x1f4,_0x17c18b[_0x91e3('0x12')]));});});}; \ No newline at end of file +var _0x18ec=['error','code','message','catch','CreateSquareReport','SquareReport','body','options','raw','debug','UpdateSquareReport','update','where','limit','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x18ec,0x1c1));var _0xc18e=function(_0x56a502,_0x32dade){_0x56a502=_0x56a502-0x0;var _0xa94418=_0x18ec[_0x56a502];return _0xa94418;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc18e('0x0'));var BPromise=require('bluebird');var rs=require(_0xc18e('0x1'));var fs=require('fs');var Redis=require(_0xc18e('0x2'));var db=require(_0xc18e('0x3'))['db'];var utils=require(_0xc18e('0x4'));var logger=require(_0xc18e('0x5'))(_0xc18e('0x6'));var config=require('../../config/environment');var jayson=require(_0xc18e('0x7'));var client=jayson[_0xc18e('0x8')][_0xc18e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb60b81,_0x4d47e9,_0x18b80e){return new BPromise(function(_0x43f44f,_0x3f165a){return client['request'](_0xb60b81,_0x18b80e)[_0xc18e('0xa')](function(_0x5ecdef){logger[_0xc18e('0xb')](_0xc18e('0xc'),_0x4d47e9,_0xc18e('0xd'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x4d47e9,'request\x20sent',JSON[_0xc18e('0xe')](_0x5ecdef));if(_0x5ecdef[_0xc18e('0xf')]){if(_0x5ecdef[_0xc18e('0xf')][_0xc18e('0x10')]===0x1f4){logger['error'](_0xc18e('0xc'),_0x4d47e9,_0x5ecdef['error'][_0xc18e('0x11')]);return _0x3f165a(_0x5ecdef[_0xc18e('0xf')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x4d47e9,_0x5ecdef[_0xc18e('0xf')]['message']);return _0x43f44f(_0x5ecdef[_0xc18e('0xf')][_0xc18e('0x11')]);}else{logger['info'](_0xc18e('0xc'),_0x4d47e9,'request\x20sent');_0x43f44f(_0x5ecdef['result'][_0xc18e('0x11')]);}})[_0xc18e('0x12')](function(_0x16f9f){logger['error'](_0xc18e('0xc'),_0x4d47e9,_0x16f9f);_0x3f165a(_0x16f9f);});});}exports[_0xc18e('0x13')]=function(_0x458f0e){var _0x3ef827=this;return new Promise(function(_0x46a9c5,_0x744c90){return db[_0xc18e('0x14')]['create'](_0x458f0e[_0xc18e('0x15')],{'raw':_0x458f0e[_0xc18e('0x16')]?_0x458f0e[_0xc18e('0x16')][_0xc18e('0x17')]===undefined?!![]:![]:!![]})[_0xc18e('0xa')](function(_0x4743bc){logger['info'](_0xc18e('0x13'),_0x458f0e);logger[_0xc18e('0x18')](_0xc18e('0x13'),_0x458f0e,JSON['stringify'](_0x4743bc));_0x46a9c5(_0x4743bc);})[_0xc18e('0x12')](function(_0x54e6ab){logger[_0xc18e('0xf')](_0xc18e('0x13'),_0x54e6ab[_0xc18e('0x11')],_0x458f0e);_0x744c90(_0x3ef827['error'](0x1f4,_0x54e6ab[_0xc18e('0x11')]));});});};exports[_0xc18e('0x19')]=function(_0x24722b){var _0x374567=this;return new Promise(function(_0x55ae37,_0x2ec4db){return db['SquareReport'][_0xc18e('0x1a')](_0x24722b['body'],{'raw':_0x24722b[_0xc18e('0x16')]?_0x24722b[_0xc18e('0x16')][_0xc18e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24722b[_0xc18e('0x16')]?_0x24722b[_0xc18e('0x16')][_0xc18e('0x1b')]||null:null,'attributes':_0x24722b['options']?_0x24722b[_0xc18e('0x16')]['attributes']||null:null,'limit':_0x24722b['options']?_0x24722b[_0xc18e('0x16')][_0xc18e('0x1c')]||null:null})['then'](function(_0x55a383){logger[_0xc18e('0xb')](_0xc18e('0x19'),_0x24722b);logger[_0xc18e('0x18')](_0xc18e('0x19'),_0x24722b,JSON['stringify'](_0x55a383));_0x55ae37(_0x55a383);})[_0xc18e('0x12')](function(_0x46b9e4){logger['error'](_0xc18e('0x19'),_0x46b9e4['message'],_0x24722b);_0x2ec4db(_0x374567[_0xc18e('0xf')](0x1f4,_0x46b9e4[_0xc18e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 103a1fb..aca36cc 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 _0xc7cd=['post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe'];(function(_0x4561c2,_0x874887){var _0x3572bd=function(_0x560f60){while(--_0x560f60){_0x4561c2['push'](_0x4561c2['shift']());}};_0x3572bd(++_0x874887);}(_0xc7cd,0x1cf));var _0xdc7c=function(_0x46a370,_0x46cdf1){_0x46a370=_0x46a370-0x0;var _0x35c2b8=_0xc7cd[_0x46a370];return _0x35c2b8;};'use strict';var multer=require(_0xdc7c('0x0'));var util=require(_0xdc7c('0x1'));var path=require(_0xdc7c('0x2'));var timeout=require(_0xdc7c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdc7c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdc7c('0x5'));var config=require(_0xdc7c('0x6'));var controller=require(_0xdc7c('0x7'));router[_0xdc7c('0x8')]('/',auth[_0xdc7c('0x9')](),controller[_0xdc7c('0xa')]);router[_0xdc7c('0x8')](_0xdc7c('0xb'),auth[_0xdc7c('0x9')](),controller['describe']);router[_0xdc7c('0x8')]('/:id',auth[_0xdc7c('0x9')](),controller['show']);router[_0xdc7c('0xc')]('/',auth[_0xdc7c('0x9')](),controller[_0xdc7c('0xd')]);router[_0xdc7c('0xe')](_0xdc7c('0xf'),auth[_0xdc7c('0x9')](),controller[_0xdc7c('0x10')]);router[_0xdc7c('0x11')](_0xdc7c('0xf'),auth[_0xdc7c('0x9')](),controller[_0xdc7c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4601=['post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','get','describe'];(function(_0x310c2a,_0x207c56){var _0x1c0d7e=function(_0x27783f){while(--_0x27783f){_0x310c2a['push'](_0x310c2a['shift']());}};_0x1c0d7e(++_0x207c56);}(_0x4601,0x170));var _0x1460=function(_0x14ddea,_0x538aa1){_0x14ddea=_0x14ddea-0x0;var _0x7e77fd=_0x4601[_0x14ddea];return _0x7e77fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1460('0x0'));var timeout=require(_0x1460('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1460('0x2'));var auth=require(_0x1460('0x3'));var interaction=require(_0x1460('0x4'));var config=require(_0x1460('0x5'));var controller=require(_0x1460('0x6'));router['get']('/',auth[_0x1460('0x7')](),controller['index']);router[_0x1460('0x8')]('/describe',auth[_0x1460('0x7')](),controller[_0x1460('0x9')]);router[_0x1460('0x8')]('/:id',auth[_0x1460('0x7')](),controller['show']);router[_0x1460('0xa')]('/',auth['isAuthenticated'](),controller[_0x1460('0xb')]);router[_0x1460('0xc')](_0x1460('0xd'),auth[_0x1460('0x7')](),controller[_0x1460('0xe')]);router[_0x1460('0xf')](_0x1460('0xd'),auth[_0x1460('0x7')](),controller[_0x1460('0x10')]);module[_0x1460('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 18062c0..35e5c1c 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 _0x5ba1=['STRING','TEXT','sequelize','exports'];(function(_0x2279cc,_0x4861ed){var _0x784d7b=function(_0x2dd685){while(--_0x2dd685){_0x2279cc['push'](_0x2279cc['shift']());}};_0x784d7b(++_0x4861ed);}(_0x5ba1,0x14e));var _0x15ba=function(_0x2b3f89,_0x56a203){_0x2b3f89=_0x2b3f89-0x0;var _0x260409=_0x5ba1[_0x2b3f89];return _0x260409;};'use strict';var Sequelize=require(_0x15ba('0x0'));module[_0x15ba('0x1')]={'uniqueid':{'type':Sequelize[_0x15ba('0x2')]},'node':{'type':Sequelize[_0x15ba('0x2')]},'application':{'type':Sequelize[_0x15ba('0x2')]},'data':{'type':Sequelize[_0x15ba('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x15ba('0x2')]}}; \ No newline at end of file +var _0xcabc=['STRING','sequelize','exports'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0xcabc,0x85));var _0xccab=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcabc[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xccab('0x0'));module[_0xccab('0x1')]={'uniqueid':{'type':Sequelize[_0xccab('0x2')]},'node':{'type':Sequelize[_0xccab('0x2')]},'application':{'type':Sequelize[_0xccab('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xccab('0x2')]},'callerid':{'type':Sequelize[_0xccab('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index e0a6e9a..234bae5 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 _0x64e1=['index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','intersection','create','body','find','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','error','stack','name','send'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0x64e1,0x1a8));var _0x164e=function(_0x5dc50e,_0x2fccaa){_0x5dc50e=_0x5dc50e-0x0;var _0x20885a=_0x64e1[_0x5dc50e];return _0x20885a;};'use strict';var emlformat=require(_0x164e('0x0'));var rimraf=require(_0x164e('0x1'));var zipdir=require(_0x164e('0x2'));var jsonpatch=require(_0x164e('0x3'));var rp=require(_0x164e('0x4'));var moment=require(_0x164e('0x5'));var BPromise=require(_0x164e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x164e('0x7'));var sox=require(_0x164e('0x8'));var csv=require('to-csv');var ejs=require(_0x164e('0x9'));var fs=require('fs');var fs_extra=require(_0x164e('0xa'));var _=require(_0x164e('0xb'));var squel=require(_0x164e('0xc'));var crypto=require(_0x164e('0xd'));var jsforce=require(_0x164e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x164e('0xf'));var querystring=require(_0x164e('0x10'));var Papa=require('papaparse');var Redis=require(_0x164e('0x11'));var authService=require(_0x164e('0x12'));var qs=require(_0x164e('0x13'));var as=require(_0x164e('0x14'));var hardwareService=require(_0x164e('0x15'));var logger=require(_0x164e('0x16'))(_0x164e('0x17'));var utils=require(_0x164e('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x164e('0x19'))['db'];function respondWithStatusCode(_0x57b109,_0x4c4bc3){_0x4c4bc3=_0x4c4bc3||0xcc;return function(_0x556c61){if(_0x556c61){return _0x57b109[_0x164e('0x1a')](_0x4c4bc3);}return _0x57b109['status'](_0x4c4bc3)[_0x164e('0x1b')]();};}function respondWithResult(_0x32aae5,_0x442a3a){_0x442a3a=_0x442a3a||0xc8;return function(_0x105e22){if(_0x105e22){return _0x32aae5[_0x164e('0x1c')](_0x442a3a)[_0x164e('0x1d')](_0x105e22);}};}function respondWithFilteredResult(_0x4a4838,_0x171643){return function(_0x15c900){if(_0x15c900){var _0x5bbb01=typeof _0x171643['offset']==='undefined'&&typeof _0x171643[_0x164e('0x1e')]===_0x164e('0x1f');var _0x38ed17=_0x15c900['count'];var _0x3d7ea8=_0x5bbb01?0x0:_0x171643['offset'];var _0x4db793=_0x5bbb01?_0x15c900[_0x164e('0x20')]:_0x171643[_0x164e('0x21')]+_0x171643[_0x164e('0x1e')];var _0x3f7a47;if(_0x4db793>=_0x38ed17){_0x4db793=_0x38ed17;_0x3f7a47=0xc8;}else{_0x3f7a47=0xce;}_0x4a4838['status'](_0x3f7a47);return _0x4a4838[_0x164e('0x22')]('Content-Range',_0x3d7ea8+'-'+_0x4db793+'/'+_0x38ed17)[_0x164e('0x1d')](_0x15c900);}return null;};}function patchUpdates(_0x384b96){return function(_0x5b1261){try{jsonpatch[_0x164e('0x23')](_0x5b1261,_0x384b96,!![]);}catch(_0x1cf27e){return BPromise[_0x164e('0x24')](_0x1cf27e);}return _0x5b1261[_0x164e('0x25')]();};}function saveUpdates(_0x3f01b7,_0x315ec5){return function(_0x2c8e0e){if(_0x2c8e0e){return _0x2c8e0e[_0x164e('0x26')](_0x3f01b7)['then'](function(_0x12ea1f){return _0x12ea1f;});}return null;};}function removeEntity(_0x25f692,_0x315143){return function(_0x13f51c){if(_0x13f51c){return _0x13f51c['destroy']()[_0x164e('0x27')](function(){_0x25f692[_0x164e('0x1c')](0xcc)[_0x164e('0x1b')]();});}};}function handleEntityNotFound(_0x4a5338,_0x2d4226){return function(_0x3aa8b8){if(!_0x3aa8b8){_0x4a5338[_0x164e('0x1a')](0x194);}return _0x3aa8b8;};}function handleError(_0x492c1c,_0x144c11){_0x144c11=_0x144c11||0x1f4;return function(_0x1e34a8){logger[_0x164e('0x28')](_0x1e34a8[_0x164e('0x29')]);if(_0x1e34a8[_0x164e('0x2a')]){delete _0x1e34a8['name'];}_0x492c1c[_0x164e('0x1c')](_0x144c11)[_0x164e('0x2b')](_0x1e34a8);};}exports[_0x164e('0x2c')]=function(_0x4a05d9,_0x4a50e8){var _0x28525e={},_0x56d9bd={},_0x5818b5={'count':0x0,'rows':[]};var _0x48e345=_[_0x164e('0x2d')](db[_0x164e('0x2e')][_0x164e('0x2f')],function(_0x3398d6){return{'name':_0x3398d6['fieldName'],'type':_0x3398d6[_0x164e('0x30')][_0x164e('0x31')]};});_0x56d9bd[_0x164e('0x32')]=_[_0x164e('0x2d')](_0x48e345,_0x164e('0x2a'));_0x56d9bd[_0x164e('0x33')]=_[_0x164e('0x34')](_0x4a05d9[_0x164e('0x33')]);_0x56d9bd[_0x164e('0x35')]=_['intersection'](_0x56d9bd[_0x164e('0x32')],_0x56d9bd['query']);_0x28525e[_0x164e('0x36')]=_['intersection'](_0x56d9bd[_0x164e('0x32')],qs['fields'](_0x4a05d9['query'][_0x164e('0x37')]));_0x28525e[_0x164e('0x36')]=_0x28525e[_0x164e('0x36')][_0x164e('0x38')]?_0x28525e[_0x164e('0x36')]:_0x56d9bd[_0x164e('0x32')];if(!_0x4a05d9[_0x164e('0x33')][_0x164e('0x39')]('nolimit')){_0x28525e[_0x164e('0x1e')]=qs[_0x164e('0x1e')](_0x4a05d9['query'][_0x164e('0x1e')]);_0x28525e[_0x164e('0x21')]=qs[_0x164e('0x21')](_0x4a05d9[_0x164e('0x33')][_0x164e('0x21')]);}_0x28525e[_0x164e('0x3a')]=qs[_0x164e('0x3b')](_0x4a05d9[_0x164e('0x33')][_0x164e('0x3b')]);_0x28525e['where']=qs[_0x164e('0x35')](_[_0x164e('0x3c')](_0x4a05d9[_0x164e('0x33')],_0x56d9bd[_0x164e('0x35')]),_0x48e345);if(_0x4a05d9['query'][_0x164e('0x3d')]){_0x28525e['where']=_[_0x164e('0x3e')](_0x28525e['where'],{'$or':_[_0x164e('0x2d')](_0x48e345,function(_0x1b7481){if(_0x1b7481[_0x164e('0x30')]!==_0x164e('0x3f')){var _0x55279f={};_0x55279f[_0x1b7481[_0x164e('0x2a')]]={'$like':'%'+_0x4a05d9[_0x164e('0x33')][_0x164e('0x3d')]+'%'};return _0x55279f;}})});}_0x28525e=_[_0x164e('0x3e')]({},_0x28525e,_0x4a05d9[_0x164e('0x40')]);var _0x31bf74={'where':_0x28525e[_0x164e('0x41')]};return db[_0x164e('0x2e')][_0x164e('0x20')](_0x31bf74)[_0x164e('0x27')](function(_0x42f99c){_0x5818b5['count']=_0x42f99c;if(_0x4a05d9[_0x164e('0x33')][_0x164e('0x42')]){_0x28525e[_0x164e('0x43')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x164e('0x44')](_0x28525e);})['then'](function(_0x57cd0b){_0x5818b5[_0x164e('0x45')]=_0x57cd0b;return _0x5818b5;})[_0x164e('0x27')](respondWithFilteredResult(_0x4a50e8,_0x28525e))[_0x164e('0x46')](handleError(_0x4a50e8,null));};exports['show']=function(_0x5463af,_0x4f06c8){var _0x20f2b0={'raw':!![],'where':{'id':_0x5463af['params']['id']}},_0x476956={};_0x476956[_0x164e('0x32')]=_[_0x164e('0x34')](db[_0x164e('0x2e')]['rawAttributes']);_0x476956[_0x164e('0x33')]=_['keys'](_0x5463af[_0x164e('0x33')]);_0x476956[_0x164e('0x35')]=_[_0x164e('0x47')](_0x476956[_0x164e('0x32')],_0x476956[_0x164e('0x33')]);_0x20f2b0[_0x164e('0x36')]=_['intersection'](_0x476956['model'],qs[_0x164e('0x37')](_0x5463af[_0x164e('0x33')][_0x164e('0x37')]));_0x20f2b0['attributes']=_0x20f2b0[_0x164e('0x36')][_0x164e('0x38')]?_0x20f2b0[_0x164e('0x36')]:_0x476956['model'];if(_0x5463af[_0x164e('0x33')]['includeAll']){_0x20f2b0[_0x164e('0x43')]=[{'all':!![]}];}_0x20f2b0=_[_0x164e('0x3e')]({},_0x20f2b0,_0x5463af['options']);return db[_0x164e('0x2e')]['find'](_0x20f2b0)['then'](handleEntityNotFound(_0x4f06c8,null))[_0x164e('0x27')](respondWithResult(_0x4f06c8,null))[_0x164e('0x46')](handleError(_0x4f06c8,null));};exports[_0x164e('0x48')]=function(_0x2ed060,_0x624085){return db[_0x164e('0x2e')][_0x164e('0x48')](_0x2ed060[_0x164e('0x49')],{})['then'](respondWithResult(_0x624085,0xc9))[_0x164e('0x46')](handleError(_0x624085,null));};exports[_0x164e('0x26')]=function(_0x41431a,_0x3e09ab){if(_0x41431a['body']['id']){delete _0x41431a[_0x164e('0x49')]['id'];}return db['SquareDetailsReport'][_0x164e('0x4a')]({'where':{'id':_0x41431a[_0x164e('0x4b')]['id']}})[_0x164e('0x27')](handleEntityNotFound(_0x3e09ab,null))[_0x164e('0x27')](saveUpdates(_0x41431a['body'],null))[_0x164e('0x27')](respondWithResult(_0x3e09ab,null))['catch'](handleError(_0x3e09ab,null));};exports[_0x164e('0x4c')]=function(_0x394c14,_0x607d6a){return db[_0x164e('0x2e')]['find']({'where':{'id':_0x394c14[_0x164e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x607d6a,null))[_0x164e('0x27')](removeEntity(_0x607d6a,null))[_0x164e('0x46')](handleError(_0x607d6a,null));};exports[_0x164e('0x4d')]=function(_0x557cf4,_0x324730){return db[_0x164e('0x2e')][_0x164e('0x4d')]()[_0x164e('0x27')](respondWithResult(_0x324730,null))[_0x164e('0x46')](handleError(_0x324730,null));}; \ No newline at end of file +var _0xda3f=['count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','SquareDetailsReport','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','request-promise','moment','util','sox','to-csv','ejs','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','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x2b5c90,_0xe47c1e){var _0x11a3e3=function(_0x39577e){while(--_0x39577e){_0x2b5c90['push'](_0x2b5c90['shift']());}};_0x11a3e3(++_0xe47c1e);}(_0xda3f,0x18b));var _0xfda3=function(_0x15fd6d,_0x2ed5da){_0x15fd6d=_0x15fd6d-0x0;var _0x57f253=_0xda3f[_0x15fd6d];return _0x57f253;};'use strict';var emlformat=require(_0xfda3('0x0'));var rimraf=require(_0xfda3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfda3('0x2'));var moment=require(_0xfda3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfda3('0x4'));var path=require('path');var sox=require(_0xfda3('0x5'));var csv=require(_0xfda3('0x6'));var ejs=require(_0xfda3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfda3('0x8'));var squel=require('squel');var crypto=require(_0xfda3('0x9'));var jsforce=require(_0xfda3('0xa'));var deskjs=require(_0xfda3('0xb'));var toCsv=require(_0xfda3('0x6'));var querystring=require('querystring');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(_0xfda3('0x12'))(_0xfda3('0x13'));var utils=require(_0xfda3('0x14'));var config=require(_0xfda3('0x15'));var licenseUtil=require(_0xfda3('0x16'));var db=require(_0xfda3('0x17'))['db'];function respondWithStatusCode(_0x404641,_0x75d245){_0x75d245=_0x75d245||0xcc;return function(_0x9d6d8d){if(_0x9d6d8d){return _0x404641[_0xfda3('0x18')](_0x75d245);}return _0x404641[_0xfda3('0x19')](_0x75d245)[_0xfda3('0x1a')]();};}function respondWithResult(_0xc7e77b,_0x562390){_0x562390=_0x562390||0xc8;return function(_0x431bb5){if(_0x431bb5){return _0xc7e77b[_0xfda3('0x19')](_0x562390)[_0xfda3('0x1b')](_0x431bb5);}};}function respondWithFilteredResult(_0xf50151,_0x23f393){return function(_0x3cfc84){if(_0x3cfc84){var _0x1867f5=typeof _0x23f393[_0xfda3('0x1c')]===_0xfda3('0x1d')&&typeof _0x23f393[_0xfda3('0x1e')]===_0xfda3('0x1d');var _0x2f2756=_0x3cfc84[_0xfda3('0x1f')];var _0x237d50=_0x1867f5?0x0:_0x23f393[_0xfda3('0x1c')];var _0x602673=_0x1867f5?_0x3cfc84[_0xfda3('0x1f')]:_0x23f393[_0xfda3('0x1c')]+_0x23f393[_0xfda3('0x1e')];var _0xab9d61;if(_0x602673>=_0x2f2756){_0x602673=_0x2f2756;_0xab9d61=0xc8;}else{_0xab9d61=0xce;}_0xf50151[_0xfda3('0x19')](_0xab9d61);return _0xf50151['set'](_0xfda3('0x20'),_0x237d50+'-'+_0x602673+'/'+_0x2f2756)[_0xfda3('0x1b')](_0x3cfc84);}return null;};}function patchUpdates(_0x25cbc4){return function(_0x5788fb){try{jsonpatch[_0xfda3('0x21')](_0x5788fb,_0x25cbc4,!![]);}catch(_0x5b1606){return BPromise['reject'](_0x5b1606);}return _0x5788fb[_0xfda3('0x22')]();};}function saveUpdates(_0x5652b2,_0x35c073){return function(_0x17a6c2){if(_0x17a6c2){return _0x17a6c2[_0xfda3('0x23')](_0x5652b2)[_0xfda3('0x24')](function(_0x5735e7){return _0x5735e7;});}return null;};}function removeEntity(_0x34bcd8,_0x57d8fe){return function(_0x157e11){if(_0x157e11){return _0x157e11[_0xfda3('0x25')]()[_0xfda3('0x24')](function(){_0x34bcd8[_0xfda3('0x19')](0xcc)[_0xfda3('0x1a')]();});}};}function handleEntityNotFound(_0x2f9b64,_0x20c31e){return function(_0x107ce0){if(!_0x107ce0){_0x2f9b64[_0xfda3('0x18')](0x194);}return _0x107ce0;};}function handleError(_0x3df316,_0x1d3d43){_0x1d3d43=_0x1d3d43||0x1f4;return function(_0x51f324){logger[_0xfda3('0x26')](_0x51f324[_0xfda3('0x27')]);if(_0x51f324[_0xfda3('0x28')]){delete _0x51f324[_0xfda3('0x28')];}_0x3df316[_0xfda3('0x19')](_0x1d3d43)[_0xfda3('0x29')](_0x51f324);};}exports['index']=function(_0x55ca72,_0x3b0537){var _0x33deec={},_0x3e3cc2={},_0x18ace4={'count':0x0,'rows':[]};var _0x3df53e=_[_0xfda3('0x2a')](db[_0xfda3('0x2b')]['rawAttributes'],function(_0xa19f77){return{'name':_0xa19f77['fieldName'],'type':_0xa19f77[_0xfda3('0x2c')]['key']};});_0x3e3cc2[_0xfda3('0x2d')]=_['map'](_0x3df53e,_0xfda3('0x28'));_0x3e3cc2['query']=_[_0xfda3('0x2e')](_0x55ca72[_0xfda3('0x2f')]);_0x3e3cc2[_0xfda3('0x30')]=_[_0xfda3('0x31')](_0x3e3cc2[_0xfda3('0x2d')],_0x3e3cc2['query']);_0x33deec[_0xfda3('0x32')]=_[_0xfda3('0x31')](_0x3e3cc2[_0xfda3('0x2d')],qs['fields'](_0x55ca72[_0xfda3('0x2f')][_0xfda3('0x33')]));_0x33deec[_0xfda3('0x32')]=_0x33deec['attributes'][_0xfda3('0x34')]?_0x33deec[_0xfda3('0x32')]:_0x3e3cc2[_0xfda3('0x2d')];if(!_0x55ca72[_0xfda3('0x2f')][_0xfda3('0x35')](_0xfda3('0x36'))){_0x33deec[_0xfda3('0x1e')]=qs['limit'](_0x55ca72[_0xfda3('0x2f')][_0xfda3('0x1e')]);_0x33deec[_0xfda3('0x1c')]=qs[_0xfda3('0x1c')](_0x55ca72[_0xfda3('0x2f')][_0xfda3('0x1c')]);}_0x33deec[_0xfda3('0x37')]=qs[_0xfda3('0x38')](_0x55ca72[_0xfda3('0x2f')][_0xfda3('0x38')]);_0x33deec[_0xfda3('0x39')]=qs[_0xfda3('0x30')](_['pick'](_0x55ca72[_0xfda3('0x2f')],_0x3e3cc2[_0xfda3('0x30')]),_0x3df53e);if(_0x55ca72[_0xfda3('0x2f')]['filter']){_0x33deec[_0xfda3('0x39')]=_['merge'](_0x33deec[_0xfda3('0x39')],{'$or':_[_0xfda3('0x2a')](_0x3df53e,function(_0x1e293b){if(_0x1e293b['type']!==_0xfda3('0x3a')){var _0xd079b4={};_0xd079b4[_0x1e293b[_0xfda3('0x28')]]={'$like':'%'+_0x55ca72[_0xfda3('0x2f')]['filter']+'%'};return _0xd079b4;}})});}_0x33deec=_['merge']({},_0x33deec,_0x55ca72['options']);var _0x470e68={'where':_0x33deec[_0xfda3('0x39')]};return db[_0xfda3('0x2b')][_0xfda3('0x1f')](_0x470e68)[_0xfda3('0x24')](function(_0x4c1f6c){_0x18ace4[_0xfda3('0x1f')]=_0x4c1f6c;if(_0x55ca72[_0xfda3('0x2f')][_0xfda3('0x3b')]){_0x33deec[_0xfda3('0x3c')]=[{'all':!![]}];}return db[_0xfda3('0x2b')][_0xfda3('0x3d')](_0x33deec);})[_0xfda3('0x24')](function(_0x1cb60e){_0x18ace4[_0xfda3('0x3e')]=_0x1cb60e;return _0x18ace4;})[_0xfda3('0x24')](respondWithFilteredResult(_0x3b0537,_0x33deec))[_0xfda3('0x3f')](handleError(_0x3b0537,null));};exports[_0xfda3('0x40')]=function(_0x5c1360,_0x387810){var _0x3793a7={'raw':!![],'where':{'id':_0x5c1360[_0xfda3('0x41')]['id']}},_0x297abf={};_0x297abf[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](db[_0xfda3('0x2b')]['rawAttributes']);_0x297abf['query']=_[_0xfda3('0x2e')](_0x5c1360[_0xfda3('0x2f')]);_0x297abf['filters']=_[_0xfda3('0x31')](_0x297abf[_0xfda3('0x2d')],_0x297abf['query']);_0x3793a7['attributes']=_['intersection'](_0x297abf['model'],qs['fields'](_0x5c1360[_0xfda3('0x2f')][_0xfda3('0x33')]));_0x3793a7[_0xfda3('0x32')]=_0x3793a7['attributes'][_0xfda3('0x34')]?_0x3793a7[_0xfda3('0x32')]:_0x297abf[_0xfda3('0x2d')];if(_0x5c1360[_0xfda3('0x2f')]['includeAll']){_0x3793a7[_0xfda3('0x3c')]=[{'all':!![]}];}_0x3793a7=_[_0xfda3('0x42')]({},_0x3793a7,_0x5c1360['options']);return db[_0xfda3('0x2b')][_0xfda3('0x43')](_0x3793a7)[_0xfda3('0x24')](handleEntityNotFound(_0x387810,null))[_0xfda3('0x24')](respondWithResult(_0x387810,null))[_0xfda3('0x3f')](handleError(_0x387810,null));};exports[_0xfda3('0x44')]=function(_0x367f6a,_0x37d76a){return db[_0xfda3('0x2b')]['create'](_0x367f6a[_0xfda3('0x45')],{})[_0xfda3('0x24')](respondWithResult(_0x37d76a,0xc9))[_0xfda3('0x3f')](handleError(_0x37d76a,null));};exports[_0xfda3('0x23')]=function(_0x5064a8,_0x3f6698){if(_0x5064a8[_0xfda3('0x45')]['id']){delete _0x5064a8[_0xfda3('0x45')]['id'];}return db[_0xfda3('0x2b')]['find']({'where':{'id':_0x5064a8[_0xfda3('0x41')]['id']}})[_0xfda3('0x24')](handleEntityNotFound(_0x3f6698,null))[_0xfda3('0x24')](saveUpdates(_0x5064a8[_0xfda3('0x45')],null))[_0xfda3('0x24')](respondWithResult(_0x3f6698,null))[_0xfda3('0x3f')](handleError(_0x3f6698,null));};exports[_0xfda3('0x25')]=function(_0x253110,_0x5c2aa9){return db[_0xfda3('0x2b')][_0xfda3('0x43')]({'where':{'id':_0x253110[_0xfda3('0x41')]['id']}})[_0xfda3('0x24')](handleEntityNotFound(_0x5c2aa9,null))[_0xfda3('0x24')](removeEntity(_0x5c2aa9,null))[_0xfda3('0x3f')](handleError(_0x5c2aa9,null));};exports[_0xfda3('0x46')]=function(_0x5d3f8c,_0x513e07){return db[_0xfda3('0x2b')][_0xfda3('0x46')]()[_0xfda3('0x24')](respondWithResult(_0x513e07,null))[_0xfda3('0x3f')](handleError(_0x513e07,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 522c342..c7e4c6c 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 _0x5df4=['../../config/environment','./squareReportDetail.attributes','define','report_square_details','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x27d0b1,_0x3388a0){var _0x5f27d1=function(_0x50be4f){while(--_0x50be4f){_0x27d0b1['push'](_0x27d0b1['shift']());}};_0x5f27d1(++_0x3388a0);}(_0x5df4,0x17a));var _0x45df=function(_0x2f9409,_0x15e1d7){_0x2f9409=_0x2f9409-0x0;var _0x5a14af=_0x5df4[_0x2f9409];return _0x5a14af;};'use strict';var _=require(_0x45df('0x0'));var util=require(_0x45df('0x1'));var logger=require('../../config/logger')(_0x45df('0x2'));var moment=require(_0x45df('0x3'));var BPromise=require(_0x45df('0x4'));var rp=require(_0x45df('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45df('0x6'));var config=require(_0x45df('0x7'));var attributes=require(_0x45df('0x8'));module['exports']=function(_0x2a4d91,_0x48b6f4){return _0x2a4d91[_0x45df('0x9')]('SquareDetailsReport',attributes,{'tableName':_0x45df('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb984=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareDetailsReport','report_square_details','util','../../config/logger'];(function(_0x291f17,_0x38a815){var _0xf91269=function(_0x5d016b){while(--_0x5d016b){_0x291f17['push'](_0x291f17['shift']());}};_0xf91269(++_0x38a815);}(_0xb984,0x1b8));var _0x4b98=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xb984[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x4b98('0x0'));var logger=require(_0x4b98('0x1'))(_0x4b98('0x2'));var moment=require(_0x4b98('0x3'));var BPromise=require(_0x4b98('0x4'));var rp=require(_0x4b98('0x5'));var fs=require('fs');var path=require(_0x4b98('0x6'));var rimraf=require(_0x4b98('0x7'));var config=require(_0x4b98('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0x4b98('0x9')]=function(_0x18706b,_0x5b831a){return _0x18706b[_0x4b98('0xa')](_0x4b98('0xb'),attributes,{'tableName':_0x4b98('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 1986fae..be9d08a 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 _0xcf66=['body','options','raw','info','debug','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport'];(function(_0x36b33e,_0x2d4222){var _0x15db4b=function(_0x49b69e){while(--_0x49b69e){_0x36b33e['push'](_0x36b33e['shift']());}};_0x15db4b(++_0x2d4222);}(_0xcf66,0x71));var _0x6cf6=function(_0x292481,_0xba6ebe){_0x292481=_0x292481-0x0;var _0x44f4aa=_0xcf66[_0x292481];return _0x44f4aa;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cf6('0x3'));var fs=require('fs');var Redis=require(_0x6cf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6cf6('0x5'))(_0x6cf6('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cf6('0x7'));var client=jayson[_0x6cf6('0x8')][_0x6cf6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eb082,_0x94c6a9,_0x308d0d){return new BPromise(function(_0x36b892,_0x748c93){return client[_0x6cf6('0xa')](_0x5eb082,_0x308d0d)[_0x6cf6('0xb')](function(_0x5b3827){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x94c6a9,_0x6cf6('0xc'));logger['debug'](_0x6cf6('0xd'),_0x94c6a9,_0x6cf6('0xc'),JSON[_0x6cf6('0xe')](_0x5b3827));if(_0x5b3827[_0x6cf6('0xf')]){if(_0x5b3827['error']['code']===0x1f4){logger['error'](_0x6cf6('0x10'),_0x94c6a9,_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);return _0x748c93(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}logger[_0x6cf6('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x94c6a9,_0x5b3827[_0x6cf6('0xf')]['message']);return _0x36b892(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}else{logger['info'](_0x6cf6('0x10'),_0x94c6a9,_0x6cf6('0xc'));_0x36b892(_0x5b3827[_0x6cf6('0x12')][_0x6cf6('0x11')]);}})[_0x6cf6('0x13')](function(_0x2bdb12){logger[_0x6cf6('0xf')](_0x6cf6('0x10'),_0x94c6a9,_0x2bdb12);_0x748c93(_0x2bdb12);});});}exports[_0x6cf6('0x14')]=function(_0x2ca2b1){var _0x5e8b11=this;return new Promise(function(_0x11d994,_0x22915c){return db[_0x6cf6('0x15')]['create'](_0x2ca2b1[_0x6cf6('0x16')],{'raw':_0x2ca2b1[_0x6cf6('0x17')]?_0x2ca2b1[_0x6cf6('0x17')][_0x6cf6('0x18')]===undefined?!![]:![]:!![]})[_0x6cf6('0xb')](function(_0x21e903){logger[_0x6cf6('0x19')]('CreateSquareDetailsReport',_0x2ca2b1);logger[_0x6cf6('0x1a')](_0x6cf6('0x14'),_0x2ca2b1,JSON[_0x6cf6('0xe')](_0x21e903));_0x11d994(_0x21e903);})[_0x6cf6('0x13')](function(_0x5cba3a){logger[_0x6cf6('0xf')](_0x6cf6('0x14'),_0x5cba3a[_0x6cf6('0x11')],_0x2ca2b1);_0x22915c(_0x5e8b11['error'](0x1f4,_0x5cba3a['message']));});});}; \ No newline at end of file +var _0xb62e=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','then','lodash','util'];(function(_0x2862fd,_0x409ded){var _0x2ce33b=function(_0x5a5c18){while(--_0x5a5c18){_0x2862fd['push'](_0x2862fd['shift']());}};_0x2ce33b(++_0x409ded);}(_0xb62e,0x1de));var _0xeb62=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb62e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var config=require(_0xeb62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb62('0xa')][_0xeb62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f5ea,_0x5e0dc4,_0x2065a0){return new BPromise(function(_0xab7049,_0x1e10ae){return client[_0xeb62('0xc')](_0x31f5ea,_0x2065a0)['then'](function(_0x5cdef3){logger[_0xeb62('0xd')](_0xeb62('0xe'),_0x5e0dc4,_0xeb62('0xf'));logger[_0xeb62('0x10')](_0xeb62('0x11'),_0x5e0dc4,_0xeb62('0xf'),JSON[_0xeb62('0x12')](_0x5cdef3));if(_0x5cdef3[_0xeb62('0x13')]){if(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x14')]===0x1f4){logger['error'](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);return _0x1e10ae(_0x5cdef3[_0xeb62('0x13')]['message']);}logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')]['message']);return _0xab7049(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);}else{logger[_0xeb62('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x5e0dc4,_0xeb62('0xf'));_0xab7049(_0x5cdef3[_0xeb62('0x16')][_0xeb62('0x15')]);}})[_0xeb62('0x17')](function(_0x3fb280){logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x3fb280);_0x1e10ae(_0x3fb280);});});}exports[_0xeb62('0x18')]=function(_0x39b138){var _0x27fd84=this;return new Promise(function(_0x27efc8,_0x11d516){return db[_0xeb62('0x19')]['create'](_0x39b138[_0xeb62('0x1a')],{'raw':_0x39b138[_0xeb62('0x1b')]?_0x39b138[_0xeb62('0x1b')][_0xeb62('0x1c')]===undefined?!![]:![]:!![]})[_0xeb62('0x1d')](function(_0x24cbf3){logger[_0xeb62('0xd')]('CreateSquareDetailsReport',_0x39b138);logger['debug'](_0xeb62('0x18'),_0x39b138,JSON[_0xeb62('0x12')](_0x24cbf3));_0x27efc8(_0x24cbf3);})[_0xeb62('0x17')](function(_0x13243f){logger[_0xeb62('0x13')]('CreateSquareDetailsReport',_0x13243f['message'],_0x39b138);_0x11d516(_0x27fd84[_0xeb62('0x13')](0x1f4,_0x13243f[_0xeb62('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 67de0f1..0bdfd56 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 _0x71b7=['express','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports'];(function(_0x385eea,_0x3f4a12){var _0x5cb185=function(_0x38b490){while(--_0x38b490){_0x385eea['push'](_0x385eea['shift']());}};_0x5cb185(++_0x3f4a12);}(_0x71b7,0xc6));var _0x771b=function(_0x4fba44,_0x10e53c){_0x4fba44=_0x4fba44-0x0;var _0x1b87ec=_0x71b7[_0x4fba44];return _0x1b87ec;};'use strict';var express=require(_0x771b('0x0'));var router=express['Router']();var auth=require(_0x771b('0x1'));var controller=require(_0x771b('0x2'));router[_0x771b('0x3')]('/',auth[_0x771b('0x4')](),controller[_0x771b('0x5')]);router[_0x771b('0x3')](_0x771b('0x6'),auth['isAuthenticated'](),controller[_0x771b('0x7')]);module[_0x771b('0x8')]=router; \ No newline at end of file +var _0x78b0=['Router','get','isAuthenticated','killProcess','exports'];(function(_0x5d0365,_0x1bde60){var _0x580e71=function(_0x4fed4a){while(--_0x4fed4a){_0x5d0365['push'](_0x5d0365['shift']());}};_0x580e71(++_0x1bde60);}(_0x78b0,0x136));var _0x078b=function(_0x5da875,_0x475a8b){_0x5da875=_0x5da875-0x0;var _0x25d687=_0x78b0[_0x5da875];return _0x25d687;};'use strict';var express=require('express');var router=express[_0x078b('0x0')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x078b('0x1')]('/',auth[_0x078b('0x2')](),controller['index']);router[_0x078b('0x1')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x078b('0x3')]);module[_0x078b('0x4')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 412d26f..2040e2b 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 _0x0344=['getAllData','then','json','killProcess','components/import/cm','format','params','pid','split','indexOf','kill','SIGINT','catch','systeminformation','exec','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0x0344,0x18d));var _0x4034=function(_0x250d93,_0x1824d3){_0x250d93=_0x250d93-0x0;var _0x28df8c=_0x0344[_0x250d93];return _0x28df8c;};'use strict';var info=require(_0x4034('0x0'));var exec=require('child_process')[_0x4034('0x1')];var logger=require('../../config/logger')(_0x4034('0x2'));var util=require('util');var BPromise=require(_0x4034('0x3'));var _=require(_0x4034('0x4'));function handleError(_0x31dbaf,_0x36f2d2,_0x7ef9c1){_0x36f2d2=_0x36f2d2||0x1f4;return function(_0x44839e){logger[_0x4034('0x5')](_0x4034('0x6'),_0x7ef9c1,_0x36f2d2,util[_0x4034('0x7')](_0x44839e,{'showHidden':![],'depth':null}));delete _0x44839e[_0x4034('0x8')];_0x31dbaf[_0x4034('0x9')](_0x36f2d2)[_0x4034('0xa')](_0x44839e);};}exports['index']=function(_0x1be5cb,_0x56427f){return info[_0x4034('0xb')]()[_0x4034('0xc')](function(_0x4d6c6c){return _0x56427f[_0x4034('0x9')](0xc8)[_0x4034('0xd')](_0x4d6c6c);})['catch'](function(_0x3b171b){return _0x56427f[_0x4034('0x9')](0x1f4)['json'](_0x3b171b);});};exports[_0x4034('0xe')]=function(_0x27616c,_0x1fc92c){var _0x9d6af9=[_0x4034('0xf')];return new BPromise(function(_0x3d3482,_0xe060aa){return exec(util[_0x4034('0x10')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x27616c[_0x4034('0x11')][_0x4034('0x12')]),function(_0xb8ba3a,_0x3e5506,_0x3d590d){if(_0xb8ba3a){return _0xe060aa(_0xb8ba3a);}return _0x3d3482(_0x3e5506);});})[_0x4034('0xc')](function(_0x4dc338){var _0xbc877c=![];var _0x24d4be=_0x4dc338[_0x4034('0x13')](/\n/);for(var _0x1b4696=0x0,_0x2bd151=_0x9d6af9['length'];_0x1b4696<_0x2bd151,_0xbc877c===![];_0x1b4696+=0x1){if(_0x4dc338[_0x4034('0x14')](_0x9d6af9[_0x1b4696])>=0x0){_0xbc877c=!![];}}if(!_0xbc877c){throw new Error(util[_0x4034('0x10')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x27616c['params']['pid']));}process[_0x4034('0x15')](_0x27616c[_0x4034('0x11')][_0x4034('0x12')],_0x4034('0x16'));return _0x1fc92c[_0x4034('0x9')](0xc8)[_0x4034('0xd')]({'message':util[_0x4034('0x10')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x27616c['params'][_0x4034('0x12')])});})[_0x4034('0x17')](handleError(_0x1fc92c,null,_0x4034('0xe')));}; \ No newline at end of file +var _0x3494=['indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','json','catch','killProcess','components/import/cm','format','pid'];(function(_0x3a26dd,_0x6f1232){var _0x12b0c5=function(_0x53289f){while(--_0x53289f){_0x3a26dd['push'](_0x3a26dd['shift']());}};_0x12b0c5(++_0x6f1232);}(_0x3494,0x69));var _0x4349=function(_0x136c2,_0x2e896d){_0x136c2=_0x136c2-0x0;var _0x4bb87b=_0x3494[_0x136c2];return _0x4bb87b;};'use strict';var info=require(_0x4349('0x0'));var exec=require(_0x4349('0x1'))[_0x4349('0x2')];var logger=require(_0x4349('0x3'))(_0x4349('0x4'));var util=require('util');var BPromise=require(_0x4349('0x5'));var _=require('lodash');function handleError(_0x2f07ff,_0x508144,_0x455e30){_0x508144=_0x508144||0x1f4;return function(_0xa7afbe){logger[_0x4349('0x6')](_0x4349('0x7'),_0x455e30,_0x508144,util[_0x4349('0x8')](_0xa7afbe,{'showHidden':![],'depth':null}));delete _0xa7afbe[_0x4349('0x9')];_0x2f07ff[_0x4349('0xa')](_0x508144)[_0x4349('0xb')](_0xa7afbe);};}exports[_0x4349('0xc')]=function(_0x4552d1,_0x56cb1f){return info['getAllData']()[_0x4349('0xd')](function(_0x56cc6a){return _0x56cb1f[_0x4349('0xa')](0xc8)[_0x4349('0xe')](_0x56cc6a);})[_0x4349('0xf')](function(_0x20dabc){return _0x56cb1f[_0x4349('0xa')](0x1f4)[_0x4349('0xe')](_0x20dabc);});};exports[_0x4349('0x10')]=function(_0x1daded,_0x2f98bb){var _0x38ad68=[_0x4349('0x11')];return new BPromise(function(_0x9c77ec,_0x1fd6d7){return exec(util[_0x4349('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1daded['params'][_0x4349('0x13')]),function(_0xf788e9,_0x465e8c,_0x2fcdca){if(_0xf788e9){return _0x1fd6d7(_0xf788e9);}return _0x9c77ec(_0x465e8c);});})[_0x4349('0xd')](function(_0x123da0){var _0x412f55=![];var _0x539af3=_0x123da0['split'](/\n/);for(var _0x269313=0x0,_0x485b69=_0x38ad68['length'];_0x269313<_0x485b69,_0x412f55===![];_0x269313+=0x1){if(_0x123da0[_0x4349('0x14')](_0x38ad68[_0x269313])>=0x0){_0x412f55=!![];}}if(!_0x412f55){throw new Error(util[_0x4349('0x12')](_0x4349('0x15'),_0x1daded[_0x4349('0x16')]['pid']));}process['kill'](_0x1daded[_0x4349('0x16')][_0x4349('0x13')],_0x4349('0x17'));return _0x2f98bb[_0x4349('0xa')](0xc8)['json']({'message':util[_0x4349('0x12')](_0x4349('0x18'),_0x1daded[_0x4349('0x16')][_0x4349('0x13')])});})[_0x4349('0xf')](handleError(_0x2f98bb,null,_0x4349('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index b001496..17f1d24 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 _0xd92e=['destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','/:id','isAuthenticated','show','create','put','update','delete'];(function(_0x7afdb0,_0x3cf997){var _0x3d1a10=function(_0x25e82d){while(--_0x25e82d){_0x7afdb0['push'](_0x7afdb0['shift']());}};_0x3d1a10(++_0x3cf997);}(_0xd92e,0x1bc));var _0xed92=function(_0xf5afd3,_0x582bef){_0xf5afd3=_0xf5afd3-0x0;var _0x5bba90=_0xd92e[_0xf5afd3];return _0x5bba90;};'use strict';var multer=require('multer');var util=require(_0xed92('0x0'));var path=require(_0xed92('0x1'));var timeout=require('connect-timeout');var express=require(_0xed92('0x2'));var router=express['Router']();var fs_extra=require(_0xed92('0x3'));var auth=require(_0xed92('0x4'));var interaction=require(_0xed92('0x5'));var config=require('../../config/environment');var controller=require(_0xed92('0x6'));router[_0xed92('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xed92('0x8'),auth[_0xed92('0x9')](),controller[_0xed92('0xa')]);router['post']('/',auth[_0xed92('0x9')](),controller[_0xed92('0xb')]);router[_0xed92('0xc')]('/:id',auth[_0xed92('0x9')](),controller[_0xed92('0xd')]);router[_0xed92('0xe')](_0xed92('0x8'),auth['isAuthenticated'](),controller[_0xed92('0xf')]);module[_0xed92('0x10')]=router; \ No newline at end of file +var _0x77e6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','isAuthenticated','get','show','post','create','/:id','update','delete'];(function(_0x1345e7,_0x4995b1){var _0x517ee4=function(_0x109587){while(--_0x109587){_0x1345e7['push'](_0x1345e7['shift']());}};_0x517ee4(++_0x4995b1);}(_0x77e6,0x1a6));var _0x677e=function(_0x4274fa,_0x4c947b){_0x4274fa=_0x4274fa-0x0;var _0x44d379=_0x77e6[_0x4274fa];return _0x44d379;};'use strict';var multer=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var path=require(_0x677e('0x2'));var timeout=require(_0x677e('0x3'));var express=require(_0x677e('0x4'));var router=express[_0x677e('0x5')]();var fs_extra=require(_0x677e('0x6'));var auth=require(_0x677e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x677e('0x8'));var controller=require(_0x677e('0x9'));router['get']('/',auth[_0x677e('0xa')](),controller['index']);router[_0x677e('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x677e('0xc')]);router[_0x677e('0xd')]('/',auth[_0x677e('0xa')](),controller[_0x677e('0xe')]);router['put'](_0x677e('0xf'),auth['isAuthenticated'](),controller[_0x677e('0x10')]);router[_0x677e('0x11')](_0x677e('0xf'),auth[_0x677e('0xa')](),controller[_0x677e('0x12')]);module[_0x677e('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index b5f4a87..f0274b5 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 _0xfd7b=['#0091EA','sequelize','exports','STRING'];(function(_0x227d7f,_0x23acd2){var _0x8a8721=function(_0x523f9b){while(--_0x523f9b){_0x227d7f['push'](_0x227d7f['shift']());}};_0x8a8721(++_0x23acd2);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfd7b[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xbfd7('0x0'));module[_0xbfd7('0x1')]={'name':{'type':Sequelize[_0xbfd7('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xbfd7('0x2')],'defaultValue':_0xbfd7('0x3')},'description':{'type':Sequelize[_0xbfd7('0x2')]}}; \ No newline at end of file +var _0xd48a=['name','#0091EA','sequelize','STRING'];(function(_0x15fe21,_0x2a4dbe){var _0x2e5271=function(_0x40d41e){while(--_0x40d41e){_0x15fe21['push'](_0x15fe21['shift']());}};_0x2e5271(++_0x2a4dbe);}(_0xd48a,0x96));var _0xad48=function(_0x21c1b3,_0x554f2f){_0x21c1b3=_0x21c1b3-0x0;var _0x4f1df2=_0xd48a[_0x21c1b3];return _0x4f1df2;};'use strict';var Sequelize=require(_0xad48('0x0'));module['exports']={'name':{'type':Sequelize[_0xad48('0x1')],'unique':_0xad48('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xad48('0x1')],'defaultValue':_0xad48('0x3')},'description':{'type':Sequelize[_0xad48('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 9166a97..9dcc2fd 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 _0x2504=['update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','map','Tag','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','where','merge','VIRTUAL','filter','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x2504,0xee));var _0x4250=function(_0xce09ee,_0x27a427){_0xce09ee=_0xce09ee-0x0;var _0x12cc47=_0x2504[_0xce09ee];return _0x12cc47;};'use strict';var emlformat=require(_0x4250('0x0'));var rimraf=require(_0x4250('0x1'));var zipdir=require(_0x4250('0x2'));var jsonpatch=require(_0x4250('0x3'));var rp=require(_0x4250('0x4'));var moment=require(_0x4250('0x5'));var BPromise=require(_0x4250('0x6'));var Mustache=require(_0x4250('0x7'));var util=require(_0x4250('0x8'));var path=require(_0x4250('0x9'));var sox=require(_0x4250('0xa'));var csv=require(_0x4250('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4250('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4250('0xd'));var jsforce=require(_0x4250('0xe'));var deskjs=require(_0x4250('0xf'));var toCsv=require(_0x4250('0xb'));var querystring=require(_0x4250('0x10'));var Papa=require('papaparse');var Redis=require(_0x4250('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4250('0x12'));var as=require(_0x4250('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4250('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4250('0x15'));var licenseUtil=require(_0x4250('0x16'));var db=require(_0x4250('0x17'))['db'];function respondWithStatusCode(_0x3c1e7e,_0x2a496b){_0x2a496b=_0x2a496b||0xcc;return function(_0x5d62a0){if(_0x5d62a0){return _0x3c1e7e[_0x4250('0x18')](_0x2a496b);}return _0x3c1e7e[_0x4250('0x19')](_0x2a496b)[_0x4250('0x1a')]();};}function respondWithResult(_0x2c8a75,_0xfa4d8a){_0xfa4d8a=_0xfa4d8a||0xc8;return function(_0x33f317){if(_0x33f317){return _0x2c8a75['status'](_0xfa4d8a)[_0x4250('0x1b')](_0x33f317);}};}function respondWithFilteredResult(_0x46ba15,_0x1b0c66){return function(_0x3cff02){if(_0x3cff02){var _0x2979cd=typeof _0x1b0c66[_0x4250('0x1c')]===_0x4250('0x1d')&&typeof _0x1b0c66['limit']===_0x4250('0x1d');var _0x35d232=_0x3cff02[_0x4250('0x1e')];var _0x17a8a9=_0x2979cd?0x0:_0x1b0c66[_0x4250('0x1c')];var _0x30e48c=_0x2979cd?_0x3cff02[_0x4250('0x1e')]:_0x1b0c66['offset']+_0x1b0c66[_0x4250('0x1f')];var _0x4f0154;if(_0x30e48c>=_0x35d232){_0x30e48c=_0x35d232;_0x4f0154=0xc8;}else{_0x4f0154=0xce;}_0x46ba15['status'](_0x4f0154);return _0x46ba15[_0x4250('0x20')](_0x4250('0x21'),_0x17a8a9+'-'+_0x30e48c+'/'+_0x35d232)[_0x4250('0x1b')](_0x3cff02);}return null;};}function patchUpdates(_0x42c331){return function(_0x242cf1){try{jsonpatch[_0x4250('0x22')](_0x242cf1,_0x42c331,!![]);}catch(_0x1ba772){return BPromise[_0x4250('0x23')](_0x1ba772);}return _0x242cf1[_0x4250('0x24')]();};}function saveUpdates(_0x3818c0,_0x728862){return function(_0x30e2ae){if(_0x30e2ae){return _0x30e2ae['update'](_0x3818c0)[_0x4250('0x25')](function(_0x171df4){return _0x171df4;});}return null;};}function removeEntity(_0x1feb98,_0x523053){return function(_0x5d1a74){if(_0x5d1a74){return _0x5d1a74[_0x4250('0x26')]()[_0x4250('0x25')](function(){var _0x1c1294=_0x5d1a74[_0x4250('0x27')]({'plain':!![]});var _0x328ffb='Tags';return db[_0x4250('0x28')][_0x4250('0x26')]({'where':{'type':_0x328ffb,'resourceId':_0x1c1294['id']}})[_0x4250('0x25')](function(){return _0x5d1a74;});})['then'](function(){_0x1feb98['status'](0xcc)[_0x4250('0x1a')]();});}};}function handleEntityNotFound(_0x5d0fa2,_0x3e8b4d){return function(_0x1c4fa5){if(!_0x1c4fa5){_0x5d0fa2[_0x4250('0x18')](0x194);}return _0x1c4fa5;};}function handleError(_0x2cdfdf,_0xb82299){_0xb82299=_0xb82299||0x1f4;return function(_0x501c5f){logger[_0x4250('0x29')](_0x501c5f[_0x4250('0x2a')]);if(_0x501c5f['name']){delete _0x501c5f[_0x4250('0x2b')];}_0x2cdfdf['status'](_0xb82299)[_0x4250('0x2c')](_0x501c5f);};}exports['index']=function(_0x5e0fe6,_0xea7ccc){var _0x5f20d5={},_0x16b8a4={},_0x281be9={'count':0x0,'rows':[]};var _0x4bed2b=_[_0x4250('0x2d')](db[_0x4250('0x2e')]['rawAttributes'],function(_0x217188){return{'name':_0x217188[_0x4250('0x2f')],'type':_0x217188['type'][_0x4250('0x30')]};});_0x16b8a4[_0x4250('0x31')]=_[_0x4250('0x2d')](_0x4bed2b,_0x4250('0x2b'));_0x16b8a4[_0x4250('0x32')]=_[_0x4250('0x33')](_0x5e0fe6[_0x4250('0x32')]);_0x16b8a4[_0x4250('0x34')]=_[_0x4250('0x35')](_0x16b8a4[_0x4250('0x31')],_0x16b8a4[_0x4250('0x32')]);_0x5f20d5[_0x4250('0x36')]=_[_0x4250('0x35')](_0x16b8a4['model'],qs[_0x4250('0x37')](_0x5e0fe6['query'][_0x4250('0x37')]));_0x5f20d5[_0x4250('0x36')]=_0x5f20d5['attributes'][_0x4250('0x38')]?_0x5f20d5[_0x4250('0x36')]:_0x16b8a4[_0x4250('0x31')];if(!_0x5e0fe6[_0x4250('0x32')]['hasOwnProperty']('nolimit')){_0x5f20d5['limit']=qs[_0x4250('0x1f')](_0x5e0fe6[_0x4250('0x32')]['limit']);_0x5f20d5[_0x4250('0x1c')]=qs[_0x4250('0x1c')](_0x5e0fe6[_0x4250('0x32')][_0x4250('0x1c')]);}_0x5f20d5[_0x4250('0x39')]=qs['sort'](_0x5e0fe6[_0x4250('0x32')]['sort']);_0x5f20d5['where']=qs[_0x4250('0x34')](_['pick'](_0x5e0fe6[_0x4250('0x32')],_0x16b8a4[_0x4250('0x34')]),_0x4bed2b);if(_0x5e0fe6[_0x4250('0x32')]['filter']){_0x5f20d5[_0x4250('0x3a')]=_[_0x4250('0x3b')](_0x5f20d5[_0x4250('0x3a')],{'$or':_[_0x4250('0x2d')](_0x4bed2b,function(_0x3bcdbf){if(_0x3bcdbf['type']!==_0x4250('0x3c')){var _0x1d8459={};_0x1d8459[_0x3bcdbf[_0x4250('0x2b')]]={'$like':'%'+_0x5e0fe6[_0x4250('0x32')][_0x4250('0x3d')]+'%'};return _0x1d8459;}})});}_0x5f20d5=_[_0x4250('0x3b')]({},_0x5f20d5,_0x5e0fe6['options']);var _0x3a340a={'where':_0x5f20d5['where']};return db[_0x4250('0x2e')][_0x4250('0x1e')](_0x3a340a)[_0x4250('0x25')](function(_0x2a10b9){_0x281be9[_0x4250('0x1e')]=_0x2a10b9;if(_0x5e0fe6[_0x4250('0x32')]['includeAll']){_0x5f20d5['include']=[{'all':!![]}];}return db['Tag'][_0x4250('0x3e')](_0x5f20d5);})[_0x4250('0x25')](function(_0x2e4a22){_0x281be9['rows']=_0x2e4a22;return _0x281be9;})[_0x4250('0x25')](respondWithFilteredResult(_0xea7ccc,_0x5f20d5))[_0x4250('0x3f')](handleError(_0xea7ccc,null));};exports[_0x4250('0x40')]=function(_0x53fb93,_0x100727){var _0x307d2c={'raw':!![],'where':{'id':_0x53fb93[_0x4250('0x41')]['id']}},_0x366cb7={};_0x366cb7['model']=_['keys'](db[_0x4250('0x2e')][_0x4250('0x42')]);_0x366cb7[_0x4250('0x32')]=_[_0x4250('0x33')](_0x53fb93[_0x4250('0x32')]);_0x366cb7['filters']=_[_0x4250('0x35')](_0x366cb7['model'],_0x366cb7[_0x4250('0x32')]);_0x307d2c[_0x4250('0x36')]=_[_0x4250('0x35')](_0x366cb7['model'],qs[_0x4250('0x37')](_0x53fb93[_0x4250('0x32')][_0x4250('0x37')]));_0x307d2c['attributes']=_0x307d2c['attributes']['length']?_0x307d2c[_0x4250('0x36')]:_0x366cb7[_0x4250('0x31')];if(_0x53fb93[_0x4250('0x32')][_0x4250('0x43')]){_0x307d2c[_0x4250('0x44')]=[{'all':!![]}];}_0x307d2c=_[_0x4250('0x3b')]({},_0x307d2c,_0x53fb93['options']);return db[_0x4250('0x2e')][_0x4250('0x45')](_0x307d2c)[_0x4250('0x25')](handleEntityNotFound(_0x100727,null))['then'](respondWithResult(_0x100727,null))[_0x4250('0x3f')](handleError(_0x100727,null));};exports['create']=function(_0x5895ea,_0x2e0d9d){return db[_0x4250('0x2e')][_0x4250('0x46')](_0x5895ea[_0x4250('0x47')],{})[_0x4250('0x25')](function(_0x34d672){var _0x59d51a=_0x5895ea[_0x4250('0x48')]['get']({'plain':!![]});if(!_0x59d51a)throw new Error(_0x4250('0x49'));if(_0x59d51a[_0x4250('0x4a')]===_0x4250('0x48')){var _0x544048=_0x34d672[_0x4250('0x27')]({'plain':!![]});var _0x440aa4='Tags';return db['UserProfileSection']['find']({'where':{'name':_0x440aa4,'userProfileId':_0x59d51a[_0x4250('0x4b')]},'raw':!![]})['then'](function(_0x4e3158){if(_0x4e3158&&_0x4e3158[_0x4250('0x4c')]===0x0){return db[_0x4250('0x28')][_0x4250('0x46')]({'name':_0x544048[_0x4250('0x2b')],'resourceId':_0x544048['id'],'type':_0x4e3158[_0x4250('0x2b')],'sectionId':_0x4e3158['id']},{})['then'](function(){return _0x34d672;});}else{return _0x34d672;}})[_0x4250('0x3f')](function(_0xb82981){logger[_0x4250('0x29')](_0x4250('0x4d'),_0xb82981);throw _0xb82981;});}return _0x34d672;})['then'](respondWithResult(_0x2e0d9d,0xc9))[_0x4250('0x3f')](handleError(_0x2e0d9d,null));};exports[_0x4250('0x4e')]=function(_0x59efc0,_0xc7ba0){if(_0x59efc0[_0x4250('0x47')]['id']){delete _0x59efc0['body']['id'];}return db[_0x4250('0x2e')][_0x4250('0x45')]({'where':{'id':_0x59efc0[_0x4250('0x41')]['id']}})[_0x4250('0x25')](handleEntityNotFound(_0xc7ba0,null))[_0x4250('0x25')](saveUpdates(_0x59efc0[_0x4250('0x47')],null))[_0x4250('0x25')](respondWithResult(_0xc7ba0,null))['catch'](handleError(_0xc7ba0,null));};exports[_0x4250('0x26')]=function(_0x39e9f5,_0x6094fb){return db['Tag']['find']({'where':{'id':_0x39e9f5[_0x4250('0x41')]['id']}})[_0x4250('0x25')](handleEntityNotFound(_0x6094fb,null))['then'](removeEntity(_0x6094fb,null))[_0x4250('0x3f')](handleError(_0x6094fb,null));}; \ No newline at end of file +var _0x91a7=['moment','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Tags','error','stack','name','send','index','map','Tag','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','includeAll','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','rimraf','zip-dir','fast-json-patch'];(function(_0x216f9d,_0x203068){var _0x15674b=function(_0x41746e){while(--_0x41746e){_0x216f9d['push'](_0x216f9d['shift']());}};_0x15674b(++_0x203068);}(_0x91a7,0xe7));var _0x791a=function(_0x5c0108,_0x580023){_0x5c0108=_0x5c0108-0x0;var _0x5ba34a=_0x91a7[_0x5c0108];return _0x5ba34a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791a('0x0'));var zipdir=require(_0x791a('0x1'));var jsonpatch=require(_0x791a('0x2'));var rp=require('request-promise');var moment=require(_0x791a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x791a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x791a('0x5'));var csv=require(_0x791a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x791a('0x7'));var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0x6'));var querystring=require(_0x791a('0xb'));var Papa=require(_0x791a('0xc'));var Redis=require(_0x791a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xe'));var as=require(_0x791a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x10'))(_0x791a('0x11'));var utils=require(_0x791a('0x12'));var config=require(_0x791a('0x13'));var licenseUtil=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];function respondWithStatusCode(_0x53dc41,_0x5daecd){_0x5daecd=_0x5daecd||0xcc;return function(_0xc92016){if(_0xc92016){return _0x53dc41[_0x791a('0x16')](_0x5daecd);}return _0x53dc41['status'](_0x5daecd)[_0x791a('0x17')]();};}function respondWithResult(_0x3a2ec6,_0x5d5b11){_0x5d5b11=_0x5d5b11||0xc8;return function(_0x2887f0){if(_0x2887f0){return _0x3a2ec6[_0x791a('0x18')](_0x5d5b11)[_0x791a('0x19')](_0x2887f0);}};}function respondWithFilteredResult(_0x5cdf2,_0x55e845){return function(_0x2ce2e0){if(_0x2ce2e0){var _0x575d11=typeof _0x55e845[_0x791a('0x1a')]===_0x791a('0x1b')&&typeof _0x55e845['limit']===_0x791a('0x1b');var _0x5bea2e=_0x2ce2e0[_0x791a('0x1c')];var _0x52941d=_0x575d11?0x0:_0x55e845['offset'];var _0x588d00=_0x575d11?_0x2ce2e0[_0x791a('0x1c')]:_0x55e845['offset']+_0x55e845['limit'];var _0x39c60b;if(_0x588d00>=_0x5bea2e){_0x588d00=_0x5bea2e;_0x39c60b=0xc8;}else{_0x39c60b=0xce;}_0x5cdf2[_0x791a('0x18')](_0x39c60b);return _0x5cdf2[_0x791a('0x1d')](_0x791a('0x1e'),_0x52941d+'-'+_0x588d00+'/'+_0x5bea2e)['json'](_0x2ce2e0);}return null;};}function patchUpdates(_0x189c0d){return function(_0xcb5e66){try{jsonpatch[_0x791a('0x1f')](_0xcb5e66,_0x189c0d,!![]);}catch(_0x280f1e){return BPromise['reject'](_0x280f1e);}return _0xcb5e66[_0x791a('0x20')]();};}function saveUpdates(_0x2054c6,_0x25bae5){return function(_0x9e17b5){if(_0x9e17b5){return _0x9e17b5[_0x791a('0x21')](_0x2054c6)[_0x791a('0x22')](function(_0x2241a0){return _0x2241a0;});}return null;};}function removeEntity(_0x45a67d,_0x323c6a){return function(_0xe8e452){if(_0xe8e452){return _0xe8e452[_0x791a('0x23')]()['then'](function(){var _0x1102c9=_0xe8e452[_0x791a('0x24')]({'plain':!![]});var _0x380329=_0x791a('0x25');return db['UserProfileResource'][_0x791a('0x23')]({'where':{'type':_0x380329,'resourceId':_0x1102c9['id']}})[_0x791a('0x22')](function(){return _0xe8e452;});})['then'](function(){_0x45a67d[_0x791a('0x18')](0xcc)[_0x791a('0x17')]();});}};}function handleEntityNotFound(_0x16dbaf,_0x4c1626){return function(_0x29194d){if(!_0x29194d){_0x16dbaf[_0x791a('0x16')](0x194);}return _0x29194d;};}function handleError(_0x2b0784,_0x395376){_0x395376=_0x395376||0x1f4;return function(_0x4f423){logger[_0x791a('0x26')](_0x4f423[_0x791a('0x27')]);if(_0x4f423[_0x791a('0x28')]){delete _0x4f423['name'];}_0x2b0784[_0x791a('0x18')](_0x395376)[_0x791a('0x29')](_0x4f423);};}exports[_0x791a('0x2a')]=function(_0x59d2c0,_0x1cdda9){var _0x5df656={},_0xc59f5e={},_0x2e4ec8={'count':0x0,'rows':[]};var _0xcde862=_[_0x791a('0x2b')](db[_0x791a('0x2c')][_0x791a('0x2d')],function(_0x15ff6e){return{'name':_0x15ff6e['fieldName'],'type':_0x15ff6e[_0x791a('0x2e')][_0x791a('0x2f')]};});_0xc59f5e[_0x791a('0x30')]=_[_0x791a('0x2b')](_0xcde862,_0x791a('0x28'));_0xc59f5e['query']=_[_0x791a('0x31')](_0x59d2c0[_0x791a('0x32')]);_0xc59f5e[_0x791a('0x33')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],_0xc59f5e['query']);_0x5df656[_0x791a('0x35')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],qs[_0x791a('0x36')](_0x59d2c0[_0x791a('0x32')]['fields']));_0x5df656[_0x791a('0x35')]=_0x5df656['attributes'][_0x791a('0x37')]?_0x5df656['attributes']:_0xc59f5e['model'];if(!_0x59d2c0[_0x791a('0x32')][_0x791a('0x38')](_0x791a('0x39'))){_0x5df656[_0x791a('0x3a')]=qs[_0x791a('0x3a')](_0x59d2c0[_0x791a('0x32')][_0x791a('0x3a')]);_0x5df656['offset']=qs[_0x791a('0x1a')](_0x59d2c0['query'][_0x791a('0x1a')]);}_0x5df656['order']=qs[_0x791a('0x3b')](_0x59d2c0[_0x791a('0x32')]['sort']);_0x5df656[_0x791a('0x3c')]=qs[_0x791a('0x33')](_['pick'](_0x59d2c0[_0x791a('0x32')],_0xc59f5e[_0x791a('0x33')]),_0xcde862);if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3d')]){_0x5df656[_0x791a('0x3c')]=_[_0x791a('0x3e')](_0x5df656[_0x791a('0x3c')],{'$or':_[_0x791a('0x2b')](_0xcde862,function(_0xc0fb63){if(_0xc0fb63[_0x791a('0x2e')]!=='VIRTUAL'){var _0x15f066={};_0x15f066[_0xc0fb63[_0x791a('0x28')]]={'$like':'%'+_0x59d2c0[_0x791a('0x32')]['filter']+'%'};return _0x15f066;}})});}_0x5df656=_[_0x791a('0x3e')]({},_0x5df656,_0x59d2c0['options']);var _0x5bad7d={'where':_0x5df656['where']};return db[_0x791a('0x2c')][_0x791a('0x1c')](_0x5bad7d)['then'](function(_0x415c44){_0x2e4ec8[_0x791a('0x1c')]=_0x415c44;if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3f')]){_0x5df656['include']=[{'all':!![]}];}return db['Tag']['findAll'](_0x5df656);})[_0x791a('0x22')](function(_0x216dd3){_0x2e4ec8['rows']=_0x216dd3;return _0x2e4ec8;})[_0x791a('0x22')](respondWithFilteredResult(_0x1cdda9,_0x5df656))[_0x791a('0x40')](handleError(_0x1cdda9,null));};exports[_0x791a('0x41')]=function(_0x954164,_0x508727){var _0x11263d={'raw':!![],'where':{'id':_0x954164[_0x791a('0x42')]['id']}},_0x5911db={};_0x5911db[_0x791a('0x30')]=_[_0x791a('0x31')](db[_0x791a('0x2c')][_0x791a('0x2d')]);_0x5911db['query']=_[_0x791a('0x31')](_0x954164[_0x791a('0x32')]);_0x5911db[_0x791a('0x33')]=_[_0x791a('0x34')](_0x5911db[_0x791a('0x30')],_0x5911db['query']);_0x11263d[_0x791a('0x35')]=_[_0x791a('0x34')](_0x5911db['model'],qs['fields'](_0x954164[_0x791a('0x32')][_0x791a('0x36')]));_0x11263d[_0x791a('0x35')]=_0x11263d['attributes']['length']?_0x11263d[_0x791a('0x35')]:_0x5911db[_0x791a('0x30')];if(_0x954164['query'][_0x791a('0x3f')]){_0x11263d[_0x791a('0x43')]=[{'all':!![]}];}_0x11263d=_[_0x791a('0x3e')]({},_0x11263d,_0x954164['options']);return db['Tag'][_0x791a('0x44')](_0x11263d)[_0x791a('0x22')](handleEntityNotFound(_0x508727,null))[_0x791a('0x22')](respondWithResult(_0x508727,null))[_0x791a('0x40')](handleError(_0x508727,null));};exports['create']=function(_0x2d7c7d,_0x9f768a){return db[_0x791a('0x2c')][_0x791a('0x45')](_0x2d7c7d['body'],{})[_0x791a('0x22')](function(_0x19654d){var _0xe0696b=_0x2d7c7d[_0x791a('0x46')][_0x791a('0x24')]({'plain':!![]});if(!_0xe0696b)throw new Error(_0x791a('0x47'));if(_0xe0696b[_0x791a('0x48')]==='user'){var _0xdcb1b=_0x19654d[_0x791a('0x24')]({'plain':!![]});var _0x4bffa6=_0x791a('0x25');return db[_0x791a('0x49')]['find']({'where':{'name':_0x4bffa6,'userProfileId':_0xe0696b[_0x791a('0x4a')]},'raw':!![]})[_0x791a('0x22')](function(_0x12178e){if(_0x12178e&&_0x12178e[_0x791a('0x4b')]===0x0){return db[_0x791a('0x4c')]['create']({'name':_0xdcb1b['name'],'resourceId':_0xdcb1b['id'],'type':_0x12178e['name'],'sectionId':_0x12178e['id']},{})[_0x791a('0x22')](function(){return _0x19654d;});}else{return _0x19654d;}})['catch'](function(_0x4c7555){logger[_0x791a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7555);throw _0x4c7555;});}return _0x19654d;})[_0x791a('0x22')](respondWithResult(_0x9f768a,0xc9))[_0x791a('0x40')](handleError(_0x9f768a,null));};exports['update']=function(_0x5166b5,_0x3599f6){if(_0x5166b5['body']['id']){delete _0x5166b5[_0x791a('0x4d')]['id'];}return db[_0x791a('0x2c')][_0x791a('0x44')]({'where':{'id':_0x5166b5['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x3599f6,null))[_0x791a('0x22')](saveUpdates(_0x5166b5['body'],null))[_0x791a('0x22')](respondWithResult(_0x3599f6,null))[_0x791a('0x40')](handleError(_0x3599f6,null));};exports[_0x791a('0x23')]=function(_0x34d53c,_0x450ad8){return db[_0x791a('0x2c')]['find']({'where':{'id':_0x34d53c['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x450ad8,null))['then'](removeEntity(_0x450ad8,null))[_0x791a('0x40')](handleError(_0x450ad8,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 11c86ea..8c50a97 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 _0xd749=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','define','tools_tags','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd749,0x180));var _0x9d74=function(_0x5ad5e6,_0x3d7c01){_0x5ad5e6=_0x5ad5e6-0x0;var _0x390168=_0xd749[_0x5ad5e6];return _0x390168;};'use strict';var _=require(_0x9d74('0x0'));var util=require('util');var logger=require(_0x9d74('0x1'))(_0x9d74('0x2'));var moment=require('moment');var BPromise=require(_0x9d74('0x3'));var rp=require(_0x9d74('0x4'));var fs=require('fs');var path=require(_0x9d74('0x5'));var rimraf=require(_0x9d74('0x6'));var config=require(_0x9d74('0x7'));var attributes=require(_0x9d74('0x8'));module['exports']=function(_0x1a92c3,_0x17ecb2){return _0x1a92c3[_0x9d74('0x9')]('Tag',attributes,{'tableName':_0x9d74('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0605=['util','api','moment','bluebird','request-promise','path','../../config/environment','./tag.attributes','exports','Tag','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0605,0x1c2));var _0x5060=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x0605[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0x5060('0x0'));var util=require(_0x5060('0x1'));var logger=require('../../config/logger')(_0x5060('0x2'));var moment=require(_0x5060('0x3'));var BPromise=require(_0x5060('0x4'));var rp=require(_0x5060('0x5'));var fs=require('fs');var path=require(_0x5060('0x6'));var rimraf=require('rimraf');var config=require(_0x5060('0x7'));var attributes=require(_0x5060('0x8'));module[_0x5060('0x9')]=function(_0x594867,_0x27aae3){return _0x594867['define'](_0x5060('0xa'),attributes,{'tableName':'tools_tags','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 731ef5b..b8c9454 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 _0xed1f=['request','then','info','Tag,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x849aa4,_0x29a9cf){var _0x451814=function(_0x927abb){while(--_0x927abb){_0x849aa4['push'](_0x849aa4['shift']());}};_0x451814(++_0x29a9cf);}(_0xed1f,0x6a));var _0xfed1=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xed1f[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('Tag,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file +var _0x0c6d=['code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x3d473e,_0x472dc0){_0x3d473e=_0x3d473e-0x0;var _0x52dec0=_0x0c6d[_0x3d473e];return _0x52dec0;};'use strict';var _=require('lodash');var util=require(_0xd0c6('0x0'));var moment=require(_0xd0c6('0x1'));var BPromise=require(_0xd0c6('0x2'));var rs=require(_0xd0c6('0x3'));var fs=require('fs');var Redis=require(_0xd0c6('0x4'));var db=require(_0xd0c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0c6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd0c6('0x7')][_0xd0c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d4a64,_0x5de1cd,_0x16c6da){return new BPromise(function(_0x534412,_0x2a14f1){return client[_0xd0c6('0x9')](_0x2d4a64,_0x16c6da)[_0xd0c6('0xa')](function(_0x184f65){logger[_0xd0c6('0xb')](_0xd0c6('0xc'),_0x5de1cd,_0xd0c6('0xd'));logger[_0xd0c6('0xe')](_0xd0c6('0xf'),_0x5de1cd,'request\x20sent',JSON[_0xd0c6('0x10')](_0x184f65));if(_0x184f65['error']){if(_0x184f65['error'][_0xd0c6('0x11')]===0x1f4){logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);return _0x2a14f1(_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);}logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);return _0x534412(_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);}else{logger[_0xd0c6('0xb')](_0xd0c6('0xc'),_0x5de1cd,_0xd0c6('0xd'));_0x534412(_0x184f65[_0xd0c6('0x14')][_0xd0c6('0x13')]);}})[_0xd0c6('0x15')](function(_0x19dd14){logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x19dd14);_0x2a14f1(_0x19dd14);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index b0ca60b..4bbc4a8 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),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 ed47f39..6b3a1ed 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 _0xbaf0=['name','exports','STRING'];(function(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'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 _0xb7e7=['STRING','sequelize'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xb7e7[_0x4b7b62];return _0x2280df;};'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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index befd3c0..824b080 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 _0x8f8b=['socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Team','include','findAll','rows','catch','show','params','includeAll','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','VoicePrefixId','isValidChannel','ValidationError','Unknown\x20channel','capitalize','channel','toLowerCase','rawAttributes','Queues','add','ids','removeQueues','remove','addAgents','Mail','Sms','Whatsapp','penalty','TeamVoiceQueue','Queue','findOrCreate','emit','Queue:save','Voice','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','findOne','UserVoicePrefix','Fax','Openchannel','removeAgents','Queue:remove','QueueId','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','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/license/util','defaults','redis','localhost'];(function(_0x5171ff,_0x5e9e47){var _0x2287ce=function(_0x1e5fca){while(--_0x1e5fca){_0x5171ff['push'](_0x5171ff['shift']());}};_0x2287ce(++_0x5e9e47);}(_0x8f8b,0x120));var _0xb8f8=function(_0x2b08bd,_0x2e91fa){_0x2b08bd=_0x2b08bd-0x0;var _0x1c6251=_0x8f8b[_0x2b08bd];return _0x1c6251;};'use strict';var emlformat=require(_0xb8f8('0x0'));var rimraf=require(_0xb8f8('0x1'));var zipdir=require(_0xb8f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8f8('0x3'));var moment=require(_0xb8f8('0x4'));var BPromise=require(_0xb8f8('0x5'));var Mustache=require(_0xb8f8('0x6'));var util=require(_0xb8f8('0x7'));var path=require(_0xb8f8('0x8'));var sox=require(_0xb8f8('0x9'));var csv=require(_0xb8f8('0xa'));var ejs=require(_0xb8f8('0xb'));var fs=require('fs');var fs_extra=require(_0xb8f8('0xc'));var _=require('lodash');var squel=require(_0xb8f8('0xd'));var crypto=require('crypto');var jsforce=require(_0xb8f8('0xe'));var deskjs=require(_0xb8f8('0xf'));var toCsv=require(_0xb8f8('0xa'));var querystring=require(_0xb8f8('0x10'));var Papa=require(_0xb8f8('0x11'));var Redis=require(_0xb8f8('0x12'));var authService=require(_0xb8f8('0x13'));var qs=require(_0xb8f8('0x14'));var as=require(_0xb8f8('0x15'));var hardwareService=require(_0xb8f8('0x16'));var logger=require(_0xb8f8('0x17'))(_0xb8f8('0x18'));var utils=require(_0xb8f8('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb8f8('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb8f8('0x1b')](config[_0xb8f8('0x1c')],{'host':_0xb8f8('0x1d'),'port':0x18eb});var socket=require(_0xb8f8('0x1e'))(new Redis(config[_0xb8f8('0x1c')]));require('./team.socket')[_0xb8f8('0x1f')](socket);function respondWithStatusCode(_0x6083bd,_0x1a446d){_0x1a446d=_0x1a446d||0xcc;return function(_0x86627b){if(_0x86627b){return _0x6083bd[_0xb8f8('0x20')](_0x1a446d);}return _0x6083bd[_0xb8f8('0x21')](_0x1a446d)[_0xb8f8('0x22')]();};}function respondWithResult(_0x142299,_0x55b452){_0x55b452=_0x55b452||0xc8;return function(_0x3735d1){if(_0x3735d1){return _0x142299[_0xb8f8('0x21')](_0x55b452)[_0xb8f8('0x23')](_0x3735d1);}};}function respondWithFilteredResult(_0x4176ff,_0x4db4b0){return function(_0x53839c){if(_0x53839c){var _0x5f1b1c=typeof _0x4db4b0[_0xb8f8('0x24')]===_0xb8f8('0x25')&&typeof _0x4db4b0[_0xb8f8('0x26')]==='undefined';var _0x36210f=_0x53839c[_0xb8f8('0x27')];var _0x5b0bab=_0x5f1b1c?0x0:_0x4db4b0['offset'];var _0x433754=_0x5f1b1c?_0x53839c['count']:_0x4db4b0['offset']+_0x4db4b0[_0xb8f8('0x26')];var _0x51f386;if(_0x433754>=_0x36210f){_0x433754=_0x36210f;_0x51f386=0xc8;}else{_0x51f386=0xce;}_0x4176ff[_0xb8f8('0x21')](_0x51f386);return _0x4176ff[_0xb8f8('0x28')](_0xb8f8('0x29'),_0x5b0bab+'-'+_0x433754+'/'+_0x36210f)['json'](_0x53839c);}return null;};}function patchUpdates(_0x2202d5){return function(_0xa1aa05){try{jsonpatch['apply'](_0xa1aa05,_0x2202d5,!![]);}catch(_0x17b471){return BPromise['reject'](_0x17b471);}return _0xa1aa05['save']();};}function saveUpdates(_0x596d94,_0x497cd2){return function(_0x14ac1d){if(_0x14ac1d){return _0x14ac1d[_0xb8f8('0x2a')](_0x596d94)[_0xb8f8('0x2b')](function(_0x114913){return _0x114913;});}return null;};}function handleEntityNotFound(_0x33a46d,_0x3936b7){return function(_0xf15311){if(!_0xf15311){_0x33a46d[_0xb8f8('0x20')](0x194);}return _0xf15311;};}function handleError(_0x4e04d2,_0x1e7e4e){_0x1e7e4e=_0x1e7e4e||0x1f4;return function(_0x511ee8){logger[_0xb8f8('0x2c')](_0x511ee8[_0xb8f8('0x2d')]);if(_0x511ee8[_0xb8f8('0x2e')]){delete _0x511ee8['name'];}_0x4e04d2['status'](_0x1e7e4e)[_0xb8f8('0x2f')](_0x511ee8);};}exports[_0xb8f8('0x30')]=function(_0x4d1a8f,_0x512e0a){var _0x1743f2={},_0x39b9b2={},_0x16122e={'count':0x0,'rows':[]};var _0x123f68=_[_0xb8f8('0x31')](db['Team']['rawAttributes'],function(_0x39ffb5){return{'name':_0x39ffb5[_0xb8f8('0x32')],'type':_0x39ffb5[_0xb8f8('0x33')][_0xb8f8('0x34')]};});_0x39b9b2[_0xb8f8('0x35')]=_[_0xb8f8('0x31')](_0x123f68,_0xb8f8('0x2e'));_0x39b9b2[_0xb8f8('0x36')]=_[_0xb8f8('0x37')](_0x4d1a8f['query']);_0x39b9b2[_0xb8f8('0x38')]=_['intersection'](_0x39b9b2['model'],_0x39b9b2[_0xb8f8('0x36')]);_0x1743f2[_0xb8f8('0x39')]=_[_0xb8f8('0x3a')](_0x39b9b2[_0xb8f8('0x35')],qs[_0xb8f8('0x3b')](_0x4d1a8f[_0xb8f8('0x36')][_0xb8f8('0x3b')]));_0x1743f2['attributes']=_0x1743f2['attributes'][_0xb8f8('0x3c')]?_0x1743f2['attributes']:_0x39b9b2[_0xb8f8('0x35')];if(!_0x4d1a8f[_0xb8f8('0x36')]['hasOwnProperty'](_0xb8f8('0x3d'))){_0x1743f2[_0xb8f8('0x26')]=qs[_0xb8f8('0x26')](_0x4d1a8f[_0xb8f8('0x36')]['limit']);_0x1743f2[_0xb8f8('0x24')]=qs[_0xb8f8('0x24')](_0x4d1a8f[_0xb8f8('0x36')][_0xb8f8('0x24')]);}_0x1743f2[_0xb8f8('0x3e')]=qs['sort'](_0x4d1a8f[_0xb8f8('0x36')][_0xb8f8('0x3f')]);_0x1743f2[_0xb8f8('0x40')]=qs[_0xb8f8('0x38')](_[_0xb8f8('0x41')](_0x4d1a8f[_0xb8f8('0x36')],_0x39b9b2[_0xb8f8('0x38')]),_0x123f68);if(_0x4d1a8f[_0xb8f8('0x36')][_0xb8f8('0x42')]){_0x1743f2[_0xb8f8('0x40')]=_['merge'](_0x1743f2[_0xb8f8('0x40')],{'$or':_[_0xb8f8('0x31')](_0x123f68,function(_0x346525){if(_0x346525[_0xb8f8('0x33')]!==_0xb8f8('0x43')){var _0x58b679={};_0x58b679[_0x346525[_0xb8f8('0x2e')]]={'$like':'%'+_0x4d1a8f[_0xb8f8('0x36')][_0xb8f8('0x42')]+'%'};return _0x58b679;}})});}_0x1743f2=_[_0xb8f8('0x44')]({},_0x1743f2,_0x4d1a8f[_0xb8f8('0x45')]);var _0x5bee1a={'where':_0x1743f2[_0xb8f8('0x40')]};return db[_0xb8f8('0x46')][_0xb8f8('0x27')](_0x5bee1a)[_0xb8f8('0x2b')](function(_0x560164){_0x16122e[_0xb8f8('0x27')]=_0x560164;if(_0x4d1a8f[_0xb8f8('0x36')]['includeAll']){_0x1743f2[_0xb8f8('0x47')]=[{'all':!![]}];}return db[_0xb8f8('0x46')][_0xb8f8('0x48')](_0x1743f2);})[_0xb8f8('0x2b')](function(_0x2e177b){_0x16122e[_0xb8f8('0x49')]=_0x2e177b;return _0x16122e;})[_0xb8f8('0x2b')](respondWithFilteredResult(_0x512e0a,_0x1743f2))[_0xb8f8('0x4a')](handleError(_0x512e0a,null));};exports[_0xb8f8('0x4b')]=function(_0x3474f0,_0x1ce7b8){var _0x355f4c={'raw':![],'where':{'id':_0x3474f0[_0xb8f8('0x4c')]['id']}},_0x2997c0={};_0x2997c0['model']=_[_0xb8f8('0x37')](db[_0xb8f8('0x46')]['rawAttributes']);_0x2997c0['query']=_[_0xb8f8('0x37')](_0x3474f0[_0xb8f8('0x36')]);_0x2997c0[_0xb8f8('0x38')]=_[_0xb8f8('0x3a')](_0x2997c0[_0xb8f8('0x35')],_0x2997c0['query']);_0x355f4c['attributes']=_[_0xb8f8('0x3a')](_0x2997c0[_0xb8f8('0x35')],qs[_0xb8f8('0x3b')](_0x3474f0[_0xb8f8('0x36')][_0xb8f8('0x3b')]));_0x355f4c['attributes']=_0x355f4c[_0xb8f8('0x39')][_0xb8f8('0x3c')]?_0x355f4c[_0xb8f8('0x39')]:_0x2997c0[_0xb8f8('0x35')];if(_0x3474f0[_0xb8f8('0x36')][_0xb8f8('0x4d')]){_0x355f4c[_0xb8f8('0x47')]=[{'all':!![]}];}_0x355f4c=_[_0xb8f8('0x44')]({},_0x355f4c,_0x3474f0[_0xb8f8('0x45')]);return db[_0xb8f8('0x46')]['find'](_0x355f4c)['then'](handleEntityNotFound(_0x1ce7b8,null))[_0xb8f8('0x2b')](respondWithResult(_0x1ce7b8,null))[_0xb8f8('0x4a')](handleError(_0x1ce7b8,null));};exports[_0xb8f8('0x4e')]=function(_0x81de14,_0x117c23){return db['Team']['create'](_0x81de14['body'],{})[_0xb8f8('0x2b')](function(_0x9b8d42){var _0x5be58d=_0x81de14[_0xb8f8('0x4f')][_0xb8f8('0x50')]({'plain':!![]});if(!_0x5be58d)throw new Error(_0xb8f8('0x51'));if(_0x5be58d[_0xb8f8('0x52')]===_0xb8f8('0x4f')){var _0x2d3e30=_0x9b8d42['get']({'plain':!![]});var _0x2fc306=_0xb8f8('0x53');return db[_0xb8f8('0x54')][_0xb8f8('0x55')]({'where':{'name':_0x2fc306,'userProfileId':_0x5be58d['userProfileId']},'raw':!![]})['then'](function(_0x3cb4d4){if(_0x3cb4d4&&_0x3cb4d4[_0xb8f8('0x56')]===0x0){return db[_0xb8f8('0x57')][_0xb8f8('0x4e')]({'name':_0x2d3e30['name'],'resourceId':_0x2d3e30['id'],'type':_0x3cb4d4[_0xb8f8('0x2e')],'sectionId':_0x3cb4d4['id']},{})[_0xb8f8('0x2b')](function(){return _0x9b8d42;});}else{return _0x9b8d42;}})[_0xb8f8('0x4a')](function(_0xbf77d0){logger[_0xb8f8('0x2c')](_0xb8f8('0x58'),_0xbf77d0);throw _0xbf77d0;});}return _0x9b8d42;})[_0xb8f8('0x2b')](respondWithResult(_0x117c23,0xc9))[_0xb8f8('0x4a')](handleError(_0x117c23,null));};exports[_0xb8f8('0x2a')]=function(_0x2f5c40,_0x1c715b){if(_0x2f5c40[_0xb8f8('0x59')]['id']){delete _0x2f5c40[_0xb8f8('0x59')]['id'];}return db[_0xb8f8('0x46')][_0xb8f8('0x55')]({'where':{'id':_0x2f5c40[_0xb8f8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1c715b,null))[_0xb8f8('0x2b')](saveUpdates(_0x2f5c40[_0xb8f8('0x59')],null))[_0xb8f8('0x2b')](respondWithResult(_0x1c715b,null))[_0xb8f8('0x4a')](handleError(_0x1c715b,null));};exports['destroy']=function(_0x6cfeee,_0x5dba29){var _0x26e9a5=_0x6cfeee[_0xb8f8('0x4c')]['id'];var _0x37ed1a=[];return db[_0xb8f8('0x5a')][_0xb8f8('0x5b')](function(_0x562353){var _0x538d93=_0xb8f8('0x5c')+_0x26e9a5;return db[_0xb8f8('0x5a')]['query'](_0x538d93,{'type':db[_0xb8f8('0x5d')][_0xb8f8('0x5e')]['SELECT'],'raw':!![],'transaction':_0x562353})[_0xb8f8('0x2b')](function(_0x3ad247){_0x37ed1a=_[_0xb8f8('0x31')](_0x3ad247,function(_0xea505d){return Number(_0xea505d[_0xb8f8('0x5f')]);});})[_0xb8f8('0x2b')](function(){var _0x18ccf8=_0xb8f8('0x60')+_0x26e9a5;return db[_0xb8f8('0x5a')][_0xb8f8('0x36')](_0x18ccf8,{'type':db[_0xb8f8('0x5d')][_0xb8f8('0x5e')][_0xb8f8('0x61')],'raw':!![],'transaction':_0x562353});})[_0xb8f8('0x2b')](function(_0x58ecff){var _0x190bee=_[_0xb8f8('0x31')](_0x58ecff,function(_0xd1cda2){return Number(_0xd1cda2[_0xb8f8('0x62')]);});return db['UserVoiceQueue'][_0xb8f8('0x63')]({'where':{'UserId':{'$in':_0x37ed1a},'VoiceQueueId':{'$in':_0x190bee}},'transaction':_0x562353});})[_0xb8f8('0x2b')](function(){var _0x41b829=_0xb8f8('0x64')+_0x26e9a5;return db[_0xb8f8('0x5a')][_0xb8f8('0x36')](_0x41b829,{'type':db['Sequelize'][_0xb8f8('0x5e')][_0xb8f8('0x61')],'raw':!![],'transaction':_0x562353});})['then'](function(_0x3d86d9){var _0x398c01=_['map'](_0x3d86d9,function(_0x7cc490){return Number(_0x7cc490[_0xb8f8('0x65')]);});return db[_0xb8f8('0x66')]['destroy']({'where':{'UserId':{'$in':_0x37ed1a},'MailQueueId':{'$in':_0x398c01}},'transaction':_0x562353});})[_0xb8f8('0x2b')](function(){var _0xfd53d0=_0xb8f8('0x67')+_0x26e9a5;return db[_0xb8f8('0x5a')][_0xb8f8('0x36')](_0xfd53d0,{'type':db[_0xb8f8('0x5d')][_0xb8f8('0x5e')][_0xb8f8('0x61')],'raw':!![],'transaction':_0x562353});})[_0xb8f8('0x2b')](function(_0x2ee202){var _0x5280ae=_[_0xb8f8('0x31')](_0x2ee202,function(_0x44cd27){return Number(_0x44cd27['SmsQueueId']);});return db[_0xb8f8('0x68')][_0xb8f8('0x63')]({'where':{'UserId':{'$in':_0x37ed1a},'SmsQueueId':{'$in':_0x5280ae}},'transaction':_0x562353});})['then'](function(){var _0x4cf649=_0xb8f8('0x69')+_0x26e9a5;return db[_0xb8f8('0x5a')]['query'](_0x4cf649,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x562353});})['then'](function(_0x5b8dd9){var _0x382f42=_[_0xb8f8('0x31')](_0x5b8dd9,function(_0x14c617){return Number(_0x14c617[_0xb8f8('0x6a')]);});return db[_0xb8f8('0x6b')][_0xb8f8('0x63')]({'where':{'UserId':{'$in':_0x37ed1a},'ChatQueueId':{'$in':_0x382f42}},'transaction':_0x562353});})[_0xb8f8('0x2b')](function(){var _0x5c67e9='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x26e9a5;return db['sequelize'][_0xb8f8('0x36')](_0x5c67e9,{'type':db[_0xb8f8('0x5d')][_0xb8f8('0x5e')]['SELECT'],'raw':!![],'transaction':_0x562353});})[_0xb8f8('0x2b')](function(_0x38de49){var _0x40e5a7=_[_0xb8f8('0x31')](_0x38de49,function(_0x4e6993){return Number(_0x4e6993[_0xb8f8('0x6c')]);});return db[_0xb8f8('0x6d')][_0xb8f8('0x63')]({'where':{'UserId':{'$in':_0x37ed1a},'FaxQueueId':{'$in':_0x40e5a7}},'transaction':_0x562353});})[_0xb8f8('0x2b')](function(){var _0xe5ec1f=_0xb8f8('0x6e')+_0x26e9a5;return db[_0xb8f8('0x5a')][_0xb8f8('0x36')](_0xe5ec1f,{'type':db[_0xb8f8('0x5d')]['QueryTypes'][_0xb8f8('0x61')],'raw':!![],'transaction':_0x562353});})[_0xb8f8('0x2b')](function(_0x58bf98){var _0x14e44b=_[_0xb8f8('0x31')](_0x58bf98,function(_0x35eef2){return Number(_0x35eef2[_0xb8f8('0x6f')]);});return db[_0xb8f8('0x70')]['destroy']({'where':{'UserId':{'$in':_0x37ed1a},'OpenchannelQueueId':{'$in':_0x14e44b}},'transaction':_0x562353});})[_0xb8f8('0x2b')](function(){var _0x5d150c=_0xb8f8('0x71')+_0x26e9a5;return db[_0xb8f8('0x5a')][_0xb8f8('0x36')](_0x5d150c,{'type':db[_0xb8f8('0x5d')]['QueryTypes'][_0xb8f8('0x61')],'raw':!![],'transaction':_0x562353});})[_0xb8f8('0x2b')](function(_0x34fe7e){var _0x4fad22=_[_0xb8f8('0x31')](_0x34fe7e,function(_0x5d3ded){return Number(_0x5d3ded[_0xb8f8('0x72')]);});return db['UserWhatsappQueue'][_0xb8f8('0x63')]({'where':{'UserId':{'$in':_0x37ed1a},'WhatsappQueueId':{'$in':_0x4fad22}},'transaction':_0x562353});})[_0xb8f8('0x2b')](function(){return db[_0xb8f8('0x73')][_0xb8f8('0x55')]({'where':{'TeamId':_0x26e9a5}});})[_0xb8f8('0x2b')](function(_0x53a0c1){if(_0x53a0c1===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x37ed1a},'VoicePrefixId':_0x53a0c1[_0xb8f8('0x74')]},'transaction':_0x562353});})['then'](function(){return db[_0xb8f8('0x46')][_0xb8f8('0x63')]({'where':{'id':_0x26e9a5},'cascade':!![],'transaction':_0x562353});})[_0xb8f8('0x2b')](function(_0x2cc72f){if(_0x2cc72f===0x0){_0x5dba29[_0xb8f8('0x20')](0x194);}else{return db[_0xb8f8('0x57')][_0xb8f8('0x63')]({'where':{'type':_0xb8f8('0x53'),'resourceId':_0x26e9a5},'cascade':!![],'transaction':_0x562353})[_0xb8f8('0x2b')](function(){_0x5dba29[_0xb8f8('0x21')](0xcc)['end']();});}})[_0xb8f8('0x4a')](function(_0xdedd78){_0x5dba29[_0xb8f8('0x21')](0x1f4)[_0xb8f8('0x2f')](_0xdedd78);});});};exports['getQueues']=function(_0x5d1973,_0x39afcb,_0x53f369){return db[_0xb8f8('0x46')]['findOne']({'where':{'id':_0x5d1973[_0xb8f8('0x4c')]['id']}})[_0xb8f8('0x2b')](handleEntityNotFound(_0x39afcb,null))['then'](function(_0x4d57c8){if(!_0x5d1973[_0xb8f8('0x36')]['channel']||!utils[_0xb8f8('0x75')](_0x5d1973['query']['channel'])){throw new db[(_0xb8f8('0x5d'))][(_0xb8f8('0x76'))](_0xb8f8('0x77'));}var _0x338a22={};var _0x2df849={};_0x2df849[_0xb8f8('0x35')]=_['keys'](db[_[_0xb8f8('0x78')](_0x5d1973[_0xb8f8('0x36')][_0xb8f8('0x79')][_0xb8f8('0x7a')]())+'Queue'][_0xb8f8('0x7b')]);_0x2df849[_0xb8f8('0x36')]=_[_0xb8f8('0x37')](_0x5d1973['query']);_0x2df849[_0xb8f8('0x38')]=_[_0xb8f8('0x3a')](_0x2df849['model'],_0x2df849[_0xb8f8('0x36')]);_0x338a22[_0xb8f8('0x39')]=_[_0xb8f8('0x3a')](_0x2df849[_0xb8f8('0x35')],qs['fields'](_0x5d1973[_0xb8f8('0x36')][_0xb8f8('0x3b')]));_0x338a22['attributes']=_0x338a22[_0xb8f8('0x39')]['length']?_0x338a22[_0xb8f8('0x39')]:_0x2df849['model'];_0x338a22[_0xb8f8('0x26')]=qs[_0xb8f8('0x26')](_0x5d1973[_0xb8f8('0x36')][_0xb8f8('0x26')]);_0x338a22['offset']=qs['offset'](_0x5d1973[_0xb8f8('0x36')]['offset']);_0x338a22['order']=qs[_0xb8f8('0x3f')](_0x5d1973[_0xb8f8('0x36')][_0xb8f8('0x3f')]);_0x338a22[_0xb8f8('0x40')]=qs[_0xb8f8('0x38')](_[_0xb8f8('0x41')](_0x5d1973[_0xb8f8('0x36')],_0x2df849['filters']));_0x338a22=_[_0xb8f8('0x44')]({},_0x338a22,_0x5d1973[_0xb8f8('0x45')]);return _0x4d57c8[_0xb8f8('0x50')+_['capitalize'](_0x5d1973[_0xb8f8('0x36')][_0xb8f8('0x79')][_0xb8f8('0x7a')]())+_0xb8f8('0x7c')](_0x338a22);})[_0xb8f8('0x2b')](respondWithResult(_0x39afcb,null))[_0xb8f8('0x4a')](handleError(_0x39afcb,null));};exports['addQueues']=function(_0x4d81cd,_0x3be40f,_0x545f90){return db[_0xb8f8('0x46')]['findOne']({'where':{'id':_0x4d81cd[_0xb8f8('0x4c')]['id']}})[_0xb8f8('0x2b')](function(_0x2fdf56){if(_0x2fdf56){if(!_0x4d81cd['body'][_0xb8f8('0x79')]||!utils[_0xb8f8('0x75')](_0x4d81cd['body'][_0xb8f8('0x79')])){throw new db['Sequelize'][(_0xb8f8('0x76'))](_0xb8f8('0x77'));}return _0x2fdf56[_0xb8f8('0x7d')+_['capitalize'](_0x4d81cd[_0xb8f8('0x59')][_0xb8f8('0x79')][_0xb8f8('0x7a')]())+_0xb8f8('0x7c')](_0x4d81cd['body'][_0xb8f8('0x7e')]);}return null;})['then'](handleEntityNotFound(_0x3be40f,null))['then'](respondWithStatusCode(_0x3be40f,null))[_0xb8f8('0x4a')](handleError(_0x3be40f,null));};exports[_0xb8f8('0x7f')]=function(_0x46eabb,_0x165929,_0x22c3cd){return db[_0xb8f8('0x46')]['findOne']({'where':{'id':_0x46eabb['params']['id']}})[_0xb8f8('0x2b')](function(_0x52a4c1){if(_0x52a4c1){if(!_0x46eabb['query'][_0xb8f8('0x79')]||!utils['isValidChannel'](_0x46eabb['query']['channel'])){throw new db['Sequelize'][(_0xb8f8('0x76'))](_0xb8f8('0x77'));}return _0x52a4c1[_0xb8f8('0x80')+_[_0xb8f8('0x78')](_0x46eabb[_0xb8f8('0x36')][_0xb8f8('0x79')]['toLowerCase']())+_0xb8f8('0x7c')](_0x46eabb['query'][_0xb8f8('0x7e')]);}return null;})[_0xb8f8('0x2b')](handleEntityNotFound(_0x165929,null))[_0xb8f8('0x2b')](respondWithStatusCode(_0x165929,null))[_0xb8f8('0x4a')](handleError(_0x165929,null));};exports[_0xb8f8('0x81')]=function(_0x1dedad,_0x545737){var _0x17d43e=_['isArray'](_0x1dedad[_0xb8f8('0x59')][_0xb8f8('0x7e')])?_0x1dedad[_0xb8f8('0x59')]['ids']:[_0x1dedad[_0xb8f8('0x59')][_0xb8f8('0x7e')]];var _0x17fa00=_0x1dedad[_0xb8f8('0x4c')]['id'];return db['Team'][_0xb8f8('0x55')]({'where':{'id':_0x17fa00}})[_0xb8f8('0x2b')](handleEntityNotFound(_0x545737,null))['then'](function(_0x2c2e98){if(_0x2c2e98){var _0x3f466a=['Voice','Chat',_0xb8f8('0x82'),_0xb8f8('0x83'),'Fax','Openchannel',_0xb8f8('0x84')];return db[_0xb8f8('0x5a')]['transaction'](function(_0x5db8c4){var _0x226d62=_['map'](_0x3f466a,function(_0x3d3c60){var _0x12578d={'attributes':['id',_0xb8f8('0x2e')]};if(_0x3d3c60==='Voice'){_0x12578d['through']={'attributes':[_0xb8f8('0x85')]};}return _0x2c2e98[_0xb8f8('0x50')+_0x3d3c60+'Queues'](_0x12578d)[_0xb8f8('0x2b')](function(_0x35fded){var _0x292ea1=_[_0xb8f8('0x31')](_0x35fded,function(_0x3b80b3){var _0x4ae6af=_[_0xb8f8('0x31')](_0x17d43e,function(_0x23c35c){var _0x2cd799={'where':{'UserId':_0x23c35c,[_0x3d3c60+'QueueId']:_0x3b80b3['id']},'transaction':_0x5db8c4};if(_0x3d3c60==='Voice'){_0x2cd799['defaults']={'penalty':_0x3b80b3[_0xb8f8('0x86')][_0xb8f8('0x85')]};}return db['User'+_0x3d3c60+_0xb8f8('0x87')][_0xb8f8('0x88')](_0x2cd799)[_0xb8f8('0x2b')](function(){socket[_0xb8f8('0x89')](_0xb8f8('0x4f')+_0x3d3c60+_0xb8f8('0x8a'),{'UserId':_0x23c35c,[_0x3d3c60+'QueueId']:_0x3b80b3['id']});if(_0x3d3c60!==_0xb8f8('0x8b')){return;}return db[_0xb8f8('0x8c')][_0xb8f8('0x48')]({'where':{'id':_0x17d43e,'online':0x1},'attributes':['id','name',_0xb8f8('0x8d'),_0xb8f8('0x8e'),_0xb8f8('0x8f')],'raw':!![]})[_0xb8f8('0x2b')](function(_0x2beac1){var _0x2a22ff=_[_0xb8f8('0x31')](_0x2beac1,function(_0x49a6bc){return db[_0xb8f8('0x90')][_0xb8f8('0x91')]({'membername':_0x49a6bc[_0xb8f8('0x2e')],'UserId':_0x49a6bc['id'],'queue_name':_0x3b80b3[_0xb8f8('0x2e')],'VoiceQueueId':_0x3b80b3['id'],'interface':_[_0xb8f8('0x92')](_0x49a6bc[_0xb8f8('0x8f')])?util[_0xb8f8('0x93')](_0xb8f8('0x94'),_0x49a6bc['name']):_0x49a6bc['interface'],'paused':_0x49a6bc[_0xb8f8('0x8e')]||![],'penalty':_0x3b80b3[_0xb8f8('0x86')][_0xb8f8('0x85')]},{'transaction':_0x5db8c4});});return Promise['all'](_0x2a22ff);});});});return Promise[_0xb8f8('0x95')](_0x4ae6af);});return Promise[_0xb8f8('0x95')](_0x292ea1);})[_0xb8f8('0x2b')](function(){return db[_0xb8f8('0x73')][_0xb8f8('0x96')]({'where':{'teamId':_0x17fa00}})[_0xb8f8('0x2b')](function(_0x36f723){if(_0x36f723){var _0x522f12=_['map'](_0x17d43e,function(_0xf20265){db[_0xb8f8('0x97')][_0xb8f8('0x91')]({'UserId':_0xf20265,'VoicePrefixId':_0x36f723['VoicePrefixId']});});return Promise[_0xb8f8('0x95')](_0x522f12);}});});});return Promise[_0xb8f8('0x95')](_0x226d62)[_0xb8f8('0x2b')](function(){return _0x2c2e98[_0xb8f8('0x81')](_0x17d43e,{'transaction':_0x5db8c4})['spread'](function(_0x9992d2){return _0x9992d2;});});});}})[_0xb8f8('0x2b')](respondWithResult(_0x545737,null))[_0xb8f8('0x4a')](handleError(_0x545737,null));};exports['removeAgents']=function(_0x38ed4c,_0x43e1b1){var _0x41d25f=_['isArray'](_0x38ed4c['query'][_0xb8f8('0x7e')])?_0x38ed4c[_0xb8f8('0x36')][_0xb8f8('0x7e')]:[_0x38ed4c['query'][_0xb8f8('0x7e')]];var _0x183e6e=_0x38ed4c[_0xb8f8('0x4c')]['id'];return db[_0xb8f8('0x46')][_0xb8f8('0x55')]({'where':{'id':_0x183e6e}})['then'](handleEntityNotFound(_0x43e1b1,null))[_0xb8f8('0x2b')](function(_0x3f443a){if(_0x3f443a){var _0x4be83a=[_0xb8f8('0x8b'),'Chat',_0xb8f8('0x82'),_0xb8f8('0x83'),_0xb8f8('0x98'),_0xb8f8('0x99'),_0xb8f8('0x84')];return db[_0xb8f8('0x5a')]['transaction'](function(_0x4642a4){var _0x3b4d2d=_['map'](_0x4be83a,function(_0x5f0d12){var _0x152dec={'attributes':['id',_0xb8f8('0x2e')]};return _0x3f443a[_0xb8f8('0x50')+_0x5f0d12+_0xb8f8('0x7c')](_0x152dec)[_0xb8f8('0x2b')](function(_0x4ec5f3){var _0x4d1a61=_[_0xb8f8('0x31')](_0x4ec5f3,function(_0xbf65f5){return _0xbf65f5[_0xb8f8('0x9a')](_0x41d25f,{'transaction':_0x4642a4})[_0xb8f8('0x2b')](function(){var _0x112c2c=_['map'](_0x41d25f,function(_0xd99f8){socket[_0xb8f8('0x89')]('user'+_0x5f0d12+_0xb8f8('0x9b'),{'UserId':Number(_0xd99f8),[_0x5f0d12+_0xb8f8('0x9c')]:_0xbf65f5['id']});if(_0x5f0d12!==_0xb8f8('0x8b')){return;}return db[_0xb8f8('0x90')][_0xb8f8('0x63')]({'where':{'VoiceQueueId':_0xbf65f5['id'],'UserId':_0xd99f8},'transaction':_0x4642a4});});return Promise[_0xb8f8('0x95')](_0x112c2c);});});return Promise[_0xb8f8('0x95')](_0x4d1a61);});});return Promise[_0xb8f8('0x95')](_0x3b4d2d)[_0xb8f8('0x2b')](function(){return _0x3f443a['removeAgents'](_0x41d25f,{'transaction':_0x4642a4});})[_0xb8f8('0x2b')](function(){return db[_0xb8f8('0x73')][_0xb8f8('0x96')]({'where':{'teamId':_0x183e6e}})[_0xb8f8('0x2b')](function(_0xae13da){if(_0xae13da){var _0x20fa70=_[_0xb8f8('0x31')](_0x41d25f,function(_0x57c41c){db[_0xb8f8('0x97')][_0xb8f8('0x63')]({'where':{'UserId':_0x57c41c,'VoicePrefixId':_0xae13da[_0xb8f8('0x74')]}});});return Promise['all'](_0x20fa70);}});});});}})[_0xb8f8('0x2b')](respondWithStatusCode(_0x43e1b1,null))[_0xb8f8('0x4a')](handleError(_0x43e1b1,null));};exports[_0xb8f8('0x9d')]=function(_0x583ca9,_0x576a62,_0x3b3447){var _0x45df16={};var _0x271080={};var _0x2a4dc4;var _0x17dd7d;return db['Team'][_0xb8f8('0x96')]({'where':{'id':_0x583ca9['params']['id']}})[_0xb8f8('0x2b')](handleEntityNotFound(_0x576a62,null))[_0xb8f8('0x2b')](function(_0x403059){if(_0x403059){_0x2a4dc4=_0x403059;_0x271080['model']=_[_0xb8f8('0x37')](db[_0xb8f8('0x8c')][_0xb8f8('0x7b')]);_0x271080['query']=_[_0xb8f8('0x37')](_0x583ca9['query']);_0x271080[_0xb8f8('0x38')]=_[_0xb8f8('0x3a')](_0x271080['model'],_0x271080[_0xb8f8('0x36')]);_0x45df16[_0xb8f8('0x39')]=_[_0xb8f8('0x3a')](_0x271080[_0xb8f8('0x35')],qs['fields'](_0x583ca9[_0xb8f8('0x36')][_0xb8f8('0x3b')]));_0x45df16[_0xb8f8('0x39')]=_0x45df16['attributes'][_0xb8f8('0x3c')]?_0x45df16[_0xb8f8('0x39')]:_0x271080[_0xb8f8('0x35')];_0x45df16['order']=qs[_0xb8f8('0x3f')](_0x583ca9[_0xb8f8('0x36')]['sort']);_0x45df16[_0xb8f8('0x40')]=qs[_0xb8f8('0x38')](_['pick'](_0x583ca9[_0xb8f8('0x36')],_0x271080['filters']));if(_0x583ca9[_0xb8f8('0x36')][_0xb8f8('0x42')]){_0x45df16[_0xb8f8('0x40')]=_['merge'](_0x45df16[_0xb8f8('0x40')],{'$or':_['map'](_0x45df16[_0xb8f8('0x39')],function(_0x419544){var _0x183434={};_0x183434[_0x419544]={'$like':'%'+_0x583ca9['query'][_0xb8f8('0x42')]+'%'};return _0x183434;})});}_0x45df16=_[_0xb8f8('0x44')]({},_0x45df16,_0x583ca9['options']);return _0x2a4dc4['getAgents'](_0x45df16);}})['then'](function(_0x26ec66){if(_0x26ec66){_0x17dd7d=_0x26ec66['length'];if(!_0x583ca9[_0xb8f8('0x36')][_0xb8f8('0x9e')]('nolimit')){_0x45df16[_0xb8f8('0x26')]=qs[_0xb8f8('0x26')](_0x583ca9[_0xb8f8('0x36')][_0xb8f8('0x26')]);_0x45df16['offset']=qs[_0xb8f8('0x24')](_0x583ca9[_0xb8f8('0x36')][_0xb8f8('0x24')]);}return _0x2a4dc4[_0xb8f8('0x9d')](_0x45df16);}})[_0xb8f8('0x2b')](function(_0x2ecaca){if(_0x2ecaca){return _0x2ecaca?{'count':_0x17dd7d,'rows':_0x2ecaca}:null;}})[_0xb8f8('0x2b')](respondWithResult(_0x576a62,null))[_0xb8f8('0x4a')](handleError(_0x576a62,null));}; \ No newline at end of file +var _0xbe29=['getAgents','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/environment','../../config/license/util','redis','defaults','localhost','./team.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','Team','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','merge','filter','options','includeAll','include','rows','show','params','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','capitalize','toLowerCase','order','pick','Queues','addQueues','ValidationError','Unknown\x20channel','ids','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','penalty','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','emit','online','voicePause','interface','UserVoiceQueueRt','SIP/%s','all','UserVoicePrefix','addAgents','removeAgents','Whatsapp','Queue:remove'];(function(_0x21d36e,_0x5dc096){var _0x4cc307=function(_0x4ae995){while(--_0x4ae995){_0x21d36e['push'](_0x21d36e['shift']());}};_0x4cc307(++_0x5dc096);}(_0xbe29,0x12c));var _0x9be2=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0xbe29[_0x5f1617];return _0x3af5da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9be2('0x0'));var zipdir=require(_0x9be2('0x1'));var jsonpatch=require(_0x9be2('0x2'));var rp=require(_0x9be2('0x3'));var moment=require(_0x9be2('0x4'));var BPromise=require(_0x9be2('0x5'));var Mustache=require(_0x9be2('0x6'));var util=require('util');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('fs-extra');var _=require(_0x9be2('0x7'));var squel=require(_0x9be2('0x8'));var crypto=require(_0x9be2('0x9'));var jsforce=require(_0x9be2('0xa'));var deskjs=require(_0x9be2('0xb'));var toCsv=require(_0x9be2('0xc'));var querystring=require(_0x9be2('0xd'));var Papa=require(_0x9be2('0xe'));var Redis=require(_0x9be2('0xf'));var authService=require(_0x9be2('0x10'));var qs=require(_0x9be2('0x11'));var as=require(_0x9be2('0x12'));var hardwareService=require(_0x9be2('0x13'));var logger=require(_0x9be2('0x14'))(_0x9be2('0x15'));var utils=require(_0x9be2('0x16'));var config=require(_0x9be2('0x17'));var licenseUtil=require(_0x9be2('0x18'));var db=require('../../mysqldb')['db'];config[_0x9be2('0x19')]=_[_0x9be2('0x1a')](config[_0x9be2('0x19')],{'host':_0x9be2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9be2('0x19')]));require(_0x9be2('0x1c'))[_0x9be2('0x1d')](socket);function respondWithStatusCode(_0x4b7c01,_0x5caa32){_0x5caa32=_0x5caa32||0xcc;return function(_0x5250d3){if(_0x5250d3){return _0x4b7c01[_0x9be2('0x1e')](_0x5caa32);}return _0x4b7c01[_0x9be2('0x1f')](_0x5caa32)[_0x9be2('0x20')]();};}function respondWithResult(_0x41b9ea,_0x1687ad){_0x1687ad=_0x1687ad||0xc8;return function(_0x59a4c5){if(_0x59a4c5){return _0x41b9ea[_0x9be2('0x1f')](_0x1687ad)['json'](_0x59a4c5);}};}function respondWithFilteredResult(_0x23b0b8,_0x1d93c2){return function(_0x191592){if(_0x191592){var _0x5d376a=typeof _0x1d93c2['offset']===_0x9be2('0x21')&&typeof _0x1d93c2[_0x9be2('0x22')]===_0x9be2('0x21');var _0x222e95=_0x191592[_0x9be2('0x23')];var _0x85db1f=_0x5d376a?0x0:_0x1d93c2[_0x9be2('0x24')];var _0x153829=_0x5d376a?_0x191592[_0x9be2('0x23')]:_0x1d93c2[_0x9be2('0x24')]+_0x1d93c2[_0x9be2('0x22')];var _0x504d37;if(_0x153829>=_0x222e95){_0x153829=_0x222e95;_0x504d37=0xc8;}else{_0x504d37=0xce;}_0x23b0b8['status'](_0x504d37);return _0x23b0b8[_0x9be2('0x25')](_0x9be2('0x26'),_0x85db1f+'-'+_0x153829+'/'+_0x222e95)[_0x9be2('0x27')](_0x191592);}return null;};}function patchUpdates(_0x2c7dc6){return function(_0x459c3b){try{jsonpatch[_0x9be2('0x28')](_0x459c3b,_0x2c7dc6,!![]);}catch(_0x2573c1){return BPromise[_0x9be2('0x29')](_0x2573c1);}return _0x459c3b[_0x9be2('0x2a')]();};}function saveUpdates(_0x1607a5,_0x517621){return function(_0x5e1704){if(_0x5e1704){return _0x5e1704[_0x9be2('0x2b')](_0x1607a5)[_0x9be2('0x2c')](function(_0x5344db){return _0x5344db;});}return null;};}function handleEntityNotFound(_0x5f4faa,_0x3c639b){return function(_0x1a4b1b){if(!_0x1a4b1b){_0x5f4faa[_0x9be2('0x1e')](0x194);}return _0x1a4b1b;};}function handleError(_0xbbfe75,_0x1c38f6){_0x1c38f6=_0x1c38f6||0x1f4;return function(_0x208cb7){logger[_0x9be2('0x2d')](_0x208cb7[_0x9be2('0x2e')]);if(_0x208cb7['name']){delete _0x208cb7[_0x9be2('0x2f')];}_0xbbfe75[_0x9be2('0x1f')](_0x1c38f6)[_0x9be2('0x30')](_0x208cb7);};}exports['index']=function(_0xcb79ee,_0x43cf85){var _0x49a570={},_0x1b7211={},_0x416ff5={'count':0x0,'rows':[]};var _0x40840d=_[_0x9be2('0x31')](db[_0x9be2('0x32')][_0x9be2('0x33')],function(_0x57f622){return{'name':_0x57f622['fieldName'],'type':_0x57f622[_0x9be2('0x34')][_0x9be2('0x35')]};});_0x1b7211[_0x9be2('0x36')]=_[_0x9be2('0x31')](_0x40840d,_0x9be2('0x2f'));_0x1b7211[_0x9be2('0x37')]=_[_0x9be2('0x38')](_0xcb79ee[_0x9be2('0x37')]);_0x1b7211['filters']=_[_0x9be2('0x39')](_0x1b7211[_0x9be2('0x36')],_0x1b7211[_0x9be2('0x37')]);_0x49a570[_0x9be2('0x3a')]=_[_0x9be2('0x39')](_0x1b7211[_0x9be2('0x36')],qs['fields'](_0xcb79ee['query'][_0x9be2('0x3b')]));_0x49a570[_0x9be2('0x3a')]=_0x49a570[_0x9be2('0x3a')][_0x9be2('0x3c')]?_0x49a570[_0x9be2('0x3a')]:_0x1b7211[_0x9be2('0x36')];if(!_0xcb79ee[_0x9be2('0x37')][_0x9be2('0x3d')]('nolimit')){_0x49a570[_0x9be2('0x22')]=qs[_0x9be2('0x22')](_0xcb79ee[_0x9be2('0x37')][_0x9be2('0x22')]);_0x49a570[_0x9be2('0x24')]=qs['offset'](_0xcb79ee['query'][_0x9be2('0x24')]);}_0x49a570['order']=qs['sort'](_0xcb79ee['query'][_0x9be2('0x3e')]);_0x49a570[_0x9be2('0x3f')]=qs[_0x9be2('0x40')](_['pick'](_0xcb79ee[_0x9be2('0x37')],_0x1b7211['filters']),_0x40840d);if(_0xcb79ee['query']['filter']){_0x49a570[_0x9be2('0x3f')]=_[_0x9be2('0x41')](_0x49a570[_0x9be2('0x3f')],{'$or':_[_0x9be2('0x31')](_0x40840d,function(_0x284ada){if(_0x284ada[_0x9be2('0x34')]!=='VIRTUAL'){var _0x4c3499={};_0x4c3499[_0x284ada[_0x9be2('0x2f')]]={'$like':'%'+_0xcb79ee[_0x9be2('0x37')][_0x9be2('0x42')]+'%'};return _0x4c3499;}})});}_0x49a570=_[_0x9be2('0x41')]({},_0x49a570,_0xcb79ee[_0x9be2('0x43')]);var _0x13e661={'where':_0x49a570[_0x9be2('0x3f')]};return db['Team'][_0x9be2('0x23')](_0x13e661)[_0x9be2('0x2c')](function(_0x1fdd85){_0x416ff5[_0x9be2('0x23')]=_0x1fdd85;if(_0xcb79ee[_0x9be2('0x37')][_0x9be2('0x44')]){_0x49a570[_0x9be2('0x45')]=[{'all':!![]}];}return db['Team']['findAll'](_0x49a570);})[_0x9be2('0x2c')](function(_0x5c97cd){_0x416ff5[_0x9be2('0x46')]=_0x5c97cd;return _0x416ff5;})[_0x9be2('0x2c')](respondWithFilteredResult(_0x43cf85,_0x49a570))['catch'](handleError(_0x43cf85,null));};exports[_0x9be2('0x47')]=function(_0x1cda60,_0x33252d){var _0x394d65={'raw':![],'where':{'id':_0x1cda60[_0x9be2('0x48')]['id']}},_0x5b93b3={};_0x5b93b3[_0x9be2('0x36')]=_[_0x9be2('0x38')](db[_0x9be2('0x32')]['rawAttributes']);_0x5b93b3[_0x9be2('0x37')]=_[_0x9be2('0x38')](_0x1cda60['query']);_0x5b93b3[_0x9be2('0x40')]=_['intersection'](_0x5b93b3[_0x9be2('0x36')],_0x5b93b3[_0x9be2('0x37')]);_0x394d65[_0x9be2('0x3a')]=_[_0x9be2('0x39')](_0x5b93b3[_0x9be2('0x36')],qs[_0x9be2('0x3b')](_0x1cda60[_0x9be2('0x37')][_0x9be2('0x3b')]));_0x394d65['attributes']=_0x394d65[_0x9be2('0x3a')]['length']?_0x394d65[_0x9be2('0x3a')]:_0x5b93b3[_0x9be2('0x36')];if(_0x1cda60[_0x9be2('0x37')][_0x9be2('0x44')]){_0x394d65['include']=[{'all':!![]}];}_0x394d65=_[_0x9be2('0x41')]({},_0x394d65,_0x1cda60[_0x9be2('0x43')]);return db['Team'][_0x9be2('0x49')](_0x394d65)[_0x9be2('0x2c')](handleEntityNotFound(_0x33252d,null))[_0x9be2('0x2c')](respondWithResult(_0x33252d,null))['catch'](handleError(_0x33252d,null));};exports['create']=function(_0x2d6c1d,_0xf6d404){return db['Team'][_0x9be2('0x4a')](_0x2d6c1d['body'],{})['then'](function(_0x1080a6){var _0x4ee60a=_0x2d6c1d['user'][_0x9be2('0x4b')]({'plain':!![]});if(!_0x4ee60a)throw new Error(_0x9be2('0x4c'));if(_0x4ee60a[_0x9be2('0x4d')]===_0x9be2('0x4e')){var _0x487fd5=_0x1080a6[_0x9be2('0x4b')]({'plain':!![]});var _0x4f6bc8=_0x9be2('0x4f');return db[_0x9be2('0x50')][_0x9be2('0x49')]({'where':{'name':_0x4f6bc8,'userProfileId':_0x4ee60a[_0x9be2('0x51')]},'raw':!![]})[_0x9be2('0x2c')](function(_0x584e19){if(_0x584e19&&_0x584e19[_0x9be2('0x52')]===0x0){return db[_0x9be2('0x53')][_0x9be2('0x4a')]({'name':_0x487fd5[_0x9be2('0x2f')],'resourceId':_0x487fd5['id'],'type':_0x584e19['name'],'sectionId':_0x584e19['id']},{})[_0x9be2('0x2c')](function(){return _0x1080a6;});}else{return _0x1080a6;}})[_0x9be2('0x54')](function(_0x6b41f1){logger[_0x9be2('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6b41f1);throw _0x6b41f1;});}return _0x1080a6;})['then'](respondWithResult(_0xf6d404,0xc9))[_0x9be2('0x54')](handleError(_0xf6d404,null));};exports['update']=function(_0x41982a,_0x5763bc){if(_0x41982a[_0x9be2('0x55')]['id']){delete _0x41982a[_0x9be2('0x55')]['id'];}return db['Team']['find']({'where':{'id':_0x41982a['params']['id']}})[_0x9be2('0x2c')](handleEntityNotFound(_0x5763bc,null))['then'](saveUpdates(_0x41982a[_0x9be2('0x55')],null))[_0x9be2('0x2c')](respondWithResult(_0x5763bc,null))[_0x9be2('0x54')](handleError(_0x5763bc,null));};exports[_0x9be2('0x56')]=function(_0x3b5633,_0x48f4d3){var _0xaf5e68=_0x3b5633[_0x9be2('0x48')]['id'];var _0x51187d=[];return db[_0x9be2('0x57')][_0x9be2('0x58')](function(_0x264e82){var _0x4385d4=_0x9be2('0x59')+_0xaf5e68;return db['sequelize']['query'](_0x4385d4,{'type':db[_0x9be2('0x5a')][_0x9be2('0x5b')]['SELECT'],'raw':!![],'transaction':_0x264e82})[_0x9be2('0x2c')](function(_0x3c0809){_0x51187d=_[_0x9be2('0x31')](_0x3c0809,function(_0x5c0f20){return Number(_0x5c0f20['UserId']);});})['then'](function(){var _0x512fba='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0xaf5e68;return db['sequelize'][_0x9be2('0x37')](_0x512fba,{'type':db['Sequelize'][_0x9be2('0x5b')]['SELECT'],'raw':!![],'transaction':_0x264e82});})[_0x9be2('0x2c')](function(_0x13e53e){var _0x5484bf=_[_0x9be2('0x31')](_0x13e53e,function(_0x8c5c2b){return Number(_0x8c5c2b[_0x9be2('0x5c')]);});return db[_0x9be2('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x51187d},'VoiceQueueId':{'$in':_0x5484bf}},'transaction':_0x264e82});})[_0x9be2('0x2c')](function(){var _0x44f024='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0xaf5e68;return db[_0x9be2('0x57')][_0x9be2('0x37')](_0x44f024,{'type':db[_0x9be2('0x5a')][_0x9be2('0x5b')][_0x9be2('0x5e')],'raw':!![],'transaction':_0x264e82});})['then'](function(_0x524531){var _0x321e48=_[_0x9be2('0x31')](_0x524531,function(_0x1a4d9e){return Number(_0x1a4d9e['MailQueueId']);});return db[_0x9be2('0x5f')][_0x9be2('0x56')]({'where':{'UserId':{'$in':_0x51187d},'MailQueueId':{'$in':_0x321e48}},'transaction':_0x264e82});})[_0x9be2('0x2c')](function(){var _0xb8e239='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0xaf5e68;return db['sequelize'][_0x9be2('0x37')](_0xb8e239,{'type':db[_0x9be2('0x5a')][_0x9be2('0x5b')][_0x9be2('0x5e')],'raw':!![],'transaction':_0x264e82});})['then'](function(_0x71f7e){var _0x4b28d4=_['map'](_0x71f7e,function(_0x302f9d){return Number(_0x302f9d[_0x9be2('0x60')]);});return db[_0x9be2('0x61')][_0x9be2('0x56')]({'where':{'UserId':{'$in':_0x51187d},'SmsQueueId':{'$in':_0x4b28d4}},'transaction':_0x264e82});})['then'](function(){var _0x3d1520=_0x9be2('0x62')+_0xaf5e68;return db['sequelize'][_0x9be2('0x37')](_0x3d1520,{'type':db[_0x9be2('0x5a')][_0x9be2('0x5b')]['SELECT'],'raw':!![],'transaction':_0x264e82});})[_0x9be2('0x2c')](function(_0x481a88){var _0x18be07=_[_0x9be2('0x31')](_0x481a88,function(_0x451f3e){return Number(_0x451f3e['ChatQueueId']);});return db[_0x9be2('0x63')][_0x9be2('0x56')]({'where':{'UserId':{'$in':_0x51187d},'ChatQueueId':{'$in':_0x18be07}},'transaction':_0x264e82});})[_0x9be2('0x2c')](function(){var _0xa8ef01=_0x9be2('0x64')+_0xaf5e68;return db[_0x9be2('0x57')]['query'](_0xa8ef01,{'type':db[_0x9be2('0x5a')][_0x9be2('0x5b')][_0x9be2('0x5e')],'raw':!![],'transaction':_0x264e82});})[_0x9be2('0x2c')](function(_0x218092){var _0x190b10=_[_0x9be2('0x31')](_0x218092,function(_0x3f4369){return Number(_0x3f4369['FaxQueueId']);});return db[_0x9be2('0x65')][_0x9be2('0x56')]({'where':{'UserId':{'$in':_0x51187d},'FaxQueueId':{'$in':_0x190b10}},'transaction':_0x264e82});})['then'](function(){var _0x2d4084='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0xaf5e68;return db[_0x9be2('0x57')]['query'](_0x2d4084,{'type':db['Sequelize'][_0x9be2('0x5b')][_0x9be2('0x5e')],'raw':!![],'transaction':_0x264e82});})[_0x9be2('0x2c')](function(_0x1459d3){var _0xcd7648=_[_0x9be2('0x31')](_0x1459d3,function(_0x2e9eff){return Number(_0x2e9eff[_0x9be2('0x66')]);});return db[_0x9be2('0x67')]['destroy']({'where':{'UserId':{'$in':_0x51187d},'OpenchannelQueueId':{'$in':_0xcd7648}},'transaction':_0x264e82});})[_0x9be2('0x2c')](function(){var _0x5aff3a=_0x9be2('0x68')+_0xaf5e68;return db['sequelize'][_0x9be2('0x37')](_0x5aff3a,{'type':db[_0x9be2('0x5a')][_0x9be2('0x5b')]['SELECT'],'raw':!![],'transaction':_0x264e82});})[_0x9be2('0x2c')](function(_0x4cd010){var _0x530e17=_['map'](_0x4cd010,function(_0xac766f){return Number(_0xac766f[_0x9be2('0x69')]);});return db[_0x9be2('0x6a')][_0x9be2('0x56')]({'where':{'UserId':{'$in':_0x51187d},'WhatsappQueueId':{'$in':_0x530e17}},'transaction':_0x264e82});})[_0x9be2('0x2c')](function(){return db[_0x9be2('0x6b')][_0x9be2('0x49')]({'where':{'TeamId':_0xaf5e68}});})[_0x9be2('0x2c')](function(_0x3d2e02){if(_0x3d2e02===null){return;}return db['UserVoicePrefix'][_0x9be2('0x56')]({'where':{'UserId':{'$in':_0x51187d},'VoicePrefixId':_0x3d2e02[_0x9be2('0x6c')]},'transaction':_0x264e82});})[_0x9be2('0x2c')](function(){return db['Team'][_0x9be2('0x56')]({'where':{'id':_0xaf5e68},'cascade':!![],'transaction':_0x264e82});})[_0x9be2('0x2c')](function(_0xed25a6){if(_0xed25a6===0x0){_0x48f4d3['sendStatus'](0x194);}else{return db[_0x9be2('0x53')][_0x9be2('0x56')]({'where':{'type':'Teams','resourceId':_0xaf5e68},'cascade':!![],'transaction':_0x264e82})['then'](function(){_0x48f4d3[_0x9be2('0x1f')](0xcc)[_0x9be2('0x20')]();});}})[_0x9be2('0x54')](function(_0x38c21b){_0x48f4d3[_0x9be2('0x1f')](0x1f4)['send'](_0x38c21b);});});};exports[_0x9be2('0x6d')]=function(_0x55ecb7,_0x58d348,_0x478fd4){return db[_0x9be2('0x32')][_0x9be2('0x6e')]({'where':{'id':_0x55ecb7[_0x9be2('0x48')]['id']}})[_0x9be2('0x2c')](handleEntityNotFound(_0x58d348,null))['then'](function(_0x5fc861){if(!_0x55ecb7['query'][_0x9be2('0x6f')]||!utils[_0x9be2('0x70')](_0x55ecb7[_0x9be2('0x37')][_0x9be2('0x6f')])){throw new db[(_0x9be2('0x5a'))]['ValidationError']('Unknown\x20channel');}var _0x242608={};var _0x3fd76e={};_0x3fd76e['model']=_[_0x9be2('0x38')](db[_[_0x9be2('0x71')](_0x55ecb7['query']['channel'][_0x9be2('0x72')]())+'Queue']['rawAttributes']);_0x3fd76e[_0x9be2('0x37')]=_[_0x9be2('0x38')](_0x55ecb7[_0x9be2('0x37')]);_0x3fd76e[_0x9be2('0x40')]=_[_0x9be2('0x39')](_0x3fd76e[_0x9be2('0x36')],_0x3fd76e[_0x9be2('0x37')]);_0x242608[_0x9be2('0x3a')]=_['intersection'](_0x3fd76e[_0x9be2('0x36')],qs[_0x9be2('0x3b')](_0x55ecb7[_0x9be2('0x37')][_0x9be2('0x3b')]));_0x242608['attributes']=_0x242608['attributes']['length']?_0x242608[_0x9be2('0x3a')]:_0x3fd76e[_0x9be2('0x36')];_0x242608[_0x9be2('0x22')]=qs[_0x9be2('0x22')](_0x55ecb7[_0x9be2('0x37')]['limit']);_0x242608[_0x9be2('0x24')]=qs['offset'](_0x55ecb7['query'][_0x9be2('0x24')]);_0x242608[_0x9be2('0x73')]=qs[_0x9be2('0x3e')](_0x55ecb7[_0x9be2('0x37')][_0x9be2('0x3e')]);_0x242608[_0x9be2('0x3f')]=qs['filters'](_[_0x9be2('0x74')](_0x55ecb7['query'],_0x3fd76e[_0x9be2('0x40')]));_0x242608=_[_0x9be2('0x41')]({},_0x242608,_0x55ecb7['options']);return _0x5fc861['get'+_[_0x9be2('0x71')](_0x55ecb7[_0x9be2('0x37')][_0x9be2('0x6f')][_0x9be2('0x72')]())+_0x9be2('0x75')](_0x242608);})[_0x9be2('0x2c')](respondWithResult(_0x58d348,null))[_0x9be2('0x54')](handleError(_0x58d348,null));};exports[_0x9be2('0x76')]=function(_0x2bde47,_0x17d052,_0x13a2cf){return db[_0x9be2('0x32')][_0x9be2('0x6e')]({'where':{'id':_0x2bde47['params']['id']}})[_0x9be2('0x2c')](function(_0xe0fafc){if(_0xe0fafc){if(!_0x2bde47['body'][_0x9be2('0x6f')]||!utils[_0x9be2('0x70')](_0x2bde47[_0x9be2('0x55')][_0x9be2('0x6f')])){throw new db[(_0x9be2('0x5a'))][(_0x9be2('0x77'))](_0x9be2('0x78'));}return _0xe0fafc['add'+_[_0x9be2('0x71')](_0x2bde47[_0x9be2('0x55')][_0x9be2('0x6f')][_0x9be2('0x72')]())+'Queues'](_0x2bde47[_0x9be2('0x55')][_0x9be2('0x79')]);}return null;})[_0x9be2('0x2c')](handleEntityNotFound(_0x17d052,null))[_0x9be2('0x2c')](respondWithStatusCode(_0x17d052,null))[_0x9be2('0x54')](handleError(_0x17d052,null));};exports['removeQueues']=function(_0x23c566,_0x3d30fb,_0x55f5b0){return db[_0x9be2('0x32')][_0x9be2('0x6e')]({'where':{'id':_0x23c566[_0x9be2('0x48')]['id']}})[_0x9be2('0x2c')](function(_0x294455){if(_0x294455){if(!_0x23c566[_0x9be2('0x37')][_0x9be2('0x6f')]||!utils[_0x9be2('0x70')](_0x23c566[_0x9be2('0x37')][_0x9be2('0x6f')])){throw new db['Sequelize'][(_0x9be2('0x77'))](_0x9be2('0x78'));}return _0x294455['remove'+_['capitalize'](_0x23c566[_0x9be2('0x37')][_0x9be2('0x6f')][_0x9be2('0x72')]())+_0x9be2('0x75')](_0x23c566[_0x9be2('0x37')][_0x9be2('0x79')]);}return null;})[_0x9be2('0x2c')](handleEntityNotFound(_0x3d30fb,null))[_0x9be2('0x2c')](respondWithStatusCode(_0x3d30fb,null))[_0x9be2('0x54')](handleError(_0x3d30fb,null));};exports['addAgents']=function(_0x68dbfa,_0xd978bd){var _0x5e6999=_[_0x9be2('0x7a')](_0x68dbfa[_0x9be2('0x55')][_0x9be2('0x79')])?_0x68dbfa['body'][_0x9be2('0x79')]:[_0x68dbfa['body']['ids']];var _0x80c41d=_0x68dbfa[_0x9be2('0x48')]['id'];return db[_0x9be2('0x32')]['find']({'where':{'id':_0x80c41d}})[_0x9be2('0x2c')](handleEntityNotFound(_0xd978bd,null))[_0x9be2('0x2c')](function(_0x363ccb){if(_0x363ccb){var _0x2f02f2=[_0x9be2('0x7b'),_0x9be2('0x7c'),_0x9be2('0x7d'),_0x9be2('0x7e'),_0x9be2('0x7f'),_0x9be2('0x80'),'Whatsapp'];return db['sequelize'][_0x9be2('0x58')](function(_0x18d551){var _0x3f8ad5=_[_0x9be2('0x31')](_0x2f02f2,function(_0x19572e){var _0x19fca4={'attributes':['id',_0x9be2('0x2f')]};if(_0x19572e===_0x9be2('0x7b')){_0x19fca4['through']={'attributes':[_0x9be2('0x81')]};}return _0x363ccb['get'+_0x19572e+_0x9be2('0x75')](_0x19fca4)['then'](function(_0x131c39){var _0x38963c=_[_0x9be2('0x31')](_0x131c39,function(_0x4f8d73){var _0x452eba=_['map'](_0x5e6999,function(_0x23fa3d){var _0x4bd516={'where':{'UserId':_0x23fa3d,[_0x19572e+_0x9be2('0x82')]:_0x4f8d73['id']},'transaction':_0x18d551};if(_0x19572e===_0x9be2('0x7b')){_0x4bd516[_0x9be2('0x1a')]={'penalty':_0x4f8d73[_0x9be2('0x83')]['penalty']};}return db[_0x9be2('0x84')+_0x19572e+_0x9be2('0x85')][_0x9be2('0x86')](_0x4bd516)[_0x9be2('0x2c')](function(){socket[_0x9be2('0x87')](_0x9be2('0x4e')+_0x19572e+'Queue:save',{'UserId':_0x23fa3d,[_0x19572e+_0x9be2('0x82')]:_0x4f8d73['id']});if(_0x19572e!==_0x9be2('0x7b')){return;}return db[_0x9be2('0x84')]['findAll']({'where':{'id':_0x5e6999,'online':0x1},'attributes':['id',_0x9be2('0x2f'),_0x9be2('0x88'),_0x9be2('0x89'),_0x9be2('0x8a')],'raw':!![]})[_0x9be2('0x2c')](function(_0xcf4205){var _0x652162=_[_0x9be2('0x31')](_0xcf4205,function(_0x20627d){return db[_0x9be2('0x8b')]['upsert']({'membername':_0x20627d['name'],'UserId':_0x20627d['id'],'queue_name':_0x4f8d73['name'],'VoiceQueueId':_0x4f8d73['id'],'interface':_['isNil'](_0x20627d[_0x9be2('0x8a')])?util['format'](_0x9be2('0x8c'),_0x20627d[_0x9be2('0x2f')]):_0x20627d['interface'],'paused':_0x20627d[_0x9be2('0x89')]||![],'penalty':_0x4f8d73[_0x9be2('0x83')][_0x9be2('0x81')]},{'transaction':_0x18d551});});return Promise[_0x9be2('0x8d')](_0x652162);});});});return Promise['all'](_0x452eba);});return Promise[_0x9be2('0x8d')](_0x38963c);})['then'](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x80c41d}})['then'](function(_0x43c6d6){if(_0x43c6d6){var _0x5b8f74=_[_0x9be2('0x31')](_0x5e6999,function(_0x1a102a){db[_0x9be2('0x8e')]['upsert']({'UserId':_0x1a102a,'VoicePrefixId':_0x43c6d6[_0x9be2('0x6c')]});});return Promise[_0x9be2('0x8d')](_0x5b8f74);}});});});return Promise['all'](_0x3f8ad5)['then'](function(){return _0x363ccb[_0x9be2('0x8f')](_0x5e6999,{'transaction':_0x18d551})['spread'](function(_0x45e84d){return _0x45e84d;});});});}})[_0x9be2('0x2c')](respondWithResult(_0xd978bd,null))[_0x9be2('0x54')](handleError(_0xd978bd,null));};exports[_0x9be2('0x90')]=function(_0xb45516,_0x57fd58){var _0x1169f8=_['isArray'](_0xb45516[_0x9be2('0x37')][_0x9be2('0x79')])?_0xb45516[_0x9be2('0x37')][_0x9be2('0x79')]:[_0xb45516[_0x9be2('0x37')][_0x9be2('0x79')]];var _0x23b4dd=_0xb45516[_0x9be2('0x48')]['id'];return db['Team'][_0x9be2('0x49')]({'where':{'id':_0x23b4dd}})[_0x9be2('0x2c')](handleEntityNotFound(_0x57fd58,null))['then'](function(_0x35491e){if(_0x35491e){var _0x2bf70e=[_0x9be2('0x7b'),_0x9be2('0x7c'),_0x9be2('0x7d'),'Sms',_0x9be2('0x7f'),_0x9be2('0x80'),_0x9be2('0x91')];return db[_0x9be2('0x57')][_0x9be2('0x58')](function(_0xcf22c5){var _0x5741dd=_[_0x9be2('0x31')](_0x2bf70e,function(_0x25d24b){var _0x4542d9={'attributes':['id',_0x9be2('0x2f')]};return _0x35491e[_0x9be2('0x4b')+_0x25d24b+'Queues'](_0x4542d9)['then'](function(_0x235376){var _0x42e82e=_[_0x9be2('0x31')](_0x235376,function(_0x1d604f){return _0x1d604f[_0x9be2('0x90')](_0x1169f8,{'transaction':_0xcf22c5})[_0x9be2('0x2c')](function(){var _0x9e8b34=_[_0x9be2('0x31')](_0x1169f8,function(_0x4c0bb3){socket[_0x9be2('0x87')](_0x9be2('0x4e')+_0x25d24b+_0x9be2('0x92'),{'UserId':Number(_0x4c0bb3),[_0x25d24b+_0x9be2('0x82')]:_0x1d604f['id']});if(_0x25d24b!=='Voice'){return;}return db['UserVoiceQueueRt'][_0x9be2('0x56')]({'where':{'VoiceQueueId':_0x1d604f['id'],'UserId':_0x4c0bb3},'transaction':_0xcf22c5});});return Promise[_0x9be2('0x8d')](_0x9e8b34);});});return Promise[_0x9be2('0x8d')](_0x42e82e);});});return Promise[_0x9be2('0x8d')](_0x5741dd)[_0x9be2('0x2c')](function(){return _0x35491e['removeAgents'](_0x1169f8,{'transaction':_0xcf22c5});})[_0x9be2('0x2c')](function(){return db['TeamVoicePrefix'][_0x9be2('0x6e')]({'where':{'teamId':_0x23b4dd}})[_0x9be2('0x2c')](function(_0x90aa81){if(_0x90aa81){var _0x359579=_[_0x9be2('0x31')](_0x1169f8,function(_0xa87340){db[_0x9be2('0x8e')][_0x9be2('0x56')]({'where':{'UserId':_0xa87340,'VoicePrefixId':_0x90aa81['VoicePrefixId']}});});return Promise['all'](_0x359579);}});});});}})['then'](respondWithStatusCode(_0x57fd58,null))[_0x9be2('0x54')](handleError(_0x57fd58,null));};exports[_0x9be2('0x93')]=function(_0x24521b,_0x43f5e9,_0x3741dc){var _0x4e912c={};var _0x486508={};var _0x57b435;var _0x1deb02;return db['Team'][_0x9be2('0x6e')]({'where':{'id':_0x24521b[_0x9be2('0x48')]['id']}})[_0x9be2('0x2c')](handleEntityNotFound(_0x43f5e9,null))[_0x9be2('0x2c')](function(_0x1992d9){if(_0x1992d9){_0x57b435=_0x1992d9;_0x486508[_0x9be2('0x36')]=_['keys'](db[_0x9be2('0x84')][_0x9be2('0x33')]);_0x486508['query']=_[_0x9be2('0x38')](_0x24521b[_0x9be2('0x37')]);_0x486508[_0x9be2('0x40')]=_[_0x9be2('0x39')](_0x486508[_0x9be2('0x36')],_0x486508[_0x9be2('0x37')]);_0x4e912c['attributes']=_[_0x9be2('0x39')](_0x486508['model'],qs[_0x9be2('0x3b')](_0x24521b[_0x9be2('0x37')][_0x9be2('0x3b')]));_0x4e912c[_0x9be2('0x3a')]=_0x4e912c[_0x9be2('0x3a')][_0x9be2('0x3c')]?_0x4e912c[_0x9be2('0x3a')]:_0x486508[_0x9be2('0x36')];_0x4e912c[_0x9be2('0x73')]=qs[_0x9be2('0x3e')](_0x24521b[_0x9be2('0x37')][_0x9be2('0x3e')]);_0x4e912c[_0x9be2('0x3f')]=qs[_0x9be2('0x40')](_[_0x9be2('0x74')](_0x24521b[_0x9be2('0x37')],_0x486508['filters']));if(_0x24521b[_0x9be2('0x37')][_0x9be2('0x42')]){_0x4e912c['where']=_['merge'](_0x4e912c[_0x9be2('0x3f')],{'$or':_[_0x9be2('0x31')](_0x4e912c[_0x9be2('0x3a')],function(_0x3a0c21){var _0x605d4d={};_0x605d4d[_0x3a0c21]={'$like':'%'+_0x24521b[_0x9be2('0x37')][_0x9be2('0x42')]+'%'};return _0x605d4d;})});}_0x4e912c=_['merge']({},_0x4e912c,_0x24521b['options']);return _0x57b435[_0x9be2('0x93')](_0x4e912c);}})[_0x9be2('0x2c')](function(_0x14fca3){if(_0x14fca3){_0x1deb02=_0x14fca3['length'];if(!_0x24521b[_0x9be2('0x37')][_0x9be2('0x3d')](_0x9be2('0x94'))){_0x4e912c['limit']=qs['limit'](_0x24521b[_0x9be2('0x37')][_0x9be2('0x22')]);_0x4e912c['offset']=qs['offset'](_0x24521b[_0x9be2('0x37')][_0x9be2('0x24')]);}return _0x57b435['getAgents'](_0x4e912c);}})[_0x9be2('0x2c')](function(_0x470f44){if(_0x470f44){return _0x470f44?{'count':_0x1deb02,'rows':_0x470f44}:null;}})[_0x9be2('0x2c')](respondWithResult(_0x43f5e9,null))[_0x9be2('0x54')](handleError(_0x43f5e9,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 29995f9..e530ad9 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 _0x49f7=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','Team','setMaxListeners'];(function(_0x7c63d,_0x279a5e){var _0x41f935=function(_0x15fb42){while(--_0x15fb42){_0x7c63d['push'](_0x7c63d['shift']());}};_0x41f935(++_0x279a5e);}(_0x49f7,0x11c));var _0x749f=function(_0x836d32,_0x4acfff){_0x836d32=_0x836d32-0x0;var _0xe4d593=_0x49f7[_0x836d32];return _0xe4d593;};'use strict';var EventEmitter=require(_0x749f('0x0'));var Team=require(_0x749f('0x1'))['db'][_0x749f('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x749f('0x3')](0x0);var events={'afterCreate':_0x749f('0x4'),'afterUpdate':_0x749f('0x5'),'afterDestroy':_0x749f('0x6')};function emitEvent(_0x4283a9){return function(_0x55478b,_0x30dcaf,_0x1b33d6){TeamEvents['emit'](_0x4283a9+':'+_0x55478b['id'],_0x55478b);TeamEvents[_0x749f('0x7')](_0x4283a9,_0x55478b);_0x1b33d6(null);};}for(var e in events){if(events[_0x749f('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x0302=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team'];(function(_0x4316e6,_0x3ac3d0){var _0x50b65f=function(_0x4fd11c){while(--_0x4fd11c){_0x4316e6['push'](_0x4316e6['shift']());}};_0x50b65f(++_0x3ac3d0);}(_0x0302,0x81));var _0x2030=function(_0xf86996,_0x216c4b){_0xf86996=_0xf86996-0x0;var _0xa1f833=_0x0302[_0xf86996];return _0xa1f833;};'use strict';var EventEmitter=require(_0x2030('0x0'));var Team=require(_0x2030('0x1'))['db'][_0x2030('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x2030('0x3')](0x0);var events={'afterCreate':_0x2030('0x4'),'afterUpdate':_0x2030('0x5'),'afterDestroy':_0x2030('0x6')};function emitEvent(_0xa64369){return function(_0x3c78fb,_0x588ffc,_0x536f97){TeamEvents[_0x2030('0x7')](_0xa64369+':'+_0x3c78fb['id'],_0x3c78fb);TeamEvents[_0x2030('0x7')](_0xa64369,_0x3c78fb);_0x536f97(null);};}for(var e in events){if(events[_0x2030('0x8')](e)){var event=events[e];Team[_0x2030('0x9')](e,emitEvent(event));}}module[_0x2030('0xa')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index b37a0cf..39f8b29 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 _0xfe22=['setDataValue','channel','catch','define','teams','Chat','Fax','Openchannel','Sms','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues','map'];(function(_0x598b78,_0xf4ee7e){var _0x6392fa=function(_0x810353){while(--_0x810353){_0x598b78['push'](_0x598b78['shift']());}};_0x6392fa(++_0xf4ee7e);}(_0xfe22,0x12d));var _0x2fe2=function(_0x528fb9,_0x328d48){_0x528fb9=_0x528fb9-0x0;var _0x28c127=_0xfe22[_0x528fb9];return _0x28c127;};'use strict';var _=require(_0x2fe2('0x0'));var attributes=require(_0x2fe2('0x1'));function getQueuesByChannel(_0x412687,_0x44375){var _0x52d237=_0x2fe2('0x2')+_0x44375+_0x2fe2('0x3');return _0x412687[_0x52d237]()['then'](function(_0x23193d){return _[_0x2fe2('0x4')](_0x23193d,function(_0x136749){_0x136749[_0x2fe2('0x5')](_0x2fe2('0x6'),_0x44375);return _0x136749;});})[_0x2fe2('0x7')](function(_0x19e1a8){throw _0x19e1a8;});}module['exports']=function(_0x3b766b){return _0x3b766b[_0x2fe2('0x8')]('Team',attributes,{'tableName':_0x2fe2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x24f7ff=this;var _0x172343=[_0x2fe2('0xa'),_0x2fe2('0xb'),'Mail',_0x2fe2('0xc'),_0x2fe2('0xd'),'Voice',_0x2fe2('0xe')];return Promise[_0x2fe2('0xf')]()['then'](function(){var _0x5cf7e6=_[_0x2fe2('0x4')](_0x172343,function(_0x2c7575){return getQueuesByChannel(_0x24f7ff,_0x2c7575);});return Promise[_0x2fe2('0x10')](_0x5cf7e6);})['catch'](function(_0x2a8c66){throw _0x2a8c66;});}}});}; \ No newline at end of file +var _0xbfc9=['exports','define','Team','teams','Fax','Sms','Voice','Whatsapp','resolve','all','./team.attributes','get','Queues','map','channel','catch'];(function(_0x14ee67,_0x45c106){var _0x4c5553=function(_0x52f262){while(--_0x52f262){_0x14ee67['push'](_0x14ee67['shift']());}};_0x4c5553(++_0x45c106);}(_0xbfc9,0x1ca));var _0x9bfc=function(_0x1596e1,_0x2ef492){_0x1596e1=_0x1596e1-0x0;var _0x3b5f3c=_0xbfc9[_0x1596e1];return _0x3b5f3c;};'use strict';var _=require('lodash');var attributes=require(_0x9bfc('0x0'));function getQueuesByChannel(_0x3a7081,_0x221d39){var _0x56d122=_0x9bfc('0x1')+_0x221d39+_0x9bfc('0x2');return _0x3a7081[_0x56d122]()['then'](function(_0x31a82b){return _[_0x9bfc('0x3')](_0x31a82b,function(_0x5bd0cb){_0x5bd0cb['setDataValue'](_0x9bfc('0x4'),_0x221d39);return _0x5bd0cb;});})[_0x9bfc('0x5')](function(_0x359435){throw _0x359435;});}module[_0x9bfc('0x6')]=function(_0x3f7c21){return _0x3f7c21[_0x9bfc('0x7')](_0x9bfc('0x8'),attributes,{'tableName':_0x9bfc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5c9dd5=this;var _0x5f4919=['Chat',_0x9bfc('0xa'),'Mail','Openchannel',_0x9bfc('0xb'),_0x9bfc('0xc'),_0x9bfc('0xd')];return Promise[_0x9bfc('0xe')]()['then'](function(){var _0x569048=_[_0x9bfc('0x3')](_0x5f4919,function(_0x5cfe1d){return getQueuesByChannel(_0x5c9dd5,_0x5cfe1d);});return Promise[_0x9bfc('0xf')](_0x569048);})[_0x9bfc('0x5')](function(_0x3f7979){throw _0x3f7979;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 5ed2fb6..dfb81af 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 _0xbb4a=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./team.socket','request','then','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x51943a,_0x33d579){var _0x595c81=function(_0x24f18b){while(--_0x24f18b){_0x51943a['push'](_0x51943a['shift']());}};_0x595c81(++_0x33d579);}(_0xbb4a,0xb8));var _0xabb4=function(_0x490665,_0x2b22a1){_0x490665=_0x490665-0x0;var _0x18c9b2=_0xbb4a[_0x490665];return _0x18c9b2;};'use strict';var _=require(_0xabb4('0x0'));var util=require(_0xabb4('0x1'));var moment=require(_0xabb4('0x2'));var BPromise=require(_0xabb4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xabb4('0x4'));var db=require(_0xabb4('0x5'))['db'];var utils=require(_0xabb4('0x6'));var logger=require(_0xabb4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xabb4('0x8'));var client=jayson[_0xabb4('0x9')][_0xabb4('0xa')]({'port':0x232a});config[_0xabb4('0xb')]=_['defaults'](config[_0xabb4('0xb')],{'host':_0xabb4('0xc'),'port':0x18eb});var socket=require(_0xabb4('0xd'))(new Redis(config[_0xabb4('0xb')]));require(_0xabb4('0xe'))['register'](socket);function respondWithRpcPromise(_0x303b19,_0x591759,_0x3757ba){return new BPromise(function(_0x57802c,_0x569d34){return client[_0xabb4('0xf')](_0x303b19,_0x3757ba)[_0xabb4('0x10')](function(_0x30c117){logger['info'](_0xabb4('0x11'),_0x591759,_0xabb4('0x12'));logger['debug'](_0xabb4('0x13'),_0x591759,_0xabb4('0x12'),JSON['stringify'](_0x30c117));if(_0x30c117[_0xabb4('0x14')]){if(_0x30c117[_0xabb4('0x14')]['code']===0x1f4){logger[_0xabb4('0x14')](_0xabb4('0x11'),_0x591759,_0x30c117[_0xabb4('0x14')][_0xabb4('0x15')]);return _0x569d34(_0x30c117[_0xabb4('0x14')][_0xabb4('0x15')]);}logger['error'](_0xabb4('0x11'),_0x591759,_0x30c117[_0xabb4('0x14')][_0xabb4('0x15')]);return _0x57802c(_0x30c117[_0xabb4('0x14')][_0xabb4('0x15')]);}else{logger[_0xabb4('0x16')](_0xabb4('0x11'),_0x591759,'request\x20sent');_0x57802c(_0x30c117[_0xabb4('0x17')][_0xabb4('0x15')]);}})['catch'](function(_0x1348c5){logger[_0xabb4('0x14')](_0xabb4('0x11'),_0x591759,_0x1348c5);_0x569d34(_0x1348c5);});});} \ No newline at end of file +var _0x554f=['debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x3fa78a,_0x27775e){var _0x33bddd=function(_0x960ee6){while(--_0x960ee6){_0x3fa78a['push'](_0x3fa78a['shift']());}};_0x33bddd(++_0x27775e);}(_0x554f,0x1d2));var _0xf554=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x554f[_0x4063a4];return _0x17908d;};'use strict';var _=require('lodash');var util=require(_0xf554('0x0'));var moment=require(_0xf554('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf554('0x2'))['db'];var utils=require(_0xf554('0x3'));var logger=require('../../config/logger')(_0xf554('0x4'));var config=require(_0xf554('0x5'));var jayson=require(_0xf554('0x6'));var client=jayson[_0xf554('0x7')]['http']({'port':0x232a});config[_0xf554('0x8')]=_[_0xf554('0x9')](config[_0xf554('0x8')],{'host':_0xf554('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf554('0xb'))[_0xf554('0xc')](socket);function respondWithRpcPromise(_0x3a5347,_0x469684,_0x6c38f2){return new BPromise(function(_0x2cc73d,_0x13dfda){return client['request'](_0x3a5347,_0x6c38f2)[_0xf554('0xd')](function(_0x3b3930){logger[_0xf554('0xe')](_0xf554('0xf'),_0x469684,_0xf554('0x10'));logger[_0xf554('0x11')](_0xf554('0x12'),_0x469684,'request\x20sent',JSON['stringify'](_0x3b3930));if(_0x3b3930['error']){if(_0x3b3930[_0xf554('0x13')][_0xf554('0x14')]===0x1f4){logger[_0xf554('0x13')](_0xf554('0xf'),_0x469684,_0x3b3930[_0xf554('0x13')]['message']);return _0x13dfda(_0x3b3930[_0xf554('0x13')][_0xf554('0x15')]);}logger[_0xf554('0x13')](_0xf554('0xf'),_0x469684,_0x3b3930['error'][_0xf554('0x15')]);return _0x2cc73d(_0x3b3930[_0xf554('0x13')][_0xf554('0x15')]);}else{logger[_0xf554('0xe')](_0xf554('0xf'),_0x469684,_0xf554('0x10'));_0x2cc73d(_0x3b3930['result'][_0xf554('0x15')]);}})[_0xf554('0x16')](function(_0x8d0882){logger[_0xf554('0x13')](_0xf554('0xf'),_0x469684,_0x8d0882);_0x13dfda(_0x8d0882);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a901c89..0ff8ee3 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 _0xbac0=['./team.events','remove','update','removeListener','register','length','team:'];(function(_0x1258f1,_0x218b1e){var _0x166756=function(_0x3d2e1a){while(--_0x3d2e1a){_0x1258f1['push'](_0x1258f1['shift']());}};_0x166756(++_0x218b1e);}(_0xbac0,0x8c));var _0x0bac=function(_0x512980,_0x401e50){_0x512980=_0x512980-0x0;var _0x571f0a=_0xbac0[_0x512980];return _0x571f0a;};'use strict';var TeamEvents=require(_0x0bac('0x0'));var events=['save',_0x0bac('0x1'),_0x0bac('0x2')];function createListener(_0x3a4a0e,_0x191a58){return function(_0x34207c){_0x191a58['emit'](_0x3a4a0e,_0x34207c);};}function removeListener(_0x30db35,_0x468df6){return function(){TeamEvents[_0x0bac('0x3')](_0x30db35,_0x468df6);};}exports[_0x0bac('0x4')]=function(_0x19619c){for(var _0x4654e9=0x0,_0x2ad9ce=events[_0x0bac('0x5')];_0x4654e9<_0x2ad9ce;_0x4654e9++){var _0x1d6908=events[_0x4654e9];var _0x1838cb=createListener(_0x0bac('0x6')+_0x1d6908,_0x19619c);TeamEvents['on'](_0x1d6908,_0x1838cb);}}; \ No newline at end of file +var _0x4fd0=['./team.events','save','remove','update','emit','removeListener','register','length','team:'];(function(_0x2aaa61,_0x37b5cf){var _0x4c702f=function(_0x171cce){while(--_0x171cce){_0x2aaa61['push'](_0x2aaa61['shift']());}};_0x4c702f(++_0x37b5cf);}(_0x4fd0,0x1d4));var _0x04fd=function(_0x2d0ef5,_0x5621a4){_0x2d0ef5=_0x2d0ef5-0x0;var _0x550979=_0x4fd0[_0x2d0ef5];return _0x550979;};'use strict';var TeamEvents=require(_0x04fd('0x0'));var events=[_0x04fd('0x1'),_0x04fd('0x2'),_0x04fd('0x3')];function createListener(_0x5a8fed,_0x138198){return function(_0x333635){_0x138198[_0x04fd('0x4')](_0x5a8fed,_0x333635);};}function removeListener(_0x435647,_0x2e09d4){return function(){TeamEvents[_0x04fd('0x5')](_0x435647,_0x2e09d4);};}exports[_0x04fd('0x6')]=function(_0x159ae9){for(var _0x3aadac=0x0,_0x28a5f1=events[_0x04fd('0x7')];_0x3aadac<_0x28a5f1;_0x3aadac++){var _0x5f0be9=events[_0x3aadac];var _0x3e33c5=createListener(_0x04fd('0x8')+_0x5f0be9,_0x159ae9);TeamEvents['on'](_0x5f0be9,_0x3e33c5);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 026bbcd..958bed1 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6655=['sequelize'];(function(_0x766097,_0x34c5da){var _0x4eae83=function(_0x167f96){while(--_0x167f96){_0x766097['push'](_0x766097['shift']());}};_0x4eae83(++_0x34c5da);}(_0x6655,0x193));var _0x5665=function(_0x437fa3,_0xd8692e){_0x437fa3=_0x437fa3-0x0;var _0x205382=_0x6655[_0x437fa3];return _0x205382;};'use strict';var Sequelize=require(_0x5665('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xce25=['INTEGER'];(function(_0x3c1892,_0x2f4cd0){var _0x5dc4e6=function(_0x3c466d){while(--_0x3c466d){_0x3c1892['push'](_0x3c1892['shift']());}};_0x5dc4e6(++_0x2f4cd0);}(_0xce25,0x196));var _0x5ce2=function(_0x8f9f66,_0x5073e9){_0x8f9f66=_0x8f9f66-0x0;var _0x43567d=_0xce25[_0x8f9f66];return _0x43567d;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0x5ce2('0x0')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index c45ec39..f6c025d 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d31=['./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x42b5d3,_0x349abc){var _0x6555f=function(_0xf0d0bd){while(--_0xf0d0bd){_0x42b5d3['push'](_0x42b5d3['shift']());}};_0x6555f(++_0x349abc);}(_0x5d31,0xf7));var _0x15d3=function(_0x545f6d,_0x16c27e){_0x545f6d=_0x545f6d-0x0;var _0x594012=_0x5d31[_0x545f6d];return _0x594012;};'use strict';var _=require('lodash');var util=require(_0x15d3('0x0'));var logger=require(_0x15d3('0x1'))(_0x15d3('0x2'));var moment=require('moment');var BPromise=require(_0x15d3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x15d3('0x4'));var config=require(_0x15d3('0x5'));var attributes=require(_0x15d3('0x6'));module[_0x15d3('0x7')]=function(_0x5ebd77,_0x8448c4){return _0x5ebd77[_0x15d3('0x8')](_0x15d3('0x9'),attributes,{'tableName':_0x15d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6629=['lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','define','team_has_voice_prefixes'];(function(_0x3f578f,_0x51f172){var _0x32c754=function(_0x1bd873){while(--_0x1bd873){_0x3f578f['push'](_0x3f578f['shift']());}};_0x32c754(++_0x51f172);}(_0x6629,0x1c2));var _0x9662=function(_0x4d94e9,_0x2f193f){_0x4d94e9=_0x4d94e9-0x0;var _0xc6e4bf=_0x6629[_0x4d94e9];return _0xc6e4bf;};'use strict';var _=require(_0x9662('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9662('0x1'));var moment=require(_0x9662('0x2'));var BPromise=require(_0x9662('0x3'));var rp=require(_0x9662('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9662('0x5'));var config=require(_0x9662('0x6'));var attributes=require(_0x9662('0x7'));module['exports']=function(_0x32db20,_0x39be49){return _0x32db20[_0x9662('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x9662('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index b614b1e..675e08a 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xb25694,_0x1ae3df){var _0x380ae0=function(_0x252816){while(--_0x252816){_0xb25694['push'](_0xb25694['shift']());}};_0x380ae0(++_0x1ae3df);}(_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(_0x4a9eda,_0x359a8c){var _0x40059a=function(_0x9cda24){while(--_0x9cda24){_0x4a9eda['push'](_0x4a9eda['shift']());}};_0x40059a(++_0x359a8c);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index bc3460a..5a6aafd 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 _0x2c8c=['exports','INTEGER','sequelize'];(function(_0x24b3fd,_0x3d7922){var _0x5bebf4=function(_0x39dfdc){while(--_0x39dfdc){_0x24b3fd['push'](_0x24b3fd['shift']());}};_0x5bebf4(++_0x3d7922);}(_0x2c8c,0x10d));var _0xc2c8=function(_0x218f41,_0x561e02){_0x218f41=_0x218f41-0x0;var _0x59453c=_0x2c8c[_0x218f41];return _0x59453c;};'use strict';var Sequelize=require(_0xc2c8('0x0'));module[_0xc2c8('0x1')]={'penalty':{'type':Sequelize[_0xc2c8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9970=['exports','INTEGER'];(function(_0xbf8ec1,_0x9169c8){var _0xc84567=function(_0x509094){while(--_0x509094){_0xbf8ec1['push'](_0xbf8ec1['shift']());}};_0xc84567(++_0x9169c8);}(_0x9970,0x1e2));var _0x0997=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x9970[_0xbe200f];return _0x192597;};'use strict';var Sequelize=require('sequelize');module[_0x0997('0x0')]={'penalty':{'type':Sequelize[_0x0997('0x1')],'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 b9a7d95..4a37210 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 _0xa1db=['request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x159927,_0x28f94f){var _0xb955ea=function(_0x1d21a1){while(--_0x1d21a1){_0x159927['push'](_0x159927['shift']());}};_0xb955ea(++_0x28f94f);}(_0xa1db,0xb0));var _0xba1d=function(_0x571714,_0x30d2b3){_0x571714=_0x571714-0x0;var _0x599a14=_0xa1db[_0x571714];return _0x599a14;};'use strict';var _=require(_0xba1d('0x0'));var util=require(_0xba1d('0x1'));var logger=require(_0xba1d('0x2'))(_0xba1d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba1d('0x4'));var fs=require('fs');var path=require(_0xba1d('0x5'));var rimraf=require('rimraf');var config=require(_0xba1d('0x6'));var attributes=require(_0xba1d('0x7'));module[_0xba1d('0x8')]=function(_0xf79440,_0xea5887){return _0xf79440[_0xba1d('0x9')](_0xba1d('0xa'),attributes,{'tableName':_0xba1d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89e8=['moment','bluebird','request-promise','path','exports','TeamVoiceQueue','lodash','util','../../config/logger','api'];(function(_0x8cf63c,_0x4286be){var _0x460f07=function(_0x3cdbf8){while(--_0x3cdbf8){_0x8cf63c['push'](_0x8cf63c['shift']());}};_0x460f07(++_0x4286be);}(_0x89e8,0x74));var _0x889e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x89e8[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x889e('0x0'));var util=require(_0x889e('0x1'));var logger=require(_0x889e('0x2'))(_0x889e('0x3'));var moment=require(_0x889e('0x4'));var BPromise=require(_0x889e('0x5'));var rp=require(_0x889e('0x6'));var fs=require('fs');var path=require(_0x889e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module[_0x889e('0x8')]=function(_0x293daf,_0x25f9e2){return _0x293daf['define'](_0x889e('0x9'),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 541ec18..ffc149c 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 _0x98fc=['http','request','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x98fc,0x156));var _0xc98f=function(_0x325673,_0x13c10b){_0x325673=_0x325673-0x0;var _0x741c5b=_0x98fc[_0x325673];return _0x741c5b;};'use strict';var _=require(_0xc98f('0x0'));var util=require(_0xc98f('0x1'));var moment=require(_0xc98f('0x2'));var BPromise=require(_0xc98f('0x3'));var rs=require(_0xc98f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc98f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc98f('0x6'))('rpc');var config=require(_0xc98f('0x7'));var jayson=require(_0xc98f('0x8'));var client=jayson[_0xc98f('0x9')][_0xc98f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3237e1,_0x1a8812,_0x28f276){return new BPromise(function(_0x191b3f,_0x12bdba){return client[_0xc98f('0xb')](_0x3237e1,_0x28f276)['then'](function(_0xb21d1a){logger['info'](_0xc98f('0xc'),_0x1a8812,_0xc98f('0xd'));logger[_0xc98f('0xe')](_0xc98f('0xf'),_0x1a8812,_0xc98f('0xd'),JSON['stringify'](_0xb21d1a));if(_0xb21d1a['error']){if(_0xb21d1a[_0xc98f('0x10')][_0xc98f('0x11')]===0x1f4){logger[_0xc98f('0x10')](_0xc98f('0xc'),_0x1a8812,_0xb21d1a[_0xc98f('0x10')]['message']);return _0x12bdba(_0xb21d1a[_0xc98f('0x10')][_0xc98f('0x12')]);}logger['error'](_0xc98f('0xc'),_0x1a8812,_0xb21d1a[_0xc98f('0x10')][_0xc98f('0x12')]);return _0x191b3f(_0xb21d1a[_0xc98f('0x10')][_0xc98f('0x12')]);}else{logger[_0xc98f('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1a8812,_0xc98f('0xd'));_0x191b3f(_0xb21d1a[_0xc98f('0x14')]['message']);}})[_0xc98f('0x15')](function(_0x5ef39c){logger[_0xc98f('0x10')](_0xc98f('0xc'),_0x1a8812,_0x5ef39c);_0x12bdba(_0x5ef39c);});});} \ No newline at end of file +var _0x6d4e=['../../config/environment','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x366359,_0x416a92){var _0x4a52d7=function(_0x56389c){while(--_0x56389c){_0x366359['push'](_0x366359['shift']());}};_0x4a52d7(++_0x416a92);}(_0x6d4e,0x12e));var _0xe6d4=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x6d4e[_0xbc346f];return _0x9f9260;};'use strict';var _=require(_0xe6d4('0x0'));var util=require(_0xe6d4('0x1'));var moment=require(_0xe6d4('0x2'));var BPromise=require(_0xe6d4('0x3'));var rs=require(_0xe6d4('0x4'));var fs=require('fs');var Redis=require(_0xe6d4('0x5'));var db=require(_0xe6d4('0x6'))['db'];var utils=require(_0xe6d4('0x7'));var logger=require(_0xe6d4('0x8'))(_0xe6d4('0x9'));var config=require(_0xe6d4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe6d4('0xb')][_0xe6d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e56b2,_0x25397f,_0x1c5205){return new BPromise(function(_0x90a6e0,_0x1390c8){return client[_0xe6d4('0xd')](_0x5e56b2,_0x1c5205)[_0xe6d4('0xe')](function(_0x28c7ed){logger[_0xe6d4('0xf')](_0xe6d4('0x10'),_0x25397f,'request\x20sent');logger[_0xe6d4('0x11')](_0xe6d4('0x12'),_0x25397f,_0xe6d4('0x13'),JSON[_0xe6d4('0x14')](_0x28c7ed));if(_0x28c7ed['error']){if(_0x28c7ed['error'][_0xe6d4('0x15')]===0x1f4){logger['error'](_0xe6d4('0x10'),_0x25397f,_0x28c7ed['error'][_0xe6d4('0x16')]);return _0x1390c8(_0x28c7ed[_0xe6d4('0x17')][_0xe6d4('0x16')]);}logger[_0xe6d4('0x17')](_0xe6d4('0x10'),_0x25397f,_0x28c7ed[_0xe6d4('0x17')][_0xe6d4('0x16')]);return _0x90a6e0(_0x28c7ed[_0xe6d4('0x17')][_0xe6d4('0x16')]);}else{logger[_0xe6d4('0xf')](_0xe6d4('0x10'),_0x25397f,'request\x20sent');_0x90a6e0(_0x28c7ed[_0xe6d4('0x18')][_0xe6d4('0x16')]);}})[_0xe6d4('0x19')](function(_0x20e83a){logger[_0xe6d4('0x17')](_0xe6d4('0x10'),_0x25397f,_0x20e83a);_0x1390c8(_0x20e83a);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 8fa07c1..29aa35e 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 _0xf3a8=['delete','exports','util','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x41697f,_0x57f881){var _0x186d5c=function(_0x57e4a0){while(--_0x57e4a0){_0x41697f['push'](_0x41697f['shift']());}};_0x186d5c(++_0x57f881);}(_0xf3a8,0xf2));var _0x8f3a=function(_0x116019,_0x546193){_0x116019=_0x116019-0x0;var _0x5d37a4=_0xf3a8[_0x116019];return _0x5d37a4;};'use strict';var multer=require('multer');var util=require(_0x8f3a('0x0'));var path=require(_0x8f3a('0x1'));var timeout=require('connect-timeout');var express=require(_0x8f3a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8f3a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8f3a('0x4'));var controller=require('./template.controller');router[_0x8f3a('0x5')]('/',auth[_0x8f3a('0x6')](),controller[_0x8f3a('0x7')]);router[_0x8f3a('0x5')](_0x8f3a('0x8'),auth[_0x8f3a('0x6')](),controller[_0x8f3a('0x9')]);router[_0x8f3a('0xa')]('/',auth[_0x8f3a('0x6')](),controller['create']);router[_0x8f3a('0xb')]('/:id',auth[_0x8f3a('0x6')](),controller[_0x8f3a('0xc')]);router[_0x8f3a('0xd')](_0x8f3a('0x8'),auth[_0x8f3a('0x6')](),controller['destroy']);module[_0x8f3a('0xe')]=router; \ No newline at end of file +var _0xd5f9=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','show','post','create','put','isAuthenticated','delete','destroy','exports','multer','util','path'];(function(_0x1c4c5a,_0x51c650){var _0x48fea6=function(_0x39aea6){while(--_0x39aea6){_0x1c4c5a['push'](_0x1c4c5a['shift']());}};_0x48fea6(++_0x51c650);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x34533,_0x531aeb){_0x34533=_0x34533-0x0;var _0x5810ff=_0xd5f9[_0x34533];return _0x5810ff;};'use strict';var multer=require(_0x9d5f('0x0'));var util=require(_0x9d5f('0x1'));var path=require(_0x9d5f('0x2'));var timeout=require(_0x9d5f('0x3'));var express=require('express');var router=express[_0x9d5f('0x4')]();var fs_extra=require(_0x9d5f('0x5'));var auth=require(_0x9d5f('0x6'));var interaction=require(_0x9d5f('0x7'));var config=require(_0x9d5f('0x8'));var controller=require(_0x9d5f('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9d5f('0xa')](_0x9d5f('0xb'),auth['isAuthenticated'](),controller[_0x9d5f('0xc')]);router[_0x9d5f('0xd')]('/',auth['isAuthenticated'](),controller[_0x9d5f('0xe')]);router[_0x9d5f('0xf')]('/:id',auth[_0x9d5f('0x10')](),controller['update']);router[_0x9d5f('0x11')](_0x9d5f('0xb'),auth[_0x9d5f('0x10')](),controller[_0x9d5f('0x12')]);module[_0x9d5f('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 66d7a96..93aed9a 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 _0x6fd0=['sequelize','exports'];(function(_0x12d812,_0x496bb7){var _0x3711ab=function(_0x3259da){while(--_0x3259da){_0x12d812['push'](_0x12d812['shift']());}};_0x3711ab(++_0x496bb7);}(_0x6fd0,0x174));var _0x06fd=function(_0x1444f5,_0x2a7978){_0x1444f5=_0x1444f5-0x0;var _0x3fc0ca=_0x6fd0[_0x1444f5];return _0x3fc0ca;};'use strict';var Sequelize=require(_0x06fd('0x0'));module[_0x06fd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf842=['TEXT','sequelize','exports','STRING'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0xf842,0x161));var _0x2f84=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xf842[_0x44a64f];return _0x52024b;};'use strict';var Sequelize=require(_0x2f84('0x0'));module[_0x2f84('0x1')]={'name':{'type':Sequelize[_0x2f84('0x2')]},'description':{'type':Sequelize[_0x2f84('0x2')]},'html':{'type':Sequelize[_0x2f84('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 875ea74..88583d1 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 _0x3b0b=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','Template','rawAttributes','type','key','model','map','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x22ce5b,_0x5a2e74){var _0x1c506f=function(_0x3f1479){while(--_0x3f1479){_0x22ce5b['push'](_0x22ce5b['shift']());}};_0x1c506f(++_0x5a2e74);}(_0x3b0b,0xd3));var _0xb3b0=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x3b0b[_0x3ab9ee];return _0x82ee88;};'use strict';var emlformat=require(_0xb3b0('0x0'));var rimraf=require(_0xb3b0('0x1'));var zipdir=require(_0xb3b0('0x2'));var jsonpatch=require(_0xb3b0('0x3'));var rp=require(_0xb3b0('0x4'));var moment=require(_0xb3b0('0x5'));var BPromise=require(_0xb3b0('0x6'));var Mustache=require(_0xb3b0('0x7'));var util=require(_0xb3b0('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xb3b0('0x9'));var ejs=require(_0xb3b0('0xa'));var fs=require('fs');var fs_extra=require(_0xb3b0('0xb'));var _=require(_0xb3b0('0xc'));var squel=require(_0xb3b0('0xd'));var crypto=require(_0xb3b0('0xe'));var jsforce=require(_0xb3b0('0xf'));var deskjs=require(_0xb3b0('0x10'));var toCsv=require(_0xb3b0('0x9'));var querystring=require(_0xb3b0('0x11'));var Papa=require(_0xb3b0('0x12'));var Redis=require(_0xb3b0('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb3b0('0x14'));var hardwareService=require(_0xb3b0('0x15'));var logger=require(_0xb3b0('0x16'))(_0xb3b0('0x17'));var utils=require('../../config/utils');var config=require(_0xb3b0('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3b0('0x19'))['db'];function respondWithStatusCode(_0x210f2d,_0x26f17b){_0x26f17b=_0x26f17b||0xcc;return function(_0x27e3b3){if(_0x27e3b3){return _0x210f2d[_0xb3b0('0x1a')](_0x26f17b);}return _0x210f2d[_0xb3b0('0x1b')](_0x26f17b)[_0xb3b0('0x1c')]();};}function respondWithResult(_0x1e4f66,_0x3c3ed4){_0x3c3ed4=_0x3c3ed4||0xc8;return function(_0x1d6a5b){if(_0x1d6a5b){return _0x1e4f66[_0xb3b0('0x1b')](_0x3c3ed4)[_0xb3b0('0x1d')](_0x1d6a5b);}};}function respondWithFilteredResult(_0x5cc776,_0x5065be){return function(_0x150abc){if(_0x150abc){var _0x170c5e=typeof _0x5065be[_0xb3b0('0x1e')]===_0xb3b0('0x1f')&&typeof _0x5065be['limit']===_0xb3b0('0x1f');var _0x154eeb=_0x150abc[_0xb3b0('0x20')];var _0x2b2f2b=_0x170c5e?0x0:_0x5065be['offset'];var _0xc9b057=_0x170c5e?_0x150abc[_0xb3b0('0x20')]:_0x5065be[_0xb3b0('0x1e')]+_0x5065be[_0xb3b0('0x21')];var _0x1ecd33;if(_0xc9b057>=_0x154eeb){_0xc9b057=_0x154eeb;_0x1ecd33=0xc8;}else{_0x1ecd33=0xce;}_0x5cc776[_0xb3b0('0x1b')](_0x1ecd33);return _0x5cc776[_0xb3b0('0x22')](_0xb3b0('0x23'),_0x2b2f2b+'-'+_0xc9b057+'/'+_0x154eeb)['json'](_0x150abc);}return null;};}function patchUpdates(_0x1b7714){return function(_0x57a96d){try{jsonpatch[_0xb3b0('0x24')](_0x57a96d,_0x1b7714,!![]);}catch(_0x2cc67e){return BPromise[_0xb3b0('0x25')](_0x2cc67e);}return _0x57a96d['save']();};}function saveUpdates(_0x183e06,_0x82b1f7){return function(_0x3c3654){if(_0x3c3654){return _0x3c3654[_0xb3b0('0x26')](_0x183e06)[_0xb3b0('0x27')](function(_0xe4fae3){return _0xe4fae3;});}return null;};}function removeEntity(_0x5ebab5,_0x4f41cb){return function(_0x832899){if(_0x832899){return _0x832899[_0xb3b0('0x28')]()[_0xb3b0('0x27')](function(){var _0x1de927=_0x832899[_0xb3b0('0x29')]({'plain':!![]});var _0x4bcbb6=_0xb3b0('0x2a');return db[_0xb3b0('0x2b')]['destroy']({'where':{'type':_0x4bcbb6,'resourceId':_0x1de927['id']}})[_0xb3b0('0x27')](function(){return _0x832899;});})['then'](function(){_0x5ebab5[_0xb3b0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d50c4,_0x555959){return function(_0x2ef8d1){if(!_0x2ef8d1){_0x3d50c4[_0xb3b0('0x1a')](0x194);}return _0x2ef8d1;};}function handleError(_0x4489a8,_0x12ad07){_0x12ad07=_0x12ad07||0x1f4;return function(_0x174695){logger[_0xb3b0('0x2c')](_0x174695[_0xb3b0('0x2d')]);if(_0x174695[_0xb3b0('0x2e')]){delete _0x174695['name'];}_0x4489a8[_0xb3b0('0x1b')](_0x12ad07)['send'](_0x174695);};}exports['index']=function(_0x1abdb4,_0x1ca7f7){var _0x4fa3e7={},_0x311a02={},_0x564dc6={'count':0x0,'rows':[]};var _0x4dd267=_['map'](db[_0xb3b0('0x2f')][_0xb3b0('0x30')],function(_0x5237e4){return{'name':_0x5237e4['fieldName'],'type':_0x5237e4[_0xb3b0('0x31')][_0xb3b0('0x32')]};});_0x311a02[_0xb3b0('0x33')]=_[_0xb3b0('0x34')](_0x4dd267,_0xb3b0('0x2e'));_0x311a02[_0xb3b0('0x35')]=_['keys'](_0x1abdb4[_0xb3b0('0x35')]);_0x311a02['filters']=_['intersection'](_0x311a02[_0xb3b0('0x33')],_0x311a02[_0xb3b0('0x35')]);_0x4fa3e7['attributes']=_[_0xb3b0('0x36')](_0x311a02[_0xb3b0('0x33')],qs[_0xb3b0('0x37')](_0x1abdb4[_0xb3b0('0x35')][_0xb3b0('0x37')]));_0x4fa3e7['attributes']=_0x4fa3e7[_0xb3b0('0x38')]['length']?_0x4fa3e7[_0xb3b0('0x38')]:_0x311a02['model'];if(!_0x1abdb4[_0xb3b0('0x35')]['hasOwnProperty'](_0xb3b0('0x39'))){_0x4fa3e7[_0xb3b0('0x21')]=qs[_0xb3b0('0x21')](_0x1abdb4['query'][_0xb3b0('0x21')]);_0x4fa3e7[_0xb3b0('0x1e')]=qs['offset'](_0x1abdb4[_0xb3b0('0x35')]['offset']);}_0x4fa3e7[_0xb3b0('0x3a')]=qs[_0xb3b0('0x3b')](_0x1abdb4[_0xb3b0('0x35')][_0xb3b0('0x3b')]);_0x4fa3e7[_0xb3b0('0x3c')]=qs[_0xb3b0('0x3d')](_[_0xb3b0('0x3e')](_0x1abdb4['query'],_0x311a02['filters']),_0x4dd267);if(_0x1abdb4[_0xb3b0('0x35')][_0xb3b0('0x3f')]){_0x4fa3e7['where']=_['merge'](_0x4fa3e7[_0xb3b0('0x3c')],{'$or':_[_0xb3b0('0x34')](_0x4dd267,function(_0x332024){if(_0x332024[_0xb3b0('0x31')]!==_0xb3b0('0x40')){var _0x412e49={};_0x412e49[_0x332024[_0xb3b0('0x2e')]]={'$like':'%'+_0x1abdb4['query'][_0xb3b0('0x3f')]+'%'};return _0x412e49;}})});}_0x4fa3e7=_[_0xb3b0('0x41')]({},_0x4fa3e7,_0x1abdb4['options']);var _0x361724={'where':_0x4fa3e7[_0xb3b0('0x3c')]};return db[_0xb3b0('0x2f')][_0xb3b0('0x20')](_0x361724)['then'](function(_0x3320f8){_0x564dc6[_0xb3b0('0x20')]=_0x3320f8;if(_0x1abdb4[_0xb3b0('0x35')][_0xb3b0('0x42')]){_0x4fa3e7[_0xb3b0('0x43')]=[{'all':!![]}];}return db[_0xb3b0('0x2f')][_0xb3b0('0x44')](_0x4fa3e7);})[_0xb3b0('0x27')](function(_0x2bee35){_0x564dc6[_0xb3b0('0x45')]=_0x2bee35;return _0x564dc6;})[_0xb3b0('0x27')](respondWithFilteredResult(_0x1ca7f7,_0x4fa3e7))['catch'](handleError(_0x1ca7f7,null));};exports['show']=function(_0x11eaab,_0x5c9d26){var _0x1b07e0={'raw':!![],'where':{'id':_0x11eaab[_0xb3b0('0x46')]['id']}},_0x521b24={};_0x521b24[_0xb3b0('0x33')]=_['keys'](db[_0xb3b0('0x2f')][_0xb3b0('0x30')]);_0x521b24['query']=_['keys'](_0x11eaab[_0xb3b0('0x35')]);_0x521b24[_0xb3b0('0x3d')]=_[_0xb3b0('0x36')](_0x521b24[_0xb3b0('0x33')],_0x521b24[_0xb3b0('0x35')]);_0x1b07e0[_0xb3b0('0x38')]=_[_0xb3b0('0x36')](_0x521b24[_0xb3b0('0x33')],qs['fields'](_0x11eaab[_0xb3b0('0x35')][_0xb3b0('0x37')]));_0x1b07e0[_0xb3b0('0x38')]=_0x1b07e0['attributes']['length']?_0x1b07e0['attributes']:_0x521b24['model'];if(_0x11eaab[_0xb3b0('0x35')]['includeAll']){_0x1b07e0[_0xb3b0('0x43')]=[{'all':!![]}];}_0x1b07e0=_['merge']({},_0x1b07e0,_0x11eaab['options']);return db[_0xb3b0('0x2f')][_0xb3b0('0x47')](_0x1b07e0)[_0xb3b0('0x27')](handleEntityNotFound(_0x5c9d26,null))[_0xb3b0('0x27')](respondWithResult(_0x5c9d26,null))['catch'](handleError(_0x5c9d26,null));};exports[_0xb3b0('0x48')]=function(_0x5e2045,_0x2fa558){return db['Template'][_0xb3b0('0x48')](_0x5e2045['body'],{})['then'](function(_0x22b89b){var _0x2884a9=_0x5e2045[_0xb3b0('0x49')]['get']({'plain':!![]});if(!_0x2884a9)throw new Error(_0xb3b0('0x4a'));if(_0x2884a9['role']==='user'){var _0x8510c=_0x22b89b[_0xb3b0('0x29')]({'plain':!![]});var _0x143888=_0xb3b0('0x2a');return db[_0xb3b0('0x4b')][_0xb3b0('0x47')]({'where':{'name':_0x143888,'userProfileId':_0x2884a9[_0xb3b0('0x4c')]},'raw':!![]})[_0xb3b0('0x27')](function(_0x5a0acd){if(_0x5a0acd&&_0x5a0acd['autoAssociation']===0x0){return db[_0xb3b0('0x2b')]['create']({'name':_0x8510c[_0xb3b0('0x2e')],'resourceId':_0x8510c['id'],'type':_0x5a0acd[_0xb3b0('0x2e')],'sectionId':_0x5a0acd['id']},{})['then'](function(){return _0x22b89b;});}else{return _0x22b89b;}})['catch'](function(_0x1cedbb){logger['error'](_0xb3b0('0x4d'),_0x1cedbb);throw _0x1cedbb;});}return _0x22b89b;})['then'](respondWithResult(_0x2fa558,0xc9))['catch'](handleError(_0x2fa558,null));};exports['update']=function(_0x28ff36,_0x187da3){if(_0x28ff36['body']['id']){delete _0x28ff36[_0xb3b0('0x4e')]['id'];}return db[_0xb3b0('0x2f')]['find']({'where':{'id':_0x28ff36[_0xb3b0('0x46')]['id']}})[_0xb3b0('0x27')](handleEntityNotFound(_0x187da3,null))[_0xb3b0('0x27')](saveUpdates(_0x28ff36[_0xb3b0('0x4e')],null))[_0xb3b0('0x27')](respondWithResult(_0x187da3,null))[_0xb3b0('0x4f')](handleError(_0x187da3,null));};exports[_0xb3b0('0x28')]=function(_0x393e3d,_0x5501a8){return db['Template'][_0xb3b0('0x47')]({'where':{'id':_0x393e3d[_0xb3b0('0x46')]['id']}})[_0xb3b0('0x27')](handleEntityNotFound(_0x5501a8,null))['then'](removeEntity(_0x5501a8,null))['catch'](handleError(_0x5501a8,null));}; \ No newline at end of file +var _0xeaf9=['mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','json','reject','save','then','destroy','get','Templates','end','error','stack','name','send','index','map','Template','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','params','eml-format','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x176d77,_0x261968){var _0x34a0c9=function(_0xd5a0c7){while(--_0xd5a0c7){_0x176d77['push'](_0x176d77['shift']());}};_0x34a0c9(++_0x261968);}(_0xeaf9,0xee));var _0x9eaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeaf9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9eaf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9eaf('0x1'));var jsonpatch=require(_0x9eaf('0x2'));var rp=require('request-promise');var moment=require(_0x9eaf('0x3'));var BPromise=require(_0x9eaf('0x4'));var Mustache=require(_0x9eaf('0x5'));var util=require(_0x9eaf('0x6'));var path=require('path');var sox=require(_0x9eaf('0x7'));var csv=require('to-csv');var ejs=require(_0x9eaf('0x8'));var fs=require('fs');var fs_extra=require(_0x9eaf('0x9'));var _=require(_0x9eaf('0xa'));var squel=require(_0x9eaf('0xb'));var crypto=require(_0x9eaf('0xc'));var jsforce=require(_0x9eaf('0xd'));var deskjs=require(_0x9eaf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9eaf('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9eaf('0x10'));var qs=require(_0x9eaf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9eaf('0x12'));var logger=require(_0x9eaf('0x13'))(_0x9eaf('0x14'));var utils=require(_0x9eaf('0x15'));var config=require(_0x9eaf('0x16'));var licenseUtil=require(_0x9eaf('0x17'));var db=require(_0x9eaf('0x18'))['db'];function respondWithStatusCode(_0x491ad3,_0x198fdb){_0x198fdb=_0x198fdb||0xcc;return function(_0x1ca5b0){if(_0x1ca5b0){return _0x491ad3[_0x9eaf('0x19')](_0x198fdb);}return _0x491ad3[_0x9eaf('0x1a')](_0x198fdb)['end']();};}function respondWithResult(_0x23af04,_0x5d3f12){_0x5d3f12=_0x5d3f12||0xc8;return function(_0x30c677){if(_0x30c677){return _0x23af04[_0x9eaf('0x1a')](_0x5d3f12)['json'](_0x30c677);}};}function respondWithFilteredResult(_0x581d89,_0x545849){return function(_0x1c7bc6){if(_0x1c7bc6){var _0xf3254c=typeof _0x545849['offset']===_0x9eaf('0x1b')&&typeof _0x545849[_0x9eaf('0x1c')]===_0x9eaf('0x1b');var _0x136b0f=_0x1c7bc6[_0x9eaf('0x1d')];var _0x21dc7d=_0xf3254c?0x0:_0x545849[_0x9eaf('0x1e')];var _0x408b19=_0xf3254c?_0x1c7bc6[_0x9eaf('0x1d')]:_0x545849[_0x9eaf('0x1e')]+_0x545849[_0x9eaf('0x1c')];var _0x46be66;if(_0x408b19>=_0x136b0f){_0x408b19=_0x136b0f;_0x46be66=0xc8;}else{_0x46be66=0xce;}_0x581d89[_0x9eaf('0x1a')](_0x46be66);return _0x581d89[_0x9eaf('0x1f')]('Content-Range',_0x21dc7d+'-'+_0x408b19+'/'+_0x136b0f)[_0x9eaf('0x20')](_0x1c7bc6);}return null;};}function patchUpdates(_0x55e69b){return function(_0x149221){try{jsonpatch['apply'](_0x149221,_0x55e69b,!![]);}catch(_0x187c82){return BPromise[_0x9eaf('0x21')](_0x187c82);}return _0x149221[_0x9eaf('0x22')]();};}function saveUpdates(_0xf05db0,_0x1f2d6d){return function(_0x30e44f){if(_0x30e44f){return _0x30e44f['update'](_0xf05db0)[_0x9eaf('0x23')](function(_0x19b559){return _0x19b559;});}return null;};}function removeEntity(_0x2c662b,_0x248103){return function(_0x540a1d){if(_0x540a1d){return _0x540a1d[_0x9eaf('0x24')]()[_0x9eaf('0x23')](function(){var _0x3ab485=_0x540a1d[_0x9eaf('0x25')]({'plain':!![]});var _0xdbf7e4=_0x9eaf('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0xdbf7e4,'resourceId':_0x3ab485['id']}})['then'](function(){return _0x540a1d;});})[_0x9eaf('0x23')](function(){_0x2c662b[_0x9eaf('0x1a')](0xcc)[_0x9eaf('0x27')]();});}};}function handleEntityNotFound(_0x3286c0,_0x57392b){return function(_0x8d672c){if(!_0x8d672c){_0x3286c0['sendStatus'](0x194);}return _0x8d672c;};}function handleError(_0x154d8b,_0x20c488){_0x20c488=_0x20c488||0x1f4;return function(_0x109b57){logger[_0x9eaf('0x28')](_0x109b57[_0x9eaf('0x29')]);if(_0x109b57[_0x9eaf('0x2a')]){delete _0x109b57[_0x9eaf('0x2a')];}_0x154d8b['status'](_0x20c488)[_0x9eaf('0x2b')](_0x109b57);};}exports[_0x9eaf('0x2c')]=function(_0x403bb9,_0x746b06){var _0x7952cc={},_0x43baa6={},_0x47ed8c={'count':0x0,'rows':[]};var _0x3cea9b=_[_0x9eaf('0x2d')](db[_0x9eaf('0x2e')][_0x9eaf('0x2f')],function(_0x1693a9){return{'name':_0x1693a9['fieldName'],'type':_0x1693a9[_0x9eaf('0x30')][_0x9eaf('0x31')]};});_0x43baa6[_0x9eaf('0x32')]=_[_0x9eaf('0x2d')](_0x3cea9b,_0x9eaf('0x2a'));_0x43baa6[_0x9eaf('0x33')]=_[_0x9eaf('0x34')](_0x403bb9[_0x9eaf('0x33')]);_0x43baa6[_0x9eaf('0x35')]=_[_0x9eaf('0x36')](_0x43baa6[_0x9eaf('0x32')],_0x43baa6[_0x9eaf('0x33')]);_0x7952cc[_0x9eaf('0x37')]=_[_0x9eaf('0x36')](_0x43baa6[_0x9eaf('0x32')],qs[_0x9eaf('0x38')](_0x403bb9[_0x9eaf('0x33')][_0x9eaf('0x38')]));_0x7952cc[_0x9eaf('0x37')]=_0x7952cc[_0x9eaf('0x37')][_0x9eaf('0x39')]?_0x7952cc['attributes']:_0x43baa6[_0x9eaf('0x32')];if(!_0x403bb9[_0x9eaf('0x33')][_0x9eaf('0x3a')]('nolimit')){_0x7952cc[_0x9eaf('0x1c')]=qs[_0x9eaf('0x1c')](_0x403bb9[_0x9eaf('0x33')][_0x9eaf('0x1c')]);_0x7952cc[_0x9eaf('0x1e')]=qs[_0x9eaf('0x1e')](_0x403bb9[_0x9eaf('0x33')][_0x9eaf('0x1e')]);}_0x7952cc['order']=qs[_0x9eaf('0x3b')](_0x403bb9[_0x9eaf('0x33')][_0x9eaf('0x3b')]);_0x7952cc[_0x9eaf('0x3c')]=qs[_0x9eaf('0x35')](_[_0x9eaf('0x3d')](_0x403bb9[_0x9eaf('0x33')],_0x43baa6[_0x9eaf('0x35')]),_0x3cea9b);if(_0x403bb9[_0x9eaf('0x33')][_0x9eaf('0x3e')]){_0x7952cc[_0x9eaf('0x3c')]=_[_0x9eaf('0x3f')](_0x7952cc[_0x9eaf('0x3c')],{'$or':_[_0x9eaf('0x2d')](_0x3cea9b,function(_0x5723be){if(_0x5723be[_0x9eaf('0x30')]!==_0x9eaf('0x40')){var _0x54001d={};_0x54001d[_0x5723be['name']]={'$like':'%'+_0x403bb9[_0x9eaf('0x33')][_0x9eaf('0x3e')]+'%'};return _0x54001d;}})});}_0x7952cc=_[_0x9eaf('0x3f')]({},_0x7952cc,_0x403bb9[_0x9eaf('0x41')]);var _0x593f0c={'where':_0x7952cc[_0x9eaf('0x3c')]};return db[_0x9eaf('0x2e')][_0x9eaf('0x1d')](_0x593f0c)[_0x9eaf('0x23')](function(_0x2194cd){_0x47ed8c[_0x9eaf('0x1d')]=_0x2194cd;if(_0x403bb9[_0x9eaf('0x33')]['includeAll']){_0x7952cc[_0x9eaf('0x42')]=[{'all':!![]}];}return db[_0x9eaf('0x2e')][_0x9eaf('0x43')](_0x7952cc);})[_0x9eaf('0x23')](function(_0x3e4a26){_0x47ed8c[_0x9eaf('0x44')]=_0x3e4a26;return _0x47ed8c;})[_0x9eaf('0x23')](respondWithFilteredResult(_0x746b06,_0x7952cc))[_0x9eaf('0x45')](handleError(_0x746b06,null));};exports[_0x9eaf('0x46')]=function(_0xad1306,_0x56ec2d){var _0x57dca1={'raw':!![],'where':{'id':_0xad1306['params']['id']}},_0x3549ea={};_0x3549ea[_0x9eaf('0x32')]=_[_0x9eaf('0x34')](db[_0x9eaf('0x2e')][_0x9eaf('0x2f')]);_0x3549ea[_0x9eaf('0x33')]=_[_0x9eaf('0x34')](_0xad1306[_0x9eaf('0x33')]);_0x3549ea[_0x9eaf('0x35')]=_['intersection'](_0x3549ea['model'],_0x3549ea['query']);_0x57dca1[_0x9eaf('0x37')]=_['intersection'](_0x3549ea[_0x9eaf('0x32')],qs[_0x9eaf('0x38')](_0xad1306[_0x9eaf('0x33')][_0x9eaf('0x38')]));_0x57dca1[_0x9eaf('0x37')]=_0x57dca1[_0x9eaf('0x37')][_0x9eaf('0x39')]?_0x57dca1['attributes']:_0x3549ea[_0x9eaf('0x32')];if(_0xad1306[_0x9eaf('0x33')][_0x9eaf('0x47')]){_0x57dca1[_0x9eaf('0x42')]=[{'all':!![]}];}_0x57dca1=_['merge']({},_0x57dca1,_0xad1306[_0x9eaf('0x41')]);return db[_0x9eaf('0x2e')][_0x9eaf('0x48')](_0x57dca1)[_0x9eaf('0x23')](handleEntityNotFound(_0x56ec2d,null))[_0x9eaf('0x23')](respondWithResult(_0x56ec2d,null))[_0x9eaf('0x45')](handleError(_0x56ec2d,null));};exports[_0x9eaf('0x49')]=function(_0x2d7423,_0x23781b){return db[_0x9eaf('0x2e')]['create'](_0x2d7423[_0x9eaf('0x4a')],{})[_0x9eaf('0x23')](function(_0x437eab){var _0x221cef=_0x2d7423[_0x9eaf('0x4b')][_0x9eaf('0x25')]({'plain':!![]});if(!_0x221cef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x221cef[_0x9eaf('0x4c')]===_0x9eaf('0x4b')){var _0x17811f=_0x437eab['get']({'plain':!![]});var _0x500f0c=_0x9eaf('0x26');return db[_0x9eaf('0x4d')][_0x9eaf('0x48')]({'where':{'name':_0x500f0c,'userProfileId':_0x221cef['userProfileId']},'raw':!![]})[_0x9eaf('0x23')](function(_0x13804a){if(_0x13804a&&_0x13804a[_0x9eaf('0x4e')]===0x0){return db[_0x9eaf('0x4f')][_0x9eaf('0x49')]({'name':_0x17811f['name'],'resourceId':_0x17811f['id'],'type':_0x13804a[_0x9eaf('0x2a')],'sectionId':_0x13804a['id']},{})['then'](function(){return _0x437eab;});}else{return _0x437eab;}})['catch'](function(_0x31bda6){logger[_0x9eaf('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31bda6);throw _0x31bda6;});}return _0x437eab;})[_0x9eaf('0x23')](respondWithResult(_0x23781b,0xc9))[_0x9eaf('0x45')](handleError(_0x23781b,null));};exports['update']=function(_0x4b3f28,_0x3ae5c2){if(_0x4b3f28[_0x9eaf('0x4a')]['id']){delete _0x4b3f28['body']['id'];}return db[_0x9eaf('0x2e')][_0x9eaf('0x48')]({'where':{'id':_0x4b3f28[_0x9eaf('0x50')]['id']}})['then'](handleEntityNotFound(_0x3ae5c2,null))[_0x9eaf('0x23')](saveUpdates(_0x4b3f28[_0x9eaf('0x4a')],null))[_0x9eaf('0x23')](respondWithResult(_0x3ae5c2,null))['catch'](handleError(_0x3ae5c2,null));};exports[_0x9eaf('0x24')]=function(_0x25e456,_0x1fc878){return db[_0x9eaf('0x2e')][_0x9eaf('0x48')]({'where':{'id':_0x25e456[_0x9eaf('0x50')]['id']}})['then'](handleEntityNotFound(_0x1fc878,null))[_0x9eaf('0x23')](removeEntity(_0x1fc878,null))['catch'](handleError(_0x1fc878,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index bbb5878..a251fb2 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 _0xf633=['define','Template','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0xf633,0xde));var _0x3f63=function(_0x2cf0bf,_0x4c171f){_0x2cf0bf=_0x2cf0bf-0x0;var _0x644f3d=_0xf633[_0x2cf0bf];return _0x644f3d;};'use strict';var _=require('lodash');var util=require(_0x3f63('0x0'));var logger=require(_0x3f63('0x1'))(_0x3f63('0x2'));var moment=require(_0x3f63('0x3'));var BPromise=require(_0x3f63('0x4'));var rp=require(_0x3f63('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f63('0x6'));var config=require(_0x3f63('0x7'));var attributes=require('./template.attributes');module[_0x3f63('0x8')]=function(_0x591c23,_0x359db7){return _0x591c23[_0x3f63('0x9')](_0x3f63('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79d2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','tools_templates','lodash','../../config/logger','api'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x79d2,0xe1));var _0x279d=function(_0x573ea2,_0x1517e4){_0x573ea2=_0x573ea2-0x0;var _0x2dc6ab=_0x79d2[_0x573ea2];return _0x2dc6ab;};'use strict';var _=require(_0x279d('0x0'));var util=require('util');var logger=require(_0x279d('0x1'))(_0x279d('0x2'));var moment=require(_0x279d('0x3'));var BPromise=require(_0x279d('0x4'));var rp=require(_0x279d('0x5'));var fs=require('fs');var path=require(_0x279d('0x6'));var rimraf=require(_0x279d('0x7'));var config=require(_0x279d('0x8'));var attributes=require(_0x279d('0x9'));module[_0x279d('0xa')]=function(_0x33bd1d,_0x52db93){return _0x33bd1d['define']('Template',attributes,{'tableName':_0x279d('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 5da7d2e..d747131 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 _0x71f6=['rpc','../../config/environment','jayson/promise','client','then','info','Template,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Template','findAll','options','raw','where','attributes','map','include','model','GetTemplate','debug','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1d8e01,_0x284e45){var _0xe9df31=function(_0x3f3382){while(--_0x3f3382){_0x1d8e01['push'](_0x1d8e01['shift']());}};_0xe9df31(++_0x284e45);}(_0x71f6,0x1ac));var _0x671f=function(_0x33bbe1,_0x2906c8){_0x33bbe1=_0x33bbe1-0x0;var _0x3dd600=_0x71f6[_0x33bbe1];return _0x3dd600;};'use strict';var _=require('lodash');var util=require(_0x671f('0x0'));var moment=require('moment');var BPromise=require(_0x671f('0x1'));var rs=require(_0x671f('0x2'));var fs=require('fs');var Redis=require(_0x671f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x671f('0x4'));var logger=require(_0x671f('0x5'))(_0x671f('0x6'));var config=require(_0x671f('0x7'));var jayson=require(_0x671f('0x8'));var client=jayson[_0x671f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4afb37,_0x10006b,_0x45e591){return new BPromise(function(_0x15922c,_0x16a5af){return client['request'](_0x4afb37,_0x45e591)[_0x671f('0xa')](function(_0x337ebd){logger[_0x671f('0xb')](_0x671f('0xc'),_0x10006b,_0x671f('0xd'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x10006b,_0x671f('0xd'),JSON[_0x671f('0xe')](_0x337ebd));if(_0x337ebd[_0x671f('0xf')]){if(_0x337ebd['error'][_0x671f('0x10')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x10006b,_0x337ebd[_0x671f('0xf')]['message']);return _0x16a5af(_0x337ebd['error'][_0x671f('0x11')]);}logger[_0x671f('0xf')](_0x671f('0xc'),_0x10006b,_0x337ebd[_0x671f('0xf')]['message']);return _0x15922c(_0x337ebd[_0x671f('0xf')][_0x671f('0x11')]);}else{logger[_0x671f('0xb')]('Template,\x20%s,\x20%s',_0x10006b,'request\x20sent');_0x15922c(_0x337ebd[_0x671f('0x12')][_0x671f('0x11')]);}})[_0x671f('0x13')](function(_0xb502df){logger[_0x671f('0xf')](_0x671f('0xc'),_0x10006b,_0xb502df);_0x16a5af(_0xb502df);});});}exports['GetTemplate']=function(_0x4e2010){var _0x347cc4=this;return new Promise(function(_0x5b1204,_0x4419de){return db[_0x671f('0x14')][_0x671f('0x15')]({'raw':_0x4e2010['options']?_0x4e2010[_0x671f('0x16')][_0x671f('0x17')]===undefined?!![]:![]:!![],'where':_0x4e2010['options']?_0x4e2010[_0x671f('0x16')][_0x671f('0x18')]||null:null,'attributes':_0x4e2010[_0x671f('0x16')]?_0x4e2010[_0x671f('0x16')][_0x671f('0x19')]||null:null,'limit':_0x4e2010[_0x671f('0x16')]?_0x4e2010[_0x671f('0x16')]['limit']||null:null,'include':_0x4e2010[_0x671f('0x16')]?_0x4e2010['options']['include']?_[_0x671f('0x1a')](_0x4e2010[_0x671f('0x16')][_0x671f('0x1b')],function(_0x3ef6de){return{'model':db[_0x3ef6de[_0x671f('0x1c')]],'as':_0x3ef6de['as'],'attributes':_0x3ef6de['attributes'],'include':_0x3ef6de[_0x671f('0x1b')]?_[_0x671f('0x1a')](_0x3ef6de[_0x671f('0x1b')],function(_0x2b3530){return{'model':db[_0x2b3530['model']],'as':_0x2b3530['as'],'attributes':_0x2b3530[_0x671f('0x19')],'include':_0x2b3530[_0x671f('0x1b')]?_[_0x671f('0x1a')](_0x2b3530[_0x671f('0x1b')],function(_0x3dc38e){return{'model':db[_0x3dc38e[_0x671f('0x1c')]],'as':_0x3dc38e['as'],'attributes':_0x3dc38e[_0x671f('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10c8cc){logger['info'](_0x671f('0x1d'),_0x4e2010);logger[_0x671f('0x1e')](_0x671f('0x1d'),_0x4e2010,JSON[_0x671f('0xe')](_0x10c8cc));_0x5b1204(_0x10c8cc);})['catch'](function(_0x2279cf){logger[_0x671f('0xf')](_0x671f('0x1d'),_0x2279cf[_0x671f('0x11')],_0x4e2010);_0x4419de(_0x347cc4['error'](0x1f4,_0x2279cf[_0x671f('0x11')]));});});}; \ No newline at end of file +var _0xa0d9=['util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','info','result','findAll','options','raw','where','attributes','limit','include','map','model','GetTemplate','stringify','catch','lodash'];(function(_0x25f3e3,_0x207891){var _0xa89b6d=function(_0xa51f2){while(--_0xa51f2){_0x25f3e3['push'](_0x25f3e3['shift']());}};_0xa89b6d(++_0x207891);}(_0xa0d9,0x19f));var _0x9a0d=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0xa0d9[_0x33ebf5];return _0x66957b;};'use strict';var _=require(_0x9a0d('0x0'));var util=require(_0x9a0d('0x1'));var moment=require(_0x9a0d('0x2'));var BPromise=require(_0x9a0d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a0d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a0d('0x5'));var logger=require('../../config/logger')(_0x9a0d('0x6'));var config=require(_0x9a0d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9a0d('0x8')][_0x9a0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc4ce8f,_0x37dfb8,_0x435b0f){return new BPromise(function(_0xfdbdf,_0x5804ba){return client['request'](_0xc4ce8f,_0x435b0f)[_0x9a0d('0xa')](function(_0x577212){logger['info'](_0x9a0d('0xb'),_0x37dfb8,_0x9a0d('0xc'));logger[_0x9a0d('0xd')](_0x9a0d('0xe'),_0x37dfb8,_0x9a0d('0xc'),JSON['stringify'](_0x577212));if(_0x577212[_0x9a0d('0xf')]){if(_0x577212['error'][_0x9a0d('0x10')]===0x1f4){logger[_0x9a0d('0xf')](_0x9a0d('0xb'),_0x37dfb8,_0x577212[_0x9a0d('0xf')][_0x9a0d('0x11')]);return _0x5804ba(_0x577212[_0x9a0d('0xf')][_0x9a0d('0x11')]);}logger[_0x9a0d('0xf')](_0x9a0d('0xb'),_0x37dfb8,_0x577212[_0x9a0d('0xf')][_0x9a0d('0x11')]);return _0xfdbdf(_0x577212[_0x9a0d('0xf')][_0x9a0d('0x11')]);}else{logger[_0x9a0d('0x12')]('Template,\x20%s,\x20%s',_0x37dfb8,'request\x20sent');_0xfdbdf(_0x577212[_0x9a0d('0x13')][_0x9a0d('0x11')]);}})['catch'](function(_0x190b0f){logger[_0x9a0d('0xf')]('Template,\x20%s,\x20%s',_0x37dfb8,_0x190b0f);_0x5804ba(_0x190b0f);});});}exports['GetTemplate']=function(_0x4a157d){var _0x5d5770=this;return new Promise(function(_0x231731,_0x27409b){return db['Template'][_0x9a0d('0x14')]({'raw':_0x4a157d['options']?_0x4a157d[_0x9a0d('0x15')][_0x9a0d('0x16')]===undefined?!![]:![]:!![],'where':_0x4a157d[_0x9a0d('0x15')]?_0x4a157d[_0x9a0d('0x15')][_0x9a0d('0x17')]||null:null,'attributes':_0x4a157d['options']?_0x4a157d['options'][_0x9a0d('0x18')]||null:null,'limit':_0x4a157d['options']?_0x4a157d['options'][_0x9a0d('0x19')]||null:null,'include':_0x4a157d[_0x9a0d('0x15')]?_0x4a157d[_0x9a0d('0x15')][_0x9a0d('0x1a')]?_[_0x9a0d('0x1b')](_0x4a157d[_0x9a0d('0x15')][_0x9a0d('0x1a')],function(_0x406c48){return{'model':db[_0x406c48[_0x9a0d('0x1c')]],'as':_0x406c48['as'],'attributes':_0x406c48['attributes'],'include':_0x406c48['include']?_[_0x9a0d('0x1b')](_0x406c48[_0x9a0d('0x1a')],function(_0x2e2cdd){return{'model':db[_0x2e2cdd[_0x9a0d('0x1c')]],'as':_0x2e2cdd['as'],'attributes':_0x2e2cdd['attributes'],'include':_0x2e2cdd[_0x9a0d('0x1a')]?_['map'](_0x2e2cdd[_0x9a0d('0x1a')],function(_0x2b3f44){return{'model':db[_0x2b3f44[_0x9a0d('0x1c')]],'as':_0x2b3f44['as'],'attributes':_0x2b3f44[_0x9a0d('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3aa22f){logger[_0x9a0d('0x12')](_0x9a0d('0x1d'),_0x4a157d);logger['debug'](_0x9a0d('0x1d'),_0x4a157d,JSON[_0x9a0d('0x1e')](_0x3aa22f));_0x231731(_0x3aa22f);})[_0x9a0d('0x1f')](function(_0x5dc307){logger[_0x9a0d('0xf')](_0x9a0d('0x1d'),_0x5dc307[_0x9a0d('0x11')],_0x4a157d);_0x27409b(_0x5d5770[_0x9a0d('0xf')](0x1f4,_0x5dc307[_0x9a0d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 55d025a..4a1bcc7 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 _0xbd7b=['/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAnyCondition','put','update','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x532421,_0x3a77fd){var _0x1ed7db=function(_0x4fccff){while(--_0x4fccff){_0x532421['push'](_0x532421['shift']());}};_0x1ed7db(++_0x3a77fd);}(_0xbd7b,0x1ec));var _0xbbd7=function(_0x59ac29,_0x2e4a05){_0x59ac29=_0x59ac29-0x0;var _0x8976f1=_0xbd7b[_0x59ac29];return _0x8976f1;};'use strict';var multer=require('multer');var util=require(_0xbbd7('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbbd7('0x1'));var router=express[_0xbbd7('0x2')]();var fs_extra=require(_0xbbd7('0x3'));var auth=require(_0xbbd7('0x4'));var interaction=require(_0xbbd7('0x5'));var config=require(_0xbbd7('0x6'));var controller=require('./trigger.controller');router[_0xbbd7('0x7')]('/',auth[_0xbbd7('0x8')](),controller[_0xbbd7('0x9')]);router[_0xbbd7('0x7')](_0xbbd7('0xa'),auth[_0xbbd7('0x8')](),controller[_0xbbd7('0xb')]);router[_0xbbd7('0x7')](_0xbbd7('0xc'),auth['isAuthenticated'](),controller[_0xbbd7('0xd')]);router[_0xbbd7('0x7')](_0xbbd7('0xe'),auth[_0xbbd7('0x8')](),controller[_0xbbd7('0xf')]);router[_0xbbd7('0x7')](_0xbbd7('0x10'),auth[_0xbbd7('0x8')](),controller['getActions']);router[_0xbbd7('0x11')]('/',auth[_0xbbd7('0x8')](),controller[_0xbbd7('0x12')]);router[_0xbbd7('0x11')](_0xbbd7('0xc'),auth[_0xbbd7('0x8')](),controller[_0xbbd7('0x13')]);router[_0xbbd7('0x11')](_0xbbd7('0xe'),auth['isAuthenticated'](),controller[_0xbbd7('0x14')]);router[_0xbbd7('0x11')](_0xbbd7('0x10'),auth['isAuthenticated'](),controller['addAction']);router[_0xbbd7('0x15')](_0xbbd7('0xa'),auth[_0xbbd7('0x8')](),controller[_0xbbd7('0x16')]);router['delete'](_0xbbd7('0xa'),auth['isAuthenticated'](),controller[_0xbbd7('0x17')]);module['exports']=router; \ No newline at end of file +var _0x2fee=['./trigger.controller','get','index','/:id','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAnyCondition','addAction','put','update','exports','multer','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x110d3f,_0x9750b6){var _0x56fc95=function(_0x2a27a1){while(--_0x2a27a1){_0x110d3f['push'](_0x110d3f['shift']());}};_0x56fc95(++_0x9750b6);}(_0x2fee,0x11a));var _0xe2fe=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0x2fee[_0x3f88bc];return _0x4df1c4;};'use strict';var multer=require(_0xe2fe('0x0'));var util=require('util');var path=require(_0xe2fe('0x1'));var timeout=require('connect-timeout');var express=require(_0xe2fe('0x2'));var router=express['Router']();var fs_extra=require(_0xe2fe('0x3'));var auth=require(_0xe2fe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe2fe('0x5'));var controller=require(_0xe2fe('0x6'));router[_0xe2fe('0x7')]('/',auth['isAuthenticated'](),controller[_0xe2fe('0x8')]);router[_0xe2fe('0x7')](_0xe2fe('0x9'),auth[_0xe2fe('0xa')](),controller[_0xe2fe('0xb')]);router[_0xe2fe('0x7')]('/:id/all_conditions',auth[_0xe2fe('0xa')](),controller[_0xe2fe('0xc')]);router['get'](_0xe2fe('0xd'),auth[_0xe2fe('0xa')](),controller[_0xe2fe('0xe')]);router[_0xe2fe('0x7')](_0xe2fe('0xf'),auth[_0xe2fe('0xa')](),controller[_0xe2fe('0x10')]);router[_0xe2fe('0x11')]('/',auth[_0xe2fe('0xa')](),controller[_0xe2fe('0x12')]);router[_0xe2fe('0x11')]('/:id/all_conditions',auth[_0xe2fe('0xa')](),controller['addAllCondition']);router[_0xe2fe('0x11')]('/:id/any_conditions',auth[_0xe2fe('0xa')](),controller[_0xe2fe('0x13')]);router[_0xe2fe('0x11')](_0xe2fe('0xf'),auth['isAuthenticated'](),controller[_0xe2fe('0x14')]);router[_0xe2fe('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xe2fe('0x16')]);router['delete']('/:id',auth[_0xe2fe('0xa')](),controller['destroy']);module[_0xe2fe('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 70c572f..c5e0e6b 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 _0x3715=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3940eb,_0x599fc7){var _0x3203c3=function(_0x41e343){while(--_0x41e343){_0x3940eb['push'](_0x3940eb['shift']());}};_0x3203c3(++_0x599fc7);}(_0x3715,0x120));var _0x5371=function(_0x29de15,_0x3d0db1){_0x29de15=_0x29de15-0x0;var _0x2e5c7e=_0x3715[_0x29de15];return _0x2e5c7e;};'use strict';var Sequelize=require(_0x5371('0x0'));module[_0x5371('0x1')]={'name':{'type':Sequelize[_0x5371('0x2')]},'channel':{'type':Sequelize[_0x5371('0x2')]},'description':{'type':Sequelize[_0x5371('0x2')]},'status':{'type':Sequelize[_0x5371('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa6d1=['STRING','BOOLEAN','sequelize','exports'];(function(_0x56c15f,_0x1fa5e2){var _0x371744=function(_0x2903e5){while(--_0x2903e5){_0x56c15f['push'](_0x56c15f['shift']());}};_0x371744(++_0x1fa5e2);}(_0xa6d1,0x1ae));var _0x1a6d=function(_0x141c05,_0x319076){_0x141c05=_0x141c05-0x0;var _0x25fa28=_0xa6d1[_0x141c05];return _0x25fa28;};'use strict';var Sequelize=require(_0x1a6d('0x0'));module[_0x1a6d('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1a6d('0x2')]},'description':{'type':Sequelize[_0x1a6d('0x2')]},'status':{'type':Sequelize[_0x1a6d('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index d59875f..25f03e1 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 _0xb224=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','TriggerAnyId','Condition','getAllConditions','findOne','getAnyConditions','options','addAction','Action','getActions','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','get','Triggers','UserProfileResource','destroy','end','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','includeAll','findAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId'];(function(_0x5e6780,_0x1a070d){var _0x37f90f=function(_0x5657bc){while(--_0x5657bc){_0x5e6780['push'](_0x5e6780['shift']());}};_0x37f90f(++_0x1a070d);}(_0xb224,0x191));var _0x4b22=function(_0x20b53c,_0x16a59d){_0x20b53c=_0x20b53c-0x0;var _0x439595=_0xb224[_0x20b53c];return _0x439595;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b22('0x0'));var zipdir=require(_0x4b22('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b22('0x2'));var moment=require(_0x4b22('0x3'));var BPromise=require(_0x4b22('0x4'));var Mustache=require(_0x4b22('0x5'));var util=require(_0x4b22('0x6'));var path=require(_0x4b22('0x7'));var sox=require(_0x4b22('0x8'));var csv=require(_0x4b22('0x9'));var ejs=require(_0x4b22('0xa'));var fs=require('fs');var fs_extra=require(_0x4b22('0xb'));var _=require(_0x4b22('0xc'));var squel=require(_0x4b22('0xd'));var crypto=require(_0x4b22('0xe'));var jsforce=require(_0x4b22('0xf'));var deskjs=require(_0x4b22('0x10'));var toCsv=require(_0x4b22('0x9'));var querystring=require(_0x4b22('0x11'));var Papa=require(_0x4b22('0x12'));var Redis=require(_0x4b22('0x13'));var authService=require(_0x4b22('0x14'));var qs=require(_0x4b22('0x15'));var as=require(_0x4b22('0x16'));var hardwareService=require(_0x4b22('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4b22('0x18'));var licenseUtil=require(_0x4b22('0x19'));var db=require(_0x4b22('0x1a'))['db'];function respondWithStatusCode(_0x2883ce,_0x28bedf){_0x28bedf=_0x28bedf||0xcc;return function(_0x2f3b62){if(_0x2f3b62){return _0x2883ce[_0x4b22('0x1b')](_0x28bedf);}return _0x2883ce[_0x4b22('0x1c')](_0x28bedf)['end']();};}function respondWithResult(_0x59888a,_0x562ace){_0x562ace=_0x562ace||0xc8;return function(_0x343cbc){if(_0x343cbc){return _0x59888a[_0x4b22('0x1c')](_0x562ace)[_0x4b22('0x1d')](_0x343cbc);}};}function respondWithFilteredResult(_0x536e7b,_0x1cb04d){return function(_0x108e4e){if(_0x108e4e){var _0xf7c203=typeof _0x1cb04d[_0x4b22('0x1e')]===_0x4b22('0x1f')&&typeof _0x1cb04d['limit']===_0x4b22('0x1f');var _0x11f25b=_0x108e4e['count'];var _0xf328c8=_0xf7c203?0x0:_0x1cb04d[_0x4b22('0x1e')];var _0x34d3eb=_0xf7c203?_0x108e4e[_0x4b22('0x20')]:_0x1cb04d['offset']+_0x1cb04d[_0x4b22('0x21')];var _0x2cdaf6;if(_0x34d3eb>=_0x11f25b){_0x34d3eb=_0x11f25b;_0x2cdaf6=0xc8;}else{_0x2cdaf6=0xce;}_0x536e7b['status'](_0x2cdaf6);return _0x536e7b[_0x4b22('0x22')](_0x4b22('0x23'),_0xf328c8+'-'+_0x34d3eb+'/'+_0x11f25b)['json'](_0x108e4e);}return null;};}function patchUpdates(_0x32880f){return function(_0x3dc14a){try{jsonpatch['apply'](_0x3dc14a,_0x32880f,!![]);}catch(_0x70928d){return BPromise['reject'](_0x70928d);}return _0x3dc14a[_0x4b22('0x24')]();};}function saveUpdates(_0x6be3a4,_0x47dee9){return function(_0x1a3725){if(_0x1a3725){return _0x1a3725[_0x4b22('0x25')](_0x6be3a4)[_0x4b22('0x26')](function(_0x894c10){return _0x894c10;});}return null;};}function removeEntity(_0x43a0fe,_0x8c0c3e){return function(_0x30701b){if(_0x30701b){return _0x30701b['destroy']()[_0x4b22('0x26')](function(){var _0x1602b0=_0x30701b[_0x4b22('0x27')]({'plain':!![]});var _0x6b298d=_0x4b22('0x28');return db[_0x4b22('0x29')][_0x4b22('0x2a')]({'where':{'type':_0x6b298d,'resourceId':_0x1602b0['id']}})['then'](function(){return _0x30701b;});})[_0x4b22('0x26')](function(){_0x43a0fe[_0x4b22('0x1c')](0xcc)[_0x4b22('0x2b')]();});}};}function handleEntityNotFound(_0x3072dc,_0x1fc99d){return function(_0x116b33){if(!_0x116b33){_0x3072dc[_0x4b22('0x1b')](0x194);}return _0x116b33;};}function handleError(_0x3a457d,_0x518ece){_0x518ece=_0x518ece||0x1f4;return function(_0x3021a3){logger[_0x4b22('0x2c')](_0x3021a3[_0x4b22('0x2d')]);if(_0x3021a3[_0x4b22('0x2e')]){delete _0x3021a3[_0x4b22('0x2e')];}_0x3a457d['status'](_0x518ece)[_0x4b22('0x2f')](_0x3021a3);};}exports[_0x4b22('0x30')]=function(_0x22b895,_0x39430b){var _0x2f3290={},_0xfa892f={},_0x5b31b4={'count':0x0,'rows':[]};var _0x5e3c00=_[_0x4b22('0x31')](db[_0x4b22('0x32')][_0x4b22('0x33')],function(_0x175954){return{'name':_0x175954[_0x4b22('0x34')],'type':_0x175954['type'][_0x4b22('0x35')]};});_0xfa892f['model']=_[_0x4b22('0x31')](_0x5e3c00,_0x4b22('0x2e'));_0xfa892f[_0x4b22('0x36')]=_[_0x4b22('0x37')](_0x22b895[_0x4b22('0x36')]);_0xfa892f[_0x4b22('0x38')]=_[_0x4b22('0x39')](_0xfa892f[_0x4b22('0x3a')],_0xfa892f[_0x4b22('0x36')]);_0x2f3290[_0x4b22('0x3b')]=_[_0x4b22('0x39')](_0xfa892f['model'],qs[_0x4b22('0x3c')](_0x22b895['query'][_0x4b22('0x3c')]));_0x2f3290['attributes']=_0x2f3290[_0x4b22('0x3b')][_0x4b22('0x3d')]?_0x2f3290['attributes']:_0xfa892f[_0x4b22('0x3a')];if(!_0x22b895[_0x4b22('0x36')][_0x4b22('0x3e')](_0x4b22('0x3f'))){_0x2f3290[_0x4b22('0x21')]=qs[_0x4b22('0x21')](_0x22b895[_0x4b22('0x36')][_0x4b22('0x21')]);_0x2f3290[_0x4b22('0x1e')]=qs[_0x4b22('0x1e')](_0x22b895['query'][_0x4b22('0x1e')]);}_0x2f3290[_0x4b22('0x40')]=qs[_0x4b22('0x41')](_0x22b895[_0x4b22('0x36')][_0x4b22('0x41')]);_0x2f3290[_0x4b22('0x42')]=qs[_0x4b22('0x38')](_[_0x4b22('0x43')](_0x22b895[_0x4b22('0x36')],_0xfa892f['filters']),_0x5e3c00);if(_0x22b895[_0x4b22('0x36')]['filter']){_0x2f3290[_0x4b22('0x42')]=_[_0x4b22('0x44')](_0x2f3290[_0x4b22('0x42')],{'$or':_[_0x4b22('0x31')](_0x5e3c00,function(_0x509972){if(_0x509972[_0x4b22('0x45')]!=='VIRTUAL'){var _0x24fd46={};_0x24fd46[_0x509972[_0x4b22('0x2e')]]={'$like':'%'+_0x22b895[_0x4b22('0x36')][_0x4b22('0x46')]+'%'};return _0x24fd46;}})});}_0x2f3290=_[_0x4b22('0x44')]({},_0x2f3290,_0x22b895['options']);var _0x471de9={'where':_0x2f3290[_0x4b22('0x42')]};return db[_0x4b22('0x32')][_0x4b22('0x20')](_0x471de9)['then'](function(_0x25c10b){_0x5b31b4[_0x4b22('0x20')]=_0x25c10b;if(_0x22b895[_0x4b22('0x36')][_0x4b22('0x47')]){_0x2f3290['include']=[{'all':!![]}];}return db[_0x4b22('0x32')][_0x4b22('0x48')](_0x2f3290);})[_0x4b22('0x26')](function(_0x515c41){_0x5b31b4[_0x4b22('0x49')]=_0x515c41;return _0x5b31b4;})['then'](respondWithFilteredResult(_0x39430b,_0x2f3290))[_0x4b22('0x4a')](handleError(_0x39430b,null));};exports[_0x4b22('0x4b')]=function(_0x45ee06,_0x2556c4){var _0x6739f6={'raw':![],'where':{'id':_0x45ee06[_0x4b22('0x4c')]['id']}},_0x4a68c2={};_0x4a68c2[_0x4b22('0x3a')]=_[_0x4b22('0x37')](db[_0x4b22('0x32')][_0x4b22('0x33')]);_0x4a68c2[_0x4b22('0x36')]=_['keys'](_0x45ee06[_0x4b22('0x36')]);_0x4a68c2['filters']=_['intersection'](_0x4a68c2['model'],_0x4a68c2[_0x4b22('0x36')]);_0x6739f6[_0x4b22('0x3b')]=_[_0x4b22('0x39')](_0x4a68c2['model'],qs[_0x4b22('0x3c')](_0x45ee06[_0x4b22('0x36')][_0x4b22('0x3c')]));_0x6739f6['attributes']=_0x6739f6[_0x4b22('0x3b')][_0x4b22('0x3d')]?_0x6739f6[_0x4b22('0x3b')]:_0x4a68c2[_0x4b22('0x3a')];if(_0x45ee06['query'][_0x4b22('0x47')]){_0x6739f6[_0x4b22('0x4d')]=[{'all':!![]}];}_0x6739f6=_['merge']({},_0x6739f6,_0x45ee06['options']);return db[_0x4b22('0x32')][_0x4b22('0x4e')](_0x6739f6)[_0x4b22('0x26')](handleEntityNotFound(_0x2556c4,null))['then'](respondWithResult(_0x2556c4,null))[_0x4b22('0x4a')](handleError(_0x2556c4,null));};exports[_0x4b22('0x4f')]=function(_0x5d25f8,_0x52231e){return db[_0x4b22('0x32')][_0x4b22('0x4f')](_0x5d25f8['body'],{})[_0x4b22('0x26')](function(_0x5ba66b){var _0x50f6a0=_0x5d25f8[_0x4b22('0x50')]['get']({'plain':!![]});if(!_0x50f6a0)throw new Error(_0x4b22('0x51'));if(_0x50f6a0[_0x4b22('0x52')]===_0x4b22('0x50')){var _0x5307ad=_0x5ba66b[_0x4b22('0x27')]({'plain':!![]});var _0x700622='Triggers';return db['UserProfileSection']['find']({'where':{'name':_0x700622,'userProfileId':_0x50f6a0[_0x4b22('0x53')]},'raw':!![]})[_0x4b22('0x26')](function(_0x58bdc1){if(_0x58bdc1&&_0x58bdc1['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5307ad[_0x4b22('0x2e')],'resourceId':_0x5307ad['id'],'type':_0x58bdc1[_0x4b22('0x2e')],'sectionId':_0x58bdc1['id']},{})[_0x4b22('0x26')](function(){return _0x5ba66b;});}else{return _0x5ba66b;}})[_0x4b22('0x4a')](function(_0xc994c1){logger[_0x4b22('0x2c')](_0x4b22('0x54'),_0xc994c1);throw _0xc994c1;});}return _0x5ba66b;})[_0x4b22('0x26')](respondWithResult(_0x52231e,0xc9))[_0x4b22('0x4a')](handleError(_0x52231e,null));};exports[_0x4b22('0x25')]=function(_0x135f46,_0x3aee9c){if(_0x135f46['body']['id']){delete _0x135f46[_0x4b22('0x55')]['id'];}return db[_0x4b22('0x32')][_0x4b22('0x4e')]({'where':{'id':_0x135f46[_0x4b22('0x4c')]['id']}})[_0x4b22('0x26')](handleEntityNotFound(_0x3aee9c,null))[_0x4b22('0x26')](saveUpdates(_0x135f46[_0x4b22('0x55')],null))[_0x4b22('0x26')](respondWithResult(_0x3aee9c,null))[_0x4b22('0x4a')](handleError(_0x3aee9c,null));};exports[_0x4b22('0x2a')]=function(_0x3106f4,_0x38af17){return db['Trigger'][_0x4b22('0x4e')]({'where':{'id':_0x3106f4['params']['id']}})[_0x4b22('0x26')](handleEntityNotFound(_0x38af17,null))[_0x4b22('0x26')](removeEntity(_0x38af17,null))[_0x4b22('0x4a')](handleError(_0x38af17,null));};exports[_0x4b22('0x56')]=function(_0x19b5b6,_0x450641,_0x3872ec){if(_0x19b5b6['body']['id']){delete _0x19b5b6[_0x4b22('0x55')]['id'];}return db['Trigger'][_0x4b22('0x4e')]({'where':{'id':_0x19b5b6[_0x4b22('0x4c')]['id']}})[_0x4b22('0x26')](handleEntityNotFound(_0x450641,null))[_0x4b22('0x26')](function(_0x1f2a47){if(_0x1f2a47){_0x19b5b6[_0x4b22('0x55')][_0x4b22('0x57')]=_0x1f2a47['id'];return db['Condition'][_0x4b22('0x4f')](_0x19b5b6[_0x4b22('0x55')]);}})['then'](respondWithResult(_0x450641,null))['catch'](handleError(_0x450641,null));};exports['addAnyCondition']=function(_0x1034d0,_0x32cb5a,_0x4390fd){if(_0x1034d0[_0x4b22('0x55')]['id']){delete _0x1034d0['body']['id'];}return db[_0x4b22('0x32')]['find']({'where':{'id':_0x1034d0[_0x4b22('0x4c')]['id']}})['then'](handleEntityNotFound(_0x32cb5a,null))[_0x4b22('0x26')](function(_0x286b04){if(_0x286b04){_0x1034d0[_0x4b22('0x55')][_0x4b22('0x58')]=_0x286b04['id'];return db[_0x4b22('0x59')][_0x4b22('0x4f')](_0x1034d0[_0x4b22('0x55')]);}})['then'](respondWithResult(_0x32cb5a,null))['catch'](handleError(_0x32cb5a,null));};exports[_0x4b22('0x5a')]=function(_0x17e7fb,_0x5668e7,_0x3f1b3a){var _0x59c26e={};var _0x2c799a={};var _0x2c92c0;var _0x25e0d2;return db[_0x4b22('0x32')][_0x4b22('0x5b')]({'where':{'id':_0x17e7fb['params']['id']}})[_0x4b22('0x26')](handleEntityNotFound(_0x5668e7,null))[_0x4b22('0x26')](function(_0x2ce1a9){if(_0x2ce1a9){_0x2c92c0=_0x2ce1a9;_0x2c799a[_0x4b22('0x3a')]=_[_0x4b22('0x37')](db[_0x4b22('0x59')][_0x4b22('0x33')]);_0x2c799a[_0x4b22('0x36')]=_['keys'](_0x17e7fb[_0x4b22('0x36')]);_0x2c799a[_0x4b22('0x38')]=_[_0x4b22('0x39')](_0x2c799a[_0x4b22('0x3a')],_0x2c799a[_0x4b22('0x36')]);_0x59c26e['attributes']=_['intersection'](_0x2c799a[_0x4b22('0x3a')],qs[_0x4b22('0x3c')](_0x17e7fb[_0x4b22('0x36')]['fields']));_0x59c26e[_0x4b22('0x3b')]=_0x59c26e[_0x4b22('0x3b')][_0x4b22('0x3d')]?_0x59c26e['attributes']:_0x2c799a[_0x4b22('0x3a')];_0x59c26e[_0x4b22('0x40')]=qs[_0x4b22('0x41')](_0x17e7fb[_0x4b22('0x36')][_0x4b22('0x41')]);_0x59c26e[_0x4b22('0x42')]=qs['filters'](_[_0x4b22('0x43')](_0x17e7fb[_0x4b22('0x36')],_0x2c799a[_0x4b22('0x38')]));if(_0x17e7fb[_0x4b22('0x36')][_0x4b22('0x46')]){_0x59c26e[_0x4b22('0x42')]=_[_0x4b22('0x44')](_0x59c26e[_0x4b22('0x42')],{'$or':_[_0x4b22('0x31')](_0x59c26e[_0x4b22('0x3b')],function(_0x197fd5){var _0x3951d6={};_0x3951d6[_0x197fd5]={'$like':'%'+_0x17e7fb[_0x4b22('0x36')][_0x4b22('0x46')]+'%'};return _0x3951d6;})});}_0x59c26e=_[_0x4b22('0x44')]({},_0x59c26e,_0x17e7fb['options']);return _0x2c92c0[_0x4b22('0x5a')](_0x59c26e);}})['then'](function(_0x617988){if(_0x617988){_0x25e0d2=_0x617988[_0x4b22('0x3d')];if(!_0x17e7fb['query'][_0x4b22('0x3e')](_0x4b22('0x3f'))){_0x59c26e['limit']=qs[_0x4b22('0x21')](_0x17e7fb[_0x4b22('0x36')]['limit']);_0x59c26e[_0x4b22('0x1e')]=qs[_0x4b22('0x1e')](_0x17e7fb[_0x4b22('0x36')][_0x4b22('0x1e')]);}return _0x2c92c0[_0x4b22('0x5a')](_0x59c26e);}})[_0x4b22('0x26')](function(_0x2e8796){if(_0x2e8796){return _0x2e8796?{'count':_0x25e0d2,'rows':_0x2e8796}:null;}})['then'](respondWithResult(_0x5668e7,null))[_0x4b22('0x4a')](handleError(_0x5668e7,null));};exports[_0x4b22('0x5c')]=function(_0x210528,_0x3ed8ce,_0x2f044e){var _0x504af0={};var _0x51c374={};var _0x3d3e3c;var _0x1fa66b;return db[_0x4b22('0x32')][_0x4b22('0x5b')]({'where':{'id':_0x210528[_0x4b22('0x4c')]['id']}})[_0x4b22('0x26')](handleEntityNotFound(_0x3ed8ce,null))['then'](function(_0x1f72f2){if(_0x1f72f2){_0x3d3e3c=_0x1f72f2;_0x51c374[_0x4b22('0x3a')]=_[_0x4b22('0x37')](db[_0x4b22('0x59')][_0x4b22('0x33')]);_0x51c374[_0x4b22('0x36')]=_[_0x4b22('0x37')](_0x210528[_0x4b22('0x36')]);_0x51c374['filters']=_[_0x4b22('0x39')](_0x51c374['model'],_0x51c374[_0x4b22('0x36')]);_0x504af0[_0x4b22('0x3b')]=_[_0x4b22('0x39')](_0x51c374[_0x4b22('0x3a')],qs[_0x4b22('0x3c')](_0x210528[_0x4b22('0x36')]['fields']));_0x504af0[_0x4b22('0x3b')]=_0x504af0['attributes'][_0x4b22('0x3d')]?_0x504af0['attributes']:_0x51c374['model'];_0x504af0[_0x4b22('0x40')]=qs[_0x4b22('0x41')](_0x210528[_0x4b22('0x36')][_0x4b22('0x41')]);_0x504af0[_0x4b22('0x42')]=qs[_0x4b22('0x38')](_[_0x4b22('0x43')](_0x210528[_0x4b22('0x36')],_0x51c374[_0x4b22('0x38')]));if(_0x210528[_0x4b22('0x36')]['filter']){_0x504af0['where']=_['merge'](_0x504af0[_0x4b22('0x42')],{'$or':_[_0x4b22('0x31')](_0x504af0[_0x4b22('0x3b')],function(_0x20c919){var _0x73223e={};_0x73223e[_0x20c919]={'$like':'%'+_0x210528[_0x4b22('0x36')][_0x4b22('0x46')]+'%'};return _0x73223e;})});}_0x504af0=_[_0x4b22('0x44')]({},_0x504af0,_0x210528[_0x4b22('0x5d')]);return _0x3d3e3c[_0x4b22('0x5c')](_0x504af0);}})[_0x4b22('0x26')](function(_0x227d87){if(_0x227d87){_0x1fa66b=_0x227d87[_0x4b22('0x3d')];if(!_0x210528[_0x4b22('0x36')][_0x4b22('0x3e')](_0x4b22('0x3f'))){_0x504af0['limit']=qs[_0x4b22('0x21')](_0x210528[_0x4b22('0x36')][_0x4b22('0x21')]);_0x504af0['offset']=qs['offset'](_0x210528[_0x4b22('0x36')]['offset']);}return _0x3d3e3c['getAnyConditions'](_0x504af0);}})[_0x4b22('0x26')](function(_0x5182cc){if(_0x5182cc){return _0x5182cc?{'count':_0x1fa66b,'rows':_0x5182cc}:null;}})[_0x4b22('0x26')](respondWithResult(_0x3ed8ce,null))[_0x4b22('0x4a')](handleError(_0x3ed8ce,null));};exports[_0x4b22('0x5e')]=function(_0x10a192,_0x5776ad,_0x20a280){if(_0x10a192['body']['id']){delete _0x10a192[_0x4b22('0x55')]['id'];}return db[_0x4b22('0x32')][_0x4b22('0x4e')]({'where':{'id':_0x10a192['params']['id']}})['then'](handleEntityNotFound(_0x5776ad,null))['then'](function(_0xc2932f){if(_0xc2932f){_0x10a192[_0x4b22('0x55')]['TriggerId']=_0xc2932f['id'];return db[_0x4b22('0x5f')]['create'](_0x10a192[_0x4b22('0x55')]);}})[_0x4b22('0x26')](respondWithResult(_0x5776ad,null))['catch'](handleError(_0x5776ad,null));};exports[_0x4b22('0x60')]=function(_0x28b6f7,_0x2d2008,_0x2dadf1){var _0x548bd7={};var _0x17ea03={};var _0x5a0228;var _0x483c68;return db['Trigger'][_0x4b22('0x5b')]({'where':{'id':_0x28b6f7['params']['id']}})[_0x4b22('0x26')](handleEntityNotFound(_0x2d2008,null))[_0x4b22('0x26')](function(_0x3ffa1c){if(_0x3ffa1c){_0x5a0228=_0x3ffa1c;_0x17ea03[_0x4b22('0x3a')]=_[_0x4b22('0x37')](db['Action'][_0x4b22('0x33')]);_0x17ea03['query']=_['keys'](_0x28b6f7[_0x4b22('0x36')]);_0x17ea03[_0x4b22('0x38')]=_['intersection'](_0x17ea03[_0x4b22('0x3a')],_0x17ea03[_0x4b22('0x36')]);_0x548bd7[_0x4b22('0x3b')]=_['intersection'](_0x17ea03[_0x4b22('0x3a')],qs[_0x4b22('0x3c')](_0x28b6f7['query']['fields']));_0x548bd7[_0x4b22('0x3b')]=_0x548bd7[_0x4b22('0x3b')][_0x4b22('0x3d')]?_0x548bd7[_0x4b22('0x3b')]:_0x17ea03[_0x4b22('0x3a')];_0x548bd7[_0x4b22('0x40')]=qs['sort'](_0x28b6f7['query']['sort']);_0x548bd7['where']=qs[_0x4b22('0x38')](_[_0x4b22('0x43')](_0x28b6f7['query'],_0x17ea03[_0x4b22('0x38')]));if(_0x28b6f7[_0x4b22('0x36')][_0x4b22('0x46')]){_0x548bd7[_0x4b22('0x42')]=_[_0x4b22('0x44')](_0x548bd7['where'],{'$or':_[_0x4b22('0x31')](_0x548bd7[_0x4b22('0x3b')],function(_0x30ce9d){var _0x21f95c={};_0x21f95c[_0x30ce9d]={'$like':'%'+_0x28b6f7[_0x4b22('0x36')][_0x4b22('0x46')]+'%'};return _0x21f95c;})});}_0x548bd7=_[_0x4b22('0x44')]({},_0x548bd7,_0x28b6f7['options']);return _0x5a0228[_0x4b22('0x60')](_0x548bd7);}})[_0x4b22('0x26')](function(_0x34e8a7){if(_0x34e8a7){_0x483c68=_0x34e8a7['length'];if(!_0x28b6f7[_0x4b22('0x36')][_0x4b22('0x3e')](_0x4b22('0x3f'))){_0x548bd7[_0x4b22('0x21')]=qs[_0x4b22('0x21')](_0x28b6f7[_0x4b22('0x36')]['limit']);_0x548bd7[_0x4b22('0x1e')]=qs['offset'](_0x28b6f7[_0x4b22('0x36')][_0x4b22('0x1e')]);}return _0x5a0228[_0x4b22('0x60')](_0x548bd7);}})[_0x4b22('0x26')](function(_0x4e80af){if(_0x4e80af){return _0x4e80af?{'count':_0x483c68,'rows':_0x4e80af}:null;}})[_0x4b22('0x26')](respondWithResult(_0x2d2008,null))[_0x4b22('0x4a')](handleError(_0x2d2008,null));}; \ No newline at end of file +var _0xdb6a=['show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','catch','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','findOne','getAllConditions','hasOwnProperty','getAnyConditions','TriggerId','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','Trigger','findAll','rows'];(function(_0x39adb2,_0x540b96){var _0x1df693=function(_0x13fb10){while(--_0x13fb10){_0x39adb2['push'](_0x39adb2['shift']());}};_0x1df693(++_0x540b96);}(_0xdb6a,0x129));var _0xadb6=function(_0x2cefe2,_0x4d6972){_0x2cefe2=_0x2cefe2-0x0;var _0x385352=_0xdb6a[_0x2cefe2];return _0x385352;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xadb6('0x0'));var jsonpatch=require(_0xadb6('0x1'));var rp=require(_0xadb6('0x2'));var moment=require(_0xadb6('0x3'));var BPromise=require(_0xadb6('0x4'));var Mustache=require(_0xadb6('0x5'));var util=require('util');var path=require('path');var sox=require(_0xadb6('0x6'));var csv=require('to-csv');var ejs=require(_0xadb6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xadb6('0x8'));var squel=require(_0xadb6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xadb6('0xa'));var querystring=require(_0xadb6('0xb'));var Papa=require(_0xadb6('0xc'));var Redis=require(_0xadb6('0xd'));var authService=require(_0xadb6('0xe'));var qs=require(_0xadb6('0xf'));var as=require(_0xadb6('0x10'));var hardwareService=require(_0xadb6('0x11'));var logger=require(_0xadb6('0x12'))(_0xadb6('0x13'));var utils=require('../../config/utils');var config=require(_0xadb6('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25a3de,_0x55b746){_0x55b746=_0x55b746||0xcc;return function(_0x2ce1f1){if(_0x2ce1f1){return _0x25a3de[_0xadb6('0x15')](_0x55b746);}return _0x25a3de[_0xadb6('0x16')](_0x55b746)[_0xadb6('0x17')]();};}function respondWithResult(_0x4d0af6,_0x445a7f){_0x445a7f=_0x445a7f||0xc8;return function(_0x509529){if(_0x509529){return _0x4d0af6['status'](_0x445a7f)[_0xadb6('0x18')](_0x509529);}};}function respondWithFilteredResult(_0x4873e6,_0x2736e2){return function(_0x2e044c){if(_0x2e044c){var _0x114b01=typeof _0x2736e2[_0xadb6('0x19')]===_0xadb6('0x1a')&&typeof _0x2736e2['limit']===_0xadb6('0x1a');var _0x285b8e=_0x2e044c['count'];var _0x3083c7=_0x114b01?0x0:_0x2736e2[_0xadb6('0x19')];var _0x2e4fa7=_0x114b01?_0x2e044c[_0xadb6('0x1b')]:_0x2736e2[_0xadb6('0x19')]+_0x2736e2[_0xadb6('0x1c')];var _0x8860e3;if(_0x2e4fa7>=_0x285b8e){_0x2e4fa7=_0x285b8e;_0x8860e3=0xc8;}else{_0x8860e3=0xce;}_0x4873e6[_0xadb6('0x16')](_0x8860e3);return _0x4873e6[_0xadb6('0x1d')](_0xadb6('0x1e'),_0x3083c7+'-'+_0x2e4fa7+'/'+_0x285b8e)[_0xadb6('0x18')](_0x2e044c);}return null;};}function patchUpdates(_0x1892c3){return function(_0x6ce9e0){try{jsonpatch[_0xadb6('0x1f')](_0x6ce9e0,_0x1892c3,!![]);}catch(_0x3d9a9b){return BPromise['reject'](_0x3d9a9b);}return _0x6ce9e0[_0xadb6('0x20')]();};}function saveUpdates(_0x19f34d,_0x450f12){return function(_0x1ac9e8){if(_0x1ac9e8){return _0x1ac9e8[_0xadb6('0x21')](_0x19f34d)['then'](function(_0xf175a0){return _0xf175a0;});}return null;};}function removeEntity(_0x40191f,_0x394f87){return function(_0x347bfc){if(_0x347bfc){return _0x347bfc[_0xadb6('0x22')]()[_0xadb6('0x23')](function(){var _0x2490f=_0x347bfc['get']({'plain':!![]});var _0x155ed6='Triggers';return db[_0xadb6('0x24')]['destroy']({'where':{'type':_0x155ed6,'resourceId':_0x2490f['id']}})[_0xadb6('0x23')](function(){return _0x347bfc;});})[_0xadb6('0x23')](function(){_0x40191f[_0xadb6('0x16')](0xcc)[_0xadb6('0x17')]();});}};}function handleEntityNotFound(_0x238a46,_0x117b09){return function(_0x50daaf){if(!_0x50daaf){_0x238a46['sendStatus'](0x194);}return _0x50daaf;};}function handleError(_0x3766a1,_0x1c73e9){_0x1c73e9=_0x1c73e9||0x1f4;return function(_0x55a226){logger[_0xadb6('0x25')](_0x55a226[_0xadb6('0x26')]);if(_0x55a226['name']){delete _0x55a226[_0xadb6('0x27')];}_0x3766a1['status'](_0x1c73e9)[_0xadb6('0x28')](_0x55a226);};}exports['index']=function(_0x3db378,_0x22b233){var _0x27c7ff={},_0x1836a5={},_0x260094={'count':0x0,'rows':[]};var _0x5158e5=_[_0xadb6('0x29')](db['Trigger'][_0xadb6('0x2a')],function(_0x57a00c){return{'name':_0x57a00c[_0xadb6('0x2b')],'type':_0x57a00c[_0xadb6('0x2c')][_0xadb6('0x2d')]};});_0x1836a5['model']=_[_0xadb6('0x29')](_0x5158e5,_0xadb6('0x27'));_0x1836a5[_0xadb6('0x2e')]=_[_0xadb6('0x2f')](_0x3db378[_0xadb6('0x2e')]);_0x1836a5['filters']=_[_0xadb6('0x30')](_0x1836a5[_0xadb6('0x31')],_0x1836a5['query']);_0x27c7ff[_0xadb6('0x32')]=_[_0xadb6('0x30')](_0x1836a5[_0xadb6('0x31')],qs[_0xadb6('0x33')](_0x3db378[_0xadb6('0x2e')][_0xadb6('0x33')]));_0x27c7ff[_0xadb6('0x32')]=_0x27c7ff[_0xadb6('0x32')][_0xadb6('0x34')]?_0x27c7ff[_0xadb6('0x32')]:_0x1836a5[_0xadb6('0x31')];if(!_0x3db378[_0xadb6('0x2e')]['hasOwnProperty'](_0xadb6('0x35'))){_0x27c7ff[_0xadb6('0x1c')]=qs[_0xadb6('0x1c')](_0x3db378['query']['limit']);_0x27c7ff[_0xadb6('0x19')]=qs[_0xadb6('0x19')](_0x3db378[_0xadb6('0x2e')]['offset']);}_0x27c7ff[_0xadb6('0x36')]=qs[_0xadb6('0x37')](_0x3db378[_0xadb6('0x2e')][_0xadb6('0x37')]);_0x27c7ff[_0xadb6('0x38')]=qs[_0xadb6('0x39')](_[_0xadb6('0x3a')](_0x3db378[_0xadb6('0x2e')],_0x1836a5[_0xadb6('0x39')]),_0x5158e5);if(_0x3db378[_0xadb6('0x2e')][_0xadb6('0x3b')]){_0x27c7ff['where']=_[_0xadb6('0x3c')](_0x27c7ff[_0xadb6('0x38')],{'$or':_[_0xadb6('0x29')](_0x5158e5,function(_0x5e6c6b){if(_0x5e6c6b[_0xadb6('0x2c')]!==_0xadb6('0x3d')){var _0x18510f={};_0x18510f[_0x5e6c6b[_0xadb6('0x27')]]={'$like':'%'+_0x3db378['query'][_0xadb6('0x3b')]+'%'};return _0x18510f;}})});}_0x27c7ff=_[_0xadb6('0x3c')]({},_0x27c7ff,_0x3db378[_0xadb6('0x3e')]);var _0x5e2195={'where':_0x27c7ff['where']};return db['Trigger'][_0xadb6('0x1b')](_0x5e2195)[_0xadb6('0x23')](function(_0x29d27f){_0x260094['count']=_0x29d27f;if(_0x3db378['query'][_0xadb6('0x3f')]){_0x27c7ff['include']=[{'all':!![]}];}return db[_0xadb6('0x40')][_0xadb6('0x41')](_0x27c7ff);})[_0xadb6('0x23')](function(_0x248c90){_0x260094[_0xadb6('0x42')]=_0x248c90;return _0x260094;})[_0xadb6('0x23')](respondWithFilteredResult(_0x22b233,_0x27c7ff))['catch'](handleError(_0x22b233,null));};exports[_0xadb6('0x43')]=function(_0x35dff3,_0x3a9fc2){var _0x3629b6={'raw':![],'where':{'id':_0x35dff3[_0xadb6('0x44')]['id']}},_0x4f7caa={};_0x4f7caa[_0xadb6('0x31')]=_['keys'](db[_0xadb6('0x40')][_0xadb6('0x2a')]);_0x4f7caa[_0xadb6('0x2e')]=_[_0xadb6('0x2f')](_0x35dff3[_0xadb6('0x2e')]);_0x4f7caa[_0xadb6('0x39')]=_[_0xadb6('0x30')](_0x4f7caa['model'],_0x4f7caa['query']);_0x3629b6[_0xadb6('0x32')]=_[_0xadb6('0x30')](_0x4f7caa[_0xadb6('0x31')],qs[_0xadb6('0x33')](_0x35dff3[_0xadb6('0x2e')][_0xadb6('0x33')]));_0x3629b6[_0xadb6('0x32')]=_0x3629b6[_0xadb6('0x32')][_0xadb6('0x34')]?_0x3629b6[_0xadb6('0x32')]:_0x4f7caa[_0xadb6('0x31')];if(_0x35dff3['query']['includeAll']){_0x3629b6[_0xadb6('0x45')]=[{'all':!![]}];}_0x3629b6=_[_0xadb6('0x3c')]({},_0x3629b6,_0x35dff3[_0xadb6('0x3e')]);return db[_0xadb6('0x40')][_0xadb6('0x46')](_0x3629b6)[_0xadb6('0x23')](handleEntityNotFound(_0x3a9fc2,null))[_0xadb6('0x23')](respondWithResult(_0x3a9fc2,null))['catch'](handleError(_0x3a9fc2,null));};exports[_0xadb6('0x47')]=function(_0x3d63d0,_0x349a26){return db[_0xadb6('0x40')][_0xadb6('0x47')](_0x3d63d0[_0xadb6('0x48')],{})[_0xadb6('0x23')](function(_0x81f0c0){var _0x16b7a4=_0x3d63d0[_0xadb6('0x49')][_0xadb6('0x4a')]({'plain':!![]});if(!_0x16b7a4)throw new Error(_0xadb6('0x4b'));if(_0x16b7a4[_0xadb6('0x4c')]===_0xadb6('0x49')){var _0xc608be=_0x81f0c0[_0xadb6('0x4a')]({'plain':!![]});var _0x4c9ad5='Triggers';return db[_0xadb6('0x4d')][_0xadb6('0x46')]({'where':{'name':_0x4c9ad5,'userProfileId':_0x16b7a4['userProfileId']},'raw':!![]})[_0xadb6('0x23')](function(_0x393d05){if(_0x393d05&&_0x393d05['autoAssociation']===0x0){return db[_0xadb6('0x24')]['create']({'name':_0xc608be[_0xadb6('0x27')],'resourceId':_0xc608be['id'],'type':_0x393d05[_0xadb6('0x27')],'sectionId':_0x393d05['id']},{})[_0xadb6('0x23')](function(){return _0x81f0c0;});}else{return _0x81f0c0;}})[_0xadb6('0x4e')](function(_0x5b35cd){logger[_0xadb6('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b35cd);throw _0x5b35cd;});}return _0x81f0c0;})[_0xadb6('0x23')](respondWithResult(_0x349a26,0xc9))['catch'](handleError(_0x349a26,null));};exports['update']=function(_0x4949e1,_0x2c3d12){if(_0x4949e1[_0xadb6('0x48')]['id']){delete _0x4949e1[_0xadb6('0x48')]['id'];}return db[_0xadb6('0x40')][_0xadb6('0x46')]({'where':{'id':_0x4949e1[_0xadb6('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c3d12,null))[_0xadb6('0x23')](saveUpdates(_0x4949e1['body'],null))['then'](respondWithResult(_0x2c3d12,null))['catch'](handleError(_0x2c3d12,null));};exports[_0xadb6('0x22')]=function(_0x2a74e1,_0xdf0434){return db[_0xadb6('0x40')]['find']({'where':{'id':_0x2a74e1[_0xadb6('0x44')]['id']}})['then'](handleEntityNotFound(_0xdf0434,null))[_0xadb6('0x23')](removeEntity(_0xdf0434,null))[_0xadb6('0x4e')](handleError(_0xdf0434,null));};exports[_0xadb6('0x4f')]=function(_0x294527,_0x1caad3,_0x3d6eef){if(_0x294527[_0xadb6('0x48')]['id']){delete _0x294527[_0xadb6('0x48')]['id'];}return db[_0xadb6('0x40')][_0xadb6('0x46')]({'where':{'id':_0x294527[_0xadb6('0x44')]['id']}})[_0xadb6('0x23')](handleEntityNotFound(_0x1caad3,null))[_0xadb6('0x23')](function(_0x186d00){if(_0x186d00){_0x294527['body'][_0xadb6('0x50')]=_0x186d00['id'];return db['Condition'][_0xadb6('0x47')](_0x294527[_0xadb6('0x48')]);}})[_0xadb6('0x23')](respondWithResult(_0x1caad3,null))[_0xadb6('0x4e')](handleError(_0x1caad3,null));};exports[_0xadb6('0x51')]=function(_0x7a635c,_0x445300,_0x24ae8b){if(_0x7a635c[_0xadb6('0x48')]['id']){delete _0x7a635c['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x7a635c[_0xadb6('0x44')]['id']}})['then'](handleEntityNotFound(_0x445300,null))[_0xadb6('0x23')](function(_0x58a2af){if(_0x58a2af){_0x7a635c[_0xadb6('0x48')][_0xadb6('0x52')]=_0x58a2af['id'];return db[_0xadb6('0x53')][_0xadb6('0x47')](_0x7a635c[_0xadb6('0x48')]);}})['then'](respondWithResult(_0x445300,null))[_0xadb6('0x4e')](handleError(_0x445300,null));};exports['getAllConditions']=function(_0x464326,_0x4cfc7d,_0x502941){var _0x6fa5f3={};var _0x113116={};var _0xf74a37;var _0x3cc5e3;return db[_0xadb6('0x40')][_0xadb6('0x54')]({'where':{'id':_0x464326[_0xadb6('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cfc7d,null))[_0xadb6('0x23')](function(_0x4fe97c){if(_0x4fe97c){_0xf74a37=_0x4fe97c;_0x113116[_0xadb6('0x31')]=_[_0xadb6('0x2f')](db[_0xadb6('0x53')][_0xadb6('0x2a')]);_0x113116[_0xadb6('0x2e')]=_[_0xadb6('0x2f')](_0x464326[_0xadb6('0x2e')]);_0x113116[_0xadb6('0x39')]=_['intersection'](_0x113116[_0xadb6('0x31')],_0x113116['query']);_0x6fa5f3[_0xadb6('0x32')]=_[_0xadb6('0x30')](_0x113116[_0xadb6('0x31')],qs[_0xadb6('0x33')](_0x464326[_0xadb6('0x2e')][_0xadb6('0x33')]));_0x6fa5f3[_0xadb6('0x32')]=_0x6fa5f3[_0xadb6('0x32')][_0xadb6('0x34')]?_0x6fa5f3['attributes']:_0x113116[_0xadb6('0x31')];_0x6fa5f3[_0xadb6('0x36')]=qs[_0xadb6('0x37')](_0x464326[_0xadb6('0x2e')][_0xadb6('0x37')]);_0x6fa5f3['where']=qs[_0xadb6('0x39')](_[_0xadb6('0x3a')](_0x464326['query'],_0x113116[_0xadb6('0x39')]));if(_0x464326[_0xadb6('0x2e')][_0xadb6('0x3b')]){_0x6fa5f3[_0xadb6('0x38')]=_[_0xadb6('0x3c')](_0x6fa5f3['where'],{'$or':_[_0xadb6('0x29')](_0x6fa5f3['attributes'],function(_0x2beec3){var _0x19b346={};_0x19b346[_0x2beec3]={'$like':'%'+_0x464326['query'][_0xadb6('0x3b')]+'%'};return _0x19b346;})});}_0x6fa5f3=_[_0xadb6('0x3c')]({},_0x6fa5f3,_0x464326[_0xadb6('0x3e')]);return _0xf74a37[_0xadb6('0x55')](_0x6fa5f3);}})['then'](function(_0x53e3bd){if(_0x53e3bd){_0x3cc5e3=_0x53e3bd[_0xadb6('0x34')];if(!_0x464326[_0xadb6('0x2e')][_0xadb6('0x56')](_0xadb6('0x35'))){_0x6fa5f3[_0xadb6('0x1c')]=qs['limit'](_0x464326[_0xadb6('0x2e')][_0xadb6('0x1c')]);_0x6fa5f3[_0xadb6('0x19')]=qs[_0xadb6('0x19')](_0x464326[_0xadb6('0x2e')]['offset']);}return _0xf74a37['getAllConditions'](_0x6fa5f3);}})[_0xadb6('0x23')](function(_0x318523){if(_0x318523){return _0x318523?{'count':_0x3cc5e3,'rows':_0x318523}:null;}})[_0xadb6('0x23')](respondWithResult(_0x4cfc7d,null))[_0xadb6('0x4e')](handleError(_0x4cfc7d,null));};exports[_0xadb6('0x57')]=function(_0x121428,_0x68f6ba,_0x1ccdae){var _0x2fdda8={};var _0x1a3149={};var _0x2eb511;var _0x5e272a;return db[_0xadb6('0x40')][_0xadb6('0x54')]({'where':{'id':_0x121428[_0xadb6('0x44')]['id']}})[_0xadb6('0x23')](handleEntityNotFound(_0x68f6ba,null))[_0xadb6('0x23')](function(_0x6d0ed3){if(_0x6d0ed3){_0x2eb511=_0x6d0ed3;_0x1a3149['model']=_[_0xadb6('0x2f')](db[_0xadb6('0x53')]['rawAttributes']);_0x1a3149['query']=_[_0xadb6('0x2f')](_0x121428['query']);_0x1a3149[_0xadb6('0x39')]=_[_0xadb6('0x30')](_0x1a3149[_0xadb6('0x31')],_0x1a3149[_0xadb6('0x2e')]);_0x2fdda8[_0xadb6('0x32')]=_[_0xadb6('0x30')](_0x1a3149[_0xadb6('0x31')],qs[_0xadb6('0x33')](_0x121428[_0xadb6('0x2e')][_0xadb6('0x33')]));_0x2fdda8[_0xadb6('0x32')]=_0x2fdda8[_0xadb6('0x32')][_0xadb6('0x34')]?_0x2fdda8['attributes']:_0x1a3149[_0xadb6('0x31')];_0x2fdda8[_0xadb6('0x36')]=qs['sort'](_0x121428[_0xadb6('0x2e')]['sort']);_0x2fdda8[_0xadb6('0x38')]=qs[_0xadb6('0x39')](_[_0xadb6('0x3a')](_0x121428[_0xadb6('0x2e')],_0x1a3149[_0xadb6('0x39')]));if(_0x121428[_0xadb6('0x2e')][_0xadb6('0x3b')]){_0x2fdda8[_0xadb6('0x38')]=_[_0xadb6('0x3c')](_0x2fdda8[_0xadb6('0x38')],{'$or':_[_0xadb6('0x29')](_0x2fdda8[_0xadb6('0x32')],function(_0x1f295b){var _0x1c32f7={};_0x1c32f7[_0x1f295b]={'$like':'%'+_0x121428[_0xadb6('0x2e')][_0xadb6('0x3b')]+'%'};return _0x1c32f7;})});}_0x2fdda8=_['merge']({},_0x2fdda8,_0x121428[_0xadb6('0x3e')]);return _0x2eb511[_0xadb6('0x57')](_0x2fdda8);}})[_0xadb6('0x23')](function(_0x3880e4){if(_0x3880e4){_0x5e272a=_0x3880e4[_0xadb6('0x34')];if(!_0x121428['query'][_0xadb6('0x56')](_0xadb6('0x35'))){_0x2fdda8[_0xadb6('0x1c')]=qs[_0xadb6('0x1c')](_0x121428[_0xadb6('0x2e')]['limit']);_0x2fdda8['offset']=qs[_0xadb6('0x19')](_0x121428[_0xadb6('0x2e')][_0xadb6('0x19')]);}return _0x2eb511[_0xadb6('0x57')](_0x2fdda8);}})[_0xadb6('0x23')](function(_0x379cf3){if(_0x379cf3){return _0x379cf3?{'count':_0x5e272a,'rows':_0x379cf3}:null;}})[_0xadb6('0x23')](respondWithResult(_0x68f6ba,null))[_0xadb6('0x4e')](handleError(_0x68f6ba,null));};exports['addAction']=function(_0x34a862,_0x2ca6e7,_0x31e5e9){if(_0x34a862[_0xadb6('0x48')]['id']){delete _0x34a862['body']['id'];}return db[_0xadb6('0x40')]['find']({'where':{'id':_0x34a862[_0xadb6('0x44')]['id']}})[_0xadb6('0x23')](handleEntityNotFound(_0x2ca6e7,null))['then'](function(_0x31504e){if(_0x31504e){_0x34a862[_0xadb6('0x48')][_0xadb6('0x58')]=_0x31504e['id'];return db[_0xadb6('0x59')][_0xadb6('0x47')](_0x34a862[_0xadb6('0x48')]);}})['then'](respondWithResult(_0x2ca6e7,null))['catch'](handleError(_0x2ca6e7,null));};exports[_0xadb6('0x5a')]=function(_0x3ed51e,_0x548d38,_0x597b1f){var _0x1bc9d7={};var _0x3abcbb={};var _0x206196;var _0x485495;return db[_0xadb6('0x40')][_0xadb6('0x54')]({'where':{'id':_0x3ed51e['params']['id']}})['then'](handleEntityNotFound(_0x548d38,null))[_0xadb6('0x23')](function(_0x498040){if(_0x498040){_0x206196=_0x498040;_0x3abcbb[_0xadb6('0x31')]=_[_0xadb6('0x2f')](db['Action'][_0xadb6('0x2a')]);_0x3abcbb[_0xadb6('0x2e')]=_['keys'](_0x3ed51e[_0xadb6('0x2e')]);_0x3abcbb[_0xadb6('0x39')]=_[_0xadb6('0x30')](_0x3abcbb[_0xadb6('0x31')],_0x3abcbb[_0xadb6('0x2e')]);_0x1bc9d7[_0xadb6('0x32')]=_[_0xadb6('0x30')](_0x3abcbb[_0xadb6('0x31')],qs[_0xadb6('0x33')](_0x3ed51e[_0xadb6('0x2e')][_0xadb6('0x33')]));_0x1bc9d7['attributes']=_0x1bc9d7['attributes']['length']?_0x1bc9d7[_0xadb6('0x32')]:_0x3abcbb[_0xadb6('0x31')];_0x1bc9d7['order']=qs[_0xadb6('0x37')](_0x3ed51e[_0xadb6('0x2e')]['sort']);_0x1bc9d7[_0xadb6('0x38')]=qs['filters'](_[_0xadb6('0x3a')](_0x3ed51e[_0xadb6('0x2e')],_0x3abcbb[_0xadb6('0x39')]));if(_0x3ed51e['query'][_0xadb6('0x3b')]){_0x1bc9d7[_0xadb6('0x38')]=_[_0xadb6('0x3c')](_0x1bc9d7['where'],{'$or':_['map'](_0x1bc9d7['attributes'],function(_0x11ed18){var _0x19c577={};_0x19c577[_0x11ed18]={'$like':'%'+_0x3ed51e[_0xadb6('0x2e')][_0xadb6('0x3b')]+'%'};return _0x19c577;})});}_0x1bc9d7=_[_0xadb6('0x3c')]({},_0x1bc9d7,_0x3ed51e[_0xadb6('0x3e')]);return _0x206196['getActions'](_0x1bc9d7);}})[_0xadb6('0x23')](function(_0x2b8946){if(_0x2b8946){_0x485495=_0x2b8946[_0xadb6('0x34')];if(!_0x3ed51e[_0xadb6('0x2e')]['hasOwnProperty'](_0xadb6('0x35'))){_0x1bc9d7[_0xadb6('0x1c')]=qs[_0xadb6('0x1c')](_0x3ed51e[_0xadb6('0x2e')][_0xadb6('0x1c')]);_0x1bc9d7[_0xadb6('0x19')]=qs[_0xadb6('0x19')](_0x3ed51e[_0xadb6('0x2e')]['offset']);}return _0x206196[_0xadb6('0x5a')](_0x1bc9d7);}})['then'](function(_0x3affcd){if(_0x3affcd){return _0x3affcd?{'count':_0x485495,'rows':_0x3affcd}:null;}})[_0xadb6('0x23')](respondWithResult(_0x548d38,null))['catch'](handleError(_0x548d38,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 128cc8f..6e08da8 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 _0x8b7c=['tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports','define','Trigger'];(function(_0x2b8722,_0x50d540){var _0x20c180=function(_0x595b40){while(--_0x595b40){_0x2b8722['push'](_0x2b8722['shift']());}};_0x20c180(++_0x50d540);}(_0x8b7c,0x119));var _0xc8b7=function(_0xaad974,_0x396049){_0xaad974=_0xaad974-0x0;var _0x3801e9=_0x8b7c[_0xaad974];return _0x3801e9;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var logger=require(_0xc8b7('0x2'))(_0xc8b7('0x3'));var moment=require(_0xc8b7('0x4'));var BPromise=require(_0xc8b7('0x5'));var rp=require(_0xc8b7('0x6'));var fs=require('fs');var path=require(_0xc8b7('0x7'));var rimraf=require('rimraf');var config=require(_0xc8b7('0x8'));var attributes=require(_0xc8b7('0x9'));module[_0xc8b7('0xa')]=function(_0x4a8b93,_0x256c78){return _0x4a8b93[_0xc8b7('0xb')](_0xc8b7('0xc'),attributes,{'tableName':_0xc8b7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7c8=['request-promise','path','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','util','../../config/logger','api','moment','bluebird'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb7c8,0x119));var _0x8b7c=function(_0x134569,_0x4fc102){_0x134569=_0x134569-0x0;var _0x3566d1=_0xb7c8[_0x134569];return _0x3566d1;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var logger=require(_0x8b7c('0x1'))(_0x8b7c('0x2'));var moment=require(_0x8b7c('0x3'));var BPromise=require(_0x8b7c('0x4'));var rp=require(_0x8b7c('0x5'));var fs=require('fs');var path=require(_0x8b7c('0x6'));var rimraf=require('rimraf');var config=require(_0x8b7c('0x7'));var attributes=require(_0x8b7c('0x8'));module[_0x8b7c('0x9')]=function(_0x440900,_0x107428){return _0x440900[_0x8b7c('0xa')](_0x8b7c('0xb'),attributes,{'tableName':_0x8b7c('0xc'),'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 b6441cd..6a9a9ed 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 _0xd643=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetTrigger','Trigger','findAll','options','attributes','limit','include','map','model','ShowTrigger','where','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x53a8d3,_0x1a0799){var _0x15e434=function(_0x21f7ac){while(--_0x21f7ac){_0x53a8d3['push'](_0x53a8d3['shift']());}};_0x15e434(++_0x1a0799);}(_0xd643,0x144));var _0x3d64=function(_0x43ab03,_0x42f57c){_0x43ab03=_0x43ab03-0x0;var _0x3cd45c=_0xd643[_0x43ab03];return _0x3cd45c;};'use strict';var _=require(_0x3d64('0x0'));var util=require(_0x3d64('0x1'));var moment=require(_0x3d64('0x2'));var BPromise=require('bluebird');var rs=require(_0x3d64('0x3'));var fs=require('fs');var Redis=require(_0x3d64('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d64('0x5'));var logger=require(_0x3d64('0x6'))(_0x3d64('0x7'));var config=require(_0x3d64('0x8'));var jayson=require(_0x3d64('0x9'));var client=jayson[_0x3d64('0xa')][_0x3d64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x328f67,_0x202c75,_0x4dbad1){return new BPromise(function(_0x2de871,_0x16c2bd){return client[_0x3d64('0xc')](_0x328f67,_0x4dbad1)[_0x3d64('0xd')](function(_0x381682){logger[_0x3d64('0xe')](_0x3d64('0xf'),_0x202c75,_0x3d64('0x10'));logger[_0x3d64('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0x202c75,_0x3d64('0x10'),JSON[_0x3d64('0x12')](_0x381682));if(_0x381682[_0x3d64('0x13')]){if(_0x381682['error']['code']===0x1f4){logger[_0x3d64('0x13')](_0x3d64('0xf'),_0x202c75,_0x381682[_0x3d64('0x13')][_0x3d64('0x14')]);return _0x16c2bd(_0x381682['error'][_0x3d64('0x14')]);}logger[_0x3d64('0x13')](_0x3d64('0xf'),_0x202c75,_0x381682[_0x3d64('0x13')]['message']);return _0x2de871(_0x381682[_0x3d64('0x13')][_0x3d64('0x14')]);}else{logger[_0x3d64('0xe')]('Trigger,\x20%s,\x20%s',_0x202c75,_0x3d64('0x10'));_0x2de871(_0x381682['result'][_0x3d64('0x14')]);}})[_0x3d64('0x15')](function(_0x3623b0){logger[_0x3d64('0x13')](_0x3d64('0xf'),_0x202c75,_0x3623b0);_0x16c2bd(_0x3623b0);});});}exports[_0x3d64('0x16')]=function(_0x4643bd){var _0x61465f=this;return new Promise(function(_0x4c6687,_0x431070){return db[_0x3d64('0x17')][_0x3d64('0x18')]({'raw':_0x4643bd['options']?_0x4643bd['options']['raw']===undefined?!![]:![]:!![],'where':_0x4643bd['options']?_0x4643bd[_0x3d64('0x19')]['where']||null:null,'attributes':_0x4643bd[_0x3d64('0x19')]?_0x4643bd[_0x3d64('0x19')][_0x3d64('0x1a')]||null:null,'limit':_0x4643bd[_0x3d64('0x19')]?_0x4643bd[_0x3d64('0x19')][_0x3d64('0x1b')]||null:null,'include':_0x4643bd[_0x3d64('0x19')]?_0x4643bd[_0x3d64('0x19')][_0x3d64('0x1c')]?_[_0x3d64('0x1d')](_0x4643bd['options']['include'],function(_0xe92475){return{'model':db[_0xe92475[_0x3d64('0x1e')]],'as':_0xe92475['as'],'attributes':_0xe92475[_0x3d64('0x1a')],'include':_0xe92475[_0x3d64('0x1c')]?_[_0x3d64('0x1d')](_0xe92475[_0x3d64('0x1c')],function(_0x4ab35a){return{'model':db[_0x4ab35a[_0x3d64('0x1e')]],'as':_0x4ab35a['as'],'attributes':_0x4ab35a[_0x3d64('0x1a')],'include':_0x4ab35a[_0x3d64('0x1c')]?_[_0x3d64('0x1d')](_0x4ab35a[_0x3d64('0x1c')],function(_0x4774b8){return{'model':db[_0x4774b8['model']],'as':_0x4774b8['as'],'attributes':_0x4774b8[_0x3d64('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3d64('0xd')](function(_0x32c03e){logger[_0x3d64('0xe')](_0x3d64('0x16'),_0x4643bd);logger[_0x3d64('0x11')]('GetTrigger',_0x4643bd,JSON['stringify'](_0x32c03e));_0x4c6687(_0x32c03e);})[_0x3d64('0x15')](function(_0x1474b6){logger[_0x3d64('0x13')](_0x3d64('0x16'),_0x1474b6[_0x3d64('0x14')],_0x4643bd);_0x431070(_0x61465f[_0x3d64('0x13')](0x1f4,_0x1474b6[_0x3d64('0x14')]));});});};exports[_0x3d64('0x1f')]=function(_0x5cbd5c){var _0x31b8ad=this;return new Promise(function(_0x8af57d,_0xcfea65){return db['Trigger']['find']({'raw':_0x5cbd5c[_0x3d64('0x19')]?_0x5cbd5c['options']['raw']===undefined?!![]:![]:!![],'where':_0x5cbd5c[_0x3d64('0x19')]?_0x5cbd5c[_0x3d64('0x19')][_0x3d64('0x20')]||null:null,'attributes':_0x5cbd5c['options']?_0x5cbd5c[_0x3d64('0x19')][_0x3d64('0x1a')]||null:null,'include':_0x5cbd5c[_0x3d64('0x19')]?_0x5cbd5c['options'][_0x3d64('0x1c')]?_[_0x3d64('0x1d')](_0x5cbd5c[_0x3d64('0x19')][_0x3d64('0x1c')],function(_0x2481ee){return{'model':db[_0x2481ee[_0x3d64('0x1e')]],'as':_0x2481ee['as'],'attributes':_0x2481ee[_0x3d64('0x1a')],'include':_0x2481ee[_0x3d64('0x1c')]?_[_0x3d64('0x1d')](_0x2481ee[_0x3d64('0x1c')],function(_0x116251){return{'model':db[_0x116251[_0x3d64('0x1e')]],'as':_0x116251['as'],'attributes':_0x116251[_0x3d64('0x1a')],'include':_0x116251[_0x3d64('0x1c')]?_[_0x3d64('0x1d')](_0x116251['include'],function(_0x1ffd79){return{'model':db[_0x1ffd79[_0x3d64('0x1e')]],'as':_0x1ffd79['as'],'attributes':_0x1ffd79[_0x3d64('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3d64('0xd')](function(_0x55626d){logger[_0x3d64('0xe')]('ShowTrigger',_0x5cbd5c);logger[_0x3d64('0x11')](_0x3d64('0x1f'),_0x5cbd5c,JSON[_0x3d64('0x12')](_0x55626d));_0x8af57d(_0x55626d);})[_0x3d64('0x15')](function(_0x5231c2){logger[_0x3d64('0x13')](_0x3d64('0x1f'),_0x5231c2[_0x3d64('0x14')],_0x5cbd5c);_0xcfea65(_0x31b8ad[_0x3d64('0x13')](0x1f4,_0x5231c2[_0x3d64('0x14')]));});});}; \ No newline at end of file +var _0x1203=['client','http','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTrigger','Trigger','options','raw','attributes','limit','include','model','map','then','catch','ShowTrigger','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xacc118,_0x3aa0d1){var _0x51c83d=function(_0x2a9e9f){while(--_0x2a9e9f){_0xacc118['push'](_0xacc118['shift']());}};_0x51c83d(++_0x3aa0d1);}(_0x1203,0x8c));var _0x3120=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1203[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3120('0x0'));var util=require(_0x3120('0x1'));var moment=require(_0x3120('0x2'));var BPromise=require(_0x3120('0x3'));var rs=require(_0x3120('0x4'));var fs=require('fs');var Redis=require(_0x3120('0x5'));var db=require(_0x3120('0x6'))['db'];var utils=require(_0x3120('0x7'));var logger=require(_0x3120('0x8'))(_0x3120('0x9'));var config=require(_0x3120('0xa'));var jayson=require(_0x3120('0xb'));var client=jayson[_0x3120('0xc')][_0x3120('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2ac620,_0x1f1c97,_0x5e9785){return new BPromise(function(_0x1fa4b8,_0x513da6){return client['request'](_0x2ac620,_0x5e9785)['then'](function(_0x580f86){logger[_0x3120('0xe')](_0x3120('0xf'),_0x1f1c97,'request\x20sent');logger[_0x3120('0x10')](_0x3120('0x11'),_0x1f1c97,_0x3120('0x12'),JSON[_0x3120('0x13')](_0x580f86));if(_0x580f86['error']){if(_0x580f86[_0x3120('0x14')][_0x3120('0x15')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x1f1c97,_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);return _0x513da6(_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);}logger[_0x3120('0x14')](_0x3120('0xf'),_0x1f1c97,_0x580f86[_0x3120('0x14')]['message']);return _0x1fa4b8(_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);}else{logger[_0x3120('0xe')](_0x3120('0xf'),_0x1f1c97,_0x3120('0x12'));_0x1fa4b8(_0x580f86[_0x3120('0x17')][_0x3120('0x16')]);}})['catch'](function(_0x308873){logger['error'](_0x3120('0xf'),_0x1f1c97,_0x308873);_0x513da6(_0x308873);});});}exports[_0x3120('0x18')]=function(_0x2bbdb7){var _0x1a513c=this;return new Promise(function(_0x3c8c9b,_0x3af913){return db[_0x3120('0x19')]['findAll']({'raw':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1b')]===undefined?!![]:![]:!![],'where':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7[_0x3120('0x1a')]['where']||null:null,'attributes':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1c')]||null:null,'limit':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1d')]||null:null,'include':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7[_0x3120('0x1a')][_0x3120('0x1e')]?_['map'](_0x2bbdb7[_0x3120('0x1a')]['include'],function(_0x444b3b){return{'model':db[_0x444b3b[_0x3120('0x1f')]],'as':_0x444b3b['as'],'attributes':_0x444b3b[_0x3120('0x1c')],'include':_0x444b3b['include']?_['map'](_0x444b3b[_0x3120('0x1e')],function(_0x7d0b5f){return{'model':db[_0x7d0b5f['model']],'as':_0x7d0b5f['as'],'attributes':_0x7d0b5f[_0x3120('0x1c')],'include':_0x7d0b5f[_0x3120('0x1e')]?_[_0x3120('0x20')](_0x7d0b5f['include'],function(_0x2636b5){return{'model':db[_0x2636b5[_0x3120('0x1f')]],'as':_0x2636b5['as'],'attributes':_0x2636b5[_0x3120('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3120('0x21')](function(_0x4b343b){logger['info']('GetTrigger',_0x2bbdb7);logger[_0x3120('0x10')]('GetTrigger',_0x2bbdb7,JSON[_0x3120('0x13')](_0x4b343b));_0x3c8c9b(_0x4b343b);})[_0x3120('0x22')](function(_0x3de290){logger[_0x3120('0x14')](_0x3120('0x18'),_0x3de290[_0x3120('0x16')],_0x2bbdb7);_0x3af913(_0x1a513c['error'](0x1f4,_0x3de290[_0x3120('0x16')]));});});};exports[_0x3120('0x23')]=function(_0x1471de){var _0x1ee7bc=this;return new Promise(function(_0x6ba5,_0x35e69f){return db[_0x3120('0x19')][_0x3120('0x24')]({'raw':_0x1471de['options']?_0x1471de['options'][_0x3120('0x1b')]===undefined?!![]:![]:!![],'where':_0x1471de[_0x3120('0x1a')]?_0x1471de[_0x3120('0x1a')][_0x3120('0x25')]||null:null,'attributes':_0x1471de[_0x3120('0x1a')]?_0x1471de[_0x3120('0x1a')]['attributes']||null:null,'include':_0x1471de[_0x3120('0x1a')]?_0x1471de[_0x3120('0x1a')][_0x3120('0x1e')]?_[_0x3120('0x20')](_0x1471de[_0x3120('0x1a')][_0x3120('0x1e')],function(_0x25f9cc){return{'model':db[_0x25f9cc['model']],'as':_0x25f9cc['as'],'attributes':_0x25f9cc[_0x3120('0x1c')],'include':_0x25f9cc[_0x3120('0x1e')]?_[_0x3120('0x20')](_0x25f9cc[_0x3120('0x1e')],function(_0x3067ca){return{'model':db[_0x3067ca[_0x3120('0x1f')]],'as':_0x3067ca['as'],'attributes':_0x3067ca[_0x3120('0x1c')],'include':_0x3067ca[_0x3120('0x1e')]?_[_0x3120('0x20')](_0x3067ca[_0x3120('0x1e')],function(_0x2fb199){return{'model':db[_0x2fb199[_0x3120('0x1f')]],'as':_0x2fb199['as'],'attributes':_0x2fb199[_0x3120('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x496364){logger[_0x3120('0xe')](_0x3120('0x23'),_0x1471de);logger[_0x3120('0x10')]('ShowTrigger',_0x1471de,JSON[_0x3120('0x13')](_0x496364));_0x6ba5(_0x496364);})[_0x3120('0x22')](function(_0x90f45){logger['error'](_0x3120('0x23'),_0x90f45[_0x3120('0x16')],_0x1471de);_0x35e69f(_0x1ee7bc[_0x3120('0x14')](0x1f4,_0x90f45[_0x3120('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index de886a7..2c596e8 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 _0x84b4=['../../config/environment','get','isAuthenticated','index','show','post','/:id/clone','clone','create','/:id','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0x84b4,0xfd));var _0x484b=function(_0x1a8d04,_0xa353b5){_0x1a8d04=_0x1a8d04-0x0;var _0x22b930=_0x84b4[_0x1a8d04];return _0x22b930;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x484b('0x0'));var timeout=require(_0x484b('0x1'));var express=require(_0x484b('0x2'));var router=express[_0x484b('0x3')]();var fs_extra=require(_0x484b('0x4'));var auth=require(_0x484b('0x5'));var interaction=require(_0x484b('0x6'));var config=require(_0x484b('0x7'));var controller=require('./trunk.controller');router[_0x484b('0x8')]('/',auth[_0x484b('0x9')](),controller[_0x484b('0xa')]);router[_0x484b('0x8')]('/:id',auth[_0x484b('0x9')](),controller[_0x484b('0xb')]);router[_0x484b('0xc')](_0x484b('0xd'),auth['isAuthenticated'](),controller[_0x484b('0xe')]);router['post']('/',auth[_0x484b('0x9')](),controller[_0x484b('0xf')]);router['put'](_0x484b('0x10'),auth[_0x484b('0x9')](),controller['update']);router[_0x484b('0x11')]('/:id',auth[_0x484b('0x9')](),controller[_0x484b('0x12')]);module[_0x484b('0x13')]=router; \ No newline at end of file +var _0x0533=['../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','show','/:id/clone','clone','create','/:id','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x464aae,_0x3098d3){var _0x29fc2d=function(_0x1374d3){while(--_0x1374d3){_0x464aae['push'](_0x464aae['shift']());}};_0x29fc2d(++_0x3098d3);}(_0x0533,0xd0));var _0x3053=function(_0x6d0c32,_0x39a2e8){_0x6d0c32=_0x6d0c32-0x0;var _0x3f14d2=_0x0533[_0x6d0c32];return _0x3f14d2;};'use strict';var multer=require(_0x3053('0x0'));var util=require(_0x3053('0x1'));var path=require(_0x3053('0x2'));var timeout=require(_0x3053('0x3'));var express=require(_0x3053('0x4'));var router=express[_0x3053('0x5')]();var fs_extra=require(_0x3053('0x6'));var auth=require(_0x3053('0x7'));var interaction=require(_0x3053('0x8'));var config=require(_0x3053('0x9'));var controller=require(_0x3053('0xa'));router[_0x3053('0xb')]('/',auth[_0x3053('0xc')](),controller['index']);router['get']('/:id',auth[_0x3053('0xc')](),controller[_0x3053('0xd')]);router['post'](_0x3053('0xe'),auth['isAuthenticated'](),controller[_0x3053('0xf')]);router['post']('/',auth[_0x3053('0xc')](),controller[_0x3053('0x10')]);router['put'](_0x3053('0x11'),auth[_0x3053('0xc')](),controller['update']);router['delete']('/:id',auth[_0x3053('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index f47e89f..d5668e7 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 _0x281c=['setDataValue','transport','getDataValue','rfc2833','info','shortinfo','inband','yes','outgoing','force_rport,comedia','nat','join','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','accept','originate','uas','pai','fingerprint','certificate','passive','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp'];(function(_0x3e27ba,_0x46b120){var _0x10b3f2=function(_0x330316){while(--_0x330316){_0x3e27ba['push'](_0x3e27ba['shift']());}};_0x10b3f2(++_0x46b120);}(_0x281c,0x139));var _0xc281=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x281c[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xc281('0x0'));module[_0xc281('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc281('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x4'),_0xc281('0x5'),_0xc281('0x6')),'allowNull':![],'defaultValue':_0xc281('0x4')},'context':{'type':Sequelize[_0xc281('0x7')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x8'),_0xc281('0x9'),_0xc281('0xa'),_0xc281('0xb'),_0xc281('0xc'),'PROHIB_PASSED_SCREEN',_0xc281('0xd'),_0xc281('0xe'))},'deny':{'type':Sequelize[_0xc281('0x7')]},'permit':{'type':Sequelize[_0xc281('0x7')]},'secret':{'type':Sequelize[_0xc281('0x7')]},'md5secret':{'type':Sequelize[_0xc281('0x7')]},'remotesecret':{'type':Sequelize[_0xc281('0x7')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xc281('0xf'),'set':function(_0x3cb96d){this[_0xc281('0x10')](_0xc281('0x11'),_0x3cb96d?_0x3cb96d['join'](','):null);},'get':function(){return this['getDataValue'](_0xc281('0x11'))?this[_0xc281('0x12')](_0xc281('0x11'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0xc281('0x13'),_0xc281('0x14'),_0xc281('0x15'),_0xc281('0x16'),'auto'),'defaultValue':_0xc281('0x13')},'directmedia':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no','nonat','update',_0xc281('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc281('0x7')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xc281('0x19'),'set':function(_0x3d3a2f){this['setDataValue'](_0xc281('0x1a'),_0x3d3a2f?_0x3d3a2f[_0xc281('0x1b')](','):null);},'get':function(){return this['getDataValue'](_0xc281('0x1a'))?this[_0xc281('0x12')](_0xc281('0x1a'))[_0xc281('0x1c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xc281('0x7')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc281('0x7')]},'language':{'type':Sequelize[_0xc281('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc281('0x7')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc281('0x7')],'defaultValue':_0xc281('0x1d')},'allow':{'type':Sequelize[_0xc281('0x7')],'allowNull':![],'defaultValue':_0xc281('0x1e'),'set':function(_0x1e6e6a){this[_0xc281('0x10')]('allow',_0x1e6e6a?_0x1e6e6a[_0xc281('0x1b')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xc281('0x12')](_0xc281('0x1f'))?this['getDataValue']('allow')[_0xc281('0x1c')](';'):null;},'comment':_0xc281('0x20')},'autoframing':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no')},'insecure':{'type':Sequelize[_0xc281('0x7')],'defaultValue':'port,invite','set':function(_0x442e3f){this[_0xc281('0x10')](_0xc281('0x21'),_0x442e3f?_0x442e3f[_0xc281('0x1b')](','):null);},'get':function(){return this['getDataValue'](_0xc281('0x21'))?this[_0xc281('0x12')](_0xc281('0x21'))[_0xc281('0x1c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xc281('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xc281('0x17'),'no',_0xc281('0x22'))},'promiscredir':{'type':Sequelize[_0xc281('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no')},'accountcode':{'type':Sequelize[_0xc281('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc281('0x7')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no'),'defaultValue':_0xc281('0x17')},'busylevel':{'type':Sequelize[_0xc281('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0xc281('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xc281('0x7')]},'template':{'type':Sequelize[_0xc281('0x7')]},'videosupport':{'type':Sequelize[_0xc281('0x3')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc281('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x24'),'refuse',_0xc281('0x25'))},'session_expires':{'type':Sequelize[_0xc281('0x23')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xc281('0x3')]('uac',_0xc281('0x26')),'defaultValue':_0xc281('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0xc281('0x7')]},'regexten':{'type':Sequelize[_0xc281('0x7')]},'fromdomain':{'type':Sequelize[_0xc281('0x7')]},'fromuser':{'type':Sequelize[_0xc281('0x7')]},'port':{'type':Sequelize[_0xc281('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xc281('0x17'),'no'),'defaultValue':_0xc281('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xc281('0x7')]},'defaultuser':{'type':Sequelize[_0xc281('0x7')]},'rtptimeout':{'type':Sequelize[_0xc281('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc281('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc281('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no',_0xc281('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc281('0x7')]},'callbackextension':{'type':Sequelize[_0xc281('0x7')]},'timert1':{'type':Sequelize[_0xc281('0x23')](0xb)},'timerb':{'type':Sequelize[_0xc281('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc281('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0xc281('0x7')]},'contactdeny':{'type':Sequelize[_0xc281('0x7')]},'contactacl':{'type':Sequelize[_0xc281('0x7')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc281('0x3')]('yes','no')},'force_avp':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no')},'icesupport':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0xc281('0x3')](_0xc281('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0xc281('0x3')]('yes','no',_0xc281('0x28'),_0xc281('0x29'))},'dtlsrekey':{'type':Sequelize[_0xc281('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc281('0x7')]},'dtlsprivatekey':{'type':Sequelize[_0xc281('0x7')]},'dtlscipher':{'type':Sequelize[_0xc281('0x7')]},'dtlscafile':{'type':Sequelize[_0xc281('0x7')]},'dtlscapath':{'type':Sequelize[_0xc281('0x7')]},'dtlssetup':{'type':Sequelize[_0xc281('0x3')]('active',_0xc281('0x2a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc281('0x7')]},'usereqphone':{'type':Sequelize['ENUM'](_0xc281('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xc281('0x7')]},'call_limit':{'type':Sequelize[_0xc281('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xc281('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0xc281('0x3')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xc281('0x7')]},'mohsuggest':{'type':Sequelize[_0xc281('0x7')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xc281('0x7')],'defaultValue':_0xc281('0x2b')},'canreinvite':{'type':Sequelize['ENUM'](_0xc281('0x17'),'no','nonat',_0xc281('0x2c'),_0xc281('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc281('0x7')]},'otherFields':{'type':Sequelize[_0xc281('0x7')]},'active':{'type':Sequelize[_0xc281('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc281('0x7')],'defaultValue':'no'}}; \ No newline at end of file +var _0x1833=['from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','udp','setDataValue','getDataValue','split','rfc2833','inband','auto','yes','nonat','update','outgoing','nat','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','always','accept','refuse','originate','uac','pai','certificate','passive','BOOLEAN','exports','STRING','ENUM','friend','peer'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1833,0x175));var _0x3183=function(_0x314ea9,_0x3c6626){_0x314ea9=_0x314ea9-0x0;var _0xa52b7b=_0x1833[_0x314ea9];return _0xa52b7b;};'use strict';var Sequelize=require('sequelize');module[_0x3183('0x0')]={'name':{'type':Sequelize[_0x3183('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x3'),'user',_0x3183('0x4')),'allowNull':![],'defaultValue':_0x3183('0x3')},'context':{'type':Sequelize[_0x3183('0x1')],'allowNull':![],'defaultValue':_0x3183('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x3183('0x6'),_0x3183('0x7'),_0x3183('0x8'),_0x3183('0x9'),_0x3183('0xa'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x3183('0xb'))},'deny':{'type':Sequelize[_0x3183('0x1')]},'permit':{'type':Sequelize[_0x3183('0x1')]},'secret':{'type':Sequelize[_0x3183('0x1')]},'md5secret':{'type':Sequelize[_0x3183('0x1')]},'remotesecret':{'type':Sequelize[_0x3183('0x1')]},'transport':{'type':Sequelize[_0x3183('0x1')],'defaultValue':_0x3183('0xc'),'set':function(_0xb680c9){this[_0x3183('0xd')]('transport',_0xb680c9?_0xb680c9['join'](','):null);},'get':function(){return this[_0x3183('0xe')]('transport')?this['getDataValue']('transport')[_0x3183('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x10'),'info','shortinfo',_0x3183('0x11'),_0x3183('0x12')),'defaultValue':_0x3183('0x10')},'directmedia':{'type':Sequelize['ENUM'](_0x3183('0x13'),'no',_0x3183('0x14'),_0x3183('0x15'),_0x3183('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x3183('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3183('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x3183('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x120b25){this[_0x3183('0xd')]('nat',_0x120b25?_0x120b25['join'](','):null);},'get':function(){return this[_0x3183('0xe')]('nat')?this[_0x3183('0xe')](_0x3183('0x17'))[_0x3183('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x3183('0x1')]},'namedcallgroup':{'type':Sequelize[_0x3183('0x1')]},'pickupgroup':{'type':Sequelize[_0x3183('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x3183('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3183('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3183('0x1')],'defaultValue':_0x3183('0x18')},'allow':{'type':Sequelize[_0x3183('0x1')],'allowNull':![],'defaultValue':_0x3183('0x19'),'set':function(_0x42c7b9){this[_0x3183('0xd')](_0x3183('0x1a'),_0x42c7b9?_0x42c7b9['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x3183('0x1a'))?this[_0x3183('0xe')](_0x3183('0x1a'))[_0x3183('0xf')](';'):null;},'comment':_0x3183('0x1b')},'autoframing':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'insecure':{'type':Sequelize[_0x3183('0x1')],'defaultValue':_0x3183('0x1c'),'set':function(_0xd4f540){this[_0x3183('0xd')](_0x3183('0x1d'),_0xd4f540?_0xd4f540['join'](','):null);},'get':function(){return this[_0x3183('0xe')](_0x3183('0x1d'))?this[_0x3183('0xe')](_0x3183('0x1d'))[_0x3183('0xf')](','):null;},'comment':_0x3183('0x1e')},'trustrpid':{'type':Sequelize['ENUM'](_0x3183('0x13'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3183('0x2')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3183('0x2')]('yes','no',_0x3183('0x1f'))},'promiscredir':{'type':Sequelize[_0x3183('0x2')]('yes','no')},'useclientcode':{'type':Sequelize[_0x3183('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0x3183('0x20')](0xb)},'setvar':{'type':Sequelize[_0x3183('0x1')]},'callerid':{'type':Sequelize[_0x3183('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x3183('0x1')]},'callcounter':{'type':Sequelize[_0x3183('0x2')]('yes','no'),'defaultValue':_0x3183('0x13')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'allowsubscribe':{'type':Sequelize[_0x3183('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0x3183('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x3183('0x2')]('yes','no',_0x3183('0x21')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'mailbox':{'type':Sequelize[_0x3183('0x1')]},'session_timers':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x22'),_0x3183('0x23'),_0x3183('0x24'))},'session_expires':{'type':Sequelize[_0x3183('0x20')](0xb)},'session_minse':{'type':Sequelize[_0x3183('0x20')](0xb)},'session_refresher':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x25'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x3183('0x1')]},'regexten':{'type':Sequelize[_0x3183('0x1')]},'fromdomain':{'type':Sequelize[_0x3183('0x1')]},'fromuser':{'type':Sequelize[_0x3183('0x1')]},'port':{'type':Sequelize[_0x3183('0x20')](0x5)},'qualify':{'type':Sequelize[_0x3183('0x2')]('yes','no'),'defaultValue':_0x3183('0x13')},'keepalive':{'type':Sequelize[_0x3183('0x20')](0xb)},'defaultip':{'type':Sequelize[_0x3183('0x1')]},'defaultuser':{'type':Sequelize[_0x3183('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3183('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x3183('0x26')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x3183('0x1')]},'timert1':{'type':Sequelize[_0x3183('0x20')](0xb)},'timerb':{'type':Sequelize[_0x3183('0x20')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3183('0x20')](0xb)},'contactpermit':{'type':Sequelize[_0x3183('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x3183('0x1')]},'use_q850_reason':{'type':Sequelize[_0x3183('0x1')]},'maxforwards':{'type':Sequelize[_0x3183('0x20')](0xb)},'encryption':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3183('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'icesupport':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'dtlsenable':{'type':Sequelize[_0x3183('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no','fingerprint',_0x3183('0x27'))},'dtlsrekey':{'type':Sequelize[_0x3183('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3183('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x3183('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x3183('0x1')]},'dtlscapath':{'type':Sequelize[_0x3183('0x1')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x3183('0x28'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3183('0x1')]},'usereqphone':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3183('0x1')]},'recordofffeature':{'type':Sequelize[_0x3183('0x1')]},'call_limit':{'type':Sequelize[_0x3183('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'subscribemwi':{'type':Sequelize[_0x3183('0x2')](_0x3183('0x13'),'no')},'vmexten':{'type':Sequelize[_0x3183('0x1')]},'mohinterpret':{'type':Sequelize[_0x3183('0x1')]},'mohsuggest':{'type':Sequelize[_0x3183('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3183('0x1')]},'host':{'type':Sequelize[_0x3183('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x3183('0x13'),'no',_0x3183('0x14'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x3183('0x1')]},'active':{'type':Sequelize[_0x3183('0x29')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3183('0x1')],'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 43c1821..6f4b958 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 _0xd6d6=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','Trunk','includeAll','include','findAll','rows','show','params','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','role','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x56840f,_0x32c57d){var _0x47510a=function(_0x513406){while(--_0x513406){_0x56840f['push'](_0x56840f['shift']());}};_0x47510a(++_0x32c57d);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5f4d66,_0x4c11f0){_0x5f4d66=_0x5f4d66-0x0;var _0x362014=_0xd6d6[_0x5f4d66];return _0x362014;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];var jayson=require(_0x6d6d('0x19'));var client=jayson[_0x6d6d('0x1a')][_0x6d6d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b74ed,_0x41fbdf,_0x19cf50,_0x2cb2dd){return new BPromise(function(_0x5f4154,_0xd09ea7){var _0x3dd4b3=_0x2cb2dd||client;return _0x3dd4b3[_0x6d6d('0x1c')](_0x2b74ed,_0x19cf50)[_0x6d6d('0x1d')](function(_0x29cbd8){logger['info'](_0x6d6d('0x1e'),_0x41fbdf,'request\x20sent');logger[_0x6d6d('0x1f')](_0x6d6d('0x20'),_0x41fbdf,_0x6d6d('0x21'),JSON['stringify'](_0x29cbd8));if(_0x29cbd8['error']){if(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x23')]===0x1f4){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8['error']['message']);return _0xd09ea7(_0x29cbd8[_0x6d6d('0x22')]['message']);}logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);return _0x5f4154(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);}else{logger[_0x6d6d('0x25')](_0x6d6d('0x1e'),_0x41fbdf,_0x6d6d('0x21'));_0x5f4154(_0x29cbd8[_0x6d6d('0x26')][_0x6d6d('0x24')]);}})[_0x6d6d('0x27')](function(_0x466a29){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x466a29);_0xd09ea7(_0x466a29);});});}function respondWithStatusCode(_0x25a02e,_0xced622){_0xced622=_0xced622||0xcc;return function(_0x583b10){if(_0x583b10){return _0x25a02e[_0x6d6d('0x28')](_0xced622);}return _0x25a02e[_0x6d6d('0x29')](_0xced622)[_0x6d6d('0x2a')]();};}function respondWithResult(_0x97ec9e,_0xf0df7f){_0xf0df7f=_0xf0df7f||0xc8;return function(_0x12fab2){if(_0x12fab2){return _0x97ec9e['status'](_0xf0df7f)[_0x6d6d('0x2b')](_0x12fab2);}};}function respondWithFilteredResult(_0x2b5e31,_0x235451){return function(_0x126ac8){if(_0x126ac8){var _0x25c121=typeof _0x235451[_0x6d6d('0x2c')]===_0x6d6d('0x2d')&&typeof _0x235451['limit']===_0x6d6d('0x2d');var _0x9595d8=_0x126ac8['count'];var _0x553645=_0x25c121?0x0:_0x235451[_0x6d6d('0x2c')];var _0x5273cd=_0x25c121?_0x126ac8[_0x6d6d('0x2e')]:_0x235451['offset']+_0x235451[_0x6d6d('0x2f')];var _0x20255e;if(_0x5273cd>=_0x9595d8){_0x5273cd=_0x9595d8;_0x20255e=0xc8;}else{_0x20255e=0xce;}_0x2b5e31[_0x6d6d('0x29')](_0x20255e);return _0x2b5e31[_0x6d6d('0x30')](_0x6d6d('0x31'),_0x553645+'-'+_0x5273cd+'/'+_0x9595d8)[_0x6d6d('0x2b')](_0x126ac8);}return null;};}function patchUpdates(_0xdda3f2){return function(_0x359cfd){try{jsonpatch[_0x6d6d('0x32')](_0x359cfd,_0xdda3f2,!![]);}catch(_0x34050a){return BPromise['reject'](_0x34050a);}return _0x359cfd[_0x6d6d('0x33')]();};}function saveUpdates(_0x4f1fc5,_0x18015a){return function(_0x1ea9b2){if(_0x1ea9b2){return _0x1ea9b2[_0x6d6d('0x34')](_0x4f1fc5)[_0x6d6d('0x1d')](function(_0x5c6248){return _0x5c6248;});}return null;};}function removeEntity(_0x182441,_0x4f2f13){return function(_0x3cc702){if(_0x3cc702){return _0x3cc702[_0x6d6d('0x35')]()['then'](function(){var _0x37993f=_0x3cc702[_0x6d6d('0x36')]({'plain':!![]});var _0x37ac94=_0x6d6d('0x37');return db[_0x6d6d('0x38')][_0x6d6d('0x35')]({'where':{'type':_0x37ac94,'resourceId':_0x37993f['id']}})[_0x6d6d('0x1d')](function(){return _0x3cc702;});})[_0x6d6d('0x1d')](function(){_0x182441[_0x6d6d('0x29')](0xcc)[_0x6d6d('0x2a')]();});}};}function handleEntityNotFound(_0x2fcf88,_0x3693da){return function(_0x17d863){if(!_0x17d863){_0x2fcf88[_0x6d6d('0x28')](0x194);}return _0x17d863;};}function handleError(_0x5a2397,_0x1335ef){_0x1335ef=_0x1335ef||0x1f4;return function(_0xf98bfa){logger[_0x6d6d('0x22')](_0xf98bfa[_0x6d6d('0x39')]);if(_0xf98bfa['name']){delete _0xf98bfa['name'];}_0x5a2397[_0x6d6d('0x29')](_0x1335ef)[_0x6d6d('0x3a')](_0xf98bfa);};}exports[_0x6d6d('0x3b')]=function(_0x4d42ff,_0x2a3f67){var _0x2607c1={},_0x23c173={},_0x125d79={'count':0x0,'rows':[]};var _0x52556b=_['map'](db['Trunk'][_0x6d6d('0x3c')],function(_0x4196f0){return{'name':_0x4196f0[_0x6d6d('0x3d')],'type':_0x4196f0[_0x6d6d('0x3e')]['key']};});_0x23c173[_0x6d6d('0x3f')]=_[_0x6d6d('0x40')](_0x52556b,_0x6d6d('0x41'));_0x23c173[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x4d42ff[_0x6d6d('0x42')]);_0x23c173['filters']=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],_0x23c173[_0x6d6d('0x42')]);_0x2607c1[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x4d42ff['query'][_0x6d6d('0x46')]));_0x2607c1[_0x6d6d('0x45')]=_0x2607c1[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x2607c1[_0x6d6d('0x45')]:_0x23c173['model'];if(!_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x48')]('nolimit')){_0x2607c1[_0x6d6d('0x2f')]=qs['limit'](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2f')]);_0x2607c1['offset']=qs[_0x6d6d('0x2c')](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2c')]);}_0x2607c1[_0x6d6d('0x49')]=qs[_0x6d6d('0x4a')](_0x4d42ff['query']['sort']);_0x2607c1[_0x6d6d('0x4b')]=qs['filters'](_['pick'](_0x4d42ff[_0x6d6d('0x42')],_0x23c173[_0x6d6d('0x4c')]),_0x52556b);if(_0x4d42ff[_0x6d6d('0x42')]['filter']){_0x2607c1[_0x6d6d('0x4b')]=_['merge'](_0x2607c1[_0x6d6d('0x4b')],{'$or':_[_0x6d6d('0x40')](_0x52556b,function(_0x1d3826){if(_0x1d3826[_0x6d6d('0x3e')]!==_0x6d6d('0x4d')){var _0x2669f0={};_0x2669f0[_0x1d3826[_0x6d6d('0x41')]]={'$like':'%'+_0x4d42ff['query'][_0x6d6d('0x4e')]+'%'};return _0x2669f0;}})});}_0x2607c1=_[_0x6d6d('0x4f')]({},_0x2607c1,_0x4d42ff[_0x6d6d('0x50')]);var _0x389e51={'where':_0x2607c1[_0x6d6d('0x4b')]};return db[_0x6d6d('0x51')][_0x6d6d('0x2e')](_0x389e51)[_0x6d6d('0x1d')](function(_0x24cec2){_0x125d79['count']=_0x24cec2;if(_0x4d42ff['query'][_0x6d6d('0x52')]){_0x2607c1[_0x6d6d('0x53')]=[{'all':!![]}];}return db[_0x6d6d('0x51')][_0x6d6d('0x54')](_0x2607c1);})[_0x6d6d('0x1d')](function(_0x492834){_0x125d79[_0x6d6d('0x55')]=_0x492834;return _0x125d79;})[_0x6d6d('0x1d')](respondWithFilteredResult(_0x2a3f67,_0x2607c1))[_0x6d6d('0x27')](handleError(_0x2a3f67,null));};exports[_0x6d6d('0x56')]=function(_0x2ee917,_0x23c2db){var _0x1f7a09={'raw':![],'where':{'id':_0x2ee917[_0x6d6d('0x57')]['id']}},_0x39ec2a={};_0x39ec2a[_0x6d6d('0x3f')]=_[_0x6d6d('0x43')](db[_0x6d6d('0x51')]['rawAttributes']);_0x39ec2a[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x2ee917[_0x6d6d('0x42')]);_0x39ec2a[_0x6d6d('0x4c')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],_0x39ec2a[_0x6d6d('0x42')]);_0x1f7a09[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],qs['fields'](_0x2ee917[_0x6d6d('0x42')]['fields']));_0x1f7a09[_0x6d6d('0x45')]=_0x1f7a09[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x1f7a09[_0x6d6d('0x45')]:_0x39ec2a[_0x6d6d('0x3f')];if(_0x2ee917[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x1f7a09[_0x6d6d('0x53')]=[{'all':!![]}];}_0x1f7a09=_[_0x6d6d('0x4f')]({},_0x1f7a09,_0x2ee917[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x1f7a09)[_0x6d6d('0x1d')](handleEntityNotFound(_0x23c2db,null))[_0x6d6d('0x1d')](respondWithResult(_0x23c2db,null))[_0x6d6d('0x27')](handleError(_0x23c2db,null));};exports[_0x6d6d('0x59')]=function(_0x45f44a,_0x243be3){var _0x5e5ace={'where':{'id':_0x45f44a[_0x6d6d('0x57')]['id']}},_0x5a1cdc={};_0x5a1cdc[_0x6d6d('0x3f')]=_['keys'](db[_0x6d6d('0x51')][_0x6d6d('0x3c')]);_0x5e5ace[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x5a1cdc[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x46')]));_0x5e5ace[_0x6d6d('0x45')]=_0x5e5ace[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x5e5ace[_0x6d6d('0x45')]:_0x5a1cdc[_0x6d6d('0x3f')];if(_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x5e5ace['include']=[{'all':!![]}];}_0x5e5ace=_[_0x6d6d('0x4f')]({},_0x5e5ace,_0x45f44a[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x5e5ace)[_0x6d6d('0x1d')](handleEntityNotFound(_0x243be3,null))[_0x6d6d('0x1d')](function(_0x407357){if(_0x407357){var _0x2d61cc=_0x407357[_0x6d6d('0x36')]({'plain':!![]});_0x2d61cc=qs[_0x6d6d('0x5a')](_0x2d61cc,['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);_0x45f44a['body']=_['omit'](_0x45f44a[_0x6d6d('0x5d')],['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);return db['Trunk']['create'](_[_0x6d6d('0x4f')](_0x2d61cc,_0x45f44a['body']),{'include':_0x45f44a[_0x6d6d('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0x6d6d('0x1d')](function(_0x367a6f){var _0x21f14c=_0x45f44a[_0x6d6d('0x5e')][_0x6d6d('0x36')]({'plain':!![]});if(!_0x21f14c)throw new Error(_0x6d6d('0x5f'));if(_0x21f14c['role']===_0x6d6d('0x5e')){var _0x5eb78f=_0x367a6f[_0x6d6d('0x36')]({'plain':!![]});var _0x52d9e7=_0x6d6d('0x37');return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x52d9e7,'userProfileId':_0x21f14c[_0x6d6d('0x61')]},'raw':!![]})[_0x6d6d('0x1d')](function(_0x163bb7){if(_0x163bb7&&_0x163bb7[_0x6d6d('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x5eb78f[_0x6d6d('0x41')],'resourceId':_0x5eb78f['id'],'type':_0x163bb7['name'],'sectionId':_0x163bb7['id']},{})[_0x6d6d('0x1d')](function(){return _0x367a6f;});}else{return _0x367a6f;}})['catch'](function(_0xe19d23){logger[_0x6d6d('0x22')](_0x6d6d('0x63'),_0xe19d23);throw _0xe19d23;});}return _0x367a6f;});}})[_0x6d6d('0x1d')](respondWithResult(_0x243be3,0xc9))[_0x6d6d('0x27')](handleError(_0x243be3,null));};exports[_0x6d6d('0x64')]=function(_0x5dd3b0,_0x3cedc0,_0xbca58e){var _0x3a6d79;return db[_0x6d6d('0x51')][_0x6d6d('0x64')](_0x5dd3b0[_0x6d6d('0x5d')],{'raw':!![]})[_0x6d6d('0x1d')](function(_0x589d64){_0x3a6d79=_0x589d64;return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0x3bf8a7){var _0x1aa25d=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x1efc55=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5b6ca7=ejs[_0x6d6d('0x6a')](_0x1aa25d,{'trunks':_0x3bf8a7||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x5b6ca7);if(_0x3a6d79[_0x6d6d('0x6d')]){var _0x2d4a04=ejs[_0x6d6d('0x6a')](_0x1efc55,{'trunks':_0x3bf8a7||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2d4a04);}})[_0x6d6d('0x1d')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x6d6d('0x1d')](function(){var _0x5cd494=_0x5dd3b0[_0x6d6d('0x5e')]['get']({'plain':!![]});if(!_0x5cd494)throw new Error(_0x6d6d('0x5f'));if(_0x5cd494[_0x6d6d('0x6e')]==='user'){var _0x52dca9=_0x3a6d79[_0x6d6d('0x36')]({'plain':!![]});return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x6d6d('0x37'),'userProfileId':_0x5cd494['userProfileId']},'raw':!![]})[_0x6d6d('0x1d')](function(_0x264d24){if(_0x264d24&&_0x264d24[_0x6d6d('0x62')]===0x0){return db[_0x6d6d('0x38')]['create']({'name':_0x52dca9[_0x6d6d('0x41')],'resourceId':_0x52dca9['id'],'type':_0x264d24['name'],'sectionId':_0x264d24['id']},{})['then'](function(){return _0x3a6d79;});}else{return _0x3a6d79;}})['catch'](function(_0x3da125){logger['error'](_0x6d6d('0x63'),_0x3da125);throw _0x3da125;});}return _0x3a6d79;})[_0x6d6d('0x1d')](respondWithResult(_0x3cedc0,0xc9))[_0x6d6d('0x27')](handleError(_0x3cedc0,null));};exports['update']=function(_0x5146a4,_0x55d877,_0xcba8dd){var _0x542386;return db['Trunk'][_0x6d6d('0x58')]({'where':{'id':_0x5146a4[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x55d877,null))[_0x6d6d('0x1d')](saveUpdates(_0x5146a4[_0x6d6d('0x5d')],null))[_0x6d6d('0x1d')](function(_0x3f9aad){if(_0x3f9aad){_0x542386=_0x3f9aad;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x5c20c5){if(_0x5c20c5){var _0x54bdef=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x59998e=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],_0x6d6d('0x6f')),_0x6d6d('0x69'));var _0x1c8d15=ejs['render'](_0x54bdef,{'trunks':_0x5c20c5||[]});fs['writeFileSync'](_0x6d6d('0x6c'),_0x1c8d15);var _0x1e1c4e=ejs['render'](_0x59998e,{'trunks':_0x5c20c5||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x1e1c4e);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x34'),{'module':_0x6d6d('0x72')});}return null;})['then'](function(_0xf5586f){if(_0xf5586f){return _0x542386;}})['then'](respondWithResult(_0x55d877,null))[_0x6d6d('0x27')](handleError(_0x55d877,null));};exports['destroy']=function(_0x108108,_0x54a5a9,_0x445196){var _0x1bfce6;return db[_0x6d6d('0x51')][_0x6d6d('0x58')]({'where':{'id':_0x108108[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x54a5a9,null))[_0x6d6d('0x1d')](removeEntity(_0x54a5a9,null))[_0x6d6d('0x1d')](function(){return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0xb2940d){var _0x7c1934=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/trunk.ejs'),'utf8');var _0x139b61=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x1d2668=ejs['render'](_0x7c1934,{'trunks':_0xb2940d});var _0x2ab52f=ejs[_0x6d6d('0x6a')](_0x139b61,{'trunks':_0xb2940d});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x1d2668);fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x2ab52f);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x35'),{'module':'chan_sip.so'});})[_0x6d6d('0x27')](handleError(_0x54a5a9,null));}; \ No newline at end of file +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(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x81bd,0x7c));var _0xd81b=function(_0x5ba35a,_0x5e5113){_0x5ba35a=_0x5ba35a-0x0;var _0x5900dc=_0x81bd[_0x5ba35a];return _0x5900dc;};'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 diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 2bf24d2..f66b59c 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 _0x413b=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./trunk.attributes','define','tools_trunks','lodash'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x413b,0x1cd));var _0xb413=function(_0x5dcfd0,_0x19b914){_0x5dcfd0=_0x5dcfd0-0x0;var _0x5e7661=_0x413b[_0x5dcfd0];return _0x5e7661;};'use strict';var _=require(_0xb413('0x0'));var util=require(_0xb413('0x1'));var logger=require(_0xb413('0x2'))(_0xb413('0x3'));var moment=require(_0xb413('0x4'));var BPromise=require('bluebird');var rp=require(_0xb413('0x5'));var fs=require('fs');var path=require(_0xb413('0x6'));var rimraf=require('rimraf');var config=require(_0xb413('0x7'));var attributes=require(_0xb413('0x8'));module['exports']=function(_0x257ae1,_0x27883a){return _0x257ae1[_0xb413('0x9')]('Trunk',attributes,{'tableName':_0xb413('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbb8=['Trunk','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0xdbb8,0x1e2));var _0x8dbb=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0xdbb8[_0x18aaaf];return _0x52d892;};'use strict';var _=require(_0x8dbb('0x0'));var util=require(_0x8dbb('0x1'));var logger=require(_0x8dbb('0x2'))(_0x8dbb('0x3'));var moment=require(_0x8dbb('0x4'));var BPromise=require(_0x8dbb('0x5'));var rp=require(_0x8dbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8dbb('0x7'));var config=require(_0x8dbb('0x8'));var attributes=require(_0x8dbb('0x9'));module[_0x8dbb('0xa')]=function(_0x510d31,_0x29ea12){return _0x510d31[_0x8dbb('0xb')](_0x8dbb('0xc'),attributes,{'tableName':'tools_trunks','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 e8c4904..aa0565b 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 _0x5a9c=['GetTrunk','Trunk','options','attributes','limit','map','include','model','stringify','ShowTrunk','find','raw','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','Trunk,\x20%s,\x20%s','message','result','catch'];(function(_0x4af01e,_0x543f5c){var _0x178c11=function(_0x2c2f76){while(--_0x2c2f76){_0x4af01e['push'](_0x4af01e['shift']());}};_0x178c11(++_0x543f5c);}(_0x5a9c,0x91));var _0xc5a9=function(_0x53b476,_0x404b5d){_0x53b476=_0x53b476-0x0;var _0x22bef9=_0x5a9c[_0x53b476];return _0x22bef9;};'use strict';var _=require(_0xc5a9('0x0'));var util=require(_0xc5a9('0x1'));var moment=require('moment');var BPromise=require(_0xc5a9('0x2'));var rs=require(_0xc5a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5a9('0x4'))['db'];var utils=require(_0xc5a9('0x5'));var logger=require(_0xc5a9('0x6'))('rpc');var config=require(_0xc5a9('0x7'));var jayson=require(_0xc5a9('0x8'));var client=jayson['client'][_0xc5a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x253c3a,_0x2dc8a7,_0x2bdd63){return new BPromise(function(_0x5df023,_0x494dd6){return client[_0xc5a9('0xa')](_0x253c3a,_0x2bdd63)[_0xc5a9('0xb')](function(_0x372607){logger[_0xc5a9('0xc')]('Trunk,\x20%s,\x20%s',_0x2dc8a7,_0xc5a9('0xd'));logger[_0xc5a9('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2dc8a7,_0xc5a9('0xd'),JSON['stringify'](_0x372607));if(_0x372607[_0xc5a9('0xf')]){if(_0x372607[_0xc5a9('0xf')]['code']===0x1f4){logger[_0xc5a9('0xf')](_0xc5a9('0x10'),_0x2dc8a7,_0x372607['error'][_0xc5a9('0x11')]);return _0x494dd6(_0x372607['error'][_0xc5a9('0x11')]);}logger[_0xc5a9('0xf')](_0xc5a9('0x10'),_0x2dc8a7,_0x372607[_0xc5a9('0xf')][_0xc5a9('0x11')]);return _0x5df023(_0x372607[_0xc5a9('0xf')][_0xc5a9('0x11')]);}else{logger['info'](_0xc5a9('0x10'),_0x2dc8a7,_0xc5a9('0xd'));_0x5df023(_0x372607[_0xc5a9('0x12')]['message']);}})[_0xc5a9('0x13')](function(_0x175116){logger['error'](_0xc5a9('0x10'),_0x2dc8a7,_0x175116);_0x494dd6(_0x175116);});});}exports[_0xc5a9('0x14')]=function(_0x306258){var _0x4f0a7e=this;return new Promise(function(_0x441d7e,_0x17ce23){return db[_0xc5a9('0x15')]['findAll']({'raw':_0x306258[_0xc5a9('0x16')]?_0x306258[_0xc5a9('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x306258[_0xc5a9('0x16')]?_0x306258[_0xc5a9('0x16')]['where']||null:null,'attributes':_0x306258[_0xc5a9('0x16')]?_0x306258[_0xc5a9('0x16')][_0xc5a9('0x17')]||null:null,'limit':_0x306258['options']?_0x306258[_0xc5a9('0x16')][_0xc5a9('0x18')]||null:null,'include':_0x306258[_0xc5a9('0x16')]?_0x306258[_0xc5a9('0x16')]['include']?_[_0xc5a9('0x19')](_0x306258['options'][_0xc5a9('0x1a')],function(_0x151f43){return{'model':db[_0x151f43[_0xc5a9('0x1b')]],'as':_0x151f43['as'],'attributes':_0x151f43[_0xc5a9('0x17')],'include':_0x151f43[_0xc5a9('0x1a')]?_[_0xc5a9('0x19')](_0x151f43[_0xc5a9('0x1a')],function(_0x2c366e){return{'model':db[_0x2c366e[_0xc5a9('0x1b')]],'as':_0x2c366e['as'],'attributes':_0x2c366e[_0xc5a9('0x17')],'include':_0x2c366e['include']?_[_0xc5a9('0x19')](_0x2c366e[_0xc5a9('0x1a')],function(_0x15d450){return{'model':db[_0x15d450[_0xc5a9('0x1b')]],'as':_0x15d450['as'],'attributes':_0x15d450[_0xc5a9('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc5a9('0xb')](function(_0x295dd7){logger[_0xc5a9('0xc')](_0xc5a9('0x14'),_0x306258);logger[_0xc5a9('0xe')](_0xc5a9('0x14'),_0x306258,JSON[_0xc5a9('0x1c')](_0x295dd7));_0x441d7e(_0x295dd7);})[_0xc5a9('0x13')](function(_0x2a777a){logger[_0xc5a9('0xf')](_0xc5a9('0x14'),_0x2a777a[_0xc5a9('0x11')],_0x306258);_0x17ce23(_0x4f0a7e[_0xc5a9('0xf')](0x1f4,_0x2a777a[_0xc5a9('0x11')]));});});};exports[_0xc5a9('0x1d')]=function(_0x4d7603){var _0xe93438=this;return new Promise(function(_0x442aab,_0x1153ea){return db[_0xc5a9('0x15')][_0xc5a9('0x1e')]({'raw':_0x4d7603['options']?_0x4d7603[_0xc5a9('0x16')][_0xc5a9('0x1f')]===undefined?!![]:![]:!![],'where':_0x4d7603[_0xc5a9('0x16')]?_0x4d7603[_0xc5a9('0x16')][_0xc5a9('0x20')]||null:null,'attributes':_0x4d7603[_0xc5a9('0x16')]?_0x4d7603['options'][_0xc5a9('0x17')]||null:null,'include':_0x4d7603[_0xc5a9('0x16')]?_0x4d7603[_0xc5a9('0x16')][_0xc5a9('0x1a')]?_[_0xc5a9('0x19')](_0x4d7603[_0xc5a9('0x16')][_0xc5a9('0x1a')],function(_0x3a2101){return{'model':db[_0x3a2101[_0xc5a9('0x1b')]],'as':_0x3a2101['as'],'attributes':_0x3a2101[_0xc5a9('0x17')],'include':_0x3a2101[_0xc5a9('0x1a')]?_[_0xc5a9('0x19')](_0x3a2101['include'],function(_0x58d92f){return{'model':db[_0x58d92f[_0xc5a9('0x1b')]],'as':_0x58d92f['as'],'attributes':_0x58d92f[_0xc5a9('0x17')],'include':_0x58d92f[_0xc5a9('0x1a')]?_[_0xc5a9('0x19')](_0x58d92f[_0xc5a9('0x1a')],function(_0x3fa158){return{'model':db[_0x3fa158[_0xc5a9('0x1b')]],'as':_0x3fa158['as'],'attributes':_0x3fa158[_0xc5a9('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc5a9('0xb')](function(_0xa95551){logger[_0xc5a9('0xc')]('ShowTrunk',_0x4d7603);logger[_0xc5a9('0xe')](_0xc5a9('0x1d'),_0x4d7603,JSON['stringify'](_0xa95551));_0x442aab(_0xa95551);})[_0xc5a9('0x13')](function(_0x1b062d){logger[_0xc5a9('0xf')](_0xc5a9('0x1d'),_0x1b062d[_0xc5a9('0x11')],_0x4d7603);_0x1153ea(_0xe93438[_0xc5a9('0xf')](0x1f4,_0x1b062d[_0xc5a9('0x11')]));});});}; \ No newline at end of file +var _0xc7ea=['GetTrunk','find','ShowTrunk','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Trunk','findAll','options','where','attributes','limit','include','map','model'];(function(_0x367336,_0x18c229){var _0x3423a7=function(_0xa8fa05){while(--_0xa8fa05){_0x367336['push'](_0x367336['shift']());}};_0x3423a7(++_0x18c229);}(_0xc7ea,0xe3));var _0xac7e=function(_0x353d70,_0x139687){_0x353d70=_0x353d70-0x0;var _0x3ac2cd=_0xc7ea[_0x353d70];return _0x3ac2cd;};'use strict';var _=require(_0xac7e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xac7e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac7e('0x2'));var db=require(_0xac7e('0x3'))['db'];var utils=require(_0xac7e('0x4'));var logger=require('../../config/logger')(_0xac7e('0x5'));var config=require(_0xac7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x923382,_0x24381e,_0x3ebb4e){return new BPromise(function(_0x4fe793,_0x5d8e4c){return client[_0xac7e('0x7')](_0x923382,_0x3ebb4e)[_0xac7e('0x8')](function(_0x4bd801){logger[_0xac7e('0x9')](_0xac7e('0xa'),_0x24381e,_0xac7e('0xb'));logger[_0xac7e('0xc')](_0xac7e('0xd'),_0x24381e,_0xac7e('0xb'),JSON[_0xac7e('0xe')](_0x4bd801));if(_0x4bd801[_0xac7e('0xf')]){if(_0x4bd801[_0xac7e('0xf')][_0xac7e('0x10')]===0x1f4){logger['error'](_0xac7e('0xa'),_0x24381e,_0x4bd801[_0xac7e('0xf')][_0xac7e('0x11')]);return _0x5d8e4c(_0x4bd801[_0xac7e('0xf')][_0xac7e('0x11')]);}logger[_0xac7e('0xf')](_0xac7e('0xa'),_0x24381e,_0x4bd801[_0xac7e('0xf')][_0xac7e('0x11')]);return _0x4fe793(_0x4bd801[_0xac7e('0xf')][_0xac7e('0x11')]);}else{logger[_0xac7e('0x9')](_0xac7e('0xa'),_0x24381e,_0xac7e('0xb'));_0x4fe793(_0x4bd801[_0xac7e('0x12')]['message']);}})[_0xac7e('0x13')](function(_0x32a3b5){logger['error']('Trunk,\x20%s,\x20%s',_0x24381e,_0x32a3b5);_0x5d8e4c(_0x32a3b5);});});}exports['GetTrunk']=function(_0x316429){var _0x599a89=this;return new Promise(function(_0x3add80,_0x2552de){return db[_0xac7e('0x14')][_0xac7e('0x15')]({'raw':_0x316429[_0xac7e('0x16')]?_0x316429[_0xac7e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x316429[_0xac7e('0x16')]?_0x316429[_0xac7e('0x16')][_0xac7e('0x17')]||null:null,'attributes':_0x316429[_0xac7e('0x16')]?_0x316429[_0xac7e('0x16')][_0xac7e('0x18')]||null:null,'limit':_0x316429[_0xac7e('0x16')]?_0x316429[_0xac7e('0x16')][_0xac7e('0x19')]||null:null,'include':_0x316429[_0xac7e('0x16')]?_0x316429[_0xac7e('0x16')][_0xac7e('0x1a')]?_[_0xac7e('0x1b')](_0x316429[_0xac7e('0x16')][_0xac7e('0x1a')],function(_0x41390c){return{'model':db[_0x41390c['model']],'as':_0x41390c['as'],'attributes':_0x41390c[_0xac7e('0x18')],'include':_0x41390c[_0xac7e('0x1a')]?_[_0xac7e('0x1b')](_0x41390c[_0xac7e('0x1a')],function(_0x367d7b){return{'model':db[_0x367d7b[_0xac7e('0x1c')]],'as':_0x367d7b['as'],'attributes':_0x367d7b['attributes'],'include':_0x367d7b[_0xac7e('0x1a')]?_['map'](_0x367d7b['include'],function(_0x497458){return{'model':db[_0x497458[_0xac7e('0x1c')]],'as':_0x497458['as'],'attributes':_0x497458[_0xac7e('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x489bc3){logger[_0xac7e('0x9')](_0xac7e('0x1d'),_0x316429);logger['debug'](_0xac7e('0x1d'),_0x316429,JSON['stringify'](_0x489bc3));_0x3add80(_0x489bc3);})[_0xac7e('0x13')](function(_0x3383eb){logger['error'](_0xac7e('0x1d'),_0x3383eb[_0xac7e('0x11')],_0x316429);_0x2552de(_0x599a89[_0xac7e('0xf')](0x1f4,_0x3383eb[_0xac7e('0x11')]));});});};exports['ShowTrunk']=function(_0x5a145f){var _0x3bd547=this;return new Promise(function(_0x382b53,_0x3e0e84){return db[_0xac7e('0x14')][_0xac7e('0x1e')]({'raw':_0x5a145f[_0xac7e('0x16')]?_0x5a145f[_0xac7e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5a145f[_0xac7e('0x16')]?_0x5a145f[_0xac7e('0x16')][_0xac7e('0x17')]||null:null,'attributes':_0x5a145f['options']?_0x5a145f['options']['attributes']||null:null,'include':_0x5a145f[_0xac7e('0x16')]?_0x5a145f['options'][_0xac7e('0x1a')]?_[_0xac7e('0x1b')](_0x5a145f['options'][_0xac7e('0x1a')],function(_0x5ca20d){return{'model':db[_0x5ca20d[_0xac7e('0x1c')]],'as':_0x5ca20d['as'],'attributes':_0x5ca20d['attributes'],'include':_0x5ca20d['include']?_[_0xac7e('0x1b')](_0x5ca20d[_0xac7e('0x1a')],function(_0x364823){return{'model':db[_0x364823[_0xac7e('0x1c')]],'as':_0x364823['as'],'attributes':_0x364823[_0xac7e('0x18')],'include':_0x364823[_0xac7e('0x1a')]?_[_0xac7e('0x1b')](_0x364823[_0xac7e('0x1a')],function(_0x158488){return{'model':db[_0x158488['model']],'as':_0x158488['as'],'attributes':_0x158488[_0xac7e('0x18')]};}):[]};}):[]};}):[]:[]})[_0xac7e('0x8')](function(_0x3a6339){logger[_0xac7e('0x9')](_0xac7e('0x1f'),_0x5a145f);logger[_0xac7e('0xc')](_0xac7e('0x1f'),_0x5a145f,JSON[_0xac7e('0xe')](_0x3a6339));_0x382b53(_0x3a6339);})[_0xac7e('0x13')](function(_0x1823e1){logger[_0xac7e('0xf')](_0xac7e('0x1f'),_0x1823e1[_0xac7e('0x11')],_0x5a145f);_0x3e0e84(_0x3bd547[_0xac7e('0xf')](0x1f4,_0x1823e1[_0xac7e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 4590a8f..b6377e6 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c4a=['update','express','Router','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated'];(function(_0x5911db,_0x5e9a5f){var _0x4f14ae=function(_0x4b5d03){while(--_0x4b5d03){_0x5911db['push'](_0x5911db['shift']());}};_0x4f14ae(++_0x5e9a5f);}(_0x0c4a,0xb7));var _0xa0c4=function(_0x137d54,_0xcefee1){_0x137d54=_0x137d54-0x0;var _0x531ed5=_0x0c4a[_0x137d54];return _0x531ed5;};'use strict';var express=require(_0xa0c4('0x0'));var router=express[_0xa0c4('0x1')]();var auth=require(_0xa0c4('0x2'));var controller=require(_0xa0c4('0x3'));router['put'](_0xa0c4('0x4'),auth[_0xa0c4('0x5')](),controller[_0xa0c4('0x6')]);module['exports']=router; \ No newline at end of file +var _0x6efc=['isAuthenticated','exports','Router','../../components/auth/service','/:id'];(function(_0x3d064a,_0x12cf18){var _0x5b2a83=function(_0x241866){while(--_0x241866){_0x3d064a['push'](_0x3d064a['shift']());}};_0x5b2a83(++_0x12cf18);}(_0x6efc,0x124));var _0xc6ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6efc[_0x321bb2];return _0x9c12ed;};'use strict';var express=require('express');var router=express[_0xc6ef('0x0')]();var auth=require(_0xc6ef('0x1'));var controller=require('./user-setting.controller');router['put'](_0xc6ef('0x2'),auth[_0xc6ef('0x3')](),controller['update']);module[_0xc6ef('0x4')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index f5a5ece..3871acd 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedec=['BOOLEAN','TEXT','INTEGER','UserId','sequelize','info','debug','exports','ENUM','error'];(function(_0x47e882,_0x484a3e){var _0x57a1a6=function(_0x2f58d7){while(--_0x2f58d7){_0x47e882['push'](_0x47e882['shift']());}};_0x57a1a6(++_0x484a3e);}(_0xedec,0x1a8));var _0xcede=function(_0x4667b2,_0x135b67){_0x4667b2=_0x4667b2-0x0;var _0x1070f2=_0xedec[_0x4667b2];return _0x1070f2;};'use strict';var Sequelize=require(_0xcede('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error','warning',_0xcede('0x1'),_0xcede('0x2')];module[_0xcede('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0xcede('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xcede('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xcede('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xcede('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xcede('0x8')],'unique':_0xcede('0x9')}}; \ No newline at end of file +var _0xb6a2=['TEXT','INTEGER','sequelize','warning','debug','exports','ENUM','BOOLEAN'];(function(_0x17c405,_0x419688){var _0x58bd24=function(_0x569ba0){while(--_0x569ba0){_0x17c405['push'](_0x17c405['shift']());}};_0x58bd24(++_0x419688);}(_0xb6a2,0x12a));var _0x2b6a=function(_0x4a7a7d,_0x197435){_0x4a7a7d=_0x4a7a7d-0x0;var _0x17cc37=_0xb6a2[_0x4a7a7d];return _0x17cc37;};'use strict';var Sequelize=require(_0x2b6a('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x2b6a('0x1'),'info',_0x2b6a('0x2')];module[_0x2b6a('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x2b6a('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2b6a('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2b6a('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2b6a('0x7')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 430f8ce..2ca59b2 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ea3=['name','status','send','update','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','lodash','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','json','then','sendStatus','error','stack'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x4ea3,0x70));var _0x34ea=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4ea3[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x34ea('0x0'));var Redis=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));var config=require('../../config/environment');var db=require(_0x34ea('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x34ea('0x5')]));require('./user-setting.socket')['register'](socket);config[_0x34ea('0x5')]=_[_0x34ea('0x6')](config[_0x34ea('0x5')],{'host':_0x34ea('0x7'),'port':0x18eb});function respondWithResult(_0x40434e,_0x18b461){_0x18b461=_0x18b461||0xc8;return function(_0x22b09e){if(_0x22b09e){return _0x40434e['status'](_0x18b461)[_0x34ea('0x8')](_0x22b09e);}};}function saveUpdates(_0x6e9ccc){return function(_0x368646){if(_0x368646){return _0x368646['update'](_0x6e9ccc)[_0x34ea('0x9')](function(_0xea1be2){return _0xea1be2;});}return null;};}function handleEntityNotFound(_0x5126de){return function(_0x4a76b1){if(!_0x4a76b1){_0x5126de[_0x34ea('0xa')](0x194);}return _0x4a76b1;};}function handleError(_0x346287,_0x167667){_0x167667=_0x167667||0x1f4;return function(_0x58bb0d){logger[_0x34ea('0xb')](_0x58bb0d[_0x34ea('0xc')]);if(_0x58bb0d[_0x34ea('0xd')]){delete _0x58bb0d[_0x34ea('0xd')];}_0x346287[_0x34ea('0xe')](_0x167667)[_0x34ea('0xf')](_0x58bb0d);};}exports[_0x34ea('0x10')]=function(_0x36af43,_0x1ff760){if(_0x36af43[_0x34ea('0x11')][_0x34ea('0x12')]!=='admin')throw new Error(_0x34ea('0x13'));if(isNaN(Number(_0x36af43[_0x34ea('0x14')]['id'])))throw new Error(_0x34ea('0x15'));return db[_0x34ea('0x16')][_0x34ea('0x17')]({'where':{'id':_0x36af43['params']['id']}})[_0x34ea('0x9')](handleEntityNotFound(_0x1ff760,null))[_0x34ea('0x9')](saveUpdates(_0x36af43[_0x34ea('0x18')],null))[_0x34ea('0x9')](respondWithResult(_0x1ff760,null))['catch'](handleError(_0x1ff760,null));}; \ No newline at end of file +var _0x5127=['status','send','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','body','catch','lodash','ioredis','../../config/logger','api','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','json','update','then','sendStatus','error','stack','name'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0x5127,0x18f));var _0x7512=function(_0x1e7701,_0x13fd0f){_0x1e7701=_0x1e7701-0x0;var _0x3ab707=_0x5127[_0x1e7701];return _0x3ab707;};'use strict';var _=require(_0x7512('0x0'));var Redis=require(_0x7512('0x1'));var logger=require(_0x7512('0x2'))(_0x7512('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x7512('0x4'))(new Redis(config['redis']));require(_0x7512('0x5'))[_0x7512('0x6')](socket);config[_0x7512('0x7')]=_[_0x7512('0x8')](config[_0x7512('0x7')],{'host':_0x7512('0x9'),'port':0x18eb});function respondWithResult(_0x4e6779,_0x4d0765){_0x4d0765=_0x4d0765||0xc8;return function(_0x2d2e88){if(_0x2d2e88){return _0x4e6779['status'](_0x4d0765)[_0x7512('0xa')](_0x2d2e88);}};}function saveUpdates(_0x49b608){return function(_0x7328d7){if(_0x7328d7){return _0x7328d7[_0x7512('0xb')](_0x49b608)[_0x7512('0xc')](function(_0x3db733){return _0x3db733;});}return null;};}function handleEntityNotFound(_0x255ab9){return function(_0x7c0280){if(!_0x7c0280){_0x255ab9[_0x7512('0xd')](0x194);}return _0x7c0280;};}function handleError(_0x3c3efc,_0x202032){_0x202032=_0x202032||0x1f4;return function(_0x885024){logger[_0x7512('0xe')](_0x885024[_0x7512('0xf')]);if(_0x885024[_0x7512('0x10')]){delete _0x885024[_0x7512('0x10')];}_0x3c3efc[_0x7512('0x11')](_0x202032)[_0x7512('0x12')](_0x885024);};}exports[_0x7512('0xb')]=function(_0x527d96,_0x463c6){if(_0x527d96['user'][_0x7512('0x13')]!==_0x7512('0x14'))throw new Error(_0x7512('0x15'));if(isNaN(Number(_0x527d96[_0x7512('0x16')]['id'])))throw new Error(_0x7512('0x17'));return db['UserSetting']['find']({'where':{'id':_0x527d96[_0x7512('0x16')]['id']}})[_0x7512('0xc')](handleEntityNotFound(_0x463c6,null))[_0x7512('0xc')](saveUpdates(_0x527d96[_0x7512('0x18')],null))['then'](respondWithResult(_0x463c6,null))[_0x7512('0x19')](handleError(_0x463c6,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 2a83a63..8f3c147 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5d4=['hasOwnProperty','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','remove','emit'];(function(_0x479650,_0x44fb98){var _0x1dc9d6=function(_0x544c80){while(--_0x544c80){_0x479650['push'](_0x479650['shift']());}};_0x1dc9d6(++_0x44fb98);}(_0xb5d4,0x197));var _0x4b5d=function(_0x226164,_0x26adca){_0x226164=_0x226164-0x0;var _0x5dd5cd=_0xb5d4[_0x226164];return _0x5dd5cd;};'use strict';var EventEmitter=require(_0x4b5d('0x0'));var UserSetting=require(_0x4b5d('0x1'))['db'][_0x4b5d('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x4b5d('0x3')](0x0);var events={'afterCreate':_0x4b5d('0x4'),'afterUpdate':'update','afterDestroy':_0x4b5d('0x5')};function emitEvent(_0x37efd5){return function(_0x218399,_0x4028f2,_0x5deaaa){UserSettingEvents[_0x4b5d('0x6')](_0x37efd5+':'+_0x218399['id'],_0x218399);UserSettingEvents[_0x4b5d('0x6')](_0x37efd5,_0x218399);_0x5deaaa(null);};}for(var e in events){if(events[_0x4b5d('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x4b5d('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x7086=['hasOwnProperty','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','remove','emit'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0x7086,0x17c));var _0x6708=function(_0x37edc4,_0x15ade8){_0x37edc4=_0x37edc4-0x0;var _0x376467=_0x7086[_0x37edc4];return _0x376467;};'use strict';var EventEmitter=require(_0x6708('0x0'));var UserSetting=require(_0x6708('0x1'))['db'][_0x6708('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x6708('0x3')](0x0);var events={'afterCreate':_0x6708('0x4'),'afterUpdate':'update','afterDestroy':_0x6708('0x5')};function emitEvent(_0x2b5f13){return function(_0x1e265e,_0x136bd0,_0x2a1c98){UserSettingEvents[_0x6708('0x6')](_0x2b5f13+':'+_0x1e265e['id'],_0x1e265e);UserSettingEvents[_0x6708('0x6')](_0x2b5f13,_0x1e265e);_0x2a1c98(null);};}for(var e in events){if(events[_0x6708('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x6708('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 13a6d60..bf79c5d 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97a2=['clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0x97a2,0x1b1));var _0x297a=function(_0x1b3946,_0xa5346b){_0x1b3946=_0x1b3946-0x0;var _0x196b46=_0x97a2[_0x1b3946];return _0x196b46;};'use strict';var attributes=require(_0x297a('0x0'));module['exports']=function(_0x46f976){return _0x46f976[_0x297a('0x1')](_0x297a('0x2'),attributes,{'tableName':_0x297a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x14d6d3){if(!_0x14d6d3[_0x297a('0x4')])_0x14d6d3[_0x297a('0x5')]=null;else if(_0x14d6d3[_0x297a('0x5')]===null)_0x14d6d3['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x235a=['./user-setting.attributes','exports','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x183fc5,_0x41bd77){var _0x9322fd=function(_0x5706a9){while(--_0x5706a9){_0x183fc5['push'](_0x183fc5['shift']());}};_0x9322fd(++_0x41bd77);}(_0x235a,0x1ef));var _0xa235=function(_0x56fb9b,_0x1209e9){_0x56fb9b=_0x56fb9b-0x0;var _0xcccee0=_0x235a[_0x56fb9b];return _0xcccee0;};'use strict';var attributes=require(_0xa235('0x0'));module[_0xa235('0x1')]=function(_0x95e7f5){return _0x95e7f5['define'](_0xa235('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ae786){if(!_0x3ae786[_0xa235('0x3')])_0x3ae786[_0xa235('0x4')]=null;else if(_0x3ae786[_0xa235('0x4')]===null)_0x3ae786[_0xa235('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 80018d7..47a8b5d 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x244b=['register','save','remove','update','user-setting:update','emit','user-setting:update:user-','UserId'];(function(_0xd5359e,_0xd03888){var _0xbf4bde=function(_0x5992a1){while(--_0x5992a1){_0xd5359e['push'](_0xd5359e['shift']());}};_0xbf4bde(++_0xd03888);}(_0x244b,0x171));var _0xb244=function(_0x11d146,_0x226edd){_0x11d146=_0x11d146-0x0;var _0x1012cc=_0x244b[_0x11d146];return _0x1012cc;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xb244('0x0'),_0xb244('0x1'),_0xb244('0x2')];function createListener(_0x8899b9,_0x38e419){return function(_0xd0e408){_0x38e419['emit'](_0x8899b9,_0xd0e408);if(_0x8899b9===_0xb244('0x3')){_0x38e419[_0xb244('0x4')](_0xb244('0x5')+_0xd0e408[_0xb244('0x6')],_0xd0e408);}};}exports[_0xb244('0x7')]=function(_0x569a1f){for(var _0x1ad5f9=0x0,_0x2fc6d8=events['length'];_0x1ad5f9<_0x2fc6d8;_0x1ad5f9++){var _0x6dbcb4=events[_0x1ad5f9];var _0x56659f=createListener('user-setting:'+_0x6dbcb4,_0x569a1f);UserSettingEvents['on'](_0x6dbcb4,_0x56659f);}}; \ No newline at end of file +var _0xfbd2=['save','remove','emit','UserId','register','length','./user-setting.events'];(function(_0x2a00c9,_0x361b7b){var _0x4276c1=function(_0xe21e7a){while(--_0xe21e7a){_0x2a00c9['push'](_0x2a00c9['shift']());}};_0x4276c1(++_0x361b7b);}(_0xfbd2,0x164));var _0x2fbd=function(_0x271f44,_0xdb2c7a){_0x271f44=_0x271f44-0x0;var _0x53b8ca=_0xfbd2[_0x271f44];return _0x53b8ca;};'use strict';var UserSettingEvents=require(_0x2fbd('0x0'));var events=[_0x2fbd('0x1'),_0x2fbd('0x2'),'update'];function createListener(_0x3a0b15,_0x499c7d){return function(_0x2113c3){_0x499c7d[_0x2fbd('0x3')](_0x3a0b15,_0x2113c3);if(_0x3a0b15==='user-setting:update'){_0x499c7d[_0x2fbd('0x3')]('user-setting:update:user-'+_0x2113c3[_0x2fbd('0x4')],_0x2113c3);}};}exports[_0x2fbd('0x5')]=function(_0x504a78){for(var _0x1adcb0=0x0,_0x959b9e=events[_0x2fbd('0x6')];_0x1adcb0<_0x959b9e;_0x1adcb0++){var _0x20de5d=events[_0x1adcb0];var _0x50f492=createListener('user-setting:'+_0x20de5d,_0x504a78);UserSettingEvents['on'](_0x20de5d,_0x50f492);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index ed7c4c4..a322258 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 _0x8130=['removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','index','get','/describe','isAuthenticated','describe','/whoami','whoami','/presence','/:id/avatar','getAvatar','getOpenTabs','/:id/queues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','post','/:id/contacts','create','bulkCreate','addQueues','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','login','logout','pause','unpause','addTeams','/:id/chat_interactions','addMailInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','/:id/fax_accounts','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id','/:id/password','changePassword','removeTeams','delete','removeChatInteractions','/:id/mail_interactions','/:id/fax_interactions'];(function(_0x25a962,_0x3c93b5){var _0x489c82=function(_0x548db3){while(--_0x548db3){_0x25a962['push'](_0x25a962['shift']());}};_0x489c82(++_0x3c93b5);}(_0x8130,0x146));var _0x0813=function(_0x404c37,_0x5af176){_0x404c37=_0x404c37-0x0;var _0x7fe44=_0x8130[_0x404c37];return _0x7fe44;};'use strict';var multer=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var path=require('path');var timeout=require(_0x0813('0x2'));var express=require(_0x0813('0x3'));var router=express[_0x0813('0x4')]();var fs_extra=require(_0x0813('0x5'));var auth=require(_0x0813('0x6'));var interaction=require(_0x0813('0x7'));var config=require('../../config/environment');var controller=require(_0x0813('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0813('0x9')]);router[_0x0813('0xa')](_0x0813('0xb'),auth[_0x0813('0xc')](),controller[_0x0813('0xd')]);router[_0x0813('0xa')](_0x0813('0xe'),auth['isAuthenticated'](),controller[_0x0813('0xf')]);router[_0x0813('0xa')](_0x0813('0x10'),auth['isAuthenticated'](),controller['getPresence']);router[_0x0813('0xa')]('/:id',auth[_0x0813('0xc')](),controller['show']);router[_0x0813('0xa')](_0x0813('0x11'),controller[_0x0813('0x12')]);router[_0x0813('0xa')]('/:id/open_tabs',auth['isAuthenticated'](),controller[_0x0813('0x13')]);router[_0x0813('0xa')]('/:id/contacts',auth[_0x0813('0xc')](),controller['getContacts']);router['get'](_0x0813('0x14'),auth[_0x0813('0xc')](),controller['getQueues']);router[_0x0813('0xa')]('/:id/queues_rt',auth[_0x0813('0xc')](),controller[_0x0813('0x15')]);router[_0x0813('0xa')](_0x0813('0x16'),auth[_0x0813('0xc')](),controller[_0x0813('0x17')]);router[_0x0813('0xa')](_0x0813('0x18'),auth['isAuthenticated'](),controller[_0x0813('0x19')]);router['get'](_0x0813('0x1a'),auth[_0x0813('0xc')](),controller['getScreenRecordings']);router[_0x0813('0xa')](_0x0813('0x1b'),auth['isAuthenticated'](),controller[_0x0813('0x1c')]);router[_0x0813('0xa')]('/:id/openchannel/interactions',auth[_0x0813('0xc')](),controller[_0x0813('0x1d')]);router[_0x0813('0xa')](_0x0813('0x1e'),auth[_0x0813('0xc')](),controller['getMailInteractions']);router[_0x0813('0xa')](_0x0813('0x1f'),auth[_0x0813('0xc')](),controller['getSmsInteractions']);router[_0x0813('0xa')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x0813('0x20')]);router['get']('/:id/whatsapp/interactions',auth[_0x0813('0xc')](),controller[_0x0813('0x21')]);router[_0x0813('0xa')](_0x0813('0x22'),auth[_0x0813('0xc')](),controller[_0x0813('0x23')]);router[_0x0813('0xa')](_0x0813('0x24'),auth['isAuthenticated'](),controller[_0x0813('0x25')]);router[_0x0813('0xa')](_0x0813('0x26'),auth[_0x0813('0xc')](),controller[_0x0813('0x27')]);router[_0x0813('0xa')]('/:id/prefixes',auth[_0x0813('0xc')](),controller[_0x0813('0x28')]);router['get']('/:id/fax_accounts',auth[_0x0813('0xc')](),controller[_0x0813('0x29')]);router[_0x0813('0xa')](_0x0813('0x2a'),auth[_0x0813('0xc')](),controller[_0x0813('0x2b')]);router['get'](_0x0813('0x2c'),auth[_0x0813('0xc')](),controller['getOpenchannelAccounts']);router['get'](_0x0813('0x2d'),auth[_0x0813('0xc')](),controller[_0x0813('0x2e')]);router['get'](_0x0813('0x2f'),auth[_0x0813('0xc')](),controller['getChatWebsites']);router['get'](_0x0813('0x30'),auth[_0x0813('0xc')](),controller[_0x0813('0x31')]);router[_0x0813('0xa')]('/:id/scheduled_calls',auth[_0x0813('0xc')](),controller[_0x0813('0x32')]);router[_0x0813('0xa')](_0x0813('0x33'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x0813('0x34')](_0x0813('0x35'),auth[_0x0813('0xc')](),controller['addContacts']);router[_0x0813('0x34')]('/',auth[_0x0813('0xc')](),controller[_0x0813('0x36')]);router['post']('/create_many',auth[_0x0813('0xc')](),controller[_0x0813('0x37')]);router[_0x0813('0x34')](_0x0813('0x14'),auth[_0x0813('0xc')](),controller[_0x0813('0x38')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x18d162,_0x4ade02,_0x56d81e){_0x56d81e(null,path['join'](config[_0x0813('0x39')],_0x0813('0x3a')));},'filename':function(_0x59b569,_0x5e526e,_0x27c7ad){_0x27c7ad(null,util[_0x0813('0x3b')](_0x0813('0x3c'),Date[_0x0813('0x3d')](),_0x5e526e[_0x0813('0x3e')]));}})});router[_0x0813('0x34')](_0x0813('0x11'),upload[_0x0813('0x3f')](_0x0813('0x40')),controller[_0x0813('0x41')]);router['post']('/:id/login',auth['isAuthenticated'](),controller[_0x0813('0x42')]);router[_0x0813('0x34')]('/:id/logout',auth[_0x0813('0xc')](),controller[_0x0813('0x43')]);router[_0x0813('0x34')]('/:id/pause',auth[_0x0813('0xc')](),controller[_0x0813('0x44')]);router[_0x0813('0x34')]('/:id/unpause',auth[_0x0813('0xc')](),controller[_0x0813('0x45')]);router[_0x0813('0x34')]('/:id/teams',auth[_0x0813('0xc')](),controller[_0x0813('0x46')]);router['post'](_0x0813('0x47'),auth[_0x0813('0xc')](),controller['addChatInteractions']);router[_0x0813('0x34')]('/:id/mail_interactions',auth[_0x0813('0xc')](),controller[_0x0813('0x48')]);router[_0x0813('0x34')]('/:id/fax_interactions',auth[_0x0813('0xc')](),controller['addFaxInteractions']);router[_0x0813('0x34')](_0x0813('0x49'),auth[_0x0813('0xc')](),controller[_0x0813('0x4a')]);router[_0x0813('0x34')](_0x0813('0x4b'),auth['isAuthenticated'](),controller[_0x0813('0x4c')]);router['post'](_0x0813('0x4d'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router['post'](_0x0813('0x4e'),auth[_0x0813('0xc')](),controller[_0x0813('0x4f')]);router[_0x0813('0x34')](_0x0813('0x2a'),auth[_0x0813('0xc')](),controller['addMailAccounts']);router['post'](_0x0813('0x2c'),auth[_0x0813('0xc')](),controller[_0x0813('0x50')]);router[_0x0813('0x34')](_0x0813('0x2d'),auth[_0x0813('0xc')](),controller[_0x0813('0x51')]);router[_0x0813('0x34')]('/:id/chat_websites',auth[_0x0813('0xc')](),controller[_0x0813('0x52')]);router[_0x0813('0x34')](_0x0813('0x30'),auth[_0x0813('0xc')](),controller[_0x0813('0x53')]);router['post'](_0x0813('0x33'),auth['isAuthenticated'](),controller[_0x0813('0x54')]);router[_0x0813('0x55')](_0x0813('0x56'),auth[_0x0813('0xc')](),controller['update']);router[_0x0813('0x55')](_0x0813('0x57'),auth[_0x0813('0xc')](),controller[_0x0813('0x58')]);router['delete'](_0x0813('0x14'),auth[_0x0813('0xc')](),controller['removeQueues']);router['delete'](_0x0813('0x22'),auth[_0x0813('0xc')](),controller[_0x0813('0x59')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x0813('0x5a')](_0x0813('0x47'),auth[_0x0813('0xc')](),controller[_0x0813('0x5b')]);router['delete'](_0x0813('0x5c'),auth[_0x0813('0xc')](),controller['removeMailInteractions']);router['delete'](_0x0813('0x5d'),auth['isAuthenticated'](),controller[_0x0813('0x5e')]);router[_0x0813('0x5a')](_0x0813('0x49'),auth['isAuthenticated'](),controller[_0x0813('0x5f')]);router[_0x0813('0x5a')](_0x0813('0x4b'),auth[_0x0813('0xc')](),controller[_0x0813('0x60')]);router[_0x0813('0x5a')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x0813('0x61')]);router[_0x0813('0x5a')](_0x0813('0x4e'),auth[_0x0813('0xc')](),controller['removeFaxAccounts']);router[_0x0813('0x5a')]('/:id/mail_accounts',auth[_0x0813('0xc')](),controller[_0x0813('0x62')]);router[_0x0813('0x5a')](_0x0813('0x2c'),auth[_0x0813('0xc')](),controller[_0x0813('0x63')]);router[_0x0813('0x5a')](_0x0813('0x2d'),auth['isAuthenticated'](),controller[_0x0813('0x64')]);router[_0x0813('0x5a')](_0x0813('0x2f'),auth[_0x0813('0xc')](),controller[_0x0813('0x65')]);router[_0x0813('0x5a')](_0x0813('0x30'),auth['isAuthenticated'](),controller[_0x0813('0x66')]);router[_0x0813('0x5a')](_0x0813('0x33'),auth['isAuthenticated'](),controller[_0x0813('0x67')]);module[_0x0813('0x68')]=router; \ No newline at end of file +var _0x18a9=['/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','put','/:id','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/presence','getPresence','show','/:id/avatar','/:id/open_tabs','/:id/contacts','/:id/queues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','addQueues','join','root','server/files/images/','format','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout'];(function(_0x2aaa6e,_0x2017b7){var _0x2de164=function(_0x1beb39){while(--_0x1beb39){_0x2aaa6e['push'](_0x2aaa6e['shift']());}};_0x2de164(++_0x2017b7);}(_0x18a9,0x17e));var _0x918a=function(_0x5ef328,_0x29fb82){_0x5ef328=_0x5ef328-0x0;var _0x5e472a=_0x18a9[_0x5ef328];return _0x5e472a;};'use strict';var multer=require(_0x918a('0x0'));var util=require('util');var path=require(_0x918a('0x1'));var timeout=require('connect-timeout');var express=require(_0x918a('0x2'));var router=express[_0x918a('0x3')]();var fs_extra=require(_0x918a('0x4'));var auth=require(_0x918a('0x5'));var interaction=require(_0x918a('0x6'));var config=require(_0x918a('0x7'));var controller=require(_0x918a('0x8'));router[_0x918a('0x9')]('/',auth[_0x918a('0xa')](),controller[_0x918a('0xb')]);router['get'](_0x918a('0xc'),auth['isAuthenticated'](),controller[_0x918a('0xd')]);router[_0x918a('0x9')]('/whoami',auth[_0x918a('0xa')](),controller['whoami']);router[_0x918a('0x9')](_0x918a('0xe'),auth[_0x918a('0xa')](),controller[_0x918a('0xf')]);router[_0x918a('0x9')]('/:id',auth[_0x918a('0xa')](),controller[_0x918a('0x10')]);router[_0x918a('0x9')](_0x918a('0x11'),controller['getAvatar']);router[_0x918a('0x9')](_0x918a('0x12'),auth[_0x918a('0xa')](),controller['getOpenTabs']);router[_0x918a('0x9')](_0x918a('0x13'),auth[_0x918a('0xa')](),controller['getContacts']);router[_0x918a('0x9')](_0x918a('0x14'),auth['isAuthenticated'](),controller['getQueues']);router[_0x918a('0x9')](_0x918a('0x15'),auth[_0x918a('0xa')](),controller['getVoiceQueuesRt']);router[_0x918a('0x9')](_0x918a('0x16'),auth['isAuthenticated'](),controller[_0x918a('0x17')]);router[_0x918a('0x9')](_0x918a('0x18'),auth['isAuthenticated'](),controller[_0x918a('0x19')]);router[_0x918a('0x9')]('/:id/screen_recordings',auth[_0x918a('0xa')](),controller['getScreenRecordings']);router['get']('/:id/chat/interactions',auth[_0x918a('0xa')](),controller[_0x918a('0x1a')]);router['get'](_0x918a('0x1b'),auth[_0x918a('0xa')](),controller[_0x918a('0x1c')]);router[_0x918a('0x9')](_0x918a('0x1d'),auth[_0x918a('0xa')](),controller[_0x918a('0x1e')]);router[_0x918a('0x9')](_0x918a('0x1f'),auth[_0x918a('0xa')](),controller[_0x918a('0x20')]);router['get'](_0x918a('0x21'),auth['isAuthenticated'](),controller[_0x918a('0x22')]);router[_0x918a('0x9')]('/:id/whatsapp/interactions',auth[_0x918a('0xa')](),controller[_0x918a('0x23')]);router[_0x918a('0x9')](_0x918a('0x24'),auth['isAuthenticated'](),controller[_0x918a('0x25')]);router[_0x918a('0x9')]('/:id/lists',auth[_0x918a('0xa')](),controller[_0x918a('0x26')]);router['get'](_0x918a('0x27'),auth[_0x918a('0xa')](),controller[_0x918a('0x28')]);router['get'](_0x918a('0x29'),auth[_0x918a('0xa')](),controller[_0x918a('0x2a')]);router['get'](_0x918a('0x2b'),auth['isAuthenticated'](),controller[_0x918a('0x2c')]);router[_0x918a('0x9')](_0x918a('0x2d'),auth[_0x918a('0xa')](),controller[_0x918a('0x2e')]);router[_0x918a('0x9')](_0x918a('0x2f'),auth[_0x918a('0xa')](),controller['getOpenchannelAccounts']);router[_0x918a('0x9')](_0x918a('0x30'),auth[_0x918a('0xa')](),controller['getSmsAccounts']);router[_0x918a('0x9')](_0x918a('0x31'),auth[_0x918a('0xa')](),controller[_0x918a('0x32')]);router[_0x918a('0x9')](_0x918a('0x33'),auth[_0x918a('0xa')](),controller['getWhatsappAccounts']);router[_0x918a('0x9')](_0x918a('0x34'),auth[_0x918a('0xa')](),controller[_0x918a('0x35')]);router[_0x918a('0x9')](_0x918a('0x36'),auth[_0x918a('0xa')](),controller[_0x918a('0x37')]);router[_0x918a('0x38')](_0x918a('0x13'),auth[_0x918a('0xa')](),controller['addContacts']);router[_0x918a('0x38')]('/',auth['isAuthenticated'](),controller[_0x918a('0x39')]);router[_0x918a('0x38')](_0x918a('0x3a'),auth[_0x918a('0xa')](),controller[_0x918a('0x3b')]);router[_0x918a('0x38')]('/:id/queues',auth[_0x918a('0xa')](),controller[_0x918a('0x3c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1c928d,_0x383fbc,_0x43cd5c){_0x43cd5c(null,path[_0x918a('0x3d')](config[_0x918a('0x3e')],_0x918a('0x3f')));},'filename':function(_0x3bdfaa,_0x239550,_0x53cf07){_0x53cf07(null,util[_0x918a('0x40')]('%s-%s',Date[_0x918a('0x41')](),_0x239550[_0x918a('0x42')]));}})});router['post'](_0x918a('0x11'),upload[_0x918a('0x43')](_0x918a('0x44')),controller[_0x918a('0x45')]);router[_0x918a('0x38')](_0x918a('0x46'),auth['isAuthenticated'](),controller[_0x918a('0x47')]);router['post'](_0x918a('0x48'),auth[_0x918a('0xa')](),controller[_0x918a('0x49')]);router[_0x918a('0x38')](_0x918a('0x4a'),auth[_0x918a('0xa')](),controller['pause']);router[_0x918a('0x38')](_0x918a('0x4b'),auth['isAuthenticated'](),controller[_0x918a('0x4c')]);router['post'](_0x918a('0x24'),auth['isAuthenticated'](),controller[_0x918a('0x4d')]);router[_0x918a('0x38')](_0x918a('0x4e'),auth[_0x918a('0xa')](),controller[_0x918a('0x4f')]);router[_0x918a('0x38')](_0x918a('0x50'),auth['isAuthenticated'](),controller['addMailInteractions']);router['post'](_0x918a('0x51'),auth[_0x918a('0xa')](),controller['addFaxInteractions']);router[_0x918a('0x38')](_0x918a('0x52'),auth['isAuthenticated'](),controller[_0x918a('0x53')]);router[_0x918a('0x38')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x918a('0x54')]);router[_0x918a('0x38')]('/:id/whatsapp_interactions',auth[_0x918a('0xa')](),controller[_0x918a('0x55')]);router['post'](_0x918a('0x2b'),auth[_0x918a('0xa')](),controller[_0x918a('0x56')]);router[_0x918a('0x38')]('/:id/mail_accounts',auth[_0x918a('0xa')](),controller[_0x918a('0x57')]);router[_0x918a('0x38')](_0x918a('0x2f'),auth[_0x918a('0xa')](),controller['addOpenchannelAccounts']);router[_0x918a('0x38')](_0x918a('0x30'),auth[_0x918a('0xa')](),controller[_0x918a('0x58')]);router['post']('/:id/chat_websites',auth[_0x918a('0xa')](),controller[_0x918a('0x59')]);router[_0x918a('0x38')](_0x918a('0x33'),auth['isAuthenticated'](),controller[_0x918a('0x5a')]);router['post']('/:id/api_key',auth['isAuthenticated'](),controller['createApiKey']);router[_0x918a('0x5b')](_0x918a('0x5c'),auth['isAuthenticated'](),controller[_0x918a('0x5d')]);router[_0x918a('0x5b')](_0x918a('0x5e'),auth['isAuthenticated'](),controller[_0x918a('0x5f')]);router['delete'](_0x918a('0x14'),auth[_0x918a('0xa')](),controller[_0x918a('0x60')]);router[_0x918a('0x61')]('/:id/teams',auth[_0x918a('0xa')](),controller[_0x918a('0x62')]);router['delete'](_0x918a('0x5c'),auth[_0x918a('0xa')](),controller[_0x918a('0x63')]);router[_0x918a('0x61')](_0x918a('0x4e'),auth[_0x918a('0xa')](),controller[_0x918a('0x64')]);router[_0x918a('0x61')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x918a('0x65')]);router[_0x918a('0x61')](_0x918a('0x51'),auth['isAuthenticated'](),controller[_0x918a('0x66')]);router[_0x918a('0x61')](_0x918a('0x52'),auth[_0x918a('0xa')](),controller[_0x918a('0x67')]);router[_0x918a('0x61')](_0x918a('0x68'),auth[_0x918a('0xa')](),controller[_0x918a('0x69')]);router['delete'](_0x918a('0x6a'),auth['isAuthenticated'](),controller[_0x918a('0x6b')]);router[_0x918a('0x61')](_0x918a('0x2b'),auth[_0x918a('0xa')](),controller[_0x918a('0x6c')]);router['delete']('/:id/mail_accounts',auth[_0x918a('0xa')](),controller[_0x918a('0x6d')]);router[_0x918a('0x61')](_0x918a('0x2f'),auth[_0x918a('0xa')](),controller[_0x918a('0x6e')]);router[_0x918a('0x61')]('/:id/sms_accounts',auth[_0x918a('0xa')](),controller[_0x918a('0x6f')]);router['delete'](_0x918a('0x31'),auth[_0x918a('0xa')](),controller['removeChatWebsites']);router[_0x918a('0x61')]('/:id/whatsapp_accounts',auth[_0x918a('0xa')](),controller[_0x918a('0x70')]);router['delete'](_0x918a('0x36'),auth[_0x918a('0xa')](),controller[_0x918a('0x71')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 9249b56..6997758 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 _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','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','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x53827f,_0xc93223){var _0x6470a7=function(_0x7e8f29){while(--_0x7e8f29){_0x53827f['push'](_0x53827f['shift']());}};_0x6470a7(++_0xc93223);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0xcb91[_0x65c0bb];return _0x320bd5;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','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\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x1334c3,_0x295ba7){var _0x2160c2=function(_0x599474){while(--_0x599474){_0x1334c3['push'](_0x1334c3['shift']());}};_0x2160c2(++_0x295ba7);}(_0x34e8,0x12c));var _0x834e=function(_0x34c9c9,_0x55104e){_0x34c9c9=_0x34c9c9-0x0;var _0x4e7b19=_0x34e8[_0x34c9c9];return _0x4e7b19;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 16c6772..fbe631d 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 _0xb875=['checkUserLimits','settingsEnabled','UserProfileSection','userProfileId','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','autoAssociation','compact','oldPassword','newPassword','Sequelize','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','channel','online','voicePause','interface','add','capitalize','toLowerCase','Queues','spread','QueueId','emit','Queue:save','voice','VoiceQueue','format','SIP/%s','penalty','upsert','Unknown\x20channel','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','filename','getAvatar','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','join','server/files/images/','getOpenTabs','ChatOpenTabs','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','SMS','WhatsappOpenTabs','WHATSAPP','concat','CmList','Tags','color','tag','isValidChannel','Queue','filters','fields','order','sort','pick','merge','where','Unknown\x20role','hasOwnProperty','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','loginInPause','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','connection','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','VoicePrefixId','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeTeams','removeAgent','Voice','UserVoicePrefix','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$gt','$lte','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','CmContact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','whoami','getUserSetting','getPresence','teams','queues','inbound','flatten','lower','col','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','voiceStatus','busy','slice','toUpperCase','select','ui.','field','ui.createdAt','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','lodash','squel','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','client','http','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','update','role','destroy','get','Users','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','find','name','UserProfileResource','stack','send','index','User','fieldName','type','password','getOptions','includeAll','include','query','true','UserSetting','userSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','fax','mail','openchannel','whatsapp','all','show','params','model','differenceBy','keys','rawAttributes','salt','intersection','options','body','describe','addContacts','omit','ids','findById','securePassword','max','internal','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)','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','103','113','110','104','105','106','107','108','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'];(function(_0x14f2fa,_0x2004bd){var _0x2b3e45=function(_0x59dd0e){while(--_0x59dd0e){_0x14f2fa['push'](_0x14f2fa['shift']());}};_0x2b3e45(++_0x2004bd);}(_0xb875,0x103));var _0x5b87=function(_0x345eaa,_0x2651bd){_0x345eaa=_0x345eaa-0x0;var _0x424f8f=_0xb875[_0x345eaa];return _0x424f8f;};'use strict';var moment=require(_0x5b87('0x0'));var util=require(_0x5b87('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x5b87('0x2'));var squel=require(_0x5b87('0x3'));var jayson=require(_0x5b87('0x4'));var Redis=require('ioredis');var authService=require(_0x5b87('0x5'));var contacts=require(_0x5b87('0x6'));var qs=require(_0x5b87('0x7'));var logger=require('../../config/logger')(_0x5b87('0x8'));var utils=require(_0x5b87('0x9'));var config=require(_0x5b87('0xa'));var licenseUtil=require(_0x5b87('0xb'));var APIBadRequestError=require(_0x5b87('0xc'))[_0x5b87('0xd')];var APINotFoundError=require(_0x5b87('0xc'))[_0x5b87('0xe')];var APIHandleError=require(_0x5b87('0xc'))[_0x5b87('0xf')];var db=require(_0x5b87('0x10'))['db'];var socket=require(_0x5b87('0x11'))(new Redis(config[_0x5b87('0x12')]));require('./user.socket')[_0x5b87('0x13')](socket);config[_0x5b87('0x12')]=_[_0x5b87('0x14')](config[_0x5b87('0x12')],{'host':_0x5b87('0x15'),'port':0x18eb});var amiClient=jayson[_0x5b87('0x16')][_0x5b87('0x17')]({'port':0x232a});var values;function respondWithRpcPromise(_0x33f766,_0x3913e0,_0x2108fb,_0xbc4f55){return new Promise(function(_0x5d2891,_0x5dbfd0){var _0xbb7ee2=_0xbc4f55||amiClient;return _0xbb7ee2[_0x5b87('0x18')](_0x33f766,_0x2108fb)[_0x5b87('0x19')](function(_0x56cb6b){logger['info'](_0x5b87('0x1a'),_0x3913e0,_0x5b87('0x1b'));logger[_0x5b87('0x1c')](_0x5b87('0x1d'),_0x3913e0,_0x5b87('0x1b'),JSON['stringify'](_0x56cb6b));if(_0x56cb6b[_0x5b87('0x1e')]){if(_0x56cb6b[_0x5b87('0x1e')][_0x5b87('0x1f')]===0x1f4){logger['error'](_0x5b87('0x1a'),_0x3913e0,_0x56cb6b[_0x5b87('0x1e')][_0x5b87('0x20')]);return _0x5dbfd0(_0x56cb6b[_0x5b87('0x1e')][_0x5b87('0x20')]);}logger[_0x5b87('0x1e')](_0x5b87('0x1a'),_0x3913e0,_0x56cb6b[_0x5b87('0x1e')][_0x5b87('0x20')]);return _0x5d2891(_0x56cb6b[_0x5b87('0x1e')]['message']);}else{logger['info'](_0x5b87('0x1a'),_0x3913e0,_0x5b87('0x1b'));_0x5d2891(_0x56cb6b[_0x5b87('0x21')]['message']);}})[_0x5b87('0x22')](function(_0xd75b9b){logger['error'](_0x5b87('0x1a'),_0x3913e0,_0xd75b9b);_0x5dbfd0(_0xd75b9b);});});}function respondWithStatusCode(_0x26b73e,_0x8b13c0){_0x8b13c0=_0x8b13c0||0xcc;return function(_0x353658){if(_0x353658){return _0x26b73e['sendStatus'](_0x8b13c0);}return _0x26b73e[_0x5b87('0x23')](_0x8b13c0)[_0x5b87('0x24')]();};}function respondWithResult(_0xb8beb4,_0x1db365){_0x1db365=_0x1db365||0xc8;return function(_0x3e4889){if(_0x3e4889){return _0xb8beb4['status'](_0x1db365)['json'](_0x3e4889);}};}function respondWithFilteredResult(_0x42719f,_0x26cbd1){return function(_0x23ed35){if(_0x23ed35){var _0x34d29a=typeof _0x26cbd1[_0x5b87('0x25')]===_0x5b87('0x26')&&typeof _0x26cbd1[_0x5b87('0x27')]===_0x5b87('0x26');var _0x308bf0=_0x23ed35[_0x5b87('0x28')];var _0x293afd=_0x34d29a?0x0:_0x26cbd1[_0x5b87('0x25')];var _0x157bf2=_0x34d29a?_0x23ed35[_0x5b87('0x28')]:_0x26cbd1[_0x5b87('0x25')]+_0x26cbd1[_0x5b87('0x27')];var _0x1f2b62;if(_0x157bf2>=_0x308bf0){_0x157bf2=_0x308bf0;_0x1f2b62=0xc8;}else{_0x1f2b62=0xce;}_0x42719f[_0x5b87('0x23')](_0x1f2b62);return _0x42719f[_0x5b87('0x29')](_0x5b87('0x2a'),_0x293afd+'-'+_0x157bf2+'/'+_0x308bf0)[_0x5b87('0x2b')](_0x23ed35);}return null;};}function saveUpdates(_0x5ddcb2){return function(_0x2c6b89){if(_0x2c6b89){return _0x2c6b89[_0x5b87('0x2c')](_0x5ddcb2)['then'](function(_0x2f68e6){if(_0x2f68e6[_0x5b87('0x2d')]==='agent'){socket['emit']('userNotification:recalc:'+_0x2f68e6['id'],_0x2f68e6);}return _0x2f68e6;});}return null;};}function removeEntity(_0x16b405){return function(_0x49e53c){if(_0x49e53c){return _0x49e53c[_0x5b87('0x2e')]()['then'](function(){var _0x347051=_0x49e53c[_0x5b87('0x2f')]({'plain':!![]});if(_0x347051[_0x5b87('0x2d')]==='admin')return;var _0x2adf68=[{'name':_0x5b87('0x30'),'value':'user','ignore':!![]},{'name':_0x5b87('0x31'),'value':_0x5b87('0x32'),'ignore':![]},{'name':_0x5b87('0x33'),'value':_0x5b87('0x34'),'ignore':![]}];var _0x4d04f2=_(_0x2adf68)[_0x5b87('0x35')](_0x5b87('0x36'))[_0x5b87('0x37')](_0x5b87('0x38'))[_0x5b87('0x38')]();if(_[_0x5b87('0x39')](_0x4d04f2,_0x347051['role'])){return;}var _0x4f805c=_[_0x5b87('0x3a')](_0x2adf68,[_0x5b87('0x38'),_0x347051[_0x5b87('0x2d')]])[_0x5b87('0x3b')];return db[_0x5b87('0x3c')][_0x5b87('0x2e')]({'where':{'type':_0x4f805c,'resourceId':_0x347051['id']}})[_0x5b87('0x19')](function(){return _0x49e53c;});})[_0x5b87('0x19')](function(){_0x16b405[_0x5b87('0x23')](0xcc)[_0x5b87('0x24')]();});}};}function handleEntityNotFound(_0x2939d8){return function(_0xa156d2){if(!_0xa156d2){_0x2939d8['sendStatus'](0x194);}return _0xa156d2;};}function handleError(_0x44bd01,_0x5be666){_0x5be666=_0x5be666||0x1f4;return function(_0x2978d5){logger[_0x5b87('0x1e')](_0x2978d5[_0x5b87('0x3d')]);if(_0x2978d5['name']){delete _0x2978d5['name'];}_0x44bd01[_0x5b87('0x23')](_0x5be666)[_0x5b87('0x3e')](_0x2978d5);};}exports[_0x5b87('0x3f')]=function(_0x6e5ad8,_0x15730a){var _0x36281c={},_0x35b135={'count':0x0,'rows':[]};var _0x420c3d=_(db[_0x5b87('0x40')]['rawAttributes'])[_0x5b87('0x37')](function(_0x5a7cb6){return{'name':_0x5a7cb6[_0x5b87('0x41')],'type':_0x5a7cb6[_0x5b87('0x42')]['key']};})[_0x5b87('0x35')](function(_0xb2aa99){return!_['includes']([_0x5b87('0x43'),'salt'],_0xb2aa99[_0x5b87('0x3b')]);})[_0x5b87('0x38')]();_0x36281c=qs[_0x5b87('0x44')](_0x420c3d,_0x6e5ad8);var _0x27d6fd={'where':_0x36281c['where']};return db['User'][_0x5b87('0x28')](_0x27d6fd)['then'](function(_0x557e2c){_0x35b135[_0x5b87('0x28')]=_0x557e2c;if(_0x6e5ad8['query'][_0x5b87('0x45')]){_0x36281c[_0x5b87('0x46')]=[{'all':!![]}];}if(_0x6e5ad8[_0x5b87('0x47')]['userSetting']===_0x5b87('0x48')){_0x36281c['include']=[{'model':db[_0x5b87('0x49')],'as':_0x5b87('0x4a')}];}if(!_[_0x5b87('0x39')](_0x36281c[_0x5b87('0x4b')],'id')){_0x36281c[_0x5b87('0x4b')][_0x5b87('0x4c')]('id');}return db['User'][_0x5b87('0x4d')](_0x36281c);})[_0x5b87('0x19')](function(_0x376762){_0x35b135[_0x5b87('0x4e')]=_0x376762;if(_0x6e5ad8['query'][_0x5b87('0x4f')]===_0x5b87('0x48')){var _0x1eb624=[];for(var _0xbffbd=0x0;_0xbffbd<_0x35b135[_0x5b87('0x4e')][_0x5b87('0x50')];_0xbffbd++){_0x1eb624['push'](get_open_tabs(_0x5b87('0x51'),_0x35b135['rows'][_0xbffbd][_0x5b87('0x52')]));_0x1eb624[_0x5b87('0x4c')](get_open_tabs('sms',_0x35b135[_0x5b87('0x4e')][_0xbffbd][_0x5b87('0x52')]));_0x1eb624['push'](get_open_tabs(_0x5b87('0x53'),_0x35b135[_0x5b87('0x4e')][_0xbffbd][_0x5b87('0x52')]));_0x1eb624[_0x5b87('0x4c')](get_open_tabs(_0x5b87('0x54'),_0x35b135[_0x5b87('0x4e')][_0xbffbd]['dataValues']));_0x1eb624[_0x5b87('0x4c')](get_open_tabs(_0x5b87('0x55'),_0x35b135[_0x5b87('0x4e')][_0xbffbd]['dataValues']));_0x1eb624[_0x5b87('0x4c')](get_open_tabs(_0x5b87('0x56'),_0x35b135[_0x5b87('0x4e')][_0xbffbd][_0x5b87('0x52')]));}return Promise[_0x5b87('0x57')](_0x1eb624)[_0x5b87('0x19')](function(){return _0x35b135;});}else{return _0x35b135;}})[_0x5b87('0x19')](respondWithFilteredResult(_0x15730a,_0x36281c))['catch'](handleError(_0x15730a,null));};exports[_0x5b87('0x58')]=function(_0x57e196,_0x1fcc6e){var _0x2b113d={'raw':![],'where':{'id':_0x57e196[_0x5b87('0x59')]['id']}},_0x1ad21a={};_0x1ad21a[_0x5b87('0x5a')]=_[_0x5b87('0x5b')](_[_0x5b87('0x5c')](db['User'][_0x5b87('0x5d')]),[_0x5b87('0x43'),_0x5b87('0x5e')]);_0x1ad21a[_0x5b87('0x47')]=_[_0x5b87('0x5c')](_0x57e196[_0x5b87('0x47')]);_0x1ad21a['filters']=_[_0x5b87('0x5f')](_0x1ad21a[_0x5b87('0x5a')],_0x1ad21a[_0x5b87('0x47')]);_0x2b113d[_0x5b87('0x4b')]=_[_0x5b87('0x5f')](_0x1ad21a[_0x5b87('0x5a')],qs['fields'](_0x57e196[_0x5b87('0x47')]['fields']));_0x2b113d[_0x5b87('0x4b')]=_0x2b113d[_0x5b87('0x4b')][_0x5b87('0x50')]?_0x2b113d['attributes']:_0x1ad21a['model'];if(_0x57e196[_0x5b87('0x47')][_0x5b87('0x45')]){_0x2b113d[_0x5b87('0x46')]=[{'all':!![]}];}if(_0x57e196['query'][_0x5b87('0x4a')]===_0x5b87('0x48')){_0x2b113d[_0x5b87('0x46')]=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x2b113d=_['merge']({},_0x2b113d,_0x57e196[_0x5b87('0x60')]);if(!_[_0x5b87('0x39')](_0x2b113d[_0x5b87('0x4b')],'id')){_0x2b113d[_0x5b87('0x4b')][_0x5b87('0x4c')]('id');}return db[_0x5b87('0x40')][_0x5b87('0x3a')](_0x2b113d)[_0x5b87('0x19')](handleEntityNotFound(_0x1fcc6e,null))[_0x5b87('0x19')](function(_0x5d59d5){var _0x24288c=[];values=_0x5d59d5;if(_0x57e196[_0x5b87('0x47')][_0x5b87('0x4f')]===_0x5b87('0x48')){_0x24288c['push'](get_open_tabs('chat',_0x5d59d5[_0x5b87('0x52')]));_0x24288c['push'](get_open_tabs('sms',_0x5d59d5[_0x5b87('0x52')]));_0x24288c[_0x5b87('0x4c')](get_open_tabs(_0x5b87('0x55'),_0x5d59d5[_0x5b87('0x52')]));_0x24288c['push'](get_open_tabs(_0x5b87('0x56'),_0x5d59d5[_0x5b87('0x52')]));_0x24288c[_0x5b87('0x4c')](get_open_tabs(_0x5b87('0x53'),_0x5d59d5['dataValues']));_0x24288c[_0x5b87('0x4c')](get_open_tabs(_0x5b87('0x54'),_0x5d59d5[_0x5b87('0x52')]));return Promise['all'](_0x24288c);}else{return values;}})[_0x5b87('0x19')](function(){return values;})[_0x5b87('0x19')](respondWithResult(_0x1fcc6e,null))[_0x5b87('0x22')](handleError(_0x1fcc6e,null));};exports['update']=function(_0x3e3428,_0x383e02){if(_0x3e3428[_0x5b87('0x61')]['id']){delete _0x3e3428[_0x5b87('0x61')]['id'];}delete _0x3e3428['body'][_0x5b87('0x2d')];return db['User'][_0x5b87('0x3a')]({'where':{'id':_0x3e3428[_0x5b87('0x59')]['id']}})[_0x5b87('0x19')](handleEntityNotFound(_0x383e02,null))['then'](saveUpdates(_0x3e3428[_0x5b87('0x61')],null))[_0x5b87('0x19')](respondWithResult(_0x383e02,null))[_0x5b87('0x22')](handleError(_0x383e02,null));};exports[_0x5b87('0x62')]=function(_0x44c247,_0x5a1e5c){return db[_0x5b87('0x40')][_0x5b87('0x62')]()['then'](respondWithResult(_0x5a1e5c,null))['catch'](handleError(_0x5a1e5c,null));};exports[_0x5b87('0x63')]=function(_0x130d01,_0x575108){return db[_0x5b87('0x40')][_0x5b87('0x3a')]({'where':{'id':_0x130d01[_0x5b87('0x59')]['id']}})['then'](handleEntityNotFound(_0x575108,null))[_0x5b87('0x19')](function(_0xf6f32e){if(_0xf6f32e){return _0xf6f32e[_0x5b87('0x63')](_0x130d01[_0x5b87('0x61')]['ids'],_[_0x5b87('0x64')](_0x130d01[_0x5b87('0x61')],[_0x5b87('0x65'),'id'])||{});}})['then'](respondWithResult(_0x575108,null))[_0x5b87('0x22')](handleError(_0x575108,null));};function validateUser(_0x4d33ee){return new Promise(function(_0x61b497,_0x4816ac){if(_0x4d33ee['internal'])return _0x61b497(_0x4d33ee);return db['Setting'][_0x5b87('0x66')](0x1)[_0x5b87('0x19')](function(_0x3d3c83){if(_0x3d3c83[_0x5b87('0x67')])authService['validatePasswordPattern'](_0x4d33ee[_0x5b87('0x43')]);db[_0x5b87('0x40')][_0x5b87('0x68')](_0x5b87('0x69'))['then'](function(_0x388016){if(_[_0x5b87('0x6a')](_0x388016)){_0x4d33ee[_0x5b87('0x69')]=_0x3d3c83[_0x5b87('0x6b')]||0x1;return;}if(_[_0x5b87('0x6a')](_0x3d3c83[_0x5b87('0x6b')])||_0x3d3c83[_0x5b87('0x6b')]===_0x388016){_0x4d33ee['internal']=_0x388016+0x1;return;}if(_0x3d3c83['min_internal']>_0x388016){_0x4d33ee[_0x5b87('0x69')]=_0x3d3c83[_0x5b87('0x6b')];return;}return db['sequelize']['query'](_0x5b87('0x6c'),{'type':db[_0x5b87('0x6d')][_0x5b87('0x6e')][_0x5b87('0x6f')]})[_0x5b87('0x19')](function(_0x140afe){if(_0x140afe&&_0x140afe['length']){for(var _0x57cf5f=0x0,_0x9a9c21=_0x140afe['length'];_0x57cf5f<_0x9a9c21&&_[_0x5b87('0x6a')](_0x4d33ee[_0x5b87('0x69')]);_0x57cf5f++){if(_0x3d3c83[_0x5b87('0x6b')]<=_0x140afe[_0x57cf5f]['from']){_0x4d33ee[_0x5b87('0x69')]=_0x140afe[_0x57cf5f][_0x5b87('0x70')];}else if(_0x3d3c83[_0x5b87('0x6b')]>_0x140afe[_0x57cf5f]['from']&&_0x3d3c83[_0x5b87('0x6b')]<=_0x140afe[_0x57cf5f]['to']){_0x4d33ee[_0x5b87('0x69')]=_0x3d3c83['min_internal'];}}}if(_[_0x5b87('0x6a')](_0x4d33ee[_0x5b87('0x69')])){_0x4d33ee[_0x5b87('0x69')]=_0x388016+0x1;}return _0x61b497(_0x4d33ee);});});})['catch'](function(_0x4cb0b1){_0x4816ac(_0x4cb0b1);});});}function updateUser(_0x3ca819){return new Promise(function(_0x2251bd,_0x335c75){try{if(_0x3ca819[_0x5b87('0x71')]){_0x3ca819[_0x5b87('0x72')]=_0x3ca819[_0x5b87('0x69')];_0x3ca819[_0x5b87('0x73')]={'mailbox':_0x3ca819[_0x5b87('0x69')],'password':_0x3ca819['password'],'fullname':_0x3ca819[_0x5b87('0x74')],'email':_0x3ca819[_0x5b87('0x75')]};}if(_0x3ca819[_0x5b87('0x2d')]===_0x5b87('0x32')){if(!_0x3ca819[_0x5b87('0x76')])_0x3ca819[_0x5b87('0x76')]=[_0x5b87('0x77'),'102',_0x5b87('0x78'),_0x5b87('0x79'),_0x5b87('0x7a'),_0x5b87('0x7b'),_0x5b87('0x7c'),_0x5b87('0x7d'),_0x5b87('0x7e'),_0x5b87('0x7f'),'109','100','111',_0x5b87('0x80'),_0x5b87('0x81')];}_0x2251bd(_0x3ca819);}catch(_0x1d317d){_0x335c75(_0x1d317d);}});}exports[_0x5b87('0x82')]=function(_0x33342f,_0x2fe539){if(_0x33342f[_0x5b87('0x83')][_0x5b87('0x2d')]===_0x5b87('0x32'))throw new Error(_0x5b87('0x84'));if(_0x33342f[_0x5b87('0x61')]['role']===_0x5b87('0x83')&&_0x33342f[_0x5b87('0x83')][_0x5b87('0x2d')]!==_0x5b87('0x85')){throw new Error(_0x5b87('0x86'));}if(_0x33342f['body'][_0x5b87('0x2d')]===_0x5b87('0x85')&&_0x33342f[_0x5b87('0x83')][_0x5b87('0x2d')]!==_0x5b87('0x85')){throw new Error(_0x5b87('0x87'));}return licenseUtil[_0x5b87('0x88')]([_0x33342f[_0x5b87('0x61')]])[_0x5b87('0x19')](function(){return validateUser(_0x33342f[_0x5b87('0x61')]);})[_0x5b87('0x19')](function(_0x3fc021){return updateUser(_0x3fc021)[_0x5b87('0x19')](function(_0x3cbb83){if(_0x3cbb83[_0x5b87('0x2d')]==='admin'){_0x3cbb83[_0x5b87('0x89')]=_0x33342f[_0x5b87('0x83')][_0x5b87('0x89')];delete _0x3cbb83['userProfileId'];}return _0x3cbb83;});})[_0x5b87('0x19')](function(_0x194adb){return db[_0x5b87('0x40')][_0x5b87('0x82')](_0x194adb,{'include':[{'model':db[_0x5b87('0x73')],'as':_0x5b87('0x73')}]});})[_0x5b87('0x19')](function(_0x346855){if(_0x33342f[_0x5b87('0x61')][_0x5b87('0x2d')]===_0x5b87('0x83'))return _0x346855;if(_0x33342f[_0x5b87('0x83')][_0x5b87('0x2d')]!==_0x5b87('0x83'))return _0x346855;return db[_0x5b87('0x8a')]['find']({'where':{'name':_0x346855[_0x5b87('0x2d')]===_0x5b87('0x32')?'Agents':_0x5b87('0x33'),'userProfileId':_0x33342f['user'][_0x5b87('0x8b')]},'raw':!![]})['then'](function(_0x55c71d){if(!_0x55c71d||_0x55c71d['autoAssociation']!=0x0)return _0x346855;return db[_0x5b87('0x3c')][_0x5b87('0x82')]({'name':_0x346855[_0x5b87('0x3b')],'resourceId':_0x346855['id'],'type':_0x55c71d[_0x5b87('0x3b')],'sectionId':_0x55c71d['id']},{})[_0x5b87('0x19')](function(){return _0x346855;});})[_0x5b87('0x22')](function(_0x2c6e51){logger[_0x5b87('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c6e51);throw _0x2c6e51;});})[_0x5b87('0x19')](respondWithResult(_0x2fe539,0xc9))[_0x5b87('0x22')](handleError(_0x2fe539,null));};exports[_0x5b87('0x8c')]=function(_0x33a101,_0x5ba37e){var _0x1e1687=_0x33a101[_0x5b87('0x61')];var _0x335674=[];if(_0x33a101[_0x5b87('0x83')]['role']===_0x5b87('0x32'))throw new Error('Unauthorized');if(_[_0x5b87('0x8d')](_0x1e1687,[_0x5b87('0x2d'),'user'])&&_0x33a101[_0x5b87('0x83')]['role']!==_0x5b87('0x85')){throw new Error(_0x5b87('0x86'));}if(_[_0x5b87('0x8d')](_0x1e1687,[_0x5b87('0x2d'),_0x5b87('0x85')])&&_0x33a101[_0x5b87('0x83')][_0x5b87('0x2d')]!=='admin'){throw new Error(_0x5b87('0x8e'));}return licenseUtil[_0x5b87('0x88')](_0x1e1687)[_0x5b87('0x19')](function(){return validateUser(_0x1e1687[0x0]);})[_0x5b87('0x19')](function(){for(var _0x3a1a21=0x1;_0x3a1a21<_0x1e1687[_0x5b87('0x50')];_0x3a1a21++){var _0x4baf6c=_0x1e1687[_0x3a1a21-0x1][_0x5b87('0x69')];if(!_0x1e1687[_0x3a1a21][_0x5b87('0x69')])_0x1e1687[_0x3a1a21][_0x5b87('0x69')]=_0x4baf6c+0x1;_0x335674[_0x5b87('0x4c')](validateUser(_0x1e1687[_0x3a1a21]));}return Promise[_0x5b87('0x57')](_0x335674);})[_0x5b87('0x19')](function(){_0x335674=[];for(var _0x193192=0x0;_0x193192<_0x1e1687[_0x5b87('0x50')];_0x193192++){_0x335674[_0x5b87('0x4c')](updateUser(_0x1e1687[_0x193192]));}return Promise[_0x5b87('0x57')](_0x335674);})[_0x5b87('0x19')](function(){_0x335674=_0x1e1687['map'](function(_0x301c86){return db[_0x5b87('0x40')][_0x5b87('0x82')](_0x301c86,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x5b87('0x19')](function(_0x412946){_0x301c86['id']=_0x412946['id'];return _0x301c86;});});return Promise[_0x5b87('0x57')](_0x335674);})[_0x5b87('0x19')](function(_0x3c1322){if(_0x33a101[_0x5b87('0x61')][_0x5b87('0x2d')]===_0x5b87('0x83'))return _0x3c1322;if(_0x33a101[_0x5b87('0x83')][_0x5b87('0x2d')]!==_0x5b87('0x83'))return _0x3c1322;var _0x2a9c48=_[_0x5b87('0x8d')](_0x3c1322,function(_0x2d09b7){return _0x2d09b7[_0x5b87('0x2d')]===_0x5b87('0x32')||_0x2d09b7[_0x5b87('0x2d')]===_0x5b87('0x34');});if(!_0x2a9c48)return _0x3c1322;return db[_0x5b87('0x8a')][_0x5b87('0x4d')]({'where':{'name':{'$or':[_0x5b87('0x31'),_0x5b87('0x33')]},'userProfileId':_0x33a101[_0x5b87('0x83')][_0x5b87('0x8b')]},'raw':!![]})[_0x5b87('0x19')](function(_0x1d8ef1){if(_[_0x5b87('0x8f')](_0x1d8ef1)||!_[_0x5b87('0x8d')](_0x1d8ef1,[_0x5b87('0x90'),0x0]))return _0x3c1322;_0x335674=[];var _0x507797=_(_0x1d8ef1)['map'](function(_0x4efa03){if(_0x4efa03[_0x5b87('0x90')]===0x1)return;return _0x4efa03[_0x5b87('0x3b')]==='Agents'?'agent':_0x5b87('0x34');})[_0x5b87('0x91')]()['value']();for(var _0x24fb69=0x0;_0x24fb69<_0x3c1322[_0x5b87('0x50')];_0x24fb69++){if(!_[_0x5b87('0x39')](_0x507797,_0x3c1322[_0x24fb69]['role']))return;var _0x28e459=_0x3c1322[_0x24fb69][_0x5b87('0x2d')]===_0x5b87('0x32')?'Agents':_0x5b87('0x33');_0x335674[_0x5b87('0x4c')](db['UserProfileResource'][_0x5b87('0x82')]({'name':_0x3c1322[_0x24fb69][_0x5b87('0x3b')],'resourceId':_0x3c1322[_0x24fb69]['id'],'type':_0x28e459,'sectionId':_[_0x5b87('0x3a')](_0x1d8ef1,[_0x5b87('0x3b'),_0x28e459])['id']},{}));}return Promise[_0x5b87('0x57')](_0x335674);});})[_0x5b87('0x19')](respondWithResult(_0x5ba37e,0xc9))[_0x5b87('0x22')](handleError(_0x5ba37e,null));};exports['changePassword']=function(_0x2979ba,_0x4ea4b0){if(_0x2979ba['body']['id']){delete _0x2979ba[_0x5b87('0x61')]['id'];}return db[_0x5b87('0x40')]['find']({'where':{'id':_0x2979ba[_0x5b87('0x59')]['id']}})['then'](function(_0x263e34){if(!_0x263e34)return null;if(_0x263e34['id']===_0x2979ba['user']['id']){if(!_0x2979ba[_0x5b87('0x61')][_0x5b87('0x92')]||!_0x2979ba[_0x5b87('0x61')][_0x5b87('0x93')]){throw new db[(_0x5b87('0x94'))][(_0x5b87('0x95'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x263e34['authenticate'](_0x2979ba[_0x5b87('0x61')][_0x5b87('0x92')])){throw new db[(_0x5b87('0x94'))][(_0x5b87('0x95'))](_0x5b87('0x96'));}if(_0x2979ba[_0x5b87('0x61')][_0x5b87('0x92')]===_0x2979ba[_0x5b87('0x61')][_0x5b87('0x93')]){throw new db[(_0x5b87('0x94'))][(_0x5b87('0x95'))](_0x5b87('0x97'));}}else if(_0x2979ba[_0x5b87('0x83')]['role']==='admin'){if(!_0x2979ba[_0x5b87('0x61')][_0x5b87('0x93')]){throw new db['Sequelize'][(_0x5b87('0x95'))](_0x5b87('0x98'));}}else if(_0x2979ba[_0x5b87('0x83')][_0x5b87('0x2d')]===_0x5b87('0x83')){if(!_0x2979ba['body'][_0x5b87('0x93')]){throw new db[(_0x5b87('0x94'))]['ValidationError'](_0x5b87('0x98'));}if(_0x263e34[_0x5b87('0x2d')]!==_0x5b87('0x32')){throw new db[(_0x5b87('0x94'))][(_0x5b87('0x95'))]('Unauthorized');}}else{throw new db[(_0x5b87('0x94'))][(_0x5b87('0x95'))](_0x5b87('0x84'));}return _0x263e34;})[_0x5b87('0x19')](handleEntityNotFound(_0x4ea4b0,null))[_0x5b87('0x19')](function(_0xd0cfe3){return db[_0x5b87('0x99')][_0x5b87('0x9a')]({'attributes':['id','securePassword',_0x5b87('0x9b'),'passwordHistoryLimit']})[_0x5b87('0x19')](function(_0x56988e){if(_0x56988e['securePassword'])authService[_0x5b87('0x9c')](_0x2979ba['body'][_0x5b87('0x93')]);if(!_0x56988e[_0x5b87('0x9b')]||!_0xd0cfe3[_0x5b87('0x9d')])return _0xd0cfe3;authService[_0x5b87('0x9e')](_0x2979ba[_0x5b87('0x61')][_0x5b87('0x93')],_0xd0cfe3[_0x5b87('0x9d')],_0x56988e[_0x5b87('0x9f')]);return _0xd0cfe3;})[_0x5b87('0x19')](saveUpdates({'password':_0x2979ba[_0x5b87('0x61')]['newPassword'],'passwordResetAt':_0x2979ba['user']['id']==_0x2979ba['params']['id']?moment():null,'previousPasswords':authService[_0x5b87('0xa0')](_0x2979ba[_0x5b87('0x61')]['newPassword'],_0xd0cfe3[_0x5b87('0x9d')])},null));})[_0x5b87('0x19')](respondWithResult(_0x4ea4b0,null))[_0x5b87('0x22')](handleError(_0x4ea4b0,null));};exports['addQueues']=function(_0x27c8d5,_0x30493e){var _0x1811a5=_0x27c8d5[_0x5b87('0x61')][_0x5b87('0xa1')];return db[_0x5b87('0x40')][_0x5b87('0x3a')]({'where':{'id':_0x27c8d5[_0x5b87('0x59')]['id']},'attributes':['id',_0x5b87('0x3b'),_0x5b87('0x2d'),_0x5b87('0xa2'),'loginInPause',_0x5b87('0xa3'),_0x5b87('0xa4')]})[_0x5b87('0x19')](handleEntityNotFound(_0x30493e,null))[_0x5b87('0x19')](function(_0x26bce7){if(_0x26bce7){if(!utils['isValidChannel'](_0x1811a5)){throw new db[(_0x5b87('0x94'))]['ValidationError']('Unknown\x20channel');}return _0x26bce7[_0x5b87('0xa5')+_[_0x5b87('0xa6')](_0x1811a5[_0x5b87('0xa7')]())+_0x5b87('0xa8')](_0x27c8d5[_0x5b87('0x61')][_0x5b87('0x65')],{'penalty':_0x27c8d5[_0x5b87('0x61')]['penalty']||0x0})[_0x5b87('0xa9')](function(_0x1a394b){for(var _0x397e46=0x0;_0x397e46<_0x27c8d5['body']['ids'][_0x5b87('0x50')];_0x397e46+=0x1){var _0x2d00b5={'UserId':Number(_0x27c8d5['params']['id'])};_0x2d00b5[_['capitalize'](_0x1811a5[_0x5b87('0xa7')]())+_0x5b87('0xaa')]=Number(_0x27c8d5[_0x5b87('0x61')][_0x5b87('0x65')][_0x397e46]);socket[_0x5b87('0xab')](_0x5b87('0x83')+_[_0x5b87('0xa6')](_0x1811a5[_0x5b87('0xa7')]())+_0x5b87('0xac'),_0x2d00b5);}return _0x1a394b;})[_0x5b87('0x19')](function(){if(_0x1811a5===_0x5b87('0xad')){return db[_0x5b87('0xae')][_0x5b87('0x4d')]({'where':{'id':_0x27c8d5[_0x5b87('0x61')][_0x5b87('0x65')]||[]},'raw':!![],'attributes':['id',_0x5b87('0x3b')]});}})[_0x5b87('0x19')](function(_0x2881b3){var _0x353110=_0x26bce7[_0x5b87('0x2f')]({'plain':!![]});var _0x2e1aca=[];if(_0x1811a5==='voice'&&_0x353110[_0x5b87('0x2d')]===_0x5b87('0x32')&&_0x353110['online']){for(let _0x180a32=0x0;_0x180a32<_0x2881b3[_0x5b87('0x50')];_0x180a32+=0x1){_0x2e1aca[_0x5b87('0x4c')]({'membername':_0x353110[_0x5b87('0x3b')],'UserId':_0x353110['id'],'queue_name':_0x2881b3[_0x180a32][_0x5b87('0x3b')],'VoiceQueueId':_0x2881b3[_0x180a32]['id'],'interface':_[_0x5b87('0x6a')](_0x353110['interface'])?util[_0x5b87('0xaf')](_0x5b87('0xb0'),_0x353110[_0x5b87('0x3b')]):_0x353110[_0x5b87('0xa4')],'paused':_0x353110['voicePause']||![],'penalty':_0x27c8d5[_0x5b87('0x61')][_0x5b87('0xb1')]||0x0});}return Promise[_0x5b87('0x57')](_0x2e1aca[_0x5b87('0x37')](function(_0x1d48c4){return db['UserVoiceQueueRt'][_0x5b87('0xb2')](_0x1d48c4);}));}return _0x26bce7;});}})[_0x5b87('0x19')](respondWithStatusCode(_0x30493e,null))[_0x5b87('0x22')](handleError(_0x30493e,null));};exports['removeQueues']=function(_0x5f4f7a,_0x107667){var _0x2b419b,_0x2d230e;return db[_0x5b87('0x40')][_0x5b87('0x3a')]({'where':{'id':_0x5f4f7a[_0x5b87('0x59')]['id']},'attributes':['id',_0x5b87('0x3b'),_0x5b87('0x2d')]})[_0x5b87('0x19')](handleEntityNotFound(_0x107667,null))[_0x5b87('0x19')](function(_0xa7a722){if(_0xa7a722){_0x2b419b=_0xa7a722;if(!_0x5f4f7a[_0x5b87('0x47')][_0x5b87('0xa1')]||!utils['isValidChannel'](_0x5f4f7a[_0x5b87('0x47')][_0x5b87('0xa1')])){throw new db[(_0x5b87('0x94'))][(_0x5b87('0x95'))](_0x5b87('0xb3'));}return _0xa7a722['remove'+_[_0x5b87('0xa6')](_0x5f4f7a[_0x5b87('0x47')][_0x5b87('0xa1')][_0x5b87('0xa7')]())+_0x5b87('0xa8')](_0x5f4f7a[_0x5b87('0x47')][_0x5b87('0x65')]);}})['then'](function(_0x18f0ea){if(_[_0x5b87('0xb4')](_0x5f4f7a[_0x5b87('0x47')]['ids'])){for(var _0x58072b=0x0;_0x58072b<_0x5f4f7a[_0x5b87('0x47')][_0x5b87('0x65')][_0x5b87('0x50')];_0x58072b+=0x1){_0x2d230e={'UserId':Number(_0x5f4f7a[_0x5b87('0x59')]['id'])};_0x2d230e[_[_0x5b87('0xa6')](_0x5f4f7a[_0x5b87('0x47')][_0x5b87('0xa1')][_0x5b87('0xa7')]())+'QueueId']=Number(_0x5f4f7a[_0x5b87('0x47')]['ids'][_0x58072b]);socket[_0x5b87('0xab')](_0x5b87('0x83')+_['capitalize'](_0x5f4f7a[_0x5b87('0x47')][_0x5b87('0xa1')][_0x5b87('0xa7')]())+_0x5b87('0xb5'),_0x2d230e);}}else{_0x2d230e={'UserId':Number(_0x5f4f7a[_0x5b87('0x59')]['id'])};_0x2d230e[_[_0x5b87('0xa6')](_0x5f4f7a[_0x5b87('0x47')][_0x5b87('0xa1')][_0x5b87('0xa7')]())+_0x5b87('0xaa')]=Number(_0x5f4f7a[_0x5b87('0x47')][_0x5b87('0x65')]);socket['emit'](_0x5b87('0x83')+_[_0x5b87('0xa6')](_0x5f4f7a[_0x5b87('0x47')][_0x5b87('0xa1')]['toLowerCase']())+_0x5b87('0xb5'),_0x2d230e);}return _0x18f0ea;})[_0x5b87('0x19')](function(){if(_0x5f4f7a[_0x5b87('0x47')]['channel']==='voice'){return db[_0x5b87('0xb6')][_0x5b87('0x2e')]({'where':{'UserId':_0x5f4f7a[_0x5b87('0x59')]['id'],'VoiceQueueId':_0x5f4f7a[_0x5b87('0x47')]['ids']},'individualHooks':!![]})[_0x5b87('0x19')](function(){return _0x2b419b;});}return _0x2b419b;})[_0x5b87('0x19')](respondWithStatusCode(_0x107667,null))[_0x5b87('0x22')](handleError(_0x107667,null));};exports[_0x5b87('0xb7')]=function(_0x234a65,_0x1cb86c){_0x234a65[_0x5b87('0x61')]['userpic']=_0x234a65['file'][_0x5b87('0xb8')];return db['User'][_0x5b87('0x3a')]({'where':{'id':_0x234a65[_0x5b87('0x59')]['id']}})[_0x5b87('0x19')](handleEntityNotFound(_0x1cb86c,null))['then'](saveUpdates(_0x234a65[_0x5b87('0x61')],null))[_0x5b87('0x19')](respondWithResult(_0x1cb86c,null))[_0x5b87('0x22')](handleError(_0x1cb86c,null));};exports[_0x5b87('0xb9')]=function(_0x27d092,_0x6cbd86){var _0x5434ed=path['join'](config[_0x5b87('0xba')],_0x5b87('0xbb'));return db['User'][_0x5b87('0x3a')]({'where':{'id':_0x27d092['params']['id']},'attributes':['id',_0x5b87('0xbc')],'raw':!![]})[_0x5b87('0x19')](handleEntityNotFound(_0x6cbd86,null))[_0x5b87('0x19')](function(_0x46b335){if(_0x46b335){if(_[_0x5b87('0x6a')](_0x46b335[_0x5b87('0xbc')])){return _0x6cbd86[_0x5b87('0xbd')](_0x5434ed);}else{if(!fs[_0x5b87('0xbe')](path[_0x5b87('0xbf')](config['root'],'server/files/images/',_0x46b335[_0x5b87('0xbc')]))){return _0x6cbd86[_0x5b87('0xbd')](_0x5434ed);}return _0x6cbd86[_0x5b87('0xbd')](path[_0x5b87('0xbf')](config[_0x5b87('0xba')],_0x5b87('0xc0'),_0x46b335[_0x5b87('0xbc')]));}}})[_0x5b87('0x22')](handleError(_0x6cbd86,null));};exports[_0x5b87('0xc1')]=function(_0x144bfb,_0x47710f){return db['User'][_0x5b87('0x3a')]({'where':{'id':_0x144bfb[_0x5b87('0x59')]['id']},'attributes':['id']})[_0x5b87('0x19')](handleEntityNotFound(_0x47710f,null))[_0x5b87('0x19')](function(_0x126cb3){var _0x4309c2=[];values=_0x126cb3[_0x5b87('0x52')];_0x4309c2[_0x5b87('0x4c')](get_open_tabs(_0x5b87('0x51'),_0x126cb3['dataValues']));_0x4309c2[_0x5b87('0x4c')](get_open_tabs('sms',_0x126cb3[_0x5b87('0x52')]));_0x4309c2[_0x5b87('0x4c')](get_open_tabs(_0x5b87('0x55'),_0x126cb3[_0x5b87('0x52')]));_0x4309c2[_0x5b87('0x4c')](get_open_tabs(_0x5b87('0x56'),_0x126cb3[_0x5b87('0x52')]));_0x4309c2[_0x5b87('0x4c')](get_open_tabs(_0x5b87('0x53'),_0x126cb3[_0x5b87('0x52')]));_0x4309c2[_0x5b87('0x4c')](get_open_tabs('mail',_0x126cb3[_0x5b87('0x52')]));return Promise[_0x5b87('0x57')](_0x4309c2);})[_0x5b87('0x19')](function(_0x18db94){if(_0x18db94){var _0x2ba915=_[_0x5b87('0x37')](values[_0x5b87('0xc2')],function(_0x2cc57a){return{'channel':'CHAT','id':_0x2cc57a['id'],'createdAt':_0x2cc57a[_0x5b87('0xc3')]};});var _0x3c8d21=_[_0x5b87('0x37')](values[_0x5b87('0xc4')],function(_0x1e9c60){return{'channel':_0x5b87('0xc5'),'id':_0x1e9c60['id'],'createdAt':_0x1e9c60[_0x5b87('0xc3')]};});var _0xcb3992=_[_0x5b87('0x37')](values[_0x5b87('0xc6')],function(_0xa5250){return{'channel':_0x5b87('0xc7'),'id':_0xa5250['id'],'createdAt':_0xa5250[_0x5b87('0xc3')]};});var _0x155872=_[_0x5b87('0x37')](values['MailOpenTabs'],function(_0x42396a){return{'channel':'MAIL','id':_0x42396a['id'],'createdAt':_0x42396a['createdAt']};});var _0x4ff940=_['map'](values['SmsOpenTabs'],function(_0x413cc2){return{'channel':_0x5b87('0xc8'),'id':_0x413cc2['id'],'createdAt':_0x413cc2[_0x5b87('0xc3')]};});var _0x4ede03=_['map'](values[_0x5b87('0xc9')],function(_0xd34359){return{'channel':_0x5b87('0xca'),'id':_0xd34359['id'],'createdAt':_0xd34359[_0x5b87('0xc3')]};});var _0x2da844=_[_0x5b87('0xcb')](_0x2ba915,_0x3c8d21,_0xcb3992,_0x155872,_0x4ff940,_0x4ede03);var _0x25f90c={'count':_0x2da844[_0x5b87('0x50')],'rows':_0x2da844};return _0x25f90c;}else return null;})[_0x5b87('0x19')](respondWithResult(_0x47710f,null))[_0x5b87('0x22')](handleError(_0x47710f,null));};exports['getContacts']=function(_0x203bfc,_0x49796d){var _0x729b3e={};return db[_0x5b87('0x40')][_0x5b87('0x9a')]({'where':{'id':_0x203bfc[_0x5b87('0x59')]['id']}})['then'](function(_0x4ead9d){if(!_0x4ead9d){throw new APINotFoundError(util[_0x5b87('0xaf')]('User\x20with\x20id\x20%s\x20not\x20found',_0x203bfc[_0x5b87('0x59')]['id']));}return contacts['describe']();})[_0x5b87('0x19')](function(_0x332a16){_0x203bfc[_0x5b87('0x47')][_0x5b87('0x40')]=_0x203bfc[_0x5b87('0x59')]['id'];_0x729b3e=qs['getOptions'](_0x332a16,_0x203bfc);if(_0x203bfc['query']['hasOwnProperty'](_0x5b87('0x45'))){_0x729b3e[_0x5b87('0x46')]=[{'model':db[_0x5b87('0xcc')],'as':'List','required':![]},{'model':db['Tag'],'as':_0x5b87('0xcd'),'attributes':['id',_0x5b87('0x3b'),_0x5b87('0xce')],'where':_0x203bfc[_0x5b87('0x47')]['tag']?{'id':_0x203bfc[_0x5b87('0x47')][_0x5b87('0xcf')]}:undefined,'required':_0x203bfc[_0x5b87('0x47')]['tag']?!![]:![]}];}return contacts['findAll'](_0x203bfc['query'],_0x203bfc[_0x5b87('0x83')],_0x729b3e,_0x332a16);})[_0x5b87('0x19')](respondWithFilteredResult(_0x49796d,_0x729b3e))[_0x5b87('0x22')](APIHandleError(_0x49796d));};exports['getQueues']=function(_0xb6f134,_0x309c9d){var _0x3551b7;var _0x15edc6={};var _0x5bf4d0;return db[_0x5b87('0x40')][_0x5b87('0x9a')]({'where':{'id':_0xb6f134['params']['id']},'attributes':['id','name',_0x5b87('0x2d')]})[_0x5b87('0x19')](handleEntityNotFound(_0x309c9d,null))[_0x5b87('0x19')](function(_0x2866d6){if(!utils[_0x5b87('0xd0')](_0xb6f134[_0x5b87('0x47')][_0x5b87('0xa1')])){throw new db['Sequelize'][(_0x5b87('0x95'))](_0x5b87('0xb3'));}_0x3551b7=_0x2866d6;var _0x1bd574={};_0x1bd574['model']=_[_0x5b87('0x5c')](db[_[_0x5b87('0xa6')](_0xb6f134[_0x5b87('0x47')][_0x5b87('0xa1')])+_0x5b87('0xd1')][_0x5b87('0x5d')]);_0x1bd574[_0x5b87('0x47')]=_['keys'](_0xb6f134[_0x5b87('0x47')]);_0x1bd574[_0x5b87('0xd2')]=_[_0x5b87('0x5f')](_0x1bd574[_0x5b87('0x5a')],_0x1bd574[_0x5b87('0x47')]);_0x15edc6[_0x5b87('0x4b')]=_[_0x5b87('0x5f')](_0x1bd574[_0x5b87('0x5a')],qs[_0x5b87('0xd3')](_0xb6f134['query'][_0x5b87('0xd3')]));_0x15edc6['attributes']=_0x15edc6[_0x5b87('0x4b')][_0x5b87('0x50')]?_0x15edc6['attributes']:_0x1bd574[_0x5b87('0x5a')];_0x15edc6[_0x5b87('0xd4')]=qs['sort'](_0xb6f134[_0x5b87('0x47')][_0x5b87('0xd5')]);_0x15edc6['where']=qs[_0x5b87('0xd2')](_[_0x5b87('0xd6')](_0xb6f134[_0x5b87('0x47')],_0x1bd574[_0x5b87('0xd2')]));if(_0xb6f134[_0x5b87('0x47')][_0x5b87('0x35')]){_0x15edc6['where']=_[_0x5b87('0xd7')](_0x15edc6[_0x5b87('0xd8')],{'$or':_[_0x5b87('0x37')](_0x15edc6['attributes'],function(_0x532e77){var _0x358ecd={};_0x358ecd[_0x532e77]={'$like':'%'+_0xb6f134[_0x5b87('0x47')]['filter']+'%'};return _0x358ecd;})});}_0x15edc6=_[_0x5b87('0xd7')]({},_0x15edc6,_0xb6f134[_0x5b87('0x60')]);switch(_0x3551b7[_0x5b87('0x2d')]){case _0x5b87('0x85'):return db[_[_0x5b87('0xa6')](_0xb6f134[_0x5b87('0x47')][_0x5b87('0xa1')])+_0x5b87('0xd1')][_0x5b87('0x4d')](_0x15edc6);case'user':case _0x5b87('0x32'):return _0x3551b7[_0x5b87('0x2f')+_[_0x5b87('0xa6')](_0xb6f134[_0x5b87('0x47')][_0x5b87('0xa1')])+_0x5b87('0xa8')](_0x15edc6);default:throw new db['Sequelize']['ValidationError'](_0x5b87('0xd9'));}})[_0x5b87('0x19')](function(_0x4e8228){_0x5bf4d0=_0x4e8228['length'];if(!_0xb6f134[_0x5b87('0x47')][_0x5b87('0xda')](_0x5b87('0xdb'))){_0x15edc6['limit']=qs[_0x5b87('0x27')](_0xb6f134[_0x5b87('0x47')][_0x5b87('0x27')]);_0x15edc6[_0x5b87('0x25')]=qs['offset'](_0xb6f134[_0x5b87('0x47')]['offset']);}switch(_0x3551b7['role']){case _0x5b87('0x85'):return db[_['capitalize'](_0xb6f134['query'][_0x5b87('0xa1')])+_0x5b87('0xd1')][_0x5b87('0x4d')](_0x15edc6);case'user':case _0x5b87('0x32'):return _0x3551b7[_0x5b87('0x2f')+_['capitalize'](_0xb6f134[_0x5b87('0x47')]['channel'])+_0x5b87('0xa8')](_0x15edc6);}})[_0x5b87('0x19')](function(_0x3db711){return{'count':_0x5bf4d0,'rows':_0x3db711};})[_0x5b87('0x19')](respondWithResult(_0x309c9d,null))[_0x5b87('0x22')](handleError(_0x309c9d,null));};exports[_0x5b87('0xdc')]=function(_0x3aba18,_0x4af4a7){var _0x5eeafa={};var _0x54c78f={};var _0x4c9c6f;var _0x5b0b9a;return db[_0x5b87('0x40')][_0x5b87('0x9a')]({'where':{'id':_0x3aba18[_0x5b87('0x59')]['id']}})[_0x5b87('0x19')](handleEntityNotFound(_0x4af4a7,null))[_0x5b87('0x19')](function(_0x53e558){if(_0x53e558){_0x4c9c6f=_0x53e558;_0x54c78f[_0x5b87('0x5a')]=_[_0x5b87('0x5c')](db[_0x5b87('0xb6')]['rawAttributes']);_0x54c78f[_0x5b87('0x47')]=_[_0x5b87('0x5c')](_0x3aba18[_0x5b87('0x47')]);_0x54c78f[_0x5b87('0xd2')]=_[_0x5b87('0x5f')](_0x54c78f['model'],_0x54c78f[_0x5b87('0x47')]);_0x5eeafa['attributes']=_['intersection'](_0x54c78f[_0x5b87('0x5a')],qs[_0x5b87('0xd3')](_0x3aba18[_0x5b87('0x47')][_0x5b87('0xd3')]));_0x5eeafa[_0x5b87('0x4b')]=_0x5eeafa['attributes'][_0x5b87('0x50')]?_0x5eeafa['attributes']:_0x54c78f[_0x5b87('0x5a')];_0x5eeafa[_0x5b87('0xd4')]=qs['sort'](_0x3aba18['query'][_0x5b87('0xd5')]);_0x5eeafa[_0x5b87('0xd8')]=qs['filters'](_[_0x5b87('0xd6')](_0x3aba18[_0x5b87('0x47')],_0x54c78f[_0x5b87('0xd2')]));if(_0x3aba18[_0x5b87('0x47')]['filter']){_0x5eeafa[_0x5b87('0xd8')]=_['merge'](_0x5eeafa[_0x5b87('0xd8')],{'$or':_[_0x5b87('0x37')](_0x5eeafa[_0x5b87('0x4b')],function(_0x52be33){var _0x152ac7={};_0x152ac7[_0x52be33]={'$like':'%'+_0x3aba18[_0x5b87('0x47')][_0x5b87('0x35')]+'%'};return _0x152ac7;})});}_0x5eeafa=_['merge']({},_0x5eeafa,_0x3aba18[_0x5b87('0x60')]);return _0x4c9c6f[_0x5b87('0xdc')](_0x5eeafa);}})['then'](function(_0x1e21b7){if(_0x1e21b7){_0x5b0b9a=_0x1e21b7[_0x5b87('0x50')];if(!_0x3aba18[_0x5b87('0x47')][_0x5b87('0xda')](_0x5b87('0xdb'))){_0x5eeafa[_0x5b87('0x27')]=qs[_0x5b87('0x27')](_0x3aba18[_0x5b87('0x47')][_0x5b87('0x27')]);_0x5eeafa[_0x5b87('0x25')]=qs['offset'](_0x3aba18[_0x5b87('0x47')][_0x5b87('0x25')]);}return _0x4c9c6f['getVoiceQueuesRt'](_0x5eeafa);}})[_0x5b87('0x19')](function(_0x2b89f0){if(_0x2b89f0){return _0x2b89f0?{'count':_0x5b0b9a,'rows':_0x2b89f0}:null;}})[_0x5b87('0x19')](respondWithResult(_0x4af4a7,null))[_0x5b87('0x22')](handleError(_0x4af4a7,null));};exports[_0x5b87('0xdd')]=function(_0x19b607,_0x252845){var _0x70646c={};var _0x22b386={};var _0x41de69;var _0x4b0edb;return db[_0x5b87('0x40')]['findOne']({'where':{'id':_0x19b607[_0x5b87('0x59')]['id']}})[_0x5b87('0x19')](handleEntityNotFound(_0x252845,null))[_0x5b87('0x19')](function(_0xf0298a){if(_0xf0298a){_0x41de69=_0xf0298a;_0x22b386[_0x5b87('0x5a')]=_[_0x5b87('0x5c')](db[_0x5b87('0xde')]['rawAttributes']);_0x22b386[_0x5b87('0x47')]=_['keys'](_0x19b607[_0x5b87('0x47')]);_0x22b386[_0x5b87('0xd2')]=_[_0x5b87('0x5f')](_0x22b386[_0x5b87('0x5a')],_0x22b386['query']);_0x70646c[_0x5b87('0x4b')]=_[_0x5b87('0x5f')](_0x22b386['model'],qs[_0x5b87('0xd3')](_0x19b607['query'][_0x5b87('0xd3')]));_0x70646c[_0x5b87('0x4b')]=_0x70646c[_0x5b87('0x4b')]['length']?_0x70646c[_0x5b87('0x4b')]:_0x22b386[_0x5b87('0x5a')];_0x70646c[_0x5b87('0xd4')]=qs[_0x5b87('0xd5')](_0x19b607[_0x5b87('0x47')][_0x5b87('0xd5')]);_0x70646c[_0x5b87('0xd8')]=qs[_0x5b87('0xd2')](_[_0x5b87('0xd6')](_0x19b607[_0x5b87('0x47')],_0x22b386['filters']));if(_0x19b607['query'][_0x5b87('0x35')]){_0x70646c['where']=_[_0x5b87('0xd7')](_0x70646c[_0x5b87('0xd8')],{'$or':_[_0x5b87('0x37')](_0x70646c[_0x5b87('0x4b')],function(_0x434188){var _0x12be46={};_0x12be46[_0x434188]={'$like':'%'+_0x19b607[_0x5b87('0x47')][_0x5b87('0x35')]+'%'};return _0x12be46;})});}_0x70646c=_[_0x5b87('0xd7')]({},_0x70646c,_0x19b607['options']);return _0x41de69[_0x5b87('0xdd')](_0x70646c);}})[_0x5b87('0x19')](function(_0x3aaddc){if(_0x3aaddc){_0x4b0edb=_0x3aaddc[_0x5b87('0x50')];if(!_0x19b607[_0x5b87('0x47')][_0x5b87('0xda')]('nolimit')){_0x70646c[_0x5b87('0x27')]=qs[_0x5b87('0x27')](_0x19b607['query'][_0x5b87('0x27')]);_0x70646c[_0x5b87('0x25')]=qs[_0x5b87('0x25')](_0x19b607[_0x5b87('0x47')][_0x5b87('0x25')]);}return _0x41de69[_0x5b87('0xdd')](_0x70646c);}})[_0x5b87('0x19')](function(_0x37254f){if(_0x37254f){return _0x37254f?{'count':_0x4b0edb,'rows':_0x37254f}:null;}})[_0x5b87('0x19')](respondWithResult(_0x252845,null))[_0x5b87('0x22')](handleError(_0x252845,null));};exports[_0x5b87('0xdf')]=function(_0x26dc7e,_0x32afc8){var _0x1c28bf={'raw':!![],'where':{}};var _0x50a2e4={};var _0x38dd76={'count':0x0,'rows':[]};return db['User'][_0x5b87('0x9a')]({'where':{'id':_0x26dc7e[_0x5b87('0x59')]['id']}})[_0x5b87('0x19')](handleEntityNotFound(_0x32afc8,null))[_0x5b87('0x19')](function(_0x3b69bb){if(_0x3b69bb){_0x50a2e4[_0x5b87('0x5a')]=_[_0x5b87('0x5c')](db[_0x5b87('0xe0')][_0x5b87('0x5d')]);_0x50a2e4[_0x5b87('0x47')]=_[_0x5b87('0x5c')](_0x26dc7e[_0x5b87('0x47')]);_0x50a2e4['filters']=_[_0x5b87('0x5f')](_0x50a2e4[_0x5b87('0x5a')],_0x50a2e4[_0x5b87('0x47')]);_0x1c28bf[_0x5b87('0x4b')]=_[_0x5b87('0x5f')](_0x50a2e4[_0x5b87('0x5a')],qs[_0x5b87('0xd3')](_0x26dc7e[_0x5b87('0x47')][_0x5b87('0xd3')]));_0x1c28bf[_0x5b87('0x4b')]=_0x1c28bf['attributes']['length']?_0x1c28bf[_0x5b87('0x4b')]:_0x50a2e4['model'];if(!_0x26dc7e[_0x5b87('0x47')][_0x5b87('0xda')](_0x5b87('0xdb'))){_0x1c28bf['limit']=qs[_0x5b87('0x27')](_0x26dc7e['query'][_0x5b87('0x27')]);_0x1c28bf['offset']=qs[_0x5b87('0x25')](_0x26dc7e['query'][_0x5b87('0x25')]);}_0x1c28bf[_0x5b87('0xd4')]=qs[_0x5b87('0xd5')](_0x26dc7e[_0x5b87('0x47')]['sort']);_0x1c28bf[_0x5b87('0xd8')]=qs[_0x5b87('0xd2')](_['pick'](_0x26dc7e[_0x5b87('0x47')],_0x50a2e4[_0x5b87('0xd2')]));_0x1c28bf['where'][_0x5b87('0xe1')]=_0x3b69bb['id'];if(_0x26dc7e[_0x5b87('0x47')][_0x5b87('0x35')]){_0x1c28bf[_0x5b87('0xd8')]=_['merge'](_0x1c28bf[_0x5b87('0xd8')],{'$or':_[_0x5b87('0x37')](_0x1c28bf[_0x5b87('0x4b')],function(_0x23ae7b){var _0xcea891={};_0xcea891[_0x23ae7b]={'$like':'%'+_0x26dc7e['query'][_0x5b87('0x35')]+'%'};return _0xcea891;})});}_0x1c28bf=_['merge']({},_0x1c28bf,_0x26dc7e[_0x5b87('0x60')]);return db[_0x5b87('0xe0')][_0x5b87('0x28')]({'where':_0x1c28bf[_0x5b87('0xd8')]})[_0x5b87('0x19')](function(_0x501fa8){_0x38dd76[_0x5b87('0x28')]=_0x501fa8;if(_0x26dc7e[_0x5b87('0x47')][_0x5b87('0x45')]){_0x1c28bf[_0x5b87('0x46')]=[{'all':!![]}];}return db[_0x5b87('0xe0')][_0x5b87('0x4d')](_0x1c28bf);})[_0x5b87('0x19')](function(_0x2daf0b){_0x38dd76[_0x5b87('0x4e')]=_0x2daf0b;return _0x38dd76;});}})[_0x5b87('0x19')](respondWithFilteredResult(_0x32afc8,_0x1c28bf))['catch'](handleError(_0x32afc8,null));};exports['getScreenRecordings']=function(_0x45e7a0,_0x162f3e){var _0x23934a={'raw':!![],'where':{}};var _0x1e50f6={};var _0x2d83de={'count':0x0,'rows':[]};return db[_0x5b87('0x40')][_0x5b87('0x9a')]({'where':{'id':_0x45e7a0[_0x5b87('0x59')]['id']}})['then'](handleEntityNotFound(_0x162f3e,null))[_0x5b87('0x19')](function(_0x2dbc48){if(_0x2dbc48){_0x1e50f6[_0x5b87('0x5a')]=_['keys'](db['ScreenRecording'][_0x5b87('0x5d')]);_0x1e50f6['query']=_[_0x5b87('0x5c')](_0x45e7a0[_0x5b87('0x47')]);_0x1e50f6[_0x5b87('0xd2')]=_[_0x5b87('0x5f')](_0x1e50f6['model'],_0x1e50f6[_0x5b87('0x47')]);_0x23934a[_0x5b87('0x4b')]=_['intersection'](_0x1e50f6[_0x5b87('0x5a')],qs['fields'](_0x45e7a0[_0x5b87('0x47')][_0x5b87('0xd3')]));_0x23934a[_0x5b87('0x4b')]=_0x23934a[_0x5b87('0x4b')]['length']?_0x23934a[_0x5b87('0x4b')]:_0x1e50f6[_0x5b87('0x5a')];if(!_0x45e7a0['query'][_0x5b87('0xda')](_0x5b87('0xdb'))){_0x23934a[_0x5b87('0x27')]=qs[_0x5b87('0x27')](_0x45e7a0[_0x5b87('0x47')]['limit']);_0x23934a[_0x5b87('0x25')]=qs[_0x5b87('0x25')](_0x45e7a0[_0x5b87('0x47')][_0x5b87('0x25')]);}_0x23934a[_0x5b87('0xd4')]=qs[_0x5b87('0xd5')](_0x45e7a0[_0x5b87('0x47')][_0x5b87('0xd5')]);_0x23934a['where']=qs[_0x5b87('0xd2')](_[_0x5b87('0xd6')](_0x45e7a0[_0x5b87('0x47')],_0x1e50f6[_0x5b87('0xd2')]));_0x23934a[_0x5b87('0xd8')][_0x5b87('0xe1')]=_0x2dbc48['id'];if(_0x45e7a0['query']['filter']){_0x23934a['where']=_[_0x5b87('0xd7')](_0x23934a[_0x5b87('0xd8')],{'$or':_['map'](_0x23934a['attributes'],function(_0xd11a04){var _0x156d06={};_0x156d06[_0xd11a04]={'$like':'%'+_0x45e7a0[_0x5b87('0x47')]['filter']+'%'};return _0x156d06;})});}_0x23934a=_[_0x5b87('0xd7')]({},_0x23934a,_0x45e7a0['options']);return db[_0x5b87('0xe2')]['count']({'where':_0x23934a['where']})[_0x5b87('0x19')](function(_0x161ae2){_0x2d83de[_0x5b87('0x28')]=_0x161ae2;if(_0x45e7a0['query'][_0x5b87('0x45')]){_0x23934a[_0x5b87('0x46')]=[{'all':!![]}];}return db[_0x5b87('0xe2')]['findAll'](_0x23934a);})[_0x5b87('0x19')](function(_0x124c9a){_0x2d83de['rows']=_0x124c9a;return _0x2d83de;});}})[_0x5b87('0x19')](respondWithFilteredResult(_0x162f3e,_0x23934a))[_0x5b87('0x22')](handleError(_0x162f3e,null));};exports[_0x5b87('0xe3')]=function(_0x42c59a,_0x31d57b){var _0x52de30={};var _0x5164a7={};var _0x3cbdca;var _0x112b07;return db['User'][_0x5b87('0x9a')]({'where':{'id':_0x42c59a['params']['id']}})[_0x5b87('0x19')](handleEntityNotFound(_0x31d57b,null))[_0x5b87('0x19')](function(_0x2b1efd){if(_0x2b1efd){_0x3cbdca=_0x2b1efd;_0x5164a7[_0x5b87('0x5a')]=_[_0x5b87('0x5c')](db[_0x5b87('0xe4')][_0x5b87('0x5d')]);_0x5164a7[_0x5b87('0x47')]=_[_0x5b87('0x5c')](_0x42c59a['query']);_0x5164a7['filters']=_['intersection'](_0x5164a7[_0x5b87('0x5a')],_0x5164a7['query']);_0x52de30[_0x5b87('0x4b')]=_[_0x5b87('0x5f')](_0x5164a7['model'],qs[_0x5b87('0xd3')](_0x42c59a['query'][_0x5b87('0xd3')]));_0x52de30[_0x5b87('0x4b')]=_0x52de30[_0x5b87('0x4b')]['length']?_0x52de30[_0x5b87('0x4b')]:_0x5164a7[_0x5b87('0x5a')];_0x52de30[_0x5b87('0xd4')]=qs[_0x5b87('0xd5')](_0x42c59a['query'][_0x5b87('0xd5')]);_0x52de30['where']=qs[_0x5b87('0xd2')](_[_0x5b87('0xd6')](_0x42c59a['query'],_0x5164a7[_0x5b87('0xd2')]));if(_0x42c59a['query'][_0x5b87('0x35')]){_0x52de30[_0x5b87('0xd8')]=_[_0x5b87('0xd7')](_0x52de30['where'],{'$or':_[_0x5b87('0x37')](_0x52de30['attributes'],function(_0x4feb80){var _0x12bd11={};_0x12bd11[_0x4feb80]={'$like':'%'+_0x42c59a[_0x5b87('0x47')][_0x5b87('0x35')]+'%'};return _0x12bd11;})});}_0x52de30=_[_0x5b87('0xd7')]({},_0x52de30,_0x42c59a[_0x5b87('0x60')]);return _0x3cbdca[_0x5b87('0xe3')](_0x52de30);}})[_0x5b87('0x19')](function(_0xfc5334){if(_0xfc5334){_0x112b07=_0xfc5334[_0x5b87('0x50')];if(!_0x42c59a['query'][_0x5b87('0xda')](_0x5b87('0xdb'))){_0x52de30[_0x5b87('0x27')]=qs[_0x5b87('0x27')](_0x42c59a[_0x5b87('0x47')]['limit']);_0x52de30[_0x5b87('0x25')]=qs[_0x5b87('0x25')](_0x42c59a['query'][_0x5b87('0x25')]);}return _0x3cbdca[_0x5b87('0xe3')](_0x52de30);}})['then'](function(_0x50e167){if(_0x50e167){return _0x50e167?{'count':_0x112b07,'rows':_0x50e167}:null;}})[_0x5b87('0x19')](respondWithResult(_0x31d57b,null))[_0x5b87('0x22')](handleError(_0x31d57b,null));};exports[_0x5b87('0xe5')]=function(_0x237ff2,_0x15faa0){var _0x41e28e={};var _0x4fcd11={};var _0x3e2c5b;var _0x217f9f;return db[_0x5b87('0x40')][_0x5b87('0x9a')]({'where':{'id':_0x237ff2['params']['id']}})[_0x5b87('0x19')](handleEntityNotFound(_0x15faa0,null))[_0x5b87('0x19')](function(_0x12a11f){if(_0x12a11f){_0x3e2c5b=_0x12a11f;_0x4fcd11[_0x5b87('0x5a')]=_[_0x5b87('0x5c')](db[_0x5b87('0xe6')]['rawAttributes']);_0x4fcd11[_0x5b87('0x47')]=_[_0x5b87('0x5c')](_0x237ff2[_0x5b87('0x47')]);_0x4fcd11[_0x5b87('0xd2')]=_[_0x5b87('0x5f')](_0x4fcd11['model'],_0x4fcd11['query']);_0x41e28e[_0x5b87('0x4b')]=_[_0x5b87('0x5f')](_0x4fcd11['model'],qs[_0x5b87('0xd3')](_0x237ff2[_0x5b87('0x47')]['fields']));_0x41e28e[_0x5b87('0x4b')]=_0x41e28e[_0x5b87('0x4b')][_0x5b87('0x50')]?_0x41e28e['attributes']:_0x4fcd11[_0x5b87('0x5a')];_0x41e28e[_0x5b87('0xd4')]=qs[_0x5b87('0xd5')](_0x237ff2[_0x5b87('0x47')][_0x5b87('0xd5')]);_0x41e28e[_0x5b87('0xd8')]=qs[_0x5b87('0xd2')](_[_0x5b87('0xd6')](_0x237ff2[_0x5b87('0x47')],_0x4fcd11[_0x5b87('0xd2')]));if(_0x237ff2[_0x5b87('0x47')][_0x5b87('0x35')]){_0x41e28e[_0x5b87('0xd8')]=_[_0x5b87('0xd7')](_0x41e28e['where'],{'$or':_[_0x5b87('0x37')](_0x41e28e[_0x5b87('0x4b')],function(_0x3ef366){var _0x51a0ea={};_0x51a0ea[_0x3ef366]={'$like':'%'+_0x237ff2['query'][_0x5b87('0x35')]+'%'};return _0x51a0ea;})});}_0x41e28e=_[_0x5b87('0xd7')]({},_0x41e28e,_0x237ff2[_0x5b87('0x60')]);return _0x3e2c5b['getOpenchannelInteractions'](_0x41e28e);}})[_0x5b87('0x19')](function(_0x39f6e2){if(_0x39f6e2){_0x217f9f=_0x39f6e2[_0x5b87('0x50')];if(!_0x237ff2[_0x5b87('0x47')][_0x5b87('0xda')](_0x5b87('0xdb'))){_0x41e28e['limit']=qs[_0x5b87('0x27')](_0x237ff2['query']['limit']);_0x41e28e[_0x5b87('0x25')]=qs[_0x5b87('0x25')](_0x237ff2[_0x5b87('0x47')][_0x5b87('0x25')]);}return _0x3e2c5b[_0x5b87('0xe5')](_0x41e28e);}})[_0x5b87('0x19')](function(_0x1ce6e6){if(_0x1ce6e6){return _0x1ce6e6?{'count':_0x217f9f,'rows':_0x1ce6e6}:null;}})[_0x5b87('0x19')](respondWithResult(_0x15faa0,null))['catch'](handleError(_0x15faa0,null));};exports[_0x5b87('0xe7')]=function(_0x14dfef,_0x16ead6){var _0x4652d0={'raw':!![],'where':{}};var _0xf5d9ba={};var _0x1831eb={'count':0x0,'rows':[]};return db[_0x5b87('0x40')][_0x5b87('0x9a')]({'where':{'id':_0x14dfef['params']['id']}})[_0x5b87('0x19')](handleEntityNotFound(_0x16ead6,null))['then'](function(_0x1fbfe3){if(_0x1fbfe3){_0xf5d9ba['model']=_[_0x5b87('0x5c')](db[_0x5b87('0xe8')][_0x5b87('0x5d')]);_0xf5d9ba[_0x5b87('0x47')]=_[_0x5b87('0x5c')](_0x14dfef[_0x5b87('0x47')]);_0xf5d9ba[_0x5b87('0xd2')]=_['intersection'](_0xf5d9ba[_0x5b87('0x5a')],_0xf5d9ba[_0x5b87('0x47')]);_0x4652d0['attributes']=_[_0x5b87('0x5f')](_0xf5d9ba[_0x5b87('0x5a')],qs[_0x5b87('0xd3')](_0x14dfef['query'][_0x5b87('0xd3')]));_0x4652d0['attributes']=_0x4652d0[_0x5b87('0x4b')][_0x5b87('0x50')]?_0x4652d0[_0x5b87('0x4b')]:_0xf5d9ba['model'];if(!_0x14dfef[_0x5b87('0x47')]['hasOwnProperty']('nolimit')){_0x4652d0['limit']=qs[_0x5b87('0x27')](_0x14dfef[_0x5b87('0x47')]['limit']);_0x4652d0[_0x5b87('0x25')]=qs[_0x5b87('0x25')](_0x14dfef[_0x5b87('0x47')]['offset']);}_0x4652d0[_0x5b87('0xd4')]=qs[_0x5b87('0xd5')](_0x14dfef[_0x5b87('0x47')][_0x5b87('0xd5')]);_0x4652d0[_0x5b87('0xd8')]=qs[_0x5b87('0xd2')](_[_0x5b87('0xd6')](_0x14dfef[_0x5b87('0x47')],_0xf5d9ba[_0x5b87('0xd2')]));_0x4652d0['where'][_0x5b87('0xe1')]=_0x1fbfe3['id'];if(_0x14dfef['query']['filter']){_0x4652d0[_0x5b87('0xd8')]=_[_0x5b87('0xd7')](_0x4652d0['where'],{'$or':_[_0x5b87('0x37')](_0x4652d0[_0x5b87('0x4b')],function(_0x4ce1e2){var _0x57d85f={};_0x57d85f[_0x4ce1e2]={'$like':'%'+_0x14dfef['query'][_0x5b87('0x35')]+'%'};return _0x57d85f;})});}_0x4652d0=_['merge']({},_0x4652d0,_0x14dfef[_0x5b87('0x60')]);return db[_0x5b87('0xe8')]['count']({'where':_0x4652d0[_0x5b87('0xd8')]})[_0x5b87('0x19')](function(_0x15f0e0){_0x1831eb[_0x5b87('0x28')]=_0x15f0e0;if(_0x14dfef[_0x5b87('0x47')][_0x5b87('0x45')]){_0x4652d0['include']=[{'all':!![]}];}return db[_0x5b87('0xe8')][_0x5b87('0x4d')](_0x4652d0);})['then'](function(_0x38d5bd){_0x1831eb[_0x5b87('0x4e')]=_0x38d5bd;return _0x1831eb;});}})[_0x5b87('0x19')](respondWithFilteredResult(_0x16ead6,_0x4652d0))[_0x5b87('0x22')](handleError(_0x16ead6,null));};exports[_0x5b87('0xe9')]=function(_0x5464e8,_0x19ef1a){var _0x590cdc={};var _0x176976={};var _0x5b719f;var _0xe8c8b6;return db[_0x5b87('0x40')]['findOne']({'where':{'id':_0x5464e8['params']['id']}})[_0x5b87('0x19')](handleEntityNotFound(_0x19ef1a,null))[_0x5b87('0x19')](function(_0xa819a5){if(_0xa819a5){_0x5b719f=_0xa819a5;_0x176976['model']=_[_0x5b87('0x5c')](db['SmsInteraction'][_0x5b87('0x5d')]);_0x176976[_0x5b87('0x47')]=_[_0x5b87('0x5c')](_0x5464e8[_0x5b87('0x47')]);_0x176976[_0x5b87('0xd2')]=_[_0x5b87('0x5f')](_0x176976[_0x5b87('0x5a')],_0x176976['query']);_0x590cdc[_0x5b87('0x4b')]=_[_0x5b87('0x5f')](_0x176976['model'],qs[_0x5b87('0xd3')](_0x5464e8[_0x5b87('0x47')][_0x5b87('0xd3')]));_0x590cdc[_0x5b87('0x4b')]=_0x590cdc[_0x5b87('0x4b')][_0x5b87('0x50')]?_0x590cdc[_0x5b87('0x4b')]:_0x176976[_0x5b87('0x5a')];_0x590cdc[_0x5b87('0xd4')]=qs[_0x5b87('0xd5')](_0x5464e8['query'][_0x5b87('0xd5')]);_0x590cdc['where']=qs[_0x5b87('0xd2')](_[_0x5b87('0xd6')](_0x5464e8[_0x5b87('0x47')],_0x176976[_0x5b87('0xd2')]));if(_0x5464e8[_0x5b87('0x47')][_0x5b87('0x35')]){_0x590cdc[_0x5b87('0xd8')]=_['merge'](_0x590cdc[_0x5b87('0xd8')],{'$or':_['map'](_0x590cdc[_0x5b87('0x4b')],function(_0x11920f){var _0x1b3c04={};_0x1b3c04[_0x11920f]={'$like':'%'+_0x5464e8[_0x5b87('0x47')]['filter']+'%'};return _0x1b3c04;})});}_0x590cdc=_[_0x5b87('0xd7')]({},_0x590cdc,_0x5464e8[_0x5b87('0x60')]);return _0x5b719f[_0x5b87('0xe9')](_0x590cdc);}})['then'](function(_0x143bdd){if(_0x143bdd){_0xe8c8b6=_0x143bdd[_0x5b87('0x50')];if(!_0x5464e8[_0x5b87('0x47')][_0x5b87('0xda')](_0x5b87('0xdb'))){_0x590cdc[_0x5b87('0x27')]=qs['limit'](_0x5464e8[_0x5b87('0x47')][_0x5b87('0x27')]);_0x590cdc[_0x5b87('0x25')]=qs[_0x5b87('0x25')](_0x5464e8['query'][_0x5b87('0x25')]);}return _0x5b719f[_0x5b87('0xe9')](_0x590cdc);}})[_0x5b87('0x19')](function(_0x3a594a){if(_0x3a594a){return _0x3a594a?{'count':_0xe8c8b6,'rows':_0x3a594a}:null;}})[_0x5b87('0x19')](respondWithResult(_0x19ef1a,null))[_0x5b87('0x22')](handleError(_0x19ef1a,null));};exports[_0x5b87('0xea')]=function(_0x295456,_0x4cf834){var _0x3f9d78={};var _0x270b70={};var _0x3c971a;var _0x1db809;return db['User'][_0x5b87('0x9a')]({'where':{'id':_0x295456['params']['id']}})[_0x5b87('0x19')](handleEntityNotFound(_0x4cf834,null))[_0x5b87('0x19')](function(_0x587d67){if(_0x587d67){_0x3c971a=_0x587d67;_0x270b70['model']=_[_0x5b87('0x5c')](db[_0x5b87('0xeb')]['rawAttributes']);_0x270b70[_0x5b87('0x47')]=_[_0x5b87('0x5c')](_0x295456[_0x5b87('0x47')]);_0x270b70[_0x5b87('0xd2')]=_[_0x5b87('0x5f')](_0x270b70[_0x5b87('0x5a')],_0x270b70[_0x5b87('0x47')]);_0x3f9d78[_0x5b87('0x4b')]=_[_0x5b87('0x5f')](_0x270b70[_0x5b87('0x5a')],qs['fields'](_0x295456[_0x5b87('0x47')][_0x5b87('0xd3')]));_0x3f9d78[_0x5b87('0x4b')]=_0x3f9d78[_0x5b87('0x4b')][_0x5b87('0x50')]?_0x3f9d78[_0x5b87('0x4b')]:_0x270b70['model'];_0x3f9d78[_0x5b87('0xd4')]=qs[_0x5b87('0xd5')](_0x295456['query'][_0x5b87('0xd5')]);_0x3f9d78[_0x5b87('0xd8')]=qs[_0x5b87('0xd2')](_[_0x5b87('0xd6')](_0x295456[_0x5b87('0x47')],_0x270b70[_0x5b87('0xd2')]));if(_0x295456[_0x5b87('0x47')]['filter']){_0x3f9d78['where']=_['merge'](_0x3f9d78[_0x5b87('0xd8')],{'$or':_['map'](_0x3f9d78[_0x5b87('0x4b')],function(_0x20eea4){var _0x50acd9={};_0x50acd9[_0x20eea4]={'$like':'%'+_0x295456[_0x5b87('0x47')][_0x5b87('0x35')]+'%'};return _0x50acd9;})});}_0x3f9d78=_[_0x5b87('0xd7')]({},_0x3f9d78,_0x295456[_0x5b87('0x60')]);return _0x3c971a[_0x5b87('0xea')](_0x3f9d78);}})[_0x5b87('0x19')](function(_0x247663){if(_0x247663){_0x1db809=_0x247663[_0x5b87('0x50')];if(!_0x295456[_0x5b87('0x47')][_0x5b87('0xda')]('nolimit')){_0x3f9d78[_0x5b87('0x27')]=qs[_0x5b87('0x27')](_0x295456[_0x5b87('0x47')]['limit']);_0x3f9d78[_0x5b87('0x25')]=qs[_0x5b87('0x25')](_0x295456[_0x5b87('0x47')][_0x5b87('0x25')]);}return _0x3c971a[_0x5b87('0xea')](_0x3f9d78);}})[_0x5b87('0x19')](function(_0x59e75c){if(_0x59e75c){return _0x59e75c?{'count':_0x1db809,'rows':_0x59e75c}:null;}})[_0x5b87('0x19')](respondWithResult(_0x4cf834,null))[_0x5b87('0x22')](handleError(_0x4cf834,null));};exports['getWhatsappInteractions']=function(_0x36797f,_0x18f92b){var _0x42882a={};var _0x2883ec={};var _0x215c3d;var _0xcdc8ed;return db['User'][_0x5b87('0x9a')]({'where':{'id':_0x36797f['params']['id']}})['then'](handleEntityNotFound(_0x18f92b,null))[_0x5b87('0x19')](function(_0x48c412){if(_0x48c412){_0x215c3d=_0x48c412;_0x2883ec['model']=_['keys'](db[_0x5b87('0xec')][_0x5b87('0x5d')]);_0x2883ec[_0x5b87('0x47')]=_[_0x5b87('0x5c')](_0x36797f[_0x5b87('0x47')]);_0x2883ec[_0x5b87('0xd2')]=_[_0x5b87('0x5f')](_0x2883ec[_0x5b87('0x5a')],_0x2883ec['query']);_0x42882a['attributes']=_[_0x5b87('0x5f')](_0x2883ec[_0x5b87('0x5a')],qs['fields'](_0x36797f[_0x5b87('0x47')][_0x5b87('0xd3')]));_0x42882a[_0x5b87('0x4b')]=_0x42882a[_0x5b87('0x4b')][_0x5b87('0x50')]?_0x42882a['attributes']:_0x2883ec[_0x5b87('0x5a')];_0x42882a['order']=qs[_0x5b87('0xd5')](_0x36797f['query']['sort']);_0x42882a['where']=qs[_0x5b87('0xd2')](_[_0x5b87('0xd6')](_0x36797f[_0x5b87('0x47')],_0x2883ec[_0x5b87('0xd2')]));if(_0x36797f[_0x5b87('0x47')][_0x5b87('0x35')]){_0x42882a['where']=_[_0x5b87('0xd7')](_0x42882a[_0x5b87('0xd8')],{'$or':_[_0x5b87('0x37')](_0x42882a['attributes'],function(_0x31d942){var _0x6371bd={};_0x6371bd[_0x31d942]={'$like':'%'+_0x36797f[_0x5b87('0x47')]['filter']+'%'};return _0x6371bd;})});}_0x42882a=_[_0x5b87('0xd7')]({},_0x42882a,_0x36797f[_0x5b87('0x60')]);return _0x215c3d[_0x5b87('0xed')](_0x42882a);}})['then'](function(_0x4f8a38){if(_0x4f8a38){_0xcdc8ed=_0x4f8a38['length'];if(!_0x36797f[_0x5b87('0x47')][_0x5b87('0xda')](_0x5b87('0xdb'))){_0x42882a[_0x5b87('0x27')]=qs['limit'](_0x36797f[_0x5b87('0x47')][_0x5b87('0x27')]);_0x42882a[_0x5b87('0x25')]=qs['offset'](_0x36797f['query'][_0x5b87('0x25')]);}return _0x215c3d[_0x5b87('0xed')](_0x42882a);}})[_0x5b87('0x19')](function(_0x2c3006){if(_0x2c3006){return _0x2c3006?{'count':_0xcdc8ed,'rows':_0x2c3006}:null;}})['then'](respondWithResult(_0x18f92b,null))[_0x5b87('0x22')](handleError(_0x18f92b,null));};exports[_0x5b87('0xee')]=function(_0x40d2d2,_0x154405,_0x58dbe6){var _0x2d6ffd;var _0x3feebe;var _0x363a77;var _0x2d69d7=!_['isNil'](_0x40d2d2[_0x5b87('0x59')]['id'])?_0x40d2d2[_0x5b87('0x59')]['id']:!_['isNil'](_0x40d2d2['user']['id'])?_0x40d2d2[_0x5b87('0x83')]['id']:null;return db['User'][_0x5b87('0x3a')]({'where':{'id':_0x2d69d7,'role':{'$or':[_0x5b87('0x85'),_0x5b87('0x83'),'agent']}},'attributes':['id','name',_0x5b87('0xef'),'mobile',_0x5b87('0x2d'),_0x5b87('0x69'),_0x5b87('0xf0')]})[_0x5b87('0x19')](function(_0x3d0578){if(_0x3d0578){if(_0x3d0578[_0x5b87('0x2d')]===_0x5b87('0x32')){_0x2d6ffd=_0x3d0578;if(_0x40d2d2['body'][_0x5b87('0xa4')]){_0x363a77=util[_0x5b87('0xaf')](_0x5b87('0xf1'),_0x2d6ffd[_0x40d2d2[_0x5b87('0x61')][_0x5b87('0xa4')]]);}else if(_0x40d2d2[_0x5b87('0x61')][_0x5b87('0xf2')]){_0x363a77=util[_0x5b87('0xaf')](_0x5b87('0xb0'),_0x40d2d2['body']['intrf']);}else{_0x363a77=util[_0x5b87('0xaf')](_0x5b87('0xb0'),_0x2d6ffd[_0x5b87('0x3b')]);}socket['to'](util['format']('user:%s',_0x2d6ffd[_0x5b87('0x3b')]))[_0x5b87('0xab')](_0x5b87('0xf3'),{'user':{'id':_0x2d6ffd['id'],'name':_0x2d6ffd['name']},'ip':_0x40d2d2[_0x5b87('0xf4')]['x-forwarded-for']||_0x40d2d2[_0x5b87('0xf5')][_0x5b87('0xf6')]||_0x40d2d2['socket']['remoteAddress']||_0x40d2d2['connection']['socket'][_0x5b87('0xf6')]});return db[_0x5b87('0xb6')][_0x5b87('0x2e')]({'where':{'membername':_0x2d6ffd['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x5b87('0x95'))](_0x5b87('0xf7'));}})['then'](function(){if(_0x2d6ffd){return _0x2d6ffd[_0x5b87('0xf8')]({'raw':!![]});}})['then'](function(_0x4b6a51){if(_0x2d6ffd){if(_0x4b6a51){_0x3feebe=_0x4b6a51;if(_0x3feebe['length']){var _0x33ffbf=_0x3feebe[_0x5b87('0x37')](function(_0x121a96){var _0x45b873={'membername':_0x2d6ffd[_0x5b87('0x3b')],'UserId':_0x2d6ffd['id'],'queue_name':_0x121a96['name'],'VoiceQueueId':_0x121a96['id'],'interface':_0x363a77,'paused':_0x2d6ffd[_0x5b87('0xf0')]||![],'penalty':_0x121a96[_0x5b87('0xf9')]||0x0};return db[_0x5b87('0xb6')][_0x5b87('0xb2')](_0x45b873);});return Promise[_0x5b87('0x57')](_0x33ffbf);}}}})[_0x5b87('0x19')](function(){if(_0x2d6ffd){return db[_0x5b87('0xfa')][_0x5b87('0x4d')]({'where':{'membername':_0x2d6ffd['name'],'exitAt':null}});}})['then'](function(_0x4486db){if(_0x2d6ffd){var _0x53ecc7=[];_0x4486db[_0x5b87('0xfb')](function(_0x57969d){_0x53ecc7[_0x5b87('0x4c')](_0x57969d['update']({'exitAt':moment()[_0x5b87('0xaf')](_0x5b87('0xfc'))}));});return Promise[_0x5b87('0x57')](_0x53ecc7);}})[_0x5b87('0x19')](function(){if(_0x2d6ffd){var _0x18e3fb=[];var _0x427d03=[];var _0x1c4162=utils[_0x5b87('0xfd')]();var _0x167353={'membername':_0x2d6ffd[_0x5b87('0x3b')],'interface':_0x363a77,'enterAt':moment()[_0x5b87('0xaf')](_0x5b87('0xfc')),'role':_0x2d6ffd['role'],'internal':_0x2d6ffd[_0x5b87('0x69')]};_0x1c4162[_0x5b87('0xfb')](function(_0x269c4e){_0x18e3fb[_0x5b87('0x4c')](_[_0x5b87('0xd7')]({'channel':_0x269c4e,'type':_0x5b87('0xfe'),'data1':_0x40d2d2['body'][_0x5b87('0xff')],'data2':_0x363a77},_0x167353));if(_0x2d6ffd['loginInPause']){_0x427d03[_0x5b87('0x4c')](_['merge']({'channel':_0x269c4e,'type':_0x5b87('0x100'),'data1':_0x5b87('0x101')},_0x167353));}});return db['MemberReport']['bulkCreate'](_0x18e3fb[_0x5b87('0xcb')](_0x427d03),{'individualHooks':!![]});}})[_0x5b87('0x19')](function(){if(_0x2d6ffd){return _0x2d6ffd[_0x5b87('0x2c')]({'online':!![],'lastLoginAt':moment()['format'](_0x5b87('0xfc')),'voicePause':_0x2d6ffd[_0x5b87('0xf0')]||![],'mailPause':_0x2d6ffd[_0x5b87('0xf0')]||![],'chatPause':_0x2d6ffd['loginInPause']||![],'faxPause':_0x2d6ffd[_0x5b87('0xf0')]||![],'smsPause':_0x2d6ffd[_0x5b87('0xf0')]||![],'openchannelPause':_0x2d6ffd[_0x5b87('0xf0')]||![],'whatsappPause':_0x2d6ffd[_0x5b87('0xf0')]||![],'pauseType':_0x2d6ffd['loginInPause']?_0x5b87('0x101'):null,'interface':_0x363a77,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x5b87('0x19')](function(_0x2c5cd2){if(_0x40d2d2[_0x5b87('0x102')]){return _0x58dbe6();}else{return Promise[_0x5b87('0x103')](_0x2c5cd2)[_0x5b87('0x19')](respondWithResult(_0x154405,null));}})[_0x5b87('0x22')](handleError(_0x154405,null));};exports[_0x5b87('0x104')]=function(_0x1d4dc5,_0x6f7f4d){var _0x2ae380;return db[_0x5b87('0x40')]['find']({'where':{'id':_0x1d4dc5[_0x5b87('0x59')]['id'],'role':'agent'},'attributes':['id',_0x5b87('0x3b'),_0x5b87('0x2d')]})[_0x5b87('0x19')](handleEntityNotFound(_0x6f7f4d,null))[_0x5b87('0x19')](function(_0x7d2c9e){if(_0x7d2c9e){_0x2ae380=_0x7d2c9e;return db['UserVoiceQueueRt'][_0x5b87('0x2e')]({'where':{'membername':_0x2ae380['name']},'individualHooks':!![]});}})[_0x5b87('0x19')](function(){return db['MemberReport'][_0x5b87('0x4d')]({'where':{'membername':_0x2ae380['name'],'exitAt':null}});})[_0x5b87('0x19')](function(_0x2b995e){var _0x2455a0=[];_0x2b995e[_0x5b87('0xfb')](function(_0x26e08c){_0x2455a0['push'](_0x26e08c[_0x5b87('0x2c')]({'exitAt':moment()[_0x5b87('0xaf')](_0x5b87('0xfc'))}));});return Promise[_0x5b87('0x57')](_0x2455a0);})[_0x5b87('0x19')](function(){return _0x2ae380['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x5b87('0x19')](respondWithResult(_0x6f7f4d,null))[_0x5b87('0x22')](handleError(_0x6f7f4d,null));};exports[_0x5b87('0x105')]=function(_0x1f1de7,_0x34da0e){var _0x15195e;return db[_0x5b87('0xb6')][_0x5b87('0x2c')]({'paused':0x1},{'where':{'UserId':_0x1f1de7[_0x5b87('0x59')]['id']},'individualHooks':!![]})[_0x5b87('0x19')](function(){return db[_0x5b87('0x40')][_0x5b87('0x3a')]({'where':{'id':_0x1f1de7[_0x5b87('0x59')]['id'],'role':_0x5b87('0x32')},'attributes':['id','name',_0x5b87('0x2d'),_0x5b87('0x69'),_0x5b87('0xa4'),_0x5b87('0xa2')]});})[_0x5b87('0x19')](handleEntityNotFound(_0x34da0e,null))[_0x5b87('0x19')](function(_0x5d233c){if(_0x5d233c){_0x15195e=_0x5d233c;return respondWithRpcPromise(_0x5b87('0x106'),_0x5b87('0x105'),{'id':_0x15195e['id'],'name':_0x15195e[_0x5b87('0x3b')],'pause':!![]});}})[_0x5b87('0x19')](function(){if(_0x15195e){return db[_0x5b87('0xfa')][_0x5b87('0x4d')]({'where':{'membername':_0x15195e[_0x5b87('0x3b')],'type':_0x5b87('0x100'),'exitAt':null}});}})[_0x5b87('0x19')](function(_0x56f370){if(_0x56f370['length']){var _0x444895=moment()['format'](_0x5b87('0xfc'));for(var _0x172b1a=0x0,_0x572ee5=_0x56f370[_0x5b87('0x50')];_0x172b1a<_0x572ee5;_0x172b1a++){_0x56f370[_0x172b1a][_0x5b87('0x107')]({'exitAt':_0x444895});}}})[_0x5b87('0x19')](function(){var _0x5aa473=[];var _0x3db741=utils['getChannels']();_0x3db741[_0x5b87('0xfb')](function(_0x1c9d2f){_0x5aa473[_0x5b87('0x4c')]({'channel':_0x1c9d2f,'membername':_0x15195e['name'],'interface':_[_0x5b87('0x6a')](_0x15195e[_0x5b87('0xa4')])?util['format'](_0x5b87('0xb0'),_0x15195e[_0x5b87('0x3b')]):_0x15195e[_0x5b87('0xa4')],'type':_0x5b87('0x100'),'enterAt':moment()[_0x5b87('0xaf')](_0x5b87('0xfc')),'data1':_0x1f1de7[_0x5b87('0x61')][_0x5b87('0x42')]||_0x5b87('0x108'),'role':_0x15195e[_0x5b87('0x2d')],'internal':_0x15195e[_0x5b87('0x69')]});});return db[_0x5b87('0xfa')][_0x5b87('0x8c')](_0x5aa473,{'individualHooks':!![]});})['then'](function(){return _0x15195e[_0x5b87('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1f1de7[_0x5b87('0x61')]['type']||_0x5b87('0x108'),'lastPauseAt':moment()['format'](_0x5b87('0xfc'))});})[_0x5b87('0x19')](respondWithResult(_0x34da0e,null))[_0x5b87('0x22')](handleError(_0x34da0e,null));};exports[_0x5b87('0x109')]=function(_0x33f126,_0x429f39){if(_0x33f126[_0x5b87('0x61')][_0x5b87('0xa1')]&&!utils['isValidChannel'](_0x33f126['body'][_0x5b87('0xa1')])){throw new APIBadRequestError(util[_0x5b87('0xaf')](_0x5b87('0x10a'),_0x33f126['body']['channel']));}return db[_0x5b87('0x40')][_0x5b87('0x3a')]({'where':{'id':_0x33f126[_0x5b87('0x59')]['id']},'attributes':['id','name','role',_0x5b87('0x69'),_0x5b87('0xa4'),_0x5b87('0xa2'),_0x5b87('0xa3'),'mailPause',_0x5b87('0x10b'),_0x5b87('0x10c'),_0x5b87('0x10d'),_0x5b87('0x10e'),_0x5b87('0x10f'),_0x5b87('0x110'),'lastPauseAt']})['then'](function(_0x37177c){if(!_0x37177c){throw new APINotFoundError(util[_0x5b87('0xaf')](_0x5b87('0x111'),_0x33f126[_0x5b87('0x59')]['id']));}return _0x37177c[_0x5b87('0x109')](_0x33f126[_0x5b87('0x61')][_0x5b87('0xa1')]);})[_0x5b87('0x19')](respondWithResult(_0x429f39,null))[_0x5b87('0x22')](APIHandleError(_0x429f39));};exports[_0x5b87('0x112')]=function(_0x7f6292,_0x4bb527){var _0x46381b={};var _0x2b4132={};var _0x4b104f;var _0x452fab;return db[_0x5b87('0x40')][_0x5b87('0x9a')]({'where':{'id':_0x7f6292[_0x5b87('0x59')]['id']}})[_0x5b87('0x19')](handleEntityNotFound(_0x4bb527,null))['then'](function(_0x140d61){if(_0x140d61){_0x4b104f=_0x140d61;_0x2b4132[_0x5b87('0x5a')]=_['keys'](db[_0x5b87('0x113')][_0x5b87('0x5d')]);_0x2b4132['query']=_[_0x5b87('0x5c')](_0x7f6292[_0x5b87('0x47')]);_0x2b4132[_0x5b87('0xd2')]=_['intersection'](_0x2b4132[_0x5b87('0x5a')],_0x2b4132['query']);_0x46381b[_0x5b87('0x4b')]=_[_0x5b87('0x5f')](_0x2b4132[_0x5b87('0x5a')],qs[_0x5b87('0xd3')](_0x7f6292[_0x5b87('0x47')]['fields']));_0x46381b[_0x5b87('0x4b')]=_0x46381b[_0x5b87('0x4b')][_0x5b87('0x50')]?_0x46381b[_0x5b87('0x4b')]:_0x2b4132[_0x5b87('0x5a')];_0x46381b[_0x5b87('0xd4')]=qs[_0x5b87('0xd5')](_0x7f6292[_0x5b87('0x47')][_0x5b87('0xd5')]);_0x46381b['where']=qs[_0x5b87('0xd2')](_[_0x5b87('0xd6')](_0x7f6292[_0x5b87('0x47')],_0x2b4132[_0x5b87('0xd2')]));if(_0x7f6292[_0x5b87('0x47')][_0x5b87('0x35')]){_0x46381b['where']=_[_0x5b87('0xd7')](_0x46381b[_0x5b87('0xd8')],{'$or':_[_0x5b87('0x37')](_0x46381b[_0x5b87('0x4b')],function(_0x17cc45){var _0x15cd50={};_0x15cd50[_0x17cc45]={'$like':'%'+_0x7f6292[_0x5b87('0x47')][_0x5b87('0x35')]+'%'};return _0x15cd50;})});}_0x46381b=_['merge']({},_0x46381b,_0x7f6292[_0x5b87('0x60')]);return _0x4b104f[_0x5b87('0x112')](_0x46381b);}})[_0x5b87('0x19')](function(_0x4fc407){if(_0x4fc407){_0x452fab=_0x4fc407[_0x5b87('0x50')];if(!_0x7f6292['query'][_0x5b87('0xda')](_0x5b87('0xdb'))){_0x46381b[_0x5b87('0x27')]=qs[_0x5b87('0x27')](_0x7f6292['query'][_0x5b87('0x27')]);_0x46381b['offset']=qs['offset'](_0x7f6292['query'][_0x5b87('0x25')]);}return _0x4b104f[_0x5b87('0x112')](_0x46381b);}})[_0x5b87('0x19')](function(_0x2bd6e9){if(_0x2bd6e9){return _0x2bd6e9?{'count':_0x452fab,'rows':_0x2bd6e9}:null;}})[_0x5b87('0x19')](respondWithResult(_0x4bb527,null))['catch'](handleError(_0x4bb527,null));};exports[_0x5b87('0x114')]=function(_0x1fa338,_0x179d30){var _0x54c38b=_0x1fa338[_0x5b87('0x59')]['id'];var _0x54c70f=_0x1fa338[_0x5b87('0x61')]?_0x1fa338[_0x5b87('0x61')]['ids']:null;var _0x2ff2f7=[];return Promise[_0x5b87('0x103')]()[_0x5b87('0x19')](function(){if(!_0x54c70f)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0x5b87('0x40')][_0x5b87('0x9a')]({'where':{'id':_0x54c38b}});})['then'](function(_0x34c30b){if(!_0x34c30b)throw new APINotFoundError(util['format'](_0x5b87('0x111'),_0x1fa338[_0x5b87('0x59')]['id']));return db[_0x5b87('0x6d')][_0x5b87('0x115')](function(_0x4f3752){return _0x34c30b[_0x5b87('0x114')](_0x54c70f,{'transaction':_0x4f3752})[_0x5b87('0x19')](function(){return db[_0x5b87('0x113')][_0x5b87('0x4d')]({'where':{'id':{'$in':_0x54c70f}}});})[_0x5b87('0x19')](function(_0x3914ba){var _0x3a71d4=_['map'](_0x3914ba,function(_0x34ef62){return _0x34ef62[_0x5b87('0x116')]();});return Promise[_0x5b87('0x57')](_0x3a71d4);})[_0x5b87('0x19')](function(_0x5a1232){_0x2ff2f7=_[_0x5b87('0x117')](_0x5a1232);var _0x2247b0=_[_0x5b87('0x37')](_0x2ff2f7,function(_0x5500cb){return _0x5500cb[_0x5b87('0x118')](_0x34c30b['id'],{'transaction':_0x4f3752});});return Promise[_0x5b87('0x57')](_0x2247b0);})[_0x5b87('0x19')](function(){if(!_0x34c30b[_0x5b87('0xa2')])return;var _0x571db4=_[_0x5b87('0x35')](_0x2ff2f7,function(_0x574802){return _0x574802[_0x5b87('0x119')](_0x5b87('0xa1'))==='Voice';});var _0x18ba5f=_['map'](_0x571db4,function(_0x4ccfda){return db[_0x5b87('0xb6')][_0x5b87('0xb2')]({'membername':_0x34c30b[_0x5b87('0x3b')],'UserId':_0x34c30b['id'],'queue_name':_0x4ccfda[_0x5b87('0x3b')],'VoiceQueueId':_0x4ccfda['id'],'interface':_[_0x5b87('0x6a')](_0x34c30b[_0x5b87('0xa4')])?util[_0x5b87('0xaf')](_0x5b87('0xb0'),_0x34c30b[_0x5b87('0x3b')]):_0x34c30b[_0x5b87('0xa4')],'paused':_0x34c30b[_0x5b87('0xa3')]||![],'penalty':_0x34c30b[_0x5b87('0xb1')]},{'transaction':_0x4f3752});});return Promise['all'](_0x18ba5f);})[_0x5b87('0x19')](function(){return db[_0x5b87('0x11a')][_0x5b87('0x4d')]({'where':{'teamId':{'$in':_0x54c70f}}});})[_0x5b87('0x19')](function(_0x358ab4){var _0x4ba847=_[_0x5b87('0x37')](_0x358ab4,function(_0x456da7){return db['UserVoicePrefix'][_0x5b87('0x82')]({'UserId':_0x34c30b['id'],'VoicePrefixId':_0x456da7[_0x5b87('0x11b')]},{'transaction':_0x4f3752});});return Promise[_0x5b87('0x57')](_0x4ba847);});});})['then'](function(){for(var _0x5cf23b=0x0;_0x5cf23b<_0x2ff2f7['length'];_0x5cf23b++){var _0x562cc1=_0x2ff2f7[_0x5cf23b][_0x5b87('0x119')](_0x5b87('0xa1'));var _0x43911c=_0x562cc1+'QueueId';socket['emit'](_0x5b87('0x83')+_0x562cc1+_0x5b87('0xac'),{'UserId':_0x54c38b,['queueField']:_0x2ff2f7[_0x5cf23b]['id']});}})[_0x5b87('0x19')](respondWithStatusCode(_0x179d30,null))['catch'](APIHandleError(_0x179d30));};exports['removeTeams']=function(_0x42953c,_0x328ded){var _0x11ac38=_0x42953c[_0x5b87('0x59')]['id'];var _0x4a8ad1=null;if(_0x42953c[_0x5b87('0x47')][_0x5b87('0x65')]){_0x4a8ad1=_[_0x5b87('0xb4')](_0x42953c[_0x5b87('0x47')][_0x5b87('0x65')])?_0x42953c[_0x5b87('0x47')][_0x5b87('0x65')]:[_0x42953c[_0x5b87('0x47')][_0x5b87('0x65')]];}var _0x506aae=[];return Promise[_0x5b87('0x103')]()[_0x5b87('0x19')](function(){if(!_0x4a8ad1)throw new APIBadRequestError(_0x5b87('0x11c'));})[_0x5b87('0x19')](function(){return db[_0x5b87('0x40')][_0x5b87('0x9a')]({'where':{'id':_0x11ac38}});})[_0x5b87('0x19')](function(_0x35238e){if(!_0x35238e)throw new APINotFoundError(util[_0x5b87('0xaf')](_0x5b87('0x111'),_0x42953c[_0x5b87('0x59')]['id']));return db['sequelize']['transaction'](function(_0x4fe9ad){return _0x35238e[_0x5b87('0x11d')](_0x4a8ad1,{'transaction':_0x4fe9ad})['then'](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x4a8ad1}}});})[_0x5b87('0x19')](function(_0x5bb4a7){var _0x24cb17=_[_0x5b87('0x37')](_0x5bb4a7,function(_0x4764c2){return _0x4764c2[_0x5b87('0x116')]();});return Promise[_0x5b87('0x57')](_0x24cb17);})[_0x5b87('0x19')](function(_0x347f30){_0x506aae=_[_0x5b87('0x117')](_0x347f30);var _0x2ab677=_[_0x5b87('0x37')](_0x506aae,function(_0x3a6637){return _0x3a6637[_0x5b87('0x11e')](_0x35238e['id'],{'transaction':_0x4fe9ad});});return Promise[_0x5b87('0x57')](_0x2ab677);})[_0x5b87('0x19')](function(){if(!_0x35238e[_0x5b87('0xa2')])return;var _0x40736d=_[_0x5b87('0x35')](_0x506aae,function(_0x32edb6){return _0x32edb6[_0x5b87('0x119')]('channel')===_0x5b87('0x11f');});var _0x147709=_[_0x5b87('0x37')](_0x40736d,function(_0x33dfea){return db[_0x5b87('0xb6')][_0x5b87('0x2e')]({'where':{'VoiceQueueId':_0x33dfea['id'],'UserId':_0x35238e['id']},'transaction':_0x4fe9ad});});return Promise[_0x5b87('0x57')](_0x147709);})[_0x5b87('0x19')](function(){return db[_0x5b87('0x11a')][_0x5b87('0x4d')]({'where':{'teamId':{'$in':_0x4a8ad1}}});})[_0x5b87('0x19')](function(_0x5ebd8b){var _0x17042f=_['map'](_0x5ebd8b,function(_0x26b18b){return db[_0x5b87('0x120')][_0x5b87('0x2e')]({'where':{'UserId':_0x35238e['id'],'VoicePrefixId':_0x26b18b['VoicePrefixId']}},{'transaction':_0x4fe9ad});});return Promise[_0x5b87('0x57')](_0x17042f);});});})[_0x5b87('0x19')](function(){for(var _0x107398=0x0;_0x107398<_0x506aae[_0x5b87('0x50')];_0x107398++){var _0x4cefa7=_0x506aae[_0x107398][_0x5b87('0x119')](_0x5b87('0xa1'));var _0x486e3b=_0x4cefa7+_0x5b87('0xaa');socket[_0x5b87('0xab')]('user'+_0x4cefa7+'Queue:remove',{'UserId':_0x11ac38,['queueField']:_0x506aae[_0x107398]['id']});}})[_0x5b87('0x19')](respondWithStatusCode(_0x328ded,null))[_0x5b87('0x22')](APIHandleError(_0x328ded));};exports[_0x5b87('0x121')]=function(_0x4215b7,_0x2589c4){var _0x215599={};var _0x4ff14d={};var _0x5c7755;var _0x5f0d8c;return db[_0x5b87('0x40')]['findOne']({'where':{'id':_0x4215b7[_0x5b87('0x59')]['id']}})[_0x5b87('0x19')](handleEntityNotFound(_0x2589c4,null))[_0x5b87('0x19')](function(_0x463276){if(_0x463276){_0x5c7755=_0x463276;_0x4ff14d[_0x5b87('0x5a')]=_['keys'](db[_0x5b87('0xcc')]['rawAttributes']);_0x4ff14d[_0x5b87('0x47')]=_[_0x5b87('0x5c')](_0x4215b7['query']);_0x4ff14d[_0x5b87('0xd2')]=_[_0x5b87('0x5f')](_0x4ff14d['model'],_0x4ff14d[_0x5b87('0x47')]);_0x215599[_0x5b87('0x4b')]=_['intersection'](_0x4ff14d['model'],qs['fields'](_0x4215b7['query'][_0x5b87('0xd3')]));_0x215599[_0x5b87('0x4b')]=_0x215599['attributes'][_0x5b87('0x50')]?_0x215599[_0x5b87('0x4b')]:_0x4ff14d[_0x5b87('0x5a')];_0x215599['order']=qs[_0x5b87('0xd5')](_0x4215b7[_0x5b87('0x47')][_0x5b87('0xd5')]);_0x215599[_0x5b87('0xd8')]=qs[_0x5b87('0xd2')](_['pick'](_0x4215b7[_0x5b87('0x47')],_0x4ff14d[_0x5b87('0xd2')]));if(_0x4215b7[_0x5b87('0x47')][_0x5b87('0x35')]){_0x215599[_0x5b87('0xd8')]=_[_0x5b87('0xd7')](_0x215599[_0x5b87('0xd8')],{'$or':_['map'](_0x215599[_0x5b87('0x4b')],function(_0x52ba35){var _0x5fbd01={};_0x5fbd01[_0x52ba35]={'$like':'%'+_0x4215b7['query'][_0x5b87('0x35')]+'%'};return _0x5fbd01;})});}_0x215599=_['merge']({},_0x215599,_0x4215b7[_0x5b87('0x60')]);return _0x5c7755[_0x5b87('0x121')](_0x215599);}})[_0x5b87('0x19')](function(_0xc3b8cb){if(_0xc3b8cb){_0x5f0d8c=_0xc3b8cb['length'];if(!_0x4215b7[_0x5b87('0x47')]['hasOwnProperty']('nolimit')){_0x215599[_0x5b87('0x27')]=qs['limit'](_0x4215b7[_0x5b87('0x47')][_0x5b87('0x27')]);_0x215599[_0x5b87('0x25')]=qs['offset'](_0x4215b7[_0x5b87('0x47')][_0x5b87('0x25')]);}return _0x5c7755['getLists'](_0x215599);}})['then'](function(_0x23b53c){if(_0x23b53c){return _0x23b53c?{'count':_0x5f0d8c,'rows':_0x23b53c}:null;}})[_0x5b87('0x19')](respondWithResult(_0x2589c4,null))[_0x5b87('0x22')](handleError(_0x2589c4,null));};exports[_0x5b87('0x122')]=function(_0x20d9b9,_0x205e33){var _0x946914={};var _0x4bb7ac={};var _0x4b5f7b;return db['User']['findOne']({'where':{'id':_0x20d9b9['params']['id']}})[_0x5b87('0x19')](handleEntityNotFound(_0x205e33,null))['then'](function(_0x2b977d){if(_0x2b977d){_0x4b5f7b=_0x2b977d;_0x4bb7ac[_0x5b87('0x5a')]=_[_0x5b87('0x5c')](db[_0x5b87('0x40')]['rawAttributes']);_0x4bb7ac[_0x5b87('0x47')]=_['keys'](_0x20d9b9[_0x5b87('0x47')]);_0x4bb7ac[_0x5b87('0xd2')]=_[_0x5b87('0x5f')](_0x4bb7ac[_0x5b87('0x5a')],_0x4bb7ac[_0x5b87('0x47')]);_0x946914[_0x5b87('0x4b')]=_[_0x5b87('0x5f')](_0x4bb7ac['model'],qs['fields'](_0x20d9b9[_0x5b87('0x47')][_0x5b87('0xd3')]));_0x946914['attributes']=_0x946914['attributes'][_0x5b87('0x50')]?_0x946914[_0x5b87('0x4b')]:_0x4bb7ac[_0x5b87('0x5a')];_0x946914[_0x5b87('0xd4')]=qs[_0x5b87('0xd5')](_0x20d9b9[_0x5b87('0x47')]['sort']);_0x946914[_0x5b87('0xd8')]=qs[_0x5b87('0xd2')](_['pick'](_0x20d9b9[_0x5b87('0x47')],_0x4bb7ac[_0x5b87('0xd2')]));if(_0x20d9b9['query']['filter']){_0x946914['where']=_[_0x5b87('0xd7')](_0x946914[_0x5b87('0xd8')],{'$or':_['map'](_0x946914[_0x5b87('0x4b')],function(_0x1ade9c){var _0x576127={};_0x576127[_0x1ade9c]={'$like':'%'+_0x20d9b9['query'][_0x5b87('0x35')]+'%'};return _0x576127;})});}_0x946914[_0x5b87('0x5a')]=db[_0x5b87('0x40')];_0x946914['as']=_0x5b87('0x31');_0x946914=_[_0x5b87('0xd7')]({},_0x946914,_0x20d9b9[_0x5b87('0x60')]);return _0x4b5f7b[_0x5b87('0xf8')]({'include':[_0x946914]});}})['then'](function(_0x545b22){if(_0x545b22){var _0x1dfce4={},_0x375b9b=[];for(var _0x4558a9=0x0;_0x4558a9<_0x545b22[_0x5b87('0x50')];_0x4558a9+=0x1){for(var _0x1f2a7c=0x0,_0x1e85e1;_0x1f2a7c<_0x545b22[_0x4558a9][_0x5b87('0x31')][_0x5b87('0x50')];_0x1f2a7c+=0x1){_0x1e85e1=_0x545b22[_0x4558a9]['Agents'][_0x1f2a7c]['get']({'plain':!![]});_0x1dfce4[_0x1e85e1['id']]=_0x1e85e1;}}_0x1dfce4=_['values'](_0x1dfce4);for(var _0x45e338=qs[_0x5b87('0x25')](_0x20d9b9[_0x5b87('0x47')][_0x5b87('0x25')]);_0x45e338<_0x1dfce4[_0x5b87('0x50')]&&_0x375b9b[_0x5b87('0x50')]=_0x29b014){_0x22ff86=_0x29b014;_0x10edb4=0xc8;}else{_0x10edb4=0xce;}_0x5386ac[_0x9860('0x1f')](_0x10edb4);return _0x5386ac[_0x9860('0x25')](_0x9860('0x26'),_0x362112+'-'+_0x22ff86+'/'+_0x29b014)['json'](_0x5413af);}return null;};}function saveUpdates(_0x51de3c){return function(_0x8b714){if(_0x8b714){return _0x8b714['update'](_0x51de3c)[_0x9860('0x14')](function(_0x1ee907){if(_0x1ee907[_0x9860('0x27')]==='agent'){socket[_0x9860('0x28')](_0x9860('0x29')+_0x1ee907['id'],_0x1ee907);}return _0x1ee907;});}return null;};}function removeEntity(_0x300753){return function(_0x5971cc){if(_0x5971cc){return _0x5971cc['destroy']()[_0x9860('0x14')](function(){var _0x3f2664=_0x5971cc[_0x9860('0x2a')]({'plain':!![]});if(_0x3f2664[_0x9860('0x27')]===_0x9860('0x2b'))return;var _0x3da8c1=[{'name':'Users','value':_0x9860('0x2c'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x9860('0x2d'),'value':_0x9860('0x2e'),'ignore':![]}];var _0x484dcf=_(_0x3da8c1)[_0x9860('0x2f')](_0x9860('0x30'))[_0x9860('0x31')]('value')['value']();if(_[_0x9860('0x32')](_0x484dcf,_0x3f2664['role'])){return;}var _0x48e6b6=_['find'](_0x3da8c1,[_0x9860('0x33'),_0x3f2664['role']])['name'];return db[_0x9860('0x34')][_0x9860('0x35')]({'where':{'type':_0x48e6b6,'resourceId':_0x3f2664['id']}})['then'](function(){return _0x5971cc;});})['then'](function(){_0x300753[_0x9860('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae07b){return function(_0x52fbc9){if(!_0x52fbc9){_0x1ae07b['sendStatus'](0x194);}return _0x52fbc9;};}function handleError(_0x3383ec,_0x55f7bd){_0x55f7bd=_0x55f7bd||0x1f4;return function(_0x2fa164){logger[_0x9860('0x1a')](_0x2fa164[_0x9860('0x36')]);if(_0x2fa164[_0x9860('0x37')]){delete _0x2fa164['name'];}_0x3383ec[_0x9860('0x1f')](_0x55f7bd)[_0x9860('0x38')](_0x2fa164);};}exports[_0x9860('0x39')]=function(_0x136b55,_0x2cbf9b){var _0x3510ab={},_0x22f4fb={'count':0x0,'rows':[]};var _0x40ac6b=_(db[_0x9860('0x3a')][_0x9860('0x3b')])[_0x9860('0x31')](function(_0x3518e6){return{'name':_0x3518e6[_0x9860('0x3c')],'type':_0x3518e6[_0x9860('0x3d')][_0x9860('0x3e')]};})['filter'](function(_0xc50f21){return!_['includes']([_0x9860('0x3f'),_0x9860('0x40')],_0xc50f21['name']);})[_0x9860('0x33')]();_0x3510ab=qs[_0x9860('0x41')](_0x40ac6b,_0x136b55);var _0x70b4bb={'where':_0x3510ab[_0x9860('0x42')]};return db['User'][_0x9860('0x22')](_0x70b4bb)[_0x9860('0x14')](function(_0x12b7d5){_0x22f4fb[_0x9860('0x22')]=_0x12b7d5;if(_0x136b55[_0x9860('0x43')][_0x9860('0x44')]){_0x3510ab[_0x9860('0x45')]=[{'all':!![]}];}if(_0x136b55[_0x9860('0x43')][_0x9860('0x46')]==='true'){_0x3510ab['include']=[{'model':db[_0x9860('0x47')],'as':_0x9860('0x46')}];}if(!_[_0x9860('0x32')](_0x3510ab[_0x9860('0x48')],'id')){_0x3510ab[_0x9860('0x48')]['push']('id');}return db['User']['findAll'](_0x3510ab);})['then'](function(_0x4d10b1){_0x22f4fb[_0x9860('0x49')]=_0x4d10b1;if(_0x136b55['query']['openTabs']===_0x9860('0x4a')){var _0x4372c6=[];for(var _0x53f28a=0x0;_0x53f28a<_0x22f4fb['rows']['length'];_0x53f28a++){_0x4372c6[_0x9860('0x4b')](get_open_tabs(_0x9860('0x4c'),_0x22f4fb[_0x9860('0x49')][_0x53f28a][_0x9860('0x4d')]));_0x4372c6[_0x9860('0x4b')](get_open_tabs(_0x9860('0x4e'),_0x22f4fb['rows'][_0x53f28a][_0x9860('0x4d')]));_0x4372c6[_0x9860('0x4b')](get_open_tabs(_0x9860('0x4f'),_0x22f4fb[_0x9860('0x49')][_0x53f28a][_0x9860('0x4d')]));_0x4372c6[_0x9860('0x4b')](get_open_tabs(_0x9860('0x50'),_0x22f4fb[_0x9860('0x49')][_0x53f28a][_0x9860('0x4d')]));_0x4372c6['push'](get_open_tabs(_0x9860('0x51'),_0x22f4fb['rows'][_0x53f28a][_0x9860('0x4d')]));_0x4372c6[_0x9860('0x4b')](get_open_tabs('whatsapp',_0x22f4fb[_0x9860('0x49')][_0x53f28a][_0x9860('0x4d')]));}return Promise[_0x9860('0x52')](_0x4372c6)[_0x9860('0x14')](function(){return _0x22f4fb;});}else{return _0x22f4fb;}})[_0x9860('0x14')](respondWithFilteredResult(_0x2cbf9b,_0x3510ab))[_0x9860('0x1d')](handleError(_0x2cbf9b,null));};exports[_0x9860('0x53')]=function(_0x13504c,_0x4d3190){var _0x12b45c={'raw':![],'where':{'id':_0x13504c[_0x9860('0x54')]['id']}},_0x5a9ad7={};_0x5a9ad7[_0x9860('0x55')]=_[_0x9860('0x56')](_[_0x9860('0x57')](db[_0x9860('0x3a')][_0x9860('0x3b')]),['password',_0x9860('0x40')]);_0x5a9ad7[_0x9860('0x43')]=_[_0x9860('0x57')](_0x13504c[_0x9860('0x43')]);_0x5a9ad7['filters']=_[_0x9860('0x58')](_0x5a9ad7[_0x9860('0x55')],_0x5a9ad7[_0x9860('0x43')]);_0x12b45c['attributes']=_['intersection'](_0x5a9ad7[_0x9860('0x55')],qs[_0x9860('0x59')](_0x13504c[_0x9860('0x43')]['fields']));_0x12b45c['attributes']=_0x12b45c[_0x9860('0x48')][_0x9860('0x5a')]?_0x12b45c[_0x9860('0x48')]:_0x5a9ad7[_0x9860('0x55')];if(_0x13504c[_0x9860('0x43')][_0x9860('0x44')]){_0x12b45c['include']=[{'all':!![]}];}if(_0x13504c[_0x9860('0x43')][_0x9860('0x46')]==='true'){_0x12b45c[_0x9860('0x45')]=[{'model':db[_0x9860('0x47')],'as':_0x9860('0x46')}];}_0x12b45c=_[_0x9860('0x5b')]({},_0x12b45c,_0x13504c[_0x9860('0x5c')]);if(!_[_0x9860('0x32')](_0x12b45c[_0x9860('0x48')],'id')){_0x12b45c['attributes'][_0x9860('0x4b')]('id');}return db[_0x9860('0x3a')][_0x9860('0x5d')](_0x12b45c)['then'](handleEntityNotFound(_0x4d3190,null))[_0x9860('0x14')](function(_0x17ae34){var _0x3d0bfd=[];values=_0x17ae34;if(_0x13504c[_0x9860('0x43')]['openTabs']==='true'){_0x3d0bfd['push'](get_open_tabs(_0x9860('0x4c'),_0x17ae34['dataValues']));_0x3d0bfd[_0x9860('0x4b')](get_open_tabs('sms',_0x17ae34['dataValues']));_0x3d0bfd['push'](get_open_tabs(_0x9860('0x51'),_0x17ae34[_0x9860('0x4d')]));_0x3d0bfd[_0x9860('0x4b')](get_open_tabs('whatsapp',_0x17ae34[_0x9860('0x4d')]));_0x3d0bfd[_0x9860('0x4b')](get_open_tabs(_0x9860('0x4f'),_0x17ae34['dataValues']));_0x3d0bfd['push'](get_open_tabs(_0x9860('0x50'),_0x17ae34[_0x9860('0x4d')]));return Promise[_0x9860('0x52')](_0x3d0bfd);}else{return values;}})[_0x9860('0x14')](function(){return values;})[_0x9860('0x14')](respondWithResult(_0x4d3190,null))[_0x9860('0x1d')](handleError(_0x4d3190,null));};exports[_0x9860('0x5e')]=function(_0x26e005,_0x2cf03c){if(_0x26e005[_0x9860('0x5f')]['id']){delete _0x26e005[_0x9860('0x5f')]['id'];}delete _0x26e005['body'][_0x9860('0x27')];return db[_0x9860('0x3a')]['find']({'where':{'id':_0x26e005['params']['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x2cf03c,null))[_0x9860('0x14')](saveUpdates(_0x26e005[_0x9860('0x5f')],null))['then'](respondWithResult(_0x2cf03c,null))[_0x9860('0x1d')](handleError(_0x2cf03c,null));};exports[_0x9860('0x60')]=function(_0x3ac942,_0x2b56e4){return db[_0x9860('0x3a')][_0x9860('0x60')]()[_0x9860('0x14')](respondWithResult(_0x2b56e4,null))[_0x9860('0x1d')](handleError(_0x2b56e4,null));};exports[_0x9860('0x61')]=function(_0x39d0c4,_0x2b3d39){return db[_0x9860('0x3a')][_0x9860('0x5d')]({'where':{'id':_0x39d0c4[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x2b3d39,null))['then'](function(_0x2046af){if(_0x2046af){return _0x2046af[_0x9860('0x61')](_0x39d0c4['body'][_0x9860('0x62')],_[_0x9860('0x63')](_0x39d0c4[_0x9860('0x5f')],[_0x9860('0x62'),'id'])||{});}})[_0x9860('0x14')](respondWithResult(_0x2b3d39,null))['catch'](handleError(_0x2b3d39,null));};function validateUser(_0x315fcd){return new Promise(function(_0x10c0f3,_0x1fa386){if(_0x315fcd[_0x9860('0x64')])return _0x10c0f3(_0x315fcd);return db[_0x9860('0x65')][_0x9860('0x66')](0x1)[_0x9860('0x14')](function(_0x4cf5d0){if(_0x4cf5d0[_0x9860('0x67')])authService[_0x9860('0x68')](_0x315fcd[_0x9860('0x3f')]);db['User'][_0x9860('0x69')](_0x9860('0x64'))[_0x9860('0x14')](function(_0x6d1229){if(_[_0x9860('0x6a')](_0x6d1229)){_0x315fcd[_0x9860('0x64')]=_0x4cf5d0[_0x9860('0x6b')]||0x1;return;}if(_[_0x9860('0x6a')](_0x4cf5d0[_0x9860('0x6b')])||_0x4cf5d0[_0x9860('0x6b')]===_0x6d1229){_0x315fcd['internal']=_0x6d1229+0x1;return;}if(_0x4cf5d0[_0x9860('0x6b')]>_0x6d1229){_0x315fcd[_0x9860('0x64')]=_0x4cf5d0[_0x9860('0x6b')];return;}return db[_0x9860('0x6c')][_0x9860('0x43')](_0x9860('0x6d'),{'type':db[_0x9860('0x6c')]['QueryTypes'][_0x9860('0x6e')]})['then'](function(_0x4f9d66){if(_0x4f9d66&&_0x4f9d66[_0x9860('0x5a')]){for(var _0x246850=0x0,_0x403170=_0x4f9d66[_0x9860('0x5a')];_0x246850<_0x403170&&_[_0x9860('0x6a')](_0x315fcd['internal']);_0x246850++){if(_0x4cf5d0[_0x9860('0x6b')]<=_0x4f9d66[_0x246850][_0x9860('0x6f')]){_0x315fcd[_0x9860('0x64')]=_0x4f9d66[_0x246850]['from'];}else if(_0x4cf5d0[_0x9860('0x6b')]>_0x4f9d66[_0x246850][_0x9860('0x6f')]&&_0x4cf5d0['min_internal']<=_0x4f9d66[_0x246850]['to']){_0x315fcd[_0x9860('0x64')]=_0x4cf5d0['min_internal'];}}}if(_[_0x9860('0x6a')](_0x315fcd['internal'])){_0x315fcd[_0x9860('0x64')]=_0x6d1229+0x1;}return _0x10c0f3(_0x315fcd);});});})['catch'](function(_0x2d2871){_0x1fa386(_0x2d2871);});});}function updateUser(_0x582265){return new Promise(function(_0x2f80ea,_0x385354){try{if(_0x582265[_0x9860('0x70')]){_0x582265[_0x9860('0x71')]=_0x582265[_0x9860('0x64')];_0x582265[_0x9860('0x72')]={'mailbox':_0x582265['internal'],'password':_0x582265[_0x9860('0x3f')],'fullname':_0x582265[_0x9860('0x73')],'email':_0x582265['email']};}if(_0x582265[_0x9860('0x27')]===_0x9860('0x74')){if(!_0x582265['permissions'])_0x582265[_0x9860('0x75')]=[_0x9860('0x76'),_0x9860('0x77'),_0x9860('0x78'),_0x9860('0x79'),_0x9860('0x7a'),_0x9860('0x7b'),_0x9860('0x7c'),_0x9860('0x7d'),_0x9860('0x7e'),'108',_0x9860('0x7f'),_0x9860('0x80'),'111','114',_0x9860('0x81')];}_0x2f80ea(_0x582265);}catch(_0x3c4d3b){_0x385354(_0x3c4d3b);}});}exports[_0x9860('0x82')]=function(_0x123a63,_0xd4a925){if(_0x123a63['user'][_0x9860('0x27')]==='agent')throw new Error(_0x9860('0x83'));if(_0x123a63['body'][_0x9860('0x27')]===_0x9860('0x2c')&&_0x123a63[_0x9860('0x2c')][_0x9860('0x27')]!==_0x9860('0x2b')){throw new Error(_0x9860('0x84'));}if(_0x123a63[_0x9860('0x5f')]['role']===_0x9860('0x2b')&&_0x123a63['user'][_0x9860('0x27')]!==_0x9860('0x2b')){throw new Error(_0x9860('0x85'));}return licenseUtil[_0x9860('0x86')]([_0x123a63['body']])[_0x9860('0x14')](function(){return validateUser(_0x123a63[_0x9860('0x5f')]);})[_0x9860('0x14')](function(_0xa51ade){return updateUser(_0xa51ade)['then'](function(_0x2c1690){if(_0x2c1690['role']==='admin'){_0x2c1690[_0x9860('0x87')]=_0x123a63[_0x9860('0x2c')]['settingsEnabled'];delete _0x2c1690[_0x9860('0x88')];}return _0x2c1690;});})[_0x9860('0x14')](function(_0x15c0f9){return db[_0x9860('0x3a')][_0x9860('0x82')](_0x15c0f9,{'include':[{'model':db[_0x9860('0x72')],'as':_0x9860('0x72')}]});})[_0x9860('0x14')](function(_0x38c33d){if(_0x123a63[_0x9860('0x5f')]['role']==='user')return _0x38c33d;if(_0x123a63[_0x9860('0x2c')][_0x9860('0x27')]!==_0x9860('0x2c'))return _0x38c33d;return db['UserProfileSection'][_0x9860('0x5d')]({'where':{'name':_0x38c33d[_0x9860('0x27')]===_0x9860('0x74')?'Agents':'Telephones','userProfileId':_0x123a63['user'][_0x9860('0x88')]},'raw':!![]})['then'](function(_0x227087){if(!_0x227087||_0x227087[_0x9860('0x89')]!=0x0)return _0x38c33d;return db['UserProfileResource'][_0x9860('0x82')]({'name':_0x38c33d[_0x9860('0x37')],'resourceId':_0x38c33d['id'],'type':_0x227087[_0x9860('0x37')],'sectionId':_0x227087['id']},{})[_0x9860('0x14')](function(){return _0x38c33d;});})[_0x9860('0x1d')](function(_0x3844a7){logger[_0x9860('0x1a')](_0x9860('0x8a'),_0x3844a7);throw _0x3844a7;});})[_0x9860('0x14')](respondWithResult(_0xd4a925,0xc9))[_0x9860('0x1d')](handleError(_0xd4a925,null));};exports[_0x9860('0x8b')]=function(_0x13ff12,_0x4543e0){var _0x4d1910=_0x13ff12['body'];var _0xbbfe96=[];if(_0x13ff12['user'][_0x9860('0x27')]===_0x9860('0x74'))throw new Error(_0x9860('0x83'));if(_['some'](_0x4d1910,[_0x9860('0x27'),_0x9860('0x2c')])&&_0x13ff12['user'][_0x9860('0x27')]!==_0x9860('0x2b')){throw new Error(_0x9860('0x84'));}if(_[_0x9860('0x8c')](_0x4d1910,['role','admin'])&&_0x13ff12['user'][_0x9860('0x27')]!==_0x9860('0x2b')){throw new Error(_0x9860('0x8d'));}return licenseUtil[_0x9860('0x86')](_0x4d1910)[_0x9860('0x14')](function(){return validateUser(_0x4d1910[0x0]);})[_0x9860('0x14')](function(){for(var _0x4a7c23=0x1;_0x4a7c23<_0x4d1910['length'];_0x4a7c23++){var _0x562b5d=_0x4d1910[_0x4a7c23-0x1][_0x9860('0x64')];if(!_0x4d1910[_0x4a7c23][_0x9860('0x64')])_0x4d1910[_0x4a7c23][_0x9860('0x64')]=_0x562b5d+0x1;_0xbbfe96[_0x9860('0x4b')](validateUser(_0x4d1910[_0x4a7c23]));}return Promise[_0x9860('0x52')](_0xbbfe96);})['then'](function(){_0xbbfe96=[];for(var _0xa51ae5=0x0;_0xa51ae5<_0x4d1910[_0x9860('0x5a')];_0xa51ae5++){_0xbbfe96[_0x9860('0x4b')](updateUser(_0x4d1910[_0xa51ae5]));}return Promise[_0x9860('0x52')](_0xbbfe96);})[_0x9860('0x14')](function(){_0xbbfe96=_0x4d1910[_0x9860('0x31')](function(_0x45926d){return db['User']['create'](_0x45926d,{'include':[{'model':db[_0x9860('0x72')],'as':'VoiceMail'}]})[_0x9860('0x14')](function(_0x33b232){_0x45926d['id']=_0x33b232['id'];return _0x45926d;});});return Promise[_0x9860('0x52')](_0xbbfe96);})[_0x9860('0x14')](function(_0x1ea341){if(_0x13ff12[_0x9860('0x5f')][_0x9860('0x27')]===_0x9860('0x2c'))return _0x1ea341;if(_0x13ff12['user'][_0x9860('0x27')]!==_0x9860('0x2c'))return _0x1ea341;var _0x2c60b4=_[_0x9860('0x8c')](_0x1ea341,function(_0xdb16e1){return _0xdb16e1['role']===_0x9860('0x74')||_0xdb16e1[_0x9860('0x27')]===_0x9860('0x2e');});if(!_0x2c60b4)return _0x1ea341;return db[_0x9860('0x8e')][_0x9860('0x8f')]({'where':{'name':{'$or':[_0x9860('0x90'),'Telephones']},'userProfileId':_0x13ff12['user']['userProfileId']},'raw':!![]})[_0x9860('0x14')](function(_0x2ae9f5){if(_[_0x9860('0x91')](_0x2ae9f5)||!_['some'](_0x2ae9f5,['autoAssociation',0x0]))return _0x1ea341;_0xbbfe96=[];var _0x5c8815=_(_0x2ae9f5)[_0x9860('0x31')](function(_0xdedb7b){if(_0xdedb7b[_0x9860('0x89')]===0x1)return;return _0xdedb7b[_0x9860('0x37')]==='Agents'?_0x9860('0x74'):_0x9860('0x2e');})['compact']()['value']();for(var _0x3ab02a=0x0;_0x3ab02a<_0x1ea341['length'];_0x3ab02a++){if(!_[_0x9860('0x32')](_0x5c8815,_0x1ea341[_0x3ab02a][_0x9860('0x27')]))return;var _0x5f0b51=_0x1ea341[_0x3ab02a][_0x9860('0x27')]==='agent'?_0x9860('0x90'):_0x9860('0x2d');_0xbbfe96[_0x9860('0x4b')](db['UserProfileResource'][_0x9860('0x82')]({'name':_0x1ea341[_0x3ab02a][_0x9860('0x37')],'resourceId':_0x1ea341[_0x3ab02a]['id'],'type':_0x5f0b51,'sectionId':_[_0x9860('0x5d')](_0x2ae9f5,['name',_0x5f0b51])['id']},{}));}return Promise['all'](_0xbbfe96);});})['then'](respondWithResult(_0x4543e0,0xc9))[_0x9860('0x1d')](handleError(_0x4543e0,null));};exports['changePassword']=function(_0x59e3f3,_0x3d9b09){if(_0x59e3f3[_0x9860('0x5f')]['id']){delete _0x59e3f3[_0x9860('0x5f')]['id'];}return db[_0x9860('0x3a')][_0x9860('0x5d')]({'where':{'id':_0x59e3f3[_0x9860('0x54')]['id']}})['then'](function(_0x3e3b57){if(!_0x3e3b57)return null;if(_0x3e3b57['id']===_0x59e3f3['user']['id']){if(!_0x59e3f3['body'][_0x9860('0x92')]||!_0x59e3f3[_0x9860('0x5f')]['newPassword']){throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0x95'));}if(!_0x3e3b57[_0x9860('0x96')](_0x59e3f3[_0x9860('0x5f')]['oldPassword'])){throw new db[(_0x9860('0x93'))]['ValidationError'](_0x9860('0x97'));}if(_0x59e3f3[_0x9860('0x5f')][_0x9860('0x92')]===_0x59e3f3['body'][_0x9860('0x98')]){throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0x99'));}}else if(_0x59e3f3[_0x9860('0x2c')]['role']===_0x9860('0x2b')){if(!_0x59e3f3[_0x9860('0x5f')]['newPassword']){throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0x9a'));}}else if(_0x59e3f3[_0x9860('0x2c')]['role']===_0x9860('0x2c')){if(!_0x59e3f3[_0x9860('0x5f')][_0x9860('0x98')]){throw new db[(_0x9860('0x93'))]['ValidationError'](_0x9860('0x9a'));}if(_0x3e3b57['role']!==_0x9860('0x74')){throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0x83'));}}else{throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0x83'));}return _0x3e3b57;})[_0x9860('0x14')](handleEntityNotFound(_0x3d9b09,null))[_0x9860('0x14')](function(_0x5deb9d){return db[_0x9860('0x65')][_0x9860('0x9b')]({'attributes':['id','securePassword',_0x9860('0x9c'),_0x9860('0x9d')]})[_0x9860('0x14')](function(_0x25f2f7){if(_0x25f2f7[_0x9860('0x67')])authService[_0x9860('0x68')](_0x59e3f3['body']['newPassword']);if(!_0x25f2f7['enforcePasswordHistory']||!_0x5deb9d[_0x9860('0x9e')])return _0x5deb9d;authService[_0x9860('0x9f')](_0x59e3f3['body'][_0x9860('0x98')],_0x5deb9d['previousPasswords'],_0x25f2f7[_0x9860('0x9d')]);return _0x5deb9d;})[_0x9860('0x14')](saveUpdates({'password':_0x59e3f3[_0x9860('0x5f')]['newPassword'],'passwordResetAt':_0x59e3f3['user']['id']==_0x59e3f3[_0x9860('0x54')]['id']?moment():null,'previousPasswords':authService[_0x9860('0xa0')](_0x59e3f3[_0x9860('0x5f')][_0x9860('0x98')],_0x5deb9d['previousPasswords'])},null));})[_0x9860('0x14')](respondWithResult(_0x3d9b09,null))[_0x9860('0x1d')](handleError(_0x3d9b09,null));};exports['addQueues']=function(_0x14d267,_0x152db6){var _0x56a761=_0x14d267[_0x9860('0x5f')][_0x9860('0xa1')];return db[_0x9860('0x3a')]['find']({'where':{'id':_0x14d267[_0x9860('0x54')]['id']},'attributes':['id',_0x9860('0x37'),_0x9860('0x27'),_0x9860('0xa2'),_0x9860('0xa3'),_0x9860('0xa4'),_0x9860('0xa5')]})['then'](handleEntityNotFound(_0x152db6,null))[_0x9860('0x14')](function(_0x497924){if(_0x497924){if(!utils[_0x9860('0xa6')](_0x56a761)){throw new db[(_0x9860('0x93'))]['ValidationError'](_0x9860('0xa7'));}return _0x497924[_0x9860('0xa8')+_[_0x9860('0xa9')](_0x56a761[_0x9860('0xaa')]())+_0x9860('0xab')](_0x14d267[_0x9860('0x5f')]['ids'],{'penalty':_0x14d267[_0x9860('0x5f')]['penalty']||0x0})[_0x9860('0xac')](function(_0x3dee30){for(var _0x37acf1=0x0;_0x37acf1<_0x14d267[_0x9860('0x5f')][_0x9860('0x62')][_0x9860('0x5a')];_0x37acf1+=0x1){var _0x4d640e={'UserId':Number(_0x14d267[_0x9860('0x54')]['id'])};_0x4d640e[_[_0x9860('0xa9')](_0x56a761[_0x9860('0xaa')]())+'QueueId']=Number(_0x14d267['body'][_0x9860('0x62')][_0x37acf1]);socket[_0x9860('0x28')]('user'+_[_0x9860('0xa9')](_0x56a761[_0x9860('0xaa')]())+_0x9860('0xad'),_0x4d640e);}return _0x3dee30;})[_0x9860('0x14')](function(){if(_0x56a761==='voice'){return db['VoiceQueue'][_0x9860('0x8f')]({'where':{'id':_0x14d267[_0x9860('0x5f')][_0x9860('0x62')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x9860('0x14')](function(_0x5a1986){var _0x34d389=_0x497924['get']({'plain':!![]});var _0x37af7c=[];if(_0x56a761===_0x9860('0xae')&&_0x34d389[_0x9860('0x27')]===_0x9860('0x74')&&_0x34d389[_0x9860('0xa2')]){for(let _0x4c59b7=0x0;_0x4c59b7<_0x5a1986[_0x9860('0x5a')];_0x4c59b7+=0x1){_0x37af7c[_0x9860('0x4b')]({'membername':_0x34d389[_0x9860('0x37')],'UserId':_0x34d389['id'],'queue_name':_0x5a1986[_0x4c59b7][_0x9860('0x37')],'VoiceQueueId':_0x5a1986[_0x4c59b7]['id'],'interface':_[_0x9860('0x6a')](_0x34d389['interface'])?util['format'](_0x9860('0xaf'),_0x34d389[_0x9860('0x37')]):_0x34d389['interface'],'paused':_0x34d389[_0x9860('0xa4')]||![],'penalty':_0x14d267['body'][_0x9860('0xb0')]||0x0});}return Promise[_0x9860('0x52')](_0x37af7c[_0x9860('0x31')](function(_0x39e2f4){return db['UserVoiceQueueRt']['upsert'](_0x39e2f4);}));}return _0x497924;});}})[_0x9860('0x14')](respondWithStatusCode(_0x152db6,null))[_0x9860('0x1d')](handleError(_0x152db6,null));};exports['removeQueues']=function(_0x415061,_0xd90ecd){var _0x38126f,_0x3bdc2f;return db['User']['find']({'where':{'id':_0x415061[_0x9860('0x54')]['id']},'attributes':['id',_0x9860('0x37'),_0x9860('0x27')]})[_0x9860('0x14')](handleEntityNotFound(_0xd90ecd,null))['then'](function(_0xaf4893){if(_0xaf4893){_0x38126f=_0xaf4893;if(!_0x415061[_0x9860('0x43')][_0x9860('0xa1')]||!utils[_0x9860('0xa6')](_0x415061[_0x9860('0x43')][_0x9860('0xa1')])){throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0xa7'));}return _0xaf4893['remove'+_['capitalize'](_0x415061['query'][_0x9860('0xa1')]['toLowerCase']())+'Queues'](_0x415061[_0x9860('0x43')][_0x9860('0x62')]);}})['then'](function(_0x4f35e9){if(_['isArray'](_0x415061[_0x9860('0x43')][_0x9860('0x62')])){for(var _0x5b88e2=0x0;_0x5b88e2<_0x415061[_0x9860('0x43')]['ids']['length'];_0x5b88e2+=0x1){_0x3bdc2f={'UserId':Number(_0x415061['params']['id'])};_0x3bdc2f[_[_0x9860('0xa9')](_0x415061[_0x9860('0x43')][_0x9860('0xa1')][_0x9860('0xaa')]())+_0x9860('0xb1')]=Number(_0x415061[_0x9860('0x43')][_0x9860('0x62')][_0x5b88e2]);socket[_0x9860('0x28')](_0x9860('0x2c')+_['capitalize'](_0x415061[_0x9860('0x43')]['channel'][_0x9860('0xaa')]())+_0x9860('0xb2'),_0x3bdc2f);}}else{_0x3bdc2f={'UserId':Number(_0x415061['params']['id'])};_0x3bdc2f[_[_0x9860('0xa9')](_0x415061[_0x9860('0x43')][_0x9860('0xa1')][_0x9860('0xaa')]())+_0x9860('0xb1')]=Number(_0x415061[_0x9860('0x43')]['ids']);socket[_0x9860('0x28')](_0x9860('0x2c')+_[_0x9860('0xa9')](_0x415061[_0x9860('0x43')]['channel'][_0x9860('0xaa')]())+_0x9860('0xb2'),_0x3bdc2f);}return _0x4f35e9;})['then'](function(){if(_0x415061[_0x9860('0x43')][_0x9860('0xa1')]===_0x9860('0xae')){return db[_0x9860('0xb3')][_0x9860('0x35')]({'where':{'UserId':_0x415061[_0x9860('0x54')]['id'],'VoiceQueueId':_0x415061['query'][_0x9860('0x62')]},'individualHooks':!![]})[_0x9860('0x14')](function(){return _0x38126f;});}return _0x38126f;})[_0x9860('0x14')](respondWithStatusCode(_0xd90ecd,null))[_0x9860('0x1d')](handleError(_0xd90ecd,null));};exports[_0x9860('0xb4')]=function(_0x2f0c34,_0x152f55){_0x2f0c34[_0x9860('0x5f')][_0x9860('0xb5')]=_0x2f0c34[_0x9860('0xb6')]['filename'];return db[_0x9860('0x3a')][_0x9860('0x5d')]({'where':{'id':_0x2f0c34[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x152f55,null))['then'](saveUpdates(_0x2f0c34['body'],null))[_0x9860('0x14')](respondWithResult(_0x152f55,null))[_0x9860('0x1d')](handleError(_0x152f55,null));};exports[_0x9860('0xb7')]=function(_0x3a8cf2,_0x3cf8a7){var _0xf6a2f7=path[_0x9860('0xb8')](config[_0x9860('0xb9')],_0x9860('0xba'));return db[_0x9860('0x3a')][_0x9860('0x5d')]({'where':{'id':_0x3a8cf2[_0x9860('0x54')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x9860('0x14')](handleEntityNotFound(_0x3cf8a7,null))[_0x9860('0x14')](function(_0x2243b3){if(_0x2243b3){if(_[_0x9860('0x6a')](_0x2243b3[_0x9860('0xb5')])){return _0x3cf8a7[_0x9860('0xbb')](_0xf6a2f7);}else{if(!fs[_0x9860('0xbc')](path[_0x9860('0xb8')](config[_0x9860('0xb9')],'server/files/images/',_0x2243b3['userpic']))){return _0x3cf8a7[_0x9860('0xbb')](_0xf6a2f7);}return _0x3cf8a7[_0x9860('0xbb')](path[_0x9860('0xb8')](config[_0x9860('0xb9')],_0x9860('0xbd'),_0x2243b3[_0x9860('0xb5')]));}}})[_0x9860('0x1d')](handleError(_0x3cf8a7,null));};exports[_0x9860('0xbe')]=function(_0x4f8594,_0x48ccc8){return db['User'][_0x9860('0x5d')]({'where':{'id':_0x4f8594['params']['id']},'attributes':['id']})[_0x9860('0x14')](handleEntityNotFound(_0x48ccc8,null))[_0x9860('0x14')](function(_0x2d6311){var _0x2277f6=[];values=_0x2d6311[_0x9860('0x4d')];_0x2277f6[_0x9860('0x4b')](get_open_tabs(_0x9860('0x4c'),_0x2d6311[_0x9860('0x4d')]));_0x2277f6['push'](get_open_tabs('sms',_0x2d6311[_0x9860('0x4d')]));_0x2277f6[_0x9860('0x4b')](get_open_tabs(_0x9860('0x51'),_0x2d6311[_0x9860('0x4d')]));_0x2277f6['push'](get_open_tabs(_0x9860('0xbf'),_0x2d6311[_0x9860('0x4d')]));_0x2277f6[_0x9860('0x4b')](get_open_tabs('fax',_0x2d6311[_0x9860('0x4d')]));_0x2277f6['push'](get_open_tabs(_0x9860('0x50'),_0x2d6311['dataValues']));return Promise['all'](_0x2277f6);})[_0x9860('0x14')](function(_0x56b1d3){if(_0x56b1d3){var _0x18239e=_[_0x9860('0x31')](values[_0x9860('0xc0')],function(_0x551d38){return{'channel':_0x9860('0xc1'),'id':_0x551d38['id'],'createdAt':_0x551d38[_0x9860('0xc2')]};});var _0x5c4af7=_['map'](values[_0x9860('0xc3')],function(_0x2b9238){return{'channel':_0x9860('0xc4'),'id':_0x2b9238['id'],'createdAt':_0x2b9238[_0x9860('0xc2')]};});var _0x122e49=_[_0x9860('0x31')](values[_0x9860('0xc5')],function(_0x2101b3){return{'channel':_0x9860('0xc6'),'id':_0x2101b3['id'],'createdAt':_0x2101b3[_0x9860('0xc2')]};});var _0x221256=_[_0x9860('0x31')](values[_0x9860('0xc7')],function(_0x1fb4d0){return{'channel':_0x9860('0xc8'),'id':_0x1fb4d0['id'],'createdAt':_0x1fb4d0[_0x9860('0xc2')]};});var _0x19b08e=_[_0x9860('0x31')](values[_0x9860('0xc9')],function(_0x3fed23){return{'channel':'SMS','id':_0x3fed23['id'],'createdAt':_0x3fed23[_0x9860('0xc2')]};});var _0x51b6c5=_['map'](values[_0x9860('0xca')],function(_0x7bea65){return{'channel':_0x9860('0xcb'),'id':_0x7bea65['id'],'createdAt':_0x7bea65['createdAt']};});var _0x487b45=_[_0x9860('0xcc')](_0x18239e,_0x5c4af7,_0x122e49,_0x221256,_0x19b08e,_0x51b6c5);var _0x286ff9={'count':_0x487b45[_0x9860('0x5a')],'rows':_0x487b45};return _0x286ff9;}else return null;})[_0x9860('0x14')](respondWithResult(_0x48ccc8,null))['catch'](handleError(_0x48ccc8,null));};exports['getContacts']=function(_0x51948e,_0x1da0b9){var _0x590916={};return db['User'][_0x9860('0x9b')]({'where':{'id':_0x51948e[_0x9860('0x54')]['id']}})[_0x9860('0x14')](function(_0x1f1f0c){if(!_0x1f1f0c){throw new APINotFoundError(util[_0x9860('0xcd')]('User\x20with\x20id\x20%s\x20not\x20found',_0x51948e['params']['id']));}return contacts[_0x9860('0x60')]();})[_0x9860('0x14')](function(_0x36b08f){_0x51948e['query'][_0x9860('0x3a')]=_0x51948e[_0x9860('0x54')]['id'];_0x590916=qs[_0x9860('0x41')](_0x36b08f,_0x51948e);if(_0x51948e['query']['hasOwnProperty'](_0x9860('0x44'))){_0x590916[_0x9860('0x45')]=[{'model':db[_0x9860('0xce')],'as':_0x9860('0xcf'),'required':![]},{'model':db[_0x9860('0xd0')],'as':_0x9860('0xd1'),'attributes':['id',_0x9860('0x37'),_0x9860('0xd2')],'where':_0x51948e[_0x9860('0x43')]['tag']?{'id':_0x51948e[_0x9860('0x43')]['tag']}:undefined,'required':_0x51948e[_0x9860('0x43')]['tag']?!![]:![]}];}return contacts[_0x9860('0x8f')](_0x51948e[_0x9860('0x43')],_0x51948e['user'],_0x590916,_0x36b08f);})[_0x9860('0x14')](respondWithFilteredResult(_0x1da0b9,_0x590916))[_0x9860('0x1d')](APIHandleError(_0x1da0b9));};exports[_0x9860('0xd3')]=function(_0x10a1ff,_0x2b0dad){var _0x31026e;var _0x610d2={};var _0x4bdcc3;return db[_0x9860('0x3a')]['findOne']({'where':{'id':_0x10a1ff['params']['id']},'attributes':['id',_0x9860('0x37'),_0x9860('0x27')]})[_0x9860('0x14')](handleEntityNotFound(_0x2b0dad,null))['then'](function(_0x793d3){if(!utils[_0x9860('0xa6')](_0x10a1ff[_0x9860('0x43')][_0x9860('0xa1')])){throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0xa7'));}_0x31026e=_0x793d3;var _0x326ac1={};_0x326ac1[_0x9860('0x55')]=_[_0x9860('0x57')](db[_['capitalize'](_0x10a1ff[_0x9860('0x43')][_0x9860('0xa1')])+'Queue'][_0x9860('0x3b')]);_0x326ac1[_0x9860('0x43')]=_[_0x9860('0x57')](_0x10a1ff[_0x9860('0x43')]);_0x326ac1[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x326ac1['model'],_0x326ac1[_0x9860('0x43')]);_0x610d2[_0x9860('0x48')]=_['intersection'](_0x326ac1[_0x9860('0x55')],qs[_0x9860('0x59')](_0x10a1ff[_0x9860('0x43')]['fields']));_0x610d2[_0x9860('0x48')]=_0x610d2[_0x9860('0x48')][_0x9860('0x5a')]?_0x610d2['attributes']:_0x326ac1['model'];_0x610d2[_0x9860('0xd5')]=qs['sort'](_0x10a1ff[_0x9860('0x43')][_0x9860('0xd6')]);_0x610d2[_0x9860('0x42')]=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0x10a1ff[_0x9860('0x43')],_0x326ac1[_0x9860('0xd4')]));if(_0x10a1ff[_0x9860('0x43')][_0x9860('0x2f')]){_0x610d2[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x610d2[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0x610d2[_0x9860('0x48')],function(_0x139b77){var _0x1a3ba9={};_0x1a3ba9[_0x139b77]={'$like':'%'+_0x10a1ff[_0x9860('0x43')]['filter']+'%'};return _0x1a3ba9;})});}_0x610d2=_[_0x9860('0x5b')]({},_0x610d2,_0x10a1ff[_0x9860('0x5c')]);switch(_0x31026e['role']){case'admin':return db[_[_0x9860('0xa9')](_0x10a1ff[_0x9860('0x43')]['channel'])+'Queue'][_0x9860('0x8f')](_0x610d2);case _0x9860('0x2c'):case _0x9860('0x74'):return _0x31026e[_0x9860('0x2a')+_[_0x9860('0xa9')](_0x10a1ff[_0x9860('0x43')][_0x9860('0xa1')])+_0x9860('0xab')](_0x610d2);default:throw new db[(_0x9860('0x93'))]['ValidationError'](_0x9860('0xd8'));}})['then'](function(_0x2d12da){_0x4bdcc3=_0x2d12da[_0x9860('0x5a')];if(!_0x10a1ff[_0x9860('0x43')][_0x9860('0xd9')](_0x9860('0xda'))){_0x610d2[_0x9860('0x24')]=qs[_0x9860('0x24')](_0x10a1ff[_0x9860('0x43')][_0x9860('0x24')]);_0x610d2[_0x9860('0x23')]=qs[_0x9860('0x23')](_0x10a1ff[_0x9860('0x43')]['offset']);}switch(_0x31026e[_0x9860('0x27')]){case'admin':return db[_[_0x9860('0xa9')](_0x10a1ff[_0x9860('0x43')][_0x9860('0xa1')])+'Queue'][_0x9860('0x8f')](_0x610d2);case _0x9860('0x2c'):case _0x9860('0x74'):return _0x31026e[_0x9860('0x2a')+_[_0x9860('0xa9')](_0x10a1ff[_0x9860('0x43')][_0x9860('0xa1')])+_0x9860('0xab')](_0x610d2);}})[_0x9860('0x14')](function(_0x514328){return{'count':_0x4bdcc3,'rows':_0x514328};})[_0x9860('0x14')](respondWithResult(_0x2b0dad,null))[_0x9860('0x1d')](handleError(_0x2b0dad,null));};exports[_0x9860('0xdb')]=function(_0x1326ef,_0x1d7bdf){var _0xeb2af1={};var _0x3a95db={};var _0x3963af;var _0x52c202;return db[_0x9860('0x3a')]['findOne']({'where':{'id':_0x1326ef[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x1d7bdf,null))[_0x9860('0x14')](function(_0x47fed4){if(_0x47fed4){_0x3963af=_0x47fed4;_0x3a95db[_0x9860('0x55')]=_['keys'](db['UserVoiceQueueRt'][_0x9860('0x3b')]);_0x3a95db[_0x9860('0x43')]=_['keys'](_0x1326ef[_0x9860('0x43')]);_0x3a95db[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x3a95db['model'],_0x3a95db['query']);_0xeb2af1[_0x9860('0x48')]=_[_0x9860('0x58')](_0x3a95db[_0x9860('0x55')],qs['fields'](_0x1326ef['query']['fields']));_0xeb2af1[_0x9860('0x48')]=_0xeb2af1[_0x9860('0x48')][_0x9860('0x5a')]?_0xeb2af1[_0x9860('0x48')]:_0x3a95db[_0x9860('0x55')];_0xeb2af1['order']=qs[_0x9860('0xd6')](_0x1326ef[_0x9860('0x43')][_0x9860('0xd6')]);_0xeb2af1[_0x9860('0x42')]=qs['filters'](_[_0x9860('0xd7')](_0x1326ef[_0x9860('0x43')],_0x3a95db[_0x9860('0xd4')]));if(_0x1326ef['query'][_0x9860('0x2f')]){_0xeb2af1[_0x9860('0x42')]=_[_0x9860('0x5b')](_0xeb2af1[_0x9860('0x42')],{'$or':_['map'](_0xeb2af1[_0x9860('0x48')],function(_0x562fdc){var _0x327b56={};_0x327b56[_0x562fdc]={'$like':'%'+_0x1326ef['query'][_0x9860('0x2f')]+'%'};return _0x327b56;})});}_0xeb2af1=_[_0x9860('0x5b')]({},_0xeb2af1,_0x1326ef[_0x9860('0x5c')]);return _0x3963af[_0x9860('0xdb')](_0xeb2af1);}})['then'](function(_0x11ef12){if(_0x11ef12){_0x52c202=_0x11ef12[_0x9860('0x5a')];if(!_0x1326ef['query'][_0x9860('0xd9')]('nolimit')){_0xeb2af1['limit']=qs[_0x9860('0x24')](_0x1326ef['query'][_0x9860('0x24')]);_0xeb2af1[_0x9860('0x23')]=qs[_0x9860('0x23')](_0x1326ef[_0x9860('0x43')]['offset']);}return _0x3963af[_0x9860('0xdb')](_0xeb2af1);}})[_0x9860('0x14')](function(_0x279ca4){if(_0x279ca4){return _0x279ca4?{'count':_0x52c202,'rows':_0x279ca4}:null;}})['then'](respondWithResult(_0x1d7bdf,null))[_0x9860('0x1d')](handleError(_0x1d7bdf,null));};exports['getGroups']=function(_0x49557a,_0x2fd1c8){var _0x1a4e15={};var _0x20d268={};var _0xee7a62;var _0x5607ec;return db[_0x9860('0x3a')][_0x9860('0x9b')]({'where':{'id':_0x49557a['params']['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x2fd1c8,null))[_0x9860('0x14')](function(_0x5c2de4){if(_0x5c2de4){_0xee7a62=_0x5c2de4;_0x20d268[_0x9860('0x55')]=_[_0x9860('0x57')](db[_0x9860('0xdc')]['rawAttributes']);_0x20d268['query']=_[_0x9860('0x57')](_0x49557a[_0x9860('0x43')]);_0x20d268[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x20d268[_0x9860('0x55')],_0x20d268[_0x9860('0x43')]);_0x1a4e15[_0x9860('0x48')]=_[_0x9860('0x58')](_0x20d268[_0x9860('0x55')],qs[_0x9860('0x59')](_0x49557a[_0x9860('0x43')][_0x9860('0x59')]));_0x1a4e15[_0x9860('0x48')]=_0x1a4e15[_0x9860('0x48')]['length']?_0x1a4e15[_0x9860('0x48')]:_0x20d268[_0x9860('0x55')];_0x1a4e15['order']=qs[_0x9860('0xd6')](_0x49557a['query'][_0x9860('0xd6')]);_0x1a4e15['where']=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0x49557a[_0x9860('0x43')],_0x20d268[_0x9860('0xd4')]));if(_0x49557a[_0x9860('0x43')][_0x9860('0x2f')]){_0x1a4e15[_0x9860('0x42')]=_['merge'](_0x1a4e15['where'],{'$or':_[_0x9860('0x31')](_0x1a4e15[_0x9860('0x48')],function(_0x46afd5){var _0x103afe={};_0x103afe[_0x46afd5]={'$like':'%'+_0x49557a[_0x9860('0x43')][_0x9860('0x2f')]+'%'};return _0x103afe;})});}_0x1a4e15=_[_0x9860('0x5b')]({},_0x1a4e15,_0x49557a[_0x9860('0x5c')]);return _0xee7a62['getGroups'](_0x1a4e15);}})[_0x9860('0x14')](function(_0x136623){if(_0x136623){_0x5607ec=_0x136623[_0x9860('0x5a')];if(!_0x49557a['query'][_0x9860('0xd9')](_0x9860('0xda'))){_0x1a4e15[_0x9860('0x24')]=qs['limit'](_0x49557a[_0x9860('0x43')][_0x9860('0x24')]);_0x1a4e15[_0x9860('0x23')]=qs['offset'](_0x49557a['query']['offset']);}return _0xee7a62[_0x9860('0xdd')](_0x1a4e15);}})[_0x9860('0x14')](function(_0xd001b7){if(_0xd001b7){return _0xd001b7?{'count':_0x5607ec,'rows':_0xd001b7}:null;}})[_0x9860('0x14')](respondWithResult(_0x2fd1c8,null))[_0x9860('0x1d')](handleError(_0x2fd1c8,null));};exports[_0x9860('0xde')]=function(_0x482dbb,_0x52fc36){var _0x35c9b1={'raw':!![],'where':{}};var _0x3e127f={};var _0x4d9c84={'count':0x0,'rows':[]};return db[_0x9860('0x3a')][_0x9860('0x9b')]({'where':{'id':_0x482dbb[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x52fc36,null))[_0x9860('0x14')](function(_0x206f17){if(_0x206f17){_0x3e127f[_0x9860('0x55')]=_[_0x9860('0x57')](db[_0x9860('0xdf')]['rawAttributes']);_0x3e127f[_0x9860('0x43')]=_[_0x9860('0x57')](_0x482dbb[_0x9860('0x43')]);_0x3e127f[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x3e127f[_0x9860('0x55')],_0x3e127f['query']);_0x35c9b1[_0x9860('0x48')]=_['intersection'](_0x3e127f[_0x9860('0x55')],qs[_0x9860('0x59')](_0x482dbb[_0x9860('0x43')][_0x9860('0x59')]));_0x35c9b1[_0x9860('0x48')]=_0x35c9b1['attributes']['length']?_0x35c9b1[_0x9860('0x48')]:_0x3e127f[_0x9860('0x55')];if(!_0x482dbb[_0x9860('0x43')]['hasOwnProperty']('nolimit')){_0x35c9b1[_0x9860('0x24')]=qs[_0x9860('0x24')](_0x482dbb[_0x9860('0x43')][_0x9860('0x24')]);_0x35c9b1[_0x9860('0x23')]=qs[_0x9860('0x23')](_0x482dbb['query'][_0x9860('0x23')]);}_0x35c9b1[_0x9860('0xd5')]=qs['sort'](_0x482dbb['query'][_0x9860('0xd6')]);_0x35c9b1[_0x9860('0x42')]=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0x482dbb[_0x9860('0x43')],_0x3e127f[_0x9860('0xd4')]));_0x35c9b1[_0x9860('0x42')]['UserId']=_0x206f17['id'];if(_0x482dbb['query'][_0x9860('0x2f')]){_0x35c9b1[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x35c9b1[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0x35c9b1[_0x9860('0x48')],function(_0x5a02d9){var _0x481a08={};_0x481a08[_0x5a02d9]={'$like':'%'+_0x482dbb[_0x9860('0x43')]['filter']+'%'};return _0x481a08;})});}_0x35c9b1=_[_0x9860('0x5b')]({},_0x35c9b1,_0x482dbb[_0x9860('0x5c')]);return db[_0x9860('0xdf')][_0x9860('0x22')]({'where':_0x35c9b1[_0x9860('0x42')]})[_0x9860('0x14')](function(_0x3f8dbf){_0x4d9c84['count']=_0x3f8dbf;if(_0x482dbb[_0x9860('0x43')][_0x9860('0x44')]){_0x35c9b1['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x9860('0x8f')](_0x35c9b1);})[_0x9860('0x14')](function(_0x3032b5){_0x4d9c84[_0x9860('0x49')]=_0x3032b5;return _0x4d9c84;});}})[_0x9860('0x14')](respondWithFilteredResult(_0x52fc36,_0x35c9b1))[_0x9860('0x1d')](handleError(_0x52fc36,null));};exports[_0x9860('0xe0')]=function(_0x3a21b9,_0xe255b2){var _0x596696={'raw':!![],'where':{}};var _0x484b90={};var _0x47033d={'count':0x0,'rows':[]};return db[_0x9860('0x3a')][_0x9860('0x9b')]({'where':{'id':_0x3a21b9['params']['id']}})[_0x9860('0x14')](handleEntityNotFound(_0xe255b2,null))[_0x9860('0x14')](function(_0x1623e6){if(_0x1623e6){_0x484b90[_0x9860('0x55')]=_[_0x9860('0x57')](db[_0x9860('0xe1')][_0x9860('0x3b')]);_0x484b90[_0x9860('0x43')]=_[_0x9860('0x57')](_0x3a21b9['query']);_0x484b90[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x484b90[_0x9860('0x55')],_0x484b90[_0x9860('0x43')]);_0x596696['attributes']=_[_0x9860('0x58')](_0x484b90[_0x9860('0x55')],qs[_0x9860('0x59')](_0x3a21b9[_0x9860('0x43')][_0x9860('0x59')]));_0x596696['attributes']=_0x596696[_0x9860('0x48')][_0x9860('0x5a')]?_0x596696[_0x9860('0x48')]:_0x484b90['model'];if(!_0x3a21b9[_0x9860('0x43')]['hasOwnProperty']('nolimit')){_0x596696[_0x9860('0x24')]=qs[_0x9860('0x24')](_0x3a21b9['query'][_0x9860('0x24')]);_0x596696[_0x9860('0x23')]=qs['offset'](_0x3a21b9[_0x9860('0x43')][_0x9860('0x23')]);}_0x596696[_0x9860('0xd5')]=qs[_0x9860('0xd6')](_0x3a21b9[_0x9860('0x43')][_0x9860('0xd6')]);_0x596696[_0x9860('0x42')]=qs['filters'](_['pick'](_0x3a21b9[_0x9860('0x43')],_0x484b90[_0x9860('0xd4')]));_0x596696['where'][_0x9860('0xe2')]=_0x1623e6['id'];if(_0x3a21b9['query'][_0x9860('0x2f')]){_0x596696[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x596696['where'],{'$or':_['map'](_0x596696['attributes'],function(_0x350ced){var _0xca7e20={};_0xca7e20[_0x350ced]={'$like':'%'+_0x3a21b9['query']['filter']+'%'};return _0xca7e20;})});}_0x596696=_[_0x9860('0x5b')]({},_0x596696,_0x3a21b9[_0x9860('0x5c')]);return db[_0x9860('0xe1')]['count']({'where':_0x596696[_0x9860('0x42')]})[_0x9860('0x14')](function(_0x3e17e5){_0x47033d[_0x9860('0x22')]=_0x3e17e5;if(_0x3a21b9['query'][_0x9860('0x44')]){_0x596696[_0x9860('0x45')]=[{'all':!![]}];}return db[_0x9860('0xe1')]['findAll'](_0x596696);})[_0x9860('0x14')](function(_0x5ba930){_0x47033d[_0x9860('0x49')]=_0x5ba930;return _0x47033d;});}})[_0x9860('0x14')](respondWithFilteredResult(_0xe255b2,_0x596696))['catch'](handleError(_0xe255b2,null));};exports[_0x9860('0xe3')]=function(_0x40245f,_0x2dee81){var _0x1763ce={};var _0x552e49={};var _0x46c685;var _0x55bb07;return db['User'][_0x9860('0x9b')]({'where':{'id':_0x40245f[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x2dee81,null))[_0x9860('0x14')](function(_0x449393){if(_0x449393){_0x46c685=_0x449393;_0x552e49[_0x9860('0x55')]=_[_0x9860('0x57')](db['ChatInteraction'][_0x9860('0x3b')]);_0x552e49[_0x9860('0x43')]=_[_0x9860('0x57')](_0x40245f[_0x9860('0x43')]);_0x552e49[_0x9860('0xd4')]=_['intersection'](_0x552e49[_0x9860('0x55')],_0x552e49[_0x9860('0x43')]);_0x1763ce[_0x9860('0x48')]=_[_0x9860('0x58')](_0x552e49[_0x9860('0x55')],qs['fields'](_0x40245f[_0x9860('0x43')][_0x9860('0x59')]));_0x1763ce[_0x9860('0x48')]=_0x1763ce['attributes']['length']?_0x1763ce['attributes']:_0x552e49['model'];_0x1763ce['order']=qs[_0x9860('0xd6')](_0x40245f[_0x9860('0x43')][_0x9860('0xd6')]);_0x1763ce[_0x9860('0x42')]=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0x40245f['query'],_0x552e49[_0x9860('0xd4')]));if(_0x40245f['query']['filter']){_0x1763ce[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x1763ce[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0x1763ce[_0x9860('0x48')],function(_0x91a255){var _0x5ad0cb={};_0x5ad0cb[_0x91a255]={'$like':'%'+_0x40245f['query']['filter']+'%'};return _0x5ad0cb;})});}_0x1763ce=_[_0x9860('0x5b')]({},_0x1763ce,_0x40245f['options']);return _0x46c685[_0x9860('0xe3')](_0x1763ce);}})[_0x9860('0x14')](function(_0x3426d0){if(_0x3426d0){_0x55bb07=_0x3426d0[_0x9860('0x5a')];if(!_0x40245f[_0x9860('0x43')][_0x9860('0xd9')](_0x9860('0xda'))){_0x1763ce['limit']=qs[_0x9860('0x24')](_0x40245f['query']['limit']);_0x1763ce[_0x9860('0x23')]=qs[_0x9860('0x23')](_0x40245f['query'][_0x9860('0x23')]);}return _0x46c685[_0x9860('0xe3')](_0x1763ce);}})['then'](function(_0x3a9fb8){if(_0x3a9fb8){return _0x3a9fb8?{'count':_0x55bb07,'rows':_0x3a9fb8}:null;}})['then'](respondWithResult(_0x2dee81,null))[_0x9860('0x1d')](handleError(_0x2dee81,null));};exports[_0x9860('0xe4')]=function(_0x3e8d23,_0x20c009){var _0x46eb70={};var _0x40238c={};var _0x549b76;var _0x22eedc;return db[_0x9860('0x3a')][_0x9860('0x9b')]({'where':{'id':_0x3e8d23[_0x9860('0x54')]['id']}})['then'](handleEntityNotFound(_0x20c009,null))[_0x9860('0x14')](function(_0x4ec38c){if(_0x4ec38c){_0x549b76=_0x4ec38c;_0x40238c[_0x9860('0x55')]=_[_0x9860('0x57')](db[_0x9860('0xe5')][_0x9860('0x3b')]);_0x40238c[_0x9860('0x43')]=_[_0x9860('0x57')](_0x3e8d23[_0x9860('0x43')]);_0x40238c[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x40238c[_0x9860('0x55')],_0x40238c['query']);_0x46eb70[_0x9860('0x48')]=_[_0x9860('0x58')](_0x40238c[_0x9860('0x55')],qs['fields'](_0x3e8d23[_0x9860('0x43')][_0x9860('0x59')]));_0x46eb70[_0x9860('0x48')]=_0x46eb70['attributes'][_0x9860('0x5a')]?_0x46eb70[_0x9860('0x48')]:_0x40238c[_0x9860('0x55')];_0x46eb70[_0x9860('0xd5')]=qs[_0x9860('0xd6')](_0x3e8d23['query'][_0x9860('0xd6')]);_0x46eb70[_0x9860('0x42')]=qs[_0x9860('0xd4')](_['pick'](_0x3e8d23[_0x9860('0x43')],_0x40238c['filters']));if(_0x3e8d23['query']['filter']){_0x46eb70[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x46eb70[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0x46eb70['attributes'],function(_0x144386){var _0x579a4b={};_0x579a4b[_0x144386]={'$like':'%'+_0x3e8d23['query']['filter']+'%'};return _0x579a4b;})});}_0x46eb70=_[_0x9860('0x5b')]({},_0x46eb70,_0x3e8d23[_0x9860('0x5c')]);return _0x549b76['getOpenchannelInteractions'](_0x46eb70);}})[_0x9860('0x14')](function(_0x8a03e5){if(_0x8a03e5){_0x22eedc=_0x8a03e5[_0x9860('0x5a')];if(!_0x3e8d23[_0x9860('0x43')][_0x9860('0xd9')](_0x9860('0xda'))){_0x46eb70[_0x9860('0x24')]=qs[_0x9860('0x24')](_0x3e8d23[_0x9860('0x43')][_0x9860('0x24')]);_0x46eb70[_0x9860('0x23')]=qs['offset'](_0x3e8d23[_0x9860('0x43')]['offset']);}return _0x549b76[_0x9860('0xe4')](_0x46eb70);}})['then'](function(_0x240452){if(_0x240452){return _0x240452?{'count':_0x22eedc,'rows':_0x240452}:null;}})['then'](respondWithResult(_0x20c009,null))[_0x9860('0x1d')](handleError(_0x20c009,null));};exports[_0x9860('0xe6')]=function(_0x38ebbb,_0x5d8652){var _0xbb5f21={'raw':!![],'where':{}};var _0x1fd77d={};var _0x376fff={'count':0x0,'rows':[]};return db[_0x9860('0x3a')]['findOne']({'where':{'id':_0x38ebbb['params']['id']}})['then'](handleEntityNotFound(_0x5d8652,null))[_0x9860('0x14')](function(_0x1bfa73){if(_0x1bfa73){_0x1fd77d[_0x9860('0x55')]=_[_0x9860('0x57')](db['MailInteraction'][_0x9860('0x3b')]);_0x1fd77d[_0x9860('0x43')]=_['keys'](_0x38ebbb[_0x9860('0x43')]);_0x1fd77d[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x1fd77d[_0x9860('0x55')],_0x1fd77d[_0x9860('0x43')]);_0xbb5f21[_0x9860('0x48')]=_['intersection'](_0x1fd77d[_0x9860('0x55')],qs[_0x9860('0x59')](_0x38ebbb[_0x9860('0x43')]['fields']));_0xbb5f21[_0x9860('0x48')]=_0xbb5f21[_0x9860('0x48')]['length']?_0xbb5f21[_0x9860('0x48')]:_0x1fd77d[_0x9860('0x55')];if(!_0x38ebbb[_0x9860('0x43')][_0x9860('0xd9')](_0x9860('0xda'))){_0xbb5f21[_0x9860('0x24')]=qs[_0x9860('0x24')](_0x38ebbb[_0x9860('0x43')][_0x9860('0x24')]);_0xbb5f21[_0x9860('0x23')]=qs[_0x9860('0x23')](_0x38ebbb[_0x9860('0x43')][_0x9860('0x23')]);}_0xbb5f21[_0x9860('0xd5')]=qs['sort'](_0x38ebbb['query'][_0x9860('0xd6')]);_0xbb5f21[_0x9860('0x42')]=qs[_0x9860('0xd4')](_['pick'](_0x38ebbb[_0x9860('0x43')],_0x1fd77d[_0x9860('0xd4')]));_0xbb5f21['where']['UserId']=_0x1bfa73['id'];if(_0x38ebbb[_0x9860('0x43')][_0x9860('0x2f')]){_0xbb5f21['where']=_['merge'](_0xbb5f21[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0xbb5f21[_0x9860('0x48')],function(_0x2eb897){var _0x3bc341={};_0x3bc341[_0x2eb897]={'$like':'%'+_0x38ebbb[_0x9860('0x43')][_0x9860('0x2f')]+'%'};return _0x3bc341;})});}_0xbb5f21=_[_0x9860('0x5b')]({},_0xbb5f21,_0x38ebbb[_0x9860('0x5c')]);return db[_0x9860('0xe7')][_0x9860('0x22')]({'where':_0xbb5f21[_0x9860('0x42')]})['then'](function(_0x5e1aa3){_0x376fff[_0x9860('0x22')]=_0x5e1aa3;if(_0x38ebbb[_0x9860('0x43')][_0x9860('0x44')]){_0xbb5f21[_0x9860('0x45')]=[{'all':!![]}];}return db[_0x9860('0xe7')][_0x9860('0x8f')](_0xbb5f21);})[_0x9860('0x14')](function(_0x4ee102){_0x376fff[_0x9860('0x49')]=_0x4ee102;return _0x376fff;});}})['then'](respondWithFilteredResult(_0x5d8652,_0xbb5f21))['catch'](handleError(_0x5d8652,null));};exports[_0x9860('0xe8')]=function(_0xf51f64,_0x4fa145){var _0x587b05={};var _0x48ce16={};var _0x194690;var _0x455945;return db[_0x9860('0x3a')]['findOne']({'where':{'id':_0xf51f64[_0x9860('0x54')]['id']}})['then'](handleEntityNotFound(_0x4fa145,null))[_0x9860('0x14')](function(_0x5d5648){if(_0x5d5648){_0x194690=_0x5d5648;_0x48ce16[_0x9860('0x55')]=_[_0x9860('0x57')](db[_0x9860('0xe9')][_0x9860('0x3b')]);_0x48ce16[_0x9860('0x43')]=_[_0x9860('0x57')](_0xf51f64[_0x9860('0x43')]);_0x48ce16[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x48ce16[_0x9860('0x55')],_0x48ce16[_0x9860('0x43')]);_0x587b05[_0x9860('0x48')]=_[_0x9860('0x58')](_0x48ce16[_0x9860('0x55')],qs[_0x9860('0x59')](_0xf51f64[_0x9860('0x43')][_0x9860('0x59')]));_0x587b05[_0x9860('0x48')]=_0x587b05[_0x9860('0x48')][_0x9860('0x5a')]?_0x587b05[_0x9860('0x48')]:_0x48ce16['model'];_0x587b05['order']=qs[_0x9860('0xd6')](_0xf51f64[_0x9860('0x43')][_0x9860('0xd6')]);_0x587b05[_0x9860('0x42')]=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0xf51f64[_0x9860('0x43')],_0x48ce16['filters']));if(_0xf51f64[_0x9860('0x43')]['filter']){_0x587b05[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x587b05['where'],{'$or':_[_0x9860('0x31')](_0x587b05[_0x9860('0x48')],function(_0x39976f){var _0x58784b={};_0x58784b[_0x39976f]={'$like':'%'+_0xf51f64['query'][_0x9860('0x2f')]+'%'};return _0x58784b;})});}_0x587b05=_[_0x9860('0x5b')]({},_0x587b05,_0xf51f64['options']);return _0x194690['getSmsInteractions'](_0x587b05);}})[_0x9860('0x14')](function(_0xcb24fb){if(_0xcb24fb){_0x455945=_0xcb24fb[_0x9860('0x5a')];if(!_0xf51f64['query'][_0x9860('0xd9')](_0x9860('0xda'))){_0x587b05[_0x9860('0x24')]=qs[_0x9860('0x24')](_0xf51f64[_0x9860('0x43')]['limit']);_0x587b05[_0x9860('0x23')]=qs[_0x9860('0x23')](_0xf51f64[_0x9860('0x43')][_0x9860('0x23')]);}return _0x194690[_0x9860('0xe8')](_0x587b05);}})[_0x9860('0x14')](function(_0x2e1b22){if(_0x2e1b22){return _0x2e1b22?{'count':_0x455945,'rows':_0x2e1b22}:null;}})[_0x9860('0x14')](respondWithResult(_0x4fa145,null))['catch'](handleError(_0x4fa145,null));};exports['getFaxInteractions']=function(_0x4ba71e,_0x322f27){var _0x351ae2={};var _0x57da8f={};var _0x551e3d;var _0x54c042;return db['User']['findOne']({'where':{'id':_0x4ba71e[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x322f27,null))['then'](function(_0x2abb24){if(_0x2abb24){_0x551e3d=_0x2abb24;_0x57da8f[_0x9860('0x55')]=_['keys'](db[_0x9860('0xea')][_0x9860('0x3b')]);_0x57da8f['query']=_['keys'](_0x4ba71e['query']);_0x57da8f['filters']=_[_0x9860('0x58')](_0x57da8f['model'],_0x57da8f['query']);_0x351ae2[_0x9860('0x48')]=_[_0x9860('0x58')](_0x57da8f[_0x9860('0x55')],qs['fields'](_0x4ba71e['query'][_0x9860('0x59')]));_0x351ae2[_0x9860('0x48')]=_0x351ae2['attributes'][_0x9860('0x5a')]?_0x351ae2['attributes']:_0x57da8f[_0x9860('0x55')];_0x351ae2[_0x9860('0xd5')]=qs[_0x9860('0xd6')](_0x4ba71e['query'][_0x9860('0xd6')]);_0x351ae2['where']=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0x4ba71e[_0x9860('0x43')],_0x57da8f[_0x9860('0xd4')]));if(_0x4ba71e[_0x9860('0x43')][_0x9860('0x2f')]){_0x351ae2[_0x9860('0x42')]=_['merge'](_0x351ae2['where'],{'$or':_[_0x9860('0x31')](_0x351ae2[_0x9860('0x48')],function(_0x3ac0f0){var _0x262189={};_0x262189[_0x3ac0f0]={'$like':'%'+_0x4ba71e['query']['filter']+'%'};return _0x262189;})});}_0x351ae2=_[_0x9860('0x5b')]({},_0x351ae2,_0x4ba71e[_0x9860('0x5c')]);return _0x551e3d[_0x9860('0xeb')](_0x351ae2);}})[_0x9860('0x14')](function(_0x34c6a3){if(_0x34c6a3){_0x54c042=_0x34c6a3['length'];if(!_0x4ba71e['query'][_0x9860('0xd9')](_0x9860('0xda'))){_0x351ae2[_0x9860('0x24')]=qs[_0x9860('0x24')](_0x4ba71e['query'][_0x9860('0x24')]);_0x351ae2['offset']=qs['offset'](_0x4ba71e[_0x9860('0x43')][_0x9860('0x23')]);}return _0x551e3d[_0x9860('0xeb')](_0x351ae2);}})['then'](function(_0x28e3af){if(_0x28e3af){return _0x28e3af?{'count':_0x54c042,'rows':_0x28e3af}:null;}})[_0x9860('0x14')](respondWithResult(_0x322f27,null))[_0x9860('0x1d')](handleError(_0x322f27,null));};exports[_0x9860('0xec')]=function(_0x332e94,_0x172f35){var _0x517b71={};var _0x21d003={};var _0x475cde;var _0x4b7fd6;return db[_0x9860('0x3a')]['findOne']({'where':{'id':_0x332e94[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x172f35,null))[_0x9860('0x14')](function(_0x53f4f8){if(_0x53f4f8){_0x475cde=_0x53f4f8;_0x21d003[_0x9860('0x55')]=_[_0x9860('0x57')](db['WhatsappInteraction'][_0x9860('0x3b')]);_0x21d003['query']=_['keys'](_0x332e94['query']);_0x21d003[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x21d003[_0x9860('0x55')],_0x21d003['query']);_0x517b71[_0x9860('0x48')]=_[_0x9860('0x58')](_0x21d003['model'],qs[_0x9860('0x59')](_0x332e94['query'][_0x9860('0x59')]));_0x517b71[_0x9860('0x48')]=_0x517b71['attributes']['length']?_0x517b71[_0x9860('0x48')]:_0x21d003[_0x9860('0x55')];_0x517b71[_0x9860('0xd5')]=qs[_0x9860('0xd6')](_0x332e94['query'][_0x9860('0xd6')]);_0x517b71[_0x9860('0x42')]=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0x332e94[_0x9860('0x43')],_0x21d003[_0x9860('0xd4')]));if(_0x332e94['query'][_0x9860('0x2f')]){_0x517b71[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x517b71[_0x9860('0x42')],{'$or':_['map'](_0x517b71[_0x9860('0x48')],function(_0x3da88c){var _0x5ce53b={};_0x5ce53b[_0x3da88c]={'$like':'%'+_0x332e94[_0x9860('0x43')][_0x9860('0x2f')]+'%'};return _0x5ce53b;})});}_0x517b71=_[_0x9860('0x5b')]({},_0x517b71,_0x332e94[_0x9860('0x5c')]);return _0x475cde[_0x9860('0xec')](_0x517b71);}})[_0x9860('0x14')](function(_0x2bb708){if(_0x2bb708){_0x4b7fd6=_0x2bb708[_0x9860('0x5a')];if(!_0x332e94['query'][_0x9860('0xd9')](_0x9860('0xda'))){_0x517b71['limit']=qs[_0x9860('0x24')](_0x332e94[_0x9860('0x43')]['limit']);_0x517b71[_0x9860('0x23')]=qs[_0x9860('0x23')](_0x332e94[_0x9860('0x43')][_0x9860('0x23')]);}return _0x475cde[_0x9860('0xec')](_0x517b71);}})[_0x9860('0x14')](function(_0x595706){if(_0x595706){return _0x595706?{'count':_0x4b7fd6,'rows':_0x595706}:null;}})['then'](respondWithResult(_0x172f35,null))[_0x9860('0x1d')](handleError(_0x172f35,null));};exports[_0x9860('0xed')]=function(_0x467616,_0x56ebd8,_0xbd23db){var _0x331251;var _0x320085;var _0x212222;var _0x2f0071=!_[_0x9860('0x6a')](_0x467616[_0x9860('0x54')]['id'])?_0x467616[_0x9860('0x54')]['id']:!_['isNil'](_0x467616[_0x9860('0x2c')]['id'])?_0x467616[_0x9860('0x2c')]['id']:null;return db[_0x9860('0x3a')][_0x9860('0x5d')]({'where':{'id':_0x2f0071,'role':{'$or':[_0x9860('0x2b'),_0x9860('0x2c'),_0x9860('0x74')]}},'attributes':['id',_0x9860('0x37'),_0x9860('0xee'),_0x9860('0xef'),_0x9860('0x27'),_0x9860('0x64'),_0x9860('0xa3')]})['then'](function(_0x28c96d){if(_0x28c96d){if(_0x28c96d[_0x9860('0x27')]==='agent'){_0x331251=_0x28c96d;if(_0x467616['body'][_0x9860('0xa5')]){_0x212222=util[_0x9860('0xcd')]('LOCAL/%s@from-sip/n',_0x331251[_0x467616[_0x9860('0x5f')][_0x9860('0xa5')]]);}else if(_0x467616[_0x9860('0x5f')]['intrf']){_0x212222=util[_0x9860('0xcd')](_0x9860('0xaf'),_0x467616[_0x9860('0x5f')][_0x9860('0xf0')]);}else{_0x212222=util[_0x9860('0xcd')]('SIP/%s',_0x331251[_0x9860('0x37')]);}socket['to'](util[_0x9860('0xcd')](_0x9860('0xf1'),_0x331251[_0x9860('0x37')]))[_0x9860('0x28')]('user:forcelogout',{'user':{'id':_0x331251['id'],'name':_0x331251[_0x9860('0x37')]},'ip':_0x467616[_0x9860('0xf2')]['x-forwarded-for']||_0x467616['connection'][_0x9860('0xf3')]||_0x467616['socket'][_0x9860('0xf3')]||_0x467616[_0x9860('0xf4')][_0x9860('0xf5')][_0x9860('0xf3')]});return db[_0x9860('0xb3')][_0x9860('0x35')]({'where':{'membername':_0x331251[_0x9860('0x37')]},'individualHooks':!![]});}}else{throw new db[(_0x9860('0x93'))][(_0x9860('0x94'))](_0x9860('0xf6'));}})['then'](function(){if(_0x331251){return _0x331251[_0x9860('0xf7')]({'raw':!![]});}})[_0x9860('0x14')](function(_0xdd1adc){if(_0x331251){if(_0xdd1adc){_0x320085=_0xdd1adc;if(_0x320085[_0x9860('0x5a')]){var _0x37e37f=_0x320085[_0x9860('0x31')](function(_0x3f8871){var _0x1a42b4={'membername':_0x331251[_0x9860('0x37')],'UserId':_0x331251['id'],'queue_name':_0x3f8871[_0x9860('0x37')],'VoiceQueueId':_0x3f8871['id'],'interface':_0x212222,'paused':_0x331251[_0x9860('0xa3')]||![],'penalty':_0x3f8871[_0x9860('0xf8')]||0x0};return db[_0x9860('0xb3')][_0x9860('0xf9')](_0x1a42b4);});return Promise[_0x9860('0x52')](_0x37e37f);}}}})[_0x9860('0x14')](function(){if(_0x331251){return db['MemberReport'][_0x9860('0x8f')]({'where':{'membername':_0x331251[_0x9860('0x37')],'exitAt':null}});}})[_0x9860('0x14')](function(_0xe83257){if(_0x331251){var _0x3c1c1f=[];_0xe83257[_0x9860('0xfa')](function(_0x196d4e){_0x3c1c1f[_0x9860('0x4b')](_0x196d4e[_0x9860('0x5e')]({'exitAt':moment()['format'](_0x9860('0xfb'))}));});return Promise[_0x9860('0x52')](_0x3c1c1f);}})[_0x9860('0x14')](function(){if(_0x331251){var _0x2b8500=[];var _0xcdeb38=[];var _0x5f3348=utils['getChannels']();var _0x39fc04={'membername':_0x331251[_0x9860('0x37')],'interface':_0x212222,'enterAt':moment()[_0x9860('0xcd')](_0x9860('0xfb')),'role':_0x331251['role'],'internal':_0x331251['internal']};_0x5f3348['forEach'](function(_0x1279a5){_0x2b8500['push'](_[_0x9860('0x5b')]({'channel':_0x1279a5,'type':_0x9860('0xfc'),'data1':_0x467616[_0x9860('0x5f')][_0x9860('0xfd')],'data2':_0x212222},_0x39fc04));if(_0x331251[_0x9860('0xa3')]){_0xcdeb38[_0x9860('0x4b')](_[_0x9860('0x5b')]({'channel':_0x1279a5,'type':_0x9860('0xfe'),'data1':'LOGININPAUSE'},_0x39fc04));}});return db[_0x9860('0xff')]['bulkCreate'](_0x2b8500[_0x9860('0xcc')](_0xcdeb38),{'individualHooks':!![]});}})[_0x9860('0x14')](function(){if(_0x331251){return _0x331251[_0x9860('0x5e')]({'online':!![],'lastLoginAt':moment()[_0x9860('0xcd')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x331251['loginInPause']||![],'mailPause':_0x331251[_0x9860('0xa3')]||![],'chatPause':_0x331251[_0x9860('0xa3')]||![],'faxPause':_0x331251[_0x9860('0xa3')]||![],'smsPause':_0x331251[_0x9860('0xa3')]||![],'openchannelPause':_0x331251[_0x9860('0xa3')]||![],'whatsappPause':_0x331251['loginInPause']||![],'pauseType':_0x331251['loginInPause']?_0x9860('0x100'):null,'interface':_0x212222,'lastPauseAt':moment()[_0x9860('0xcd')](_0x9860('0xfb'))});}})[_0x9860('0x14')](function(_0x1a3294){if(_0x467616['isMiddleware']){return _0xbd23db();}else{return Promise[_0x9860('0x101')](_0x1a3294)[_0x9860('0x14')](respondWithResult(_0x56ebd8,null));}})['catch'](handleError(_0x56ebd8,null));};exports[_0x9860('0x102')]=function(_0x25d553,_0x1bfc66){var _0x5950b1;return db[_0x9860('0x3a')][_0x9860('0x5d')]({'where':{'id':_0x25d553[_0x9860('0x54')]['id'],'role':_0x9860('0x74')},'attributes':['id',_0x9860('0x37'),_0x9860('0x27')]})[_0x9860('0x14')](handleEntityNotFound(_0x1bfc66,null))[_0x9860('0x14')](function(_0x36a1b6){if(_0x36a1b6){_0x5950b1=_0x36a1b6;return db[_0x9860('0xb3')][_0x9860('0x35')]({'where':{'membername':_0x5950b1[_0x9860('0x37')]},'individualHooks':!![]});}})[_0x9860('0x14')](function(){return db[_0x9860('0xff')][_0x9860('0x8f')]({'where':{'membername':_0x5950b1[_0x9860('0x37')],'exitAt':null}});})[_0x9860('0x14')](function(_0x29cf62){var _0x3faf08=[];_0x29cf62[_0x9860('0xfa')](function(_0xbeff25){_0x3faf08[_0x9860('0x4b')](_0xbeff25['update']({'exitAt':moment()[_0x9860('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x9860('0x52')](_0x3faf08);})[_0x9860('0x14')](function(){return _0x5950b1[_0x9860('0x5e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x9860('0x14')](respondWithResult(_0x1bfc66,null))['catch'](handleError(_0x1bfc66,null));};exports[_0x9860('0x103')]=function(_0x50d171,_0x1fb645){var _0x1babb2;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x50d171['params']['id']},'individualHooks':!![]})[_0x9860('0x14')](function(){return db['User'][_0x9860('0x5d')]({'where':{'id':_0x50d171[_0x9860('0x54')]['id'],'role':'agent'},'attributes':['id',_0x9860('0x37'),'role',_0x9860('0x64'),_0x9860('0xa5'),_0x9860('0xa2')]});})['then'](handleEntityNotFound(_0x1fb645,null))[_0x9860('0x14')](function(_0x544803){if(_0x544803){_0x1babb2=_0x544803;return respondWithRpcPromise(_0x9860('0x104'),_0x9860('0x103'),{'id':_0x1babb2['id'],'name':_0x1babb2[_0x9860('0x37')],'pause':!![]});}})['then'](function(){if(_0x1babb2){return db[_0x9860('0xff')][_0x9860('0x8f')]({'where':{'membername':_0x1babb2[_0x9860('0x37')],'type':_0x9860('0xfe'),'exitAt':null}});}})['then'](function(_0x333566){if(_0x333566[_0x9860('0x5a')]){var _0x2ecd2b=moment()[_0x9860('0xcd')](_0x9860('0xfb'));for(var _0x265791=0x0,_0x53f040=_0x333566[_0x9860('0x5a')];_0x265791<_0x53f040;_0x265791++){_0x333566[_0x265791][_0x9860('0x105')]({'exitAt':_0x2ecd2b});}}})[_0x9860('0x14')](function(){var _0x9caab=[];var _0x4ea078=utils[_0x9860('0x106')]();_0x4ea078[_0x9860('0xfa')](function(_0x324675){_0x9caab['push']({'channel':_0x324675,'membername':_0x1babb2['name'],'interface':_['isNil'](_0x1babb2[_0x9860('0xa5')])?util[_0x9860('0xcd')]('SIP/%s',_0x1babb2[_0x9860('0x37')]):_0x1babb2[_0x9860('0xa5')],'type':'PAUSE','enterAt':moment()[_0x9860('0xcd')](_0x9860('0xfb')),'data1':_0x50d171[_0x9860('0x5f')][_0x9860('0x3d')]||_0x9860('0x107'),'role':_0x1babb2[_0x9860('0x27')],'internal':_0x1babb2['internal']});});return db[_0x9860('0xff')][_0x9860('0x8b')](_0x9caab,{'individualHooks':!![]});})[_0x9860('0x14')](function(){return _0x1babb2[_0x9860('0x5e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x50d171[_0x9860('0x5f')][_0x9860('0x3d')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0x9860('0xfb'))});})['then'](respondWithResult(_0x1fb645,null))['catch'](handleError(_0x1fb645,null));};exports[_0x9860('0x108')]=function(_0x3e8e82,_0x368226){if(_0x3e8e82[_0x9860('0x5f')][_0x9860('0xa1')]&&!utils['isValidChannel'](_0x3e8e82[_0x9860('0x5f')][_0x9860('0xa1')])){throw new APIBadRequestError(util[_0x9860('0xcd')](_0x9860('0x109'),_0x3e8e82[_0x9860('0x5f')][_0x9860('0xa1')]));}return db[_0x9860('0x3a')]['find']({'where':{'id':_0x3e8e82[_0x9860('0x54')]['id']},'attributes':['id',_0x9860('0x37'),_0x9860('0x27'),_0x9860('0x64'),'interface',_0x9860('0xa2'),'voicePause','mailPause',_0x9860('0x10a'),_0x9860('0x10b'),_0x9860('0x10c'),_0x9860('0x10d'),_0x9860('0x10e'),_0x9860('0x10f'),_0x9860('0x110')]})[_0x9860('0x14')](function(_0x1462bf){if(!_0x1462bf){throw new APINotFoundError(util[_0x9860('0xcd')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3e8e82[_0x9860('0x54')]['id']));}return _0x1462bf[_0x9860('0x108')](_0x3e8e82[_0x9860('0x5f')][_0x9860('0xa1')]);})[_0x9860('0x14')](respondWithResult(_0x368226,null))[_0x9860('0x1d')](APIHandleError(_0x368226));};exports[_0x9860('0x111')]=function(_0x51160c,_0x3305ee){var _0x50daed={};var _0x4c241d={};var _0x5a8220;var _0x1d5067;return db[_0x9860('0x3a')][_0x9860('0x9b')]({'where':{'id':_0x51160c['params']['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x3305ee,null))[_0x9860('0x14')](function(_0x2a2198){if(_0x2a2198){_0x5a8220=_0x2a2198;_0x4c241d[_0x9860('0x55')]=_[_0x9860('0x57')](db[_0x9860('0x112')]['rawAttributes']);_0x4c241d['query']=_['keys'](_0x51160c[_0x9860('0x43')]);_0x4c241d['filters']=_['intersection'](_0x4c241d[_0x9860('0x55')],_0x4c241d[_0x9860('0x43')]);_0x50daed[_0x9860('0x48')]=_[_0x9860('0x58')](_0x4c241d[_0x9860('0x55')],qs['fields'](_0x51160c[_0x9860('0x43')][_0x9860('0x59')]));_0x50daed['attributes']=_0x50daed[_0x9860('0x48')]['length']?_0x50daed[_0x9860('0x48')]:_0x4c241d[_0x9860('0x55')];_0x50daed[_0x9860('0xd5')]=qs[_0x9860('0xd6')](_0x51160c[_0x9860('0x43')][_0x9860('0xd6')]);_0x50daed['where']=qs['filters'](_[_0x9860('0xd7')](_0x51160c['query'],_0x4c241d['filters']));if(_0x51160c[_0x9860('0x43')][_0x9860('0x2f')]){_0x50daed[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x50daed[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0x50daed[_0x9860('0x48')],function(_0x1af20d){var _0x1f7531={};_0x1f7531[_0x1af20d]={'$like':'%'+_0x51160c[_0x9860('0x43')][_0x9860('0x2f')]+'%'};return _0x1f7531;})});}_0x50daed=_[_0x9860('0x5b')]({},_0x50daed,_0x51160c[_0x9860('0x5c')]);return _0x5a8220['getTeams'](_0x50daed);}})[_0x9860('0x14')](function(_0x332be3){if(_0x332be3){_0x1d5067=_0x332be3['length'];if(!_0x51160c[_0x9860('0x43')]['hasOwnProperty'](_0x9860('0xda'))){_0x50daed['limit']=qs['limit'](_0x51160c[_0x9860('0x43')][_0x9860('0x24')]);_0x50daed['offset']=qs[_0x9860('0x23')](_0x51160c[_0x9860('0x43')][_0x9860('0x23')]);}return _0x5a8220['getTeams'](_0x50daed);}})['then'](function(_0x5ee515){if(_0x5ee515){return _0x5ee515?{'count':_0x1d5067,'rows':_0x5ee515}:null;}})[_0x9860('0x14')](respondWithResult(_0x3305ee,null))[_0x9860('0x1d')](handleError(_0x3305ee,null));};exports[_0x9860('0x113')]=function(_0x6d5cb6,_0xcc3895){var _0x29016a=_0x6d5cb6[_0x9860('0x54')]['id'];var _0x4c7929=_0x6d5cb6['body']?_0x6d5cb6[_0x9860('0x5f')]['ids']:null;var _0x45c691=[];return Promise[_0x9860('0x101')]()[_0x9860('0x14')](function(){if(!_0x4c7929)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x9860('0x14')](function(){return db['User'][_0x9860('0x9b')]({'where':{'id':_0x29016a}});})[_0x9860('0x14')](function(_0x25a30a){if(!_0x25a30a)throw new APINotFoundError(util['format'](_0x9860('0x114'),_0x6d5cb6[_0x9860('0x54')]['id']));return db['sequelize'][_0x9860('0x115')](function(_0x59cf87){return _0x25a30a[_0x9860('0x113')](_0x4c7929,{'transaction':_0x59cf87})[_0x9860('0x14')](function(){return db['Team'][_0x9860('0x8f')]({'where':{'id':{'$in':_0x4c7929}}});})[_0x9860('0x14')](function(_0x430847){var _0x1b3e58=_[_0x9860('0x31')](_0x430847,function(_0x25ce83){return _0x25ce83['getAssociatedQueues']();});return Promise[_0x9860('0x52')](_0x1b3e58);})[_0x9860('0x14')](function(_0x2ab8ca){_0x45c691=_[_0x9860('0x116')](_0x2ab8ca);var _0xa335e5=_[_0x9860('0x31')](_0x45c691,function(_0x120a66){return _0x120a66[_0x9860('0x117')](_0x25a30a['id'],{'transaction':_0x59cf87});});return Promise[_0x9860('0x52')](_0xa335e5);})['then'](function(){if(!_0x25a30a['online'])return;var _0x576f9c=_[_0x9860('0x2f')](_0x45c691,function(_0x206ede){return _0x206ede[_0x9860('0x118')](_0x9860('0xa1'))===_0x9860('0x119');});var _0x7fe600=_[_0x9860('0x31')](_0x576f9c,function(_0x150c79){return db['UserVoiceQueueRt'][_0x9860('0xf9')]({'membername':_0x25a30a['name'],'UserId':_0x25a30a['id'],'queue_name':_0x150c79[_0x9860('0x37')],'VoiceQueueId':_0x150c79['id'],'interface':_[_0x9860('0x6a')](_0x25a30a[_0x9860('0xa5')])?util[_0x9860('0xcd')](_0x9860('0xaf'),_0x25a30a[_0x9860('0x37')]):_0x25a30a[_0x9860('0xa5')],'paused':_0x25a30a['voicePause']||![],'penalty':_0x25a30a[_0x9860('0xb0')]},{'transaction':_0x59cf87});});return Promise[_0x9860('0x52')](_0x7fe600);})[_0x9860('0x14')](function(){return db[_0x9860('0x11a')][_0x9860('0x8f')]({'where':{'teamId':{'$in':_0x4c7929}}});})[_0x9860('0x14')](function(_0x126aa9){var _0x58c503=_[_0x9860('0x31')](_0x126aa9,function(_0xfeafe9){return db[_0x9860('0x11b')][_0x9860('0x82')]({'UserId':_0x25a30a['id'],'VoicePrefixId':_0xfeafe9[_0x9860('0x11c')]},{'transaction':_0x59cf87});});return Promise[_0x9860('0x52')](_0x58c503);});});})[_0x9860('0x14')](function(){for(var _0x3e7777=0x0;_0x3e7777<_0x45c691[_0x9860('0x5a')];_0x3e7777++){var _0x897ad4=_0x45c691[_0x3e7777][_0x9860('0x118')]('channel');var _0x2eac9a=_0x897ad4+_0x9860('0xb1');socket[_0x9860('0x28')](_0x9860('0x2c')+_0x897ad4+_0x9860('0xad'),{'UserId':_0x29016a,['queueField']:_0x45c691[_0x3e7777]['id']});}})[_0x9860('0x14')](respondWithStatusCode(_0xcc3895,null))[_0x9860('0x1d')](APIHandleError(_0xcc3895));};exports[_0x9860('0x11d')]=function(_0x5ec06c,_0x1f1e6f){var _0x57cdf0=_0x5ec06c[_0x9860('0x54')]['id'];var _0x29f932=null;if(_0x5ec06c['query'][_0x9860('0x62')]){_0x29f932=_[_0x9860('0x11e')](_0x5ec06c[_0x9860('0x43')]['ids'])?_0x5ec06c[_0x9860('0x43')][_0x9860('0x62')]:[_0x5ec06c[_0x9860('0x43')]['ids']];}var _0x51a870=[];return Promise['resolve']()['then'](function(){if(!_0x29f932)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x9860('0x14')](function(){return db[_0x9860('0x3a')]['findOne']({'where':{'id':_0x57cdf0}});})[_0x9860('0x14')](function(_0x44a6cb){if(!_0x44a6cb)throw new APINotFoundError(util[_0x9860('0xcd')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5ec06c[_0x9860('0x54')]['id']));return db[_0x9860('0x6c')][_0x9860('0x115')](function(_0x1c8e9b){return _0x44a6cb[_0x9860('0x11d')](_0x29f932,{'transaction':_0x1c8e9b})[_0x9860('0x14')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x29f932}}});})['then'](function(_0x54b92b){var _0x47dac7=_[_0x9860('0x31')](_0x54b92b,function(_0x5dda75){return _0x5dda75[_0x9860('0x11f')]();});return Promise[_0x9860('0x52')](_0x47dac7);})[_0x9860('0x14')](function(_0x38a931){_0x51a870=_[_0x9860('0x116')](_0x38a931);var _0x4e0cd8=_['map'](_0x51a870,function(_0x1b16c3){return _0x1b16c3[_0x9860('0x120')](_0x44a6cb['id'],{'transaction':_0x1c8e9b});});return Promise[_0x9860('0x52')](_0x4e0cd8);})[_0x9860('0x14')](function(){if(!_0x44a6cb[_0x9860('0xa2')])return;var _0x307e0c=_['filter'](_0x51a870,function(_0x1118ec){return _0x1118ec[_0x9860('0x118')](_0x9860('0xa1'))===_0x9860('0x119');});var _0x12a8bf=_[_0x9860('0x31')](_0x307e0c,function(_0xf9b057){return db[_0x9860('0xb3')][_0x9860('0x35')]({'where':{'VoiceQueueId':_0xf9b057['id'],'UserId':_0x44a6cb['id']},'transaction':_0x1c8e9b});});return Promise[_0x9860('0x52')](_0x12a8bf);})[_0x9860('0x14')](function(){return db[_0x9860('0x11a')][_0x9860('0x8f')]({'where':{'teamId':{'$in':_0x29f932}}});})[_0x9860('0x14')](function(_0x224739){var _0x161bb6=_[_0x9860('0x31')](_0x224739,function(_0x26ea54){return db[_0x9860('0x11b')][_0x9860('0x35')]({'where':{'UserId':_0x44a6cb['id'],'VoicePrefixId':_0x26ea54['VoicePrefixId']}},{'transaction':_0x1c8e9b});});return Promise[_0x9860('0x52')](_0x161bb6);});});})[_0x9860('0x14')](function(){for(var _0x49cf7c=0x0;_0x49cf7c<_0x51a870[_0x9860('0x5a')];_0x49cf7c++){var _0x885daf=_0x51a870[_0x49cf7c][_0x9860('0x118')](_0x9860('0xa1'));var _0x5650c5=_0x885daf+_0x9860('0xb1');socket['emit'](_0x9860('0x2c')+_0x885daf+'Queue:remove',{'UserId':_0x57cdf0,['queueField']:_0x51a870[_0x49cf7c]['id']});}})[_0x9860('0x14')](respondWithStatusCode(_0x1f1e6f,null))[_0x9860('0x1d')](APIHandleError(_0x1f1e6f));};exports['getLists']=function(_0x34f89f,_0x160029){var _0x110e7f={};var _0x5905af={};var _0x550c22;var _0x1f6b20;return db[_0x9860('0x3a')]['findOne']({'where':{'id':_0x34f89f[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x160029,null))[_0x9860('0x14')](function(_0x42d2c1){if(_0x42d2c1){_0x550c22=_0x42d2c1;_0x5905af[_0x9860('0x55')]=_[_0x9860('0x57')](db[_0x9860('0xce')]['rawAttributes']);_0x5905af[_0x9860('0x43')]=_['keys'](_0x34f89f[_0x9860('0x43')]);_0x5905af[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x5905af['model'],_0x5905af[_0x9860('0x43')]);_0x110e7f['attributes']=_[_0x9860('0x58')](_0x5905af[_0x9860('0x55')],qs[_0x9860('0x59')](_0x34f89f[_0x9860('0x43')]['fields']));_0x110e7f[_0x9860('0x48')]=_0x110e7f['attributes'][_0x9860('0x5a')]?_0x110e7f[_0x9860('0x48')]:_0x5905af[_0x9860('0x55')];_0x110e7f['order']=qs['sort'](_0x34f89f[_0x9860('0x43')]['sort']);_0x110e7f[_0x9860('0x42')]=qs['filters'](_[_0x9860('0xd7')](_0x34f89f[_0x9860('0x43')],_0x5905af[_0x9860('0xd4')]));if(_0x34f89f[_0x9860('0x43')][_0x9860('0x2f')]){_0x110e7f[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x110e7f[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0x110e7f[_0x9860('0x48')],function(_0xa4c21e){var _0x26153d={};_0x26153d[_0xa4c21e]={'$like':'%'+_0x34f89f['query'][_0x9860('0x2f')]+'%'};return _0x26153d;})});}_0x110e7f=_['merge']({},_0x110e7f,_0x34f89f['options']);return _0x550c22[_0x9860('0x121')](_0x110e7f);}})[_0x9860('0x14')](function(_0x48afc5){if(_0x48afc5){_0x1f6b20=_0x48afc5['length'];if(!_0x34f89f[_0x9860('0x43')][_0x9860('0xd9')](_0x9860('0xda'))){_0x110e7f[_0x9860('0x24')]=qs[_0x9860('0x24')](_0x34f89f[_0x9860('0x43')][_0x9860('0x24')]);_0x110e7f[_0x9860('0x23')]=qs[_0x9860('0x23')](_0x34f89f[_0x9860('0x43')][_0x9860('0x23')]);}return _0x550c22[_0x9860('0x121')](_0x110e7f);}})['then'](function(_0x2e4bae){if(_0x2e4bae){return _0x2e4bae?{'count':_0x1f6b20,'rows':_0x2e4bae}:null;}})[_0x9860('0x14')](respondWithResult(_0x160029,null))['catch'](handleError(_0x160029,null));};exports['getAgents']=function(_0x2958fe,_0x314bbe){var _0x10a6df={};var _0x30c024={};var _0x116826;return db[_0x9860('0x3a')][_0x9860('0x9b')]({'where':{'id':_0x2958fe[_0x9860('0x54')]['id']}})[_0x9860('0x14')](handleEntityNotFound(_0x314bbe,null))[_0x9860('0x14')](function(_0x4bbdef){if(_0x4bbdef){_0x116826=_0x4bbdef;_0x30c024['model']=_[_0x9860('0x57')](db[_0x9860('0x3a')][_0x9860('0x3b')]);_0x30c024[_0x9860('0x43')]=_[_0x9860('0x57')](_0x2958fe[_0x9860('0x43')]);_0x30c024[_0x9860('0xd4')]=_[_0x9860('0x58')](_0x30c024[_0x9860('0x55')],_0x30c024[_0x9860('0x43')]);_0x10a6df[_0x9860('0x48')]=_['intersection'](_0x30c024[_0x9860('0x55')],qs[_0x9860('0x59')](_0x2958fe[_0x9860('0x43')]['fields']));_0x10a6df[_0x9860('0x48')]=_0x10a6df[_0x9860('0x48')][_0x9860('0x5a')]?_0x10a6df[_0x9860('0x48')]:_0x30c024['model'];_0x10a6df[_0x9860('0xd5')]=qs[_0x9860('0xd6')](_0x2958fe[_0x9860('0x43')][_0x9860('0xd6')]);_0x10a6df[_0x9860('0x42')]=qs[_0x9860('0xd4')](_[_0x9860('0xd7')](_0x2958fe[_0x9860('0x43')],_0x30c024[_0x9860('0xd4')]));if(_0x2958fe[_0x9860('0x43')]['filter']){_0x10a6df[_0x9860('0x42')]=_[_0x9860('0x5b')](_0x10a6df[_0x9860('0x42')],{'$or':_[_0x9860('0x31')](_0x10a6df['attributes'],function(_0x5491d8){var _0x2c47f4={};_0x2c47f4[_0x5491d8]={'$like':'%'+_0x2958fe[_0x9860('0x43')]['filter']+'%'};return _0x2c47f4;})});}_0x10a6df['model']=db[_0x9860('0x3a')];_0x10a6df['as']='Agents';_0x10a6df=_[_0x9860('0x5b')]({},_0x10a6df,_0x2958fe[_0x9860('0x5c')]);return _0x116826['getVoiceQueues']({'include':[_0x10a6df]});}})[_0x9860('0x14')](function(_0xa99a3){if(_0xa99a3){var _0x549037={},_0x3b529f=[];for(var _0x5e525f=0x0;_0x5e525f<_0xa99a3[_0x9860('0x5a')];_0x5e525f+=0x1){for(var _0x111640=0x0,_0xd42099;_0x111640<_0xa99a3[_0x5e525f][_0x9860('0x90')]['length'];_0x111640+=0x1){_0xd42099=_0xa99a3[_0x5e525f][_0x9860('0x90')][_0x111640][_0x9860('0x2a')]({'plain':!![]});_0x549037[_0xd42099['id']]=_0xd42099;}}_0x549037=_['values'](_0x549037);for(var _0x279cb7=qs[_0x9860('0x23')](_0x2958fe[_0x9860('0x43')][_0x9860('0x23')]);_0x279cb7<_0x549037[_0x9860('0x5a')]&&_0x3b529f['length']=_0x4c7e9c[_0x6da8('0x4f')]){throw new Error(_0x6da8('0x50'));}})[_0x6da8('0x18')](function(){if(_0x5a3525){return db[_0x6da8('0x25')]['destroy']({'where':{'membername':_0x5a3525[_0x6da8('0x30')]},'individualHooks':!![]});}})[_0x6da8('0x18')](function(){if(_0x5a3525){return _0x5a3525[_0x6da8('0x51')]({'raw':!![]});}})[_0x6da8('0x18')](function(_0x15bd88){if(_0x5a3525){if(_0x15bd88){var _0x2b37c3=[];_0x4fadc9=_0x15bd88;if(_0x4fadc9[_0x6da8('0x29')]){for(var _0x302908=0x0;_0x302908<_0x4fadc9['length'];_0x302908++){_0x2b37c3[_0x6da8('0x48')](db['UserVoiceQueueRt'][_0x6da8('0x52')]({'membername':_0x5a3525[_0x6da8('0x30')],'UserId':_0x5a3525['id'],'queue_name':_0x4fadc9[_0x302908][_0x6da8('0x30')],'VoiceQueueId':_0x4fadc9[_0x302908]['id'],'interface':_0x8be065,'paused':_0x5a3525[_0x6da8('0x53')]||![],'penalty':_0x4fadc9[_0x302908][_0x6da8('0x54')]||0x0}));}return BPromise[_0x6da8('0x49')](_0x2b37c3);}}}})[_0x6da8('0x18')](function(){if(_0x5a3525){return db[_0x6da8('0x47')][_0x6da8('0xf')]({'where':{'membername':_0x5a3525[_0x6da8('0x30')],'exitAt':null}});}})[_0x6da8('0x18')](function(_0x183f96){if(_0x5a3525){if(_0x183f96&&_0x183f96[_0x6da8('0x29')]){var _0x350b6e=[];_0x183f96[_0x6da8('0x2c')](function(_0x10502a){_0x350b6e[_0x6da8('0x48')](_0x10502a[_0x6da8('0x26')]({'exitAt':moment()[_0x6da8('0x23')](_0x6da8('0x28'))}));});return BPromise[_0x6da8('0x49')](_0x350b6e);}}})[_0x6da8('0x18')](function(){if(_0x5a3525){var _0x4e1234=[];var _0x5301b6=[];var _0x352713=utils[_0x6da8('0x2b')]();var _0x1ebcbf={'membername':_0x5a3525['name'],'interface':_0x8be065,'enterAt':moment()[_0x6da8('0x23')](_0x6da8('0x28')),'role':_0x5a3525[_0x6da8('0x33')],'internal':_0x5a3525[_0x6da8('0x22')]};_0x352713[_0x6da8('0x2c')](function(_0x3585c9){_0x4e1234['push'](_['merge']({'channel':_0x3585c9,'type':_0x6da8('0x55'),'data1':_0x6da8('0x56'),'data2':_0x8be065},_0x1ebcbf));if(_0x5a3525[_0x6da8('0x53')]){_0x5301b6['push'](_['merge']({'channel':_0x3585c9,'type':_0x6da8('0x27'),'data1':_0x6da8('0x57')},_0x1ebcbf));}});return db[_0x6da8('0x47')][_0x6da8('0x58')](_0x4e1234[_0x6da8('0x59')](_0x5301b6),{'individualHooks':!![]});}})[_0x6da8('0x18')](function(){if(_0x5a3525){return _0x5a3525['update']({'online':!![],'lastLoginAt':moment()[_0x6da8('0x23')](_0x6da8('0x28')),'voicePause':_0x5a3525[_0x6da8('0x53')]||![],'mailPause':_0x5a3525[_0x6da8('0x53')]||![],'chatPause':_0x5a3525['loginInPause']||![],'faxPause':_0x5a3525[_0x6da8('0x53')]||![],'smsPause':_0x5a3525['loginInPause']||![],'openchannelPause':_0x5a3525['loginInPause']||![],'pauseType':_0x5a3525['loginInPause']?_0x6da8('0x57'):null,'lastPauseAt':moment()[_0x6da8('0x23')](_0x6da8('0x28')),'interface':_0x8be065});}})[_0x6da8('0x18')](function(_0x11e40a){_0x238d3d(_0x11e40a);})['catch'](function(_0x198231){_0x329c91(_0x2558ba['error'](0x1f4,_0x198231[_0x6da8('0x1c')]));});});}; \ No newline at end of file +var _0x4220=['../../config/utils','../../config/logger','redis','localhost','socket.io-emitter','./user.socket','register','User','findAll','options','raw','where','limit','map','include','attributes','model','then','info','debug','GetUser','stringify','catch','message','error','ShowUser','find','PauseUser','role','internal','interface','User\x20with\x20id\x20%s\x20not\x20found','params','update','name','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','DEFAULT\x20PAUSE','body','uniqueid','MemberReport','type','UnpauseUser','channel','isValidChannel','findOne','online','mailPause','faxPause','openchannelPause','smsPause','pauseType','system','destroy','length','mobile','phone','SIP/%s','count','agent','../../config/license/util','getLicense','agents','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','all','forEach','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0xae7883,_0xabf9c8){var _0xd55326=function(_0x51fb2f){while(--_0x51fb2f){_0xae7883['push'](_0xae7883['shift']());}};_0xd55326(++_0xabf9c8);}(_0x4220,0xf7));var _0x0422=function(_0xc4bdc1,_0x53ac7a){_0xc4bdc1=_0xc4bdc1-0x0;var _0xf45cdb=_0x4220[_0xc4bdc1];return _0xf45cdb;};'use strict';var _=require(_0x0422('0x0'));var util=require(_0x0422('0x1'));var moment=require('moment');var BPromise=require(_0x0422('0x2'));var Redis=require(_0x0422('0x3'));var db=require(_0x0422('0x4'))['db'];var utils=require(_0x0422('0x5'));var logger=require(_0x0422('0x6'))('rpc');var config=require('../../config/environment');config[_0x0422('0x7')]=_['defaults'](config[_0x0422('0x7')],{'host':_0x0422('0x8'),'port':0x18eb});var socket=require(_0x0422('0x9'))(new Redis(config[_0x0422('0x7')]));require(_0x0422('0xa'))[_0x0422('0xb')](socket);exports['GetUser']=function(_0x48cb7a){var _0x4c043b=this;return new Promise(function(_0x2f9c1a,_0x16c0a8){return db[_0x0422('0xc')][_0x0422('0xd')]({'raw':_0x48cb7a[_0x0422('0xe')]?_0x48cb7a[_0x0422('0xe')][_0x0422('0xf')]===undefined?!![]:![]:!![],'where':_0x48cb7a[_0x0422('0xe')]?_0x48cb7a['options'][_0x0422('0x10')]||null:null,'attributes':_0x48cb7a['options']?_0x48cb7a[_0x0422('0xe')]['attributes']||null:null,'limit':_0x48cb7a['options']?_0x48cb7a[_0x0422('0xe')][_0x0422('0x11')]||null:null,'include':_0x48cb7a['options']?_0x48cb7a[_0x0422('0xe')]['include']?_[_0x0422('0x12')](_0x48cb7a[_0x0422('0xe')][_0x0422('0x13')],function(_0x2b9bc4){return{'model':db[_0x2b9bc4['model']],'as':_0x2b9bc4['as'],'attributes':_0x2b9bc4[_0x0422('0x14')],'include':_0x2b9bc4[_0x0422('0x13')]?_[_0x0422('0x12')](_0x2b9bc4[_0x0422('0x13')],function(_0x42b567){return{'model':db[_0x42b567[_0x0422('0x15')]],'as':_0x42b567['as'],'attributes':_0x42b567['attributes'],'include':_0x42b567[_0x0422('0x13')]?_[_0x0422('0x12')](_0x42b567[_0x0422('0x13')],function(_0x107f0d){return{'model':db[_0x107f0d[_0x0422('0x15')]],'as':_0x107f0d['as'],'attributes':_0x107f0d[_0x0422('0x14')]};}):[]};}):[]};}):[]:[]})[_0x0422('0x16')](function(_0x4ccdb6){logger[_0x0422('0x17')]('GetUser',_0x48cb7a);logger[_0x0422('0x18')](_0x0422('0x19'),_0x48cb7a,JSON[_0x0422('0x1a')](_0x4ccdb6));_0x2f9c1a(_0x4ccdb6);})[_0x0422('0x1b')](function(_0x32817b){logger['error']('GetUser',_0x32817b[_0x0422('0x1c')],_0x48cb7a);_0x16c0a8(_0x4c043b[_0x0422('0x1d')](0x1f4,_0x32817b[_0x0422('0x1c')]));});});};exports[_0x0422('0x1e')]=function(_0x313e10){var _0x69c4ef=this;return new Promise(function(_0x2c1c33,_0x164b49){return db[_0x0422('0xc')][_0x0422('0x1f')]({'raw':_0x313e10[_0x0422('0xe')]?_0x313e10[_0x0422('0xe')][_0x0422('0xf')]===undefined?!![]:![]:!![],'where':_0x313e10[_0x0422('0xe')]?_0x313e10[_0x0422('0xe')]['where']||null:null,'attributes':_0x313e10['options']?_0x313e10[_0x0422('0xe')]['attributes']||null:null,'include':_0x313e10['options']?_0x313e10[_0x0422('0xe')][_0x0422('0x13')]?_['map'](_0x313e10[_0x0422('0xe')]['include'],function(_0x24b7d3){return{'model':db[_0x24b7d3[_0x0422('0x15')]],'as':_0x24b7d3['as'],'attributes':_0x24b7d3[_0x0422('0x14')],'include':_0x24b7d3[_0x0422('0x13')]?_[_0x0422('0x12')](_0x24b7d3['include'],function(_0x42bef6){return{'model':db[_0x42bef6[_0x0422('0x15')]],'as':_0x42bef6['as'],'attributes':_0x42bef6[_0x0422('0x14')],'include':_0x42bef6['include']?_['map'](_0x42bef6['include'],function(_0x16f722){return{'model':db[_0x16f722[_0x0422('0x15')]],'as':_0x16f722['as'],'attributes':_0x16f722['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4de7ba){logger[_0x0422('0x17')]('ShowUser',_0x313e10);logger[_0x0422('0x18')]('ShowUser',_0x313e10,JSON[_0x0422('0x1a')](_0x4de7ba));_0x2c1c33(_0x4de7ba);})['catch'](function(_0x13f36c){logger[_0x0422('0x1d')](_0x0422('0x1e'),_0x13f36c[_0x0422('0x1c')],_0x313e10);_0x164b49(_0x69c4ef[_0x0422('0x1d')](0x1f4,_0x13f36c['message']));});});};exports[_0x0422('0x20')]=function(_0x43ec38){var _0x52d5bd;return db[_0x0422('0xc')]['find']({'where':_0x43ec38['options'][_0x0422('0x10')]||{},'attributes':['id','name',_0x0422('0x21'),_0x0422('0x22'),_0x0422('0x23')]})[_0x0422('0x16')](function(_0x390f1f){if(!_0x390f1f){throw new Error(util['format'](_0x0422('0x24'),_0x43ec38[_0x0422('0x25')]['id']));}_0x52d5bd=_0x390f1f;return db['UserVoiceQueueRt'][_0x0422('0x26')]({'paused':0x1},{'where':{'UserId':_0x52d5bd['id']},'individualHooks':!![]});})[_0x0422('0x16')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x52d5bd[_0x0422('0x27')],'type':_0x0422('0x28'),'exitAt':null}});})[_0x0422('0x16')](function(_0x2cede9){if(_0x2cede9&&_0x2cede9['length']){var _0x8af42a=moment()[_0x0422('0x29')](_0x0422('0x2a'));for(var _0x1cb2ee=0x0,_0x471626=_0x2cede9['length'];_0x1cb2ee<_0x471626;_0x1cb2ee++){_0x2cede9[_0x1cb2ee][_0x0422('0x2b')]({'exitAt':_0x8af42a});}}})['then'](function(){var _0x3565df=[];var _0x92178=utils[_0x0422('0x2c')]();_0x92178['forEach'](function(_0x1b4759){_0x3565df[_0x0422('0x2d')]({'channel':_0x1b4759,'membername':_0x52d5bd[_0x0422('0x27')],'interface':_[_0x0422('0x2e')](_0x52d5bd[_0x0422('0x23')])?util['format']('SIP/%s',_0x52d5bd[_0x0422('0x27')]):_0x52d5bd[_0x0422('0x23')],'type':_0x0422('0x28'),'enterAt':moment()['format'](_0x0422('0x2a')),'data1':_0x43ec38['body']['type']||_0x0422('0x2f'),'role':_0x52d5bd[_0x0422('0x21')],'internal':_0x52d5bd[_0x0422('0x22')],'uniqueid':_0x43ec38[_0x0422('0x30')][_0x0422('0x31')]||null});});return db[_0x0422('0x32')]['bulkCreate'](_0x3565df,{'individualHooks':!![]});})[_0x0422('0x16')](function(){return _0x52d5bd['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x43ec38[_0x0422('0x30')][_0x0422('0x33')]||_0x0422('0x2f'),'lastPauseAt':moment()[_0x0422('0x29')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x0422('0x1b')](function(_0x3b1ecf){throw _0x3b1ecf;});};exports[_0x0422('0x34')]=function(_0x4ea88d){return Promise['resolve']()['then'](function(){if(_0x4ea88d['body'][_0x0422('0x35')]&&!utils[_0x0422('0x36')](_0x4ea88d[_0x0422('0x30')][_0x0422('0x35')])){throw new Error(util[_0x0422('0x29')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x4ea88d[_0x0422('0x30')][_0x0422('0x35')]));}return db[_0x0422('0xc')][_0x0422('0x37')]({'where':_0x4ea88d[_0x0422('0xe')]['where']||{},'attributes':['id','name','role',_0x0422('0x22'),_0x0422('0x23'),_0x0422('0x38'),'voicePause',_0x0422('0x39'),'chatPause',_0x0422('0x3a'),_0x0422('0x3b'),_0x0422('0x3c'),'whatsappPause',_0x0422('0x3d'),'lastPauseAt']});})[_0x0422('0x16')](function(_0x276c4b){if(!_0x276c4b){throw new Error(util[_0x0422('0x29')](_0x0422('0x24'),_0x4ea88d[_0x0422('0x25')]['id']));}return _0x276c4b['unpause'](_0x4ea88d['body'][_0x0422('0x35')],_0x0422('0x3e'));})['catch'](function(_0x35935b){throw _0x35935b;});};exports['LogoutUser']=function(_0x5f3aba){var _0x2405c3=this;return new Promise(function(_0x253940,_0x2dd317){var _0x1ef1ee;return db[_0x0422('0xc')][_0x0422('0x37')]({'where':_0x5f3aba[_0x0422('0xe')][_0x0422('0x10')]||{},'attributes':['id',_0x0422('0x27')]})['then'](function(_0x3250fa){if(_0x3250fa){_0x1ef1ee=_0x3250fa;return db['UserVoiceQueueRt'][_0x0422('0x3f')]({'where':{'membername':_0x1ef1ee[_0x0422('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x1ef1ee){return db['MemberReport'][_0x0422('0xd')]({'where':{'membername':_0x1ef1ee['name'],'exitAt':null}});}})[_0x0422('0x16')](function(_0x155be3){if(_0x1ef1ee){if(_0x155be3&&_0x155be3[_0x0422('0x40')]){var _0x550f36=[];_0x155be3['forEach'](function(_0x155fed){_0x550f36[_0x0422('0x2d')](_0x155fed['update']({'exitAt':moment()['format'](_0x0422('0x2a'))}));});return BPromise['all'](_0x550f36);}}})[_0x0422('0x16')](function(){if(_0x1ef1ee){return _0x1ef1ee[_0x0422('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x0422('0x16')](function(_0x281ecc){_0x253940(_0x281ecc);})[_0x0422('0x1b')](function(_0x52f95d){_0x2dd317(_0x2405c3['error'](0x1f4,_0x52f95d[_0x0422('0x1c')]));});});};exports['LoginUser']=function(_0x512b23){var _0x26807d=this;return new Promise(function(_0x361d58,_0x517240){var _0x2b5818;var _0xa391b5;var _0x50bdd0;var _0x793a13;return db['User'][_0x0422('0x37')]({'where':_0x512b23[_0x0422('0xe')][_0x0422('0x10')]||{},'attributes':['id',_0x0422('0x27'),_0x0422('0x21'),_0x0422('0x41'),_0x0422('0x42'),'internal','loginInPause','interface']})['then'](function(_0x254b40){if(_0x254b40){_0x2b5818=_0x254b40;_0x793a13=_0x512b23[_0x0422('0x30')][_0x0422('0x23')]?_0x512b23[_0x0422('0x30')][_0x0422('0x23')]:util[_0x0422('0x29')](_0x0422('0x43'),_0x2b5818[_0x0422('0x27')]);return db[_0x0422('0xc')][_0x0422('0x44')]({'where':{'role':_0x0422('0x45'),'online':!![],'id':{'$ne':_0x2b5818['id']}}});}})['then'](function(_0x2dcb3a){if(_0x2dcb3a){_0x50bdd0=_0x2dcb3a;return require(_0x0422('0x46'))[_0x0422('0x47')]();}})[_0x0422('0x16')](function(_0x1f43bd){if(_0x1f43bd&&_0x1f43bd['agents']&&_0x50bdd0>=_0x1f43bd[_0x0422('0x48')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x0422('0x16')](function(){if(_0x2b5818){return db['UserVoiceQueueRt'][_0x0422('0x3f')]({'where':{'membername':_0x2b5818[_0x0422('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x2b5818){return _0x2b5818[_0x0422('0x49')]({'raw':!![]});}})[_0x0422('0x16')](function(_0x4c1634){if(_0x2b5818){if(_0x4c1634){var _0x54b97a=[];_0xa391b5=_0x4c1634;if(_0xa391b5[_0x0422('0x40')]){for(var _0x34c93d=0x0;_0x34c93d<_0xa391b5[_0x0422('0x40')];_0x34c93d++){_0x54b97a[_0x0422('0x2d')](db['UserVoiceQueueRt'][_0x0422('0x4a')]({'membername':_0x2b5818[_0x0422('0x27')],'UserId':_0x2b5818['id'],'queue_name':_0xa391b5[_0x34c93d][_0x0422('0x27')],'VoiceQueueId':_0xa391b5[_0x34c93d]['id'],'interface':_0x793a13,'paused':_0x2b5818[_0x0422('0x4b')]||![],'penalty':_0xa391b5[_0x34c93d][_0x0422('0x4c')]||0x0}));}return BPromise[_0x0422('0x4d')](_0x54b97a);}}}})[_0x0422('0x16')](function(){if(_0x2b5818){return db[_0x0422('0x32')][_0x0422('0xd')]({'where':{'membername':_0x2b5818[_0x0422('0x27')],'exitAt':null}});}})['then'](function(_0x265080){if(_0x2b5818){if(_0x265080&&_0x265080[_0x0422('0x40')]){var _0x5cacfc=[];_0x265080[_0x0422('0x4e')](function(_0x257e88){_0x5cacfc[_0x0422('0x2d')](_0x257e88[_0x0422('0x26')]({'exitAt':moment()[_0x0422('0x29')](_0x0422('0x2a'))}));});return BPromise[_0x0422('0x4d')](_0x5cacfc);}}})[_0x0422('0x16')](function(){if(_0x2b5818){var _0x1f1488=[];var _0xf4af9e=[];var _0x2d0223=utils[_0x0422('0x2c')]();var _0xeecef={'membername':_0x2b5818[_0x0422('0x27')],'interface':_0x793a13,'enterAt':moment()[_0x0422('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2b5818['role'],'internal':_0x2b5818[_0x0422('0x22')]};_0x2d0223[_0x0422('0x4e')](function(_0xc8e6b7){_0x1f1488[_0x0422('0x2d')](_[_0x0422('0x4f')]({'channel':_0xc8e6b7,'type':_0x0422('0x50'),'data1':_0x0422('0x51'),'data2':_0x793a13},_0xeecef));if(_0x2b5818[_0x0422('0x4b')]){_0xf4af9e[_0x0422('0x2d')](_[_0x0422('0x4f')]({'channel':_0xc8e6b7,'type':'PAUSE','data1':_0x0422('0x52')},_0xeecef));}});return db['MemberReport']['bulkCreate'](_0x1f1488[_0x0422('0x53')](_0xf4af9e),{'individualHooks':!![]});}})[_0x0422('0x16')](function(){if(_0x2b5818){return _0x2b5818['update']({'online':!![],'lastLoginAt':moment()[_0x0422('0x29')](_0x0422('0x2a')),'voicePause':_0x2b5818[_0x0422('0x4b')]||![],'mailPause':_0x2b5818[_0x0422('0x4b')]||![],'chatPause':_0x2b5818[_0x0422('0x4b')]||![],'faxPause':_0x2b5818[_0x0422('0x4b')]||![],'smsPause':_0x2b5818[_0x0422('0x4b')]||![],'openchannelPause':_0x2b5818[_0x0422('0x4b')]||![],'pauseType':_0x2b5818[_0x0422('0x4b')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x0422('0x29')](_0x0422('0x2a')),'interface':_0x793a13});}})[_0x0422('0x16')](function(_0x112c5c){_0x361d58(_0x112c5c);})[_0x0422('0x1b')](function(_0xd4ca33){_0x517240(_0x26807d['error'](0x1f4,_0xd4ca33[_0x0422('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 9f5a195..7412cfd 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 _0x7395=['save','remove','update','emit','removeListener','register','length','./user.events'];(function(_0x5d7321,_0x45ac24){var _0x13359d=function(_0x34a023){while(--_0x34a023){_0x5d7321['push'](_0x5d7321['shift']());}};_0x13359d(++_0x45ac24);}(_0x7395,0xcf));var _0x5739=function(_0x5df575,_0x2e32ad){_0x5df575=_0x5df575-0x0;var _0x5a7ac6=_0x7395[_0x5df575];return _0x5a7ac6;};'use strict';var UserEvents=require(_0x5739('0x0'));var events=[_0x5739('0x1'),_0x5739('0x2'),_0x5739('0x3')];function createListener(_0x4569a7,_0x4c9da0){return function(_0x3c1b82){_0x4c9da0[_0x5739('0x4')](_0x4569a7,_0x3c1b82);};}function removeListener(_0x344562,_0x58ee74){return function(){UserEvents[_0x5739('0x5')](_0x344562,_0x58ee74);};}exports[_0x5739('0x6')]=function(_0x1fde36){for(var _0x4d9b25=0x0,_0xf04469=events[_0x5739('0x7')];_0x4d9b25<_0xf04469;_0x4d9b25++){var _0x36c1ba=events[_0x4d9b25];var _0x51172b=createListener('user:'+_0x36c1ba,_0x1fde36);UserEvents['on'](_0x36c1ba,_0x51172b);}}; \ No newline at end of file +var _0x49be=['register','length','./user.events','save','remove','update','removeListener'];(function(_0x16938f,_0x35e57f){var _0x5c66e9=function(_0x5167d7){while(--_0x5167d7){_0x16938f['push'](_0x16938f['shift']());}};_0x5c66e9(++_0x35e57f);}(_0x49be,0xbf));var _0xe49b=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x49be[_0x28aea5];return _0x6a55f9;};'use strict';var UserEvents=require(_0xe49b('0x0'));var events=[_0xe49b('0x1'),_0xe49b('0x2'),_0xe49b('0x3')];function createListener(_0x37d2c8,_0x4cb54c){return function(_0x420bec){_0x4cb54c['emit'](_0x37d2c8,_0x420bec);};}function removeListener(_0x329cd6,_0x248460){return function(){UserEvents[_0xe49b('0x4')](_0x329cd6,_0x248460);};}exports[_0xe49b('0x5')]=function(_0x2d6d9f){for(var _0x25bec7=0x0,_0x1008ce=events[_0xe49b('0x6')];_0x25bec7<_0x1008ce;_0x25bec7++){var _0x8f7455=events[_0x25bec7];var _0x240804=createListener('user:'+_0x8f7455,_0x2d6d9f);UserEvents['on'](_0x8f7455,_0x240804);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index cc6663c..8457aa9 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1fbfef,_0x518e25){var _0x26776e=function(_0x48fb5f){while(--_0x48fb5f){_0x1fbfef['push'](_0x1fbfef['shift']());}};_0x26776e(++_0x518e25);}(_0xedd9,0xfc));var _0x9edd=function(_0x54fdd9,_0x2c8d89){_0x54fdd9=_0x54fdd9-0x0;var _0x5c43c2=_0xedd9[_0x54fdd9];return _0x5c43c2;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x283533,_0x3cfc01){var _0x3ade22=function(_0x4424ab){while(--_0x4424ab){_0x283533['push'](_0x283533['shift']());}};_0x3ade22(++_0x3cfc01);}(_0x70e0,0x17b));var _0x070e=function(_0x18e94b,_0x217fa2){_0x18e94b=_0x18e94b-0x0;var _0x213a9a=_0x70e0[_0x18e94b];return _0x213a9a;};'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');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 7eacb0f..951b188 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 _0x485d=['exports','sequelize'];(function(_0x4e7c2,_0x3b3347){var _0x84bb35=function(_0x217b38){while(--_0x217b38){_0x4e7c2['push'](_0x4e7c2['shift']());}};_0x84bb35(++_0x3b3347);}(_0x485d,0xd3));var _0xd485=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0x485d[_0x515afd];return _0x536d53;};'use strict';var Sequelize=require(_0xd485('0x0'));module[_0xd485('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x624b=['sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x624b,0x1b0));var _0xb624=function(_0x4bd540,_0x3be25a){_0x4bd540=_0x4bd540-0x0;var _0x2f8c3a=_0x624b[_0x4bd540];return _0x2f8c3a;};'use strict';var Sequelize=require(_0xb624('0x0'));module[_0xb624('0x1')]={'penalty':{'type':Sequelize[_0xb624('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 2e8bd5f..e86b86c 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 _0x5029=['api','bluebird','request-promise','path','rimraf','../../config/environment','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5029,0xf9));var _0x9502=function(_0x7e048,_0x305976){_0x7e048=_0x7e048-0x0;var _0x5d2aa9=_0x5029[_0x7e048];return _0x5d2aa9;};'use strict';var _=require(_0x9502('0x0'));var util=require(_0x9502('0x1'));var logger=require(_0x9502('0x2'))(_0x9502('0x3'));var moment=require('moment');var BPromise=require(_0x9502('0x4'));var rp=require(_0x9502('0x5'));var fs=require('fs');var path=require(_0x9502('0x6'));var rimraf=require(_0x9502('0x7'));var config=require(_0x9502('0x8'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x1eef79,_0x49fef1){return _0x1eef79[_0x9502('0x9')](_0x9502('0xa'),attributes,{'tableName':_0x9502('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe94b=['../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','util','api','moment','path'];(function(_0xb94a22,_0x18f90f){var _0x45370e=function(_0x377600){while(--_0x377600){_0xb94a22['push'](_0xb94a22['shift']());}};_0x45370e(++_0x18f90f);}(_0xe94b,0x17f));var _0xbe94=function(_0x47c8bb,_0x294561){_0x47c8bb=_0x47c8bb-0x0;var _0x1f8741=_0xe94b[_0x47c8bb];return _0x1f8741;};'use strict';var _=require('lodash');var util=require(_0xbe94('0x0'));var logger=require('../../config/logger')(_0xbe94('0x1'));var moment=require(_0xbe94('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe94('0x3'));var rimraf=require('rimraf');var config=require(_0xbe94('0x4'));var attributes=require(_0xbe94('0x5'));module[_0xbe94('0x6')]=function(_0x53dde8,_0x5d4ad3){return _0x53dde8[_0xbe94('0x7')]('UserChatQueue',attributes,{'tableName':_0xbe94('0x8'),'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 4cd6417..c9cbe1f 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 _0x345f=['then','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','client','http','request'];(function(_0x2100a8,_0x306120){var _0x34119b=function(_0x490858){while(--_0x490858){_0x2100a8['push'](_0x2100a8['shift']());}};_0x34119b(++_0x306120);}(_0x345f,0x1da));var _0xf345=function(_0x4ac60a,_0x503a99){_0x4ac60a=_0x4ac60a-0x0;var _0x4b22e8=_0x345f[_0x4ac60a];return _0x4b22e8;};'use strict';var _=require(_0xf345('0x0'));var util=require(_0xf345('0x1'));var moment=require(_0xf345('0x2'));var BPromise=require(_0xf345('0x3'));var rs=require(_0xf345('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf345('0x5'));var logger=require('../../config/logger')(_0xf345('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf345('0x7')][_0xf345('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a0048,_0x55c19b,_0x23c18f){return new BPromise(function(_0x341391,_0xa4d0f0){return client[_0xf345('0x9')](_0x1a0048,_0x23c18f)[_0xf345('0xa')](function(_0x2d6082){logger[_0xf345('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x55c19b,'request\x20sent');logger[_0xf345('0xc')](_0xf345('0xd'),_0x55c19b,_0xf345('0xe'),JSON[_0xf345('0xf')](_0x2d6082));if(_0x2d6082[_0xf345('0x10')]){if(_0x2d6082[_0xf345('0x10')][_0xf345('0x11')]===0x1f4){logger[_0xf345('0x10')](_0xf345('0x12'),_0x55c19b,_0x2d6082['error'][_0xf345('0x13')]);return _0xa4d0f0(_0x2d6082['error'][_0xf345('0x13')]);}logger[_0xf345('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x55c19b,_0x2d6082[_0xf345('0x10')][_0xf345('0x13')]);return _0x341391(_0x2d6082[_0xf345('0x10')][_0xf345('0x13')]);}else{logger[_0xf345('0xb')](_0xf345('0x12'),_0x55c19b,_0xf345('0xe'));_0x341391(_0x2d6082[_0xf345('0x14')][_0xf345('0x13')]);}})[_0xf345('0x15')](function(_0x3878b2){logger[_0xf345('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x55c19b,_0x3878b2);_0xa4d0f0(_0x3878b2);});});} \ No newline at end of file +var _0xb30e=['info','result','lodash','moment','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1eb2ce,_0x57c0bd){var _0x138311=function(_0x489912){while(--_0x489912){_0x1eb2ce['push'](_0x1eb2ce['shift']());}};_0x138311(++_0x57c0bd);}(_0xb30e,0x6e));var _0xeb30=function(_0x35f9fd,_0x161f16){_0x35f9fd=_0x35f9fd-0x0;var _0x53a02d=_0xb30e[_0x35f9fd];return _0x53a02d;};'use strict';var _=require(_0xeb30('0x0'));var util=require('util');var moment=require(_0xeb30('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb30('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb30('0x3'))('rpc');var config=require(_0xeb30('0x4'));var jayson=require(_0xeb30('0x5'));var client=jayson[_0xeb30('0x6')][_0xeb30('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5903ca,_0x38e16e,_0x43d949){return new BPromise(function(_0x53784c,_0x4480c5){return client[_0xeb30('0x8')](_0x5903ca,_0x43d949)['then'](function(_0x256ca5){logger['info'](_0xeb30('0x9'),_0x38e16e,_0xeb30('0xa'));logger[_0xeb30('0xb')](_0xeb30('0xc'),_0x38e16e,_0xeb30('0xa'),JSON['stringify'](_0x256ca5));if(_0x256ca5['error']){if(_0x256ca5[_0xeb30('0xd')][_0xeb30('0xe')]===0x1f4){logger['error'](_0xeb30('0x9'),_0x38e16e,_0x256ca5[_0xeb30('0xd')][_0xeb30('0xf')]);return _0x4480c5(_0x256ca5[_0xeb30('0xd')][_0xeb30('0xf')]);}logger[_0xeb30('0xd')](_0xeb30('0x9'),_0x38e16e,_0x256ca5[_0xeb30('0xd')]['message']);return _0x53784c(_0x256ca5['error'][_0xeb30('0xf')]);}else{logger[_0xeb30('0x10')](_0xeb30('0x9'),_0x38e16e,_0xeb30('0xa'));_0x53784c(_0x256ca5[_0xeb30('0x11')][_0xeb30('0xf')]);}})['catch'](function(_0x46a24b){logger[_0xeb30('0xd')](_0xeb30('0x9'),_0x38e16e,_0x46a24b);_0x4480c5(_0x46a24b);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index d564ad9..b00ad8b 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x324d77,_0x307ef7){var _0x2a77a7=function(_0x54120e){while(--_0x54120e){_0x324d77['push'](_0x324d77['shift']());}};_0x2a77a7(++_0x307ef7);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xa56b53,_0x53dbb7){var _0x19849f=function(_0x503946){while(--_0x503946){_0xa56b53['push'](_0xa56b53['shift']());}};_0x19849f(++_0x53dbb7);}(_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 1884ffc..7b4744f 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 _0x3425=['INTEGER','STRING','sequelize','exports'];(function(_0x4e310c,_0x35d063){var _0x51bb9b=function(_0x1f3aae){while(--_0x1f3aae){_0x4e310c['push'](_0x4e310c['shift']());}};_0x51bb9b(++_0x35d063);}(_0x3425,0x1ce));var _0x5342=function(_0x395f63,_0x1d8c89){_0x395f63=_0x395f63-0x0;var _0x34f627=_0x3425[_0x395f63];return _0x34f627;};'use strict';var Sequelize=require(_0x5342('0x0'));module[_0x5342('0x1')]={'penalty':{'type':Sequelize[_0x5342('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5342('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5342('0x3')]}}; \ No newline at end of file +var _0x7af7=['STRING','sequelize','INTEGER'];(function(_0x3b038e,_0x2b555c){var _0x223947=function(_0x24be95){while(--_0x24be95){_0x3b038e['push'](_0x3b038e['shift']());}};_0x223947(++_0x2b555c);}(_0x7af7,0xc4));var _0x77af=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0x7af7[_0x55d58f];return _0x1ad6e6;};'use strict';var Sequelize=require(_0x77af('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x77af('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x77af('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x77af('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 80b7563..8028ed0 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 _0xa063=['path','../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','moment','bluebird'];(function(_0x1a4b0e,_0x5de233){var _0x37a442=function(_0x3594ef){while(--_0x3594ef){_0x1a4b0e['push'](_0x1a4b0e['shift']());}};_0x37a442(++_0x5de233);}(_0xa063,0x1a4));var _0x3a06=function(_0x1c00fd,_0x77cbb8){_0x1c00fd=_0x1c00fd-0x0;var _0x173a1e=_0xa063[_0x1c00fd];return _0x173a1e;};'use strict';var _=require(_0x3a06('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3a06('0x1'));var BPromise=require(_0x3a06('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a06('0x3'));var rimraf=require('rimraf');var config=require(_0x3a06('0x4'));var attributes=require('./userFaxQueue.attributes');module[_0x3a06('0x5')]=function(_0x4c79cb,_0x580e7f){return _0x4c79cb[_0x3a06('0x6')](_0x3a06('0x7'),attributes,{'tableName':_0x3a06('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x115e=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue'];(function(_0x307f9c,_0x13fcb6){var _0x3cd355=function(_0x40e9dd){while(--_0x40e9dd){_0x307f9c['push'](_0x307f9c['shift']());}};_0x3cd355(++_0x13fcb6);}(_0x115e,0x16b));var _0xe115=function(_0x168466,_0x5f37e5){_0x168466=_0x168466-0x0;var _0xcf8a4=_0x115e[_0x168466];return _0xcf8a4;};'use strict';var _=require(_0xe115('0x0'));var util=require(_0xe115('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe115('0x2'));var BPromise=require(_0xe115('0x3'));var rp=require(_0xe115('0x4'));var fs=require('fs');var path=require(_0xe115('0x5'));var rimraf=require(_0xe115('0x6'));var config=require(_0xe115('0x7'));var attributes=require(_0xe115('0x8'));module['exports']=function(_0x2b2755,_0x1174ac){return _0x2b2755[_0xe115('0x9')](_0xe115('0xa'),attributes,{'tableName':'user_has_fax_queues','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 c6dcfda..c2935bd 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 _0x45e1=['request\x20sent','debug','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x30f2a3,_0x218d00){var _0x3bb570=function(_0x781c2f){while(--_0x781c2f){_0x30f2a3['push'](_0x30f2a3['shift']());}};_0x3bb570(++_0x218d00);}(_0x45e1,0x168));var _0x145e=function(_0x15eb63,_0xd3f629){_0x15eb63=_0x15eb63-0x0;var _0x19fc81=_0x45e1[_0x15eb63];return _0x19fc81;};'use strict';var _=require(_0x145e('0x0'));var util=require(_0x145e('0x1'));var moment=require(_0x145e('0x2'));var BPromise=require(_0x145e('0x3'));var rs=require(_0x145e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x145e('0x5'))['db'];var utils=require(_0x145e('0x6'));var logger=require('../../config/logger')(_0x145e('0x7'));var config=require(_0x145e('0x8'));var jayson=require(_0x145e('0x9'));var client=jayson[_0x145e('0xa')][_0x145e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d4bc9,_0x4e9f83,_0x27cfd1){return new BPromise(function(_0xbb1b28,_0x207609){return client[_0x145e('0xc')](_0x3d4bc9,_0x27cfd1)['then'](function(_0x2be400){logger[_0x145e('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x4e9f83,_0x145e('0xe'));logger[_0x145e('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4e9f83,_0x145e('0xe'),JSON[_0x145e('0x10')](_0x2be400));if(_0x2be400[_0x145e('0x11')]){if(_0x2be400[_0x145e('0x11')][_0x145e('0x12')]===0x1f4){logger['error'](_0x145e('0x13'),_0x4e9f83,_0x2be400['error'][_0x145e('0x14')]);return _0x207609(_0x2be400[_0x145e('0x11')][_0x145e('0x14')]);}logger[_0x145e('0x11')](_0x145e('0x13'),_0x4e9f83,_0x2be400[_0x145e('0x11')][_0x145e('0x14')]);return _0xbb1b28(_0x2be400[_0x145e('0x11')][_0x145e('0x14')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x4e9f83,_0x145e('0xe'));_0xbb1b28(_0x2be400[_0x145e('0x15')][_0x145e('0x14')]);}})['catch'](function(_0x1caf8b){logger[_0x145e('0x11')](_0x145e('0x13'),_0x4e9f83,_0x1caf8b);_0x207609(_0x1caf8b);});});} \ No newline at end of file +var _0x493b=['util','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x493b,0xbc));var _0xb493=function(_0x8cf806,_0x1c5273){_0x8cf806=_0x8cf806-0x0;var _0x34e46b=_0x493b[_0x8cf806];return _0x34e46b;};'use strict';var _=require(_0xb493('0x0'));var util=require(_0xb493('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb493('0x2'));var fs=require('fs');var Redis=require(_0xb493('0x3'));var db=require(_0xb493('0x4'))['db'];var utils=require(_0xb493('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb493('0x6'));var client=jayson[_0xb493('0x7')][_0xb493('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa449c9,_0x27a1ca,_0x1a91c8){return new BPromise(function(_0x2133f6,_0x1bd947){return client[_0xb493('0x9')](_0xa449c9,_0x1a91c8)[_0xb493('0xa')](function(_0x2896bd){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x27a1ca,_0xb493('0xb'));logger['debug'](_0xb493('0xc'),_0x27a1ca,'request\x20sent',JSON[_0xb493('0xd')](_0x2896bd));if(_0x2896bd[_0xb493('0xe')]){if(_0x2896bd[_0xb493('0xe')][_0xb493('0xf')]===0x1f4){logger[_0xb493('0xe')](_0xb493('0x10'),_0x27a1ca,_0x2896bd[_0xb493('0xe')][_0xb493('0x11')]);return _0x1bd947(_0x2896bd[_0xb493('0xe')]['message']);}logger[_0xb493('0xe')](_0xb493('0x10'),_0x27a1ca,_0x2896bd[_0xb493('0xe')][_0xb493('0x11')]);return _0x2133f6(_0x2896bd[_0xb493('0xe')][_0xb493('0x11')]);}else{logger[_0xb493('0x12')](_0xb493('0x10'),_0x27a1ca,_0xb493('0xb'));_0x2133f6(_0x2896bd[_0xb493('0x13')][_0xb493('0x11')]);}})[_0xb493('0x14')](function(_0x5bcbc5){logger['error'](_0xb493('0x10'),_0x27a1ca,_0x5bcbc5);_0x1bd947(_0x5bcbc5);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index f63a3fd..89a49ed 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4760d6,_0x3b2e02){var _0x1fff67=function(_0x401542){while(--_0x401542){_0x4760d6['push'](_0x4760d6['shift']());}};_0x1fff67(++_0x3b2e02);}(_0x70e0,0x17b));var _0x070e=function(_0x107240,_0x4e9cc6){_0x107240=_0x107240-0x0;var _0x467447=_0x70e0[_0x107240];return _0x467447;};'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');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4c6eca,_0x357c0e){var _0x29fc3c=function(_0x257cc8){while(--_0x257cc8){_0x4c6eca['push'](_0x4c6eca['shift']());}};_0x29fc3c(++_0x357c0e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x423097,_0x8a09f4){_0x423097=_0x423097-0x0;var _0x3a73f1=_0xcb91[_0x423097];return _0x3a73f1;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 3ebfe28..58b8c8f 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 _0x5fd5=['INTEGER'];(function(_0x32859c,_0xbe26a1){var _0xa2dddb=function(_0x4f35c1){while(--_0x4f35c1){_0x32859c['push'](_0x32859c['shift']());}};_0xa2dddb(++_0xbe26a1);}(_0x5fd5,0x1ec));var _0x55fd=function(_0x12bba6,_0x7578e4){_0x12bba6=_0x12bba6-0x0;var _0x1a3f40=_0x5fd5[_0x12bba6];return _0x1a3f40;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x55fd('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x10f9=['sequelize','exports','INTEGER'];(function(_0x3073c5,_0x426ccc){var _0x35f385=function(_0x45b159){while(--_0x45b159){_0x3073c5['push'](_0x3073c5['shift']());}};_0x35f385(++_0x426ccc);}(_0x10f9,0x69));var _0x910f=function(_0x420169,_0x5021f7){_0x420169=_0x420169-0x0;var _0x25ec2a=_0x10f9[_0x420169];return _0x25ec2a;};'use strict';var Sequelize=require(_0x910f('0x0'));module[_0x910f('0x1')]={'penalty':{'type':Sequelize[_0x910f('0x2')],'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 201ec0a..19a6fd1 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 _0xbc69=['../../config/environment','./userMailQueue.attributes','define','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x54ce6d,_0x3c8572){var _0x4d732c=function(_0x27a54a){while(--_0x27a54a){_0x54ce6d['push'](_0x54ce6d['shift']());}};_0x4d732c(++_0x3c8572);}(_0xbc69,0x13c));var _0x9bc6=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xbc69[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0x9bc6('0x0'));var util=require(_0x9bc6('0x1'));var logger=require(_0x9bc6('0x2'))('api');var moment=require(_0x9bc6('0x3'));var BPromise=require(_0x9bc6('0x4'));var rp=require(_0x9bc6('0x5'));var fs=require('fs');var path=require(_0x9bc6('0x6'));var rimraf=require(_0x9bc6('0x7'));var config=require(_0x9bc6('0x8'));var attributes=require(_0x9bc6('0x9'));module['exports']=function(_0x441973,_0x3c0f81){return _0x441973[_0x9bc6('0xa')]('UserMailQueue',attributes,{'tableName':_0x9bc6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc46b=['rimraf','UserMailQueue','user_has_mail_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc46b,0x1f3));var _0xbc46=function(_0x158984,_0x42c216){_0x158984=_0x158984-0x0;var _0x5a389f=_0xc46b[_0x158984];return _0x5a389f;};'use strict';var _=require(_0xbc46('0x0'));var util=require('util');var logger=require(_0xbc46('0x1'))(_0xbc46('0x2'));var moment=require(_0xbc46('0x3'));var BPromise=require(_0xbc46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc46('0x5'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x448f74,_0x1bf9a7){return _0x448f74['define'](_0xbc46('0x6'),attributes,{'tableName':_0xbc46('0x7'),'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 fc9cba6..b1b6de1 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 _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(_0x9078f5,_0x4af0ac){var _0x5cb11e=function(_0x20149a){while(--_0x20149a){_0x9078f5['push'](_0x9078f5['shift']());}};_0x5cb11e(++_0x4af0ac);}(_0x6aa7,0x178));var _0x76aa=function(_0x29f8d0,_0x526ec4){_0x29f8d0=_0x29f8d0-0x0;var _0x116d1c=_0x6aa7[_0x29f8d0];return _0x116d1c;};'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 +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','UserMailQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x140db9,_0x4ab213){var _0x211456=function(_0x2229f7){while(--_0x2229f7){_0x140db9['push'](_0x140db9['shift']());}};_0x211456(++_0x4ab213);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0x5fc3[_0x1057a3];return _0x131cdb;};'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')]('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('UserMailQueue,\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']('UserMailQueue,\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);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 0d0c192..a7781cd 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 _0x4f92=['fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0x4f92,0x1c1));var _0x24f9=function(_0x5096f6,_0x203b13){_0x5096f6=_0x5096f6-0x0;var _0x45bf69=_0x4f92[_0x5096f6];return _0x45bf69;};'use strict';var multer=require(_0x24f9('0x0'));var util=require(_0x24f9('0x1'));var path=require(_0x24f9('0x2'));var timeout=require(_0x24f9('0x3'));var express=require(_0x24f9('0x4'));var router=express[_0x24f9('0x5')]();var fs_extra=require(_0x24f9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x24f9('0x7'));var config=require(_0x24f9('0x8'));var controller=require(_0x24f9('0x9'));router[_0x24f9('0xa')]('/',auth[_0x24f9('0xb')](),controller['sendUserNotification']);module[_0x24f9('0xc')]=router; \ No newline at end of file +var _0xe4e0=['express','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','util','path','connect-timeout'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0xe4e0,0x11d));var _0x0e4e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xe4e0[_0x5447fd];return _0x15b28a;};'use strict';var multer=require('multer');var util=require(_0x0e4e('0x0'));var path=require(_0x0e4e('0x1'));var timeout=require(_0x0e4e('0x2'));var express=require(_0x0e4e('0x3'));var router=express['Router']();var fs_extra=require(_0x0e4e('0x4'));var auth=require(_0x0e4e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0e4e('0x6'));var controller=require(_0x0e4e('0x7'));router[_0x0e4e('0x8')]('/',auth[_0x0e4e('0x9')](),controller[_0x0e4e('0xa')]);module[_0x0e4e('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index b62fe08..b7369e2 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 _0x4f2d=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4f092c,_0x56f16a){var _0x481529=function(_0x426b03){while(--_0x426b03){_0x4f092c['push'](_0x4f092c['shift']());}};_0x481529(++_0x56f16a);}(_0x4f2d,0x1ce));var _0xd4f2=function(_0xc2dc1d,_0x69552c){_0xc2dc1d=_0xc2dc1d-0x0;var _0xd37483=_0x4f2d[_0xc2dc1d];return _0xd37483;};'use strict';var Sequelize=require(_0xd4f2('0x0'));module[_0xd4f2('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xd4f2('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xd4f2('0x2')]},'beep':{'type':Sequelize[_0xd4f2('0x3')]}}; \ No newline at end of file +var _0x1b90=['BOOLEAN','exports','TEXT','STRING'];(function(_0x28bccc,_0x436ada){var _0x5900d0=function(_0x1a2b5f){while(--_0x1a2b5f){_0x28bccc['push'](_0x28bccc['shift']());}};_0x5900d0(++_0x436ada);}(_0x1b90,0x7d));var _0x01b9=function(_0x390562,_0x514ec5){_0x390562=_0x390562-0x0;var _0x1ffe39=_0x1b90[_0x390562];return _0x1ffe39;};'use strict';var Sequelize=require('sequelize');module[_0x01b9('0x0')]={'body':{'type':Sequelize[_0x01b9('0x1')]},'senderName':{'type':Sequelize[_0x01b9('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x01b9('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index f4acbd5..91683fa 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 _0xaea9=['sequelize','create','forEach','recipient','emit','userNotification:send','catch','text','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','union','ids','includes','queue','Queue','push','all','getAgents','map','rimraf','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/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./userNotification.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','then','destroy','error','stack','name','sendUserNotification','hasOwnProperty','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join'];(function(_0x2c5eb8,_0x2af07e){var _0x3f4509=function(_0x233f44){while(--_0x233f44){_0x2c5eb8['push'](_0x2c5eb8['shift']());}};_0x3f4509(++_0x2af07e);}(_0xaea9,0x149));var _0x9aea=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xaea9[_0x1e7b16];return _0x37fadc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9aea('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9aea('0x1'));var rp=require(_0x9aea('0x2'));var moment=require(_0x9aea('0x3'));var BPromise=require(_0x9aea('0x4'));var Mustache=require(_0x9aea('0x5'));var util=require(_0x9aea('0x6'));var path=require(_0x9aea('0x7'));var sox=require(_0x9aea('0x8'));var csv=require(_0x9aea('0x9'));var ejs=require(_0x9aea('0xa'));var fs=require('fs');var fs_extra=require(_0x9aea('0xb'));var _=require(_0x9aea('0xc'));var squel=require(_0x9aea('0xd'));var crypto=require(_0x9aea('0xe'));var jsforce=require(_0x9aea('0xf'));var deskjs=require(_0x9aea('0x10'));var toCsv=require(_0x9aea('0x9'));var querystring=require(_0x9aea('0x11'));var Papa=require(_0x9aea('0x12'));var Redis=require(_0x9aea('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9aea('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9aea('0x15'));var logger=require(_0x9aea('0x16'))('api');var utils=require(_0x9aea('0x17'));var config=require(_0x9aea('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9aea('0x19'))['db'];config[_0x9aea('0x1a')]=_[_0x9aea('0x1b')](config[_0x9aea('0x1a')],{'host':_0x9aea('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9aea('0x1a')]));require(_0x9aea('0x1d'))['register'](socket);function respondWithStatusCode(_0x279091,_0x3c6237){_0x3c6237=_0x3c6237||0xcc;return function(_0x41898a){if(_0x41898a){return _0x279091[_0x9aea('0x1e')](_0x3c6237);}return _0x279091[_0x9aea('0x1f')](_0x3c6237)[_0x9aea('0x20')]();};}function respondWithResult(_0x57d9f6,_0x4c9d89){_0x4c9d89=_0x4c9d89||0xc8;return function(_0x3fbea1){if(_0x3fbea1){return _0x57d9f6[_0x9aea('0x1f')](_0x4c9d89)[_0x9aea('0x21')](_0x3fbea1);}};}function respondWithFilteredResult(_0x418cbe,_0xe42072){return function(_0x3ffb39){if(_0x3ffb39){var _0x27086c=typeof _0xe42072[_0x9aea('0x22')]==='undefined'&&typeof _0xe42072[_0x9aea('0x23')]===_0x9aea('0x24');var _0x3a58b8=_0x3ffb39[_0x9aea('0x25')];var _0x3fb3f5=_0x27086c?0x0:_0xe42072[_0x9aea('0x22')];var _0x35703b=_0x27086c?_0x3ffb39[_0x9aea('0x25')]:_0xe42072[_0x9aea('0x22')]+_0xe42072[_0x9aea('0x23')];var _0x2067c0;if(_0x35703b>=_0x3a58b8){_0x35703b=_0x3a58b8;_0x2067c0=0xc8;}else{_0x2067c0=0xce;}_0x418cbe[_0x9aea('0x1f')](_0x2067c0);return _0x418cbe[_0x9aea('0x26')](_0x9aea('0x27'),_0x3fb3f5+'-'+_0x35703b+'/'+_0x3a58b8)['json'](_0x3ffb39);}return null;};}function patchUpdates(_0x1d824a){return function(_0x2d164c){try{jsonpatch['apply'](_0x2d164c,_0x1d824a,!![]);}catch(_0x2f6bb6){return BPromise['reject'](_0x2f6bb6);}return _0x2d164c[_0x9aea('0x28')]();};}function saveUpdates(_0x447b5a,_0x1787f7){return function(_0x12f324){if(_0x12f324){return _0x12f324['update'](_0x447b5a)[_0x9aea('0x29')](function(_0x36a850){return _0x36a850;});}return null;};}function removeEntity(_0x3941c0,_0x4ad027){return function(_0x13a50c){if(_0x13a50c){return _0x13a50c[_0x9aea('0x2a')]()[_0x9aea('0x29')](function(){_0x3941c0[_0x9aea('0x1f')](0xcc)[_0x9aea('0x20')]();});}};}function handleEntityNotFound(_0x39fb25,_0x5d50e3){return function(_0x22bb5){if(!_0x22bb5){_0x39fb25['sendStatus'](0x194);}return _0x22bb5;};}function handleError(_0x4db90f,_0x26e53c){_0x26e53c=_0x26e53c||0x1f4;return function(_0x4cefae){logger[_0x9aea('0x2b')](_0x4cefae[_0x9aea('0x2c')]);if(_0x4cefae[_0x9aea('0x2d')]){delete _0x4cefae[_0x9aea('0x2d')];}_0x4db90f[_0x9aea('0x1f')](_0x26e53c)['send'](_0x4cefae);};}exports[_0x9aea('0x2e')]=function(_0x3a5350,_0x42c6f4,_0x352ea5){if(!_0x3a5350['body'][_0x9aea('0x2f')]('text')&&!_0x3a5350[_0x9aea('0x30')][_0x9aea('0x2f')](_0x9aea('0x31'))){throw new db[(_0x9aea('0x32'))][(_0x9aea('0x33'))](_0x9aea('0x34'));}else{if(_0x3a5350[_0x9aea('0x30')]['hasOwnProperty'](_0x9aea('0x31'))&&!_0x3a5350[_0x9aea('0x30')]['hasOwnProperty'](_0x9aea('0x35'))){throw new db['Sequelize']['ValidationError'](_0x9aea('0x36'));}if(!_0x3a5350[_0x9aea('0x30')][_0x9aea('0x2f')](_0x9aea('0x37'))){throw new db[(_0x9aea('0x32'))][(_0x9aea('0x33'))](_0x9aea('0x38'));}else{try{var _0x2da02a=JSON[_0x9aea('0x39')](_0x3a5350[_0x9aea('0x30')][_0x9aea('0x37')]);}catch(_0x5ca2f4){logger['error'](_0x5ca2f4);throw new db['Sequelize'][(_0x9aea('0x33'))](_0x9aea('0x3a'));}var _0x1a0b1e=[_0x9aea('0x3b'),_0x9aea('0x3c'),_0x9aea('0x3d'),_0x9aea('0x3e'),_0x9aea('0x3f'),_0x9aea('0x40'),'whatsappqueue',_0x9aea('0x41'),'user'];if(_[_0x9aea('0x42')](_0x2da02a,function(_0x5e1534){return!_['includes'](_0x1a0b1e,_0x5e1534[_0x9aea('0x43')][_0x9aea('0x44')]());})){throw new db[(_0x9aea('0x32'))][(_0x9aea('0x33'))](_0x9aea('0x45'));}}}var _0x33413e={};_0x33413e[_0x9aea('0x46')]=_0x3a5350[_0x9aea('0x30')]['hasOwnProperty'](_0x9aea('0x46'))?_0x3a5350['body'][_0x9aea('0x46')]:_0x3a5350[_0x9aea('0x47')][_0x9aea('0x48')];_0x33413e[_0x9aea('0x49')]=_[_0x9aea('0x4a')](_0x3a5350[_0x9aea('0x30')][_0x9aea('0x49')])?null:_0x3a5350[_0x9aea('0x30')]['recipientsDescription'];_0x33413e[_0x9aea('0x4b')]=_0x3a5350['body']['beep']||![];_0x33413e['SenderId']=_0x3a5350[_0x9aea('0x47')]['id'];return getContent(_0x3a5350[_0x9aea('0x30')])[_0x9aea('0x29')](function(_0x36378a){_0x33413e[_0x9aea('0x30')]=_0x36378a;return getRecipients(_0x2da02a);})['then'](function(_0x43cfca){_0x33413e[_0x9aea('0x4c')]=_[_0x9aea('0x4d')](_0x43cfca)[_0x9aea('0x4e')](',');return db[_0x9aea('0x4f')]['transaction'](function(_0x395db9){return db['UserNotification'][_0x9aea('0x50')](_0x33413e,{'raw':!![],'transaction':_0x395db9})[_0x9aea('0x29')](function(_0x19952e){var _0x51cda7={'sender':_0x33413e[_0x9aea('0x46')],'description':_0x33413e['recipientsDescription'],'content':_0x33413e[_0x9aea('0x30')],'beep':_0x33413e[_0x9aea('0x4b')]};_0x43cfca[_0x9aea('0x51')](function(_0x3c985e){_0x51cda7[_0x9aea('0x52')]=_0x3c985e;socket[_0x9aea('0x53')](_0x9aea('0x54'),_0x51cda7);});return _0x19952e;});});})[_0x9aea('0x29')](respondWithResult(_0x42c6f4,0xc9))[_0x9aea('0x55')](handleError(_0x42c6f4,null));};function getContent(_0xc8f896){return new BPromise(function(_0x446448,_0x5bdec5){if(_0xc8f896['text']){_0x446448(_0xc8f896[_0x9aea('0x56')]);return;}return db['Template'][_0x9aea('0x57')]({'attributes':['html'],'where':{'id':_0xc8f896[_0x9aea('0x31')]},'raw':!![]})[_0x9aea('0x29')](function(_0x251632){if(!_0x251632)throw new db[(_0x9aea('0x32'))]['ValidationError'](_0x9aea('0x58'));var _0x207936=Mustache[_0x9aea('0x59')](_0x251632[_0x9aea('0x5a')],_0xc8f896[_0x9aea('0x35')]);_0x446448(_0x207936);})[_0x9aea('0x55')](function(_0xaf958c){_0x5bdec5(_0xaf958c);});});}function getRecipients(_0x432a27){return new BPromise(function(_0x44e6bf,_0x44e1c2){var _0x2e98fd=[];var _0x1ef441=[];_0x432a27[_0x9aea('0x51')](function(_0x3c99e3){var _0x4af6b7=_[_0x9aea('0x5b')](_0x3c99e3[_0x9aea('0x43')][_0x9aea('0x44')]());if(_0x4af6b7===_0x9aea('0x5c')){_0x2e98fd=_[_0x9aea('0x5d')](_0x2e98fd,_0x3c99e3[_0x9aea('0x5e')]);}else{if(_[_0x9aea('0x5f')](_0x4af6b7,_0x9aea('0x60')))_0x4af6b7=_0x4af6b7['replace']('queue',_0x9aea('0x61'));_0x3c99e3[_0x9aea('0x5e')]['forEach'](function(_0x376495){_0x1ef441[_0x9aea('0x62')](getAgents(_0x4af6b7,_0x376495));});}});return BPromise[_0x9aea('0x63')](_0x1ef441)[_0x9aea('0x29')](function(_0x2a6ce4){_0x2e98fd=_['union'](_0x2e98fd,_['flatten'](_0x2a6ce4));_0x44e6bf(_0x2e98fd);})[_0x9aea('0x55')](function(_0x49a67a){_0x44e1c2(_0x49a67a);});});}function getAgents(_0x360013,_0x1fd172){return new BPromise(function(_0x51a36d,_0x12cc07){return db[_0x360013]['findOne']({'where':{'id':_0x1fd172}})[_0x9aea('0x29')](function(_0x17663f){return _0x17663f[_0x9aea('0x64')]({'attributes':['id'],'raw':!![]})[_0x9aea('0x29')](function(_0x1cc11f){var _0x2d8056=_[_0x9aea('0x65')](_0x1cc11f,'id');_0x51a36d(_0x2d8056);});})[_0x9aea('0x55')](function(_0x2528df){_0x12cc07(_0x2528df);});});} \ No newline at end of file +var _0x9fc3=['send','sendUserNotification','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','parse','chatqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','emit','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','User','union','ids','queue','replace','all','getAgents','map','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','destroy','then','error','stack','name'];(function(_0x6a8acd,_0x59e0f2){var _0x36fc71=function(_0x2ff6a5){while(--_0x2ff6a5){_0x6a8acd['push'](_0x6a8acd['shift']());}};_0x36fc71(++_0x59e0f2);}(_0x9fc3,0x1ed));var _0x39fc=function(_0x27e78a,_0x19a060){_0x27e78a=_0x27e78a-0x0;var _0x506cf8=_0x9fc3[_0x27e78a];return _0x506cf8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x39fc('0x0'));var rp=require(_0x39fc('0x1'));var moment=require(_0x39fc('0x2'));var BPromise=require(_0x39fc('0x3'));var Mustache=require(_0x39fc('0x4'));var util=require('util');var path=require(_0x39fc('0x5'));var sox=require(_0x39fc('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39fc('0x7'));var _=require('lodash');var squel=require(_0x39fc('0x8'));var crypto=require('crypto');var jsforce=require(_0x39fc('0x9'));var deskjs=require(_0x39fc('0xa'));var toCsv=require(_0x39fc('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x39fc('0xc'));var authService=require(_0x39fc('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x39fc('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39fc('0xf'))(_0x39fc('0x10'));var utils=require(_0x39fc('0x11'));var config=require(_0x39fc('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x39fc('0x13')]=_[_0x39fc('0x14')](config[_0x39fc('0x13')],{'host':_0x39fc('0x15'),'port':0x18eb});var socket=require(_0x39fc('0x16'))(new Redis(config['redis']));require(_0x39fc('0x17'))[_0x39fc('0x18')](socket);function respondWithStatusCode(_0x35f6bf,_0x5b57bf){_0x5b57bf=_0x5b57bf||0xcc;return function(_0x1b7b93){if(_0x1b7b93){return _0x35f6bf[_0x39fc('0x19')](_0x5b57bf);}return _0x35f6bf[_0x39fc('0x1a')](_0x5b57bf)[_0x39fc('0x1b')]();};}function respondWithResult(_0x1d3f31,_0x4e3ce3){_0x4e3ce3=_0x4e3ce3||0xc8;return function(_0x2c9e3b){if(_0x2c9e3b){return _0x1d3f31[_0x39fc('0x1a')](_0x4e3ce3)['json'](_0x2c9e3b);}};}function respondWithFilteredResult(_0x23eb48,_0x364ad3){return function(_0x48a0c7){if(_0x48a0c7){var _0x521206=typeof _0x364ad3[_0x39fc('0x1c')]==='undefined'&&typeof _0x364ad3[_0x39fc('0x1d')]===_0x39fc('0x1e');var _0x1bf524=_0x48a0c7[_0x39fc('0x1f')];var _0x328164=_0x521206?0x0:_0x364ad3[_0x39fc('0x1c')];var _0x16fd23=_0x521206?_0x48a0c7[_0x39fc('0x1f')]:_0x364ad3[_0x39fc('0x1c')]+_0x364ad3[_0x39fc('0x1d')];var _0x4a20eb;if(_0x16fd23>=_0x1bf524){_0x16fd23=_0x1bf524;_0x4a20eb=0xc8;}else{_0x4a20eb=0xce;}_0x23eb48[_0x39fc('0x1a')](_0x4a20eb);return _0x23eb48[_0x39fc('0x20')]('Content-Range',_0x328164+'-'+_0x16fd23+'/'+_0x1bf524)['json'](_0x48a0c7);}return null;};}function patchUpdates(_0x41eff5){return function(_0x1333c8){try{jsonpatch[_0x39fc('0x21')](_0x1333c8,_0x41eff5,!![]);}catch(_0x1cbe65){return BPromise[_0x39fc('0x22')](_0x1cbe65);}return _0x1333c8[_0x39fc('0x23')]();};}function saveUpdates(_0x3f5866,_0x2eeb93){return function(_0x7fe28d){if(_0x7fe28d){return _0x7fe28d['update'](_0x3f5866)['then'](function(_0xb27321){return _0xb27321;});}return null;};}function removeEntity(_0x3fc7ad,_0x44a1cc){return function(_0x54d7d1){if(_0x54d7d1){return _0x54d7d1[_0x39fc('0x24')]()[_0x39fc('0x25')](function(){_0x3fc7ad['status'](0xcc)[_0x39fc('0x1b')]();});}};}function handleEntityNotFound(_0x13657d,_0x4cfb29){return function(_0x5e9f27){if(!_0x5e9f27){_0x13657d[_0x39fc('0x19')](0x194);}return _0x5e9f27;};}function handleError(_0x23c5a9,_0x49d6ed){_0x49d6ed=_0x49d6ed||0x1f4;return function(_0x27a419){logger[_0x39fc('0x26')](_0x27a419[_0x39fc('0x27')]);if(_0x27a419[_0x39fc('0x28')]){delete _0x27a419[_0x39fc('0x28')];}_0x23c5a9['status'](_0x49d6ed)[_0x39fc('0x29')](_0x27a419);};}exports[_0x39fc('0x2a')]=function(_0x124634,_0x251944,_0xd3d0a9){if(!_0x124634[_0x39fc('0x2b')][_0x39fc('0x2c')]('text')&&!_0x124634[_0x39fc('0x2b')][_0x39fc('0x2c')](_0x39fc('0x2d'))){throw new db[(_0x39fc('0x2e'))][(_0x39fc('0x2f'))](_0x39fc('0x30'));}else{if(_0x124634[_0x39fc('0x2b')][_0x39fc('0x2c')]('TemplateId')&&!_0x124634[_0x39fc('0x2b')][_0x39fc('0x2c')](_0x39fc('0x31'))){throw new db[(_0x39fc('0x2e'))][(_0x39fc('0x2f'))](_0x39fc('0x32'));}if(!_0x124634['body']['hasOwnProperty']('recipients')){throw new db[(_0x39fc('0x2e'))][(_0x39fc('0x2f'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x3e3aac=JSON[_0x39fc('0x33')](_0x124634[_0x39fc('0x2b')]['recipients']);}catch(_0x4f8b6b){logger['error'](_0x4f8b6b);throw new db[(_0x39fc('0x2e'))][(_0x39fc('0x2f'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x2c518c=[_0x39fc('0x34'),'faxqueue','mailqueue',_0x39fc('0x35'),_0x39fc('0x36'),_0x39fc('0x37'),_0x39fc('0x38'),'team',_0x39fc('0x39')];if(_[_0x39fc('0x3a')](_0x3e3aac,function(_0x5372bb){return!_[_0x39fc('0x3b')](_0x2c518c,_0x5372bb[_0x39fc('0x3c')][_0x39fc('0x3d')]());})){throw new db[(_0x39fc('0x2e'))][(_0x39fc('0x2f'))](_0x39fc('0x3e'));}}}var _0x4364c7={};_0x4364c7[_0x39fc('0x3f')]=_0x124634[_0x39fc('0x2b')][_0x39fc('0x2c')]('senderName')?_0x124634[_0x39fc('0x2b')]['senderName']:_0x124634[_0x39fc('0x39')]['fullname'];_0x4364c7[_0x39fc('0x40')]=_['isEmpty'](_0x124634['body'][_0x39fc('0x40')])?null:_0x124634[_0x39fc('0x2b')][_0x39fc('0x40')];_0x4364c7['beep']=_0x124634[_0x39fc('0x2b')][_0x39fc('0x41')]||![];_0x4364c7[_0x39fc('0x42')]=_0x124634[_0x39fc('0x39')]['id'];return getContent(_0x124634[_0x39fc('0x2b')])[_0x39fc('0x25')](function(_0x32c369){_0x4364c7[_0x39fc('0x2b')]=_0x32c369;return getRecipients(_0x3e3aac);})[_0x39fc('0x25')](function(_0x4ce90e){_0x4364c7['recipientsId']=_[_0x39fc('0x43')](_0x4ce90e)[_0x39fc('0x44')](',');return db[_0x39fc('0x45')][_0x39fc('0x46')](function(_0x199fdd){return db[_0x39fc('0x47')]['create'](_0x4364c7,{'raw':!![],'transaction':_0x199fdd})[_0x39fc('0x25')](function(_0x39cafe){var _0x55b204={'sender':_0x4364c7[_0x39fc('0x3f')],'description':_0x4364c7[_0x39fc('0x40')],'content':_0x4364c7[_0x39fc('0x2b')],'beep':_0x4364c7['beep']};_0x4ce90e['forEach'](function(_0x178116){_0x55b204['recipient']=_0x178116;socket[_0x39fc('0x48')]('userNotification:send',_0x55b204);});return _0x39cafe;});});})['then'](respondWithResult(_0x251944,0xc9))[_0x39fc('0x49')](handleError(_0x251944,null));};function getContent(_0x58df6b){return new BPromise(function(_0x4b941b,_0x366ff9){if(_0x58df6b[_0x39fc('0x4a')]){_0x4b941b(_0x58df6b[_0x39fc('0x4a')]);return;}return db[_0x39fc('0x4b')][_0x39fc('0x4c')]({'attributes':[_0x39fc('0x4d')],'where':{'id':_0x58df6b['TemplateId']},'raw':!![]})[_0x39fc('0x25')](function(_0x4ce514){if(!_0x4ce514)throw new db[(_0x39fc('0x2e'))][(_0x39fc('0x2f'))](_0x39fc('0x4e'));var _0x736fa9=Mustache[_0x39fc('0x4f')](_0x4ce514['html'],_0x58df6b[_0x39fc('0x31')]);_0x4b941b(_0x736fa9);})[_0x39fc('0x49')](function(_0x3e6d68){_0x366ff9(_0x3e6d68);});});}function getRecipients(_0x396489){return new BPromise(function(_0x13e0c2,_0x434b21){var _0x1e58bd=[];var _0x4082f2=[];_0x396489[_0x39fc('0x50')](function(_0x3d09c4){var _0x20bfc2=_['startCase'](_0x3d09c4[_0x39fc('0x3c')]['toLowerCase']());if(_0x20bfc2===_0x39fc('0x51')){_0x1e58bd=_[_0x39fc('0x52')](_0x1e58bd,_0x3d09c4[_0x39fc('0x53')]);}else{if(_[_0x39fc('0x3b')](_0x20bfc2,_0x39fc('0x54')))_0x20bfc2=_0x20bfc2[_0x39fc('0x55')](_0x39fc('0x54'),'Queue');_0x3d09c4[_0x39fc('0x53')][_0x39fc('0x50')](function(_0x50b536){_0x4082f2['push'](getAgents(_0x20bfc2,_0x50b536));});}});return BPromise[_0x39fc('0x56')](_0x4082f2)[_0x39fc('0x25')](function(_0x5ee2ca){_0x1e58bd=_['union'](_0x1e58bd,_['flatten'](_0x5ee2ca));_0x13e0c2(_0x1e58bd);})['catch'](function(_0x1e127c){_0x434b21(_0x1e127c);});});}function getAgents(_0x183678,_0x39d611){return new BPromise(function(_0x151190,_0x1dd8b3){return db[_0x183678][_0x39fc('0x4c')]({'where':{'id':_0x39d611}})[_0x39fc('0x25')](function(_0x1817a9){return _0x1817a9[_0x39fc('0x57')]({'attributes':['id'],'raw':!![]})[_0x39fc('0x25')](function(_0x6e221a){var _0x5b9aea=_[_0x39fc('0x58')](_0x6e221a,'id');_0x151190(_0x5b9aea);});})['catch'](function(_0x1b31a5){_0x1dd8b3(_0x1b31a5);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index caece37..9b5e095 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 _0x9f58=['events','../../mysqldb','UserNotification','setMaxListeners','save','remove','emit'];(function(_0x53c83a,_0x2a441b){var _0x390792=function(_0x424145){while(--_0x424145){_0x53c83a['push'](_0x53c83a['shift']());}};_0x390792(++_0x2a441b);}(_0x9f58,0x1b2));var _0x89f5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9f58[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x89f5('0x0'));var UserNotification=require(_0x89f5('0x1'))['db'][_0x89f5('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x89f5('0x3')](0x0);var events={'afterCreate':_0x89f5('0x4'),'afterUpdate':'update','afterDestroy':_0x89f5('0x5')};function emitEvent(_0x590d04){return function(_0x3de77,_0x5b6404,_0x124264){UserNotificationEvents['emit'](_0x590d04+':'+_0x3de77['id'],_0x3de77);UserNotificationEvents[_0x89f5('0x6')](_0x590d04,_0x3de77);_0x124264(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x6869=['emit','hasOwnProperty','hook','exports','UserNotification','save','update','remove'];(function(_0x7a0134,_0x33ee65){var _0x2bcfc1=function(_0x50c6cd){while(--_0x50c6cd){_0x7a0134['push'](_0x7a0134['shift']());}};_0x2bcfc1(++_0x33ee65);}(_0x6869,0x1bc));var _0x9686=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6869[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x9686('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9686('0x1'),'afterUpdate':_0x9686('0x2'),'afterDestroy':_0x9686('0x3')};function emitEvent(_0x3219a8){return function(_0x586d74,_0x1c6f53,_0x392b68){UserNotificationEvents[_0x9686('0x4')](_0x3219a8+':'+_0x586d74['id'],_0x586d74);UserNotificationEvents[_0x9686('0x4')](_0x3219a8,_0x586d74);_0x392b68(null);};}for(var e in events){if(events[_0x9686('0x5')](e)){var event=events[e];UserNotification[_0x9686('0x6')](e,emitEvent(event));}}module[_0x9686('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 48a4ce6..5739c34 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 _0xc4ff=['userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc4ff,0x111));var _0xfc4f=function(_0x1cb55d,_0xd9537){_0x1cb55d=_0x1cb55d-0x0;var _0xa553ca=_0xc4ff[_0x1cb55d];return _0xa553ca;};'use strict';var _=require('lodash');var util=require(_0xfc4f('0x0'));var logger=require(_0xfc4f('0x1'))(_0xfc4f('0x2'));var moment=require(_0xfc4f('0x3'));var BPromise=require(_0xfc4f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc4f('0x5'));var rimraf=require(_0xfc4f('0x6'));var config=require(_0xfc4f('0x7'));var attributes=require(_0xfc4f('0x8'));module[_0xfc4f('0x9')]=function(_0x260a13,_0x191269){return _0x260a13[_0xfc4f('0xa')](_0xfc4f('0xb'),attributes,{'tableName':_0xfc4f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfc4f('0xd'),'collate':_0xfc4f('0xe')});}; \ No newline at end of file +var _0xd4aa=['../../config/logger','moment','bluebird','path','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x9ea8e2,_0x20cc78){var _0x48aa73=function(_0x3a6196){while(--_0x3a6196){_0x9ea8e2['push'](_0x9ea8e2['shift']());}};_0x48aa73(++_0x20cc78);}(_0xd4aa,0x8d));var _0xad4a=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xd4aa[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0xad4a('0x0'));var util=require(_0xad4a('0x1'));var logger=require(_0xad4a('0x2'))('api');var moment=require(_0xad4a('0x3'));var BPromise=require(_0xad4a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad4a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xad4a('0x6'));module[_0xad4a('0x7')]=function(_0x4b6715,_0x3e8f36){return _0x4b6715[_0xad4a('0x8')](_0xad4a('0x9'),attributes,{'tableName':_0xad4a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xad4a('0xb'),'collate':_0xad4a('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 0a49d71..d1f702b 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 _0x913d=['localhost','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x36519a,_0x264ce2){var _0x43a91e=function(_0x320b05){while(--_0x320b05){_0x36519a['push'](_0x36519a['shift']());}};_0x43a91e(++_0x264ce2);}(_0x913d,0x1b7));var _0xd913=function(_0x2d7972,_0x27e99c){_0x2d7972=_0x2d7972-0x0;var _0x4b054d=_0x913d[_0x2d7972];return _0x4b054d;};'use strict';var _=require(_0xd913('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd913('0x1'));var rs=require(_0xd913('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd913('0x3'))['db'];var utils=require(_0xd913('0x4'));var logger=require(_0xd913('0x5'))(_0xd913('0x6'));var config=require('../../config/environment');var jayson=require(_0xd913('0x7'));var client=jayson[_0xd913('0x8')][_0xd913('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd913('0xa')],{'host':_0xd913('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd913('0xa')]));require('./userNotification.socket')[_0xd913('0xc')](socket);function respondWithRpcPromise(_0x3252e2,_0x56c748,_0x5a89bf){return new BPromise(function(_0x9376ad,_0x2d1f20){return client[_0xd913('0xd')](_0x3252e2,_0x5a89bf)[_0xd913('0xe')](function(_0x4707d8){logger['info'](_0xd913('0xf'),_0x56c748,_0xd913('0x10'));logger[_0xd913('0x11')](_0xd913('0x12'),_0x56c748,_0xd913('0x10'),JSON[_0xd913('0x13')](_0x4707d8));if(_0x4707d8['error']){if(_0x4707d8[_0xd913('0x14')][_0xd913('0x15')]===0x1f4){logger[_0xd913('0x14')](_0xd913('0xf'),_0x56c748,_0x4707d8[_0xd913('0x14')][_0xd913('0x16')]);return _0x2d1f20(_0x4707d8[_0xd913('0x14')][_0xd913('0x16')]);}logger[_0xd913('0x14')](_0xd913('0xf'),_0x56c748,_0x4707d8['error']['message']);return _0x9376ad(_0x4707d8[_0xd913('0x14')][_0xd913('0x16')]);}else{logger[_0xd913('0x17')](_0xd913('0xf'),_0x56c748,_0xd913('0x10'));_0x9376ad(_0x4707d8['result'][_0xd913('0x16')]);}})[_0xd913('0x18')](function(_0x2d2a68){logger[_0xd913('0x14')]('UserNotification,\x20%s,\x20%s',_0x56c748,_0x2d2a68);_0x2d1f20(_0x2d2a68);});});} \ No newline at end of file +var _0x0aab=['UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request'];(function(_0x290b36,_0x2e6172){var _0x1fa11a=function(_0x116c79){while(--_0x116c79){_0x290b36['push'](_0x290b36['shift']());}};_0x1fa11a(++_0x2e6172);}(_0x0aab,0x1b2));var _0xb0aa=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0x0aab[_0x13843f];return _0x1063ae;};'use strict';var _=require(_0xb0aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb0aa('0x1'));var rs=require(_0xb0aa('0x2'));var fs=require('fs');var Redis=require(_0xb0aa('0x3'));var db=require(_0xb0aa('0x4'))['db'];var utils=require(_0xb0aa('0x5'));var logger=require(_0xb0aa('0x6'))(_0xb0aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb0aa('0x8')][_0xb0aa('0x9')]({'port':0x232a});config[_0xb0aa('0xa')]=_['defaults'](config[_0xb0aa('0xa')],{'host':_0xb0aa('0xb'),'port':0x18eb});var socket=require(_0xb0aa('0xc'))(new Redis(config[_0xb0aa('0xa')]));require(_0xb0aa('0xd'))[_0xb0aa('0xe')](socket);function respondWithRpcPromise(_0x25d5a2,_0x3e99e0,_0x729cee){return new BPromise(function(_0x13172a,_0x8348b3){return client[_0xb0aa('0xf')](_0x25d5a2,_0x729cee)['then'](function(_0x1e4a65){logger['info'](_0xb0aa('0x10'),_0x3e99e0,_0xb0aa('0x11'));logger[_0xb0aa('0x12')](_0xb0aa('0x13'),_0x3e99e0,_0xb0aa('0x11'),JSON['stringify'](_0x1e4a65));if(_0x1e4a65[_0xb0aa('0x14')]){if(_0x1e4a65[_0xb0aa('0x14')]['code']===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x3e99e0,_0x1e4a65[_0xb0aa('0x14')]['message']);return _0x8348b3(_0x1e4a65['error'][_0xb0aa('0x15')]);}logger[_0xb0aa('0x14')](_0xb0aa('0x10'),_0x3e99e0,_0x1e4a65['error'][_0xb0aa('0x15')]);return _0x13172a(_0x1e4a65[_0xb0aa('0x14')][_0xb0aa('0x15')]);}else{logger[_0xb0aa('0x16')](_0xb0aa('0x10'),_0x3e99e0,'request\x20sent');_0x13172a(_0x1e4a65[_0xb0aa('0x17')][_0xb0aa('0x15')]);}})[_0xb0aa('0x18')](function(_0x1db089){logger['error'](_0xb0aa('0x10'),_0x3e99e0,_0x1db089);_0x8348b3(_0x1db089);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 465d4dc..4de0f6e 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 _0x13bf=['save','emit','removeListener','length'];(function(_0x3777c4,_0x5dc039){var _0x20551e=function(_0x375f76){while(--_0x375f76){_0x3777c4['push'](_0x3777c4['shift']());}};_0x20551e(++_0x5dc039);}(_0x13bf,0x1f4));var _0xf13b=function(_0x6245f4,_0x32e4b5){_0x6245f4=_0x6245f4-0x0;var _0x349eec=_0x13bf[_0x6245f4];return _0x349eec;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xf13b('0x0'),'remove','update'];function createListener(_0x518f13,_0x259774){return function(_0x58e3fb){_0x259774[_0xf13b('0x1')](_0x518f13,_0x58e3fb);};}function removeListener(_0x1d2984,_0x140e02){return function(){UserNotificationEvents[_0xf13b('0x2')](_0x1d2984,_0x140e02);};}exports['register']=function(_0x56ab64){for(var _0x233dab=0x0,_0x4aa648=events[_0xf13b('0x3')];_0x233dab<_0x4aa648;_0x233dab++){var _0x410b42=events[_0x233dab];var _0x120fdc=createListener('userNotification:'+_0x410b42,_0x56ab64);UserNotificationEvents['on'](_0x410b42,_0x120fdc);}}; \ No newline at end of file +var _0x3a4c=['save','update','register','length','userNotification:'];(function(_0x4dc7d5,_0x4087e2){var _0x22aa45=function(_0x238b8b){while(--_0x238b8b){_0x4dc7d5['push'](_0x4dc7d5['shift']());}};_0x22aa45(++_0x4087e2);}(_0x3a4c,0x14f));var _0xc3a4=function(_0x216780,_0x521052){_0x216780=_0x216780-0x0;var _0x4ef487=_0x3a4c[_0x216780];return _0x4ef487;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xc3a4('0x0'),'remove',_0xc3a4('0x1')];function createListener(_0xfcaa74,_0x36fe50){return function(_0x1b0ad0){_0x36fe50['emit'](_0xfcaa74,_0x1b0ad0);};}function removeListener(_0x3dda84,_0x56b7e){return function(){UserNotificationEvents['removeListener'](_0x3dda84,_0x56b7e);};}exports[_0xc3a4('0x2')]=function(_0x3ff191){for(var _0x419932=0x0,_0x41cc9a=events[_0xc3a4('0x3')];_0x419932<_0x41cc9a;_0x419932++){var _0x14676a=events[_0x419932];var _0x48380c=createListener(_0xc3a4('0x4')+_0x14676a,_0x3ff191);UserNotificationEvents['on'](_0x14676a,_0x48380c);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 50a92a8..782dcda 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(_0x4c3e50,_0x184114){var _0x15b4d2=function(_0x2f47c2){while(--_0x2f47c2){_0x4c3e50['push'](_0x4c3e50['shift']());}};_0x15b4d2(++_0x184114);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xcb91[_0xe39824];return _0x4bc31e;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x558fd7,_0x28aa87){var _0x41a21d=function(_0x4b096f){while(--_0x4b096f){_0x558fd7['push'](_0x558fd7['shift']());}};_0x41a21d(++_0x28aa87);}(_0x70e0,0x17b));var _0x070e=function(_0x24e9f8,_0x5ad5b4){_0x24e9f8=_0x24e9f8-0x0;var _0x25ad74=_0x70e0[_0x24e9f8];return _0x25ad74;};'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');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 123b988..5f04f9d 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 _0xbc12=['exports','sequelize'];(function(_0x5d97be,_0x420e45){var _0x3a9148=function(_0x4aa068){while(--_0x4aa068){_0x5d97be['push'](_0x5d97be['shift']());}};_0x3a9148(++_0x420e45);}(_0xbc12,0xc1));var _0x2bc1=function(_0x459b3e,_0x5a0c7a){_0x459b3e=_0x459b3e-0x0;var _0xaf15e4=_0xbc12[_0x459b3e];return _0xaf15e4;};'use strict';var Sequelize=require(_0x2bc1('0x0'));module[_0x2bc1('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc03a=['sequelize','exports','INTEGER'];(function(_0x22bd06,_0x2322e4){var _0x3a02c6=function(_0x225727){while(--_0x225727){_0x22bd06['push'](_0x22bd06['shift']());}};_0x3a02c6(++_0x2322e4);}(_0xc03a,0x1e3));var _0xac03=function(_0x1eff8e,_0x3dc442){_0x1eff8e=_0x1eff8e-0x0;var _0x251652=_0xc03a[_0x1eff8e];return _0x251652;};'use strict';var Sequelize=require(_0xac03('0x0'));module[_0xac03('0x1')]={'penalty':{'type':Sequelize[_0xac03('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 4b2521a..5c36e59 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 _0x8e66=['exports','define','UserOpenchannelQueue','lodash','../../config/logger','api','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8e66,0xa3));var _0x68e6=function(_0x416a0a,_0x24f91f){_0x416a0a=_0x416a0a-0x0;var _0x574c9f=_0x8e66[_0x416a0a];return _0x574c9f;};'use strict';var _=require(_0x68e6('0x0'));var util=require('util');var logger=require(_0x68e6('0x1'))(_0x68e6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x68e6('0x3'));var rimraf=require(_0x68e6('0x4'));var config=require(_0x68e6('0x5'));var attributes=require(_0x68e6('0x6'));module[_0x68e6('0x7')]=function(_0xe68e2e,_0x4e1b3c){return _0xe68e2e[_0x68e6('0x8')](_0x68e6('0x9'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50a9=['../../config/logger','api','request-promise','path','../../config/environment','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x50a9,0x13e));var _0x950a=function(_0x3e14c3,_0x214814){_0x3e14c3=_0x3e14c3-0x0;var _0x23e6bd=_0x50a9[_0x3e14c3];return _0x23e6bd;};'use strict';var _=require(_0x950a('0x0'));var util=require(_0x950a('0x1'));var logger=require(_0x950a('0x2'))(_0x950a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x950a('0x4'));var fs=require('fs');var path=require(_0x950a('0x5'));var rimraf=require('rimraf');var config=require(_0x950a('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x34f05a,_0x596507){return _0x34f05a[_0x950a('0x7')](_0x950a('0x8'),attributes,{'tableName':_0x950a('0x9'),'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 1829303..a5c2cc8 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 _0x57de=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug'];(function(_0x3a4bd,_0x4dd1b6){var _0x242f2e=function(_0x4ee17c){while(--_0x4ee17c){_0x3a4bd['push'](_0x3a4bd['shift']());}};_0x242f2e(++_0x4dd1b6);}(_0x57de,0x177));var _0xe57d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x57de[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xe57d('0x0'));var util=require(_0xe57d('0x1'));var moment=require(_0xe57d('0x2'));var BPromise=require(_0xe57d('0x3'));var rs=require(_0xe57d('0x4'));var fs=require('fs');var Redis=require(_0xe57d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe57d('0x6'));var logger=require(_0xe57d('0x7'))(_0xe57d('0x8'));var config=require(_0xe57d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe57d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ad4ca,_0xe6331,_0x691e7f){return new BPromise(function(_0x4ac3a9,_0x326e9d){return client[_0xe57d('0xb')](_0x3ad4ca,_0x691e7f)[_0xe57d('0xc')](function(_0x5a41d4){logger[_0xe57d('0xd')](_0xe57d('0xe'),_0xe6331,'request\x20sent');logger[_0xe57d('0xf')](_0xe57d('0x10'),_0xe6331,'request\x20sent',JSON[_0xe57d('0x11')](_0x5a41d4));if(_0x5a41d4[_0xe57d('0x12')]){if(_0x5a41d4[_0xe57d('0x12')][_0xe57d('0x13')]===0x1f4){logger[_0xe57d('0x12')](_0xe57d('0xe'),_0xe6331,_0x5a41d4['error']['message']);return _0x326e9d(_0x5a41d4[_0xe57d('0x12')][_0xe57d('0x14')]);}logger['error'](_0xe57d('0xe'),_0xe6331,_0x5a41d4[_0xe57d('0x12')][_0xe57d('0x14')]);return _0x4ac3a9(_0x5a41d4[_0xe57d('0x12')][_0xe57d('0x14')]);}else{logger['info'](_0xe57d('0xe'),_0xe6331,_0xe57d('0x15'));_0x4ac3a9(_0x5a41d4[_0xe57d('0x16')][_0xe57d('0x14')]);}})['catch'](function(_0x455c55){logger[_0xe57d('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0xe6331,_0x455c55);_0x326e9d(_0x455c55);});});} \ No newline at end of file +var _0x5845=['UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x151718,_0x2be570){var _0x1e7bed=function(_0x29cc53){while(--_0x29cc53){_0x151718['push'](_0x151718['shift']());}};_0x1e7bed(++_0x2be570);}(_0x5845,0x1a1));var _0x5584=function(_0x375c8d,_0x4fb2df){_0x375c8d=_0x375c8d-0x0;var _0x1224b0=_0x5845[_0x375c8d];return _0x1224b0;};'use strict';var _=require(_0x5584('0x0'));var util=require(_0x5584('0x1'));var moment=require(_0x5584('0x2'));var BPromise=require(_0x5584('0x3'));var rs=require(_0x5584('0x4'));var fs=require('fs');var Redis=require(_0x5584('0x5'));var db=require(_0x5584('0x6'))['db'];var utils=require(_0x5584('0x7'));var logger=require(_0x5584('0x8'))('rpc');var config=require(_0x5584('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5584('0xa')][_0x5584('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12745d,_0x21d4dc,_0x573ca9){return new BPromise(function(_0x71442a,_0x3144ca){return client[_0x5584('0xc')](_0x12745d,_0x573ca9)[_0x5584('0xd')](function(_0x43d39b){logger[_0x5584('0xe')](_0x5584('0xf'),_0x21d4dc,_0x5584('0x10'));logger[_0x5584('0x11')](_0x5584('0x12'),_0x21d4dc,'request\x20sent',JSON['stringify'](_0x43d39b));if(_0x43d39b[_0x5584('0x13')]){if(_0x43d39b[_0x5584('0x13')][_0x5584('0x14')]===0x1f4){logger[_0x5584('0x13')](_0x5584('0xf'),_0x21d4dc,_0x43d39b[_0x5584('0x13')][_0x5584('0x15')]);return _0x3144ca(_0x43d39b[_0x5584('0x13')]['message']);}logger[_0x5584('0x13')](_0x5584('0xf'),_0x21d4dc,_0x43d39b[_0x5584('0x13')][_0x5584('0x15')]);return _0x71442a(_0x43d39b[_0x5584('0x13')][_0x5584('0x15')]);}else{logger[_0x5584('0xe')](_0x5584('0xf'),_0x21d4dc,_0x5584('0x10'));_0x71442a(_0x43d39b[_0x5584('0x16')][_0x5584('0x15')]);}})[_0x5584('0x17')](function(_0x414529){logger[_0x5584('0x13')](_0x5584('0xf'),_0x21d4dc,_0x414529);_0x3144ca(_0x414529);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 6b6bd29..b254d50 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 _0x5ac9=['getResources','post','/:id/clone','clone','addSections','addResources','put','update','destroy','removeSections','delete','removeResources','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources'];(function(_0x5c1bdf,_0x12ec63){var _0x3e9de4=function(_0x4f7e89){while(--_0x4f7e89){_0x5c1bdf['push'](_0x5c1bdf['shift']());}};_0x3e9de4(++_0x12ec63);}(_0x5ac9,0x1a0));var _0x95ac=function(_0xd5f216,_0x3ae356){_0xd5f216=_0xd5f216-0x0;var _0x57e5ff=_0x5ac9[_0xd5f216];return _0x57e5ff;};'use strict';var multer=require(_0x95ac('0x0'));var util=require(_0x95ac('0x1'));var path=require(_0x95ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x95ac('0x3'));var router=express[_0x95ac('0x4')]();var fs_extra=require(_0x95ac('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x95ac('0x6'));var config=require(_0x95ac('0x7'));var controller=require(_0x95ac('0x8'));router['get']('/',auth[_0x95ac('0x9')](),controller['index']);router[_0x95ac('0xa')](_0x95ac('0xb'),auth[_0x95ac('0x9')](),controller[_0x95ac('0xc')]);router[_0x95ac('0xa')](_0x95ac('0xd'),auth[_0x95ac('0x9')](),controller[_0x95ac('0xe')]);router['get'](_0x95ac('0xf'),auth['isAuthenticated'](),controller[_0x95ac('0x10')]);router[_0x95ac('0xa')](_0x95ac('0x11'),auth['isAuthenticated'](),controller[_0x95ac('0x12')]);router[_0x95ac('0x13')]('/',auth[_0x95ac('0x9')](),controller['create']);router['post'](_0x95ac('0x14'),auth[_0x95ac('0x9')](),controller[_0x95ac('0x15')]);router[_0x95ac('0x13')](_0x95ac('0xf'),auth['isAuthenticated'](),controller[_0x95ac('0x16')]);router[_0x95ac('0x13')]('/:id/resources',auth['isAuthenticated'](),controller[_0x95ac('0x17')]);router[_0x95ac('0x18')](_0x95ac('0xd'),auth[_0x95ac('0x9')](),controller[_0x95ac('0x19')]);router['delete'](_0x95ac('0xd'),auth[_0x95ac('0x9')](),controller[_0x95ac('0x1a')]);router['delete'](_0x95ac('0xf'),auth[_0x95ac('0x9')](),controller[_0x95ac('0x1b')]);router[_0x95ac('0x1c')](_0x95ac('0x11'),auth[_0x95ac('0x9')](),controller[_0x95ac('0x1d')]);module[_0x95ac('0x1e')]=router; \ No newline at end of file +var _0x5ad6=['index','/describe','isAuthenticated','describe','get','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','put','update','delete','destroy','removeSections','removeResources','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5ad6,0xfd));var _0x65ad=function(_0x4a3acd,_0x4bf641){_0x4a3acd=_0x4a3acd-0x0;var _0x3efdaa=_0x5ad6[_0x4a3acd];return _0x3efdaa;};'use strict';var multer=require(_0x65ad('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x65ad('0x1'));var router=express[_0x65ad('0x2')]();var fs_extra=require(_0x65ad('0x3'));var auth=require(_0x65ad('0x4'));var interaction=require(_0x65ad('0x5'));var config=require(_0x65ad('0x6'));var controller=require(_0x65ad('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x65ad('0x8')]);router['get'](_0x65ad('0x9'),auth[_0x65ad('0xa')](),controller[_0x65ad('0xb')]);router[_0x65ad('0xc')](_0x65ad('0xd'),auth['isAuthenticated'](),controller[_0x65ad('0xe')]);router[_0x65ad('0xc')](_0x65ad('0xf'),auth['isAuthenticated'](),controller[_0x65ad('0x10')]);router['get'](_0x65ad('0x11'),auth[_0x65ad('0xa')](),controller[_0x65ad('0x12')]);router[_0x65ad('0x13')]('/',auth['isAuthenticated'](),controller[_0x65ad('0x14')]);router[_0x65ad('0x13')](_0x65ad('0x15'),auth['isAuthenticated'](),controller['clone']);router[_0x65ad('0x13')](_0x65ad('0xf'),auth[_0x65ad('0xa')](),controller['addSections']);router[_0x65ad('0x13')](_0x65ad('0x11'),auth[_0x65ad('0xa')](),controller['addResources']);router[_0x65ad('0x16')](_0x65ad('0xd'),auth['isAuthenticated'](),controller[_0x65ad('0x17')]);router[_0x65ad('0x18')](_0x65ad('0xd'),auth['isAuthenticated'](),controller[_0x65ad('0x19')]);router[_0x65ad('0x18')](_0x65ad('0xf'),auth['isAuthenticated'](),controller[_0x65ad('0x1a')]);router[_0x65ad('0x18')](_0x65ad('0x11'),auth['isAuthenticated'](),controller[_0x65ad('0x1b')]);module[_0x65ad('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 1f32a79..6eb727d 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 _0x31df=['join','getDataValue','BOOLEAN','STRING','name','crudPermissions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x31df,0xf9));var _0xf31d=function(_0x3bc19c,_0x75ac9f){_0x3bc19c=_0x3bc19c-0x0;var _0x4a5818=_0x31df[_0x3bc19c];return _0x4a5818;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf31d('0x0')],'allowNull':![],'unique':_0xf31d('0x1')},'crudPermissions':{'type':Sequelize[_0xf31d('0x0')],'set':function(_0x4be0d2){this['setDataValue'](_0xf31d('0x2'),_0x4be0d2?_0x4be0d2[_0xf31d('0x3')](''):[]);},'get':function(){return this[_0xf31d('0x4')](_0xf31d('0x2'))?this[_0xf31d('0x4')](_0xf31d('0x2'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xf31d('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf31d('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xf31d('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf31d('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf31d('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf31d('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf31d('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1d91=['name','crudPermissions','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x59079d,_0x4dd722){var _0x31df35=function(_0x3eb986){while(--_0x3eb986){_0x59079d['push'](_0x59079d['shift']());}};_0x31df35(++_0x4dd722);}(_0x1d91,0x89));var _0x11d9=function(_0x4f47ed,_0x4efe68){_0x4f47ed=_0x4f47ed-0x0;var _0x45f8ee=_0x1d91[_0x4f47ed];return _0x45f8ee;};'use strict';var Sequelize=require(_0x11d9('0x0'));module[_0x11d9('0x1')]={'name':{'type':Sequelize[_0x11d9('0x2')],'allowNull':![],'unique':_0x11d9('0x3')},'crudPermissions':{'type':Sequelize[_0x11d9('0x2')],'set':function(_0x266414){this['setDataValue'](_0x11d9('0x4'),_0x266414?_0x266414['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0x11d9('0x4'))[_0x11d9('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x11d9('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x11d9('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x11d9('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x11d9('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x11d9('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x11d9('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index b64523e..c6a1b94 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 _0xda93=['apply','save','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','UserProfile','includeAll','include','findAll','rows','catch','show','length','merge','find','create','clone','params','rawAttributes','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','addSections','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','concat','findOne','forEach','resourceId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json'];(function(_0x313a00,_0x107929){var _0x46d07b=function(_0x452b30){while(--_0x452b30){_0x313a00['push'](_0x313a00['shift']());}};_0x46d07b(++_0x107929);}(_0xda93,0x1ab));var _0x3da9=function(_0x527a57,_0x4e054c){_0x527a57=_0x527a57-0x0;var _0x4e6aca=_0xda93[_0x527a57];return _0x4e6aca;};'use strict';var emlformat=require(_0x3da9('0x0'));var rimraf=require(_0x3da9('0x1'));var zipdir=require(_0x3da9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3da9('0x3'));var moment=require(_0x3da9('0x4'));var BPromise=require(_0x3da9('0x5'));var Mustache=require(_0x3da9('0x6'));var util=require(_0x3da9('0x7'));var path=require('path');var sox=require(_0x3da9('0x8'));var csv=require(_0x3da9('0x9'));var ejs=require(_0x3da9('0xa'));var fs=require('fs');var fs_extra=require(_0x3da9('0xb'));var _=require(_0x3da9('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3da9('0xd'));var Papa=require(_0x3da9('0xe'));var Redis=require(_0x3da9('0xf'));var authService=require(_0x3da9('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3da9('0x11'));var logger=require('../../config/logger')(_0x3da9('0x12'));var utils=require(_0x3da9('0x13'));var config=require(_0x3da9('0x14'));var licenseUtil=require(_0x3da9('0x15'));var db=require(_0x3da9('0x16'))['db'];config['redis']=_[_0x3da9('0x17')](config[_0x3da9('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x3da9('0x19'))(new Redis(config[_0x3da9('0x18')]));require(_0x3da9('0x1a'))[_0x3da9('0x1b')](socket);function respondWithStatusCode(_0x445082,_0x8a25c0){_0x8a25c0=_0x8a25c0||0xcc;return function(_0x285eac){if(_0x285eac){return _0x445082[_0x3da9('0x1c')](_0x8a25c0);}return _0x445082[_0x3da9('0x1d')](_0x8a25c0)[_0x3da9('0x1e')]();};}function respondWithResult(_0x56cdbb,_0x465398){_0x465398=_0x465398||0xc8;return function(_0x2df13e){if(_0x2df13e){return _0x56cdbb[_0x3da9('0x1d')](_0x465398)['json'](_0x2df13e);}};}function respondWithFilteredResult(_0x41d7ea,_0x365ce8){return function(_0x7ee9d3){if(_0x7ee9d3){var _0xa9e48e=typeof _0x365ce8[_0x3da9('0x1f')]===_0x3da9('0x20')&&typeof _0x365ce8[_0x3da9('0x21')]===_0x3da9('0x20');var _0x56947b=_0x7ee9d3['count'];var _0x327810=_0xa9e48e?0x0:_0x365ce8['offset'];var _0x3dc130=_0xa9e48e?_0x7ee9d3[_0x3da9('0x22')]:_0x365ce8[_0x3da9('0x1f')]+_0x365ce8['limit'];var _0x420d38;if(_0x3dc130>=_0x56947b){_0x3dc130=_0x56947b;_0x420d38=0xc8;}else{_0x420d38=0xce;}_0x41d7ea['status'](_0x420d38);return _0x41d7ea['set'](_0x3da9('0x23'),_0x327810+'-'+_0x3dc130+'/'+_0x56947b)[_0x3da9('0x24')](_0x7ee9d3);}return null;};}function patchUpdates(_0x1a922c){return function(_0x206ae3){try{jsonpatch[_0x3da9('0x25')](_0x206ae3,_0x1a922c,!![]);}catch(_0x523fba){return BPromise['reject'](_0x523fba);}return _0x206ae3[_0x3da9('0x26')]();};}function saveUpdates(_0x2885b6,_0x5aa2f3){return function(_0x2ddffd){if(_0x2ddffd){return _0x2ddffd['update'](_0x2885b6)[_0x3da9('0x27')](function(_0x2acb12){return _0x2acb12;});}return null;};}function removeEntity(_0xe14d4b,_0x238442){return function(_0x29bad3){if(_0x29bad3){return _0x29bad3[_0x3da9('0x28')]()['then'](function(){_0xe14d4b['status'](0xcc)[_0x3da9('0x1e')]();});}};}function handleEntityNotFound(_0x15c93b,_0x4fd4ed){return function(_0x205617){if(!_0x205617){_0x15c93b[_0x3da9('0x1c')](0x194);}return _0x205617;};}function handleError(_0x1abc2b,_0x45fcb4){_0x45fcb4=_0x45fcb4||0x1f4;return function(_0x59900b){logger[_0x3da9('0x29')](_0x59900b[_0x3da9('0x2a')]);if(_0x59900b[_0x3da9('0x2b')]){delete _0x59900b[_0x3da9('0x2b')];}_0x1abc2b[_0x3da9('0x1d')](_0x45fcb4)[_0x3da9('0x2c')](_0x59900b);};}exports[_0x3da9('0x2d')]=function(_0x33ec1d,_0x5a5de8){var _0x1a9fb3={},_0x2e4bb9={},_0x30796b={'count':0x0,'rows':[]};var _0x9ff864=_[_0x3da9('0x2e')](db['UserProfile']['rawAttributes'],function(_0x1e4922){return{'name':_0x1e4922[_0x3da9('0x2f')],'type':_0x1e4922['type'][_0x3da9('0x30')]};});_0x2e4bb9[_0x3da9('0x31')]=_['map'](_0x9ff864,'name');_0x2e4bb9[_0x3da9('0x32')]=_[_0x3da9('0x33')](_0x33ec1d['query']);_0x2e4bb9[_0x3da9('0x34')]=_[_0x3da9('0x35')](_0x2e4bb9[_0x3da9('0x31')],_0x2e4bb9[_0x3da9('0x32')]);_0x1a9fb3[_0x3da9('0x36')]=_[_0x3da9('0x35')](_0x2e4bb9[_0x3da9('0x31')],qs[_0x3da9('0x37')](_0x33ec1d[_0x3da9('0x32')][_0x3da9('0x37')]));_0x1a9fb3[_0x3da9('0x36')]=_0x1a9fb3[_0x3da9('0x36')]['length']?_0x1a9fb3['attributes']:_0x2e4bb9[_0x3da9('0x31')];if(!_0x33ec1d[_0x3da9('0x32')][_0x3da9('0x38')](_0x3da9('0x39'))){_0x1a9fb3[_0x3da9('0x21')]=qs[_0x3da9('0x21')](_0x33ec1d[_0x3da9('0x32')]['limit']);_0x1a9fb3['offset']=qs['offset'](_0x33ec1d[_0x3da9('0x32')]['offset']);}_0x1a9fb3[_0x3da9('0x3a')]=qs[_0x3da9('0x3b')](_0x33ec1d['query']['sort']);_0x1a9fb3[_0x3da9('0x3c')]=qs[_0x3da9('0x34')](_[_0x3da9('0x3d')](_0x33ec1d['query'],_0x2e4bb9['filters']),_0x9ff864);if(_0x33ec1d['query'][_0x3da9('0x3e')]){_0x1a9fb3[_0x3da9('0x3c')]=_['merge'](_0x1a9fb3['where'],{'$or':_[_0x3da9('0x2e')](_0x9ff864,function(_0x557c3e){if(_0x557c3e[_0x3da9('0x3f')]!==_0x3da9('0x40')){var _0x2506b6={};_0x2506b6[_0x557c3e[_0x3da9('0x2b')]]={'$like':'%'+_0x33ec1d[_0x3da9('0x32')][_0x3da9('0x3e')]+'%'};return _0x2506b6;}})});}_0x1a9fb3=_['merge']({},_0x1a9fb3,_0x33ec1d[_0x3da9('0x41')]);var _0x390b66={'where':_0x1a9fb3['where']};return db[_0x3da9('0x42')][_0x3da9('0x22')](_0x390b66)['then'](function(_0x2f1e0e){_0x30796b[_0x3da9('0x22')]=_0x2f1e0e;if(_0x33ec1d[_0x3da9('0x32')][_0x3da9('0x43')]){_0x1a9fb3[_0x3da9('0x44')]=[{'all':!![]}];}return db[_0x3da9('0x42')][_0x3da9('0x45')](_0x1a9fb3);})['then'](function(_0x3118cb){_0x30796b[_0x3da9('0x46')]=_0x3118cb;return _0x30796b;})[_0x3da9('0x27')](respondWithFilteredResult(_0x5a5de8,_0x1a9fb3))[_0x3da9('0x47')](handleError(_0x5a5de8,null));};exports[_0x3da9('0x48')]=function(_0x2773d2,_0x22d130){var _0x326925={'raw':![],'where':{'id':_0x2773d2['params']['id']}},_0x1e54eb={};_0x1e54eb[_0x3da9('0x31')]=_[_0x3da9('0x33')](db['UserProfile']['rawAttributes']);_0x1e54eb['query']=_['keys'](_0x2773d2['query']);_0x1e54eb[_0x3da9('0x34')]=_['intersection'](_0x1e54eb['model'],_0x1e54eb[_0x3da9('0x32')]);_0x326925[_0x3da9('0x36')]=_['intersection'](_0x1e54eb[_0x3da9('0x31')],qs[_0x3da9('0x37')](_0x2773d2[_0x3da9('0x32')][_0x3da9('0x37')]));_0x326925[_0x3da9('0x36')]=_0x326925[_0x3da9('0x36')][_0x3da9('0x49')]?_0x326925[_0x3da9('0x36')]:_0x1e54eb[_0x3da9('0x31')];if(_0x2773d2[_0x3da9('0x32')]['includeAll']){_0x326925[_0x3da9('0x44')]=[{'all':!![]}];}_0x326925=_[_0x3da9('0x4a')]({},_0x326925,_0x2773d2['options']);return db[_0x3da9('0x42')][_0x3da9('0x4b')](_0x326925)[_0x3da9('0x27')](handleEntityNotFound(_0x22d130,null))['then'](respondWithResult(_0x22d130,null))['catch'](handleError(_0x22d130,null));};exports['create']=function(_0x1aeeb6,_0x14af42){return db[_0x3da9('0x42')][_0x3da9('0x4c')](_0x1aeeb6['body'],{})[_0x3da9('0x27')](respondWithResult(_0x14af42,0xc9))[_0x3da9('0x47')](handleError(_0x14af42,null));};exports[_0x3da9('0x4d')]=function(_0x4c8559,_0x3efc8e){var _0x1834ec={'where':{'id':_0x4c8559[_0x3da9('0x4e')]['id']}},_0xd43bcd={};_0xd43bcd[_0x3da9('0x31')]=_[_0x3da9('0x33')](db[_0x3da9('0x42')][_0x3da9('0x4f')]);_0x1834ec['attributes']=_[_0x3da9('0x35')](_0xd43bcd[_0x3da9('0x31')],qs[_0x3da9('0x37')](_0x4c8559[_0x3da9('0x32')][_0x3da9('0x37')]));_0x1834ec[_0x3da9('0x36')]=_0x1834ec['attributes'][_0x3da9('0x49')]?_0x1834ec[_0x3da9('0x36')]:_0xd43bcd[_0x3da9('0x31')];if(_0x4c8559[_0x3da9('0x32')]['includeAll']){_0x1834ec[_0x3da9('0x44')]=[{'all':!![]}];}_0x1834ec=_['merge']({},_0x1834ec,_0x4c8559[_0x3da9('0x41')]);return db[_0x3da9('0x42')][_0x3da9('0x4b')](_0x1834ec)[_0x3da9('0x27')](handleEntityNotFound(_0x3efc8e,null))[_0x3da9('0x27')](function(_0x144581){if(_0x144581){var _0x45ce97=_0x144581[_0x3da9('0x50')]({'plain':!![]});_0x45ce97=qs[_0x3da9('0x51')](_0x45ce97,['id',_0x3da9('0x52'),_0x3da9('0x53'),_0x3da9('0x54')]);_0x4c8559[_0x3da9('0x55')]=_[_0x3da9('0x51')](_0x4c8559[_0x3da9('0x55')],['id',_0x3da9('0x52'),_0x3da9('0x53')]);return db[_0x3da9('0x56')][_0x3da9('0x57')](function(_0x110d62){return db[_0x3da9('0x42')]['create'](_[_0x3da9('0x4a')](_0x45ce97,_0x4c8559['body']),{'include':_0x4c8559['query'][_0x3da9('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x110d62})[_0x3da9('0x27')](function(_0xbc92ae){var _0x16d011=_0xbc92ae['get']({'plain':!![]});return db[_0x3da9('0x58')]['findAll']({'where':{'userProfileId':_0x4c8559[_0x3da9('0x4e')]['id']},'raw':!![]})[_0x3da9('0x27')](function(_0x24b512){if(_0x24b512){return BPromise[_0x3da9('0x59')](_0x24b512,function(_0x2b9f71){return new BPromise(function(_0x1f8ac7,_0x3e9551){if(_0x2b9f71[_0x3da9('0x5a')]===null||_0x2b9f71['autoAssociation']===0x1)_0x1f8ac7(null);return db[_0x3da9('0x5b')]['findAll']({'where':{'sectionId':_0x2b9f71['id']},'raw':!![]})['then'](function(_0x2c630b){var _0x3ac79a=_['map'](_0x2c630b,function(_0x41bc5f){return qs[_0x3da9('0x51')](_0x41bc5f,['id',_0x3da9('0x52'),_0x3da9('0x53'),_0x3da9('0x5c')]);});_0x1f8ac7(_0x3ac79a);})[_0x3da9('0x47')](function(_0x21b13c){_0x3e9551(_0x21b13c);});})[_0x3da9('0x27')](function(_0x57eef0){var _0x4e618f=qs['omit'](_0x2b9f71,['id','createdAt',_0x3da9('0x53')]);_0x4e618f[_0x3da9('0x5d')]=_0x16d011['id'];if(_0x57eef0)_0x4e618f[_0x3da9('0x5e')]=_0x57eef0;return _0x4e618f;})['then'](function(_0x2bb579){return db[_0x3da9('0x58')][_0x3da9('0x4c')](_0x2bb579,{'include':[{'model':db['UserProfileResource'],'as':_0x3da9('0x5e')}],'raw':!![],'transaction':_0x110d62});});})[_0x3da9('0x27')](function(){return _0x16d011;});}});});});}})['then'](respondWithResult(_0x3efc8e,0xc9))[_0x3da9('0x47')](handleError(_0x3efc8e,null));};exports[_0x3da9('0x5f')]=function(_0x206d5d,_0xcd9037){if(_0x206d5d['body']['id']){delete _0x206d5d['body']['id'];}return db['UserProfile'][_0x3da9('0x4b')]({'where':{'id':_0x206d5d[_0x3da9('0x4e')]['id']}})[_0x3da9('0x27')](handleEntityNotFound(_0xcd9037,null))[_0x3da9('0x27')](saveUpdates(_0x206d5d[_0x3da9('0x55')],null))[_0x3da9('0x27')](respondWithResult(_0xcd9037,null))['catch'](handleError(_0xcd9037,null));};exports[_0x3da9('0x28')]=function(_0x5b14f6,_0x5d41d3){return db[_0x3da9('0x42')][_0x3da9('0x4b')]({'where':{'id':_0x5b14f6[_0x3da9('0x4e')]['id']}})[_0x3da9('0x27')](handleEntityNotFound(_0x5d41d3,null))['then'](removeEntity(_0x5d41d3,null))[_0x3da9('0x47')](handleError(_0x5d41d3,null));};exports[_0x3da9('0x60')]=function(_0x48f162,_0x63d7a0){return db[_0x3da9('0x42')]['describe']()[_0x3da9('0x27')](respondWithResult(_0x63d7a0,null))[_0x3da9('0x47')](handleError(_0x63d7a0,null));};exports[_0x3da9('0x61')]=function(_0x4f2dc2,_0x266ec4){var _0x3974d8=_0x4f2dc2[_0x3da9('0x55')];return db[_0x3da9('0x42')][_0x3da9('0x4b')]({'where':{'id':_0x4f2dc2[_0x3da9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x266ec4,null))[_0x3da9('0x27')](function(_0xf329cf){if(_0xf329cf){return db[_0x3da9('0x56')][_0x3da9('0x57')](function(_0x20e626){return db[_0x3da9('0x58')][_0x3da9('0x28')]({'where':{'userProfileId':_0x4f2dc2[_0x3da9('0x4e')]['id'],'sectionId':_[_0x3da9('0x2e')](_0x3974d8,function(_0x30131f){return _0x30131f['sectionId'];})},'transaction':_0x20e626})[_0x3da9('0x27')](function(){var _0x1f486e=_[_0x3da9('0x2e')](_0x3974d8,function(_0x59b202){_0x59b202[_0x3da9('0x5d')]=_0x4f2dc2[_0x3da9('0x4e')]['id'];return _0x59b202;});var _0x3a1c9b=[];return BPromise[_0x3da9('0x59')](_0x1f486e,function(_0x142829){return db[_0x3da9('0x58')][_0x3da9('0x4c')](_0x142829,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x20e626})[_0x3da9('0x27')](function(_0x441f4b){_0x3a1c9b[_0x3da9('0x62')](_0x441f4b[_0x3da9('0x50')]({'plain':!![]}));});})[_0x3da9('0x27')](function(){return _0x3a1c9b;});});});}})[_0x3da9('0x27')](function(_0x113438){return _0x113438;})[_0x3da9('0x27')](respondWithResult(_0x266ec4,null))[_0x3da9('0x47')](handleError(_0x266ec4,null));};exports[_0x3da9('0x63')]=function(_0x16f35c,_0x4037f1){var _0x33469b;return db[_0x3da9('0x42')]['find']({'where':{'id':_0x16f35c[_0x3da9('0x4e')]['id']},'attributes':['id',_0x3da9('0x2b')]})[_0x3da9('0x27')](handleEntityNotFound(_0x4037f1,null))[_0x3da9('0x27')](function(_0x4c4672){if(_0x4c4672){_0x33469b=_0x4c4672;return db[_0x3da9('0x58')][_0x3da9('0x28')]({'where':{'userProfileId':_0x16f35c[_0x3da9('0x4e')]['id'],'sectionId':_0x16f35c[_0x3da9('0x32')][_0x3da9('0x64')]}});}})[_0x3da9('0x27')](function(){return _0x33469b;})[_0x3da9('0x27')](respondWithStatusCode(_0x4037f1,null))[_0x3da9('0x47')](handleError(_0x4037f1,null));};exports[_0x3da9('0x65')]=function(_0x16a58f,_0x195e0a){var _0x59472d=[];var _0x3213f4=[];return db['UserProfileSection'][_0x3da9('0x45')]({'where':{'userProfileId':_0x16a58f[_0x3da9('0x4e')]['id']},'raw':!![]})[_0x3da9('0x27')](function(_0x5126d2){_0x59472d=_[_0x3da9('0x3e')](_0x5126d2,function(_0x28d212){return _0x28d212[_0x3da9('0x66')]===0x1||_['includes']([0x3eb,0x709],_0x28d212['sectionId']);});if(!_[_0x3da9('0x67')](_0x59472d)){return _[_0x3da9('0x2e')](_0x59472d,function(_0x19583e){return _0x19583e['sectionId'];});}else{return;}})[_0x3da9('0x27')](function(_0x2131d8){if(_0x2131d8)_0x3213f4=_0x2131d8;if(_[_0x3da9('0x68')](_0x3213f4,0x64)){var _0x54c3ea=_['find'](_0x59472d,{'sectionId':0x64});return hasDefaultDashboard(_0x54c3ea)[_0x3da9('0x27')](function(_0x4e2bed){return _[_0x3da9('0x2e')](_0x59472d,function(_0x2649e3){if(_0x2649e3[_0x3da9('0x5c')]===0x64){_0x2649e3['subsections']=_0x4e2bed;}return _0x2649e3;});});}else{return;}})[_0x3da9('0x27')](function(_0x2fb94e){if(_0x2fb94e)_0x59472d=_0x2fb94e;if(_[_0x3da9('0x68')](_0x3213f4,0x3eb)){var _0x530137=_[_0x3da9('0x4b')](_0x59472d,{'sectionId':0x3eb});return getCustomDashboards(_0x530137)[_0x3da9('0x27')](function(_0x4c350e){return _[_0x3da9('0x2e')](_0x59472d,function(_0x4c87b8){if(_0x530137[_0x3da9('0x66')]){if(_0x4c87b8[_0x3da9('0x5c')]===0x3eb){_0x4c87b8['subsections']=_0x4c350e;}}else{if(_0x4c87b8['sectionId']===0x64){if(!_0x4c87b8[_0x3da9('0x69')]){_0x4c87b8[_0x3da9('0x69')]=[];}_0x4c87b8[_0x3da9('0x69')]=_0x4c87b8[_0x3da9('0x69')][_0x3da9('0x6a')](_0x4c350e);}}return _0x4c87b8;});});}else{return;}})[_0x3da9('0x27')](function(_0x34e685){if(_0x34e685)_0x59472d=_0x34e685;if(_[_0x3da9('0x68')](_0x3213f4,0x709)){var _0x2acf14=_[_0x3da9('0x4b')](_0x59472d,{'sectionId':0x709});return getPlugins(_0x2acf14)[_0x3da9('0x27')](function(_0xe269fb){if(_0x2acf14[_0x3da9('0x66')]){return _[_0x3da9('0x2e')](_0x59472d,function(_0x592ff0){if(_0x592ff0[_0x3da9('0x5c')]===0x709){_0x592ff0[_0x3da9('0x69')]=_0xe269fb;}return _0x592ff0;});}else{var _0x36c5de={'sectionId':0x76c,'enabled':0x1,'subsections':_0xe269fb};var _0x5b7aae=_[_0x3da9('0x2e')](_0x59472d);_0x5b7aae[_0x3da9('0x62')](_0x36c5de);return _0x5b7aae;}});}else{return;}})[_0x3da9('0x27')](function(_0x126383){if(_0x126383)_0x59472d=_0x126383;return _['filter'](_0x59472d,[_0x3da9('0x66'),0x1]);})['then'](respondWithResult(_0x195e0a,null))[_0x3da9('0x47')](handleError(_0x195e0a,null));};function hasDefaultDashboard(_0x54d28c){var _0x4e1a1a=[0x65];return new BPromise(function(_0x3b8718,_0x30c6d0){try{if(_0x54d28c[_0x3da9('0x5a')]){_0x3b8718(_0x4e1a1a);}else{return db['UserProfileResource'][_0x3da9('0x6b')]({'where':{'sectionId':_0x54d28c['id']},'raw':!![]})[_0x3da9('0x27')](function(_0x377ef9){_0x377ef9?_0x3b8718(_0x4e1a1a):_0x3b8718();});}}catch(_0x456c67){_0x30c6d0(_0x456c67);}});}function getCustomDashboards(_0x5f4ccd){var _0x1ec9b9=[];return new BPromise(function(_0x2a168c,_0x497cd6){try{if(_0x5f4ccd[_0x3da9('0x5a')]){return db['Dashboard'][_0x3da9('0x45')]({'raw':!![]})[_0x3da9('0x27')](function(_0x6036a2){_0x6036a2[_0x3da9('0x6c')](function(_0x3dec93){_0x1ec9b9[_0x3da9('0x62')](_0x3dec93['id']+0x1869f);});_0x2a168c(_0x1ec9b9);});}else{return db[_0x3da9('0x5b')]['findAll']({'where':{'sectionId':_0x5f4ccd['id']},'raw':!![]})[_0x3da9('0x27')](function(_0x2a41f6){_0x2a41f6['forEach'](function(_0x147ed8){_0x1ec9b9[_0x3da9('0x62')](_0x147ed8['resourceId']+0x1869f);});_0x2a168c(_0x1ec9b9);});}}catch(_0x4f7085){_0x497cd6(_0x4f7085);}});}function getPlugins(_0x3742ce){var _0x1f04e2=[];return new BPromise(function(_0x19236d,_0x58a365){try{if(_0x3742ce[_0x3da9('0x5a')]){return db['Plugin'][_0x3da9('0x45')]({'raw':!![]})[_0x3da9('0x27')](function(_0x2aba5f){_0x2aba5f[_0x3da9('0x6c')](function(_0x47bb73){_0x1f04e2[_0x3da9('0x62')](_0x47bb73['id']+0x15b38);});_0x19236d(_0x1f04e2);});}else{return db[_0x3da9('0x5b')][_0x3da9('0x45')]({'where':{'sectionId':_0x3742ce['id']},'raw':!![]})['then'](function(_0x4193b7){_0x4193b7[_0x3da9('0x6c')](function(_0x3768f6){_0x1f04e2[_0x3da9('0x62')](_0x3768f6[_0x3da9('0x6d')]+0x15b38);});_0x19236d(_0x1f04e2);});}}catch(_0x1396d4){_0x58a365(_0x1396d4);}});}exports['addResources']=function(_0x4f2c0a,_0x327257){return db['UserProfile']['find']({'where':{'id':_0x4f2c0a[_0x3da9('0x4e')]['id']}})[_0x3da9('0x27')](handleEntityNotFound(_0x327257,null))[_0x3da9('0x27')](function(_0x547aca){if(_0x547aca){return db['sequelize']['transaction'](function(_0x2e41c0){return db['UserProfileSection'][_0x3da9('0x45')]({'where':{'userProfileId':_0x4f2c0a[_0x3da9('0x4e')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x167105){if(_0x167105){return db[_0x3da9('0x58')][_0x3da9('0x28')]({'where':{'userProfileId':_0x4f2c0a['params']['id'],'id':_[_0x3da9('0x2e')](_0x167105,function(_0x3f8a1c){return _0x3f8a1c['id'];})},'transaction':_0x2e41c0});}})[_0x3da9('0x27')](function(_0x1639cc){var _0x4aaca2=_[_0x3da9('0x2e')](_0x4f2c0a['body'],function(_0xfd43b0){_0xfd43b0[_0x3da9('0x5d')]=_0x4f2c0a[_0x3da9('0x4e')]['id'];return _0xfd43b0;});return db[_0x3da9('0x58')][_0x3da9('0x6e')](_0x4aaca2,{'raw':!![],'transaction':_0x2e41c0});})[_0x3da9('0x27')](function(_0x316ac1){var _0x21b701=_[_0x3da9('0x3e')](_['map'](_0x316ac1,function(_0x16dd6a){return _0x16dd6a[_0x3da9('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x21b701){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x4f2c0a[_0x3da9('0x4e')]['id'],'sectionId':_[_0x3da9('0x2e')](_0x21b701,function(_0x28e8e3){return _0x28e8e3[_0x3da9('0x5c')];})},'attributes':['id',_0x3da9('0x5c')],'raw':!![]})[_0x3da9('0x27')](function(_0x27c71f){var _0x2abbac=_[_0x3da9('0x2e')](_0x4f2c0a[_0x3da9('0x55')],function(_0x5d3541){_0x5d3541[_0x3da9('0x5d')]=_0x4f2c0a[_0x3da9('0x4e')]['id'];return _0x5d3541;});return db[_0x3da9('0x5b')][_0x3da9('0x6e')](_0x2abbac,{'raw':!![],'transaction':_0x2e41c0});});}})[_0x3da9('0x47')](handleError(_0x327257,null));});}})[_0x3da9('0x27')](function(_0x33fee7){var _0x38cde7=_['map'](_0x33fee7,function(_0x2ef307){return _0x2ef307['get']({'plain':!![]});});})['then'](respondWithResult(_0x327257,null))[_0x3da9('0x47')](handleError(_0x327257,null));};exports[_0x3da9('0x6f')]=function(_0x38025f,_0x462ac4,_0x1c2853){return db[_0x3da9('0x42')][_0x3da9('0x4b')]({'where':{'id':_0x38025f[_0x3da9('0x4e')]['id']}})[_0x3da9('0x27')](handleEntityNotFound(_0x462ac4,null))['then'](function(_0x1f04ee){if(_0x1f04ee){return _0x1f04ee[_0x3da9('0x6f')](_0x38025f['query'][_0x3da9('0x64')]);}})[_0x3da9('0x27')](respondWithStatusCode(_0x462ac4,null))['catch'](handleError(_0x462ac4,null));};exports[_0x3da9('0x70')]=function(_0x504758,_0x270732){var _0x845bc={};if(!_0x504758['query'][_0x3da9('0x71')])throw new Error(_0x3da9('0x72'));if(!_0x504758[_0x3da9('0x32')][_0x3da9('0x38')]('nolimit')){_0x845bc[_0x3da9('0x21')]=qs[_0x3da9('0x21')](_0x504758[_0x3da9('0x32')]['limit']);_0x845bc[_0x3da9('0x1f')]=qs[_0x3da9('0x1f')](_0x504758[_0x3da9('0x32')]['offset']);}return db[_0x3da9('0x42')][_0x3da9('0x4b')]({'where':{'id':_0x504758[_0x3da9('0x4e')]['id']}})['then'](function(_0xd37123){if(!_0xd37123)throw new Error(_0x3da9('0x73')+_0x504758[_0x3da9('0x4e')]['id']);return db[_0x3da9('0x42')][_0x3da9('0x70')](_0x504758);})[_0x3da9('0x27')](respondWithFilteredResult(_0x270732,_0x845bc))['catch'](handleError(_0x270732,null));}; \ No newline at end of file +var _0xcc6d=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./userProfile.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','filters','include','find','create','body','length','omit','crudPermissions','createdAt','updatedAt','get','each','UserProfileResource','Resources','describe','addSections','sequelize','transaction','UserProfileSection','sectionId','userProfileId','removeSections','getSections','includes','subsections','enabled','concat','push','autoAssociation','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2966de,_0xc756d5){var _0x4e75a2=function(_0x15b554){while(--_0x15b554){_0x2966de['push'](_0x2966de['shift']());}};_0x4e75a2(++_0xc756d5);}(_0xcc6d,0xd0));var _0xdcc6=function(_0x361b8c,_0xe8d07c){_0x361b8c=_0x361b8c-0x0;var _0x530501=_0xcc6d[_0x361b8c];return _0x530501;};'use strict';var emlformat=require(_0xdcc6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcc6('0x1'));var jsonpatch=require(_0xdcc6('0x2'));var rp=require(_0xdcc6('0x3'));var moment=require(_0xdcc6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdcc6('0x5'));var util=require('util');var path=require(_0xdcc6('0x6'));var sox=require(_0xdcc6('0x7'));var csv=require(_0xdcc6('0x8'));var ejs=require(_0xdcc6('0x9'));var fs=require('fs');var fs_extra=require(_0xdcc6('0xa'));var _=require(_0xdcc6('0xb'));var squel=require(_0xdcc6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdcc6('0x8'));var querystring=require(_0xdcc6('0xd'));var Papa=require(_0xdcc6('0xe'));var Redis=require('ioredis');var authService=require(_0xdcc6('0xf'));var qs=require(_0xdcc6('0x10'));var as=require(_0xdcc6('0x11'));var hardwareService=require(_0xdcc6('0x12'));var logger=require(_0xdcc6('0x13'))(_0xdcc6('0x14'));var utils=require(_0xdcc6('0x15'));var config=require(_0xdcc6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdcc6('0x17'))['db'];config[_0xdcc6('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdcc6('0x18')]));require(_0xdcc6('0x19'))[_0xdcc6('0x1a')](socket);function respondWithStatusCode(_0x149d7e,_0x55f564){_0x55f564=_0x55f564||0xcc;return function(_0x2c3b26){if(_0x2c3b26){return _0x149d7e[_0xdcc6('0x1b')](_0x55f564);}return _0x149d7e['status'](_0x55f564)[_0xdcc6('0x1c')]();};}function respondWithResult(_0x30a303,_0x4834f8){_0x4834f8=_0x4834f8||0xc8;return function(_0x32e90a){if(_0x32e90a){return _0x30a303[_0xdcc6('0x1d')](_0x4834f8)[_0xdcc6('0x1e')](_0x32e90a);}};}function respondWithFilteredResult(_0x380166,_0x1f9951){return function(_0x15d992){if(_0x15d992){var _0x30ac1d=typeof _0x1f9951[_0xdcc6('0x1f')]===_0xdcc6('0x20')&&typeof _0x1f9951[_0xdcc6('0x21')]==='undefined';var _0x5b1bfd=_0x15d992['count'];var _0x178bcc=_0x30ac1d?0x0:_0x1f9951[_0xdcc6('0x1f')];var _0x2f28a9=_0x30ac1d?_0x15d992[_0xdcc6('0x22')]:_0x1f9951[_0xdcc6('0x1f')]+_0x1f9951['limit'];var _0x3cd5b0;if(_0x2f28a9>=_0x5b1bfd){_0x2f28a9=_0x5b1bfd;_0x3cd5b0=0xc8;}else{_0x3cd5b0=0xce;}_0x380166[_0xdcc6('0x1d')](_0x3cd5b0);return _0x380166[_0xdcc6('0x23')](_0xdcc6('0x24'),_0x178bcc+'-'+_0x2f28a9+'/'+_0x5b1bfd)[_0xdcc6('0x1e')](_0x15d992);}return null;};}function patchUpdates(_0xaa0cfd){return function(_0x450978){try{jsonpatch[_0xdcc6('0x25')](_0x450978,_0xaa0cfd,!![]);}catch(_0x21f977){return BPromise['reject'](_0x21f977);}return _0x450978[_0xdcc6('0x26')]();};}function saveUpdates(_0x91bb6f,_0x49cf60){return function(_0x18893b){if(_0x18893b){return _0x18893b[_0xdcc6('0x27')](_0x91bb6f)[_0xdcc6('0x28')](function(_0x59e518){return _0x59e518;});}return null;};}function removeEntity(_0x5e0220,_0x171950){return function(_0x315f9e){if(_0x315f9e){return _0x315f9e[_0xdcc6('0x29')]()[_0xdcc6('0x28')](function(){_0x5e0220[_0xdcc6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52659f,_0x3c6ef2){return function(_0xdc28a1){if(!_0xdc28a1){_0x52659f[_0xdcc6('0x1b')](0x194);}return _0xdc28a1;};}function handleError(_0x4be986,_0x5ddb8a){_0x5ddb8a=_0x5ddb8a||0x1f4;return function(_0x4aab30){logger[_0xdcc6('0x2a')](_0x4aab30['stack']);if(_0x4aab30[_0xdcc6('0x2b')]){delete _0x4aab30[_0xdcc6('0x2b')];}_0x4be986['status'](_0x5ddb8a)[_0xdcc6('0x2c')](_0x4aab30);};}exports[_0xdcc6('0x2d')]=function(_0x4a6e61,_0x1d2b2f){var _0x413f00={},_0x159779={},_0x16440e={'count':0x0,'rows':[]};var _0x530c86=_[_0xdcc6('0x2e')](db[_0xdcc6('0x2f')][_0xdcc6('0x30')],function(_0x2a7ca7){return{'name':_0x2a7ca7[_0xdcc6('0x31')],'type':_0x2a7ca7[_0xdcc6('0x32')][_0xdcc6('0x33')]};});_0x159779[_0xdcc6('0x34')]=_[_0xdcc6('0x2e')](_0x530c86,'name');_0x159779[_0xdcc6('0x35')]=_['keys'](_0x4a6e61[_0xdcc6('0x35')]);_0x159779['filters']=_[_0xdcc6('0x36')](_0x159779[_0xdcc6('0x34')],_0x159779['query']);_0x413f00[_0xdcc6('0x37')]=_[_0xdcc6('0x36')](_0x159779[_0xdcc6('0x34')],qs[_0xdcc6('0x38')](_0x4a6e61[_0xdcc6('0x35')][_0xdcc6('0x38')]));_0x413f00[_0xdcc6('0x37')]=_0x413f00[_0xdcc6('0x37')]['length']?_0x413f00[_0xdcc6('0x37')]:_0x159779['model'];if(!_0x4a6e61[_0xdcc6('0x35')][_0xdcc6('0x39')](_0xdcc6('0x3a'))){_0x413f00[_0xdcc6('0x21')]=qs[_0xdcc6('0x21')](_0x4a6e61[_0xdcc6('0x35')][_0xdcc6('0x21')]);_0x413f00[_0xdcc6('0x1f')]=qs['offset'](_0x4a6e61[_0xdcc6('0x35')][_0xdcc6('0x1f')]);}_0x413f00[_0xdcc6('0x3b')]=qs['sort'](_0x4a6e61[_0xdcc6('0x35')][_0xdcc6('0x3c')]);_0x413f00[_0xdcc6('0x3d')]=qs['filters'](_[_0xdcc6('0x3e')](_0x4a6e61[_0xdcc6('0x35')],_0x159779['filters']),_0x530c86);if(_0x4a6e61[_0xdcc6('0x35')][_0xdcc6('0x3f')]){_0x413f00[_0xdcc6('0x3d')]=_[_0xdcc6('0x40')](_0x413f00[_0xdcc6('0x3d')],{'$or':_['map'](_0x530c86,function(_0x5e54e4){if(_0x5e54e4[_0xdcc6('0x32')]!==_0xdcc6('0x41')){var _0x56f2a9={};_0x56f2a9[_0x5e54e4[_0xdcc6('0x2b')]]={'$like':'%'+_0x4a6e61['query'][_0xdcc6('0x3f')]+'%'};return _0x56f2a9;}})});}_0x413f00=_[_0xdcc6('0x40')]({},_0x413f00,_0x4a6e61[_0xdcc6('0x42')]);var _0x3cbb62={'where':_0x413f00[_0xdcc6('0x3d')]};return db[_0xdcc6('0x2f')]['count'](_0x3cbb62)['then'](function(_0x3d9ad1){_0x16440e[_0xdcc6('0x22')]=_0x3d9ad1;if(_0x4a6e61[_0xdcc6('0x35')][_0xdcc6('0x43')]){_0x413f00['include']=[{'all':!![]}];}return db['UserProfile'][_0xdcc6('0x44')](_0x413f00);})[_0xdcc6('0x28')](function(_0x42044d){_0x16440e['rows']=_0x42044d;return _0x16440e;})[_0xdcc6('0x28')](respondWithFilteredResult(_0x1d2b2f,_0x413f00))[_0xdcc6('0x45')](handleError(_0x1d2b2f,null));};exports[_0xdcc6('0x46')]=function(_0x20f90e,_0x34f7cc){var _0x2f16c0={'raw':![],'where':{'id':_0x20f90e[_0xdcc6('0x47')]['id']}},_0x2a673e={};_0x2a673e['model']=_['keys'](db[_0xdcc6('0x2f')][_0xdcc6('0x30')]);_0x2a673e[_0xdcc6('0x35')]=_[_0xdcc6('0x48')](_0x20f90e[_0xdcc6('0x35')]);_0x2a673e[_0xdcc6('0x49')]=_[_0xdcc6('0x36')](_0x2a673e[_0xdcc6('0x34')],_0x2a673e[_0xdcc6('0x35')]);_0x2f16c0['attributes']=_[_0xdcc6('0x36')](_0x2a673e[_0xdcc6('0x34')],qs['fields'](_0x20f90e['query'][_0xdcc6('0x38')]));_0x2f16c0[_0xdcc6('0x37')]=_0x2f16c0[_0xdcc6('0x37')]['length']?_0x2f16c0[_0xdcc6('0x37')]:_0x2a673e[_0xdcc6('0x34')];if(_0x20f90e[_0xdcc6('0x35')]['includeAll']){_0x2f16c0[_0xdcc6('0x4a')]=[{'all':!![]}];}_0x2f16c0=_[_0xdcc6('0x40')]({},_0x2f16c0,_0x20f90e[_0xdcc6('0x42')]);return db[_0xdcc6('0x2f')][_0xdcc6('0x4b')](_0x2f16c0)[_0xdcc6('0x28')](handleEntityNotFound(_0x34f7cc,null))[_0xdcc6('0x28')](respondWithResult(_0x34f7cc,null))['catch'](handleError(_0x34f7cc,null));};exports[_0xdcc6('0x4c')]=function(_0x4d8bb0,_0x483ee0){return db['UserProfile'][_0xdcc6('0x4c')](_0x4d8bb0[_0xdcc6('0x4d')],{})[_0xdcc6('0x28')](respondWithResult(_0x483ee0,0xc9))[_0xdcc6('0x45')](handleError(_0x483ee0,null));};exports['clone']=function(_0x3f0973,_0x37cd7f){var _0x41eafe={'where':{'id':_0x3f0973[_0xdcc6('0x47')]['id']}},_0x5b2547={};_0x5b2547[_0xdcc6('0x34')]=_[_0xdcc6('0x48')](db[_0xdcc6('0x2f')][_0xdcc6('0x30')]);_0x41eafe[_0xdcc6('0x37')]=_['intersection'](_0x5b2547[_0xdcc6('0x34')],qs['fields'](_0x3f0973[_0xdcc6('0x35')][_0xdcc6('0x38')]));_0x41eafe[_0xdcc6('0x37')]=_0x41eafe['attributes'][_0xdcc6('0x4e')]?_0x41eafe[_0xdcc6('0x37')]:_0x5b2547['model'];if(_0x3f0973['query'][_0xdcc6('0x43')]){_0x41eafe[_0xdcc6('0x4a')]=[{'all':!![]}];}_0x41eafe=_[_0xdcc6('0x40')]({},_0x41eafe,_0x3f0973[_0xdcc6('0x42')]);return db[_0xdcc6('0x2f')][_0xdcc6('0x4b')](_0x41eafe)[_0xdcc6('0x28')](handleEntityNotFound(_0x37cd7f,null))[_0xdcc6('0x28')](function(_0x5a60b6){if(_0x5a60b6){var _0x41c566=_0x5a60b6['get']({'plain':!![]});_0x41c566=qs[_0xdcc6('0x4f')](_0x41c566,['id','createdAt','updatedAt',_0xdcc6('0x50')]);_0x3f0973['body']=_[_0xdcc6('0x4f')](_0x3f0973[_0xdcc6('0x4d')],['id',_0xdcc6('0x51'),_0xdcc6('0x52')]);return db['sequelize']['transaction'](function(_0x942c11){return db[_0xdcc6('0x2f')][_0xdcc6('0x4c')](_[_0xdcc6('0x40')](_0x41c566,_0x3f0973[_0xdcc6('0x4d')]),{'include':_0x3f0973['query'][_0xdcc6('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x942c11})['then'](function(_0x488b58){var _0x41bea1=_0x488b58[_0xdcc6('0x53')]({'plain':!![]});return db['UserProfileSection'][_0xdcc6('0x44')]({'where':{'userProfileId':_0x3f0973[_0xdcc6('0x47')]['id']},'raw':!![]})[_0xdcc6('0x28')](function(_0x4c7bd7){if(_0x4c7bd7){return BPromise[_0xdcc6('0x54')](_0x4c7bd7,function(_0x3a49c3){return new BPromise(function(_0x426b33,_0x41ddfc){if(_0x3a49c3['autoAssociation']===null||_0x3a49c3['autoAssociation']===0x1)_0x426b33(null);return db[_0xdcc6('0x55')]['findAll']({'where':{'sectionId':_0x3a49c3['id']},'raw':!![]})[_0xdcc6('0x28')](function(_0x5c2cac){var _0x1b3efd=_['map'](_0x5c2cac,function(_0x1890fb){return qs[_0xdcc6('0x4f')](_0x1890fb,['id',_0xdcc6('0x51'),'updatedAt','sectionId']);});_0x426b33(_0x1b3efd);})[_0xdcc6('0x45')](function(_0x30edff){_0x41ddfc(_0x30edff);});})[_0xdcc6('0x28')](function(_0x828d3f){var _0x258512=qs[_0xdcc6('0x4f')](_0x3a49c3,['id',_0xdcc6('0x51'),_0xdcc6('0x52')]);_0x258512['userProfileId']=_0x41bea1['id'];if(_0x828d3f)_0x258512[_0xdcc6('0x56')]=_0x828d3f;return _0x258512;})[_0xdcc6('0x28')](function(_0xc0953a){return db['UserProfileSection'][_0xdcc6('0x4c')](_0xc0953a,{'include':[{'model':db[_0xdcc6('0x55')],'as':_0xdcc6('0x56')}],'raw':!![],'transaction':_0x942c11});});})[_0xdcc6('0x28')](function(){return _0x41bea1;});}});});});}})['then'](respondWithResult(_0x37cd7f,0xc9))[_0xdcc6('0x45')](handleError(_0x37cd7f,null));};exports['update']=function(_0x1e09a1,_0x2c9665){if(_0x1e09a1[_0xdcc6('0x4d')]['id']){delete _0x1e09a1['body']['id'];}return db['UserProfile'][_0xdcc6('0x4b')]({'where':{'id':_0x1e09a1[_0xdcc6('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c9665,null))[_0xdcc6('0x28')](saveUpdates(_0x1e09a1[_0xdcc6('0x4d')],null))[_0xdcc6('0x28')](respondWithResult(_0x2c9665,null))['catch'](handleError(_0x2c9665,null));};exports[_0xdcc6('0x29')]=function(_0x37bb16,_0x472cac){return db[_0xdcc6('0x2f')]['find']({'where':{'id':_0x37bb16[_0xdcc6('0x47')]['id']}})['then'](handleEntityNotFound(_0x472cac,null))[_0xdcc6('0x28')](removeEntity(_0x472cac,null))[_0xdcc6('0x45')](handleError(_0x472cac,null));};exports[_0xdcc6('0x57')]=function(_0x1093bf,_0xd36a0a){return db[_0xdcc6('0x2f')]['describe']()[_0xdcc6('0x28')](respondWithResult(_0xd36a0a,null))[_0xdcc6('0x45')](handleError(_0xd36a0a,null));};exports[_0xdcc6('0x58')]=function(_0xa723ca,_0x5b01fa){var _0xa86825=_0xa723ca['body'];return db[_0xdcc6('0x2f')][_0xdcc6('0x4b')]({'where':{'id':_0xa723ca[_0xdcc6('0x47')]['id']}})[_0xdcc6('0x28')](handleEntityNotFound(_0x5b01fa,null))['then'](function(_0x48ae12){if(_0x48ae12){return db[_0xdcc6('0x59')][_0xdcc6('0x5a')](function(_0x408f10){return db[_0xdcc6('0x5b')]['destroy']({'where':{'userProfileId':_0xa723ca[_0xdcc6('0x47')]['id'],'sectionId':_[_0xdcc6('0x2e')](_0xa86825,function(_0x2bac43){return _0x2bac43[_0xdcc6('0x5c')];})},'transaction':_0x408f10})[_0xdcc6('0x28')](function(){var _0x49c566=_[_0xdcc6('0x2e')](_0xa86825,function(_0x2f7dde){_0x2f7dde[_0xdcc6('0x5d')]=_0xa723ca['params']['id'];return _0x2f7dde;});var _0xbebf64=[];return BPromise[_0xdcc6('0x54')](_0x49c566,function(_0x51c826){return db[_0xdcc6('0x5b')]['create'](_0x51c826,{'include':[{'model':db[_0xdcc6('0x55')],'as':_0xdcc6('0x56')}],'raw':!![],'transaction':_0x408f10})['then'](function(_0x18e06){_0xbebf64['push'](_0x18e06[_0xdcc6('0x53')]({'plain':!![]}));});})[_0xdcc6('0x28')](function(){return _0xbebf64;});});});}})[_0xdcc6('0x28')](function(_0x5cb63d){return _0x5cb63d;})[_0xdcc6('0x28')](respondWithResult(_0x5b01fa,null))[_0xdcc6('0x45')](handleError(_0x5b01fa,null));};exports[_0xdcc6('0x5e')]=function(_0x21ef0c,_0x970694){var _0x3a0fb0;return db['UserProfile'][_0xdcc6('0x4b')]({'where':{'id':_0x21ef0c[_0xdcc6('0x47')]['id']},'attributes':['id',_0xdcc6('0x2b')]})[_0xdcc6('0x28')](handleEntityNotFound(_0x970694,null))[_0xdcc6('0x28')](function(_0x5e599a){if(_0x5e599a){_0x3a0fb0=_0x5e599a;return db[_0xdcc6('0x5b')]['destroy']({'where':{'userProfileId':_0x21ef0c[_0xdcc6('0x47')]['id'],'sectionId':_0x21ef0c[_0xdcc6('0x35')]['ids']}});}})[_0xdcc6('0x28')](function(){return _0x3a0fb0;})[_0xdcc6('0x28')](respondWithStatusCode(_0x970694,null))[_0xdcc6('0x45')](handleError(_0x970694,null));};exports[_0xdcc6('0x5f')]=function(_0x21909e,_0x50e3f9){var _0x35f4a0=[];var _0x4853ea=[];return db[_0xdcc6('0x5b')][_0xdcc6('0x44')]({'where':{'userProfileId':_0x21909e[_0xdcc6('0x47')]['id']},'raw':!![]})[_0xdcc6('0x28')](function(_0x475421){_0x35f4a0=_[_0xdcc6('0x3f')](_0x475421,function(_0x245c45){return _0x245c45['enabled']===0x1||_[_0xdcc6('0x60')]([0x3eb,0x709],_0x245c45[_0xdcc6('0x5c')]);});if(!_['isEmpty'](_0x35f4a0)){return _['map'](_0x35f4a0,function(_0x152d2b){return _0x152d2b[_0xdcc6('0x5c')];});}else{return;}})[_0xdcc6('0x28')](function(_0x2263ab){if(_0x2263ab)_0x4853ea=_0x2263ab;if(_[_0xdcc6('0x60')](_0x4853ea,0x64)){var _0x16c4d4=_[_0xdcc6('0x4b')](_0x35f4a0,{'sectionId':0x64});return hasDefaultDashboard(_0x16c4d4)[_0xdcc6('0x28')](function(_0x3434c0){return _[_0xdcc6('0x2e')](_0x35f4a0,function(_0x220b27){if(_0x220b27[_0xdcc6('0x5c')]===0x64){_0x220b27[_0xdcc6('0x61')]=_0x3434c0;}return _0x220b27;});});}else{return;}})[_0xdcc6('0x28')](function(_0xba7095){if(_0xba7095)_0x35f4a0=_0xba7095;if(_['includes'](_0x4853ea,0x3eb)){var _0x7ebc29=_[_0xdcc6('0x4b')](_0x35f4a0,{'sectionId':0x3eb});return getCustomDashboards(_0x7ebc29)[_0xdcc6('0x28')](function(_0x2ebdd4){return _['map'](_0x35f4a0,function(_0x397d4d){if(_0x7ebc29[_0xdcc6('0x62')]){if(_0x397d4d[_0xdcc6('0x5c')]===0x3eb){_0x397d4d[_0xdcc6('0x61')]=_0x2ebdd4;}}else{if(_0x397d4d['sectionId']===0x64){if(!_0x397d4d[_0xdcc6('0x61')]){_0x397d4d[_0xdcc6('0x61')]=[];}_0x397d4d[_0xdcc6('0x61')]=_0x397d4d['subsections'][_0xdcc6('0x63')](_0x2ebdd4);}}return _0x397d4d;});});}else{return;}})[_0xdcc6('0x28')](function(_0x59fcc1){if(_0x59fcc1)_0x35f4a0=_0x59fcc1;if(_[_0xdcc6('0x60')](_0x4853ea,0x709)){var _0x1edfb6=_[_0xdcc6('0x4b')](_0x35f4a0,{'sectionId':0x709});return getPlugins(_0x1edfb6)['then'](function(_0x381d65){if(_0x1edfb6[_0xdcc6('0x62')]){return _['map'](_0x35f4a0,function(_0x5152c6){if(_0x5152c6[_0xdcc6('0x5c')]===0x709){_0x5152c6[_0xdcc6('0x61')]=_0x381d65;}return _0x5152c6;});}else{var _0x58932c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x381d65};var _0x532021=_[_0xdcc6('0x2e')](_0x35f4a0);_0x532021[_0xdcc6('0x64')](_0x58932c);return _0x532021;}});}else{return;}})['then'](function(_0x18e6db){if(_0x18e6db)_0x35f4a0=_0x18e6db;return _[_0xdcc6('0x3f')](_0x35f4a0,[_0xdcc6('0x62'),0x1]);})[_0xdcc6('0x28')](respondWithResult(_0x50e3f9,null))[_0xdcc6('0x45')](handleError(_0x50e3f9,null));};function hasDefaultDashboard(_0x3b9b8a){var _0x501976=[0x65];return new BPromise(function(_0x42695f,_0x5c1c0a){try{if(_0x3b9b8a[_0xdcc6('0x65')]){_0x42695f(_0x501976);}else{return db[_0xdcc6('0x55')][_0xdcc6('0x66')]({'where':{'sectionId':_0x3b9b8a['id']},'raw':!![]})[_0xdcc6('0x28')](function(_0x4f7dd1){_0x4f7dd1?_0x42695f(_0x501976):_0x42695f();});}}catch(_0x795b30){_0x5c1c0a(_0x795b30);}});}function getCustomDashboards(_0x258ce3){var _0x3a500d=[];return new BPromise(function(_0x5e220f,_0x3d1194){try{if(_0x258ce3[_0xdcc6('0x65')]){return db['Dashboard']['findAll']({'raw':!![]})[_0xdcc6('0x28')](function(_0x303d8f){_0x303d8f[_0xdcc6('0x67')](function(_0x5d6916){_0x3a500d[_0xdcc6('0x64')](_0x5d6916['id']+0x1869f);});_0x5e220f(_0x3a500d);});}else{return db['UserProfileResource'][_0xdcc6('0x44')]({'where':{'sectionId':_0x258ce3['id']},'raw':!![]})[_0xdcc6('0x28')](function(_0x1d5c05){_0x1d5c05[_0xdcc6('0x67')](function(_0x1ee490){_0x3a500d[_0xdcc6('0x64')](_0x1ee490[_0xdcc6('0x68')]+0x1869f);});_0x5e220f(_0x3a500d);});}}catch(_0x4ab986){_0x3d1194(_0x4ab986);}});}function getPlugins(_0x254d4e){var _0x2c35b7=[];return new BPromise(function(_0x548070,_0x263ba6){try{if(_0x254d4e['autoAssociation']){return db['Plugin']['findAll']({'raw':!![]})['then'](function(_0x5dfb30){_0x5dfb30[_0xdcc6('0x67')](function(_0x11055f){_0x2c35b7[_0xdcc6('0x64')](_0x11055f['id']+0x15b38);});_0x548070(_0x2c35b7);});}else{return db['UserProfileResource'][_0xdcc6('0x44')]({'where':{'sectionId':_0x254d4e['id']},'raw':!![]})['then'](function(_0x53b369){_0x53b369[_0xdcc6('0x67')](function(_0xb085bd){_0x2c35b7[_0xdcc6('0x64')](_0xb085bd['resourceId']+0x15b38);});_0x548070(_0x2c35b7);});}}catch(_0x52813c){_0x263ba6(_0x52813c);}});}exports[_0xdcc6('0x69')]=function(_0x177a89,_0x49456d){return db[_0xdcc6('0x2f')][_0xdcc6('0x4b')]({'where':{'id':_0x177a89['params']['id']}})[_0xdcc6('0x28')](handleEntityNotFound(_0x49456d,null))[_0xdcc6('0x28')](function(_0x36bf93){if(_0x36bf93){return db[_0xdcc6('0x59')][_0xdcc6('0x5a')](function(_0x5656d3){return db[_0xdcc6('0x5b')][_0xdcc6('0x44')]({'where':{'userProfileId':_0x177a89[_0xdcc6('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0xdcc6('0x28')](function(_0x665f8e){if(_0x665f8e){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x177a89['params']['id'],'id':_[_0xdcc6('0x2e')](_0x665f8e,function(_0x1d3390){return _0x1d3390['id'];})},'transaction':_0x5656d3});}})['then'](function(_0x439de1){var _0xaf8a7f=_[_0xdcc6('0x2e')](_0x177a89[_0xdcc6('0x4d')],function(_0x76ed9a){_0x76ed9a[_0xdcc6('0x5d')]=_0x177a89[_0xdcc6('0x47')]['id'];return _0x76ed9a;});return db[_0xdcc6('0x5b')][_0xdcc6('0x6a')](_0xaf8a7f,{'raw':!![],'transaction':_0x5656d3});})['then'](function(_0x2c2589){var _0x2d0f05=_[_0xdcc6('0x3f')](_[_0xdcc6('0x2e')](_0x2c2589,function(_0x34c103){return _0x34c103[_0xdcc6('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x2d0f05){return db[_0xdcc6('0x5b')][_0xdcc6('0x44')]({'where':{'userProfileId':_0x177a89[_0xdcc6('0x47')]['id'],'sectionId':_[_0xdcc6('0x2e')](_0x2d0f05,function(_0x2a7fa1){return _0x2a7fa1[_0xdcc6('0x5c')];})},'attributes':['id',_0xdcc6('0x5c')],'raw':!![]})[_0xdcc6('0x28')](function(_0x3ad34a){var _0x100a46=_['map'](_0x177a89['body'],function(_0x22f8e6){_0x22f8e6[_0xdcc6('0x5d')]=_0x177a89['params']['id'];return _0x22f8e6;});return db[_0xdcc6('0x55')][_0xdcc6('0x6a')](_0x100a46,{'raw':!![],'transaction':_0x5656d3});});}})['catch'](handleError(_0x49456d,null));});}})[_0xdcc6('0x28')](function(_0x3c3c7f){var _0x44ffcb=_['map'](_0x3c3c7f,function(_0x103145){return _0x103145[_0xdcc6('0x53')]({'plain':!![]});});})[_0xdcc6('0x28')](respondWithResult(_0x49456d,null))[_0xdcc6('0x45')](handleError(_0x49456d,null));};exports[_0xdcc6('0x6b')]=function(_0x801b70,_0x221ffd,_0x84719d){return db['UserProfile'][_0xdcc6('0x4b')]({'where':{'id':_0x801b70[_0xdcc6('0x47')]['id']}})[_0xdcc6('0x28')](handleEntityNotFound(_0x221ffd,null))[_0xdcc6('0x28')](function(_0x4166b5){if(_0x4166b5){return _0x4166b5[_0xdcc6('0x6b')](_0x801b70[_0xdcc6('0x35')][_0xdcc6('0x6c')]);}})[_0xdcc6('0x28')](respondWithStatusCode(_0x221ffd,null))[_0xdcc6('0x45')](handleError(_0x221ffd,null));};exports[_0xdcc6('0x6d')]=function(_0x4caafd,_0x2c7e02){var _0x516498={};if(!_0x4caafd['query'][_0xdcc6('0x6e')])throw new Error(_0xdcc6('0x6f'));if(!_0x4caafd['query'][_0xdcc6('0x39')]('nolimit')){_0x516498[_0xdcc6('0x21')]=qs['limit'](_0x4caafd['query']['limit']);_0x516498['offset']=qs['offset'](_0x4caafd['query'][_0xdcc6('0x1f')]);}return db[_0xdcc6('0x2f')][_0xdcc6('0x4b')]({'where':{'id':_0x4caafd[_0xdcc6('0x47')]['id']}})[_0xdcc6('0x28')](function(_0x8d5e45){if(!_0x8d5e45)throw new Error(_0xdcc6('0x70')+_0x4caafd[_0xdcc6('0x47')]['id']);return db[_0xdcc6('0x2f')]['getResources'](_0x4caafd);})[_0xdcc6('0x28')](respondWithFilteredResult(_0x2c7e02,_0x516498))[_0xdcc6('0x45')](handleError(_0x2c7e02,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index dfcbeca..009c49a 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 _0x96f2=['events','UserProfile','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x2fa371,_0x50a68b){var _0x36744a=function(_0x4650bc){while(--_0x4650bc){_0x2fa371['push'](_0x2fa371['shift']());}};_0x36744a(++_0x50a68b);}(_0x96f2,0xb0));var _0x296f=function(_0x3470ee,_0x3c2291){_0x3470ee=_0x3470ee-0x0;var _0x216892=_0x96f2[_0x3470ee];return _0x216892;};'use strict';var EventEmitter=require(_0x296f('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x296f('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x296f('0x2')](0x0);var events={'afterCreate':_0x296f('0x3'),'afterUpdate':'update','afterDestroy':_0x296f('0x4')};function emitEvent(_0x333b22){return function(_0x334a4e,_0x57f54e,_0x5fae7){UserProfileEvents[_0x296f('0x5')](_0x333b22+':'+_0x334a4e['id'],_0x334a4e);UserProfileEvents['emit'](_0x333b22,_0x334a4e);_0x5fae7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x296f('0x6')](e,emitEvent(event));}}module[_0x296f('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x4815=['hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2dacca,_0x3b55a5){var _0x4e8745=function(_0x4c4515){while(--_0x4c4515){_0x2dacca['push'](_0x2dacca['shift']());}};_0x4e8745(++_0x3b55a5);}(_0x4815,0xff));var _0x5481=function(_0x58bd6f,_0x4487bc){_0x58bd6f=_0x58bd6f-0x0;var _0x242bf0=_0x4815[_0x58bd6f];return _0x242bf0;};'use strict';var EventEmitter=require(_0x5481('0x0'));var UserProfile=require(_0x5481('0x1'))['db'][_0x5481('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5481('0x3')](0x0);var events={'afterCreate':_0x5481('0x4'),'afterUpdate':_0x5481('0x5'),'afterDestroy':_0x5481('0x6')};function emitEvent(_0x4797f0){return function(_0x4a7db7,_0x2e5eec,_0x433e2a){UserProfileEvents[_0x5481('0x7')](_0x4797f0+':'+_0x4a7db7['id'],_0x4a7db7);UserProfileEvents[_0x5481('0x7')](_0x4797f0,_0x4a7db7);_0x433e2a(null);};}for(var e in events){if(events[_0x5481('0x8')](e)){var event=events[e];UserProfile[_0x5481('0x9')](e,emitEvent(event));}}module[_0x5481('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index f4b5a30..a6ca797 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 _0xab48=['zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','Tag','Template','triggers','trunks','Trunk','variables','Variable','plugins','Reports','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','find','params','ignore','union','push','autoAssociation','all','length','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','reportId','DefaultReports','CustomReports','count','rows','ids','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','filter','field','value','findAll','then','associatedResources','map','model','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','SquareProject','childModel','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','CmContact','Lists','ListId','lists','companies','globalcustomfields','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceMail','Agents','membername','User','agent','Telephones','role','telephone','queue','VoiceQueue','inbound','QueueCampaigns','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','queuecampaigns','VoiceQueues','users','agents','telephones','parentSections','Users','admin','user'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xab48,0x1e4));var _0x8ab4=function(_0x19e432,_0xba4339){_0x19e432=_0x19e432-0x0;var _0x30b89a=_0xab48[_0x19e432];return _0x30b89a;};'use strict';var _=require(_0x8ab4('0x0'));var attributes=require(_0x8ab4('0x1'));var qs=require('../../components/parsers/qs');var squel=require(_0x8ab4('0x2'));module[_0x8ab4('0x3')]=function(_0x2eb099){var _0x56db3f=_0x2eb099['models'];function _0x455aee(_0x3e7e5b,_0x3af1d6){return new Promise(function(_0x238d6f,_0x24932f){if(!_0x3af1d6)return _0x238d6f(null);var _0x38dbee=_0x3af1d6[_0x8ab4('0x4')]?{[_0x3af1d6[_0x8ab4('0x4')][_0x8ab4('0x5')]]:_0x3af1d6[_0x8ab4('0x4')][_0x8ab4('0x6')]}:undefined;return _0x56db3f[_0x3e7e5b][_0x8ab4('0x7')]({'where':_0x38dbee,'raw':!![]})[_0x8ab4('0x8')](function(_0x28a63a){_0x3af1d6[_0x8ab4('0x9')]=_[_0x8ab4('0xa')](_0x28a63a,'id');_0x238d6f(_0x3af1d6);})['catch'](function(_0xabf3b3){_0x24932f(_0xabf3b3);});});}function _0x553e0b(_0x1be72d,_0x3271a7){return new Promise(function(_0x9f82e2,_0x189102){var _0x3338d7=_0x1be72d[_0x8ab4('0x4')]?{[_0x1be72d[_0x8ab4('0x4')][_0x8ab4('0x5')]]:_0x1be72d['filter'][_0x8ab4('0x6')]}:undefined;return _0x56db3f[_0x1be72d[_0x8ab4('0xb')]][_0x8ab4('0x7')]({'where':_0x3338d7,'raw':!![]})[_0x8ab4('0x8')](function(_0x186dc9){_0x3271a7['associatedResources']=_['map'](_0x186dc9,function(_0x2cbcc8){return _0x2cbcc8[_0x8ab4('0xc')];});_0x9f82e2(_0x3271a7);})[_0x8ab4('0xd')](function(_0x4c33cd){_0x189102(_0x4c33cd);});});}function _0x855ea8(_0x55d70f,_0x942f9a,_0x1149db){if(!_0x942f9a)return Promise[_0x8ab4('0xe')](null);return new Promise(function(_0x1882a,_0x127b34){return _0x56db3f[_0x8ab4('0xf')][_0x8ab4('0x7')]({'where':{'sectionId':_0x942f9a['id']},'raw':!![]})[_0x8ab4('0x8')](function(_0x16cffe){if(_0x55d70f[_0x8ab4('0x5')]&&_0x55d70f['field']!=='id'){_0x942f9a[_0x8ab4('0x9')]=_[_0x8ab4('0xa')](_0x16cffe,function(_0x3622d7){return _0x3622d7[_0x55d70f[_0x8ab4('0x5')]];});}else{if(_0x1149db===_0x8ab4('0x10')){_0x942f9a[_0x8ab4('0x9')]=_['map'](_0x16cffe,function(_0x2874e5){return{'id':_0x2874e5[_0x8ab4('0x11')],'type':_0x2874e5[_0x8ab4('0x12')]};});}else{_0x942f9a[_0x8ab4('0x9')]=_[_0x8ab4('0xa')](_0x16cffe,function(_0x3080a5){return _0x3080a5['resourceId'];});}}_0x1882a(_0x942f9a);})[_0x8ab4('0xd')](function(_0x3364c4){_0x127b34(_0x3364c4);});});}function _0x2f349d(_0x372a0b,_0x44363b){var _0x432597={'parentSections':[]};switch(_0x372a0b[_0x8ab4('0x13')]()){case _0x8ab4('0x14'):_0x432597['childModel']=_0x8ab4('0x15');break;case'odbc':_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x17');break;case _0x8ab4('0x18'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x19');_0x432597['parentSections']=[{'name':_0x8ab4('0x1a'),'field':_0x8ab4('0xc'),'foreignKey':_0x8ab4('0x1b')}];break;case _0x8ab4('0x1c'):_0x432597[_0x8ab4('0x16')]='JscriptyProject';break;case'contacts':_0x432597['childModel']=_0x8ab4('0x1d');_0x432597['parentSections']=[{'name':_0x8ab4('0x1e'),'field':'id','foreignKey':_0x8ab4('0x1f')}];break;case _0x8ab4('0x20'):_0x432597[_0x8ab4('0x16')]='CmList';break;case _0x8ab4('0x21'):_0x432597[_0x8ab4('0x16')]='CmCompany';break;case _0x8ab4('0x22'):_0x432597[_0x8ab4('0x16')]='CmCustomField';break;case'chatqueues':_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x23');break;case _0x8ab4('0x24'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x25');break;case'faxqueues':_0x432597['childModel']=_0x8ab4('0x26');break;case _0x8ab4('0x27'):_0x432597['childModel']=_0x8ab4('0x28');break;case _0x8ab4('0x29'):case _0x8ab4('0x2a'):case _0x8ab4('0x2b'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x2c');break;case _0x8ab4('0x2d'):_0x432597['childModel']='VoiceContext';break;case'voicemails':_0x432597['childModel']=_0x8ab4('0x2e');break;case'voicerecordings':_0x432597['childModel']='VoiceRecording';_0x432597['parentSections']=[{'name':_0x8ab4('0x2f'),'field':'name','foreignKey':_0x8ab4('0x30'),'model':_0x8ab4('0x31'),'filter':{'field':'role','value':[_0x8ab4('0x32')]}},{'name':_0x8ab4('0x33'),'field':_0x8ab4('0xc'),'foreignKey':_0x8ab4('0x30'),'model':_0x8ab4('0x31'),'filter':{'field':_0x8ab4('0x34'),'value':[_0x8ab4('0x35')]}},{'name':'VoiceQueues','field':_0x8ab4('0xc'),'foreignKey':_0x8ab4('0x36'),'model':_0x8ab4('0x37'),'filter':{'field':'type','value':[_0x8ab4('0x38')]}},{'name':_0x8ab4('0x39'),'field':_0x8ab4('0xc'),'foreignKey':_0x8ab4('0x36'),'model':'VoiceQueue','filter':{'field':'type','value':['outbound']}}];break;case'musiconholds':_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x3a');break;case _0x8ab4('0x3b'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x3c');break;case _0x8ab4('0x3d'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x3e');break;case _0x8ab4('0x3f'):_0x432597[_0x8ab4('0x16')]='Campaign';break;case _0x8ab4('0x40'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x41');break;case'mailaccounts':_0x432597['childModel']=_0x8ab4('0x42');break;case _0x8ab4('0x43'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x44');break;case'openchannelqueues':_0x432597[_0x8ab4('0x16')]='OpenchannelQueue';break;case _0x8ab4('0x45'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x46');break;case _0x8ab4('0x47'):_0x432597['childModel']=_0x8ab4('0x48');break;case _0x8ab4('0x49'):_0x432597['childModel']=_0x8ab4('0x4a');break;case _0x8ab4('0x4b'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x4c');break;case'whatsappaccounts':_0x432597['childModel']=_0x8ab4('0x4d');break;case _0x8ab4('0x4e'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x4f');break;case'voicequeues':case _0x8ab4('0x50'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x37');if(_0x44363b){_0x432597['parentSections']=[{'name':_0x8ab4('0x51')},{'name':_0x8ab4('0x39')}];}break;case _0x8ab4('0x52'):case _0x8ab4('0x53'):case _0x8ab4('0x54'):_0x432597['childModel']=_0x8ab4('0x31');if(_0x44363b){_0x432597[_0x8ab4('0x55')]=[{'name':_0x8ab4('0x56'),'filter':{'field':_0x8ab4('0x34'),'value':[_0x8ab4('0x57'),_0x8ab4('0x58')]},'ignore':!![]},{'name':_0x8ab4('0x2f')},{'name':_0x8ab4('0x33')}];}break;case _0x8ab4('0x59'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x5a');break;case _0x8ab4('0x5b'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x5c');break;case'freshdeskaccounts':_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x5d');break;case _0x8ab4('0x5e'):_0x432597['childModel']='SugarcrmAccount';break;case _0x8ab4('0x5f'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x60');break;case _0x8ab4('0x61'):_0x432597[_0x8ab4('0x16')]='ZohoAccount';break;case _0x8ab4('0x62'):_0x432597[_0x8ab4('0x16')]='User';break;case _0x8ab4('0x63'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x64');break;case _0x8ab4('0x65'):_0x432597[_0x8ab4('0x16')]='Disposition';break;case _0x8ab4('0x66'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x67');break;case _0x8ab4('0x68'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x69');break;case _0x8ab4('0x6a'):_0x432597[_0x8ab4('0x16')]='Pause';break;case _0x8ab4('0x6b'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x6c');break;case _0x8ab4('0x6d'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x6e');break;case'tags':_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x6f');break;case'templates':_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x70');break;case _0x8ab4('0x71'):_0x432597[_0x8ab4('0x16')]='Trigger';break;case _0x8ab4('0x72'):_0x432597['childModel']=_0x8ab4('0x73');break;case _0x8ab4('0x74'):_0x432597['childModel']=_0x8ab4('0x75');break;case _0x8ab4('0x76'):_0x432597[_0x8ab4('0x16')]='Plugin';break;case'extractedreports':_0x432597['childModel']=_0x8ab4('0x10');_0x432597[_0x8ab4('0x55')]=[{'name':_0x8ab4('0x77'),'field':'id','foreignKey':'reportId'}];break;case _0x8ab4('0x78'):_0x432597[_0x8ab4('0x16')]=_0x8ab4('0x79');break;}return _0x432597;}function _0x2fb00e(_0x2263d0,_0x49e37a){var _0x1f52d8=_0x2263d0[_0x8ab4('0x7a')](0x0)[_0x8ab4('0x7b')]()+_0x2263d0['slice'](0x1);var _0x41784d={'type':_0x56db3f[_0x8ab4('0x7c')][_0x8ab4('0x7d')][_0x8ab4('0x7e')],'raw':!![]};return new Promise(function(_0x57004a,_0x3b9ff1){var _0x23ae71=squel['select']()[_0x8ab4('0x5')](_0x8ab4('0x7f')+_0x1f52d8+_0x8ab4('0x80'),'id')[_0x8ab4('0x5')](_0x8ab4('0x81'))[_0x8ab4('0x82')](_0x8ab4('0x83')+_0x2263d0+_0x8ab4('0x84'),'ui')[_0x8ab4('0x85')](_0x8ab4('0x86'),_0x49e37a['id']);return _0x56db3f[_0x8ab4('0x87')]['query'](_0x23ae71[_0x8ab4('0x88')](),_0x41784d)[_0x8ab4('0x8')](function(_0x5a294e){_0x49e37a[_0x1f52d8+'OpenTabs']=_0x5a294e;_0x57004a(_0x5a294e);})[_0x8ab4('0xd')](function(_0x52c52d){_0x3b9ff1(_0x52c52d);});});}return _0x2eb099['define']('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1a2932){var _0x57022c={'raw':_0x1a2932['query']['raw'],'where':{}};var _0x1bfdd9={};var _0x36b8b1={'count':0x0,'rows':[]};var _0x102a6c=_0x1a2932[_0x8ab4('0x89')][_0x8ab4('0x8a')];var _0x1edf29=_0x1a2932['query'][_0x8ab4('0x8b')]||![];var _0x3a3c51=_0x2f349d(_0x102a6c,_0x1edf29);if(!_0x3a3c51[_0x8ab4('0x16')])throw new Error(_0x8ab4('0x8c')+_0x102a6c+'\x27');var _0x2b0e7a=[{'name':_0x102a6c}];if(!_[_0x8ab4('0x8d')](_0x3a3c51['parentSections']))_0x2b0e7a=_0x3a3c51[_0x8ab4('0x55')];var _0x292706=[];for(var _0x3d31dc=0x0;_0x3d31dc<_0x2b0e7a['length'];_0x3d31dc++){_0x292706['push'](_0x56db3f['UserProfileSection'][_0x8ab4('0x8e')]({'where':{'userProfileId':_0x1a2932[_0x8ab4('0x8f')]['id'],'name':_0x2b0e7a[_0x3d31dc][_0x8ab4('0xc')]},'raw':!![]}));}return Promise['all'](_0x292706)[_0x8ab4('0x8')](function(_0x473e07){var _0x2ca1b1=_[_0x8ab4('0x4')](_0x473e07,function(_0x6bb99b){return _0x6bb99b?_0x6bb99b:undefined;});var _0x261f2c=_[_0x8ab4('0x4')](_0x2b0e7a,[_0x8ab4('0x90'),!![]]);var _0x3e7eaa=_[_0x8ab4('0x8d')](_0x2ca1b1)&&_[_0x8ab4('0x8d')](_0x261f2c)?null:_[_0x8ab4('0x91')](_0x261f2c,_0x2ca1b1);if(!_0x3e7eaa)return null;var _0x4958a6=[];for(var _0x1a8fd8=0x0;_0x1a8fd8<_0x3e7eaa['length'];_0x1a8fd8++){var _0xf2694c=_[_0x8ab4('0x8e')](_0x2b0e7a,function(_0x106504){return _0x3e7eaa[_0x1a8fd8]?_0x106504[_0x8ab4('0xc')]===_0x3e7eaa[_0x1a8fd8][_0x8ab4('0xc')]:null;});if(_0xf2694c){if(_0x3e7eaa[_0x1a8fd8]['ignore']){_0x4958a6[_0x8ab4('0x92')](_0x455aee(_0x3a3c51[_0x8ab4('0x16')],_0x3e7eaa[_0x1a8fd8]));}else{if(!_0x3e7eaa[_0x1a8fd8][_0x8ab4('0x93')]){_0x4958a6['push'](_0x855ea8(_0xf2694c,_0x3e7eaa[_0x1a8fd8],_0x3a3c51['childModel']));}else{if(_0xf2694c[_0x8ab4('0xb')]){_0x4958a6[_0x8ab4('0x92')](_0x553e0b(_0xf2694c,_0x3e7eaa[_0x1a8fd8]));}}}}}return Promise[_0x8ab4('0x94')](_0x4958a6);})[_0x8ab4('0x8')](function(_0x3abe3e){var _0x21a0e6=_0x3abe3e;var _0x47a5a0=null;if(_0x21a0e6){_0x47a5a0=_0x21a0e6[_0x8ab4('0x95')]===0x1?_0x21a0e6[0x0]:null;}if(!_0x47a5a0&&!_0x21a0e6)return _0x36b8b1;var _0x4536bb=_0x56db3f[_0x3a3c51['childModel']][_0x8ab4('0x96')];_0x1bfdd9[_0x8ab4('0xb')]=_[_0x8ab4('0x97')](_0x4536bb);_0x1bfdd9[_0x8ab4('0x89')]=_['keys'](_0x1a2932[_0x8ab4('0x89')]);_0x1bfdd9[_0x8ab4('0x98')]=_[_0x8ab4('0x99')](_0x1bfdd9['model'],_0x1bfdd9[_0x8ab4('0x89')]);_0x57022c[_0x8ab4('0x9a')]=_['intersection'](_0x1bfdd9[_0x8ab4('0xb')],qs[_0x8ab4('0x9b')](_0x1a2932[_0x8ab4('0x89')][_0x8ab4('0x9b')]));_0x57022c['attributes']=_0x57022c['attributes'][_0x8ab4('0x95')]?_0x57022c[_0x8ab4('0x9a')]:_0x1bfdd9[_0x8ab4('0xb')];if(!_0x1a2932[_0x8ab4('0x89')][_0x8ab4('0x9c')](_0x8ab4('0x9d'))){_0x57022c['limit']=qs[_0x8ab4('0x9e')](_0x1a2932[_0x8ab4('0x89')]['limit']);_0x57022c[_0x8ab4('0x9f')]=qs[_0x8ab4('0x9f')](_0x1a2932[_0x8ab4('0x89')][_0x8ab4('0x9f')]);}_0x57022c[_0x8ab4('0xa0')]=qs[_0x8ab4('0xa1')](_0x1a2932[_0x8ab4('0x89')][_0x8ab4('0xa1')]);_0x57022c[_0x8ab4('0x85')]=qs['filters'](_['pick'](_0x1a2932[_0x8ab4('0x89')],_0x1bfdd9['filters']));if(_0x1a2932['query']['filter']){_0x57022c[_0x8ab4('0x85')]=_[_0x8ab4('0xa2')](_0x57022c[_0x8ab4('0x85')],{'$or':_[_0x8ab4('0xa')](_0x4536bb,function(_0xc01dc7){if(_0xc01dc7[_0x8ab4('0x12')][_0x8ab4('0xa3')]!==_0x8ab4('0xa4')){var _0x1a81ee={};_0x1a81ee[_0xc01dc7['field']]={'$like':'%'+_0x1a2932[_0x8ab4('0x89')][_0x8ab4('0x4')]+'%'};return _0x1a81ee;}})});}var _0x54a081=[];var _0xab2201=null;var _0x2bb16e={};if(_0x47a5a0){_0xab2201=_['find'](_0x2b0e7a,[_0x8ab4('0xc'),_0x47a5a0[_0x8ab4('0xc')]]);if(_0xab2201[_0x8ab4('0x5')]){_0x2bb16e={};if(_0x3a3c51[_0x8ab4('0x16')]==='AnalyticExtractedReport'){_0x2bb16e[_0xab2201[_0x8ab4('0xa5')]]=_[_0x8ab4('0xa')](_0x47a5a0[_0x8ab4('0x9')],'id');}else{_0x2bb16e[_0xab2201[_0x8ab4('0xa5')]]=_0x47a5a0[_0x8ab4('0x9')];}_0x54a081['push'](_0x2bb16e);}else{_0x57022c[_0x8ab4('0x85')]['id']=_0x47a5a0['associatedResources'];}}else{for(var _0x417ca9=0x0;_0x417ca9<_0x21a0e6[_0x8ab4('0x95')];_0x417ca9++){_0xab2201=_[_0x8ab4('0x8e')](_0x2b0e7a,[_0x8ab4('0xc'),_0x21a0e6[_0x417ca9]['name']]);if(_0xab2201[_0x8ab4('0x5')]){_0x2bb16e={};_0x2bb16e[_0xab2201['foreignKey']]=_0x21a0e6[_0x417ca9][_0x8ab4('0x9')];_0x54a081[_0x8ab4('0x92')](_0x2bb16e);}else{if(!_0x57022c[_0x8ab4('0x85')]['id'])_0x57022c[_0x8ab4('0x85')]['id']=[];_0x21a0e6[_0x417ca9][_0x8ab4('0x9')][_0x8ab4('0xa6')](function(_0x174a34){_0x57022c[_0x8ab4('0x85')]['id']['push'](_0x174a34);});}}}if(!_[_0x8ab4('0x8d')](_0x54a081)){_0x57022c[_0x8ab4('0x85')]=_[_0x8ab4('0xa2')](_0x57022c['where'],{'$and':{'$or':_0x54a081}});}_0x57022c=_[_0x8ab4('0xa2')]({},_0x57022c,_0x1a2932[_0x8ab4('0xa7')]);if(_0x47a5a0&&!_0x47a5a0[_0x8ab4('0x93')]&&_0x3a3c51[_0x8ab4('0x16')]==='AnalyticExtractedReport'){if(_0x1a2932['query'][_0x8ab4('0xa8')]){_0x57022c[_0x8ab4('0xa9')]=[{'all':!![]}];}return _0x56db3f[_0x3a3c51[_0x8ab4('0x16')]]['findAll'](_0x57022c)[_0x8ab4('0x8')](function(_0xb7917b){var _0x1e7da7=[];_0xb7917b[_0x8ab4('0xa6')](function(_0xe55247){var _0x5dd822;switch(_0xe55247[_0x8ab4('0xaa')]){case'default':_0x5dd822=_[_0x8ab4('0x8e')](_0x47a5a0['associatedResources'],function(_0x1eca50){return _0x1eca50['id']===_0xe55247[_0x8ab4('0xab')]&&_0x1eca50[_0x8ab4('0x12')]===_0x8ab4('0xac');});break;case'custom':_0x5dd822=_[_0x8ab4('0x8e')](_0x47a5a0[_0x8ab4('0x9')],function(_0x34c420){return _0x34c420['id']===_0xe55247[_0x8ab4('0xab')]&&_0x34c420[_0x8ab4('0x12')]===_0x8ab4('0xad');});break;}if(_0x5dd822)_0x1e7da7[_0x8ab4('0x92')](_0xe55247);});_0x36b8b1[_0x8ab4('0xae')]=_0x1e7da7[_0x8ab4('0x95')];_0x36b8b1[_0x8ab4('0xaf')]=_0x1e7da7;return _0x36b8b1;});}else{if(!_['isEmpty'](_0x1a2932[_0x8ab4('0x89')]['ids'])){_0x57022c[_0x8ab4('0x85')]['id']=_0x57022c[_0x8ab4('0x85')]['id']?_[_0x8ab4('0x99')](_0x57022c[_0x8ab4('0x85')]['id'],_0x1a2932['query'][_0x8ab4('0xb0')]):_0x1a2932[_0x8ab4('0x89')][_0x8ab4('0xb0')];if(_0x1a2932[_0x8ab4('0x89')]['customSorting']){_0x57022c['order']=_0x1a2932[_0x8ab4('0x89')]['customSorting'];}}if(_0x1a2932[_0x8ab4('0x89')][_0x8ab4('0xb1')]){_0x57022c[_0x8ab4('0x85')]=_[_0x8ab4('0xa2')](_0x57022c[_0x8ab4('0x85')],{'$and':_0x1a2932['query'][_0x8ab4('0xb1')]});}return _0x56db3f[_0x3a3c51[_0x8ab4('0x16')]]['count']({'where':_0x57022c[_0x8ab4('0x85')]})[_0x8ab4('0x8')](function(_0x2e22e9){_0x36b8b1['count']=_0x2e22e9;if(_0x1a2932[_0x8ab4('0x89')][_0x8ab4('0xa8')]){if(_0x3a3c51[_0x8ab4('0x16')]===_0x8ab4('0x1d')){_0x57022c[_0x8ab4('0xa9')]=[{'model':_0x56db3f[_0x8ab4('0x6f')],'as':_0x8ab4('0xb2'),'attributes':['id',_0x8ab4('0xc'),_0x8ab4('0xb3')],'required':_0x1a2932[_0x8ab4('0x89')][_0x8ab4('0xb4')]?!![]:![]},{'model':_0x56db3f[_0x8ab4('0x6f')],'as':_0x8ab4('0xb5'),'attributes':['id','name',_0x8ab4('0xb3')],'through':_0x1a2932[_0x8ab4('0x89')][_0x8ab4('0xb4')]?{'attributes':[],'where':{'TagId':_0x1a2932['query'][_0x8ab4('0xb4')]||undefined}}:{},'required':_0x1a2932[_0x8ab4('0x89')][_0x8ab4('0xb4')]?!![]:![]}];}else{_0x57022c[_0x8ab4('0xa9')]=[{'all':!![]}];}}return _0x56db3f[_0x3a3c51[_0x8ab4('0x16')]][_0x8ab4('0x7')](_0x57022c);})[_0x8ab4('0x8')](function(_0x5aeb38){_0x36b8b1[_0x8ab4('0xaf')]=_0x5aeb38;if(_0x102a6c==='Agents'&&_0x1a2932[_0x8ab4('0x89')][_0x8ab4('0xb6')]===_0x8ab4('0xb7')){var _0x1a2067=[];for(var _0x527f8a=0x0;_0x527f8a<_0x36b8b1[_0x8ab4('0xaf')][_0x8ab4('0x95')];_0x527f8a++){_0x1a2067['push'](_0x2fb00e(_0x8ab4('0xb8'),_0x36b8b1[_0x8ab4('0xaf')][_0x527f8a][_0x8ab4('0xb9')]));_0x1a2067[_0x8ab4('0x92')](_0x2fb00e(_0x8ab4('0xba'),_0x36b8b1['rows'][_0x527f8a]['dataValues']));_0x1a2067[_0x8ab4('0x92')](_0x2fb00e(_0x8ab4('0xbb'),_0x36b8b1['rows'][_0x527f8a][_0x8ab4('0xb9')]));_0x1a2067[_0x8ab4('0x92')](_0x2fb00e(_0x8ab4('0xbc'),_0x36b8b1['rows'][_0x527f8a][_0x8ab4('0xb9')]));_0x1a2067['push'](_0x2fb00e(_0x8ab4('0xbd'),_0x36b8b1['rows'][_0x527f8a][_0x8ab4('0xb9')]));_0x1a2067[_0x8ab4('0x92')](_0x2fb00e(_0x8ab4('0xbe'),_0x36b8b1['rows'][_0x527f8a][_0x8ab4('0xb9')]));}return Promise[_0x8ab4('0x94')](_0x1a2067)['then'](function(){return _0x36b8b1;});}return _0x36b8b1;});}});}}});}; \ No newline at end of file +var _0x7763=['associatedResources','model','findAll','then','map','catch','AnalyticExtractedReport','resourceId','type','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','Telephones','telephone','VoiceQueues','queue','inbound','outbound','musiconholds','chanspies','VoiceChanSpy','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','VoiceQueue','QueueCampaigns','users','agents','telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','dispositions','intervals','Interval','pauses','Schedule','sounds','tags','Template','triggers','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','params','all','ignore','union','find','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','sort','merge','VIRTUAL','foreignKey','forEach','isEmpty','autoAssociation','includeAll','include','reportType','DefaultReports','custom','CustomReports','count','ids','customSorting','order','extraQueryConditions','CmContact','Tag','Tags','tag','ThroughTags','rows','openTabs','true','chat','sms','dataValues','openchannel','whatsapp','lodash','../../components/parsers/qs','exports','models','filter','field','value'];(function(_0x35268f,_0x5226e8){var _0x4787e7=function(_0x2bf4e1){while(--_0x2bf4e1){_0x35268f['push'](_0x35268f['shift']());}};_0x4787e7(++_0x5226e8);}(_0x7763,0x16d));var _0x3776=function(_0x164eb1,_0x198a7d){_0x164eb1=_0x164eb1-0x0;var _0x73311=_0x7763[_0x164eb1];return _0x73311;};'use strict';var _=require(_0x3776('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x3776('0x1'));var squel=require('squel');module[_0x3776('0x2')]=function(_0x12533c){var _0x3d3e11=_0x12533c[_0x3776('0x3')];function _0x2816ba(_0x1f6207,_0x275cfb){return new Promise(function(_0x2b9b5b,_0xe16e04){if(!_0x275cfb)return _0x2b9b5b(null);var _0x5c0cab=_0x275cfb[_0x3776('0x4')]?{[_0x275cfb[_0x3776('0x4')][_0x3776('0x5')]]:_0x275cfb[_0x3776('0x4')][_0x3776('0x6')]}:undefined;return _0x3d3e11[_0x1f6207]['findAll']({'where':_0x5c0cab,'raw':!![]})['then'](function(_0x5dcc24){_0x275cfb[_0x3776('0x7')]=_['map'](_0x5dcc24,'id');_0x2b9b5b(_0x275cfb);})['catch'](function(_0x5a42b7){_0xe16e04(_0x5a42b7);});});}function _0x213d1a(_0x1d2615,_0x2cabb){return new Promise(function(_0x372111,_0x5cfc07){var _0x20dd19=_0x1d2615['filter']?{[_0x1d2615[_0x3776('0x4')][_0x3776('0x5')]]:_0x1d2615[_0x3776('0x4')][_0x3776('0x6')]}:undefined;return _0x3d3e11[_0x1d2615[_0x3776('0x8')]][_0x3776('0x9')]({'where':_0x20dd19,'raw':!![]})[_0x3776('0xa')](function(_0x46ae32){_0x2cabb[_0x3776('0x7')]=_[_0x3776('0xb')](_0x46ae32,function(_0x34407e){return _0x34407e['name'];});_0x372111(_0x2cabb);})[_0x3776('0xc')](function(_0x19618f){_0x5cfc07(_0x19618f);});});}function _0x9073b8(_0x3465a6,_0x4d202c,_0x59e9c3){if(!_0x4d202c)return Promise['resolve'](null);return new Promise(function(_0x25e891,_0x151cf2){return _0x3d3e11['UserProfileResource'][_0x3776('0x9')]({'where':{'sectionId':_0x4d202c['id']},'raw':!![]})[_0x3776('0xa')](function(_0x51eef4){if(_0x3465a6['field']&&_0x3465a6['field']!=='id'){_0x4d202c[_0x3776('0x7')]=_['map'](_0x51eef4,function(_0x325253){return _0x325253[_0x3465a6['field']];});}else{if(_0x59e9c3===_0x3776('0xd')){_0x4d202c[_0x3776('0x7')]=_['map'](_0x51eef4,function(_0x102b78){return{'id':_0x102b78[_0x3776('0xe')],'type':_0x102b78[_0x3776('0xf')]};});}else{_0x4d202c[_0x3776('0x7')]=_[_0x3776('0xb')](_0x51eef4,function(_0x329d6d){return _0x329d6d[_0x3776('0xe')];});}}_0x25e891(_0x4d202c);})[_0x3776('0xc')](function(_0x2eb737){_0x151cf2(_0x2eb737);});});}function _0x3bbc3c(_0x3ad43d,_0x35e2e5){var _0x59fce0={'parentSections':[]};switch(_0x3ad43d['toLowerCase']()){case'squareprojects':_0x59fce0[_0x3776('0x10')]=_0x3776('0x11');break;case _0x3776('0x12'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x13');break;case _0x3776('0x14'):_0x59fce0[_0x3776('0x10')]='SquareRecording';_0x59fce0[_0x3776('0x15')]=[{'name':_0x3776('0x16'),'field':_0x3776('0x17'),'foreignKey':_0x3776('0x18')}];break;case _0x3776('0x19'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x1a');break;case _0x3776('0x1b'):_0x59fce0[_0x3776('0x10')]='CmContact';_0x59fce0[_0x3776('0x15')]=[{'name':_0x3776('0x1c'),'field':'id','foreignKey':_0x3776('0x1d')}];break;case _0x3776('0x1e'):_0x59fce0['childModel']=_0x3776('0x1f');break;case'companies':_0x59fce0[_0x3776('0x10')]=_0x3776('0x20');break;case _0x3776('0x21'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x22');break;case _0x3776('0x23'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x24');break;case _0x3776('0x25'):_0x59fce0['childModel']=_0x3776('0x26');break;case _0x3776('0x27'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x28');break;case _0x3776('0x29'):_0x59fce0['childModel']=_0x3776('0x2a');break;case _0x3776('0x2b'):case _0x3776('0x2c'):case _0x3776('0x2d'):_0x59fce0[_0x3776('0x10')]='VoiceExtension';break;case _0x3776('0x2e'):_0x59fce0[_0x3776('0x10')]='VoiceContext';break;case _0x3776('0x2f'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x30');break;case _0x3776('0x31'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x32');_0x59fce0[_0x3776('0x15')]=[{'name':_0x3776('0x33'),'field':_0x3776('0x17'),'foreignKey':_0x3776('0x34'),'model':_0x3776('0x35'),'filter':{'field':'role','value':['agent']}},{'name':_0x3776('0x36'),'field':_0x3776('0x17'),'foreignKey':_0x3776('0x34'),'model':_0x3776('0x35'),'filter':{'field':'role','value':[_0x3776('0x37')]}},{'name':_0x3776('0x38'),'field':_0x3776('0x17'),'foreignKey':_0x3776('0x39'),'model':'VoiceQueue','filter':{'field':_0x3776('0xf'),'value':[_0x3776('0x3a')]}},{'name':'QueueCampaigns','field':_0x3776('0x17'),'foreignKey':_0x3776('0x39'),'model':'VoiceQueue','filter':{'field':_0x3776('0xf'),'value':[_0x3776('0x3b')]}}];break;case _0x3776('0x3c'):_0x59fce0[_0x3776('0x10')]='VoiceMusicOnHold';break;case _0x3776('0x3d'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x3e');break;case'voiceprefixes':_0x59fce0[_0x3776('0x10')]=_0x3776('0x3f');break;case'ivrcampaigns':_0x59fce0[_0x3776('0x10')]=_0x3776('0x40');break;case _0x3776('0x41'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x42');break;case _0x3776('0x43'):_0x59fce0['childModel']='MailAccount';break;case'mailsubstatuses':_0x59fce0[_0x3776('0x10')]=_0x3776('0x44');break;case _0x3776('0x45'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x46');break;case _0x3776('0x47'):_0x59fce0['childModel']=_0x3776('0x48');break;case _0x3776('0x49'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x4a');break;case _0x3776('0x4b'):_0x59fce0['childModel']=_0x3776('0x4c');break;case _0x3776('0x4d'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x4e');break;case _0x3776('0x4f'):_0x59fce0['childModel']=_0x3776('0x50');break;case _0x3776('0x51'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x52');break;case'voicequeues':case'queuecampaigns':_0x59fce0[_0x3776('0x10')]=_0x3776('0x53');if(_0x35e2e5){_0x59fce0[_0x3776('0x15')]=[{'name':_0x3776('0x38')},{'name':_0x3776('0x54')}];}break;case _0x3776('0x55'):case _0x3776('0x56'):case _0x3776('0x57'):_0x59fce0['childModel']=_0x3776('0x35');if(_0x35e2e5){_0x59fce0[_0x3776('0x15')]=[{'name':'Users','filter':{'field':'role','value':['admin','user']},'ignore':!![]},{'name':_0x3776('0x33')},{'name':_0x3776('0x36')}];}break;case _0x3776('0x58'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x59');break;case _0x3776('0x5a'):_0x59fce0['childModel']=_0x3776('0x5b');break;case'freshdeskaccounts':_0x59fce0[_0x3776('0x10')]='FreshdeskAccount';break;case _0x3776('0x5c'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x5d');break;case _0x3776('0x5e'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x5f');break;case'zohoaccounts':_0x59fce0[_0x3776('0x10')]=_0x3776('0x60');break;case'vtigeraccounts':_0x59fce0[_0x3776('0x10')]=_0x3776('0x35');break;case _0x3776('0x61'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x62');break;case _0x3776('0x63'):_0x59fce0[_0x3776('0x10')]='Disposition';break;case'customdashboards':_0x59fce0[_0x3776('0x10')]='Dashboard';break;case _0x3776('0x64'):_0x59fce0[_0x3776('0x10')]=_0x3776('0x65');break;case _0x3776('0x66'):_0x59fce0[_0x3776('0x10')]='Pause';break;case'scheduler':_0x59fce0[_0x3776('0x10')]=_0x3776('0x67');break;case _0x3776('0x68'):_0x59fce0[_0x3776('0x10')]='Sound';break;case _0x3776('0x69'):_0x59fce0[_0x3776('0x10')]='Tag';break;case'templates':_0x59fce0[_0x3776('0x10')]=_0x3776('0x6a');break;case _0x3776('0x6b'):_0x59fce0[_0x3776('0x10')]='Trigger';break;case'trunks':_0x59fce0[_0x3776('0x10')]=_0x3776('0x6c');break;case _0x3776('0x6d'):_0x59fce0['childModel']=_0x3776('0x6e');break;case _0x3776('0x6f'):_0x59fce0['childModel']=_0x3776('0x70');break;case _0x3776('0x71'):_0x59fce0[_0x3776('0x10')]=_0x3776('0xd');_0x59fce0[_0x3776('0x15')]=[{'name':_0x3776('0x72'),'field':'id','foreignKey':_0x3776('0x73')}];break;case'metrics':_0x59fce0[_0x3776('0x10')]=_0x3776('0x74');break;}return _0x59fce0;}function _0x14fce1(_0x33ffe9,_0x5108b6){var _0x59f170=_0x33ffe9[_0x3776('0x75')](0x0)[_0x3776('0x76')]()+_0x33ffe9['slice'](0x1);var _0xa8a5b={'type':_0x3d3e11[_0x3776('0x77')][_0x3776('0x78')]['SELECT'],'raw':!![]};return new Promise(function(_0x12ed97,_0x5847cb){var _0x5bf055=squel[_0x3776('0x79')]()[_0x3776('0x5')]('ui.'+_0x59f170+_0x3776('0x7a'),'id')['field'](_0x3776('0x7b'))[_0x3776('0x7c')](_0x3776('0x7d')+_0x33ffe9+_0x3776('0x7e'),'ui')[_0x3776('0x7f')](_0x3776('0x80'),_0x5108b6['id']);return _0x3d3e11['sequelize'][_0x3776('0x81')](_0x5bf055[_0x3776('0x82')](),_0xa8a5b)[_0x3776('0xa')](function(_0x3a39b9){_0x5108b6[_0x59f170+_0x3776('0x83')]=_0x3a39b9;_0x12ed97(_0x3a39b9);})[_0x3776('0xc')](function(_0x540f37){_0x5847cb(_0x540f37);});});}return _0x12533c[_0x3776('0x84')](_0x3776('0x85'),attributes,{'tableName':_0x3776('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x27d459){var _0xc2bbce={'raw':_0x27d459['query'][_0x3776('0x87')],'where':{}};var _0x45f159={};var _0x522ae0={'count':0x0,'rows':[]};var _0x44c4c1=_0x27d459['query'][_0x3776('0x88')];var _0x140e00=_0x27d459['query'][_0x3776('0x89')]||![];var _0x2aa8a6=_0x3bbc3c(_0x44c4c1,_0x140e00);if(!_0x2aa8a6['childModel'])throw new Error(_0x3776('0x8a')+_0x44c4c1+'\x27');var _0x4fa89c=[{'name':_0x44c4c1}];if(!_['isEmpty'](_0x2aa8a6['parentSections']))_0x4fa89c=_0x2aa8a6[_0x3776('0x15')];var _0x181967=[];for(var _0x14c9c6=0x0;_0x14c9c6<_0x4fa89c[_0x3776('0x8b')];_0x14c9c6++){_0x181967[_0x3776('0x8c')](_0x3d3e11[_0x3776('0x8d')]['find']({'where':{'userProfileId':_0x27d459[_0x3776('0x8e')]['id'],'name':_0x4fa89c[_0x14c9c6][_0x3776('0x17')]},'raw':!![]}));}return Promise[_0x3776('0x8f')](_0x181967)[_0x3776('0xa')](function(_0x3a122d){var _0x2897a4=_['filter'](_0x3a122d,function(_0x408c40){return _0x408c40?_0x408c40:undefined;});var _0x1ff8d7=_['filter'](_0x4fa89c,[_0x3776('0x90'),!![]]);var _0x524af5=_['isEmpty'](_0x2897a4)&&_['isEmpty'](_0x1ff8d7)?null:_[_0x3776('0x91')](_0x1ff8d7,_0x2897a4);if(!_0x524af5)return null;var _0x9396b0=[];for(var _0x2fab81=0x0;_0x2fab81<_0x524af5[_0x3776('0x8b')];_0x2fab81++){var _0x5f052d=_[_0x3776('0x92')](_0x4fa89c,function(_0x1e227a){return _0x524af5[_0x2fab81]?_0x1e227a[_0x3776('0x17')]===_0x524af5[_0x2fab81][_0x3776('0x17')]:null;});if(_0x5f052d){if(_0x524af5[_0x2fab81][_0x3776('0x90')]){_0x9396b0['push'](_0x2816ba(_0x2aa8a6['childModel'],_0x524af5[_0x2fab81]));}else{if(!_0x524af5[_0x2fab81]['autoAssociation']){_0x9396b0['push'](_0x9073b8(_0x5f052d,_0x524af5[_0x2fab81],_0x2aa8a6['childModel']));}else{if(_0x5f052d[_0x3776('0x8')]){_0x9396b0[_0x3776('0x8c')](_0x213d1a(_0x5f052d,_0x524af5[_0x2fab81]));}}}}}return Promise[_0x3776('0x8f')](_0x9396b0);})['then'](function(_0x4eb862){var _0x5609b3=_0x4eb862;var _0x228fd0=null;if(_0x5609b3){_0x228fd0=_0x5609b3[_0x3776('0x8b')]===0x1?_0x5609b3[0x0]:null;}if(!_0x228fd0&&!_0x5609b3)return _0x522ae0;var _0x25d398=_0x3d3e11[_0x2aa8a6[_0x3776('0x10')]]['rawAttributes'];_0x45f159[_0x3776('0x8')]=_[_0x3776('0x93')](_0x25d398);_0x45f159[_0x3776('0x81')]=_[_0x3776('0x93')](_0x27d459['query']);_0x45f159[_0x3776('0x94')]=_[_0x3776('0x95')](_0x45f159[_0x3776('0x8')],_0x45f159[_0x3776('0x81')]);_0xc2bbce['attributes']=_[_0x3776('0x95')](_0x45f159['model'],qs['fields'](_0x27d459[_0x3776('0x81')][_0x3776('0x96')]));_0xc2bbce[_0x3776('0x97')]=_0xc2bbce[_0x3776('0x97')][_0x3776('0x8b')]?_0xc2bbce[_0x3776('0x97')]:_0x45f159[_0x3776('0x8')];if(!_0x27d459['query'][_0x3776('0x98')]('nolimit')){_0xc2bbce[_0x3776('0x99')]=qs[_0x3776('0x99')](_0x27d459[_0x3776('0x81')]['limit']);_0xc2bbce[_0x3776('0x9a')]=qs['offset'](_0x27d459['query']['offset']);}_0xc2bbce['order']=qs['sort'](_0x27d459[_0x3776('0x81')][_0x3776('0x9b')]);_0xc2bbce[_0x3776('0x7f')]=qs['filters'](_['pick'](_0x27d459[_0x3776('0x81')],_0x45f159[_0x3776('0x94')]));if(_0x27d459['query'][_0x3776('0x4')]){_0xc2bbce[_0x3776('0x7f')]=_[_0x3776('0x9c')](_0xc2bbce['where'],{'$or':_[_0x3776('0xb')](_0x25d398,function(_0x2fcaf4){if(_0x2fcaf4[_0x3776('0xf')]['key']!==_0x3776('0x9d')){var _0x5b60d8={};_0x5b60d8[_0x2fcaf4[_0x3776('0x5')]]={'$like':'%'+_0x27d459[_0x3776('0x81')][_0x3776('0x4')]+'%'};return _0x5b60d8;}})});}var _0x1aea64=[];var _0x202793=null;var _0x112c53={};if(_0x228fd0){_0x202793=_[_0x3776('0x92')](_0x4fa89c,[_0x3776('0x17'),_0x228fd0[_0x3776('0x17')]]);if(_0x202793[_0x3776('0x5')]){_0x112c53={};if(_0x2aa8a6[_0x3776('0x10')]===_0x3776('0xd')){_0x112c53[_0x202793[_0x3776('0x9e')]]=_['map'](_0x228fd0[_0x3776('0x7')],'id');}else{_0x112c53[_0x202793[_0x3776('0x9e')]]=_0x228fd0['associatedResources'];}_0x1aea64['push'](_0x112c53);}else{_0xc2bbce[_0x3776('0x7f')]['id']=_0x228fd0[_0x3776('0x7')];}}else{for(var _0x4d1563=0x0;_0x4d1563<_0x5609b3['length'];_0x4d1563++){_0x202793=_[_0x3776('0x92')](_0x4fa89c,[_0x3776('0x17'),_0x5609b3[_0x4d1563][_0x3776('0x17')]]);if(_0x202793['field']){_0x112c53={};_0x112c53[_0x202793[_0x3776('0x9e')]]=_0x5609b3[_0x4d1563][_0x3776('0x7')];_0x1aea64['push'](_0x112c53);}else{if(!_0xc2bbce[_0x3776('0x7f')]['id'])_0xc2bbce[_0x3776('0x7f')]['id']=[];_0x5609b3[_0x4d1563][_0x3776('0x7')][_0x3776('0x9f')](function(_0x26d976){_0xc2bbce[_0x3776('0x7f')]['id'][_0x3776('0x8c')](_0x26d976);});}}}if(!_[_0x3776('0xa0')](_0x1aea64)){_0xc2bbce[_0x3776('0x7f')]=_[_0x3776('0x9c')](_0xc2bbce[_0x3776('0x7f')],{'$and':{'$or':_0x1aea64}});}_0xc2bbce=_[_0x3776('0x9c')]({},_0xc2bbce,_0x27d459['options']);if(_0x228fd0&&!_0x228fd0[_0x3776('0xa1')]&&_0x2aa8a6[_0x3776('0x10')]===_0x3776('0xd')){if(_0x27d459[_0x3776('0x81')][_0x3776('0xa2')]){_0xc2bbce[_0x3776('0xa3')]=[{'all':!![]}];}return _0x3d3e11[_0x2aa8a6[_0x3776('0x10')]][_0x3776('0x9')](_0xc2bbce)[_0x3776('0xa')](function(_0xb5ee3a){var _0x566280=[];_0xb5ee3a['forEach'](function(_0x5589f8){var _0x52d116;switch(_0x5589f8[_0x3776('0xa4')]){case'default':_0x52d116=_[_0x3776('0x92')](_0x228fd0[_0x3776('0x7')],function(_0x538e59){return _0x538e59['id']===_0x5589f8[_0x3776('0x73')]&&_0x538e59[_0x3776('0xf')]===_0x3776('0xa5');});break;case _0x3776('0xa6'):_0x52d116=_['find'](_0x228fd0['associatedResources'],function(_0x39b5f1){return _0x39b5f1['id']===_0x5589f8[_0x3776('0x73')]&&_0x39b5f1['type']===_0x3776('0xa7');});break;}if(_0x52d116)_0x566280[_0x3776('0x8c')](_0x5589f8);});_0x522ae0[_0x3776('0xa8')]=_0x566280[_0x3776('0x8b')];_0x522ae0['rows']=_0x566280;return _0x522ae0;});}else{if(!_[_0x3776('0xa0')](_0x27d459[_0x3776('0x81')][_0x3776('0xa9')])){_0xc2bbce[_0x3776('0x7f')]['id']=_0xc2bbce[_0x3776('0x7f')]['id']?_[_0x3776('0x95')](_0xc2bbce['where']['id'],_0x27d459[_0x3776('0x81')][_0x3776('0xa9')]):_0x27d459[_0x3776('0x81')]['ids'];if(_0x27d459['query'][_0x3776('0xaa')]){_0xc2bbce[_0x3776('0xab')]=_0x27d459[_0x3776('0x81')][_0x3776('0xaa')];}}if(_0x27d459['query'][_0x3776('0xac')]){_0xc2bbce['where']=_['merge'](_0xc2bbce[_0x3776('0x7f')],{'$and':_0x27d459[_0x3776('0x81')]['extraQueryConditions']});}return _0x3d3e11[_0x2aa8a6[_0x3776('0x10')]][_0x3776('0xa8')]({'where':_0xc2bbce['where']})[_0x3776('0xa')](function(_0x56a968){_0x522ae0[_0x3776('0xa8')]=_0x56a968;if(_0x27d459['query'][_0x3776('0xa2')]){if(_0x2aa8a6[_0x3776('0x10')]===_0x3776('0xad')){_0xc2bbce[_0x3776('0xa3')]=[{'model':_0x3d3e11[_0x3776('0xae')],'as':_0x3776('0xaf'),'attributes':['id','name','color'],'required':_0x27d459['query'][_0x3776('0xb0')]?!![]:![]},{'model':_0x3d3e11[_0x3776('0xae')],'as':_0x3776('0xb1'),'attributes':['id','name','color'],'through':_0x27d459[_0x3776('0x81')][_0x3776('0xb0')]?{'attributes':[],'where':{'TagId':_0x27d459[_0x3776('0x81')]['tag']||undefined}}:{},'required':_0x27d459['query']['tag']?!![]:![]}];}else{_0xc2bbce[_0x3776('0xa3')]=[{'all':!![]}];}}return _0x3d3e11[_0x2aa8a6[_0x3776('0x10')]]['findAll'](_0xc2bbce);})['then'](function(_0x1e54ed){_0x522ae0[_0x3776('0xb2')]=_0x1e54ed;if(_0x44c4c1===_0x3776('0x33')&&_0x27d459['query'][_0x3776('0xb3')]===_0x3776('0xb4')){var _0x83d583=[];for(var _0x5e5be4=0x0;_0x5e5be4<_0x522ae0[_0x3776('0xb2')][_0x3776('0x8b')];_0x5e5be4++){_0x83d583['push'](_0x14fce1(_0x3776('0xb5'),_0x522ae0[_0x3776('0xb2')][_0x5e5be4]['dataValues']));_0x83d583[_0x3776('0x8c')](_0x14fce1(_0x3776('0xb6'),_0x522ae0[_0x3776('0xb2')][_0x5e5be4][_0x3776('0xb7')]));_0x83d583[_0x3776('0x8c')](_0x14fce1('fax',_0x522ae0[_0x3776('0xb2')][_0x5e5be4][_0x3776('0xb7')]));_0x83d583[_0x3776('0x8c')](_0x14fce1('mail',_0x522ae0[_0x3776('0xb2')][_0x5e5be4]['dataValues']));_0x83d583['push'](_0x14fce1(_0x3776('0xb8'),_0x522ae0[_0x3776('0xb2')][_0x5e5be4][_0x3776('0xb7')]));_0x83d583[_0x3776('0x8c')](_0x14fce1(_0x3776('0xb9'),_0x522ae0[_0x3776('0xb2')][_0x5e5be4]['dataValues']));}return Promise['all'](_0x83d583)[_0x3776('0xa')](function(){return _0x522ae0;});}return _0x522ae0;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 0dec653..04bd5f8 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 _0xe14a=['error','code','message','catch','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x19f559,_0x1f3967){var _0x1f8143=function(_0x7f7acc){while(--_0x7f7acc){_0x19f559['push'](_0x19f559['shift']());}};_0x1f8143(++_0x1f3967);}(_0xe14a,0x94));var _0xae14=function(_0x2e25f0,_0xbe0a97){_0x2e25f0=_0x2e25f0-0x0;var _0x257245=_0xe14a[_0x2e25f0];return _0x257245;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae14('0x0'));var db=require(_0xae14('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xae14('0x2'))(_0xae14('0x3'));var config=require(_0xae14('0x4'));var jayson=require(_0xae14('0x5'));var client=jayson[_0xae14('0x6')][_0xae14('0x7')]({'port':0x232a});config[_0xae14('0x8')]=_[_0xae14('0x9')](config[_0xae14('0x8')],{'host':_0xae14('0xa'),'port':0x18eb});var socket=require(_0xae14('0xb'))(new Redis(config[_0xae14('0x8')]));require(_0xae14('0xc'))['register'](socket);function respondWithRpcPromise(_0x507639,_0x2edf05,_0x345149){return new BPromise(function(_0x38a65f,_0x324dd0){return client[_0xae14('0xd')](_0x507639,_0x345149)['then'](function(_0x5e051f){logger[_0xae14('0xe')](_0xae14('0xf'),_0x2edf05,_0xae14('0x10'));logger[_0xae14('0x11')](_0xae14('0x12'),_0x2edf05,_0xae14('0x10'),JSON[_0xae14('0x13')](_0x5e051f));if(_0x5e051f[_0xae14('0x14')]){if(_0x5e051f[_0xae14('0x14')][_0xae14('0x15')]===0x1f4){logger['error'](_0xae14('0xf'),_0x2edf05,_0x5e051f[_0xae14('0x14')]['message']);return _0x324dd0(_0x5e051f[_0xae14('0x14')][_0xae14('0x16')]);}logger[_0xae14('0x14')](_0xae14('0xf'),_0x2edf05,_0x5e051f[_0xae14('0x14')]['message']);return _0x38a65f(_0x5e051f['error'][_0xae14('0x16')]);}else{logger[_0xae14('0xe')](_0xae14('0xf'),_0x2edf05,_0xae14('0x10'));_0x38a65f(_0x5e051f['result'][_0xae14('0x16')]);}})[_0xae14('0x17')](function(_0x3e8424){logger[_0xae14('0x14')](_0xae14('0xf'),_0x2edf05,_0x3e8424);_0x324dd0(_0x3e8424);});});} \ No newline at end of file +var _0xbd0a=['http','redis','localhost','socket.io-emitter','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1685a0,_0x325d05){var _0x30848b=function(_0xe67f50){while(--_0xe67f50){_0x1685a0['push'](_0x1685a0['shift']());}};_0x30848b(++_0x325d05);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x4c2c3b,_0x4a569a){_0x4c2c3b=_0x4c2c3b-0x0;var _0x46775f=_0xbd0a[_0x4c2c3b];return _0x46775f;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var moment=require(_0xabd0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabd0('0x2'))['db'];var utils=require(_0xabd0('0x3'));var logger=require(_0xabd0('0x4'))(_0xabd0('0x5'));var config=require(_0xabd0('0x6'));var jayson=require(_0xabd0('0x7'));var client=jayson[_0xabd0('0x8')][_0xabd0('0x9')]({'port':0x232a});config[_0xabd0('0xa')]=_['defaults'](config[_0xabd0('0xa')],{'host':_0xabd0('0xb'),'port':0x18eb});var socket=require(_0xabd0('0xc'))(new Redis(config['redis']));require(_0xabd0('0xd'))['register'](socket);function respondWithRpcPromise(_0x151048,_0x23d4e4,_0x2c31c9){return new BPromise(function(_0x3dc0ab,_0x50fc2d){return client[_0xabd0('0xe')](_0x151048,_0x2c31c9)['then'](function(_0x1b78e2){logger[_0xabd0('0xf')](_0xabd0('0x10'),_0x23d4e4,_0xabd0('0x11'));logger[_0xabd0('0x12')](_0xabd0('0x13'),_0x23d4e4,'request\x20sent',JSON[_0xabd0('0x14')](_0x1b78e2));if(_0x1b78e2['error']){if(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x16')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x23d4e4,_0x1b78e2['error']['message']);return _0x50fc2d(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);}logger[_0xabd0('0x15')](_0xabd0('0x10'),_0x23d4e4,_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);return _0x3dc0ab(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);}else{logger[_0xabd0('0xf')]('UserProfile,\x20%s,\x20%s',_0x23d4e4,_0xabd0('0x11'));_0x3dc0ab(_0x1b78e2['result']['message']);}})[_0xabd0('0x18')](function(_0x391988){logger[_0xabd0('0x15')](_0xabd0('0x10'),_0x23d4e4,_0x391988);_0x50fc2d(_0x391988);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 992b97f..22d0912 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 _0x5623=['register','length','remove','update','emit','removeListener'];(function(_0x581bc1,_0x526dbb){var _0x33eaf7=function(_0x4dffbb){while(--_0x4dffbb){_0x581bc1['push'](_0x581bc1['shift']());}};_0x33eaf7(++_0x526dbb);}(_0x5623,0x1e2));var _0x3562=function(_0xee4627,_0xf855c4){_0xee4627=_0xee4627-0x0;var _0x214a57=_0x5623[_0xee4627];return _0x214a57;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x3562('0x0'),_0x3562('0x1')];function createListener(_0x2e8634,_0x5aa01f){return function(_0xee7553){_0x5aa01f[_0x3562('0x2')](_0x2e8634,_0xee7553);};}function removeListener(_0x19fe89,_0x32d7be){return function(){UserProfileEvents[_0x3562('0x3')](_0x19fe89,_0x32d7be);};}exports[_0x3562('0x4')]=function(_0x539ea9){for(var _0x4100d2=0x0,_0x4aa97c=events[_0x3562('0x5')];_0x4100d2<_0x4aa97c;_0x4100d2++){var _0x14f274=events[_0x4100d2];var _0x38bfcd=createListener('userProfile:'+_0x14f274,_0x539ea9);UserProfileEvents['on'](_0x14f274,_0x38bfcd);}}; \ No newline at end of file +var _0xd233=['save','remove','update','register','userProfile:','./userProfile.events'];(function(_0x329849,_0x1bcd70){var _0x3ef89c=function(_0x401aca){while(--_0x401aca){_0x329849['push'](_0x329849['shift']());}};_0x3ef89c(++_0x1bcd70);}(_0xd233,0x12b));var _0x3d23=function(_0x546ce7,_0x135234){_0x546ce7=_0x546ce7-0x0;var _0x1e1530=_0xd233[_0x546ce7];return _0x1e1530;};'use strict';var UserProfileEvents=require(_0x3d23('0x0'));var events=[_0x3d23('0x1'),_0x3d23('0x2'),_0x3d23('0x3')];function createListener(_0xaae9ab,_0x4f8af5){return function(_0x4c1e3f){_0x4f8af5['emit'](_0xaae9ab,_0x4c1e3f);};}function removeListener(_0x48aa88,_0x514a95){return function(){UserProfileEvents['removeListener'](_0x48aa88,_0x514a95);};}exports[_0x3d23('0x4')]=function(_0x32a463){for(var _0x2915d0=0x0,_0x1f1b38=events['length'];_0x2915d0<_0x1f1b38;_0x2915d0++){var _0x3b8adb=events[_0x2915d0];var _0x3c1a1e=createListener(_0x3d23('0x5')+_0x3b8adb,_0x32a463);UserProfileEvents['on'](_0x3b8adb,_0x3c1a1e);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index fe25713..d11ca95 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 _0xbe27=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x1b1ff6,_0x54a036){var _0x54b26a=function(_0x139fdc){while(--_0x139fdc){_0x1b1ff6['push'](_0x1b1ff6['shift']());}};_0x54b26a(++_0x54a036);}(_0xbe27,0x1ce));var _0x7be2=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbe27[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x7be2('0x0'));var util=require(_0x7be2('0x1'));var path=require('path');var timeout=require(_0x7be2('0x2'));var express=require('express');var router=express[_0x7be2('0x3')]();var fs_extra=require(_0x7be2('0x4'));var auth=require(_0x7be2('0x5'));var interaction=require(_0x7be2('0x6'));var config=require('../../config/environment');var controller=require(_0x7be2('0x7'));router[_0x7be2('0x8')]('/',auth[_0x7be2('0x9')](),controller[_0x7be2('0xa')]);router[_0x7be2('0x8')](_0x7be2('0xb'),auth[_0x7be2('0x9')](),controller[_0x7be2('0xc')]);router[_0x7be2('0x8')](_0x7be2('0xd'),auth[_0x7be2('0x9')](),controller[_0x7be2('0xe')]);router[_0x7be2('0xf')]('/',auth['isAuthenticated'](),controller[_0x7be2('0x10')]);router[_0x7be2('0x11')](_0x7be2('0xd'),auth[_0x7be2('0x9')](),controller['update']);router[_0x7be2('0x12')](_0x7be2('0xd'),auth[_0x7be2('0x9')](),controller[_0x7be2('0x13')]);module[_0x7be2('0x14')]=router; \ No newline at end of file +var _0x47d4=['post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3f5686,_0x271efb){var _0x293adf=function(_0x2e2282){while(--_0x2e2282){_0x3f5686['push'](_0x3f5686['shift']());}};_0x293adf(++_0x271efb);}(_0x47d4,0x1a7));var _0x447d=function(_0x207d3a,_0x5bb75e){_0x207d3a=_0x207d3a-0x0;var _0x31e506=_0x47d4[_0x207d3a];return _0x31e506;};'use strict';var multer=require(_0x447d('0x0'));var util=require(_0x447d('0x1'));var path=require('path');var timeout=require(_0x447d('0x2'));var express=require(_0x447d('0x3'));var router=express[_0x447d('0x4')]();var fs_extra=require(_0x447d('0x5'));var auth=require(_0x447d('0x6'));var interaction=require(_0x447d('0x7'));var config=require(_0x447d('0x8'));var controller=require(_0x447d('0x9'));router[_0x447d('0xa')]('/',auth[_0x447d('0xb')](),controller[_0x447d('0xc')]);router[_0x447d('0xa')](_0x447d('0xd'),auth['isAuthenticated'](),controller[_0x447d('0xe')]);router['get'](_0x447d('0xf'),auth[_0x447d('0xb')](),controller[_0x447d('0x10')]);router[_0x447d('0x11')]('/',auth[_0x447d('0xb')](),controller[_0x447d('0x12')]);router[_0x447d('0x13')]('/:id',auth[_0x447d('0xb')](),controller['update']);router[_0x447d('0x14')]('/:id',auth[_0x447d('0xb')](),controller['destroy']);module[_0x447d('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 0c6a237..dae89b3 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 _0xf7c9=['sequelize','exports','STRING','INTEGER'];(function(_0x1fbbe4,_0x2476d8){var _0x39df51=function(_0x12875b){while(--_0x12875b){_0x1fbbe4['push'](_0x1fbbe4['shift']());}};_0x39df51(++_0x2476d8);}(_0xf7c9,0x13c));var _0x9f7c=function(_0x11abf8,_0x272d15){_0x11abf8=_0x11abf8-0x0;var _0x33d27f=_0xf7c9[_0x11abf8];return _0x33d27f;};'use strict';var Sequelize=require(_0x9f7c('0x0'));module[_0x9f7c('0x1')]={'name':{'type':Sequelize[_0x9f7c('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9f7c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9f7c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3915=['INTEGER','sequelize','STRING'];(function(_0x1738ce,_0x46fd56){var _0x2eade4=function(_0x1e07b6){while(--_0x1e07b6){_0x1738ce['push'](_0x1738ce['shift']());}};_0x2eade4(++_0x46fd56);}(_0x3915,0xca));var _0x5391=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0x3915[_0x38aeea];return _0x5e8d2c;};'use strict';var Sequelize=require(_0x5391('0x0'));module['exports']={'name':{'type':Sequelize[_0x5391('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5391('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index c9d99a4..9778ce5 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 _0xafc4=['update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','UserProfileResource','includeAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x1c2970,_0x5b0b36){var _0x40936a=function(_0xe3015b){while(--_0xe3015b){_0x1c2970['push'](_0x1c2970['shift']());}};_0x40936a(++_0x5b0b36);}(_0xafc4,0x69));var _0x4afc=function(_0x862bb2,_0x51357e){_0x862bb2=_0x862bb2-0x0;var _0x246d88=_0xafc4[_0x862bb2];return _0x246d88;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['UserProfileResource'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['UserProfileResource']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));};exports[_0x4afc('0x45')]=function(_0x3625c9,_0x387834){return db[_0x4afc('0x3d')][_0x4afc('0x45')]()[_0x4afc('0x25')](respondWithResult(_0x387834,null))[_0x4afc('0x3f')](handleError(_0x387834,null));}; \ No newline at end of file +var _0xc4aa=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x245690,_0x3bf938){var _0x3fb9a4=function(_0x3354b3){while(--_0x3354b3){_0x245690['push'](_0x245690['shift']());}};_0x3fb9a4(++_0x3bf938);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));};exports[_0xac4a('0x4c')]=function(_0x26e716,_0x3ac36e){return db['UserProfileResource'][_0xac4a('0x4c')]()[_0xac4a('0x24')](respondWithResult(_0x3ac36e,null))[_0xac4a('0x44')](handleError(_0x3ac36e,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index da126c3..47773e0 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 _0x6383=['exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0xf06f64,_0x2917a1){var _0x1583f6=function(_0x598bce){while(--_0x598bce){_0xf06f64['push'](_0xf06f64['shift']());}};_0x1583f6(++_0x2917a1);}(_0x6383,0x66));var _0x3638=function(_0x281d4b,_0x24a3fc){_0x281d4b=_0x281d4b-0x0;var _0x2b9858=_0x6383[_0x281d4b];return _0x2b9858;};'use strict';var _=require('lodash');var util=require(_0x3638('0x0'));var logger=require(_0x3638('0x1'))(_0x3638('0x2'));var moment=require(_0x3638('0x3'));var BPromise=require(_0x3638('0x4'));var rp=require(_0x3638('0x5'));var fs=require('fs');var path=require(_0x3638('0x6'));var rimraf=require(_0x3638('0x7'));var config=require(_0x3638('0x8'));var attributes=require(_0x3638('0x9'));module[_0x3638('0xa')]=function(_0xcfb52b,_0x459ba5){return _0xcfb52b[_0x3638('0xb')](_0x3638('0xc'),attributes,{'tableName':_0x3638('0xd'),'paranoid':![],'indexes':[{'name':_0x3638('0xe'),'fields':[_0x3638('0xf'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8704=['../../config/logger','api','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util'];(function(_0x2371ef,_0x4db24f){var _0x324f13=function(_0x294752){while(--_0x294752){_0x2371ef['push'](_0x2371ef['shift']());}};_0x324f13(++_0x4db24f);}(_0x8704,0x148));var _0x4870=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0x8704[_0x166e96];return _0x553d73;};'use strict';var _=require(_0x4870('0x0'));var util=require(_0x4870('0x1'));var logger=require(_0x4870('0x2'))(_0x4870('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4870('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4870('0x5'));var config=require(_0x4870('0x6'));var attributes=require(_0x4870('0x7'));module[_0x4870('0x8')]=function(_0x72466,_0x2d19bb){return _0x72466[_0x4870('0x9')](_0x4870('0xa'),attributes,{'tableName':_0x4870('0xb'),'paranoid':![],'indexes':[{'name':_0x4870('0xc'),'fields':[_0x4870('0xd'),_0x4870('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index e48b1f2..b0f4aea 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 _0x6191=['info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0x6191,0xbe));var _0x1619=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0x6191[_0x47623f];return _0x282ce8;};'use strict';var _=require(_0x1619('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1619('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1619('0x2'));var logger=require('../../config/logger')(_0x1619('0x3'));var config=require(_0x1619('0x4'));var jayson=require(_0x1619('0x5'));var client=jayson[_0x1619('0x6')][_0x1619('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x13925d,_0x7dea11,_0x19a939){return new BPromise(function(_0x23c5d9,_0x5c3fb3){return client[_0x1619('0x8')](_0x13925d,_0x19a939)[_0x1619('0x9')](function(_0x5a42f9){logger[_0x1619('0xa')](_0x1619('0xb'),_0x7dea11,_0x1619('0xc'));logger['debug'](_0x1619('0xd'),_0x7dea11,_0x1619('0xc'),JSON[_0x1619('0xe')](_0x5a42f9));if(_0x5a42f9['error']){if(_0x5a42f9['error'][_0x1619('0xf')]===0x1f4){logger[_0x1619('0x10')](_0x1619('0xb'),_0x7dea11,_0x5a42f9[_0x1619('0x10')][_0x1619('0x11')]);return _0x5c3fb3(_0x5a42f9[_0x1619('0x10')][_0x1619('0x11')]);}logger[_0x1619('0x10')](_0x1619('0xb'),_0x7dea11,_0x5a42f9[_0x1619('0x10')][_0x1619('0x11')]);return _0x23c5d9(_0x5a42f9[_0x1619('0x10')][_0x1619('0x11')]);}else{logger[_0x1619('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x7dea11,'request\x20sent');_0x23c5d9(_0x5a42f9[_0x1619('0x12')]['message']);}})[_0x1619('0x13')](function(_0xfe99ed){logger[_0x1619('0x10')](_0x1619('0xb'),_0x7dea11,_0xfe99ed);_0x5c3fb3(_0xfe99ed);});});} \ No newline at end of file +var _0xe287=['../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2a99ee,_0x2adb3d){var _0x4d2ae3=function(_0x5d5c10){while(--_0x5d5c10){_0x2a99ee['push'](_0x2a99ee['shift']());}};_0x4d2ae3(++_0x2adb3d);}(_0xe287,0x82));var _0x7e28=function(_0x1fd5e2,_0xb053fd){_0x1fd5e2=_0x1fd5e2-0x0;var _0x19c5e3=_0xe287[_0x1fd5e2];return _0x19c5e3;};'use strict';var _=require(_0x7e28('0x0'));var util=require(_0x7e28('0x1'));var moment=require(_0x7e28('0x2'));var BPromise=require(_0x7e28('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e28('0x4'));var db=require(_0x7e28('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e28('0x6'))(_0x7e28('0x7'));var config=require(_0x7e28('0x8'));var jayson=require(_0x7e28('0x9'));var client=jayson[_0x7e28('0xa')][_0x7e28('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a6ff5,_0x3c8e10,_0x3f1e2a){return new BPromise(function(_0xbe5a25,_0xa139b){return client['request'](_0x4a6ff5,_0x3f1e2a)[_0x7e28('0xc')](function(_0x106b98){logger[_0x7e28('0xd')](_0x7e28('0xe'),_0x3c8e10,_0x7e28('0xf'));logger[_0x7e28('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x3c8e10,_0x7e28('0xf'),JSON[_0x7e28('0x11')](_0x106b98));if(_0x106b98[_0x7e28('0x12')]){if(_0x106b98['error'][_0x7e28('0x13')]===0x1f4){logger['error'](_0x7e28('0xe'),_0x3c8e10,_0x106b98[_0x7e28('0x12')][_0x7e28('0x14')]);return _0xa139b(_0x106b98[_0x7e28('0x12')]['message']);}logger[_0x7e28('0x12')](_0x7e28('0xe'),_0x3c8e10,_0x106b98['error'][_0x7e28('0x14')]);return _0xbe5a25(_0x106b98[_0x7e28('0x12')][_0x7e28('0x14')]);}else{logger['info'](_0x7e28('0xe'),_0x3c8e10,_0x7e28('0xf'));_0xbe5a25(_0x106b98[_0x7e28('0x15')]['message']);}})[_0x7e28('0x16')](function(_0x2afb73){logger[_0x7e28('0x12')](_0x7e28('0xe'),_0x3c8e10,_0x2afb73);_0xa139b(_0x2afb73);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 0cc54a5..0feef00 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 _0x673e=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','describe'];(function(_0x2c9dee,_0xcd9baa){var _0x174c02=function(_0x199218){while(--_0x199218){_0x2c9dee['push'](_0x2c9dee['shift']());}};_0x174c02(++_0xcd9baa);}(_0x673e,0xbd));var _0xe673=function(_0xf339da,_0x45e3be){_0xf339da=_0xf339da-0x0;var _0x33dfbf=_0x673e[_0xf339da];return _0x33dfbf;};'use strict';var multer=require(_0xe673('0x0'));var util=require('util');var path=require(_0xe673('0x1'));var timeout=require(_0xe673('0x2'));var express=require('express');var router=express[_0xe673('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe673('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe673('0x5'));var controller=require(_0xe673('0x6'));router[_0xe673('0x7')]('/',auth[_0xe673('0x8')](),controller['index']);router[_0xe673('0x7')](_0xe673('0x9'),auth[_0xe673('0x8')](),controller[_0xe673('0xa')]);router[_0xe673('0x7')](_0xe673('0xb'),auth[_0xe673('0x8')](),controller[_0xe673('0xc')]);router[_0xe673('0xd')]('/',auth[_0xe673('0x8')](),controller[_0xe673('0xe')]);router[_0xe673('0xf')](_0xe673('0xb'),auth[_0xe673('0x8')](),controller[_0xe673('0x10')]);router[_0xe673('0x11')]('/:id',auth[_0xe673('0x8')](),controller[_0xe673('0x12')]);module[_0xe673('0x13')]=router; \ No newline at end of file +var _0x76c3=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','post','create','/:id','delete','destroy','multer','express'];(function(_0x23cc62,_0x23d374){var _0xf0521a=function(_0x458e4c){while(--_0x458e4c){_0x23cc62['push'](_0x23cc62['shift']());}};_0xf0521a(++_0x23d374);}(_0x76c3,0x64));var _0x376c=function(_0x35ec7a,_0x3c1115){_0x35ec7a=_0x35ec7a-0x0;var _0x4ba727=_0x76c3[_0x35ec7a];return _0x4ba727;};'use strict';var multer=require(_0x376c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x376c('0x1'));var router=express[_0x376c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x376c('0x3'));var interaction=require(_0x376c('0x4'));var config=require(_0x376c('0x5'));var controller=require(_0x376c('0x6'));router['get']('/',auth[_0x376c('0x7')](),controller[_0x376c('0x8')]);router[_0x376c('0x9')](_0x376c('0xa'),auth[_0x376c('0x7')](),controller[_0x376c('0xb')]);router['get']('/:id',auth[_0x376c('0x7')](),controller['show']);router[_0x376c('0xc')]('/',auth[_0x376c('0x7')](),controller[_0x376c('0xd')]);router['put'](_0x376c('0xe'),auth[_0x376c('0x7')](),controller['update']);router[_0x376c('0xf')](_0x376c('0xe'),auth[_0x376c('0x7')](),controller[_0x376c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 3db30fd..a3d7255 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 _0x5423=['getDataValue','crudPermissions','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join'];(function(_0xe65eab,_0xb53341){var _0x16479c=function(_0x1cd9ea){while(--_0x1cd9ea){_0xe65eab['push'](_0xe65eab['shift']());}};_0x16479c(++_0xb53341);}(_0x5423,0xe3));var _0x3542=function(_0x2479db,_0x1f1c61){_0x2479db=_0x2479db-0x0;var _0x1666ec=_0x5423[_0x2479db];return _0x1666ec;};'use strict';var Sequelize=require(_0x3542('0x0'));module[_0x3542('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x3542('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3542('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3542('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3542('0x2')],'set':function(_0xf0835){this[_0x3542('0x5')]('crudPermissions',_0xf0835?_0xf0835[_0x3542('0x6')](''):[]);},'get':function(){return this[_0x3542('0x7')](_0x3542('0x8'))?this[_0x3542('0x7')](_0x3542('0x8'))['split'](''):[];}}}; \ No newline at end of file +var _0xeb3b=['sequelize','exports','STRING','INTEGER','setDataValue','join','getDataValue','crudPermissions','split'];(function(_0x373d0e,_0x44ad60){var _0x34cb0f=function(_0x48f412){while(--_0x48f412){_0x373d0e['push'](_0x373d0e['shift']());}};_0x34cb0f(++_0x44ad60);}(_0xeb3b,0x19e));var _0xbeb3=function(_0xd307d9,_0x50e8e0){_0xd307d9=_0xd307d9-0x0;var _0x209bf8=_0xeb3b[_0xd307d9];return _0x209bf8;};'use strict';var Sequelize=require(_0xbeb3('0x0'));module[_0xbeb3('0x1')]={'name':{'type':Sequelize[_0xbeb3('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xbeb3('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xbeb3('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbeb3('0x2')],'set':function(_0x5b0e3b){this[_0xbeb3('0x4')]('crudPermissions',_0x5b0e3b?_0x5b0e3b[_0xbeb3('0x5')](''):[]);},'get':function(){return this[_0xbeb3('0x6')](_0xbeb3('0x7'))?this[_0xbeb3('0x6')](_0xbeb3('0x7'))[_0xbeb3('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 36edad3..21b7e89 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 _0x3551=['limit','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','index','map','UserProfileSection','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','mustache','util','path','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset'];(function(_0x3ccc83,_0xefb8c2){var _0x1df2f1=function(_0x4a730b){while(--_0x4a730b){_0x3ccc83['push'](_0x3ccc83['shift']());}};_0x1df2f1(++_0xefb8c2);}(_0x3551,0x1e8));var _0x1355=function(_0x239a74,_0x1490e3){_0x239a74=_0x239a74-0x0;var _0x1b5415=_0x3551[_0x239a74];return _0x1b5415;};'use strict';var emlformat=require(_0x1355('0x0'));var rimraf=require(_0x1355('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1355('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1355('0x3'));var util=require(_0x1355('0x4'));var path=require(_0x1355('0x5'));var sox=require('sox');var csv=require(_0x1355('0x6'));var ejs=require(_0x1355('0x7'));var fs=require('fs');var fs_extra=require(_0x1355('0x8'));var _=require(_0x1355('0x9'));var squel=require(_0x1355('0xa'));var crypto=require('crypto');var jsforce=require(_0x1355('0xb'));var deskjs=require(_0x1355('0xc'));var toCsv=require(_0x1355('0x6'));var querystring=require(_0x1355('0xd'));var Papa=require(_0x1355('0xe'));var Redis=require(_0x1355('0xf'));var authService=require(_0x1355('0x10'));var qs=require(_0x1355('0x11'));var as=require(_0x1355('0x12'));var hardwareService=require(_0x1355('0x13'));var logger=require(_0x1355('0x14'))('api');var utils=require(_0x1355('0x15'));var config=require(_0x1355('0x16'));var licenseUtil=require(_0x1355('0x17'));var db=require(_0x1355('0x18'))['db'];function respondWithStatusCode(_0x3cf0b1,_0x4d30ed){_0x4d30ed=_0x4d30ed||0xcc;return function(_0x386205){if(_0x386205){return _0x3cf0b1['sendStatus'](_0x4d30ed);}return _0x3cf0b1[_0x1355('0x19')](_0x4d30ed)[_0x1355('0x1a')]();};}function respondWithResult(_0x3ee3db,_0x246a78){_0x246a78=_0x246a78||0xc8;return function(_0x7153ae){if(_0x7153ae){return _0x3ee3db[_0x1355('0x19')](_0x246a78)['json'](_0x7153ae);}};}function respondWithFilteredResult(_0x4734d3,_0x379c0a){return function(_0x3b8f17){if(_0x3b8f17){var _0x5e18cc=typeof _0x379c0a['offset']===_0x1355('0x1b')&&typeof _0x379c0a['limit']===_0x1355('0x1b');var _0x211e23=_0x3b8f17[_0x1355('0x1c')];var _0x3fb0f7=_0x5e18cc?0x0:_0x379c0a[_0x1355('0x1d')];var _0x5a79b9=_0x5e18cc?_0x3b8f17[_0x1355('0x1c')]:_0x379c0a[_0x1355('0x1d')]+_0x379c0a[_0x1355('0x1e')];var _0x251a17;if(_0x5a79b9>=_0x211e23){_0x5a79b9=_0x211e23;_0x251a17=0xc8;}else{_0x251a17=0xce;}_0x4734d3[_0x1355('0x19')](_0x251a17);return _0x4734d3[_0x1355('0x1f')](_0x1355('0x20'),_0x3fb0f7+'-'+_0x5a79b9+'/'+_0x211e23)[_0x1355('0x21')](_0x3b8f17);}return null;};}function patchUpdates(_0x210473){return function(_0xb73ff5){try{jsonpatch[_0x1355('0x22')](_0xb73ff5,_0x210473,!![]);}catch(_0x2365ac){return BPromise['reject'](_0x2365ac);}return _0xb73ff5[_0x1355('0x23')]();};}function saveUpdates(_0x13192b,_0x35fc53){return function(_0x41b196){if(_0x41b196){return _0x41b196[_0x1355('0x24')](_0x13192b)[_0x1355('0x25')](function(_0x38262f){return _0x38262f;});}return null;};}function removeEntity(_0x59bc3a,_0x1b433c){return function(_0x580978){if(_0x580978){return _0x580978[_0x1355('0x26')]()[_0x1355('0x25')](function(){_0x59bc3a[_0x1355('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47d6dd,_0x5eb980){return function(_0x5d36af){if(!_0x5d36af){_0x47d6dd['sendStatus'](0x194);}return _0x5d36af;};}function handleError(_0x5866ec,_0x2f9243){_0x2f9243=_0x2f9243||0x1f4;return function(_0x3ae912){logger[_0x1355('0x27')](_0x3ae912['stack']);if(_0x3ae912['name']){delete _0x3ae912[_0x1355('0x28')];}_0x5866ec[_0x1355('0x19')](_0x2f9243)[_0x1355('0x29')](_0x3ae912);};}exports[_0x1355('0x2a')]=function(_0x4855ec,_0x37cab4){var _0x5d167e={},_0x57fb5a={},_0x5706e0={'count':0x0,'rows':[]};var _0x5dcaa8=_[_0x1355('0x2b')](db[_0x1355('0x2c')]['rawAttributes'],function(_0x1c7b60){return{'name':_0x1c7b60[_0x1355('0x2d')],'type':_0x1c7b60[_0x1355('0x2e')][_0x1355('0x2f')]};});_0x57fb5a[_0x1355('0x30')]=_['map'](_0x5dcaa8,_0x1355('0x28'));_0x57fb5a[_0x1355('0x31')]=_[_0x1355('0x32')](_0x4855ec['query']);_0x57fb5a[_0x1355('0x33')]=_['intersection'](_0x57fb5a[_0x1355('0x30')],_0x57fb5a[_0x1355('0x31')]);_0x5d167e[_0x1355('0x34')]=_[_0x1355('0x35')](_0x57fb5a['model'],qs[_0x1355('0x36')](_0x4855ec['query']['fields']));_0x5d167e[_0x1355('0x34')]=_0x5d167e[_0x1355('0x34')][_0x1355('0x37')]?_0x5d167e['attributes']:_0x57fb5a[_0x1355('0x30')];if(!_0x4855ec[_0x1355('0x31')]['hasOwnProperty']('nolimit')){_0x5d167e[_0x1355('0x1e')]=qs[_0x1355('0x1e')](_0x4855ec[_0x1355('0x31')][_0x1355('0x1e')]);_0x5d167e['offset']=qs[_0x1355('0x1d')](_0x4855ec[_0x1355('0x31')][_0x1355('0x1d')]);}_0x5d167e[_0x1355('0x38')]=qs[_0x1355('0x39')](_0x4855ec['query']['sort']);_0x5d167e[_0x1355('0x3a')]=qs[_0x1355('0x33')](_['pick'](_0x4855ec['query'],_0x57fb5a[_0x1355('0x33')]),_0x5dcaa8);if(_0x4855ec[_0x1355('0x31')][_0x1355('0x3b')]){_0x5d167e[_0x1355('0x3a')]=_[_0x1355('0x3c')](_0x5d167e[_0x1355('0x3a')],{'$or':_[_0x1355('0x2b')](_0x5dcaa8,function(_0x424eee){if(_0x424eee['type']!=='VIRTUAL'){var _0x132b1a={};_0x132b1a[_0x424eee[_0x1355('0x28')]]={'$like':'%'+_0x4855ec[_0x1355('0x31')][_0x1355('0x3b')]+'%'};return _0x132b1a;}})});}_0x5d167e=_[_0x1355('0x3c')]({},_0x5d167e,_0x4855ec[_0x1355('0x3d')]);var _0x494d85={'where':_0x5d167e[_0x1355('0x3a')]};return db[_0x1355('0x2c')][_0x1355('0x1c')](_0x494d85)[_0x1355('0x25')](function(_0x2b4f91){_0x5706e0[_0x1355('0x1c')]=_0x2b4f91;if(_0x4855ec[_0x1355('0x31')][_0x1355('0x3e')]){_0x5d167e[_0x1355('0x3f')]=[{'all':!![]}];}return db[_0x1355('0x2c')][_0x1355('0x40')](_0x5d167e);})[_0x1355('0x25')](function(_0x5220d7){_0x5706e0[_0x1355('0x41')]=_0x5220d7;return _0x5706e0;})[_0x1355('0x25')](respondWithFilteredResult(_0x37cab4,_0x5d167e))[_0x1355('0x42')](handleError(_0x37cab4,null));};exports[_0x1355('0x43')]=function(_0x5a5c02,_0xc735b6){var _0xbb3cf5={'raw':![],'where':{'id':_0x5a5c02[_0x1355('0x44')]['id']}},_0x31f230={};_0x31f230[_0x1355('0x30')]=_[_0x1355('0x32')](db[_0x1355('0x2c')][_0x1355('0x45')]);_0x31f230[_0x1355('0x31')]=_['keys'](_0x5a5c02[_0x1355('0x31')]);_0x31f230[_0x1355('0x33')]=_[_0x1355('0x35')](_0x31f230[_0x1355('0x30')],_0x31f230[_0x1355('0x31')]);_0xbb3cf5['attributes']=_[_0x1355('0x35')](_0x31f230['model'],qs[_0x1355('0x36')](_0x5a5c02[_0x1355('0x31')][_0x1355('0x36')]));_0xbb3cf5[_0x1355('0x34')]=_0xbb3cf5['attributes'][_0x1355('0x37')]?_0xbb3cf5[_0x1355('0x34')]:_0x31f230['model'];if(_0x5a5c02[_0x1355('0x31')][_0x1355('0x3e')]){_0xbb3cf5[_0x1355('0x3f')]=[{'all':!![]}];}_0xbb3cf5=_['merge']({},_0xbb3cf5,_0x5a5c02[_0x1355('0x3d')]);return db[_0x1355('0x2c')][_0x1355('0x46')](_0xbb3cf5)['then'](handleEntityNotFound(_0xc735b6,null))[_0x1355('0x25')](respondWithResult(_0xc735b6,null))[_0x1355('0x42')](handleError(_0xc735b6,null));};exports[_0x1355('0x47')]=function(_0x514dc5,_0x3760c0){return db[_0x1355('0x2c')][_0x1355('0x47')](_0x514dc5[_0x1355('0x48')],{})[_0x1355('0x25')](respondWithResult(_0x3760c0,0xc9))['catch'](handleError(_0x3760c0,null));};exports[_0x1355('0x24')]=function(_0x207049,_0x24f561){if(_0x207049[_0x1355('0x48')]['id']){delete _0x207049[_0x1355('0x48')]['id'];}return db[_0x1355('0x2c')]['find']({'where':{'id':_0x207049[_0x1355('0x44')]['id']}})[_0x1355('0x25')](handleEntityNotFound(_0x24f561,null))[_0x1355('0x25')](saveUpdates(_0x207049[_0x1355('0x48')],null))[_0x1355('0x25')](respondWithResult(_0x24f561,null))[_0x1355('0x42')](handleError(_0x24f561,null));};exports[_0x1355('0x26')]=function(_0x3fc774,_0x568d71){return db[_0x1355('0x2c')][_0x1355('0x46')]({'where':{'id':_0x3fc774[_0x1355('0x44')]['id']}})[_0x1355('0x25')](handleEntityNotFound(_0x568d71,null))[_0x1355('0x25')](removeEntity(_0x568d71,null))[_0x1355('0x42')](handleError(_0x568d71,null));};exports[_0x1355('0x49')]=function(_0x286728,_0x45671e){return db[_0x1355('0x2c')]['describe']()[_0x1355('0x25')](respondWithResult(_0x45671e,null))[_0x1355('0x42')](handleError(_0x45671e,null));}; \ No newline at end of file +var _0x9b13=['jsforce','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','Content-Range','reject','save','update','then','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x9b13,0x119));var _0x39b1=function(_0x33ffee,_0xa318de){_0x33ffee=_0x33ffee-0x0;var _0x27adc5=_0x9b13[_0x33ffee];return _0x27adc5;};'use strict';var emlformat=require(_0x39b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x39b1('0x1'));var jsonpatch=require(_0x39b1('0x2'));var rp=require(_0x39b1('0x3'));var moment=require(_0x39b1('0x4'));var BPromise=require(_0x39b1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x39b1('0x6'));var sox=require('sox');var csv=require(_0x39b1('0x7'));var ejs=require(_0x39b1('0x8'));var fs=require('fs');var fs_extra=require(_0x39b1('0x9'));var _=require('lodash');var squel=require(_0x39b1('0xa'));var crypto=require('crypto');var jsforce=require(_0x39b1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x39b1('0x7'));var querystring=require(_0x39b1('0xc'));var Papa=require(_0x39b1('0xd'));var Redis=require(_0x39b1('0xe'));var authService=require(_0x39b1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x39b1('0x10'));var hardwareService=require(_0x39b1('0x11'));var logger=require(_0x39b1('0x12'))(_0x39b1('0x13'));var utils=require(_0x39b1('0x14'));var config=require(_0x39b1('0x15'));var licenseUtil=require(_0x39b1('0x16'));var db=require(_0x39b1('0x17'))['db'];function respondWithStatusCode(_0x4bbe21,_0x398cbf){_0x398cbf=_0x398cbf||0xcc;return function(_0x59e158){if(_0x59e158){return _0x4bbe21[_0x39b1('0x18')](_0x398cbf);}return _0x4bbe21[_0x39b1('0x19')](_0x398cbf)[_0x39b1('0x1a')]();};}function respondWithResult(_0x49dd14,_0x411798){_0x411798=_0x411798||0xc8;return function(_0x3b1971){if(_0x3b1971){return _0x49dd14[_0x39b1('0x19')](_0x411798)[_0x39b1('0x1b')](_0x3b1971);}};}function respondWithFilteredResult(_0x31bbfd,_0x648f70){return function(_0x131ab1){if(_0x131ab1){var _0x37280d=typeof _0x648f70[_0x39b1('0x1c')]===_0x39b1('0x1d')&&typeof _0x648f70[_0x39b1('0x1e')]===_0x39b1('0x1d');var _0x82200d=_0x131ab1[_0x39b1('0x1f')];var _0x393f1a=_0x37280d?0x0:_0x648f70[_0x39b1('0x1c')];var _0x3c7fb2=_0x37280d?_0x131ab1['count']:_0x648f70[_0x39b1('0x1c')]+_0x648f70[_0x39b1('0x1e')];var _0x362741;if(_0x3c7fb2>=_0x82200d){_0x3c7fb2=_0x82200d;_0x362741=0xc8;}else{_0x362741=0xce;}_0x31bbfd[_0x39b1('0x19')](_0x362741);return _0x31bbfd['set'](_0x39b1('0x20'),_0x393f1a+'-'+_0x3c7fb2+'/'+_0x82200d)['json'](_0x131ab1);}return null;};}function patchUpdates(_0x30a810){return function(_0x2d97c2){try{jsonpatch['apply'](_0x2d97c2,_0x30a810,!![]);}catch(_0x7a75ca){return BPromise[_0x39b1('0x21')](_0x7a75ca);}return _0x2d97c2[_0x39b1('0x22')]();};}function saveUpdates(_0x581497,_0x3d534b){return function(_0x18ddde){if(_0x18ddde){return _0x18ddde[_0x39b1('0x23')](_0x581497)[_0x39b1('0x24')](function(_0xdd40ae){return _0xdd40ae;});}return null;};}function removeEntity(_0x3dfe47,_0x4d41ea){return function(_0x2b13f8){if(_0x2b13f8){return _0x2b13f8['destroy']()[_0x39b1('0x24')](function(){_0x3dfe47['status'](0xcc)[_0x39b1('0x1a')]();});}};}function handleEntityNotFound(_0x43171c,_0x5e569f){return function(_0x8651c2){if(!_0x8651c2){_0x43171c[_0x39b1('0x18')](0x194);}return _0x8651c2;};}function handleError(_0x1489d9,_0x4d195d){_0x4d195d=_0x4d195d||0x1f4;return function(_0x44fce3){logger['error'](_0x44fce3[_0x39b1('0x25')]);if(_0x44fce3[_0x39b1('0x26')]){delete _0x44fce3[_0x39b1('0x26')];}_0x1489d9['status'](_0x4d195d)['send'](_0x44fce3);};}exports[_0x39b1('0x27')]=function(_0x4a7fe5,_0xc6909b){var _0x658a10={},_0x28cebb={},_0x165242={'count':0x0,'rows':[]};var _0x530a59=_[_0x39b1('0x28')](db[_0x39b1('0x29')][_0x39b1('0x2a')],function(_0x16728c){return{'name':_0x16728c[_0x39b1('0x2b')],'type':_0x16728c[_0x39b1('0x2c')]['key']};});_0x28cebb[_0x39b1('0x2d')]=_[_0x39b1('0x28')](_0x530a59,_0x39b1('0x26'));_0x28cebb[_0x39b1('0x2e')]=_[_0x39b1('0x2f')](_0x4a7fe5['query']);_0x28cebb[_0x39b1('0x30')]=_['intersection'](_0x28cebb[_0x39b1('0x2d')],_0x28cebb[_0x39b1('0x2e')]);_0x658a10[_0x39b1('0x31')]=_[_0x39b1('0x32')](_0x28cebb[_0x39b1('0x2d')],qs[_0x39b1('0x33')](_0x4a7fe5[_0x39b1('0x2e')][_0x39b1('0x33')]));_0x658a10['attributes']=_0x658a10[_0x39b1('0x31')][_0x39b1('0x34')]?_0x658a10[_0x39b1('0x31')]:_0x28cebb[_0x39b1('0x2d')];if(!_0x4a7fe5[_0x39b1('0x2e')][_0x39b1('0x35')](_0x39b1('0x36'))){_0x658a10[_0x39b1('0x1e')]=qs[_0x39b1('0x1e')](_0x4a7fe5[_0x39b1('0x2e')]['limit']);_0x658a10[_0x39b1('0x1c')]=qs[_0x39b1('0x1c')](_0x4a7fe5['query'][_0x39b1('0x1c')]);}_0x658a10[_0x39b1('0x37')]=qs['sort'](_0x4a7fe5[_0x39b1('0x2e')][_0x39b1('0x38')]);_0x658a10[_0x39b1('0x39')]=qs[_0x39b1('0x30')](_[_0x39b1('0x3a')](_0x4a7fe5[_0x39b1('0x2e')],_0x28cebb[_0x39b1('0x30')]),_0x530a59);if(_0x4a7fe5[_0x39b1('0x2e')][_0x39b1('0x3b')]){_0x658a10['where']=_[_0x39b1('0x3c')](_0x658a10[_0x39b1('0x39')],{'$or':_[_0x39b1('0x28')](_0x530a59,function(_0x989709){if(_0x989709[_0x39b1('0x2c')]!==_0x39b1('0x3d')){var _0x481738={};_0x481738[_0x989709['name']]={'$like':'%'+_0x4a7fe5[_0x39b1('0x2e')]['filter']+'%'};return _0x481738;}})});}_0x658a10=_[_0x39b1('0x3c')]({},_0x658a10,_0x4a7fe5['options']);var _0x69083d={'where':_0x658a10[_0x39b1('0x39')]};return db[_0x39b1('0x29')]['count'](_0x69083d)[_0x39b1('0x24')](function(_0x3ee700){_0x165242[_0x39b1('0x1f')]=_0x3ee700;if(_0x4a7fe5['query']['includeAll']){_0x658a10[_0x39b1('0x3e')]=[{'all':!![]}];}return db[_0x39b1('0x29')][_0x39b1('0x3f')](_0x658a10);})['then'](function(_0x5dcdc0){_0x165242[_0x39b1('0x40')]=_0x5dcdc0;return _0x165242;})[_0x39b1('0x24')](respondWithFilteredResult(_0xc6909b,_0x658a10))[_0x39b1('0x41')](handleError(_0xc6909b,null));};exports[_0x39b1('0x42')]=function(_0x447ba0,_0x283bde){var _0x4b743f={'raw':![],'where':{'id':_0x447ba0['params']['id']}},_0x93d86={};_0x93d86['model']=_[_0x39b1('0x2f')](db[_0x39b1('0x29')][_0x39b1('0x2a')]);_0x93d86[_0x39b1('0x2e')]=_['keys'](_0x447ba0[_0x39b1('0x2e')]);_0x93d86['filters']=_[_0x39b1('0x32')](_0x93d86['model'],_0x93d86['query']);_0x4b743f[_0x39b1('0x31')]=_[_0x39b1('0x32')](_0x93d86[_0x39b1('0x2d')],qs[_0x39b1('0x33')](_0x447ba0[_0x39b1('0x2e')]['fields']));_0x4b743f['attributes']=_0x4b743f[_0x39b1('0x31')][_0x39b1('0x34')]?_0x4b743f['attributes']:_0x93d86[_0x39b1('0x2d')];if(_0x447ba0[_0x39b1('0x2e')][_0x39b1('0x43')]){_0x4b743f[_0x39b1('0x3e')]=[{'all':!![]}];}_0x4b743f=_[_0x39b1('0x3c')]({},_0x4b743f,_0x447ba0[_0x39b1('0x44')]);return db[_0x39b1('0x29')][_0x39b1('0x45')](_0x4b743f)[_0x39b1('0x24')](handleEntityNotFound(_0x283bde,null))[_0x39b1('0x24')](respondWithResult(_0x283bde,null))['catch'](handleError(_0x283bde,null));};exports['create']=function(_0x17ca9d,_0x223023){return db[_0x39b1('0x29')]['create'](_0x17ca9d[_0x39b1('0x46')],{})[_0x39b1('0x24')](respondWithResult(_0x223023,0xc9))[_0x39b1('0x41')](handleError(_0x223023,null));};exports[_0x39b1('0x23')]=function(_0x5e0f75,_0x2b1b68){if(_0x5e0f75[_0x39b1('0x46')]['id']){delete _0x5e0f75[_0x39b1('0x46')]['id'];}return db['UserProfileSection'][_0x39b1('0x45')]({'where':{'id':_0x5e0f75[_0x39b1('0x47')]['id']}})[_0x39b1('0x24')](handleEntityNotFound(_0x2b1b68,null))[_0x39b1('0x24')](saveUpdates(_0x5e0f75['body'],null))['then'](respondWithResult(_0x2b1b68,null))[_0x39b1('0x41')](handleError(_0x2b1b68,null));};exports['destroy']=function(_0x290f5c,_0x43dd90){return db[_0x39b1('0x29')][_0x39b1('0x45')]({'where':{'id':_0x290f5c['params']['id']}})[_0x39b1('0x24')](handleEntityNotFound(_0x43dd90,null))['then'](removeEntity(_0x43dd90,null))[_0x39b1('0x41')](handleError(_0x43dd90,null));};exports['describe']=function(_0x507a5c,_0x198367){return db[_0x39b1('0x29')][_0x39b1('0x48')]()[_0x39b1('0x24')](respondWithResult(_0x198367,null))[_0x39b1('0x41')](handleError(_0x198367,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index bbd4da7..9d6849f 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 _0x0de8=['../../config/environment','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x0de8,0x1db));var _0x80de=function(_0x4a464e,_0x250abf){_0x4a464e=_0x4a464e-0x0;var _0x54d070=_0x0de8[_0x4a464e];return _0x54d070;};'use strict';var _=require(_0x80de('0x0'));var util=require(_0x80de('0x1'));var logger=require(_0x80de('0x2'))(_0x80de('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x80de('0x4'));var rimraf=require(_0x80de('0x5'));var config=require(_0x80de('0x6'));var attributes=require('./userProfileSection.attributes');module[_0x80de('0x7')]=function(_0x2a1350,_0x522e0a){return _0x2a1350[_0x80de('0x8')]('UserProfileSection',attributes,{'tableName':_0x80de('0x9'),'paranoid':![],'indexes':[{'name':_0x80de('0xa'),'fields':[_0x80de('0xb'),_0x80de('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x552a=['../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x5586d4,_0x14b6ee){var _0x5a184f=function(_0x4553ee){while(--_0x4553ee){_0x5586d4['push'](_0x5586d4['shift']());}};_0x5a184f(++_0x14b6ee);}(_0x552a,0x9e));var _0xa552=function(_0x1d6d70,_0x5c45d1){_0x1d6d70=_0x1d6d70-0x0;var _0x1b4d36=_0x552a[_0x1d6d70];return _0x1b4d36;};'use strict';var _=require(_0xa552('0x0'));var util=require(_0xa552('0x1'));var logger=require(_0xa552('0x2'))('api');var moment=require(_0xa552('0x3'));var BPromise=require(_0xa552('0x4'));var rp=require(_0xa552('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa552('0x6'));var config=require(_0xa552('0x7'));var attributes=require('./userProfileSection.attributes');module[_0xa552('0x8')]=function(_0x39da3e,_0x46f739){return _0x39da3e[_0xa552('0x9')](_0xa552('0xa'),attributes,{'tableName':_0xa552('0xb'),'paranoid':![],'indexes':[{'name':_0xa552('0xc'),'fields':[_0xa552('0xd'),_0xa552('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 8c07ca6..3df3fe5 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 _0x87df=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x25d1be,_0x371093){var _0x41147e=function(_0x1ebbe0){while(--_0x1ebbe0){_0x25d1be['push'](_0x25d1be['shift']());}};_0x41147e(++_0x371093);}(_0x87df,0x1e9));var _0xf87d=function(_0x2d595f,_0xdfdb46){_0x2d595f=_0x2d595f-0x0;var _0x1e26a2=_0x87df[_0x2d595f];return _0x1e26a2;};'use strict';var _=require(_0xf87d('0x0'));var util=require(_0xf87d('0x1'));var moment=require(_0xf87d('0x2'));var BPromise=require(_0xf87d('0x3'));var rs=require(_0xf87d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf87d('0x5'))['db'];var utils=require(_0xf87d('0x6'));var logger=require(_0xf87d('0x7'))('rpc');var config=require(_0xf87d('0x8'));var jayson=require(_0xf87d('0x9'));var client=jayson['client'][_0xf87d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34366c,_0x454dc7,_0x41ae29){return new BPromise(function(_0x298f29,_0x488e55){return client[_0xf87d('0xb')](_0x34366c,_0x41ae29)[_0xf87d('0xc')](function(_0x3a3120){logger['info'](_0xf87d('0xd'),_0x454dc7,_0xf87d('0xe'));logger[_0xf87d('0xf')](_0xf87d('0x10'),_0x454dc7,'request\x20sent',JSON[_0xf87d('0x11')](_0x3a3120));if(_0x3a3120['error']){if(_0x3a3120[_0xf87d('0x12')][_0xf87d('0x13')]===0x1f4){logger[_0xf87d('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x454dc7,_0x3a3120[_0xf87d('0x12')][_0xf87d('0x14')]);return _0x488e55(_0x3a3120[_0xf87d('0x12')]['message']);}logger[_0xf87d('0x12')](_0xf87d('0xd'),_0x454dc7,_0x3a3120[_0xf87d('0x12')][_0xf87d('0x14')]);return _0x298f29(_0x3a3120[_0xf87d('0x12')][_0xf87d('0x14')]);}else{logger['info'](_0xf87d('0xd'),_0x454dc7,_0xf87d('0xe'));_0x298f29(_0x3a3120[_0xf87d('0x15')][_0xf87d('0x14')]);}})['catch'](function(_0x2eda90){logger[_0xf87d('0x12')](_0xf87d('0xd'),_0x454dc7,_0x2eda90);_0x488e55(_0x2eda90);});});} \ No newline at end of file +var _0x6dcd=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0x6dcd,0x130));var _0xd6dc=function(_0x387645,_0x42d1ae){_0x387645=_0x387645-0x0;var _0x869a39=_0x6dcd[_0x387645];return _0x869a39;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6dc('0x0'));var BPromise=require(_0xd6dc('0x1'));var rs=require(_0xd6dc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd6dc('0x3'));var logger=require(_0xd6dc('0x4'))(_0xd6dc('0x5'));var config=require('../../config/environment');var jayson=require(_0xd6dc('0x6'));var client=jayson[_0xd6dc('0x7')][_0xd6dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x398978,_0x502952,_0x508f92){return new BPromise(function(_0x1b98d1,_0x4cc646){return client['request'](_0x398978,_0x508f92)['then'](function(_0x10a0a1){logger[_0xd6dc('0x9')](_0xd6dc('0xa'),_0x502952,_0xd6dc('0xb'));logger[_0xd6dc('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x502952,_0xd6dc('0xb'),JSON[_0xd6dc('0xd')](_0x10a0a1));if(_0x10a0a1[_0xd6dc('0xe')]){if(_0x10a0a1[_0xd6dc('0xe')][_0xd6dc('0xf')]===0x1f4){logger[_0xd6dc('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x502952,_0x10a0a1[_0xd6dc('0xe')]['message']);return _0x4cc646(_0x10a0a1['error'][_0xd6dc('0x10')]);}logger[_0xd6dc('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x502952,_0x10a0a1[_0xd6dc('0xe')][_0xd6dc('0x10')]);return _0x1b98d1(_0x10a0a1[_0xd6dc('0xe')]['message']);}else{logger['info'](_0xd6dc('0xa'),_0x502952,_0xd6dc('0xb'));_0x1b98d1(_0x10a0a1[_0xd6dc('0x11')]['message']);}})[_0xd6dc('0x12')](function(_0x21acac){logger['error'](_0xd6dc('0xa'),_0x502952,_0x21acac);_0x4cc646(_0x21acac);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 2146e06..23a0d4d 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(_0x5ac6d9,_0x28cdea){var _0x3eea6e=function(_0x2b7b5c){while(--_0x2b7b5c){_0x5ac6d9['push'](_0x5ac6d9['shift']());}};_0x3eea6e(++_0x28cdea);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x42c383,_0x5b92b6){var _0x4aba3b=function(_0x2bfba3){while(--_0x2bfba3){_0x42c383['push'](_0x42c383['shift']());}};_0x4aba3b(++_0x5b92b6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index f3eb8bb..27de5ff 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 _0x046b=['INTEGER','exports'];(function(_0x457ef0,_0xe99ae9){var _0x17c1ea=function(_0x2b0dec){while(--_0x2b0dec){_0x457ef0['push'](_0x457ef0['shift']());}};_0x17c1ea(++_0xe99ae9);}(_0x046b,0x147));var _0xb046=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x046b[_0x5cc8b9];return _0x58892e;};'use strict';var Sequelize=require('sequelize');module[_0xb046('0x0')]={'penalty':{'type':Sequelize[_0xb046('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa42b=['sequelize','exports','INTEGER'];(function(_0x210ce7,_0x4d9a73){var _0x5de04c=function(_0xf9da31){while(--_0xf9da31){_0x210ce7['push'](_0x210ce7['shift']());}};_0x5de04c(++_0x4d9a73);}(_0xa42b,0xcf));var _0xba42=function(_0x490f78,_0x3161c2){_0x490f78=_0x490f78-0x0;var _0x5de2d0=_0xa42b[_0x490f78];return _0x5de2d0;};'use strict';var Sequelize=require(_0xba42('0x0'));module[_0xba42('0x1')]={'penalty':{'type':Sequelize[_0xba42('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 906682e..2b893e2 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 _0x2eba=['user_has_sms_queues','util','../../config/logger','api','moment','path','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x3bc702,_0x4ced94){var _0x5493d2=function(_0x23c25e){while(--_0x23c25e){_0x3bc702['push'](_0x3bc702['shift']());}};_0x5493d2(++_0x4ced94);}(_0x2eba,0xc7));var _0xa2eb=function(_0x2c8dd6,_0x3d86ca){_0x2c8dd6=_0x2c8dd6-0x0;var _0x55ffca=_0x2eba[_0x2c8dd6];return _0x55ffca;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var logger=require(_0xa2eb('0x1'))(_0xa2eb('0x2'));var moment=require(_0xa2eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2eb('0x4'));var rimraf=require('rimraf');var config=require(_0xa2eb('0x5'));var attributes=require(_0xa2eb('0x6'));module[_0xa2eb('0x7')]=function(_0x1e6fa2,_0x575a5c){return _0x1e6fa2['define']('UserSmsQueue',attributes,{'tableName':_0xa2eb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc359=['user_has_sms_queues','util','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0xc359,0x1d9));var _0x9c35=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0xc359[_0x2eb3db];return _0x358f33;};'use strict';var _=require('lodash');var util=require(_0x9c35('0x0'));var logger=require('../../config/logger')(_0x9c35('0x1'));var moment=require(_0x9c35('0x2'));var BPromise=require(_0x9c35('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c35('0x4'));var rimraf=require('rimraf');var config=require(_0x9c35('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x9c35('0x6')]=function(_0x5b3ada,_0x490409){return _0x5b3ada['define']('UserSmsQueue',attributes,{'tableName':_0x9c35('0x7'),'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 79b24b0..678d6cb 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 _0xb0a0=['http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb0a0,0x16d));var _0x0b0a=function(_0x54cda0,_0x3bf6e9){_0x54cda0=_0x54cda0-0x0;var _0x26f2c2=_0xb0a0[_0x54cda0];return _0x26f2c2;};'use strict';var _=require(_0x0b0a('0x0'));var util=require('util');var moment=require(_0x0b0a('0x1'));var BPromise=require(_0x0b0a('0x2'));var rs=require(_0x0b0a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b0a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b0a('0x5'))('rpc');var config=require(_0x0b0a('0x6'));var jayson=require(_0x0b0a('0x7'));var client=jayson[_0x0b0a('0x8')][_0x0b0a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11a07f,_0x1280a6,_0x2fdc5b){return new BPromise(function(_0x4986e9,_0x5eac30){return client[_0x0b0a('0xa')](_0x11a07f,_0x2fdc5b)[_0x0b0a('0xb')](function(_0x333712){logger[_0x0b0a('0xc')](_0x0b0a('0xd'),_0x1280a6,'request\x20sent');logger[_0x0b0a('0xe')](_0x0b0a('0xf'),_0x1280a6,_0x0b0a('0x10'),JSON[_0x0b0a('0x11')](_0x333712));if(_0x333712[_0x0b0a('0x12')]){if(_0x333712[_0x0b0a('0x12')][_0x0b0a('0x13')]===0x1f4){logger[_0x0b0a('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x1280a6,_0x333712[_0x0b0a('0x12')][_0x0b0a('0x14')]);return _0x5eac30(_0x333712[_0x0b0a('0x12')]['message']);}logger[_0x0b0a('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x1280a6,_0x333712[_0x0b0a('0x12')]['message']);return _0x4986e9(_0x333712[_0x0b0a('0x12')][_0x0b0a('0x14')]);}else{logger[_0x0b0a('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x1280a6,_0x0b0a('0x10'));_0x4986e9(_0x333712['result'][_0x0b0a('0x14')]);}})[_0x0b0a('0x15')](function(_0x5e31e8){logger[_0x0b0a('0x12')](_0x0b0a('0xd'),_0x1280a6,_0x5e31e8);_0x5eac30(_0x5e31e8);});});} \ No newline at end of file +var _0x178b=['client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0xa24985,_0x1d2c15){var _0x2f7c36=function(_0x28219c){while(--_0x28219c){_0xa24985['push'](_0xa24985['shift']());}};_0x2f7c36(++_0x1d2c15);}(_0x178b,0x74));var _0xb178=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x178b[_0x5eb22e];return _0x27fed5;};'use strict';var _=require(_0xb178('0x0'));var util=require(_0xb178('0x1'));var moment=require(_0xb178('0x2'));var BPromise=require(_0xb178('0x3'));var rs=require(_0xb178('0x4'));var fs=require('fs');var Redis=require(_0xb178('0x5'));var db=require(_0xb178('0x6'))['db'];var utils=require(_0xb178('0x7'));var logger=require(_0xb178('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb178('0x9'));var client=jayson[_0xb178('0xa')][_0xb178('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x836c8c,_0x59078e,_0x146ba3){return new BPromise(function(_0x499e04,_0x5496ea){return client[_0xb178('0xc')](_0x836c8c,_0x146ba3)[_0xb178('0xd')](function(_0x40eeda){logger[_0xb178('0xe')](_0xb178('0xf'),_0x59078e,'request\x20sent');logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x59078e,_0xb178('0x10'),JSON[_0xb178('0x11')](_0x40eeda));if(_0x40eeda[_0xb178('0x12')]){if(_0x40eeda[_0xb178('0x12')][_0xb178('0x13')]===0x1f4){logger['error'](_0xb178('0xf'),_0x59078e,_0x40eeda[_0xb178('0x12')][_0xb178('0x14')]);return _0x5496ea(_0x40eeda[_0xb178('0x12')][_0xb178('0x14')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x59078e,_0x40eeda[_0xb178('0x12')][_0xb178('0x14')]);return _0x499e04(_0x40eeda[_0xb178('0x12')][_0xb178('0x14')]);}else{logger[_0xb178('0xe')](_0xb178('0xf'),_0x59078e,_0xb178('0x10'));_0x499e04(_0x40eeda['result']['message']);}})['catch'](function(_0x356ef3){logger[_0xb178('0x12')](_0xb178('0xf'),_0x59078e,_0x356ef3);_0x5496ea(_0x356ef3);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 8364be0..360e7dc 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8029=['sequelize','exports','INTEGER'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8029,0x19b));var _0x9802=function(_0x533d41,_0x4c5b6e){_0x533d41=_0x533d41-0x0;var _0x2e2d36=_0x8029[_0x533d41];return _0x2e2d36;};'use strict';var Sequelize=require(_0x9802('0x0'));module[_0x9802('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x9802('0x2')]}}; \ No newline at end of file +var _0x6fc4=['INTEGER','exports'];(function(_0x559958,_0x9f3a90){var _0x4bc85a=function(_0x5d5b7c){while(--_0x5d5b7c){_0x559958['push'](_0x559958['shift']());}};_0x4bc85a(++_0x9f3a90);}(_0x6fc4,0x139));var _0x46fc=function(_0x5de237,_0x2058e8){_0x5de237=_0x5de237-0x0;var _0x3b3d4d=_0x6fc4[_0x5de237];return _0x3b3d4d;};'use strict';var Sequelize=require('sequelize');module[_0x46fc('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x46fc('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 78cd501..0d9cc52 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1a7399,_0x5ee2d4){var _0x45474f=function(_0x5058a6){while(--_0x5058a6){_0x1a7399['push'](_0x1a7399['shift']());}};_0x45474f(++_0x5ee2d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5693b9,_0x24239a){var _0x407e06=function(_0x318078){while(--_0x318078){_0x5693b9['push'](_0x5693b9['shift']());}};_0x407e06(++_0x24239a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 3123532..36cc32b 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x465908,_0x46f9f4){var _0x301018=function(_0x13aa04){while(--_0x13aa04){_0x465908['push'](_0x465908['shift']());}};_0x301018(++_0x46f9f4);}(_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(_0x22626b,_0x154dda){var _0x2bae4c=function(_0x171362){while(--_0x171362){_0x22626b['push'](_0x22626b['shift']());}};_0x2bae4c(++_0x154dda);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 12d4b22..cd36495 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 _0x77f7=['sequelize','exports','INTEGER'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x77f7,0xbd));var _0x777f=function(_0x2a309f,_0x442137){_0x2a309f=_0x2a309f-0x0;var _0x140fe9=_0x77f7[_0x2a309f];return _0x140fe9;};'use strict';var Sequelize=require(_0x777f('0x0'));module[_0x777f('0x1')]={'penalty':{'type':Sequelize[_0x777f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb22e=['sequelize','exports'];(function(_0x4ea039,_0x12da7d){var _0xa477a6=function(_0x5bb7ca){while(--_0x5bb7ca){_0x4ea039['push'](_0x4ea039['shift']());}};_0xa477a6(++_0x12da7d);}(_0xb22e,0xba));var _0xeb22=function(_0x498bfc,_0x1ac9c1){_0x498bfc=_0x498bfc-0x0;var _0x4612ff=_0xb22e[_0x498bfc];return _0x4612ff;};'use strict';var Sequelize=require(_0xeb22('0x0'));module[_0xeb22('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 dbf8dc6..dab735d 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 _0x45cb=['define','UserVoiceQueue','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x38c961,_0x102578){var _0x2bee54=function(_0xd0ddcf){while(--_0xd0ddcf){_0x38c961['push'](_0x38c961['shift']());}};_0x2bee54(++_0x102578);}(_0x45cb,0xf2));var _0xb45c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x45cb[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xb45c('0x0'));var util=require(_0xb45c('0x1'));var logger=require('../../config/logger')(_0xb45c('0x2'));var moment=require(_0xb45c('0x3'));var BPromise=require(_0xb45c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb45c('0x5'));var rimraf=require(_0xb45c('0x6'));var config=require(_0xb45c('0x7'));var attributes=require(_0xb45c('0x8'));module[_0xb45c('0x9')]=function(_0x4bea0b,_0x4c330c){return _0x4bea0b[_0xb45c('0xa')](_0xb45c('0xb'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13cf=['UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define'];(function(_0x112e82,_0x305813){var _0xc10fa3=function(_0x3194ca){while(--_0x3194ca){_0x112e82['push'](_0x112e82['shift']());}};_0xc10fa3(++_0x305813);}(_0x13cf,0x10a));var _0xf13c=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x13cf[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require(_0xf13c('0x0'));var logger=require(_0xf13c('0x1'))(_0xf13c('0x2'));var moment=require(_0xf13c('0x3'));var BPromise=require('bluebird');var rp=require(_0xf13c('0x4'));var fs=require('fs');var path=require(_0xf13c('0x5'));var rimraf=require(_0xf13c('0x6'));var config=require(_0xf13c('0x7'));var attributes=require(_0xf13c('0x8'));module['exports']=function(_0xd8c5c9,_0x14a535){return _0xd8c5c9[_0xf13c('0x9')](_0xf13c('0xa'),attributes,{'tableName':_0xf13c('0xb'),'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 6d99be3..f72ffbc 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 _0x63c8=['randomstring','ioredis','rpc','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','util','moment'];(function(_0x522a0a,_0x4878fa){var _0x47dcb4=function(_0xe4a50){while(--_0xe4a50){_0x522a0a['push'](_0x522a0a['shift']());}};_0x47dcb4(++_0x4878fa);}(_0x63c8,0x1c9));var _0x863c=function(_0x2716a4,_0x13e95d){_0x2716a4=_0x2716a4-0x0;var _0x5a0942=_0x63c8[_0x2716a4];return _0x5a0942;};'use strict';var _=require('lodash');var util=require(_0x863c('0x0'));var moment=require(_0x863c('0x1'));var BPromise=require('bluebird');var rs=require(_0x863c('0x2'));var fs=require('fs');var Redis=require(_0x863c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x863c('0x4'));var config=require('../../config/environment');var jayson=require(_0x863c('0x5'));var client=jayson[_0x863c('0x6')][_0x863c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1be1bf,_0x211ac4,_0x42e24a){return new BPromise(function(_0x2fe9b5,_0x2bb16c){return client[_0x863c('0x8')](_0x1be1bf,_0x42e24a)[_0x863c('0x9')](function(_0x5c4f91){logger['info'](_0x863c('0xa'),_0x211ac4,_0x863c('0xb'));logger['debug'](_0x863c('0xc'),_0x211ac4,_0x863c('0xb'),JSON[_0x863c('0xd')](_0x5c4f91));if(_0x5c4f91['error']){if(_0x5c4f91[_0x863c('0xe')]['code']===0x1f4){logger[_0x863c('0xe')](_0x863c('0xa'),_0x211ac4,_0x5c4f91[_0x863c('0xe')][_0x863c('0xf')]);return _0x2bb16c(_0x5c4f91[_0x863c('0xe')]['message']);}logger['error'](_0x863c('0xa'),_0x211ac4,_0x5c4f91[_0x863c('0xe')][_0x863c('0xf')]);return _0x2fe9b5(_0x5c4f91[_0x863c('0xe')][_0x863c('0xf')]);}else{logger[_0x863c('0x10')](_0x863c('0xa'),_0x211ac4,_0x863c('0xb'));_0x2fe9b5(_0x5c4f91['result']['message']);}})['catch'](function(_0x3cc9b7){logger[_0x863c('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x211ac4,_0x3cc9b7);_0x2bb16c(_0x3cc9b7);});});} \ No newline at end of file +var _0x4202=['UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x4202,0xb0));var _0x2420=function(_0x19a1bf,_0xd46be){_0x19a1bf=_0x19a1bf-0x0;var _0x4e8a3e=_0x4202[_0x19a1bf];return _0x4e8a3e;};'use strict';var _=require(_0x2420('0x0'));var util=require(_0x2420('0x1'));var moment=require(_0x2420('0x2'));var BPromise=require('bluebird');var rs=require(_0x2420('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2420('0x4'))['db'];var utils=require(_0x2420('0x5'));var logger=require('../../config/logger')(_0x2420('0x6'));var config=require(_0x2420('0x7'));var jayson=require(_0x2420('0x8'));var client=jayson[_0x2420('0x9')][_0x2420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ff7e2,_0x4e1932,_0x4060ea){return new BPromise(function(_0x2ccb4f,_0x594a64){return client[_0x2420('0xb')](_0x1ff7e2,_0x4060ea)['then'](function(_0x473e5d){logger[_0x2420('0xc')](_0x2420('0xd'),_0x4e1932,_0x2420('0xe'));logger[_0x2420('0xf')](_0x2420('0x10'),_0x4e1932,_0x2420('0xe'),JSON[_0x2420('0x11')](_0x473e5d));if(_0x473e5d[_0x2420('0x12')]){if(_0x473e5d['error'][_0x2420('0x13')]===0x1f4){logger[_0x2420('0x12')](_0x2420('0xd'),_0x4e1932,_0x473e5d[_0x2420('0x12')][_0x2420('0x14')]);return _0x594a64(_0x473e5d[_0x2420('0x12')][_0x2420('0x14')]);}logger['error'](_0x2420('0xd'),_0x4e1932,_0x473e5d[_0x2420('0x12')][_0x2420('0x14')]);return _0x2ccb4f(_0x473e5d[_0x2420('0x12')]['message']);}else{logger[_0x2420('0xc')](_0x2420('0xd'),_0x4e1932,_0x2420('0xe'));_0x2ccb4f(_0x473e5d['result']['message']);}})['catch'](function(_0x5cfb4d){logger[_0x2420('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x4e1932,_0x5cfb4d);_0x594a64(_0x5cfb4d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 4ff1134..c99323b 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x46f7ab,_0x3ba935){var _0x59104f=function(_0x2bb461){while(--_0x2bb461){_0x46f7ab['push'](_0x46f7ab['shift']());}};_0x59104f(++_0x3ba935);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x255145,_0x2ba97a){var _0x3882ce=function(_0x1a1a4f){while(--_0x1a1a4f){_0x255145['push'](_0x255145['shift']());}};_0x3882ce(++_0x2ba97a);}(_0xe706,0xa3));var _0x6e70=function(_0x3b9570,_0x4ead31){_0x3b9570=_0x3b9570-0x0;var _0x28acdd=_0xe706[_0x3b9570];return _0x28acdd;};'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 f7f4709..a3a9947 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 _0x012a=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x539075,_0x1dfaec){var _0x5b611c=function(_0x52c735){while(--_0x52c735){_0x539075['push'](_0x539075['shift']());}};_0x5b611c(++_0x1dfaec);}(_0x012a,0x89));var _0xa012=function(_0x22f796,_0x3e99a0){_0x22f796=_0x22f796-0x0;var _0xa8f4e7=_0x012a[_0x22f796];return _0xa8f4e7;};'use strict';var Sequelize=require(_0xa012('0x0'));module[_0xa012('0x1')]={'uniqueid':{'type':Sequelize[_0xa012('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xa012('0x3')},'membername':{'type':Sequelize[_0xa012('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xa012('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa012('0x4')],'allowNull':![],'unique':_0xa012('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xa012('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xa012('0x4')],'allowNull':![],'unique':_0xa012('0x5'),'comment':_0xa012('0x3')},'penalty':{'type':Sequelize[_0xa012('0x2')](0xb),'defaultValue':0x0,'comment':_0xa012('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xa012('0x3')}}; \ No newline at end of file +var _0x3e51=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x43f50c,_0x21950e){var _0x44a32c=function(_0x5b3a49){while(--_0x5b3a49){_0x43f50c['push'](_0x43f50c['shift']());}};_0x44a32c(++_0x21950e);}(_0x3e51,0x74));var _0x13e5=function(_0x46cf7e,_0xe67477){_0x46cf7e=_0x46cf7e-0x0;var _0x241ad7=_0x3e51[_0x46cf7e];return _0x241ad7;};'use strict';var Sequelize=require(_0x13e5('0x0'));module[_0x13e5('0x1')]={'uniqueid':{'type':Sequelize[_0x13e5('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x13e5('0x3')},'membername':{'type':Sequelize[_0x13e5('0x4')],'allowNull':![],'comment':_0x13e5('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x13e5('0x4')],'allowNull':![],'unique':_0x13e5('0x5'),'comment':_0x13e5('0x3')},'VoiceQueueId':{'type':Sequelize[_0x13e5('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x13e5('0x4')],'allowNull':![],'unique':_0x13e5('0x5'),'comment':_0x13e5('0x3')},'penalty':{'type':Sequelize[_0x13e5('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x13e5('0x2')](0xb),'defaultValue':0x0,'comment':_0x13e5('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 7847907..5e61287 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 _0x775d=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x775d,0x1a1));var _0xd775=function(_0x1bfea0,_0xc9cbfa){_0x1bfea0=_0x1bfea0-0x0;var _0x151b78=_0x775d[_0x1bfea0];return _0x151b78;};'use strict';var EventEmitter=require(_0xd775('0x0'));var UserVoiceQueueRt=require(_0xd775('0x1'))['db'][_0xd775('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd775('0x3')](0x0);var events={'afterCreate':_0xd775('0x4'),'afterUpdate':_0xd775('0x5'),'afterDestroy':_0xd775('0x6')};function emitEvent(_0x20aa09){return function(_0x12cf03,_0x5afdf9,_0x28ce45){UserVoiceQueueRtEvents[_0xd775('0x7')](_0x20aa09+':'+_0x12cf03['id'],_0x12cf03);UserVoiceQueueRtEvents['emit'](_0x20aa09,_0x12cf03);_0x28ce45(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xd775('0x8')](e,emitEvent(event));}}module[_0xd775('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x739c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0xc7e2d6,_0x5af8fd){var _0x193111=function(_0x1e0026){while(--_0x1e0026){_0xc7e2d6['push'](_0xc7e2d6['shift']());}};_0x193111(++_0x5af8fd);}(_0x739c,0x1b2));var _0xc739=function(_0x27e4e8,_0x42cd4e){_0x27e4e8=_0x27e4e8-0x0;var _0x35f212=_0x739c[_0x27e4e8];return _0x35f212;};'use strict';var EventEmitter=require(_0xc739('0x0'));var UserVoiceQueueRt=require(_0xc739('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc739('0x2')](0x0);var events={'afterCreate':_0xc739('0x3'),'afterUpdate':_0xc739('0x4'),'afterDestroy':_0xc739('0x5')};function emitEvent(_0x11e511){return function(_0x501993,_0x3dbf80,_0x16f097){UserVoiceQueueRtEvents['emit'](_0x11e511+':'+_0x501993['id'],_0x501993);UserVoiceQueueRtEvents[_0xc739('0x6')](_0x11e511,_0x501993);_0x16f097(null);};}for(var e in events){if(events[_0xc739('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xc739('0x8')](e,emitEvent(event));}}module[_0xc739('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index c23992c..6b0064e 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 _0x0879=['../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0x0879,0x16d));var _0x9087=function(_0x17a610,_0x32a8f6){_0x17a610=_0x17a610-0x0;var _0xdabd1f=_0x0879[_0x17a610];return _0xdabd1f;};'use strict';var _=require(_0x9087('0x0'));var util=require('util');var logger=require(_0x9087('0x1'))(_0x9087('0x2'));var moment=require('moment');var BPromise=require(_0x9087('0x3'));var rp=require(_0x9087('0x4'));var fs=require('fs');var path=require(_0x9087('0x5'));var rimraf=require(_0x9087('0x6'));var config=require(_0x9087('0x7'));var attributes=require(_0x9087('0x8'));module['exports']=function(_0x5b55f2,_0x313520){return _0x5b55f2[_0x9087('0x9')](_0x9087('0xa'),attributes,{'tableName':_0x9087('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c47=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger'];(function(_0x2ec026,_0xb190a8){var _0x4eb11f=function(_0xaea945){while(--_0xaea945){_0x2ec026['push'](_0x2ec026['shift']());}};_0x4eb11f(++_0xb190a8);}(_0x3c47,0x140));var _0x73c4=function(_0x5c4223,_0x38ba38){_0x5c4223=_0x5c4223-0x0;var _0x4a0c4e=_0x3c47[_0x5c4223];return _0x4a0c4e;};'use strict';var _=require(_0x73c4('0x0'));var util=require('util');var logger=require(_0x73c4('0x1'))(_0x73c4('0x2'));var moment=require(_0x73c4('0x3'));var BPromise=require(_0x73c4('0x4'));var rp=require(_0x73c4('0x5'));var fs=require('fs');var path=require(_0x73c4('0x6'));var rimraf=require(_0x73c4('0x7'));var config=require(_0x73c4('0x8'));var attributes=require(_0x73c4('0x9'));module[_0x73c4('0xa')]=function(_0x1014af,_0x31d2ee){return _0x1014af[_0x73c4('0xb')](_0x73c4('0xc'),attributes,{'tableName':_0x73c4('0xd'),'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 017e9c5..0d9382f 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 _0xc928=['literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','stringify','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT'];(function(_0x54bbad,_0x554d32){var _0x16e361=function(_0x247eda){while(--_0x247eda){_0x54bbad['push'](_0x54bbad['shift']());}};_0x16e361(++_0x554d32);}(_0xc928,0xe9));var _0x8c92=function(_0x49e8f9,_0xa1de89){_0x49e8f9=_0x49e8f9-0x0;var _0x2d7dde=_0xc928[_0x49e8f9];return _0x2d7dde;};'use strict';var _=require(_0x8c92('0x0'));var util=require(_0x8c92('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8c92('0x2'));var fs=require('fs');var Redis=require(_0x8c92('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c92('0x4'));var logger=require(_0x8c92('0x5'))(_0x8c92('0x6'));var config=require(_0x8c92('0x7'));var jayson=require(_0x8c92('0x8'));var client=jayson[_0x8c92('0x9')][_0x8c92('0xa')]({'port':0x232a});config[_0x8c92('0xb')]=_[_0x8c92('0xc')](config[_0x8c92('0xb')],{'host':_0x8c92('0xd'),'port':0x18eb});var socket=require(_0x8c92('0xe'))(new Redis(config[_0x8c92('0xb')]));require(_0x8c92('0xf'))[_0x8c92('0x10')](socket);function respondWithRpcPromise(_0x37d37c,_0x4580bc,_0x57aa57){return new BPromise(function(_0x3f0a9c,_0x27327b){return client[_0x8c92('0x11')](_0x37d37c,_0x57aa57)['then'](function(_0xc77e5a){logger[_0x8c92('0x12')](_0x8c92('0x13'),_0x4580bc,_0x8c92('0x14'));logger[_0x8c92('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x4580bc,'request\x20sent',JSON['stringify'](_0xc77e5a));if(_0xc77e5a['error']){if(_0xc77e5a[_0x8c92('0x16')][_0x8c92('0x17')]===0x1f4){logger[_0x8c92('0x16')](_0x8c92('0x13'),_0x4580bc,_0xc77e5a[_0x8c92('0x16')][_0x8c92('0x18')]);return _0x27327b(_0xc77e5a['error'][_0x8c92('0x18')]);}logger[_0x8c92('0x16')](_0x8c92('0x13'),_0x4580bc,_0xc77e5a[_0x8c92('0x16')][_0x8c92('0x18')]);return _0x3f0a9c(_0xc77e5a[_0x8c92('0x16')]['message']);}else{logger[_0x8c92('0x12')](_0x8c92('0x13'),_0x4580bc,'request\x20sent');_0x3f0a9c(_0xc77e5a['result'][_0x8c92('0x18')]);}})[_0x8c92('0x19')](function(_0x3c1421){logger[_0x8c92('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4580bc,_0x3c1421);_0x27327b(_0x3c1421);});});}exports[_0x8c92('0x1a')]=function(_0x119710){var _0x2a32e0=this;return new Promise(function(_0x320810,_0x74847a){return db['UserVoiceQueueRt'][_0x8c92('0x1b')]({'raw':_0x119710[_0x8c92('0x1c')]?_0x119710[_0x8c92('0x1c')][_0x8c92('0x1d')]===undefined?!![]:![]:!![],'where':_0x119710['options']?_0x119710['options'][_0x8c92('0x1e')]||null:null,'attributes':[[db[_0x8c92('0x1f')]['fn'](_0x8c92('0x20'),db[_0x8c92('0x1f')]['fn']('IF',db[_0x8c92('0x1f')][_0x8c92('0x21')](_0x8c92('0x22')))),_0x8c92('0x23')]]})[_0x8c92('0x24')](function(_0x3bd0e9){logger[_0x8c92('0x12')](_0x8c92('0x1a'),_0x119710);logger[_0x8c92('0x15')](_0x8c92('0x1a'),_0x119710,JSON[_0x8c92('0x25')](_0x3bd0e9));_0x320810(_0x3bd0e9);})['catch'](function(_0x1eb44f){logger[_0x8c92('0x16')](_0x8c92('0x1a'),_0x1eb44f['message'],_0x119710);_0x74847a(_0x2a32e0[_0x8c92('0x16')](0x1f4,_0x1eb44f['message']));});});}; \ No newline at end of file +var _0x12e2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','bluebird','randomstring'];(function(_0x1c29fd,_0x2366d8){var _0x52ff9d=function(_0x4d0921){while(--_0x4d0921){_0x1c29fd['push'](_0x1c29fd['shift']());}};_0x52ff9d(++_0x2366d8);}(_0x12e2,0xdb));var _0x212e=function(_0xfa14b5,_0x164434){_0xfa14b5=_0xfa14b5-0x0;var _0x57e471=_0x12e2[_0xfa14b5];return _0x57e471;};'use strict';var _=require('lodash');var util=require(_0x212e('0x0'));var moment=require('moment');var BPromise=require(_0x212e('0x1'));var rs=require(_0x212e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x212e('0x3'))['db'];var utils=require(_0x212e('0x4'));var logger=require(_0x212e('0x5'))(_0x212e('0x6'));var config=require(_0x212e('0x7'));var jayson=require(_0x212e('0x8'));var client=jayson[_0x212e('0x9')][_0x212e('0xa')]({'port':0x232a});config[_0x212e('0xb')]=_[_0x212e('0xc')](config[_0x212e('0xb')],{'host':_0x212e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x212e('0xe'))[_0x212e('0xf')](socket);function respondWithRpcPromise(_0x49f095,_0x191f2c,_0x20d1ba){return new BPromise(function(_0x16a70f,_0x342f8a){return client[_0x212e('0x10')](_0x49f095,_0x20d1ba)[_0x212e('0x11')](function(_0x1fc5f2){logger[_0x212e('0x12')](_0x212e('0x13'),_0x191f2c,'request\x20sent');logger[_0x212e('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x191f2c,_0x212e('0x15'),JSON[_0x212e('0x16')](_0x1fc5f2));if(_0x1fc5f2[_0x212e('0x17')]){if(_0x1fc5f2[_0x212e('0x17')]['code']===0x1f4){logger[_0x212e('0x17')](_0x212e('0x13'),_0x191f2c,_0x1fc5f2['error'][_0x212e('0x18')]);return _0x342f8a(_0x1fc5f2['error'][_0x212e('0x18')]);}logger[_0x212e('0x17')](_0x212e('0x13'),_0x191f2c,_0x1fc5f2[_0x212e('0x17')][_0x212e('0x18')]);return _0x16a70f(_0x1fc5f2[_0x212e('0x17')][_0x212e('0x18')]);}else{logger[_0x212e('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x191f2c,'request\x20sent');_0x16a70f(_0x1fc5f2['result']['message']);}})[_0x212e('0x19')](function(_0x4021f1){logger[_0x212e('0x17')](_0x212e('0x13'),_0x191f2c,_0x4021f1);_0x342f8a(_0x4021f1);});});}exports[_0x212e('0x1a')]=function(_0x5c6fe0){var _0x222502=this;return new Promise(function(_0xc4aa86,_0x472bcb){return db[_0x212e('0x1b')][_0x212e('0x1c')]({'raw':_0x5c6fe0[_0x212e('0x1d')]?_0x5c6fe0[_0x212e('0x1d')][_0x212e('0x1e')]===undefined?!![]:![]:!![],'where':_0x5c6fe0[_0x212e('0x1d')]?_0x5c6fe0[_0x212e('0x1d')][_0x212e('0x1f')]||null:null,'attributes':[[db[_0x212e('0x20')]['fn'](_0x212e('0x21'),db[_0x212e('0x20')]['fn']('IF',db[_0x212e('0x20')][_0x212e('0x22')](_0x212e('0x23')))),_0x212e('0x24')]]})[_0x212e('0x11')](function(_0x31d907){logger['info'](_0x212e('0x1a'),_0x5c6fe0);logger[_0x212e('0x14')](_0x212e('0x1a'),_0x5c6fe0,JSON[_0x212e('0x16')](_0x31d907));_0xc4aa86(_0x31d907);})[_0x212e('0x19')](function(_0x5350cd){logger[_0x212e('0x17')]('GetVoiceQueueRtPauses',_0x5350cd[_0x212e('0x18')],_0x5c6fe0);_0x472bcb(_0x222502[_0x212e('0x17')](0x1f4,_0x5350cd[_0x212e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index cb17952..e424a8a 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 _0xc7a3=['remove','update','register','length','save'];(function(_0x1c2c5b,_0x3393ef){var _0x31a8ac=function(_0x5ddbf0){while(--_0x5ddbf0){_0x1c2c5b['push'](_0x1c2c5b['shift']());}};_0x31a8ac(++_0x3393ef);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x39df46,_0x3172f8){_0x39df46=_0x39df46-0x0;var _0x2c4a68=_0xc7a3[_0x39df46];return _0x2c4a68;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x3c7a('0x0'),_0x3c7a('0x1'),_0x3c7a('0x2')];function createListener(_0x12f959,_0x283aed){return function(_0x2d6d97){_0x283aed['emit'](_0x12f959,_0x2d6d97);};}function removeListener(_0x44fd47,_0x3e1c47){return function(){UserVoiceQueueRtEvents['removeListener'](_0x44fd47,_0x3e1c47);};}exports[_0x3c7a('0x3')]=function(_0x2051ce){for(var _0x2736c1=0x0,_0x48e820=events[_0x3c7a('0x4')];_0x2736c1<_0x48e820;_0x2736c1++){var _0x4f0608=events[_0x2736c1];var _0x20d36c=createListener('userVoiceQueueRt:'+_0x4f0608,_0x2051ce);UserVoiceQueueRtEvents['on'](_0x4f0608,_0x20d36c);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x814b,0x1a2));var _0xb814=function(_0x57fcc0,_0x585004){_0x57fcc0=_0x57fcc0-0x0;var _0x5270df=_0x814b[_0x57fcc0];return _0x5270df;};'use strict';var UserVoiceQueueRtEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){UserVoiceQueueRtEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);UserVoiceQueueRtEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index b2740f9..d9fd0a5 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x45c4e6,_0x39361d){var _0xfb2bcb=function(_0x3109a8){while(--_0x3109a8){_0x45c4e6['push'](_0x45c4e6['shift']());}};_0xfb2bcb(++_0x39361d);}(_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(_0xfb2489,_0x4a2ffe){var _0x1f9dda=function(_0x151fc9){while(--_0x151fc9){_0xfb2489['push'](_0xfb2489['shift']());}};_0x1f9dda(++_0x4a2ffe);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9e3ee68..19227cb 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 _0xae56=['sequelize','INTEGER'];(function(_0xc8ce1c,_0x1f7f5a){var _0x588790=function(_0x41a3ba){while(--_0x41a3ba){_0xc8ce1c['push'](_0xc8ce1c['shift']());}};_0x588790(++_0x1f7f5a);}(_0xae56,0xae));var _0x6ae5=function(_0x343087,_0x49eddb){_0x343087=_0x343087-0x0;var _0x55e2da=_0xae56[_0x343087];return _0x55e2da;};'use strict';var Sequelize=require(_0x6ae5('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6ae5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7ba5=['exports','INTEGER','sequelize'];(function(_0x47c5bd,_0x7605da){var _0x2447dc=function(_0x1d4bff){while(--_0x1d4bff){_0x47c5bd['push'](_0x47c5bd['shift']());}};_0x2447dc(++_0x7605da);}(_0x7ba5,0x185));var _0x57ba=function(_0x579d77,_0x2fcc91){_0x579d77=_0x579d77-0x0;var _0xf9b1b=_0x7ba5[_0x579d77];return _0xf9b1b;};'use strict';var Sequelize=require(_0x57ba('0x0'));module[_0x57ba('0x1')]={'penalty':{'type':Sequelize[_0x57ba('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 357456f..8e386af 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 _0x140c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./userWhatsappQueue.attributes','define','UserWhatsappQueue'];(function(_0x3211f9,_0x459035){var _0x2f4324=function(_0x446477){while(--_0x446477){_0x3211f9['push'](_0x3211f9['shift']());}};_0x2f4324(++_0x459035);}(_0x140c,0x11e));var _0xc140=function(_0x307299,_0x121719){_0x307299=_0x307299-0x0;var _0x3a4d19=_0x140c[_0x307299];return _0x3a4d19;};'use strict';var _=require(_0xc140('0x0'));var util=require(_0xc140('0x1'));var logger=require(_0xc140('0x2'))(_0xc140('0x3'));var moment=require(_0xc140('0x4'));var BPromise=require(_0xc140('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc140('0x6'));var rimraf=require(_0xc140('0x7'));var config=require('../../config/environment');var attributes=require(_0xc140('0x8'));module['exports']=function(_0x301d72,_0x3a2f5b){return _0x301d72[_0xc140('0x9')](_0xc140('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ba8=['exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x17f47a,_0x5c773a){var _0x3d9fc5=function(_0x22b885){while(--_0x22b885){_0x17f47a['push'](_0x17f47a['shift']());}};_0x3d9fc5(++_0x5c773a);}(_0x0ba8,0x159));var _0x80ba=function(_0x2a8319,_0x377fe2){_0x2a8319=_0x2a8319-0x0;var _0x185ae1=_0x0ba8[_0x2a8319];return _0x185ae1;};'use strict';var _=require(_0x80ba('0x0'));var util=require('util');var logger=require(_0x80ba('0x1'))('api');var moment=require(_0x80ba('0x2'));var BPromise=require(_0x80ba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80ba('0x4'));var rimraf=require(_0x80ba('0x5'));var config=require(_0x80ba('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0x80ba('0x7')]=function(_0x3ba256,_0x4d3555){return _0x3ba256[_0x80ba('0x8')](_0x80ba('0x9'),attributes,{'tableName':_0x80ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 59fffd3..304d0a4 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 _0xd2a1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash'];(function(_0x5dbbd8,_0x774fd1){var _0xff6f30=function(_0x1b5423){while(--_0x1b5423){_0x5dbbd8['push'](_0x5dbbd8['shift']());}};_0xff6f30(++_0x774fd1);}(_0xd2a1,0x17b));var _0x1d2a=function(_0x42f0d1,_0x45fe4a){_0x42f0d1=_0x42f0d1-0x0;var _0x43f981=_0xd2a1[_0x42f0d1];return _0x43f981;};'use strict';var _=require(_0x1d2a('0x0'));var util=require('util');var moment=require(_0x1d2a('0x1'));var BPromise=require(_0x1d2a('0x2'));var rs=require(_0x1d2a('0x3'));var fs=require('fs');var Redis=require(_0x1d2a('0x4'));var db=require(_0x1d2a('0x5'))['db'];var utils=require(_0x1d2a('0x6'));var logger=require('../../config/logger')(_0x1d2a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1d2a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f4238,_0x473d53,_0x40f6e6){return new BPromise(function(_0x210ad6,_0x314a38){return client[_0x1d2a('0x9')](_0x3f4238,_0x40f6e6)[_0x1d2a('0xa')](function(_0x1bdb83){logger['info'](_0x1d2a('0xb'),_0x473d53,_0x1d2a('0xc'));logger[_0x1d2a('0xd')](_0x1d2a('0xe'),_0x473d53,_0x1d2a('0xc'),JSON[_0x1d2a('0xf')](_0x1bdb83));if(_0x1bdb83[_0x1d2a('0x10')]){if(_0x1bdb83[_0x1d2a('0x10')]['code']===0x1f4){logger['error'](_0x1d2a('0xb'),_0x473d53,_0x1bdb83[_0x1d2a('0x10')][_0x1d2a('0x11')]);return _0x314a38(_0x1bdb83['error'][_0x1d2a('0x11')]);}logger[_0x1d2a('0x10')](_0x1d2a('0xb'),_0x473d53,_0x1bdb83['error']['message']);return _0x210ad6(_0x1bdb83['error'][_0x1d2a('0x11')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x473d53,_0x1d2a('0xc'));_0x210ad6(_0x1bdb83[_0x1d2a('0x12')][_0x1d2a('0x11')]);}})['catch'](function(_0x4c618a){logger[_0x1d2a('0x10')](_0x1d2a('0xb'),_0x473d53,_0x4c618a);_0x314a38(_0x4c618a);});});} \ No newline at end of file +var _0xeaa9=['then','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x17c8a9,_0x531ca3){var _0x379aa6=function(_0x5ba780){while(--_0x5ba780){_0x17c8a9['push'](_0x17c8a9['shift']());}};_0x379aa6(++_0x531ca3);}(_0xeaa9,0xdd));var _0x9eaa=function(_0x206225,_0x528689){_0x206225=_0x206225-0x0;var _0x2a1c21=_0xeaa9[_0x206225];return _0x2a1c21;};'use strict';var _=require(_0x9eaa('0x0'));var util=require(_0x9eaa('0x1'));var moment=require(_0x9eaa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9eaa('0x3'));var db=require(_0x9eaa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9eaa('0x5'))(_0x9eaa('0x6'));var config=require(_0x9eaa('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9eaa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d7036,_0x39cc90,_0x461352){return new BPromise(function(_0x1f9929,_0x494dbf){return client[_0x9eaa('0x9')](_0x2d7036,_0x461352)[_0x9eaa('0xa')](function(_0x60ace9){logger[_0x9eaa('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x39cc90,_0x9eaa('0xc'));logger[_0x9eaa('0xd')](_0x9eaa('0xe'),_0x39cc90,_0x9eaa('0xc'),JSON['stringify'](_0x60ace9));if(_0x60ace9[_0x9eaa('0xf')]){if(_0x60ace9[_0x9eaa('0xf')][_0x9eaa('0x10')]===0x1f4){logger[_0x9eaa('0xf')](_0x9eaa('0x11'),_0x39cc90,_0x60ace9[_0x9eaa('0xf')][_0x9eaa('0x12')]);return _0x494dbf(_0x60ace9['error']['message']);}logger['error'](_0x9eaa('0x11'),_0x39cc90,_0x60ace9[_0x9eaa('0xf')][_0x9eaa('0x12')]);return _0x1f9929(_0x60ace9[_0x9eaa('0xf')][_0x9eaa('0x12')]);}else{logger[_0x9eaa('0xb')](_0x9eaa('0x11'),_0x39cc90,'request\x20sent');_0x1f9929(_0x60ace9[_0x9eaa('0x13')][_0x9eaa('0x12')]);}})[_0x9eaa('0x14')](function(_0x1c0a2b){logger[_0x9eaa('0xf')](_0x9eaa('0x11'),_0x39cc90,_0x1c0a2b);_0x494dbf(_0x1c0a2b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index c360907..f024412 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 _0x6282=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0x6282,0x76));var _0x2628=function(_0x2cbfcc,_0x41c929){_0x2cbfcc=_0x2cbfcc-0x0;var _0x46dd12=_0x6282[_0x2cbfcc];return _0x46dd12;};'use strict';var multer=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var path=require(_0x2628('0x2'));var timeout=require(_0x2628('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2628('0x4'));var auth=require(_0x2628('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2628('0x6'));var controller=require(_0x2628('0x7'));router[_0x2628('0x8')]('/',auth[_0x2628('0x9')](),controller[_0x2628('0xa')]);router['get'](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0xc')]);router[_0x2628('0xd')]('/',auth[_0x2628('0x9')](),controller[_0x2628('0xe')]);router[_0x2628('0xf')](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0x10')]);router[_0x2628('0x11')](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0x12')]);module[_0x2628('0x13')]=router; \ No newline at end of file +var _0xbed7=['isAuthenticated','index','show','create','/:id','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get'];(function(_0xf29f71,_0x277924){var _0xf1825a=function(_0x2ef0e3){while(--_0x2ef0e3){_0xf29f71['push'](_0xf29f71['shift']());}};_0xf1825a(++_0x277924);}(_0xbed7,0x14b));var _0x7bed=function(_0x1229bd,_0x5cd775){_0x1229bd=_0x1229bd-0x0;var _0x3fd218=_0xbed7[_0x1229bd];return _0x3fd218;};'use strict';var multer=require(_0x7bed('0x0'));var util=require(_0x7bed('0x1'));var path=require(_0x7bed('0x2'));var timeout=require(_0x7bed('0x3'));var express=require(_0x7bed('0x4'));var router=express['Router']();var fs_extra=require(_0x7bed('0x5'));var auth=require(_0x7bed('0x6'));var interaction=require(_0x7bed('0x7'));var config=require(_0x7bed('0x8'));var controller=require(_0x7bed('0x9'));router[_0x7bed('0xa')]('/',auth[_0x7bed('0xb')](),controller[_0x7bed('0xc')]);router[_0x7bed('0xa')]('/:id',auth[_0x7bed('0xb')](),controller[_0x7bed('0xd')]);router['post']('/',auth[_0x7bed('0xb')](),controller[_0x7bed('0xe')]);router['put'](_0x7bed('0xf'),auth[_0x7bed('0xb')](),controller['update']);router[_0x7bed('0x10')](_0x7bed('0xf'),auth[_0x7bed('0xb')](),controller[_0x7bed('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 520fa32..3fa8c6a 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 _0x3b34=['exports','STRING','sequelize'];(function(_0x8585ff,_0x9232d){var _0x3ff111=function(_0x1c40bc){while(--_0x1c40bc){_0x8585ff['push'](_0x8585ff['shift']());}};_0x3ff111(++_0x9232d);}(_0x3b34,0xe3));var _0x43b3=function(_0x4adfcc,_0x4ef91a){_0x4adfcc=_0x4adfcc-0x0;var _0x566c4e=_0x3b34[_0x4adfcc];return _0x566c4e;};'use strict';var Sequelize=require(_0x43b3('0x0'));module[_0x43b3('0x1')]={'name':{'type':Sequelize[_0x43b3('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x43b3('0x2')]}}; \ No newline at end of file +var _0xd011=['sequelize','STRING'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xd011,0x156));var _0x1d01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd011[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1d01('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d01('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1d01('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 62396db..856c384 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 _0x4243=['nolimit','sort','where','filters','filter','merge','VIRTUAL','name','options','include','findAll','rows','show','params','fields','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','stack','map','Variable','rawAttributes','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4243,0xc0));var _0x3424=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4243[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3424('0x0'));var rimraf=require(_0x3424('0x1'));var zipdir=require(_0x3424('0x2'));var jsonpatch=require(_0x3424('0x3'));var rp=require(_0x3424('0x4'));var moment=require(_0x3424('0x5'));var BPromise=require(_0x3424('0x6'));var Mustache=require(_0x3424('0x7'));var util=require('util');var path=require(_0x3424('0x8'));var sox=require(_0x3424('0x9'));var csv=require(_0x3424('0xa'));var ejs=require(_0x3424('0xb'));var fs=require('fs');var fs_extra=require(_0x3424('0xc'));var _=require(_0x3424('0xd'));var squel=require(_0x3424('0xe'));var crypto=require(_0x3424('0xf'));var jsforce=require(_0x3424('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3424('0xa'));var querystring=require(_0x3424('0x11'));var Papa=require(_0x3424('0x12'));var Redis=require(_0x3424('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3424('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3424('0x15'));var utils=require(_0x3424('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3424('0x17'))['db'];function respondWithStatusCode(_0x44e05f,_0x30bfd5){_0x30bfd5=_0x30bfd5||0xcc;return function(_0x44095c){if(_0x44095c){return _0x44e05f[_0x3424('0x18')](_0x30bfd5);}return _0x44e05f[_0x3424('0x19')](_0x30bfd5)[_0x3424('0x1a')]();};}function respondWithResult(_0x302bf9,_0x1a6cdd){_0x1a6cdd=_0x1a6cdd||0xc8;return function(_0x35c444){if(_0x35c444){return _0x302bf9[_0x3424('0x19')](_0x1a6cdd)['json'](_0x35c444);}};}function respondWithFilteredResult(_0x182a71,_0x3e7e45){return function(_0x14dafc){if(_0x14dafc){var _0x17c23a=typeof _0x3e7e45[_0x3424('0x1b')]===_0x3424('0x1c')&&typeof _0x3e7e45[_0x3424('0x1d')]===_0x3424('0x1c');var _0x4c8441=_0x14dafc[_0x3424('0x1e')];var _0x6be7c3=_0x17c23a?0x0:_0x3e7e45[_0x3424('0x1b')];var _0xad7f5b=_0x17c23a?_0x14dafc[_0x3424('0x1e')]:_0x3e7e45['offset']+_0x3e7e45[_0x3424('0x1d')];var _0x2ddc73;if(_0xad7f5b>=_0x4c8441){_0xad7f5b=_0x4c8441;_0x2ddc73=0xc8;}else{_0x2ddc73=0xce;}_0x182a71[_0x3424('0x19')](_0x2ddc73);return _0x182a71[_0x3424('0x1f')](_0x3424('0x20'),_0x6be7c3+'-'+_0xad7f5b+'/'+_0x4c8441)[_0x3424('0x21')](_0x14dafc);}return null;};}function patchUpdates(_0x58615d){return function(_0x1757f8){try{jsonpatch[_0x3424('0x22')](_0x1757f8,_0x58615d,!![]);}catch(_0x364d1a){return BPromise[_0x3424('0x23')](_0x364d1a);}return _0x1757f8['save']();};}function saveUpdates(_0x5223a4,_0x5cd396){return function(_0x4bba3b){if(_0x4bba3b){return _0x4bba3b[_0x3424('0x24')](_0x5223a4)[_0x3424('0x25')](function(_0x522c41){return _0x522c41;});}return null;};}function removeEntity(_0x7c0e16,_0x550c11){return function(_0x202b5c){if(_0x202b5c){return _0x202b5c[_0x3424('0x26')]()['then'](function(){var _0x5431bb=_0x202b5c[_0x3424('0x27')]({'plain':!![]});var _0x34115d='Variables';return db[_0x3424('0x28')][_0x3424('0x26')]({'where':{'type':_0x34115d,'resourceId':_0x5431bb['id']}})[_0x3424('0x25')](function(){return _0x202b5c;});})[_0x3424('0x25')](function(){_0x7c0e16[_0x3424('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a2683,_0xfe7226){return function(_0x471d14){if(!_0x471d14){_0x3a2683['sendStatus'](0x194);}return _0x471d14;};}function handleError(_0x215b7a,_0x3e430f){_0x3e430f=_0x3e430f||0x1f4;return function(_0x59a8a1){logger['error'](_0x59a8a1[_0x3424('0x29')]);if(_0x59a8a1['name']){delete _0x59a8a1['name'];}_0x215b7a['status'](_0x3e430f)['send'](_0x59a8a1);};}exports['index']=function(_0x4f0a2e,_0x26cf66){var _0x3fefed={},_0x5dbe35={},_0x243e5d={'count':0x0,'rows':[]};var _0x33d1c3=_[_0x3424('0x2a')](db[_0x3424('0x2b')][_0x3424('0x2c')],function(_0x16f0da){return{'name':_0x16f0da['fieldName'],'type':_0x16f0da[_0x3424('0x2d')][_0x3424('0x2e')]};});_0x5dbe35[_0x3424('0x2f')]=_[_0x3424('0x2a')](_0x33d1c3,'name');_0x5dbe35[_0x3424('0x30')]=_[_0x3424('0x31')](_0x4f0a2e[_0x3424('0x30')]);_0x5dbe35['filters']=_['intersection'](_0x5dbe35[_0x3424('0x2f')],_0x5dbe35[_0x3424('0x30')]);_0x3fefed[_0x3424('0x32')]=_[_0x3424('0x33')](_0x5dbe35[_0x3424('0x2f')],qs['fields'](_0x4f0a2e[_0x3424('0x30')]['fields']));_0x3fefed[_0x3424('0x32')]=_0x3fefed[_0x3424('0x32')][_0x3424('0x34')]?_0x3fefed[_0x3424('0x32')]:_0x5dbe35[_0x3424('0x2f')];if(!_0x4f0a2e[_0x3424('0x30')][_0x3424('0x35')](_0x3424('0x36'))){_0x3fefed[_0x3424('0x1d')]=qs['limit'](_0x4f0a2e['query'][_0x3424('0x1d')]);_0x3fefed[_0x3424('0x1b')]=qs[_0x3424('0x1b')](_0x4f0a2e[_0x3424('0x30')]['offset']);}_0x3fefed['order']=qs[_0x3424('0x37')](_0x4f0a2e[_0x3424('0x30')]['sort']);_0x3fefed[_0x3424('0x38')]=qs[_0x3424('0x39')](_['pick'](_0x4f0a2e[_0x3424('0x30')],_0x5dbe35[_0x3424('0x39')]),_0x33d1c3);if(_0x4f0a2e[_0x3424('0x30')][_0x3424('0x3a')]){_0x3fefed['where']=_[_0x3424('0x3b')](_0x3fefed[_0x3424('0x38')],{'$or':_[_0x3424('0x2a')](_0x33d1c3,function(_0x553851){if(_0x553851[_0x3424('0x2d')]!==_0x3424('0x3c')){var _0x462751={};_0x462751[_0x553851[_0x3424('0x3d')]]={'$like':'%'+_0x4f0a2e[_0x3424('0x30')]['filter']+'%'};return _0x462751;}})});}_0x3fefed=_[_0x3424('0x3b')]({},_0x3fefed,_0x4f0a2e[_0x3424('0x3e')]);var _0x5c76a5={'where':_0x3fefed[_0x3424('0x38')]};return db['Variable'][_0x3424('0x1e')](_0x5c76a5)['then'](function(_0x199788){_0x243e5d['count']=_0x199788;if(_0x4f0a2e[_0x3424('0x30')]['includeAll']){_0x3fefed[_0x3424('0x3f')]=[{'all':!![]}];}return db['Variable'][_0x3424('0x40')](_0x3fefed);})[_0x3424('0x25')](function(_0x453139){_0x243e5d[_0x3424('0x41')]=_0x453139;return _0x243e5d;})[_0x3424('0x25')](respondWithFilteredResult(_0x26cf66,_0x3fefed))['catch'](handleError(_0x26cf66,null));};exports[_0x3424('0x42')]=function(_0x13e11d,_0x5d3626){var _0x19a9ce={'raw':!![],'where':{'id':_0x13e11d[_0x3424('0x43')]['id']}},_0x28333d={};_0x28333d[_0x3424('0x2f')]=_[_0x3424('0x31')](db[_0x3424('0x2b')][_0x3424('0x2c')]);_0x28333d[_0x3424('0x30')]=_[_0x3424('0x31')](_0x13e11d[_0x3424('0x30')]);_0x28333d[_0x3424('0x39')]=_[_0x3424('0x33')](_0x28333d[_0x3424('0x2f')],_0x28333d['query']);_0x19a9ce['attributes']=_[_0x3424('0x33')](_0x28333d[_0x3424('0x2f')],qs[_0x3424('0x44')](_0x13e11d[_0x3424('0x30')][_0x3424('0x44')]));_0x19a9ce[_0x3424('0x32')]=_0x19a9ce[_0x3424('0x32')][_0x3424('0x34')]?_0x19a9ce[_0x3424('0x32')]:_0x28333d['model'];if(_0x13e11d['query'][_0x3424('0x45')]){_0x19a9ce[_0x3424('0x3f')]=[{'all':!![]}];}_0x19a9ce=_[_0x3424('0x3b')]({},_0x19a9ce,_0x13e11d['options']);return db[_0x3424('0x2b')][_0x3424('0x46')](_0x19a9ce)[_0x3424('0x25')](handleEntityNotFound(_0x5d3626,null))[_0x3424('0x25')](respondWithResult(_0x5d3626,null))[_0x3424('0x47')](handleError(_0x5d3626,null));};exports[_0x3424('0x48')]=function(_0x335e1c,_0x4e4dc4){return db[_0x3424('0x2b')][_0x3424('0x48')](_0x335e1c[_0x3424('0x49')],{})[_0x3424('0x25')](function(_0xcea6e){var _0x5b16b1=_0x335e1c[_0x3424('0x4a')][_0x3424('0x27')]({'plain':!![]});if(!_0x5b16b1)throw new Error(_0x3424('0x4b'));if(_0x5b16b1[_0x3424('0x4c')]===_0x3424('0x4a')){var _0x444d1d=_0xcea6e[_0x3424('0x27')]({'plain':!![]});var _0xcced2=_0x3424('0x4d');return db[_0x3424('0x4e')][_0x3424('0x46')]({'where':{'name':_0xcced2,'userProfileId':_0x5b16b1[_0x3424('0x4f')]},'raw':!![]})[_0x3424('0x25')](function(_0x56175e){if(_0x56175e&&_0x56175e[_0x3424('0x50')]===0x0){return db[_0x3424('0x28')][_0x3424('0x48')]({'name':_0x444d1d[_0x3424('0x3d')],'resourceId':_0x444d1d['id'],'type':_0x56175e['name'],'sectionId':_0x56175e['id']},{})['then'](function(){return _0xcea6e;});}else{return _0xcea6e;}})['catch'](function(_0x1bb093){logger[_0x3424('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bb093);throw _0x1bb093;});}return _0xcea6e;})[_0x3424('0x25')](respondWithResult(_0x4e4dc4,0xc9))[_0x3424('0x47')](handleError(_0x4e4dc4,null));};exports[_0x3424('0x24')]=function(_0xd41dc3,_0x182f3e){if(_0xd41dc3[_0x3424('0x49')]['id']){delete _0xd41dc3['body']['id'];}return db[_0x3424('0x2b')]['find']({'where':{'id':_0xd41dc3['params']['id']}})[_0x3424('0x25')](handleEntityNotFound(_0x182f3e,null))['then'](saveUpdates(_0xd41dc3[_0x3424('0x49')],null))['then'](respondWithResult(_0x182f3e,null))[_0x3424('0x47')](handleError(_0x182f3e,null));};exports[_0x3424('0x26')]=function(_0x1234de,_0x3bc344){return db['Variable'][_0x3424('0x46')]({'where':{'id':_0x1234de[_0x3424('0x43')]['id']}})[_0x3424('0x25')](handleEntityNotFound(_0x3bc344,null))[_0x3424('0x25')](removeEntity(_0x3bc344,null))[_0x3424('0x47')](handleError(_0x3bc344,null));}; \ No newline at end of file +var _0x3269=['error','name','send','index','map','Variable','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','keys','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end'];(function(_0x3bb5b4,_0x128455){var _0x586c60=function(_0x179226){while(--_0x179226){_0x3bb5b4['push'](_0x3bb5b4['shift']());}};_0x586c60(++_0x128455);}(_0x3269,0x1c6));var _0x9326=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3269[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9326('0x0'));var rimraf=require(_0x9326('0x1'));var zipdir=require(_0x9326('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9326('0x3'));var moment=require(_0x9326('0x4'));var BPromise=require(_0x9326('0x5'));var Mustache=require(_0x9326('0x6'));var util=require(_0x9326('0x7'));var path=require(_0x9326('0x8'));var sox=require(_0x9326('0x9'));var csv=require(_0x9326('0xa'));var ejs=require(_0x9326('0xb'));var fs=require('fs');var fs_extra=require(_0x9326('0xc'));var _=require(_0x9326('0xd'));var squel=require('squel');var crypto=require(_0x9326('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9326('0xf'));var toCsv=require(_0x9326('0xa'));var querystring=require(_0x9326('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9326('0x11'));var qs=require(_0x9326('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9326('0x13'));var logger=require(_0x9326('0x14'))(_0x9326('0x15'));var utils=require('../../config/utils');var config=require(_0x9326('0x16'));var licenseUtil=require(_0x9326('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fd5fe,_0x53a3eb){_0x53a3eb=_0x53a3eb||0xcc;return function(_0x129080){if(_0x129080){return _0x3fd5fe[_0x9326('0x18')](_0x53a3eb);}return _0x3fd5fe[_0x9326('0x19')](_0x53a3eb)['end']();};}function respondWithResult(_0x2230a5,_0x298134){_0x298134=_0x298134||0xc8;return function(_0xdfaac1){if(_0xdfaac1){return _0x2230a5['status'](_0x298134)[_0x9326('0x1a')](_0xdfaac1);}};}function respondWithFilteredResult(_0x53cb3b,_0x33e869){return function(_0x2da4ef){if(_0x2da4ef){var _0x5b6dbd=typeof _0x33e869[_0x9326('0x1b')]===_0x9326('0x1c')&&typeof _0x33e869[_0x9326('0x1d')]===_0x9326('0x1c');var _0xee2a8c=_0x2da4ef[_0x9326('0x1e')];var _0x341adc=_0x5b6dbd?0x0:_0x33e869[_0x9326('0x1b')];var _0x14b08f=_0x5b6dbd?_0x2da4ef[_0x9326('0x1e')]:_0x33e869[_0x9326('0x1b')]+_0x33e869[_0x9326('0x1d')];var _0x508982;if(_0x14b08f>=_0xee2a8c){_0x14b08f=_0xee2a8c;_0x508982=0xc8;}else{_0x508982=0xce;}_0x53cb3b[_0x9326('0x19')](_0x508982);return _0x53cb3b[_0x9326('0x1f')](_0x9326('0x20'),_0x341adc+'-'+_0x14b08f+'/'+_0xee2a8c)[_0x9326('0x1a')](_0x2da4ef);}return null;};}function patchUpdates(_0x122666){return function(_0x26fe14){try{jsonpatch['apply'](_0x26fe14,_0x122666,!![]);}catch(_0x42d785){return BPromise[_0x9326('0x21')](_0x42d785);}return _0x26fe14['save']();};}function saveUpdates(_0x421b45,_0x4c5ec5){return function(_0x17e82f){if(_0x17e82f){return _0x17e82f[_0x9326('0x22')](_0x421b45)[_0x9326('0x23')](function(_0x2e0746){return _0x2e0746;});}return null;};}function removeEntity(_0x2619fd,_0x628547){return function(_0x15e52d){if(_0x15e52d){return _0x15e52d['destroy']()[_0x9326('0x23')](function(){var _0x22c569=_0x15e52d['get']({'plain':!![]});var _0x7fd179='Variables';return db['UserProfileResource'][_0x9326('0x24')]({'where':{'type':_0x7fd179,'resourceId':_0x22c569['id']}})[_0x9326('0x23')](function(){return _0x15e52d;});})[_0x9326('0x23')](function(){_0x2619fd['status'](0xcc)[_0x9326('0x25')]();});}};}function handleEntityNotFound(_0x4f803a,_0x31ee23){return function(_0x3b9bab){if(!_0x3b9bab){_0x4f803a[_0x9326('0x18')](0x194);}return _0x3b9bab;};}function handleError(_0x4e0177,_0x1917d6){_0x1917d6=_0x1917d6||0x1f4;return function(_0x42c433){logger[_0x9326('0x26')](_0x42c433['stack']);if(_0x42c433[_0x9326('0x27')]){delete _0x42c433[_0x9326('0x27')];}_0x4e0177['status'](_0x1917d6)[_0x9326('0x28')](_0x42c433);};}exports[_0x9326('0x29')]=function(_0x283ea2,_0x38f0e0){var _0x52bfa9={},_0x599228={},_0x42810a={'count':0x0,'rows':[]};var _0x2b1118=_[_0x9326('0x2a')](db[_0x9326('0x2b')]['rawAttributes'],function(_0x52d386){return{'name':_0x52d386[_0x9326('0x2c')],'type':_0x52d386[_0x9326('0x2d')][_0x9326('0x2e')]};});_0x599228[_0x9326('0x2f')]=_[_0x9326('0x2a')](_0x2b1118,_0x9326('0x27'));_0x599228[_0x9326('0x30')]=_['keys'](_0x283ea2['query']);_0x599228[_0x9326('0x31')]=_[_0x9326('0x32')](_0x599228[_0x9326('0x2f')],_0x599228[_0x9326('0x30')]);_0x52bfa9[_0x9326('0x33')]=_['intersection'](_0x599228['model'],qs[_0x9326('0x34')](_0x283ea2[_0x9326('0x30')][_0x9326('0x34')]));_0x52bfa9[_0x9326('0x33')]=_0x52bfa9[_0x9326('0x33')]['length']?_0x52bfa9[_0x9326('0x33')]:_0x599228['model'];if(!_0x283ea2['query'][_0x9326('0x35')](_0x9326('0x36'))){_0x52bfa9[_0x9326('0x1d')]=qs[_0x9326('0x1d')](_0x283ea2[_0x9326('0x30')][_0x9326('0x1d')]);_0x52bfa9['offset']=qs['offset'](_0x283ea2[_0x9326('0x30')][_0x9326('0x1b')]);}_0x52bfa9[_0x9326('0x37')]=qs[_0x9326('0x38')](_0x283ea2[_0x9326('0x30')][_0x9326('0x38')]);_0x52bfa9[_0x9326('0x39')]=qs[_0x9326('0x31')](_[_0x9326('0x3a')](_0x283ea2[_0x9326('0x30')],_0x599228[_0x9326('0x31')]),_0x2b1118);if(_0x283ea2[_0x9326('0x30')][_0x9326('0x3b')]){_0x52bfa9[_0x9326('0x39')]=_[_0x9326('0x3c')](_0x52bfa9[_0x9326('0x39')],{'$or':_[_0x9326('0x2a')](_0x2b1118,function(_0x502c23){if(_0x502c23[_0x9326('0x2d')]!==_0x9326('0x3d')){var _0x5bd60d={};_0x5bd60d[_0x502c23['name']]={'$like':'%'+_0x283ea2[_0x9326('0x30')][_0x9326('0x3b')]+'%'};return _0x5bd60d;}})});}_0x52bfa9=_[_0x9326('0x3c')]({},_0x52bfa9,_0x283ea2[_0x9326('0x3e')]);var _0x5482a9={'where':_0x52bfa9[_0x9326('0x39')]};return db[_0x9326('0x2b')][_0x9326('0x1e')](_0x5482a9)[_0x9326('0x23')](function(_0x5c8dbf){_0x42810a[_0x9326('0x1e')]=_0x5c8dbf;if(_0x283ea2[_0x9326('0x30')]['includeAll']){_0x52bfa9['include']=[{'all':!![]}];}return db['Variable'][_0x9326('0x3f')](_0x52bfa9);})['then'](function(_0x14817a){_0x42810a[_0x9326('0x40')]=_0x14817a;return _0x42810a;})[_0x9326('0x23')](respondWithFilteredResult(_0x38f0e0,_0x52bfa9))[_0x9326('0x41')](handleError(_0x38f0e0,null));};exports[_0x9326('0x42')]=function(_0x2d58c0,_0xe2112d){var _0xface38={'raw':!![],'where':{'id':_0x2d58c0[_0x9326('0x43')]['id']}},_0x2562cf={};_0x2562cf[_0x9326('0x2f')]=_['keys'](db['Variable'][_0x9326('0x44')]);_0x2562cf[_0x9326('0x30')]=_[_0x9326('0x45')](_0x2d58c0[_0x9326('0x30')]);_0x2562cf[_0x9326('0x31')]=_[_0x9326('0x32')](_0x2562cf[_0x9326('0x2f')],_0x2562cf[_0x9326('0x30')]);_0xface38['attributes']=_[_0x9326('0x32')](_0x2562cf['model'],qs[_0x9326('0x34')](_0x2d58c0[_0x9326('0x30')][_0x9326('0x34')]));_0xface38['attributes']=_0xface38['attributes']['length']?_0xface38[_0x9326('0x33')]:_0x2562cf['model'];if(_0x2d58c0[_0x9326('0x30')]['includeAll']){_0xface38[_0x9326('0x46')]=[{'all':!![]}];}_0xface38=_[_0x9326('0x3c')]({},_0xface38,_0x2d58c0[_0x9326('0x3e')]);return db[_0x9326('0x2b')][_0x9326('0x47')](_0xface38)[_0x9326('0x23')](handleEntityNotFound(_0xe2112d,null))['then'](respondWithResult(_0xe2112d,null))[_0x9326('0x41')](handleError(_0xe2112d,null));};exports[_0x9326('0x48')]=function(_0x671c46,_0x2fc13d){return db[_0x9326('0x2b')][_0x9326('0x48')](_0x671c46[_0x9326('0x49')],{})[_0x9326('0x23')](function(_0x36f8a5){var _0x48cf77=_0x671c46[_0x9326('0x4a')][_0x9326('0x4b')]({'plain':!![]});if(!_0x48cf77)throw new Error(_0x9326('0x4c'));if(_0x48cf77[_0x9326('0x4d')]===_0x9326('0x4a')){var _0x1e4cd8=_0x36f8a5[_0x9326('0x4b')]({'plain':!![]});var _0x4a6200='Variables';return db[_0x9326('0x4e')]['find']({'where':{'name':_0x4a6200,'userProfileId':_0x48cf77[_0x9326('0x4f')]},'raw':!![]})[_0x9326('0x23')](function(_0x5e09a7){if(_0x5e09a7&&_0x5e09a7[_0x9326('0x50')]===0x0){return db['UserProfileResource'][_0x9326('0x48')]({'name':_0x1e4cd8[_0x9326('0x27')],'resourceId':_0x1e4cd8['id'],'type':_0x5e09a7[_0x9326('0x27')],'sectionId':_0x5e09a7['id']},{})['then'](function(){return _0x36f8a5;});}else{return _0x36f8a5;}})['catch'](function(_0x1c1659){logger[_0x9326('0x26')](_0x9326('0x51'),_0x1c1659);throw _0x1c1659;});}return _0x36f8a5;})[_0x9326('0x23')](respondWithResult(_0x2fc13d,0xc9))[_0x9326('0x41')](handleError(_0x2fc13d,null));};exports[_0x9326('0x22')]=function(_0x458e86,_0x75f900){if(_0x458e86['body']['id']){delete _0x458e86[_0x9326('0x49')]['id'];}return db[_0x9326('0x2b')][_0x9326('0x47')]({'where':{'id':_0x458e86[_0x9326('0x43')]['id']}})['then'](handleEntityNotFound(_0x75f900,null))[_0x9326('0x23')](saveUpdates(_0x458e86[_0x9326('0x49')],null))[_0x9326('0x23')](respondWithResult(_0x75f900,null))['catch'](handleError(_0x75f900,null));};exports[_0x9326('0x24')]=function(_0x1a22f7,_0x2514a8){return db[_0x9326('0x2b')][_0x9326('0x47')]({'where':{'id':_0x1a22f7['params']['id']}})['then'](handleEntityNotFound(_0x2514a8,null))[_0x9326('0x23')](removeEntity(_0x2514a8,null))[_0x9326('0x41')](handleError(_0x2514a8,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c338495..c281ea8 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 _0x2d02=['request-promise','rimraf','./variable.attributes','define','lodash','util','moment'];(function(_0x4f0645,_0x3e8a67){var _0x2fe8fc=function(_0x25495f){while(--_0x25495f){_0x4f0645['push'](_0x4f0645['shift']());}};_0x2fe8fc(++_0x3e8a67);}(_0x2d02,0x185));var _0x22d0=function(_0x63d730,_0x9a063b){_0x63d730=_0x63d730-0x0;var _0x1949bc=_0x2d02[_0x63d730];return _0x1949bc;};'use strict';var _=require(_0x22d0('0x0'));var util=require(_0x22d0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x22d0('0x2'));var BPromise=require('bluebird');var rp=require(_0x22d0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22d0('0x4'));var config=require('../../config/environment');var attributes=require(_0x22d0('0x5'));module['exports']=function(_0x42de72,_0x17944f){return _0x42de72[_0x22d0('0x6')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84af=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./variable.attributes','exports','define','tools_variables','lodash'];(function(_0x12f614,_0x3d7d91){var _0x3f449e=function(_0x54b58b){while(--_0x54b58b){_0x12f614['push'](_0x12f614['shift']());}};_0x3f449e(++_0x3d7d91);}(_0x84af,0x1e3));var _0xf84a=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x84af[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xf84a('0x0'));var util=require(_0xf84a('0x1'));var logger=require(_0xf84a('0x2'))('api');var moment=require(_0xf84a('0x3'));var BPromise=require(_0xf84a('0x4'));var rp=require(_0xf84a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf84a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf84a('0x7'));module[_0xf84a('0x8')]=function(_0xea5994,_0x24ef4a){return _0xea5994[_0xf84a('0x9')]('Variable',attributes,{'tableName':_0xf84a('0xa'),'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 163dffa..70706aa 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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x3cf053,_0x7a9947){var _0x3b55a0=function(_0x2a99cc){while(--_0x2a99cc){_0x3cf053['push'](_0x3cf053['shift']());}};_0x3b55a0(++_0x7a9947);}(_0x55ca,0x126));var _0xa55c=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0x55ca[_0x1b8e60];return _0x363363;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x5f03f4,_0x71be0){var _0x3a4d47=function(_0x48830b){while(--_0x48830b){_0x5f03f4['push'](_0x5f03f4['shift']());}};_0x3a4d47(++_0x71be0);}(_0x6aa7,0x178));var _0x76aa=function(_0x1fe732,_0x2b1865){_0x1fe732=_0x1fe732-0x0;var _0xd7d13f=_0x6aa7[_0x1fe732];return _0xd7d13f;};'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);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 06c32a5..01eedfa 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 _0x8af6=['express','Router','./version.controller','get','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','migrations'];(function(_0x315745,_0x781b66){var _0x3ff34d=function(_0xee9c17){while(--_0xee9c17){_0x315745['push'](_0x315745['shift']());}};_0x3ff34d(++_0x781b66);}(_0x8af6,0x150));var _0x68af=function(_0x23cf87,_0x54c773){_0x23cf87=_0x23cf87-0x0;var _0xf27a30=_0x8af6[_0x23cf87];return _0xf27a30;};'use strict';var express=require(_0x68af('0x0'));var router=express[_0x68af('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x68af('0x2'));router[_0x68af('0x3')]('/',controller['index']);router[_0x68af('0x3')]('/fetch',auth[_0x68af('0x4')](),auth[_0x68af('0x5')](),controller[_0x68af('0x6')]);router[_0x68af('0x3')](_0x68af('0x7'),auth['isAuthenticated'](),auth[_0x68af('0x5')](),controller[_0x68af('0x8')]);router[_0x68af('0x3')](_0x68af('0x9'),auth[_0x68af('0x4')](),auth[_0x68af('0x5')](),controller[_0x68af('0xa')]);router['get'](_0x68af('0xb'),auth[_0x68af('0x4')](),controller[_0x68af('0xc')]);router[_0x68af('0x3')]('/migrations',controller[_0x68af('0xd')]);module['exports']=router; \ No newline at end of file +var _0xf065=['/reset','isAuthenticated','/pull','pull','restart','migrations','exports','express','../../components/auth/service','./version.controller','get','canUpdate','fetch'];(function(_0x54b1f7,_0x4d9d09){var _0x4b9391=function(_0x29518a){while(--_0x29518a){_0x54b1f7['push'](_0x54b1f7['shift']());}};_0x4b9391(++_0x4d9d09);}(_0xf065,0x18d));var _0x5f06=function(_0x48774f,_0x3fd771){_0x48774f=_0x48774f-0x0;var _0x4d5ef2=_0xf065[_0x48774f];return _0x4d5ef2;};'use strict';var express=require(_0x5f06('0x0'));var router=express['Router']();var auth=require(_0x5f06('0x1'));var controller=require(_0x5f06('0x2'));router[_0x5f06('0x3')]('/',controller['index']);router['get']('/fetch',auth['isAuthenticated'](),auth[_0x5f06('0x4')](),controller[_0x5f06('0x5')]);router['get'](_0x5f06('0x6'),auth[_0x5f06('0x7')](),auth[_0x5f06('0x4')](),controller['reset']);router['get'](_0x5f06('0x8'),auth[_0x5f06('0x7')](),auth[_0x5f06('0x4')](),controller[_0x5f06('0x9')]);router['get']('/restart',auth[_0x5f06('0x7')](),controller[_0x5f06('0xa')]);router[_0x5f06('0x3')]('/migrations',controller[_0x5f06('0xb')]);module[_0x5f06('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 4d8f81a..d701d9d 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 _0x9dd7=['readdirSync','server','length','replace','push','sort','sequelize','Migration','getQueryInterface','constructor','join','map','.js','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','version','compare-versions','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','latest','fetch','tags','exports','2.0.0','status','json','error','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations'];(function(_0x1ebd56,_0x558f17){var _0x59eded=function(_0x212210){while(--_0x212210){_0x1ebd56['push'](_0x1ebd56['shift']());}};_0x59eded(++_0x558f17);}(_0x9dd7,0x106));var _0x79dd=function(_0x22dcb2,_0x346f29){_0x22dcb2=_0x22dcb2-0x0;var _0x19cd59=_0x9dd7[_0x22dcb2];return _0x19cd59;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x79dd('0x0'));var pkginfo=require('pkginfo')(module,_0x79dd('0x1'));var compareVersions=require(_0x79dd('0x2'));var exec=require('child_process')[_0x79dd('0x3')];var db=require('../../mysqldb')['db'];var config=require(_0x79dd('0x4'));var pm2=require(_0x79dd('0x5'));var logger=require(_0x79dd('0x6'))(_0x79dd('0x7'));var git=require(_0x79dd('0x8'))(config[_0x79dd('0x9')]);exports[_0x79dd('0xa')]=function(_0x45abb6,_0x26780c){var _0x53b62a={'current':module['exports']['version'],'phonebar':0x2};if(_0x45abb6['query']&&_0x45abb6['query'][_0x79dd('0xb')]){return git[_0x79dd('0xc')]()[_0x79dd('0xd')](function(_0x40596d,_0x4dc80b){_0x53b62a[_0x79dd('0xb')]=(_0x40596d?module[_0x79dd('0xe')][_0x79dd('0x1')]:_0x4dc80b[_0x79dd('0xb')])||_0x79dd('0xf');return _0x26780c[_0x79dd('0x10')](0xc8)['json'](_0x53b62a);});}else{return _0x26780c[_0x79dd('0x10')](0xc8)[_0x79dd('0x11')](_0x53b62a);}};exports[_0x79dd('0xc')]=function(_0x3b79b4,_0x547f62){return git[_0x79dd('0xc')](['origin','master'],function(_0x2705e4){if(_0x2705e4){logger[_0x79dd('0x12')](_0x2705e4);return _0x547f62[_0x79dd('0x10')](0x1f4)[_0x79dd('0x11')](_0x2705e4);}logger['info']('git\x20fetch');return _0x547f62[_0x79dd('0x10')](0xc8)['json']({'output':_0x79dd('0x13')});});};exports['reset']=function(_0x58a7fe,_0x23b6bb){return git[_0x79dd('0x14')]([_0x79dd('0x15'),_0x79dd('0x16')],function(_0x48b664){if(_0x48b664){logger[_0x79dd('0x12')](_0x48b664);return _0x23b6bb[_0x79dd('0x10')](0x1f4)[_0x79dd('0x11')](_0x48b664);}logger[_0x79dd('0x17')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x23b6bb['status'](0xc8)['json']({'output':_0x79dd('0x18')});});};exports['pull']=function(_0x2b262c,_0x5c2684){exec(_0x79dd('0x19'),function(_0x4a8ec1,_0x52945d,_0x26a0a9){logger['info'](_0x52945d);logger[_0x79dd('0x17')](_0x26a0a9);if(_0x4a8ec1){logger[_0x79dd('0x12')](_0x4a8ec1);return _0x5c2684[_0x79dd('0x10')](0x1f4)[_0x79dd('0x11')](_0x4a8ec1);}return _0x5c2684[_0x79dd('0x10')](0xc8)[_0x79dd('0x11')]({'output':_0x52945d});});};exports['restart']=function(_0x284353,_0x448166){return pm2[_0x79dd('0x1a')](_0x79dd('0x1b'))['then'](function(_0xe94494){logger[_0x79dd('0x17')](_0x79dd('0x1c'),_0xe94494);return _0x448166[_0x79dd('0x10')](0xc8)[_0x79dd('0x11')]({'output':_0x79dd('0x1d')});})[_0x79dd('0x1e')](function(_0x35e7ef){logger[_0x79dd('0x12')](_0x35e7ef);return _0x448166[_0x79dd('0x10')](0x1f4)[_0x79dd('0x11')](_0x35e7ef);});};exports[_0x79dd('0x1f')]=function(_0x126660,_0x48452f){var _0x4acaa7=fs[_0x79dd('0x20')](path['join'](config[_0x79dd('0x9')],_0x79dd('0x21'),_0x79dd('0x1f')));var _0x5dc8e9=[];for(var _0x5e1645=0x0;_0x5e1645<_0x4acaa7[_0x79dd('0x22')];_0x5e1645++){var _0x25f9d5=_0x4acaa7[_0x5e1645][_0x79dd('0x23')]('.js','');if(compareVersions(module[_0x79dd('0xe')][_0x79dd('0x1')],_0x25f9d5)===-0x1){_0x5dc8e9[_0x79dd('0x24')](_0x25f9d5);}}if(_0x5dc8e9[_0x79dd('0x22')]){var _0x9a2ea6=_0x5dc8e9[_0x79dd('0x25')](compareVersions);var _0x478b74=new Umzug({'storage':_0x79dd('0x26'),'storageOptions':{'model':db[_0x79dd('0x27')],'modelName':_0x79dd('0x27'),'columnName':_0x79dd('0x1')},'migrations':{'params':[db[_0x79dd('0x26')][_0x79dd('0x28')](),db[_0x79dd('0x26')][_0x79dd('0x29')],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[_0x79dd('0x2a')](config[_0x79dd('0x9')],'server',_0x79dd('0x1f')),'pattern':/\.js$/}});_0x478b74['up']({'migrations':_[_0x79dd('0x2b')](_0x9a2ea6,function(_0x5e37a7){return _0x5e37a7+_0x79dd('0x2c');})})['then'](function(){return _0x48452f[_0x79dd('0x10')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x79dd('0xe')]['version']+_0x79dd('0x2d')+_[_0x79dd('0x2e')](_0x9a2ea6),'migrations':_[_0x79dd('0x2a')](_0x9a2ea6)});})[_0x79dd('0x1e')](function(_0x3269ec){if(_0x3269ec instanceof db['sequelize'][_0x79dd('0x2f')]){return _0x48452f['status'](0xc8)[_0x79dd('0x11')]({'output':_0x79dd('0x30')});}else{return _0x48452f['status'](0x1f4)[_0x79dd('0x11')](_0x3269ec);}});}else{return _0x48452f['status'](0xc8)[_0x79dd('0x11')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x0b99=['FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','sort','Migration','sequelize','constructor','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','version','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','fetch','tags','latest','2.0.0','status','json','error','info','git\x20fetch','reset','--hard'];(function(_0x2fc30a,_0x349fbd){var _0x5cad21=function(_0xbca2f7){while(--_0xbca2f7){_0x2fc30a['push'](_0x2fc30a['shift']());}};_0x5cad21(++_0x349fbd);}(_0x0b99,0xde));var _0x90b9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0b99[_0x14add3];return _0x4a174f;};'use strict';var Umzug=require(_0x90b9('0x0'));var path=require(_0x90b9('0x1'));var fs=require('fs');var _=require(_0x90b9('0x2'));var pkginfo=require('pkginfo')(module,_0x90b9('0x3'));var compareVersions=require('compare-versions');var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x90b9('0x4'));var pm2=require(_0x90b9('0x5'));var logger=require(_0x90b9('0x6'))(_0x90b9('0x7'));var git=require(_0x90b9('0x8'))(config['root']);exports[_0x90b9('0x9')]=function(_0x1280c9,_0x308c33){var _0x12957d={'current':module[_0x90b9('0xa')][_0x90b9('0x3')],'phonebar':0x2};if(_0x1280c9[_0x90b9('0xb')]&&_0x1280c9[_0x90b9('0xb')]['latest']){return git[_0x90b9('0xc')]()[_0x90b9('0xd')](function(_0x2532a5,_0x1fc76c){_0x12957d['latest']=(_0x2532a5?module[_0x90b9('0xa')][_0x90b9('0x3')]:_0x1fc76c[_0x90b9('0xe')])||_0x90b9('0xf');return _0x308c33[_0x90b9('0x10')](0xc8)['json'](_0x12957d);});}else{return _0x308c33['status'](0xc8)[_0x90b9('0x11')](_0x12957d);}};exports[_0x90b9('0xc')]=function(_0x33edb6,_0x1fa0a4){return git[_0x90b9('0xc')](['origin','master'],function(_0xaca3a1){if(_0xaca3a1){logger[_0x90b9('0x12')](_0xaca3a1);return _0x1fa0a4[_0x90b9('0x10')](0x1f4)[_0x90b9('0x11')](_0xaca3a1);}logger[_0x90b9('0x13')](_0x90b9('0x14'));return _0x1fa0a4[_0x90b9('0x10')](0xc8)[_0x90b9('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x90b9('0x15')]=function(_0x54b39d,_0x396da0){return git['reset']([_0x90b9('0x16'),_0x90b9('0x17')],function(_0x168aea){if(_0x168aea){logger[_0x90b9('0x12')](_0x168aea);return _0x396da0['status'](0x1f4)['json'](_0x168aea);}logger[_0x90b9('0x13')](_0x90b9('0x18'));return _0x396da0['status'](0xc8)[_0x90b9('0x11')]({'output':_0x90b9('0x19')});});};exports[_0x90b9('0x1a')]=function(_0xa771e7,_0x2107b9){exec(_0x90b9('0x1b'),function(_0x220998,_0x942903,_0x1c8f80){logger[_0x90b9('0x13')](_0x942903);logger[_0x90b9('0x13')](_0x1c8f80);if(_0x220998){logger[_0x90b9('0x12')](_0x220998);return _0x2107b9['status'](0x1f4)['json'](_0x220998);}return _0x2107b9[_0x90b9('0x10')](0xc8)['json']({'output':_0x942903});});};exports[_0x90b9('0x1c')]=function(_0x4a0ef6,_0x46f07a){return pm2['restart']('motion2')[_0x90b9('0x1d')](function(_0x1e45ff){logger['info'](_0x90b9('0x1e'),_0x1e45ff);return _0x46f07a[_0x90b9('0x10')](0xc8)[_0x90b9('0x11')]({'output':_0x90b9('0x1f')});})[_0x90b9('0x20')](function(_0x299af4){logger[_0x90b9('0x12')](_0x299af4);return _0x46f07a[_0x90b9('0x10')](0x1f4)[_0x90b9('0x11')](_0x299af4);});};exports[_0x90b9('0x21')]=function(_0x149696,_0x33a733){var _0x184093=fs[_0x90b9('0x22')](path[_0x90b9('0x23')](config[_0x90b9('0x24')],_0x90b9('0x25'),_0x90b9('0x21')));var _0x304434=[];for(var _0x405033=0x0;_0x405033<_0x184093[_0x90b9('0x26')];_0x405033++){var _0x5250b5=_0x184093[_0x405033]['replace']('.js','');if(compareVersions(module[_0x90b9('0xa')][_0x90b9('0x3')],_0x5250b5)===-0x1){_0x304434['push'](_0x5250b5);}}if(_0x304434[_0x90b9('0x26')]){var _0x18e997=_0x304434[_0x90b9('0x27')](compareVersions);var _0x245e37=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x90b9('0x28')],'modelName':_0x90b9('0x28'),'columnName':_0x90b9('0x3')},'migrations':{'params':[db[_0x90b9('0x29')]['getQueryInterface'](),db['sequelize'][_0x90b9('0x2a')],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[_0x90b9('0x23')](config[_0x90b9('0x24')],_0x90b9('0x25'),_0x90b9('0x21')),'pattern':/\.js$/}});_0x245e37['up']({'migrations':_[_0x90b9('0x2b')](_0x18e997,function(_0x243569){return _0x243569+_0x90b9('0x2c');})})[_0x90b9('0x1d')](function(){return _0x33a733[_0x90b9('0x10')](0xc8)[_0x90b9('0x11')]({'output':_0x90b9('0x2d')+module[_0x90b9('0xa')][_0x90b9('0x3')]+_0x90b9('0x2e')+_[_0x90b9('0x2f')](_0x18e997),'migrations':_[_0x90b9('0x23')](_0x18e997)});})[_0x90b9('0x20')](function(_0x1a4dda){if(_0x1a4dda instanceof db[_0x90b9('0x29')]['UniqueConstraintError']){return _0x33a733['status'](0xc8)[_0x90b9('0x11')]({'output':_0x90b9('0x30')});}else{return _0x33a733['status'](0x1f4)[_0x90b9('0x11')](_0x1a4dda);}});}else{return _0x33a733['status'](0xc8)['json']({'output':_0x90b9('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index f09c761..7e8e065 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 _0xcfaf=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','post','put','update','/:id','destroy'];(function(_0x363519,_0x4eab3b){var _0x5cb059=function(_0x4bfd93){while(--_0x4bfd93){_0x363519['push'](_0x363519['shift']());}};_0x5cb059(++_0x4eab3b);}(_0xcfaf,0x10b));var _0xfcfa=function(_0x7ba5d4,_0x299db0){_0x7ba5d4=_0x7ba5d4-0x0;var _0xac36eb=_0xcfaf[_0x7ba5d4];return _0xac36eb;};'use strict';var multer=require(_0xfcfa('0x0'));var util=require(_0xfcfa('0x1'));var path=require(_0xfcfa('0x2'));var timeout=require(_0xfcfa('0x3'));var express=require(_0xfcfa('0x4'));var router=express['Router']();var fs_extra=require(_0xfcfa('0x5'));var auth=require(_0xfcfa('0x6'));var interaction=require(_0xfcfa('0x7'));var config=require(_0xfcfa('0x8'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0xfcfa('0x9')](),controller[_0xfcfa('0xa')]);router[_0xfcfa('0xb')]('/describe',auth[_0xfcfa('0x9')](),controller[_0xfcfa('0xc')]);router[_0xfcfa('0xb')]('/:id',auth[_0xfcfa('0x9')](),controller['show']);router[_0xfcfa('0xd')]('/',auth[_0xfcfa('0x9')](),controller['create']);router[_0xfcfa('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xfcfa('0xf')]);router['delete'](_0xfcfa('0x10'),auth[_0xfcfa('0x9')](),controller[_0xfcfa('0x11')]);module[_0xfcfa('0x12')]=router; \ No newline at end of file +var _0xfdc9=['../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','update','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4afc5c,_0x584159){var _0x436888=function(_0x25e994){while(--_0x25e994){_0x4afc5c['push'](_0x4afc5c['shift']());}};_0x436888(++_0x584159);}(_0xfdc9,0xe9));var _0x9fdc=function(_0x25e8e2,_0x4fb8fd){_0x25e8e2=_0x25e8e2-0x0;var _0x22107d=_0xfdc9[_0x25e8e2];return _0x22107d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9fdc('0x0'));var timeout=require(_0x9fdc('0x1'));var express=require('express');var router=express[_0x9fdc('0x2')]();var fs_extra=require(_0x9fdc('0x3'));var auth=require(_0x9fdc('0x4'));var interaction=require(_0x9fdc('0x5'));var config=require(_0x9fdc('0x6'));var controller=require(_0x9fdc('0x7'));router[_0x9fdc('0x8')]('/',auth['isAuthenticated'](),controller[_0x9fdc('0x9')]);router['get'](_0x9fdc('0xa'),auth[_0x9fdc('0xb')](),controller['describe']);router[_0x9fdc('0x8')](_0x9fdc('0xc'),auth[_0x9fdc('0xb')](),controller[_0x9fdc('0xd')]);router[_0x9fdc('0xe')]('/',auth[_0x9fdc('0xb')](),controller['create']);router['put'](_0x9fdc('0xc'),auth['isAuthenticated'](),controller[_0x9fdc('0xf')]);router['delete'](_0x9fdc('0xc'),auth[_0x9fdc('0xb')](),controller['destroy']);module[_0x9fdc('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 57a1977..f8e7dad 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 _0xbc36=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x1aba68,_0x4d0d8c){var _0x479a7a=function(_0x34bf70){while(--_0x34bf70){_0x1aba68['push'](_0x1aba68['shift']());}};_0x479a7a(++_0x4d0d8c);}(_0xbc36,0x169));var _0x6bc3=function(_0x489a3d,_0x2f894a){_0x489a3d=_0x489a3d-0x0;var _0x4d3bff=_0xbc36[_0x489a3d];return _0x4d3bff;};'use strict';var Sequelize=require(_0x6bc3('0x0'));module['exports']={'type':{'type':Sequelize[_0x6bc3('0x1')]},'uniqueid':{'type':Sequelize[_0x6bc3('0x1')]},'calleridnum':{'type':Sequelize[_0x6bc3('0x1')]},'calleridname':{'type':Sequelize[_0x6bc3('0x1')]},'queue':{'type':Sequelize[_0x6bc3('0x1')]},'interface':{'type':Sequelize[_0x6bc3('0x1')]},'membername':{'type':Sequelize[_0x6bc3('0x1')]},'agentcalledAt':{'type':Sequelize[_0x6bc3('0x2')]},'agentconnectAt':{'type':Sequelize[_0x6bc3('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x6bc3('0x2')]},'agentdumpAt':{'type':Sequelize[_0x6bc3('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x6bc3('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x6bc3('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6bc3('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x6bc3('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6bc3('0x4')]},'reason':{'type':Sequelize[_0x6bc3('0x1')]},'lastevent':{'type':Sequelize[_0x6bc3('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x6bc3('0x4')]},'channelstatedesc':{'type':Sequelize[_0x6bc3('0x1')]},'connectedlinenum':{'type':Sequelize[_0x6bc3('0x1')]},'connectedlinename':{'type':Sequelize[_0x6bc3('0x1')]},'language':{'type':Sequelize[_0x6bc3('0x1')]},'accountcode':{'type':Sequelize[_0x6bc3('0x1')]},'context':{'type':Sequelize[_0x6bc3('0x1')]},'exten':{'type':Sequelize[_0x6bc3('0x1')]},'priority':{'type':Sequelize[_0x6bc3('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x6bc3('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x6bc3('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6bc3('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x6bc3('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x6bc3('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6bc3('0x1')]},'destuniqueid':{'type':Sequelize[_0x6bc3('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6bc3('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x6bc3('0x1')]},'transfer':{'type':Sequelize[_0x6bc3('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6bc3('0x1')],'comment':_0x6bc3('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x6bc3('0x1')]},'agententerreason':{'type':Sequelize[_0x6bc3('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaa64=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaa64,0xf7));var _0x4aa6=function(_0x5b15bd,_0x57f86d){_0x5b15bd=_0x5b15bd-0x0;var _0x11e333=_0xaa64[_0x5b15bd];return _0x11e333;};'use strict';var Sequelize=require(_0x4aa6('0x0'));module[_0x4aa6('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4aa6('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4aa6('0x2')]},'queue':{'type':Sequelize[_0x4aa6('0x2')]},'interface':{'type':Sequelize[_0x4aa6('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4aa6('0x3')]},'holdtime':{'type':Sequelize[_0x4aa6('0x4')]},'agentcomplete':{'type':Sequelize[_0x4aa6('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4aa6('0x4')]},'agentacw':{'type':Sequelize[_0x4aa6('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x4aa6('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4aa6('0x2')]},'channelstate':{'type':Sequelize[_0x4aa6('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4aa6('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4aa6('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4aa6('0x2')]},'accountcode':{'type':Sequelize[_0x4aa6('0x2')]},'context':{'type':Sequelize[_0x4aa6('0x2')]},'exten':{'type':Sequelize[_0x4aa6('0x2')]},'priority':{'type':Sequelize[_0x4aa6('0x2')]},'destchannel':{'type':Sequelize[_0x4aa6('0x2')]},'destchannelstate':{'type':Sequelize[_0x4aa6('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x4aa6('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4aa6('0x2')]},'destcalleridname':{'type':Sequelize[_0x4aa6('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4aa6('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4aa6('0x2')]},'destexten':{'type':Sequelize[_0x4aa6('0x2')]},'destpriority':{'type':Sequelize[_0x4aa6('0x2')]},'destuniqueid':{'type':Sequelize[_0x4aa6('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4aa6('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x4aa6('0x2')]},'transfer':{'type':Sequelize[_0x4aa6('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4aa6('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x4aa6('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x4aa6('0x4')],'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 2caf8a4..9d6614c 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(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 84e45f6..4e64d01 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 _0x6aa7=['define','VoiceAgentReport','report_agent','destuniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x6aa7,0x178));var _0x76aa=function(_0x21164d,_0x313f3a){_0x21164d=_0x21164d-0x0;var _0xb52277=_0x6aa7[_0x21164d];return _0xb52277;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x76aa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3248=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3248,0x1bc));var _0x8324=function(_0x48a66e,_0x22a358){_0x48a66e=_0x48a66e-0x0;var _0x276ff2=_0x3248[_0x48a66e];return _0x276ff2;};'use strict';var _=require('lodash');var util=require(_0x8324('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8324('0x1'));var BPromise=require(_0x8324('0x2'));var rp=require(_0x8324('0x3'));var fs=require('fs');var path=require(_0x8324('0x4'));var rimraf=require(_0x8324('0x5'));var config=require(_0x8324('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0x8324('0x7')]=function(_0x1c5c2a,_0x5157f4){return _0x1c5c2a[_0x8324('0x8')](_0x8324('0x9'),attributes,{'tableName':_0x8324('0xa'),'paranoid':![],'indexes':[{'fields':[_0x8324('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index bf6eb10..1ade45d 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 _0xd4f4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','update','raw','where','attributes','limit','UpdateVoiceAgentReport','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4f4,0x143));var _0x4d4f=function(_0x3ad4d3,_0x568ce3){_0x3ad4d3=_0x3ad4d3-0x0;var _0x52da56=_0xd4f4[_0x3ad4d3];return _0x52da56;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require('../../config/logger')(_0x4d4f('0x8'));var config=require(_0x4d4f('0x9'));var jayson=require(_0x4d4f('0xa'));var client=jayson[_0x4d4f('0xb')][_0x4d4f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x291960,_0x19a613,_0x2ad9c9){return new BPromise(function(_0xe0be97,_0x3023f7){return client[_0x4d4f('0xd')](_0x291960,_0x2ad9c9)[_0x4d4f('0xe')](function(_0x3dbc09){logger[_0x4d4f('0xf')](_0x4d4f('0x10'),_0x19a613,_0x4d4f('0x11'));logger[_0x4d4f('0x12')](_0x4d4f('0x13'),_0x19a613,_0x4d4f('0x11'),JSON[_0x4d4f('0x14')](_0x3dbc09));if(_0x3dbc09[_0x4d4f('0x15')]){if(_0x3dbc09[_0x4d4f('0x15')][_0x4d4f('0x16')]===0x1f4){logger[_0x4d4f('0x15')](_0x4d4f('0x10'),_0x19a613,_0x3dbc09['error'][_0x4d4f('0x17')]);return _0x3023f7(_0x3dbc09[_0x4d4f('0x15')][_0x4d4f('0x17')]);}logger[_0x4d4f('0x15')](_0x4d4f('0x10'),_0x19a613,_0x3dbc09['error'][_0x4d4f('0x17')]);return _0xe0be97(_0x3dbc09[_0x4d4f('0x15')][_0x4d4f('0x17')]);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x19a613,_0x4d4f('0x11'));_0xe0be97(_0x3dbc09['result'][_0x4d4f('0x17')]);}})[_0x4d4f('0x18')](function(_0x40faac){logger[_0x4d4f('0x15')]('VoiceAgentReport,\x20%s,\x20%s',_0x19a613,_0x40faac);_0x3023f7(_0x40faac);});});}exports[_0x4d4f('0x19')]=function(_0x41022c){var _0x5787d6=this;return new Promise(function(_0x462cd4,_0xccbfba){return db[_0x4d4f('0x1a')][_0x4d4f('0x1b')](_0x41022c[_0x4d4f('0x1c')],{'raw':_0x41022c[_0x4d4f('0x1d')]?_0x41022c[_0x4d4f('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x521ece){logger['info'](_0x4d4f('0x19'),_0x41022c);logger[_0x4d4f('0x12')](_0x4d4f('0x19'),_0x41022c,JSON[_0x4d4f('0x14')](_0x521ece));_0x462cd4(_0x521ece);})[_0x4d4f('0x18')](function(_0x1de8f2){logger[_0x4d4f('0x15')](_0x4d4f('0x19'),_0x1de8f2[_0x4d4f('0x17')],_0x41022c);_0xccbfba(_0x5787d6[_0x4d4f('0x15')](0x1f4,_0x1de8f2[_0x4d4f('0x17')]));});});};exports['UpdateVoiceAgentReport']=function(_0x1ecee9){var _0x45712c=this;return new Promise(function(_0x1263f9,_0x4ed9bd){return db[_0x4d4f('0x1a')][_0x4d4f('0x1e')](_0x1ecee9['body'],{'raw':_0x1ecee9[_0x4d4f('0x1d')]?_0x1ecee9['options'][_0x4d4f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ecee9[_0x4d4f('0x1d')]?_0x1ecee9[_0x4d4f('0x1d')][_0x4d4f('0x20')]||null:null,'attributes':_0x1ecee9[_0x4d4f('0x1d')]?_0x1ecee9[_0x4d4f('0x1d')][_0x4d4f('0x21')]||null:null,'limit':_0x1ecee9['options']?_0x1ecee9[_0x4d4f('0x1d')][_0x4d4f('0x22')]||null:null})[_0x4d4f('0xe')](function(_0x39c366){logger[_0x4d4f('0xf')](_0x4d4f('0x23'),_0x1ecee9);logger[_0x4d4f('0x12')](_0x4d4f('0x23'),_0x1ecee9,JSON[_0x4d4f('0x14')](_0x39c366));_0x1263f9(_0x39c366);})[_0x4d4f('0x18')](function(_0x1fcba3){logger['error'](_0x4d4f('0x23'),_0x1fcba3['message'],_0x1ecee9);_0x4ed9bd(_0x45712c[_0x4d4f('0x15')](0x1f4,_0x1fcba3[_0x4d4f('0x17')]));});});}; \ No newline at end of file +var _0x391a=['limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','UpdateVoiceAgentReport','update','raw','where'];(function(_0x56fea2,_0x5501bd){var _0x362102=function(_0x1faa33){while(--_0x1faa33){_0x56fea2['push'](_0x56fea2['shift']());}};_0x362102(++_0x5501bd);}(_0x391a,0xa6));var _0xa391=function(_0x57fee7,_0x23f8d5){_0x57fee7=_0x57fee7-0x0;var _0x3f61be=_0x391a[_0x57fee7];return _0x3f61be;};'use strict';var _=require(_0xa391('0x0'));var util=require(_0xa391('0x1'));var moment=require('moment');var BPromise=require(_0xa391('0x2'));var rs=require(_0xa391('0x3'));var fs=require('fs');var Redis=require(_0xa391('0x4'));var db=require(_0xa391('0x5'))['db'];var utils=require(_0xa391('0x6'));var logger=require(_0xa391('0x7'))(_0xa391('0x8'));var config=require(_0xa391('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa391('0xa')][_0xa391('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f0ab,_0x4430f4,_0x4e14cf){return new BPromise(function(_0x136ae8,_0x3a95f8){return client['request'](_0x31f0ab,_0x4e14cf)[_0xa391('0xc')](function(_0x120c78){logger[_0xa391('0xd')](_0xa391('0xe'),_0x4430f4,_0xa391('0xf'));logger[_0xa391('0x10')](_0xa391('0x11'),_0x4430f4,_0xa391('0xf'),JSON[_0xa391('0x12')](_0x120c78));if(_0x120c78[_0xa391('0x13')]){if(_0x120c78[_0xa391('0x13')]['code']===0x1f4){logger[_0xa391('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x4430f4,_0x120c78['error'][_0xa391('0x14')]);return _0x3a95f8(_0x120c78[_0xa391('0x13')][_0xa391('0x14')]);}logger[_0xa391('0x13')](_0xa391('0xe'),_0x4430f4,_0x120c78[_0xa391('0x13')][_0xa391('0x14')]);return _0x136ae8(_0x120c78[_0xa391('0x13')]['message']);}else{logger[_0xa391('0xd')](_0xa391('0xe'),_0x4430f4,_0xa391('0xf'));_0x136ae8(_0x120c78[_0xa391('0x15')]['message']);}})[_0xa391('0x16')](function(_0x433a15){logger[_0xa391('0x13')](_0xa391('0xe'),_0x4430f4,_0x433a15);_0x3a95f8(_0x433a15);});});}exports[_0xa391('0x17')]=function(_0x4507bd){var _0x569a92=this;return new Promise(function(_0xc74b5f,_0x529b56){return db[_0xa391('0x18')][_0xa391('0x19')](_0x4507bd[_0xa391('0x1a')],{'raw':_0x4507bd[_0xa391('0x1b')]?_0x4507bd[_0xa391('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xa391('0xc')](function(_0x357a75){logger[_0xa391('0xd')]('CreateVoiceAgentReport',_0x4507bd);logger['debug']('CreateVoiceAgentReport',_0x4507bd,JSON[_0xa391('0x12')](_0x357a75));_0xc74b5f(_0x357a75);})['catch'](function(_0xad3b97){logger[_0xa391('0x13')]('CreateVoiceAgentReport',_0xad3b97['message'],_0x4507bd);_0x529b56(_0x569a92[_0xa391('0x13')](0x1f4,_0xad3b97[_0xa391('0x14')]));});});};exports[_0xa391('0x1c')]=function(_0x56c4bf){var _0x1aec57=this;return new Promise(function(_0x5a04b1,_0x590816){return db[_0xa391('0x18')][_0xa391('0x1d')](_0x56c4bf['body'],{'raw':_0x56c4bf[_0xa391('0x1b')]?_0x56c4bf[_0xa391('0x1b')][_0xa391('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56c4bf[_0xa391('0x1b')]?_0x56c4bf[_0xa391('0x1b')][_0xa391('0x1f')]||null:null,'attributes':_0x56c4bf[_0xa391('0x1b')]?_0x56c4bf[_0xa391('0x1b')]['attributes']||null:null,'limit':_0x56c4bf[_0xa391('0x1b')]?_0x56c4bf[_0xa391('0x1b')][_0xa391('0x20')]||null:null})[_0xa391('0xc')](function(_0xbcc784){logger['info'](_0xa391('0x1c'),_0x56c4bf);logger['debug'](_0xa391('0x1c'),_0x56c4bf,JSON[_0xa391('0x12')](_0xbcc784));_0x5a04b1(_0xbcc784);})[_0xa391('0x16')](function(_0x176e0e){logger[_0xa391('0x13')](_0xa391('0x1c'),_0x176e0e['message'],_0x56c4bf);_0x590816(_0x1aec57[_0xa391('0x13')](0x1f4,_0x176e0e[_0xa391('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 5cfe776..a17708d 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 _0x7fbe=['/describe','describe','/:id','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index'];(function(_0x1bf795,_0x1f415f){var _0x1688c8=function(_0x2b3e16){while(--_0x2b3e16){_0x1bf795['push'](_0x1bf795['shift']());}};_0x1688c8(++_0x1f415f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2d73da,_0x4e9643){_0x2d73da=_0x2d73da-0x0;var _0x2d06af=_0x7fbe[_0x2d73da];return _0x2d06af;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0x7dfd=['isAuthenticated','index','/describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get'];(function(_0x5f1c2e,_0x50cf54){var _0x2ecb25=function(_0x44e730){while(--_0x44e730){_0x5f1c2e['push'](_0x5f1c2e['shift']());}};_0x2ecb25(++_0x50cf54);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0xd')]);router[_0xd7df('0xb')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller['describe']);router[_0xd7df('0xb')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x10')]);router['post']('/',auth[_0xd7df('0xc')](),controller['create']);router[_0xd7df('0x11')]('/:id',auth[_0xd7df('0xc')](),controller[_0xd7df('0x12')]);router[_0xd7df('0x13')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x14')]);module[_0xd7df('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index dbda80e..c77c042 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 _0x160f=['sequelize','exports','STRING','ENUM','internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER'];(function(_0x4c3491,_0x15406b){var _0x19bb96=function(_0xa5ef11){while(--_0xa5ef11){_0x4c3491['push'](_0x4c3491['shift']());}};_0x19bb96(++_0x15406b);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf160('0x0'));module[_0xf160('0x1')]={'uniqueid':{'type':Sequelize[_0xf160('0x2')]},'type':{'type':Sequelize[_0xf160('0x3')]('inbound',_0xf160('0x4'),_0xf160('0x5'),_0xf160('0x6'),_0xf160('0x7'),_0xf160('0x8'))},'tag':{'type':Sequelize[_0xf160('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xf160('0x2')]},'destination':{'type':Sequelize[_0xf160('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf160('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xf160('0x9')]},'systemanswertime':{'type':Sequelize[_0xf160('0x9')]},'answertime':{'type':Sequelize[_0xf160('0x9')]},'endtime':{'type':Sequelize[_0xf160('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xf160('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf160('0x2')]},'amaflags':{'type':Sequelize[_0xf160('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xf160('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xf160('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xf160('0x2')]},'note':{'type':Sequelize[_0xf160('0x2')]},'prefix':{'type':Sequelize[_0xf160('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xf160('0x2')]}}; \ No newline at end of file +var _0xd763=['inbound','internal','outbound','inbound-fax','outbound-fax','STRING','TEXT','DATE','INTEGER','sequelize','ENUM'];(function(_0x227649,_0x2f99a9){var _0x263613=function(_0x6f0406){while(--_0x6f0406){_0x227649['push'](_0x227649['shift']());}};_0x263613(++_0x2f99a9);}(_0xd763,0xda));var _0x3d76=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xd763[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0x3d76('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3d76('0x1')](_0x3d76('0x2'),_0x3d76('0x3'),_0x3d76('0x4'),_0x3d76('0x5'),_0x3d76('0x6'),'dialer')},'tag':{'type':Sequelize[_0x3d76('0x7')]},'accountcode':{'type':Sequelize[_0x3d76('0x7')]},'source':{'type':Sequelize[_0x3d76('0x7')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x3d76('0x7')]},'callerid':{'type':Sequelize[_0x3d76('0x7')]},'channel':{'type':Sequelize[_0x3d76('0x7')]},'destinationchannel':{'type':Sequelize[_0x3d76('0x7')]},'lastapplication':{'type':Sequelize[_0x3d76('0x7')]},'lastdata':{'type':Sequelize[_0x3d76('0x8')]},'starttime':{'type':Sequelize[_0x3d76('0x9')]},'systemanswertime':{'type':Sequelize[_0x3d76('0x9')]},'answertime':{'type':Sequelize[_0x3d76('0x9')]},'endtime':{'type':Sequelize[_0x3d76('0x9')]},'duration':{'type':Sequelize[_0x3d76('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x3d76('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3d76('0x7')]},'amaflags':{'type':Sequelize[_0x3d76('0x7')]},'userfield':{'type':Sequelize[_0x3d76('0x7')]},'userDisposition':{'type':Sequelize[_0x3d76('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x3d76('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x3d76('0x7')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x3d76('0x7')]},'routeid':{'type':Sequelize[_0x3d76('0xa')]},'sipcallid':{'type':Sequelize[_0x3d76('0x7')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 6f148ee..85a79ab 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 _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','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','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x2ef3,0xba));var _0x32ef=function(_0x41358e,_0x669fc4){_0x41358e=_0x41358e-0x0;var _0x133af3=_0x2ef3[_0x41358e];return _0x133af3;};'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['VoiceCallReport'][_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')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x4f49af,_0x47e992){var _0x28ef1a=function(_0x3b3081){while(--_0x3b3081){_0x4f49af['push'](_0x4f49af['shift']());}};_0x28ef1a(++_0x47e992);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5fe69a,_0x5484f5){_0x5fe69a=_0x5fe69a-0x0;var _0x3f1aee=_0x0b0e[_0x5fe69a];return _0x3f1aee;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 4570ead..b4a5807 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 _0x3b51=['VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment','rimraf','./voiceCallReport.attributes','exports','define'];(function(_0x3e9e17,_0x1ce6ab){var _0x3fff43=function(_0x419faf){while(--_0x419faf){_0x3e9e17['push'](_0x3e9e17['shift']());}};_0x3fff43(++_0x1ce6ab);}(_0x3b51,0x19a));var _0x13b5=function(_0x3b9d79,_0x42f721){_0x3b9d79=_0x3b9d79-0x0;var _0x16d93e=_0x3b51[_0x3b9d79];return _0x16d93e;};'use strict';var _=require('lodash');var util=require(_0x13b5('0x0'));var logger=require(_0x13b5('0x1'))(_0x13b5('0x2'));var moment=require(_0x13b5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x13b5('0x4'));var config=require('../../config/environment');var attributes=require(_0x13b5('0x5'));module[_0x13b5('0x6')]=function(_0x4cede5,_0x2c68f0){return _0x4cede5[_0x13b5('0x7')](_0x13b5('0x8'),attributes,{'tableName':_0x13b5('0x9'),'paranoid':![],'indexes':[{'fields':[_0x13b5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0f5=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1bdcb8,_0x3d29e4){var _0x56e7d3=function(_0x6b1e05){while(--_0x6b1e05){_0x1bdcb8['push'](_0x1bdcb8['shift']());}};_0x56e7d3(++_0x3d29e4);}(_0xe0f5,0xfd));var _0x5e0f=function(_0x59c683,_0x209444){_0x59c683=_0x59c683-0x0;var _0x47251b=_0xe0f5[_0x59c683];return _0x47251b;};'use strict';var _=require(_0x5e0f('0x0'));var util=require(_0x5e0f('0x1'));var logger=require(_0x5e0f('0x2'))(_0x5e0f('0x3'));var moment=require('moment');var BPromise=require(_0x5e0f('0x4'));var rp=require(_0x5e0f('0x5'));var fs=require('fs');var path=require(_0x5e0f('0x6'));var rimraf=require(_0x5e0f('0x7'));var config=require(_0x5e0f('0x8'));var attributes=require(_0x5e0f('0x9'));module[_0x5e0f('0xa')]=function(_0x46aaa3,_0x49959a){return _0x46aaa3['define'](_0x5e0f('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x5e0f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 7fddab9..30638b7 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 _0x33ae=['error','code','message','result','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x24c0b8,_0x50eadd){var _0x34c932=function(_0x3e4c2d){while(--_0x3e4c2d){_0x24c0b8['push'](_0x24c0b8['shift']());}};_0x34c932(++_0x50eadd);}(_0x33ae,0x155));var _0xe33a=function(_0x1df3e5,_0x2d37f1){_0x1df3e5=_0x1df3e5-0x0;var _0x422d0c=_0x33ae[_0x1df3e5];return _0x422d0c;};'use strict';var _=require(_0xe33a('0x0'));var util=require(_0xe33a('0x1'));var moment=require(_0xe33a('0x2'));var BPromise=require(_0xe33a('0x3'));var rs=require(_0xe33a('0x4'));var fs=require('fs');var Redis=require(_0xe33a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe33a('0x6'));var logger=require(_0xe33a('0x7'))(_0xe33a('0x8'));var config=require(_0xe33a('0x9'));var jayson=require(_0xe33a('0xa'));var client=jayson[_0xe33a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c7646,_0x4ae313,_0x369248){return new BPromise(function(_0x356185,_0x3d44a9){return client['request'](_0x2c7646,_0x369248)[_0xe33a('0xc')](function(_0xab826b){logger[_0xe33a('0xd')](_0xe33a('0xe'),_0x4ae313,_0xe33a('0xf'));logger[_0xe33a('0x10')](_0xe33a('0x11'),_0x4ae313,_0xe33a('0xf'),JSON[_0xe33a('0x12')](_0xab826b));if(_0xab826b[_0xe33a('0x13')]){if(_0xab826b[_0xe33a('0x13')][_0xe33a('0x14')]===0x1f4){logger[_0xe33a('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x4ae313,_0xab826b[_0xe33a('0x13')][_0xe33a('0x15')]);return _0x3d44a9(_0xab826b[_0xe33a('0x13')][_0xe33a('0x15')]);}logger[_0xe33a('0x13')](_0xe33a('0xe'),_0x4ae313,_0xab826b[_0xe33a('0x13')]['message']);return _0x356185(_0xab826b[_0xe33a('0x13')]['message']);}else{logger[_0xe33a('0xd')](_0xe33a('0xe'),_0x4ae313,_0xe33a('0xf'));_0x356185(_0xab826b[_0xe33a('0x16')][_0xe33a('0x15')]);}})[_0xe33a('0x17')](function(_0x5ca809){logger[_0xe33a('0x13')](_0xe33a('0xe'),_0x4ae313,_0x5ca809);_0x3d44a9(_0x5ca809);});});}exports[_0xe33a('0x18')]=function(_0x2e795a){var _0x18e6a3=this;return new Promise(function(_0xdcc03b,_0x397760){return db['VoiceCallReport'][_0xe33a('0x19')]({'raw':_0x2e795a[_0xe33a('0x1a')]?_0x2e795a['options'][_0xe33a('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e795a[_0xe33a('0x1a')]?_0x2e795a[_0xe33a('0x1a')][_0xe33a('0x1c')]||null:null,'attributes':_0x2e795a[_0xe33a('0x1a')]?_0x2e795a[_0xe33a('0x1a')][_0xe33a('0x1d')]||null:null,'limit':_0x2e795a[_0xe33a('0x1a')]?_0x2e795a[_0xe33a('0x1a')][_0xe33a('0x1e')]||null:null,'include':_0x2e795a[_0xe33a('0x1a')]?_0x2e795a[_0xe33a('0x1a')][_0xe33a('0x1f')]?_[_0xe33a('0x20')](_0x2e795a[_0xe33a('0x1a')][_0xe33a('0x1f')],function(_0x1c7ad0){return{'model':db[_0x1c7ad0['model']],'as':_0x1c7ad0['as'],'attributes':_0x1c7ad0[_0xe33a('0x1d')],'include':_0x1c7ad0[_0xe33a('0x1f')]?_['map'](_0x1c7ad0[_0xe33a('0x1f')],function(_0x50040e){return{'model':db[_0x50040e[_0xe33a('0x21')]],'as':_0x50040e['as'],'attributes':_0x50040e[_0xe33a('0x1d')],'include':_0x50040e['include']?_[_0xe33a('0x20')](_0x50040e[_0xe33a('0x1f')],function(_0xf66edf){return{'model':db[_0xf66edf[_0xe33a('0x21')]],'as':_0xf66edf['as'],'attributes':_0xf66edf['attributes']};}):[]};}):[]};}):[]:[]})[_0xe33a('0xc')](function(_0x3b9fca){logger['info'](_0xe33a('0x18'),_0x2e795a);logger[_0xe33a('0x10')](_0xe33a('0x18'),_0x2e795a,JSON[_0xe33a('0x12')](_0x3b9fca));_0xdcc03b(_0x3b9fca);})['catch'](function(_0x46a0f3){logger[_0xe33a('0x13')](_0xe33a('0x18'),_0x46a0f3[_0xe33a('0x15')],_0x2e795a);_0x397760(_0x18e6a3[_0xe33a('0x13')](0x1f4,_0x46a0f3[_0xe33a('0x15')]));});});};exports[_0xe33a('0x22')]=function(_0x50c263){var _0x4952ce=this;return new Promise(function(_0x407d23,_0xd20f4c){return db[_0xe33a('0x23')][_0xe33a('0x24')](_0x50c263[_0xe33a('0x25')],{'raw':_0x50c263[_0xe33a('0x1a')]?_0x50c263[_0xe33a('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2552c6){logger['info'](_0xe33a('0x22'),_0x50c263);logger['debug'](_0xe33a('0x22'),_0x50c263,JSON[_0xe33a('0x12')](_0x2552c6));_0x407d23(_0x2552c6);})['catch'](function(_0x562623){logger[_0xe33a('0x13')](_0xe33a('0x22'),_0x562623[_0xe33a('0x15')],_0x50c263);_0xd20f4c(_0x4952ce['error'](0x1f4,_0x562623['message']));});});};exports[_0xe33a('0x26')]=function(_0x37c72e){var _0x47d33e=this;return new Promise(function(_0x316c9f,_0x42e02c){return db[_0xe33a('0x23')][_0xe33a('0x27')](_0x37c72e['body'],{'raw':_0x37c72e[_0xe33a('0x1a')]?_0x37c72e[_0xe33a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37c72e[_0xe33a('0x1a')]?_0x37c72e['options']['where']||null:null,'attributes':_0x37c72e[_0xe33a('0x1a')]?_0x37c72e[_0xe33a('0x1a')]['attributes']||null:null,'limit':_0x37c72e[_0xe33a('0x1a')]?_0x37c72e[_0xe33a('0x1a')][_0xe33a('0x1e')]||null:null})[_0xe33a('0xc')](function(_0x2f4381){logger[_0xe33a('0xd')](_0xe33a('0x26'),_0x37c72e);logger[_0xe33a('0x10')](_0xe33a('0x26'),_0x37c72e,JSON['stringify'](_0x2f4381));_0x316c9f(_0x2f4381);})[_0xe33a('0x17')](function(_0x438461){logger[_0xe33a('0x13')]('UpdateVoiceCallReport',_0x438461[_0xe33a('0x15')],_0x37c72e);_0x42e02c(_0x47d33e['error'](0x1f4,_0x438461[_0xe33a('0x15')]));});});}; \ No newline at end of file +var _0x57d8=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','include','map','model','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','limit','util','moment','ioredis'];(function(_0x1c7684,_0x5eec48){var _0x139925=function(_0x4ad207){while(--_0x4ad207){_0x1c7684['push'](_0x1c7684['shift']());}};_0x139925(++_0x5eec48);}(_0x57d8,0x1ad));var _0x857d=function(_0x5a9dc6,_0x5e98af){_0x5a9dc6=_0x5a9dc6-0x0;var _0x285b86=_0x57d8[_0x5a9dc6];return _0x285b86;};'use strict';var _=require('lodash');var util=require(_0x857d('0x0'));var moment=require(_0x857d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x857d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x857d('0x3'));var logger=require(_0x857d('0x4'))(_0x857d('0x5'));var config=require('../../config/environment');var jayson=require(_0x857d('0x6'));var client=jayson[_0x857d('0x7')][_0x857d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x199490,_0x1520d2,_0x36be1b){return new BPromise(function(_0x5e409d,_0x1eea92){return client[_0x857d('0x9')](_0x199490,_0x36be1b)[_0x857d('0xa')](function(_0x12a60b){logger[_0x857d('0xb')](_0x857d('0xc'),_0x1520d2,_0x857d('0xd'));logger['debug'](_0x857d('0xe'),_0x1520d2,_0x857d('0xd'),JSON[_0x857d('0xf')](_0x12a60b));if(_0x12a60b[_0x857d('0x10')]){if(_0x12a60b[_0x857d('0x10')][_0x857d('0x11')]===0x1f4){logger['error'](_0x857d('0xc'),_0x1520d2,_0x12a60b[_0x857d('0x10')]['message']);return _0x1eea92(_0x12a60b[_0x857d('0x10')]['message']);}logger[_0x857d('0x10')](_0x857d('0xc'),_0x1520d2,_0x12a60b['error'][_0x857d('0x12')]);return _0x5e409d(_0x12a60b['error'][_0x857d('0x12')]);}else{logger['info'](_0x857d('0xc'),_0x1520d2,_0x857d('0xd'));_0x5e409d(_0x12a60b[_0x857d('0x13')][_0x857d('0x12')]);}})[_0x857d('0x14')](function(_0x522639){logger[_0x857d('0x10')](_0x857d('0xc'),_0x1520d2,_0x522639);_0x1eea92(_0x522639);});});}exports[_0x857d('0x15')]=function(_0x368f04){var _0x1ac0bc=this;return new Promise(function(_0x4fa515,_0x157efe){return db[_0x857d('0x16')][_0x857d('0x17')]({'raw':_0x368f04[_0x857d('0x18')]?_0x368f04['options'][_0x857d('0x19')]===undefined?!![]:![]:!![],'where':_0x368f04[_0x857d('0x18')]?_0x368f04[_0x857d('0x18')]['where']||null:null,'attributes':_0x368f04[_0x857d('0x18')]?_0x368f04['options'][_0x857d('0x1a')]||null:null,'limit':_0x368f04['options']?_0x368f04[_0x857d('0x18')]['limit']||null:null,'include':_0x368f04[_0x857d('0x18')]?_0x368f04[_0x857d('0x18')][_0x857d('0x1b')]?_[_0x857d('0x1c')](_0x368f04[_0x857d('0x18')][_0x857d('0x1b')],function(_0x16ae42){return{'model':db[_0x16ae42[_0x857d('0x1d')]],'as':_0x16ae42['as'],'attributes':_0x16ae42['attributes'],'include':_0x16ae42[_0x857d('0x1b')]?_[_0x857d('0x1c')](_0x16ae42[_0x857d('0x1b')],function(_0x3c77c1){return{'model':db[_0x3c77c1['model']],'as':_0x3c77c1['as'],'attributes':_0x3c77c1[_0x857d('0x1a')],'include':_0x3c77c1[_0x857d('0x1b')]?_['map'](_0x3c77c1[_0x857d('0x1b')],function(_0x1b3f6e){return{'model':db[_0x1b3f6e[_0x857d('0x1d')]],'as':_0x1b3f6e['as'],'attributes':_0x1b3f6e[_0x857d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x857d('0xa')](function(_0x1542db){logger[_0x857d('0xb')](_0x857d('0x15'),_0x368f04);logger[_0x857d('0x1e')](_0x857d('0x15'),_0x368f04,JSON[_0x857d('0xf')](_0x1542db));_0x4fa515(_0x1542db);})[_0x857d('0x14')](function(_0x3bd7bf){logger[_0x857d('0x10')]('GetVoiceCallReport',_0x3bd7bf[_0x857d('0x12')],_0x368f04);_0x157efe(_0x1ac0bc[_0x857d('0x10')](0x1f4,_0x3bd7bf[_0x857d('0x12')]));});});};exports[_0x857d('0x1f')]=function(_0x1bc1d1){var _0x3944e5=this;return new Promise(function(_0x2ebf7c,_0x236c96){return db[_0x857d('0x16')][_0x857d('0x20')](_0x1bc1d1[_0x857d('0x21')],{'raw':_0x1bc1d1[_0x857d('0x18')]?_0x1bc1d1['options']['raw']===undefined?!![]:![]:!![]})[_0x857d('0xa')](function(_0x42d4d5){logger[_0x857d('0xb')](_0x857d('0x1f'),_0x1bc1d1);logger[_0x857d('0x1e')]('CreateVoiceCallReport',_0x1bc1d1,JSON[_0x857d('0xf')](_0x42d4d5));_0x2ebf7c(_0x42d4d5);})[_0x857d('0x14')](function(_0x528d8e){logger[_0x857d('0x10')]('CreateVoiceCallReport',_0x528d8e[_0x857d('0x12')],_0x1bc1d1);_0x236c96(_0x3944e5[_0x857d('0x10')](0x1f4,_0x528d8e['message']));});});};exports[_0x857d('0x22')]=function(_0x16bf12){var _0x331f44=this;return new Promise(function(_0x45b648,_0x8646c2){return db['VoiceCallReport']['update'](_0x16bf12[_0x857d('0x21')],{'raw':_0x16bf12[_0x857d('0x18')]?_0x16bf12['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16bf12[_0x857d('0x18')]?_0x16bf12['options']['where']||null:null,'attributes':_0x16bf12[_0x857d('0x18')]?_0x16bf12[_0x857d('0x18')]['attributes']||null:null,'limit':_0x16bf12[_0x857d('0x18')]?_0x16bf12[_0x857d('0x18')][_0x857d('0x23')]||null:null})[_0x857d('0xa')](function(_0x179ac6){logger[_0x857d('0xb')](_0x857d('0x22'),_0x16bf12);logger[_0x857d('0x1e')]('UpdateVoiceCallReport',_0x16bf12,JSON[_0x857d('0xf')](_0x179ac6));_0x45b648(_0x179ac6);})['catch'](function(_0x4131d6){logger[_0x857d('0x10')](_0x857d('0x22'),_0x4131d6['message'],_0x16bf12);_0x8646c2(_0x331f44[_0x857d('0x10')](0x1f4,_0x4131d6['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 304f4f9..3c42a2c 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 _0x89da=['create','put','update','destroy','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post'];(function(_0x7c9d74,_0x104ab4){var _0xb31ab9=function(_0x266d8b){while(--_0x266d8b){_0x7c9d74['push'](_0x7c9d74['shift']());}};_0xb31ab9(++_0x104ab4);}(_0x89da,0x1c4));var _0xa89d=function(_0x3c9520,_0x949664){_0x3c9520=_0x3c9520-0x0;var _0x54ef84=_0x89da[_0x3c9520];return _0x54ef84;};'use strict';var multer=require(_0xa89d('0x0'));var util=require('util');var path=require(_0xa89d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa89d('0x2')]();var fs_extra=require(_0xa89d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa89d('0x4'));var config=require(_0xa89d('0x5'));var controller=require('./voiceChanSpy.controller');router[_0xa89d('0x6')]('/',auth[_0xa89d('0x7')](),controller['index']);router[_0xa89d('0x6')](_0xa89d('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xa89d('0x9')]('/',auth[_0xa89d('0x7')](),controller[_0xa89d('0xa')]);router[_0xa89d('0xb')]('/:id',auth[_0xa89d('0x7')](),controller[_0xa89d('0xc')]);router['delete'](_0xa89d('0x8'),auth[_0xa89d('0x7')](),controller[_0xa89d('0xd')]);module['exports']=router; \ No newline at end of file +var _0x9ae5=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','update','delete','exports','util','connect-timeout','Router','../../components/auth/service'];(function(_0x428885,_0x4122de){var _0xbdc7d5=function(_0xbe39c5){while(--_0xbe39c5){_0x428885['push'](_0x428885['shift']());}};_0xbdc7d5(++_0x4122de);}(_0x9ae5,0x96));var _0x59ae=function(_0x5e5b83,_0x19baf0){_0x5e5b83=_0x5e5b83-0x0;var _0x5d20c4=_0x9ae5[_0x5e5b83];return _0x5d20c4;};'use strict';var multer=require('multer');var util=require(_0x59ae('0x0'));var path=require('path');var timeout=require(_0x59ae('0x1'));var express=require('express');var router=express[_0x59ae('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x59ae('0x3'));var interaction=require(_0x59ae('0x4'));var config=require(_0x59ae('0x5'));var controller=require('./voiceChanSpy.controller');router[_0x59ae('0x6')]('/',auth[_0x59ae('0x7')](),controller['index']);router['get'](_0x59ae('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x59ae('0x9')]('/',auth[_0x59ae('0x7')](),controller[_0x59ae('0xa')]);router['put'](_0x59ae('0x8'),auth[_0x59ae('0x7')](),controller[_0x59ae('0xb')]);router[_0x59ae('0xc')](_0x59ae('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x59ae('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 127ec2e..c1fc250 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 _0xdec5=['sequelize','STRING','name','setDataValue','join','getDataValue','options','split','BOOLEAN'];(function(_0x5ffb95,_0x2498ad){var _0xf48453=function(_0x299f69){while(--_0x299f69){_0x5ffb95['push'](_0x5ffb95['shift']());}};_0xf48453(++_0x2498ad);}(_0xdec5,0x1dd));var _0x5dec=function(_0x2908de,_0x5f0624){_0x2908de=_0x2908de-0x0;var _0x124a22=_0xdec5[_0x2908de];return _0x124a22;};'use strict';var Sequelize=require(_0x5dec('0x0'));module['exports']={'name':{'type':Sequelize[_0x5dec('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x5dec('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x5dec('0x1')],'set':function(_0x2ba955){this[_0x5dec('0x3')]('options',_0x2ba955?_0x2ba955[_0x5dec('0x4')](''):[]);},'get':function(){return this[_0x5dec('0x5')](_0x5dec('0x6'))?this[_0x5dec('0x5')](_0x5dec('0x6'))[_0x5dec('0x7')](''):[];}},'auth':{'type':Sequelize[_0x5dec('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x5dec('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x5dec('0x1')]},'description':{'type':Sequelize[_0x5dec('0x1')]}}; \ No newline at end of file +var _0xffb6=['sequelize','exports','STRING','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xffb6,0x99));var _0x6ffb=function(_0x4fab3b,_0x2949f2){_0x4fab3b=_0x4fab3b-0x0;var _0x5e7826=_0xffb6[_0x4fab3b];return _0x5e7826;};'use strict';var Sequelize=require(_0x6ffb('0x0'));module[_0x6ffb('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x6ffb('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x1e66a2){this[_0x6ffb('0x3')](_0x6ffb('0x4'),_0x1e66a2?_0x1e66a2[_0x6ffb('0x5')](''):[]);},'get':function(){return this[_0x6ffb('0x6')](_0x6ffb('0x4'))?this[_0x6ffb('0x6')](_0x6ffb('0x4'))[_0x6ffb('0x7')](''):[];}},'auth':{'type':Sequelize[_0x6ffb('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x6ffb('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6ffb('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index ad5c2a4..eca6271 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 _0x94b1=['catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','get','ChanSpies','UserProfileResource','destroy','error','stack','name','send','index','VoiceChanSpy','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','rows','show','params','length','include'];(function(_0x15368a,_0x55be0b){var _0x4d59e5=function(_0x377d39){while(--_0x377d39){_0x15368a['push'](_0x15368a['shift']());}};_0x4d59e5(++_0x55be0b);}(_0x94b1,0x102));var _0x194b=function(_0x4d32bc,_0x3ecbe7){_0x4d32bc=_0x4d32bc-0x0;var _0x21b875=_0x94b1[_0x4d32bc];return _0x21b875;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x194b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x194b('0x1'));var rp=require(_0x194b('0x2'));var moment=require(_0x194b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x194b('0x4'));var util=require(_0x194b('0x5'));var path=require(_0x194b('0x6'));var sox=require(_0x194b('0x7'));var csv=require('to-csv');var ejs=require(_0x194b('0x8'));var fs=require('fs');var fs_extra=require(_0x194b('0x9'));var _=require('lodash');var squel=require(_0x194b('0xa'));var crypto=require(_0x194b('0xb'));var jsforce=require(_0x194b('0xc'));var deskjs=require(_0x194b('0xd'));var toCsv=require(_0x194b('0xe'));var querystring=require(_0x194b('0xf'));var Papa=require(_0x194b('0x10'));var Redis=require(_0x194b('0x11'));var authService=require(_0x194b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x194b('0x13'));var hardwareService=require(_0x194b('0x14'));var logger=require(_0x194b('0x15'))('api');var utils=require(_0x194b('0x16'));var config=require(_0x194b('0x17'));var licenseUtil=require(_0x194b('0x18'));var db=require(_0x194b('0x19'))['db'];function respondWithStatusCode(_0x2f2dec,_0x69d003){_0x69d003=_0x69d003||0xcc;return function(_0x394f1d){if(_0x394f1d){return _0x2f2dec[_0x194b('0x1a')](_0x69d003);}return _0x2f2dec[_0x194b('0x1b')](_0x69d003)[_0x194b('0x1c')]();};}function respondWithResult(_0x3170dc,_0xb5776f){_0xb5776f=_0xb5776f||0xc8;return function(_0x2a181c){if(_0x2a181c){return _0x3170dc[_0x194b('0x1b')](_0xb5776f)[_0x194b('0x1d')](_0x2a181c);}};}function respondWithFilteredResult(_0x15bac5,_0x1efd3f){return function(_0x15e7de){if(_0x15e7de){var _0x383579=typeof _0x1efd3f[_0x194b('0x1e')]===_0x194b('0x1f')&&typeof _0x1efd3f['limit']==='undefined';var _0x2c665a=_0x15e7de[_0x194b('0x20')];var _0x417b96=_0x383579?0x0:_0x1efd3f[_0x194b('0x1e')];var _0xc38e3f=_0x383579?_0x15e7de[_0x194b('0x20')]:_0x1efd3f[_0x194b('0x1e')]+_0x1efd3f[_0x194b('0x21')];var _0x5e1464;if(_0xc38e3f>=_0x2c665a){_0xc38e3f=_0x2c665a;_0x5e1464=0xc8;}else{_0x5e1464=0xce;}_0x15bac5[_0x194b('0x1b')](_0x5e1464);return _0x15bac5['set'](_0x194b('0x22'),_0x417b96+'-'+_0xc38e3f+'/'+_0x2c665a)[_0x194b('0x1d')](_0x15e7de);}return null;};}function patchUpdates(_0x476168){return function(_0x1b0f1b){try{jsonpatch[_0x194b('0x23')](_0x1b0f1b,_0x476168,!![]);}catch(_0xb4f90a){return BPromise[_0x194b('0x24')](_0xb4f90a);}return _0x1b0f1b['save']();};}function saveUpdates(_0x7bf529,_0x4d31fd){return function(_0x1c1fb8){if(_0x1c1fb8){return _0x1c1fb8[_0x194b('0x25')](_0x7bf529)[_0x194b('0x26')](function(_0xa7a966){return _0xa7a966;});}return null;};}function removeEntity(_0x3f2133,_0x2a9776){return function(_0x3f3aeb){if(_0x3f3aeb){return _0x3f3aeb['destroy']()[_0x194b('0x26')](function(){var _0x25eed2=_0x3f3aeb[_0x194b('0x27')]({'plain':!![]});var _0x1fa11d=_0x194b('0x28');return db[_0x194b('0x29')][_0x194b('0x2a')]({'where':{'type':_0x1fa11d,'resourceId':_0x25eed2['id']}})[_0x194b('0x26')](function(){return _0x3f3aeb;});})[_0x194b('0x26')](function(){_0x3f2133[_0x194b('0x1b')](0xcc)[_0x194b('0x1c')]();});}};}function handleEntityNotFound(_0x34e107,_0x3173e8){return function(_0x21d397){if(!_0x21d397){_0x34e107[_0x194b('0x1a')](0x194);}return _0x21d397;};}function handleError(_0x2a44c6,_0x250741){_0x250741=_0x250741||0x1f4;return function(_0x15da96){logger[_0x194b('0x2b')](_0x15da96[_0x194b('0x2c')]);if(_0x15da96[_0x194b('0x2d')]){delete _0x15da96['name'];}_0x2a44c6[_0x194b('0x1b')](_0x250741)[_0x194b('0x2e')](_0x15da96);};}exports[_0x194b('0x2f')]=function(_0x59b589,_0x5d1052){var _0x2225e7={},_0x60572a={},_0x42e690={'count':0x0,'rows':[]};var _0x3f7b95=_['map'](db[_0x194b('0x30')][_0x194b('0x31')],function(_0x25d42d){return{'name':_0x25d42d['fieldName'],'type':_0x25d42d['type'][_0x194b('0x32')]};});_0x60572a[_0x194b('0x33')]=_[_0x194b('0x34')](_0x3f7b95,_0x194b('0x2d'));_0x60572a[_0x194b('0x35')]=_[_0x194b('0x36')](_0x59b589[_0x194b('0x35')]);_0x60572a[_0x194b('0x37')]=_[_0x194b('0x38')](_0x60572a[_0x194b('0x33')],_0x60572a[_0x194b('0x35')]);_0x2225e7['attributes']=_[_0x194b('0x38')](_0x60572a['model'],qs[_0x194b('0x39')](_0x59b589[_0x194b('0x35')][_0x194b('0x39')]));_0x2225e7[_0x194b('0x3a')]=_0x2225e7['attributes']['length']?_0x2225e7['attributes']:_0x60572a[_0x194b('0x33')];if(!_0x59b589[_0x194b('0x35')][_0x194b('0x3b')]('nolimit')){_0x2225e7[_0x194b('0x21')]=qs[_0x194b('0x21')](_0x59b589['query'][_0x194b('0x21')]);_0x2225e7[_0x194b('0x1e')]=qs[_0x194b('0x1e')](_0x59b589['query']['offset']);}_0x2225e7[_0x194b('0x3c')]=qs['sort'](_0x59b589[_0x194b('0x35')][_0x194b('0x3d')]);_0x2225e7[_0x194b('0x3e')]=qs[_0x194b('0x37')](_[_0x194b('0x3f')](_0x59b589[_0x194b('0x35')],_0x60572a[_0x194b('0x37')]),_0x3f7b95);if(_0x59b589[_0x194b('0x35')]['filter']){_0x2225e7[_0x194b('0x3e')]=_[_0x194b('0x40')](_0x2225e7['where'],{'$or':_[_0x194b('0x34')](_0x3f7b95,function(_0x4ca7b0){if(_0x4ca7b0[_0x194b('0x41')]!==_0x194b('0x42')){var _0x158072={};_0x158072[_0x4ca7b0[_0x194b('0x2d')]]={'$like':'%'+_0x59b589['query']['filter']+'%'};return _0x158072;}})});}_0x2225e7=_['merge']({},_0x2225e7,_0x59b589[_0x194b('0x43')]);var _0x4ddcd8={'where':_0x2225e7[_0x194b('0x3e')]};return db['VoiceChanSpy'][_0x194b('0x20')](_0x4ddcd8)['then'](function(_0x4de5c3){_0x42e690[_0x194b('0x20')]=_0x4de5c3;if(_0x59b589['query'][_0x194b('0x44')]){_0x2225e7['include']=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x2225e7);})[_0x194b('0x26')](function(_0x49c623){_0x42e690[_0x194b('0x45')]=_0x49c623;return _0x42e690;})[_0x194b('0x26')](respondWithFilteredResult(_0x5d1052,_0x2225e7))['catch'](handleError(_0x5d1052,null));};exports[_0x194b('0x46')]=function(_0x33a06f,_0x372e7e){var _0x1709a={'raw':![],'where':{'id':_0x33a06f[_0x194b('0x47')]['id']}},_0x2a474c={};_0x2a474c[_0x194b('0x33')]=_['keys'](db[_0x194b('0x30')][_0x194b('0x31')]);_0x2a474c[_0x194b('0x35')]=_[_0x194b('0x36')](_0x33a06f[_0x194b('0x35')]);_0x2a474c[_0x194b('0x37')]=_['intersection'](_0x2a474c['model'],_0x2a474c[_0x194b('0x35')]);_0x1709a[_0x194b('0x3a')]=_[_0x194b('0x38')](_0x2a474c[_0x194b('0x33')],qs[_0x194b('0x39')](_0x33a06f[_0x194b('0x35')][_0x194b('0x39')]));_0x1709a['attributes']=_0x1709a[_0x194b('0x3a')][_0x194b('0x48')]?_0x1709a[_0x194b('0x3a')]:_0x2a474c['model'];if(_0x33a06f[_0x194b('0x35')][_0x194b('0x44')]){_0x1709a[_0x194b('0x49')]=[{'all':!![]}];}_0x1709a=_['merge']({},_0x1709a,_0x33a06f[_0x194b('0x43')]);return db['VoiceChanSpy']['find'](_0x1709a)['then'](handleEntityNotFound(_0x372e7e,null))[_0x194b('0x26')](respondWithResult(_0x372e7e,null))[_0x194b('0x4a')](handleError(_0x372e7e,null));};exports[_0x194b('0x4b')]=function(_0x1812fa,_0x4aabce){return db[_0x194b('0x30')][_0x194b('0x4b')](_0x1812fa['body'],{})['then'](function(_0x153411){var _0x3a8349=_0x1812fa[_0x194b('0x4c')][_0x194b('0x27')]({'plain':!![]});if(!_0x3a8349)throw new Error(_0x194b('0x4d'));if(_0x3a8349[_0x194b('0x4e')]===_0x194b('0x4c')){var _0x12b448=_0x153411[_0x194b('0x27')]({'plain':!![]});var _0x32d30a='ChanSpies';return db[_0x194b('0x4f')][_0x194b('0x50')]({'where':{'name':_0x32d30a,'userProfileId':_0x3a8349[_0x194b('0x51')]},'raw':!![]})['then'](function(_0x22f602){if(_0x22f602&&_0x22f602['autoAssociation']===0x0){return db[_0x194b('0x29')][_0x194b('0x4b')]({'name':_0x12b448[_0x194b('0x2d')],'resourceId':_0x12b448['id'],'type':_0x22f602[_0x194b('0x2d')],'sectionId':_0x22f602['id']},{})[_0x194b('0x26')](function(){return _0x153411;});}else{return _0x153411;}})['catch'](function(_0x1bbe25){logger[_0x194b('0x2b')](_0x194b('0x52'),_0x1bbe25);throw _0x1bbe25;});}return _0x153411;})[_0x194b('0x26')](respondWithResult(_0x4aabce,0xc9))[_0x194b('0x4a')](handleError(_0x4aabce,null));};exports[_0x194b('0x25')]=function(_0x48d64e,_0x337e45){if(_0x48d64e['body']['id']){delete _0x48d64e['body']['id'];}return db[_0x194b('0x30')][_0x194b('0x50')]({'where':{'id':_0x48d64e[_0x194b('0x47')]['id']}})['then'](handleEntityNotFound(_0x337e45,null))['then'](saveUpdates(_0x48d64e['body'],null))[_0x194b('0x26')](respondWithResult(_0x337e45,null))[_0x194b('0x4a')](handleError(_0x337e45,null));};exports['destroy']=function(_0x23f3ec,_0x12a785){return db[_0x194b('0x30')][_0x194b('0x50')]({'where':{'id':_0x23f3ec['params']['id']}})[_0x194b('0x26')](handleEntityNotFound(_0x12a785,null))[_0x194b('0x26')](removeEntity(_0x12a785,null))[_0x194b('0x4a')](handleError(_0x12a785,null));}; \ No newline at end of file +var _0x7af2=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','fieldName','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x197b4e,_0x229344){var _0x2d474b=function(_0x158f0d){while(--_0x158f0d){_0x197b4e['push'](_0x197b4e['shift']());}};_0x2d474b(++_0x229344);}(_0x7af2,0x119));var _0x27af=function(_0x3ad00e,_0x37f5f){_0x3ad00e=_0x3ad00e-0x0;var _0x3fe25d=_0x7af2[_0x3ad00e];return _0x3fe25d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];function respondWithStatusCode(_0x49a883,_0x406340){_0x406340=_0x406340||0xcc;return function(_0x203501){if(_0x203501){return _0x49a883[_0x27af('0x17')](_0x406340);}return _0x49a883[_0x27af('0x18')](_0x406340)[_0x27af('0x19')]();};}function respondWithResult(_0x1edb50,_0x234825){_0x234825=_0x234825||0xc8;return function(_0x3da435){if(_0x3da435){return _0x1edb50[_0x27af('0x18')](_0x234825)[_0x27af('0x1a')](_0x3da435);}};}function respondWithFilteredResult(_0x30f675,_0x9c2d4b){return function(_0x2d7800){if(_0x2d7800){var _0x3102c4=typeof _0x9c2d4b[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x9c2d4b[_0x27af('0x1d')]===_0x27af('0x1c');var _0x58583a=_0x2d7800[_0x27af('0x1e')];var _0x31d702=_0x3102c4?0x0:_0x9c2d4b['offset'];var _0x4e6e2f=_0x3102c4?_0x2d7800[_0x27af('0x1e')]:_0x9c2d4b[_0x27af('0x1b')]+_0x9c2d4b[_0x27af('0x1d')];var _0x31573a;if(_0x4e6e2f>=_0x58583a){_0x4e6e2f=_0x58583a;_0x31573a=0xc8;}else{_0x31573a=0xce;}_0x30f675[_0x27af('0x18')](_0x31573a);return _0x30f675['set'](_0x27af('0x1f'),_0x31d702+'-'+_0x4e6e2f+'/'+_0x58583a)[_0x27af('0x1a')](_0x2d7800);}return null;};}function patchUpdates(_0xcb4b90){return function(_0x5e7c19){try{jsonpatch[_0x27af('0x20')](_0x5e7c19,_0xcb4b90,!![]);}catch(_0x2eec5f){return BPromise[_0x27af('0x21')](_0x2eec5f);}return _0x5e7c19['save']();};}function saveUpdates(_0x2dce2b,_0x2460f4){return function(_0x30720b){if(_0x30720b){return _0x30720b[_0x27af('0x22')](_0x2dce2b)[_0x27af('0x23')](function(_0x396156){return _0x396156;});}return null;};}function removeEntity(_0x43dd9e,_0x35b36d){return function(_0x2e1bb0){if(_0x2e1bb0){return _0x2e1bb0['destroy']()['then'](function(){var _0x4b8fe6=_0x2e1bb0[_0x27af('0x24')]({'plain':!![]});var _0x4feaf1=_0x27af('0x25');return db[_0x27af('0x26')]['destroy']({'where':{'type':_0x4feaf1,'resourceId':_0x4b8fe6['id']}})[_0x27af('0x23')](function(){return _0x2e1bb0;});})[_0x27af('0x23')](function(){_0x43dd9e[_0x27af('0x18')](0xcc)[_0x27af('0x19')]();});}};}function handleEntityNotFound(_0x39b8ee,_0x3ca40e){return function(_0x775d4e){if(!_0x775d4e){_0x39b8ee['sendStatus'](0x194);}return _0x775d4e;};}function handleError(_0x14d5fc,_0x250d5b){_0x250d5b=_0x250d5b||0x1f4;return function(_0xadd38e){logger[_0x27af('0x27')](_0xadd38e[_0x27af('0x28')]);if(_0xadd38e[_0x27af('0x29')]){delete _0xadd38e[_0x27af('0x29')];}_0x14d5fc[_0x27af('0x18')](_0x250d5b)[_0x27af('0x2a')](_0xadd38e);};}exports[_0x27af('0x2b')]=function(_0x205e41,_0x4f4955){var _0x15e867={},_0x14b2e7={},_0x3800a1={'count':0x0,'rows':[]};var _0x575887=_[_0x27af('0x2c')](db[_0x27af('0x2d')]['rawAttributes'],function(_0x51bc97){return{'name':_0x51bc97[_0x27af('0x2e')],'type':_0x51bc97[_0x27af('0x2f')]['key']};});_0x14b2e7[_0x27af('0x30')]=_[_0x27af('0x2c')](_0x575887,_0x27af('0x29'));_0x14b2e7[_0x27af('0x31')]=_[_0x27af('0x32')](_0x205e41[_0x27af('0x31')]);_0x14b2e7[_0x27af('0x33')]=_[_0x27af('0x34')](_0x14b2e7[_0x27af('0x30')],_0x14b2e7[_0x27af('0x31')]);_0x15e867[_0x27af('0x35')]=_['intersection'](_0x14b2e7['model'],qs[_0x27af('0x36')](_0x205e41[_0x27af('0x31')]['fields']));_0x15e867[_0x27af('0x35')]=_0x15e867[_0x27af('0x35')]['length']?_0x15e867[_0x27af('0x35')]:_0x14b2e7[_0x27af('0x30')];if(!_0x205e41[_0x27af('0x31')][_0x27af('0x37')](_0x27af('0x38'))){_0x15e867['limit']=qs[_0x27af('0x1d')](_0x205e41[_0x27af('0x31')]['limit']);_0x15e867['offset']=qs[_0x27af('0x1b')](_0x205e41[_0x27af('0x31')][_0x27af('0x1b')]);}_0x15e867[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x205e41[_0x27af('0x31')]['sort']);_0x15e867[_0x27af('0x3b')]=qs['filters'](_[_0x27af('0x3c')](_0x205e41[_0x27af('0x31')],_0x14b2e7[_0x27af('0x33')]),_0x575887);if(_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]){_0x15e867['where']=_[_0x27af('0x3e')](_0x15e867[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x575887,function(_0x3faebd){if(_0x3faebd[_0x27af('0x2f')]!==_0x27af('0x3f')){var _0x415d9f={};_0x415d9f[_0x3faebd[_0x27af('0x29')]]={'$like':'%'+_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x415d9f;}})});}_0x15e867=_[_0x27af('0x3e')]({},_0x15e867,_0x205e41[_0x27af('0x40')]);var _0x24ee9b={'where':_0x15e867[_0x27af('0x3b')]};return db['VoiceChanSpy'][_0x27af('0x1e')](_0x24ee9b)[_0x27af('0x23')](function(_0x44534b){_0x3800a1[_0x27af('0x1e')]=_0x44534b;if(_0x205e41['query'][_0x27af('0x41')]){_0x15e867['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x27af('0x42')](_0x15e867);})[_0x27af('0x23')](function(_0x279f99){_0x3800a1[_0x27af('0x43')]=_0x279f99;return _0x3800a1;})[_0x27af('0x23')](respondWithFilteredResult(_0x4f4955,_0x15e867))[_0x27af('0x44')](handleError(_0x4f4955,null));};exports[_0x27af('0x45')]=function(_0x26eb28,_0x2269e8){var _0x100fcb={'raw':![],'where':{'id':_0x26eb28[_0x27af('0x46')]['id']}},_0x1e3c35={};_0x1e3c35['model']=_[_0x27af('0x32')](db[_0x27af('0x2d')]['rawAttributes']);_0x1e3c35['query']=_[_0x27af('0x32')](_0x26eb28[_0x27af('0x31')]);_0x1e3c35[_0x27af('0x33')]=_[_0x27af('0x34')](_0x1e3c35[_0x27af('0x30')],_0x1e3c35['query']);_0x100fcb[_0x27af('0x35')]=_['intersection'](_0x1e3c35[_0x27af('0x30')],qs[_0x27af('0x36')](_0x26eb28[_0x27af('0x31')][_0x27af('0x36')]));_0x100fcb[_0x27af('0x35')]=_0x100fcb[_0x27af('0x35')][_0x27af('0x47')]?_0x100fcb['attributes']:_0x1e3c35['model'];if(_0x26eb28[_0x27af('0x31')]['includeAll']){_0x100fcb[_0x27af('0x48')]=[{'all':!![]}];}_0x100fcb=_[_0x27af('0x3e')]({},_0x100fcb,_0x26eb28[_0x27af('0x40')]);return db[_0x27af('0x2d')][_0x27af('0x49')](_0x100fcb)[_0x27af('0x23')](handleEntityNotFound(_0x2269e8,null))[_0x27af('0x23')](respondWithResult(_0x2269e8,null))['catch'](handleError(_0x2269e8,null));};exports[_0x27af('0x4a')]=function(_0xc7e2a8,_0x20e180){return db[_0x27af('0x2d')][_0x27af('0x4a')](_0xc7e2a8['body'],{})[_0x27af('0x23')](function(_0x25f960){var _0x28ba64=_0xc7e2a8['user']['get']({'plain':!![]});if(!_0x28ba64)throw new Error(_0x27af('0x4b'));if(_0x28ba64[_0x27af('0x4c')]===_0x27af('0x4d')){var _0x5be44f=_0x25f960['get']({'plain':!![]});var _0x2fad23='ChanSpies';return db[_0x27af('0x4e')][_0x27af('0x49')]({'where':{'name':_0x2fad23,'userProfileId':_0x28ba64[_0x27af('0x4f')]},'raw':!![]})[_0x27af('0x23')](function(_0x38aa14){if(_0x38aa14&&_0x38aa14[_0x27af('0x50')]===0x0){return db[_0x27af('0x26')][_0x27af('0x4a')]({'name':_0x5be44f[_0x27af('0x29')],'resourceId':_0x5be44f['id'],'type':_0x38aa14[_0x27af('0x29')],'sectionId':_0x38aa14['id']},{})[_0x27af('0x23')](function(){return _0x25f960;});}else{return _0x25f960;}})['catch'](function(_0x76ed78){logger[_0x27af('0x27')](_0x27af('0x51'),_0x76ed78);throw _0x76ed78;});}return _0x25f960;})[_0x27af('0x23')](respondWithResult(_0x20e180,0xc9))[_0x27af('0x44')](handleError(_0x20e180,null));};exports[_0x27af('0x22')]=function(_0x20c155,_0x31eaa9){if(_0x20c155['body']['id']){delete _0x20c155[_0x27af('0x52')]['id'];}return db['VoiceChanSpy'][_0x27af('0x49')]({'where':{'id':_0x20c155[_0x27af('0x46')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x31eaa9,null))['then'](saveUpdates(_0x20c155[_0x27af('0x52')],null))['then'](respondWithResult(_0x31eaa9,null))[_0x27af('0x44')](handleError(_0x31eaa9,null));};exports[_0x27af('0x53')]=function(_0x4769ff,_0x5bf8b0){return db[_0x27af('0x2d')]['find']({'where':{'id':_0x4769ff[_0x27af('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bf8b0,null))[_0x27af('0x23')](removeEntity(_0x5bf8b0,null))[_0x27af('0x44')](handleError(_0x5bf8b0,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index ec4c918..2bafe4b 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 _0x274b=['User','findAll','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','internal'];(function(_0x469c7c,_0x4a54c6){var _0x4b8ffa=function(_0x2bff74){while(--_0x2bff74){_0x469c7c['push'](_0x469c7c['shift']());}};_0x4b8ffa(++_0x4a54c6);}(_0x274b,0x108));var _0xb274=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x274b[_0x550d12];return _0x12103d;};'use strict';var _=require(_0xb274('0x0'));var util=require(_0xb274('0x1'));var BPromise=require(_0xb274('0x2'));var attributes=require(_0xb274('0x3'));var getUserApplications=function(_0x51f071,_0x4f447c,_0x5bc175){var _0xf3342f=0x1;var _0x5b1a61=[];var _0x4ea488={'context':_0x4f447c[_0xb274('0x4')]||_0xb274('0x5'),'exten':util[_0xb274('0x6')](_0xb274('0x7'),_0x51f071[_0xb274('0x8')],_0x5bc175),'type':_0xb274('0x9'),'isApp':![],'ChanSpyId':_0x51f071['id'],'UserId':_0x4f447c['id']};_0x5b1a61[_0xb274('0xa')](_[_0xb274('0xb')]({'app':_0xb274('0xc'),'appdata':util['format'](_0xb274('0xd'),_0xb274('0xe')),'priority':_0xf3342f++},_0x4ea488));if(_0x51f071['record']){_0x5b1a61[_0xb274('0xa')](_['merge']({'app':_0xb274('0xf'),'appdata':util['format'](_0xb274('0x10'),_0x51f071[_0xb274('0x11')]),'priority':_0xf3342f++},_0x4ea488));}if(_0x51f071[_0xb274('0x12')]){_0x5b1a61[_0xb274('0xa')](_[_0xb274('0xb')]({'app':_0xb274('0x13'),'appdata':_0x51f071[_0xb274('0x14')],'priority':_0xf3342f++},_0x4ea488));}_0x5b1a61[_0xb274('0xa')](_['merge']({'app':_0xb274('0x15'),'appdata':util[_0xb274('0x6')](_0xb274('0x16'),_0x4f447c[_0xb274('0x17')],_0x51f071['options']?_0x51f071[_0xb274('0x18')][_0xb274('0x19')](''):''),'priority':_0xf3342f++},_0x4ea488));if(_0x51f071[_0xb274('0x1a')]){_0x5b1a61[_0xb274('0xa')](_[_0xb274('0xb')]({'app':_0xb274('0x1b'),'priority':_0xf3342f++},_0x4ea488));}return _0x5b1a61;};var getChanSpyApplications=function(_0x30413f,_0x168156){var _0xc9e730=[];for(var _0xa9a326=0x0,_0x20ad58=0x1;_0xa9a326<_0x168156[_0xb274('0x1c')];_0xa9a326++,_0x20ad58=0x1){_0xc9e730=_0xc9e730['concat'](getUserApplications(_0x30413f,_0x168156[_0xa9a326],_0x168156[_0xa9a326][_0xb274('0x1d')]));if(_0x168156[_0xa9a326][_0xb274('0x1d')]!=_0x168156[_0xa9a326][_0xb274('0x17')]){_0xc9e730=_0xc9e730['concat'](getUserApplications(_0x30413f,_0x168156[_0xa9a326],_0x168156[_0xa9a326][_0xb274('0x17')]));}}return _0xc9e730;};var getChanSpyPromise=function(_0x340c07,_0x554ab9){return new BPromise(function(_0x409174,_0x3c84b0){return _0x340c07[_0xb274('0x1e')][_0xb274('0x1f')]({'attributes':['id','name',_0xb274('0x1d')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xb274('0x20')](function(_0x5e9700){if(_0x5e9700){return _0x409174(getChanSpyApplications(_0x554ab9,_0x5e9700));}return _0x409174([]);})[_0xb274('0x21')](function(_0x17fc53){_0x3c84b0(_0x17fc53);});});};module[_0xb274('0x22')]=function(_0x75f6b0,_0x5c6164){var _0x27dbc8=_0x75f6b0[_0xb274('0x23')];return _0x75f6b0[_0xb274('0x24')](_0xb274('0x25'),attributes,{'tableName':_0xb274('0x26'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x285d11,_0xd3644c,_0x3f79e4){return getChanSpyPromise(_0x27dbc8,_0x285d11)[_0xb274('0x20')](function(_0x85d41a){if(_0x85d41a&&_0x85d41a['length']){return _0x27dbc8['VoiceExtension']['bulkCreate'](_0x85d41a);}})[_0xb274('0x20')](function(){_0x3f79e4();})[_0xb274('0x21')](function(_0x35fa76){_0x3f79e4(_0x35fa76);});},'afterUpdate':function(_0x39a66c,_0x512c9e,_0xbddc6){return _0x27dbc8[_0xb274('0x27')][_0xb274('0x28')]({'where':{'ChanSpyId':_0x39a66c['id']}})['then'](function(){return getChanSpyPromise(_0x27dbc8,_0x39a66c);})[_0xb274('0x20')](function(_0x9b0a16){if(_0x9b0a16&&_0x9b0a16['length']){return _0x27dbc8['VoiceExtension'][_0xb274('0x29')](_0x9b0a16);}})[_0xb274('0x20')](function(){_0xbddc6();})[_0xb274('0x21')](function(_0x7d5476){_0xbddc6(_0x7d5476);});},'afterDestroy':function(_0x5cd88a,_0x2d6ca5,_0x4711f6){return _0x27dbc8[_0xb274('0x27')][_0xb274('0x28')]({'where':{'ChanSpyId':_0x5cd88a['id']}})['then'](function(){_0x4711f6();})['catch'](function(_0x545bf0){_0x4711f6(_0x545bf0);});}}});}; \ No newline at end of file +var _0xe4fb=['format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','agent','catch','exports','models','define','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','context','from-sip'];(function(_0x1bc9d3,_0x5dc4d5){var _0x24fe17=function(_0x435365){while(--_0x435365){_0x1bc9d3['push'](_0x1bc9d3['shift']());}};_0x24fe17(++_0x5dc4d5);}(_0xe4fb,0x149));var _0xbe4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe4fb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbe4f('0x0'));var util=require(_0xbe4f('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x39e054,_0x4e6c2a,_0x40221f){var _0x17f5b0=0x1;var _0x363d68=[];var _0x4e7874={'context':_0x4e6c2a[_0xbe4f('0x2')]||_0xbe4f('0x3'),'exten':util[_0xbe4f('0x4')](_0xbe4f('0x5'),_0x39e054[_0xbe4f('0x6')],_0x40221f),'type':_0xbe4f('0x7'),'isApp':![],'ChanSpyId':_0x39e054['id'],'UserId':_0x4e6c2a['id']};_0x363d68[_0xbe4f('0x8')](_[_0xbe4f('0x9')]({'app':_0xbe4f('0xa'),'appdata':util['format'](_0xbe4f('0xb'),'chanspy'),'priority':_0x17f5b0++},_0x4e7874));if(_0x39e054[_0xbe4f('0xc')]){_0x363d68['push'](_[_0xbe4f('0x9')]({'app':_0xbe4f('0xd'),'appdata':util[_0xbe4f('0x4')]('${UNIQUEID}.%s,a',_0x39e054[_0xbe4f('0xe')]),'priority':_0x17f5b0++},_0x4e7874));}if(_0x39e054[_0xbe4f('0xf')]){_0x363d68[_0xbe4f('0x8')](_[_0xbe4f('0x9')]({'app':_0xbe4f('0x10'),'appdata':_0x39e054[_0xbe4f('0x11')],'priority':_0x17f5b0++},_0x4e7874));}_0x363d68[_0xbe4f('0x8')](_[_0xbe4f('0x9')]({'app':_0xbe4f('0x12'),'appdata':util[_0xbe4f('0x4')](_0xbe4f('0x13'),_0x4e6c2a[_0xbe4f('0x14')],_0x39e054[_0xbe4f('0x15')]?_0x39e054['options'][_0xbe4f('0x16')](''):''),'priority':_0x17f5b0++},_0x4e7874));if(_0x39e054[_0xbe4f('0xc')]){_0x363d68[_0xbe4f('0x8')](_[_0xbe4f('0x9')]({'app':_0xbe4f('0x17'),'priority':_0x17f5b0++},_0x4e7874));}return _0x363d68;};var getChanSpyApplications=function(_0x183614,_0x354724){var _0x3031c6=[];for(var _0x9fe442=0x0,_0x4b99bc=0x1;_0x9fe442<_0x354724[_0xbe4f('0x18')];_0x9fe442++,_0x4b99bc=0x1){_0x3031c6=_0x3031c6[_0xbe4f('0x19')](getUserApplications(_0x183614,_0x354724[_0x9fe442],_0x354724[_0x9fe442]['internal']));if(_0x354724[_0x9fe442][_0xbe4f('0x1a')]!=_0x354724[_0x9fe442][_0xbe4f('0x14')]){_0x3031c6=_0x3031c6['concat'](getUserApplications(_0x183614,_0x354724[_0x9fe442],_0x354724[_0x9fe442][_0xbe4f('0x14')]));}}return _0x3031c6;};var getChanSpyPromise=function(_0x33700b,_0x18a3ad){return new BPromise(function(_0x4e5839,_0x1050ee){return _0x33700b['User']['findAll']({'attributes':['id',_0xbe4f('0x14'),_0xbe4f('0x1a')],'where':{'role':_0xbe4f('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x122873){if(_0x122873){return _0x4e5839(getChanSpyApplications(_0x18a3ad,_0x122873));}return _0x4e5839([]);})[_0xbe4f('0x1c')](function(_0x4ce244){_0x1050ee(_0x4ce244);});});};module[_0xbe4f('0x1d')]=function(_0x4c313c,_0x154c42){var _0x435e1e=_0x4c313c[_0xbe4f('0x1e')];return _0x4c313c[_0xbe4f('0x1f')]('VoiceChanSpy',attributes,{'tableName':_0xbe4f('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4003c6,_0x10fc2e,_0x2aeedc){return getChanSpyPromise(_0x435e1e,_0x4003c6)[_0xbe4f('0x21')](function(_0x2fc0b3){if(_0x2fc0b3&&_0x2fc0b3[_0xbe4f('0x18')]){return _0x435e1e[_0xbe4f('0x22')][_0xbe4f('0x23')](_0x2fc0b3);}})[_0xbe4f('0x21')](function(){_0x2aeedc();})[_0xbe4f('0x1c')](function(_0x164e9c){_0x2aeedc(_0x164e9c);});},'afterUpdate':function(_0x480078,_0x50fa49,_0x181249){return _0x435e1e[_0xbe4f('0x22')][_0xbe4f('0x24')]({'where':{'ChanSpyId':_0x480078['id']}})[_0xbe4f('0x21')](function(){return getChanSpyPromise(_0x435e1e,_0x480078);})[_0xbe4f('0x21')](function(_0x281359){if(_0x281359&&_0x281359[_0xbe4f('0x18')]){return _0x435e1e[_0xbe4f('0x22')][_0xbe4f('0x23')](_0x281359);}})['then'](function(){_0x181249();})[_0xbe4f('0x1c')](function(_0x2127eb){_0x181249(_0x2127eb);});},'afterDestroy':function(_0x4e2ec6,_0x43e067,_0x2512a0){return _0x435e1e['VoiceExtension'][_0xbe4f('0x24')]({'where':{'ChanSpyId':_0x4e2ec6['id']}})[_0xbe4f('0x21')](function(){_0x2512a0();})[_0xbe4f('0x1c')](function(_0x4bd64b){_0x2512a0(_0x4bd64b);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 3ef6b37..f7d4490 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 _0x00b3=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x3c573b,_0x369a4e){var _0x42d81d=function(_0x320c56){while(--_0x320c56){_0x3c573b['push'](_0x3c573b['shift']());}};_0x42d81d(++_0x369a4e);}(_0x00b3,0x17a));var _0x300b=function(_0x29a0c9,_0x512058){_0x29a0c9=_0x29a0c9-0x0;var _0x173b36=_0x00b3[_0x29a0c9];return _0x173b36;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var rs=require(_0x300b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x300b('0x5'))('rpc');var config=require(_0x300b('0x6'));var jayson=require(_0x300b('0x7'));var client=jayson[_0x300b('0x8')][_0x300b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af470,_0x5dabb9,_0x30b3fe){return new BPromise(function(_0x590c4d,_0x5e283c){return client[_0x300b('0xa')](_0x5af470,_0x30b3fe)[_0x300b('0xb')](function(_0x457aa3){logger['info'](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));logger[_0x300b('0xe')](_0x300b('0xf'),_0x5dabb9,'request\x20sent',JSON[_0x300b('0x10')](_0x457aa3));if(_0x457aa3[_0x300b('0x11')]){if(_0x457aa3[_0x300b('0x11')]['code']===0x1f4){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);return _0x5e283c(_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);}logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3['error']['message']);return _0x590c4d(_0x457aa3['error']['message']);}else{logger[_0x300b('0x13')](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));_0x590c4d(_0x457aa3[_0x300b('0x14')]['message']);}})['catch'](function(_0x35b1d7){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x35b1d7);_0x5e283c(_0x35b1d7);});});} \ No newline at end of file +var _0xf403=['error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf403,0x1d3));var _0x3f40=function(_0x52ebbd,_0x2ed044){_0x52ebbd=_0x52ebbd-0x0;var _0x54429f=_0xf403[_0x52ebbd];return _0x54429f;};'use strict';var _=require(_0x3f40('0x0'));var util=require('util');var moment=require(_0x3f40('0x1'));var BPromise=require(_0x3f40('0x2'));var rs=require(_0x3f40('0x3'));var fs=require('fs');var Redis=require(_0x3f40('0x4'));var db=require(_0x3f40('0x5'))['db'];var utils=require(_0x3f40('0x6'));var logger=require(_0x3f40('0x7'))(_0x3f40('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3f40('0x9')][_0x3f40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24fb9e,_0x1f21fa,_0x5878f9){return new BPromise(function(_0x1dffe8,_0x4c1694){return client['request'](_0x24fb9e,_0x5878f9)[_0x3f40('0xb')](function(_0xb4a314){logger[_0x3f40('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x1f21fa,'request\x20sent');logger[_0x3f40('0xd')](_0x3f40('0xe'),_0x1f21fa,_0x3f40('0xf'),JSON['stringify'](_0xb4a314));if(_0xb4a314[_0x3f40('0x10')]){if(_0xb4a314[_0x3f40('0x10')][_0x3f40('0x11')]===0x1f4){logger['error'](_0x3f40('0x12'),_0x1f21fa,_0xb4a314['error'][_0x3f40('0x13')]);return _0x4c1694(_0xb4a314[_0x3f40('0x10')][_0x3f40('0x13')]);}logger[_0x3f40('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x1f21fa,_0xb4a314[_0x3f40('0x10')][_0x3f40('0x13')]);return _0x1dffe8(_0xb4a314[_0x3f40('0x10')][_0x3f40('0x13')]);}else{logger[_0x3f40('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x1f21fa,_0x3f40('0xf'));_0x1dffe8(_0xb4a314[_0x3f40('0x14')]['message']);}})['catch'](function(_0x54f596){logger[_0x3f40('0x10')](_0x3f40('0x12'),_0x1f21fa,_0x54f596);_0x4c1694(_0x54f596);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 345f59c..e4e537c 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 _0x8e9a=['../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x182ff0,_0x547f15){var _0xa2f7fa=function(_0x28b45f){while(--_0x28b45f){_0x182ff0['push'](_0x182ff0['shift']());}};_0xa2f7fa(++_0x547f15);}(_0x8e9a,0xa5));var _0xa8e9=function(_0x2b07c2,_0x54b93b){_0x2b07c2=_0x2b07c2-0x0;var _0x5a1bfc=_0x8e9a[_0x2b07c2];return _0x5a1bfc;};'use strict';var multer=require('multer');var util=require(_0xa8e9('0x0'));var path=require(_0xa8e9('0x1'));var timeout=require(_0xa8e9('0x2'));var express=require(_0xa8e9('0x3'));var router=express[_0xa8e9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa8e9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa8e9('0x6'));var controller=require(_0xa8e9('0x7'));router[_0xa8e9('0x8')]('/',auth['isAuthenticated'](),controller[_0xa8e9('0x9')]);router[_0xa8e9('0x8')](_0xa8e9('0xa'),auth[_0xa8e9('0xb')](),controller[_0xa8e9('0xc')]);router['post']('/',auth[_0xa8e9('0xb')](),controller[_0xa8e9('0xd')]);router[_0xa8e9('0xe')](_0xa8e9('0xa'),auth[_0xa8e9('0xb')](),controller[_0xa8e9('0xf')]);router[_0xa8e9('0x10')]('/:id',auth[_0xa8e9('0xb')](),controller[_0xa8e9('0x11')]);module[_0xa8e9('0x12')]=router; \ No newline at end of file +var _0x89c3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x34bd34,_0x1444f7){var _0x4e36d6=function(_0x20ed8e){while(--_0x20ed8e){_0x34bd34['push'](_0x34bd34['shift']());}};_0x4e36d6(++_0x1444f7);}(_0x89c3,0x1f4));var _0x389c=function(_0x2c65f2,_0x2b8b6d){_0x2c65f2=_0x2c65f2-0x0;var _0xb0f8be=_0x89c3[_0x2c65f2];return _0xb0f8be;};'use strict';var multer=require(_0x389c('0x0'));var util=require('util');var path=require(_0x389c('0x1'));var timeout=require(_0x389c('0x2'));var express=require(_0x389c('0x3'));var router=express[_0x389c('0x4')]();var fs_extra=require(_0x389c('0x5'));var auth=require(_0x389c('0x6'));var interaction=require(_0x389c('0x7'));var config=require(_0x389c('0x8'));var controller=require(_0x389c('0x9'));router[_0x389c('0xa')]('/',auth['isAuthenticated'](),controller[_0x389c('0xb')]);router[_0x389c('0xa')]('/:id',auth[_0x389c('0xc')](),controller[_0x389c('0xd')]);router[_0x389c('0xe')]('/',auth[_0x389c('0xc')](),controller[_0x389c('0xf')]);router['put'](_0x389c('0x10'),auth['isAuthenticated'](),controller[_0x389c('0x11')]);router[_0x389c('0x12')](_0x389c('0x10'),auth[_0x389c('0xc')](),controller[_0x389c('0x13')]);module[_0x389c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index b79b1e5..e0eea10 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 _0x697a=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4fe382,_0x393ed4){var _0xc32446=function(_0x4c00df){while(--_0x4c00df){_0x4fe382['push'](_0x4fe382['shift']());}};_0xc32446(++_0x393ed4);}(_0x697a,0x10f));var _0xa697=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x697a[_0x355ce8];return _0x1db8b8;};'use strict';var Sequelize=require(_0xa697('0x0'));module[_0xa697('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xa697('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xa697('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfba2=['STRING','name','BOOLEAN','exports'];(function(_0xb9bb51,_0x1e153a){var _0x18a29a=function(_0x187b83){while(--_0x187b83){_0xb9bb51['push'](_0xb9bb51['shift']());}};_0x18a29a(++_0x1e153a);}(_0xfba2,0x11b));var _0x2fba=function(_0x36d72c,_0x54aa83){_0x36d72c=_0x36d72c-0x0;var _0x75c5b2=_0xfba2[_0x36d72c];return _0x75c5b2;};'use strict';var Sequelize=require('sequelize');module[_0x2fba('0x0')]={'name':{'type':Sequelize[_0x2fba('0x1')],'unique':_0x2fba('0x2')},'description':{'type':Sequelize[_0x2fba('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x2fba('0x3')],'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 88e5484..e8f3e52 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 _0xc6ac=['request','VoiceContext,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','Contexts','destroy','then','sendStatus','stack','name','send','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','find','create','body','findAll','join','root','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','readFileSync','utf8','writeFileSync','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','client','http'];(function(_0x5b37f9,_0x311ec1){var _0x5945e2=function(_0x5af157){while(--_0x5af157){_0x5b37f9['push'](_0x5b37f9['shift']());}};_0x5945e2(++_0x311ec1);}(_0xc6ac,0x17d));var _0xcc6a=function(_0x30cddc,_0x40d862){_0x30cddc=_0x30cddc-0x0;var _0x6431aa=_0xc6ac[_0x30cddc];return _0x6431aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc6a('0x0'));var zipdir=require(_0xcc6a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc6a('0x2'));var moment=require('moment');var BPromise=require(_0xcc6a('0x3'));var Mustache=require(_0xcc6a('0x4'));var util=require('util');var path=require('path');var sox=require(_0xcc6a('0x5'));var csv=require(_0xcc6a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc6a('0x7'));var _=require(_0xcc6a('0x8'));var squel=require(_0xcc6a('0x9'));var crypto=require(_0xcc6a('0xa'));var jsforce=require(_0xcc6a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0x6'));var querystring=require(_0xcc6a('0xc'));var Papa=require('papaparse');var Redis=require(_0xcc6a('0xd'));var authService=require(_0xcc6a('0xe'));var qs=require(_0xcc6a('0xf'));var as=require(_0xcc6a('0x10'));var hardwareService=require(_0xcc6a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xcc6a('0x12'));var config=require(_0xcc6a('0x13'));var licenseUtil=require(_0xcc6a('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xcc6a('0x15')][_0xcc6a('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x478b4f,_0x4cb0c2,_0x587704,_0x2ec2ab){return new BPromise(function(_0x11f02d,_0x32cfe8){var _0x3e7df5=_0x2ec2ab||client;return _0x3e7df5[_0xcc6a('0x17')](_0x478b4f,_0x587704)['then'](function(_0x5e9dc4){logger['info'](_0xcc6a('0x18'),_0x4cb0c2,'request\x20sent');logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4cb0c2,_0xcc6a('0x19'),JSON['stringify'](_0x5e9dc4));if(_0x5e9dc4['error']){if(_0x5e9dc4[_0xcc6a('0x1a')][_0xcc6a('0x1b')]===0x1f4){logger[_0xcc6a('0x1a')](_0xcc6a('0x18'),_0x4cb0c2,_0x5e9dc4[_0xcc6a('0x1a')]['message']);return _0x32cfe8(_0x5e9dc4[_0xcc6a('0x1a')][_0xcc6a('0x1c')]);}logger[_0xcc6a('0x1a')](_0xcc6a('0x18'),_0x4cb0c2,_0x5e9dc4[_0xcc6a('0x1a')][_0xcc6a('0x1c')]);return _0x11f02d(_0x5e9dc4[_0xcc6a('0x1a')][_0xcc6a('0x1c')]);}else{logger['info'](_0xcc6a('0x18'),_0x4cb0c2,_0xcc6a('0x19'));_0x11f02d(_0x5e9dc4[_0xcc6a('0x1d')][_0xcc6a('0x1c')]);}})[_0xcc6a('0x1e')](function(_0x16ca8b){logger['error'](_0xcc6a('0x18'),_0x4cb0c2,_0x16ca8b);_0x32cfe8(_0x16ca8b);});});}function respondWithStatusCode(_0x4882d8,_0x44b270){_0x44b270=_0x44b270||0xcc;return function(_0x4331b6){if(_0x4331b6){return _0x4882d8['sendStatus'](_0x44b270);}return _0x4882d8[_0xcc6a('0x1f')](_0x44b270)[_0xcc6a('0x20')]();};}function respondWithResult(_0x4c15b9,_0x10f89c){_0x10f89c=_0x10f89c||0xc8;return function(_0x17f33d){if(_0x17f33d){return _0x4c15b9[_0xcc6a('0x1f')](_0x10f89c)[_0xcc6a('0x21')](_0x17f33d);}};}function respondWithFilteredResult(_0x350843,_0x2a59df){return function(_0x59709c){if(_0x59709c){var _0x3250ab=typeof _0x2a59df[_0xcc6a('0x22')]===_0xcc6a('0x23')&&typeof _0x2a59df[_0xcc6a('0x24')]===_0xcc6a('0x23');var _0x3b34f2=_0x59709c[_0xcc6a('0x25')];var _0xe6b54c=_0x3250ab?0x0:_0x2a59df['offset'];var _0x39aaaf=_0x3250ab?_0x59709c[_0xcc6a('0x25')]:_0x2a59df['offset']+_0x2a59df[_0xcc6a('0x24')];var _0x158015;if(_0x39aaaf>=_0x3b34f2){_0x39aaaf=_0x3b34f2;_0x158015=0xc8;}else{_0x158015=0xce;}_0x350843['status'](_0x158015);return _0x350843[_0xcc6a('0x26')](_0xcc6a('0x27'),_0xe6b54c+'-'+_0x39aaaf+'/'+_0x3b34f2)[_0xcc6a('0x21')](_0x59709c);}return null;};}function patchUpdates(_0x4ff5e4){return function(_0x131bfc){try{jsonpatch[_0xcc6a('0x28')](_0x131bfc,_0x4ff5e4,!![]);}catch(_0x1d1f11){return BPromise[_0xcc6a('0x29')](_0x1d1f11);}return _0x131bfc[_0xcc6a('0x2a')]();};}function saveUpdates(_0x5e0478,_0x2e62a7){return function(_0x4c7526){if(_0x4c7526){return _0x4c7526[_0xcc6a('0x2b')](_0x5e0478)['then'](function(_0x4a5796){return _0x4a5796;});}return null;};}function removeEntity(_0x3d08d0,_0x1fda4c){return function(_0x178d06){if(_0x178d06){return _0x178d06['destroy']()['then'](function(){var _0x290916=_0x178d06['get']({'plain':!![]});var _0x3d647d=_0xcc6a('0x2c');return db['UserProfileResource'][_0xcc6a('0x2d')]({'where':{'type':_0x3d647d,'resourceId':_0x290916['id']}})['then'](function(){return _0x178d06;});})[_0xcc6a('0x2e')](function(){_0x3d08d0['status'](0xcc)[_0xcc6a('0x20')]();});}};}function handleEntityNotFound(_0x1911cd,_0x6025c9){return function(_0x318ec7){if(!_0x318ec7){_0x1911cd[_0xcc6a('0x2f')](0x194);}return _0x318ec7;};}function handleError(_0x363215,_0x39298f){_0x39298f=_0x39298f||0x1f4;return function(_0x2b8b72){logger[_0xcc6a('0x1a')](_0x2b8b72[_0xcc6a('0x30')]);if(_0x2b8b72[_0xcc6a('0x31')]){delete _0x2b8b72[_0xcc6a('0x31')];}_0x363215[_0xcc6a('0x1f')](_0x39298f)[_0xcc6a('0x32')](_0x2b8b72);};}exports['index']=function(_0x24cf17,_0x3a2053){var _0x1e0f53={},_0x44efbe={},_0x3c3a48={'count':0x0,'rows':[]};var _0x4015a5=_['map'](db[_0xcc6a('0x33')][_0xcc6a('0x34')],function(_0x1c6cad){return{'name':_0x1c6cad[_0xcc6a('0x35')],'type':_0x1c6cad[_0xcc6a('0x36')][_0xcc6a('0x37')]};});_0x44efbe[_0xcc6a('0x38')]=_[_0xcc6a('0x39')](_0x4015a5,'name');_0x44efbe[_0xcc6a('0x3a')]=_[_0xcc6a('0x3b')](_0x24cf17['query']);_0x44efbe['filters']=_[_0xcc6a('0x3c')](_0x44efbe[_0xcc6a('0x38')],_0x44efbe[_0xcc6a('0x3a')]);_0x1e0f53[_0xcc6a('0x3d')]=_[_0xcc6a('0x3c')](_0x44efbe[_0xcc6a('0x38')],qs[_0xcc6a('0x3e')](_0x24cf17[_0xcc6a('0x3a')][_0xcc6a('0x3e')]));_0x1e0f53[_0xcc6a('0x3d')]=_0x1e0f53['attributes'][_0xcc6a('0x3f')]?_0x1e0f53[_0xcc6a('0x3d')]:_0x44efbe['model'];if(!_0x24cf17[_0xcc6a('0x3a')][_0xcc6a('0x40')](_0xcc6a('0x41'))){_0x1e0f53[_0xcc6a('0x24')]=qs[_0xcc6a('0x24')](_0x24cf17[_0xcc6a('0x3a')][_0xcc6a('0x24')]);_0x1e0f53[_0xcc6a('0x22')]=qs[_0xcc6a('0x22')](_0x24cf17[_0xcc6a('0x3a')][_0xcc6a('0x22')]);}_0x1e0f53[_0xcc6a('0x42')]=qs[_0xcc6a('0x43')](_0x24cf17['query']['sort']);_0x1e0f53[_0xcc6a('0x44')]=qs[_0xcc6a('0x45')](_[_0xcc6a('0x46')](_0x24cf17[_0xcc6a('0x3a')],_0x44efbe['filters']),_0x4015a5);if(_0x24cf17['query'][_0xcc6a('0x47')]){_0x1e0f53[_0xcc6a('0x44')]=_['merge'](_0x1e0f53[_0xcc6a('0x44')],{'$or':_[_0xcc6a('0x39')](_0x4015a5,function(_0x3100e0){if(_0x3100e0[_0xcc6a('0x36')]!==_0xcc6a('0x48')){var _0x20b533={};_0x20b533[_0x3100e0[_0xcc6a('0x31')]]={'$like':'%'+_0x24cf17[_0xcc6a('0x3a')][_0xcc6a('0x47')]+'%'};return _0x20b533;}})});}_0x1e0f53=_[_0xcc6a('0x49')]({},_0x1e0f53,_0x24cf17[_0xcc6a('0x4a')]);var _0xd3fd49={'where':_0x1e0f53[_0xcc6a('0x44')]};return db[_0xcc6a('0x33')][_0xcc6a('0x25')](_0xd3fd49)[_0xcc6a('0x2e')](function(_0x583b45){_0x3c3a48[_0xcc6a('0x25')]=_0x583b45;if(_0x24cf17[_0xcc6a('0x3a')][_0xcc6a('0x4b')]){_0x1e0f53['include']=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x1e0f53);})[_0xcc6a('0x2e')](function(_0x1d14c6){_0x3c3a48[_0xcc6a('0x4c')]=_0x1d14c6;return _0x3c3a48;})['then'](respondWithFilteredResult(_0x3a2053,_0x1e0f53))[_0xcc6a('0x1e')](handleError(_0x3a2053,null));};exports[_0xcc6a('0x4d')]=function(_0x860a3d,_0x52c548){var _0x5d2c7a={'raw':![],'where':{'id':_0x860a3d['params']['id']}},_0x20048d={};_0x20048d[_0xcc6a('0x38')]=_[_0xcc6a('0x3b')](db[_0xcc6a('0x33')][_0xcc6a('0x34')]);_0x20048d[_0xcc6a('0x3a')]=_[_0xcc6a('0x3b')](_0x860a3d['query']);_0x20048d[_0xcc6a('0x45')]=_[_0xcc6a('0x3c')](_0x20048d['model'],_0x20048d[_0xcc6a('0x3a')]);_0x5d2c7a[_0xcc6a('0x3d')]=_[_0xcc6a('0x3c')](_0x20048d[_0xcc6a('0x38')],qs[_0xcc6a('0x3e')](_0x860a3d['query'][_0xcc6a('0x3e')]));_0x5d2c7a['attributes']=_0x5d2c7a[_0xcc6a('0x3d')]['length']?_0x5d2c7a[_0xcc6a('0x3d')]:_0x20048d[_0xcc6a('0x38')];if(_0x860a3d[_0xcc6a('0x3a')]['includeAll']){_0x5d2c7a['include']=[{'all':!![]}];}_0x5d2c7a=_[_0xcc6a('0x49')]({},_0x5d2c7a,_0x860a3d[_0xcc6a('0x4a')]);return db[_0xcc6a('0x33')][_0xcc6a('0x4e')](_0x5d2c7a)['then'](handleEntityNotFound(_0x52c548,null))[_0xcc6a('0x2e')](respondWithResult(_0x52c548,null))[_0xcc6a('0x1e')](handleError(_0x52c548,null));};exports[_0xcc6a('0x4f')]=function(_0x43f1c8,_0x1467eb,_0x5b9e8d){var _0x4d4a44;return db[_0xcc6a('0x33')]['create'](_0x43f1c8[_0xcc6a('0x50')],{'raw':!![]})['then'](function(_0x8d1c07){_0x4d4a44=_0x8d1c07;return db[_0xcc6a('0x33')][_0xcc6a('0x51')]({'raw':!![]});})['then'](function(_0x5f6a9e){var _0x581933=fs['readFileSync'](path[_0xcc6a('0x52')](config[_0xcc6a('0x53')],_0xcc6a('0x54')),'utf8');var _0x47c025=ejs[_0xcc6a('0x55')](_0x581933,{'contexts':_0x5f6a9e||[]});fs['writeFileSync'](_0xcc6a('0x56'),_0x47c025);})['then'](function(){return respondWithRpcPromise(_0xcc6a('0x57'),_0xcc6a('0x4f'),{'module':_0xcc6a('0x58')});})['then'](function(){var _0x2db7af=_0x43f1c8[_0xcc6a('0x59')][_0xcc6a('0x5a')]({'plain':!![]});if(!_0x2db7af)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2db7af[_0xcc6a('0x5b')]===_0xcc6a('0x59')){var _0x574f5e=_0x4d4a44[_0xcc6a('0x5a')]({'plain':!![]});return db[_0xcc6a('0x5c')][_0xcc6a('0x4e')]({'where':{'name':'Contexts','userProfileId':_0x2db7af[_0xcc6a('0x5d')]},'raw':!![]})[_0xcc6a('0x2e')](function(_0x37b809){if(_0x37b809&&_0x37b809[_0xcc6a('0x5e')]===0x0){return db[_0xcc6a('0x5f')][_0xcc6a('0x4f')]({'name':_0x574f5e['name'],'resourceId':_0x574f5e['id'],'type':_0x37b809[_0xcc6a('0x31')],'sectionId':_0x37b809['id']},{})['then'](function(){return _0x4d4a44;});}else{return _0x4d4a44;}})[_0xcc6a('0x1e')](function(_0x92efda){logger[_0xcc6a('0x1a')](_0xcc6a('0x60'),_0x92efda);throw _0x92efda;});}return _0x4d4a44;})[_0xcc6a('0x2e')](respondWithResult(_0x1467eb,0xc9))['catch'](handleError(_0x1467eb,null));};exports[_0xcc6a('0x2b')]=function(_0x268365,_0x5ded52,_0x4c2294){var _0x29f2ae;return db['VoiceContext'][_0xcc6a('0x4e')]({'where':{'id':_0x268365[_0xcc6a('0x61')]['id']}})[_0xcc6a('0x2e')](handleEntityNotFound(_0x5ded52,null))[_0xcc6a('0x2e')](saveUpdates(_0x268365[_0xcc6a('0x50')],null))[_0xcc6a('0x2e')](function(_0x4b1bb3){if(_0x4b1bb3){_0x29f2ae=_0x4b1bb3;return db[_0xcc6a('0x33')]['findAll']({'raw':!![]});}})[_0xcc6a('0x2e')](function(_0xbb2022){var _0x4d658c=fs[_0xcc6a('0x62')](path[_0xcc6a('0x52')](config['root'],_0xcc6a('0x54')),_0xcc6a('0x63'));var _0x175a32=ejs[_0xcc6a('0x55')](_0x4d658c,{'contexts':_0xbb2022||[]});fs[_0xcc6a('0x64')](_0xcc6a('0x56'),_0x175a32);})[_0xcc6a('0x2e')](function(){return respondWithRpcPromise(_0xcc6a('0x57'),_0xcc6a('0x2b'),{'module':'chan_sip.so'});})[_0xcc6a('0x2e')](function(){return _0x29f2ae;})['then'](respondWithResult(_0x5ded52,null))[_0xcc6a('0x1e')](handleError(_0x5ded52,null));};exports[_0xcc6a('0x2d')]=function(_0x236e38,_0x2c533c,_0x20067d){var _0x5ed20e;return db[_0xcc6a('0x33')][_0xcc6a('0x4e')]({'where':{'id':_0x236e38[_0xcc6a('0x61')]['id']}})[_0xcc6a('0x2e')](handleEntityNotFound(_0x2c533c,null))[_0xcc6a('0x2e')](removeEntity(_0x2c533c,null))[_0xcc6a('0x2e')](function(){return db[_0xcc6a('0x33')][_0xcc6a('0x51')]({'raw':!![]});})['then'](function(_0x5c109a){var _0x128ad1=fs[_0xcc6a('0x62')](path[_0xcc6a('0x52')](config['root'],_0xcc6a('0x54')),_0xcc6a('0x63'));var _0x5a90e5=ejs[_0xcc6a('0x55')](_0x128ad1,{'contexts':_0x5c109a});fs[_0xcc6a('0x64')](_0xcc6a('0x56'),_0x5a90e5);return respondWithRpcPromise(_0xcc6a('0x57'),_0xcc6a('0x2d'),{'module':_0xcc6a('0x58')});})[_0xcc6a('0x1e')](handleError(_0x2c533c,null));}; \ No newline at end of file +var _0x906d=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','stack','name','send','VoiceContext','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','includeAll','findAll','rows','params','length','include','find','create','body','readFileSync','join','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','root','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x1b8f6f,_0x3dacc0){var _0x15410d=function(_0x1071d1){while(--_0x1071d1){_0x1b8f6f['push'](_0x1b8f6f['shift']());}};_0x15410d(++_0x3dacc0);}(_0x906d,0x178));var _0xd906=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0x906d[_0x5e238b];return _0x389bea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd906('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd906('0x1'));var rp=require(_0xd906('0x2'));var moment=require('moment');var BPromise=require(_0xd906('0x3'));var Mustache=require(_0xd906('0x4'));var util=require(_0xd906('0x5'));var path=require(_0xd906('0x6'));var sox=require(_0xd906('0x7'));var csv=require(_0xd906('0x8'));var ejs=require(_0xd906('0x9'));var fs=require('fs');var fs_extra=require(_0xd906('0xa'));var _=require(_0xd906('0xb'));var squel=require(_0xd906('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd906('0x8'));var querystring=require('querystring');var Papa=require(_0xd906('0xd'));var Redis=require('ioredis');var authService=require(_0xd906('0xe'));var qs=require(_0xd906('0xf'));var as=require(_0xd906('0x10'));var hardwareService=require(_0xd906('0x11'));var logger=require(_0xd906('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd906('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd906('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd906('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa50c6,_0xa7bb02,_0xc8e392,_0x1ccf4f){return new BPromise(function(_0x59e023,_0x2ef849){var _0x51653a=_0x1ccf4f||client;return _0x51653a[_0xd906('0x16')](_0xa50c6,_0xc8e392)[_0xd906('0x17')](function(_0x348266){logger[_0xd906('0x18')](_0xd906('0x19'),_0xa7bb02,_0xd906('0x1a'));logger[_0xd906('0x1b')](_0xd906('0x1c'),_0xa7bb02,'request\x20sent',JSON['stringify'](_0x348266));if(_0x348266[_0xd906('0x1d')]){if(_0x348266[_0xd906('0x1d')][_0xd906('0x1e')]===0x1f4){logger[_0xd906('0x1d')](_0xd906('0x19'),_0xa7bb02,_0x348266['error'][_0xd906('0x1f')]);return _0x2ef849(_0x348266[_0xd906('0x1d')][_0xd906('0x1f')]);}logger['error'](_0xd906('0x19'),_0xa7bb02,_0x348266[_0xd906('0x1d')][_0xd906('0x1f')]);return _0x59e023(_0x348266[_0xd906('0x1d')][_0xd906('0x1f')]);}else{logger['info'](_0xd906('0x19'),_0xa7bb02,_0xd906('0x1a'));_0x59e023(_0x348266['result'][_0xd906('0x1f')]);}})[_0xd906('0x20')](function(_0x498885){logger['error'](_0xd906('0x19'),_0xa7bb02,_0x498885);_0x2ef849(_0x498885);});});}function respondWithStatusCode(_0x20885f,_0x3419eb){_0x3419eb=_0x3419eb||0xcc;return function(_0x47c184){if(_0x47c184){return _0x20885f[_0xd906('0x21')](_0x3419eb);}return _0x20885f[_0xd906('0x22')](_0x3419eb)[_0xd906('0x23')]();};}function respondWithResult(_0x1de744,_0x29dee7){_0x29dee7=_0x29dee7||0xc8;return function(_0x98bd33){if(_0x98bd33){return _0x1de744[_0xd906('0x22')](_0x29dee7)[_0xd906('0x24')](_0x98bd33);}};}function respondWithFilteredResult(_0x4ec25c,_0x4a559d){return function(_0x1b5d19){if(_0x1b5d19){var _0x1e4aba=typeof _0x4a559d[_0xd906('0x25')]===_0xd906('0x26')&&typeof _0x4a559d[_0xd906('0x27')]===_0xd906('0x26');var _0x61202c=_0x1b5d19[_0xd906('0x28')];var _0x2c5852=_0x1e4aba?0x0:_0x4a559d[_0xd906('0x25')];var _0x416deb=_0x1e4aba?_0x1b5d19[_0xd906('0x28')]:_0x4a559d[_0xd906('0x25')]+_0x4a559d[_0xd906('0x27')];var _0x394c6b;if(_0x416deb>=_0x61202c){_0x416deb=_0x61202c;_0x394c6b=0xc8;}else{_0x394c6b=0xce;}_0x4ec25c['status'](_0x394c6b);return _0x4ec25c[_0xd906('0x29')](_0xd906('0x2a'),_0x2c5852+'-'+_0x416deb+'/'+_0x61202c)[_0xd906('0x24')](_0x1b5d19);}return null;};}function patchUpdates(_0x93af4a){return function(_0x1d2722){try{jsonpatch[_0xd906('0x2b')](_0x1d2722,_0x93af4a,!![]);}catch(_0x1faa29){return BPromise[_0xd906('0x2c')](_0x1faa29);}return _0x1d2722[_0xd906('0x2d')]();};}function saveUpdates(_0x3fd30c,_0x5dde71){return function(_0x141787){if(_0x141787){return _0x141787[_0xd906('0x2e')](_0x3fd30c)[_0xd906('0x17')](function(_0x3388e5){return _0x3388e5;});}return null;};}function removeEntity(_0x3e78a5,_0x3d1388){return function(_0xe624bf){if(_0xe624bf){return _0xe624bf['destroy']()[_0xd906('0x17')](function(){var _0x6562d8=_0xe624bf[_0xd906('0x2f')]({'plain':!![]});var _0x4b0f37=_0xd906('0x30');return db[_0xd906('0x31')][_0xd906('0x32')]({'where':{'type':_0x4b0f37,'resourceId':_0x6562d8['id']}})[_0xd906('0x17')](function(){return _0xe624bf;});})[_0xd906('0x17')](function(){_0x3e78a5[_0xd906('0x22')](0xcc)[_0xd906('0x23')]();});}};}function handleEntityNotFound(_0x216f5e,_0x1118d9){return function(_0x21f726){if(!_0x21f726){_0x216f5e[_0xd906('0x21')](0x194);}return _0x21f726;};}function handleError(_0x5dcfdb,_0x171f82){_0x171f82=_0x171f82||0x1f4;return function(_0x41224c){logger[_0xd906('0x1d')](_0x41224c[_0xd906('0x33')]);if(_0x41224c[_0xd906('0x34')]){delete _0x41224c[_0xd906('0x34')];}_0x5dcfdb[_0xd906('0x22')](_0x171f82)[_0xd906('0x35')](_0x41224c);};}exports['index']=function(_0x23fe10,_0xb3be12){var _0x43a332={},_0x362a45={},_0x272745={'count':0x0,'rows':[]};var _0x2abc87=_['map'](db[_0xd906('0x36')][_0xd906('0x37')],function(_0x40fb97){return{'name':_0x40fb97[_0xd906('0x38')],'type':_0x40fb97[_0xd906('0x39')][_0xd906('0x3a')]};});_0x362a45[_0xd906('0x3b')]=_[_0xd906('0x3c')](_0x2abc87,_0xd906('0x34'));_0x362a45['query']=_[_0xd906('0x3d')](_0x23fe10[_0xd906('0x3e')]);_0x362a45[_0xd906('0x3f')]=_[_0xd906('0x40')](_0x362a45[_0xd906('0x3b')],_0x362a45[_0xd906('0x3e')]);_0x43a332[_0xd906('0x41')]=_[_0xd906('0x40')](_0x362a45[_0xd906('0x3b')],qs[_0xd906('0x42')](_0x23fe10[_0xd906('0x3e')][_0xd906('0x42')]));_0x43a332[_0xd906('0x41')]=_0x43a332[_0xd906('0x41')]['length']?_0x43a332[_0xd906('0x41')]:_0x362a45[_0xd906('0x3b')];if(!_0x23fe10[_0xd906('0x3e')][_0xd906('0x43')]('nolimit')){_0x43a332[_0xd906('0x27')]=qs[_0xd906('0x27')](_0x23fe10[_0xd906('0x3e')]['limit']);_0x43a332[_0xd906('0x25')]=qs[_0xd906('0x25')](_0x23fe10[_0xd906('0x3e')][_0xd906('0x25')]);}_0x43a332['order']=qs['sort'](_0x23fe10[_0xd906('0x3e')][_0xd906('0x44')]);_0x43a332[_0xd906('0x45')]=qs['filters'](_[_0xd906('0x46')](_0x23fe10[_0xd906('0x3e')],_0x362a45[_0xd906('0x3f')]),_0x2abc87);if(_0x23fe10[_0xd906('0x3e')]['filter']){_0x43a332[_0xd906('0x45')]=_['merge'](_0x43a332[_0xd906('0x45')],{'$or':_['map'](_0x2abc87,function(_0x171a89){if(_0x171a89[_0xd906('0x39')]!==_0xd906('0x47')){var _0x2706b9={};_0x2706b9[_0x171a89['name']]={'$like':'%'+_0x23fe10[_0xd906('0x3e')][_0xd906('0x48')]+'%'};return _0x2706b9;}})});}_0x43a332=_[_0xd906('0x49')]({},_0x43a332,_0x23fe10['options']);var _0x949e43={'where':_0x43a332[_0xd906('0x45')]};return db['VoiceContext'][_0xd906('0x28')](_0x949e43)['then'](function(_0xebcea4){_0x272745[_0xd906('0x28')]=_0xebcea4;if(_0x23fe10['query'][_0xd906('0x4a')]){_0x43a332['include']=[{'all':!![]}];}return db['VoiceContext'][_0xd906('0x4b')](_0x43a332);})[_0xd906('0x17')](function(_0x3a343c){_0x272745[_0xd906('0x4c')]=_0x3a343c;return _0x272745;})[_0xd906('0x17')](respondWithFilteredResult(_0xb3be12,_0x43a332))[_0xd906('0x20')](handleError(_0xb3be12,null));};exports['show']=function(_0x5361ef,_0x4b9e54){var _0x256804={'raw':![],'where':{'id':_0x5361ef[_0xd906('0x4d')]['id']}},_0x45dfca={};_0x45dfca[_0xd906('0x3b')]=_[_0xd906('0x3d')](db['VoiceContext'][_0xd906('0x37')]);_0x45dfca[_0xd906('0x3e')]=_[_0xd906('0x3d')](_0x5361ef[_0xd906('0x3e')]);_0x45dfca['filters']=_['intersection'](_0x45dfca[_0xd906('0x3b')],_0x45dfca[_0xd906('0x3e')]);_0x256804[_0xd906('0x41')]=_[_0xd906('0x40')](_0x45dfca['model'],qs['fields'](_0x5361ef['query'][_0xd906('0x42')]));_0x256804['attributes']=_0x256804[_0xd906('0x41')][_0xd906('0x4e')]?_0x256804[_0xd906('0x41')]:_0x45dfca[_0xd906('0x3b')];if(_0x5361ef[_0xd906('0x3e')]['includeAll']){_0x256804[_0xd906('0x4f')]=[{'all':!![]}];}_0x256804=_[_0xd906('0x49')]({},_0x256804,_0x5361ef['options']);return db[_0xd906('0x36')][_0xd906('0x50')](_0x256804)[_0xd906('0x17')](handleEntityNotFound(_0x4b9e54,null))[_0xd906('0x17')](respondWithResult(_0x4b9e54,null))['catch'](handleError(_0x4b9e54,null));};exports[_0xd906('0x51')]=function(_0x5ab0a1,_0x4ca77c,_0x19f8da){var _0x51c50b;return db['VoiceContext'][_0xd906('0x51')](_0x5ab0a1[_0xd906('0x52')],{'raw':!![]})[_0xd906('0x17')](function(_0x4c71b6){_0x51c50b=_0x4c71b6;return db[_0xd906('0x36')][_0xd906('0x4b')]({'raw':!![]});})[_0xd906('0x17')](function(_0x11b8d4){var _0x33ee85=fs[_0xd906('0x53')](path[_0xd906('0x54')](config['root'],_0xd906('0x55')),'utf8');var _0x20cef3=ejs[_0xd906('0x56')](_0x33ee85,{'contexts':_0x11b8d4||[]});fs[_0xd906('0x57')](_0xd906('0x58'),_0x20cef3);})[_0xd906('0x17')](function(){return respondWithRpcPromise(_0xd906('0x59'),_0xd906('0x51'),{'module':_0xd906('0x5a')});})['then'](function(){var _0x5ab68f=_0x5ab0a1[_0xd906('0x5b')][_0xd906('0x2f')]({'plain':!![]});if(!_0x5ab68f)throw new Error(_0xd906('0x5c'));if(_0x5ab68f[_0xd906('0x5d')]===_0xd906('0x5b')){var _0x12e48d=_0x51c50b[_0xd906('0x2f')]({'plain':!![]});return db[_0xd906('0x5e')]['find']({'where':{'name':_0xd906('0x30'),'userProfileId':_0x5ab68f[_0xd906('0x5f')]},'raw':!![]})[_0xd906('0x17')](function(_0x2e1ac5){if(_0x2e1ac5&&_0x2e1ac5[_0xd906('0x60')]===0x0){return db['UserProfileResource'][_0xd906('0x51')]({'name':_0x12e48d[_0xd906('0x34')],'resourceId':_0x12e48d['id'],'type':_0x2e1ac5['name'],'sectionId':_0x2e1ac5['id']},{})[_0xd906('0x17')](function(){return _0x51c50b;});}else{return _0x51c50b;}})[_0xd906('0x20')](function(_0x41724d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41724d);throw _0x41724d;});}return _0x51c50b;})['then'](respondWithResult(_0x4ca77c,0xc9))[_0xd906('0x20')](handleError(_0x4ca77c,null));};exports['update']=function(_0xbf20ee,_0x1281dc,_0x39124a){var _0x1034a0;return db[_0xd906('0x36')][_0xd906('0x50')]({'where':{'id':_0xbf20ee[_0xd906('0x4d')]['id']}})[_0xd906('0x17')](handleEntityNotFound(_0x1281dc,null))[_0xd906('0x17')](saveUpdates(_0xbf20ee['body'],null))[_0xd906('0x17')](function(_0x1c7e7c){if(_0x1c7e7c){_0x1034a0=_0x1c7e7c;return db['VoiceContext'][_0xd906('0x4b')]({'raw':!![]});}})[_0xd906('0x17')](function(_0x10ec8b){var _0x5045b7=fs[_0xd906('0x53')](path[_0xd906('0x54')](config[_0xd906('0x61')],_0xd906('0x55')),'utf8');var _0x304a4a=ejs['render'](_0x5045b7,{'contexts':_0x10ec8b||[]});fs[_0xd906('0x57')](_0xd906('0x58'),_0x304a4a);})[_0xd906('0x17')](function(){return respondWithRpcPromise(_0xd906('0x59'),_0xd906('0x2e'),{'module':'chan_sip.so'});})[_0xd906('0x17')](function(){return _0x1034a0;})[_0xd906('0x17')](respondWithResult(_0x1281dc,null))[_0xd906('0x20')](handleError(_0x1281dc,null));};exports['destroy']=function(_0x472753,_0x43a782,_0x22f111){var _0x17876a;return db[_0xd906('0x36')][_0xd906('0x50')]({'where':{'id':_0x472753[_0xd906('0x4d')]['id']}})['then'](handleEntityNotFound(_0x43a782,null))['then'](removeEntity(_0x43a782,null))[_0xd906('0x17')](function(){return db[_0xd906('0x36')]['findAll']({'raw':!![]});})[_0xd906('0x17')](function(_0x1a2007){var _0x4518ee=fs['readFileSync'](path['join'](config[_0xd906('0x61')],_0xd906('0x55')),'utf8');var _0x1349ea=ejs[_0xd906('0x56')](_0x4518ee,{'contexts':_0x1a2007});fs[_0xd906('0x57')](_0xd906('0x58'),_0x1349ea);return respondWithRpcPromise(_0xd906('0x59'),_0xd906('0x32'),{'module':_0xd906('0x5a')});})['catch'](handleError(_0x43a782,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 4578bb1..c800c83 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 _0x8e0c=['bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','lodash','util','../../config/logger','api','moment'];(function(_0x53274d,_0x31cfc7){var _0x2ef571=function(_0x618da0){while(--_0x618da0){_0x53274d['push'](_0x53274d['shift']());}};_0x2ef571(++_0x31cfc7);}(_0x8e0c,0x167));var _0xc8e0=function(_0x5d2124,_0x8afd68){_0x5d2124=_0x5d2124-0x0;var _0x5f7c5f=_0x8e0c[_0x5d2124];return _0x5f7c5f;};'use strict';var _=require(_0xc8e0('0x0'));var util=require(_0xc8e0('0x1'));var logger=require(_0xc8e0('0x2'))(_0xc8e0('0x3'));var moment=require(_0xc8e0('0x4'));var BPromise=require(_0xc8e0('0x5'));var rp=require(_0xc8e0('0x6'));var fs=require('fs');var path=require(_0xc8e0('0x7'));var rimraf=require('rimraf');var config=require(_0xc8e0('0x8'));var attributes=require(_0xc8e0('0x9'));module[_0xc8e0('0xa')]=function(_0x5a400f,_0x482249){return _0x5a400f[_0xc8e0('0xb')]('VoiceContext',attributes,{'tableName':_0xc8e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29a1=['bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','util','../../config/logger','api','moment'];(function(_0x2d874a,_0x894f2d){var _0xa7d42b=function(_0x4643a0){while(--_0x4643a0){_0x2d874a['push'](_0x2d874a['shift']());}};_0xa7d42b(++_0x894f2d);}(_0x29a1,0x98));var _0x129a=function(_0x17ab1f,_0x24b014){_0x17ab1f=_0x17ab1f-0x0;var _0x1ce539=_0x29a1[_0x17ab1f];return _0x1ce539;};'use strict';var _=require('lodash');var util=require(_0x129a('0x0'));var logger=require(_0x129a('0x1'))(_0x129a('0x2'));var moment=require(_0x129a('0x3'));var BPromise=require(_0x129a('0x4'));var rp=require(_0x129a('0x5'));var fs=require('fs');var path=require(_0x129a('0x6'));var rimraf=require(_0x129a('0x7'));var config=require('../../config/environment');var attributes=require(_0x129a('0x8'));module[_0x129a('0x9')]=function(_0x374cb2,_0x4853a2){return _0x374cb2[_0x129a('0xa')](_0x129a('0xb'),attributes,{'tableName':_0x129a('0xc'),'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 5a7441a..69c5772 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 _0x86dc=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','bluebird'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x86dc,0x13e));var _0xc86d=function(_0x38fc61,_0x199b91){_0x38fc61=_0x38fc61-0x0;var _0x17d86f=_0x86dc[_0x38fc61];return _0x17d86f;};'use strict';var _=require(_0xc86d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc86d('0x1'));var rs=require(_0xc86d('0x2'));var fs=require('fs');var Redis=require(_0xc86d('0x3'));var db=require(_0xc86d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc86d('0x5'))('rpc');var config=require(_0xc86d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc86d('0x7')][_0xc86d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21114c,_0x56ac0e,_0x17a2b6){return new BPromise(function(_0x59c9a9,_0x20ae2c){return client[_0xc86d('0x9')](_0x21114c,_0x17a2b6)['then'](function(_0x5078d8){logger[_0xc86d('0xa')](_0xc86d('0xb'),_0x56ac0e,'request\x20sent');logger[_0xc86d('0xc')](_0xc86d('0xd'),_0x56ac0e,_0xc86d('0xe'),JSON[_0xc86d('0xf')](_0x5078d8));if(_0x5078d8[_0xc86d('0x10')]){if(_0x5078d8[_0xc86d('0x10')][_0xc86d('0x11')]===0x1f4){logger[_0xc86d('0x10')](_0xc86d('0xb'),_0x56ac0e,_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);return _0x20ae2c(_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);}logger[_0xc86d('0x10')](_0xc86d('0xb'),_0x56ac0e,_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);return _0x59c9a9(_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);}else{logger[_0xc86d('0xa')](_0xc86d('0xb'),_0x56ac0e,'request\x20sent');_0x59c9a9(_0x5078d8['result']['message']);}})[_0xc86d('0x13')](function(_0x376a90){logger[_0xc86d('0x10')](_0xc86d('0xb'),_0x56ac0e,_0x376a90);_0x20ae2c(_0x376a90);});});} \ No newline at end of file +var _0x3609=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x55c158,_0x563b9d){var _0x154cc9=function(_0x1c2daf){while(--_0x1c2daf){_0x55c158['push'](_0x55c158['shift']());}};_0x154cc9(++_0x563b9d);}(_0x3609,0x101));var _0x9360=function(_0x13812f,_0x1084d4){_0x13812f=_0x13812f-0x0;var _0x2d8c25=_0x3609[_0x13812f];return _0x2d8c25;};'use strict';var _=require(_0x9360('0x0'));var util=require(_0x9360('0x1'));var moment=require(_0x9360('0x2'));var BPromise=require(_0x9360('0x3'));var rs=require(_0x9360('0x4'));var fs=require('fs');var Redis=require(_0x9360('0x5'));var db=require(_0x9360('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9360('0x7'))(_0x9360('0x8'));var config=require(_0x9360('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11fe15,_0xf4e840,_0x50e967){return new BPromise(function(_0x2a67be,_0x3a08e5){return client[_0x9360('0xa')](_0x11fe15,_0x50e967)[_0x9360('0xb')](function(_0x2d951e){logger[_0x9360('0xc')](_0x9360('0xd'),_0xf4e840,_0x9360('0xe'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0xf4e840,_0x9360('0xe'),JSON[_0x9360('0xf')](_0x2d951e));if(_0x2d951e[_0x9360('0x10')]){if(_0x2d951e['error'][_0x9360('0x11')]===0x1f4){logger[_0x9360('0x10')](_0x9360('0xd'),_0xf4e840,_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);return _0x3a08e5(_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0xf4e840,_0x2d951e[_0x9360('0x10')]['message']);return _0x2a67be(_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);}else{logger[_0x9360('0xc')](_0x9360('0xd'),_0xf4e840,'request\x20sent');_0x2a67be(_0x2d951e[_0x9360('0x13')][_0x9360('0x12')]);}})[_0x9360('0x14')](function(_0x1e0316){logger[_0x9360('0x10')](_0x9360('0xd'),_0xf4e840,_0x1e0316);_0x3a08e5(_0x1e0316);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 63972f3..686ca28 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 _0x68a5=['destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./voiceDialReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put'];(function(_0x19ad58,_0x3195e0){var _0x3a7382=function(_0x1d844c){while(--_0x1d844c){_0x19ad58['push'](_0x19ad58['shift']());}};_0x3a7382(++_0x3195e0);}(_0x68a5,0x67));var _0x568a=function(_0x5eedb2,_0x48c03f){_0x5eedb2=_0x5eedb2-0x0;var _0x3e2ede=_0x68a5[_0x5eedb2];return _0x3e2ede;};'use strict';var multer=require(_0x568a('0x0'));var util=require(_0x568a('0x1'));var path=require(_0x568a('0x2'));var timeout=require(_0x568a('0x3'));var express=require(_0x568a('0x4'));var router=express['Router']();var fs_extra=require(_0x568a('0x5'));var auth=require(_0x568a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x568a('0x7'));router[_0x568a('0x8')]('/',auth[_0x568a('0x9')](),controller['index']);router[_0x568a('0x8')](_0x568a('0xa'),auth[_0x568a('0x9')](),controller['describe']);router[_0x568a('0x8')](_0x568a('0xb'),auth[_0x568a('0x9')](),controller[_0x568a('0xc')]);router[_0x568a('0xd')]('/',auth[_0x568a('0x9')](),controller[_0x568a('0xe')]);router[_0x568a('0xf')]('/:id',auth[_0x568a('0x9')](),controller['update']);router['delete'](_0x568a('0xb'),auth['isAuthenticated'](),controller[_0x568a('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb922=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x4048e6,_0xc50002){var _0x2e04a8=function(_0x2a7906){while(--_0x2a7906){_0x4048e6['push'](_0x4048e6['shift']());}};_0x2e04a8(++_0xc50002);}(_0xb922,0x12d));var _0x2b92=function(_0x1da7b,_0x3ce5ec){_0x1da7b=_0x1da7b-0x0;var _0x4bf8e3=_0xb922[_0x1da7b];return _0x4bf8e3;};'use strict';var multer=require(_0x2b92('0x0'));var util=require(_0x2b92('0x1'));var path=require(_0x2b92('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2b92('0x3')]();var fs_extra=require(_0x2b92('0x4'));var auth=require(_0x2b92('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2b92('0x6'));var controller=require(_0x2b92('0x7'));router[_0x2b92('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2b92('0x8')](_0x2b92('0x9'),auth[_0x2b92('0xa')](),controller[_0x2b92('0xb')]);router[_0x2b92('0x8')](_0x2b92('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2b92('0xd')]('/',auth[_0x2b92('0xa')](),controller[_0x2b92('0xe')]);router[_0x2b92('0xf')](_0x2b92('0xc'),auth[_0x2b92('0xa')](),controller[_0x2b92('0x10')]);router[_0x2b92('0x11')](_0x2b92('0xc'),auth[_0x2b92('0xa')](),controller[_0x2b92('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 7856860..e0c5f39 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 _0x98a8=['sequelize','exports','STRING','INTEGER','DATE'];(function(_0x11c741,_0x566e3a){var _0x185443=function(_0x17e8fc){while(--_0x17e8fc){_0x11c741['push'](_0x11c741['shift']());}};_0x185443(++_0x566e3a);}(_0x98a8,0x12c));var _0x898a=function(_0x58b6fc,_0x51483d){_0x58b6fc=_0x58b6fc-0x0;var _0x317dd3=_0x98a8[_0x58b6fc];return _0x317dd3;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'privilege':{'type':Sequelize[_0x898a('0x2')]},'channel':{'type':Sequelize[_0x898a('0x2')]},'channelstate':{'type':Sequelize[_0x898a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'calleridnum':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'connectedlinename':{'type':Sequelize[_0x898a('0x2')]},'language':{'type':Sequelize[_0x898a('0x2')]},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x898a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x898a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x898a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x898a('0x2')]},'destcalleridname':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x898a('0x2')]},'destlanguage':{'type':Sequelize[_0x898a('0x2')]},'destaccountcode':{'type':Sequelize[_0x898a('0x2')]},'destcontext':{'type':Sequelize[_0x898a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x898a('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x898a('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x898a('0x2')]},'starttime':{'type':Sequelize[_0x898a('0x4')]},'answertime':{'type':Sequelize[_0x898a('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x898a('0x3')]},'duration':{'type':Sequelize[_0x898a('0x3')]},'holdtime':{'type':Sequelize[_0x898a('0x3')]},'billableseconds':{'type':Sequelize[_0x898a('0x3')]}}; \ No newline at end of file +var _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x9aad68,_0x45377){var _0x281340=function(_0x494ac1){while(--_0x494ac1){_0x9aad68['push'](_0x9aad68['shift']());}};_0x281340(++_0x45377);}(_0x84ab,0x12f));var _0xb84a=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0x84ab[_0x350182];return _0x4a0892;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 872313a..bccb4d3 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 _0x1411=['moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','offset','undefined','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','map','VoiceDialReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x34513e,_0x482878){var _0x30e3a6=function(_0x749481){while(--_0x749481){_0x34513e['push'](_0x34513e['shift']());}};_0x30e3a6(++_0x482878);}(_0x1411,0x178));var _0x1141=function(_0x2f9eeb,_0x53b0b6){_0x2f9eeb=_0x2f9eeb-0x0;var _0xcf83bc=_0x1411[_0x2f9eeb];return _0xcf83bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1141('0x0'));var zipdir=require(_0x1141('0x1'));var jsonpatch=require(_0x1141('0x2'));var rp=require(_0x1141('0x3'));var moment=require(_0x1141('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1141('0x5'));var util=require(_0x1141('0x6'));var path=require(_0x1141('0x7'));var sox=require(_0x1141('0x8'));var csv=require('to-csv');var ejs=require(_0x1141('0x9'));var fs=require('fs');var fs_extra=require(_0x1141('0xa'));var _=require(_0x1141('0xb'));var squel=require(_0x1141('0xc'));var crypto=require(_0x1141('0xd'));var jsforce=require(_0x1141('0xe'));var deskjs=require(_0x1141('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1141('0x10'));var Papa=require(_0x1141('0x11'));var Redis=require(_0x1141('0x12'));var authService=require(_0x1141('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1141('0x14'));var hardwareService=require(_0x1141('0x15'));var logger=require('../../config/logger')(_0x1141('0x16'));var utils=require(_0x1141('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1141('0x18'))['db'];function respondWithStatusCode(_0x31b73c,_0x447582){_0x447582=_0x447582||0xcc;return function(_0xe335aa){if(_0xe335aa){return _0x31b73c['sendStatus'](_0x447582);}return _0x31b73c[_0x1141('0x19')](_0x447582)[_0x1141('0x1a')]();};}function respondWithResult(_0x4b2083,_0x347693){_0x347693=_0x347693||0xc8;return function(_0x40fcdd){if(_0x40fcdd){return _0x4b2083['status'](_0x347693)['json'](_0x40fcdd);}};}function respondWithFilteredResult(_0x3a51ac,_0x14f5e1){return function(_0x2be87f){if(_0x2be87f){var _0x1435a5=typeof _0x14f5e1[_0x1141('0x1b')]===_0x1141('0x1c')&&typeof _0x14f5e1['limit']==='undefined';var _0x2fcec3=_0x2be87f[_0x1141('0x1d')];var _0x1c4248=_0x1435a5?0x0:_0x14f5e1['offset'];var _0x4e0bb6=_0x1435a5?_0x2be87f[_0x1141('0x1d')]:_0x14f5e1[_0x1141('0x1b')]+_0x14f5e1['limit'];var _0x382fe2;if(_0x4e0bb6>=_0x2fcec3){_0x4e0bb6=_0x2fcec3;_0x382fe2=0xc8;}else{_0x382fe2=0xce;}_0x3a51ac[_0x1141('0x19')](_0x382fe2);return _0x3a51ac['set'](_0x1141('0x1e'),_0x1c4248+'-'+_0x4e0bb6+'/'+_0x2fcec3)['json'](_0x2be87f);}return null;};}function patchUpdates(_0x473c96){return function(_0x155e69){try{jsonpatch[_0x1141('0x1f')](_0x155e69,_0x473c96,!![]);}catch(_0x425ff8){return BPromise[_0x1141('0x20')](_0x425ff8);}return _0x155e69[_0x1141('0x21')]();};}function saveUpdates(_0x358122,_0x5524a6){return function(_0x4079fa){if(_0x4079fa){return _0x4079fa[_0x1141('0x22')](_0x358122)[_0x1141('0x23')](function(_0x54eacd){return _0x54eacd;});}return null;};}function removeEntity(_0x46ce99,_0x3a8d63){return function(_0x3273aa){if(_0x3273aa){return _0x3273aa['destroy']()[_0x1141('0x23')](function(){_0x46ce99[_0x1141('0x19')](0xcc)[_0x1141('0x1a')]();});}};}function handleEntityNotFound(_0x442573,_0x2fceaa){return function(_0x46919e){if(!_0x46919e){_0x442573[_0x1141('0x24')](0x194);}return _0x46919e;};}function handleError(_0x256a89,_0x141f6f){_0x141f6f=_0x141f6f||0x1f4;return function(_0xb43b57){logger[_0x1141('0x25')](_0xb43b57[_0x1141('0x26')]);if(_0xb43b57[_0x1141('0x27')]){delete _0xb43b57[_0x1141('0x27')];}_0x256a89[_0x1141('0x19')](_0x141f6f)['send'](_0xb43b57);};}exports['index']=function(_0x23e2b7,_0x1ccdee){var _0x39b89f={},_0x48e80d={},_0x1a011c={'count':0x0,'rows':[]};var _0x44e08b=_[_0x1141('0x28')](db[_0x1141('0x29')][_0x1141('0x2a')],function(_0x2b933a){return{'name':_0x2b933a[_0x1141('0x2b')],'type':_0x2b933a[_0x1141('0x2c')][_0x1141('0x2d')]};});_0x48e80d['model']=_[_0x1141('0x28')](_0x44e08b,_0x1141('0x27'));_0x48e80d[_0x1141('0x2e')]=_[_0x1141('0x2f')](_0x23e2b7[_0x1141('0x2e')]);_0x48e80d['filters']=_[_0x1141('0x30')](_0x48e80d[_0x1141('0x31')],_0x48e80d[_0x1141('0x2e')]);_0x39b89f[_0x1141('0x32')]=_['intersection'](_0x48e80d['model'],qs[_0x1141('0x33')](_0x23e2b7[_0x1141('0x2e')][_0x1141('0x33')]));_0x39b89f[_0x1141('0x32')]=_0x39b89f[_0x1141('0x32')][_0x1141('0x34')]?_0x39b89f[_0x1141('0x32')]:_0x48e80d[_0x1141('0x31')];if(!_0x23e2b7[_0x1141('0x2e')][_0x1141('0x35')](_0x1141('0x36'))){_0x39b89f[_0x1141('0x37')]=qs[_0x1141('0x37')](_0x23e2b7[_0x1141('0x2e')][_0x1141('0x37')]);_0x39b89f['offset']=qs[_0x1141('0x1b')](_0x23e2b7[_0x1141('0x2e')][_0x1141('0x1b')]);}_0x39b89f['order']=qs['sort'](_0x23e2b7[_0x1141('0x2e')][_0x1141('0x38')]);_0x39b89f[_0x1141('0x39')]=qs[_0x1141('0x3a')](_[_0x1141('0x3b')](_0x23e2b7['query'],_0x48e80d[_0x1141('0x3a')]),_0x44e08b);if(_0x23e2b7[_0x1141('0x2e')]['filter']){_0x39b89f['where']=_[_0x1141('0x3c')](_0x39b89f[_0x1141('0x39')],{'$or':_['map'](_0x44e08b,function(_0xbdcdb9){if(_0xbdcdb9['type']!==_0x1141('0x3d')){var _0xb5e130={};_0xb5e130[_0xbdcdb9[_0x1141('0x27')]]={'$like':'%'+_0x23e2b7[_0x1141('0x2e')][_0x1141('0x3e')]+'%'};return _0xb5e130;}})});}_0x39b89f=_[_0x1141('0x3c')]({},_0x39b89f,_0x23e2b7[_0x1141('0x3f')]);var _0x3944b9={'where':_0x39b89f[_0x1141('0x39')]};return db[_0x1141('0x29')][_0x1141('0x1d')](_0x3944b9)['then'](function(_0x4ebb89){_0x1a011c[_0x1141('0x1d')]=_0x4ebb89;if(_0x23e2b7[_0x1141('0x2e')][_0x1141('0x40')]){_0x39b89f[_0x1141('0x41')]=[{'all':!![]}];}return db[_0x1141('0x29')][_0x1141('0x42')](_0x39b89f);})[_0x1141('0x23')](function(_0x2b53fe){_0x1a011c[_0x1141('0x43')]=_0x2b53fe;return _0x1a011c;})['then'](respondWithFilteredResult(_0x1ccdee,_0x39b89f))[_0x1141('0x44')](handleError(_0x1ccdee,null));};exports[_0x1141('0x45')]=function(_0x585b6e,_0x8dc0ea){var _0x3f9d39={'raw':!![],'where':{'id':_0x585b6e[_0x1141('0x46')]['id']}},_0x37b52c={};_0x37b52c['model']=_['keys'](db['VoiceDialReport'][_0x1141('0x2a')]);_0x37b52c[_0x1141('0x2e')]=_[_0x1141('0x2f')](_0x585b6e['query']);_0x37b52c[_0x1141('0x3a')]=_[_0x1141('0x30')](_0x37b52c['model'],_0x37b52c[_0x1141('0x2e')]);_0x3f9d39[_0x1141('0x32')]=_[_0x1141('0x30')](_0x37b52c['model'],qs[_0x1141('0x33')](_0x585b6e[_0x1141('0x2e')][_0x1141('0x33')]));_0x3f9d39['attributes']=_0x3f9d39[_0x1141('0x32')][_0x1141('0x34')]?_0x3f9d39[_0x1141('0x32')]:_0x37b52c[_0x1141('0x31')];if(_0x585b6e[_0x1141('0x2e')]['includeAll']){_0x3f9d39[_0x1141('0x41')]=[{'all':!![]}];}_0x3f9d39=_['merge']({},_0x3f9d39,_0x585b6e[_0x1141('0x3f')]);return db[_0x1141('0x29')][_0x1141('0x47')](_0x3f9d39)[_0x1141('0x23')](handleEntityNotFound(_0x8dc0ea,null))[_0x1141('0x23')](respondWithResult(_0x8dc0ea,null))[_0x1141('0x44')](handleError(_0x8dc0ea,null));};exports['create']=function(_0x3640c5,_0x1ded89){return db['VoiceDialReport'][_0x1141('0x48')](_0x3640c5[_0x1141('0x49')],{})['then'](respondWithResult(_0x1ded89,0xc9))[_0x1141('0x44')](handleError(_0x1ded89,null));};exports[_0x1141('0x22')]=function(_0x5d3b17,_0x5bcef3){if(_0x5d3b17['body']['id']){delete _0x5d3b17[_0x1141('0x49')]['id'];}return db[_0x1141('0x29')][_0x1141('0x47')]({'where':{'id':_0x5d3b17[_0x1141('0x46')]['id']}})[_0x1141('0x23')](handleEntityNotFound(_0x5bcef3,null))['then'](saveUpdates(_0x5d3b17[_0x1141('0x49')],null))['then'](respondWithResult(_0x5bcef3,null))[_0x1141('0x44')](handleError(_0x5bcef3,null));};exports[_0x1141('0x4a')]=function(_0x1eb838,_0x5e468a){return db['VoiceDialReport'][_0x1141('0x47')]({'where':{'id':_0x1eb838[_0x1141('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e468a,null))[_0x1141('0x23')](removeEntity(_0x5e468a,null))[_0x1141('0x44')](handleError(_0x5e468a,null));};exports['describe']=function(_0x3a2647,_0x42b283){return db[_0x1141('0x29')][_0x1141('0x4b')]()['then'](respondWithResult(_0x42b283,null))[_0x1141('0x44')](handleError(_0x42b283,null));}; \ No newline at end of file +var _0x75a4=['pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','find','create','body','describe','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','then','destroy','end','error','stack','name','send','index','VoiceDialReport','type','key','map','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x75a4,0xa6));var _0x475a=function(_0x3c61e9,_0x413e93){_0x3c61e9=_0x3c61e9-0x0;var _0x43fb43=_0x75a4[_0x3c61e9];return _0x43fb43;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x475a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x475a('0x1'));var moment=require('moment');var BPromise=require(_0x475a('0x2'));var Mustache=require(_0x475a('0x3'));var util=require(_0x475a('0x4'));var path=require(_0x475a('0x5'));var sox=require(_0x475a('0x6'));var csv=require(_0x475a('0x7'));var ejs=require(_0x475a('0x8'));var fs=require('fs');var fs_extra=require(_0x475a('0x9'));var _=require(_0x475a('0xa'));var squel=require(_0x475a('0xb'));var crypto=require(_0x475a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x475a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x475a('0xe'));var Papa=require(_0x475a('0xf'));var Redis=require(_0x475a('0x10'));var authService=require(_0x475a('0x11'));var qs=require(_0x475a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x475a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x475a('0x14'));var config=require(_0x475a('0x15'));var licenseUtil=require(_0x475a('0x16'));var db=require(_0x475a('0x17'))['db'];function respondWithStatusCode(_0x599785,_0x13222c){_0x13222c=_0x13222c||0xcc;return function(_0x1442a2){if(_0x1442a2){return _0x599785[_0x475a('0x18')](_0x13222c);}return _0x599785[_0x475a('0x19')](_0x13222c)['end']();};}function respondWithResult(_0x12b0ce,_0x38094a){_0x38094a=_0x38094a||0xc8;return function(_0x50b19e){if(_0x50b19e){return _0x12b0ce[_0x475a('0x19')](_0x38094a)[_0x475a('0x1a')](_0x50b19e);}};}function respondWithFilteredResult(_0x57e54c,_0x4475d6){return function(_0x12af54){if(_0x12af54){var _0x6b7b32=typeof _0x4475d6[_0x475a('0x1b')]==='undefined'&&typeof _0x4475d6['limit']===_0x475a('0x1c');var _0x498465=_0x12af54['count'];var _0x1046da=_0x6b7b32?0x0:_0x4475d6[_0x475a('0x1b')];var _0x810e26=_0x6b7b32?_0x12af54[_0x475a('0x1d')]:_0x4475d6[_0x475a('0x1b')]+_0x4475d6[_0x475a('0x1e')];var _0x3a84cb;if(_0x810e26>=_0x498465){_0x810e26=_0x498465;_0x3a84cb=0xc8;}else{_0x3a84cb=0xce;}_0x57e54c['status'](_0x3a84cb);return _0x57e54c[_0x475a('0x1f')]('Content-Range',_0x1046da+'-'+_0x810e26+'/'+_0x498465)[_0x475a('0x1a')](_0x12af54);}return null;};}function patchUpdates(_0x240cb5){return function(_0xc29e39){try{jsonpatch['apply'](_0xc29e39,_0x240cb5,!![]);}catch(_0x1bf67e){return BPromise[_0x475a('0x20')](_0x1bf67e);}return _0xc29e39[_0x475a('0x21')]();};}function saveUpdates(_0x47fca9,_0xec9f86){return function(_0x34511a){if(_0x34511a){return _0x34511a['update'](_0x47fca9)[_0x475a('0x22')](function(_0x178319){return _0x178319;});}return null;};}function removeEntity(_0x248c95,_0xa73519){return function(_0x14fee1){if(_0x14fee1){return _0x14fee1[_0x475a('0x23')]()[_0x475a('0x22')](function(){_0x248c95[_0x475a('0x19')](0xcc)[_0x475a('0x24')]();});}};}function handleEntityNotFound(_0x94883e,_0x4671ca){return function(_0x15d87f){if(!_0x15d87f){_0x94883e['sendStatus'](0x194);}return _0x15d87f;};}function handleError(_0x205402,_0x21ede9){_0x21ede9=_0x21ede9||0x1f4;return function(_0x35dc47){logger[_0x475a('0x25')](_0x35dc47[_0x475a('0x26')]);if(_0x35dc47['name']){delete _0x35dc47[_0x475a('0x27')];}_0x205402[_0x475a('0x19')](_0x21ede9)[_0x475a('0x28')](_0x35dc47);};}exports[_0x475a('0x29')]=function(_0x33c38b,_0x3c9551){var _0x317de8={},_0x26cdf8={},_0x15b539={'count':0x0,'rows':[]};var _0x5df9c1=_['map'](db[_0x475a('0x2a')]['rawAttributes'],function(_0x180013){return{'name':_0x180013['fieldName'],'type':_0x180013[_0x475a('0x2b')][_0x475a('0x2c')]};});_0x26cdf8['model']=_[_0x475a('0x2d')](_0x5df9c1,_0x475a('0x27'));_0x26cdf8[_0x475a('0x2e')]=_[_0x475a('0x2f')](_0x33c38b['query']);_0x26cdf8[_0x475a('0x30')]=_['intersection'](_0x26cdf8[_0x475a('0x31')],_0x26cdf8['query']);_0x317de8[_0x475a('0x32')]=_['intersection'](_0x26cdf8[_0x475a('0x31')],qs[_0x475a('0x33')](_0x33c38b[_0x475a('0x2e')][_0x475a('0x33')]));_0x317de8['attributes']=_0x317de8[_0x475a('0x32')][_0x475a('0x34')]?_0x317de8['attributes']:_0x26cdf8[_0x475a('0x31')];if(!_0x33c38b[_0x475a('0x2e')][_0x475a('0x35')](_0x475a('0x36'))){_0x317de8[_0x475a('0x1e')]=qs[_0x475a('0x1e')](_0x33c38b[_0x475a('0x2e')][_0x475a('0x1e')]);_0x317de8['offset']=qs[_0x475a('0x1b')](_0x33c38b[_0x475a('0x2e')]['offset']);}_0x317de8[_0x475a('0x37')]=qs['sort'](_0x33c38b[_0x475a('0x2e')]['sort']);_0x317de8['where']=qs[_0x475a('0x30')](_[_0x475a('0x38')](_0x33c38b[_0x475a('0x2e')],_0x26cdf8[_0x475a('0x30')]),_0x5df9c1);if(_0x33c38b[_0x475a('0x2e')][_0x475a('0x39')]){_0x317de8[_0x475a('0x3a')]=_[_0x475a('0x3b')](_0x317de8[_0x475a('0x3a')],{'$or':_[_0x475a('0x2d')](_0x5df9c1,function(_0x3c8bde){if(_0x3c8bde['type']!==_0x475a('0x3c')){var _0x4fcee1={};_0x4fcee1[_0x3c8bde[_0x475a('0x27')]]={'$like':'%'+_0x33c38b[_0x475a('0x2e')][_0x475a('0x39')]+'%'};return _0x4fcee1;}})});}_0x317de8=_[_0x475a('0x3b')]({},_0x317de8,_0x33c38b[_0x475a('0x3d')]);var _0x39f949={'where':_0x317de8[_0x475a('0x3a')]};return db['VoiceDialReport']['count'](_0x39f949)[_0x475a('0x22')](function(_0x115a9f){_0x15b539[_0x475a('0x1d')]=_0x115a9f;if(_0x33c38b[_0x475a('0x2e')][_0x475a('0x3e')]){_0x317de8[_0x475a('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x475a('0x40')](_0x317de8);})[_0x475a('0x22')](function(_0x5d815c){_0x15b539[_0x475a('0x41')]=_0x5d815c;return _0x15b539;})[_0x475a('0x22')](respondWithFilteredResult(_0x3c9551,_0x317de8))[_0x475a('0x42')](handleError(_0x3c9551,null));};exports['show']=function(_0x586619,_0x14af68){var _0x3d8eae={'raw':!![],'where':{'id':_0x586619[_0x475a('0x43')]['id']}},_0x1adb2c={};_0x1adb2c[_0x475a('0x31')]=_[_0x475a('0x2f')](db['VoiceDialReport'][_0x475a('0x44')]);_0x1adb2c['query']=_['keys'](_0x586619['query']);_0x1adb2c[_0x475a('0x30')]=_[_0x475a('0x45')](_0x1adb2c[_0x475a('0x31')],_0x1adb2c[_0x475a('0x2e')]);_0x3d8eae[_0x475a('0x32')]=_[_0x475a('0x45')](_0x1adb2c[_0x475a('0x31')],qs[_0x475a('0x33')](_0x586619[_0x475a('0x2e')]['fields']));_0x3d8eae[_0x475a('0x32')]=_0x3d8eae['attributes'][_0x475a('0x34')]?_0x3d8eae['attributes']:_0x1adb2c[_0x475a('0x31')];if(_0x586619[_0x475a('0x2e')][_0x475a('0x3e')]){_0x3d8eae[_0x475a('0x3f')]=[{'all':!![]}];}_0x3d8eae=_[_0x475a('0x3b')]({},_0x3d8eae,_0x586619[_0x475a('0x3d')]);return db['VoiceDialReport'][_0x475a('0x46')](_0x3d8eae)['then'](handleEntityNotFound(_0x14af68,null))[_0x475a('0x22')](respondWithResult(_0x14af68,null))[_0x475a('0x42')](handleError(_0x14af68,null));};exports[_0x475a('0x47')]=function(_0x106c06,_0x2f76aa){return db[_0x475a('0x2a')][_0x475a('0x47')](_0x106c06['body'],{})[_0x475a('0x22')](respondWithResult(_0x2f76aa,0xc9))[_0x475a('0x42')](handleError(_0x2f76aa,null));};exports['update']=function(_0x4c7c9a,_0x52ef60){if(_0x4c7c9a[_0x475a('0x48')]['id']){delete _0x4c7c9a[_0x475a('0x48')]['id'];}return db['VoiceDialReport'][_0x475a('0x46')]({'where':{'id':_0x4c7c9a[_0x475a('0x43')]['id']}})['then'](handleEntityNotFound(_0x52ef60,null))['then'](saveUpdates(_0x4c7c9a[_0x475a('0x48')],null))[_0x475a('0x22')](respondWithResult(_0x52ef60,null))[_0x475a('0x42')](handleError(_0x52ef60,null));};exports[_0x475a('0x23')]=function(_0x2dd923,_0x16e01f){return db[_0x475a('0x2a')][_0x475a('0x46')]({'where':{'id':_0x2dd923[_0x475a('0x43')]['id']}})['then'](handleEntityNotFound(_0x16e01f,null))[_0x475a('0x22')](removeEntity(_0x16e01f,null))['catch'](handleError(_0x16e01f,null));};exports[_0x475a('0x49')]=function(_0x126e99,_0xc337ef){return db[_0x475a('0x2a')][_0x475a('0x49')]()[_0x475a('0x22')](respondWithResult(_0xc337ef,null))[_0x475a('0x42')](handleError(_0xc337ef,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index fc5cda8..d1f90c0 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 _0x7070=['define','uniqueid','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3768a4,_0x1a2d7b){var _0x30a34d=function(_0x3d12da){while(--_0x3d12da){_0x3768a4['push'](_0x3768a4['shift']());}};_0x30a34d(++_0x1a2d7b);}(_0x7070,0xa4));var _0x0707=function(_0x530150,_0x3111f4){_0x530150=_0x530150-0x0;var _0x5ea1c4=_0x7070[_0x530150];return _0x5ea1c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0707('0x0'))('api');var moment=require(_0x0707('0x1'));var BPromise=require('bluebird');var rp=require(_0x0707('0x2'));var fs=require('fs');var path=require(_0x0707('0x3'));var rimraf=require(_0x0707('0x4'));var config=require(_0x0707('0x5'));var attributes=require('./voiceDialReport.attributes');module[_0x0707('0x6')]=function(_0x45254f,_0x32ce99){return _0x45254f[_0x0707('0x7')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x0707('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe35e=['VoiceDialReport','uniqueid','util','../../config/logger','api','path','rimraf','./voiceDialReport.attributes','exports','define'];(function(_0x3b72d8,_0x1ed42e){var _0x59bee4=function(_0x251b69){while(--_0x251b69){_0x3b72d8['push'](_0x3b72d8['shift']());}};_0x59bee4(++_0x1ed42e);}(_0xe35e,0xfc));var _0xee35=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0xe35e[_0x55ff3e];return _0x2709eb;};'use strict';var _=require('lodash');var util=require(_0xee35('0x0'));var logger=require(_0xee35('0x1'))(_0xee35('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xee35('0x3'));var rimraf=require(_0xee35('0x4'));var config=require('../../config/environment');var attributes=require(_0xee35('0x5'));module[_0xee35('0x6')]=function(_0x57da7f,_0x4d7879){return _0x57da7f[_0xee35('0x7')](_0xee35('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xee35('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index ab1db3a..eca3bf7 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 _0x299a=['CreateVoiceDialReport','create','body','options','raw','update','where','attributes','UpdateVoiceDialReport','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0x299a,0x95));var _0xa299=function(_0x588d45,_0x27e18e){_0x588d45=_0x588d45-0x0;var _0x2ab5e2=_0x299a[_0x588d45];return _0x2ab5e2;};'use strict';var _=require(_0xa299('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa299('0x1'));var fs=require('fs');var Redis=require(_0xa299('0x2'));var db=require(_0xa299('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa299('0x4'));var config=require(_0xa299('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa299('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x578a2f,_0x124867,_0x46f6f6){return new BPromise(function(_0x1d3367,_0x37da58){return client[_0xa299('0x7')](_0x578a2f,_0x46f6f6)[_0xa299('0x8')](function(_0x395f40){logger[_0xa299('0x9')](_0xa299('0xa'),_0x124867,_0xa299('0xb'));logger[_0xa299('0xc')](_0xa299('0xd'),_0x124867,'request\x20sent',JSON[_0xa299('0xe')](_0x395f40));if(_0x395f40[_0xa299('0xf')]){if(_0x395f40[_0xa299('0xf')][_0xa299('0x10')]===0x1f4){logger['error'](_0xa299('0xa'),_0x124867,_0x395f40[_0xa299('0xf')]['message']);return _0x37da58(_0x395f40[_0xa299('0xf')][_0xa299('0x11')]);}logger[_0xa299('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x124867,_0x395f40[_0xa299('0xf')]['message']);return _0x1d3367(_0x395f40[_0xa299('0xf')][_0xa299('0x11')]);}else{logger[_0xa299('0x9')]('VoiceDialReport,\x20%s,\x20%s',_0x124867,_0xa299('0xb'));_0x1d3367(_0x395f40['result'][_0xa299('0x11')]);}})[_0xa299('0x12')](function(_0x424da6){logger[_0xa299('0xf')](_0xa299('0xa'),_0x124867,_0x424da6);_0x37da58(_0x424da6);});});}exports[_0xa299('0x13')]=function(_0x4d3e1e){var _0x1ea5be=this;return new Promise(function(_0x2827f7,_0x65c6){return db['VoiceDialReport'][_0xa299('0x14')](_0x4d3e1e[_0xa299('0x15')],{'raw':_0x4d3e1e[_0xa299('0x16')]?_0x4d3e1e[_0xa299('0x16')][_0xa299('0x17')]===undefined?!![]:![]:!![]})[_0xa299('0x8')](function(_0x188dd4){logger['info']('CreateVoiceDialReport',_0x4d3e1e);logger[_0xa299('0xc')](_0xa299('0x13'),_0x4d3e1e,JSON['stringify'](_0x188dd4));_0x2827f7(_0x188dd4);})[_0xa299('0x12')](function(_0x3da69e){logger['error'](_0xa299('0x13'),_0x3da69e['message'],_0x4d3e1e);_0x65c6(_0x1ea5be[_0xa299('0xf')](0x1f4,_0x3da69e[_0xa299('0x11')]));});});};exports['UpdateVoiceDialReport']=function(_0x2dfb03){var _0xda1bc1=this;return new Promise(function(_0x5beeba,_0x5ae58a){return db['VoiceDialReport'][_0xa299('0x18')](_0x2dfb03[_0xa299('0x15')],{'raw':_0x2dfb03[_0xa299('0x16')]?_0x2dfb03['options'][_0xa299('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dfb03[_0xa299('0x16')]?_0x2dfb03[_0xa299('0x16')][_0xa299('0x19')]||null:null,'attributes':_0x2dfb03[_0xa299('0x16')]?_0x2dfb03[_0xa299('0x16')][_0xa299('0x1a')]||null:null,'limit':_0x2dfb03[_0xa299('0x16')]?_0x2dfb03[_0xa299('0x16')]['limit']||null:null})['then'](function(_0x12dc93){logger[_0xa299('0x9')](_0xa299('0x1b'),_0x2dfb03);logger['debug'](_0xa299('0x1b'),_0x2dfb03,JSON[_0xa299('0xe')](_0x12dc93));_0x5beeba(_0x12dc93);})[_0xa299('0x12')](function(_0x4c67c6){logger[_0xa299('0xf')](_0xa299('0x1b'),_0x4c67c6[_0xa299('0x11')],_0x2dfb03);_0x5ae58a(_0xda1bc1[_0xa299('0xf')](0x1f4,_0x4c67c6[_0xa299('0x11')]));});});}; \ No newline at end of file +var _0x9ddb=['error','code','message','request\x20sent','CreateVoiceDialReport','VoiceDialReport','body','options','raw','catch','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9ddb,0x1ef));var _0xb9dd=function(_0x3a74c9,_0x5edbc1){_0x3a74c9=_0x3a74c9-0x0;var _0x49b49e=_0x9ddb[_0x3a74c9];return _0x49b49e;};'use strict';var _=require(_0xb9dd('0x0'));var util=require(_0xb9dd('0x1'));var moment=require('moment');var BPromise=require(_0xb9dd('0x2'));var rs=require(_0xb9dd('0x3'));var fs=require('fs');var Redis=require(_0xb9dd('0x4'));var db=require(_0xb9dd('0x5'))['db'];var utils=require(_0xb9dd('0x6'));var logger=require('../../config/logger')(_0xb9dd('0x7'));var config=require(_0xb9dd('0x8'));var jayson=require(_0xb9dd('0x9'));var client=jayson[_0xb9dd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12dcfc,_0x3b51f7,_0x12331a){return new BPromise(function(_0x17278a,_0x58b350){return client['request'](_0x12dcfc,_0x12331a)[_0xb9dd('0xb')](function(_0x1640fa){logger[_0xb9dd('0xc')](_0xb9dd('0xd'),_0x3b51f7,'request\x20sent');logger[_0xb9dd('0xe')](_0xb9dd('0xf'),_0x3b51f7,'request\x20sent',JSON[_0xb9dd('0x10')](_0x1640fa));if(_0x1640fa[_0xb9dd('0x11')]){if(_0x1640fa[_0xb9dd('0x11')][_0xb9dd('0x12')]===0x1f4){logger[_0xb9dd('0x11')](_0xb9dd('0xd'),_0x3b51f7,_0x1640fa['error']['message']);return _0x58b350(_0x1640fa['error'][_0xb9dd('0x13')]);}logger[_0xb9dd('0x11')](_0xb9dd('0xd'),_0x3b51f7,_0x1640fa[_0xb9dd('0x11')][_0xb9dd('0x13')]);return _0x17278a(_0x1640fa['error']['message']);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x3b51f7,_0xb9dd('0x14'));_0x17278a(_0x1640fa['result'][_0xb9dd('0x13')]);}})['catch'](function(_0x3f1360){logger[_0xb9dd('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x3b51f7,_0x3f1360);_0x58b350(_0x3f1360);});});}exports[_0xb9dd('0x15')]=function(_0x1670de){var _0x1400dd=this;return new Promise(function(_0x11871a,_0x4e29e6){return db[_0xb9dd('0x16')]['create'](_0x1670de[_0xb9dd('0x17')],{'raw':_0x1670de[_0xb9dd('0x18')]?_0x1670de['options'][_0xb9dd('0x19')]===undefined?!![]:![]:!![]})[_0xb9dd('0xb')](function(_0x5bffcc){logger[_0xb9dd('0xc')](_0xb9dd('0x15'),_0x1670de);logger[_0xb9dd('0xe')]('CreateVoiceDialReport',_0x1670de,JSON[_0xb9dd('0x10')](_0x5bffcc));_0x11871a(_0x5bffcc);})[_0xb9dd('0x1a')](function(_0x2bad78){logger[_0xb9dd('0x11')](_0xb9dd('0x15'),_0x2bad78[_0xb9dd('0x13')],_0x1670de);_0x4e29e6(_0x1400dd[_0xb9dd('0x11')](0x1f4,_0x2bad78[_0xb9dd('0x13')]));});});};exports[_0xb9dd('0x1b')]=function(_0x5d44e4){var _0x16f659=this;return new Promise(function(_0x29d6f7,_0x3e1e7b){return db[_0xb9dd('0x16')][_0xb9dd('0x1c')](_0x5d44e4[_0xb9dd('0x17')],{'raw':_0x5d44e4[_0xb9dd('0x18')]?_0x5d44e4['options'][_0xb9dd('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d44e4['options']?_0x5d44e4[_0xb9dd('0x18')][_0xb9dd('0x1d')]||null:null,'attributes':_0x5d44e4[_0xb9dd('0x18')]?_0x5d44e4[_0xb9dd('0x18')][_0xb9dd('0x1e')]||null:null,'limit':_0x5d44e4[_0xb9dd('0x18')]?_0x5d44e4['options'][_0xb9dd('0x1f')]||null:null})[_0xb9dd('0xb')](function(_0x4b618f){logger[_0xb9dd('0xc')]('UpdateVoiceDialReport',_0x5d44e4);logger[_0xb9dd('0xe')](_0xb9dd('0x1b'),_0x5d44e4,JSON[_0xb9dd('0x10')](_0x4b618f));_0x29d6f7(_0x4b618f);})[_0xb9dd('0x1a')](function(_0x3759a9){logger[_0xb9dd('0x11')]('UpdateVoiceDialReport',_0x3759a9[_0xb9dd('0x13')],_0x5d44e4);_0x3e1e7b(_0x16f659[_0xb9dd('0x11')](0x1f4,_0x3759a9['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 5e854e9..ac46f79 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 _0x6ad0=['express','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','isAuthenticated','index','get','/:id','create','post','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x6ad0,0x138));var _0x06ad=function(_0x4dad1e,_0x1c6ec0){_0x4dad1e=_0x4dad1e-0x0;var _0x365bfc=_0x6ad0[_0x4dad1e];return _0x365bfc;};'use strict';var multer=require(_0x06ad('0x0'));var util=require(_0x06ad('0x1'));var path=require(_0x06ad('0x2'));var timeout=require('connect-timeout');var express=require(_0x06ad('0x3'));var router=express[_0x06ad('0x4')]();var fs_extra=require(_0x06ad('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x06ad('0x6'));var config=require('../../config/environment');var controller=require(_0x06ad('0x7'));router['get']('/',auth[_0x06ad('0x8')](),controller[_0x06ad('0x9')]);router[_0x06ad('0xa')](_0x06ad('0xb'),auth[_0x06ad('0x8')](),controller['show']);router['post']('/',auth[_0x06ad('0x8')](),controller[_0x06ad('0xc')]);router[_0x06ad('0xd')](_0x06ad('0xe'),auth['isAuthenticated'](),controller[_0x06ad('0xf')]);router[_0x06ad('0x10')](_0x06ad('0xb'),auth['isAuthenticated'](),controller[_0x06ad('0x11')]);router[_0x06ad('0x12')]('/:id',auth[_0x06ad('0x8')](),controller[_0x06ad('0x13')]);module[_0x06ad('0x14')]=router; \ No newline at end of file +var _0x53c4=['isAuthenticated','index','get','/:id','create','post','addApplications','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller'];(function(_0x461cd7,_0x555589){var _0x58b3a9=function(_0x2497b5){while(--_0x2497b5){_0x461cd7['push'](_0x461cd7['shift']());}};_0x58b3a9(++_0x555589);}(_0x53c4,0xd1));var _0x453c=function(_0x1413d2,_0x179c6d){_0x1413d2=_0x1413d2-0x0;var _0x5b674d=_0x53c4[_0x1413d2];return _0x5b674d;};'use strict';var multer=require(_0x453c('0x0'));var util=require(_0x453c('0x1'));var path=require(_0x453c('0x2'));var timeout=require(_0x453c('0x3'));var express=require(_0x453c('0x4'));var router=express[_0x453c('0x5')]();var fs_extra=require(_0x453c('0x6'));var auth=require(_0x453c('0x7'));var interaction=require(_0x453c('0x8'));var config=require(_0x453c('0x9'));var controller=require(_0x453c('0xa'));router['get']('/',auth[_0x453c('0xb')](),controller[_0x453c('0xc')]);router[_0x453c('0xd')](_0x453c('0xe'),auth[_0x453c('0xb')](),controller['show']);router['post']('/',auth[_0x453c('0xb')](),controller[_0x453c('0xf')]);router[_0x453c('0x10')]('/:id/applications',auth[_0x453c('0xb')](),controller[_0x453c('0x11')]);router['put'](_0x453c('0xe'),auth[_0x453c('0xb')](),controller[_0x453c('0x12')]);router[_0x453c('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x453c('0x14')]);module[_0x453c('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 6a67948..da30308 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 _0x56bd=['exten','sequelize','STRING','compositeIndex','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','INTEGER','BOOLEAN','VIRTUAL'];(function(_0x1eedf2,_0x5d884e){var _0x184c3d=function(_0x387e25){while(--_0x387e25){_0x1eedf2['push'](_0x1eedf2['shift']());}};_0x184c3d(++_0x5d884e);}(_0x56bd,0x17b));var _0xd56b=function(_0x518e51,_0x43dc3b){_0x518e51=_0x518e51-0x0;var _0x4262eb=_0x56bd[_0x518e51];return _0x4262eb;};'use strict';var Sequelize=require(_0xd56b('0x0'));module['exports']={'context':{'type':Sequelize[_0xd56b('0x1')],'allowNull':![],'unique':_0xd56b('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd56b('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xd56b('0x2')},'tag':{'type':Sequelize[_0xd56b('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd56b('0x1')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xd56b('0x3'),_0xd56b('0x4'),_0xd56b('0x5'),_0xd56b('0x6'),_0xd56b('0x7'),_0xd56b('0x8'),_0xd56b('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xd56b('0x1')]},'interval':{'type':Sequelize[_0xd56b('0x1')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xd56b('0xa')]},'isApp':{'type':Sequelize[_0xd56b('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd56b('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd56b('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xd56b('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xd56b('0xc')],'get':function(_0x12bd96){return this['getDataValue'](_0xd56b('0xd'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x01d0=['compositeIndex','inbound','internal','inbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','exten','STRING'];(function(_0x4ae761,_0x2fbb0f){var _0x4c2da5=function(_0xa0615b){while(--_0xa0615b){_0x4ae761['push'](_0x4ae761['shift']());}};_0x4c2da5(++_0x2fbb0f);}(_0x01d0,0xc5));var _0x001d=function(_0x29e57e,_0x2d1f6c){_0x29e57e=_0x29e57e-0x0;var _0x5dd5a7=_0x01d0[_0x29e57e];return _0x5dd5a7;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x001d('0x0')],'allowNull':![],'unique':_0x001d('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x001d('0x0')],'allowNull':![],'unique':_0x001d('0x1')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x001d('0x1')},'tag':{'type':Sequelize[_0x001d('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x001d('0x0')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x001d('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x001d('0x2'),'outbound',_0x001d('0x3'),_0x001d('0x4'),'outbound-fax','system',_0x001d('0x5')),'allowNull':![]},'description':{'type':Sequelize[_0x001d('0x0')]},'interval':{'type':Sequelize[_0x001d('0x0')],'allowNull':![],'defaultValue':_0x001d('0x6')},'IntervalId':{'type':Sequelize[_0x001d('0x7')]},'isApp':{'type':Sequelize[_0x001d('0x8')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x001d('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x001d('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0x001d('0x8')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x001d('0x7')]},'recordingFormat':{'type':Sequelize[_0x001d('0x0')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x001d('0x8')],'defaultValue':!![]},'name':{'type':Sequelize[_0x001d('0x9')],'get':function(_0x4576db){return this['getDataValue'](_0x001d('0xa'));}},'alias':{'type':Sequelize[_0x001d('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 69ad23c..ce74a43 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 _0x1669=['intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','include','findAll','rows','catch','show','params','includeAll','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','mandatoryDisposition','alias','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','undefined','offset','set','json','destroy','get','inbound','OutboundRoutes','outbound','internal','filter','ignore','value','includes','type','find','name','UserProfileResource','then','end','error','stack','send','index','rawAttributes','fieldName','model','map','query','keys','filters','attributes'];(function(_0x510d04,_0x4aabb3){var _0x846cab=function(_0x24e39c){while(--_0x24e39c){_0x510d04['push'](_0x510d04['shift']());}};_0x846cab(++_0x4aabb3);}(_0x1669,0xdd));var _0x9166=function(_0x39d6aa,_0x4f43ec){_0x39d6aa=_0x39d6aa-0x0;var _0x1c5283=_0x1669[_0x39d6aa];return _0x1c5283;};'use strict';var _=require(_0x9166('0x0'));var Redis=require(_0x9166('0x1'));var qs=require(_0x9166('0x2'));var logger=require(_0x9166('0x3'))(_0x9166('0x4'));var config=require(_0x9166('0x5'));var db=require(_0x9166('0x6'))['db'];config[_0x9166('0x7')]=_[_0x9166('0x8')](config[_0x9166('0x7')],{'host':_0x9166('0x9'),'port':0x18eb});var socket=require(_0x9166('0xa'))(new Redis(config[_0x9166('0x7')]));require('./voiceExtension.socket')[_0x9166('0xb')](socket);function respondWithStatusCode(_0x14772f,_0x5f010c){_0x5f010c=_0x5f010c||0xcc;return function(_0x43fb5e){if(_0x43fb5e){return _0x14772f[_0x9166('0xc')](_0x5f010c);}return _0x14772f[_0x9166('0xd')](_0x5f010c)['end']();};}function respondWithResult(_0x281047,_0x4149c7){_0x4149c7=_0x4149c7||0xc8;return function(_0x32fcf4){if(_0x32fcf4){return _0x281047[_0x9166('0xd')](_0x4149c7)['json'](_0x32fcf4);}};}function respondWithFilteredResult(_0x30bcde,_0x57ea29){return function(_0x15bb10){if(_0x15bb10){var _0x4023aa=typeof _0x57ea29['offset']===_0x9166('0xe')&&typeof _0x57ea29['limit']===_0x9166('0xe');var _0x232717=_0x15bb10['count'];var _0x221d82=_0x4023aa?0x0:_0x57ea29[_0x9166('0xf')];var _0x4eb9b6=_0x4023aa?_0x15bb10['count']:_0x57ea29[_0x9166('0xf')]+_0x57ea29['limit'];var _0x66c564;if(_0x4eb9b6>=_0x232717){_0x4eb9b6=_0x232717;_0x66c564=0xc8;}else{_0x66c564=0xce;}_0x30bcde[_0x9166('0xd')](_0x66c564);return _0x30bcde[_0x9166('0x10')]('Content-Range',_0x221d82+'-'+_0x4eb9b6+'/'+_0x232717)[_0x9166('0x11')](_0x15bb10);}return null;};}function removeEntity(_0x145a52){return function(_0x36e8fa){if(_0x36e8fa){return _0x36e8fa[_0x9166('0x12')]()['then'](function(){var _0x53c9e9=_0x36e8fa[_0x9166('0x13')]({'plain':!![]});var _0xd9333=[{'name':'InboundRoutes','value':_0x9166('0x14'),'ignore':![]},{'name':_0x9166('0x15'),'value':_0x9166('0x16'),'ignore':![]},{'name':'InternalRoutes','value':_0x9166('0x17'),'ignore':![]}];var _0x1ee270=_(_0xd9333)[_0x9166('0x18')](_0x9166('0x19'))['map'](_0x9166('0x1a'))['value']();if(_[_0x9166('0x1b')](_0x1ee270,_0x53c9e9[_0x9166('0x1c')])){return;}var _0x1c0331=_[_0x9166('0x1d')](_0xd9333,['value',_0x53c9e9[_0x9166('0x1c')]])[_0x9166('0x1e')];return db[_0x9166('0x1f')][_0x9166('0x12')]({'where':{'type':_0x1c0331,'resourceId':_0x53c9e9['id']}})[_0x9166('0x20')](function(){return _0x36e8fa;});})['then'](function(){_0x145a52[_0x9166('0xd')](0xcc)[_0x9166('0x21')]();});}};}function handleEntityNotFound(_0x5731b7){return function(_0xc5a1b3){if(!_0xc5a1b3){_0x5731b7[_0x9166('0xc')](0x194);}return _0xc5a1b3;};}function handleError(_0x11ecbe,_0x37eee6){_0x37eee6=_0x37eee6||0x1f4;return function(_0x36e4cb){logger[_0x9166('0x22')](_0x36e4cb[_0x9166('0x23')]);if(_0x36e4cb[_0x9166('0x1e')]){delete _0x36e4cb[_0x9166('0x1e')];}_0x11ecbe[_0x9166('0xd')](_0x37eee6)[_0x9166('0x24')](_0x36e4cb);};}exports[_0x9166('0x25')]=function(_0x24ba9f,_0x2d8f8f){var _0x4ca13e={},_0x50b5b7={},_0x296352={'count':0x0,'rows':[]};var _0x2cf1d3=_['map'](db['VoiceExtension'][_0x9166('0x26')],function(_0x1cfa40){return{'name':_0x1cfa40[_0x9166('0x27')],'type':_0x1cfa40['type']['key']};});_0x50b5b7[_0x9166('0x28')]=_[_0x9166('0x29')](_0x2cf1d3,_0x9166('0x1e'));_0x50b5b7[_0x9166('0x2a')]=_[_0x9166('0x2b')](_0x24ba9f[_0x9166('0x2a')]);_0x50b5b7[_0x9166('0x2c')]=_['intersection'](_0x50b5b7['model'],_0x50b5b7[_0x9166('0x2a')]);_0x4ca13e[_0x9166('0x2d')]=_[_0x9166('0x2e')](_0x50b5b7['model'],qs[_0x9166('0x2f')](_0x24ba9f[_0x9166('0x2a')][_0x9166('0x2f')]));_0x4ca13e[_0x9166('0x2d')]=_0x4ca13e[_0x9166('0x2d')]['length']?_0x4ca13e[_0x9166('0x2d')]:_0x50b5b7['model'];if(!_0x24ba9f[_0x9166('0x2a')][_0x9166('0x30')](_0x9166('0x31'))){_0x4ca13e[_0x9166('0x32')]=qs['limit'](_0x24ba9f['query'][_0x9166('0x32')]);_0x4ca13e[_0x9166('0xf')]=qs[_0x9166('0xf')](_0x24ba9f[_0x9166('0x2a')]['offset']);}_0x4ca13e[_0x9166('0x33')]=qs[_0x9166('0x34')](_0x24ba9f[_0x9166('0x2a')]['sort']);_0x4ca13e[_0x9166('0x35')]=qs['filters'](_[_0x9166('0x36')](_0x24ba9f[_0x9166('0x2a')],_0x50b5b7[_0x9166('0x2c')]),_0x2cf1d3);if(_0x24ba9f[_0x9166('0x2a')][_0x9166('0x18')]){_0x4ca13e[_0x9166('0x35')]=_[_0x9166('0x37')](_0x4ca13e[_0x9166('0x35')],{'$or':_[_0x9166('0x29')](_0x2cf1d3,function(_0x213a4a){if(_0x213a4a[_0x9166('0x1c')]!==_0x9166('0x38')){var _0x5d4d66={};_0x5d4d66[_0x213a4a[_0x9166('0x1e')]]={'$like':'%'+_0x24ba9f[_0x9166('0x2a')][_0x9166('0x18')]+'%'};return _0x5d4d66;}})});}_0x4ca13e=_['merge']({},_0x4ca13e,_0x24ba9f[_0x9166('0x39')]);var _0x531cdc={'where':_0x4ca13e[_0x9166('0x35')]};return db[_0x9166('0x3a')]['count'](_0x531cdc)[_0x9166('0x20')](function(_0x16263e){_0x296352['count']=_0x16263e;if(_0x24ba9f[_0x9166('0x2a')]['includeAll']){_0x4ca13e[_0x9166('0x3b')]=[{'all':!![]}];}return db[_0x9166('0x3a')][_0x9166('0x3c')](_0x4ca13e);})[_0x9166('0x20')](function(_0x20be3f){_0x296352[_0x9166('0x3d')]=_0x20be3f;return _0x296352;})[_0x9166('0x20')](respondWithFilteredResult(_0x2d8f8f,_0x4ca13e))[_0x9166('0x3e')](handleError(_0x2d8f8f,null));};exports[_0x9166('0x3f')]=function(_0x6a7ecc,_0x27d330){var _0x295724={'raw':![],'where':{'id':_0x6a7ecc[_0x9166('0x40')]['id']}},_0x5b5891={};_0x5b5891['model']=_[_0x9166('0x2b')](db[_0x9166('0x3a')]['rawAttributes']);_0x5b5891[_0x9166('0x2a')]=_[_0x9166('0x2b')](_0x6a7ecc[_0x9166('0x2a')]);_0x5b5891[_0x9166('0x2c')]=_[_0x9166('0x2e')](_0x5b5891[_0x9166('0x28')],_0x5b5891['query']);_0x295724[_0x9166('0x2d')]=_[_0x9166('0x2e')](_0x5b5891[_0x9166('0x28')],qs[_0x9166('0x2f')](_0x6a7ecc[_0x9166('0x2a')][_0x9166('0x2f')]));_0x295724[_0x9166('0x2d')]=_0x295724['attributes']['length']?_0x295724['attributes']:_0x5b5891[_0x9166('0x28')];if(_0x6a7ecc[_0x9166('0x2a')][_0x9166('0x41')]){_0x295724[_0x9166('0x3b')]=[{'all':!![]}];}_0x295724=_[_0x9166('0x37')]({},_0x295724,_0x6a7ecc['options']);return db[_0x9166('0x3a')]['find'](_0x295724)[_0x9166('0x20')](handleEntityNotFound(_0x27d330,null))[_0x9166('0x20')](respondWithResult(_0x27d330,null))[_0x9166('0x3e')](handleError(_0x27d330,null));};exports['destroy']=function(_0x2b1d72,_0x10549a){return db[_0x9166('0x3a')][_0x9166('0x1d')]({'where':{'id':_0x2b1d72[_0x9166('0x40')]['id']}})[_0x9166('0x20')](handleEntityNotFound(_0x10549a,null))['then'](removeEntity(_0x10549a,null))['catch'](handleError(_0x10549a,null));};exports[_0x9166('0x42')]=function(_0x4c52d5,_0x4cb32a){if(_0x4c52d5[_0x9166('0x43')]['type']===_0x9166('0x16')&&!_[_0x9166('0x44')](_0x4c52d5[_0x9166('0x43')][_0x9166('0x45')],'_')){_0x4c52d5[_0x9166('0x43')][_0x9166('0x45')]='_'[_0x9166('0x46')](_0x4c52d5['body'][_0x9166('0x45')]);}return db['VoiceExtension'][_0x9166('0x42')](_0x4c52d5['body'],{'raw':![]})[_0x9166('0x20')](function(_0x21c968){var _0x52cd34=_0x4c52d5['user'][_0x9166('0x13')]({'plain':!![]});if(!_0x52cd34)throw new Error(_0x9166('0x47'));if(_0x52cd34['role']===_0x9166('0x48')){var _0x22fcac=_0x21c968[_0x9166('0x13')]({'plain':!![]});var _0x173b9c=[{'name':'InboundRoutes','value':_0x9166('0x14')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':'internal'}];var _0x3b5ed5=_[_0x9166('0x1d')](_0x173b9c,[_0x9166('0x1a'),_0x22fcac[_0x9166('0x1c')]])[_0x9166('0x1e')];return db['UserProfileSection'][_0x9166('0x1d')]({'where':{'name':_0x3b5ed5,'userProfileId':_0x52cd34[_0x9166('0x49')]},'raw':!![]})[_0x9166('0x20')](function(_0x199bc8){if(_0x199bc8&&_0x199bc8[_0x9166('0x4a')]===0x0){return db[_0x9166('0x1f')]['create']({'name':_0x22fcac[_0x9166('0x1e')],'resourceId':_0x22fcac['id'],'type':_0x199bc8[_0x9166('0x1e')],'sectionId':_0x199bc8['id']},{})[_0x9166('0x20')](function(){return _0x21c968;});}else{return _0x21c968;}})['catch'](function(_0x145062){logger[_0x9166('0x22')](_0x9166('0x4b'),_0x145062);throw _0x145062;});}return _0x21c968;})[_0x9166('0x20')](respondWithResult(_0x4cb32a,0xc9))[_0x9166('0x3e')](handleError(_0x4cb32a,null));};exports[_0x9166('0x4c')]=function(_0x2fdb67,_0x3e1e8e){if(_0x2fdb67[_0x9166('0x43')]['id']){delete _0x2fdb67[_0x9166('0x43')]['id'];}return db[_0x9166('0x3a')][_0x9166('0x1d')]({'where':{'id':_0x2fdb67['params']['id']}})['then'](handleEntityNotFound(_0x3e1e8e,null))[_0x9166('0x20')](function(_0x58b61c){if(_0x58b61c){return db[_0x9166('0x3a')][_0x9166('0x4c')](_[_0x9166('0x36')](_0x2fdb67[_0x9166('0x43')],[_0x9166('0x45'),_0x9166('0x4d'),'description','recordingFormat','cutdigits',_0x9166('0x4e'),_0x9166('0x4f')]),{'where':{'context':_0x58b61c['context'],'exten':_0x58b61c[_0x9166('0x45')]},'individualHooks':!![]})[_0x9166('0x20')](function(_0x2d5c68){return _0x2d5c68;});}return null;})[_0x9166('0x20')](respondWithStatusCode(_0x3e1e8e,null))['catch'](handleError(_0x3e1e8e,null));};exports['addApplications']=function(_0x120ab1,_0x18319){var _0x5210a3=_0x120ab1[_0x9166('0x40')]['id'];var _0x378704=_0x120ab1[_0x9166('0x43')];var _0x3b619b=0xc8;var _0x163a77=null;return db[_0x9166('0x50')]['transaction']({'isolationLevel':db[_0x9166('0x50')]['Transaction'][_0x9166('0x51')][_0x9166('0x52')]},function(_0x44e178){return db['VoiceExtension'][_0x9166('0x53')]({'where':{'id':_0x5210a3},'transaction':_0x44e178})[_0x9166('0x20')](function(_0x155cdd){if(_0x155cdd){return db[_0x9166('0x3a')]['destroy']({'where':{'VoiceExtensionId':_0x5210a3},'transaction':_0x44e178})[_0x9166('0x20')](function(){var _0x266b3c=_['map'](_0x378704,function(_0x5304d4){_0x5304d4[_0x9166('0x54')]=_0x5210a3;_0x5304d4['isApp']=!![];return _0x5304d4;});return _0x155cdd[_0x9166('0x55')](_0x266b3c);})['then'](function(_0x2d4684){return db[_0x9166('0x3a')][_0x9166('0x56')](_0x2d4684,{'transaction':_0x44e178});});}else{_0x3b619b=0x194;_0x163a77=[];}});})[_0x9166('0x20')](function(){if(_0x3b619b!==0x194){return db[_0x9166('0x3a')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x5210a3},'order':_0x9166('0x57')})[_0x9166('0x20')](function(_0x4447c8){_0x163a77=_0x4447c8;});}})[_0x9166('0x3e')](function(_0x9d1a77){_0x3b619b=0x1f4;logger[_0x9166('0x22')](_0x9d1a77[_0x9166('0x23')]);if(_0x9d1a77[_0x9166('0x1e')]){delete _0x9d1a77[_0x9166('0x1e')];}_0x163a77=_0x9d1a77;})[_0x9166('0x58')](function(){if(_0x163a77===null){_0x18319[_0x9166('0xc')](_0x3b619b);}else{if(_0x3b619b===0x1f4){_0x18319[_0x9166('0xd')](_0x3b619b)[_0x9166('0x24')](_0x163a77);}else{_0x18319[_0x9166('0xd')](_0x3b619b)[_0x9166('0x11')](_0x163a77);}}});}; \ No newline at end of file +var _0x781a=['findAll','rows','catch','params','rawAttributes','create','startsWith','body','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','recordingFormat','cutdigits','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','status','end','json','undefined','limit','count','set','destroy','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','ignore','value','includes','type','find','then','sendStatus','error','stack','send','VoiceExtension','fieldName','key','model','map','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','merge','options','includeAll','include'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x781a,0xe1));var _0xa781=function(_0x36e4d9,_0x395aaf){_0x36e4d9=_0x36e4d9-0x0;var _0xc87153=_0x781a[_0x36e4d9];return _0xc87153;};'use strict';var _=require(_0xa781('0x0'));var Redis=require(_0xa781('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xa781('0x2'))(_0xa781('0x3'));var config=require(_0xa781('0x4'));var db=require('../../mysqldb')['db'];config[_0xa781('0x5')]=_[_0xa781('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa781('0x7'))(new Redis(config[_0xa781('0x5')]));require(_0xa781('0x8'))[_0xa781('0x9')](socket);function respondWithStatusCode(_0x5d3307,_0x1f0ca6){_0x1f0ca6=_0x1f0ca6||0xcc;return function(_0x2d143b){if(_0x2d143b){return _0x5d3307['sendStatus'](_0x1f0ca6);}return _0x5d3307[_0xa781('0xa')](_0x1f0ca6)[_0xa781('0xb')]();};}function respondWithResult(_0x193142,_0x4b0766){_0x4b0766=_0x4b0766||0xc8;return function(_0x549dd7){if(_0x549dd7){return _0x193142[_0xa781('0xa')](_0x4b0766)[_0xa781('0xc')](_0x549dd7);}};}function respondWithFilteredResult(_0x37634e,_0x295f98){return function(_0x3de63c){if(_0x3de63c){var _0x55fc00=typeof _0x295f98['offset']===_0xa781('0xd')&&typeof _0x295f98[_0xa781('0xe')]===_0xa781('0xd');var _0x49ce9a=_0x3de63c[_0xa781('0xf')];var _0x3dc6c9=_0x55fc00?0x0:_0x295f98['offset'];var _0x4f91f8=_0x55fc00?_0x3de63c[_0xa781('0xf')]:_0x295f98['offset']+_0x295f98[_0xa781('0xe')];var _0x1ba22d;if(_0x4f91f8>=_0x49ce9a){_0x4f91f8=_0x49ce9a;_0x1ba22d=0xc8;}else{_0x1ba22d=0xce;}_0x37634e[_0xa781('0xa')](_0x1ba22d);return _0x37634e[_0xa781('0x10')]('Content-Range',_0x3dc6c9+'-'+_0x4f91f8+'/'+_0x49ce9a)[_0xa781('0xc')](_0x3de63c);}return null;};}function removeEntity(_0x429d98){return function(_0xb01be5){if(_0xb01be5){return _0xb01be5[_0xa781('0x11')]()['then'](function(){var _0x335953=_0xb01be5['get']({'plain':!![]});var _0x554e0a=[{'name':_0xa781('0x12'),'value':_0xa781('0x13'),'ignore':![]},{'name':'OutboundRoutes','value':_0xa781('0x14'),'ignore':![]},{'name':_0xa781('0x15'),'value':_0xa781('0x16'),'ignore':![]}];var _0x3cea9c=_(_0x554e0a)[_0xa781('0x17')](_0xa781('0x18'))['map'](_0xa781('0x19'))[_0xa781('0x19')]();if(_[_0xa781('0x1a')](_0x3cea9c,_0x335953[_0xa781('0x1b')])){return;}var _0x5a30f2=_[_0xa781('0x1c')](_0x554e0a,[_0xa781('0x19'),_0x335953[_0xa781('0x1b')]])['name'];return db['UserProfileResource'][_0xa781('0x11')]({'where':{'type':_0x5a30f2,'resourceId':_0x335953['id']}})[_0xa781('0x1d')](function(){return _0xb01be5;});})[_0xa781('0x1d')](function(){_0x429d98[_0xa781('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30e11b){return function(_0x73c964){if(!_0x73c964){_0x30e11b[_0xa781('0x1e')](0x194);}return _0x73c964;};}function handleError(_0x39e93f,_0x4afd6c){_0x4afd6c=_0x4afd6c||0x1f4;return function(_0x27bb27){logger[_0xa781('0x1f')](_0x27bb27[_0xa781('0x20')]);if(_0x27bb27['name']){delete _0x27bb27['name'];}_0x39e93f[_0xa781('0xa')](_0x4afd6c)[_0xa781('0x21')](_0x27bb27);};}exports['index']=function(_0x2955bf,_0x33b403){var _0x21a7f7={},_0x3d5cdf={},_0x356da6={'count':0x0,'rows':[]};var _0x424aef=_['map'](db[_0xa781('0x22')]['rawAttributes'],function(_0xc39b57){return{'name':_0xc39b57[_0xa781('0x23')],'type':_0xc39b57[_0xa781('0x1b')][_0xa781('0x24')]};});_0x3d5cdf[_0xa781('0x25')]=_[_0xa781('0x26')](_0x424aef,_0xa781('0x27'));_0x3d5cdf[_0xa781('0x28')]=_[_0xa781('0x29')](_0x2955bf[_0xa781('0x28')]);_0x3d5cdf[_0xa781('0x2a')]=_['intersection'](_0x3d5cdf[_0xa781('0x25')],_0x3d5cdf['query']);_0x21a7f7[_0xa781('0x2b')]=_[_0xa781('0x2c')](_0x3d5cdf[_0xa781('0x25')],qs[_0xa781('0x2d')](_0x2955bf[_0xa781('0x28')][_0xa781('0x2d')]));_0x21a7f7['attributes']=_0x21a7f7[_0xa781('0x2b')][_0xa781('0x2e')]?_0x21a7f7[_0xa781('0x2b')]:_0x3d5cdf[_0xa781('0x25')];if(!_0x2955bf['query'][_0xa781('0x2f')](_0xa781('0x30'))){_0x21a7f7[_0xa781('0xe')]=qs['limit'](_0x2955bf[_0xa781('0x28')][_0xa781('0xe')]);_0x21a7f7[_0xa781('0x31')]=qs[_0xa781('0x31')](_0x2955bf[_0xa781('0x28')][_0xa781('0x31')]);}_0x21a7f7[_0xa781('0x32')]=qs[_0xa781('0x33')](_0x2955bf[_0xa781('0x28')][_0xa781('0x33')]);_0x21a7f7[_0xa781('0x34')]=qs[_0xa781('0x2a')](_['pick'](_0x2955bf[_0xa781('0x28')],_0x3d5cdf[_0xa781('0x2a')]),_0x424aef);if(_0x2955bf[_0xa781('0x28')][_0xa781('0x17')]){_0x21a7f7[_0xa781('0x34')]=_[_0xa781('0x35')](_0x21a7f7[_0xa781('0x34')],{'$or':_[_0xa781('0x26')](_0x424aef,function(_0x159c69){if(_0x159c69[_0xa781('0x1b')]!=='VIRTUAL'){var _0x7e12d4={};_0x7e12d4[_0x159c69[_0xa781('0x27')]]={'$like':'%'+_0x2955bf[_0xa781('0x28')][_0xa781('0x17')]+'%'};return _0x7e12d4;}})});}_0x21a7f7=_[_0xa781('0x35')]({},_0x21a7f7,_0x2955bf[_0xa781('0x36')]);var _0x22554c={'where':_0x21a7f7[_0xa781('0x34')]};return db[_0xa781('0x22')][_0xa781('0xf')](_0x22554c)['then'](function(_0x347b17){_0x356da6[_0xa781('0xf')]=_0x347b17;if(_0x2955bf['query'][_0xa781('0x37')]){_0x21a7f7[_0xa781('0x38')]=[{'all':!![]}];}return db['VoiceExtension'][_0xa781('0x39')](_0x21a7f7);})['then'](function(_0xea11e3){_0x356da6[_0xa781('0x3a')]=_0xea11e3;return _0x356da6;})[_0xa781('0x1d')](respondWithFilteredResult(_0x33b403,_0x21a7f7))[_0xa781('0x3b')](handleError(_0x33b403,null));};exports['show']=function(_0x13021f,_0x6a2886){var _0x37ece9={'raw':![],'where':{'id':_0x13021f[_0xa781('0x3c')]['id']}},_0x440b00={};_0x440b00[_0xa781('0x25')]=_[_0xa781('0x29')](db[_0xa781('0x22')][_0xa781('0x3d')]);_0x440b00[_0xa781('0x28')]=_['keys'](_0x13021f[_0xa781('0x28')]);_0x440b00['filters']=_['intersection'](_0x440b00[_0xa781('0x25')],_0x440b00[_0xa781('0x28')]);_0x37ece9[_0xa781('0x2b')]=_[_0xa781('0x2c')](_0x440b00[_0xa781('0x25')],qs['fields'](_0x13021f[_0xa781('0x28')][_0xa781('0x2d')]));_0x37ece9[_0xa781('0x2b')]=_0x37ece9[_0xa781('0x2b')][_0xa781('0x2e')]?_0x37ece9[_0xa781('0x2b')]:_0x440b00[_0xa781('0x25')];if(_0x13021f[_0xa781('0x28')][_0xa781('0x37')]){_0x37ece9[_0xa781('0x38')]=[{'all':!![]}];}_0x37ece9=_[_0xa781('0x35')]({},_0x37ece9,_0x13021f[_0xa781('0x36')]);return db[_0xa781('0x22')][_0xa781('0x1c')](_0x37ece9)[_0xa781('0x1d')](handleEntityNotFound(_0x6a2886,null))[_0xa781('0x1d')](respondWithResult(_0x6a2886,null))[_0xa781('0x3b')](handleError(_0x6a2886,null));};exports[_0xa781('0x11')]=function(_0x49a6b9,_0xd6e47d){return db[_0xa781('0x22')][_0xa781('0x1c')]({'where':{'id':_0x49a6b9[_0xa781('0x3c')]['id']}})[_0xa781('0x1d')](handleEntityNotFound(_0xd6e47d,null))[_0xa781('0x1d')](removeEntity(_0xd6e47d,null))[_0xa781('0x3b')](handleError(_0xd6e47d,null));};exports[_0xa781('0x3e')]=function(_0x577829,_0x8c86bb){if(_0x577829['body'][_0xa781('0x1b')]==='outbound'&&!_[_0xa781('0x3f')](_0x577829[_0xa781('0x40')]['exten'],'_')){_0x577829[_0xa781('0x40')][_0xa781('0x41')]='_'[_0xa781('0x42')](_0x577829[_0xa781('0x40')][_0xa781('0x41')]);}return db[_0xa781('0x22')][_0xa781('0x3e')](_0x577829[_0xa781('0x40')],{'raw':![]})[_0xa781('0x1d')](function(_0x5e4820){var _0x1512b5=_0x577829[_0xa781('0x43')][_0xa781('0x44')]({'plain':!![]});if(!_0x1512b5)throw new Error(_0xa781('0x45'));if(_0x1512b5[_0xa781('0x46')]===_0xa781('0x43')){var _0x55626a=_0x5e4820[_0xa781('0x44')]({'plain':!![]});var _0x23d037=[{'name':'InboundRoutes','value':_0xa781('0x13')},{'name':'OutboundRoutes','value':_0xa781('0x14')},{'name':'InternalRoutes','value':_0xa781('0x16')}];var _0x4c3648=_[_0xa781('0x1c')](_0x23d037,[_0xa781('0x19'),_0x55626a[_0xa781('0x1b')]])[_0xa781('0x27')];return db[_0xa781('0x47')]['find']({'where':{'name':_0x4c3648,'userProfileId':_0x1512b5['userProfileId']},'raw':!![]})[_0xa781('0x1d')](function(_0x4a6518){if(_0x4a6518&&_0x4a6518[_0xa781('0x48')]===0x0){return db[_0xa781('0x49')][_0xa781('0x3e')]({'name':_0x55626a['name'],'resourceId':_0x55626a['id'],'type':_0x4a6518[_0xa781('0x27')],'sectionId':_0x4a6518['id']},{})[_0xa781('0x1d')](function(){return _0x5e4820;});}else{return _0x5e4820;}})[_0xa781('0x3b')](function(_0x100f68){logger['error'](_0xa781('0x4a'),_0x100f68);throw _0x100f68;});}return _0x5e4820;})['then'](respondWithResult(_0x8c86bb,0xc9))[_0xa781('0x3b')](handleError(_0x8c86bb,null));};exports[_0xa781('0x4b')]=function(_0x4545bb,_0x1a52b0){if(_0x4545bb[_0xa781('0x40')]['id']){delete _0x4545bb[_0xa781('0x40')]['id'];}return db[_0xa781('0x22')][_0xa781('0x1c')]({'where':{'id':_0x4545bb['params']['id']}})['then'](handleEntityNotFound(_0x1a52b0,null))[_0xa781('0x1d')](function(_0x24c120){if(_0x24c120){return db[_0xa781('0x22')][_0xa781('0x4b')](_[_0xa781('0x4c')](_0x4545bb[_0xa781('0x40')],['exten',_0xa781('0x4d'),'description',_0xa781('0x4e'),_0xa781('0x4f'),'mandatoryDisposition',_0xa781('0x50')]),{'where':{'context':_0x24c120[_0xa781('0x4d')],'exten':_0x24c120[_0xa781('0x41')]},'individualHooks':!![]})[_0xa781('0x1d')](function(_0x10b214){return _0x10b214;});}return null;})[_0xa781('0x1d')](respondWithStatusCode(_0x1a52b0,null))['catch'](handleError(_0x1a52b0,null));};exports[_0xa781('0x51')]=function(_0x3f8827,_0xe8d8ca){var _0xe54399=_0x3f8827[_0xa781('0x3c')]['id'];var _0x30c54f=_0x3f8827[_0xa781('0x40')];var _0x50b402=0xc8;var _0x4d5545=null;return db[_0xa781('0x52')][_0xa781('0x53')]({'isolationLevel':db['sequelize'][_0xa781('0x54')][_0xa781('0x55')][_0xa781('0x56')]},function(_0x305809){return db[_0xa781('0x22')][_0xa781('0x57')]({'where':{'id':_0xe54399},'transaction':_0x305809})[_0xa781('0x1d')](function(_0x256dbb){if(_0x256dbb){return db[_0xa781('0x22')]['destroy']({'where':{'VoiceExtensionId':_0xe54399},'transaction':_0x305809})[_0xa781('0x1d')](function(){var _0x58ec8e=_['map'](_0x30c54f,function(_0x21ccb6){_0x21ccb6[_0xa781('0x58')]=_0xe54399;_0x21ccb6['isApp']=!![];return _0x21ccb6;});return _0x256dbb[_0xa781('0x59')](_0x58ec8e);})[_0xa781('0x1d')](function(_0x3425c8){return db[_0xa781('0x22')][_0xa781('0x5a')](_0x3425c8,{'transaction':_0x305809});});}else{_0x50b402=0x194;_0x4d5545=[];}});})[_0xa781('0x1d')](function(){if(_0x50b402!==0x194){return db[_0xa781('0x22')][_0xa781('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0xe54399},'order':_0xa781('0x5c')})[_0xa781('0x1d')](function(_0x2c5feb){_0x4d5545=_0x2c5feb;});}})[_0xa781('0x3b')](function(_0x2e5958){_0x50b402=0x1f4;logger[_0xa781('0x1f')](_0x2e5958[_0xa781('0x20')]);if(_0x2e5958['name']){delete _0x2e5958[_0xa781('0x27')];}_0x4d5545=_0x2e5958;})[_0xa781('0x5d')](function(){if(_0x4d5545===null){_0xe8d8ca['sendStatus'](_0x50b402);}else{if(_0x50b402===0x1f4){_0xe8d8ca['status'](_0x50b402)[_0xa781('0x21')](_0x4d5545);}else{_0xe8d8ca[_0xa781('0xa')](_0x50b402)[_0xa781('0xc')](_0x4d5545);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9039faa..e5595ea 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 _0x2e6b=['remove','emit','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','update'];(function(_0x3c9c05,_0x31f740){var _0x2f1d51=function(_0x123a10){while(--_0x123a10){_0x3c9c05['push'](_0x3c9c05['shift']());}};_0x2f1d51(++_0x31f740);}(_0x2e6b,0x148));var _0xb2e6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2e6b[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xb2e6('0x0'));var VoiceExtension=require(_0xb2e6('0x1'))['db'][_0xb2e6('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb2e6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb2e6('0x4'),'afterDestroy':_0xb2e6('0x5')};function emitEvent(_0x5824dd){return function(_0x2b0f10,_0x5e681b,_0x2b921d){VoiceExtensionEvents[_0xb2e6('0x6')](_0x5824dd+':'+_0x2b0f10['id'],_0x2b0f10);VoiceExtensionEvents['emit'](_0x5824dd,_0x2b0f10);_0x2b921d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xb2e6('0x7')](e,emitEvent(event));}}module[_0xb2e6('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x056d=['VoiceExtension','save','update','remove','emit','hook','events'];(function(_0x20f630,_0x387bf6){var _0x34a034=function(_0x12b7af){while(--_0x12b7af){_0x20f630['push'](_0x20f630['shift']());}};_0x34a034(++_0x387bf6);}(_0x056d,0x125));var _0xd056=function(_0x7e6848,_0x2c333a){_0x7e6848=_0x7e6848-0x0;var _0x110775=_0x056d[_0x7e6848];return _0x110775;};'use strict';var EventEmitter=require(_0xd056('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xd056('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd056('0x2'),'afterUpdate':_0xd056('0x3'),'afterDestroy':_0xd056('0x4')};function emitEvent(_0x25be8f){return function(_0x6613fd,_0x10f866,_0x4173e5){VoiceExtensionEvents[_0xd056('0x5')](_0x25be8f+':'+_0x6613fd['id'],_0x6613fd);VoiceExtensionEvents['emit'](_0x25be8f,_0x6613fd);_0x4173e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xd056('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index a9e7a3c..51b591e 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 _0xb1a3=['split','length','param','phone','prefix','${EXTEN:','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','priority','last','define','VoiceExtension','voice_extensions','get','concat','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','exten','alias','CDR(routeAlias)=','context','push','inbound','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url'];(function(_0x4b6086,_0x3b9028){var _0x4da986=function(_0x4fa742){while(--_0x4fa742){_0x4b6086['push'](_0x4b6086['shift']());}};_0x4da986(++_0x3b9028);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xb1a3[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x3b1a('0x0'));var attributes=require(_0x3b1a('0x1'));module[_0x3b1a('0x2')]=function(_0x5b8410){var _0x23230d=_0x5b8410['models'];function _0x5c84f6(_0x41fe6c){var _0x77489e=0x2;var _0xd2c9e1=[{'type':_0x41fe6c[_0x3b1a('0x3')],'app':_0x3b1a('0x4'),'appdata':_0x3b1a('0x5')+_0x41fe6c[_0x3b1a('0x3')],'context':_0x41fe6c['context'],'exten':_0x41fe6c[_0x3b1a('0x6')],'priority':_0x77489e++,'VoiceExtensionId':_0x41fe6c['id']},{'type':_0x41fe6c[_0x3b1a('0x3')],'app':_0x41fe6c[_0x3b1a('0x7')]?_0x3b1a('0x4'):'NoOp','appdata':_0x41fe6c['alias']?_0x3b1a('0x8')+_0x41fe6c[_0x3b1a('0x7')]:'No\x20alias\x20set','context':_0x41fe6c[_0x3b1a('0x9')],'exten':_0x41fe6c['exten'],'priority':_0x77489e++,'VoiceExtensionId':_0x41fe6c['id']}];if(_0x41fe6c[_0x3b1a('0x3')]==='inbound'){_0xd2c9e1[_0x3b1a('0xa')]({'type':_0x3b1a('0xb'),'app':_0x3b1a('0x4'),'appdata':_0x3b1a('0xc')+_0x41fe6c['id'],'context':_0x41fe6c[_0x3b1a('0x9')],'exten':_0x41fe6c[_0x3b1a('0x6')],'priority':_0x77489e++,'VoiceExtensionId':_0x41fe6c['id']});}_0xd2c9e1[_0x3b1a('0xa')]({'type':_0x41fe6c[_0x3b1a('0x3')],'app':_0x3b1a('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x41fe6c['context'],'exten':_0x41fe6c[_0x3b1a('0x6')],'priority':_0x77489e++,'VoiceExtensionId':_0x41fe6c['id']},{'type':_0x41fe6c[_0x3b1a('0x3')],'app':_0x3b1a('0x4'),'appdata':_0x3b1a('0xd'),'context':_0x41fe6c['context'],'exten':_0x41fe6c[_0x3b1a('0x6')],'priority':_0x77489e++,'VoiceExtensionId':_0x41fe6c['id']},{'type':_0x41fe6c[_0x3b1a('0x3')],'app':'Set','appdata':_0x3b1a('0xe'),'context':_0x41fe6c[_0x3b1a('0x9')],'exten':_0x41fe6c[_0x3b1a('0x6')],'priority':_0x77489e++,'VoiceExtensionId':_0x41fe6c['id']});return _0xd2c9e1;}function _0x177358(_0x2ba12b){var _0xf10b60=0x2;var _0x3b6ad7=[{'type':_0x3b1a('0xf'),'app':'Set','appdata':_0x3b1a('0x10'),'context':_0x2ba12b[_0x3b1a('0x9')],'exten':_0x2ba12b['exten'],'priority':_0xf10b60++,'VoiceExtensionId':_0x2ba12b['id']},{'type':_0x3b1a('0xf'),'app':_0x2ba12b['alias']?_0x3b1a('0x4'):_0x3b1a('0x11'),'appdata':_0x2ba12b[_0x3b1a('0x7')]?_0x3b1a('0x8')+_0x2ba12b[_0x3b1a('0x7')]:_0x3b1a('0x12'),'context':_0x2ba12b['context'],'exten':_0x2ba12b[_0x3b1a('0x6')],'priority':_0xf10b60++,'VoiceExtensionId':_0x2ba12b['id']},{'type':_0x3b1a('0xf'),'app':_0x3b1a('0x4'),'appdata':_0x3b1a('0x13')+(_0x2ba12b[_0x3b1a('0x14')]?'${EXTEN:'+_0x2ba12b['cutdigits']+'}':_0x3b1a('0x15')),'context':_0x2ba12b[_0x3b1a('0x9')],'exten':_0x2ba12b[_0x3b1a('0x6')],'priority':_0xf10b60++,'VoiceExtensionId':_0x2ba12b['id']},{'type':_0x3b1a('0xf'),'app':_0x3b1a('0x4'),'appdata':_0x3b1a('0xc')+_0x2ba12b['id'],'context':_0x2ba12b[_0x3b1a('0x9')],'exten':_0x2ba12b['exten'],'priority':_0xf10b60++,'VoiceExtensionId':_0x2ba12b['id']},{'type':_0x3b1a('0xf'),'app':_0x3b1a('0x16'),'appdata':_0x3b1a('0x17')+(_0xf10b60+0x2)+'):Goto('+(_0xf10b60+0x1)+')','context':_0x2ba12b[_0x3b1a('0x9')],'exten':_0x2ba12b[_0x3b1a('0x6')],'priority':_0xf10b60++,'VoiceExtensionId':_0x2ba12b['id']},{'type':_0x3b1a('0xf'),'app':_0x3b1a('0x4'),'appdata':_0x2ba12b[_0x3b1a('0x14')]?_0x3b1a('0x18')+_0x2ba12b['cutdigits']+'}':_0x3b1a('0x19'),'context':_0x2ba12b[_0x3b1a('0x9')],'exten':_0x2ba12b[_0x3b1a('0x6')],'priority':_0xf10b60++,'VoiceExtensionId':_0x2ba12b['id']},{'type':_0x3b1a('0xf'),'app':_0x3b1a('0x4'),'appdata':_0x3b1a('0x1a'),'context':_0x2ba12b['context'],'exten':_0x2ba12b['exten'],'priority':_0xf10b60++,'VoiceExtensionId':_0x2ba12b['id']},{'type':_0x3b1a('0xf'),'app':_0x3b1a('0x4'),'appdata':_0x3b1a('0xd'),'context':_0x2ba12b[_0x3b1a('0x9')],'exten':_0x2ba12b[_0x3b1a('0x6')],'priority':_0xf10b60++,'VoiceExtensionId':_0x2ba12b['id']},{'type':_0x3b1a('0xf'),'app':_0x3b1a('0x4'),'appdata':_0x3b1a('0xe'),'context':_0x2ba12b[_0x3b1a('0x9')],'exten':_0x2ba12b['exten'],'priority':_0xf10b60++,'VoiceExtensionId':_0x2ba12b['id']},{'type':_0x3b1a('0xf'),'app':_0x3b1a('0x4'),'appdata':_0x3b1a('0x1b')+_0x2ba12b['id'],'context':_0x2ba12b[_0x3b1a('0x9')],'exten':_0x2ba12b[_0x3b1a('0x6')],'priority':_0xf10b60++,'VoiceExtensionId':_0x2ba12b['id']}];if(_0x2ba12b[_0x3b1a('0x1c')](_0x3b1a('0x1d'))&&_0x2ba12b[_0x3b1a('0x1d')]!==_0x3b1a('0x1e')){_0x3b6ad7['push']({'type':_0x3b1a('0xf'),'app':_0x3b1a('0x4'),'appdata':_0x3b1a('0x1f'),'context':_0x2ba12b[_0x3b1a('0x9')],'exten':_0x2ba12b['exten'],'priority':_0xf10b60++,'VoiceExtensionId':_0x2ba12b['id']},{'type':_0x3b1a('0xf'),'app':_0x3b1a('0x4'),'appdata':_0x3b1a('0x20')+_0x2ba12b[_0x3b1a('0x1d')]||_0x3b1a('0x21'),'context':_0x2ba12b[_0x3b1a('0x9')],'exten':_0x2ba12b[_0x3b1a('0x6')],'priority':_0xf10b60++,'VoiceExtensionId':_0x2ba12b['id']});}return _0x3b6ad7;}function _0x422db4(_0x51086c,_0x189e00){var _0x2be45d=[{'name':_0x3b1a('0x22'),'param':0x0},{'name':_0x3b1a('0x23'),'param':0x1},{'name':_0x3b1a('0x24'),'param':0x2},{'name':_0x3b1a('0x25'),'param':0x3}];var _0x1cfcd4={};var _0x591a10=_0x189e00[_0x3b1a('0x26')](',');var _0x420d13=[];for(var _0x525d46=0x0;_0x525d46<_0x2be45d[_0x3b1a('0x27')];_0x525d46++){switch(_0x2be45d[_0x525d46]['name']){case _0x3b1a('0x22'):_0x1cfcd4[_0x3b1a('0x22')]=_0x591a10[_0x2be45d[_0x525d46][_0x3b1a('0x28')]][_0x3b1a('0x26')]('/')[0x1];_0x1cfcd4[_0x3b1a('0x29')]=_0x591a10[_0x2be45d[_0x525d46][_0x3b1a('0x28')]][_0x3b1a('0x26')]('/')[0x2];_0x1cfcd4[_0x3b1a('0x2a')]=_0x1cfcd4[_0x3b1a('0x29')]?_0x1cfcd4['phone'][_0x3b1a('0x26')]('$')[0x0]:undefined;_0x1cfcd4[_0x3b1a('0x29')]=_0x51086c['cutdigits']?(_0x1cfcd4[_0x3b1a('0x2a')]||'')+_0x3b1a('0x2b')+_0x51086c[_0x3b1a('0x14')]+'}':(_0x1cfcd4[_0x3b1a('0x2a')]||'')+'${EXTEN}';_0x420d13[_0x2be45d[_0x525d46][_0x3b1a('0x28')]]=[_0x3b1a('0x2c'),_0x1cfcd4[_0x3b1a('0x22')],_0x1cfcd4['phone']][_0x3b1a('0x2d')]('/');break;case _0x3b1a('0x24'):_0x1cfcd4[_0x3b1a('0x24')]=_0x591a10[_0x2be45d[_0x525d46][_0x3b1a('0x28')]];if(_0x51086c['recordingFormat']!=='none'){if(_0x1cfcd4[_0x3b1a('0x24')][_0x3b1a('0x2e')](_0x3b1a('0x2f'))<0x0){_0x1cfcd4['options']+=_0x3b1a('0x2f');}}else{_0x1cfcd4[_0x3b1a('0x24')]=_0x1cfcd4[_0x3b1a('0x24')][_0x3b1a('0x30')]('U(xcally-mixmonitor-context)','');}_0x420d13[_0x2be45d[_0x525d46][_0x3b1a('0x28')]]=_0x1cfcd4['options'];break;default:_0x420d13[_0x2be45d[_0x525d46]['param']]=_0x591a10[_0x2be45d[_0x525d46][_0x3b1a('0x28')]];}}return _0x420d13[_0x3b1a('0x2d')](',');}function _0x171e49(_0x4eee23,_0x152e0a,_0x423bc1){return new Promise(function(_0xb6b0f4,_0x3b35e0){var _0x94825b=[];if(_['isEmpty'](_0x152e0a))return _0xb6b0f4(_0x94825b);_0x23230d[_0x3b1a('0x31')][_0x3b1a('0x32')]({'attributes':['id',_0x3b1a('0x33'),_0x3b1a('0x34')],'raw':!![]})[_0x3b1a('0x35')](function(_0x4ddec1){for(var _0x2e1c3c=0x0,_0x51ef63=0x0;_0x2e1c3c<_0x152e0a[_0x3b1a('0x27')];_0x2e1c3c++,_0x51ef63=0x0){var _0xd5a38f=_0x152e0a[_0x2e1c3c];var _0x502326=[];var _0x25ce1d=[];delete _0xd5a38f['id'];if(_0xd5a38f[_0x3b1a('0x33')]!==_0x3b1a('0x36')){_0xd5a38f[_0x3b1a('0x37')]=[_0xd5a38f[_0x3b1a('0x33')]];}else{_0xd5a38f['intervals']=_0xd5a38f[_0x3b1a('0x34')]?_[_0x3b1a('0x38')](_[_0x3b1a('0x39')](_0x4ddec1,{'IntervalId':_0xd5a38f[_0x3b1a('0x34')]}),_0x3b1a('0x33')):[];}_0xd5a38f[_0x3b1a('0x9')]=_0x4eee23[_0x3b1a('0x9')];_0xd5a38f[_0x3b1a('0x6')]=_0x4eee23[_0x3b1a('0x6')];if(_0xd5a38f['type'])_0xd5a38f[_0x3b1a('0x3')]=_0xd5a38f[_0x3b1a('0x3')][_0x3b1a('0x3a')]();if(_0x4eee23[_0x3b1a('0x3')]==='outbound'){if(_0xd5a38f[_0x3b1a('0x1c')](_0x3b1a('0x3b'))&&_0xd5a38f['tag']&&_0xd5a38f['tag']!=='--'){_0x502326[_0x3b1a('0xa')]({'type':_0xd5a38f['type'][_0x3b1a('0x3a')](),'app':'Set','appdata':'CDR(tag)='+_0xd5a38f[_0x3b1a('0x3b')],'context':_0x4eee23[_0x3b1a('0x9')],'exten':_0x4eee23[_0x3b1a('0x6')],'priority':_0xd5a38f['intervals'][_0x3b1a('0x27')]+_0x423bc1+_0x51ef63++,'VoiceExtensionId':_0x4eee23['id']});}_0x502326[_0x3b1a('0xa')]({'type':_0xd5a38f[_0x3b1a('0x3')][_0x3b1a('0x3a')](),'app':_0x3b1a('0x16'),'appdata':_0x3b1a('0x3c')+(_0xd5a38f[_0x3b1a('0x3d')]?_0x3b1a('0x3e')+_0xd5a38f['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x4eee23['context'],'exten':_0x4eee23[_0x3b1a('0x6')],'priority':_0xd5a38f[_0x3b1a('0x37')]['length']+_0x423bc1+_0x51ef63++,'VoiceExtensionId':_0x4eee23['id']});}else{if(_0xd5a38f[_0x3b1a('0x1c')]('answer')){if(['queue','playback'][_0x3b1a('0x3f')](_0xd5a38f[_0x3b1a('0x40')]['toLowerCase']())&&_0xd5a38f[_0x3b1a('0x41')]!==_0x3b1a('0x42')){if(_0xd5a38f[_0x3b1a('0x43')]){_0x502326[_0x3b1a('0xa')]({'type':_0xd5a38f['type'][_0x3b1a('0x3a')](),'app':_0x3b1a('0x16'),'appdata':_0x3b1a('0x44'),'context':_0x4eee23[_0x3b1a('0x9')],'exten':_0x4eee23[_0x3b1a('0x6')],'priority':_0xd5a38f[_0x3b1a('0x37')][_0x3b1a('0x27')]+_0x423bc1+_0x51ef63++,'VoiceExtensionId':_0x4eee23['id']});_0x502326['push']({'type':_0xd5a38f['type'][_0x3b1a('0x3a')](),'app':_0x3b1a('0x4'),'appdata':_0x3b1a('0x45'),'context':_0x4eee23['context'],'exten':_0x4eee23[_0x3b1a('0x6')],'priority':_0xd5a38f[_0x3b1a('0x37')][_0x3b1a('0x27')]+_0x423bc1+_0x51ef63++,'VoiceExtensionId':_0x4eee23['id']});}else{_0x502326['push']({'type':_0xd5a38f[_0x3b1a('0x3')][_0x3b1a('0x3a')](),'app':_0x3b1a('0x16'),'appdata':_0x3b1a('0x46'),'context':_0x4eee23[_0x3b1a('0x9')],'exten':_0x4eee23[_0x3b1a('0x6')],'priority':_0xd5a38f['intervals'][_0x3b1a('0x27')]+_0x423bc1+_0x51ef63++,'VoiceExtensionId':_0x4eee23['id']});_0x502326['push']({'type':_0xd5a38f[_0x3b1a('0x3')][_0x3b1a('0x3a')](),'app':_0x3b1a('0x4'),'appdata':_0x3b1a('0x47'),'context':_0x4eee23['context'],'exten':_0x4eee23[_0x3b1a('0x6')],'priority':_0xd5a38f[_0x3b1a('0x37')][_0x3b1a('0x27')]+_0x423bc1+_0x51ef63++,'VoiceExtensionId':_0x4eee23['id']});}}}}for(var _0x597d5a=0x0;_0x597d5a<_0xd5a38f[_0x3b1a('0x37')][_0x3b1a('0x27')];_0x597d5a++){var _0x53897=_0x423bc1+_0xd5a38f[_0x3b1a('0x37')][_0x3b1a('0x27')];var _0x5be9c0=_0x597d5a===_0xd5a38f[_0x3b1a('0x37')][_0x3b1a('0x27')]-0x1?_0x423bc1+_0x502326[_0x3b1a('0x27')]+_0x25ce1d['length']+0x2:_0x423bc1+_0x597d5a+0x1;_0x502326[_0x3b1a('0x48')](_0x597d5a,0x0,{'type':_0x4eee23[_0x3b1a('0x3')],'app':_0x3b1a('0x49'),'appdata':_0xd5a38f['intervals'][_0x597d5a]+'?'+_0x4eee23['context']+_0x3b1a('0x4a')+_0x53897+':'+_0x4eee23[_0x3b1a('0x9')]+',${EXTEN},'+_0x5be9c0,'exten':_0x4eee23[_0x3b1a('0x6')],'context':_0x4eee23[_0x3b1a('0x9')],'priority':_0x423bc1+_0x597d5a,'VoiceExtensionId':_0x4eee23['id']});}if(_0xd5a38f[_0x3b1a('0x41')]==='outboundDial')_0xd5a38f['appdata']=_0x422db4(_0x4eee23,_0xd5a38f['appdata']);_0xd5a38f[_0x3b1a('0x4b')]=_0x502326[_0x3b1a('0x27')]?_[_0x3b1a('0x4c')](_0x502326)[_0x3b1a('0x4b')]+0x1:_0x423bc1;_0x94825b=_['concat'](_0x94825b,_0x502326,[_0xd5a38f],_0x25ce1d);_0x423bc1=_[_0x3b1a('0x4c')](_0x94825b)['priority']+0x1;}return _0xb6b0f4(_0x94825b);})['catch'](function(_0x401b12){_0x3b35e0(_0x401b12);});});}return _0x5b8410[_0x3b1a('0x4d')](_0x3b1a('0x4e'),attributes,{'tableName':_0x3b1a('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x34fc6b){var _0xc60bfd=this[_0x3b1a('0x50')]({'plain':!![]});var _0x220596=_0xc60bfd[_0x3b1a('0x3')]===_0x3b1a('0xf')?_0x177358(_0xc60bfd):_0x5c84f6(_0xc60bfd);return _0x171e49(_0xc60bfd,_0x34fc6b,_[_0x3b1a('0x4c')](_0x220596)[_0x3b1a('0x4b')]+0x1)[_0x3b1a('0x35')](function(_0x45f239){var _0x416e38=_[_0x3b1a('0x51')](_0x220596,_0x45f239);_0x416e38[_0x3b1a('0xa')]({'type':_0xc60bfd[_0x3b1a('0x3')],'app':_0x3b1a('0x52'),'exten':_0xc60bfd[_0x3b1a('0x6')],'context':_0xc60bfd[_0x3b1a('0x9')],'priority':_[_0x3b1a('0x4c')](_0x416e38)[_0x3b1a('0x4b')]+0x1,'VoiceExtensionId':_0xc60bfd['id']});return _0x416e38;});}}});}; \ No newline at end of file +var _0x5d01=['outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','indexOf','replace','U(xcally-mixmonitor-context)','Interval','IntervalId','then','interval','*,*,*,*','map','filter','toLowerCase','tag','CDR(tag)=','intervals','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','exten','NoOp','CDR(routeAlias)=','alias','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0x5d01,0xe5));var _0x15d0=function(_0x158f49,_0x3a3903){_0x158f49=_0x158f49-0x0;var _0x9fe32a=_0x5d01[_0x158f49];return _0x9fe32a;};'use strict';var _=require(_0x15d0('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x15d0('0x1')]=function(_0x451b82){var _0x580bc6=_0x451b82[_0x15d0('0x2')];function _0x665632(_0x5e76ab){var _0x53abcf=0x2;var _0x1a067d=[{'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x15d0('0x4'),'appdata':_0x15d0('0x5')+_0x5e76ab[_0x15d0('0x3')],'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab[_0x15d0('0x7')],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']},{'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x5e76ab['alias']?_0x15d0('0x4'):_0x15d0('0x8'),'appdata':_0x5e76ab['alias']?_0x15d0('0x9')+_0x5e76ab[_0x15d0('0xa')]:'No\x20alias\x20set','context':_0x5e76ab['context'],'exten':_0x5e76ab['exten'],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']}];if(_0x5e76ab[_0x15d0('0x3')]===_0x15d0('0xb')){_0x1a067d[_0x15d0('0xc')]({'type':_0x15d0('0xb'),'app':'Set','appdata':_0x15d0('0xd')+_0x5e76ab['id'],'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab[_0x15d0('0x7')],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']});}_0x1a067d[_0x15d0('0xc')]({'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x15d0('0x4'),'appdata':_0x15d0('0xe'),'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab['exten'],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']},{'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x15d0('0x4'),'appdata':_0x15d0('0xf'),'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab[_0x15d0('0x7')],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']},{'type':_0x5e76ab[_0x15d0('0x3')],'app':_0x15d0('0x4'),'appdata':_0x15d0('0x10'),'context':_0x5e76ab[_0x15d0('0x6')],'exten':_0x5e76ab['exten'],'priority':_0x53abcf++,'VoiceExtensionId':_0x5e76ab['id']});return _0x1a067d;}function _0x50ae3a(_0x536f28){var _0x6831b6=0x2;var _0x1abfa8=[{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x12'),'context':_0x536f28['context'],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x536f28[_0x15d0('0xa')]?_0x15d0('0x4'):'NoOp','appdata':_0x536f28[_0x15d0('0xa')]?'CDR(routeAlias)='+_0x536f28['alias']:_0x15d0('0x13'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':'Set','appdata':_0x15d0('0x14')+(_0x536f28[_0x15d0('0x15')]?_0x15d0('0x16')+_0x536f28[_0x15d0('0x15')]+'}':'${EXTEN}'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28['exten'],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':'CDR(routeid)='+_0x536f28['id'],'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x17'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x6831b6+0x2)+_0x15d0('0x18')+(_0x6831b6+0x1)+')','context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28['exten'],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':'Set','appdata':_0x536f28['cutdigits']?_0x15d0('0x19')+_0x536f28[_0x15d0('0x15')]+'}':'CDR(prefix)=noprefix','context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':'Set','appdata':_0x15d0('0xe'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':_0x15d0('0xf'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x10'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x1a')+_0x536f28['id'],'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']}];if(_0x536f28[_0x15d0('0x1b')](_0x15d0('0x1c'))&&_0x536f28[_0x15d0('0x1c')]!==_0x15d0('0x1d')){_0x1abfa8[_0x15d0('0xc')]({'type':'outbound','app':_0x15d0('0x4'),'appdata':_0x15d0('0x1e'),'context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']},{'type':_0x15d0('0x11'),'app':_0x15d0('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x536f28[_0x15d0('0x1c')]||'wav','context':_0x536f28[_0x15d0('0x6')],'exten':_0x536f28[_0x15d0('0x7')],'priority':_0x6831b6++,'VoiceExtensionId':_0x536f28['id']});}return _0x1abfa8;}function _0x496c80(_0x35e1dc,_0x8e02a0){var _0x495d2a=[{'name':_0x15d0('0x1f'),'param':0x0},{'name':_0x15d0('0x20'),'param':0x1},{'name':_0x15d0('0x21'),'param':0x2},{'name':_0x15d0('0x22'),'param':0x3}];var _0x4a7d94={};var _0x54601c=_0x8e02a0[_0x15d0('0x23')](',');var _0x3a9b23=[];for(var _0xdd62e5=0x0;_0xdd62e5<_0x495d2a[_0x15d0('0x24')];_0xdd62e5++){switch(_0x495d2a[_0xdd62e5][_0x15d0('0x25')]){case _0x15d0('0x1f'):_0x4a7d94['trunk']=_0x54601c[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]][_0x15d0('0x23')]('/')[0x1];_0x4a7d94[_0x15d0('0x27')]=_0x54601c[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]]['split']('/')[0x2];_0x4a7d94[_0x15d0('0x28')]=_0x4a7d94[_0x15d0('0x27')]?_0x4a7d94[_0x15d0('0x27')]['split']('$')[0x0]:undefined;_0x4a7d94['phone']=_0x35e1dc[_0x15d0('0x15')]?(_0x4a7d94[_0x15d0('0x28')]||'')+_0x15d0('0x16')+_0x35e1dc[_0x15d0('0x15')]+'}':(_0x4a7d94[_0x15d0('0x28')]||'')+'${EXTEN}';_0x3a9b23[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]]=[_0x15d0('0x29'),_0x4a7d94[_0x15d0('0x1f')],_0x4a7d94[_0x15d0('0x27')]][_0x15d0('0x2a')]('/');break;case _0x15d0('0x21'):_0x4a7d94[_0x15d0('0x21')]=_0x54601c[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]];if(_0x35e1dc[_0x15d0('0x1c')]!==_0x15d0('0x1d')){if(_0x4a7d94[_0x15d0('0x21')][_0x15d0('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x4a7d94[_0x15d0('0x21')]+='U(xcally-mixmonitor-context)';}}else{_0x4a7d94[_0x15d0('0x21')]=_0x4a7d94[_0x15d0('0x21')][_0x15d0('0x2c')](_0x15d0('0x2d'),'');}_0x3a9b23[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]]=_0x4a7d94[_0x15d0('0x21')];break;default:_0x3a9b23[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]]=_0x54601c[_0x495d2a[_0xdd62e5][_0x15d0('0x26')]];}}return _0x3a9b23[_0x15d0('0x2a')](',');}function _0x622830(_0x5ba147,_0x2be6ca,_0x21c3bf){return new Promise(function(_0x230bb2,_0x1f1b3c){var _0x25eedb=[];if(_['isEmpty'](_0x2be6ca))return _0x230bb2(_0x25eedb);_0x580bc6[_0x15d0('0x2e')]['findAll']({'attributes':['id','interval',_0x15d0('0x2f')],'raw':!![]})[_0x15d0('0x30')](function(_0x367d58){for(var _0x11933f=0x0,_0x1c7c01=0x0;_0x11933f<_0x2be6ca['length'];_0x11933f++,_0x1c7c01=0x0){var _0xb4be9b=_0x2be6ca[_0x11933f];var _0x32de8d=[];var _0x1b38e7=[];delete _0xb4be9b['id'];if(_0xb4be9b[_0x15d0('0x31')]!==_0x15d0('0x32')){_0xb4be9b['intervals']=[_0xb4be9b[_0x15d0('0x31')]];}else{_0xb4be9b['intervals']=_0xb4be9b[_0x15d0('0x2f')]?_[_0x15d0('0x33')](_[_0x15d0('0x34')](_0x367d58,{'IntervalId':_0xb4be9b[_0x15d0('0x2f')]}),'interval'):[];}_0xb4be9b[_0x15d0('0x6')]=_0x5ba147[_0x15d0('0x6')];_0xb4be9b[_0x15d0('0x7')]=_0x5ba147[_0x15d0('0x7')];if(_0xb4be9b[_0x15d0('0x3')])_0xb4be9b[_0x15d0('0x3')]=_0xb4be9b['type'][_0x15d0('0x35')]();if(_0x5ba147[_0x15d0('0x3')]==='outbound'){if(_0xb4be9b[_0x15d0('0x1b')](_0x15d0('0x36'))&&_0xb4be9b[_0x15d0('0x36')]&&_0xb4be9b[_0x15d0('0x36')]!=='--'){_0x32de8d[_0x15d0('0xc')]({'type':_0xb4be9b[_0x15d0('0x3')]['toLowerCase'](),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x37')+_0xb4be9b[_0x15d0('0x36')],'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147[_0x15d0('0x7')],'priority':_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});}_0x32de8d[_0x15d0('0xc')]({'type':_0xb4be9b[_0x15d0('0x3')][_0x15d0('0x35')](),'app':_0x15d0('0x17'),'appdata':_0x15d0('0x39')+(_0xb4be9b[_0x15d0('0x3a')]?_0x15d0('0x3b')+_0xb4be9b[_0x15d0('0x3a')]+')':_0x15d0('0x3c')),'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147['exten'],'priority':_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});}else{if(_0xb4be9b[_0x15d0('0x1b')]('answer')){if([_0x15d0('0x3d'),_0x15d0('0x3e')][_0x15d0('0x3f')](_0xb4be9b[_0x15d0('0x40')][_0x15d0('0x35')]())&&_0xb4be9b['appType']!==_0x15d0('0x41')){if(_0xb4be9b['answer']){_0x32de8d['push']({'type':_0xb4be9b[_0x15d0('0x3')][_0x15d0('0x35')](),'app':_0x15d0('0x17'),'appdata':_0x15d0('0x42'),'context':_0x5ba147['context'],'exten':_0x5ba147['exten'],'priority':_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});_0x32de8d[_0x15d0('0xc')]({'type':_0xb4be9b[_0x15d0('0x3')][_0x15d0('0x35')](),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x43'),'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147['exten'],'priority':_0xb4be9b['intervals'][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});}else{_0x32de8d['push']({'type':_0xb4be9b[_0x15d0('0x3')]['toLowerCase'](),'app':_0x15d0('0x17'),'appdata':_0x15d0('0x44'),'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147[_0x15d0('0x7')],'priority':_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});_0x32de8d['push']({'type':_0xb4be9b[_0x15d0('0x3')]['toLowerCase'](),'app':_0x15d0('0x4'),'appdata':_0x15d0('0x45'),'context':_0x5ba147[_0x15d0('0x6')],'exten':_0x5ba147[_0x15d0('0x7')],'priority':_0xb4be9b['intervals'][_0x15d0('0x24')]+_0x21c3bf+_0x1c7c01++,'VoiceExtensionId':_0x5ba147['id']});}}}}for(var _0x2eb7be=0x0;_0x2eb7be<_0xb4be9b['intervals'][_0x15d0('0x24')];_0x2eb7be++){var _0x507584=_0x21c3bf+_0xb4be9b[_0x15d0('0x38')][_0x15d0('0x24')];var _0x5868bf=_0x2eb7be===_0xb4be9b['intervals'][_0x15d0('0x24')]-0x1?_0x21c3bf+_0x32de8d[_0x15d0('0x24')]+_0x1b38e7[_0x15d0('0x24')]+0x2:_0x21c3bf+_0x2eb7be+0x1;_0x32de8d[_0x15d0('0x46')](_0x2eb7be,0x0,{'type':_0x5ba147[_0x15d0('0x3')],'app':_0x15d0('0x47'),'appdata':_0xb4be9b[_0x15d0('0x38')][_0x2eb7be]+'?'+_0x5ba147[_0x15d0('0x6')]+',${EXTEN},'+_0x507584+':'+_0x5ba147['context']+_0x15d0('0x48')+_0x5868bf,'exten':_0x5ba147[_0x15d0('0x7')],'context':_0x5ba147[_0x15d0('0x6')],'priority':_0x21c3bf+_0x2eb7be,'VoiceExtensionId':_0x5ba147['id']});}if(_0xb4be9b[_0x15d0('0x49')]===_0x15d0('0x4a'))_0xb4be9b['appdata']=_0x496c80(_0x5ba147,_0xb4be9b[_0x15d0('0x4b')]);_0xb4be9b[_0x15d0('0x4c')]=_0x32de8d[_0x15d0('0x24')]?_[_0x15d0('0x4d')](_0x32de8d)[_0x15d0('0x4c')]+0x1:_0x21c3bf;_0x25eedb=_[_0x15d0('0x4e')](_0x25eedb,_0x32de8d,[_0xb4be9b],_0x1b38e7);_0x21c3bf=_[_0x15d0('0x4d')](_0x25eedb)[_0x15d0('0x4c')]+0x1;}return _0x230bb2(_0x25eedb);})[_0x15d0('0x4f')](function(_0x5b6be7){_0x1f1b3c(_0x5b6be7);});});}return _0x451b82[_0x15d0('0x50')](_0x15d0('0x51'),attributes,{'tableName':_0x15d0('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1415d1){var _0x425511=this[_0x15d0('0x53')]({'plain':!![]});var _0x55f4b9=_0x425511[_0x15d0('0x3')]===_0x15d0('0x11')?_0x50ae3a(_0x425511):_0x665632(_0x425511);return _0x622830(_0x425511,_0x1415d1,_['last'](_0x55f4b9)['priority']+0x1)[_0x15d0('0x30')](function(_0x506701){var _0x23bb40=_['concat'](_0x55f4b9,_0x506701);_0x23bb40[_0x15d0('0xc')]({'type':_0x425511[_0x15d0('0x3')],'app':_0x15d0('0x54'),'exten':_0x425511['exten'],'context':_0x425511[_0x15d0('0x6')],'priority':_['last'](_0x23bb40)[_0x15d0('0x4c')]+0x1,'VoiceExtensionId':_0x425511['id']});return _0x23bb40;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 5205ac6..fc8169e 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 _0x2cd3=['where','map','model','attributes','include','then','GetVoiceExtension','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceExtension,\x20%s,\x20%s','result','catch','VoiceExtension','options','raw'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0x2cd3,0xf1));var _0x32cd=function(_0xd73d53,_0x598443){_0xd73d53=_0xd73d53-0x0;var _0x560148=_0x2cd3[_0xd73d53];return _0x560148;};'use strict';var _=require(_0x32cd('0x0'));var util=require('util');var moment=require(_0x32cd('0x1'));var BPromise=require(_0x32cd('0x2'));var rs=require(_0x32cd('0x3'));var fs=require('fs');var Redis=require(_0x32cd('0x4'));var db=require(_0x32cd('0x5'))['db'];var utils=require(_0x32cd('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x32cd('0x7'));var jayson=require(_0x32cd('0x8'));var client=jayson[_0x32cd('0x9')][_0x32cd('0xa')]({'port':0x232a});config[_0x32cd('0xb')]=_[_0x32cd('0xc')](config[_0x32cd('0xb')],{'host':_0x32cd('0xd'),'port':0x18eb});var socket=require(_0x32cd('0xe'))(new Redis(config[_0x32cd('0xb')]));require(_0x32cd('0xf'))[_0x32cd('0x10')](socket);function respondWithRpcPromise(_0x29e794,_0x425976,_0xa26503){return new BPromise(function(_0x164ad8,_0x2ceed9){return client[_0x32cd('0x11')](_0x29e794,_0xa26503)['then'](function(_0x5a0208){logger[_0x32cd('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x425976,'request\x20sent');logger[_0x32cd('0x13')](_0x32cd('0x14'),_0x425976,_0x32cd('0x15'),JSON[_0x32cd('0x16')](_0x5a0208));if(_0x5a0208[_0x32cd('0x17')]){if(_0x5a0208[_0x32cd('0x17')][_0x32cd('0x18')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x425976,_0x5a0208[_0x32cd('0x17')][_0x32cd('0x19')]);return _0x2ceed9(_0x5a0208[_0x32cd('0x17')][_0x32cd('0x19')]);}logger['error'](_0x32cd('0x1a'),_0x425976,_0x5a0208['error']['message']);return _0x164ad8(_0x5a0208[_0x32cd('0x17')][_0x32cd('0x19')]);}else{logger[_0x32cd('0x12')](_0x32cd('0x1a'),_0x425976,_0x32cd('0x15'));_0x164ad8(_0x5a0208[_0x32cd('0x1b')]['message']);}})[_0x32cd('0x1c')](function(_0x3c4f56){logger[_0x32cd('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x425976,_0x3c4f56);_0x2ceed9(_0x3c4f56);});});}exports['GetVoiceExtension']=function(_0x3e9880){var _0xed528d=this;return new Promise(function(_0x1356de,_0x19ab29){return db[_0x32cd('0x1d')]['findAll']({'raw':_0x3e9880[_0x32cd('0x1e')]?_0x3e9880[_0x32cd('0x1e')][_0x32cd('0x1f')]===undefined?!![]:![]:!![],'where':_0x3e9880[_0x32cd('0x1e')]?_0x3e9880[_0x32cd('0x1e')][_0x32cd('0x20')]||null:null,'attributes':_0x3e9880[_0x32cd('0x1e')]?_0x3e9880[_0x32cd('0x1e')]['attributes']||null:null,'limit':_0x3e9880[_0x32cd('0x1e')]?_0x3e9880['options']['limit']||null:null,'include':_0x3e9880[_0x32cd('0x1e')]?_0x3e9880['options']['include']?_[_0x32cd('0x21')](_0x3e9880[_0x32cd('0x1e')]['include'],function(_0x48dadb){return{'model':db[_0x48dadb[_0x32cd('0x22')]],'as':_0x48dadb['as'],'attributes':_0x48dadb[_0x32cd('0x23')],'include':_0x48dadb[_0x32cd('0x24')]?_[_0x32cd('0x21')](_0x48dadb['include'],function(_0x58a5c8){return{'model':db[_0x58a5c8['model']],'as':_0x58a5c8['as'],'attributes':_0x58a5c8[_0x32cd('0x23')],'include':_0x58a5c8[_0x32cd('0x24')]?_['map'](_0x58a5c8[_0x32cd('0x24')],function(_0x35f798){return{'model':db[_0x35f798[_0x32cd('0x22')]],'as':_0x35f798['as'],'attributes':_0x35f798[_0x32cd('0x23')]};}):[]};}):[]};}):[]:[]})[_0x32cd('0x25')](function(_0x330671){logger['info'](_0x32cd('0x26'),_0x3e9880);logger[_0x32cd('0x13')](_0x32cd('0x26'),_0x3e9880,JSON[_0x32cd('0x16')](_0x330671));_0x1356de(_0x330671);})[_0x32cd('0x1c')](function(_0x1232f1){logger['error'](_0x32cd('0x26'),_0x1232f1[_0x32cd('0x19')],_0x3e9880);_0x19ab29(_0xed528d[_0x32cd('0x17')](0x1f4,_0x1232f1[_0x32cd('0x19')]));});});}; \ No newline at end of file +var _0xcca7=['raw','attributes','limit','map','include','model','stringify','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetVoiceExtension','VoiceExtension','findAll','options'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0xcca7,0x1aa));var _0x7cca=function(_0x33eb80,_0x46570c){_0x33eb80=_0x33eb80-0x0;var _0x56c653=_0xcca7[_0x33eb80];return _0x56c653;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var moment=require(_0x7cca('0x2'));var BPromise=require(_0x7cca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cca('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7cca('0x5'))(_0x7cca('0x6'));var config=require(_0x7cca('0x7'));var jayson=require(_0x7cca('0x8'));var client=jayson[_0x7cca('0x9')][_0x7cca('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7cca('0xb')],{'host':_0x7cca('0xc'),'port':0x18eb});var socket=require(_0x7cca('0xd'))(new Redis(config[_0x7cca('0xb')]));require(_0x7cca('0xe'))[_0x7cca('0xf')](socket);function respondWithRpcPromise(_0x20ffa9,_0x2b8b62,_0x27323a){return new BPromise(function(_0x1a773e,_0x53b5f6){return client[_0x7cca('0x10')](_0x20ffa9,_0x27323a)[_0x7cca('0x11')](function(_0x275ab2){logger[_0x7cca('0x12')](_0x7cca('0x13'),_0x2b8b62,'request\x20sent');logger[_0x7cca('0x14')](_0x7cca('0x15'),_0x2b8b62,_0x7cca('0x16'),JSON['stringify'](_0x275ab2));if(_0x275ab2['error']){if(_0x275ab2[_0x7cca('0x17')][_0x7cca('0x18')]===0x1f4){logger[_0x7cca('0x17')](_0x7cca('0x13'),_0x2b8b62,_0x275ab2[_0x7cca('0x17')][_0x7cca('0x19')]);return _0x53b5f6(_0x275ab2[_0x7cca('0x17')]['message']);}logger[_0x7cca('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x2b8b62,_0x275ab2['error']['message']);return _0x1a773e(_0x275ab2[_0x7cca('0x17')][_0x7cca('0x19')]);}else{logger[_0x7cca('0x12')](_0x7cca('0x13'),_0x2b8b62,_0x7cca('0x16'));_0x1a773e(_0x275ab2['result'][_0x7cca('0x19')]);}})['catch'](function(_0x5d47f8){logger['error'](_0x7cca('0x13'),_0x2b8b62,_0x5d47f8);_0x53b5f6(_0x5d47f8);});});}exports[_0x7cca('0x1a')]=function(_0x2beb6c){var _0x1a20be=this;return new Promise(function(_0x36ba41,_0x45db2f){return db[_0x7cca('0x1b')][_0x7cca('0x1c')]({'raw':_0x2beb6c['options']?_0x2beb6c[_0x7cca('0x1d')][_0x7cca('0x1e')]===undefined?!![]:![]:!![],'where':_0x2beb6c[_0x7cca('0x1d')]?_0x2beb6c[_0x7cca('0x1d')]['where']||null:null,'attributes':_0x2beb6c[_0x7cca('0x1d')]?_0x2beb6c[_0x7cca('0x1d')][_0x7cca('0x1f')]||null:null,'limit':_0x2beb6c[_0x7cca('0x1d')]?_0x2beb6c[_0x7cca('0x1d')][_0x7cca('0x20')]||null:null,'include':_0x2beb6c[_0x7cca('0x1d')]?_0x2beb6c[_0x7cca('0x1d')]['include']?_[_0x7cca('0x21')](_0x2beb6c[_0x7cca('0x1d')][_0x7cca('0x22')],function(_0xdaf07f){return{'model':db[_0xdaf07f[_0x7cca('0x23')]],'as':_0xdaf07f['as'],'attributes':_0xdaf07f[_0x7cca('0x1f')],'include':_0xdaf07f[_0x7cca('0x22')]?_[_0x7cca('0x21')](_0xdaf07f['include'],function(_0x2cafe1){return{'model':db[_0x2cafe1['model']],'as':_0x2cafe1['as'],'attributes':_0x2cafe1[_0x7cca('0x1f')],'include':_0x2cafe1[_0x7cca('0x22')]?_['map'](_0x2cafe1[_0x7cca('0x22')],function(_0x3d91b1){return{'model':db[_0x3d91b1['model']],'as':_0x3d91b1['as'],'attributes':_0x3d91b1[_0x7cca('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7cca('0x11')](function(_0x100061){logger['info']('GetVoiceExtension',_0x2beb6c);logger[_0x7cca('0x14')](_0x7cca('0x1a'),_0x2beb6c,JSON[_0x7cca('0x24')](_0x100061));_0x36ba41(_0x100061);})[_0x7cca('0x25')](function(_0x34336c){logger[_0x7cca('0x17')](_0x7cca('0x1a'),_0x34336c['message'],_0x2beb6c);_0x45db2f(_0x1a20be['error'](0x1f4,_0x34336c[_0x7cca('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index ee62816..6546e35 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 _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x2f6b44,_0xf202be){var _0xf77503=function(_0x309193){while(--_0x309193){_0x2f6b44['push'](_0x2f6b44['shift']());}};_0xf77503(++_0xf202be);}(_0x5fab,0x177));var _0xb5fa=function(_0x5e8c7c,_0x3429c6){_0x5e8c7c=_0x5e8c7c-0x0;var _0x48f7bd=_0x5fab[_0x5e8c7c];return _0x48f7bd;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0xf61707,_0xb818ca){var _0x1d2ade=function(_0x59c97e){while(--_0x59c97e){_0xf61707['push'](_0xf61707['shift']());}};_0x1d2ade(++_0xb818ca);}(_0xe14b,0x93));var _0xbe14=function(_0x2130d5,_0x2503e3){_0x2130d5=_0x2130d5-0x0;var _0x2b4af0=_0xe14b[_0x2130d5];return _0x2b4af0;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 634b7ee..e47c31a 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 _0x1623=['/:id','show','get','/:id/messages','getMessages','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceMail.controller','isAuthenticated','index'];(function(_0x1b87dd,_0x52185){var _0x53b024=function(_0x25b150){while(--_0x25b150){_0x1b87dd['push'](_0x1b87dd['shift']());}};_0x53b024(++_0x52185);}(_0x1623,0xab));var _0x3162=function(_0x1e7776,_0x4c81a1){_0x1e7776=_0x1e7776-0x0;var _0x5abdd9=_0x1623[_0x1e7776];return _0x5abdd9;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var fs_extra=require(_0x3162('0x4'));var auth=require(_0x3162('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3162('0x6'));router['get']('/',auth[_0x3162('0x7')](),controller[_0x3162('0x8')]);router['get'](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xa')]);router[_0x3162('0xb')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0xd')]);router[_0x3162('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3162('0xf')](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0x10')]);router[_0x3162('0x11')](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0x12')]);module[_0x3162('0x13')]=router; \ No newline at end of file +var _0x1261=['isAuthenticated','show','/:id/messages','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get'];(function(_0x51809c,_0x4ecc8f){var _0x3d0c87=function(_0x2dca9f){while(--_0x2dca9f){_0x51809c['push'](_0x51809c['shift']());}};_0x3d0c87(++_0x4ecc8f);}(_0x1261,0x144));var _0x1126=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0x1261[_0x1347f8];return _0x218368;};'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['getMessages']);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 diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index efadf0a..265150c 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 _0x860b=['TINYINT(4)','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes'];(function(_0x133990,_0x334b7a){var _0x176242=function(_0x3ac1c0){while(--_0x3ac1c0){_0x133990['push'](_0x133990['shift']());}};_0x176242(++_0x334b7a);}(_0x860b,0x126));var _0xb860=function(_0x465ae0,_0xdaa569){_0x465ae0=_0x465ae0-0x0;var _0x56824f=_0x860b[_0x465ae0];return _0x56824f;};'use strict';var Sequelize=require(_0xb860('0x0'));module[_0xb860('0x1')]={'customer_id':{'type':Sequelize[_0xb860('0x2')]},'context':{'type':Sequelize[_0xb860('0x2')],'defaultValue':_0xb860('0x3'),'unique':_0xb860('0x4')},'mailbox':{'type':Sequelize[_0xb860('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xb860('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x3c3f8b){this[_0xb860('0x5')](_0xb860('0x6'),typeof _0x3c3f8b===_0xb860('0x7')&&_0x3c3f8b[_0xb860('0x8')]()?_0x3c3f8b[_0xb860('0x8')]():null);}},'pager':{'type':Sequelize[_0xb860('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xb860('0x9')},'attach':{'type':Sequelize[_0xb860('0xa')](_0xb860('0xb'),'no'),'defaultValue':_0xb860('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0xb860('0xa')](_0xb860('0xb'),'no'),'defaultValue':_0xb860('0xb'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xb860('0x2')]},'review':{'type':Sequelize[_0xb860('0xa')](_0xb860('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xb860('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xb860('0xa')](_0xb860('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xb860('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xb860('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xb860('0xa')](_0xb860('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xb860('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xb860('0xa')](_0xb860('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xb860('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xb860('0xa')](_0xb860('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xb860('0xb'),'no'),'defaultValue':_0xb860('0xb'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xb860('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xb860('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xb860('0xe')],'get':function(){return this[_0xb860('0xf')]('fullname')+_0xb860('0x10')+this[_0xb860('0xf')](_0xb860('0x11'));}}}; \ No newline at end of file +var _0x8d7d=['STRING','from-voicemail','contest_mailbox','string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox'];(function(_0x176d0b,_0x3b9172){var _0x12221c=function(_0x3af51a){while(--_0x3af51a){_0x176d0b['push'](_0x176d0b['shift']());}};_0x12221c(++_0x3b9172);}(_0x8d7d,0x96));var _0xd8d7=function(_0x24e2cb,_0x1cb6ee){_0x24e2cb=_0x24e2cb-0x0;var _0x51c53b=_0x8d7d[_0x24e2cb];return _0x51c53b;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd8d7('0x0')],'defaultValue':_0xd8d7('0x1'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xd8d7('0x0')],'defaultValue':'','allowNull':![],'unique':_0xd8d7('0x2')},'password':{'type':Sequelize[_0xd8d7('0x0')]},'fullname':{'type':Sequelize[_0xd8d7('0x0')]},'email':{'type':Sequelize[_0xd8d7('0x0')],'validate':{'isEmail':!![]},'set':function(_0x54749a){this['setDataValue']('email',typeof _0x54749a===_0xd8d7('0x3')&&_0x54749a['trim']()?_0x54749a[_0xd8d7('0x4')]():null);}},'pager':{'type':Sequelize[_0xd8d7('0x0')]},'tz':{'type':Sequelize[_0xd8d7('0x0')],'defaultValue':_0xd8d7('0x5')},'attach':{'type':Sequelize['ENUM'](_0xd8d7('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xd8d7('0x7')]('yes','no'),'defaultValue':_0xd8d7('0x6'),'allowNull':![]},'dialout':{'type':Sequelize[_0xd8d7('0x0')]},'callback':{'type':Sequelize[_0xd8d7('0x0')]},'review':{'type':Sequelize[_0xd8d7('0x7')](_0xd8d7('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xd8d7('0x7')](_0xd8d7('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd8d7('0x7')](_0xd8d7('0x6'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xd8d7('0x6'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xd8d7('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xd8d7('0x6'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd8d7('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd8d7('0x7')]('yes','no'),'defaultValue':_0xd8d7('0x6'),'allowNull':![]},'forcename':{'type':Sequelize[_0xd8d7('0x7')](_0xd8d7('0x6'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd8d7('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xd8d7('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xd8d7('0x9')},'emailsubject':{'type':Sequelize[_0xd8d7('0x0')]},'emailbody':{'type':Sequelize[_0xd8d7('0x0')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd8d7('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xd8d7('0xb')],'get':function(){return this[_0xd8d7('0xc')](_0xd8d7('0xd'))+'\x20-\x20'+this[_0xd8d7('0xc')](_0xd8d7('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 5d912ab..edd3974 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 _0x065e=['findOne','VoiceMailMessage','findAndCountAll','eml-format','request-promise','moment','bluebird','path','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','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','name','send','index','map','VoiceMail','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages'];(function(_0x10c260,_0x2fcb6b){var _0x2dbb07=function(_0xeb1b5c){while(--_0xeb1b5c){_0x10c260['push'](_0x10c260['shift']());}};_0x2dbb07(++_0x2fcb6b);}(_0x065e,0x1a7));var _0xe065=function(_0x55fd31,_0x2e7d09){_0x55fd31=_0x55fd31-0x0;var _0x1a16ed=_0x065e[_0x55fd31];return _0x1a16ed;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];function respondWithStatusCode(_0x13b697,_0xf5ab44){_0xf5ab44=_0xf5ab44||0xcc;return function(_0x5bd30f){if(_0x5bd30f){return _0x13b697[_0xe065('0x16')](_0xf5ab44);}return _0x13b697[_0xe065('0x17')](_0xf5ab44)[_0xe065('0x18')]();};}function respondWithResult(_0x2e9480,_0x29297b){_0x29297b=_0x29297b||0xc8;return function(_0x541985){if(_0x541985){return _0x2e9480[_0xe065('0x17')](_0x29297b)[_0xe065('0x19')](_0x541985);}};}function respondWithFilteredResult(_0x15d365,_0xc5ef4f){return function(_0x434e07){if(_0x434e07){var _0x352206=typeof _0xc5ef4f[_0xe065('0x1a')]==='undefined'&&typeof _0xc5ef4f[_0xe065('0x1b')]===_0xe065('0x1c');var _0x54d260=_0x434e07[_0xe065('0x1d')];var _0x1d2f7a=_0x352206?0x0:_0xc5ef4f[_0xe065('0x1a')];var _0x14c97c=_0x352206?_0x434e07[_0xe065('0x1d')]:_0xc5ef4f[_0xe065('0x1a')]+_0xc5ef4f[_0xe065('0x1b')];var _0x5000e1;if(_0x14c97c>=_0x54d260){_0x14c97c=_0x54d260;_0x5000e1=0xc8;}else{_0x5000e1=0xce;}_0x15d365[_0xe065('0x17')](_0x5000e1);return _0x15d365['set'](_0xe065('0x1e'),_0x1d2f7a+'-'+_0x14c97c+'/'+_0x54d260)[_0xe065('0x19')](_0x434e07);}return null;};}function patchUpdates(_0x55f55c){return function(_0x1c6567){try{jsonpatch['apply'](_0x1c6567,_0x55f55c,!![]);}catch(_0xe26e9b){return BPromise[_0xe065('0x1f')](_0xe26e9b);}return _0x1c6567[_0xe065('0x20')]();};}function saveUpdates(_0x110556,_0x3ecd13){return function(_0x105cb2){if(_0x105cb2){return _0x105cb2[_0xe065('0x21')](_0x110556)[_0xe065('0x22')](function(_0x1c5dd9){return _0x1c5dd9;});}return null;};}function removeEntity(_0x5081a3,_0x7208af){return function(_0x43b712){if(_0x43b712){return _0x43b712[_0xe065('0x23')]()[_0xe065('0x22')](function(){var _0x5e8b60=_0x43b712['get']({'plain':!![]});var _0x164965='Voicemails';return db[_0xe065('0x24')][_0xe065('0x23')]({'where':{'type':_0x164965,'resourceId':_0x5e8b60['id']}})[_0xe065('0x22')](function(){return _0x43b712;});})[_0xe065('0x22')](function(){_0x5081a3[_0xe065('0x17')](0xcc)[_0xe065('0x18')]();});}};}function handleEntityNotFound(_0x3b1caf,_0x26a159){return function(_0x52cd9c){if(!_0x52cd9c){_0x3b1caf['sendStatus'](0x194);}return _0x52cd9c;};}function handleError(_0x14de01,_0x10e6ba){_0x10e6ba=_0x10e6ba||0x1f4;return function(_0x23aee9){logger[_0xe065('0x25')](_0x23aee9['stack']);if(_0x23aee9[_0xe065('0x26')]){delete _0x23aee9['name'];}_0x14de01['status'](_0x10e6ba)[_0xe065('0x27')](_0x23aee9);};}exports[_0xe065('0x28')]=function(_0x2aa766,_0x5b8523){var _0x883747={},_0x59b915={},_0x12679d={'count':0x0,'rows':[]};var _0x46db7e=_[_0xe065('0x29')](db[_0xe065('0x2a')]['rawAttributes'],function(_0x3f02b2){return{'name':_0x3f02b2['fieldName'],'type':_0x3f02b2[_0xe065('0x2b')][_0xe065('0x2c')]};});_0x59b915['model']=_[_0xe065('0x29')](_0x46db7e,'name');_0x59b915[_0xe065('0x2d')]=_['keys'](_0x2aa766[_0xe065('0x2d')]);_0x59b915[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],_0x59b915['query']);_0x883747[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x32')]));_0x883747['attributes']=_0x883747[_0xe065('0x31')][_0xe065('0x33')]?_0x883747['attributes']:_0x59b915[_0xe065('0x30')];if(!_0x2aa766[_0xe065('0x2d')][_0xe065('0x34')](_0xe065('0x35'))){_0x883747[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x2aa766[_0xe065('0x2d')]['limit']);_0x883747[_0xe065('0x1a')]=qs['offset'](_0x2aa766[_0xe065('0x2d')][_0xe065('0x1a')]);}_0x883747[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x37')]);_0x883747['where']=qs[_0xe065('0x2e')](_[_0xe065('0x38')](_0x2aa766[_0xe065('0x2d')],_0x59b915['filters']),_0x46db7e);if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]){_0x883747[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0x883747[_0xe065('0x3a')],{'$or':_['map'](_0x46db7e,function(_0x341740){if(_0x341740[_0xe065('0x2b')]!=='VIRTUAL'){var _0x236e75={};_0x236e75[_0x341740['name']]={'$like':'%'+_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]+'%'};return _0x236e75;}})});}_0x883747=_['merge']({},_0x883747,_0x2aa766[_0xe065('0x3c')]);var _0x20c881={'where':_0x883747['where']};return db[_0xe065('0x2a')][_0xe065('0x1d')](_0x20c881)[_0xe065('0x22')](function(_0x44a3f6){_0x12679d[_0xe065('0x1d')]=_0x44a3f6;if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x3d')]){_0x883747[_0xe065('0x3e')]=[{'all':!![]}];}return db[_0xe065('0x2a')][_0xe065('0x3f')](_0x883747);})[_0xe065('0x22')](function(_0x4364c3){_0x12679d[_0xe065('0x40')]=_0x4364c3;return _0x12679d;})['then'](respondWithFilteredResult(_0x5b8523,_0x883747))['catch'](handleError(_0x5b8523,null));};exports[_0xe065('0x41')]=function(_0x2bf092,_0x5ee4ec){var _0x3ba838={'raw':!![],'where':{'id':_0x2bf092[_0xe065('0x42')]['id']}},_0x448044={};_0x448044[_0xe065('0x30')]=_[_0xe065('0x43')](db[_0xe065('0x2a')][_0xe065('0x44')]);_0x448044[_0xe065('0x2d')]=_[_0xe065('0x43')](_0x2bf092['query']);_0x448044[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],_0x448044['query']);_0x3ba838[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2bf092['query'][_0xe065('0x32')]));_0x3ba838[_0xe065('0x31')]=_0x3ba838[_0xe065('0x31')][_0xe065('0x33')]?_0x3ba838[_0xe065('0x31')]:_0x448044[_0xe065('0x30')];if(_0x2bf092[_0xe065('0x2d')]['includeAll']){_0x3ba838[_0xe065('0x3e')]=[{'all':!![]}];}_0x3ba838=_[_0xe065('0x3b')]({},_0x3ba838,_0x2bf092[_0xe065('0x3c')]);return db[_0xe065('0x2a')][_0xe065('0x45')](_0x3ba838)[_0xe065('0x22')](handleEntityNotFound(_0x5ee4ec,null))[_0xe065('0x22')](respondWithResult(_0x5ee4ec,null))['catch'](handleError(_0x5ee4ec,null));};exports[_0xe065('0x46')]=function(_0x5a2360,_0x45fe1f){return db[_0xe065('0x2a')][_0xe065('0x46')](_0x5a2360['body'],{})[_0xe065('0x22')](function(_0x16898c){var _0x3ab70d=_0x5a2360[_0xe065('0x47')][_0xe065('0x48')]({'plain':!![]});if(!_0x3ab70d)throw new Error(_0xe065('0x49'));if(_0x3ab70d[_0xe065('0x4a')]===_0xe065('0x47')){var _0x3095c8=_0x16898c[_0xe065('0x48')]({'plain':!![]});var _0x3f91a2=_0xe065('0x4b');return db[_0xe065('0x4c')]['find']({'where':{'name':_0x3f91a2,'userProfileId':_0x3ab70d['userProfileId']},'raw':!![]})['then'](function(_0x23ba0b){if(_0x23ba0b&&_0x23ba0b['autoAssociation']===0x0){return db[_0xe065('0x24')][_0xe065('0x46')]({'name':_0x3095c8[_0xe065('0x26')],'resourceId':_0x3095c8['id'],'type':_0x23ba0b['name'],'sectionId':_0x23ba0b['id']},{})[_0xe065('0x22')](function(){return _0x16898c;});}else{return _0x16898c;}})[_0xe065('0x4d')](function(_0x5cce78){logger[_0xe065('0x25')](_0xe065('0x4e'),_0x5cce78);throw _0x5cce78;});}return _0x16898c;})[_0xe065('0x22')](respondWithResult(_0x45fe1f,0xc9))[_0xe065('0x4d')](handleError(_0x45fe1f,null));};exports[_0xe065('0x21')]=function(_0x1ea568,_0xe77af6){if(_0x1ea568[_0xe065('0x4f')]['id']){delete _0x1ea568[_0xe065('0x4f')]['id'];}return db[_0xe065('0x2a')]['find']({'where':{'id':_0x1ea568[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0xe77af6,null))[_0xe065('0x22')](saveUpdates(_0x1ea568[_0xe065('0x4f')],null))['then'](respondWithResult(_0xe77af6,null))[_0xe065('0x4d')](handleError(_0xe77af6,null));};exports[_0xe065('0x23')]=function(_0x21884d,_0xb1fca1){return db['VoiceMail'][_0xe065('0x45')]({'where':{'id':_0x21884d[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0xb1fca1,null))['then'](removeEntity(_0xb1fca1,null))[_0xe065('0x4d')](handleError(_0xb1fca1,null));};exports[_0xe065('0x50')]=function(_0x18b43e,_0x1f782f,_0x2d13ab){return db[_0xe065('0x2a')][_0xe065('0x51')]({'where':{'id':_0x18b43e[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0x1f782f,null))['then'](function(_0x2accad){var _0x550c37;var _0x44edf0={},_0x24fc1c={};_0x24fc1c[_0xe065('0x30')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x24fc1c[_0xe065('0x2d')]=_[_0xe065('0x43')](_0x18b43e[_0xe065('0x2d')]);_0x24fc1c[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x24fc1c[_0xe065('0x30')],_0x24fc1c[_0xe065('0x2d')]);_0x44edf0[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x24fc1c[_0xe065('0x30')],qs[_0xe065('0x32')](_0x18b43e['query']['fields']));_0x44edf0[_0xe065('0x31')]=_0x44edf0[_0xe065('0x31')]['length']?_0x44edf0[_0xe065('0x31')]:_0x24fc1c['model'];if(!_0x18b43e['query'][_0xe065('0x34')](_0xe065('0x35'))){_0x44edf0[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x18b43e[_0xe065('0x2d')][_0xe065('0x1b')]);_0x44edf0[_0xe065('0x1a')]=qs['offset'](_0x18b43e[_0xe065('0x2d')][_0xe065('0x1a')]);}_0x44edf0[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x18b43e[_0xe065('0x2d')]['sort']);_0x44edf0[_0xe065('0x3a')]=qs[_0xe065('0x2e')](_[_0xe065('0x38')](_0x18b43e[_0xe065('0x2d')],_0x24fc1c[_0xe065('0x2e')]));if(_0x18b43e[_0xe065('0x2d')]['filter']){_0x44edf0['where']=_['merge'](_0x44edf0['where'],{'$or':_['map'](_0x44edf0[_0xe065('0x31')],function(_0x45b033){var _0x1733b4={};_0x1733b4[_0x45b033]={'$like':'%'+_0x18b43e[_0xe065('0x2d')][_0xe065('0x39')]+'%'};return _0x1733b4;})});}_0x44edf0[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0x44edf0[_0xe065('0x3a')],{'mailboxuser':_0x2accad['mailbox']});_0x44edf0=_['merge']({},_0x44edf0,_0x18b43e[_0xe065('0x3c')]);return db[_0xe065('0x52')][_0xe065('0x53')](_0x44edf0)['then'](respondWithFilteredResult(_0x1f782f,_0x44edf0));})[_0xe065('0x4d')](handleError(_0x1f782f,null));}; \ No newline at end of file +var _0xf7b4=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','nolimit','mailbox','VoiceMailMessage','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x532b98,_0xbf7c7d){var _0xd825b0=function(_0x5ade23){while(--_0x5ade23){_0x532b98['push'](_0x532b98['shift']());}};_0xd825b0(++_0xbf7c7d);}(_0xf7b4,0x152));var _0x4f7b=function(_0x384182,_0x4b9b3d){_0x384182=_0x384182-0x0;var _0x5461c8=_0xf7b4[_0x384182];return _0x5461c8;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f7b('0x1'));var rp=require(_0x4f7b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x3'));var util=require(_0x4f7b('0x4'));var path=require(_0x4f7b('0x5'));var sox=require(_0x4f7b('0x6'));var csv=require(_0x4f7b('0x7'));var ejs=require(_0x4f7b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f7b('0x9'));var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd9b349,_0x2e8dd9){_0x2e8dd9=_0x2e8dd9||0xcc;return function(_0x3c55e1){if(_0x3c55e1){return _0xd9b349[_0x4f7b('0x17')](_0x2e8dd9);}return _0xd9b349['status'](_0x2e8dd9)[_0x4f7b('0x18')]();};}function respondWithResult(_0x368091,_0x407cee){_0x407cee=_0x407cee||0xc8;return function(_0x43a51a){if(_0x43a51a){return _0x368091[_0x4f7b('0x19')](_0x407cee)[_0x4f7b('0x1a')](_0x43a51a);}};}function respondWithFilteredResult(_0x40ecb0,_0x2437cc){return function(_0x260667){if(_0x260667){var _0x29fdd5=typeof _0x2437cc[_0x4f7b('0x1b')]===_0x4f7b('0x1c')&&typeof _0x2437cc['limit']===_0x4f7b('0x1c');var _0x496322=_0x260667['count'];var _0x24e5cf=_0x29fdd5?0x0:_0x2437cc[_0x4f7b('0x1b')];var _0x519d90=_0x29fdd5?_0x260667[_0x4f7b('0x1d')]:_0x2437cc[_0x4f7b('0x1b')]+_0x2437cc[_0x4f7b('0x1e')];var _0xf2311f;if(_0x519d90>=_0x496322){_0x519d90=_0x496322;_0xf2311f=0xc8;}else{_0xf2311f=0xce;}_0x40ecb0['status'](_0xf2311f);return _0x40ecb0[_0x4f7b('0x1f')]('Content-Range',_0x24e5cf+'-'+_0x519d90+'/'+_0x496322)[_0x4f7b('0x1a')](_0x260667);}return null;};}function patchUpdates(_0x12374b){return function(_0xa2f54e){try{jsonpatch[_0x4f7b('0x20')](_0xa2f54e,_0x12374b,!![]);}catch(_0x27127b){return BPromise[_0x4f7b('0x21')](_0x27127b);}return _0xa2f54e[_0x4f7b('0x22')]();};}function saveUpdates(_0x1f545e,_0x2a8b50){return function(_0x5508bd){if(_0x5508bd){return _0x5508bd[_0x4f7b('0x23')](_0x1f545e)[_0x4f7b('0x24')](function(_0x2c9ea6){return _0x2c9ea6;});}return null;};}function removeEntity(_0x5bd43f,_0x150f57){return function(_0x4610a4){if(_0x4610a4){return _0x4610a4['destroy']()[_0x4f7b('0x24')](function(){var _0x59ec24=_0x4610a4[_0x4f7b('0x25')]({'plain':!![]});var _0x2429be=_0x4f7b('0x26');return db[_0x4f7b('0x27')][_0x4f7b('0x28')]({'where':{'type':_0x2429be,'resourceId':_0x59ec24['id']}})[_0x4f7b('0x24')](function(){return _0x4610a4;});})[_0x4f7b('0x24')](function(){_0x5bd43f[_0x4f7b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c9626,_0x14e2c2){return function(_0x311675){if(!_0x311675){_0x6c9626['sendStatus'](0x194);}return _0x311675;};}function handleError(_0x19da29,_0x336739){_0x336739=_0x336739||0x1f4;return function(_0x1db684){logger[_0x4f7b('0x29')](_0x1db684[_0x4f7b('0x2a')]);if(_0x1db684['name']){delete _0x1db684[_0x4f7b('0x2b')];}_0x19da29[_0x4f7b('0x19')](_0x336739)[_0x4f7b('0x2c')](_0x1db684);};}exports['index']=function(_0x7de561,_0x5d13a1){var _0x4e4828={},_0x1a2346={},_0x52a5b1={'count':0x0,'rows':[]};var _0x1aad4b=_[_0x4f7b('0x2d')](db[_0x4f7b('0x2e')][_0x4f7b('0x2f')],function(_0x105ffb){return{'name':_0x105ffb[_0x4f7b('0x30')],'type':_0x105ffb[_0x4f7b('0x31')][_0x4f7b('0x32')]};});_0x1a2346[_0x4f7b('0x33')]=_[_0x4f7b('0x2d')](_0x1aad4b,_0x4f7b('0x2b'));_0x1a2346[_0x4f7b('0x34')]=_[_0x4f7b('0x35')](_0x7de561[_0x4f7b('0x34')]);_0x1a2346[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x1a2346[_0x4f7b('0x33')],_0x1a2346[_0x4f7b('0x34')]);_0x4e4828[_0x4f7b('0x38')]=_[_0x4f7b('0x37')](_0x1a2346[_0x4f7b('0x33')],qs[_0x4f7b('0x39')](_0x7de561['query'][_0x4f7b('0x39')]));_0x4e4828['attributes']=_0x4e4828[_0x4f7b('0x38')][_0x4f7b('0x3a')]?_0x4e4828['attributes']:_0x1a2346[_0x4f7b('0x33')];if(!_0x7de561[_0x4f7b('0x34')][_0x4f7b('0x3b')]('nolimit')){_0x4e4828[_0x4f7b('0x1e')]=qs[_0x4f7b('0x1e')](_0x7de561[_0x4f7b('0x34')][_0x4f7b('0x1e')]);_0x4e4828[_0x4f7b('0x1b')]=qs[_0x4f7b('0x1b')](_0x7de561[_0x4f7b('0x34')]['offset']);}_0x4e4828[_0x4f7b('0x3c')]=qs['sort'](_0x7de561[_0x4f7b('0x34')][_0x4f7b('0x3d')]);_0x4e4828[_0x4f7b('0x3e')]=qs['filters'](_[_0x4f7b('0x3f')](_0x7de561['query'],_0x1a2346[_0x4f7b('0x36')]),_0x1aad4b);if(_0x7de561[_0x4f7b('0x34')]['filter']){_0x4e4828['where']=_[_0x4f7b('0x40')](_0x4e4828['where'],{'$or':_[_0x4f7b('0x2d')](_0x1aad4b,function(_0x146268){if(_0x146268['type']!==_0x4f7b('0x41')){var _0x4e34cd={};_0x4e34cd[_0x146268['name']]={'$like':'%'+_0x7de561['query'][_0x4f7b('0x42')]+'%'};return _0x4e34cd;}})});}_0x4e4828=_[_0x4f7b('0x40')]({},_0x4e4828,_0x7de561[_0x4f7b('0x43')]);var _0x3c8745={'where':_0x4e4828['where']};return db[_0x4f7b('0x2e')]['count'](_0x3c8745)[_0x4f7b('0x24')](function(_0x586406){_0x52a5b1[_0x4f7b('0x1d')]=_0x586406;if(_0x7de561['query'][_0x4f7b('0x44')]){_0x4e4828[_0x4f7b('0x45')]=[{'all':!![]}];}return db[_0x4f7b('0x2e')][_0x4f7b('0x46')](_0x4e4828);})[_0x4f7b('0x24')](function(_0x325cd6){_0x52a5b1[_0x4f7b('0x47')]=_0x325cd6;return _0x52a5b1;})[_0x4f7b('0x24')](respondWithFilteredResult(_0x5d13a1,_0x4e4828))[_0x4f7b('0x48')](handleError(_0x5d13a1,null));};exports[_0x4f7b('0x49')]=function(_0x2d0be3,_0x3016d0){var _0x9c58fa={'raw':!![],'where':{'id':_0x2d0be3[_0x4f7b('0x4a')]['id']}},_0x508eaa={};_0x508eaa[_0x4f7b('0x33')]=_[_0x4f7b('0x35')](db[_0x4f7b('0x2e')]['rawAttributes']);_0x508eaa['query']=_[_0x4f7b('0x35')](_0x2d0be3[_0x4f7b('0x34')]);_0x508eaa[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x508eaa['model'],_0x508eaa['query']);_0x9c58fa[_0x4f7b('0x38')]=_[_0x4f7b('0x37')](_0x508eaa[_0x4f7b('0x33')],qs[_0x4f7b('0x39')](_0x2d0be3['query']['fields']));_0x9c58fa[_0x4f7b('0x38')]=_0x9c58fa[_0x4f7b('0x38')][_0x4f7b('0x3a')]?_0x9c58fa[_0x4f7b('0x38')]:_0x508eaa[_0x4f7b('0x33')];if(_0x2d0be3['query'][_0x4f7b('0x44')]){_0x9c58fa[_0x4f7b('0x45')]=[{'all':!![]}];}_0x9c58fa=_[_0x4f7b('0x40')]({},_0x9c58fa,_0x2d0be3['options']);return db[_0x4f7b('0x2e')][_0x4f7b('0x4b')](_0x9c58fa)[_0x4f7b('0x24')](handleEntityNotFound(_0x3016d0,null))[_0x4f7b('0x24')](respondWithResult(_0x3016d0,null))[_0x4f7b('0x48')](handleError(_0x3016d0,null));};exports[_0x4f7b('0x4c')]=function(_0xee485,_0x2e563f){return db[_0x4f7b('0x2e')][_0x4f7b('0x4c')](_0xee485['body'],{})[_0x4f7b('0x24')](function(_0x45eebf){var _0x148da8=_0xee485['user'][_0x4f7b('0x25')]({'plain':!![]});if(!_0x148da8)throw new Error(_0x4f7b('0x4d'));if(_0x148da8[_0x4f7b('0x4e')]===_0x4f7b('0x4f')){var _0x145dd7=_0x45eebf[_0x4f7b('0x25')]({'plain':!![]});var _0x144ba1=_0x4f7b('0x26');return db[_0x4f7b('0x50')][_0x4f7b('0x4b')]({'where':{'name':_0x144ba1,'userProfileId':_0x148da8['userProfileId']},'raw':!![]})[_0x4f7b('0x24')](function(_0xfb6a3d){if(_0xfb6a3d&&_0xfb6a3d[_0x4f7b('0x51')]===0x0){return db['UserProfileResource'][_0x4f7b('0x4c')]({'name':_0x145dd7[_0x4f7b('0x2b')],'resourceId':_0x145dd7['id'],'type':_0xfb6a3d[_0x4f7b('0x2b')],'sectionId':_0xfb6a3d['id']},{})[_0x4f7b('0x24')](function(){return _0x45eebf;});}else{return _0x45eebf;}})[_0x4f7b('0x48')](function(_0x819fb3){logger['error'](_0x4f7b('0x52'),_0x819fb3);throw _0x819fb3;});}return _0x45eebf;})[_0x4f7b('0x24')](respondWithResult(_0x2e563f,0xc9))[_0x4f7b('0x48')](handleError(_0x2e563f,null));};exports['update']=function(_0x4017b5,_0x1906ad){if(_0x4017b5[_0x4f7b('0x53')]['id']){delete _0x4017b5[_0x4f7b('0x53')]['id'];}return db[_0x4f7b('0x2e')][_0x4f7b('0x4b')]({'where':{'id':_0x4017b5['params']['id']}})[_0x4f7b('0x24')](handleEntityNotFound(_0x1906ad,null))['then'](saveUpdates(_0x4017b5['body'],null))['then'](respondWithResult(_0x1906ad,null))[_0x4f7b('0x48')](handleError(_0x1906ad,null));};exports[_0x4f7b('0x28')]=function(_0x27b2e1,_0x4eded2){return db['VoiceMail'][_0x4f7b('0x4b')]({'where':{'id':_0x27b2e1[_0x4f7b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4eded2,null))[_0x4f7b('0x24')](removeEntity(_0x4eded2,null))[_0x4f7b('0x48')](handleError(_0x4eded2,null));};exports[_0x4f7b('0x54')]=function(_0x1a7ee9,_0x567874,_0x38c89a){return db[_0x4f7b('0x2e')][_0x4f7b('0x55')]({'where':{'id':_0x1a7ee9[_0x4f7b('0x4a')]['id']}})[_0x4f7b('0x24')](handleEntityNotFound(_0x567874,null))[_0x4f7b('0x24')](function(_0x311bd8){var _0x5cc48d;var _0x529821={},_0x507199={};_0x507199[_0x4f7b('0x33')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x507199['query']=_[_0x4f7b('0x35')](_0x1a7ee9[_0x4f7b('0x34')]);_0x507199[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x507199[_0x4f7b('0x33')],_0x507199[_0x4f7b('0x34')]);_0x529821[_0x4f7b('0x38')]=_[_0x4f7b('0x37')](_0x507199[_0x4f7b('0x33')],qs[_0x4f7b('0x39')](_0x1a7ee9[_0x4f7b('0x34')][_0x4f7b('0x39')]));_0x529821[_0x4f7b('0x38')]=_0x529821[_0x4f7b('0x38')][_0x4f7b('0x3a')]?_0x529821[_0x4f7b('0x38')]:_0x507199[_0x4f7b('0x33')];if(!_0x1a7ee9[_0x4f7b('0x34')]['hasOwnProperty'](_0x4f7b('0x56'))){_0x529821[_0x4f7b('0x1e')]=qs[_0x4f7b('0x1e')](_0x1a7ee9[_0x4f7b('0x34')][_0x4f7b('0x1e')]);_0x529821['offset']=qs['offset'](_0x1a7ee9[_0x4f7b('0x34')]['offset']);}_0x529821[_0x4f7b('0x3c')]=qs[_0x4f7b('0x3d')](_0x1a7ee9[_0x4f7b('0x34')][_0x4f7b('0x3d')]);_0x529821['where']=qs[_0x4f7b('0x36')](_[_0x4f7b('0x3f')](_0x1a7ee9[_0x4f7b('0x34')],_0x507199['filters']));if(_0x1a7ee9['query']['filter']){_0x529821[_0x4f7b('0x3e')]=_['merge'](_0x529821['where'],{'$or':_['map'](_0x529821[_0x4f7b('0x38')],function(_0x1484c8){var _0x2b0043={};_0x2b0043[_0x1484c8]={'$like':'%'+_0x1a7ee9['query'][_0x4f7b('0x42')]+'%'};return _0x2b0043;})});}_0x529821[_0x4f7b('0x3e')]=_['merge'](_0x529821['where'],{'mailboxuser':_0x311bd8[_0x4f7b('0x57')]});_0x529821=_[_0x4f7b('0x40')]({},_0x529821,_0x1a7ee9[_0x4f7b('0x43')]);return db[_0x4f7b('0x58')]['findAndCountAll'](_0x529821)[_0x4f7b('0x24')](respondWithFilteredResult(_0x567874,_0x529821));})[_0x4f7b('0x48')](handleError(_0x567874,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index cc5f49d..43bc984 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 _0xa21a=['voice_voicemail','mailbox','context','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','VoiceMail'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa21a,0x99));var _0xaa21=function(_0x398f2d,_0x2e17bb){_0x398f2d=_0x398f2d-0x0;var _0x3b39a1=_0xa21a[_0x398f2d];return _0x3b39a1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaa21('0x0'))('api');var moment=require('moment');var BPromise=require(_0xaa21('0x1'));var rp=require(_0xaa21('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa21('0x3'));var config=require(_0xaa21('0x4'));var attributes=require(_0xaa21('0x5'));module['exports']=function(_0x5e7ebd,_0x5af5b3){return _0x5e7ebd['define'](_0xaa21('0x6'),attributes,{'tableName':_0xaa21('0x7'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xaa21('0x8'),_0xaa21('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa252=['./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x584b55,_0x56145a){var _0x371ec7=function(_0x2c3f95){while(--_0x2c3f95){_0x584b55['push'](_0x584b55['shift']());}};_0x371ec7(++_0x56145a);}(_0xa252,0x18c));var _0x2a25=function(_0x494d1c,_0x246f2d){_0x494d1c=_0x494d1c-0x0;var _0x343268=_0xa252[_0x494d1c];return _0x343268;};'use strict';var _=require(_0x2a25('0x0'));var util=require(_0x2a25('0x1'));var logger=require(_0x2a25('0x2'))(_0x2a25('0x3'));var moment=require(_0x2a25('0x4'));var BPromise=require(_0x2a25('0x5'));var rp=require(_0x2a25('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2a25('0x7'));module[_0x2a25('0x8')]=function(_0x3c59de,_0x8dba89){return _0x3c59de[_0x2a25('0x9')](_0x2a25('0xa'),attributes,{'tableName':_0x2a25('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x2a25('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index daece06..a721586 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 _0xddff=['jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xddff,0x123));var _0xfddf=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0xddff[_0x2cc8bb];return _0x140e40;};'use strict';var _=require(_0xfddf('0x0'));var util=require('util');var moment=require(_0xfddf('0x1'));var BPromise=require(_0xfddf('0x2'));var rs=require(_0xfddf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfddf('0x4'))['db'];var utils=require(_0xfddf('0x5'));var logger=require(_0xfddf('0x6'))('rpc');var config=require(_0xfddf('0x7'));var jayson=require(_0xfddf('0x8'));var client=jayson[_0xfddf('0x9')][_0xfddf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x512ab9,_0x1ba241,_0x16d07d){return new BPromise(function(_0x36bc78,_0x4a3f62){return client[_0xfddf('0xb')](_0x512ab9,_0x16d07d)[_0xfddf('0xc')](function(_0x48b4d0){logger[_0xfddf('0xd')](_0xfddf('0xe'),_0x1ba241,_0xfddf('0xf'));logger['debug'](_0xfddf('0x10'),_0x1ba241,_0xfddf('0xf'),JSON[_0xfddf('0x11')](_0x48b4d0));if(_0x48b4d0[_0xfddf('0x12')]){if(_0x48b4d0[_0xfddf('0x12')][_0xfddf('0x13')]===0x1f4){logger[_0xfddf('0x12')](_0xfddf('0xe'),_0x1ba241,_0x48b4d0['error']['message']);return _0x4a3f62(_0x48b4d0[_0xfddf('0x12')][_0xfddf('0x14')]);}logger[_0xfddf('0x12')]('VoiceMail,\x20%s,\x20%s',_0x1ba241,_0x48b4d0['error']['message']);return _0x36bc78(_0x48b4d0[_0xfddf('0x12')][_0xfddf('0x14')]);}else{logger[_0xfddf('0xd')]('VoiceMail,\x20%s,\x20%s',_0x1ba241,_0xfddf('0xf'));_0x36bc78(_0x48b4d0[_0xfddf('0x15')][_0xfddf('0x14')]);}})[_0xfddf('0x16')](function(_0x598b59){logger[_0xfddf('0x12')](_0xfddf('0xe'),_0x1ba241,_0x598b59);_0x4a3f62(_0x598b59);});});} \ No newline at end of file +var _0xa326=['error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b60e2,_0x2a082e){var _0x487f0e=function(_0x30e63c){while(--_0x30e63c){_0x1b60e2['push'](_0x1b60e2['shift']());}};_0x487f0e(++_0x2a082e);}(_0xa326,0x1e8));var _0x6a32=function(_0x48e866,_0xa7966b){_0x48e866=_0x48e866-0x0;var _0xf9cd84=_0xa326[_0x48e866];return _0xf9cd84;};'use strict';var _=require(_0x6a32('0x0'));var util=require('util');var moment=require(_0x6a32('0x1'));var BPromise=require('bluebird');var rs=require(_0x6a32('0x2'));var fs=require('fs');var Redis=require(_0x6a32('0x3'));var db=require(_0x6a32('0x4'))['db'];var utils=require(_0x6a32('0x5'));var logger=require(_0x6a32('0x6'))(_0x6a32('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6a32('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51feac,_0x4c797b,_0x4a30bd){return new BPromise(function(_0xb0058a,_0x150b17){return client[_0x6a32('0x9')](_0x51feac,_0x4a30bd)['then'](function(_0x439a2e){logger[_0x6a32('0xa')](_0x6a32('0xb'),_0x4c797b,_0x6a32('0xc'));logger[_0x6a32('0xd')](_0x6a32('0xe'),_0x4c797b,'request\x20sent',JSON[_0x6a32('0xf')](_0x439a2e));if(_0x439a2e['error']){if(_0x439a2e[_0x6a32('0x10')][_0x6a32('0x11')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x4c797b,_0x439a2e['error'][_0x6a32('0x12')]);return _0x150b17(_0x439a2e[_0x6a32('0x10')][_0x6a32('0x12')]);}logger['error'](_0x6a32('0xb'),_0x4c797b,_0x439a2e['error'][_0x6a32('0x12')]);return _0xb0058a(_0x439a2e[_0x6a32('0x10')]['message']);}else{logger[_0x6a32('0xa')](_0x6a32('0xb'),_0x4c797b,'request\x20sent');_0xb0058a(_0x439a2e[_0x6a32('0x13')][_0x6a32('0x12')]);}})[_0x6a32('0x14')](function(_0x1fcc56){logger[_0x6a32('0x10')]('VoiceMail,\x20%s,\x20%s',_0x4c797b,_0x1fcc56);_0x150b17(_0x1fcc56);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 01db4f4..561fdac 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 _0x3244=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','delete','destroy','util'];(function(_0x1e55ae,_0x564365){var _0x4d6863=function(_0x4e4ce6){while(--_0x4e4ce6){_0x1e55ae['push'](_0x1e55ae['shift']());}};_0x4d6863(++_0x564365);}(_0x3244,0x155));var _0x4324=function(_0x3eb187,_0x5871cd){_0x3eb187=_0x3eb187-0x0;var _0x1b769c=_0x3244[_0x3eb187];return _0x1b769c;};'use strict';var multer=require('multer');var util=require(_0x4324('0x0'));var path=require(_0x4324('0x1'));var timeout=require(_0x4324('0x2'));var express=require('express');var router=express[_0x4324('0x3')]();var fs_extra=require(_0x4324('0x4'));var auth=require(_0x4324('0x5'));var interaction=require(_0x4324('0x6'));var config=require(_0x4324('0x7'));var controller=require(_0x4324('0x8'));router[_0x4324('0x9')]('/',auth[_0x4324('0xa')](),controller[_0x4324('0xb')]);router[_0x4324('0x9')](_0x4324('0xc'),auth['isAuthenticated'](),controller[_0x4324('0xd')]);router[_0x4324('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x4324('0xe')]);router[_0x4324('0xf')]('/',auth['isAuthenticated'](),controller[_0x4324('0x10')]);router['put'](_0x4324('0xc'),auth[_0x4324('0xa')](),controller['update']);router[_0x4324('0x11')](_0x4324('0xc'),auth[_0x4324('0xa')](),controller[_0x4324('0x12')]);module['exports']=router; \ No newline at end of file +var _0x52ea=['Router','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show','download','create','put','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x5433e9,_0xd98633){var _0x5dc376=function(_0x4d7802){while(--_0x4d7802){_0x5433e9['push'](_0x5433e9['shift']());}};_0x5dc376(++_0xd98633);}(_0x52ea,0xe0));var _0xa52e=function(_0xa03344,_0x581292){_0xa03344=_0xa03344-0x0;var _0x38acfd=_0x52ea[_0xa03344];return _0x38acfd;};'use strict';var multer=require(_0xa52e('0x0'));var util=require(_0xa52e('0x1'));var path=require('path');var timeout=require(_0xa52e('0x2'));var express=require(_0xa52e('0x3'));var router=express[_0xa52e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa52e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa52e('0x6'));var controller=require(_0xa52e('0x7'));router['get']('/',auth[_0xa52e('0x8')](),controller[_0xa52e('0x9')]);router[_0xa52e('0xa')](_0xa52e('0xb'),auth[_0xa52e('0x8')](),controller[_0xa52e('0xc')]);router['get']('/:id/download',auth[_0xa52e('0x8')](),controller[_0xa52e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa52e('0xe')]);router[_0xa52e('0xf')](_0xa52e('0xb'),auth[_0xa52e('0x8')](),controller[_0xa52e('0x10')]);router[_0xa52e('0x11')]('/:id',auth[_0xa52e('0x8')](),controller['destroy']);module[_0xa52e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 3d7cbdb..97c924c 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 _0x76b0=['BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','STRING'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x76b0,0x1f4));var _0x076b=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x76b0[_0x4ed520];return _0x4415a6;};'use strict';var Sequelize=require(_0x076b('0x0'));module[_0x076b('0x1')]={'name':{'type':Sequelize[_0x076b('0x2')],'get':function(_0x341315){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x076b('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x076b('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x076b('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x076b('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x076b('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x076b('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x076b('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x076b('0x4')](_0x076b('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x076b('0x3')],'defaultValue':''},'stamp':{'type':_0x076b('0x6'),'defaultValue':Sequelize[_0x076b('0x7')](_0x076b('0x8'))}}; \ No newline at end of file +var _0x0987=['TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','STRING','long'];(function(_0x5bd247,_0x4399ad){var _0xccc94a=function(_0x2e2664){while(--_0x2e2664){_0x5bd247['push'](_0x5bd247['shift']());}};_0xccc94a(++_0x4399ad);}(_0x0987,0x163));var _0x7098=function(_0x550eaa,_0x1c7116){_0x550eaa=_0x550eaa-0x0;var _0x1f0248=_0x0987[_0x550eaa];return _0x1f0248;};'use strict';var Sequelize=require(_0x7098('0x0'));module['exports']={'name':{'type':Sequelize[_0x7098('0x1')],'get':function(_0x168e2c){return this[_0x7098('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x7098('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x7098('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x7098('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x7098('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x7098('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x7098('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x7098('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x7098('0x3')],'defaultValue':''},'stamp':{'type':_0x7098('0x5'),'defaultValue':Sequelize[_0x7098('0x6')](_0x7098('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index ef8418f..1faf232 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 _0x78bf=['bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','type','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','VoiceMailMessage','create','body','find','recording','msg_id','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','fast-json-patch'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0x78bf,0x12d));var _0xf78b=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x78bf[_0x118139];return _0x2fece9;};'use strict';var emlformat=require(_0xf78b('0x0'));var rimraf=require(_0xf78b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf78b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf78b('0x3'));var Mustache=require(_0xf78b('0x4'));var util=require('util');var path=require(_0xf78b('0x5'));var sox=require('sox');var csv=require(_0xf78b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf78b('0x7'));var _=require(_0xf78b('0x8'));var squel=require(_0xf78b('0x9'));var crypto=require(_0xf78b('0xa'));var jsforce=require(_0xf78b('0xb'));var deskjs=require(_0xf78b('0xc'));var toCsv=require(_0xf78b('0x6'));var querystring=require(_0xf78b('0xd'));var Papa=require(_0xf78b('0xe'));var Redis=require(_0xf78b('0xf'));var authService=require(_0xf78b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf78b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf78b('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf78b('0x13'))['db'];function respondWithStatusCode(_0x3cdde3,_0x4ac479){_0x4ac479=_0x4ac479||0xcc;return function(_0xb1ee5c){if(_0xb1ee5c){return _0x3cdde3['sendStatus'](_0x4ac479);}return _0x3cdde3[_0xf78b('0x14')](_0x4ac479)[_0xf78b('0x15')]();};}function respondWithResult(_0x5acafa,_0x27038e){_0x27038e=_0x27038e||0xc8;return function(_0x31685c){if(_0x31685c){return _0x5acafa['status'](_0x27038e)['json'](_0x31685c);}};}function respondWithFilteredResult(_0x4dc158,_0x242db5){return function(_0x2d155e){if(_0x2d155e){var _0x2d0223=typeof _0x242db5['offset']===_0xf78b('0x16')&&typeof _0x242db5[_0xf78b('0x17')]===_0xf78b('0x16');var _0x4520ba=_0x2d155e[_0xf78b('0x18')];var _0x1efc12=_0x2d0223?0x0:_0x242db5[_0xf78b('0x19')];var _0x3463bd=_0x2d0223?_0x2d155e['count']:_0x242db5[_0xf78b('0x19')]+_0x242db5[_0xf78b('0x17')];var _0x5e3f57;if(_0x3463bd>=_0x4520ba){_0x3463bd=_0x4520ba;_0x5e3f57=0xc8;}else{_0x5e3f57=0xce;}_0x4dc158[_0xf78b('0x14')](_0x5e3f57);return _0x4dc158[_0xf78b('0x1a')](_0xf78b('0x1b'),_0x1efc12+'-'+_0x3463bd+'/'+_0x4520ba)[_0xf78b('0x1c')](_0x2d155e);}return null;};}function patchUpdates(_0x47687d){return function(_0x5f3634){try{jsonpatch['apply'](_0x5f3634,_0x47687d,!![]);}catch(_0x2b7f30){return BPromise[_0xf78b('0x1d')](_0x2b7f30);}return _0x5f3634['save']();};}function saveUpdates(_0x369b79,_0x30c0ac){return function(_0x1a4a09){if(_0x1a4a09){return _0x1a4a09[_0xf78b('0x1e')](_0x369b79)[_0xf78b('0x1f')](function(_0x34cd9b){return _0x34cd9b;});}return null;};}function removeEntity(_0x1e07d4,_0x3080e5){return function(_0x443e50){if(_0x443e50){return _0x443e50[_0xf78b('0x20')]()['then'](function(){_0x1e07d4['status'](0xcc)[_0xf78b('0x15')]();});}};}function handleEntityNotFound(_0x4a335b,_0x164599){return function(_0x5d4965){if(!_0x5d4965){_0x4a335b[_0xf78b('0x21')](0x194);}return _0x5d4965;};}function handleError(_0x10b63b,_0x5def03){_0x5def03=_0x5def03||0x1f4;return function(_0x22aef8){logger['error'](_0x22aef8[_0xf78b('0x22')]);if(_0x22aef8[_0xf78b('0x23')]){delete _0x22aef8[_0xf78b('0x23')];}_0x10b63b[_0xf78b('0x14')](_0x5def03)['send'](_0x22aef8);};}exports[_0xf78b('0x24')]=function(_0x3b51b8,_0x57ff7d){var _0x327420={},_0x1d917f={},_0x6f5634={'count':0x0,'rows':[]};var _0x21130b=_[_0xf78b('0x25')](db['VoiceMailMessage'][_0xf78b('0x26')],function(_0x4feb65){return{'name':_0x4feb65['fieldName'],'type':_0x4feb65[_0xf78b('0x27')]['key']};});_0x1d917f[_0xf78b('0x28')]=_[_0xf78b('0x29')](_['map'](_0x21130b,'name'),[_0xf78b('0x23')]);_0x1d917f['query']=_[_0xf78b('0x2a')](_0x3b51b8[_0xf78b('0x2b')]);_0x1d917f[_0xf78b('0x2c')]=_[_0xf78b('0x2d')](_0x1d917f['model'],_0x1d917f[_0xf78b('0x2b')]);_0x327420[_0xf78b('0x2e')]=_[_0xf78b('0x2d')](_0x1d917f['model'],qs[_0xf78b('0x2f')](_0x3b51b8[_0xf78b('0x2b')][_0xf78b('0x2f')]));_0x327420[_0xf78b('0x2e')]=_0x327420[_0xf78b('0x2e')][_0xf78b('0x30')]?_0x327420[_0xf78b('0x2e')]:_0x1d917f['model'];if(!_0x3b51b8['query'][_0xf78b('0x31')](_0xf78b('0x32'))){_0x327420['limit']=qs[_0xf78b('0x17')](_0x3b51b8[_0xf78b('0x2b')][_0xf78b('0x17')]);_0x327420[_0xf78b('0x19')]=qs['offset'](_0x3b51b8[_0xf78b('0x2b')][_0xf78b('0x19')]);}_0x327420[_0xf78b('0x33')]=qs['sort'](_0x3b51b8[_0xf78b('0x2b')]['sort']);_0x327420[_0xf78b('0x34')]=qs[_0xf78b('0x2c')](_[_0xf78b('0x35')](_0x3b51b8[_0xf78b('0x2b')],_0x1d917f[_0xf78b('0x2c')]),_0x21130b);if(_0x3b51b8[_0xf78b('0x2b')]['filter']){_0x327420[_0xf78b('0x34')]=_[_0xf78b('0x36')](_0x327420[_0xf78b('0x34')],{'$or':_[_0xf78b('0x25')](_0x21130b,function(_0x5bb447){if(_0x5bb447[_0xf78b('0x27')]!==_0xf78b('0x37')){var _0x4fe2c5={};_0x4fe2c5[_0x5bb447[_0xf78b('0x23')]]={'$like':'%'+_0x3b51b8[_0xf78b('0x2b')]['filter']+'%'};return _0x4fe2c5;}})});}_0x327420=_[_0xf78b('0x36')]({},_0x327420,_0x3b51b8[_0xf78b('0x38')]);var _0x10b546={'where':_0x327420[_0xf78b('0x34')]};return db['VoiceMailMessage'][_0xf78b('0x18')](_0x10b546)['then'](function(_0x39cd0c){_0x6f5634[_0xf78b('0x18')]=_0x39cd0c;if(_0x3b51b8[_0xf78b('0x2b')][_0xf78b('0x39')]){_0x327420[_0xf78b('0x3a')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x327420);})[_0xf78b('0x1f')](function(_0x2f592a){_0x6f5634[_0xf78b('0x3b')]=_0x2f592a;return _0x6f5634;})[_0xf78b('0x1f')](respondWithFilteredResult(_0x57ff7d,_0x327420))[_0xf78b('0x3c')](handleError(_0x57ff7d,null));};exports[_0xf78b('0x3d')]=function(_0x2c4658,_0x5989c5){var _0x173acf={'raw':!![],'where':{'id':_0x2c4658[_0xf78b('0x3e')]['id']}},_0x3075a3={};_0x3075a3['model']=_[_0xf78b('0x2a')](db[_0xf78b('0x3f')][_0xf78b('0x26')]);_0x3075a3[_0xf78b('0x2b')]=_['keys'](_0x2c4658[_0xf78b('0x2b')]);_0x3075a3[_0xf78b('0x2c')]=_[_0xf78b('0x2d')](_0x3075a3[_0xf78b('0x28')],_0x3075a3['query']);_0x173acf[_0xf78b('0x2e')]=_[_0xf78b('0x2d')](_0x3075a3['model'],qs[_0xf78b('0x2f')](_0x2c4658[_0xf78b('0x2b')][_0xf78b('0x2f')]));_0x173acf['attributes']=_0x173acf['attributes']['length']?_0x173acf['attributes']:_0x3075a3['model'];if(_0x2c4658['query'][_0xf78b('0x39')]){_0x173acf['include']=[{'all':!![]}];}_0x173acf=_['merge']({},_0x173acf,_0x2c4658[_0xf78b('0x38')]);return db[_0xf78b('0x3f')]['find'](_0x173acf)[_0xf78b('0x1f')](handleEntityNotFound(_0x5989c5,null))[_0xf78b('0x1f')](respondWithResult(_0x5989c5,null))['catch'](handleError(_0x5989c5,null));};exports[_0xf78b('0x40')]=function(_0x3960fc,_0x499a96){return db[_0xf78b('0x3f')][_0xf78b('0x40')](_0x3960fc['body'],{})[_0xf78b('0x1f')](respondWithResult(_0x499a96,0xc9))[_0xf78b('0x3c')](handleError(_0x499a96,null));};exports['update']=function(_0x1c3157,_0x303044){if(_0x1c3157[_0xf78b('0x41')]['id']){delete _0x1c3157[_0xf78b('0x41')]['id'];}return db[_0xf78b('0x3f')][_0xf78b('0x42')]({'where':{'id':_0x1c3157[_0xf78b('0x3e')]['id']}})[_0xf78b('0x1f')](handleEntityNotFound(_0x303044,null))['then'](saveUpdates(_0x1c3157['body'],null))[_0xf78b('0x1f')](respondWithResult(_0x303044,null))[_0xf78b('0x3c')](handleError(_0x303044,null));};exports[_0xf78b('0x20')]=function(_0x16ed78,_0x556b11){return db[_0xf78b('0x3f')]['find']({'where':{'id':_0x16ed78[_0xf78b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x556b11,null))[_0xf78b('0x1f')](removeEntity(_0x556b11,null))[_0xf78b('0x3c')](handleError(_0x556b11,null));};exports['download']=function(_0x15c7f0,_0x549b52,_0x3d1a63){return db[_0xf78b('0x3f')]['find']({'where':{'id':_0x15c7f0['params']['id']},'attributes':['id',_0xf78b('0x43'),_0xf78b('0x44')]})[_0xf78b('0x1f')](handleEntityNotFound(_0x549b52,null))[_0xf78b('0x1f')](function(_0xb6d214){if(_0xb6d214){if(!_0xb6d214[_0xf78b('0x43')]){throw new db['Sequelize'][(_0xf78b('0x45'))]('VoiceMailMessage\x20not\x20found');}var _0x1e57be={'Content-Type':_0xf78b('0x46'),'Content-Disposition':_0xf78b('0x47')};if(_0xb6d214['msg_id']){_0x1e57be[_0xf78b('0x48')]=_0xf78b('0x49')+_0xb6d214[_0xf78b('0x44')]+_0xf78b('0x4a');}_0x549b52['set'](_0x1e57be);return _0x549b52[_0xf78b('0x4b')](new Buffer(_0xb6d214[_0xf78b('0x43')]));}})[_0xf78b('0x3c')](handleError(_0x549b52,null));}; \ No newline at end of file +var _0x9e4b=['save','update','then','error','stack','name','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','find','catch','create','body','params','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','send','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject'];(function(_0x2e7984,_0x773fbc){var _0x3b1bea=function(_0x4eacbe){while(--_0x4eacbe){_0x2e7984['push'](_0x2e7984['shift']());}};_0x3b1bea(++_0x773fbc);}(_0x9e4b,0x18f));var _0xb9e4=function(_0xc2299,_0x318d47){_0xc2299=_0xc2299-0x0;var _0x5e0f4e=_0x9e4b[_0xc2299];return _0x5e0f4e;};'use strict';var emlformat=require(_0xb9e4('0x0'));var rimraf=require(_0xb9e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb9e4('0x2'));var moment=require(_0xb9e4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb9e4('0x4'));var util=require(_0xb9e4('0x5'));var path=require(_0xb9e4('0x6'));var sox=require(_0xb9e4('0x7'));var csv=require(_0xb9e4('0x8'));var ejs=require(_0xb9e4('0x9'));var fs=require('fs');var fs_extra=require(_0xb9e4('0xa'));var _=require(_0xb9e4('0xb'));var squel=require(_0xb9e4('0xc'));var crypto=require('crypto');var jsforce=require(_0xb9e4('0xd'));var deskjs=require(_0xb9e4('0xe'));var toCsv=require(_0xb9e4('0x8'));var querystring=require(_0xb9e4('0xf'));var Papa=require(_0xb9e4('0x10'));var Redis=require('ioredis');var authService=require(_0xb9e4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb9e4('0x12'));var hardwareService=require(_0xb9e4('0x13'));var logger=require(_0xb9e4('0x14'))(_0xb9e4('0x15'));var utils=require(_0xb9e4('0x16'));var config=require(_0xb9e4('0x17'));var licenseUtil=require(_0xb9e4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599fc2,_0x1ddc2e){_0x1ddc2e=_0x1ddc2e||0xcc;return function(_0x170ef3){if(_0x170ef3){return _0x599fc2['sendStatus'](_0x1ddc2e);}return _0x599fc2[_0xb9e4('0x19')](_0x1ddc2e)[_0xb9e4('0x1a')]();};}function respondWithResult(_0x296718,_0x2762ee){_0x2762ee=_0x2762ee||0xc8;return function(_0x5415be){if(_0x5415be){return _0x296718[_0xb9e4('0x19')](_0x2762ee)[_0xb9e4('0x1b')](_0x5415be);}};}function respondWithFilteredResult(_0x5193a7,_0x2a5208){return function(_0xa1935a){if(_0xa1935a){var _0x642c99=typeof _0x2a5208['offset']==='undefined'&&typeof _0x2a5208[_0xb9e4('0x1c')]===_0xb9e4('0x1d');var _0x370ff8=_0xa1935a[_0xb9e4('0x1e')];var _0x9bf79d=_0x642c99?0x0:_0x2a5208[_0xb9e4('0x1f')];var _0x29fee7=_0x642c99?_0xa1935a[_0xb9e4('0x1e')]:_0x2a5208[_0xb9e4('0x1f')]+_0x2a5208['limit'];var _0x1da198;if(_0x29fee7>=_0x370ff8){_0x29fee7=_0x370ff8;_0x1da198=0xc8;}else{_0x1da198=0xce;}_0x5193a7[_0xb9e4('0x19')](_0x1da198);return _0x5193a7[_0xb9e4('0x20')](_0xb9e4('0x21'),_0x9bf79d+'-'+_0x29fee7+'/'+_0x370ff8)['json'](_0xa1935a);}return null;};}function patchUpdates(_0x591c6d){return function(_0x5804ee){try{jsonpatch[_0xb9e4('0x22')](_0x5804ee,_0x591c6d,!![]);}catch(_0x37e1cb){return BPromise[_0xb9e4('0x23')](_0x37e1cb);}return _0x5804ee[_0xb9e4('0x24')]();};}function saveUpdates(_0x184ab2,_0x1a305c){return function(_0x1c5d84){if(_0x1c5d84){return _0x1c5d84[_0xb9e4('0x25')](_0x184ab2)[_0xb9e4('0x26')](function(_0x3329b9){return _0x3329b9;});}return null;};}function removeEntity(_0x419064,_0x1e50da){return function(_0x18f2fc){if(_0x18f2fc){return _0x18f2fc['destroy']()[_0xb9e4('0x26')](function(){_0x419064[_0xb9e4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cf925,_0x5d5b2c){return function(_0x4c5e8d){if(!_0x4c5e8d){_0x3cf925['sendStatus'](0x194);}return _0x4c5e8d;};}function handleError(_0xcd44b,_0x53de0e){_0x53de0e=_0x53de0e||0x1f4;return function(_0x967f6e){logger[_0xb9e4('0x27')](_0x967f6e[_0xb9e4('0x28')]);if(_0x967f6e[_0xb9e4('0x29')]){delete _0x967f6e[_0xb9e4('0x29')];}_0xcd44b['status'](_0x53de0e)['send'](_0x967f6e);};}exports[_0xb9e4('0x2a')]=function(_0x144657,_0x1c24a4){var _0x322b24={},_0x3f1fe5={},_0x38a18b={'count':0x0,'rows':[]};var _0x45823f=_['map'](db[_0xb9e4('0x2b')][_0xb9e4('0x2c')],function(_0x37daf0){return{'name':_0x37daf0[_0xb9e4('0x2d')],'type':_0x37daf0[_0xb9e4('0x2e')][_0xb9e4('0x2f')]};});_0x3f1fe5[_0xb9e4('0x30')]=_['differenceBy'](_[_0xb9e4('0x31')](_0x45823f,'name'),[_0xb9e4('0x29')]);_0x3f1fe5[_0xb9e4('0x32')]=_[_0xb9e4('0x33')](_0x144657[_0xb9e4('0x32')]);_0x3f1fe5[_0xb9e4('0x34')]=_[_0xb9e4('0x35')](_0x3f1fe5[_0xb9e4('0x30')],_0x3f1fe5[_0xb9e4('0x32')]);_0x322b24[_0xb9e4('0x36')]=_[_0xb9e4('0x35')](_0x3f1fe5[_0xb9e4('0x30')],qs[_0xb9e4('0x37')](_0x144657['query'][_0xb9e4('0x37')]));_0x322b24[_0xb9e4('0x36')]=_0x322b24['attributes'][_0xb9e4('0x38')]?_0x322b24['attributes']:_0x3f1fe5['model'];if(!_0x144657[_0xb9e4('0x32')][_0xb9e4('0x39')](_0xb9e4('0x3a'))){_0x322b24[_0xb9e4('0x1c')]=qs[_0xb9e4('0x1c')](_0x144657['query'][_0xb9e4('0x1c')]);_0x322b24[_0xb9e4('0x1f')]=qs[_0xb9e4('0x1f')](_0x144657[_0xb9e4('0x32')]['offset']);}_0x322b24[_0xb9e4('0x3b')]=qs[_0xb9e4('0x3c')](_0x144657[_0xb9e4('0x32')][_0xb9e4('0x3c')]);_0x322b24[_0xb9e4('0x3d')]=qs[_0xb9e4('0x34')](_[_0xb9e4('0x3e')](_0x144657[_0xb9e4('0x32')],_0x3f1fe5['filters']),_0x45823f);if(_0x144657[_0xb9e4('0x32')][_0xb9e4('0x3f')]){_0x322b24[_0xb9e4('0x3d')]=_[_0xb9e4('0x40')](_0x322b24[_0xb9e4('0x3d')],{'$or':_[_0xb9e4('0x31')](_0x45823f,function(_0x38f68c){if(_0x38f68c[_0xb9e4('0x2e')]!==_0xb9e4('0x41')){var _0x2f6470={};_0x2f6470[_0x38f68c[_0xb9e4('0x29')]]={'$like':'%'+_0x144657[_0xb9e4('0x32')]['filter']+'%'};return _0x2f6470;}})});}_0x322b24=_['merge']({},_0x322b24,_0x144657[_0xb9e4('0x42')]);var _0x4607eb={'where':_0x322b24[_0xb9e4('0x3d')]};return db[_0xb9e4('0x2b')][_0xb9e4('0x1e')](_0x4607eb)[_0xb9e4('0x26')](function(_0x224e1a){_0x38a18b['count']=_0x224e1a;if(_0x144657['query'][_0xb9e4('0x43')]){_0x322b24['include']=[{'all':!![]}];}return db[_0xb9e4('0x2b')][_0xb9e4('0x44')](_0x322b24);})[_0xb9e4('0x26')](function(_0x2e510e){_0x38a18b[_0xb9e4('0x45')]=_0x2e510e;return _0x38a18b;})[_0xb9e4('0x26')](respondWithFilteredResult(_0x1c24a4,_0x322b24))['catch'](handleError(_0x1c24a4,null));};exports['show']=function(_0x35aa6c,_0x445604){var _0x372cc0={'raw':!![],'where':{'id':_0x35aa6c['params']['id']}},_0x4861da={};_0x4861da[_0xb9e4('0x30')]=_['keys'](db[_0xb9e4('0x2b')][_0xb9e4('0x2c')]);_0x4861da[_0xb9e4('0x32')]=_[_0xb9e4('0x33')](_0x35aa6c[_0xb9e4('0x32')]);_0x4861da[_0xb9e4('0x34')]=_[_0xb9e4('0x35')](_0x4861da[_0xb9e4('0x30')],_0x4861da[_0xb9e4('0x32')]);_0x372cc0[_0xb9e4('0x36')]=_[_0xb9e4('0x35')](_0x4861da['model'],qs[_0xb9e4('0x37')](_0x35aa6c[_0xb9e4('0x32')][_0xb9e4('0x37')]));_0x372cc0['attributes']=_0x372cc0['attributes'][_0xb9e4('0x38')]?_0x372cc0[_0xb9e4('0x36')]:_0x4861da[_0xb9e4('0x30')];if(_0x35aa6c['query'][_0xb9e4('0x43')]){_0x372cc0['include']=[{'all':!![]}];}_0x372cc0=_[_0xb9e4('0x40')]({},_0x372cc0,_0x35aa6c[_0xb9e4('0x42')]);return db['VoiceMailMessage'][_0xb9e4('0x46')](_0x372cc0)[_0xb9e4('0x26')](handleEntityNotFound(_0x445604,null))[_0xb9e4('0x26')](respondWithResult(_0x445604,null))[_0xb9e4('0x47')](handleError(_0x445604,null));};exports[_0xb9e4('0x48')]=function(_0x308da7,_0x4d3936){return db[_0xb9e4('0x2b')][_0xb9e4('0x48')](_0x308da7[_0xb9e4('0x49')],{})[_0xb9e4('0x26')](respondWithResult(_0x4d3936,0xc9))[_0xb9e4('0x47')](handleError(_0x4d3936,null));};exports[_0xb9e4('0x25')]=function(_0x362293,_0x4e60b4){if(_0x362293[_0xb9e4('0x49')]['id']){delete _0x362293[_0xb9e4('0x49')]['id'];}return db[_0xb9e4('0x2b')][_0xb9e4('0x46')]({'where':{'id':_0x362293[_0xb9e4('0x4a')]['id']}})[_0xb9e4('0x26')](handleEntityNotFound(_0x4e60b4,null))[_0xb9e4('0x26')](saveUpdates(_0x362293[_0xb9e4('0x49')],null))[_0xb9e4('0x26')](respondWithResult(_0x4e60b4,null))[_0xb9e4('0x47')](handleError(_0x4e60b4,null));};exports[_0xb9e4('0x4b')]=function(_0x176d3e,_0x5395b0){return db[_0xb9e4('0x2b')]['find']({'where':{'id':_0x176d3e[_0xb9e4('0x4a')]['id']}})[_0xb9e4('0x26')](handleEntityNotFound(_0x5395b0,null))['then'](removeEntity(_0x5395b0,null))[_0xb9e4('0x47')](handleError(_0x5395b0,null));};exports[_0xb9e4('0x4c')]=function(_0x2eb897,_0x39f295,_0x1eab1c){return db[_0xb9e4('0x2b')][_0xb9e4('0x46')]({'where':{'id':_0x2eb897[_0xb9e4('0x4a')]['id']},'attributes':['id',_0xb9e4('0x4d'),_0xb9e4('0x4e')]})[_0xb9e4('0x26')](handleEntityNotFound(_0x39f295,null))['then'](function(_0x4d95f4){if(_0x4d95f4){if(!_0x4d95f4[_0xb9e4('0x4d')]){throw new db[(_0xb9e4('0x4f'))][(_0xb9e4('0x50'))](_0xb9e4('0x51'));}var _0x26a1bd={'Content-Type':_0xb9e4('0x52'),'Content-Disposition':_0xb9e4('0x53')};if(_0x4d95f4[_0xb9e4('0x4e')]){_0x26a1bd[_0xb9e4('0x54')]=_0xb9e4('0x55')+_0x4d95f4[_0xb9e4('0x4e')]+'.wav\x22';}_0x39f295[_0xb9e4('0x20')](_0x26a1bd);return _0x39f295[_0xb9e4('0x56')](new Buffer(_0x4d95f4['recording']));}})[_0xb9e4('0x47')](handleError(_0x39f295,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index bc34f93..d835930 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 _0xf886=['rimraf','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','moment','bluebird','path'];(function(_0x435a57,_0x1e0193){var _0x4cd9e4=function(_0x39ceb2){while(--_0x39ceb2){_0x435a57['push'](_0x435a57['shift']());}};_0x4cd9e4(++_0x1e0193);}(_0xf886,0xb6));var _0x6f88=function(_0xf35bc1,_0x510803){_0xf35bc1=_0xf35bc1-0x0;var _0xa6b162=_0xf886[_0xf35bc1];return _0xa6b162;};'use strict';var _=require('lodash');var util=require(_0x6f88('0x0'));var logger=require(_0x6f88('0x1'))('api');var moment=require(_0x6f88('0x2'));var BPromise=require(_0x6f88('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f88('0x4'));var rimraf=require(_0x6f88('0x5'));var config=require('../../config/environment');var attributes=require(_0x6f88('0x6'));module[_0x6f88('0x7')]=function(_0x596790,_0x33e4e0){return _0x596790['define'](_0x6f88('0x8'),attributes,{'tableName':_0x6f88('0x9'),'paranoid':![],'indexes':[{'name':_0x6f88('0xa'),'fields':[_0x6f88('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4264=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x4264,0x1ed));var _0x4426=function(_0x266c6b,_0x58d88e){_0x266c6b=_0x266c6b-0x0;var _0x3373b0=_0x4264[_0x266c6b];return _0x3373b0;};'use strict';var _=require(_0x4426('0x0'));var util=require(_0x4426('0x1'));var logger=require(_0x4426('0x2'))(_0x4426('0x3'));var moment=require(_0x4426('0x4'));var BPromise=require(_0x4426('0x5'));var rp=require(_0x4426('0x6'));var fs=require('fs');var path=require(_0x4426('0x7'));var rimraf=require(_0x4426('0x8'));var config=require(_0x4426('0x9'));var attributes=require(_0x4426('0xa'));module[_0x4426('0xb')]=function(_0x596b07,_0xfa06c4){return _0x596b07[_0x4426('0xc')](_0x4426('0xd'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x4426('0xe'),'fields':[_0x4426('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 0a1b287..f134fa3 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 _0xaaee=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash'];(function(_0x420a70,_0x40a545){var _0x6086b9=function(_0x34b40f){while(--_0x34b40f){_0x420a70['push'](_0x420a70['shift']());}};_0x6086b9(++_0x40a545);}(_0xaaee,0x83));var _0xeaae=function(_0x5b6861,_0x44ca73){_0x5b6861=_0x5b6861-0x0;var _0x32daec=_0xaaee[_0x5b6861];return _0x32daec;};'use strict';var _=require(_0xeaae('0x0'));var util=require(_0xeaae('0x1'));var moment=require(_0xeaae('0x2'));var BPromise=require(_0xeaae('0x3'));var rs=require(_0xeaae('0x4'));var fs=require('fs');var Redis=require(_0xeaae('0x5'));var db=require(_0xeaae('0x6'))['db'];var utils=require(_0xeaae('0x7'));var logger=require('../../config/logger')(_0xeaae('0x8'));var config=require(_0xeaae('0x9'));var jayson=require(_0xeaae('0xa'));var client=jayson[_0xeaae('0xb')][_0xeaae('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36eea5,_0x28b889,_0xd507bc){return new BPromise(function(_0x2ba22b,_0x384acf){return client[_0xeaae('0xd')](_0x36eea5,_0xd507bc)[_0xeaae('0xe')](function(_0x2d0941){logger['info'](_0xeaae('0xf'),_0x28b889,_0xeaae('0x10'));logger[_0xeaae('0x11')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x28b889,'request\x20sent',JSON['stringify'](_0x2d0941));if(_0x2d0941[_0xeaae('0x12')]){if(_0x2d0941[_0xeaae('0x12')][_0xeaae('0x13')]===0x1f4){logger[_0xeaae('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x28b889,_0x2d0941[_0xeaae('0x12')]['message']);return _0x384acf(_0x2d0941['error'][_0xeaae('0x14')]);}logger[_0xeaae('0x12')](_0xeaae('0xf'),_0x28b889,_0x2d0941[_0xeaae('0x12')]['message']);return _0x2ba22b(_0x2d0941[_0xeaae('0x12')][_0xeaae('0x14')]);}else{logger['info'](_0xeaae('0xf'),_0x28b889,'request\x20sent');_0x2ba22b(_0x2d0941[_0xeaae('0x15')][_0xeaae('0x14')]);}})['catch'](function(_0x32604c){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x28b889,_0x32604c);_0x384acf(_0x32604c);});});} \ No newline at end of file +var _0xcca0=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','code','error','VoiceMailMessage,\x20%s,\x20%s','message'];(function(_0x54a02e,_0x57e5df){var _0x32e842=function(_0x4cd8ea){while(--_0x4cd8ea){_0x54a02e['push'](_0x54a02e['shift']());}};_0x32e842(++_0x57e5df);}(_0xcca0,0x1bb));var _0x0cca=function(_0x2b6fd6,_0x4e5a05){_0x2b6fd6=_0x2b6fd6-0x0;var _0xc0d50f=_0xcca0[_0x2b6fd6];return _0xc0d50f;};'use strict';var _=require(_0x0cca('0x0'));var util=require(_0x0cca('0x1'));var moment=require(_0x0cca('0x2'));var BPromise=require(_0x0cca('0x3'));var rs=require(_0x0cca('0x4'));var fs=require('fs');var Redis=require(_0x0cca('0x5'));var db=require(_0x0cca('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cca('0x7'))(_0x0cca('0x8'));var config=require('../../config/environment');var jayson=require(_0x0cca('0x9'));var client=jayson[_0x0cca('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d586f,_0x2eb296,_0x18b488){return new BPromise(function(_0x392107,_0x145c17){return client['request'](_0x1d586f,_0x18b488)[_0x0cca('0xb')](function(_0x49dde5){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x2eb296,_0x0cca('0xc'));logger[_0x0cca('0xd')](_0x0cca('0xe'),_0x2eb296,'request\x20sent',JSON['stringify'](_0x49dde5));if(_0x49dde5['error']){if(_0x49dde5['error'][_0x0cca('0xf')]===0x1f4){logger[_0x0cca('0x10')](_0x0cca('0x11'),_0x2eb296,_0x49dde5[_0x0cca('0x10')]['message']);return _0x145c17(_0x49dde5[_0x0cca('0x10')][_0x0cca('0x12')]);}logger['error'](_0x0cca('0x11'),_0x2eb296,_0x49dde5[_0x0cca('0x10')]['message']);return _0x392107(_0x49dde5[_0x0cca('0x10')][_0x0cca('0x12')]);}else{logger[_0x0cca('0x13')](_0x0cca('0x11'),_0x2eb296,_0x0cca('0xc'));_0x392107(_0x49dde5[_0x0cca('0x14')]['message']);}})[_0x0cca('0x15')](function(_0x1d4451){logger['error'](_0x0cca('0x11'),_0x2eb296,_0x1d4451);_0x145c17(_0x1d4451);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 4868a33..7cb19ff 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 _0xaba4=['/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds','post','create','addSound','put','update','delete','destroy'];(function(_0x4f57f3,_0x226e36){var _0x31d6f4=function(_0x373e10){while(--_0x373e10){_0x4f57f3['push'](_0x4f57f3['shift']());}};_0x31d6f4(++_0x226e36);}(_0xaba4,0x148));var _0x4aba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaba4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4aba('0x0'));var util=require(_0x4aba('0x1'));var path=require(_0x4aba('0x2'));var timeout=require(_0x4aba('0x3'));var express=require(_0x4aba('0x4'));var router=express[_0x4aba('0x5')]();var fs_extra=require(_0x4aba('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4aba('0x7'));var config=require(_0x4aba('0x8'));var controller=require(_0x4aba('0x9'));router[_0x4aba('0xa')]('/',auth[_0x4aba('0xb')](),controller['index']);router[_0x4aba('0xa')](_0x4aba('0xc'),auth[_0x4aba('0xb')](),controller[_0x4aba('0xd')]);router[_0x4aba('0xa')](_0x4aba('0xe'),auth[_0x4aba('0xb')](),controller['getSounds']);router[_0x4aba('0xf')]('/',auth[_0x4aba('0xb')](),controller[_0x4aba('0x10')]);router[_0x4aba('0xf')](_0x4aba('0xe'),auth[_0x4aba('0xb')](),controller[_0x4aba('0x11')]);router[_0x4aba('0x12')](_0x4aba('0xc'),auth[_0x4aba('0xb')](),controller[_0x4aba('0x13')]);router[_0x4aba('0x14')](_0x4aba('0xc'),auth[_0x4aba('0xb')](),controller[_0x4aba('0x15')]);router['delete'](_0x4aba('0x16'),auth['isAuthenticated'](),controller[_0x4aba('0x17')]);module[_0x4aba('0x18')]=router; \ No newline at end of file +var _0xe5bb=['index','/:id','show','/:id/sounds','getSounds','post','addSound','put','update','delete','removeSound','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4dabf3,_0x204886){var _0x30644f=function(_0x5c3519){while(--_0x5c3519){_0x4dabf3['push'](_0x4dabf3['shift']());}};_0x30644f(++_0x204886);}(_0xe5bb,0x14e));var _0xbe5b=function(_0x549e8b,_0x2a0acf){_0x549e8b=_0x549e8b-0x0;var _0x4f6954=_0xe5bb[_0x549e8b];return _0x4f6954;};'use strict';var multer=require(_0xbe5b('0x0'));var util=require(_0xbe5b('0x1'));var path=require(_0xbe5b('0x2'));var timeout=require(_0xbe5b('0x3'));var express=require(_0xbe5b('0x4'));var router=express['Router']();var fs_extra=require(_0xbe5b('0x5'));var auth=require(_0xbe5b('0x6'));var interaction=require(_0xbe5b('0x7'));var config=require(_0xbe5b('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0xbe5b('0x9')]('/',auth[_0xbe5b('0xa')](),controller[_0xbe5b('0xb')]);router[_0xbe5b('0x9')](_0xbe5b('0xc'),auth[_0xbe5b('0xa')](),controller[_0xbe5b('0xd')]);router[_0xbe5b('0x9')](_0xbe5b('0xe'),auth[_0xbe5b('0xa')](),controller[_0xbe5b('0xf')]);router[_0xbe5b('0x10')]('/',auth[_0xbe5b('0xa')](),controller['create']);router[_0xbe5b('0x10')]('/:id/sounds',auth[_0xbe5b('0xa')](),controller[_0xbe5b('0x11')]);router[_0xbe5b('0x12')](_0xbe5b('0xc'),auth[_0xbe5b('0xa')](),controller[_0xbe5b('0x13')]);router[_0xbe5b('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xbe5b('0x14')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xbe5b('0x15')]);module[_0xbe5b('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 3b45f30..d87488d 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 _0x8325=['exports','STRING','name','ENUM','custom','mp3nb','quietmp3nb','quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x47a491,_0x45e171){var _0x3b176b=function(_0x8c826){while(--_0x8c826){_0x47a491['push'](_0x47a491['shift']());}};_0x3b176b(++_0x45e171);}(_0x8325,0x14f));var _0x5832=function(_0x5e6d3d,_0x33e928){_0x5e6d3d=_0x5e6d3d-0x0;var _0x48cd0e=_0x8325[_0x5e6d3d];return _0x48cd0e;};'use strict';var Sequelize=require(_0x5832('0x0'));module[_0x5832('0x1')]={'name':{'type':Sequelize[_0x5832('0x2')],'allowNull':![],'unique':_0x5832('0x3')},'mode':{'type':Sequelize[_0x5832('0x4')](_0x5832('0x5'),'files',_0x5832('0x6'),_0x5832('0x7'),_0x5832('0x8'),_0x5832('0x9')),'allowNull':!![],'defaultValue':_0x5832('0xa')},'directory':{'type':Sequelize[_0x5832('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x5832('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5832('0xb')},'format':{'type':Sequelize[_0x5832('0x2')],'allowNull':!![]},'stamp':{'type':_0x5832('0xc')},'defaultEntry':{'type':Sequelize[_0x5832('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb137=['mp3nb','quietmp3nb','quietmp3','TIMESTAMP','exports','STRING','name','ENUM','custom','files'];(function(_0x108d5f,_0x33f82d){var _0x456ea3=function(_0x228200){while(--_0x228200){_0x108d5f['push'](_0x108d5f['shift']());}};_0x456ea3(++_0x33f82d);}(_0xb137,0xe0));var _0x7b13=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0xb137[_0x301dab];return _0x2500a2;};'use strict';var Sequelize=require('sequelize');module[_0x7b13('0x0')]={'name':{'type':Sequelize[_0x7b13('0x1')],'allowNull':![],'unique':_0x7b13('0x2')},'mode':{'type':Sequelize[_0x7b13('0x3')](_0x7b13('0x4'),_0x7b13('0x5'),_0x7b13('0x6'),_0x7b13('0x7'),_0x7b13('0x8'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x7b13('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x7b13('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7b13('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x7b13('0x1')],'allowNull':!![]},'stamp':{'type':_0x7b13('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 ded7fca..2262d1e 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 _0x472c=['sequelize','transaction','mode','files','root','server/files/moh','directory','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','forEach','unlinkSync','join','rmdirSync','Sequelize','message','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','ValidationError','removeSound','findOne','id2','getSounds','order','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','MusicOnHolds','UserProfileResource','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','find','body','create'];(function(_0x5e9638,_0x52acfa){var _0x2215cb=function(_0x494602){while(--_0x494602){_0x5e9638['push'](_0x5e9638['shift']());}};_0x2215cb(++_0x52acfa);}(_0x472c,0x97));var _0xc472=function(_0x5065cd,_0x41b0f0){_0x5065cd=_0x5065cd-0x0;var _0x591ea7=_0x472c[_0x5065cd];return _0x591ea7;};'use strict';var emlformat=require(_0xc472('0x0'));var rimraf=require(_0xc472('0x1'));var zipdir=require(_0xc472('0x2'));var jsonpatch=require(_0xc472('0x3'));var rp=require('request-promise');var moment=require(_0xc472('0x4'));var BPromise=require(_0xc472('0x5'));var Mustache=require(_0xc472('0x6'));var util=require(_0xc472('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc472('0x8'));var ejs=require(_0xc472('0x9'));var fs=require('fs');var fs_extra=require(_0xc472('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc472('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc472('0xc'));var toCsv=require(_0xc472('0x8'));var querystring=require(_0xc472('0xd'));var Papa=require(_0xc472('0xe'));var Redis=require('ioredis');var authService=require(_0xc472('0xf'));var qs=require(_0xc472('0x10'));var as=require(_0xc472('0x11'));var hardwareService=require(_0xc472('0x12'));var logger=require(_0xc472('0x13'))(_0xc472('0x14'));var utils=require(_0xc472('0x15'));var config=require(_0xc472('0x16'));var licenseUtil=require(_0xc472('0x17'));var db=require(_0xc472('0x18'))['db'];function respondWithStatusCode(_0x48da40,_0x3fc60f){_0x3fc60f=_0x3fc60f||0xcc;return function(_0x4d1059){if(_0x4d1059){return _0x48da40[_0xc472('0x19')](_0x3fc60f);}return _0x48da40[_0xc472('0x1a')](_0x3fc60f)[_0xc472('0x1b')]();};}function respondWithResult(_0x49de61,_0x1d21eb){_0x1d21eb=_0x1d21eb||0xc8;return function(_0x3b77e0){if(_0x3b77e0){return _0x49de61[_0xc472('0x1a')](_0x1d21eb)[_0xc472('0x1c')](_0x3b77e0);}};}function respondWithFilteredResult(_0x2562be,_0x4c8a82){return function(_0x524a34){if(_0x524a34){var _0xf5b66b=typeof _0x4c8a82[_0xc472('0x1d')]==='undefined'&&typeof _0x4c8a82[_0xc472('0x1e')]==='undefined';var _0x18a77b=_0x524a34[_0xc472('0x1f')];var _0x5b7974=_0xf5b66b?0x0:_0x4c8a82[_0xc472('0x1d')];var _0x3a92d2=_0xf5b66b?_0x524a34[_0xc472('0x1f')]:_0x4c8a82[_0xc472('0x1d')]+_0x4c8a82[_0xc472('0x1e')];var _0x44cf01;if(_0x3a92d2>=_0x18a77b){_0x3a92d2=_0x18a77b;_0x44cf01=0xc8;}else{_0x44cf01=0xce;}_0x2562be[_0xc472('0x1a')](_0x44cf01);return _0x2562be[_0xc472('0x20')]('Content-Range',_0x5b7974+'-'+_0x3a92d2+'/'+_0x18a77b)[_0xc472('0x1c')](_0x524a34);}return null;};}function patchUpdates(_0x41b9ef){return function(_0x1a3800){try{jsonpatch[_0xc472('0x21')](_0x1a3800,_0x41b9ef,!![]);}catch(_0xc302de){return BPromise[_0xc472('0x22')](_0xc302de);}return _0x1a3800[_0xc472('0x23')]();};}function saveUpdates(_0x39edd2,_0x1d5514){return function(_0x55bd8f){if(_0x55bd8f){return _0x55bd8f[_0xc472('0x24')](_0x39edd2)[_0xc472('0x25')](function(_0xb2e9e){return _0xb2e9e;});}return null;};}function removeEntity(_0x150801,_0x1e3bf1){return function(_0xc59f78){if(_0xc59f78){return _0xc59f78[_0xc472('0x26')]()[_0xc472('0x25')](function(){var _0x478d45=_0xc59f78['get']({'plain':!![]});var _0x56f08f=_0xc472('0x27');return db[_0xc472('0x28')][_0xc472('0x26')]({'where':{'type':_0x56f08f,'resourceId':_0x478d45['id']}})[_0xc472('0x25')](function(){return _0xc59f78;});})[_0xc472('0x25')](function(){_0x150801['status'](0xcc)[_0xc472('0x1b')]();});}};}function handleEntityNotFound(_0x24d186,_0x5cc27){return function(_0x2e4abe){if(!_0x2e4abe){_0x24d186[_0xc472('0x19')](0x194);}return _0x2e4abe;};}function handleError(_0x217474,_0x434215){_0x434215=_0x434215||0x1f4;return function(_0x221aa4){logger[_0xc472('0x29')](_0x221aa4[_0xc472('0x2a')]);if(_0x221aa4[_0xc472('0x2b')]){delete _0x221aa4[_0xc472('0x2b')];}_0x217474[_0xc472('0x1a')](_0x434215)[_0xc472('0x2c')](_0x221aa4);};}exports[_0xc472('0x2d')]=function(_0x219299,_0x1ebd02){var _0x26d934={},_0x749fec={},_0x3ea70a={'count':0x0,'rows':[]};var _0x446ca6=_['map'](db[_0xc472('0x2e')][_0xc472('0x2f')],function(_0x21820c){return{'name':_0x21820c[_0xc472('0x30')],'type':_0x21820c['type'][_0xc472('0x31')]};});_0x749fec[_0xc472('0x32')]=_[_0xc472('0x33')](_0x446ca6,'name');_0x749fec[_0xc472('0x34')]=_[_0xc472('0x35')](_0x219299[_0xc472('0x34')]);_0x749fec[_0xc472('0x36')]=_['intersection'](_0x749fec[_0xc472('0x32')],_0x749fec['query']);_0x26d934['attributes']=_[_0xc472('0x37')](_0x749fec['model'],qs[_0xc472('0x38')](_0x219299[_0xc472('0x34')][_0xc472('0x38')]));_0x26d934['attributes']=_0x26d934[_0xc472('0x39')][_0xc472('0x3a')]?_0x26d934['attributes']:_0x749fec[_0xc472('0x32')];if(!_0x219299['query'][_0xc472('0x3b')](_0xc472('0x3c'))){_0x26d934[_0xc472('0x1e')]=qs[_0xc472('0x1e')](_0x219299[_0xc472('0x34')]['limit']);_0x26d934[_0xc472('0x1d')]=qs[_0xc472('0x1d')](_0x219299['query'][_0xc472('0x1d')]);}_0x26d934['order']=qs['sort'](_0x219299[_0xc472('0x34')]['sort']);delete _0x219299['query'][_0xc472('0x3d')];_0x26d934[_0xc472('0x3e')]=qs['filters'](_[_0xc472('0x3f')](_0x219299[_0xc472('0x34')],_0x749fec[_0xc472('0x36')]),_0x446ca6);if(_0x219299[_0xc472('0x34')][_0xc472('0x40')]){_0x26d934[_0xc472('0x3e')]=_[_0xc472('0x41')](_0x26d934[_0xc472('0x3e')],{'$or':_[_0xc472('0x33')](_0x446ca6,function(_0x3f55ef){if(_0x3f55ef[_0xc472('0x42')]!=='VIRTUAL'){var _0x42b2ef={};_0x42b2ef[_0x3f55ef[_0xc472('0x2b')]]={'$like':'%'+_0x219299[_0xc472('0x34')]['filter']+'%'};return _0x42b2ef;}})});}_0x26d934=_[_0xc472('0x41')]({},_0x26d934,_0x219299[_0xc472('0x43')]);var _0x1dba67={'where':_0x26d934[_0xc472('0x3e')]};return db['VoiceMusicOnHold']['count'](_0x1dba67)['then'](function(_0x912ca2){_0x3ea70a[_0xc472('0x1f')]=_0x912ca2;if(_0x219299[_0xc472('0x34')][_0xc472('0x44')]){_0x26d934['include']=[{'all':!![]}];}return db[_0xc472('0x2e')][_0xc472('0x45')](_0x26d934);})[_0xc472('0x25')](function(_0x523f25){_0x3ea70a[_0xc472('0x46')]=_0x523f25;return _0x3ea70a;})[_0xc472('0x25')](respondWithFilteredResult(_0x1ebd02,_0x26d934))[_0xc472('0x47')](handleError(_0x1ebd02,null));};exports[_0xc472('0x48')]=function(_0x5a5996,_0x5d6e33){var _0x54bb3a={'raw':![],'where':{'id':_0x5a5996[_0xc472('0x49')]['id']}},_0x532cad={};_0x532cad[_0xc472('0x32')]=_[_0xc472('0x35')](db['VoiceMusicOnHold'][_0xc472('0x2f')]);_0x532cad['query']=_[_0xc472('0x35')](_0x5a5996[_0xc472('0x34')]);_0x532cad[_0xc472('0x36')]=_[_0xc472('0x37')](_0x532cad[_0xc472('0x32')],_0x532cad[_0xc472('0x34')]);_0x54bb3a[_0xc472('0x39')]=_[_0xc472('0x37')](_0x532cad[_0xc472('0x32')],qs[_0xc472('0x38')](_0x5a5996[_0xc472('0x34')][_0xc472('0x38')]));_0x54bb3a['attributes']=_0x54bb3a[_0xc472('0x39')][_0xc472('0x3a')]?_0x54bb3a['attributes']:_0x532cad[_0xc472('0x32')];if(_0x5a5996[_0xc472('0x34')]['includeAll']){_0x54bb3a['include']=[{'all':!![]}];}_0x54bb3a=_[_0xc472('0x41')]({},_0x54bb3a,_0x5a5996['options']);return db[_0xc472('0x2e')][_0xc472('0x4a')](_0x54bb3a)['then'](handleEntityNotFound(_0x5d6e33,null))[_0xc472('0x25')](respondWithResult(_0x5d6e33,null))[_0xc472('0x47')](handleError(_0x5d6e33,null));};exports[_0xc472('0x24')]=function(_0x21622e,_0x13bd9d){if(_0x21622e[_0xc472('0x4b')]['id']){delete _0x21622e['body']['id'];}return db[_0xc472('0x2e')][_0xc472('0x4a')]({'where':{'id':_0x21622e[_0xc472('0x49')]['id']}})[_0xc472('0x25')](handleEntityNotFound(_0x13bd9d,null))[_0xc472('0x25')](saveUpdates(_0x21622e['body'],null))[_0xc472('0x25')](respondWithResult(_0x13bd9d,null))[_0xc472('0x47')](handleError(_0x13bd9d,null));};exports[_0xc472('0x4c')]=function(_0x52458a,_0x5f3d0d,_0xf0cc84){return db[_0xc472('0x4d')][_0xc472('0x4e')](function(_0xe79878){if(_0x52458a[_0xc472('0x4b')][_0xc472('0x4f')]===_0xc472('0x50')){_0x52458a[_0xc472('0x4b')]['directory']=path['join'](config[_0xc472('0x51')],_0xc472('0x52'),_0x52458a[_0xc472('0x4b')]['name']);}return db[_0xc472('0x2e')][_0xc472('0x4c')](_0x52458a[_0xc472('0x4b')],{'transaction':_0xe79878})['then'](function(_0x457d9a){if(_0x52458a['body'][_0xc472('0x4f')]==='files'){fs['mkdirSync'](_0x457d9a[_0xc472('0x53')],parseInt(_0xc472('0x54'),0x8));}var _0x2f41a2=_0x52458a[_0xc472('0x55')][_0xc472('0x56')]({'plain':!![]});if(!_0x2f41a2)throw new Error(_0xc472('0x57'));if(_0x2f41a2[_0xc472('0x58')]==='user'){var _0x2e0dd1=_0x457d9a[_0xc472('0x56')]({'plain':!![]});return db[_0xc472('0x59')][_0xc472('0x4a')]({'where':{'name':'MusicOnHolds','userProfileId':_0x2f41a2[_0xc472('0x5a')]},'raw':!![]})[_0xc472('0x25')](function(_0x193aef){if(_0x193aef&&_0x193aef[_0xc472('0x5b')]===0x0){return db['UserProfileResource'][_0xc472('0x4c')]({'name':_0x2e0dd1[_0xc472('0x2b')],'resourceId':_0x2e0dd1['id'],'type':_0x193aef[_0xc472('0x2b')],'sectionId':_0x193aef['id']},{})[_0xc472('0x25')](function(){return _0x457d9a;});}else{return _0x457d9a;}})[_0xc472('0x47')](function(_0x36c96a){logger[_0xc472('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36c96a);});}return _0x457d9a;});})[_0xc472('0x25')](respondWithResult(_0x5f3d0d,0xc9))[_0xc472('0x47')](handleError(_0x5f3d0d,null));};exports[_0xc472('0x26')]=function(_0x25ee5e,_0x142794,_0x4c41a0){var _0x30eb0c;return db[_0xc472('0x2e')][_0xc472('0x4a')]({'where':{'id':_0x25ee5e[_0xc472('0x49')]['id']}})['then'](function(_0x472fa3){if(_0x472fa3){return db['sequelize'][_0xc472('0x4e')](function(_0x24e6ca){return _0x472fa3[_0xc472('0x26')]({'transaction':_0x24e6ca,'raw':!![]})[_0xc472('0x25')](function(_0x16c3bf){if(_0x16c3bf[_0xc472('0x53')]){fs['readdirSync'](_0x16c3bf[_0xc472('0x53')])[_0xc472('0x5c')](function(_0x37fffa){fs[_0xc472('0x5d')](path[_0xc472('0x5e')](_0x16c3bf[_0xc472('0x53')],_0x37fffa));});fs[_0xc472('0x5f')](_0x16c3bf[_0xc472('0x53')]);}return _0x16c3bf;});})[_0xc472('0x47')](function(_0x220b32){throw new db[(_0xc472('0x60'))]['ValidationError'](_0x220b32[_0xc472('0x61')]);});}})[_0xc472('0x25')](handleEntityNotFound(_0x142794,null))[_0xc472('0x25')](removeEntity(_0x142794,null))['catch'](handleError(_0x142794,null));};exports[_0xc472('0x62')]=function(_0x307ce0,_0x5faa4,_0x368207){return db[_0xc472('0x4d')]['transaction'](function(_0x449343){var _0x565a39;return db[_0xc472('0x2e')]['find']({'where':{'id':_0x307ce0[_0xc472('0x49')]['id']}})[_0xc472('0x25')](function(_0x3a17b9){if(_0x3a17b9){_0x565a39=_0x3a17b9;return _0x3a17b9[_0xc472('0x62')](_0x307ce0[_0xc472('0x4b')]['id'],{'transaction':_0x449343});}})[_0xc472('0x25')](function(_0x5af415){if(_0x5af415){return db[_0xc472('0x63')]['findOne']({'where':{'id':_0x307ce0[_0xc472('0x4b')]['id']},'attributes':['id',_0xc472('0x2b'),_0xc472('0x64'),_0xc472('0x65'),_0xc472('0x66')],'raw':!![]});}})[_0xc472('0x25')](function(_0xc43bde){if(_0xc43bde){var _0xa1fba=path['join'](config[_0xc472('0x51')],_0xc472('0x67'),util[_0xc472('0x68')](_0xc472('0x69'),path[_0xc472('0x6a')](_0xc43bde['save_name'],path[_0xc472('0x6b')](_0xc43bde[_0xc472('0x64')])),_0xc43bde[_0xc472('0x65')]));var _0x3783c0=path[_0xc472('0x5e')](config[_0xc472('0x51')],_0xc472('0x52'),_0x565a39[_0xc472('0x2b')],util['format'](_0xc472('0x69'),_0xc43bde[_0xc472('0x2b')],_0xc43bde[_0xc472('0x65')]));fs['symlinkSync'](_0xa1fba,_0x3783c0);return _0xc43bde;}})[_0xc472('0x47')](function(_0x1c47c4){throw new db['Sequelize'][(_0xc472('0x6c'))](_0x1c47c4[_0xc472('0x61')]);});})[_0xc472('0x25')](handleEntityNotFound(_0x5faa4,null))[_0xc472('0x25')](respondWithResult(_0x5faa4,0xc9))[_0xc472('0x47')](handleError(_0x5faa4,null));};exports[_0xc472('0x6d')]=function(_0x519aa4,_0x489081,_0x36854a){return db['sequelize'][_0xc472('0x4e')](function(_0x56f7d5){var _0x313abb;return db[_0xc472('0x2e')]['findOne']({'where':{'id':_0x519aa4[_0xc472('0x49')]['id']}})[_0xc472('0x25')](handleEntityNotFound(_0x489081,null))[_0xc472('0x25')](function(_0x1f9c93){if(_0x1f9c93){_0x313abb=_0x1f9c93;return _0x1f9c93[_0xc472('0x6d')](_0x519aa4[_0xc472('0x49')]['id2']);}})[_0xc472('0x25')](function(_0x241141){if(_0x241141){return db['Sound'][_0xc472('0x6e')]({'where':{'id':_0x519aa4[_0xc472('0x49')][_0xc472('0x6f')]},'attributes':['id',_0xc472('0x2b'),_0xc472('0x64'),_0xc472('0x65'),'createdAt'],'raw':!![]});}})['then'](function(_0x1ffd9e){if(_0x1ffd9e){fs['unlinkSync'](path[_0xc472('0x5e')](_0x313abb[_0xc472('0x53')],util['format'](_0xc472('0x69'),_0x1ffd9e['name'],_0x1ffd9e[_0xc472('0x65')])));return _0x1ffd9e;}})[_0xc472('0x47')](function(_0x2a7e0c){throw new db[(_0xc472('0x60'))][(_0xc472('0x6c'))](_0x2a7e0c[_0xc472('0x61')]);});})[_0xc472('0x25')](handleEntityNotFound(_0x489081,null))[_0xc472('0x25')](respondWithStatusCode(_0x489081,0xcc))[_0xc472('0x47')](handleError(_0x489081,null));};exports[_0xc472('0x70')]=function(_0x683e1f,_0x4e0762,_0x3a1ca3){var _0x21370e={};var _0x1b8b6f={};var _0x1ebab7;var _0x87692a;return db[_0xc472('0x2e')][_0xc472('0x6e')]({'where':{'id':_0x683e1f[_0xc472('0x49')]['id']}})[_0xc472('0x25')](handleEntityNotFound(_0x4e0762,null))[_0xc472('0x25')](function(_0x23d732){if(_0x23d732){_0x1ebab7=_0x23d732;_0x1b8b6f[_0xc472('0x32')]=_[_0xc472('0x35')](db[_0xc472('0x63')]['rawAttributes']);_0x1b8b6f[_0xc472('0x34')]=_[_0xc472('0x35')](_0x683e1f['query']);_0x1b8b6f[_0xc472('0x36')]=_[_0xc472('0x37')](_0x1b8b6f[_0xc472('0x32')],_0x1b8b6f[_0xc472('0x34')]);_0x21370e[_0xc472('0x39')]=_['intersection'](_0x1b8b6f[_0xc472('0x32')],qs['fields'](_0x683e1f[_0xc472('0x34')][_0xc472('0x38')]));_0x21370e[_0xc472('0x39')]=_0x21370e[_0xc472('0x39')][_0xc472('0x3a')]?_0x21370e['attributes']:_0x1b8b6f[_0xc472('0x32')];_0x21370e[_0xc472('0x71')]=qs[_0xc472('0x3d')](_0x683e1f[_0xc472('0x34')][_0xc472('0x3d')]);_0x21370e[_0xc472('0x3e')]=qs[_0xc472('0x36')](_[_0xc472('0x3f')](_0x683e1f[_0xc472('0x34')],_0x1b8b6f[_0xc472('0x36')]));if(_0x683e1f['query'][_0xc472('0x40')]){_0x21370e['where']=_[_0xc472('0x41')](_0x21370e[_0xc472('0x3e')],{'$or':_[_0xc472('0x33')](_0x21370e['attributes'],function(_0x555f80){var _0x514fed={};_0x514fed[_0x555f80]={'$like':'%'+_0x683e1f[_0xc472('0x34')]['filter']+'%'};return _0x514fed;})});}_0x21370e=_['merge']({},_0x21370e,_0x683e1f[_0xc472('0x43')]);return _0x1ebab7['getSounds'](_0x21370e);}})['then'](function(_0x7f1e60){if(_0x7f1e60){_0x87692a=_0x7f1e60[_0xc472('0x3a')];if(!_0x683e1f['query'][_0xc472('0x3b')](_0xc472('0x3c'))){_0x21370e['limit']=qs[_0xc472('0x1e')](_0x683e1f[_0xc472('0x34')][_0xc472('0x1e')]);_0x21370e[_0xc472('0x1d')]=qs['offset'](_0x683e1f[_0xc472('0x34')][_0xc472('0x1d')]);}return _0x1ebab7[_0xc472('0x70')](_0x21370e);}})[_0xc472('0x25')](function(_0x5cce2f){if(_0x5cce2f){return _0x5cce2f?{'count':_0x87692a,'rows':_0x5cce2f}:null;}})[_0xc472('0x25')](respondWithResult(_0x4e0762,null))[_0xc472('0x47')](handleError(_0x4e0762,null));}; \ No newline at end of file +var _0x519c=['mode','files','directory','join','server/files/moh','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','unlinkSync','ValidationError','message','Sound','findOne','converted_format','createdAt','root','server/files/sounds/converted','%s.%s','basename','save_name','extname','format','removeSound','params','id2','Sequelize','pick','getSounds','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','options','find','body','create','transaction'];(function(_0x3f8f75,_0x2b066a){var _0x1104d3=function(_0x165246){while(--_0x165246){_0x3f8f75['push'](_0x3f8f75['shift']());}};_0x1104d3(++_0x2b066a);}(_0x519c,0x8f));var _0xc519=function(_0x19c339,_0xd98d2e){_0x19c339=_0x19c339-0x0;var _0x2b7bf3=_0x519c[_0x19c339];return _0x2b7bf3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc519('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc519('0x1'));var rp=require(_0xc519('0x2'));var moment=require(_0xc519('0x3'));var BPromise=require(_0xc519('0x4'));var Mustache=require('mustache');var util=require(_0xc519('0x5'));var path=require(_0xc519('0x6'));var sox=require(_0xc519('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc519('0x8'));var _=require('lodash');var squel=require(_0xc519('0x9'));var crypto=require('crypto');var jsforce=require(_0xc519('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc519('0xb'));var querystring=require(_0xc519('0xc'));var Papa=require('papaparse');var Redis=require(_0xc519('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc519('0xe'));var as=require(_0xc519('0xf'));var hardwareService=require(_0xc519('0x10'));var logger=require('../../config/logger')(_0xc519('0x11'));var utils=require(_0xc519('0x12'));var config=require(_0xc519('0x13'));var licenseUtil=require(_0xc519('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x153c31,_0xd0e3cb){_0xd0e3cb=_0xd0e3cb||0xcc;return function(_0x59f2dd){if(_0x59f2dd){return _0x153c31[_0xc519('0x15')](_0xd0e3cb);}return _0x153c31['status'](_0xd0e3cb)[_0xc519('0x16')]();};}function respondWithResult(_0x54583d,_0x5df07f){_0x5df07f=_0x5df07f||0xc8;return function(_0x51c430){if(_0x51c430){return _0x54583d[_0xc519('0x17')](_0x5df07f)[_0xc519('0x18')](_0x51c430);}};}function respondWithFilteredResult(_0x57c5b9,_0x4ca33d){return function(_0x43a88d){if(_0x43a88d){var _0x12167b=typeof _0x4ca33d[_0xc519('0x19')]===_0xc519('0x1a')&&typeof _0x4ca33d[_0xc519('0x1b')]===_0xc519('0x1a');var _0x5593ac=_0x43a88d[_0xc519('0x1c')];var _0x2d57dd=_0x12167b?0x0:_0x4ca33d[_0xc519('0x19')];var _0x19ca38=_0x12167b?_0x43a88d[_0xc519('0x1c')]:_0x4ca33d['offset']+_0x4ca33d['limit'];var _0xb3ce97;if(_0x19ca38>=_0x5593ac){_0x19ca38=_0x5593ac;_0xb3ce97=0xc8;}else{_0xb3ce97=0xce;}_0x57c5b9[_0xc519('0x17')](_0xb3ce97);return _0x57c5b9[_0xc519('0x1d')](_0xc519('0x1e'),_0x2d57dd+'-'+_0x19ca38+'/'+_0x5593ac)[_0xc519('0x18')](_0x43a88d);}return null;};}function patchUpdates(_0x3b0fa7){return function(_0x1d14c7){try{jsonpatch[_0xc519('0x1f')](_0x1d14c7,_0x3b0fa7,!![]);}catch(_0x610a0a){return BPromise[_0xc519('0x20')](_0x610a0a);}return _0x1d14c7[_0xc519('0x21')]();};}function saveUpdates(_0x1a83ae,_0x3944d1){return function(_0x4aaf05){if(_0x4aaf05){return _0x4aaf05[_0xc519('0x22')](_0x1a83ae)[_0xc519('0x23')](function(_0x140e32){return _0x140e32;});}return null;};}function removeEntity(_0x14a6a6,_0x4fb316){return function(_0x58700d){if(_0x58700d){return _0x58700d[_0xc519('0x24')]()['then'](function(){var _0x190403=_0x58700d[_0xc519('0x25')]({'plain':!![]});var _0x426c2=_0xc519('0x26');return db['UserProfileResource'][_0xc519('0x24')]({'where':{'type':_0x426c2,'resourceId':_0x190403['id']}})[_0xc519('0x23')](function(){return _0x58700d;});})[_0xc519('0x23')](function(){_0x14a6a6[_0xc519('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f097b,_0x5964b5){return function(_0x24550d){if(!_0x24550d){_0x2f097b[_0xc519('0x15')](0x194);}return _0x24550d;};}function handleError(_0x4c0f35,_0x363137){_0x363137=_0x363137||0x1f4;return function(_0x3ec57a){logger[_0xc519('0x27')](_0x3ec57a[_0xc519('0x28')]);if(_0x3ec57a[_0xc519('0x29')]){delete _0x3ec57a[_0xc519('0x29')];}_0x4c0f35[_0xc519('0x17')](_0x363137)[_0xc519('0x2a')](_0x3ec57a);};}exports[_0xc519('0x2b')]=function(_0x4fe6c2,_0x3dc05f){var _0x1dfc61={},_0x261c8e={},_0x16429d={'count':0x0,'rows':[]};var _0x596f6a=_[_0xc519('0x2c')](db[_0xc519('0x2d')][_0xc519('0x2e')],function(_0x45c842){return{'name':_0x45c842[_0xc519('0x2f')],'type':_0x45c842[_0xc519('0x30')][_0xc519('0x31')]};});_0x261c8e[_0xc519('0x32')]=_['map'](_0x596f6a,_0xc519('0x29'));_0x261c8e[_0xc519('0x33')]=_[_0xc519('0x34')](_0x4fe6c2[_0xc519('0x33')]);_0x261c8e[_0xc519('0x35')]=_[_0xc519('0x36')](_0x261c8e['model'],_0x261c8e[_0xc519('0x33')]);_0x1dfc61['attributes']=_[_0xc519('0x36')](_0x261c8e[_0xc519('0x32')],qs[_0xc519('0x37')](_0x4fe6c2[_0xc519('0x33')][_0xc519('0x37')]));_0x1dfc61[_0xc519('0x38')]=_0x1dfc61[_0xc519('0x38')][_0xc519('0x39')]?_0x1dfc61[_0xc519('0x38')]:_0x261c8e[_0xc519('0x32')];if(!_0x4fe6c2[_0xc519('0x33')]['hasOwnProperty']('nolimit')){_0x1dfc61[_0xc519('0x1b')]=qs[_0xc519('0x1b')](_0x4fe6c2[_0xc519('0x33')]['limit']);_0x1dfc61[_0xc519('0x19')]=qs[_0xc519('0x19')](_0x4fe6c2[_0xc519('0x33')][_0xc519('0x19')]);}_0x1dfc61[_0xc519('0x3a')]=qs[_0xc519('0x3b')](_0x4fe6c2[_0xc519('0x33')][_0xc519('0x3b')]);delete _0x4fe6c2[_0xc519('0x33')][_0xc519('0x3b')];_0x1dfc61[_0xc519('0x3c')]=qs['filters'](_['pick'](_0x4fe6c2[_0xc519('0x33')],_0x261c8e[_0xc519('0x35')]),_0x596f6a);if(_0x4fe6c2[_0xc519('0x33')][_0xc519('0x3d')]){_0x1dfc61[_0xc519('0x3c')]=_[_0xc519('0x3e')](_0x1dfc61[_0xc519('0x3c')],{'$or':_[_0xc519('0x2c')](_0x596f6a,function(_0x1033dd){if(_0x1033dd[_0xc519('0x30')]!==_0xc519('0x3f')){var _0x67c128={};_0x67c128[_0x1033dd[_0xc519('0x29')]]={'$like':'%'+_0x4fe6c2[_0xc519('0x33')][_0xc519('0x3d')]+'%'};return _0x67c128;}})});}_0x1dfc61=_[_0xc519('0x3e')]({},_0x1dfc61,_0x4fe6c2['options']);var _0x224d7a={'where':_0x1dfc61[_0xc519('0x3c')]};return db[_0xc519('0x2d')][_0xc519('0x1c')](_0x224d7a)['then'](function(_0x48283c){_0x16429d[_0xc519('0x1c')]=_0x48283c;if(_0x4fe6c2['query'][_0xc519('0x40')]){_0x1dfc61[_0xc519('0x41')]=[{'all':!![]}];}return db[_0xc519('0x2d')]['findAll'](_0x1dfc61);})[_0xc519('0x23')](function(_0x5461c5){_0x16429d[_0xc519('0x42')]=_0x5461c5;return _0x16429d;})[_0xc519('0x23')](respondWithFilteredResult(_0x3dc05f,_0x1dfc61))[_0xc519('0x43')](handleError(_0x3dc05f,null));};exports['show']=function(_0xb9bf1a,_0x21ed8e){var _0x3b04aa={'raw':![],'where':{'id':_0xb9bf1a['params']['id']}},_0x33f45d={};_0x33f45d[_0xc519('0x32')]=_['keys'](db[_0xc519('0x2d')][_0xc519('0x2e')]);_0x33f45d[_0xc519('0x33')]=_[_0xc519('0x34')](_0xb9bf1a[_0xc519('0x33')]);_0x33f45d['filters']=_['intersection'](_0x33f45d[_0xc519('0x32')],_0x33f45d[_0xc519('0x33')]);_0x3b04aa[_0xc519('0x38')]=_['intersection'](_0x33f45d['model'],qs[_0xc519('0x37')](_0xb9bf1a[_0xc519('0x33')][_0xc519('0x37')]));_0x3b04aa[_0xc519('0x38')]=_0x3b04aa[_0xc519('0x38')][_0xc519('0x39')]?_0x3b04aa['attributes']:_0x33f45d[_0xc519('0x32')];if(_0xb9bf1a[_0xc519('0x33')][_0xc519('0x40')]){_0x3b04aa['include']=[{'all':!![]}];}_0x3b04aa=_[_0xc519('0x3e')]({},_0x3b04aa,_0xb9bf1a[_0xc519('0x44')]);return db[_0xc519('0x2d')][_0xc519('0x45')](_0x3b04aa)[_0xc519('0x23')](handleEntityNotFound(_0x21ed8e,null))[_0xc519('0x23')](respondWithResult(_0x21ed8e,null))['catch'](handleError(_0x21ed8e,null));};exports[_0xc519('0x22')]=function(_0x3c82d7,_0x5c5b6d){if(_0x3c82d7[_0xc519('0x46')]['id']){delete _0x3c82d7[_0xc519('0x46')]['id'];}return db['VoiceMusicOnHold'][_0xc519('0x45')]({'where':{'id':_0x3c82d7['params']['id']}})['then'](handleEntityNotFound(_0x5c5b6d,null))[_0xc519('0x23')](saveUpdates(_0x3c82d7[_0xc519('0x46')],null))['then'](respondWithResult(_0x5c5b6d,null))[_0xc519('0x43')](handleError(_0x5c5b6d,null));};exports[_0xc519('0x47')]=function(_0x3a1625,_0x10b5f3,_0x6c9612){return db['sequelize'][_0xc519('0x48')](function(_0x4bb10e){if(_0x3a1625['body'][_0xc519('0x49')]===_0xc519('0x4a')){_0x3a1625[_0xc519('0x46')][_0xc519('0x4b')]=path[_0xc519('0x4c')](config['root'],_0xc519('0x4d'),_0x3a1625['body'][_0xc519('0x29')]);}return db[_0xc519('0x2d')][_0xc519('0x47')](_0x3a1625[_0xc519('0x46')],{'transaction':_0x4bb10e})[_0xc519('0x23')](function(_0x43824b){if(_0x3a1625[_0xc519('0x46')][_0xc519('0x49')]==='files'){fs[_0xc519('0x4e')](_0x43824b['directory'],parseInt('0777',0x8));}var _0x5de6b8=_0x3a1625[_0xc519('0x4f')]['get']({'plain':!![]});if(!_0x5de6b8)throw new Error(_0xc519('0x50'));if(_0x5de6b8[_0xc519('0x51')]==='user'){var _0x29ff7d=_0x43824b[_0xc519('0x25')]({'plain':!![]});return db['UserProfileSection'][_0xc519('0x45')]({'where':{'name':'MusicOnHolds','userProfileId':_0x5de6b8[_0xc519('0x52')]},'raw':!![]})['then'](function(_0x4d6708){if(_0x4d6708&&_0x4d6708['autoAssociation']===0x0){return db[_0xc519('0x53')]['create']({'name':_0x29ff7d[_0xc519('0x29')],'resourceId':_0x29ff7d['id'],'type':_0x4d6708[_0xc519('0x29')],'sectionId':_0x4d6708['id']},{})[_0xc519('0x23')](function(){return _0x43824b;});}else{return _0x43824b;}})[_0xc519('0x43')](function(_0x64c1f5){logger[_0xc519('0x27')](_0xc519('0x54'),_0x64c1f5);});}return _0x43824b;});})[_0xc519('0x23')](respondWithResult(_0x10b5f3,0xc9))[_0xc519('0x43')](handleError(_0x10b5f3,null));};exports['destroy']=function(_0x723607,_0x5e95de,_0x41e054){var _0x4eabc8;return db[_0xc519('0x2d')][_0xc519('0x45')]({'where':{'id':_0x723607['params']['id']}})['then'](function(_0x289eec){if(_0x289eec){return db[_0xc519('0x55')][_0xc519('0x48')](function(_0x386c75){return _0x289eec[_0xc519('0x24')]({'transaction':_0x386c75,'raw':!![]})[_0xc519('0x23')](function(_0x3e897a){if(_0x3e897a[_0xc519('0x4b')]){fs[_0xc519('0x56')](_0x3e897a[_0xc519('0x4b')])[_0xc519('0x57')](function(_0x1ab718){fs[_0xc519('0x58')](path['join'](_0x3e897a[_0xc519('0x4b')],_0x1ab718));});fs['rmdirSync'](_0x3e897a[_0xc519('0x4b')]);}return _0x3e897a;});})['catch'](function(_0x385ae5){throw new db['Sequelize'][(_0xc519('0x59'))](_0x385ae5[_0xc519('0x5a')]);});}})[_0xc519('0x23')](handleEntityNotFound(_0x5e95de,null))[_0xc519('0x23')](removeEntity(_0x5e95de,null))[_0xc519('0x43')](handleError(_0x5e95de,null));};exports['addSound']=function(_0x5c5c74,_0x5bd250,_0x15abbc){return db['sequelize']['transaction'](function(_0x30702d){var _0x3b4f69;return db['VoiceMusicOnHold'][_0xc519('0x45')]({'where':{'id':_0x5c5c74['params']['id']}})['then'](function(_0x190649){if(_0x190649){_0x3b4f69=_0x190649;return _0x190649['addSound'](_0x5c5c74[_0xc519('0x46')]['id'],{'transaction':_0x30702d});}})[_0xc519('0x23')](function(_0x32ea2f){if(_0x32ea2f){return db[_0xc519('0x5b')][_0xc519('0x5c')]({'where':{'id':_0x5c5c74[_0xc519('0x46')]['id']},'attributes':['id',_0xc519('0x29'),'save_name',_0xc519('0x5d'),_0xc519('0x5e')],'raw':!![]});}})['then'](function(_0xe98be8){if(_0xe98be8){var _0x1ee1dd=path[_0xc519('0x4c')](config[_0xc519('0x5f')],_0xc519('0x60'),util['format'](_0xc519('0x61'),path[_0xc519('0x62')](_0xe98be8[_0xc519('0x63')],path[_0xc519('0x64')](_0xe98be8[_0xc519('0x63')])),_0xe98be8['converted_format']));var _0x513989=path[_0xc519('0x4c')](config[_0xc519('0x5f')],'server/files/moh',_0x3b4f69['name'],util[_0xc519('0x65')](_0xc519('0x61'),_0xe98be8['name'],_0xe98be8[_0xc519('0x5d')]));fs['symlinkSync'](_0x1ee1dd,_0x513989);return _0xe98be8;}})[_0xc519('0x43')](function(_0x142e82){throw new db['Sequelize']['ValidationError'](_0x142e82[_0xc519('0x5a')]);});})['then'](handleEntityNotFound(_0x5bd250,null))[_0xc519('0x23')](respondWithResult(_0x5bd250,0xc9))['catch'](handleError(_0x5bd250,null));};exports[_0xc519('0x66')]=function(_0x1c0895,_0x1d0bca,_0x1a70f8){return db[_0xc519('0x55')][_0xc519('0x48')](function(_0xc8ff39){var _0xfbd1d9;return db[_0xc519('0x2d')][_0xc519('0x5c')]({'where':{'id':_0x1c0895[_0xc519('0x67')]['id']}})[_0xc519('0x23')](handleEntityNotFound(_0x1d0bca,null))[_0xc519('0x23')](function(_0x581046){if(_0x581046){_0xfbd1d9=_0x581046;return _0x581046['removeSound'](_0x1c0895[_0xc519('0x67')][_0xc519('0x68')]);}})[_0xc519('0x23')](function(_0x15bf5c){if(_0x15bf5c){return db['Sound'][_0xc519('0x5c')]({'where':{'id':_0x1c0895['params']['id2']},'attributes':['id','name',_0xc519('0x63'),_0xc519('0x5d'),_0xc519('0x5e')],'raw':!![]});}})[_0xc519('0x23')](function(_0x42c677){if(_0x42c677){fs['unlinkSync'](path['join'](_0xfbd1d9[_0xc519('0x4b')],util[_0xc519('0x65')]('%s.%s',_0x42c677[_0xc519('0x29')],_0x42c677['converted_format'])));return _0x42c677;}})[_0xc519('0x43')](function(_0x4b1e5a){throw new db[(_0xc519('0x69'))][(_0xc519('0x59'))](_0x4b1e5a[_0xc519('0x5a')]);});})[_0xc519('0x23')](handleEntityNotFound(_0x1d0bca,null))[_0xc519('0x23')](respondWithStatusCode(_0x1d0bca,0xcc))[_0xc519('0x43')](handleError(_0x1d0bca,null));};exports['getSounds']=function(_0x1ab615,_0x185787,_0x4134f9){var _0xe99e09={};var _0x232cd4={};var _0x14cb9d;var _0x3bd762;return db['VoiceMusicOnHold'][_0xc519('0x5c')]({'where':{'id':_0x1ab615[_0xc519('0x67')]['id']}})[_0xc519('0x23')](handleEntityNotFound(_0x185787,null))['then'](function(_0x1f85ce){if(_0x1f85ce){_0x14cb9d=_0x1f85ce;_0x232cd4['model']=_['keys'](db['Sound'][_0xc519('0x2e')]);_0x232cd4[_0xc519('0x33')]=_[_0xc519('0x34')](_0x1ab615[_0xc519('0x33')]);_0x232cd4[_0xc519('0x35')]=_[_0xc519('0x36')](_0x232cd4[_0xc519('0x32')],_0x232cd4[_0xc519('0x33')]);_0xe99e09['attributes']=_[_0xc519('0x36')](_0x232cd4['model'],qs['fields'](_0x1ab615[_0xc519('0x33')][_0xc519('0x37')]));_0xe99e09[_0xc519('0x38')]=_0xe99e09[_0xc519('0x38')][_0xc519('0x39')]?_0xe99e09[_0xc519('0x38')]:_0x232cd4[_0xc519('0x32')];_0xe99e09[_0xc519('0x3a')]=qs[_0xc519('0x3b')](_0x1ab615[_0xc519('0x33')][_0xc519('0x3b')]);_0xe99e09[_0xc519('0x3c')]=qs[_0xc519('0x35')](_[_0xc519('0x6a')](_0x1ab615[_0xc519('0x33')],_0x232cd4['filters']));if(_0x1ab615[_0xc519('0x33')][_0xc519('0x3d')]){_0xe99e09['where']=_['merge'](_0xe99e09['where'],{'$or':_[_0xc519('0x2c')](_0xe99e09[_0xc519('0x38')],function(_0x19eef7){var _0x1381b8={};_0x1381b8[_0x19eef7]={'$like':'%'+_0x1ab615[_0xc519('0x33')][_0xc519('0x3d')]+'%'};return _0x1381b8;})});}_0xe99e09=_[_0xc519('0x3e')]({},_0xe99e09,_0x1ab615[_0xc519('0x44')]);return _0x14cb9d[_0xc519('0x6b')](_0xe99e09);}})[_0xc519('0x23')](function(_0x1b5d95){if(_0x1b5d95){_0x3bd762=_0x1b5d95[_0xc519('0x39')];if(!_0x1ab615['query']['hasOwnProperty']('nolimit')){_0xe99e09[_0xc519('0x1b')]=qs[_0xc519('0x1b')](_0x1ab615[_0xc519('0x33')][_0xc519('0x1b')]);_0xe99e09['offset']=qs['offset'](_0x1ab615[_0xc519('0x33')][_0xc519('0x19')]);}return _0x14cb9d[_0xc519('0x6b')](_0xe99e09);}})['then'](function(_0x53d6d7){if(_0x53d6d7){return _0x53d6d7?{'count':_0x3bd762,'rows':_0x53d6d7}:null;}})['then'](respondWithResult(_0x185787,null))[_0xc519('0x43')](handleError(_0x185787,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 237e928..ab3a5da 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 _0xe05f=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x53d49e,_0x251520){var _0x1504e3=function(_0x1f90e7){while(--_0x1f90e7){_0x53d49e['push'](_0x53d49e['shift']());}};_0x1504e3(++_0x251520);}(_0xe05f,0xcc));var _0xfe05=function(_0x3ce4f8,_0x2628fc){_0x3ce4f8=_0x3ce4f8-0x0;var _0x427ba0=_0xe05f[_0x3ce4f8];return _0x427ba0;};'use strict';var _=require(_0xfe05('0x0'));var util=require(_0xfe05('0x1'));var logger=require(_0xfe05('0x2'))(_0xfe05('0x3'));var moment=require('moment');var BPromise=require(_0xfe05('0x4'));var rp=require(_0xfe05('0x5'));var fs=require('fs');var path=require(_0xfe05('0x6'));var rimraf=require(_0xfe05('0x7'));var config=require(_0xfe05('0x8'));var attributes=require(_0xfe05('0x9'));module[_0xfe05('0xa')]=function(_0x5a0202,_0x28e7d6){return _0x5a0202[_0xfe05('0xb')](_0xfe05('0xc'),attributes,{'tableName':_0xfe05('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x583e=['api','moment','request-promise','path','../../config/environment','define','voice_musiconhold','lodash','../../config/logger'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x583e,0xdf));var _0xe583=function(_0x3f4328,_0x389f8f){_0x3f4328=_0x3f4328-0x0;var _0x2df80a=_0x583e[_0x3f4328];return _0x2df80a;};'use strict';var _=require(_0xe583('0x0'));var util=require('util');var logger=require(_0xe583('0x1'))(_0xe583('0x2'));var moment=require(_0xe583('0x3'));var BPromise=require('bluebird');var rp=require(_0xe583('0x4'));var fs=require('fs');var path=require(_0xe583('0x5'));var rimraf=require('rimraf');var config=require(_0xe583('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x53a148,_0x39e54f){return _0x53a148[_0xe583('0x7')]('VoiceMusicOnHold',attributes,{'tableName':_0xe583('0x8'),'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 b86264e..a6ecaab 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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x43848e,_0x5f2da8){var _0x2cfbbb=function(_0x613c9d){while(--_0x613c9d){_0x43848e['push'](_0x43848e['shift']());}};_0x2cfbbb(++_0x5f2da8);}(_0xe706,0xa3));var _0x6e70=function(_0x578c1f,_0x5c52fc){_0x578c1f=_0x578c1f-0x0;var _0x39bef2=_0xe706[_0x578c1f];return _0x39bef2;};'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']('VoiceMusicOnHold,\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']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x939736,_0x4c1710){var _0x2b140a=function(_0x436d2a){while(--_0x436d2a){_0x939736['push'](_0x939736['shift']());}};_0x2b140a(++_0x4c1710);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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/voicePrefix/index.js b/server/api/voicePrefix/index.js index 00f2866..85c6b51 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 _0xc70b=['fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','getTeams','create','post','addAgents','/:id/teams','addTeams','put','update','delete','destroy','removeAgents','exports','multer','path','express','Router'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xc70b,0x13b));var _0xbc70=function(_0x549587,_0x58614d){_0x549587=_0x549587-0x0;var _0x2ebbad=_0xc70b[_0x549587];return _0x2ebbad;};'use strict';var multer=require(_0xbc70('0x0'));var util=require('util');var path=require(_0xbc70('0x1'));var timeout=require('connect-timeout');var express=require(_0xbc70('0x2'));var router=express[_0xbc70('0x3')]();var fs_extra=require(_0xbc70('0x4'));var auth=require(_0xbc70('0x5'));var interaction=require(_0xbc70('0x6'));var config=require('../../config/environment');var controller=require(_0xbc70('0x7'));router[_0xbc70('0x8')]('/',auth[_0xbc70('0x9')](),controller[_0xbc70('0xa')]);router[_0xbc70('0x8')](_0xbc70('0xb'),auth[_0xbc70('0x9')](),controller[_0xbc70('0xc')]);router[_0xbc70('0x8')](_0xbc70('0xd'),auth['isAuthenticated'](),controller[_0xbc70('0xe')]);router[_0xbc70('0x8')](_0xbc70('0xf'),auth[_0xbc70('0x9')](),controller[_0xbc70('0x10')]);router[_0xbc70('0x8')]('/:id/teams',auth[_0xbc70('0x9')](),controller[_0xbc70('0x11')]);router['post']('/',auth[_0xbc70('0x9')](),controller[_0xbc70('0x12')]);router[_0xbc70('0x13')](_0xbc70('0xf'),auth[_0xbc70('0x9')](),controller[_0xbc70('0x14')]);router[_0xbc70('0x13')](_0xbc70('0x15'),auth[_0xbc70('0x9')](),controller[_0xbc70('0x16')]);router[_0xbc70('0x17')]('/:id',auth[_0xbc70('0x9')](),controller[_0xbc70('0x18')]);router[_0xbc70('0x19')]('/:id',auth[_0xbc70('0x9')](),controller[_0xbc70('0x1a')]);router['delete'](_0xbc70('0xf'),auth[_0xbc70('0x9')](),controller[_0xbc70('0x1b')]);router[_0xbc70('0x19')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);module[_0xbc70('0x1c')]=router; \ No newline at end of file +var _0x2029=['addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','create'];(function(_0x23d957,_0x5d2176){var _0x568ff2=function(_0x6ad689){while(--_0x6ad689){_0x23d957['push'](_0x23d957['shift']());}};_0x568ff2(++_0x5d2176);}(_0x2029,0x171));var _0x9202=function(_0x57eef6,_0x5551ef){_0x57eef6=_0x57eef6-0x0;var _0x4bc946=_0x2029[_0x57eef6];return _0x4bc946;};'use strict';var multer=require(_0x9202('0x0'));var util=require(_0x9202('0x1'));var path=require('path');var timeout=require(_0x9202('0x2'));var express=require(_0x9202('0x3'));var router=express[_0x9202('0x4')]();var fs_extra=require(_0x9202('0x5'));var auth=require(_0x9202('0x6'));var interaction=require(_0x9202('0x7'));var config=require(_0x9202('0x8'));var controller=require(_0x9202('0x9'));router[_0x9202('0xa')]('/',auth[_0x9202('0xb')](),controller[_0x9202('0xc')]);router[_0x9202('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x9202('0xd')]);router['get'](_0x9202('0xe'),auth[_0x9202('0xb')](),controller['show']);router[_0x9202('0xa')](_0x9202('0xf'),auth[_0x9202('0xb')](),controller[_0x9202('0x10')]);router[_0x9202('0xa')](_0x9202('0x11'),auth[_0x9202('0xb')](),controller[_0x9202('0x12')]);router[_0x9202('0x13')]('/',auth[_0x9202('0xb')](),controller[_0x9202('0x14')]);router[_0x9202('0x13')](_0x9202('0xf'),auth[_0x9202('0xb')](),controller[_0x9202('0x15')]);router[_0x9202('0x13')](_0x9202('0x11'),auth['isAuthenticated'](),controller[_0x9202('0x16')]);router[_0x9202('0x17')](_0x9202('0xe'),auth[_0x9202('0xb')](),controller[_0x9202('0x18')]);router[_0x9202('0x19')](_0x9202('0xe'),auth[_0x9202('0xb')](),controller[_0x9202('0x1a')]);router[_0x9202('0x19')]('/:id/users',auth[_0x9202('0xb')](),controller[_0x9202('0x1b')]);router[_0x9202('0x19')](_0x9202('0x11'),auth[_0x9202('0xb')](),controller[_0x9202('0x1c')]);module[_0x9202('0x1d')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 58c6831..168f4f7 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 _0xc8ec=['VIRTUAL','system-','getDataValue','sequelize','exports','STRING','name'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0xc8ec,0x1e6));var _0xcc8e=function(_0x1d4637,_0x28bc0d){_0x1d4637=_0x1d4637-0x0;var _0x246611=_0xc8ec[_0x1d4637];return _0x246611;};'use strict';var Sequelize=require(_0xcc8e('0x0'));module[_0xcc8e('0x1')]={'name':{'type':Sequelize[_0xcc8e('0x2')],'allowNull':![],'unique':_0xcc8e('0x3')},'prefix':{'type':Sequelize[_0xcc8e('0x4')],'get':function(_0x37c0c7){return _0xcc8e('0x5')+this[_0xcc8e('0x6')](_0xcc8e('0x3'))+'-';}},'description':{'type':Sequelize[_0xcc8e('0x2')]},'callerIdAll':{'type':Sequelize[_0xcc8e('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7886=['exports','STRING','name','VIRTUAL','INTEGER'];(function(_0x2f4fbe,_0x238fc2){var _0x5f0a7e=function(_0x13b94a){while(--_0x13b94a){_0x2f4fbe['push'](_0x2f4fbe['shift']());}};_0x5f0a7e(++_0x238fc2);}(_0x7886,0x1a9));var _0x6788=function(_0x5cc3d4,_0xbcbf9b){_0x5cc3d4=_0x5cc3d4-0x0;var _0x17ca31=_0x7886[_0x5cc3d4];return _0x17ca31;};'use strict';var Sequelize=require('sequelize');module[_0x6788('0x0')]={'name':{'type':Sequelize[_0x6788('0x1')],'allowNull':![],'unique':_0x6788('0x2')},'prefix':{'type':Sequelize[_0x6788('0x3')],'get':function(_0x3cc2b4){return'system-'+this['getDataValue'](_0x6788('0x2'))+'-';}},'description':{'type':Sequelize[_0x6788('0x1')]},'callerIdAll':{'type':Sequelize[_0x6788('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x6788('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5ff64bd..1f909c5 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 _0x63a5=['merge','VIRTUAL','options','includeAll','include','VoicePrefix','findAll','rows','catch','show','params','rawAttributes','keys','find','describe','create','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','context','from-sip','exten','app','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','charAt','system-','transaction','findById','addAgents','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','tq.TeamId','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','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/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter'];(function(_0x55ecaf,_0x32745f){var _0x38dbbb=function(_0x5b2275){while(--_0x5b2275){_0x55ecaf['push'](_0x55ecaf['shift']());}};_0x38dbbb(++_0x32745f);}(_0x63a5,0x18e));var _0x563a=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x63a5[_0xef8146];return _0x5a6cb0;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];config[_0x563a('0x19')]=_[_0x563a('0x1a')](config[_0x563a('0x19')],{'host':_0x563a('0x1b'),'port':0x18eb});var socket=require(_0x563a('0x1c'))(new Redis(config[_0x563a('0x19')]));require('./voicePrefix.socket')[_0x563a('0x1d')](socket);function respondWithStatusCode(_0x3045ac,_0x8c3727){_0x8c3727=_0x8c3727||0xcc;return function(_0x26987f){if(_0x26987f){return _0x3045ac['sendStatus'](_0x8c3727);}return _0x3045ac['status'](_0x8c3727)[_0x563a('0x1e')]();};}function respondWithResult(_0x2ad667,_0x5b291f){_0x5b291f=_0x5b291f||0xc8;return function(_0x2ade24){if(_0x2ade24){return _0x2ad667[_0x563a('0x1f')](_0x5b291f)[_0x563a('0x20')](_0x2ade24);}};}function respondWithFilteredResult(_0x9c2f77,_0x4f947d){return function(_0x598693){if(_0x598693){var _0xe3d2bd=typeof _0x4f947d[_0x563a('0x21')]===_0x563a('0x22')&&typeof _0x4f947d['limit']==='undefined';var _0x52b99a=_0x598693['count'];var _0x40916a=_0xe3d2bd?0x0:_0x4f947d[_0x563a('0x21')];var _0x26061f=_0xe3d2bd?_0x598693[_0x563a('0x23')]:_0x4f947d['offset']+_0x4f947d['limit'];var _0x3930f0;if(_0x26061f>=_0x52b99a){_0x26061f=_0x52b99a;_0x3930f0=0xc8;}else{_0x3930f0=0xce;}_0x9c2f77[_0x563a('0x1f')](_0x3930f0);return _0x9c2f77[_0x563a('0x24')](_0x563a('0x25'),_0x40916a+'-'+_0x26061f+'/'+_0x52b99a)[_0x563a('0x20')](_0x598693);}return null;};}function patchUpdates(_0x2dc7e2){return function(_0x44b460){try{jsonpatch[_0x563a('0x26')](_0x44b460,_0x2dc7e2,!![]);}catch(_0x506491){return BPromise[_0x563a('0x27')](_0x506491);}return _0x44b460['save']();};}function saveUpdates(_0x44e2c1,_0xd3e0ae){return function(_0x3a36a4){if(_0x3a36a4){return _0x3a36a4[_0x563a('0x28')](_0x44e2c1)[_0x563a('0x29')](function(_0x1682ee){return _0x1682ee;});}return null;};}function removeEntity(_0x3642b3,_0x173990){return function(_0x4de4c3){if(_0x4de4c3){return _0x4de4c3[_0x563a('0x2a')]()[_0x563a('0x29')](function(){var _0x2311f2=_0x4de4c3[_0x563a('0x2b')]({'plain':!![]});var _0xce8165=_0x563a('0x2c');return db[_0x563a('0x2d')][_0x563a('0x2a')]({'where':{'type':_0xce8165,'resourceId':_0x2311f2['id']}})[_0x563a('0x29')](function(){return _0x4de4c3;});})[_0x563a('0x29')](function(){_0x3642b3[_0x563a('0x1f')](0xcc)[_0x563a('0x1e')]();});}};}function handleEntityNotFound(_0x1bdfb0,_0x7696c2){return function(_0x579cb5){if(!_0x579cb5){_0x1bdfb0[_0x563a('0x2e')](0x194);}return _0x579cb5;};}function handleError(_0x3c16d0,_0x2257e1){_0x2257e1=_0x2257e1||0x1f4;return function(_0x4aaa3d){logger[_0x563a('0x2f')](_0x4aaa3d[_0x563a('0x30')]);if(_0x4aaa3d[_0x563a('0x31')]){delete _0x4aaa3d[_0x563a('0x31')];}_0x3c16d0[_0x563a('0x1f')](_0x2257e1)[_0x563a('0x32')](_0x4aaa3d);};}exports[_0x563a('0x33')]=function(_0x4a2d28,_0x2418ae){var _0x24ec9d={},_0x4259f6={},_0x2ea6c2={'count':0x0,'rows':[]};var _0x1a77b8=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x4e5c46){return{'name':_0x4e5c46[_0x563a('0x34')],'type':_0x4e5c46[_0x563a('0x35')][_0x563a('0x36')]};});_0x4259f6[_0x563a('0x37')]=_[_0x563a('0x38')](_0x1a77b8,_0x563a('0x31'));_0x4259f6['query']=_['keys'](_0x4a2d28[_0x563a('0x39')]);_0x4259f6[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x4259f6[_0x563a('0x37')],_0x4259f6[_0x563a('0x39')]);_0x24ec9d[_0x563a('0x3c')]=_[_0x563a('0x3b')](_0x4259f6[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x4a2d28[_0x563a('0x39')][_0x563a('0x3d')]));_0x24ec9d[_0x563a('0x3c')]=_0x24ec9d[_0x563a('0x3c')][_0x563a('0x3e')]?_0x24ec9d[_0x563a('0x3c')]:_0x4259f6[_0x563a('0x37')];if(!_0x4a2d28['query'][_0x563a('0x3f')](_0x563a('0x40'))){_0x24ec9d[_0x563a('0x41')]=qs['limit'](_0x4a2d28[_0x563a('0x39')]['limit']);_0x24ec9d[_0x563a('0x21')]=qs[_0x563a('0x21')](_0x4a2d28['query']['offset']);}_0x24ec9d[_0x563a('0x42')]=qs['sort'](_0x4a2d28[_0x563a('0x39')][_0x563a('0x43')]);_0x24ec9d[_0x563a('0x44')]=qs[_0x563a('0x3a')](_['pick'](_0x4a2d28['query'],_0x4259f6[_0x563a('0x3a')]),_0x1a77b8);if(_0x4a2d28['query'][_0x563a('0x45')]){_0x24ec9d[_0x563a('0x44')]=_[_0x563a('0x46')](_0x24ec9d[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x1a77b8,function(_0x38fab5){if(_0x38fab5[_0x563a('0x35')]!==_0x563a('0x47')){var _0x4c71df={};_0x4c71df[_0x38fab5[_0x563a('0x31')]]={'$like':'%'+_0x4a2d28['query'][_0x563a('0x45')]+'%'};return _0x4c71df;}})});}_0x24ec9d=_[_0x563a('0x46')]({},_0x24ec9d,_0x4a2d28[_0x563a('0x48')]);var _0x2d3800={'where':_0x24ec9d['where']};return db['VoicePrefix']['count'](_0x2d3800)[_0x563a('0x29')](function(_0x1255da){_0x2ea6c2[_0x563a('0x23')]=_0x1255da;if(_0x4a2d28[_0x563a('0x39')][_0x563a('0x49')]){_0x24ec9d[_0x563a('0x4a')]=[{'all':!![]}];}return db[_0x563a('0x4b')][_0x563a('0x4c')](_0x24ec9d);})[_0x563a('0x29')](function(_0x433353){_0x2ea6c2[_0x563a('0x4d')]=_0x433353;return _0x2ea6c2;})[_0x563a('0x29')](respondWithFilteredResult(_0x2418ae,_0x24ec9d))[_0x563a('0x4e')](handleError(_0x2418ae,null));};exports[_0x563a('0x4f')]=function(_0x144e15,_0x456d27){var _0x4643c4={'raw':![],'where':{'id':_0x144e15[_0x563a('0x50')]['id']}},_0x21bafb={};_0x21bafb['model']=_['keys'](db[_0x563a('0x4b')][_0x563a('0x51')]);_0x21bafb[_0x563a('0x39')]=_[_0x563a('0x52')](_0x144e15[_0x563a('0x39')]);_0x21bafb[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x21bafb[_0x563a('0x37')],_0x21bafb['query']);_0x4643c4['attributes']=_[_0x563a('0x3b')](_0x21bafb[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x144e15[_0x563a('0x39')][_0x563a('0x3d')]));_0x4643c4[_0x563a('0x3c')]=_0x4643c4[_0x563a('0x3c')][_0x563a('0x3e')]?_0x4643c4['attributes']:_0x21bafb[_0x563a('0x37')];if(_0x144e15[_0x563a('0x39')]['includeAll']){_0x4643c4[_0x563a('0x4a')]=[{'all':!![]}];}_0x4643c4=_['merge']({},_0x4643c4,_0x144e15[_0x563a('0x48')]);return db[_0x563a('0x4b')][_0x563a('0x53')](_0x4643c4)['then'](handleEntityNotFound(_0x456d27,null))[_0x563a('0x29')](respondWithResult(_0x456d27,null))[_0x563a('0x4e')](handleError(_0x456d27,null));};exports[_0x563a('0x2a')]=function(_0x39c104,_0x6fe8a9){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x39c104[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x6fe8a9,null))[_0x563a('0x29')](removeEntity(_0x6fe8a9,null))[_0x563a('0x4e')](handleError(_0x6fe8a9,null));};exports[_0x563a('0x54')]=function(_0x406d4a,_0x497469){return db['VoicePrefix'][_0x563a('0x54')]()[_0x563a('0x29')](respondWithResult(_0x497469,null))[_0x563a('0x4e')](handleError(_0x497469,null));};exports['create']=function(_0x5ae08f,_0x13530f){var _0x1fc4d2;return db['sequelize']['transaction'](function(_0x51e142){return db[_0x563a('0x4b')][_0x563a('0x55')](_0x5ae08f[_0x563a('0x56')],{'transaction':_0x51e142})[_0x563a('0x29')](function(_0x8d3997){_0x1fc4d2=_0x8d3997[_0x563a('0x2b')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x1fc4d2[_0x563a('0x57')]},'raw':!![]})['then'](function(_0x4453b2){return createVoicePrefixExtensions(_0x1fc4d2,_0x4453b2,_0x51e142);});});})[_0x563a('0x29')](function(){var _0x3e993e=_0x5ae08f[_0x563a('0x58')][_0x563a('0x2b')]({'plain':!![]});if(!_0x3e993e)throw new Error(_0x563a('0x59'));if(_0x3e993e[_0x563a('0x5a')]==='user'){var _0x22cc91=_0x1fc4d2;return db[_0x563a('0x5b')]['find']({'where':{'name':_0x563a('0x2c'),'userProfileId':_0x3e993e[_0x563a('0x5c')]},'raw':!![]})[_0x563a('0x29')](function(_0x2afa8c){if(_0x2afa8c&&_0x2afa8c[_0x563a('0x5d')]===0x0){return db[_0x563a('0x2d')][_0x563a('0x55')]({'name':_0x22cc91[_0x563a('0x31')],'resourceId':_0x22cc91['id'],'type':_0x2afa8c[_0x563a('0x31')],'sectionId':_0x2afa8c['id']},{})[_0x563a('0x29')](function(){return _0x1fc4d2;});}else{return _0x1fc4d2;}})['catch'](function(_0x1926f1){logger[_0x563a('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1926f1);throw _0x1926f1;});}return _0x1fc4d2;})['then'](respondWithResult(_0x13530f,null))[_0x563a('0x4e')](handleError(_0x13530f,null));};function Extension(_0x709bfd,_0x579d61,_0x19edc3,_0x59e371){this[_0x563a('0x5e')]=_0x563a('0x5f');this[_0x563a('0x60')]=_0x709bfd;this[_0x563a('0x61')]=_0x19edc3;this[_0x563a('0x35')]='system';this['description']='Voice\x20Prefix\x20Extension';this['priority']=_0x579d61;this[_0x563a('0x62')]=_0x59e371;}function createVoicePrefixExtensions(_0x5141d5,_0x111444,_0x496b6a){return new BPromise(function(_0x2a82cf,_0x3f2750){var _0xbe3343=new Extension(formatPrefixName(_0x5141d5[_0x563a('0x63')]),0x1,_0x563a('0x64'),'Voice\x20Prefix');_0xbe3343[_0x563a('0x65')]=_0x5141d5['id'];return db['VoiceExtension']['create'](_0xbe3343,{'transaction':_0x496b6a})[_0x563a('0x29')](function(_0x3b7993){var _0x409f3c=_0x3b7993[_0x563a('0x2b')]({'plain':!![]});var _0x1c8ad7=_['map'](addVoicePrefixExtensions(_0x5141d5,_0x111444),function(_0x10eb03){_0x10eb03[_0x563a('0x57')]=_0x409f3c['id'];_0x10eb03[_0x563a('0x65')]=_0x5141d5['id'];return _0x10eb03;});return db[_0x563a('0x66')][_0x563a('0x67')](_0x1c8ad7,{'transaction':_0x496b6a})['then'](function(_0xac578c){if(!_0xac578c){return _0x3f2750('Extensions\x20creation\x20failed');}else{return _0x2a82cf(_0xac578c);}})[_0x563a('0x4e')](function(_0x201c9d){return _0x3f2750(_0x201c9d);});});;});};function addVoicePrefixExtensions(_0x47d6cd,_0x34dd59){var _0x30bf2b=[];var _0x18a26b=formatPrefixName(_0x47d6cd[_0x563a('0x63')]);_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x2,_0x563a('0x69'),_0x563a('0x6a')+_0x47d6cd[_0x563a('0x31')]));if(_0x47d6cd['callerIdAll']){_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x3,_0x563a('0x69'),_0x563a('0x6b')+_0x47d6cd[_0x563a('0x6c')]));}else{_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x3,_0x563a('0x64'),_0x563a('0x6d')));}_0x30bf2b['push'](new Extension(_0x18a26b,0x4,_0x563a('0x6e'),_0x34dd59['context']+','+'${EXTEN:'+(0x8+_0x47d6cd['name'][_0x563a('0x3e')])+'}'+','+0x1));return _0x30bf2b;}function formatPrefixName(_0x4e4e60){var _0x529587='_';for(var _0x30d775=0x0;_0x30d775<_0x4e4e60[_0x563a('0x3e')];_0x30d775++){if(_0x4e4e60[_0x563a('0x6f')](_0x30d775)=='-'){_0x529587+=_0x4e4e60[_0x563a('0x6f')](_0x30d775);}else{_0x529587+='['+_0x4e4e60[_0x563a('0x6f')](_0x30d775)+']';}}_0x529587+='.';return _0x529587;}exports['update']=function(_0x4814b3,_0x4c9ad7,_0x39b8f8){var _0x8b2e10=_0x4814b3[_0x563a('0x56')];_0x8b2e10[_0x563a('0x63')]=_0x563a('0x70')+_0x8b2e10[_0x563a('0x31')]+'-';return db['sequelize'][_0x563a('0x71')](function(_0x43b2f1){return db['VoicePrefix'][_0x563a('0x28')](_0x8b2e10,{'where':{'id':_0x8b2e10['id']},'transaction':_0x43b2f1})[_0x563a('0x29')](function(){return db[_0x563a('0x66')]['destroy']({'where':{'VoicePrefixId':_0x8b2e10['id']},'transaction':_0x43b2f1})[_0x563a('0x29')](function(){return db[_0x563a('0x66')][_0x563a('0x53')]({'where':{'id':_0x8b2e10[_0x563a('0x57')]},'raw':!![]})['then'](function(_0x229690){return createVoicePrefixExtensions(_0x8b2e10,_0x229690,_0x43b2f1);});});});})[_0x563a('0x29')](function(){return db[_0x563a('0x4b')][_0x563a('0x72')](_0x8b2e10['id']);})[_0x563a('0x29')](respondWithResult(_0x4c9ad7,null))['catch'](handleError(_0x4c9ad7,null));};exports['addAgents']=function(_0x4346fe,_0x598a91,_0x46beba){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x4346fe[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x598a91,null))[_0x563a('0x29')](function(_0x3f66be){if(_0x3f66be){return _0x3f66be[_0x563a('0x73')](_0x4346fe[_0x563a('0x56')][_0x563a('0x74')],_['omit'](_0x4346fe[_0x563a('0x56')],['ids','id'])||{})[_0x563a('0x75')](function(_0x441933){for(var _0x54c512=0x0;_0x54c512<_0x4346fe[_0x563a('0x56')]['ids'][_0x563a('0x3e')];_0x54c512+=0x1){socket[_0x563a('0x76')]('userVoicePrefix:save',{'UserId':Number(_0x4346fe[_0x563a('0x56')][_0x563a('0x74')][_0x54c512]),'VoicePrefixId':Number(_0x4346fe[_0x563a('0x50')]['id'])});}return _0x441933;});}})[_0x563a('0x29')](respondWithResult(_0x598a91,null))['catch'](handleError(_0x598a91,null));};exports[_0x563a('0x77')]=function(_0x31faef,_0x17000b,_0x3cdfc1){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x31faef[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x17000b,null))[_0x563a('0x29')](function(_0x238ae4){if(_0x238ae4){return _0x238ae4['removeAgents'](_0x31faef[_0x563a('0x39')][_0x563a('0x74')])[_0x563a('0x29')](function(){if(_['isArray'](_0x31faef[_0x563a('0x39')][_0x563a('0x74')])){for(var _0x3dc800=0x0;_0x3dc800<_0x31faef[_0x563a('0x39')][_0x563a('0x74')][_0x563a('0x3e')];_0x3dc800+=0x1){socket[_0x563a('0x76')](_0x563a('0x78'),{'UserId':Number(_0x31faef[_0x563a('0x39')][_0x563a('0x74')][_0x3dc800]),'VoicePrefixId':Number(_0x31faef[_0x563a('0x50')]['id'])});}}else{socket[_0x563a('0x76')](_0x563a('0x78'),{'UserId':Number(_0x31faef['query'][_0x563a('0x74')]),'VoicePrefixId':Number(_0x31faef[_0x563a('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x17000b,null))[_0x563a('0x4e')](handleError(_0x17000b,null));};exports[_0x563a('0x79')]=function(_0x1ecca5,_0x162ab6,_0xf3ed04){var _0x44cbb4={};var _0x3a00b8={};var _0x9b753b;var _0x41898f;return db['VoicePrefix'][_0x563a('0x7a')]({'where':{'id':_0x1ecca5[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x162ab6,null))[_0x563a('0x29')](function(_0x4c5547){if(_0x4c5547){_0x9b753b=_0x4c5547;_0x3a00b8['model']=_['keys'](db[_0x563a('0x7b')][_0x563a('0x51')]);_0x3a00b8[_0x563a('0x39')]=_[_0x563a('0x52')](_0x1ecca5[_0x563a('0x39')]);_0x3a00b8[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x3a00b8[_0x563a('0x37')],_0x3a00b8[_0x563a('0x39')]);_0x44cbb4[_0x563a('0x3c')]=_['intersection'](_0x3a00b8[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x3d')]));_0x44cbb4[_0x563a('0x3c')]=_0x44cbb4[_0x563a('0x3c')][_0x563a('0x3e')]?_0x44cbb4[_0x563a('0x3c')]:_0x3a00b8[_0x563a('0x37')];_0x44cbb4[_0x563a('0x42')]=qs[_0x563a('0x43')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x43')]);_0x44cbb4['where']=qs[_0x563a('0x3a')](_[_0x563a('0x7c')](_0x1ecca5[_0x563a('0x39')],_0x3a00b8[_0x563a('0x3a')]));if(_0x1ecca5[_0x563a('0x39')][_0x563a('0x45')]){_0x44cbb4[_0x563a('0x44')]=_['merge'](_0x44cbb4[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x44cbb4[_0x563a('0x3c')],function(_0x562120){var _0x1e3b8c={};_0x1e3b8c[_0x562120]={'$like':'%'+_0x1ecca5[_0x563a('0x39')][_0x563a('0x45')]+'%'};return _0x1e3b8c;})});}_0x44cbb4=_[_0x563a('0x46')]({},_0x44cbb4,_0x1ecca5[_0x563a('0x48')]);return _0x9b753b[_0x563a('0x79')](_0x44cbb4);}})['then'](function(_0x2d46f5){if(_0x2d46f5){_0x41898f=_0x2d46f5[_0x563a('0x3e')];if(!_0x1ecca5[_0x563a('0x39')][_0x563a('0x3f')](_0x563a('0x40'))){_0x44cbb4['limit']=qs[_0x563a('0x41')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x41')]);_0x44cbb4[_0x563a('0x21')]=qs['offset'](_0x1ecca5[_0x563a('0x39')][_0x563a('0x21')]);}return _0x9b753b['getAgents'](_0x44cbb4);}})['then'](function(_0x458a21){if(_0x458a21){return _0x458a21?{'count':_0x41898f,'rows':_0x458a21}:null;}})[_0x563a('0x29')](respondWithResult(_0x162ab6,null))[_0x563a('0x4e')](handleError(_0x162ab6,null));};exports[_0x563a('0x7d')]=function(_0x241361,_0x31a58e,_0x1e324a){var _0x38857b={};var _0x43b6a2={};var _0x2385eb;var _0x36fe22;return db['VoicePrefix'][_0x563a('0x7a')]({'where':{'id':_0x241361[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x31a58e,null))['then'](function(_0x1dc77d){if(_0x1dc77d){_0x2385eb=_0x1dc77d;_0x43b6a2[_0x563a('0x37')]=_['keys'](db[_0x563a('0x7e')][_0x563a('0x51')]);_0x43b6a2[_0x563a('0x39')]=_[_0x563a('0x52')](_0x241361[_0x563a('0x39')]);_0x43b6a2[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x43b6a2[_0x563a('0x37')],_0x43b6a2['query']);_0x38857b[_0x563a('0x3c')]=_[_0x563a('0x3b')](_0x43b6a2[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x241361[_0x563a('0x39')]['fields']));_0x38857b[_0x563a('0x3c')]=_0x38857b['attributes']['length']?_0x38857b[_0x563a('0x3c')]:_0x43b6a2[_0x563a('0x37')];_0x38857b[_0x563a('0x42')]=qs[_0x563a('0x43')](_0x241361['query'][_0x563a('0x43')]);_0x38857b[_0x563a('0x44')]=qs['filters'](_[_0x563a('0x7c')](_0x241361['query'],_0x43b6a2[_0x563a('0x3a')]));if(_0x241361[_0x563a('0x39')][_0x563a('0x45')]){_0x38857b[_0x563a('0x44')]=_[_0x563a('0x46')](_0x38857b[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x38857b[_0x563a('0x3c')],function(_0x372e43){var _0x484953={};_0x484953[_0x372e43]={'$like':'%'+_0x241361[_0x563a('0x39')]['filter']+'%'};return _0x484953;})});}_0x38857b=_['merge']({},_0x38857b,_0x241361[_0x563a('0x48')]);return _0x2385eb[_0x563a('0x7d')](_0x38857b);}})['then'](function(_0x44859c){if(_0x44859c){_0x36fe22=_0x44859c[_0x563a('0x3e')];if(!_0x241361[_0x563a('0x39')][_0x563a('0x3f')](_0x563a('0x40'))){_0x38857b[_0x563a('0x41')]=qs[_0x563a('0x41')](_0x241361[_0x563a('0x39')]['limit']);_0x38857b[_0x563a('0x21')]=qs[_0x563a('0x21')](_0x241361['query'][_0x563a('0x21')]);}return _0x2385eb[_0x563a('0x7d')](_0x38857b);}})['then'](function(_0x38601a){if(_0x38601a){return _0x38601a?{'count':_0x36fe22,'rows':_0x38601a}:null;}})[_0x563a('0x29')](respondWithResult(_0x31a58e,null))[_0x563a('0x4e')](handleError(_0x31a58e,null));};exports['addTeams']=function(_0x10c81e,_0x4928de,_0x95bb77){var _0x33d74b=_0x10c81e[_0x563a('0x56')]['ids'];var _0x2d9810;return db['Team'][_0x563a('0x4c')]({'where':{'id':_0x33d74b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x563a('0x7f'),'attributes':['id',_0x563a('0x31'),_0x563a('0x80'),_0x563a('0x81'),_0x563a('0x82')],'raw':!![]}]})[_0x563a('0x29')](function(_0x2d2cb9){if(_0x2d2cb9){_0x2d9810=_0x2d2cb9;var _0x2c4b52=_[_0x563a('0x83')](_0x2d2cb9,function(_0x5c8df5){var _0x579601=_0x5c8df5[_0x563a('0x2b')]({'plain':!![]});return _0x579601[_0x563a('0x7f')];});return db['VoicePrefix'][_0x563a('0x53')]({'where':{'id':_0x10c81e[_0x563a('0x50')]['id']}})[_0x563a('0x29')](function(_0x1ebdd0){return db[_0x563a('0x84')][_0x563a('0x71')](function(_0x2a3bdd){return _0x1ebdd0['addTeams'](_0x33d74b,{'transaction':_0x2a3bdd})[_0x563a('0x29')](function(){return BPromise[_0x563a('0x85')](_0x2d9810,function(_0x28bbe5){return db[_0x563a('0x86')]['upsert']({'TeamId':_0x28bbe5['id'],'VoicePrefixId':_0x10c81e[_0x563a('0x50')]['id']},{'transaction':_0x2a3bdd});});})[_0x563a('0x29')](function(){return BPromise[_0x563a('0x85')](_0x2c4b52,function(_0x150fd6){return db[_0x563a('0x87')][_0x563a('0x88')]({'where':{'UserId':_0x150fd6['id'],'VoicePrefixId':_0x10c81e[_0x563a('0x50')]['id']},'transaction':_0x2a3bdd});});})[_0x563a('0x29')](function(){_0x2c4b52[_0x563a('0x89')](function(_0x3f78b7){socket[_0x563a('0x76')](_0x563a('0x8a'),{'UserId':_0x3f78b7['id'],'VoicePrefixId':_0x1ebdd0['id']});});});});});}})[_0x563a('0x29')](respondWithStatusCode(_0x4928de,null))[_0x563a('0x4e')](handleError(_0x4928de,null));};exports[_0x563a('0x8b')]=function(_0x115188,_0x713637,_0x12bb1b){return db[_0x563a('0x7e')][_0x563a('0x4c')]({'where':{'id':_0x115188[_0x563a('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x563a('0x7b')],'as':_0x563a('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x563a('0x29')](handleEntityNotFound(_0x713637,null))[_0x563a('0x29')](function(_0xb9cbc9){var _0x42831f=_[_0x563a('0x38')](_0xb9cbc9,'id');var _0x5385e0=[];var _0x1d0ed4=[];var _0x14bc9e=squel[_0x563a('0x8c')]();_0x14bc9e[_0x563a('0x8d')](_0x563a('0x8e'))['from'](_0x563a('0x8f'),'tq')['join'](_0x563a('0x90'),'ut',_0x563a('0x91'))[_0x563a('0x44')]('VoicePrefixId\x20=\x20?',_0x115188[_0x563a('0x50')]['id']);for(var _0x25e5d1=0x0;_0x25e5d1<_0xb9cbc9[_0x563a('0x3e')];_0x25e5d1+=0x1){let _0x5ba698=_0xb9cbc9[_0x25e5d1];for(var _0x2dadc1=0x0;_0x2dadc1<_0x5ba698[_0x563a('0x7f')]['length'];_0x2dadc1+=0x1){let _0x55f64e=_0x5ba698[_0x563a('0x7f')][_0x2dadc1];var _0x41d0df=_0x14bc9e['clone']();_0x41d0df['where'](_0x563a('0x92'),_0x55f64e['id']);_0x1d0ed4['push'](db[_0x563a('0x84')][_0x563a('0x39')](_0x41d0df[_0x563a('0x93')](),{'type':db[_0x563a('0x84')][_0x563a('0x94')][_0x563a('0x95')]})[_0x563a('0x29')](function(_0xc24817){if(_0xc24817[_0x563a('0x3e')]===0x1){return _0x55f64e['id'];}else{var _0xd04cd=_[_0x563a('0x96')](_['map'](_0xc24817,'TeamId'),function(_0x571a84){return _[_0x563a('0x97')](_0x42831f,_0x571a84);});if(_0xd04cd){return _0x55f64e['id'];}}}));}}return BPromise[_0x563a('0x98')](_0x1d0ed4)[_0x563a('0x29')](function(_0x5244e5){_0x5385e0=_(_0x5385e0)['union'](_0x5244e5)[_0x563a('0x99')]()[_0x563a('0x9a')]();return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x115188[_0x563a('0x50')]['id']}})[_0x563a('0x29')](function(_0x23e33f){return db['sequelize'][_0x563a('0x71')](function(_0x25049d){return _0x23e33f[_0x563a('0x8b')](_0x115188[_0x563a('0x39')][_0x563a('0x74')],{'transaction':_0x25049d})[_0x563a('0x29')](function(){if(!_[_0x563a('0x9b')](_0x5385e0)){return _0x23e33f[_0x563a('0x77')](_0x5385e0,{'transaction':_0x25049d});}})[_0x563a('0x29')](function(){_0x5385e0[_0x563a('0x89')](function(_0x482d21){socket[_0x563a('0x76')]('userVoicePrefix:remove',{'UserId':_0x482d21,'VoicePrefixId':_0x23e33f['id']});});});});});});})[_0x563a('0x29')](respondWithStatusCode(_0x713637,null))[_0x563a('0x4e')](handleError(_0x713637,null));}; \ No newline at end of file +var _0x1a85=['UserProfileSection','userProfileId','autoAssociation','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','NoOp','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','getTeams','Team','Agents','online','voicePause','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','forEach','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','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','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','index','map','VoicePrefix','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','describe','create','sequelize','transaction','body','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x476c06,_0x158a4f){var _0x54240a=function(_0x406665){while(--_0x406665){_0x476c06['push'](_0x476c06['shift']());}};_0x54240a(++_0x158a4f);}(_0x1a85,0x178));var _0x51a8=function(_0x59145a,_0x1f60f1){_0x59145a=_0x59145a-0x0;var _0xf04d7=_0x1a85[_0x59145a];return _0xf04d7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];config[_0x51a8('0x17')]=_[_0x51a8('0x18')](config[_0x51a8('0x17')],{'host':_0x51a8('0x19'),'port':0x18eb});var socket=require(_0x51a8('0x1a'))(new Redis(config['redis']));require(_0x51a8('0x1b'))[_0x51a8('0x1c')](socket);function respondWithStatusCode(_0xaec066,_0x50d992){_0x50d992=_0x50d992||0xcc;return function(_0xf4eb6e){if(_0xf4eb6e){return _0xaec066['sendStatus'](_0x50d992);}return _0xaec066[_0x51a8('0x1d')](_0x50d992)[_0x51a8('0x1e')]();};}function respondWithResult(_0x39cd45,_0x2b0521){_0x2b0521=_0x2b0521||0xc8;return function(_0x3fbd02){if(_0x3fbd02){return _0x39cd45[_0x51a8('0x1d')](_0x2b0521)[_0x51a8('0x1f')](_0x3fbd02);}};}function respondWithFilteredResult(_0x516abc,_0x1c2f25){return function(_0x45a433){if(_0x45a433){var _0xd52230=typeof _0x1c2f25[_0x51a8('0x20')]===_0x51a8('0x21')&&typeof _0x1c2f25[_0x51a8('0x22')]==='undefined';var _0x1df8c2=_0x45a433[_0x51a8('0x23')];var _0x2217ce=_0xd52230?0x0:_0x1c2f25[_0x51a8('0x20')];var _0x2a4c4c=_0xd52230?_0x45a433[_0x51a8('0x23')]:_0x1c2f25[_0x51a8('0x20')]+_0x1c2f25[_0x51a8('0x22')];var _0x5ac1c0;if(_0x2a4c4c>=_0x1df8c2){_0x2a4c4c=_0x1df8c2;_0x5ac1c0=0xc8;}else{_0x5ac1c0=0xce;}_0x516abc[_0x51a8('0x1d')](_0x5ac1c0);return _0x516abc['set'](_0x51a8('0x24'),_0x2217ce+'-'+_0x2a4c4c+'/'+_0x1df8c2)[_0x51a8('0x1f')](_0x45a433);}return null;};}function patchUpdates(_0x8bda40){return function(_0x3759d6){try{jsonpatch['apply'](_0x3759d6,_0x8bda40,!![]);}catch(_0xae3588){return BPromise['reject'](_0xae3588);}return _0x3759d6['save']();};}function saveUpdates(_0x23d26a,_0x52e503){return function(_0x384d25){if(_0x384d25){return _0x384d25[_0x51a8('0x25')](_0x23d26a)[_0x51a8('0x26')](function(_0x18e2f3){return _0x18e2f3;});}return null;};}function removeEntity(_0x157554,_0x2f2f05){return function(_0x291ed6){if(_0x291ed6){return _0x291ed6[_0x51a8('0x27')]()['then'](function(){var _0x273ce2=_0x291ed6[_0x51a8('0x28')]({'plain':!![]});var _0xca5746=_0x51a8('0x29');return db[_0x51a8('0x2a')][_0x51a8('0x27')]({'where':{'type':_0xca5746,'resourceId':_0x273ce2['id']}})[_0x51a8('0x26')](function(){return _0x291ed6;});})[_0x51a8('0x26')](function(){_0x157554[_0x51a8('0x1d')](0xcc)[_0x51a8('0x1e')]();});}};}function handleEntityNotFound(_0x20c6b5,_0x347a02){return function(_0x4a1548){if(!_0x4a1548){_0x20c6b5[_0x51a8('0x2b')](0x194);}return _0x4a1548;};}function handleError(_0x58cba0,_0x276424){_0x276424=_0x276424||0x1f4;return function(_0x3bc19a){logger[_0x51a8('0x2c')](_0x3bc19a[_0x51a8('0x2d')]);if(_0x3bc19a[_0x51a8('0x2e')]){delete _0x3bc19a['name'];}_0x58cba0[_0x51a8('0x1d')](_0x276424)['send'](_0x3bc19a);};}exports[_0x51a8('0x2f')]=function(_0x24b39a,_0x253a59){var _0x4b19c8={},_0x2080a1={},_0x499a43={'count':0x0,'rows':[]};var _0x25a858=_[_0x51a8('0x30')](db[_0x51a8('0x31')][_0x51a8('0x32')],function(_0x193e0f){return{'name':_0x193e0f['fieldName'],'type':_0x193e0f[_0x51a8('0x33')]['key']};});_0x2080a1[_0x51a8('0x34')]=_[_0x51a8('0x30')](_0x25a858,_0x51a8('0x2e'));_0x2080a1['query']=_[_0x51a8('0x35')](_0x24b39a[_0x51a8('0x36')]);_0x2080a1[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x2080a1[_0x51a8('0x34')],_0x2080a1['query']);_0x4b19c8['attributes']=_['intersection'](_0x2080a1[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x24b39a['query'][_0x51a8('0x39')]));_0x4b19c8['attributes']=_0x4b19c8[_0x51a8('0x3a')][_0x51a8('0x3b')]?_0x4b19c8[_0x51a8('0x3a')]:_0x2080a1[_0x51a8('0x34')];if(!_0x24b39a[_0x51a8('0x36')][_0x51a8('0x3c')]('nolimit')){_0x4b19c8['limit']=qs[_0x51a8('0x22')](_0x24b39a['query']['limit']);_0x4b19c8['offset']=qs[_0x51a8('0x20')](_0x24b39a[_0x51a8('0x36')][_0x51a8('0x20')]);}_0x4b19c8['order']=qs[_0x51a8('0x3d')](_0x24b39a[_0x51a8('0x36')][_0x51a8('0x3d')]);_0x4b19c8[_0x51a8('0x3e')]=qs['filters'](_[_0x51a8('0x3f')](_0x24b39a[_0x51a8('0x36')],_0x2080a1[_0x51a8('0x37')]),_0x25a858);if(_0x24b39a['query'][_0x51a8('0x40')]){_0x4b19c8['where']=_[_0x51a8('0x41')](_0x4b19c8[_0x51a8('0x3e')],{'$or':_[_0x51a8('0x30')](_0x25a858,function(_0x37d50b){if(_0x37d50b['type']!==_0x51a8('0x42')){var _0x3da2cf={};_0x3da2cf[_0x37d50b[_0x51a8('0x2e')]]={'$like':'%'+_0x24b39a[_0x51a8('0x36')][_0x51a8('0x40')]+'%'};return _0x3da2cf;}})});}_0x4b19c8=_[_0x51a8('0x41')]({},_0x4b19c8,_0x24b39a[_0x51a8('0x43')]);var _0x1cdec6={'where':_0x4b19c8[_0x51a8('0x3e')]};return db['VoicePrefix'][_0x51a8('0x23')](_0x1cdec6)[_0x51a8('0x26')](function(_0x4c7c67){_0x499a43['count']=_0x4c7c67;if(_0x24b39a[_0x51a8('0x36')][_0x51a8('0x44')]){_0x4b19c8[_0x51a8('0x45')]=[{'all':!![]}];}return db[_0x51a8('0x31')][_0x51a8('0x46')](_0x4b19c8);})[_0x51a8('0x26')](function(_0x28f5b3){_0x499a43[_0x51a8('0x47')]=_0x28f5b3;return _0x499a43;})[_0x51a8('0x26')](respondWithFilteredResult(_0x253a59,_0x4b19c8))[_0x51a8('0x48')](handleError(_0x253a59,null));};exports['show']=function(_0x416988,_0x218ae0){var _0x190d52={'raw':![],'where':{'id':_0x416988[_0x51a8('0x49')]['id']}},_0x444b0b={};_0x444b0b[_0x51a8('0x34')]=_['keys'](db[_0x51a8('0x31')]['rawAttributes']);_0x444b0b[_0x51a8('0x36')]=_[_0x51a8('0x35')](_0x416988[_0x51a8('0x36')]);_0x444b0b[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x444b0b['model'],_0x444b0b['query']);_0x190d52[_0x51a8('0x3a')]=_[_0x51a8('0x38')](_0x444b0b[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x416988[_0x51a8('0x36')]['fields']));_0x190d52['attributes']=_0x190d52[_0x51a8('0x3a')][_0x51a8('0x3b')]?_0x190d52[_0x51a8('0x3a')]:_0x444b0b[_0x51a8('0x34')];if(_0x416988[_0x51a8('0x36')][_0x51a8('0x44')]){_0x190d52[_0x51a8('0x45')]=[{'all':!![]}];}_0x190d52=_[_0x51a8('0x41')]({},_0x190d52,_0x416988[_0x51a8('0x43')]);return db['VoicePrefix']['find'](_0x190d52)['then'](handleEntityNotFound(_0x218ae0,null))[_0x51a8('0x26')](respondWithResult(_0x218ae0,null))[_0x51a8('0x48')](handleError(_0x218ae0,null));};exports[_0x51a8('0x27')]=function(_0x5259f3,_0x3bd492){return db[_0x51a8('0x31')]['find']({'where':{'id':_0x5259f3[_0x51a8('0x49')]['id']}})['then'](handleEntityNotFound(_0x3bd492,null))['then'](removeEntity(_0x3bd492,null))[_0x51a8('0x48')](handleError(_0x3bd492,null));};exports[_0x51a8('0x4a')]=function(_0x41dd1f,_0x56d7f1){return db['VoicePrefix'][_0x51a8('0x4a')]()['then'](respondWithResult(_0x56d7f1,null))[_0x51a8('0x48')](handleError(_0x56d7f1,null));};exports[_0x51a8('0x4b')]=function(_0x3623d4,_0x1ace5b){var _0xee9bee;return db[_0x51a8('0x4c')][_0x51a8('0x4d')](function(_0x406a87){return db[_0x51a8('0x31')]['create'](_0x3623d4[_0x51a8('0x4e')],{'transaction':_0x406a87})[_0x51a8('0x26')](function(_0x823d14){_0xee9bee=_0x823d14[_0x51a8('0x28')]({'plain':!![]});return db['VoiceExtension'][_0x51a8('0x4f')]({'where':{'id':_0xee9bee['VoiceExtensionId']},'raw':!![]})[_0x51a8('0x26')](function(_0x252c20){return createVoicePrefixExtensions(_0xee9bee,_0x252c20,_0x406a87);});});})['then'](function(){var _0x56dd7a=_0x3623d4[_0x51a8('0x50')][_0x51a8('0x28')]({'plain':!![]});if(!_0x56dd7a)throw new Error(_0x51a8('0x51'));if(_0x56dd7a[_0x51a8('0x52')]===_0x51a8('0x50')){var _0x52f60f=_0xee9bee;return db[_0x51a8('0x53')][_0x51a8('0x4f')]({'where':{'name':_0x51a8('0x29'),'userProfileId':_0x56dd7a[_0x51a8('0x54')]},'raw':!![]})[_0x51a8('0x26')](function(_0x5d44fe){if(_0x5d44fe&&_0x5d44fe[_0x51a8('0x55')]===0x0){return db[_0x51a8('0x2a')][_0x51a8('0x4b')]({'name':_0x52f60f[_0x51a8('0x2e')],'resourceId':_0x52f60f['id'],'type':_0x5d44fe[_0x51a8('0x2e')],'sectionId':_0x5d44fe['id']},{})[_0x51a8('0x26')](function(){return _0xee9bee;});}else{return _0xee9bee;}})['catch'](function(_0x4cef4e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cef4e);throw _0x4cef4e;});}return _0xee9bee;})[_0x51a8('0x26')](respondWithResult(_0x1ace5b,null))[_0x51a8('0x48')](handleError(_0x1ace5b,null));};function Extension(_0x51f9f7,_0x7ac0ae,_0x56d3d7,_0x41cc00){this['context']=_0x51a8('0x56');this[_0x51a8('0x57')]=_0x51f9f7;this['app']=_0x56d3d7;this['type']='system';this[_0x51a8('0x58')]=_0x51a8('0x59');this[_0x51a8('0x5a')]=_0x7ac0ae;this[_0x51a8('0x5b')]=_0x41cc00;}function createVoicePrefixExtensions(_0x149047,_0x21c8e0,_0x3fd347){return new BPromise(function(_0x259153,_0x494e11){var _0x43c2ad=new Extension(formatPrefixName(_0x149047[_0x51a8('0x5c')]),0x1,'NoOp',_0x51a8('0x5d'));_0x43c2ad[_0x51a8('0x5e')]=_0x149047['id'];return db[_0x51a8('0x5f')][_0x51a8('0x4b')](_0x43c2ad,{'transaction':_0x3fd347})[_0x51a8('0x26')](function(_0x2a5684){var _0x4f6d5f=_0x2a5684['get']({'plain':!![]});var _0x31a464=_['map'](addVoicePrefixExtensions(_0x149047,_0x21c8e0),function(_0x4ca01a){_0x4ca01a['VoiceExtensionId']=_0x4f6d5f['id'];_0x4ca01a['VoicePrefixId']=_0x149047['id'];return _0x4ca01a;});return db['VoiceExtension'][_0x51a8('0x60')](_0x31a464,{'transaction':_0x3fd347})['then'](function(_0x1477af){if(!_0x1477af){return _0x494e11(_0x51a8('0x61'));}else{return _0x259153(_0x1477af);}})[_0x51a8('0x48')](function(_0x2d3d37){return _0x494e11(_0x2d3d37);});});;});};function addVoicePrefixExtensions(_0xf05c1a,_0x2d8b9b){var _0x28c539=[];var _0xdafa01=formatPrefixName(_0xf05c1a[_0x51a8('0x5c')]);_0x28c539[_0x51a8('0x62')](new Extension(_0xdafa01,0x2,'Set',_0x51a8('0x63')+_0xf05c1a[_0x51a8('0x2e')]));if(_0xf05c1a[_0x51a8('0x64')]){_0x28c539['push'](new Extension(_0xdafa01,0x3,'Set','PREFIX-CALLERIDALL='+_0xf05c1a[_0x51a8('0x64')]));}else{_0x28c539[_0x51a8('0x62')](new Extension(_0xdafa01,0x3,_0x51a8('0x65'),_0x51a8('0x66')));}_0x28c539[_0x51a8('0x62')](new Extension(_0xdafa01,0x4,_0x51a8('0x67'),_0x2d8b9b[_0x51a8('0x68')]+','+_0x51a8('0x69')+(0x8+_0xf05c1a[_0x51a8('0x2e')][_0x51a8('0x3b')])+'}'+','+0x1));return _0x28c539;}function formatPrefixName(_0x45aabc){var _0x3ba418='_';for(var _0x934ea9=0x0;_0x934ea9<_0x45aabc['length'];_0x934ea9++){if(_0x45aabc[_0x51a8('0x6a')](_0x934ea9)=='-'){_0x3ba418+=_0x45aabc[_0x51a8('0x6a')](_0x934ea9);}else{_0x3ba418+='['+_0x45aabc['charAt'](_0x934ea9)+']';}}_0x3ba418+='.';return _0x3ba418;}exports[_0x51a8('0x25')]=function(_0x5140b8,_0x4ac62e,_0x59c80f){var _0x2b4313=_0x5140b8[_0x51a8('0x4e')];_0x2b4313[_0x51a8('0x5c')]=_0x51a8('0x6b')+_0x2b4313[_0x51a8('0x2e')]+'-';return db[_0x51a8('0x4c')][_0x51a8('0x4d')](function(_0x5a37c1){return db['VoicePrefix']['update'](_0x2b4313,{'where':{'id':_0x2b4313['id']},'transaction':_0x5a37c1})[_0x51a8('0x26')](function(){return db[_0x51a8('0x5f')][_0x51a8('0x27')]({'where':{'VoicePrefixId':_0x2b4313['id']},'transaction':_0x5a37c1})[_0x51a8('0x26')](function(){return db[_0x51a8('0x5f')][_0x51a8('0x4f')]({'where':{'id':_0x2b4313['VoiceExtensionId']},'raw':!![]})[_0x51a8('0x26')](function(_0x481030){return createVoicePrefixExtensions(_0x2b4313,_0x481030,_0x5a37c1);});});});})[_0x51a8('0x26')](function(){return db[_0x51a8('0x31')][_0x51a8('0x6c')](_0x2b4313['id']);})[_0x51a8('0x26')](respondWithResult(_0x4ac62e,null))[_0x51a8('0x48')](handleError(_0x4ac62e,null));};exports[_0x51a8('0x6d')]=function(_0x895b42,_0xc751c3,_0x3540cd){return db[_0x51a8('0x31')][_0x51a8('0x4f')]({'where':{'id':_0x895b42['params']['id']}})['then'](handleEntityNotFound(_0xc751c3,null))[_0x51a8('0x26')](function(_0xf0c644){if(_0xf0c644){return _0xf0c644[_0x51a8('0x6d')](_0x895b42[_0x51a8('0x4e')]['ids'],_[_0x51a8('0x6e')](_0x895b42['body'],[_0x51a8('0x6f'),'id'])||{})[_0x51a8('0x70')](function(_0xbee86f){for(var _0x24fcc3=0x0;_0x24fcc3<_0x895b42[_0x51a8('0x4e')][_0x51a8('0x6f')][_0x51a8('0x3b')];_0x24fcc3+=0x1){socket[_0x51a8('0x71')](_0x51a8('0x72'),{'UserId':Number(_0x895b42['body'][_0x51a8('0x6f')][_0x24fcc3]),'VoicePrefixId':Number(_0x895b42[_0x51a8('0x49')]['id'])});}return _0xbee86f;});}})[_0x51a8('0x26')](respondWithResult(_0xc751c3,null))[_0x51a8('0x48')](handleError(_0xc751c3,null));};exports['removeAgents']=function(_0x529062,_0x1c1d2f,_0x4b517d){return db['VoicePrefix']['find']({'where':{'id':_0x529062[_0x51a8('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c1d2f,null))['then'](function(_0x1325ca){if(_0x1325ca){return _0x1325ca[_0x51a8('0x73')](_0x529062[_0x51a8('0x36')]['ids'])[_0x51a8('0x26')](function(){if(_[_0x51a8('0x74')](_0x529062[_0x51a8('0x36')]['ids'])){for(var _0x3ac9c8=0x0;_0x3ac9c8<_0x529062[_0x51a8('0x36')][_0x51a8('0x6f')][_0x51a8('0x3b')];_0x3ac9c8+=0x1){socket[_0x51a8('0x71')](_0x51a8('0x75'),{'UserId':Number(_0x529062[_0x51a8('0x36')][_0x51a8('0x6f')][_0x3ac9c8]),'VoicePrefixId':Number(_0x529062[_0x51a8('0x49')]['id'])});}}else{socket['emit'](_0x51a8('0x75'),{'UserId':Number(_0x529062[_0x51a8('0x36')]['ids']),'VoicePrefixId':Number(_0x529062[_0x51a8('0x49')]['id'])});}});}})[_0x51a8('0x26')](respondWithStatusCode(_0x1c1d2f,null))['catch'](handleError(_0x1c1d2f,null));};exports[_0x51a8('0x76')]=function(_0x132ce5,_0x3fbdf1,_0x17fd0a){var _0x398fb2={};var _0x53cca9={};var _0x160861;var _0x1e7f04;return db[_0x51a8('0x31')][_0x51a8('0x77')]({'where':{'id':_0x132ce5['params']['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x3fbdf1,null))[_0x51a8('0x26')](function(_0x2a10ac){if(_0x2a10ac){_0x160861=_0x2a10ac;_0x53cca9[_0x51a8('0x34')]=_[_0x51a8('0x35')](db[_0x51a8('0x78')][_0x51a8('0x32')]);_0x53cca9[_0x51a8('0x36')]=_['keys'](_0x132ce5[_0x51a8('0x36')]);_0x53cca9[_0x51a8('0x37')]=_['intersection'](_0x53cca9[_0x51a8('0x34')],_0x53cca9[_0x51a8('0x36')]);_0x398fb2['attributes']=_[_0x51a8('0x38')](_0x53cca9['model'],qs['fields'](_0x132ce5[_0x51a8('0x36')][_0x51a8('0x39')]));_0x398fb2[_0x51a8('0x3a')]=_0x398fb2['attributes']['length']?_0x398fb2[_0x51a8('0x3a')]:_0x53cca9['model'];_0x398fb2[_0x51a8('0x79')]=qs[_0x51a8('0x3d')](_0x132ce5[_0x51a8('0x36')][_0x51a8('0x3d')]);_0x398fb2[_0x51a8('0x3e')]=qs[_0x51a8('0x37')](_[_0x51a8('0x3f')](_0x132ce5[_0x51a8('0x36')],_0x53cca9[_0x51a8('0x37')]));if(_0x132ce5[_0x51a8('0x36')][_0x51a8('0x40')]){_0x398fb2[_0x51a8('0x3e')]=_[_0x51a8('0x41')](_0x398fb2[_0x51a8('0x3e')],{'$or':_[_0x51a8('0x30')](_0x398fb2['attributes'],function(_0x48f746){var _0x31e7e3={};_0x31e7e3[_0x48f746]={'$like':'%'+_0x132ce5['query']['filter']+'%'};return _0x31e7e3;})});}_0x398fb2=_['merge']({},_0x398fb2,_0x132ce5[_0x51a8('0x43')]);return _0x160861[_0x51a8('0x76')](_0x398fb2);}})[_0x51a8('0x26')](function(_0x125a28){if(_0x125a28){_0x1e7f04=_0x125a28['length'];if(!_0x132ce5[_0x51a8('0x36')][_0x51a8('0x3c')]('nolimit')){_0x398fb2[_0x51a8('0x22')]=qs[_0x51a8('0x22')](_0x132ce5['query']['limit']);_0x398fb2[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x132ce5[_0x51a8('0x36')][_0x51a8('0x20')]);}return _0x160861[_0x51a8('0x76')](_0x398fb2);}})[_0x51a8('0x26')](function(_0x4e566a){if(_0x4e566a){return _0x4e566a?{'count':_0x1e7f04,'rows':_0x4e566a}:null;}})[_0x51a8('0x26')](respondWithResult(_0x3fbdf1,null))[_0x51a8('0x48')](handleError(_0x3fbdf1,null));};exports[_0x51a8('0x7a')]=function(_0x566d62,_0x315802,_0x3f4649){var _0x1db1e0={};var _0x58a83c={};var _0x149fa4;var _0x1821a8;return db['VoicePrefix'][_0x51a8('0x77')]({'where':{'id':_0x566d62['params']['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x315802,null))[_0x51a8('0x26')](function(_0xfb059){if(_0xfb059){_0x149fa4=_0xfb059;_0x58a83c[_0x51a8('0x34')]=_[_0x51a8('0x35')](db[_0x51a8('0x7b')][_0x51a8('0x32')]);_0x58a83c[_0x51a8('0x36')]=_['keys'](_0x566d62[_0x51a8('0x36')]);_0x58a83c[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x58a83c[_0x51a8('0x34')],_0x58a83c[_0x51a8('0x36')]);_0x1db1e0['attributes']=_['intersection'](_0x58a83c[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x566d62[_0x51a8('0x36')][_0x51a8('0x39')]));_0x1db1e0[_0x51a8('0x3a')]=_0x1db1e0['attributes'][_0x51a8('0x3b')]?_0x1db1e0['attributes']:_0x58a83c[_0x51a8('0x34')];_0x1db1e0[_0x51a8('0x79')]=qs['sort'](_0x566d62[_0x51a8('0x36')]['sort']);_0x1db1e0[_0x51a8('0x3e')]=qs[_0x51a8('0x37')](_[_0x51a8('0x3f')](_0x566d62[_0x51a8('0x36')],_0x58a83c[_0x51a8('0x37')]));if(_0x566d62['query'][_0x51a8('0x40')]){_0x1db1e0[_0x51a8('0x3e')]=_['merge'](_0x1db1e0[_0x51a8('0x3e')],{'$or':_[_0x51a8('0x30')](_0x1db1e0['attributes'],function(_0x49b0d2){var _0x24b2a9={};_0x24b2a9[_0x49b0d2]={'$like':'%'+_0x566d62[_0x51a8('0x36')][_0x51a8('0x40')]+'%'};return _0x24b2a9;})});}_0x1db1e0=_['merge']({},_0x1db1e0,_0x566d62[_0x51a8('0x43')]);return _0x149fa4[_0x51a8('0x7a')](_0x1db1e0);}})[_0x51a8('0x26')](function(_0x11aab9){if(_0x11aab9){_0x1821a8=_0x11aab9[_0x51a8('0x3b')];if(!_0x566d62[_0x51a8('0x36')][_0x51a8('0x3c')]('nolimit')){_0x1db1e0[_0x51a8('0x22')]=qs[_0x51a8('0x22')](_0x566d62[_0x51a8('0x36')][_0x51a8('0x22')]);_0x1db1e0['offset']=qs['offset'](_0x566d62[_0x51a8('0x36')][_0x51a8('0x20')]);}return _0x149fa4['getTeams'](_0x1db1e0);}})['then'](function(_0x5b44ba){if(_0x5b44ba){return _0x5b44ba?{'count':_0x1821a8,'rows':_0x5b44ba}:null;}})[_0x51a8('0x26')](respondWithResult(_0x315802,null))['catch'](handleError(_0x315802,null));};exports['addTeams']=function(_0x517de1,_0x2164d7,_0x4b03f7){var _0x2cea3f=_0x517de1[_0x51a8('0x4e')]['ids'];var _0x5ab3c0;return db[_0x51a8('0x7b')]['findAll']({'where':{'id':_0x2cea3f},'attributes':['id'],'include':[{'model':db[_0x51a8('0x78')],'as':_0x51a8('0x7c'),'attributes':['id','name',_0x51a8('0x7d'),_0x51a8('0x7e'),'interface'],'raw':!![]}]})[_0x51a8('0x26')](function(_0x3bcc82){if(_0x3bcc82){_0x5ab3c0=_0x3bcc82;var _0x223bd7=_['flatMap'](_0x3bcc82,function(_0x2af315){var _0x2db8da=_0x2af315[_0x51a8('0x28')]({'plain':!![]});return _0x2db8da['Agents'];});return db['VoicePrefix'][_0x51a8('0x4f')]({'where':{'id':_0x517de1[_0x51a8('0x49')]['id']}})[_0x51a8('0x26')](function(_0xabdbd0){return db[_0x51a8('0x4c')][_0x51a8('0x4d')](function(_0x35cd5d){return _0xabdbd0[_0x51a8('0x7f')](_0x2cea3f,{'transaction':_0x35cd5d})[_0x51a8('0x26')](function(){return BPromise[_0x51a8('0x80')](_0x5ab3c0,function(_0x2a8aa1){return db[_0x51a8('0x81')][_0x51a8('0x82')]({'TeamId':_0x2a8aa1['id'],'VoicePrefixId':_0x517de1['params']['id']},{'transaction':_0x35cd5d});});})['then'](function(){return BPromise[_0x51a8('0x80')](_0x223bd7,function(_0x318478){return db[_0x51a8('0x83')][_0x51a8('0x84')]({'where':{'UserId':_0x318478['id'],'VoicePrefixId':_0x517de1[_0x51a8('0x49')]['id']},'transaction':_0x35cd5d});});})['then'](function(){_0x223bd7['forEach'](function(_0x39e8e6){socket[_0x51a8('0x71')]('userVoicePrefix:save',{'UserId':_0x39e8e6['id'],'VoicePrefixId':_0xabdbd0['id']});});});});});}})[_0x51a8('0x26')](respondWithStatusCode(_0x2164d7,null))[_0x51a8('0x48')](handleError(_0x2164d7,null));};exports[_0x51a8('0x85')]=function(_0x19ffd8,_0x121944,_0x4ee800){return db['Team'][_0x51a8('0x46')]({'where':{'id':_0x19ffd8['query'][_0x51a8('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x51a8('0x7c'),'attributes':['id'],'raw':!![]}]})[_0x51a8('0x26')](handleEntityNotFound(_0x121944,null))['then'](function(_0x2dc65c){var _0x1837cb=_[_0x51a8('0x30')](_0x2dc65c,'id');var _0x11bee7=[];var _0x5cacc1=[];var _0x57b718=squel[_0x51a8('0x86')]();_0x57b718[_0x51a8('0x87')](_0x51a8('0x88'))[_0x51a8('0x89')]('team_has_voice_prefixes','tq')[_0x51a8('0x8a')]('user_has_teams','ut',_0x51a8('0x8b'))['where'](_0x51a8('0x8c'),_0x19ffd8[_0x51a8('0x49')]['id']);for(var _0x1ae73c=0x0;_0x1ae73c<_0x2dc65c[_0x51a8('0x3b')];_0x1ae73c+=0x1){let _0x5e923f=_0x2dc65c[_0x1ae73c];for(var _0x432e6a=0x0;_0x432e6a<_0x5e923f['Agents'][_0x51a8('0x3b')];_0x432e6a+=0x1){let _0x1e99d0=_0x5e923f[_0x51a8('0x7c')][_0x432e6a];var _0x5e22f4=_0x57b718[_0x51a8('0x8d')]();_0x5e22f4[_0x51a8('0x3e')](_0x51a8('0x8e'),_0x1e99d0['id']);_0x5cacc1['push'](db['sequelize'][_0x51a8('0x36')](_0x5e22f4[_0x51a8('0x8f')](),{'type':db[_0x51a8('0x4c')][_0x51a8('0x90')]['SELECT']})['then'](function(_0x46c310){if(_0x46c310['length']===0x1){return _0x1e99d0['id'];}else{var _0x1b9cd4=_[_0x51a8('0x91')](_[_0x51a8('0x30')](_0x46c310,_0x51a8('0x92')),function(_0x399fa0){return _[_0x51a8('0x93')](_0x1837cb,_0x399fa0);});if(_0x1b9cd4){return _0x1e99d0['id'];}}}));}}return BPromise[_0x51a8('0x94')](_0x5cacc1)['then'](function(_0x593711){_0x11bee7=_(_0x11bee7)['union'](_0x593711)[_0x51a8('0x95')]()[_0x51a8('0x96')]();return db[_0x51a8('0x31')][_0x51a8('0x4f')]({'where':{'id':_0x19ffd8[_0x51a8('0x49')]['id']}})['then'](function(_0x193d27){return db['sequelize'][_0x51a8('0x4d')](function(_0x188991){return _0x193d27[_0x51a8('0x85')](_0x19ffd8[_0x51a8('0x36')]['ids'],{'transaction':_0x188991})['then'](function(){if(!_[_0x51a8('0x97')](_0x11bee7)){return _0x193d27['removeAgents'](_0x11bee7,{'transaction':_0x188991});}})[_0x51a8('0x26')](function(){_0x11bee7[_0x51a8('0x98')](function(_0x292f74){socket[_0x51a8('0x71')]('userVoicePrefix:remove',{'UserId':_0x292f74,'VoicePrefixId':_0x193d27['id']});});});});});});})[_0x51a8('0x26')](respondWithStatusCode(_0x121944,null))[_0x51a8('0x48')](handleError(_0x121944,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index e1b6edb..66735a0 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 _0x236b=['events','update','remove','hasOwnProperty','hook','exports'];(function(_0x2e1458,_0x2a8dc6){var _0x46f3b8=function(_0x1a2a27){while(--_0x1a2a27){_0x2e1458['push'](_0x2e1458['shift']());}};_0x46f3b8(++_0x2a8dc6);}(_0x236b,0x1d4));var _0xb236=function(_0x546b80,_0x51104b){_0x546b80=_0x546b80-0x0;var _0x4bfe0f=_0x236b[_0x546b80];return _0x4bfe0f;};'use strict';var EventEmitter=require(_0xb236('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb236('0x1'),'afterDestroy':_0xb236('0x2')};function emitEvent(_0x74568c){return function(_0x1050e9,_0x2b839f,_0x13d0ec){VoicePrefixEvents['emit'](_0x74568c+':'+_0x1050e9['id'],_0x1050e9);VoicePrefixEvents['emit'](_0x74568c,_0x1050e9);_0x13d0ec(null);};}for(var e in events){if(events[_0xb236('0x3')](e)){var event=events[e];VoicePrefix[_0xb236('0x4')](e,emitEvent(event));}}module[_0xb236('0x5')]=VoicePrefixEvents; \ No newline at end of file +var _0x52a4=['hook','../../mysqldb','VoicePrefix','setMaxListeners','update','remove','emit'];(function(_0x5c7cd6,_0xa77e75){var _0x5820da=function(_0x2d499e){while(--_0x2d499e){_0x5c7cd6['push'](_0x5c7cd6['shift']());}};_0x5820da(++_0xa77e75);}(_0x52a4,0x151));var _0x452a=function(_0x540a17,_0x36509d){_0x540a17=_0x540a17-0x0;var _0x39b97e=_0x52a4[_0x540a17];return _0x39b97e;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x452a('0x0'))['db'][_0x452a('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x452a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x452a('0x3'),'afterDestroy':_0x452a('0x4')};function emitEvent(_0x45f8f5){return function(_0x15c667,_0x3a264f,_0xb57f4f){VoicePrefixEvents[_0x452a('0x5')](_0x45f8f5+':'+_0x15c667['id'],_0x15c667);VoicePrefixEvents[_0x452a('0x5')](_0x45f8f5,_0x15c667);_0xb57f4f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x452a('0x6')](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 48bb6b3..f6d4899 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 _0xa822=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define','VoicePrefix','voice_prefixes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa822,0x9a));var _0x2a82=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0xa822[_0x16629d];return _0x56ccee;};'use strict';var _=require(_0x2a82('0x0'));var util=require(_0x2a82('0x1'));var logger=require(_0x2a82('0x2'))('api');var moment=require(_0x2a82('0x3'));var BPromise=require(_0x2a82('0x4'));var rp=require(_0x2a82('0x5'));var fs=require('fs');var path=require(_0x2a82('0x6'));var rimraf=require('rimraf');var config=require(_0x2a82('0x7'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x5581ae,_0x4fef3b){return _0x5581ae[_0x2a82('0x8')](_0x2a82('0x9'),attributes,{'tableName':_0x2a82('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf950=['util','../../config/logger','api','bluebird','request-promise','rimraf','./voicePrefix.attributes','exports','voice_prefixes','lodash'];(function(_0x1651eb,_0x5c81b4){var _0x2e65e6=function(_0x4ee6af){while(--_0x4ee6af){_0x1651eb['push'](_0x1651eb['shift']());}};_0x2e65e6(++_0x5c81b4);}(_0xf950,0x13f));var _0x0f95=function(_0x4cb51c,_0x48feba){_0x4cb51c=_0x4cb51c-0x0;var _0x52c77c=_0xf950[_0x4cb51c];return _0x52c77c;};'use strict';var _=require(_0x0f95('0x0'));var util=require(_0x0f95('0x1'));var logger=require(_0x0f95('0x2'))(_0x0f95('0x3'));var moment=require('moment');var BPromise=require(_0x0f95('0x4'));var rp=require(_0x0f95('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f95('0x6'));var config=require('../../config/environment');var attributes=require(_0x0f95('0x7'));module[_0x0f95('0x8')]=function(_0x6d1f68,_0x57727c){return _0x6d1f68['define']('VoicePrefix',attributes,{'tableName':_0x0f95('0x9'),'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 4b118a6..00660bb 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 _0xde1a=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a1077,_0x2106b5){var _0x380332=function(_0xce5fd1){while(--_0xce5fd1){_0x4a1077['push'](_0x4a1077['shift']());}};_0x380332(++_0x2106b5);}(_0xde1a,0xfd));var _0xade1=function(_0x2d1f7e,_0x35adb8){_0x2d1f7e=_0x2d1f7e-0x0;var _0x39cafc=_0xde1a[_0x2d1f7e];return _0x39cafc;};'use strict';var _=require('lodash');var util=require(_0xade1('0x0'));var moment=require(_0xade1('0x1'));var BPromise=require(_0xade1('0x2'));var rs=require(_0xade1('0x3'));var fs=require('fs');var Redis=require(_0xade1('0x4'));var db=require(_0xade1('0x5'))['db'];var utils=require(_0xade1('0x6'));var logger=require(_0xade1('0x7'))('rpc');var config=require(_0xade1('0x8'));var jayson=require(_0xade1('0x9'));var client=jayson[_0xade1('0xa')][_0xade1('0xb')]({'port':0x232a});config[_0xade1('0xc')]=_[_0xade1('0xd')](config['redis'],{'host':_0xade1('0xe'),'port':0x18eb});var socket=require(_0xade1('0xf'))(new Redis(config[_0xade1('0xc')]));require(_0xade1('0x10'))[_0xade1('0x11')](socket);function respondWithRpcPromise(_0x2b3854,_0x3ebc61,_0x12eb7f){return new BPromise(function(_0x5add3c,_0x5c44fa){return client[_0xade1('0x12')](_0x2b3854,_0x12eb7f)['then'](function(_0x1d71a8){logger[_0xade1('0x13')](_0xade1('0x14'),_0x3ebc61,'request\x20sent');logger[_0xade1('0x15')](_0xade1('0x16'),_0x3ebc61,_0xade1('0x17'),JSON[_0xade1('0x18')](_0x1d71a8));if(_0x1d71a8[_0xade1('0x19')]){if(_0x1d71a8[_0xade1('0x19')]['code']===0x1f4){logger[_0xade1('0x19')](_0xade1('0x14'),_0x3ebc61,_0x1d71a8[_0xade1('0x19')][_0xade1('0x1a')]);return _0x5c44fa(_0x1d71a8[_0xade1('0x19')]['message']);}logger[_0xade1('0x19')](_0xade1('0x14'),_0x3ebc61,_0x1d71a8[_0xade1('0x19')][_0xade1('0x1a')]);return _0x5add3c(_0x1d71a8[_0xade1('0x19')]['message']);}else{logger[_0xade1('0x13')](_0xade1('0x14'),_0x3ebc61,_0xade1('0x17'));_0x5add3c(_0x1d71a8[_0xade1('0x1b')][_0xade1('0x1a')]);}})[_0xade1('0x1c')](function(_0x39a360){logger[_0xade1('0x19')](_0xade1('0x14'),_0x3ebc61,_0x39a360);_0x5c44fa(_0x39a360);});});} \ No newline at end of file +var _0xed5c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','request','info','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoicePrefix,\x20%s,\x20%s','result','lodash'];(function(_0x51411b,_0x2b96d7){var _0x114d97=function(_0x230121){while(--_0x230121){_0x51411b['push'](_0x51411b['shift']());}};_0x114d97(++_0x2b96d7);}(_0xed5c,0x81));var _0xced5=function(_0x29ceb4,_0x2c0bb0){_0x29ceb4=_0x29ceb4-0x0;var _0x4764a1=_0xed5c[_0x29ceb4];return _0x4764a1;};'use strict';var _=require(_0xced5('0x0'));var util=require(_0xced5('0x1'));var moment=require(_0xced5('0x2'));var BPromise=require(_0xced5('0x3'));var rs=require(_0xced5('0x4'));var fs=require('fs');var Redis=require(_0xced5('0x5'));var db=require(_0xced5('0x6'))['db'];var utils=require(_0xced5('0x7'));var logger=require(_0xced5('0x8'))(_0xced5('0x9'));var config=require('../../config/environment');var jayson=require(_0xced5('0xa'));var client=jayson[_0xced5('0xb')]['http']({'port':0x232a});config['redis']=_[_0xced5('0xc')](config[_0xced5('0xd')],{'host':_0xced5('0xe'),'port':0x18eb});var socket=require(_0xced5('0xf'))(new Redis(config[_0xced5('0xd')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x708a5a,_0x2f2606,_0x37d308){return new BPromise(function(_0x10fd53,_0x5b760e){return client[_0xced5('0x10')](_0x708a5a,_0x37d308)['then'](function(_0x3ba212){logger[_0xced5('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x2f2606,_0xced5('0x12'));logger['debug'](_0xced5('0x13'),_0x2f2606,_0xced5('0x12'),JSON[_0xced5('0x14')](_0x3ba212));if(_0x3ba212[_0xced5('0x15')]){if(_0x3ba212[_0xced5('0x15')][_0xced5('0x16')]===0x1f4){logger[_0xced5('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x2f2606,_0x3ba212['error'][_0xced5('0x17')]);return _0x5b760e(_0x3ba212[_0xced5('0x15')][_0xced5('0x17')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x2f2606,_0x3ba212[_0xced5('0x15')][_0xced5('0x17')]);return _0x10fd53(_0x3ba212[_0xced5('0x15')][_0xced5('0x17')]);}else{logger[_0xced5('0x11')](_0xced5('0x18'),_0x2f2606,'request\x20sent');_0x10fd53(_0x3ba212[_0xced5('0x19')][_0xced5('0x17')]);}})['catch'](function(_0x33851d){logger[_0xced5('0x15')](_0xced5('0x18'),_0x2f2606,_0x33851d);_0x5b760e(_0x33851d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7e542d8..3de6471 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 _0x1ba2=['emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','remove'];(function(_0x53c610,_0x15195c){var _0x5276a6=function(_0x337345){while(--_0x337345){_0x53c610['push'](_0x53c610['shift']());}};_0x5276a6(++_0x15195c);}(_0x1ba2,0xb4));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var VoicePrefixEvents=require(_0x21ba('0x0'));var events=['save',_0x21ba('0x1'),'update'];function createListener(_0x31494a,_0x349a68){return function(_0x46eb26){_0x349a68[_0x21ba('0x2')](_0x31494a,_0x46eb26);};}function removeListener(_0x3661dd,_0x527ad5){return function(){VoicePrefixEvents[_0x21ba('0x3')](_0x3661dd,_0x527ad5);};}exports[_0x21ba('0x4')]=function(_0x4a07e8){for(var _0x10dae1=0x0,_0x53b3e0=events[_0x21ba('0x5')];_0x10dae1<_0x53b3e0;_0x10dae1++){var _0x23c3b7=events[_0x10dae1];var _0x5c50aa=createListener(_0x21ba('0x6')+_0x23c3b7,_0x4a07e8);VoicePrefixEvents['on'](_0x23c3b7,_0x5c50aa);}}; \ No newline at end of file +var _0x1782=['update','voicePrefix:','./voicePrefix.events','remove'];(function(_0x470b4e,_0x3ea13a){var _0x42a5fa=function(_0x208ba7){while(--_0x208ba7){_0x470b4e['push'](_0x470b4e['shift']());}};_0x42a5fa(++_0x3ea13a);}(_0x1782,0x13e));var _0x2178=function(_0x10d671,_0x5d7431){_0x10d671=_0x10d671-0x0;var _0x2f17a1=_0x1782[_0x10d671];return _0x2f17a1;};'use strict';var VoicePrefixEvents=require(_0x2178('0x0'));var events=['save',_0x2178('0x1'),_0x2178('0x2')];function createListener(_0x1df52d,_0x1c92e6){return function(_0x17b0da){_0x1c92e6['emit'](_0x1df52d,_0x17b0da);};}function removeListener(_0x601378,_0x1659a1){return function(){VoicePrefixEvents['removeListener'](_0x601378,_0x1659a1);};}exports['register']=function(_0x3c4dd1){for(var _0x3b0f74=0x0,_0x50ad34=events['length'];_0x3b0f74<_0x50ad34;_0x3b0f74++){var _0x4cf22a=events[_0x3b0f74];var _0x3b4115=createListener(_0x2178('0x3')+_0x4cf22a,_0x3c4dd1);VoicePrefixEvents['on'](_0x4cf22a,_0x3b4115);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 2e49003..81cf08b 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 _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x38a544,_0xe31974){var _0x40c859=function(_0xae53f9){while(--_0xae53f9){_0x38a544['push'](_0x38a544['shift']());}};_0x40c859(++_0xe31974);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x156dba,_0x4e513e){var _0xa401c=function(_0x2fcb8c){while(--_0x2fcb8c){_0x156dba['push'](_0x156dba['shift']());}};_0xa401c(++_0x4e513e);}(_0xb10b,0x12a));var _0xbb10=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0xb10b[_0x36bf88];return _0x332914;};'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['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 941c98a..12b92f3 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 _0xcc4a=['wrandom','rrordered','ringall','strategy','getDataValue','type','dialMethod','roundrobin','includes','INTEGER','yes','all','periodic_announce','join','setDataValue','joinempty','split','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','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,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','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)','#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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','leastrecent','fewestcalls','rrmemory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc4a,0x1db));var _0xacc4=function(_0x4333c4,_0x113141){_0x4333c4=_0x4333c4-0x0;var _0x5d8e34=_0xcc4a[_0x4333c4];return _0x5d8e34;};'use strict';var Sequelize=require(_0xacc4('0x0'));module[_0xacc4('0x1')]={'name':{'type':Sequelize[_0xacc4('0x2')],'allowNull':![],'unique':_0xacc4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xacc4('0x4')](_0xacc4('0x5'),_0xacc4('0x6')),'allowNull':![],'defaultValue':_0xacc4('0x5')},'musiconhold':{'type':Sequelize[_0xacc4('0x2')],'defaultValue':_0xacc4('0x7')},'announce':{'type':Sequelize[_0xacc4('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xacc4('0x4')]('rr','ringall',_0xacc4('0x8'),_0xacc4('0x9'),'random',_0xacc4('0xa'),'linear',_0xacc4('0xb'),_0xacc4('0xc')),'allowNull':![],'defaultValue':_0xacc4('0xd'),'set':function(_0x5c3c17){this['setDataValue'](_0xacc4('0xe'),_0x5c3c17?_0x5c3c17:_0xacc4('0xa'));},'get':function(){var _0x2f67df=this[_0xacc4('0xf')](_0xacc4('0x10'));var _0x2cc908=this['getDataValue'](_0xacc4('0x11'));var _0x463d6c=this['getDataValue']('strategy');if(_0x2f67df==='outbound'){if(_0x2cc908==='preview'){return null;}if(_0x2cc908==='booked'&&!['rrmemory',_0xacc4('0x12')][_0xacc4('0x13')](_0x463d6c)){this['setDataValue'](_0xacc4('0xe'),_0xacc4('0xa'));}}return _0x463d6c;}},'servicelevel':{'type':Sequelize[_0xacc4('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xacc4('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xacc4('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xacc4('0x2')]},'weight':{'type':Sequelize[_0xacc4('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xacc4('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xacc4('0x4')](_0xacc4('0x15'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xacc4('0x4')](_0xacc4('0x15'),'no',_0xacc4('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xacc4('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xacc4('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xacc4('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xacc4('0x4')](_0xacc4('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xacc4('0x4')](_0xacc4('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xacc4('0x4')](_0xacc4('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xacc4('0x4')](_0xacc4('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xacc4('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xacc4('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xacc4('0x4')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xacc4('0x4')](_0xacc4('0x15'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xacc4('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0xacc4('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xacc4('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xacc4('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xacc4('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xacc4('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xacc4('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xacc4('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xacc4('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xacc4('0x2')]},'queue_quantity1':{'type':Sequelize[_0xacc4('0x2')]},'queue_quantity2':{'type':Sequelize[_0xacc4('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xacc4('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x1aef0c){this['setDataValue'](_0xacc4('0x17'),_0x1aef0c?_0x1aef0c[_0xacc4('0x18')](','):[]);},'get':function(){return this['getDataValue'](_0xacc4('0x17'))?this[_0xacc4('0xf')](_0xacc4('0x17'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xacc4('0x2')],'defaultValue':_0xacc4('0x15'),'set':function(_0x459f5f){this[_0xacc4('0x19')]('joinempty',_0x459f5f?_0x459f5f['join'](','):undefined);},'get':function(){return this[_0xacc4('0xf')](_0xacc4('0x1a'))?this[_0xacc4('0xf')](_0xacc4('0x1a'))[_0xacc4('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xacc4('0x2')],'defaultValue':'no','set':function(_0x130ef9){this[_0xacc4('0x19')](_0xacc4('0x1c'),_0x130ef9?_0x130ef9[_0xacc4('0x18')](','):undefined);},'get':function(){return this['getDataValue'](_0xacc4('0x1c'))?this[_0xacc4('0xf')](_0xacc4('0x1c'))[_0xacc4('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xacc4('0x4')](_0xacc4('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xacc4('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xacc4('0x4')](_0xacc4('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xacc4('0x2')]},'description':{'type':Sequelize[_0xacc4('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x66c5cd){this[_0xacc4('0x19')](_0xacc4('0x1d'),_0x66c5cd);if(_0x66c5cd){if(this[_0xacc4('0xf')](_0xacc4('0x1e'))<0x2){this[_0xacc4('0x19')](_0xacc4('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xacc4('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xacc4('0x1f')],'defaultValue':0x0,'comment':_0xacc4('0x20')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xacc4('0x21'),_0xacc4('0x22'),'predictive',_0xacc4('0x23')),'defaultValue':_0xacc4('0x21'),'comment':_0xacc4('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xacc4('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xacc4('0x26')},'dialLimitQueue':{'type':Sequelize[_0xacc4('0x14')](0x4)[_0xacc4('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xacc4('0x27')](0x2)[_0xacc4('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xacc4('0x4')](_0xacc4('0x28'),_0xacc4('0x29')),'defaultValue':_0xacc4('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xacc4('0x27')](0x2)[_0xacc4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xacc4('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0xacc4('0x14')](0x3)[_0xacc4('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xacc4('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xacc4('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xacc4('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacc4('0x2c')},'dialQueueOptions':{'type':Sequelize[_0xacc4('0x2')],'defaultValue':'tTxX','comment':_0xacc4('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0xacc4('0x14')](0x3)[_0xacc4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacc4('0x2e')},'dialQueueProject':{'type':Sequelize[_0xacc4('0x2')],'comment':_0xacc4('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0xacc4('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacc4('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xacc4('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xacc4('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacc4('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xacc4('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xacc4('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xacc4('0x14')](0x3)[_0xacc4('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xacc4('0x14')](0x5)[_0xacc4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xacc4('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xacc4('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xacc4('0x35')},'dialTimezone':{'type':Sequelize[_0xacc4('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xacc4('0x2')],'defaultValue':_0xacc4('0x36')},'dialPrefix':{'type':Sequelize[_0xacc4('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xacc4('0x4')](_0xacc4('0x37'),_0xacc4('0x38'),_0xacc4('0x39')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xacc4('0x1f')],'defaultValue':0x0,'comment':_0xacc4('0x3a')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xacc4('0x14')](0x9)[_0xacc4('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xacc4('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xacc4('0x14')](0x9)[_0xacc4('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xacc4('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xacc4('0x14')](0x9)[_0xacc4('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xacc4('0x14')](0x9)[_0xacc4('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xacc4('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xacc4('0x14')](0x9)[_0xacc4('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xacc4('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xacc4('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xacc4('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xacc4('0x14')](0x5)[_0xacc4('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xacc4('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xacc4('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xacc4('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0xacc4('0x14')](0x5)[_0xacc4('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xacc4('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xacc4('0x1f')],'defaultValue':0x0,'comment':_0xacc4('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0xacc4('0x4')](_0xacc4('0x44'),'ASC'),'defaultValue':_0xacc4('0x44')},'dialQueueProject2':{'type':Sequelize[_0xacc4('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xacc4('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xacc4('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xacc4('0x14')](0x3)[_0xacc4('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xacc4('0x45')},'dialCutDigit':{'type':Sequelize[_0xacc4('0x14')](0x3)[_0xacc4('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xacc4('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xacc4('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacc4('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xacc4('0x14')](0x5)[_0xacc4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xacc4('0x48')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xacc4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xacc4('0x14')](0x5)[_0xacc4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xacc4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacc4('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xacc4('0x14')](0x5)[_0xacc4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xacc4('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0xacc4('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacc4('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xacc4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacc4('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xacc4('0x14')](0x5)[_0xacc4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xacc4('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0xacc4('0x1f')],'defaultValue':![],'comment':_0xacc4('0x4e'),'set':function(_0x4574b8){if(!_0x4574b8)this[_0xacc4('0x19')](_0xacc4('0x4f'),null);this[_0xacc4('0x19')](_0xacc4('0x50'),_0x4574b8);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xacc4('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xacc4('0x14')](0x3)[_0xacc4('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xacc4('0x14')](0x3)[_0xacc4('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xacc4('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0xb65d=['mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','outbound','ringall','fewestcalls','random','rrmemory','linear','wrandom','strategy','type','getDataValue','dialMethod','preview','booked','roundrobin','includes','setDataValue','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','power','progressive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','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,)','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x38a97e,_0x2054b7){var _0x1e56ca=function(_0x287529){while(--_0x287529){_0x38a97e['push'](_0x38a97e['shift']());}};_0x1e56ca(++_0x2054b7);}(_0xb65d,0x18c));var _0xdb65=function(_0x2d643f,_0x1573a0){_0x2d643f=_0x2d643f-0x0;var _0x126aca=_0xb65d[_0x2d643f];return _0x126aca;};'use strict';var Sequelize=require(_0xdb65('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb65('0x1')],'allowNull':![],'unique':_0xdb65('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x4'),_0xdb65('0x5')),'allowNull':![],'defaultValue':_0xdb65('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xdb65('0x6'),'leastrecent',_0xdb65('0x7'),_0xdb65('0x8'),_0xdb65('0x9'),_0xdb65('0xa'),_0xdb65('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0xdb65('0x6'),'set':function(_0x32940c){this['setDataValue'](_0xdb65('0xc'),_0x32940c?_0x32940c:'rrmemory');},'get':function(){var _0x3665ae=this['getDataValue'](_0xdb65('0xd'));var _0x333cf7=this[_0xdb65('0xe')](_0xdb65('0xf'));var _0x355036=this[_0xdb65('0xe')](_0xdb65('0xc'));if(_0x3665ae===_0xdb65('0x5')){if(_0x333cf7===_0xdb65('0x10')){return null;}if(_0x333cf7===_0xdb65('0x11')&&![_0xdb65('0x9'),_0xdb65('0x12')][_0xdb65('0x13')](_0x355036)){this[_0xdb65('0x14')]('strategy',_0xdb65('0x9'));}}return _0x355036;}},'servicelevel':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xdb65('0x15')](0xb)},'timeout':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xdb65('0x1')]},'weight':{'type':Sequelize[_0xdb65('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x16'),'no',_0xdb65('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xdb65('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xdb65('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xdb65('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xdb65('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xdb65('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xdb65('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xdb65('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xdb65('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xdb65('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xdb65('0x3')]('yes','no'),'defaultValue':_0xdb65('0x16')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xdb65('0x16'),'no',_0xdb65('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xdb65('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xdb65('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xdb65('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xdb65('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xdb65('0x1')]},'queue_less_than':{'type':Sequelize[_0xdb65('0x1')]},'periodic_announce':{'type':Sequelize[_0xdb65('0x19')],'set':function(_0x4f8320){this[_0xdb65('0x14')](_0xdb65('0x1a'),_0x4f8320?_0x4f8320[_0xdb65('0x1b')](','):[]);},'get':function(){return this[_0xdb65('0xe')](_0xdb65('0x1a'))?this[_0xdb65('0xe')]('periodic_announce')[_0xdb65('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x56f08c){this[_0xdb65('0x14')](_0xdb65('0x1d'),_0x56f08c?_0x56f08c[_0xdb65('0x1b')](','):undefined);},'get':function(){return this[_0xdb65('0xe')](_0xdb65('0x1d'))?this[_0xdb65('0xe')](_0xdb65('0x1d'))[_0xdb65('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x4948b3){this[_0xdb65('0x14')](_0xdb65('0x1e'),_0x4948b3?_0x4948b3[_0xdb65('0x1b')](','):undefined);},'get':function(){return this[_0xdb65('0xe')](_0xdb65('0x1e'))?this[_0xdb65('0xe')](_0xdb65('0x1e'))[_0xdb65('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xdb65('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xdb65('0x1f')],'defaultValue':0x0,'set':function(_0x4ace19){this[_0xdb65('0x14')](_0xdb65('0x20'),_0x4ace19);if(_0x4ace19){if(this[_0xdb65('0xe')](_0xdb65('0x21'))<0x2){this[_0xdb65('0x14')](_0xdb65('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xdb65('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xdb65('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0xdb65('0x10'),'progressive',_0xdb65('0x22'),'predictive',_0xdb65('0x11')),'defaultValue':_0xdb65('0x23'),'comment':_0xdb65('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xdb65('0x25')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xdb65('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xdb65('0x27')](0x2)[_0xdb65('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xdb65('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xdb65('0x3')](_0xdb65('0x29'),_0xdb65('0x2a')),'defaultValue':_0xdb65('0x2a'),'comment':_0xdb65('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xdb65('0x27')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xdb65('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xdb65('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdb65('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb65('0x2d')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0xdb65('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb65('0x2f')},'dialQueueProject':{'type':Sequelize[_0xdb65('0x1')],'comment':_0xdb65('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb65('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb65('0x32')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'comment':_0xdb65('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb65('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdb65('0x35')},'dialTimezone':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':_0xdb65('0x36')},'dialPrefix':{'type':Sequelize[_0xdb65('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xdb65('0x37'),_0xdb65('0x38'),'onlyIfOpen'),'defaultValue':_0xdb65('0x37')},'dialAMDActive':{'type':Sequelize[_0xdb65('0x1f')],'defaultValue':0x0,'comment':_0xdb65('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0xdb65('0x15')](0x9)[_0xdb65('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdb65('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0xdb65('0x15')](0x9)[_0xdb65('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdb65('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdb65('0x15')](0x9)[_0xdb65('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdb65('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xdb65('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xdb65('0x15')](0x9)[_0xdb65('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdb65('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdb65('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdb65('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xdb65('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdb65('0x15')](0x9)[_0xdb65('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xdb65('0x3')]('DESC',_0xdb65('0x40')),'defaultValue':_0xdb65('0x41')},'dialQueueProject2':{'type':Sequelize[_0xdb65('0x1')],'comment':_0xdb65('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xdb65('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xdb65('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdb65('0x42')},'dialCutDigit':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdb65('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xdb65('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb65('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb65('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb65('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb65('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb65('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0xdb65('0x15')](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdb65('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb65('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdb65('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdb65('0x15')](0x5)[_0xdb65('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdb65('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdb65('0x15')],'allowNull':!![],'comment':_0xdb65('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xdb65('0x1f')],'defaultValue':![],'comment':_0xdb65('0x4d'),'set':function(_0x49e5fb){if(!_0x49e5fb)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xdb65('0x14')](_0xdb65('0x4e'),_0x49e5fb);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xdb65('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xdb65('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xdb65('0x15')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 608b4ba..5f94b59 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 _0xbd10=['filters','intersection','model','attributes','fields','length','order','sort','filter','where','merge','options','include','findAll','rows','catch','show','params','create','body','role','QueueCampaigns','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','outbound','UserProfileSection','findOne','CmHopper','hasOwnProperty','VoiceQueueId','getHopperHistories','CmHopperHistory','nolimit','getHopperFinals','CmHopperFinal','pick','getHopperBlacks','CmHopperBlack','getTeams','teams','Team','Agents','voicePause','interface','flatMap','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','User','online','push','format','getAgents','getMembers','getLists','CmList','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','ListId','phone','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper_additional_phones','CmHopperId','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','get','VoiceQueues','inbound','map','value','type','error','name','index','VoiceQueue','rawAttributes','fieldName','key','keys','query'];(function(_0x789c04,_0x1a3609){var _0x379f82=function(_0x2e4169){while(--_0x2e4169){_0x789c04['push'](_0x789c04['shift']());}};_0x379f82(++_0x1a3609);}(_0xbd10,0x85));var _0x0bd1=function(_0x2431e3,_0x2492ae){_0x2431e3=_0x2431e3-0x0;var _0xbcca61=_0xbd10[_0x2431e3];return _0xbcca61;};'use strict';var emlformat=require(_0x0bd1('0x0'));var rimraf=require(_0x0bd1('0x1'));var zipdir=require(_0x0bd1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bd1('0x3'));var moment=require(_0x0bd1('0x4'));var BPromise=require(_0x0bd1('0x5'));var Mustache=require('mustache');var util=require(_0x0bd1('0x6'));var path=require(_0x0bd1('0x7'));var sox=require(_0x0bd1('0x8'));var csv=require(_0x0bd1('0x9'));var ejs=require(_0x0bd1('0xa'));var fs=require('fs');var fs_extra=require(_0x0bd1('0xb'));var _=require('lodash');var squel=require(_0x0bd1('0xc'));var crypto=require('crypto');var jsforce=require(_0x0bd1('0xd'));var deskjs=require(_0x0bd1('0xe'));var toCsv=require(_0x0bd1('0x9'));var querystring=require(_0x0bd1('0xf'));var Papa=require('papaparse');var Redis=require(_0x0bd1('0x10'));var authService=require(_0x0bd1('0x11'));var qs=require(_0x0bd1('0x12'));var as=require(_0x0bd1('0x13'));var hardwareService=require(_0x0bd1('0x14'));var logger=require(_0x0bd1('0x15'))('api');var utils=require(_0x0bd1('0x16'));var config=require(_0x0bd1('0x17'));var licenseUtil=require(_0x0bd1('0x18'));var db=require(_0x0bd1('0x19'))['db'];config[_0x0bd1('0x1a')]=_[_0x0bd1('0x1b')](config['redis'],{'host':_0x0bd1('0x1c'),'port':0x18eb});var socket=require(_0x0bd1('0x1d'))(new Redis(config[_0x0bd1('0x1a')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x3e2f49,_0x1d32cb){_0x1d32cb=_0x1d32cb||0xcc;return function(_0x1cdf80){if(_0x1cdf80){return _0x3e2f49['sendStatus'](_0x1d32cb);}return _0x3e2f49['status'](_0x1d32cb)[_0x0bd1('0x1e')]();};}function respondWithResult(_0x88e088,_0xc96c4d){_0xc96c4d=_0xc96c4d||0xc8;return function(_0x5ab359){if(_0x5ab359){return _0x88e088[_0x0bd1('0x1f')](_0xc96c4d)[_0x0bd1('0x20')](_0x5ab359);}};}function respondWithFilteredResult(_0x2f2969,_0x3042c6){return function(_0x4790eb){if(_0x4790eb){var _0x11479e=typeof _0x3042c6[_0x0bd1('0x21')]==='undefined'&&typeof _0x3042c6[_0x0bd1('0x22')]===_0x0bd1('0x23');var _0x59d106=_0x4790eb['count'];var _0x5ab684=_0x11479e?0x0:_0x3042c6[_0x0bd1('0x21')];var _0x313422=_0x11479e?_0x4790eb[_0x0bd1('0x24')]:_0x3042c6[_0x0bd1('0x21')]+_0x3042c6[_0x0bd1('0x22')];var _0xc5ece1;if(_0x313422>=_0x59d106){_0x313422=_0x59d106;_0xc5ece1=0xc8;}else{_0xc5ece1=0xce;}_0x2f2969[_0x0bd1('0x1f')](_0xc5ece1);return _0x2f2969['set'](_0x0bd1('0x25'),_0x5ab684+'-'+_0x313422+'/'+_0x59d106)[_0x0bd1('0x20')](_0x4790eb);}return null;};}function patchUpdates(_0x31eaf5){return function(_0x156f74){try{jsonpatch[_0x0bd1('0x26')](_0x156f74,_0x31eaf5,!![]);}catch(_0x569b09){return BPromise[_0x0bd1('0x27')](_0x569b09);}return _0x156f74['save']();};}function saveUpdates(_0x5f0742,_0x9bb815){return function(_0x27e9ad){if(_0x27e9ad){return _0x27e9ad[_0x0bd1('0x28')](_0x5f0742)[_0x0bd1('0x29')](function(_0x237f4a){return _0x237f4a;});}return null;};}function removeEntity(_0x16eb7b,_0x3e0c07){return function(_0x36273c){if(_0x36273c){return _0x36273c[_0x0bd1('0x2a')]()['then'](function(){var _0x5cb236=_0x36273c[_0x0bd1('0x2b')]({'plain':!![]});var _0x58d9a9=[{'name':_0x0bd1('0x2c'),'value':_0x0bd1('0x2d'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x569993=_(_0x58d9a9)['filter']('ignore')[_0x0bd1('0x2e')](_0x0bd1('0x2f'))[_0x0bd1('0x2f')]();if(_['includes'](_0x569993,_0x5cb236[_0x0bd1('0x30')])){return;}var _0xcf82bb=_['find'](_0x58d9a9,['value',_0x5cb236[_0x0bd1('0x30')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0xcf82bb,'resourceId':_0x5cb236['id']}})[_0x0bd1('0x29')](function(){return _0x36273c;});})[_0x0bd1('0x29')](function(){_0x16eb7b[_0x0bd1('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62b713,_0x2cd5c0){return function(_0x49bdf4){if(!_0x49bdf4){_0x62b713['sendStatus'](0x194);}return _0x49bdf4;};}function handleError(_0x28877b,_0x58f30f){_0x58f30f=_0x58f30f||0x1f4;return function(_0xf382fa){logger[_0x0bd1('0x31')](_0xf382fa['stack']);if(_0xf382fa[_0x0bd1('0x32')]){delete _0xf382fa[_0x0bd1('0x32')];}_0x28877b[_0x0bd1('0x1f')](_0x58f30f)['send'](_0xf382fa);};}exports[_0x0bd1('0x33')]=function(_0x4e79f4,_0x4628ba){var _0x2cc999={},_0x175f59={},_0x37345b={'count':0x0,'rows':[]};var _0x484195=_[_0x0bd1('0x2e')](db[_0x0bd1('0x34')][_0x0bd1('0x35')],function(_0x151fc8){return{'name':_0x151fc8[_0x0bd1('0x36')],'type':_0x151fc8[_0x0bd1('0x30')][_0x0bd1('0x37')]};});_0x175f59['model']=_[_0x0bd1('0x2e')](_0x484195,_0x0bd1('0x32'));_0x175f59['query']=_[_0x0bd1('0x38')](_0x4e79f4[_0x0bd1('0x39')]);_0x175f59[_0x0bd1('0x3a')]=_[_0x0bd1('0x3b')](_0x175f59[_0x0bd1('0x3c')],_0x175f59[_0x0bd1('0x39')]);_0x2cc999[_0x0bd1('0x3d')]=_[_0x0bd1('0x3b')](_0x175f59[_0x0bd1('0x3c')],qs[_0x0bd1('0x3e')](_0x4e79f4[_0x0bd1('0x39')][_0x0bd1('0x3e')]));_0x2cc999[_0x0bd1('0x3d')]=_0x2cc999[_0x0bd1('0x3d')][_0x0bd1('0x3f')]?_0x2cc999[_0x0bd1('0x3d')]:_0x175f59[_0x0bd1('0x3c')];if(!_0x4e79f4[_0x0bd1('0x39')]['hasOwnProperty']('nolimit')){_0x2cc999[_0x0bd1('0x22')]=qs[_0x0bd1('0x22')](_0x4e79f4[_0x0bd1('0x39')][_0x0bd1('0x22')]);_0x2cc999[_0x0bd1('0x21')]=qs[_0x0bd1('0x21')](_0x4e79f4['query']['offset']);}_0x2cc999[_0x0bd1('0x40')]=qs[_0x0bd1('0x41')](_0x4e79f4[_0x0bd1('0x39')][_0x0bd1('0x41')]);_0x2cc999['where']=qs[_0x0bd1('0x3a')](_['pick'](_0x4e79f4[_0x0bd1('0x39')],_0x175f59['filters']),_0x484195);if(_0x4e79f4[_0x0bd1('0x39')][_0x0bd1('0x42')]){_0x2cc999[_0x0bd1('0x43')]=_[_0x0bd1('0x44')](_0x2cc999['where'],{'$or':_[_0x0bd1('0x2e')](_0x484195,function(_0x3c7a23){if(_0x3c7a23[_0x0bd1('0x30')]!=='VIRTUAL'){var _0x2ebbe6={};_0x2ebbe6[_0x3c7a23[_0x0bd1('0x32')]]={'$like':'%'+_0x4e79f4[_0x0bd1('0x39')][_0x0bd1('0x42')]+'%'};return _0x2ebbe6;}})});}_0x2cc999=_[_0x0bd1('0x44')]({},_0x2cc999,_0x4e79f4[_0x0bd1('0x45')]);var _0x255aaa={'where':_0x2cc999[_0x0bd1('0x43')]};return db[_0x0bd1('0x34')][_0x0bd1('0x24')](_0x255aaa)[_0x0bd1('0x29')](function(_0x5ea824){_0x37345b['count']=_0x5ea824;if(_0x4e79f4[_0x0bd1('0x39')]['includeAll']){_0x2cc999[_0x0bd1('0x46')]=[{'all':!![]}];}return db['VoiceQueue'][_0x0bd1('0x47')](_0x2cc999);})[_0x0bd1('0x29')](function(_0x3123c7){_0x37345b[_0x0bd1('0x48')]=_0x3123c7;return _0x37345b;})[_0x0bd1('0x29')](respondWithFilteredResult(_0x4628ba,_0x2cc999))[_0x0bd1('0x49')](handleError(_0x4628ba,null));};exports[_0x0bd1('0x4a')]=function(_0x4430af,_0x10451a){var _0x3cc2f6={'raw':![],'where':{'id':_0x4430af[_0x0bd1('0x4b')]['id']}},_0x5d012a={};_0x5d012a[_0x0bd1('0x3c')]=_[_0x0bd1('0x38')](db[_0x0bd1('0x34')]['rawAttributes']);_0x5d012a['query']=_[_0x0bd1('0x38')](_0x4430af[_0x0bd1('0x39')]);_0x5d012a[_0x0bd1('0x3a')]=_['intersection'](_0x5d012a[_0x0bd1('0x3c')],_0x5d012a[_0x0bd1('0x39')]);_0x3cc2f6[_0x0bd1('0x3d')]=_[_0x0bd1('0x3b')](_0x5d012a['model'],qs['fields'](_0x4430af[_0x0bd1('0x39')]['fields']));_0x3cc2f6[_0x0bd1('0x3d')]=_0x3cc2f6['attributes'][_0x0bd1('0x3f')]?_0x3cc2f6['attributes']:_0x5d012a[_0x0bd1('0x3c')];if(_0x4430af[_0x0bd1('0x39')]['includeAll']){_0x3cc2f6['include']=[{'all':!![]}];}_0x3cc2f6=_[_0x0bd1('0x44')]({},_0x3cc2f6,_0x4430af[_0x0bd1('0x45')]);return db['VoiceQueue']['find'](_0x3cc2f6)[_0x0bd1('0x29')](handleEntityNotFound(_0x10451a,null))[_0x0bd1('0x29')](respondWithResult(_0x10451a,null))[_0x0bd1('0x49')](handleError(_0x10451a,null));};exports['create']=function(_0x57bea3,_0x1484dc){return db[_0x0bd1('0x34')][_0x0bd1('0x4c')](_0x57bea3[_0x0bd1('0x4d')],{})['then'](function(_0x296abc){var _0x576b7f=_0x57bea3['user'][_0x0bd1('0x2b')]({'plain':!![]});if(!_0x576b7f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x576b7f[_0x0bd1('0x4e')]==='user'){var _0x503bae=_0x296abc[_0x0bd1('0x2b')]({'plain':!![]});var _0x724e2f=[{'name':_0x0bd1('0x2c'),'value':'inbound'},{'name':_0x0bd1('0x4f'),'value':'outbound'}];var _0x2a6d46=_['find'](_0x724e2f,['value',_0x503bae[_0x0bd1('0x30')]])[_0x0bd1('0x32')];return db['UserProfileSection'][_0x0bd1('0x50')]({'where':{'name':_0x2a6d46,'userProfileId':_0x576b7f[_0x0bd1('0x51')]},'raw':!![]})['then'](function(_0x3b1ae5){if(_0x3b1ae5&&_0x3b1ae5[_0x0bd1('0x52')]===0x0){return db[_0x0bd1('0x53')][_0x0bd1('0x4c')]({'name':_0x503bae[_0x0bd1('0x32')],'resourceId':_0x503bae['id'],'type':_0x3b1ae5[_0x0bd1('0x32')],'sectionId':_0x3b1ae5['id']},{})[_0x0bd1('0x29')](function(){return _0x296abc;});}else{return _0x296abc;}})[_0x0bd1('0x49')](function(_0x129b1b){logger[_0x0bd1('0x31')](_0x0bd1('0x54'),_0x129b1b);throw _0x129b1b;});}return _0x296abc;})[_0x0bd1('0x29')](respondWithResult(_0x1484dc,0xc9))[_0x0bd1('0x49')](handleError(_0x1484dc,null));};exports[_0x0bd1('0x55')]=function(_0xcb00dc,_0x180a2f){var _0x4eccd6={'where':{'id':_0xcb00dc[_0x0bd1('0x4b')]['id']}},_0x5b2845={};_0x5b2845[_0x0bd1('0x3c')]=_[_0x0bd1('0x38')](db[_0x0bd1('0x34')][_0x0bd1('0x35')]);_0x4eccd6[_0x0bd1('0x3d')]=_[_0x0bd1('0x3b')](_0x5b2845['model'],qs['fields'](_0xcb00dc[_0x0bd1('0x39')][_0x0bd1('0x3e')]));_0x4eccd6[_0x0bd1('0x3d')]=_0x4eccd6[_0x0bd1('0x3d')]['length']?_0x4eccd6['attributes']:_0x5b2845[_0x0bd1('0x3c')];if(_0xcb00dc[_0x0bd1('0x39')][_0x0bd1('0x56')]){_0x4eccd6[_0x0bd1('0x46')]=[{'all':!![]}];}_0x4eccd6=_[_0x0bd1('0x44')]({},_0x4eccd6,_0xcb00dc[_0x0bd1('0x45')]);return db['VoiceQueue'][_0x0bd1('0x50')](_0x4eccd6)['then'](handleEntityNotFound(_0x180a2f,null))[_0x0bd1('0x29')](function(_0x1414bb){if(_0x1414bb){var _0x33812d=_0x1414bb[_0x0bd1('0x2b')]({'plain':!![]});_0x33812d=qs[_0x0bd1('0x57')](_0x33812d,['id',_0x0bd1('0x58'),_0x0bd1('0x59')]);_0xcb00dc['body']=_[_0x0bd1('0x57')](_0xcb00dc[_0x0bd1('0x4d')],['id',_0x0bd1('0x58'),'updatedAt']);return db[_0x0bd1('0x34')][_0x0bd1('0x4c')](_['merge'](_0x33812d,_0xcb00dc['body']),{'include':_0xcb00dc[_0x0bd1('0x39')][_0x0bd1('0x56')]?[{'all':!![]}]:undefined})['then'](function(_0x2eaa29){var _0x511f46=_0xcb00dc[_0x0bd1('0x5a')]['get']({'plain':!![]});if(!_0x511f46)throw new Error(_0x0bd1('0x5b'));if(_0x511f46[_0x0bd1('0x4e')]===_0x0bd1('0x5a')){var _0x12a77e=_0x2eaa29['get']({'plain':!![]});var _0x4129f9=[{'name':_0x0bd1('0x2c'),'value':_0x0bd1('0x2d')},{'name':'QueueCampaigns','value':_0x0bd1('0x5c')}];var _0x3acb60=_['find'](_0x4129f9,['value',_0x12a77e[_0x0bd1('0x30')]])[_0x0bd1('0x32')];return db[_0x0bd1('0x5d')][_0x0bd1('0x50')]({'where':{'name':_0x3acb60,'userProfileId':_0x511f46['userProfileId']},'raw':!![]})['then'](function(_0x3821f4){if(_0x3821f4&&_0x3821f4[_0x0bd1('0x52')]===0x0){return db['UserProfileResource'][_0x0bd1('0x4c')]({'name':_0x12a77e[_0x0bd1('0x32')],'resourceId':_0x12a77e['id'],'type':_0x3821f4[_0x0bd1('0x32')],'sectionId':_0x3821f4['id']},{})[_0x0bd1('0x29')](function(){return _0x2eaa29;});}else{return _0x2eaa29;}})['catch'](function(_0x565765){logger[_0x0bd1('0x31')](_0x0bd1('0x54'),_0x565765);throw _0x565765;});}return _0x2eaa29;});}})[_0x0bd1('0x29')](respondWithResult(_0x180a2f,0xc9))['catch'](handleError(_0x180a2f,null));};exports['update']=function(_0x4f708c,_0x20235d){if(_0x4f708c[_0x0bd1('0x4d')]['id']){delete _0x4f708c[_0x0bd1('0x4d')]['id'];}return db[_0x0bd1('0x34')][_0x0bd1('0x50')]({'where':{'id':_0x4f708c[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x20235d,null))[_0x0bd1('0x29')](saveUpdates(_0x4f708c[_0x0bd1('0x4d')],null))[_0x0bd1('0x29')](respondWithResult(_0x20235d,null))[_0x0bd1('0x49')](handleError(_0x20235d,null));};exports[_0x0bd1('0x2a')]=function(_0x52077c,_0x1f2162){return db['VoiceQueue'][_0x0bd1('0x50')]({'where':{'id':_0x52077c[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x1f2162,null))['then'](removeEntity(_0x1f2162,null))[_0x0bd1('0x49')](handleError(_0x1f2162,null));};exports['getHoppers']=function(_0x2de814,_0x3db28c,_0x3cf99d){var _0xc792a7={'raw':![],'where':{}};var _0x59e08d={};var _0x42fd8e={'count':0x0,'rows':[]};return db[_0x0bd1('0x34')][_0x0bd1('0x5e')]({'where':{'id':_0x2de814[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x3db28c,null))[_0x0bd1('0x29')](function(_0x36655e){if(_0x36655e){_0x59e08d[_0x0bd1('0x3c')]=_[_0x0bd1('0x38')](db[_0x0bd1('0x5f')][_0x0bd1('0x35')]);_0x59e08d[_0x0bd1('0x39')]=_[_0x0bd1('0x38')](_0x2de814[_0x0bd1('0x39')]);_0x59e08d[_0x0bd1('0x3a')]=_[_0x0bd1('0x3b')](_0x59e08d[_0x0bd1('0x3c')],_0x59e08d['query']);_0xc792a7[_0x0bd1('0x3d')]=_[_0x0bd1('0x3b')](_0x59e08d[_0x0bd1('0x3c')],qs[_0x0bd1('0x3e')](_0x2de814[_0x0bd1('0x39')][_0x0bd1('0x3e')]));_0xc792a7[_0x0bd1('0x3d')]=_0xc792a7['attributes']['length']?_0xc792a7[_0x0bd1('0x3d')]:_0x59e08d[_0x0bd1('0x3c')];if(!_0x2de814[_0x0bd1('0x39')][_0x0bd1('0x60')]('nolimit')){_0xc792a7[_0x0bd1('0x22')]=qs[_0x0bd1('0x22')](_0x2de814[_0x0bd1('0x39')]['limit']);_0xc792a7['offset']=qs[_0x0bd1('0x21')](_0x2de814['query'][_0x0bd1('0x21')]);}_0xc792a7[_0x0bd1('0x40')]=qs[_0x0bd1('0x41')](_0x2de814[_0x0bd1('0x39')][_0x0bd1('0x41')]);_0xc792a7[_0x0bd1('0x43')]=qs[_0x0bd1('0x3a')](_['pick'](_0x2de814['query'],_0x59e08d['filters']));_0xc792a7[_0x0bd1('0x43')][_0x0bd1('0x61')]=_0x36655e['id'];if(_0x2de814[_0x0bd1('0x39')]['filter']){_0xc792a7[_0x0bd1('0x43')]=_[_0x0bd1('0x44')](_0xc792a7['where'],{'$or':_[_0x0bd1('0x2e')](_0xc792a7[_0x0bd1('0x3d')],function(_0x6dc68d){var _0x52d001={};_0x52d001[_0x6dc68d]={'$like':'%'+_0x2de814[_0x0bd1('0x39')][_0x0bd1('0x42')]+'%'};return _0x52d001;})});}_0xc792a7=_[_0x0bd1('0x44')]({},_0xc792a7,_0x2de814[_0x0bd1('0x45')]);return db['CmHopper'][_0x0bd1('0x24')]({'where':_0xc792a7[_0x0bd1('0x43')]})[_0x0bd1('0x29')](function(_0x571707){_0x42fd8e[_0x0bd1('0x24')]=_0x571707;if(_0x2de814[_0x0bd1('0x39')][_0x0bd1('0x56')]){_0xc792a7[_0x0bd1('0x46')]=[{'all':!![]}];}return db['CmHopper'][_0x0bd1('0x47')](_0xc792a7);})[_0x0bd1('0x29')](function(_0x1e5b85){_0x42fd8e[_0x0bd1('0x48')]=_0x1e5b85;return _0x42fd8e;});}})[_0x0bd1('0x29')](respondWithFilteredResult(_0x3db28c,_0xc792a7))[_0x0bd1('0x49')](handleError(_0x3db28c,null));};exports[_0x0bd1('0x62')]=function(_0x5b56e4,_0x271fe4,_0x1dacc7){var _0x405dc2={'raw':!![],'where':{}};var _0xfb6016={};var _0x20ab8f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0bd1('0x5e')]({'where':{'id':_0x5b56e4[_0x0bd1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x271fe4,null))['then'](function(_0x2efc04){if(_0x2efc04){_0xfb6016['model']=_[_0x0bd1('0x38')](db[_0x0bd1('0x63')][_0x0bd1('0x35')]);_0xfb6016[_0x0bd1('0x39')]=_[_0x0bd1('0x38')](_0x5b56e4['query']);_0xfb6016[_0x0bd1('0x3a')]=_['intersection'](_0xfb6016[_0x0bd1('0x3c')],_0xfb6016[_0x0bd1('0x39')]);_0x405dc2[_0x0bd1('0x3d')]=_[_0x0bd1('0x3b')](_0xfb6016[_0x0bd1('0x3c')],qs['fields'](_0x5b56e4[_0x0bd1('0x39')][_0x0bd1('0x3e')]));_0x405dc2[_0x0bd1('0x3d')]=_0x405dc2[_0x0bd1('0x3d')][_0x0bd1('0x3f')]?_0x405dc2['attributes']:_0xfb6016[_0x0bd1('0x3c')];if(!_0x5b56e4[_0x0bd1('0x39')]['hasOwnProperty'](_0x0bd1('0x64'))){_0x405dc2[_0x0bd1('0x22')]=qs[_0x0bd1('0x22')](_0x5b56e4[_0x0bd1('0x39')]['limit']);_0x405dc2[_0x0bd1('0x21')]=qs['offset'](_0x5b56e4[_0x0bd1('0x39')][_0x0bd1('0x21')]);}_0x405dc2[_0x0bd1('0x40')]=qs[_0x0bd1('0x41')](_0x5b56e4[_0x0bd1('0x39')]['sort']);_0x405dc2[_0x0bd1('0x43')]=qs['filters'](_['pick'](_0x5b56e4[_0x0bd1('0x39')],_0xfb6016['filters']));_0x405dc2[_0x0bd1('0x43')][_0x0bd1('0x61')]=_0x2efc04['id'];if(_0x5b56e4['query'][_0x0bd1('0x42')]){_0x405dc2['where']=_['merge'](_0x405dc2[_0x0bd1('0x43')],{'$or':_[_0x0bd1('0x2e')](_0x405dc2[_0x0bd1('0x3d')],function(_0x36858c){var _0x2e37a2={};_0x2e37a2[_0x36858c]={'$like':'%'+_0x5b56e4[_0x0bd1('0x39')][_0x0bd1('0x42')]+'%'};return _0x2e37a2;})});}_0x405dc2=_[_0x0bd1('0x44')]({},_0x405dc2,_0x5b56e4[_0x0bd1('0x45')]);return db[_0x0bd1('0x63')]['count']({'where':_0x405dc2[_0x0bd1('0x43')]})[_0x0bd1('0x29')](function(_0x592f25){_0x20ab8f[_0x0bd1('0x24')]=_0x592f25;if(_0x5b56e4[_0x0bd1('0x39')][_0x0bd1('0x56')]){_0x405dc2[_0x0bd1('0x46')]=[{'all':!![]}];}return db[_0x0bd1('0x63')][_0x0bd1('0x47')](_0x405dc2);})[_0x0bd1('0x29')](function(_0x225799){_0x20ab8f['rows']=_0x225799;return _0x20ab8f;});}})[_0x0bd1('0x29')](respondWithFilteredResult(_0x271fe4,_0x405dc2))[_0x0bd1('0x49')](handleError(_0x271fe4,null));};exports[_0x0bd1('0x65')]=function(_0x344072,_0x22a1ee,_0x384192){var _0x29a658={'raw':!![],'where':{}};var _0x5d29c4={};var _0x3869f9={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x344072[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x22a1ee,null))[_0x0bd1('0x29')](function(_0x47ab0f){if(_0x47ab0f){_0x5d29c4['model']=_['keys'](db[_0x0bd1('0x66')][_0x0bd1('0x35')]);_0x5d29c4[_0x0bd1('0x39')]=_[_0x0bd1('0x38')](_0x344072[_0x0bd1('0x39')]);_0x5d29c4['filters']=_[_0x0bd1('0x3b')](_0x5d29c4[_0x0bd1('0x3c')],_0x5d29c4[_0x0bd1('0x39')]);_0x29a658['attributes']=_[_0x0bd1('0x3b')](_0x5d29c4[_0x0bd1('0x3c')],qs[_0x0bd1('0x3e')](_0x344072[_0x0bd1('0x39')]['fields']));_0x29a658[_0x0bd1('0x3d')]=_0x29a658[_0x0bd1('0x3d')]['length']?_0x29a658['attributes']:_0x5d29c4['model'];if(!_0x344072['query'][_0x0bd1('0x60')](_0x0bd1('0x64'))){_0x29a658[_0x0bd1('0x22')]=qs[_0x0bd1('0x22')](_0x344072[_0x0bd1('0x39')]['limit']);_0x29a658[_0x0bd1('0x21')]=qs[_0x0bd1('0x21')](_0x344072[_0x0bd1('0x39')]['offset']);}_0x29a658[_0x0bd1('0x40')]=qs[_0x0bd1('0x41')](_0x344072[_0x0bd1('0x39')][_0x0bd1('0x41')]);_0x29a658[_0x0bd1('0x43')]=qs['filters'](_[_0x0bd1('0x67')](_0x344072[_0x0bd1('0x39')],_0x5d29c4[_0x0bd1('0x3a')]));_0x29a658['where'][_0x0bd1('0x61')]=_0x47ab0f['id'];if(_0x344072['query']['filter']){_0x29a658[_0x0bd1('0x43')]=_[_0x0bd1('0x44')](_0x29a658[_0x0bd1('0x43')],{'$or':_[_0x0bd1('0x2e')](_0x29a658[_0x0bd1('0x3d')],function(_0x28f06b){var _0x1b7377={};_0x1b7377[_0x28f06b]={'$like':'%'+_0x344072['query'][_0x0bd1('0x42')]+'%'};return _0x1b7377;})});}_0x29a658=_[_0x0bd1('0x44')]({},_0x29a658,_0x344072[_0x0bd1('0x45')]);return db['CmHopperFinal'][_0x0bd1('0x24')]({'where':_0x29a658[_0x0bd1('0x43')]})[_0x0bd1('0x29')](function(_0x1de753){_0x3869f9[_0x0bd1('0x24')]=_0x1de753;if(_0x344072[_0x0bd1('0x39')][_0x0bd1('0x56')]){_0x29a658[_0x0bd1('0x46')]=[{'all':!![]}];}return db[_0x0bd1('0x66')][_0x0bd1('0x47')](_0x29a658);})[_0x0bd1('0x29')](function(_0x1cbdcc){_0x3869f9[_0x0bd1('0x48')]=_0x1cbdcc;return _0x3869f9;});}})[_0x0bd1('0x29')](respondWithFilteredResult(_0x22a1ee,_0x29a658))[_0x0bd1('0x49')](handleError(_0x22a1ee,null));};exports[_0x0bd1('0x68')]=function(_0x30b845,_0x38a30c,_0xb3f17){var _0x489cdb={'raw':!![],'where':{}};var _0x5f20ba={};var _0x580994={'count':0x0,'rows':[]};return db[_0x0bd1('0x34')][_0x0bd1('0x5e')]({'where':{'id':_0x30b845[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x38a30c,null))[_0x0bd1('0x29')](function(_0x3c989d){if(_0x3c989d){_0x5f20ba[_0x0bd1('0x3c')]=_[_0x0bd1('0x38')](db[_0x0bd1('0x69')]['rawAttributes']);_0x5f20ba['query']=_[_0x0bd1('0x38')](_0x30b845[_0x0bd1('0x39')]);_0x5f20ba[_0x0bd1('0x3a')]=_[_0x0bd1('0x3b')](_0x5f20ba[_0x0bd1('0x3c')],_0x5f20ba['query']);_0x489cdb[_0x0bd1('0x3d')]=_[_0x0bd1('0x3b')](_0x5f20ba[_0x0bd1('0x3c')],qs[_0x0bd1('0x3e')](_0x30b845[_0x0bd1('0x39')][_0x0bd1('0x3e')]));_0x489cdb[_0x0bd1('0x3d')]=_0x489cdb['attributes']['length']?_0x489cdb[_0x0bd1('0x3d')]:_0x5f20ba[_0x0bd1('0x3c')];if(!_0x30b845[_0x0bd1('0x39')][_0x0bd1('0x60')](_0x0bd1('0x64'))){_0x489cdb[_0x0bd1('0x22')]=qs[_0x0bd1('0x22')](_0x30b845[_0x0bd1('0x39')][_0x0bd1('0x22')]);_0x489cdb[_0x0bd1('0x21')]=qs[_0x0bd1('0x21')](_0x30b845['query'][_0x0bd1('0x21')]);}_0x489cdb['order']=qs['sort'](_0x30b845[_0x0bd1('0x39')][_0x0bd1('0x41')]);_0x489cdb[_0x0bd1('0x43')]=qs[_0x0bd1('0x3a')](_[_0x0bd1('0x67')](_0x30b845[_0x0bd1('0x39')],_0x5f20ba[_0x0bd1('0x3a')]));_0x489cdb[_0x0bd1('0x43')]['VoiceQueueId']=_0x3c989d['id'];if(_0x30b845['query']['filter']){_0x489cdb['where']=_[_0x0bd1('0x44')](_0x489cdb['where'],{'$or':_[_0x0bd1('0x2e')](_0x489cdb[_0x0bd1('0x3d')],function(_0x5b0e64){var _0xe50c4e={};_0xe50c4e[_0x5b0e64]={'$like':'%'+_0x30b845[_0x0bd1('0x39')][_0x0bd1('0x42')]+'%'};return _0xe50c4e;})});}_0x489cdb=_[_0x0bd1('0x44')]({},_0x489cdb,_0x30b845[_0x0bd1('0x45')]);return db[_0x0bd1('0x69')][_0x0bd1('0x24')]({'where':_0x489cdb[_0x0bd1('0x43')]})['then'](function(_0x46058e){_0x580994['count']=_0x46058e;if(_0x30b845[_0x0bd1('0x39')][_0x0bd1('0x56')]){_0x489cdb[_0x0bd1('0x46')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0bd1('0x47')](_0x489cdb);})[_0x0bd1('0x29')](function(_0x4eeec0){_0x580994['rows']=_0x4eeec0;return _0x580994;});}})[_0x0bd1('0x29')](respondWithFilteredResult(_0x38a30c,_0x489cdb))[_0x0bd1('0x49')](handleError(_0x38a30c,null));};exports[_0x0bd1('0x6a')]=function(_0x4a4c82,_0x3ef38a,_0xb94415){var _0x5079ab={};var _0x24a828={};var _0xb15a25;var _0x2d05e5;return db[_0x0bd1('0x34')][_0x0bd1('0x5e')]({'where':{'id':_0x4a4c82[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x3ef38a,null))[_0x0bd1('0x29')](function(_0x58e020){if(_0x58e020){_0xb15a25=_0x58e020;_0x24a828[_0x0bd1('0x3c')]=_[_0x0bd1('0x38')](db['Team'][_0x0bd1('0x35')]);_0x24a828[_0x0bd1('0x39')]=_['keys'](_0x4a4c82[_0x0bd1('0x39')]);_0x24a828['filters']=_[_0x0bd1('0x3b')](_0x24a828[_0x0bd1('0x3c')],_0x24a828[_0x0bd1('0x39')]);_0x5079ab[_0x0bd1('0x3d')]=_[_0x0bd1('0x3b')](_0x24a828[_0x0bd1('0x3c')],qs[_0x0bd1('0x3e')](_0x4a4c82[_0x0bd1('0x39')][_0x0bd1('0x3e')]));_0x5079ab[_0x0bd1('0x3d')]=_0x5079ab[_0x0bd1('0x3d')][_0x0bd1('0x3f')]?_0x5079ab[_0x0bd1('0x3d')]:_0x24a828[_0x0bd1('0x3c')];_0x5079ab[_0x0bd1('0x40')]=qs[_0x0bd1('0x41')](_0x4a4c82['query'][_0x0bd1('0x41')]);_0x5079ab['where']=qs['filters'](_[_0x0bd1('0x67')](_0x4a4c82[_0x0bd1('0x39')],_0x24a828['filters']));if(_0x4a4c82[_0x0bd1('0x39')][_0x0bd1('0x42')]){_0x5079ab[_0x0bd1('0x43')]=_['merge'](_0x5079ab[_0x0bd1('0x43')],{'$or':_[_0x0bd1('0x2e')](_0x5079ab[_0x0bd1('0x3d')],function(_0x58e80c){var _0x49933f={};_0x49933f[_0x58e80c]={'$like':'%'+_0x4a4c82[_0x0bd1('0x39')][_0x0bd1('0x42')]+'%'};return _0x49933f;})});}_0x5079ab=_['merge']({},_0x5079ab,_0x4a4c82[_0x0bd1('0x45')]);return _0xb15a25[_0x0bd1('0x6a')](_0x5079ab);}})[_0x0bd1('0x29')](function(_0x50219b){if(_0x50219b){_0x2d05e5=_0x50219b[_0x0bd1('0x3f')];if(!_0x4a4c82[_0x0bd1('0x39')][_0x0bd1('0x60')](_0x0bd1('0x64'))){_0x5079ab[_0x0bd1('0x22')]=qs[_0x0bd1('0x22')](_0x4a4c82['query']['limit']);_0x5079ab[_0x0bd1('0x21')]=qs[_0x0bd1('0x21')](_0x4a4c82[_0x0bd1('0x39')]['offset']);}return _0xb15a25[_0x0bd1('0x6a')](_0x5079ab);}})['then'](function(_0x305a6e){if(_0x305a6e){return _0x305a6e?{'count':_0x2d05e5,'rows':_0x305a6e}:null;}})[_0x0bd1('0x29')](respondWithResult(_0x3ef38a,null))[_0x0bd1('0x49')](handleError(_0x3ef38a,null));};exports['addTeams']=function(_0x4ceed4,_0x271b15,_0x46a9b7){var _0xe924a7=_0x4ceed4['body'][_0x0bd1('0x6b')];var _0x19b359=_[_0x0bd1('0x2e')](_0xe924a7,'id');return db[_0x0bd1('0x6c')][_0x0bd1('0x47')]({'where':{'id':_0x19b359},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0bd1('0x6d'),'attributes':['id',_0x0bd1('0x32'),'online',_0x0bd1('0x6e'),_0x0bd1('0x6f')],'raw':!![]}]})[_0x0bd1('0x29')](function(_0x1cf984){if(_0x1cf984){var _0x3fce17=_[_0x0bd1('0x70')](_0x1cf984,function(_0x5431e2){var _0x20be67=_0x5431e2[_0x0bd1('0x2b')]({'plain':!![]});_0x20be67[_0x0bd1('0x6d')]['forEach'](function(_0x10716c){_0x10716c[_0x0bd1('0x71')]=_[_0x0bd1('0x50')](_0xe924a7,{'id':_0x20be67['id']})[_0x0bd1('0x71')];});return _0x20be67[_0x0bd1('0x6d')];});return db[_0x0bd1('0x34')]['find']({'where':{'id':_0x4ceed4['params']['id']}})['then'](function(_0x91186){return db[_0x0bd1('0x72')][_0x0bd1('0x73')](function(_0x5b14fd){return _0x91186[_0x0bd1('0x74')](_0x19b359,{'transaction':_0x5b14fd})['then'](function(){return BPromise[_0x0bd1('0x75')](_0xe924a7,function(_0x5ef3bd){return db[_0x0bd1('0x76')][_0x0bd1('0x77')]({'TeamId':_0x5ef3bd['id'],'VoiceQueueId':_0x4ceed4['params']['id'],'penalty':_0x5ef3bd[_0x0bd1('0x71')]},{'transaction':_0x5b14fd});});})[_0x0bd1('0x29')](function(){return BPromise[_0x0bd1('0x75')](_0x3fce17,function(_0x2b2711){return db[_0x0bd1('0x78')][_0x0bd1('0x79')]({'where':{'UserId':_0x2b2711['id'],'VoiceQueueId':_0x4ceed4[_0x0bd1('0x4b')]['id']},'defaults':{'penalty':_0x2b2711[_0x0bd1('0x71')]},'transaction':_0x5b14fd});});})[_0x0bd1('0x29')](function(){return BPromise['each'](_[_0x0bd1('0x42')](_0x3fce17,{'online':!![]}),function(_0x2bfa72){return db[_0x0bd1('0x7a')][_0x0bd1('0x77')]({'membername':_0x2bfa72['name'],'UserId':_0x2bfa72['id'],'queue_name':_0x91186['name'],'VoiceQueueId':_0x91186['id'],'interface':_[_0x0bd1('0x7b')](_0x2bfa72[_0x0bd1('0x6f')])?util['format'](_0x0bd1('0x7c'),_0x2bfa72[_0x0bd1('0x32')]):_0x2bfa72[_0x0bd1('0x6f')],'paused':_0x2bfa72[_0x0bd1('0x6e')]||![],'penalty':_0x2bfa72[_0x0bd1('0x71')]},{'transaction':_0x5b14fd});});})['then'](function(){_0x3fce17[_0x0bd1('0x7d')](function(_0x49ed8d){socket[_0x0bd1('0x7e')](_0x0bd1('0x7f'),{'UserId':_0x49ed8d['id'],'VoiceQueueId':_0x91186['id']});});});});});}})['then'](respondWithStatusCode(_0x271b15,null))['catch'](handleError(_0x271b15,null));};exports[_0x0bd1('0x80')]=function(_0x52feec,_0x2d45f0,_0x2cc791){return db[_0x0bd1('0x6c')][_0x0bd1('0x47')]({'where':{'id':_0x52feec[_0x0bd1('0x39')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0bd1('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x0bd1('0x29')](handleEntityNotFound(_0x2d45f0,null))[_0x0bd1('0x29')](function(_0x38e446){var _0x1c5052=_[_0x0bd1('0x2e')](_0x38e446,'id');var _0x14d129=[];var _0x31a078=[];var _0x725a33=squel[_0x0bd1('0x81')]();_0x725a33[_0x0bd1('0x82')](_0x0bd1('0x83'))[_0x0bd1('0x84')](_0x0bd1('0x85'),'tq')[_0x0bd1('0x86')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x0bd1('0x87'),_0x52feec[_0x0bd1('0x4b')]['id']);for(var _0xe3f67c=0x0;_0xe3f67c<_0x38e446['length'];_0xe3f67c+=0x1){let _0x1c126e=_0x38e446[_0xe3f67c];for(var _0x5397a3=0x0;_0x5397a3<_0x1c126e[_0x0bd1('0x6d')][_0x0bd1('0x3f')];_0x5397a3+=0x1){let _0x35c0eb=_0x1c126e['Agents'][_0x5397a3];var _0xe63a00=_0x725a33['clone']();_0xe63a00[_0x0bd1('0x43')]('ut.UserId\x20=\x20?',_0x35c0eb['id']);_0x31a078['push'](db[_0x0bd1('0x72')][_0x0bd1('0x39')](_0xe63a00[_0x0bd1('0x88')](),{'type':db['sequelize'][_0x0bd1('0x89')][_0x0bd1('0x8a')]})[_0x0bd1('0x29')](function(_0x2cee86){if(_0x2cee86[_0x0bd1('0x3f')]===0x1){return _0x35c0eb['id'];}else{var _0x58fef4=_[_0x0bd1('0x8b')](_['map'](_0x2cee86,_0x0bd1('0x8c')),function(_0x4ce7ce){return _[_0x0bd1('0x8d')](_0x1c5052,_0x4ce7ce);});if(_0x58fef4){return _0x35c0eb['id'];}}}));}}return BPromise[_0x0bd1('0x8e')](_0x31a078)['then'](function(_0x386bfb){_0x14d129=_(_0x14d129)[_0x0bd1('0x8f')](_0x386bfb)[_0x0bd1('0x90')]()[_0x0bd1('0x2f')]();return db[_0x0bd1('0x34')][_0x0bd1('0x50')]({'where':{'id':_0x52feec['params']['id']}})[_0x0bd1('0x29')](function(_0x5d65b7){return db[_0x0bd1('0x72')][_0x0bd1('0x73')](function(_0x3923f3){return _0x5d65b7[_0x0bd1('0x80')](_0x52feec[_0x0bd1('0x39')][_0x0bd1('0x91')],{'transaction':_0x3923f3})[_0x0bd1('0x29')](function(){if(!_[_0x0bd1('0x92')](_0x14d129)){return _0x5d65b7[_0x0bd1('0x93')](_0x14d129,{'transaction':_0x3923f3})[_0x0bd1('0x29')](function(){return db[_0x0bd1('0x7a')][_0x0bd1('0x2a')]({'where':{'VoiceQueueId':_0x52feec[_0x0bd1('0x4b')]['id'],'UserId':_0x14d129},'transaction':_0x3923f3});});}})['then'](function(){_0x14d129[_0x0bd1('0x7d')](function(_0x3c6d8d){socket[_0x0bd1('0x7e')](_0x0bd1('0x94'),{'UserId':_0x3c6d8d,'VoiceQueueId':_0x5d65b7['id']});});});});});});})[_0x0bd1('0x29')](respondWithStatusCode(_0x2d45f0,null))['catch'](handleError(_0x2d45f0,null));};exports[_0x0bd1('0x95')]=function(_0x3bbf84,_0x4a572b,_0x1b4f1f){var _0xe1211,_0x5d6746;return db[_0x0bd1('0x34')][_0x0bd1('0x50')]({'where':{'id':_0x3bbf84[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x4a572b,null))[_0x0bd1('0x29')](function(_0x4bc5d6){if(_0x4bc5d6){_0x5d6746=_0x4bc5d6;return _0x4bc5d6[_0x0bd1('0x95')](_0x3bbf84[_0x0bd1('0x4d')][_0x0bd1('0x91')],_[_0x0bd1('0x57')](_0x3bbf84['body'],[_0x0bd1('0x91'),'id'])||{})[_0x0bd1('0x96')](function(_0x41f004){for(var _0x25664d=0x0;_0x25664d<_0x3bbf84[_0x0bd1('0x4d')]['ids'][_0x0bd1('0x3f')];_0x25664d+=0x1){socket[_0x0bd1('0x7e')](_0x0bd1('0x7f'),{'UserId':Number(_0x3bbf84['body'][_0x0bd1('0x91')][_0x25664d]),'VoiceQueueId':Number(_0x3bbf84['params']['id'])});}return _0x41f004;});}})[_0x0bd1('0x29')](function(_0x350cec){_0xe1211=_0x350cec||[];if(_0x5d6746){return db[_0x0bd1('0x97')][_0x0bd1('0x47')]({'where':{'id':_0x3bbf84['body'][_0x0bd1('0x91')]},'attributes':['id',_0x0bd1('0x32'),_0x0bd1('0x98'),_0x0bd1('0x6e'),'interface'],'raw':!![]});}})[_0x0bd1('0x29')](function(_0x474f6c){if(!_['isEmpty'](_0x474f6c)){var _0x1f96a3=[];for(var _0x175c31=0x0;_0x175c31<_0x474f6c['length'];_0x175c31++){if(_0x474f6c[_0x175c31][_0x0bd1('0x98')]){_0x1f96a3[_0x0bd1('0x99')](db[_0x0bd1('0x7a')][_0x0bd1('0x77')]({'membername':_0x474f6c[_0x175c31][_0x0bd1('0x32')],'UserId':_0x474f6c[_0x175c31]['id'],'queue_name':_0x5d6746[_0x0bd1('0x32')],'VoiceQueueId':_0x5d6746['id'],'interface':_[_0x0bd1('0x7b')](_0x474f6c[_0x175c31][_0x0bd1('0x6f')])?util[_0x0bd1('0x9a')]('SIP/%s',_0x474f6c[_0x175c31][_0x0bd1('0x32')]):_0x474f6c[_0x175c31][_0x0bd1('0x6f')],'paused':_0x474f6c[_0x175c31][_0x0bd1('0x6e')]||![],'penalty':_0x3bbf84[_0x0bd1('0x4d')]['penalty']||0x0}));}}return BPromise[_0x0bd1('0x8e')](_0x1f96a3);}})[_0x0bd1('0x29')](function(){return _0xe1211;})[_0x0bd1('0x29')](respondWithResult(_0x4a572b,null))[_0x0bd1('0x49')](handleError(_0x4a572b,null));};exports['removeAgents']=function(_0x55e487,_0x421fbb,_0x2d3dbe){return db['VoiceQueue'][_0x0bd1('0x50')]({'where':{'id':_0x55e487[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x421fbb,null))['then'](function(_0x15784c){if(_0x15784c){return _0x15784c['removeAgents'](_0x55e487['query'][_0x0bd1('0x91')])[_0x0bd1('0x29')](function(){if(_['isArray'](_0x55e487[_0x0bd1('0x39')][_0x0bd1('0x91')])){for(var _0x8262f2=0x0;_0x8262f2<_0x55e487[_0x0bd1('0x39')][_0x0bd1('0x91')]['length'];_0x8262f2+=0x1){socket[_0x0bd1('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x55e487[_0x0bd1('0x39')][_0x0bd1('0x91')][_0x8262f2]),'VoiceQueueId':Number(_0x55e487[_0x0bd1('0x4b')]['id'])});}}else{socket[_0x0bd1('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x55e487[_0x0bd1('0x39')][_0x0bd1('0x91')]),'VoiceQueueId':Number(_0x55e487[_0x0bd1('0x4b')]['id'])});}});}})[_0x0bd1('0x29')](function(_0x2ccdbf){return db[_0x0bd1('0x7a')][_0x0bd1('0x2a')]({'where':{'VoiceQueueId':_0x55e487[_0x0bd1('0x4b')]['id'],'UserId':_0x55e487[_0x0bd1('0x39')][_0x0bd1('0x91')]}})[_0x0bd1('0x29')](function(){return _0x2ccdbf;});})['then'](respondWithStatusCode(_0x421fbb,null))['catch'](handleError(_0x421fbb,null));};exports[_0x0bd1('0x9b')]=function(_0x2e84be,_0x4bcb69,_0x5ca259){var _0x2b1dbb={};var _0x4981c9={};var _0x549f0c;var _0x69afd;return db[_0x0bd1('0x34')][_0x0bd1('0x5e')]({'where':{'id':_0x2e84be[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x4bcb69,null))[_0x0bd1('0x29')](function(_0x273ec4){if(_0x273ec4){_0x549f0c=_0x273ec4;_0x4981c9[_0x0bd1('0x3c')]=_[_0x0bd1('0x38')](db[_0x0bd1('0x97')][_0x0bd1('0x35')]);_0x4981c9['query']=_[_0x0bd1('0x38')](_0x2e84be[_0x0bd1('0x39')]);_0x4981c9[_0x0bd1('0x3a')]=_['intersection'](_0x4981c9[_0x0bd1('0x3c')],_0x4981c9[_0x0bd1('0x39')]);_0x2b1dbb[_0x0bd1('0x3d')]=_['intersection'](_0x4981c9[_0x0bd1('0x3c')],qs['fields'](_0x2e84be['query'][_0x0bd1('0x3e')]));_0x2b1dbb['attributes']=_0x2b1dbb[_0x0bd1('0x3d')][_0x0bd1('0x3f')]?_0x2b1dbb[_0x0bd1('0x3d')]:_0x4981c9[_0x0bd1('0x3c')];_0x2b1dbb[_0x0bd1('0x40')]=qs[_0x0bd1('0x41')](_0x2e84be['query']['sort']);_0x2b1dbb['where']=qs[_0x0bd1('0x3a')](_[_0x0bd1('0x67')](_0x2e84be[_0x0bd1('0x39')],_0x4981c9[_0x0bd1('0x3a')]));if(_0x2e84be[_0x0bd1('0x39')]['filter']){_0x2b1dbb[_0x0bd1('0x43')]=_[_0x0bd1('0x44')](_0x2b1dbb['where'],{'$or':_['map'](_0x2b1dbb[_0x0bd1('0x3d')],function(_0x5f0f47){var _0x2ef7dc={};_0x2ef7dc[_0x5f0f47]={'$like':'%'+_0x2e84be[_0x0bd1('0x39')][_0x0bd1('0x42')]+'%'};return _0x2ef7dc;})});}_0x2b1dbb=_['merge']({},_0x2b1dbb,_0x2e84be['options']);return _0x549f0c[_0x0bd1('0x9b')](_0x2b1dbb);}})[_0x0bd1('0x29')](function(_0x52c324){if(_0x52c324){_0x69afd=_0x52c324['length'];if(!_0x2e84be[_0x0bd1('0x39')][_0x0bd1('0x60')]('nolimit')){_0x2b1dbb[_0x0bd1('0x22')]=qs[_0x0bd1('0x22')](_0x2e84be[_0x0bd1('0x39')]['limit']);_0x2b1dbb[_0x0bd1('0x21')]=qs[_0x0bd1('0x21')](_0x2e84be[_0x0bd1('0x39')][_0x0bd1('0x21')]);}return _0x549f0c[_0x0bd1('0x9b')](_0x2b1dbb);}})[_0x0bd1('0x29')](function(_0x2e8339){if(_0x2e8339){return _0x2e8339?{'count':_0x69afd,'rows':_0x2e8339}:null;}})[_0x0bd1('0x29')](respondWithResult(_0x4bcb69,null))[_0x0bd1('0x49')](handleError(_0x4bcb69,null));};exports['getMembers']=function(_0x260617,_0x47b0c7,_0x494612){var _0x386d5c={};var _0x4cf5d6={};var _0x132768;var _0x321438;return db[_0x0bd1('0x34')][_0x0bd1('0x5e')]({'where':{'id':_0x260617[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x47b0c7,null))[_0x0bd1('0x29')](function(_0x343ffc){if(_0x343ffc){_0x132768=_0x343ffc;_0x4cf5d6[_0x0bd1('0x3c')]=_['keys'](db[_0x0bd1('0x7a')][_0x0bd1('0x35')]);_0x4cf5d6[_0x0bd1('0x39')]=_[_0x0bd1('0x38')](_0x260617['query']);_0x4cf5d6[_0x0bd1('0x3a')]=_[_0x0bd1('0x3b')](_0x4cf5d6['model'],_0x4cf5d6['query']);_0x386d5c[_0x0bd1('0x3d')]=_[_0x0bd1('0x3b')](_0x4cf5d6[_0x0bd1('0x3c')],qs['fields'](_0x260617[_0x0bd1('0x39')][_0x0bd1('0x3e')]));_0x386d5c[_0x0bd1('0x3d')]=_0x386d5c[_0x0bd1('0x3d')][_0x0bd1('0x3f')]?_0x386d5c[_0x0bd1('0x3d')]:_0x4cf5d6['model'];_0x386d5c['order']=qs[_0x0bd1('0x41')](_0x260617['query'][_0x0bd1('0x41')]);_0x386d5c['where']=qs[_0x0bd1('0x3a')](_[_0x0bd1('0x67')](_0x260617[_0x0bd1('0x39')],_0x4cf5d6[_0x0bd1('0x3a')]));if(_0x260617['query'][_0x0bd1('0x42')]){_0x386d5c[_0x0bd1('0x43')]=_[_0x0bd1('0x44')](_0x386d5c['where'],{'$or':_['map'](_0x386d5c[_0x0bd1('0x3d')],function(_0x4628e4){var _0x13d9c9={};_0x13d9c9[_0x4628e4]={'$like':'%'+_0x260617[_0x0bd1('0x39')]['filter']+'%'};return _0x13d9c9;})});}_0x386d5c=_[_0x0bd1('0x44')]({},_0x386d5c,_0x260617[_0x0bd1('0x45')]);return _0x132768[_0x0bd1('0x9c')](_0x386d5c);}})[_0x0bd1('0x29')](function(_0x242863){if(_0x242863){_0x321438=_0x242863[_0x0bd1('0x3f')];if(!_0x260617['query'][_0x0bd1('0x60')](_0x0bd1('0x64'))){_0x386d5c[_0x0bd1('0x22')]=qs[_0x0bd1('0x22')](_0x260617[_0x0bd1('0x39')][_0x0bd1('0x22')]);_0x386d5c['offset']=qs[_0x0bd1('0x21')](_0x260617[_0x0bd1('0x39')][_0x0bd1('0x21')]);}return _0x132768[_0x0bd1('0x9c')](_0x386d5c);}})[_0x0bd1('0x29')](function(_0x29258f){return _0x29258f?{'count':_0x321438,'rows':_0x29258f}:null;})[_0x0bd1('0x29')](respondWithResult(_0x47b0c7,null))[_0x0bd1('0x49')](handleError(_0x47b0c7,null));};exports[_0x0bd1('0x9d')]=function(_0x895687,_0x233200,_0x499250){var _0x5905c9={};var _0x1356bf={};var _0x6e8e92;var _0x187be6;return db[_0x0bd1('0x34')][_0x0bd1('0x5e')]({'where':{'id':_0x895687[_0x0bd1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x233200,null))['then'](function(_0x215144){if(_0x215144){_0x6e8e92=_0x215144;_0x1356bf[_0x0bd1('0x3c')]=_[_0x0bd1('0x38')](db[_0x0bd1('0x9e')][_0x0bd1('0x35')]);_0x1356bf['query']=_[_0x0bd1('0x38')](_0x895687[_0x0bd1('0x39')]);_0x1356bf[_0x0bd1('0x3a')]=_['intersection'](_0x1356bf[_0x0bd1('0x3c')],_0x1356bf[_0x0bd1('0x39')]);_0x5905c9[_0x0bd1('0x3d')]=_[_0x0bd1('0x3b')](_0x1356bf[_0x0bd1('0x3c')],qs[_0x0bd1('0x3e')](_0x895687[_0x0bd1('0x39')][_0x0bd1('0x3e')]));_0x5905c9[_0x0bd1('0x3d')]=_0x5905c9[_0x0bd1('0x3d')][_0x0bd1('0x3f')]?_0x5905c9[_0x0bd1('0x3d')]:_0x1356bf[_0x0bd1('0x3c')];_0x5905c9['order']=qs[_0x0bd1('0x41')](_0x895687[_0x0bd1('0x39')]['sort']);_0x5905c9[_0x0bd1('0x43')]=qs[_0x0bd1('0x3a')](_[_0x0bd1('0x67')](_0x895687[_0x0bd1('0x39')],_0x1356bf['filters']));if(_0x895687[_0x0bd1('0x39')][_0x0bd1('0x42')]){_0x5905c9[_0x0bd1('0x43')]=_['merge'](_0x5905c9[_0x0bd1('0x43')],{'$or':_[_0x0bd1('0x2e')](_0x5905c9[_0x0bd1('0x3d')],function(_0x2a29d9){var _0x2a9395={};_0x2a9395[_0x2a29d9]={'$like':'%'+_0x895687[_0x0bd1('0x39')][_0x0bd1('0x42')]+'%'};return _0x2a9395;})});}_0x5905c9=_[_0x0bd1('0x44')]({},_0x5905c9,_0x895687[_0x0bd1('0x45')]);return _0x6e8e92[_0x0bd1('0x9d')](_0x5905c9);}})[_0x0bd1('0x29')](function(_0x3134db){if(_0x3134db){_0x187be6=_0x3134db['length'];if(!_0x895687[_0x0bd1('0x39')][_0x0bd1('0x60')]('nolimit')){_0x5905c9[_0x0bd1('0x22')]=qs['limit'](_0x895687['query'][_0x0bd1('0x22')]);_0x5905c9['offset']=qs[_0x0bd1('0x21')](_0x895687[_0x0bd1('0x39')][_0x0bd1('0x21')]);}return _0x6e8e92[_0x0bd1('0x9d')](_0x5905c9);}})[_0x0bd1('0x29')](function(_0x2169c3){if(_0x2169c3){return _0x2169c3?{'count':_0x187be6,'rows':_0x2169c3}:null;}})[_0x0bd1('0x29')](respondWithResult(_0x233200,null))[_0x0bd1('0x49')](handleError(_0x233200,null));};exports['addLists']=function(_0x43b12f,_0x386945,_0x4a3340){var _0x35905d=moment()['format'](_0x0bd1('0x9f'));var _0x3fe51b,_0x3ba355;return db['VoiceQueue']['find']({'where':{'id':_0x43b12f[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x386945,null))[_0x0bd1('0x29')](function(_0x993bde){if(_0x993bde){_0x3ba355=_0x993bde;return _0x993bde['addLists'](_0x43b12f['body'][_0x0bd1('0x91')],_['omit'](_0x43b12f[_0x0bd1('0x4d')],[_0x0bd1('0x91'),'id'])||{});}return null;})[_0x0bd1('0x96')](function(_0x6ac6a1){var _0x37a8fa;_0x3fe51b=_0x6ac6a1||[];var _0x57e6f0=[];if(_0x6ac6a1){for(var _0x582bca=0x0;_0x582bca<_0x6ac6a1[_0x0bd1('0x3f')];_0x582bca+=0x1){var _0x182dfc=_0x6ac6a1[_0x582bca][_0x0bd1('0x2b')]({'plain':!![]});_0x3ba355['dialCheckDuplicateType']=_0x43b12f[_0x0bd1('0x4d')]['dialCheckDuplicateType']?_0x43b12f[_0x0bd1('0x4d')][_0x0bd1('0xa0')]:_0x3ba355['dialCheckDuplicateType'];switch(_0x3ba355[_0x0bd1('0xa0')]){case _0x0bd1('0xa1'):_0x37a8fa=squel[_0x0bd1('0xa2')]()[_0x0bd1('0xa3')](_0x0bd1('0xa4'))[_0x0bd1('0xa5')](['phone','scheduledAt',_0x0bd1('0xa6'),_0x0bd1('0xa7'),'VoiceQueueId',_0x0bd1('0x58'),_0x0bd1('0x59')],squel[_0x0bd1('0x81')]()[_0x0bd1('0x82')](_0x0bd1('0xa8'),'phone')[_0x0bd1('0x82')]('\x27'+_0x35905d+'\x27',_0x0bd1('0xa9'))['field']('id',_0x0bd1('0xa6'))[_0x0bd1('0x82')](_0x182dfc[_0x0bd1('0xaa')][_0x0bd1('0x88')](),'ListId')['field'](_0x43b12f['params']['id'][_0x0bd1('0x88')](),_0x0bd1('0x61'))[_0x0bd1('0x82')]('\x27'+_0x35905d+'\x27',_0x0bd1('0x58'))[_0x0bd1('0x82')]('\x27'+_0x35905d+'\x27',_0x0bd1('0x59'))[_0x0bd1('0x84')](_0x0bd1('0xab'))[_0x0bd1('0x43')](_0x0bd1('0xac'))[_0x0bd1('0x43')](_0x0bd1('0xad'),_0x182dfc['CmListId'][_0x0bd1('0x88')]())[_0x0bd1('0x43')](_0x0bd1('0xae'))['where'](_0x0bd1('0xaf'),squel[_0x0bd1('0x81')]()[_0x0bd1('0x82')](_0x0bd1('0xb0'))[_0x0bd1('0x84')](_0x0bd1('0xb1'))[_0x0bd1('0x43')](_0x0bd1('0x87'),_0x43b12f[_0x0bd1('0x4b')]['id'][_0x0bd1('0x88')]()))[_0x0bd1('0x43')](_0x0bd1('0xaf'),squel[_0x0bd1('0x81')]()[_0x0bd1('0x82')](_0x0bd1('0xb2'))[_0x0bd1('0x84')](_0x0bd1('0xa4'))[_0x0bd1('0x43')]('VoiceQueueId\x20=\x20?',_0x43b12f[_0x0bd1('0x4b')]['id'][_0x0bd1('0x88')]())))[_0x0bd1('0x88')]();break;case _0x0bd1('0xb3'):_0x37a8fa=squel[_0x0bd1('0xa2')]()['into'](_0x0bd1('0xa4'))[_0x0bd1('0xa5')](['phone',_0x0bd1('0xa9'),_0x0bd1('0xa6'),'ListId','VoiceQueueId',_0x0bd1('0x58'),_0x0bd1('0x59')],squel[_0x0bd1('0x81')]()['field'](_0x0bd1('0xa8'),_0x0bd1('0xa8'))[_0x0bd1('0x82')]('\x27'+_0x35905d+'\x27',_0x0bd1('0xa9'))[_0x0bd1('0x82')]('id',_0x0bd1('0xa6'))['field'](_0x182dfc[_0x0bd1('0xaa')][_0x0bd1('0x88')](),'ListId')[_0x0bd1('0x82')](_0x43b12f['params']['id'][_0x0bd1('0x88')](),_0x0bd1('0x61'))[_0x0bd1('0x82')]('\x27'+_0x35905d+'\x27',_0x0bd1('0x58'))[_0x0bd1('0x82')]('\x27'+_0x35905d+'\x27','updatedAt')[_0x0bd1('0x84')](_0x0bd1('0xab'))[_0x0bd1('0x43')]('deletedAt\x20IS\x20NULL')[_0x0bd1('0x43')](_0x0bd1('0xad'),_0x182dfc[_0x0bd1('0xaa')][_0x0bd1('0x88')]())[_0x0bd1('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x0bd1('0x43')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0bd1('0x82')]('COALESCE(phone,\x27\x27)')[_0x0bd1('0x84')]('cm_hopper')[_0x0bd1('0x43')](_0x0bd1('0x87'),_0x43b12f[_0x0bd1('0x4b')]['id'][_0x0bd1('0x88')]())))[_0x0bd1('0x88')]();break;default:_0x37a8fa=squel[_0x0bd1('0xa2')]()[_0x0bd1('0xa3')](_0x0bd1('0xa4'))[_0x0bd1('0xa5')](['phone',_0x0bd1('0xa9'),_0x0bd1('0xa6'),_0x0bd1('0xa7'),'VoiceQueueId',_0x0bd1('0x58'),_0x0bd1('0x59')],squel[_0x0bd1('0x81')]()['field'](_0x0bd1('0xa8'),_0x0bd1('0xa8'))[_0x0bd1('0x82')]('\x27'+_0x35905d+'\x27',_0x0bd1('0xa9'))[_0x0bd1('0x82')]('id','ContactId')[_0x0bd1('0x82')](_0x182dfc[_0x0bd1('0xaa')][_0x0bd1('0x88')](),'ListId')['field'](_0x43b12f['params']['id']['toString'](),'VoiceQueueId')[_0x0bd1('0x82')]('\x27'+_0x35905d+'\x27',_0x0bd1('0x58'))[_0x0bd1('0x82')]('\x27'+_0x35905d+'\x27',_0x0bd1('0x59'))[_0x0bd1('0x84')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x0bd1('0xad'),_0x182dfc[_0x0bd1('0xaa')]['toString']())['where'](_0x0bd1('0xae')))[_0x0bd1('0x88')]();}_0x57e6f0['push'](db[_0x0bd1('0x72')][_0x0bd1('0x39')](_0x37a8fa));}return BPromise[_0x0bd1('0x8e')](_0x57e6f0);}})[_0x0bd1('0x29')](function(){var _0x1fb77d=[];var _0x3884e9=squel[_0x0bd1('0xa2')]()['into'](_0x0bd1('0xb4'))[_0x0bd1('0xa5')]([_0x0bd1('0xb5'),_0x0bd1('0xa8'),'OrderBy',_0x0bd1('0x58'),_0x0bd1('0x59')],squel['select']()[_0x0bd1('0x82')]('h.id')[_0x0bd1('0x82')](_0x0bd1('0xb6'))[_0x0bd1('0x82')](_0x0bd1('0xb7'))[_0x0bd1('0x82')]('\x27'+_0x35905d+'\x27','createdAt')[_0x0bd1('0x82')]('\x27'+_0x35905d+'\x27','updatedAt')[_0x0bd1('0x84')](_0x0bd1('0xb8'),'ci')[_0x0bd1('0x86')](_0x0bd1('0xa4'),'h','h.ContactId=ci.CmContactId')[_0x0bd1('0x43')](_0x0bd1('0xb9'),_0x35905d)['where']('ci.ItemClass=?','PHONE'))[_0x0bd1('0x88')]();_0x1fb77d['push'](db[_0x0bd1('0x72')]['query'](_0x3884e9));return BPromise[_0x0bd1('0x8e')](_0x1fb77d);})['then'](function(){return _0x3fe51b;})[_0x0bd1('0x29')](respondWithResult(_0x386945,null))[_0x0bd1('0x49')](handleError(_0x386945,null));};exports[_0x0bd1('0xba')]=function(_0x44fc00,_0x54d71e,_0x30d9c3){return db['VoiceQueue'][_0x0bd1('0x50')]({'where':{'id':_0x44fc00[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x54d71e,null))['then'](function(_0x1ce8ea){if(_0x1ce8ea){return _0x1ce8ea[_0x0bd1('0xba')](_0x44fc00['query'][_0x0bd1('0x91')]);}})[_0x0bd1('0x29')](function(_0x8a381){if(_0x8a381){return db[_0x0bd1('0x5f')][_0x0bd1('0x2a')]({'where':{'ListId':_0x44fc00[_0x0bd1('0x39')][_0x0bd1('0x91')],'VoiceQueueId':_0x44fc00[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](function(){return _0x8a381;});}})[_0x0bd1('0x29')](respondWithStatusCode(_0x54d71e,null))['catch'](handleError(_0x54d71e,null));};exports[_0x0bd1('0xbb')]=function(_0x332c96,_0x5e67ef,_0x3107f1){var _0x36a721={};var _0x1b9952={};var _0x13889e;var _0x32b978;return db[_0x0bd1('0x34')][_0x0bd1('0x5e')]({'where':{'id':_0x332c96[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x5e67ef,null))[_0x0bd1('0x29')](function(_0x1acf4d){if(_0x1acf4d){_0x13889e=_0x1acf4d;_0x1b9952[_0x0bd1('0x3c')]=_[_0x0bd1('0x38')](db[_0x0bd1('0x9e')][_0x0bd1('0x35')]);_0x1b9952['query']=_['keys'](_0x332c96[_0x0bd1('0x39')]);_0x1b9952['filters']=_[_0x0bd1('0x3b')](_0x1b9952[_0x0bd1('0x3c')],_0x1b9952[_0x0bd1('0x39')]);_0x36a721[_0x0bd1('0x3d')]=_[_0x0bd1('0x3b')](_0x1b9952[_0x0bd1('0x3c')],qs[_0x0bd1('0x3e')](_0x332c96[_0x0bd1('0x39')][_0x0bd1('0x3e')]));_0x36a721[_0x0bd1('0x3d')]=_0x36a721[_0x0bd1('0x3d')][_0x0bd1('0x3f')]?_0x36a721[_0x0bd1('0x3d')]:_0x1b9952[_0x0bd1('0x3c')];_0x36a721['order']=qs[_0x0bd1('0x41')](_0x332c96[_0x0bd1('0x39')][_0x0bd1('0x41')]);_0x36a721[_0x0bd1('0x43')]=qs[_0x0bd1('0x3a')](_[_0x0bd1('0x67')](_0x332c96[_0x0bd1('0x39')],_0x1b9952['filters']));if(_0x332c96[_0x0bd1('0x39')]['filter']){_0x36a721[_0x0bd1('0x43')]=_[_0x0bd1('0x44')](_0x36a721[_0x0bd1('0x43')],{'$or':_['map'](_0x36a721[_0x0bd1('0x3d')],function(_0x1f4855){var _0x11142d={};_0x11142d[_0x1f4855]={'$like':'%'+_0x332c96[_0x0bd1('0x39')][_0x0bd1('0x42')]+'%'};return _0x11142d;})});}_0x36a721=_['merge']({},_0x36a721,_0x332c96[_0x0bd1('0x45')]);return _0x13889e[_0x0bd1('0xbb')](_0x36a721);}})[_0x0bd1('0x29')](function(_0x57e1f6){if(_0x57e1f6){_0x32b978=_0x57e1f6[_0x0bd1('0x3f')];if(!_0x332c96[_0x0bd1('0x39')][_0x0bd1('0x60')](_0x0bd1('0x64'))){_0x36a721['limit']=qs[_0x0bd1('0x22')](_0x332c96[_0x0bd1('0x39')][_0x0bd1('0x22')]);_0x36a721[_0x0bd1('0x21')]=qs[_0x0bd1('0x21')](_0x332c96[_0x0bd1('0x39')]['offset']);}return _0x13889e[_0x0bd1('0xbb')](_0x36a721);}})[_0x0bd1('0x29')](function(_0x1a9cef){if(_0x1a9cef){return _0x1a9cef?{'count':_0x32b978,'rows':_0x1a9cef}:null;}})[_0x0bd1('0x29')](respondWithResult(_0x5e67ef,null))[_0x0bd1('0x49')](handleError(_0x5e67ef,null));};exports[_0x0bd1('0xbc')]=function(_0x1763d6,_0x31a9d2,_0x458082){var _0x42763c,_0x870a0a;return db[_0x0bd1('0x34')][_0x0bd1('0x50')]({'where':{'id':_0x1763d6[_0x0bd1('0x4b')]['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x31a9d2,null))[_0x0bd1('0x29')](function(_0x135e79){if(_0x135e79){_0x870a0a=_0x135e79;return _0x135e79[_0x0bd1('0xbc')](_0x1763d6['body'][_0x0bd1('0x91')],_[_0x0bd1('0x57')](_0x1763d6[_0x0bd1('0x4d')],[_0x0bd1('0x91'),'id'])||{});}return null;})[_0x0bd1('0x96')](function(_0x3c44e8){var _0x1a0d60;_0x42763c=_0x3c44e8||[];var _0x140e79=[];if(_0x3c44e8){for(var _0x81758=0x0;_0x81758<_0x3c44e8[_0x0bd1('0x3f')];_0x81758+=0x1){var _0x575dd1=_0x3c44e8[_0x81758][_0x0bd1('0x2b')]({'plain':!![]});_0x1a0d60=squel[_0x0bd1('0xa2')]()[_0x0bd1('0xa3')]('cm_hopper_black')['fromQuery'](['phone','ContactId','ListId',_0x0bd1('0x61'),_0x0bd1('0x58'),_0x0bd1('0x59')],squel[_0x0bd1('0x81')]()[_0x0bd1('0x82')](_0x0bd1('0xa8'),_0x0bd1('0xa8'))[_0x0bd1('0x82')]('id',_0x0bd1('0xa6'))[_0x0bd1('0x82')](_0x575dd1[_0x0bd1('0xaa')][_0x0bd1('0x88')](),'ListId')[_0x0bd1('0x82')](_0x1763d6['params']['id'][_0x0bd1('0x88')](),_0x0bd1('0x61'))[_0x0bd1('0x82')]('NOW()',_0x0bd1('0x58'))[_0x0bd1('0x82')](_0x0bd1('0xbd'),_0x0bd1('0x59'))[_0x0bd1('0x84')](_0x0bd1('0xab'))[_0x0bd1('0x43')]('deletedAt\x20IS\x20NULL')[_0x0bd1('0x43')]('ListId\x20=\x20?',_0x575dd1[_0x0bd1('0xaa')][_0x0bd1('0x88')]())[_0x0bd1('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0bd1('0x88')]();_0x140e79['push'](db['sequelize']['query'](_0x1a0d60));}return BPromise[_0x0bd1('0x8e')](_0x140e79);}})[_0x0bd1('0x29')](function(){return _0x42763c;})['then'](respondWithResult(_0x31a9d2,null))[_0x0bd1('0x49')](handleError(_0x31a9d2,null));};exports[_0x0bd1('0xbe')]=function(_0x1663dc,_0x2645a0,_0x2d3739){return db[_0x0bd1('0x34')][_0x0bd1('0x50')]({'where':{'id':_0x1663dc['params']['id']}})[_0x0bd1('0x29')](handleEntityNotFound(_0x2645a0,null))[_0x0bd1('0x29')](function(_0x3bdee3){if(_0x3bdee3){return _0x3bdee3['removeBlackLists'](_0x1663dc['query'][_0x0bd1('0x91')]);}})[_0x0bd1('0x29')](function(_0x1e6ba3){if(_0x1e6ba3){return db[_0x0bd1('0x69')]['destroy']({'where':{'ListId':_0x1663dc[_0x0bd1('0x39')][_0x0bd1('0x91')],'VoiceQueueId':_0x1663dc['params']['id']}})['then'](function(){return _0x1e6ba3;});}})['then'](respondWithStatusCode(_0x2645a0,null))[_0x0bd1('0x49')](handleError(_0x2645a0,null));}; \ No newline at end of file +var _0x4745=['autoAssociation','clone','params','omit','createdAt','updatedAt','role','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','VoiceQueueId','findAll','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','User','online','voicePause','interface','Agents','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','compact','isEmpty','removeAgents','destroy','userVoiceQueue:remove','addAgents','spread','push','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','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','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','get','VoiceQueues','inbound','QueueCampaigns','filter','includes','type','find','UserProfileResource','end','error','name','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VoiceQueue','includeAll','include','catch','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','value'];(function(_0xfca6a9,_0x563456){var _0x2723c4=function(_0x4af419){while(--_0x4af419){_0xfca6a9['push'](_0xfca6a9['shift']());}};_0x2723c4(++_0x563456);}(_0x4745,0x1e7));var _0x5474=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4745[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x5474('0x0'));var rimraf=require(_0x5474('0x1'));var zipdir=require(_0x5474('0x2'));var jsonpatch=require(_0x5474('0x3'));var rp=require(_0x5474('0x4'));var moment=require(_0x5474('0x5'));var BPromise=require(_0x5474('0x6'));var Mustache=require(_0x5474('0x7'));var util=require(_0x5474('0x8'));var path=require(_0x5474('0x9'));var sox=require(_0x5474('0xa'));var csv=require(_0x5474('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5474('0xc'));var _=require(_0x5474('0xd'));var squel=require('squel');var crypto=require(_0x5474('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5474('0xf'));var toCsv=require(_0x5474('0xb'));var querystring=require('querystring');var Papa=require(_0x5474('0x10'));var Redis=require(_0x5474('0x11'));var authService=require(_0x5474('0x12'));var qs=require(_0x5474('0x13'));var as=require(_0x5474('0x14'));var hardwareService=require(_0x5474('0x15'));var logger=require(_0x5474('0x16'))(_0x5474('0x17'));var utils=require('../../config/utils');var config=require(_0x5474('0x18'));var licenseUtil=require(_0x5474('0x19'));var db=require(_0x5474('0x1a'))['db'];config[_0x5474('0x1b')]=_[_0x5474('0x1c')](config[_0x5474('0x1b')],{'host':_0x5474('0x1d'),'port':0x18eb});var socket=require(_0x5474('0x1e'))(new Redis(config[_0x5474('0x1b')]));require('./voiceQueue.socket')[_0x5474('0x1f')](socket);function respondWithStatusCode(_0x17e424,_0x2ce218){_0x2ce218=_0x2ce218||0xcc;return function(_0x1790eb){if(_0x1790eb){return _0x17e424['sendStatus'](_0x2ce218);}return _0x17e424['status'](_0x2ce218)['end']();};}function respondWithResult(_0x50eb42,_0x32f0e4){_0x32f0e4=_0x32f0e4||0xc8;return function(_0x172bcb){if(_0x172bcb){return _0x50eb42[_0x5474('0x20')](_0x32f0e4)['json'](_0x172bcb);}};}function respondWithFilteredResult(_0x3da004,_0x2be746){return function(_0x56dbfa){if(_0x56dbfa){var _0x22b37d=typeof _0x2be746[_0x5474('0x21')]===_0x5474('0x22')&&typeof _0x2be746[_0x5474('0x23')]===_0x5474('0x22');var _0x4ab269=_0x56dbfa[_0x5474('0x24')];var _0x5f31a9=_0x22b37d?0x0:_0x2be746[_0x5474('0x21')];var _0x178e5c=_0x22b37d?_0x56dbfa['count']:_0x2be746['offset']+_0x2be746['limit'];var _0x1f81d6;if(_0x178e5c>=_0x4ab269){_0x178e5c=_0x4ab269;_0x1f81d6=0xc8;}else{_0x1f81d6=0xce;}_0x3da004[_0x5474('0x20')](_0x1f81d6);return _0x3da004[_0x5474('0x25')](_0x5474('0x26'),_0x5f31a9+'-'+_0x178e5c+'/'+_0x4ab269)[_0x5474('0x27')](_0x56dbfa);}return null;};}function patchUpdates(_0x24db35){return function(_0xe4850d){try{jsonpatch[_0x5474('0x28')](_0xe4850d,_0x24db35,!![]);}catch(_0x219be1){return BPromise[_0x5474('0x29')](_0x219be1);}return _0xe4850d['save']();};}function saveUpdates(_0x5f065d,_0x337c5b){return function(_0x266465){if(_0x266465){return _0x266465[_0x5474('0x2a')](_0x5f065d)['then'](function(_0x24997a){return _0x24997a;});}return null;};}function removeEntity(_0x49f691,_0xa95a2){return function(_0x23dbc5){if(_0x23dbc5){return _0x23dbc5['destroy']()[_0x5474('0x2b')](function(){var _0x5d4cd7=_0x23dbc5[_0x5474('0x2c')]({'plain':!![]});var _0x5efa8d=[{'name':_0x5474('0x2d'),'value':_0x5474('0x2e'),'ignore':![]},{'name':_0x5474('0x2f'),'value':'outbound','ignore':![]}];var _0x574ed6=_(_0x5efa8d)[_0x5474('0x30')]('ignore')['map']('value')['value']();if(_[_0x5474('0x31')](_0x574ed6,_0x5d4cd7[_0x5474('0x32')])){return;}var _0x54cd0c=_[_0x5474('0x33')](_0x5efa8d,['value',_0x5d4cd7[_0x5474('0x32')]])['name'];return db[_0x5474('0x34')]['destroy']({'where':{'type':_0x54cd0c,'resourceId':_0x5d4cd7['id']}})[_0x5474('0x2b')](function(){return _0x23dbc5;});})['then'](function(){_0x49f691[_0x5474('0x20')](0xcc)[_0x5474('0x35')]();});}};}function handleEntityNotFound(_0x3487ca,_0x45469c){return function(_0x5b85b8){if(!_0x5b85b8){_0x3487ca['sendStatus'](0x194);}return _0x5b85b8;};}function handleError(_0x44e089,_0x1167c0){_0x1167c0=_0x1167c0||0x1f4;return function(_0x42b931){logger[_0x5474('0x36')](_0x42b931['stack']);if(_0x42b931['name']){delete _0x42b931[_0x5474('0x37')];}_0x44e089[_0x5474('0x20')](_0x1167c0)['send'](_0x42b931);};}exports[_0x5474('0x38')]=function(_0x26d752,_0x391c7e){var _0xc5fb7={},_0x4d32ce={},_0xe655ac={'count':0x0,'rows':[]};var _0x409111=_[_0x5474('0x39')](db['VoiceQueue'][_0x5474('0x3a')],function(_0x2b8d66){return{'name':_0x2b8d66[_0x5474('0x3b')],'type':_0x2b8d66[_0x5474('0x32')]['key']};});_0x4d32ce['model']=_[_0x5474('0x39')](_0x409111,_0x5474('0x37'));_0x4d32ce[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x26d752['query']);_0x4d32ce[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0x4d32ce[_0x5474('0x40')],_0x4d32ce[_0x5474('0x3c')]);_0xc5fb7['attributes']=_['intersection'](_0x4d32ce['model'],qs[_0x5474('0x41')](_0x26d752['query'][_0x5474('0x41')]));_0xc5fb7[_0x5474('0x42')]=_0xc5fb7[_0x5474('0x42')][_0x5474('0x43')]?_0xc5fb7[_0x5474('0x42')]:_0x4d32ce[_0x5474('0x40')];if(!_0x26d752[_0x5474('0x3c')][_0x5474('0x44')](_0x5474('0x45'))){_0xc5fb7['limit']=qs[_0x5474('0x23')](_0x26d752[_0x5474('0x3c')][_0x5474('0x23')]);_0xc5fb7[_0x5474('0x21')]=qs['offset'](_0x26d752[_0x5474('0x3c')]['offset']);}_0xc5fb7[_0x5474('0x46')]=qs[_0x5474('0x47')](_0x26d752['query'][_0x5474('0x47')]);_0xc5fb7[_0x5474('0x48')]=qs['filters'](_[_0x5474('0x49')](_0x26d752[_0x5474('0x3c')],_0x4d32ce['filters']),_0x409111);if(_0x26d752[_0x5474('0x3c')]['filter']){_0xc5fb7[_0x5474('0x48')]=_[_0x5474('0x4a')](_0xc5fb7['where'],{'$or':_[_0x5474('0x39')](_0x409111,function(_0xb8a084){if(_0xb8a084[_0x5474('0x32')]!=='VIRTUAL'){var _0x279e1f={};_0x279e1f[_0xb8a084[_0x5474('0x37')]]={'$like':'%'+_0x26d752[_0x5474('0x3c')][_0x5474('0x30')]+'%'};return _0x279e1f;}})});}_0xc5fb7=_['merge']({},_0xc5fb7,_0x26d752['options']);var _0x2544fc={'where':_0xc5fb7['where']};return db[_0x5474('0x4b')][_0x5474('0x24')](_0x2544fc)['then'](function(_0x8e611a){_0xe655ac[_0x5474('0x24')]=_0x8e611a;if(_0x26d752['query'][_0x5474('0x4c')]){_0xc5fb7[_0x5474('0x4d')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0xc5fb7);})[_0x5474('0x2b')](function(_0x355421){_0xe655ac['rows']=_0x355421;return _0xe655ac;})[_0x5474('0x2b')](respondWithFilteredResult(_0x391c7e,_0xc5fb7))[_0x5474('0x4e')](handleError(_0x391c7e,null));};exports[_0x5474('0x4f')]=function(_0x46bde7,_0x52863b){var _0x1b423c={'raw':![],'where':{'id':_0x46bde7['params']['id']}},_0xe884b6={};_0xe884b6[_0x5474('0x40')]=_[_0x5474('0x3d')](db[_0x5474('0x4b')][_0x5474('0x3a')]);_0xe884b6[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x46bde7[_0x5474('0x3c')]);_0xe884b6[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0xe884b6[_0x5474('0x40')],_0xe884b6[_0x5474('0x3c')]);_0x1b423c[_0x5474('0x42')]=_['intersection'](_0xe884b6[_0x5474('0x40')],qs[_0x5474('0x41')](_0x46bde7[_0x5474('0x3c')][_0x5474('0x41')]));_0x1b423c['attributes']=_0x1b423c[_0x5474('0x42')][_0x5474('0x43')]?_0x1b423c[_0x5474('0x42')]:_0xe884b6[_0x5474('0x40')];if(_0x46bde7[_0x5474('0x3c')][_0x5474('0x4c')]){_0x1b423c[_0x5474('0x4d')]=[{'all':!![]}];}_0x1b423c=_[_0x5474('0x4a')]({},_0x1b423c,_0x46bde7[_0x5474('0x50')]);return db[_0x5474('0x4b')][_0x5474('0x33')](_0x1b423c)[_0x5474('0x2b')](handleEntityNotFound(_0x52863b,null))[_0x5474('0x2b')](respondWithResult(_0x52863b,null))['catch'](handleError(_0x52863b,null));};exports['create']=function(_0x570e89,_0x615418){return db[_0x5474('0x4b')][_0x5474('0x51')](_0x570e89[_0x5474('0x52')],{})[_0x5474('0x2b')](function(_0x574b1e){var _0x32798f=_0x570e89[_0x5474('0x53')][_0x5474('0x2c')]({'plain':!![]});if(!_0x32798f)throw new Error(_0x5474('0x54'));if(_0x32798f['role']===_0x5474('0x53')){var _0xe63e02=_0x574b1e[_0x5474('0x2c')]({'plain':!![]});var _0x37e1bc=[{'name':_0x5474('0x2d'),'value':_0x5474('0x2e')},{'name':'QueueCampaigns','value':'outbound'}];var _0x27dd7f=_['find'](_0x37e1bc,[_0x5474('0x55'),_0xe63e02[_0x5474('0x32')]])[_0x5474('0x37')];return db['UserProfileSection'][_0x5474('0x33')]({'where':{'name':_0x27dd7f,'userProfileId':_0x32798f['userProfileId']},'raw':!![]})[_0x5474('0x2b')](function(_0x1a6201){if(_0x1a6201&&_0x1a6201[_0x5474('0x56')]===0x0){return db[_0x5474('0x34')][_0x5474('0x51')]({'name':_0xe63e02[_0x5474('0x37')],'resourceId':_0xe63e02['id'],'type':_0x1a6201[_0x5474('0x37')],'sectionId':_0x1a6201['id']},{})['then'](function(){return _0x574b1e;});}else{return _0x574b1e;}})['catch'](function(_0x34f95c){logger[_0x5474('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34f95c);throw _0x34f95c;});}return _0x574b1e;})[_0x5474('0x2b')](respondWithResult(_0x615418,0xc9))[_0x5474('0x4e')](handleError(_0x615418,null));};exports[_0x5474('0x57')]=function(_0x4ec2a3,_0x549184){var _0x27e27d={'where':{'id':_0x4ec2a3[_0x5474('0x58')]['id']}},_0x5a1551={};_0x5a1551['model']=_[_0x5474('0x3d')](db[_0x5474('0x4b')][_0x5474('0x3a')]);_0x27e27d['attributes']=_['intersection'](_0x5a1551[_0x5474('0x40')],qs[_0x5474('0x41')](_0x4ec2a3['query'][_0x5474('0x41')]));_0x27e27d[_0x5474('0x42')]=_0x27e27d[_0x5474('0x42')][_0x5474('0x43')]?_0x27e27d[_0x5474('0x42')]:_0x5a1551[_0x5474('0x40')];if(_0x4ec2a3['query'][_0x5474('0x4c')]){_0x27e27d[_0x5474('0x4d')]=[{'all':!![]}];}_0x27e27d=_['merge']({},_0x27e27d,_0x4ec2a3[_0x5474('0x50')]);return db[_0x5474('0x4b')]['find'](_0x27e27d)['then'](handleEntityNotFound(_0x549184,null))[_0x5474('0x2b')](function(_0x4f37d5){if(_0x4f37d5){var _0x298c0c=_0x4f37d5[_0x5474('0x2c')]({'plain':!![]});_0x298c0c=qs[_0x5474('0x59')](_0x298c0c,['id',_0x5474('0x5a'),_0x5474('0x5b')]);_0x4ec2a3[_0x5474('0x52')]=_['omit'](_0x4ec2a3['body'],['id',_0x5474('0x5a'),_0x5474('0x5b')]);return db[_0x5474('0x4b')][_0x5474('0x51')](_[_0x5474('0x4a')](_0x298c0c,_0x4ec2a3[_0x5474('0x52')]),{'include':_0x4ec2a3[_0x5474('0x3c')][_0x5474('0x4c')]?[{'all':!![]}]:undefined})[_0x5474('0x2b')](function(_0x1dac34){var _0x59e85e=_0x4ec2a3[_0x5474('0x53')]['get']({'plain':!![]});if(!_0x59e85e)throw new Error(_0x5474('0x54'));if(_0x59e85e[_0x5474('0x5c')]==='user'){var _0x1f7e38=_0x1dac34['get']({'plain':!![]});var _0x4e1bc7=[{'name':_0x5474('0x2d'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x5474('0x5d')}];var _0x18a99a=_[_0x5474('0x33')](_0x4e1bc7,[_0x5474('0x55'),_0x1f7e38['type']])[_0x5474('0x37')];return db[_0x5474('0x5e')][_0x5474('0x33')]({'where':{'name':_0x18a99a,'userProfileId':_0x59e85e[_0x5474('0x5f')]},'raw':!![]})[_0x5474('0x2b')](function(_0x1a5ac0){if(_0x1a5ac0&&_0x1a5ac0['autoAssociation']===0x0){return db[_0x5474('0x34')]['create']({'name':_0x1f7e38[_0x5474('0x37')],'resourceId':_0x1f7e38['id'],'type':_0x1a5ac0[_0x5474('0x37')],'sectionId':_0x1a5ac0['id']},{})['then'](function(){return _0x1dac34;});}else{return _0x1dac34;}})['catch'](function(_0x3679c4){logger[_0x5474('0x36')](_0x5474('0x60'),_0x3679c4);throw _0x3679c4;});}return _0x1dac34;});}})[_0x5474('0x2b')](respondWithResult(_0x549184,0xc9))[_0x5474('0x4e')](handleError(_0x549184,null));};exports[_0x5474('0x2a')]=function(_0x472c86,_0x5a5a94){if(_0x472c86['body']['id']){delete _0x472c86[_0x5474('0x52')]['id'];}return db[_0x5474('0x4b')][_0x5474('0x33')]({'where':{'id':_0x472c86[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x5a5a94,null))[_0x5474('0x2b')](saveUpdates(_0x472c86[_0x5474('0x52')],null))[_0x5474('0x2b')](respondWithResult(_0x5a5a94,null))[_0x5474('0x4e')](handleError(_0x5a5a94,null));};exports['destroy']=function(_0x50e625,_0x55e5a3){return db['VoiceQueue'][_0x5474('0x33')]({'where':{'id':_0x50e625['params']['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x55e5a3,null))[_0x5474('0x2b')](removeEntity(_0x55e5a3,null))[_0x5474('0x4e')](handleError(_0x55e5a3,null));};exports[_0x5474('0x61')]=function(_0x4493ec,_0xa0bf7,_0x53b5b2){var _0x455255={'raw':![],'where':{}};var _0x41288e={};var _0x35d950={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x5474('0x62')]({'where':{'id':_0x4493ec[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0xa0bf7,null))['then'](function(_0xe604df){if(_0xe604df){_0x41288e[_0x5474('0x40')]=_[_0x5474('0x3d')](db[_0x5474('0x63')][_0x5474('0x3a')]);_0x41288e[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x4493ec['query']);_0x41288e[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0x41288e[_0x5474('0x40')],_0x41288e[_0x5474('0x3c')]);_0x455255[_0x5474('0x42')]=_['intersection'](_0x41288e[_0x5474('0x40')],qs[_0x5474('0x41')](_0x4493ec[_0x5474('0x3c')][_0x5474('0x41')]));_0x455255[_0x5474('0x42')]=_0x455255['attributes'][_0x5474('0x43')]?_0x455255[_0x5474('0x42')]:_0x41288e[_0x5474('0x40')];if(!_0x4493ec[_0x5474('0x3c')][_0x5474('0x44')](_0x5474('0x45'))){_0x455255[_0x5474('0x23')]=qs[_0x5474('0x23')](_0x4493ec[_0x5474('0x3c')]['limit']);_0x455255['offset']=qs[_0x5474('0x21')](_0x4493ec[_0x5474('0x3c')][_0x5474('0x21')]);}_0x455255[_0x5474('0x46')]=qs[_0x5474('0x47')](_0x4493ec[_0x5474('0x3c')]['sort']);_0x455255[_0x5474('0x48')]=qs['filters'](_[_0x5474('0x49')](_0x4493ec[_0x5474('0x3c')],_0x41288e[_0x5474('0x3e')]));_0x455255['where'][_0x5474('0x64')]=_0xe604df['id'];if(_0x4493ec[_0x5474('0x3c')][_0x5474('0x30')]){_0x455255['where']=_[_0x5474('0x4a')](_0x455255[_0x5474('0x48')],{'$or':_[_0x5474('0x39')](_0x455255['attributes'],function(_0x4952ea){var _0x53743a={};_0x53743a[_0x4952ea]={'$like':'%'+_0x4493ec[_0x5474('0x3c')][_0x5474('0x30')]+'%'};return _0x53743a;})});}_0x455255=_[_0x5474('0x4a')]({},_0x455255,_0x4493ec[_0x5474('0x50')]);return db[_0x5474('0x63')][_0x5474('0x24')]({'where':_0x455255[_0x5474('0x48')]})['then'](function(_0x42ed1e){_0x35d950[_0x5474('0x24')]=_0x42ed1e;if(_0x4493ec[_0x5474('0x3c')][_0x5474('0x4c')]){_0x455255[_0x5474('0x4d')]=[{'all':!![]}];}return db[_0x5474('0x63')][_0x5474('0x65')](_0x455255);})[_0x5474('0x2b')](function(_0x16adff){_0x35d950[_0x5474('0x66')]=_0x16adff;return _0x35d950;});}})[_0x5474('0x2b')](respondWithFilteredResult(_0xa0bf7,_0x455255))[_0x5474('0x4e')](handleError(_0xa0bf7,null));};exports[_0x5474('0x67')]=function(_0x2c9fbe,_0x947657,_0x146e15){var _0x7cfabc={'raw':!![],'where':{}};var _0x19aa83={};var _0x1de17a={'count':0x0,'rows':[]};return db[_0x5474('0x4b')]['findOne']({'where':{'id':_0x2c9fbe[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x947657,null))[_0x5474('0x2b')](function(_0x569630){if(_0x569630){_0x19aa83['model']=_[_0x5474('0x3d')](db['CmHopperHistory'][_0x5474('0x3a')]);_0x19aa83[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x2c9fbe[_0x5474('0x3c')]);_0x19aa83[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0x19aa83[_0x5474('0x40')],_0x19aa83[_0x5474('0x3c')]);_0x7cfabc[_0x5474('0x42')]=_[_0x5474('0x3f')](_0x19aa83[_0x5474('0x40')],qs['fields'](_0x2c9fbe[_0x5474('0x3c')][_0x5474('0x41')]));_0x7cfabc[_0x5474('0x42')]=_0x7cfabc[_0x5474('0x42')][_0x5474('0x43')]?_0x7cfabc[_0x5474('0x42')]:_0x19aa83['model'];if(!_0x2c9fbe[_0x5474('0x3c')]['hasOwnProperty'](_0x5474('0x45'))){_0x7cfabc['limit']=qs[_0x5474('0x23')](_0x2c9fbe[_0x5474('0x3c')][_0x5474('0x23')]);_0x7cfabc[_0x5474('0x21')]=qs[_0x5474('0x21')](_0x2c9fbe[_0x5474('0x3c')][_0x5474('0x21')]);}_0x7cfabc[_0x5474('0x46')]=qs['sort'](_0x2c9fbe['query'][_0x5474('0x47')]);_0x7cfabc['where']=qs[_0x5474('0x3e')](_['pick'](_0x2c9fbe['query'],_0x19aa83[_0x5474('0x3e')]));_0x7cfabc[_0x5474('0x48')][_0x5474('0x64')]=_0x569630['id'];if(_0x2c9fbe[_0x5474('0x3c')]['filter']){_0x7cfabc[_0x5474('0x48')]=_[_0x5474('0x4a')](_0x7cfabc['where'],{'$or':_[_0x5474('0x39')](_0x7cfabc[_0x5474('0x42')],function(_0xf9e715){var _0x1ec2ae={};_0x1ec2ae[_0xf9e715]={'$like':'%'+_0x2c9fbe['query'][_0x5474('0x30')]+'%'};return _0x1ec2ae;})});}_0x7cfabc=_[_0x5474('0x4a')]({},_0x7cfabc,_0x2c9fbe[_0x5474('0x50')]);return db['CmHopperHistory'][_0x5474('0x24')]({'where':_0x7cfabc['where']})['then'](function(_0x11b067){_0x1de17a[_0x5474('0x24')]=_0x11b067;if(_0x2c9fbe[_0x5474('0x3c')][_0x5474('0x4c')]){_0x7cfabc[_0x5474('0x4d')]=[{'all':!![]}];}return db[_0x5474('0x68')][_0x5474('0x65')](_0x7cfabc);})[_0x5474('0x2b')](function(_0xbf4ac3){_0x1de17a[_0x5474('0x66')]=_0xbf4ac3;return _0x1de17a;});}})[_0x5474('0x2b')](respondWithFilteredResult(_0x947657,_0x7cfabc))[_0x5474('0x4e')](handleError(_0x947657,null));};exports[_0x5474('0x69')]=function(_0x264981,_0x2c555a,_0x1057ab){var _0x2f32c6={'raw':!![],'where':{}};var _0x583292={};var _0x4dcbf0={'count':0x0,'rows':[]};return db[_0x5474('0x4b')][_0x5474('0x62')]({'where':{'id':_0x264981[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x2c555a,null))[_0x5474('0x2b')](function(_0xfa5749){if(_0xfa5749){_0x583292[_0x5474('0x40')]=_[_0x5474('0x3d')](db[_0x5474('0x6a')]['rawAttributes']);_0x583292[_0x5474('0x3c')]=_['keys'](_0x264981['query']);_0x583292[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0x583292[_0x5474('0x40')],_0x583292[_0x5474('0x3c')]);_0x2f32c6[_0x5474('0x42')]=_['intersection'](_0x583292[_0x5474('0x40')],qs[_0x5474('0x41')](_0x264981[_0x5474('0x3c')]['fields']));_0x2f32c6[_0x5474('0x42')]=_0x2f32c6[_0x5474('0x42')][_0x5474('0x43')]?_0x2f32c6['attributes']:_0x583292[_0x5474('0x40')];if(!_0x264981[_0x5474('0x3c')][_0x5474('0x44')](_0x5474('0x45'))){_0x2f32c6[_0x5474('0x23')]=qs[_0x5474('0x23')](_0x264981[_0x5474('0x3c')][_0x5474('0x23')]);_0x2f32c6['offset']=qs[_0x5474('0x21')](_0x264981[_0x5474('0x3c')][_0x5474('0x21')]);}_0x2f32c6['order']=qs[_0x5474('0x47')](_0x264981[_0x5474('0x3c')][_0x5474('0x47')]);_0x2f32c6[_0x5474('0x48')]=qs[_0x5474('0x3e')](_[_0x5474('0x49')](_0x264981[_0x5474('0x3c')],_0x583292[_0x5474('0x3e')]));_0x2f32c6['where'][_0x5474('0x64')]=_0xfa5749['id'];if(_0x264981['query']['filter']){_0x2f32c6[_0x5474('0x48')]=_['merge'](_0x2f32c6['where'],{'$or':_[_0x5474('0x39')](_0x2f32c6[_0x5474('0x42')],function(_0x22a7f3){var _0x32aef7={};_0x32aef7[_0x22a7f3]={'$like':'%'+_0x264981[_0x5474('0x3c')][_0x5474('0x30')]+'%'};return _0x32aef7;})});}_0x2f32c6=_['merge']({},_0x2f32c6,_0x264981['options']);return db[_0x5474('0x6a')][_0x5474('0x24')]({'where':_0x2f32c6[_0x5474('0x48')]})['then'](function(_0x5a3c9c){_0x4dcbf0[_0x5474('0x24')]=_0x5a3c9c;if(_0x264981[_0x5474('0x3c')][_0x5474('0x4c')]){_0x2f32c6[_0x5474('0x4d')]=[{'all':!![]}];}return db[_0x5474('0x6a')][_0x5474('0x65')](_0x2f32c6);})[_0x5474('0x2b')](function(_0x8b9bb2){_0x4dcbf0[_0x5474('0x66')]=_0x8b9bb2;return _0x4dcbf0;});}})[_0x5474('0x2b')](respondWithFilteredResult(_0x2c555a,_0x2f32c6))[_0x5474('0x4e')](handleError(_0x2c555a,null));};exports[_0x5474('0x6b')]=function(_0x37ddd1,_0x57b277,_0xba6b85){var _0x4e0692={'raw':!![],'where':{}};var _0x2518b5={};var _0x4fdaa8={'count':0x0,'rows':[]};return db[_0x5474('0x4b')][_0x5474('0x62')]({'where':{'id':_0x37ddd1[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x57b277,null))[_0x5474('0x2b')](function(_0x33ebef){if(_0x33ebef){_0x2518b5[_0x5474('0x40')]=_[_0x5474('0x3d')](db['CmHopperBlack'][_0x5474('0x3a')]);_0x2518b5[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x37ddd1[_0x5474('0x3c')]);_0x2518b5[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0x2518b5[_0x5474('0x40')],_0x2518b5[_0x5474('0x3c')]);_0x4e0692[_0x5474('0x42')]=_[_0x5474('0x3f')](_0x2518b5[_0x5474('0x40')],qs[_0x5474('0x41')](_0x37ddd1[_0x5474('0x3c')]['fields']));_0x4e0692[_0x5474('0x42')]=_0x4e0692[_0x5474('0x42')][_0x5474('0x43')]?_0x4e0692[_0x5474('0x42')]:_0x2518b5[_0x5474('0x40')];if(!_0x37ddd1['query'][_0x5474('0x44')](_0x5474('0x45'))){_0x4e0692[_0x5474('0x23')]=qs[_0x5474('0x23')](_0x37ddd1['query'][_0x5474('0x23')]);_0x4e0692[_0x5474('0x21')]=qs[_0x5474('0x21')](_0x37ddd1[_0x5474('0x3c')]['offset']);}_0x4e0692[_0x5474('0x46')]=qs[_0x5474('0x47')](_0x37ddd1['query']['sort']);_0x4e0692['where']=qs[_0x5474('0x3e')](_[_0x5474('0x49')](_0x37ddd1[_0x5474('0x3c')],_0x2518b5['filters']));_0x4e0692[_0x5474('0x48')][_0x5474('0x64')]=_0x33ebef['id'];if(_0x37ddd1[_0x5474('0x3c')][_0x5474('0x30')]){_0x4e0692[_0x5474('0x48')]=_[_0x5474('0x4a')](_0x4e0692[_0x5474('0x48')],{'$or':_[_0x5474('0x39')](_0x4e0692[_0x5474('0x42')],function(_0x125664){var _0x4cbdc2={};_0x4cbdc2[_0x125664]={'$like':'%'+_0x37ddd1[_0x5474('0x3c')]['filter']+'%'};return _0x4cbdc2;})});}_0x4e0692=_[_0x5474('0x4a')]({},_0x4e0692,_0x37ddd1[_0x5474('0x50')]);return db[_0x5474('0x6c')][_0x5474('0x24')]({'where':_0x4e0692['where']})[_0x5474('0x2b')](function(_0x3773b6){_0x4fdaa8[_0x5474('0x24')]=_0x3773b6;if(_0x37ddd1[_0x5474('0x3c')][_0x5474('0x4c')]){_0x4e0692['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x4e0692);})['then'](function(_0x425c7d){_0x4fdaa8['rows']=_0x425c7d;return _0x4fdaa8;});}})[_0x5474('0x2b')](respondWithFilteredResult(_0x57b277,_0x4e0692))[_0x5474('0x4e')](handleError(_0x57b277,null));};exports['getTeams']=function(_0x29517a,_0x8fc2a1,_0x22860d){var _0x1e1760={};var _0x3d0e2d={};var _0x38bc81;var _0x125ae5;return db[_0x5474('0x4b')][_0x5474('0x62')]({'where':{'id':_0x29517a['params']['id']}})['then'](handleEntityNotFound(_0x8fc2a1,null))[_0x5474('0x2b')](function(_0x370519){if(_0x370519){_0x38bc81=_0x370519;_0x3d0e2d['model']=_[_0x5474('0x3d')](db[_0x5474('0x6d')]['rawAttributes']);_0x3d0e2d[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x29517a[_0x5474('0x3c')]);_0x3d0e2d[_0x5474('0x3e')]=_['intersection'](_0x3d0e2d[_0x5474('0x40')],_0x3d0e2d[_0x5474('0x3c')]);_0x1e1760[_0x5474('0x42')]=_[_0x5474('0x3f')](_0x3d0e2d[_0x5474('0x40')],qs['fields'](_0x29517a['query']['fields']));_0x1e1760[_0x5474('0x42')]=_0x1e1760[_0x5474('0x42')][_0x5474('0x43')]?_0x1e1760[_0x5474('0x42')]:_0x3d0e2d[_0x5474('0x40')];_0x1e1760[_0x5474('0x46')]=qs[_0x5474('0x47')](_0x29517a['query'][_0x5474('0x47')]);_0x1e1760[_0x5474('0x48')]=qs['filters'](_[_0x5474('0x49')](_0x29517a[_0x5474('0x3c')],_0x3d0e2d[_0x5474('0x3e')]));if(_0x29517a[_0x5474('0x3c')]['filter']){_0x1e1760['where']=_[_0x5474('0x4a')](_0x1e1760['where'],{'$or':_[_0x5474('0x39')](_0x1e1760[_0x5474('0x42')],function(_0xf88699){var _0x3a5503={};_0x3a5503[_0xf88699]={'$like':'%'+_0x29517a[_0x5474('0x3c')][_0x5474('0x30')]+'%'};return _0x3a5503;})});}_0x1e1760=_[_0x5474('0x4a')]({},_0x1e1760,_0x29517a[_0x5474('0x50')]);return _0x38bc81[_0x5474('0x6e')](_0x1e1760);}})[_0x5474('0x2b')](function(_0x34e972){if(_0x34e972){_0x125ae5=_0x34e972[_0x5474('0x43')];if(!_0x29517a[_0x5474('0x3c')][_0x5474('0x44')]('nolimit')){_0x1e1760[_0x5474('0x23')]=qs[_0x5474('0x23')](_0x29517a[_0x5474('0x3c')][_0x5474('0x23')]);_0x1e1760[_0x5474('0x21')]=qs['offset'](_0x29517a['query'][_0x5474('0x21')]);}return _0x38bc81[_0x5474('0x6e')](_0x1e1760);}})[_0x5474('0x2b')](function(_0x20fbf8){if(_0x20fbf8){return _0x20fbf8?{'count':_0x125ae5,'rows':_0x20fbf8}:null;}})[_0x5474('0x2b')](respondWithResult(_0x8fc2a1,null))['catch'](handleError(_0x8fc2a1,null));};exports['addTeams']=function(_0x68babe,_0x150ade,_0x12e5ea){var _0x18d312=_0x68babe[_0x5474('0x52')]['teams'];var _0x1dd90d=_[_0x5474('0x39')](_0x18d312,'id');return db[_0x5474('0x6d')][_0x5474('0x65')]({'where':{'id':_0x1dd90d},'attributes':['id'],'include':[{'model':db[_0x5474('0x6f')],'as':'Agents','attributes':['id','name',_0x5474('0x70'),_0x5474('0x71'),_0x5474('0x72')],'raw':!![]}]})[_0x5474('0x2b')](function(_0x22f8c0){if(_0x22f8c0){var _0x5c2ca4=_['flatMap'](_0x22f8c0,function(_0x1f6b99){var _0x4e876e=_0x1f6b99[_0x5474('0x2c')]({'plain':!![]});_0x4e876e[_0x5474('0x73')]['forEach'](function(_0x1ce03c){_0x1ce03c[_0x5474('0x74')]=_[_0x5474('0x33')](_0x18d312,{'id':_0x4e876e['id']})['penalty'];});return _0x4e876e[_0x5474('0x73')];});return db['VoiceQueue'][_0x5474('0x33')]({'where':{'id':_0x68babe[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](function(_0x28c6de){return db[_0x5474('0x75')][_0x5474('0x76')](function(_0x14fa88){return _0x28c6de['addTeams'](_0x1dd90d,{'transaction':_0x14fa88})[_0x5474('0x2b')](function(){return BPromise[_0x5474('0x77')](_0x18d312,function(_0x3e78fc){return db[_0x5474('0x78')][_0x5474('0x79')]({'TeamId':_0x3e78fc['id'],'VoiceQueueId':_0x68babe[_0x5474('0x58')]['id'],'penalty':_0x3e78fc[_0x5474('0x74')]},{'transaction':_0x14fa88});});})[_0x5474('0x2b')](function(){return BPromise[_0x5474('0x77')](_0x5c2ca4,function(_0x1b02a2){return db[_0x5474('0x7a')]['findOrCreate']({'where':{'UserId':_0x1b02a2['id'],'VoiceQueueId':_0x68babe[_0x5474('0x58')]['id']},'defaults':{'penalty':_0x1b02a2[_0x5474('0x74')]},'transaction':_0x14fa88});});})[_0x5474('0x2b')](function(){return BPromise['each'](_[_0x5474('0x30')](_0x5c2ca4,{'online':!![]}),function(_0x16cd00){return db[_0x5474('0x7b')][_0x5474('0x79')]({'membername':_0x16cd00[_0x5474('0x37')],'UserId':_0x16cd00['id'],'queue_name':_0x28c6de[_0x5474('0x37')],'VoiceQueueId':_0x28c6de['id'],'interface':_[_0x5474('0x7c')](_0x16cd00[_0x5474('0x72')])?util[_0x5474('0x7d')](_0x5474('0x7e'),_0x16cd00[_0x5474('0x37')]):_0x16cd00['interface'],'paused':_0x16cd00[_0x5474('0x71')]||![],'penalty':_0x16cd00[_0x5474('0x74')]},{'transaction':_0x14fa88});});})['then'](function(){_0x5c2ca4[_0x5474('0x7f')](function(_0x490a9b){socket[_0x5474('0x80')](_0x5474('0x81'),{'UserId':_0x490a9b['id'],'VoiceQueueId':_0x28c6de['id']});});});});});}})[_0x5474('0x2b')](respondWithStatusCode(_0x150ade,null))[_0x5474('0x4e')](handleError(_0x150ade,null));};exports[_0x5474('0x82')]=function(_0x1e7249,_0x2ea2ca,_0xe1925){return db[_0x5474('0x6d')][_0x5474('0x65')]({'where':{'id':_0x1e7249['query'][_0x5474('0x83')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2ea2ca,null))[_0x5474('0x2b')](function(_0x230523){var _0x3fd78b=_[_0x5474('0x39')](_0x230523,'id');var _0x4376e2=[];var _0x282350=[];var _0x27a87b=squel[_0x5474('0x84')]();_0x27a87b[_0x5474('0x85')](_0x5474('0x86'))['from']('team_has_voice_queues','tq')[_0x5474('0x87')](_0x5474('0x88'),'ut',_0x5474('0x89'))['where']('VoiceQueueId\x20=\x20?',_0x1e7249[_0x5474('0x58')]['id']);for(var _0x4a01e9=0x0;_0x4a01e9<_0x230523['length'];_0x4a01e9+=0x1){let _0x333c80=_0x230523[_0x4a01e9];for(var _0x58c157=0x0;_0x58c157<_0x333c80[_0x5474('0x73')][_0x5474('0x43')];_0x58c157+=0x1){let _0x55e233=_0x333c80[_0x5474('0x73')][_0x58c157];var _0x4dc322=_0x27a87b[_0x5474('0x57')]();_0x4dc322[_0x5474('0x48')](_0x5474('0x8a'),_0x55e233['id']);_0x282350['push'](db[_0x5474('0x75')][_0x5474('0x3c')](_0x4dc322[_0x5474('0x8b')](),{'type':db[_0x5474('0x75')]['QueryTypes'][_0x5474('0x8c')]})[_0x5474('0x2b')](function(_0x25b8d9){if(_0x25b8d9['length']===0x1){return _0x55e233['id'];}else{var _0x3c0365=_[_0x5474('0x8d')](_[_0x5474('0x39')](_0x25b8d9,_0x5474('0x8e')),function(_0x109ef8){return _[_0x5474('0x31')](_0x3fd78b,_0x109ef8);});if(_0x3c0365){return _0x55e233['id'];}}}));}}return BPromise[_0x5474('0x8f')](_0x282350)[_0x5474('0x2b')](function(_0x613266){_0x4376e2=_(_0x4376e2)['union'](_0x613266)[_0x5474('0x90')]()[_0x5474('0x55')]();return db[_0x5474('0x4b')][_0x5474('0x33')]({'where':{'id':_0x1e7249[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](function(_0x52a360){return db[_0x5474('0x75')][_0x5474('0x76')](function(_0x68d4e7){return _0x52a360['removeTeams'](_0x1e7249[_0x5474('0x3c')][_0x5474('0x83')],{'transaction':_0x68d4e7})[_0x5474('0x2b')](function(){if(!_[_0x5474('0x91')](_0x4376e2)){return _0x52a360[_0x5474('0x92')](_0x4376e2,{'transaction':_0x68d4e7})['then'](function(){return db['UserVoiceQueueRt'][_0x5474('0x93')]({'where':{'VoiceQueueId':_0x1e7249[_0x5474('0x58')]['id'],'UserId':_0x4376e2},'transaction':_0x68d4e7});});}})[_0x5474('0x2b')](function(){_0x4376e2['forEach'](function(_0x2c3d45){socket[_0x5474('0x80')](_0x5474('0x94'),{'UserId':_0x2c3d45,'VoiceQueueId':_0x52a360['id']});});});});});});})[_0x5474('0x2b')](respondWithStatusCode(_0x2ea2ca,null))[_0x5474('0x4e')](handleError(_0x2ea2ca,null));};exports[_0x5474('0x95')]=function(_0x41f3ae,_0x472dad,_0xfb48dc){var _0x4e8133,_0x2a4f82;return db['VoiceQueue'][_0x5474('0x33')]({'where':{'id':_0x41f3ae[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x472dad,null))['then'](function(_0x575d65){if(_0x575d65){_0x2a4f82=_0x575d65;return _0x575d65['addAgents'](_0x41f3ae[_0x5474('0x52')][_0x5474('0x83')],_[_0x5474('0x59')](_0x41f3ae[_0x5474('0x52')],['ids','id'])||{})[_0x5474('0x96')](function(_0x1ebaa1){for(var _0x2eade0=0x0;_0x2eade0<_0x41f3ae[_0x5474('0x52')][_0x5474('0x83')][_0x5474('0x43')];_0x2eade0+=0x1){socket['emit'](_0x5474('0x81'),{'UserId':Number(_0x41f3ae[_0x5474('0x52')]['ids'][_0x2eade0]),'VoiceQueueId':Number(_0x41f3ae[_0x5474('0x58')]['id'])});}return _0x1ebaa1;});}})[_0x5474('0x2b')](function(_0x2ba69e){_0x4e8133=_0x2ba69e||[];if(_0x2a4f82){return db[_0x5474('0x6f')][_0x5474('0x65')]({'where':{'id':_0x41f3ae['body'][_0x5474('0x83')]},'attributes':['id','name','online',_0x5474('0x71'),_0x5474('0x72')],'raw':!![]});}})[_0x5474('0x2b')](function(_0x29e713){if(!_['isEmpty'](_0x29e713)){var _0x1662b0=[];for(var _0x332bcc=0x0;_0x332bcc<_0x29e713[_0x5474('0x43')];_0x332bcc++){if(_0x29e713[_0x332bcc]['online']){_0x1662b0[_0x5474('0x97')](db[_0x5474('0x7b')][_0x5474('0x79')]({'membername':_0x29e713[_0x332bcc][_0x5474('0x37')],'UserId':_0x29e713[_0x332bcc]['id'],'queue_name':_0x2a4f82[_0x5474('0x37')],'VoiceQueueId':_0x2a4f82['id'],'interface':_[_0x5474('0x7c')](_0x29e713[_0x332bcc][_0x5474('0x72')])?util[_0x5474('0x7d')](_0x5474('0x7e'),_0x29e713[_0x332bcc][_0x5474('0x37')]):_0x29e713[_0x332bcc][_0x5474('0x72')],'paused':_0x29e713[_0x332bcc][_0x5474('0x71')]||![],'penalty':_0x41f3ae['body'][_0x5474('0x74')]||0x0}));}}return BPromise[_0x5474('0x8f')](_0x1662b0);}})[_0x5474('0x2b')](function(){return _0x4e8133;})[_0x5474('0x2b')](respondWithResult(_0x472dad,null))[_0x5474('0x4e')](handleError(_0x472dad,null));};exports['removeAgents']=function(_0x1d1267,_0x3e3069,_0x27086c){return db['VoiceQueue'][_0x5474('0x33')]({'where':{'id':_0x1d1267[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x3e3069,null))['then'](function(_0x18b022){if(_0x18b022){return _0x18b022['removeAgents'](_0x1d1267[_0x5474('0x3c')][_0x5474('0x83')])['then'](function(){if(_['isArray'](_0x1d1267[_0x5474('0x3c')]['ids'])){for(var _0x16b2cd=0x0;_0x16b2cd<_0x1d1267[_0x5474('0x3c')][_0x5474('0x83')][_0x5474('0x43')];_0x16b2cd+=0x1){socket[_0x5474('0x80')](_0x5474('0x94'),{'UserId':Number(_0x1d1267[_0x5474('0x3c')]['ids'][_0x16b2cd]),'VoiceQueueId':Number(_0x1d1267[_0x5474('0x58')]['id'])});}}else{socket[_0x5474('0x80')]('userVoiceQueue:remove',{'UserId':Number(_0x1d1267[_0x5474('0x3c')][_0x5474('0x83')]),'VoiceQueueId':Number(_0x1d1267[_0x5474('0x58')]['id'])});}});}})[_0x5474('0x2b')](function(_0x2b4fbc){return db[_0x5474('0x7b')][_0x5474('0x93')]({'where':{'VoiceQueueId':_0x1d1267[_0x5474('0x58')]['id'],'UserId':_0x1d1267['query'][_0x5474('0x83')]}})['then'](function(){return _0x2b4fbc;});})[_0x5474('0x2b')](respondWithStatusCode(_0x3e3069,null))[_0x5474('0x4e')](handleError(_0x3e3069,null));};exports[_0x5474('0x98')]=function(_0x3f2143,_0x4ac329,_0x58dedb){var _0xcc3e2f={};var _0x2c0649={};var _0x13b25d;var _0x57ea61;return db[_0x5474('0x4b')][_0x5474('0x62')]({'where':{'id':_0x3f2143[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x4ac329,null))[_0x5474('0x2b')](function(_0x278620){if(_0x278620){_0x13b25d=_0x278620;_0x2c0649[_0x5474('0x40')]=_['keys'](db['User'][_0x5474('0x3a')]);_0x2c0649[_0x5474('0x3c')]=_['keys'](_0x3f2143[_0x5474('0x3c')]);_0x2c0649[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0x2c0649['model'],_0x2c0649[_0x5474('0x3c')]);_0xcc3e2f[_0x5474('0x42')]=_[_0x5474('0x3f')](_0x2c0649[_0x5474('0x40')],qs[_0x5474('0x41')](_0x3f2143[_0x5474('0x3c')][_0x5474('0x41')]));_0xcc3e2f[_0x5474('0x42')]=_0xcc3e2f['attributes'][_0x5474('0x43')]?_0xcc3e2f[_0x5474('0x42')]:_0x2c0649[_0x5474('0x40')];_0xcc3e2f[_0x5474('0x46')]=qs[_0x5474('0x47')](_0x3f2143[_0x5474('0x3c')][_0x5474('0x47')]);_0xcc3e2f['where']=qs[_0x5474('0x3e')](_[_0x5474('0x49')](_0x3f2143[_0x5474('0x3c')],_0x2c0649[_0x5474('0x3e')]));if(_0x3f2143[_0x5474('0x3c')]['filter']){_0xcc3e2f[_0x5474('0x48')]=_[_0x5474('0x4a')](_0xcc3e2f['where'],{'$or':_[_0x5474('0x39')](_0xcc3e2f[_0x5474('0x42')],function(_0x2b5f52){var _0x301239={};_0x301239[_0x2b5f52]={'$like':'%'+_0x3f2143[_0x5474('0x3c')]['filter']+'%'};return _0x301239;})});}_0xcc3e2f=_[_0x5474('0x4a')]({},_0xcc3e2f,_0x3f2143[_0x5474('0x50')]);return _0x13b25d[_0x5474('0x98')](_0xcc3e2f);}})[_0x5474('0x2b')](function(_0x2886bb){if(_0x2886bb){_0x57ea61=_0x2886bb[_0x5474('0x43')];if(!_0x3f2143[_0x5474('0x3c')][_0x5474('0x44')](_0x5474('0x45'))){_0xcc3e2f[_0x5474('0x23')]=qs[_0x5474('0x23')](_0x3f2143[_0x5474('0x3c')][_0x5474('0x23')]);_0xcc3e2f[_0x5474('0x21')]=qs[_0x5474('0x21')](_0x3f2143[_0x5474('0x3c')][_0x5474('0x21')]);}return _0x13b25d['getAgents'](_0xcc3e2f);}})[_0x5474('0x2b')](function(_0x4fb68e){if(_0x4fb68e){return _0x4fb68e?{'count':_0x57ea61,'rows':_0x4fb68e}:null;}})['then'](respondWithResult(_0x4ac329,null))[_0x5474('0x4e')](handleError(_0x4ac329,null));};exports[_0x5474('0x99')]=function(_0x452be0,_0x11344e,_0x539bf3){var _0x21ab99={};var _0x1efa6d={};var _0x14f910;var _0x37c089;return db['VoiceQueue'][_0x5474('0x62')]({'where':{'id':_0x452be0[_0x5474('0x58')]['id']}})['then'](handleEntityNotFound(_0x11344e,null))[_0x5474('0x2b')](function(_0x49dc78){if(_0x49dc78){_0x14f910=_0x49dc78;_0x1efa6d[_0x5474('0x40')]=_[_0x5474('0x3d')](db[_0x5474('0x7b')][_0x5474('0x3a')]);_0x1efa6d[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x452be0[_0x5474('0x3c')]);_0x1efa6d['filters']=_[_0x5474('0x3f')](_0x1efa6d['model'],_0x1efa6d[_0x5474('0x3c')]);_0x21ab99[_0x5474('0x42')]=_[_0x5474('0x3f')](_0x1efa6d[_0x5474('0x40')],qs[_0x5474('0x41')](_0x452be0[_0x5474('0x3c')]['fields']));_0x21ab99[_0x5474('0x42')]=_0x21ab99[_0x5474('0x42')]['length']?_0x21ab99[_0x5474('0x42')]:_0x1efa6d['model'];_0x21ab99[_0x5474('0x46')]=qs[_0x5474('0x47')](_0x452be0[_0x5474('0x3c')][_0x5474('0x47')]);_0x21ab99['where']=qs[_0x5474('0x3e')](_[_0x5474('0x49')](_0x452be0['query'],_0x1efa6d[_0x5474('0x3e')]));if(_0x452be0['query'][_0x5474('0x30')]){_0x21ab99[_0x5474('0x48')]=_[_0x5474('0x4a')](_0x21ab99[_0x5474('0x48')],{'$or':_[_0x5474('0x39')](_0x21ab99[_0x5474('0x42')],function(_0x31709e){var _0x5f586b={};_0x5f586b[_0x31709e]={'$like':'%'+_0x452be0[_0x5474('0x3c')][_0x5474('0x30')]+'%'};return _0x5f586b;})});}_0x21ab99=_[_0x5474('0x4a')]({},_0x21ab99,_0x452be0[_0x5474('0x50')]);return _0x14f910[_0x5474('0x99')](_0x21ab99);}})['then'](function(_0x2e8fd3){if(_0x2e8fd3){_0x37c089=_0x2e8fd3['length'];if(!_0x452be0[_0x5474('0x3c')]['hasOwnProperty']('nolimit')){_0x21ab99['limit']=qs['limit'](_0x452be0[_0x5474('0x3c')][_0x5474('0x23')]);_0x21ab99[_0x5474('0x21')]=qs['offset'](_0x452be0[_0x5474('0x3c')]['offset']);}return _0x14f910[_0x5474('0x99')](_0x21ab99);}})['then'](function(_0xa53047){return _0xa53047?{'count':_0x37c089,'rows':_0xa53047}:null;})[_0x5474('0x2b')](respondWithResult(_0x11344e,null))[_0x5474('0x4e')](handleError(_0x11344e,null));};exports[_0x5474('0x9a')]=function(_0x93862e,_0x306c90,_0xe3e398){var _0x270cc4={};var _0x52f949={};var _0x4abb72;var _0x43798e;return db[_0x5474('0x4b')]['findOne']({'where':{'id':_0x93862e['params']['id']}})['then'](handleEntityNotFound(_0x306c90,null))[_0x5474('0x2b')](function(_0x409413){if(_0x409413){_0x4abb72=_0x409413;_0x52f949['model']=_['keys'](db[_0x5474('0x9b')][_0x5474('0x3a')]);_0x52f949[_0x5474('0x3c')]=_[_0x5474('0x3d')](_0x93862e[_0x5474('0x3c')]);_0x52f949[_0x5474('0x3e')]=_[_0x5474('0x3f')](_0x52f949[_0x5474('0x40')],_0x52f949[_0x5474('0x3c')]);_0x270cc4[_0x5474('0x42')]=_[_0x5474('0x3f')](_0x52f949[_0x5474('0x40')],qs[_0x5474('0x41')](_0x93862e[_0x5474('0x3c')][_0x5474('0x41')]));_0x270cc4['attributes']=_0x270cc4['attributes'][_0x5474('0x43')]?_0x270cc4[_0x5474('0x42')]:_0x52f949[_0x5474('0x40')];_0x270cc4[_0x5474('0x46')]=qs[_0x5474('0x47')](_0x93862e[_0x5474('0x3c')][_0x5474('0x47')]);_0x270cc4['where']=qs[_0x5474('0x3e')](_[_0x5474('0x49')](_0x93862e[_0x5474('0x3c')],_0x52f949[_0x5474('0x3e')]));if(_0x93862e[_0x5474('0x3c')][_0x5474('0x30')]){_0x270cc4['where']=_[_0x5474('0x4a')](_0x270cc4[_0x5474('0x48')],{'$or':_[_0x5474('0x39')](_0x270cc4['attributes'],function(_0x5b31fc){var _0x4e50f3={};_0x4e50f3[_0x5b31fc]={'$like':'%'+_0x93862e[_0x5474('0x3c')][_0x5474('0x30')]+'%'};return _0x4e50f3;})});}_0x270cc4=_[_0x5474('0x4a')]({},_0x270cc4,_0x93862e[_0x5474('0x50')]);return _0x4abb72['getLists'](_0x270cc4);}})[_0x5474('0x2b')](function(_0x201a3d){if(_0x201a3d){_0x43798e=_0x201a3d['length'];if(!_0x93862e[_0x5474('0x3c')][_0x5474('0x44')](_0x5474('0x45'))){_0x270cc4[_0x5474('0x23')]=qs[_0x5474('0x23')](_0x93862e['query'][_0x5474('0x23')]);_0x270cc4['offset']=qs[_0x5474('0x21')](_0x93862e[_0x5474('0x3c')][_0x5474('0x21')]);}return _0x4abb72['getLists'](_0x270cc4);}})[_0x5474('0x2b')](function(_0x10a883){if(_0x10a883){return _0x10a883?{'count':_0x43798e,'rows':_0x10a883}:null;}})[_0x5474('0x2b')](respondWithResult(_0x306c90,null))['catch'](handleError(_0x306c90,null));};exports[_0x5474('0x9c')]=function(_0x6fd54,_0x473277,_0x554038){var _0xbe5e1=moment()[_0x5474('0x7d')](_0x5474('0x9d'));var _0x26ebbe,_0x2f9480;return db[_0x5474('0x4b')][_0x5474('0x33')]({'where':{'id':_0x6fd54[_0x5474('0x58')]['id']}})['then'](handleEntityNotFound(_0x473277,null))[_0x5474('0x2b')](function(_0x139921){if(_0x139921){_0x2f9480=_0x139921;return _0x139921[_0x5474('0x9c')](_0x6fd54[_0x5474('0x52')][_0x5474('0x83')],_[_0x5474('0x59')](_0x6fd54['body'],[_0x5474('0x83'),'id'])||{});}return null;})[_0x5474('0x96')](function(_0x577ac6){var _0x6b7df3;_0x26ebbe=_0x577ac6||[];var _0x41969e=[];if(_0x577ac6){for(var _0x185919=0x0;_0x185919<_0x577ac6[_0x5474('0x43')];_0x185919+=0x1){var _0x1c48c6=_0x577ac6[_0x185919][_0x5474('0x2c')]({'plain':!![]});_0x2f9480[_0x5474('0x9e')]=_0x6fd54[_0x5474('0x52')]['dialCheckDuplicateType']?_0x6fd54['body'][_0x5474('0x9e')]:_0x2f9480['dialCheckDuplicateType'];switch(_0x2f9480['dialCheckDuplicateType']){case'always':_0x6b7df3=squel[_0x5474('0x9f')]()[_0x5474('0xa0')](_0x5474('0xa1'))[_0x5474('0xa2')]([_0x5474('0xa3'),_0x5474('0xa4'),_0x5474('0xa5'),_0x5474('0xa6'),_0x5474('0x64'),_0x5474('0x5a'),_0x5474('0x5b')],squel['select']()['field']('phone','phone')['field']('\x27'+_0xbe5e1+'\x27',_0x5474('0xa4'))['field']('id',_0x5474('0xa5'))[_0x5474('0x85')](_0x1c48c6[_0x5474('0xa7')][_0x5474('0x8b')](),'ListId')[_0x5474('0x85')](_0x6fd54[_0x5474('0x58')]['id'][_0x5474('0x8b')](),'VoiceQueueId')['field']('\x27'+_0xbe5e1+'\x27',_0x5474('0x5a'))[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27',_0x5474('0x5b'))[_0x5474('0xa8')](_0x5474('0xa9'))[_0x5474('0x48')]('deletedAt\x20IS\x20NULL')[_0x5474('0x48')](_0x5474('0xaa'),_0x1c48c6[_0x5474('0xa7')][_0x5474('0x8b')]())[_0x5474('0x48')](_0x5474('0xab'))[_0x5474('0x48')](_0x5474('0xac'),squel[_0x5474('0x84')]()['field'](_0x5474('0xad'))[_0x5474('0xa8')](_0x5474('0xae'))[_0x5474('0x48')](_0x5474('0xaf'),_0x6fd54[_0x5474('0x58')]['id']['toString']()))[_0x5474('0x48')](_0x5474('0xac'),squel[_0x5474('0x84')]()[_0x5474('0x85')](_0x5474('0xb0'))[_0x5474('0xa8')](_0x5474('0xa1'))[_0x5474('0x48')](_0x5474('0xaf'),_0x6fd54['params']['id']['toString']())))['toString']();break;case _0x5474('0xb1'):_0x6b7df3=squel[_0x5474('0x9f')]()[_0x5474('0xa0')](_0x5474('0xa1'))[_0x5474('0xa2')](['phone','scheduledAt',_0x5474('0xa5'),'ListId','VoiceQueueId',_0x5474('0x5a'),_0x5474('0x5b')],squel[_0x5474('0x84')]()['field']('phone','phone')[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27','scheduledAt')[_0x5474('0x85')]('id',_0x5474('0xa5'))[_0x5474('0x85')](_0x1c48c6[_0x5474('0xa7')][_0x5474('0x8b')](),_0x5474('0xa6'))['field'](_0x6fd54[_0x5474('0x58')]['id']['toString'](),_0x5474('0x64'))[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27',_0x5474('0x5a'))[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27','updatedAt')[_0x5474('0xa8')](_0x5474('0xa9'))[_0x5474('0x48')](_0x5474('0xb2'))[_0x5474('0x48')](_0x5474('0xaa'),_0x1c48c6[_0x5474('0xa7')]['toString']())[_0x5474('0x48')](_0x5474('0xab'))[_0x5474('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5474('0x84')]()[_0x5474('0x85')](_0x5474('0xb0'))[_0x5474('0xa8')](_0x5474('0xa1'))[_0x5474('0x48')](_0x5474('0xaf'),_0x6fd54[_0x5474('0x58')]['id'][_0x5474('0x8b')]())))[_0x5474('0x8b')]();break;default:_0x6b7df3=squel[_0x5474('0x9f')]()[_0x5474('0xa0')](_0x5474('0xa1'))[_0x5474('0xa2')]([_0x5474('0xa3'),_0x5474('0xa4'),_0x5474('0xa5'),'ListId',_0x5474('0x64'),'createdAt',_0x5474('0x5b')],squel[_0x5474('0x84')]()['field'](_0x5474('0xa3'),'phone')[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27','scheduledAt')[_0x5474('0x85')]('id',_0x5474('0xa5'))[_0x5474('0x85')](_0x1c48c6[_0x5474('0xa7')]['toString'](),'ListId')['field'](_0x6fd54[_0x5474('0x58')]['id']['toString'](),_0x5474('0x64'))[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27','createdAt')[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27',_0x5474('0x5b'))[_0x5474('0xa8')]('cm_contacts')[_0x5474('0x48')](_0x5474('0xb2'))['where'](_0x5474('0xaa'),_0x1c48c6[_0x5474('0xa7')]['toString']())[_0x5474('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0x5474('0x8b')]();}_0x41969e[_0x5474('0x97')](db[_0x5474('0x75')][_0x5474('0x3c')](_0x6b7df3));}return BPromise[_0x5474('0x8f')](_0x41969e);}})[_0x5474('0x2b')](function(){var _0xd407db=[];var _0x3c872f=squel['insert']()['into']('cm_hopper_additional_phones')[_0x5474('0xa2')](['CmHopperId',_0x5474('0xa3'),_0x5474('0xb3'),_0x5474('0x5a'),'updatedAt'],squel[_0x5474('0x84')]()['field']('h.id')[_0x5474('0x85')](_0x5474('0xb4'))[_0x5474('0x85')](_0x5474('0xb5'))[_0x5474('0x85')]('\x27'+_0xbe5e1+'\x27',_0x5474('0x5a'))['field']('\x27'+_0xbe5e1+'\x27',_0x5474('0x5b'))[_0x5474('0xa8')](_0x5474('0xb6'),'ci')['join'](_0x5474('0xa1'),'h',_0x5474('0xb7'))[_0x5474('0x48')]('h.scheduledat=?',_0xbe5e1)[_0x5474('0x48')](_0x5474('0xb8'),'PHONE'))[_0x5474('0x8b')]();_0xd407db[_0x5474('0x97')](db[_0x5474('0x75')][_0x5474('0x3c')](_0x3c872f));return BPromise[_0x5474('0x8f')](_0xd407db);})[_0x5474('0x2b')](function(){return _0x26ebbe;})[_0x5474('0x2b')](respondWithResult(_0x473277,null))[_0x5474('0x4e')](handleError(_0x473277,null));};exports[_0x5474('0xb9')]=function(_0xd3bcee,_0x380a4f,_0xac8fd3){return db[_0x5474('0x4b')][_0x5474('0x33')]({'where':{'id':_0xd3bcee['params']['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x380a4f,null))['then'](function(_0x2b9f7d){if(_0x2b9f7d){return _0x2b9f7d[_0x5474('0xb9')](_0xd3bcee[_0x5474('0x3c')][_0x5474('0x83')]);}})[_0x5474('0x2b')](function(_0xb0e675){if(_0xb0e675){return db['CmHopper']['destroy']({'where':{'ListId':_0xd3bcee[_0x5474('0x3c')]['ids'],'VoiceQueueId':_0xd3bcee[_0x5474('0x58')]['id']}})['then'](function(){return _0xb0e675;});}})[_0x5474('0x2b')](respondWithStatusCode(_0x380a4f,null))[_0x5474('0x4e')](handleError(_0x380a4f,null));};exports[_0x5474('0xba')]=function(_0x1c3a5d,_0x3df9cc,_0x1b845a){var _0x1c835c={};var _0x2cd88f={};var _0x2a16ef;var _0x3a9a8a;return db[_0x5474('0x4b')][_0x5474('0x62')]({'where':{'id':_0x1c3a5d[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x3df9cc,null))[_0x5474('0x2b')](function(_0x10fbcb){if(_0x10fbcb){_0x2a16ef=_0x10fbcb;_0x2cd88f[_0x5474('0x40')]=_[_0x5474('0x3d')](db[_0x5474('0x9b')]['rawAttributes']);_0x2cd88f[_0x5474('0x3c')]=_['keys'](_0x1c3a5d[_0x5474('0x3c')]);_0x2cd88f['filters']=_[_0x5474('0x3f')](_0x2cd88f[_0x5474('0x40')],_0x2cd88f['query']);_0x1c835c[_0x5474('0x42')]=_['intersection'](_0x2cd88f[_0x5474('0x40')],qs[_0x5474('0x41')](_0x1c3a5d['query'][_0x5474('0x41')]));_0x1c835c[_0x5474('0x42')]=_0x1c835c[_0x5474('0x42')]['length']?_0x1c835c['attributes']:_0x2cd88f[_0x5474('0x40')];_0x1c835c[_0x5474('0x46')]=qs['sort'](_0x1c3a5d[_0x5474('0x3c')][_0x5474('0x47')]);_0x1c835c[_0x5474('0x48')]=qs[_0x5474('0x3e')](_[_0x5474('0x49')](_0x1c3a5d[_0x5474('0x3c')],_0x2cd88f['filters']));if(_0x1c3a5d['query'][_0x5474('0x30')]){_0x1c835c[_0x5474('0x48')]=_[_0x5474('0x4a')](_0x1c835c['where'],{'$or':_[_0x5474('0x39')](_0x1c835c['attributes'],function(_0x571b12){var _0xecdb39={};_0xecdb39[_0x571b12]={'$like':'%'+_0x1c3a5d[_0x5474('0x3c')][_0x5474('0x30')]+'%'};return _0xecdb39;})});}_0x1c835c=_[_0x5474('0x4a')]({},_0x1c835c,_0x1c3a5d[_0x5474('0x50')]);return _0x2a16ef['getBlackLists'](_0x1c835c);}})[_0x5474('0x2b')](function(_0x40f1e0){if(_0x40f1e0){_0x3a9a8a=_0x40f1e0[_0x5474('0x43')];if(!_0x1c3a5d['query'][_0x5474('0x44')]('nolimit')){_0x1c835c[_0x5474('0x23')]=qs['limit'](_0x1c3a5d[_0x5474('0x3c')][_0x5474('0x23')]);_0x1c835c['offset']=qs[_0x5474('0x21')](_0x1c3a5d['query']['offset']);}return _0x2a16ef[_0x5474('0xba')](_0x1c835c);}})[_0x5474('0x2b')](function(_0x3cb878){if(_0x3cb878){return _0x3cb878?{'count':_0x3a9a8a,'rows':_0x3cb878}:null;}})[_0x5474('0x2b')](respondWithResult(_0x3df9cc,null))[_0x5474('0x4e')](handleError(_0x3df9cc,null));};exports[_0x5474('0xbb')]=function(_0x25d3c9,_0x4e43bf,_0x206f02){var _0x2d1c49,_0x26465e;return db['VoiceQueue'][_0x5474('0x33')]({'where':{'id':_0x25d3c9[_0x5474('0x58')]['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x4e43bf,null))['then'](function(_0x2ac329){if(_0x2ac329){_0x26465e=_0x2ac329;return _0x2ac329[_0x5474('0xbb')](_0x25d3c9[_0x5474('0x52')][_0x5474('0x83')],_[_0x5474('0x59')](_0x25d3c9[_0x5474('0x52')],[_0x5474('0x83'),'id'])||{});}return null;})[_0x5474('0x96')](function(_0x166bca){var _0x3fcb40;_0x2d1c49=_0x166bca||[];var _0x114af2=[];if(_0x166bca){for(var _0x271e86=0x0;_0x271e86<_0x166bca[_0x5474('0x43')];_0x271e86+=0x1){var _0x46e01b=_0x166bca[_0x271e86][_0x5474('0x2c')]({'plain':!![]});_0x3fcb40=squel[_0x5474('0x9f')]()[_0x5474('0xa0')](_0x5474('0xbc'))[_0x5474('0xa2')]([_0x5474('0xa3'),_0x5474('0xa5'),_0x5474('0xa6'),'VoiceQueueId',_0x5474('0x5a'),_0x5474('0x5b')],squel[_0x5474('0x84')]()['field'](_0x5474('0xa3'),'phone')[_0x5474('0x85')]('id',_0x5474('0xa5'))[_0x5474('0x85')](_0x46e01b['CmListId']['toString'](),'ListId')[_0x5474('0x85')](_0x25d3c9[_0x5474('0x58')]['id']['toString'](),_0x5474('0x64'))[_0x5474('0x85')]('NOW()',_0x5474('0x5a'))[_0x5474('0x85')](_0x5474('0xbd'),_0x5474('0x5b'))[_0x5474('0xa8')]('cm_contacts')[_0x5474('0x48')](_0x5474('0xb2'))[_0x5474('0x48')](_0x5474('0xaa'),_0x46e01b[_0x5474('0xa7')][_0x5474('0x8b')]())[_0x5474('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0x5474('0x8b')]();_0x114af2[_0x5474('0x97')](db[_0x5474('0x75')][_0x5474('0x3c')](_0x3fcb40));}return BPromise[_0x5474('0x8f')](_0x114af2);}})[_0x5474('0x2b')](function(){return _0x2d1c49;})[_0x5474('0x2b')](respondWithResult(_0x4e43bf,null))[_0x5474('0x4e')](handleError(_0x4e43bf,null));};exports['removeBlackLists']=function(_0x4280a9,_0x490065,_0x5d1798){return db[_0x5474('0x4b')]['find']({'where':{'id':_0x4280a9['params']['id']}})[_0x5474('0x2b')](handleEntityNotFound(_0x490065,null))[_0x5474('0x2b')](function(_0x3ec66f){if(_0x3ec66f){return _0x3ec66f[_0x5474('0xbe')](_0x4280a9[_0x5474('0x3c')][_0x5474('0x83')]);}})[_0x5474('0x2b')](function(_0x1524a8){if(_0x1524a8){return db[_0x5474('0x6c')][_0x5474('0x93')]({'where':{'ListId':_0x4280a9[_0x5474('0x3c')]['ids'],'VoiceQueueId':_0x4280a9[_0x5474('0x58')]['id']}})['then'](function(){return _0x1524a8;});}})[_0x5474('0x2b')](respondWithStatusCode(_0x490065,null))[_0x5474('0x4e')](handleError(_0x490065,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 8a1e8c9..14f232f 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 _0x90d1=['events','../../mysqldb','VoiceQueue','setMaxListeners','save','remove','hasOwnProperty','exports'];(function(_0x506b51,_0x2d2b6d){var _0xca5779=function(_0x5f0fcb){while(--_0x5f0fcb){_0x506b51['push'](_0x506b51['shift']());}};_0xca5779(++_0x2d2b6d);}(_0x90d1,0xc8));var _0x190d=function(_0xd6fcb5,_0x526523){_0xd6fcb5=_0xd6fcb5-0x0;var _0x278ac7=_0x90d1[_0xd6fcb5];return _0x278ac7;};'use strict';var EventEmitter=require(_0x190d('0x0'));var VoiceQueue=require(_0x190d('0x1'))['db'][_0x190d('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x190d('0x3')](0x0);var events={'afterCreate':_0x190d('0x4'),'afterUpdate':'update','afterDestroy':_0x190d('0x5')};function emitEvent(_0x2e880c){return function(_0x5015cb,_0x1d71b2,_0x1a7dd0){VoiceQueueEvents['emit'](_0x2e880c+':'+_0x5015cb['id'],_0x5015cb);VoiceQueueEvents['emit'](_0x2e880c,_0x5015cb);_0x1a7dd0(null);};}for(var e in events){if(events[_0x190d('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x190d('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x23fd=['exports','events','../../mysqldb','VoiceQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x324d49,_0x54408e){var _0x1db6f0=function(_0x1cdf84){while(--_0x1cdf84){_0x324d49['push'](_0x324d49['shift']());}};_0x1db6f0(++_0x54408e);}(_0x23fd,0x141));var _0xd23f=function(_0x553502,_0x4d2c0c){_0x553502=_0x553502-0x0;var _0x246c37=_0x23fd[_0x553502];return _0x246c37;};'use strict';var EventEmitter=require(_0xd23f('0x0'));var VoiceQueue=require(_0xd23f('0x1'))['db'][_0xd23f('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd23f('0x3'),'afterUpdate':_0xd23f('0x4'),'afterDestroy':_0xd23f('0x5')};function emitEvent(_0x5bf551){return function(_0x3511a8,_0x42c5bf,_0x333368){VoiceQueueEvents[_0xd23f('0x6')](_0x5bf551+':'+_0x3511a8['id'],_0x3511a8);VoiceQueueEvents['emit'](_0x5bf551,_0x3511a8);_0x333368(null);};}for(var e in events){if(events[_0xd23f('0x7')](e)){var event=events[e];VoiceQueue[_0xd23f('0x8')](e,emitEvent(event));}}module[_0xd23f('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 999e2b5..d309eef 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xf86485,_0x436928){var _0x5b80aa=function(_0x3ac5b3){while(--_0x3ac5b3){_0xf86485['push'](_0xf86485['shift']());}};_0x5b80aa(++_0x436928);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x55ca,0x126));var _0xa55c=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x55ca[_0x3e7804];return _0x56efda;};'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')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'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 b593abe..fcec7ae 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 _0x1336=['../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','./voiceQueue.socket','register','request','then','info','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','VoiceQueue','findAll','options','where','limit','include','map','model','attributes','debug','GetVoiceQueue','ShowVoiceQueue','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x587fce,_0x258beb){var _0x21e802=function(_0x156119){while(--_0x156119){_0x587fce['push'](_0x587fce['shift']());}};_0x21e802(++_0x258beb);}(_0x1336,0x118));var _0x6133=function(_0x400f31,_0x57e573){_0x400f31=_0x400f31-0x0;var _0x78b2a=_0x1336[_0x400f31];return _0x78b2a;};'use strict';var _=require(_0x6133('0x0'));var util=require(_0x6133('0x1'));var moment=require(_0x6133('0x2'));var BPromise=require('bluebird');var rs=require(_0x6133('0x3'));var fs=require('fs');var Redis=require(_0x6133('0x4'));var db=require(_0x6133('0x5'))['db'];var utils=require(_0x6133('0x6'));var logger=require(_0x6133('0x7'))('rpc');var config=require(_0x6133('0x8'));var jayson=require(_0x6133('0x9'));var client=jayson[_0x6133('0xa')][_0x6133('0xb')]({'port':0x232a});config['redis']=_[_0x6133('0xc')](config[_0x6133('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6133('0xd')]));require(_0x6133('0xe'))[_0x6133('0xf')](socket);function respondWithRpcPromise(_0x5498e6,_0x233c88,_0x2c1d6e){return new BPromise(function(_0x2ed5d0,_0x2c07d7){return client[_0x6133('0x10')](_0x5498e6,_0x2c1d6e)[_0x6133('0x11')](function(_0x1604bb){logger[_0x6133('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x233c88,_0x6133('0x13'));logger['debug'](_0x6133('0x14'),_0x233c88,_0x6133('0x13'),JSON[_0x6133('0x15')](_0x1604bb));if(_0x1604bb[_0x6133('0x16')]){if(_0x1604bb['error'][_0x6133('0x17')]===0x1f4){logger[_0x6133('0x16')](_0x6133('0x18'),_0x233c88,_0x1604bb[_0x6133('0x16')][_0x6133('0x19')]);return _0x2c07d7(_0x1604bb['error']['message']);}logger[_0x6133('0x16')](_0x6133('0x18'),_0x233c88,_0x1604bb[_0x6133('0x16')][_0x6133('0x19')]);return _0x2ed5d0(_0x1604bb['error'][_0x6133('0x19')]);}else{logger[_0x6133('0x12')](_0x6133('0x18'),_0x233c88,_0x6133('0x13'));_0x2ed5d0(_0x1604bb[_0x6133('0x1a')][_0x6133('0x19')]);}})[_0x6133('0x1b')](function(_0x58e7e9){logger[_0x6133('0x16')](_0x6133('0x18'),_0x233c88,_0x58e7e9);_0x2c07d7(_0x58e7e9);});});}exports['GetVoiceQueue']=function(_0x3830aa){var _0x45f425=this;return new Promise(function(_0x5a5d98,_0x3109c2){return db[_0x6133('0x1c')][_0x6133('0x1d')]({'raw':_0x3830aa[_0x6133('0x1e')]?_0x3830aa[_0x6133('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3830aa[_0x6133('0x1e')]?_0x3830aa[_0x6133('0x1e')][_0x6133('0x1f')]||null:null,'attributes':_0x3830aa[_0x6133('0x1e')]?_0x3830aa[_0x6133('0x1e')]['attributes']||null:null,'limit':_0x3830aa[_0x6133('0x1e')]?_0x3830aa[_0x6133('0x1e')][_0x6133('0x20')]||null:null,'include':_0x3830aa['options']?_0x3830aa[_0x6133('0x1e')][_0x6133('0x21')]?_[_0x6133('0x22')](_0x3830aa[_0x6133('0x1e')][_0x6133('0x21')],function(_0x209768){return{'model':db[_0x209768[_0x6133('0x23')]],'as':_0x209768['as'],'attributes':_0x209768[_0x6133('0x24')],'include':_0x209768[_0x6133('0x21')]?_[_0x6133('0x22')](_0x209768[_0x6133('0x21')],function(_0x112ebd){return{'model':db[_0x112ebd[_0x6133('0x23')]],'as':_0x112ebd['as'],'attributes':_0x112ebd[_0x6133('0x24')],'include':_0x112ebd[_0x6133('0x21')]?_[_0x6133('0x22')](_0x112ebd['include'],function(_0x3a99c5){return{'model':db[_0x3a99c5[_0x6133('0x23')]],'as':_0x3a99c5['as'],'attributes':_0x3a99c5[_0x6133('0x24')]};}):[]};}):[]};}):[]:[]})[_0x6133('0x11')](function(_0x582f1d){logger['info']('GetVoiceQueue',_0x3830aa);logger[_0x6133('0x25')](_0x6133('0x26'),_0x3830aa,JSON[_0x6133('0x15')](_0x582f1d));_0x5a5d98(_0x582f1d);})[_0x6133('0x1b')](function(_0x5983a5){logger[_0x6133('0x16')]('GetVoiceQueue',_0x5983a5[_0x6133('0x19')],_0x3830aa);_0x3109c2(_0x45f425[_0x6133('0x16')](0x1f4,_0x5983a5['message']));});});};exports[_0x6133('0x27')]=function(_0x2d2240){var _0x291fe1=this;return new Promise(function(_0x2fa34d,_0x30deb6){return db['VoiceQueue']['find']({'raw':_0x2d2240[_0x6133('0x1e')]?_0x2d2240['options'][_0x6133('0x28')]===undefined?!![]:![]:!![],'where':_0x2d2240['options']?_0x2d2240[_0x6133('0x1e')][_0x6133('0x1f')]||null:null,'attributes':_0x2d2240[_0x6133('0x1e')]?_0x2d2240[_0x6133('0x1e')][_0x6133('0x24')]||null:null,'include':_0x2d2240[_0x6133('0x1e')]?_0x2d2240[_0x6133('0x1e')]['include']?_[_0x6133('0x22')](_0x2d2240[_0x6133('0x1e')][_0x6133('0x21')],function(_0x330244){return{'model':db[_0x330244['model']],'as':_0x330244['as'],'attributes':_0x330244[_0x6133('0x24')],'include':_0x330244[_0x6133('0x21')]?_[_0x6133('0x22')](_0x330244[_0x6133('0x21')],function(_0x556c2d){return{'model':db[_0x556c2d[_0x6133('0x23')]],'as':_0x556c2d['as'],'attributes':_0x556c2d['attributes'],'include':_0x556c2d['include']?_['map'](_0x556c2d[_0x6133('0x21')],function(_0x4601da){return{'model':db[_0x4601da[_0x6133('0x23')]],'as':_0x4601da['as'],'attributes':_0x4601da['attributes']};}):[]};}):[]};}):[]:[]})[_0x6133('0x11')](function(_0x1347e9){logger[_0x6133('0x12')]('ShowVoiceQueue',_0x2d2240);logger['debug'](_0x6133('0x27'),_0x2d2240,JSON[_0x6133('0x15')](_0x1347e9));_0x2fa34d(_0x1347e9);})['catch'](function(_0x369993){logger[_0x6133('0x16')]('ShowVoiceQueue',_0x369993[_0x6133('0x19')],_0x2d2240);_0x30deb6(_0x291fe1[_0x6133('0x16')](0x1f4,_0x369993[_0x6133('0x19')]));});});}; \ No newline at end of file +var _0x1f34=['then','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','map','model','include','ShowVoiceQueue','find'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x1f34,0x129));var _0x41f3=function(_0x1b45ad,_0x3b7f8a){_0x1b45ad=_0x1b45ad-0x0;var _0x10f46d=_0x1f34[_0x1b45ad];return _0x10f46d;};'use strict';var _=require(_0x41f3('0x0'));var util=require('util');var moment=require(_0x41f3('0x1'));var BPromise=require('bluebird');var rs=require(_0x41f3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41f3('0x3'))['db'];var utils=require(_0x41f3('0x4'));var logger=require(_0x41f3('0x5'))('rpc');var config=require(_0x41f3('0x6'));var jayson=require(_0x41f3('0x7'));var client=jayson[_0x41f3('0x8')][_0x41f3('0x9')]({'port':0x232a});config[_0x41f3('0xa')]=_[_0x41f3('0xb')](config[_0x41f3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x41f3('0xc'))(new Redis(config[_0x41f3('0xa')]));require(_0x41f3('0xd'))[_0x41f3('0xe')](socket);function respondWithRpcPromise(_0x3a0d56,_0x518b72,_0xf2f806){return new BPromise(function(_0x21dd69,_0x532349){return client['request'](_0x3a0d56,_0xf2f806)['then'](function(_0x5cfa38){logger['info'](_0x41f3('0xf'),_0x518b72,_0x41f3('0x10'));logger[_0x41f3('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x518b72,'request\x20sent',JSON[_0x41f3('0x12')](_0x5cfa38));if(_0x5cfa38[_0x41f3('0x13')]){if(_0x5cfa38[_0x41f3('0x13')][_0x41f3('0x14')]===0x1f4){logger[_0x41f3('0x13')](_0x41f3('0xf'),_0x518b72,_0x5cfa38[_0x41f3('0x13')][_0x41f3('0x15')]);return _0x532349(_0x5cfa38[_0x41f3('0x13')]['message']);}logger[_0x41f3('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x518b72,_0x5cfa38[_0x41f3('0x13')][_0x41f3('0x15')]);return _0x21dd69(_0x5cfa38['error'][_0x41f3('0x15')]);}else{logger[_0x41f3('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x518b72,_0x41f3('0x10'));_0x21dd69(_0x5cfa38['result'][_0x41f3('0x15')]);}})[_0x41f3('0x17')](function(_0x35460d){logger[_0x41f3('0x13')](_0x41f3('0xf'),_0x518b72,_0x35460d);_0x532349(_0x35460d);});});}exports[_0x41f3('0x18')]=function(_0x1475b9){var _0x15de03=this;return new Promise(function(_0x2f663b,_0x1c37e0){return db[_0x41f3('0x19')][_0x41f3('0x1a')]({'raw':_0x1475b9[_0x41f3('0x1b')]?_0x1475b9[_0x41f3('0x1b')][_0x41f3('0x1c')]===undefined?!![]:![]:!![],'where':_0x1475b9[_0x41f3('0x1b')]?_0x1475b9['options']['where']||null:null,'attributes':_0x1475b9[_0x41f3('0x1b')]?_0x1475b9['options'][_0x41f3('0x1d')]||null:null,'limit':_0x1475b9[_0x41f3('0x1b')]?_0x1475b9[_0x41f3('0x1b')][_0x41f3('0x1e')]||null:null,'include':_0x1475b9[_0x41f3('0x1b')]?_0x1475b9[_0x41f3('0x1b')]['include']?_[_0x41f3('0x1f')](_0x1475b9['options']['include'],function(_0x3ac719){return{'model':db[_0x3ac719[_0x41f3('0x20')]],'as':_0x3ac719['as'],'attributes':_0x3ac719[_0x41f3('0x1d')],'include':_0x3ac719['include']?_['map'](_0x3ac719[_0x41f3('0x21')],function(_0x53d9da){return{'model':db[_0x53d9da['model']],'as':_0x53d9da['as'],'attributes':_0x53d9da[_0x41f3('0x1d')],'include':_0x53d9da[_0x41f3('0x21')]?_[_0x41f3('0x1f')](_0x53d9da[_0x41f3('0x21')],function(_0x132c72){return{'model':db[_0x132c72['model']],'as':_0x132c72['as'],'attributes':_0x132c72[_0x41f3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x365dfd){logger['info'](_0x41f3('0x18'),_0x1475b9);logger[_0x41f3('0x11')](_0x41f3('0x18'),_0x1475b9,JSON[_0x41f3('0x12')](_0x365dfd));_0x2f663b(_0x365dfd);})[_0x41f3('0x17')](function(_0x2c0c83){logger[_0x41f3('0x13')](_0x41f3('0x18'),_0x2c0c83['message'],_0x1475b9);_0x1c37e0(_0x15de03[_0x41f3('0x13')](0x1f4,_0x2c0c83[_0x41f3('0x15')]));});});};exports[_0x41f3('0x22')]=function(_0x436942){var _0x4f4ac2=this;return new Promise(function(_0x8deed7,_0xd4a586){return db[_0x41f3('0x19')][_0x41f3('0x23')]({'raw':_0x436942[_0x41f3('0x1b')]?_0x436942['options'][_0x41f3('0x1c')]===undefined?!![]:![]:!![],'where':_0x436942['options']?_0x436942[_0x41f3('0x1b')]['where']||null:null,'attributes':_0x436942[_0x41f3('0x1b')]?_0x436942[_0x41f3('0x1b')][_0x41f3('0x1d')]||null:null,'include':_0x436942[_0x41f3('0x1b')]?_0x436942[_0x41f3('0x1b')][_0x41f3('0x21')]?_['map'](_0x436942[_0x41f3('0x1b')]['include'],function(_0x180644){return{'model':db[_0x180644[_0x41f3('0x20')]],'as':_0x180644['as'],'attributes':_0x180644[_0x41f3('0x1d')],'include':_0x180644[_0x41f3('0x21')]?_[_0x41f3('0x1f')](_0x180644[_0x41f3('0x21')],function(_0x2c4229){return{'model':db[_0x2c4229[_0x41f3('0x20')]],'as':_0x2c4229['as'],'attributes':_0x2c4229[_0x41f3('0x1d')],'include':_0x2c4229['include']?_[_0x41f3('0x1f')](_0x2c4229[_0x41f3('0x21')],function(_0x1a4774){return{'model':db[_0x1a4774['model']],'as':_0x1a4774['as'],'attributes':_0x1a4774[_0x41f3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x41f3('0x24')](function(_0x1b403e){logger[_0x41f3('0x16')]('ShowVoiceQueue',_0x436942);logger[_0x41f3('0x11')](_0x41f3('0x22'),_0x436942,JSON['stringify'](_0x1b403e));_0x8deed7(_0x1b403e);})[_0x41f3('0x17')](function(_0x552159){logger[_0x41f3('0x13')]('ShowVoiceQueue',_0x552159[_0x41f3('0x15')],_0x436942);_0xd4a586(_0x4f4ac2['error'](0x1f4,_0x552159[_0x41f3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 8eaa832..2e7fd0f 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 _0x6a25=['save','remove','update','removeListener','register','./voiceQueue.events'];(function(_0x567fff,_0xd8acd8){var _0x465a37=function(_0x9d7bf7){while(--_0x9d7bf7){_0x567fff['push'](_0x567fff['shift']());}};_0x465a37(++_0xd8acd8);}(_0x6a25,0x13d));var _0x56a2=function(_0x24b6ff,_0x386452){_0x24b6ff=_0x24b6ff-0x0;var _0x2501c6=_0x6a25[_0x24b6ff];return _0x2501c6;};'use strict';var VoiceQueueEvents=require(_0x56a2('0x0'));var events=[_0x56a2('0x1'),_0x56a2('0x2'),_0x56a2('0x3')];function createListener(_0xd0b694,_0x382405){return function(_0x181879){_0x382405['emit'](_0xd0b694,_0x181879);};}function removeListener(_0x2923e4,_0x1ab8f5){return function(){VoiceQueueEvents[_0x56a2('0x4')](_0x2923e4,_0x1ab8f5);};}exports[_0x56a2('0x5')]=function(_0x3652ff){for(var _0x2cec34=0x0,_0x5cd3f4=events['length'];_0x2cec34<_0x5cd3f4;_0x2cec34++){var _0x16cac8=events[_0x2cec34];var _0x114224=createListener('voiceQueue:'+_0x16cac8,_0x3652ff);VoiceQueueEvents['on'](_0x16cac8,_0x114224);}}; \ No newline at end of file +var _0x750a=['register','length','voiceQueue:','save','remove','update','emit','removeListener'];(function(_0x2bcb5f,_0x62a33e){var _0x4c10eb=function(_0x22715b){while(--_0x22715b){_0x2bcb5f['push'](_0x2bcb5f['shift']());}};_0x4c10eb(++_0x62a33e);}(_0x750a,0x9b));var _0xa750=function(_0x454d24,_0x749d57){_0x454d24=_0x454d24-0x0;var _0x311b2c=_0x750a[_0x454d24];return _0x311b2c;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xa750('0x0'),_0xa750('0x1'),_0xa750('0x2')];function createListener(_0x569b2a,_0x287204){return function(_0x4da678){_0x287204[_0xa750('0x3')](_0x569b2a,_0x4da678);};}function removeListener(_0x57e050,_0x41dba9){return function(){VoiceQueueEvents[_0xa750('0x4')](_0x57e050,_0x41dba9);};}exports[_0xa750('0x5')]=function(_0x2040c9){for(var _0x16bf72=0x0,_0x278dab=events[_0xa750('0x6')];_0x16bf72<_0x278dab;_0x16bf72++){var _0x587e06=events[_0x16bf72];var _0x5a70f3=createListener(_0xa750('0x7')+_0x587e06,_0x2040c9);VoiceQueueEvents['on'](_0x587e06,_0x5a70f3);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 5ff3bc7..317eaef 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 _0x50aa=['put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','create'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x50aa,0x137));var _0xa50a=function(_0x5bd1a9,_0x313714){_0x5bd1a9=_0x5bd1a9-0x0;var _0x2ba345=_0x50aa[_0x5bd1a9];return _0x2ba345;};'use strict';var multer=require(_0xa50a('0x0'));var util=require(_0xa50a('0x1'));var path=require(_0xa50a('0x2'));var timeout=require(_0xa50a('0x3'));var express=require(_0xa50a('0x4'));var router=express[_0xa50a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa50a('0x6'));var interaction=require(_0xa50a('0x7'));var config=require(_0xa50a('0x8'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa50a('0x9')]);router[_0xa50a('0xa')]('/describe',auth[_0xa50a('0xb')](),controller[_0xa50a('0xc')]);router[_0xa50a('0xa')](_0xa50a('0xd'),auth[_0xa50a('0xb')](),controller[_0xa50a('0xe')]);router['get'](_0xa50a('0xf'),auth[_0xa50a('0xb')](),controller[_0xa50a('0x10')]);router[_0xa50a('0x11')]('/',auth[_0xa50a('0xb')](),controller[_0xa50a('0x12')]);router[_0xa50a('0x13')](_0xa50a('0xf'),auth[_0xa50a('0xb')](),controller[_0xa50a('0x14')]);router['delete'](_0xa50a('0xf'),auth[_0xa50a('0xb')](),controller[_0xa50a('0x15')]);module['exports']=router; \ No newline at end of file +var _0x1871=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','/:id','show','create','put','delete','destroy','exports','multer','util','express','../../components/auth/service'];(function(_0x592a9d,_0x434abb){var _0x59d2b3=function(_0x4661dc){while(--_0x4661dc){_0x592a9d['push'](_0x592a9d['shift']());}};_0x59d2b3(++_0x434abb);}(_0x1871,0x19a));var _0x1187=function(_0x5e6103,_0x43a670){_0x5e6103=_0x5e6103-0x0;var _0x1b285a=_0x1871[_0x5e6103];return _0x1b285a;};'use strict';var multer=require(_0x1187('0x0'));var util=require(_0x1187('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1187('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1187('0x3'));var interaction=require(_0x1187('0x4'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0x1187('0x5')]('/',auth[_0x1187('0x6')](),controller[_0x1187('0x7')]);router[_0x1187('0x5')](_0x1187('0x8'),auth[_0x1187('0x6')](),controller[_0x1187('0x9')]);router['get']('/index',auth['isAuthenticated'](),controller[_0x1187('0xa')]);router[_0x1187('0x5')](_0x1187('0xb'),auth[_0x1187('0x6')](),controller[_0x1187('0xc')]);router['post']('/',auth[_0x1187('0x6')](),controller[_0x1187('0xd')]);router[_0x1187('0xe')]('/:id',auth[_0x1187('0x6')](),controller['update']);router[_0x1187('0xf')](_0x1187('0xb'),auth[_0x1187('0x6')](),controller[_0x1187('0x10')]);module[_0x1187('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 4509ab6..0233897 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 _0xd3c1=['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','exports','STRING','DATE'];(function(_0x3ac3bb,_0x4d0c92){var _0x308c4d=function(_0x789180){while(--_0x789180){_0x3ac3bb['push'](_0x3ac3bb['shift']());}};_0x308c4d(++_0x4d0c92);}(_0xd3c1,0xc0));var _0x1d3c=function(_0x1a2c72,_0x53c7f0){_0x1a2c72=_0x1a2c72-0x0;var _0x413211=_0xd3c1[_0x1a2c72];return _0x413211;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1d3c('0x0')]={'type':{'type':Sequelize[_0x1d3c('0x1')]},'uniqueid':{'type':Sequelize[_0x1d3c('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1d3c('0x1')]},'queue':{'type':Sequelize[_0x1d3c('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x1d3c('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x1d3c('0x2')],'set':function(_0x14301b){var _0x5da8b8=moment(_0x14301b);var _0xcaab23=moment(this[_0x1d3c('0x3')](_0x1d3c('0x4')))[_0x1d3c('0x5')](_0x1d3c('0x6'));var _0x5f01f2=_0x5da8b8[_0x1d3c('0x7')](_0xcaab23,'seconds');this[_0x1d3c('0x8')](_0x1d3c('0x9'),_0x14301b);this[_0x1d3c('0x8')](_0x1d3c('0xa'),_0x5f01f2||null);}},'position':{'type':Sequelize[_0x1d3c('0xb')]},'count':{'type':Sequelize[_0x1d3c('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x1d3c('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1d3c('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x1d3c('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1d3c('0x2')]},'queuecallerexit':{'type':Sequelize[_0x1d3c('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1d3c('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x1d3c('0x1')],'comment':_0x1d3c('0xd')},'originalposition':{'type':Sequelize[_0x1d3c('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1d3c('0x1')]},'context':{'type':Sequelize[_0x1d3c('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1d3c('0x1')]},'holdtime':{'type':Sequelize[_0x1d3c('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1d3c('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x1d3c('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1d3c('0x1')],'comment':_0x1d3c('0xe')},'transferexten':{'type':Sequelize[_0x1d3c('0x1')]},'transferuniqueid':{'type':Sequelize[_0x1d3c('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1d3c('0x1')]},'thirdDisposition':{'type':Sequelize[_0x1d3c('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x1d3c('0x1')]}}; \ No newline at end of file +var _0x8f25=['sequelize','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x2410cc,_0xcf7386){var _0x515dfa=function(_0x233a22){while(--_0x233a22){_0x2410cc['push'](_0x2410cc['shift']());}};_0x515dfa(++_0xcf7386);}(_0x8f25,0xee));var _0x58f2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8f25[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x58f2('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x58f2('0x1')]},'uniqueid':{'type':Sequelize[_0x58f2('0x1')]},'calleridnum':{'type':Sequelize[_0x58f2('0x1')]},'calleridname':{'type':Sequelize[_0x58f2('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x58f2('0x2')],'set':function(_0x27adc0){var _0x576ba2=moment(_0x27adc0);var _0x2bb7ad=moment(this['getDataValue'](_0x58f2('0x3')))[_0x58f2('0x4')](_0x58f2('0x5'));var _0x3e2234=_0x576ba2[_0x58f2('0x6')](_0x2bb7ad,_0x58f2('0x7'));this[_0x58f2('0x8')](_0x58f2('0x9'),_0x27adc0);this[_0x58f2('0x8')]('holdtime',_0x3e2234||null);}},'position':{'type':Sequelize[_0x58f2('0xa')]},'count':{'type':Sequelize[_0x58f2('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x58f2('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x58f2('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x58f2('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x58f2('0x2')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x58f2('0x1')],'comment':_0x58f2('0xc')},'originalposition':{'type':Sequelize[_0x58f2('0xa')]},'channel':{'type':Sequelize[_0x58f2('0x1')]},'connectedlinenum':{'type':Sequelize[_0x58f2('0x1')]},'connectedlinename':{'type':Sequelize[_0x58f2('0x1')]},'accountcode':{'type':Sequelize[_0x58f2('0x1')]},'context':{'type':Sequelize[_0x58f2('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x58f2('0x1')]},'holdtime':{'type':Sequelize[_0x58f2('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x58f2('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x58f2('0x1')]},'transfer':{'type':Sequelize[_0x58f2('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x58f2('0x1')],'comment':_0x58f2('0xd')},'transferexten':{'type':Sequelize[_0x58f2('0x1')]},'transferuniqueid':{'type':Sequelize[_0x58f2('0x1')]},'disposition':{'type':Sequelize[_0x58f2('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x58f2('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x58f2('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0x58f2('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 86859e8..8700010 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 _0x7ea8=['sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','update','describe','getVoiceQueuesReport','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x34358f,_0x3e021d){var _0x5c71c1=function(_0x1033bf){while(--_0x1033bf){_0x34358f['push'](_0x34358f['shift']());}};_0x5c71c1(++_0x3e021d);}(_0x7ea8,0x1db));var _0x87ea=function(_0x2c045e,_0x2177d9){_0x2c045e=_0x2c045e-0x0;var _0x4b1f04=_0x7ea8[_0x2c045e];return _0x4b1f04;};'use strict';var emlformat=require(_0x87ea('0x0'));var rimraf=require(_0x87ea('0x1'));var zipdir=require(_0x87ea('0x2'));var jsonpatch=require(_0x87ea('0x3'));var rp=require(_0x87ea('0x4'));var moment=require('moment');var BPromise=require(_0x87ea('0x5'));var Mustache=require('mustache');var util=require(_0x87ea('0x6'));var path=require(_0x87ea('0x7'));var sox=require('sox');var csv=require(_0x87ea('0x8'));var ejs=require(_0x87ea('0x9'));var fs=require('fs');var fs_extra=require(_0x87ea('0xa'));var _=require('lodash');var squel=require(_0x87ea('0xb'));var crypto=require(_0x87ea('0xc'));var jsforce=require(_0x87ea('0xd'));var deskjs=require(_0x87ea('0xe'));var toCsv=require(_0x87ea('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x87ea('0xf'));var authService=require(_0x87ea('0x10'));var qs=require(_0x87ea('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x87ea('0x12'))(_0x87ea('0x13'));var utils=require(_0x87ea('0x14'));var config=require(_0x87ea('0x15'));var licenseUtil=require(_0x87ea('0x16'));var db=require(_0x87ea('0x17'))['db'];config[_0x87ea('0x18')]=_[_0x87ea('0x19')](config['redis'],{'host':_0x87ea('0x1a'),'port':0x18eb});var socket=require(_0x87ea('0x1b'))(new Redis(config[_0x87ea('0x18')]));require('./voiceQueueReport.socket')[_0x87ea('0x1c')](socket);function respondWithStatusCode(_0x398977,_0xab679e){_0xab679e=_0xab679e||0xcc;return function(_0x1cb51e){if(_0x1cb51e){return _0x398977[_0x87ea('0x1d')](_0xab679e);}return _0x398977['status'](_0xab679e)[_0x87ea('0x1e')]();};}function respondWithResult(_0x5e94f5,_0x340248){_0x340248=_0x340248||0xc8;return function(_0x402c22){if(_0x402c22){return _0x5e94f5['status'](_0x340248)[_0x87ea('0x1f')](_0x402c22);}};}function respondWithFilteredResult(_0x410b1a,_0x5af35a){return function(_0x5887c1){if(_0x5887c1){var _0x1ed4f4=typeof _0x5af35a['offset']===_0x87ea('0x20')&&typeof _0x5af35a[_0x87ea('0x21')]===_0x87ea('0x20');var _0xadf25e=_0x5887c1[_0x87ea('0x22')];var _0x46635d=_0x1ed4f4?0x0:_0x5af35a[_0x87ea('0x23')];var _0x1e9561=_0x1ed4f4?_0x5887c1[_0x87ea('0x22')]:_0x5af35a['offset']+_0x5af35a[_0x87ea('0x21')];var _0x1899d4;if(_0x1e9561>=_0xadf25e){_0x1e9561=_0xadf25e;_0x1899d4=0xc8;}else{_0x1899d4=0xce;}_0x410b1a[_0x87ea('0x24')](_0x1899d4);return _0x410b1a[_0x87ea('0x25')](_0x87ea('0x26'),_0x46635d+'-'+_0x1e9561+'/'+_0xadf25e)[_0x87ea('0x1f')](_0x5887c1);}return null;};}function patchUpdates(_0x2d01b0){return function(_0x2674d2){try{jsonpatch[_0x87ea('0x27')](_0x2674d2,_0x2d01b0,!![]);}catch(_0x3a0d9b){return BPromise['reject'](_0x3a0d9b);}return _0x2674d2[_0x87ea('0x28')]();};}function saveUpdates(_0x4596d9,_0x5e3a50){return function(_0x4d15ac){if(_0x4d15ac){return _0x4d15ac['update'](_0x4596d9)['then'](function(_0x290ffe){return _0x290ffe;});}return null;};}function removeEntity(_0x67f65c,_0x4a7310){return function(_0x54de65){if(_0x54de65){return _0x54de65[_0x87ea('0x29')]()[_0x87ea('0x2a')](function(){_0x67f65c[_0x87ea('0x24')](0xcc)[_0x87ea('0x1e')]();});}};}function handleEntityNotFound(_0x40f469,_0x14c9dd){return function(_0x1bdf32){if(!_0x1bdf32){_0x40f469[_0x87ea('0x1d')](0x194);}return _0x1bdf32;};}function handleError(_0x3fb1e4,_0x1f70ef){_0x1f70ef=_0x1f70ef||0x1f4;return function(_0x15f33a){logger[_0x87ea('0x2b')](_0x15f33a[_0x87ea('0x2c')]);if(_0x15f33a['name']){delete _0x15f33a[_0x87ea('0x2d')];}_0x3fb1e4['status'](_0x1f70ef)[_0x87ea('0x2e')](_0x15f33a);};}exports[_0x87ea('0x2f')]=function(_0xead282,_0x29a8e0){var _0x5380bf={},_0x57130c={},_0x4dcd16={'count':0x0,'rows':[]};var _0x3debcb=_['map'](db[_0x87ea('0x30')][_0x87ea('0x31')],function(_0x3db065){return{'name':_0x3db065[_0x87ea('0x32')],'type':_0x3db065[_0x87ea('0x33')][_0x87ea('0x34')]};});_0x57130c[_0x87ea('0x35')]=_[_0x87ea('0x36')](_0x3debcb,'name');_0x57130c[_0x87ea('0x37')]=_['keys'](_0xead282[_0x87ea('0x37')]);_0x57130c['filters']=_[_0x87ea('0x38')](_0x57130c[_0x87ea('0x35')],_0x57130c[_0x87ea('0x37')]);_0x5380bf['attributes']=_[_0x87ea('0x38')](_0x57130c[_0x87ea('0x35')],qs[_0x87ea('0x39')](_0xead282[_0x87ea('0x37')][_0x87ea('0x39')]));_0x5380bf[_0x87ea('0x3a')]=_0x5380bf[_0x87ea('0x3a')][_0x87ea('0x3b')]?_0x5380bf[_0x87ea('0x3a')]:_0x57130c['model'];if(!_0xead282[_0x87ea('0x37')][_0x87ea('0x3c')](_0x87ea('0x3d'))){_0x5380bf['limit']=qs[_0x87ea('0x21')](_0xead282[_0x87ea('0x37')]['limit']);_0x5380bf[_0x87ea('0x23')]=qs[_0x87ea('0x23')](_0xead282[_0x87ea('0x37')][_0x87ea('0x23')]);}_0x5380bf['order']=qs[_0x87ea('0x3e')](_0xead282[_0x87ea('0x37')][_0x87ea('0x3e')]);_0x5380bf['where']=qs['filters'](_[_0x87ea('0x3f')](_0xead282[_0x87ea('0x37')],_0x57130c[_0x87ea('0x40')]),_0x3debcb);if(_0xead282[_0x87ea('0x37')][_0x87ea('0x41')]){_0x5380bf[_0x87ea('0x42')]=_[_0x87ea('0x43')](_0x5380bf[_0x87ea('0x42')],{'$or':_[_0x87ea('0x36')](_0x3debcb,function(_0x3d7b49){if(_0x3d7b49[_0x87ea('0x33')]!==_0x87ea('0x44')){var _0x4866f0={};_0x4866f0[_0x3d7b49[_0x87ea('0x2d')]]={'$like':'%'+_0xead282['query'][_0x87ea('0x41')]+'%'};return _0x4866f0;}})});}_0x5380bf=_[_0x87ea('0x43')]({},_0x5380bf,_0xead282[_0x87ea('0x45')]);var _0x3f2740={'where':_0x5380bf[_0x87ea('0x42')]};return db[_0x87ea('0x30')]['count'](_0x3f2740)['then'](function(_0x343566){_0x4dcd16['count']=_0x343566;if(_0xead282[_0x87ea('0x37')][_0x87ea('0x46')]){_0x5380bf[_0x87ea('0x47')]=[{'all':!![]}];}return db[_0x87ea('0x30')]['findAll'](_0x5380bf);})[_0x87ea('0x2a')](function(_0x2e7719){_0x4dcd16[_0x87ea('0x48')]=_0x2e7719;return _0x4dcd16;})['then'](respondWithFilteredResult(_0x29a8e0,_0x5380bf))[_0x87ea('0x49')](handleError(_0x29a8e0,null));};exports[_0x87ea('0x4a')]=function(_0x51c761,_0xfca305){var _0x372225={'raw':![],'where':{'id':_0x51c761[_0x87ea('0x4b')]['id']}},_0x49a848={};_0x49a848[_0x87ea('0x35')]=_[_0x87ea('0x4c')](db[_0x87ea('0x30')][_0x87ea('0x31')]);_0x49a848[_0x87ea('0x37')]=_[_0x87ea('0x4c')](_0x51c761[_0x87ea('0x37')]);_0x49a848[_0x87ea('0x40')]=_['intersection'](_0x49a848[_0x87ea('0x35')],_0x49a848['query']);_0x372225[_0x87ea('0x3a')]=_['intersection'](_0x49a848[_0x87ea('0x35')],qs[_0x87ea('0x39')](_0x51c761['query'][_0x87ea('0x39')]));_0x372225[_0x87ea('0x3a')]=_0x372225[_0x87ea('0x3a')][_0x87ea('0x3b')]?_0x372225[_0x87ea('0x3a')]:_0x49a848[_0x87ea('0x35')];if(_0x51c761['query']['includeAll']){_0x372225[_0x87ea('0x47')]=[{'all':!![]}];}_0x372225=_[_0x87ea('0x43')]({},_0x372225,_0x51c761[_0x87ea('0x45')]);return db[_0x87ea('0x30')][_0x87ea('0x4d')](_0x372225)[_0x87ea('0x2a')](handleEntityNotFound(_0xfca305,null))[_0x87ea('0x2a')](respondWithResult(_0xfca305,null))['catch'](handleError(_0xfca305,null));};exports[_0x87ea('0x4e')]=function(_0xec1da9,_0x4c606e){return db['VoiceQueueReport'][_0x87ea('0x4e')](_0xec1da9[_0x87ea('0x4f')],{})['then'](respondWithResult(_0x4c606e,0xc9))[_0x87ea('0x49')](handleError(_0x4c606e,null));};exports[_0x87ea('0x50')]=function(_0x50df27,_0x52860c){if(_0x50df27['body']['id']){delete _0x50df27['body']['id'];}return db[_0x87ea('0x30')]['find']({'where':{'id':_0x50df27[_0x87ea('0x4b')]['id']}})[_0x87ea('0x2a')](handleEntityNotFound(_0x52860c,null))['then'](saveUpdates(_0x50df27[_0x87ea('0x4f')],null))['then'](respondWithResult(_0x52860c,null))[_0x87ea('0x49')](handleError(_0x52860c,null));};exports['destroy']=function(_0x80e518,_0x3d9965){return db[_0x87ea('0x30')]['find']({'where':{'id':_0x80e518['params']['id']}})[_0x87ea('0x2a')](handleEntityNotFound(_0x3d9965,null))[_0x87ea('0x2a')](removeEntity(_0x3d9965,null))[_0x87ea('0x49')](handleError(_0x3d9965,null));};exports[_0x87ea('0x51')]=function(_0x6bd21a,_0x78108a){return db[_0x87ea('0x30')]['describe']()[_0x87ea('0x2a')](respondWithResult(_0x78108a,null))['catch'](handleError(_0x78108a,null));};exports[_0x87ea('0x52')]=function(_0x290b81,_0x2094e5){var _0x3590a7={},_0x521e20={},_0x67591={'count':0x0,'rows':[]};_0x521e20[_0x87ea('0x35')]=_[_0x87ea('0x4c')](db[_0x87ea('0x30')][_0x87ea('0x31')]);_0x521e20[_0x87ea('0x37')]=_[_0x87ea('0x4c')](_0x290b81[_0x87ea('0x37')]);_0x521e20[_0x87ea('0x40')]=_[_0x87ea('0x38')](_0x521e20['model'],_0x521e20[_0x87ea('0x37')]);_0x3590a7[_0x87ea('0x3a')]=_['intersection'](_0x521e20['model'],qs[_0x87ea('0x39')](_0x290b81[_0x87ea('0x37')][_0x87ea('0x39')]));_0x3590a7[_0x87ea('0x3a')]=_0x3590a7['attributes'][_0x87ea('0x3b')]?_0x3590a7[_0x87ea('0x3a')]:_0x521e20[_0x87ea('0x35')];if(!_0x290b81[_0x87ea('0x37')][_0x87ea('0x3c')](_0x87ea('0x3d'))){_0x3590a7['limit']=qs[_0x87ea('0x21')](_0x290b81[_0x87ea('0x37')]['limit']);_0x3590a7[_0x87ea('0x23')]=qs[_0x87ea('0x23')](_0x290b81['query'][_0x87ea('0x23')]);}_0x3590a7['order']=qs['sort'](_0x290b81[_0x87ea('0x37')]['sort']);_0x3590a7[_0x87ea('0x42')]=qs[_0x87ea('0x40')](_[_0x87ea('0x3f')](_0x290b81['query'],_0x521e20[_0x87ea('0x40')]));if(_0x290b81[_0x87ea('0x37')][_0x87ea('0x41')]){_0x3590a7[_0x87ea('0x42')]=_[_0x87ea('0x43')](_0x3590a7[_0x87ea('0x42')],{'$or':_[_0x87ea('0x36')](_0x3590a7[_0x87ea('0x3a')],function(_0x46344a){var _0x49b18e={};_0x49b18e[_0x46344a]={'$like':'%'+_0x290b81[_0x87ea('0x37')][_0x87ea('0x41')]+'%'};return _0x49b18e;})});}_0x3590a7=_[_0x87ea('0x43')]({},_0x3590a7,_0x290b81[_0x87ea('0x45')]);var _0x5acc5c={'where':_0x3590a7[_0x87ea('0x42')]};return db[_0x87ea('0x30')]['count'](_0x5acc5c)[_0x87ea('0x2a')](function(_0x3df49c){_0x67591[_0x87ea('0x22')]=_0x3df49c;if(_0x290b81[_0x87ea('0x37')]['includeAll']){_0x3590a7[_0x87ea('0x47')]=[{'all':!![]}];}return db[_0x87ea('0x30')][_0x87ea('0x53')](_0x3590a7);})[_0x87ea('0x2a')](function(_0x51b42b){_0x67591[_0x87ea('0x48')]=_0x51b42b;return _0x67591;})[_0x87ea('0x2a')](respondWithFilteredResult(_0x2094e5,_0x3590a7,'getVoiceQueuesReport'))['catch'](handleError(_0x2094e5,null,_0x87ea('0x52')));}; \ No newline at end of file +var _0xfc1e=['includeAll','findAll','rows','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','update','then','destroy','end','error','stack','name','index','VoiceQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','catch','find','create','body','params','describe','getVoiceQueuesReport','map'];(function(_0x188741,_0x243906){var _0x5e9290=function(_0x90f20a){while(--_0x90f20a){_0x188741['push'](_0x188741['shift']());}};_0x5e9290(++_0x243906);}(_0xfc1e,0xf3));var _0xefc1=function(_0xe5b349,_0x5f06e4){_0xe5b349=_0xe5b349-0x0;var _0x26b0ad=_0xfc1e[_0xe5b349];return _0x26b0ad;};'use strict';var emlformat=require(_0xefc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefc1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefc1('0x2'));var moment=require(_0xefc1('0x3'));var BPromise=require(_0xefc1('0x4'));var Mustache=require(_0xefc1('0x5'));var util=require(_0xefc1('0x6'));var path=require(_0xefc1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xefc1('0x8'));var fs=require('fs');var fs_extra=require(_0xefc1('0x9'));var _=require(_0xefc1('0xa'));var squel=require('squel');var crypto=require(_0xefc1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xefc1('0xc'));var toCsv=require(_0xefc1('0xd'));var querystring=require(_0xefc1('0xe'));var Papa=require('papaparse');var Redis=require(_0xefc1('0xf'));var authService=require(_0xefc1('0x10'));var qs=require(_0xefc1('0x11'));var as=require(_0xefc1('0x12'));var hardwareService=require(_0xefc1('0x13'));var logger=require(_0xefc1('0x14'))('api');var utils=require(_0xefc1('0x15'));var config=require(_0xefc1('0x16'));var licenseUtil=require(_0xefc1('0x17'));var db=require(_0xefc1('0x18'))['db'];config[_0xefc1('0x19')]=_[_0xefc1('0x1a')](config['redis'],{'host':_0xefc1('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xefc1('0x19')]));require(_0xefc1('0x1c'))[_0xefc1('0x1d')](socket);function respondWithStatusCode(_0x36a6f4,_0x50ad2e){_0x50ad2e=_0x50ad2e||0xcc;return function(_0x4a7aa4){if(_0x4a7aa4){return _0x36a6f4[_0xefc1('0x1e')](_0x50ad2e);}return _0x36a6f4[_0xefc1('0x1f')](_0x50ad2e)['end']();};}function respondWithResult(_0x3801e6,_0xfb7f69){_0xfb7f69=_0xfb7f69||0xc8;return function(_0x245bc0){if(_0x245bc0){return _0x3801e6['status'](_0xfb7f69)['json'](_0x245bc0);}};}function respondWithFilteredResult(_0x142a41,_0x56e8d3){return function(_0x459864){if(_0x459864){var _0x16f269=typeof _0x56e8d3[_0xefc1('0x20')]===_0xefc1('0x21')&&typeof _0x56e8d3[_0xefc1('0x22')]==='undefined';var _0x5be5d9=_0x459864[_0xefc1('0x23')];var _0x37d165=_0x16f269?0x0:_0x56e8d3['offset'];var _0x2da854=_0x16f269?_0x459864[_0xefc1('0x23')]:_0x56e8d3[_0xefc1('0x20')]+_0x56e8d3[_0xefc1('0x22')];var _0x7b2d37;if(_0x2da854>=_0x5be5d9){_0x2da854=_0x5be5d9;_0x7b2d37=0xc8;}else{_0x7b2d37=0xce;}_0x142a41[_0xefc1('0x1f')](_0x7b2d37);return _0x142a41['set'](_0xefc1('0x24'),_0x37d165+'-'+_0x2da854+'/'+_0x5be5d9)[_0xefc1('0x25')](_0x459864);}return null;};}function patchUpdates(_0x33a1ff){return function(_0x59f290){try{jsonpatch[_0xefc1('0x26')](_0x59f290,_0x33a1ff,!![]);}catch(_0x5c3864){return BPromise['reject'](_0x5c3864);}return _0x59f290['save']();};}function saveUpdates(_0x18563a,_0x46d230){return function(_0x58d89c){if(_0x58d89c){return _0x58d89c[_0xefc1('0x27')](_0x18563a)[_0xefc1('0x28')](function(_0x56ef4a){return _0x56ef4a;});}return null;};}function removeEntity(_0xd33188,_0x50fa9c){return function(_0x4b117a){if(_0x4b117a){return _0x4b117a[_0xefc1('0x29')]()[_0xefc1('0x28')](function(){_0xd33188['status'](0xcc)[_0xefc1('0x2a')]();});}};}function handleEntityNotFound(_0x29e890,_0x266791){return function(_0x2031ed){if(!_0x2031ed){_0x29e890[_0xefc1('0x1e')](0x194);}return _0x2031ed;};}function handleError(_0x440dd9,_0x3460ca){_0x3460ca=_0x3460ca||0x1f4;return function(_0x16732f){logger[_0xefc1('0x2b')](_0x16732f[_0xefc1('0x2c')]);if(_0x16732f[_0xefc1('0x2d')]){delete _0x16732f[_0xefc1('0x2d')];}_0x440dd9['status'](_0x3460ca)['send'](_0x16732f);};}exports[_0xefc1('0x2e')]=function(_0x1d7bca,_0x246b40){var _0xe058bd={},_0x5f00aa={},_0x243788={'count':0x0,'rows':[]};var _0x4196d5=_['map'](db[_0xefc1('0x2f')][_0xefc1('0x30')],function(_0x376ff0){return{'name':_0x376ff0['fieldName'],'type':_0x376ff0[_0xefc1('0x31')][_0xefc1('0x32')]};});_0x5f00aa[_0xefc1('0x33')]=_['map'](_0x4196d5,_0xefc1('0x2d'));_0x5f00aa[_0xefc1('0x34')]=_[_0xefc1('0x35')](_0x1d7bca['query']);_0x5f00aa[_0xefc1('0x36')]=_[_0xefc1('0x37')](_0x5f00aa[_0xefc1('0x33')],_0x5f00aa[_0xefc1('0x34')]);_0xe058bd['attributes']=_['intersection'](_0x5f00aa['model'],qs['fields'](_0x1d7bca[_0xefc1('0x34')][_0xefc1('0x38')]));_0xe058bd[_0xefc1('0x39')]=_0xe058bd['attributes'][_0xefc1('0x3a')]?_0xe058bd[_0xefc1('0x39')]:_0x5f00aa['model'];if(!_0x1d7bca[_0xefc1('0x34')][_0xefc1('0x3b')](_0xefc1('0x3c'))){_0xe058bd[_0xefc1('0x22')]=qs['limit'](_0x1d7bca[_0xefc1('0x34')][_0xefc1('0x22')]);_0xe058bd[_0xefc1('0x20')]=qs[_0xefc1('0x20')](_0x1d7bca[_0xefc1('0x34')]['offset']);}_0xe058bd[_0xefc1('0x3d')]=qs[_0xefc1('0x3e')](_0x1d7bca[_0xefc1('0x34')][_0xefc1('0x3e')]);_0xe058bd[_0xefc1('0x3f')]=qs[_0xefc1('0x36')](_[_0xefc1('0x40')](_0x1d7bca['query'],_0x5f00aa[_0xefc1('0x36')]),_0x4196d5);if(_0x1d7bca['query'][_0xefc1('0x41')]){_0xe058bd[_0xefc1('0x3f')]=_[_0xefc1('0x42')](_0xe058bd[_0xefc1('0x3f')],{'$or':_['map'](_0x4196d5,function(_0x503bd3){if(_0x503bd3['type']!=='VIRTUAL'){var _0x100196={};_0x100196[_0x503bd3['name']]={'$like':'%'+_0x1d7bca[_0xefc1('0x34')][_0xefc1('0x41')]+'%'};return _0x100196;}})});}_0xe058bd=_[_0xefc1('0x42')]({},_0xe058bd,_0x1d7bca[_0xefc1('0x43')]);var _0x43b3ae={'where':_0xe058bd['where']};return db['VoiceQueueReport'][_0xefc1('0x23')](_0x43b3ae)[_0xefc1('0x28')](function(_0x4db6b5){_0x243788[_0xefc1('0x23')]=_0x4db6b5;if(_0x1d7bca['query']['includeAll']){_0xe058bd[_0xefc1('0x44')]=[{'all':!![]}];}return db[_0xefc1('0x2f')]['findAll'](_0xe058bd);})[_0xefc1('0x28')](function(_0x2632a2){_0x243788['rows']=_0x2632a2;return _0x243788;})[_0xefc1('0x28')](respondWithFilteredResult(_0x246b40,_0xe058bd))[_0xefc1('0x45')](handleError(_0x246b40,null));};exports['show']=function(_0x7428a9,_0x214a96){var _0x2f5ea4={'raw':![],'where':{'id':_0x7428a9['params']['id']}},_0xf93da0={};_0xf93da0[_0xefc1('0x33')]=_[_0xefc1('0x35')](db[_0xefc1('0x2f')]['rawAttributes']);_0xf93da0[_0xefc1('0x34')]=_[_0xefc1('0x35')](_0x7428a9[_0xefc1('0x34')]);_0xf93da0[_0xefc1('0x36')]=_['intersection'](_0xf93da0['model'],_0xf93da0[_0xefc1('0x34')]);_0x2f5ea4[_0xefc1('0x39')]=_[_0xefc1('0x37')](_0xf93da0['model'],qs[_0xefc1('0x38')](_0x7428a9[_0xefc1('0x34')][_0xefc1('0x38')]));_0x2f5ea4['attributes']=_0x2f5ea4['attributes'][_0xefc1('0x3a')]?_0x2f5ea4[_0xefc1('0x39')]:_0xf93da0[_0xefc1('0x33')];if(_0x7428a9['query']['includeAll']){_0x2f5ea4[_0xefc1('0x44')]=[{'all':!![]}];}_0x2f5ea4=_['merge']({},_0x2f5ea4,_0x7428a9[_0xefc1('0x43')]);return db[_0xefc1('0x2f')][_0xefc1('0x46')](_0x2f5ea4)[_0xefc1('0x28')](handleEntityNotFound(_0x214a96,null))[_0xefc1('0x28')](respondWithResult(_0x214a96,null))[_0xefc1('0x45')](handleError(_0x214a96,null));};exports['create']=function(_0x545ee8,_0x2ca3b5){return db[_0xefc1('0x2f')][_0xefc1('0x47')](_0x545ee8[_0xefc1('0x48')],{})[_0xefc1('0x28')](respondWithResult(_0x2ca3b5,0xc9))[_0xefc1('0x45')](handleError(_0x2ca3b5,null));};exports['update']=function(_0x28dcd8,_0x14887f){if(_0x28dcd8[_0xefc1('0x48')]['id']){delete _0x28dcd8['body']['id'];}return db[_0xefc1('0x2f')][_0xefc1('0x46')]({'where':{'id':_0x28dcd8['params']['id']}})['then'](handleEntityNotFound(_0x14887f,null))['then'](saveUpdates(_0x28dcd8[_0xefc1('0x48')],null))[_0xefc1('0x28')](respondWithResult(_0x14887f,null))['catch'](handleError(_0x14887f,null));};exports[_0xefc1('0x29')]=function(_0x4f9c36,_0x41854d){return db[_0xefc1('0x2f')][_0xefc1('0x46')]({'where':{'id':_0x4f9c36[_0xefc1('0x49')]['id']}})[_0xefc1('0x28')](handleEntityNotFound(_0x41854d,null))[_0xefc1('0x28')](removeEntity(_0x41854d,null))[_0xefc1('0x45')](handleError(_0x41854d,null));};exports[_0xefc1('0x4a')]=function(_0x502ff3,_0x38f480){return db[_0xefc1('0x2f')][_0xefc1('0x4a')]()['then'](respondWithResult(_0x38f480,null))[_0xefc1('0x45')](handleError(_0x38f480,null));};exports[_0xefc1('0x4b')]=function(_0x5d8204,_0x4ee19a){var _0x3004eb={},_0x3cf0c1={},_0x14aa05={'count':0x0,'rows':[]};_0x3cf0c1[_0xefc1('0x33')]=_[_0xefc1('0x35')](db[_0xefc1('0x2f')][_0xefc1('0x30')]);_0x3cf0c1[_0xefc1('0x34')]=_[_0xefc1('0x35')](_0x5d8204[_0xefc1('0x34')]);_0x3cf0c1[_0xefc1('0x36')]=_[_0xefc1('0x37')](_0x3cf0c1['model'],_0x3cf0c1['query']);_0x3004eb[_0xefc1('0x39')]=_[_0xefc1('0x37')](_0x3cf0c1[_0xefc1('0x33')],qs[_0xefc1('0x38')](_0x5d8204[_0xefc1('0x34')][_0xefc1('0x38')]));_0x3004eb[_0xefc1('0x39')]=_0x3004eb[_0xefc1('0x39')][_0xefc1('0x3a')]?_0x3004eb[_0xefc1('0x39')]:_0x3cf0c1['model'];if(!_0x5d8204['query'][_0xefc1('0x3b')](_0xefc1('0x3c'))){_0x3004eb['limit']=qs[_0xefc1('0x22')](_0x5d8204[_0xefc1('0x34')][_0xefc1('0x22')]);_0x3004eb[_0xefc1('0x20')]=qs[_0xefc1('0x20')](_0x5d8204[_0xefc1('0x34')][_0xefc1('0x20')]);}_0x3004eb[_0xefc1('0x3d')]=qs['sort'](_0x5d8204[_0xefc1('0x34')][_0xefc1('0x3e')]);_0x3004eb['where']=qs['filters'](_[_0xefc1('0x40')](_0x5d8204[_0xefc1('0x34')],_0x3cf0c1['filters']));if(_0x5d8204['query'][_0xefc1('0x41')]){_0x3004eb[_0xefc1('0x3f')]=_[_0xefc1('0x42')](_0x3004eb[_0xefc1('0x3f')],{'$or':_[_0xefc1('0x4c')](_0x3004eb[_0xefc1('0x39')],function(_0x851d47){var _0x294269={};_0x294269[_0x851d47]={'$like':'%'+_0x5d8204[_0xefc1('0x34')][_0xefc1('0x41')]+'%'};return _0x294269;})});}_0x3004eb=_['merge']({},_0x3004eb,_0x5d8204[_0xefc1('0x43')]);var _0x392729={'where':_0x3004eb['where']};return db[_0xefc1('0x2f')][_0xefc1('0x23')](_0x392729)[_0xefc1('0x28')](function(_0x39f0db){_0x14aa05[_0xefc1('0x23')]=_0x39f0db;if(_0x5d8204[_0xefc1('0x34')][_0xefc1('0x4d')]){_0x3004eb['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xefc1('0x4e')](_0x3004eb);})['then'](function(_0x30bc39){_0x14aa05[_0xefc1('0x4f')]=_0x30bc39;return _0x14aa05;})[_0xefc1('0x28')](respondWithFilteredResult(_0x4ee19a,_0x3004eb,_0xefc1('0x4b')))['catch'](handleError(_0x4ee19a,null,_0xefc1('0x4b')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index c8d8eab..4e62603 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 _0x1b5b=['emit','hasOwnProperty','hook','exports','setMaxListeners','save','update','remove'];(function(_0x2b593e,_0x8f01e3){var _0x3b3c5b=function(_0x424609){while(--_0x424609){_0x2b593e['push'](_0x2b593e['shift']());}};_0x3b3c5b(++_0x8f01e3);}(_0x1b5b,0x74));var _0xb1b5=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0x1b5b[_0x406696];return _0x10e35c;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xb1b5('0x0')](0x0);var events={'afterCreate':_0xb1b5('0x1'),'afterUpdate':_0xb1b5('0x2'),'afterDestroy':_0xb1b5('0x3')};function emitEvent(_0x1e7210){return function(_0x1d3071,_0xd424ce,_0x4eabc2){VoiceQueueReportEvents['emit'](_0x1e7210+':'+_0x1d3071['id'],_0x1d3071);VoiceQueueReportEvents[_0xb1b5('0x4')](_0x1e7210,_0x1d3071);_0x4eabc2(null);};}for(var e in events){if(events[_0xb1b5('0x5')](e)){var event=events[e];VoiceQueueReport[_0xb1b5('0x6')](e,emitEvent(event));}}module[_0xb1b5('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x9040=['events','../../mysqldb','VoiceQueueReport','update','emit','hasOwnProperty','hook','exports'];(function(_0x1f5f0a,_0x558472){var _0x4c47f6=function(_0x14a67a){while(--_0x14a67a){_0x1f5f0a['push'](_0x1f5f0a['shift']());}};_0x4c47f6(++_0x558472);}(_0x9040,0xd8));var _0x0904=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9040[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x0904('0x0'));var VoiceQueueReport=require(_0x0904('0x1'))['db'][_0x0904('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0904('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1ce2ba){return function(_0x55a758,_0x501b50,_0xa6f91f){VoiceQueueReportEvents[_0x0904('0x4')](_0x1ce2ba+':'+_0x55a758['id'],_0x55a758);VoiceQueueReportEvents['emit'](_0x1ce2ba,_0x55a758);_0xa6f91f(null);};}for(var e in events){if(events[_0x0904('0x5')](e)){var event=events[e];VoiceQueueReport[_0x0904('0x6')](e,emitEvent(event));}}module[_0x0904('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 81ead7c..97bf423 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 _0xb383=['VoiceQueueReport','report_queue','uniqueid','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xb383,0x114));var _0x3b38=function(_0x1be323,_0x55c3e1){_0x1be323=_0x1be323-0x0;var _0x1f8f3d=_0xb383[_0x1be323];return _0x1f8f3d;};'use strict';var _=require('lodash');var util=require(_0x3b38('0x0'));var logger=require(_0x3b38('0x1'))(_0x3b38('0x2'));var moment=require('moment');var BPromise=require(_0x3b38('0x3'));var rp=require(_0x3b38('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b38('0x5'));var config=require(_0x3b38('0x6'));var attributes=require(_0x3b38('0x7'));module[_0x3b38('0x8')]=function(_0x180d3a,_0x999ebb){return _0x180d3a[_0x3b38('0x9')](_0x3b38('0xa'),attributes,{'tableName':_0x3b38('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3b38('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x858a=['report_queue','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','VoiceQueueReport'];(function(_0x162432,_0x457935){var _0x15df9f=function(_0x421383){while(--_0x421383){_0x162432['push'](_0x162432['shift']());}};_0x15df9f(++_0x457935);}(_0x858a,0x1a2));var _0xa858=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x858a[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xa858('0x0'));var util=require(_0xa858('0x1'));var logger=require(_0xa858('0x2'))(_0xa858('0x3'));var moment=require(_0xa858('0x4'));var BPromise=require(_0xa858('0x5'));var rp=require(_0xa858('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa858('0x7'));var config=require(_0xa858('0x8'));var attributes=require(_0xa858('0x9'));module['exports']=function(_0x4e07e9,_0x348ee9){return _0x4e07e9['define'](_0xa858('0xa'),attributes,{'tableName':_0xa858('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xa858('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 80f9ae0..f60fba4 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 _0xfa33=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','VoiceQueueReport','findAll','options','raw','where','include','map','model','attributes','GetVoiceQueueReport','CreateVoiceQueueReport','body','then','stringify','update','limit','UpdateVoiceQueueReport','lodash'];(function(_0x58b204,_0x52fb7c){var _0x225cdb=function(_0xba61bb){while(--_0xba61bb){_0x58b204['push'](_0x58b204['shift']());}};_0x225cdb(++_0x52fb7c);}(_0xfa33,0x1a3));var _0x3fa3=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xfa33[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0x3fa3('0x0'));var util=require(_0x3fa3('0x1'));var moment=require(_0x3fa3('0x2'));var BPromise=require('bluebird');var rs=require(_0x3fa3('0x3'));var fs=require('fs');var Redis=require(_0x3fa3('0x4'));var db=require(_0x3fa3('0x5'))['db'];var utils=require(_0x3fa3('0x6'));var logger=require(_0x3fa3('0x7'))(_0x3fa3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3fa3('0x9')][_0x3fa3('0xa')]({'port':0x232a});config[_0x3fa3('0xb')]=_[_0x3fa3('0xc')](config[_0x3fa3('0xb')],{'host':_0x3fa3('0xd'),'port':0x18eb});var socket=require(_0x3fa3('0xe'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x3fa3('0xf')](socket);function respondWithRpcPromise(_0xd8ef3,_0x2f1f40,_0x28f555){return new BPromise(function(_0x44c3d8,_0x185d56){return client['request'](_0xd8ef3,_0x28f555)['then'](function(_0x70466a){logger[_0x3fa3('0x10')](_0x3fa3('0x11'),_0x2f1f40,'request\x20sent');logger[_0x3fa3('0x12')](_0x3fa3('0x13'),_0x2f1f40,_0x3fa3('0x14'),JSON['stringify'](_0x70466a));if(_0x70466a[_0x3fa3('0x15')]){if(_0x70466a[_0x3fa3('0x15')]['code']===0x1f4){logger[_0x3fa3('0x15')](_0x3fa3('0x11'),_0x2f1f40,_0x70466a[_0x3fa3('0x15')][_0x3fa3('0x16')]);return _0x185d56(_0x70466a['error'][_0x3fa3('0x16')]);}logger[_0x3fa3('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x2f1f40,_0x70466a[_0x3fa3('0x15')][_0x3fa3('0x16')]);return _0x44c3d8(_0x70466a['error']['message']);}else{logger[_0x3fa3('0x10')](_0x3fa3('0x11'),_0x2f1f40,_0x3fa3('0x14'));_0x44c3d8(_0x70466a[_0x3fa3('0x17')][_0x3fa3('0x16')]);}})[_0x3fa3('0x18')](function(_0x21c2bd){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x2f1f40,_0x21c2bd);_0x185d56(_0x21c2bd);});});}exports['GetVoiceQueueReport']=function(_0x4c5f25){var _0x3a1daa=this;return new Promise(function(_0x436984,_0x1c7668){return db[_0x3fa3('0x19')][_0x3fa3('0x1a')]({'raw':_0x4c5f25[_0x3fa3('0x1b')]?_0x4c5f25[_0x3fa3('0x1b')][_0x3fa3('0x1c')]===undefined?!![]:![]:!![],'where':_0x4c5f25[_0x3fa3('0x1b')]?_0x4c5f25[_0x3fa3('0x1b')][_0x3fa3('0x1d')]||null:null,'attributes':_0x4c5f25[_0x3fa3('0x1b')]?_0x4c5f25['options']['attributes']||null:null,'limit':_0x4c5f25[_0x3fa3('0x1b')]?_0x4c5f25[_0x3fa3('0x1b')]['limit']||null:null,'include':_0x4c5f25[_0x3fa3('0x1b')]?_0x4c5f25[_0x3fa3('0x1b')][_0x3fa3('0x1e')]?_[_0x3fa3('0x1f')](_0x4c5f25[_0x3fa3('0x1b')][_0x3fa3('0x1e')],function(_0x3722be){return{'model':db[_0x3722be[_0x3fa3('0x20')]],'as':_0x3722be['as'],'attributes':_0x3722be[_0x3fa3('0x21')],'include':_0x3722be[_0x3fa3('0x1e')]?_['map'](_0x3722be['include'],function(_0x4cd0ab){return{'model':db[_0x4cd0ab['model']],'as':_0x4cd0ab['as'],'attributes':_0x4cd0ab[_0x3fa3('0x21')],'include':_0x4cd0ab[_0x3fa3('0x1e')]?_[_0x3fa3('0x1f')](_0x4cd0ab[_0x3fa3('0x1e')],function(_0x2a3c03){return{'model':db[_0x2a3c03['model']],'as':_0x2a3c03['as'],'attributes':_0x2a3c03[_0x3fa3('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40d809){logger[_0x3fa3('0x10')](_0x3fa3('0x22'),_0x4c5f25);logger[_0x3fa3('0x12')]('GetVoiceQueueReport',_0x4c5f25,JSON['stringify'](_0x40d809));_0x436984(_0x40d809);})[_0x3fa3('0x18')](function(_0x1a7d7f){logger['error']('GetVoiceQueueReport',_0x1a7d7f['message'],_0x4c5f25);_0x1c7668(_0x3a1daa[_0x3fa3('0x15')](0x1f4,_0x1a7d7f[_0x3fa3('0x16')]));});});};exports[_0x3fa3('0x23')]=function(_0x29705d){var _0x2ad14e=this;return new Promise(function(_0x12c6e9,_0x1d09a6){return db['VoiceQueueReport']['create'](_0x29705d[_0x3fa3('0x24')],{'raw':_0x29705d['options']?_0x29705d[_0x3fa3('0x1b')][_0x3fa3('0x1c')]===undefined?!![]:![]:!![]})[_0x3fa3('0x25')](function(_0x106731){logger[_0x3fa3('0x10')]('CreateVoiceQueueReport',_0x29705d);logger[_0x3fa3('0x12')]('CreateVoiceQueueReport',_0x29705d,JSON[_0x3fa3('0x26')](_0x106731));_0x12c6e9(_0x106731);})['catch'](function(_0x2b5e8f){logger[_0x3fa3('0x15')](_0x3fa3('0x23'),_0x2b5e8f['message'],_0x29705d);_0x1d09a6(_0x2ad14e[_0x3fa3('0x15')](0x1f4,_0x2b5e8f[_0x3fa3('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x3f3af3){var _0x217e2a=this;return new Promise(function(_0x460de2,_0x340292){return db[_0x3fa3('0x19')][_0x3fa3('0x27')](_0x3f3af3[_0x3fa3('0x24')],{'raw':_0x3f3af3[_0x3fa3('0x1b')]?_0x3f3af3[_0x3fa3('0x1b')][_0x3fa3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f3af3['options']?_0x3f3af3[_0x3fa3('0x1b')][_0x3fa3('0x1d')]||null:null,'attributes':_0x3f3af3['options']?_0x3f3af3[_0x3fa3('0x1b')][_0x3fa3('0x21')]||null:null,'limit':_0x3f3af3['options']?_0x3f3af3[_0x3fa3('0x1b')][_0x3fa3('0x28')]||null:null})[_0x3fa3('0x25')](function(_0x1f02df){logger[_0x3fa3('0x10')](_0x3fa3('0x29'),_0x3f3af3);logger[_0x3fa3('0x12')]('UpdateVoiceQueueReport',_0x3f3af3,JSON['stringify'](_0x1f02df));_0x460de2(_0x1f02df);})[_0x3fa3('0x18')](function(_0x458351){logger[_0x3fa3('0x15')](_0x3fa3('0x29'),_0x458351[_0x3fa3('0x16')],_0x3f3af3);_0x340292(_0x217e2a[_0x3fa3('0x15')](0x1f4,_0x458351['message']));});});}; \ No newline at end of file +var _0x1136=['socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','redis'];(function(_0x2510a4,_0x2427ec){var _0x21150a=function(_0x86b386){while(--_0x86b386){_0x2510a4['push'](_0x2510a4['shift']());}};_0x21150a(++_0x2427ec);}(_0x1136,0x1cb));var _0x6113=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1136[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x6113('0x0'));var util=require('util');var moment=require(_0x6113('0x1'));var BPromise=require(_0x6113('0x2'));var rs=require(_0x6113('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6113('0x4'))['db'];var utils=require(_0x6113('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6113('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6113('0x7')]['http']({'port':0x232a});config[_0x6113('0x8')]=_['defaults'](config[_0x6113('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x6113('0x9'))(new Redis(config[_0x6113('0x8')]));require(_0x6113('0xa'))[_0x6113('0xb')](socket);function respondWithRpcPromise(_0x5d7bbc,_0x3cde11,_0xd7a510){return new BPromise(function(_0x96b9cd,_0x547946){return client[_0x6113('0xc')](_0x5d7bbc,_0xd7a510)[_0x6113('0xd')](function(_0x459a16){logger[_0x6113('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x3cde11,_0x6113('0xf'));logger[_0x6113('0x10')](_0x6113('0x11'),_0x3cde11,_0x6113('0xf'),JSON[_0x6113('0x12')](_0x459a16));if(_0x459a16[_0x6113('0x13')]){if(_0x459a16[_0x6113('0x13')][_0x6113('0x14')]===0x1f4){logger[_0x6113('0x13')](_0x6113('0x15'),_0x3cde11,_0x459a16[_0x6113('0x13')][_0x6113('0x16')]);return _0x547946(_0x459a16['error']['message']);}logger[_0x6113('0x13')](_0x6113('0x15'),_0x3cde11,_0x459a16[_0x6113('0x13')][_0x6113('0x16')]);return _0x96b9cd(_0x459a16[_0x6113('0x13')]['message']);}else{logger[_0x6113('0xe')](_0x6113('0x15'),_0x3cde11,_0x6113('0xf'));_0x96b9cd(_0x459a16['result'][_0x6113('0x16')]);}})[_0x6113('0x17')](function(_0x254c66){logger['error'](_0x6113('0x15'),_0x3cde11,_0x254c66);_0x547946(_0x254c66);});});}exports[_0x6113('0x18')]=function(_0x40afde){var _0x394b8c=this;return new Promise(function(_0x4476d2,_0x169045){return db[_0x6113('0x19')][_0x6113('0x1a')]({'raw':_0x40afde[_0x6113('0x1b')]?_0x40afde['options'][_0x6113('0x1c')]===undefined?!![]:![]:!![],'where':_0x40afde[_0x6113('0x1b')]?_0x40afde[_0x6113('0x1b')][_0x6113('0x1d')]||null:null,'attributes':_0x40afde[_0x6113('0x1b')]?_0x40afde[_0x6113('0x1b')][_0x6113('0x1e')]||null:null,'limit':_0x40afde[_0x6113('0x1b')]?_0x40afde[_0x6113('0x1b')]['limit']||null:null,'include':_0x40afde['options']?_0x40afde[_0x6113('0x1b')][_0x6113('0x1f')]?_[_0x6113('0x20')](_0x40afde[_0x6113('0x1b')][_0x6113('0x1f')],function(_0x5a574f){return{'model':db[_0x5a574f[_0x6113('0x21')]],'as':_0x5a574f['as'],'attributes':_0x5a574f[_0x6113('0x1e')],'include':_0x5a574f[_0x6113('0x1f')]?_['map'](_0x5a574f['include'],function(_0x36c772){return{'model':db[_0x36c772['model']],'as':_0x36c772['as'],'attributes':_0x36c772[_0x6113('0x1e')],'include':_0x36c772[_0x6113('0x1f')]?_[_0x6113('0x20')](_0x36c772[_0x6113('0x1f')],function(_0x38387c){return{'model':db[_0x38387c['model']],'as':_0x38387c['as'],'attributes':_0x38387c[_0x6113('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2152da){logger[_0x6113('0xe')](_0x6113('0x18'),_0x40afde);logger[_0x6113('0x10')]('GetVoiceQueueReport',_0x40afde,JSON[_0x6113('0x12')](_0x2152da));_0x4476d2(_0x2152da);})[_0x6113('0x17')](function(_0x120605){logger[_0x6113('0x13')](_0x6113('0x18'),_0x120605[_0x6113('0x16')],_0x40afde);_0x169045(_0x394b8c['error'](0x1f4,_0x120605[_0x6113('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x501b54){var _0x4ae2c9=this;return new Promise(function(_0xe8af99,_0x26d4e5){return db[_0x6113('0x19')]['create'](_0x501b54[_0x6113('0x22')],{'raw':_0x501b54[_0x6113('0x1b')]?_0x501b54[_0x6113('0x1b')][_0x6113('0x1c')]===undefined?!![]:![]:!![]})[_0x6113('0xd')](function(_0x1891fa){logger['info'](_0x6113('0x23'),_0x501b54);logger[_0x6113('0x10')](_0x6113('0x23'),_0x501b54,JSON[_0x6113('0x12')](_0x1891fa));_0xe8af99(_0x1891fa);})[_0x6113('0x17')](function(_0x20e6ae){logger[_0x6113('0x13')](_0x6113('0x23'),_0x20e6ae[_0x6113('0x16')],_0x501b54);_0x26d4e5(_0x4ae2c9[_0x6113('0x13')](0x1f4,_0x20e6ae[_0x6113('0x16')]));});});};exports[_0x6113('0x24')]=function(_0x327dff){var _0x5a8e37=this;return new Promise(function(_0x533b35,_0xe7e981){return db[_0x6113('0x19')][_0x6113('0x25')](_0x327dff[_0x6113('0x22')],{'raw':_0x327dff[_0x6113('0x1b')]?_0x327dff[_0x6113('0x1b')][_0x6113('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x327dff[_0x6113('0x1b')]?_0x327dff[_0x6113('0x1b')][_0x6113('0x1d')]||null:null,'attributes':_0x327dff[_0x6113('0x1b')]?_0x327dff[_0x6113('0x1b')][_0x6113('0x1e')]||null:null,'limit':_0x327dff[_0x6113('0x1b')]?_0x327dff[_0x6113('0x1b')][_0x6113('0x26')]||null:null})['then'](function(_0x3407b4){logger[_0x6113('0xe')](_0x6113('0x24'),_0x327dff);logger[_0x6113('0x10')](_0x6113('0x24'),_0x327dff,JSON['stringify'](_0x3407b4));_0x533b35(_0x3407b4);})[_0x6113('0x17')](function(_0x5e361a){logger['error']('UpdateVoiceQueueReport',_0x5e361a[_0x6113('0x16')],_0x327dff);_0xe7e981(_0x5a8e37['error'](0x1f4,_0x5e361a[_0x6113('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index cf7b1af..02c2959 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 _0x872a=['removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x43ee36,_0x14b742){var _0xd7c771=function(_0x1d349b){while(--_0x1d349b){_0x43ee36['push'](_0x43ee36['shift']());}};_0xd7c771(++_0x14b742);}(_0x872a,0x100));var _0xa872=function(_0xf0820c,_0x2b72c5){_0xf0820c=_0xf0820c-0x0;var _0x2ca975=_0x872a[_0xf0820c];return _0x2ca975;};'use strict';var VoiceQueueReportEvents=require(_0xa872('0x0'));var events=[_0xa872('0x1'),_0xa872('0x2'),_0xa872('0x3')];function createListener(_0x4a2170,_0x48294d){return function(_0x4c6509){_0x48294d[_0xa872('0x4')](_0x4a2170,_0x4c6509);};}function removeListener(_0x58715a,_0x2854a7){return function(){VoiceQueueReportEvents[_0xa872('0x5')](_0x58715a,_0x2854a7);};}exports[_0xa872('0x6')]=function(_0x1c8d2f){for(var _0x3e3cd4=0x0,_0x4aab9d=events[_0xa872('0x7')];_0x3e3cd4<_0x4aab9d;_0x3e3cd4++){var _0x1b87b7=events[_0x3e3cd4];var _0x1e0c05=createListener(_0xa872('0x8')+_0x1b87b7,_0x1c8d2f);VoiceQueueReportEvents['on'](_0x1b87b7,_0x1e0c05);}}; \ No newline at end of file +var _0x897d=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener','register'];(function(_0x3a49ed,_0x5942c0){var _0xfc681=function(_0x11d26b){while(--_0x11d26b){_0x3a49ed['push'](_0x3a49ed['shift']());}};_0xfc681(++_0x5942c0);}(_0x897d,0x80));var _0xd897=function(_0x31a212,_0x45c30d){_0x31a212=_0x31a212-0x0;var _0x4fe251=_0x897d[_0x31a212];return _0x4fe251;};'use strict';var VoiceQueueReportEvents=require(_0xd897('0x0'));var events=[_0xd897('0x1'),_0xd897('0x2'),_0xd897('0x3')];function createListener(_0x2bd776,_0xcee3){return function(_0x8e4325){_0xcee3[_0xd897('0x4')](_0x2bd776,_0x8e4325);};}function removeListener(_0x407c5c,_0xf4d1dd){return function(){VoiceQueueReportEvents[_0xd897('0x5')](_0x407c5c,_0xf4d1dd);};}exports[_0xd897('0x6')]=function(_0x3e1cc5){for(var _0x386bc2=0x0,_0x317dac=events[_0xd897('0x7')];_0x386bc2<_0x317dac;_0x386bc2++){var _0x29caa5=events[_0x386bc2];var _0x28e011=createListener(_0xd897('0x8')+_0x29caa5,_0x3e1cc5);VoiceQueueReportEvents['on'](_0x29caa5,_0x28e011);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index b658e58..06ecf5f 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 _0x1b6d=['/:id','create','put','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated'];(function(_0x21b9e1,_0x5c9fbc){var _0x1a7952=function(_0x142a21){while(--_0x142a21){_0x21b9e1['push'](_0x21b9e1['shift']());}};_0x1a7952(++_0x5c9fbc);}(_0x1b6d,0x1e6));var _0xd1b6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1b6d[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xd1b6('0x0'));var util=require('util');var path=require(_0xd1b6('0x1'));var timeout=require('connect-timeout');var express=require(_0xd1b6('0x2'));var router=express[_0xd1b6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd1b6('0x4'));var interaction=require(_0xd1b6('0x5'));var config=require(_0xd1b6('0x6'));var controller=require(_0xd1b6('0x7'));router['get']('/',auth[_0xd1b6('0x8')](),controller['index']);router['get'](_0xd1b6('0x9'),auth[_0xd1b6('0x8')](),controller['show']);router['post']('/',auth[_0xd1b6('0x8')](),controller[_0xd1b6('0xa')]);router[_0xd1b6('0xb')]('/:id',auth[_0xd1b6('0x8')](),controller[_0xd1b6('0xc')]);router[_0xd1b6('0xd')](_0xd1b6('0x9'),auth[_0xd1b6('0x8')](),controller['destroy']);module[_0xd1b6('0xe')]=router; \ No newline at end of file +var _0x9122=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x2cf307,_0x1caed8){var _0x5eb76c=function(_0x2d7097){while(--_0x2d7097){_0x2cf307['push'](_0x2cf307['shift']());}};_0x5eb76c(++_0x1caed8);}(_0x9122,0xa5));var _0x2912=function(_0x17935e,_0x1256f5){_0x17935e=_0x17935e-0x0;var _0x14c9e9=_0x9122[_0x17935e];return _0x14c9e9;};'use strict';var multer=require(_0x2912('0x0'));var util=require(_0x2912('0x1'));var path=require(_0x2912('0x2'));var timeout=require(_0x2912('0x3'));var express=require(_0x2912('0x4'));var router=express[_0x2912('0x5')]();var fs_extra=require(_0x2912('0x6'));var auth=require(_0x2912('0x7'));var interaction=require(_0x2912('0x8'));var config=require(_0x2912('0x9'));var controller=require(_0x2912('0xa'));router[_0x2912('0xb')]('/',auth[_0x2912('0xc')](),controller[_0x2912('0xd')]);router[_0x2912('0xb')](_0x2912('0xe'),auth[_0x2912('0xc')](),controller[_0x2912('0xf')]);router[_0x2912('0x10')]('/',auth[_0x2912('0xc')](),controller[_0x2912('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2912('0x12')]);router[_0x2912('0x13')](_0x2912('0xe'),auth['isAuthenticated'](),controller[_0x2912('0x14')]);module[_0x2912('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index cad8c5c..dafd7ad 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 _0x8ef6=['DATE','literal','sequelize','moment','exports','STRING'];(function(_0x5dc3bc,_0x44681c){var _0x27e0e0=function(_0x226b79){while(--_0x226b79){_0x5dc3bc['push'](_0x5dc3bc['shift']());}};_0x27e0e0(++_0x44681c);}(_0x8ef6,0x80));var _0x68ef=function(_0x2d85ab,_0x52c601){_0x2d85ab=_0x2d85ab-0x0;var _0x2c78db=_0x8ef6[_0x2d85ab];return _0x2c78db;};'use strict';var Sequelize=require(_0x68ef('0x0'));var moment=require(_0x68ef('0x1'));module[_0x68ef('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x68ef('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x68ef('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x68ef('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xd63c=['DATE','literal','moment','exports','STRING'];(function(_0x4ae9da,_0x23d7ac){var _0x50e578=function(_0x31a467){while(--_0x31a467){_0x4ae9da['push'](_0x4ae9da['shift']());}};_0x50e578(++_0x23d7ac);}(_0xd63c,0x8e));var _0xcd63=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd63c[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcd63('0x0'));module[_0xcd63('0x1')]={'time':{'type':Sequelize[_0xcd63('0x2')]},'callid':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xcd63('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xcd63('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xcd63('0x4')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index e4e1d11..cee0bbf 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 _0x04ba=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','VoiceQueuesLog','fieldName','type','key','keys','filters','intersection','model','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x47b05d,_0x5413e5){var _0x288523=function(_0x12fdf5){while(--_0x12fdf5){_0x47b05d['push'](_0x47b05d['shift']());}};_0x288523(++_0x5413e5);}(_0x04ba,0x7e));var _0xa04b=function(_0x1cff76,_0x3e52c0){_0x1cff76=_0x1cff76-0x0;var _0x17b58f=_0x04ba[_0x1cff76];return _0x17b58f;};'use strict';var emlformat=require(_0xa04b('0x0'));var rimraf=require(_0xa04b('0x1'));var zipdir=require(_0xa04b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa04b('0x3'));var moment=require(_0xa04b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa04b('0x5'));var util=require(_0xa04b('0x6'));var path=require(_0xa04b('0x7'));var sox=require('sox');var csv=require(_0xa04b('0x8'));var ejs=require(_0xa04b('0x9'));var fs=require('fs');var fs_extra=require(_0xa04b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa04b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa04b('0x8'));var querystring=require('querystring');var Papa=require(_0xa04b('0xc'));var Redis=require(_0xa04b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa04b('0xe'));var as=require(_0xa04b('0xf'));var hardwareService=require(_0xa04b('0x10'));var logger=require(_0xa04b('0x11'))('api');var utils=require(_0xa04b('0x12'));var config=require(_0xa04b('0x13'));var licenseUtil=require(_0xa04b('0x14'));var db=require(_0xa04b('0x15'))['db'];function respondWithStatusCode(_0x2e8eca,_0xb4d9a8){_0xb4d9a8=_0xb4d9a8||0xcc;return function(_0x487647){if(_0x487647){return _0x2e8eca[_0xa04b('0x16')](_0xb4d9a8);}return _0x2e8eca[_0xa04b('0x17')](_0xb4d9a8)[_0xa04b('0x18')]();};}function respondWithResult(_0x1ba606,_0x5b9c57){_0x5b9c57=_0x5b9c57||0xc8;return function(_0x4633b1){if(_0x4633b1){return _0x1ba606[_0xa04b('0x17')](_0x5b9c57)[_0xa04b('0x19')](_0x4633b1);}};}function respondWithFilteredResult(_0x54446d,_0x404788){return function(_0x5524ef){if(_0x5524ef){var _0x31fcd8=typeof _0x404788[_0xa04b('0x1a')]===_0xa04b('0x1b')&&typeof _0x404788['limit']===_0xa04b('0x1b');var _0x423b24=_0x5524ef[_0xa04b('0x1c')];var _0x2fdf7b=_0x31fcd8?0x0:_0x404788['offset'];var _0x5ec765=_0x31fcd8?_0x5524ef['count']:_0x404788[_0xa04b('0x1a')]+_0x404788[_0xa04b('0x1d')];var _0x15f3f7;if(_0x5ec765>=_0x423b24){_0x5ec765=_0x423b24;_0x15f3f7=0xc8;}else{_0x15f3f7=0xce;}_0x54446d[_0xa04b('0x17')](_0x15f3f7);return _0x54446d[_0xa04b('0x1e')](_0xa04b('0x1f'),_0x2fdf7b+'-'+_0x5ec765+'/'+_0x423b24)[_0xa04b('0x19')](_0x5524ef);}return null;};}function patchUpdates(_0x45cb4b){return function(_0x4b30da){try{jsonpatch[_0xa04b('0x20')](_0x4b30da,_0x45cb4b,!![]);}catch(_0xd0c119){return BPromise['reject'](_0xd0c119);}return _0x4b30da[_0xa04b('0x21')]();};}function saveUpdates(_0x31e368,_0xa18876){return function(_0x13ec08){if(_0x13ec08){return _0x13ec08[_0xa04b('0x22')](_0x31e368)[_0xa04b('0x23')](function(_0x4e28f3){return _0x4e28f3;});}return null;};}function removeEntity(_0x4e019b,_0x45714e){return function(_0x531e3c){if(_0x531e3c){return _0x531e3c[_0xa04b('0x24')]()[_0xa04b('0x23')](function(){_0x4e019b[_0xa04b('0x17')](0xcc)[_0xa04b('0x18')]();});}};}function handleEntityNotFound(_0x331fd3,_0x113883){return function(_0x3a7cc0){if(!_0x3a7cc0){_0x331fd3[_0xa04b('0x16')](0x194);}return _0x3a7cc0;};}function handleError(_0x1c6075,_0x2b0863){_0x2b0863=_0x2b0863||0x1f4;return function(_0x1a238f){logger[_0xa04b('0x25')](_0x1a238f[_0xa04b('0x26')]);if(_0x1a238f[_0xa04b('0x27')]){delete _0x1a238f[_0xa04b('0x27')];}_0x1c6075[_0xa04b('0x17')](_0x2b0863)[_0xa04b('0x28')](_0x1a238f);};}exports['index']=function(_0x42a30d,_0x192733){var _0x2adc75={},_0x4e8980={},_0x3c1080={'count':0x0,'rows':[]};var _0x490475=_[_0xa04b('0x29')](db[_0xa04b('0x2a')]['rawAttributes'],function(_0xdc54e9){return{'name':_0xdc54e9[_0xa04b('0x2b')],'type':_0xdc54e9[_0xa04b('0x2c')][_0xa04b('0x2d')]};});_0x4e8980['model']=_['map'](_0x490475,'name');_0x4e8980['query']=_[_0xa04b('0x2e')](_0x42a30d['query']);_0x4e8980[_0xa04b('0x2f')]=_[_0xa04b('0x30')](_0x4e8980[_0xa04b('0x31')],_0x4e8980[_0xa04b('0x32')]);_0x2adc75[_0xa04b('0x33')]=_[_0xa04b('0x30')](_0x4e8980[_0xa04b('0x31')],qs['fields'](_0x42a30d[_0xa04b('0x32')]['fields']));_0x2adc75[_0xa04b('0x33')]=_0x2adc75['attributes'][_0xa04b('0x34')]?_0x2adc75[_0xa04b('0x33')]:_0x4e8980[_0xa04b('0x31')];if(!_0x42a30d[_0xa04b('0x32')][_0xa04b('0x35')](_0xa04b('0x36'))){_0x2adc75['limit']=qs[_0xa04b('0x1d')](_0x42a30d['query'][_0xa04b('0x1d')]);_0x2adc75[_0xa04b('0x1a')]=qs['offset'](_0x42a30d[_0xa04b('0x32')][_0xa04b('0x1a')]);}_0x2adc75[_0xa04b('0x37')]=qs[_0xa04b('0x38')](_0x42a30d[_0xa04b('0x32')][_0xa04b('0x38')]);_0x2adc75[_0xa04b('0x39')]=qs[_0xa04b('0x2f')](_[_0xa04b('0x3a')](_0x42a30d[_0xa04b('0x32')],_0x4e8980['filters']),_0x490475);if(_0x42a30d[_0xa04b('0x32')][_0xa04b('0x3b')]){_0x2adc75['where']=_[_0xa04b('0x3c')](_0x2adc75['where'],{'$or':_[_0xa04b('0x29')](_0x490475,function(_0x5afc6d){if(_0x5afc6d['type']!=='VIRTUAL'){var _0xad4e91={};_0xad4e91[_0x5afc6d['name']]={'$like':'%'+_0x42a30d[_0xa04b('0x32')][_0xa04b('0x3b')]+'%'};return _0xad4e91;}})});}_0x2adc75=_['merge']({},_0x2adc75,_0x42a30d['options']);var _0x21b915={'where':_0x2adc75['where']};return db[_0xa04b('0x2a')][_0xa04b('0x1c')](_0x21b915)[_0xa04b('0x23')](function(_0x2cee38){_0x3c1080[_0xa04b('0x1c')]=_0x2cee38;if(_0x42a30d[_0xa04b('0x32')][_0xa04b('0x3d')]){_0x2adc75[_0xa04b('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x2adc75);})['then'](function(_0x530353){_0x3c1080[_0xa04b('0x3f')]=_0x530353;return _0x3c1080;})[_0xa04b('0x23')](respondWithFilteredResult(_0x192733,_0x2adc75))[_0xa04b('0x40')](handleError(_0x192733,null));};exports[_0xa04b('0x41')]=function(_0x5fd52d,_0x1b31d7){var _0x25e7f1={'raw':!![],'where':{'id':_0x5fd52d[_0xa04b('0x42')]['id']}},_0x43eb0a={};_0x43eb0a[_0xa04b('0x31')]=_[_0xa04b('0x2e')](db['VoiceQueuesLog']['rawAttributes']);_0x43eb0a[_0xa04b('0x32')]=_['keys'](_0x5fd52d[_0xa04b('0x32')]);_0x43eb0a[_0xa04b('0x2f')]=_['intersection'](_0x43eb0a[_0xa04b('0x31')],_0x43eb0a[_0xa04b('0x32')]);_0x25e7f1['attributes']=_['intersection'](_0x43eb0a[_0xa04b('0x31')],qs['fields'](_0x5fd52d[_0xa04b('0x32')]['fields']));_0x25e7f1[_0xa04b('0x33')]=_0x25e7f1['attributes'][_0xa04b('0x34')]?_0x25e7f1[_0xa04b('0x33')]:_0x43eb0a[_0xa04b('0x31')];if(_0x5fd52d[_0xa04b('0x32')][_0xa04b('0x3d')]){_0x25e7f1[_0xa04b('0x3e')]=[{'all':!![]}];}_0x25e7f1=_[_0xa04b('0x3c')]({},_0x25e7f1,_0x5fd52d[_0xa04b('0x43')]);return db[_0xa04b('0x2a')][_0xa04b('0x44')](_0x25e7f1)[_0xa04b('0x23')](handleEntityNotFound(_0x1b31d7,null))[_0xa04b('0x23')](respondWithResult(_0x1b31d7,null))[_0xa04b('0x40')](handleError(_0x1b31d7,null));};exports[_0xa04b('0x45')]=function(_0x5baea7,_0x10acf6){return db[_0xa04b('0x2a')][_0xa04b('0x45')](_0x5baea7['body'],{})[_0xa04b('0x23')](respondWithResult(_0x10acf6,0xc9))[_0xa04b('0x40')](handleError(_0x10acf6,null));};exports[_0xa04b('0x22')]=function(_0x525a04,_0x25dd77){if(_0x525a04[_0xa04b('0x46')]['id']){delete _0x525a04[_0xa04b('0x46')]['id'];}return db[_0xa04b('0x2a')][_0xa04b('0x44')]({'where':{'id':_0x525a04[_0xa04b('0x42')]['id']}})[_0xa04b('0x23')](handleEntityNotFound(_0x25dd77,null))[_0xa04b('0x23')](saveUpdates(_0x525a04[_0xa04b('0x46')],null))[_0xa04b('0x23')](respondWithResult(_0x25dd77,null))[_0xa04b('0x40')](handleError(_0x25dd77,null));};exports[_0xa04b('0x24')]=function(_0x122cc8,_0xcda71f){return db[_0xa04b('0x2a')][_0xa04b('0x44')]({'where':{'id':_0x122cc8[_0xa04b('0x42')]['id']}})[_0xa04b('0x23')](handleEntityNotFound(_0xcda71f,null))[_0xa04b('0x23')](removeEntity(_0xcda71f,null))[_0xa04b('0x40')](handleError(_0xcda71f,null));}; \ No newline at end of file +var _0x530b=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceQueuesLog','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','merge','type','filter','options','where','includeAll','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x4a81e8,_0x478cbf){var _0x570665=function(_0x2ecd60){while(--_0x2ecd60){_0x4a81e8['push'](_0x4a81e8['shift']());}};_0x570665(++_0x478cbf);}(_0x530b,0x1e3));var _0xb530=function(_0x5df033,_0x29458b){_0x5df033=_0x5df033-0x0;var _0x445829=_0x530b[_0x5df033];return _0x445829;};'use strict';var emlformat=require(_0xb530('0x0'));var rimraf=require(_0xb530('0x1'));var zipdir=require(_0xb530('0x2'));var jsonpatch=require(_0xb530('0x3'));var rp=require(_0xb530('0x4'));var moment=require('moment');var BPromise=require(_0xb530('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb530('0x6'));var sox=require(_0xb530('0x7'));var csv=require('to-csv');var ejs=require(_0xb530('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb530('0x9'));var squel=require(_0xb530('0xa'));var crypto=require(_0xb530('0xb'));var jsforce=require(_0xb530('0xc'));var deskjs=require(_0xb530('0xd'));var toCsv=require(_0xb530('0xe'));var querystring=require(_0xb530('0xf'));var Papa=require('papaparse');var Redis=require(_0xb530('0x10'));var authService=require(_0xb530('0x11'));var qs=require(_0xb530('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb530('0x13'));var logger=require(_0xb530('0x14'))('api');var utils=require(_0xb530('0x15'));var config=require(_0xb530('0x16'));var licenseUtil=require(_0xb530('0x17'));var db=require(_0xb530('0x18'))['db'];function respondWithStatusCode(_0x2f0a75,_0x309156){_0x309156=_0x309156||0xcc;return function(_0x458777){if(_0x458777){return _0x2f0a75[_0xb530('0x19')](_0x309156);}return _0x2f0a75[_0xb530('0x1a')](_0x309156)['end']();};}function respondWithResult(_0x4ece81,_0x5202d1){_0x5202d1=_0x5202d1||0xc8;return function(_0x576714){if(_0x576714){return _0x4ece81['status'](_0x5202d1)[_0xb530('0x1b')](_0x576714);}};}function respondWithFilteredResult(_0x44c997,_0x187590){return function(_0x63fd1){if(_0x63fd1){var _0x2bd548=typeof _0x187590[_0xb530('0x1c')]===_0xb530('0x1d')&&typeof _0x187590[_0xb530('0x1e')]===_0xb530('0x1d');var _0x4d55a7=_0x63fd1[_0xb530('0x1f')];var _0x5d8031=_0x2bd548?0x0:_0x187590[_0xb530('0x1c')];var _0x5f395c=_0x2bd548?_0x63fd1[_0xb530('0x1f')]:_0x187590[_0xb530('0x1c')]+_0x187590[_0xb530('0x1e')];var _0x20e476;if(_0x5f395c>=_0x4d55a7){_0x5f395c=_0x4d55a7;_0x20e476=0xc8;}else{_0x20e476=0xce;}_0x44c997[_0xb530('0x1a')](_0x20e476);return _0x44c997[_0xb530('0x20')](_0xb530('0x21'),_0x5d8031+'-'+_0x5f395c+'/'+_0x4d55a7)['json'](_0x63fd1);}return null;};}function patchUpdates(_0xca511d){return function(_0x3d109c){try{jsonpatch[_0xb530('0x22')](_0x3d109c,_0xca511d,!![]);}catch(_0x51691f){return BPromise[_0xb530('0x23')](_0x51691f);}return _0x3d109c[_0xb530('0x24')]();};}function saveUpdates(_0x3f18c1,_0x48b8e6){return function(_0x3f2453){if(_0x3f2453){return _0x3f2453[_0xb530('0x25')](_0x3f18c1)[_0xb530('0x26')](function(_0x2ecd53){return _0x2ecd53;});}return null;};}function removeEntity(_0xc02384,_0x10b9f0){return function(_0x2a7815){if(_0x2a7815){return _0x2a7815[_0xb530('0x27')]()[_0xb530('0x26')](function(){_0xc02384[_0xb530('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bcf5c,_0x2adb8e){return function(_0x5bbb6b){if(!_0x5bbb6b){_0x1bcf5c['sendStatus'](0x194);}return _0x5bbb6b;};}function handleError(_0x4d2672,_0x12d815){_0x12d815=_0x12d815||0x1f4;return function(_0x1d8de5){logger[_0xb530('0x28')](_0x1d8de5[_0xb530('0x29')]);if(_0x1d8de5[_0xb530('0x2a')]){delete _0x1d8de5['name'];}_0x4d2672[_0xb530('0x1a')](_0x12d815)['send'](_0x1d8de5);};}exports[_0xb530('0x2b')]=function(_0x3a579e,_0x4cf69c){var _0x49d8bf={},_0x1d0c60={},_0x48195d={'count':0x0,'rows':[]};var _0xc1e9ed=_[_0xb530('0x2c')](db[_0xb530('0x2d')]['rawAttributes'],function(_0x352abc){return{'name':_0x352abc['fieldName'],'type':_0x352abc['type'][_0xb530('0x2e')]};});_0x1d0c60[_0xb530('0x2f')]=_[_0xb530('0x2c')](_0xc1e9ed,_0xb530('0x2a'));_0x1d0c60[_0xb530('0x30')]=_[_0xb530('0x31')](_0x3a579e[_0xb530('0x30')]);_0x1d0c60[_0xb530('0x32')]=_[_0xb530('0x33')](_0x1d0c60[_0xb530('0x2f')],_0x1d0c60[_0xb530('0x30')]);_0x49d8bf[_0xb530('0x34')]=_[_0xb530('0x33')](_0x1d0c60[_0xb530('0x2f')],qs[_0xb530('0x35')](_0x3a579e[_0xb530('0x30')]['fields']));_0x49d8bf['attributes']=_0x49d8bf['attributes'][_0xb530('0x36')]?_0x49d8bf['attributes']:_0x1d0c60[_0xb530('0x2f')];if(!_0x3a579e['query']['hasOwnProperty'](_0xb530('0x37'))){_0x49d8bf[_0xb530('0x1e')]=qs[_0xb530('0x1e')](_0x3a579e[_0xb530('0x30')][_0xb530('0x1e')]);_0x49d8bf[_0xb530('0x1c')]=qs[_0xb530('0x1c')](_0x3a579e[_0xb530('0x30')][_0xb530('0x1c')]);}_0x49d8bf[_0xb530('0x38')]=qs['sort'](_0x3a579e[_0xb530('0x30')][_0xb530('0x39')]);_0x49d8bf['where']=qs[_0xb530('0x32')](_[_0xb530('0x3a')](_0x3a579e[_0xb530('0x30')],_0x1d0c60[_0xb530('0x32')]),_0xc1e9ed);if(_0x3a579e[_0xb530('0x30')]['filter']){_0x49d8bf['where']=_[_0xb530('0x3b')](_0x49d8bf['where'],{'$or':_[_0xb530('0x2c')](_0xc1e9ed,function(_0xc899f0){if(_0xc899f0[_0xb530('0x3c')]!=='VIRTUAL'){var _0x30df02={};_0x30df02[_0xc899f0['name']]={'$like':'%'+_0x3a579e[_0xb530('0x30')][_0xb530('0x3d')]+'%'};return _0x30df02;}})});}_0x49d8bf=_[_0xb530('0x3b')]({},_0x49d8bf,_0x3a579e[_0xb530('0x3e')]);var _0x24d695={'where':_0x49d8bf[_0xb530('0x3f')]};return db[_0xb530('0x2d')]['count'](_0x24d695)[_0xb530('0x26')](function(_0x2cf797){_0x48195d[_0xb530('0x1f')]=_0x2cf797;if(_0x3a579e[_0xb530('0x30')][_0xb530('0x40')]){_0x49d8bf['include']=[{'all':!![]}];}return db[_0xb530('0x2d')][_0xb530('0x41')](_0x49d8bf);})[_0xb530('0x26')](function(_0x1682da){_0x48195d[_0xb530('0x42')]=_0x1682da;return _0x48195d;})[_0xb530('0x26')](respondWithFilteredResult(_0x4cf69c,_0x49d8bf))[_0xb530('0x43')](handleError(_0x4cf69c,null));};exports['show']=function(_0x1e52c9,_0x1c82a4){var _0x29e70c={'raw':!![],'where':{'id':_0x1e52c9[_0xb530('0x44')]['id']}},_0x1d5611={};_0x1d5611['model']=_[_0xb530('0x31')](db[_0xb530('0x2d')]['rawAttributes']);_0x1d5611[_0xb530('0x30')]=_[_0xb530('0x31')](_0x1e52c9['query']);_0x1d5611[_0xb530('0x32')]=_[_0xb530('0x33')](_0x1d5611[_0xb530('0x2f')],_0x1d5611[_0xb530('0x30')]);_0x29e70c[_0xb530('0x34')]=_[_0xb530('0x33')](_0x1d5611[_0xb530('0x2f')],qs[_0xb530('0x35')](_0x1e52c9[_0xb530('0x30')][_0xb530('0x35')]));_0x29e70c[_0xb530('0x34')]=_0x29e70c[_0xb530('0x34')][_0xb530('0x36')]?_0x29e70c[_0xb530('0x34')]:_0x1d5611[_0xb530('0x2f')];if(_0x1e52c9['query'][_0xb530('0x40')]){_0x29e70c['include']=[{'all':!![]}];}_0x29e70c=_[_0xb530('0x3b')]({},_0x29e70c,_0x1e52c9[_0xb530('0x3e')]);return db[_0xb530('0x2d')][_0xb530('0x45')](_0x29e70c)[_0xb530('0x26')](handleEntityNotFound(_0x1c82a4,null))['then'](respondWithResult(_0x1c82a4,null))[_0xb530('0x43')](handleError(_0x1c82a4,null));};exports[_0xb530('0x46')]=function(_0x2619a9,_0x1d75e9){return db[_0xb530('0x2d')][_0xb530('0x46')](_0x2619a9[_0xb530('0x47')],{})['then'](respondWithResult(_0x1d75e9,0xc9))[_0xb530('0x43')](handleError(_0x1d75e9,null));};exports[_0xb530('0x25')]=function(_0x4e52b4,_0x54d8e4){if(_0x4e52b4[_0xb530('0x47')]['id']){delete _0x4e52b4[_0xb530('0x47')]['id'];}return db[_0xb530('0x2d')][_0xb530('0x45')]({'where':{'id':_0x4e52b4[_0xb530('0x44')]['id']}})[_0xb530('0x26')](handleEntityNotFound(_0x54d8e4,null))[_0xb530('0x26')](saveUpdates(_0x4e52b4[_0xb530('0x47')],null))['then'](respondWithResult(_0x54d8e4,null))[_0xb530('0x43')](handleError(_0x54d8e4,null));};exports[_0xb530('0x27')]=function(_0x39881c,_0xd6b8f2){return db[_0xb530('0x2d')][_0xb530('0x45')]({'where':{'id':_0x39881c[_0xb530('0x44')]['id']}})[_0xb530('0x26')](handleEntityNotFound(_0xd6b8f2,null))[_0xb530('0x26')](removeEntity(_0xd6b8f2,null))[_0xb530('0x43')](handleError(_0xd6b8f2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 67bc95b..9243ebc 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 _0x81c9=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','dtm','lodash','util'];(function(_0x2d7836,_0x5a5412){var _0x491179=function(_0xaafd3){while(--_0xaafd3){_0x2d7836['push'](_0x2d7836['shift']());}};_0x491179(++_0x5a5412);}(_0x81c9,0x1de));var _0x981c=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x81c9[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x981c('0x0'));var util=require(_0x981c('0x1'));var logger=require(_0x981c('0x2'))(_0x981c('0x3'));var moment=require('moment');var BPromise=require(_0x981c('0x4'));var rp=require(_0x981c('0x5'));var fs=require('fs');var path=require(_0x981c('0x6'));var rimraf=require('rimraf');var config=require(_0x981c('0x7'));var attributes=require(_0x981c('0x8'));module[_0x981c('0x9')]=function(_0x19aa19,_0x5976c6){return _0x19aa19[_0x981c('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0x981c('0xb'),'paranoid':![],'indexes':[{'name':_0x981c('0xc'),'fields':[_0x981c('0xd'),_0x981c('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8275=['bluebird','request-promise','path','../../config/environment','exports','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment'];(function(_0x233be2,_0xa819c9){var _0x3e0449=function(_0x2ef358){while(--_0x2ef358){_0x233be2['push'](_0x233be2['shift']());}};_0x3e0449(++_0xa819c9);}(_0x8275,0x87));var _0x5827=function(_0x47be0c,_0x44a438){_0x47be0c=_0x47be0c-0x0;var _0x40bf94=_0x8275[_0x47be0c];return _0x40bf94;};'use strict';var _=require(_0x5827('0x0'));var util=require(_0x5827('0x1'));var logger=require(_0x5827('0x2'))(_0x5827('0x3'));var moment=require(_0x5827('0x4'));var BPromise=require(_0x5827('0x5'));var rp=require(_0x5827('0x6'));var fs=require('fs');var path=require(_0x5827('0x7'));var rimraf=require('rimraf');var config=require(_0x5827('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x5827('0x9')]=function(_0x43777f,_0x8182ab){return _0x43777f['define'](_0x5827('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x5827('0xb'),'fields':[_0x5827('0xc'),_0x5827('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index d8343d1..529df4e 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 _0x9251=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2f363b,_0x404b1d){var _0x5b1401=function(_0x162676){while(--_0x162676){_0x2f363b['push'](_0x2f363b['shift']());}};_0x5b1401(++_0x404b1d);}(_0x9251,0x1e6));var _0x1925=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0x9251[_0x3e6b2f];return _0x323215;};'use strict';var _=require('lodash');var util=require(_0x1925('0x0'));var moment=require(_0x1925('0x1'));var BPromise=require(_0x1925('0x2'));var rs=require(_0x1925('0x3'));var fs=require('fs');var Redis=require(_0x1925('0x4'));var db=require(_0x1925('0x5'))['db'];var utils=require(_0x1925('0x6'));var logger=require(_0x1925('0x7'))(_0x1925('0x8'));var config=require(_0x1925('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1925('0xa')][_0x1925('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a6313,_0x3dd721,_0x4f8d6c){return new BPromise(function(_0x4cfd03,_0x41d888){return client[_0x1925('0xc')](_0x1a6313,_0x4f8d6c)['then'](function(_0x4a37e1){logger[_0x1925('0xd')](_0x1925('0xe'),_0x3dd721,_0x1925('0xf'));logger[_0x1925('0x10')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x3dd721,_0x1925('0xf'),JSON[_0x1925('0x11')](_0x4a37e1));if(_0x4a37e1['error']){if(_0x4a37e1[_0x1925('0x12')][_0x1925('0x13')]===0x1f4){logger[_0x1925('0x12')](_0x1925('0xe'),_0x3dd721,_0x4a37e1[_0x1925('0x12')][_0x1925('0x14')]);return _0x41d888(_0x4a37e1['error']['message']);}logger[_0x1925('0x12')](_0x1925('0xe'),_0x3dd721,_0x4a37e1[_0x1925('0x12')][_0x1925('0x14')]);return _0x4cfd03(_0x4a37e1['error']['message']);}else{logger[_0x1925('0xd')](_0x1925('0xe'),_0x3dd721,_0x1925('0xf'));_0x4cfd03(_0x4a37e1[_0x1925('0x15')][_0x1925('0x14')]);}})[_0x1925('0x16')](function(_0x568257){logger[_0x1925('0x12')](_0x1925('0xe'),_0x3dd721,_0x568257);_0x41d888(_0x568257);});});} \ No newline at end of file +var _0x73bd=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','then','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','lodash'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0x73bd,0x6b));var _0xd73b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x73bd[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xd73b('0x0'));var util=require('util');var moment=require(_0xd73b('0x1'));var BPromise=require(_0xd73b('0x2'));var rs=require(_0xd73b('0x3'));var fs=require('fs');var Redis=require(_0xd73b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd73b('0x5'));var logger=require(_0xd73b('0x6'))('rpc');var config=require(_0xd73b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd73b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f3a3d,_0x41a563,_0x397565){return new BPromise(function(_0x397b44,_0x6574b8){return client['request'](_0x3f3a3d,_0x397565)[_0xd73b('0x9')](function(_0x18b10c){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x41a563,_0xd73b('0xa'));logger[_0xd73b('0xb')](_0xd73b('0xc'),_0x41a563,_0xd73b('0xa'),JSON['stringify'](_0x18b10c));if(_0x18b10c[_0xd73b('0xd')]){if(_0x18b10c[_0xd73b('0xd')]['code']===0x1f4){logger[_0xd73b('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x41a563,_0x18b10c['error']['message']);return _0x6574b8(_0x18b10c[_0xd73b('0xd')][_0xd73b('0xe')]);}logger[_0xd73b('0xd')](_0xd73b('0xf'),_0x41a563,_0x18b10c[_0xd73b('0xd')][_0xd73b('0xe')]);return _0x397b44(_0x18b10c[_0xd73b('0xd')][_0xd73b('0xe')]);}else{logger['info'](_0xd73b('0xf'),_0x41a563,_0xd73b('0xa'));_0x397b44(_0x18b10c[_0xd73b('0x10')][_0xd73b('0xe')]);}})[_0xd73b('0x11')](function(_0x5b9558){logger[_0xd73b('0xd')](_0xd73b('0xf'),_0x41a563,_0x5b9558);_0x6574b8(_0x5b9558);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c652fc4..0a86572 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 _0xc723=['../../components/interaction/service','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service'];(function(_0x40fa47,_0x4abd8b){var _0x545ceb=function(_0x543e9b){while(--_0x543e9b){_0x40fa47['push'](_0x40fa47['shift']());}};_0x545ceb(++_0x4abd8b);}(_0xc723,0x82));var _0x3c72=function(_0x5df033,_0x29458b){_0x5df033=_0x5df033-0x0;var _0x445829=_0xc723[_0x5df033];return _0x445829;};'use strict';var multer=require(_0x3c72('0x0'));var util=require(_0x3c72('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3c72('0x2'));var router=express['Router']();var fs_extra=require(_0x3c72('0x3'));var auth=require(_0x3c72('0x4'));var interaction=require(_0x3c72('0x5'));var config=require('../../config/environment');var controller=require(_0x3c72('0x6'));router[_0x3c72('0x7')]('/',auth['isAuthenticated'](),controller[_0x3c72('0x8')]);router[_0x3c72('0x7')](_0x3c72('0x9'),auth[_0x3c72('0xa')](),controller[_0x3c72('0xb')]);router[_0x3c72('0x7')](_0x3c72('0xc'),auth[_0x3c72('0xa')](),controller[_0x3c72('0xd')]);router[_0x3c72('0x7')](_0x3c72('0xe'),auth[_0x3c72('0xa')](),controller[_0x3c72('0xf')]);router[_0x3c72('0x7')](_0x3c72('0x10'),controller['downloads']);router['get'](_0x3c72('0x11'),auth[_0x3c72('0xa')](),controller[_0x3c72('0x12')]);router[_0x3c72('0x13')]('/',auth[_0x3c72('0xa')](),controller[_0x3c72('0x14')]);router[_0x3c72('0x13')](_0x3c72('0x11'),auth[_0x3c72('0xa')](),controller[_0x3c72('0x15')]);router[_0x3c72('0x16')](_0x3c72('0xc'),auth[_0x3c72('0xa')](),controller[_0x3c72('0x17')]);router[_0x3c72('0x18')](_0x3c72('0xc'),auth['isAuthenticated'](),controller[_0x3c72('0x19')]);module[_0x3c72('0x1a')]=router; \ No newline at end of file +var _0xde9d=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','/:id','show','get','/:id/download','download','/:id/downloads','downloads','create','post','put','update','util'];(function(_0x2c672f,_0x41bd03){var _0x2d0e7e=function(_0x3a210d){while(--_0x3a210d){_0x2c672f['push'](_0x2c672f['shift']());}};_0x2d0e7e(++_0x41bd03);}(_0xde9d,0xdb));var _0xdde9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde9d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xdde9('0x0'));var path=require('path');var timeout=require(_0xdde9('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdde9('0x2'));var auth=require(_0xdde9('0x3'));var interaction=require(_0xdde9('0x4'));var config=require(_0xdde9('0x5'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0xdde9('0x6')](),controller[_0xdde9('0x7')]);router['get'](_0xdde9('0x8'),auth[_0xdde9('0x6')](),controller['describe']);router['get'](_0xdde9('0x9'),auth[_0xdde9('0x6')](),controller[_0xdde9('0xa')]);router[_0xdde9('0xb')](_0xdde9('0xc'),auth[_0xdde9('0x6')](),controller[_0xdde9('0xd')]);router[_0xdde9('0xb')](_0xdde9('0xe'),controller[_0xdde9('0xf')]);router['get']('/:id/transcribe',auth[_0xdde9('0x6')](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller[_0xdde9('0x10')]);router[_0xdde9('0x11')]('/:id/transcribe',auth['isAuthenticated'](),controller['runTranscribe']);router[_0xdde9('0x12')](_0xdde9('0x9'),auth[_0xdde9('0x6')](),controller[_0xdde9('0x13')]);router['delete'](_0xdde9('0x9'),auth[_0xdde9('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 662eee7..5edf822 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(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 8937f3c..49c4ce6 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 _0x7614=['token','$and','push','ValidationError','extname','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','name','send','index','map','VoiceRecording','rawAttributes','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','catch','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col'];(function(_0x4d6bf3,_0x16ce7e){var _0x4b5457=function(_0x3781a2){while(--_0x3781a2){_0x4d6bf3['push'](_0x4d6bf3['shift']());}};_0x4b5457(++_0x16ce7e);}(_0x7614,0xd8));var _0x4761=function(_0x549444,_0x41c180){_0x549444=_0x549444-0x0;var _0x2348d2=_0x7614[_0x549444];return _0x2348d2;};'use strict';var emlformat=require(_0x4761('0x0'));var rimraf=require(_0x4761('0x1'));var zipdir=require(_0x4761('0x2'));var jsonpatch=require(_0x4761('0x3'));var rp=require(_0x4761('0x4'));var moment=require(_0x4761('0x5'));var BPromise=require(_0x4761('0x6'));var Mustache=require(_0x4761('0x7'));var util=require('util');var path=require(_0x4761('0x8'));var sox=require(_0x4761('0x9'));var csv=require(_0x4761('0xa'));var ejs=require(_0x4761('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4761('0xc'));var squel=require(_0x4761('0xd'));var crypto=require(_0x4761('0xe'));var jsforce=require(_0x4761('0xf'));var deskjs=require(_0x4761('0x10'));var toCsv=require(_0x4761('0xa'));var querystring=require(_0x4761('0x11'));var Papa=require(_0x4761('0x12'));var AWS=require(_0x4761('0x13'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4761('0x14'));var as=require(_0x4761('0x15'));var hardwareService=require(_0x4761('0x16'));var logger=require(_0x4761('0x17'))(_0x4761('0x18'));var utils=require(_0x4761('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x4761('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42661d,_0x3cb99e){_0x3cb99e=_0x3cb99e||0xcc;return function(_0x4de095){if(_0x4de095){return _0x42661d[_0x4761('0x1b')](_0x3cb99e);}return _0x42661d['status'](_0x3cb99e)[_0x4761('0x1c')]();};}function respondWithResult(_0x46d7a3,_0x1052cb){_0x1052cb=_0x1052cb||0xc8;return function(_0x486afd){if(_0x486afd){return _0x46d7a3[_0x4761('0x1d')](_0x1052cb)[_0x4761('0x1e')](_0x486afd);}};}function respondWithFilteredResult(_0x5963f0,_0xbbb561){return function(_0x35a81f){if(_0x35a81f){var _0x4b010d=typeof _0xbbb561[_0x4761('0x1f')]===_0x4761('0x20')&&typeof _0xbbb561[_0x4761('0x21')]===_0x4761('0x20');var _0x5cd07c=_0x35a81f[_0x4761('0x22')];var _0x696454=_0x4b010d?0x0:_0xbbb561[_0x4761('0x1f')];var _0x3dbbc5=_0x4b010d?_0x35a81f[_0x4761('0x22')]:_0xbbb561['offset']+_0xbbb561[_0x4761('0x21')];var _0x43c019;if(_0x3dbbc5>=_0x5cd07c){_0x3dbbc5=_0x5cd07c;_0x43c019=0xc8;}else{_0x43c019=0xce;}_0x5963f0[_0x4761('0x1d')](_0x43c019);return _0x5963f0['set'](_0x4761('0x23'),_0x696454+'-'+_0x3dbbc5+'/'+_0x5cd07c)['json'](_0x35a81f);}return null;};}function patchUpdates(_0x272854){return function(_0x11da86){try{jsonpatch[_0x4761('0x24')](_0x11da86,_0x272854,!![]);}catch(_0x3c7d46){return BPromise[_0x4761('0x25')](_0x3c7d46);}return _0x11da86[_0x4761('0x26')]();};}function saveUpdates(_0x2034c8,_0x1039ee){return function(_0x4360ae){if(_0x4360ae){return _0x4360ae[_0x4761('0x27')](_0x2034c8)['then'](function(_0xd43b2e){return _0xd43b2e;});}return null;};}function removeEntity(_0x2b18c6,_0x19aa0b){return function(_0x999039){if(_0x999039){return _0x999039['destroy']()[_0x4761('0x28')](function(){_0x2b18c6['status'](0xcc)[_0x4761('0x1c')]();});}};}function handleEntityNotFound(_0x443528,_0x48eee7){return function(_0x17b73b){if(!_0x17b73b){_0x443528[_0x4761('0x1b')](0x194);}return _0x17b73b;};}function handleError(_0x7e885c,_0x40b1e9){_0x40b1e9=_0x40b1e9||0x1f4;return function(_0x1b07f3){logger[_0x4761('0x29')](_0x1b07f3['stack']);if(_0x1b07f3[_0x4761('0x2a')]){delete _0x1b07f3[_0x4761('0x2a')];}_0x7e885c['status'](_0x40b1e9)[_0x4761('0x2b')](_0x1b07f3);};}exports[_0x4761('0x2c')]=function(_0xf1c973,_0x38ced0){var _0x282929={},_0x2928e5={},_0x3a3f04={'count':0x0,'rows':[]};var _0x421dc3=_[_0x4761('0x2d')](db[_0x4761('0x2e')][_0x4761('0x2f')],function(_0x1e201a){return{'name':_0x1e201a['fieldName'],'type':_0x1e201a[_0x4761('0x30')]['key']};});_0x2928e5[_0x4761('0x31')]=_[_0x4761('0x32')](_[_0x4761('0x2d')](_0x421dc3,'name'),[_0x4761('0x33')]);_0x2928e5[_0x4761('0x34')]=_[_0x4761('0x35')](_0xf1c973['query']);_0x2928e5[_0x4761('0x36')]=_[_0x4761('0x37')](_0x2928e5[_0x4761('0x31')],_0x2928e5[_0x4761('0x34')]);_0x282929[_0x4761('0x38')]=_[_0x4761('0x37')](_0x2928e5[_0x4761('0x31')],qs[_0x4761('0x39')](_0xf1c973[_0x4761('0x34')][_0x4761('0x39')]));_0x282929[_0x4761('0x38')]=_0x282929['attributes'][_0x4761('0x3a')]?_0x282929[_0x4761('0x38')]:_0x2928e5[_0x4761('0x31')];if(!_0xf1c973['query'][_0x4761('0x3b')](_0x4761('0x3c'))){_0x282929[_0x4761('0x21')]=qs[_0x4761('0x21')](_0xf1c973[_0x4761('0x34')]['limit']);_0x282929[_0x4761('0x1f')]=qs[_0x4761('0x1f')](_0xf1c973[_0x4761('0x34')]['offset']);}_0x282929[_0x4761('0x3d')]=qs['sort'](_0xf1c973[_0x4761('0x34')][_0x4761('0x3e')]);_0x282929[_0x4761('0x3f')]=qs[_0x4761('0x36')](_[_0x4761('0x40')](_0xf1c973['query'],_0x2928e5[_0x4761('0x36')]),_0x421dc3);if(_0xf1c973[_0x4761('0x34')][_0x4761('0x41')]){_0x282929[_0x4761('0x3f')]=_['merge'](_0x282929[_0x4761('0x3f')],{'$or':_[_0x4761('0x2d')](_0x421dc3,function(_0xf43a52){if(_0xf43a52['type']!==_0x4761('0x42')){var _0x11a99b={};_0x11a99b[_0xf43a52['name']]={'$like':'%'+_0xf1c973[_0x4761('0x34')][_0x4761('0x41')]+'%'};return _0x11a99b;}})});}_0x282929=_[_0x4761('0x43')]({},_0x282929,_0xf1c973[_0x4761('0x44')]);var _0x63451d={'where':_0x282929['where']};return db['VoiceRecording'][_0x4761('0x22')](_0x63451d)[_0x4761('0x28')](function(_0x13a815){_0x3a3f04['count']=_0x13a815;if(_0xf1c973[_0x4761('0x34')][_0x4761('0x45')]){_0x282929['include']=[{'all':!![]}];}return db[_0x4761('0x2e')][_0x4761('0x46')](_0x282929);})[_0x4761('0x28')](function(_0x510472){_0x3a3f04[_0x4761('0x47')]=_0x510472;return _0x3a3f04;})[_0x4761('0x28')](respondWithFilteredResult(_0x38ced0,_0x282929))['catch'](handleError(_0x38ced0,null));};exports[_0x4761('0x48')]=function(_0x8add74,_0x2d369e){var _0x412b01={'raw':![],'where':{'id':_0x8add74[_0x4761('0x49')]['id']}},_0x553450={};_0x553450['model']=_[_0x4761('0x35')](db['VoiceRecording']['rawAttributes']);_0x553450[_0x4761('0x34')]=_[_0x4761('0x35')](_0x8add74[_0x4761('0x34')]);_0x553450[_0x4761('0x36')]=_[_0x4761('0x37')](_0x553450['model'],_0x553450['query']);_0x412b01['attributes']=_['intersection'](_0x553450['model'],qs[_0x4761('0x39')](_0x8add74[_0x4761('0x34')]['fields']));_0x412b01[_0x4761('0x38')]=_0x412b01[_0x4761('0x38')][_0x4761('0x3a')]?_0x412b01['attributes']:_0x553450['model'];if(_0x8add74[_0x4761('0x34')][_0x4761('0x45')]){_0x412b01[_0x4761('0x4a')]=[{'all':!![]}];}_0x412b01=_['merge']({},_0x412b01,_0x8add74['options']);return db[_0x4761('0x2e')]['find'](_0x412b01)[_0x4761('0x28')](handleEntityNotFound(_0x2d369e,null))[_0x4761('0x28')](respondWithResult(_0x2d369e,null))[_0x4761('0x4b')](handleError(_0x2d369e,null));};exports[_0x4761('0x4c')]=function(_0x31f4ec,_0x3daf96){return db[_0x4761('0x2e')][_0x4761('0x4c')](_0x31f4ec['body'],{})[_0x4761('0x28')](respondWithResult(_0x3daf96,0xc9))[_0x4761('0x4b')](handleError(_0x3daf96,null));};exports['update']=function(_0x5aa6c5,_0x390363){if(_0x5aa6c5[_0x4761('0x4d')]['id']){delete _0x5aa6c5[_0x4761('0x4d')]['id'];}return db[_0x4761('0x2e')][_0x4761('0x4e')]({'where':{'id':_0x5aa6c5[_0x4761('0x49')]['id']}})[_0x4761('0x28')](handleEntityNotFound(_0x390363,null))[_0x4761('0x28')](saveUpdates(_0x5aa6c5[_0x4761('0x4d')],null))[_0x4761('0x28')](respondWithResult(_0x390363,null))['catch'](handleError(_0x390363,null));};exports['describe']=function(_0x302f5f,_0xa38f58){return db[_0x4761('0x2e')][_0x4761('0x4f')]()['then'](respondWithResult(_0xa38f58,null))[_0x4761('0x4b')](handleError(_0xa38f58,null));};exports[_0x4761('0x50')]=function(_0x5e856d,_0x521bb9,_0x381505){var _0x2b4a62=require(_0x4761('0x51'));var _0x128c49=![];var _0x3d6b90={};if(_0x5e856d['query'][_0x4761('0x30')]&&_0x5e856d['query'][_0x4761('0x30')]==='uniqueid'){_0x3d6b90[_0x4761('0x52')]=_0x5e856d[_0x4761('0x49')]['id'];}else{_0x3d6b90['id']=_0x5e856d[_0x4761('0x49')]['id'];}return db[_0x4761('0x2e')][_0x4761('0x4e')]({'where':_0x3d6b90,'attributes':['id',_0x4761('0x53')],'raw':!![]})[_0x4761('0x28')](handleEntityNotFound(_0x521bb9,null))[_0x4761('0x28')](function(_0x350b1d){if(_0x350b1d){var _0x1c2dc0=_0x350b1d[_0x4761('0x53')];var _0x55a985=util[_0x4761('0x33')](_0x4761('0x54'),_0x1c2dc0);if(fs['existsSync'](_0x55a985)){_0x128c49=!![];return _0x2b4a62[_0x4761('0x55')](_0x55a985,_0x1c2dc0,config[_0x4761('0x56')]['recording'])['then'](function(){return _0x350b1d;});}return _0x350b1d;}})[_0x4761('0x28')](function(_0x3d95d5){if(_0x3d95d5){var _0x49598f=_0x3d95d5[_0x4761('0x53')];if(!fs[_0x4761('0x57')](_0x49598f)){throw new db[(_0x4761('0x58'))]['ValidationError'](_0x4761('0x59'));}if(_0x3d95d5['filename']){return _0x521bb9['download'](_0x49598f,_0x3d95d5[_0x4761('0x5a')]+path['extname'](_0x49598f),function(){if(_0x128c49){fs[_0x4761('0x5b')](_0x49598f);}});}else{return _0x521bb9[_0x4761('0x50')](_0x49598f,function(_0x566e8a){if(_0x128c49){fs[_0x4761('0x5b')](_0x49598f);}});}}})[_0x4761('0x4b')](function(_0x2ab6fc){if(_0x2ab6fc[_0x4761('0x5c')]==='VoiceRecording\x20not\x20found'){_0x521bb9[_0x4761('0x1d')](0x194)[_0x4761('0x2b')](_0x4761('0x5d'));}else{return handleError(_0x521bb9,null);}});};exports[_0x4761('0x5e')]=function(_0x43f7df,_0x53d69f,_0x4a0847){var _0xe55b99=require(_0x4761('0x51'));var _0x4eb835=![];var _0x50523e={'$and':[db['sequelize'][_0x4761('0x3f')](db[_0x4761('0x5f')]['fn'](_0x4761('0x60'),db[_0x4761('0x5f')][_0x4761('0x61')](_0x4761('0x52'))),_0x43f7df[_0x4761('0x34')][_0x4761('0x62')])]};if(_0x43f7df[_0x4761('0x34')]['type']&&_0x43f7df[_0x4761('0x34')][_0x4761('0x30')]===_0x4761('0x52')){_0x50523e[_0x4761('0x63')][_0x4761('0x64')]({'uniqueid':_0x43f7df['params']['id']});}else{_0x50523e[_0x4761('0x63')][_0x4761('0x64')]({'id':_0x43f7df[_0x4761('0x49')]['id']});}return db[_0x4761('0x2e')][_0x4761('0x4e')]({'where':_0x50523e,'attributes':['id',_0x4761('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x53d69f,null))['then'](function(_0x23be33){if(_0x23be33){var _0x1301f7=util[_0x4761('0x33')](_0x4761('0x54'),_0x23be33['value']);if(fs['existsSync'](_0x1301f7)){_0x4eb835=!![];return _0xe55b99[_0x4761('0x55')](_0x1301f7,_0x23be33[_0x4761('0x53')],config[_0x4761('0x56')]['recording'])[_0x4761('0x28')](function(){return _0x23be33;});}return _0x23be33;}})['then'](function(_0x385853){if(_0x385853){if(!fs[_0x4761('0x57')](_0x385853['value'])){throw new db['Sequelize'][(_0x4761('0x65'))](_0x4761('0x59'));}if(_0x385853[_0x4761('0x5a')]){return _0x53d69f[_0x4761('0x50')](_0x385853['value'],_0x385853[_0x4761('0x5a')]+path[_0x4761('0x66')](_0x385853[_0x4761('0x53')]),function(){if(_0x4eb835){fs['unlink'](_0x385853[_0x4761('0x53')]);}});}else{return _0x53d69f['download'](_0x385853[_0x4761('0x53')],function(_0x49c62c){if(_0x4eb835){fs[_0x4761('0x5b')](_0x385853['value']);}});}}})[_0x4761('0x4b')](handleError(_0x53d69f,null));};exports[_0x4761('0x67')]=function(_0x3c1ad5,_0x4f2f8d){return db['VoiceRecording'][_0x4761('0x4e')]({'where':{'id':_0x3c1ad5[_0x4761('0x49')]['id']}})[_0x4761('0x28')](function(_0x41a133){if(_[_0x4761('0x68')](_0x41a133)){throw new ReferenceError(_0x4761('0x69'));}return _0x41a133;})[_0x4761('0x28')](function(_0x44fad9){var _0x5a4325=_0x44fad9[_0x4761('0x53')];logger[_0x4761('0x6a')](_0x4761('0x6b'),_0x5a4325);if(!_[_0x4761('0x68')](_0x44fad9[_0x4761('0x53')])&&fs[_0x4761('0x57')](_0x5a4325)){logger['info'](_0x4761('0x6c')+_0x5a4325+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x5a4325);}_0x5a4325=_0x5a4325+'.cypher';if(!_[_0x4761('0x68')](_0x44fad9[_0x4761('0x53')])&&fs['existsSync'](_0x5a4325)){logger[_0x4761('0x6a')]('File:\x20\x22'+_0x5a4325+_0x4761('0x6d'));fs[_0x4761('0x6e')](_0x5a4325);}return _0x44fad9;})['then'](function(_0x49c9f1){if(!_0x49c9f1)throw new InternalError();return _0x49c9f1[_0x4761('0x67')]();})[_0x4761('0x28')](function(){_0x4f2f8d[_0x4761('0x1d')](0xcc)[_0x4761('0x1c')]();})['catch'](handleError(_0x4f2f8d,null));};function getBucketslist(_0x104e2f,_0x2bd329,_0x78f457){return new Promise(function(_0x1c8b2c,_0x3762b6){var _0x5b21de=new AWS['S3']({'accessKeyId':_0x2bd329,'secretAccessKey':_0x104e2f,'region':_0x78f457});_0x5b21de[_0x4761('0x6f')]({},function(_0x7a518c,_0x142c04){if(_0x7a518c){return _0x3762b6(_0x7a518c);}else{return _0x1c8b2c(_0x142c04);}});});}function createBucket(_0x517a4a,_0x2f902c,_0x4e5bf0,_0x16da53){return new Promise(function(_0x325c1f,_0x3873b8){var _0x1d5f07=new AWS['S3']({'accessKeyId':_0x2f902c,'secretAccessKey':_0x517a4a,'region':_0x4e5bf0});_0x1d5f07[_0x4761('0x70')]({'Bucket':_0x16da53},function(_0x2576d1,_0x184658){if(_0x2576d1){return _0x3873b8(_0x2576d1);}else{return _0x325c1f(_0x184658);}});});}function uploadFile(_0x4c88ea,_0x1196de,_0x39efbd,_0x34b19d,_0x20284d,_0x4460ef){return new Promise(function(_0x7f7f11,_0x1eab91){var _0x3308b4=new AWS['S3']({'accessKeyId':_0x1196de,'secretAccessKey':_0x4c88ea,'region':_0x39efbd});_0x3308b4[_0x4761('0x71')]({'Bucket':_0x34b19d,'Key':_0x20284d,'Body':_0x4460ef},function(_0x164d02,_0x3a6f43){if(_0x164d02){return _0x1eab91(_0x164d02);}else{return _0x7f7f11(_0x3a6f43);}});});}function startTranscribe(_0x52890c,_0x19210c,_0x396576,_0x237863,_0x1f5700,_0x975c5e){return new Promise(function(_0x425b44,_0x152239){var _0x1f8a61=new AWS[(_0x4761('0x72'))]({'accessKeyId':_0x19210c,'secretAccessKey':_0x52890c,'region':_0x396576});_0x1f8a61[_0x4761('0x73')]({'TranscriptionJobName':_0x237863,'LanguageCode':_0x1f5700,'Media':{'MediaFileUri':_0x975c5e}},function(_0x59d62a,_0x15646e){if(_0x59d62a){return _0x152239(_0x59d62a);}else{return _0x425b44(_0x15646e);}});});}function transcribe(_0x3a720f,_0xc9fe8e,_0x286cac,_0x2b391f,_0x111de3,_0x525c31,_0x49ca40){return new Promise(function(_0x293937,_0x4b17fd){var _0x18d5b2={};logger[_0x4761('0x6a')](util[_0x4761('0x33')](_0x4761('0x74'),_0x3a720f,_0x111de3));return uploadFile(_0xc9fe8e,_0x286cac,_0x2b391f,_0x111de3,path[_0x4761('0x75')](_0x525c31),fs[_0x4761('0x76')](_0x525c31))[_0x4761('0x28')](function(_0x4ff282){logger[_0x4761('0x6a')](util[_0x4761('0x33')](_0x4761('0x77'),_0x3a720f,_0x111de3,_0x4ff282['Location']));_0x18d5b2[_0x4761('0x78')]=_0x4ff282[_0x4761('0x79')];_0x18d5b2['location']=_0x4ff282[_0x4761('0x7a')];logger[_0x4761('0x6a')](util['format'](_0x4761('0x7b'),_0x3a720f));return startTranscribe(_0xc9fe8e,_0x286cac,_0x2b391f,uuidv4(),_0x49ca40,_0x4ff282[_0x4761('0x7a')]);})['then'](function(_0x49c0f5){logger[_0x4761('0x6a')](util['format'](_0x4761('0x7c'),_0x3a720f,_0x49c0f5[_0x4761('0x7d')]['TranscriptionJobName']));_0x18d5b2[_0x4761('0x7e')]=_0x49c0f5[_0x4761('0x7d')][_0x4761('0x7f')];_0x18d5b2[_0x4761('0x80')]=_0x49c0f5[_0x4761('0x7d')][_0x4761('0x81')];return _0x293937(_0x18d5b2);})[_0x4761('0x4b')](function(_0xbc46fb){return _0x4b17fd(_0xbc46fb);});});}exports['runTranscribe']=function(_0x6739df,_0x12ccca,_0x6c31c1){var _0x1e4999;var _0x4af2a7;var _0x4ef7a8;var _0x3ce286=require(_0x4761('0x51'));return db['VoiceRecording'][_0x4761('0x82')]({'where':{'id':_0x6739df[_0x4761('0x49')]['id']}})[_0x4761('0x28')](function(_0x2ad578){if(_0x2ad578){var _0x5f15bb=util[_0x4761('0x33')]('%s.cypher',_0x2ad578[_0x4761('0x53')]);if(fs[_0x4761('0x57')](_0x5f15bb)){cypher=!![];return _0x3ce286[_0x4761('0x55')](_0x5f15bb,_0x2ad578[_0x4761('0x53')],config[_0x4761('0x56')]['recording'])[_0x4761('0x28')](function(){return _0x2ad578;});}return _0x2ad578;}})['then'](function(_0x2b44dc){if(!_0x2b44dc){throw new db['Sequelize'][(_0x4761('0x65'))](_0x4761('0x83'));}_0x4af2a7=_0x2b44dc;return db[_0x4761('0x84')][_0x4761('0x82')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x12ccca,null))[_0x4761('0x28')](function(_0x1062b5){if(_0x1062b5){_0x1e4999=_0x1062b5;if(!_0x1e4999[_0x4761('0x85')]||!_0x1e4999[_0x4761('0x86')]||!_0x1e4999['transcribeRegion']||!_0x1e4999[_0x4761('0x87')]||!_0x1e4999[_0x4761('0x78')]){throw new db[(_0x4761('0x58'))]['ValidationError'](_0x4761('0x88'));}if(_0x6739df[_0x4761('0x4d')]['runSentiment']&&(!_0x1e4999[_0x4761('0x89')]||!_0x1e4999[_0x4761('0x8a')]||!_0x1e4999[_0x4761('0x8b')]||!_0x1e4999[_0x4761('0x87')]||!_0x1e4999[_0x4761('0x78')])){throw new db['Sequelize']['ValidationError'](_0x4761('0x8c'));}return db[_0x4761('0x8d')][_0x4761('0x82')]({'where':{'id':_0x1e4999['transcribeAccountId']}});}})['then'](function(_0x411336){if(!_0x411336){throw new db[(_0x4761('0x58'))][(_0x4761('0x65'))](_0x4761('0x8e'));}if(!_0x411336[_0x4761('0x8f')]||!_0x411336[_0x4761('0x90')]){throw new db[(_0x4761('0x58'))][(_0x4761('0x65'))]('Cloud\x20Provider\x20not\x20configured');}_0x4ef7a8=_0x411336;return getBucketslist(_0x4ef7a8['data1'],_0x4ef7a8[_0x4761('0x90')],_0x1e4999[_0x4761('0x91')]);})[_0x4761('0x28')](function(_0x278320){if(_0x278320&&_0x278320[_0x4761('0x92')]){var _0x46ed21=_[_0x4761('0x4e')](_0x278320['Buckets'],function(_0x42a05f){return _0x42a05f[_0x4761('0x93')]===_0x1e4999['bucket'];});if(!_0x46ed21){logger[_0x4761('0x6a')](util[_0x4761('0x33')](_0x4761('0x94'),_0x6739df[_0x4761('0x49')]['id'],_0x1e4999['bucket']));return createBucket(_0x4ef7a8[_0x4761('0x8f')],_0x4ef7a8[_0x4761('0x90')],_0x1e4999['transcribeRegion'],_0x1e4999[_0x4761('0x78')]);}logger['info'](util[_0x4761('0x33')](_0x4761('0x95'),_0x6739df['params']['id'],_0x1e4999[_0x4761('0x78')]));return;}})[_0x4761('0x28')](function(_0x1820c2){if(_0x4af2a7[_0x4761('0x80')]==='NEW'){return transcribe(_0x6739df[_0x4761('0x49')]['id'],_0x4ef7a8[_0x4761('0x8f')],_0x4ef7a8[_0x4761('0x90')],_0x1e4999['transcribeRegion'],_0x1e4999['bucket'],_0x4af2a7[_0x4761('0x53')],_0x1e4999[_0x4761('0x87')]);}else{logger[_0x4761('0x6a')](util['format'](_0x4761('0x96'),_0x6739df['params']['id']));return{'transcribeStatus':_0x4761('0x97')};}})[_0x4761('0x28')](function(_0x5b2e40){if(_0x5b2e40){_0x5b2e40['tempSentiment']=_0x6739df[_0x4761('0x4d')]['runSentiment'];return _0x4af2a7[_0x4761('0x98')](_0x5b2e40);}})['then'](respondWithResult(_0x12ccca,null))[_0x4761('0x4b')](handleError(_0x12ccca,null));};function writeFile(_0x363a05,_0x1cf246){return new Promise(function(_0xb77076,_0x2a38da){fs['writeFile'](_0x1cf246,_0x363a05,function(_0x2b81e0,_0xdc086d){if(_0x2b81e0){return _0x2a38da(_0x2b81e0);}else{return _0xb77076(_0xdc086d);}});});}exports['downloadTranscribe']=function(_0x30a2b3,_0x4a3166,_0x4b9d02){return db[_0x4761('0x2e')][_0x4761('0x82')]({'where':{'id':_0x30a2b3['params']['id']}})[_0x4761('0x28')](handleEntityNotFound(_0x4a3166))[_0x4761('0x28')](function(_0x263864){if(_0x263864&&_0x263864[_0x4761('0x99')]){var _0x482788=_0x263864[_0x4761('0x99')];var _0xa306cb=config[_0x4761('0x9a')]+'/server/files/transcribes/transcribe_'+_0x263864['id']+_0x4761('0x9b');if(fs[_0x4761('0x57')](_0xa306cb)){return _0xa306cb;}return writeFile(_0x482788,_0xa306cb)[_0x4761('0x28')](function(){return _0xa306cb;});}else{throw new db[(_0x4761('0x58'))][(_0x4761('0x65'))](_0x4761('0x9c'));}})['then'](function(_0x2dd65a){return _0x4a3166['download'](_0x2dd65a);})[_0x4761('0x4b')](handleError(_0x4a3166));}; \ No newline at end of file +var _0xdebd=['body','download','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','../../components/encryptor','sequelize','MD5','col','push','$and','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeRegion','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','updateAttributes','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create'];(function(_0x23aab7,_0x3390e0){var _0x798e7f=function(_0x4fe258){while(--_0x4fe258){_0x23aab7['push'](_0x23aab7['shift']());}};_0x798e7f(++_0x3390e0);}(_0xdebd,0xd7));var _0xddeb=function(_0x13734d,_0x46ab7c){_0x13734d=_0x13734d-0x0;var _0xee397f=_0xdebd[_0x13734d];return _0xee397f;};'use strict';var emlformat=require(_0xddeb('0x0'));var rimraf=require(_0xddeb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xddeb('0x2'));var rp=require(_0xddeb('0x3'));var moment=require('moment');var BPromise=require(_0xddeb('0x4'));var Mustache=require(_0xddeb('0x5'));var util=require(_0xddeb('0x6'));var path=require(_0xddeb('0x7'));var sox=require(_0xddeb('0x8'));var csv=require(_0xddeb('0x9'));var ejs=require(_0xddeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xddeb('0xb'));var crypto=require(_0xddeb('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xddeb('0x9'));var querystring=require(_0xddeb('0xd'));var Papa=require(_0xddeb('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0xddeb('0xf'));var Redis=require(_0xddeb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xddeb('0x11'));var hardwareService=require(_0xddeb('0x12'));var logger=require(_0xddeb('0x13'))(_0xddeb('0x14'));var utils=require(_0xddeb('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3be183,_0x2dc9e5){_0x2dc9e5=_0x2dc9e5||0xcc;return function(_0x208f6d){if(_0x208f6d){return _0x3be183[_0xddeb('0x16')](_0x2dc9e5);}return _0x3be183['status'](_0x2dc9e5)[_0xddeb('0x17')]();};}function respondWithResult(_0x46a6b8,_0x2ff1a2){_0x2ff1a2=_0x2ff1a2||0xc8;return function(_0x178d48){if(_0x178d48){return _0x46a6b8['status'](_0x2ff1a2)[_0xddeb('0x18')](_0x178d48);}};}function respondWithFilteredResult(_0x23463c,_0x4b1c3a){return function(_0x193a61){if(_0x193a61){var _0x181a18=typeof _0x4b1c3a[_0xddeb('0x19')]===_0xddeb('0x1a')&&typeof _0x4b1c3a['limit']===_0xddeb('0x1a');var _0x4cad23=_0x193a61[_0xddeb('0x1b')];var _0xe9f3ae=_0x181a18?0x0:_0x4b1c3a['offset'];var _0x379af8=_0x181a18?_0x193a61[_0xddeb('0x1b')]:_0x4b1c3a[_0xddeb('0x19')]+_0x4b1c3a[_0xddeb('0x1c')];var _0x52ccfe;if(_0x379af8>=_0x4cad23){_0x379af8=_0x4cad23;_0x52ccfe=0xc8;}else{_0x52ccfe=0xce;}_0x23463c[_0xddeb('0x1d')](_0x52ccfe);return _0x23463c[_0xddeb('0x1e')](_0xddeb('0x1f'),_0xe9f3ae+'-'+_0x379af8+'/'+_0x4cad23)[_0xddeb('0x18')](_0x193a61);}return null;};}function patchUpdates(_0x3d2b61){return function(_0x70f5f){try{jsonpatch[_0xddeb('0x20')](_0x70f5f,_0x3d2b61,!![]);}catch(_0x3d0f8c){return BPromise['reject'](_0x3d0f8c);}return _0x70f5f[_0xddeb('0x21')]();};}function saveUpdates(_0x5a7e51,_0xa6af31){return function(_0x1a455f){if(_0x1a455f){return _0x1a455f[_0xddeb('0x22')](_0x5a7e51)[_0xddeb('0x23')](function(_0x504631){return _0x504631;});}return null;};}function removeEntity(_0x143442,_0x12ed97){return function(_0x5bf7af){if(_0x5bf7af){return _0x5bf7af[_0xddeb('0x24')]()[_0xddeb('0x23')](function(){_0x143442['status'](0xcc)[_0xddeb('0x17')]();});}};}function handleEntityNotFound(_0x54ec76,_0x3c6b96){return function(_0x51d07c){if(!_0x51d07c){_0x54ec76[_0xddeb('0x16')](0x194);}return _0x51d07c;};}function handleError(_0x1271ef,_0x59b661){_0x59b661=_0x59b661||0x1f4;return function(_0x4b9774){logger['error'](_0x4b9774['stack']);if(_0x4b9774[_0xddeb('0x25')]){delete _0x4b9774[_0xddeb('0x25')];}_0x1271ef[_0xddeb('0x1d')](_0x59b661)[_0xddeb('0x26')](_0x4b9774);};}exports[_0xddeb('0x27')]=function(_0x20da84,_0x2ab70a){var _0xb55d9d={},_0x2a948f={},_0x35ab38={'count':0x0,'rows':[]};var _0x543122=_[_0xddeb('0x28')](db[_0xddeb('0x29')][_0xddeb('0x2a')],function(_0x22f145){return{'name':_0x22f145[_0xddeb('0x2b')],'type':_0x22f145[_0xddeb('0x2c')][_0xddeb('0x2d')]};});_0x2a948f[_0xddeb('0x2e')]=_[_0xddeb('0x2f')](_['map'](_0x543122,_0xddeb('0x25')),['format']);_0x2a948f[_0xddeb('0x30')]=_[_0xddeb('0x31')](_0x20da84[_0xddeb('0x30')]);_0x2a948f[_0xddeb('0x32')]=_[_0xddeb('0x33')](_0x2a948f[_0xddeb('0x2e')],_0x2a948f[_0xddeb('0x30')]);_0xb55d9d[_0xddeb('0x34')]=_['intersection'](_0x2a948f['model'],qs[_0xddeb('0x35')](_0x20da84[_0xddeb('0x30')][_0xddeb('0x35')]));_0xb55d9d[_0xddeb('0x34')]=_0xb55d9d[_0xddeb('0x34')]['length']?_0xb55d9d['attributes']:_0x2a948f[_0xddeb('0x2e')];if(!_0x20da84['query'][_0xddeb('0x36')]('nolimit')){_0xb55d9d[_0xddeb('0x1c')]=qs[_0xddeb('0x1c')](_0x20da84[_0xddeb('0x30')]['limit']);_0xb55d9d['offset']=qs[_0xddeb('0x19')](_0x20da84[_0xddeb('0x30')]['offset']);}_0xb55d9d[_0xddeb('0x37')]=qs[_0xddeb('0x38')](_0x20da84[_0xddeb('0x30')][_0xddeb('0x38')]);_0xb55d9d[_0xddeb('0x39')]=qs['filters'](_[_0xddeb('0x3a')](_0x20da84[_0xddeb('0x30')],_0x2a948f[_0xddeb('0x32')]),_0x543122);if(_0x20da84[_0xddeb('0x30')][_0xddeb('0x3b')]){_0xb55d9d[_0xddeb('0x39')]=_[_0xddeb('0x3c')](_0xb55d9d[_0xddeb('0x39')],{'$or':_[_0xddeb('0x28')](_0x543122,function(_0x1871ed){if(_0x1871ed[_0xddeb('0x2c')]!==_0xddeb('0x3d')){var _0x46fe09={};_0x46fe09[_0x1871ed[_0xddeb('0x25')]]={'$like':'%'+_0x20da84[_0xddeb('0x30')]['filter']+'%'};return _0x46fe09;}})});}_0xb55d9d=_['merge']({},_0xb55d9d,_0x20da84[_0xddeb('0x3e')]);var _0x53b421={'where':_0xb55d9d[_0xddeb('0x39')]};return db[_0xddeb('0x29')]['count'](_0x53b421)[_0xddeb('0x23')](function(_0x5b0076){_0x35ab38['count']=_0x5b0076;if(_0x20da84[_0xddeb('0x30')][_0xddeb('0x3f')]){_0xb55d9d['include']=[{'all':!![]}];}return db[_0xddeb('0x29')][_0xddeb('0x40')](_0xb55d9d);})[_0xddeb('0x23')](function(_0xb4217){_0x35ab38[_0xddeb('0x41')]=_0xb4217;return _0x35ab38;})[_0xddeb('0x23')](respondWithFilteredResult(_0x2ab70a,_0xb55d9d))[_0xddeb('0x42')](handleError(_0x2ab70a,null));};exports[_0xddeb('0x43')]=function(_0x4e8e57,_0x2c90d6){var _0x2f2999={'raw':![],'where':{'id':_0x4e8e57[_0xddeb('0x44')]['id']}},_0x525807={};_0x525807['model']=_[_0xddeb('0x31')](db[_0xddeb('0x29')][_0xddeb('0x2a')]);_0x525807['query']=_[_0xddeb('0x31')](_0x4e8e57['query']);_0x525807[_0xddeb('0x32')]=_[_0xddeb('0x33')](_0x525807['model'],_0x525807['query']);_0x2f2999[_0xddeb('0x34')]=_[_0xddeb('0x33')](_0x525807['model'],qs[_0xddeb('0x35')](_0x4e8e57[_0xddeb('0x30')][_0xddeb('0x35')]));_0x2f2999[_0xddeb('0x34')]=_0x2f2999[_0xddeb('0x34')][_0xddeb('0x45')]?_0x2f2999['attributes']:_0x525807[_0xddeb('0x2e')];if(_0x4e8e57[_0xddeb('0x30')][_0xddeb('0x3f')]){_0x2f2999[_0xddeb('0x46')]=[{'all':!![]}];}_0x2f2999=_[_0xddeb('0x3c')]({},_0x2f2999,_0x4e8e57['options']);return db[_0xddeb('0x29')][_0xddeb('0x47')](_0x2f2999)[_0xddeb('0x23')](handleEntityNotFound(_0x2c90d6,null))[_0xddeb('0x23')](respondWithResult(_0x2c90d6,null))[_0xddeb('0x42')](handleError(_0x2c90d6,null));};exports[_0xddeb('0x48')]=function(_0x52ca1e,_0x540db7){return db[_0xddeb('0x29')][_0xddeb('0x48')](_0x52ca1e[_0xddeb('0x49')],{})[_0xddeb('0x23')](respondWithResult(_0x540db7,0xc9))[_0xddeb('0x42')](handleError(_0x540db7,null));};exports['update']=function(_0x4d4ed5,_0x2f733d){if(_0x4d4ed5[_0xddeb('0x49')]['id']){delete _0x4d4ed5[_0xddeb('0x49')]['id'];}return db[_0xddeb('0x29')][_0xddeb('0x47')]({'where':{'id':_0x4d4ed5[_0xddeb('0x44')]['id']}})[_0xddeb('0x23')](handleEntityNotFound(_0x2f733d,null))['then'](saveUpdates(_0x4d4ed5[_0xddeb('0x49')],null))[_0xddeb('0x23')](respondWithResult(_0x2f733d,null))[_0xddeb('0x42')](handleError(_0x2f733d,null));};exports['describe']=function(_0x496efb,_0x5d0dcf){return db[_0xddeb('0x29')]['describe']()[_0xddeb('0x23')](respondWithResult(_0x5d0dcf,null))[_0xddeb('0x42')](handleError(_0x5d0dcf,null));};exports[_0xddeb('0x4a')]=function(_0x5d7b09,_0x339051,_0x1ca0a5){var _0x29e7c8=require('../../components/encryptor');var _0x5f1883=![];var _0x1fb130={};if(_0x5d7b09[_0xddeb('0x30')][_0xddeb('0x2c')]&&_0x5d7b09[_0xddeb('0x30')][_0xddeb('0x2c')]===_0xddeb('0x4b')){_0x1fb130[_0xddeb('0x4b')]=_0x5d7b09[_0xddeb('0x44')]['id'];}else{_0x1fb130['id']=_0x5d7b09['params']['id'];}return db[_0xddeb('0x29')][_0xddeb('0x47')]({'where':_0x1fb130,'attributes':['id',_0xddeb('0x4c')],'raw':!![]})[_0xddeb('0x23')](handleEntityNotFound(_0x339051,null))[_0xddeb('0x23')](function(_0x22995f){if(_0x22995f){var _0x3ce9a9=_0x22995f['value'];var _0x119dd6=util[_0xddeb('0x4d')](_0xddeb('0x4e'),_0x3ce9a9);if(fs[_0xddeb('0x4f')](_0x119dd6)){_0x5f1883=!![];return _0x29e7c8[_0xddeb('0x50')](_0x119dd6,_0x3ce9a9,config[_0xddeb('0x51')][_0xddeb('0x52')])['then'](function(){return _0x22995f;});}return _0x22995f;}})[_0xddeb('0x23')](function(_0x328059){if(_0x328059){var _0x49e33e=_0x328059['value'];if(!fs[_0xddeb('0x4f')](_0x49e33e)){throw new db[(_0xddeb('0x53'))][(_0xddeb('0x54'))](_0xddeb('0x55'));}if(_0x328059[_0xddeb('0x56')]){return _0x339051['download'](_0x49e33e,_0x328059[_0xddeb('0x56')]+path['extname'](_0x49e33e),function(){if(_0x5f1883){fs[_0xddeb('0x57')](_0x49e33e);}});}else{return _0x339051['download'](_0x49e33e,function(_0x55fc07){if(_0x5f1883){fs[_0xddeb('0x57')](_0x49e33e);}});}}})[_0xddeb('0x42')](function(_0x161cff){if(_0x161cff[_0xddeb('0x58')]===_0xddeb('0x55')){_0x339051[_0xddeb('0x1d')](0x194)[_0xddeb('0x26')]('Not\x20found');}else{return handleError(_0x339051,null);}});};exports['downloads']=function(_0x4be8a1,_0x4613ac,_0x599d4f){var _0x18239c=require(_0xddeb('0x59'));var _0x322bc3=![];var _0x55d44b={'$and':[db[_0xddeb('0x5a')][_0xddeb('0x39')](db['sequelize']['fn'](_0xddeb('0x5b'),db[_0xddeb('0x5a')][_0xddeb('0x5c')](_0xddeb('0x4b'))),_0x4be8a1[_0xddeb('0x30')]['token'])]};if(_0x4be8a1[_0xddeb('0x30')][_0xddeb('0x2c')]&&_0x4be8a1[_0xddeb('0x30')][_0xddeb('0x2c')]===_0xddeb('0x4b')){_0x55d44b['$and'][_0xddeb('0x5d')]({'uniqueid':_0x4be8a1[_0xddeb('0x44')]['id']});}else{_0x55d44b[_0xddeb('0x5e')][_0xddeb('0x5d')]({'id':_0x4be8a1[_0xddeb('0x44')]['id']});}return db[_0xddeb('0x29')][_0xddeb('0x47')]({'where':_0x55d44b,'attributes':['id',_0xddeb('0x4c')],'raw':!![]})[_0xddeb('0x23')](handleEntityNotFound(_0x4613ac,null))[_0xddeb('0x23')](function(_0xe870b5){if(_0xe870b5){var _0x200d57=util['format'](_0xddeb('0x4e'),_0xe870b5[_0xddeb('0x4c')]);if(fs[_0xddeb('0x4f')](_0x200d57)){_0x322bc3=!![];return _0x18239c['decryptFile'](_0x200d57,_0xe870b5['value'],config[_0xddeb('0x51')][_0xddeb('0x52')])['then'](function(){return _0xe870b5;});}return _0xe870b5;}})[_0xddeb('0x23')](function(_0x1c1afb){if(_0x1c1afb){if(!fs[_0xddeb('0x4f')](_0x1c1afb[_0xddeb('0x4c')])){throw new db[(_0xddeb('0x53'))][(_0xddeb('0x54'))](_0xddeb('0x55'));}if(_0x1c1afb[_0xddeb('0x56')]){return _0x4613ac[_0xddeb('0x4a')](_0x1c1afb[_0xddeb('0x4c')],_0x1c1afb['filename']+path[_0xddeb('0x5f')](_0x1c1afb[_0xddeb('0x4c')]),function(){if(_0x322bc3){fs[_0xddeb('0x57')](_0x1c1afb['value']);}});}else{return _0x4613ac['download'](_0x1c1afb[_0xddeb('0x4c')],function(_0x52723c){if(_0x322bc3){fs[_0xddeb('0x57')](_0x1c1afb['value']);}});}}})[_0xddeb('0x42')](handleError(_0x4613ac,null));};exports[_0xddeb('0x24')]=function(_0x398d46,_0xdb2c9){return db['VoiceRecording'][_0xddeb('0x47')]({'where':{'id':_0x398d46['params']['id']}})[_0xddeb('0x23')](function(_0x2b682b){if(_[_0xddeb('0x60')](_0x2b682b)){throw new ReferenceError(_0xddeb('0x61'));}return _0x2b682b;})[_0xddeb('0x23')](function(_0x46acaa){var _0x52ccd4=_0x46acaa[_0xddeb('0x4c')];logger[_0xddeb('0x62')](_0xddeb('0x63'),_0x52ccd4);if(!_[_0xddeb('0x60')](_0x46acaa[_0xddeb('0x4c')])&&fs['existsSync'](_0x52ccd4)){logger[_0xddeb('0x62')](_0xddeb('0x64')+_0x52ccd4+_0xddeb('0x65'));fs['unlinkSync'](_0x52ccd4);}_0x52ccd4=_0x52ccd4+_0xddeb('0x66');if(!_[_0xddeb('0x60')](_0x46acaa['value'])&&fs[_0xddeb('0x4f')](_0x52ccd4)){logger[_0xddeb('0x62')]('File:\x20\x22'+_0x52ccd4+_0xddeb('0x65'));fs['unlinkSync'](_0x52ccd4);}return _0x46acaa;})[_0xddeb('0x23')](function(_0x5b0e54){if(!_0x5b0e54)throw new InternalError();return _0x5b0e54[_0xddeb('0x24')]();})[_0xddeb('0x23')](function(){_0xdb2c9['status'](0xcc)[_0xddeb('0x17')]();})[_0xddeb('0x42')](handleError(_0xdb2c9,null));};function getBucketslist(_0x36d715,_0x31c406,_0x4a8038){return new Promise(function(_0x32901e,_0x442897){var _0x1558b1=new AWS['S3']({'accessKeyId':_0x31c406,'secretAccessKey':_0x36d715,'region':_0x4a8038});_0x1558b1['listBuckets']({},function(_0x4e7b4f,_0x2d12e6){if(_0x4e7b4f){return _0x442897(_0x4e7b4f);}else{return _0x32901e(_0x2d12e6);}});});}function createBucket(_0x484617,_0x1c1e21,_0x327d2f,_0x2693a0){return new Promise(function(_0x5e5bc0,_0x21ec71){var _0x3ee2f9=new AWS['S3']({'accessKeyId':_0x1c1e21,'secretAccessKey':_0x484617,'region':_0x327d2f});_0x3ee2f9[_0xddeb('0x67')]({'Bucket':_0x2693a0},function(_0x162d2f,_0x4db073){if(_0x162d2f){return _0x21ec71(_0x162d2f);}else{return _0x5e5bc0(_0x4db073);}});});}function uploadFile(_0x36bf3b,_0x29dc20,_0x2ea1b2,_0x5e7c88,_0x11aa04,_0x46de67){return new Promise(function(_0x398db3,_0x16749d){var _0x2e4d6f=new AWS['S3']({'accessKeyId':_0x29dc20,'secretAccessKey':_0x36bf3b,'region':_0x2ea1b2});_0x2e4d6f[_0xddeb('0x68')]({'Bucket':_0x5e7c88,'Key':_0x11aa04,'Body':_0x46de67},function(_0x91e57,_0x30f0d1){if(_0x91e57){return _0x16749d(_0x91e57);}else{return _0x398db3(_0x30f0d1);}});});}function startTranscribe(_0xe0f243,_0x43da06,_0x34e34c,_0x460a99,_0x5a7185,_0x3b6bce){return new Promise(function(_0x23c501,_0x4b1c30){var _0x225b3c=new AWS[(_0xddeb('0x69'))]({'accessKeyId':_0x43da06,'secretAccessKey':_0xe0f243,'region':_0x34e34c});_0x225b3c[_0xddeb('0x6a')]({'TranscriptionJobName':_0x460a99,'LanguageCode':_0x5a7185,'Media':{'MediaFileUri':_0x3b6bce}},function(_0x388a49,_0x34e604){if(_0x388a49){return _0x4b1c30(_0x388a49);}else{return _0x23c501(_0x34e604);}});});}function transcribe(_0x1026ef,_0x5ad056,_0x12245d,_0x10d178,_0x18c9cf,_0x5a81da,_0x2f3baa){return new Promise(function(_0x351e91,_0x21cfcd){var _0x420d5b={};logger['info'](util[_0xddeb('0x4d')](_0xddeb('0x6b'),_0x1026ef,_0x18c9cf));return uploadFile(_0x5ad056,_0x12245d,_0x10d178,_0x18c9cf,path[_0xddeb('0x6c')](_0x5a81da),fs[_0xddeb('0x6d')](_0x5a81da))[_0xddeb('0x23')](function(_0x11c03a){logger[_0xddeb('0x62')](util[_0xddeb('0x4d')](_0xddeb('0x6e'),_0x1026ef,_0x18c9cf,_0x11c03a[_0xddeb('0x6f')]));_0x420d5b[_0xddeb('0x70')]=_0x11c03a['Bucket'];_0x420d5b[_0xddeb('0x71')]=_0x11c03a[_0xddeb('0x6f')];logger[_0xddeb('0x62')](util[_0xddeb('0x4d')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x1026ef));return startTranscribe(_0x5ad056,_0x12245d,_0x10d178,uuidv4(),_0x2f3baa,_0x11c03a[_0xddeb('0x6f')]);})[_0xddeb('0x23')](function(_0x4b783e){logger['info'](util[_0xddeb('0x4d')](_0xddeb('0x72'),_0x1026ef,_0x4b783e[_0xddeb('0x73')][_0xddeb('0x74')]));_0x420d5b[_0xddeb('0x75')]=_0x4b783e[_0xddeb('0x73')]['TranscriptionJobName'];_0x420d5b['transcribeStatus']=_0x4b783e['TranscriptionJob'][_0xddeb('0x76')];return _0x351e91(_0x420d5b);})['catch'](function(_0x5862a2){return _0x21cfcd(_0x5862a2);});});}exports[_0xddeb('0x77')]=function(_0x4269fb,_0x3c713e,_0x1039a4){var _0x3b7a40;var _0x23eaa9;var _0x5e64ee;var _0x2fae66=require(_0xddeb('0x59'));return db[_0xddeb('0x29')][_0xddeb('0x78')]({'where':{'id':_0x4269fb[_0xddeb('0x44')]['id']}})[_0xddeb('0x23')](function(_0x565d6c){if(_0x565d6c){var _0x5c6e3f=util[_0xddeb('0x4d')](_0xddeb('0x4e'),_0x565d6c[_0xddeb('0x4c')]);if(fs['existsSync'](_0x5c6e3f)){cypher=!![];return _0x2fae66[_0xddeb('0x50')](_0x5c6e3f,_0x565d6c[_0xddeb('0x4c')],config[_0xddeb('0x51')][_0xddeb('0x52')])[_0xddeb('0x23')](function(){return _0x565d6c;});}return _0x565d6c;}})[_0xddeb('0x23')](function(_0x9a183b){if(!_0x9a183b){throw new db[(_0xddeb('0x53'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x23eaa9=_0x9a183b;return db[_0xddeb('0x79')][_0xddeb('0x78')]({'where':{'id':0x1}});})[_0xddeb('0x23')](handleEntityNotFound(_0x3c713e,null))[_0xddeb('0x23')](function(_0x98e701){if(_0x98e701){_0x3b7a40=_0x98e701;if(!_0x3b7a40[_0xddeb('0x7a')]||!_0x3b7a40['transcribeAccountId']||!_0x3b7a40[_0xddeb('0x7b')]||!_0x3b7a40['language']||!_0x3b7a40[_0xddeb('0x70')]){throw new db[(_0xddeb('0x53'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x4269fb[_0xddeb('0x49')][_0xddeb('0x7c')]&&(!_0x3b7a40[_0xddeb('0x7d')]||!_0x3b7a40[_0xddeb('0x7e')]||!_0x3b7a40[_0xddeb('0x7f')]||!_0x3b7a40[_0xddeb('0x80')]||!_0x3b7a40[_0xddeb('0x70')])){throw new db[(_0xddeb('0x53'))][(_0xddeb('0x54'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xddeb('0x81')][_0xddeb('0x78')]({'where':{'id':_0x3b7a40['transcribeAccountId']}});}})[_0xddeb('0x23')](function(_0x297214){if(!_0x297214){throw new db[(_0xddeb('0x53'))][(_0xddeb('0x54'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x297214[_0xddeb('0x82')]||!_0x297214['data2']){throw new db[(_0xddeb('0x53'))][(_0xddeb('0x54'))](_0xddeb('0x83'));}_0x5e64ee=_0x297214;return getBucketslist(_0x5e64ee['data1'],_0x5e64ee[_0xddeb('0x84')],_0x3b7a40[_0xddeb('0x7b')]);})[_0xddeb('0x23')](function(_0x4c5e97){if(_0x4c5e97&&_0x4c5e97[_0xddeb('0x85')]){var _0x106c75=_[_0xddeb('0x47')](_0x4c5e97[_0xddeb('0x85')],function(_0x2036bb){return _0x2036bb[_0xddeb('0x86')]===_0x3b7a40[_0xddeb('0x70')];});if(!_0x106c75){logger['info'](util[_0xddeb('0x4d')](_0xddeb('0x87'),_0x4269fb['params']['id'],_0x3b7a40[_0xddeb('0x70')]));return createBucket(_0x5e64ee['data1'],_0x5e64ee['data2'],_0x3b7a40[_0xddeb('0x7b')],_0x3b7a40[_0xddeb('0x70')]);}logger['info'](util[_0xddeb('0x4d')](_0xddeb('0x88'),_0x4269fb[_0xddeb('0x44')]['id'],_0x3b7a40['bucket']));return;}})['then'](function(_0x1fcae5){if(_0x23eaa9[_0xddeb('0x89')]===_0xddeb('0x8a')){return transcribe(_0x4269fb[_0xddeb('0x44')]['id'],_0x5e64ee[_0xddeb('0x82')],_0x5e64ee[_0xddeb('0x84')],_0x3b7a40[_0xddeb('0x7b')],_0x3b7a40['bucket'],_0x23eaa9[_0xddeb('0x4c')],_0x3b7a40[_0xddeb('0x80')]);}else{logger[_0xddeb('0x62')](util[_0xddeb('0x4d')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4269fb[_0xddeb('0x44')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x128990){if(_0x128990){_0x128990['tempSentiment']=_0x4269fb['body'][_0xddeb('0x7c')];return _0x23eaa9[_0xddeb('0x8b')](_0x128990);}})['then'](respondWithResult(_0x3c713e,null))[_0xddeb('0x42')](handleError(_0x3c713e,null));};function writeFile(_0x1c7a01,_0x4e85ea){return new Promise(function(_0x46d8f1,_0x1c6db3){fs['writeFile'](_0x4e85ea,_0x1c7a01,function(_0x45a9ac,_0x4af49e){if(_0x45a9ac){return _0x1c6db3(_0x45a9ac);}else{return _0x46d8f1(_0x4af49e);}});});}exports['downloadTranscribe']=function(_0x28dae8,_0x570d4a,_0x19ed5f){return db[_0xddeb('0x29')][_0xddeb('0x78')]({'where':{'id':_0x28dae8[_0xddeb('0x44')]['id']}})[_0xddeb('0x23')](handleEntityNotFound(_0x570d4a))[_0xddeb('0x23')](function(_0x4d3add){if(_0x4d3add&&_0x4d3add[_0xddeb('0x8c')]){var _0x3191fb=_0x4d3add[_0xddeb('0x8c')];var _0x17934c=config['root']+_0xddeb('0x8d')+_0x4d3add['id']+_0xddeb('0x8e');if(fs[_0xddeb('0x4f')](_0x17934c)){return _0x17934c;}return writeFile(_0x3191fb,_0x17934c)['then'](function(){return _0x17934c;});}else{throw new db[(_0xddeb('0x53'))][(_0xddeb('0x54'))](_0xddeb('0x8f'));}})[_0xddeb('0x23')](function(_0xa7eb30){return _0x570d4a[_0xddeb('0x4a')](_0xa7eb30);})[_0xddeb('0x42')](handleError(_0x570d4a));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 8298db5..26eae08 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 _0xf53f=['transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x2202f4,_0x166928){var _0x12ff09=function(_0x3f34aa){while(--_0x3f34aa){_0x2202f4['push'](_0x2202f4['shift']());}};_0x12ff09(++_0x166928);}(_0xf53f,0x8d));var _0xff53=function(_0x17e294,_0x42e672){_0x17e294=_0x17e294-0x0;var _0x27f89f=_0xf53f[_0x17e294];return _0x27f89f;};'use strict';var attributes=require(_0xff53('0x0'));module[_0xff53('0x1')]=function(_0x25c590,_0x28461e){return _0x25c590[_0xff53('0x2')](_0xff53('0x3'),attributes,{'tableName':_0xff53('0x4'),'paranoid':![],'indexes':[{'name':_0xff53('0x5'),'fields':[_0xff53('0x5')]},{'name':_0xff53('0x6'),'fields':[_0xff53('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x97a2=['transcribeStatus','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x1af655,_0x28b928){var _0x29da01=function(_0x508209){while(--_0x508209){_0x1af655['push'](_0x1af655['shift']());}};_0x29da01(++_0x28b928);}(_0x97a2,0x1b1));var _0x297a=function(_0x2e7de8,_0x277bf4){_0x2e7de8=_0x2e7de8-0x0;var _0x27b26f=_0x97a2[_0x2e7de8];return _0x27b26f;};'use strict';var attributes=require(_0x297a('0x0'));module['exports']=function(_0x46f976,_0x41ac57){return _0x46f976[_0x297a('0x1')](_0x297a('0x2'),attributes,{'tableName':_0x297a('0x3'),'paranoid':![],'indexes':[{'name':_0x297a('0x4'),'fields':[_0x297a('0x4')]},{'name':_0x297a('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 6d7151e..f75cb06 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 _0x66fa=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','VoiceRecording','update','body','options','raw','where','attributes','UpdateVoiceRecording','stringify'];(function(_0xb2a00,_0x419835){var _0x355ac9=function(_0x58ee5d){while(--_0x58ee5d){_0xb2a00['push'](_0xb2a00['shift']());}};_0x355ac9(++_0x419835);}(_0x66fa,0x117));var _0xa66f=function(_0x5f48be,_0x4dd1c2){_0x5f48be=_0x5f48be-0x0;var _0x3a4cd2=_0x66fa[_0x5f48be];return _0x3a4cd2;};'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')]('VoiceRecording,\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')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['UpdateVoiceRecording']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')](_0x1cbe64[_0xa66f('0x16')],{'raw':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x19')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x1a')]||null:null,'limit':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')]['limit']||null:null})[_0xa66f('0xb')](function(_0xc5c82e){logger[_0xa66f('0xc')](_0xa66f('0x1b'),_0x1cbe64);logger['debug'](_0xa66f('0x1b'),_0x1cbe64,JSON[_0xa66f('0x1c')](_0xc5c82e));_0x4a28d4(_0xc5c82e);})[_0xa66f('0x13')](function(_0x16f1fa){logger['error']('UpdateVoiceRecording',_0x16f1fa[_0xa66f('0x12')],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x16f1fa[_0xa66f('0x12')]));});});};exports[_0xa66f('0x1d')]=function(_0x384164){var _0x57da7f=this;return new Promise(function(_0x4683c7,_0x1c2903){var _0x13495f=require(_0xa66f('0x1e'));var _0x17c103;return db[_0xa66f('0x1f')][_0xa66f('0x20')]({'attributes':['id',_0xa66f('0x21')],'where':{'id':0x1},'raw':!![]})[_0xa66f('0xb')](function(_0x117d03){_0x17c103=_0x117d03;return db[_0xa66f('0x14')][_0xa66f('0x22')](_0x384164[_0xa66f('0x16')]);})[_0xa66f('0xb')](function(_0x49f615){if(_0x17c103['callRecordingEncryption']&&fs[_0xa66f('0x23')](_0x49f615[_0xa66f('0x24')])){var _0x55f309=util[_0xa66f('0x25')](_0xa66f('0x26'),_0x49f615['value']);return _0x13495f[_0xa66f('0x27')](_0x49f615[_0xa66f('0x24')],_0x55f309,config[_0xa66f('0x28')][_0xa66f('0x29')])[_0xa66f('0xb')](function(){fs['unlink'](_0x49f615[_0xa66f('0x24')]);logger['info'](_0xa66f('0x2a'));return _0x49f615;});}return _0x49f615;})[_0xa66f('0xb')](function(_0x2e4dc8){logger['info'](_0xa66f('0x1d'),_0x384164);logger[_0xa66f('0x2b')]('CreateVoiceRecording',_0x384164,JSON[_0xa66f('0x1c')](_0x2e4dc8));_0x4683c7(_0x2e4dc8);})[_0xa66f('0x13')](function(_0xba9457){logger[_0xa66f('0xf')](_0xa66f('0x1d'),_0xba9457[_0xa66f('0x12')],_0x384164);_0x1c2903(_0x57da7f[_0xa66f('0xf')](0x1f4,_0xba9457[_0xa66f('0x12')]));});});}; \ No newline at end of file +var _0x0424=['stringify','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s'];(function(_0x531a94,_0xbf2864){var _0x4ad3e1=function(_0x5e98b4){while(--_0x5e98b4){_0x531a94['push'](_0x531a94['shift']());}};_0x4ad3e1(++_0xbf2864);}(_0x0424,0x159));var _0x4042=function(_0x471448,_0x1c0e9e){_0x471448=_0x471448-0x0;var _0x38190b=_0x0424[_0x471448];return _0x38190b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('VoiceRecording,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});}exports[_0x4042('0x15')]=function(_0x466077){var _0x4b02d4=this;return new Promise(function(_0xe5c1ec,_0x4fe024){return db[_0x4042('0x16')]['update'](_0x466077[_0x4042('0x17')],{'raw':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x466077['options']?_0x466077[_0x4042('0x18')][_0x4042('0x1a')]||null:null,'attributes':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')]['attributes']||null:null,'limit':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x1b')]||null:null})[_0x4042('0xa')](function(_0x352631){logger['info'](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('UpdateVoiceRecording',_0x466077,JSON[_0x4042('0xf')](_0x352631));_0xe5c1ec(_0x352631);})['catch'](function(_0x271b82){logger[_0x4042('0x10')](_0x4042('0x15'),_0x271b82['message'],_0x466077);_0x4fe024(_0x4b02d4[_0x4042('0x10')](0x1f4,_0x271b82[_0x4042('0x11')]));});});};exports[_0x4042('0x1c')]=function(_0xbdadc8){var _0x1c4d9f=this;return new Promise(function(_0x52e575,_0x58c409){var _0x1d8d48=require(_0x4042('0x1d'));var _0x26542c;return db[_0x4042('0x1e')][_0x4042('0x1f')]({'attributes':['id',_0x4042('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x33733b){_0x26542c=_0x33733b;return db[_0x4042('0x16')]['create'](_0xbdadc8[_0x4042('0x17')]);})[_0x4042('0xa')](function(_0xe924fe){if(_0x26542c['callRecordingEncryption']&&fs['existsSync'](_0xe924fe[_0x4042('0x21')])){var _0x43bd1c=util['format'](_0x4042('0x22'),_0xe924fe[_0x4042('0x21')]);return _0x1d8d48[_0x4042('0x23')](_0xe924fe[_0x4042('0x21')],_0x43bd1c,config[_0x4042('0x24')][_0x4042('0x25')])[_0x4042('0xa')](function(){fs[_0x4042('0x26')](_0xe924fe[_0x4042('0x21')]);logger['info'](_0x4042('0x27'));return _0xe924fe;});}return _0xe924fe;})[_0x4042('0xa')](function(_0x5320f8){logger[_0x4042('0x12')](_0x4042('0x1c'),_0xbdadc8);logger['debug'](_0x4042('0x1c'),_0xbdadc8,JSON[_0x4042('0xf')](_0x5320f8));_0x52e575(_0x5320f8);})[_0x4042('0x14')](function(_0xaa7c99){logger[_0x4042('0x10')](_0x4042('0x1c'),_0xaa7c99[_0x4042('0x11')],_0xbdadc8);_0x58c409(_0x1c4d9f[_0x4042('0x10')](0x1f4,_0xaa7c99[_0x4042('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 477759b..c83bafd 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 _0x13f9=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x450b9e,_0x6b0d85){var _0x535e14=function(_0x17ac1a){while(--_0x17ac1a){_0x450b9e['push'](_0x450b9e['shift']());}};_0x535e14(++_0x6b0d85);}(_0x13f9,0xba));var _0x913f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x13f9[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x913f('0x0'));var util=require(_0x913f('0x1'));var path=require(_0x913f('0x2'));var timeout=require(_0x913f('0x3'));var express=require(_0x913f('0x4'));var router=express[_0x913f('0x5')]();var fs_extra=require(_0x913f('0x6'));var auth=require(_0x913f('0x7'));var interaction=require(_0x913f('0x8'));var config=require(_0x913f('0x9'));var controller=require('./voiceTransferReport.controller');router[_0x913f('0xa')]('/',auth['isAuthenticated'](),controller[_0x913f('0xb')]);router[_0x913f('0xa')](_0x913f('0xc'),auth[_0x913f('0xd')](),controller[_0x913f('0xe')]);router[_0x913f('0xa')](_0x913f('0xf'),auth['isAuthenticated'](),controller[_0x913f('0x10')]);router[_0x913f('0x11')]('/',auth[_0x913f('0xd')](),controller[_0x913f('0x12')]);router[_0x913f('0x13')](_0x913f('0xf'),auth[_0x913f('0xd')](),controller[_0x913f('0x14')]);router[_0x913f('0x15')](_0x913f('0xf'),auth[_0x913f('0xd')](),controller[_0x913f('0x16')]);module[_0x913f('0x17')]=router; \ No newline at end of file +var _0x685e=['put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x46c26f,_0x27eb55){var _0x35031e=function(_0x5877c1){while(--_0x5877c1){_0x46c26f['push'](_0x46c26f['shift']());}};_0x35031e(++_0x27eb55);}(_0x685e,0x101));var _0xe685=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x685e[_0x47a349];return _0x18ab75;};'use strict';var multer=require('multer');var util=require(_0xe685('0x0'));var path=require(_0xe685('0x1'));var timeout=require(_0xe685('0x2'));var express=require('express');var router=express[_0xe685('0x3')]();var fs_extra=require(_0xe685('0x4'));var auth=require(_0xe685('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe685('0x6'));var controller=require(_0xe685('0x7'));router[_0xe685('0x8')]('/',auth['isAuthenticated'](),controller[_0xe685('0x9')]);router[_0xe685('0x8')](_0xe685('0xa'),auth[_0xe685('0xb')](),controller[_0xe685('0xc')]);router['get'](_0xe685('0xd'),auth[_0xe685('0xb')](),controller[_0xe685('0xe')]);router[_0xe685('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe685('0x10')]('/:id',auth[_0xe685('0xb')](),controller[_0xe685('0x11')]);router[_0xe685('0x12')]('/:id',auth[_0xe685('0xb')](),controller[_0xe685('0x13')]);module[_0xe685('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index d1fb6ca..4c52a83 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 _0x53e3=['attended','STRING','Yes','sequelize','moment','exports','ENUM'];(function(_0x1eb170,_0x57a773){var _0x4f01ed=function(_0x1e5576){while(--_0x1e5576){_0x1eb170['push'](_0x1eb170['shift']());}};_0x4f01ed(++_0x57a773);}(_0x53e3,0x1ae));var _0x353e=function(_0x2fe75a,_0x39ee44){_0x2fe75a=_0x2fe75a-0x0;var _0x29b9d4=_0x53e3[_0x2fe75a];return _0x29b9d4;};'use strict';var Sequelize=require(_0x353e('0x0'));var moment=require(_0x353e('0x1'));module[_0x353e('0x2')]={'type':{'type':Sequelize[_0x353e('0x3')]('blind',_0x353e('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x353e('0x5')]},'transferercalleridname':{'type':Sequelize[_0x353e('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x353e('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x353e('0x5')]},'transfererexten':{'type':Sequelize[_0x353e('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x353e('0x5')]},'transfereechannel':{'type':Sequelize[_0x353e('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x353e('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x353e('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x353e('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x353e('0x5')]},'transfereecontext':{'type':Sequelize[_0x353e('0x5')]},'transfereeexten':{'type':Sequelize[_0x353e('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x353e('0x5')]},'isexternal':{'type':Sequelize[_0x353e('0x3')](_0x353e('0x6'),'No')},'context':{'type':Sequelize[_0x353e('0x5')]},'extension':{'type':Sequelize[_0x353e('0x5')]}}; \ No newline at end of file +var _0x1260=['moment','exports','blind','attended','STRING','ENUM','Yes','sequelize'];(function(_0x1e7517,_0x4b03c9){var _0x522f4c=function(_0x4b056b){while(--_0x4b056b){_0x1e7517['push'](_0x1e7517['shift']());}};_0x522f4c(++_0x4b03c9);}(_0x1260,0x77));var _0x0126=function(_0xb78399,_0x1a62c5){_0xb78399=_0xb78399-0x0;var _0x427483=_0x1260[_0xb78399];return _0x427483;};'use strict';var Sequelize=require(_0x0126('0x0'));var moment=require(_0x0126('0x1'));module[_0x0126('0x2')]={'type':{'type':Sequelize['ENUM'](_0x0126('0x3'),_0x0126('0x4'))},'result':{'type':Sequelize[_0x0126('0x5')]},'transfererchannel':{'type':Sequelize[_0x0126('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x0126('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x0126('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x0126('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x0126('0x5')]},'transfereechannel':{'type':Sequelize[_0x0126('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x0126('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x0126('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x0126('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x0126('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x0126('0x5')]},'transfereecontext':{'type':Sequelize[_0x0126('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x0126('0x5')]},'isexternal':{'type':Sequelize[_0x0126('0x6')](_0x0126('0x7'),'No')},'context':{'type':Sequelize[_0x0126('0x5')]},'extension':{'type':Sequelize[_0x0126('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e1fb538..b91abfd 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 _0x0d20=['nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','length','include','options','find','catch','create','body','destroy','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','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','offset','undefined','limit','count','set','json','apply','reject','save','update','then','error','stack','name','index','VoiceTransferReport','rawAttributes','fieldName','type','key','model','map','keys','query','attributes','intersection','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d20,0xb5));var _0x00d2=function(_0x359d54,_0x19f1f7){_0x359d54=_0x359d54-0x0;var _0xf07b18=_0x0d20[_0x359d54];return _0xf07b18;};'use strict';var emlformat=require(_0x00d2('0x0'));var rimraf=require(_0x00d2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00d2('0x2'));var rp=require(_0x00d2('0x3'));var moment=require(_0x00d2('0x4'));var BPromise=require(_0x00d2('0x5'));var Mustache=require(_0x00d2('0x6'));var util=require(_0x00d2('0x7'));var path=require(_0x00d2('0x8'));var sox=require(_0x00d2('0x9'));var csv=require('to-csv');var ejs=require(_0x00d2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x00d2('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x00d2('0xc'));var deskjs=require(_0x00d2('0xd'));var toCsv=require(_0x00d2('0xe'));var querystring=require(_0x00d2('0xf'));var Papa=require(_0x00d2('0x10'));var Redis=require(_0x00d2('0x11'));var authService=require(_0x00d2('0x12'));var qs=require(_0x00d2('0x13'));var as=require(_0x00d2('0x14'));var hardwareService=require(_0x00d2('0x15'));var logger=require(_0x00d2('0x16'))(_0x00d2('0x17'));var utils=require('../../config/utils');var config=require(_0x00d2('0x18'));var licenseUtil=require(_0x00d2('0x19'));var db=require(_0x00d2('0x1a'))['db'];function respondWithStatusCode(_0x310ab7,_0x59dfe6){_0x59dfe6=_0x59dfe6||0xcc;return function(_0x23b37a){if(_0x23b37a){return _0x310ab7['sendStatus'](_0x59dfe6);}return _0x310ab7[_0x00d2('0x1b')](_0x59dfe6)[_0x00d2('0x1c')]();};}function respondWithResult(_0x1ff8da,_0x2838ef){_0x2838ef=_0x2838ef||0xc8;return function(_0x2f7dd1){if(_0x2f7dd1){return _0x1ff8da[_0x00d2('0x1b')](_0x2838ef)['json'](_0x2f7dd1);}};}function respondWithFilteredResult(_0x58b6c8,_0x274d9b){return function(_0x52ad16){if(_0x52ad16){var _0x3c9a1d=typeof _0x274d9b[_0x00d2('0x1d')]===_0x00d2('0x1e')&&typeof _0x274d9b[_0x00d2('0x1f')]===_0x00d2('0x1e');var _0x2edf55=_0x52ad16[_0x00d2('0x20')];var _0x22aafb=_0x3c9a1d?0x0:_0x274d9b[_0x00d2('0x1d')];var _0x5b8e8f=_0x3c9a1d?_0x52ad16[_0x00d2('0x20')]:_0x274d9b[_0x00d2('0x1d')]+_0x274d9b['limit'];var _0x58d0ed;if(_0x5b8e8f>=_0x2edf55){_0x5b8e8f=_0x2edf55;_0x58d0ed=0xc8;}else{_0x58d0ed=0xce;}_0x58b6c8['status'](_0x58d0ed);return _0x58b6c8[_0x00d2('0x21')]('Content-Range',_0x22aafb+'-'+_0x5b8e8f+'/'+_0x2edf55)[_0x00d2('0x22')](_0x52ad16);}return null;};}function patchUpdates(_0x486cd8){return function(_0x5dbedc){try{jsonpatch[_0x00d2('0x23')](_0x5dbedc,_0x486cd8,!![]);}catch(_0x2797a9){return BPromise[_0x00d2('0x24')](_0x2797a9);}return _0x5dbedc[_0x00d2('0x25')]();};}function saveUpdates(_0x465f48,_0x432c4f){return function(_0x4c9ac3){if(_0x4c9ac3){return _0x4c9ac3[_0x00d2('0x26')](_0x465f48)['then'](function(_0x5d4a4e){return _0x5d4a4e;});}return null;};}function removeEntity(_0x2e5bf7,_0x36a145){return function(_0x1e9fc4){if(_0x1e9fc4){return _0x1e9fc4['destroy']()[_0x00d2('0x27')](function(){_0x2e5bf7[_0x00d2('0x1b')](0xcc)[_0x00d2('0x1c')]();});}};}function handleEntityNotFound(_0x1a730f,_0x5ab06c){return function(_0x32cca1){if(!_0x32cca1){_0x1a730f['sendStatus'](0x194);}return _0x32cca1;};}function handleError(_0x253f86,_0x52e6f8){_0x52e6f8=_0x52e6f8||0x1f4;return function(_0xc5d4fd){logger[_0x00d2('0x28')](_0xc5d4fd[_0x00d2('0x29')]);if(_0xc5d4fd['name']){delete _0xc5d4fd[_0x00d2('0x2a')];}_0x253f86[_0x00d2('0x1b')](_0x52e6f8)['send'](_0xc5d4fd);};}exports[_0x00d2('0x2b')]=function(_0x37bcc8,_0x190a67){var _0x50a840={},_0x533f3d={},_0x1a50d4={'count':0x0,'rows':[]};var _0x3516ff=_['map'](db[_0x00d2('0x2c')][_0x00d2('0x2d')],function(_0x5df624){return{'name':_0x5df624[_0x00d2('0x2e')],'type':_0x5df624[_0x00d2('0x2f')][_0x00d2('0x30')]};});_0x533f3d[_0x00d2('0x31')]=_[_0x00d2('0x32')](_0x3516ff,_0x00d2('0x2a'));_0x533f3d['query']=_[_0x00d2('0x33')](_0x37bcc8[_0x00d2('0x34')]);_0x533f3d['filters']=_['intersection'](_0x533f3d[_0x00d2('0x31')],_0x533f3d['query']);_0x50a840[_0x00d2('0x35')]=_[_0x00d2('0x36')](_0x533f3d['model'],qs[_0x00d2('0x37')](_0x37bcc8['query']['fields']));_0x50a840[_0x00d2('0x35')]=_0x50a840[_0x00d2('0x35')]['length']?_0x50a840[_0x00d2('0x35')]:_0x533f3d[_0x00d2('0x31')];if(!_0x37bcc8[_0x00d2('0x34')]['hasOwnProperty'](_0x00d2('0x38'))){_0x50a840[_0x00d2('0x1f')]=qs['limit'](_0x37bcc8[_0x00d2('0x34')]['limit']);_0x50a840[_0x00d2('0x1d')]=qs[_0x00d2('0x1d')](_0x37bcc8[_0x00d2('0x34')]['offset']);}_0x50a840[_0x00d2('0x39')]=qs[_0x00d2('0x3a')](_0x37bcc8['query'][_0x00d2('0x3a')]);_0x50a840[_0x00d2('0x3b')]=qs[_0x00d2('0x3c')](_[_0x00d2('0x3d')](_0x37bcc8[_0x00d2('0x34')],_0x533f3d['filters']),_0x3516ff);if(_0x37bcc8[_0x00d2('0x34')][_0x00d2('0x3e')]){_0x50a840[_0x00d2('0x3b')]=_[_0x00d2('0x3f')](_0x50a840[_0x00d2('0x3b')],{'$or':_['map'](_0x3516ff,function(_0x55d2b5){if(_0x55d2b5['type']!==_0x00d2('0x40')){var _0x4da052={};_0x4da052[_0x55d2b5['name']]={'$like':'%'+_0x37bcc8['query'][_0x00d2('0x3e')]+'%'};return _0x4da052;}})});}_0x50a840=_[_0x00d2('0x3f')]({},_0x50a840,_0x37bcc8['options']);var _0x2a964a={'where':_0x50a840[_0x00d2('0x3b')]};return db[_0x00d2('0x2c')]['count'](_0x2a964a)[_0x00d2('0x27')](function(_0xaaecf){_0x1a50d4[_0x00d2('0x20')]=_0xaaecf;if(_0x37bcc8[_0x00d2('0x34')][_0x00d2('0x41')]){_0x50a840['include']=[{'all':!![]}];}return db[_0x00d2('0x2c')][_0x00d2('0x42')](_0x50a840);})[_0x00d2('0x27')](function(_0x49d8f4){_0x1a50d4[_0x00d2('0x43')]=_0x49d8f4;return _0x1a50d4;})[_0x00d2('0x27')](respondWithFilteredResult(_0x190a67,_0x50a840))['catch'](handleError(_0x190a67,null));};exports[_0x00d2('0x44')]=function(_0x26f72c,_0x26130e){var _0x776df1={'raw':!![],'where':{'id':_0x26f72c['params']['id']}},_0x339e8b={};_0x339e8b[_0x00d2('0x31')]=_[_0x00d2('0x33')](db[_0x00d2('0x2c')]['rawAttributes']);_0x339e8b[_0x00d2('0x34')]=_['keys'](_0x26f72c[_0x00d2('0x34')]);_0x339e8b['filters']=_[_0x00d2('0x36')](_0x339e8b[_0x00d2('0x31')],_0x339e8b[_0x00d2('0x34')]);_0x776df1[_0x00d2('0x35')]=_['intersection'](_0x339e8b[_0x00d2('0x31')],qs[_0x00d2('0x37')](_0x26f72c[_0x00d2('0x34')]['fields']));_0x776df1[_0x00d2('0x35')]=_0x776df1[_0x00d2('0x35')][_0x00d2('0x45')]?_0x776df1[_0x00d2('0x35')]:_0x339e8b[_0x00d2('0x31')];if(_0x26f72c[_0x00d2('0x34')][_0x00d2('0x41')]){_0x776df1[_0x00d2('0x46')]=[{'all':!![]}];}_0x776df1=_[_0x00d2('0x3f')]({},_0x776df1,_0x26f72c[_0x00d2('0x47')]);return db[_0x00d2('0x2c')][_0x00d2('0x48')](_0x776df1)[_0x00d2('0x27')](handleEntityNotFound(_0x26130e,null))[_0x00d2('0x27')](respondWithResult(_0x26130e,null))[_0x00d2('0x49')](handleError(_0x26130e,null));};exports[_0x00d2('0x4a')]=function(_0x469a0e,_0xd1feb7){return db[_0x00d2('0x2c')]['create'](_0x469a0e[_0x00d2('0x4b')],{})[_0x00d2('0x27')](respondWithResult(_0xd1feb7,0xc9))[_0x00d2('0x49')](handleError(_0xd1feb7,null));};exports['update']=function(_0xadcb05,_0x2d62bc){if(_0xadcb05[_0x00d2('0x4b')]['id']){delete _0xadcb05[_0x00d2('0x4b')]['id'];}return db['VoiceTransferReport'][_0x00d2('0x48')]({'where':{'id':_0xadcb05['params']['id']}})['then'](handleEntityNotFound(_0x2d62bc,null))[_0x00d2('0x27')](saveUpdates(_0xadcb05[_0x00d2('0x4b')],null))['then'](respondWithResult(_0x2d62bc,null))['catch'](handleError(_0x2d62bc,null));};exports[_0x00d2('0x4c')]=function(_0x40a44f,_0x55e3a7){return db[_0x00d2('0x2c')][_0x00d2('0x48')]({'where':{'id':_0x40a44f[_0x00d2('0x4d')]['id']}})[_0x00d2('0x27')](handleEntityNotFound(_0x55e3a7,null))['then'](removeEntity(_0x55e3a7,null))['catch'](handleError(_0x55e3a7,null));};exports[_0x00d2('0x4e')]=function(_0x113a63,_0x2bc55a){return db[_0x00d2('0x2c')][_0x00d2('0x4e')]()[_0x00d2('0x27')](respondWithResult(_0x2bc55a,null))[_0x00d2('0x49')](handleError(_0x2bc55a,null));}; \ No newline at end of file +var _0x6bd6=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','update','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','VoiceTransferReport','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf'];(function(_0x5d7886,_0x4b2d49){var _0xba0713=function(_0x23c57e){while(--_0x23c57e){_0x5d7886['push'](_0x5d7886['shift']());}};_0xba0713(++_0x4b2d49);}(_0x6bd6,0x96));var _0x66bd=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0x6bd6[_0x54bac5];return _0xc15971;};'use strict';var emlformat=require(_0x66bd('0x0'));var rimraf=require(_0x66bd('0x1'));var zipdir=require(_0x66bd('0x2'));var jsonpatch=require(_0x66bd('0x3'));var rp=require('request-promise');var moment=require(_0x66bd('0x4'));var BPromise=require(_0x66bd('0x5'));var Mustache=require(_0x66bd('0x6'));var util=require(_0x66bd('0x7'));var path=require(_0x66bd('0x8'));var sox=require(_0x66bd('0x9'));var csv=require(_0x66bd('0xa'));var ejs=require(_0x66bd('0xb'));var fs=require('fs');var fs_extra=require(_0x66bd('0xc'));var _=require(_0x66bd('0xd'));var squel=require('squel');var crypto=require(_0x66bd('0xe'));var jsforce=require(_0x66bd('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x66bd('0x10'));var Papa=require(_0x66bd('0x11'));var Redis=require(_0x66bd('0x12'));var authService=require(_0x66bd('0x13'));var qs=require(_0x66bd('0x14'));var as=require(_0x66bd('0x15'));var hardwareService=require(_0x66bd('0x16'));var logger=require(_0x66bd('0x17'))('api');var utils=require(_0x66bd('0x18'));var config=require(_0x66bd('0x19'));var licenseUtil=require(_0x66bd('0x1a'));var db=require(_0x66bd('0x1b'))['db'];function respondWithStatusCode(_0x59b17f,_0xa9098e){_0xa9098e=_0xa9098e||0xcc;return function(_0x584836){if(_0x584836){return _0x59b17f[_0x66bd('0x1c')](_0xa9098e);}return _0x59b17f[_0x66bd('0x1d')](_0xa9098e)['end']();};}function respondWithResult(_0x2955a7,_0xdd2c9f){_0xdd2c9f=_0xdd2c9f||0xc8;return function(_0x1f29fa){if(_0x1f29fa){return _0x2955a7[_0x66bd('0x1d')](_0xdd2c9f)[_0x66bd('0x1e')](_0x1f29fa);}};}function respondWithFilteredResult(_0x3f4ad6,_0x14af3f){return function(_0x20e7cf){if(_0x20e7cf){var _0x2f52fb=typeof _0x14af3f[_0x66bd('0x1f')]===_0x66bd('0x20')&&typeof _0x14af3f['limit']==='undefined';var _0x520444=_0x20e7cf[_0x66bd('0x21')];var _0xc32d44=_0x2f52fb?0x0:_0x14af3f[_0x66bd('0x1f')];var _0x3efb75=_0x2f52fb?_0x20e7cf['count']:_0x14af3f['offset']+_0x14af3f[_0x66bd('0x22')];var _0x16de33;if(_0x3efb75>=_0x520444){_0x3efb75=_0x520444;_0x16de33=0xc8;}else{_0x16de33=0xce;}_0x3f4ad6[_0x66bd('0x1d')](_0x16de33);return _0x3f4ad6['set'](_0x66bd('0x23'),_0xc32d44+'-'+_0x3efb75+'/'+_0x520444)[_0x66bd('0x1e')](_0x20e7cf);}return null;};}function patchUpdates(_0x328b46){return function(_0x51b060){try{jsonpatch['apply'](_0x51b060,_0x328b46,!![]);}catch(_0xce57d5){return BPromise[_0x66bd('0x24')](_0xce57d5);}return _0x51b060['save']();};}function saveUpdates(_0x1955a8,_0x34b444){return function(_0xd9b36c){if(_0xd9b36c){return _0xd9b36c[_0x66bd('0x25')](_0x1955a8)['then'](function(_0x449be7){return _0x449be7;});}return null;};}function removeEntity(_0x2381d2,_0x2d44b4){return function(_0x15ec33){if(_0x15ec33){return _0x15ec33['destroy']()[_0x66bd('0x26')](function(){_0x2381d2[_0x66bd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c444a,_0x3aacdc){return function(_0x4c3f19){if(!_0x4c3f19){_0x5c444a[_0x66bd('0x1c')](0x194);}return _0x4c3f19;};}function handleError(_0x105612,_0x1a337d){_0x1a337d=_0x1a337d||0x1f4;return function(_0x6fc166){logger[_0x66bd('0x27')](_0x6fc166[_0x66bd('0x28')]);if(_0x6fc166['name']){delete _0x6fc166['name'];}_0x105612[_0x66bd('0x1d')](_0x1a337d)[_0x66bd('0x29')](_0x6fc166);};}exports[_0x66bd('0x2a')]=function(_0x4a98cc,_0x4f80d4){var _0x362a2b={},_0x18c2e7={},_0xc02de={'count':0x0,'rows':[]};var _0x5ea340=_[_0x66bd('0x2b')](db['VoiceTransferReport'][_0x66bd('0x2c')],function(_0x527bf1){return{'name':_0x527bf1[_0x66bd('0x2d')],'type':_0x527bf1[_0x66bd('0x2e')][_0x66bd('0x2f')]};});_0x18c2e7[_0x66bd('0x30')]=_['map'](_0x5ea340,'name');_0x18c2e7[_0x66bd('0x31')]=_[_0x66bd('0x32')](_0x4a98cc['query']);_0x18c2e7[_0x66bd('0x33')]=_[_0x66bd('0x34')](_0x18c2e7[_0x66bd('0x30')],_0x18c2e7['query']);_0x362a2b[_0x66bd('0x35')]=_['intersection'](_0x18c2e7['model'],qs[_0x66bd('0x36')](_0x4a98cc['query'][_0x66bd('0x36')]));_0x362a2b[_0x66bd('0x35')]=_0x362a2b[_0x66bd('0x35')][_0x66bd('0x37')]?_0x362a2b[_0x66bd('0x35')]:_0x18c2e7['model'];if(!_0x4a98cc[_0x66bd('0x31')][_0x66bd('0x38')](_0x66bd('0x39'))){_0x362a2b[_0x66bd('0x22')]=qs['limit'](_0x4a98cc[_0x66bd('0x31')][_0x66bd('0x22')]);_0x362a2b[_0x66bd('0x1f')]=qs['offset'](_0x4a98cc['query'][_0x66bd('0x1f')]);}_0x362a2b[_0x66bd('0x3a')]=qs['sort'](_0x4a98cc[_0x66bd('0x31')][_0x66bd('0x3b')]);_0x362a2b[_0x66bd('0x3c')]=qs[_0x66bd('0x33')](_[_0x66bd('0x3d')](_0x4a98cc['query'],_0x18c2e7[_0x66bd('0x33')]),_0x5ea340);if(_0x4a98cc[_0x66bd('0x31')]['filter']){_0x362a2b[_0x66bd('0x3c')]=_[_0x66bd('0x3e')](_0x362a2b[_0x66bd('0x3c')],{'$or':_['map'](_0x5ea340,function(_0x10e898){if(_0x10e898[_0x66bd('0x2e')]!=='VIRTUAL'){var _0x1084b7={};_0x1084b7[_0x10e898['name']]={'$like':'%'+_0x4a98cc[_0x66bd('0x31')][_0x66bd('0x3f')]+'%'};return _0x1084b7;}})});}_0x362a2b=_[_0x66bd('0x3e')]({},_0x362a2b,_0x4a98cc[_0x66bd('0x40')]);var _0x527f8f={'where':_0x362a2b[_0x66bd('0x3c')]};return db[_0x66bd('0x41')][_0x66bd('0x21')](_0x527f8f)['then'](function(_0x3dce57){_0xc02de[_0x66bd('0x21')]=_0x3dce57;if(_0x4a98cc[_0x66bd('0x31')][_0x66bd('0x42')]){_0x362a2b[_0x66bd('0x43')]=[{'all':!![]}];}return db[_0x66bd('0x41')]['findAll'](_0x362a2b);})[_0x66bd('0x26')](function(_0x36cc97){_0xc02de[_0x66bd('0x44')]=_0x36cc97;return _0xc02de;})['then'](respondWithFilteredResult(_0x4f80d4,_0x362a2b))[_0x66bd('0x45')](handleError(_0x4f80d4,null));};exports[_0x66bd('0x46')]=function(_0x1fc538,_0x4542fa){var _0x4e6df0={'raw':!![],'where':{'id':_0x1fc538[_0x66bd('0x47')]['id']}},_0x8201fe={};_0x8201fe['model']=_[_0x66bd('0x32')](db[_0x66bd('0x41')][_0x66bd('0x2c')]);_0x8201fe[_0x66bd('0x31')]=_['keys'](_0x1fc538[_0x66bd('0x31')]);_0x8201fe[_0x66bd('0x33')]=_[_0x66bd('0x34')](_0x8201fe[_0x66bd('0x30')],_0x8201fe[_0x66bd('0x31')]);_0x4e6df0[_0x66bd('0x35')]=_[_0x66bd('0x34')](_0x8201fe[_0x66bd('0x30')],qs[_0x66bd('0x36')](_0x1fc538[_0x66bd('0x31')][_0x66bd('0x36')]));_0x4e6df0['attributes']=_0x4e6df0[_0x66bd('0x35')][_0x66bd('0x37')]?_0x4e6df0[_0x66bd('0x35')]:_0x8201fe[_0x66bd('0x30')];if(_0x1fc538[_0x66bd('0x31')][_0x66bd('0x42')]){_0x4e6df0[_0x66bd('0x43')]=[{'all':!![]}];}_0x4e6df0=_[_0x66bd('0x3e')]({},_0x4e6df0,_0x1fc538[_0x66bd('0x40')]);return db[_0x66bd('0x41')][_0x66bd('0x48')](_0x4e6df0)[_0x66bd('0x26')](handleEntityNotFound(_0x4542fa,null))[_0x66bd('0x26')](respondWithResult(_0x4542fa,null))[_0x66bd('0x45')](handleError(_0x4542fa,null));};exports[_0x66bd('0x49')]=function(_0x1d7fcd,_0x24f8e5){return db['VoiceTransferReport']['create'](_0x1d7fcd[_0x66bd('0x4a')],{})[_0x66bd('0x26')](respondWithResult(_0x24f8e5,0xc9))[_0x66bd('0x45')](handleError(_0x24f8e5,null));};exports[_0x66bd('0x25')]=function(_0x33bbdf,_0x4d069e){if(_0x33bbdf[_0x66bd('0x4a')]['id']){delete _0x33bbdf[_0x66bd('0x4a')]['id'];}return db[_0x66bd('0x41')][_0x66bd('0x48')]({'where':{'id':_0x33bbdf[_0x66bd('0x47')]['id']}})[_0x66bd('0x26')](handleEntityNotFound(_0x4d069e,null))['then'](saveUpdates(_0x33bbdf['body'],null))[_0x66bd('0x26')](respondWithResult(_0x4d069e,null))['catch'](handleError(_0x4d069e,null));};exports['destroy']=function(_0x4b2a3d,_0x12c629){return db[_0x66bd('0x41')][_0x66bd('0x48')]({'where':{'id':_0x4b2a3d[_0x66bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x12c629,null))[_0x66bd('0x26')](removeEntity(_0x12c629,null))[_0x66bd('0x45')](handleError(_0x12c629,null));};exports[_0x66bd('0x4b')]=function(_0x599c30,_0x45d826){return db[_0x66bd('0x41')][_0x66bd('0x4b')]()[_0x66bd('0x26')](respondWithResult(_0x45d826,null))[_0x66bd('0x45')](handleError(_0x45d826,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 46a6336..f3819da 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 _0x58ab=['rimraf','./voiceTransferReport.attributes','exports','VoiceTransferReport','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x1f426f,_0x5c3f12){var _0x3741bc=function(_0x46be33){while(--_0x46be33){_0x1f426f['push'](_0x1f426f['shift']());}};_0x3741bc(++_0x5c3f12);}(_0x58ab,0xcc));var _0xb58a=function(_0x186d33,_0x535a19){_0x186d33=_0x186d33-0x0;var _0x13de70=_0x58ab[_0x186d33];return _0x13de70;};'use strict';var _=require(_0xb58a('0x0'));var util=require('util');var logger=require(_0xb58a('0x1'))(_0xb58a('0x2'));var moment=require(_0xb58a('0x3'));var BPromise=require(_0xb58a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb58a('0x5'));var rimraf=require(_0xb58a('0x6'));var config=require('../../config/environment');var attributes=require(_0xb58a('0x7'));module[_0xb58a('0x8')]=function(_0x2a59fb,_0x2e60c6){return _0x2a59fb['define'](_0xb58a('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0ab=['api','moment','bluebird','request-promise','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util'];(function(_0x2d8ad6,_0x3a4c24){var _0x20c118=function(_0x37ea4b){while(--_0x37ea4b){_0x2d8ad6['push'](_0x2d8ad6['shift']());}};_0x20c118(++_0x3a4c24);}(_0xf0ab,0xd1));var _0xbf0a=function(_0x3482df,_0x400676){_0x3482df=_0x3482df-0x0;var _0x4ff418=_0xf0ab[_0x3482df];return _0x4ff418;};'use strict';var _=require('lodash');var util=require(_0xbf0a('0x0'));var logger=require('../../config/logger')(_0xbf0a('0x1'));var moment=require(_0xbf0a('0x2'));var BPromise=require(_0xbf0a('0x3'));var rp=require(_0xbf0a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbf0a('0x5'));module[_0xbf0a('0x6')]=function(_0x461a05,_0x21e702){return _0x461a05[_0xbf0a('0x7')](_0xbf0a('0x8'),attributes,{'tableName':_0xbf0a('0x9'),'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 a612244..05ba963 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 _0x3382=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','moment','bluebird','ioredis'];(function(_0x2507b2,_0x7c7971){var _0x4a1041=function(_0x39d353){while(--_0x39d353){_0x2507b2['push'](_0x2507b2['shift']());}};_0x4a1041(++_0x7c7971);}(_0x3382,0x1f4));var _0x2338=function(_0x249737,_0x534004){_0x249737=_0x249737-0x0;var _0x616b6a=_0x3382[_0x249737];return _0x616b6a;};'use strict';var _=require(_0x2338('0x0'));var util=require('util');var moment=require(_0x2338('0x1'));var BPromise=require(_0x2338('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2338('0x3'));var db=require(_0x2338('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2338('0x5'))(_0x2338('0x6'));var config=require(_0x2338('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2338('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13ccb4,_0x996602,_0x3e5cef){return new BPromise(function(_0x30f6f0,_0x41c43a){return client[_0x2338('0x9')](_0x13ccb4,_0x3e5cef)[_0x2338('0xa')](function(_0x52b76b){logger['info'](_0x2338('0xb'),_0x996602,_0x2338('0xc'));logger[_0x2338('0xd')](_0x2338('0xe'),_0x996602,_0x2338('0xc'),JSON[_0x2338('0xf')](_0x52b76b));if(_0x52b76b[_0x2338('0x10')]){if(_0x52b76b[_0x2338('0x10')][_0x2338('0x11')]===0x1f4){logger[_0x2338('0x10')](_0x2338('0xb'),_0x996602,_0x52b76b['error'][_0x2338('0x12')]);return _0x41c43a(_0x52b76b['error'][_0x2338('0x12')]);}logger[_0x2338('0x10')](_0x2338('0xb'),_0x996602,_0x52b76b[_0x2338('0x10')][_0x2338('0x12')]);return _0x30f6f0(_0x52b76b['error'][_0x2338('0x12')]);}else{logger[_0x2338('0x13')](_0x2338('0xb'),_0x996602,_0x2338('0xc'));_0x30f6f0(_0x52b76b[_0x2338('0x14')][_0x2338('0x12')]);}})[_0x2338('0x15')](function(_0x27bd31){logger[_0x2338('0x10')](_0x2338('0xb'),_0x996602,_0x27bd31);_0x41c43a(_0x27bd31);});});}exports[_0x2338('0x16')]=function(_0x42a1f5){var _0xea99ea=this;return new Promise(function(_0x196a66,_0x2e2721){return db[_0x2338('0x17')][_0x2338('0x18')](_0x42a1f5[_0x2338('0x19')],{'raw':_0x42a1f5['options']?_0x42a1f5[_0x2338('0x1a')][_0x2338('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5b48b4){logger[_0x2338('0x13')]('CreateVoiceTransferReport',_0x42a1f5);logger[_0x2338('0xd')](_0x2338('0x16'),_0x42a1f5,JSON['stringify'](_0x5b48b4));_0x196a66(_0x5b48b4);})[_0x2338('0x15')](function(_0x3b1abb){logger[_0x2338('0x10')](_0x2338('0x16'),_0x3b1abb[_0x2338('0x12')],_0x42a1f5);_0x2e2721(_0xea99ea[_0x2338('0x10')](0x1f4,_0x3b1abb['message']));});});}; \ No newline at end of file +var _0xcbef=['rpc','../../config/environment','jayson/promise','http','request','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','then','lodash','bluebird','ioredis','../../mysqldb'];(function(_0x5c0923,_0x3385d9){var _0x5d71e3=function(_0x49b874){while(--_0x49b874){_0x5c0923['push'](_0x5c0923['shift']());}};_0x5d71e3(++_0x3385d9);}(_0xcbef,0x18c));var _0xfcbe=function(_0x213721,_0xc41653){_0x213721=_0x213721-0x0;var _0x6435ee=_0xcbef[_0x213721];return _0x6435ee;};'use strict';var _=require(_0xfcbe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfcbe('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcbe('0x2'));var db=require(_0xfcbe('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfcbe('0x4'));var config=require(_0xfcbe('0x5'));var jayson=require(_0xfcbe('0x6'));var client=jayson['client'][_0xfcbe('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x174e14,_0x1f8a27,_0x1c7c00){return new BPromise(function(_0x4329c2,_0x22ab39){return client[_0xfcbe('0x8')](_0x174e14,_0x1c7c00)['then'](function(_0x1e2e26){logger[_0xfcbe('0x9')]('VoiceTransferReport,\x20%s,\x20%s',_0x1f8a27,'request\x20sent');logger[_0xfcbe('0xa')](_0xfcbe('0xb'),_0x1f8a27,'request\x20sent',JSON[_0xfcbe('0xc')](_0x1e2e26));if(_0x1e2e26[_0xfcbe('0xd')]){if(_0x1e2e26['error'][_0xfcbe('0xe')]===0x1f4){logger[_0xfcbe('0xd')](_0xfcbe('0xf'),_0x1f8a27,_0x1e2e26[_0xfcbe('0xd')][_0xfcbe('0x10')]);return _0x22ab39(_0x1e2e26[_0xfcbe('0xd')][_0xfcbe('0x10')]);}logger[_0xfcbe('0xd')](_0xfcbe('0xf'),_0x1f8a27,_0x1e2e26['error']['message']);return _0x4329c2(_0x1e2e26['error'][_0xfcbe('0x10')]);}else{logger[_0xfcbe('0x9')](_0xfcbe('0xf'),_0x1f8a27,_0xfcbe('0x11'));_0x4329c2(_0x1e2e26[_0xfcbe('0x12')][_0xfcbe('0x10')]);}})[_0xfcbe('0x13')](function(_0x22e341){logger[_0xfcbe('0xd')](_0xfcbe('0xf'),_0x1f8a27,_0x22e341);_0x22ab39(_0x22e341);});});}exports[_0xfcbe('0x14')]=function(_0x5ace0e){var _0x3c0438=this;return new Promise(function(_0xf44dc3,_0x28f5c7){return db[_0xfcbe('0x15')]['create'](_0x5ace0e[_0xfcbe('0x16')],{'raw':_0x5ace0e['options']?_0x5ace0e[_0xfcbe('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xfcbe('0x18')](function(_0x48333a){logger[_0xfcbe('0x9')](_0xfcbe('0x14'),_0x5ace0e);logger[_0xfcbe('0xa')](_0xfcbe('0x14'),_0x5ace0e,JSON[_0xfcbe('0xc')](_0x48333a));_0xf44dc3(_0x48333a);})['catch'](function(_0x4d472a){logger[_0xfcbe('0xd')]('CreateVoiceTransferReport',_0x4d472a[_0xfcbe('0x10')],_0x5ace0e);_0x28f5c7(_0x3c0438[_0xfcbe('0xd')](0x1f4,_0x4d472a[_0xfcbe('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 77dd86d..38f4f25 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 _0xbec5=['exports','express','Router','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer'];(function(_0x518794,_0x44630c){var _0x3c834a=function(_0x17677b){while(--_0x17677b){_0x518794['push'](_0x518794['shift']());}};_0x3c834a(++_0x44630c);}(_0xbec5,0xe5));var _0x5bec=function(_0xcfeff4,_0x3f2e19){_0xcfeff4=_0xcfeff4-0x0;var _0xb2fadc=_0xbec5[_0xcfeff4];return _0xb2fadc;};'use strict';var express=require(_0x5bec('0x0'));var router=express[_0x5bec('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5bec('0x2'));router[_0x5bec('0x3')](_0x5bec('0x4'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller['originate']);router[_0x5bec('0x3')](_0x5bec('0x7'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0x8')]);router[_0x5bec('0x3')](_0x5bec('0x9'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xa')]);router[_0x5bec('0x3')](_0x5bec('0xb'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller['hold']);router[_0x5bec('0x3')](_0x5bec('0xc'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0xd')]);router[_0x5bec('0x3')](_0x5bec('0xe'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xf')]);router['post'](_0x5bec('0x10'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0x11')]);module[_0x5bec('0x12')]=router; \ No newline at end of file +var _0x5b02=['Router','../../components/auth/service','./webbar.controller','isAuthenticated','originate','post','/hangup','isWebrtcLicence','/answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express'];(function(_0x4b9af1,_0x4f15ae){var _0x11911a=function(_0x4137a5){while(--_0x4137a5){_0x4b9af1['push'](_0x4b9af1['shift']());}};_0x11911a(++_0x4f15ae);}(_0x5b02,0xe9));var _0x25b0=function(_0x2aadae,_0x299e53){_0x2aadae=_0x2aadae-0x0;var _0x186462=_0x5b02[_0x2aadae];return _0x186462;};'use strict';var express=require(_0x25b0('0x0'));var router=express[_0x25b0('0x1')]();var auth=require(_0x25b0('0x2'));var controller=require(_0x25b0('0x3'));router['post']('/originate',auth[_0x25b0('0x4')](),auth['isWebrtcLicence'](),controller[_0x25b0('0x5')]);router[_0x25b0('0x6')](_0x25b0('0x7'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hangup']);router[_0x25b0('0x6')](_0x25b0('0x9'),auth['isAuthenticated'](),auth[_0x25b0('0x8')](),controller['answer']);router['post'](_0x25b0('0xa'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hold']);router[_0x25b0('0x6')](_0x25b0('0xb'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xc')]);router[_0x25b0('0x6')](_0x25b0('0xd'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xe')]);router[_0x25b0('0x6')](_0x25b0('0xf'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0x10')]);module[_0x25b0('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1078801..2fa7151 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 _0xac55=['stack','name','status','send','NotFound','request','then','error','message','catch','User','findOne','agent','VoiceChannels','filter','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','json','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','format','webbar:unhold','unhold\x20executed!','calls','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:'];(function(_0x557a73,_0xd3e559){var _0x501293=function(_0x333b93){while(--_0x333b93){_0x557a73['push'](_0x557a73['shift']());}};_0x501293(++_0xd3e559);}(_0xac55,0x1c8));var _0x5ac5=function(_0x27ad73,_0x40aa7c){_0x27ad73=_0x27ad73-0x0;var _0x58718a=_0xac55[_0x27ad73];return _0x58718a;};'use strict';var path=require(_0x5ac5('0x0'));var fs=require('fs');var _=require(_0x5ac5('0x1'));var db=require(_0x5ac5('0x2'))['db'];var config=require(_0x5ac5('0x3'));var util=require('util');var BPromise=require(_0x5ac5('0x4'));var jayson=require(_0x5ac5('0x5'));var amiClient=jayson[_0x5ac5('0x6')][_0x5ac5('0x7')]({'port':0x232a});var logger=require(_0x5ac5('0x8'))(_0x5ac5('0x9'));var Redis=require(_0x5ac5('0xa'));config['redis']=_['defaults'](config[_0x5ac5('0xb')],{'host':_0x5ac5('0xc'),'port':0x18eb});var io=require(_0x5ac5('0xd'))(new Redis(config[_0x5ac5('0xb')]));var Schema=require(_0x5ac5('0xe'));var originateValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],_0x5ac5('0x10')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x5ac5('0x11')},'callbackUrl':{'type':_0x5ac5('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':_0x5ac5('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':_0x5ac5('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':_0x5ac5('0x11'),'required':[!![],_0x5ac5('0x12')]},'transferNumber':{'type':_0x5ac5('0x11'),'required':[!![],_0x5ac5('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],_0x5ac5('0x10')]}});function emit(_0x30244d,_0x1282be,_0x34a95e){logger[_0x5ac5('0x14')](_0x30244d,_0x1282be,JSON[_0x5ac5('0x15')](_0x34a95e));io['to'](_0x30244d)['emit'](_0x1282be,_0x34a95e);}function handleError(_0x4e186a){return function(_0x5364a6){console[_0x5ac5('0x16')](_0x5ac5('0x17'),_0x5364a6,_0x5364a6 instanceof RangeError);logger['error'](_0x5364a6[_0x5ac5('0x18')]);if(_0x5364a6 instanceof RangeError){if(_0x5364a6['name']){delete _0x5364a6[_0x5ac5('0x19')];}_0x4e186a['status'](0x194)['send'](_0x5364a6);}else{if(_0x5364a6[_0x5ac5('0x19')]){delete _0x5364a6['name'];}_0x4e186a[_0x5ac5('0x1a')](0x1f4)[_0x5ac5('0x1b')](_0x5364a6);}};}function checkError(){return function(_0x5c21d8){if(!_0x5c21d8){throw new RangeError(_0x5ac5('0x1c'));}return _0x5c21d8;};}function respondWithRpcPromise(_0x4ac526,_0x29a44c){return new BPromise(function(_0x40bdbc,_0x47993e){var _0x47a898=amiClient;return _0x47a898[_0x5ac5('0x1d')](_0x4ac526,_0x29a44c)[_0x5ac5('0x1e')](function(_0x400308){if(_0x400308[_0x5ac5('0x1f')]){if(_0x400308[_0x5ac5('0x1f')]['code']===0x1f4){return _0x47993e(_0x400308[_0x5ac5('0x1f')][_0x5ac5('0x20')]);}return _0x40bdbc(_0x400308[_0x5ac5('0x1f')][_0x5ac5('0x20')]);}else{_0x40bdbc(_0x400308['result']);}})[_0x5ac5('0x21')](function(_0x4eda97){_0x47993e(_0x4eda97);});});}function getAgent(_0x17c507){return db[_0x5ac5('0x22')][_0x5ac5('0x23')]({'where':{'id':_0x17c507,'role':_0x5ac5('0x24')}})[_0x5ac5('0x1e')](checkError());}function getAgentCheckSession(_0x3b3ec0,_0x5ce67c){return new BPromise(function(_0x31f9cc,_0x4a5f4d){var _0x24e8c7=respondWithRpcPromise(_0x5ac5('0x25'));var _0x35535f=getAgent(_0x3b3ec0);Promise['all']([_0x24e8c7,_0x35535f])[_0x5ac5('0x1e')](function(_0x229941){var _0x21df31=_0x229941[0x0];var _0x21307c=_0x229941[0x1];var _0x4eafa1=_[_0x5ac5('0x26')](_0x21df31['rows'],function(_0x3414ba){return _0x3414ba[_0x5ac5('0x27')]==_0x21307c['id']&&_0x3414ba[_0x5ac5('0x28')]==_0x5ce67c;});if(_0x4eafa1[_0x5ac5('0x29')]==0x1){_0x31f9cc(_0x21307c);}else{_0x4a5f4d(new RangeError(_0x5ac5('0x2a')+_0x5ce67c+'\x20not\x20found!'));}});});}exports[_0x5ac5('0x2b')]=function(_0x21116,_0x36285d){logger['info'](_0x5ac5('0x2c'),_0x21116['body']);var _0x472782=originateValidation[_0x5ac5('0xe')](_0x21116[_0x5ac5('0x2d')]);if(_0x472782[_0x5ac5('0x29')]>0x0){return _0x36285d[_0x5ac5('0x1a')](0x190)['json'](_0x472782);}var _0x39a895=_0x21116['body'][_0x5ac5('0x2e')];var _0x5ae4af=_0x21116[_0x5ac5('0x2d')][_0x5ac5('0x2f')];var _0x47a5d8=_0x21116[_0x5ac5('0x2d')][_0x5ac5('0x30')];var _0x585e4b=_0x21116['body'][_0x5ac5('0x31')];return getAgent(_0x39a895)[_0x5ac5('0x1e')](function(_0x243204){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x243204[_0x5ac5('0x19')]);emit(util['format']('user:%s',_0x243204['name']),_0x5ac5('0x33'),{'callNumber':_0x5ae4af,'callerId':_0x47a5d8,'callbackUrl':_0x585e4b});return _0x36285d[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':_0x5ac5('0x34')});})[_0x5ac5('0x21')](handleError(_0x36285d));};exports[_0x5ac5('0x35')]=function(_0x38667d,_0x46290f){logger[_0x5ac5('0x14')](_0x5ac5('0x36'),_0x38667d[_0x5ac5('0x2d')]);var _0x2d726e=hangupValidation['validate'](_0x38667d[_0x5ac5('0x2d')]);if(_0x2d726e['length']>0x0){return _0x46290f[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x2d726e);}var _0x1ca0f0=_0x38667d[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x1ec79a=_0x38667d[_0x5ac5('0x2d')][_0x5ac5('0x28')];return getAgent(_0x1ca0f0)[_0x5ac5('0x1e')](function(_0x5105fc){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x5105fc['name']);emit(util['format'](_0x5ac5('0x38'),_0x5105fc['name']),_0x5ac5('0x39'),{'sessionId':_0x1ec79a});return _0x46290f[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0x5ac5('0x21')](handleError(_0x46290f));};exports[_0x5ac5('0x3a')]=function(_0x32cc92,_0x1475b0){logger[_0x5ac5('0x14')](_0x5ac5('0x3b'),_0x32cc92[_0x5ac5('0x2d')]);var _0x5a86a0=answerValidation[_0x5ac5('0xe')](_0x32cc92[_0x5ac5('0x2d')]);if(_0x5a86a0[_0x5ac5('0x29')]>0x0){return _0x1475b0[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x5a86a0);}var _0x3abf39=_0x32cc92['body'][_0x5ac5('0x2e')];var _0x24657d=_0x32cc92[_0x5ac5('0x2d')][_0x5ac5('0x28')];return getAgent(_0x3abf39)['then'](function(_0x228179){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x228179['name']);emit(util['format'](_0x5ac5('0x38'),_0x228179[_0x5ac5('0x19')]),_0x5ac5('0x3c'),{'sessionId':_0x24657d});return _0x1475b0[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':_0x5ac5('0x3d')});})['catch'](handleError(_0x1475b0));};exports[_0x5ac5('0x3e')]=function(_0x3dfeba,_0x4d90cf){logger[_0x5ac5('0x14')]('hold\x20fired:',_0x3dfeba[_0x5ac5('0x2d')]);var _0x3f26e0=holdValidation[_0x5ac5('0xe')](_0x3dfeba['body']);if(_0x3f26e0['length']>0x0){return _0x4d90cf[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x3f26e0);}var _0xd6ae55=_0x3dfeba[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x3534ce=_0x3dfeba[_0x5ac5('0x2d')][_0x5ac5('0x28')];return getAgent(_0xd6ae55)[_0x5ac5('0x1e')](function(_0x536765){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x536765[_0x5ac5('0x19')]);emit(util['format']('user:%s',_0x536765[_0x5ac5('0x19')]),_0x5ac5('0x3f'),{'sessionId':_0x3534ce});return _0x4d90cf[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':_0x5ac5('0x40')});})[_0x5ac5('0x21')](handleError(_0x4d90cf));};exports[_0x5ac5('0x41')]=function(_0x2a3396,_0x326f60){logger[_0x5ac5('0x14')](_0x5ac5('0x42'),_0x2a3396['body']);var _0x5ac4e3=unholdValidation['validate'](_0x2a3396[_0x5ac5('0x2d')]);if(_0x5ac4e3[_0x5ac5('0x29')]>0x0){return _0x326f60[_0x5ac5('0x1a')](0x190)['json'](_0x5ac4e3);}var _0x1973f6=_0x2a3396[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x286304=_0x2a3396[_0x5ac5('0x2d')]['sessionId'];return getAgent(_0x1973f6)['then'](function(_0x516ffd){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x516ffd[_0x5ac5('0x19')]);emit(util[_0x5ac5('0x43')](_0x5ac5('0x38'),_0x516ffd[_0x5ac5('0x19')]),_0x5ac5('0x44'),{'sessionId':_0x286304});return _0x326f60[_0x5ac5('0x1a')](0xc8)[_0x5ac5('0x37')]({'error':![],'message':_0x5ac5('0x45')});})[_0x5ac5('0x21')](handleError(_0x326f60));};exports[_0x5ac5('0x46')]=function(_0x447603,_0x252030){logger[_0x5ac5('0x14')]('calls\x20fired:',_0x252030[_0x5ac5('0x2d')]);var _0x360fb8=callsValidation['validate'](_0x447603[_0x5ac5('0x2d')]);if(_0x360fb8[_0x5ac5('0x29')]>0x0){return _0x252030[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x360fb8);}var _0x316af1=_0x447603[_0x5ac5('0x2d')]['userId'];var _0x2b5329=respondWithRpcPromise(_0x5ac5('0x25'));var _0x424bed=getAgent(_0x316af1);return Promise['all']([_0x2b5329,_0x424bed])[_0x5ac5('0x1e')](function(_0x44e349){var _0x4dd8be=_0x44e349[0x0];var _0x1a6428=_0x44e349[0x1];var _0x3227dc=_['filter'](_0x4dd8be['rows'],function(_0x4d1346){return _0x4d1346[_0x5ac5('0x27')]==_0x1a6428['id'];});return _0x252030[_0x5ac5('0x1a')](0xc8)[_0x5ac5('0x37')]({'count':_0x3227dc[_0x5ac5('0x29')],'rows':_0x3227dc});})[_0x5ac5('0x21')](handleError(_0x252030));};exports[_0x5ac5('0x47')]=function(_0x4ee231,_0x75ca64){logger[_0x5ac5('0x14')](_0x5ac5('0x48'),_0x4ee231[_0x5ac5('0x2d')]);var _0x1f9b9b=conferenceValidation['validate'](_0x4ee231['body']);if(_0x1f9b9b['length']>0x0){return _0x75ca64[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x1f9b9b);}var _0x334a1c=_0x4ee231[_0x5ac5('0x2d')]['userId'];return getAgent(_0x334a1c)[_0x5ac5('0x1e')](function(_0x38b128){logger[_0x5ac5('0x14')]('entityFound:',_0x38b128['name']);emit(util['format'](_0x5ac5('0x38'),_0x38b128[_0x5ac5('0x19')]),_0x5ac5('0x49'));return _0x75ca64[_0x5ac5('0x1a')](0xc8)[_0x5ac5('0x37')]({'error':![],'message':_0x5ac5('0x4a')});})['catch'](handleError(_0x75ca64));};exports[_0x5ac5('0x4b')]=function(_0x5532d6,_0x492179){logger[_0x5ac5('0x14')](_0x5ac5('0x4c'),_0x5532d6[_0x5ac5('0x2d')]);var _0x324ec9=transferValidation[_0x5ac5('0xe')](_0x5532d6[_0x5ac5('0x2d')]);if(_0x324ec9[_0x5ac5('0x29')]>0x0){return _0x492179[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x324ec9);}var _0x130c67=_0x5532d6[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x299b02=_0x5532d6[_0x5ac5('0x2d')][_0x5ac5('0x28')];var _0x46315b=_0x5532d6[_0x5ac5('0x2d')][_0x5ac5('0x4d')];return getAgent(_0x130c67)[_0x5ac5('0x1e')](function(_0xc95ae5){logger[_0x5ac5('0x14')]('entityFound:',_0xc95ae5[_0x5ac5('0x19')]);emit(util['format'](_0x5ac5('0x38'),_0xc95ae5['name']),_0x5ac5('0x4e'),{'sessionId':_0x299b02,'transferNumber':_0x46315b});return _0x492179['status'](0xc8)['json']({'error':![],'message':_0x5ac5('0x4f')});})['catch'](handleError(_0x492179));}; \ No newline at end of file +var _0x6b19=['originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','rows','UserId','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','jayson/promise','client','http','../../config/logger','webbarapi','redis','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','name','status','send','request','then','code','message','catch','User','all','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','validate','body','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6b19,0xe8));var _0x96b1=function(_0x16a1f1,_0x4b6f31){_0x16a1f1=_0x16a1f1-0x0;var _0x384567=_0x6b19[_0x16a1f1];return _0x384567;};'use strict';var path=require(_0x96b1('0x0'));var fs=require('fs');var _=require(_0x96b1('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x96b1('0x2'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x96b1('0x3'));var amiClient=jayson[_0x96b1('0x4')][_0x96b1('0x5')]({'port':0x232a});var logger=require(_0x96b1('0x6'))(_0x96b1('0x7'));var Redis=require('ioredis');config[_0x96b1('0x8')]=_['defaults'](config[_0x96b1('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x96b1('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x96b1('0xa'),'required':[!![],_0x96b1('0xb')]},'callerId':{'type':_0x96b1('0xa')},'callbackUrl':{'type':_0x96b1('0xa')}});var hangupValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]},'sessionId':{'type':_0x96b1('0xa'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x96b1('0xa'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x96b1('0xa'),'required':[!![],_0x96b1('0xd')]},'transferNumber':{'type':_0x96b1('0xa'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]},'sessionId':{'type':_0x96b1('0xa'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x96b1('0x9'),'required':[!![],_0x96b1('0xc')]}});function emit(_0x2cd1f5,_0x43b7f5,_0x24fa0f){logger[_0x96b1('0xe')](_0x2cd1f5,_0x43b7f5,JSON[_0x96b1('0xf')](_0x24fa0f));io['to'](_0x2cd1f5)[_0x96b1('0x10')](_0x43b7f5,_0x24fa0f);}function handleError(_0x450099){return function(_0x38478c){console[_0x96b1('0x11')](_0x96b1('0x12'),_0x38478c,_0x38478c instanceof RangeError);logger[_0x96b1('0x13')](_0x38478c['stack']);if(_0x38478c instanceof RangeError){if(_0x38478c[_0x96b1('0x14')]){delete _0x38478c['name'];}_0x450099[_0x96b1('0x15')](0x194)[_0x96b1('0x16')](_0x38478c);}else{if(_0x38478c[_0x96b1('0x14')]){delete _0x38478c['name'];}_0x450099[_0x96b1('0x15')](0x1f4)[_0x96b1('0x16')](_0x38478c);}};}function checkError(){return function(_0x48786f){if(!_0x48786f){throw new RangeError('NotFound');}return _0x48786f;};}function respondWithRpcPromise(_0x2b7d4d,_0x3595b7){return new BPromise(function(_0x35db4a,_0x18594b){var _0x555185=amiClient;return _0x555185[_0x96b1('0x17')](_0x2b7d4d,_0x3595b7)[_0x96b1('0x18')](function(_0xde249b){if(_0xde249b['error']){if(_0xde249b[_0x96b1('0x13')][_0x96b1('0x19')]===0x1f4){return _0x18594b(_0xde249b[_0x96b1('0x13')][_0x96b1('0x1a')]);}return _0x35db4a(_0xde249b['error'][_0x96b1('0x1a')]);}else{_0x35db4a(_0xde249b['result']);}})[_0x96b1('0x1b')](function(_0x4ad19f){_0x18594b(_0x4ad19f);});});}function getAgent(_0x6509d2){return db[_0x96b1('0x1c')]['findOne']({'where':{'id':_0x6509d2,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x3f24bc,_0x2e4420){return new BPromise(function(_0x18e56a,_0x444b0b){var _0x2a9229=respondWithRpcPromise('VoiceChannels');var _0x21a63f=getAgent(_0x3f24bc);Promise[_0x96b1('0x1d')]([_0x2a9229,_0x21a63f])[_0x96b1('0x18')](function(_0x209ce8){var _0x51e2c1=_0x209ce8[0x0];var _0x30dd00=_0x209ce8[0x1];var _0x33f96b=_['filter'](_0x51e2c1['rows'],function(_0x3666f8){return _0x3666f8['UserId']==_0x30dd00['id']&&_0x3666f8[_0x96b1('0x1e')]==_0x2e4420;});if(_0x33f96b[_0x96b1('0x1f')]==0x1){_0x18e56a(_0x30dd00);}else{_0x444b0b(new RangeError('sessionId\x20'+_0x2e4420+_0x96b1('0x20')));}});});}exports[_0x96b1('0x21')]=function(_0x5cb283,_0x36e049){logger[_0x96b1('0xe')](_0x96b1('0x22'),_0x5cb283['body']);var _0x2ac0bf=originateValidation[_0x96b1('0x23')](_0x5cb283[_0x96b1('0x24')]);if(_0x2ac0bf[_0x96b1('0x1f')]>0x0){return _0x36e049[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x2ac0bf);}var _0x55c5ec=_0x5cb283[_0x96b1('0x24')][_0x96b1('0x26')];var _0x50edd9=_0x5cb283['body'][_0x96b1('0x27')];var _0x1b1497=_0x5cb283[_0x96b1('0x24')]['callerId'];var _0x4ba6eb=_0x5cb283[_0x96b1('0x24')][_0x96b1('0x28')];return getAgent(_0x55c5ec)[_0x96b1('0x18')](function(_0x1721a4){logger['info'](_0x96b1('0x29'),_0x1721a4['name']);emit(util[_0x96b1('0x2a')](_0x96b1('0x2b'),_0x1721a4[_0x96b1('0x14')]),'webbar:originate',{'callNumber':_0x50edd9,'callerId':_0x1b1497,'callbackUrl':_0x4ba6eb});return _0x36e049[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x2c')});})[_0x96b1('0x1b')](handleError(_0x36e049));};exports[_0x96b1('0x2d')]=function(_0x370d03,_0x560fb6){logger[_0x96b1('0xe')](_0x96b1('0x2e'),_0x370d03['body']);var _0x320d31=hangupValidation['validate'](_0x370d03[_0x96b1('0x24')]);if(_0x320d31[_0x96b1('0x1f')]>0x0){return _0x560fb6[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x320d31);}var _0x30be03=_0x370d03[_0x96b1('0x24')][_0x96b1('0x26')];var _0x220d08=_0x370d03[_0x96b1('0x24')]['sessionId'];return getAgent(_0x30be03)[_0x96b1('0x18')](function(_0x4d3c9f){logger[_0x96b1('0xe')](_0x96b1('0x29'),_0x4d3c9f[_0x96b1('0x14')]);emit(util[_0x96b1('0x2a')](_0x96b1('0x2b'),_0x4d3c9f[_0x96b1('0x14')]),_0x96b1('0x2f'),{'sessionId':_0x220d08});return _0x560fb6[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x30')});})[_0x96b1('0x1b')](handleError(_0x560fb6));};exports[_0x96b1('0x31')]=function(_0x13529e,_0x49a73e){logger['info'](_0x96b1('0x32'),_0x13529e[_0x96b1('0x24')]);var _0x5282dd=answerValidation[_0x96b1('0x23')](_0x13529e[_0x96b1('0x24')]);if(_0x5282dd['length']>0x0){return _0x49a73e['status'](0x190)['json'](_0x5282dd);}var _0x3f8220=_0x13529e[_0x96b1('0x24')][_0x96b1('0x26')];var _0x458fd9=_0x13529e[_0x96b1('0x24')][_0x96b1('0x1e')];return getAgent(_0x3f8220)[_0x96b1('0x18')](function(_0x12fbb0){logger[_0x96b1('0xe')](_0x96b1('0x29'),_0x12fbb0['name']);emit(util[_0x96b1('0x2a')]('user:%s',_0x12fbb0[_0x96b1('0x14')]),'webbar:answer',{'sessionId':_0x458fd9});return _0x49a73e[_0x96b1('0x15')](0xc8)['json']({'error':![],'message':_0x96b1('0x33')});})[_0x96b1('0x1b')](handleError(_0x49a73e));};exports[_0x96b1('0x34')]=function(_0x266eaa,_0x1d2eb2){logger['info'](_0x96b1('0x35'),_0x266eaa[_0x96b1('0x24')]);var _0x1fdfe8=holdValidation['validate'](_0x266eaa[_0x96b1('0x24')]);if(_0x1fdfe8[_0x96b1('0x1f')]>0x0){return _0x1d2eb2[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x1fdfe8);}var _0x4919b2=_0x266eaa[_0x96b1('0x24')][_0x96b1('0x26')];var _0x4e6f7a=_0x266eaa[_0x96b1('0x24')][_0x96b1('0x1e')];return getAgent(_0x4919b2)[_0x96b1('0x18')](function(_0xc7b84b){logger[_0x96b1('0xe')](_0x96b1('0x29'),_0xc7b84b['name']);emit(util[_0x96b1('0x2a')]('user:%s',_0xc7b84b[_0x96b1('0x14')]),_0x96b1('0x36'),{'sessionId':_0x4e6f7a});return _0x1d2eb2['status'](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x37')});})['catch'](handleError(_0x1d2eb2));};exports[_0x96b1('0x38')]=function(_0xa66f17,_0x2087ba){logger[_0x96b1('0xe')](_0x96b1('0x39'),_0xa66f17[_0x96b1('0x24')]);var _0x8cd80b=unholdValidation[_0x96b1('0x23')](_0xa66f17[_0x96b1('0x24')]);if(_0x8cd80b[_0x96b1('0x1f')]>0x0){return _0x2087ba['status'](0x190)[_0x96b1('0x25')](_0x8cd80b);}var _0x220551=_0xa66f17[_0x96b1('0x24')][_0x96b1('0x26')];var _0x471177=_0xa66f17[_0x96b1('0x24')][_0x96b1('0x1e')];return getAgent(_0x220551)[_0x96b1('0x18')](function(_0x4d055a){logger['info'](_0x96b1('0x29'),_0x4d055a[_0x96b1('0x14')]);emit(util['format'](_0x96b1('0x2b'),_0x4d055a[_0x96b1('0x14')]),_0x96b1('0x3a'),{'sessionId':_0x471177});return _0x2087ba['status'](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x3b')});})['catch'](handleError(_0x2087ba));};exports['calls']=function(_0x31c32d,_0x19cc23){logger[_0x96b1('0xe')](_0x96b1('0x3c'),_0x19cc23[_0x96b1('0x24')]);var _0x3dc040=callsValidation[_0x96b1('0x23')](_0x31c32d[_0x96b1('0x24')]);if(_0x3dc040[_0x96b1('0x1f')]>0x0){return _0x19cc23[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x3dc040);}var _0x16ce91=_0x31c32d['body'][_0x96b1('0x26')];var _0x1a5134=respondWithRpcPromise(_0x96b1('0x3d'));var _0x22da91=getAgent(_0x16ce91);return Promise[_0x96b1('0x1d')]([_0x1a5134,_0x22da91])[_0x96b1('0x18')](function(_0x227cc2){var _0x51b672=_0x227cc2[0x0];var _0x10d5b7=_0x227cc2[0x1];var _0x50f400=_['filter'](_0x51b672[_0x96b1('0x3e')],function(_0x2964e5){return _0x2964e5[_0x96b1('0x3f')]==_0x10d5b7['id'];});return _0x19cc23[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'count':_0x50f400[_0x96b1('0x1f')],'rows':_0x50f400});})[_0x96b1('0x1b')](handleError(_0x19cc23));};exports['conference']=function(_0x26a496,_0x54f45a){logger[_0x96b1('0xe')]('conference\x20fired:',_0x26a496[_0x96b1('0x24')]);var _0x405366=conferenceValidation['validate'](_0x26a496[_0x96b1('0x24')]);if(_0x405366[_0x96b1('0x1f')]>0x0){return _0x54f45a[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x405366);}var _0x4c8edf=_0x26a496['body'][_0x96b1('0x26')];return getAgent(_0x4c8edf)[_0x96b1('0x18')](function(_0x474bad){logger[_0x96b1('0xe')]('entityFound:',_0x474bad[_0x96b1('0x14')]);emit(util[_0x96b1('0x2a')](_0x96b1('0x2b'),_0x474bad[_0x96b1('0x14')]),_0x96b1('0x40'));return _0x54f45a[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x41')});})[_0x96b1('0x1b')](handleError(_0x54f45a));};exports['transfer']=function(_0x4f62c1,_0x15f591){logger[_0x96b1('0xe')]('transfer\x20fired:',_0x4f62c1['body']);var _0x11bb4d=transferValidation[_0x96b1('0x23')](_0x4f62c1[_0x96b1('0x24')]);if(_0x11bb4d[_0x96b1('0x1f')]>0x0){return _0x15f591[_0x96b1('0x15')](0x190)[_0x96b1('0x25')](_0x11bb4d);}var _0x37b48d=_0x4f62c1['body']['userId'];var _0x316cfa=_0x4f62c1[_0x96b1('0x24')]['sessionId'];var _0x5edcee=_0x4f62c1[_0x96b1('0x24')][_0x96b1('0x42')];return getAgent(_0x37b48d)['then'](function(_0x1190d6){logger[_0x96b1('0xe')](_0x96b1('0x29'),_0x1190d6[_0x96b1('0x14')]);emit(util[_0x96b1('0x2a')](_0x96b1('0x2b'),_0x1190d6['name']),_0x96b1('0x43'),{'sessionId':_0x316cfa,'transferNumber':_0x5edcee});return _0x15f591[_0x96b1('0x15')](0xc8)[_0x96b1('0x25')]({'error':![],'message':_0x96b1('0x44')});})['catch'](handleError(_0x15f591));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index ff77598..f6ad7e8 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 _0x0b0e=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','post','create','addDisposition','/:id/canned_answers','addAgents','notify','put','update','delete','removeDispositions'];(function(_0x2f822f,_0x17538a){var _0x5c1ae9=function(_0x3b2b12){while(--_0x3b2b12){_0x2f822f['push'](_0x2f822f['shift']());}};_0x5c1ae9(++_0x17538a);}(_0x0b0e,0x187));var _0xe0b0=function(_0xfb65aa,_0x1651a6){_0xfb65aa=_0xfb65aa-0x0;var _0x2aee31=_0x0b0e[_0xfb65aa];return _0x2aee31;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/canned_answers',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x9')]('/:id/users',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x11')]);router[_0xe0b0('0x9')](_0xe0b0('0x12'),auth[_0xe0b0('0xa')](),controller['getApplications']);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0x15')]);router['post'](_0xe0b0('0x16'),auth[_0xe0b0('0xa')](),controller['addAnswer']);router[_0xe0b0('0x13')]('/:id/users',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x17')]);router['post']('/:id/applications',auth[_0xe0b0('0xa')](),controller['addApplications']);router['post']('/:id/notify',controller[_0xe0b0('0x18')]);router['post']('/:id/send',auth[_0xe0b0('0xa')](),controller['send']);router[_0xe0b0('0x19')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1a')]);router[_0xe0b0('0x1b')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['destroy']);router['delete'](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0x1c')]);router[_0xe0b0('0x1b')]('/:id/canned_answers',auth[_0xe0b0('0xa')](),controller['removeAnswers']);router[_0xe0b0('0x1b')]('/:id/users',auth[_0xe0b0('0xa')](),controller['removeAgents']);module[_0xe0b0('0x1d')]=router; \ No newline at end of file +var _0x01d9=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe'];(function(_0xb4df7d,_0xd352df){var _0x43bdc0=function(_0x1acafc){while(--_0x1acafc){_0xb4df7d['push'](_0xb4df7d['shift']());}};_0x43bdc0(++_0xd352df);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var fs_extra=require(_0x901d('0x5'));var auth=require(_0x901d('0x6'));var interaction=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var controller=require(_0x901d('0x9'));router[_0x901d('0xa')]('/',auth['isAuthenticated'](),controller[_0x901d('0xb')]);router[_0x901d('0xa')](_0x901d('0xc'),auth[_0x901d('0xd')](),controller[_0x901d('0xe')]);router[_0x901d('0xa')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x10')]);router[_0x901d('0xa')](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x12')]);router['get'](_0x901d('0x13'),auth['isAuthenticated'](),controller[_0x901d('0x14')]);router[_0x901d('0xa')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x16')]);router['get'](_0x901d('0x17'),auth[_0x901d('0xd')](),controller[_0x901d('0x18')]);router[_0x901d('0x19')]('/',auth[_0x901d('0xd')](),controller[_0x901d('0x1a')]);router['post'](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x1b')]);router[_0x901d('0x19')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x1c')]);router[_0x901d('0x19')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x1d')]);router[_0x901d('0x19')](_0x901d('0x17'),auth[_0x901d('0xd')](),controller[_0x901d('0x1e')]);router[_0x901d('0x19')](_0x901d('0x1f'),controller[_0x901d('0x20')]);router['post'](_0x901d('0x21'),auth[_0x901d('0xd')](),controller['send']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x901d('0x22')]);router[_0x901d('0x23')]('/:id',auth[_0x901d('0xd')](),controller[_0x901d('0x24')]);router['delete'](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x25')]);router[_0x901d('0x23')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x26')]);router[_0x901d('0x23')]('/:id/users',auth[_0x901d('0xd')](),controller[_0x901d('0x27')]);module[_0x901d('0x28')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index b542f59..2876bc2 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 _0x3c48=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x375126,_0x514a8e){var _0x1f76bb=function(_0x22f2d0){while(--_0x22f2d0){_0x375126['push'](_0x375126['shift']());}};_0x1f76bb(++_0x514a8e);}(_0x3c48,0x145));var _0x83c4=function(_0x4ff7d4,_0x596df8){_0x4ff7d4=_0x4ff7d4-0x0;var _0x43fe98=_0x3c48[_0x4ff7d4];return _0x43fe98;};'use strict';var Sequelize=require(_0x83c4('0x0'));var rs=require('randomstring');module[_0x83c4('0x1')]={'name':{'type':Sequelize[_0x83c4('0x2')],'unique':_0x83c4('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x83c4('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x83c4('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x83c4('0x4')]();}},'phone':{'type':Sequelize[_0x83c4('0x2')]},'type':{'type':Sequelize['ENUM'](_0x83c4('0x5'),_0x83c4('0x6'))},'accountSid':{'type':Sequelize[_0x83c4('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x83c4('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x83c4('0x7');}},'notificationSound':{'type':Sequelize[_0x83c4('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x83c4('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x83c4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x83c4('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x83c4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x83c4('0x9')],'comment':_0x83c4('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4dbb66){if(!_0x4dbb66){this[_0x83c4('0xb')](_0x83c4('0xc'),null);}this['setDataValue'](_0x83c4('0xd'),_0x4dbb66);}},'description':{'type':Sequelize[_0x83c4('0x2')]}}; \ No newline at end of file +var _0x9733=['sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x57ca9b,_0x5cb367){var _0x35bf2f=function(_0x10a298){while(--_0x10a298){_0x57ca9b['push'](_0x57ca9b['shift']());}};_0x35bf2f(++_0x5cb367);}(_0x9733,0x177));var _0x3973=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9733[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3973('0x0'));var rs=require(_0x3973('0x1'));module[_0x3973('0x2')]={'name':{'type':Sequelize[_0x3973('0x3')],'unique':_0x3973('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x3973('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3973('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x3973('0x5')]();}},'phone':{'type':Sequelize[_0x3973('0x3')]},'type':{'type':Sequelize[_0x3973('0x6')](_0x3973('0x7'),'sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x3973('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x3973('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3973('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3973('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3973('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3973('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3973('0x9')],'comment':_0x3973('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x3973('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x360f78){if(!_0x360f78){this[_0x3973('0xc')](_0x3973('0xd'),null);}this[_0x3973('0xc')](_0x3973('0xe'),_0x360f78);}},'description':{'type':Sequelize[_0x3973('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index f9affc0..8fd6805 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 _0x6161=['MessageSid','notifications','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','interaction','autoclose','applications','push','close','unmanaged','*,*,*,*','created','ContactId','UserId','unshift','agent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','List','WhatsappInteraction','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','WhatsappAccounts','stack','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','include','WhatsappAccount','findAll','show','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','WhatsappAccountId','Disposition','getDispositions','findOne','pick','includeAll','rows','removeDispositions','ids','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId'];(function(_0x557821,_0x14ccc6){var _0x5cc9c8=function(_0x397bf2){while(--_0x397bf2){_0x557821['push'](_0x557821['shift']());}};_0x5cc9c8(++_0x14ccc6);}(_0x6161,0xe9));var _0x1616=function(_0x2d50bb,_0x2674c3){_0x2d50bb=_0x2d50bb-0x0;var _0x24a7c8=_0x6161[_0x2d50bb];return _0x24a7c8;};'use strict';var emlformat=require(_0x1616('0x0'));var rimraf=require(_0x1616('0x1'));var zipdir=require(_0x1616('0x2'));var jsonpatch=require(_0x1616('0x3'));var rp=require('request-promise');var moment=require(_0x1616('0x4'));var BPromise=require(_0x1616('0x5'));var Mustache=require(_0x1616('0x6'));var util=require(_0x1616('0x7'));var path=require('path');var sox=require(_0x1616('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1616('0x9'));var _=require(_0x1616('0xa'));var squel=require('squel');var crypto=require(_0x1616('0xb'));var jsforce=require(_0x1616('0xc'));var deskjs=require(_0x1616('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1616('0xe'));var Papa=require(_0x1616('0xf'));var Redis=require(_0x1616('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1616('0x11'));var as=require(_0x1616('0x12'));var hardwareService=require(_0x1616('0x13'));var logger=require('../../config/logger')(_0x1616('0x14'));var utils=require('../../config/utils');var config=require(_0x1616('0x15'));var licenseUtil=require(_0x1616('0x16'));var db=require(_0x1616('0x17'))['db'];config[_0x1616('0x18')]=_[_0x1616('0x19')](config[_0x1616('0x18')],{'host':_0x1616('0x1a'),'port':0x18eb});var socket=require(_0x1616('0x1b'))(new Redis(config[_0x1616('0x18')]));require(_0x1616('0x1c'))[_0x1616('0x1d')](socket);var jayson=require(_0x1616('0x1e'));var client=jayson[_0x1616('0x1f')][_0x1616('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x2af4fa,_0x7a59ce,_0x126d06,_0x126de2){return new BPromise(function(_0x385e88,_0x56a832){var _0x1c83b3=_0x126de2||client;return _0x1c83b3['request'](_0x2af4fa,_0x126d06)['then'](function(_0x303454){logger[_0x1616('0x21')](_0x1616('0x22'),_0x7a59ce,_0x1616('0x23'));logger[_0x1616('0x24')](_0x1616('0x25'),_0x7a59ce,_0x1616('0x23'),JSON[_0x1616('0x26')](_0x303454));if(_0x303454[_0x1616('0x27')]){if(_0x303454[_0x1616('0x27')]['code']===0x1f4){logger[_0x1616('0x27')](_0x1616('0x22'),_0x7a59ce,_0x303454['error'][_0x1616('0x28')]);return _0x56a832(_0x303454[_0x1616('0x27')][_0x1616('0x28')]);}logger[_0x1616('0x27')](_0x1616('0x22'),_0x7a59ce,_0x303454['error']['message']);return _0x385e88(_0x303454['error'][_0x1616('0x28')]);}else{logger[_0x1616('0x21')](_0x1616('0x22'),_0x7a59ce,_0x1616('0x23'));_0x385e88(_0x303454[_0x1616('0x29')][_0x1616('0x28')]);}})[_0x1616('0x2a')](function(_0x24782c){logger[_0x1616('0x27')](_0x1616('0x22'),_0x7a59ce,_0x24782c);_0x56a832(_0x24782c);});});}function respondWithStatusCode(_0x1a62b2,_0x23f0c9){_0x23f0c9=_0x23f0c9||0xcc;return function(_0x2e1f49){if(_0x2e1f49){return _0x1a62b2[_0x1616('0x2b')](_0x23f0c9);}return _0x1a62b2[_0x1616('0x2c')](_0x23f0c9)[_0x1616('0x2d')]();};}function respondWithResult(_0x4da8da,_0xfc9ec5){_0xfc9ec5=_0xfc9ec5||0xc8;return function(_0x33d224){if(_0x33d224){return _0x4da8da[_0x1616('0x2c')](_0xfc9ec5)[_0x1616('0x2e')](_0x33d224);}};}function respondWithFilteredResult(_0x4712e6,_0x13f679){return function(_0x5efc3c){if(_0x5efc3c){var _0x526c1f=typeof _0x13f679[_0x1616('0x2f')]===_0x1616('0x30')&&typeof _0x13f679['limit']===_0x1616('0x30');var _0x295bf9=_0x5efc3c[_0x1616('0x31')];var _0x14ce10=_0x526c1f?0x0:_0x13f679[_0x1616('0x2f')];var _0x3f3e3a=_0x526c1f?_0x5efc3c[_0x1616('0x31')]:_0x13f679[_0x1616('0x2f')]+_0x13f679[_0x1616('0x32')];var _0x29ac4a;if(_0x3f3e3a>=_0x295bf9){_0x3f3e3a=_0x295bf9;_0x29ac4a=0xc8;}else{_0x29ac4a=0xce;}_0x4712e6[_0x1616('0x2c')](_0x29ac4a);return _0x4712e6[_0x1616('0x33')](_0x1616('0x34'),_0x14ce10+'-'+_0x3f3e3a+'/'+_0x295bf9)[_0x1616('0x2e')](_0x5efc3c);}return null;};}function patchUpdates(_0x26a6d5){return function(_0x1db693){try{jsonpatch['apply'](_0x1db693,_0x26a6d5,!![]);}catch(_0x16898f){return BPromise[_0x1616('0x35')](_0x16898f);}return _0x1db693[_0x1616('0x36')]();};}function saveUpdates(_0x24ca75,_0x562554){return function(_0x3d20a7){if(_0x3d20a7){return _0x3d20a7[_0x1616('0x37')](_0x24ca75)[_0x1616('0x38')](function(_0x2ceb8b){return _0x2ceb8b;});}return null;};}function removeEntity(_0x472793,_0x215a87){return function(_0x14c6a7){if(_0x14c6a7){return _0x14c6a7[_0x1616('0x39')]()[_0x1616('0x38')](function(){var _0x256a87=_0x14c6a7[_0x1616('0x3a')]({'plain':!![]});var _0x409f43=_0x1616('0x3b');return db['UserProfileResource'][_0x1616('0x39')]({'where':{'type':_0x409f43,'resourceId':_0x256a87['id']}})[_0x1616('0x38')](function(){return _0x14c6a7;});})['then'](function(){_0x472793[_0x1616('0x2c')](0xcc)[_0x1616('0x2d')]();});}};}function handleEntityNotFound(_0x475b91,_0x521dc4){return function(_0x5db7a6){if(!_0x5db7a6){_0x475b91[_0x1616('0x2b')](0x194);}return _0x5db7a6;};}function handleError(_0x2df177,_0x26a247){_0x26a247=_0x26a247||0x1f4;return function(_0x58f523){logger['error'](_0x58f523[_0x1616('0x3c')]);if(_0x58f523['name']){delete _0x58f523['name'];}_0x2df177[_0x1616('0x2c')](_0x26a247)['send'](_0x58f523);};}exports[_0x1616('0x3d')]=function(_0x1c15f4,_0x23fcaf){var _0x3f5f88={'include':[{'model':db[_0x1616('0x3e')],'as':_0x1616('0x3f')}]},_0x426689={},_0x453a52={'count':0x0,'rows':[]};var _0x259fc0=_[_0x1616('0x40')](db['WhatsappAccount'][_0x1616('0x41')],function(_0x5624f8){return{'name':_0x5624f8['fieldName'],'type':_0x5624f8[_0x1616('0x42')][_0x1616('0x43')]};});_0x426689[_0x1616('0x44')]=_[_0x1616('0x40')](_0x259fc0,_0x1616('0x45'));_0x426689['query']=_['keys'](_0x1c15f4[_0x1616('0x46')]);_0x426689[_0x1616('0x47')]=_[_0x1616('0x48')](_0x426689[_0x1616('0x44')],_0x426689['query']);_0x3f5f88[_0x1616('0x49')]=_[_0x1616('0x48')](_0x426689['model'],qs[_0x1616('0x4a')](_0x1c15f4[_0x1616('0x46')][_0x1616('0x4a')]));_0x3f5f88[_0x1616('0x49')]=_0x3f5f88['attributes'][_0x1616('0x4b')]?_0x3f5f88[_0x1616('0x49')]:_0x426689[_0x1616('0x44')];if(!_0x1c15f4[_0x1616('0x46')][_0x1616('0x4c')](_0x1616('0x4d'))){_0x3f5f88[_0x1616('0x32')]=qs[_0x1616('0x32')](_0x1c15f4[_0x1616('0x46')][_0x1616('0x32')]);_0x3f5f88['offset']=qs['offset'](_0x1c15f4[_0x1616('0x46')][_0x1616('0x2f')]);}_0x3f5f88[_0x1616('0x4e')]=qs[_0x1616('0x4f')](_0x1c15f4[_0x1616('0x46')]['sort']);_0x3f5f88[_0x1616('0x50')]=qs['filters'](_['pick'](_0x1c15f4[_0x1616('0x46')],_0x426689[_0x1616('0x47')]),_0x259fc0);if(_0x1c15f4[_0x1616('0x46')]['filter']){_0x3f5f88[_0x1616('0x50')]=_[_0x1616('0x51')](_0x3f5f88[_0x1616('0x50')],{'$or':_[_0x1616('0x40')](_0x259fc0,function(_0x3f830e){if(_0x3f830e[_0x1616('0x42')]!==_0x1616('0x52')){var _0x58ecd={};_0x58ecd[_0x3f830e[_0x1616('0x45')]]={'$like':'%'+_0x1c15f4[_0x1616('0x46')][_0x1616('0x53')]+'%'};return _0x58ecd;}})});}_0x3f5f88=_[_0x1616('0x51')]({},_0x3f5f88,_0x1c15f4['options']);var _0x4a9e9f={'where':_0x3f5f88['where']};return db['WhatsappAccount']['count'](_0x4a9e9f)['then'](function(_0x44913a){_0x453a52[_0x1616('0x31')]=_0x44913a;if(_0x1c15f4[_0x1616('0x46')]['includeAll']){_0x3f5f88[_0x1616('0x54')]=[{'all':!![]}];}return db[_0x1616('0x55')][_0x1616('0x56')](_0x3f5f88);})[_0x1616('0x38')](function(_0x1b9451){_0x453a52['rows']=_0x1b9451;return _0x453a52;})[_0x1616('0x38')](respondWithFilteredResult(_0x23fcaf,_0x3f5f88))[_0x1616('0x2a')](handleError(_0x23fcaf,null));};exports[_0x1616('0x57')]=function(_0x288e2e,_0x18e9a6){var _0x4bc9e3={'raw':![],'where':{'id':_0x288e2e[_0x1616('0x58')]['id']},'include':[{'model':db[_0x1616('0x3e')],'as':'mandatoryDispositionPause'}]},_0x21e827={};_0x21e827[_0x1616('0x44')]=_[_0x1616('0x59')](db[_0x1616('0x55')]['rawAttributes']);_0x21e827['query']=_[_0x1616('0x59')](_0x288e2e['query']);_0x21e827['filters']=_['intersection'](_0x21e827[_0x1616('0x44')],_0x21e827[_0x1616('0x46')]);_0x4bc9e3[_0x1616('0x49')]=_['intersection'](_0x21e827[_0x1616('0x44')],qs[_0x1616('0x4a')](_0x288e2e[_0x1616('0x46')][_0x1616('0x4a')]));_0x4bc9e3[_0x1616('0x49')]=_0x4bc9e3[_0x1616('0x49')][_0x1616('0x4b')]?_0x4bc9e3[_0x1616('0x49')]:_0x21e827['model'];if(_0x288e2e[_0x1616('0x46')]['includeAll']){_0x4bc9e3[_0x1616('0x54')]=[{'all':!![]}];}_0x4bc9e3=_[_0x1616('0x51')]({},_0x4bc9e3,_0x288e2e[_0x1616('0x5a')]);return db[_0x1616('0x55')][_0x1616('0x5b')](_0x4bc9e3)['then'](handleEntityNotFound(_0x18e9a6,null))[_0x1616('0x38')](respondWithResult(_0x18e9a6,null))[_0x1616('0x2a')](handleError(_0x18e9a6,null));};exports[_0x1616('0x5c')]=function(_0x39546a,_0x51575e){return db[_0x1616('0x55')][_0x1616('0x5c')](_0x39546a['body'],{})[_0x1616('0x38')](function(_0x17c216){var _0x35c711=_0x39546a[_0x1616('0x5d')][_0x1616('0x3a')]({'plain':!![]});if(!_0x35c711)throw new Error(_0x1616('0x5e'));if(_0x35c711[_0x1616('0x5f')]===_0x1616('0x5d')){var _0x2ed6db=_0x17c216[_0x1616('0x3a')]({'plain':!![]});var _0x5881bb=_0x1616('0x3b');return db[_0x1616('0x60')][_0x1616('0x5b')]({'where':{'name':_0x5881bb,'userProfileId':_0x35c711['userProfileId']},'raw':!![]})[_0x1616('0x38')](function(_0x425f21){if(_0x425f21&&_0x425f21[_0x1616('0x61')]===0x0){return db[_0x1616('0x62')][_0x1616('0x5c')]({'name':_0x2ed6db[_0x1616('0x45')],'resourceId':_0x2ed6db['id'],'type':_0x425f21[_0x1616('0x45')],'sectionId':_0x425f21['id']},{})[_0x1616('0x38')](function(){return _0x17c216;});}else{return _0x17c216;}})['catch'](function(_0x5def68){logger['error'](_0x1616('0x63'),_0x5def68);throw _0x5def68;});}return _0x17c216;})[_0x1616('0x38')](respondWithResult(_0x51575e,0xc9))['catch'](handleError(_0x51575e,null));};exports['update']=function(_0x4164a8,_0x40752e){if(_0x4164a8['body']['id']){delete _0x4164a8[_0x1616('0x64')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x4164a8[_0x1616('0x58')]['id']},'include':[{'model':db[_0x1616('0x3e')],'as':_0x1616('0x3f')}]})[_0x1616('0x38')](handleEntityNotFound(_0x40752e,null))[_0x1616('0x38')](saveUpdates(_0x4164a8[_0x1616('0x64')],null))['then'](respondWithResult(_0x40752e,null))['catch'](handleError(_0x40752e,null));};exports[_0x1616('0x39')]=function(_0x49bd67,_0x1acfd8){return db['WhatsappAccount'][_0x1616('0x5b')]({'where':{'id':_0x49bd67[_0x1616('0x58')]['id']}})[_0x1616('0x38')](handleEntityNotFound(_0x1acfd8,null))[_0x1616('0x38')](removeEntity(_0x1acfd8,null))[_0x1616('0x2a')](handleError(_0x1acfd8,null));};exports['describe']=function(_0x2d640e,_0xa4ff03){return db['WhatsappAccount'][_0x1616('0x65')]()[_0x1616('0x38')](respondWithResult(_0xa4ff03,null))[_0x1616('0x2a')](handleError(_0xa4ff03,null));};exports['addDisposition']=function(_0x46d242,_0x34c653,_0x500850){if(_0x46d242[_0x1616('0x64')]['id']){delete _0x46d242[_0x1616('0x64')]['id'];}return db[_0x1616('0x55')][_0x1616('0x5b')]({'where':{'id':_0x46d242[_0x1616('0x58')]['id']}})[_0x1616('0x38')](handleEntityNotFound(_0x34c653,null))[_0x1616('0x38')](function(_0x1982d1){if(_0x1982d1){_0x46d242[_0x1616('0x64')][_0x1616('0x66')]=_0x1982d1['id'];return db[_0x1616('0x67')]['create'](_0x46d242[_0x1616('0x64')]);}})[_0x1616('0x38')](respondWithResult(_0x34c653,null))['catch'](handleError(_0x34c653,null));};exports[_0x1616('0x68')]=function(_0x48b8d2,_0x227145,_0x3f724f){var _0x37f54e={'raw':![],'where':{}};var _0x3274fb={};var _0x5c9d8d={'count':0x0,'rows':[]};return db[_0x1616('0x55')][_0x1616('0x69')]({'where':{'id':_0x48b8d2[_0x1616('0x58')]['id']}})[_0x1616('0x38')](handleEntityNotFound(_0x227145,null))[_0x1616('0x38')](function(_0x562090){if(_0x562090){_0x3274fb[_0x1616('0x44')]=_[_0x1616('0x59')](db[_0x1616('0x67')][_0x1616('0x41')]);_0x3274fb[_0x1616('0x46')]=_[_0x1616('0x59')](_0x48b8d2[_0x1616('0x46')]);_0x3274fb[_0x1616('0x47')]=_[_0x1616('0x48')](_0x3274fb[_0x1616('0x44')],_0x3274fb[_0x1616('0x46')]);_0x37f54e[_0x1616('0x49')]=_[_0x1616('0x48')](_0x3274fb[_0x1616('0x44')],qs[_0x1616('0x4a')](_0x48b8d2[_0x1616('0x46')][_0x1616('0x4a')]));_0x37f54e[_0x1616('0x49')]=_0x37f54e[_0x1616('0x49')][_0x1616('0x4b')]?_0x37f54e['attributes']:_0x3274fb[_0x1616('0x44')];if(!_0x48b8d2[_0x1616('0x46')][_0x1616('0x4c')](_0x1616('0x4d'))){_0x37f54e[_0x1616('0x32')]=qs[_0x1616('0x32')](_0x48b8d2[_0x1616('0x46')][_0x1616('0x32')]);_0x37f54e['offset']=qs['offset'](_0x48b8d2['query']['offset']);}_0x37f54e[_0x1616('0x4e')]=qs[_0x1616('0x4f')](_0x48b8d2[_0x1616('0x46')]['sort']);_0x37f54e['where']=qs[_0x1616('0x47')](_[_0x1616('0x6a')](_0x48b8d2[_0x1616('0x46')],_0x3274fb[_0x1616('0x47')]));_0x37f54e[_0x1616('0x50')]['WhatsappAccountId']=_0x562090['id'];if(_0x48b8d2[_0x1616('0x46')][_0x1616('0x53')]){_0x37f54e[_0x1616('0x50')]=_[_0x1616('0x51')](_0x37f54e['where'],{'$or':_[_0x1616('0x40')](_0x37f54e[_0x1616('0x49')],function(_0x193a8b){var _0x8734a3={};_0x8734a3[_0x193a8b]={'$like':'%'+_0x48b8d2['query'][_0x1616('0x53')]+'%'};return _0x8734a3;})});}_0x37f54e=_[_0x1616('0x51')]({},_0x37f54e,_0x48b8d2[_0x1616('0x5a')]);return db[_0x1616('0x67')][_0x1616('0x31')]({'where':_0x37f54e[_0x1616('0x50')]})[_0x1616('0x38')](function(_0x5178ad){_0x5c9d8d[_0x1616('0x31')]=_0x5178ad;if(_0x48b8d2[_0x1616('0x46')][_0x1616('0x6b')]){_0x37f54e['include']=[{'all':!![]}];}return db[_0x1616('0x67')]['findAll'](_0x37f54e);})[_0x1616('0x38')](function(_0x45a9dd){_0x5c9d8d[_0x1616('0x6c')]=_0x45a9dd;return _0x5c9d8d;});}})[_0x1616('0x38')](respondWithFilteredResult(_0x227145,_0x37f54e))[_0x1616('0x2a')](handleError(_0x227145,null));};exports['removeDispositions']=function(_0x5b02c3,_0x4a24cb,_0xfdb2d1){return db[_0x1616('0x55')][_0x1616('0x5b')]({'where':{'id':_0x5b02c3[_0x1616('0x58')]['id']}})[_0x1616('0x38')](handleEntityNotFound(_0x4a24cb,null))[_0x1616('0x38')](function(_0x52bcb4){if(_0x52bcb4){return _0x52bcb4[_0x1616('0x6d')](_0x5b02c3[_0x1616('0x46')][_0x1616('0x6e')]);}})[_0x1616('0x38')](respondWithStatusCode(_0x4a24cb,null))[_0x1616('0x2a')](handleError(_0x4a24cb,null));};exports['addAnswer']=function(_0x43fe03,_0x34f5c2,_0x583c32){if(_0x43fe03[_0x1616('0x64')]['id']){delete _0x43fe03[_0x1616('0x64')]['id'];}return db[_0x1616('0x55')]['find']({'where':{'id':_0x43fe03[_0x1616('0x58')]['id']}})['then'](handleEntityNotFound(_0x34f5c2,null))[_0x1616('0x38')](function(_0x5dde81){if(_0x5dde81){_0x43fe03[_0x1616('0x64')]['WhatsappAccountId']=_0x5dde81['id'];return db[_0x1616('0x6f')][_0x1616('0x5c')](_0x43fe03[_0x1616('0x64')]);}})[_0x1616('0x38')](respondWithResult(_0x34f5c2,null))['catch'](handleError(_0x34f5c2,null));};exports['getAnswers']=function(_0x22d9f9,_0x532261,_0x1bc57e){var _0x1265de={'raw':![],'where':{}};var _0x3e34e6={};var _0x1e8527={'count':0x0,'rows':[]};return db[_0x1616('0x55')][_0x1616('0x69')]({'where':{'id':_0x22d9f9['params']['id']}})['then'](handleEntityNotFound(_0x532261,null))['then'](function(_0x8f9e7f){if(_0x8f9e7f){_0x3e34e6[_0x1616('0x44')]=_[_0x1616('0x59')](db[_0x1616('0x6f')][_0x1616('0x41')]);_0x3e34e6['query']=_[_0x1616('0x59')](_0x22d9f9[_0x1616('0x46')]);_0x3e34e6['filters']=_['intersection'](_0x3e34e6[_0x1616('0x44')],_0x3e34e6[_0x1616('0x46')]);_0x1265de[_0x1616('0x49')]=_[_0x1616('0x48')](_0x3e34e6['model'],qs[_0x1616('0x4a')](_0x22d9f9['query'][_0x1616('0x4a')]));_0x1265de[_0x1616('0x49')]=_0x1265de[_0x1616('0x49')]['length']?_0x1265de[_0x1616('0x49')]:_0x3e34e6['model'];if(!_0x22d9f9[_0x1616('0x46')][_0x1616('0x4c')](_0x1616('0x4d'))){_0x1265de['limit']=qs[_0x1616('0x32')](_0x22d9f9[_0x1616('0x46')][_0x1616('0x32')]);_0x1265de[_0x1616('0x2f')]=qs[_0x1616('0x2f')](_0x22d9f9['query'][_0x1616('0x2f')]);}_0x1265de[_0x1616('0x4e')]=qs[_0x1616('0x4f')](_0x22d9f9[_0x1616('0x46')]['sort']);_0x1265de[_0x1616('0x50')]=qs[_0x1616('0x47')](_[_0x1616('0x6a')](_0x22d9f9[_0x1616('0x46')],_0x3e34e6['filters']));_0x1265de[_0x1616('0x50')][_0x1616('0x66')]=_0x8f9e7f['id'];if(_0x22d9f9[_0x1616('0x46')][_0x1616('0x53')]){_0x1265de['where']=_[_0x1616('0x51')](_0x1265de[_0x1616('0x50')],{'$or':_[_0x1616('0x40')](_0x1265de[_0x1616('0x49')],function(_0x29a56b){var _0x3be55a={};_0x3be55a[_0x29a56b]={'$like':'%'+_0x22d9f9[_0x1616('0x46')][_0x1616('0x53')]+'%'};return _0x3be55a;})});}_0x1265de=_[_0x1616('0x51')]({},_0x1265de,_0x22d9f9['options']);return db[_0x1616('0x6f')][_0x1616('0x31')]({'where':_0x1265de[_0x1616('0x50')]})[_0x1616('0x38')](function(_0x57ce1e){_0x1e8527[_0x1616('0x31')]=_0x57ce1e;if(_0x22d9f9['query'][_0x1616('0x6b')]){_0x1265de[_0x1616('0x54')]=[{'all':!![]}];}return db[_0x1616('0x6f')][_0x1616('0x56')](_0x1265de);})[_0x1616('0x38')](function(_0x402cd2){_0x1e8527[_0x1616('0x6c')]=_0x402cd2;return _0x1e8527;});}})['then'](respondWithFilteredResult(_0x532261,_0x1265de))[_0x1616('0x2a')](handleError(_0x532261,null));};exports[_0x1616('0x70')]=function(_0x318f0c,_0x242ea4,_0x5f09e8){return db[_0x1616('0x55')][_0x1616('0x5b')]({'where':{'id':_0x318f0c[_0x1616('0x58')]['id']}})[_0x1616('0x38')](handleEntityNotFound(_0x242ea4,null))[_0x1616('0x38')](function(_0x5822de){if(_0x5822de){return _0x5822de[_0x1616('0x70')](_0x318f0c[_0x1616('0x46')][_0x1616('0x6e')]);}})[_0x1616('0x38')](respondWithStatusCode(_0x242ea4,null))[_0x1616('0x2a')](handleError(_0x242ea4,null));};exports['addAgents']=function(_0x5a5736,_0x4a3ba2,_0x2da531){return db[_0x1616('0x55')]['find']({'where':{'id':_0x5a5736[_0x1616('0x58')]['id']}})[_0x1616('0x38')](handleEntityNotFound(_0x4a3ba2,null))[_0x1616('0x38')](function(_0x58499b){if(_0x58499b){return _0x58499b[_0x1616('0x71')](_0x5a5736['body']['ids'],_[_0x1616('0x72')](_0x5a5736[_0x1616('0x64')],[_0x1616('0x6e'),'id'])||{})[_0x1616('0x73')](function(_0x33f88e){for(var _0x29fd0f=0x0;_0x29fd0f<_0x5a5736[_0x1616('0x64')][_0x1616('0x6e')][_0x1616('0x4b')];_0x29fd0f+=0x1){socket[_0x1616('0x74')](_0x1616('0x75'),{'UserId':Number(_0x5a5736[_0x1616('0x64')]['ids'][_0x29fd0f]),'WhatsappAccountId':Number(_0x5a5736[_0x1616('0x58')]['id'])});}return _0x33f88e;});}})[_0x1616('0x38')](respondWithResult(_0x4a3ba2,null))[_0x1616('0x2a')](handleError(_0x4a3ba2,null));};exports['removeAgents']=function(_0x46e6bb,_0x3d97f4,_0x219e64){return db['WhatsappAccount'][_0x1616('0x5b')]({'where':{'id':_0x46e6bb[_0x1616('0x58')]['id']}})[_0x1616('0x38')](handleEntityNotFound(_0x3d97f4,null))[_0x1616('0x38')](function(_0x68ac3b){if(_0x68ac3b){return _0x68ac3b[_0x1616('0x76')](_0x46e6bb[_0x1616('0x46')][_0x1616('0x6e')])['then'](function(){if(_['isArray'](_0x46e6bb['query'][_0x1616('0x6e')])){for(var _0x3f8220=0x0;_0x3f8220<_0x46e6bb[_0x1616('0x46')][_0x1616('0x6e')][_0x1616('0x4b')];_0x3f8220+=0x1){socket[_0x1616('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x46e6bb[_0x1616('0x46')][_0x1616('0x6e')][_0x3f8220]),'WhatsappAccountId':Number(_0x46e6bb[_0x1616('0x58')]['id'])});}}else{socket[_0x1616('0x74')](_0x1616('0x77'),{'UserId':Number(_0x46e6bb[_0x1616('0x46')][_0x1616('0x6e')]),'WhatsappAccountId':Number(_0x46e6bb[_0x1616('0x58')]['id'])});}});}})[_0x1616('0x38')](respondWithStatusCode(_0x3d97f4,null))['catch'](handleError(_0x3d97f4,null));};exports[_0x1616('0x78')]=function(_0x2a50e7,_0x2ffde6,_0x15be25){var _0x1335be={};var _0x19a2f1={};var _0x699462;var _0x5069bc;return db[_0x1616('0x55')][_0x1616('0x69')]({'where':{'id':_0x2a50e7[_0x1616('0x58')]['id']}})[_0x1616('0x38')](handleEntityNotFound(_0x2ffde6,null))[_0x1616('0x38')](function(_0x251206){if(_0x251206){_0x699462=_0x251206;_0x19a2f1[_0x1616('0x44')]=_[_0x1616('0x59')](db[_0x1616('0x79')]['rawAttributes']);_0x19a2f1['query']=_['keys'](_0x2a50e7[_0x1616('0x46')]);_0x19a2f1[_0x1616('0x47')]=_[_0x1616('0x48')](_0x19a2f1['model'],_0x19a2f1['query']);_0x1335be[_0x1616('0x49')]=_[_0x1616('0x48')](_0x19a2f1[_0x1616('0x44')],qs[_0x1616('0x4a')](_0x2a50e7[_0x1616('0x46')][_0x1616('0x4a')]));_0x1335be[_0x1616('0x49')]=_0x1335be[_0x1616('0x49')]['length']?_0x1335be[_0x1616('0x49')]:_0x19a2f1[_0x1616('0x44')];_0x1335be[_0x1616('0x4e')]=qs[_0x1616('0x4f')](_0x2a50e7[_0x1616('0x46')][_0x1616('0x4f')]);_0x1335be[_0x1616('0x50')]=qs[_0x1616('0x47')](_[_0x1616('0x6a')](_0x2a50e7[_0x1616('0x46')],_0x19a2f1[_0x1616('0x47')]));if(_0x2a50e7['query'][_0x1616('0x53')]){_0x1335be['where']=_[_0x1616('0x51')](_0x1335be[_0x1616('0x50')],{'$or':_[_0x1616('0x40')](_0x1335be[_0x1616('0x49')],function(_0x2df810){var _0x20c652={};_0x20c652[_0x2df810]={'$like':'%'+_0x2a50e7[_0x1616('0x46')][_0x1616('0x53')]+'%'};return _0x20c652;})});}_0x1335be=_[_0x1616('0x51')]({},_0x1335be,_0x2a50e7[_0x1616('0x5a')]);return _0x699462['getAgents'](_0x1335be);}})[_0x1616('0x38')](function(_0x2b559f){if(_0x2b559f){_0x5069bc=_0x2b559f[_0x1616('0x4b')];if(!_0x2a50e7[_0x1616('0x46')]['hasOwnProperty'](_0x1616('0x4d'))){_0x1335be[_0x1616('0x32')]=qs[_0x1616('0x32')](_0x2a50e7[_0x1616('0x46')][_0x1616('0x32')]);_0x1335be[_0x1616('0x2f')]=qs['offset'](_0x2a50e7[_0x1616('0x46')][_0x1616('0x2f')]);}return _0x699462[_0x1616('0x78')](_0x1335be);}})[_0x1616('0x38')](function(_0x5212ae){if(_0x5212ae){return _0x5212ae?{'count':_0x5069bc,'rows':_0x5212ae}:null;}})[_0x1616('0x38')](respondWithResult(_0x2ffde6,null))[_0x1616('0x2a')](handleError(_0x2ffde6,null));};exports[_0x1616('0x7a')]=function(_0x4d9b7c,_0x3305ea){var _0x50acd9=_0x4d9b7c['params']['id'];var _0x407672=_0x4d9b7c[_0x1616('0x64')];var _0x41f08f=0xc8;var _0x13133d=null;return db[_0x1616('0x7b')][_0x1616('0x7c')]({'isolationLevel':db[_0x1616('0x7b')][_0x1616('0x7d')][_0x1616('0x7e')][_0x1616('0x7f')]},function(_0x3ab72a){return db[_0x1616('0x55')][_0x1616('0x69')]({'where':{'id':_0x50acd9},'transaction':_0x3ab72a})[_0x1616('0x38')](function(_0x1e4379){if(_0x1e4379){return db[_0x1616('0x80')][_0x1616('0x39')]({'where':{'WhatsappAccountId':_0x50acd9},'transaction':_0x3ab72a})['then'](function(){var _0x56becb=_[_0x1616('0x40')](_0x407672,function(_0x5cefae){_0x5cefae[_0x1616('0x66')]=_0x50acd9;return _0x5cefae;});return db['WhatsappApplication'][_0x1616('0x81')](_0x56becb,{'transaction':_0x3ab72a});});}else{_0x41f08f=0x194;_0x13133d=[];}});})[_0x1616('0x38')](function(){if(_0x41f08f!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x50acd9},'order':_0x1616('0x82')})[_0x1616('0x38')](function(_0x2e3b32){_0x13133d=_0x2e3b32;});}})[_0x1616('0x2a')](function(_0x2aa9ef){_0x41f08f=0x1f4;logger[_0x1616('0x27')](_0x2aa9ef['stack']);if(_0x2aa9ef[_0x1616('0x45')]){delete _0x2aa9ef['name'];}_0x13133d=_0x2aa9ef;})['finally'](function(){if(_0x13133d===null){_0x3305ea[_0x1616('0x2b')](_0x41f08f);}else{if(_0x41f08f===0x1f4){_0x3305ea[_0x1616('0x2c')](_0x41f08f)['send'](_0x13133d);}else{_0x3305ea[_0x1616('0x2c')](_0x41f08f)['json'](_0x13133d);}}});};exports[_0x1616('0x83')]=function(_0x471f17,_0x18ab46,_0x20c8bf){var _0x2c10a0={};var _0x2f5298={};var _0x4a8ceb;var _0x8d5a17;return db[_0x1616('0x55')][_0x1616('0x69')]({'where':{'id':_0x471f17[_0x1616('0x58')]['id']}})[_0x1616('0x38')](handleEntityNotFound(_0x18ab46,null))['then'](function(_0x493b36){if(_0x493b36){_0x4a8ceb=_0x493b36;_0x2f5298['model']=_[_0x1616('0x59')](db['WhatsappApplication'][_0x1616('0x41')]);_0x2f5298['query']=_[_0x1616('0x59')](_0x471f17[_0x1616('0x46')]);_0x2f5298[_0x1616('0x47')]=_[_0x1616('0x48')](_0x2f5298[_0x1616('0x44')],_0x2f5298[_0x1616('0x46')]);_0x2c10a0[_0x1616('0x49')]=_[_0x1616('0x48')](_0x2f5298[_0x1616('0x44')],qs[_0x1616('0x4a')](_0x471f17[_0x1616('0x46')][_0x1616('0x4a')]));_0x2c10a0[_0x1616('0x49')]=_0x2c10a0['attributes']['length']?_0x2c10a0['attributes']:_0x2f5298[_0x1616('0x44')];_0x2c10a0[_0x1616('0x4e')]=qs[_0x1616('0x4f')](_0x471f17[_0x1616('0x46')][_0x1616('0x4f')]);_0x2c10a0[_0x1616('0x50')]=qs[_0x1616('0x47')](_[_0x1616('0x6a')](_0x471f17[_0x1616('0x46')],_0x2f5298[_0x1616('0x47')]));if(_0x471f17[_0x1616('0x46')][_0x1616('0x53')]){_0x2c10a0[_0x1616('0x50')]=_[_0x1616('0x51')](_0x2c10a0[_0x1616('0x50')],{'$or':_[_0x1616('0x40')](_0x2c10a0[_0x1616('0x49')],function(_0xf8a8a7){var _0x3c9897={};_0x3c9897[_0xf8a8a7]={'$like':'%'+_0x471f17[_0x1616('0x46')][_0x1616('0x53')]+'%'};return _0x3c9897;})});}_0x2c10a0=_['merge']({},_0x2c10a0,_0x471f17['options']);return _0x4a8ceb[_0x1616('0x83')](_0x2c10a0);}})['then'](function(_0x5805f5){if(_0x5805f5){_0x8d5a17=_0x5805f5[_0x1616('0x4b')];if(!_0x471f17[_0x1616('0x46')][_0x1616('0x4c')](_0x1616('0x4d'))){_0x2c10a0[_0x1616('0x32')]=qs[_0x1616('0x32')](_0x471f17[_0x1616('0x46')][_0x1616('0x32')]);_0x2c10a0[_0x1616('0x2f')]=qs[_0x1616('0x2f')](_0x471f17[_0x1616('0x46')]['offset']);}return _0x4a8ceb[_0x1616('0x83')](_0x2c10a0);}})[_0x1616('0x38')](function(_0x583160){if(_0x583160){return _0x583160?{'count':_0x8d5a17,'rows':_0x583160}:null;}})['then'](respondWithResult(_0x18ab46,null))[_0x1616('0x2a')](handleError(_0x18ab46,null));};exports[_0x1616('0x84')]=function(_0x2c1634,_0xe7cecf,_0x4759a6){var _0x39f279={'channel':_0x1616('0x85')};var _0x467d8d=[];var _0x97c57a=[];var _0x4f59b9={};return db[_0x1616('0x55')][_0x1616('0x5b')]({'where':{'id':_0x2c1634[_0x1616('0x58')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x1616('0x86')}]})[_0x1616('0x38')](handleEntityNotFound(_0xe7cecf,null))['then'](function(_0x180d26){_0x39f279['account']=_0x180d26;if(_0x39f279['account']&&_0x39f279[_0x1616('0x87')][_0x1616('0x42')]===_0x1616('0x88')&&_0x2c1634['body'][_0x1616('0x89')]){if(_0x2c1634[_0x1616('0x64')][_0x1616('0x89')][_0x1616('0x4b')]===0x0)return;if(_0x2c1634[_0x1616('0x64')][_0x1616('0x89')][0x0][_0x1616('0x8a')]!==_0x1616('0x8b'))return;return db[_0x1616('0x8c')]['update']({'read':!![],'readAt':_0x2c1634['body'][_0x1616('0x89')][0x0][_0x1616('0x8d')]},{'where':{'messageId':_0x2c1634[_0x1616('0x64')][_0x1616('0x89')][0x0][_0x1616('0x8e')]},'individualHooks':!![]})['then'](function(_0x11176b){return _0xe7cecf[_0x1616('0x2c')](0xc8)['json'](_0x11176b);});}_0x39f279['applications']=_[_0x1616('0x8f')](_0x180d26['Applications'],['priority'],[_0x1616('0x90')]);if(_0x39f279[_0x1616('0x87')]['Applications']){delete _0x39f279[_0x1616('0x87')][_0x1616('0x86')];}return db[_0x1616('0x91')][_0x1616('0x65')]()[_0x1616('0x38')](function(_0x5331ec){if(!_0x5331ec){throw new db[(_0x1616('0x92'))][(_0x1616('0x93'))](_0x1616('0x94'));}_0x467d8d=_['difference'](_['keys'](_0x5331ec),[_0x1616('0x95'),_0x1616('0x96')]);_0x97c57a=_['difference'](_[_0x1616('0x59')](_0x5331ec),['createdAt',_0x1616('0x96'),'CompanyId',_0x1616('0x97')]);_0x39f279[_0x1616('0x64')]={'mapKey':_0x1616('0x98')};if(_0x39f279['account']&&_0x39f279['account']['type']===_0x1616('0x99')){_0x39f279[_0x1616('0x64')][_0x1616('0x9a')]=_0x2c1634[_0x1616('0x64')]['From'][_0x1616('0x9b')](_0x1616('0x9c'),'');_0x39f279[_0x1616('0x64')][_0x1616('0x64')]=_0x2c1634[_0x1616('0x64')][_0x1616('0x9d')];_0x39f279['body'][_0x1616('0x9e')]=_0x2c1634[_0x1616('0x64')][_0x1616('0x9f')];}if(_0x39f279[_0x1616('0x87')]&&_0x39f279['account']['type']===_0x1616('0x88')){_0x39f279[_0x1616('0x64')][_0x1616('0x9a')]=_0x2c1634['body'][_0x1616('0xa0')][0x0][_0x1616('0x9a')];_0x39f279[_0x1616('0x64')][_0x1616('0x64')]=_0x2c1634[_0x1616('0x64')][_0x1616('0xa0')][0x0][_0x1616('0x28')]['body'];_0x39f279[_0x1616('0x64')][_0x1616('0x9e')]=_0x2c1634[_0x1616('0x64')][_0x1616('0xa0')][0x0]['message_id'];}if(_0x39f279[_0x1616('0x64')]['id']){delete _0x39f279['body']['id'];}if(_['isNil'](_0x39f279[_0x1616('0x64')]['from'])){throw new db[(_0x1616('0x92'))][(_0x1616('0x93'))](_0x1616('0xa1'));}if(_[_0x1616('0xa2')](_0x39f279[_0x1616('0x64')][_0x1616('0x64')])||_0x39f279[_0x1616('0x64')][_0x1616('0x64')]===''){throw new db[(_0x1616('0x92'))][(_0x1616('0x93'))](_0x1616('0xa3'));}if(_[_0x1616('0xa2')](_0x39f279[_0x1616('0x64')][_0x1616('0xa4')])){throw new db[(_0x1616('0x92'))][(_0x1616('0x93'))](_0x1616('0xa5')+_0x97c57a);}if(!_[_0x1616('0xa6')](_0x97c57a,_0x39f279['body'][_0x1616('0xa4')])){throw new db['Sequelize'][(_0x1616('0x93'))](_0x1616('0xa7')+_0x97c57a);}_0x4f59b9[_0x39f279[_0x1616('0x64')]['mapKey']]=_0x39f279[_0x1616('0x64')][_0x1616('0x9a')];return db['CmList']['find']({'where':{'id':_0x39f279[_0x1616('0x87')][_0x1616('0x97')]},'include':[{'model':db[_0x1616('0x91')],'as':_0x1616('0xa8'),'where':_0x4f59b9,'limit':0x1,'order':[[_0x1616('0x96'),_0x1616('0xa9')]]}]});})['then'](handleEntityNotFound(_0xe7cecf,null))[_0x1616('0x38')](function(_0x25062f){if(_0x25062f){_0x39f279[_0x1616('0xaa')]=_[_0x1616('0x72')](_0x25062f,[_0x1616('0xa8')]);if(_0x25062f[_0x1616('0xa8')][_0x1616('0x4b')]){return _0x25062f['Contacts'][0x0];}var _0x5379c5=_[_0x1616('0x19')](_0x39f279[_0x1616('0x64')],{'firstName':_0x39f279['body'][_0x1616('0x9a')],'ListId':_0x25062f['id']});_0x5379c5[_0x39f279[_0x1616('0x64')][_0x1616('0xa4')]]=_0x39f279[_0x1616('0x64')][_0x1616('0x9a')];return db[_0x1616('0x91')][_0x1616('0x5c')](_0x5379c5,{'fields':_0x467d8d,'raw':!![]});}})[_0x1616('0x38')](handleEntityNotFound(_0xe7cecf,null))[_0x1616('0x38')](function(_0x6d5eb8){if(_0x6d5eb8){_0x39f279[_0x1616('0xab')]=_0x6d5eb8;var _0x3d7f6c={'ContactId':_0x6d5eb8['id'],'phone':_0x39f279[_0x1616('0x64')][_0x1616('0x9a')],'WhatsappAccountId':_0x2c1634[_0x1616('0x58')]['id']};var _0x420ce0={'ContactId':_0x6d5eb8['id'],'WhatsappAccountId':_0x2c1634[_0x1616('0x58')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x1616('0x5b')]({'where':_0x420ce0})[_0x1616('0x38')](function(_0x5d6dca){if(_0x5d6dca){return[_0x5d6dca,![]];}return db['WhatsappInteraction'][_0x1616('0x5c')](_0x3d7f6c)[_0x1616('0x38')](function(_0x332d06){return[_0x332d06,!![]];});});}})[_0x1616('0x73')](function(_0x5240a0,_0x4275a4){_0x39f279[_0x1616('0xac')]=_0x5240a0[_0x1616('0x3a')]({'plain':!![]});_0x39f279[_0x1616('0xac')]['created']=![];if(_0x4275a4){if(_0x39f279[_0x1616('0x87')][_0x1616('0xad')]){_0x39f279[_0x1616('0xae')][_0x1616('0xaf')]({'id':0x0,'priority':_0x39f279[_0x1616('0xae')][_0x1616('0x4b')]+0x1,'app':_0x1616('0xb0'),'appdata':_0x1616('0xb1'),'interval':_0x1616('0xb2')});}_0x39f279[_0x1616('0xac')][_0x1616('0xb3')]=!![];}return db[_0x1616('0x8c')][_0x1616('0x5c')]({'phone':_0x39f279[_0x1616('0x64')][_0x1616('0x9a')],'messageId':_0x39f279[_0x1616('0x64')]['messageId'],'body':_0x39f279[_0x1616('0x64')]['body'],'WhatsappAccountId':_0x2c1634[_0x1616('0x58')]['id'],'WhatsappInteractionId':_0x5240a0['id'],'direction':'in','ContactId':_0x5240a0[_0x1616('0xb4')],'AttachmentId':_0x39f279[_0x1616('0x64')]['AttachmentId']});})[_0x1616('0x38')](function(_0x227cc5){_0x39f279[_0x1616('0x28')]=_0x227cc5;if(_0x39f279[_0x1616('0xac')][_0x1616('0xb5')]){return db[_0x1616('0x79')][_0x1616('0x5b')]({'attributes':['id','name'],'where':{'id':_0x39f279[_0x1616('0xac')][_0x1616('0xb5')]}})[_0x1616('0x38')](function(_0x2d85ca){if(_0x2d85ca){_0x39f279[_0x1616('0xae')][_0x1616('0xb6')]({'id':0x0,'priority':0x0,'app':_0x1616('0xb7'),'appdata':_0x2d85ca[_0x1616('0x45')]+','+(_0x39f279['account']['waitForTheAssignedAgent']||0xa),'interval':_0x1616('0xb2')});}return respondWithRpcPromise(_0x1616('0xb8'),_0x1616('0xb9'),_0x39f279);});}return respondWithRpcPromise(_0x1616('0xb8'),'startRouting',_0x39f279);})[_0x1616('0x38')](function(_0x5d9f81){if(_0x5d9f81){var _0x567602=0xc8;var _0x44f4a8=_0x1616('0xba');logger['info'](_0x1616('0x25'),_0x44f4a8,_0x567602,'entity\x20found');logger[_0x1616('0x24')](_0x1616('0xbb'),_0x44f4a8,_0x567602,'entity\x20found',JSON['stringify'](_0x5d9f81));if(_0x39f279[_0x1616('0x87')][_0x1616('0x42')]===_0x1616('0x99')){return _0xe7cecf[_0x1616('0x2c')](_0x567602)[_0x1616('0x33')](_0x1616('0xbc'),_0x1616('0xbd'))['send']('\x0a');}else{return _0xe7cecf[_0x1616('0x2c')](_0x567602)['json'](_0x5d9f81);}}});})[_0x1616('0x2a')](handleError(_0xe7cecf,null));};exports['send']=function(_0x4ce1a2,_0x13ec23,_0x4335f2){var _0x4a7fc8,_0x1e0736,_0x531931;if(_[_0x1616('0xa2')](_0x4ce1a2['body'][_0x1616('0x64')])||_0x4ce1a2[_0x1616('0x64')][_0x1616('0x64')]===''){throw new db['Sequelize']['ValidationError'](_0x1616('0xa3'));}if(_[_0x1616('0xa2')](_0x4ce1a2[_0x1616('0x64')]['to'])){throw new db[(_0x1616('0x92'))][(_0x1616('0x93'))](_0x1616('0xbe'));}_0x4a7fc8=_0x4ce1a2['body']['to'];return db['WhatsappAccount'][_0x1616('0x5b')]({'where':{'id':_0x4ce1a2[_0x1616('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x1616('0xbf'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x4a7fc8},'limit':0x1,'order':[[_0x1616('0x96'),_0x1616('0xa9')]]}]}]})[_0x1616('0x38')](handleEntityNotFound(_0x13ec23,null))[_0x1616('0x38')](function(_0x1a9ec8){if(_0x1a9ec8&&_0x1a9ec8[_0x1616('0xbf')]){_0x1e0736=_0x1a9ec8[_0x1616('0x3a')]({'plain':!![]});if(_0x1e0736[_0x1616('0xbf')]&&_0x1e0736['List']['Contacts'][_0x1616('0x4b')]){return _0x1e0736[_0x1616('0xbf')][_0x1616('0xa8')][0x0];}return db[_0x1616('0x91')][_0x1616('0x5c')](_['defaults'](_0x4ce1a2[_0x1616('0x64')],{'firstName':_0x4a7fc8,'mobile':_0x4a7fc8,'phone':_0x4a7fc8,'ListId':_0x1e0736[_0x1616('0x97')]}));}})[_0x1616('0x38')](handleEntityNotFound(_0x13ec23,null))[_0x1616('0x38')](function(_0x4d8ada){if(_0x4d8ada){_0x531931=_0x4d8ada;return db[_0x1616('0xc0')][_0x1616('0x5b')]({'where':{'ContactId':_0x531931['id'],'closed':![],'WhatsappAccountId':_0x1e0736['id']}})[_0x1616('0x38')](function(_0x4e36d6){if(_0x4e36d6){return[_0x4e36d6,![]];}return db[_0x1616('0xc0')][_0x1616('0x5c')]({'UserId':_0x4ce1a2[_0x1616('0x5d')]['id'],'ContactId':_0x531931['id'],'WhatsappAccountId':_0x1e0736['id'],'phone':_0x4a7fc8,'firstMsgDirection':_0x1616('0xc1'),'Messages':[_[_0x1616('0x51')](_0x4ce1a2[_0x1616('0x64')],{'read':![],'body':_0x4ce1a2[_0x1616('0x64')][_0x1616('0x64')],'phone':_0x4a7fc8,'WhatsappAccountId':_0x1e0736['id'],'UserId':_0x4ce1a2[_0x1616('0x5d')]['id'],'ContactId':_0x531931['id']})]},{'include':[{'model':db[_0x1616('0x8c')],'as':_0x1616('0xc2')}]})[_0x1616('0x38')](function(_0x10ffbe){return[_0x10ffbe,!![]];});});}})[_0x1616('0x73')](function(_0x4b0261,_0x4456d1){if(_0x4456d1){return _0x4b0261;}return db[_0x1616('0x8c')][_0x1616('0x5c')](_['merge'](_0x4ce1a2['body'],{'read':![],'body':_0x4ce1a2['body'][_0x1616('0x64')],'phone':_0x4a7fc8,'WhatsappAccountId':_0x1e0736['id'],'WhatsappInteractionId':_0x4b0261['id'],'UserId':_0x4ce1a2[_0x1616('0x5d')]['id'],'ContactId':_0x531931['id']}))[_0x1616('0x38')](function(_0x1da96a){_0x4b0261[_0x1616('0xc3')]['Messages']=[];_0x4b0261['dataValues'][_0x1616('0xc2')]['push'](_0x1da96a[_0x1616('0xc3')]);return _0x4b0261;});})[_0x1616('0x38')](respondWithResult(_0x13ec23,null))['catch'](handleError(_0x13ec23,null));}; \ No newline at end of file +var _0xb9eb=['mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','List','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','update','params','describe','addDisposition','Disposition','getDispositions','findOne','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','length','removeAnswers','omit','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','state','WhatsappMessage','statuses','timestamp','message_id','applications','asc','CmContact','Sequelize','ValidationError','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','Body','messageId','MessageSid','sinch','from','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x21ce32,_0x2ccd1c){var _0xd6b087=function(_0x58e475){while(--_0x58e475){_0x21ce32['push'](_0x21ce32['shift']());}};_0xd6b087(++_0x2ccd1c);}(_0xb9eb,0x1ad));var _0xbb9e=function(_0x2def13,_0x1b781f){_0x2def13=_0x2def13-0x0;var _0x186312=_0xb9eb[_0x2def13];return _0x186312;};'use strict';var emlformat=require(_0xbb9e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb9e('0x1'));var jsonpatch=require(_0xbb9e('0x2'));var rp=require(_0xbb9e('0x3'));var moment=require(_0xbb9e('0x4'));var BPromise=require(_0xbb9e('0x5'));var Mustache=require('mustache');var util=require(_0xbb9e('0x6'));var path=require(_0xbb9e('0x7'));var sox=require(_0xbb9e('0x8'));var csv=require('to-csv');var ejs=require(_0xbb9e('0x9'));var fs=require('fs');var fs_extra=require(_0xbb9e('0xa'));var _=require(_0xbb9e('0xb'));var squel=require('squel');var crypto=require(_0xbb9e('0xc'));var jsforce=require(_0xbb9e('0xd'));var deskjs=require(_0xbb9e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbb9e('0xf'));var Papa=require(_0xbb9e('0x10'));var Redis=require(_0xbb9e('0x11'));var authService=require(_0xbb9e('0x12'));var qs=require(_0xbb9e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb9e('0x14'));var logger=require('../../config/logger')(_0xbb9e('0x15'));var utils=require(_0xbb9e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb9e('0x17'));var db=require(_0xbb9e('0x18'))['db'];config[_0xbb9e('0x19')]=_[_0xbb9e('0x1a')](config[_0xbb9e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb9e('0x1b'))(new Redis(config[_0xbb9e('0x19')]));require(_0xbb9e('0x1c'))[_0xbb9e('0x1d')](socket);var jayson=require(_0xbb9e('0x1e'));var client=jayson[_0xbb9e('0x1f')][_0xbb9e('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x5d632c,_0x1f9187,_0x52862c,_0x4e7c5c){return new BPromise(function(_0xf57aca,_0x840860){var _0x351d30=_0x4e7c5c||client;return _0x351d30[_0xbb9e('0x21')](_0x5d632c,_0x52862c)[_0xbb9e('0x22')](function(_0x52dbb4){logger['info'](_0xbb9e('0x23'),_0x1f9187,_0xbb9e('0x24'));logger['debug'](_0xbb9e('0x25'),_0x1f9187,_0xbb9e('0x24'),JSON[_0xbb9e('0x26')](_0x52dbb4));if(_0x52dbb4['error']){if(_0x52dbb4[_0xbb9e('0x27')][_0xbb9e('0x28')]===0x1f4){logger[_0xbb9e('0x27')](_0xbb9e('0x23'),_0x1f9187,_0x52dbb4[_0xbb9e('0x27')][_0xbb9e('0x29')]);return _0x840860(_0x52dbb4[_0xbb9e('0x27')][_0xbb9e('0x29')]);}logger[_0xbb9e('0x27')](_0xbb9e('0x23'),_0x1f9187,_0x52dbb4[_0xbb9e('0x27')][_0xbb9e('0x29')]);return _0xf57aca(_0x52dbb4[_0xbb9e('0x27')][_0xbb9e('0x29')]);}else{logger[_0xbb9e('0x2a')](_0xbb9e('0x23'),_0x1f9187,_0xbb9e('0x24'));_0xf57aca(_0x52dbb4[_0xbb9e('0x2b')][_0xbb9e('0x29')]);}})['catch'](function(_0x4135f0){logger[_0xbb9e('0x27')](_0xbb9e('0x23'),_0x1f9187,_0x4135f0);_0x840860(_0x4135f0);});});}function respondWithStatusCode(_0x4f263c,_0x59192d){_0x59192d=_0x59192d||0xcc;return function(_0x1dfbed){if(_0x1dfbed){return _0x4f263c[_0xbb9e('0x2c')](_0x59192d);}return _0x4f263c[_0xbb9e('0x2d')](_0x59192d)[_0xbb9e('0x2e')]();};}function respondWithResult(_0x4b95e9,_0x3491d4){_0x3491d4=_0x3491d4||0xc8;return function(_0x144aab){if(_0x144aab){return _0x4b95e9[_0xbb9e('0x2d')](_0x3491d4)['json'](_0x144aab);}};}function respondWithFilteredResult(_0x26d789,_0x35d43c){return function(_0x2d58df){if(_0x2d58df){var _0x58f39f=typeof _0x35d43c['offset']===_0xbb9e('0x2f')&&typeof _0x35d43c[_0xbb9e('0x30')]===_0xbb9e('0x2f');var _0x1afac6=_0x2d58df[_0xbb9e('0x31')];var _0x3f4e33=_0x58f39f?0x0:_0x35d43c[_0xbb9e('0x32')];var _0x59d388=_0x58f39f?_0x2d58df[_0xbb9e('0x31')]:_0x35d43c[_0xbb9e('0x32')]+_0x35d43c[_0xbb9e('0x30')];var _0x46b0e8;if(_0x59d388>=_0x1afac6){_0x59d388=_0x1afac6;_0x46b0e8=0xc8;}else{_0x46b0e8=0xce;}_0x26d789['status'](_0x46b0e8);return _0x26d789['set'](_0xbb9e('0x33'),_0x3f4e33+'-'+_0x59d388+'/'+_0x1afac6)[_0xbb9e('0x34')](_0x2d58df);}return null;};}function patchUpdates(_0x14964d){return function(_0x12ae1f){try{jsonpatch[_0xbb9e('0x35')](_0x12ae1f,_0x14964d,!![]);}catch(_0x20d78d){return BPromise[_0xbb9e('0x36')](_0x20d78d);}return _0x12ae1f[_0xbb9e('0x37')]();};}function saveUpdates(_0x95665,_0x1af428){return function(_0x9d7036){if(_0x9d7036){return _0x9d7036['update'](_0x95665)[_0xbb9e('0x22')](function(_0x3ba933){return _0x3ba933;});}return null;};}function removeEntity(_0x14ffaf,_0x5258a2){return function(_0x29ac53){if(_0x29ac53){return _0x29ac53[_0xbb9e('0x38')]()['then'](function(){var _0xb22fb3=_0x29ac53['get']({'plain':!![]});var _0x52cf7f=_0xbb9e('0x39');return db[_0xbb9e('0x3a')][_0xbb9e('0x38')]({'where':{'type':_0x52cf7f,'resourceId':_0xb22fb3['id']}})[_0xbb9e('0x22')](function(){return _0x29ac53;});})[_0xbb9e('0x22')](function(){_0x14ffaf['status'](0xcc)[_0xbb9e('0x2e')]();});}};}function handleEntityNotFound(_0x50a27e,_0x2b377a){return function(_0xe46da6){if(!_0xe46da6){_0x50a27e[_0xbb9e('0x2c')](0x194);}return _0xe46da6;};}function handleError(_0x2b84df,_0x5abb42){_0x5abb42=_0x5abb42||0x1f4;return function(_0xd4ceea){logger[_0xbb9e('0x27')](_0xd4ceea[_0xbb9e('0x3b')]);if(_0xd4ceea['name']){delete _0xd4ceea[_0xbb9e('0x3c')];}_0x2b84df[_0xbb9e('0x2d')](_0x5abb42)[_0xbb9e('0x3d')](_0xd4ceea);};}exports[_0xbb9e('0x3e')]=function(_0x295715,_0x5aee7c){var _0x21123a={'include':[{'model':db[_0xbb9e('0x3f')],'as':_0xbb9e('0x40')}]},_0x545d63={},_0x48e5ae={'count':0x0,'rows':[]};var _0x2bbc19=_[_0xbb9e('0x41')](db[_0xbb9e('0x42')][_0xbb9e('0x43')],function(_0x26401f){return{'name':_0x26401f[_0xbb9e('0x44')],'type':_0x26401f[_0xbb9e('0x45')][_0xbb9e('0x46')]};});_0x545d63[_0xbb9e('0x47')]=_['map'](_0x2bbc19,_0xbb9e('0x3c'));_0x545d63[_0xbb9e('0x48')]=_[_0xbb9e('0x49')](_0x295715[_0xbb9e('0x48')]);_0x545d63[_0xbb9e('0x4a')]=_[_0xbb9e('0x4b')](_0x545d63[_0xbb9e('0x47')],_0x545d63[_0xbb9e('0x48')]);_0x21123a[_0xbb9e('0x4c')]=_[_0xbb9e('0x4b')](_0x545d63['model'],qs[_0xbb9e('0x4d')](_0x295715[_0xbb9e('0x48')][_0xbb9e('0x4d')]));_0x21123a['attributes']=_0x21123a[_0xbb9e('0x4c')]['length']?_0x21123a[_0xbb9e('0x4c')]:_0x545d63[_0xbb9e('0x47')];if(!_0x295715[_0xbb9e('0x48')][_0xbb9e('0x4e')](_0xbb9e('0x4f'))){_0x21123a[_0xbb9e('0x30')]=qs[_0xbb9e('0x30')](_0x295715['query']['limit']);_0x21123a[_0xbb9e('0x32')]=qs['offset'](_0x295715[_0xbb9e('0x48')][_0xbb9e('0x32')]);}_0x21123a[_0xbb9e('0x50')]=qs[_0xbb9e('0x51')](_0x295715['query'][_0xbb9e('0x51')]);_0x21123a[_0xbb9e('0x52')]=qs['filters'](_[_0xbb9e('0x53')](_0x295715[_0xbb9e('0x48')],_0x545d63[_0xbb9e('0x4a')]),_0x2bbc19);if(_0x295715[_0xbb9e('0x48')][_0xbb9e('0x54')]){_0x21123a[_0xbb9e('0x52')]=_['merge'](_0x21123a[_0xbb9e('0x52')],{'$or':_[_0xbb9e('0x41')](_0x2bbc19,function(_0x4065cc){if(_0x4065cc[_0xbb9e('0x45')]!==_0xbb9e('0x55')){var _0x59dea3={};_0x59dea3[_0x4065cc[_0xbb9e('0x3c')]]={'$like':'%'+_0x295715['query'][_0xbb9e('0x54')]+'%'};return _0x59dea3;}})});}_0x21123a=_['merge']({},_0x21123a,_0x295715[_0xbb9e('0x56')]);var _0xfbaeae={'where':_0x21123a['where']};return db[_0xbb9e('0x42')][_0xbb9e('0x31')](_0xfbaeae)['then'](function(_0x730791){_0x48e5ae[_0xbb9e('0x31')]=_0x730791;if(_0x295715['query'][_0xbb9e('0x57')]){_0x21123a[_0xbb9e('0x58')]=[{'all':!![]}];}return db[_0xbb9e('0x42')][_0xbb9e('0x59')](_0x21123a);})['then'](function(_0x369327){_0x48e5ae[_0xbb9e('0x5a')]=_0x369327;return _0x48e5ae;})[_0xbb9e('0x22')](respondWithFilteredResult(_0x5aee7c,_0x21123a))[_0xbb9e('0x5b')](handleError(_0x5aee7c,null));};exports[_0xbb9e('0x5c')]=function(_0x41b578,_0x1073e7){var _0x336eb9={'raw':![],'where':{'id':_0x41b578['params']['id']},'include':[{'model':db[_0xbb9e('0x3f')],'as':_0xbb9e('0x40')}]},_0x128592={};_0x128592[_0xbb9e('0x47')]=_[_0xbb9e('0x49')](db[_0xbb9e('0x42')][_0xbb9e('0x43')]);_0x128592[_0xbb9e('0x48')]=_[_0xbb9e('0x49')](_0x41b578['query']);_0x128592['filters']=_['intersection'](_0x128592[_0xbb9e('0x47')],_0x128592[_0xbb9e('0x48')]);_0x336eb9[_0xbb9e('0x4c')]=_['intersection'](_0x128592['model'],qs[_0xbb9e('0x4d')](_0x41b578[_0xbb9e('0x48')][_0xbb9e('0x4d')]));_0x336eb9[_0xbb9e('0x4c')]=_0x336eb9[_0xbb9e('0x4c')]['length']?_0x336eb9[_0xbb9e('0x4c')]:_0x128592['model'];if(_0x41b578[_0xbb9e('0x48')]['includeAll']){_0x336eb9[_0xbb9e('0x58')]=[{'all':!![]}];}_0x336eb9=_[_0xbb9e('0x5d')]({},_0x336eb9,_0x41b578[_0xbb9e('0x56')]);return db[_0xbb9e('0x42')][_0xbb9e('0x5e')](_0x336eb9)[_0xbb9e('0x22')](handleEntityNotFound(_0x1073e7,null))[_0xbb9e('0x22')](respondWithResult(_0x1073e7,null))[_0xbb9e('0x5b')](handleError(_0x1073e7,null));};exports[_0xbb9e('0x5f')]=function(_0x40edc7,_0x3ac370){return db['WhatsappAccount'][_0xbb9e('0x5f')](_0x40edc7[_0xbb9e('0x60')],{})['then'](function(_0x1d2caf){var _0x16e287=_0x40edc7['user'][_0xbb9e('0x61')]({'plain':!![]});if(!_0x16e287)throw new Error(_0xbb9e('0x62'));if(_0x16e287[_0xbb9e('0x63')]===_0xbb9e('0x64')){var _0x482a32=_0x1d2caf['get']({'plain':!![]});var _0x4151f1=_0xbb9e('0x39');return db['UserProfileSection'][_0xbb9e('0x5e')]({'where':{'name':_0x4151f1,'userProfileId':_0x16e287['userProfileId']},'raw':!![]})[_0xbb9e('0x22')](function(_0x57f8d5){if(_0x57f8d5&&_0x57f8d5[_0xbb9e('0x65')]===0x0){return db['UserProfileResource']['create']({'name':_0x482a32[_0xbb9e('0x3c')],'resourceId':_0x482a32['id'],'type':_0x57f8d5[_0xbb9e('0x3c')],'sectionId':_0x57f8d5['id']},{})[_0xbb9e('0x22')](function(){return _0x1d2caf;});}else{return _0x1d2caf;}})[_0xbb9e('0x5b')](function(_0x25f258){logger[_0xbb9e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25f258);throw _0x25f258;});}return _0x1d2caf;})['then'](respondWithResult(_0x3ac370,0xc9))['catch'](handleError(_0x3ac370,null));};exports[_0xbb9e('0x66')]=function(_0x39deb0,_0x468e3d){if(_0x39deb0['body']['id']){delete _0x39deb0[_0xbb9e('0x60')]['id'];}return db[_0xbb9e('0x42')][_0xbb9e('0x5e')]({'where':{'id':_0x39deb0[_0xbb9e('0x67')]['id']},'include':[{'model':db['Pause'],'as':_0xbb9e('0x40')}]})[_0xbb9e('0x22')](handleEntityNotFound(_0x468e3d,null))['then'](saveUpdates(_0x39deb0['body'],null))['then'](respondWithResult(_0x468e3d,null))[_0xbb9e('0x5b')](handleError(_0x468e3d,null));};exports[_0xbb9e('0x38')]=function(_0x114129,_0x19302f){return db['WhatsappAccount'][_0xbb9e('0x5e')]({'where':{'id':_0x114129[_0xbb9e('0x67')]['id']}})[_0xbb9e('0x22')](handleEntityNotFound(_0x19302f,null))['then'](removeEntity(_0x19302f,null))['catch'](handleError(_0x19302f,null));};exports[_0xbb9e('0x68')]=function(_0x4962ad,_0x3fd6e2){return db[_0xbb9e('0x42')][_0xbb9e('0x68')]()[_0xbb9e('0x22')](respondWithResult(_0x3fd6e2,null))[_0xbb9e('0x5b')](handleError(_0x3fd6e2,null));};exports[_0xbb9e('0x69')]=function(_0x3517a7,_0x5a0253,_0x2a1821){if(_0x3517a7[_0xbb9e('0x60')]['id']){delete _0x3517a7[_0xbb9e('0x60')]['id'];}return db[_0xbb9e('0x42')][_0xbb9e('0x5e')]({'where':{'id':_0x3517a7[_0xbb9e('0x67')]['id']}})['then'](handleEntityNotFound(_0x5a0253,null))[_0xbb9e('0x22')](function(_0x32fb50){if(_0x32fb50){_0x3517a7[_0xbb9e('0x60')]['WhatsappAccountId']=_0x32fb50['id'];return db[_0xbb9e('0x6a')][_0xbb9e('0x5f')](_0x3517a7[_0xbb9e('0x60')]);}})[_0xbb9e('0x22')](respondWithResult(_0x5a0253,null))[_0xbb9e('0x5b')](handleError(_0x5a0253,null));};exports[_0xbb9e('0x6b')]=function(_0x5c674d,_0x5a9854,_0x10fa90){var _0x13d372={'raw':![],'where':{}};var _0x427c69={};var _0x3f0c6d={'count':0x0,'rows':[]};return db[_0xbb9e('0x42')][_0xbb9e('0x6c')]({'where':{'id':_0x5c674d['params']['id']}})[_0xbb9e('0x22')](handleEntityNotFound(_0x5a9854,null))[_0xbb9e('0x22')](function(_0x20025c){if(_0x20025c){_0x427c69[_0xbb9e('0x47')]=_[_0xbb9e('0x49')](db[_0xbb9e('0x6a')][_0xbb9e('0x43')]);_0x427c69[_0xbb9e('0x48')]=_[_0xbb9e('0x49')](_0x5c674d['query']);_0x427c69['filters']=_[_0xbb9e('0x4b')](_0x427c69[_0xbb9e('0x47')],_0x427c69[_0xbb9e('0x48')]);_0x13d372[_0xbb9e('0x4c')]=_[_0xbb9e('0x4b')](_0x427c69['model'],qs[_0xbb9e('0x4d')](_0x5c674d[_0xbb9e('0x48')][_0xbb9e('0x4d')]));_0x13d372['attributes']=_0x13d372[_0xbb9e('0x4c')]['length']?_0x13d372['attributes']:_0x427c69[_0xbb9e('0x47')];if(!_0x5c674d['query'][_0xbb9e('0x4e')](_0xbb9e('0x4f'))){_0x13d372[_0xbb9e('0x30')]=qs[_0xbb9e('0x30')](_0x5c674d['query'][_0xbb9e('0x30')]);_0x13d372[_0xbb9e('0x32')]=qs['offset'](_0x5c674d[_0xbb9e('0x48')]['offset']);}_0x13d372['order']=qs[_0xbb9e('0x51')](_0x5c674d[_0xbb9e('0x48')]['sort']);_0x13d372['where']=qs[_0xbb9e('0x4a')](_[_0xbb9e('0x53')](_0x5c674d[_0xbb9e('0x48')],_0x427c69['filters']));_0x13d372['where'][_0xbb9e('0x6d')]=_0x20025c['id'];if(_0x5c674d[_0xbb9e('0x48')][_0xbb9e('0x54')]){_0x13d372[_0xbb9e('0x52')]=_[_0xbb9e('0x5d')](_0x13d372[_0xbb9e('0x52')],{'$or':_[_0xbb9e('0x41')](_0x13d372[_0xbb9e('0x4c')],function(_0x421cb0){var _0x4399fd={};_0x4399fd[_0x421cb0]={'$like':'%'+_0x5c674d[_0xbb9e('0x48')]['filter']+'%'};return _0x4399fd;})});}_0x13d372=_[_0xbb9e('0x5d')]({},_0x13d372,_0x5c674d[_0xbb9e('0x56')]);return db[_0xbb9e('0x6a')][_0xbb9e('0x31')]({'where':_0x13d372[_0xbb9e('0x52')]})[_0xbb9e('0x22')](function(_0x1013e1){_0x3f0c6d['count']=_0x1013e1;if(_0x5c674d[_0xbb9e('0x48')]['includeAll']){_0x13d372[_0xbb9e('0x58')]=[{'all':!![]}];}return db[_0xbb9e('0x6a')][_0xbb9e('0x59')](_0x13d372);})['then'](function(_0x31b6bf){_0x3f0c6d[_0xbb9e('0x5a')]=_0x31b6bf;return _0x3f0c6d;});}})[_0xbb9e('0x22')](respondWithFilteredResult(_0x5a9854,_0x13d372))[_0xbb9e('0x5b')](handleError(_0x5a9854,null));};exports[_0xbb9e('0x6e')]=function(_0xc9dbd8,_0x7b94,_0xdf99a7){return db['WhatsappAccount']['find']({'where':{'id':_0xc9dbd8[_0xbb9e('0x67')]['id']}})['then'](handleEntityNotFound(_0x7b94,null))[_0xbb9e('0x22')](function(_0x28213b){if(_0x28213b){return _0x28213b[_0xbb9e('0x6e')](_0xc9dbd8[_0xbb9e('0x48')][_0xbb9e('0x6f')]);}})[_0xbb9e('0x22')](respondWithStatusCode(_0x7b94,null))[_0xbb9e('0x5b')](handleError(_0x7b94,null));};exports[_0xbb9e('0x70')]=function(_0xdda4ec,_0x410b59,_0x13884d){if(_0xdda4ec['body']['id']){delete _0xdda4ec[_0xbb9e('0x60')]['id'];}return db[_0xbb9e('0x42')][_0xbb9e('0x5e')]({'where':{'id':_0xdda4ec[_0xbb9e('0x67')]['id']}})['then'](handleEntityNotFound(_0x410b59,null))[_0xbb9e('0x22')](function(_0x5593e4){if(_0x5593e4){_0xdda4ec[_0xbb9e('0x60')]['WhatsappAccountId']=_0x5593e4['id'];return db[_0xbb9e('0x71')][_0xbb9e('0x5f')](_0xdda4ec[_0xbb9e('0x60')]);}})[_0xbb9e('0x22')](respondWithResult(_0x410b59,null))[_0xbb9e('0x5b')](handleError(_0x410b59,null));};exports[_0xbb9e('0x72')]=function(_0x16692a,_0x7390c,_0x501690){var _0x3fc9e4={'raw':![],'where':{}};var _0x3c68d7={};var _0x2bdd83={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x16692a['params']['id']}})['then'](handleEntityNotFound(_0x7390c,null))[_0xbb9e('0x22')](function(_0x164446){if(_0x164446){_0x3c68d7['model']=_['keys'](db['CannedAnswer']['rawAttributes']);_0x3c68d7[_0xbb9e('0x48')]=_[_0xbb9e('0x49')](_0x16692a[_0xbb9e('0x48')]);_0x3c68d7[_0xbb9e('0x4a')]=_['intersection'](_0x3c68d7['model'],_0x3c68d7[_0xbb9e('0x48')]);_0x3fc9e4[_0xbb9e('0x4c')]=_[_0xbb9e('0x4b')](_0x3c68d7[_0xbb9e('0x47')],qs[_0xbb9e('0x4d')](_0x16692a[_0xbb9e('0x48')][_0xbb9e('0x4d')]));_0x3fc9e4[_0xbb9e('0x4c')]=_0x3fc9e4[_0xbb9e('0x4c')][_0xbb9e('0x73')]?_0x3fc9e4[_0xbb9e('0x4c')]:_0x3c68d7['model'];if(!_0x16692a[_0xbb9e('0x48')][_0xbb9e('0x4e')](_0xbb9e('0x4f'))){_0x3fc9e4[_0xbb9e('0x30')]=qs['limit'](_0x16692a[_0xbb9e('0x48')][_0xbb9e('0x30')]);_0x3fc9e4[_0xbb9e('0x32')]=qs[_0xbb9e('0x32')](_0x16692a['query'][_0xbb9e('0x32')]);}_0x3fc9e4['order']=qs['sort'](_0x16692a[_0xbb9e('0x48')][_0xbb9e('0x51')]);_0x3fc9e4['where']=qs[_0xbb9e('0x4a')](_[_0xbb9e('0x53')](_0x16692a[_0xbb9e('0x48')],_0x3c68d7[_0xbb9e('0x4a')]));_0x3fc9e4[_0xbb9e('0x52')][_0xbb9e('0x6d')]=_0x164446['id'];if(_0x16692a[_0xbb9e('0x48')][_0xbb9e('0x54')]){_0x3fc9e4['where']=_[_0xbb9e('0x5d')](_0x3fc9e4[_0xbb9e('0x52')],{'$or':_[_0xbb9e('0x41')](_0x3fc9e4[_0xbb9e('0x4c')],function(_0x10cd02){var _0x10d92c={};_0x10d92c[_0x10cd02]={'$like':'%'+_0x16692a[_0xbb9e('0x48')]['filter']+'%'};return _0x10d92c;})});}_0x3fc9e4=_[_0xbb9e('0x5d')]({},_0x3fc9e4,_0x16692a[_0xbb9e('0x56')]);return db[_0xbb9e('0x71')][_0xbb9e('0x31')]({'where':_0x3fc9e4[_0xbb9e('0x52')]})[_0xbb9e('0x22')](function(_0x587df0){_0x2bdd83[_0xbb9e('0x31')]=_0x587df0;if(_0x16692a[_0xbb9e('0x48')][_0xbb9e('0x57')]){_0x3fc9e4[_0xbb9e('0x58')]=[{'all':!![]}];}return db[_0xbb9e('0x71')][_0xbb9e('0x59')](_0x3fc9e4);})['then'](function(_0x322f96){_0x2bdd83['rows']=_0x322f96;return _0x2bdd83;});}})[_0xbb9e('0x22')](respondWithFilteredResult(_0x7390c,_0x3fc9e4))[_0xbb9e('0x5b')](handleError(_0x7390c,null));};exports[_0xbb9e('0x74')]=function(_0x2e98e8,_0x213b5b,_0x18976a){return db[_0xbb9e('0x42')][_0xbb9e('0x5e')]({'where':{'id':_0x2e98e8['params']['id']}})['then'](handleEntityNotFound(_0x213b5b,null))[_0xbb9e('0x22')](function(_0x2f10aa){if(_0x2f10aa){return _0x2f10aa[_0xbb9e('0x74')](_0x2e98e8[_0xbb9e('0x48')][_0xbb9e('0x6f')]);}})[_0xbb9e('0x22')](respondWithStatusCode(_0x213b5b,null))[_0xbb9e('0x5b')](handleError(_0x213b5b,null));};exports['addAgents']=function(_0xfdb39d,_0x26e25f,_0x4e9a5b){return db[_0xbb9e('0x42')][_0xbb9e('0x5e')]({'where':{'id':_0xfdb39d['params']['id']}})[_0xbb9e('0x22')](handleEntityNotFound(_0x26e25f,null))[_0xbb9e('0x22')](function(_0x1787f1){if(_0x1787f1){return _0x1787f1['addAgents'](_0xfdb39d[_0xbb9e('0x60')][_0xbb9e('0x6f')],_[_0xbb9e('0x75')](_0xfdb39d['body'],['ids','id'])||{})['spread'](function(_0x6a54ba){for(var _0x362503=0x0;_0x362503<_0xfdb39d[_0xbb9e('0x60')][_0xbb9e('0x6f')]['length'];_0x362503+=0x1){socket['emit'](_0xbb9e('0x76'),{'UserId':Number(_0xfdb39d['body']['ids'][_0x362503]),'WhatsappAccountId':Number(_0xfdb39d[_0xbb9e('0x67')]['id'])});}return _0x6a54ba;});}})[_0xbb9e('0x22')](respondWithResult(_0x26e25f,null))[_0xbb9e('0x5b')](handleError(_0x26e25f,null));};exports[_0xbb9e('0x77')]=function(_0x94373b,_0xd6ea67,_0x33472a){return db[_0xbb9e('0x42')]['find']({'where':{'id':_0x94373b[_0xbb9e('0x67')]['id']}})[_0xbb9e('0x22')](handleEntityNotFound(_0xd6ea67,null))[_0xbb9e('0x22')](function(_0x4a7df9){if(_0x4a7df9){return _0x4a7df9[_0xbb9e('0x77')](_0x94373b['query'][_0xbb9e('0x6f')])[_0xbb9e('0x22')](function(){if(_[_0xbb9e('0x78')](_0x94373b[_0xbb9e('0x48')][_0xbb9e('0x6f')])){for(var _0x3c9719=0x0;_0x3c9719<_0x94373b[_0xbb9e('0x48')]['ids'][_0xbb9e('0x73')];_0x3c9719+=0x1){socket[_0xbb9e('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0x94373b['query'][_0xbb9e('0x6f')][_0x3c9719]),'WhatsappAccountId':Number(_0x94373b[_0xbb9e('0x67')]['id'])});}}else{socket[_0xbb9e('0x79')](_0xbb9e('0x7a'),{'UserId':Number(_0x94373b[_0xbb9e('0x48')][_0xbb9e('0x6f')]),'WhatsappAccountId':Number(_0x94373b[_0xbb9e('0x67')]['id'])});}});}})[_0xbb9e('0x22')](respondWithStatusCode(_0xd6ea67,null))[_0xbb9e('0x5b')](handleError(_0xd6ea67,null));};exports['getAgents']=function(_0x5b11b2,_0x3891fb,_0x2bb780){var _0x292d55={};var _0x2cd188={};var _0x10f02d;var _0x5bce79;return db[_0xbb9e('0x42')][_0xbb9e('0x6c')]({'where':{'id':_0x5b11b2[_0xbb9e('0x67')]['id']}})['then'](handleEntityNotFound(_0x3891fb,null))['then'](function(_0x4bc436){if(_0x4bc436){_0x10f02d=_0x4bc436;_0x2cd188[_0xbb9e('0x47')]=_[_0xbb9e('0x49')](db[_0xbb9e('0x7b')][_0xbb9e('0x43')]);_0x2cd188[_0xbb9e('0x48')]=_[_0xbb9e('0x49')](_0x5b11b2[_0xbb9e('0x48')]);_0x2cd188[_0xbb9e('0x4a')]=_[_0xbb9e('0x4b')](_0x2cd188['model'],_0x2cd188[_0xbb9e('0x48')]);_0x292d55[_0xbb9e('0x4c')]=_['intersection'](_0x2cd188[_0xbb9e('0x47')],qs[_0xbb9e('0x4d')](_0x5b11b2[_0xbb9e('0x48')]['fields']));_0x292d55[_0xbb9e('0x4c')]=_0x292d55[_0xbb9e('0x4c')][_0xbb9e('0x73')]?_0x292d55[_0xbb9e('0x4c')]:_0x2cd188[_0xbb9e('0x47')];_0x292d55[_0xbb9e('0x50')]=qs[_0xbb9e('0x51')](_0x5b11b2[_0xbb9e('0x48')]['sort']);_0x292d55[_0xbb9e('0x52')]=qs[_0xbb9e('0x4a')](_[_0xbb9e('0x53')](_0x5b11b2[_0xbb9e('0x48')],_0x2cd188[_0xbb9e('0x4a')]));if(_0x5b11b2[_0xbb9e('0x48')]['filter']){_0x292d55[_0xbb9e('0x52')]=_[_0xbb9e('0x5d')](_0x292d55[_0xbb9e('0x52')],{'$or':_[_0xbb9e('0x41')](_0x292d55[_0xbb9e('0x4c')],function(_0x5afc78){var _0x4d7ee5={};_0x4d7ee5[_0x5afc78]={'$like':'%'+_0x5b11b2[_0xbb9e('0x48')][_0xbb9e('0x54')]+'%'};return _0x4d7ee5;})});}_0x292d55=_[_0xbb9e('0x5d')]({},_0x292d55,_0x5b11b2[_0xbb9e('0x56')]);return _0x10f02d[_0xbb9e('0x7c')](_0x292d55);}})[_0xbb9e('0x22')](function(_0x4def48){if(_0x4def48){_0x5bce79=_0x4def48['length'];if(!_0x5b11b2[_0xbb9e('0x48')][_0xbb9e('0x4e')](_0xbb9e('0x4f'))){_0x292d55[_0xbb9e('0x30')]=qs[_0xbb9e('0x30')](_0x5b11b2[_0xbb9e('0x48')]['limit']);_0x292d55['offset']=qs['offset'](_0x5b11b2['query'][_0xbb9e('0x32')]);}return _0x10f02d['getAgents'](_0x292d55);}})[_0xbb9e('0x22')](function(_0x444d61){if(_0x444d61){return _0x444d61?{'count':_0x5bce79,'rows':_0x444d61}:null;}})['then'](respondWithResult(_0x3891fb,null))[_0xbb9e('0x5b')](handleError(_0x3891fb,null));};exports[_0xbb9e('0x7d')]=function(_0x13eb01,_0x16763d){var _0x4961bf=_0x13eb01[_0xbb9e('0x67')]['id'];var _0x5fb59d=_0x13eb01[_0xbb9e('0x60')];var _0x35de15=0xc8;var _0x29bad7=null;return db[_0xbb9e('0x7e')]['transaction']({'isolationLevel':db[_0xbb9e('0x7e')][_0xbb9e('0x7f')][_0xbb9e('0x80')][_0xbb9e('0x81')]},function(_0x57b522){return db[_0xbb9e('0x42')][_0xbb9e('0x6c')]({'where':{'id':_0x4961bf},'transaction':_0x57b522})[_0xbb9e('0x22')](function(_0x3207ae){if(_0x3207ae){return db[_0xbb9e('0x82')][_0xbb9e('0x38')]({'where':{'WhatsappAccountId':_0x4961bf},'transaction':_0x57b522})[_0xbb9e('0x22')](function(){var _0x41fd47=_['map'](_0x5fb59d,function(_0x5c1b1c){_0x5c1b1c[_0xbb9e('0x6d')]=_0x4961bf;return _0x5c1b1c;});return db['WhatsappApplication'][_0xbb9e('0x83')](_0x41fd47,{'transaction':_0x57b522});});}else{_0x35de15=0x194;_0x29bad7=[];}});})[_0xbb9e('0x22')](function(){if(_0x35de15!==0x194){return db['WhatsappApplication'][_0xbb9e('0x84')]({'where':{'WhatsappAccountId':_0x4961bf},'order':_0xbb9e('0x85')})[_0xbb9e('0x22')](function(_0x472177){_0x29bad7=_0x472177;});}})[_0xbb9e('0x5b')](function(_0x15edce){_0x35de15=0x1f4;logger['error'](_0x15edce[_0xbb9e('0x3b')]);if(_0x15edce['name']){delete _0x15edce['name'];}_0x29bad7=_0x15edce;})[_0xbb9e('0x86')](function(){if(_0x29bad7===null){_0x16763d[_0xbb9e('0x2c')](_0x35de15);}else{if(_0x35de15===0x1f4){_0x16763d['status'](_0x35de15)[_0xbb9e('0x3d')](_0x29bad7);}else{_0x16763d[_0xbb9e('0x2d')](_0x35de15)[_0xbb9e('0x34')](_0x29bad7);}}});};exports[_0xbb9e('0x87')]=function(_0x583f84,_0xb3a180,_0x13ca41){var _0x7a9f9d={};var _0x471da4={};var _0x5e8712;var _0xa111d6;return db['WhatsappAccount']['findOne']({'where':{'id':_0x583f84[_0xbb9e('0x67')]['id']}})[_0xbb9e('0x22')](handleEntityNotFound(_0xb3a180,null))['then'](function(_0x268a45){if(_0x268a45){_0x5e8712=_0x268a45;_0x471da4[_0xbb9e('0x47')]=_['keys'](db[_0xbb9e('0x82')][_0xbb9e('0x43')]);_0x471da4['query']=_['keys'](_0x583f84['query']);_0x471da4[_0xbb9e('0x4a')]=_['intersection'](_0x471da4[_0xbb9e('0x47')],_0x471da4['query']);_0x7a9f9d[_0xbb9e('0x4c')]=_['intersection'](_0x471da4[_0xbb9e('0x47')],qs['fields'](_0x583f84[_0xbb9e('0x48')]['fields']));_0x7a9f9d['attributes']=_0x7a9f9d[_0xbb9e('0x4c')][_0xbb9e('0x73')]?_0x7a9f9d[_0xbb9e('0x4c')]:_0x471da4[_0xbb9e('0x47')];_0x7a9f9d[_0xbb9e('0x50')]=qs[_0xbb9e('0x51')](_0x583f84[_0xbb9e('0x48')][_0xbb9e('0x51')]);_0x7a9f9d['where']=qs[_0xbb9e('0x4a')](_[_0xbb9e('0x53')](_0x583f84[_0xbb9e('0x48')],_0x471da4['filters']));if(_0x583f84[_0xbb9e('0x48')]['filter']){_0x7a9f9d[_0xbb9e('0x52')]=_['merge'](_0x7a9f9d['where'],{'$or':_['map'](_0x7a9f9d[_0xbb9e('0x4c')],function(_0x38403e){var _0x465350={};_0x465350[_0x38403e]={'$like':'%'+_0x583f84[_0xbb9e('0x48')][_0xbb9e('0x54')]+'%'};return _0x465350;})});}_0x7a9f9d=_[_0xbb9e('0x5d')]({},_0x7a9f9d,_0x583f84['options']);return _0x5e8712['getApplications'](_0x7a9f9d);}})[_0xbb9e('0x22')](function(_0xbd8aa8){if(_0xbd8aa8){_0xa111d6=_0xbd8aa8[_0xbb9e('0x73')];if(!_0x583f84[_0xbb9e('0x48')][_0xbb9e('0x4e')](_0xbb9e('0x4f'))){_0x7a9f9d[_0xbb9e('0x30')]=qs[_0xbb9e('0x30')](_0x583f84[_0xbb9e('0x48')]['limit']);_0x7a9f9d[_0xbb9e('0x32')]=qs['offset'](_0x583f84[_0xbb9e('0x48')][_0xbb9e('0x32')]);}return _0x5e8712['getApplications'](_0x7a9f9d);}})[_0xbb9e('0x22')](function(_0x309077){if(_0x309077){return _0x309077?{'count':_0xa111d6,'rows':_0x309077}:null;}})[_0xbb9e('0x22')](respondWithResult(_0xb3a180,null))['catch'](handleError(_0xb3a180,null));};exports[_0xbb9e('0x88')]=function(_0x459330,_0x553143,_0x16d4d0){var _0x405d61={'channel':_0xbb9e('0x89')};var _0x499abe=[];var _0x21b83a=[];var _0x1dc01b={};return db[_0xbb9e('0x42')][_0xbb9e('0x5e')]({'where':{'id':_0x459330[_0xbb9e('0x67')]['id']},'include':[{'model':db[_0xbb9e('0x82')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x553143,null))[_0xbb9e('0x22')](function(_0x43f1ed){_0x405d61[_0xbb9e('0x8a')]=_0x43f1ed;if(_0x405d61[_0xbb9e('0x8a')]&&_0x405d61[_0xbb9e('0x8a')]['type']==='sinch'&&_0x459330[_0xbb9e('0x60')]['statuses']){if(_0x459330['body']['statuses'][_0xbb9e('0x73')]===0x0)return;if(_0x459330[_0xbb9e('0x60')]['statuses'][0x0][_0xbb9e('0x8b')]!=='read')return;return db[_0xbb9e('0x8c')][_0xbb9e('0x66')]({'read':!![],'readAt':_0x459330[_0xbb9e('0x60')][_0xbb9e('0x8d')][0x0][_0xbb9e('0x8e')]},{'where':{'messageId':_0x459330['body'][_0xbb9e('0x8d')][0x0][_0xbb9e('0x8f')]},'individualHooks':!![]})['then'](function(_0x31809c){return _0x553143[_0xbb9e('0x2d')](0xc8)[_0xbb9e('0x34')](_0x31809c);});}_0x405d61[_0xbb9e('0x90')]=_['orderBy'](_0x43f1ed['Applications'],[_0xbb9e('0x85')],[_0xbb9e('0x91')]);if(_0x405d61[_0xbb9e('0x8a')]['Applications']){delete _0x405d61[_0xbb9e('0x8a')]['Applications'];}return db[_0xbb9e('0x92')][_0xbb9e('0x68')]()[_0xbb9e('0x22')](function(_0x4114ff){if(!_0x4114ff){throw new db[(_0xbb9e('0x93'))][(_0xbb9e('0x94'))]('no\x20available\x20attributes');}_0x499abe=_['difference'](_['keys'](_0x4114ff),[_0xbb9e('0x95'),_0xbb9e('0x96')]);_0x21b83a=_['difference'](_[_0xbb9e('0x49')](_0x4114ff),[_0xbb9e('0x95'),'updatedAt',_0xbb9e('0x97'),_0xbb9e('0x98')]);_0x405d61[_0xbb9e('0x60')]={'mapKey':_0xbb9e('0x99')};if(_0x405d61[_0xbb9e('0x8a')]&&_0x405d61[_0xbb9e('0x8a')][_0xbb9e('0x45')]===_0xbb9e('0x9a')){_0x405d61[_0xbb9e('0x60')]['from']=_0x459330[_0xbb9e('0x60')]['From']['replace']('whatsapp:','');_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x60')]=_0x459330['body'][_0xbb9e('0x9b')];_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x9c')]=_0x459330[_0xbb9e('0x60')][_0xbb9e('0x9d')];}if(_0x405d61[_0xbb9e('0x8a')]&&_0x405d61[_0xbb9e('0x8a')][_0xbb9e('0x45')]===_0xbb9e('0x9e')){_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x9f')]=_0x459330['body'][_0xbb9e('0xa0')][0x0][_0xbb9e('0x9f')];_0x405d61[_0xbb9e('0x60')]['body']=_0x459330['body'][_0xbb9e('0xa0')][0x0][_0xbb9e('0x29')]['body'];_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x9c')]=_0x459330[_0xbb9e('0x60')][_0xbb9e('0xa0')][0x0][_0xbb9e('0x8f')];}if(_0x405d61[_0xbb9e('0x60')]['id']){delete _0x405d61['body']['id'];}if(_[_0xbb9e('0xa1')](_0x405d61['body'][_0xbb9e('0x9f')])){throw new db[(_0xbb9e('0x93'))][(_0xbb9e('0x94'))](_0xbb9e('0xa2'));}if(_[_0xbb9e('0xa1')](_0x405d61['body'][_0xbb9e('0x60')])||_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x60')]===''){throw new db[(_0xbb9e('0x93'))][(_0xbb9e('0x94'))](_0xbb9e('0xa3'));}if(_[_0xbb9e('0xa1')](_0x405d61[_0xbb9e('0x60')][_0xbb9e('0xa4')])){throw new db[(_0xbb9e('0x93'))][(_0xbb9e('0x94'))](_0xbb9e('0xa5')+_0x21b83a);}if(!_[_0xbb9e('0xa6')](_0x21b83a,_0x405d61[_0xbb9e('0x60')][_0xbb9e('0xa4')])){throw new db['Sequelize']['ValidationError'](_0xbb9e('0xa7')+_0x21b83a);}_0x1dc01b[_0x405d61[_0xbb9e('0x60')][_0xbb9e('0xa4')]]=_0x405d61['body'][_0xbb9e('0x9f')];return db[_0xbb9e('0xa8')][_0xbb9e('0x5e')]({'where':{'id':_0x405d61[_0xbb9e('0x8a')][_0xbb9e('0x98')]},'include':[{'model':db['CmContact'],'as':_0xbb9e('0xa9'),'where':_0x1dc01b,'limit':0x1,'order':[[_0xbb9e('0x96'),_0xbb9e('0xaa')]]}]});})[_0xbb9e('0x22')](handleEntityNotFound(_0x553143,null))[_0xbb9e('0x22')](function(_0x4d91e7){if(_0x4d91e7){_0x405d61[_0xbb9e('0xab')]=_['omit'](_0x4d91e7,[_0xbb9e('0xa9')]);if(_0x4d91e7[_0xbb9e('0xa9')][_0xbb9e('0x73')]){return _0x4d91e7['Contacts'][0x0];}var _0x2d62ed=_[_0xbb9e('0x1a')](_0x405d61[_0xbb9e('0x60')],{'firstName':_0x405d61['body'][_0xbb9e('0x9f')],'ListId':_0x4d91e7['id']});_0x2d62ed[_0x405d61[_0xbb9e('0x60')]['mapKey']]=_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x9f')];return db[_0xbb9e('0x92')][_0xbb9e('0x5f')](_0x2d62ed,{'fields':_0x499abe,'raw':!![]});}})[_0xbb9e('0x22')](handleEntityNotFound(_0x553143,null))['then'](function(_0x377c6a){if(_0x377c6a){_0x405d61[_0xbb9e('0xac')]=_0x377c6a;var _0x1d0064={'ContactId':_0x377c6a['id'],'phone':_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x9f')],'WhatsappAccountId':_0x459330[_0xbb9e('0x67')]['id']};var _0x261bf7={'ContactId':_0x377c6a['id'],'WhatsappAccountId':_0x459330['params']['id'],'closed':![]};return db[_0xbb9e('0xad')][_0xbb9e('0x5e')]({'where':_0x261bf7})[_0xbb9e('0x22')](function(_0x3e3c5f){if(_0x3e3c5f){return[_0x3e3c5f,![]];}return db[_0xbb9e('0xad')][_0xbb9e('0x5f')](_0x1d0064)[_0xbb9e('0x22')](function(_0x344269){return[_0x344269,!![]];});});}})[_0xbb9e('0xae')](function(_0x1f6893,_0x3ee656){_0x405d61[_0xbb9e('0xaf')]=_0x1f6893[_0xbb9e('0x61')]({'plain':!![]});_0x405d61[_0xbb9e('0xaf')][_0xbb9e('0xb0')]=![];if(_0x3ee656){if(_0x405d61[_0xbb9e('0x8a')][_0xbb9e('0xb1')]){_0x405d61[_0xbb9e('0x90')][_0xbb9e('0xb2')]({'id':0x0,'priority':_0x405d61[_0xbb9e('0x90')][_0xbb9e('0x73')]+0x1,'app':_0xbb9e('0xb3'),'appdata':'unmanaged','interval':_0xbb9e('0xb4')});}_0x405d61[_0xbb9e('0xaf')]['created']=!![];}return db[_0xbb9e('0x8c')][_0xbb9e('0x5f')]({'phone':_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x9f')],'messageId':_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x9c')],'body':_0x405d61[_0xbb9e('0x60')][_0xbb9e('0x60')],'WhatsappAccountId':_0x459330[_0xbb9e('0x67')]['id'],'WhatsappInteractionId':_0x1f6893['id'],'direction':'in','ContactId':_0x1f6893['ContactId'],'AttachmentId':_0x405d61[_0xbb9e('0x60')][_0xbb9e('0xb5')]});})[_0xbb9e('0x22')](function(_0x2d2e1d){_0x405d61[_0xbb9e('0x29')]=_0x2d2e1d;if(_0x405d61[_0xbb9e('0xaf')][_0xbb9e('0xb6')]){return db[_0xbb9e('0x7b')][_0xbb9e('0x5e')]({'attributes':['id',_0xbb9e('0x3c')],'where':{'id':_0x405d61['interaction'][_0xbb9e('0xb6')]}})['then'](function(_0x1b6a49){if(_0x1b6a49){_0x405d61[_0xbb9e('0x90')][_0xbb9e('0xb7')]({'id':0x0,'priority':0x0,'app':_0xbb9e('0xb8'),'appdata':_0x1b6a49[_0xbb9e('0x3c')]+','+(_0x405d61['account'][_0xbb9e('0xb9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xbb9e('0xba'),_0x405d61);});}return respondWithRpcPromise(_0xbb9e('0xbb'),_0xbb9e('0xba'),_0x405d61);})[_0xbb9e('0x22')](function(_0x98d4e9){if(_0x98d4e9){var _0x5b31fb=0xc8;var _0x2e5dc4=_0xbb9e('0xbc');logger[_0xbb9e('0x2a')](_0xbb9e('0x25'),_0x2e5dc4,_0x5b31fb,_0xbb9e('0xbd'));logger[_0xbb9e('0xbe')](_0xbb9e('0xbf'),_0x2e5dc4,_0x5b31fb,_0xbb9e('0xbd'),JSON['stringify'](_0x98d4e9));if(_0x405d61[_0xbb9e('0x8a')][_0xbb9e('0x45')]===_0xbb9e('0x9a')){return _0x553143[_0xbb9e('0x2d')](_0x5b31fb)[_0xbb9e('0xc0')](_0xbb9e('0xc1'),'text/xml')[_0xbb9e('0x3d')]('\x0a');}else{return _0x553143[_0xbb9e('0x2d')](_0x5b31fb)[_0xbb9e('0x34')](_0x98d4e9);}}});})[_0xbb9e('0x5b')](handleError(_0x553143,null));};exports[_0xbb9e('0x3d')]=function(_0x1696b2,_0x20f5e1,_0x4aa074){var _0x21cbfd,_0x4829fe,_0x23d576;if(_[_0xbb9e('0xa1')](_0x1696b2[_0xbb9e('0x60')][_0xbb9e('0x60')])||_0x1696b2[_0xbb9e('0x60')]['body']===''){throw new db['Sequelize'][(_0xbb9e('0x94'))](_0xbb9e('0xa3'));}if(_['isNil'](_0x1696b2[_0xbb9e('0x60')]['to'])){throw new db[(_0xbb9e('0x93'))][(_0xbb9e('0x94'))]('to\x20is\x20mandatory');}_0x21cbfd=_0x1696b2[_0xbb9e('0x60')]['to'];return db[_0xbb9e('0x42')]['find']({'where':{'id':_0x1696b2[_0xbb9e('0x67')]['id']},'include':[{'model':db[_0xbb9e('0xa8')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x21cbfd},'limit':0x1,'order':[[_0xbb9e('0x96'),_0xbb9e('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x20f5e1,null))[_0xbb9e('0x22')](function(_0x1e609b){if(_0x1e609b&&_0x1e609b[_0xbb9e('0xc2')]){_0x4829fe=_0x1e609b[_0xbb9e('0x61')]({'plain':!![]});if(_0x4829fe['List']&&_0x4829fe['List'][_0xbb9e('0xa9')][_0xbb9e('0x73')]){return _0x4829fe[_0xbb9e('0xc2')]['Contacts'][0x0];}return db[_0xbb9e('0x92')][_0xbb9e('0x5f')](_[_0xbb9e('0x1a')](_0x1696b2['body'],{'firstName':_0x21cbfd,'mobile':_0x21cbfd,'phone':_0x21cbfd,'ListId':_0x4829fe[_0xbb9e('0x98')]}));}})[_0xbb9e('0x22')](handleEntityNotFound(_0x20f5e1,null))[_0xbb9e('0x22')](function(_0x245b38){if(_0x245b38){_0x23d576=_0x245b38;return db[_0xbb9e('0xad')][_0xbb9e('0x5e')]({'where':{'ContactId':_0x23d576['id'],'closed':![],'WhatsappAccountId':_0x4829fe['id']}})['then'](function(_0x1279ca){if(_0x1279ca){return[_0x1279ca,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x1696b2[_0xbb9e('0x64')]['id'],'ContactId':_0x23d576['id'],'WhatsappAccountId':_0x4829fe['id'],'phone':_0x21cbfd,'firstMsgDirection':_0xbb9e('0xc3'),'Messages':[_['merge'](_0x1696b2[_0xbb9e('0x60')],{'read':![],'body':_0x1696b2[_0xbb9e('0x60')][_0xbb9e('0x60')],'phone':_0x21cbfd,'WhatsappAccountId':_0x4829fe['id'],'UserId':_0x1696b2[_0xbb9e('0x64')]['id'],'ContactId':_0x23d576['id']})]},{'include':[{'model':db[_0xbb9e('0x8c')],'as':'Messages'}]})[_0xbb9e('0x22')](function(_0x1eb20c){return[_0x1eb20c,!![]];});});}})[_0xbb9e('0xae')](function(_0x5b06a7,_0xcbe338){if(_0xcbe338){return _0x5b06a7;}return db[_0xbb9e('0x8c')][_0xbb9e('0x5f')](_[_0xbb9e('0x5d')](_0x1696b2[_0xbb9e('0x60')],{'read':![],'body':_0x1696b2[_0xbb9e('0x60')][_0xbb9e('0x60')],'phone':_0x21cbfd,'WhatsappAccountId':_0x4829fe['id'],'WhatsappInteractionId':_0x5b06a7['id'],'UserId':_0x1696b2[_0xbb9e('0x64')]['id'],'ContactId':_0x23d576['id']}))[_0xbb9e('0x22')](function(_0x91fcb5){_0x5b06a7['dataValues'][_0xbb9e('0xc4')]=[];_0x5b06a7[_0xbb9e('0xc5')][_0xbb9e('0xc4')]['push'](_0x91fcb5[_0xbb9e('0xc5')]);return _0x5b06a7;});})[_0xbb9e('0x22')](respondWithResult(_0x20f5e1,null))[_0xbb9e('0x5b')](handleError(_0x20f5e1,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 5362d73..ac52491 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 _0x73d1=['WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2b3f35,_0x547fc9){var _0xdac08a=function(_0x526bad){while(--_0x526bad){_0x2b3f35['push'](_0x2b3f35['shift']());}};_0xdac08a(++_0x547fc9);}(_0x73d1,0x153));var _0x173d=function(_0x161c66,_0x565d77){_0x161c66=_0x161c66-0x0;var _0x18dcce=_0x73d1[_0x161c66];return _0x18dcce;};'use strict';var EventEmitter=require(_0x173d('0x0'));var WhatsappAccount=require(_0x173d('0x1'))['db'][_0x173d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x173d('0x3')](0x0);var events={'afterCreate':_0x173d('0x4'),'afterUpdate':_0x173d('0x5'),'afterDestroy':_0x173d('0x6')};function emitEvent(_0xbb42d0){return function(_0x46b063,_0x39cbff,_0x5ed700){WhatsappAccountEvents[_0x173d('0x7')](_0xbb42d0+':'+_0x46b063['id'],_0x46b063);WhatsappAccountEvents[_0x173d('0x7')](_0xbb42d0,_0x46b063);_0x5ed700(null);};}for(var e in events){if(events[_0x173d('0x8')](e)){var event=events[e];WhatsappAccount[_0x173d('0x9')](e,emitEvent(event));}}module[_0x173d('0xa')]=WhatsappAccountEvents; \ No newline at end of file +var _0xccc3=['emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','save','update','remove'];(function(_0x5738f7,_0x17df47){var _0x2e6d3c=function(_0x5c9b13){while(--_0x5c9b13){_0x5738f7['push'](_0x5738f7['shift']());}};_0x2e6d3c(++_0x17df47);}(_0xccc3,0xe5));var _0x3ccc=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xccc3[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x3ccc('0x0'))['db'][_0x3ccc('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3ccc('0x2'),'afterUpdate':_0x3ccc('0x3'),'afterDestroy':_0x3ccc('0x4')};function emitEvent(_0x52b8e9){return function(_0x6d1f15,_0x49822e,_0xf32799){WhatsappAccountEvents[_0x3ccc('0x5')](_0x52b8e9+':'+_0x6d1f15['id'],_0x6d1f15);WhatsappAccountEvents[_0x3ccc('0x5')](_0x52b8e9,_0x6d1f15);_0xf32799(null);};}for(var e in events){if(events[_0x3ccc('0x6')](e)){var event=events[e];WhatsappAccount[_0x3ccc('0x7')](e,emitEvent(event));}}module[_0x3ccc('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 4c6d792..a464b96 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 _0x29a5=['bluebird','request-promise','path','./whatsappAccount.attributes','define','WhatsappAccount','util','../../config/logger','api','moment'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0x29a5,0xce));var _0x529a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x29a5[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require(_0x529a('0x0'));var logger=require(_0x529a('0x1'))(_0x529a('0x2'));var moment=require(_0x529a('0x3'));var BPromise=require(_0x529a('0x4'));var rp=require(_0x529a('0x5'));var fs=require('fs');var path=require(_0x529a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x529a('0x7'));module['exports']=function(_0xc0f8c9,_0x216c2b){return _0xc0f8c9[_0x529a('0x8')](_0x529a('0x9'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad8c=['exports','whatsapp_accounts','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0x342edd,_0xf8cc8a){var _0x5d45ef=function(_0x1846a5){while(--_0x1846a5){_0x342edd['push'](_0x342edd['shift']());}};_0x5d45ef(++_0xf8cc8a);}(_0xad8c,0x160));var _0xcad8=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0xad8c[_0x38c652];return _0x218a37;};'use strict';var _=require('lodash');var util=require(_0xcad8('0x0'));var logger=require('../../config/logger')(_0xcad8('0x1'));var moment=require(_0xcad8('0x2'));var BPromise=require(_0xcad8('0x3'));var rp=require(_0xcad8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcad8('0x5'));var config=require(_0xcad8('0x6'));var attributes=require(_0xcad8('0x7'));module[_0xcad8('0x8')]=function(_0x40de44,_0x435229){return _0x40de44['define']('WhatsappAccount',attributes,{'tableName':_0xcad8('0x9'),'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 ba55b47..6c5c3d8 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 _0x08b7=['defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','ShowWhatsappAccount','WhatsappAccount','options','raw','where','include','map','model','attributes','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis'];(function(_0x241fda,_0x432e54){var _0x10ff6f=function(_0x20d05d){while(--_0x20d05d){_0x241fda['push'](_0x241fda['shift']());}};_0x10ff6f(++_0x432e54);}(_0x08b7,0xce));var _0x708b=function(_0x52f1e2,_0x42cf02){_0x52f1e2=_0x52f1e2-0x0;var _0x3e8615=_0x08b7[_0x52f1e2];return _0x3e8615;};'use strict';var _=require(_0x708b('0x0'));var util=require(_0x708b('0x1'));var moment=require(_0x708b('0x2'));var BPromise=require('bluebird');var rs=require(_0x708b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x708b('0x4'))['db'];var utils=require(_0x708b('0x5'));var logger=require('../../config/logger')(_0x708b('0x6'));var config=require('../../config/environment');var jayson=require(_0x708b('0x7'));var client=jayson[_0x708b('0x8')]['http']({'port':0x232a});config[_0x708b('0x9')]=_[_0x708b('0xa')](config[_0x708b('0x9')],{'host':_0x708b('0xb'),'port':0x18eb});var socket=require(_0x708b('0xc'))(new Redis(config[_0x708b('0x9')]));require(_0x708b('0xd'))[_0x708b('0xe')](socket);function respondWithRpcPromise(_0x189bc0,_0x46eeb6,_0x27f3f2){return new BPromise(function(_0x25427a,_0x566f84){return client[_0x708b('0xf')](_0x189bc0,_0x27f3f2)[_0x708b('0x10')](function(_0x3e649b){logger[_0x708b('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x46eeb6,_0x708b('0x12'));logger[_0x708b('0x13')](_0x708b('0x14'),_0x46eeb6,_0x708b('0x12'),JSON[_0x708b('0x15')](_0x3e649b));if(_0x3e649b[_0x708b('0x16')]){if(_0x3e649b[_0x708b('0x16')][_0x708b('0x17')]===0x1f4){logger['error'](_0x708b('0x18'),_0x46eeb6,_0x3e649b['error']['message']);return _0x566f84(_0x3e649b['error']['message']);}logger[_0x708b('0x16')](_0x708b('0x18'),_0x46eeb6,_0x3e649b['error'][_0x708b('0x19')]);return _0x25427a(_0x3e649b[_0x708b('0x16')][_0x708b('0x19')]);}else{logger[_0x708b('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x46eeb6,_0x708b('0x12'));_0x25427a(_0x3e649b['result'][_0x708b('0x19')]);}})['catch'](function(_0x1b47a5){logger[_0x708b('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x46eeb6,_0x1b47a5);_0x566f84(_0x1b47a5);});});}exports[_0x708b('0x1a')]=function(_0x28e766){var _0x5c23ec=this;return new Promise(function(_0x52408c,_0x3ee6fe){return db[_0x708b('0x1b')]['find']({'raw':_0x28e766[_0x708b('0x1c')]?_0x28e766[_0x708b('0x1c')][_0x708b('0x1d')]===undefined?!![]:![]:!![],'where':_0x28e766[_0x708b('0x1c')]?_0x28e766[_0x708b('0x1c')][_0x708b('0x1e')]||null:null,'attributes':_0x28e766[_0x708b('0x1c')]?_0x28e766[_0x708b('0x1c')]['attributes']||null:null,'include':_0x28e766[_0x708b('0x1c')]?_0x28e766[_0x708b('0x1c')][_0x708b('0x1f')]?_[_0x708b('0x20')](_0x28e766[_0x708b('0x1c')][_0x708b('0x1f')],function(_0x36003c){return{'model':db[_0x36003c[_0x708b('0x21')]],'as':_0x36003c['as'],'attributes':_0x36003c[_0x708b('0x22')],'include':_0x36003c[_0x708b('0x1f')]?_[_0x708b('0x20')](_0x36003c[_0x708b('0x1f')],function(_0x1e8357){return{'model':db[_0x1e8357[_0x708b('0x21')]],'as':_0x1e8357['as'],'attributes':_0x1e8357['attributes'],'include':_0x1e8357[_0x708b('0x1f')]?_['map'](_0x1e8357[_0x708b('0x1f')],function(_0x43527d){return{'model':db[_0x43527d['model']],'as':_0x43527d['as'],'attributes':_0x43527d[_0x708b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x708b('0x10')](function(_0x7dfbc5){logger[_0x708b('0x11')](_0x708b('0x1a'),_0x28e766);logger[_0x708b('0x13')](_0x708b('0x1a'),_0x28e766,JSON[_0x708b('0x15')](_0x7dfbc5));_0x52408c(_0x7dfbc5);})[_0x708b('0x23')](function(_0x306595){logger[_0x708b('0x16')](_0x708b('0x1a'),_0x306595[_0x708b('0x19')],_0x28e766);_0x3ee6fe(_0x5c23ec[_0x708b('0x16')](0x1f4,_0x306595['message']));});});}; \ No newline at end of file +var _0xea2e=['debug','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','util','moment','randomstring','ioredis','../../mysqldb','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xea2e,0xc5));var _0xeea2=function(_0x8ef481,_0x1cddc0){_0x8ef481=_0x8ef481-0x0;var _0x3989ea=_0xea2e[_0x8ef481];return _0x3989ea;};'use strict';var _=require('lodash');var util=require(_0xeea2('0x0'));var moment=require(_0xeea2('0x1'));var BPromise=require('bluebird');var rs=require(_0xeea2('0x2'));var fs=require('fs');var Redis=require(_0xeea2('0x3'));var db=require(_0xeea2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeea2('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeea2('0x6')][_0xeea2('0x7')]({'port':0x232a});config[_0xeea2('0x8')]=_[_0xeea2('0x9')](config[_0xeea2('0x8')],{'host':_0xeea2('0xa'),'port':0x18eb});var socket=require(_0xeea2('0xb'))(new Redis(config[_0xeea2('0x8')]));require(_0xeea2('0xc'))[_0xeea2('0xd')](socket);function respondWithRpcPromise(_0x4cbee6,_0x5f5867,_0x4e8617){return new BPromise(function(_0x6b3b0d,_0xf5de22){return client[_0xeea2('0xe')](_0x4cbee6,_0x4e8617)[_0xeea2('0xf')](function(_0x2cbe84){logger[_0xeea2('0x10')](_0xeea2('0x11'),_0x5f5867,_0xeea2('0x12'));logger[_0xeea2('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5f5867,_0xeea2('0x12'),JSON[_0xeea2('0x14')](_0x2cbe84));if(_0x2cbe84['error']){if(_0x2cbe84[_0xeea2('0x15')][_0xeea2('0x16')]===0x1f4){logger[_0xeea2('0x15')](_0xeea2('0x11'),_0x5f5867,_0x2cbe84[_0xeea2('0x15')][_0xeea2('0x17')]);return _0xf5de22(_0x2cbe84['error'][_0xeea2('0x17')]);}logger['error'](_0xeea2('0x11'),_0x5f5867,_0x2cbe84['error']['message']);return _0x6b3b0d(_0x2cbe84[_0xeea2('0x15')][_0xeea2('0x17')]);}else{logger[_0xeea2('0x10')](_0xeea2('0x11'),_0x5f5867,'request\x20sent');_0x6b3b0d(_0x2cbe84[_0xeea2('0x18')][_0xeea2('0x17')]);}})[_0xeea2('0x19')](function(_0x4e3e5e){logger[_0xeea2('0x15')](_0xeea2('0x11'),_0x5f5867,_0x4e3e5e);_0xf5de22(_0x4e3e5e);});});}exports[_0xeea2('0x1a')]=function(_0x10801b){var _0x2b3cde=this;return new Promise(function(_0x18d7df,_0x4a11a0){return db[_0xeea2('0x1b')][_0xeea2('0x1c')]({'raw':_0x10801b[_0xeea2('0x1d')]?_0x10801b['options'][_0xeea2('0x1e')]===undefined?!![]:![]:!![],'where':_0x10801b[_0xeea2('0x1d')]?_0x10801b[_0xeea2('0x1d')][_0xeea2('0x1f')]||null:null,'attributes':_0x10801b['options']?_0x10801b[_0xeea2('0x1d')][_0xeea2('0x20')]||null:null,'include':_0x10801b[_0xeea2('0x1d')]?_0x10801b['options'][_0xeea2('0x21')]?_[_0xeea2('0x22')](_0x10801b[_0xeea2('0x1d')][_0xeea2('0x21')],function(_0x20c0bb){return{'model':db[_0x20c0bb[_0xeea2('0x23')]],'as':_0x20c0bb['as'],'attributes':_0x20c0bb['attributes'],'include':_0x20c0bb[_0xeea2('0x21')]?_[_0xeea2('0x22')](_0x20c0bb[_0xeea2('0x21')],function(_0x2d4f8a){return{'model':db[_0x2d4f8a[_0xeea2('0x23')]],'as':_0x2d4f8a['as'],'attributes':_0x2d4f8a['attributes'],'include':_0x2d4f8a[_0xeea2('0x21')]?_[_0xeea2('0x22')](_0x2d4f8a[_0xeea2('0x21')],function(_0xa47181){return{'model':db[_0xa47181['model']],'as':_0xa47181['as'],'attributes':_0xa47181['attributes']};}):[]};}):[]};}):[]:[]})[_0xeea2('0xf')](function(_0x299251){logger['info'](_0xeea2('0x1a'),_0x10801b);logger[_0xeea2('0x13')](_0xeea2('0x1a'),_0x10801b,JSON[_0xeea2('0x14')](_0x299251));_0x18d7df(_0x299251);})[_0xeea2('0x19')](function(_0x27db1f){logger[_0xeea2('0x15')](_0xeea2('0x1a'),_0x27db1f[_0xeea2('0x17')],_0x10801b);_0x4a11a0(_0x2b3cde['error'](0x1f4,_0x27db1f[_0xeea2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 08f0a76..996dd64 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 _0x0e2c=['length','./whatsappAccount.events','save','remove','update','emit','register'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0e2c,0x1d6));var _0xc0e2=function(_0x5b5c37,_0x18ec24){_0x5b5c37=_0x5b5c37-0x0;var _0x502c2b=_0x0e2c[_0x5b5c37];return _0x502c2b;};'use strict';var WhatsappAccountEvents=require(_0xc0e2('0x0'));var events=[_0xc0e2('0x1'),_0xc0e2('0x2'),_0xc0e2('0x3')];function createListener(_0x5eb5a1,_0x173a20){return function(_0x4d637d){_0x173a20[_0xc0e2('0x4')](_0x5eb5a1,_0x4d637d);};}function removeListener(_0x334e01,_0x3aa074){return function(){WhatsappAccountEvents['removeListener'](_0x334e01,_0x3aa074);};}exports[_0xc0e2('0x5')]=function(_0x217b5a){for(var _0x21e7e0=0x0,_0x3f5a1f=events[_0xc0e2('0x6')];_0x21e7e0<_0x3f5a1f;_0x21e7e0++){var _0x390027=events[_0x21e7e0];var _0x1d85e3=createListener('whatsappAccount:'+_0x390027,_0x217b5a);WhatsappAccountEvents['on'](_0x390027,_0x1d85e3);}}; \ No newline at end of file +var _0x3f87=['remove','update','emit','removeListener','save'];(function(_0x25bafc,_0x3d7062){var _0x36b781=function(_0x139f33){while(--_0x139f33){_0x25bafc['push'](_0x25bafc['shift']());}};_0x36b781(++_0x3d7062);}(_0x3f87,0x6d));var _0x73f8=function(_0x33bba7,_0x137f1b){_0x33bba7=_0x33bba7-0x0;var _0x1df555=_0x3f87[_0x33bba7];return _0x1df555;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x73f8('0x0'),_0x73f8('0x1'),_0x73f8('0x2')];function createListener(_0x4ff780,_0x522e10){return function(_0x2c0534){_0x522e10[_0x73f8('0x3')](_0x4ff780,_0x2c0534);};}function removeListener(_0x352a1e,_0x700cc9){return function(){WhatsappAccountEvents[_0x73f8('0x4')](_0x352a1e,_0x700cc9);};}exports['register']=function(_0x551450){for(var _0x9a6f23=0x0,_0x3314b4=events['length'];_0x9a6f23<_0x3314b4;_0x9a6f23++){var _0x4f813e=events[_0x9a6f23];var _0x48c5c2=createListener('whatsappAccount:'+_0x4f813e,_0x551450);WhatsappAccountEvents['on'](_0x4f813e,_0x48c5c2);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index bfb6aa4..0d29b14 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 _0x06f3=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x3f9537,_0x375341){var _0xfbd2a7=function(_0x56bafc){while(--_0x56bafc){_0x3f9537['push'](_0x3f9537['shift']());}};_0xfbd2a7(++_0x375341);}(_0x06f3,0x1b7));var _0x306f=function(_0x4214af,_0x197efd){_0x4214af=_0x4214af-0x0;var _0x1f6b1e=_0x06f3[_0x4214af];return _0x1f6b1e;};'use strict';var multer=require(_0x306f('0x0'));var util=require(_0x306f('0x1'));var path=require(_0x306f('0x2'));var timeout=require('connect-timeout');var express=require(_0x306f('0x3'));var router=express['Router']();var fs_extra=require(_0x306f('0x4'));var auth=require(_0x306f('0x5'));var interaction=require(_0x306f('0x6'));var config=require(_0x306f('0x7'));var controller=require(_0x306f('0x8'));router[_0x306f('0x9')]('/',auth[_0x306f('0xa')](),controller[_0x306f('0xb')]);router[_0x306f('0x9')](_0x306f('0xc'),auth[_0x306f('0xa')](),controller[_0x306f('0xd')]);router[_0x306f('0xe')]('/',auth['isAuthenticated'](),controller[_0x306f('0xf')]);router[_0x306f('0x10')](_0x306f('0xc'),auth[_0x306f('0xa')](),controller[_0x306f('0x11')]);router[_0x306f('0x12')](_0x306f('0xc'),auth[_0x306f('0xa')](),controller['destroy']);module[_0x306f('0x13')]=router; \ No newline at end of file +var _0x1a13=['index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x31a8db,_0x9151c8){var _0x740e5d=function(_0x47aa74){while(--_0x47aa74){_0x31a8db['push'](_0x31a8db['shift']());}};_0x740e5d(++_0x9151c8);}(_0x1a13,0x10e));var _0x31a1=function(_0x25e9df,_0x17a63a){_0x25e9df=_0x25e9df-0x0;var _0x3dea70=_0x1a13[_0x25e9df];return _0x3dea70;};'use strict';var multer=require(_0x31a1('0x0'));var util=require(_0x31a1('0x1'));var path=require(_0x31a1('0x2'));var timeout=require(_0x31a1('0x3'));var express=require(_0x31a1('0x4'));var router=express[_0x31a1('0x5')]();var fs_extra=require(_0x31a1('0x6'));var auth=require(_0x31a1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x31a1('0x8'));var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x31a1('0x9')](),controller[_0x31a1('0xa')]);router['get']('/:id',auth[_0x31a1('0x9')](),controller[_0x31a1('0xb')]);router[_0x31a1('0xc')]('/',auth[_0x31a1('0x9')](),controller[_0x31a1('0xd')]);router[_0x31a1('0xe')](_0x31a1('0xf'),auth[_0x31a1('0x9')](),controller[_0x31a1('0x10')]);router[_0x31a1('0x11')](_0x31a1('0xf'),auth['isAuthenticated'](),controller[_0x31a1('0x12')]);module[_0x31a1('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 f44638c..fb15853 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 _0xe52c=['INTEGER','noop','TEXT','STRING','exports'];(function(_0x3f0d52,_0xcfee2c){var _0x4712a1=function(_0x43e462){while(--_0x43e462){_0x3f0d52['push'](_0x3f0d52['shift']());}};_0x4712a1(++_0xcfee2c);}(_0xe52c,0x86));var _0xce52=function(_0x4089f5,_0x1e1be9){_0x4089f5=_0x4089f5-0x0;var _0x1755c5=_0xe52c[_0x4089f5];return _0x1755c5;};'use strict';var Sequelize=require('sequelize');module[_0xce52('0x0')]={'priority':{'type':Sequelize[_0xce52('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xce52('0x2')},'appdata':{'type':Sequelize[_0xce52('0x3')]()},'description':{'type':Sequelize[_0xce52('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x13e5=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0xa4fe30,_0x2d80b4){var _0x2bd33b=function(_0x4639e0){while(--_0x4639e0){_0xa4fe30['push'](_0xa4fe30['shift']());}};_0x2bd33b(++_0x2d80b4);}(_0x13e5,0x86));var _0x513e=function(_0x5935bf,_0x5221d2){_0x5935bf=_0x5935bf-0x0;var _0x22b061=_0x13e5[_0x5935bf];return _0x22b061;};'use strict';var Sequelize=require('sequelize');module[_0x513e('0x0')]={'priority':{'type':Sequelize[_0x513e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x513e('0x2')],'allowNull':![],'defaultValue':_0x513e('0x3')},'appdata':{'type':Sequelize[_0x513e('0x4')]()},'description':{'type':Sequelize[_0x513e('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x513e('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index b60c360..aff5f29 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 _0xef0f=['offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','WhatsappApplication','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x50b711,_0x47f5fd){var _0x1783df=function(_0x3428e0){while(--_0x3428e0){_0x50b711['push'](_0x50b711['shift']());}};_0x1783df(++_0x47f5fd);}(_0xef0f,0x168));var _0xfef0=function(_0x216d84,_0x592540){_0x216d84=_0x216d84-0x0;var _0x115b45=_0xef0f[_0x216d84];return _0x115b45;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=typeof _0x5acdd0[_0xfef0('0x1e')]===_0xfef0('0x1f')&&typeof _0x5acdd0[_0xfef0('0x20')]===_0xfef0('0x1f');var _0x155833=_0x118b8d[_0xfef0('0x21')];var _0x581459=_0x284b6d?0x0:_0x5acdd0[_0xfef0('0x1e')];var _0x1642cd=_0x284b6d?_0x118b8d[_0xfef0('0x21')]:_0x5acdd0[_0xfef0('0x1e')]+_0x5acdd0[_0xfef0('0x20')];var _0x55912f;if(_0x1642cd>=_0x155833){_0x1642cd=_0x155833;_0x55912f=0xc8;}else{_0x55912f=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x55912f);return _0x4b5bcf['set'](_0xfef0('0x22'),_0x581459+'-'+_0x1642cd+'/'+_0x155833)[_0xfef0('0x23')](_0x118b8d);}return null;};}function patchUpdates(_0x28dee1){return function(_0x48408a){try{jsonpatch[_0xfef0('0x24')](_0x48408a,_0x28dee1,!![]);}catch(_0x4c304d){return BPromise[_0xfef0('0x25')](_0x4c304d);}return _0x48408a[_0xfef0('0x26')]();};}function saveUpdates(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')](_0x52b93b)['then'](function(_0x1f9970){return _0x1f9970;});}return null;};}function removeEntity(_0x46b34a,_0x1a8d66){return function(_0x4483f2){if(_0x4483f2){return _0x4483f2[_0xfef0('0x28')]()[_0xfef0('0x29')](function(){_0x46b34a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x1b')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x2a')](_0x5df04f[_0xfef0('0x2b')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x2c')];}_0xab231c[_0xfef0('0x1c')](_0xf60f2)[_0xfef0('0x2d')](_0x5df04f);};}exports[_0xfef0('0x2e')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=_[_0xfef0('0x2f')](db[_0xfef0('0x30')]['rawAttributes'],function(_0x445625){return{'name':_0x445625['fieldName'],'type':_0x445625['type'][_0xfef0('0x31')]};});_0x3e026a[_0xfef0('0x32')]=_['map'](_0x213a91,'name');_0x3e026a['query']=_['keys'](_0x37921f['query']);_0x3e026a[_0xfef0('0x33')]=_[_0xfef0('0x34')](_0x3e026a[_0xfef0('0x32')],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x32')],qs['fields'](_0x37921f[_0xfef0('0x35')][_0xfef0('0x36')]));_0x3e3c4c[_0xfef0('0x37')]=_0x3e3c4c['attributes'][_0xfef0('0x38')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x32')];if(!_0x37921f[_0xfef0('0x35')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x3e3c4c[_0xfef0('0x20')]=qs[_0xfef0('0x20')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x20')]);_0x3e3c4c['offset']=qs[_0xfef0('0x1e')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x1e')]);}_0x3e3c4c[_0xfef0('0x3b')]=qs[_0xfef0('0x3c')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x3c')]);_0x3e3c4c[_0xfef0('0x3d')]=qs[_0xfef0('0x33')](_[_0xfef0('0x3e')](_0x37921f[_0xfef0('0x35')],_0x3e026a[_0xfef0('0x33')]),_0x213a91);if(_0x37921f[_0xfef0('0x35')]['filter']){_0x3e3c4c[_0xfef0('0x3d')]=_['merge'](_0x3e3c4c[_0xfef0('0x3d')],{'$or':_[_0xfef0('0x2f')](_0x213a91,function(_0x1ddce6){if(_0x1ddce6['type']!==_0xfef0('0x3f')){var _0x29469e={};_0x29469e[_0x1ddce6[_0xfef0('0x2c')]]={'$like':'%'+_0x37921f['query'][_0xfef0('0x40')]+'%'};return _0x29469e;}})});}_0x3e3c4c=_[_0xfef0('0x41')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x42')]);var _0x5577f4={'where':_0x3e3c4c[_0xfef0('0x3d')]};return db['WhatsappApplication']['count'](_0x5577f4)[_0xfef0('0x29')](function(_0x547a5d){_0x26cb9a['count']=_0x547a5d;if(_0x37921f[_0xfef0('0x35')][_0xfef0('0x43')]){_0x3e3c4c[_0xfef0('0x44')]=[{'all':!![]}];}return db[_0xfef0('0x30')][_0xfef0('0x45')](_0x3e3c4c);})[_0xfef0('0x29')](function(_0x4dd8f8){_0x26cb9a[_0xfef0('0x46')]=_0x4dd8f8;return _0x26cb9a;})[_0xfef0('0x29')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))['catch'](handleError(_0x1ac4a3,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':!![],'where':{'id':_0x1d554e[_0xfef0('0x47')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x32')]=_[_0xfef0('0x48')](db[_0xfef0('0x30')][_0xfef0('0x49')]);_0x22c940[_0xfef0('0x35')]=_['keys'](_0x1d554e[_0xfef0('0x35')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x32')],_0x22c940[_0xfef0('0x35')]);_0x1fc518['attributes']=_[_0xfef0('0x34')](_0x22c940['model'],qs[_0xfef0('0x36')](_0x1d554e[_0xfef0('0x35')][_0xfef0('0x36')]));_0x1fc518[_0xfef0('0x37')]=_0x1fc518['attributes'][_0xfef0('0x38')]?_0x1fc518[_0xfef0('0x37')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x43')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x41')]({},_0x1fc518,_0x1d554e[_0xfef0('0x42')]);return db[_0xfef0('0x30')][_0xfef0('0x4a')](_0x1fc518)[_0xfef0('0x29')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x29')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x4b')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x30')][_0xfef0('0x4b')](_0x559a28[_0xfef0('0x4c')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x4d')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x4c')]['id']){delete _0x5dd26b[_0xfef0('0x4c')]['id'];}return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x5dd26b[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x29')](saveUpdates(_0x5dd26b[_0xfef0('0x4c')],null))[_0xfef0('0x29')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x2bebec[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x29')](removeEntity(_0x18e5ba,null))[_0xfef0('0x4d')](handleError(_0x18e5ba,null));}; \ No newline at end of file +var _0x50e5=['map','WhatsappApplication','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','update','then','error','stack','name','index'];(function(_0x21dbe5,_0x42c6d4){var _0x33cf9e=function(_0x267453){while(--_0x267453){_0x21dbe5['push'](_0x21dbe5['shift']());}};_0x33cf9e(++_0x42c6d4);}(_0x50e5,0xb7));var _0x550e=function(_0x5b1d31,_0x5268c8){_0x5b1d31=_0x5b1d31-0x0;var _0x1276e8=_0x50e5[_0x5b1d31];return _0x1276e8;};'use strict';var emlformat=require(_0x550e('0x0'));var rimraf=require(_0x550e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x550e('0x2'));var rp=require(_0x550e('0x3'));var moment=require(_0x550e('0x4'));var BPromise=require(_0x550e('0x5'));var Mustache=require(_0x550e('0x6'));var util=require(_0x550e('0x7'));var path=require(_0x550e('0x8'));var sox=require(_0x550e('0x9'));var csv=require(_0x550e('0xa'));var ejs=require(_0x550e('0xb'));var fs=require('fs');var fs_extra=require(_0x550e('0xc'));var _=require(_0x550e('0xd'));var squel=require('squel');var crypto=require(_0x550e('0xe'));var jsforce=require(_0x550e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x550e('0xa'));var querystring=require(_0x550e('0x10'));var Papa=require(_0x550e('0x11'));var Redis=require('ioredis');var authService=require(_0x550e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x550e('0x13'));var logger=require(_0x550e('0x14'))('api');var utils=require(_0x550e('0x15'));var config=require(_0x550e('0x16'));var licenseUtil=require(_0x550e('0x17'));var db=require(_0x550e('0x18'))['db'];function respondWithStatusCode(_0x518cad,_0x335cba){_0x335cba=_0x335cba||0xcc;return function(_0x57214a){if(_0x57214a){return _0x518cad[_0x550e('0x19')](_0x335cba);}return _0x518cad['status'](_0x335cba)[_0x550e('0x1a')]();};}function respondWithResult(_0x4c6070,_0x393055){_0x393055=_0x393055||0xc8;return function(_0x2d4b79){if(_0x2d4b79){return _0x4c6070[_0x550e('0x1b')](_0x393055)['json'](_0x2d4b79);}};}function respondWithFilteredResult(_0x302be0,_0x49787c){return function(_0xf28ba7){if(_0xf28ba7){var _0x49474f=typeof _0x49787c['offset']===_0x550e('0x1c')&&typeof _0x49787c[_0x550e('0x1d')]==='undefined';var _0x4e49bf=_0xf28ba7['count'];var _0x22c264=_0x49474f?0x0:_0x49787c['offset'];var _0x580c6f=_0x49474f?_0xf28ba7[_0x550e('0x1e')]:_0x49787c[_0x550e('0x1f')]+_0x49787c[_0x550e('0x1d')];var _0x846ad;if(_0x580c6f>=_0x4e49bf){_0x580c6f=_0x4e49bf;_0x846ad=0xc8;}else{_0x846ad=0xce;}_0x302be0[_0x550e('0x1b')](_0x846ad);return _0x302be0[_0x550e('0x20')](_0x550e('0x21'),_0x22c264+'-'+_0x580c6f+'/'+_0x4e49bf)[_0x550e('0x22')](_0xf28ba7);}return null;};}function patchUpdates(_0x1b9799){return function(_0x47e6e1){try{jsonpatch[_0x550e('0x23')](_0x47e6e1,_0x1b9799,!![]);}catch(_0x106c68){return BPromise['reject'](_0x106c68);}return _0x47e6e1['save']();};}function saveUpdates(_0x3e9822,_0x2663c7){return function(_0x5769bb){if(_0x5769bb){return _0x5769bb[_0x550e('0x24')](_0x3e9822)[_0x550e('0x25')](function(_0x1762c3){return _0x1762c3;});}return null;};}function removeEntity(_0x317249,_0x3aa1b8){return function(_0x3bbca3){if(_0x3bbca3){return _0x3bbca3['destroy']()[_0x550e('0x25')](function(){_0x317249[_0x550e('0x1b')](0xcc)[_0x550e('0x1a')]();});}};}function handleEntityNotFound(_0x2d10f3,_0x403391){return function(_0xc94de2){if(!_0xc94de2){_0x2d10f3[_0x550e('0x19')](0x194);}return _0xc94de2;};}function handleError(_0x111161,_0x13ca4e){_0x13ca4e=_0x13ca4e||0x1f4;return function(_0x136beb){logger[_0x550e('0x26')](_0x136beb[_0x550e('0x27')]);if(_0x136beb['name']){delete _0x136beb[_0x550e('0x28')];}_0x111161[_0x550e('0x1b')](_0x13ca4e)['send'](_0x136beb);};}exports[_0x550e('0x29')]=function(_0x78f04c,_0x7ae242){var _0x33bc32={},_0x1a4caa={},_0x403472={'count':0x0,'rows':[]};var _0x449da3=_[_0x550e('0x2a')](db[_0x550e('0x2b')][_0x550e('0x2c')],function(_0x25c40a){return{'name':_0x25c40a[_0x550e('0x2d')],'type':_0x25c40a[_0x550e('0x2e')][_0x550e('0x2f')]};});_0x1a4caa['model']=_[_0x550e('0x2a')](_0x449da3,_0x550e('0x28'));_0x1a4caa['query']=_[_0x550e('0x30')](_0x78f04c[_0x550e('0x31')]);_0x1a4caa['filters']=_[_0x550e('0x32')](_0x1a4caa[_0x550e('0x33')],_0x1a4caa[_0x550e('0x31')]);_0x33bc32[_0x550e('0x34')]=_[_0x550e('0x32')](_0x1a4caa[_0x550e('0x33')],qs[_0x550e('0x35')](_0x78f04c[_0x550e('0x31')]['fields']));_0x33bc32[_0x550e('0x34')]=_0x33bc32['attributes'][_0x550e('0x36')]?_0x33bc32[_0x550e('0x34')]:_0x1a4caa['model'];if(!_0x78f04c[_0x550e('0x31')][_0x550e('0x37')]('nolimit')){_0x33bc32['limit']=qs['limit'](_0x78f04c['query'][_0x550e('0x1d')]);_0x33bc32[_0x550e('0x1f')]=qs[_0x550e('0x1f')](_0x78f04c['query']['offset']);}_0x33bc32['order']=qs[_0x550e('0x38')](_0x78f04c[_0x550e('0x31')]['sort']);_0x33bc32['where']=qs['filters'](_[_0x550e('0x39')](_0x78f04c[_0x550e('0x31')],_0x1a4caa[_0x550e('0x3a')]),_0x449da3);if(_0x78f04c['query']['filter']){_0x33bc32[_0x550e('0x3b')]=_[_0x550e('0x3c')](_0x33bc32[_0x550e('0x3b')],{'$or':_[_0x550e('0x2a')](_0x449da3,function(_0x4f4671){if(_0x4f4671[_0x550e('0x2e')]!==_0x550e('0x3d')){var _0x4cfde4={};_0x4cfde4[_0x4f4671['name']]={'$like':'%'+_0x78f04c[_0x550e('0x31')][_0x550e('0x3e')]+'%'};return _0x4cfde4;}})});}_0x33bc32=_[_0x550e('0x3c')]({},_0x33bc32,_0x78f04c[_0x550e('0x3f')]);var _0x5badca={'where':_0x33bc32[_0x550e('0x3b')]};return db[_0x550e('0x2b')][_0x550e('0x1e')](_0x5badca)[_0x550e('0x25')](function(_0x4d7297){_0x403472[_0x550e('0x1e')]=_0x4d7297;if(_0x78f04c[_0x550e('0x31')][_0x550e('0x40')]){_0x33bc32[_0x550e('0x41')]=[{'all':!![]}];}return db[_0x550e('0x2b')][_0x550e('0x42')](_0x33bc32);})['then'](function(_0x2f8cf5){_0x403472[_0x550e('0x43')]=_0x2f8cf5;return _0x403472;})[_0x550e('0x25')](respondWithFilteredResult(_0x7ae242,_0x33bc32))[_0x550e('0x44')](handleError(_0x7ae242,null));};exports[_0x550e('0x45')]=function(_0x4af549,_0x10f18f){var _0x2db9c9={'raw':!![],'where':{'id':_0x4af549[_0x550e('0x46')]['id']}},_0x5ca5fc={};_0x5ca5fc[_0x550e('0x33')]=_[_0x550e('0x30')](db['WhatsappApplication']['rawAttributes']);_0x5ca5fc[_0x550e('0x31')]=_[_0x550e('0x30')](_0x4af549['query']);_0x5ca5fc[_0x550e('0x3a')]=_[_0x550e('0x32')](_0x5ca5fc['model'],_0x5ca5fc[_0x550e('0x31')]);_0x2db9c9[_0x550e('0x34')]=_[_0x550e('0x32')](_0x5ca5fc[_0x550e('0x33')],qs[_0x550e('0x35')](_0x4af549[_0x550e('0x31')]['fields']));_0x2db9c9[_0x550e('0x34')]=_0x2db9c9['attributes'][_0x550e('0x36')]?_0x2db9c9[_0x550e('0x34')]:_0x5ca5fc['model'];if(_0x4af549[_0x550e('0x31')][_0x550e('0x40')]){_0x2db9c9[_0x550e('0x41')]=[{'all':!![]}];}_0x2db9c9=_[_0x550e('0x3c')]({},_0x2db9c9,_0x4af549[_0x550e('0x3f')]);return db[_0x550e('0x2b')]['find'](_0x2db9c9)[_0x550e('0x25')](handleEntityNotFound(_0x10f18f,null))[_0x550e('0x25')](respondWithResult(_0x10f18f,null))[_0x550e('0x44')](handleError(_0x10f18f,null));};exports[_0x550e('0x47')]=function(_0x5a9ef5,_0xbfd031){return db[_0x550e('0x2b')][_0x550e('0x47')](_0x5a9ef5[_0x550e('0x48')],{})[_0x550e('0x25')](respondWithResult(_0xbfd031,0xc9))[_0x550e('0x44')](handleError(_0xbfd031,null));};exports[_0x550e('0x24')]=function(_0xfbad1e,_0x2d233b){if(_0xfbad1e[_0x550e('0x48')]['id']){delete _0xfbad1e[_0x550e('0x48')]['id'];}return db[_0x550e('0x2b')][_0x550e('0x49')]({'where':{'id':_0xfbad1e[_0x550e('0x46')]['id']}})[_0x550e('0x25')](handleEntityNotFound(_0x2d233b,null))[_0x550e('0x25')](saveUpdates(_0xfbad1e[_0x550e('0x48')],null))['then'](respondWithResult(_0x2d233b,null))[_0x550e('0x44')](handleError(_0x2d233b,null));};exports[_0x550e('0x4a')]=function(_0x22dc07,_0x264c4d){return db[_0x550e('0x2b')][_0x550e('0x49')]({'where':{'id':_0x22dc07[_0x550e('0x46')]['id']}})['then'](handleEntityNotFound(_0x264c4d,null))[_0x550e('0x25')](removeEntity(_0x264c4d,null))[_0x550e('0x44')](handleError(_0x264c4d,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b223942..c93cba2 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 _0xd847=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xd847,0x18a));var _0x7d84=function(_0x5bc95e,_0x34e27a){_0x5bc95e=_0x5bc95e-0x0;var _0x1ebc03=_0xd847[_0x5bc95e];return _0x1ebc03;};'use strict';var _=require(_0x7d84('0x0'));var util=require(_0x7d84('0x1'));var logger=require(_0x7d84('0x2'))(_0x7d84('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7d84('0x4'));var fs=require('fs');var path=require(_0x7d84('0x5'));var rimraf=require(_0x7d84('0x6'));var config=require(_0x7d84('0x7'));var attributes=require(_0x7d84('0x8'));module['exports']=function(_0x1544e7,_0x5d8f76){return _0x1544e7[_0x7d84('0x9')](_0x7d84('0xa'),attributes,{'tableName':_0x7d84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7d84('0xc'),'collate':_0x7d84('0xd')});}; \ No newline at end of file +var _0x089f=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','WhatsappApplication','whatsapp_applications','utf8mb4','util'];(function(_0x370852,_0x2c7e62){var _0x40cc7e=function(_0x34a439){while(--_0x34a439){_0x370852['push'](_0x370852['shift']());}};_0x40cc7e(++_0x2c7e62);}(_0x089f,0x1c7));var _0xf089=function(_0x4157a7,_0x2fb62e){_0x4157a7=_0x4157a7-0x0;var _0x4ba2a2=_0x089f[_0x4157a7];return _0x4ba2a2;};'use strict';var _=require('lodash');var util=require(_0xf089('0x0'));var logger=require(_0xf089('0x1'))(_0xf089('0x2'));var moment=require(_0xf089('0x3'));var BPromise=require(_0xf089('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf089('0x5'));var rimraf=require(_0xf089('0x6'));var config=require(_0xf089('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0xf089('0x8')]=function(_0x126d3d,_0x21bce2){return _0x126d3d['define'](_0xf089('0x9'),attributes,{'tableName':_0xf089('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf089('0xb'),'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 efdbf36..b0988d9 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappApplication,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x14d5d5,_0x4e1fe6){var _0x45dd85=function(_0x2d71cc){while(--_0x2d71cc){_0x14d5d5['push'](_0x14d5d5['shift']());}};_0x45dd85(++_0x4e1fe6);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0x4b84[_0x4d82ea];return _0x257f4a;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('WhatsappApplication,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0xd0bb=['debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x14d027,_0x2903eb){var _0x56a1bb=function(_0x511f8f){while(--_0x511f8f){_0x14d027['push'](_0x14d027['shift']());}};_0x56a1bb(++_0x2903eb);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x599d7f,_0xc586e8){_0x599d7f=_0x599d7f-0x0;var _0x3346d3=_0xd0bb[_0x599d7f];return _0x3346d3;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 91034a1..e4d4bd5 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 _0xa1f6=['whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked'];(function(_0x58ae8a,_0x3c619e){var _0x2f0b6b=function(_0x6db940){while(--_0x6db940){_0x58ae8a['push'](_0x58ae8a['shift']());}};_0x2f0b6b(++_0x3c619e);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x20fb02,_0x96c029){_0x20fb02=_0x20fb02-0x0;var _0x24a33e=_0xa1f6[_0x20fb02];return _0x24a33e;};'use strict';var multer=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var path=require(_0x6a1f('0x2'));var timeout=require(_0x6a1f('0x3'));var express=require(_0x6a1f('0x4'));var router=express[_0x6a1f('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('./whatsappInteraction.controller');router[_0x6a1f('0x6')]('/',auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x8')]);router[_0x6a1f('0x6')](_0x6a1f('0x9'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xa')]);router['get'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xc')]);router[_0x6a1f('0x6')](_0x6a1f('0xd'),auth['isAuthenticated'](),controller[_0x6a1f('0xe')]);router[_0x6a1f('0x6')](_0x6a1f('0xf'),auth[_0x6a1f('0x7')](),controller['download']);router[_0x6a1f('0x10')]('/',auth['isAuthenticated'](),controller[_0x6a1f('0x11')]);router[_0x6a1f('0x10')](_0x6a1f('0xd'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x12')]);router[_0x6a1f('0x10')](_0x6a1f('0x13'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x16')),controller[_0x6a1f('0x17')]);router[_0x6a1f('0x18')](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x19')),controller[_0x6a1f('0x1a')]);router['delete'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x1b')),controller[_0x6a1f('0x1c')]);router[_0x6a1f('0x1d')](_0x6a1f('0x13'),auth['isAuthenticated'](),controller[_0x6a1f('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x4300=['removeTags','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','addTags','put','update','whatsappinteraction:destroy','destroy'];(function(_0x4bff69,_0x5b3bc8){var _0x490f4c=function(_0x1995b9){while(--_0x1995b9){_0x4bff69['push'](_0x4bff69['shift']());}};_0x490f4c(++_0x5b3bc8);}(_0x4300,0x1a6));var _0x0430=function(_0x56dddf,_0x470a16){_0x56dddf=_0x56dddf-0x0;var _0x16a959=_0x4300[_0x56dddf];return _0x16a959;};'use strict';var multer=require(_0x0430('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0430('0x1')]();var fs_extra=require(_0x0430('0x2'));var auth=require(_0x0430('0x3'));var interaction=require(_0x0430('0x4'));var config=require(_0x0430('0x5'));var controller=require('./whatsappInteraction.controller');router[_0x0430('0x6')]('/',auth['isAuthenticated'](),controller[_0x0430('0x7')]);router['get'](_0x0430('0x8'),auth[_0x0430('0x9')](),controller[_0x0430('0xa')]);router[_0x0430('0x6')](_0x0430('0xb'),auth[_0x0430('0x9')](),controller[_0x0430('0xc')]);router[_0x0430('0x6')](_0x0430('0xd'),auth['isAuthenticated'](),controller[_0x0430('0xe')]);router[_0x0430('0x6')](_0x0430('0xf'),auth[_0x0430('0x9')](),controller[_0x0430('0x10')]);router[_0x0430('0x11')]('/',auth[_0x0430('0x9')](),controller[_0x0430('0x12')]);router['post']('/:id/messages',auth[_0x0430('0x9')](),controller[_0x0430('0x13')]);router[_0x0430('0x11')](_0x0430('0x14'),auth[_0x0430('0x9')](),interaction[_0x0430('0x15')](_0x0430('0x16'),'whatsappinteraction:addtags'),controller[_0x0430('0x17')]);router[_0x0430('0x18')](_0x0430('0xb'),auth[_0x0430('0x9')](),interaction['tracked']('whatsapp','whatsappinteraction:update'),controller[_0x0430('0x19')]);router['delete']('/:id',auth[_0x0430('0x9')](),interaction[_0x0430('0x15')](_0x0430('0x16'),_0x0430('0x1a')),controller[_0x0430('0x1b')]);router['delete']('/:id/tags',auth[_0x0430('0x9')](),controller[_0x0430('0x1c')]);module[_0x0430('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 8a7ab2d..7cc18a4 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 _0x746f=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x1f81df,_0x1373ef){var _0x5eb1dc=function(_0x3def6a){while(--_0x3def6a){_0x1f81df['push'](_0x1f81df['shift']());}};_0x5eb1dc(++_0x1373ef);}(_0x746f,0x9c));var _0xf746=function(_0x42c60a,_0x516bcc){_0x42c60a=_0x42c60a-0x0;var _0x3c71f6=_0x746f[_0x42c60a];return _0x3c71f6;};'use strict';var Sequelize=require(_0xf746('0x0'));var moment=require(_0xf746('0x1'));module[_0xf746('0x2')]={'closed':{'type':Sequelize[_0xf746('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf746('0x4')]},'disposition':{'type':Sequelize[_0xf746('0x5')]},'secondDisposition':{'type':Sequelize[_0xf746('0x5')]},'thirdDisposition':{'type':Sequelize[_0xf746('0x5')]},'note':{'type':Sequelize[_0xf746('0x5')]},'phone':{'type':Sequelize[_0xf746('0x5')]},'read1stAt':{'type':Sequelize[_0xf746('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xf746('0x6')]('in',_0xf746('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf746('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xf746('0x6')]('in',_0xf746('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf746('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3a5e=['DATE','STRING','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3a5e,0x14c));var _0xe3a5=function(_0x3780e9,_0x30a2e9){_0x3780e9=_0x3780e9-0x0;var _0x1dc02c=_0x3a5e[_0x3780e9];return _0x1dc02c;};'use strict';var Sequelize=require(_0xe3a5('0x0'));var moment=require(_0xe3a5('0x1'));module[_0xe3a5('0x2')]={'closed':{'type':Sequelize[_0xe3a5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe3a5('0x4')]},'disposition':{'type':Sequelize[_0xe3a5('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe3a5('0x5')]},'note':{'type':Sequelize[_0xe3a5('0x5')]},'phone':{'type':Sequelize[_0xe3a5('0x5')]},'read1stAt':{'type':Sequelize[_0xe3a5('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe3a5('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe3a5('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe3a5('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index e717294..4304e19 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 _0xf0e4=['send','index','WhatsappInteraction','fieldName','type','key','getOptions','findAll','query','user','catch','show','params','model','rawAttributes','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','create','body','find','destroy','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','color','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Owner','mkdirSync','Account','fullname','toString','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','out','System','value','views','downloadInteraction.ejs','transcript-','Whatsapp','createPdfFromHTML','log','rimraf','zip-dir','moment','bluebird','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','then','stack','name'];(function(_0x1b0cb9,_0x128eda){var _0x446813=function(_0x1d6869){while(--_0x1d6869){_0x1b0cb9['push'](_0x1b0cb9['shift']());}};_0x446813(++_0x128eda);}(_0xf0e4,0xe0));var _0x4f0e=function(_0x1be7df,_0x5bd899){_0x1be7df=_0x1be7df-0x0;var _0x497f5e=_0xf0e4[_0x1be7df];return _0x497f5e;};'use strict';var rimraf=require(_0x4f0e('0x0'));var zipdir=require(_0x4f0e('0x1'));var moment=require(_0x4f0e('0x2'));var BPromise=require(_0x4f0e('0x3'));var util=require(_0x4f0e('0x4'));var path=require(_0x4f0e('0x5'));var ejs=require(_0x4f0e('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x4f0e('0x7'));var qs=require(_0x4f0e('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x4f0e('0x9'))('api');var config=require(_0x4f0e('0xa'));var db=require(_0x4f0e('0xb'))['db'];config[_0x4f0e('0xc')]=_['defaults'](config[_0x4f0e('0xc')],{'host':_0x4f0e('0xd'),'port':0x18eb});var socket=require(_0x4f0e('0xe'))(new Redis(config['redis']));require(_0x4f0e('0xf'))[_0x4f0e('0x10')](socket);function respondWithStatusCode(_0x17f1c1,_0x358c6b){_0x358c6b=_0x358c6b||0xcc;return function(_0x4c4a52){if(_0x4c4a52){return _0x17f1c1[_0x4f0e('0x11')](_0x358c6b);}return _0x17f1c1['status'](_0x358c6b)[_0x4f0e('0x12')]();};}function respondWithResult(_0xc628a,_0x32d58a){_0x32d58a=_0x32d58a||0xc8;return function(_0x3b002c){if(_0x3b002c){return _0xc628a[_0x4f0e('0x13')](_0x32d58a)[_0x4f0e('0x14')](_0x3b002c);}};}function respondWithFilteredResult(_0x3faf47,_0x47cdfb){return function(_0xc1dbf4){if(_0xc1dbf4){var _0x36331f=typeof _0x47cdfb[_0x4f0e('0x15')]===_0x4f0e('0x16')&&typeof _0x47cdfb[_0x4f0e('0x17')]===_0x4f0e('0x16');var _0x4dda44=_0xc1dbf4['count'];var _0x5aaa99=_0x36331f?0x0:_0x47cdfb['offset'];var _0x32daaf=_0x36331f?_0xc1dbf4[_0x4f0e('0x18')]:_0x47cdfb[_0x4f0e('0x15')]+_0x47cdfb[_0x4f0e('0x17')];var _0x4570fe;if(_0x32daaf>=_0x4dda44){_0x32daaf=_0x4dda44;_0x4570fe=0xc8;}else{_0x4570fe=0xce;}_0x3faf47['status'](_0x4570fe);return _0x3faf47[_0x4f0e('0x19')](_0x4f0e('0x1a'),_0x5aaa99+'-'+_0x32daaf+'/'+_0x4dda44)[_0x4f0e('0x14')](_0xc1dbf4);}return null;};}function saveUpdates(_0x2dfe92){return function(_0x2a1dea){if(_0x2a1dea){return _0x2a1dea['update'](_0x2dfe92)[_0x4f0e('0x1b')](function(_0x16b3cd){return _0x16b3cd;});}return null;};}function removeEntity(_0x30ab9b){return function(_0x1b607d){if(_0x1b607d){return _0x1b607d['destroy']()[_0x4f0e('0x1b')](function(){_0x30ab9b[_0x4f0e('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15d62a){return function(_0x34cd85){if(!_0x34cd85){_0x15d62a[_0x4f0e('0x11')](0x194);}return _0x34cd85;};}function handleError(_0x3f9afc,_0x5c7973){_0x5c7973=_0x5c7973||0x1f4;return function(_0x2eccbf){logger['error'](_0x2eccbf[_0x4f0e('0x1c')]);if(_0x2eccbf[_0x4f0e('0x1d')]){delete _0x2eccbf[_0x4f0e('0x1d')];}_0x3f9afc['status'](_0x5c7973)[_0x4f0e('0x1e')](_0x2eccbf);};}exports[_0x4f0e('0x1f')]=function(_0x412186,_0x8e95b){var _0x8cf383={};var _0x25b3a7=_['map'](db[_0x4f0e('0x20')]['rawAttributes'],function(_0x30de18){return{'name':_0x30de18[_0x4f0e('0x21')],'type':_0x30de18[_0x4f0e('0x22')][_0x4f0e('0x23')]};});_0x8cf383=qs[_0x4f0e('0x24')](_0x25b3a7,_0x412186);return interaction[_0x4f0e('0x25')]('whatsapp',_0x412186[_0x4f0e('0x26')],_0x412186[_0x4f0e('0x27')],_0x8cf383,_0x25b3a7)[_0x4f0e('0x1b')](respondWithFilteredResult(_0x8e95b,_0x8cf383))[_0x4f0e('0x28')](handleError(_0x8e95b,null));};exports[_0x4f0e('0x29')]=function(_0x14cf90,_0x259980){var _0x39ae43={'raw':![],'where':{'id':_0x14cf90[_0x4f0e('0x2a')]['id']}},_0x1c123d={};_0x1c123d[_0x4f0e('0x2b')]=_['keys'](db[_0x4f0e('0x20')][_0x4f0e('0x2c')]);_0x1c123d[_0x4f0e('0x26')]=_[_0x4f0e('0x2d')](_0x14cf90[_0x4f0e('0x26')]);_0x1c123d[_0x4f0e('0x2e')]=_['intersection'](_0x1c123d['model'],_0x1c123d[_0x4f0e('0x26')]);_0x39ae43['attributes']=_[_0x4f0e('0x2f')](_0x1c123d[_0x4f0e('0x2b')],qs[_0x4f0e('0x30')](_0x14cf90['query'][_0x4f0e('0x30')]));_0x39ae43[_0x4f0e('0x31')]=_0x39ae43[_0x4f0e('0x31')][_0x4f0e('0x32')]?_0x39ae43[_0x4f0e('0x31')]:_0x1c123d['model'];if(_0x14cf90[_0x4f0e('0x26')][_0x4f0e('0x33')]){_0x39ae43[_0x4f0e('0x34')]=[{'all':!![]}];}_0x39ae43=_[_0x4f0e('0x35')]({},_0x39ae43,_0x14cf90[_0x4f0e('0x36')]);return db['WhatsappInteraction']['find'](_0x39ae43)[_0x4f0e('0x1b')](handleEntityNotFound(_0x259980,null))[_0x4f0e('0x1b')](respondWithResult(_0x259980,null))[_0x4f0e('0x28')](handleError(_0x259980,null));};exports[_0x4f0e('0x37')]=function(_0x42570e,_0x17a234){return db[_0x4f0e('0x20')][_0x4f0e('0x37')](_0x42570e['body'],{})['then'](respondWithResult(_0x17a234,0xc9))[_0x4f0e('0x28')](handleError(_0x17a234,null));};exports['update']=function(_0x2ae9c6,_0x23555c){if(_0x2ae9c6[_0x4f0e('0x38')]['id']){delete _0x2ae9c6[_0x4f0e('0x38')]['id'];}return db[_0x4f0e('0x20')][_0x4f0e('0x39')]({'where':{'id':_0x2ae9c6[_0x4f0e('0x2a')]['id']}})[_0x4f0e('0x1b')](handleEntityNotFound(_0x23555c,null))[_0x4f0e('0x1b')](saveUpdates(_0x2ae9c6[_0x4f0e('0x38')],null))[_0x4f0e('0x1b')](respondWithResult(_0x23555c,null))['catch'](handleError(_0x23555c,null));};exports[_0x4f0e('0x3a')]=function(_0x1362a1,_0x460f5a){return db[_0x4f0e('0x20')][_0x4f0e('0x39')]({'where':{'id':_0x1362a1[_0x4f0e('0x2a')]['id']}})[_0x4f0e('0x1b')](handleEntityNotFound(_0x460f5a,null))[_0x4f0e('0x1b')](removeEntity(_0x460f5a,null))[_0x4f0e('0x28')](handleError(_0x460f5a,null));};exports['describe']=function(_0x3544e1,_0x3b23d8){return db['WhatsappInteraction'][_0x4f0e('0x3b')]()[_0x4f0e('0x1b')](respondWithResult(_0x3b23d8,null))[_0x4f0e('0x28')](handleError(_0x3b23d8,null));};exports['addMessage']=function(_0x4fde26,_0x4dfd33){return db['WhatsappMessage'][_0x4f0e('0x39')]({'where':{'id':_0x4fde26[_0x4f0e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4dfd33,null))[_0x4f0e('0x1b')](function(_0x410a81){if(_0x410a81){return _0x410a81[_0x4f0e('0x3c')](_0x4fde26['body']['ids'],_['omit'](_0x4fde26[_0x4f0e('0x38')],[_0x4f0e('0x3d'),'id'])||{});}})[_0x4f0e('0x1b')](respondWithResult(_0x4dfd33,null))['catch'](handleError(_0x4dfd33,null));};exports[_0x4f0e('0x3e')]=function(_0x21e0a1,_0x421530){var _0x50a274={'raw':![],'where':{}};var _0x6a8925={};var _0x4b6906={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x4f0e('0x3f')]({'where':{'id':_0x21e0a1[_0x4f0e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x421530,null))[_0x4f0e('0x1b')](function(_0x16d97f){if(_0x16d97f){_0x6a8925[_0x4f0e('0x2b')]=_['keys'](db[_0x4f0e('0x40')][_0x4f0e('0x2c')]);_0x6a8925[_0x4f0e('0x26')]=_[_0x4f0e('0x2d')](_0x21e0a1['query']);_0x6a8925[_0x4f0e('0x2e')]=_['intersection'](_0x6a8925[_0x4f0e('0x2b')],_0x6a8925['query']);_0x50a274[_0x4f0e('0x31')]=_[_0x4f0e('0x2f')](_0x6a8925['model'],qs[_0x4f0e('0x30')](_0x21e0a1[_0x4f0e('0x26')][_0x4f0e('0x30')]));_0x50a274[_0x4f0e('0x31')]=_0x50a274[_0x4f0e('0x31')][_0x4f0e('0x32')]?_0x50a274[_0x4f0e('0x31')]:_0x6a8925['model'];if(!_0x21e0a1[_0x4f0e('0x26')][_0x4f0e('0x41')](_0x4f0e('0x42'))){_0x50a274[_0x4f0e('0x17')]=qs[_0x4f0e('0x17')](_0x21e0a1[_0x4f0e('0x26')][_0x4f0e('0x17')]);_0x50a274['offset']=qs[_0x4f0e('0x15')](_0x21e0a1[_0x4f0e('0x26')][_0x4f0e('0x15')]);}_0x50a274[_0x4f0e('0x43')]=qs[_0x4f0e('0x44')](_0x21e0a1[_0x4f0e('0x26')][_0x4f0e('0x44')]);_0x50a274[_0x4f0e('0x45')]=qs[_0x4f0e('0x2e')](_[_0x4f0e('0x46')](_0x21e0a1[_0x4f0e('0x26')],_0x6a8925['filters']));_0x50a274[_0x4f0e('0x45')][_0x4f0e('0x47')]=_0x16d97f['id'];if(_0x21e0a1[_0x4f0e('0x26')][_0x4f0e('0x48')]){_0x50a274[_0x4f0e('0x45')]=_[_0x4f0e('0x35')](_0x50a274[_0x4f0e('0x45')],{'$or':_[_0x4f0e('0x49')](_0x50a274[_0x4f0e('0x31')],function(_0x435e02){var _0x59d085={};_0x59d085[_0x435e02]={'$like':'%'+_0x21e0a1[_0x4f0e('0x26')][_0x4f0e('0x48')]+'%'};return _0x59d085;})});}if(_0x21e0a1[_0x4f0e('0x26')]['$gte']){var _0xeec021=_0x21e0a1[_0x4f0e('0x26')][_0x4f0e('0x4a')][_0x4f0e('0x4b')](',');var _0x1d6eba={};_0x1d6eba[_0xeec021[0x0]]={'$gte':moment(_0xeec021[0x1])[_0x4f0e('0x4c')](_0x4f0e('0x4d'))};_0x50a274['where']=_[_0x4f0e('0x35')](_0x50a274['where'],_0x1d6eba);}_0x50a274=_[_0x4f0e('0x35')]({},_0x50a274,_0x21e0a1['options']);return db[_0x4f0e('0x40')]['count']({'where':_0x50a274[_0x4f0e('0x45')]})[_0x4f0e('0x1b')](function(_0xccecad){_0x4b6906['count']=_0xccecad;if(_0x21e0a1[_0x4f0e('0x26')]['includeAll']){_0x50a274[_0x4f0e('0x34')]=[{'all':!![]}];}return db[_0x4f0e('0x40')][_0x4f0e('0x25')](_0x50a274);})[_0x4f0e('0x1b')](function(_0x40f5af){_0x4b6906[_0x4f0e('0x4e')]=_0x40f5af;return _0x4b6906;});}})[_0x4f0e('0x1b')](respondWithFilteredResult(_0x421530,_0x50a274))['catch'](handleError(_0x421530,null));};exports[_0x4f0e('0x4f')]=function(_0x371421,_0x1435e6){return db[_0x4f0e('0x20')][_0x4f0e('0x39')]({'where':{'id':_0x371421['params']['id']}})[_0x4f0e('0x1b')](handleEntityNotFound(_0x1435e6,null))[_0x4f0e('0x1b')](function(_0x426049){if(_0x426049){return _0x426049[_0x4f0e('0x50')](_0x371421['body'][_0x4f0e('0x3d')],_[_0x4f0e('0x51')](_0x371421[_0x4f0e('0x38')],[_0x4f0e('0x3d'),'id'])||{})[_0x4f0e('0x52')](function(){return db['Tag'][_0x4f0e('0x25')]({'attributes':['id',_0x4f0e('0x1d'),_0x4f0e('0x53')],'where':{'id':_0x371421[_0x4f0e('0x38')]['ids']}});})[_0x4f0e('0x1b')](function(_0x2ca53e){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x371421[_0x4f0e('0x2a')]['id']),'tags':_0x2ca53e||[]});return{'id':Number(_0x371421[_0x4f0e('0x2a')]['id']),'tags':_0x2ca53e||[]};});}})[_0x4f0e('0x1b')](respondWithResult(_0x1435e6,null))['catch'](handleError(_0x1435e6,null));};exports[_0x4f0e('0x54')]=function(_0x38587c,_0x3af2d4){return db[_0x4f0e('0x20')]['find']({'where':{'id':_0x38587c['params']['id']}})[_0x4f0e('0x1b')](handleEntityNotFound(_0x3af2d4,null))[_0x4f0e('0x1b')](function(_0x2351b5){if(_0x2351b5){return _0x2351b5[_0x4f0e('0x54')](_0x38587c[_0x4f0e('0x26')][_0x4f0e('0x3d')]);}})[_0x4f0e('0x1b')](respondWithStatusCode(_0x3af2d4,null))[_0x4f0e('0x28')](handleError(_0x3af2d4,null));};exports[_0x4f0e('0x55')]=function(_0x37688c,_0x13625e){var _0x572e1a=moment()[_0x4f0e('0x56')]()['toString']();var _0x1cf393=path[_0x4f0e('0x57')](config[_0x4f0e('0x58')],_0x4f0e('0x59'),_0x4f0e('0x5a'),'tmp');var _0x45dcd1=path['join'](config['root'],_0x4f0e('0x59'),_0x4f0e('0x5a'),_0x4f0e('0x5b'));var _0x4c2bd8=path[_0x4f0e('0x57')](_0x1cf393,_0x572e1a);var _0x358238=util[_0x4f0e('0x4c')](_0x4f0e('0x5c'),_0x37688c[_0x4f0e('0x2a')]['id'],_0x572e1a);var _0x3a1239=path[_0x4f0e('0x57')](_0x1cf393,_0x358238);var _0x5e7f90=[];_0x5e7f90[_0x4f0e('0x5d')]({'model':db['User'],'as':_0x4f0e('0x5e'),'attributes':['id','fullname'],'raw':!![]});_0x5e7f90[_0x4f0e('0x5d')]({'model':db[_0x4f0e('0x5f')],'as':_0x4f0e('0x60'),'attributes':['id',_0x4f0e('0x61'),_0x4f0e('0x62')],'raw':!![]});if(_0x37688c['query'][_0x4f0e('0x5b')]){_0x5e7f90[_0x4f0e('0x5d')]({'model':db[_0x4f0e('0x63')],'as':_0x4f0e('0x63'),'raw':!![]});}var _0x26081a=[{'model':db['WhatsappMessage'],'as':_0x4f0e('0x64'),'attributes':['id','body',_0x4f0e('0x65'),_0x4f0e('0x66'),_0x4f0e('0x67'),_0x4f0e('0x68')],'include':_0x5e7f90}];_0x26081a[_0x4f0e('0x5d')]({'model':db[_0x4f0e('0x69')],'as':'Account','attributes':['id',_0x4f0e('0x1d')]});_0x26081a[_0x4f0e('0x5d')]({'model':db[_0x4f0e('0x5e')],'as':_0x4f0e('0x6a'),'attributes':['id','fullname']});return db[_0x4f0e('0x20')][_0x4f0e('0x39')]({'where':{'id':_0x37688c[_0x4f0e('0x2a')]['id']},'include':_0x26081a})['then'](handleEntityNotFound(_0x13625e,null))[_0x4f0e('0x1b')](function(_0x1f5bbd){if(_0x1f5bbd){var _0x535902=_0x1f5bbd['get']({'plain':!![]});fs[_0x4f0e('0x6b')](_0x4c2bd8);var _0x4b8c76={'channel':'Whatsapp','account':_0x535902[_0x4f0e('0x6c')][_0x4f0e('0x1d')],'agent':_0x535902[_0x4f0e('0x6a')]?_0x535902[_0x4f0e('0x6a')][_0x4f0e('0x6d')]:'N.A.','createdAt':moment(_0x535902[_0x4f0e('0x65')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4f0e('0x6e')](),'closedAt':_0x535902[_0x4f0e('0x6f')]?moment(_0x535902[_0x4f0e('0x70')])[_0x4f0e('0x4c')](_0x4f0e('0x4d'))['toString']():'','disposition':_0x535902[_0x4f0e('0x71')],'messages':_(_0x535902[_0x4f0e('0x64')])['filter']({'secret':![]})['map'](function(_0x13c644){if(_0x13c644[_0x4f0e('0x63')]){var _0x1d3812=path['join'](_0x45dcd1,_0x13c644[_0x4f0e('0x63')][_0x4f0e('0x72')]);if(fs[_0x4f0e('0x73')](_0x1d3812)){fs[_0x4f0e('0x74')](_0x1d3812)[_0x4f0e('0x75')](fs['createWriteStream'](path[_0x4f0e('0x57')](_0x4c2bd8,_0x13c644[_0x4f0e('0x63')][_0x4f0e('0x72')])));}}return{'date':moment(_0x13c644[_0x4f0e('0x65')])['format'](_0x4f0e('0x4d'))[_0x4f0e('0x6e')](),'sender':_0x13c644[_0x4f0e('0x66')]===_0x4f0e('0x76')?_0x13c644[_0x4f0e('0x5e')]?_0x13c644[_0x4f0e('0x5e')][_0x4f0e('0x6d')]:_0x4f0e('0x77'):_0x13c644[_0x4f0e('0x60')][_0x4f0e('0x61')]+(_0x13c644[_0x4f0e('0x60')][_0x4f0e('0x62')]?'\x20'+_0x13c644[_0x4f0e('0x60')][_0x4f0e('0x62')]:''),'body':_0x13c644[_0x4f0e('0x63')]?_0x13c644[_0x4f0e('0x63')]['basename']:_0x13c644[_0x4f0e('0x38')],'direction':_0x13c644[_0x4f0e('0x66')]==='out'?'A':'C','secret':_0x13c644[_0x4f0e('0x67')],'read':_0x13c644[_0x4f0e('0x68')],'attachment':_0x13c644[_0x4f0e('0x63')]};})[_0x4f0e('0x78')]()};return ejs['renderFile'](path[_0x4f0e('0x57')](config['root'],'server',_0x4f0e('0x79'),_0x4f0e('0x7a')),{'interaction':_0x4b8c76})['then'](function(_0x545dfd){var _0x959638=path['join'](_0x4c2bd8,_0x4f0e('0x7b')+_0x535902['id']+'-'+_0x572e1a+'.pdf');var _0x448086={'path':_0x959638,'channel':_0x4f0e('0x7c'),'interactionId':_0x535902['id']};return pdf[_0x4f0e('0x7d')](_0x545dfd,_0x448086);})[_0x4f0e('0x1b')](function(){return new BPromise(function(_0x17c2df,_0x23d729){zipdir(_0x4c2bd8,{'saveTo':_0x3a1239},function(_0x2b2c37,_0x17a84d){if(_0x2b2c37)return _0x23d729(_0x2b2c37);return _0x17c2df(_0x17a84d);});})[_0x4f0e('0x1b')](function(){return new BPromise(function(_0x2c7664,_0x380dd3){rimraf(_0x4c2bd8,function(_0x4b1021){if(_0x4b1021)_0x380dd3(_0x4b1021);return _0x2c7664();});});})['then'](function(){return _0x13625e[_0x4f0e('0x55')](_0x3a1239,_0x358238,function(_0x3afd53){if(_0x3afd53){console[_0x4f0e('0x7e')]('err',_0x3afd53);}else{fs['unlinkSync'](_0x3a1239);}});});});}else{return _0x13625e[_0x4f0e('0x11')](0xc8);}})[_0x4f0e('0x28')](handleError(_0x13625e,null));}; \ No newline at end of file +var _0x09d1=['omit','getMessages','intersection','nolimit','sort','where','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','push','firstName','lastName','Attachment','direction','secret','read','WhatsappAccount','Account','get','mkdirSync','Owner','fullname','N.A.','createdAt','toString','closedAt','disposition','filter','map','basename','createReadStream','out','System','Contact','value','renderFile','views','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','user','show','params','model','keys','WhatsappInteraction','query','filters','attributes','fields','length','includeAll','include','merge','find','catch','create','body','describe','addMessage','WhatsappMessage','ids'];(function(_0x186591,_0x41385c){var _0x54d42d=function(_0x50e4f9){while(--_0x50e4f9){_0x186591['push'](_0x186591['shift']());}};_0x54d42d(++_0x41385c);}(_0x09d1,0xba));var _0x109d=function(_0x152a71,_0x86006c){_0x152a71=_0x152a71-0x0;var _0x38a371=_0x09d1[_0x152a71];return _0x38a371;};'use strict';var rimraf=require(_0x109d('0x0'));var zipdir=require(_0x109d('0x1'));var moment=require('moment');var BPromise=require(_0x109d('0x2'));var util=require(_0x109d('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x109d('0x4'));var Redis=require(_0x109d('0x5'));var interaction=require(_0x109d('0x6'));var qs=require(_0x109d('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x109d('0x8'));var config=require(_0x109d('0x9'));var db=require(_0x109d('0xa'))['db'];config[_0x109d('0xb')]=_[_0x109d('0xc')](config[_0x109d('0xb')],{'host':_0x109d('0xd'),'port':0x18eb});var socket=require(_0x109d('0xe'))(new Redis(config[_0x109d('0xb')]));require(_0x109d('0xf'))['register'](socket);function respondWithStatusCode(_0x1ef07b,_0x3114cb){_0x3114cb=_0x3114cb||0xcc;return function(_0x3b6731){if(_0x3b6731){return _0x1ef07b[_0x109d('0x10')](_0x3114cb);}return _0x1ef07b[_0x109d('0x11')](_0x3114cb)['end']();};}function respondWithResult(_0x587581,_0x104ba0){_0x104ba0=_0x104ba0||0xc8;return function(_0x586dc0){if(_0x586dc0){return _0x587581[_0x109d('0x11')](_0x104ba0)[_0x109d('0x12')](_0x586dc0);}};}function respondWithFilteredResult(_0xbca6a3,_0xff5390){return function(_0x4a6853){if(_0x4a6853){var _0xfe278e=typeof _0xff5390['offset']==='undefined'&&typeof _0xff5390[_0x109d('0x13')]===_0x109d('0x14');var _0x3086d6=_0x4a6853[_0x109d('0x15')];var _0x42dfe4=_0xfe278e?0x0:_0xff5390[_0x109d('0x16')];var _0x55dec5=_0xfe278e?_0x4a6853[_0x109d('0x15')]:_0xff5390['offset']+_0xff5390[_0x109d('0x13')];var _0x472cd2;if(_0x55dec5>=_0x3086d6){_0x55dec5=_0x3086d6;_0x472cd2=0xc8;}else{_0x472cd2=0xce;}_0xbca6a3['status'](_0x472cd2);return _0xbca6a3[_0x109d('0x17')](_0x109d('0x18'),_0x42dfe4+'-'+_0x55dec5+'/'+_0x3086d6)[_0x109d('0x12')](_0x4a6853);}return null;};}function saveUpdates(_0x4b583a){return function(_0x576d9c){if(_0x576d9c){return _0x576d9c[_0x109d('0x19')](_0x4b583a)[_0x109d('0x1a')](function(_0x3c38f7){return _0x3c38f7;});}return null;};}function removeEntity(_0x16286a){return function(_0x512a89){if(_0x512a89){return _0x512a89[_0x109d('0x1b')]()[_0x109d('0x1a')](function(){_0x16286a[_0x109d('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa00cb9){return function(_0x3316fb){if(!_0x3316fb){_0xa00cb9[_0x109d('0x10')](0x194);}return _0x3316fb;};}function handleError(_0x32faa3,_0x3933b8){_0x3933b8=_0x3933b8||0x1f4;return function(_0x4e0017){logger[_0x109d('0x1c')](_0x4e0017[_0x109d('0x1d')]);if(_0x4e0017[_0x109d('0x1e')]){delete _0x4e0017[_0x109d('0x1e')];}_0x32faa3[_0x109d('0x11')](_0x3933b8)[_0x109d('0x1f')](_0x4e0017);};}exports[_0x109d('0x20')]=function(_0x49cca0,_0x46a82a){var _0x20d644={};var _0x1a9d8d=_['map'](db['WhatsappInteraction'][_0x109d('0x21')],function(_0x4b0d5e){return{'name':_0x4b0d5e[_0x109d('0x22')],'type':_0x4b0d5e[_0x109d('0x23')][_0x109d('0x24')]};});_0x20d644=qs[_0x109d('0x25')](_0x1a9d8d,_0x49cca0);return interaction[_0x109d('0x26')](_0x109d('0x27'),_0x49cca0['query'],_0x49cca0[_0x109d('0x28')],_0x20d644,_0x1a9d8d)[_0x109d('0x1a')](respondWithFilteredResult(_0x46a82a,_0x20d644))['catch'](handleError(_0x46a82a,null));};exports[_0x109d('0x29')]=function(_0x378b97,_0xa52fe4){var _0x555e35={'raw':![],'where':{'id':_0x378b97[_0x109d('0x2a')]['id']}},_0x47f0ab={};_0x47f0ab[_0x109d('0x2b')]=_[_0x109d('0x2c')](db[_0x109d('0x2d')][_0x109d('0x21')]);_0x47f0ab[_0x109d('0x2e')]=_[_0x109d('0x2c')](_0x378b97['query']);_0x47f0ab[_0x109d('0x2f')]=_['intersection'](_0x47f0ab['model'],_0x47f0ab[_0x109d('0x2e')]);_0x555e35[_0x109d('0x30')]=_['intersection'](_0x47f0ab[_0x109d('0x2b')],qs['fields'](_0x378b97[_0x109d('0x2e')][_0x109d('0x31')]));_0x555e35[_0x109d('0x30')]=_0x555e35[_0x109d('0x30')][_0x109d('0x32')]?_0x555e35[_0x109d('0x30')]:_0x47f0ab['model'];if(_0x378b97['query'][_0x109d('0x33')]){_0x555e35[_0x109d('0x34')]=[{'all':!![]}];}_0x555e35=_[_0x109d('0x35')]({},_0x555e35,_0x378b97['options']);return db['WhatsappInteraction'][_0x109d('0x36')](_0x555e35)[_0x109d('0x1a')](handleEntityNotFound(_0xa52fe4,null))[_0x109d('0x1a')](respondWithResult(_0xa52fe4,null))[_0x109d('0x37')](handleError(_0xa52fe4,null));};exports[_0x109d('0x38')]=function(_0x41a7f4,_0x21da85){return db[_0x109d('0x2d')][_0x109d('0x38')](_0x41a7f4[_0x109d('0x39')],{})['then'](respondWithResult(_0x21da85,0xc9))[_0x109d('0x37')](handleError(_0x21da85,null));};exports[_0x109d('0x19')]=function(_0xd3e6cc,_0x3ca95b){if(_0xd3e6cc[_0x109d('0x39')]['id']){delete _0xd3e6cc[_0x109d('0x39')]['id'];}return db['WhatsappInteraction'][_0x109d('0x36')]({'where':{'id':_0xd3e6cc['params']['id']}})[_0x109d('0x1a')](handleEntityNotFound(_0x3ca95b,null))[_0x109d('0x1a')](saveUpdates(_0xd3e6cc[_0x109d('0x39')],null))[_0x109d('0x1a')](respondWithResult(_0x3ca95b,null))[_0x109d('0x37')](handleError(_0x3ca95b,null));};exports['destroy']=function(_0x28dd44,_0x4af88f){return db[_0x109d('0x2d')][_0x109d('0x36')]({'where':{'id':_0x28dd44['params']['id']}})[_0x109d('0x1a')](handleEntityNotFound(_0x4af88f,null))['then'](removeEntity(_0x4af88f,null))[_0x109d('0x37')](handleError(_0x4af88f,null));};exports['describe']=function(_0x4b0021,_0x228ea7){return db[_0x109d('0x2d')][_0x109d('0x3a')]()[_0x109d('0x1a')](respondWithResult(_0x228ea7,null))[_0x109d('0x37')](handleError(_0x228ea7,null));};exports[_0x109d('0x3b')]=function(_0x16d4e7,_0x2e3529){return db[_0x109d('0x3c')][_0x109d('0x36')]({'where':{'id':_0x16d4e7[_0x109d('0x2a')]['id']}})[_0x109d('0x1a')](handleEntityNotFound(_0x2e3529,null))[_0x109d('0x1a')](function(_0x1a4833){if(_0x1a4833){return _0x1a4833[_0x109d('0x3b')](_0x16d4e7[_0x109d('0x39')][_0x109d('0x3d')],_[_0x109d('0x3e')](_0x16d4e7['body'],['ids','id'])||{});}})[_0x109d('0x1a')](respondWithResult(_0x2e3529,null))['catch'](handleError(_0x2e3529,null));};exports[_0x109d('0x3f')]=function(_0x104347,_0x3fe28c){var _0x3e253e={'raw':![],'where':{}};var _0x88a0d6={};var _0x36ad9d={'count':0x0,'rows':[]};return db[_0x109d('0x2d')]['findOne']({'where':{'id':_0x104347[_0x109d('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3fe28c,null))[_0x109d('0x1a')](function(_0x122f75){if(_0x122f75){_0x88a0d6[_0x109d('0x2b')]=_[_0x109d('0x2c')](db[_0x109d('0x3c')][_0x109d('0x21')]);_0x88a0d6[_0x109d('0x2e')]=_[_0x109d('0x2c')](_0x104347[_0x109d('0x2e')]);_0x88a0d6[_0x109d('0x2f')]=_[_0x109d('0x40')](_0x88a0d6[_0x109d('0x2b')],_0x88a0d6[_0x109d('0x2e')]);_0x3e253e[_0x109d('0x30')]=_[_0x109d('0x40')](_0x88a0d6[_0x109d('0x2b')],qs[_0x109d('0x31')](_0x104347['query'][_0x109d('0x31')]));_0x3e253e[_0x109d('0x30')]=_0x3e253e[_0x109d('0x30')]['length']?_0x3e253e[_0x109d('0x30')]:_0x88a0d6['model'];if(!_0x104347[_0x109d('0x2e')]['hasOwnProperty'](_0x109d('0x41'))){_0x3e253e['limit']=qs[_0x109d('0x13')](_0x104347[_0x109d('0x2e')]['limit']);_0x3e253e['offset']=qs[_0x109d('0x16')](_0x104347['query'][_0x109d('0x16')]);}_0x3e253e['order']=qs['sort'](_0x104347[_0x109d('0x2e')][_0x109d('0x42')]);_0x3e253e[_0x109d('0x43')]=qs[_0x109d('0x2f')](_[_0x109d('0x44')](_0x104347[_0x109d('0x2e')],_0x88a0d6['filters']));_0x3e253e['where']['WhatsappInteractionId']=_0x122f75['id'];if(_0x104347[_0x109d('0x2e')]['filter']){_0x3e253e[_0x109d('0x43')]=_[_0x109d('0x35')](_0x3e253e['where'],{'$or':_['map'](_0x3e253e['attributes'],function(_0x147a6a){var _0x5ddfe7={};_0x5ddfe7[_0x147a6a]={'$like':'%'+_0x104347['query']['filter']+'%'};return _0x5ddfe7;})});}if(_0x104347[_0x109d('0x2e')]['$gte']){var _0x5e2f60=_0x104347[_0x109d('0x2e')][_0x109d('0x45')][_0x109d('0x46')](',');var _0xa2305c={};_0xa2305c[_0x5e2f60[0x0]]={'$gte':moment(_0x5e2f60[0x1])[_0x109d('0x47')](_0x109d('0x48'))};_0x3e253e[_0x109d('0x43')]=_[_0x109d('0x35')](_0x3e253e[_0x109d('0x43')],_0xa2305c);}_0x3e253e=_[_0x109d('0x35')]({},_0x3e253e,_0x104347['options']);return db[_0x109d('0x3c')][_0x109d('0x15')]({'where':_0x3e253e[_0x109d('0x43')]})['then'](function(_0x41e0ee){_0x36ad9d[_0x109d('0x15')]=_0x41e0ee;if(_0x104347[_0x109d('0x2e')][_0x109d('0x33')]){_0x3e253e[_0x109d('0x34')]=[{'all':!![]}];}return db[_0x109d('0x3c')]['findAll'](_0x3e253e);})[_0x109d('0x1a')](function(_0x5a2e16){_0x36ad9d[_0x109d('0x49')]=_0x5a2e16;return _0x36ad9d;});}})['then'](respondWithFilteredResult(_0x3fe28c,_0x3e253e))[_0x109d('0x37')](handleError(_0x3fe28c,null));};exports[_0x109d('0x4a')]=function(_0x216207,_0x40433b){return db['WhatsappInteraction'][_0x109d('0x36')]({'where':{'id':_0x216207[_0x109d('0x2a')]['id']}})[_0x109d('0x1a')](handleEntityNotFound(_0x40433b,null))[_0x109d('0x1a')](function(_0x139452){if(_0x139452){return _0x139452[_0x109d('0x4b')](_0x216207[_0x109d('0x39')][_0x109d('0x3d')],_[_0x109d('0x3e')](_0x216207['body'],['ids','id'])||{})['spread'](function(){return db[_0x109d('0x4c')]['findAll']({'attributes':['id',_0x109d('0x1e'),'color'],'where':{'id':_0x216207['body'][_0x109d('0x3d')]}});})[_0x109d('0x1a')](function(_0x16bb56){socket['emit'](_0x109d('0x4d'),{'id':Number(_0x216207[_0x109d('0x2a')]['id']),'tags':_0x16bb56||[]});return{'id':Number(_0x216207[_0x109d('0x2a')]['id']),'tags':_0x16bb56||[]};});}})[_0x109d('0x1a')](respondWithResult(_0x40433b,null))[_0x109d('0x37')](handleError(_0x40433b,null));};exports[_0x109d('0x4e')]=function(_0x338c8e,_0x584846){return db[_0x109d('0x2d')][_0x109d('0x36')]({'where':{'id':_0x338c8e[_0x109d('0x2a')]['id']}})[_0x109d('0x1a')](handleEntityNotFound(_0x584846,null))[_0x109d('0x1a')](function(_0x406aa2){if(_0x406aa2){return _0x406aa2['removeTags'](_0x338c8e[_0x109d('0x2e')]['ids']);}})[_0x109d('0x1a')](respondWithStatusCode(_0x584846,null))['catch'](handleError(_0x584846,null));};exports[_0x109d('0x4f')]=function(_0xa36185,_0x4cabc0){var _0x1248e9=moment()[_0x109d('0x50')]()['toString']();var _0x4fccf6=path[_0x109d('0x51')](config[_0x109d('0x52')],_0x109d('0x53'),_0x109d('0x54'),_0x109d('0x55'));var _0x2aa28a=path[_0x109d('0x51')](config[_0x109d('0x52')],'server',_0x109d('0x54'),_0x109d('0x56'));var _0x318c68=path[_0x109d('0x51')](_0x4fccf6,_0x1248e9);var _0x43bcce=util[_0x109d('0x47')](_0x109d('0x57'),_0xa36185[_0x109d('0x2a')]['id'],_0x1248e9);var _0x1b49e6=path[_0x109d('0x51')](_0x4fccf6,_0x43bcce);var _0x2cf430=[];_0x2cf430['push']({'model':db[_0x109d('0x58')],'as':_0x109d('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x2cf430[_0x109d('0x59')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x109d('0x5a'),_0x109d('0x5b')],'raw':!![]});if(_0xa36185[_0x109d('0x2e')][_0x109d('0x56')]){_0x2cf430[_0x109d('0x59')]({'model':db['Attachment'],'as':_0x109d('0x5c'),'raw':!![]});}var _0x79a3e9=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x109d('0x39'),'createdAt',_0x109d('0x5d'),_0x109d('0x5e'),_0x109d('0x5f')],'include':_0x2cf430}];_0x79a3e9['push']({'model':db[_0x109d('0x60')],'as':_0x109d('0x61'),'attributes':['id',_0x109d('0x1e')]});_0x79a3e9[_0x109d('0x59')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0x109d('0x2d')][_0x109d('0x36')]({'where':{'id':_0xa36185[_0x109d('0x2a')]['id']},'include':_0x79a3e9})[_0x109d('0x1a')](handleEntityNotFound(_0x4cabc0,null))[_0x109d('0x1a')](function(_0x59bd25){if(_0x59bd25){var _0x22df86=_0x59bd25[_0x109d('0x62')]({'plain':!![]});fs[_0x109d('0x63')](_0x318c68);var _0xbbf41={'channel':'Whatsapp','account':_0x22df86[_0x109d('0x61')][_0x109d('0x1e')],'agent':_0x22df86['Owner']?_0x22df86[_0x109d('0x64')][_0x109d('0x65')]:_0x109d('0x66'),'createdAt':moment(_0x22df86[_0x109d('0x67')])[_0x109d('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x109d('0x68')](),'closedAt':_0x22df86['closed']?moment(_0x22df86[_0x109d('0x69')])[_0x109d('0x47')](_0x109d('0x48'))[_0x109d('0x68')]():'','disposition':_0x22df86[_0x109d('0x6a')],'messages':_(_0x22df86['Messages'])[_0x109d('0x6b')]({'secret':![]})[_0x109d('0x6c')](function(_0x458a5a){if(_0x458a5a['Attachment']){var _0x2412fc=path[_0x109d('0x51')](_0x2aa28a,_0x458a5a[_0x109d('0x5c')][_0x109d('0x6d')]);if(fs['existsSync'](_0x2412fc)){fs[_0x109d('0x6e')](_0x2412fc)['pipe'](fs['createWriteStream'](path[_0x109d('0x51')](_0x318c68,_0x458a5a[_0x109d('0x5c')]['basename'])));}}return{'date':moment(_0x458a5a['createdAt'])[_0x109d('0x47')](_0x109d('0x48'))[_0x109d('0x68')](),'sender':_0x458a5a['direction']===_0x109d('0x6f')?_0x458a5a[_0x109d('0x58')]?_0x458a5a[_0x109d('0x58')][_0x109d('0x65')]:_0x109d('0x70'):_0x458a5a[_0x109d('0x71')][_0x109d('0x5a')]+(_0x458a5a[_0x109d('0x71')][_0x109d('0x5b')]?'\x20'+_0x458a5a[_0x109d('0x71')]['lastName']:''),'body':_0x458a5a[_0x109d('0x5c')]?_0x458a5a['Attachment']['basename']:_0x458a5a['body'],'direction':_0x458a5a[_0x109d('0x5d')]===_0x109d('0x6f')?'A':'C','secret':_0x458a5a[_0x109d('0x5e')],'read':_0x458a5a[_0x109d('0x5f')],'attachment':_0x458a5a['Attachment']};})[_0x109d('0x72')]()};return ejs[_0x109d('0x73')](path[_0x109d('0x51')](config['root'],_0x109d('0x53'),_0x109d('0x74'),'downloadInteraction.ejs'),{'interaction':_0xbbf41})[_0x109d('0x1a')](function(_0x596f8e){var _0x555429=path[_0x109d('0x51')](_0x318c68,_0x109d('0x75')+_0x22df86['id']+'-'+_0x1248e9+_0x109d('0x76'));var _0x1f5279={'path':_0x555429,'channel':_0x109d('0x77'),'interactionId':_0x22df86['id']};return pdf[_0x109d('0x78')](_0x596f8e,_0x1f5279);})[_0x109d('0x1a')](function(){return new BPromise(function(_0x15e6ed,_0x165ee0){zipdir(_0x318c68,{'saveTo':_0x1b49e6},function(_0x86e556,_0x33a882){if(_0x86e556)return _0x165ee0(_0x86e556);return _0x15e6ed(_0x33a882);});})[_0x109d('0x1a')](function(){return new BPromise(function(_0x2abb51,_0x43dcd8){rimraf(_0x318c68,function(_0x36c6d1){if(_0x36c6d1)_0x43dcd8(_0x36c6d1);return _0x2abb51();});});})[_0x109d('0x1a')](function(){return _0x4cabc0['download'](_0x1b49e6,_0x43bcce,function(_0x1dfffd){if(_0x1dfffd){console[_0x109d('0x79')](_0x109d('0x7a'),_0x1dfffd);}else{fs[_0x109d('0x7b')](_0x1b49e6);}});});});}else{return _0x4cabc0[_0x109d('0x10')](0xc8);}})[_0x109d('0x37')](handleError(_0x4cabc0,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 0694357..f04d631 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 _0xa62c=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','then','Users','map','setDataValue','length','emit'];(function(_0xc76e8a,_0x3e86ae){var _0x218c02=function(_0x129bbe){while(--_0x129bbe){_0xc76e8a['push'](_0xc76e8a['shift']());}};_0x218c02(++_0x3e86ae);}(_0xa62c,0x70));var _0xca62=function(_0x2da357,_0x1f9b2f){_0x2da357=_0x2da357-0x0;var _0x138fdd=_0xa62c[_0x2da357];return _0x138fdd;};'use strict';var EventEmitter=require(_0xca62('0x0'));var WhatsappInteraction=require(_0xca62('0x1'))['db'][_0xca62('0x2')];var WhatsappMessage=require(_0xca62('0x1'))['db'][_0xca62('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xca62('0x4')](0x0);var events={'afterCreate':_0xca62('0x5'),'afterUpdate':'update','afterDestroy':_0xca62('0x6')};function emitEvent(_0x3da6b7){return function(_0x2845a1,_0x2b8280,_0x1e51ba){_0x2845a1[_0xca62('0x7')]({'attributes':['id'],'raw':!![]})[_0xca62('0x8')](function(_0x4584ab){_0x2845a1['setDataValue'](_0xca62('0x9'),_0x4584ab[_0xca62('0xa')](function(_0xf52d20){return{'id':_0xf52d20['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2845a1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xca62('0x8')](function(_0x3dd26b){_0x2845a1[_0xca62('0xb')]('unreadMessages',_0x3dd26b[_0xca62('0xc')]);WhatsappInteractionEvents[_0xca62('0xd')](_0x3da6b7+':'+_0x2845a1['id'],_0x2845a1);WhatsappInteractionEvents[_0xca62('0xd')](_0x3da6b7,_0x2845a1);_0x1e51ba(null);})[_0xca62('0xe')](_0x1e51ba(null));};}for(var e in events){if(events[_0xca62('0xf')](e)){var event=events[e];WhatsappInteraction[_0xca62('0x10')](e,emitEvent(event));}}module[_0xca62('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xd757=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','save','update','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x1ac6e5,_0x40f47f){var _0x5877dc=function(_0x99caea){while(--_0x99caea){_0x1ac6e5['push'](_0x1ac6e5['shift']());}};_0x5877dc(++_0x40f47f);}(_0xd757,0x1e5));var _0x7d75=function(_0x5df274,_0x18eb29){_0x5df274=_0x5df274-0x0;var _0x192e73=_0xd757[_0x5df274];return _0x192e73;};'use strict';var EventEmitter=require(_0x7d75('0x0'));var WhatsappInteraction=require(_0x7d75('0x1'))['db'][_0x7d75('0x2')];var WhatsappMessage=require(_0x7d75('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7d75('0x3'),'afterUpdate':_0x7d75('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa7df66){return function(_0x10d11a,_0x42c15a,_0x52bb43){_0x10d11a['getUsers']({'attributes':['id'],'raw':!![]})[_0x7d75('0x5')](function(_0x3fde33){_0x10d11a[_0x7d75('0x6')](_0x7d75('0x7'),_0x3fde33[_0x7d75('0x8')](function(_0x2f0103){return{'id':_0x2f0103['id']};}));return WhatsappMessage[_0x7d75('0x9')]({'where':{'WhatsappInteractionId':_0x10d11a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7d75('0x5')](function(_0x24e1d8){_0x10d11a[_0x7d75('0x6')](_0x7d75('0xa'),_0x24e1d8[_0x7d75('0xb')]);WhatsappInteractionEvents[_0x7d75('0xc')](_0xa7df66+':'+_0x10d11a['id'],_0x10d11a);WhatsappInteractionEvents['emit'](_0xa7df66,_0x10d11a);_0x52bb43(null);})['catch'](_0x52bb43(null));};}for(var e in events){if(events[_0x7d75('0xd')](e)){var event=events[e];WhatsappInteraction[_0x7d75('0xe')](e,emitEvent(event));}}module[_0x7d75('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 2412432..a7a32d0 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 _0x27de=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','path','./whatsappInteraction.attributes','define','whatsapp_interactions','changed','closed'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x27de,0x1b0));var _0xe27d=function(_0x15b26f,_0x17222e){_0x15b26f=_0x15b26f-0x0;var _0xe47402=_0x27de[_0x15b26f];return _0xe47402;};'use strict';var _=require(_0xe27d('0x0'));var util=require(_0xe27d('0x1'));var logger=require('../../config/logger')(_0xe27d('0x2'));var moment=require('moment');var BPromise=require(_0xe27d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe27d('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe27d('0x5'));module['exports']=function(_0x3dfa8a,_0x471ffc){return _0x3dfa8a[_0xe27d('0x6')]('WhatsappInteraction',attributes,{'tableName':_0xe27d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x17f10d,_0x1193a6,_0x3f99b3){if(_0x17f10d[_0xe27d('0x8')](_0xe27d('0x9'))){_0x17f10d[_0xe27d('0xa')]=moment()[_0xe27d('0xb')](_0xe27d('0xc'));}_0x3f99b3(null,_0x17f10d);}}});}; \ No newline at end of file +var _0xf0f8=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0xf0f8,0x1e1));var _0x8f0f=function(_0x5eb0fb,_0x509260){_0x5eb0fb=_0x5eb0fb-0x0;var _0x37524c=_0xf0f8[_0x5eb0fb];return _0x37524c;};'use strict';var _=require(_0x8f0f('0x0'));var util=require(_0x8f0f('0x1'));var logger=require(_0x8f0f('0x2'))('api');var moment=require(_0x8f0f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f0f('0x4'));var rimraf=require(_0x8f0f('0x5'));var config=require(_0x8f0f('0x6'));var attributes=require('./whatsappInteraction.attributes');module[_0x8f0f('0x7')]=function(_0x374698,_0x354037){return _0x374698[_0x8f0f('0x8')](_0x8f0f('0x9'),attributes,{'tableName':_0x8f0f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f958b,_0x2618c8,_0x345c9c){if(_0x4f958b[_0x8f0f('0xb')](_0x8f0f('0xc'))){_0x4f958b['closedAt']=moment()[_0x8f0f('0xd')](_0x8f0f('0xe'));}_0x345c9c(null,_0x4f958b);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 5d13496..78f4d07 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 _0xdef1=['WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateWhatsappInteraction','WhatsappInteraction','body','options','where','limit','then','catch','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','register','request','info'];(function(_0x2df646,_0x484c5f){var _0x1234b3=function(_0x2a7e9b){while(--_0x2a7e9b){_0x2df646['push'](_0x2df646['shift']());}};_0x1234b3(++_0x484c5f);}(_0xdef1,0x101));var _0x1def=function(_0x3c70e1,_0x3965c3){_0x3c70e1=_0x3c70e1-0x0;var _0x29026c=_0xdef1[_0x3c70e1];return _0x29026c;};'use strict';var _=require(_0x1def('0x0'));var util=require(_0x1def('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1def('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1def('0x3'))['db'];var utils=require(_0x1def('0x4'));var logger=require('../../config/logger')(_0x1def('0x5'));var config=require(_0x1def('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1def('0x7')][_0x1def('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x1def('0x9'),'port':0x18eb});var socket=require(_0x1def('0xa'))(new Redis(config[_0x1def('0xb')]));require(_0x1def('0xc'))[_0x1def('0xd')](socket);function respondWithRpcPromise(_0x1dd66a,_0x1d33af,_0x759571){return new BPromise(function(_0x4188c9,_0x497858){return client[_0x1def('0xe')](_0x1dd66a,_0x759571)['then'](function(_0x4c1a09){logger[_0x1def('0xf')](_0x1def('0x10'),_0x1d33af,_0x1def('0x11'));logger[_0x1def('0x12')](_0x1def('0x13'),_0x1d33af,_0x1def('0x11'),JSON[_0x1def('0x14')](_0x4c1a09));if(_0x4c1a09[_0x1def('0x15')]){if(_0x4c1a09['error'][_0x1def('0x16')]===0x1f4){logger[_0x1def('0x15')](_0x1def('0x10'),_0x1d33af,_0x4c1a09['error'][_0x1def('0x17')]);return _0x497858(_0x4c1a09[_0x1def('0x15')][_0x1def('0x17')]);}logger['error'](_0x1def('0x10'),_0x1d33af,_0x4c1a09[_0x1def('0x15')][_0x1def('0x17')]);return _0x4188c9(_0x4c1a09[_0x1def('0x15')][_0x1def('0x17')]);}else{logger[_0x1def('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x1d33af,_0x1def('0x11'));_0x4188c9(_0x4c1a09['result'][_0x1def('0x17')]);}})['catch'](function(_0x1380cf){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x1d33af,_0x1380cf);_0x497858(_0x1380cf);});});}exports[_0x1def('0x18')]=function(_0x43d5eb){var _0x43ee04=this;return new Promise(function(_0x517bcd,_0x500bd5){return db[_0x1def('0x19')]['update'](_0x43d5eb[_0x1def('0x1a')],{'raw':_0x43d5eb[_0x1def('0x1b')]?_0x43d5eb[_0x1def('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43d5eb[_0x1def('0x1b')]?_0x43d5eb[_0x1def('0x1b')][_0x1def('0x1c')]||null:null,'attributes':_0x43d5eb[_0x1def('0x1b')]?_0x43d5eb[_0x1def('0x1b')]['attributes']||null:null,'limit':_0x43d5eb['options']?_0x43d5eb['options'][_0x1def('0x1d')]||null:null})[_0x1def('0x1e')](function(_0x22a364){logger[_0x1def('0xf')](_0x1def('0x18'),_0x43d5eb);logger[_0x1def('0x12')](_0x1def('0x18'),_0x43d5eb,JSON[_0x1def('0x14')](_0x22a364));_0x517bcd(_0x22a364);})[_0x1def('0x1f')](function(_0x365e3a){logger[_0x1def('0x15')](_0x1def('0x18'),_0x365e3a[_0x1def('0x17')],_0x43d5eb);_0x500bd5(_0x43ee04[_0x1def('0x15')](0x1f4,_0x365e3a[_0x1def('0x17')]));});});};exports[_0x1def('0x20')]=function(_0x26670c){return new Promise(function(_0x450bff,_0x40c103){return db[_0x1def('0x19')][_0x1def('0x21')]({'where':_0x26670c[_0x1def('0x1b')]?_0x26670c[_0x1def('0x1b')][_0x1def('0x1c')]||null:null})[_0x1def('0x1e')](function(_0x45e3c8){if(_0x45e3c8){return _0x45e3c8[_0x1def('0x22')](_0x26670c[_0x1def('0x1a')][_0x1def('0x23')],_[_0x1def('0x24')](_0x26670c['body'],[_0x1def('0x23'),'id'])||{});}})[_0x1def('0x25')](function(_0xafd44b){logger[_0x1def('0xf')](_0x1def('0x26'),_0x26670c);logger[_0x1def('0x12')](_0x1def('0x26'),_0x26670c,JSON['stringify'](_0xafd44b));_0x450bff(_0xafd44b);})['catch'](function(_0x2baec9){logger['error']('AddTags',_0x2baec9[_0x1def('0x17')],_0x26670c);_0x40c103(_this['error'](0x1f4,_0x2baec9[_0x1def('0x17')]));});});}; \ No newline at end of file +var _0x7bf3=['update','body','options','raw','where','debug','find','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./whatsappInteraction.socket','register','then','info','request\x20sent','stringify','error','code','message','WhatsappInteraction,\x20%s,\x20%s','result','catch','UpdateWhatsappInteraction','WhatsappInteraction'];(function(_0x586998,_0xc9fd34){var _0x1c882d=function(_0x48b3e8){while(--_0x48b3e8){_0x586998['push'](_0x586998['shift']());}};_0x1c882d(++_0xc9fd34);}(_0x7bf3,0x1e0));var _0x37bf=function(_0x29e119,_0x838181){_0x29e119=_0x29e119-0x0;var _0x2e8584=_0x7bf3[_0x29e119];return _0x2e8584;};'use strict';var _=require(_0x37bf('0x0'));var util=require('util');var moment=require(_0x37bf('0x1'));var BPromise=require('bluebird');var rs=require(_0x37bf('0x2'));var fs=require('fs');var Redis=require(_0x37bf('0x3'));var db=require(_0x37bf('0x4'))['db'];var utils=require(_0x37bf('0x5'));var logger=require('../../config/logger')(_0x37bf('0x6'));var config=require(_0x37bf('0x7'));var jayson=require(_0x37bf('0x8'));var client=jayson['client'][_0x37bf('0x9')]({'port':0x232a});config['redis']=_[_0x37bf('0xa')](config[_0x37bf('0xb')],{'host':_0x37bf('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x37bf('0xd'))[_0x37bf('0xe')](socket);function respondWithRpcPromise(_0x2e92f6,_0x71689a,_0x38f33b){return new BPromise(function(_0xeb2038,_0x57d22d){return client['request'](_0x2e92f6,_0x38f33b)[_0x37bf('0xf')](function(_0x1ee904){logger[_0x37bf('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x71689a,'request\x20sent');logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x71689a,_0x37bf('0x11'),JSON[_0x37bf('0x12')](_0x1ee904));if(_0x1ee904[_0x37bf('0x13')]){if(_0x1ee904[_0x37bf('0x13')][_0x37bf('0x14')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x71689a,_0x1ee904[_0x37bf('0x13')]['message']);return _0x57d22d(_0x1ee904[_0x37bf('0x13')][_0x37bf('0x15')]);}logger[_0x37bf('0x13')](_0x37bf('0x16'),_0x71689a,_0x1ee904[_0x37bf('0x13')][_0x37bf('0x15')]);return _0xeb2038(_0x1ee904['error']['message']);}else{logger[_0x37bf('0x10')](_0x37bf('0x16'),_0x71689a,_0x37bf('0x11'));_0xeb2038(_0x1ee904[_0x37bf('0x17')][_0x37bf('0x15')]);}})[_0x37bf('0x18')](function(_0x298d30){logger['error'](_0x37bf('0x16'),_0x71689a,_0x298d30);_0x57d22d(_0x298d30);});});}exports[_0x37bf('0x19')]=function(_0x29569b){var _0x185afa=this;return new Promise(function(_0x4cd1fe,_0x1a1cec){return db[_0x37bf('0x1a')][_0x37bf('0x1b')](_0x29569b[_0x37bf('0x1c')],{'raw':_0x29569b[_0x37bf('0x1d')]?_0x29569b[_0x37bf('0x1d')][_0x37bf('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29569b[_0x37bf('0x1d')]?_0x29569b[_0x37bf('0x1d')][_0x37bf('0x1f')]||null:null,'attributes':_0x29569b[_0x37bf('0x1d')]?_0x29569b[_0x37bf('0x1d')]['attributes']||null:null,'limit':_0x29569b[_0x37bf('0x1d')]?_0x29569b[_0x37bf('0x1d')]['limit']||null:null})[_0x37bf('0xf')](function(_0x56b206){logger[_0x37bf('0x10')](_0x37bf('0x19'),_0x29569b);logger[_0x37bf('0x20')](_0x37bf('0x19'),_0x29569b,JSON['stringify'](_0x56b206));_0x4cd1fe(_0x56b206);})[_0x37bf('0x18')](function(_0x54d71d){logger['error'](_0x37bf('0x19'),_0x54d71d['message'],_0x29569b);_0x1a1cec(_0x185afa['error'](0x1f4,_0x54d71d[_0x37bf('0x15')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x495c8b){return new Promise(function(_0x4a130b,_0x49738f){return db[_0x37bf('0x1a')][_0x37bf('0x21')]({'where':_0x495c8b[_0x37bf('0x1d')]?_0x495c8b[_0x37bf('0x1d')]['where']||null:null})[_0x37bf('0xf')](function(_0x29338f){if(_0x29338f){return _0x29338f[_0x37bf('0x22')](_0x495c8b['body'][_0x37bf('0x23')],_[_0x37bf('0x24')](_0x495c8b[_0x37bf('0x1c')],[_0x37bf('0x23'),'id'])||{});}})[_0x37bf('0x25')](function(_0xf478fa){logger[_0x37bf('0x10')]('AddTags',_0x495c8b);logger[_0x37bf('0x20')](_0x37bf('0x26'),_0x495c8b,JSON[_0x37bf('0x12')](_0xf478fa));_0x4a130b(_0xf478fa);})[_0x37bf('0x18')](function(_0x128971){logger[_0x37bf('0x13')](_0x37bf('0x26'),_0x128971['message'],_0x495c8b);_0x49738f(_this['error'](0x1f4,_0x128971[_0x37bf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index aa1a7be..ab8800e 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 _0xd228=['removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit'];(function(_0x609e64,_0x5e7d00){var _0x5d42bc=function(_0x5cc53b){while(--_0x5cc53b){_0x609e64['push'](_0x609e64['shift']());}};_0x5d42bc(++_0x5e7d00);}(_0xd228,0x1c3));var _0x8d22=function(_0x57cbfb,_0x2de760){_0x57cbfb=_0x57cbfb-0x0;var _0x4cb933=_0xd228[_0x57cbfb];return _0x4cb933;};'use strict';var WhatsappInteractionEvents=require(_0x8d22('0x0'));var events=[_0x8d22('0x1'),_0x8d22('0x2'),_0x8d22('0x3')];function createListener(_0x1f2f0e,_0x1dd8dc){return function(_0x43504c){_0x1dd8dc[_0x8d22('0x4')](_0x1f2f0e,_0x43504c);};}function removeListener(_0x2d1f6a,_0x4d04d0){return function(){WhatsappInteractionEvents[_0x8d22('0x5')](_0x2d1f6a,_0x4d04d0);};}exports['register']=function(_0x37dc6b){for(var _0x4e4773=0x0,_0x563680=events[_0x8d22('0x6')];_0x4e4773<_0x563680;_0x4e4773++){var _0x5c34a0=events[_0x4e4773];var _0x14af7d=createListener(_0x8d22('0x7')+_0x5c34a0,_0x37dc6b);WhatsappInteractionEvents['on'](_0x5c34a0,_0x14af7d);}}; \ No newline at end of file +var _0x1f05=['save','remove','update','emit','length','whatsappInteraction:'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x1f05,0xe4));var _0x51f0=function(_0x5afa68,_0x3fb091){_0x5afa68=_0x5afa68-0x0;var _0x11dfd6=_0x1f05[_0x5afa68];return _0x11dfd6;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x51f0('0x0'),_0x51f0('0x1'),_0x51f0('0x2')];function createListener(_0x1f4a39,_0x3113ec){return function(_0x1b1572){_0x3113ec[_0x51f0('0x3')](_0x1f4a39,_0x1b1572);};}function removeListener(_0x138595,_0x5edebd){return function(){WhatsappInteractionEvents['removeListener'](_0x138595,_0x5edebd);};}exports['register']=function(_0x453a46){for(var _0x4a4f7d=0x0,_0x18ace5=events[_0x51f0('0x4')];_0x4a4f7d<_0x18ace5;_0x4a4f7d++){var _0x5f17c2=events[_0x4a4f7d];var _0x49ce98=createListener(_0x51f0('0x5')+_0x5f17c2,_0x453a46);WhatsappInteractionEvents['on'](_0x5f17c2,_0x49ce98);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 8959aa7..8055e30 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 _0x7e8a=['tracked','whatsapp','create','/:id/status','put','/:id','accept','/:id/reject','reject','delete','destroy','exports','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7e8a,0x174));var _0xa7e8=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x7e8a[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0xa7e8('0x0'));var util=require('util');var path=require(_0xa7e8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa7e8('0x2')]();var fs_extra=require(_0xa7e8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa7e8('0x4'));var config=require(_0xa7e8('0x5'));var controller=require('./whatsappMessage.controller');router[_0xa7e8('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa7e8('0x7'),auth[_0xa7e8('0x8')](),controller[_0xa7e8('0x9')]);router[_0xa7e8('0x6')]('/:id',auth[_0xa7e8('0x8')](),controller[_0xa7e8('0xa')]);router[_0xa7e8('0xb')]('/',auth[_0xa7e8('0x8')](),interaction[_0xa7e8('0xc')](_0xa7e8('0xd'),'whatsappmessage:create'),controller[_0xa7e8('0xe')]);router[_0xa7e8('0xb')](_0xa7e8('0xf'),controller['status']);router[_0xa7e8('0x10')](_0xa7e8('0x11'),auth[_0xa7e8('0x8')](),controller['update']);router['put']('/:id/accept',auth[_0xa7e8('0x8')](),controller[_0xa7e8('0x12')]);router[_0xa7e8('0x10')](_0xa7e8('0x13'),auth[_0xa7e8('0x8')](),controller[_0xa7e8('0x14')]);router[_0xa7e8('0x15')](_0xa7e8('0x11'),auth[_0xa7e8('0x8')](),controller[_0xa7e8('0x16')]);module[_0xa7e8('0x17')]=router; \ No newline at end of file +var _0xb4ed=['accept','/:id/reject','reject','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./whatsappMessage.controller','get','index','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','put','update','/:id/accept'];(function(_0x382e19,_0x2701bd){var _0x22c2f1=function(_0x3cb7a5){while(--_0x3cb7a5){_0x382e19['push'](_0x382e19['shift']());}};_0x22c2f1(++_0x2701bd);}(_0xb4ed,0xef));var _0xdb4e=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0xb4ed[_0x592e40];return _0x5d4288;};'use strict';var multer=require(_0xdb4e('0x0'));var util=require(_0xdb4e('0x1'));var path=require('path');var timeout=require(_0xdb4e('0x2'));var express=require(_0xdb4e('0x3'));var router=express['Router']();var fs_extra=require(_0xdb4e('0x4'));var auth=require(_0xdb4e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdb4e('0x6'));router[_0xdb4e('0x7')]('/',auth['isAuthenticated'](),controller[_0xdb4e('0x8')]);router[_0xdb4e('0x7')]('/describe',auth[_0xdb4e('0x9')](),controller[_0xdb4e('0xa')]);router['get'](_0xdb4e('0xb'),auth[_0xdb4e('0x9')](),controller[_0xdb4e('0xc')]);router[_0xdb4e('0xd')]('/',auth['isAuthenticated'](),interaction[_0xdb4e('0xe')](_0xdb4e('0xf'),_0xdb4e('0x10')),controller[_0xdb4e('0x11')]);router[_0xdb4e('0xd')]('/:id/status',controller['status']);router[_0xdb4e('0x12')]('/:id',auth[_0xdb4e('0x9')](),controller[_0xdb4e('0x13')]);router[_0xdb4e('0x12')](_0xdb4e('0x14'),auth['isAuthenticated'](),controller[_0xdb4e('0x15')]);router[_0xdb4e('0x12')](_0xdb4e('0x16'),auth['isAuthenticated'](),controller[_0xdb4e('0x17')]);router[_0xdb4e('0x18')](_0xdb4e('0xb'),auth[_0xdb4e('0x9')](),controller['destroy']);module[_0xdb4e('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 7ae3faa..1a7e670 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 _0x254a=['BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0xada82f,_0x57126b){var _0x2f6276=function(_0x40899b){while(--_0x40899b){_0xada82f['push'](_0xada82f['shift']());}};_0x2f6276(++_0x57126b);}(_0x254a,0x138));var _0xa254=function(_0x3a5d2f,_0x3d5590){_0x3a5d2f=_0x3a5d2f-0x0;var _0x107045=_0x254a[_0x3a5d2f];return _0x107045;};'use strict';var Sequelize=require(_0xa254('0x0'));module[_0xa254('0x1')]={'body':{'type':Sequelize[_0xa254('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa254('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa254('0x4')]('in',_0xa254('0x5')),'defaultValue':_0xa254('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xa254('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xa254('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa254('0x6')]},'providerResponse':{'type':Sequelize[_0xa254('0x2')]}}; \ No newline at end of file +var _0x2882=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x5ce68d,_0x41dcb3){var _0x17418c=function(_0x30a3d9){while(--_0x30a3d9){_0x5ce68d['push'](_0x5ce68d['shift']());}};_0x17418c(++_0x41dcb3);}(_0x2882,0xb8));var _0x2288=function(_0x2e8a6f,_0x211e88){_0x2e8a6f=_0x2e8a6f-0x0;var _0x42d47e=_0x2882[_0x2e8a6f];return _0x42d47e;};'use strict';var Sequelize=require(_0x2288('0x0'));module[_0x2288('0x1')]={'body':{'type':Sequelize[_0x2288('0x2')](_0x2288('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2288('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2288('0x5')]('in',_0x2288('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x2288('0x7')](0xbe)},'phone':{'type':Sequelize[_0x2288('0x7')]},'readAt':{'type':Sequelize[_0x2288('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 0257971..5062c04 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 _0x7aff=['debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','destroy','stack','name','index','map','WhatsappMessage','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','options','includeAll','include','findAll','catch','show','rawAttributes','create','body','update','find','params','describe','whatsapp-interactions','whatsapp','read','readAt','UserId','user','agent','get','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','QueryTypes','SELECT','event','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','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','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7aff,0x66));var _0xf7af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7aff[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf7af('0x0'));var rimraf=require(_0xf7af('0x1'));var zipdir=require(_0xf7af('0x2'));var jsonpatch=require(_0xf7af('0x3'));var rp=require(_0xf7af('0x4'));var moment=require(_0xf7af('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf7af('0x6'));var util=require(_0xf7af('0x7'));var path=require(_0xf7af('0x8'));var sox=require('sox');var csv=require(_0xf7af('0x9'));var ejs=require(_0xf7af('0xa'));var fs=require('fs');var fs_extra=require(_0xf7af('0xb'));var _=require(_0xf7af('0xc'));var squel=require(_0xf7af('0xd'));var crypto=require('crypto');var jsforce=require(_0xf7af('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf7af('0x9'));var querystring=require(_0xf7af('0xf'));var Papa=require(_0xf7af('0x10'));var Redis=require(_0xf7af('0x11'));var authService=require(_0xf7af('0x12'));var qs=require(_0xf7af('0x13'));var as=require(_0xf7af('0x14'));var hardwareService=require(_0xf7af('0x15'));var logger=require(_0xf7af('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf7af('0x17'));var licenseUtil=require(_0xf7af('0x18'));var db=require(_0xf7af('0x19'))['db'];config[_0xf7af('0x1a')]=_['defaults'](config[_0xf7af('0x1a')],{'host':_0xf7af('0x1b'),'port':0x18eb});var socket=require(_0xf7af('0x1c'))(new Redis(config['redis']));require(_0xf7af('0x1d'))[_0xf7af('0x1e')](socket);var jayson=require(_0xf7af('0x1f'));var client=jayson[_0xf7af('0x20')][_0xf7af('0x21')]({'port':0x232c});var client9002=jayson[_0xf7af('0x20')][_0xf7af('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x497906,_0x46a778,_0x17ee1c,_0x3c4e6d){return new BPromise(function(_0x45873c,_0x143e50){var _0x543e9c=_0x3c4e6d||client;return _0x543e9c['request'](_0x497906,_0x17ee1c)[_0xf7af('0x22')](function(_0x19e972){logger[_0xf7af('0x23')](_0xf7af('0x24'),_0x46a778,'request\x20sent');logger[_0xf7af('0x25')](_0xf7af('0x26'),_0x46a778,'request\x20sent',JSON[_0xf7af('0x27')](_0x19e972));if(_0x19e972[_0xf7af('0x28')]){if(_0x19e972[_0xf7af('0x28')][_0xf7af('0x29')]===0x1f4){logger[_0xf7af('0x28')](_0xf7af('0x24'),_0x46a778,_0x19e972[_0xf7af('0x28')][_0xf7af('0x2a')]);return _0x143e50(_0x19e972['error'][_0xf7af('0x2a')]);}logger[_0xf7af('0x28')](_0xf7af('0x24'),_0x46a778,_0x19e972['error'][_0xf7af('0x2a')]);return _0x45873c(_0x19e972['error']['message']);}else{logger[_0xf7af('0x23')](_0xf7af('0x24'),_0x46a778,_0xf7af('0x2b'));_0x45873c(_0x19e972[_0xf7af('0x2c')]['message']);}})['catch'](function(_0x408f6d){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x46a778,_0x408f6d);_0x143e50(_0x408f6d);});});}function respondWithStatusCode(_0x44db05,_0x2e0683){_0x2e0683=_0x2e0683||0xcc;return function(_0x236367){if(_0x236367){return _0x44db05[_0xf7af('0x2d')](_0x2e0683);}return _0x44db05[_0xf7af('0x2e')](_0x2e0683)[_0xf7af('0x2f')]();};}function respondWithResult(_0xa5ee75,_0x213c1f){_0x213c1f=_0x213c1f||0xc8;return function(_0x268fb2){if(_0x268fb2){return _0xa5ee75[_0xf7af('0x2e')](_0x213c1f)[_0xf7af('0x30')](_0x268fb2);}};}function respondWithFilteredResult(_0x1eae82,_0x96af8){return function(_0x440fb1){if(_0x440fb1){var _0x1f1ac0=typeof _0x96af8[_0xf7af('0x31')]===_0xf7af('0x32')&&typeof _0x96af8[_0xf7af('0x33')]===_0xf7af('0x32');var _0x2606cb=_0x440fb1['count'];var _0xed07c2=_0x1f1ac0?0x0:_0x96af8[_0xf7af('0x31')];var _0x2d4d62=_0x1f1ac0?_0x440fb1[_0xf7af('0x34')]:_0x96af8[_0xf7af('0x31')]+_0x96af8['limit'];var _0x3996f1;if(_0x2d4d62>=_0x2606cb){_0x2d4d62=_0x2606cb;_0x3996f1=0xc8;}else{_0x3996f1=0xce;}_0x1eae82['status'](_0x3996f1);return _0x1eae82['set'](_0xf7af('0x35'),_0xed07c2+'-'+_0x2d4d62+'/'+_0x2606cb)['json'](_0x440fb1);}return null;};}function patchUpdates(_0x5b0679){return function(_0x4c0c7a){try{jsonpatch['apply'](_0x4c0c7a,_0x5b0679,!![]);}catch(_0x103f9c){return BPromise[_0xf7af('0x36')](_0x103f9c);}return _0x4c0c7a[_0xf7af('0x37')]();};}function saveUpdates(_0x15156e,_0x4c6a46){return function(_0x206584){if(_0x206584){return _0x206584['update'](_0x15156e)['then'](function(_0x4036d3){return _0x4036d3;});}return null;};}function removeEntity(_0x2850e8,_0x457332){return function(_0x30d663){if(_0x30d663){return _0x30d663[_0xf7af('0x38')]()['then'](function(){_0x2850e8[_0xf7af('0x2e')](0xcc)[_0xf7af('0x2f')]();});}};}function handleEntityNotFound(_0x567737,_0x526856){return function(_0x3e7534){if(!_0x3e7534){_0x567737[_0xf7af('0x2d')](0x194);}return _0x3e7534;};}function handleError(_0x1b7257,_0x429cfb){_0x429cfb=_0x429cfb||0x1f4;return function(_0x5a517c){logger['error'](_0x5a517c[_0xf7af('0x39')]);if(_0x5a517c[_0xf7af('0x3a')]){delete _0x5a517c[_0xf7af('0x3a')];}_0x1b7257[_0xf7af('0x2e')](_0x429cfb)['send'](_0x5a517c);};}exports[_0xf7af('0x3b')]=function(_0x265aa4,_0x158adb){var _0x379bbe={},_0x312c55={},_0x2d4638={'count':0x0,'rows':[]};var _0x4cd3e1=_[_0xf7af('0x3c')](db[_0xf7af('0x3d')]['rawAttributes'],function(_0x28f2e5){return{'name':_0x28f2e5['fieldName'],'type':_0x28f2e5['type'][_0xf7af('0x3e')]};});_0x312c55['model']=_[_0xf7af('0x3c')](_0x4cd3e1,_0xf7af('0x3a'));_0x312c55[_0xf7af('0x3f')]=_[_0xf7af('0x40')](_0x265aa4['query']);_0x312c55['filters']=_[_0xf7af('0x41')](_0x312c55[_0xf7af('0x42')],_0x312c55[_0xf7af('0x3f')]);_0x379bbe[_0xf7af('0x43')]=_[_0xf7af('0x41')](_0x312c55[_0xf7af('0x42')],qs[_0xf7af('0x44')](_0x265aa4[_0xf7af('0x3f')][_0xf7af('0x44')]));_0x379bbe[_0xf7af('0x43')]=_0x379bbe[_0xf7af('0x43')][_0xf7af('0x45')]?_0x379bbe['attributes']:_0x312c55[_0xf7af('0x42')];if(!_0x265aa4['query'][_0xf7af('0x46')](_0xf7af('0x47'))){_0x379bbe[_0xf7af('0x33')]=qs[_0xf7af('0x33')](_0x265aa4[_0xf7af('0x3f')][_0xf7af('0x33')]);_0x379bbe[_0xf7af('0x31')]=qs['offset'](_0x265aa4[_0xf7af('0x3f')][_0xf7af('0x31')]);}_0x379bbe[_0xf7af('0x48')]=qs[_0xf7af('0x49')](_0x265aa4[_0xf7af('0x3f')]['sort']);_0x379bbe[_0xf7af('0x4a')]=qs[_0xf7af('0x4b')](_[_0xf7af('0x4c')](_0x265aa4[_0xf7af('0x3f')],_0x312c55[_0xf7af('0x4b')]),_0x4cd3e1);if(_0x265aa4[_0xf7af('0x3f')]['filter']){_0x379bbe[_0xf7af('0x4a')]=_[_0xf7af('0x4d')](_0x379bbe[_0xf7af('0x4a')],{'$or':_['map'](_0x4cd3e1,function(_0x29cd7b){if(_0x29cd7b[_0xf7af('0x4e')]!=='VIRTUAL'){var _0x3c5658={};_0x3c5658[_0x29cd7b[_0xf7af('0x3a')]]={'$like':'%'+_0x265aa4[_0xf7af('0x3f')][_0xf7af('0x4f')]+'%'};return _0x3c5658;}})});}_0x379bbe=_['merge']({},_0x379bbe,_0x265aa4[_0xf7af('0x50')]);var _0x450664={'where':_0x379bbe[_0xf7af('0x4a')]};return db[_0xf7af('0x3d')][_0xf7af('0x34')](_0x450664)['then'](function(_0x16a522){_0x2d4638['count']=_0x16a522;if(_0x265aa4[_0xf7af('0x3f')][_0xf7af('0x51')]){_0x379bbe[_0xf7af('0x52')]=[{'all':!![]}];}return db[_0xf7af('0x3d')][_0xf7af('0x53')](_0x379bbe);})['then'](function(_0x545499){_0x2d4638['rows']=_0x545499;return _0x2d4638;})[_0xf7af('0x22')](respondWithFilteredResult(_0x158adb,_0x379bbe))[_0xf7af('0x54')](handleError(_0x158adb,null));};exports[_0xf7af('0x55')]=function(_0x5a9940,_0x3ea0e0){var _0x53c9a0={'raw':!![],'where':{'id':_0x5a9940['params']['id']}},_0x1c43f1={};_0x1c43f1[_0xf7af('0x42')]=_[_0xf7af('0x40')](db['WhatsappMessage'][_0xf7af('0x56')]);_0x1c43f1['query']=_[_0xf7af('0x40')](_0x5a9940[_0xf7af('0x3f')]);_0x1c43f1[_0xf7af('0x4b')]=_[_0xf7af('0x41')](_0x1c43f1[_0xf7af('0x42')],_0x1c43f1[_0xf7af('0x3f')]);_0x53c9a0[_0xf7af('0x43')]=_[_0xf7af('0x41')](_0x1c43f1['model'],qs['fields'](_0x5a9940[_0xf7af('0x3f')][_0xf7af('0x44')]));_0x53c9a0[_0xf7af('0x43')]=_0x53c9a0['attributes']['length']?_0x53c9a0[_0xf7af('0x43')]:_0x1c43f1[_0xf7af('0x42')];if(_0x5a9940['query'][_0xf7af('0x51')]){_0x53c9a0[_0xf7af('0x52')]=[{'all':!![]}];}_0x53c9a0=_[_0xf7af('0x4d')]({},_0x53c9a0,_0x5a9940[_0xf7af('0x50')]);return db['WhatsappMessage']['find'](_0x53c9a0)[_0xf7af('0x22')](handleEntityNotFound(_0x3ea0e0,null))[_0xf7af('0x22')](respondWithResult(_0x3ea0e0,null))[_0xf7af('0x54')](handleError(_0x3ea0e0,null));};exports[_0xf7af('0x57')]=function(_0x489235,_0x14e7c7){return db['WhatsappMessage'][_0xf7af('0x57')](_0x489235[_0xf7af('0x58')],{})[_0xf7af('0x22')](respondWithResult(_0x14e7c7,0xc9))[_0xf7af('0x54')](handleError(_0x14e7c7,null));};exports[_0xf7af('0x59')]=function(_0x14236d,_0x1bb873){if(_0x14236d[_0xf7af('0x58')]['id']){delete _0x14236d['body']['id'];}return db[_0xf7af('0x3d')][_0xf7af('0x5a')]({'where':{'id':_0x14236d['params']['id']}})[_0xf7af('0x22')](handleEntityNotFound(_0x1bb873,null))[_0xf7af('0x22')](saveUpdates(_0x14236d[_0xf7af('0x58')],null))[_0xf7af('0x22')](respondWithResult(_0x1bb873,null))[_0xf7af('0x54')](handleError(_0x1bb873,null));};exports[_0xf7af('0x38')]=function(_0x283882,_0x38447a){return db[_0xf7af('0x3d')]['find']({'where':{'id':_0x283882[_0xf7af('0x5b')]['id']}})[_0xf7af('0x22')](handleEntityNotFound(_0x38447a,null))[_0xf7af('0x22')](removeEntity(_0x38447a,null))[_0xf7af('0x54')](handleError(_0x38447a,null));};exports[_0xf7af('0x5c')]=function(_0x3d6827,_0x384fa0){return db[_0xf7af('0x3d')][_0xf7af('0x5c')]()[_0xf7af('0x22')](respondWithResult(_0x384fa0,null))[_0xf7af('0x54')](handleError(_0x384fa0,null));};var interaction_log=require(_0xf7af('0x16'))(_0xf7af('0x5d'));exports['accept']=function(_0x15dfd5,_0x123167,_0x29c50a){var _0x12ffd5={'agent':{},'channel':_0xf7af('0x5e')};if(_0x15dfd5[_0xf7af('0x58')]['id']){delete _0x15dfd5['body']['id'];}_0x15dfd5[_0xf7af('0x58')][_0xf7af('0x5f')]=!![];_0x15dfd5[_0xf7af('0x58')][_0xf7af('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x15dfd5['body'][_0xf7af('0x61')]=_0x15dfd5['body'][_0xf7af('0x61')]||_0x15dfd5[_0xf7af('0x62')]['id'];_0x12ffd5[_0xf7af('0x63')]['id']=_0x15dfd5[_0xf7af('0x58')]['UserId'];return db[_0xf7af('0x3d')]['find']({'where':{'id':_0x15dfd5[_0xf7af('0x5b')]['id'],'UserId':null}})[_0xf7af('0x22')](handleEntityNotFound(_0x123167,null))['then'](saveUpdates(_0x15dfd5[_0xf7af('0x58')],null))[_0xf7af('0x22')](function(_0x318174){if(_0x318174){_0x12ffd5['message']=_0x318174[_0xf7af('0x64')]({'plain':!![]});return db['WhatsappInteraction'][_0xf7af('0x5a')]({'where':{'id':_0x318174['WhatsappInteractionId']}});}return null;})[_0xf7af('0x22')](handleEntityNotFound(_0x123167,null))[_0xf7af('0x22')](function(_0x170c43){if(_0x170c43){return _0x170c43[_0xf7af('0x59')]({'UserId':_0x15dfd5[_0xf7af('0x58')][_0xf7af('0x61')],'read1stAt':_[_0xf7af('0x65')](_0x170c43[_0xf7af('0x66')])?moment()[_0xf7af('0x67')](_0xf7af('0x68')):undefined});}return null;})[_0xf7af('0x22')](function(_0x2ccedd){if(_0x2ccedd){_0x12ffd5[_0xf7af('0x69')]=_0x2ccedd['get']({'plain':!![]});interaction_log[_0xf7af('0x23')](_0xf7af('0x6a'),_0x15dfd5[_0xf7af('0x62')]['id'],_0x15dfd5['user'][_0xf7af('0x3a')],_0x15dfd5[_0xf7af('0x62')]['role'],_0x12ffd5[_0xf7af('0x69')]['id'],_0x15dfd5[_0xf7af('0x58')]?JSON['stringify'](_0x15dfd5['body']):_0xf7af('0x6b'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x12ffd5);}return null;})[_0xf7af('0x22')](function(_0x59c538){var _0x40bfc1=_0xf7af('0x6c')+_0x59c538[_0xf7af('0x2a')]['ContactId'];return db[_0xf7af('0x6d')]['query'](_0x40bfc1,{'type':db[_0xf7af('0x6e')]['QueryTypes']['SELECT'],'raw':!![]})[_0xf7af('0x22')](function(_0x5108b8){return _0x5108b8;});})[_0xf7af('0x22')](function(_0x3b3cea){if(_0x3b3cea){_0x12ffd5[_0xf7af('0x2a')][_0xf7af('0x6f')]=_0x3b3cea[0x0];if(!_0x15dfd5[_0xf7af('0x58')][_0xf7af('0x61')])return;return db[_0xf7af('0x70')][_0xf7af('0x5a')]({'where':{'id':_0x15dfd5[_0xf7af('0x58')]['UserId'],'role':_0xf7af('0x63')},'attributes':['id','name',_0xf7af('0x71'),_0xf7af('0x72'),_0xf7af('0x73')],'raw':!![]});}return null;})[_0xf7af('0x22')](function(_0x4c237e){if(!_0x4c237e)return null;_0x12ffd5[_0xf7af('0x2a')]['agent']=_0x4c237e;return _0x12ffd5;})[_0xf7af('0x22')](function(_0x5ebefc){if(_0x5ebefc){if(_0x15dfd5[_0xf7af('0x58')][_0xf7af('0x74')]){_0x12ffd5[_0xf7af('0x2a')][_0xf7af('0x75')]=util['format'](_0xf7af('0x76'),_0x15dfd5[_0xf7af('0x62')]['name']);_0x12ffd5[_0xf7af('0x2a')][_0xf7af('0x77')]=_0x12ffd5[_0xf7af('0x77')];_0x12ffd5[_0xf7af('0x2a')][_0xf7af('0x78')]=_0x12ffd5[_0xf7af('0x77')];_0x12ffd5[_0xf7af('0x2a')]['event']='accept';return respondWithRpcPromise(_0xf7af('0x79'),_0xf7af('0x79'),{'event':_0xf7af('0x7a'),'message':_0x12ffd5[_0xf7af('0x2a')]},client9002)[_0xf7af('0x22')](function(){return _0x12ffd5;});}return _0x12ffd5;}return null;})['then'](respondWithResult(_0x123167,null))['catch'](handleError(_0x123167,null));};var interaction_log=require(_0xf7af('0x16'))(_0xf7af('0x5d'));exports[_0xf7af('0x36')]=function(_0x242da7,_0x1d44c7,_0x25865a){var _0x127358={'agent':{},'channel':'whatsapp'};if(_0x242da7[_0xf7af('0x58')]['id']){delete _0x242da7[_0xf7af('0x58')]['id'];}_0x242da7[_0xf7af('0x58')][_0xf7af('0x61')]=_0x242da7[_0xf7af('0x58')][_0xf7af('0x61')]||_0x242da7[_0xf7af('0x62')]['id'];_0x127358[_0xf7af('0x63')]['id']=_0x242da7[_0xf7af('0x58')][_0xf7af('0x61')];return db['WhatsappMessage'][_0xf7af('0x5a')]({'where':{'id':_0x242da7[_0xf7af('0x5b')]['id'],'UserId':null}})[_0xf7af('0x22')](handleEntityNotFound(_0x1d44c7,null))[_0xf7af('0x22')](function(_0x593d0f){if(_0x593d0f){_0x127358[_0xf7af('0x2a')]=_0x593d0f['get']({'plain':!![]});return db[_0xf7af('0x7b')][_0xf7af('0x5a')]({'where':{'id':_0x593d0f['WhatsappInteractionId']}});}return null;})[_0xf7af('0x22')](handleEntityNotFound(_0x1d44c7,null))[_0xf7af('0x22')](function(_0x3a90a3){if(_0x3a90a3){_0x127358[_0xf7af('0x69')]=_0x3a90a3[_0xf7af('0x64')]({'plain':!![]});interaction_log[_0xf7af('0x23')](_0xf7af('0x7c'),_0x242da7[_0xf7af('0x62')]['id'],_0x242da7[_0xf7af('0x62')][_0xf7af('0x3a')],_0x242da7[_0xf7af('0x62')]['role'],_0x127358[_0xf7af('0x69')]['id'],_0x242da7[_0xf7af('0x58')]?JSON[_0xf7af('0x27')](_0x242da7['body']):_0xf7af('0x6b'));return respondWithRpcPromise(_0xf7af('0x7d'),'rejectMessage',_0x127358);}return null;})['then'](function(_0x1fc2ed){var _0x409ac1=_0xf7af('0x6c')+_0x1fc2ed['message'][_0xf7af('0x7e')];return db[_0xf7af('0x6d')]['query'](_0x409ac1,{'type':db[_0xf7af('0x6e')][_0xf7af('0x7f')][_0xf7af('0x80')],'raw':!![]})[_0xf7af('0x22')](function(_0x1cfd64){return _0x1cfd64;});})[_0xf7af('0x22')](function(_0x7c4fbb){if(_0x7c4fbb){_0x127358[_0xf7af('0x2a')][_0xf7af('0x6f')]=_0x7c4fbb[0x0];if(!_0x242da7[_0xf7af('0x58')]['UserId'])return;return db[_0xf7af('0x70')][_0xf7af('0x5a')]({'where':{'id':_0x242da7[_0xf7af('0x58')][_0xf7af('0x61')],'role':'agent'},'attributes':['id',_0xf7af('0x3a'),_0xf7af('0x71'),_0xf7af('0x72'),'internal'],'raw':!![]});}return null;})[_0xf7af('0x22')](function(_0x46fa97){if(!_0x46fa97)return null;_0x127358[_0xf7af('0x2a')][_0xf7af('0x63')]=_0x46fa97;return _0x127358;})[_0xf7af('0x22')](function(_0x2a64be){if(_0x2a64be){_0x2a64be['message'][_0xf7af('0x75')]=util[_0xf7af('0x67')](_0xf7af('0x76'),_0x242da7[_0xf7af('0x62')]['name']);_0x2a64be['message'][_0xf7af('0x77')]=_0x127358[_0xf7af('0x77')];_0x2a64be['message'][_0xf7af('0x78')]=_0x127358[_0xf7af('0x77')];_0x2a64be[_0xf7af('0x2a')][_0xf7af('0x81')]=_0xf7af('0x36');respondWithRpcPromise(_0xf7af('0x79'),'EventManager',{'event':'rejectmessage','message':_0x2a64be[_0xf7af('0x2a')]},client9002);return _0x127358;}return null;})[_0xf7af('0x22')](respondWithResult(_0x1d44c7,null))['catch'](handleError(_0x1d44c7,null));};exports[_0xf7af('0x2e')]=function(_0x5a7396,_0x5b6a57,_0x45e355){if(_0x5a7396[_0xf7af('0x58')]['id']){delete _0x5a7396['body']['id'];}var _0x5a7348;return db['WhatsappMessage'][_0xf7af('0x5a')]({'where':{'id':_0x5a7396['params']['id']}})['then'](handleEntityNotFound(_0x5b6a57,null))[_0xf7af('0x22')](function(_0x4f812e){if(_0x4f812e){_0x5a7348=_0x4f812e;return db[_0xf7af('0x82')][_0xf7af('0x5a')]({'where':{'id':_0x4f812e[_0xf7af('0x83')]}});}})['then'](handleEntityNotFound(_0x5b6a57,null))[_0xf7af('0x22')](function(_0x214d3d){if(_0x214d3d){logger[_0xf7af('0x25')](_0xf7af('0x84'),'status',_0xf7af('0x85'),_0x214d3d['type'],util[_0xf7af('0x86')](_0x5a7396['body'],{'showHidden':![],'depth':null}));switch(_0x214d3d[_0xf7af('0x4e')]){case _0xf7af('0x87'):if(_0x5a7396['body'][_0xf7af('0x88')]&&_0x5a7396[_0xf7af('0x58')][_0xf7af('0x88')]===_0x5a7348[_0xf7af('0x89')]&&_0x5a7396[_0xf7af('0x58')][_0xf7af('0x8a')]&&_0x5a7396[_0xf7af('0x58')][_0xf7af('0x8a')]===_0xf7af('0x5f')){return _0x5a7348['update']({'read':!![]});}else{logger[_0xf7af('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xf7af('0x2e'),_0xf7af('0x87'),util[_0xf7af('0x86')](_0x5a7396[_0xf7af('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x5a7348;}})['then'](respondWithResult(_0x5b6a57,null))[_0xf7af('0x54')](handleError(_0x5b6a57,null));}; \ No newline at end of file +var _0xcf82=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','show','params','keys','options','create','update','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','WhatsappInteraction','contact','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','then','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length'];(function(_0x5974e5,_0xef90dd){var _0x58540e=function(_0x294354){while(--_0x294354){_0x5974e5['push'](_0x5974e5['shift']());}};_0x58540e(++_0xef90dd);}(_0xcf82,0xc6));var _0x2cf8=function(_0x562721,_0x4b2a11){_0x562721=_0x562721-0x0;var _0x11b1d0=_0xcf82[_0x562721];return _0x11b1d0;};'use strict';var emlformat=require(_0x2cf8('0x0'));var rimraf=require(_0x2cf8('0x1'));var zipdir=require(_0x2cf8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cf8('0x3'));var moment=require('moment');var BPromise=require(_0x2cf8('0x4'));var Mustache=require(_0x2cf8('0x5'));var util=require('util');var path=require(_0x2cf8('0x6'));var sox=require(_0x2cf8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2cf8('0x8'));var _=require(_0x2cf8('0x9'));var squel=require(_0x2cf8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2cf8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2cf8('0xc'));var Papa=require('papaparse');var Redis=require(_0x2cf8('0xd'));var authService=require(_0x2cf8('0xe'));var qs=require(_0x2cf8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2cf8('0x10'));var logger=require(_0x2cf8('0x11'))(_0x2cf8('0x12'));var utils=require(_0x2cf8('0x13'));var config=require(_0x2cf8('0x14'));var licenseUtil=require(_0x2cf8('0x15'));var db=require(_0x2cf8('0x16'))['db'];config[_0x2cf8('0x17')]=_['defaults'](config[_0x2cf8('0x17')],{'host':_0x2cf8('0x18'),'port':0x18eb});var socket=require(_0x2cf8('0x19'))(new Redis(config[_0x2cf8('0x17')]));require(_0x2cf8('0x1a'))[_0x2cf8('0x1b')](socket);var jayson=require(_0x2cf8('0x1c'));var client=jayson[_0x2cf8('0x1d')][_0x2cf8('0x1e')]({'port':0x232c});var client9002=jayson[_0x2cf8('0x1d')][_0x2cf8('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x8b4270,_0x933964,_0x373bfc,_0x53766e){return new BPromise(function(_0x1e4f78,_0x3b5f11){var _0x3b8a5c=_0x53766e||client;return _0x3b8a5c['request'](_0x8b4270,_0x373bfc)['then'](function(_0x2a9f91){logger[_0x2cf8('0x1f')](_0x2cf8('0x20'),_0x933964,_0x2cf8('0x21'));logger[_0x2cf8('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x933964,_0x2cf8('0x21'),JSON['stringify'](_0x2a9f91));if(_0x2a9f91[_0x2cf8('0x23')]){if(_0x2a9f91['error']['code']===0x1f4){logger[_0x2cf8('0x23')](_0x2cf8('0x20'),_0x933964,_0x2a9f91[_0x2cf8('0x23')]['message']);return _0x3b5f11(_0x2a9f91[_0x2cf8('0x23')][_0x2cf8('0x24')]);}logger[_0x2cf8('0x23')](_0x2cf8('0x20'),_0x933964,_0x2a9f91[_0x2cf8('0x23')][_0x2cf8('0x24')]);return _0x1e4f78(_0x2a9f91['error'][_0x2cf8('0x24')]);}else{logger['info'](_0x2cf8('0x20'),_0x933964,_0x2cf8('0x21'));_0x1e4f78(_0x2a9f91[_0x2cf8('0x25')][_0x2cf8('0x24')]);}})[_0x2cf8('0x26')](function(_0x2c4e88){logger['error'](_0x2cf8('0x20'),_0x933964,_0x2c4e88);_0x3b5f11(_0x2c4e88);});});}function respondWithStatusCode(_0x18a495,_0x12e136){_0x12e136=_0x12e136||0xcc;return function(_0x29e781){if(_0x29e781){return _0x18a495[_0x2cf8('0x27')](_0x12e136);}return _0x18a495[_0x2cf8('0x28')](_0x12e136)[_0x2cf8('0x29')]();};}function respondWithResult(_0x154b44,_0x47f04c){_0x47f04c=_0x47f04c||0xc8;return function(_0x28b493){if(_0x28b493){return _0x154b44[_0x2cf8('0x28')](_0x47f04c)[_0x2cf8('0x2a')](_0x28b493);}};}function respondWithFilteredResult(_0x1a6e97,_0x3a89db){return function(_0x107e5e){if(_0x107e5e){var _0x4589c5=typeof _0x3a89db[_0x2cf8('0x2b')]===_0x2cf8('0x2c')&&typeof _0x3a89db['limit']===_0x2cf8('0x2c');var _0x39497e=_0x107e5e[_0x2cf8('0x2d')];var _0x18a719=_0x4589c5?0x0:_0x3a89db[_0x2cf8('0x2b')];var _0x120519=_0x4589c5?_0x107e5e[_0x2cf8('0x2d')]:_0x3a89db[_0x2cf8('0x2b')]+_0x3a89db[_0x2cf8('0x2e')];var _0x3f3b4c;if(_0x120519>=_0x39497e){_0x120519=_0x39497e;_0x3f3b4c=0xc8;}else{_0x3f3b4c=0xce;}_0x1a6e97[_0x2cf8('0x28')](_0x3f3b4c);return _0x1a6e97[_0x2cf8('0x2f')]('Content-Range',_0x18a719+'-'+_0x120519+'/'+_0x39497e)[_0x2cf8('0x2a')](_0x107e5e);}return null;};}function patchUpdates(_0x526cdc){return function(_0x3f2513){try{jsonpatch[_0x2cf8('0x30')](_0x3f2513,_0x526cdc,!![]);}catch(_0x38d24b){return BPromise['reject'](_0x38d24b);}return _0x3f2513['save']();};}function saveUpdates(_0x775557,_0x4a8c9e){return function(_0x5a905c){if(_0x5a905c){return _0x5a905c['update'](_0x775557)[_0x2cf8('0x31')](function(_0x5c7be0){return _0x5c7be0;});}return null;};}function removeEntity(_0x3bf447,_0x25b248){return function(_0x489dd3){if(_0x489dd3){return _0x489dd3[_0x2cf8('0x32')]()[_0x2cf8('0x31')](function(){_0x3bf447[_0x2cf8('0x28')](0xcc)[_0x2cf8('0x29')]();});}};}function handleEntityNotFound(_0x900da3,_0x4c6ba2){return function(_0x12a4f8){if(!_0x12a4f8){_0x900da3[_0x2cf8('0x27')](0x194);}return _0x12a4f8;};}function handleError(_0x2b0314,_0x1f9b3b){_0x1f9b3b=_0x1f9b3b||0x1f4;return function(_0x49e217){logger['error'](_0x49e217[_0x2cf8('0x33')]);if(_0x49e217[_0x2cf8('0x34')]){delete _0x49e217[_0x2cf8('0x34')];}_0x2b0314[_0x2cf8('0x28')](_0x1f9b3b)[_0x2cf8('0x35')](_0x49e217);};}exports[_0x2cf8('0x36')]=function(_0x384bb7,_0xefc0f9){var _0x16b803={},_0x5cb75e={},_0x3d4069={'count':0x0,'rows':[]};var _0x2662bd=_[_0x2cf8('0x37')](db[_0x2cf8('0x38')][_0x2cf8('0x39')],function(_0x57d658){return{'name':_0x57d658[_0x2cf8('0x3a')],'type':_0x57d658[_0x2cf8('0x3b')][_0x2cf8('0x3c')]};});_0x5cb75e['model']=_[_0x2cf8('0x37')](_0x2662bd,_0x2cf8('0x34'));_0x5cb75e[_0x2cf8('0x3d')]=_['keys'](_0x384bb7['query']);_0x5cb75e[_0x2cf8('0x3e')]=_[_0x2cf8('0x3f')](_0x5cb75e['model'],_0x5cb75e[_0x2cf8('0x3d')]);_0x16b803[_0x2cf8('0x40')]=_['intersection'](_0x5cb75e[_0x2cf8('0x41')],qs[_0x2cf8('0x42')](_0x384bb7[_0x2cf8('0x3d')][_0x2cf8('0x42')]));_0x16b803[_0x2cf8('0x40')]=_0x16b803[_0x2cf8('0x40')][_0x2cf8('0x43')]?_0x16b803[_0x2cf8('0x40')]:_0x5cb75e[_0x2cf8('0x41')];if(!_0x384bb7[_0x2cf8('0x3d')][_0x2cf8('0x44')]('nolimit')){_0x16b803[_0x2cf8('0x2e')]=qs[_0x2cf8('0x2e')](_0x384bb7['query'][_0x2cf8('0x2e')]);_0x16b803[_0x2cf8('0x2b')]=qs[_0x2cf8('0x2b')](_0x384bb7[_0x2cf8('0x3d')]['offset']);}_0x16b803[_0x2cf8('0x45')]=qs[_0x2cf8('0x46')](_0x384bb7[_0x2cf8('0x3d')][_0x2cf8('0x46')]);_0x16b803[_0x2cf8('0x47')]=qs[_0x2cf8('0x3e')](_[_0x2cf8('0x48')](_0x384bb7['query'],_0x5cb75e['filters']),_0x2662bd);if(_0x384bb7[_0x2cf8('0x3d')][_0x2cf8('0x49')]){_0x16b803['where']=_[_0x2cf8('0x4a')](_0x16b803[_0x2cf8('0x47')],{'$or':_['map'](_0x2662bd,function(_0x5e78e0){if(_0x5e78e0[_0x2cf8('0x3b')]!==_0x2cf8('0x4b')){var _0x39427d={};_0x39427d[_0x5e78e0[_0x2cf8('0x34')]]={'$like':'%'+_0x384bb7[_0x2cf8('0x3d')]['filter']+'%'};return _0x39427d;}})});}_0x16b803=_['merge']({},_0x16b803,_0x384bb7['options']);var _0x30729b={'where':_0x16b803[_0x2cf8('0x47')]};return db[_0x2cf8('0x38')][_0x2cf8('0x2d')](_0x30729b)[_0x2cf8('0x31')](function(_0x289f86){_0x3d4069['count']=_0x289f86;if(_0x384bb7[_0x2cf8('0x3d')][_0x2cf8('0x4c')]){_0x16b803[_0x2cf8('0x4d')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x16b803);})[_0x2cf8('0x31')](function(_0x4658db){_0x3d4069['rows']=_0x4658db;return _0x3d4069;})[_0x2cf8('0x31')](respondWithFilteredResult(_0xefc0f9,_0x16b803))[_0x2cf8('0x26')](handleError(_0xefc0f9,null));};exports[_0x2cf8('0x4e')]=function(_0x3aa1fe,_0x310bf2){var _0x33b800={'raw':!![],'where':{'id':_0x3aa1fe[_0x2cf8('0x4f')]['id']}},_0x137fdb={};_0x137fdb[_0x2cf8('0x41')]=_[_0x2cf8('0x50')](db[_0x2cf8('0x38')]['rawAttributes']);_0x137fdb[_0x2cf8('0x3d')]=_[_0x2cf8('0x50')](_0x3aa1fe['query']);_0x137fdb['filters']=_[_0x2cf8('0x3f')](_0x137fdb['model'],_0x137fdb[_0x2cf8('0x3d')]);_0x33b800[_0x2cf8('0x40')]=_[_0x2cf8('0x3f')](_0x137fdb[_0x2cf8('0x41')],qs['fields'](_0x3aa1fe[_0x2cf8('0x3d')][_0x2cf8('0x42')]));_0x33b800['attributes']=_0x33b800[_0x2cf8('0x40')]['length']?_0x33b800[_0x2cf8('0x40')]:_0x137fdb[_0x2cf8('0x41')];if(_0x3aa1fe[_0x2cf8('0x3d')][_0x2cf8('0x4c')]){_0x33b800[_0x2cf8('0x4d')]=[{'all':!![]}];}_0x33b800=_['merge']({},_0x33b800,_0x3aa1fe[_0x2cf8('0x51')]);return db[_0x2cf8('0x38')]['find'](_0x33b800)[_0x2cf8('0x31')](handleEntityNotFound(_0x310bf2,null))[_0x2cf8('0x31')](respondWithResult(_0x310bf2,null))[_0x2cf8('0x26')](handleError(_0x310bf2,null));};exports[_0x2cf8('0x52')]=function(_0x53043e,_0x59d1bb){return db['WhatsappMessage'][_0x2cf8('0x52')](_0x53043e['body'],{})['then'](respondWithResult(_0x59d1bb,0xc9))['catch'](handleError(_0x59d1bb,null));};exports[_0x2cf8('0x53')]=function(_0x393245,_0x34465e){if(_0x393245[_0x2cf8('0x54')]['id']){delete _0x393245[_0x2cf8('0x54')]['id'];}return db[_0x2cf8('0x38')]['find']({'where':{'id':_0x393245[_0x2cf8('0x4f')]['id']}})[_0x2cf8('0x31')](handleEntityNotFound(_0x34465e,null))[_0x2cf8('0x31')](saveUpdates(_0x393245['body'],null))[_0x2cf8('0x31')](respondWithResult(_0x34465e,null))[_0x2cf8('0x26')](handleError(_0x34465e,null));};exports[_0x2cf8('0x32')]=function(_0x2ee2dc,_0x1907dd){return db[_0x2cf8('0x38')][_0x2cf8('0x55')]({'where':{'id':_0x2ee2dc[_0x2cf8('0x4f')]['id']}})[_0x2cf8('0x31')](handleEntityNotFound(_0x1907dd,null))[_0x2cf8('0x31')](removeEntity(_0x1907dd,null))[_0x2cf8('0x26')](handleError(_0x1907dd,null));};exports[_0x2cf8('0x56')]=function(_0x20dbed,_0x2a9655){return db['WhatsappMessage']['describe']()[_0x2cf8('0x31')](respondWithResult(_0x2a9655,null))[_0x2cf8('0x26')](handleError(_0x2a9655,null));};var interaction_log=require(_0x2cf8('0x11'))(_0x2cf8('0x57'));exports[_0x2cf8('0x58')]=function(_0x5ae9ce,_0x41bbaa,_0x4b4876){var _0x417b4e={'agent':{},'channel':_0x2cf8('0x59')};if(_0x5ae9ce['body']['id']){delete _0x5ae9ce['body']['id'];}_0x5ae9ce['body'][_0x2cf8('0x5a')]=!![];_0x5ae9ce['body'][_0x2cf8('0x5b')]=moment()[_0x2cf8('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5ae9ce[_0x2cf8('0x54')]['UserId']=_0x5ae9ce[_0x2cf8('0x54')][_0x2cf8('0x5d')]||_0x5ae9ce[_0x2cf8('0x5e')]['id'];_0x417b4e[_0x2cf8('0x5f')]['id']=_0x5ae9ce[_0x2cf8('0x54')]['UserId'];return db['WhatsappMessage']['find']({'where':{'id':_0x5ae9ce[_0x2cf8('0x4f')]['id'],'UserId':null}})[_0x2cf8('0x31')](handleEntityNotFound(_0x41bbaa,null))[_0x2cf8('0x31')](saveUpdates(_0x5ae9ce[_0x2cf8('0x54')],null))[_0x2cf8('0x31')](function(_0x3117c5){if(_0x3117c5){_0x417b4e[_0x2cf8('0x24')]=_0x3117c5[_0x2cf8('0x60')]({'plain':!![]});return db['WhatsappInteraction'][_0x2cf8('0x55')]({'where':{'id':_0x3117c5[_0x2cf8('0x61')]}});}return null;})[_0x2cf8('0x31')](handleEntityNotFound(_0x41bbaa,null))[_0x2cf8('0x31')](function(_0x2fae2f){if(_0x2fae2f){return _0x2fae2f['update']({'UserId':_0x5ae9ce['body'][_0x2cf8('0x5d')],'read1stAt':_[_0x2cf8('0x62')](_0x2fae2f[_0x2cf8('0x63')])?moment()[_0x2cf8('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2cf8('0x31')](function(_0xdd752b){if(_0xdd752b){_0x417b4e[_0x2cf8('0x64')]=_0xdd752b['get']({'plain':!![]});interaction_log[_0x2cf8('0x1f')](_0x2cf8('0x65'),_0x5ae9ce[_0x2cf8('0x5e')]['id'],_0x5ae9ce[_0x2cf8('0x5e')][_0x2cf8('0x34')],_0x5ae9ce[_0x2cf8('0x5e')][_0x2cf8('0x66')],_0x417b4e['interaction']['id'],_0x5ae9ce[_0x2cf8('0x54')]?JSON[_0x2cf8('0x67')](_0x5ae9ce['body']):_0x2cf8('0x68'));return respondWithRpcPromise('AcceptMessage',_0x2cf8('0x69'),_0x417b4e);}return null;})[_0x2cf8('0x31')](function(_0xc5a380){var _0x33b01b=_0x2cf8('0x6a')+_0xc5a380[_0x2cf8('0x24')][_0x2cf8('0x6b')];return db['sequelize'][_0x2cf8('0x3d')](_0x33b01b,{'type':db[_0x2cf8('0x6c')][_0x2cf8('0x6d')][_0x2cf8('0x6e')],'raw':!![]})[_0x2cf8('0x31')](function(_0x252e1b){return _0x252e1b;});})[_0x2cf8('0x31')](function(_0x3c3f38){if(_0x3c3f38){_0x417b4e[_0x2cf8('0x24')]['contact']=_0x3c3f38[0x0];if(!_0x5ae9ce[_0x2cf8('0x54')][_0x2cf8('0x5d')])return;return db[_0x2cf8('0x6f')][_0x2cf8('0x55')]({'where':{'id':_0x5ae9ce[_0x2cf8('0x54')][_0x2cf8('0x5d')],'role':_0x2cf8('0x5f')},'attributes':['id','name',_0x2cf8('0x70'),_0x2cf8('0x71'),_0x2cf8('0x72')],'raw':!![]});}return null;})['then'](function(_0x51e4e2){if(!_0x51e4e2)return null;_0x417b4e['message'][_0x2cf8('0x5f')]=_0x51e4e2;return _0x417b4e;})['then'](function(_0x4a6f02){if(_0x4a6f02){if(_0x5ae9ce[_0x2cf8('0x54')][_0x2cf8('0x73')]){_0x417b4e[_0x2cf8('0x24')][_0x2cf8('0x74')]=util[_0x2cf8('0x5c')](_0x2cf8('0x75'),_0x5ae9ce[_0x2cf8('0x5e')]['name']);_0x417b4e[_0x2cf8('0x24')][_0x2cf8('0x76')]=_0x417b4e['channel'];_0x417b4e[_0x2cf8('0x24')][_0x2cf8('0x77')]=_0x417b4e['channel'];_0x417b4e['message'][_0x2cf8('0x78')]=_0x2cf8('0x58');return respondWithRpcPromise(_0x2cf8('0x79'),_0x2cf8('0x79'),{'event':_0x2cf8('0x7a'),'message':_0x417b4e[_0x2cf8('0x24')]},client9002)[_0x2cf8('0x31')](function(){return _0x417b4e;});}return _0x417b4e;}return null;})[_0x2cf8('0x31')](respondWithResult(_0x41bbaa,null))[_0x2cf8('0x26')](handleError(_0x41bbaa,null));};var interaction_log=require(_0x2cf8('0x11'))('whatsapp-interactions');exports[_0x2cf8('0x7b')]=function(_0x403cb1,_0x472c31,_0x74f65e){var _0x41d038={'agent':{},'channel':'whatsapp'};if(_0x403cb1[_0x2cf8('0x54')]['id']){delete _0x403cb1['body']['id'];}_0x403cb1[_0x2cf8('0x54')][_0x2cf8('0x5d')]=_0x403cb1[_0x2cf8('0x54')][_0x2cf8('0x5d')]||_0x403cb1['user']['id'];_0x41d038[_0x2cf8('0x5f')]['id']=_0x403cb1[_0x2cf8('0x54')][_0x2cf8('0x5d')];return db[_0x2cf8('0x38')][_0x2cf8('0x55')]({'where':{'id':_0x403cb1[_0x2cf8('0x4f')]['id'],'UserId':null}})[_0x2cf8('0x31')](handleEntityNotFound(_0x472c31,null))[_0x2cf8('0x31')](function(_0x419974){if(_0x419974){_0x41d038[_0x2cf8('0x24')]=_0x419974[_0x2cf8('0x60')]({'plain':!![]});return db[_0x2cf8('0x7c')][_0x2cf8('0x55')]({'where':{'id':_0x419974[_0x2cf8('0x61')]}});}return null;})[_0x2cf8('0x31')](handleEntityNotFound(_0x472c31,null))[_0x2cf8('0x31')](function(_0xe0e80c){if(_0xe0e80c){_0x41d038[_0x2cf8('0x64')]=_0xe0e80c['get']({'plain':!![]});interaction_log[_0x2cf8('0x1f')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x403cb1[_0x2cf8('0x5e')]['id'],_0x403cb1[_0x2cf8('0x5e')][_0x2cf8('0x34')],_0x403cb1[_0x2cf8('0x5e')]['role'],_0x41d038[_0x2cf8('0x64')]['id'],_0x403cb1[_0x2cf8('0x54')]?JSON[_0x2cf8('0x67')](_0x403cb1[_0x2cf8('0x54')]):_0x2cf8('0x68'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x41d038);}return null;})[_0x2cf8('0x31')](function(_0x3e4665){var _0xb291ec=_0x2cf8('0x6a')+_0x3e4665[_0x2cf8('0x24')][_0x2cf8('0x6b')];return db['sequelize'][_0x2cf8('0x3d')](_0xb291ec,{'type':db[_0x2cf8('0x6c')][_0x2cf8('0x6d')][_0x2cf8('0x6e')],'raw':!![]})[_0x2cf8('0x31')](function(_0x2284c6){return _0x2284c6;});})[_0x2cf8('0x31')](function(_0xec4ca9){if(_0xec4ca9){_0x41d038[_0x2cf8('0x24')][_0x2cf8('0x7d')]=_0xec4ca9[0x0];if(!_0x403cb1[_0x2cf8('0x54')][_0x2cf8('0x5d')])return;return db[_0x2cf8('0x6f')]['find']({'where':{'id':_0x403cb1[_0x2cf8('0x54')][_0x2cf8('0x5d')],'role':'agent'},'attributes':['id',_0x2cf8('0x34'),_0x2cf8('0x70'),_0x2cf8('0x71'),_0x2cf8('0x72')],'raw':!![]});}return null;})[_0x2cf8('0x31')](function(_0x262306){if(!_0x262306)return null;_0x41d038[_0x2cf8('0x24')][_0x2cf8('0x5f')]=_0x262306;return _0x41d038;})[_0x2cf8('0x31')](function(_0x37cd13){if(_0x37cd13){_0x37cd13[_0x2cf8('0x24')][_0x2cf8('0x74')]=util[_0x2cf8('0x5c')]('SIP/%s',_0x403cb1['user'][_0x2cf8('0x34')]);_0x37cd13[_0x2cf8('0x24')]['channel']=_0x41d038['channel'];_0x37cd13[_0x2cf8('0x24')]['motionChannel']=_0x41d038['channel'];_0x37cd13['message'][_0x2cf8('0x78')]=_0x2cf8('0x7b');respondWithRpcPromise('EventManager',_0x2cf8('0x79'),{'event':_0x2cf8('0x7e'),'message':_0x37cd13[_0x2cf8('0x24')]},client9002);return _0x41d038;}return null;})[_0x2cf8('0x31')](respondWithResult(_0x472c31,null))[_0x2cf8('0x26')](handleError(_0x472c31,null));};exports[_0x2cf8('0x28')]=function(_0x1b756a,_0x441c62,_0x13882a){if(_0x1b756a[_0x2cf8('0x54')]['id']){delete _0x1b756a[_0x2cf8('0x54')]['id'];}var _0x1f1bd8;return db[_0x2cf8('0x38')][_0x2cf8('0x55')]({'where':{'id':_0x1b756a[_0x2cf8('0x4f')]['id']}})[_0x2cf8('0x31')](handleEntityNotFound(_0x441c62,null))[_0x2cf8('0x31')](function(_0x3a2cd5){if(_0x3a2cd5){_0x1f1bd8=_0x3a2cd5;return db['WhatsappAccount'][_0x2cf8('0x55')]({'where':{'id':_0x3a2cd5['WhatsappAccountId']}});}})[_0x2cf8('0x31')](handleEntityNotFound(_0x441c62,null))[_0x2cf8('0x31')](function(_0x1b4822){if(_0x1b4822){logger[_0x2cf8('0x22')](_0x2cf8('0x7f'),_0x2cf8('0x28'),'received\x20delivery\x20report\x20from',_0x1b4822[_0x2cf8('0x3b')],util[_0x2cf8('0x80')](_0x1b756a[_0x2cf8('0x54')],{'showHidden':![],'depth':null}));switch(_0x1b4822[_0x2cf8('0x3b')]){case _0x2cf8('0x81'):if(_0x1b756a[_0x2cf8('0x54')]['MessageSid']&&_0x1b756a[_0x2cf8('0x54')][_0x2cf8('0x82')]===_0x1f1bd8[_0x2cf8('0x83')]&&_0x1b756a[_0x2cf8('0x54')][_0x2cf8('0x84')]&&_0x1b756a[_0x2cf8('0x54')][_0x2cf8('0x84')]===_0x2cf8('0x5a')){return _0x1f1bd8['update']({'read':!![]});}else{logger[_0x2cf8('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x2cf8('0x81'),util[_0x2cf8('0x80')](_0x1b756a[_0x2cf8('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x1f1bd8;}})[_0x2cf8('0x31')](respondWithResult(_0x441c62,null))['catch'](handleError(_0x441c62,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index b05748d..0a09131 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 _0x0647=['hook','events','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x18dcc9,_0x175a73){var _0x48ca01=function(_0x473c50){while(--_0x473c50){_0x18dcc9['push'](_0x18dcc9['shift']());}};_0x48ca01(++_0x175a73);}(_0x0647,0xd0));var _0x7064=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x0647[_0x278e3c];return _0x3e2d9b;};'use strict';var EventEmitter=require(_0x7064('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0x7064('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7064('0x2')](0x0);var events={'afterCreate':_0x7064('0x3'),'afterUpdate':_0x7064('0x4'),'afterDestroy':_0x7064('0x5')};function emitEvent(_0x5e8659){return function(_0x58b306,_0x313dce,_0x34b4d5){WhatsappMessageEvents[_0x7064('0x6')](_0x5e8659+':'+_0x58b306['id'],_0x58b306);WhatsappMessageEvents[_0x7064('0x6')](_0x5e8659,_0x58b306);_0x34b4d5(null);};}for(var e in events){if(events[_0x7064('0x7')](e)){var event=events[e];WhatsappMessage[_0x7064('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x705f=['update','remove','emit','hasOwnProperty','hook','WhatsappMessage','save'];(function(_0x450ef7,_0x2f2dda){var _0x2bcd3b=function(_0x4fe820){while(--_0x4fe820){_0x450ef7['push'](_0x450ef7['shift']());}};_0x2bcd3b(++_0x2f2dda);}(_0x705f,0x75));var _0xf705=function(_0x2c25c7,_0x57f2d7){_0x2c25c7=_0x2c25c7-0x0;var _0x1e51bd=_0x705f[_0x2c25c7];return _0x1e51bd;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0xf705('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf705('0x1'),'afterUpdate':_0xf705('0x2'),'afterDestroy':_0xf705('0x3')};function emitEvent(_0x35760c){return function(_0x1dd679,_0x47514c,_0x9045cf){WhatsappMessageEvents[_0xf705('0x4')](_0x35760c+':'+_0x1dd679['id'],_0x1dd679);WhatsappMessageEvents[_0xf705('0x4')](_0x35760c,_0x1dd679);_0x9045cf(null);};}for(var e in events){if(events[_0xf705('0x5')](e)){var event=events[e];WhatsappMessage[_0xf705('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 9ddaf80..83f833d 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 _0x7dff=['secret','WhatsappAccount','find','type','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','twilio','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x7dff,0xde));var _0xf7df=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x7dff[_0x934425];return _0x31d596;};'use strict';var _=require(_0xf7df('0x0'));var util=require('util');var logger=require(_0xf7df('0x1'))(_0xf7df('0x2'));var moment=require(_0xf7df('0x3'));var BPromise=require(_0xf7df('0x4'));var rp=require(_0xf7df('0x5'));var fetch=require(_0xf7df('0x6'));var fs=require('fs');var path=require(_0xf7df('0x7'));var rimraf=require(_0xf7df('0x8'));var config=require(_0xf7df('0x9'));var attributes=require(_0xf7df('0xa'));module[_0xf7df('0xb')]=function(_0x56bf9e,_0xf665b0){return _0x56bf9e[_0xf7df('0xc')](_0xf7df('0xd'),attributes,{'tableName':_0xf7df('0xe'),'paranoid':![],'indexes':[{'name':_0xf7df('0xf'),'fields':[_0xf7df('0xf')]},{'name':_0xf7df('0x10'),'fields':[_0xf7df('0x11')],'type':_0xf7df('0x12')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c6cda,_0x54d47a,_0x42f8bd){var _0x102f8b=_0x56bf9e[_0xf7df('0x13')];var _0x343d43=_0x5c6cda[_0xf7df('0x14')]({'plain':!![]});if(_0x343d43['direction'][_0xf7df('0x15')]()==='in'||_0x343d43[_0xf7df('0x16')][_0xf7df('0x15')]()===_0xf7df('0x17')&&!_0x343d43['secret']&&!_[_0xf7df('0x18')](_0x343d43[_0xf7df('0x19')])){_0x102f8b[_0xf7df('0x1a')][_0xf7df('0x1b')]({'where':{'id':_0x343d43[_0xf7df('0x1c')]}})[_0xf7df('0x1d')](function(_0x423061){if(_0x423061){_0x423061[_0xf7df('0x1e')]({'lastMsgAt':_0x343d43[_0xf7df('0x1f')],'lastMsgDirection':_0x343d43[_0xf7df('0x16')][_0xf7df('0x15')]()});}})[_0xf7df('0x20')](function(_0x3086c2){console[_0xf7df('0x21')](_0x3086c2);});}if(_0x343d43['direction']===_0xf7df('0x17')&&!_0x343d43[_0xf7df('0x22')]){var _0x10bf45;_0x102f8b[_0xf7df('0x23')][_0xf7df('0x24')]({'where':{'id':_0x343d43['WhatsappAccountId']},'raw':!![]})[_0xf7df('0x1d')](function(_0x1dc4db){_0x10bf45=_0x1dc4db;if(_0x10bf45&&_0x10bf45[_0xf7df('0x25')]){switch(_0x10bf45[_0xf7df('0x25')]){case'twilio':var _0x33fcfa=require('twilio');if(_0x10bf45[_0xf7df('0x26')]&&_0x10bf45[_0xf7df('0x27')]&&_0x10bf45[_0xf7df('0x28')]){var _0x23bbca=new _0x33fcfa(_0x10bf45[_0xf7df('0x26')],_0x10bf45[_0xf7df('0x27')]);_0x23bbca[_0xf7df('0x29')]['create']({'body':_0x343d43[_0xf7df('0x11')],'to':_0xf7df('0x2a')+_0x343d43[_0xf7df('0x28')],'from':_0xf7df('0x2a')+_0x10bf45[_0xf7df('0x28')],'statusCallback':_0x10bf45[_0xf7df('0x2b')]+_0xf7df('0x2c')+_0x343d43['id']+_0xf7df('0x2d')+_0x10bf45[_0xf7df('0x2e')]})['then'](function(_0x1b7b0b){if(_0x1b7b0b[_0xf7df('0x2f')]){return _0x5c6cda[_0xf7df('0x1e')]({'messageId':_0x1b7b0b[_0xf7df('0x2f')]});}})['catch'](function(_0xa8ae5c){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xf7df('0x30'),_0xf7df('0x31'),util[_0xf7df('0x32')](_0xa8ae5c,{'showHidden':![],'depth':null}));});}else{logger[_0xf7df('0x21')](_0xf7df('0x33'),_0xf7df('0x30'),_0xf7df('0x31'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xf7df('0x34'):var _0x2f3ae2=_0x10bf45[_0xf7df('0x26')];var _0x453e39=_0x10bf45[_0xf7df('0x27')];var _0x172182=_0x10bf45['baseUrl']+_0xf7df('0x35')+_0x2f3ae2+_0xf7df('0x36');var _0x5dcc21={'to':[_0x343d43[_0xf7df('0x28')]],'message':{'type':_0xf7df('0x37'),'text':_0x343d43[_0xf7df('0x11')]}};var _0x18ede6={'method':_0xf7df('0x38'),'uri':_0x172182,'headers':{'Authorization':_0xf7df('0x39')+_0x453e39,'Content-Type':'application/json'},'body':_0x5dcc21,'json':!![]};rp(_0x18ede6)[_0xf7df('0x1d')](function(_0x2019a4){if(_0x2019a4[_0xf7df('0x3a')][0x0][_0xf7df('0x3b')]){return _0x5c6cda['update']({'messageId':_0x2019a4[_0xf7df('0x3a')][0x0][_0xf7df('0x3b')]});}})[_0xf7df('0x20')](function(_0x46b2b9){logger[_0xf7df('0x3c')](_0xf7df('0x3d'),_0x46b2b9);});break;}}})[_0xf7df('0x3e')](function(){_0x42f8bd();});}else{_0x42f8bd();}}},'charset':_0xf7df('0x3f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdb73=['../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','find','type','twilio','accountSid','authToken','messages','create','phone','whatsapp:','remote','/status?token=','token','sid','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','statuses','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','node-fetch','path','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xdb73,0xe7));var _0x3db7=function(_0x21d387,_0x51c585){_0x21d387=_0x21d387-0x0;var _0x12eacf=_0xdb73[_0x21d387];return _0x12eacf;};'use strict';var _=require(_0x3db7('0x0'));var util=require(_0x3db7('0x1'));var logger=require(_0x3db7('0x2'))(_0x3db7('0x3'));var moment=require(_0x3db7('0x4'));var BPromise=require(_0x3db7('0x5'));var rp=require('request-promise');var fetch=require(_0x3db7('0x6'));var fs=require('fs');var path=require(_0x3db7('0x7'));var rimraf=require(_0x3db7('0x8'));var config=require(_0x3db7('0x9'));var attributes=require(_0x3db7('0xa'));module['exports']=function(_0x11a849,_0x3af7a2){return _0x11a849[_0x3db7('0xb')](_0x3db7('0xc'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x3db7('0xd'),'fields':['messageId']},{'name':_0x3db7('0xe'),'fields':[_0x3db7('0xf')],'type':_0x3db7('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a8713,_0x1478be,_0x199759){var _0x53ad28=_0x11a849[_0x3db7('0x11')];var _0xb4f635=_0x2a8713[_0x3db7('0x12')]({'plain':!![]});if(_0xb4f635[_0x3db7('0x13')][_0x3db7('0x14')]()==='in'||_0xb4f635[_0x3db7('0x13')]['toLowerCase']()===_0x3db7('0x15')&&!_0xb4f635[_0x3db7('0x16')]&&!_['isNil'](_0xb4f635[_0x3db7('0x17')])){_0x53ad28[_0x3db7('0x18')][_0x3db7('0x19')]({'where':{'id':_0xb4f635[_0x3db7('0x1a')]}})[_0x3db7('0x1b')](function(_0x172bdf){if(_0x172bdf){_0x172bdf[_0x3db7('0x1c')]({'lastMsgAt':_0xb4f635[_0x3db7('0x1d')],'lastMsgDirection':_0xb4f635['direction'][_0x3db7('0x14')]()});}})['catch'](function(_0x156f56){console['error'](_0x156f56);});}if(_0xb4f635[_0x3db7('0x13')]===_0x3db7('0x15')&&!_0xb4f635[_0x3db7('0x16')]){var _0x198776;_0x53ad28['WhatsappAccount'][_0x3db7('0x1e')]({'where':{'id':_0xb4f635['WhatsappAccountId']},'raw':!![]})[_0x3db7('0x1b')](function(_0x34f49e){_0x198776=_0x34f49e;if(_0x198776&&_0x198776[_0x3db7('0x1f')]){switch(_0x198776[_0x3db7('0x1f')]){case _0x3db7('0x20'):var _0x46b6f2=require('twilio');if(_0x198776['accountSid']&&_0x198776['authToken']&&_0x198776['phone']){var _0x53aa63=new _0x46b6f2(_0x198776[_0x3db7('0x21')],_0x198776[_0x3db7('0x22')]);_0x53aa63[_0x3db7('0x23')][_0x3db7('0x24')]({'body':_0xb4f635[_0x3db7('0xf')],'to':'whatsapp:'+_0xb4f635[_0x3db7('0x25')],'from':_0x3db7('0x26')+_0x198776[_0x3db7('0x25')],'statusCallback':_0x198776[_0x3db7('0x27')]+'/api/whatsapp/messages/'+_0xb4f635['id']+_0x3db7('0x28')+_0x198776[_0x3db7('0x29')]})['then'](function(_0x5f1e8c){if(_0x5f1e8c['sid']){return _0x2a8713[_0x3db7('0x1c')]({'messageId':_0x5f1e8c[_0x3db7('0x2a')]});}})[_0x3db7('0x2b')](function(_0x58d1d7){logger[_0x3db7('0x2c')](_0x3db7('0x2d'),_0x3db7('0x2e'),_0x3db7('0x20'),util[_0x3db7('0x2f')](_0x58d1d7,{'showHidden':![],'depth':null}));});}else{logger[_0x3db7('0x2c')](_0x3db7('0x2d'),'afterCreate',_0x3db7('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x3db7('0x30'):var _0x427e51=_0x198776[_0x3db7('0x21')];var _0x4b7b88=_0x198776[_0x3db7('0x22')];var _0x2d2adf=_0x198776[_0x3db7('0x31')]+_0x3db7('0x32')+_0x427e51+_0x3db7('0x33');var _0xfde0da={'to':[_0xb4f635[_0x3db7('0x25')]],'message':{'type':_0x3db7('0x34'),'text':_0xb4f635[_0x3db7('0xf')]}};var _0x562736={'method':_0x3db7('0x35'),'uri':_0x2d2adf,'headers':{'Authorization':_0x3db7('0x36')+_0x4b7b88,'Content-Type':'application/json'},'body':_0xfde0da,'json':!![]};rp(_0x562736)[_0x3db7('0x1b')](function(_0x1f1e83){if(_0x1f1e83[_0x3db7('0x37')][0x0]['message_id']){return _0x2a8713[_0x3db7('0x1c')]({'messageId':_0x1f1e83[_0x3db7('0x37')][0x0]['message_id']});}})[_0x3db7('0x2b')](function(_0x2dd5f4){logger[_0x3db7('0x38')]('WhatsappMessage,\x20%s',_0x2dd5f4);});break;}}})[_0x3db7('0x39')](function(){_0x199759();});}else{_0x199759();}}},'charset':_0x3db7('0x3a'),'collate':_0x3db7('0x3b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 425b659..e51b267 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 _0x5bd7=['socket.io-emitter','./whatsappMessage.socket','register','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x4b5039,_0x23b033){var _0x597f29=function(_0x34465e){while(--_0x34465e){_0x4b5039['push'](_0x4b5039['shift']());}};_0x597f29(++_0x23b033);}(_0x5bd7,0x161));var _0x75bd=function(_0x5c8eae,_0x272f80){_0x5c8eae=_0x5c8eae-0x0;var _0x3899b5=_0x5bd7[_0x5c8eae];return _0x3899b5;};'use strict';var _=require(_0x75bd('0x0'));var util=require(_0x75bd('0x1'));var moment=require(_0x75bd('0x2'));var BPromise=require(_0x75bd('0x3'));var rs=require(_0x75bd('0x4'));var fs=require('fs');var Redis=require(_0x75bd('0x5'));var db=require(_0x75bd('0x6'))['db'];var utils=require(_0x75bd('0x7'));var logger=require(_0x75bd('0x8'))(_0x75bd('0x9'));var config=require(_0x75bd('0xa'));var jayson=require(_0x75bd('0xb'));var client=jayson[_0x75bd('0xc')][_0x75bd('0xd')]({'port':0x232a});config[_0x75bd('0xe')]=_[_0x75bd('0xf')](config['redis'],{'host':_0x75bd('0x10'),'port':0x18eb});var socket=require(_0x75bd('0x11'))(new Redis(config[_0x75bd('0xe')]));require(_0x75bd('0x12'))[_0x75bd('0x13')](socket);function respondWithRpcPromise(_0x5aeb32,_0xd127,_0x102eac){return new BPromise(function(_0x1bac37,_0x5a03b3){return client[_0x75bd('0x14')](_0x5aeb32,_0x102eac)[_0x75bd('0x15')](function(_0x3b3590){logger[_0x75bd('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0xd127,_0x75bd('0x17'));logger[_0x75bd('0x18')](_0x75bd('0x19'),_0xd127,_0x75bd('0x17'),JSON[_0x75bd('0x1a')](_0x3b3590));if(_0x3b3590['error']){if(_0x3b3590[_0x75bd('0x1b')][_0x75bd('0x1c')]===0x1f4){logger[_0x75bd('0x1b')](_0x75bd('0x1d'),_0xd127,_0x3b3590['error'][_0x75bd('0x1e')]);return _0x5a03b3(_0x3b3590[_0x75bd('0x1b')][_0x75bd('0x1e')]);}logger[_0x75bd('0x1b')](_0x75bd('0x1d'),_0xd127,_0x3b3590[_0x75bd('0x1b')][_0x75bd('0x1e')]);return _0x1bac37(_0x3b3590['error'][_0x75bd('0x1e')]);}else{logger[_0x75bd('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0xd127,_0x75bd('0x17'));_0x1bac37(_0x3b3590['result'][_0x75bd('0x1e')]);}})[_0x75bd('0x1f')](function(_0x4b151b){logger[_0x75bd('0x1b')](_0x75bd('0x1d'),_0xd127,_0x4b151b);_0x5a03b3(_0x4b151b);});});}exports[_0x75bd('0x20')]=function(_0x4abac1){var _0xcfc526=this;return new Promise(function(_0x4a466e,_0x14d55d){return db[_0x75bd('0x21')]['create'](_0x4abac1[_0x75bd('0x22')],{'raw':_0x4abac1[_0x75bd('0x23')]?_0x4abac1[_0x75bd('0x23')][_0x75bd('0x24')]===undefined?!![]:![]:!![]})[_0x75bd('0x15')](function(_0x2a0dc6){logger[_0x75bd('0x16')]('CreateWhatsappMessage',_0x4abac1);logger[_0x75bd('0x18')](_0x75bd('0x20'),_0x4abac1,JSON['stringify'](_0x2a0dc6));_0x4a466e(_0x2a0dc6);})[_0x75bd('0x1f')](function(_0x5381a4){logger['error'](_0x75bd('0x20'),_0x5381a4[_0x75bd('0x1e')],_0x4abac1);_0x14d55d(_0xcfc526[_0x75bd('0x1b')](0x1f4,_0x5381a4[_0x75bd('0x1e')]));});});}; \ No newline at end of file +var _0x6aa9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','WhatsappMessage','create','body','options','CreateWhatsappMessage','debug','lodash','util'];(function(_0x286d82,_0x1729bf){var _0x203e57=function(_0x3ad4b4){while(--_0x3ad4b4){_0x286d82['push'](_0x286d82['shift']());}};_0x203e57(++_0x1729bf);}(_0x6aa9,0x139));var _0x96aa=function(_0x3ba8f6,_0xc676fe){_0x3ba8f6=_0x3ba8f6-0x0;var _0x5c0dd8=_0x6aa9[_0x3ba8f6];return _0x5c0dd8;};'use strict';var _=require(_0x96aa('0x0'));var util=require(_0x96aa('0x1'));var moment=require(_0x96aa('0x2'));var BPromise=require(_0x96aa('0x3'));var rs=require(_0x96aa('0x4'));var fs=require('fs');var Redis=require(_0x96aa('0x5'));var db=require(_0x96aa('0x6'))['db'];var utils=require(_0x96aa('0x7'));var logger=require(_0x96aa('0x8'))('rpc');var config=require(_0x96aa('0x9'));var jayson=require(_0x96aa('0xa'));var client=jayson[_0x96aa('0xb')][_0x96aa('0xc')]({'port':0x232a});config['redis']=_[_0x96aa('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x96aa('0xe'))(new Redis(config['redis']));require(_0x96aa('0xf'))[_0x96aa('0x10')](socket);function respondWithRpcPromise(_0x4fe278,_0x320447,_0x43297b){return new BPromise(function(_0x1527c8,_0x4736e0){return client[_0x96aa('0x11')](_0x4fe278,_0x43297b)[_0x96aa('0x12')](function(_0x4a88d5){logger[_0x96aa('0x13')](_0x96aa('0x14'),_0x320447,'request\x20sent');logger['debug'](_0x96aa('0x15'),_0x320447,_0x96aa('0x16'),JSON[_0x96aa('0x17')](_0x4a88d5));if(_0x4a88d5[_0x96aa('0x18')]){if(_0x4a88d5[_0x96aa('0x18')][_0x96aa('0x19')]===0x1f4){logger[_0x96aa('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x320447,_0x4a88d5[_0x96aa('0x18')][_0x96aa('0x1a')]);return _0x4736e0(_0x4a88d5['error'][_0x96aa('0x1a')]);}logger[_0x96aa('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x320447,_0x4a88d5['error'][_0x96aa('0x1a')]);return _0x1527c8(_0x4a88d5['error'][_0x96aa('0x1a')]);}else{logger[_0x96aa('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x320447,_0x96aa('0x16'));_0x1527c8(_0x4a88d5[_0x96aa('0x1b')][_0x96aa('0x1a')]);}})[_0x96aa('0x1c')](function(_0x48358e){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x320447,_0x48358e);_0x4736e0(_0x48358e);});});}exports['CreateWhatsappMessage']=function(_0x2637f2){var _0x4445da=this;return new Promise(function(_0x44929a,_0x4b9d97){return db[_0x96aa('0x1d')][_0x96aa('0x1e')](_0x2637f2[_0x96aa('0x1f')],{'raw':_0x2637f2[_0x96aa('0x20')]?_0x2637f2[_0x96aa('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x96aa('0x12')](function(_0x38331c){logger['info'](_0x96aa('0x21'),_0x2637f2);logger[_0x96aa('0x22')]('CreateWhatsappMessage',_0x2637f2,JSON['stringify'](_0x38331c));_0x44929a(_0x38331c);})['catch'](function(_0x337c6d){logger[_0x96aa('0x18')]('CreateWhatsappMessage',_0x337c6d[_0x96aa('0x1a')],_0x2637f2);_0x4b9d97(_0x4445da[_0x96aa('0x18')](0x1f4,_0x337c6d[_0x96aa('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 5cb4482..afe738f 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 _0x743d=['update','emit','removeListener','whatsappMessage:','save','remove'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x743d,0x142));var _0xd743=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x743d[_0x3947c9];return _0x2e7871;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xd743('0x0'),_0xd743('0x1'),_0xd743('0x2')];function createListener(_0x163440,_0x31d3bc){return function(_0x5b7947){_0x31d3bc[_0xd743('0x3')](_0x163440,_0x5b7947);};}function removeListener(_0x45608a,_0x529b8e){return function(){WhatsappMessageEvents[_0xd743('0x4')](_0x45608a,_0x529b8e);};}exports['register']=function(_0x28c961){for(var _0x34de11=0x0,_0x46bc04=events['length'];_0x34de11<_0x46bc04;_0x34de11++){var _0x436f20=events[_0x34de11];var _0x52cd78=createListener(_0xd743('0x5')+_0x436f20,_0x28c961);WhatsappMessageEvents['on'](_0x436f20,_0x52cd78);}}; \ No newline at end of file +var _0xa632=['emit','removeListener','./whatsappMessage.events','remove','update'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0xa632,0x6b));var _0x2a63=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa632[_0x4bfac3];return _0x15f0f2;};'use strict';var WhatsappMessageEvents=require(_0x2a63('0x0'));var events=['save',_0x2a63('0x1'),_0x2a63('0x2')];function createListener(_0x56d5e4,_0x5e63c5){return function(_0x2cb332){_0x5e63c5[_0x2a63('0x3')](_0x56d5e4,_0x2cb332);};}function removeListener(_0x3353c8,_0xda9b5a){return function(){WhatsappMessageEvents[_0x2a63('0x4')](_0x3353c8,_0xda9b5a);};}exports['register']=function(_0x3cd537){for(var _0x5e3168=0x0,_0x2b6e74=events['length'];_0x5e3168<_0x2b6e74;_0x5e3168++){var _0x2599be=events[_0x5e3168];var _0x94e1d4=createListener('whatsappMessage:'+_0x2599be,_0x3cd537);WhatsappMessageEvents['on'](_0x2599be,_0x94e1d4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 4804fdb..08a9690 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 _0xe195=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','describe','isAuthenticated','/:id/members','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','/:id','update','delete','removeTeams','removeAgents'];(function(_0x12fcbd,_0x884804){var _0x28ec2a=function(_0xa5ff99){while(--_0xa5ff99){_0x12fcbd['push'](_0x12fcbd['shift']());}};_0x28ec2a(++_0x884804);}(_0xe195,0xea));var _0x5e19=function(_0x362f9d,_0x28eb1a){_0x362f9d=_0x362f9d-0x0;var _0x587f97=_0xe195[_0x362f9d];return _0x587f97;};'use strict';var multer=require('multer');var util=require(_0x5e19('0x0'));var path=require(_0x5e19('0x1'));var timeout=require(_0x5e19('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5e19('0x3'));var auth=require(_0x5e19('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5e19('0x5'));var controller=require(_0x5e19('0x6'));router[_0x5e19('0x7')]('/',auth['isAuthenticated'](),controller[_0x5e19('0x8')]);router[_0x5e19('0x7')](_0x5e19('0x9'),auth['isAuthenticated'](),controller[_0x5e19('0xa')]);router['get']('/:id',auth[_0x5e19('0xb')](),controller['show']);router['get'](_0x5e19('0xc'),auth[_0x5e19('0xb')](),controller['getMembers']);router[_0x5e19('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5e19('0xd')]);router['get'](_0x5e19('0xe'),auth[_0x5e19('0xb')](),controller[_0x5e19('0xf')]);router['post']('/',auth[_0x5e19('0xb')](),controller['create']);router[_0x5e19('0x10')](_0x5e19('0x11'),auth[_0x5e19('0xb')](),controller[_0x5e19('0x12')]);router[_0x5e19('0x10')](_0x5e19('0xe'),auth[_0x5e19('0xb')](),controller[_0x5e19('0x13')]);router[_0x5e19('0x14')](_0x5e19('0x15'),auth[_0x5e19('0xb')](),controller[_0x5e19('0x16')]);router[_0x5e19('0x17')](_0x5e19('0x15'),auth[_0x5e19('0xb')](),controller['destroy']);router[_0x5e19('0x17')](_0x5e19('0x11'),auth[_0x5e19('0xb')](),controller[_0x5e19('0x18')]);router[_0x5e19('0x17')](_0x5e19('0xe'),auth[_0x5e19('0xb')](),controller[_0x5e19('0x19')]);module['exports']=router; \ No newline at end of file +var _0x5201=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','update','delete','destroy','removeTeams','/:id/users','removeAgents','util','path','Router','fs-extra','../../components/auth/service','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x50748b,_0x599d6d){var _0x5688d7=function(_0xfb5d55){while(--_0xfb5d55){_0x50748b['push'](_0x50748b['shift']());}};_0x5688d7(++_0x599d6d);}(_0x5201,0xc5));var _0x1520=function(_0x5d40b1,_0x230b2a){_0x5d40b1=_0x5d40b1-0x0;var _0x5efe12=_0x5201[_0x5d40b1];return _0x5efe12;};'use strict';var multer=require('multer');var util=require(_0x1520('0x0'));var path=require(_0x1520('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1520('0x2')]();var fs_extra=require(_0x1520('0x3'));var auth=require(_0x1520('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1520('0x5'));router[_0x1520('0x6')]('/',auth['isAuthenticated'](),controller[_0x1520('0x7')]);router[_0x1520('0x6')](_0x1520('0x8'),auth[_0x1520('0x9')](),controller[_0x1520('0xa')]);router[_0x1520('0x6')](_0x1520('0xb'),auth[_0x1520('0x9')](),controller[_0x1520('0xc')]);router[_0x1520('0x6')](_0x1520('0xd'),auth[_0x1520('0x9')](),controller[_0x1520('0xe')]);router['get'](_0x1520('0xf'),auth[_0x1520('0x9')](),controller[_0x1520('0x10')]);router[_0x1520('0x6')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x1520('0x11')]('/',auth['isAuthenticated'](),controller[_0x1520('0x12')]);router[_0x1520('0x11')](_0x1520('0xf'),auth[_0x1520('0x9')](),controller[_0x1520('0x13')]);router['post']('/:id/users',auth[_0x1520('0x9')](),controller['addAgents']);router['put'](_0x1520('0xb'),auth[_0x1520('0x9')](),controller[_0x1520('0x14')]);router[_0x1520('0x15')](_0x1520('0xb'),auth[_0x1520('0x9')](),controller[_0x1520('0x16')]);router[_0x1520('0x15')](_0x1520('0xf'),auth[_0x1520('0x9')](),controller[_0x1520('0x17')]);router[_0x1520('0x15')](_0x1520('0x18'),auth[_0x1520('0x9')](),controller[_0x1520('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index c88cfc7..a79b703 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 _0xcfac=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x111000,_0x253bca){var _0x374ea8=function(_0x11c2f5){while(--_0x11c2f5){_0x111000['push'](_0x111000['shift']());}};_0x374ea8(++_0x253bca);}(_0xcfac,0x105));var _0xccfa=function(_0x4e5df8,_0x5cc782){_0x4e5df8=_0x4e5df8-0x0;var _0x47f4ad=_0xcfac[_0x4e5df8];return _0x47f4ad;};'use strict';var Sequelize=require(_0xccfa('0x0'));module[_0xccfa('0x1')]={'name':{'type':Sequelize[_0xccfa('0x2')],'unique':_0xccfa('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xccfa('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xccfa('0x5')](_0xccfa('0x6'),_0xccfa('0x7'),_0xccfa('0x8'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa4de=['ENUM','rrmemory','beepall','roundrobin','STRING','sequelize','name','INTEGER'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0xa4de,0x10d));var _0xea4d=function(_0x3fda62,_0x5d1256){_0x3fda62=_0x3fda62-0x0;var _0x45a3c3=_0xa4de[_0x3fda62];return _0x45a3c3;};'use strict';var Sequelize=require(_0xea4d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xea4d('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xea4d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xea4d('0x3')](_0xea4d('0x4'),_0xea4d('0x5'),_0xea4d('0x6'))},'description':{'type':Sequelize[_0xea4d('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index f6aecc0..eea971a 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 _0xb745=['redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','send','index','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','WhatsappQueue','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','sort','pick','findAll','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','getTeams','Team','online','interface','flatMap','Agents','transaction','addTeams','forEach','emit','userWhatsappQueue:save','removeTeams','ids','User','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','union','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util'];(function(_0x1620f5,_0xcf5340){var _0x4017fe=function(_0xcfad40){while(--_0xcfad40){_0x1620f5['push'](_0x1620f5['shift']());}};_0x4017fe(++_0xcf5340);}(_0xb745,0x194));var _0x5b74=function(_0x433b93,_0x40db4f){_0x433b93=_0x433b93-0x0;var _0x116edd=_0xb745[_0x433b93];return _0x116edd;};'use strict';var emlformat=require(_0x5b74('0x0'));var rimraf=require(_0x5b74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b74('0x2'));var rp=require('request-promise');var moment=require(_0x5b74('0x3'));var BPromise=require(_0x5b74('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5b74('0x5'));var sox=require(_0x5b74('0x6'));var csv=require(_0x5b74('0x7'));var ejs=require(_0x5b74('0x8'));var fs=require('fs');var fs_extra=require(_0x5b74('0x9'));var _=require(_0x5b74('0xa'));var squel=require(_0x5b74('0xb'));var crypto=require(_0x5b74('0xc'));var jsforce=require(_0x5b74('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b74('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5b74('0xf'));var qs=require(_0x5b74('0x10'));var as=require(_0x5b74('0x11'));var hardwareService=require(_0x5b74('0x12'));var logger=require(_0x5b74('0x13'))(_0x5b74('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5b74('0x15'));var db=require('../../mysqldb')['db'];config[_0x5b74('0x16')]=_[_0x5b74('0x17')](config[_0x5b74('0x16')],{'host':_0x5b74('0x18'),'port':0x18eb});var socket=require(_0x5b74('0x19'))(new Redis(config[_0x5b74('0x16')]));require(_0x5b74('0x1a'))[_0x5b74('0x1b')](socket);function respondWithStatusCode(_0x483b15,_0x47e0f5){_0x47e0f5=_0x47e0f5||0xcc;return function(_0x2907ad){if(_0x2907ad){return _0x483b15['sendStatus'](_0x47e0f5);}return _0x483b15[_0x5b74('0x1c')](_0x47e0f5)[_0x5b74('0x1d')]();};}function respondWithResult(_0x3aaea7,_0x1c8ce2){_0x1c8ce2=_0x1c8ce2||0xc8;return function(_0x36a9e3){if(_0x36a9e3){return _0x3aaea7['status'](_0x1c8ce2)['json'](_0x36a9e3);}};}function respondWithFilteredResult(_0x4ebc4b,_0x2e5444){return function(_0x1e021d){if(_0x1e021d){var _0x4cd3f1=typeof _0x2e5444[_0x5b74('0x1e')]==='undefined'&&typeof _0x2e5444[_0x5b74('0x1f')]===_0x5b74('0x20');var _0x29e0d=_0x1e021d[_0x5b74('0x21')];var _0x1e2bff=_0x4cd3f1?0x0:_0x2e5444[_0x5b74('0x1e')];var _0x4313b2=_0x4cd3f1?_0x1e021d[_0x5b74('0x21')]:_0x2e5444[_0x5b74('0x1e')]+_0x2e5444[_0x5b74('0x1f')];var _0x6989c7;if(_0x4313b2>=_0x29e0d){_0x4313b2=_0x29e0d;_0x6989c7=0xc8;}else{_0x6989c7=0xce;}_0x4ebc4b[_0x5b74('0x1c')](_0x6989c7);return _0x4ebc4b[_0x5b74('0x22')](_0x5b74('0x23'),_0x1e2bff+'-'+_0x4313b2+'/'+_0x29e0d)[_0x5b74('0x24')](_0x1e021d);}return null;};}function patchUpdates(_0x33865b){return function(_0x53576d){try{jsonpatch[_0x5b74('0x25')](_0x53576d,_0x33865b,!![]);}catch(_0x502d9c){return BPromise[_0x5b74('0x26')](_0x502d9c);}return _0x53576d[_0x5b74('0x27')]();};}function saveUpdates(_0x43db2c,_0x37b311){return function(_0x185d89){if(_0x185d89){return _0x185d89[_0x5b74('0x28')](_0x43db2c)['then'](function(_0x1c3e43){return _0x1c3e43;});}return null;};}function removeEntity(_0x2e10d5,_0xf02a3c){return function(_0x5a4f9f){if(_0x5a4f9f){return _0x5a4f9f[_0x5b74('0x29')]()[_0x5b74('0x2a')](function(){var _0x19568f=_0x5a4f9f[_0x5b74('0x2b')]({'plain':!![]});var _0x15389f=_0x5b74('0x2c');return db[_0x5b74('0x2d')][_0x5b74('0x29')]({'where':{'type':_0x15389f,'resourceId':_0x19568f['id']}})[_0x5b74('0x2a')](function(){return _0x5a4f9f;});})[_0x5b74('0x2a')](function(){_0x2e10d5[_0x5b74('0x1c')](0xcc)[_0x5b74('0x1d')]();});}};}function handleEntityNotFound(_0x67d6ad,_0x5a2700){return function(_0x174f80){if(!_0x174f80){_0x67d6ad[_0x5b74('0x2e')](0x194);}return _0x174f80;};}function handleError(_0x4aba1c,_0x7a007e){_0x7a007e=_0x7a007e||0x1f4;return function(_0x3a0163){logger[_0x5b74('0x2f')](_0x3a0163[_0x5b74('0x30')]);if(_0x3a0163[_0x5b74('0x31')]){delete _0x3a0163['name'];}_0x4aba1c['status'](_0x7a007e)[_0x5b74('0x32')](_0x3a0163);};}exports[_0x5b74('0x33')]=function(_0xac7407,_0xc76dc1){var _0x3c5aa7={},_0x538d40={},_0x2db132={'count':0x0,'rows':[]};var _0x4ca8a3=_['map'](db['WhatsappQueue']['rawAttributes'],function(_0x268b20){return{'name':_0x268b20[_0x5b74('0x34')],'type':_0x268b20[_0x5b74('0x35')][_0x5b74('0x36')]};});_0x538d40['model']=_[_0x5b74('0x37')](_0x4ca8a3,_0x5b74('0x31'));_0x538d40['query']=_['keys'](_0xac7407[_0x5b74('0x38')]);_0x538d40[_0x5b74('0x39')]=_[_0x5b74('0x3a')](_0x538d40[_0x5b74('0x3b')],_0x538d40['query']);_0x3c5aa7[_0x5b74('0x3c')]=_[_0x5b74('0x3a')](_0x538d40['model'],qs[_0x5b74('0x3d')](_0xac7407[_0x5b74('0x38')][_0x5b74('0x3d')]));_0x3c5aa7['attributes']=_0x3c5aa7[_0x5b74('0x3c')][_0x5b74('0x3e')]?_0x3c5aa7[_0x5b74('0x3c')]:_0x538d40[_0x5b74('0x3b')];if(!_0xac7407[_0x5b74('0x38')][_0x5b74('0x3f')](_0x5b74('0x40'))){_0x3c5aa7[_0x5b74('0x1f')]=qs['limit'](_0xac7407['query'][_0x5b74('0x1f')]);_0x3c5aa7['offset']=qs[_0x5b74('0x1e')](_0xac7407['query'][_0x5b74('0x1e')]);}_0x3c5aa7[_0x5b74('0x41')]=qs['sort'](_0xac7407['query']['sort']);_0x3c5aa7[_0x5b74('0x42')]=qs[_0x5b74('0x39')](_['pick'](_0xac7407[_0x5b74('0x38')],_0x538d40[_0x5b74('0x39')]),_0x4ca8a3);if(_0xac7407[_0x5b74('0x38')][_0x5b74('0x43')]){_0x3c5aa7[_0x5b74('0x42')]=_[_0x5b74('0x44')](_0x3c5aa7[_0x5b74('0x42')],{'$or':_[_0x5b74('0x37')](_0x4ca8a3,function(_0x35307a){if(_0x35307a[_0x5b74('0x35')]!==_0x5b74('0x45')){var _0x45c462={};_0x45c462[_0x35307a[_0x5b74('0x31')]]={'$like':'%'+_0xac7407[_0x5b74('0x38')]['filter']+'%'};return _0x45c462;}})});}_0x3c5aa7=_[_0x5b74('0x44')]({},_0x3c5aa7,_0xac7407[_0x5b74('0x46')]);var _0x50beb4={'where':_0x3c5aa7[_0x5b74('0x42')]};return db[_0x5b74('0x47')][_0x5b74('0x21')](_0x50beb4)[_0x5b74('0x2a')](function(_0x25a16c){_0x2db132[_0x5b74('0x21')]=_0x25a16c;if(_0xac7407[_0x5b74('0x38')][_0x5b74('0x48')]){_0x3c5aa7[_0x5b74('0x49')]=[{'all':!![]}];}return db[_0x5b74('0x47')]['findAll'](_0x3c5aa7);})['then'](function(_0x556a9b){_0x2db132[_0x5b74('0x4a')]=_0x556a9b;return _0x2db132;})[_0x5b74('0x2a')](respondWithFilteredResult(_0xc76dc1,_0x3c5aa7))[_0x5b74('0x4b')](handleError(_0xc76dc1,null));};exports[_0x5b74('0x4c')]=function(_0x4b7331,_0xbc098d){var _0x1c439d={'raw':!![],'where':{'id':_0x4b7331[_0x5b74('0x4d')]['id']}},_0x2d243a={};_0x2d243a[_0x5b74('0x3b')]=_[_0x5b74('0x4e')](db[_0x5b74('0x47')][_0x5b74('0x4f')]);_0x2d243a[_0x5b74('0x38')]=_['keys'](_0x4b7331[_0x5b74('0x38')]);_0x2d243a[_0x5b74('0x39')]=_[_0x5b74('0x3a')](_0x2d243a[_0x5b74('0x3b')],_0x2d243a[_0x5b74('0x38')]);_0x1c439d[_0x5b74('0x3c')]=_[_0x5b74('0x3a')](_0x2d243a[_0x5b74('0x3b')],qs[_0x5b74('0x3d')](_0x4b7331[_0x5b74('0x38')][_0x5b74('0x3d')]));_0x1c439d[_0x5b74('0x3c')]=_0x1c439d['attributes'][_0x5b74('0x3e')]?_0x1c439d[_0x5b74('0x3c')]:_0x2d243a[_0x5b74('0x3b')];if(_0x4b7331[_0x5b74('0x38')][_0x5b74('0x48')]){_0x1c439d['include']=[{'all':!![]}];}_0x1c439d=_[_0x5b74('0x44')]({},_0x1c439d,_0x4b7331[_0x5b74('0x46')]);return db[_0x5b74('0x47')][_0x5b74('0x50')](_0x1c439d)[_0x5b74('0x2a')](handleEntityNotFound(_0xbc098d,null))['then'](respondWithResult(_0xbc098d,null))[_0x5b74('0x4b')](handleError(_0xbc098d,null));};exports[_0x5b74('0x51')]=function(_0x1ea85b,_0x5bc772){return db[_0x5b74('0x47')][_0x5b74('0x51')](_0x1ea85b[_0x5b74('0x52')],{})['then'](function(_0x581bac){var _0x434c99=_0x1ea85b[_0x5b74('0x53')][_0x5b74('0x2b')]({'plain':!![]});if(!_0x434c99)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x434c99[_0x5b74('0x54')]===_0x5b74('0x53')){var _0x5bb83d=_0x581bac['get']({'plain':!![]});var _0x5d16b3=_0x5b74('0x2c');return db[_0x5b74('0x55')][_0x5b74('0x50')]({'where':{'name':_0x5d16b3,'userProfileId':_0x434c99[_0x5b74('0x56')]},'raw':!![]})[_0x5b74('0x2a')](function(_0x3ffca3){if(_0x3ffca3&&_0x3ffca3['autoAssociation']===0x0){return db[_0x5b74('0x2d')][_0x5b74('0x51')]({'name':_0x5bb83d[_0x5b74('0x31')],'resourceId':_0x5bb83d['id'],'type':_0x3ffca3[_0x5b74('0x31')],'sectionId':_0x3ffca3['id']},{})['then'](function(){return _0x581bac;});}else{return _0x581bac;}})['catch'](function(_0x14cbb0){logger[_0x5b74('0x2f')](_0x5b74('0x57'),_0x14cbb0);throw _0x14cbb0;});}return _0x581bac;})[_0x5b74('0x2a')](respondWithResult(_0x5bc772,0xc9))[_0x5b74('0x4b')](handleError(_0x5bc772,null));};exports[_0x5b74('0x28')]=function(_0x2687dc,_0x330610){if(_0x2687dc[_0x5b74('0x52')]['id']){delete _0x2687dc[_0x5b74('0x52')]['id'];}return db[_0x5b74('0x47')][_0x5b74('0x50')]({'where':{'id':_0x2687dc['params']['id']}})[_0x5b74('0x2a')](handleEntityNotFound(_0x330610,null))[_0x5b74('0x2a')](saveUpdates(_0x2687dc[_0x5b74('0x52')],null))[_0x5b74('0x2a')](respondWithResult(_0x330610,null))['catch'](handleError(_0x330610,null));};exports[_0x5b74('0x29')]=function(_0x4eb37a,_0x1b0ecd){return db[_0x5b74('0x47')][_0x5b74('0x50')]({'where':{'id':_0x4eb37a[_0x5b74('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1b0ecd,null))[_0x5b74('0x2a')](removeEntity(_0x1b0ecd,null))[_0x5b74('0x4b')](handleError(_0x1b0ecd,null));};exports[_0x5b74('0x58')]=function(_0x199f57,_0x537a96){return db[_0x5b74('0x47')][_0x5b74('0x58')]()[_0x5b74('0x2a')](respondWithResult(_0x537a96,null))[_0x5b74('0x4b')](handleError(_0x537a96,null));};exports[_0x5b74('0x59')]=function(_0x56cd74,_0x157e83,_0x12ff39){var _0x3bdf39={'raw':!![],'where':{}},_0x194998={},_0x4da78e;return db[_0x5b74('0x47')][_0x5b74('0x5a')]({'where':{'id':_0x56cd74['params']['id']}})[_0x5b74('0x2a')](handleEntityNotFound(_0x157e83,null))[_0x5b74('0x2a')](function(_0xe0ee73){if(_0xe0ee73){_0x4da78e=_0xe0ee73[_0x5b74('0x2b')]({'plain':!![]});_0x194998[_0x5b74('0x3b')]=_[_0x5b74('0x4e')](db[_0x5b74('0x5b')]['rawAttributes']);_0x194998[_0x5b74('0x38')]=_[_0x5b74('0x4e')](_0x56cd74[_0x5b74('0x38')]);_0x194998[_0x5b74('0x39')]=_['intersection'](_0x194998[_0x5b74('0x3b')],_0x194998[_0x5b74('0x38')]);_0x3bdf39[_0x5b74('0x3c')]=_[_0x5b74('0x3a')](_0x194998[_0x5b74('0x3b')],qs[_0x5b74('0x3d')](_0x56cd74[_0x5b74('0x38')][_0x5b74('0x3d')]));_0x3bdf39['attributes']=_0x3bdf39[_0x5b74('0x3c')]['length']?_0x3bdf39[_0x5b74('0x3c')]:_0x194998['model'];if(!_0x56cd74[_0x5b74('0x38')][_0x5b74('0x3f')](_0x5b74('0x40'))){_0x3bdf39[_0x5b74('0x1f')]=qs[_0x5b74('0x1f')](_0x56cd74[_0x5b74('0x38')][_0x5b74('0x1f')]);_0x3bdf39[_0x5b74('0x1e')]=qs[_0x5b74('0x1e')](_0x56cd74[_0x5b74('0x38')][_0x5b74('0x1e')]);}_0x3bdf39[_0x5b74('0x41')]=qs[_0x5b74('0x5c')](_0x56cd74[_0x5b74('0x38')][_0x5b74('0x5c')]);_0x3bdf39['where']=qs[_0x5b74('0x39')](_[_0x5b74('0x5d')](_0x56cd74[_0x5b74('0x38')],_0x194998[_0x5b74('0x39')]));_0x3bdf39[_0x5b74('0x42')]['WhatsappQueueId']=_0xe0ee73['id'];if(_0x56cd74[_0x5b74('0x38')][_0x5b74('0x43')]){_0x3bdf39[_0x5b74('0x42')]=_[_0x5b74('0x44')](_0x3bdf39[_0x5b74('0x42')],{'$or':_[_0x5b74('0x37')](_0x3bdf39[_0x5b74('0x3c')],function(_0x481bae){var _0x54beff={};_0x54beff[_0x481bae]={'$like':'%'+_0x56cd74['query']['filter']+'%'};return _0x54beff;})});}_0x3bdf39=_[_0x5b74('0x44')]({},_0x3bdf39,_0x56cd74['options']);return db['UserWhatsappQueue'][_0x5b74('0x5e')](_0x3bdf39);}})['then'](function(_0x1178ef){if(_0x1178ef){return db['User'][_0x5b74('0x5f')]({'where':{'id':_[_0x5b74('0x37')](_0x1178ef,_0x5b74('0x60')),'role':_0x5b74('0x61')},'attributes':['id',_0x5b74('0x31'),'whatsappPause',_0x5b74('0x62'),_0x5b74('0x63')]});}})[_0x5b74('0x2a')](function(_0x48f409){if(_0x48f409){return{'count':_0x48f409[_0x5b74('0x21')],'rows':_['map'](_0x48f409[_0x5b74('0x4a')],function(_0x1a1dbe){return{'membername':_0x1a1dbe['name'],'UserId':_0x1a1dbe['id'],'queue_name':_0x4da78e[_0x5b74('0x31')],'WhatsappQueueId':_0x4da78e['id'],'interface':util[_0x5b74('0x64')](_0x5b74('0x65'),_0x5b74('0x66'),_0x1a1dbe[_0x5b74('0x31')]),'penalty':0x0,'paused':_0x1a1dbe[_0x5b74('0x67')],'createdAt':_0x1a1dbe[_0x5b74('0x63')],'updatedAt':_0x1a1dbe[_0x5b74('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5b74('0x2a')](respondWithFilteredResult(_0x157e83,_0x3bdf39))[_0x5b74('0x4b')](handleError(_0x157e83,null));};exports[_0x5b74('0x68')]=function(_0x3ce7e6,_0x5548b0,_0x3052d2){var _0x5e9132={};var _0x5ad3c6={};var _0x4843cd;var _0x8bb234;return db[_0x5b74('0x47')][_0x5b74('0x5a')]({'where':{'id':_0x3ce7e6['params']['id']}})[_0x5b74('0x2a')](handleEntityNotFound(_0x5548b0,null))['then'](function(_0x32b54b){if(_0x32b54b){_0x4843cd=_0x32b54b;_0x5ad3c6[_0x5b74('0x3b')]=_[_0x5b74('0x4e')](db[_0x5b74('0x69')][_0x5b74('0x4f')]);_0x5ad3c6[_0x5b74('0x38')]=_[_0x5b74('0x4e')](_0x3ce7e6['query']);_0x5ad3c6[_0x5b74('0x39')]=_['intersection'](_0x5ad3c6['model'],_0x5ad3c6['query']);_0x5e9132[_0x5b74('0x3c')]=_['intersection'](_0x5ad3c6['model'],qs['fields'](_0x3ce7e6['query']['fields']));_0x5e9132[_0x5b74('0x3c')]=_0x5e9132[_0x5b74('0x3c')][_0x5b74('0x3e')]?_0x5e9132['attributes']:_0x5ad3c6[_0x5b74('0x3b')];_0x5e9132[_0x5b74('0x41')]=qs[_0x5b74('0x5c')](_0x3ce7e6['query']['sort']);_0x5e9132[_0x5b74('0x42')]=qs[_0x5b74('0x39')](_[_0x5b74('0x5d')](_0x3ce7e6[_0x5b74('0x38')],_0x5ad3c6[_0x5b74('0x39')]));if(_0x3ce7e6[_0x5b74('0x38')]['filter']){_0x5e9132['where']=_[_0x5b74('0x44')](_0x5e9132[_0x5b74('0x42')],{'$or':_[_0x5b74('0x37')](_0x5e9132['attributes'],function(_0x5770c3){var _0x3fc354={};_0x3fc354[_0x5770c3]={'$like':'%'+_0x3ce7e6[_0x5b74('0x38')]['filter']+'%'};return _0x3fc354;})});}_0x5e9132=_['merge']({},_0x5e9132,_0x3ce7e6[_0x5b74('0x46')]);return _0x4843cd[_0x5b74('0x68')](_0x5e9132);}})[_0x5b74('0x2a')](function(_0x3c1b3f){if(_0x3c1b3f){_0x8bb234=_0x3c1b3f[_0x5b74('0x3e')];if(!_0x3ce7e6[_0x5b74('0x38')][_0x5b74('0x3f')](_0x5b74('0x40'))){_0x5e9132[_0x5b74('0x1f')]=qs[_0x5b74('0x1f')](_0x3ce7e6['query'][_0x5b74('0x1f')]);_0x5e9132[_0x5b74('0x1e')]=qs[_0x5b74('0x1e')](_0x3ce7e6[_0x5b74('0x38')]['offset']);}return _0x4843cd[_0x5b74('0x68')](_0x5e9132);}})[_0x5b74('0x2a')](function(_0x508522){if(_0x508522){return _0x508522?{'count':_0x8bb234,'rows':_0x508522}:null;}})[_0x5b74('0x2a')](respondWithResult(_0x5548b0,null))[_0x5b74('0x4b')](handleError(_0x5548b0,null));};exports['addTeams']=function(_0x354487,_0x33a903,_0x117f8a){var _0x2a4c75=_0x354487[_0x5b74('0x52')]['ids'];return db[_0x5b74('0x69')][_0x5b74('0x5e')]({'where':{'id':_0x2a4c75},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x5b74('0x31'),_0x5b74('0x6a'),'voicePause',_0x5b74('0x6b')],'raw':!![]}]})[_0x5b74('0x2a')](function(_0x2a8647){if(_0x2a8647){var _0x99b20f=_[_0x5b74('0x6c')](_0x2a8647,function(_0x1f3d50){var _0x442fe7=_0x1f3d50['get']({'plain':!![]});return _0x442fe7[_0x5b74('0x6d')];});return db[_0x5b74('0x47')]['find']({'where':{'id':_0x354487[_0x5b74('0x4d')]['id']}})[_0x5b74('0x2a')](function(_0x241697){return db['sequelize'][_0x5b74('0x6e')](function(_0x63f44c){return _0x241697[_0x5b74('0x6f')](_0x2a4c75,{'transaction':_0x63f44c})[_0x5b74('0x2a')](function(){return BPromise['each'](_0x99b20f,function(_0x520969){return db[_0x5b74('0x5b')]['findOrCreate']({'where':{'UserId':_0x520969['id'],'WhatsappQueueId':_0x354487[_0x5b74('0x4d')]['id']},'transaction':_0x63f44c});});})['then'](function(){_0x99b20f[_0x5b74('0x70')](function(_0x42d294){socket[_0x5b74('0x71')](_0x5b74('0x72'),{'UserId':_0x42d294['id'],'WhatsappQueueId':_0x241697['id']});});});});});}})['then'](respondWithStatusCode(_0x33a903,null))[_0x5b74('0x4b')](handleError(_0x33a903,null));};exports[_0x5b74('0x73')]=function(_0x2ee8da,_0x1731c7,_0x446a79){return db[_0x5b74('0x69')]['findAll']({'where':{'id':_0x2ee8da[_0x5b74('0x38')][_0x5b74('0x74')]},'attributes':['id'],'include':[{'model':db[_0x5b74('0x75')],'as':_0x5b74('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x5b74('0x2a')](handleEntityNotFound(_0x1731c7,null))[_0x5b74('0x2a')](function(_0x393ea9){var _0x1c5faa=_[_0x5b74('0x37')](_0x393ea9,'id');var _0x1e6dc7=[];var _0x5c9ec4=[];var _0x2ae638=squel[_0x5b74('0x76')]();_0x2ae638[_0x5b74('0x77')](_0x5b74('0x78'))[_0x5b74('0x79')]('team_has_whatsapp_queues','tq')[_0x5b74('0x7a')](_0x5b74('0x7b'),'ut',_0x5b74('0x7c'))[_0x5b74('0x42')]('WhatsappQueueId\x20=\x20?',_0x2ee8da[_0x5b74('0x4d')]['id']);for(var _0x366782=0x0;_0x366782<_0x393ea9[_0x5b74('0x3e')];_0x366782+=0x1){let _0x54244f=_0x393ea9[_0x366782];for(var _0x58ad09=0x0;_0x58ad09<_0x54244f['Agents'][_0x5b74('0x3e')];_0x58ad09+=0x1){let _0x416730=_0x54244f[_0x5b74('0x6d')][_0x58ad09];var _0x2c2bfd=_0x2ae638[_0x5b74('0x7d')]();_0x2c2bfd[_0x5b74('0x42')](_0x5b74('0x7e'),_0x416730['id']);_0x5c9ec4[_0x5b74('0x7f')](db['sequelize']['query'](_0x2c2bfd['toString'](),{'type':db[_0x5b74('0x80')][_0x5b74('0x81')][_0x5b74('0x82')]})['then'](function(_0x2e24ed){if(_0x2e24ed[_0x5b74('0x3e')]===0x1){return _0x416730['id'];}else{var _0x3dac59=_[_0x5b74('0x83')](_[_0x5b74('0x37')](_0x2e24ed,_0x5b74('0x84')),function(_0x943bdc){return _[_0x5b74('0x85')](_0x1c5faa,_0x943bdc);});if(_0x3dac59){return _0x416730['id'];}}}));}}return BPromise['all'](_0x5c9ec4)[_0x5b74('0x2a')](function(_0x49bdde){_0x1e6dc7=_(_0x1e6dc7)[_0x5b74('0x86')](_0x49bdde)['compact']()[_0x5b74('0x87')]();return db[_0x5b74('0x47')]['find']({'where':{'id':_0x2ee8da[_0x5b74('0x4d')]['id']}})[_0x5b74('0x2a')](function(_0x5208ae){return db['sequelize'][_0x5b74('0x6e')](function(_0x4c710d){return _0x5208ae[_0x5b74('0x73')](_0x2ee8da[_0x5b74('0x38')][_0x5b74('0x74')],{'transaction':_0x4c710d})[_0x5b74('0x2a')](function(){if(!_[_0x5b74('0x88')](_0x1e6dc7)){return _0x5208ae[_0x5b74('0x89')](_0x1e6dc7,{'transaction':_0x4c710d});}})['then'](function(){_0x1e6dc7[_0x5b74('0x70')](function(_0x591952){socket[_0x5b74('0x71')](_0x5b74('0x8a'),{'UserId':_0x591952,'WhatsappQueueId':_0x5208ae['id']});});});});});});})[_0x5b74('0x2a')](respondWithStatusCode(_0x1731c7,null))[_0x5b74('0x4b')](handleError(_0x1731c7,null));};exports[_0x5b74('0x8b')]=function(_0x72bbc,_0x327859,_0xbe132){return db[_0x5b74('0x47')][_0x5b74('0x50')]({'where':{'id':_0x72bbc[_0x5b74('0x4d')]['id']}})[_0x5b74('0x2a')](handleEntityNotFound(_0x327859,null))[_0x5b74('0x2a')](function(_0x1282f7){if(_0x1282f7){return _0x1282f7['addAgents'](_0x72bbc[_0x5b74('0x52')]['ids'],_['omit'](_0x72bbc[_0x5b74('0x52')],[_0x5b74('0x74'),'id'])||{})[_0x5b74('0x8c')](function(_0x57d00e){for(var _0x362f7e=0x0;_0x362f7e<_0x72bbc[_0x5b74('0x52')][_0x5b74('0x74')]['length'];_0x362f7e+=0x1){socket[_0x5b74('0x71')](_0x5b74('0x72'),{'UserId':Number(_0x72bbc['body'][_0x5b74('0x74')][_0x362f7e]),'WhatsappQueueId':Number(_0x72bbc[_0x5b74('0x4d')]['id'])});}return _0x57d00e;});}})[_0x5b74('0x2a')](respondWithResult(_0x327859,null))[_0x5b74('0x4b')](handleError(_0x327859,null));};exports[_0x5b74('0x89')]=function(_0x436720,_0x35eb73,_0x24d255){return db[_0x5b74('0x47')][_0x5b74('0x50')]({'where':{'id':_0x436720['params']['id']}})[_0x5b74('0x2a')](handleEntityNotFound(_0x35eb73,null))[_0x5b74('0x2a')](function(_0xe19dc0){if(_0xe19dc0){return _0xe19dc0['removeAgents'](_0x436720[_0x5b74('0x38')]['ids'])['then'](function(){if(_['isArray'](_0x436720[_0x5b74('0x38')][_0x5b74('0x74')])){for(var _0x2c229a=0x0;_0x2c229a<_0x436720[_0x5b74('0x38')][_0x5b74('0x74')][_0x5b74('0x3e')];_0x2c229a+=0x1){socket[_0x5b74('0x71')](_0x5b74('0x8a'),{'UserId':Number(_0x436720[_0x5b74('0x38')][_0x5b74('0x74')][_0x2c229a]),'WhatsappQueueId':Number(_0x436720[_0x5b74('0x4d')]['id'])});}}else{socket[_0x5b74('0x71')](_0x5b74('0x8a'),{'UserId':Number(_0x436720[_0x5b74('0x38')]['ids']),'WhatsappQueueId':Number(_0x436720[_0x5b74('0x4d')]['id'])});}});}})[_0x5b74('0x2a')](respondWithStatusCode(_0x35eb73,null))[_0x5b74('0x4b')](handleError(_0x35eb73,null));};exports[_0x5b74('0x8d')]=function(_0x51c824,_0x26fbaf,_0x4270cc){var _0x5f46dd={};var _0x46d727={};var _0x48dbe3;var _0xf94f16;return db[_0x5b74('0x47')]['findOne']({'where':{'id':_0x51c824[_0x5b74('0x4d')]['id']}})[_0x5b74('0x2a')](handleEntityNotFound(_0x26fbaf,null))[_0x5b74('0x2a')](function(_0x3ed2f4){if(_0x3ed2f4){_0x48dbe3=_0x3ed2f4;_0x46d727[_0x5b74('0x3b')]=_[_0x5b74('0x4e')](db['User']['rawAttributes']);_0x46d727[_0x5b74('0x38')]=_['keys'](_0x51c824[_0x5b74('0x38')]);_0x46d727[_0x5b74('0x39')]=_[_0x5b74('0x3a')](_0x46d727[_0x5b74('0x3b')],_0x46d727[_0x5b74('0x38')]);_0x5f46dd['attributes']=_[_0x5b74('0x3a')](_0x46d727[_0x5b74('0x3b')],qs[_0x5b74('0x3d')](_0x51c824[_0x5b74('0x38')][_0x5b74('0x3d')]));_0x5f46dd['attributes']=_0x5f46dd['attributes'][_0x5b74('0x3e')]?_0x5f46dd[_0x5b74('0x3c')]:_0x46d727[_0x5b74('0x3b')];_0x5f46dd[_0x5b74('0x41')]=qs['sort'](_0x51c824[_0x5b74('0x38')]['sort']);_0x5f46dd['where']=qs[_0x5b74('0x39')](_[_0x5b74('0x5d')](_0x51c824[_0x5b74('0x38')],_0x46d727[_0x5b74('0x39')]));if(_0x51c824[_0x5b74('0x38')][_0x5b74('0x43')]){_0x5f46dd[_0x5b74('0x42')]=_[_0x5b74('0x44')](_0x5f46dd[_0x5b74('0x42')],{'$or':_[_0x5b74('0x37')](_0x5f46dd[_0x5b74('0x3c')],function(_0x186614){var _0x1bc6e3={};_0x1bc6e3[_0x186614]={'$like':'%'+_0x51c824[_0x5b74('0x38')][_0x5b74('0x43')]+'%'};return _0x1bc6e3;})});}_0x5f46dd=_[_0x5b74('0x44')]({},_0x5f46dd,_0x51c824[_0x5b74('0x46')]);return _0x48dbe3[_0x5b74('0x8d')](_0x5f46dd);}})[_0x5b74('0x2a')](function(_0x282a99){if(_0x282a99){_0xf94f16=_0x282a99[_0x5b74('0x3e')];if(!_0x51c824[_0x5b74('0x38')][_0x5b74('0x3f')](_0x5b74('0x40'))){_0x5f46dd[_0x5b74('0x1f')]=qs['limit'](_0x51c824[_0x5b74('0x38')][_0x5b74('0x1f')]);_0x5f46dd[_0x5b74('0x1e')]=qs[_0x5b74('0x1e')](_0x51c824[_0x5b74('0x38')][_0x5b74('0x1e')]);}return _0x48dbe3['getAgents'](_0x5f46dd);}})[_0x5b74('0x2a')](function(_0x4302d5){if(_0x4302d5){return _0x4302d5?{'count':_0xf94f16,'rows':_0x4302d5}:null;}})['then'](respondWithResult(_0x26fbaf,null))[_0x5b74('0x4b')](handleError(_0x26fbaf,null));}; \ No newline at end of file +var _0x1aba=['from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','value','isEmpty','emit','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','status','json','limit','undefined','offset','count','set','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','error','name','send','index','WhatsappQueue','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','describe','UserWhatsappQueue','length','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','params','Team','ids','Agents','online','interface','flatMap','sequelize','transaction','addTeams','forEach','userWhatsappQueue:save','removeTeams','field'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x1aba,0x1bc));var _0xa1ab=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1aba[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xa1ab('0x0'));var rimraf=require(_0xa1ab('0x1'));var zipdir=require(_0xa1ab('0x2'));var jsonpatch=require(_0xa1ab('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1ab('0x4'));var Mustache=require('mustache');var util=require(_0xa1ab('0x5'));var path=require(_0xa1ab('0x6'));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(_0xa1ab('0x7'));var squel=require(_0xa1ab('0x8'));var crypto=require(_0xa1ab('0x9'));var jsforce=require(_0xa1ab('0xa'));var deskjs=require(_0xa1ab('0xb'));var toCsv=require(_0xa1ab('0xc'));var querystring=require(_0xa1ab('0xd'));var Papa=require(_0xa1ab('0xe'));var Redis=require('ioredis');var authService=require(_0xa1ab('0xf'));var qs=require(_0xa1ab('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1ab('0x11'))(_0xa1ab('0x12'));var utils=require(_0xa1ab('0x13'));var config=require(_0xa1ab('0x14'));var licenseUtil=require(_0xa1ab('0x15'));var db=require(_0xa1ab('0x16'))['db'];config[_0xa1ab('0x17')]=_[_0xa1ab('0x18')](config[_0xa1ab('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa1ab('0x19'))(new Redis(config[_0xa1ab('0x17')]));require(_0xa1ab('0x1a'))[_0xa1ab('0x1b')](socket);function respondWithStatusCode(_0x187bf4,_0x5735fd){_0x5735fd=_0x5735fd||0xcc;return function(_0x2fb50c){if(_0x2fb50c){return _0x187bf4['sendStatus'](_0x5735fd);}return _0x187bf4['status'](_0x5735fd)['end']();};}function respondWithResult(_0x8a05c3,_0x487e67){_0x487e67=_0x487e67||0xc8;return function(_0x4c81d7){if(_0x4c81d7){return _0x8a05c3[_0xa1ab('0x1c')](_0x487e67)[_0xa1ab('0x1d')](_0x4c81d7);}};}function respondWithFilteredResult(_0x5b2b60,_0x5f119c){return function(_0x138be1){if(_0x138be1){var _0xed7124=typeof _0x5f119c['offset']==='undefined'&&typeof _0x5f119c[_0xa1ab('0x1e')]===_0xa1ab('0x1f');var _0x3a1534=_0x138be1['count'];var _0x4084af=_0xed7124?0x0:_0x5f119c[_0xa1ab('0x20')];var _0xa4587d=_0xed7124?_0x138be1[_0xa1ab('0x21')]:_0x5f119c[_0xa1ab('0x20')]+_0x5f119c[_0xa1ab('0x1e')];var _0x459970;if(_0xa4587d>=_0x3a1534){_0xa4587d=_0x3a1534;_0x459970=0xc8;}else{_0x459970=0xce;}_0x5b2b60[_0xa1ab('0x1c')](_0x459970);return _0x5b2b60[_0xa1ab('0x22')]('Content-Range',_0x4084af+'-'+_0xa4587d+'/'+_0x3a1534)[_0xa1ab('0x1d')](_0x138be1);}return null;};}function patchUpdates(_0x416cf0){return function(_0x596ecf){try{jsonpatch[_0xa1ab('0x23')](_0x596ecf,_0x416cf0,!![]);}catch(_0x2edbd8){return BPromise[_0xa1ab('0x24')](_0x2edbd8);}return _0x596ecf[_0xa1ab('0x25')]();};}function saveUpdates(_0xffd3f3,_0x40e2a9){return function(_0x4cc6bc){if(_0x4cc6bc){return _0x4cc6bc[_0xa1ab('0x26')](_0xffd3f3)['then'](function(_0x14131e){return _0x14131e;});}return null;};}function removeEntity(_0x10e694,_0xf98cbd){return function(_0x27c8bc){if(_0x27c8bc){return _0x27c8bc[_0xa1ab('0x27')]()[_0xa1ab('0x28')](function(){var _0x23c39e=_0x27c8bc[_0xa1ab('0x29')]({'plain':!![]});var _0x4d6ee4='WhatsappQueues';return db[_0xa1ab('0x2a')][_0xa1ab('0x27')]({'where':{'type':_0x4d6ee4,'resourceId':_0x23c39e['id']}})[_0xa1ab('0x28')](function(){return _0x27c8bc;});})['then'](function(){_0x10e694[_0xa1ab('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x596647,_0x5655d5){return function(_0x18da40){if(!_0x18da40){_0x596647[_0xa1ab('0x2b')](0x194);}return _0x18da40;};}function handleError(_0x633556,_0x135463){_0x135463=_0x135463||0x1f4;return function(_0x34d20d){logger[_0xa1ab('0x2c')](_0x34d20d['stack']);if(_0x34d20d[_0xa1ab('0x2d')]){delete _0x34d20d[_0xa1ab('0x2d')];}_0x633556[_0xa1ab('0x1c')](_0x135463)[_0xa1ab('0x2e')](_0x34d20d);};}exports[_0xa1ab('0x2f')]=function(_0x582c45,_0x10b170){var _0x22085b={},_0x341ac={},_0x5d94d0={'count':0x0,'rows':[]};var _0x4325d9=_['map'](db[_0xa1ab('0x30')][_0xa1ab('0x31')],function(_0x532cb5){return{'name':_0x532cb5[_0xa1ab('0x32')],'type':_0x532cb5['type'][_0xa1ab('0x33')]};});_0x341ac[_0xa1ab('0x34')]=_[_0xa1ab('0x35')](_0x4325d9,_0xa1ab('0x2d'));_0x341ac[_0xa1ab('0x36')]=_[_0xa1ab('0x37')](_0x582c45[_0xa1ab('0x36')]);_0x341ac['filters']=_[_0xa1ab('0x38')](_0x341ac[_0xa1ab('0x34')],_0x341ac['query']);_0x22085b[_0xa1ab('0x39')]=_[_0xa1ab('0x38')](_0x341ac['model'],qs['fields'](_0x582c45[_0xa1ab('0x36')]['fields']));_0x22085b['attributes']=_0x22085b['attributes']['length']?_0x22085b[_0xa1ab('0x39')]:_0x341ac[_0xa1ab('0x34')];if(!_0x582c45[_0xa1ab('0x36')][_0xa1ab('0x3a')](_0xa1ab('0x3b'))){_0x22085b['limit']=qs[_0xa1ab('0x1e')](_0x582c45[_0xa1ab('0x36')][_0xa1ab('0x1e')]);_0x22085b[_0xa1ab('0x20')]=qs['offset'](_0x582c45['query']['offset']);}_0x22085b[_0xa1ab('0x3c')]=qs[_0xa1ab('0x3d')](_0x582c45['query']['sort']);_0x22085b['where']=qs[_0xa1ab('0x3e')](_[_0xa1ab('0x3f')](_0x582c45[_0xa1ab('0x36')],_0x341ac['filters']),_0x4325d9);if(_0x582c45['query'][_0xa1ab('0x40')]){_0x22085b[_0xa1ab('0x41')]=_[_0xa1ab('0x42')](_0x22085b[_0xa1ab('0x41')],{'$or':_[_0xa1ab('0x35')](_0x4325d9,function(_0x4ef988){if(_0x4ef988['type']!==_0xa1ab('0x43')){var _0x196357={};_0x196357[_0x4ef988['name']]={'$like':'%'+_0x582c45[_0xa1ab('0x36')][_0xa1ab('0x40')]+'%'};return _0x196357;}})});}_0x22085b=_[_0xa1ab('0x42')]({},_0x22085b,_0x582c45[_0xa1ab('0x44')]);var _0x11f6dc={'where':_0x22085b[_0xa1ab('0x41')]};return db['WhatsappQueue'][_0xa1ab('0x21')](_0x11f6dc)[_0xa1ab('0x28')](function(_0x2f4289){_0x5d94d0['count']=_0x2f4289;if(_0x582c45[_0xa1ab('0x36')][_0xa1ab('0x45')]){_0x22085b[_0xa1ab('0x46')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xa1ab('0x47')](_0x22085b);})[_0xa1ab('0x28')](function(_0x2ba3ad){_0x5d94d0[_0xa1ab('0x48')]=_0x2ba3ad;return _0x5d94d0;})['then'](respondWithFilteredResult(_0x10b170,_0x22085b))[_0xa1ab('0x49')](handleError(_0x10b170,null));};exports[_0xa1ab('0x4a')]=function(_0x5d7858,_0x28cfb7){var _0x32f066={'raw':!![],'where':{'id':_0x5d7858['params']['id']}},_0x1eeeef={};_0x1eeeef[_0xa1ab('0x34')]=_[_0xa1ab('0x37')](db[_0xa1ab('0x30')]['rawAttributes']);_0x1eeeef['query']=_[_0xa1ab('0x37')](_0x5d7858['query']);_0x1eeeef[_0xa1ab('0x3e')]=_['intersection'](_0x1eeeef[_0xa1ab('0x34')],_0x1eeeef[_0xa1ab('0x36')]);_0x32f066[_0xa1ab('0x39')]=_[_0xa1ab('0x38')](_0x1eeeef[_0xa1ab('0x34')],qs[_0xa1ab('0x4b')](_0x5d7858[_0xa1ab('0x36')][_0xa1ab('0x4b')]));_0x32f066[_0xa1ab('0x39')]=_0x32f066[_0xa1ab('0x39')]['length']?_0x32f066[_0xa1ab('0x39')]:_0x1eeeef[_0xa1ab('0x34')];if(_0x5d7858[_0xa1ab('0x36')][_0xa1ab('0x45')]){_0x32f066[_0xa1ab('0x46')]=[{'all':!![]}];}_0x32f066=_['merge']({},_0x32f066,_0x5d7858[_0xa1ab('0x44')]);return db[_0xa1ab('0x30')][_0xa1ab('0x4c')](_0x32f066)[_0xa1ab('0x28')](handleEntityNotFound(_0x28cfb7,null))['then'](respondWithResult(_0x28cfb7,null))['catch'](handleError(_0x28cfb7,null));};exports[_0xa1ab('0x4d')]=function(_0x325dfb,_0x2094c0){return db[_0xa1ab('0x30')][_0xa1ab('0x4d')](_0x325dfb[_0xa1ab('0x4e')],{})[_0xa1ab('0x28')](function(_0x50e8a3){var _0x38c55b=_0x325dfb[_0xa1ab('0x4f')][_0xa1ab('0x29')]({'plain':!![]});if(!_0x38c55b)throw new Error(_0xa1ab('0x50'));if(_0x38c55b[_0xa1ab('0x51')]==='user'){var _0x3a5153=_0x50e8a3[_0xa1ab('0x29')]({'plain':!![]});var _0x2c8dd5=_0xa1ab('0x52');return db[_0xa1ab('0x53')]['find']({'where':{'name':_0x2c8dd5,'userProfileId':_0x38c55b[_0xa1ab('0x54')]},'raw':!![]})['then'](function(_0x4a3e46){if(_0x4a3e46&&_0x4a3e46[_0xa1ab('0x55')]===0x0){return db[_0xa1ab('0x2a')][_0xa1ab('0x4d')]({'name':_0x3a5153['name'],'resourceId':_0x3a5153['id'],'type':_0x4a3e46['name'],'sectionId':_0x4a3e46['id']},{})[_0xa1ab('0x28')](function(){return _0x50e8a3;});}else{return _0x50e8a3;}})[_0xa1ab('0x49')](function(_0x2217f1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2217f1);throw _0x2217f1;});}return _0x50e8a3;})[_0xa1ab('0x28')](respondWithResult(_0x2094c0,0xc9))[_0xa1ab('0x49')](handleError(_0x2094c0,null));};exports[_0xa1ab('0x26')]=function(_0x1bb986,_0x15ac43){if(_0x1bb986[_0xa1ab('0x4e')]['id']){delete _0x1bb986[_0xa1ab('0x4e')]['id'];}return db['WhatsappQueue'][_0xa1ab('0x4c')]({'where':{'id':_0x1bb986['params']['id']}})['then'](handleEntityNotFound(_0x15ac43,null))[_0xa1ab('0x28')](saveUpdates(_0x1bb986[_0xa1ab('0x4e')],null))['then'](respondWithResult(_0x15ac43,null))[_0xa1ab('0x49')](handleError(_0x15ac43,null));};exports[_0xa1ab('0x27')]=function(_0xf428d4,_0x44d30a){return db[_0xa1ab('0x30')][_0xa1ab('0x4c')]({'where':{'id':_0xf428d4['params']['id']}})['then'](handleEntityNotFound(_0x44d30a,null))[_0xa1ab('0x28')](removeEntity(_0x44d30a,null))[_0xa1ab('0x49')](handleError(_0x44d30a,null));};exports[_0xa1ab('0x56')]=function(_0x450dd6,_0x44d6de){return db[_0xa1ab('0x30')][_0xa1ab('0x56')]()[_0xa1ab('0x28')](respondWithResult(_0x44d6de,null))[_0xa1ab('0x49')](handleError(_0x44d6de,null));};exports['getMembers']=function(_0x29299c,_0x24a9b2,_0x2e3ece){var _0x1790c2={'raw':!![],'where':{}},_0x18b191={},_0x5eac0e;return db[_0xa1ab('0x30')]['findOne']({'where':{'id':_0x29299c['params']['id']}})['then'](handleEntityNotFound(_0x24a9b2,null))[_0xa1ab('0x28')](function(_0x5c78b7){if(_0x5c78b7){_0x5eac0e=_0x5c78b7['get']({'plain':!![]});_0x18b191['model']=_['keys'](db[_0xa1ab('0x57')]['rawAttributes']);_0x18b191[_0xa1ab('0x36')]=_['keys'](_0x29299c[_0xa1ab('0x36')]);_0x18b191[_0xa1ab('0x3e')]=_[_0xa1ab('0x38')](_0x18b191['model'],_0x18b191[_0xa1ab('0x36')]);_0x1790c2[_0xa1ab('0x39')]=_['intersection'](_0x18b191[_0xa1ab('0x34')],qs[_0xa1ab('0x4b')](_0x29299c['query'][_0xa1ab('0x4b')]));_0x1790c2[_0xa1ab('0x39')]=_0x1790c2['attributes'][_0xa1ab('0x58')]?_0x1790c2[_0xa1ab('0x39')]:_0x18b191[_0xa1ab('0x34')];if(!_0x29299c[_0xa1ab('0x36')][_0xa1ab('0x3a')](_0xa1ab('0x3b'))){_0x1790c2['limit']=qs[_0xa1ab('0x1e')](_0x29299c[_0xa1ab('0x36')]['limit']);_0x1790c2['offset']=qs[_0xa1ab('0x20')](_0x29299c['query']['offset']);}_0x1790c2[_0xa1ab('0x3c')]=qs[_0xa1ab('0x3d')](_0x29299c[_0xa1ab('0x36')]['sort']);_0x1790c2['where']=qs[_0xa1ab('0x3e')](_[_0xa1ab('0x3f')](_0x29299c[_0xa1ab('0x36')],_0x18b191[_0xa1ab('0x3e')]));_0x1790c2[_0xa1ab('0x41')][_0xa1ab('0x59')]=_0x5c78b7['id'];if(_0x29299c[_0xa1ab('0x36')][_0xa1ab('0x40')]){_0x1790c2[_0xa1ab('0x41')]=_['merge'](_0x1790c2[_0xa1ab('0x41')],{'$or':_[_0xa1ab('0x35')](_0x1790c2[_0xa1ab('0x39')],function(_0x3cde6e){var _0x4afa3c={};_0x4afa3c[_0x3cde6e]={'$like':'%'+_0x29299c[_0xa1ab('0x36')][_0xa1ab('0x40')]+'%'};return _0x4afa3c;})});}_0x1790c2=_[_0xa1ab('0x42')]({},_0x1790c2,_0x29299c[_0xa1ab('0x44')]);return db[_0xa1ab('0x57')]['findAll'](_0x1790c2);}})[_0xa1ab('0x28')](function(_0x1863f5){if(_0x1863f5){return db[_0xa1ab('0x5a')][_0xa1ab('0x5b')]({'where':{'id':_['map'](_0x1863f5,_0xa1ab('0x5c')),'role':_0xa1ab('0x5d')},'attributes':['id',_0xa1ab('0x2d'),_0xa1ab('0x5e'),_0xa1ab('0x5f'),_0xa1ab('0x60')]});}})[_0xa1ab('0x28')](function(_0x1cbd8e){if(_0x1cbd8e){return{'count':_0x1cbd8e[_0xa1ab('0x21')],'rows':_[_0xa1ab('0x35')](_0x1cbd8e[_0xa1ab('0x48')],function(_0xbbf6a4){return{'membername':_0xbbf6a4[_0xa1ab('0x2d')],'UserId':_0xbbf6a4['id'],'queue_name':_0x5eac0e['name'],'WhatsappQueueId':_0x5eac0e['id'],'interface':util[_0xa1ab('0x61')](_0xa1ab('0x62'),_0xa1ab('0x63'),_0xbbf6a4[_0xa1ab('0x2d')]),'penalty':0x0,'paused':_0xbbf6a4['whatsappPause'],'createdAt':_0xbbf6a4[_0xa1ab('0x60')],'updatedAt':_0xbbf6a4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x24a9b2,_0x1790c2))[_0xa1ab('0x49')](handleError(_0x24a9b2,null));};exports[_0xa1ab('0x64')]=function(_0x4cc58b,_0x232616,_0x26d1a3){var _0x2d3008={};var _0x2a5495={};var _0x595a7d;var _0x164529;return db[_0xa1ab('0x30')][_0xa1ab('0x65')]({'where':{'id':_0x4cc58b[_0xa1ab('0x66')]['id']}})[_0xa1ab('0x28')](handleEntityNotFound(_0x232616,null))['then'](function(_0x185e79){if(_0x185e79){_0x595a7d=_0x185e79;_0x2a5495[_0xa1ab('0x34')]=_[_0xa1ab('0x37')](db[_0xa1ab('0x67')][_0xa1ab('0x31')]);_0x2a5495['query']=_[_0xa1ab('0x37')](_0x4cc58b[_0xa1ab('0x36')]);_0x2a5495['filters']=_[_0xa1ab('0x38')](_0x2a5495[_0xa1ab('0x34')],_0x2a5495[_0xa1ab('0x36')]);_0x2d3008[_0xa1ab('0x39')]=_[_0xa1ab('0x38')](_0x2a5495[_0xa1ab('0x34')],qs['fields'](_0x4cc58b[_0xa1ab('0x36')][_0xa1ab('0x4b')]));_0x2d3008[_0xa1ab('0x39')]=_0x2d3008['attributes'][_0xa1ab('0x58')]?_0x2d3008[_0xa1ab('0x39')]:_0x2a5495[_0xa1ab('0x34')];_0x2d3008['order']=qs['sort'](_0x4cc58b[_0xa1ab('0x36')][_0xa1ab('0x3d')]);_0x2d3008[_0xa1ab('0x41')]=qs[_0xa1ab('0x3e')](_[_0xa1ab('0x3f')](_0x4cc58b[_0xa1ab('0x36')],_0x2a5495[_0xa1ab('0x3e')]));if(_0x4cc58b['query'][_0xa1ab('0x40')]){_0x2d3008[_0xa1ab('0x41')]=_['merge'](_0x2d3008[_0xa1ab('0x41')],{'$or':_['map'](_0x2d3008[_0xa1ab('0x39')],function(_0x261ae8){var _0xa3469c={};_0xa3469c[_0x261ae8]={'$like':'%'+_0x4cc58b[_0xa1ab('0x36')][_0xa1ab('0x40')]+'%'};return _0xa3469c;})});}_0x2d3008=_[_0xa1ab('0x42')]({},_0x2d3008,_0x4cc58b['options']);return _0x595a7d[_0xa1ab('0x64')](_0x2d3008);}})[_0xa1ab('0x28')](function(_0x119d71){if(_0x119d71){_0x164529=_0x119d71[_0xa1ab('0x58')];if(!_0x4cc58b[_0xa1ab('0x36')][_0xa1ab('0x3a')](_0xa1ab('0x3b'))){_0x2d3008[_0xa1ab('0x1e')]=qs['limit'](_0x4cc58b[_0xa1ab('0x36')]['limit']);_0x2d3008['offset']=qs[_0xa1ab('0x20')](_0x4cc58b['query']['offset']);}return _0x595a7d['getTeams'](_0x2d3008);}})[_0xa1ab('0x28')](function(_0x30db55){if(_0x30db55){return _0x30db55?{'count':_0x164529,'rows':_0x30db55}:null;}})[_0xa1ab('0x28')](respondWithResult(_0x232616,null))[_0xa1ab('0x49')](handleError(_0x232616,null));};exports['addTeams']=function(_0x2b071e,_0x570946,_0x57fa0c){var _0x55a333=_0x2b071e[_0xa1ab('0x4e')][_0xa1ab('0x68')];return db[_0xa1ab('0x67')]['findAll']({'where':{'id':_0x55a333},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa1ab('0x69'),'attributes':['id',_0xa1ab('0x2d'),_0xa1ab('0x6a'),'voicePause',_0xa1ab('0x6b')],'raw':!![]}]})[_0xa1ab('0x28')](function(_0x519542){if(_0x519542){var _0x195310=_[_0xa1ab('0x6c')](_0x519542,function(_0x2cb449){var _0x3a5800=_0x2cb449[_0xa1ab('0x29')]({'plain':!![]});return _0x3a5800[_0xa1ab('0x69')];});return db[_0xa1ab('0x30')][_0xa1ab('0x4c')]({'where':{'id':_0x2b071e[_0xa1ab('0x66')]['id']}})['then'](function(_0x339005){return db[_0xa1ab('0x6d')][_0xa1ab('0x6e')](function(_0x2e57f7){return _0x339005[_0xa1ab('0x6f')](_0x55a333,{'transaction':_0x2e57f7})[_0xa1ab('0x28')](function(){return BPromise['each'](_0x195310,function(_0x350bd3){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x350bd3['id'],'WhatsappQueueId':_0x2b071e['params']['id']},'transaction':_0x2e57f7});});})[_0xa1ab('0x28')](function(){_0x195310[_0xa1ab('0x70')](function(_0x204c5e){socket['emit'](_0xa1ab('0x71'),{'UserId':_0x204c5e['id'],'WhatsappQueueId':_0x339005['id']});});});});});}})[_0xa1ab('0x28')](respondWithStatusCode(_0x570946,null))['catch'](handleError(_0x570946,null));};exports[_0xa1ab('0x72')]=function(_0x1c69f8,_0xbf6772,_0x3e2c21){return db['Team'][_0xa1ab('0x47')]({'where':{'id':_0x1c69f8[_0xa1ab('0x36')][_0xa1ab('0x68')]},'attributes':['id'],'include':[{'model':db[_0xa1ab('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa1ab('0x28')](handleEntityNotFound(_0xbf6772,null))[_0xa1ab('0x28')](function(_0x538a7e){var _0x2942ab=_[_0xa1ab('0x35')](_0x538a7e,'id');var _0x3c806e=[];var _0x1769cc=[];var _0x5cd078=squel['select']();_0x5cd078[_0xa1ab('0x73')]('tq.TeamId')[_0xa1ab('0x74')](_0xa1ab('0x75'),'tq')[_0xa1ab('0x76')](_0xa1ab('0x77'),'ut',_0xa1ab('0x78'))[_0xa1ab('0x41')](_0xa1ab('0x79'),_0x1c69f8[_0xa1ab('0x66')]['id']);for(var _0x2615fc=0x0;_0x2615fc<_0x538a7e[_0xa1ab('0x58')];_0x2615fc+=0x1){let _0x10284d=_0x538a7e[_0x2615fc];for(var _0x58166d=0x0;_0x58166d<_0x10284d[_0xa1ab('0x69')][_0xa1ab('0x58')];_0x58166d+=0x1){let _0xaed0e0=_0x10284d[_0xa1ab('0x69')][_0x58166d];var _0x55ac2f=_0x5cd078[_0xa1ab('0x7a')]();_0x55ac2f[_0xa1ab('0x41')](_0xa1ab('0x7b'),_0xaed0e0['id']);_0x1769cc[_0xa1ab('0x7c')](db['sequelize'][_0xa1ab('0x36')](_0x55ac2f['toString'](),{'type':db[_0xa1ab('0x6d')][_0xa1ab('0x7d')][_0xa1ab('0x7e')]})[_0xa1ab('0x28')](function(_0x3e6413){if(_0x3e6413[_0xa1ab('0x58')]===0x1){return _0xaed0e0['id'];}else{var _0x13d3d5=_[_0xa1ab('0x7f')](_[_0xa1ab('0x35')](_0x3e6413,'TeamId'),function(_0x1a1238){return _[_0xa1ab('0x80')](_0x2942ab,_0x1a1238);});if(_0x13d3d5){return _0xaed0e0['id'];}}}));}}return BPromise[_0xa1ab('0x81')](_0x1769cc)[_0xa1ab('0x28')](function(_0x20e2a7){_0x3c806e=_(_0x3c806e)['union'](_0x20e2a7)['compact']()[_0xa1ab('0x82')]();return db['WhatsappQueue'][_0xa1ab('0x4c')]({'where':{'id':_0x1c69f8[_0xa1ab('0x66')]['id']}})[_0xa1ab('0x28')](function(_0x4781a7){return db[_0xa1ab('0x6d')][_0xa1ab('0x6e')](function(_0x11d1eb){return _0x4781a7[_0xa1ab('0x72')](_0x1c69f8[_0xa1ab('0x36')][_0xa1ab('0x68')],{'transaction':_0x11d1eb})['then'](function(){if(!_[_0xa1ab('0x83')](_0x3c806e)){return _0x4781a7['removeAgents'](_0x3c806e,{'transaction':_0x11d1eb});}})[_0xa1ab('0x28')](function(){_0x3c806e[_0xa1ab('0x70')](function(_0x692ea3){socket[_0xa1ab('0x84')](_0xa1ab('0x85'),{'UserId':_0x692ea3,'WhatsappQueueId':_0x4781a7['id']});});});});});});})[_0xa1ab('0x28')](respondWithStatusCode(_0xbf6772,null))['catch'](handleError(_0xbf6772,null));};exports[_0xa1ab('0x86')]=function(_0x329baf,_0x3d14df,_0x3a0082){return db[_0xa1ab('0x30')][_0xa1ab('0x4c')]({'where':{'id':_0x329baf['params']['id']}})[_0xa1ab('0x28')](handleEntityNotFound(_0x3d14df,null))['then'](function(_0x48aea9){if(_0x48aea9){return _0x48aea9[_0xa1ab('0x86')](_0x329baf['body']['ids'],_[_0xa1ab('0x87')](_0x329baf[_0xa1ab('0x4e')],[_0xa1ab('0x68'),'id'])||{})[_0xa1ab('0x88')](function(_0x4b861b){for(var _0x216767=0x0;_0x216767<_0x329baf['body'][_0xa1ab('0x68')][_0xa1ab('0x58')];_0x216767+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0x329baf['body'][_0xa1ab('0x68')][_0x216767]),'WhatsappQueueId':Number(_0x329baf[_0xa1ab('0x66')]['id'])});}return _0x4b861b;});}})['then'](respondWithResult(_0x3d14df,null))[_0xa1ab('0x49')](handleError(_0x3d14df,null));};exports['removeAgents']=function(_0x3b270f,_0xb018ad,_0x2bc7c4){return db['WhatsappQueue']['find']({'where':{'id':_0x3b270f[_0xa1ab('0x66')]['id']}})['then'](handleEntityNotFound(_0xb018ad,null))['then'](function(_0xd1632){if(_0xd1632){return _0xd1632[_0xa1ab('0x89')](_0x3b270f['query']['ids'])[_0xa1ab('0x28')](function(){if(_[_0xa1ab('0x8a')](_0x3b270f[_0xa1ab('0x36')][_0xa1ab('0x68')])){for(var _0x50ca7b=0x0;_0x50ca7b<_0x3b270f['query'][_0xa1ab('0x68')][_0xa1ab('0x58')];_0x50ca7b+=0x1){socket[_0xa1ab('0x84')](_0xa1ab('0x85'),{'UserId':Number(_0x3b270f['query'][_0xa1ab('0x68')][_0x50ca7b]),'WhatsappQueueId':Number(_0x3b270f[_0xa1ab('0x66')]['id'])});}}else{socket[_0xa1ab('0x84')](_0xa1ab('0x85'),{'UserId':Number(_0x3b270f[_0xa1ab('0x36')][_0xa1ab('0x68')]),'WhatsappQueueId':Number(_0x3b270f[_0xa1ab('0x66')]['id'])});}});}})[_0xa1ab('0x28')](respondWithStatusCode(_0xb018ad,null))['catch'](handleError(_0xb018ad,null));};exports[_0xa1ab('0x8b')]=function(_0x3e2e5e,_0x33d8ab,_0xc7f89e){var _0x1050a9={};var _0x71ff1b={};var _0x657efc;var _0x10a78e;return db[_0xa1ab('0x30')][_0xa1ab('0x65')]({'where':{'id':_0x3e2e5e[_0xa1ab('0x66')]['id']}})[_0xa1ab('0x28')](handleEntityNotFound(_0x33d8ab,null))['then'](function(_0x38768b){if(_0x38768b){_0x657efc=_0x38768b;_0x71ff1b['model']=_[_0xa1ab('0x37')](db['User'][_0xa1ab('0x31')]);_0x71ff1b[_0xa1ab('0x36')]=_[_0xa1ab('0x37')](_0x3e2e5e[_0xa1ab('0x36')]);_0x71ff1b[_0xa1ab('0x3e')]=_['intersection'](_0x71ff1b[_0xa1ab('0x34')],_0x71ff1b[_0xa1ab('0x36')]);_0x1050a9[_0xa1ab('0x39')]=_[_0xa1ab('0x38')](_0x71ff1b[_0xa1ab('0x34')],qs[_0xa1ab('0x4b')](_0x3e2e5e[_0xa1ab('0x36')][_0xa1ab('0x4b')]));_0x1050a9['attributes']=_0x1050a9[_0xa1ab('0x39')][_0xa1ab('0x58')]?_0x1050a9[_0xa1ab('0x39')]:_0x71ff1b[_0xa1ab('0x34')];_0x1050a9[_0xa1ab('0x3c')]=qs[_0xa1ab('0x3d')](_0x3e2e5e[_0xa1ab('0x36')][_0xa1ab('0x3d')]);_0x1050a9[_0xa1ab('0x41')]=qs['filters'](_['pick'](_0x3e2e5e['query'],_0x71ff1b[_0xa1ab('0x3e')]));if(_0x3e2e5e[_0xa1ab('0x36')][_0xa1ab('0x40')]){_0x1050a9[_0xa1ab('0x41')]=_[_0xa1ab('0x42')](_0x1050a9[_0xa1ab('0x41')],{'$or':_[_0xa1ab('0x35')](_0x1050a9[_0xa1ab('0x39')],function(_0x1ff826){var _0x586e26={};_0x586e26[_0x1ff826]={'$like':'%'+_0x3e2e5e['query'][_0xa1ab('0x40')]+'%'};return _0x586e26;})});}_0x1050a9=_[_0xa1ab('0x42')]({},_0x1050a9,_0x3e2e5e[_0xa1ab('0x44')]);return _0x657efc[_0xa1ab('0x8b')](_0x1050a9);}})['then'](function(_0x572108){if(_0x572108){_0x10a78e=_0x572108[_0xa1ab('0x58')];if(!_0x3e2e5e[_0xa1ab('0x36')]['hasOwnProperty'](_0xa1ab('0x3b'))){_0x1050a9[_0xa1ab('0x1e')]=qs['limit'](_0x3e2e5e['query'][_0xa1ab('0x1e')]);_0x1050a9[_0xa1ab('0x20')]=qs[_0xa1ab('0x20')](_0x3e2e5e[_0xa1ab('0x36')]['offset']);}return _0x657efc['getAgents'](_0x1050a9);}})[_0xa1ab('0x28')](function(_0x197510){if(_0x197510){return _0x197510?{'count':_0x10a78e,'rows':_0x197510}:null;}})['then'](respondWithResult(_0x33d8ab,null))['catch'](handleError(_0x33d8ab,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index fe0dc36..18dfd6b 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 _0xa1db=['remove','emit','hook','exports','WhatsappQueue','setMaxListeners','save','update'];(function(_0x5e6d65,_0x5db89c){var _0x5e1f75=function(_0x3729a1){while(--_0x3729a1){_0x5e6d65['push'](_0x5e6d65['shift']());}};_0x5e1f75(++_0x5db89c);}(_0xa1db,0x64));var _0xba1d=function(_0x5b96f6,_0x26fe54){_0x5b96f6=_0x5b96f6-0x0;var _0xe67cd8=_0xa1db[_0x5b96f6];return _0xe67cd8;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0xba1d('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xba1d('0x1')](0x0);var events={'afterCreate':_0xba1d('0x2'),'afterUpdate':_0xba1d('0x3'),'afterDestroy':_0xba1d('0x4')};function emitEvent(_0x416b0e){return function(_0x396f2c,_0x22dc65,_0x3b1276){WhatsappQueueEvents['emit'](_0x416b0e+':'+_0x396f2c['id'],_0x396f2c);WhatsappQueueEvents[_0xba1d('0x5')](_0x416b0e,_0x396f2c);_0x3b1276(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xba1d('0x6')](e,emitEvent(event));}}module[_0xba1d('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x7b2b=['remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue','setMaxListeners','save'];(function(_0x221f94,_0x5b6586){var _0x5bf802=function(_0x5c1eae){while(--_0x5c1eae){_0x221f94['push'](_0x221f94['shift']());}};_0x5bf802(++_0x5b6586);}(_0x7b2b,0x101));var _0xb7b2=function(_0x39ab2e,_0x3ee6ee){_0x39ab2e=_0x39ab2e-0x0;var _0x53cab0=_0x7b2b[_0x39ab2e];return _0x53cab0;};'use strict';var EventEmitter=require(_0xb7b2('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xb7b2('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb7b2('0x2')](0x0);var events={'afterCreate':_0xb7b2('0x3'),'afterUpdate':'update','afterDestroy':_0xb7b2('0x4')};function emitEvent(_0x360083){return function(_0x33e57b,_0x563343,_0x2510df){WhatsappQueueEvents[_0xb7b2('0x5')](_0x360083+':'+_0x33e57b['id'],_0x33e57b);WhatsappQueueEvents[_0xb7b2('0x5')](_0x360083,_0x33e57b);_0x2510df(null);};}for(var e in events){if(events[_0xb7b2('0x6')](e)){var event=events[e];WhatsappQueue[_0xb7b2('0x7')](e,emitEvent(event));}}module[_0xb7b2('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 7ec30bf..a6fde99 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 _0xf02a=['../../config/environment','./whatsappQueue.attributes','exports','define','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf02a,0x1da));var _0xaf02=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0xf02a[_0x398294];return _0x2a872d;};'use strict';var _=require('lodash');var util=require(_0xaf02('0x0'));var logger=require('../../config/logger')(_0xaf02('0x1'));var moment=require(_0xaf02('0x2'));var BPromise=require(_0xaf02('0x3'));var rp=require(_0xaf02('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf02('0x5'));var config=require(_0xaf02('0x6'));var attributes=require(_0xaf02('0x7'));module[_0xaf02('0x8')]=function(_0x24ecbd,_0x50b276){return _0x24ecbd[_0xaf02('0x9')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b7b=['../../config/logger','api','moment','request-promise','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x279e9c,_0x45dfe4){var _0x2c6e72=function(_0xe05702){while(--_0xe05702){_0x279e9c['push'](_0x279e9c['shift']());}};_0x2c6e72(++_0x45dfe4);}(_0x8b7b,0x1c1));var _0xb8b7=function(_0x270b91,_0x4400d5){_0x270b91=_0x270b91-0x0;var _0x5a4097=_0x8b7b[_0x270b91];return _0x5a4097;};'use strict';var _=require(_0xb8b7('0x0'));var util=require(_0xb8b7('0x1'));var logger=require(_0xb8b7('0x2'))(_0xb8b7('0x3'));var moment=require(_0xb8b7('0x4'));var BPromise=require('bluebird');var rp=require(_0xb8b7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb8b7('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0xb8b7('0x7')]=function(_0x4631b4,_0x128e24){return _0x4631b4[_0xb8b7('0x8')](_0xb8b7('0x9'),attributes,{'tableName':_0xb8b7('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 300268b..96037ca 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 _0xb0ba=['then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetWhatsappQueue','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb0ba,0xc9));var _0xab0b=function(_0x5245f7,_0x57bea5){_0x5245f7=_0x5245f7-0x0;var _0x28b446=_0xb0ba[_0x5245f7];return _0x28b446;};'use strict';var _=require('lodash');var util=require(_0xab0b('0x0'));var moment=require(_0xab0b('0x1'));var BPromise=require(_0xab0b('0x2'));var rs=require(_0xab0b('0x3'));var fs=require('fs');var Redis=require(_0xab0b('0x4'));var db=require(_0xab0b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xab0b('0x6'))(_0xab0b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xab0b('0x8')]['http']({'port':0x232a});config[_0xab0b('0x9')]=_[_0xab0b('0xa')](config[_0xab0b('0x9')],{'host':_0xab0b('0xb'),'port':0x18eb});var socket=require(_0xab0b('0xc'))(new Redis(config[_0xab0b('0x9')]));require(_0xab0b('0xd'))['register'](socket);function respondWithRpcPromise(_0x47ad1a,_0x5427f9,_0x51809f){return new BPromise(function(_0x35790d,_0x1f8457){return client[_0xab0b('0xe')](_0x47ad1a,_0x51809f)[_0xab0b('0xf')](function(_0x430964){logger[_0xab0b('0x10')](_0xab0b('0x11'),_0x5427f9,_0xab0b('0x12'));logger[_0xab0b('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5427f9,_0xab0b('0x12'),JSON[_0xab0b('0x14')](_0x430964));if(_0x430964['error']){if(_0x430964[_0xab0b('0x15')]['code']===0x1f4){logger['error'](_0xab0b('0x11'),_0x5427f9,_0x430964[_0xab0b('0x15')][_0xab0b('0x16')]);return _0x1f8457(_0x430964[_0xab0b('0x15')][_0xab0b('0x16')]);}logger[_0xab0b('0x15')](_0xab0b('0x11'),_0x5427f9,_0x430964['error']['message']);return _0x35790d(_0x430964[_0xab0b('0x15')][_0xab0b('0x16')]);}else{logger['info'](_0xab0b('0x11'),_0x5427f9,_0xab0b('0x12'));_0x35790d(_0x430964[_0xab0b('0x17')][_0xab0b('0x16')]);}})[_0xab0b('0x18')](function(_0x52c32f){logger[_0xab0b('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x5427f9,_0x52c32f);_0x1f8457(_0x52c32f);});});}exports[_0xab0b('0x19')]=function(_0x543610){var _0x230213=this;return new Promise(function(_0x312d9d,_0x11492f){return db['WhatsappQueue']['findAll']({'raw':_0x543610[_0xab0b('0x1a')]?_0x543610[_0xab0b('0x1a')][_0xab0b('0x1b')]===undefined?!![]:![]:!![],'where':_0x543610[_0xab0b('0x1a')]?_0x543610['options'][_0xab0b('0x1c')]||null:null,'attributes':_0x543610[_0xab0b('0x1a')]?_0x543610[_0xab0b('0x1a')][_0xab0b('0x1d')]||null:null,'limit':_0x543610[_0xab0b('0x1a')]?_0x543610[_0xab0b('0x1a')][_0xab0b('0x1e')]||null:null,'include':_0x543610[_0xab0b('0x1a')]?_0x543610[_0xab0b('0x1a')][_0xab0b('0x1f')]?_[_0xab0b('0x20')](_0x543610[_0xab0b('0x1a')]['include'],function(_0x32e885){return{'model':db[_0x32e885[_0xab0b('0x21')]],'as':_0x32e885['as'],'attributes':_0x32e885[_0xab0b('0x1d')],'include':_0x32e885['include']?_[_0xab0b('0x20')](_0x32e885[_0xab0b('0x1f')],function(_0x163ece){return{'model':db[_0x163ece[_0xab0b('0x21')]],'as':_0x163ece['as'],'attributes':_0x163ece[_0xab0b('0x1d')],'include':_0x163ece[_0xab0b('0x1f')]?_['map'](_0x163ece['include'],function(_0x3f5052){return{'model':db[_0x3f5052[_0xab0b('0x21')]],'as':_0x3f5052['as'],'attributes':_0x3f5052[_0xab0b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xab0b('0xf')](function(_0xc1e4e9){logger['info'](_0xab0b('0x19'),_0x543610);logger[_0xab0b('0x13')]('GetWhatsappQueue',_0x543610,JSON[_0xab0b('0x14')](_0xc1e4e9));_0x312d9d(_0xc1e4e9);})[_0xab0b('0x18')](function(_0x409ad8){logger[_0xab0b('0x15')](_0xab0b('0x19'),_0x409ad8[_0xab0b('0x16')],_0x543610);_0x11492f(_0x230213[_0xab0b('0x15')](0x1f4,_0x409ad8['message']));});});};exports[_0xab0b('0x22')]=function(_0x4f248f){var _0xe03e3a=this;return new Promise(function(_0x492594,_0x416bb6){return db['WhatsappQueue'][_0xab0b('0x23')]({'raw':_0x4f248f['options']?_0x4f248f[_0xab0b('0x1a')][_0xab0b('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f248f[_0xab0b('0x1a')]?_0x4f248f[_0xab0b('0x1a')][_0xab0b('0x1c')]||null:null,'attributes':_0x4f248f[_0xab0b('0x1a')]?_0x4f248f[_0xab0b('0x1a')][_0xab0b('0x1d')]||null:null,'include':_0x4f248f['options']?_0x4f248f[_0xab0b('0x1a')][_0xab0b('0x1f')]?_['map'](_0x4f248f[_0xab0b('0x1a')]['include'],function(_0x522b74){return{'model':db[_0x522b74[_0xab0b('0x21')]],'as':_0x522b74['as'],'attributes':_0x522b74[_0xab0b('0x1d')],'include':_0x522b74['include']?_[_0xab0b('0x20')](_0x522b74[_0xab0b('0x1f')],function(_0x50d342){return{'model':db[_0x50d342[_0xab0b('0x21')]],'as':_0x50d342['as'],'attributes':_0x50d342[_0xab0b('0x1d')],'include':_0x50d342[_0xab0b('0x1f')]?_[_0xab0b('0x20')](_0x50d342[_0xab0b('0x1f')],function(_0x372767){return{'model':db[_0x372767[_0xab0b('0x21')]],'as':_0x372767['as'],'attributes':_0x372767[_0xab0b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xab0b('0xf')](function(_0x30689d){logger[_0xab0b('0x10')](_0xab0b('0x22'),_0x4f248f);logger[_0xab0b('0x13')](_0xab0b('0x22'),_0x4f248f,JSON[_0xab0b('0x14')](_0x30689d));_0x492594(_0x30689d);})[_0xab0b('0x18')](function(_0x229cb6){logger[_0xab0b('0x15')](_0xab0b('0x22'),_0x229cb6['message'],_0x4f248f);_0x416bb6(_0xe03e3a[_0xab0b('0x15')](0x1f4,_0x229cb6[_0xab0b('0x16')]));});});}; \ No newline at end of file +var _0xa245=['../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','attributes','limit','include','map','model','find','raw','where','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x24e8db,_0x89fc47){var _0x576cc1=function(_0x58f214){while(--_0x58f214){_0x24e8db['push'](_0x24e8db['shift']());}};_0x576cc1(++_0x89fc47);}(_0xa245,0x11e));var _0x5a24=function(_0x383e32,_0x28bfd6){_0x383e32=_0x383e32-0x0;var _0x4c4cbb=_0xa245[_0x383e32];return _0x4c4cbb;};'use strict';var _=require(_0x5a24('0x0'));var util=require(_0x5a24('0x1'));var moment=require(_0x5a24('0x2'));var BPromise=require(_0x5a24('0x3'));var rs=require(_0x5a24('0x4'));var fs=require('fs');var Redis=require(_0x5a24('0x5'));var db=require(_0x5a24('0x6'))['db'];var utils=require(_0x5a24('0x7'));var logger=require(_0x5a24('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5a24('0x9')][_0x5a24('0xa')]({'port':0x232a});config[_0x5a24('0xb')]=_[_0x5a24('0xc')](config[_0x5a24('0xb')],{'host':_0x5a24('0xd'),'port':0x18eb});var socket=require(_0x5a24('0xe'))(new Redis(config[_0x5a24('0xb')]));require(_0x5a24('0xf'))['register'](socket);function respondWithRpcPromise(_0x509028,_0x338778,_0x4cd357){return new BPromise(function(_0x5e0869,_0xec5821){return client[_0x5a24('0x10')](_0x509028,_0x4cd357)[_0x5a24('0x11')](function(_0xee8428){logger[_0x5a24('0x12')](_0x5a24('0x13'),_0x338778,'request\x20sent');logger[_0x5a24('0x14')](_0x5a24('0x15'),_0x338778,_0x5a24('0x16'),JSON[_0x5a24('0x17')](_0xee8428));if(_0xee8428[_0x5a24('0x18')]){if(_0xee8428[_0x5a24('0x18')][_0x5a24('0x19')]===0x1f4){logger[_0x5a24('0x18')](_0x5a24('0x13'),_0x338778,_0xee8428[_0x5a24('0x18')]['message']);return _0xec5821(_0xee8428[_0x5a24('0x18')][_0x5a24('0x1a')]);}logger[_0x5a24('0x18')](_0x5a24('0x13'),_0x338778,_0xee8428[_0x5a24('0x18')][_0x5a24('0x1a')]);return _0x5e0869(_0xee8428[_0x5a24('0x18')]['message']);}else{logger[_0x5a24('0x12')](_0x5a24('0x13'),_0x338778,_0x5a24('0x16'));_0x5e0869(_0xee8428[_0x5a24('0x1b')][_0x5a24('0x1a')]);}})[_0x5a24('0x1c')](function(_0x40cc7c){logger[_0x5a24('0x18')](_0x5a24('0x13'),_0x338778,_0x40cc7c);_0xec5821(_0x40cc7c);});});}exports[_0x5a24('0x1d')]=function(_0x14e4c5){var _0x392049=this;return new Promise(function(_0x324fbc,_0x43bd7c){return db[_0x5a24('0x1e')][_0x5a24('0x1f')]({'raw':_0x14e4c5[_0x5a24('0x20')]?_0x14e4c5['options']['raw']===undefined?!![]:![]:!![],'where':_0x14e4c5[_0x5a24('0x20')]?_0x14e4c5[_0x5a24('0x20')]['where']||null:null,'attributes':_0x14e4c5[_0x5a24('0x20')]?_0x14e4c5[_0x5a24('0x20')][_0x5a24('0x21')]||null:null,'limit':_0x14e4c5[_0x5a24('0x20')]?_0x14e4c5[_0x5a24('0x20')][_0x5a24('0x22')]||null:null,'include':_0x14e4c5[_0x5a24('0x20')]?_0x14e4c5[_0x5a24('0x20')][_0x5a24('0x23')]?_[_0x5a24('0x24')](_0x14e4c5[_0x5a24('0x20')]['include'],function(_0x20bfbc){return{'model':db[_0x20bfbc[_0x5a24('0x25')]],'as':_0x20bfbc['as'],'attributes':_0x20bfbc[_0x5a24('0x21')],'include':_0x20bfbc['include']?_[_0x5a24('0x24')](_0x20bfbc[_0x5a24('0x23')],function(_0x453036){return{'model':db[_0x453036[_0x5a24('0x25')]],'as':_0x453036['as'],'attributes':_0x453036[_0x5a24('0x21')],'include':_0x453036['include']?_[_0x5a24('0x24')](_0x453036[_0x5a24('0x23')],function(_0x5cca2b){return{'model':db[_0x5cca2b[_0x5a24('0x25')]],'as':_0x5cca2b['as'],'attributes':_0x5cca2b[_0x5a24('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5a24('0x11')](function(_0x5e81b7){logger[_0x5a24('0x12')]('GetWhatsappQueue',_0x14e4c5);logger[_0x5a24('0x14')](_0x5a24('0x1d'),_0x14e4c5,JSON['stringify'](_0x5e81b7));_0x324fbc(_0x5e81b7);})[_0x5a24('0x1c')](function(_0x41a98e){logger['error']('GetWhatsappQueue',_0x41a98e[_0x5a24('0x1a')],_0x14e4c5);_0x43bd7c(_0x392049[_0x5a24('0x18')](0x1f4,_0x41a98e[_0x5a24('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x144b4f){var _0x25bbb2=this;return new Promise(function(_0x3c3e33,_0x475583){return db[_0x5a24('0x1e')][_0x5a24('0x26')]({'raw':_0x144b4f['options']?_0x144b4f[_0x5a24('0x20')][_0x5a24('0x27')]===undefined?!![]:![]:!![],'where':_0x144b4f[_0x5a24('0x20')]?_0x144b4f[_0x5a24('0x20')][_0x5a24('0x28')]||null:null,'attributes':_0x144b4f[_0x5a24('0x20')]?_0x144b4f[_0x5a24('0x20')][_0x5a24('0x21')]||null:null,'include':_0x144b4f[_0x5a24('0x20')]?_0x144b4f['options'][_0x5a24('0x23')]?_[_0x5a24('0x24')](_0x144b4f[_0x5a24('0x20')][_0x5a24('0x23')],function(_0x4d764a){return{'model':db[_0x4d764a[_0x5a24('0x25')]],'as':_0x4d764a['as'],'attributes':_0x4d764a[_0x5a24('0x21')],'include':_0x4d764a[_0x5a24('0x23')]?_[_0x5a24('0x24')](_0x4d764a['include'],function(_0x3949c0){return{'model':db[_0x3949c0[_0x5a24('0x25')]],'as':_0x3949c0['as'],'attributes':_0x3949c0[_0x5a24('0x21')],'include':_0x3949c0['include']?_[_0x5a24('0x24')](_0x3949c0[_0x5a24('0x23')],function(_0x75475c){return{'model':db[_0x75475c[_0x5a24('0x25')]],'as':_0x75475c['as'],'attributes':_0x75475c[_0x5a24('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5a24('0x11')](function(_0x20c2fc){logger['info'](_0x5a24('0x29'),_0x144b4f);logger[_0x5a24('0x14')](_0x5a24('0x29'),_0x144b4f,JSON[_0x5a24('0x17')](_0x20c2fc));_0x3c3e33(_0x20c2fc);})[_0x5a24('0x1c')](function(_0x3cc040){logger['error'](_0x5a24('0x29'),_0x3cc040[_0x5a24('0x1a')],_0x144b4f);_0x475583(_0x25bbb2[_0x5a24('0x18')](0x1f4,_0x3cc040[_0x5a24('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index c8004fc..c89dfdc 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 _0x3540=['length','whatsappQueue:','./whatsappQueue.events','save','update','register'];(function(_0x281305,_0x47691a){var _0x53d9a1=function(_0x49fc01){while(--_0x49fc01){_0x281305['push'](_0x281305['shift']());}};_0x53d9a1(++_0x47691a);}(_0x3540,0x92));var _0x0354=function(_0x6bb4fa,_0x4603e3){_0x6bb4fa=_0x6bb4fa-0x0;var _0x4cd4d0=_0x3540[_0x6bb4fa];return _0x4cd4d0;};'use strict';var WhatsappQueueEvents=require(_0x0354('0x0'));var events=[_0x0354('0x1'),'remove',_0x0354('0x2')];function createListener(_0x16966d,_0x493cd8){return function(_0x45fbb9){_0x493cd8['emit'](_0x16966d,_0x45fbb9);};}function removeListener(_0x5dfc13,_0x531e40){return function(){WhatsappQueueEvents['removeListener'](_0x5dfc13,_0x531e40);};}exports[_0x0354('0x3')]=function(_0x30d605){for(var _0x11cbf0=0x0,_0x6f17b3=events[_0x0354('0x4')];_0x11cbf0<_0x6f17b3;_0x11cbf0++){var _0x3a467c=events[_0x11cbf0];var _0x5a18da=createListener(_0x0354('0x5')+_0x3a467c,_0x30d605);WhatsappQueueEvents['on'](_0x3a467c,_0x5a18da);}}; \ No newline at end of file +var _0x64bb=['removeListener','length','./whatsappQueue.events','save','remove','update','emit'];(function(_0x4c2114,_0x57e809){var _0x1d7c44=function(_0x57cba9){while(--_0x57cba9){_0x4c2114['push'](_0x4c2114['shift']());}};_0x1d7c44(++_0x57e809);}(_0x64bb,0x105));var _0xb64b=function(_0x19c516,_0x211cc3){_0x19c516=_0x19c516-0x0;var _0x1bc9f9=_0x64bb[_0x19c516];return _0x1bc9f9;};'use strict';var WhatsappQueueEvents=require(_0xb64b('0x0'));var events=[_0xb64b('0x1'),_0xb64b('0x2'),_0xb64b('0x3')];function createListener(_0x4df529,_0x47bea2){return function(_0x458c5d){_0x47bea2[_0xb64b('0x4')](_0x4df529,_0x458c5d);};}function removeListener(_0x3d2726,_0x5275e0){return function(){WhatsappQueueEvents[_0xb64b('0x5')](_0x3d2726,_0x5275e0);};}exports['register']=function(_0x10b82e){for(var _0x21ea9f=0x0,_0x20a16a=events[_0xb64b('0x6')];_0x21ea9f<_0x20a16a;_0x21ea9f++){var _0x3563fd=events[_0x21ea9f];var _0x18ee2=createListener('whatsappQueue:'+_0x3563fd,_0x10b82e);WhatsappQueueEvents['on'](_0x3563fd,_0x18ee2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 05788ce..d1dd587 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 _0x0ead=['../../components/auth/service','./whatsappQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','create','update','delete','exports','multer','util','path','Router','fs-extra'];(function(_0x6d8fc0,_0xfa1012){var _0x3d0122=function(_0x1099bf){while(--_0x1099bf){_0x6d8fc0['push'](_0x6d8fc0['shift']());}};_0x3d0122(++_0xfa1012);}(_0x0ead,0x11c));var _0xd0ea=function(_0x4972f3,_0x575c00){_0x4972f3=_0x4972f3-0x0;var _0x5ccdd6=_0x0ead[_0x4972f3];return _0x5ccdd6;};'use strict';var multer=require(_0xd0ea('0x0'));var util=require(_0xd0ea('0x1'));var path=require(_0xd0ea('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd0ea('0x3')]();var fs_extra=require(_0xd0ea('0x4'));var auth=require(_0xd0ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd0ea('0x6'));router[_0xd0ea('0x7')]('/',auth[_0xd0ea('0x8')](),controller['index']);router['get']('/describe',auth[_0xd0ea('0x8')](),controller[_0xd0ea('0x9')]);router['get'](_0xd0ea('0xa'),auth[_0xd0ea('0x8')](),controller[_0xd0ea('0xb')]);router[_0xd0ea('0xc')]('/',auth[_0xd0ea('0x8')](),controller[_0xd0ea('0xd')]);router['put'](_0xd0ea('0xa'),auth['isAuthenticated'](),controller[_0xd0ea('0xe')]);router[_0xd0ea('0xf')](_0xd0ea('0xa'),auth[_0xd0ea('0x8')](),controller['destroy']);module[_0xd0ea('0x10')]=router; \ No newline at end of file +var _0x8c45=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','create'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8c45,0x1f3));var _0x58c4=function(_0x3fcd1d,_0x4a1e22){_0x3fcd1d=_0x3fcd1d-0x0;var _0x15ced2=_0x8c45[_0x3fcd1d];return _0x15ced2;};'use strict';var multer=require(_0x58c4('0x0'));var util=require(_0x58c4('0x1'));var path=require('path');var timeout=require(_0x58c4('0x2'));var express=require('express');var router=express[_0x58c4('0x3')]();var fs_extra=require(_0x58c4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x58c4('0x5'));var config=require('../../config/environment');var controller=require(_0x58c4('0x6'));router[_0x58c4('0x7')]('/',auth[_0x58c4('0x8')](),controller[_0x58c4('0x9')]);router['get']('/describe',auth[_0x58c4('0x8')](),controller['describe']);router[_0x58c4('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x58c4('0x8')](),controller[_0x58c4('0xa')]);router[_0x58c4('0xb')](_0x58c4('0xc'),auth[_0x58c4('0x8')](),controller[_0x58c4('0xd')]);router[_0x58c4('0xe')]('/:id',auth[_0x58c4('0x8')](),controller[_0x58c4('0xf')]);module[_0x58c4('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 47a34b9..4979ae3 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(_0x332b7c,_0x2a1246){var _0x1d4c13=function(_0x4db214){while(--_0x4db214){_0x332b7c['push'](_0x332b7c['shift']());}};_0x1d4c13(++_0x2a1246);}(_0x7a54,0x106));var _0x47a5=function(_0x51e6bd,_0x4b17c2){_0x51e6bd=_0x51e6bd-0x0;var _0x5aab68=_0x7a54[_0x51e6bd];return _0x5aab68;};'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(_0x142c7a,_0x26e73c){var _0x3a81eb=function(_0x1fccaf){while(--_0x1fccaf){_0x142c7a['push'](_0x142c7a['shift']());}};_0x3a81eb(++_0x26e73c);}(_0x7a54,0x106));var _0x47a5=function(_0x445d62,_0x26d074){_0x445d62=_0x445d62-0x0;var _0x328ddf=_0x7a54[_0x445d62];return _0x328ddf;};'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 0d7302d..3e6bd52 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 _0x9ffd=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','update','then','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x109060,_0x380440){_0x109060=_0x109060-0x0;var _0x261729=_0x9ffd[_0x109060];return _0x261729;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];function respondWithStatusCode(_0x47d842,_0x47b0d7){_0x47b0d7=_0x47b0d7||0xcc;return function(_0xaaf7af){if(_0xaaf7af){return _0x47d842[_0xd9ff('0x1a')](_0x47b0d7);}return _0x47d842[_0xd9ff('0x1b')](_0x47b0d7)[_0xd9ff('0x1c')]();};}function respondWithResult(_0x12c39a,_0x556aa4){_0x556aa4=_0x556aa4||0xc8;return function(_0x2f78c1){if(_0x2f78c1){return _0x12c39a[_0xd9ff('0x1b')](_0x556aa4)['json'](_0x2f78c1);}};}function respondWithFilteredResult(_0xf14c9f,_0x5db010){return function(_0x4ffe54){if(_0x4ffe54){var _0x547e28=typeof _0x5db010['offset']===_0xd9ff('0x1d')&&typeof _0x5db010['limit']===_0xd9ff('0x1d');var _0xa30fd2=_0x4ffe54[_0xd9ff('0x1e')];var _0x3afd19=_0x547e28?0x0:_0x5db010[_0xd9ff('0x1f')];var _0x2d4df1=_0x547e28?_0x4ffe54[_0xd9ff('0x1e')]:_0x5db010[_0xd9ff('0x1f')]+_0x5db010[_0xd9ff('0x20')];var _0x1f028f;if(_0x2d4df1>=_0xa30fd2){_0x2d4df1=_0xa30fd2;_0x1f028f=0xc8;}else{_0x1f028f=0xce;}_0xf14c9f[_0xd9ff('0x1b')](_0x1f028f);return _0xf14c9f[_0xd9ff('0x21')](_0xd9ff('0x22'),_0x3afd19+'-'+_0x2d4df1+'/'+_0xa30fd2)['json'](_0x4ffe54);}return null;};}function patchUpdates(_0x4cf8ec){return function(_0x264a3d){try{jsonpatch[_0xd9ff('0x23')](_0x264a3d,_0x4cf8ec,!![]);}catch(_0x4eea4d){return BPromise['reject'](_0x4eea4d);}return _0x264a3d['save']();};}function saveUpdates(_0x4b1477,_0x1f4d9e){return function(_0x58eb5f){if(_0x58eb5f){return _0x58eb5f[_0xd9ff('0x24')](_0x4b1477)[_0xd9ff('0x25')](function(_0x291f52){return _0x291f52;});}return null;};}function removeEntity(_0x9f074e,_0x278b66){return function(_0x42a828){if(_0x42a828){return _0x42a828['destroy']()['then'](function(){_0x9f074e[_0xd9ff('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ca906,_0x4d86fe){return function(_0x285002){if(!_0x285002){_0x3ca906['sendStatus'](0x194);}return _0x285002;};}function handleError(_0x10cbdd,_0x159e56){_0x159e56=_0x159e56||0x1f4;return function(_0x2138b4){logger[_0xd9ff('0x26')](_0x2138b4['stack']);if(_0x2138b4[_0xd9ff('0x27')]){delete _0x2138b4[_0xd9ff('0x27')];}_0x10cbdd[_0xd9ff('0x1b')](_0x159e56)[_0xd9ff('0x28')](_0x2138b4);};}exports['index']=function(_0x1d3684,_0x3792d9){var _0x44b5a7={},_0x45fb63={},_0x263d3a={'count':0x0,'rows':[]};var _0xe516e2=_[_0xd9ff('0x29')](db[_0xd9ff('0x2a')][_0xd9ff('0x2b')],function(_0x5706cf){return{'name':_0x5706cf[_0xd9ff('0x2c')],'type':_0x5706cf['type'][_0xd9ff('0x2d')]};});_0x45fb63[_0xd9ff('0x2e')]=_[_0xd9ff('0x29')](_0xe516e2,'name');_0x45fb63[_0xd9ff('0x2f')]=_[_0xd9ff('0x30')](_0x1d3684[_0xd9ff('0x2f')]);_0x45fb63[_0xd9ff('0x31')]=_['intersection'](_0x45fb63[_0xd9ff('0x2e')],_0x45fb63['query']);_0x44b5a7[_0xd9ff('0x32')]=_[_0xd9ff('0x33')](_0x45fb63[_0xd9ff('0x2e')],qs[_0xd9ff('0x34')](_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x34')]));_0x44b5a7[_0xd9ff('0x32')]=_0x44b5a7[_0xd9ff('0x32')][_0xd9ff('0x35')]?_0x44b5a7[_0xd9ff('0x32')]:_0x45fb63[_0xd9ff('0x2e')];if(!_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x36')](_0xd9ff('0x37'))){_0x44b5a7['limit']=qs[_0xd9ff('0x20')](_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x20')]);_0x44b5a7['offset']=qs[_0xd9ff('0x1f')](_0x1d3684['query'][_0xd9ff('0x1f')]);}_0x44b5a7['order']=qs[_0xd9ff('0x38')](_0x1d3684['query'][_0xd9ff('0x38')]);_0x44b5a7[_0xd9ff('0x39')]=qs[_0xd9ff('0x31')](_['pick'](_0x1d3684['query'],_0x45fb63['filters']),_0xe516e2);if(_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x3a')]){_0x44b5a7[_0xd9ff('0x39')]=_[_0xd9ff('0x3b')](_0x44b5a7[_0xd9ff('0x39')],{'$or':_[_0xd9ff('0x29')](_0xe516e2,function(_0x596d29){if(_0x596d29['type']!=='VIRTUAL'){var _0x316d93={};_0x316d93[_0x596d29[_0xd9ff('0x27')]]={'$like':'%'+_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x3a')]+'%'};return _0x316d93;}})});}_0x44b5a7=_['merge']({},_0x44b5a7,_0x1d3684[_0xd9ff('0x3c')]);var _0x5b8e17={'where':_0x44b5a7[_0xd9ff('0x39')]};return db[_0xd9ff('0x2a')][_0xd9ff('0x1e')](_0x5b8e17)[_0xd9ff('0x25')](function(_0x59fc07){_0x263d3a[_0xd9ff('0x1e')]=_0x59fc07;if(_0x1d3684[_0xd9ff('0x2f')]['includeAll']){_0x44b5a7[_0xd9ff('0x3d')]=[{'all':!![]}];}return db[_0xd9ff('0x2a')][_0xd9ff('0x3e')](_0x44b5a7);})[_0xd9ff('0x25')](function(_0x1fe44d){_0x263d3a[_0xd9ff('0x3f')]=_0x1fe44d;return _0x263d3a;})['then'](respondWithFilteredResult(_0x3792d9,_0x44b5a7))[_0xd9ff('0x40')](handleError(_0x3792d9,null));};exports[_0xd9ff('0x41')]=function(_0x10533a,_0x39fbbb){var _0x472724={'raw':!![],'where':{'id':_0x10533a[_0xd9ff('0x42')]['id']}},_0x52aab8={};_0x52aab8[_0xd9ff('0x2e')]=_[_0xd9ff('0x30')](db['WhatsappQueueReport']['rawAttributes']);_0x52aab8[_0xd9ff('0x2f')]=_[_0xd9ff('0x30')](_0x10533a[_0xd9ff('0x2f')]);_0x52aab8[_0xd9ff('0x31')]=_[_0xd9ff('0x33')](_0x52aab8[_0xd9ff('0x2e')],_0x52aab8['query']);_0x472724[_0xd9ff('0x32')]=_[_0xd9ff('0x33')](_0x52aab8['model'],qs[_0xd9ff('0x34')](_0x10533a[_0xd9ff('0x2f')][_0xd9ff('0x34')]));_0x472724[_0xd9ff('0x32')]=_0x472724[_0xd9ff('0x32')]['length']?_0x472724['attributes']:_0x52aab8['model'];if(_0x10533a[_0xd9ff('0x2f')]['includeAll']){_0x472724[_0xd9ff('0x3d')]=[{'all':!![]}];}_0x472724=_[_0xd9ff('0x3b')]({},_0x472724,_0x10533a[_0xd9ff('0x3c')]);return db['WhatsappQueueReport'][_0xd9ff('0x43')](_0x472724)[_0xd9ff('0x25')](handleEntityNotFound(_0x39fbbb,null))['then'](respondWithResult(_0x39fbbb,null))[_0xd9ff('0x40')](handleError(_0x39fbbb,null));};exports[_0xd9ff('0x44')]=function(_0x23b224,_0x316854){return db['WhatsappQueueReport'][_0xd9ff('0x44')](_0x23b224['body'],{})[_0xd9ff('0x25')](respondWithResult(_0x316854,0xc9))['catch'](handleError(_0x316854,null));};exports[_0xd9ff('0x24')]=function(_0x3d91e6,_0x2bf37a){if(_0x3d91e6[_0xd9ff('0x45')]['id']){delete _0x3d91e6[_0xd9ff('0x45')]['id'];}return db['WhatsappQueueReport'][_0xd9ff('0x43')]({'where':{'id':_0x3d91e6[_0xd9ff('0x42')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x2bf37a,null))[_0xd9ff('0x25')](saveUpdates(_0x3d91e6['body'],null))['then'](respondWithResult(_0x2bf37a,null))['catch'](handleError(_0x2bf37a,null));};exports[_0xd9ff('0x46')]=function(_0x40be56,_0x29c6bd){return db['WhatsappQueueReport'][_0xd9ff('0x43')]({'where':{'id':_0x40be56[_0xd9ff('0x42')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x29c6bd,null))[_0xd9ff('0x25')](removeEntity(_0x29c6bd,null))[_0xd9ff('0x40')](handleError(_0x29c6bd,null));};exports[_0xd9ff('0x47')]=function(_0x43a8ae,_0x1e1364){return db[_0xd9ff('0x2a')][_0xd9ff('0x47')]()[_0xd9ff('0x25')](respondWithResult(_0x1e1364,null))[_0xd9ff('0x40')](handleError(_0x1e1364,null));}; \ No newline at end of file +var _0x1eba=['name','send','WhatsappQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error'];(function(_0x37d239,_0x9890dc){var _0x219891=function(_0xff7ebb){while(--_0xff7ebb){_0x37d239['push'](_0x37d239['shift']());}};_0x219891(++_0x9890dc);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x1eba[_0x220dbb];return _0x2b77de;};'use strict';var emlformat=require(_0xa1eb('0x0'));var rimraf=require(_0xa1eb('0x1'));var zipdir=require(_0xa1eb('0x2'));var jsonpatch=require(_0xa1eb('0x3'));var rp=require(_0xa1eb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa1eb('0x5'));var util=require(_0xa1eb('0x6'));var path=require(_0xa1eb('0x7'));var sox=require(_0xa1eb('0x8'));var csv=require(_0xa1eb('0x9'));var ejs=require(_0xa1eb('0xa'));var fs=require('fs');var fs_extra=require(_0xa1eb('0xb'));var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1eb('0x18'))['db'];function respondWithStatusCode(_0x39b4a3,_0x5df92d){_0x5df92d=_0x5df92d||0xcc;return function(_0x16a623){if(_0x16a623){return _0x39b4a3['sendStatus'](_0x5df92d);}return _0x39b4a3['status'](_0x5df92d)[_0xa1eb('0x19')]();};}function respondWithResult(_0x4c7983,_0x25d058){_0x25d058=_0x25d058||0xc8;return function(_0x2178e2){if(_0x2178e2){return _0x4c7983[_0xa1eb('0x1a')](_0x25d058)[_0xa1eb('0x1b')](_0x2178e2);}};}function respondWithFilteredResult(_0x3cd675,_0x44f37d){return function(_0x1c858c){if(_0x1c858c){var _0x45d6dd=typeof _0x44f37d[_0xa1eb('0x1c')]==='undefined'&&typeof _0x44f37d[_0xa1eb('0x1d')]==='undefined';var _0x1401ef=_0x1c858c[_0xa1eb('0x1e')];var _0x33c4e3=_0x45d6dd?0x0:_0x44f37d[_0xa1eb('0x1c')];var _0x49bfaa=_0x45d6dd?_0x1c858c[_0xa1eb('0x1e')]:_0x44f37d[_0xa1eb('0x1c')]+_0x44f37d[_0xa1eb('0x1d')];var _0xcf45c1;if(_0x49bfaa>=_0x1401ef){_0x49bfaa=_0x1401ef;_0xcf45c1=0xc8;}else{_0xcf45c1=0xce;}_0x3cd675[_0xa1eb('0x1a')](_0xcf45c1);return _0x3cd675[_0xa1eb('0x1f')](_0xa1eb('0x20'),_0x33c4e3+'-'+_0x49bfaa+'/'+_0x1401ef)[_0xa1eb('0x1b')](_0x1c858c);}return null;};}function patchUpdates(_0x4fc14a){return function(_0x137e2c){try{jsonpatch['apply'](_0x137e2c,_0x4fc14a,!![]);}catch(_0x2258d1){return BPromise[_0xa1eb('0x21')](_0x2258d1);}return _0x137e2c[_0xa1eb('0x22')]();};}function saveUpdates(_0x250f99,_0x5e7a34){return function(_0x539634){if(_0x539634){return _0x539634[_0xa1eb('0x23')](_0x250f99)[_0xa1eb('0x24')](function(_0x5b0903){return _0x5b0903;});}return null;};}function removeEntity(_0x437b2a,_0x250728){return function(_0x258d3a){if(_0x258d3a){return _0x258d3a[_0xa1eb('0x25')]()[_0xa1eb('0x24')](function(){_0x437b2a[_0xa1eb('0x1a')](0xcc)[_0xa1eb('0x19')]();});}};}function handleEntityNotFound(_0x364b1c,_0xd7bb88){return function(_0x352796){if(!_0x352796){_0x364b1c[_0xa1eb('0x26')](0x194);}return _0x352796;};}function handleError(_0x208844,_0x57d089){_0x57d089=_0x57d089||0x1f4;return function(_0x7c617e){logger[_0xa1eb('0x27')](_0x7c617e['stack']);if(_0x7c617e[_0xa1eb('0x28')]){delete _0x7c617e['name'];}_0x208844[_0xa1eb('0x1a')](_0x57d089)[_0xa1eb('0x29')](_0x7c617e);};}exports['index']=function(_0x45ff0d,_0x1581ee){var _0x136835={},_0x4f64bb={},_0x12cf56={'count':0x0,'rows':[]};var _0x41b3ad=_['map'](db[_0xa1eb('0x2a')][_0xa1eb('0x2b')],function(_0x401510){return{'name':_0x401510[_0xa1eb('0x2c')],'type':_0x401510[_0xa1eb('0x2d')]['key']};});_0x4f64bb[_0xa1eb('0x2e')]=_[_0xa1eb('0x2f')](_0x41b3ad,_0xa1eb('0x28'));_0x4f64bb[_0xa1eb('0x30')]=_[_0xa1eb('0x31')](_0x45ff0d[_0xa1eb('0x30')]);_0x4f64bb[_0xa1eb('0x32')]=_[_0xa1eb('0x33')](_0x4f64bb[_0xa1eb('0x2e')],_0x4f64bb[_0xa1eb('0x30')]);_0x136835[_0xa1eb('0x34')]=_['intersection'](_0x4f64bb['model'],qs[_0xa1eb('0x35')](_0x45ff0d[_0xa1eb('0x30')][_0xa1eb('0x35')]));_0x136835[_0xa1eb('0x34')]=_0x136835[_0xa1eb('0x34')]['length']?_0x136835['attributes']:_0x4f64bb[_0xa1eb('0x2e')];if(!_0x45ff0d[_0xa1eb('0x30')]['hasOwnProperty']('nolimit')){_0x136835[_0xa1eb('0x1d')]=qs['limit'](_0x45ff0d[_0xa1eb('0x30')]['limit']);_0x136835[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0x45ff0d[_0xa1eb('0x30')]['offset']);}_0x136835[_0xa1eb('0x36')]=qs[_0xa1eb('0x37')](_0x45ff0d[_0xa1eb('0x30')]['sort']);_0x136835[_0xa1eb('0x38')]=qs[_0xa1eb('0x32')](_[_0xa1eb('0x39')](_0x45ff0d[_0xa1eb('0x30')],_0x4f64bb[_0xa1eb('0x32')]),_0x41b3ad);if(_0x45ff0d['query'][_0xa1eb('0x3a')]){_0x136835[_0xa1eb('0x38')]=_[_0xa1eb('0x3b')](_0x136835[_0xa1eb('0x38')],{'$or':_[_0xa1eb('0x2f')](_0x41b3ad,function(_0x2af1d1){if(_0x2af1d1[_0xa1eb('0x2d')]!==_0xa1eb('0x3c')){var _0x53f251={};_0x53f251[_0x2af1d1[_0xa1eb('0x28')]]={'$like':'%'+_0x45ff0d[_0xa1eb('0x30')][_0xa1eb('0x3a')]+'%'};return _0x53f251;}})});}_0x136835=_[_0xa1eb('0x3b')]({},_0x136835,_0x45ff0d[_0xa1eb('0x3d')]);var _0x5bf994={'where':_0x136835[_0xa1eb('0x38')]};return db[_0xa1eb('0x2a')][_0xa1eb('0x1e')](_0x5bf994)['then'](function(_0x334849){_0x12cf56[_0xa1eb('0x1e')]=_0x334849;if(_0x45ff0d[_0xa1eb('0x30')][_0xa1eb('0x3e')]){_0x136835[_0xa1eb('0x3f')]=[{'all':!![]}];}return db[_0xa1eb('0x2a')][_0xa1eb('0x40')](_0x136835);})['then'](function(_0x3c8713){_0x12cf56[_0xa1eb('0x41')]=_0x3c8713;return _0x12cf56;})['then'](respondWithFilteredResult(_0x1581ee,_0x136835))[_0xa1eb('0x42')](handleError(_0x1581ee,null));};exports['show']=function(_0x1744e4,_0x3a6f36){var _0x75f7f6={'raw':!![],'where':{'id':_0x1744e4[_0xa1eb('0x43')]['id']}},_0x361675={};_0x361675[_0xa1eb('0x2e')]=_[_0xa1eb('0x31')](db[_0xa1eb('0x2a')][_0xa1eb('0x2b')]);_0x361675[_0xa1eb('0x30')]=_[_0xa1eb('0x31')](_0x1744e4[_0xa1eb('0x30')]);_0x361675[_0xa1eb('0x32')]=_[_0xa1eb('0x33')](_0x361675[_0xa1eb('0x2e')],_0x361675[_0xa1eb('0x30')]);_0x75f7f6['attributes']=_[_0xa1eb('0x33')](_0x361675['model'],qs[_0xa1eb('0x35')](_0x1744e4[_0xa1eb('0x30')]['fields']));_0x75f7f6['attributes']=_0x75f7f6[_0xa1eb('0x34')][_0xa1eb('0x44')]?_0x75f7f6[_0xa1eb('0x34')]:_0x361675['model'];if(_0x1744e4[_0xa1eb('0x30')][_0xa1eb('0x3e')]){_0x75f7f6[_0xa1eb('0x3f')]=[{'all':!![]}];}_0x75f7f6=_[_0xa1eb('0x3b')]({},_0x75f7f6,_0x1744e4[_0xa1eb('0x3d')]);return db[_0xa1eb('0x2a')][_0xa1eb('0x45')](_0x75f7f6)[_0xa1eb('0x24')](handleEntityNotFound(_0x3a6f36,null))[_0xa1eb('0x24')](respondWithResult(_0x3a6f36,null))[_0xa1eb('0x42')](handleError(_0x3a6f36,null));};exports[_0xa1eb('0x46')]=function(_0x393f95,_0x39d3c6){return db[_0xa1eb('0x2a')]['create'](_0x393f95[_0xa1eb('0x47')],{})[_0xa1eb('0x24')](respondWithResult(_0x39d3c6,0xc9))[_0xa1eb('0x42')](handleError(_0x39d3c6,null));};exports[_0xa1eb('0x23')]=function(_0x2b0cbf,_0x12dfd4){if(_0x2b0cbf[_0xa1eb('0x47')]['id']){delete _0x2b0cbf['body']['id'];}return db[_0xa1eb('0x2a')][_0xa1eb('0x45')]({'where':{'id':_0x2b0cbf[_0xa1eb('0x43')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x12dfd4,null))[_0xa1eb('0x24')](saveUpdates(_0x2b0cbf[_0xa1eb('0x47')],null))[_0xa1eb('0x24')](respondWithResult(_0x12dfd4,null))[_0xa1eb('0x42')](handleError(_0x12dfd4,null));};exports[_0xa1eb('0x25')]=function(_0x4f7c05,_0x190370){return db['WhatsappQueueReport'][_0xa1eb('0x45')]({'where':{'id':_0x4f7c05['params']['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x190370,null))[_0xa1eb('0x24')](removeEntity(_0x190370,null))[_0xa1eb('0x42')](handleError(_0x190370,null));};exports['describe']=function(_0x3fbd6c,_0xbd9a42){return db['WhatsappQueueReport'][_0xa1eb('0x48')]()[_0xa1eb('0x24')](respondWithResult(_0xbd9a42,null))[_0xa1eb('0x42')](handleError(_0xbd9a42,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 3fedaef..bb44def 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 _0x128a=['rimraf','../../config/environment','exports','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x53a170,_0x1bd757){var _0x1bc761=function(_0x17f04c){while(--_0x17f04c){_0x53a170['push'](_0x53a170['shift']());}};_0x1bc761(++_0x1bd757);}(_0x128a,0xc2));var _0xa128=function(_0x4a96ca,_0x13754e){_0x4a96ca=_0x4a96ca-0x0;var _0x2aed48=_0x128a[_0x4a96ca];return _0x2aed48;};'use strict';var _=require(_0xa128('0x0'));var util=require(_0xa128('0x1'));var logger=require(_0xa128('0x2'))('api');var moment=require(_0xa128('0x3'));var BPromise=require(_0xa128('0x4'));var rp=require(_0xa128('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa128('0x6'));var config=require(_0xa128('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0xa128('0x8')]=function(_0x13410b,_0x12f29b){return _0x13410b['define']('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xa128('0x9'),'fields':[_0xa128('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xef52=['api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x90a171,_0x1b4216){var _0x293595=function(_0x16538b){while(--_0x16538b){_0x90a171['push'](_0x90a171['shift']());}};_0x293595(++_0x1b4216);}(_0xef52,0xe9));var _0x2ef5=function(_0x512e72,_0x49ffe1){_0x512e72=_0x512e72-0x0;var _0x143086=_0xef52[_0x512e72];return _0x143086;};'use strict';var _=require(_0x2ef5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2ef5('0x1'));var moment=require(_0x2ef5('0x2'));var BPromise=require(_0x2ef5('0x3'));var rp=require(_0x2ef5('0x4'));var fs=require('fs');var path=require(_0x2ef5('0x5'));var rimraf=require('rimraf');var config=require(_0x2ef5('0x6'));var attributes=require(_0x2ef5('0x7'));module[_0x2ef5('0x8')]=function(_0x23e609,_0x1d5fe5){return _0x23e609[_0x2ef5('0x9')](_0x2ef5('0xa'),attributes,{'tableName':_0x2ef5('0xb'),'paranoid':![],'indexes':[{'name':_0x2ef5('0xc'),'fields':[_0x2ef5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 19ec0a3..56ec3cf 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 _0xa62f=['rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','WhatsappQueueReport','create','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','body','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2f4667,_0x200e37){var _0x523c94=function(_0x29e021){while(--_0x29e021){_0x2f4667['push'](_0x2f4667['shift']());}};_0x523c94(++_0x200e37);}(_0xa62f,0xbe));var _0xfa62=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa62f[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xfa62('0x0'));var moment=require(_0xfa62('0x1'));var BPromise=require(_0xfa62('0x2'));var rs=require(_0xfa62('0x3'));var fs=require('fs');var Redis=require(_0xfa62('0x4'));var db=require(_0xfa62('0x5'))['db'];var utils=require(_0xfa62('0x6'));var logger=require(_0xfa62('0x7'))(_0xfa62('0x8'));var config=require(_0xfa62('0x9'));var jayson=require(_0xfa62('0xa'));var client=jayson[_0xfa62('0xb')][_0xfa62('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30acfa,_0x2e6a1b,_0x4a0e32){return new BPromise(function(_0x21373c,_0x25889c){return client[_0xfa62('0xd')](_0x30acfa,_0x4a0e32)[_0xfa62('0xe')](function(_0xd7dcca){logger['info'](_0xfa62('0xf'),_0x2e6a1b,_0xfa62('0x10'));logger[_0xfa62('0x11')](_0xfa62('0x12'),_0x2e6a1b,_0xfa62('0x10'),JSON[_0xfa62('0x13')](_0xd7dcca));if(_0xd7dcca['error']){if(_0xd7dcca[_0xfa62('0x14')][_0xfa62('0x15')]===0x1f4){logger[_0xfa62('0x14')](_0xfa62('0xf'),_0x2e6a1b,_0xd7dcca[_0xfa62('0x14')][_0xfa62('0x16')]);return _0x25889c(_0xd7dcca[_0xfa62('0x14')][_0xfa62('0x16')]);}logger['error'](_0xfa62('0xf'),_0x2e6a1b,_0xd7dcca[_0xfa62('0x14')][_0xfa62('0x16')]);return _0x21373c(_0xd7dcca[_0xfa62('0x14')][_0xfa62('0x16')]);}else{logger[_0xfa62('0x17')](_0xfa62('0xf'),_0x2e6a1b,'request\x20sent');_0x21373c(_0xd7dcca[_0xfa62('0x18')]['message']);}})['catch'](function(_0x56e299){logger[_0xfa62('0x14')](_0xfa62('0xf'),_0x2e6a1b,_0x56e299);_0x25889c(_0x56e299);});});}exports['CreateWhatsappQueueReport']=function(_0x52a0d2){var _0x413d18=this;return new Promise(function(_0x52c62d,_0x3302b3){return db[_0xfa62('0x19')][_0xfa62('0x1a')](_0x52a0d2['body'],{'raw':_0x52a0d2['options']?_0x52a0d2[_0xfa62('0x1b')][_0xfa62('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x17401a){logger[_0xfa62('0x17')](_0xfa62('0x1d'),_0x52a0d2);logger[_0xfa62('0x11')](_0xfa62('0x1d'),_0x52a0d2,JSON[_0xfa62('0x13')](_0x17401a));_0x52c62d(_0x17401a);})['catch'](function(_0x3e3f42){logger['error'](_0xfa62('0x1d'),_0x3e3f42[_0xfa62('0x16')],_0x52a0d2);_0x3302b3(_0x413d18[_0xfa62('0x14')](0x1f4,_0x3e3f42[_0xfa62('0x16')]));});});};exports[_0xfa62('0x1e')]=function(_0x4368a0){var _0x2c3e73=this;return new Promise(function(_0x44930a,_0x2365c8){return db[_0xfa62('0x19')]['update'](_0x4368a0[_0xfa62('0x1f')],{'raw':_0x4368a0[_0xfa62('0x1b')]?_0x4368a0['options'][_0xfa62('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4368a0[_0xfa62('0x1b')]?_0x4368a0[_0xfa62('0x1b')]['where']||null:null,'attributes':_0x4368a0[_0xfa62('0x1b')]?_0x4368a0['options']['attributes']||null:null,'limit':_0x4368a0[_0xfa62('0x1b')]?_0x4368a0[_0xfa62('0x1b')]['limit']||null:null})[_0xfa62('0xe')](function(_0x57ef95){logger['info'](_0xfa62('0x1e'),_0x4368a0);logger[_0xfa62('0x11')](_0xfa62('0x1e'),_0x4368a0,JSON[_0xfa62('0x13')](_0x57ef95));_0x44930a(_0x57ef95);})[_0xfa62('0x20')](function(_0x10d930){logger[_0xfa62('0x14')](_0xfa62('0x1e'),_0x10d930['message'],_0x4368a0);_0x2365c8(_0x2c3e73[_0xfa62('0x14')](0x1f4,_0x10d930[_0xfa62('0x16')]));});});}; \ No newline at end of file +var _0x03b5=['info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','debug','UpdateWhatsappQueueReport','update','body','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x57a352,_0xbd7532){var _0x5cd613=function(_0x2e51c4){while(--_0x2e51c4){_0x57a352['push'](_0x57a352['shift']());}};_0x5cd613(++_0xbd7532);}(_0x03b5,0x197));var _0x503b=function(_0x225d0c,_0x171fea){_0x225d0c=_0x225d0c-0x0;var _0x17a85c=_0x03b5[_0x225d0c];return _0x17a85c;};'use strict';var _=require('lodash');var util=require(_0x503b('0x0'));var moment=require(_0x503b('0x1'));var BPromise=require(_0x503b('0x2'));var rs=require(_0x503b('0x3'));var fs=require('fs');var Redis=require(_0x503b('0x4'));var db=require(_0x503b('0x5'))['db'];var utils=require(_0x503b('0x6'));var logger=require(_0x503b('0x7'))(_0x503b('0x8'));var config=require('../../config/environment');var jayson=require(_0x503b('0x9'));var client=jayson[_0x503b('0xa')][_0x503b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b0164,_0x448545,_0x175195){return new BPromise(function(_0xf7aa9a,_0x2ebc1a){return client['request'](_0x4b0164,_0x175195)[_0x503b('0xc')](function(_0x5ae805){logger[_0x503b('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x448545,_0x503b('0xe'));logger['debug'](_0x503b('0xf'),_0x448545,_0x503b('0xe'),JSON[_0x503b('0x10')](_0x5ae805));if(_0x5ae805['error']){if(_0x5ae805['error'][_0x503b('0x11')]===0x1f4){logger[_0x503b('0x12')](_0x503b('0x13'),_0x448545,_0x5ae805['error']['message']);return _0x2ebc1a(_0x5ae805['error'][_0x503b('0x14')]);}logger[_0x503b('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x448545,_0x5ae805[_0x503b('0x12')][_0x503b('0x14')]);return _0xf7aa9a(_0x5ae805[_0x503b('0x12')][_0x503b('0x14')]);}else{logger[_0x503b('0xd')](_0x503b('0x13'),_0x448545,_0x503b('0xe'));_0xf7aa9a(_0x5ae805[_0x503b('0x15')][_0x503b('0x14')]);}})[_0x503b('0x16')](function(_0x9f2737){logger[_0x503b('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x448545,_0x9f2737);_0x2ebc1a(_0x9f2737);});});}exports[_0x503b('0x17')]=function(_0x340c0b){var _0x3c4ff3=this;return new Promise(function(_0x51675a,_0x54088d){return db[_0x503b('0x18')][_0x503b('0x19')](_0x340c0b['body'],{'raw':_0x340c0b[_0x503b('0x1a')]?_0x340c0b[_0x503b('0x1a')][_0x503b('0x1b')]===undefined?!![]:![]:!![]})[_0x503b('0xc')](function(_0x44e4b8){logger[_0x503b('0xd')](_0x503b('0x17'),_0x340c0b);logger[_0x503b('0x1c')](_0x503b('0x17'),_0x340c0b,JSON['stringify'](_0x44e4b8));_0x51675a(_0x44e4b8);})[_0x503b('0x16')](function(_0x373328){logger[_0x503b('0x12')](_0x503b('0x17'),_0x373328[_0x503b('0x14')],_0x340c0b);_0x54088d(_0x3c4ff3[_0x503b('0x12')](0x1f4,_0x373328['message']));});});};exports[_0x503b('0x1d')]=function(_0x3d33c7){var _0x4d9d7a=this;return new Promise(function(_0xf5d57d,_0x25c78e){return db[_0x503b('0x18')][_0x503b('0x1e')](_0x3d33c7[_0x503b('0x1f')],{'raw':_0x3d33c7[_0x503b('0x1a')]?_0x3d33c7[_0x503b('0x1a')][_0x503b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d33c7['options']?_0x3d33c7[_0x503b('0x1a')][_0x503b('0x20')]||null:null,'attributes':_0x3d33c7[_0x503b('0x1a')]?_0x3d33c7[_0x503b('0x1a')][_0x503b('0x21')]||null:null,'limit':_0x3d33c7[_0x503b('0x1a')]?_0x3d33c7[_0x503b('0x1a')][_0x503b('0x22')]||null:null})[_0x503b('0xc')](function(_0x54e765){logger[_0x503b('0xd')](_0x503b('0x1d'),_0x3d33c7);logger[_0x503b('0x1c')](_0x503b('0x1d'),_0x3d33c7,JSON[_0x503b('0x10')](_0x54e765));_0xf5d57d(_0x54e765);})['catch'](function(_0x37a64a){logger[_0x503b('0x12')]('UpdateWhatsappQueueReport',_0x37a64a['message'],_0x3d33c7);_0x25c78e(_0x4d9d7a[_0x503b('0x12')](0x1f4,_0x37a64a[_0x503b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index f2ef6aa..cfe776a 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 _0xaa32=['../../config/environment','./whatsappTransferReport.controller','get','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x718807,_0x549e1f){var _0x1c2ed6=function(_0x2bb0cf){while(--_0x2bb0cf){_0x718807['push'](_0x718807['shift']());}};_0x1c2ed6(++_0x549e1f);}(_0xaa32,0x15e));var _0x2aa3=function(_0x5056d9,_0x1f678c){_0x5056d9=_0x5056d9-0x0;var _0x166f29=_0xaa32[_0x5056d9];return _0x166f29;};'use strict';var multer=require('multer');var util=require(_0x2aa3('0x0'));var path=require(_0x2aa3('0x1'));var timeout=require('connect-timeout');var express=require(_0x2aa3('0x2'));var router=express[_0x2aa3('0x3')]();var fs_extra=require(_0x2aa3('0x4'));var auth=require(_0x2aa3('0x5'));var interaction=require(_0x2aa3('0x6'));var config=require(_0x2aa3('0x7'));var controller=require(_0x2aa3('0x8'));router[_0x2aa3('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2aa3('0x9')](_0x2aa3('0xa'),auth[_0x2aa3('0xb')](),controller['describe']);router[_0x2aa3('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2aa3('0xc')]);router[_0x2aa3('0xd')]('/',auth[_0x2aa3('0xb')](),controller[_0x2aa3('0xe')]);router[_0x2aa3('0xf')](_0x2aa3('0x10'),auth[_0x2aa3('0xb')](),controller[_0x2aa3('0x11')]);router[_0x2aa3('0x12')](_0x2aa3('0x10'),auth['isAuthenticated'](),controller[_0x2aa3('0x13')]);module[_0x2aa3('0x14')]=router; \ No newline at end of file +var _0xf1a7=['index','/describe','describe','get','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','./whatsappTransferReport.controller','isAuthenticated'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xf1a7,0x1c1));var _0x7f1a=function(_0x440bce,_0x38a205){_0x440bce=_0x440bce-0x0;var _0x465166=_0xf1a7[_0x440bce];return _0x465166;};'use strict';var multer=require('multer');var util=require(_0x7f1a('0x0'));var path=require('path');var timeout=require(_0x7f1a('0x1'));var express=require(_0x7f1a('0x2'));var router=express['Router']();var fs_extra=require(_0x7f1a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7f1a('0x4'));var config=require('../../config/environment');var controller=require(_0x7f1a('0x5'));router['get']('/',auth[_0x7f1a('0x6')](),controller[_0x7f1a('0x7')]);router['get'](_0x7f1a('0x8'),auth['isAuthenticated'](),controller[_0x7f1a('0x9')]);router[_0x7f1a('0xa')](_0x7f1a('0xb'),auth['isAuthenticated'](),controller[_0x7f1a('0xc')]);router[_0x7f1a('0xd')]('/',auth[_0x7f1a('0x6')](),controller['create']);router[_0x7f1a('0xe')](_0x7f1a('0xb'),auth[_0x7f1a('0x6')](),controller[_0x7f1a('0xf')]);router[_0x7f1a('0x10')](_0x7f1a('0xb'),auth['isAuthenticated'](),controller[_0x7f1a('0x11')]);module[_0x7f1a('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 17fe0aa..fcdd79e 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 _0x38c9=['agent','queue','DATE','sequelize','exports','STRING','account'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x38c9,0x199));var _0x938c=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0x38c9[_0x597484];return _0x218e64;};'use strict';var Sequelize=require(_0x938c('0x0'));module[_0x938c('0x1')]={'uniqueid':{'type':Sequelize[_0x938c('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x938c('0x3'),_0x938c('0x4'),_0x938c('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x938c('0x6')]}}; \ No newline at end of file +var _0xa664=['queue','exports','STRING','ENUM','account'];(function(_0x2a9687,_0x3ac0e5){var _0xec5f71=function(_0x12301b){while(--_0x12301b){_0x2a9687['push'](_0x2a9687['shift']());}};_0xec5f71(++_0x3ac0e5);}(_0xa664,0x132));var _0x4a66=function(_0x98bc07,_0x310949){_0x98bc07=_0x98bc07-0x0;var _0xa15c02=_0xa664[_0x98bc07];return _0xa15c02;};'use strict';var Sequelize=require('sequelize');module[_0x4a66('0x0')]={'uniqueid':{'type':Sequelize[_0x4a66('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4a66('0x2')](_0x4a66('0x3'),'agent',_0x4a66('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 2d7266f..3d782cd 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 _0x464d=['save','update','then','destroy','end','error','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','catch','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','reject'];(function(_0x3560de,_0x28b150){var _0x2d31c1=function(_0x1c13d9){while(--_0x1c13d9){_0x3560de['push'](_0x3560de['shift']());}};_0x2d31c1(++_0x28b150);}(_0x464d,0x70));var _0xd464=function(_0x4101ce,_0x501e3b){_0x4101ce=_0x4101ce-0x0;var _0x5b9a4a=_0x464d[_0x4101ce];return _0x5b9a4a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd464('0x0'));var zipdir=require(_0xd464('0x1'));var jsonpatch=require(_0xd464('0x2'));var rp=require(_0xd464('0x3'));var moment=require(_0xd464('0x4'));var BPromise=require(_0xd464('0x5'));var Mustache=require(_0xd464('0x6'));var util=require(_0xd464('0x7'));var path=require(_0xd464('0x8'));var sox=require(_0xd464('0x9'));var csv=require(_0xd464('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd464('0xb'));var _=require(_0xd464('0xc'));var squel=require(_0xd464('0xd'));var crypto=require(_0xd464('0xe'));var jsforce=require(_0xd464('0xf'));var deskjs=require(_0xd464('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd464('0x11'));var authService=require(_0xd464('0x12'));var qs=require(_0xd464('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd464('0x14'));var logger=require(_0xd464('0x15'))(_0xd464('0x16'));var utils=require(_0xd464('0x17'));var config=require(_0xd464('0x18'));var licenseUtil=require(_0xd464('0x19'));var db=require(_0xd464('0x1a'))['db'];function respondWithStatusCode(_0x1ded86,_0x394d0a){_0x394d0a=_0x394d0a||0xcc;return function(_0x3174d4){if(_0x3174d4){return _0x1ded86[_0xd464('0x1b')](_0x394d0a);}return _0x1ded86[_0xd464('0x1c')](_0x394d0a)['end']();};}function respondWithResult(_0x24cc6e,_0x39fe99){_0x39fe99=_0x39fe99||0xc8;return function(_0x300ef8){if(_0x300ef8){return _0x24cc6e[_0xd464('0x1c')](_0x39fe99)[_0xd464('0x1d')](_0x300ef8);}};}function respondWithFilteredResult(_0x230ec9,_0x4fa5f5){return function(_0xb50010){if(_0xb50010){var _0x4303c7=typeof _0x4fa5f5[_0xd464('0x1e')]===_0xd464('0x1f')&&typeof _0x4fa5f5['limit']===_0xd464('0x1f');var _0x128caf=_0xb50010[_0xd464('0x20')];var _0x435863=_0x4303c7?0x0:_0x4fa5f5[_0xd464('0x1e')];var _0x37e98c=_0x4303c7?_0xb50010[_0xd464('0x20')]:_0x4fa5f5['offset']+_0x4fa5f5[_0xd464('0x21')];var _0x214d52;if(_0x37e98c>=_0x128caf){_0x37e98c=_0x128caf;_0x214d52=0xc8;}else{_0x214d52=0xce;}_0x230ec9[_0xd464('0x1c')](_0x214d52);return _0x230ec9['set']('Content-Range',_0x435863+'-'+_0x37e98c+'/'+_0x128caf)[_0xd464('0x1d')](_0xb50010);}return null;};}function patchUpdates(_0x73072f){return function(_0xca9502){try{jsonpatch[_0xd464('0x22')](_0xca9502,_0x73072f,!![]);}catch(_0x3695df){return BPromise[_0xd464('0x23')](_0x3695df);}return _0xca9502[_0xd464('0x24')]();};}function saveUpdates(_0x470191,_0x164b64){return function(_0x43bfcd){if(_0x43bfcd){return _0x43bfcd[_0xd464('0x25')](_0x470191)[_0xd464('0x26')](function(_0x44937c){return _0x44937c;});}return null;};}function removeEntity(_0x46666a,_0x2db3e8){return function(_0x2393a5){if(_0x2393a5){return _0x2393a5[_0xd464('0x27')]()[_0xd464('0x26')](function(){_0x46666a[_0xd464('0x1c')](0xcc)[_0xd464('0x28')]();});}};}function handleEntityNotFound(_0x7cb1c6,_0x441ff8){return function(_0x45deff){if(!_0x45deff){_0x7cb1c6[_0xd464('0x1b')](0x194);}return _0x45deff;};}function handleError(_0x44d082,_0x15e45c){_0x15e45c=_0x15e45c||0x1f4;return function(_0x26f08d){logger[_0xd464('0x29')](_0x26f08d['stack']);if(_0x26f08d[_0xd464('0x2a')]){delete _0x26f08d[_0xd464('0x2a')];}_0x44d082['status'](_0x15e45c)['send'](_0x26f08d);};}exports[_0xd464('0x2b')]=function(_0x5cbbff,_0x455682){var _0x8484e8={},_0x1b2b03={},_0x49cc72={'count':0x0,'rows':[]};var _0x4a5b4d=_[_0xd464('0x2c')](db[_0xd464('0x2d')][_0xd464('0x2e')],function(_0x3f79d0){return{'name':_0x3f79d0[_0xd464('0x2f')],'type':_0x3f79d0[_0xd464('0x30')][_0xd464('0x31')]};});_0x1b2b03['model']=_['map'](_0x4a5b4d,_0xd464('0x2a'));_0x1b2b03['query']=_[_0xd464('0x32')](_0x5cbbff[_0xd464('0x33')]);_0x1b2b03[_0xd464('0x34')]=_[_0xd464('0x35')](_0x1b2b03[_0xd464('0x36')],_0x1b2b03[_0xd464('0x33')]);_0x8484e8['attributes']=_[_0xd464('0x35')](_0x1b2b03[_0xd464('0x36')],qs[_0xd464('0x37')](_0x5cbbff[_0xd464('0x33')][_0xd464('0x37')]));_0x8484e8[_0xd464('0x38')]=_0x8484e8[_0xd464('0x38')][_0xd464('0x39')]?_0x8484e8['attributes']:_0x1b2b03['model'];if(!_0x5cbbff[_0xd464('0x33')][_0xd464('0x3a')](_0xd464('0x3b'))){_0x8484e8[_0xd464('0x21')]=qs[_0xd464('0x21')](_0x5cbbff[_0xd464('0x33')][_0xd464('0x21')]);_0x8484e8['offset']=qs['offset'](_0x5cbbff[_0xd464('0x33')]['offset']);}_0x8484e8['order']=qs[_0xd464('0x3c')](_0x5cbbff[_0xd464('0x33')]['sort']);_0x8484e8[_0xd464('0x3d')]=qs[_0xd464('0x34')](_[_0xd464('0x3e')](_0x5cbbff[_0xd464('0x33')],_0x1b2b03[_0xd464('0x34')]),_0x4a5b4d);if(_0x5cbbff['query']['filter']){_0x8484e8[_0xd464('0x3d')]=_['merge'](_0x8484e8[_0xd464('0x3d')],{'$or':_[_0xd464('0x2c')](_0x4a5b4d,function(_0x1e0309){if(_0x1e0309[_0xd464('0x30')]!=='VIRTUAL'){var _0xde7d8a={};_0xde7d8a[_0x1e0309[_0xd464('0x2a')]]={'$like':'%'+_0x5cbbff['query'][_0xd464('0x3f')]+'%'};return _0xde7d8a;}})});}_0x8484e8=_[_0xd464('0x40')]({},_0x8484e8,_0x5cbbff['options']);var _0x2f53cc={'where':_0x8484e8[_0xd464('0x3d')]};return db[_0xd464('0x2d')][_0xd464('0x20')](_0x2f53cc)[_0xd464('0x26')](function(_0x4bbf43){_0x49cc72[_0xd464('0x20')]=_0x4bbf43;if(_0x5cbbff[_0xd464('0x33')][_0xd464('0x41')]){_0x8484e8[_0xd464('0x42')]=[{'all':!![]}];}return db[_0xd464('0x2d')][_0xd464('0x43')](_0x8484e8);})[_0xd464('0x26')](function(_0x2191ad){_0x49cc72['rows']=_0x2191ad;return _0x49cc72;})[_0xd464('0x26')](respondWithFilteredResult(_0x455682,_0x8484e8))[_0xd464('0x44')](handleError(_0x455682,null));};exports['show']=function(_0x23b132,_0x4c2864){var _0x46ec00={'raw':!![],'where':{'id':_0x23b132[_0xd464('0x45')]['id']}},_0x38262f={};_0x38262f[_0xd464('0x36')]=_[_0xd464('0x32')](db[_0xd464('0x2d')][_0xd464('0x2e')]);_0x38262f[_0xd464('0x33')]=_[_0xd464('0x32')](_0x23b132[_0xd464('0x33')]);_0x38262f[_0xd464('0x34')]=_[_0xd464('0x35')](_0x38262f[_0xd464('0x36')],_0x38262f[_0xd464('0x33')]);_0x46ec00[_0xd464('0x38')]=_[_0xd464('0x35')](_0x38262f[_0xd464('0x36')],qs[_0xd464('0x37')](_0x23b132[_0xd464('0x33')][_0xd464('0x37')]));_0x46ec00['attributes']=_0x46ec00['attributes'][_0xd464('0x39')]?_0x46ec00[_0xd464('0x38')]:_0x38262f['model'];if(_0x23b132['query'][_0xd464('0x41')]){_0x46ec00['include']=[{'all':!![]}];}_0x46ec00=_[_0xd464('0x40')]({},_0x46ec00,_0x23b132['options']);return db[_0xd464('0x2d')][_0xd464('0x46')](_0x46ec00)[_0xd464('0x26')](handleEntityNotFound(_0x4c2864,null))[_0xd464('0x26')](respondWithResult(_0x4c2864,null))['catch'](handleError(_0x4c2864,null));};exports[_0xd464('0x47')]=function(_0xc8fecb,_0x5b5613){return db[_0xd464('0x2d')][_0xd464('0x47')](_0xc8fecb[_0xd464('0x48')],{})['then'](respondWithResult(_0x5b5613,0xc9))[_0xd464('0x44')](handleError(_0x5b5613,null));};exports[_0xd464('0x25')]=function(_0xb04d3f,_0x4329f9){if(_0xb04d3f[_0xd464('0x48')]['id']){delete _0xb04d3f[_0xd464('0x48')]['id'];}return db[_0xd464('0x2d')][_0xd464('0x46')]({'where':{'id':_0xb04d3f[_0xd464('0x45')]['id']}})['then'](handleEntityNotFound(_0x4329f9,null))[_0xd464('0x26')](saveUpdates(_0xb04d3f[_0xd464('0x48')],null))[_0xd464('0x26')](respondWithResult(_0x4329f9,null))[_0xd464('0x44')](handleError(_0x4329f9,null));};exports['destroy']=function(_0x5c718d,_0x4e8746){return db[_0xd464('0x2d')][_0xd464('0x46')]({'where':{'id':_0x5c718d[_0xd464('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e8746,null))[_0xd464('0x26')](removeEntity(_0x4e8746,null))['catch'](handleError(_0x4e8746,null));};exports[_0xd464('0x49')]=function(_0x2a47c9,_0x5d8885){return db[_0xd464('0x2d')]['describe']()[_0xd464('0x26')](respondWithResult(_0x5d8885,null))[_0xd464('0x44')](handleError(_0x5d8885,null));}; \ No newline at end of file +var _0x5e11=['json','offset','limit','undefined','count','set','Content-Range','reject','then','error','stack','name','index','WhatsappTransferReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4e29fb,_0x14649b){var _0x5a259c=function(_0x5717ed){while(--_0x5717ed){_0x4e29fb['push'](_0x4e29fb['shift']());}};_0x5a259c(++_0x14649b);}(_0x5e11,0x1a6));var _0x15e1=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x5e11[_0x1daaa9];return _0x1dd221;};'use strict';var emlformat=require(_0x15e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15e1('0x2'));var moment=require(_0x15e1('0x3'));var BPromise=require(_0x15e1('0x4'));var Mustache=require(_0x15e1('0x5'));var util=require(_0x15e1('0x6'));var path=require(_0x15e1('0x7'));var sox=require(_0x15e1('0x8'));var csv=require('to-csv');var ejs=require(_0x15e1('0x9'));var fs=require('fs');var fs_extra=require(_0x15e1('0xa'));var _=require(_0x15e1('0xb'));var squel=require('squel');var crypto=require(_0x15e1('0xc'));var jsforce=require(_0x15e1('0xd'));var deskjs=require(_0x15e1('0xe'));var toCsv=require(_0x15e1('0xf'));var querystring=require('querystring');var Papa=require(_0x15e1('0x10'));var Redis=require('ioredis');var authService=require(_0x15e1('0x11'));var qs=require(_0x15e1('0x12'));var as=require(_0x15e1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x15e1('0x14'))(_0x15e1('0x15'));var utils=require(_0x15e1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x15e1('0x17'));var db=require(_0x15e1('0x18'))['db'];function respondWithStatusCode(_0x5b5f2b,_0xbfe59a){_0xbfe59a=_0xbfe59a||0xcc;return function(_0x2e6cbc){if(_0x2e6cbc){return _0x5b5f2b[_0x15e1('0x19')](_0xbfe59a);}return _0x5b5f2b[_0x15e1('0x1a')](_0xbfe59a)[_0x15e1('0x1b')]();};}function respondWithResult(_0xc86dd8,_0x3436e0){_0x3436e0=_0x3436e0||0xc8;return function(_0xbb69d0){if(_0xbb69d0){return _0xc86dd8[_0x15e1('0x1a')](_0x3436e0)[_0x15e1('0x1c')](_0xbb69d0);}};}function respondWithFilteredResult(_0x3880a7,_0x5ad7af){return function(_0x2f35ca){if(_0x2f35ca){var _0x27978b=typeof _0x5ad7af[_0x15e1('0x1d')]==='undefined'&&typeof _0x5ad7af[_0x15e1('0x1e')]===_0x15e1('0x1f');var _0x1b8b2e=_0x2f35ca[_0x15e1('0x20')];var _0x5b53d4=_0x27978b?0x0:_0x5ad7af['offset'];var _0x4a1fdd=_0x27978b?_0x2f35ca[_0x15e1('0x20')]:_0x5ad7af[_0x15e1('0x1d')]+_0x5ad7af[_0x15e1('0x1e')];var _0x611a24;if(_0x4a1fdd>=_0x1b8b2e){_0x4a1fdd=_0x1b8b2e;_0x611a24=0xc8;}else{_0x611a24=0xce;}_0x3880a7[_0x15e1('0x1a')](_0x611a24);return _0x3880a7[_0x15e1('0x21')](_0x15e1('0x22'),_0x5b53d4+'-'+_0x4a1fdd+'/'+_0x1b8b2e)[_0x15e1('0x1c')](_0x2f35ca);}return null;};}function patchUpdates(_0x3210d9){return function(_0x3824e2){try{jsonpatch['apply'](_0x3824e2,_0x3210d9,!![]);}catch(_0x1f4487){return BPromise[_0x15e1('0x23')](_0x1f4487);}return _0x3824e2['save']();};}function saveUpdates(_0x1b7eaf,_0x122511){return function(_0x292fae){if(_0x292fae){return _0x292fae['update'](_0x1b7eaf)[_0x15e1('0x24')](function(_0xd9850e){return _0xd9850e;});}return null;};}function removeEntity(_0x10e77f,_0x297c67){return function(_0x54b108){if(_0x54b108){return _0x54b108['destroy']()[_0x15e1('0x24')](function(){_0x10e77f[_0x15e1('0x1a')](0xcc)[_0x15e1('0x1b')]();});}};}function handleEntityNotFound(_0x1271aa,_0x6c2d9d){return function(_0x3b0793){if(!_0x3b0793){_0x1271aa['sendStatus'](0x194);}return _0x3b0793;};}function handleError(_0x535f6f,_0x1f58f0){_0x1f58f0=_0x1f58f0||0x1f4;return function(_0x3bc6a0){logger[_0x15e1('0x25')](_0x3bc6a0[_0x15e1('0x26')]);if(_0x3bc6a0[_0x15e1('0x27')]){delete _0x3bc6a0[_0x15e1('0x27')];}_0x535f6f['status'](_0x1f58f0)['send'](_0x3bc6a0);};}exports[_0x15e1('0x28')]=function(_0x3a6757,_0x5196a9){var _0x447828={},_0xdbd1e3={},_0x584583={'count':0x0,'rows':[]};var _0x3fbc07=_['map'](db[_0x15e1('0x29')][_0x15e1('0x2a')],function(_0x4fbb78){return{'name':_0x4fbb78[_0x15e1('0x2b')],'type':_0x4fbb78[_0x15e1('0x2c')]['key']};});_0xdbd1e3[_0x15e1('0x2d')]=_[_0x15e1('0x2e')](_0x3fbc07,_0x15e1('0x27'));_0xdbd1e3['query']=_[_0x15e1('0x2f')](_0x3a6757[_0x15e1('0x30')]);_0xdbd1e3[_0x15e1('0x31')]=_[_0x15e1('0x32')](_0xdbd1e3[_0x15e1('0x2d')],_0xdbd1e3['query']);_0x447828[_0x15e1('0x33')]=_[_0x15e1('0x32')](_0xdbd1e3['model'],qs[_0x15e1('0x34')](_0x3a6757[_0x15e1('0x30')]['fields']));_0x447828['attributes']=_0x447828[_0x15e1('0x33')][_0x15e1('0x35')]?_0x447828['attributes']:_0xdbd1e3['model'];if(!_0x3a6757[_0x15e1('0x30')]['hasOwnProperty'](_0x15e1('0x36'))){_0x447828[_0x15e1('0x1e')]=qs['limit'](_0x3a6757[_0x15e1('0x30')]['limit']);_0x447828[_0x15e1('0x1d')]=qs['offset'](_0x3a6757['query']['offset']);}_0x447828[_0x15e1('0x37')]=qs[_0x15e1('0x38')](_0x3a6757['query'][_0x15e1('0x38')]);_0x447828['where']=qs['filters'](_['pick'](_0x3a6757['query'],_0xdbd1e3[_0x15e1('0x31')]),_0x3fbc07);if(_0x3a6757[_0x15e1('0x30')][_0x15e1('0x39')]){_0x447828[_0x15e1('0x3a')]=_[_0x15e1('0x3b')](_0x447828[_0x15e1('0x3a')],{'$or':_[_0x15e1('0x2e')](_0x3fbc07,function(_0x1be7ed){if(_0x1be7ed[_0x15e1('0x2c')]!==_0x15e1('0x3c')){var _0x2118e2={};_0x2118e2[_0x1be7ed['name']]={'$like':'%'+_0x3a6757['query'][_0x15e1('0x39')]+'%'};return _0x2118e2;}})});}_0x447828=_[_0x15e1('0x3b')]({},_0x447828,_0x3a6757[_0x15e1('0x3d')]);var _0x43a1fc={'where':_0x447828['where']};return db[_0x15e1('0x29')]['count'](_0x43a1fc)[_0x15e1('0x24')](function(_0x147328){_0x584583[_0x15e1('0x20')]=_0x147328;if(_0x3a6757[_0x15e1('0x30')][_0x15e1('0x3e')]){_0x447828[_0x15e1('0x3f')]=[{'all':!![]}];}return db[_0x15e1('0x29')][_0x15e1('0x40')](_0x447828);})[_0x15e1('0x24')](function(_0x309617){_0x584583[_0x15e1('0x41')]=_0x309617;return _0x584583;})[_0x15e1('0x24')](respondWithFilteredResult(_0x5196a9,_0x447828))[_0x15e1('0x42')](handleError(_0x5196a9,null));};exports[_0x15e1('0x43')]=function(_0x2f2279,_0x51ae62){var _0x68052d={'raw':!![],'where':{'id':_0x2f2279[_0x15e1('0x44')]['id']}},_0x3036a5={};_0x3036a5[_0x15e1('0x2d')]=_[_0x15e1('0x2f')](db[_0x15e1('0x29')][_0x15e1('0x2a')]);_0x3036a5['query']=_[_0x15e1('0x2f')](_0x2f2279[_0x15e1('0x30')]);_0x3036a5[_0x15e1('0x31')]=_[_0x15e1('0x32')](_0x3036a5[_0x15e1('0x2d')],_0x3036a5[_0x15e1('0x30')]);_0x68052d[_0x15e1('0x33')]=_[_0x15e1('0x32')](_0x3036a5['model'],qs[_0x15e1('0x34')](_0x2f2279[_0x15e1('0x30')][_0x15e1('0x34')]));_0x68052d[_0x15e1('0x33')]=_0x68052d['attributes'][_0x15e1('0x35')]?_0x68052d[_0x15e1('0x33')]:_0x3036a5[_0x15e1('0x2d')];if(_0x2f2279['query']['includeAll']){_0x68052d[_0x15e1('0x3f')]=[{'all':!![]}];}_0x68052d=_[_0x15e1('0x3b')]({},_0x68052d,_0x2f2279['options']);return db['WhatsappTransferReport']['find'](_0x68052d)[_0x15e1('0x24')](handleEntityNotFound(_0x51ae62,null))[_0x15e1('0x24')](respondWithResult(_0x51ae62,null))[_0x15e1('0x42')](handleError(_0x51ae62,null));};exports[_0x15e1('0x45')]=function(_0x46f6a2,_0x11b0b4){return db[_0x15e1('0x29')][_0x15e1('0x45')](_0x46f6a2[_0x15e1('0x46')],{})['then'](respondWithResult(_0x11b0b4,0xc9))[_0x15e1('0x42')](handleError(_0x11b0b4,null));};exports[_0x15e1('0x47')]=function(_0x27a9fa,_0x104a86){if(_0x27a9fa[_0x15e1('0x46')]['id']){delete _0x27a9fa[_0x15e1('0x46')]['id'];}return db[_0x15e1('0x29')][_0x15e1('0x48')]({'where':{'id':_0x27a9fa[_0x15e1('0x44')]['id']}})[_0x15e1('0x24')](handleEntityNotFound(_0x104a86,null))[_0x15e1('0x24')](saveUpdates(_0x27a9fa[_0x15e1('0x46')],null))['then'](respondWithResult(_0x104a86,null))[_0x15e1('0x42')](handleError(_0x104a86,null));};exports[_0x15e1('0x49')]=function(_0x558022,_0x2e6f23){return db[_0x15e1('0x29')]['find']({'where':{'id':_0x558022[_0x15e1('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e6f23,null))['then'](removeEntity(_0x2e6f23,null))[_0x15e1('0x42')](handleError(_0x2e6f23,null));};exports[_0x15e1('0x4a')]=function(_0x16e66a,_0x57c9a4){return db[_0x15e1('0x29')][_0x15e1('0x4a')]()[_0x15e1('0x24')](respondWithResult(_0x57c9a4,null))[_0x15e1('0x42')](handleError(_0x57c9a4,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 0af7d00..6d9568b 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 _0xe59c=['../../config/environment','exports','define','WhatsappTransferReport','uniqueid','lodash','util','bluebird','request-promise'];(function(_0x4e736a,_0x1d728f){var _0x3f5555=function(_0x53e066){while(--_0x53e066){_0x4e736a['push'](_0x4e736a['shift']());}};_0x3f5555(++_0x1d728f);}(_0xe59c,0xdd));var _0xce59=function(_0x21cb47,_0x201d74){_0x21cb47=_0x21cb47-0x0;var _0xb339e6=_0xe59c[_0x21cb47];return _0xb339e6;};'use strict';var _=require(_0xce59('0x0'));var util=require(_0xce59('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xce59('0x2'));var rp=require(_0xce59('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xce59('0x4'));var attributes=require('./whatsappTransferReport.attributes');module[_0xce59('0x5')]=function(_0x571265,_0x3a3c97){return _0x571265[_0xce59('0x6')](_0xce59('0x7'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xce59('0x8'),'fields':[_0xce59('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5283=['../../config/environment','./whatsappTransferReport.attributes','exports','define','uniqueid','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x6b8a78,_0x471808){var _0x2e3d10=function(_0x1010c7){while(--_0x1010c7){_0x6b8a78['push'](_0x6b8a78['shift']());}};_0x2e3d10(++_0x471808);}(_0x5283,0x1e9));var _0x3528=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0x5283[_0x32f9ca];return _0x52e083;};'use strict';var _=require(_0x3528('0x0'));var util=require('util');var logger=require(_0x3528('0x1'))(_0x3528('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3528('0x3'));var fs=require('fs');var path=require(_0x3528('0x4'));var rimraf=require(_0x3528('0x5'));var config=require(_0x3528('0x6'));var attributes=require(_0x3528('0x7'));module[_0x3528('0x8')]=function(_0x4ccfad,_0x154d34){return _0x4ccfad[_0x3528('0x9')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x3528('0xa'),'fields':[_0x3528('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 6e0a111..b5bdb22 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 _0x978d=['request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x4d456a,_0x38fb40){var _0x4c9230=function(_0x5e4037){while(--_0x5e4037){_0x4d456a['push'](_0x4d456a['shift']());}};_0x4c9230(++_0x38fb40);}(_0x978d,0x128));var _0xd978=function(_0x54448e,_0xa6325b){_0x54448e=_0x54448e-0x0;var _0x3ed951=_0x978d[_0x54448e];return _0x3ed951;};'use strict';var _=require(_0xd978('0x0'));var util=require(_0xd978('0x1'));var moment=require(_0xd978('0x2'));var BPromise=require(_0xd978('0x3'));var rs=require(_0xd978('0x4'));var fs=require('fs');var Redis=require(_0xd978('0x5'));var db=require(_0xd978('0x6'))['db'];var utils=require(_0xd978('0x7'));var logger=require(_0xd978('0x8'))(_0xd978('0x9'));var config=require(_0xd978('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd978('0xb')][_0xd978('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x350b9a,_0x101989,_0x101f6e){return new BPromise(function(_0x37ecc1,_0x46e9db){return client[_0xd978('0xd')](_0x350b9a,_0x101f6e)[_0xd978('0xe')](function(_0x18e386){logger[_0xd978('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x101989,_0xd978('0x10'));logger['debug'](_0xd978('0x11'),_0x101989,'request\x20sent',JSON[_0xd978('0x12')](_0x18e386));if(_0x18e386[_0xd978('0x13')]){if(_0x18e386['error'][_0xd978('0x14')]===0x1f4){logger[_0xd978('0x13')](_0xd978('0x15'),_0x101989,_0x18e386[_0xd978('0x13')]['message']);return _0x46e9db(_0x18e386[_0xd978('0x13')]['message']);}logger[_0xd978('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x101989,_0x18e386['error'][_0xd978('0x16')]);return _0x37ecc1(_0x18e386[_0xd978('0x13')]['message']);}else{logger[_0xd978('0xf')](_0xd978('0x15'),_0x101989,_0xd978('0x10'));_0x37ecc1(_0x18e386[_0xd978('0x17')][_0xd978('0x16')]);}})['catch'](function(_0x23a7d3){logger['error'](_0xd978('0x15'),_0x101989,_0x23a7d3);_0x46e9db(_0x23a7d3);});});} \ No newline at end of file +var _0x4ccf=['WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug'];(function(_0x36ad07,_0x3b71e2){var _0x255c34=function(_0x3819d3){while(--_0x3819d3){_0x36ad07['push'](_0x36ad07['shift']());}};_0x255c34(++_0x3b71e2);}(_0x4ccf,0x9a));var _0xf4cc=function(_0x5b867b,_0x3cc0df){_0x5b867b=_0x5b867b-0x0;var _0x631fee=_0x4ccf[_0x5b867b];return _0x631fee;};'use strict';var _=require('lodash');var util=require(_0xf4cc('0x0'));var moment=require(_0xf4cc('0x1'));var BPromise=require(_0xf4cc('0x2'));var rs=require(_0xf4cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf4cc('0x4'));var logger=require(_0xf4cc('0x5'))(_0xf4cc('0x6'));var config=require(_0xf4cc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf4cc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2def9b,_0x4b1d30,_0x1b60f1){return new BPromise(function(_0x96fab4,_0x26a545){return client[_0xf4cc('0x9')](_0x2def9b,_0x1b60f1)[_0xf4cc('0xa')](function(_0x4b29b4){logger[_0xf4cc('0xb')](_0xf4cc('0xc'),_0x4b1d30,'request\x20sent');logger[_0xf4cc('0xd')](_0xf4cc('0xe'),_0x4b1d30,_0xf4cc('0xf'),JSON[_0xf4cc('0x10')](_0x4b29b4));if(_0x4b29b4[_0xf4cc('0x11')]){if(_0x4b29b4['error'][_0xf4cc('0x12')]===0x1f4){logger[_0xf4cc('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4b1d30,_0x4b29b4[_0xf4cc('0x11')][_0xf4cc('0x13')]);return _0x26a545(_0x4b29b4[_0xf4cc('0x11')]['message']);}logger[_0xf4cc('0x11')](_0xf4cc('0xc'),_0x4b1d30,_0x4b29b4[_0xf4cc('0x11')][_0xf4cc('0x13')]);return _0x96fab4(_0x4b29b4[_0xf4cc('0x11')][_0xf4cc('0x13')]);}else{logger[_0xf4cc('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4b1d30,'request\x20sent');_0x96fab4(_0x4b29b4[_0xf4cc('0x14')][_0xf4cc('0x13')]);}})['catch'](function(_0x5293f2){logger[_0xf4cc('0x11')](_0xf4cc('0xc'),_0x4b1d30,_0x5293f2);_0x26a545(_0x5293f2);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 13a94db..1324446 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x891b=['./config/schedule/chat','./config/schedule/transcribe','then','seedDB','default','listen','info','start','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','filter','online','join','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./config/seedDB','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/schedule'];(function(_0x2bf14b,_0x409fc8){var _0x32f2d4=function(_0x1f5602){while(--_0x1f5602){_0x2bf14b['push'](_0x2bf14b['shift']());}};_0x32f2d4(++_0x409fc8);}(_0x891b,0xc5));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var db=require('./mysqldb')['db'];var seedDb=require(_0xb891('0x0'));var checkLicense=require(_0xb891('0x1'));var rpc=require('./rpc');var config=require(_0xb891('0x2'));var logger=require(_0xb891('0x3'))(_0xb891('0x4'));var pm2=require(_0xb891('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xb891('0x6'));var chat=require(_0xb891('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xb891('0x8'));var provider=require('./config/schedule/cloud-provider');function main(){return db['sequelize']['sync']()[_0xb891('0x9')](function(){if(config[_0xb891('0xa')]){return seedDb[_0xb891('0xb')]();}})[_0xb891('0x9')](function(){return checkLicense[_0xb891('0xb')]();})[_0xb891('0x9')](function(){return rpc[_0xb891('0xc')]();})['then'](function(_0x160c03){logger[_0xb891('0xd')](_0x160c03);return chat[_0xb891('0xe')]();})[_0xb891('0x9')](function(){return whatsapp[_0xb891('0xe')]();})[_0xb891('0x9')](function(){return schedule[_0xb891('0xe')]();})[_0xb891('0x9')](function(){return transcribe[_0xb891('0xe')]();})[_0xb891('0x9')](function(){return provider[_0xb891('0xe')]();})['then'](function(_0x3d456b){logger[_0xb891('0xd')](_0x3d456b);return pm2[_0xb891('0xe')](pm2Config);})['then'](function(_0x3fe2a0){var _0x2abd19=_0x3fe2a0['filter'](function(_0xca0294){return typeof _0xca0294['exitCode']===_0xb891('0xf')&&_0xca0294[_0xb891('0x10')]>=0x0;});if(_0x2abd19[_0xb891('0x11')]>0x0){throw new Error(_0x2abd19[_0xb891('0x11')]+_0xb891('0x12')+_[_0xb891('0x13')](_0x2abd19,function(_0x592f48){return'\x22'+_0x592f48['pm2_env'][_0xb891('0x14')]+'\x22';}));}logger[_0xb891('0xd')](_0xb891('0x15'),_[_0xb891('0x13')](_[_0xb891('0x16')](_0x3fe2a0,{'status':_0xb891('0x17')}),_0xb891('0x14'))[_0xb891('0x18')]());logger['info']('Offline\x20apps:',_[_0xb891('0x13')](_['filter'](_0x3fe2a0,function(_0x2d9995){return _0x2d9995[_0xb891('0x19')]!=='online';}),_0xb891('0x14'))['join']()||_0xb891('0x1a'));console[_0xb891('0x1b')](_0xb891('0x1c'));})[_0xb891('0x1d')](function(_0x32c4d2){console[_0xb891('0x1b')](_0xb891('0x1e'),_0x32c4d2);logger[_0xb891('0x1f')](_0xb891('0x20'),_0x32c4d2);process[_0xb891('0x21')](0x1);});}main(); \ No newline at end of file +var _0x7dee=['Offline\x20apps:','log','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','listen','info','start','exitCode','number','length','map','Online\x20apps:','filter','online','name','join'];(function(_0x5bb1e3,_0x51efec){var _0x18fac5=function(_0x5600b3){while(--_0x5600b3){_0x5bb1e3['push'](_0x5bb1e3['shift']());}};_0x18fac5(++_0x51efec);}(_0x7dee,0xb0));var _0xe7de=function(_0x4b0e42,_0x3e8740){_0x4b0e42=_0x4b0e42-0x0;var _0x5b2c29=_0x7dee[_0x4b0e42];return _0x5b2c29;};'use strict';var _=require(_0xe7de('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xe7de('0x1'));var checkLicense=require('./config/license');var rpc=require(_0xe7de('0x2'));var config=require(_0xe7de('0x3'));var logger=require(_0xe7de('0x4'))(_0xe7de('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0xe7de('0x6'));var schedule=require('./config/schedule');var chat=require(_0xe7de('0x7'));var whatsapp=require(_0xe7de('0x8'));var transcribe=require(_0xe7de('0x9'));var provider=require(_0xe7de('0xa'));function main(){return db[_0xe7de('0xb')][_0xe7de('0xc')]()['then'](function(){if(config[_0xe7de('0xd')]){return seedDb[_0xe7de('0xe')]();}})[_0xe7de('0xf')](function(){return checkLicense[_0xe7de('0xe')]();})['then'](function(){return rpc[_0xe7de('0x10')]();})[_0xe7de('0xf')](function(_0x2a2042){logger[_0xe7de('0x11')](_0x2a2042);return chat[_0xe7de('0x12')]();})[_0xe7de('0xf')](function(){return whatsapp[_0xe7de('0x12')]();})['then'](function(){return schedule[_0xe7de('0x12')]();})[_0xe7de('0xf')](function(){return transcribe[_0xe7de('0x12')]();})[_0xe7de('0xf')](function(){return provider[_0xe7de('0x12')]();})['then'](function(_0x1cb4cf){logger[_0xe7de('0x11')](_0x1cb4cf);return pm2[_0xe7de('0x12')](pm2Config);})[_0xe7de('0xf')](function(_0xe68b48){var _0x752cb2=_0xe68b48['filter'](function(_0x4b70ab){return typeof _0x4b70ab[_0xe7de('0x13')]===_0xe7de('0x14')&&_0x4b70ab[_0xe7de('0x13')]>=0x0;});if(_0x752cb2[_0xe7de('0x15')]>0x0){throw new Error(_0x752cb2[_0xe7de('0x15')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xe7de('0x16')](_0x752cb2,function(_0x4b1648){return'\x22'+_0x4b1648['pm2_env']['name']+'\x22';}));}logger[_0xe7de('0x11')](_0xe7de('0x17'),_['map'](_[_0xe7de('0x18')](_0xe68b48,{'status':_0xe7de('0x19')}),_0xe7de('0x1a'))[_0xe7de('0x1b')]());logger[_0xe7de('0x11')](_0xe7de('0x1c'),_[_0xe7de('0x16')](_[_0xe7de('0x18')](_0xe68b48,function(_0x1c6fa6){return _0x1c6fa6['status']!==_0xe7de('0x19');}),_0xe7de('0x1a'))[_0xe7de('0x1b')]()||'None');console[_0xe7de('0x1d')]('App\x20Ready!');})[_0xe7de('0x1e')](function(_0x110dec){console[_0xe7de('0x1d')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x110dec);logger[_0xe7de('0x1f')](_0xe7de('0x20'),_0x110dec);process[_0xe7de('0x21')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 7b2be76..f70ed2b 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 _0x00bb=['lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','use','user','findOne','params','disposition','then','closed','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','Basic','User','find','pass','status','Wrong\x20credentials.','Bearer','json','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','Setting','allowedLoginAttempts','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','options','verify','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','secrets','session','role','fullname','name','internal','permissions','md5secret','voicePause','chatPause','mailPause','smsPause'];(function(_0x255021,_0x4a7b8f){var _0x431921=function(_0x14a500){while(--_0x14a500){_0x255021['push'](_0x255021['shift']());}};_0x431921(++_0x4a7b8f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00bb[_0x4cf98e];return _0x1623ac;};'use strict';var db=require(_0xb00b('0x0'))['db'];var config=require(_0xb00b('0x1'));var hardwareConf=require(_0xb00b('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xb00b('0x3'));var _=require('lodash');var jwt=require(_0xb00b('0x4'));var expressJwt=require(_0xb00b('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0xb00b('0x6'));var crypto=require(_0xb00b('0x7'));var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb00b('0x8')][_0xb00b('0x9')]});var userAttributes=['id',_0xb00b('0xa'),_0xb00b('0xb'),_0xb00b('0xc'),_0xb00b('0xd'),'email','userpic',_0xb00b('0xe'),_0xb00b('0xf'),_0xb00b('0x10'),_0xb00b('0x11'),_0xb00b('0x12'),'faxPause',_0xb00b('0x13'),'openchannelPause','pauseType','showWebBar',_0xb00b('0x14'),_0xb00b('0x15'),_0xb00b('0x16'),_0xb00b('0x17'),_0xb00b('0x18'),_0xb00b('0x19'),'phoneBarAutoAnswer',_0xb00b('0x1a'),_0xb00b('0x1b'),'phoneBarEnableRecording',_0xb00b('0x1c'),_0xb00b('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0xb00b('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xb00b('0x1f'),_0xb00b('0x20'),_0xb00b('0x21'),_0xb00b('0x22'),'wssPort',_0xb00b('0x23'),'downloadOmnichannelInteractions',_0xb00b('0x24'),'ignorePauseForPreviewCalls',_0xb00b('0x25'),'chatAutoanswer',_0xb00b('0x26'),_0xb00b('0x27'),'emailAutoanswerDelay','smsAutoanswer',_0xb00b('0x28'),'openchannelAutoanswer',_0xb00b('0x29'),_0xb00b('0x2a'),_0xb00b('0x2b'),_0xb00b('0x2c'),'whatsappAutoanswerDelay'];exports[_0xb00b('0x2d')]=function(){return this['isAuthenticated'](!![])[_0xb00b('0x2e')](function(_0x121ec7,_0x51b841,_0x231293){if(_0x121ec7[_0xb00b('0x2f')]){_0x231293();}else{return db['ChatInteraction'][_0xb00b('0x30')]({'where':{'id':_0x121ec7[_0xb00b('0x31')]['id']},'attributes':['id','closed',_0xb00b('0x32')],'raw':!![]})[_0xb00b('0x33')](function(_0x3c9500){if(_0x3c9500&&_0x3c9500[_0xb00b('0x34')]){return _0x51b841['status'](_0x3c9500['disposition']===_0xb00b('0x35')?0x195:0x193)['json']({'message':_0x3c9500['disposition']==='unmanaged'?_0xb00b('0x36'):_0xb00b('0x37')});}else{_0x231293();}})[_0xb00b('0x38')](function(_0x3825af){_0x231293(_0x3825af);});}});};exports[_0xb00b('0x39')]=function isAuthenticated(_0x197379){return compose()[_0xb00b('0x2e')](function(_0x4a8d2b,_0x22c22d,_0x503c9c){var _0x450129;if(_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')]){if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x3c'))){var _0x183233=basicAuth(_0x4a8d2b);db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'name':_0x183233[_0xb00b('0xc')]}})[_0xb00b('0x33')](function(_0x149c1a){if(!_0x149c1a||!_0x149c1a['authenticate'](_0x183233[_0xb00b('0x3f')])){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x41')});}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x149c1a['id']};_0x503c9c();})['catch'](function(_0x456241){_0x503c9c(_0x456241);});}else if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x42'))){validateJwt(_0x4a8d2b,_0x22c22d,_0x503c9c);}else{if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x44')});}}}else if(_0x4a8d2b[_0xb00b('0x45')]['apikey']){try{var _0x57e8f9={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};verifyJwt(_0x4a8d2b[_0xb00b('0x45')][_0xb00b('0x47')],_0x57e8f9)[_0xb00b('0x33')](function(_0x5cfa60){return db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0x5cfa60[_0xb00b('0x48')]}})[_0xb00b('0x33')](function(_0x261c80){_0x450129=_0x261c80;return db[_0xb00b('0x49')][_0xb00b('0x30')]({'where':{'id':0x1},'attributes':[_0xb00b('0x4a'),'blockDuration'],'raw':!![]});})['then'](function(_0x2ea41d){if(!_0x450129||!_['isEqual'](_0x450129[_0xb00b('0x4b')],_0x5cfa60[_0xb00b('0x4c')])){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4d')});}if(_0x450129[_0xb00b('0x4e')]){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x4f')});}if(_0x450129[_0xb00b('0x50')]){if(_0x2ea41d[_0xb00b('0x51')]>0x0){if(moment(_0x450129[_0xb00b('0x52')])[_0xb00b('0x53')](_0x2ea41d[_0xb00b('0x51')],'minutes')>moment()){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});}}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x450129['id']};_0x503c9c();});})[_0xb00b('0x38')](function(){return _0x22c22d['status'](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});});}catch(_0xb76ede){_0x503c9c(_0xb76ede);}}else if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0xb00b('0x2e')](function(_0xf6ae0c,_0x10a348,_0x152437){if(_0xf6ae0c[_0xb00b('0x2f')]){db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0xf6ae0c['user']['id']},'attributes':userAttributes})[_0xb00b('0x33')](function(_0x3b72c4){if(!_0x3b72c4){return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x54')});}_0xf6ae0c[_0xb00b('0x2f')]=_0x3b72c4;_0x152437();})[_0xb00b('0x38')](function(_0x974a29){_0x152437(_0x974a29);});}else if(_0x197379){_0x152437();}else{return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x55')});}});};exports[_0xb00b('0x56')]=function canUpdate(){return compose()['use'](function(_0x3da23c,_0x35a0ba,_0xd07fb8){return licenseUtil[_0xb00b('0x57')]()[_0xb00b('0x33')](function(_0x2d9174){if(_0x2d9174[_0xb00b('0x58')]){_0xd07fb8();}else{return _0x35a0ba[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x59')});}})[_0xb00b('0x38')](function(_0x3b3031){_0xd07fb8(_0x3b3031);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x47c6c0,_0x3f8f60,_0x23d858){return licenseUtil['getLicense']()[_0xb00b('0x33')](function(_0x3c0fa){if(_0x3c0fa[_0xb00b('0x5a')]){_0x23d858();}else{return _0x3f8f60[_0xb00b('0x40')](0x193)['json']({'message':'Forbidden'});}})[_0xb00b('0x38')](function(_0x40c2fd){_0x23d858(_0x40c2fd);});});};exports['isMiddleware']=function(_0x514c5b,_0x154759,_0x3a205d){_0x514c5b['isMiddleware']=!![];return _0x3a205d();};exports[_0xb00b('0x5b')]=function signToken(_0x47a814){return signJwt(_0x47a814);};exports['setTokenCookie']=function(_0x4bcc9e,_0x465d90){if(!_0x4bcc9e['user']){return _0x465d90[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x5c')});}var _0xe724a5={'payload':{'id':_0x4bcc9e[_0xb00b('0x2f')]['id'],'role':_0x4bcc9e[_0xb00b('0x2f')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0xe724a5)['then'](function(_0x1d2a0d){_0x465d90[_0xb00b('0x5d')]('motion.token',_0x1d2a0d);_0x465d90[_0xb00b('0x5e')](_0xb00b('0x5f'));})['catch'](function(_0x15dcbf){return _0x465d90[_0xb00b('0x40')](0x1f4)[_0xb00b('0x60')](_0x15dcbf);});};exports['retrieveApiKey']=function(_0x501cbe){if(_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x4b')])||_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x62')])){return null;}else{return createJwt(_0x501cbe);}};exports['generateApiKey']=function(_0x380acb){_0x380acb[_0xb00b('0x4b')]=generateNonce();_0x380acb['apiKeyIat']=generateIssuedAt();return createJwt(_0x380acb);};exports['regenerateApiKey']=function(_0x160965,_0x524b05){var _0x1ab196=_0x160965[_0xb00b('0x45')][_0xb00b('0x47')];if(_0x1ab196){var _0x222459={'nonce':_0x524b05[_0xb00b('0x4b')],'iat':_0x524b05[_0xb00b('0x62')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};return verifyJwt(_0x1ab196,_0x222459)['then'](function(){return generateApiKey(_0x524b05);});}else{throw{'message':_0xb00b('0x63')};}};exports[_0xb00b('0x64')]=function(_0x4129ba){var _0x5ac79e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5ac79e[_0xb00b('0x65')](_0x4129ba))throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))]('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[_0xb00b('0x68')]=function(_0x309ae6,_0x219b74,_0x385029){var _0x131848=encryptor[_0xb00b('0x69')](_0x219b74)[_0xb00b('0x6a')](',');for(var _0x3a0b90=0x0;_0x3a0b90<_0x385029;_0x3a0b90++){if(!_0x131848[_0x3a0b90])break;if(_0x309ae6['toLowerCase']()===_0x131848[_0x3a0b90][_0xb00b('0x6b')]()){var _0x2cbe80=util[_0xb00b('0x6c')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x385029);if(_0x385029===0x1){_0x2cbe80=_0xb00b('0x6d');}throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))](_0x2cbe80);}}return;};exports[_0xb00b('0x6e')]=function(_0x1ad387,_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b?encryptor[_0xb00b('0x69')](_0x4bfe0b)[_0xb00b('0x6a')](','):[];if(_0xfd4ecc[_0xb00b('0x6f')]===0x5){_0xfd4ecc['splice'](-0x1,0x1);}_0xfd4ecc[_0xb00b('0x70')](_0x1ad387);return encryptor[_0xb00b('0x71')](_0xfd4ecc[_0xb00b('0x72')](','));};function signJwt(_0x2d73bb){var _0x161216=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x74')],{'context':jwt});var _0x542223=_0x2d73bb[_0xb00b('0x75')]||config['secrets'][_0xb00b('0x9')];return new BPromise(function(_0x4c2186,_0x3b3272){_0x161216(_0x2d73bb['payload'],_0x542223,_0x2d73bb[_0xb00b('0x76')])['then'](function(_0x3dffaf){_0x4c2186(_0x3dffaf);})[_0xb00b('0x38')](function(_0x3bae02){_0x3b3272(_0x3bae02);});});}function verifyJwt(_0x4d1cec,_0x51fbe2,_0x4f7a59){var _0x21a53d=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x77')],{'context':jwt});var _0x49246b=_0x4f7a59||config[_0xb00b('0x8')][_0xb00b('0x9')];return new BPromise(function(_0xca87d4,_0x2ddba4){_0x21a53d(_0x4d1cec,_0x49246b,_0x51fbe2)[_0xb00b('0x33')](function(_0x485033){_0xca87d4(_0x485033);})[_0xb00b('0x38')](function(_0x27b13b){_0x2ddba4(_0x27b13b);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xb00b('0x78')](_0xb00b('0x79'));}function generateIssuedAt(){return Math[_0xb00b('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x359669){var _0x188da7={'payload':{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x359669['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xb00b('0x46')]()}};return signJwt(_0x188da7)['then'](function(_0x2434a0){return{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce'],'token':_0x2434a0};});} \ No newline at end of file +var _0xa9e0=['role','redirect','/dashboards/general','send','retrieveApiKey','apiKeyIat','generateApiKey','regenerateApiKey','apiKeyNonce','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','decryptString','length','unshift','encryptString','promisify','payload','options','verify','randomBytes','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','name','userpic','permissions','md5secret','voicePause','chatPause','mailPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','use','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','catch','isAuthenticated','headers','startsWith','authorization','Basic','User','find','authenticate','pass','status','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'];(function(_0x389148,_0x4d19e0){var _0x4823ce=function(_0x513937){while(--_0x513937){_0x389148['push'](_0x389148['shift']());}};_0x4823ce(++_0x4d19e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var db=require(_0x0a9e('0x0'))['db'];var config=require(_0x0a9e('0x1'));var hardwareConf=require(_0x0a9e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x0a9e('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x0a9e('0x4'));var compose=require(_0x0a9e('0x5'));var basicAuth=require(_0x0a9e('0x6'));var crypto=require(_0x0a9e('0x7'));var BPromise=require(_0x0a9e('0x8'));var util=require('util');var moment=require(_0x0a9e('0x9'));var validateJwt=expressJwt({'secret':config[_0x0a9e('0xa')][_0x0a9e('0xb')]});var userAttributes=['id','role','fullname',_0x0a9e('0xc'),'internal','email',_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),_0x0a9e('0x11'),_0x0a9e('0x12'),'faxPause','smsPause','openchannelPause','pauseType',_0x0a9e('0x13'),_0x0a9e('0x14'),_0x0a9e('0x15'),_0x0a9e('0x16'),_0x0a9e('0x17'),_0x0a9e('0x18'),'alias',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'phoneBarExpires',_0x0a9e('0x1f'),'phoneBarRemoteControl',_0x0a9e('0x20'),'hotdesk',_0x0a9e('0x21'),_0x0a9e('0x22'),'privacyEnabled',_0x0a9e('0x23'),'wssPort',_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28'),_0x0a9e('0x29'),_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x0a9e('0x2c'),_0x0a9e('0x2d'),_0x0a9e('0x2e'),_0x0a9e('0x2f'),'openchannelAutoanswerDelay',_0x0a9e('0x30'),_0x0a9e('0x31'),'whatsappAutoanswer',_0x0a9e('0x32')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x0a9e('0x33')](function(_0x432e56,_0x38e7c4,_0x30bae6){if(_0x432e56['user']){_0x30bae6();}else{return db[_0x0a9e('0x34')][_0x0a9e('0x35')]({'where':{'id':_0x432e56[_0x0a9e('0x36')]['id']},'attributes':['id',_0x0a9e('0x37'),_0x0a9e('0x38')],'raw':!![]})[_0x0a9e('0x39')](function(_0x16b1ca){if(_0x16b1ca&&_0x16b1ca['closed']){return _0x38e7c4['status'](_0x16b1ca[_0x0a9e('0x38')]===_0x0a9e('0x3a')?0x195:0x193)[_0x0a9e('0x3b')]({'message':_0x16b1ca[_0x0a9e('0x38')]==='unmanaged'?_0x0a9e('0x3c'):'Forbidden.'});}else{_0x30bae6();}})[_0x0a9e('0x3d')](function(_0x5bfb33){_0x30bae6(_0x5bfb33);});}});};exports[_0x0a9e('0x3e')]=function isAuthenticated(_0x34dc65){return compose()[_0x0a9e('0x33')](function(_0x14433c,_0x140511,_0x1538a4){var _0x11c3b6;if(_0x14433c[_0x0a9e('0x3f')]['authorization']){if(_[_0x0a9e('0x40')](_0x14433c[_0x0a9e('0x3f')][_0x0a9e('0x41')],_0x0a9e('0x42'))){var _0x5c877d=basicAuth(_0x14433c);db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'name':_0x5c877d[_0x0a9e('0xc')]}})[_0x0a9e('0x39')](function(_0x58b06f){if(!_0x58b06f||!_0x58b06f[_0x0a9e('0x45')](_0x5c877d[_0x0a9e('0x46')])){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':'Wrong\x20credentials.'});}_0x14433c[_0x0a9e('0x48')]={'id':_0x58b06f['id']};_0x1538a4();})['catch'](function(_0x2407f9){_0x1538a4(_0x2407f9);});}else if(_[_0x0a9e('0x40')](_0x14433c[_0x0a9e('0x3f')][_0x0a9e('0x41')],_0x0a9e('0x49'))){validateJwt(_0x14433c,_0x140511,_0x1538a4);}else{if(_0x34dc65){_0x1538a4();}else{return _0x140511['status'](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x4a')});}}}else if(_0x14433c[_0x0a9e('0x4b')][_0x0a9e('0x4c')]){try{var _0x2b45ea={'audience':hardwareConf[_0x0a9e('0x4d')](),'issuer':hardwareConf[_0x0a9e('0x4d')]()};verifyJwt(_0x14433c[_0x0a9e('0x4b')]['apikey'],_0x2b45ea)[_0x0a9e('0x39')](function(_0x5e7238){return db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'id':_0x5e7238[_0x0a9e('0x4e')]}})[_0x0a9e('0x39')](function(_0x567193){_0x11c3b6=_0x567193;return db[_0x0a9e('0x4f')][_0x0a9e('0x35')]({'where':{'id':0x1},'attributes':[_0x0a9e('0x50'),_0x0a9e('0x51')],'raw':!![]});})['then'](function(_0x54135e){if(!_0x11c3b6||!_[_0x0a9e('0x52')](_0x11c3b6['apiKeyNonce'],_0x5e7238[_0x0a9e('0x53')])){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x54')});}if(_0x11c3b6['disabled']){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});}if(_0x11c3b6['blocked']){if(_0x54135e[_0x0a9e('0x51')]>0x0){if(moment(_0x11c3b6[_0x0a9e('0x56')])[_0x0a9e('0x57')](_0x54135e['blockDuration'],'minutes')>moment()){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});}}_0x14433c[_0x0a9e('0x48')]={'id':_0x11c3b6['id']};_0x1538a4();});})['catch'](function(){return _0x140511['status'](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});});}catch(_0x53f3ee){_0x1538a4(_0x53f3ee);}}else if(_0x34dc65){_0x1538a4();}else{return _0x140511[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x4a')});}})['use'](function(_0x316c8f,_0x2cfea9,_0x274e8e){if(_0x316c8f[_0x0a9e('0x48')]){db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'id':_0x316c8f[_0x0a9e('0x48')]['id']},'attributes':userAttributes})[_0x0a9e('0x39')](function(_0x23b089){if(!_0x23b089){return _0x2cfea9[_0x0a9e('0x47')](0x194)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x58')});}_0x316c8f[_0x0a9e('0x48')]=_0x23b089;_0x274e8e();})[_0x0a9e('0x3d')](function(_0x37f6cc){_0x274e8e(_0x37f6cc);});}else if(_0x34dc65){_0x274e8e();}else{return _0x2cfea9['status'](0x194)['json']({'message':_0x0a9e('0x59')});}});};exports[_0x0a9e('0x5a')]=function canUpdate(){return compose()[_0x0a9e('0x33')](function(_0x315881,_0x1a69dd,_0xc9a702){return licenseUtil[_0x0a9e('0x5b')]()[_0x0a9e('0x39')](function(_0x432fcc){if(_0x432fcc[_0x0a9e('0x5c')]){_0xc9a702();}else{return _0x1a69dd[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':'Forbidden'});}})[_0x0a9e('0x3d')](function(_0x138b8b){_0xc9a702(_0x138b8b);});});};exports[_0x0a9e('0x5d')]=function isWebrtcLicence(){return compose()[_0x0a9e('0x33')](function(_0x2e8caf,_0xbe9d19,_0x21eb86){return licenseUtil[_0x0a9e('0x5b')]()['then'](function(_0x2e9d90){if(_0x2e9d90['webrtc']){_0x21eb86();}else{return _0xbe9d19[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x5e')});}})['catch'](function(_0x14bec2){_0x21eb86(_0x14bec2);});});};exports[_0x0a9e('0x5f')]=function(_0x4774f4,_0x34aa5a,_0x45c845){_0x4774f4[_0x0a9e('0x5f')]=!![];return _0x45c845();};exports[_0x0a9e('0x60')]=function signToken(_0x5bbcde){return signJwt(_0x5bbcde);};exports[_0x0a9e('0x61')]=function(_0x1bde3c,_0x1b5e80){if(!_0x1bde3c[_0x0a9e('0x48')]){return _0x1b5e80[_0x0a9e('0x47')](0x194)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x62')});}var _0x19383e={'payload':{'id':_0x1bde3c[_0x0a9e('0x48')]['id'],'role':_0x1bde3c['user'][_0x0a9e('0x63')]},'options':{'expiresIn':0x15180}};return signJwt(_0x19383e)[_0x0a9e('0x39')](function(_0x4f7240){_0x1b5e80['cookie']('motion.token',_0x4f7240);_0x1b5e80[_0x0a9e('0x64')](_0x0a9e('0x65'));})[_0x0a9e('0x3d')](function(_0x11545a){return _0x1b5e80[_0x0a9e('0x47')](0x1f4)[_0x0a9e('0x66')](_0x11545a);});};exports[_0x0a9e('0x67')]=function(_0x375c18){if(_['isNil'](_0x375c18['apiKeyNonce'])||_['isNil'](_0x375c18[_0x0a9e('0x68')])){return null;}else{return createJwt(_0x375c18);}};exports[_0x0a9e('0x69')]=function(_0x14d602){_0x14d602['apiKeyNonce']=generateNonce();_0x14d602[_0x0a9e('0x68')]=generateIssuedAt();return createJwt(_0x14d602);};exports[_0x0a9e('0x6a')]=function(_0x53d113,_0x5a88da){var _0x2ef381=_0x53d113['query'][_0x0a9e('0x4c')];if(_0x2ef381){var _0x4c3845={'nonce':_0x5a88da[_0x0a9e('0x6b')],'iat':_0x5a88da[_0x0a9e('0x68')],'audience':hardwareConf[_0x0a9e('0x4d')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x2ef381,_0x4c3845)[_0x0a9e('0x39')](function(){return generateApiKey(_0x5a88da);});}else{throw{'message':_0x0a9e('0x6c')};}};exports['validatePasswordPattern']=function(_0x50f687){var _0x128aa6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x128aa6[_0x0a9e('0x6d')](_0x50f687))throw new db['Sequelize'][(_0x0a9e('0x6e'))]('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[_0x0a9e('0x6f')]=function(_0x523cd2,_0xe22ccc,_0x4a6deb){var _0x5da27d=encryptor['decryptString'](_0xe22ccc)[_0x0a9e('0x70')](',');for(var _0x47de4c=0x0;_0x47de4c<_0x4a6deb;_0x47de4c++){if(!_0x5da27d[_0x47de4c])break;if(_0x523cd2[_0x0a9e('0x71')]()===_0x5da27d[_0x47de4c][_0x0a9e('0x71')]()){var _0x3cfd00=util[_0x0a9e('0x72')](_0x0a9e('0x73'),_0x4a6deb);if(_0x4a6deb===0x1){_0x3cfd00=_0x0a9e('0x74');}throw new db[(_0x0a9e('0x75'))][(_0x0a9e('0x6e'))](_0x3cfd00);}}return;};exports['updatePasswordsHistory']=function(_0x1c693e,_0x121cef){var _0x2642bb=_0x121cef?encryptor[_0x0a9e('0x76')](_0x121cef)[_0x0a9e('0x70')](','):[];if(_0x2642bb[_0x0a9e('0x77')]===0x5){_0x2642bb['splice'](-0x1,0x1);}_0x2642bb[_0x0a9e('0x78')](_0x1c693e);return encryptor[_0x0a9e('0x79')](_0x2642bb['join'](','));};function signJwt(_0x3649cc){var _0x5cc8fb=BPromise[_0x0a9e('0x7a')](jwt['sign'],{'context':jwt});var _0x4b3c1a=_0x3649cc['secret']||config[_0x0a9e('0xa')]['session'];return new BPromise(function(_0x2244d6,_0x1fc70e){_0x5cc8fb(_0x3649cc[_0x0a9e('0x7b')],_0x4b3c1a,_0x3649cc[_0x0a9e('0x7c')])[_0x0a9e('0x39')](function(_0x26d7db){_0x2244d6(_0x26d7db);})['catch'](function(_0x1627a7){_0x1fc70e(_0x1627a7);});});}function verifyJwt(_0x5854cc,_0xca4ade,_0x1f07cb){var _0x51aaf7=BPromise['promisify'](jwt[_0x0a9e('0x7d')],{'context':jwt});var _0x156f1c=_0x1f07cb||config[_0x0a9e('0xa')][_0x0a9e('0xb')];return new BPromise(function(_0x497d91,_0x1d0dc8){_0x51aaf7(_0x5854cc,_0x156f1c,_0xca4ade)[_0x0a9e('0x39')](function(_0x54327c){_0x497d91(_0x54327c);})[_0x0a9e('0x3d')](function(_0x17e88c){_0x1d0dc8(_0x17e88c);});});}function generateNonce(){return crypto[_0x0a9e('0x7e')](0x10)[_0x0a9e('0x7f')](_0x0a9e('0x80'));}function generateIssuedAt(){return Math['floor'](Date[_0x0a9e('0x81')]()/0x3e8)[_0x0a9e('0x7f')]();}function createJwt(_0x281c7d){var _0x47bb43={'payload':{'iat':_0x281c7d[_0x0a9e('0x68')],'nonce':_0x281c7d['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x281c7d['id'][_0x0a9e('0x7f')](),'issuer':hardwareConf[_0x0a9e('0x4d')](),'audience':hardwareConf[_0x0a9e('0x4d')]()}};return signJwt(_0x47bb43)[_0x0a9e('0x39')](function(_0x186f39){return{'iat':_0x281c7d[_0x0a9e('0x68')],'nonce':_0x281c7d[_0x0a9e('0x6b')],'token':_0x186f39};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 094ecec..9e753ff 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ad7=['fieldType','type','map','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','where','fields','filter','user','clause','tags','skip','checkListsRestrictions','ids','tag','count','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','slice','all','length'];(function(_0x3878bd,_0x51e3e5){var _0x359e60=function(_0xe70276){while(--_0xe70276){_0x3878bd['push'](_0x3878bd['shift']());}};_0x359e60(++_0x51e3e5);}(_0x2ad7,0x16e));var _0x72ad=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2ad7[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var sqlUtils=require(_0x72ad('0x0'));var db=require(_0x72ad('0x1'))['db'];exports['findAll']=function(_0x13b2e8,_0x1e4a68,_0x32913c,_0x21dc6b){var _0x49a827={'count':0x0,'rows':[]};var _0x5b3df8=sqlUtils[_0x72ad('0x2')](_0x1e4a68,_0x13b2e8);if(_0x5b3df8){return Promise[_0x72ad('0x3')](_0x49a827);}var _0x23f1d2=sqlUtils[_0x72ad('0x4')]();var _0x280293={};var _0x1a8759=![];var _0x349062=![];return Promise[_0x72ad('0x3')]()[_0x72ad('0x5')](function(){if(_0x13b2e8['search']){return sqlUtils[_0x72ad('0x6')](_0x13b2e8[_0x72ad('0x7')],_0x21dc6b);}else{return sqlUtils['parseQueryParameters'](_0x13b2e8,_0x21dc6b);}})[_0x72ad('0x5')](function(_0x45a036){_0x23f1d2['where'](_0x45a036['default']);_0x23f1d2[_0x72ad('0x8')](_0x45a036[_0x72ad('0x9')]);_0x23f1d2[_0x72ad('0x8')](_0x45a036[_0x72ad('0xa')]);_0x23f1d2[_0x72ad('0x8')](_0x45a036[_0x72ad('0xb')][_0x72ad('0xc')]);_0x280293=_0x45a036[_0x72ad('0xd')];_0x349062=_0x45a036['user'][_0x72ad('0xe')];return sqlUtils[_0x72ad('0xf')](_0x1e4a68,_0x13b2e8,_0x349062);})[_0x72ad('0x5')](function(_0x247b34){_0x23f1d2[_0x72ad('0x8')](_0x247b34);var _0x3f7fe2=_0x13b2e8['search']?_0x280293[_0x72ad('0x10')]:_0x13b2e8[_0x72ad('0x11')];_0x1a8759=_0x3f7fe2?!![]:![];return sqlUtils['countFilteredContacts'](_0x23f1d2,_0x3f7fe2);})[_0x72ad('0x5')](function(_0x4867d9){_0x49a827[_0x72ad('0x12')]=_0x4867d9;if(_0x49a827[_0x72ad('0x12')]===0x0){return;}if(_0x13b2e8['User']){_0x349062=!![];}return sqlUtils['buildContactsQuery'](_0x23f1d2,_0x13b2e8[_0x72ad('0x9')],_0x32913c,_0x1a8759,_0x280293[_0x72ad('0xc')],_0x349062);})[_0x72ad('0x5')](function(_0x35a308){if(!_0x35a308){return[];}return sqlUtils[_0x72ad('0x13')](_0x35a308,_0x13b2e8,_0x32913c);})['then'](function(_0x1055e7){_0x49a827[_0x72ad('0x14')]=_0x1055e7;return _0x49a827;})[_0x72ad('0x15')](function(_0x9a65ba){throw _0x9a65ba;});};exports[_0x72ad('0x16')]=function(){var _0x161591={};var _0x487c89=[];return db[_0x72ad('0x17')][_0x72ad('0x16')]()[_0x72ad('0x5')](function(_0x400eeb){_0x161591=_0x400eeb;var _0x51c98c=Object[_0x72ad('0x18')](_0x161591)[_0x72ad('0xa')](function(_0x4956d5){return _[_0x72ad('0x19')](_0x4956d5,_0x72ad('0x1a'))?_0x4956d5:undefined;});var _0x3dc9cf=_0x51c98c['map'](function(_0x16aa4a){return db['CmCustomField']['findOne']({'where':{'id':_0x16aa4a[_0x72ad('0x1b')](0x3)},'raw':!![]});});return Promise[_0x72ad('0x1c')](_0x3dc9cf);})[_0x72ad('0x5')](function(_0x35a7cc){for(var _0x17ee3d=0x0;_0x17ee3d<_0x35a7cc[_0x72ad('0x1d')];_0x17ee3d++){if(_0x35a7cc[_0x17ee3d]){var _0x160e83=_0x72ad('0x1a')+_0x35a7cc[_0x17ee3d]['id'];_0x161591[_0x160e83][_0x72ad('0x1e')]=_0x35a7cc[_0x17ee3d][_0x72ad('0x1f')];}}_0x487c89=_[_0x72ad('0x20')](Object[_0x72ad('0x18')](_0x161591),function(_0x3c767f){return{'name':_0x3c767f,'type':_0x161591[_0x3c767f][_0x72ad('0x1f')]};});return _0x487c89;})[_0x72ad('0x15')](function(_0x14cf8f){throw _0x14cf8f;});}; \ No newline at end of file +var _0xc793=['search','ids','count','User','getFilteredContacts','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','./sql-utils','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','fields','where','user','clause','tags','skip','checkListsRestrictions'];(function(_0x215456,_0x15aa5c){var _0x8e0e9e=function(_0x3bb623){while(--_0x3bb623){_0x215456['push'](_0x215456['shift']());}};_0x8e0e9e(++_0x15aa5c);}(_0xc793,0x10a));var _0x3c79=function(_0x589f62,_0x5125b7){_0x589f62=_0x589f62-0x0;var _0x4b70cf=_0xc793[_0x589f62];return _0x4b70cf;};'use strict';var _=require(_0x3c79('0x0'));var sqlUtils=require(_0x3c79('0x1'));var db=require('../../mysqldb')['db'];exports['findAll']=function(_0x3fb699,_0x599d4c,_0x37e2d0,_0x5e7da3){var _0x1728b2={'count':0x0,'rows':[]};var _0x43a7e5=sqlUtils['skipContactsQuery'](_0x599d4c,_0x3fb699);if(_0x43a7e5){return Promise[_0x3c79('0x2')](_0x1728b2);}var _0x87c6b5=sqlUtils[_0x3c79('0x3')]();var _0x4cbfcc={};var _0x16fad4=![];var _0x2950ea=![];return Promise[_0x3c79('0x2')]()[_0x3c79('0x4')](function(){if(_0x3fb699['search']){return sqlUtils[_0x3c79('0x5')](_0x3fb699['search'],_0x5e7da3);}else{return sqlUtils['parseQueryParameters'](_0x3fb699,_0x5e7da3);}})[_0x3c79('0x4')](function(_0x320538){_0x87c6b5['where'](_0x320538['default']);_0x87c6b5['where'](_0x320538[_0x3c79('0x6')]);_0x87c6b5[_0x3c79('0x7')](_0x320538['filter']);_0x87c6b5[_0x3c79('0x7')](_0x320538[_0x3c79('0x8')][_0x3c79('0x9')]);_0x4cbfcc=_0x320538[_0x3c79('0xa')];_0x2950ea=_0x320538[_0x3c79('0x8')][_0x3c79('0xb')];return sqlUtils[_0x3c79('0xc')](_0x599d4c,_0x3fb699,_0x2950ea);})['then'](function(_0x7509f3){_0x87c6b5[_0x3c79('0x7')](_0x7509f3);var _0x1ac8a6=_0x3fb699[_0x3c79('0xd')]?_0x4cbfcc[_0x3c79('0xe')]:_0x3fb699['tag'];_0x16fad4=_0x1ac8a6?!![]:![];return sqlUtils['countFilteredContacts'](_0x87c6b5,_0x1ac8a6);})['then'](function(_0x553368){_0x1728b2[_0x3c79('0xf')]=_0x553368;if(_0x1728b2[_0x3c79('0xf')]===0x0){return;}if(_0x3fb699[_0x3c79('0x10')]){_0x2950ea=!![];}return sqlUtils['buildContactsQuery'](_0x87c6b5,_0x3fb699['fields'],_0x37e2d0,_0x16fad4,_0x4cbfcc['clause'],_0x2950ea);})[_0x3c79('0x4')](function(_0x3dbea0){if(!_0x3dbea0){return[];}return sqlUtils[_0x3c79('0x11')](_0x3dbea0,_0x3fb699,_0x37e2d0);})[_0x3c79('0x4')](function(_0x4e1732){_0x1728b2['rows']=_0x4e1732;return _0x1728b2;})[_0x3c79('0x12')](function(_0x5966a1){throw _0x5966a1;});};exports[_0x3c79('0x13')]=function(){var _0x5de345={};var _0x298265=[];return db[_0x3c79('0x14')][_0x3c79('0x13')]()['then'](function(_0x19ca41){_0x5de345=_0x19ca41;var _0x468a7b=Object[_0x3c79('0x15')](_0x5de345)['filter'](function(_0x52a514){return _[_0x3c79('0x16')](_0x52a514,_0x3c79('0x17'))?_0x52a514:undefined;});var _0x1d8828=_0x468a7b[_0x3c79('0x18')](function(_0x3ba259){return db[_0x3c79('0x19')][_0x3c79('0x1a')]({'where':{'id':_0x3ba259[_0x3c79('0x1b')](0x3)},'raw':!![]});});return Promise[_0x3c79('0x1c')](_0x1d8828);})[_0x3c79('0x4')](function(_0x30f2ba){for(var _0xeaa3af=0x0;_0xeaa3af<_0x30f2ba['length'];_0xeaa3af++){if(_0x30f2ba[_0xeaa3af]){var _0x94e99f=_0x3c79('0x17')+_0x30f2ba[_0xeaa3af]['id'];_0x5de345[_0x94e99f][_0x3c79('0x1d')]=_0x30f2ba[_0xeaa3af][_0x3c79('0x1e')];}}_0x298265=_[_0x3c79('0x18')](Object[_0x3c79('0x15')](_0x5de345),function(_0x1011ec){return{'name':_0x1011ec,'type':_0x5de345[_0x1011ec]['type']};});return _0x298265;})['catch'](function(_0x3b2533){throw _0x3b2533;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index b03a159..e0f0fe2 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a70=['forEach','replace','split','length','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','datetime','castTo','DATE','type','default','text','value','start','end','Tag','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','map','some','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','tag','filter','resolve','search','c.ListId\x20IS\x20NULL','attributes','c.id','limit','offset','group','subqry.id','order','DESC','findAll','color','keyBy','sequelize','query','toString','Tags','COUNT(*)','getSelectedTags','QueryTypes','SELECT','exports','lodash','../parsers/advancedSearch','../parsers/qs','role','agent','autocomplete','true','from','cm_contacts','where','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','firstName','phone','CompanyId','createdAt','deletedAt','TagIds','includes','push','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr'];(function(_0x2fa8aa,_0x393128){var _0x2618e4=function(_0x11cbbb){while(--_0x11cbbb){_0x2fa8aa['push'](_0x2fa8aa['shift']());}};_0x2618e4(++_0x393128);}(_0x7a70,0xab));var _0x07a7=function(_0x45d150,_0x34d4ba){_0x45d150=_0x45d150-0x0;var _0xf01d85=_0x7a70[_0x45d150];return _0xf01d85;};'use strict';var _=require(_0x07a7('0x0'));var squel=require('squel');var as=require(_0x07a7('0x1'));var qs=require(_0x07a7('0x2'));var utils=require('../interaction/utils');var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x5992fe,_0x50b7e5){var _0x5149d5=![];if(_0x5992fe[_0x07a7('0x3')]===_0x07a7('0x4')&&!_0x50b7e5['search']&&!_0x50b7e5['ListId']&&_0x50b7e5[_0x07a7('0x5')]!==_0x07a7('0x6')){_0x5149d5=!![];}return _0x5149d5;}function getContactsSubquery(){return squel['select']()[_0x07a7('0x7')](_0x07a7('0x8'),'c')[_0x07a7('0x9')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x34ca22,_0x31e284){var _0x2c6336=_0x31e284?'c':_0x07a7('0xa');_0x34ca22[_0x07a7('0xb')](_0x07a7('0xc'),'uc',_0x07a7('0xd')+_0x2c6336+_0x07a7('0xe'))[_0x07a7('0xb')](_0x07a7('0xf'),'ct',_0x07a7('0x10')+_0x2c6336+'.id')[_0x07a7('0xb')]('tools_tags','t',_0x07a7('0x11'));return _0x34ca22;}function addFieldsToQuery(_0x3d9b9c,_0x1df4c9,_0x179876,_0x509556,_0xe3ba2d){var _0x503300=_0xe3ba2d?'c':_0x07a7('0xa');if(!_0x1df4c9){_0x1df4c9=['id',_0x07a7('0x12'),'lastName',_0x07a7('0x13'),'mobile','fax','email','ListId',_0x07a7('0x14'),_0x07a7('0x15'),'updatedAt',_0x07a7('0x16'),_0x07a7('0x17')];}else if(!_0x1df4c9[_0x07a7('0x18')]('id')){_0x1df4c9[_0x07a7('0x19')]('id');}var _0xde7e68=_0x179876&&_0xe3ba2d||!_0x179876&&!_0xe3ba2d;if(_0x509556){_0xde7e68=_0x509556&&_0xe3ba2d||!_0x509556&&!_0xe3ba2d;}_0x1df4c9['forEach'](function(_0x122fc3){if(_0x122fc3===_0x07a7('0x17')){if(_0xde7e68){_0x3d9b9c['field'](_0x07a7('0x1a'),_0x122fc3);}else if(_0x179876||_0x509556){_0x3d9b9c[_0x07a7('0x1b')](_0x503300+'.'+_0x122fc3);}}else{_0x3d9b9c['field'](_0x503300+'.'+_0x122fc3);}});return _0x3d9b9c;}function getSqlClauses(){var _0xd70c0a={'default':squel[_0x07a7('0x1c')](),'fields':squel[_0x07a7('0x1c')](),'filter':squel[_0x07a7('0x1c')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x07a7('0x1c')](),'skip':![]}};return _0xd70c0a;}function parseTagParameter(_0x5ae0f3){var _0x15dfc7=squel[_0x07a7('0x1c')]();if(_0x5ae0f3){var _0x28f31e=utils['getSelectedTags'](_0x5ae0f3);_0x28f31e[_0x07a7('0x1d')](function(_0x50aecf){_0x15dfc7['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x50aecf+',%');});}return _0x15dfc7;}function parseSearchFilter(_0x3f01f5){var _0x2753bc=squel[_0x07a7('0x1c')]();if(_0x3f01f5){var _0x2215e3=_0x3f01f5[_0x07a7('0x1e')]('\x5c','\x5c\x5c')[_0x07a7('0x1e')](/'/g,'\x27\x27');if(_0x2215e3[_0x07a7('0x1f')]('\x20')[_0x07a7('0x20')]>0x1){_0x2753bc['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x07a7('0x21')](_0x2215e3,!![]),null);}else{if(qs['isNumeric'](_0x2215e3)){_0x2753bc['or'](_0x07a7('0x22'),_0x2215e3+'%');_0x2753bc['or'](_0x07a7('0x23'),_0x2215e3+'%');_0x2753bc['or'](_0x07a7('0x24'),_0x2215e3+'%');_0x2753bc['or'](_0x07a7('0x25'),_0x2215e3+'%');}else if(qs[_0x07a7('0x26')](_0x2215e3)){_0x2753bc['or'](_0x07a7('0x27'),_0x2215e3+'%');}else{_0x2753bc['or'](_0x07a7('0x28'),'%'+_0x2215e3+'%');_0x2753bc['or']('c.lastName\x20LIKE\x20?','%'+_0x2215e3+'%');_0x2753bc['or'](_0x07a7('0x27'),'%'+_0x2215e3+'%');}}}return _0x2753bc;}function parseAdvancedSearchFilter(_0x5719bf,_0x594b3a){var _0x3007b3=getSqlClauses();var _0x18ac0c=as[_0x07a7('0x29')](_0x5719bf);var _0x439322=_0x18ac0c[_0x07a7('0x2a')];for(var _0x49cc39=0x0;_0x49cc39<_0x18ac0c[_0x07a7('0x2b')][_0x07a7('0x20')];_0x49cc39++){var _0xed4adc=_0x18ac0c[_0x07a7('0x2b')][_0x49cc39];var _0x1f47ed='c';var _0xb3d347=_[_0x07a7('0x2c')](_0x594b3a,[_0x07a7('0x2d'),_0xed4adc[_0x07a7('0x1b')]]);if(_0xb3d347){if(_0xed4adc[_0x07a7('0x1b')]===_0x07a7('0x2e')||_0xb3d347['fieldType']===_0x07a7('0x2f')){_0xed4adc[_0x07a7('0x30')]=_0x07a7('0x31');}var _0xb7a5ab=as['buildExpression'](_0x1f47ed,_0xb3d347[_0x07a7('0x32')],_0xed4adc);_0x3007b3[_0x07a7('0x33')][_0x439322](_0xb7a5ab[_0x07a7('0x34')],_0xb7a5ab[_0x07a7('0x35')][_0x07a7('0x36')],_0xb7a5ab[_0x07a7('0x35')][_0x07a7('0x37')]);}else{if(_0xed4adc[_0x07a7('0x1b')]===_0x07a7('0x38')){var _0x2c4f50=_0xed4adc['value']['split'](',')['map'](function(_0x53d6e5){return Number(_0x53d6e5);});var _0x651ac4=parseTagParameter(_0x2c4f50);_0x3007b3[_0x07a7('0x39')][_0x07a7('0x3a')][_0x07a7('0x3b')](_0x651ac4);_0x3007b3[_0x07a7('0x39')][_0x07a7('0x3c')]=_0x2c4f50;}else if(_0xed4adc['field']===_0x07a7('0x3d')){_0x3007b3[_0x07a7('0x3e')][_0x07a7('0x3a')][_0x07a7('0x3b')](_0x07a7('0x3f'),_0xed4adc[_0x07a7('0x35')]);_0x3007b3[_0x07a7('0x3e')][_0x07a7('0x40')]=!![];}}}return _0x3007b3;}function parseModelFields(_0x5ca53f,_0x257461){var _0x498dc6=squel['expr']();var _0x28654e=_(_0x5ca53f)['keys']()[_0x07a7('0x41')](function(_0x1bd57c){return _[_0x07a7('0x42')](_0x257461,[_0x07a7('0x2d'),_0x1bd57c])?_0x1bd57c:undefined;})['compact']()[_0x07a7('0x35')]();if(_0x5ca53f[_0x07a7('0x43')]){_0x28654e[_0x07a7('0x19')](_0x07a7('0x43'));}if(_0x5ca53f[_0x07a7('0x3d')]){_0x28654e['push'](_0x07a7('0x3d'));}if(_0x28654e[_0x07a7('0x20')]>0x0){_0x28654e[_0x07a7('0x1d')](function(_0x67115c){if(_0x67115c===_0x07a7('0x44')){_0x498dc6['and'](_0x07a7('0x45'),[][_0x07a7('0x46')](_0x5ca53f[_0x67115c]));}else if(_0x67115c===_0x07a7('0x43')){var _0xa04fd6='%'+_0x5ca53f[_0x67115c]+'%';_0x498dc6[_0x07a7('0x3b')](_0x07a7('0x47'),_0xa04fd6);}else if(_0x67115c===_0x07a7('0x3d')){_0x498dc6['and']('uc.UserId\x20=\x20?',_0x5ca53f[_0x67115c]);}else{_0x498dc6[_0x07a7('0x3b')]('c.'+_0x67115c+_0x07a7('0x48'),_0x5ca53f[_0x67115c]);}});}return _0x498dc6;}function parseQueryParameters(_0x38e7f5,_0x4f8766){var _0x3a4aa4=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x38e7f5,_0x4f8766);})[_0x07a7('0x49')](function(_0x236d51){_0x3a4aa4[_0x07a7('0x4a')][_0x07a7('0x3b')](_0x236d51);return parseTagParameter(_0x38e7f5[_0x07a7('0x4b')]);})[_0x07a7('0x49')](function(_0x1b7bee){_0x3a4aa4['tags'][_0x07a7('0x3a')]['and'](_0x1b7bee);return parseSearchFilter(_0x38e7f5[_0x07a7('0x4c')]);})[_0x07a7('0x49')](function(_0x4643ff){_0x3a4aa4[_0x07a7('0x4c')]=_0x4643ff;return _0x3a4aa4;});}function checkListsRestrictions(_0x2f17d7,_0x3e3e16,_0x52b264){var _0x3a5abf=squel[_0x07a7('0x1c')]();return Promise[_0x07a7('0x4d')]()['then'](function(){if(_0x3e3e16[_0x07a7('0x4e')]&&_0x2f17d7[_0x07a7('0x3')]===_0x07a7('0x4')&&!_0x52b264){return _0x2f17d7['getLists']({'attributes':['id'],'raw':!![]});}})[_0x07a7('0x49')](function(_0x583a97){if(_0x583a97){if(_0x583a97[_0x07a7('0x20')]===0x0){_0x3a5abf[_0x07a7('0x3b')](_0x07a7('0x4f'));}else{_0x3a5abf[_0x07a7('0x3b')](_0x07a7('0x45'),_[_0x07a7('0x41')](_0x583a97,'id'));}}})[_0x07a7('0x49')](function(){return _0x3a5abf;});}function buildContactsQuery(_0x3b483a,_0x145b99,_0x4baf77,_0x204d39,_0x43ffd1,_0x4c8252){if(_0x145b99){_0x145b99=_0x4baf77[_0x07a7('0x50')];}_0x3b483a=addFieldsToQuery(_0x3b483a,_0x145b99,_0x204d39,_0x4c8252,!![]);var _0x2a7180=squel['select']();_0x2a7180=addFieldsToQuery(_0x2a7180,_0x145b99,_0x204d39,_0x4c8252,![]);if(_0x204d39||_0x4c8252){_0x3b483a=applyJoinClauses(_0x3b483a,!![]);_0x3b483a['group'](_0x07a7('0x51'));if(_0x4baf77[_0x07a7('0x52')]){_0x2a7180[_0x07a7('0x52')](_0x4baf77[_0x07a7('0x52')]);}if(_0x4baf77[_0x07a7('0x53')]){_0x2a7180[_0x07a7('0x53')](_0x4baf77[_0x07a7('0x53')]);}}else{_0x2a7180=applyJoinClauses(_0x2a7180,![]);_0x2a7180[_0x07a7('0x54')](_0x07a7('0x55'));if(_0x4baf77[_0x07a7('0x52')]){_0x3b483a[_0x07a7('0x52')](_0x4baf77[_0x07a7('0x52')]);}if(_0x4baf77[_0x07a7('0x53')]){_0x3b483a[_0x07a7('0x53')](_0x4baf77['offset']);}}_0x2a7180['having'](_0x43ffd1);if(_0x4baf77[_0x07a7('0x56')]){_0x4baf77['order'][_0x07a7('0x1d')](function(_0x18396d){_0x3b483a[_0x07a7('0x56')]('c.'+_0x18396d[0x0],_0x18396d[0x1]===_0x07a7('0x57')?![]:!![]);_0x2a7180[_0x07a7('0x56')]('subqry.'+_0x18396d[0x0],_0x18396d[0x1]===_0x07a7('0x57')?![]:!![]);});}_0x2a7180[_0x07a7('0x7')](_0x3b483a,_0x07a7('0xa'));return _0x2a7180;}function getFilteredContacts(_0x2c9b74){var _0x44e1ed=[];return db[_0x07a7('0x38')][_0x07a7('0x58')]({'attributes':['id',_0x07a7('0x2d'),_0x07a7('0x59')],'raw':!![]})[_0x07a7('0x49')](function(_0x2bb674){_0x44e1ed=_[_0x07a7('0x5a')](_0x2bb674,'id');var _0x3290b2={'type':db['Sequelize']['QueryTypes']['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x07a7('0x5b')][_0x07a7('0x5c')](_0x2c9b74[_0x07a7('0x5d')](),_0x3290b2);})[_0x07a7('0x49')](function(_0x32a2f8){_0x32a2f8[_0x07a7('0x1d')](function(_0x657570){if(_0x657570[_0x07a7('0x17')]){_0x657570[_0x07a7('0x5e')]=[];_0x657570[_0x07a7('0x17')][_0x07a7('0x1f')](',')[_0x07a7('0x1d')](function(_0x42c1fa){_0x657570['Tags'][_0x07a7('0x19')](_0x44e1ed[_0x42c1fa]);});}delete _0x657570[_0x07a7('0x17')];});return _0x32a2f8;});}function countFilteredContacts(_0x81c069,_0x23e7c2){var _0x126f56=_0x81c069['clone']();_0x126f56[_0x07a7('0x1b')](_0x07a7('0x5f'));_0x126f56=applyJoinClauses(_0x126f56,!![]);_0x81c069['group'](_0x07a7('0x51'));var _0x247f95=utils[_0x07a7('0x60')](_0x23e7c2);if(!_['isEmpty'](_0x247f95)){_0x126f56[_0x07a7('0x9')]('t.id\x20IN\x20?',_0x247f95);}var _0x8d7c3c={'type':db['Sequelize'][_0x07a7('0x61')][_0x07a7('0x62')],'raw':!![]};return db[_0x07a7('0x5b')][_0x07a7('0x5c')](_0x126f56[_0x07a7('0x5d')](),_0x8d7c3c)[_0x07a7('0x49')](function(_0xbf85bd){return _0xbf85bd[0x0][_0x07a7('0x5f')];});}module[_0x07a7('0x63')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x8c51=['DATE','type','text','start','value','end','tags','clause','ids','User','and','uc.UserId\x20=\x20?','user','skip','map','some','compact','Contact','push','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','tag','filter','agent','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','having','order','subqry.','DESC','findAll','keyBy','QueryTypes','SELECT','CmContact','query','toString','COUNT(*)','isEmpty','t.id\x20IN\x20?','sequelize','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','search','autocomplete','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','firstName','mobile','fax','email','ListId','CompanyId','createdAt','deletedAt','TagIds','includes','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','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.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','datetime','castTo'];(function(_0x9b7e1c,_0x3680d7){var _0xa3b16=function(_0x5278f9){while(--_0x5278f9){_0x9b7e1c['push'](_0x9b7e1c['shift']());}};_0xa3b16(++_0x3680d7);}(_0x8c51,0x1c9));var _0x18c5=function(_0x14213c,_0x21fdb2){_0x14213c=_0x14213c-0x0;var _0x5c5470=_0x8c51[_0x14213c];return _0x5c5470;};'use strict';var _=require(_0x18c5('0x0'));var squel=require(_0x18c5('0x1'));var as=require(_0x18c5('0x2'));var qs=require('../parsers/qs');var utils=require(_0x18c5('0x3'));var db=require(_0x18c5('0x4'))['db'];function skipContactsQuery(_0x168c0a,_0x1c4fba){var _0x5b7c39=![];if(_0x168c0a[_0x18c5('0x5')]==='agent'&&!_0x1c4fba[_0x18c5('0x6')]&&!_0x1c4fba['ListId']&&_0x1c4fba[_0x18c5('0x7')]!=='true'){_0x5b7c39=!![];}return _0x5b7c39;}function getContactsSubquery(){return squel[_0x18c5('0x8')]()[_0x18c5('0x9')](_0x18c5('0xa'),'c')[_0x18c5('0xb')](_0x18c5('0xc'));}function applyJoinClauses(_0x435707,_0x3fd133){var _0x2185e6=_0x3fd133?'c':_0x18c5('0xd');_0x435707[_0x18c5('0xe')](_0x18c5('0xf'),'uc',_0x18c5('0x10')+_0x2185e6+_0x18c5('0x11'))[_0x18c5('0xe')](_0x18c5('0x12'),'ct','ct.CmContactId\x20=\x20'+_0x2185e6+'.id')[_0x18c5('0xe')]('tools_tags','t',_0x18c5('0x13'));return _0x435707;}function addFieldsToQuery(_0x3cc6cc,_0x105f3d,_0x23c52c,_0x2176bc,_0x5bbb2d){var _0x3c9fd1=_0x5bbb2d?'c':'subqry';if(!_0x105f3d){_0x105f3d=['id',_0x18c5('0x14'),'lastName','phone',_0x18c5('0x15'),_0x18c5('0x16'),_0x18c5('0x17'),_0x18c5('0x18'),_0x18c5('0x19'),_0x18c5('0x1a'),'updatedAt',_0x18c5('0x1b'),_0x18c5('0x1c')];}else if(!_0x105f3d[_0x18c5('0x1d')]('id')){_0x105f3d['push']('id');}var _0x4454d1=_0x23c52c&&_0x5bbb2d||!_0x23c52c&&!_0x5bbb2d;if(_0x2176bc){_0x4454d1=_0x2176bc&&_0x5bbb2d||!_0x2176bc&&!_0x5bbb2d;}_0x105f3d[_0x18c5('0x1e')](function(_0x3bc0f8){if(_0x3bc0f8===_0x18c5('0x1c')){if(_0x4454d1){_0x3cc6cc['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3bc0f8);}else if(_0x23c52c||_0x2176bc){_0x3cc6cc[_0x18c5('0x1f')](_0x3c9fd1+'.'+_0x3bc0f8);}}else{_0x3cc6cc[_0x18c5('0x1f')](_0x3c9fd1+'.'+_0x3bc0f8);}});return _0x3cc6cc;}function getSqlClauses(){var _0x15f706={'default':squel['expr'](),'fields':squel[_0x18c5('0x20')](),'filter':squel[_0x18c5('0x20')](),'tags':{'clause':squel[_0x18c5('0x20')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x15f706;}function parseTagParameter(_0x49f413){var _0x1151a8=squel['expr']();if(_0x49f413){var _0x12ebae=utils[_0x18c5('0x21')](_0x49f413);_0x12ebae[_0x18c5('0x1e')](function(_0x224829){_0x1151a8['or'](_0x18c5('0x22'),'%,'+_0x224829+',%');});}return _0x1151a8;}function parseSearchFilter(_0x3dedea){var _0x3baee1=squel[_0x18c5('0x20')]();if(_0x3dedea){var _0x523c65=_0x3dedea[_0x18c5('0x23')]('\x5c','\x5c\x5c')[_0x18c5('0x23')](/'/g,'\x27\x27');if(_0x523c65[_0x18c5('0x24')]('\x20')[_0x18c5('0x25')]>0x1){_0x3baee1['or'](_0x18c5('0x26'),qs[_0x18c5('0x27')](_0x523c65,!![]),null);}else{if(qs[_0x18c5('0x28')](_0x523c65)){_0x3baee1['or'](_0x18c5('0x29'),_0x523c65+'%');_0x3baee1['or']('c.phone\x20LIKE\x20?',_0x523c65+'%');_0x3baee1['or'](_0x18c5('0x2a'),_0x523c65+'%');_0x3baee1['or']('c.fax\x20LIKE\x20?',_0x523c65+'%');}else if(qs[_0x18c5('0x2b')](_0x523c65)){_0x3baee1['or']('c.email\x20LIKE\x20?',_0x523c65+'%');}else{_0x3baee1['or'](_0x18c5('0x2c'),'%'+_0x523c65+'%');_0x3baee1['or']('c.lastName\x20LIKE\x20?','%'+_0x523c65+'%');_0x3baee1['or'](_0x18c5('0x2d'),'%'+_0x523c65+'%');}}}return _0x3baee1;}function parseAdvancedSearchFilter(_0x2cfa80,_0x2b40c0){var _0x5228eb=getSqlClauses();var _0x3657c7=as[_0x18c5('0x2e')](_0x2cfa80);var _0x1ab002=_0x3657c7['sqlOperator'];for(var _0x529b09=0x0;_0x529b09<_0x3657c7[_0x18c5('0x2f')][_0x18c5('0x25')];_0x529b09++){var _0x1b0534=_0x3657c7[_0x18c5('0x2f')][_0x529b09];var _0x5bace5='c';var _0x32084=_[_0x18c5('0x30')](_0x2b40c0,[_0x18c5('0x31'),_0x1b0534[_0x18c5('0x1f')]]);if(_0x32084){if(_0x1b0534[_0x18c5('0x1f')]===_0x18c5('0x32')||_0x32084['fieldType']===_0x18c5('0x33')){_0x1b0534[_0x18c5('0x34')]=_0x18c5('0x35');}var _0x41a68a=as['buildExpression'](_0x5bace5,_0x32084[_0x18c5('0x36')],_0x1b0534);_0x5228eb['default'][_0x1ab002](_0x41a68a[_0x18c5('0x37')],_0x41a68a['value'][_0x18c5('0x38')],_0x41a68a[_0x18c5('0x39')][_0x18c5('0x3a')]);}else{if(_0x1b0534[_0x18c5('0x1f')]==='Tag'){var _0x505b5c=_0x1b0534[_0x18c5('0x39')][_0x18c5('0x24')](',')['map'](function(_0x5c5bb3){return Number(_0x5c5bb3);});var _0x18c1f3=parseTagParameter(_0x505b5c);_0x5228eb[_0x18c5('0x3b')][_0x18c5('0x3c')]['and'](_0x18c1f3);_0x5228eb[_0x18c5('0x3b')][_0x18c5('0x3d')]=_0x505b5c;}else if(_0x1b0534[_0x18c5('0x1f')]===_0x18c5('0x3e')){_0x5228eb['user'][_0x18c5('0x3c')][_0x18c5('0x3f')](_0x18c5('0x40'),_0x1b0534[_0x18c5('0x39')]);_0x5228eb[_0x18c5('0x41')][_0x18c5('0x42')]=!![];}}}return _0x5228eb;}function parseModelFields(_0x580625,_0x5ba7a2){var _0x1c67fc=squel[_0x18c5('0x20')]();var _0x339d8d=_(_0x580625)['keys']()[_0x18c5('0x43')](function(_0x3a3661){return _[_0x18c5('0x44')](_0x5ba7a2,[_0x18c5('0x31'),_0x3a3661])?_0x3a3661:undefined;})[_0x18c5('0x45')]()[_0x18c5('0x39')]();if(_0x580625[_0x18c5('0x46')]){_0x339d8d[_0x18c5('0x47')](_0x18c5('0x46'));}if(_0x580625[_0x18c5('0x3e')]){_0x339d8d[_0x18c5('0x47')](_0x18c5('0x3e'));}if(_0x339d8d[_0x18c5('0x25')]>0x0){_0x339d8d[_0x18c5('0x1e')](function(_0xf4c9f8){if(_0xf4c9f8===_0x18c5('0x18')){_0x1c67fc[_0x18c5('0x3f')](_0x18c5('0x48'),[]['concat'](_0x580625[_0xf4c9f8]));}else if(_0xf4c9f8===_0x18c5('0x46')){var _0x501e2e='%'+_0x580625[_0xf4c9f8]+'%';_0x1c67fc['and']('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x501e2e);}else if(_0xf4c9f8===_0x18c5('0x3e')){_0x1c67fc['and'](_0x18c5('0x40'),_0x580625[_0xf4c9f8]);}else{_0x1c67fc[_0x18c5('0x3f')]('c.'+_0xf4c9f8+_0x18c5('0x49'),_0x580625[_0xf4c9f8]);}});}return _0x1c67fc;}function parseQueryParameters(_0x4da0ff,_0x16c6b0){var _0x52dc8a=getSqlClauses();return Promise[_0x18c5('0x4a')]()[_0x18c5('0x4b')](function(){return parseModelFields(_0x4da0ff,_0x16c6b0);})['then'](function(_0x8e3f5f){_0x52dc8a['fields']['and'](_0x8e3f5f);return parseTagParameter(_0x4da0ff[_0x18c5('0x4c')]);})[_0x18c5('0x4b')](function(_0x46fd8f){_0x52dc8a[_0x18c5('0x3b')][_0x18c5('0x3c')][_0x18c5('0x3f')](_0x46fd8f);return parseSearchFilter(_0x4da0ff[_0x18c5('0x4d')]);})['then'](function(_0x1c3b86){_0x52dc8a[_0x18c5('0x4d')]=_0x1c3b86;return _0x52dc8a;});}function checkListsRestrictions(_0x748d45,_0x57d1a6,_0x2684e8){var _0x3b0d3f=squel[_0x18c5('0x20')]();return Promise[_0x18c5('0x4a')]()[_0x18c5('0x4b')](function(){if(_0x57d1a6[_0x18c5('0x6')]&&_0x748d45[_0x18c5('0x5')]===_0x18c5('0x4e')&&!_0x2684e8){return _0x748d45[_0x18c5('0x4f')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x92cb4c){if(_0x92cb4c){if(_0x92cb4c[_0x18c5('0x25')]===0x0){_0x3b0d3f[_0x18c5('0x3f')](_0x18c5('0x50'));}else{_0x3b0d3f[_0x18c5('0x3f')](_0x18c5('0x48'),_[_0x18c5('0x43')](_0x92cb4c,'id'));}}})[_0x18c5('0x4b')](function(){return _0x3b0d3f;});}function buildContactsQuery(_0x31e25f,_0x2ef9e5,_0x1e994a,_0x1b2162,_0x44d0f1,_0x5569c4){if(_0x2ef9e5){_0x2ef9e5=_0x1e994a[_0x18c5('0x51')];}_0x31e25f=addFieldsToQuery(_0x31e25f,_0x2ef9e5,_0x1b2162,_0x5569c4,!![]);var _0x260117=squel[_0x18c5('0x8')]();_0x260117=addFieldsToQuery(_0x260117,_0x2ef9e5,_0x1b2162,_0x5569c4,![]);if(_0x1b2162||_0x5569c4){_0x31e25f=applyJoinClauses(_0x31e25f,!![]);_0x31e25f[_0x18c5('0x52')]('c.id');if(_0x1e994a[_0x18c5('0x53')]){_0x260117[_0x18c5('0x53')](_0x1e994a[_0x18c5('0x53')]);}if(_0x1e994a['offset']){_0x260117[_0x18c5('0x54')](_0x1e994a[_0x18c5('0x54')]);}}else{_0x260117=applyJoinClauses(_0x260117,![]);_0x260117['group'](_0x18c5('0x55'));if(_0x1e994a[_0x18c5('0x53')]){_0x31e25f['limit'](_0x1e994a['limit']);}if(_0x1e994a['offset']){_0x31e25f[_0x18c5('0x54')](_0x1e994a['offset']);}}_0x260117[_0x18c5('0x56')](_0x44d0f1);if(_0x1e994a[_0x18c5('0x57')]){_0x1e994a[_0x18c5('0x57')][_0x18c5('0x1e')](function(_0x829635){_0x31e25f['order']('c.'+_0x829635[0x0],_0x829635[0x1]==='DESC'?![]:!![]);_0x260117['order'](_0x18c5('0x58')+_0x829635[0x0],_0x829635[0x1]===_0x18c5('0x59')?![]:!![]);});}_0x260117[_0x18c5('0x9')](_0x31e25f,_0x18c5('0xd'));return _0x260117;}function getFilteredContacts(_0x35d698){var _0x4454e1=[];return db['Tag'][_0x18c5('0x5a')]({'attributes':['id','name','color'],'raw':!![]})[_0x18c5('0x4b')](function(_0x12091b){_0x4454e1=_[_0x18c5('0x5b')](_0x12091b,'id');var _0x3d0f12={'type':db['Sequelize'][_0x18c5('0x5c')][_0x18c5('0x5d')],'model':db[_0x18c5('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x18c5('0x5f')](_0x35d698[_0x18c5('0x60')](),_0x3d0f12);})[_0x18c5('0x4b')](function(_0x19dbb0){_0x19dbb0['forEach'](function(_0x2e9e2a){if(_0x2e9e2a[_0x18c5('0x1c')]){_0x2e9e2a['Tags']=[];_0x2e9e2a[_0x18c5('0x1c')][_0x18c5('0x24')](',')[_0x18c5('0x1e')](function(_0x114299){_0x2e9e2a['Tags'][_0x18c5('0x47')](_0x4454e1[_0x114299]);});}delete _0x2e9e2a[_0x18c5('0x1c')];});return _0x19dbb0;});}function countFilteredContacts(_0x3d4c00,_0x4c29c3){var _0x572dcc=_0x3d4c00['clone']();_0x572dcc['field'](_0x18c5('0x61'));_0x572dcc=applyJoinClauses(_0x572dcc,!![]);_0x3d4c00[_0x18c5('0x52')]('c.id');var _0x5cdb10=utils['getSelectedTags'](_0x4c29c3);if(!_[_0x18c5('0x62')](_0x5cdb10)){_0x572dcc[_0x18c5('0xb')](_0x18c5('0x63'),_0x5cdb10);}var _0x2bbaf5={'type':db['Sequelize'][_0x18c5('0x5c')]['SELECT'],'raw':!![]};return db[_0x18c5('0x64')][_0x18c5('0x5f')](_0x572dcc['toString'](),_0x2bbaf5)[_0x18c5('0x4b')](function(_0x384c46){return _0x384c46[0x0]['COUNT(*)'];});}module[_0x18c5('0x65')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 77e928e..4b5cc37 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 _0xa778=['createWriteStream','createCipher','data','update','write','end','final','binary','close','unlink','decryptFile','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','../../config/environment','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream'];(function(_0x24e887,_0x550df3){var _0x5e3948=function(_0x583d34){while(--_0x583d34){_0x24e887['push'](_0x24e887['shift']());}};_0x5e3948(++_0x550df3);}(_0xa778,0xe3));var _0x8a77=function(_0x1329c0,_0x346292){_0x1329c0=_0x1329c0-0x0;var _0x54481e=_0xa778[_0x1329c0];return _0x54481e;};'use strict';var crypto=require(_0x8a77('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require(_0x8a77('0x1'));var logger=require(_0x8a77('0x2'))(_0x8a77('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x8a77('0x4')][_0x8a77('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x8a77('0x6')};if(config[_0x8a77('0x7')]&&config[_0x8a77('0x7')][_0x8a77('0x8')]){var isSupported=isAlgorithmSupported(config[_0x8a77('0x7')][_0x8a77('0x8')]);if(isSupported){fileOptions['algorithm']=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8a77('0x9')](',\x20');logger[_0x8a77('0xa')](config[_0x8a77('0x7')][_0x8a77('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0xa92cd8){return AES_SUPPORTED_RX[_0x8a77('0xb')](_0xa92cd8);}function getSupportedCiphers(){return crypto[_0x8a77('0xc')]()[_0x8a77('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x528e3a){return getSupportedCiphers()[_0x8a77('0xe')](_0x528e3a)>-0x1;}function combineOptions(_0x21ec82){var _0x2f0662={};for(var _0x4baaa2 in fileOptions){if(fileOptions[_0x8a77('0xf')](_0x4baaa2)){_0x2f0662[_0x4baaa2]=fileOptions[_0x4baaa2];}}if(_0x21ec82){for(var _0x2b16dc in _0x21ec82){if(_0x21ec82[_0x8a77('0xf')](_0x2b16dc)){_0x2f0662[_0x2b16dc]=_0x21ec82[_0x2b16dc];}}}return _0x2f0662;}exports[_0x8a77('0x10')]=function(_0x1c207b,_0x33885e,_0x2f02b8,_0x4c7ad7){return new BPromise(function(_0x1e0f72,_0x315087){_0x4c7ad7=combineOptions(_0x4c7ad7);var _0x28811e=new Buffer(_0x2f02b8);var _0x31df9d=fs[_0x8a77('0x11')](_0x1c207b);var _0x35bb89=fs[_0x8a77('0x12')](_0x33885e);var _0x58749f=crypto[_0x8a77('0x13')](_0x4c7ad7[_0x8a77('0x8')],_0x28811e);_0x31df9d['on'](_0x8a77('0x14'),function(_0x52d937){var _0x47aa25=new Buffer(_0x58749f[_0x8a77('0x15')](_0x52d937),'binary');_0x35bb89[_0x8a77('0x16')](_0x47aa25);});_0x31df9d['on'](_0x8a77('0x17'),function(){try{var _0x517988=new Buffer(_0x58749f[_0x8a77('0x18')](_0x8a77('0x19')),_0x8a77('0x19'));_0x35bb89[_0x8a77('0x16')](_0x517988);_0x35bb89[_0x8a77('0x17')]();_0x35bb89['on'](_0x8a77('0x1a'),function(){return _0x1e0f72(_0x33885e);});}catch(_0x2c64a4){fs[_0x8a77('0x1b')](_0x33885e);return _0x315087(_0x2c64a4);}});});};exports[_0x8a77('0x1c')]=function(_0x309c3a,_0x2f0dfc,_0x19ace5,_0x10a47b){return new BPromise(function(_0x1a1c9f,_0x2106a3){_0x10a47b=combineOptions(_0x10a47b);var _0x5a46d2=new Buffer(_0x19ace5);var _0x4754eb=fs['createReadStream'](_0x309c3a);var _0x3348c6=fs['createWriteStream'](_0x2f0dfc);var _0x4d00dc=crypto[_0x8a77('0x1d')](_0x10a47b['algorithm'],_0x5a46d2);_0x4754eb['on'](_0x8a77('0x14'),function(_0x12c276){var _0x2e1557=new Buffer(_0x4d00dc[_0x8a77('0x15')](_0x12c276),_0x8a77('0x19'));_0x3348c6[_0x8a77('0x16')](_0x2e1557);});_0x4754eb['on'](_0x8a77('0x17'),function(){try{var _0x19c0e1=new Buffer(_0x4d00dc[_0x8a77('0x18')]('binary'),_0x8a77('0x19'));_0x3348c6[_0x8a77('0x16')](_0x19c0e1);_0x3348c6['end']();_0x3348c6['on'](_0x8a77('0x1a'),function(){return _0x1a1c9f(_0x2f0dfc);});}catch(_0x503c1e){fs[_0x8a77('0x1b')](_0x2f0dfc);return _0x2106a3(_0x503c1e);}});});};exports[_0x8a77('0x1e')]=function(_0x32382a,_0x581c25,_0x319cdf){var _0x2330cb=_0x319cdf||stringOptions[_0x8a77('0x8')];var _0x26aa9d=_0x581c25||stringOptions[_0x8a77('0x1f')];var _0xcf668c=crypto['createCipher'](_0x2330cb,_0x26aa9d);var _0x33c38b=_0xcf668c[_0x8a77('0x15')](_0x32382a,_0x8a77('0x20'),_0x8a77('0x21'));_0x33c38b+=_0xcf668c[_0x8a77('0x18')](_0x8a77('0x21'));return _0x33c38b;};exports[_0x8a77('0x22')]=function(_0x496e6e,_0x15e11c,_0x1db3d2){var _0x3203ee=_0x1db3d2||stringOptions[_0x8a77('0x8')];var _0x4f6a9d=_0x15e11c||stringOptions[_0x8a77('0x1f')];var _0x98a26d=crypto['createDecipher'](_0x3203ee,_0x4f6a9d);var _0x1e4ee6=_0x98a26d[_0x8a77('0x15')](_0x496e6e,_0x8a77('0x21'),_0x8a77('0x20'));_0x1e4ee6+=_0x98a26d[_0x8a77('0x18')](_0x8a77('0x20'));return _0x1e4ee6;}; \ No newline at end of file +var _0x0c52=['secret','createDecipher','crypto','bluebird','lodash','app','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createCipher','data','update','binary','write','end','final','close','unlink','createReadStream','createWriteStream','utf8','base64','decryptString'];(function(_0xd3ddd9,_0x58c14f){var _0x541ca7=function(_0x3a6905){while(--_0x3a6905){_0xd3ddd9['push'](_0xd3ddd9['shift']());}};_0x541ca7(++_0x58c14f);}(_0x0c52,0x156));var _0x20c5=function(_0xf13059,_0x124679){_0xf13059=_0xf13059-0x0;var _0xb66aca=_0x0c52[_0xf13059];return _0xb66aca;};'use strict';var crypto=require(_0x20c5('0x0'));var fs=require('fs');var BPromise=require(_0x20c5('0x1'));var _=require(_0x20c5('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x20c5('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x20c5('0x4')][_0x20c5('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x20c5('0x6')};if(config[_0x20c5('0x7')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0x20c5('0x7')]['algorithm']);if(isSupported){fileOptions[_0x20c5('0x8')]=config[_0x20c5('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x20c5('0x9')](',\x20');logger[_0x20c5('0xa')](config[_0x20c5('0x7')][_0x20c5('0x8')],_0x20c5('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x34607c){return AES_SUPPORTED_RX[_0x20c5('0xc')](_0x34607c);}function getSupportedCiphers(){return crypto[_0x20c5('0xd')]()[_0x20c5('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x4fe071){return getSupportedCiphers()[_0x20c5('0xf')](_0x4fe071)>-0x1;}function combineOptions(_0xb615b6){var _0x35113f={};for(var _0x1b68d8 in fileOptions){if(fileOptions['hasOwnProperty'](_0x1b68d8)){_0x35113f[_0x1b68d8]=fileOptions[_0x1b68d8];}}if(_0xb615b6){for(var _0x2c864c in _0xb615b6){if(_0xb615b6[_0x20c5('0x10')](_0x2c864c)){_0x35113f[_0x2c864c]=_0xb615b6[_0x2c864c];}}}return _0x35113f;}exports[_0x20c5('0x11')]=function(_0x23186e,_0x3967a3,_0x2e3542,_0x1adeeb){return new BPromise(function(_0x27011b,_0x2a4366){_0x1adeeb=combineOptions(_0x1adeeb);var _0x5659b4=new Buffer(_0x2e3542);var _0x5aa4b7=fs['createReadStream'](_0x23186e);var _0x3ed511=fs['createWriteStream'](_0x3967a3);var _0x4be673=crypto[_0x20c5('0x12')](_0x1adeeb['algorithm'],_0x5659b4);_0x5aa4b7['on'](_0x20c5('0x13'),function(_0x6572bb){var _0x2f0605=new Buffer(_0x4be673[_0x20c5('0x14')](_0x6572bb),_0x20c5('0x15'));_0x3ed511[_0x20c5('0x16')](_0x2f0605);});_0x5aa4b7['on'](_0x20c5('0x17'),function(){try{var _0xb70378=new Buffer(_0x4be673[_0x20c5('0x18')](_0x20c5('0x15')),'binary');_0x3ed511['write'](_0xb70378);_0x3ed511[_0x20c5('0x17')]();_0x3ed511['on'](_0x20c5('0x19'),function(){return _0x27011b(_0x3967a3);});}catch(_0x564d51){fs[_0x20c5('0x1a')](_0x3967a3);return _0x2a4366(_0x564d51);}});});};exports['decryptFile']=function(_0x45599a,_0x15ffb4,_0x55eefa,_0x36a1b2){return new BPromise(function(_0x336c4f,_0x1d02b0){_0x36a1b2=combineOptions(_0x36a1b2);var _0x583df5=new Buffer(_0x55eefa);var _0x136f5=fs[_0x20c5('0x1b')](_0x45599a);var _0x3dc61e=fs[_0x20c5('0x1c')](_0x15ffb4);var _0x194123=crypto['createDecipher'](_0x36a1b2[_0x20c5('0x8')],_0x583df5);_0x136f5['on'](_0x20c5('0x13'),function(_0x17639b){var _0x395b7b=new Buffer(_0x194123[_0x20c5('0x14')](_0x17639b),_0x20c5('0x15'));_0x3dc61e['write'](_0x395b7b);});_0x136f5['on'](_0x20c5('0x17'),function(){try{var _0x1bc66f=new Buffer(_0x194123[_0x20c5('0x18')]('binary'),'binary');_0x3dc61e[_0x20c5('0x16')](_0x1bc66f);_0x3dc61e['end']();_0x3dc61e['on'](_0x20c5('0x19'),function(){return _0x336c4f(_0x15ffb4);});}catch(_0x1fc355){fs['unlink'](_0x15ffb4);return _0x1d02b0(_0x1fc355);}});});};exports['encryptString']=function(_0x2751e3,_0x25e825,_0x45140f){var _0x205ddb=_0x45140f||stringOptions[_0x20c5('0x8')];var _0x4369b3=_0x25e825||stringOptions['secret'];var _0x44f080=crypto[_0x20c5('0x12')](_0x205ddb,_0x4369b3);var _0xd52282=_0x44f080[_0x20c5('0x14')](_0x2751e3,_0x20c5('0x1d'),_0x20c5('0x1e'));_0xd52282+=_0x44f080['final'](_0x20c5('0x1e'));return _0xd52282;};exports[_0x20c5('0x1f')]=function(_0x35ed80,_0x1d8e15,_0x544635){var _0x41d7b2=_0x544635||stringOptions[_0x20c5('0x8')];var _0x5dfa53=_0x1d8e15||stringOptions[_0x20c5('0x20')];var _0x3f7da1=crypto[_0x20c5('0x21')](_0x41d7b2,_0x5dfa53);var _0x3c8b71=_0x3f7da1[_0x20c5('0x14')](_0x35ed80,'base64','utf8');_0x3c8b71+=_0x3f7da1[_0x20c5('0x18')](_0x20c5('0x1d'));return _0x3c8b71;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 7e87bb7..df7955d 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 _0x71a9=['Setting','find','split','splitSizeCsv','then','query','sequelize','QueryTypes','SELECT','num','length','range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','zip\x20finished','Completed','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','CSV'];(function(_0x1db998,_0x4f9a45){var _0x155d91=function(_0x3a5d5e){while(--_0x3a5d5e){_0x1db998['push'](_0x1db998['shift']());}};_0x155d91(++_0x4f9a45);}(_0x71a9,0x83));var _0x971a=function(_0x28c870,_0x1bf349){_0x28c870=_0x28c870-0x0;var _0x5e4de6=_0x71a9[_0x28c870];return _0x5e4de6;};'use strict';var util=require(_0x971a('0x0'));var path=require(_0x971a('0x1'));var _=require(_0x971a('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x971a('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x971a('0x4'));var db=require(_0x971a('0x5'))['db'];var dbH=require(_0x971a('0x5'))[_0x971a('0x6')];var logger=require(_0x971a('0x7'))(_0x971a('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x971a('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x24dd79,_0x17f8f0){var _0x32be9c={'status':_0x24dd79};var _0x57ca74={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x17f8f0){_0x32be9c[_0x971a('0xa')]=_0x17f8f0;}return db[_0x971a('0xb')][_0x971a('0xc')](_0x32be9c,_0x57ca74);}function main(){var _0x236b5f=0x1388;var _0x33fde4;logger[_0x971a('0xd')](util[_0x971a('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x971a('0xf')));return db[_0x971a('0x10')][_0x971a('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x971a('0x12'),_0x971a('0x13')]})[_0x971a('0x14')](function(_0x404fc3){if(_0x404fc3){_0x33fde4=_0x404fc3;_0x236b5f=_0x33fde4['splitSizeCsv']||0x1388;}})['then'](function(){return dbH['sequelize'][_0x971a('0x15')](util[_0x971a('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x971a('0x16')][_0x971a('0x17')][_0x971a('0x18')]});})[_0x971a('0x14')](function(_0x32d3f2){if(!_0x32d3f2[0x0][_0x971a('0x19')]){return analyticExtractedReport('Empty');}var _0x55bbc2=[];var _0x485ad6=0x0;if(_0x33fde4[_0x971a('0x12')]){if(_0x32d3f2&&_0x32d3f2[_0x971a('0x1a')]){var _0x4289bd=_[_0x971a('0x1b')](_0x32d3f2[0x0][_0x971a('0x19')]/_0x236b5f);var _0xf04e81=Number['isInteger'](_0x32d3f2[0x0][_0x971a('0x19')]/_0x236b5f)?_0x32d3f2[0x0][_0x971a('0x19')]%_0x236b5f:0x0;_0x4289bd[_0x971a('0x1c')](function(_0x454077){if(_0x454077>0x0){_0x485ad6+=_0x236b5f;}_0x55bbc2['push'](dbH[_0x971a('0x16')]['query'](util[_0x971a('0xe')](_0x971a('0x1d'),QUERY,_0x236b5f,_0x485ad6),{'type':dbH[_0x971a('0x16')][_0x971a('0x17')][_0x971a('0x18')]}));});if(_0xf04e81>0x0){_0x485ad6+=_0x236b5f;_0x55bbc2[_0x971a('0x1e')](dbH[_0x971a('0x16')][_0x971a('0x15')](util[_0x971a('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xf04e81,_0x485ad6),{'type':dbH[_0x971a('0x16')][_0x971a('0x17')]['SELECT']}));}}}else{_0x55bbc2[_0x971a('0x1e')](dbH[_0x971a('0x16')][_0x971a('0x15')](QUERY,{'type':dbH[_0x971a('0x16')]['QueryTypes'][_0x971a('0x18')]}));}var _0x511e21=path[_0x971a('0x1f')](PATH);var _0x3da90a=path[_0x971a('0x20')](PATH,_0x971a('0x21'));var _0x3b6970=_0x33fde4[_0x971a('0x12')]&&_0x55bbc2[_0x971a('0x1a')]>0x1;var _0x3ee8d4=[];if(!fs[_0x971a('0x22')](path[_0x971a('0x23')](_0x511e21,_0x3da90a))&&_0x3b6970){fs[_0x971a('0x24')](path['join'](_0x511e21,_0x3da90a));}return BPromise[_0x971a('0x25')](_0x55bbc2,function(_0xe9a59c){_0x3ee8d4[_0x971a('0x1e')](_0xe9a59c);})['then'](function(){for(var _0x161a41=0x0;_0x161a41<_0x3ee8d4['length'];_0x161a41+=0x1){var _0x1fdab9;var _0x3d0d80=_0x3ee8d4[_0x161a41];if(_0x3b6970){_0x1fdab9=path['join'](_0x511e21,_0x3da90a,util[_0x971a('0xe')](_0x971a('0x26'),_0x3da90a,_0x161a41,_0x971a('0x27')));}else{_0x1fdab9=path[_0x971a('0x23')](_0x511e21,util[_0x971a('0xe')]('%s.%s',_0x3da90a,_0x971a('0x27')));}fs['writeFileSync'](_0x1fdab9,csv(_0x3d0d80));}})[_0x971a('0x14')](function(){if(_0x3b6970){return new Promise(function(_0x532e98){zipdir(path[_0x971a('0x23')](_0x511e21,_0x3da90a),{'saveTo':path[_0x971a('0x23')](_0x511e21,util[_0x971a('0xe')]('%s.%s',_0x3da90a,'zip'))},function(_0x39037f,_0x236d0d){rimraf(path[_0x971a('0x23')](_0x511e21,_0x3da90a),function(){});_0x532e98(_0x971a('0x28'));});});}})[_0x971a('0x14')](function(){logger[_0x971a('0xd')](util[_0x971a('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x971a('0xf')));return analyticExtractedReport(_0x971a('0x29'),_0x3b6970?util[_0x971a('0xe')](_0x971a('0x2a'),_0x3da90a,_0x3b6970?_0x971a('0x2b'):_0x971a('0x27')):null);});})[_0x971a('0x2c')](function(_0x148645){logger[_0x971a('0xd')](util[_0x971a('0xe')](_0x971a('0x2d'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x148645,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x971a('0x2e'));})[_0x971a('0x2f')](function(){process[_0x971a('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x450a=['util','lodash','to-csv','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','length','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','dirname','basename','.csv','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','catch','info','finally','exit'];(function(_0x99ba67,_0x10eae9){var _0x5c4f7d=function(_0x2962f6){while(--_0x2962f6){_0x99ba67['push'](_0x99ba67['shift']());}};_0x5c4f7d(++_0x10eae9);}(_0x450a,0xe1));var _0xa450=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x450a[_0xfae23b];return _0x200640;};'use strict';var util=require(_0xa450('0x0'));var path=require('path');var _=require(_0xa450('0x1'));var csv=require(_0xa450('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xa450('0x3'));var rimraf=require(_0xa450('0x4'));var db=require(_0xa450('0x5'))['db'];var dbH=require(_0xa450('0x5'))['dbH'];var logger=require(_0xa450('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xa450('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xa450('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xe7318d,_0x1d9797){var _0x3beca1={'status':_0xe7318d};var _0x3da860={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1d9797){_0x3beca1[_0xa450('0x8')]=_0x1d9797;}return db[_0xa450('0x9')][_0xa450('0xa')](_0x3beca1,_0x3da860);}function main(){var _0x270509=0x1388;var _0x44c32e;logger['info'](util[_0xa450('0xb')](_0xa450('0xc'),EXTRACTED_REPORT_ID,_0xa450('0xd')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa450('0xe'),_0xa450('0xf')]})[_0xa450('0x10')](function(_0x272a94){if(_0x272a94){_0x44c32e=_0x272a94;_0x270509=_0x44c32e[_0xa450('0xf')]||0x1388;}})[_0xa450('0x10')](function(){return dbH[_0xa450('0x11')][_0xa450('0x12')](util[_0xa450('0xb')](_0xa450('0x13'),QUERY),{'type':dbH[_0xa450('0x11')]['QueryTypes'][_0xa450('0x14')]});})[_0xa450('0x10')](function(_0x2c4298){if(!_0x2c4298[0x0][_0xa450('0x15')]){return analyticExtractedReport('Empty');}var _0x47f4ba=[];var _0x496d73=0x0;if(_0x44c32e['split']){if(_0x2c4298&&_0x2c4298[_0xa450('0x16')]){var _0x242835=_['range'](_0x2c4298[0x0]['num']/_0x270509);var _0xdaf577=Number[_0xa450('0x17')](_0x2c4298[0x0][_0xa450('0x15')]/_0x270509)?_0x2c4298[0x0][_0xa450('0x15')]%_0x270509:0x0;_0x242835[_0xa450('0x18')](function(_0x1d6a93){if(_0x1d6a93>0x0){_0x496d73+=_0x270509;}_0x47f4ba['push'](dbH[_0xa450('0x11')]['query'](util['format'](_0xa450('0x19'),QUERY,_0x270509,_0x496d73),{'type':dbH[_0xa450('0x11')][_0xa450('0x1a')]['SELECT']}));});if(_0xdaf577>0x0){_0x496d73+=_0x270509;_0x47f4ba[_0xa450('0x1b')](dbH[_0xa450('0x11')][_0xa450('0x12')](util[_0xa450('0xb')](_0xa450('0x19'),QUERY,_0xdaf577,_0x496d73),{'type':dbH['sequelize'][_0xa450('0x1a')][_0xa450('0x14')]}));}}}else{_0x47f4ba[_0xa450('0x1b')](dbH['sequelize'][_0xa450('0x12')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xa450('0x14')]}));}var _0x7f18b0=path[_0xa450('0x1c')](PATH);var _0x44a2f1=path[_0xa450('0x1d')](PATH,_0xa450('0x1e'));var _0x388c5e=_0x44c32e[_0xa450('0xe')]&&_0x47f4ba[_0xa450('0x16')]>0x1;var _0x23cb05=[];if(!fs['existsSync'](path['join'](_0x7f18b0,_0x44a2f1))&&_0x388c5e){fs[_0xa450('0x1f')](path[_0xa450('0x20')](_0x7f18b0,_0x44a2f1));}return BPromise[_0xa450('0x21')](_0x47f4ba,function(_0x5e9244){_0x23cb05[_0xa450('0x1b')](_0x5e9244);})[_0xa450('0x10')](function(){for(var _0x1b0558=0x0;_0x1b0558<_0x23cb05['length'];_0x1b0558+=0x1){var _0x1457da;var _0x58eb8b=_0x23cb05[_0x1b0558];if(_0x388c5e){_0x1457da=path[_0xa450('0x20')](_0x7f18b0,_0x44a2f1,util['format'](_0xa450('0x22'),_0x44a2f1,_0x1b0558,_0xa450('0x23')));}else{_0x1457da=path['join'](_0x7f18b0,util['format'](_0xa450('0x24'),_0x44a2f1,_0xa450('0x23')));}fs[_0xa450('0x25')](_0x1457da,csv(_0x58eb8b));}})[_0xa450('0x10')](function(){if(_0x388c5e){return new Promise(function(_0x38d9c4){zipdir(path[_0xa450('0x20')](_0x7f18b0,_0x44a2f1),{'saveTo':path[_0xa450('0x20')](_0x7f18b0,util[_0xa450('0xb')](_0xa450('0x24'),_0x44a2f1,_0xa450('0x26')))},function(_0x266a2f,_0x19715d){rimraf(path[_0xa450('0x20')](_0x7f18b0,_0x44a2f1),function(){});_0x38d9c4(_0xa450('0x27'));});});}})[_0xa450('0x10')](function(){logger['info'](util[_0xa450('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xa450('0xd')));return analyticExtractedReport(_0xa450('0x28'),_0x388c5e?util[_0xa450('0xb')](_0xa450('0x24'),_0x44a2f1,_0x388c5e?_0xa450('0x26'):_0xa450('0x23')):null);});})[_0xa450('0x29')](function(_0x55501a){logger[_0xa450('0x2a')](util[_0xa450('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x55501a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa450('0x2b')](function(){process[_0xa450('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 44b447c..4ff1471 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 _0xb09d=['right','num','Empty','Setting','find','split','splitSizePdf','then','length','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','Failed','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','interactionId','center','Interaction\x20Transcript','createWriteStream','finish','error','createPdfFromHTML','catch','lodash','path','moment','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','auto','body','push','concat','keys','forEach','format','name','startDate','endDate','header','margin','landscape','footer','Arial','black'];(function(_0x233716,_0x346676){var _0x302298=function(_0x53d84c){while(--_0x53d84c){_0x233716['push'](_0x233716['shift']());}};_0x302298(++_0x346676);}(_0xb09d,0x12f));var _0xdb09=function(_0xc6efce,_0x3da60b){_0xc6efce=_0xc6efce-0x0;var _0x4932e5=_0xb09d[_0xc6efce];return _0x4932e5;};'use strict';var _=require(_0xdb09('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xdb09('0x1'));var moment=require(_0xdb09('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xdb09('0x3'));var zipdir=require(_0xdb09('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0xdb09('0x5'))[_0xdb09('0x6')];var window=new JSDOM('')[_0xdb09('0x7')];var BPromise=require('bluebird');var db=require(_0xdb09('0x8'))['db'];var dbH=require(_0xdb09('0x8'))[_0xdb09('0x9')];var logger=require(_0xdb09('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xdb09('0xb')][0x2]);var QUERY=process[_0xdb09('0xb')][0x3];var PATH=process[_0xdb09('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cb1a0,_0x114d59){var _0x1334bd={'status':_0x2cb1a0};var _0x9033d5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x114d59){_0x1334bd[_0xdb09('0xc')]=_0x114d59;}return db[_0xdb09('0xd')][_0xdb09('0xe')](_0x1334bd,_0x9033d5);}function getHeaders(_0x2a9d38){return _[_0xdb09('0xf')](_0x2a9d38,function(_0x751570){return{'text':_0x751570,'style':_0xdb09('0x10')};});}function getRows(_0x25ebb8,_0x556540){return _[_0xdb09('0xf')](_0x556540,function(_0x230567){return _(_0x230567)[_0xdb09('0x11')](_0x25ebb8)[_0xdb09('0xf')](function(_0x1cdbb8){return _0x1cdbb8?_[_0xdb09('0x12')](_0x1cdbb8):'';})[_0xdb09('0x13')]();});}function createTable(_0x2fdb55,_0x424da7){var _0x4baddb={'widths':_[_0xdb09('0x14')](Array(_0x2fdb55['length']),0x91),'heights':function(_0x140272){return _0x140272===0x0?_0xdb09('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x356500=getHeaders(_0x2fdb55);_0x4baddb[_0xdb09('0x16')][_0xdb09('0x17')](_0x356500);var _0x17a417=getRows(_0x2fdb55,_0x424da7);_0x4baddb[_0xdb09('0x16')]=_0x4baddb[_0xdb09('0x16')][_0xdb09('0x18')](_0x17a417);return _0x4baddb;}function createTables(_0x535d2f){var _0x43a9b7=[];var _0x1a6f53=_['chunk'](Object[_0xdb09('0x19')](_0x535d2f[0x0]),0x5);_0x1a6f53[_0xdb09('0x1a')](function(_0x2bf667){_0x43a9b7['push'](createTable(_0x2bf667,_0x535d2f));});return _0x43a9b7;}function getPDFDocDefinition(_0x2a756f){var _0x21f349=util[_0xdb09('0x1b')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xdb09('0x1c')],moment(EXTRACTED_REPORT[_0xdb09('0x1d')])[_0xdb09('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0xdb09('0x1e')])[_0xdb09('0x1b')](FORMAT));var _0x135ada=[];for(var _0x16acd4=0x0;_0x16acd4<_0x2a756f['length'];_0x16acd4++){var _0x2002f9=[];if(_0x16acd4===0x0){_0x2002f9[_0xdb09('0x17')]({'text':_0x21f349,'style':_0xdb09('0x1f')});}var _0x1e6bbd={'table':_0x2a756f[_0x16acd4]};if(_0x16acd4>0x0){_0x1e6bbd['pageBreak']='before';_0x1e6bbd[_0xdb09('0x20')]=[0x0,0x46,0x0,0x0];}_0x2002f9[_0xdb09('0x17')](_0x1e6bbd);_0x135ada[_0xdb09('0x17')](_0x2002f9);}return{'pageSize':'A4','pageOrientation':_0xdb09('0x21'),'content':_0x135ada,'footer':function(_0x226a28,_0x1fd85d){return{'text':_0x226a28[_0xdb09('0x12')]()+'\x20/\x20'+_0x1fd85d,'style':_0xdb09('0x22')};},'defaultStyle':{'font':_0xdb09('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xdb09('0x24')},'footer':{'alignment':_0xdb09('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x57f153){var _0x373cc4=0x1388;var _0x287f76;if(!_0x57f153[0x0][_0xdb09('0x26')]){return analyticExtractedReport(_0xdb09('0x27'));}return db[_0xdb09('0x28')][_0xdb09('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdb09('0x2a'),_0xdb09('0x2b')]})[_0xdb09('0x2c')](function(_0x5d7c9b){if(_0x5d7c9b){_0x287f76=_0x5d7c9b;_0x373cc4=_0x287f76['splitSizePdf']||0x3e8;}})['then'](function(){var _0x71fe76=[];var _0x39ba4a=0x0;if(_0x287f76[_0xdb09('0x2a')]){if(_0x57f153&&_0x57f153[_0xdb09('0x2d')]){var _0x35b67d=_[_0xdb09('0x2e')](_0x57f153[0x0][_0xdb09('0x26')]/_0x373cc4);var _0x423c7b=Number[_0xdb09('0x2f')](_0x57f153[0x0][_0xdb09('0x26')]/_0x373cc4)?_0x57f153[0x0][_0xdb09('0x26')]%_0x373cc4:0x0;_0x35b67d[_0xdb09('0x1a')](function(_0x2795c1){if(_0x2795c1>0x0){_0x39ba4a+=_0x373cc4;}_0x71fe76[_0xdb09('0x17')](dbH[_0xdb09('0x30')][_0xdb09('0x31')](util[_0xdb09('0x1b')](_0xdb09('0x32'),QUERY,_0x373cc4,_0x39ba4a),{'type':dbH[_0xdb09('0x30')]['QueryTypes'][_0xdb09('0x33')]}));});if(_0x423c7b>0x0){_0x39ba4a+=_0x373cc4;_0x71fe76['push'](dbH['sequelize'][_0xdb09('0x31')](util[_0xdb09('0x1b')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x423c7b,_0x39ba4a),{'type':dbH[_0xdb09('0x30')]['QueryTypes'][_0xdb09('0x33')]}));}}}else{_0x71fe76[_0xdb09('0x17')](dbH[_0xdb09('0x30')][_0xdb09('0x31')](QUERY,{'type':dbH[_0xdb09('0x30')][_0xdb09('0x34')][_0xdb09('0x33')]}));}var _0xcf833d=path[_0xdb09('0x35')](PATH);var _0x202306=path['basename'](PATH,_0xdb09('0x36'));var _0x1e62cb=_0x287f76['split']&&_0x71fe76['length']>0x1;var _0x6b5716=[];if(!fs[_0xdb09('0x37')](path[_0xdb09('0x38')](_0xcf833d,_0x202306))&&_0x1e62cb){fs[_0xdb09('0x39')](path[_0xdb09('0x38')](_0xcf833d,_0x202306));}return BPromise[_0xdb09('0x3a')](_0x71fe76,function(_0x2c5625){_0x6b5716[_0xdb09('0x17')](_0x2c5625);})['then'](function(){var _0x475305=[];for(var _0x2b77df=0x0;_0x2b77df<_0x6b5716['length'];_0x2b77df+=0x1){var _0x2d173b=_0x6b5716[_0x2b77df];var _0x174096=createTables(_[_0xdb09('0x3b')](_0x2d173b));var _0x2855b7;var _0x15bf51=getPDFDocDefinition(_0x174096);var _0x131616=getPDFPrinter();var _0x482c0f=_0x131616[_0xdb09('0x3c')](_0x15bf51);if(_0x1e62cb){_0x2855b7=path[_0xdb09('0x38')](_0xcf833d,_0x202306,util[_0xdb09('0x1b')](_0xdb09('0x3d'),_0x202306,_0x2b77df,_0xdb09('0x3e')));}else{_0x2855b7=path[_0xdb09('0x38')](_0xcf833d,util[_0xdb09('0x1b')](_0xdb09('0x3f'),_0x202306,_0xdb09('0x3e')));}_0x475305[_0xdb09('0x17')](writePDFDocument(_0x482c0f,_0x2855b7));}return Promise[_0xdb09('0x40')](_0x475305);})[_0xdb09('0x2c')](function(){if(_0x1e62cb){return new Promise(function(_0x5d5f0e){zipdir(path['join'](_0xcf833d,_0x202306),{'saveTo':path[_0xdb09('0x38')](_0xcf833d,util[_0xdb09('0x1b')]('%s.%s',_0x202306,_0xdb09('0x41')))},function(){rimraf(path[_0xdb09('0x38')](_0xcf833d,_0x202306),function(){});_0x5d5f0e(_0xdb09('0x42'));});});}})[_0xdb09('0x2c')](function(){if(!_0x1e62cb)return;rimraf(path[_0xdb09('0x38')](_0xcf833d,_0x202306),function(){});})[_0xdb09('0x2c')](function(){logger[_0xdb09('0x43')](util[_0xdb09('0x1b')](_0xdb09('0x44'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x1e62cb?util[_0xdb09('0x1b')]('%s.%s',_0x202306,_0x1e62cb?_0xdb09('0x41'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xdb09('0x43')](util['format'](_0xdb09('0x45'),EXTRACTED_REPORT_ID,_0xdb09('0x46')));return db[_0xdb09('0xd')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xdb09('0x2c')](function(_0x2e3585){EXTRACTED_REPORT=_0x2e3585;return dbH[_0xdb09('0x30')][_0xdb09('0x31')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xdb09('0x30')][_0xdb09('0x34')][_0xdb09('0x33')]});})[_0xdb09('0x2c')](extractReport)['catch'](function(_0x2ff1df){logger[_0xdb09('0x43')](util[_0xdb09('0x1b')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xdb09('0x46')),util[_0xdb09('0x47')](_0x2ff1df,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdb09('0x48'));})['finally'](function(){process[_0xdb09('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1616c7=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xdb09('0x4a'),'italics':__dirname+_0xdb09('0x4b'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x1616c7;}function getPDFDocDefinitionFromHTML(_0x37134c,_0x595807){var _0x27c1e9=util[_0xdb09('0x1b')](_0xdb09('0x4c'),_0x595807['channel'],_0x595807[_0xdb09('0x4d')]);var _0x56321f=moment()['format']('YYYY-MM-DD')['toString']();var _0x514f88=htmlToPdfmake(_0x37134c,{'window':window,'tableAutoSize':!![]});return{'content':[_0x514f88],'defaultStyle':{'font':_0xdb09('0x23')},'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':_0xdb09('0x4e')}},'header':function(){return[{'text':_0xdb09('0x4f'),'style':_0xdb09('0x1f')}];},'footer':function(_0x2c3d2d,_0x5caa08){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x27c1e9,_0x2c3d2d,_0x5caa08,_0x56321f),'style':_0xdb09('0x22')}];}};}function writePDFDocument(_0x26f569,_0x57ca17){return new Promise(function(_0x5013ee,_0x32a39b){var _0x24b665=_0x26f569['pipe'](fs[_0xdb09('0x50')](_0x57ca17));_0x24b665['on'](_0xdb09('0x51'),function(){_0x5013ee(_0xdb09('0x51'));});_0x24b665['on'](_0xdb09('0x52'),function(_0x42a1aa){_0x32a39b(_0x42a1aa);});_0x26f569['end']();});}exports[_0xdb09('0x53')]=function(_0x380fb5,_0x17f104){var _0x3f0f34=getPDFPrinter();var _0x22a33c=getPDFDocDefinitionFromHTML(_0x380fb5,_0x17f104);var _0x470b45=_0x3f0f34[_0xdb09('0x3c')](_0x22a33c);return writePDFDocument(_0x470b45,_0x17f104['path'])[_0xdb09('0x54')](function(_0x110774){throw _0x110774;});}; \ No newline at end of file +var _0xfdc1=['all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','channel','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','lodash','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','argv','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','length','auto','push','body','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','format','pageBreak','before','margin','\x20/\x20','footer','black','right','Empty','split','splitSizePdf','then','range','num','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','.pdf','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s'];(function(_0x2d4e24,_0x4a324f){var _0x55c5dd=function(_0x39e1d){while(--_0x39e1d){_0x2d4e24['push'](_0x2d4e24['shift']());}};_0x55c5dd(++_0x4a324f);}(_0xfdc1,0x117));var _0x1fdc=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0xfdc1[_0x4392af];return _0x9fa8eb;};'use strict';var _=require(_0x1fdc('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x1fdc('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x1fdc('0x2'));var PdfPrinter=require(_0x1fdc('0x3'));var zipdir=require(_0x1fdc('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x1fdc('0x5'))[_0x1fdc('0x6')];var window=new JSDOM('')[_0x1fdc('0x7')];var BPromise=require(_0x1fdc('0x8'));var db=require(_0x1fdc('0x9'))['db'];var dbH=require(_0x1fdc('0x9'))[_0x1fdc('0xa')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x1fdc('0xb')][0x2]);var QUERY=process[_0x1fdc('0xb')][0x3];var PATH=process[_0x1fdc('0xb')][0x4];var NAME=process[_0x1fdc('0xb')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4f9b9b,_0x3e3f03){var _0x156660={'status':_0x4f9b9b};var _0x3b59ac={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3e3f03){_0x156660['savename']=_0x3e3f03;}return db[_0x1fdc('0xc')][_0x1fdc('0xd')](_0x156660,_0x3b59ac);}function getHeaders(_0x211c47){return _[_0x1fdc('0xe')](_0x211c47,function(_0x21e60f){return{'text':_0x21e60f,'style':_0x1fdc('0xf')};});}function getRows(_0x4b1fd2,_0x488171){return _[_0x1fdc('0xe')](_0x488171,function(_0x341026){return _(_0x341026)[_0x1fdc('0x10')](_0x4b1fd2)[_0x1fdc('0xe')](function(_0x27b2ce){return _0x27b2ce?_[_0x1fdc('0x11')](_0x27b2ce):'';})[_0x1fdc('0x12')]();});}function createTable(_0x47560d,_0x5289d4){var _0xc598c1={'widths':_['fill'](Array(_0x47560d[_0x1fdc('0x13')]),0x91),'heights':function(_0x3361c0){return _0x3361c0===0x0?_0x1fdc('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1e689b=getHeaders(_0x47560d);_0xc598c1['body'][_0x1fdc('0x15')](_0x1e689b);var _0x586843=getRows(_0x47560d,_0x5289d4);_0xc598c1[_0x1fdc('0x16')]=_0xc598c1[_0x1fdc('0x16')]['concat'](_0x586843);return _0xc598c1;}function createTables(_0x4c6cb3){var _0x49157e=[];var _0x518684=_[_0x1fdc('0x17')](Object[_0x1fdc('0x18')](_0x4c6cb3[0x0]),0x5);_0x518684[_0x1fdc('0x19')](function(_0xf43b8c){_0x49157e['push'](createTable(_0xf43b8c,_0x4c6cb3));});return _0x49157e;}function getPDFDocDefinition(_0x252e60){var _0x10c09c=util['format'](_0x1fdc('0x1a'),NAME,EXTRACTED_REPORT[_0x1fdc('0x1b')],moment(EXTRACTED_REPORT[_0x1fdc('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x1fdc('0x1d')])[_0x1fdc('0x1e')](FORMAT));var _0x2db094=[];for(var _0x25a97a=0x0;_0x25a97a<_0x252e60[_0x1fdc('0x13')];_0x25a97a++){var _0x71555f=[];if(_0x25a97a===0x0){_0x71555f[_0x1fdc('0x15')]({'text':_0x10c09c,'style':'header'});}var _0x9f9b4c={'table':_0x252e60[_0x25a97a]};if(_0x25a97a>0x0){_0x9f9b4c[_0x1fdc('0x1f')]=_0x1fdc('0x20');_0x9f9b4c[_0x1fdc('0x21')]=[0x0,0x46,0x0,0x0];}_0x71555f[_0x1fdc('0x15')](_0x9f9b4c);_0x2db094[_0x1fdc('0x15')](_0x71555f);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x2db094,'footer':function(_0x39b583,_0xfe1b2e){return{'text':_0x39b583['toString']()+_0x1fdc('0x22')+_0xfe1b2e,'style':_0x1fdc('0x23')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1fdc('0x24')},'footer':{'alignment':_0x1fdc('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x227336){var _0x1401f8=0x1388;var _0x6f84ab;if(!_0x227336[0x0]['num']){return analyticExtractedReport(_0x1fdc('0x26'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1fdc('0x27'),_0x1fdc('0x28')]})[_0x1fdc('0x29')](function(_0x14df7b){if(_0x14df7b){_0x6f84ab=_0x14df7b;_0x1401f8=_0x6f84ab[_0x1fdc('0x28')]||0x3e8;}})['then'](function(){var _0x1cd676=[];var _0x1fe9de=0x0;if(_0x6f84ab[_0x1fdc('0x27')]){if(_0x227336&&_0x227336['length']){var _0x355892=_[_0x1fdc('0x2a')](_0x227336[0x0]['num']/_0x1401f8);var _0x3672cb=Number['isInteger'](_0x227336[0x0][_0x1fdc('0x2b')]/_0x1401f8)?_0x227336[0x0][_0x1fdc('0x2b')]%_0x1401f8:0x0;_0x355892[_0x1fdc('0x19')](function(_0x556ad4){if(_0x556ad4>0x0){_0x1fe9de+=_0x1401f8;}_0x1cd676['push'](dbH[_0x1fdc('0x2c')]['query'](util[_0x1fdc('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1401f8,_0x1fe9de),{'type':dbH[_0x1fdc('0x2c')][_0x1fdc('0x2d')][_0x1fdc('0x2e')]}));});if(_0x3672cb>0x0){_0x1fe9de+=_0x1401f8;_0x1cd676[_0x1fdc('0x15')](dbH['sequelize']['query'](util[_0x1fdc('0x1e')](_0x1fdc('0x2f'),QUERY,_0x3672cb,_0x1fe9de),{'type':dbH[_0x1fdc('0x2c')][_0x1fdc('0x2d')]['SELECT']}));}}}else{_0x1cd676['push'](dbH['sequelize'][_0x1fdc('0x30')](QUERY,{'type':dbH['sequelize'][_0x1fdc('0x2d')][_0x1fdc('0x2e')]}));}var _0x4dcdc2=path[_0x1fdc('0x31')](PATH);var _0x980f1c=path[_0x1fdc('0x32')](PATH,_0x1fdc('0x33'));var _0x4bc0bc=_0x6f84ab[_0x1fdc('0x27')]&&_0x1cd676[_0x1fdc('0x13')]>0x1;var _0x24c1df=[];if(!fs[_0x1fdc('0x34')](path['join'](_0x4dcdc2,_0x980f1c))&&_0x4bc0bc){fs[_0x1fdc('0x35')](path[_0x1fdc('0x36')](_0x4dcdc2,_0x980f1c));}return BPromise[_0x1fdc('0x37')](_0x1cd676,function(_0x1c1921){_0x24c1df[_0x1fdc('0x15')](_0x1c1921);})['then'](function(){var _0x35ad86=[];for(var _0x484f5d=0x0;_0x484f5d<_0x24c1df['length'];_0x484f5d+=0x1){var _0x49da7b=_0x24c1df[_0x484f5d];var _0x33e7b6=createTables(_[_0x1fdc('0x38')](_0x49da7b));var _0x339dec;var _0x5d3e69=getPDFDocDefinition(_0x33e7b6);var _0x545236=getPDFPrinter();var _0x542792=_0x545236[_0x1fdc('0x39')](_0x5d3e69);if(_0x4bc0bc){_0x339dec=path[_0x1fdc('0x36')](_0x4dcdc2,_0x980f1c,util['format'](_0x1fdc('0x3a'),_0x980f1c,_0x484f5d,_0x1fdc('0x3b')));}else{_0x339dec=path[_0x1fdc('0x36')](_0x4dcdc2,util[_0x1fdc('0x1e')](_0x1fdc('0x3c'),_0x980f1c,_0x1fdc('0x3b')));}_0x35ad86[_0x1fdc('0x15')](writePDFDocument(_0x542792,_0x339dec));}return Promise[_0x1fdc('0x3d')](_0x35ad86);})[_0x1fdc('0x29')](function(){if(_0x4bc0bc){return new Promise(function(_0x2f4750){zipdir(path[_0x1fdc('0x36')](_0x4dcdc2,_0x980f1c),{'saveTo':path[_0x1fdc('0x36')](_0x4dcdc2,util['format']('%s.%s',_0x980f1c,'zip'))},function(){rimraf(path[_0x1fdc('0x36')](_0x4dcdc2,_0x980f1c),function(){});_0x2f4750(_0x1fdc('0x3e'));});});}})[_0x1fdc('0x29')](function(){if(!_0x4bc0bc)return;rimraf(path[_0x1fdc('0x36')](_0x4dcdc2,_0x980f1c),function(){});})[_0x1fdc('0x29')](function(){logger[_0x1fdc('0x3f')](util[_0x1fdc('0x1e')](_0x1fdc('0x40'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x1fdc('0x41'),_0x4bc0bc?util[_0x1fdc('0x1e')]('%s.%s',_0x980f1c,_0x4bc0bc?_0x1fdc('0x42'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1fdc('0x3f')](util[_0x1fdc('0x1e')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1fdc('0x43')));return db['AnalyticExtractedReport'][_0x1fdc('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1fdc('0x29')](function(_0xddef51){EXTRACTED_REPORT=_0xddef51;return dbH[_0x1fdc('0x2c')]['query'](util[_0x1fdc('0x1e')](_0x1fdc('0x45'),QUERY),{'type':dbH['sequelize'][_0x1fdc('0x2d')][_0x1fdc('0x2e')]});})[_0x1fdc('0x29')](extractReport)[_0x1fdc('0x46')](function(_0x35e6bb){logger[_0x1fdc('0x3f')](util['format'](_0x1fdc('0x47'),EXTRACTED_REPORT_ID,'PDF'),util[_0x1fdc('0x48')](_0x35e6bb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x1fdc('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xb4bc30=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x1fdc('0x4a'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x1fdc('0x4b')}});return _0xb4bc30;}function getPDFDocDefinitionFromHTML(_0x32e7d3,_0x32ebe0){var _0x34d389=util[_0x1fdc('0x1e')]('%s\x20#%d',_0x32ebe0[_0x1fdc('0x4c')],_0x32ebe0['interactionId']);var _0x228256=moment()[_0x1fdc('0x1e')](_0x1fdc('0x4d'))['toString']();var _0x40791e=htmlToPdfmake(_0x32e7d3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x40791e],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1fdc('0x4e'),'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':_0x1fdc('0x4e')}},'header':function(){return[{'text':_0x1fdc('0x4f'),'style':_0x1fdc('0x50')}];},'footer':function(_0x3ef64f,_0x205706){return[{'text':util[_0x1fdc('0x1e')](_0x1fdc('0x51'),_0x34d389,_0x3ef64f,_0x205706,_0x228256),'style':_0x1fdc('0x23')}];}};}function writePDFDocument(_0x222081,_0xbffb73){return new Promise(function(_0x47abc5,_0x111934){var _0xeb61c3=_0x222081[_0x1fdc('0x52')](fs['createWriteStream'](_0xbffb73));_0xeb61c3['on']('finish',function(){_0x47abc5(_0x1fdc('0x53'));});_0xeb61c3['on'](_0x1fdc('0x54'),function(_0x5a62d0){_0x111934(_0x5a62d0);});_0x222081['end']();});}exports['createPdfFromHTML']=function(_0xaf6caa,_0x1545f8){var _0x90ecc4=getPDFPrinter();var _0x5673fa=getPDFDocDefinitionFromHTML(_0xaf6caa,_0x1545f8);var _0x276f1d=_0x90ecc4['createPdfKitDocument'](_0x5673fa);return writePDFDocument(_0x276f1d,_0x1545f8[_0x1fdc('0x1')])[_0x1fdc('0x46')](function(_0x30227f){throw _0x30227f;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 135fd16..c0de839 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 _0x5525=['zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','exit','util','path','lodash','json2xls','bluebird','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','XLSX','find','splitSizeXlsx','then','Empty','split','range','num','isInteger','forEach','push','sequelize','query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','length','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','Completed'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5525,0x87));var _0x5552=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5525[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0x5552('0x0'));var path=require(_0x5552('0x1'));var _=require(_0x5552('0x2'));var fs=require('fs');var json2xls=require(_0x5552('0x3'));var BPromise=require(_0x5552('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x5552('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x5552('0x6'))(_0x5552('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x5552('0x8')][0x3];var PATH=process[_0x5552('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x230857,_0x4ab86c){var _0x435989={'status':_0x230857};var _0x5746d9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4ab86c){_0x435989[_0x5552('0x9')]=_0x4ab86c;}return db[_0x5552('0xa')][_0x5552('0xb')](_0x435989,_0x5746d9);}function main(){var _0x3c106e=0x1388;var _0x3af34c;logger[_0x5552('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x5552('0xd')));return db['Setting'][_0x5552('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x5552('0xf')]})[_0x5552('0x10')](function(_0x5864a6){if(_0x5864a6){_0x3af34c=_0x5864a6;_0x3c106e=_0x3af34c[_0x5552('0xf')]||0x1388;}})[_0x5552('0x10')](function(){return dbH['sequelize']['query'](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x5552('0x10')](function(_0x5561a9){if(!_0x5561a9[0x0]['num']){return analyticExtractedReport(_0x5552('0x11'));}var _0x5e78d9=[];var _0x5552c2=0x0;if(_0x3af34c[_0x5552('0x12')]){if(_0x5561a9&&_0x5561a9['length']){var _0x298b49=_[_0x5552('0x13')](_0x5561a9[0x0][_0x5552('0x14')]/_0x3c106e);var _0x5325df=Number[_0x5552('0x15')](_0x5561a9[0x0][_0x5552('0x14')]/_0x3c106e)?_0x5561a9[0x0][_0x5552('0x14')]%_0x3c106e:0x0;_0x298b49[_0x5552('0x16')](function(_0x40d9cf){if(_0x40d9cf>0x0){_0x5552c2+=_0x3c106e;}_0x5e78d9[_0x5552('0x17')](dbH[_0x5552('0x18')][_0x5552('0x19')](util[_0x5552('0x1a')](_0x5552('0x1b'),QUERY,_0x3c106e,_0x5552c2),{'type':dbH[_0x5552('0x18')][_0x5552('0x1c')][_0x5552('0x1d')]}));});if(_0x5325df>0x0){_0x5552c2+=_0x3c106e;_0x5e78d9[_0x5552('0x17')](dbH[_0x5552('0x18')]['query'](util[_0x5552('0x1a')](_0x5552('0x1b'),QUERY,_0x5325df,_0x5552c2),{'type':dbH[_0x5552('0x18')][_0x5552('0x1c')]['SELECT']}));}}}else{_0x5e78d9[_0x5552('0x17')](dbH[_0x5552('0x18')]['query'](QUERY,{'type':dbH[_0x5552('0x18')][_0x5552('0x1c')]['SELECT']}));}var _0x2bad0a=path[_0x5552('0x1e')](PATH);var _0x351725=path[_0x5552('0x1f')](PATH,'.xlsx');var _0x22b13b=_0x3af34c['split']&&_0x5e78d9[_0x5552('0x20')]>0x1;var _0x42c5fd=[];if(!fs['existsSync'](path[_0x5552('0x21')](_0x2bad0a,_0x351725))&&_0x22b13b){fs['mkdirSync'](path[_0x5552('0x21')](_0x2bad0a,_0x351725));}return BPromise[_0x5552('0x22')](_0x5e78d9,function(_0x365022){_0x42c5fd[_0x5552('0x17')](_0x365022);})['then'](function(){for(var _0x7a298f=0x0;_0x7a298f<_0x42c5fd[_0x5552('0x20')];_0x7a298f+=0x1){var _0x5c0bc0;var _0x1f8b87=_0x42c5fd[_0x7a298f];if(_0x22b13b){_0x5c0bc0=path[_0x5552('0x21')](_0x2bad0a,_0x351725,util[_0x5552('0x1a')](_0x5552('0x23'),_0x351725,_0x7a298f,_0x5552('0x24')));}else{_0x5c0bc0=path[_0x5552('0x21')](_0x2bad0a,util[_0x5552('0x1a')](_0x5552('0x25'),_0x351725,_0x5552('0x24')));}fs[_0x5552('0x26')](_0x5c0bc0,json2xls(_0x1f8b87),_0x5552('0x27'));}})['then'](function(){if(_0x22b13b){return new Promise(function(_0x2b04d5){zipdir(path[_0x5552('0x21')](_0x2bad0a,_0x351725),{'saveTo':path[_0x5552('0x21')](_0x2bad0a,util[_0x5552('0x1a')](_0x5552('0x25'),_0x351725,'zip'))},function(_0x5fc37,_0x4b6977){rimraf(path[_0x5552('0x21')](_0x2bad0a,_0x351725),function(){});_0x2b04d5('zip\x20finished');});});}})[_0x5552('0x10')](function(){logger[_0x5552('0xc')](util[_0x5552('0x1a')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x5552('0x28'),_0x22b13b?util['format'](_0x5552('0x25'),_0x351725,_0x22b13b?_0x5552('0x29'):_0x5552('0x24')):null);});})['catch'](function(_0x539bf8){logger[_0x5552('0xc')](util['format'](_0x5552('0x2a'),EXTRACTED_REPORT_ID,_0x5552('0xd')),util['inspect'](_0x539bf8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x5552('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb8c1=['rimraf','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','split','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.xlsx','existsSync','%s%d.%s','join','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','exit','path','lodash','json2xls','bluebird','zip-dir'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xb8c1,0x91));var _0x1b8c=function(_0x1ef953,_0x5f4de4){_0x1ef953=_0x1ef953-0x0;var _0x246088=_0xb8c1[_0x1ef953];return _0x246088;};'use strict';var util=require('util');var path=require(_0x1b8c('0x0'));var _=require(_0x1b8c('0x1'));var fs=require('fs');var json2xls=require(_0x1b8c('0x2'));var BPromise=require(_0x1b8c('0x3'));var zipdir=require(_0x1b8c('0x4'));var rimraf=require(_0x1b8c('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x1b8c('0x6'))(_0x1b8c('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x1b8c('0x8')][0x2]);var QUERY=process[_0x1b8c('0x8')][0x3];var PATH=process[_0x1b8c('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x148847,_0x23191c){var _0xd96ed1={'status':_0x148847};var _0x4e0510={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x23191c){_0xd96ed1[_0x1b8c('0x9')]=_0x23191c;}return db[_0x1b8c('0xa')]['update'](_0xd96ed1,_0x4e0510);}function main(){var _0x32f5cd=0x1388;var _0x311a9a;logger[_0x1b8c('0xb')](util[_0x1b8c('0xc')](_0x1b8c('0xd'),EXTRACTED_REPORT_ID,_0x1b8c('0xe')));return db[_0x1b8c('0xf')][_0x1b8c('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1b8c('0x11')]})['then'](function(_0x29b1a4){if(_0x29b1a4){_0x311a9a=_0x29b1a4;_0x32f5cd=_0x311a9a['splitSizeXlsx']||0x1388;}})[_0x1b8c('0x12')](function(){return dbH[_0x1b8c('0x13')][_0x1b8c('0x14')](util['format'](_0x1b8c('0x15'),QUERY),{'type':dbH[_0x1b8c('0x13')]['QueryTypes']['SELECT']});})[_0x1b8c('0x12')](function(_0x7be88a){if(!_0x7be88a[0x0][_0x1b8c('0x16')]){return analyticExtractedReport(_0x1b8c('0x17'));}var _0x3c1156=[];var _0x35a970=0x0;if(_0x311a9a[_0x1b8c('0x18')]){if(_0x7be88a&&_0x7be88a[_0x1b8c('0x19')]){var _0x14e3c9=_[_0x1b8c('0x1a')](_0x7be88a[0x0][_0x1b8c('0x16')]/_0x32f5cd);var _0x1088db=Number[_0x1b8c('0x1b')](_0x7be88a[0x0]['num']/_0x32f5cd)?_0x7be88a[0x0][_0x1b8c('0x16')]%_0x32f5cd:0x0;_0x14e3c9['forEach'](function(_0x98cc02){if(_0x98cc02>0x0){_0x35a970+=_0x32f5cd;}_0x3c1156[_0x1b8c('0x1c')](dbH[_0x1b8c('0x13')]['query'](util[_0x1b8c('0xc')](_0x1b8c('0x1d'),QUERY,_0x32f5cd,_0x35a970),{'type':dbH[_0x1b8c('0x13')][_0x1b8c('0x1e')][_0x1b8c('0x1f')]}));});if(_0x1088db>0x0){_0x35a970+=_0x32f5cd;_0x3c1156[_0x1b8c('0x1c')](dbH[_0x1b8c('0x13')]['query'](util[_0x1b8c('0xc')](_0x1b8c('0x1d'),QUERY,_0x1088db,_0x35a970),{'type':dbH[_0x1b8c('0x13')][_0x1b8c('0x1e')][_0x1b8c('0x1f')]}));}}}else{_0x3c1156['push'](dbH[_0x1b8c('0x13')][_0x1b8c('0x14')](QUERY,{'type':dbH[_0x1b8c('0x13')][_0x1b8c('0x1e')][_0x1b8c('0x1f')]}));}var _0x5b10fb=path[_0x1b8c('0x20')](PATH);var _0x55bb50=path[_0x1b8c('0x21')](PATH,_0x1b8c('0x22'));var _0x34cf0b=_0x311a9a[_0x1b8c('0x18')]&&_0x3c1156[_0x1b8c('0x19')]>0x1;var _0x460208=[];if(!fs[_0x1b8c('0x23')](path['join'](_0x5b10fb,_0x55bb50))&&_0x34cf0b){fs['mkdirSync'](path['join'](_0x5b10fb,_0x55bb50));}return BPromise['each'](_0x3c1156,function(_0x8c8eb0){_0x460208['push'](_0x8c8eb0);})['then'](function(){for(var _0x63f6f9=0x0;_0x63f6f9<_0x460208[_0x1b8c('0x19')];_0x63f6f9+=0x1){var _0x47bf38;var _0x11a53f=_0x460208[_0x63f6f9];if(_0x34cf0b){_0x47bf38=path['join'](_0x5b10fb,_0x55bb50,util[_0x1b8c('0xc')](_0x1b8c('0x24'),_0x55bb50,_0x63f6f9,'xlsx'));}else{_0x47bf38=path[_0x1b8c('0x25')](_0x5b10fb,util[_0x1b8c('0xc')](_0x1b8c('0x26'),_0x55bb50,_0x1b8c('0x27')));}fs[_0x1b8c('0x28')](_0x47bf38,json2xls(_0x11a53f),_0x1b8c('0x29'));}})[_0x1b8c('0x12')](function(){if(_0x34cf0b){return new Promise(function(_0x1cd705){zipdir(path[_0x1b8c('0x25')](_0x5b10fb,_0x55bb50),{'saveTo':path[_0x1b8c('0x25')](_0x5b10fb,util['format'](_0x1b8c('0x26'),_0x55bb50,_0x1b8c('0x2a')))},function(_0x27561a,_0x5e15f0){rimraf(path[_0x1b8c('0x25')](_0x5b10fb,_0x55bb50),function(){});_0x1cd705(_0x1b8c('0x2b'));});});}})[_0x1b8c('0x12')](function(){logger[_0x1b8c('0xb')](util[_0x1b8c('0xc')](_0x1b8c('0x2c'),EXTRACTED_REPORT_ID,_0x1b8c('0xe')));return analyticExtractedReport(_0x1b8c('0x2d'),_0x34cf0b?util[_0x1b8c('0xc')]('%s.%s',_0x55bb50,_0x34cf0b?_0x1b8c('0x2a'):_0x1b8c('0x27')):null);});})[_0x1b8c('0x2e')](function(_0x113c97){logger['info'](util[_0x1b8c('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1b8c('0xe')),util[_0x1b8c('0x2f')](_0x113c97,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1b8c('0x30'));})['finally'](function(){process[_0x1b8c('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index c09f387..6e7e6c9 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 _0x3da3=['_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','IntervalId','interval','tag','CDR(tag)=','callerID','$[${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','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','Hangup','concat','transaction','destroy','sortBy','error','rewrite','util','models','Interval','intervals','VoiceExtension','findAll','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extension','find','extensions','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','push','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid='];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3da3,0xef));var _0x33da=function(_0x39a873,_0x449c58){_0x39a873=_0x39a873-0x0;var _0x3a2c5f=_0x3da3[_0x39a873];return _0x3a2c5f;};'use strict';var _=require('lodash');var util=require(_0x33da('0x0'));function rewrite(_0x52eeb3,_0x125c7d){var _0x7e1adf=this;return _0x52eeb3[_0x33da('0x1')][_0x33da('0x2')]['findAll']({'raw':!![]})['then'](function(_0x3c5f4c){_0x7e1adf[_0x33da('0x3')]=_0x3c5f4c;return _0x52eeb3['models'][_0x33da('0x4')][_0x33da('0x5')]({'where':{'IntervalId':_0x125c7d['IntervalId']},'raw':!![]});})[_0x33da('0x6')](function(_0x557b34){return _0x52eeb3[_0x33da('0x1')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0x33da('0x7')](_[_0x33da('0x8')](_0x557b34,_0x33da('0x9')))}},'order':[{'raw':_0x33da('0xa')}],'raw':!![]});})[_0x33da('0x6')](function(_0x3bf8b0){var _0x35a39e=_[_0x33da('0xb')](_0x3bf8b0,{'priority':'1'});var _0x22725c=_[_0x33da('0xb')](_0x3bf8b0,{'isApp':0x1});var _0x5635a5=_['groupBy'](_0x22725c,_0x33da('0x9'));var _0x41517b=[_0x33da('0xc'),_0x33da('0xd')];var _0x32dc72=[];var _0x59c4e3=[];for(var _0x59750a in _0x5635a5){if(_0x5635a5[_0x33da('0xe')](_0x59750a)){_0x7e1adf[_0x33da('0xf')]=0x2;_0x7e1adf['extensions']=[];_0x7e1adf[_0x33da('0x10')]=_[_0x33da('0x11')](_0x35a39e,{'exten':_0x5635a5[_0x59750a][0x0]['exten']});_0x7e1adf[_0x33da('0x12')]['push']({'type':_0x5635a5[_0x59750a][0x0]['type'],'app':_0x33da('0x13'),'appdata':util[_0x33da('0x14')](_0x33da('0x15'),_0x5635a5[_0x59750a][0x0][_0x33da('0x16')]),'context':_0x5635a5[_0x59750a][0x0][_0x33da('0x17')],'exten':_0x5635a5[_0x59750a][0x0][_0x33da('0x9')],'priority':_0x7e1adf[_0x33da('0xf')]++,'VoiceExtensionId':_0x5635a5[_0x59750a][0x0][_0x33da('0x18')]});if(_0x5635a5[_0x59750a][0x0][_0x33da('0x16')]==='inbound'){_0x7e1adf['extensions'][_0x33da('0x19')]({'type':_0x5635a5[_0x59750a][0x0]['type'],'app':'Set','appdata':_0x33da('0x1a')+_0x5635a5[_0x59750a][0x0][_0x33da('0x18')],'context':_0x5635a5[_0x59750a][0x0]['context'],'exten':_0x5635a5[_0x59750a][0x0][_0x33da('0x9')],'priority':_0x7e1adf[_0x33da('0xf')]++,'VoiceExtensionId':_0x5635a5[_0x59750a][0x0]['VoiceExtensionId']});}else if(_0x5635a5[_0x59750a][0x0][_0x33da('0x16')]===_0x33da('0x1b')){if(_0x7e1adf[_0x33da('0x10')]){_0x7e1adf[_0x33da('0x12')][_0x33da('0x19')]({'type':_0x5635a5[_0x59750a][0x0][_0x33da('0x16')],'app':_0x33da('0x13'),'appdata':_0x33da('0x1c')+(_0x7e1adf[_0x33da('0x10')][_0x33da('0x1d')]?_0x33da('0x1e')+_0x7e1adf[_0x33da('0x10')][_0x33da('0x1d')]+'}':_0x33da('0x1f')),'context':_0x5635a5[_0x59750a][0x0][_0x33da('0x17')],'exten':_0x5635a5[_0x59750a][0x0][_0x33da('0x9')],'priority':_0x7e1adf[_0x33da('0xf')]++,'VoiceExtensionId':_0x5635a5[_0x59750a][0x0]['VoiceExtensionId']});}_0x7e1adf[_0x33da('0x12')]['push']({'type':_0x5635a5[_0x59750a][0x0][_0x33da('0x16')],'app':'Set','appdata':_0x33da('0x1a')+_0x5635a5[_0x59750a][0x0][_0x33da('0x18')],'context':_0x5635a5[_0x59750a][0x0]['context'],'exten':_0x5635a5[_0x59750a][0x0][_0x33da('0x9')],'priority':_0x7e1adf[_0x33da('0xf')]++,'VoiceExtensionId':_0x5635a5[_0x59750a][0x0]['VoiceExtensionId']});var _0x22ae7d=_0x7e1adf[_0x33da('0xf')]++;_0x7e1adf[_0x33da('0x12')][_0x33da('0x19')]({'type':_0x5635a5[_0x59750a][0x0][_0x33da('0x16')],'app':_0x33da('0x20'),'appdata':_0x33da('0x21')+(_0x22ae7d+0x2)+'):Goto('+(_0x22ae7d+0x1)+')','context':_0x5635a5[_0x59750a][0x0][_0x33da('0x17')],'exten':_0x5635a5[_0x59750a][0x0][_0x33da('0x9')],'priority':_0x22ae7d,'VoiceExtensionId':_0x5635a5[_0x59750a][0x0][_0x33da('0x18')]});if(_0x7e1adf[_0x33da('0x10')]){_0x7e1adf[_0x33da('0x12')][_0x33da('0x19')]({'type':_0x5635a5[_0x59750a][0x0][_0x33da('0x16')],'app':'Set','appdata':_0x7e1adf['extension'][_0x33da('0x1d')]?_0x33da('0x22')+_0x7e1adf['extension'][_0x33da('0x1d')]+'}':_0x33da('0x23'),'context':_0x5635a5[_0x59750a][0x0][_0x33da('0x17')],'exten':_0x5635a5[_0x59750a][0x0][_0x33da('0x9')],'priority':_0x7e1adf['priority']++,'VoiceExtensionId':_0x5635a5[_0x59750a][0x0][_0x33da('0x18')]});}_0x7e1adf[_0x33da('0x12')][_0x33da('0x19')]({'type':_0x5635a5[_0x59750a][0x0][_0x33da('0x16')],'app':_0x33da('0x13'),'appdata':_0x33da('0x24')+_0x5635a5[_0x59750a][0x0][_0x33da('0x18')],'context':_0x5635a5[_0x59750a][0x0]['context'],'exten':_0x5635a5[_0x59750a][0x0][_0x33da('0x9')],'priority':_0x7e1adf['priority']++,'VoiceExtensionId':_0x5635a5[_0x59750a][0x0][_0x33da('0x18')]});if(_0x7e1adf[_0x33da('0x10')]&&_0x7e1adf['extension'][_0x33da('0xe')]('recordingFormat')&&_0x7e1adf['extension']['recordingFormat']!=='none'){_0x7e1adf[_0x33da('0x12')][_0x33da('0x19')]({'type':_0x5635a5[_0x59750a][0x0][_0x33da('0x16')],'app':_0x33da('0x13'),'appdata':_0x33da('0x25'),'context':_0x5635a5[_0x59750a][0x0][_0x33da('0x17')],'exten':_0x5635a5[_0x59750a][0x0][_0x33da('0x9')],'priority':_0x7e1adf[_0x33da('0xf')]++,'VoiceExtensionId':_0x5635a5[_0x59750a][0x0][_0x33da('0x18')]});_0x7e1adf[_0x33da('0x12')][_0x33da('0x19')]({'type':_0x5635a5[_0x59750a][0x0][_0x33da('0x16')],'app':_0x33da('0x13'),'appdata':_0x33da('0x26')+_0x7e1adf['extension']['recordingFormat']||_0x33da('0x27'),'context':_0x5635a5[_0x59750a][0x0][_0x33da('0x17')],'exten':_0x5635a5[_0x59750a][0x0][_0x33da('0x9')],'priority':_0x7e1adf[_0x33da('0xf')]++,'VoiceExtensionId':_0x5635a5[_0x59750a][0x0][_0x33da('0x18')]});}}_0x7e1adf[_0x33da('0x12')][_0x33da('0x19')]({'type':_0x5635a5[_0x59750a][0x0]['type'],'app':'Set','appdata':_0x33da('0x28'),'context':_0x5635a5[_0x59750a][0x0]['context'],'exten':_0x5635a5[_0x59750a][0x0]['exten'],'priority':_0x7e1adf[_0x33da('0xf')]++,'VoiceExtensionId':_0x5635a5[_0x59750a][0x0][_0x33da('0x18')]});_0x7e1adf[_0x33da('0x12')][_0x33da('0x19')]({'type':_0x5635a5[_0x59750a][0x0][_0x33da('0x16')],'app':_0x33da('0x13'),'appdata':_0x33da('0x29'),'context':_0x5635a5[_0x59750a][0x0][_0x33da('0x17')],'exten':_0x5635a5[_0x59750a][0x0][_0x33da('0x9')],'priority':_0x7e1adf['priority']++,'VoiceExtensionId':_0x5635a5[_0x59750a][0x0][_0x33da('0x18')]});_0x7e1adf[_0x33da('0x12')][_0x33da('0x19')]({'type':_0x5635a5[_0x59750a][0x0][_0x33da('0x16')],'app':'Set','appdata':_0x33da('0x2a'),'context':_0x5635a5[_0x59750a][0x0][_0x33da('0x17')],'exten':_0x5635a5[_0x59750a][0x0][_0x33da('0x9')],'priority':_0x7e1adf[_0x33da('0xf')]++,'VoiceExtensionId':_0x5635a5[_0x59750a][0x0][_0x33da('0x18')]});for(var _0x16169e=0x0,_0x4632fe=0x0;_0x16169e<_0x5635a5[_0x59750a][_0x33da('0x2b')];_0x16169e+=0x1,_0x4632fe=0x0){var _0x4683dd=_0x5635a5[_0x59750a][_0x16169e];if(_0x4683dd[_0x33da('0x16')]){_0x4683dd[_0x33da('0x16')]=_0x4683dd['type'][_0x33da('0x2c')]();}var _0x2d7a9f=[];var _0x23d135=[];delete _0x4683dd['id'];delete _0x4683dd[_0x33da('0x2d')];delete _0x4683dd[_0x33da('0x2e')];var _0x1528fb=_0x4683dd['interval']!=='*,*,*,*'?[_0x4683dd['interval']]:_0x4683dd[_0x33da('0x2f')]?_[_0x33da('0x8')](_[_0x33da('0xb')](_0x7e1adf['intervals'],{'IntervalId':_0x4683dd['IntervalId']}),_0x33da('0x30')):[];if(_0x4683dd['hasOwnProperty']('tag')){if(_0x4683dd[_0x33da('0x31')]&&_0x4683dd['tag']!=='--'){_0x2d7a9f[_0x33da('0x19')]({'type':_0x4683dd[_0x33da('0x16')],'app':_0x33da('0x13'),'appdata':_0x33da('0x32')+_0x4683dd[_0x33da('0x31')],'context':_0x4683dd[_0x33da('0x17')],'exten':_0x4683dd[_0x33da('0x9')],'priority':_0x1528fb['length']+_0x7e1adf[_0x33da('0xf')]+_0x4632fe++,'VoiceExtensionId':_0x4683dd[_0x33da('0x18')]});}}if(_0x4683dd[_0x33da('0x16')]==='outbound'&&_0x4683dd[_0x33da('0xe')](_0x33da('0x33'))){if(_0x4683dd[_0x33da('0x33')]){_0x2d7a9f['push']({'type':_0x4683dd[_0x33da('0x16')],'app':'ExecIf','appdata':_0x33da('0x34')+_0x4683dd[_0x33da('0x33')]+')','context':_0x4683dd[_0x33da('0x17')],'exten':_0x4683dd[_0x33da('0x9')],'priority':_0x1528fb['length']+_0x7e1adf[_0x33da('0xf')]+_0x4632fe++,'VoiceExtensionId':_0x4683dd[_0x33da('0x18')]});}else{_0x2d7a9f['push']({'type':_0x4683dd[_0x33da('0x16')],'app':'ExecIf','appdata':_0x33da('0x35'),'context':_0x4683dd['context'],'exten':_0x4683dd['exten'],'priority':_0x1528fb['length']+_0x7e1adf[_0x33da('0xf')]+_0x4632fe++,'VoiceExtensionId':_0x4683dd[_0x33da('0x18')]});}}if(_0x4683dd[_0x33da('0xe')](_0x33da('0x36'))){if(_0x41517b['indexOf'](_0x4683dd['app'][_0x33da('0x2c')]())>=0x0&&_0x4683dd[_0x33da('0x37')]!==_0x33da('0x38')){if(_0x4683dd['answer']){_0x2d7a9f[_0x33da('0x19')]({'type':_0x4683dd[_0x33da('0x16')],'app':_0x33da('0x20'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4683dd['context'],'exten':_0x4683dd[_0x33da('0x9')],'priority':_0x1528fb[_0x33da('0x2b')]+_0x7e1adf['priority']+_0x4632fe++,'VoiceExtensionId':_0x4683dd[_0x33da('0x18')]});_0x2d7a9f[_0x33da('0x19')]({'type':_0x4683dd[_0x33da('0x16')],'app':_0x33da('0x13'),'appdata':_0x33da('0x39'),'context':_0x4683dd['context'],'exten':_0x4683dd['exten'],'priority':_0x1528fb[_0x33da('0x2b')]+_0x7e1adf[_0x33da('0xf')]+_0x4632fe++,'VoiceExtensionId':_0x4683dd[_0x33da('0x18')]});}else{_0x2d7a9f['push']({'type':_0x4683dd[_0x33da('0x16')],'app':_0x33da('0x20'),'appdata':_0x33da('0x3a'),'context':_0x4683dd[_0x33da('0x17')],'exten':_0x4683dd[_0x33da('0x9')],'priority':_0x1528fb[_0x33da('0x2b')]+_0x7e1adf[_0x33da('0xf')]+_0x4632fe++,'VoiceExtensionId':_0x4683dd['VoiceExtensionId']});_0x2d7a9f[_0x33da('0x19')]({'type':_0x4683dd['type'],'app':'Set','appdata':_0x33da('0x3b'),'context':_0x4683dd['context'],'exten':_0x4683dd[_0x33da('0x9')],'priority':_0x1528fb[_0x33da('0x2b')]+_0x7e1adf[_0x33da('0xf')]+_0x4632fe++,'VoiceExtensionId':_0x4683dd[_0x33da('0x18')]});}}}for(var _0x5f010b=0x0;_0x5f010b<_0x1528fb[_0x33da('0x2b')];_0x5f010b+=0x1){var _0x616210=_0x7e1adf['priority']+_0x1528fb[_0x33da('0x2b')];var _0x38866b=_0x5f010b===_0x1528fb[_0x33da('0x2b')]-0x1?_0x7e1adf[_0x33da('0xf')]+_0x2d7a9f[_0x33da('0x2b')]+_0x23d135[_0x33da('0x2b')]+0x2:_0x7e1adf[_0x33da('0xf')]+_0x5f010b+0x1;_0x2d7a9f['splice'](_0x5f010b,0x0,{'type':_0x4683dd[_0x33da('0x16')],'app':_0x33da('0x3c'),'appdata':_0x1528fb[_0x5f010b]+'?'+_0x4683dd[_0x33da('0x17')]+_0x33da('0x3d')+_0x616210+':'+_0x4683dd[_0x33da('0x17')]+',${EXTEN},'+_0x38866b,'exten':_0x4683dd['exten'],'context':_0x4683dd[_0x33da('0x17')],'priority':_0x7e1adf[_0x33da('0xf')]+_0x5f010b,'VoiceExtensionId':_0x5635a5[_0x59750a][0x0][_0x33da('0x18')]});}_0x4683dd[_0x33da('0xf')]=_0x2d7a9f[_0x33da('0x2b')]?_['last'](_0x2d7a9f)[_0x33da('0xf')]+0x1:_0x7e1adf[_0x33da('0xf')];_0x7e1adf[_0x33da('0xf')]=(_0x23d135['length']?_['last'](_0x23d135)[_0x33da('0xf')]:_0x4683dd[_0x33da('0xf')])+0x1;_0x7e1adf[_0x33da('0x12')]=_['concat'](_0x7e1adf[_0x33da('0x12')],_0x2d7a9f,[_0x4683dd],_0x23d135);}_0x7e1adf[_0x33da('0x12')][_0x33da('0x19')]({'type':_0x5635a5[_0x59750a][0x0][_0x33da('0x16')],'app':_0x33da('0x3e'),'exten':_0x5635a5[_0x59750a][0x0]['exten'],'context':_0x5635a5[_0x59750a][0x0][_0x33da('0x17')],'priority':_0x7e1adf[_0x33da('0xf')],'VoiceExtensionId':_0x5635a5[_0x59750a][0x0][_0x33da('0x18')]});_0x32dc72[_0x33da('0x19')](_0x5635a5[_0x59750a][0x0]['VoiceExtensionId']);_0x59c4e3=_[_0x33da('0x3f')](_0x59c4e3,_0x7e1adf['extensions']);}}return _0x52eeb3[_0x33da('0x40')](function(_0x22121a){return _0x52eeb3[_0x33da('0x1')]['VoiceExtension'][_0x33da('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x32dc72}},'transaction':_0x22121a})['then'](function(_0x593bb8){return _0x52eeb3[_0x33da('0x1')][_0x33da('0x4')]['bulkCreate'](_[_0x33da('0x42')](_0x59c4e3,_0x33da('0xf')),{'transaction':_0x22121a});});});})['catch'](function(_0x392464){console[_0x33da('0x43')](_0x392464);});}exports[_0x33da('0x44')]=rewrite; \ No newline at end of file +var _0x24f1=['queue','playback','hasOwnProperty','priority','extensions','find','push','type','Set','format','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','extension','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','map','tag','CDR(tag)=','callerID','ExecIf','$[${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','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x24f1,0xd4));var _0x124f=function(_0x1e41db,_0x38d213){_0x1e41db=_0x1e41db-0x0;var _0x11b1ac=_0x24f1[_0x1e41db];return _0x11b1ac;};'use strict';var _=require(_0x124f('0x0'));var util=require(_0x124f('0x1'));function rewrite(_0x41e960,_0x21a835){var _0x432426=this;return _0x41e960[_0x124f('0x2')][_0x124f('0x3')][_0x124f('0x4')]({'raw':!![]})['then'](function(_0x46058a){_0x432426[_0x124f('0x5')]=_0x46058a;return _0x41e960[_0x124f('0x2')]['VoiceExtension'][_0x124f('0x4')]({'where':{'IntervalId':_0x21a835['IntervalId']},'raw':!![]});})['then'](function(_0x1ff200){return _0x41e960[_0x124f('0x2')][_0x124f('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x124f('0x7')](_['map'](_0x1ff200,_0x124f('0x8')))}},'order':[{'raw':_0x124f('0x9')}],'raw':!![]});})[_0x124f('0xa')](function(_0x573b91){var _0x2ded31=_['filter'](_0x573b91,{'priority':'1'});var _0x271422=_[_0x124f('0xb')](_0x573b91,{'isApp':0x1});var _0x228f10=_[_0x124f('0xc')](_0x271422,_0x124f('0x8'));var _0x4822c4=[_0x124f('0xd'),_0x124f('0xe')];var _0x5520ae=[];var _0x4c6588=[];for(var _0x1c95bc in _0x228f10){if(_0x228f10[_0x124f('0xf')](_0x1c95bc)){_0x432426[_0x124f('0x10')]=0x2;_0x432426[_0x124f('0x11')]=[];_0x432426['extension']=_[_0x124f('0x12')](_0x2ded31,{'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')]});_0x432426[_0x124f('0x11')][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':util[_0x124f('0x16')]('CDR(type)=%s',_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')]),'context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});if(_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')]===_0x124f('0x19')){_0x432426[_0x124f('0x11')]['push']({'type':_0x228f10[_0x1c95bc][0x0]['type'],'app':_0x124f('0x15'),'appdata':_0x124f('0x1a')+_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')],'context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0]['exten'],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});}else if(_0x228f10[_0x1c95bc][0x0]['type']===_0x124f('0x1b')){if(_0x432426['extension']){_0x432426[_0x124f('0x11')]['push']({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':_0x124f('0x1c')+(_0x432426[_0x124f('0x1d')][_0x124f('0x1e')]?_0x124f('0x1f')+_0x432426[_0x124f('0x1d')][_0x124f('0x1e')]+'}':_0x124f('0x20')),'context':_0x228f10[_0x1c95bc][0x0]['context'],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});}_0x432426[_0x124f('0x11')][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':_0x124f('0x1a')+_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')],'context':_0x228f10[_0x1c95bc][0x0]['context'],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});var _0x241ab2=_0x432426['priority']++;_0x432426['extensions'][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':'ExecIf','appdata':_0x124f('0x21')+(_0x241ab2+0x2)+'):Goto('+(_0x241ab2+0x1)+')','context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x241ab2,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});if(_0x432426[_0x124f('0x1d')]){_0x432426[_0x124f('0x11')][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':_0x432426[_0x124f('0x1d')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x432426['extension'][_0x124f('0x1e')]+'}':_0x124f('0x22'),'context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});}_0x432426[_0x124f('0x11')][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':_0x124f('0x23')+_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')],'context':_0x228f10[_0x1c95bc][0x0]['context'],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0]['VoiceExtensionId']});if(_0x432426['extension']&&_0x432426[_0x124f('0x1d')][_0x124f('0xf')](_0x124f('0x24'))&&_0x432426['extension'][_0x124f('0x24')]!==_0x124f('0x25')){_0x432426[_0x124f('0x11')]['push']({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':_0x124f('0x26'),'context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0]['exten'],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});_0x432426['extensions'][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':'Set','appdata':_0x124f('0x27')+_0x432426[_0x124f('0x1d')]['recordingFormat']||_0x124f('0x28'),'context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});}}_0x432426[_0x124f('0x11')][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});_0x432426[_0x124f('0x11')][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':_0x124f('0x29'),'context':_0x228f10[_0x1c95bc][0x0]['context'],'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'priority':_0x432426['priority']++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});_0x432426[_0x124f('0x11')]['push']({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'exten':_0x228f10[_0x1c95bc][0x0]['exten'],'priority':_0x432426[_0x124f('0x10')]++,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0]['VoiceExtensionId']});for(var _0x56faa8=0x0,_0x2e042b=0x0;_0x56faa8<_0x228f10[_0x1c95bc][_0x124f('0x2a')];_0x56faa8+=0x1,_0x2e042b=0x0){var _0x107688=_0x228f10[_0x1c95bc][_0x56faa8];if(_0x107688[_0x124f('0x14')]){_0x107688[_0x124f('0x14')]=_0x107688['type'][_0x124f('0x2b')]();}var _0xce3a59=[];var _0x102f7c=[];delete _0x107688['id'];delete _0x107688[_0x124f('0x2c')];delete _0x107688['updatedAt'];var _0x35dfee=_0x107688[_0x124f('0x2d')]!==_0x124f('0x2e')?[_0x107688[_0x124f('0x2d')]]:_0x107688[_0x124f('0x2f')]?_[_0x124f('0x30')](_[_0x124f('0xb')](_0x432426[_0x124f('0x5')],{'IntervalId':_0x107688[_0x124f('0x2f')]}),_0x124f('0x2d')):[];if(_0x107688[_0x124f('0xf')]('tag')){if(_0x107688['tag']&&_0x107688[_0x124f('0x31')]!=='--'){_0xce3a59[_0x124f('0x13')]({'type':_0x107688[_0x124f('0x14')],'app':'Set','appdata':_0x124f('0x32')+_0x107688[_0x124f('0x31')],'context':_0x107688['context'],'exten':_0x107688[_0x124f('0x8')],'priority':_0x35dfee[_0x124f('0x2a')]+_0x432426[_0x124f('0x10')]+_0x2e042b++,'VoiceExtensionId':_0x107688[_0x124f('0x18')]});}}if(_0x107688['type']===_0x124f('0x1b')&&_0x107688[_0x124f('0xf')](_0x124f('0x33'))){if(_0x107688[_0x124f('0x33')]){_0xce3a59[_0x124f('0x13')]({'type':_0x107688[_0x124f('0x14')],'app':_0x124f('0x34'),'appdata':_0x124f('0x35')+_0x107688[_0x124f('0x33')]+')','context':_0x107688[_0x124f('0x17')],'exten':_0x107688[_0x124f('0x8')],'priority':_0x35dfee['length']+_0x432426[_0x124f('0x10')]+_0x2e042b++,'VoiceExtensionId':_0x107688[_0x124f('0x18')]});}else{_0xce3a59['push']({'type':_0x107688[_0x124f('0x14')],'app':_0x124f('0x34'),'appdata':_0x124f('0x36'),'context':_0x107688[_0x124f('0x17')],'exten':_0x107688[_0x124f('0x8')],'priority':_0x35dfee[_0x124f('0x2a')]+_0x432426[_0x124f('0x10')]+_0x2e042b++,'VoiceExtensionId':_0x107688['VoiceExtensionId']});}}if(_0x107688['hasOwnProperty'](_0x124f('0x37'))){if(_0x4822c4[_0x124f('0x38')](_0x107688['app']['toLowerCase']())>=0x0&&_0x107688[_0x124f('0x39')]!==_0x124f('0x3a')){if(_0x107688[_0x124f('0x37')]){_0xce3a59[_0x124f('0x13')]({'type':_0x107688['type'],'app':_0x124f('0x34'),'appdata':_0x124f('0x3b'),'context':_0x107688[_0x124f('0x17')],'exten':_0x107688[_0x124f('0x8')],'priority':_0x35dfee[_0x124f('0x2a')]+_0x432426['priority']+_0x2e042b++,'VoiceExtensionId':_0x107688[_0x124f('0x18')]});_0xce3a59['push']({'type':_0x107688[_0x124f('0x14')],'app':'Set','appdata':_0x124f('0x3c'),'context':_0x107688[_0x124f('0x17')],'exten':_0x107688['exten'],'priority':_0x35dfee[_0x124f('0x2a')]+_0x432426[_0x124f('0x10')]+_0x2e042b++,'VoiceExtensionId':_0x107688['VoiceExtensionId']});}else{_0xce3a59[_0x124f('0x13')]({'type':_0x107688[_0x124f('0x14')],'app':_0x124f('0x34'),'appdata':_0x124f('0x3d'),'context':_0x107688[_0x124f('0x17')],'exten':_0x107688[_0x124f('0x8')],'priority':_0x35dfee[_0x124f('0x2a')]+_0x432426[_0x124f('0x10')]+_0x2e042b++,'VoiceExtensionId':_0x107688[_0x124f('0x18')]});_0xce3a59[_0x124f('0x13')]({'type':_0x107688['type'],'app':'Set','appdata':_0x124f('0x3e'),'context':_0x107688[_0x124f('0x17')],'exten':_0x107688['exten'],'priority':_0x35dfee[_0x124f('0x2a')]+_0x432426[_0x124f('0x10')]+_0x2e042b++,'VoiceExtensionId':_0x107688['VoiceExtensionId']});}}}for(var _0x1e9d8a=0x0;_0x1e9d8a<_0x35dfee[_0x124f('0x2a')];_0x1e9d8a+=0x1){var _0x5c9724=_0x432426[_0x124f('0x10')]+_0x35dfee['length'];var _0x52684e=_0x1e9d8a===_0x35dfee[_0x124f('0x2a')]-0x1?_0x432426['priority']+_0xce3a59[_0x124f('0x2a')]+_0x102f7c['length']+0x2:_0x432426['priority']+_0x1e9d8a+0x1;_0xce3a59[_0x124f('0x3f')](_0x1e9d8a,0x0,{'type':_0x107688[_0x124f('0x14')],'app':_0x124f('0x40'),'appdata':_0x35dfee[_0x1e9d8a]+'?'+_0x107688['context']+_0x124f('0x41')+_0x5c9724+':'+_0x107688[_0x124f('0x17')]+_0x124f('0x41')+_0x52684e,'exten':_0x107688[_0x124f('0x8')],'context':_0x107688[_0x124f('0x17')],'priority':_0x432426['priority']+_0x1e9d8a,'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});}_0x107688[_0x124f('0x10')]=_0xce3a59[_0x124f('0x2a')]?_[_0x124f('0x42')](_0xce3a59)['priority']+0x1:_0x432426[_0x124f('0x10')];_0x432426[_0x124f('0x10')]=(_0x102f7c['length']?_[_0x124f('0x42')](_0x102f7c)[_0x124f('0x10')]:_0x107688['priority'])+0x1;_0x432426[_0x124f('0x11')]=_[_0x124f('0x43')](_0x432426[_0x124f('0x11')],_0xce3a59,[_0x107688],_0x102f7c);}_0x432426[_0x124f('0x11')][_0x124f('0x13')]({'type':_0x228f10[_0x1c95bc][0x0][_0x124f('0x14')],'app':_0x124f('0x44'),'exten':_0x228f10[_0x1c95bc][0x0][_0x124f('0x8')],'context':_0x228f10[_0x1c95bc][0x0][_0x124f('0x17')],'priority':_0x432426[_0x124f('0x10')],'VoiceExtensionId':_0x228f10[_0x1c95bc][0x0][_0x124f('0x18')]});_0x5520ae[_0x124f('0x13')](_0x228f10[_0x1c95bc][0x0]['VoiceExtensionId']);_0x4c6588=_[_0x124f('0x43')](_0x4c6588,_0x432426['extensions']);}}return _0x41e960[_0x124f('0x45')](function(_0x4d7cab){return _0x41e960[_0x124f('0x2')][_0x124f('0x6')][_0x124f('0x46')]({'where':{'VoiceExtensionId':{'$in':_0x5520ae}},'transaction':_0x4d7cab})[_0x124f('0xa')](function(_0x462b2b){return _0x41e960[_0x124f('0x2')][_0x124f('0x6')]['bulkCreate'](_[_0x124f('0x47')](_0x4c6588,'priority'),{'transaction':_0x4d7cab});});});})[_0x124f('0x48')](function(_0x12088c){console[_0x124f('0x49')](_0x12088c);});}exports[_0x124f('0x4a')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 775a541..c8bf118 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 _0x00de=['createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','squel','ioredis','../../../mysqldb','../../../config/logger','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','CompanyId','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','stringify','cmContact','checkHopper','inspect','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','ListId','from','deletedAt\x20IS\x20NULL','where','phone\x20IS\x20NOT\x20NULL','select','\x20=\x20?','insert','fromQuery','cm_contacts','ListId\x20=\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','CmList','Lists','get','dialCheckDuplicateType','sequelize','query','VoiceQueueId','all','outbound','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!'];(function(_0xeb8ae1,_0x4b8abb){var _0xa63ef=function(_0x53611f){while(--_0x53611f){_0xeb8ae1['push'](_0xeb8ae1['shift']());}};_0xa63ef(++_0x4b8abb);}(_0x00de,0x71));var _0xe00d=function(_0x59f0dc,_0x1e2497){_0x59f0dc=_0x59f0dc-0x0;var _0x5b5445=_0x00de[_0x59f0dc];return _0x5b5445;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0xe00d('0x0'));var Papa=require('papaparse');var Redis=require(_0xe00d('0x1'));var db=require(_0xe00d('0x2'))['db'];var config=require('../../../config/environment');var logger=require(_0xe00d('0x3'))(_0xe00d('0x4'));config[_0xe00d('0x5')]=_['defaults'](config[_0xe00d('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xe00d('0x6'))(new Redis(config[_0xe00d('0x5')]));require(_0xe00d('0x7'))[_0xe00d('0x8')](socket);try{if(!process[_0xe00d('0x9')][0x2]||process[_0xe00d('0x9')][0x2]===_0xe00d('0xa')||process[_0xe00d('0x9')][0x2]===_0xe00d('0xb')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xe00d('0x9')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0xe00d('0xa')||process[_0xe00d('0x9')][0x3]==='null'||!process['argv'][0x4]||process[_0xe00d('0x9')][0x4]===_0xe00d('0xa')||process[_0xe00d('0x9')][0x4]===_0xe00d('0xb')){throw new Error(_0xe00d('0xc'));}var FIELDS=_[_0xe00d('0xd')](process[_0xe00d('0x9')][0x3][_0xe00d('0xe')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process['argv'][0x5]==='undefined'||process[_0xe00d('0x9')][0x5]===_0xe00d('0xb')){throw new Error(_0xe00d('0xf'));}var LISTID=process[_0xe00d('0x9')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0xe00d('0x9')][0x6]!==_0xe00d('0xb')?process[_0xe00d('0x9')][0x6]:null;var DUPLICATES=process[_0xe00d('0x9')][0x7]&&process[_0xe00d('0x9')][0x7]!==_0xe00d('0xa')&&process['argv'][0x7]!==_0xe00d('0xb')?process[_0xe00d('0x9')][0x7]:null;if(!process[_0xe00d('0x9')][0x8]||process[_0xe00d('0x9')][0x8]===_0xe00d('0xa')||process['argv'][0x8]===_0xe00d('0xb')){throw new Error(_0xe00d('0x10'));}var SOCKET_TIMESTAMP=process[_0xe00d('0x9')][0x8];}catch(_0x208d24){logger[_0xe00d('0x11')](_0x208d24);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(_0x3cd678,_0x4f7e35,_0x47b1dc,_0x5434bc){var _0x467eb2={'message':_0x4f7e35};_0x467eb2[_0x3cd678]=!![];if(_0x47b1dc){_0x467eb2['contact']=_0x47b1dc;}if(_0x5434bc){_0x467eb2[_0xe00d('0x12')]=_0x5434bc;}return _0x467eb2;}function isEmail(_0xc64408){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))*$/[_0xe00d('0x13')](_0xc64408);}function checkRow(_0x4d9792,_0x4695bb,_0x1b6b03){return new BPromise(function(_0x508101,_0x3e5c61){if(_[_0xe00d('0x14')](_0x4d9792)){return _0x3e5c61(handleCheckRowError('error',_0xe00d('0x15'),null,_0x1b6b03));}if(_0x4d9792[_0xe00d('0x16')]&&_0x4d9792[_0xe00d('0x16')][_0xe00d('0x17')]){var _0x4c1f85=_[_0xe00d('0x18')](_0x4d9792[_0xe00d('0x16')],_0xe00d('0x19'))[_0xe00d('0x1a')](';');return _0x3e5c61(handleCheckRowError(_0xe00d('0x11'),_0x4c1f85,null,_0x1b6b03));}var _0x264da0={};for(var _0x162c55 in FIELDS){if(FIELDS[_0xe00d('0x1b')](_0x162c55)&&FIELDS[_0x162c55]){_0x264da0[_0x162c55]=_0x4d9792[_0xe00d('0x1c')][0x0][FIELDS[_0x162c55]]||_0x4d9792[_0xe00d('0x1c')][0x0]['\ufeff'+FIELDS[_0x162c55]];}}if(!_0x264da0[_0xe00d('0x1d')]){return _0x3e5c61(handleCheckRowError('error',_0xe00d('0x1e'),null,_0x1b6b03));}if(!_0x264da0[_0xe00d('0x1f')]){return _0x3e5c61(handleCheckRowError(_0xe00d('0x11'),_0xe00d('0x20'),null,_0x1b6b03));}if(_0x264da0[_0xe00d('0x21')]){var _0x21c37a=moment(_0x264da0[_0xe00d('0x21')],_0xe00d('0x22'));if(!_0x21c37a['isValid']()){return _0x3e5c61(handleCheckRowError(_0xe00d('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x1b6b03));}}if(_0x264da0['email']){if(!isEmail(_0x264da0[_0xe00d('0x23')])){return _0x3e5c61(handleCheckRowError(_0xe00d('0x11'),_0xe00d('0x24'),null,_0x1b6b03));}}_0x264da0['ListId']=LISTID;_0x264da0[_0xe00d('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x4695bb){var _0x5fa500={};for(var _0x4c9dfa=0x0,_0x44be58=DUPLICATES[_0xe00d('0x17')];_0x4c9dfa<_0x44be58;_0x4c9dfa+=0x1){_0x5fa500[DUPLICATES[_0x4c9dfa]]=_0x264da0[DUPLICATES[_0x4c9dfa]];}var _0x2ef374=_['find'](_0x4695bb,_0x5fa500);if(_0x2ef374){return _0x3e5c61(handleCheckRowError('duplicate',_0xe00d('0x26'),_0x2ef374,_0x1b6b03));}}return db[_0xe00d('0x27')][_0xe00d('0x28')](_0x264da0,{'raw':!![],'hooks':![],'fields':_[_0xe00d('0x29')](_0x264da0)})[_0xe00d('0x2a')](function(_0xbbbdea){if(DUPLICATES&&DUPLICATES[_0xe00d('0x17')]&&_0x4695bb){_0x4695bb[_0xe00d('0x2b')](_['pick'](_0x264da0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xbbbdea['id'];return _0x508101();})[_0xe00d('0x2c')](function(_0x4aef2e){return _0x3e5c61(handleCheckRowError(_0xe00d('0x11'),'Error\x20while\x20creating\x20contact:\x20'+(_0x4aef2e[_0xe00d('0x19')]||JSON[_0xe00d('0x2d')](_0x4aef2e)),null,_0x1b6b03));});});}function checkHopper(){function _0x24b968(){return function(_0x4f30e9){logger['error'](_0xe00d('0x2e'),_0xe00d('0x2f'),util[_0xe00d('0x30')](_0x4f30e9,{'showHidden':![],'depth':null}));};}var _0x5084f7=function(_0x3ab2c2,_0x4789b0){var _0x3c175f=squel['insert']()[_0xe00d('0x31')](_0xe00d('0x32'))['fromQuery'](['phone',_0xe00d('0x33'),_0xe00d('0x34'),'ListId',_0x4789b0,_0xe00d('0x35'),_0xe00d('0x36')],squel['select']()[_0xe00d('0x37')](_0xe00d('0x1f'),'phone')['field'](_0xe00d('0x38'),_0xe00d('0x33'))[_0xe00d('0x37')]('id','ContactId')[_0xe00d('0x37')](LISTID[_0xe00d('0x39')](),_0xe00d('0x3a'))[_0xe00d('0x37')](_0x3ab2c2['id'][_0xe00d('0x39')](),_0x4789b0)[_0xe00d('0x37')](_0xe00d('0x38'),_0xe00d('0x35'))[_0xe00d('0x37')]('NOW()',_0xe00d('0x36'))[_0xe00d('0x3b')]('cm_contacts')['where'](_0xe00d('0x3c'))['where']('ListId\x20=\x20?',LISTID[_0xe00d('0x39')]())[_0xe00d('0x3d')](_0xe00d('0x3e'))[_0xe00d('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe00d('0x3f')]()[_0xe00d('0x37')](_0xe00d('0x1f'))[_0xe00d('0x3b')](_0xe00d('0x32'))[_0xe00d('0x3d')](_0x4789b0+_0xe00d('0x40'),_0x3ab2c2['id'][_0xe00d('0x39')]())))[_0xe00d('0x39')]();return _0x3c175f;};var _0x4dec44=function(_0xd4bac2,_0x1480f7){var _0xd82e6e=squel[_0xe00d('0x41')]()[_0xe00d('0x31')]('cm_hopper')[_0xe00d('0x42')]([_0xe00d('0x1f'),_0xe00d('0x33'),_0xe00d('0x34'),_0xe00d('0x3a'),_0x1480f7,_0xe00d('0x35'),_0xe00d('0x36')],squel[_0xe00d('0x3f')]()['field'](_0xe00d('0x1f'),_0xe00d('0x1f'))[_0xe00d('0x37')](_0xe00d('0x38'),'scheduledAt')[_0xe00d('0x37')]('id','ContactId')[_0xe00d('0x37')](LISTID[_0xe00d('0x39')](),_0xe00d('0x3a'))['field'](_0xd4bac2['id']['toString'](),_0x1480f7)[_0xe00d('0x37')](_0xe00d('0x38'),_0xe00d('0x35'))[_0xe00d('0x37')](_0xe00d('0x38'),_0xe00d('0x36'))['from'](_0xe00d('0x43'))['where'](_0xe00d('0x3c'))['where'](_0xe00d('0x44'),LISTID['toString']())[_0xe00d('0x3d')]('id\x20IN\x20?',squel[_0xe00d('0x45')](hopperContacts))[_0xe00d('0x3d')](_0xe00d('0x3e'))[_0xe00d('0x3d')](_0xe00d('0x46'),squel['select']()[_0xe00d('0x37')](_0xe00d('0x47'))[_0xe00d('0x3b')](_0xe00d('0x48'))['where'](_0x1480f7+_0xe00d('0x40'),_0xd4bac2['id'][_0xe00d('0x39')]()))[_0xe00d('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe00d('0x3f')]()[_0xe00d('0x37')](_0xe00d('0x1f'))[_0xe00d('0x3b')]('cm_hopper')[_0xe00d('0x3d')](_0x1480f7+_0xe00d('0x40'),_0xd4bac2['id'][_0xe00d('0x39')]())))[_0xe00d('0x39')]();return _0xd82e6e;};function _0x5b30ef(_0x43c122,_0x56957e){var _0x4faef6=squel[_0xe00d('0x41')]()[_0xe00d('0x31')](_0xe00d('0x32'))[_0xe00d('0x42')]([_0xe00d('0x1f'),_0xe00d('0x33'),_0xe00d('0x34'),_0xe00d('0x3a'),_0x56957e,_0xe00d('0x35'),'updatedAt'],squel[_0xe00d('0x3f')]()[_0xe00d('0x37')](_0xe00d('0x1f'),_0xe00d('0x1f'))[_0xe00d('0x37')](_0xe00d('0x38'),_0xe00d('0x33'))[_0xe00d('0x37')]('id',_0xe00d('0x34'))[_0xe00d('0x37')](LISTID[_0xe00d('0x39')](),_0xe00d('0x3a'))[_0xe00d('0x37')](_0x43c122['id'][_0xe00d('0x39')](),_0x56957e)[_0xe00d('0x37')](_0xe00d('0x38'),'createdAt')[_0xe00d('0x37')]('NOW()','updatedAt')['from'](_0xe00d('0x43'))[_0xe00d('0x3d')](_0xe00d('0x3c'))[_0xe00d('0x3d')](_0xe00d('0x44'),LISTID[_0xe00d('0x39')]())[_0xe00d('0x3d')](_0xe00d('0x49'),squel[_0xe00d('0x45')](hopperContacts))[_0xe00d('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0xe00d('0x39')]();return _0x4faef6;}function _0x26fd88(_0x299caa,_0x4e4f9e){var _0x5819ca=squel[_0xe00d('0x41')]()[_0xe00d('0x31')](_0xe00d('0x4a'))[_0xe00d('0x42')]([_0xe00d('0x1f'),'ContactId',_0xe00d('0x3a'),_0x4e4f9e,_0xe00d('0x35'),'updatedAt'],squel[_0xe00d('0x3f')]()['field'](_0xe00d('0x1f'),_0xe00d('0x1f'))[_0xe00d('0x37')]('id',_0xe00d('0x34'))[_0xe00d('0x37')](LISTID[_0xe00d('0x39')](),'ListId')[_0xe00d('0x37')](_0x299caa['id'][_0xe00d('0x39')](),_0x4e4f9e)[_0xe00d('0x37')](_0xe00d('0x38'),_0xe00d('0x35'))[_0xe00d('0x37')]('NOW()',_0xe00d('0x36'))[_0xe00d('0x3b')]('cm_contacts')[_0xe00d('0x3d')](_0xe00d('0x3c'))[_0xe00d('0x3d')]('ListId\x20=\x20?',LISTID[_0xe00d('0x39')]())[_0xe00d('0x3d')](_0xe00d('0x49'),squel[_0xe00d('0x45')](hopperContacts))['where'](_0xe00d('0x3e')))[_0xe00d('0x39')]();return _0x5819ca;}return db[_0xe00d('0x4b')][_0xe00d('0x4c')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xe00d('0x4d')],'as':_0xe00d('0x4e'),'where':{'id':LISTID}}]})[_0xe00d('0x2a')](function(_0x106a3a){var _0x43daa8=[];if(_0x106a3a){var _0x39b9c6;for(var _0x2d0aa4=0x0,_0x700b4d;_0x2d0aa4<_0x106a3a['length'];_0x2d0aa4+=0x1){_0x700b4d=_0x106a3a[_0x2d0aa4][_0xe00d('0x4f')]({'plain':!![]});switch(_0x700b4d[_0xe00d('0x50')]){case'always':_0x43daa8[_0xe00d('0x2b')](db[_0xe00d('0x51')][_0xe00d('0x52')](_0x4dec44(_0x700b4d,_0xe00d('0x53')))['then'](function(){})[_0xe00d('0x2c')](_0x24b968()));break;case'onlyIfOpen':_0x43daa8[_0xe00d('0x2b')](db[_0xe00d('0x51')][_0xe00d('0x52')](_0x5084f7(_0x700b4d,_0xe00d('0x53')))[_0xe00d('0x2a')](function(){})['catch'](_0x24b968()));break;default:_0x43daa8['push'](db[_0xe00d('0x51')][_0xe00d('0x52')](_0x5b30ef(_0x700b4d,_0xe00d('0x53')))[_0xe00d('0x2a')](function(){})[_0xe00d('0x2c')](_0x24b968()));}}}return _0x43daa8;})[_0xe00d('0x54')]()[_0xe00d('0x2a')](function(){return db[_0xe00d('0x4b')]['findAll']({'where':{'type':_0xe00d('0x55')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xe00d('0x56'),'where':{'id':LISTID}}]})[_0xe00d('0x2a')](function(_0x248285){var _0x5c6568=[];if(_0x248285){var _0x12d85f;for(var _0xc7657=0x0,_0x264fdb;_0xc7657<_0x248285[_0xe00d('0x17')];_0xc7657+=0x1){_0x264fdb=_0x248285[_0xc7657][_0xe00d('0x4f')]({'plain':!![]});_0x5c6568[_0xe00d('0x2b')](db[_0xe00d('0x51')][_0xe00d('0x52')](_0x26fd88(_0x264fdb,_0xe00d('0x53')))[_0xe00d('0x2a')](function(){})[_0xe00d('0x2c')](_0x24b968()));}}return _0x5c6568;})[_0xe00d('0x54')]();})[_0xe00d('0x2a')](function(){return db[_0xe00d('0x57')][_0xe00d('0x4c')]({'attributes':['id',_0xe00d('0x50')],'include':[{'model':db[_0xe00d('0x4d')],'as':_0xe00d('0x4e'),'where':{'id':LISTID}}]})[_0xe00d('0x2a')](function(_0x56eca0){var _0x17658a=[];if(_0x56eca0){for(var _0x7108be=0x0,_0x51b0c0;_0x7108be<_0x56eca0[_0xe00d('0x17')];_0x7108be+=0x1){_0x51b0c0=_0x56eca0[_0x7108be][_0xe00d('0x4f')]({'plain':!![]});switch(_0x51b0c0[_0xe00d('0x50')]){case'always':_0x17658a[_0xe00d('0x2b')](db[_0xe00d('0x51')][_0xe00d('0x52')](_0x4dec44(_0x51b0c0,_0xe00d('0x58')))[_0xe00d('0x2a')](function(){})[_0xe00d('0x2c')](_0x24b968()));break;case'onlyIfOpen':_0x17658a[_0xe00d('0x2b')](db[_0xe00d('0x51')][_0xe00d('0x52')](_0x5084f7(_0x51b0c0,_0xe00d('0x58')))[_0xe00d('0x2a')](function(){})['catch'](_0x24b968()));break;default:_0x17658a[_0xe00d('0x2b')](db[_0xe00d('0x51')]['query'](_0x5b30ef(_0x51b0c0,_0xe00d('0x58')))[_0xe00d('0x2a')](function(){})['catch'](_0x24b968()));}}}return _0x17658a;})[_0xe00d('0x54')]();})[_0xe00d('0x2a')](function(){return db[_0xe00d('0x57')][_0xe00d('0x4c')]({'attributes':['id'],'include':[{'model':db[_0xe00d('0x4d')],'as':_0xe00d('0x56'),'where':{'id':LISTID}}]})[_0xe00d('0x2a')](function(_0x228833){var _0x5e8d24=[];if(_0x228833){for(var _0xd80e34=0x0,_0x4a2a74;_0xd80e34<_0x228833['length'];_0xd80e34+=0x1){_0x4a2a74=_0x228833[_0xd80e34]['get']({'plain':!![]});_0x5e8d24[_0xe00d('0x2b')](db[_0xe00d('0x51')]['query'](_0x26fd88(_0x4a2a74,_0xe00d('0x58')))[_0xe00d('0x2a')](function(){})[_0xe00d('0x2c')](_0x24b968()));}}return _0x5e8d24;})[_0xe00d('0x54')]();})[_0xe00d('0x2c')](function(_0x2f2b0d){logger[_0xe00d('0x11')](_0xe00d('0x59'),_0xe00d('0x5a'),_0x2f2b0d[_0xe00d('0x19')]);});}var processPromises=function(_0x220764){return BPromise[_0xe00d('0x54')](promises)['then'](function(_0x46f914){})['catch'](function(_0x4730fd){logger['error']('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x4730fd));})[_0xe00d('0x5b')](function(){socket[_0xe00d('0x5c')](_0xe00d('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x220764){return _0x220764[_0xe00d('0x5e')]();}});};var endCsv=function(){return BPromise[_0xe00d('0x5f')]()[_0xe00d('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0xe00d('0x2a')](function(){socket[_0xe00d('0x5c')](_0xe00d('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe00d('0x60')](FILEPATH);}catch(_0x2b480f){logger[_0xe00d('0x11')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x2b480f));}finally{process[_0xe00d('0x61')](0x0);}});};process['on'](_0xe00d('0x62'),function(){logger[_0xe00d('0x63')](_0xe00d('0x64'));endCsv();});function main(){return BPromise[_0xe00d('0x5f')]()[_0xe00d('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xe00d('0x27')][_0xe00d('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe00d('0x2a')](function(_0x8beaef){var _0x194209=fs[_0xe00d('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xe00d('0x66')](_0x194209,{'header':!![],'skipEmptyLines':!![],'step':function(_0x594d9f,_0x2d62ba){total+=0x1;var _0x33d398=total;promises[_0xe00d('0x2b')](checkRow(_0x594d9f,_0x8beaef,_0x33d398)[_0xe00d('0x2a')](function(){success+=0x1;})['catch'](function(_0x18911d){if(_0x18911d['error']){errors+=0x1;delete _0x18911d[_0xe00d('0x11')];}else if(_0x18911d[_0xe00d('0x67')]){duplicates+=0x1;delete _0x18911d['duplicate'];}rows[_0xe00d('0x2b')](_0x18911d);}));if(total%0xc8===0x0){_0x2d62ba[_0xe00d('0x68')]();return processPromises(_0x2d62ba);}},'complete':function(){return processPromises()[_0xe00d('0x2a')](function(){logger[_0xe00d('0x63')](_0xe00d('0x69'));endCsv();});},'error':function(_0x1cfa2d,_0x234f5b){logger[_0xe00d('0x63')](_0xe00d('0x6a'),JSON['stringify'](_0x1cfa2d));endCsv();}});})[_0xe00d('0x2c')](function(_0x5de33c){logger[_0xe00d('0x11')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xe00d('0x2d')](_0x5de33c));});}main(); \ No newline at end of file +var _0x1edc=['errors','length','join','hasOwnProperty','data','firstName','phone\x20not\x20specified!','YYYY-MM-DD','isValid','email','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','keys','then','push','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','field','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','updatedAt','id\x20IN\x20?','str','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','catch','BlackLists','all','Campaign','get','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','resolve','contact:csv_','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','api','redis','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!'];(function(_0x4ffdc0,_0x173126){var _0x2eb36a=function(_0x3e04e4){while(--_0x3e04e4){_0x4ffdc0['push'](_0x4ffdc0['shift']());}};_0x2eb36a(++_0x173126);}(_0x1edc,0xb4));var _0xc1ed=function(_0x301545,_0xd1f3b){_0x301545=_0x301545-0x0;var _0x229495=_0x1edc[_0x301545];return _0x229495;};'use strict';var BPromise=require(_0xc1ed('0x0'));var util=require('util');var _=require(_0xc1ed('0x1'));var fs=require('fs');var squel=require(_0xc1ed('0x2'));var Papa=require(_0xc1ed('0x3'));var Redis=require(_0xc1ed('0x4'));var db=require(_0xc1ed('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xc1ed('0x6'));config[_0xc1ed('0x7')]=_['defaults'](config[_0xc1ed('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc1ed('0x7')]));require(_0xc1ed('0x8'))[_0xc1ed('0x9')](socket);try{if(!process[_0xc1ed('0xa')][0x2]||process[_0xc1ed('0xa')][0x2]==='undefined'||process[_0xc1ed('0xa')][0x2]===_0xc1ed('0xb')){throw new Error(_0xc1ed('0xc'));}var FILEPATH=process[_0xc1ed('0xa')][0x2];if(!process[_0xc1ed('0xa')][0x3]||process['argv'][0x3]===_0xc1ed('0xd')||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0xc1ed('0xa')][0x4]===_0xc1ed('0xd')||process[_0xc1ed('0xa')][0x4]===_0xc1ed('0xb')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0xc1ed('0xa')][0x3][_0xc1ed('0xe')](','),process[_0xc1ed('0xa')][0x4][_0xc1ed('0xe')](','));if(!process[_0xc1ed('0xa')][0x5]||process[_0xc1ed('0xa')][0x5]===_0xc1ed('0xd')||process[_0xc1ed('0xa')][0x5]==='null'){throw new Error(_0xc1ed('0xf'));}var LISTID=process[_0xc1ed('0xa')][0x5];var COMPANYID=process[_0xc1ed('0xa')][0x6]&&process['argv'][0x6]!=='undefined'&&process['argv'][0x6]!==_0xc1ed('0xb')?process[_0xc1ed('0xa')][0x6]:null;var DUPLICATES=process[_0xc1ed('0xa')][0x7]&&process[_0xc1ed('0xa')][0x7]!==_0xc1ed('0xd')&&process[_0xc1ed('0xa')][0x7]!==_0xc1ed('0xb')?process['argv'][0x7]:null;if(!process[_0xc1ed('0xa')][0x8]||process[_0xc1ed('0xa')][0x8]===_0xc1ed('0xd')||process[_0xc1ed('0xa')][0x8]==='null'){throw new Error(_0xc1ed('0x10'));}var SOCKET_TIMESTAMP=process[_0xc1ed('0xa')][0x8];}catch(_0x21fc0a){logger['error'](_0x21fc0a);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(_0x18ed27,_0x339259,_0x41a87d,_0x50c735){var _0x11eee4={'message':_0x339259};_0x11eee4[_0x18ed27]=!![];if(_0x41a87d){_0x11eee4['contact']=_0x41a87d;}if(_0x50c735){_0x11eee4['index']=_0x50c735;}return _0x11eee4;}function isEmail(_0x5db47b){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))*$/[_0xc1ed('0x11')](_0x5db47b);}function checkRow(_0x8fe284,_0x422516,_0x468ad6){return new BPromise(function(_0x137db5,_0x11a4e0){if(_['isNil'](_0x8fe284)){return _0x11a4e0(handleCheckRowError(_0xc1ed('0x12'),_0xc1ed('0x13'),null,_0x468ad6));}if(_0x8fe284[_0xc1ed('0x14')]&&_0x8fe284[_0xc1ed('0x14')][_0xc1ed('0x15')]){var _0x1fc6dd=_['map'](_0x8fe284['errors'],'message')[_0xc1ed('0x16')](';');return _0x11a4e0(handleCheckRowError(_0xc1ed('0x12'),_0x1fc6dd,null,_0x468ad6));}var _0x254bed={};for(var _0x4634ad in FIELDS){if(FIELDS[_0xc1ed('0x17')](_0x4634ad)&&FIELDS[_0x4634ad]){_0x254bed[_0x4634ad]=_0x8fe284[_0xc1ed('0x18')][0x0][FIELDS[_0x4634ad]]||_0x8fe284[_0xc1ed('0x18')][0x0]['\ufeff'+FIELDS[_0x4634ad]];}}if(!_0x254bed[_0xc1ed('0x19')]){return _0x11a4e0(handleCheckRowError(_0xc1ed('0x12'),'firstName\x20not\x20specified!',null,_0x468ad6));}if(!_0x254bed['phone']){return _0x11a4e0(handleCheckRowError(_0xc1ed('0x12'),_0xc1ed('0x1a'),null,_0x468ad6));}if(_0x254bed['birthDate']){var _0x5b0379=moment(_0x254bed['birthDate'],_0xc1ed('0x1b'));if(!_0x5b0379[_0xc1ed('0x1c')]()){return _0x11a4e0(handleCheckRowError(_0xc1ed('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x468ad6));}}if(_0x254bed['email']){if(!isEmail(_0x254bed[_0xc1ed('0x1d')])){return _0x11a4e0(handleCheckRowError(_0xc1ed('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x468ad6));}}_0x254bed[_0xc1ed('0x1e')]=LISTID;_0x254bed[_0xc1ed('0x1f')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xc1ed('0x15')]&&_0x422516){var _0x2b75a1={};for(var _0x244378=0x0,_0x4397ae=DUPLICATES[_0xc1ed('0x15')];_0x244378<_0x4397ae;_0x244378+=0x1){_0x2b75a1[DUPLICATES[_0x244378]]=_0x254bed[DUPLICATES[_0x244378]];}var _0x457c21=_[_0xc1ed('0x20')](_0x422516,_0x2b75a1);if(_0x457c21){return _0x11a4e0(handleCheckRowError('duplicate',_0xc1ed('0x21'),_0x457c21,_0x468ad6));}}return db[_0xc1ed('0x22')][_0xc1ed('0x23')](_0x254bed,{'raw':!![],'hooks':![],'fields':_[_0xc1ed('0x24')](_0x254bed)})[_0xc1ed('0x25')](function(_0x4ea79c){if(DUPLICATES&&DUPLICATES[_0xc1ed('0x15')]&&_0x422516){_0x422516[_0xc1ed('0x26')](_['pick'](_0x254bed,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4ea79c['id'];return _0x137db5();})['catch'](function(_0x550c0d){return _0x11a4e0(handleCheckRowError(_0xc1ed('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x550c0d[_0xc1ed('0x27')]||JSON[_0xc1ed('0x28')](_0x550c0d)),null,_0x468ad6));});});}function checkHopper(){function _0x3bde6f(){return function(_0x51f7e1){logger[_0xc1ed('0x12')](_0xc1ed('0x29'),_0xc1ed('0x2a'),util['inspect'](_0x51f7e1,{'showHidden':![],'depth':null}));};}var _0x30c901=function(_0x127316,_0x1358c0){var _0xef7f64=squel[_0xc1ed('0x2b')]()[_0xc1ed('0x2c')](_0xc1ed('0x2d'))[_0xc1ed('0x2e')]([_0xc1ed('0x2f'),_0xc1ed('0x30'),_0xc1ed('0x31'),_0xc1ed('0x1e'),_0x1358c0,_0xc1ed('0x32'),'updatedAt'],squel['select']()['field']('phone',_0xc1ed('0x2f'))[_0xc1ed('0x33')](_0xc1ed('0x34'),_0xc1ed('0x30'))[_0xc1ed('0x33')]('id',_0xc1ed('0x31'))[_0xc1ed('0x33')](LISTID['toString'](),'ListId')[_0xc1ed('0x33')](_0x127316['id']['toString'](),_0x1358c0)[_0xc1ed('0x33')](_0xc1ed('0x34'),_0xc1ed('0x32'))[_0xc1ed('0x33')](_0xc1ed('0x34'),'updatedAt')[_0xc1ed('0x35')](_0xc1ed('0x36'))['where'](_0xc1ed('0x37'))[_0xc1ed('0x38')](_0xc1ed('0x39'),LISTID[_0xc1ed('0x3a')]())[_0xc1ed('0x38')](_0xc1ed('0x3b'))[_0xc1ed('0x38')](_0xc1ed('0x3c'),squel[_0xc1ed('0x3d')]()[_0xc1ed('0x33')](_0xc1ed('0x2f'))[_0xc1ed('0x35')](_0xc1ed('0x2d'))['where'](_0x1358c0+_0xc1ed('0x3e'),_0x127316['id'][_0xc1ed('0x3a')]())))[_0xc1ed('0x3a')]();return _0xef7f64;};var _0x3f7ad1=function(_0x1fb2a6,_0x11e335){var _0x32a834=squel[_0xc1ed('0x2b')]()[_0xc1ed('0x2c')](_0xc1ed('0x2d'))['fromQuery']([_0xc1ed('0x2f'),_0xc1ed('0x30'),'ContactId',_0xc1ed('0x1e'),_0x11e335,_0xc1ed('0x32'),'updatedAt'],squel[_0xc1ed('0x3d')]()['field'](_0xc1ed('0x2f'),_0xc1ed('0x2f'))[_0xc1ed('0x33')](_0xc1ed('0x34'),_0xc1ed('0x30'))[_0xc1ed('0x33')]('id',_0xc1ed('0x31'))['field'](LISTID[_0xc1ed('0x3a')](),'ListId')['field'](_0x1fb2a6['id'][_0xc1ed('0x3a')](),_0x11e335)[_0xc1ed('0x33')](_0xc1ed('0x34'),_0xc1ed('0x32'))[_0xc1ed('0x33')](_0xc1ed('0x34'),_0xc1ed('0x3f'))['from'](_0xc1ed('0x36'))[_0xc1ed('0x38')](_0xc1ed('0x37'))[_0xc1ed('0x38')]('ListId\x20=\x20?',LISTID['toString']())[_0xc1ed('0x38')](_0xc1ed('0x40'),squel[_0xc1ed('0x41')](hopperContacts))[_0xc1ed('0x38')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xc1ed('0x3c'),squel[_0xc1ed('0x3d')]()[_0xc1ed('0x33')]('calleridnum')[_0xc1ed('0x35')](_0xc1ed('0x42'))[_0xc1ed('0x38')](_0x11e335+_0xc1ed('0x3e'),_0x1fb2a6['id']['toString']()))[_0xc1ed('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc1ed('0x3d')]()[_0xc1ed('0x33')]('phone')[_0xc1ed('0x35')](_0xc1ed('0x2d'))[_0xc1ed('0x38')](_0x11e335+_0xc1ed('0x3e'),_0x1fb2a6['id'][_0xc1ed('0x3a')]())))[_0xc1ed('0x3a')]();return _0x32a834;};function _0x46a3c6(_0x1152f0,_0x1c5ff3){var _0x178566=squel[_0xc1ed('0x2b')]()['into'](_0xc1ed('0x2d'))[_0xc1ed('0x2e')]([_0xc1ed('0x2f'),_0xc1ed('0x30'),'ContactId','ListId',_0x1c5ff3,_0xc1ed('0x32'),_0xc1ed('0x3f')],squel[_0xc1ed('0x3d')]()[_0xc1ed('0x33')]('phone',_0xc1ed('0x2f'))['field'](_0xc1ed('0x34'),_0xc1ed('0x30'))[_0xc1ed('0x33')]('id',_0xc1ed('0x31'))[_0xc1ed('0x33')](LISTID['toString'](),'ListId')[_0xc1ed('0x33')](_0x1152f0['id'][_0xc1ed('0x3a')](),_0x1c5ff3)['field'](_0xc1ed('0x34'),_0xc1ed('0x32'))['field'](_0xc1ed('0x34'),_0xc1ed('0x3f'))['from']('cm_contacts')[_0xc1ed('0x38')](_0xc1ed('0x37'))[_0xc1ed('0x38')](_0xc1ed('0x39'),LISTID['toString']())[_0xc1ed('0x38')](_0xc1ed('0x40'),squel[_0xc1ed('0x41')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xc1ed('0x3a')]();return _0x178566;}function _0x10033d(_0xdc9d4c,_0x214f21){var _0x46cdb3=squel[_0xc1ed('0x2b')]()['into'](_0xc1ed('0x43'))[_0xc1ed('0x2e')]([_0xc1ed('0x2f'),'ContactId',_0xc1ed('0x1e'),_0x214f21,_0xc1ed('0x32'),_0xc1ed('0x3f')],squel[_0xc1ed('0x3d')]()[_0xc1ed('0x33')](_0xc1ed('0x2f'),_0xc1ed('0x2f'))[_0xc1ed('0x33')]('id',_0xc1ed('0x31'))[_0xc1ed('0x33')](LISTID[_0xc1ed('0x3a')](),_0xc1ed('0x1e'))[_0xc1ed('0x33')](_0xdc9d4c['id'][_0xc1ed('0x3a')](),_0x214f21)[_0xc1ed('0x33')](_0xc1ed('0x34'),_0xc1ed('0x32'))[_0xc1ed('0x33')](_0xc1ed('0x34'),'updatedAt')[_0xc1ed('0x35')]('cm_contacts')[_0xc1ed('0x38')](_0xc1ed('0x37'))[_0xc1ed('0x38')](_0xc1ed('0x39'),LISTID[_0xc1ed('0x3a')]())[_0xc1ed('0x38')](_0xc1ed('0x40'),squel[_0xc1ed('0x41')](hopperContacts))[_0xc1ed('0x38')](_0xc1ed('0x3b')))[_0xc1ed('0x3a')]();return _0x46cdb3;}return db[_0xc1ed('0x44')][_0xc1ed('0x45')]({'where':{'type':_0xc1ed('0x46')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xc1ed('0x47')],'as':_0xc1ed('0x48'),'where':{'id':LISTID}}]})[_0xc1ed('0x25')](function(_0x217fa1){var _0x55f5d1=[];if(_0x217fa1){var _0x46c3df;for(var _0x19dedb=0x0,_0x115560;_0x19dedb<_0x217fa1[_0xc1ed('0x15')];_0x19dedb+=0x1){_0x115560=_0x217fa1[_0x19dedb]['get']({'plain':!![]});switch(_0x115560[_0xc1ed('0x49')]){case _0xc1ed('0x4a'):_0x55f5d1[_0xc1ed('0x26')](db[_0xc1ed('0x4b')][_0xc1ed('0x4c')](_0x3f7ad1(_0x115560,_0xc1ed('0x4d')))[_0xc1ed('0x25')](function(){})['catch'](_0x3bde6f()));break;case'onlyIfOpen':_0x55f5d1[_0xc1ed('0x26')](db[_0xc1ed('0x4b')][_0xc1ed('0x4c')](_0x30c901(_0x115560,'VoiceQueueId'))['then'](function(){})[_0xc1ed('0x4e')](_0x3bde6f()));break;default:_0x55f5d1[_0xc1ed('0x26')](db[_0xc1ed('0x4b')][_0xc1ed('0x4c')](_0x46a3c6(_0x115560,_0xc1ed('0x4d')))['then'](function(){})[_0xc1ed('0x4e')](_0x3bde6f()));}}}return _0x55f5d1;})['all']()[_0xc1ed('0x25')](function(){return db[_0xc1ed('0x44')][_0xc1ed('0x45')]({'where':{'type':_0xc1ed('0x46')},'attributes':['id'],'include':[{'model':db[_0xc1ed('0x47')],'as':_0xc1ed('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x3adecf){var _0x41f78b=[];if(_0x3adecf){var _0x80733c;for(var _0x119052=0x0,_0x474e91;_0x119052<_0x3adecf[_0xc1ed('0x15')];_0x119052+=0x1){_0x474e91=_0x3adecf[_0x119052]['get']({'plain':!![]});_0x41f78b[_0xc1ed('0x26')](db[_0xc1ed('0x4b')][_0xc1ed('0x4c')](_0x10033d(_0x474e91,'VoiceQueueId'))[_0xc1ed('0x25')](function(){})[_0xc1ed('0x4e')](_0x3bde6f()));}}return _0x41f78b;})[_0xc1ed('0x50')]();})['then'](function(){return db[_0xc1ed('0x51')][_0xc1ed('0x45')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xc1ed('0x47')],'as':_0xc1ed('0x48'),'where':{'id':LISTID}}]})[_0xc1ed('0x25')](function(_0x547f38){var _0x36f48e=[];if(_0x547f38){for(var _0x30087f=0x0,_0x2427bb;_0x30087f<_0x547f38[_0xc1ed('0x15')];_0x30087f+=0x1){_0x2427bb=_0x547f38[_0x30087f][_0xc1ed('0x52')]({'plain':!![]});switch(_0x2427bb[_0xc1ed('0x49')]){case _0xc1ed('0x4a'):_0x36f48e[_0xc1ed('0x26')](db['sequelize'][_0xc1ed('0x4c')](_0x3f7ad1(_0x2427bb,_0xc1ed('0x53')))['then'](function(){})[_0xc1ed('0x4e')](_0x3bde6f()));break;case'onlyIfOpen':_0x36f48e[_0xc1ed('0x26')](db[_0xc1ed('0x4b')][_0xc1ed('0x4c')](_0x30c901(_0x2427bb,_0xc1ed('0x53')))['then'](function(){})['catch'](_0x3bde6f()));break;default:_0x36f48e[_0xc1ed('0x26')](db[_0xc1ed('0x4b')][_0xc1ed('0x4c')](_0x46a3c6(_0x2427bb,'CampaignId'))[_0xc1ed('0x25')](function(){})[_0xc1ed('0x4e')](_0x3bde6f()));}}}return _0x36f48e;})[_0xc1ed('0x50')]();})[_0xc1ed('0x25')](function(){return db['Campaign'][_0xc1ed('0x45')]({'attributes':['id'],'include':[{'model':db[_0xc1ed('0x47')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xc1ed('0x25')](function(_0x25e794){var _0x459897=[];if(_0x25e794){for(var _0x294a31=0x0,_0x543961;_0x294a31<_0x25e794[_0xc1ed('0x15')];_0x294a31+=0x1){_0x543961=_0x25e794[_0x294a31][_0xc1ed('0x52')]({'plain':!![]});_0x459897[_0xc1ed('0x26')](db[_0xc1ed('0x4b')]['query'](_0x10033d(_0x543961,_0xc1ed('0x53')))[_0xc1ed('0x25')](function(){})[_0xc1ed('0x4e')](_0x3bde6f()));}}return _0x459897;})['all']();})[_0xc1ed('0x4e')](function(_0x4b7751){logger[_0xc1ed('0x12')](_0xc1ed('0x54'),'generalCheckHopper',_0x4b7751[_0xc1ed('0x27')]);});}var processPromises=function(_0x2a9c17){return BPromise[_0xc1ed('0x50')](promises)[_0xc1ed('0x25')](function(_0x194cb2){})[_0xc1ed('0x4e')](function(_0x523b0e){logger[_0xc1ed('0x12')](_0xc1ed('0x55'),JSON['stringify'](_0x523b0e));})['finally'](function(){socket[_0xc1ed('0x56')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2a9c17){return _0x2a9c17['resume']();}});};var endCsv=function(){return BPromise[_0xc1ed('0x57')]()[_0xc1ed('0x25')](function(){if(hopperContacts){return checkHopper();}})[_0xc1ed('0x25')](function(){socket[_0xc1ed('0x56')](_0xc1ed('0x58')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x12321e){logger[_0xc1ed('0x12')](_0xc1ed('0x59'),JSON[_0xc1ed('0x28')](_0x12321e));}finally{process[_0xc1ed('0x5a')](0x0);}});};process['on'](_0xc1ed('0x5b'),function(){logger[_0xc1ed('0x5c')](_0xc1ed('0x5d'));endCsv();});function main(){return BPromise[_0xc1ed('0x57')]()[_0xc1ed('0x25')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc1ed('0xe')](',');return db[_0xc1ed('0x22')][_0xc1ed('0x45')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xc1ed('0x25')](function(_0x5e8a3c){var _0x10f40e=fs[_0xc1ed('0x5e')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x10f40e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x356994,_0x579995){total+=0x1;var _0x482486=total;promises[_0xc1ed('0x26')](checkRow(_0x356994,_0x5e8a3c,_0x482486)[_0xc1ed('0x25')](function(){success+=0x1;})[_0xc1ed('0x4e')](function(_0x106f20){if(_0x106f20[_0xc1ed('0x12')]){errors+=0x1;delete _0x106f20[_0xc1ed('0x12')];}else if(_0x106f20[_0xc1ed('0x5f')]){duplicates+=0x1;delete _0x106f20[_0xc1ed('0x5f')];}rows[_0xc1ed('0x26')](_0x106f20);}));if(total%0xc8===0x0){_0x579995[_0xc1ed('0x60')]();return processPromises(_0x579995);}},'complete':function(){return processPromises()[_0xc1ed('0x25')](function(){logger['info'](_0xc1ed('0x61'));endCsv();});},'error':function(_0x590ee1,_0x339b51){logger[_0xc1ed('0x5c')](_0xc1ed('0x62'),JSON[_0xc1ed('0x28')](_0x590ee1));endCsv();}});})[_0xc1ed('0x4e')](function(_0x39cd03){logger[_0xc1ed('0x12')](_0xc1ed('0x63'),JSON['stringify'](_0x39cd03));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 6ee790f..dfcf6b5 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 _0x6c8e=['cm_hopper_black','ContactId','updatedAt','select','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','recallme','.id\x20=\x20','createdAt','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','scheduledAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','errors','code','message','sequelize','query','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','utcOffset','set','offset','dialTimezone','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','keys','includes','ContactItemType','name','_description','header','writeFileSync','parse','rows','data','find','hasOwnProperty','trim','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','replace','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','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','CompanyId',',\x20scheduledAt\x20=\x20NOW()','duplicates','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','redis','localhost','socket.io-emitter','format','field','from','join','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','ListId','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone'];(function(_0xb4e3f1,_0x3fe445){var _0x5f32c6=function(_0x480200){while(--_0x480200){_0xb4e3f1['push'](_0xb4e3f1['shift']());}};_0x5f32c6(++_0x3fe445);}(_0x6c8e,0x80));var _0xe6c8=function(_0x153d7d,_0x1a0f50){_0x153d7d=_0x153d7d-0x0;var _0x336a8f=_0x6c8e[_0x153d7d];return _0x336a8f;};'use strict';var fs=require('fs');var path=require(_0xe6c8('0x0'));var _=require(_0xe6c8('0x1'));var Papa=require(_0xe6c8('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0xe6c8('0x3'));var squel=require(_0xe6c8('0x4'));var Redis=require(_0xe6c8('0x5'));var db=require(_0xe6c8('0x6'))['db'];var config=require(_0xe6c8('0x7'));var shared=require(_0xe6c8('0x8'));var logger=require('../../../config/logger')('import');config[_0xe6c8('0x9')]=_['defaults'](config[_0xe6c8('0x9')],{'host':_0xe6c8('0xa'),'port':0x18eb});var socket=require(_0xe6c8('0xb'))(new Redis(config[_0xe6c8('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xe6c8('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xe6c8('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x6851fb){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'](_0x6851fb);}function selectNotIn(_0x267f8f,_0x4e45cc,_0x136fda,_0x47133e,_0x7f15d4){return squel['select']()[_0xe6c8('0xd')]('phone')[_0xe6c8('0xe')](_0x47133e)[_0xe6c8('0xf')](_0x4e45cc,null,_0x4e45cc+'.id\x20=\x20'+_0x47133e+'.'+_0x136fda)['where'](_0x47133e+'.'+_0x136fda+_0xe6c8('0x10')+_0x267f8f+'.'+_0x136fda)[_0xe6c8('0x11')](_0x4e45cc+_0xe6c8('0x12')+_0x7f15d4[_0xe6c8('0xf')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x186278,_0x5eae0b){promisesAdditionalPhones=[];return db['CmContact'][_0xe6c8('0x13')]({'raw':!![],'attributes':['id',_0xe6c8('0x14')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xe6c8('0x15')](function(_0x5ccc84){if(_0x5ccc84!==null){var _0xa3649e=[];for(var _0x5575de=0x0;_0x5575de<_0x5ccc84[_0xe6c8('0x16')];_0x5575de++){var _0x2343f2=_0x5ccc84[_0x5575de];_0xa3649e[_0xe6c8('0x17')](insertAdditionalPhones(_0x2343f2));}}Promise[_0xe6c8('0x18')](_0xa3649e)['then'](function(){_0x186278({'val':0x1});});});});}function insertAdditionalPhones(_0x5af0de){return new Promise(function(_0x45a266,_0x5e192e){var _0x3ee112=_0x5af0de[_0xe6c8('0x14')];var _0x25f5ec=_0x3ee112[_0xe6c8('0x19')](';');var _0x164e22=[];orderBy=0x0;for(var _0x971f08=0x0;_0x971f08<_0x25f5ec[_0xe6c8('0x16')];_0x971f08++){_0x164e22[_0xe6c8('0x17')](splitAdditionalPhone(_0x5af0de['id'],_0x25f5ec[_0x971f08]));}Promise['all'](_0x164e22)[_0xe6c8('0x15')](function(){_0x45a266({'val':_0x25f5ec[_0xe6c8('0x16')]});});});}function splitAdditionalPhone(_0x1450b0,_0x222a2f){return new Promise(function(_0x463847,_0x482825){var _0xdfc44f=_0x222a2f[_0xe6c8('0x19')](':');var _0x1f44ff=_0xdfc44f[0x0];var _0x19926b=_0xdfc44f[0x1];if(!_[_0xe6c8('0x1a')](_0x19926b)){var _0xe8f660=_0x19926b[_0xe6c8('0x19')]('|');var _0x5f12f5=[];for(var _0x531bd6=0x0;_0x531bd6<_0xe8f660[_0xe6c8('0x16')];_0x531bd6++){if(_0xe8f660[_0x531bd6]!==''){var _0xac0c74=_[_0xe6c8('0x1b')](promisesAdditionalPhones,{'contactId':_0x1450b0,'phone':_0xe8f660[_0x531bd6]});if(_0xac0c74[_0xe6c8('0x16')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x1450b0,'contactTypeId':_0x1f44ff,'phone':_0xe8f660[_0x531bd6],'orderBy':orderBy});}}}_0x463847({'ok':0x1});}else _0x463847({'res':0x0});});}function createAdditionalPhone(_0x15ad13,_0x37402e,_0x6cf531,_0x1150d7){var _0xa52858='';var _0x5c05b0='';var _0x188c7f=_0x6cf531[_0xe6c8('0x19')]('§');_0xa52858=_0x188c7f[0x0];if(_0x188c7f['length']==0x2)_0x5c05b0=_0x188c7f[0x1];return new Promise(function(_0x2f3435,_0x4a4093){return db[_0xe6c8('0x1c')][_0xe6c8('0x1d')]({'where':{'CmContactId':_0x15ad13,'item':_0xa52858}})[_0xe6c8('0x15')](function(_0x250b8f){if(_0x250b8f){return db[_0xe6c8('0x1c')][_0xe6c8('0x1e')]({'ItemTypeId':_0x37402e,'description':_0x5c05b0,'OrderBy':_0x1150d7},{'where':{'CmContactId':_0x15ad13,'item':_0xa52858}})[_0xe6c8('0x15')](function(_0x4613b3){_0x2f3435({'res':'updated'});});}else{return db[_0xe6c8('0x1c')][_0xe6c8('0x1f')]({'CmContactId':_0x15ad13,'item':_0xa52858,'description':_0x5c05b0,'ItemTypeId':_0x37402e,'OrderBy':_0x1150d7,'ItemClass':_0xe6c8('0x20')})['then'](function(_0x45449c){_0x2f3435({'res':_0xe6c8('0x21')});});}});});}function insertCmHopper(_0x2c03c0,_0x4de1c5,_0x35c595,_0x3a7cff,_0x357266){var _0x4ce1da=['cm_contacts.phone',_0xe6c8('0x22'),_0xe6c8('0x23'),_0xe6c8('0x24'),_0x4de1c5+'.'+_0x3a7cff,_0xe6c8('0x25'),'cm_contacts.updatedAt',_0xe6c8('0x26'),_0xe6c8('0x27'),'\x22'+_0x357266+'\x22'];return squel[_0xe6c8('0x28')]()[_0xe6c8('0x29')](_0xe6c8('0x2a'))[_0xe6c8('0x2b')]([_0xe6c8('0x2c'),'scheduledat','ContactId',_0xe6c8('0x2d'),_0x3a7cff,'createdAt','updatedAt',_0xe6c8('0x2e'),_0xe6c8('0x2f'),'recallme'],squel['select']()[_0xe6c8('0x30')](_0x4ce1da)[_0xe6c8('0xe')](_0x4de1c5)[_0xe6c8('0xf')](_0xe6c8('0x31'),null,_0xe6c8('0x32')+_0x4de1c5+_0xe6c8('0x33'))[_0xe6c8('0xf')](_0x35c595,null,_0x35c595+'.id\x20=\x20'+_0x4de1c5+'.'+_0x3a7cff)[_0xe6c8('0x11')](_0x4de1c5+_0xe6c8('0x34'),_0x2c03c0)[_0xe6c8('0x11')](_0xe6c8('0x35'),NOW)[_0xe6c8('0x11')](_0xe6c8('0x36'),selectNotIn(_0x4de1c5,_0x35c595,_0x3a7cff,_0xe6c8('0x2a'),[_0xe6c8('0x37'),_0xe6c8('0x38')]))[_0xe6c8('0x11')](_0xe6c8('0x36'),selectNotIn(_0x4de1c5,_0x35c595,_0x3a7cff,_0xe6c8('0x2a'),[_0xe6c8('0x37')])))[_0xe6c8('0x39')]();}function insertCmHopperBlack(_0x45d4c,_0x19c014,_0x21a851,_0x332a18){var _0x1e383b=[_0xe6c8('0x3a'),_0xe6c8('0x23'),'cm_contacts.ListId',_0x19c014+'.'+_0x332a18,_0xe6c8('0x25'),'cm_contacts.updatedAt'];return squel[_0xe6c8('0x28')]()[_0xe6c8('0x29')](_0xe6c8('0x3b'))['fromQuery']([_0xe6c8('0x2c'),_0xe6c8('0x3c'),_0xe6c8('0x2d'),_0x332a18,'createdAt',_0xe6c8('0x3d')],squel[_0xe6c8('0x3e')]()[_0xe6c8('0x30')](_0x1e383b)[_0xe6c8('0xe')](_0x19c014)['join']('cm_contacts',null,_0xe6c8('0x32')+_0x19c014+'.CmListId')[_0xe6c8('0xf')](_0x21a851,null,_0x21a851+'.id\x20=\x20'+_0x19c014+'.'+_0x332a18)[_0xe6c8('0x11')](_0x19c014+_0xe6c8('0x34'),_0x45d4c)[_0xe6c8('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xe6c8('0x36'),squel[_0xe6c8('0x3e')]()[_0xe6c8('0xd')](_0xe6c8('0x2c'))[_0xe6c8('0xe')](_0xe6c8('0x3b'))[_0xe6c8('0x11')](_0xe6c8('0x3f'),_0x45d4c)['where'](_0x332a18+_0xe6c8('0x10')+_0x19c014+'.'+_0x332a18)))[_0xe6c8('0x39')]();}function insertTzCmHopper(_0x4aaeef,_0x1fae7a,_0x1a1105,_0x3fe616,_0x59abfe,_0xf2a124){var _0x278502=['cm_contacts.phone',_0xe6c8('0x40')+_0xf2a124+_0xe6c8('0x41'),_0xe6c8('0x23'),_0xe6c8('0x24'),_0x1fae7a+'.'+_0x3fe616,'cm_contacts.createdAt',_0xe6c8('0x42'),_0xe6c8('0x26'),_0xe6c8('0x27'),'\x22'+_0x59abfe+'\x22'];var _0xc94f5e=squel['insert']()[_0xe6c8('0x29')]('cm_hopper')['fromQuery']([_0xe6c8('0x2c'),_0xe6c8('0x43'),_0xe6c8('0x3c'),_0xe6c8('0x2d'),_0x3fe616,'createdAt',_0xe6c8('0x3d'),_0xe6c8('0x2e'),'UserId',_0xe6c8('0x44')],squel[_0xe6c8('0x3e')]()[_0xe6c8('0x30')](_0x278502)['from'](_0x1fae7a)[_0xe6c8('0xf')](_0xe6c8('0x31'),null,_0xe6c8('0x32')+_0x1fae7a+_0xe6c8('0x33'))[_0xe6c8('0xf')](_0x1a1105,null,_0x1a1105+_0xe6c8('0x45')+_0x1fae7a+'.'+_0x3fe616)[_0xe6c8('0xf')](_0xf2a124,null,_0xf2a124+_0xe6c8('0x45')+_0x1fae7a+'.'+_0x3fe616)['where'](_0x1fae7a+_0xe6c8('0x34'),_0x4aaeef)['where'](_0xe6c8('0x35'),NOW)[_0xe6c8('0x11')](_0xe6c8('0x36'),selectNotIn(_0x1fae7a,_0x1a1105,_0x3fe616,_0xe6c8('0x2a'),[_0xe6c8('0x37'),_0xe6c8('0x38')]))[_0xe6c8('0x11')](_0xe6c8('0x36'),selectNotIn(_0x1fae7a,_0x1a1105,_0x3fe616,'cm_hopper',[_0xe6c8('0x37')])))[_0xe6c8('0x39')]();return _0xc94f5e;}function insertTzCmHopperBlack(_0x2fdba4,_0x5349b8,_0x233dcf,_0x5017ff){var _0x1cd703=[_0xe6c8('0x3a'),_0xe6c8('0x23'),'cm_contacts.ListId',_0x5349b8+'.'+_0x5017ff,'cm_contacts.createdAt',_0xe6c8('0x42')];return squel[_0xe6c8('0x28')]()[_0xe6c8('0x29')](_0xe6c8('0x3b'))[_0xe6c8('0x2b')](['phone','ContactId',_0xe6c8('0x2d'),_0x5017ff,_0xe6c8('0x46'),_0xe6c8('0x3d')],squel['select']()['fields'](_0x1cd703)[_0xe6c8('0xe')](_0x5349b8)[_0xe6c8('0xf')]('cm_contacts',null,_0xe6c8('0x32')+_0x5349b8+_0xe6c8('0x33'))[_0xe6c8('0xf')](_0x233dcf,null,_0x233dcf+_0xe6c8('0x45')+_0x5349b8+'.'+_0x5017ff)[_0xe6c8('0x11')](_0x5349b8+'.CmListId\x20=\x20?',_0x2fdba4)['where'](_0xe6c8('0x35'),NOW)['where'](_0xe6c8('0x36'),squel[_0xe6c8('0x3e')]()[_0xe6c8('0xd')](_0xe6c8('0x2c'))[_0xe6c8('0xe')](_0xe6c8('0x3b'))[_0xe6c8('0x11')](_0xe6c8('0x3f'),_0x2fdba4)[_0xe6c8('0x11')](_0x5017ff+_0xe6c8('0x10')+_0x5349b8+'.'+_0x5017ff)))['toString']();}function insertCmHopperAdditionalPhones(_0x271409){var _0x29b3a1=[_0xe6c8('0x47'),_0xe6c8('0x48'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0xe6c8('0x49')];return squel[_0xe6c8('0x28')]()[_0xe6c8('0x29')](_0xe6c8('0x4a'))['fromQuery']([_0xe6c8('0x4b'),_0xe6c8('0x2c'),_0xe6c8('0x4c'),_0xe6c8('0x46'),_0xe6c8('0x3d')],squel[_0xe6c8('0x3e')]()[_0xe6c8('0x30')](_0x29b3a1)['from'](_0xe6c8('0x2a'))[_0xe6c8('0xf')](_0xe6c8('0x31'),null,_0xe6c8('0x4d'))[_0xe6c8('0xf')](_0xe6c8('0x4e'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xe6c8('0x11')](_0xe6c8('0x4f'),_0x271409)[_0xe6c8('0x11')](_0xe6c8('0x35'),NOW))[_0xe6c8('0x39')]();}function insertCmContact(_0x5353ee,_0x54286e,_0x4ed487,_0x11caf0){var _0x515a09=_['concat'](_['keys'](_0x11caf0),[_0xe6c8('0x2d'),'CompanyId','createdAt',_0xe6c8('0x3d'),_0xe6c8('0x50')]);return squel['insert']()['into'](_0xe6c8('0x31'))[_0xe6c8('0x2b')](_0x515a09,squel['select']()[_0xe6c8('0x30')](_0x515a09)['from'](_0x54286e)[_0xe6c8('0x11')]('('+_0x4ed487[_0xe6c8('0xf')](',')+_0xe6c8('0x51'),squel[_0xe6c8('0x3e')]()[_0xe6c8('0x30')](_0x4ed487)['from']('cm_contacts')[_0xe6c8('0x11')](_0xe6c8('0x3f'),_0x5353ee)[_0xe6c8('0x11')]('deletedAt\x20IS\x20NULL'))[_0xe6c8('0x11')](_0xe6c8('0x52'),squel[_0xe6c8('0x3e')]()[_0xe6c8('0xd')](_0xe6c8('0x53'),_0xe6c8('0x54'))[_0xe6c8('0xe')](_0x54286e)[_0xe6c8('0x55')](_0x4ed487[_0xe6c8('0xf')](','))))['toString']();}function handleStop(){logger[_0xe6c8('0x56')](_0xe6c8('0x57'));stopped=!![];}function handleUncaughtException(_0x2560a6){logger[_0xe6c8('0x58')](_0x2560a6['message']);process[_0xe6c8('0x59')](0x1);}function handleError(_0xf1664d,_0x288ee0){stats[_0xe6c8('0x5a')][_0xe6c8('0x17')]({'name':_0x288ee0[_0xe6c8('0x5b')],'message':_0x288ee0[_0xe6c8('0x5c')],'row':_0xf1664d});}function handleQuery(_0x432717){logger[_0xe6c8('0x56')](_0x432717);return db[_0xe6c8('0x5d')][_0xe6c8('0x5e')](_0x432717)[_0xe6c8('0x5f')](function(_0x318c69){results[_0xe6c8('0x17')](_0x318c69);})['catch'](function(_0x1916aa){logger['error'](_0x1916aa['message']);});}function updateTzCampaigns(_0x2fe629){return new Promise(function(_0x28f144,_0x1d3cdf){var _0x1b5709=squel[_0xe6c8('0x3e')]()[_0xe6c8('0x30')]([_0xe6c8('0x60'),'campaigns.dialTimezone'])[_0xe6c8('0xe')](_0xe6c8('0x61'))[_0xe6c8('0xf')](_0xe6c8('0x62'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0xe6c8('0x11')](_0xe6c8('0x63')+_0x2fe629);db[_0xe6c8('0x5d')]['query'](_0x1b5709[_0xe6c8('0x39')]())[_0xe6c8('0x5f')](function(_0x543621){var _0x501fd5=[];for(var _0x44f65a=0x0;_0x44f65a<_0x543621[_0xe6c8('0x16')];_0x44f65a++){_0x501fd5[_0xe6c8('0x17')](getTimezoneData(_0x543621[_0x44f65a],tmp_campaigns));}BPromise[_0xe6c8('0x18')](_0x501fd5)['then'](function(){_0x28f144({'val':0x1});});})[_0xe6c8('0x64')](function(_0xce181f){logger[_0xe6c8('0x58')](_0xce181f[_0xe6c8('0x5c')]);_0x28f144({'val':0x0});});});}function updateTzVoiceQueues(_0x3b074e){return new Promise(function(_0x143c31,_0x422a6a){var _0x52dd5a=squel[_0xe6c8('0x3e')]()[_0xe6c8('0x30')]([_0xe6c8('0x65'),_0xe6c8('0x66')])['from'](_0xe6c8('0x67'))[_0xe6c8('0xf')](_0xe6c8('0x68'),null,_0xe6c8('0x69'))['where'](_0xe6c8('0x6a')+_0x3b074e);db['sequelize']['query'](_0x52dd5a[_0xe6c8('0x39')]())[_0xe6c8('0x5f')](function(_0x47a5e6){var _0x19799a=[];for(var _0x579c49=0x0;_0x579c49<_0x47a5e6[_0xe6c8('0x16')];_0x579c49++){_0x19799a['push'](getTimezoneData(_0x47a5e6[_0x579c49],tmp_voice_queues));}BPromise[_0xe6c8('0x18')](_0x19799a)[_0xe6c8('0x15')](function(){_0x143c31({'val':0x1});});})[_0xe6c8('0x64')](function(_0x48efc0){logger['error'](_0x48efc0['message']);_0x143c31({'val':0x0});});});}function getTimezoneData(_0x20cfdd,_0x231f70){return new Promise(function(_0x46f2ab,_0x5d616e){var _0x1b47be=shared['timezones'];var _0x8791c4=_0x1b47be[_0x20cfdd['dialTimezone']];if(_[_0xe6c8('0x1a')](_0x8791c4)){_0x46f2ab({'ret':0x1});}else{var _0x4e28c9=_0x8791c4[_0xe6c8('0x6b')];var _0x3c0ca0=squel[_0xe6c8('0x28')]()[_0xe6c8('0x29')](_0x231f70)[_0xe6c8('0x6c')]('id',_0x20cfdd['id'])[_0xe6c8('0x6c')](_0xe6c8('0x6d'),_0x4e28c9)[_0xe6c8('0x6c')](_0xe6c8('0x6e'),_0x20cfdd[_0xe6c8('0x6e')])[_0xe6c8('0x39')]();return db[_0xe6c8('0x5d')]['query'](_0x3c0ca0)[_0xe6c8('0x5f')](function(_0x122867){_0x46f2ab({'ret':0x1});})['catch'](function(_0x5349ec){logger['error'](_0x5349ec['message']);_0x5d616e({'ret':0x1});});}});}function handleTZQuery(_0x29c7db){logger[_0xe6c8('0x56')](_0x29c7db);return db[_0xe6c8('0x5d')]['query'](_0x29c7db)[_0xe6c8('0x5f')](function(_0x16ba80){})[_0xe6c8('0x64')](function(_0x16c77b){logger['error'](_0x16c77b[_0xe6c8('0x5c')]);});}function main(_0x1f9657,_0x3a0f1e,_0x496753,_0x5c6f85){logger[_0xe6c8('0x56')](_0xe6c8('0x6f'),_0x1f9657,JSON[_0xe6c8('0x70')](_0x3a0f1e));process[_0xe6c8('0x71')](_0xe6c8('0x72'));var _0x47dd6f=_0x3a0f1e[_0xe6c8('0x73')];var _0x780c24=_[_0xe6c8('0x74')](_0x47dd6f);var _0xe68fb4=_0x3a0f1e[_0xe6c8('0x75')];var _0x565c93=path['join'](config[_0xe6c8('0x76')],_0xe6c8('0x77'),_0xe68fb4+_0xe6c8('0x78'));hasTZ=_[_0xe6c8('0x79')](_0x47dd6f)[_0xe6c8('0x7a')]('dialTimezone');var _0x2c5546=_[_0xe6c8('0x79')](_0x47dd6f)['join']();logger[_0xe6c8('0x56')]('header',_0x2c5546);db[_0xe6c8('0x7b')][_0xe6c8('0x13')]({'raw':!![],'attributes':['id',_0xe6c8('0x7c')]})[_0xe6c8('0x15')](function(_0x4f5355){for(var _0xf3083b=0x0;_0xf3083b<_0x4f5355['length'];_0xf3083b++){if(_0x4f5355[_0xf3083b][_0xe6c8('0x7c')]in _0x47dd6f){contactItemTypes[_0xe6c8('0x17')](_0x4f5355[_0xf3083b]);delete _0x780c24[_0x4f5355[_0xf3083b][_0xe6c8('0x7c')]];hasAdditionalPhones=!![];}for(var _0x10e9d5 in _0x47dd6f){if(_0x4f5355[_0xf3083b][_0xe6c8('0x7c')]+_0xe6c8('0x7d')===_0x10e9d5){phoneDescriptions[_0xe6c8('0x17')]({'itemTypeId':_0x4f5355[_0xf3083b]['id'],'description':_0x10e9d5});delete _0x780c24[_0x10e9d5];}}}if(hasAdditionalPhones)_0x780c24[_0xe6c8('0x14')]='';var _0x127abb=_[_0xe6c8('0x79')](_0x780c24)['join']();logger['info'](_0xe6c8('0x7e'),_0x127abb);fs[_0xe6c8('0x7f')](_0x565c93,_0x127abb+'\x0a');Papa[_0xe6c8('0x80')](fs['createReadStream'](_0x1f9657),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4c9f46,_0x27c7ff){try{for(var _0x3de756=0x0,_0x18d1f5=[];_0x3de756<_0x4c9f46['data']['length'];_0x3de756++){stats[_0xe6c8('0x81')]+=0x1;if(_0x4c9f46[_0xe6c8('0x5a')][_0x3de756]){handleError(_0x4c9f46[_0xe6c8('0x82')][_0x3de756],_0x4c9f46[_0xe6c8('0x5a')][_0x3de756]);}else{var _0x5130d1=[];var _0x41a1ed=[];var _0x32208e={};for(var _0x31bf57 in _0x47dd6f){let _0x2f30f0=contactItemTypes[_0xe6c8('0x83')](_0x1178f2=>_0x1178f2[_0xe6c8('0x7c')]===_0x31bf57);let _0x2b07d9=contactItemTypes[_0xe6c8('0x83')](_0x26077e=>_0x26077e['name']+'_description'===_0x31bf57);if(_[_0xe6c8('0x1a')](_0x2f30f0)&&_['isNil'](_0x2b07d9)){if(_0x47dd6f[_0xe6c8('0x84')](_0x31bf57)){if(_0x4c9f46[_0xe6c8('0x82')][_0x3de756][_0x47dd6f[_0x31bf57]]){var _0x1264ce=_[_0xe6c8('0x85')](_0x4c9f46[_0xe6c8('0x82')][_0x3de756][_0x47dd6f[_0x31bf57]]['replace'](/"/g,'\x27'));switch(_0x31bf57){case _0xe6c8('0x43'):var _0x147672=moment(_0x1264ce,_0xe6c8('0x86'),!![]);if(_0x147672[_0xe6c8('0x87')]()){_0x18d1f5[_0xe6c8('0x17')]('\x22'+_0x1264ce+'\x22');}else{_0x5130d1['push'](_0xe6c8('0x88'));}break;case _0xe6c8('0x2e'):var _0x2fabdc=parseInt(_0x1264ce);_0x1264ce=_['isNaN'](_0x2fabdc)||_0x2fabdc<0x0||_0x2fabdc>0x4?_0x5c6f85?0x3:0x2:_0x2fabdc;_0x18d1f5[_0xe6c8('0x17')]('\x22'+_0x1264ce+'\x22');break;case _0xe6c8('0x2f'):var _0x52d3c3=parseInt(_0x1264ce);if(_[_0xe6c8('0x89')](_0x52d3c3)&&_['includes'](_0x496753,_0x52d3c3)){_0x18d1f5[_0xe6c8('0x17')]('\x22'+_0x52d3c3+'\x22');}else{_0x5130d1[_0xe6c8('0x17')](_0xe6c8('0x8a'));}break;case _0xe6c8('0x8b'):if(isEmail(_0x1264ce)){_0x18d1f5[_0xe6c8('0x17')]('\x22'+_0x1264ce+'\x22');}else{_0x5130d1['push'](_0xe6c8('0x8c'));}break;case'dateOfBirth':var _0x17277f=moment(_0x1264ce,'YYYY-MM-DD',!![]);if(_0x17277f['isValid']()){_0x18d1f5[_0xe6c8('0x17')]('\x22'+_0x1264ce+'\x22');}else{_0x5130d1[_0xe6c8('0x17')](_0xe6c8('0x8d'));}break;case _0xe6c8('0x6e'):var _0x1db51a=shared[_0xe6c8('0x8e')];var _0x47083d=_0x1db51a[_0x1264ce];if(!_['isNil'](_0x47083d)){var _0x339bcb=_0x47083d['utcOffset'];_0x18d1f5['push']('\x22'+_0x1264ce+'\x22');_0x18d1f5[_0xe6c8('0x17')]('\x22'+_0x339bcb+'\x22');}break;default:_0x18d1f5[_0xe6c8('0x17')]('\x22'+_0x1264ce+'\x22');}}else{switch(_0x31bf57){case _0xe6c8('0x8f'):case'phone':_0x5130d1[_0xe6c8('0x17')](_0x31bf57+_0xe6c8('0x90'));break;default:_0x18d1f5['push']('\x22\x22');}}}}else{var _0x49a134='';if(!_[_0xe6c8('0x1a')](_0x2f30f0)){if(!_0x32208e[_0xe6c8('0x84')](_0x2f30f0['id'])){if(!_[_0xe6c8('0x1a')](_0x4c9f46['data'][_0x3de756][_0x47dd6f[_0x31bf57]])){var _0x1264ce=_['trim'](_0x4c9f46['data'][_0x3de756][_0x47dd6f[_0x31bf57]][_0xe6c8('0x91')](/"/g,'\x27'));var _0x475d25=phoneDescriptions[_0xe6c8('0x83')](_0x1bc14f=>_0x1bc14f['itemTypeId']===_0x2f30f0['id']);if(!_[_0xe6c8('0x1a')](_0x475d25)){var _0x489db9=_[_0xe6c8('0x85')](_0x4c9f46['data'][_0x3de756][_0x47dd6f[_0x475d25['description']]]['replace'](/"/g,'\x27'));if(!_[_0xe6c8('0x1a')](_0x489db9))_0x1264ce=_0x1264ce+'§'+_0x489db9;}if(_0x49a134=='')_0x49a134=_0x1264ce;else _0x49a134+='|'+_0x1264ce;}_0x41a1ed[_0xe6c8('0x17')](_0x2f30f0['id']+':'+_0x49a134);_0x32208e[_0x2f30f0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x18d1f5[_0xe6c8('0x17')]('\x22'+_0x41a1ed[_0xe6c8('0xf')](';')+'\x22');}if(_0x5130d1[_0xe6c8('0x16')]){handleError(_0x4c9f46[_0xe6c8('0x82')][_0x3de756],{'code':_0xe6c8('0x92'),'message':_0x5130d1[_0xe6c8('0xf')]()});}else{fs[_0xe6c8('0x93')](_0x565c93,_0x18d1f5[_0xe6c8('0xf')]()+'\x0a');}_0x18d1f5=[];}if(!(stats['rows']%0xc8)){socket[_0xe6c8('0x94')](_0xe6c8('0x95')+_0xe68fb4,stats);stats['errors']=[];}}if(stopped){logger[_0xe6c8('0x56')](_0xe6c8('0x96'));_0x27c7ff[_0xe6c8('0x97')]();}}catch(_0x52f5a7){handleError(_0x4c9f46[_0xe6c8('0x82')][_0x3de756],{'code':'SystemError','message':_0x52f5a7['message']});logger[_0xe6c8('0x58')]('step',_0x52f5a7[_0xe6c8('0x5c')]);}},'complete':function(){try{var _0x36bf4d=[];var _0x31907b=[];var _0x17bdfb=_0xe6c8('0x31');if(_0x3a0f1e['duplicates']&&_0x3a0f1e['duplicates'][_0xe6c8('0x16')]){_0x17bdfb=_0xe6c8('0x98')+_0xe68fb4;_0x36bf4d[_0xe6c8('0x17')](_0xe6c8('0x99')+_0x17bdfb+_0xe6c8('0x9a'));}tmp_campaigns=_0xe6c8('0x9b')+_0xe68fb4;tmp_voice_queues=_0xe6c8('0x9c')+_0xe68fb4;_0x31907b[_0xe6c8('0x17')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x31907b['push'](_0xe6c8('0x99')+tmp_voice_queues+_0xe6c8('0x9d'));BPromise['each'](_0x31907b,handleTZQuery)['then'](function(_0x1e58de){updateTzCampaigns(_0x3a0f1e['ListId'])[_0xe6c8('0x15')](function(_0x504776){updateTzVoiceQueues(_0x3a0f1e[_0xe6c8('0x2d')])[_0xe6c8('0x15')](function(_0x353c45){if(hasTZ)_0x127abb=_0x127abb[_0xe6c8('0x91')]('dialTimezone',_0xe6c8('0x9e'));var _0x4bdd42=util[_0xe6c8('0xc')](_0xe6c8('0x9f'),_0x565c93,_0x17bdfb,_0x127abb,_0x3a0f1e[_0xe6c8('0x2d')],_0x3a0f1e[_0xe6c8('0xa0')]||null,NOW,NOW);if(_[_0xe6c8('0x1a')](_0x47dd6f[_0xe6c8('0x43')])){_0x4bdd42+=_0xe6c8('0xa1');}_0x36bf4d[_0xe6c8('0x17')](_0x4bdd42);if(_0x3a0f1e[_0xe6c8('0xa2')]&&_0x3a0f1e[_0xe6c8('0xa2')][_0xe6c8('0x16')]){_0x36bf4d[_0xe6c8('0x17')](insertCmContact(_0x3a0f1e[_0xe6c8('0x2d')],_0x17bdfb,_0x3a0f1e[_0xe6c8('0xa2')],_0x47dd6f));_0x36bf4d['push'](_0xe6c8('0xa3')+_0x17bdfb+';');}BPromise[_0xe6c8('0xa4')](_0x36bf4d,handleQuery)['then'](function(_0x4a04bf){BPromise[_0xe6c8('0x18')]([handleAdditionalPhones()])[_0xe6c8('0x15')](function(){_0x36bf4d=[];for(var _0x59fb23=0x0;_0x59fb23\x20\x20','server/files/tmp','existsSync','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','papaparse','util','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','from','join','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','push','all','length','split','filter','CmContactHasItem','findOne','create','PHONE','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_contacts.updatedAt','cm_hopper_black','createdAt','updatedAt','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','field','\x20=\x20','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','stringify','send','start','binding','clone','socket_timestamp','root','.csv','includes','ContactItemType','name','_description','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x9ba7,0xdf));var _0x79ba=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9ba7[_0x16b9ed];return _0x66b1f8;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x79ba('0x0'));var util=require(_0x79ba('0x1'));var BPromise=require('bluebird');var moment=require('moment');var squel=require('squel');var Redis=require('ioredis');var db=require(_0x79ba('0x2'))['db'];var config=require(_0x79ba('0x3'));var shared=require(_0x79ba('0x4'));var logger=require(_0x79ba('0x5'))(_0x79ba('0x6'));config[_0x79ba('0x7')]=_[_0x79ba('0x8')](config[_0x79ba('0x7')],{'host':_0x79ba('0x9'),'port':0x18eb});var socket=require(_0x79ba('0xa'))(new Redis(config[_0x79ba('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x79ba('0xb')](_0x79ba('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0xfb37cb){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'](_0xfb37cb);}function selectNotIn(_0x539901,_0x526976,_0x3f10d7,_0x22ce7a,_0x1bdd66){return squel[_0x79ba('0xd')]()['field']('phone')[_0x79ba('0xe')](_0x22ce7a)[_0x79ba('0xf')](_0x526976,null,_0x526976+'.id\x20=\x20'+_0x22ce7a+'.'+_0x3f10d7)['where'](_0x22ce7a+'.'+_0x3f10d7+'\x20=\x20'+_0x539901+'.'+_0x3f10d7)[_0x79ba('0x10')](_0x526976+_0x79ba('0x11')+_0x1bdd66[_0x79ba('0xf')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5bf4af,_0x92ff34){promisesAdditionalPhones=[];return db[_0x79ba('0x12')][_0x79ba('0x13')]({'raw':!![],'attributes':['id',_0x79ba('0x14')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x79ba('0x15')](function(_0x13b8bf){if(_0x13b8bf!==null){var _0x4f9145=[];for(var _0x5f567e=0x0;_0x5f567e<_0x13b8bf['length'];_0x5f567e++){var _0x2dd69e=_0x13b8bf[_0x5f567e];_0x4f9145[_0x79ba('0x16')](insertAdditionalPhones(_0x2dd69e));}}Promise[_0x79ba('0x17')](_0x4f9145)[_0x79ba('0x15')](function(){_0x5bf4af({'val':0x1});});});});}function insertAdditionalPhones(_0x44f622){return new Promise(function(_0x3d4e10,_0x1bc158){var _0x288c5f=_0x44f622[_0x79ba('0x14')];var _0x589106=_0x288c5f['split'](';');var _0x3275a5=[];orderBy=0x0;for(var _0x870444=0x0;_0x870444<_0x589106[_0x79ba('0x18')];_0x870444++){_0x3275a5[_0x79ba('0x16')](splitAdditionalPhone(_0x44f622['id'],_0x589106[_0x870444]));}Promise[_0x79ba('0x17')](_0x3275a5)[_0x79ba('0x15')](function(){_0x3d4e10({'val':_0x589106[_0x79ba('0x18')]});});});}function splitAdditionalPhone(_0x21c9b4,_0x10cad6){return new Promise(function(_0x4c6e27,_0x9bc179){var _0x558d3e=_0x10cad6[_0x79ba('0x19')](':');var _0x1ae283=_0x558d3e[0x0];var _0x265842=_0x558d3e[0x1];if(!_['isNil'](_0x265842)){var _0x3ab694=_0x265842[_0x79ba('0x19')]('|');var _0x18b560=[];for(var _0x58553d=0x0;_0x58553d<_0x3ab694['length'];_0x58553d++){if(_0x3ab694[_0x58553d]!==''){var _0x376302=_[_0x79ba('0x1a')](promisesAdditionalPhones,{'contactId':_0x21c9b4,'phone':_0x3ab694[_0x58553d]});if(_0x376302[_0x79ba('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x79ba('0x16')]({'contactId':_0x21c9b4,'contactTypeId':_0x1ae283,'phone':_0x3ab694[_0x58553d],'orderBy':orderBy});}}}_0x4c6e27({'ok':0x1});}else _0x4c6e27({'res':0x0});});}function createAdditionalPhone(_0x576c88,_0x5003da,_0x1aa14e,_0x5739df){var _0x4aa183='';var _0x2c0524='';var _0x186445=_0x1aa14e['split']('§');_0x4aa183=_0x186445[0x0];if(_0x186445['length']==0x2)_0x2c0524=_0x186445[0x1];return new Promise(function(_0x4c4e70,_0x2437c4){return db[_0x79ba('0x1b')][_0x79ba('0x1c')]({'where':{'CmContactId':_0x576c88,'item':_0x4aa183}})[_0x79ba('0x15')](function(_0x28ace7){if(_0x28ace7){return db[_0x79ba('0x1b')]['update']({'ItemTypeId':_0x5003da,'description':_0x2c0524,'OrderBy':_0x5739df},{'where':{'CmContactId':_0x576c88,'item':_0x4aa183}})['then'](function(_0x48256b){_0x4c4e70({'res':'updated'});});}else{return db[_0x79ba('0x1b')][_0x79ba('0x1d')]({'CmContactId':_0x576c88,'item':_0x4aa183,'description':_0x2c0524,'ItemTypeId':_0x5003da,'OrderBy':_0x5739df,'ItemClass':_0x79ba('0x1e')})[_0x79ba('0x15')](function(_0x3e2fd3){_0x4c4e70({'res':'inserted'});});}});});}function insertCmHopper(_0x52e146,_0x535a48,_0x43376b,_0xd3565c,_0x1b35eb){var _0x4258ce=[_0x79ba('0x1f'),'cm_contacts.scheduledat',_0x79ba('0x20'),'cm_contacts.ListId',_0x535a48+'.'+_0xd3565c,_0x79ba('0x21'),'cm_contacts.updatedAt',_0x79ba('0x22'),'cm_contacts.UserId','\x22'+_0x1b35eb+'\x22'];return squel[_0x79ba('0x23')]()[_0x79ba('0x24')](_0x79ba('0x25'))[_0x79ba('0x26')]([_0x79ba('0x27'),_0x79ba('0x28'),_0x79ba('0x29'),_0x79ba('0x2a'),_0xd3565c,'createdAt','updatedAt',_0x79ba('0x2b'),_0x79ba('0x2c'),_0x79ba('0x2d')],squel[_0x79ba('0xd')]()[_0x79ba('0x2e')](_0x4258ce)[_0x79ba('0xe')](_0x535a48)[_0x79ba('0xf')](_0x79ba('0x2f'),null,_0x79ba('0x30')+_0x535a48+_0x79ba('0x31'))[_0x79ba('0xf')](_0x43376b,null,_0x43376b+_0x79ba('0x32')+_0x535a48+'.'+_0xd3565c)[_0x79ba('0x10')](_0x535a48+_0x79ba('0x33'),_0x52e146)[_0x79ba('0x10')](_0x79ba('0x34'),NOW)[_0x79ba('0x10')](_0x79ba('0x35'),selectNotIn(_0x535a48,_0x43376b,_0xd3565c,_0x79ba('0x25'),[_0x79ba('0x36'),_0x79ba('0x37')]))[_0x79ba('0x10')](_0x79ba('0x35'),selectNotIn(_0x535a48,_0x43376b,_0xd3565c,_0x79ba('0x25'),[_0x79ba('0x36')])))[_0x79ba('0x38')]();}function insertCmHopperBlack(_0x324249,_0x33273f,_0x20b905,_0x12ac9c){var _0x1b2bbd=[_0x79ba('0x1f'),_0x79ba('0x20'),_0x79ba('0x39'),_0x33273f+'.'+_0x12ac9c,'cm_contacts.createdAt',_0x79ba('0x3a')];return squel[_0x79ba('0x23')]()['into'](_0x79ba('0x3b'))['fromQuery']([_0x79ba('0x27'),'ContactId',_0x79ba('0x2a'),_0x12ac9c,_0x79ba('0x3c'),_0x79ba('0x3d')],squel[_0x79ba('0xd')]()['fields'](_0x1b2bbd)[_0x79ba('0xe')](_0x33273f)[_0x79ba('0xf')]('cm_contacts',null,_0x79ba('0x30')+_0x33273f+'.CmListId')[_0x79ba('0xf')](_0x20b905,null,_0x20b905+'.id\x20=\x20'+_0x33273f+'.'+_0x12ac9c)[_0x79ba('0x10')](_0x33273f+_0x79ba('0x33'),_0x324249)['where'](_0x79ba('0x34'),NOW)['where'](_0x79ba('0x35'),squel[_0x79ba('0xd')]()['field']('phone')['from'](_0x79ba('0x3b'))[_0x79ba('0x10')](_0x79ba('0x3e'),_0x324249)[_0x79ba('0x10')](_0x12ac9c+'\x20=\x20'+_0x33273f+'.'+_0x12ac9c)))[_0x79ba('0x38')]();}function insertTzCmHopper(_0x550c4a,_0x4be79c,_0x1aa03f,_0x4e6949,_0x19a1eb,_0x4c4104){var _0x49bcc3=[_0x79ba('0x1f'),_0x79ba('0x3f')+_0x4c4104+_0x79ba('0x40'),'cm_contacts.id',_0x79ba('0x39'),_0x4be79c+'.'+_0x4e6949,_0x79ba('0x21'),_0x79ba('0x3a'),_0x79ba('0x22'),_0x79ba('0x41'),'\x22'+_0x19a1eb+'\x22'];var _0x6d9a55=squel[_0x79ba('0x23')]()[_0x79ba('0x24')](_0x79ba('0x25'))[_0x79ba('0x26')]([_0x79ba('0x27'),_0x79ba('0x28'),_0x79ba('0x29'),_0x79ba('0x2a'),_0x4e6949,_0x79ba('0x3c'),_0x79ba('0x3d'),_0x79ba('0x2b'),_0x79ba('0x2c'),_0x79ba('0x2d')],squel[_0x79ba('0xd')]()[_0x79ba('0x2e')](_0x49bcc3)[_0x79ba('0xe')](_0x4be79c)['join'](_0x79ba('0x2f'),null,_0x79ba('0x30')+_0x4be79c+_0x79ba('0x31'))[_0x79ba('0xf')](_0x1aa03f,null,_0x1aa03f+_0x79ba('0x32')+_0x4be79c+'.'+_0x4e6949)['join'](_0x4c4104,null,_0x4c4104+_0x79ba('0x32')+_0x4be79c+'.'+_0x4e6949)[_0x79ba('0x10')](_0x4be79c+_0x79ba('0x33'),_0x550c4a)[_0x79ba('0x10')](_0x79ba('0x34'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4be79c,_0x1aa03f,_0x4e6949,_0x79ba('0x25'),[_0x79ba('0x36'),_0x79ba('0x37')]))['where'](_0x79ba('0x35'),selectNotIn(_0x4be79c,_0x1aa03f,_0x4e6949,_0x79ba('0x25'),[_0x79ba('0x36')])))[_0x79ba('0x38')]();return _0x6d9a55;}function insertTzCmHopperBlack(_0x3f570e,_0x30c25b,_0x1ac678,_0x1312c7){var _0xb74296=[_0x79ba('0x1f'),'cm_contacts.id','cm_contacts.ListId',_0x30c25b+'.'+_0x1312c7,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x79ba('0x23')]()[_0x79ba('0x24')](_0x79ba('0x3b'))[_0x79ba('0x26')]([_0x79ba('0x27'),_0x79ba('0x29'),_0x79ba('0x2a'),_0x1312c7,'createdAt',_0x79ba('0x3d')],squel['select']()['fields'](_0xb74296)[_0x79ba('0xe')](_0x30c25b)['join'](_0x79ba('0x2f'),null,'cm_contacts.ListId\x20=\x20'+_0x30c25b+_0x79ba('0x31'))[_0x79ba('0xf')](_0x1ac678,null,_0x1ac678+_0x79ba('0x32')+_0x30c25b+'.'+_0x1312c7)[_0x79ba('0x10')](_0x30c25b+_0x79ba('0x33'),_0x3f570e)[_0x79ba('0x10')](_0x79ba('0x34'),NOW)[_0x79ba('0x10')](_0x79ba('0x35'),squel[_0x79ba('0xd')]()[_0x79ba('0x42')](_0x79ba('0x27'))[_0x79ba('0xe')]('cm_hopper_black')[_0x79ba('0x10')]('ListId\x20=\x20?',_0x3f570e)[_0x79ba('0x10')](_0x1312c7+_0x79ba('0x43')+_0x30c25b+'.'+_0x1312c7)))[_0x79ba('0x38')]();}function insertCmHopperAdditionalPhones(_0x4efdeb){var _0x23f226=[_0x79ba('0x44'),_0x79ba('0x45'),_0x79ba('0x46'),'cm_contact_has_items.createdAt',_0x79ba('0x47')];return squel[_0x79ba('0x23')]()[_0x79ba('0x24')](_0x79ba('0x48'))['fromQuery'](['CmHopperId',_0x79ba('0x27'),_0x79ba('0x49'),_0x79ba('0x3c'),_0x79ba('0x3d')],squel[_0x79ba('0xd')]()[_0x79ba('0x2e')](_0x23f226)[_0x79ba('0xe')](_0x79ba('0x25'))[_0x79ba('0xf')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x79ba('0xf')](_0x79ba('0x4a'),null,_0x79ba('0x4b'))[_0x79ba('0x10')](_0x79ba('0x4c'),_0x4efdeb)[_0x79ba('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x79ba('0x38')]();}function insertCmContact(_0x27dd3f,_0x55a613,_0x56ac70,_0x491a8b){var _0x592f94=_['concat'](_[_0x79ba('0x4d')](_0x491a8b),[_0x79ba('0x2a'),_0x79ba('0x4e'),_0x79ba('0x3c'),'updatedAt',_0x79ba('0x4f')]);return squel[_0x79ba('0x23')]()[_0x79ba('0x24')](_0x79ba('0x2f'))[_0x79ba('0x26')](_0x592f94,squel[_0x79ba('0xd')]()[_0x79ba('0x2e')](_0x592f94)[_0x79ba('0xe')](_0x55a613)[_0x79ba('0x10')]('('+_0x56ac70[_0x79ba('0xf')](',')+_0x79ba('0x50'),squel[_0x79ba('0xd')]()[_0x79ba('0x2e')](_0x56ac70)['from'](_0x79ba('0x2f'))[_0x79ba('0x10')](_0x79ba('0x3e'),_0x27dd3f)[_0x79ba('0x10')](_0x79ba('0x51')))[_0x79ba('0x10')]('id\x20IN\x20?',squel[_0x79ba('0xd')]()[_0x79ba('0x42')](_0x79ba('0x52'),_0x79ba('0x53'))[_0x79ba('0xe')](_0x55a613)[_0x79ba('0x54')](_0x56ac70['join'](','))))[_0x79ba('0x38')]();}function handleStop(){logger[_0x79ba('0x55')](_0x79ba('0x56'));stopped=!![];}function handleUncaughtException(_0x12a985){logger[_0x79ba('0x57')](_0x12a985[_0x79ba('0x58')]);process[_0x79ba('0x59')](0x1);}function handleError(_0x2bd52d,_0x36e0db){stats[_0x79ba('0x5a')][_0x79ba('0x16')]({'name':_0x36e0db[_0x79ba('0x5b')],'message':_0x36e0db[_0x79ba('0x58')],'row':_0x2bd52d});}function handleQuery(_0x3bfc24){logger['info'](_0x3bfc24);return db[_0x79ba('0x5c')][_0x79ba('0x5d')](_0x3bfc24)[_0x79ba('0x5e')](function(_0x862ec8){results['push'](_0x862ec8);})[_0x79ba('0x5f')](function(_0x1f5885){logger[_0x79ba('0x57')](_0x1f5885[_0x79ba('0x58')]);});}function updateTzCampaigns(_0x503a0f){return new Promise(function(_0x581032,_0x1be28a){var _0x46a5e4=squel[_0x79ba('0xd')]()[_0x79ba('0x2e')]([_0x79ba('0x60'),_0x79ba('0x61')])['from'](_0x79ba('0x62'))[_0x79ba('0xf')]('campaigns_has_cm_lists',null,_0x79ba('0x63'))['where']('campaigns_has_cm_lists.CmListId='+_0x503a0f);db['sequelize']['query'](_0x46a5e4[_0x79ba('0x38')]())[_0x79ba('0x5e')](function(_0x3ddec8){var _0x2f05b5=[];for(var _0xc0bb61=0x0;_0xc0bb61<_0x3ddec8['length'];_0xc0bb61++){_0x2f05b5[_0x79ba('0x16')](getTimezoneData(_0x3ddec8[_0xc0bb61],tmp_campaigns));}BPromise[_0x79ba('0x17')](_0x2f05b5)[_0x79ba('0x15')](function(){_0x581032({'val':0x1});});})[_0x79ba('0x5f')](function(_0x558c1b){logger['error'](_0x558c1b['message']);_0x581032({'val':0x0});});});}function updateTzVoiceQueues(_0x353d1f){return new Promise(function(_0x3c3340,_0x40e5da){var _0x4c8bcc=squel[_0x79ba('0xd')]()[_0x79ba('0x2e')]([_0x79ba('0x64'),_0x79ba('0x65')])['from'](_0x79ba('0x66'))[_0x79ba('0xf')](_0x79ba('0x67'),null,_0x79ba('0x68'))[_0x79ba('0x10')](_0x79ba('0x69')+_0x353d1f);db['sequelize']['query'](_0x4c8bcc[_0x79ba('0x38')]())['spread'](function(_0xd59b2d){var _0x50ba07=[];for(var _0x4e34ea=0x0;_0x4e34ea<_0xd59b2d[_0x79ba('0x18')];_0x4e34ea++){_0x50ba07[_0x79ba('0x16')](getTimezoneData(_0xd59b2d[_0x4e34ea],tmp_voice_queues));}BPromise[_0x79ba('0x17')](_0x50ba07)['then'](function(){_0x3c3340({'val':0x1});});})[_0x79ba('0x5f')](function(_0x1ba864){logger[_0x79ba('0x57')](_0x1ba864[_0x79ba('0x58')]);_0x3c3340({'val':0x0});});});}function getTimezoneData(_0x4fc856,_0x2fc23b){return new Promise(function(_0x34c73c,_0x31f40c){var _0x58d028=shared[_0x79ba('0x6a')];var _0x450d09=_0x58d028[_0x4fc856[_0x79ba('0x6b')]];if(_[_0x79ba('0x6c')](_0x450d09)){_0x34c73c({'ret':0x1});}else{var _0x305193=_0x450d09[_0x79ba('0x6d')];var _0x489d10=squel[_0x79ba('0x23')]()[_0x79ba('0x24')](_0x2fc23b)[_0x79ba('0x6e')]('id',_0x4fc856['id'])[_0x79ba('0x6e')](_0x79ba('0x6f'),_0x305193)['set'](_0x79ba('0x6b'),_0x4fc856[_0x79ba('0x6b')])[_0x79ba('0x38')]();return db['sequelize'][_0x79ba('0x5d')](_0x489d10)[_0x79ba('0x5e')](function(_0xee9039){_0x34c73c({'ret':0x1});})[_0x79ba('0x5f')](function(_0x591c5e){logger[_0x79ba('0x57')](_0x591c5e[_0x79ba('0x58')]);_0x31f40c({'ret':0x1});});}});}function handleTZQuery(_0x324105){logger[_0x79ba('0x55')](_0x324105);return db[_0x79ba('0x5c')][_0x79ba('0x5d')](_0x324105)[_0x79ba('0x5e')](function(_0xfe1456){})[_0x79ba('0x5f')](function(_0x2454db){logger[_0x79ba('0x57')](_0x2454db[_0x79ba('0x58')]);});}function main(_0x4619ca,_0x880d0c,_0x5d04de,_0x38252c){logger['info']('main',_0x4619ca,JSON[_0x79ba('0x70')](_0x880d0c));process[_0x79ba('0x71')](_0x79ba('0x72'));var _0x2abdde=_0x880d0c[_0x79ba('0x73')];var _0x5c3825=_[_0x79ba('0x74')](_0x2abdde);var _0x1955bc=_0x880d0c[_0x79ba('0x75')];var _0x36d825=path[_0x79ba('0xf')](config[_0x79ba('0x76')],'server/files/tmp',_0x1955bc+_0x79ba('0x77'));hasTZ=_['keys'](_0x2abdde)[_0x79ba('0x78')]('dialTimezone');var _0x5b613f=_['keys'](_0x2abdde)['join']();logger[_0x79ba('0x55')]('header',_0x5b613f);db[_0x79ba('0x79')]['findAll']({'raw':!![],'attributes':['id',_0x79ba('0x7a')]})[_0x79ba('0x15')](function(_0x28eaf9){for(var _0x42ac5a=0x0;_0x42ac5a<_0x28eaf9['length'];_0x42ac5a++){if(_0x28eaf9[_0x42ac5a][_0x79ba('0x7a')]in _0x2abdde){contactItemTypes[_0x79ba('0x16')](_0x28eaf9[_0x42ac5a]);delete _0x5c3825[_0x28eaf9[_0x42ac5a][_0x79ba('0x7a')]];hasAdditionalPhones=!![];}for(var _0x516f43 in _0x2abdde){if(_0x28eaf9[_0x42ac5a][_0x79ba('0x7a')]+_0x79ba('0x7b')===_0x516f43){phoneDescriptions['push']({'itemTypeId':_0x28eaf9[_0x42ac5a]['id'],'description':_0x516f43});delete _0x5c3825[_0x516f43];}}}if(hasAdditionalPhones)_0x5c3825[_0x79ba('0x14')]='';var _0x3b24b0=_[_0x79ba('0x4d')](_0x5c3825)['join']();logger[_0x79ba('0x55')](_0x79ba('0x7c'),_0x3b24b0);fs[_0x79ba('0x7d')](_0x36d825,_0x3b24b0+'\x0a');Papa[_0x79ba('0x7e')](fs[_0x79ba('0x7f')](_0x4619ca),{'header':!![],'skipEmptyLines':!![],'step':function(_0x8681ca,_0x2fe13b){try{for(var _0x326bdf=0x0,_0x200c13=[];_0x326bdf<_0x8681ca[_0x79ba('0x80')][_0x79ba('0x18')];_0x326bdf++){stats[_0x79ba('0x81')]+=0x1;if(_0x8681ca['errors'][_0x326bdf]){handleError(_0x8681ca[_0x79ba('0x80')][_0x326bdf],_0x8681ca[_0x79ba('0x5a')][_0x326bdf]);}else{var _0x25e4bb=[];var _0x709775=[];var _0x2ebbdc={};for(var _0x59e679 in _0x2abdde){let _0x22ed47=contactItemTypes[_0x79ba('0x82')](_0x3a5948=>_0x3a5948[_0x79ba('0x7a')]===_0x59e679);let _0x545721=contactItemTypes[_0x79ba('0x82')](_0x50cdac=>_0x50cdac[_0x79ba('0x7a')]+'_description'===_0x59e679);if(_[_0x79ba('0x6c')](_0x22ed47)&&_['isNil'](_0x545721)){if(_0x2abdde[_0x79ba('0x83')](_0x59e679)){if(_0x8681ca[_0x79ba('0x80')][_0x326bdf][_0x2abdde[_0x59e679]]){var _0x245bf4=_[_0x79ba('0x84')](_0x8681ca['data'][_0x326bdf][_0x2abdde[_0x59e679]][_0x79ba('0x85')](/"/g,'\x27'));switch(_0x59e679){case _0x79ba('0x28'):var _0x212ac5=moment(_0x245bf4,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x212ac5[_0x79ba('0x86')]()){_0x200c13['push']('\x22'+_0x245bf4+'\x22');}else{_0x25e4bb['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x79ba('0x2b'):var _0x545ebf=parseInt(_0x245bf4);_0x245bf4=_[_0x79ba('0x87')](_0x545ebf)||_0x545ebf<0x0||_0x545ebf>0x4?_0x38252c?0x3:0x2:_0x545ebf;_0x200c13[_0x79ba('0x16')]('\x22'+_0x245bf4+'\x22');break;case'UserId':var _0xabb1c3=parseInt(_0x245bf4);if(_[_0x79ba('0x88')](_0xabb1c3)&&_['includes'](_0x5d04de,_0xabb1c3)){_0x200c13[_0x79ba('0x16')]('\x22'+_0xabb1c3+'\x22');}else{_0x25e4bb[_0x79ba('0x16')](_0x79ba('0x89'));}break;case'email':if(isEmail(_0x245bf4)){_0x200c13[_0x79ba('0x16')]('\x22'+_0x245bf4+'\x22');}else{_0x25e4bb[_0x79ba('0x16')]('email\x20wrong\x20format');}break;case _0x79ba('0x8a'):var _0x23afe3=moment(_0x245bf4,_0x79ba('0x8b'),!![]);if(_0x23afe3[_0x79ba('0x86')]()){_0x200c13[_0x79ba('0x16')]('\x22'+_0x245bf4+'\x22');}else{_0x25e4bb[_0x79ba('0x16')](_0x79ba('0x8c'));}break;case _0x79ba('0x6b'):var _0x20fb6b=shared[_0x79ba('0x6a')];var _0x19fec9=_0x20fb6b[_0x245bf4];if(!_[_0x79ba('0x6c')](_0x19fec9)){var _0x7ec4da=_0x19fec9[_0x79ba('0x6d')];_0x200c13['push']('\x22'+_0x245bf4+'\x22');_0x200c13[_0x79ba('0x16')]('\x22'+_0x7ec4da+'\x22');}break;default:_0x200c13[_0x79ba('0x16')]('\x22'+_0x245bf4+'\x22');}}else{switch(_0x59e679){case _0x79ba('0x8d'):case'phone':_0x25e4bb[_0x79ba('0x16')](_0x59e679+_0x79ba('0x8e'));break;default:_0x200c13[_0x79ba('0x16')]('\x22\x22');}}}}else{var _0x40811c='';if(!_['isNil'](_0x22ed47)){if(!_0x2ebbdc['hasOwnProperty'](_0x22ed47['id'])){if(!_[_0x79ba('0x6c')](_0x8681ca[_0x79ba('0x80')][_0x326bdf][_0x2abdde[_0x59e679]])){var _0x245bf4=_[_0x79ba('0x84')](_0x8681ca['data'][_0x326bdf][_0x2abdde[_0x59e679]][_0x79ba('0x85')](/"/g,'\x27'));var _0x58ae8f=phoneDescriptions[_0x79ba('0x82')](_0x13f55b=>_0x13f55b[_0x79ba('0x8f')]===_0x22ed47['id']);if(!_['isNil'](_0x58ae8f)){var _0x5ca875=_['trim'](_0x8681ca[_0x79ba('0x80')][_0x326bdf][_0x2abdde[_0x58ae8f[_0x79ba('0x90')]]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x5ca875))_0x245bf4=_0x245bf4+'§'+_0x5ca875;}if(_0x40811c=='')_0x40811c=_0x245bf4;else _0x40811c+='|'+_0x245bf4;}_0x709775['push'](_0x22ed47['id']+':'+_0x40811c);_0x2ebbdc[_0x22ed47['id']]=0x1;}}}}if(hasAdditionalPhones){_0x200c13['push']('\x22'+_0x709775[_0x79ba('0xf')](';')+'\x22');}if(_0x25e4bb[_0x79ba('0x18')]){handleError(_0x8681ca['data'][_0x326bdf],{'code':_0x79ba('0x91'),'message':_0x25e4bb[_0x79ba('0xf')]()});}else{fs[_0x79ba('0x92')](_0x36d825,_0x200c13[_0x79ba('0xf')]()+'\x0a');}_0x200c13=[];}if(!(stats['rows']%0xc8)){socket[_0x79ba('0x93')]('contact:import:'+_0x1955bc,stats);stats[_0x79ba('0x5a')]=[];}}if(stopped){logger[_0x79ba('0x55')](_0x79ba('0x94'));_0x2fe13b[_0x79ba('0x95')]();}}catch(_0xbc8aba){handleError(_0x8681ca['data'][_0x326bdf],{'code':'SystemError','message':_0xbc8aba[_0x79ba('0x58')]});logger['error'](_0x79ba('0x96'),_0xbc8aba[_0x79ba('0x58')]);}},'complete':function(){try{var _0x12ecf1=[];var _0x1359ae=[];var _0x114bbb=_0x79ba('0x2f');if(_0x880d0c[_0x79ba('0x97')]&&_0x880d0c[_0x79ba('0x97')][_0x79ba('0x18')]){_0x114bbb=_0x79ba('0x98')+_0x1955bc;_0x12ecf1[_0x79ba('0x16')]('CREATE\x20TABLE\x20'+_0x114bbb+_0x79ba('0x99'));}tmp_campaigns=_0x79ba('0x9a')+_0x1955bc;tmp_voice_queues=_0x79ba('0x9b')+_0x1955bc;_0x1359ae[_0x79ba('0x16')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x79ba('0x9c'));_0x1359ae[_0x79ba('0x16')](_0x79ba('0x9d')+tmp_voice_queues+_0x79ba('0x9c'));BPromise[_0x79ba('0x9e')](_0x1359ae,handleTZQuery)[_0x79ba('0x15')](function(_0x4ec198){updateTzCampaigns(_0x880d0c[_0x79ba('0x2a')])['then'](function(_0x2ffebe){updateTzVoiceQueues(_0x880d0c[_0x79ba('0x2a')])[_0x79ba('0x15')](function(_0x3dbecc){if(hasTZ)_0x3b24b0=_0x3b24b0[_0x79ba('0x85')]('dialTimezone','dialTimezone,utcOffset');var _0x4a1c36=util[_0x79ba('0xb')](_0x79ba('0x9f'),_0x36d825,_0x114bbb,_0x3b24b0,_0x880d0c[_0x79ba('0x2a')],_0x880d0c['CompanyId']||null,NOW,NOW);if(_[_0x79ba('0x6c')](_0x2abdde[_0x79ba('0x28')])){_0x4a1c36+=_0x79ba('0xa0');}_0x12ecf1[_0x79ba('0x16')](_0x4a1c36);if(_0x880d0c['duplicates']&&_0x880d0c[_0x79ba('0x97')][_0x79ba('0x18')]){_0x12ecf1[_0x79ba('0x16')](insertCmContact(_0x880d0c[_0x79ba('0x2a')],_0x114bbb,_0x880d0c[_0x79ba('0x97')],_0x2abdde));_0x12ecf1[_0x79ba('0x16')](_0x79ba('0xa1')+_0x114bbb+';');}BPromise['each'](_0x12ecf1,handleQuery)['then'](function(_0x1e00c9){BPromise[_0x79ba('0x17')]([handleAdditionalPhones()])[_0x79ba('0x15')](function(){_0x12ecf1=[];for(var _0x48c55e=0x0;_0x48c55e\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','.id\x20=\x20','\x20=\x20','join','sequelize','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','then','error','length','split','filter','CmContactHasItem','findOne','update','updated','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','cm_hopper','scheduledat','ContactId','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.id','ListId','createdAt','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','into','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','fromQuery',')\x20NOT\x20IN\x20?','id\x20IN\x20?','group','info','Received\x20SIGINT','message','exit','catch','main','stringify','start','binding','clone','root','server/files/tmp','body','ContactItemType','findAll','name','_description','header','parse','createReadStream','data','errors','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','contactId','orderBy'];(function(_0x1e502f,_0x42063c){var _0x573fb4=function(_0x54d410){while(--_0x54d410){_0x1e502f['push'](_0x1e502f['shift']());}};_0x573fb4(++_0x42063c);}(_0x4910,0x1d9));var _0x0491=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4910[_0x2c91e9];return _0x13f0ff;};'use strict';var fs=require('fs');var path=require(_0x0491('0x0'));var _=require(_0x0491('0x1'));var Papa=require(_0x0491('0x2'));var util=require('util');var BPromise=require(_0x0491('0x3'));var moment=require(_0x0491('0x4'));var squel=require(_0x0491('0x5'));var Redis=require(_0x0491('0x6'));var db=require(_0x0491('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0x0491('0x8'))(_0x0491('0x9'));config[_0x0491('0xa')]=_[_0x0491('0xb')](config[_0x0491('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0491('0xc'))(new Redis(config[_0x0491('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x0491('0xd')](_0x0491('0xe'));var tempTableName=_0x0491('0xf')+moment()['format'](_0x0491('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x51bd65){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))*$/[_0x0491('0x11')](_0x51bd65);}function selectNotIn(_0x1b57a1,_0x3ff9c6,_0x108308,_0x3b8318,_0x12ab48){return squel[_0x0491('0x12')]()[_0x0491('0x13')](_0x0491('0x14'))[_0x0491('0x15')](_0x3b8318)['join'](_0x3ff9c6,null,_0x3ff9c6+_0x0491('0x16')+_0x3b8318+'.'+_0x108308)['where'](_0x3b8318+'.'+_0x108308+_0x0491('0x17')+_0x1b57a1+'.'+_0x108308)['where'](_0x3ff9c6+'.dialCheckDuplicateType\x20IN\x20('+_0x12ab48[_0x0491('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x7ba36,_0x439f5c){promisesAdditionalPhones=[];promisesContact=[];return db[_0x0491('0x19')][_0x0491('0x1a')](_0x0491('0x1b')+tempTableName)[_0x0491('0x1c')](function(_0xbd94bd){if(_0xbd94bd!==null){var _0xf12423=[];for(var _0x1411a6=0x0;_0x1411a6<_0xbd94bd['length'];_0x1411a6++){var _0x410548=_0xbd94bd[_0x1411a6];if(!_[_0x0491('0x1d')](_0x410548[_0x0491('0x14')])){if(!_[_0x0491('0x1d')](_0x410548[_0x0491('0x1e')]))_0xf12423[_0x0491('0x1f')](insertAdditionalPhones(_0x410548));promisesContact['push']({'contact':_0x410548});}}}Promise[_0x0491('0x20')](_0xf12423)[_0x0491('0x21')](function(){_0x7ba36({'val':0x1});});})['catch'](function(_0x54be7f){logger[_0x0491('0x22')](_0x54be7f['message']);});});}function insertAdditionalPhones(_0x6f8139){return new Promise(function(_0x431782,_0x55dcb3){var _0x6141b9=_0x6f8139[_0x0491('0x1e')];if(_[_0x0491('0x1d')](_0x6141b9))_0x55dcb3({'val':0x0});else{var _0x291d40=_0x6141b9['split'](';');var _0x23146d=[];orderBy=0x0;for(var _0x358117=0x0;_0x358117<_0x291d40[_0x0491('0x23')];_0x358117++){_0x23146d['push'](splitAdditionalPhone(_0x6f8139['id'],_0x291d40[_0x358117]));}Promise[_0x0491('0x20')](_0x23146d)[_0x0491('0x21')](function(){_0x431782({'val':_0x291d40[_0x0491('0x23')]});});}});}function splitAdditionalPhone(_0x1934a0,_0x30ad41){return new Promise(function(_0xdda718,_0x207ff9){var _0x4ab232=_0x30ad41[_0x0491('0x24')](':');var _0x4a39f0=_0x4ab232[0x0];var _0xc0c021=_0x4ab232[0x1];if(_0xc0c021!==''){var _0x93bc14=_0xc0c021[_0x0491('0x24')]('|');var _0x54571a=[];for(var _0x12ebdb=0x0;_0x12ebdb<_0x93bc14[_0x0491('0x23')];_0x12ebdb++){if(_0x93bc14[_0x12ebdb]!==''){var _0x59beec=_[_0x0491('0x25')](promisesAdditionalPhones,{'contactId':_0x1934a0,'phone':_0x93bc14[_0x12ebdb]});if(_0x59beec[_0x0491('0x23')]==0x0){orderBy++;promisesAdditionalPhones[_0x0491('0x1f')]({'contactId':_0x1934a0,'contactTypeId':_0x4a39f0,'phone':_0x93bc14[_0x12ebdb],'orderBy':orderBy});}}}_0xdda718({'ok':0x1});}else _0xdda718({'res':0x0});});}function createAdditionalPhone(_0x2c3f39,_0x3ec059,_0x38b4b8,_0x15b80d){var _0x5c9ee2='';var _0x4fbeb8='';var _0x5daa56=_0x38b4b8['split']('§');_0x5c9ee2=_0x5daa56[0x0];if(_0x5daa56[_0x0491('0x23')]==0x2)_0x4fbeb8=_0x5daa56[0x1];return new Promise(function(_0x53f923,_0x46d432){return db[_0x0491('0x26')][_0x0491('0x27')]({'where':{'CmContactId':_0x2c3f39,'item':_0x5c9ee2}})[_0x0491('0x21')](function(_0x2e3223){if(_0x2e3223){return db[_0x0491('0x26')][_0x0491('0x28')]({'ItemTypeId':_0x3ec059,'description':_0x4fbeb8,'OrderBy':_0x15b80d},{'where':{'CmContactId':_0x2c3f39,'item':_0x5c9ee2}})['then'](function(_0x712f33){_0x53f923({'res':_0x0491('0x29')});});}else{return db[_0x0491('0x26')][_0x0491('0x2a')]({'CmContactId':_0x2c3f39,'item':_0x5c9ee2,'ItemTypeId':_0x3ec059,'description':_0x4fbeb8,'OrderBy':_0x15b80d,'ItemClass':'PHONE'})['then'](function(_0x58a20b){_0x53f923({'res':_0x0491('0x2b')});});}});});}function updateContact(_0x5ebccf){return new Promise(function(_0x2ad8b2,_0x434c1c){var _0x20d728=_0x5ebccf['id'];delete _0x5ebccf['id'];return db[_0x0491('0x2c')][_0x0491('0x28')](_0x5ebccf,{'where':{'id':_0x20d728}})[_0x0491('0x21')](function(_0x17b4ee){updatedRows+=0x1;return db[_0x0491('0x2d')]['update']({'phone':_0x5ebccf[_0x0491('0x14')]},{'where':{'ContactId':_0x20d728}})['then'](function(_0x1f24e9){_0x2ad8b2({'ret':'OK'});});});});}function insertCmHopper(_0x16ef85,_0x4bbffc,_0x20e036,_0x5a946c,_0x1d7460){var _0x2a6425=[_0x0491('0x2e'),_0x0491('0x2f'),'cm_contacts.id','cm_contacts.ListId',_0x4bbffc+'.'+_0x5a946c,_0x0491('0x30'),_0x0491('0x31'),_0x0491('0x32'),'cm_contacts.UserId','\x22'+_0x1d7460+'\x22'];return squel[_0x0491('0x33')]()['into'](_0x0491('0x34'))['fromQuery']([_0x0491('0x14'),_0x0491('0x35'),_0x0491('0x36'),'ListId',_0x5a946c,'createdAt',_0x0491('0x37'),_0x0491('0x38'),_0x0491('0x39'),'recallme'],squel['select']()[_0x0491('0x3a')](_0x2a6425)[_0x0491('0x15')](_0x4bbffc)[_0x0491('0x18')](_0x0491('0x3b'),null,_0x0491('0x3c')+_0x4bbffc+_0x0491('0x3d'))[_0x0491('0x18')](_0x20e036,null,_0x20e036+'.id\x20=\x20'+_0x4bbffc+'.'+_0x5a946c)[_0x0491('0x3e')](_0x4bbffc+_0x0491('0x3f'),_0x16ef85)['where'](_0x0491('0x40'),NOW)[_0x0491('0x3e')](_0x0491('0x41'),selectNotIn(_0x4bbffc,_0x20e036,_0x5a946c,_0x0491('0x34'),[_0x0491('0x42'),'\x22onlyIfOpen\x22']))[_0x0491('0x3e')](_0x0491('0x41'),selectNotIn(_0x4bbffc,_0x20e036,_0x5a946c,_0x0491('0x34'),[_0x0491('0x42')])))[_0x0491('0x43')]();}function insertCmHopperBlack(_0x6ef0a0,_0x49cf9,_0x1b6571,_0x20ead0){var _0x20adae=[_0x0491('0x2e'),_0x0491('0x44'),'cm_contacts.ListId',_0x49cf9+'.'+_0x20ead0,'cm_contacts.createdAt',_0x0491('0x31')];return squel['insert']()['into']('cm_hopper_black')['fromQuery']([_0x0491('0x14'),'ContactId',_0x0491('0x45'),_0x20ead0,_0x0491('0x46'),_0x0491('0x37')],squel['select']()[_0x0491('0x3a')](_0x20adae)['from'](_0x49cf9)[_0x0491('0x18')]('cm_contacts',null,_0x0491('0x3c')+_0x49cf9+_0x0491('0x3d'))[_0x0491('0x18')](_0x1b6571,null,_0x1b6571+_0x0491('0x16')+_0x49cf9+'.'+_0x20ead0)[_0x0491('0x3e')](_0x49cf9+_0x0491('0x3f'),_0x6ef0a0)[_0x0491('0x3e')](_0x0491('0x40'),NOW)[_0x0491('0x3e')](_0x0491('0x41'),squel[_0x0491('0x12')]()[_0x0491('0x13')](_0x0491('0x14'))['from'](_0x0491('0x47'))[_0x0491('0x3e')](_0x0491('0x48'),_0x6ef0a0)[_0x0491('0x3e')](_0x20ead0+_0x0491('0x49'),_0x49cf9+'.'+_0x20ead0)))[_0x0491('0x43')]();}function insertCmHopperAdditionalPhones(_0x48d193){var _0xdc7140=[_0x0491('0x4a'),_0x0491('0x4b'),_0x0491('0x4c'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x0491('0x33')]()[_0x0491('0x4d')](_0x0491('0x4e'))['fromQuery']([_0x0491('0x4f'),'phone',_0x0491('0x50'),'createdAt',_0x0491('0x37')],squel[_0x0491('0x12')]()[_0x0491('0x3a')](_0xdc7140)[_0x0491('0x15')](_0x0491('0x34'))['join'](_0x0491('0x3b'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join'](_0x0491('0x51'),null,_0x0491('0x52'))[_0x0491('0x3e')](_0x0491('0x53'),_0x48d193)[_0x0491('0x3e')](_0x0491('0x40'),NOW))[_0x0491('0x43')]();}function insertCmContact(_0x3add97,_0x47fe72,_0xec5404,_0x31791c){var _0x276c4e=_[_0x0491('0x54')](_[_0x0491('0x55')](_0x31791c),['ListId',_0x0491('0x56'),_0x0491('0x46'),_0x0491('0x37')]);return squel[_0x0491('0x33')]()[_0x0491('0x4d')](_0x0491('0x3b'))[_0x0491('0x57')](_0x276c4e,squel[_0x0491('0x12')]()['fields'](_0x276c4e)[_0x0491('0x15')](_0x47fe72)[_0x0491('0x3e')]('('+_0xec5404[_0x0491('0x18')](',')+_0x0491('0x58'),squel[_0x0491('0x12')]()[_0x0491('0x3a')](_0xec5404)[_0x0491('0x15')](_0x0491('0x3b'))[_0x0491('0x3e')]('ListId\x20=\x20?',_0x3add97))[_0x0491('0x3e')](_0x0491('0x59'),squel[_0x0491('0x12')]()[_0x0491('0x13')]('MIN(id)','min_id')['from'](_0x47fe72)[_0x0491('0x5a')](_0xec5404[_0x0491('0x18')](','))))['toString']();}function handleStop(){logger[_0x0491('0x5b')](_0x0491('0x5c'));stopped=!![];}function handleUncaughtException(_0x4bb695){logger[_0x0491('0x22')](_0x4bb695[_0x0491('0x5d')]);process[_0x0491('0x5e')](0x1);}function handleError(_0x12dc2c,_0x1af724){stats['errors'][_0x0491('0x1f')]({'name':_0x1af724['code'],'message':_0x1af724['message'],'row':_0x12dc2c});}function handleQuery(_0x2ca08b){logger[_0x0491('0x5b')](_0x2ca08b);return db[_0x0491('0x19')]['query'](_0x2ca08b)[_0x0491('0x1c')](function(_0x185a20){results['push'](_0x185a20);})[_0x0491('0x5f')](function(_0x4c97b){logger[_0x0491('0x22')](_0x4c97b[_0x0491('0x5d')]);});}function main(_0x27e04c,_0x4c12e0,_0x41da4a,_0x4a93a5){logger['info'](_0x0491('0x60'),_0x27e04c,JSON[_0x0491('0x61')](_0x4c12e0));process['send'](_0x0491('0x62'));var _0x19b2da=_0x4c12e0[_0x0491('0x63')];var _0x3f41b1=_[_0x0491('0x64')](_0x19b2da);var _0x430e37=_0x4c12e0['socket_timestamp'];var _0x2c41ec=path[_0x0491('0x18')](config[_0x0491('0x65')],_0x0491('0x66'),_0x430e37+'.csv');logger[_0x0491('0x5b')](_0x0491('0x67'),_0x4c12e0);db[_0x0491('0x68')][_0x0491('0x69')]({'raw':!![],'attributes':['id','name']})[_0x0491('0x21')](function(_0x442a97){for(var _0x2652d9=0x0;_0x2652d9<_0x442a97[_0x0491('0x23')];_0x2652d9++){if(_0x442a97[_0x2652d9][_0x0491('0x6a')]in _0x19b2da){contactItemTypes['push'](_0x442a97[_0x2652d9]);delete _0x3f41b1[_0x442a97[_0x2652d9]['name']];hasAdditionalPhones=!![];}for(var _0x526798 in _0x19b2da){if(_0x442a97[_0x2652d9][_0x0491('0x6a')]+_0x0491('0x6b')===_0x526798){phoneDescriptions[_0x0491('0x1f')]({'itemTypeId':_0x442a97[_0x2652d9]['id'],'description':_0x526798});delete _0x3f41b1[_0x526798];}}}if(hasAdditionalPhones)_0x3f41b1[_0x0491('0x1e')]='';var _0x4236e5=_[_0x0491('0x55')](_0x3f41b1)[_0x0491('0x18')]();logger['info'](_0x0491('0x6c'),_0x4236e5);fs['writeFileSync'](_0x2c41ec,_0x4236e5+'\x0a');Papa[_0x0491('0x6d')](fs[_0x0491('0x6e')](_0x27e04c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x6f2731,_0xe4af61){try{for(var _0x35d4c0=0x0,_0x537256=[];_0x35d4c0<_0x6f2731[_0x0491('0x6f')][_0x0491('0x23')];_0x35d4c0++){stats['rows']+=0x1;if(_0x6f2731['errors'][_0x35d4c0]){handleError(_0x6f2731[_0x0491('0x6f')][_0x35d4c0],_0x6f2731[_0x0491('0x70')][_0x35d4c0]);}else{var _0x544d84=[];var _0x1cf948=[];var _0x55b92f={};for(var _0x395c23 in _0x19b2da){let _0x275224=contactItemTypes[_0x0491('0x71')](_0xd5aed4=>_0xd5aed4[_0x0491('0x6a')]===_0x395c23);let _0x50067b=contactItemTypes[_0x0491('0x71')](_0xe7f058=>_0xe7f058[_0x0491('0x6a')]+_0x0491('0x6b')===_0x395c23);if(_[_0x0491('0x1d')](_0x275224)&&_[_0x0491('0x1d')](_0x50067b)){if(_0x19b2da[_0x0491('0x72')](_0x395c23)){if(_0x6f2731[_0x0491('0x6f')][_0x35d4c0][_0x19b2da[_0x395c23]]){var _0x5afb42=_[_0x0491('0x73')](_0x6f2731[_0x0491('0x6f')][_0x35d4c0][_0x19b2da[_0x395c23]][_0x0491('0x74')](/"/g,'\x27'));switch(_0x395c23){case'scheduledat':var _0x3e0903=moment(_0x5afb42,_0x0491('0xe'),!![]);if(_0x3e0903[_0x0491('0x75')]()){_0x537256[_0x0491('0x1f')]('\x22'+_0x5afb42+'\x22');}else{_0x544d84[_0x0491('0x1f')](_0x0491('0x76'));}break;case _0x0491('0x38'):var _0x2aa4b3=parseInt(_0x5afb42);_0x5afb42=_[_0x0491('0x77')](_0x2aa4b3)||_0x2aa4b3<0x0||_0x2aa4b3>0x4?_0x4a93a5?0x3:0x2:_0x2aa4b3;_0x537256['push']('\x22'+_0x5afb42+'\x22');break;case _0x0491('0x39'):var _0x24899e=parseInt(_0x5afb42);if(_[_0x0491('0x78')](_0x24899e)&&_[_0x0491('0x79')](_0x41da4a,_0x24899e)){_0x537256[_0x0491('0x1f')]('\x22'+_0x24899e+'\x22');}else{_0x544d84[_0x0491('0x1f')](_0x0491('0x7a'));}break;case'email':if(isEmail(_0x5afb42)){_0x537256[_0x0491('0x1f')]('\x22'+_0x5afb42+'\x22');}else{_0x544d84[_0x0491('0x1f')](_0x0491('0x7b'));}break;case _0x0491('0x7c'):var _0x56d062=moment(_0x5afb42,_0x0491('0x7d'),!![]);if(_0x56d062[_0x0491('0x75')]()){_0x537256[_0x0491('0x1f')]('\x22'+_0x5afb42+'\x22');}else{_0x544d84['push'](_0x0491('0x7e'));}break;default:_0x537256['push']('\x22'+_0x5afb42+'\x22');}}else{switch(_0x395c23){case _0x0491('0x7f'):case _0x0491('0x14'):_0x544d84[_0x0491('0x1f')](_0x395c23+_0x0491('0x80'));break;default:_0x537256[_0x0491('0x1f')]('\x22\x22');}}}}else{var _0x4f8c61='';if(!_['isNil'](_0x275224)){if(!_0x55b92f['hasOwnProperty'](_0x275224['id'])){for(var _0x499671=0x0;_0x499671<_0x19b2da[_0x395c23][_0x0491('0x23')];_0x499671++){var _0x5afb42=_[_0x0491('0x73')](_0x6f2731['data'][_0x35d4c0][_0x19b2da[_0x395c23][_0x499671]][_0x0491('0x74')](/"/g,'\x27'));var _0x562ae9=phoneDescriptions[_0x0491('0x71')](_0x52feb7=>_0x52feb7[_0x0491('0x81')]===_0x275224['id']);if(!_[_0x0491('0x1d')](_0x562ae9)){var _0x21d22b=_[_0x0491('0x73')](_0x6f2731['data'][_0x35d4c0][_0x19b2da[_0x562ae9[_0x0491('0x82')]][0x0]][_0x0491('0x74')](/"/g,'\x27'));if(!_[_0x0491('0x1d')](_0x21d22b))_0x5afb42=_0x5afb42+'§'+_0x21d22b;}if(_0x4f8c61=='')_0x4f8c61=_0x5afb42;else _0x4f8c61+='|'+_0x5afb42;}_0x1cf948['push'](_0x275224['id']+':'+_0x4f8c61);_0x55b92f[_0x275224['id']]=0x1;}}}}if(hasAdditionalPhones){_0x537256[_0x0491('0x1f')]('\x22'+_0x1cf948[_0x0491('0x18')](';')+'\x22');}if(_0x544d84[_0x0491('0x23')]){handleError(_0x6f2731[_0x0491('0x6f')][_0x35d4c0],{'code':_0x0491('0x83'),'message':_0x544d84['join']()});}else{fs[_0x0491('0x84')](_0x2c41ec,_0x537256['join']()+'\x0a');}_0x537256=[];}if(!(stats[_0x0491('0x85')]%0xc8)){socket[_0x0491('0x86')](_0x0491('0x87')+_0x430e37,stats);stats['errors']=[];}}if(stopped){logger[_0x0491('0x5b')](_0x0491('0x88'));_0xe4af61[_0x0491('0x89')]();}}catch(_0x45acfb){handleError(_0x6f2731[_0x0491('0x6f')][_0x35d4c0],{'code':_0x0491('0x8a'),'message':_0x45acfb[_0x0491('0x5d')]});logger[_0x0491('0x22')]('step',_0x45acfb[_0x0491('0x5d')]);}},'complete':function(){try{var _0x393832=[];var _0x53a88b=tempTableName;_0x393832[_0x0491('0x1f')]('CREATE\x20TABLE\x20'+_0x53a88b+'\x20LIKE\x20cm_contacts;');logger['info'](_0x0491('0x8b'),contactItemTypes[_0x0491('0x23')]);var _0x3b07c2=util[_0x0491('0xd')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x2c41ec,_0x53a88b,_0x4236e5,_0x4c12e0['ListId'],_0x4c12e0[_0x0491('0x56')]||null,NOW,NOW);if(_[_0x0491('0x1d')](_0x19b2da[_0x0491('0x35')])){_0x3b07c2+=_0x0491('0x8c');}_0x393832[_0x0491('0x1f')](_0x3b07c2);BPromise['each'](_0x393832,handleQuery)[_0x0491('0x21')](function(_0xf52e3b){BPromise[_0x0491('0x20')]([handleAdditionalPhones()])[_0x0491('0x21')](function(){_0x393832=[];for(var _0x52ea4d=0x0;_0x52ea4d_0x3c2088[_0x3c49('0x68')]===_0x4dceb7);let _0x1ada5c=contactItemTypes['find'](_0x19d5ac=>_0x19d5ac[_0x3c49('0x68')]+_0x3c49('0x69')===_0x4dceb7);if(_['isNil'](_0xa2511d)&&_[_0x3c49('0x1c')](_0x1ada5c)){if(_0x4864ee[_0x3c49('0x6e')](_0x4dceb7)){if(_0x53fe71[_0x3c49('0x6c')][_0x38e9b7][_0x4864ee[_0x4dceb7]]){var _0x525f72=_['trim'](_0x53fe71[_0x3c49('0x6c')][_0x38e9b7][_0x4864ee[_0x4dceb7]][_0x3c49('0x6f')](/"/g,'\x27'));switch(_0x4dceb7){case _0x3c49('0x70'):var _0x8c2f86=moment(_0x525f72,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x8c2f86[_0x3c49('0x71')]()){_0x6d1f29[_0x3c49('0x1e')]('\x22'+_0x525f72+'\x22');}else{_0x7dcde6[_0x3c49('0x1e')](_0x3c49('0x72'));}break;case _0x3c49('0x38'):var _0x7552cc=parseInt(_0x525f72);_0x525f72=_[_0x3c49('0x73')](_0x7552cc)||_0x7552cc<0x0||_0x7552cc>0x4?_0x50658e?0x3:0x2:_0x7552cc;_0x6d1f29[_0x3c49('0x1e')]('\x22'+_0x525f72+'\x22');break;case _0x3c49('0x39'):var _0x1f9d8f=parseInt(_0x525f72);if(_[_0x3c49('0x74')](_0x1f9d8f)&&_['includes'](_0x56cafd,_0x1f9d8f)){_0x6d1f29['push']('\x22'+_0x1f9d8f+'\x22');}else{_0x7dcde6[_0x3c49('0x1e')]('agent\x20not\x20exists');}break;case _0x3c49('0x75'):if(isEmail(_0x525f72)){_0x6d1f29['push']('\x22'+_0x525f72+'\x22');}else{_0x7dcde6[_0x3c49('0x1e')]('email\x20wrong\x20format');}break;case _0x3c49('0x76'):var _0x2187f7=moment(_0x525f72,_0x3c49('0x77'),!![]);if(_0x2187f7[_0x3c49('0x71')]()){_0x6d1f29[_0x3c49('0x1e')]('\x22'+_0x525f72+'\x22');}else{_0x7dcde6[_0x3c49('0x1e')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x6d1f29[_0x3c49('0x1e')]('\x22'+_0x525f72+'\x22');}}else{switch(_0x4dceb7){case'firstName':case _0x3c49('0x1b'):_0x7dcde6[_0x3c49('0x1e')](_0x4dceb7+_0x3c49('0x78'));break;default:_0x6d1f29[_0x3c49('0x1e')]('\x22\x22');}}}}else{var _0x34a1b7='';if(!_[_0x3c49('0x1c')](_0xa2511d)){if(!_0x1f5094[_0x3c49('0x6e')](_0xa2511d['id'])){for(var _0x43b4f9=0x0;_0x43b4f9<_0x4864ee[_0x4dceb7][_0x3c49('0x1a')];_0x43b4f9++){var _0x525f72=_[_0x3c49('0x79')](_0x53fe71[_0x3c49('0x6c')][_0x38e9b7][_0x4864ee[_0x4dceb7][_0x43b4f9]]['replace'](/"/g,'\x27'));var _0xe67823=phoneDescriptions[_0x3c49('0x6d')](_0x3d3460=>_0x3d3460[_0x3c49('0x7a')]===_0xa2511d['id']);if(!_[_0x3c49('0x1c')](_0xe67823)){var _0x4cd842=_['trim'](_0x53fe71[_0x3c49('0x6c')][_0x38e9b7][_0x4864ee[_0xe67823[_0x3c49('0x7b')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x3c49('0x1c')](_0x4cd842))_0x525f72=_0x525f72+'§'+_0x4cd842;}if(_0x34a1b7=='')_0x34a1b7=_0x525f72;else _0x34a1b7+='|'+_0x525f72;}_0x212c3a[_0x3c49('0x1e')](_0xa2511d['id']+':'+_0x34a1b7);_0x1f5094[_0xa2511d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x6d1f29['push']('\x22'+_0x212c3a[_0x3c49('0x3c')](';')+'\x22');}if(_0x7dcde6['length']){handleError(_0x53fe71[_0x3c49('0x6c')][_0x38e9b7],{'code':_0x3c49('0x7c'),'message':_0x7dcde6[_0x3c49('0x3c')]()});}else{fs[_0x3c49('0x7d')](_0x4ce107,_0x6d1f29[_0x3c49('0x3c')]()+'\x0a');}_0x6d1f29=[];}if(!(stats[_0x3c49('0x7e')]%0xc8)){socket[_0x3c49('0x7f')](_0x3c49('0x80')+_0x2b472b,stats);stats[_0x3c49('0x5e')]=[];}}if(stopped){logger[_0x3c49('0x5b')](_0x3c49('0x81'));_0x49e4fa[_0x3c49('0x82')]();}}catch(_0x2acff4){handleError(_0x53fe71[_0x3c49('0x6c')][_0x38e9b7],{'code':_0x3c49('0x83'),'message':_0x2acff4[_0x3c49('0x21')]});logger['error'](_0x3c49('0x84'),_0x2acff4[_0x3c49('0x21')]);}},'complete':function(){try{var _0x217afb=[];var _0x2ac535=tempTableName;_0x217afb[_0x3c49('0x1e')](_0x3c49('0x85')+_0x2ac535+_0x3c49('0x86'));logger[_0x3c49('0x5b')](_0x3c49('0x87'),contactItemTypes[_0x3c49('0x1a')]);var _0x5b5803=util[_0x3c49('0xf')](_0x3c49('0x88'),_0x4ce107,_0x2ac535,_0x55e341,_0x281a01['ListId'],_0x281a01['CompanyId']||null,NOW,NOW);if(_[_0x3c49('0x1c')](_0x4864ee[_0x3c49('0x70')])){_0x5b5803+=',\x20scheduledAt\x20=\x20NOW()';}_0x217afb[_0x3c49('0x1e')](_0x5b5803);BPromise[_0x3c49('0x89')](_0x217afb,handleQuery)['then'](function(_0x4c0152){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x217afb=[];for(var _0x4a9837=0x0;_0x4a9837\x20\x20');}var _0x5e69d0=path[_0x3c49('0x3c')](config[_0x3c49('0x92')],'server/files/tmp',process[_0x3c49('0x91')][0x2]);if(!fs[_0x3c49('0x93')](_0x5e69d0)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x214ee7={};try{_0x214ee7=JSON[_0x3c49('0x94')](process[_0x3c49('0x91')][0x3]);if(!_0x214ee7['binding']){throw new Error(_0x3c49('0x95'));}var _0x4a422e=0x0;if(_0x214ee7[_0x3c49('0x96')][_0x3c49('0x39')]){_0x4a422e=0x1;}if(!_0x214ee7[_0x3c49('0x36')]){throw new Error(_0x3c49('0x97'));}}catch(_0x165569){throw new Error(_0x3c49('0x98'));}var _0x4e331d=[];try{_0x4e331d=_[_0x3c49('0x99')](JSON[_0x3c49('0x94')](process['argv'][0x4]),'id');}catch(_0xb4c692){logger['info']('No\x20agent\x20available');}main(_0x5e69d0,_0x214ee7,_0x4e331d,_0x4a422e);}validate();process['on']('SIGINT',handleStop);process['on'](_0x3c49('0x9a'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 3410e66..f06359f 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 _0x9c84=['Called\x20Number','Member\x20Name','membername','UniqueId','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','queue','push','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','Queue','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time'];(function(_0x40f6d8,_0x175693){var _0x484ab7=function(_0x4b4129){while(--_0x4b4129){_0x40f6d8['push'](_0x40f6d8['shift']());}};_0x484ab7(++_0x175693);}(_0x9c84,0x120));var _0x49c8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9c84[_0x20a584];return _0x4b41a8;};'use strict';exports[_0x49c8('0x0')]=function(_0x4b9a06,_0x2c68d1){var _0x3e997c=[{'type':_0x49c8('0x1'),'content':_0x49c8('0x2'),'variableName':null}];switch(_0x4b9a06[_0x49c8('0x3')]()){case _0x49c8('0x4'):switch(_0x2c68d1[_0x49c8('0x3')]()){case _0x49c8('0x5'):_0x3e997c['push']({'type':'variable','content':'','variableName':_0x49c8('0x6')});_0x3e997c[_0x49c8('0x7')]({'type':_0x49c8('0x8'),'content':'','variableName':_0x49c8('0x9')});break;case _0x49c8('0xa'):_0x3e997c[_0x49c8('0x7')]({'type':'string','content':_0x49c8('0xb'),'variableName':null});_0x3e997c[_0x49c8('0x7')]({'type':_0x49c8('0x8'),'content':'','variableName':_0x49c8('0xc')});break;}}return _0x3e997c;};exports[_0x49c8('0xd')]=function(_0x5c8d93,_0x59790c){var _0x2e68ef=[];switch(_0x5c8d93[_0x49c8('0x3')]()){case _0x49c8('0x4'):switch(_0x59790c[_0x49c8('0x3')]()){case'inbound':_0x2e68ef=[{'type':_0x49c8('0x1'),'content':_0x49c8('0xe'),'key':null,'keyType':null,'variableName':null},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x10'),'keyType':_0x49c8('0x8'),'variableName':_0x49c8('0x9')},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x11'),'keyType':_0x49c8('0x8'),'variableName':'calleridname'},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x12'),'keyType':_0x49c8('0x8'),'variableName':'destexten'},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x13'),'keyType':_0x49c8('0x8'),'variableName':_0x49c8('0x6')},{'type':_0x49c8('0xf'),'content':'','key':'UniqueId','keyType':_0x49c8('0x8'),'variableName':_0x49c8('0x14')},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x15'),'keyType':'variable','variableName':_0x49c8('0x16')},{'type':'string','content':_0x49c8('0x17'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x49c8('0x18'),'keyType':_0x49c8('0x8'),'variableName':_0x49c8('0x19')},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x1a'),'keyType':_0x49c8('0x8'),'variableName':'destcalleridnum'},{'type':_0x49c8('0x1'),'content':_0x49c8('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x1c'),'keyType':'variable','variableName':_0x49c8('0x16')},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x1d'),'keyType':'variable','variableName':'agentconnectAt'},{'type':_0x49c8('0xf'),'content':'','key':'Agent\x20Complete','keyType':_0x49c8('0x8'),'variableName':_0x49c8('0x1e')},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x1f'),'keyType':'variable','variableName':_0x49c8('0x20')},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x21'),'keyType':_0x49c8('0x8'),'variableName':'talktime'}];break;case _0x49c8('0xa'):_0x2e68ef=[{'type':_0x49c8('0x1'),'content':_0x49c8('0xe'),'variableName':null},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x22'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0x49c8('0x23'),'keyType':_0x49c8('0x8'),'keyContent':'','variableName':_0x49c8('0x24')},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x25'),'keyType':_0x49c8('0x8'),'keyContent':'','variableName':'uniqueid'},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x15'),'keyType':'variable','keyContent':'','variableName':_0x49c8('0x26')},{'type':_0x49c8('0x1'),'content':_0x49c8('0x1b')},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x27'),'keyType':_0x49c8('0x8'),'keyContent':'','variableName':_0x49c8('0x28')},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x29'),'keyType':_0x49c8('0x8'),'keyContent':'','variableName':_0x49c8('0x2a')},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x2b'),'keyType':_0x49c8('0x8'),'keyContent':'','variableName':_0x49c8('0x2c')},{'type':_0x49c8('0xf'),'content':'','key':_0x49c8('0x2d'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x2e68ef;}; \ No newline at end of file +var _0xfbc5=['Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','calleridnum','Outbound\x20Call','destcalleridnum','getDescriptions','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','outbound','***\x20Call\x20Info\x20***','Member\x20Name','starttime','Answer\x20Time'];(function(_0x23ac30,_0x2a1d00){var _0x208fec=function(_0x23213a){while(--_0x23213a){_0x23ac30['push'](_0x23ac30['shift']());}};_0x208fec(++_0x2a1d00);}(_0xfbc5,0xb9));var _0x5fbc=function(_0x10db0b,_0x5f19f4){_0x10db0b=_0x10db0b-0x0;var _0xff5fc7=_0xfbc5[_0x10db0b];return _0xff5fc7;};'use strict';exports[_0x5fbc('0x0')]=function(_0x1be45e,_0x5655f5){var _0x200794=[{'type':_0x5fbc('0x1'),'content':_0x5fbc('0x2'),'variableName':null}];switch(_0x1be45e[_0x5fbc('0x3')]()){case _0x5fbc('0x4'):switch(_0x5655f5['toLowerCase']()){case _0x5fbc('0x5'):_0x200794[_0x5fbc('0x6')]({'type':_0x5fbc('0x7'),'content':'','variableName':'queue'});_0x200794['push']({'type':_0x5fbc('0x7'),'content':'','variableName':_0x5fbc('0x8')});break;case'outbound':_0x200794[_0x5fbc('0x6')]({'type':'string','content':_0x5fbc('0x9'),'variableName':null});_0x200794[_0x5fbc('0x6')]({'type':_0x5fbc('0x7'),'content':'','variableName':_0x5fbc('0xa')});break;}}return _0x200794;};exports[_0x5fbc('0xb')]=function(_0x21b2d2,_0x4f881c){var _0x3fc6a7=[];switch(_0x21b2d2[_0x5fbc('0x3')]()){case'voice':switch(_0x4f881c[_0x5fbc('0x3')]()){case _0x5fbc('0x5'):_0x3fc6a7=[{'type':_0x5fbc('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x5fbc('0xc'),'content':'','key':'Caller\x20Number','keyType':_0x5fbc('0x7'),'variableName':'calleridnum'},{'type':'keyValue','content':'','key':_0x5fbc('0xd'),'keyType':_0x5fbc('0x7'),'variableName':_0x5fbc('0xe')},{'type':_0x5fbc('0xc'),'content':'','key':_0x5fbc('0xf'),'keyType':_0x5fbc('0x7'),'variableName':_0x5fbc('0x10')},{'type':_0x5fbc('0xc'),'content':'','key':'Queue','keyType':'variable','variableName':_0x5fbc('0x11')},{'type':'keyValue','content':'','key':_0x5fbc('0x12'),'keyType':'variable','variableName':_0x5fbc('0x13')},{'type':'keyValue','content':'','key':_0x5fbc('0x14'),'keyType':_0x5fbc('0x7'),'variableName':_0x5fbc('0x15')},{'type':_0x5fbc('0x1'),'content':_0x5fbc('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x5fbc('0xc'),'content':'','key':_0x5fbc('0x17'),'keyType':_0x5fbc('0x7'),'variableName':'destcalleridname'},{'type':_0x5fbc('0xc'),'content':'','key':_0x5fbc('0x18'),'keyType':_0x5fbc('0x7'),'variableName':_0x5fbc('0xa')},{'type':'string','content':_0x5fbc('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x5fbc('0x1a'),'keyType':_0x5fbc('0x7'),'variableName':_0x5fbc('0x15')},{'type':_0x5fbc('0xc'),'content':'','key':_0x5fbc('0x1b'),'keyType':_0x5fbc('0x7'),'variableName':_0x5fbc('0x1c')},{'type':_0x5fbc('0xc'),'content':'','key':_0x5fbc('0x1d'),'keyType':_0x5fbc('0x7'),'variableName':_0x5fbc('0x1e')},{'type':_0x5fbc('0xc'),'content':'','key':_0x5fbc('0x1f'),'keyType':_0x5fbc('0x7'),'variableName':_0x5fbc('0x20')},{'type':_0x5fbc('0xc'),'content':'','key':_0x5fbc('0x21'),'keyType':_0x5fbc('0x7'),'variableName':_0x5fbc('0x22')}];break;case _0x5fbc('0x23'):_0x3fc6a7=[{'type':_0x5fbc('0x1'),'content':_0x5fbc('0x24'),'variableName':null},{'type':_0x5fbc('0xc'),'content':'','key':'Called\x20Number','keyType':_0x5fbc('0x7'),'keyContent':'','variableName':_0x5fbc('0xa')},{'type':_0x5fbc('0xc'),'content':'','key':_0x5fbc('0x25'),'keyType':_0x5fbc('0x7'),'keyContent':'','variableName':'membername'},{'type':_0x5fbc('0xc'),'content':'','key':_0x5fbc('0x12'),'keyType':_0x5fbc('0x7'),'keyContent':'','variableName':_0x5fbc('0x13')},{'type':_0x5fbc('0xc'),'content':'','key':_0x5fbc('0x14'),'keyType':_0x5fbc('0x7'),'keyContent':'','variableName':_0x5fbc('0x26')},{'type':_0x5fbc('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':_0x5fbc('0x27'),'keyType':_0x5fbc('0x7'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0x5fbc('0x28'),'keyType':_0x5fbc('0x7'),'keyContent':'','variableName':_0x5fbc('0x29')},{'type':_0x5fbc('0xc'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':_0x5fbc('0x2a')},{'type':_0x5fbc('0xc'),'content':'','key':_0x5fbc('0x2b'),'keyType':_0x5fbc('0x7'),'keyContent':'','variableName':_0x5fbc('0x2c')}];break;}}return _0x3fc6a7;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index c769bde..f4e7398 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 _0x9822=['rows','catch','tracked','query','clone','omit','phone','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','getInteractionsQuery','resolve','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','body','contact','default','fields','user','having','read','tags','checkAccountsRestrictions','group','i.id','ids','tag','countFilteredInteractions','count','length','clause','order','forEach','contactName','DESC','closed','getClosedOrderClause','getFilteredInteractions'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x9822,0x168));var _0x2982=function(_0x275c07,_0x5bcbf6){_0x275c07=_0x275c07-0x0;var _0xa7612b=_0x9822[_0x275c07];return _0xa7612b;};'use strict';var _=require(_0x2982('0x0'));var sqlUtils=require(_0x2982('0x1'));var utils=require(_0x2982('0x2'));exports[_0x2982('0x3')]=function(_0xeb1704,_0x1f8dc5,_0x56bc79,_0x4e89dc,_0x3120e8){var _0x35ee94={'count':0x0,'rows':[]};var _0x58b759=sqlUtils[_0x2982('0x4')](_0xeb1704,_0x56bc79,_0x1f8dc5);if(_0x58b759){return Promise['resolve'](_0x35ee94);}var _0xfecfd7=sqlUtils[_0x2982('0x5')](_0xeb1704);var _0xa65b65={};return Promise[_0x2982('0x6')]()['then'](function(){if(_0x1f8dc5[_0x2982('0x7')]){return sqlUtils[_0x2982('0x8')](_0x1f8dc5['search'],_0x3120e8);}else{return sqlUtils[_0x2982('0x9')](_0xeb1704,_0x1f8dc5,_0x3120e8);}})[_0x2982('0xa')](function(_0x541829){_0xfecfd7[_0x2982('0xb')](_0x541829[_0x2982('0xc')]);_0xfecfd7[_0x2982('0xb')](_0x541829[_0x2982('0xd')]);_0xfecfd7[_0x2982('0xb')](_0x541829[_0x2982('0xe')]);_0xfecfd7[_0x2982('0xb')](_0x541829[_0x2982('0xf')]);_0xfecfd7['where'](_0x541829['filter']);_0xfecfd7[_0x2982('0xb')](_0x541829[_0x2982('0x10')]);_0xfecfd7[_0x2982('0x11')](_0x541829[_0x2982('0x12')]);_0xa65b65=_0x541829[_0x2982('0x13')];return sqlUtils[_0x2982('0x14')](_0xeb1704,_0x56bc79,_0x1f8dc5);})[_0x2982('0xa')](function(_0x4a88b3){_0xfecfd7[_0x2982('0xb')](_0x4a88b3);_0xfecfd7[_0x2982('0x15')](_0x2982('0x16'));var _0x2224e8=_0x1f8dc5['search']?_0xa65b65[_0x2982('0x17')]:_0x1f8dc5[_0x2982('0x18')];return sqlUtils[_0x2982('0x19')](_0xfecfd7,_0x2224e8);})['then'](function(_0x249a78){_0x35ee94[_0x2982('0x1a')]=_0x249a78[_0x2982('0x1b')];if(_0x35ee94['count']===0x0){return[];}_0xfecfd7[_0x2982('0x11')](_0xa65b65[_0x2982('0x1c')]);if(_0x4e89dc[_0x2982('0x1d')]){_0x4e89dc[_0x2982('0x1d')][_0x2982('0x1e')](function(_0x30b37c){var _0x4ce35e=_0x30b37c[0x0]===_0x2982('0x1f')?_0x30b37c[0x0]:'i.'+_0x30b37c[0x0];_0xfecfd7[_0x2982('0x1d')](_0x4ce35e,_0x30b37c[0x1]===_0x2982('0x20')?![]:!![]);if(_0x30b37c[0x0]===_0x2982('0x21')){var _0x1280ca=sqlUtils[_0x2982('0x22')](_0xeb1704,_0x1f8dc5);_0xfecfd7[_0x2982('0x1d')](_0x1280ca,_0x30b37c[0x1]===_0x2982('0x20')?![]:!![]);}});}return sqlUtils[_0x2982('0x23')](_0xeb1704,_0xfecfd7,_0x1f8dc5,_0x4e89dc);})['then'](function(_0x1cd3f7){_0x35ee94[_0x2982('0x24')]=_0x1cd3f7;return _0x35ee94;})[_0x2982('0x25')](function(_0x4da293){throw _0x4da293;});};exports[_0x2982('0x26')]=function(_0xe1c29a,_0x17b812){return function(_0x1accf4,_0x2d082c,_0x10cff6){var _0x35ba45=_0x1accf4[_0x2982('0x10')];var _0xece5ad={};var _0x224824=_0x1accf4[_0x2982('0x27')];if(_0xece5ad){_0xece5ad=_[_0x2982('0x28')](_0x1accf4[_0x2982('0xc')]);_0xece5ad=_[_0x2982('0x29')](_0xece5ad,[_0x2982('0xc'),'html',_0x2982('0x2a'),'fax','mobile']);}utils[_0x2982('0x2b')](_0x35ba45,_0xece5ad,_0x224824,_0xe1c29a,_0x17b812);_0x10cff6(null);};}; \ No newline at end of file +var _0x7edb=['query','clone','omit','body','html','phone','fax','mobile','updateUser','./sql-utils','./utils','findAll','getInteractionsQuery','resolve','search','parseAdvancedSearchFilter','parseQueryParameters','then','contact','where','fields','filter','user','read','tags','checkAccountsRestrictions','group','i.id','ids','tag','countFilteredInteractions','count','having','clause','order','DESC','closed','getClosedOrderClause','catch','tracked'];(function(_0x43f548,_0x4a85cc){var _0x544019=function(_0x4f35b6){while(--_0x4f35b6){_0x43f548['push'](_0x43f548['shift']());}};_0x544019(++_0x4a85cc);}(_0x7edb,0x1c1));var _0xb7ed=function(_0x29229c,_0x4d3637){_0x29229c=_0x29229c-0x0;var _0x828829=_0x7edb[_0x29229c];return _0x828829;};'use strict';var _=require('lodash');var sqlUtils=require(_0xb7ed('0x0'));var utils=require(_0xb7ed('0x1'));exports[_0xb7ed('0x2')]=function(_0x5350ee,_0xa94356,_0x39d732,_0x4818e4,_0x5d92cb){var _0x30ee78={'count':0x0,'rows':[]};var _0x2cf9d0=sqlUtils['skipInteractionsQuery'](_0x5350ee,_0x39d732,_0xa94356);if(_0x2cf9d0){return Promise['resolve'](_0x30ee78);}var _0x333b95=sqlUtils[_0xb7ed('0x3')](_0x5350ee);var _0x3fb9f2={};return Promise[_0xb7ed('0x4')]()['then'](function(){if(_0xa94356[_0xb7ed('0x5')]){return sqlUtils[_0xb7ed('0x6')](_0xa94356['search'],_0x5d92cb);}else{return sqlUtils[_0xb7ed('0x7')](_0x5350ee,_0xa94356,_0x5d92cb);}})[_0xb7ed('0x8')](function(_0x1c5848){_0x333b95['where'](_0x1c5848['body']);_0x333b95['where'](_0x1c5848[_0xb7ed('0x9')]);_0x333b95[_0xb7ed('0xa')](_0x1c5848['default']);_0x333b95[_0xb7ed('0xa')](_0x1c5848[_0xb7ed('0xb')]);_0x333b95[_0xb7ed('0xa')](_0x1c5848[_0xb7ed('0xc')]);_0x333b95[_0xb7ed('0xa')](_0x1c5848[_0xb7ed('0xd')]);_0x333b95['having'](_0x1c5848[_0xb7ed('0xe')]);_0x3fb9f2=_0x1c5848[_0xb7ed('0xf')];return sqlUtils[_0xb7ed('0x10')](_0x5350ee,_0x39d732,_0xa94356);})[_0xb7ed('0x8')](function(_0x42613f){_0x333b95[_0xb7ed('0xa')](_0x42613f);_0x333b95[_0xb7ed('0x11')](_0xb7ed('0x12'));var _0x2da80e=_0xa94356[_0xb7ed('0x5')]?_0x3fb9f2[_0xb7ed('0x13')]:_0xa94356[_0xb7ed('0x14')];return sqlUtils[_0xb7ed('0x15')](_0x333b95,_0x2da80e);})[_0xb7ed('0x8')](function(_0x3e2b04){_0x30ee78[_0xb7ed('0x16')]=_0x3e2b04['length'];if(_0x30ee78[_0xb7ed('0x16')]===0x0){return[];}_0x333b95[_0xb7ed('0x17')](_0x3fb9f2[_0xb7ed('0x18')]);if(_0x4818e4[_0xb7ed('0x19')]){_0x4818e4[_0xb7ed('0x19')]['forEach'](function(_0x477583){var _0x1edd83=_0x477583[0x0]==='contactName'?_0x477583[0x0]:'i.'+_0x477583[0x0];_0x333b95[_0xb7ed('0x19')](_0x1edd83,_0x477583[0x1]===_0xb7ed('0x1a')?![]:!![]);if(_0x477583[0x0]===_0xb7ed('0x1b')){var _0x1a43d8=sqlUtils[_0xb7ed('0x1c')](_0x5350ee,_0xa94356);_0x333b95[_0xb7ed('0x19')](_0x1a43d8,_0x477583[0x1]===_0xb7ed('0x1a')?![]:!![]);}});}return sqlUtils['getFilteredInteractions'](_0x5350ee,_0x333b95,_0xa94356,_0x4818e4);})[_0xb7ed('0x8')](function(_0x1b09d9){_0x30ee78['rows']=_0x1b09d9;return _0x30ee78;})[_0xb7ed('0x1d')](function(_0x56a1be){throw _0x56a1be;});};exports[_0xb7ed('0x1e')]=function(_0x93865,_0x311995){return function(_0x27ea42,_0x2cae3e,_0x4ac55d){var _0x153a2c=_0x27ea42['user'];var _0x47e307={};var _0x450188=_0x27ea42[_0xb7ed('0x1f')];if(_0x47e307){_0x47e307=_[_0xb7ed('0x20')](_0x27ea42['body']);_0x47e307=_[_0xb7ed('0x21')](_0x47e307,[_0xb7ed('0x22'),_0xb7ed('0x23'),_0xb7ed('0x24'),_0xb7ed('0x25'),_0xb7ed('0x26')]);}utils[_0xb7ed('0x27')](_0x153a2c,_0x47e307,_0x450188,_0x93865,_0x311995);_0x4ac55d(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 8d550b7..6b5cbb6 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x221c=['length','where','\x20IN\x20?','map','getInteractionsTables','cm_contacts','users','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','default','text','value','end','read','and','operator','$substring','split','contact','name','ContactId','start','Tag','clause','tags','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','user','body','keys','some','parse','$lte','null','resolve','then','tag','filter','get','capitalize','chat','Websites','Accounts','role','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','Sequelize','SELECT','sequelize','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','a.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_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.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.to','i.ContactId','i.MailAccountId','i.UserId','contactName','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','TagIds','limit','offset','query','toString','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','agent','search','select','field','color','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','from','left_join','u.id\x20=\x20ui.UserId'];(function(_0x12986b,_0x2e4653){var _0x578ce6=function(_0xb706ab){while(--_0xb706ab){_0x12986b['push'](_0x12986b['shift']());}};_0x578ce6(++_0x2e4653);}(_0x221c,0x125));var _0xc221=function(_0x55e465,_0x54f587){_0x55e465=_0x55e465-0x0;var _0x5993bd=_0x221c[_0x55e465];return _0x5993bd;};'use strict';var _=require(_0xc221('0x0'));var squel=require(_0xc221('0x1'));var as=require(_0xc221('0x2'));var qs=require(_0xc221('0x3'));var updateInteraction=require(_0xc221('0x4'))['updateInteraction'];var utils=require(_0xc221('0x5'));var db=require(_0xc221('0x6'))['db'];function skipInteractionsQuery(_0x443375,_0x5aa96c,_0x45268f){var _0x262f02=![];var _0x23edfe=utils[_0xc221('0x7')](_0x443375);if(_0x5aa96c['role']===_0xc221('0x8')&&!_0x45268f[_0xc221('0x9')]&&!_0x45268f[_0x23edfe]){_0x262f02=!![];}return _0x262f02;}function getTagsQuery(){return squel[_0xc221('0xa')]()[_0xc221('0xb')]('id')[_0xc221('0xb')]('name')[_0xc221('0xb')](_0xc221('0xc'))['from'](_0xc221('0xd'));}function getUsersQuery(_0x4dd89a,_0x242a92){var _0x1f0c59=utils[_0xc221('0xe')](_0x4dd89a);var _0x2f2aec=_0xc221('0xf')+_0x4dd89a+_0xc221('0x10');var _0x26097f=squel[_0xc221('0xa')]()[_0xc221('0xb')](_0xc221('0x11'))[_0xc221('0xb')](_0xc221('0x12'))['field'](_0xc221('0x13')+_0x1f0c59)[_0xc221('0x14')](_0x2f2aec,'ui')[_0xc221('0x15')]('users','u',_0xc221('0x16'));if(_0x242a92[_0xc221('0x17')]>0x0){_0x26097f[_0xc221('0x18')](_0xc221('0x13')+_0x1f0c59+_0xc221('0x19'),_[_0xc221('0x1a')](_0x242a92,'id'));}return _0x26097f;}function getInteractionsQuery(_0x28a502){var _0x45b502=utils[_0xc221('0x1b')](_0x28a502);var _0x115bc8=utils[_0xc221('0x7')](_0x28a502);var _0xf502f2=utils[_0xc221('0xe')](_0x28a502);return squel[_0xc221('0xa')]()[_0xc221('0x14')](_0x45b502['interactions'],'i')[_0xc221('0x15')](_0xc221('0x1c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc221('0x15')](_0xc221('0x1d'),'o',_0xc221('0x1e'))[_0xc221('0x15')](_0x45b502[_0xc221('0x1f')],'a',_0xc221('0x20')+_0x115bc8)['left_join'](_0x45b502[_0xc221('0x21')],'me','me.'+_0xf502f2+_0xc221('0x22'))[_0xc221('0x15')](_0x45b502['interactionsTags'],'it',_0xc221('0x23')+_0xf502f2+_0xc221('0x22'))[_0xc221('0x15')](_0xc221('0xd'),'t',_0xc221('0x24'));}function getSqlClauses(){var _0x5ef6c2={'body':squel[_0xc221('0x25')](),'contact':squel['expr'](),'default':squel[_0xc221('0x25')](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel[_0xc221('0x25')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0xc221('0x25')]()};return _0x5ef6c2;}function parseTagParameter(_0x1646c7){var _0x598e90=squel[_0xc221('0x25')]();if(_0x1646c7){var _0x20eb1f=utils[_0xc221('0x26')](_0x1646c7);_0x20eb1f[_0xc221('0x27')](function(_0x4116af){_0x598e90['or'](_0xc221('0x28'),'%,'+_0x4116af+',%');});}return _0x598e90;}function parseReadParameter(_0x10021c){var _0x5aacb5='';if(_0x10021c){_0x5aacb5='unreadMessages\x20{OPERATOR}\x200';if(_0x10021c==='1'){_0x5aacb5=_0x5aacb5[_0xc221('0x29')](_0xc221('0x2a'),'=');}else{_0x5aacb5=_0x5aacb5['replace'](_0xc221('0x2a'),'>');}}return _0x5aacb5;}function parseSearchFilter(_0x3fdad7,_0xa57d70){var _0x3121f1=squel[_0xc221('0x25')]();if(_0xa57d70){var _0x45a85f=_0xa57d70[_0xc221('0x29')]('\x5c','\x5c\x5c')[_0xc221('0x29')](/'/g,'\x27\x27');if(qs[_0xc221('0x2b')](_0x45a85f)){_0x3121f1['or']('i.id\x20LIKE\x20?',_0x45a85f+'%');if(['sms',_0xc221('0x2c')][_0xc221('0x2d')](_0x3fdad7)){_0x3121f1['or'](_0xc221('0x2e'),_0x45a85f+'%');}else if(_0x3fdad7===_0xc221('0x2f')){_0x3121f1['or'](_0xc221('0x30'),_0x45a85f+'%');}else if(_0x3fdad7===_0xc221('0x31')){_0x3121f1['or'](_0xc221('0x32'),_0x45a85f+'%');}}else if(_0x3fdad7==='mail'&&qs[_0xc221('0x33')](_0x45a85f)){_0x3121f1['or'](_0xc221('0x34'),_0x45a85f+'%');}else{if(_0x3fdad7===_0xc221('0x35')){_0x3121f1['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc221('0x36')](_0x45a85f,!![]))['or'](_0xc221('0x37'),qs[_0xc221('0x36')](_0x45a85f));}else if(_0x3fdad7!==_0xc221('0x2f')){_0x3121f1['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc221('0x36')](_0x45a85f));}_0x3121f1['or'](_0xc221('0x38'),qs[_0xc221('0x36')](_0x45a85f,!![]),null);}}return _0x3121f1;}function parseAdvancedSearchFilter(_0x27f182,_0xf2d24c){var _0x1ee7ee=getSqlClauses();var _0x97c73f=as[_0xc221('0x39')](_0x27f182);var _0x28cba4=_0x97c73f[_0xc221('0x3a')];for(var _0x196edd=0x0;_0x196edd<_0x97c73f[_0xc221('0x3b')][_0xc221('0x17')];_0x196edd++){var _0x564643=_0x97c73f['conditions'][_0x196edd];var _0x2e3a7c='i';var _0x407724=_[_0xc221('0x3c')](_0xf2d24c,['name',_0x564643[_0xc221('0xb')]]);if(_0x407724){var _0x89745c=as[_0xc221('0x3d')](_0x2e3a7c,_0x407724[_0xc221('0x3e')],_0x564643);_0x1ee7ee[_0xc221('0x3f')][_0x28cba4](_0x89745c[_0xc221('0x40')],_0x89745c[_0xc221('0x41')]['start'],_0x89745c[_0xc221('0x41')][_0xc221('0x42')]);}else{switch(_0x564643[_0xc221('0xb')]){case'unreadMessages':var _0x1254a2=parseReadParameter(_0x564643['value']);_0x1ee7ee[_0xc221('0x43')][_0xc221('0x44')](_0x1254a2);break;case'Contact':if(_0x564643[_0xc221('0x45')]===_0xc221('0x46')){if(_0x564643[_0xc221('0x41')][_0xc221('0x47')]('\x20')[_0xc221('0x17')]>0x1){_0x1ee7ee[_0xc221('0x48')][_0x28cba4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc221('0x36')](_0x564643['value'],!![]),null);}else{var _0xbb131c='%'+_0x564643[_0xc221('0x41')]+'%';_0x1ee7ee[_0xc221('0x48')][_0x28cba4]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xbb131c,_0xbb131c,_0xbb131c);}}else{_0x407724=_[_0xc221('0x3c')](_0xf2d24c,[_0xc221('0x49'),'ContactId']);_0x564643[_0xc221('0xb')]=_0xc221('0x4a');_0x89745c=as[_0xc221('0x3d')](_0x2e3a7c,_0x407724[_0xc221('0x3e')],_0x564643);_0x1ee7ee[_0xc221('0x48')][_0x28cba4](_0x89745c[_0xc221('0x40')],_0x89745c[_0xc221('0x41')][_0xc221('0x4b')],_0x89745c['value'][_0xc221('0x42')]);}break;case _0xc221('0x4c'):var _0x273681=_0x564643[_0xc221('0x41')][_0xc221('0x47')](',')[_0xc221('0x1a')](function(_0x547d39){return Number(_0x547d39);});var _0x552d37=parseTagParameter(_0x273681);_0x1ee7ee['tags'][_0xc221('0x4d')][_0xc221('0x44')](_0x552d37);_0x1ee7ee[_0xc221('0x4e')]['ids']=_0x273681;break;case _0xc221('0x4f'):if(_0x564643[_0xc221('0x45')]===_0xc221('0x46')){_0x1ee7ee['user'][_0x28cba4](_0xc221('0x50'),'%'+_0x564643['value']+'%',null);}else{_0x407724=_[_0xc221('0x3c')](_0xf2d24c,[_0xc221('0x49'),_0xc221('0x51')]);_0x564643[_0xc221('0xb')]=_0xc221('0x51');_0x89745c=as[_0xc221('0x3d')](_0x2e3a7c,_0x407724[_0xc221('0x3e')],_0x564643);_0x1ee7ee[_0xc221('0x52')][_0x28cba4](_0x89745c['text'],_0x89745c[_0xc221('0x41')][_0xc221('0x4b')],_0x89745c[_0xc221('0x41')][_0xc221('0x42')]);}break;case _0xc221('0x53'):case'plainBody':_0x89745c=as[_0xc221('0x3d')]('me',null,_0x564643);_0x1ee7ee['body'][_0x28cba4](_0x89745c[_0xc221('0x40')],_0x89745c['value']['start'],_0x89745c[_0xc221('0x41')][_0xc221('0x42')]);break;}}}return _0x1ee7ee;}function parseModelFields(_0xe5c7b3,_0x444f33,_0x78bdd5){var _0xe8e3f9=utils['getAccountFK'](_0xe5c7b3);var _0xa22efb=squel[_0xc221('0x25')]();var _0xfc4031=_(_0x444f33)[_0xc221('0x54')]()[_0xc221('0x1a')](function(_0x58be61){return _[_0xc221('0x55')](_0x78bdd5,['name',_0x58be61])?_0x58be61:undefined;})['compact']()[_0xc221('0x41')]();if(_0xfc4031['length']>0x0){_0xfc4031[_0xc221('0x27')](function(_0x50e225){if(_0x50e225===_0xe8e3f9){_0xa22efb[_0xc221('0x44')]('i.'+_0xe8e3f9+'\x20IN\x20?',[]['concat'](_0x444f33[_0x50e225]));}else if(_0x50e225==='createdAt'){var _0x385560=JSON[_0xc221('0x56')](_0x444f33[_0x50e225])['$gte'];var _0x2f5ac0=JSON[_0xc221('0x56')](_0x444f33[_0x50e225])[_0xc221('0x57')];_0xa22efb[_0xc221('0x44')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x385560,_0x2f5ac0);}else{if(_0x444f33[_0x50e225]===_0xc221('0x58')){_0xa22efb[_0xc221('0x44')]('i.'+_0x50e225+'\x20IS\x20NULL');}else{_0xa22efb[_0xc221('0x44')]('i.'+_0x50e225+'\x20=\x20?',_0x444f33[_0x50e225]);}}});}return _0xa22efb;}function parseQueryParameters(_0x5bf2ce,_0x5716fd,_0x289fa6){var _0x14fdbd=getSqlClauses();return Promise[_0xc221('0x59')]()['then'](function(){return parseModelFields(_0x5bf2ce,_0x5716fd,_0x289fa6);})[_0xc221('0x5a')](function(_0x38cefc){_0x14fdbd['fields'][_0xc221('0x44')](_0x38cefc);return parseReadParameter(_0x5716fd[_0xc221('0x43')]);})[_0xc221('0x5a')](function(_0x3cb477){_0x14fdbd['read'][_0xc221('0x44')](_0x3cb477);return parseTagParameter(_0x5716fd[_0xc221('0x5b')]);})[_0xc221('0x5a')](function(_0x50fc70){_0x14fdbd[_0xc221('0x4e')][_0xc221('0x4d')][_0xc221('0x44')](_0x50fc70);return parseSearchFilter(_0x5bf2ce,_0x5716fd[_0xc221('0x5c')]);})['then'](function(_0x45cb4f){_0x14fdbd['filter']=_0x45cb4f;return _0x14fdbd;});}function checkAccountsRestrictions(_0x5cbbd5,_0x4cf7a2,_0x19362d){var _0x5ea725=utils[_0xc221('0x7')](_0x5cbbd5);var _0xfde37c=_0xc221('0x5d')+_[_0xc221('0x5e')](_0x5cbbd5)+(_0x5cbbd5===_0xc221('0x5f')?_0xc221('0x60'):_0xc221('0x61'));var _0x317232=squel[_0xc221('0x25')]();return Promise[_0xc221('0x59')]()[_0xc221('0x5a')](function(){if(_0x19362d[_0xc221('0x9')]&&_0x4cf7a2[_0xc221('0x62')]===_0xc221('0x8')){return _0x4cf7a2[_0xfde37c]({'attributes':['id'],'raw':!![]});}})[_0xc221('0x5a')](function(_0x25b5fe){if(_0x25b5fe){if(_0x25b5fe[_0xc221('0x17')]===0x0){_0x317232[_0xc221('0x44')]('i.'+_0x5ea725+_0xc221('0x63'));}else{_0x317232[_0xc221('0x44')]('i.'+_0x5ea725+'\x20IN\x20?',_[_0xc221('0x1a')](_0x25b5fe,'id'));}}else if(!_0x19362d[_0x5ea725]){_0x317232['and']('i.'+_0x5ea725+_0xc221('0x64'));}})[_0xc221('0x5a')](function(){return _0x317232;});}function getClosedOrderClause(_0x4767dd,_0x463199){var _0xf02353='';var _0x5e002f=[_0xc221('0x65'),_0xc221('0x66'),_0xc221('0x67')];if(_0x4767dd===_0xc221('0x35')){_0x5e002f[_0xc221('0x68')](_0xc221('0x69'));}if(_0x463199[_0xc221('0x6a')]==='0'&&_0x4767dd===_0xc221('0x35')){_0xf02353=_0xc221('0x69');}else{if(_0x463199[_0xc221('0x6a')]==='1'){_0x5e002f['shift']();}_0xf02353=_0xc221('0x6b')+_0x5e002f['join'](',\x20')+')';}return _0xf02353;}function getFilteredInteractions(_0x12d633,_0x4aeedb,_0x58115,_0x27fa04){var _0x4076a7=utils[_0xc221('0xe')](_0x12d633);var _0x469ccb=_[_0xc221('0x5e')](_0x12d633)+'Interaction';var _0x26a8ef=[];var _0x2d577c=getTagsQuery();var _0xbb3121={'type':db[_0xc221('0x6c')]['QueryTypes'][_0xc221('0x6d')],'raw':!![]};var _0x17ccc6=[];var _0x1e5a7b=[];return db[_0xc221('0x6e')]['query'](_0x2d577c['toString'](),_0xbb3121)[_0xc221('0x5a')](function(_0x1a4d7b){_0x26a8ef=_[_0xc221('0x6f')](_0x1a4d7b,'id');_0xbb3121=_['merge'](_0xbb3121,{'model':db[_0x469ccb],'mapToModel':!![],'nest':!![]});if(_0x58115[_0xc221('0x70')]){_0x27fa04['attributes']['forEach'](function(_0x189e6e){_0x4aeedb[_0xc221('0xb')]('i.'+_0x189e6e);});}else{_0x4aeedb['field'](_0xc221('0x71'),_0xc221('0x72'));_0x4aeedb[_0xc221('0xb')](_0xc221('0x73'),'Account.key');_0x4aeedb[_0xc221('0xb')](_0xc221('0x74'),'Account.mandatoryDisposition');if(_0x12d633===_0xc221('0x35')){_0x4aeedb[_0xc221('0xb')](_0xc221('0x75'),_0xc221('0x76'));_0x4aeedb[_0xc221('0xb')](_0xc221('0x77'),'contactName');_0x4aeedb[_0xc221('0xb')]('i.id');_0x4aeedb['field']('i.createdAt');_0x4aeedb[_0xc221('0xb')]('i.updatedAt');_0x4aeedb[_0xc221('0xb')](_0xc221('0x78'));_0x4aeedb[_0xc221('0xb')](_0xc221('0x79'));_0x4aeedb[_0xc221('0xb')](_0xc221('0x7a'));_0x4aeedb[_0xc221('0xb')](_0xc221('0x7b'));_0x4aeedb[_0xc221('0xb')](_0xc221('0x7c'));_0x4aeedb[_0xc221('0xb')]('i.subject');_0x4aeedb[_0xc221('0xb')](_0xc221('0x67'));_0x4aeedb[_0xc221('0xb')](_0xc221('0x66'));_0x4aeedb[_0xc221('0xb')](_0xc221('0x65'));_0x4aeedb[_0xc221('0xb')]('i.substatus');_0x4aeedb[_0xc221('0xb')](_0xc221('0x7d'));_0x4aeedb[_0xc221('0xb')](_0xc221('0x7e'));_0x4aeedb[_0xc221('0xb')](_0xc221('0x7f'));_0x4aeedb[_0xc221('0xb')](_0xc221('0x80'));}else if(_0x12d633===_0xc221('0x31')){_0x4aeedb[_0xc221('0xb')]('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',_0xc221('0x81'));}else{_0x4aeedb[_0xc221('0xb')]('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',_0xc221('0x81'));}if(_0x12d633!==_0xc221('0x35')){_0x4aeedb[_0xc221('0xb')]('i.*');}_0x4aeedb[_0xc221('0xb')](_0xc221('0x82'),'Contact.firstName');_0x4aeedb[_0xc221('0xb')](_0xc221('0x83'),'Contact.lastName');_0x4aeedb[_0xc221('0xb')](_0xc221('0x84'),_0xc221('0x85'));_0x4aeedb['field'](_0xc221('0x86'),_0xc221('0x87'));_0x4aeedb[_0xc221('0xb')](_0xc221('0x88'),_0xc221('0x89'));_0x4aeedb['field'](_0xc221('0x8a'),_0xc221('0x8b'));_0x4aeedb[_0xc221('0xb')](_0xc221('0x8c'),'Owner.fullname');_0x4aeedb[_0xc221('0xb')](_0xc221('0x8d'),_0xc221('0x8e'));_0x4aeedb[_0xc221('0xb')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc221('0x8f'));}if(_0x27fa04[_0xc221('0x90')]){_0x4aeedb['limit'](_0x27fa04[_0xc221('0x90')]);}if(_0x27fa04[_0xc221('0x91')]){_0x4aeedb['offset'](_0x27fa04[_0xc221('0x91')]);}return db[_0xc221('0x6e')][_0xc221('0x92')](_0x4aeedb[_0xc221('0x93')](),_0xbb3121);})[_0xc221('0x5a')](function(_0x5ae2c5){_0x17ccc6=_0x5ae2c5;var _0x5d11dd=getUsersQuery(_0x12d633,_0x17ccc6);return db[_0xc221('0x6e')][_0xc221('0x92')](_0x5d11dd['toString'](),_0xbb3121);})[_0xc221('0x5a')](function(_0x2c1d06){_0x1e5a7b=_['groupBy'](_0x2c1d06,_0x4076a7);if(_0x12d633===_0xc221('0x35')){return db[_0xc221('0x94')][_0xc221('0x95')]({'attributes':[_0xc221('0x96')],'raw':!![]});}})[_0xc221('0x5a')](function(_0x31dddd){var _0xd8c687=_0x31dddd?_0x31dddd[_0xc221('0x96')]:undefined;var _0x1e983f=_0x17ccc6[_0xc221('0x1a')](function(_0x50c62e){return updateInteraction(_0x50c62e,_0x26a8ef,_0x1e5a7b,_0xd8c687);});return Promise[_0xc221('0x97')](_0x1e983f);});}function countFilteredInteractions(_0x47ed17,_0x3eb555){var _0x13045d=_0x47ed17[_0xc221('0x98')]();_0x13045d[_0xc221('0xb')](_0xc221('0x99'));_0x13045d[_0xc221('0xb')](_0xc221('0x71'),_0xc221('0x72'));var _0x30ccda=utils[_0xc221('0x26')](_0x3eb555);if(!_[_0xc221('0x9a')](_0x30ccda)){_0x13045d['where'](_0xc221('0x9b'),_0x30ccda);}var _0x2060a6={'type':db[_0xc221('0x6c')][_0xc221('0x9c')][_0xc221('0x6d')],'raw':!![]};return db[_0xc221('0x6e')][_0xc221('0x92')](_0x13045d[_0xc221('0x93')](),_0x2060a6);}module[_0xc221('0x9d')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x3b63=['a.id\x20=\x20i.','messages','me.','interactionsTags','\x20=\x20i.id','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','find','buildExpression','type','default','text','value','start','and','Contact','operator','split','contact','ContactId','end','map','tags','clause','ids','User','$substring','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','\x20IN\x20?','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','then','fields','read','tag','get','capitalize','chat','Websites','resolve','search','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','unshift','i.substatus','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.to','i.ContactId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','isEmpty','where','t.id\x20IN\x20?','SELECT','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','getAccountFK','role','agent','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts'];(function(_0x58dc86,_0x4e6b28){var _0x4aae2c=function(_0x214d51){while(--_0x214d51){_0x58dc86['push'](_0x58dc86['shift']());}};_0x4aae2c(++_0x4e6b28);}(_0x3b63,0x87));var _0x33b6=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x3b63[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x33b6('0x0'));var squel=require(_0x33b6('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x33b6('0x2'));var updateInteraction=require(_0x33b6('0x3'))[_0x33b6('0x4')];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x49eb5c,_0x1128a4,_0x369fbe){var _0x381b15=![];var _0xd81e61=utils[_0x33b6('0x5')](_0x49eb5c);if(_0x1128a4[_0x33b6('0x6')]===_0x33b6('0x7')&&!_0x369fbe['search']&&!_0x369fbe[_0xd81e61]){_0x381b15=!![];}return _0x381b15;}function getTagsQuery(){return squel[_0x33b6('0x8')]()['field']('id')[_0x33b6('0x9')](_0x33b6('0xa'))['field'](_0x33b6('0xb'))[_0x33b6('0xc')](_0x33b6('0xd'));}function getUsersQuery(_0x5eb4a8,_0x405933){var _0x453faa=utils[_0x33b6('0xe')](_0x5eb4a8);var _0x2d1d3a=_0x33b6('0xf')+_0x5eb4a8+_0x33b6('0x10');var _0x5d6070=squel['select']()[_0x33b6('0x9')]('u.id')[_0x33b6('0x9')]('u.fullname')[_0x33b6('0x9')](_0x33b6('0x11')+_0x453faa)[_0x33b6('0xc')](_0x2d1d3a,'ui')[_0x33b6('0x12')](_0x33b6('0x13'),'u',_0x33b6('0x14'));if(_0x405933[_0x33b6('0x15')]>0x0){_0x5d6070['where']('ui.'+_0x453faa+'\x20IN\x20?',_['map'](_0x405933,'id'));}return _0x5d6070;}function getInteractionsQuery(_0x2c0f48){var _0x2e950b=utils[_0x33b6('0x16')](_0x2c0f48);var _0x1d6633=utils[_0x33b6('0x5')](_0x2c0f48);var _0x3c67bf=utils['getInteractionFK'](_0x2c0f48);return squel[_0x33b6('0x8')]()[_0x33b6('0xc')](_0x2e950b[_0x33b6('0x17')],'i')[_0x33b6('0x12')](_0x33b6('0x18'),'c',_0x33b6('0x19'))[_0x33b6('0x12')](_0x33b6('0x13'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x2e950b[_0x33b6('0x1a')],'a',_0x33b6('0x1b')+_0x1d6633)['left_join'](_0x2e950b[_0x33b6('0x1c')],'me',_0x33b6('0x1d')+_0x3c67bf+'\x20=\x20i.id')['left_join'](_0x2e950b[_0x33b6('0x1e')],'it','it.'+_0x3c67bf+_0x33b6('0x1f'))[_0x33b6('0x12')](_0x33b6('0xd'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x3815d4={'body':squel[_0x33b6('0x20')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0x33b6('0x20')](),'filter':squel[_0x33b6('0x20')](),'read':squel[_0x33b6('0x20')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x33b6('0x20')]()};return _0x3815d4;}function parseTagParameter(_0x15133a){var _0x4aeb33=squel[_0x33b6('0x20')]();if(_0x15133a){var _0x17263f=utils[_0x33b6('0x21')](_0x15133a);_0x17263f[_0x33b6('0x22')](function(_0x155e7a){_0x4aeb33['or'](_0x33b6('0x23'),'%,'+_0x155e7a+',%');});}return _0x4aeb33;}function parseReadParameter(_0x425e7c){var _0x35b9d1='';if(_0x425e7c){_0x35b9d1=_0x33b6('0x24');if(_0x425e7c==='1'){_0x35b9d1=_0x35b9d1['replace']('{OPERATOR}','=');}else{_0x35b9d1=_0x35b9d1['replace']('{OPERATOR}','>');}}return _0x35b9d1;}function parseSearchFilter(_0x4e2317,_0x4d1188){var _0x331658=squel[_0x33b6('0x20')]();if(_0x4d1188){var _0x21299f=_0x4d1188['replace']('\x5c','\x5c\x5c')[_0x33b6('0x25')](/'/g,'\x27\x27');if(qs[_0x33b6('0x26')](_0x21299f)){_0x331658['or'](_0x33b6('0x27'),_0x21299f+'%');if([_0x33b6('0x28'),_0x33b6('0x29')][_0x33b6('0x2a')](_0x4e2317)){_0x331658['or'](_0x33b6('0x2b'),_0x21299f+'%');}else if(_0x4e2317==='fax'){_0x331658['or'](_0x33b6('0x2c'),_0x21299f+'%');}else if(_0x4e2317===_0x33b6('0x2d')){_0x331658['or'](_0x33b6('0x2e'),_0x21299f+'%');}}else if(_0x4e2317===_0x33b6('0x2f')&&qs[_0x33b6('0x30')](_0x21299f)){_0x331658['or']('c.email\x20LIKE\x20?',_0x21299f+'%');}else{if(_0x4e2317===_0x33b6('0x2f')){_0x331658['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x33b6('0x31')](_0x21299f,!![]))['or'](_0x33b6('0x32'),qs['getFullTextValue'](_0x21299f));}else if(_0x4e2317!==_0x33b6('0x33')){_0x331658['or'](_0x33b6('0x34'),qs[_0x33b6('0x31')](_0x21299f));}_0x331658['or'](_0x33b6('0x35'),qs[_0x33b6('0x31')](_0x21299f,!![]),null);}}return _0x331658;}function parseAdvancedSearchFilter(_0x33514e,_0x44a848){var _0x207f6b=getSqlClauses();var _0x4bcf46=as[_0x33b6('0x36')](_0x33514e);var _0x2caa5a=_0x4bcf46['sqlOperator'];for(var _0x195509=0x0;_0x195509<_0x4bcf46[_0x33b6('0x37')][_0x33b6('0x15')];_0x195509++){var _0x127dbf=_0x4bcf46[_0x33b6('0x37')][_0x195509];var _0xac62f1='i';var _0x588f84=_[_0x33b6('0x38')](_0x44a848,[_0x33b6('0xa'),_0x127dbf[_0x33b6('0x9')]]);if(_0x588f84){var _0x51edb2=as[_0x33b6('0x39')](_0xac62f1,_0x588f84[_0x33b6('0x3a')],_0x127dbf);_0x207f6b[_0x33b6('0x3b')][_0x2caa5a](_0x51edb2[_0x33b6('0x3c')],_0x51edb2[_0x33b6('0x3d')][_0x33b6('0x3e')],_0x51edb2[_0x33b6('0x3d')]['end']);}else{switch(_0x127dbf['field']){case'unreadMessages':var _0x5a8f1d=parseReadParameter(_0x127dbf['value']);_0x207f6b['read'][_0x33b6('0x3f')](_0x5a8f1d);break;case _0x33b6('0x40'):if(_0x127dbf[_0x33b6('0x41')]==='$substring'){if(_0x127dbf[_0x33b6('0x3d')][_0x33b6('0x42')]('\x20')[_0x33b6('0x15')]>0x1){_0x207f6b[_0x33b6('0x43')][_0x2caa5a](_0x33b6('0x35'),qs[_0x33b6('0x31')](_0x127dbf[_0x33b6('0x3d')],!![]),null);}else{var _0x2118a8='%'+_0x127dbf['value']+'%';_0x207f6b[_0x33b6('0x43')][_0x2caa5a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2118a8,_0x2118a8,_0x2118a8);}}else{_0x588f84=_['find'](_0x44a848,['name',_0x33b6('0x44')]);_0x127dbf[_0x33b6('0x9')]=_0x33b6('0x44');_0x51edb2=as[_0x33b6('0x39')](_0xac62f1,_0x588f84[_0x33b6('0x3a')],_0x127dbf);_0x207f6b[_0x33b6('0x43')][_0x2caa5a](_0x51edb2[_0x33b6('0x3c')],_0x51edb2['value'][_0x33b6('0x3e')],_0x51edb2[_0x33b6('0x3d')][_0x33b6('0x45')]);}break;case'Tag':var _0x2c2054=_0x127dbf[_0x33b6('0x3d')][_0x33b6('0x42')](',')[_0x33b6('0x46')](function(_0x3d91cd){return Number(_0x3d91cd);});var _0x5c1bd2=parseTagParameter(_0x2c2054);_0x207f6b[_0x33b6('0x47')][_0x33b6('0x48')]['and'](_0x5c1bd2);_0x207f6b[_0x33b6('0x47')][_0x33b6('0x49')]=_0x2c2054;break;case _0x33b6('0x4a'):if(_0x127dbf[_0x33b6('0x41')]===_0x33b6('0x4b')){_0x207f6b[_0x33b6('0x4c')][_0x2caa5a](_0x33b6('0x4d'),'%'+_0x127dbf[_0x33b6('0x3d')]+'%',null);}else{_0x588f84=_[_0x33b6('0x38')](_0x44a848,['name',_0x33b6('0x4e')]);_0x127dbf[_0x33b6('0x9')]='UserId';_0x51edb2=as[_0x33b6('0x39')](_0xac62f1,_0x588f84[_0x33b6('0x3a')],_0x127dbf);_0x207f6b[_0x33b6('0x4c')][_0x2caa5a](_0x51edb2[_0x33b6('0x3c')],_0x51edb2[_0x33b6('0x3d')][_0x33b6('0x3e')],_0x51edb2[_0x33b6('0x3d')][_0x33b6('0x45')]);}break;case _0x33b6('0x4f'):case _0x33b6('0x50'):_0x51edb2=as[_0x33b6('0x39')]('me',null,_0x127dbf);_0x207f6b[_0x33b6('0x4f')][_0x2caa5a](_0x51edb2[_0x33b6('0x3c')],_0x51edb2[_0x33b6('0x3d')][_0x33b6('0x3e')],_0x51edb2[_0x33b6('0x3d')][_0x33b6('0x45')]);break;}}}return _0x207f6b;}function parseModelFields(_0x533c34,_0x2fdfac,_0x204cce){var _0xefe302=utils[_0x33b6('0x5')](_0x533c34);var _0xe240c=squel[_0x33b6('0x20')]();var _0x820103=_(_0x2fdfac)[_0x33b6('0x51')]()['map'](function(_0x4965b9){return _[_0x33b6('0x52')](_0x204cce,[_0x33b6('0xa'),_0x4965b9])?_0x4965b9:undefined;})['compact']()[_0x33b6('0x3d')]();if(_0x820103[_0x33b6('0x15')]>0x0){_0x820103[_0x33b6('0x22')](function(_0x3c558){if(_0x3c558===_0xefe302){_0xe240c[_0x33b6('0x3f')]('i.'+_0xefe302+_0x33b6('0x53'),[]['concat'](_0x2fdfac[_0x3c558]));}else if(_0x3c558==='createdAt'){var _0x6f4762=JSON[_0x33b6('0x54')](_0x2fdfac[_0x3c558])[_0x33b6('0x55')];var _0x2b838f=JSON[_0x33b6('0x54')](_0x2fdfac[_0x3c558])[_0x33b6('0x56')];_0xe240c[_0x33b6('0x3f')](_0x33b6('0x57'),_0x6f4762,_0x2b838f);}else{if(_0x2fdfac[_0x3c558]===_0x33b6('0x58')){_0xe240c[_0x33b6('0x3f')]('i.'+_0x3c558+'\x20IS\x20NULL');}else{_0xe240c[_0x33b6('0x3f')]('i.'+_0x3c558+'\x20=\x20?',_0x2fdfac[_0x3c558]);}}});}return _0xe240c;}function parseQueryParameters(_0x542ffa,_0x4abfb5,_0x5cbf78){var _0x4fa079=getSqlClauses();return Promise['resolve']()[_0x33b6('0x59')](function(){return parseModelFields(_0x542ffa,_0x4abfb5,_0x5cbf78);})['then'](function(_0x21ad8f){_0x4fa079[_0x33b6('0x5a')][_0x33b6('0x3f')](_0x21ad8f);return parseReadParameter(_0x4abfb5['read']);})[_0x33b6('0x59')](function(_0x3b2d90){_0x4fa079[_0x33b6('0x5b')][_0x33b6('0x3f')](_0x3b2d90);return parseTagParameter(_0x4abfb5[_0x33b6('0x5c')]);})[_0x33b6('0x59')](function(_0x2b854a){_0x4fa079['tags'][_0x33b6('0x48')][_0x33b6('0x3f')](_0x2b854a);return parseSearchFilter(_0x542ffa,_0x4abfb5['filter']);})[_0x33b6('0x59')](function(_0x14af5e){_0x4fa079['filter']=_0x14af5e;return _0x4fa079;});}function checkAccountsRestrictions(_0x51d94f,_0x7f0b66,_0x2a5cfa){var _0x1b7e86=utils[_0x33b6('0x5')](_0x51d94f);var _0x136683=_0x33b6('0x5d')+_[_0x33b6('0x5e')](_0x51d94f)+(_0x51d94f===_0x33b6('0x5f')?_0x33b6('0x60'):'Accounts');var _0x3d4388=squel[_0x33b6('0x20')]();return Promise[_0x33b6('0x61')]()[_0x33b6('0x59')](function(){if(_0x2a5cfa[_0x33b6('0x62')]&&_0x7f0b66[_0x33b6('0x6')]==='agent'){return _0x7f0b66[_0x136683]({'attributes':['id'],'raw':!![]});}})[_0x33b6('0x59')](function(_0x2da253){if(_0x2da253){if(_0x2da253[_0x33b6('0x15')]===0x0){_0x3d4388['and']('i.'+_0x1b7e86+'\x20IS\x20NULL');}else{_0x3d4388[_0x33b6('0x3f')]('i.'+_0x1b7e86+_0x33b6('0x53'),_[_0x33b6('0x46')](_0x2da253,'id'));}}else if(!_0x2a5cfa[_0x1b7e86]){_0x3d4388['and']('i.'+_0x1b7e86+_0x33b6('0x63'));}})['then'](function(){return _0x3d4388;});}function getClosedOrderClause(_0x2437ba,_0x4b6aae){var _0x7debb3='';var _0xfaecf3=[_0x33b6('0x64'),_0x33b6('0x65'),'i.disposition'];if(_0x2437ba===_0x33b6('0x2f')){_0xfaecf3[_0x33b6('0x66')](_0x33b6('0x67'));}if(_0x4b6aae['closed']==='0'&&_0x2437ba==='mail'){_0x7debb3='i.substatus';}else{if(_0x4b6aae['closed']==='1'){_0xfaecf3['shift']();}_0x7debb3=_0x33b6('0x68')+_0xfaecf3[_0x33b6('0x69')](',\x20')+')';}return _0x7debb3;}function getFilteredInteractions(_0x2024c7,_0x2f7174,_0x114d9a,_0x3a7d24){var _0x18080e=utils['getInteractionFK'](_0x2024c7);var _0x195ad2=_[_0x33b6('0x5e')](_0x2024c7)+_0x33b6('0x6a');var _0xb4fd4e=[];var _0x581b8c=getTagsQuery();var _0x1a9688={'type':db[_0x33b6('0x6b')][_0x33b6('0x6c')]['SELECT'],'raw':!![]};var _0x211074=[];var _0x3dc8e9=[];return db[_0x33b6('0x6d')][_0x33b6('0x6e')](_0x581b8c[_0x33b6('0x6f')](),_0x1a9688)[_0x33b6('0x59')](function(_0x15c3b0){_0xb4fd4e=_[_0x33b6('0x70')](_0x15c3b0,'id');_0x1a9688=_[_0x33b6('0x71')](_0x1a9688,{'model':db[_0x195ad2],'mapToModel':!![],'nest':!![]});if(_0x114d9a[_0x33b6('0x5a')]){_0x3a7d24[_0x33b6('0x72')]['forEach'](function(_0x18ad7b){_0x2f7174['field']('i.'+_0x18ad7b);});}else{_0x2f7174[_0x33b6('0x9')](_0x33b6('0x73'),_0x33b6('0x74'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x75'),'Account.key');_0x2f7174[_0x33b6('0x9')](_0x33b6('0x76'),_0x33b6('0x77'));if(_0x2024c7===_0x33b6('0x2f')){_0x2f7174[_0x33b6('0x9')]('a.email',_0x33b6('0x78'));_0x2f7174['field'](_0x33b6('0x79'),_0x33b6('0x7a'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x7b'));_0x2f7174[_0x33b6('0x9')]('i.createdAt');_0x2f7174[_0x33b6('0x9')](_0x33b6('0x7c'));_0x2f7174['field'](_0x33b6('0x7d'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x7e'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x7f'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x80'));_0x2f7174['field'](_0x33b6('0x81'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x82'));_0x2f7174['field'](_0x33b6('0x83'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x65'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x64'));_0x2f7174[_0x33b6('0x9')]('i.substatus');_0x2f7174['field'](_0x33b6('0x84'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x85'));_0x2f7174[_0x33b6('0x9')]('i.MailAccountId');_0x2f7174[_0x33b6('0x9')]('i.UserId');}else if(_0x2024c7===_0x33b6('0x2d')){_0x2f7174[_0x33b6('0x9')]('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',_0x33b6('0x7a'));}else{_0x2f7174[_0x33b6('0x9')](_0x33b6('0x86'),'contactName');}if(_0x2024c7!==_0x33b6('0x2f')){_0x2f7174['field']('i.*');}_0x2f7174[_0x33b6('0x9')](_0x33b6('0x87'),'Contact.firstName');_0x2f7174[_0x33b6('0x9')](_0x33b6('0x88'),_0x33b6('0x89'));_0x2f7174['field'](_0x33b6('0x8a'),_0x33b6('0x8b'));_0x2f7174['field'](_0x33b6('0x8c'),_0x33b6('0x8d'));_0x2f7174['field'](_0x33b6('0x8e'),_0x33b6('0x8f'));_0x2f7174[_0x33b6('0x9')]('c.fax',_0x33b6('0x90'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x91'),_0x33b6('0x92'));_0x2f7174[_0x33b6('0x9')](_0x33b6('0x93'),'Owner.internal');_0x2f7174['field'](_0x33b6('0x94'),_0x33b6('0x95'));}if(_0x3a7d24[_0x33b6('0x96')]){_0x2f7174[_0x33b6('0x96')](_0x3a7d24['limit']);}if(_0x3a7d24[_0x33b6('0x97')]){_0x2f7174['offset'](_0x3a7d24[_0x33b6('0x97')]);}return db['sequelize']['query'](_0x2f7174[_0x33b6('0x6f')](),_0x1a9688);})['then'](function(_0x2a1d4f){_0x211074=_0x2a1d4f;var _0x45a1ab=getUsersQuery(_0x2024c7,_0x211074);return db[_0x33b6('0x6d')][_0x33b6('0x6e')](_0x45a1ab[_0x33b6('0x6f')](),_0x1a9688);})[_0x33b6('0x59')](function(_0x17a3b9){_0x3dc8e9=_[_0x33b6('0x98')](_0x17a3b9,_0x18080e);if(_0x2024c7==='mail'){return db[_0x33b6('0x99')][_0x33b6('0x9a')]({'attributes':[_0x33b6('0x9b')],'raw':!![]});}})['then'](function(_0x784065){var _0x31f0b2=_0x784065?_0x784065[_0x33b6('0x9b')]:undefined;var _0x29901d=_0x211074[_0x33b6('0x46')](function(_0x3d9b91){return updateInteraction(_0x3d9b91,_0xb4fd4e,_0x3dc8e9,_0x31f0b2);});return Promise[_0x33b6('0x9c')](_0x29901d);});}function countFilteredInteractions(_0x391bdf,_0xe43447){var _0x4cd283=_0x391bdf[_0x33b6('0x9d')]();_0x4cd283[_0x33b6('0x9')]('COUNT(*)');_0x4cd283[_0x33b6('0x9')](_0x33b6('0x73'),_0x33b6('0x74'));var _0x16f27b=utils[_0x33b6('0x21')](_0xe43447);if(!_[_0x33b6('0x9e')](_0x16f27b)){_0x4cd283[_0x33b6('0x9f')](_0x33b6('0xa0'),_0x16f27b);}var _0xd8f05e={'type':db[_0x33b6('0x6b')][_0x33b6('0x6c')][_0x33b6('0xa1')],'raw':!![]};return db[_0x33b6('0x6d')][_0x33b6('0x6e')](_0x4cd283[_0x33b6('0x6f')](),_0xd8f05e);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index fb22938..9aa8c32 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53c2=['trimStart','catch','updateInteraction','Users','TagIds','Tags','map','waiting','talking','answered','unmanaged','abandoned','closed','disposition','UserId','total','MailMessage','findOne','out','plainBody','-id','then','lastMsgText'];(function(_0x524b78,_0x4d1c13){var _0x4f42fd=function(_0x195a26){while(--_0x195a26){_0x524b78['push'](_0x524b78['shift']());}};_0x4f42fd(++_0x4d1c13);}(_0x53c2,0x18d));var _0x253c=function(_0x402ff8,_0x1bb2a6){_0x402ff8=_0x402ff8-0x0;var _0x36f9d7=_0x53c2[_0x402ff8];return _0x36f9d7;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x22955d,_0x2aa12e){return new Promise(function(_0x26fc2d,_0xc20cbb){try{var _0x700909=[];if(_0x2aa12e[_0x22955d]){_0x700909=_0x2aa12e[_0x22955d][_0x253c('0x0')](function(_0x19e68d){return{'id':_0x19e68d['id'],'fullname':_0x19e68d['fullname']};});}return _0x26fc2d(_0x700909);}catch(_0xb3c1dd){_0xc20cbb(_0xb3c1dd);}});}function getInteractionTags(_0x549f22,_0x2196fb){var _0x566418=[];if(_0x549f22){_0x549f22['split'](',')['forEach'](function(_0x148def){_0x566418['push'](_0x2196fb[_0x148def]);});}return _0x566418;}function updateWaitingCounter(_0x1c55ef){if(_0x1c55ef['waiting']){_0x1c55ef[_0x253c('0x1')]-=0x1;}}function updateInteractionCounters(_0x417ca9){_0x417ca9[_0x253c('0x1')]=0x0;_0x417ca9[_0x253c('0x2')]=0x0;_0x417ca9[_0x253c('0x3')]=0x0;_0x417ca9[_0x253c('0x4')]=0x0;_0x417ca9[_0x253c('0x5')]=0x0;_0x417ca9['total']=0x0;if(_0x417ca9[_0x253c('0x6')]){if(_0x417ca9[_0x253c('0x7')]===_0x253c('0x5')){_0x417ca9[_0x253c('0x5')]+=0x1;updateWaitingCounter(_0x417ca9);}if(_0x417ca9[_0x253c('0x8')]){_0x417ca9['answered']+=0x1;if(_0x417ca9[_0x253c('0x2')]){_0x417ca9['talking']-=0x1;}}else{if(_0x417ca9[_0x253c('0x7')]){_0x417ca9[_0x253c('0x4')]+=0x1;updateWaitingCounter(_0x417ca9);}}}else{if(!_0x417ca9[_0x253c('0x8')]){_0x417ca9['waiting']+=0x1;}if(_0x417ca9['UserId']){_0x417ca9[_0x253c('0x2')]+=0x1;updateWaitingCounter(_0x417ca9);}}_0x417ca9[_0x253c('0x9')]+=0x1;return _0x417ca9;}function getLastMessageText(_0x1fb1f0){return db[_0x253c('0xa')][_0x253c('0xb')]({'where':{'$and':[{'MailInteractionId':_0x1fb1f0['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x253c('0xc')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x253c('0xd')],'order':_0x253c('0xe'),'raw':!![]})[_0x253c('0xf')](function(_0x2bfd1c){if(_0x2bfd1c&&_0x2bfd1c[_0x253c('0xd')]){_0x1fb1f0[_0x253c('0x10')]=_[_0x253c('0x11')](_0x2bfd1c[_0x253c('0xd')]);}return _0x1fb1f0;})[_0x253c('0x12')](function(_0xd3b8b4){throw _0xd3b8b4;});}exports[_0x253c('0x13')]=function(_0x10b7ac,_0x200bae,_0x26b1cb,_0x31f017){return new Promise(function(_0x1e9470,_0x52fd07){return getInteractionUsers(_0x10b7ac['id'],_0x26b1cb)[_0x253c('0xf')](function(_0x48e250){_0x10b7ac[_0x253c('0x14')]=_0x48e250;return getInteractionTags(_0x10b7ac[_0x253c('0x15')],_0x200bae);})[_0x253c('0xf')](function(_0x5733cb){_0x10b7ac[_0x253c('0x16')]=_0x5733cb;delete _0x10b7ac['TagIds'];return updateInteractionCounters(_0x10b7ac);})['then'](function(_0x459d60){if(_0x31f017){return getLastMessageText(_0x459d60);}else{return _0x459d60;}})[_0x253c('0xf')](function(_0xcb20a0){_0x1e9470(_0xcb20a0);})['catch'](function(_0x2c7406){_0x52fd07(_0x2c7406);});});}; \ No newline at end of file +var _0x5192=['disposition','unmanaged','UserId','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','then','Users','TagIds','Tags','lodash','fullname','push','waiting','talking','abandoned','total'];(function(_0x1c60c2,_0x40927f){var _0x419518=function(_0x1df581){while(--_0x1df581){_0x1c60c2['push'](_0x1c60c2['shift']());}};_0x419518(++_0x40927f);}(_0x5192,0x101));var _0x2519=function(_0x213d18,_0x523ee2){_0x213d18=_0x213d18-0x0;var _0x534cdf=_0x5192[_0x213d18];return _0x534cdf;};'use strict';var _=require(_0x2519('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0xca51fc,_0x22f746){return new Promise(function(_0x4d34ee,_0x2748a1){try{var _0x48ee19=[];if(_0x22f746[_0xca51fc]){_0x48ee19=_0x22f746[_0xca51fc]['map'](function(_0x2f1e37){return{'id':_0x2f1e37['id'],'fullname':_0x2f1e37[_0x2519('0x1')]};});}return _0x4d34ee(_0x48ee19);}catch(_0x3282a0){_0x2748a1(_0x3282a0);}});}function getInteractionTags(_0x16763e,_0xbcc886){var _0x2d9349=[];if(_0x16763e){_0x16763e['split'](',')['forEach'](function(_0x2c9fae){_0x2d9349[_0x2519('0x2')](_0xbcc886[_0x2c9fae]);});}return _0x2d9349;}function updateWaitingCounter(_0x121b95){if(_0x121b95[_0x2519('0x3')]){_0x121b95[_0x2519('0x3')]-=0x1;}}function updateInteractionCounters(_0x46d21){_0x46d21[_0x2519('0x3')]=0x0;_0x46d21[_0x2519('0x4')]=0x0;_0x46d21['answered']=0x0;_0x46d21['unmanaged']=0x0;_0x46d21[_0x2519('0x5')]=0x0;_0x46d21[_0x2519('0x6')]=0x0;if(_0x46d21['closed']){if(_0x46d21[_0x2519('0x7')]===_0x2519('0x5')){_0x46d21[_0x2519('0x5')]+=0x1;updateWaitingCounter(_0x46d21);}if(_0x46d21['UserId']){_0x46d21['answered']+=0x1;if(_0x46d21['talking']){_0x46d21[_0x2519('0x4')]-=0x1;}}else{if(_0x46d21[_0x2519('0x7')]){_0x46d21[_0x2519('0x8')]+=0x1;updateWaitingCounter(_0x46d21);}}}else{if(!_0x46d21['UserId']){_0x46d21[_0x2519('0x3')]+=0x1;}if(_0x46d21[_0x2519('0x9')]){_0x46d21[_0x2519('0x4')]+=0x1;updateWaitingCounter(_0x46d21);}}_0x46d21[_0x2519('0x6')]+=0x1;return _0x46d21;}function getLastMessageText(_0x3c9f06){return db['MailMessage'][_0x2519('0xa')]({'where':{'$and':[{'MailInteractionId':_0x3c9f06['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2519('0xb')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2519('0xc')],'order':_0x2519('0xd'),'raw':!![]})['then'](function(_0x151906){if(_0x151906&&_0x151906[_0x2519('0xc')]){_0x3c9f06[_0x2519('0xe')]=_[_0x2519('0xf')](_0x151906[_0x2519('0xc')]);}return _0x3c9f06;})[_0x2519('0x10')](function(_0x179393){throw _0x179393;});}exports[_0x2519('0x11')]=function(_0x5610ac,_0x37fe7f,_0x4a85b3,_0x1ef5c9){return new Promise(function(_0xd57664,_0x1ed296){return getInteractionUsers(_0x5610ac['id'],_0x4a85b3)[_0x2519('0x12')](function(_0xd13c89){_0x5610ac[_0x2519('0x13')]=_0xd13c89;return getInteractionTags(_0x5610ac[_0x2519('0x14')],_0x37fe7f);})[_0x2519('0x12')](function(_0x59fba6){_0x5610ac[_0x2519('0x15')]=_0x59fba6;delete _0x5610ac[_0x2519('0x14')];return updateInteractionCounters(_0x5610ac);})['then'](function(_0x27af37){if(_0x1ef5c9){return getLastMessageText(_0x27af37);}else{return _0x27af37;}})[_0x2519('0x12')](function(_0x3dd9ab){_0xd57664(_0x3dd9ab);})[_0x2519('0x10')](function(_0x1e16d5){_0x1ed296(_0x1e16d5);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 4a700d1..c5718bc 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24cb=['upperFirst','unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','findOne','then','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','chat-interactions','chat','Website','Account','capitalize','InteractionId'];(function(_0x2f57b2,_0xa8e91a){var _0x5ace77=function(_0x59c00a){while(--_0x59c00a){_0x2f57b2['push'](_0x2f57b2['shift']());}};_0x5ace77(++_0xa8e91a);}(_0x24cb,0xf5));var _0xb24c=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x24cb[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xb24c('0x0'));var db=require(_0xb24c('0x1'))['db'];var loggers={'openchannel':require(_0xb24c('0x2'))('openchannel-interactions'),'mail':require('../../config/logger')(_0xb24c('0x3')),'fax':require(_0xb24c('0x2'))(_0xb24c('0x4')),'sms':require(_0xb24c('0x2'))('sms-interactions'),'chat':require('../../config/logger')(_0xb24c('0x5')),'whatsapp':require(_0xb24c('0x2'))('whatsapp-interactions')};function getAccountFK(_0x315da4){return _['capitalize'](_0x315da4)+(_0x315da4===_0xb24c('0x6')?_0xb24c('0x7'):_0xb24c('0x8'))+'Id';}function getInteractionFK(_0x209398){return _[_0xb24c('0x9')](_0x209398)+_0xb24c('0xa');}function getInteractionId(_0x38737c,_0x5691e2,_0x5bf725){if(_0x38737c&&_0x38737c[_[_0xb24c('0xb')](_0x5bf725)+_0xb24c('0xa')]){return _0x38737c[_[_0xb24c('0xb')](_0x5bf725)+_0xb24c('0xa')];}else if(_0x38737c&&_0x38737c['id']){return _0x38737c['id'];}else if(_0x5691e2&&_0x5691e2['id']){return _0x5691e2['id'];}else{return _0xb24c('0xc');}}function getInteractionsTables(_0x41df97){return{'accounts':_0x41df97+'_'+(_0x41df97===_0xb24c('0x6')?'websites':_0xb24c('0xd')),'interactions':_0x41df97+_0xb24c('0xe'),'interactionsTags':_0x41df97+_0xb24c('0xf'),'messages':_0x41df97+_0xb24c('0x10'),'userInteractions':_0xb24c('0x11')+_0x41df97+_0xb24c('0xe')};}function getSelectedTags(_0x4edbc9){var _0x5a62ec=[];if(_0x4edbc9){_0x5a62ec=Array[_0xb24c('0x12')](_0x4edbc9)?_0x4edbc9:[_0x4edbc9];}return _0x5a62ec;}function log(_0x29357b,_0x5a87fa,_0x45db65,_0x515523,_0x48f502,_0x200137){loggers[_0x48f502[_0xb24c('0x13')]()][_0x29357b](_0xb24c('0x14'),_0x200137[_0xb24c('0x15')](),_0x5a87fa?_0x5a87fa['id']:null,_0x5a87fa?_0x5a87fa[_0xb24c('0x16')]:null,_0x5a87fa?_0x5a87fa[_0xb24c('0x17')]:null,getInteractionId(_0x45db65,_0x515523,_0x48f502),_0x45db65?JSON[_0xb24c('0x18')](_0x45db65):_0xb24c('0x19'));}function updateUser(_0x245c9e,_0x367ea6,_0x3cbb6c,_0x1d077a,_0x5491f5){db[_['upperFirst'](_0x1d077a)+'Interaction'][_0xb24c('0x1a')]({'where':{'id':getInteractionId(_0x367ea6,_0x3cbb6c,_0x1d077a)}})[_0xb24c('0x1b')](function(_0x4cab12){if(_0x4cab12){return _0x4cab12['update']({'UserId':_0x245c9e?_0x245c9e['id']:null});}})['then'](function(_0x3e80fb){if(_0x3e80fb){log(_0xb24c('0x1c'),_0x245c9e,_0x367ea6,_0x3cbb6c,_0x1d077a,_0x5491f5);}})[_0xb24c('0x1d')](function(){log(_0xb24c('0x1e'),_0x245c9e,_0x367ea6,_0x3cbb6c,_0x1d077a,_0x5491f5);});}module[_0xb24c('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x4425=['catch','error','exports','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_messages','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','stringify','Interaction','findOne','then','update','info'];(function(_0x5ceb9e,_0x395877){var _0xb5a999=function(_0x7f938f){while(--_0x7f938f){_0x5ceb9e['push'](_0x5ceb9e['shift']());}};_0xb5a999(++_0x395877);}(_0x4425,0x1e3));var _0x5442=function(_0x297777,_0x8716){_0x297777=_0x297777-0x0;var _0x494a61=_0x4425[_0x297777];return _0x494a61;};'use strict';var _=require(_0x5442('0x0'));var db=require(_0x5442('0x1'))['db'];var loggers={'openchannel':require(_0x5442('0x2'))('openchannel-interactions'),'mail':require('../../config/logger')(_0x5442('0x3')),'fax':require('../../config/logger')(_0x5442('0x4')),'sms':require(_0x5442('0x2'))(_0x5442('0x5')),'chat':require(_0x5442('0x2'))(_0x5442('0x6')),'whatsapp':require(_0x5442('0x2'))(_0x5442('0x7'))};function getAccountFK(_0x3f02cf){return _[_0x5442('0x8')](_0x3f02cf)+(_0x3f02cf===_0x5442('0x9')?_0x5442('0xa'):_0x5442('0xb'))+'Id';}function getInteractionFK(_0x3af103){return _[_0x5442('0x8')](_0x3af103)+_0x5442('0xc');}function getInteractionId(_0x4f47cb,_0x9fe4f3,_0xe80d67){if(_0x4f47cb&&_0x4f47cb[_[_0x5442('0xd')](_0xe80d67)+_0x5442('0xc')]){return _0x4f47cb[_[_0x5442('0xd')](_0xe80d67)+_0x5442('0xc')];}else if(_0x4f47cb&&_0x4f47cb['id']){return _0x4f47cb['id'];}else if(_0x9fe4f3&&_0x9fe4f3['id']){return _0x9fe4f3['id'];}else{return _0x5442('0xe');}}function getInteractionsTables(_0xb54c5a){return{'accounts':_0xb54c5a+'_'+(_0xb54c5a==='chat'?_0x5442('0xf'):_0x5442('0x10')),'interactions':_0xb54c5a+'_interactions','interactionsTags':_0xb54c5a+'_interaction_has_tags','messages':_0xb54c5a+_0x5442('0x11'),'userInteractions':'user_has_'+_0xb54c5a+_0x5442('0x12')};}function getSelectedTags(_0x14309c){var _0x3c2f0f=[];if(_0x14309c){_0x3c2f0f=Array[_0x5442('0x13')](_0x14309c)?_0x14309c:[_0x14309c];}return _0x3c2f0f;}function log(_0x1fadfc,_0x36e562,_0x107090,_0x28c6ec,_0x158542,_0x1ce653){loggers[_0x158542[_0x5442('0x14')]()][_0x1fadfc](_0x5442('0x15'),_0x1ce653[_0x5442('0x16')](),_0x36e562?_0x36e562['id']:null,_0x36e562?_0x36e562['name']:null,_0x36e562?_0x36e562['role']:null,getInteractionId(_0x107090,_0x28c6ec,_0x158542),_0x107090?JSON[_0x5442('0x17')](_0x107090):'null');}function updateUser(_0x20742a,_0x1df857,_0x4bb0ed,_0xed716e,_0x3d3338){db[_['upperFirst'](_0xed716e)+_0x5442('0x18')][_0x5442('0x19')]({'where':{'id':getInteractionId(_0x1df857,_0x4bb0ed,_0xed716e)}})[_0x5442('0x1a')](function(_0x21a3b6){if(_0x21a3b6){return _0x21a3b6[_0x5442('0x1b')]({'UserId':_0x20742a?_0x20742a['id']:null});}})['then'](function(_0x30d597){if(_0x30d597){log(_0x5442('0x1c'),_0x20742a,_0x1df857,_0x4bb0ed,_0xed716e,_0x3d3338);}})[_0x5442('0x1d')](function(){log(_0x5442('0x1e'),_0x20742a,_0x1df857,_0x4bb0ed,_0xed716e,_0x3d3338);});}module[_0x5442('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index bd4a7f7..bdf74ed 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 _0x18ff=['../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','update','base64','utf8','final','hasOwnProperty','use','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','crypto','util','composable-middleware'];(function(_0x1ec521,_0x3236ef){var _0x2c32da=function(_0x31e126){while(--_0x31e126){_0x1ec521['push'](_0x1ec521['shift']());}};_0x2c32da(++_0x3236ef);}(_0x18ff,0x69));var _0xf18f=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x18ff[_0x2b5eae];return _0x5f3ac9;};'use strict';var crypto=require(_0xf18f('0x0'));var util=require(_0xf18f('0x1'));var compose=require(_0xf18f('0x2'));var db=require(_0xf18f('0x3'))['db'];var config=require(_0xf18f('0x4'));function getValueFromLicense(_0x4a8224,_0x48e393){if(_0x4a8224&&_0x48e393){if(_0x48e393[_0xf18f('0x5')]&&_0x48e393[_0xf18f('0x6')]){var _0x728008=_0x48e393[_0xf18f('0x5')];var _0x274c7a=_0x48e393[_0xf18f('0x6')];var _0x32feb0=_0x728008[_0xf18f('0x7')]('-')[0x4];var _0x3845fc=_0x728008['split']('-')[0x0];var _0x693240=crypto[_0xf18f('0x8')](_0xf18f('0x9'),util[_0xf18f('0xa')]('%s:%s:%s',_0x32feb0,_0x728008,_0x3845fc));var _0x5cba19=_0x693240[_0xf18f('0xb')](_0x274c7a,_0xf18f('0xc'),_0xf18f('0xd'));_0x5cba19+=_0x693240[_0xf18f('0xe')](_0xf18f('0xd'));var _0x42d5d1=JSON['parse'](_0x5cba19);return _0x42d5d1[_0xf18f('0xf')](_0x4a8224)?_0x42d5d1[_0x4a8224]:null;}}return null;}function isLimit(_0x1f7858,_0x2716f3,_0x3b2c18,_0x37aa32){var _0xd256f4=_0x2716f3;return compose()[_0xf18f('0x10')](function(_0x30f2f7,_0x1efcf2,_0x3807e1){return db['License'][_0xf18f('0x11')]({'where':{'id':0x1},'raw':!![]})[_0xf18f('0x12')](function(_0x3ba544){var _0x59907e=getValueFromLicense(_0x1f7858,_0x3ba544);return _0x59907e?_0x59907e:_0xd256f4;})[_0xf18f('0x12')](function(_0x5eb786){_0xd256f4=_0x5eb786;return _0x3b2c18['count'](_0x37aa32);})['then'](function(_0x4d9234){if(_0x4d9234>=_0xd256f4){return _0x1efcf2[_0xf18f('0x13')](0x193)[_0xf18f('0x14')]({'message':util[_0xf18f('0xa')](_0xf18f('0x15'),_0x1f7858)});}_0x3807e1();})[_0xf18f('0x16')](function(_0x55a1d4){_0x3807e1(_0x55a1d4);});});}function isUserLimit(){return isLimit(_0xf18f('0x17'),0x1,db[_0xf18f('0x18')],{'where':{'$or':[{'role':_0xf18f('0x19')},{'role':'user'}]}});}exports[_0xf18f('0x1a')]=isUserLimit; \ No newline at end of file +var _0x86bc=['status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','isUserLimit','crypto','composable-middleware','../../mysqldb','data1','license','split','format','update','base64','utf8','final','parse','use','License','findOne','then','count'];(function(_0x1114e0,_0x237b02){var _0xc5b786=function(_0x1252ba){while(--_0x1252ba){_0x1114e0['push'](_0x1114e0['shift']());}};_0xc5b786(++_0x237b02);}(_0x86bc,0x19f));var _0xc86b=function(_0x42fed7,_0x536879){_0x42fed7=_0x42fed7-0x0;var _0x507960=_0x86bc[_0x42fed7];return _0x507960;};'use strict';var crypto=require(_0xc86b('0x0'));var util=require('util');var compose=require(_0xc86b('0x1'));var db=require(_0xc86b('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0xa6ebd0,_0x105ca3){if(_0xa6ebd0&&_0x105ca3){if(_0x105ca3[_0xc86b('0x3')]&&_0x105ca3[_0xc86b('0x4')]){var _0x2ed332=_0x105ca3[_0xc86b('0x3')];var _0x2548cb=_0x105ca3['license'];var _0x4877ca=_0x2ed332[_0xc86b('0x5')]('-')[0x4];var _0x4b3c7a=_0x2ed332[_0xc86b('0x5')]('-')[0x0];var _0x363552=crypto['createDecipher']('aes-256-ctr',util[_0xc86b('0x6')]('%s:%s:%s',_0x4877ca,_0x2ed332,_0x4b3c7a));var _0x18e687=_0x363552[_0xc86b('0x7')](_0x2548cb,_0xc86b('0x8'),_0xc86b('0x9'));_0x18e687+=_0x363552[_0xc86b('0xa')]('utf8');var _0x52dd27=JSON[_0xc86b('0xb')](_0x18e687);return _0x52dd27['hasOwnProperty'](_0xa6ebd0)?_0x52dd27[_0xa6ebd0]:null;}}return null;}function isLimit(_0x546001,_0x1076c9,_0x3ec1fd,_0x17993e){var _0x3988b7=_0x1076c9;return compose()[_0xc86b('0xc')](function(_0x1ebb2a,_0x32e063,_0x42dd28){return db[_0xc86b('0xd')][_0xc86b('0xe')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x990557){var _0x535e1f=getValueFromLicense(_0x546001,_0x990557);return _0x535e1f?_0x535e1f:_0x3988b7;})[_0xc86b('0xf')](function(_0x490682){_0x3988b7=_0x490682;return _0x3ec1fd[_0xc86b('0x10')](_0x17993e);})[_0xc86b('0xf')](function(_0x36ba44){if(_0x36ba44>=_0x3988b7){return _0x32e063[_0xc86b('0x11')](0x193)[_0xc86b('0x12')]({'message':util[_0xc86b('0x6')](_0xc86b('0x13'),_0x546001)});}_0x42dd28();})['catch'](function(_0x242859){_0x42dd28(_0x242859);});});}function isUserLimit(){return isLimit(_0xc86b('0x14'),0x1,db[_0xc86b('0x15')],{'where':{'$or':[{'role':_0xc86b('0x16')},{'role':'user'}]}});}exports[_0xc86b('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index ad854cb..268fafb 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 _0x5b39=['sqlOperator','startsWith','[$or]','replace','split','slice','forEach','shift','match','indexOf','conditions','push','DATE','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','$eq','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$gte','>=\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','parseSearch'];(function(_0x1d787c,_0x93ff5){var _0x149f08=function(_0x318641){while(--_0x318641){_0x1d787c['push'](_0x1d787c['shift']());}};_0x149f08(++_0x93ff5);}(_0x5b39,0x19e));var _0x95b3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5b39[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x95b3('0x0'));var moment=require('moment');exports[_0x95b3('0x1')]=function(_0x5f54cd){var _0x438a8f={'conditions':[]};_0x438a8f[_0x95b3('0x2')]=_[_0x95b3('0x3')](_0x5f54cd,_0x95b3('0x4'))?'or':'and';var _0x5963c6=_0x5f54cd['replace']('[$and]','')[_0x95b3('0x5')](_0x95b3('0x4'),'')['split']('||');for(var _0xb5ae1c=0x0;_0xb5ae1c<_0x5963c6['length'];_0xb5ae1c++){var _0xdd4e7f=_0x5963c6[_0xb5ae1c][_0x95b3('0x6')](':=');var _0x4610f0=_0xdd4e7f[0x0];var _0x5cbc38=_0xdd4e7f[_0x95b3('0x7')](0x1);_0x5cbc38[_0x95b3('0x8')](function(_0x2b476c){var _0x33ff90=_0x2b476c[_0x95b3('0x6')]('[')[_0x95b3('0x9')]();var _0x28c0b2=_0x2b476c[_0x95b3('0xa')](/\[(.*?)\]/g);_0x28c0b2[_0x95b3('0x8')](function(_0x4dfee6){var _0x411492=_0x4dfee6[_0x95b3('0x6')]('[')['filter'](function(_0x739392){return _0x739392[_0x95b3('0xb')](']')>-0x1;})['map'](function(_0x534680){return _0x534680[_0x95b3('0x6')](']')[0x0];})[0x0];_0x438a8f[_0x95b3('0xc')][_0x95b3('0xd')]({'field':_0x4610f0,'operator':_0x33ff90,'value':_0x411492});});});}return _0x438a8f;};exports['buildExpression']=function(_0x2de7fd,_0x1ac449,_0x3363df){var _0x15087d={};if(_0x1ac449===_0x95b3('0xe')){if(_0x3363df[_0x95b3('0xf')]==='$eq'){_0x3363df[_0x95b3('0xf')]=_0x95b3('0x10');_0x3363df[_0x95b3('0x11')]+=','+_0x3363df[_0x95b3('0x11')];}else if(_[_0x95b3('0x12')]([_0x95b3('0x13'),_0x95b3('0x14')],_0x3363df[_0x95b3('0xf')])){_0x3363df[_0x95b3('0x11')]=moment(_0x3363df[_0x95b3('0x11')])[_0x95b3('0x15')](0x1,_0x95b3('0x16'))[_0x95b3('0x17')](_0x95b3('0x18'));}}if(_0x3363df[_0x95b3('0x19')]){_0x1ac449=_0x3363df['castTo'];_0x15087d[_0x95b3('0x1a')]=_0x95b3('0x1b')+_0x2de7fd+'.'+_0x3363df[_0x95b3('0x1c')]+_0x95b3('0x1d')+_0x3363df[_0x95b3('0x19')]+')\x20'+parseOperator(_0x3363df[_0x95b3('0xf')]);}else{_0x15087d[_0x95b3('0x1a')]=_0x2de7fd+'.'+_0x3363df['field']+'\x20'+parseOperator(_0x3363df[_0x95b3('0xf')]);}if(_[_0x95b3('0x12')](['$ne',_0x95b3('0x1e')],_0x3363df['operator']))_0x15087d[_0x95b3('0x1a')]='('+_0x15087d['text']+'\x20OR\x20'+_0x2de7fd+'.'+_0x3363df[_0x95b3('0x1c')]+_0x95b3('0x1f');_0x15087d['value']=parseValue(_0x1ac449,_0x3363df[_0x95b3('0xf')],_0x3363df[_0x95b3('0x11')]);return _0x15087d;};function parseOperator(_0x2ee176){var _0x1c12e9;switch(_0x2ee176){case _0x95b3('0x20'):_0x1c12e9='IN\x20?';break;case _0x95b3('0x1e'):_0x1c12e9=_0x95b3('0x21');break;case _0x95b3('0x22'):_0x1c12e9=_0x95b3('0x23');break;case _0x95b3('0x24'):_0x1c12e9=_0x95b3('0x25');break;case _0x95b3('0x26'):case _0x95b3('0x27'):case _0x95b3('0x28'):_0x1c12e9='LIKE\x20?';break;case _0x95b3('0x29'):_0x1c12e9=_0x95b3('0x2a');break;case'$gt':_0x1c12e9=_0x95b3('0x2b');break;case _0x95b3('0x14'):_0x1c12e9='<=\x20?';break;case _0x95b3('0x2c'):_0x1c12e9=_0x95b3('0x2d');break;case _0x95b3('0x10'):_0x1c12e9='BETWEEN\x20?\x20AND\x20?';break;}return _0x1c12e9;}function parseValue(_0x3b8a7c,_0x5de5ca,_0x580383){var _0x171dc7={'start':undefined,'end':undefined};switch(_0x5de5ca){case _0x95b3('0x20'):case'$notIn':_0x171dc7['start']=_0x580383[_0x95b3('0x6')](',');break;case _0x95b3('0x26'):_0x171dc7[_0x95b3('0x2e')]='%'+_0x580383+'%';break;case _0x95b3('0x27'):_0x171dc7[_0x95b3('0x2e')]=_0x580383+'%';break;case _0x95b3('0x28'):_0x171dc7[_0x95b3('0x2e')]='%'+_0x580383;break;case _0x95b3('0x10'):var _0x2beb41=_0x580383['split'](',');var _0x580383=_0x2beb41[_0x95b3('0x9')]();var _0x30f269=_0x2beb41[_0x95b3('0x2f')]();if(_0x3b8a7c===_0x95b3('0xe')){_0x580383=moment(_0x580383)[_0x95b3('0x30')](0x0,!![])[_0x95b3('0x17')]();_0x30f269=moment(_0x30f269)[_0x95b3('0x30')](0x0,!![])[_0x95b3('0x15')](0x17,_0x95b3('0x31'))[_0x95b3('0x15')](0x3b,_0x95b3('0x32'))[_0x95b3('0x15')](0x3b,_0x95b3('0x33'))[_0x95b3('0x17')]();}_0x171dc7={'start':_0x580383,'end':_0x30f269};break;default:_0x171dc7[_0x95b3('0x2e')]=_0x580383;break;}return _0x171dc7;} \ No newline at end of file +var _0x4b88=['field','\x20AS\x20','$ne','$notIn','$in','IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','add','hours','minutes','seconds','lodash','moment','startsWith','[$or]','and','[$and]','split','length','forEach','shift','map','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST('];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x4b88,0xb6));var _0x84b8=function(_0x5133c6,_0x8f3d2){_0x5133c6=_0x5133c6-0x0;var _0x1e2557=_0x4b88[_0x5133c6];return _0x1e2557;};'use strict';var _=require(_0x84b8('0x0'));var moment=require(_0x84b8('0x1'));exports['parseSearch']=function(_0x290017){var _0x466194={'conditions':[]};_0x466194['sqlOperator']=_[_0x84b8('0x2')](_0x290017,_0x84b8('0x3'))?'or':_0x84b8('0x4');var _0x1ed82d=_0x290017['replace'](_0x84b8('0x5'),'')['replace'](_0x84b8('0x3'),'')[_0x84b8('0x6')]('||');for(var _0x562852=0x0;_0x562852<_0x1ed82d[_0x84b8('0x7')];_0x562852++){var _0x3cbc09=_0x1ed82d[_0x562852][_0x84b8('0x6')](':=');var _0x94593b=_0x3cbc09[0x0];var _0x120e74=_0x3cbc09['slice'](0x1);_0x120e74[_0x84b8('0x8')](function(_0x2296b6){var _0x161ffc=_0x2296b6['split']('[')[_0x84b8('0x9')]();var _0x2c0b08=_0x2296b6['match'](/\[(.*?)\]/g);_0x2c0b08['forEach'](function(_0x170981){var _0x52a65f=_0x170981[_0x84b8('0x6')]('[')['filter'](function(_0x5656e6){return _0x5656e6['indexOf'](']')>-0x1;})[_0x84b8('0xa')](function(_0x240c2b){return _0x240c2b[_0x84b8('0x6')](']')[0x0];})[0x0];_0x466194['conditions'][_0x84b8('0xb')]({'field':_0x94593b,'operator':_0x161ffc,'value':_0x52a65f});});});}return _0x466194;};exports[_0x84b8('0xc')]=function(_0x5db58f,_0x5eac42,_0x548f8b){var _0x11f40a={};if(_0x5eac42===_0x84b8('0xd')){if(_0x548f8b[_0x84b8('0xe')]===_0x84b8('0xf')){_0x548f8b[_0x84b8('0xe')]='$between';_0x548f8b[_0x84b8('0x10')]+=','+_0x548f8b[_0x84b8('0x10')];}else if(_[_0x84b8('0x11')]([_0x84b8('0x12'),_0x84b8('0x13')],_0x548f8b[_0x84b8('0xe')])){_0x548f8b[_0x84b8('0x10')]=moment(_0x548f8b[_0x84b8('0x10')])['add'](0x1,_0x84b8('0x14'))[_0x84b8('0x15')](_0x84b8('0x16'));}}if(_0x548f8b['castTo']){_0x5eac42=_0x548f8b[_0x84b8('0x17')];_0x11f40a[_0x84b8('0x18')]=_0x84b8('0x19')+_0x5db58f+'.'+_0x548f8b[_0x84b8('0x1a')]+_0x84b8('0x1b')+_0x548f8b[_0x84b8('0x17')]+')\x20'+parseOperator(_0x548f8b[_0x84b8('0xe')]);}else{_0x11f40a[_0x84b8('0x18')]=_0x5db58f+'.'+_0x548f8b[_0x84b8('0x1a')]+'\x20'+parseOperator(_0x548f8b[_0x84b8('0xe')]);}if(_['includes']([_0x84b8('0x1c'),_0x84b8('0x1d')],_0x548f8b[_0x84b8('0xe')]))_0x11f40a[_0x84b8('0x18')]='('+_0x11f40a['text']+'\x20OR\x20'+_0x5db58f+'.'+_0x548f8b[_0x84b8('0x1a')]+'\x20IS\x20NULL)';_0x11f40a[_0x84b8('0x10')]=parseValue(_0x5eac42,_0x548f8b['operator'],_0x548f8b['value']);return _0x11f40a;};function parseOperator(_0x5ecc97){var _0x21027a;switch(_0x5ecc97){case _0x84b8('0x1e'):_0x21027a=_0x84b8('0x1f');break;case _0x84b8('0x1d'):_0x21027a='NOT\x20IN\x20?';break;case _0x84b8('0xf'):_0x21027a=_0x84b8('0x20');break;case _0x84b8('0x1c'):_0x21027a=_0x84b8('0x21');break;case'$substring':case _0x84b8('0x22'):case _0x84b8('0x23'):_0x21027a=_0x84b8('0x24');break;case _0x84b8('0x25'):_0x21027a=_0x84b8('0x26');break;case _0x84b8('0x12'):_0x21027a='>\x20?';break;case _0x84b8('0x13'):_0x21027a=_0x84b8('0x27');break;case _0x84b8('0x28'):_0x21027a=_0x84b8('0x29');break;case _0x84b8('0x2a'):_0x21027a=_0x84b8('0x2b');break;}return _0x21027a;}function parseValue(_0x4e3a13,_0x17c894,_0xaea8a2){var _0x209a8d={'start':undefined,'end':undefined};switch(_0x17c894){case _0x84b8('0x1e'):case _0x84b8('0x1d'):_0x209a8d[_0x84b8('0x2c')]=_0xaea8a2[_0x84b8('0x6')](',');break;case _0x84b8('0x2d'):_0x209a8d[_0x84b8('0x2c')]='%'+_0xaea8a2+'%';break;case _0x84b8('0x22'):_0x209a8d[_0x84b8('0x2c')]=_0xaea8a2+'%';break;case _0x84b8('0x23'):_0x209a8d[_0x84b8('0x2c')]='%'+_0xaea8a2;break;case _0x84b8('0x2a'):var _0x3d531f=_0xaea8a2[_0x84b8('0x6')](',');var _0xaea8a2=_0x3d531f['shift']();var _0x537755=_0x3d531f[_0x84b8('0x2e')]();if(_0x4e3a13===_0x84b8('0xd')){_0xaea8a2=moment(_0xaea8a2)[_0x84b8('0x2f')](0x0,!![])[_0x84b8('0x15')]();_0x537755=moment(_0x537755)[_0x84b8('0x2f')](0x0,!![])[_0x84b8('0x30')](0x17,_0x84b8('0x31'))[_0x84b8('0x30')](0x3b,_0x84b8('0x32'))['add'](0x3b,_0x84b8('0x33'))[_0x84b8('0x15')]();}_0x209a8d={'start':_0xaea8a2,'end':_0x537755};break;default:_0x209a8d[_0x84b8('0x2c')]=_0xaea8a2;break;}return _0x209a8d;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 5aa3108..12020e2 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 _0x1423=['limit','sort','map','priority','cast','col','unsigned','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','{EXPR}','join','getOptions','$id','query','model','intersection','attributes','hasOwnProperty','nolimit','offset','order','where','filter','object','columns','value','merge','lower','options','sequelize','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','name','uniqueid','isArray'];(function(_0x37f62e,_0x5a61b1){var _0x484738=function(_0x2a677c){while(--_0x2a677c){_0x37f62e['push'](_0x37f62e['shift']());}};_0x484738(++_0x5a61b1);}(_0x1423,0x9f));var _0x3142=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1423[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var sequelize=require(_0x3142('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x59fe25){var _0x3efbd9=['ne'];try{var _0x23be8c=JSON[_0x3142('0x1')](_0x59fe25);var _0x4c828b=Object[_0x3142('0x2')](_0x23be8c)[0x0];return _0x3efbd9[_0x3142('0x3')](_0x4c828b);}catch(_0xde7247){return![];}}function getOperatorValue(_0x3e267d){var _0x275469=JSON[_0x3142('0x1')](_0x3e267d);var _0x5bf428=Object[_0x3142('0x2')](_0x275469)[0x0];var _0x1dc014=_0x275469[_0x5bf428];return{['$'+_0x5bf428]:_0x1dc014};}exports[_0x3142('0x4')]=function(_0x754e80){var _0x2ff86c=null;if(_0x754e80){_0x2ff86c=_0x754e80[_0x3142('0x5')](',');}return _0x2ff86c;};exports[_0x3142('0x6')]=function(_0x30a235,_0x5ef54f){var _0x2e3d79={};if(!_[_0x3142('0x7')](_0x30a235)){_[_0x3142('0x8')](_0x30a235,function(_0x237847,_0x5392a3){try{if(_0x5ef54f){var _0x34c36c=_[_0x3142('0x9')](_0x5ef54f,{'name':_0x5392a3})||{};if(hasSequelizeOperator(_0x237847)){_0x2e3d79[_0x5392a3]=getOperatorValue(_0x237847);}else if(_0x34c36c[_0x3142('0xa')]===_0x3142('0xb')&&_[_0x3142('0xc')](_0x237847)){var _0x52c041=JSON['parse'](_0x237847);var _0x63d45c={'$gte':moment(moment(_0x52c041[_0x3142('0xd')])['format'](_0x3142('0xe')))[_0x3142('0xf')]()[_0x3142('0x10')](),'$lte':moment(moment(_0x52c041[_0x3142('0x11')])[_0x3142('0x10')](_0x3142('0xe')))[_0x3142('0xf')]()['subtract'](0x1,'s')[_0x3142('0x10')]()};_0x2e3d79[_0x5392a3]=_0x63d45c;}else if(_0x34c36c[_0x3142('0x12')]===_0x3142('0x13')){_0x2e3d79[_0x5392a3]=_0x237847;}else{_0x2e3d79[_0x5392a3]=_[_0x3142('0x14')](_0x237847)?_0x237847:JSON[_0x3142('0x1')](_0x237847);}}else{_0x2e3d79[_0x5392a3]=_[_0x3142('0x14')](_0x237847)?_0x237847:JSON[_0x3142('0x1')](_0x237847);}}catch(_0x593a35){_0x2e3d79[_0x5392a3]=_0x237847[_0x3142('0x5')](',');}});}return _0x2e3d79;};exports[_0x3142('0x15')]=function(_0x2cab39){_0x2cab39=parseInt(_0x2cab39,0xa);if(!_0x2cab39||_0x2cab39<0x0){_0x2cab39=LIMIT_VALUE;}return _0x2cab39;};exports['offset']=function(_0x2618e3){_0x2618e3=parseInt(_0x2618e3,0xa);if(!_0x2618e3||_0x2618e3<0x0){_0x2618e3=0x0;}return _0x2618e3;};exports[_0x3142('0x16')]=function(_0x2af6d1){var _0x3ce0f2,_0x4884b4=null;if(_0x2af6d1){_0x3ce0f2=_0x2af6d1['split'](',');_0x4884b4=_[_0x3142('0x17')](_0x3ce0f2,function(_0x18efb8){if(_0x18efb8['indexOf']('-')===0x0){return[_0x18efb8===_0x3142('0x18')?sequelize[_0x3142('0x19')](sequelize[_0x3142('0x1a')](_0x3142('0x18')),_0x3142('0x1b')):_0x18efb8['substr'](0x1),'DESC'];}else{return[_0x18efb8===_0x3142('0x18')?sequelize[_0x3142('0x19')](sequelize['col'](_0x3142('0x18')),_0x3142('0x1b')):_0x18efb8,'ASC'];}});}return _0x4884b4;};exports[_0x3142('0x1c')]=function(_0xac5bca,_0x40e664){if(_['isEmpty'](_0xac5bca)){return _0xac5bca;}if(_['isArray'](_0xac5bca)){for(var _0x34cc4b=0x0;_0x34cc4b<_0xac5bca[_0x3142('0x1d')];_0x34cc4b+=0x1){_0xac5bca[_0x34cc4b]=this[_0x3142('0x1c')](_0xac5bca[_0x34cc4b],_0x40e664);}return _0xac5bca;}if(!_[_0x3142('0x1e')](_0xac5bca)){return _0xac5bca;}if(_[_0x3142('0x1f')](_0x40e664)){_0x40e664=[_0x40e664];}if(!_[_0x3142('0x14')](_0x40e664)){return _0xac5bca;}for(var _0x3f9c95=0x0;_0x3f9c95<_0x40e664['length'];_0x3f9c95+=0x1){_[_0x3142('0x20')](_0xac5bca,_0x40e664[_0x3f9c95]);}for(var _0x550e78 in _0xac5bca){if(_0xac5bca['hasOwnProperty'](_0x550e78)){_0xac5bca[_0x550e78]=this[_0x3142('0x1c')](_0xac5bca[_0x550e78],_0x40e664);}}return _0xac5bca;};exports[_0x3142('0x21')]=function(_0x1a99d1){return _0x1a99d1[_0x3142('0x22')](RegExp(_0x3142('0x23')))?!![]:![];};exports['isEmail']=function(_0x32c1f6){return _0x32c1f6[_0x3142('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x3142('0x24')]=function(_0x18857e,_0x308cd1){var _0x3c8816=[];var _0x19af03=/[ `!@#$%^&*()_\-?~]/;var _0x5c4774=_0x308cd1?'\x22{EXPR}\x22':'{EXPR}';_0x18857e[_0x3142('0x5')](/[ ,]+/)[_0x3142('0x25')](function(_0x5e1ad9){_0x5e1ad9=_0x5e1ad9[_0x3142('0x26')](/([^:]")"+/g,'$1');_0x5e1ad9='+'+_0x5e1ad9+'*';var _0x47ded8=_0x5e1ad9['match'](_0x19af03);if(_0x47ded8){_0x5e1ad9='\x22'+_0x5e1ad9+'\x22';}_0x3c8816[_0x3142('0x27')](_0x5e1ad9);});_0x5c4774=_0x5c4774[_0x3142('0x26')](_0x3142('0x28'),_0x3c8816[_0x3142('0x29')]('\x20'));return _0x5c4774;};exports[_0x3142('0x2a')]=function(_0x1052cd,_0x406417,_0x34865d){var _0x1d67ba={},_0x5b91b={};if(_0x406417['query'][_0x3142('0x2b')]){_0x406417[_0x3142('0x2c')]['id']=_0x406417[_0x3142('0x2c')][_0x3142('0x2b')];delete _0x406417[_0x3142('0x2c')][_0x3142('0x2b')];}_0x1d67ba[_0x3142('0x2d')]=_[_0x3142('0x17')](_0x1052cd,_0x3142('0x12'));_0x1d67ba[_0x3142('0x2c')]=_[_0x3142('0x2')](_0x406417['query']);_0x1d67ba['filters']=_[_0x3142('0x2e')](_0x1d67ba['model'],_0x1d67ba[_0x3142('0x2c')]);_0x5b91b[_0x3142('0x2f')]=_['intersection'](_0x1d67ba[_0x3142('0x2d')],this[_0x3142('0x4')](_0x406417[_0x3142('0x2c')][_0x3142('0x4')]));_0x5b91b[_0x3142('0x2f')]=_0x5b91b[_0x3142('0x2f')][_0x3142('0x1d')]?_0x5b91b[_0x3142('0x2f')]:_0x1d67ba[_0x3142('0x2d')];if(!_0x406417[_0x3142('0x2c')][_0x3142('0x30')](_0x3142('0x31'))){_0x5b91b['limit']=this['limit'](_0x406417[_0x3142('0x2c')][_0x3142('0x15')]);_0x5b91b[_0x3142('0x32')]=this[_0x3142('0x32')](_0x406417[_0x3142('0x2c')][_0x3142('0x32')]);}_0x5b91b[_0x3142('0x33')]=this[_0x3142('0x16')](_0x406417['query'][_0x3142('0x16')]);_0x5b91b[_0x3142('0x34')]=this['filters'](_['pick'](_0x406417[_0x3142('0x2c')],_0x1d67ba['filters']),_0x1052cd);if(_0x406417[_0x3142('0x2c')][_0x3142('0x35')]){var _0x30552c=_0x1052cd;var _0x56700e=_0x406417[_0x3142('0x2c')][_0x3142('0x35')];if(typeof _0x56700e===_0x3142('0x36')){_0x30552c=_['filter'](_0x1052cd,function(_0x469278){return _[_0x3142('0x3')](_0x56700e[_0x3142('0x37')],_0x469278['name']);});_0x56700e=_0x56700e[_0x3142('0x38')];}_0x5b91b[_0x3142('0x34')]=_[_0x3142('0x39')](_0x5b91b[_0x3142('0x34')],{'$or':_['map'](_0x30552c,function(_0x24a8df){if(_0x24a8df[_0x3142('0xa')]!=='VIRTUAL'){if(_0x34865d){return sequelize[_0x3142('0x34')](sequelize['fn'](_0x3142('0x3a'),sequelize[_0x3142('0x1a')](_0x24a8df[_0x3142('0x12')])),{'$like':sequelize['fn'](_0x3142('0x3a'),'%'+_0x406417['query'][_0x3142('0x35')]+'%')});}else{var _0xeeea6b={};_0xeeea6b[_0x24a8df[_0x3142('0x12')]]={'$like':'%'+_0x406417[_0x3142('0x2c')][_0x3142('0x35')]+'%'};return _0xeeea6b;}}})});}_0x5b91b=_[_0x3142('0x39')]({},_0x5b91b,_0x406417[_0x3142('0x3b')]);return _0x5b91b;}; \ No newline at end of file +var _0x0ef5=['limit','offset','sort','map','priority','cast','col','DESC','unsigned','ASC','isObject','isString','isNumeric','match','^[+]?[0-9]*$','\x22{EXPR}\x22','{EXPR}','push','replace','join','getOptions','query','$id','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','filter','object','value','merge','VIRTUAL','lower','options','lodash','sequelize','parse','keys','includes','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','isArray'];(function(_0x2f7849,_0x24e39a){var _0xcd4066=function(_0x5cd350){while(--_0x5cd350){_0x2f7849['push'](_0x2f7849['shift']());}};_0xcd4066(++_0x24e39a);}(_0x0ef5,0x116));var _0x50ef=function(_0x48271f,_0xc4f6d3){_0x48271f=_0x48271f-0x0;var _0x13eb5c=_0x0ef5[_0x48271f];return _0x13eb5c;};'use strict';var _=require(_0x50ef('0x0'));var sequelize=require(_0x50ef('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x397877){var _0xc0d2c8=['ne'];try{var _0x12a23a=JSON[_0x50ef('0x2')](_0x397877);var _0x358c0d=Object[_0x50ef('0x3')](_0x12a23a)[0x0];return _0xc0d2c8[_0x50ef('0x4')](_0x358c0d);}catch(_0x1be8f){return![];}}function getOperatorValue(_0x4c5656){var _0x1bb87e=JSON[_0x50ef('0x2')](_0x4c5656);var _0x2f3f3e=Object['keys'](_0x1bb87e)[0x0];var _0x2401ba=_0x1bb87e[_0x2f3f3e];return{['$'+_0x2f3f3e]:_0x2401ba};}exports['fields']=function(_0x8580cd){var _0x31f670=null;if(_0x8580cd){_0x31f670=_0x8580cd[_0x50ef('0x5')](',');}return _0x31f670;};exports[_0x50ef('0x6')]=function(_0x3b67dd,_0x3d74fb){var _0x3fd600={};if(!_[_0x50ef('0x7')](_0x3b67dd)){_[_0x50ef('0x8')](_0x3b67dd,function(_0x59c1c0,_0x2166a0){try{if(_0x3d74fb){var _0x56e967=_[_0x50ef('0x9')](_0x3d74fb,{'name':_0x2166a0})||{};if(hasSequelizeOperator(_0x59c1c0)){_0x3fd600[_0x2166a0]=getOperatorValue(_0x59c1c0);}else if(_0x56e967[_0x50ef('0xa')]===_0x50ef('0xb')&&_[_0x50ef('0xc')](_0x59c1c0)){var _0x1df658=JSON['parse'](_0x59c1c0);var _0x4f2ab0={'$gte':moment(moment(_0x1df658[_0x50ef('0xd')])['format'](_0x50ef('0xe')))[_0x50ef('0xf')]()[_0x50ef('0x10')](),'$lte':moment(moment(_0x1df658[_0x50ef('0x11')])[_0x50ef('0x10')](_0x50ef('0xe')))[_0x50ef('0xf')]()[_0x50ef('0x12')](0x1,'s')[_0x50ef('0x10')]()};_0x3fd600[_0x2166a0]=_0x4f2ab0;}else if(_0x56e967[_0x50ef('0x13')]===_0x50ef('0x14')){_0x3fd600[_0x2166a0]=_0x59c1c0;}else{_0x3fd600[_0x2166a0]=_[_0x50ef('0x15')](_0x59c1c0)?_0x59c1c0:JSON['parse'](_0x59c1c0);}}else{_0x3fd600[_0x2166a0]=_['isArray'](_0x59c1c0)?_0x59c1c0:JSON[_0x50ef('0x2')](_0x59c1c0);}}catch(_0x3d1fed){_0x3fd600[_0x2166a0]=_0x59c1c0[_0x50ef('0x5')](',');}});}return _0x3fd600;};exports[_0x50ef('0x16')]=function(_0x56fc52){_0x56fc52=parseInt(_0x56fc52,0xa);if(!_0x56fc52||_0x56fc52<0x0){_0x56fc52=LIMIT_VALUE;}return _0x56fc52;};exports[_0x50ef('0x17')]=function(_0x531664){_0x531664=parseInt(_0x531664,0xa);if(!_0x531664||_0x531664<0x0){_0x531664=0x0;}return _0x531664;};exports[_0x50ef('0x18')]=function(_0x3101f9){var _0x57f92e,_0x162b29=null;if(_0x3101f9){_0x57f92e=_0x3101f9[_0x50ef('0x5')](',');_0x162b29=_[_0x50ef('0x19')](_0x57f92e,function(_0x441c6e){if(_0x441c6e['indexOf']('-')===0x0){return[_0x441c6e===_0x50ef('0x1a')?sequelize[_0x50ef('0x1b')](sequelize[_0x50ef('0x1c')](_0x50ef('0x1a')),'unsigned'):_0x441c6e['substr'](0x1),_0x50ef('0x1d')];}else{return[_0x441c6e==='priority'?sequelize[_0x50ef('0x1b')](sequelize[_0x50ef('0x1c')]('priority'),_0x50ef('0x1e')):_0x441c6e,_0x50ef('0x1f')];}});}return _0x162b29;};exports['omit']=function(_0x1e3a32,_0x2ba515){if(_[_0x50ef('0x7')](_0x1e3a32)){return _0x1e3a32;}if(_[_0x50ef('0x15')](_0x1e3a32)){for(var _0x5e14a9=0x0;_0x5e14a9<_0x1e3a32['length'];_0x5e14a9+=0x1){_0x1e3a32[_0x5e14a9]=this['omit'](_0x1e3a32[_0x5e14a9],_0x2ba515);}return _0x1e3a32;}if(!_[_0x50ef('0x20')](_0x1e3a32)){return _0x1e3a32;}if(_[_0x50ef('0x21')](_0x2ba515)){_0x2ba515=[_0x2ba515];}if(!_['isArray'](_0x2ba515)){return _0x1e3a32;}for(var _0x3dd37a=0x0;_0x3dd37a<_0x2ba515['length'];_0x3dd37a+=0x1){_['unset'](_0x1e3a32,_0x2ba515[_0x3dd37a]);}for(var _0xd113ca in _0x1e3a32){if(_0x1e3a32['hasOwnProperty'](_0xd113ca)){_0x1e3a32[_0xd113ca]=this['omit'](_0x1e3a32[_0xd113ca],_0x2ba515);}}return _0x1e3a32;};exports[_0x50ef('0x22')]=function(_0x29374d){return _0x29374d[_0x50ef('0x23')](RegExp(_0x50ef('0x24')))?!![]:![];};exports['isEmail']=function(_0x58e1ba){return _0x58e1ba['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x15e4f2,_0x20a839){var _0x17e310=[];var _0xf78aee=/[ `!@#$%^&*()_\-?~]/;var _0x1cdc6a=_0x20a839?_0x50ef('0x25'):_0x50ef('0x26');_0x15e4f2[_0x50ef('0x5')](/[ ,]+/)['forEach'](function(_0x24fbdf){_0x24fbdf=_0x24fbdf['replace'](/([^:]")"+/g,'$1');_0x24fbdf='+'+_0x24fbdf+'*';var _0x241742=_0x24fbdf[_0x50ef('0x23')](_0xf78aee);if(_0x241742){_0x24fbdf='\x22'+_0x24fbdf+'\x22';}_0x17e310[_0x50ef('0x27')](_0x24fbdf);});_0x1cdc6a=_0x1cdc6a[_0x50ef('0x28')](_0x50ef('0x26'),_0x17e310[_0x50ef('0x29')]('\x20'));return _0x1cdc6a;};exports[_0x50ef('0x2a')]=function(_0xe33549,_0x1d613c,_0x48a585){var _0x2d956b={},_0x82b0c7={};if(_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x2c')]){_0x1d613c[_0x50ef('0x2b')]['id']=_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x2c')];delete _0x1d613c[_0x50ef('0x2b')]['$id'];}_0x2d956b['model']=_[_0x50ef('0x19')](_0xe33549,_0x50ef('0x13'));_0x2d956b[_0x50ef('0x2b')]=_[_0x50ef('0x3')](_0x1d613c[_0x50ef('0x2b')]);_0x2d956b['filters']=_[_0x50ef('0x2d')](_0x2d956b[_0x50ef('0x2e')],_0x2d956b[_0x50ef('0x2b')]);_0x82b0c7[_0x50ef('0x2f')]=_[_0x50ef('0x2d')](_0x2d956b[_0x50ef('0x2e')],this[_0x50ef('0x30')](_0x1d613c[_0x50ef('0x2b')]['fields']));_0x82b0c7['attributes']=_0x82b0c7[_0x50ef('0x2f')][_0x50ef('0x31')]?_0x82b0c7[_0x50ef('0x2f')]:_0x2d956b['model'];if(!_0x1d613c['query'][_0x50ef('0x32')](_0x50ef('0x33'))){_0x82b0c7['limit']=this[_0x50ef('0x16')](_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x16')]);_0x82b0c7[_0x50ef('0x17')]=this['offset'](_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x17')]);}_0x82b0c7['order']=this[_0x50ef('0x18')](_0x1d613c['query']['sort']);_0x82b0c7[_0x50ef('0x34')]=this[_0x50ef('0x6')](_['pick'](_0x1d613c[_0x50ef('0x2b')],_0x2d956b[_0x50ef('0x6')]),_0xe33549);if(_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x35')]){var _0x1f251d=_0xe33549;var _0x2e722d=_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x35')];if(typeof _0x2e722d===_0x50ef('0x36')){_0x1f251d=_[_0x50ef('0x35')](_0xe33549,function(_0x2411cf){return _['includes'](_0x2e722d['columns'],_0x2411cf[_0x50ef('0x13')]);});_0x2e722d=_0x2e722d[_0x50ef('0x37')];}_0x82b0c7[_0x50ef('0x34')]=_[_0x50ef('0x38')](_0x82b0c7[_0x50ef('0x34')],{'$or':_[_0x50ef('0x19')](_0x1f251d,function(_0x391b2e){if(_0x391b2e[_0x50ef('0xa')]!==_0x50ef('0x39')){if(_0x48a585){return sequelize[_0x50ef('0x34')](sequelize['fn']('lower',sequelize['col'](_0x391b2e[_0x50ef('0x13')])),{'$like':sequelize['fn'](_0x50ef('0x3a'),'%'+_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x35')]+'%')});}else{var _0x42c4ea={};_0x42c4ea[_0x391b2e[_0x50ef('0x13')]]={'$like':'%'+_0x1d613c[_0x50ef('0x2b')][_0x50ef('0x35')]+'%'};return _0x42c4ea;}}})});}_0x82b0c7=_[_0x50ef('0x38')]({},_0x82b0c7,_0x1d613c[_0x50ef('0x3b')]);return _0x82b0c7;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 9d82f46..7b99ffa 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x862f=['pauseType','globalStatus','getSortedAgentsIdsByStatus','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','smsPause','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','voicePause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','openchannelStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','findAll','name','fullname','openchannelPause','whatsappPause'];(function(_0x389226,_0x4167a4){var _0x5ddcba=function(_0x98a556){while(--_0x98a556){_0x389226['push'](_0x389226['shift']());}};_0x5ddcba(++_0x4167a4);}(_0x862f,0x14f));var _0xf862=function(_0x560408,_0x45c914){_0x560408=_0x560408-0x0;var _0x3fd4da=_0x862f[_0x560408];return _0x3fd4da;};'use strict';var _=require(_0xf862('0x0'));var jayson=require(_0xf862('0x1'));var db=require(_0xf862('0x2'))['db'];var amiClient=jayson[_0xf862('0x3')][_0xf862('0x4')]({'port':0x232a});var routingClient=jayson[_0xf862('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x59550d,_0x5703c2){var _0x1dc061=[_0x59550d[_0xf862('0x5')],_0x59550d[_0xf862('0x6')],_0x59550d[_0xf862('0x7')],_0x59550d['openchannelPause'],_0x59550d['smsPause'],_0x59550d[_0xf862('0x8')],_0x59550d['whatsappPause']];if(!_0x5703c2)return _[_0xf862('0x9')](_0x1dc061);var _0x7293e=_[_0xf862('0xa')](_0x1dc061);return _0x7293e[_0xf862('0xb')]>0x0&&_0x7293e[_0xf862('0xb')]<_0x1dc061[_0xf862('0xb')]?!![]:![];}function isIdle(_0x3d8ea4){return _0x3d8ea4===_0xf862('0xc')||_0x3d8ea4===_0xf862('0xd')||_0x3d8ea4===_0xf862('0xe')||_0x3d8ea4===_0xf862('0xf')||_[_0xf862('0x10')](_0x3d8ea4);}function isAgentIdle(_0x1324c1){if(_0x1324c1[_0xf862('0x11')]!==_0xf862('0xc')&&_0x1324c1[_0xf862('0x8')]){_0x1324c1[_0xf862('0x11')]=_0xf862('0x12');return![];}return _[_0xf862('0x9')]([_0x1324c1[_0xf862('0x13')],_0x1324c1[_0xf862('0x14')],_0x1324c1['mailStatus'],_0x1324c1[_0xf862('0x15')],_0x1324c1['smsStatus'],_0x1324c1['voiceStatus'],_0x1324c1[_0xf862('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xf862('0x17')](_0xf862('0x18'),{})[_0xf862('0x19')](function(_0x10dc47){if(_0x10dc47[_0xf862('0x1a')]){throw new Error(_0xf862('0x1b'));}var _0x419aa7=_0x10dc47['result'];return routingClient['request']('Agents',{})[_0xf862('0x19')](function(_0x41f0ed){if(_0x41f0ed[_0xf862('0x1a')]){throw new Error(_0xf862('0x1c'));}var _0x24e596=_0x41f0ed[_0xf862('0x1d')];return _[_0xf862('0x1e')]({},_0x419aa7,_0x24e596);});})[_0xf862('0x1f')](function(_0x32d3bd){throw _0x32d3bd;});}exports[_0xf862('0x20')]=getRealtimeAgents;function getAgentStatus(_0x677012){var _0x2f90ae=_0xf862('0xd');if(isAgentPaused(_0x677012))_0x2f90ae=_0xf862('0x12');else if(isAgentPaused(_0x677012,!![]))_0x2f90ae=_0xf862('0x21');else if(isAgentIdle(_0x677012))_0x2f90ae=_0xf862('0xc');else _0x2f90ae=_0xf862('0x22');return _0x2f90ae;}exports[_0xf862('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x1ada08,_0x5e0de9){var _0x1c3aa0=_[_0xf862('0x24')](_0x1ada08)?_0x1ada08:[_0x1ada08];var _0xac2f5f=_[_0xf862('0x25')](_0x5e0de9)+_0xf862('0x26');var _0x21783b=_[_0xf862('0x27')](_0x1c3aa0,function(_0x521256){return db[_0xac2f5f][_0xf862('0x28')]({'where':{'id':_0x521256}})['then'](function(_0xad89a9){if(!_0xad89a9)return[];return _0xad89a9[_0xf862('0x29')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xf862('0x2a')](_0x21783b)['then'](function(_0x35fa2b){var _0x5ab4b9=_(_0x35fa2b)['flatten']()['map']('id')['uniq']()[_0xf862('0x2b')]();return _0x5ab4b9;});}exports[_0xf862('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x2d4963,_0x52b2b6,_0x579fd6){try{if(_0x52b2b6['length']>0x0){_0x2d4963=_0x2d4963[_0xf862('0xa')](function(_0x3b0a99){return _0x52b2b6[_0xf862('0x2d')](_0x3b0a99['id']);});}var _0x3fdf2b=_0x2d4963[_0xf862('0xa')](function(_0x1d60ac){var _0x46e1e7='busy';if(isAgentIdle(_0x1d60ac)){_0x46e1e7=_0xf862('0xc');}return _0x46e1e7===_0x579fd6;});return _[_0xf862('0x27')](_0x3fdf2b,'id');}catch(_0x323794){throw _0x323794;}}exports[_0xf862('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xd07038,_0x333814,_0xf9d172){return Promise[_0xf862('0x2f')]()[_0xf862('0x19')](function(){if(_0x333814[_0xf862('0xb')]>0x0){_0xd07038=_0xd07038[_0xf862('0xa')](function(_0x44ba34){return _0x333814[_0xf862('0x2d')](_0x44ba34['id']);});}return _0xd07038;})[_0xf862('0x19')](function(){return db['User'][_0xf862('0x30')]({'attributes':['id',_0xf862('0x31'),_0xf862('0x32'),_0xf862('0x5'),_0xf862('0x6'),_0xf862('0x7'),_0xf862('0x33'),'smsPause',_0xf862('0x8'),_0xf862('0x34'),_0xf862('0x35')],'where':{'id':{'$in':_[_0xf862('0x27')](_0xd07038,'id')}},'raw':!![]});})['then'](function(_0x3d48dc){return _0x3d48dc[_0xf862('0x27')](function(_0x204c39){var _0x53eed5=_['find'](_0xd07038,['id',_0x204c39['id']]);var _0x370762=filterAgentAttributes(_0x53eed5);_[_0xf862('0x1e')](_0x204c39,_0x370762);_0x204c39[_0xf862('0x36')]=getAgentStatus(_0x204c39);return _0x204c39;});})['then'](function(_0x1e030a){var _0x4bb869=sortAgentsByStatus(_0x1e030a,_0xf9d172);return _[_0xf862('0x27')](_0x4bb869,'id');})[_0xf862('0x1f')](function(_0x3a2b7){throw _0x3a2b7;});}exports[_0xf862('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x48a756){var _0x4356c7={'fields':[],'order':null};var _0x5046cf=_0x48a756['split'](',');_0x4356c7['fields']=_[_0xf862('0xa')](_0x5046cf,function(_0x53266d){if(!_0x53266d['includes']('globalStatus')){return!![];}_0x4356c7['order']=_[_0xf862('0x38')](_0x53266d,'-')?_0xf862('0x39'):_0xf862('0x3a');return![];});return _0x4356c7;}exports[_0xf862('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x399cc8){if(_0x399cc8[_0xf862('0x2d')]('fullname')&&!_0x399cc8[_0xf862('0x2d')](_0xf862('0x3c'))){var _0xbbdc71=_0x399cc8[_0xf862('0x3d')](0x0,_0x399cc8[_0xf862('0x3e')](_0xf862('0x32')));_0x399cc8+=','+_0xbbdc71+'internal';}return _0x399cc8;}exports[_0xf862('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x34a74c,_0x443e20){var _0x40815e=_0x34a74c[_0xf862('0x40')](function(_0x1bbda1,_0x18aa09){if(_0x1bbda1[_0xf862('0x36')]===_0x18aa09['globalStatus']){if(_0x1bbda1[_0xf862('0x36')]===_0xf862('0x12')){if(_0x443e20===_0xf862('0x39')){return(_0x1bbda1['pauseType']||'')<(_0x18aa09['pauseType']||'')||_0x1bbda1['fullname'][_0xf862('0x41')]()>_0x18aa09[_0xf862('0x32')][_0xf862('0x41')]()?0x1:-0x1;}else{return(_0x1bbda1['pauseType']||'')<(_0x18aa09[_0xf862('0x35')]||'')||_0x1bbda1[_0xf862('0x32')][_0xf862('0x41')]()>_0x18aa09[_0xf862('0x32')][_0xf862('0x41')]()?-0x1:0x1;}}else{if(_0x443e20===_0xf862('0x39')){return _0x1bbda1[_0xf862('0x32')][_0xf862('0x41')]()<_0x18aa09[_0xf862('0x32')][_0xf862('0x41')]()?0x1:-0x1;}else{return _0x1bbda1[_0xf862('0x32')]['toLowerCase']()<_0x18aa09[_0xf862('0x32')][_0xf862('0x41')]()?-0x1:0x1;}}}else{if(_0x443e20===_0xf862('0x39')){return _0x1bbda1[_0xf862('0x36')]<_0x18aa09[_0xf862('0x36')]?0x1:-0x1;}else{return _0x1bbda1[_0xf862('0x36')]<_0x18aa09['globalStatus']?-0x1:0x1;}}});return _0x40815e;}exports[_0xf862('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x35647){var _0x455935=[_0xf862('0x43'),_0xf862('0x44'),_0xf862('0x45'),_0xf862('0x46'),_0xf862('0x35'),_0xf862('0x46'),_0xf862('0x3c'),_0xf862('0x47'),_0xf862('0x5'),'openchannelPause',_0xf862('0x7'),_0xf862('0x48'),_0xf862('0x34'),_0xf862('0x6'),_0xf862('0x8'),_0xf862('0x49'),_0xf862('0x4a'),'mailCapacity',_0xf862('0x4b'),_0xf862('0x4c'),_0xf862('0x4d'),_0xf862('0x4e'),_0xf862('0x4f'),_0xf862('0x50'),_0xf862('0x51'),_0xf862('0x52'),_0xf862('0x53'),'chatStatus',_0xf862('0x15'),'mailStatus',_0xf862('0x54'),'whatsappStatus',_0xf862('0x14'),_0xf862('0x11'),_0xf862('0x55'),'openchannelStatusTime',_0xf862('0x56'),_0xf862('0x57'),_0xf862('0x58'),_0xf862('0x59'),_0xf862('0x5a'),_0xf862('0x5b'),'destconnectedlinenum',_0xf862('0x5c'),_0xf862('0x5d'),_0xf862('0x5e'),_0xf862('0x5f')];var _0x12688c=[_0xf862('0x5'),_0xf862('0x33'),_0xf862('0x7'),'smsPause',_0xf862('0x34'),_0xf862('0x6'),'voicePause',_0xf862('0x44')];var _0x107586=_(_0x35647)[_0xf862('0x60')](_0x12688c)['pick'](_0x455935)[_0xf862('0x2b')]();return _0x107586;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file +var _0x21dd=['chatStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','routealias','omit','value','filterAgentAttributes','lodash','jayson/promise','client','http','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','length','idle','unknown','unavailable','ringing','voiceStatus','pause','chatStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','filter','User','name','smsPause','pauseType','split','fields','order','startsWith','DESC','ASC','fullname','substring','indexOf','internal','validateSortParameter','sort','globalStatus','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','faxCurrentCapacity','mailStatus','faxStatus'];(function(_0x5b57af,_0x1f3989){var _0x4480da=function(_0x370d1d){while(--_0x370d1d){_0x5b57af['push'](_0x5b57af['shift']());}};_0x4480da(++_0x1f3989);}(_0x21dd,0x1dd));var _0xd21d=function(_0x16b47d,_0x51dd58){_0x16b47d=_0x16b47d-0x0;var _0x36a731=_0x21dd[_0x16b47d];return _0x36a731;};'use strict';var _=require(_0xd21d('0x0'));var jayson=require(_0xd21d('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xd21d('0x2')][_0xd21d('0x3')]({'port':0x232a});var routingClient=jayson[_0xd21d('0x2')][_0xd21d('0x3')]({'port':0x232c});function isAgentPaused(_0x2a3af5,_0x51a5c6){var _0x2c01c1=[_0x2a3af5[_0xd21d('0x4')],_0x2a3af5[_0xd21d('0x5')],_0x2a3af5[_0xd21d('0x6')],_0x2a3af5[_0xd21d('0x7')],_0x2a3af5['smsPause'],_0x2a3af5[_0xd21d('0x8')],_0x2a3af5[_0xd21d('0x9')]];if(!_0x51a5c6)return _[_0xd21d('0xa')](_0x2c01c1);var _0x25e4d9=_['filter'](_0x2c01c1);return _0x25e4d9[_0xd21d('0xb')]>0x0&&_0x25e4d9[_0xd21d('0xb')]<_0x2c01c1[_0xd21d('0xb')]?!![]:![];}function isIdle(_0x2d40e8){return _0x2d40e8===_0xd21d('0xc')||_0x2d40e8===_0xd21d('0xd')||_0x2d40e8===_0xd21d('0xe')||_0x2d40e8===_0xd21d('0xf')||_['isNil'](_0x2d40e8);}function isAgentIdle(_0x492513){if(_0x492513[_0xd21d('0x10')]!==_0xd21d('0xc')&&_0x492513[_0xd21d('0x8')]){_0x492513[_0xd21d('0x10')]=_0xd21d('0x11');return![];}return _[_0xd21d('0xa')]([_0x492513[_0xd21d('0x12')],_0x492513['faxStatus'],_0x492513['mailStatus'],_0x492513[_0xd21d('0x13')],_0x492513[_0xd21d('0x14')],_0x492513['voiceStatus'],_0x492513[_0xd21d('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xd21d('0x16')](_0xd21d('0x17'),{})[_0xd21d('0x18')](function(_0x56d8fc){if(_0x56d8fc[_0xd21d('0x19')]){throw new Error(_0xd21d('0x1a'));}var _0x2f5c8b=_0x56d8fc[_0xd21d('0x1b')];return routingClient[_0xd21d('0x16')](_0xd21d('0x17'),{})[_0xd21d('0x18')](function(_0xf26cbc){if(_0xf26cbc[_0xd21d('0x19')]){throw new Error(_0xd21d('0x1c'));}var _0x2c8088=_0xf26cbc['result'];return _[_0xd21d('0x1d')]({},_0x2f5c8b,_0x2c8088);});})[_0xd21d('0x1e')](function(_0x42e165){throw _0x42e165;});}exports[_0xd21d('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x353f15){var _0xabd3a3=_0xd21d('0xd');if(isAgentPaused(_0x353f15))_0xabd3a3=_0xd21d('0x11');else if(isAgentPaused(_0x353f15,!![]))_0xabd3a3=_0xd21d('0x20');else if(isAgentIdle(_0x353f15))_0xabd3a3=_0xd21d('0xc');else _0xabd3a3=_0xd21d('0x21');return _0xabd3a3;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x3d42e2,_0x15d6d8){var _0x209485=_[_0xd21d('0x22')](_0x3d42e2)?_0x3d42e2:[_0x3d42e2];var _0x504d08=_[_0xd21d('0x23')](_0x15d6d8)+_0xd21d('0x24');var _0x452a2e=_[_0xd21d('0x25')](_0x209485,function(_0x58835a){return db[_0x504d08][_0xd21d('0x26')]({'where':{'id':_0x58835a}})[_0xd21d('0x18')](function(_0x367524){if(!_0x367524)return[];return _0x367524[_0xd21d('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xd21d('0x28')](_0x452a2e)[_0xd21d('0x18')](function(_0x30db83){var _0x15cd91=_(_0x30db83)[_0xd21d('0x29')]()[_0xd21d('0x25')]('id')['uniq']()['value']();return _0x15cd91;});}exports[_0xd21d('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1f27d9,_0x5bd6d5,_0x63e7d9){try{if(_0x5bd6d5[_0xd21d('0xb')]>0x0){_0x1f27d9=_0x1f27d9['filter'](function(_0x24c0b2){return _0x5bd6d5[_0xd21d('0x2b')](_0x24c0b2['id']);});}var _0x2a527b=_0x1f27d9['filter'](function(_0x31fbfa){var _0x24672c='busy';if(isAgentIdle(_0x31fbfa)){_0x24672c=_0xd21d('0xc');}return _0x24672c===_0x63e7d9;});return _['map'](_0x2a527b,'id');}catch(_0x3066a4){throw _0x3066a4;}}exports[_0xd21d('0x2c')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x3c1569,_0x104ee9,_0x420a5b){return Promise[_0xd21d('0x2d')]()['then'](function(){if(_0x104ee9[_0xd21d('0xb')]>0x0){_0x3c1569=_0x3c1569[_0xd21d('0x2e')](function(_0xf7a672){return _0x104ee9[_0xd21d('0x2b')](_0xf7a672['id']);});}return _0x3c1569;})['then'](function(){return db[_0xd21d('0x2f')]['findAll']({'attributes':['id',_0xd21d('0x30'),'fullname',_0xd21d('0x4'),'faxPause','mailPause',_0xd21d('0x7'),_0xd21d('0x31'),_0xd21d('0x8'),_0xd21d('0x9'),_0xd21d('0x32')],'where':{'id':{'$in':_['map'](_0x3c1569,'id')}},'raw':!![]});})['then'](function(_0xce99e4){return _0xce99e4[_0xd21d('0x25')](function(_0x108c57){var _0x2ff444=_['find'](_0x3c1569,['id',_0x108c57['id']]);var _0x299aa7=filterAgentAttributes(_0x2ff444);_[_0xd21d('0x1d')](_0x108c57,_0x299aa7);_0x108c57['globalStatus']=getAgentStatus(_0x108c57);return _0x108c57;});})['then'](function(_0x33a675){var _0x174236=sortAgentsByStatus(_0x33a675,_0x420a5b);return _[_0xd21d('0x25')](_0x174236,'id');})[_0xd21d('0x1e')](function(_0x44aefc){throw _0x44aefc;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x12e7ef){var _0x18674b={'fields':[],'order':null};var _0x381af4=_0x12e7ef[_0xd21d('0x33')](',');_0x18674b[_0xd21d('0x34')]=_[_0xd21d('0x2e')](_0x381af4,function(_0x6f4db1){if(!_0x6f4db1[_0xd21d('0x2b')]('globalStatus')){return!![];}_0x18674b[_0xd21d('0x35')]=_[_0xd21d('0x36')](_0x6f4db1,'-')?_0xd21d('0x37'):_0xd21d('0x38');return![];});return _0x18674b;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x53034e){if(_0x53034e[_0xd21d('0x2b')](_0xd21d('0x39'))&&!_0x53034e[_0xd21d('0x2b')]('internal')){var _0x12a10a=_0x53034e[_0xd21d('0x3a')](0x0,_0x53034e[_0xd21d('0x3b')](_0xd21d('0x39')));_0x53034e+=','+_0x12a10a+_0xd21d('0x3c');}return _0x53034e;}exports[_0xd21d('0x3d')]=validateSortParameter;function sortAgentsByStatus(_0x44d5f9,_0x4f5645){var _0x873fe7=_0x44d5f9[_0xd21d('0x3e')](function(_0x4796bc,_0x254a4c){if(_0x4796bc[_0xd21d('0x3f')]===_0x254a4c[_0xd21d('0x3f')]){if(_0x4796bc['globalStatus']===_0xd21d('0x11')){if(_0x4f5645===_0xd21d('0x37')){return(_0x4796bc[_0xd21d('0x32')]||'')<(_0x254a4c['pauseType']||'')||_0x4796bc[_0xd21d('0x39')][_0xd21d('0x40')]()>_0x254a4c[_0xd21d('0x39')][_0xd21d('0x40')]()?0x1:-0x1;}else{return(_0x4796bc[_0xd21d('0x32')]||'')<(_0x254a4c['pauseType']||'')||_0x4796bc[_0xd21d('0x39')][_0xd21d('0x40')]()>_0x254a4c[_0xd21d('0x39')][_0xd21d('0x40')]()?-0x1:0x1;}}else{if(_0x4f5645===_0xd21d('0x37')){return _0x4796bc[_0xd21d('0x39')][_0xd21d('0x40')]()<_0x254a4c[_0xd21d('0x39')][_0xd21d('0x40')]()?0x1:-0x1;}else{return _0x4796bc[_0xd21d('0x39')][_0xd21d('0x40')]()<_0x254a4c['fullname']['toLowerCase']()?-0x1:0x1;}}}else{if(_0x4f5645===_0xd21d('0x37')){return _0x4796bc[_0xd21d('0x3f')]<_0x254a4c[_0xd21d('0x3f')]?0x1:-0x1;}else{return _0x4796bc[_0xd21d('0x3f')]<_0x254a4c['globalStatus']?-0x1:0x1;}}});return _0x873fe7;}exports[_0xd21d('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x387001){var _0x254386=[_0xd21d('0x42'),_0xd21d('0x43'),'lastLoginAt',_0xd21d('0x44'),_0xd21d('0x32'),'lastPauseAt',_0xd21d('0x3c'),_0xd21d('0x45'),'chatPause',_0xd21d('0x7'),_0xd21d('0x6'),'smsPause',_0xd21d('0x9'),_0xd21d('0x5'),'voicePause','chatCapacity',_0xd21d('0x46'),_0xd21d('0x47'),_0xd21d('0x48'),_0xd21d('0x49'),_0xd21d('0x4a'),_0xd21d('0x4b'),_0xd21d('0x4c'),_0xd21d('0x4d'),'smsCurrentCapacity','whatsappCurrentCapacity',_0xd21d('0x4e'),_0xd21d('0x12'),_0xd21d('0x13'),_0xd21d('0x4f'),'smsStatus',_0xd21d('0x15'),_0xd21d('0x50'),'voiceStatus',_0xd21d('0x51'),'openchannelStatusTime',_0xd21d('0x52'),'smsStatusTime',_0xd21d('0x53'),_0xd21d('0x54'),_0xd21d('0x55'),_0xd21d('0x56'),_0xd21d('0x57'),_0xd21d('0x58'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording',_0xd21d('0x59')];var _0x542968=[_0xd21d('0x4'),_0xd21d('0x7'),_0xd21d('0x6'),'smsPause',_0xd21d('0x9'),_0xd21d('0x5'),_0xd21d('0x8'),_0xd21d('0x43')];var _0x51bc2a=_(_0x387001)[_0xd21d('0x5a')](_0x542968)['pick'](_0x254386)[_0xd21d('0x5b')]();return _0x51bc2a;}exports[_0xd21d('0x5c')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 7b67e55..2fb9787 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7afc=['http','client','available','loggedIn','waiting','busy','invalid','loggedInDb','notInUse','ringing','talking','unknown','originated','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','startCase','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','map','get','paused','outbound','pTalking','find','pick','initializeQueues','lodash'];(function(_0x5ef0f0,_0x14ee3d){var _0x301726=function(_0x55dab2){while(--_0x55dab2){_0x5ef0f0['push'](_0x5ef0f0['shift']());}};_0x301726(++_0x14ee3d);}(_0x7afc,0x1df));var _0xc7af=function(_0x199c9b,_0xd6e4c3){_0x199c9b=_0x199c9b-0x0;var _0x2f4c42=_0x7afc[_0x199c9b];return _0x2f4c42;};'use strict';var _=require(_0xc7af('0x0'));var jayson=require('jayson/promise');var util=require('util');var amiClient=jayson['client'][_0xc7af('0x1')]({'port':0x232a});var routingClient=jayson[_0xc7af('0x2')][_0xc7af('0x1')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xc7af('0x3'),_0xc7af('0x4'),'paused',_0xc7af('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0xc7af('0x6'),'inUse',_0xc7af('0x7'),_0xc7af('0x8'),_0xc7af('0x9'),'onHold',_0xc7af('0xa'),'ringInUse',_0xc7af('0xb'),'unavailable',_0xc7af('0xc')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xc7af('0xd'),'message',_0xc7af('0xe'),_0xc7af('0xf'),_0xc7af('0x10'),'Trunk',_0xc7af('0x11'),_0xc7af('0x12'),'erlangCalls','erlangCallToSecond',_0xc7af('0x13'),_0xc7af('0x14'),_0xc7af('0x15'),_0xc7af('0x16'),_0xc7af('0x17'),_0xc7af('0x18'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls',_0xc7af('0x19'),_0xc7af('0x1a'),_0xc7af('0x1b'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x3bd316,_0x4815e5){var _0x48681e=_0x4815e5===_0xc7af('0x1c')?amiClient:routingClient;return _0x48681e[_0xc7af('0x1d')](_[_0xc7af('0x1e')](_0x4815e5)+_0xc7af('0x1f'),_0x3bd316)[_0xc7af('0x20')](function(_0x48950a){if(_0x48950a[_0xc7af('0x21')])throw new Error(util['format'](_0xc7af('0x22'),_0x4815e5));return _0x48950a[_0xc7af('0x23')];})[_0xc7af('0x24')](function(_0x1c520e){throw _0x1c520e;});}exports[_0xc7af('0x25')]=getRealtimeQueues;function initializeQueues(_0xf29fb9,_0x57318f,_0x237b30,_0x481d71){var _0x522685=DEFAULT_QUEUE_ATTRIBUTES;if(_0x237b30===_0xc7af('0x1c')){if(_0x481d71===_0xc7af('0x26')){_0x522685=_0x522685['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x481d71==='outbound'){_0x522685=_0x522685[_0xc7af('0x27')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xf29fb9[_0xc7af('0x28')](function(_0x1a59ab){var _0x37f9a4=_0x1a59ab[_0xc7af('0x29')]({'plain':!![]});_0x37f9a4[_0xc7af('0x2a')]=0x0;_0x37f9a4[_0xc7af('0x8')]=0x0;_0x37f9a4[_0xc7af('0x4')]=0x0;_0x37f9a4[_0xc7af('0x3')]=0x0;_0x37f9a4[_0xc7af('0x5')]=0x0;if(_0x237b30==='voice'){_0x37f9a4[_0xc7af('0xb')]=0x0;_0x37f9a4['busy']=0x0;if(_0x481d71===_0xc7af('0x2b')){_0x37f9a4[_0xc7af('0x2c')]=0x0;_0x37f9a4[_0xc7af('0xd')]=0x0;}}var _0x585f58=_[_0xc7af('0x2d')](_0x57318f,['id',_0x37f9a4['id']]);if(_0x585f58){_['merge'](_0x37f9a4,_[_0xc7af('0x2e')](_0x585f58,_0x522685));}return _0x37f9a4;});}exports[_0xc7af('0x2f')]=initializeQueues; \ No newline at end of file +var _0xee78=['dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','inbound','concat','outbound','map','get','loggedInDb','find','merge','initializeQueues','lodash','util','http','client','available','loggedIn','paused','waiting','busy','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0xee78,0xb7));var _0x8ee7=function(_0x2b12ac,_0x1ddb41){_0x2b12ac=_0x2b12ac-0x0;var _0x3a9696=_0xee78[_0x2b12ac];return _0x3a9696;};'use strict';var _=require(_0x8ee7('0x0'));var jayson=require('jayson/promise');var util=require(_0x8ee7('0x1'));var amiClient=jayson['client'][_0x8ee7('0x2')]({'port':0x232a});var routingClient=jayson[_0x8ee7('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x8ee7('0x4'),_0x8ee7('0x5'),_0x8ee7('0x6'),_0x8ee7('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x8ee7('0x8'),'inUse','invalid','loggedInDb',_0x8ee7('0x9'),_0x8ee7('0xa'),_0x8ee7('0xb'),_0x8ee7('0xc'),_0x8ee7('0xd'),_0x8ee7('0xe'),_0x8ee7('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8ee7('0x10'),_0x8ee7('0x11'),_0x8ee7('0x12'),_0x8ee7('0x13'),_0x8ee7('0x14'),_0x8ee7('0x15'),_0x8ee7('0x16'),'startPredictive',_0x8ee7('0x17'),_0x8ee7('0x18'),_0x8ee7('0x19'),_0x8ee7('0x1a'),_0x8ee7('0x1b'),_0x8ee7('0x1c'),_0x8ee7('0x1d'),_0x8ee7('0x1e'),_0x8ee7('0x1f'),_0x8ee7('0x20'),_0x8ee7('0x21'),'predictiveIntervalDroppedCallsTimeout',_0x8ee7('0x22'),_0x8ee7('0x23'),_0x8ee7('0x24')];function getRealtimeQueues(_0x10ae4b,_0x399caa){var _0x11955e=_0x399caa===_0x8ee7('0x25')?amiClient:routingClient;return _0x11955e[_0x8ee7('0x26')](_['startCase'](_0x399caa)+_0x8ee7('0x27'),_0x10ae4b)[_0x8ee7('0x28')](function(_0x5678c4){if(_0x5678c4[_0x8ee7('0x29')])throw new Error(util['format'](_0x8ee7('0x2a'),_0x399caa));return _0x5678c4['result'];})[_0x8ee7('0x2b')](function(_0x3d0980){throw _0x3d0980;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x1d9511,_0x13747b,_0xf0cfdd,_0x185163){var _0x5a2818=DEFAULT_QUEUE_ATTRIBUTES;if(_0xf0cfdd==='voice'){if(_0x185163===_0x8ee7('0x2c')){_0x5a2818=_0x5a2818[_0x8ee7('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x185163===_0x8ee7('0x2e')){_0x5a2818=_0x5a2818[_0x8ee7('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1d9511[_0x8ee7('0x2f')](function(_0x5f2d18){var _0x492c0f=_0x5f2d18[_0x8ee7('0x30')]({'plain':!![]});_0x492c0f[_0x8ee7('0x6')]=0x0;_0x492c0f[_0x8ee7('0x31')]=0x0;_0x492c0f[_0x8ee7('0x5')]=0x0;_0x492c0f[_0x8ee7('0x4')]=0x0;_0x492c0f[_0x8ee7('0x7')]=0x0;if(_0xf0cfdd===_0x8ee7('0x25')){_0x492c0f[_0x8ee7('0xd')]=0x0;_0x492c0f[_0x8ee7('0x8')]=0x0;if(_0x185163===_0x8ee7('0x2e')){_0x492c0f['pTalking']=0x0;_0x492c0f['originated']=0x0;}}var _0x28a55c=_[_0x8ee7('0x32')](_0x13747b,['id',_0x492c0f['id']]);if(_0x28a55c){_[_0x8ee7('0x33')](_0x492c0f,_['pick'](_0x28a55c,_0x5a2818));}return _0x492c0f;});}exports[_0x8ee7('0x34')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index f5ff29a..8a5122f 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0xc8a598,_0x8ffd7c){var _0x2a6225=function(_0x5f2d46){while(--_0x5f2d46){_0xc8a598['push'](_0xc8a598['shift']());}};_0x2a6225(++_0x8ffd7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x16bf05,_0x4f70da){var _0xbcf546=function(_0x70b01d){while(--_0x70b01d){_0x16bf05['push'](_0x16bf05['shift']());}};_0xbcf546(++_0x4f70da);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 34fc773..f0945c8 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 _0x0db1=['hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','length','filter','family','IPv4','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','map','model','join','createHash','md5','digest','hex','getUuid','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace'];(function(_0xcaff5e,_0x8b970d){var _0x41ddc5=function(_0x52cf2f){while(--_0x52cf2f){_0xcaff5e['push'](_0xcaff5e['shift']());}};_0x41ddc5(++_0x8b970d);}(_0x0db1,0x1ee));var _0x10db=function(_0x2f678b,_0x658eee){_0x2f678b=_0x2f678b-0x0;var _0x523f13=_0x0db1[_0x2f678b];return _0x523f13;};'use strict';var _=require(_0x10db('0x0'));var os=require('os');var crypto=require(_0x10db('0x1'));var machine=require(_0x10db('0x2'));var exec=require(_0x10db('0x3'))[_0x10db('0x4')];var config=require(_0x10db('0x5'));function getInterfaces(){var _0x5cffd4=[];var _0x31be15=os[_0x10db('0x6')]();var _0x2ce952=_['orderBy'](_['keys'](_0x31be15));for(var _0xc08d4c=0x0;_0xc08d4c<_0x2ce952[_0x10db('0x7')];_0xc08d4c++){var _0x57809b=_0x31be15[_0x2ce952[_0xc08d4c]][_0x10db('0x8')](function(_0x3fe5cd){return _0x3fe5cd[_0x10db('0x9')]===_0x10db('0xa')&&_0x3fe5cd['internal']===![];});_0x5cffd4=_0x5cffd4['concat'](_0x57809b);}return _0x5cffd4;}function getFirstInterface(){var _0xb2e704=_[_0x10db('0xb')](getInterfaces());return{'macAddress':_0xb2e704&&_0xb2e704['mac']?_0xb2e704[_0x10db('0xc')]:_0x10db('0xd'),'ipAddress':_0xb2e704&&_0xb2e704['address']?_0xb2e704[_0x10db('0xe')]:_0x10db('0xf')};}exports[_0x10db('0x10')]=getFirstInterface;function getCPUhash(){var _0x1ba582=_[_0x10db('0x11')](os['cpus']()[_0x10db('0x12')](function(_0x512756){return _0x512756[_0x10db('0x13')];}))[_0x10db('0x14')](':');return crypto[_0x10db('0x15')](_0x10db('0x16'))['update'](_0x1ba582)[_0x10db('0x17')](_0x10db('0x18'));}exports[_0x10db('0x19')]=function(){var _0x38dd56=os['platform']();var _0x1143f6=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x1143f6[_0x10db('0x1a')](config[_0x10db('0x1b')])){return config[_0x10db('0x1b')];}else if(_0x38dd56===_0x10db('0x1c')){return exec(_0x10db('0x1d'),{'encoding':'utf8'})[_0x10db('0x1e')]('\x0d\x0a','');}else{var _0x1085c4=getFirstInterface();var _0xb94111=getCPUhash();var _0x3677f2=_0xb94111+'|'+os[_0x10db('0x1f')]()+'|'+_0x1085c4[_0x10db('0x20')]+'|'+_0x1085c4[_0x10db('0x21')];var _0x167b5c=crypto[_0x10db('0x15')](_0x10db('0x16'))['update'](_0x3677f2)[_0x10db('0x17')]('hex');return _0x167b5c[_0x10db('0x22')](0x0,0x8)+'-'+_0x167b5c[_0x10db('0x22')](0x8,0xc)+'-'+_0x167b5c['substring'](0xc,0x10)+'-'+_0x167b5c[_0x10db('0x22')](0x10,0x14)+'-'+_0x167b5c[_0x10db('0x22')](0x14);}}; \ No newline at end of file +var _0x7c7e=['bimedia-machine-uuid','child_process','execSync','../environment','orderBy','keys','length','family','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','update','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','digest','substring','lodash','crypto'];(function(_0x243f60,_0x2b8786){var _0x36297=function(_0x2cb281){while(--_0x2cb281){_0x243f60['push'](_0x243f60['shift']());}};_0x36297(++_0x2b8786);}(_0x7c7e,0x116));var _0xe7c7=function(_0x3c9fbc,_0x47cae5){_0x3c9fbc=_0x3c9fbc-0x0;var _0x355ce9=_0x7c7e[_0x3c9fbc];return _0x355ce9;};'use strict';var _=require(_0xe7c7('0x0'));var os=require('os');var crypto=require(_0xe7c7('0x1'));var machine=require(_0xe7c7('0x2'));var exec=require(_0xe7c7('0x3'))[_0xe7c7('0x4')];var config=require(_0xe7c7('0x5'));function getInterfaces(){var _0x34504c=[];var _0x59ea42=os['networkInterfaces']();var _0x16b93e=_[_0xe7c7('0x6')](_[_0xe7c7('0x7')](_0x59ea42));for(var _0x1ccee5=0x0;_0x1ccee5<_0x16b93e[_0xe7c7('0x8')];_0x1ccee5++){var _0x7db532=_0x59ea42[_0x16b93e[_0x1ccee5]]['filter'](function(_0xf8ff0d){return _0xf8ff0d[_0xe7c7('0x9')]==='IPv4'&&_0xf8ff0d[_0xe7c7('0xa')]===![];});_0x34504c=_0x34504c[_0xe7c7('0xb')](_0x7db532);}return _0x34504c;}function getFirstInterface(){var _0x40aeba=_[_0xe7c7('0xc')](getInterfaces());return{'macAddress':_0x40aeba&&_0x40aeba[_0xe7c7('0xd')]?_0x40aeba[_0xe7c7('0xd')]:'00:00:00:00:00:00','ipAddress':_0x40aeba&&_0x40aeba['address']?_0x40aeba[_0xe7c7('0xe')]:_0xe7c7('0xf')};}exports[_0xe7c7('0x10')]=getFirstInterface;function getCPUhash(){var _0x5eb3d8=_[_0xe7c7('0x6')](os[_0xe7c7('0x11')]()[_0xe7c7('0x12')](function(_0x464f43){return _0x464f43['model'];}))[_0xe7c7('0x13')](':');return crypto[_0xe7c7('0x14')](_0xe7c7('0x15'))[_0xe7c7('0x16')](_0x5eb3d8)['digest'](_0xe7c7('0x17'));}exports[_0xe7c7('0x18')]=function(){var _0x5bc7f0=os[_0xe7c7('0x19')]();var _0x4b3477=/[0-9a-f-]{36}/;if(config[_0xe7c7('0x1a')]&&_0x4b3477[_0xe7c7('0x1b')](config[_0xe7c7('0x1a')])){return config[_0xe7c7('0x1a')];}else if(_0x5bc7f0===_0xe7c7('0x1c')){return exec(_0xe7c7('0x1d'),{'encoding':_0xe7c7('0x1e')})[_0xe7c7('0x1f')]('\x0d\x0a','');}else{var _0x369f7b=getFirstInterface();var _0x2c9cae=getCPUhash();var _0xa296d6=_0x2c9cae+'|'+os['hostname']()+'|'+_0x369f7b[_0xe7c7('0x20')]+'|'+_0x369f7b['ipAddress'];var _0x50f859=crypto[_0xe7c7('0x14')](_0xe7c7('0x15'))['update'](_0xa296d6)[_0xe7c7('0x21')](_0xe7c7('0x17'));return _0x50f859[_0xe7c7('0x22')](0x0,0x8)+'-'+_0x50f859['substring'](0x8,0xc)+'-'+_0x50f859[_0xe7c7('0x22')](0xc,0x10)+'-'+_0x50f859[_0xe7c7('0x22')](0x10,0x14)+'-'+_0x50f859[_0xe7c7('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 5d262ad..b1d6cd7 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 _0xfd46=['../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','bluebird','pkginfo','version','../../components/encryptor','./hardware'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0xfd46,0xcb));var _0x6fd4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xfd46[_0xfae23b];return _0x200640;};'use strict';var util=require(_0x6fd4('0x0'));var moment=require(_0x6fd4('0x1'));var rp=require('request-promise');var BPromise=require(_0x6fd4('0x2'));var pkginfo=require(_0x6fd4('0x3'))(module,_0x6fd4('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x6fd4('0x5'));var hardware=require(_0x6fd4('0x6'));var logger=require(_0x6fd4('0x7'))(_0x6fd4('0x8'));var HOST=_0x6fd4('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x20baa1){return new BPromise(function(_0x2545f9,_0x15342d){var _0x3bb16e=util[_0x6fd4('0xa')](_0x6fd4('0xb'),HOST,_0x20baa1,module['exports']['version']);if(oldToken){_0x3bb16e=util[_0x6fd4('0xa')](_0x6fd4('0xc'),HOST,_0x20baa1,module[_0x6fd4('0xd')]['version'],oldToken);}var _0x1c0191={'uri':_0x3bb16e,'method':_0x6fd4('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x1c0191)[_0x6fd4('0xf')](function(_0x1ffbf2){_0x2545f9(_0x1ffbf2);})['catch'](function(_0x24bf56){_0x15342d(_0x24bf56);});});}function manageLicense(_0x2bc923,_0x170f30){var _0x27cc51=_0x170f30[_0x6fd4('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x27cc51[_0x6fd4('0x11')]!==_0x2bc923&&!_0x27cc51[_0x6fd4('0x12')]){oldToken=_0x27cc51['data1'];}httpRequest(_0x2bc923)[_0x6fd4('0xf')](function(_0xc06957){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xc06957[_0x6fd4('0x13')]){isOldTokenSent=![];if(!_0x27cc51[_0x6fd4('0x8')]&&_0x27cc51[_0x6fd4('0x8')]!=_0xc06957['license']||_0x27cc51[_0x6fd4('0x8')]&&_0x27cc51['data2']){logger[_0x6fd4('0x14')](_0x6fd4('0x15'));}if(_0x27cc51[_0x6fd4('0x8')]&&!_0x27cc51['data2']&&_0x27cc51[_0x6fd4('0x8')]!=_0xc06957[_0x6fd4('0x8')]){logger['info'](_0x6fd4('0x16'));}if(_0x27cc51[_0x6fd4('0x8')]&&!_0x27cc51[_0x6fd4('0x12')]&&_0x27cc51[_0x6fd4('0x8')]==_0xc06957['license']){return _0x170f30;}return _0x170f30[_0x6fd4('0x17')]({'data1':_0x2bc923,'data2':null,'license':_0xc06957[_0x6fd4('0x8')]});}else{if(_0xc06957[_0x6fd4('0x8')]||_0x27cc51[_0x6fd4('0x8')]){if(!_0x27cc51[_0x6fd4('0x12')]){if(_0x27cc51[_0x6fd4('0x11')]==_0x2bc923){GRAY_PERIOD_REASON=_0x6fd4('0x18');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x6fd4('0x19');logger[_0x6fd4('0x14')](_0x6fd4('0x1a'),_0x27cc51[_0x6fd4('0x11')],_0x2bc923);}logger[_0x6fd4('0x14')](_0x6fd4('0x1b'),GRAY_PERIOD_REASON[_0x6fd4('0x1c')](),moment()[_0x6fd4('0xa')](_0x6fd4('0x1d')));return _0x170f30[_0x6fd4('0x17')]({'data2':encryptor['encryptString'](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x6fd4('0x1e')](encryptor['decryptString'](_0x27cc51['data2']),_0x6fd4('0x1f'))>DAYS){logger['info'](_0x6fd4('0x20'),moment()[_0x6fd4('0xa')](_0x6fd4('0x1d')));isOldTokenSent=![];return _0x170f30[_0x6fd4('0x17')]({'data1':_0x2bc923,'data2':null,'license':null});}}}else{if(_0x27cc51[_0x6fd4('0x11')]!=_0x2bc923){logger[_0x6fd4('0x14')](_0x6fd4('0x1a'),_0x27cc51[_0x6fd4('0x11')],_0x2bc923);return _0x170f30[_0x6fd4('0x17')]({'data1':_0x2bc923,'data2':null,'license':null});}}}return _0x170f30;})['then'](function(_0x224c24){_0x170f30=_0x224c24;})[_0x6fd4('0x21')](function(_0x254ade){logger[_0x6fd4('0x22')](_0x254ade[_0x6fd4('0x23')]);})[_0x6fd4('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x6fd4('0x25')](),_0x170f30);},TIME);});}function defaultLicense(){var _0x310571=hardware[_0x6fd4('0x25')]();if(_0x310571){return db['License'][_0x6fd4('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x310571}})[_0x6fd4('0x27')](function(_0x43bfd7,_0x3c92e4){logger[_0x6fd4('0x14')](_0x6fd4('0x28'),_0x310571);manageLicense(_0x310571,_0x43bfd7);})['catch'](function(_0x116639){logger[_0x6fd4('0x22')](_0x116639[_0x6fd4('0x23')]);});}}exports[_0x6fd4('0x29')]=defaultLicense; \ No newline at end of file +var _0x401f=['version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','catch','default','util','moment','request-promise','bluebird','pkginfo'];(function(_0x4ae9e2,_0x46a991){var _0x23177e=function(_0x2557a0){while(--_0x2557a0){_0x4ae9e2['push'](_0x4ae9e2['shift']());}};_0x23177e(++_0x46a991);}(_0x401f,0x175));var _0xf401=function(_0xe666d4,_0x239fbc){_0xe666d4=_0xe666d4-0x0;var _0x3b7a94=_0x401f[_0xe666d4];return _0x3b7a94;};'use strict';var util=require(_0xf401('0x0'));var moment=require(_0xf401('0x1'));var rp=require(_0xf401('0x2'));var BPromise=require(_0xf401('0x3'));var pkginfo=require(_0xf401('0x4'))(module,_0xf401('0x5'));var db=require(_0xf401('0x6'))['db'];var encryptor=require(_0xf401('0x7'));var hardware=require('./hardware');var logger=require(_0xf401('0x8'))(_0xf401('0x9'));var HOST=_0xf401('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5d054a){return new BPromise(function(_0x8582ab,_0x10417f){var _0x4df824=util['format'](_0xf401('0xb'),HOST,_0x5d054a,module['exports'][_0xf401('0x5')]);if(oldToken){_0x4df824=util[_0xf401('0xc')](_0xf401('0xd'),HOST,_0x5d054a,module[_0xf401('0xe')]['version'],oldToken);}var _0x29b88b={'uri':_0x4df824,'method':_0xf401('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x29b88b)['then'](function(_0x36ad08){_0x8582ab(_0x36ad08);})['catch'](function(_0x28dbde){_0x10417f(_0x28dbde);});});}function manageLicense(_0x3d6584,_0x199a30){var _0xc9e6fb=_0x199a30[_0xf401('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0xc9e6fb[_0xf401('0x11')]!==_0x3d6584&&!_0xc9e6fb[_0xf401('0x12')]){oldToken=_0xc9e6fb[_0xf401('0x11')];}httpRequest(_0x3d6584)['then'](function(_0x56a46d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x56a46d['active']){isOldTokenSent=![];if(!_0xc9e6fb[_0xf401('0x9')]&&_0xc9e6fb[_0xf401('0x9')]!=_0x56a46d[_0xf401('0x9')]||_0xc9e6fb['license']&&_0xc9e6fb[_0xf401('0x12')]){logger[_0xf401('0x13')](_0xf401('0x14'));}if(_0xc9e6fb[_0xf401('0x9')]&&!_0xc9e6fb[_0xf401('0x12')]&&_0xc9e6fb[_0xf401('0x9')]!=_0x56a46d[_0xf401('0x9')]){logger['info'](_0xf401('0x15'));}if(_0xc9e6fb[_0xf401('0x9')]&&!_0xc9e6fb['data2']&&_0xc9e6fb[_0xf401('0x9')]==_0x56a46d[_0xf401('0x9')]){return _0x199a30;}return _0x199a30[_0xf401('0x16')]({'data1':_0x3d6584,'data2':null,'license':_0x56a46d[_0xf401('0x9')]});}else{if(_0x56a46d[_0xf401('0x9')]||_0xc9e6fb['license']){if(!_0xc9e6fb[_0xf401('0x12')]){if(_0xc9e6fb['data1']==_0x3d6584){GRAY_PERIOD_REASON=_0xf401('0x17');logger[_0xf401('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xf401('0x18');logger[_0xf401('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xc9e6fb['data1'],_0x3d6584);}logger[_0xf401('0x13')](_0xf401('0x19'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xf401('0xc')]('YYYY-MM-DD\x20HH:mm'));return _0x199a30[_0xf401('0x16')]({'data2':encryptor[_0xf401('0x1a')](moment()[_0xf401('0xc')](_0xf401('0x1b')))});}else{if(moment()[_0xf401('0x1c')](encryptor[_0xf401('0x1d')](_0xc9e6fb[_0xf401('0x12')]),_0xf401('0x1e'))>DAYS){logger[_0xf401('0x13')](_0xf401('0x1f'),moment()[_0xf401('0xc')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x199a30[_0xf401('0x16')]({'data1':_0x3d6584,'data2':null,'license':null});}}}else{if(_0xc9e6fb[_0xf401('0x11')]!=_0x3d6584){logger[_0xf401('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xc9e6fb[_0xf401('0x11')],_0x3d6584);return _0x199a30[_0xf401('0x16')]({'data1':_0x3d6584,'data2':null,'license':null});}}}return _0x199a30;})['then'](function(_0x372b77){_0x199a30=_0x372b77;})['catch'](function(_0x46e510){logger[_0xf401('0x20')](_0x46e510[_0xf401('0x21')]);})[_0xf401('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0xf401('0x23')](),_0x199a30);},TIME);});}function defaultLicense(){var _0x4f56b2=hardware[_0xf401('0x23')]();if(_0x4f56b2){return db[_0xf401('0x24')][_0xf401('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x4f56b2}})[_0xf401('0x26')](function(_0x1b7bed,_0x5c18c7){logger['info'](_0xf401('0x27'),_0x4f56b2);manageLicense(_0x4f56b2,_0x1b7bed);})[_0xf401('0x28')](function(_0x29afcc){logger[_0xf401('0x20')](_0x29afcc['message']);});}}exports[_0xf401('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 9898c51..bdd1fb9 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 _0x7e3d=['data2','split','decryptString','format','%s:%s:%s','parse','machineUuid','gray','deadline','add','changed','message','User','findAll','role','COUNT','sequelize','col','count','admin','user','telephone','users','forEach','pick','countBy','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found'];(function(_0xa64531,_0x48c65f){var _0x1b1f42=function(_0x78e575){while(--_0x78e575){_0xa64531['push'](_0xa64531['shift']());}};_0x1b1f42(++_0x48c65f);}(_0x7e3d,0x101));var _0xd7e3=function(_0x59ef3d,_0x5c7aee){_0x59ef3d=_0x59ef3d-0x0;var _0x585558=_0x7e3d[_0x59ef3d];return _0x585558;};'use strict';var util=require(_0xd7e3('0x0'));var _=require(_0xd7e3('0x1'));var moment=require(_0xd7e3('0x2'));var BPromise=require(_0xd7e3('0x3'));var hardware=require(_0xd7e3('0x4'));var encryptor=require(_0xd7e3('0x5'));var db=require(_0xd7e3('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd7e3('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd7e3('0x8'),'machineUuid':hardware[_0xd7e3('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xd7e3('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x52d17b){return new BPromise(function(_0x5754a0,_0x5fb5b4){return db[_0xd7e3('0xa')]['find'](_[_0xd7e3('0xb')](_0x52d17b,{'raw':!![],'where':{'id':0x1}}))[_0xd7e3('0xc')](function(_0x29b39c){return checkLicense(_0x29b39c,null);})[_0xd7e3('0xc')](function(_0x393431){_0x5754a0(_0x393431);return;})[_0xd7e3('0xd')](function(_0x3493ae){_0x5fb5b4(_0x3493ae);});});}function checkLicense(_0x5ed509,_0x3fb6e7){if(!_0x5ed509){demoLicense[_0xd7e3('0xe')]=_0x5ed509[_0xd7e3('0xf')];return demoLicense;}try{var _0x419305=_0x3fb6e7||_0x5ed509[_0xd7e3('0x10')];if(_[_0xd7e3('0x11')](_0x419305)){throw new Error(_0xd7e3('0x12'));}var _0x54827a=_0x5ed509['data1'];var _0x3cde81=_0x5ed509[_0xd7e3('0x13')];var _0x40311c=_0x54827a[_0xd7e3('0x14')]('-')[0x4];var _0x2d6f29=_0x54827a[_0xd7e3('0x14')]('-')[0x0];var _0x45494b=encryptor[_0xd7e3('0x15')](_0x419305,util[_0xd7e3('0x16')](_0xd7e3('0x17'),_0x40311c,_0x54827a,_0x2d6f29));var _0x525b97=JSON[_0xd7e3('0x18')](_0x45494b);_0x525b97['demo']=![];_0x525b97[_0xd7e3('0xe')]=_0x54827a;_0x525b97[_0xd7e3('0x19')]=hardware[_0xd7e3('0x9')]();if(_0x3cde81){var _0x43071a=encryptor[_0xd7e3('0x15')](_0x3cde81);_0x525b97[_0xd7e3('0x1a')]=_0x43071a;_0x525b97[_0xd7e3('0x1b')]=moment(_0x43071a)[_0xd7e3('0x1c')](0x7,'days')[_0xd7e3('0x16')]();_0x525b97['grayReason']=_0x525b97[_0xd7e3('0xe')]!=_0x525b97[_0xd7e3('0x19')]?_0xd7e3('0x1d'):'disabled';}return _0x525b97;}catch(_0x19d8fc){breakingLicense[_0xd7e3('0xe')]=_0x5ed509['data1'];breakingLicense[_0xd7e3('0x1e')]=_0x19d8fc[_0xd7e3('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x443d78,_0x59e6b1){getLicense()[_0xd7e3('0xc')](function(_0x19dfe5){return db[_0xd7e3('0x1f')][_0xd7e3('0x20')]({'attributes':[_0xd7e3('0x21'),[db['sequelize']['fn'](_0xd7e3('0x22'),db[_0xd7e3('0x23')][_0xd7e3('0x24')](_0xd7e3('0x21'))),_0xd7e3('0x25')]],'group':_0xd7e3('0x21'),'where':{'role':{'$or':[_0xd7e3('0x26'),_0xd7e3('0x27'),_0xd7e3('0x28')]}},'raw':!![]})['then'](function(_0x525c96){var _0x1b1cb0={'user':_0x19dfe5[_0xd7e3('0x29')]||0x0,'telephone':_0x19dfe5['telephones']||0x0};_0x525c96[_0xd7e3('0x2a')](function(_0x107c7e){var _0x3c94f7=_0x107c7e[_0xd7e3('0x21')]==='admin'?_0xd7e3('0x27'):_0x107c7e[_0xd7e3('0x21')];_0x1b1cb0[_0x3c94f7]-=_0x107c7e[_0xd7e3('0x25')];if(_0x1b1cb0[_0x3c94f7]<0x0)_0x1b1cb0[_0x3c94f7]=0x0;});_0x443d78(_0x1b1cb0);return;});})[_0xd7e3('0xd')](function(_0x401c18){_0x59e6b1(_0x401c18);});});}function checkUserLimits(_0x95efe7){return new BPromise(function(_0x5ae281,_0x308f71){getLimits()[_0xd7e3('0xc')](function(_0x12accd){var _0x57e895=_[_0xd7e3('0x2b')](_[_0xd7e3('0x2c')](_0x95efe7,'role'),[_0xd7e3('0x26'),_0xd7e3('0x27'),_0xd7e3('0x28')]);var _0x32c2dd=(_0x57e895[_0xd7e3('0x26')]||0x0)+(_0x57e895[_0xd7e3('0x27')]||0x0);var _0x16ace2=_0x57e895[_0xd7e3('0x28')]||0x0;if(_0x32c2dd>_0x12accd[_0xd7e3('0x27')])return _0x308f71('License\x20limit\x20reached\x20for\x20users');if(_0x16ace2>_0x12accd[_0xd7e3('0x28')])return _0x308f71('License\x20limit\x20reached\x20for\x20telephones');return _0x5ae281();})[_0xd7e3('0xd')](function(_0x502b0f){_0x308f71(_0x502b0f);});});}module[_0xd7e3('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x273b=['grayReason','disabled','message','User','findAll','role','sequelize','COUNT','col','count','user','telephone','telephones','forEach','pick','countBy','admin','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','catch','uuid','data1','license','isEmpty','data2','split','%s:%s:%s','demo','gray','add'];(function(_0x4b1bd4,_0x14e7f5){var _0x21b842=function(_0x3ba203){while(--_0x3ba203){_0x4b1bd4['push'](_0x4b1bd4['shift']());}};_0x21b842(++_0x14e7f5);}(_0x273b,0x6a));var _0xb273=function(_0x514543,_0x2d5ce5){_0x514543=_0x514543-0x0;var _0x3fd3d5=_0x273b[_0x514543];return _0x3fd3d5;};'use strict';var util=require('util');var _=require(_0xb273('0x0'));var moment=require('moment');var BPromise=require(_0xb273('0x1'));var hardware=require(_0xb273('0x2'));var encryptor=require(_0xb273('0x3'));var db=require(_0xb273('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb273('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb273('0x6'),'machineUuid':hardware[_0xb273('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb273('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb273('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xb24ba6){return new BPromise(function(_0x197e65,_0x582a49){return db[_0xb273('0x9')]['find'](_[_0xb273('0xa')](_0xb24ba6,{'raw':!![],'where':{'id':0x1}}))[_0xb273('0xb')](function(_0x5af8a2){return checkLicense(_0x5af8a2,null);})[_0xb273('0xb')](function(_0x1a296b){_0x197e65(_0x1a296b);return;})[_0xb273('0xc')](function(_0x1207e6){_0x582a49(_0x1207e6);});});}function checkLicense(_0x4d870f,_0x25f594){if(!_0x4d870f){demoLicense[_0xb273('0xd')]=_0x4d870f[_0xb273('0xe')];return demoLicense;}try{var _0x98775c=_0x25f594||_0x4d870f[_0xb273('0xf')];if(_[_0xb273('0x10')](_0x98775c)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xaf5fd5=_0x4d870f['data1'];var _0x5ad3af=_0x4d870f[_0xb273('0x11')];var _0x4b1100=_0xaf5fd5[_0xb273('0x12')]('-')[0x4];var _0x4d8269=_0xaf5fd5['split']('-')[0x0];var _0x527674=encryptor['decryptString'](_0x98775c,util['format'](_0xb273('0x13'),_0x4b1100,_0xaf5fd5,_0x4d8269));var _0x2333d9=JSON['parse'](_0x527674);_0x2333d9[_0xb273('0x14')]=![];_0x2333d9['uuid']=_0xaf5fd5;_0x2333d9['machineUuid']=hardware[_0xb273('0x7')]();if(_0x5ad3af){var _0x50eea8=encryptor['decryptString'](_0x5ad3af);_0x2333d9[_0xb273('0x15')]=_0x50eea8;_0x2333d9['deadline']=moment(_0x50eea8)[_0xb273('0x16')](0x7,'days')['format']();_0x2333d9[_0xb273('0x17')]=_0x2333d9['uuid']!=_0x2333d9['machineUuid']?'changed':_0xb273('0x18');}return _0x2333d9;}catch(_0xc507da){breakingLicense[_0xb273('0xd')]=_0x4d870f[_0xb273('0xe')];breakingLicense[_0xb273('0x19')]=_0xc507da[_0xb273('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5b874e,_0x4565da){getLicense()[_0xb273('0xb')](function(_0x42bfdf){return db[_0xb273('0x1a')][_0xb273('0x1b')]({'attributes':[_0xb273('0x1c'),[db[_0xb273('0x1d')]['fn'](_0xb273('0x1e'),db['sequelize'][_0xb273('0x1f')](_0xb273('0x1c'))),_0xb273('0x20')]],'group':'role','where':{'role':{'$or':['admin',_0xb273('0x21'),_0xb273('0x22')]}},'raw':!![]})[_0xb273('0xb')](function(_0x4dc155){var _0x29da82={'user':_0x42bfdf['users']||0x0,'telephone':_0x42bfdf[_0xb273('0x23')]||0x0};_0x4dc155[_0xb273('0x24')](function(_0x34c96d){var _0x3eb17d=_0x34c96d[_0xb273('0x1c')]==='admin'?_0xb273('0x21'):_0x34c96d[_0xb273('0x1c')];_0x29da82[_0x3eb17d]-=_0x34c96d[_0xb273('0x20')];if(_0x29da82[_0x3eb17d]<0x0)_0x29da82[_0x3eb17d]=0x0;});_0x5b874e(_0x29da82);return;});})[_0xb273('0xc')](function(_0x17e3d3){_0x4565da(_0x17e3d3);});});}function checkUserLimits(_0x36b832){return new BPromise(function(_0x483ff7,_0x42f656){getLimits()[_0xb273('0xb')](function(_0x1a52aa){var _0x2eab62=_[_0xb273('0x25')](_[_0xb273('0x26')](_0x36b832,_0xb273('0x1c')),['admin',_0xb273('0x21'),_0xb273('0x22')]);var _0x18fd38=(_0x2eab62[_0xb273('0x27')]||0x0)+(_0x2eab62['user']||0x0);var _0x44df15=_0x2eab62['telephone']||0x0;if(_0x18fd38>_0x1a52aa[_0xb273('0x21')])return _0x42f656(_0xb273('0x28'));if(_0x44df15>_0x1a52aa[_0xb273('0x22')])return _0x42f656(_0xb273('0x29'));return _0x483ff7();})[_0xb273('0xc')](function(_0x5812ee){_0x42f656(_0x5812ee);});});}module[_0xb273('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 0deeec0..273b5a1 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 _0xb62e=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x59a5e9,_0x2296e3){var _0x45ee50=function(_0x474cbb){while(--_0x474cbb){_0x59a5e9['push'](_0x59a5e9['shift']());}};_0x45ee50(++_0x2296e3);}(_0xb62e,0x1de));var _0xeb62=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb62e[_0x618414];return _0x21c19a;};'use strict';module[_0xeb62('0x0')]={'DOMAIN':_0xeb62('0x1'),'SESSION_SECRET':_0xeb62('0x2'),'GOOGLE_ID':_0xeb62('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x2032=['app-id','http://localhost:9000','myappanuglar-secret'];(function(_0x2a165d,_0x595f5f){var _0x120536=function(_0x43382a){while(--_0x43382a){_0x2a165d['push'](_0x2a165d['shift']());}};_0x120536(++_0x595f5f);}(_0x2032,0xd9));var _0x2203=function(_0x4570a8,_0x4c2a54){_0x4570a8=_0x4570a8-0x0;var _0x2f39a3=_0x2032[_0x4570a8];return _0x2f39a3;};'use strict';module['exports']={'DOMAIN':_0x2203('0x0'),'SESSION_SECRET':_0x2203('0x1'),'GOOGLE_ID':_0x2203('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 9fcddce..260ebbc 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb527=['fileLogger','exports','../utils/loggers'];(function(_0x22aef8,_0x4bc9ef){var _0x4af2ff=function(_0x23fdf8){while(--_0x23fdf8){_0x22aef8['push'](_0x22aef8['shift']());}};_0x4af2ff(++_0x4bc9ef);}(_0xb527,0x1b5));var _0x7b52=function(_0x47ecf6,_0x366d16){_0x47ecf6=_0x47ecf6-0x0;var _0x912276=_0xb527[_0x47ecf6];return _0x912276;};'use strict';var fileLogger=require(_0x7b52('0x0'))[_0x7b52('0x1')];module[_0x7b52('0x2')]=fileLogger; \ No newline at end of file +var _0x5ce9=['../utils/loggers','fileLogger','exports'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0x5ce9,0x11d));var _0x95ce=function(_0x1d3c84,_0x27447d){_0x1d3c84=_0x1d3c84-0x0;var _0x211702=_0x5ce9[_0x1d3c84];return _0x211702;};'use strict';var fileLogger=require(_0x95ce('0x0'))[_0x95ce('0x1')];module[_0x95ce('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 38dc036..2175989 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 _0x06d6=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','../../config/environment','join','legacy-libs','ami','../../services/agi/index.js','email','../../services/email/index.js','routing'];(function(_0x2bbd2d,_0x37c3c4){var _0x257dc9=function(_0x1928ff){while(--_0x1928ff){_0x2bbd2d['push'](_0x2bbd2d['shift']());}};_0x257dc9(++_0x37c3c4);}(_0x06d6,0x1cc));var _0x606d=function(_0x1f0d78,_0x3398bb){_0x1f0d78=_0x1f0d78-0x0;var _0x5c16fd=_0x06d6[_0x1f0d78];return _0x5c16fd;};'use strict';var path=require('path');var cfg=require(_0x606d('0x0'));var env={'NODE_PATH':path['resolve'](path[_0x606d('0x1')](cfg['root'],_0x606d('0x2')))};var pm2config={'apps':[{'name':'express','script':path[_0x606d('0x1')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x606d('0x3'),'script':path[_0x606d('0x1')](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0x606d('0x1')](__dirname,_0x606d('0x4')),'env':env},{'name':_0x606d('0x5'),'script':path[_0x606d('0x1')](__dirname,_0x606d('0x6')),'env':env},{'name':_0x606d('0x7'),'script':path[_0x606d('0x1')](__dirname,_0x606d('0x8')),'env':env},{'name':_0x606d('0x9'),'script':path[_0x606d('0x1')](__dirname,_0x606d('0xa')),'env':env}]};module[_0x606d('0xb')]=pm2config; \ No newline at end of file +var _0x07e3=['resolve','join','root','legacy-libs','express','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/routing/index.js','xdr','path','../../config/environment'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x07e3,0x129));var _0x307e=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0x07e3[_0x336ca2];return _0xda59a6;};'use strict';var path=require(_0x307e('0x0'));var cfg=require(_0x307e('0x1'));var env={'NODE_PATH':path[_0x307e('0x2')](path[_0x307e('0x3')](cfg[_0x307e('0x4')],_0x307e('0x5')))};var pm2config={'apps':[{'name':_0x307e('0x6'),'script':path[_0x307e('0x3')](__dirname,'../../services/express/index.js'),'env':env},{'name':'ami','script':path[_0x307e('0x3')](__dirname,_0x307e('0x7')),'env':env},{'name':_0x307e('0x8'),'script':path[_0x307e('0x3')](__dirname,_0x307e('0x9')),'env':env},{'name':_0x307e('0xa'),'script':path[_0x307e('0x3')](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path[_0x307e('0x3')](__dirname,_0x307e('0xb')),'env':env},{'name':_0x307e('0xc'),'script':path[_0x307e('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index e7e579f..19b94bb 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 _0xc447=['delete','dump','saved','bluebird','./config','connect','connected','then','start','stop','disconnect','restart','list','describe'];(function(_0xca0087,_0x1c66ce){var _0x12e9ed=function(_0x54210b){while(--_0x54210b){_0xca0087['push'](_0xca0087['shift']());}};_0x12e9ed(++_0x1c66ce);}(_0xc447,0xab));var _0x7c44=function(_0x58bdd0,_0x208207){_0x58bdd0=_0x58bdd0-0x0;var _0x166fde=_0xc447[_0x58bdd0];return _0x166fde;};'use strict';var pm2=require('pm2');var BPromise=require(_0x7c44('0x0'));var config=require(_0x7c44('0x1'));function connect(){return new BPromise(function(_0x29a847,_0x137e3d){return pm2[_0x7c44('0x2')](function(_0x5f134d){if(_0x5f134d){return _0x137e3d(_0x5f134d);}return _0x29a847(_0x7c44('0x3'));});});};exports['start']=function(_0x1f3af9){return connect()[_0x7c44('0x4')](function(){return new BPromise(function(_0x831fe5,_0x2607e2){return pm2[_0x7c44('0x5')](_0x1f3af9,function(_0x8d4507,_0x32a3d4){if(_0x8d4507){return _0x2607e2(_0x8d4507);}pm2['disconnect']();return _0x831fe5(_0x32a3d4);});});});};exports[_0x7c44('0x6')]=function(_0x2f4cce){return connect()[_0x7c44('0x4')](function(){return new BPromise(function(_0x435cc0,_0x95dd55){return pm2[_0x7c44('0x6')](_0x2f4cce,function(_0xd71de6,_0x29fc2f){if(_0xd71de6){return _0x95dd55(_0xd71de6);}pm2[_0x7c44('0x7')]();return _0x435cc0(_0x29fc2f);});});});};exports[_0x7c44('0x8')]=function(_0x41e04b){return connect()[_0x7c44('0x4')](function(){return new BPromise(function(_0x491e5d,_0x3522c9){return pm2[_0x7c44('0x8')](_0x41e04b,function(_0x144434,_0x22f001){if(_0x144434){return _0x3522c9(_0x144434);}pm2[_0x7c44('0x7')]();return _0x491e5d(_0x22f001);});});});};exports[_0x7c44('0x9')]=function(){return connect()[_0x7c44('0x4')](function(){return new BPromise(function(_0x5ac3f2,_0x1ae187){return pm2[_0x7c44('0x9')](function(_0x28d360,_0x29bac3){if(_0x28d360){return _0x1ae187(_0x28d360);}pm2[_0x7c44('0x7')]();return _0x5ac3f2(_0x29bac3);});});});};exports[_0x7c44('0xa')]=function(_0x1a45da){return connect()['then'](function(){return new BPromise(function(_0x2b8a1a,_0x3d4420){return pm2[_0x7c44('0xa')](_0x1a45da,function(_0xce7806,_0x3de15b){if(_0xce7806){return _0x3d4420(_0xce7806);}pm2[_0x7c44('0x7')]();return _0x2b8a1a(_0x3de15b);});});});};exports[_0x7c44('0xb')]=function(_0x45c78c){return connect()['then'](function(){return new BPromise(function(_0xfea2f6,_0x1d1e2e){return pm2['delete'](_0x45c78c,function(_0x5c3e2b,_0x529b74){if(_0x5c3e2b){return _0x1d1e2e(_0x5c3e2b);}pm2['disconnect']();return _0xfea2f6(_0x529b74);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x2f3fb1,_0x3078fd){return pm2[_0x7c44('0xc')](function(_0x3c0030){if(_0x3c0030){return _0x3078fd(_0x3c0030);}return _0x2f3fb1(_0x7c44('0xd'));});});});}; \ No newline at end of file +var _0x0fec=['stop','then','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connected','start','disconnect'];(function(_0x1f38a0,_0x1a5a9d){var _0x3fa815=function(_0x340313){while(--_0x340313){_0x1f38a0['push'](_0x1f38a0['shift']());}};_0x3fa815(++_0x1a5a9d);}(_0x0fec,0x190));var _0xc0fe=function(_0x41d116,_0x36f9f9){_0x41d116=_0x41d116-0x0;var _0x17a999=_0x0fec[_0x41d116];return _0x17a999;};'use strict';var pm2=require(_0xc0fe('0x0'));var BPromise=require(_0xc0fe('0x1'));var config=require(_0xc0fe('0x2'));function connect(){return new BPromise(function(_0x424ddb,_0x18f944){return pm2['connect'](function(_0x2f83df){if(_0x2f83df){return _0x18f944(_0x2f83df);}return _0x424ddb(_0xc0fe('0x3'));});});};exports['start']=function(_0x3f6eb5){return connect()['then'](function(){return new BPromise(function(_0x1f32d1,_0x3459de){return pm2[_0xc0fe('0x4')](_0x3f6eb5,function(_0x5393f4,_0x3146c1){if(_0x5393f4){return _0x3459de(_0x5393f4);}pm2[_0xc0fe('0x5')]();return _0x1f32d1(_0x3146c1);});});});};exports[_0xc0fe('0x6')]=function(_0x23c366){return connect()[_0xc0fe('0x7')](function(){return new BPromise(function(_0x2336e2,_0x3812f2){return pm2[_0xc0fe('0x6')](_0x23c366,function(_0x380b7a,_0x2591a2){if(_0x380b7a){return _0x3812f2(_0x380b7a);}pm2[_0xc0fe('0x5')]();return _0x2336e2(_0x2591a2);});});});};exports[_0xc0fe('0x8')]=function(_0x464ec9){return connect()[_0xc0fe('0x7')](function(){return new BPromise(function(_0x87c0a6,_0x5dfe1c){return pm2[_0xc0fe('0x8')](_0x464ec9,function(_0x236b4d,_0x4739ff){if(_0x236b4d){return _0x5dfe1c(_0x236b4d);}pm2[_0xc0fe('0x5')]();return _0x87c0a6(_0x4739ff);});});});};exports[_0xc0fe('0x9')]=function(){return connect()[_0xc0fe('0x7')](function(){return new BPromise(function(_0x42d16f,_0x3dc819){return pm2[_0xc0fe('0x9')](function(_0x27ef4b,_0x5d903c){if(_0x27ef4b){return _0x3dc819(_0x27ef4b);}pm2['disconnect']();return _0x42d16f(_0x5d903c);});});});};exports[_0xc0fe('0xa')]=function(_0x1c2565){return connect()['then'](function(){return new BPromise(function(_0x59c873,_0x5a5a64){return pm2[_0xc0fe('0xa')](_0x1c2565,function(_0x137b42,_0x436600){if(_0x137b42){return _0x5a5a64(_0x137b42);}pm2[_0xc0fe('0x5')]();return _0x59c873(_0x436600);});});});};exports[_0xc0fe('0xb')]=function(_0x14fa6c){return connect()['then'](function(){return new BPromise(function(_0x5f5c08,_0x4ae1d2){return pm2[_0xc0fe('0xb')](_0x14fa6c,function(_0x4f5e,_0xa9f912){if(_0x4f5e){return _0x4ae1d2(_0x4f5e);}pm2[_0xc0fe('0x5')]();return _0x5f5c08(_0xa9f912);});});});};exports[_0xc0fe('0xc')]=function(){return connect()[_0xc0fe('0x7')](function(){return new BPromise(function(_0x1557b5,_0x4d62aa){return pm2[_0xc0fe('0xc')](function(_0x3bbf48){if(_0x3bbf48){return _0x4d62aa(_0x3bbf48);}return _0x1557b5(_0xc0fe('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 9f0a6a6..dac9246 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 _0x1e6d=['redis','defaults','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','length','map','info','join','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','moment','../../config/environment','../../mysqldb','schedule'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1e6d,0x13b));var _0xd1e6=function(_0x3d6db1,_0x4358f8){_0x3d6db1=_0x3d6db1-0x0;var _0x5e1cc3=_0x1e6d[_0x3d6db1];return _0x5e1cc3;};'use strict';var _=require(_0xd1e6('0x0'));var moment=require(_0xd1e6('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xd1e6('0x2'));var db=require(_0xd1e6('0x3'))['db'];var logger=require('../logger')(_0xd1e6('0x4'));config[_0xd1e6('0x5')]=_[_0xd1e6('0x6')](config[_0xd1e6('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xd1e6('0x7'))(new Redis(config[_0xd1e6('0x5')]));function closeInteractions(){var _0x2cfbc9=0x0;var _0x6af02f=[];return db[_0xd1e6('0x8')]['find']({'raw':!![],'attributes':['id',_0xd1e6('0x9')],'where':{'id':0x1}})[_0xd1e6('0xa')](function(_0x2abda8){_0x2cfbc9=_0x2abda8[_0xd1e6('0x9')];if(_0x2cfbc9){return db[_0xd1e6('0xb')][_0xd1e6('0xc')]({'raw':!![],'attributes':['id',_0xd1e6('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd1e6('0xe')](_0x2abda8[_0xd1e6('0x9')],'minutes')}}});}else{return[];}})[_0xd1e6('0xa')](function(_0x61c0fc){if(_0x61c0fc&&_0x61c0fc[_0xd1e6('0xf')]){_0x6af02f=_[_0xd1e6('0x10')](_0x61c0fc||[],'id');logger[_0xd1e6('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0x6af02f[_0xd1e6('0x12')]());return db[_0xd1e6('0xb')][_0xd1e6('0x13')]({'closeReason':_0xd1e6('0x14'),'disposition':_0xd1e6('0x15'),'closed':!![],'closedAt':moment()[_0xd1e6('0x16')](_0xd1e6('0x17'))},{'where':{'id':_0x6af02f}});}})[_0xd1e6('0xa')](function(){if(_0x6af02f&&_0x6af02f['length']){logger['info'](_0xd1e6('0x18'),_0x6af02f[_0xd1e6('0x12')]());for(var _0xf5a321=0x0;_0xf5a321<_0x6af02f[_0xd1e6('0xf')];_0xf5a321++){io[_0xd1e6('0x19')](_0xd1e6('0x1a'),{'id':_0x6af02f[_0xf5a321],'closed':!![]});}}})[_0xd1e6('0x1b')](function(_0x5b77c3){logger[_0xd1e6('0x1c')](_0xd1e6('0x1d'),_0x5b77c3?util[_0xd1e6('0x1e')](_0x5b77c3,{'showHidden':![],'depth':null}):'');});}exports[_0xd1e6('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x314f=['format','length','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','map','info','join','system'];(function(_0x5165f4,_0x26ad84){var _0xbb4b1f=function(_0x3c8a06){while(--_0x3c8a06){_0x5165f4['push'](_0x5165f4['shift']());}};_0xbb4b1f(++_0x26ad84);}(_0x314f,0xf0));var _0xf314=function(_0x4d200e,_0x4295b9){_0x4d200e=_0x4d200e-0x0;var _0x4ef85f=_0x314f[_0x4d200e];return _0x4ef85f;};'use strict';var _=require(_0xf314('0x0'));var moment=require(_0xf314('0x1'));var Redis=require(_0xf314('0x2'));var util=require(_0xf314('0x3'));var config=require('../../config/environment');var db=require(_0xf314('0x4'))['db'];var logger=require(_0xf314('0x5'))(_0xf314('0x6'));config[_0xf314('0x7')]=_[_0xf314('0x8')](config['redis'],{'host':_0xf314('0x9'),'port':0x18eb});var io=require(_0xf314('0xa'))(new Redis(config[_0xf314('0x7')]));function closeInteractions(){var _0x287b0d=0x0;var _0x16665b=[];return db[_0xf314('0xb')][_0xf314('0xc')]({'raw':!![],'attributes':['id',_0xf314('0xd')],'where':{'id':0x1}})['then'](function(_0x42f528){_0x287b0d=_0x42f528[_0xf314('0xd')];if(_0x287b0d){return db[_0xf314('0xe')][_0xf314('0xf')]({'raw':!![],'attributes':['id',_0xf314('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf314('0x11')](_0x42f528['chatTimeout'],_0xf314('0x12'))}}});}else{return[];}})[_0xf314('0x13')](function(_0x1dda44){if(_0x1dda44&&_0x1dda44['length']){_0x16665b=_[_0xf314('0x14')](_0x1dda44||[],'id');logger[_0xf314('0x15')]('[CHAT]\x20Interactions\x20to\x20close:',_0x16665b[_0xf314('0x16')]());return db['ChatInteraction']['update']({'closeReason':_0xf314('0x17'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xf314('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x16665b}});}})[_0xf314('0x13')](function(){if(_0x16665b&&_0x16665b[_0xf314('0x19')]){logger[_0xf314('0x15')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x16665b[_0xf314('0x16')]());for(var _0x253a50=0x0;_0x253a50<_0x16665b[_0xf314('0x19')];_0x253a50++){io[_0xf314('0x1a')](_0xf314('0x1b'),{'id':_0x16665b[_0x253a50],'closed':!![]});}}})[_0xf314('0x1c')](function(_0x34d968){logger[_0xf314('0x1d')](_0xf314('0x1e'),_0x34d968?util[_0xf314('0x1f')](_0x34d968,{'showHidden':![],'depth':null}):'');});}exports[_0xf314('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index bc3ef23..e4eb068 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca85=['startAllRefreshIntervals'];(function(_0x47e36f,_0x2079f2){var _0x5ddd14=function(_0x563aff){while(--_0x563aff){_0x47e36f['push'](_0x47e36f['shift']());}};_0x5ddd14(++_0x2079f2);}(_0xca85,0xec));var _0x5ca8=function(_0x5ad70c,_0x442c3d){_0x5ad70c=_0x5ad70c-0x0;var _0x4b22f1=_0xca85[_0x5ad70c];return _0x4b22f1;};'use strict';function start(){var _0x144359=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x144359[_0x5ca8('0x0')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x9bec=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0xbcda4d,_0x3deb9c){var _0x1e5a79=function(_0x393aba){while(--_0x393aba){_0xbcda4d['push'](_0xbcda4d['shift']());}};_0x1e5a79(++_0x3deb9c);}(_0x9bec,0x13d));var _0xc9be=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x9bec[_0x7e2eb0];return _0xd92de4;};'use strict';function start(){var _0x13d020=require(_0xc9be('0x0'));return _0x13d020[_0xc9be('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 5a4a830..10d7c70 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 _0x2ca7=['endAt','add','start','add\x20cron','stop','stop\x20cron','run','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','email','bcc','name','join','%s.%s','basename','savename','zip','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','status','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','output','runReport','DefaultReportId','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','intersection','difference','exists','deleteJob','delete\x20cron','length','index','resolve','run\x20job','cron','active','isBetween'];(function(_0x27eb71,_0x4b05df){var _0x2ebbe1=function(_0x34be3d){while(--_0x34be3d){_0x27eb71['push'](_0x27eb71['shift']());}};_0x2ebbe1(++_0x4b05df);}(_0x2ca7,0x157));var _0x72ca=function(_0x33f8ff,_0x562281){_0x33f8ff=_0x33f8ff-0x0;var _0x1790ed=_0x2ca7[_0x33f8ff];return _0x1790ed;};'use strict';var fs=require('fs');var util=require(_0x72ca('0x0'));var path=require(_0x72ca('0x1'));var _=require('lodash');var moment=require(_0x72ca('0x2'));var CronJobManager=require(_0x72ca('0x3'));var jayson=require(_0x72ca('0x4'));var BPromise=require(_0x72ca('0x5'));var logger=require(_0x72ca('0x6'))(_0x72ca('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x72ca('0x8'));var analyticDefaultReportController=require(_0x72ca('0x9'));var client=jayson[_0x72ca('0xa')][_0x72ca('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3a03ad,_0x14e5a9){return function(){logger[_0x72ca('0xc')](_0x72ca('0xd'),_0x3a03ad['email']);var _0x307b58=!![];var _0x1cc318=_0x3a03ad[_0x72ca('0xe')][_0x72ca('0xf')]();var _0x3b40f9={'account':_0x1cc318,'message':{'from':util[_0x72ca('0x10')](_0x72ca('0x11'),_0x3a03ad[_0x72ca('0xe')]['name'],_0x3a03ad[_0x72ca('0xe')][_0x72ca('0x12')]||_0x3a03ad[_0x72ca('0xe')]['Smtp']['user']),'to':_0x3a03ad[_0x72ca('0x12')],'cc':_0x3a03ad['cc'],'bcc':_0x3a03ad[_0x72ca('0x13')],'subject':util[_0x72ca('0x10')]('Report\x20%s\x20last\x20%s\x20%s',_0x14e5a9[_0x72ca('0x14')],_0x3a03ad['subtractNumber'],_0x3a03ad['subtractUnit'])}};var _0x7deb1b=path[_0x72ca('0x15')](__dirname,'../../files/reports');var _0x542d4f=_0x14e5a9['savename'];var _0xcf7f18=util[_0x72ca('0x10')](_0x72ca('0x16'),path[_0x72ca('0x17')](_0x14e5a9['savename'],path['extname'](_0x14e5a9[_0x72ca('0x18')])),_0x72ca('0x19'));var _0x113c3b=path[_0x72ca('0x15')](_0x7deb1b,_0x542d4f);var _0x358c9b=path[_0x72ca('0x15')](_0x7deb1b,_0xcf7f18);if(fs['existsSync'](_0x113c3b)){_0x14e5a9['status']='Sent';_0x3b40f9[_0x72ca('0x1a')][_0x72ca('0x1b')]=[{'filename':_0x542d4f,'path':_0x113c3b}];_0x3b40f9[_0x72ca('0x1a')][_0x72ca('0x1c')]=util['format'](_0x72ca('0x1d'),JSON[_0x72ca('0x1e')](_0x14e5a9,null,0x2));}else if(fs[_0x72ca('0x1f')](_0x358c9b)){_0x14e5a9[_0x72ca('0x20')]=_0x72ca('0x21');_0x3b40f9[_0x72ca('0x1a')][_0x72ca('0x1b')]=[{'filename':_0xcf7f18,'path':_0x358c9b}];}else{_0x3b40f9[_0x72ca('0x1a')][_0x72ca('0x1c')]=_0x72ca('0x22');if(!_0x3a03ad[_0x72ca('0x23')]){_0x307b58=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x307b58){return client[_0x72ca('0x24')](_0x72ca('0x25'),_0x3b40f9)[_0x72ca('0x26')](function(_0x5a91df){if(_0x5a91df[_0x72ca('0x27')]){return logger[_0x72ca('0x27')](_0x72ca('0x28'),JSON[_0x72ca('0x1e')](_0x5a91df));}return logger[_0x72ca('0xc')](_0x72ca('0x29'));})[_0x72ca('0x2a')](function(_0x158a7d){return logger[_0x72ca('0x27')](_0x72ca('0x28'),JSON[_0x72ca('0x1e')](_0x158a7d));});}};}function handleError(){return function(_0x2e8fe5){return logger[_0x72ca('0x27')](JSON[_0x72ca('0x1e')](_0x2e8fe5));};}function handleResult(_0x5e0b99){return function(_0x14e0a5){logger[_0x72ca('0xc')](_0x72ca('0x2b'),JSON['stringify'](_0x14e0a5));if(_0x5e0b99['MailAccount']&&_0x5e0b99[_0x72ca('0xe')][_0x72ca('0x2c')]&&!_[_0x72ca('0x2d')](_0x5e0b99[_0x72ca('0x12')])){setTimeout(handleSendEmail(_0x5e0b99,_0x14e0a5),0x3c*0x3e8);}};}function handleJob(_0x557c31){return function(){try{if(_[_0x72ca('0x2d')](_0x557c31['subtractNumber'])){return logger[_0x72ca('0xc')](_0x72ca('0x2e'));}if(_['isNil'](_0x557c31[_0x72ca('0x2f')])){return logger['info'](_0x72ca('0x30'));}var _0x4e14b5={'startDate':moment()[_0x72ca('0x31')](_0x557c31[_0x72ca('0x32')],_0x557c31['subtractUnit'])[_0x72ca('0x10')](_0x72ca('0x33')),'endDate':moment()[_0x72ca('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x557c31[_0x72ca('0x34')],'name':_0x557c31[_0x72ca('0x14')]};if(!_[_0x72ca('0x2d')](_0x557c31['DefaultReportId'])){logger[_0x72ca('0xc')]('exec\x20defaul\x20report\x20id:%s',_0x557c31['DefaultReportId']);return analyticDefaultReportController[_0x72ca('0x35')]({'id':_0x557c31[_0x72ca('0x36')]},_0x4e14b5)['then'](handleResult(_0x557c31))['catch'](handleError());}if(!_[_0x72ca('0x2d')](_0x557c31['CustomReportId'])){logger[_0x72ca('0xc')](_0x72ca('0x37'),_0x557c31[_0x72ca('0x38')]);return analyticCustomReportController[_0x72ca('0x35')]({'id':_0x557c31[_0x72ca('0x38')]},_0x4e14b5)[_0x72ca('0x26')](handleResult(_0x557c31))[_0x72ca('0x2a')](handleError());}}catch(_0x5f356f){logger[_0x72ca('0x27')](JSON['stringify'](_0x5f356f));}return logger['info'](_0x72ca('0x39'));};}function getJobs(_0x41c6fa){var _0x593c30={};if(_0x41c6fa){_0x593c30['id']=_0x41c6fa;}return db['Schedule'][_0x72ca('0x3a')]({'where':_0x593c30,'include':[{'model':db[_0x72ca('0xe')],'attributes':['id','name',_0x72ca('0x12')],'include':[{'model':db[_0x72ca('0x3b')],'as':_0x72ca('0x2c'),'include':[{'model':db[_0x72ca('0x3c')],'as':_0x72ca('0x3c')}]}]}]})['then'](function(_0x6f3e09){var _0xdb7f6a=_['keys'](manager[_0x72ca('0x3d')]);var _0x3574cf=_[_0x72ca('0x3e')](_0x6f3e09,function(_0x61ffc2){return _0x61ffc2['id'][_0x72ca('0x3f')]();});var _0x46585e=_[_0x72ca('0x40')](_0x6f3e09,function(_0x953da0){return _0x953da0['id'][_0x72ca('0x3f')]();});var _0x2b3cd4=_0x41c6fa?_0x3574cf:_['difference'](_0x3574cf,_0xdb7f6a);var _0x38f8d2=_[_0x72ca('0x41')](_0x3574cf,_0xdb7f6a);var _0x2f1def=_[_0x72ca('0x42')](_0xdb7f6a,_0x3574cf);var _0xfdc1b8;var _0xd8cbbd;for(_0xfdc1b8=0x0;_0xfdc1b8<_0x2f1def['length']&&!_0x41c6fa;_0xfdc1b8+=0x1){_0xd8cbbd=_0x2f1def[_0xfdc1b8][_0x72ca('0x3f')]();if(manager[_0x72ca('0x43')](_0xd8cbbd)){manager['stop'](_0xd8cbbd);manager[_0x72ca('0x44')](_0xd8cbbd);logger['info'](_0x72ca('0x45'),_0xd8cbbd);}}logger['info']('toRun',JSON['stringify'](_0x2b3cd4));for(_0xfdc1b8=0x0;_0xfdc1b8<_0x2b3cd4[_0x72ca('0x46')];_0xfdc1b8+=0x1){_0xd8cbbd=_0x2b3cd4[_0xfdc1b8]['toString']();logger[_0x72ca('0xc')](_0x72ca('0x47'),_0xd8cbbd);if(_0x41c6fa){logger[_0x72ca('0xc')]('my\x20id',_0x41c6fa);logger[_0x72ca('0xc')](JSON[_0x72ca('0x1e')](_0x46585e[_0xd8cbbd]));BPromise[_0x72ca('0x48')]()[_0x72ca('0x26')](handleJob(_0x46585e[_0xd8cbbd]));logger[_0x72ca('0xc')](_0x72ca('0x49'),_0x46585e[_0xd8cbbd][_0x72ca('0x14')],_0x46585e[_0xd8cbbd][_0x72ca('0x4a')]);}else if(_0x46585e[_0xd8cbbd][_0x72ca('0x4a')]&&_0x46585e[_0xd8cbbd][_0x72ca('0x4b')]&&moment()[_0x72ca('0x4c')](_0x46585e[_0xd8cbbd]['startAt'],_0x46585e[_0xd8cbbd][_0x72ca('0x4d')])){manager[_0x72ca('0x4e')](_0xd8cbbd,_0x46585e[_0xd8cbbd]['cron'],handleJob(_0x46585e[_0xd8cbbd]));manager[_0x72ca('0x4f')](_0xd8cbbd);logger[_0x72ca('0xc')](_0x72ca('0x50'),_0x46585e[_0xd8cbbd][_0x72ca('0x14')],_0x46585e[_0xd8cbbd][_0x72ca('0x4a')]);}else if(manager[_0x72ca('0x43')](_0xd8cbbd)){manager[_0x72ca('0x51')](_0xd8cbbd);manager['deleteJob'](_0xd8cbbd);logger[_0x72ca('0xc')]('stop\x20cron',_0x46585e[_0xd8cbbd][_0x72ca('0x14')],_0x46585e[_0xd8cbbd]['cron']);}}for(_0xfdc1b8=0x0,_0xd8cbbd;_0xfdc1b8<_0x38f8d2[_0x72ca('0x46')]&&!_0x41c6fa;_0xfdc1b8+=0x1){_0xd8cbbd=_0x38f8d2[_0xfdc1b8][_0x72ca('0x3f')]();if(manager['exists'](_0xd8cbbd)){if(_0x46585e[_0xd8cbbd][_0x72ca('0x4a')]&&_0x46585e[_0xd8cbbd][_0x72ca('0x4b')]&&moment()[_0x72ca('0x4c')](_0x46585e[_0xd8cbbd]['startAt'],_0x46585e[_0xd8cbbd][_0x72ca('0x4d')])){manager['update'](_0xd8cbbd,_0x46585e[_0xd8cbbd][_0x72ca('0x4a')],handleJob(_0x46585e[_0xd8cbbd]));logger[_0x72ca('0xc')]('update\x20cron',_0x46585e[_0xd8cbbd]['name'],_0x46585e[_0xd8cbbd][_0x72ca('0x4a')]);}else{manager['stop'](_0xd8cbbd);manager[_0x72ca('0x44')](_0xd8cbbd);logger[_0x72ca('0xc')](_0x72ca('0x52'),_0x46585e[_0xd8cbbd]['name'],_0x46585e[_0xd8cbbd][_0x72ca('0x4a')]);}}}})[_0x72ca('0x2a')](function(_0x42781a){logger[_0x72ca('0x27')](JSON['stringify'](_0x42781a));});}exports[_0x72ca('0x53')]=function(_0x4366bb){return getJobs(_0x4366bb);};exports[_0x72ca('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x3c2a=['toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','add','start','add\x20cron','stop\x20cron','startAt','update','update\x20cron','util','path','moment','cron-job-manager','jayson/promise','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','Smtp','bcc','name','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','extname','zip','join','existsSync','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','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','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','delete\x20cron'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3c2a,0x10f));var _0xa3c2=function(_0x4d9e91,_0x3ee4cd){_0x4d9e91=_0x4d9e91-0x0;var _0x4ec62a=_0x3c2a[_0x4d9e91];return _0x4ec62a;};'use strict';var fs=require('fs');var util=require(_0xa3c2('0x0'));var path=require(_0xa3c2('0x1'));var _=require('lodash');var moment=require(_0xa3c2('0x2'));var CronJobManager=require(_0xa3c2('0x3'));var jayson=require(_0xa3c2('0x4'));var BPromise=require('bluebird');var logger=require(_0xa3c2('0x5'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xa3c2('0x6'));var analyticDefaultReportController=require(_0xa3c2('0x7'));var client=jayson[_0xa3c2('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x315985,_0x1cb80b){return function(){logger[_0xa3c2('0x9')](_0xa3c2('0xa'),_0x315985[_0xa3c2('0xb')]);var _0x4a955c=!![];var _0x32c212=_0x315985[_0xa3c2('0xc')]['getSmtpOptions']();var _0x2f40f2={'account':_0x32c212,'message':{'from':util[_0xa3c2('0xd')](_0xa3c2('0xe'),_0x315985[_0xa3c2('0xc')]['name'],_0x315985[_0xa3c2('0xc')][_0xa3c2('0xb')]||_0x315985[_0xa3c2('0xc')][_0xa3c2('0xf')]['user']),'to':_0x315985[_0xa3c2('0xb')],'cc':_0x315985['cc'],'bcc':_0x315985[_0xa3c2('0x10')],'subject':util[_0xa3c2('0xd')]('Report\x20%s\x20last\x20%s\x20%s',_0x1cb80b[_0xa3c2('0x11')],_0x315985[_0xa3c2('0x12')],_0x315985[_0xa3c2('0x13')])}};var _0x6c4933=path['join'](__dirname,_0xa3c2('0x14'));var _0x514337=_0x1cb80b[_0xa3c2('0x15')];var _0x3b7454=util[_0xa3c2('0xd')](_0xa3c2('0x16'),path['basename'](_0x1cb80b[_0xa3c2('0x15')],path[_0xa3c2('0x17')](_0x1cb80b[_0xa3c2('0x15')])),_0xa3c2('0x18'));var _0x258c83=path[_0xa3c2('0x19')](_0x6c4933,_0x514337);var _0x253979=path['join'](_0x6c4933,_0x3b7454);if(fs[_0xa3c2('0x1a')](_0x258c83)){_0x1cb80b['status']=_0xa3c2('0x1b');_0x2f40f2['message']['attachments']=[{'filename':_0x514337,'path':_0x258c83}];_0x2f40f2[_0xa3c2('0x1c')][_0xa3c2('0x1d')]=util[_0xa3c2('0xd')](_0xa3c2('0x1e'),JSON[_0xa3c2('0x1f')](_0x1cb80b,null,0x2));}else if(fs[_0xa3c2('0x1a')](_0x253979)){_0x1cb80b[_0xa3c2('0x20')]='Sent';_0x2f40f2[_0xa3c2('0x1c')]['attachments']=[{'filename':_0x3b7454,'path':_0x253979}];}else{_0x2f40f2[_0xa3c2('0x1c')][_0xa3c2('0x1d')]=_0xa3c2('0x21');if(!_0x315985[_0xa3c2('0x22')]){_0x4a955c=![];logger[_0xa3c2('0x9')](_0xa3c2('0x23'));}}if(_0x4a955c){return client[_0xa3c2('0x24')](_0xa3c2('0x25'),_0x2f40f2)[_0xa3c2('0x26')](function(_0x53a953){if(_0x53a953[_0xa3c2('0x27')]){return logger['error'](_0xa3c2('0x28'),JSON[_0xa3c2('0x1f')](_0x53a953));}return logger[_0xa3c2('0x9')](_0xa3c2('0x29'));})['catch'](function(_0x3ff46e){return logger[_0xa3c2('0x27')](_0xa3c2('0x28'),JSON['stringify'](_0x3ff46e));});}};}function handleError(){return function(_0x4ec8f7){return logger['error'](JSON[_0xa3c2('0x1f')](_0x4ec8f7));};}function handleResult(_0xefb60){return function(_0x149d49){logger[_0xa3c2('0x9')](_0xa3c2('0x2a'),JSON[_0xa3c2('0x1f')](_0x149d49));if(_0xefb60[_0xa3c2('0xc')]&&_0xefb60[_0xa3c2('0xc')][_0xa3c2('0xf')]&&!_[_0xa3c2('0x2b')](_0xefb60[_0xa3c2('0xb')])){setTimeout(handleSendEmail(_0xefb60,_0x149d49),0x3c*0x3e8);}};}function handleJob(_0xfe89f0){return function(){try{if(_['isNil'](_0xfe89f0[_0xa3c2('0x12')])){return logger[_0xa3c2('0x9')](_0xa3c2('0x2c'));}if(_[_0xa3c2('0x2b')](_0xfe89f0[_0xa3c2('0x13')])){return logger[_0xa3c2('0x9')](_0xa3c2('0x2d'));}var _0x3ba163={'startDate':moment()[_0xa3c2('0x2e')](_0xfe89f0[_0xa3c2('0x12')],_0xfe89f0['subtractUnit'])[_0xa3c2('0xd')](_0xa3c2('0x2f')),'endDate':moment()[_0xa3c2('0xd')](_0xa3c2('0x2f')),'type':_0xa3c2('0x30'),'output':_0xfe89f0['output'],'name':_0xfe89f0[_0xa3c2('0x11')]};if(!_[_0xa3c2('0x2b')](_0xfe89f0['DefaultReportId'])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0xfe89f0[_0xa3c2('0x31')]);return analyticDefaultReportController[_0xa3c2('0x32')]({'id':_0xfe89f0[_0xa3c2('0x31')]},_0x3ba163)[_0xa3c2('0x26')](handleResult(_0xfe89f0))[_0xa3c2('0x33')](handleError());}if(!_[_0xa3c2('0x2b')](_0xfe89f0[_0xa3c2('0x34')])){logger[_0xa3c2('0x9')](_0xa3c2('0x35'),_0xfe89f0[_0xa3c2('0x34')]);return analyticCustomReportController[_0xa3c2('0x32')]({'id':_0xfe89f0['CustomReportId']},_0x3ba163)[_0xa3c2('0x26')](handleResult(_0xfe89f0))[_0xa3c2('0x33')](handleError());}}catch(_0x36b450){logger[_0xa3c2('0x27')](JSON[_0xa3c2('0x1f')](_0x36b450));}return logger['info'](_0xa3c2('0x36'));};}function getJobs(_0x3dd76e){var _0x42117d={};if(_0x3dd76e){_0x42117d['id']=_0x3dd76e;}return db[_0xa3c2('0x37')][_0xa3c2('0x38')]({'where':_0x42117d,'include':[{'model':db[_0xa3c2('0xc')],'attributes':['id','name','email'],'include':[{'model':db[_0xa3c2('0x39')],'as':_0xa3c2('0xf'),'include':[{'model':db[_0xa3c2('0x3a')],'as':_0xa3c2('0x3a')}]}]}]})[_0xa3c2('0x26')](function(_0x553ea6){var _0x4ef1e4=_['keys'](manager[_0xa3c2('0x3b')]);var _0x854f28=_['map'](_0x553ea6,function(_0x3b3525){return _0x3b3525['id'][_0xa3c2('0x3c')]();});var _0x101a5b=_[_0xa3c2('0x3d')](_0x553ea6,function(_0x882417){return _0x882417['id']['toString']();});var _0x54ba69=_0x3dd76e?_0x854f28:_['difference'](_0x854f28,_0x4ef1e4);var _0x27f0e6=_[_0xa3c2('0x3e')](_0x854f28,_0x4ef1e4);var _0x56ed3b=_[_0xa3c2('0x3f')](_0x4ef1e4,_0x854f28);var _0x9835cc;var _0x425f81;for(_0x9835cc=0x0;_0x9835cc<_0x56ed3b[_0xa3c2('0x40')]&&!_0x3dd76e;_0x9835cc+=0x1){_0x425f81=_0x56ed3b[_0x9835cc]['toString']();if(manager[_0xa3c2('0x41')](_0x425f81)){manager[_0xa3c2('0x42')](_0x425f81);manager[_0xa3c2('0x43')](_0x425f81);logger[_0xa3c2('0x9')](_0xa3c2('0x44'),_0x425f81);}}logger[_0xa3c2('0x9')](_0xa3c2('0x45'),JSON[_0xa3c2('0x1f')](_0x54ba69));for(_0x9835cc=0x0;_0x9835cc<_0x54ba69[_0xa3c2('0x40')];_0x9835cc+=0x1){_0x425f81=_0x54ba69[_0x9835cc][_0xa3c2('0x3c')]();logger[_0xa3c2('0x9')](_0xa3c2('0x46'),_0x425f81);if(_0x3dd76e){logger[_0xa3c2('0x9')](_0xa3c2('0x47'),_0x3dd76e);logger[_0xa3c2('0x9')](JSON['stringify'](_0x101a5b[_0x425f81]));BPromise[_0xa3c2('0x48')]()[_0xa3c2('0x26')](handleJob(_0x101a5b[_0x425f81]));logger[_0xa3c2('0x9')](_0xa3c2('0x49'),_0x101a5b[_0x425f81][_0xa3c2('0x11')],_0x101a5b[_0x425f81][_0xa3c2('0x4a')]);}else if(_0x101a5b[_0x425f81][_0xa3c2('0x4a')]&&_0x101a5b[_0x425f81][_0xa3c2('0x4b')]&&moment()[_0xa3c2('0x4c')](_0x101a5b[_0x425f81]['startAt'],_0x101a5b[_0x425f81][_0xa3c2('0x4d')])){manager[_0xa3c2('0x4e')](_0x425f81,_0x101a5b[_0x425f81]['cron'],handleJob(_0x101a5b[_0x425f81]));manager[_0xa3c2('0x4f')](_0x425f81);logger[_0xa3c2('0x9')](_0xa3c2('0x50'),_0x101a5b[_0x425f81]['name'],_0x101a5b[_0x425f81]['cron']);}else if(manager[_0xa3c2('0x41')](_0x425f81)){manager[_0xa3c2('0x42')](_0x425f81);manager[_0xa3c2('0x43')](_0x425f81);logger[_0xa3c2('0x9')](_0xa3c2('0x51'),_0x101a5b[_0x425f81][_0xa3c2('0x11')],_0x101a5b[_0x425f81]['cron']);}}for(_0x9835cc=0x0,_0x425f81;_0x9835cc<_0x27f0e6[_0xa3c2('0x40')]&&!_0x3dd76e;_0x9835cc+=0x1){_0x425f81=_0x27f0e6[_0x9835cc][_0xa3c2('0x3c')]();if(manager[_0xa3c2('0x41')](_0x425f81)){if(_0x101a5b[_0x425f81]['cron']&&_0x101a5b[_0x425f81][_0xa3c2('0x4b')]&&moment()[_0xa3c2('0x4c')](_0x101a5b[_0x425f81][_0xa3c2('0x52')],_0x101a5b[_0x425f81]['endAt'])){manager[_0xa3c2('0x53')](_0x425f81,_0x101a5b[_0x425f81][_0xa3c2('0x4a')],handleJob(_0x101a5b[_0x425f81]));logger['info'](_0xa3c2('0x54'),_0x101a5b[_0x425f81]['name'],_0x101a5b[_0x425f81]['cron']);}else{manager[_0xa3c2('0x42')](_0x425f81);manager[_0xa3c2('0x43')](_0x425f81);logger['info'](_0xa3c2('0x51'),_0x101a5b[_0x425f81][_0xa3c2('0x11')],_0x101a5b[_0x425f81]['cron']);}}}})[_0xa3c2('0x33')](function(_0x2035e7){logger[_0xa3c2('0x27')](JSON[_0xa3c2('0x1f')](_0x2035e7));});}exports['run']=function(_0x3ae121){return getJobs(_0x3ae121);};exports[_0xa3c2('0x4f')]=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 ab86921..98ae9d1 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 _0xb688=['data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJob','fileText','COMPLETED','TranscriptionJobStatus','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','then','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','sentimentAccountId','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','tempSentiment','findOne','Mixed','catch','name','SequelizeValidationError','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','error','inspect','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','substring','format','data1'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb688,0xcf));var _0x8b68=function(_0x54ce64,_0xf34292){_0x54ce64=_0x54ce64-0x0;var _0x6c6bee=_0xb688[_0x54ce64];return _0x6c6bee;};var _=require('lodash');var AWS=require(_0x8b68('0x0'));var rp=require(_0x8b68('0x1'));var util=require(_0x8b68('0x2'));var BPromise=require(_0x8b68('0x3'));var db=require(_0x8b68('0x4'))['db'];var logger=require(_0x8b68('0x5'))('transcribe');function getTranscriptionJob(_0x41030e,_0x27925d,_0x30f33d,_0x12d40e){return new Promise(function(_0x583d16,_0x34314e){var _0x57ee56=new AWS[(_0x8b68('0x6'))]({'accessKeyId':_0x27925d,'secretAccessKey':_0x41030e,'region':_0x30f33d});_0x57ee56[_0x8b68('0x7')]({'TranscriptionJobName':_0x12d40e},function(_0x130892,_0xa5571b){if(_0x130892){return _0x34314e(_0x130892);}else{return _0x583d16(_0xa5571b);}});});}function sentiment(_0x132617,_0x3f9685,_0x261753,_0x21d944,_0x24e0b0){return new Promise(function(_0x2f2e3c,_0x418775){var _0x317d01=new AWS[(_0x8b68('0x8'))]({'accessKeyId':_0x3f9685,'secretAccessKey':_0x132617,'region':_0x261753});_0x317d01['detectSentiment']({'Text':_0x21d944,'LanguageCode':_0x24e0b0[_0x8b68('0x9')](0x0,0x2)},function(_0x4426d1,_0x5e76c){if(_0x4426d1){return _0x418775(_0x4426d1);}else{return _0x2f2e3c(_0x5e76c);}});});}function checkTranscribeJob(_0x2d8472,_0x1965cf,_0x2f3af4){var _0xaa8725;return new BPromise(function(_0x137c8e,_0x2686c7){logger['info'](util[_0x8b68('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x2d8472['id'],_0x2d8472['transcribeName']));return getTranscriptionJob(_0x2f3af4[_0x8b68('0xb')],_0x2f3af4[_0x8b68('0xc')],_0x1965cf[_0x8b68('0xd')],_0x2d8472['transcribeName'])['then'](function(_0x23bd52){logger['info'](util[_0x8b68('0xa')](_0x8b68('0xe'),_0x2d8472['id'],_0x2d8472[_0x8b68('0xf')],_0x23bd52[_0x8b68('0x10')]['TranscriptionJobStatus']));if(!_0x2d8472[_0x8b68('0x11')]){switch(_0x23bd52[_0x8b68('0x10')]['TranscriptionJobStatus']){case _0x8b68('0x12'):var _0x3c7e5a={'transcribeStatus':_0x23bd52[_0x8b68('0x10')][_0x8b68('0x13')],'fileUri':_0x23bd52[_0x8b68('0x10')]['Transcript'][_0x8b68('0x14')]};logger[_0x8b68('0x15')](util[_0x8b68('0xa')](_0x8b68('0x16'),_0x2d8472['id']));return rp({'uri':_0x23bd52[_0x8b68('0x10')][_0x8b68('0x17')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x23edc1){logger['info'](util[_0x8b68('0xa')](_0x8b68('0x18'),_0x2d8472['id']));if(_0x23edc1&&_0x23edc1[_0x8b68('0x19')]&&_0x23edc1[_0x8b68('0x19')][_0x8b68('0x1a')]&&_0x23edc1[_0x8b68('0x19')]['transcripts'][_0x8b68('0x1b')]){_0x3c7e5a[_0x8b68('0x11')]='';for(var _0x4ca77d=0x0;_0x4ca77d<_0x23edc1[_0x8b68('0x19')][_0x8b68('0x1a')][_0x8b68('0x1b')];_0x4ca77d++){_0x3c7e5a['fileText']+=_0x23edc1['results']['transcripts'][_0x4ca77d][_0x8b68('0x1c')]+'';}}return _0x2d8472[_0x8b68('0x1d')](_0x3c7e5a);})[_0x8b68('0x1e')](function(){logger['info'](util[_0x8b68('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2d8472['id']));if(!_0x2d8472['tempSentiment']){throw new db[(_0x8b68('0x1f'))]['ValidationError'](_0x8b68('0x20'));}if(!_0x1965cf[_0x8b68('0x21')]||!_0x1965cf['sentimentAccountId']||!_0x1965cf['sentimentRegion']||!_0x1965cf[_0x8b68('0x22')]||!_0x1965cf[_0x8b68('0x23')]){throw new db[(_0x8b68('0x1f'))][(_0x8b68('0x24'))](_0x8b68('0x25'));}if(!_0x3c7e5a[_0x8b68('0x11')]){throw new Error(_0x8b68('0x26'));}if(_0x1965cf['sentimentAccountId']===_0x2f3af4['id']){return _0x2f3af4;}else{return db[_0x8b68('0x27')]['findOne']({'where':{'id':_settings[_0x8b68('0x28')]}});}})[_0x8b68('0x1e')](function(_0x4c276f){if(!_0x4c276f){throw new db[(_0x8b68('0x1f'))][(_0x8b68('0x24'))](_0x8b68('0x29'));}if(!_0x4c276f['data1']||!_0x4c276f['data2']){throw new db[(_0x8b68('0x1f'))][(_0x8b68('0x24'))](_0x8b68('0x2a'));}_0xaa8725=_0x4c276f;logger[_0x8b68('0x15')](util[_0x8b68('0xa')](_0x8b68('0x2b'),_0x2d8472['id']));return sentiment(_0xaa8725[_0x8b68('0xb')],_0xaa8725[_0x8b68('0xc')],_0x1965cf[_0x8b68('0x2c')],_0x3c7e5a[_0x8b68('0x11')],_0x1965cf[_0x8b68('0x22')]);})[_0x8b68('0x1e')](function(_0x232fa9){logger[_0x8b68('0x15')](util[_0x8b68('0xa')](_0x8b68('0x2d'),_0x2d8472['id']));return _0x2d8472[_0x8b68('0x1d')]({'sentiment':_0x232fa9[_0x8b68('0x2e')],'sPositive':_0x232fa9[_0x8b68('0x2f')][_0x8b68('0x30')],'sNegative':_0x232fa9[_0x8b68('0x2f')][_0x8b68('0x31')],'sMixed':_0x232fa9['SentimentScore']['Mixed'],'sNeutral':_0x232fa9[_0x8b68('0x2f')][_0x8b68('0x32')]});})[_0x8b68('0x1e')](function(){logger[_0x8b68('0x15')](util[_0x8b68('0xa')](_0x8b68('0x33'),_0x2d8472['id']));_0x137c8e();});case _0x8b68('0x34'):return _0x2d8472[_0x8b68('0x1d')]({'transcribeStatus':'FAILED','failureReason':_0x23bd52[_0x8b68('0x10')][_0x8b68('0x35')]})[_0x8b68('0x1e')](function(){logger[_0x8b68('0x15')](util[_0x8b68('0xa')](_0x8b68('0x33'),_0x2d8472['id']));_0x137c8e();});default:logger[_0x8b68('0x15')](util[_0x8b68('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2d8472['id']));break;}}else{return BPromise[_0x8b68('0x36')]()[_0x8b68('0x1e')](function(){if(!_0x2d8472[_0x8b68('0x37')]){throw new db[(_0x8b68('0x1f'))][(_0x8b68('0x24'))](_0x8b68('0x20'));}if(!_0x1965cf[_0x8b68('0x21')]||!_0x1965cf['sentimentAccountId']||!_0x1965cf[_0x8b68('0x2c')]||!_0x1965cf[_0x8b68('0x22')]||!_0x1965cf['bucket']){throw new db[(_0x8b68('0x1f'))][(_0x8b68('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2d8472['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x1965cf['sentimentAccountId']===_0x2f3af4['id']){return _0x2f3af4;}else{return db[_0x8b68('0x27')][_0x8b68('0x38')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x8b68('0x1e')](function(_0x5960fc){if(!_0x5960fc){throw new db[(_0x8b68('0x1f'))][(_0x8b68('0x24'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5960fc[_0x8b68('0xb')]||!_0x5960fc['data2']){throw new db['Sequelize']['ValidationError'](_0x8b68('0x2a'));}_0xaa8725=_0x5960fc;logger[_0x8b68('0x15')](util[_0x8b68('0xa')](_0x8b68('0x2b'),_0x2d8472['id']));return sentiment(_0xaa8725['data1'],_0xaa8725[_0x8b68('0xc')],_0x1965cf['sentimentRegion'],_0x2d8472[_0x8b68('0x11')],_0x1965cf[_0x8b68('0x22')]);})['then'](function(_0x2bd7ba){logger[_0x8b68('0x15')](util[_0x8b68('0xa')](_0x8b68('0x2d'),_0x2d8472['id']));return _0x2d8472['update']({'sentiment':_0x2bd7ba[_0x8b68('0x2e')],'sPositive':_0x2bd7ba[_0x8b68('0x2f')][_0x8b68('0x30')],'sNegative':_0x2bd7ba[_0x8b68('0x2f')][_0x8b68('0x31')],'sMixed':_0x2bd7ba[_0x8b68('0x2f')][_0x8b68('0x39')],'sNeutral':_0x2bd7ba[_0x8b68('0x2f')][_0x8b68('0x32')],'transcribeStatus':_0x8b68('0x12')});})[_0x8b68('0x1e')](function(){logger[_0x8b68('0x15')](util[_0x8b68('0xa')](_0x8b68('0x33'),_0x2d8472['id']));_0x137c8e();});}})[_0x8b68('0x3a')](function(_0xe65007){if(_0xe65007){if(!_0xe65007['name']||_0xe65007[_0x8b68('0x3b')]!==_0x8b68('0x3c')){logger['error'](util[_0x8b68('0xa')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x2d8472['id']),util['inspect'](_0xe65007,{'showHidden':![],'depth':null}));}}_0x137c8e();});});}function checkTranscribe(){var _0x59a4a6;var _0x1c8a3e;var _0x35874b;return db[_0x8b68('0x3d')][_0x8b68('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x42b433){if(!_0x42b433||!_0x42b433[_0x8b68('0x1b')]){throw new db[(_0x8b68('0x1f'))]['ValidationError'](_0x8b68('0x3f'));}_0x59a4a6=_0x42b433;return db[_0x8b68('0x40')]['findOne']({'where':{'id':0x1}});})[_0x8b68('0x1e')](function(_0xacac82){if(!_0xacac82){throw new db['Sequelize'][(_0x8b68('0x24'))](_0x8b68('0x41'));}_0x1c8a3e=_0xacac82;if(!_0x1c8a3e['transcribe']||!_0x1c8a3e[_0x8b68('0x42')]||!_0x1c8a3e[_0x8b68('0xd')]||!_0x1c8a3e['language']||!_0x1c8a3e['bucket']){throw new db['Sequelize'][(_0x8b68('0x24'))](_0x8b68('0x43'));}return db[_0x8b68('0x27')][_0x8b68('0x38')]({'where':{'id':_0x1c8a3e['transcribeAccountId']}});})['then'](function(_0x4492fd){if(!_0x4492fd){throw new db[(_0x8b68('0x1f'))][(_0x8b68('0x24'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4492fd[_0x8b68('0xb')]||!_0x4492fd[_0x8b68('0xc')]){throw new db[(_0x8b68('0x1f'))]['ValidationError'](_0x8b68('0x2a'));}_0x35874b=_0x4492fd;var _0x4825df=[];_0x59a4a6[_0x8b68('0x44')](function(_0x3efb0e){_0x4825df['push'](checkTranscribeJob(_0x3efb0e,_0x1c8a3e,_0x35874b));});return BPromise[_0x8b68('0x45')](_0x4825df);})[_0x8b68('0x3a')](function(_0x6ac18){if(_0x6ac18){if(!_0x6ac18[_0x8b68('0x3b')]||_0x6ac18[_0x8b68('0x3b')]!=='SequelizeValidationError'){logger[_0x8b68('0x46')](util[_0x8b68('0x47')](_0x6ac18,{'showHidden':![],'depth':null}));}}});}exports[_0x8b68('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2572=['tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','CloudProvider','forEach','push','SequelizeValidationError','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','fileText','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x2572,0x110));var _0x2257=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2572[_0x1facfa];return _0x9ec701;};var _=require(_0x2257('0x0'));var AWS=require(_0x2257('0x1'));var rp=require(_0x2257('0x2'));var util=require(_0x2257('0x3'));var BPromise=require(_0x2257('0x4'));var db=require(_0x2257('0x5'))['db'];var logger=require(_0x2257('0x6'))(_0x2257('0x7'));function getTranscriptionJob(_0x2e2640,_0x5bb654,_0x3abf7b,_0x3fcebd){return new Promise(function(_0x43ffe5,_0xa5bd9){var _0x26b2c6=new AWS[(_0x2257('0x8'))]({'accessKeyId':_0x5bb654,'secretAccessKey':_0x2e2640,'region':_0x3abf7b});_0x26b2c6[_0x2257('0x9')]({'TranscriptionJobName':_0x3fcebd},function(_0x380460,_0xee7249){if(_0x380460){return _0xa5bd9(_0x380460);}else{return _0x43ffe5(_0xee7249);}});});}function sentiment(_0x4c9b99,_0x12472b,_0x3e088a,_0x585a28,_0x36a281){return new Promise(function(_0x8f65b3,_0x2d22d0){var _0x4bab94=new AWS[(_0x2257('0xa'))]({'accessKeyId':_0x12472b,'secretAccessKey':_0x4c9b99,'region':_0x3e088a});_0x4bab94[_0x2257('0xb')]({'Text':_0x585a28,'LanguageCode':_0x36a281[_0x2257('0xc')](0x0,0x2)},function(_0x3027b6,_0x4cb935){if(_0x3027b6){return _0x2d22d0(_0x3027b6);}else{return _0x8f65b3(_0x4cb935);}});});}function checkTranscribeJob(_0x351beb,_0x5131bd,_0x578d2f){var _0x7f8b71;return new BPromise(function(_0x4537d2,_0x2791dc){logger[_0x2257('0xd')](util[_0x2257('0xe')](_0x2257('0xf'),_0x351beb['id'],_0x351beb[_0x2257('0x10')]));return getTranscriptionJob(_0x578d2f['data1'],_0x578d2f['data2'],_0x5131bd[_0x2257('0x11')],_0x351beb[_0x2257('0x10')])[_0x2257('0x12')](function(_0x156d68){logger['info'](util['format'](_0x2257('0x13'),_0x351beb['id'],_0x351beb['transcribeName'],_0x156d68['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x351beb[_0x2257('0x14')]){switch(_0x156d68[_0x2257('0x15')][_0x2257('0x16')]){case _0x2257('0x17'):var _0x119136={'transcribeStatus':_0x156d68[_0x2257('0x15')][_0x2257('0x16')],'fileUri':_0x156d68[_0x2257('0x15')][_0x2257('0x18')][_0x2257('0x19')]};logger[_0x2257('0xd')](util[_0x2257('0xe')]('[RECORDING:%d]\x20Get\x20transcript',_0x351beb['id']));return rp({'uri':_0x156d68[_0x2257('0x15')][_0x2257('0x18')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x56e513){logger['info'](util[_0x2257('0xe')](_0x2257('0x1a'),_0x351beb['id']));if(_0x56e513&&_0x56e513[_0x2257('0x1b')]&&_0x56e513[_0x2257('0x1b')][_0x2257('0x1c')]&&_0x56e513[_0x2257('0x1b')][_0x2257('0x1c')][_0x2257('0x1d')]){_0x119136[_0x2257('0x14')]='';for(var _0x27a619=0x0;_0x27a619<_0x56e513['results'][_0x2257('0x1c')][_0x2257('0x1d')];_0x27a619++){_0x119136['fileText']+=_0x56e513[_0x2257('0x1b')][_0x2257('0x1c')][_0x27a619]['transcript']+'';}}return _0x351beb[_0x2257('0x1e')](_0x119136);})[_0x2257('0x12')](function(){logger['info'](util[_0x2257('0xe')](_0x2257('0x1f'),_0x351beb['id']));if(!_0x351beb[_0x2257('0x20')]){throw new db[(_0x2257('0x21'))]['ValidationError'](_0x2257('0x22'));}if(!_0x5131bd[_0x2257('0x23')]||!_0x5131bd['sentimentAccountId']||!_0x5131bd[_0x2257('0x24')]||!_0x5131bd[_0x2257('0x25')]||!_0x5131bd[_0x2257('0x26')]){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))](_0x2257('0x28'));}if(!_0x119136[_0x2257('0x14')]){throw new Error(_0x2257('0x29'));}if(_0x5131bd[_0x2257('0x2a')]===_0x578d2f['id']){return _0x578d2f;}else{return db['CloudProvider'][_0x2257('0x2b')]({'where':{'id':_settings[_0x2257('0x2a')]}});}})['then'](function(_0x53b823){if(!_0x53b823){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))](_0x2257('0x2c'));}if(!_0x53b823[_0x2257('0x2d')]||!_0x53b823[_0x2257('0x2e')]){throw new db[(_0x2257('0x21'))]['ValidationError'](_0x2257('0x2f'));}_0x7f8b71=_0x53b823;logger[_0x2257('0xd')](util[_0x2257('0xe')](_0x2257('0x30'),_0x351beb['id']));return sentiment(_0x7f8b71['data1'],_0x7f8b71[_0x2257('0x2e')],_0x5131bd['sentimentRegion'],_0x119136['fileText'],_0x5131bd[_0x2257('0x25')]);})[_0x2257('0x12')](function(_0x388bd6){logger[_0x2257('0xd')](util[_0x2257('0xe')](_0x2257('0x31'),_0x351beb['id']));return _0x351beb[_0x2257('0x1e')]({'sentiment':_0x388bd6[_0x2257('0x32')],'sPositive':_0x388bd6[_0x2257('0x33')][_0x2257('0x34')],'sNegative':_0x388bd6[_0x2257('0x33')][_0x2257('0x35')],'sMixed':_0x388bd6[_0x2257('0x33')][_0x2257('0x36')],'sNeutral':_0x388bd6['SentimentScore'][_0x2257('0x37')]});})[_0x2257('0x12')](function(){logger[_0x2257('0xd')](util[_0x2257('0xe')](_0x2257('0x1f'),_0x351beb['id']));_0x4537d2();});case'FAILED':return _0x351beb[_0x2257('0x1e')]({'transcribeStatus':_0x2257('0x38'),'failureReason':_0x156d68[_0x2257('0x15')][_0x2257('0x39')]})[_0x2257('0x12')](function(){logger[_0x2257('0xd')](util[_0x2257('0xe')](_0x2257('0x1f'),_0x351beb['id']));_0x4537d2();});default:logger[_0x2257('0xd')](util[_0x2257('0xe')](_0x2257('0x3a'),_0x351beb['id']));break;}}else{return BPromise[_0x2257('0x3b')]()[_0x2257('0x12')](function(){if(!_0x351beb['tempSentiment']){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))](_0x2257('0x22'));}if(!_0x5131bd[_0x2257('0x23')]||!_0x5131bd[_0x2257('0x2a')]||!_0x5131bd[_0x2257('0x24')]||!_0x5131bd[_0x2257('0x25')]||!_0x5131bd[_0x2257('0x26')]){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x351beb[_0x2257('0x14')]){throw new Error(_0x2257('0x29'));}if(_0x5131bd[_0x2257('0x2a')]===_0x578d2f['id']){return _0x578d2f;}else{return db['CloudProvider'][_0x2257('0x2b')]({'where':{'id':_settings[_0x2257('0x2a')]}});}})[_0x2257('0x12')](function(_0x3e4c5b){if(!_0x3e4c5b){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3e4c5b[_0x2257('0x2d')]||!_0x3e4c5b[_0x2257('0x2e')]){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))]('Cloud\x20Provider\x20not\x20configured');}_0x7f8b71=_0x3e4c5b;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x351beb['id']));return sentiment(_0x7f8b71[_0x2257('0x2d')],_0x7f8b71['data2'],_0x5131bd['sentimentRegion'],_0x351beb[_0x2257('0x14')],_0x5131bd['language']);})['then'](function(_0x548a3f){logger[_0x2257('0xd')](util[_0x2257('0xe')](_0x2257('0x31'),_0x351beb['id']));return _0x351beb[_0x2257('0x1e')]({'sentiment':_0x548a3f[_0x2257('0x32')],'sPositive':_0x548a3f[_0x2257('0x33')][_0x2257('0x34')],'sNegative':_0x548a3f['SentimentScore'][_0x2257('0x35')],'sMixed':_0x548a3f['SentimentScore'][_0x2257('0x36')],'sNeutral':_0x548a3f[_0x2257('0x33')][_0x2257('0x37')],'transcribeStatus':_0x2257('0x17')});})[_0x2257('0x12')](function(){logger[_0x2257('0xd')](util[_0x2257('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x351beb['id']));_0x4537d2();});}})[_0x2257('0x3c')](function(_0x20e1fc){if(_0x20e1fc){if(!_0x20e1fc['name']||_0x20e1fc[_0x2257('0x3d')]!=='SequelizeValidationError'){logger[_0x2257('0x3e')](util[_0x2257('0xe')](_0x2257('0x3f'),_0x351beb['id']),util[_0x2257('0x40')](_0x20e1fc,{'showHidden':![],'depth':null}));}}_0x4537d2();});});}function checkTranscribe(){var _0x13244d;var _0x261350;var _0x33ed5a;return db['VoiceRecording'][_0x2257('0x41')]({'where':{'transcribeStatus':_0x2257('0x42')}})['then'](function(_0x1e10c9){if(!_0x1e10c9||!_0x1e10c9['length']){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))](_0x2257('0x43'));}_0x13244d=_0x1e10c9;return db[_0x2257('0x44')]['findOne']({'where':{'id':0x1}});})[_0x2257('0x12')](function(_0x4cf2b6){if(!_0x4cf2b6){throw new db[(_0x2257('0x21'))]['ValidationError'](_0x2257('0x45'));}_0x261350=_0x4cf2b6;if(!_0x261350[_0x2257('0x7')]||!_0x261350[_0x2257('0x46')]||!_0x261350[_0x2257('0x11')]||!_0x261350[_0x2257('0x25')]||!_0x261350[_0x2257('0x26')]){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))]('Transcribe\x20not\x20configured');}return db[_0x2257('0x47')][_0x2257('0x2b')]({'where':{'id':_0x261350[_0x2257('0x46')]}});})[_0x2257('0x12')](function(_0x3ae279){if(!_0x3ae279){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))](_0x2257('0x2c'));}if(!_0x3ae279[_0x2257('0x2d')]||!_0x3ae279[_0x2257('0x2e')]){throw new db[(_0x2257('0x21'))][(_0x2257('0x27'))](_0x2257('0x2f'));}_0x33ed5a=_0x3ae279;var _0x594c16=[];_0x13244d[_0x2257('0x48')](function(_0x3848a8){_0x594c16[_0x2257('0x49')](checkTranscribeJob(_0x3848a8,_0x261350,_0x33ed5a));});return BPromise['all'](_0x594c16);})[_0x2257('0x3c')](function(_0x2a8135){if(_0x2a8135){if(!_0x2a8135[_0x2257('0x3d')]||_0x2a8135['name']!==_0x2257('0x4a')){logger[_0x2257('0x3e')](util[_0x2257('0x40')](_0x2a8135,{'showHidden':![],'depth':null}));}}});}exports[_0x2257('0x4b')]=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 5eac234..81f1730 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 _0x0e5e=['schedule','defaults','redis','WhatsappInteraction','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0x0e5e,0x1ce));var _0xe0e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e5e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe0e5('0x0'));var moment=require(_0xe0e5('0x1'));var Redis=require(_0xe0e5('0x2'));var util=require(_0xe0e5('0x3'));var config=require(_0xe0e5('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xe0e5('0x5'))(_0xe0e5('0x6'));config['redis']=_[_0xe0e5('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe0e5('0x8')]));function closeInteractions(){var _0x559c02=[];return db[_0xe0e5('0x9')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xe0e5('0xa')](0x18,_0xe0e5('0xb'))}}})[_0xe0e5('0xc')](function(_0x224255){if(_0x224255&&_0x224255[_0xe0e5('0xd')]){_0x559c02=_['map'](_0x224255||[],'id');logger[_0xe0e5('0xe')](_0xe0e5('0xf'),_0x559c02[_0xe0e5('0x10')]());return db[_0xe0e5('0x9')]['update']({'closeReason':_0xe0e5('0x11'),'disposition':_0xe0e5('0x12'),'closed':!![],'closedAt':moment()[_0xe0e5('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x559c02}});}})[_0xe0e5('0xc')](function(){if(_0x559c02&&_0x559c02['length']){logger['info'](_0xe0e5('0x14'),_0x559c02[_0xe0e5('0x10')]());for(var _0x35afc8=0x0;_0x35afc8<_0x559c02[_0xe0e5('0xd')];_0x35afc8++){io['emit'](_0xe0e5('0x15'),{'id':_0x559c02[_0x35afc8],'closed':!![]});}}})['catch'](function(_0x5cc35b){logger[_0xe0e5('0x16')](_0xe0e5('0x17'),_0x5cc35b?util[_0xe0e5('0x18')](_0x5cc35b,{'showHidden':![],'depth':null}):'');});}exports[_0xe0e5('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x08ce=['../logger','schedule','redis','defaults','localhost','socket.io-emitter','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb'];(function(_0x2d0f8a,_0x639712){var _0x35e843=function(_0x551cca){while(--_0x551cca){_0x2d0f8a['push'](_0x2d0f8a['shift']());}};_0x35e843(++_0x639712);}(_0x08ce,0xbe));var _0xe08c=function(_0x213f91,_0x8f3782){_0x213f91=_0x213f91-0x0;var _0x5cf677=_0x08ce[_0x213f91];return _0x5cf677;};'use strict';var _=require(_0xe08c('0x0'));var moment=require(_0xe08c('0x1'));var Redis=require(_0xe08c('0x2'));var util=require(_0xe08c('0x3'));var config=require(_0xe08c('0x4'));var db=require(_0xe08c('0x5'))['db'];var logger=require(_0xe08c('0x6'))(_0xe08c('0x7'));config[_0xe08c('0x8')]=_[_0xe08c('0x9')](config[_0xe08c('0x8')],{'host':_0xe08c('0xa'),'port':0x18eb});var io=require(_0xe08c('0xb'))(new Redis(config[_0xe08c('0x8')]));function closeInteractions(){var _0x25a53a=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0xe08c('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xe08c('0xd'))}}})[_0xe08c('0xe')](function(_0x47816c){if(_0x47816c&&_0x47816c[_0xe08c('0xf')]){_0x25a53a=_[_0xe08c('0x10')](_0x47816c||[],'id');logger[_0xe08c('0x11')](_0xe08c('0x12'),_0x25a53a[_0xe08c('0x13')]());return db['WhatsappInteraction']['update']({'closeReason':_0xe08c('0x14'),'disposition':_0xe08c('0x15'),'closed':!![],'closedAt':moment()[_0xe08c('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x25a53a}});}})[_0xe08c('0xe')](function(){if(_0x25a53a&&_0x25a53a['length']){logger[_0xe08c('0x11')](_0xe08c('0x17'),_0x25a53a[_0xe08c('0x13')]());for(var _0x2b2159=0x0;_0x2b2159<_0x25a53a['length'];_0x2b2159++){io['emit'](_0xe08c('0x18'),{'id':_0x25a53a[_0x2b2159],'closed':!![]});}}})[_0xe08c('0x19')](function(_0xbf6d9b){logger['error'](_0xe08c('0x1a'),_0xbf6d9b?util[_0xe08c('0x1b')](_0xbf6d9b,{'showHidden':![],'depth':null}):'');});}exports['start']=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 571e023..8dc294c 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16da=['contacts1','CmHopper','hopper1','contacts2','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','then','CmContact','bulkCreate','log','finished\x20populating'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x16da,0x125));var _0xa16d=function(_0x1147d1,_0x499518){_0x1147d1=_0x1147d1-0x0;var _0x228d1d=_0x16da[_0x1147d1];return _0x228d1d;};'use strict';var util=require(_0xa16d('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xa16d('0x1')]({'id':i,'firstName':_0xa16d('0x2')+i,'lastName':_0xa16d('0x3')+i,'phone':0xf879fb460+i,'email':_0xa16d('0x4')+i+_0xa16d('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xa16d('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa16d('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xa16d('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xa16d('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa16d('0x6')](),'updatedAt':Date['now']()});}db['CmContact'][_0xa16d('0x7')]({'where':{}})[_0xa16d('0x8')](function(){return db[_0xa16d('0x9')][_0xa16d('0xa')](contacts);})[_0xa16d('0x8')](function(){console[_0xa16d('0xb')](_0xa16d('0xc'),_0xa16d('0xd'));return db[_0xa16d('0xe')][_0xa16d('0x7')]({'where':{}});})[_0xa16d('0x8')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0xa16d('0x8')](function(){console['log'](_0xa16d('0xc'),_0xa16d('0xf'));return db[_0xa16d('0x9')]['bulkCreate'](contacts2);})[_0xa16d('0x8')](function(){console[_0xa16d('0xb')](_0xa16d('0xc'),_0xa16d('0x10'));return db['CmHopper'][_0xa16d('0xa')](hopper2);})[_0xa16d('0x8')](function(){console[_0xa16d('0xb')](_0xa16d('0xc'),'hopper2');})['catch'](function(_0x22544e){console[_0xa16d('0xb')](_0x22544e);}); \ No newline at end of file +var _0x6ec9=['CmHopper','hopper1','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','bulkCreate','then','log','finished\x20populating','contacts1','destroy'];(function(_0x34c03f,_0x19e264){var _0x567db9=function(_0x212a8e){while(--_0x212a8e){_0x34c03f['push'](_0x34c03f['shift']());}};_0x567db9(++_0x19e264);}(_0x6ec9,0x9d));var _0x96ec=function(_0x58e1f4,_0x50bcb1){_0x58e1f4=_0x58e1f4-0x0;var _0x48f33c=_0x6ec9[_0x58e1f4];return _0x48f33c;};'use strict';var util=require(_0x96ec('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x96ec('0x1')]({'id':i,'firstName':_0x96ec('0x2')+i,'lastName':_0x96ec('0x3')+i,'phone':0xf879fb460+i,'email':_0x96ec('0x4')+i+_0x96ec('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x96ec('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x96ec('0x6')](),'updatedAt':Date[_0x96ec('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x96ec('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x96ec('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x96ec('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x96ec('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x96ec('0x6')]()});}db[_0x96ec('0x7')]['destroy']({'where':{}})['then'](function(){return db[_0x96ec('0x7')][_0x96ec('0x8')](contacts);})[_0x96ec('0x9')](function(){console[_0x96ec('0xa')](_0x96ec('0xb'),_0x96ec('0xc'));return db['CmHopper'][_0x96ec('0xd')]({'where':{}});})[_0x96ec('0x9')](function(){return db[_0x96ec('0xe')][_0x96ec('0x8')](hopper);})['then'](function(){console[_0x96ec('0xa')]('finished\x20populating',_0x96ec('0xf'));return db[_0x96ec('0x7')]['bulkCreate'](contacts2);})[_0x96ec('0x9')](function(){console['log'](_0x96ec('0xb'),_0x96ec('0x10'));return db[_0x96ec('0xe')][_0x96ec('0x8')](hopper2);})[_0x96ec('0x9')](function(){console[_0x96ec('0xa')](_0x96ec('0xb'),_0x96ec('0x11'));})[_0x96ec('0x12')](function(_0x34016a){console[_0x96ec('0xa')](_0x34016a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e0029bf..54a7837 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfba2=['%s%s','format','agent','%s%s@xcally.com','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','catch','util','../mysqldb','push'];(function(_0x3187f2,_0x2e61e1){var _0x2ed563=function(_0x555d27){while(--_0x555d27){_0x3187f2['push'](_0x3187f2['shift']());}};_0x2ed563(++_0x2e61e1);}(_0xfba2,0x1eb));var _0x2fba=function(_0x5325e1,_0x3140b9){_0x5325e1=_0x5325e1-0x0;var _0x37ac27=_0xfba2[_0x5325e1];return _0x37ac27;};'use strict';var util=require(_0x2fba('0x0'));var db=require(_0x2fba('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2fba('0x2')]({'name':util['format'](_0x2fba('0x3'),'agent',i),'fullname':util[_0x2fba('0x4')](_0x2fba('0x3'),_0x2fba('0x5'),i),'email':util[_0x2fba('0x4')](_0x2fba('0x6'),'agent',i),'role':_0x2fba('0x5'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x2fba('0x7'),'ws','wss'],'disallow':[_0x2fba('0x8')],'allow':[_0x2fba('0x9')],'defaultuser':util['format']('%s%s',_0x2fba('0x5'),i),'encryption':'yes','avpf':_0x2fba('0xa'),'force_avp':_0x2fba('0xa'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x2fba('0xb'),'dtlsprivatekey':_0x2fba('0xc'),'dtlssetup':_0x2fba('0xd'),'callerid':util[_0x2fba('0x4')](_0x2fba('0xe'),util[_0x2fba('0x4')]('%s%s','agent',i),0xfa0+i)});}db[_0x2fba('0xf')]['bulkCreate'](users)[_0x2fba('0x10')](function(){console[_0x2fba('0x11')]('add\x20user');})[_0x2fba('0x12')](function(_0x491dac){console[_0x2fba('0x11')](_0x491dac);}); \ No newline at end of file +var _0xc8d0=['add\x20user','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','User','then'];(function(_0x2994d4,_0x364c48){var _0x1c7c5d=function(_0x20180f){while(--_0x20180f){_0x2994d4['push'](_0x2994d4['shift']());}};_0x1c7c5d(++_0x364c48);}(_0xc8d0,0xcd));var _0x0c8d=function(_0x42f270,_0x452dec){_0x42f270=_0x42f270-0x0;var _0x57bc5b=_0xc8d0[_0x42f270];return _0x57bc5b;};'use strict';var util=require(_0x0c8d('0x0'));var db=require(_0x0c8d('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x0c8d('0x2')]({'name':util[_0x0c8d('0x3')](_0x0c8d('0x4'),'agent',i),'fullname':util[_0x0c8d('0x3')](_0x0c8d('0x4'),_0x0c8d('0x5'),i),'email':util[_0x0c8d('0x3')](_0x0c8d('0x6'),_0x0c8d('0x5'),i),'role':_0x0c8d('0x5'),'password':'password','internal':0xfa0+i,'type':_0x0c8d('0x7'),'transport':[_0x0c8d('0x8'),'ws',_0x0c8d('0x9')],'disallow':['all'],'allow':[_0x0c8d('0xa')],'defaultuser':util[_0x0c8d('0x3')]('%s%s',_0x0c8d('0x5'),i),'encryption':_0x0c8d('0xb'),'avpf':_0x0c8d('0xb'),'force_avp':_0x0c8d('0xb'),'icesupport':_0x0c8d('0xb'),'dtlsenable':_0x0c8d('0xb'),'dtlsverify':'no','dtlscertfile':_0x0c8d('0xc'),'dtlsprivatekey':_0x0c8d('0xd'),'dtlssetup':'actpass','callerid':util[_0x0c8d('0x3')]('\x22%s\x22\x20<%s>',util[_0x0c8d('0x3')](_0x0c8d('0x4'),_0x0c8d('0x5'),i),0xfa0+i)});}db[_0x0c8d('0xe')]['bulkCreate'](users)[_0x0c8d('0xf')](function(){console['log'](_0x0c8d('0x10'));})['catch'](function(_0x411db2){console['log'](_0x411db2);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 75aa2d9..b7fe8fa 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb679=['findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','Telephones','Trunks','findAll','UserProfileResource','resourceId','map','where','telephone','Campaign','format','length','user:%s','query','find','userProfileId','ChatInteraction','MailInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','VoiceQueue','SmsQueues','MailQueues','Trunk','voice:inbound','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','connectedAt','nsp','disconnect','DISCONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','type','ivr','UserProfileSection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb679,0x1e8));var _0x9b67=function(_0x51ff6c,_0x199926){_0x51ff6c=_0x51ff6c-0x0;var _0x56a805=_0xb679[_0x51ff6c];return _0x56a805;};'use strict';var _=require('lodash');var util=require(_0x9b67('0x0'));var BPromise=require(_0x9b67('0x1'));var db=require(_0x9b67('0x2'))['db'];var config=require(_0x9b67('0x3'));var queryQueues={'attributes':['id',_0x9b67('0x4')],'include':[{'as':_0x9b67('0x5'),'model':db[_0x9b67('0x6')],'attributes':['id',_0x9b67('0x4'),_0x9b67('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9b67('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x9b67('0x4')],'where':{'role':_0x9b67('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9b67('0x4'),_0x9b67('0x9')],'where':{'type':_0x9b67('0xa')}};function getAssociatedResources(_0x5659a2,_0x4bbd93,_0x111033){return db[_0x9b67('0xb')][_0x9b67('0xc')]({'where':{'name':_0x5659a2,'userProfileId':_0x4bbd93},'raw':!![]})[_0x9b67('0xd')](function(_0x22d2b8){if(_0x22d2b8){if(_0x22d2b8[_0x9b67('0xe')]){switch(_0x5659a2){case _0x9b67('0xf'):case _0x9b67('0x10'):case _0x9b67('0x11'):case'SmsQueues':case'MailQueues':case _0x9b67('0x12'):case _0x9b67('0x13'):return db[_0x111033]['findAll'](queryQueues);case _0x9b67('0x14'):return db[_0x111033]['findAll'](queryTelephones);case _0x9b67('0x15'):return db[_0x111033][_0x9b67('0x16')](queryTrunks);case'IvrCampaigns':return db[_0x111033][_0x9b67('0x16')](queryCampaigns);}}else{return db[_0x9b67('0x17')][_0x9b67('0x16')]({'attributes':[_0x9b67('0x18')],'where':{'sectionId':_0x22d2b8['id']},'raw':!![]})[_0x9b67('0xd')](function(_0x1d14e4){if(_0x1d14e4){var _0x20fe14={'where':{'id':_[_0x9b67('0x19')](_0x1d14e4,_0x9b67('0x18'))},'raw':!![]};switch(_0x111033){case _0x9b67('0x6'):_0x20fe14[_0x9b67('0x1a')][_0x9b67('0x7')]=_0x9b67('0x1b');break;case _0x9b67('0x1c'):_0x20fe14[_0x9b67('0x1a')][_0x9b67('0x9')]=_0x9b67('0xa');break;}return db[_0x111033]['findAll'](_0x20fe14);}else{return[];}});}}else{return[];}})[_0x9b67('0xd')](function(_0x2d4e7a){return _0x2d4e7a;});}function joinOrLeaveQueues(_0x4e6092,_0x3303b2,_0x4e2feb,_0x40e3ea){_0x4e6092[_0x3303b2](util[_0x9b67('0x1d')]('%s:queue:%s',_0x4e2feb,_0x40e3ea[_0x9b67('0x4')]));if(_0x40e3ea[_0x9b67('0x5')]){for(var _0x25663e=0x0;_0x25663e<_0x40e3ea[_0x9b67('0x5')][_0x9b67('0x1e')];_0x25663e+=0x1){_0x4e6092[_0x3303b2](util[_0x9b67('0x1d')](_0x9b67('0x1f'),_0x40e3ea['Agents'][_0x25663e][_0x9b67('0x4')]));}}}function joinOrLeave(_0x4bc18e,_0xd1c79,_0x25ab9b){var _0x2ea003;if(_0x4bc18e['handshake'][_0x9b67('0x20')]['id']){db[_0x9b67('0x6')][_0x9b67('0x21')]({'attributes':['id',_0x9b67('0x4'),'role',_0x9b67('0x22')],'where':{'id':_0x4bc18e['handshake'][_0x9b67('0x20')]['id']},'include':[{'model':db[_0x9b67('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9b67('0x24')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x9b67('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x9b67('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9b67('0x27')],'as':_0x9b67('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x9b67('0x29')],'as':_0x9b67('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x9b67('0xd')](function(_0x322ffe){if(_0x322ffe){_0x2ea003=_0x322ffe;_0x4bc18e[_0xd1c79](util['format'](_0x9b67('0x1f'),_0x322ffe[_0x9b67('0x4')]));var _0x55ccbb=[];switch(_0x322ffe['role']){case _0x9b67('0x2b'):_0x4bc18e[_0xd1c79]('voice:inbound');_0x4bc18e[_0xd1c79](_0x9b67('0x2c'));if(queryQueues[_0x9b67('0x2d')](_0x9b67('0x2e'))){delete queryQueues['include'];}_0x55ccbb[_0x9b67('0x2f')](db['VoiceQueue']['findAll'](queryQueues));_0x55ccbb[_0x9b67('0x2f')](db[_0x9b67('0x30')]['findAll'](queryQueues));_0x55ccbb[_0x9b67('0x2f')](db[_0x9b67('0x31')][_0x9b67('0x16')](queryQueues));_0x55ccbb[_0x9b67('0x2f')](db[_0x9b67('0x32')][_0x9b67('0x16')](queryQueues));_0x55ccbb[_0x9b67('0x2f')](db[_0x9b67('0x33')][_0x9b67('0x16')](queryQueues));_0x55ccbb[_0x9b67('0x2f')](db[_0x9b67('0x34')][_0x9b67('0x16')](queryQueues));_0x55ccbb[_0x9b67('0x2f')](db[_0x9b67('0x35')]['findAll'](queryQueues));_0x55ccbb[_0x9b67('0x2f')](db[_0x9b67('0x6')]['findAll'](queryTelephones));_0x55ccbb[_0x9b67('0x2f')](db['Trunk'][_0x9b67('0x16')](queryTrunks));_0x55ccbb[_0x9b67('0x2f')](db[_0x9b67('0x1c')][_0x9b67('0x16')](queryCampaigns));_0x55ccbb[_0x9b67('0x2f')](db['User'][_0x9b67('0x16')](queryAgents));break;case'user':_0x4bc18e[_0xd1c79]('voice:inbound');_0x4bc18e[_0xd1c79](_0x9b67('0x2c'));_0x55ccbb[_0x9b67('0x2f')](getAssociatedResources(_0x9b67('0xf'),_0x322ffe['userProfileId'],_0x9b67('0x36')));_0x55ccbb[_0x9b67('0x2f')](getAssociatedResources('ChatQueues',_0x322ffe[_0x9b67('0x22')],_0x9b67('0x30')));_0x55ccbb[_0x9b67('0x2f')](getAssociatedResources(_0x9b67('0x11'),_0x322ffe[_0x9b67('0x22')],'FaxQueue'));_0x55ccbb[_0x9b67('0x2f')](getAssociatedResources(_0x9b67('0x37'),_0x322ffe['userProfileId'],'SmsQueue'));_0x55ccbb[_0x9b67('0x2f')](getAssociatedResources(_0x9b67('0x38'),_0x322ffe[_0x9b67('0x22')],_0x9b67('0x33')));_0x55ccbb[_0x9b67('0x2f')](getAssociatedResources('OpenchannelQueues',_0x322ffe['userProfileId'],_0x9b67('0x34')));_0x55ccbb[_0x9b67('0x2f')](getAssociatedResources(_0x9b67('0x13'),_0x322ffe[_0x9b67('0x22')],_0x9b67('0x35')));_0x55ccbb[_0x9b67('0x2f')](getAssociatedResources(_0x9b67('0x14'),_0x322ffe['userProfileId'],_0x9b67('0x6')));_0x55ccbb[_0x9b67('0x2f')](getAssociatedResources(_0x9b67('0x15'),_0x322ffe[_0x9b67('0x22')],_0x9b67('0x39')));_0x55ccbb[_0x9b67('0x2f')](getAssociatedResources('IvrCampaigns',_0x322ffe[_0x9b67('0x22')],_0x9b67('0x1c')));_0x55ccbb['push'](db['User'][_0x9b67('0x16')](queryAgents));break;case _0x9b67('0x8'):_0x4bc18e[_0xd1c79](_0x9b67('0x3a'));_0x4bc18e[_0xd1c79](_0x9b67('0x2c'));_0x55ccbb[_0x9b67('0x2f')](_0x322ffe[_0x9b67('0x3b')]({'attributes':['id','name']}));_0x55ccbb[_0x9b67('0x2f')](_0x322ffe[_0x9b67('0x3c')]({'attributes':['id','name']}));_0x55ccbb[_0x9b67('0x2f')](_0x322ffe['getFaxQueues']({'attributes':['id',_0x9b67('0x4')]}));_0x55ccbb[_0x9b67('0x2f')](_0x322ffe[_0x9b67('0x3d')]({'attributes':['id',_0x9b67('0x4')]}));_0x55ccbb[_0x9b67('0x2f')](_0x322ffe[_0x9b67('0x3e')]({'attributes':['id',_0x9b67('0x4')]}));_0x55ccbb[_0x9b67('0x2f')](_0x322ffe[_0x9b67('0x3f')]({'attributes':['id',_0x9b67('0x4')]}));_0x55ccbb[_0x9b67('0x2f')](_0x322ffe[_0x9b67('0x40')]({'attributes':['id','name']}));break;}return BPromise[_0x9b67('0x41')](_0x55ccbb);}})[_0x9b67('0xd')](function(_0x2891b8){if(_0x2891b8&&_0x2891b8[_0x9b67('0x1e')]){for(var _0x4d0d33=0x0;_0x4d0d33<_0x2891b8[_0x9b67('0x1e')];_0x4d0d33+=0x1){for(var _0x2886a5=0x0;_0x2886a5<_0x2891b8[_0x4d0d33][_0x9b67('0x1e')];_0x2886a5+=0x1){switch(_0x4d0d33){case 0x0:joinOrLeaveQueues(_0x4bc18e,_0xd1c79,_0x9b67('0x42'),_0x2891b8[_0x4d0d33][_0x2886a5]);break;case 0x1:joinOrLeaveQueues(_0x4bc18e,_0xd1c79,'chat',_0x2891b8[_0x4d0d33][_0x2886a5]);break;case 0x2:joinOrLeaveQueues(_0x4bc18e,_0xd1c79,_0x9b67('0x43'),_0x2891b8[_0x4d0d33][_0x2886a5]);break;case 0x3:joinOrLeaveQueues(_0x4bc18e,_0xd1c79,_0x9b67('0x44'),_0x2891b8[_0x4d0d33][_0x2886a5]);break;case 0x4:joinOrLeaveQueues(_0x4bc18e,_0xd1c79,_0x9b67('0x45'),_0x2891b8[_0x4d0d33][_0x2886a5]);break;case 0x5:joinOrLeaveQueues(_0x4bc18e,_0xd1c79,_0x9b67('0x46'),_0x2891b8[_0x4d0d33][_0x2886a5]);break;case 0x6:joinOrLeaveQueues(_0x4bc18e,_0xd1c79,_0x9b67('0x47'),_0x2891b8[_0x4d0d33][_0x2886a5]);break;case 0x7:if(_0x2ea003['role']!==_0x9b67('0x8'))_0x4bc18e[_0xd1c79](util['format'](_0x9b67('0x48'),_0x2891b8[_0x4d0d33][_0x2886a5][_0x9b67('0x4')]));break;case 0x8:if(_0x2ea003[_0x9b67('0x7')]!==_0x9b67('0x8'))_0x4bc18e[_0xd1c79](util[_0x9b67('0x1d')]('trunk:%s',_0x2891b8[_0x4d0d33][_0x2886a5][_0x9b67('0x4')]));break;case 0x9:if(_0x2ea003[_0x9b67('0x7')]!=='agent')_0x4bc18e[_0xd1c79](util[_0x9b67('0x1d')](_0x9b67('0x49'),_0x2891b8[_0x4d0d33][_0x2886a5][_0x9b67('0x9')],_0x2891b8[_0x4d0d33][_0x2886a5][_0x9b67('0x4')]));break;case 0xa:_0x4bc18e[_0xd1c79](util['format']('user:%s',_0x2891b8[_0x4d0d33][_0x2886a5]['name']));break;}}}}})[_0x9b67('0xd')](function(){if(_0xd1c79===_0x9b67('0x4a')){var _0x1f1c1b=_[_0x9b67('0x19')](_0x2ea003[_0x9b67('0x4b')],'id');return _0x2ea003[_0x9b67('0x4c')](_0x1f1c1b)[_0x9b67('0xd')](function(){for(var _0x1ab722=0x0;_0x1ab722<_0x1f1c1b[_0x9b67('0x1e')];_0x1ab722+=0x1){_0x25ab9b[_0x9b67('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x1f1c1b[_0x1ab722]),'UserId':Number(_0x2ea003['id'])});}});}})['then'](function(){if(_0xd1c79===_0x9b67('0x4a')){var _0x4e01d9=_[_0x9b67('0x19')](_0x2ea003[_0x9b67('0x4e')],'id');return _0x2ea003[_0x9b67('0x4f')](_0x4e01d9)['then'](function(){for(var _0x44159b=0x0;_0x44159b<_0x4e01d9['length'];_0x44159b+=0x1){_0x25ab9b[_0x9b67('0x4d')](_0x9b67('0x50'),{'MailInteractionId':Number(_0x4e01d9[_0x44159b]),'UserId':Number(_0x2ea003['id'])});}});}})[_0x9b67('0xd')](function(){if(_0xd1c79===_0x9b67('0x4a')){var _0x48ac10=_[_0x9b67('0x19')](_0x2ea003['FaxInteractions'],'id');return _0x2ea003[_0x9b67('0x51')](_0x48ac10)[_0x9b67('0xd')](function(){for(var _0x879548=0x0;_0x879548<_0x48ac10['length'];_0x879548+=0x1){_0x25ab9b[_0x9b67('0x4d')](_0x9b67('0x52'),{'FaxInteractionId':Number(_0x48ac10[_0x879548]),'UserId':Number(_0x2ea003['id'])});}});}})[_0x9b67('0xd')](function(){if(_0xd1c79===_0x9b67('0x4a')){var _0x49cc71=_['map'](_0x2ea003[_0x9b67('0x53')],'id');return _0x2ea003[_0x9b67('0x54')](_0x49cc71)[_0x9b67('0xd')](function(){for(var _0x41cfd3=0x0;_0x41cfd3<_0x49cc71[_0x9b67('0x1e')];_0x41cfd3+=0x1){_0x25ab9b[_0x9b67('0x4d')](_0x9b67('0x55'),{'SmsInteractionId':Number(_0x49cc71[_0x41cfd3]),'UserId':Number(_0x2ea003['id'])});}});}})[_0x9b67('0xd')](function(){if(_0xd1c79===_0x9b67('0x4a')){var _0x1a2e69=_[_0x9b67('0x19')](_0x2ea003[_0x9b67('0x28')],'id');return _0x2ea003[_0x9b67('0x56')](_0x1a2e69)[_0x9b67('0xd')](function(){for(var _0x3fed54=0x0;_0x3fed54<_0x1a2e69[_0x9b67('0x1e')];_0x3fed54+=0x1){_0x25ab9b['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x1a2e69[_0x3fed54]),'UserId':Number(_0x2ea003['id'])});}});}})[_0x9b67('0xd')](function(){if(_0xd1c79===_0x9b67('0x4a')){var _0x49e893=_[_0x9b67('0x19')](_0x2ea003[_0x9b67('0x2a')],'id');return _0x2ea003['removeWhatsappInteractions'](_0x49e893)[_0x9b67('0xd')](function(){for(var _0x2ddb7d=0x0;_0x2ddb7d<_0x49e893[_0x9b67('0x1e')];_0x2ddb7d+=0x1){_0x25ab9b[_0x9b67('0x4d')](_0x9b67('0x57'),{'WhatsappInteractionId':Number(_0x49e893[_0x2ddb7d]),'UserId':Number(_0x2ea003['id'])});}});}})[_0x9b67('0x58')](function(_0x3e7221){_0x4bc18e[_0x9b67('0x59')](_0x3e7221);});}}function onDisconnect(_0x326759,_0x5e3d53){joinOrLeave(_0x326759,_0x9b67('0x4a'),_0x5e3d53);}function onConnect(_0x3fac1e){joinOrLeave(_0x3fac1e,_0x9b67('0x5a'));}exports[_0x9b67('0x5b')]=function(_0x30fb9a){_0x30fb9a['on'](_0x9b67('0x5c'),function(_0x43dcd8){_0x43dcd8[_0x9b67('0x5d')](0x0);_0x43dcd8[_0x9b67('0x5e')]=_0x43dcd8[_0x9b67('0x5f')]['connection']['remoteAddress']+':'+_0x43dcd8[_0x9b67('0x5f')][_0x9b67('0x5c')]['remotePort'];_0x43dcd8[_0x9b67('0x60')]=new Date();_0x43dcd8[_0x9b67('0x59')]=function(_0x3e35c2){console['log']('SocketIO\x20'+_0x43dcd8[_0x9b67('0x61')][_0x9b67('0x4')]+'['+_0x43dcd8[_0x9b67('0x5e')]+']',_0x3e35c2);};_0x43dcd8['on'](_0x9b67('0x62'),function(){onDisconnect(_0x43dcd8,_0x30fb9a);_0x43dcd8[_0x9b67('0x59')](_0x9b67('0x63'));});onConnect(_0x43dcd8);_0x43dcd8[_0x9b67('0x59')]('CONNECTED');});}; \ No newline at end of file +var _0x8ed7=['all','voice','chat','fax','openchannel','whatsapp','telephone:%s','campaign:%s:%s','type','user:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','Agents','User','name','role','agent','telephone','ivr','findOne','then','autoAssociation','VoiceQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','map','resourceId','where','Campaign','format','%s:queue:%s','length','handshake','query','userProfileId','MailInteraction','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','voice:outbound','ChatQueues','SmsQueues','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8ed7,0x8b));var _0x78ed=function(_0x82f6aa,_0xc6acd1){_0x82f6aa=_0x82f6aa-0x0;var _0x3ff4d0=_0x8ed7[_0x82f6aa];return _0x3ff4d0;};'use strict';var _=require('lodash');var util=require(_0x78ed('0x0'));var BPromise=require(_0x78ed('0x1'));var db=require(_0x78ed('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x78ed('0x3'),'model':db[_0x78ed('0x4')],'attributes':['id',_0x78ed('0x5'),_0x78ed('0x6')],'raw':!![],'where':{'role':_0x78ed('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x78ed('0x5')],'where':{'role':_0x78ed('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x78ed('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x78ed('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x78ed('0x5'),'type'],'where':{'type':_0x78ed('0x9')}};function getAssociatedResources(_0x574428,_0x256c1a,_0x550763){return db['UserProfileSection'][_0x78ed('0xa')]({'where':{'name':_0x574428,'userProfileId':_0x256c1a},'raw':!![]})[_0x78ed('0xb')](function(_0x58f77d){if(_0x58f77d){if(_0x58f77d[_0x78ed('0xc')]){switch(_0x574428){case _0x78ed('0xd'):case'ChatQueues':case _0x78ed('0xe'):case'SmsQueues':case _0x78ed('0xf'):case _0x78ed('0x10'):case _0x78ed('0x11'):return db[_0x550763][_0x78ed('0x12')](queryQueues);case _0x78ed('0x13'):return db[_0x550763][_0x78ed('0x12')](queryTelephones);case'Trunks':return db[_0x550763][_0x78ed('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x550763]['findAll'](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x58f77d['id']},'raw':!![]})[_0x78ed('0xb')](function(_0x272171){if(_0x272171){var _0x2e9007={'where':{'id':_[_0x78ed('0x14')](_0x272171,_0x78ed('0x15'))},'raw':!![]};switch(_0x550763){case _0x78ed('0x4'):_0x2e9007[_0x78ed('0x16')][_0x78ed('0x6')]=_0x78ed('0x8');break;case _0x78ed('0x17'):_0x2e9007[_0x78ed('0x16')]['type']=_0x78ed('0x9');break;}return db[_0x550763][_0x78ed('0x12')](_0x2e9007);}else{return[];}});}}else{return[];}})['then'](function(_0x47eb69){return _0x47eb69;});}function joinOrLeaveQueues(_0x2868d1,_0x2ab0fc,_0x2e9e1d,_0x3bb4a9){_0x2868d1[_0x2ab0fc](util[_0x78ed('0x18')](_0x78ed('0x19'),_0x2e9e1d,_0x3bb4a9[_0x78ed('0x5')]));if(_0x3bb4a9[_0x78ed('0x3')]){for(var _0x376076=0x0;_0x376076<_0x3bb4a9[_0x78ed('0x3')][_0x78ed('0x1a')];_0x376076+=0x1){_0x2868d1[_0x2ab0fc](util['format']('user:%s',_0x3bb4a9[_0x78ed('0x3')][_0x376076]['name']));}}}function joinOrLeave(_0xee570c,_0x55f0e8,_0x4675d3){var _0x590d90;if(_0xee570c[_0x78ed('0x1b')][_0x78ed('0x1c')]['id']){db[_0x78ed('0x4')]['find']({'attributes':['id',_0x78ed('0x5'),'role',_0x78ed('0x1d')],'where':{'id':_0xee570c[_0x78ed('0x1b')][_0x78ed('0x1c')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x78ed('0x1e')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x78ed('0x1f')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x78ed('0x20')],'as':_0x78ed('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x78ed('0x22')],'as':_0x78ed('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x78ed('0x24')],'as':_0x78ed('0x25'),'attributes':['id'],'raw':!![]}]})[_0x78ed('0xb')](function(_0x312801){if(_0x312801){_0x590d90=_0x312801;_0xee570c[_0x55f0e8](util[_0x78ed('0x18')]('user:%s',_0x312801[_0x78ed('0x5')]));var _0x9b1ba6=[];switch(_0x312801[_0x78ed('0x6')]){case _0x78ed('0x26'):_0xee570c[_0x55f0e8]('voice:inbound');_0xee570c[_0x55f0e8]('voice:outbound');if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x78ed('0x27')];}_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x29')][_0x78ed('0x12')](queryQueues));_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x2a')][_0x78ed('0x12')](queryQueues));_0x9b1ba6['push'](db[_0x78ed('0x2b')]['findAll'](queryQueues));_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x2c')]['findAll'](queryQueues));_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x2d')][_0x78ed('0x12')](queryQueues));_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x2e')][_0x78ed('0x12')](queryQueues));_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x2f')]['findAll'](queryQueues));_0x9b1ba6[_0x78ed('0x28')](db['User'][_0x78ed('0x12')](queryTelephones));_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x30')][_0x78ed('0x12')](queryTrunks));_0x9b1ba6[_0x78ed('0x28')](db[_0x78ed('0x17')][_0x78ed('0x12')](queryCampaigns));_0x9b1ba6['push'](db[_0x78ed('0x4')][_0x78ed('0x12')](queryAgents));break;case _0x78ed('0x31'):_0xee570c[_0x55f0e8](_0x78ed('0x32'));_0xee570c[_0x55f0e8](_0x78ed('0x33'));_0x9b1ba6[_0x78ed('0x28')](getAssociatedResources(_0x78ed('0xd'),_0x312801[_0x78ed('0x1d')],_0x78ed('0x29')));_0x9b1ba6[_0x78ed('0x28')](getAssociatedResources(_0x78ed('0x34'),_0x312801['userProfileId'],'ChatQueue'));_0x9b1ba6[_0x78ed('0x28')](getAssociatedResources('FaxQueues',_0x312801[_0x78ed('0x1d')],_0x78ed('0x2b')));_0x9b1ba6['push'](getAssociatedResources(_0x78ed('0x35'),_0x312801[_0x78ed('0x1d')],_0x78ed('0x2c')));_0x9b1ba6[_0x78ed('0x28')](getAssociatedResources(_0x78ed('0xf'),_0x312801[_0x78ed('0x1d')],'MailQueue'));_0x9b1ba6[_0x78ed('0x28')](getAssociatedResources(_0x78ed('0x10'),_0x312801[_0x78ed('0x1d')],_0x78ed('0x2e')));_0x9b1ba6['push'](getAssociatedResources('WhatsappQueues',_0x312801[_0x78ed('0x1d')],_0x78ed('0x2f')));_0x9b1ba6['push'](getAssociatedResources(_0x78ed('0x13'),_0x312801[_0x78ed('0x1d')],'User'));_0x9b1ba6['push'](getAssociatedResources(_0x78ed('0x36'),_0x312801[_0x78ed('0x1d')],_0x78ed('0x30')));_0x9b1ba6[_0x78ed('0x28')](getAssociatedResources('IvrCampaigns',_0x312801['userProfileId'],_0x78ed('0x17')));_0x9b1ba6[_0x78ed('0x28')](db['User'][_0x78ed('0x12')](queryAgents));break;case'agent':_0xee570c[_0x55f0e8](_0x78ed('0x32'));_0xee570c[_0x55f0e8](_0x78ed('0x33'));_0x9b1ba6[_0x78ed('0x28')](_0x312801[_0x78ed('0x37')]({'attributes':['id',_0x78ed('0x5')]}));_0x9b1ba6['push'](_0x312801[_0x78ed('0x38')]({'attributes':['id',_0x78ed('0x5')]}));_0x9b1ba6[_0x78ed('0x28')](_0x312801[_0x78ed('0x39')]({'attributes':['id',_0x78ed('0x5')]}));_0x9b1ba6['push'](_0x312801['getSmsQueues']({'attributes':['id',_0x78ed('0x5')]}));_0x9b1ba6[_0x78ed('0x28')](_0x312801[_0x78ed('0x3a')]({'attributes':['id',_0x78ed('0x5')]}));_0x9b1ba6['push'](_0x312801[_0x78ed('0x3b')]({'attributes':['id',_0x78ed('0x5')]}));_0x9b1ba6[_0x78ed('0x28')](_0x312801[_0x78ed('0x3c')]({'attributes':['id',_0x78ed('0x5')]}));break;}return BPromise[_0x78ed('0x3d')](_0x9b1ba6);}})['then'](function(_0x1de5a2){if(_0x1de5a2&&_0x1de5a2['length']){for(var _0x20547b=0x0;_0x20547b<_0x1de5a2['length'];_0x20547b+=0x1){for(var _0x120c95=0x0;_0x120c95<_0x1de5a2[_0x20547b][_0x78ed('0x1a')];_0x120c95+=0x1){switch(_0x20547b){case 0x0:joinOrLeaveQueues(_0xee570c,_0x55f0e8,_0x78ed('0x3e'),_0x1de5a2[_0x20547b][_0x120c95]);break;case 0x1:joinOrLeaveQueues(_0xee570c,_0x55f0e8,_0x78ed('0x3f'),_0x1de5a2[_0x20547b][_0x120c95]);break;case 0x2:joinOrLeaveQueues(_0xee570c,_0x55f0e8,_0x78ed('0x40'),_0x1de5a2[_0x20547b][_0x120c95]);break;case 0x3:joinOrLeaveQueues(_0xee570c,_0x55f0e8,'sms',_0x1de5a2[_0x20547b][_0x120c95]);break;case 0x4:joinOrLeaveQueues(_0xee570c,_0x55f0e8,'mail',_0x1de5a2[_0x20547b][_0x120c95]);break;case 0x5:joinOrLeaveQueues(_0xee570c,_0x55f0e8,_0x78ed('0x41'),_0x1de5a2[_0x20547b][_0x120c95]);break;case 0x6:joinOrLeaveQueues(_0xee570c,_0x55f0e8,_0x78ed('0x42'),_0x1de5a2[_0x20547b][_0x120c95]);break;case 0x7:if(_0x590d90[_0x78ed('0x6')]!=='agent')_0xee570c[_0x55f0e8](util[_0x78ed('0x18')](_0x78ed('0x43'),_0x1de5a2[_0x20547b][_0x120c95][_0x78ed('0x5')]));break;case 0x8:if(_0x590d90['role']!=='agent')_0xee570c[_0x55f0e8](util[_0x78ed('0x18')]('trunk:%s',_0x1de5a2[_0x20547b][_0x120c95][_0x78ed('0x5')]));break;case 0x9:if(_0x590d90[_0x78ed('0x6')]!=='agent')_0xee570c[_0x55f0e8](util['format'](_0x78ed('0x44'),_0x1de5a2[_0x20547b][_0x120c95][_0x78ed('0x45')],_0x1de5a2[_0x20547b][_0x120c95][_0x78ed('0x5')]));break;case 0xa:_0xee570c[_0x55f0e8](util[_0x78ed('0x18')](_0x78ed('0x46'),_0x1de5a2[_0x20547b][_0x120c95][_0x78ed('0x5')]));break;}}}}})[_0x78ed('0xb')](function(){if(_0x55f0e8===_0x78ed('0x47')){var _0x419d92=_[_0x78ed('0x14')](_0x590d90[_0x78ed('0x48')],'id');return _0x590d90[_0x78ed('0x49')](_0x419d92)[_0x78ed('0xb')](function(){for(var _0x167b6b=0x0;_0x167b6b<_0x419d92['length'];_0x167b6b+=0x1){_0x4675d3[_0x78ed('0x4a')](_0x78ed('0x4b'),{'ChatInteractionId':Number(_0x419d92[_0x167b6b]),'UserId':Number(_0x590d90['id'])});}});}})['then'](function(){if(_0x55f0e8===_0x78ed('0x47')){var _0x16f5e3=_[_0x78ed('0x14')](_0x590d90[_0x78ed('0x4c')],'id');return _0x590d90[_0x78ed('0x4d')](_0x16f5e3)['then'](function(){for(var _0xf0a187=0x0;_0xf0a187<_0x16f5e3['length'];_0xf0a187+=0x1){_0x4675d3[_0x78ed('0x4a')](_0x78ed('0x4e'),{'MailInteractionId':Number(_0x16f5e3[_0xf0a187]),'UserId':Number(_0x590d90['id'])});}});}})[_0x78ed('0xb')](function(){if(_0x55f0e8===_0x78ed('0x47')){var _0x3d5862=_[_0x78ed('0x14')](_0x590d90['FaxInteractions'],'id');return _0x590d90['removeFaxInteractions'](_0x3d5862)[_0x78ed('0xb')](function(){for(var _0x5f369d=0x0;_0x5f369d<_0x3d5862[_0x78ed('0x1a')];_0x5f369d+=0x1){_0x4675d3[_0x78ed('0x4a')](_0x78ed('0x4f'),{'FaxInteractionId':Number(_0x3d5862[_0x5f369d]),'UserId':Number(_0x590d90['id'])});}});}})[_0x78ed('0xb')](function(){if(_0x55f0e8==='leave'){var _0x2d8326=_[_0x78ed('0x14')](_0x590d90[_0x78ed('0x21')],'id');return _0x590d90[_0x78ed('0x50')](_0x2d8326)[_0x78ed('0xb')](function(){for(var _0x53709d=0x0;_0x53709d<_0x2d8326['length'];_0x53709d+=0x1){_0x4675d3[_0x78ed('0x4a')](_0x78ed('0x51'),{'SmsInteractionId':Number(_0x2d8326[_0x53709d]),'UserId':Number(_0x590d90['id'])});}});}})['then'](function(){if(_0x55f0e8===_0x78ed('0x47')){var _0x133309=_[_0x78ed('0x14')](_0x590d90['OpenchannelInteractions'],'id');return _0x590d90[_0x78ed('0x52')](_0x133309)['then'](function(){for(var _0x3d3882=0x0;_0x3d3882<_0x133309['length'];_0x3d3882+=0x1){_0x4675d3['emit'](_0x78ed('0x53'),{'OpenchannelInteractionId':Number(_0x133309[_0x3d3882]),'UserId':Number(_0x590d90['id'])});}});}})[_0x78ed('0xb')](function(){if(_0x55f0e8===_0x78ed('0x47')){var _0x32ec7b=_[_0x78ed('0x14')](_0x590d90[_0x78ed('0x25')],'id');return _0x590d90[_0x78ed('0x54')](_0x32ec7b)[_0x78ed('0xb')](function(){for(var _0x2d9662=0x0;_0x2d9662<_0x32ec7b[_0x78ed('0x1a')];_0x2d9662+=0x1){_0x4675d3[_0x78ed('0x4a')](_0x78ed('0x55'),{'WhatsappInteractionId':Number(_0x32ec7b[_0x2d9662]),'UserId':Number(_0x590d90['id'])});}});}})['catch'](function(_0x3f62b0){_0xee570c[_0x78ed('0x56')](_0x3f62b0);});}}function onDisconnect(_0x1095c7,_0x531fee){joinOrLeave(_0x1095c7,'leave',_0x531fee);}function onConnect(_0x217fae){joinOrLeave(_0x217fae,_0x78ed('0x57'));}exports[_0x78ed('0x58')]=function(_0x1781af){_0x1781af['on'](_0x78ed('0x59'),function(_0x55897a){_0x55897a[_0x78ed('0x5a')](0x0);_0x55897a[_0x78ed('0x5b')]=_0x55897a[_0x78ed('0x5c')]['connection'][_0x78ed('0x5d')]+':'+_0x55897a[_0x78ed('0x5c')][_0x78ed('0x59')][_0x78ed('0x5e')];_0x55897a[_0x78ed('0x5f')]=new Date();_0x55897a[_0x78ed('0x56')]=function(_0x42b1df){console[_0x78ed('0x56')](_0x78ed('0x60')+_0x55897a['nsp'][_0x78ed('0x5')]+'['+_0x55897a[_0x78ed('0x5b')]+']',_0x42b1df);};_0x55897a['on'](_0x78ed('0x61'),function(){onDisconnect(_0x55897a,_0x1781af);_0x55897a[_0x78ed('0x56')](_0x78ed('0x62'));});onConnect(_0x55897a);_0x55897a[_0x78ed('0x56')](_0x78ed('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 8565598..23a6dd9 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 _0x624e=['error','catch','get','channel','event','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','interface','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','motionChannel','offlineMessage','opened','UserId','AfterCreate','changed','closed','substatus','AfterUpdate','find','fullname','internal','length','hasOwnProperty','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','triggers','client','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','newmessage','ChatOfflineMessage','afterCreate','SmsInteraction','Sms','SmsMessage','Whatsapp','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','code'];(function(_0x3cb3f1,_0x3cf121){var _0x39d933=function(_0x1a1262){while(--_0x1a1262){_0x3cb3f1['push'](_0x3cb3f1['shift']());}};_0x39d933(++_0x3cf121);}(_0x624e,0x72));var _0xe624=function(_0x38c60e,_0xfc998d){_0x38c60e=_0x38c60e-0x0;var _0x292b13=_0x624e[_0x38c60e];return _0x292b13;};'use strict';var util=require(_0xe624('0x0'));var db=require(_0xe624('0x1'))['db'];var jayson=require(_0xe624('0x2'));var logger=require('../logger')(_0xe624('0x3'));var client=jayson[_0xe624('0x4')][_0xe624('0x5')]({'port':0x232a});var triggers=[{'channel':_0xe624('0x6'),'model':_0xe624('0x7'),'event':'afterCreate','condition':_0xe624('0x8'),'callback':afterCreate},{'channel':'Chat','model':_0xe624('0x7'),'event':_0xe624('0x9'),'condition':_0xe624('0xa'),'callback':afterUpdate},{'channel':_0xe624('0x6'),'model':'ChatMessage','event':'afterCreate','condition':_0xe624('0xb'),'callback':afterCreateMessage},{'channel':_0xe624('0x6'),'model':_0xe624('0xc'),'event':_0xe624('0xd'),'condition':_0xe624('0xb'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0xe624('0xe'),'event':_0xe624('0xd'),'condition':_0xe624('0x8'),'callback':afterCreate},{'channel':'Sms','model':_0xe624('0xe'),'event':'afterUpdate','condition':_0xe624('0xa'),'callback':afterUpdate},{'channel':_0xe624('0xf'),'model':_0xe624('0x10'),'event':_0xe624('0xd'),'condition':_0xe624('0xb'),'callback':afterCreateMessage},{'channel':_0xe624('0x11'),'model':'WhatsappInteraction','event':_0xe624('0xd'),'condition':_0xe624('0x8'),'callback':afterCreate},{'channel':_0xe624('0x11'),'model':'WhatsappInteraction','event':_0xe624('0x9'),'condition':_0xe624('0xa'),'callback':afterUpdate},{'channel':_0xe624('0x11'),'model':_0xe624('0x12'),'event':_0xe624('0xd'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0xe624('0x13'),'event':'afterCreate','condition':_0xe624('0x8'),'callback':afterCreate},{'channel':_0xe624('0x14'),'model':_0xe624('0x13'),'event':_0xe624('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe624('0x14'),'model':_0xe624('0x15'),'event':'afterCreate','condition':_0xe624('0xb'),'callback':afterCreateMessage},{'channel':_0xe624('0x16'),'model':'MailInteraction','event':_0xe624('0xd'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xe624('0x16'),'model':_0xe624('0x17'),'event':_0xe624('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0xe624('0x18'),'event':_0xe624('0xd'),'condition':_0xe624('0xb'),'callback':afterCreateMessage},{'channel':_0xe624('0x19'),'model':_0xe624('0x1a'),'event':_0xe624('0xd'),'condition':_0xe624('0x8'),'callback':afterCreate},{'channel':_0xe624('0x19'),'model':_0xe624('0x1a'),'event':_0xe624('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe624('0x19'),'model':_0xe624('0x1b'),'event':'afterCreate','condition':_0xe624('0xb'),'callback':afterCreateMessage}];function request(_0x197034){return client[_0xe624('0x1c')](_0xe624('0x1d'),_0x197034)[_0xe624('0x1e')](function(_0xd2b64c){logger[_0xe624('0x1f')](_0xe624('0x20'),'EventManager',_0xd2b64c);if(_0xd2b64c['error']){if(_0xd2b64c['error'][_0xe624('0x21')]===0x1f4){logger[_0xe624('0x22')](_0xe624('0x20'),_0xe624('0x1d'),_0xd2b64c[_0xe624('0x22')]);}}})[_0xe624('0x23')](function(_0x1aed46){logger[_0xe624('0x22')](_0xe624('0x20'),'EventManager',_0x1aed46);});}function afterCreateMessage(_0x1d4c97){return function(_0x17e009){_0x17e009=_0x17e009[_0xe624('0x24')]({'plain':!![]});_0x17e009[_0xe624('0x25')]=_0x1d4c97;_0x17e009['motionChannel']=_0x1d4c97;_0x17e009[_0xe624('0x26')]=_0x17e009['direction'];Promise[_0xe624('0x27')]()[_0xe624('0x1e')](function(){if(typeof _0x17e009[_0xe624('0x28')]===_0xe624('0x29'))return null;var _0x41364c=_0xe624('0x2a')+_0x17e009[_0xe624('0x28')];return db[_0xe624('0x2b')][_0xe624('0x2c')](_0x41364c,{'type':db[_0xe624('0x2d')][_0xe624('0x2e')][_0xe624('0x2f')],'raw':!![]});})[_0xe624('0x1e')](function(_0x3042eb){if(_0x3042eb){_0x17e009['contact']=_0x3042eb[0x0];}if(typeof _0x17e009['UserId']===_0xe624('0x29'))return;return getAgent(_0x17e009['UserId']);})['then'](function(_0x126bfd){if(_0x126bfd){_0x17e009[_0xe624('0x30')]=util[_0xe624('0x31')](_0xe624('0x32'),_0x126bfd[_0xe624('0x33')]);_0x17e009[_0xe624('0x34')]=_0x126bfd;_0x17e009[_0xe624('0x25')]=_0x1d4c97;return request({'event':_0xe624('0x35'),'message':_0x17e009});}else{return request({'event':_0xe624('0x36'),'message':_0x17e009});}})[_0xe624('0x23')](function(_0x1d78b8){logger['error'](_0xe624('0x20'),_0xe624('0x37'),_0x1d78b8);});};}function afterCreateOfflineMessage(_0x233909){return function(_0x392085){_0x392085=_0x392085[_0xe624('0x24')]({'plain':!![]});_0x392085[_0xe624('0x25')]=_0x233909;_0x392085[_0xe624('0x38')]=_0x233909;_0x392085[_0xe624('0x26')]=_0xe624('0x39');return request({'event':_0x392085[_0xe624('0x26')],'message':_0x392085});};}function afterCreate(_0x2703cc,_0xcfc029){return function(_0x354644){_0x354644=_0x354644['get']({'plain':!![]});_0x354644[_0xe624('0x25')]=_0x2703cc;_0x354644[_0xe624('0x38')]=_0x2703cc;_0x354644[_0xe624('0x26')]=_0xe624('0x3a');Promise[_0xe624('0x27')]()[_0xe624('0x1e')](function(){var _0x22494d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x354644[_0xe624('0x28')];return db['sequelize'][_0xe624('0x2c')](_0x22494d,{'type':db[_0xe624('0x2d')][_0xe624('0x2e')][_0xe624('0x2f')],'raw':!![]});})[_0xe624('0x1e')](function(_0xeacf59){if(_0xeacf59){_0x354644['contact']=_0xeacf59[0x0];}if(typeof _0x354644[_0xe624('0x3b')]==='undefined')return;return getAgent(_0x354644[_0xe624('0x3b')]);})[_0xe624('0x1e')](function(_0x295e29){if(_0x295e29){_0x354644[_0xe624('0x30')]=util[_0xe624('0x31')](_0xe624('0x32'),_0x295e29[_0xe624('0x33')]);_0x354644[_0xe624('0x34')]=_0x295e29;}return request({'event':_0xcfc029,'message':_0x354644});})['catch'](function(_0x4ba2c2){logger[_0xe624('0x22')](_0xe624('0x20'),_0xe624('0x3c'),_0x4ba2c2);});};}function afterUpdate(_0x670b96){return function(_0x3d6f88){var _0x1f3393=_0x3d6f88[_0xe624('0x3d')](_0xe624('0x3e'))&&_0x3d6f88[_0xe624('0x3e')];var _0x59bc34=_0x3d6f88[_0xe624('0x3d')]('substatus');if(_0x1f3393||_0x59bc34){var _0x50cd74=_0x1f3393?_0xe624('0xa'):'substatus';var _0x1e8249=_0x3d6f88[_0xe624('0x24')]({'plain':!![]});_0x1e8249['channel']=_0x670b96;_0x1e8249[_0xe624('0x38')]=_0x670b96;_0x1e8249[_0xe624('0x26')]=_0x1f3393?_0xe624('0x3e'):_0xe624('0x3f');var _0x2b17c7=_0xe624('0x2a')+_0x1e8249[_0xe624('0x28')];return db[_0xe624('0x2b')]['query'](_0x2b17c7,{'type':db[_0xe624('0x2d')][_0xe624('0x2e')][_0xe624('0x2f')],'raw':!![]})[_0xe624('0x1e')](function(_0x5a4d40){if(_0x5a4d40){_0x1e8249['contact']=_0x5a4d40[0x0];}if(typeof _0x1e8249[_0xe624('0x3b')]===_0xe624('0x29'))return;return getAgent(_0x1e8249[_0xe624('0x3b')]);})[_0xe624('0x1e')](function(_0x2b0aa1){if(_0x2b0aa1){_0x1e8249[_0xe624('0x30')]=util[_0xe624('0x31')]('SIP/%s',_0x2b0aa1['name']);_0x1e8249[_0xe624('0x34')]=_0x2b0aa1;}return request({'event':_0x50cd74,'message':_0x1e8249});})[_0xe624('0x23')](function(_0xef3817){logger[_0xe624('0x22')](_0xe624('0x20'),_0xe624('0x40'),_0xef3817);});}};}function getAgent(_0x9271c1){return db['User'][_0xe624('0x41')]({'where':{'id':_0x9271c1},'attributes':['id',_0xe624('0x33'),_0xe624('0x42'),'email',_0xe624('0x43')],'raw':!![]})['then'](function(_0x3dff1b){return _0x3dff1b;});}exports['default']=function(){for(var _0x5673dc=0x0;_0x5673dc=_0x1dd682[_0xf916('0x12')]){throw Error(_0xf916('0x13'));}_0x2903ff(_0x1f59da);})['catch'](function(_0x957b0e){_0x5962b9(_0x957b0e);});});}; \ No newline at end of file +var _0x0138=['clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','toLowerCase','includes'];(function(_0x4bcdb6,_0x1bf781){var _0x4a25cb=function(_0x231640){while(--_0x231640){_0x4bcdb6['push'](_0x4bcdb6['shift']());}};_0x4a25cb(++_0x1bf781);}(_0x0138,0x174));var _0x8013=function(_0x4c3cd2,_0x4e4dbf){_0x4c3cd2=_0x4c3cd2-0x0;var _0x2d1dba=_0x0138[_0x4c3cd2];return _0x2d1dba;};'use strict';var _=require(_0x8013('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x8013('0x1'));var channels=[_0x8013('0x2'),_0x8013('0x3'),_0x8013('0x4'),_0x8013('0x5'),_0x8013('0x6'),_0x8013('0x7'),_0x8013('0x8')];exports[_0x8013('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0x2d4b78){_0x2d4b78=_0x2d4b78[_0x8013('0xa')]();return _[_0x8013('0xb')](channels,_0x2d4b78);};exports[_0x8013('0xc')]=function(_0x135379,_0x4c92db,_0x316bb9,_0x3ff5b3){var _0x5d766a={'loginAttempts':_0x4c92db,'blocked':_0x316bb9};if(!_[_0x8013('0xd')](_0x3ff5b3)){_0x5d766a[_0x8013('0xe')]=_0x3ff5b3;}return _0x135379[_0x8013('0xf')](_0x5d766a);};exports[_0x8013('0x10')]=function(_0x9e8684){return new BPromise(function(_0x319ba2,_0x4052f7){var _0x58497b=0x0;if(_0x9e8684[_0x8013('0x11')]!==_0x8013('0x12')){_0x319ba2(_0x9e8684);}db[_0x8013('0x13')][_0x8013('0x14')]({'where':{'role':_0x8013('0x12'),'online':!![],'id':{'$ne':_0x9e8684['id']}}})['then'](function(_0x57df7f){_0x58497b=_0x57df7f;return util[_0x8013('0x10')]();})['then'](function(_0xb6dd9c){if(_0xb6dd9c&&_0xb6dd9c['agents']&&_0x58497b>=_0xb6dd9c[_0x8013('0x15')]){throw Error(_0x8013('0x16'));}_0x319ba2(_0x9e8684);})[_0x8013('0x17')](function(_0xa335ed){_0x4052f7(_0xa335ed);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 66f2c16..111bc0e 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf109=['status','exports','util','../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0xf109,0xce));var _0x9f10=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xf109[_0x4f9b18];return _0x29f20c;};'use strict';var util=require(_0x9f10('0x0'));var logger=require(_0x9f10('0x1'))(_0x9f10('0x2'));var APIError=function(_0x5d2950,_0x5b381d){this['message']=_0x5d2950||_0x9f10('0x3');this[_0x9f10('0x4')]=_0x5b381d||_0x9f10('0x5');util[_0x9f10('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4027f4){this[_0x9f10('0x7')]=_0x4027f4||_0x9f10('0x8');this[_0x9f10('0x4')]=_0x9f10('0x8');util[_0x9f10('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x3fd82f){this['message']=_0x3fd82f||_0x9f10('0x9');this[_0x9f10('0x4')]=_0x9f10('0xa');util[_0x9f10('0x6')](APINotFoundError,APIError);};function getStatusCode(_0x325f22){switch(_0x325f22){case'Bad\x20Request':return 0x190;case _0x9f10('0xb'),_0x9f10('0xc'):return 0x193;case _0x9f10('0xa'):return 0x194;default:return 0x1f4;}}function handleError(_0x4e577d){return function(_0x50215f){logger[_0x9f10('0xd')](_0x50215f[_0x9f10('0xe')]);var _0x407336=getStatusCode(_0x50215f['name']);if(_0x50215f[_0x9f10('0x4')])delete _0x50215f[_0x9f10('0x4')];return _0x4e577d[_0x9f10('0xf')](_0x407336)['send'](_0x50215f);};}module[_0x9f10('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xbec5=['error','stack','status','send','exports','util','../config/logger','message','Internal\x20Server\x20Error','name','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval'];(function(_0xb321b4,_0x5f26b8){var _0xd4f2c3=function(_0x240ae8){while(--_0x240ae8){_0xb321b4['push'](_0xb321b4['shift']());}};_0xd4f2c3(++_0x5f26b8);}(_0xbec5,0xe5));var _0x5bec=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0xbec5[_0x3cec8c];return _0x38032e;};'use strict';var util=require(_0x5bec('0x0'));var logger=require(_0x5bec('0x1'))('api');var APIError=function(_0x1d4842,_0x38c81a){this[_0x5bec('0x2')]=_0x1d4842||_0x5bec('0x3');this[_0x5bec('0x4')]=_0x38c81a||'Error';util[_0x5bec('0x5')](APIError,Error);};var APIBadRequestError=function(_0x376cdb){this[_0x5bec('0x2')]=_0x376cdb||'Bad\x20Request';this[_0x5bec('0x4')]=_0x5bec('0x6');util[_0x5bec('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x406e65){this[_0x5bec('0x2')]=_0x406e65||_0x5bec('0x7');this[_0x5bec('0x4')]=_0x5bec('0x8');util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x41a827){switch(_0x41a827){case'Bad\x20Request':return 0x190;case _0x5bec('0x9'),_0x5bec('0xa'):return 0x193;case _0x5bec('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x4a5482){return function(_0x288d1b){logger[_0x5bec('0xb')](_0x288d1b[_0x5bec('0xc')]);var _0x57ffc4=getStatusCode(_0x288d1b[_0x5bec('0x4')]);if(_0x288d1b[_0x5bec('0x4')])delete _0x288d1b['name'];return _0x4a5482[_0x5bec('0xd')](_0x57ffc4)[_0x5bec('0xe')](_0x288d1b);};}module[_0x5bec('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index d5883de..3499cc1 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d8d=['json','send','404','status','render'];(function(_0x145544,_0x1a8f8b){var _0x69294f=function(_0xdc426){while(--_0xdc426){_0x145544['push'](_0x145544['shift']());}};_0x69294f(++_0x1a8f8b);}(_0x9d8d,0x8e));var _0xd9d8=function(_0x19c0e0,_0x184f6c){_0x19c0e0=_0x19c0e0-0x0;var _0x32eeed=_0x9d8d[_0x19c0e0];return _0x32eeed;};'use strict';module['exports'][0x194]=function pageNotFound(_0xbc9616,_0x2fdebc){var _0x326a54=_0xd9d8('0x0');var _0x1ddeea=0x194;var _0x24fb34={'status':_0x1ddeea};_0x2fdebc[_0xd9d8('0x1')](_0x24fb34[_0xd9d8('0x1')]);_0x2fdebc[_0xd9d8('0x2')](_0x326a54,{},function(_0x1f3bc3,_0x3f787a){if(_0x1f3bc3){return _0x2fdebc[_0xd9d8('0x1')](_0x24fb34[_0xd9d8('0x1')])[_0xd9d8('0x3')](_0x24fb34);}_0x2fdebc[_0xd9d8('0x4')](_0x3f787a);});}; \ No newline at end of file +var _0xd596=['json','send','exports','404','status','render'];(function(_0xcd03f4,_0x40bf27){var _0x122a24=function(_0x1dfb6c){while(--_0x1dfb6c){_0xcd03f4['push'](_0xcd03f4['shift']());}};_0x122a24(++_0x40bf27);}(_0xd596,0x14c));var _0x6d59=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0xd596[_0x17bb31];return _0x505c71;};'use strict';module[_0x6d59('0x0')][0x194]=function pageNotFound(_0x435c17,_0xeab2d3){var _0x3594b8=_0x6d59('0x1');var _0x3b72ba=0x194;var _0x575a41={'status':_0x3b72ba};_0xeab2d3[_0x6d59('0x2')](_0x575a41['status']);_0xeab2d3[_0x6d59('0x3')](_0x3594b8,{},function(_0x3e577a,_0xffd836){if(_0x3e577a){return _0xeab2d3[_0x6d59('0x2')](_0x575a41['status'])[_0x6d59('0x4')](_0x575a41);}_0xeab2d3[_0x6d59('0x5')](_0xffd836);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index ab81b6a..ffd2d94 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ca88562..ef1faea 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe263=['express','./config/environment','./utils/client-side-logger','setupLoggers','default','then','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','use','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMailMessage','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','/api/openchannel/reports/queue','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','/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/voicePrefix','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','3.1.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0xe263,0x11b));var _0x3e26=function(_0x3f8ba0,_0x91ee09){_0x3f8ba0=_0x3f8ba0-0x0;var _0x12cd70=_0xe263[_0x3f8ba0];return _0x12cd70;};'use strict';var path=require(_0x3e26('0x0'));var express=require(_0x3e26('0x1'));var errors=require('./errors');var config=require(_0x3e26('0x2'));var setupLoggers=require(_0x3e26('0x3'))[_0x3e26('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0x3e26('0x5')]=function(_0x335817){return setupLoggers(_0x335817)[_0x3e26('0x6')](function(){_0x335817['use'](_0x3e26('0x7'),require(_0x3e26('0x8')));_0x335817['use'](_0x3e26('0x9'),require(_0x3e26('0xa')));_0x335817['use'](_0x3e26('0xb'),require(_0x3e26('0xc')));_0x335817[_0x3e26('0xd')](_0x3e26('0xe'),require(_0x3e26('0xf')));_0x335817[_0x3e26('0xd')]('/api/voice/mohs',require(_0x3e26('0x10')));_0x335817['use'](_0x3e26('0x11'),require(_0x3e26('0x12')));_0x335817[_0x3e26('0xd')]('/api/voice/recordings',require(_0x3e26('0x13')));_0x335817[_0x3e26('0xd')](_0x3e26('0x14'),require('./api/screenRecording'));_0x335817['use'](_0x3e26('0x15'),require('./api/voiceMail'));_0x335817[_0x3e26('0xd')]('/api/voice/mails/messages',require(_0x3e26('0x16')));_0x335817[_0x3e26('0xd')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x335817[_0x3e26('0xd')]('/api/voice/dials/reports',require(_0x3e26('0x17')));_0x335817[_0x3e26('0xd')](_0x3e26('0x18'),require(_0x3e26('0x19')));_0x335817[_0x3e26('0xd')](_0x3e26('0x1a'),require(_0x3e26('0x1b')));_0x335817[_0x3e26('0xd')](_0x3e26('0x1c'),require(_0x3e26('0x1d')));_0x335817[_0x3e26('0xd')]('/api/trunks',require(_0x3e26('0x1e')));_0x335817['use']('/api/voice/transfers/reports',require(_0x3e26('0x1f')));_0x335817[_0x3e26('0xd')](_0x3e26('0x20'),require('./api/mailServerOut'));_0x335817[_0x3e26('0xd')](_0x3e26('0x21'),require(_0x3e26('0x22')));_0x335817[_0x3e26('0xd')](_0x3e26('0x23'),require(_0x3e26('0x24')));_0x335817[_0x3e26('0xd')](_0x3e26('0x25'),require('./api/mailSubstatus'));_0x335817[_0x3e26('0xd')]('/api/mail/interactions',require(_0x3e26('0x26')));_0x335817['use'](_0x3e26('0x27'),require('./api/mailMessage'));_0x335817['use']('/api/mail/applications',require(_0x3e26('0x28')));_0x335817[_0x3e26('0xd')](_0x3e26('0x29'),require(_0x3e26('0x2a')));_0x335817['use']('/api/dashboards',require('./api/dashboard'));_0x335817[_0x3e26('0xd')](_0x3e26('0x2b'),require(_0x3e26('0x2c')));_0x335817[_0x3e26('0xd')](_0x3e26('0x2d'),require(_0x3e26('0x2e')));_0x335817[_0x3e26('0xd')](_0x3e26('0x2f'),require('./api/faxApplication'));_0x335817[_0x3e26('0xd')](_0x3e26('0x30'),require(_0x3e26('0x31')));_0x335817[_0x3e26('0xd')]('/api/fax/messages',require(_0x3e26('0x32')));_0x335817[_0x3e26('0xd')](_0x3e26('0x33'),require(_0x3e26('0x34')));_0x335817[_0x3e26('0xd')](_0x3e26('0x35'),require(_0x3e26('0x36')));_0x335817[_0x3e26('0xd')](_0x3e26('0x37'),require(_0x3e26('0x38')));_0x335817[_0x3e26('0xd')]('/api/sms/applications',require('./api/smsApplication'));_0x335817[_0x3e26('0xd')]('/api/sms/interactions',require(_0x3e26('0x39')));_0x335817['use'](_0x3e26('0x3a'),require(_0x3e26('0x3b')));_0x335817[_0x3e26('0xd')](_0x3e26('0x3c'),require(_0x3e26('0x3d')));_0x335817[_0x3e26('0xd')](_0x3e26('0x3e'),require(_0x3e26('0x3f')));_0x335817[_0x3e26('0xd')](_0x3e26('0x40'),require('./api/openchannelApplication'));_0x335817[_0x3e26('0xd')](_0x3e26('0x41'),require(_0x3e26('0x42')));_0x335817[_0x3e26('0xd')](_0x3e26('0x43'),require(_0x3e26('0x44')));_0x335817['use'](_0x3e26('0x45'),require('./api/openchannelQueue'));_0x335817[_0x3e26('0xd')](_0x3e26('0x46'),require('./api/chatWebsite'));_0x335817[_0x3e26('0xd')](_0x3e26('0x47'),require('./api/openchannelQueueReport'));_0x335817[_0x3e26('0xd')]('/api/chat/applications',require(_0x3e26('0x48')));_0x335817[_0x3e26('0xd')](_0x3e26('0x49'),require(_0x3e26('0x4a')));_0x335817[_0x3e26('0xd')]('/api/chat/messages',require(_0x3e26('0x4b')));_0x335817[_0x3e26('0xd')]('/api/chat/offline_messages',require(_0x3e26('0x4c')));_0x335817['use']('/api/chat/queues',require(_0x3e26('0x4d')));_0x335817['use'](_0x3e26('0x4e'),require(_0x3e26('0x4f')));_0x335817[_0x3e26('0xd')](_0x3e26('0x50'),require('./api/chatProactiveAction'));_0x335817[_0x3e26('0xd')](_0x3e26('0x51'),require(_0x3e26('0x52')));_0x335817[_0x3e26('0xd')](_0x3e26('0x53'),require(_0x3e26('0x54')));_0x335817[_0x3e26('0xd')](_0x3e26('0x55'),require(_0x3e26('0x56')));_0x335817[_0x3e26('0xd')](_0x3e26('0x57'),require('./api/cmHopperBlack'));_0x335817[_0x3e26('0xd')](_0x3e26('0x58'),require(_0x3e26('0x59')));_0x335817[_0x3e26('0xd')](_0x3e26('0x5a'),require(_0x3e26('0x5b')));_0x335817[_0x3e26('0xd')](_0x3e26('0x5c'),require(_0x3e26('0x5d')));_0x335817['use'](_0x3e26('0x5e'),require(_0x3e26('0x5f')));_0x335817[_0x3e26('0xd')](_0x3e26('0x60'),require(_0x3e26('0x61')));_0x335817['use'](_0x3e26('0x62'),require('./api/cannedAnswer'));_0x335817[_0x3e26('0xd')](_0x3e26('0x63'),require(_0x3e26('0x64')));_0x335817['use'](_0x3e26('0x65'),require(_0x3e26('0x66')));_0x335817[_0x3e26('0xd')](_0x3e26('0x67'),require(_0x3e26('0x68')));_0x335817[_0x3e26('0xd')](_0x3e26('0x69'),require(_0x3e26('0x6a')));_0x335817[_0x3e26('0xd')](_0x3e26('0x6b'),require(_0x3e26('0x6c')));_0x335817[_0x3e26('0xd')](_0x3e26('0x6d'),require(_0x3e26('0x6e')));_0x335817[_0x3e26('0xd')](_0x3e26('0x6f'),require('./api/schedule'));_0x335817[_0x3e26('0xd')](_0x3e26('0x70'),require(_0x3e26('0x71')));_0x335817['use'](_0x3e26('0x72'),require(_0x3e26('0x73')));_0x335817['use'](_0x3e26('0x74'),require(_0x3e26('0x75')));_0x335817['use']('/api/cm_contact_has_items',require(_0x3e26('0x76')));_0x335817[_0x3e26('0xd')](_0x3e26('0x77'),require(_0x3e26('0x78')));_0x335817[_0x3e26('0xd')](_0x3e26('0x79'),require(_0x3e26('0x7a')));_0x335817[_0x3e26('0xd')](_0x3e26('0x7b'),require('./api/trigger'));_0x335817['use'](_0x3e26('0x7c'),require(_0x3e26('0x7d')));_0x335817[_0x3e26('0xd')]('/api/integrations',require('./api/integration'));_0x335817['use'](_0x3e26('0x7e'),require(_0x3e26('0x7f')));_0x335817[_0x3e26('0xd')]('/api/analytics/custom_reports',require(_0x3e26('0x80')));_0x335817['use'](_0x3e26('0x81'),require(_0x3e26('0x82')));_0x335817['use'](_0x3e26('0x83'),require(_0x3e26('0x84')));_0x335817[_0x3e26('0xd')]('/api/analytics/metrics',require(_0x3e26('0x85')));_0x335817[_0x3e26('0xd')](_0x3e26('0x86'),require(_0x3e26('0x87')));_0x335817[_0x3e26('0xd')](_0x3e26('0x88'),require(_0x3e26('0x89')));_0x335817['use'](_0x3e26('0x8a'),require('./api/intSalesforceAccount'));_0x335817[_0x3e26('0xd')](_0x3e26('0x8b'),require(_0x3e26('0x8c')));_0x335817[_0x3e26('0xd')]('/api/integrations/salesforce/fields',require(_0x3e26('0x8d')));_0x335817[_0x3e26('0xd')](_0x3e26('0x8e'),require('./api/intSugarcrmAccount'));_0x335817[_0x3e26('0xd')](_0x3e26('0x8f'),require('./api/intSugarcrmConfiguration'));_0x335817[_0x3e26('0xd')](_0x3e26('0x90'),require(_0x3e26('0x91')));_0x335817[_0x3e26('0xd')](_0x3e26('0x92'),require(_0x3e26('0x93')));_0x335817[_0x3e26('0xd')](_0x3e26('0x94'),require(_0x3e26('0x95')));_0x335817[_0x3e26('0xd')](_0x3e26('0x96'),require(_0x3e26('0x97')));_0x335817['use'](_0x3e26('0x98'),require(_0x3e26('0x99')));_0x335817['use'](_0x3e26('0x9a'),require(_0x3e26('0x9b')));_0x335817['use'](_0x3e26('0x9c'),require(_0x3e26('0x9d')));_0x335817[_0x3e26('0xd')]('/api/integrations/zendesk/accounts',require(_0x3e26('0x9e')));_0x335817[_0x3e26('0xd')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x335817[_0x3e26('0xd')](_0x3e26('0x9f'),require(_0x3e26('0xa0')));_0x335817[_0x3e26('0xd')](_0x3e26('0xa1'),require(_0x3e26('0xa2')));_0x335817[_0x3e26('0xd')](_0x3e26('0xa3'),require(_0x3e26('0xa4')));_0x335817[_0x3e26('0xd')](_0x3e26('0xa5'),require(_0x3e26('0xa6')));_0x335817['use']('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x335817[_0x3e26('0xd')](_0x3e26('0xa7'),require(_0x3e26('0xa8')));_0x335817[_0x3e26('0xd')](_0x3e26('0xa9'),require(_0x3e26('0xaa')));_0x335817[_0x3e26('0xd')]('/api/integrations/servicenow/accounts',require(_0x3e26('0xab')));_0x335817['use'](_0x3e26('0xac'),require(_0x3e26('0xad')));_0x335817[_0x3e26('0xd')](_0x3e26('0xae'),require(_0x3e26('0xaf')));_0x335817[_0x3e26('0xd')]('/api/integrations/dynamics365/accounts',require(_0x3e26('0xb0')));_0x335817[_0x3e26('0xd')](_0x3e26('0xb1'),require(_0x3e26('0xb2')));_0x335817[_0x3e26('0xd')](_0x3e26('0xb3'),require(_0x3e26('0xb4')));_0x335817[_0x3e26('0xd')](_0x3e26('0xb5'),require('./api/intFreshsalesAccount'));_0x335817['use'](_0x3e26('0xb6'),require(_0x3e26('0xb7')));_0x335817['use'](_0x3e26('0xb8'),require(_0x3e26('0xb9')));_0x335817[_0x3e26('0xd')](_0x3e26('0xba'),require(_0x3e26('0xbb')));_0x335817[_0x3e26('0xd')](_0x3e26('0xbc'),require(_0x3e26('0xbd')));_0x335817[_0x3e26('0xd')](_0x3e26('0xbe'),require('./api/chatInternalMessage'));_0x335817[_0x3e26('0xd')](_0x3e26('0xbf'),require('./api/jscriptyAnswerReport'));_0x335817['use'](_0x3e26('0xc0'),require(_0x3e26('0xc1')));_0x335817[_0x3e26('0xd')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x335817[_0x3e26('0xd')](_0x3e26('0xc2'),require(_0x3e26('0xc3')));_0x335817['use'](_0x3e26('0xc4'),require(_0x3e26('0xc5')));_0x335817[_0x3e26('0xd')](_0x3e26('0xc6'),require('./api/squareReportDetail'));_0x335817[_0x3e26('0xd')](_0x3e26('0xc7'),require(_0x3e26('0xc8')));_0x335817[_0x3e26('0xd')](_0x3e26('0xc9'),require('./api/setting'));_0x335817['use'](_0x3e26('0xca'),require(_0x3e26('0xcb')));_0x335817[_0x3e26('0xd')](_0x3e26('0xcc'),require(_0x3e26('0xcd')));_0x335817['use']('/api/square/recordings',require(_0x3e26('0xce')));_0x335817[_0x3e26('0xd')](_0x3e26('0xcf'),require(_0x3e26('0xd0')));_0x335817[_0x3e26('0xd')](_0x3e26('0xd1'),require('./api/team'));_0x335817['use'](_0x3e26('0xd2'),require(_0x3e26('0xd3')));_0x335817[_0x3e26('0xd')](_0x3e26('0xd4'),require(_0x3e26('0xd5')));_0x335817[_0x3e26('0xd')](_0x3e26('0xd6'),require(_0x3e26('0xd7')));_0x335817[_0x3e26('0xd')](_0x3e26('0xd8'),require(_0x3e26('0xd9')));_0x335817[_0x3e26('0xd')]('/api/plugins',require(_0x3e26('0xda')));_0x335817['use']('/api/mail/reports/transfer',require(_0x3e26('0xdb')));_0x335817[_0x3e26('0xd')](_0x3e26('0xdc'),require(_0x3e26('0xdd')));_0x335817[_0x3e26('0xd')](_0x3e26('0xde'),require(_0x3e26('0xdf')));_0x335817[_0x3e26('0xd')](_0x3e26('0xe0'),require('./api/openchannelTransferReport'));_0x335817[_0x3e26('0xd')](_0x3e26('0xe1'),require(_0x3e26('0xe2')));_0x335817[_0x3e26('0xd')](_0x3e26('0xe3'),require(_0x3e26('0xe4')));_0x335817[_0x3e26('0xd')]('/api/voice/prefixes',require(_0x3e26('0xe5')));_0x335817[_0x3e26('0xd')]('/api/userProfiles',require('./api/userProfile'));_0x335817['use'](_0x3e26('0xe6'),require('./api/userProfileSection'));_0x335817[_0x3e26('0xd')](_0x3e26('0xe7'),require(_0x3e26('0xe8')));_0x335817[_0x3e26('0xd')]('/api/userNotifications',require(_0x3e26('0xe9')));_0x335817[_0x3e26('0xd')](_0x3e26('0xea'),require('./api/whatsappAccount'));_0x335817['use'](_0x3e26('0xeb'),require(_0x3e26('0xec')));_0x335817[_0x3e26('0xd')]('/api/whatsapp/interactions',require(_0x3e26('0xed')));_0x335817[_0x3e26('0xd')](_0x3e26('0xee'),require(_0x3e26('0xef')));_0x335817[_0x3e26('0xd')](_0x3e26('0xf0'),require('./api/whatsappQueueReport'));_0x335817[_0x3e26('0xd')](_0x3e26('0xf1'),require(_0x3e26('0xf2')));_0x335817[_0x3e26('0xd')](_0x3e26('0xf3'),require(_0x3e26('0xf4')));_0x335817[_0x3e26('0xd')](_0x3e26('0xf5'),require(_0x3e26('0xf6')));_0x335817[_0x3e26('0xd')](_0x3e26('0xf7'),require(_0x3e26('0xf8')));_0x335817[_0x3e26('0xd')](_0x3e26('0xf9'),require(_0x3e26('0xfa')));_0x335817[_0x3e26('0xd')](_0x3e26('0xfb'),require(_0x3e26('0xfc')));_0x335817[_0x3e26('0xd')](_0x3e26('0xfd'),require(_0x3e26('0xfe')));_0x335817[_0x3e26('0xd')]('/api/auth/activedirectory',require(_0x3e26('0xff')));_0x335817[_0x3e26('0xd')]('/api/jira',require(_0x3e26('0x100')));_0x335817['use'](_0x3e26('0x101'),require(_0x3e26('0x102')));_0x335817[_0x3e26('0xd')](_0x3e26('0x103'),require(_0x3e26('0x104')));_0x335817['use'](_0x3e26('0x105'),require(_0x3e26('0x106')));_0x335817[_0x3e26('0xd')](_0x3e26('0x107'),require(_0x3e26('0x108')));_0x335817[_0x3e26('0xd')](_0x3e26('0x109'),require(_0x3e26('0x10a')));_0x335817[_0x3e26('0xd')](_0x3e26('0x10b'),clientSideLogs);_0x335817[_0x3e26('0xd')](_0x3e26('0x10c'),express[_0x3e26('0x10d')](path['join'](config[_0x3e26('0x10e')],_0x3e26('0x10c'))));_0x335817[_0x3e26('0xd')](_0x3e26('0x10f'),express[_0x3e26('0x10d')](path[_0x3e26('0x110')](config[_0x3e26('0x10e')],_0x3e26('0x10f'))));_0x335817[_0x3e26('0xd')](_0x3e26('0x111'),express['static'](path[_0x3e26('0x110')](config[_0x3e26('0x10e')],'/demo')));_0x335817[_0x3e26('0xd')](_0x3e26('0x112'),express[_0x3e26('0x10d')](path['join'](config[_0x3e26('0x10e')],'snippet',_0x3e26('0x113'))));_0x335817['use'](_0x3e26('0x114'),express[_0x3e26('0x10d')](path[_0x3e26('0x110')](config[_0x3e26('0x10e')],_0x3e26('0x115'))));_0x335817[_0x3e26('0x116')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x3e26('0x117')](errors[0x194]);_0x335817[_0x3e26('0x116')]('/*')['get'](function(_0x5d8bad,_0x11f0c9){_0x11f0c9[_0x3e26('0x118')](path[_0x3e26('0x119')](_0x335817[_0x3e26('0x117')](_0x3e26('0x11a'))+_0x3e26('0x11b')));});return _0x335817;});}; \ No newline at end of file +var _0x54e6=['/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/template','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/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/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/logs','/apidoc','static','join','root','/www','/snippet','snippet','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/chat/websites','/api/openchannel/reports/queue','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule'];(function(_0x50b20f,_0x5ae4f1){var _0x2d00d3=function(_0x58c50a){while(--_0x58c50a){_0x50b20f['push'](_0x50b20f['shift']());}};_0x2d00d3(++_0x5ae4f1);}(_0x54e6,0x199));var _0x654e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x54e6[_0x20a584];return _0x4b41a8;};'use strict';var path=require('path');var express=require(_0x654e('0x0'));var errors=require(_0x654e('0x1'));var config=require(_0x654e('0x2'));var setupLoggers=require(_0x654e('0x3'))[_0x654e('0x4')];var clientSideLogs=require(_0x654e('0x5'));exports[_0x654e('0x6')]=function(_0x1dbaaa){return setupLoggers(_0x1dbaaa)[_0x654e('0x7')](function(){_0x1dbaaa[_0x654e('0x8')](_0x654e('0x9'),require(_0x654e('0xa')));_0x1dbaaa[_0x654e('0x8')]('/api/voice/chanspy',require(_0x654e('0xb')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xc'),require(_0x654e('0xd')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xe'),require(_0x654e('0xf')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x10'),require(_0x654e('0x11')));_0x1dbaaa['use']('/api/voice/queues',require('./api/voiceQueue'));_0x1dbaaa['use'](_0x654e('0x12'),require('./api/voiceRecording'));_0x1dbaaa['use']('/api/screen/recordings',require(_0x654e('0x13')));_0x1dbaaa[_0x654e('0x8')]('/api/voice/mails',require(_0x654e('0x14')));_0x1dbaaa['use'](_0x654e('0x15'),require('./api/voiceMailMessage'));_0x1dbaaa[_0x654e('0x8')]('/api/voice/calls/reports',require(_0x654e('0x16')));_0x1dbaaa[_0x654e('0x8')]('/api/voice/dials/reports',require(_0x654e('0x17')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x18'),require(_0x654e('0x19')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x1a'),require(_0x654e('0x1b')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x1c'),require(_0x654e('0x1d')));_0x1dbaaa['use']('/api/trunks',require(_0x654e('0x1e')));_0x1dbaaa['use'](_0x654e('0x1f'),require('./api/voiceTransferReport'));_0x1dbaaa[_0x654e('0x8')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x1dbaaa['use'](_0x654e('0x20'),require(_0x654e('0x21')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x22'),require(_0x654e('0x23')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x24'),require('./api/mailSubstatus'));_0x1dbaaa['use'](_0x654e('0x25'),require(_0x654e('0x26')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x27'),require(_0x654e('0x28')));_0x1dbaaa[_0x654e('0x8')]('/api/mail/applications',require(_0x654e('0x29')));_0x1dbaaa['use'](_0x654e('0x2a'),require(_0x654e('0x2b')));_0x1dbaaa[_0x654e('0x8')]('/api/dashboards',require(_0x654e('0x2c')));_0x1dbaaa['use'](_0x654e('0x2d'),require(_0x654e('0x2e')));_0x1dbaaa['use'](_0x654e('0x2f'),require(_0x654e('0x30')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x31'),require(_0x654e('0x32')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x33'),require(_0x654e('0x34')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x35'),require('./api/faxMessage'));_0x1dbaaa['use']('/api/fax/queues',require('./api/faxQueue'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x36'),require(_0x654e('0x37')));_0x1dbaaa[_0x654e('0x8')]('/api/sms/accounts',require(_0x654e('0x38')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x39'),require('./api/smsApplication'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x3a'),require(_0x654e('0x3b')));_0x1dbaaa[_0x654e('0x8')]('/api/sms/messages',require(_0x654e('0x3c')));_0x1dbaaa['use'](_0x654e('0x3d'),require(_0x654e('0x3e')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x3f'),require(_0x654e('0x40')));_0x1dbaaa[_0x654e('0x8')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x1dbaaa['use'](_0x654e('0x41'),require('./api/openchannelInteraction'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x42'),require(_0x654e('0x43')));_0x1dbaaa['use']('/api/openchannel/queues',require('./api/openchannelQueue'));_0x1dbaaa['use'](_0x654e('0x44'),require('./api/chatWebsite'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x45'),require('./api/openchannelQueueReport'));_0x1dbaaa[_0x654e('0x8')]('/api/chat/applications',require('./api/chatApplication'));_0x1dbaaa[_0x654e('0x8')]('/api/chat/interactions',require('./api/chatInteraction'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x46'),require(_0x654e('0x47')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x48'),require(_0x654e('0x49')));_0x1dbaaa['use'](_0x654e('0x4a'),require(_0x654e('0x4b')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x4c'),require(_0x654e('0x4d')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x4e'),require(_0x654e('0x4f')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x50'),require(_0x654e('0x51')));_0x1dbaaa['use'](_0x654e('0x52'),require('./api/cmContact'));_0x1dbaaa[_0x654e('0x8')]('/api/cm/hopper',require(_0x654e('0x53')));_0x1dbaaa[_0x654e('0x8')]('/api/cm/hopper_black',require(_0x654e('0x54')));_0x1dbaaa['use'](_0x654e('0x55'),require('./api/cmHopperFinal'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x56'),require(_0x654e('0x57')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x58'),require(_0x654e('0x59')));_0x1dbaaa[_0x654e('0x8')]('/api/actions',require(_0x654e('0x5a')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x5b'),require(_0x654e('0x5c')));_0x1dbaaa[_0x654e('0x8')]('/api/canned_answers',require('./api/cannedAnswer'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x5d'),require(_0x654e('0x5e')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x5f'),require(_0x654e('0x60')));_0x1dbaaa[_0x654e('0x8')]('/api/intervals',require(_0x654e('0x61')));_0x1dbaaa['use'](_0x654e('0x62'),require('./api/pause'));_0x1dbaaa[_0x654e('0x8')]('/api/cdr',require(_0x654e('0x63')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x64'),require('./api/voiceQueuesLog'));_0x1dbaaa['use'](_0x654e('0x65'),require(_0x654e('0x66')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x67'),require(_0x654e('0x68')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x69'),require('./api/tag'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x6a'),require(_0x654e('0x6b')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x6c'),require('./api/cmContactHasItem'));_0x1dbaaa['use']('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x1dbaaa[_0x654e('0x8')]('/api/templates',require(_0x654e('0x6d')));_0x1dbaaa[_0x654e('0x8')]('/api/triggers',require('./api/trigger'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x6e'),require('./api/variable'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x6f'),require(_0x654e('0x70')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x71'),require('./api/integrationReport'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x72'),require(_0x654e('0x73')));_0x1dbaaa['use']('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x1dbaaa['use'](_0x654e('0x74'),require(_0x654e('0x75')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x76'),require(_0x654e('0x77')));_0x1dbaaa['use'](_0x654e('0x78'),require(_0x654e('0x79')));_0x1dbaaa['use'](_0x654e('0x7a'),require(_0x654e('0x7b')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x7c'),require(_0x654e('0x7d')));_0x1dbaaa[_0x654e('0x8')]('/api/integrations/salesforce/configurations',require(_0x654e('0x7e')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x7f'),require(_0x654e('0x80')));_0x1dbaaa['use'](_0x654e('0x81'),require('./api/intSugarcrmAccount'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x82'),require(_0x654e('0x83')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x84'),require(_0x654e('0x85')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x86'),require(_0x654e('0x87')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x88'),require('./api/intDeskConfiguration'));_0x1dbaaa['use']('/api/integrations/desk/fields',require(_0x654e('0x89')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x8a'),require(_0x654e('0x8b')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x8c'),require(_0x654e('0x8d')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x8e'),require(_0x654e('0x8f')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x90'),require('./api/intZendeskAccount'));_0x1dbaaa['use'](_0x654e('0x91'),require(_0x654e('0x92')));_0x1dbaaa[_0x654e('0x8')]('/api/integrations/zendesk/fields',require(_0x654e('0x93')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x94'),require('./api/intFreshdeskAccount'));_0x1dbaaa['use'](_0x654e('0x95'),require(_0x654e('0x96')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x97'),require(_0x654e('0x98')));_0x1dbaaa[_0x654e('0x8')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x1dbaaa['use']('/api/integrations/vtiger/configurations',require(_0x654e('0x99')));_0x1dbaaa['use'](_0x654e('0x9a'),require(_0x654e('0x9b')));_0x1dbaaa[_0x654e('0x8')]('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x9c'),require('./api/intServicenowConfiguration'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x9d'),require(_0x654e('0x9e')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0x9f'),require(_0x654e('0xa0')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xa1'),require(_0x654e('0xa2')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xa3'),require('./api/intDynamics365Field'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xa4'),require(_0x654e('0xa5')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xa6'),require(_0x654e('0xa7')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xa8'),require('./api/intFreshsalesField'));_0x1dbaaa[_0x654e('0x8')]('/api/networks',require('./api/network'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xa9'),require('./api/chatQueueReport'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xaa'),require(_0x654e('0xab')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xac'),require(_0x654e('0xad')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xae'),require(_0x654e('0xaf')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xb0'),require(_0x654e('0xb1')));_0x1dbaaa['use'](_0x654e('0xb2'),require('./api/smsQueueReport'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xb3'),require(_0x654e('0xb4')));_0x1dbaaa[_0x654e('0x8')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x1dbaaa[_0x654e('0x8')]('/api/jscripty/projects',require(_0x654e('0xb5')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xb6'),require(_0x654e('0xb7')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xb8'),require('./api/squareOdbc'));_0x1dbaaa['use'](_0x654e('0xb9'),require(_0x654e('0xba')));_0x1dbaaa['use']('/api/square/recordings',require('./api/squareRecording'));_0x1dbaaa[_0x654e('0x8')]('/api/square/messages',require(_0x654e('0xbb')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xbc'),require(_0x654e('0xbd')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xbe'),require(_0x654e('0xbf')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xc0'),require(_0x654e('0xc1')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xc2'),require(_0x654e('0xc3')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xc4'),require('./api/attachment'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xc5'),require(_0x654e('0xc6')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xc7'),require(_0x654e('0xc8')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xc9'),require(_0x654e('0xca')));_0x1dbaaa['use'](_0x654e('0xcb'),require('./api/faxTransferReport'));_0x1dbaaa[_0x654e('0x8')]('/api/openchannel/reports/transfer',require(_0x654e('0xcc')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xcd'),require(_0x654e('0xce')));_0x1dbaaa[_0x654e('0x8')]('/api/cm/lists',require(_0x654e('0xcf')));_0x1dbaaa[_0x654e('0x8')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xd0'),require(_0x654e('0xd1')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xd2'),require('./api/userProfileSection'));_0x1dbaaa[_0x654e('0x8')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x1dbaaa['use'](_0x654e('0xd3'),require('./api/userNotification'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xd4'),require(_0x654e('0xd5')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xd6'),require(_0x654e('0xd7')));_0x1dbaaa['use'](_0x654e('0xd8'),require(_0x654e('0xd9')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xda'),require(_0x654e('0xdb')));_0x1dbaaa[_0x654e('0x8')]('/api/whatsapp/reports/queue',require(_0x654e('0xdc')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xdd'),require(_0x654e('0xde')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xdf'),require(_0x654e('0xe0')));_0x1dbaaa[_0x654e('0x8')]('/api/cloudProviders',require('./api/cloudProvider'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xe1'),require(_0x654e('0xe2')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xe3'),require(_0x654e('0xe4')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xe5'),require('./api/authLocal'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xe6'),require(_0x654e('0xe7')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xe8'),require(_0x654e('0xe9')));_0x1dbaaa['use'](_0x654e('0xea'),require(_0x654e('0xeb')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xec'),require(_0x654e('0xed')));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xee'),require('./api/version'));_0x1dbaaa['use'](_0x654e('0xef'),require(_0x654e('0xf0')));_0x1dbaaa[_0x654e('0x8')]('/api/pm2',require('./api/pm2'));_0x1dbaaa['use']('/api/webbar',require('./api/webbar'));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xf1'),clientSideLogs);_0x1dbaaa[_0x654e('0x8')](_0x654e('0xf2'),express[_0x654e('0xf3')](path[_0x654e('0xf4')](config[_0x654e('0xf5')],_0x654e('0xf2'))));_0x1dbaaa['use'](_0x654e('0xf6'),express[_0x654e('0xf3')](path[_0x654e('0xf4')](config[_0x654e('0xf5')],_0x654e('0xf6'))));_0x1dbaaa[_0x654e('0x8')]('/demo',express[_0x654e('0xf3')](path[_0x654e('0xf4')](config[_0x654e('0xf5')],'/demo')));_0x1dbaaa['use'](_0x654e('0xf7'),express[_0x654e('0xf3')](path['join'](config[_0x654e('0xf5')],_0x654e('0xf8'),_0x654e('0xf9'))));_0x1dbaaa[_0x654e('0x8')](_0x654e('0xfa'),express['static'](path[_0x654e('0xf4')](config[_0x654e('0xf5')],_0x654e('0xfb'))));_0x1dbaaa[_0x654e('0xfc')](_0x654e('0xfd'))[_0x654e('0xfe')](errors[0x194]);_0x1dbaaa[_0x654e('0xfc')]('/*')[_0x654e('0xfe')](function(_0x1a95f7,_0x3748d6){_0x3748d6['sendFile'](path[_0x654e('0xff')](_0x1dbaaa['get']('appPath')+'/index.html'));});return _0x1dbaaa;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 520e42a..f6b7769 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d4e=['../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','lodash','../config/environment','listen','merge','../api/user/user.rpc','../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/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.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/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc'];(function(_0x479462,_0x3137db){var _0x479e5f=function(_0x38839f){while(--_0x38839f){_0x479462['push'](_0x479462['shift']());}};_0x479e5f(++_0x3137db);}(_0x1d4e,0x137));var _0xe1d4=function(_0x14c750,_0x4ad003){_0x14c750=_0x14c750-0x0;var _0x5bef79=_0x1d4e[_0x14c750];return _0x5bef79;};'use strict';var jayson=require('jayson/promise');var _=require(_0xe1d4('0x0'));var config=require(_0xe1d4('0x1'));exports[_0xe1d4('0x2')]=function(){return new Promise(function(_0x12a958,_0x3f1ab9){var _0x4fad12={};_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x4')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x5')));_0x4fad12=_['merge'](_0x4fad12,require('../api/voiceQueue/voiceQueue.rpc'));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x6')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x7')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x8')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x9')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0xa')));_0x4fad12=_['merge'](_0x4fad12,require(_0xe1d4('0xb')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require('../api/trunk/trunk.rpc'));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0xc')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0xd')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0xe')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require('../api/mailAccount/mailAccount.rpc'));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require('../api/mailQueue/mailQueue.rpc'));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0xf')));_0x4fad12=_['merge'](_0x4fad12,require(_0xe1d4('0x10')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x11')));_0x4fad12=_['merge'](_0x4fad12,require(_0xe1d4('0x12')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require('../api/faxAccount/faxAccount.rpc'));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x13')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x14')));_0x4fad12=_['merge'](_0x4fad12,require('../api/faxMessage/faxMessage.rpc'));_0x4fad12=_['merge'](_0x4fad12,require('../api/faxQueue/faxQueue.rpc'));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require('../api/smsAccount/smsAccount.rpc'));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x15')));_0x4fad12=_['merge'](_0x4fad12,require('../api/smsMessage/smsMessage.rpc'));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x16')));_0x4fad12=_['merge'](_0x4fad12,require(_0xe1d4('0x17')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x18')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x19')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x1a')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x1b')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x1c')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x1d')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x1e')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x1f')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x20')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x21')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x22')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x23')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require('../api/interval/interval.rpc'));_0x4fad12=_['merge'](_0x4fad12,require(_0xe1d4('0x24')));_0x4fad12=_['merge'](_0x4fad12,require(_0xe1d4('0x25')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x26')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x27')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x28')));_0x4fad12=_['merge'](_0x4fad12,require(_0xe1d4('0x29')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x2a')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x2b')));_0x4fad12=_['merge'](_0x4fad12,require(_0xe1d4('0x2c')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x2d')));_0x4fad12=_['merge'](_0x4fad12,require(_0xe1d4('0x2e')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x2f')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x30')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x31')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x32')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x33')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x34')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x35')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x36')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x37')));_0x4fad12=_['merge'](_0x4fad12,require('../api/squareRecording/squareRecording.rpc'));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x38')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x39')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x3a')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x3b')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x3c')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x3d')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x3e')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x3f')));_0x4fad12=_[_0xe1d4('0x3')](_0x4fad12,require(_0xe1d4('0x40')));var _0x4ef107=jayson[_0xe1d4('0x41')](_0x4fad12)[_0xe1d4('0x42')]();var _0x4d49b5=config['rpc'][_0xe1d4('0x43')]||config[_0xe1d4('0x43')]+0x1;var _0x361066=config['rpc']['ip']||_0xe1d4('0x44');_0x4ef107['on']('error',function(_0x250879){return _0x3f1ab9(_0x250879);});_0x4ef107[_0xe1d4('0x2')](_0x4d49b5,_0x361066,function(){console[_0xe1d4('0x45')](_0xe1d4('0x46'),_0x361066,_0x4d49b5);require(_0xe1d4('0x47'))[_0xe1d4('0x48')]();return _0x12a958('RPC\x20listening\x20on\x20'+_0x361066+':'+_0x4d49b5);});});}; \ No newline at end of file +var _0x07d7=['../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.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/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intZohoAccount/intZohoAccount.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','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','listen','log','../config/triggers','default','jayson/promise','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc'];(function(_0x4596c8,_0x3ae0f3){var _0x37f619=function(_0x218c64){while(--_0x218c64){_0x4596c8['push'](_0x4596c8['shift']());}};_0x37f619(++_0x3ae0f3);}(_0x07d7,0x141));var _0x707d=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x07d7[_0x4bed75];return _0x2dd8e8;};'use strict';var jayson=require(_0x707d('0x0'));var _=require('lodash');var config=require(_0x707d('0x1'));exports['listen']=function(){return new Promise(function(_0xc7732c,_0x34dc7c){var _0x33c8f4={};_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/user/user.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x3')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x4')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x5')));_0x33c8f4=_['merge'](_0x33c8f4,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x6')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x7')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x8')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x9')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0xa')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0xb')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/mailServerIn/mailServerIn.rpc'));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0xc')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0xd')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/mailInteraction/mailInteraction.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0xe')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/mailApplication/mailApplication.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0xf')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x10')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x11')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x12')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x13')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x14')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x15')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x16')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x17')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x18')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/smsQueue/smsQueue.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x19')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x1a')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x1b')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x1c')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x1d')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x1e')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x1f')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x20')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/cmHopper/cmHopper.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x21')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x22')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x23')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x24')));_0x33c8f4=_['merge'](_0x33c8f4,require('../api/sound/sound.rpc'));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x25')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x26')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x27')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/variable/variable.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x28')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x29')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x2a')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x2b')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x2c')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x2d')));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x2e')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x2f')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x30')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x31')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x32')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/squareOdbc/squareOdbc.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x33')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x34')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x35')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/campaign/campaign.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x36')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/plugin/plugin.rpc'));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x37')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x33c8f4=_['merge'](_0x33c8f4,require(_0x707d('0x38')));_0x33c8f4=_[_0x707d('0x2')](_0x33c8f4,require(_0x707d('0x39')));var _0x4be0c2=jayson[_0x707d('0x3a')](_0x33c8f4)[_0x707d('0x3b')]();var _0x1b7f29=config['rpc'][_0x707d('0x3c')]||config['port']+0x1;var _0x121df7=config[_0x707d('0x3d')]['ip']||_0x707d('0x3e');_0x4be0c2['on'](_0x707d('0x3f'),function(_0x429108){return _0x34dc7c(_0x429108);});_0x4be0c2[_0x707d('0x40')](_0x1b7f29,_0x121df7,function(){console[_0x707d('0x41')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x121df7,_0x1b7f29);require(_0x707d('0x42'))[_0x707d('0x43')]();return _0xc7732c('RPC\x20listening\x20on\x20'+_0x121df7+':'+_0x1b7f29);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 6702743..4bc5953 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 _0xa17b=['isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','emit','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec'];(function(_0x3e6afe,_0x62f3bf){var _0x81776a=function(_0xb70972){while(--_0xb70972){_0x3e6afe['push'](_0x3e6afe['shift']());}};_0x81776a(++_0x62f3bf);}(_0xa17b,0xbf));var _0xba17=function(_0x57df9c,_0x395831){_0x57df9c=_0x57df9c-0x0;var _0x487ae2=_0xa17b[_0x57df9c];return _0x487ae2;};'use strict';var util=require(_0xba17('0x0'));var _=require(_0xba17('0x1'));var EventEmitter=require(_0xba17('0x2'))[_0xba17('0x3')];var AGIReply=require(_0xba17('0x4'));var AGIError=require('./error');function AGIChannel(_0xdea7e){var _0xc0ccbe=this,_0x398ae8=new AGIReply(),_0x3d0b6b=![],_0x336a87={};EventEmitter[_0xba17('0x5')](_0xc0ccbe);_0xdea7e[_0xba17('0x6')](_0xba17('0x7'));_0xdea7e[_0xba17('0x8')](0x8*0x3c*0x3c*0x3e8);_0x398ae8[_0xba17('0x6')](_0xba17('0x7'));_0x398ae8['on'](_0xba17('0x9'),function(_0x50a0d8){for(var _0x11e0b2 in _0x50a0d8){_0xc0ccbe[_0x11e0b2]=_0x50a0d8[_0x11e0b2];}_0xc0ccbe['emit'](_0xba17('0xa'));});_0x398ae8['on'](_0xba17('0xb'),function(_0x3cf4f8){if(_0x3cf4f8[_0xba17('0xc')]()=='hangup'){_0xc0ccbe[_0xba17('0xd')](_0xba17('0xe'));return;}if(_0x3cf4f8[_0xba17('0xf')](0x0,0xb)==_0xba17('0x10')){_0x3d0b6b=!![];}if(_0x3d0b6b){_0x336a87['rx']+=_0x3cf4f8+'\x0a';if(_0x3cf4f8[_0xba17('0x11')](_0xba17('0x12'))!=-0x1){_0x3d0b6b=![];}}else{_0x336a87['rx']=_0x3cf4f8;}if(_0x3d0b6b){return;}if(typeof _0x336a87['cb']=='function'){var _0x3ee514=_0x336a87['rx'][_0xba17('0xf')](0x0,0x3),_0x41e866=null,_0x2f1a1c=null;_0x3ee514=parseInt(_0x3ee514);if(isNaN(_0x3ee514)){_0x336a87['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xba17('0x13')});return;}if(_0x3ee514!=0xc8){_0x336a87['cb'](null,{'code':_0x3ee514,'result':-0x1,'extra':'KO'});return;}_0x41e866=_0x336a87['rx']['substring'](0x4)[_0xba17('0x14')](_0xba17('0x15'),'');if(_0x41e866['indexOf']('\x20')!=-0x1){_0x41e866=_0x41e866['substr'](0x0,_0x41e866[_0xba17('0x16')]('\x20'));}if(_['startsWith'](_0x41e866,'-1')){_0x41e866=parseInt(_0x41e866);}_0x2f1a1c=_0x336a87['rx'][_0xba17('0x17')]('\x20');if(_0x2f1a1c[_0xba17('0x18')]==0x3){_0x2f1a1c=_0x2f1a1c[0x2][_0xba17('0xf')](0x1,_0x2f1a1c[0x2][_0xba17('0x18')]-0x1);}else if(_0x2f1a1c[_0xba17('0x18')]>0x3){var _0x14a972=/\((.+)\)/;var _0x405bb9=_0x336a87['rx'][_0xba17('0x19')](_0x14a972);if(_0x405bb9){_0x2f1a1c=_0x405bb9[0x1];}else{_0x2f1a1c=null;}}else{_0x2f1a1c=null;}_0x336a87['cb'](null,{'code':_0x3ee514,'result':_0x41e866,'extra':_0x2f1a1c});}});_0xdea7e['on'](_0xba17('0x1a'),function(_0x27517d){_0xc0ccbe[_0xba17('0xd')](_0xba17('0x1a'),new AGIError(_0xba17('0x1b'),_0x27517d[_0xba17('0x1c')]));});_0xdea7e['on'](_0xba17('0x1d'),function(){_0xc0ccbe[_0xba17('0xd')](_0xba17('0x1d'),new AGIError(_0xba17('0x1e')));});_0xdea7e['on']('timeout',function(){_0xc0ccbe['emit'](_0xba17('0x1f'),new AGIError(_0xba17('0x20')));_0xdea7e[_0xba17('0x21')]();});_0xdea7e[_0xba17('0x22')](_0x398ae8);this[_0xba17('0x23')]=function(_0x2b0a8f,_0xb8dc27){var _0x2b0a8f=_0x2b0a8f||'',_0xb8dc27=typeof _0xb8dc27==_0xba17('0x24')?_0xb8dc27:new Function();_0x336a87={'tx':_0x2b0a8f,'rx':'','cb':_0xb8dc27};_0xdea7e[_0xba17('0x25')](_0x2b0a8f+'\x0a');},this[_0xba17('0x1d')]=function(){_0xdea7e[_0xba17('0x21')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xba17('0x26')][_0xba17('0x27')]=function(_0x509977){return this[_0xba17('0x23')][_0xba17('0x28')](this,_0x509977);};AGIChannel[_0xba17('0x26')][_0xba17('0x29')]=function(){return this['sendRequest']('ANSWER');};AGIChannel['prototype'][_0xba17('0x2a')]=function(_0x2689a2,_0x46305a,_0x19f767){_0x2689a2=_0x2689a2===undefined?_0xba17('0x2b'):_0x2689a2;_0x46305a=_0x46305a===undefined?'5':_0x46305a;_0x19f767=_0x19f767===undefined?'1':_0x19f767;return this[_0xba17('0x27')](util[_0xba17('0x2c')](_0xba17('0x2d'),_0x2689a2,_0x46305a*0x3e8,_0x19f767));};AGIChannel[_0xba17('0x26')][_0xba17('0x2e')]=function(_0xffd2d7){_0xffd2d7=_0xffd2d7||_0xba17('0x2f');return this[_0xba17('0x27')](util[_0xba17('0x2c')]('VERBOSE\x20\x22%s\x22',_0xffd2d7));};AGIChannel['prototype'][_0xba17('0x30')]=function(_0x4ba740,_0x3fffed){if(_[_0xba17('0x31')](_0x3fffed)){return this[_0xba17('0x27')](util['format'](_0xba17('0x32'),_0x4ba740,_0x3fffed[_0xba17('0x33')](',')));}return this['sendRequest'](util['format'](_0xba17('0x32'),_0x4ba740,_0x3fffed));};AGIChannel['prototype'][_0xba17('0x34')]=function(_0xcf3dca){return this['sendRequest'](util[_0xba17('0x2c')](_0xba17('0x35'),_0xcf3dca));};AGIChannel['prototype'][_0xba17('0x36')]=function(_0x16e17){return this[_0xba17('0x27')](util['format'](_0xba17('0x37'),_0x16e17));};AGIChannel['prototype']['setPriority']=function(_0x46bc30){return this['sendRequest'](util[_0xba17('0x2c')]('SET\x20PRIORITY\x20%s',_0x46bc30));};AGIChannel[_0xba17('0x26')][_0xba17('0xe')]=function(){return this['sendRequest'](_0xba17('0x38'));};AGIChannel[_0xba17('0x26')][_0xba17('0x39')]=function(_0x4c997a,_0x46219c){var _0xbd06e3=_[_0xba17('0x3a')](_0x46219c)||_[_0xba17('0x3b')](_0x46219c)?_0x46219c[_0xba17('0x3c')]():_0x46219c;return this[_0xba17('0x27')](util[_0xba17('0x2c')](_0xba17('0x3d'),_0x4c997a,_0xbd06e3?_0xbd06e3[_0xba17('0x3c')]()[_0xba17('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xba17('0x3e')]=function(_0x2f60c5,_0x52dd57){return this['sendRequest'](util[_0xba17('0x2c')](_0xba17('0x3f'),_0x2f60c5,_0x52dd57));};AGIChannel[_0xba17('0x26')]['sayDigits']=function(_0x53fb9b,_0x29604e){return this['sendRequest'](util[_0xba17('0x2c')]('SAY\x20DIGITS\x20%s\x20%s',_0x53fb9b,_0x29604e));};AGIChannel[_0xba17('0x26')][_0xba17('0x40')]=function(_0x1d2fc2,_0x1c8dab){return this[_0xba17('0x27')](util[_0xba17('0x2c')](_0xba17('0x41'),_0x1d2fc2,_0x1c8dab));};AGIChannel[_0xba17('0x26')][_0xba17('0x42')]=function(_0x50bd9c,_0x2b798f,_0x2d1450){_0x2b798f=_0x2b798f||this['extension'];_0x2d1450=_0x2d1450||0x1;this[_0xba17('0x34')](_0x50bd9c);this[_0xba17('0x36')](_0x2b798f);this[_0xba17('0x43')](_0x2d1450);return this[_0xba17('0x2e')](util[_0xba17('0x2c')](_0xba17('0x44'),_0x50bd9c,_0x2b798f,_0x2d1450));};AGIChannel[_0xba17('0x26')]['getVariable']=function(_0x3c24ba){return this[_0xba17('0x27')](util[_0xba17('0x2c')](_0xba17('0x45'),_0x3c24ba));};AGIChannel['prototype'][_0xba17('0x46')]=function(_0x4c20d2,_0x33dece,_0x3252f0,_0x1e8c7e,_0x19a779,_0xc044a1){_0x33dece=_0x33dece||_0xba17('0x47');_0x3252f0=_0x3252f0||'';_0x1e8c7e=_0x1e8c7e===undefined?-0x1:_0x1e8c7e==='-1'?-0x1:_0x1e8c7e*0x3e8;_0x19a779=_0x19a779===undefined?'':'s='+_0x19a779;_0xc044a1=_0xc044a1?_0xba17('0x48'):'';return this[_0xba17('0x27')](util[_0xba17('0x2c')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x4c20d2,_0x33dece,_0x3252f0,_0x1e8c7e,_0xc044a1,_0x19a779));};AGIChannel[_0xba17('0x26')][_0xba17('0x49')]=function(_0x5059e7,_0x2014e8){_0x2014e8=_0x2014e8||'';return this[_0xba17('0x27')](util[_0xba17('0x2c')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x5059e7,_0x2014e8));};AGIChannel[_0xba17('0x26')][_0xba17('0x4a')]=function(_0x1b8109){return this['exec'](_0xba17('0x4b'),_0x1b8109);};AGIChannel[_0xba17('0x26')][_0xba17('0x4c')]=function(_0x53c657){return this['exec'](_0xba17('0x4d'),_0x53c657);};AGIChannel[_0xba17('0x26')][_0xba17('0x1a')]=function(_0x54f323,_0x23924d){this['noop'](util[_0xba17('0x2c')](_0xba17('0x4e'),_0x54f323['id'],_0x54f323['label'],_0x23924d));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xba17('0x4f')]=AGIChannel; \ No newline at end of file +var _0x890b=['util','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','emit','ready','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','indexOf','startsWith','split','length','match','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','close','prototype','sendRequest','sync','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20EXTENSION\x20%s','HANGUP','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setExtension','setPriority','GOTO\x20%s\x20%s\x20%s','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','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s'];(function(_0x33afed,_0x2b3e20){var _0x3c5803=function(_0x1917ed){while(--_0x1917ed){_0x33afed['push'](_0x33afed['shift']());}};_0x3c5803(++_0x2b3e20);}(_0x890b,0x168));var _0xb890=function(_0x3330ab,_0x52aa37){_0x3330ab=_0x3330ab-0x0;var _0x4687ef=_0x890b[_0x3330ab];return _0x4687ef;};'use strict';var util=require(_0xb890('0x0'));var _=require('lodash');var EventEmitter=require(_0xb890('0x1'))[_0xb890('0x2')];var AGIReply=require(_0xb890('0x3'));var AGIError=require(_0xb890('0x4'));function AGIChannel(_0x1246ca){var _0x409b21=this,_0x240155=new AGIReply(),_0x53cfb1=![],_0x523efb={};EventEmitter[_0xb890('0x5')](_0x409b21);_0x1246ca['setEncoding'](_0xb890('0x6'));_0x1246ca[_0xb890('0x7')](0x8*0x3c*0x3c*0x3e8);_0x240155[_0xb890('0x8')]('utf8');_0x240155['on']('headers',function(_0x38175e){for(var _0x23a816 in _0x38175e){_0x409b21[_0x23a816]=_0x38175e[_0x23a816];}_0x409b21[_0xb890('0x9')](_0xb890('0xa'));});_0x240155['on']('line',function(_0x249744){if(_0x249744['toLowerCase']()==_0xb890('0xb')){_0x409b21[_0xb890('0x9')](_0xb890('0xb'));return;}if(_0x249744[_0xb890('0xc')](0x0,0xb)==_0xb890('0xd')){_0x53cfb1=!![];}if(_0x53cfb1){_0x523efb['rx']+=_0x249744+'\x0a';if(_0x249744[_0xb890('0xe')](_0xb890('0xf'))!=-0x1){_0x53cfb1=![];}}else{_0x523efb['rx']=_0x249744;}if(_0x53cfb1){return;}if(typeof _0x523efb['cb']==_0xb890('0x10')){var _0xa89df9=_0x523efb['rx'][_0xb890('0xc')](0x0,0x3),_0x4e2638=null,_0x525fbc=null;_0xa89df9=parseInt(_0xa89df9);if(isNaN(_0xa89df9)){_0x523efb['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xa89df9!=0xc8){_0x523efb['cb'](null,{'code':_0xa89df9,'result':-0x1,'extra':'KO'});return;}_0x4e2638=_0x523efb['rx']['substring'](0x4)[_0xb890('0x11')]('result=','');if(_0x4e2638[_0xb890('0x12')]('\x20')!=-0x1){_0x4e2638=_0x4e2638['substr'](0x0,_0x4e2638[_0xb890('0x12')]('\x20'));}if(_[_0xb890('0x13')](_0x4e2638,'-1')){_0x4e2638=parseInt(_0x4e2638);}_0x525fbc=_0x523efb['rx'][_0xb890('0x14')]('\x20');if(_0x525fbc[_0xb890('0x15')]==0x3){_0x525fbc=_0x525fbc[0x2][_0xb890('0xc')](0x1,_0x525fbc[0x2][_0xb890('0x15')]-0x1);}else if(_0x525fbc[_0xb890('0x15')]>0x3){var _0x46075a=/\((.+)\)/;var _0x365f5c=_0x523efb['rx'][_0xb890('0x16')](_0x46075a);if(_0x365f5c){_0x525fbc=_0x365f5c[0x1];}else{_0x525fbc=null;}}else{_0x525fbc=null;}_0x523efb['cb'](null,{'code':_0xa89df9,'result':_0x4e2638,'extra':_0x525fbc});}});_0x1246ca['on']('error',function(_0x1596bd){_0x409b21[_0xb890('0x9')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x1596bd[_0xb890('0x17')]));});_0x1246ca['on']('close',function(){_0x409b21[_0xb890('0x9')]('close',new AGIError(_0xb890('0x18')));});_0x1246ca['on'](_0xb890('0x19'),function(){_0x409b21[_0xb890('0x9')](_0xb890('0x19'),new AGIError(_0xb890('0x1a')));_0x1246ca[_0xb890('0x1b')]();});_0x1246ca['pipe'](_0x240155);this[_0xb890('0x1c')]=function(_0x4de0be,_0x19b521){var _0x4de0be=_0x4de0be||'',_0x19b521=typeof _0x19b521==_0xb890('0x10')?_0x19b521:new Function();_0x523efb={'tx':_0x4de0be,'rx':'','cb':_0x19b521};_0x1246ca[_0xb890('0x1d')](_0x4de0be+'\x0a');},this[_0xb890('0x1e')]=function(){_0x1246ca[_0xb890('0x1b')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xb890('0x1f')][_0xb890('0x20')]=function(_0x10f11f){return this[_0xb890('0x1c')][_0xb890('0x21')](this,_0x10f11f);};AGIChannel['prototype']['answer']=function(){return this[_0xb890('0x20')]('ANSWER');};AGIChannel['prototype'][_0xb890('0x22')]=function(_0x42570c,_0x52a256,_0x2a2413){_0x42570c=_0x42570c===undefined?_0xb890('0x23'):_0x42570c;_0x52a256=_0x52a256===undefined?'5':_0x52a256;_0x2a2413=_0x2a2413===undefined?'1':_0x2a2413;return this[_0xb890('0x20')](util[_0xb890('0x24')](_0xb890('0x25'),_0x42570c,_0x52a256*0x3e8,_0x2a2413));};AGIChannel['prototype']['noop']=function(_0x4f3e4e){_0x4f3e4e=_0x4f3e4e||_0xb890('0x26');return this[_0xb890('0x20')](util[_0xb890('0x24')](_0xb890('0x27'),_0x4f3e4e));};AGIChannel[_0xb890('0x1f')][_0xb890('0x28')]=function(_0x1b81f9,_0x2be72a){if(_[_0xb890('0x29')](_0x2be72a)){return this['sendRequest'](util[_0xb890('0x24')](_0xb890('0x2a'),_0x1b81f9,_0x2be72a[_0xb890('0x2b')](',')));}return this[_0xb890('0x20')](util['format'](_0xb890('0x2a'),_0x1b81f9,_0x2be72a));};AGIChannel[_0xb890('0x1f')][_0xb890('0x2c')]=function(_0x5c052e){return this[_0xb890('0x20')](util[_0xb890('0x24')]('SET\x20CONTEXT\x20%s',_0x5c052e));};AGIChannel[_0xb890('0x1f')]['setExtension']=function(_0xa5c678){return this['sendRequest'](util[_0xb890('0x24')](_0xb890('0x2d'),_0xa5c678));};AGIChannel[_0xb890('0x1f')]['setPriority']=function(_0x3a2e31){return this['sendRequest'](util[_0xb890('0x24')]('SET\x20PRIORITY\x20%s',_0x3a2e31));};AGIChannel[_0xb890('0x1f')][_0xb890('0xb')]=function(){return this[_0xb890('0x20')](_0xb890('0x2e'));};AGIChannel[_0xb890('0x1f')]['setVariable']=function(_0x4e2181,_0x1f4eec){var _0x19d689=_[_0xb890('0x2f')](_0x1f4eec)||_['isNumber'](_0x1f4eec)?_0x1f4eec[_0xb890('0x30')]():_0x1f4eec;return this[_0xb890('0x20')](util[_0xb890('0x24')](_0xb890('0x31'),_0x4e2181,_0x19d689?_0x19d689[_0xb890('0x30')]()[_0xb890('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xb890('0x1f')][_0xb890('0x32')]=function(_0x54e410,_0x3fcfdf){return this[_0xb890('0x20')](util['format'](_0xb890('0x33'),_0x54e410,_0x3fcfdf));};AGIChannel['prototype'][_0xb890('0x34')]=function(_0x51c1e1,_0x2882b8){return this[_0xb890('0x20')](util['format'](_0xb890('0x35'),_0x51c1e1,_0x2882b8));};AGIChannel[_0xb890('0x1f')][_0xb890('0x36')]=function(_0x238cef,_0x5673d9){return this[_0xb890('0x20')](util[_0xb890('0x24')](_0xb890('0x37'),_0x238cef,_0x5673d9));};AGIChannel[_0xb890('0x1f')]['continueAt']=function(_0x1a3406,_0x2e6672,_0x2f5719){_0x2e6672=_0x2e6672||this[_0xb890('0x38')];_0x2f5719=_0x2f5719||0x1;this[_0xb890('0x2c')](_0x1a3406);this[_0xb890('0x39')](_0x2e6672);this[_0xb890('0x3a')](_0x2f5719);return this['noop'](util[_0xb890('0x24')](_0xb890('0x3b'),_0x1a3406,_0x2e6672,_0x2f5719));};AGIChannel[_0xb890('0x1f')]['getVariable']=function(_0x68a621){return this['sendRequest'](util[_0xb890('0x24')]('GET\x20VARIABLE\x20\x22%s\x22',_0x68a621));};AGIChannel['prototype'][_0xb890('0x3c')]=function(_0x481ef3,_0x38111e,_0x1124f7,_0x5c5b4c,_0x19ee93,_0x402ded){_0x38111e=_0x38111e||_0xb890('0x3d');_0x1124f7=_0x1124f7||'';_0x5c5b4c=_0x5c5b4c===undefined?-0x1:_0x5c5b4c==='-1'?-0x1:_0x5c5b4c*0x3e8;_0x19ee93=_0x19ee93===undefined?'':'s='+_0x19ee93;_0x402ded=_0x402ded?_0xb890('0x3e'):'';return this[_0xb890('0x20')](util[_0xb890('0x24')](_0xb890('0x3f'),_0x481ef3,_0x38111e,_0x1124f7,_0x5c5b4c,_0x402ded,_0x19ee93));};AGIChannel[_0xb890('0x1f')][_0xb890('0x40')]=function(_0x56e260,_0x34bb02){_0x34bb02=_0x34bb02||'';return this[_0xb890('0x20')](util['format'](_0xb890('0x41'),_0x56e260,_0x34bb02));};AGIChannel[_0xb890('0x1f')][_0xb890('0x42')]=function(_0x16d0bb){return this[_0xb890('0x28')](_0xb890('0x43'),_0x16d0bb);};AGIChannel[_0xb890('0x1f')][_0xb890('0x44')]=function(_0xd73568){return this[_0xb890('0x28')](_0xb890('0x45'),_0xd73568);};AGIChannel[_0xb890('0x1f')]['error']=function(_0x43c62c,_0x25a437){this[_0xb890('0x46')](util[_0xb890('0x24')](_0xb890('0x47'),_0x43c62c['id'],_0x43c62c['label'],_0x25a437));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 0f3522a..6dd5a04 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 _0xc8b3=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x38a792,_0x5a21a5){var _0x2cee7b=function(_0x3e9555){while(--_0x3e9555){_0x38a792['push'](_0x38a792['shift']());}};_0x2cee7b(++_0x5a21a5);}(_0xc8b3,0x78));var _0x3c8b=function(_0x47bcee,_0x5c0311){_0x47bcee=_0x47bcee-0x0;var _0x4b88a8=_0xc8b3[_0x47bcee];return _0x4b88a8;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x3c8b('0x0'),'E_AGI_SERVER_ERROR':_0x3c8b('0x1'),'E_AGI_SERVER_CLOSE':_0x3c8b('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x3c8b('0x3'),'E_AGI_SOCKET_ERROR':_0x3c8b('0x4'),'E_AGI_SOCKET_CLOSE':_0x3c8b('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x3c8b('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x3c8b('0x7'),'E_AGI_IVR_ENTRY':_0x3c8b('0x8')};function AGIError(_0x5c005e){var _0x5c005e=_0x5c005e||null,_0x4ad6f6=_0x4ad6f6||[],_0x1710c1=0x1,_0x378630='';if(!error[_0x5c005e]){_0x5c005e=_0x3c8b('0x9');}_0x4ad6f6[_0x3c8b('0xa')](error[_0x5c005e]);while(arguments[_0x1710c1]){_0x4ad6f6[_0x3c8b('0xa')](arguments[_0x1710c1]);_0x1710c1++;}_0x378630=util[_0x3c8b('0xb')][_0x3c8b('0xc')](util,_0x4ad6f6);this[_0x3c8b('0xd')]=_0x378630;this[_0x3c8b('0xe')]=_0x5c005e;}module[_0x3c8b('0xf')]=AGIError; \ No newline at end of file +var _0x591a=['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.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message','name','util','Undefined\x20error.'];(function(_0x2cebc5,_0x5642fb){var _0x4c494b=function(_0xeae8ea){while(--_0xeae8ea){_0x2cebc5['push'](_0x2cebc5['shift']());}};_0x4c494b(++_0x5642fb);}(_0x591a,0x19e));var _0xa591=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0x591a[_0x588011];return _0x3b3773;};'use strict';var util=require(_0xa591('0x0'));var error={'E_AGI_UNDEFINED':_0xa591('0x1'),'E_AGI_ARGUMENT_PORT':_0xa591('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xa591('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xa591('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xa591('0x5'),'E_AGI_SOCKET_ERROR':_0xa591('0x6'),'E_AGI_SOCKET_CLOSE':_0xa591('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xa591('0x8'),'E_AGI_COMMAND_EMPTY':_0xa591('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa591('0xa'),'E_AGI_IVR_ENTRY':_0xa591('0xb')};function AGIError(_0x10ccdb){var _0x10ccdb=_0x10ccdb||null,_0x5113bb=_0x5113bb||[],_0xa42447=0x1,_0x125c02='';if(!error[_0x10ccdb]){_0x10ccdb=_0xa591('0xc');}_0x5113bb[_0xa591('0xd')](error[_0x10ccdb]);while(arguments[_0xa42447]){_0x5113bb['push'](arguments[_0xa42447]);_0xa42447++;}_0x125c02=util['format']['apply'](util,_0x5113bb);this[_0xa591('0xe')]=_0x125c02;this[_0xa591('0xf')]=_0x10ccdb;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 2b97ec6..8b8e9bc 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa354=['subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','lodash','events','EventEmitter','ioredis','./error','redis','localhost'];(function(_0x2e5d14,_0x5049fb){var _0x4dae85=function(_0x3425a1){while(--_0x3425a1){_0x2e5d14['push'](_0x2e5d14['shift']());}};_0x4dae85(++_0x5049fb);}(_0xa354,0x9e));var _0x4a35=function(_0x1be563,_0x31d09a){_0x1be563=_0x1be563-0x0;var _0x58a1b5=_0xa354[_0x1be563];return _0x58a1b5;};'use strict';var _=require(_0x4a35('0x0'));var EventEmitter=require(_0x4a35('0x1'))[_0x4a35('0x2')];var Redis=require(_0x4a35('0x3'));var AGIError=require(_0x4a35('0x4'));var config=require('../../config/environment');config[_0x4a35('0x5')]=_['defaults'](config['redis'],{'host':_0x4a35('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x4a35('0x5')]);sub[_0x4a35('0x7')](_0x4a35('0x8'),function(_0x2afc54){if(_0x2afc54)return eventEmitter[_0x4a35('0x9')](_0x4a35('0xa'),new AGIError(_0x4a35('0xb'),_0x2afc54));});sub['on'](_0x4a35('0xc'),function(_0x37c05a,_0x362c2e){if(_0x37c05a!==_0x4a35('0x8'))return;try{var _0x39cb3a=JSON[_0x4a35('0xd')](_0x362c2e);eventEmitter[_0x4a35('0x9')](_0x4a35('0xe'),_0x39cb3a);}catch(_0x54c0d1){eventEmitter[_0x4a35('0x9')](_0x4a35('0xa'),new AGIError(_0x4a35('0xb'),_0x54c0d1));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xbcaf=['localhost','subscribe','agi','E_AGI_SERVER_ERROR','message','emit','exports','lodash','events','EventEmitter','redis','defaults'];(function(_0x447582,_0x4f4b8a){var _0x7c0741=function(_0x2ef093){while(--_0x2ef093){_0x447582['push'](_0x447582['shift']());}};_0x7c0741(++_0x4f4b8a);}(_0xbcaf,0xf7));var _0xfbca=function(_0x443ea8,_0x5d4752){_0x443ea8=_0x443ea8-0x0;var _0x56fba9=_0xbcaf[_0x443ea8];return _0x56fba9;};'use strict';var _=require(_0xfbca('0x0'));var EventEmitter=require(_0xfbca('0x1'))[_0xfbca('0x2')];var Redis=require('ioredis');var AGIError=require('./error');var config=require('../../config/environment');config[_0xfbca('0x3')]=_[_0xfbca('0x4')](config[_0xfbca('0x3')],{'host':_0xfbca('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xfbca('0x3')]);sub[_0xfbca('0x6')](_0xfbca('0x7'),function(_0x23bc28){if(_0x23bc28)return eventEmitter['emit']('error',new AGIError(_0xfbca('0x8'),_0x23bc28));});sub['on'](_0xfbca('0x9'),function(_0xa13a65,_0xe24266){if(_0xa13a65!==_0xfbca('0x7'))return;try{var _0x45fa59=JSON['parse'](_0xe24266);eventEmitter[_0xfbca('0xa')]('projectUpdate',_0x45fa59);}catch(_0x1ab775){eventEmitter[_0xfbca('0xa')]('error',new AGIError(_0xfbca('0x8'),_0x1ab775));}});module[_0xfbca('0xb')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index ad38f56..56c1bcf 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 _0x8297=['relations','getVertex','info','no\x20vertex\x20found','length','condition','split','agicommand','vswitch','target','default','menu','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','getdigits','vertices','edges','prototype','addVertex','numberOfEdges'];(function(_0x3e4e66,_0x3b38a7){var _0x42f9c7=function(_0x54e0d0){while(--_0x54e0d0){_0x3e4e66['push'](_0x3e4e66['shift']());}};_0x42f9c7(++_0x3b38a7);}(_0x8297,0xfc));var _0x7829=function(_0x556c21,_0x5d8069){_0x556c21=_0x556c21-0x0;var _0x3f4a79=_0x8297[_0x556c21];return _0x3f4a79;};'use strict';var _=require(_0x7829('0x0'));var logger=require('../../../config/logger')(_0x7829('0x1'));var verticesWithRetry=['menu',_0x7829('0x2'),'getsecretdigits'];var Graph=function(){this[_0x7829('0x3')]={};this[_0x7829('0x4')]={};this['numberOfEdges']=0x0;};Graph[_0x7829('0x5')][_0x7829('0x6')]=function(_0x3e0ec8){this[_0x7829('0x3')][_0x3e0ec8['id']]=_0x3e0ec8;this[_0x7829('0x4')][_0x3e0ec8['id']]=[];};Graph[_0x7829('0x5')]['addEdge']=function(_0x525a5e,_0x411954,_0x3f2cc2){this[_0x7829('0x4')][_0x525a5e]['push']({'target':_0x411954,'condition':_0x3f2cc2});this[_0x7829('0x7')]+=0x1;};Graph[_0x7829('0x5')]['size']=function(){return _['size'](this[_0x7829('0x3')]);};Graph[_0x7829('0x5')][_0x7829('0x8')]=function(){return this[_0x7829('0x7')];};Graph['prototype'][_0x7829('0x9')]=function(_0x645a24){return this[_0x7829('0x3')][_0x645a24];};Graph[_0x7829('0x5')]['traverseBFS']=function(_0x4f5692,_0x379528){if(!this['vertices'][_0x4f5692]){return logger[_0x7829('0xa')](_0x7829('0xb'));}var _0x26e973=_0x379528(this[_0x7829('0x3')][_0x4f5692]);if(!_0x26e973){return logger[_0x7829('0xa')]('stop\x20traverse');}if(this[_0x7829('0x4')][_0x4f5692][_0x7829('0xc')]===0x0){return logger[_0x7829('0xa')]('no\x20edge/s\x20available');}for(var _0x19241d=0x0,_0x244347=[],_0x2e03a7=![];_0x19241d\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./project','./events','EventEmitter','projectUpdate','nextTick','error','stack','findIndex','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','name','message','[%s]\x20%s','[ERROR]\x20%s','info','[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','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','substring','debug'];(function(_0x54d08c,_0x1f1651){var _0xeb3bd2=function(_0xc8ced5){while(--_0xc8ced5){_0x54d08c['push'](_0x54d08c['shift']());}};_0xeb3bd2(++_0x1f1651);}(_0x383e,0xcf));var _0xe383=function(_0x305ef1,_0x3e34d2){_0x305ef1=_0x305ef1-0x0;var _0x435124=_0x383e[_0x305ef1];return _0x435124;};'use strict';var _=require(_0xe383('0x0'));var syncho=require(_0xe383('0x1'));var util=require(_0xe383('0x2'));var config=require(_0xe383('0x3'));var logger=require(_0xe383('0x4'))(_0xe383('0x5'));var utilLicense=require(_0xe383('0x6'));var rpc=require('./rpc');var Project=require(_0xe383('0x7'));var AGIEmitter=require(_0xe383('0x8'))[_0xe383('0x9')];var projects=[];config[_0xe383('0x5')]=_['defaults'](config[_0xe383('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xe383('0xa'),projectUpdateHandler);function connectionHandler(_0x406d50){process[_0xe383('0xb')](function(){syncho(function(){try{setChannelVariables(_0x406d50);agiHandler(_0x406d50);}catch(_0x3e77c6){logger[_0xe383('0xc')](_0x3e77c6[_0xe383('0xd')]);}});});}function projectUpdateHandler(_0xbd779c){try{var _0x5ea095=_[_0xe383('0xe')](projects,['id',_0xbd779c['id']]);if(_0x5ea095>-0x1){if(_0xbd779c['deleted']===!![]){projects[_0xe383('0xf')](_0x5ea095,0x1);}else{projects[_0x5ea095]=_0xbd779c;}}else{projects[_0xe383('0x10')](_0xbd779c);}}catch(_0x24c2d4){logger['error'](_0x24c2d4['stack']);}}function listeningHandler(){console[_0xe383('0x11')](_0xe383('0x12'),config['agi'][_0xe383('0x13')]);logger['info'](util[_0xe383('0x14')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0xe383('0x5')][_0xe383('0x13')]));}function errorHandler(_0x1e572c){if(_0x1e572c&&_0x1e572c[_0xe383('0x15')]&&_0x1e572c[_0xe383('0x16')]){logger[_0xe383('0xc')](util[_0xe383('0x14')](_0xe383('0x17'),_0x1e572c[_0xe383('0x15')],_0x1e572c[_0xe383('0x16')]));}else{logger[_0xe383('0xc')](util['format'](_0xe383('0x18'),_0x1e572c[_0xe383('0xd')]));}}function closeHandler(){logger[_0xe383('0x19')](util[_0xe383('0x14')](_0xe383('0x1a'),this[_0xe383('0x1b')],this[_0xe383('0x1c')],this[_0xe383('0x1d')],this[_0xe383('0x1e')],this[_0xe383('0x1f')]));try{createSquareReport(this);}catch(_0x3b9830){logger[_0xe383('0xc')](_0x3b9830['stack']);}}function timeoutHandler(){logger[_0xe383('0x19')](util[_0xe383('0x14')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe383('0x1b')],this[_0xe383('0x1c')],this[_0xe383('0x1d')],this[_0xe383('0x1e')],this['uniqueid']));}function hangupHandler(){logger[_0xe383('0x19')](util[_0xe383('0x14')](_0xe383('0x20'),this['arg_1'],this[_0xe383('0x1c')],this['callerid'],this[_0xe383('0x1e')],this['uniqueid']));this[_0xe383('0x21')]=!![];}function createSquareReport(_0x151540,_0x143616){rpc[_0xe383('0x22')](_0x151540)[_0xe383('0x23')](function(_0x5265f2){if(_0x143616){_0x143616(null,_0x5265f2);}})[_0xe383('0x24')](function(_0xdea85e){if(_0x143616){_0x143616(null,_0xdea85e);}});}function setChannelVariables(_0xa97c7a){for(var _0x5bcd63 in _0xa97c7a){if(_0xa97c7a[_0xe383('0x25')](_0x5bcd63)){if(_0x5bcd63[_0xe383('0x26')]('agi_')===0x0){_0xa97c7a[_0x5bcd63[_0xe383('0x27')](0x4)]=_0xa97c7a[_0x5bcd63];delete _0xa97c7a[_0x5bcd63];}}}}function agiHandler(_0x53b90e){logger[_0xe383('0x28')](_0xe383('0x29'),JSON[_0xe383('0x2a')](_0x53b90e,null,0x2));logger[_0xe383('0x19')](util[_0xe383('0x14')](_0xe383('0x2b'),_0x53b90e[_0xe383('0x1b')],_0x53b90e[_0xe383('0x1c')],_0x53b90e[_0xe383('0x1d')],_0x53b90e[_0xe383('0x1e')],_0x53b90e[_0xe383('0x1f')]));_0x53b90e['on']('error',errorHandler);_0x53b90e['on'](_0xe383('0x2c'),closeHandler);_0x53b90e['on'](_0xe383('0x2d'),timeoutHandler);_0x53b90e[_0xe383('0x21')]=![];_0x53b90e['on'](_0xe383('0x2e'),hangupHandler);var _0x2a7dab=_[_0xe383('0x2f')](projects,[_0xe383('0x15'),_0x53b90e['arg_1']]);if(!_0x2a7dab)return Project[_0xe383('0x30')](_0x53b90e);if(!_0x2a7dab[_0xe383('0x31')])return Project['handleUnpublished'](_0x53b90e);return Project[_0xe383('0x32')](_0x2a7dab,_0x53b90e);}function main(){var _0x3d60e4;return utilLicense[_0xe383('0x33')]()[_0xe383('0x23')](function(_0x20e633){if(!_0x20e633)return;if(_0x20e633[_0xe383('0x34')]){if(_0x20e633['callysquare']&&_0x20e633[_0xe383('0x35')]>0x0){logger[_0xe383('0x19')](util[_0xe383('0x14')](_0xe383('0x36'),_0x20e633['callysquare']));_0x3d60e4=_0x20e633['callysquare'];}else{logger[_0xe383('0x19')](_0xe383('0x37'));}}else{logger[_0xe383('0x19')](_0xe383('0x38'));_0x3d60e4=-0x1;}})['then'](function(){return Project[_0xe383('0x39')]();})['then'](function(_0x27f9ab){projects=_0x27f9ab;return;})[_0xe383('0x24')](function(_0x6489c9){logger[_0xe383('0xc')]('[LICENSE]',_0x6489c9['stack']);})[_0xe383('0x3a')](function(){var _0x31cb68=require(_0xe383('0x3b'))(config[_0xe383('0x5')][_0xe383('0x13')],config['agi']['ip'],_0x3d60e4);_0x31cb68['on'](_0xe383('0xc'),errorHandler);_0x31cb68['on'](_0xe383('0x3c'),listeningHandler);_0x31cb68['on'](_0xe383('0x3d'),connectionHandler);_0x31cb68['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x18c9=['listening','close','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','error','stack','findIndex','splice','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','format','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','substring','debug','variables','stringify','timeout','hangup','find','production','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','./server'];(function(_0x560afd,_0x1674d9){var _0x2f8a72=function(_0x376170){while(--_0x376170){_0x560afd['push'](_0x560afd['shift']());}};_0x2f8a72(++_0x1674d9);}(_0x18c9,0x74));var _0x918c=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x18c9[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0x918c('0x0'));var syncho=require(_0x918c('0x1'));var util=require(_0x918c('0x2'));var config=require(_0x918c('0x3'));var logger=require(_0x918c('0x4'))(_0x918c('0x5'));var utilLicense=require(_0x918c('0x6'));var rpc=require(_0x918c('0x7'));var Project=require(_0x918c('0x8'));var AGIEmitter=require(_0x918c('0x9'))[_0x918c('0xa')];var projects=[];config['agi']=_[_0x918c('0xb')](config['agi'],{'ip':_0x918c('0xc'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x5b96cd){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x5b96cd);agiHandler(_0x5b96cd);}catch(_0x2cf017){logger[_0x918c('0xd')](_0x2cf017[_0x918c('0xe')]);}});});}function projectUpdateHandler(_0x591f25){try{var _0x5baf2e=_[_0x918c('0xf')](projects,['id',_0x591f25['id']]);if(_0x5baf2e>-0x1){if(_0x591f25['deleted']===!![]){projects[_0x918c('0x10')](_0x5baf2e,0x1);}else{projects[_0x5baf2e]=_0x591f25;}}else{projects['push'](_0x591f25);}}catch(_0x224844){logger[_0x918c('0xd')](_0x224844['stack']);}}function listeningHandler(){console[_0x918c('0x11')](_0x918c('0x12'),config['agi'][_0x918c('0x13')]);logger[_0x918c('0x14')](util['format'](_0x918c('0x15'),config[_0x918c('0x5')]['ip'],config['agi'][_0x918c('0x13')]));}function errorHandler(_0x2cbdfc){if(_0x2cbdfc&&_0x2cbdfc[_0x918c('0x16')]&&_0x2cbdfc[_0x918c('0x17')]){logger[_0x918c('0xd')](util['format'](_0x918c('0x18'),_0x2cbdfc[_0x918c('0x16')],_0x2cbdfc[_0x918c('0x17')]));}else{logger['error'](util[_0x918c('0x19')]('[ERROR]\x20%s',_0x2cbdfc[_0x918c('0xe')]));}}function closeHandler(){logger[_0x918c('0x14')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x918c('0x1a')],this[_0x918c('0x1b')],this[_0x918c('0x1c')],this[_0x918c('0x1d')],this[_0x918c('0x1e')]));try{createSquareReport(this);}catch(_0x5c153a){logger[_0x918c('0xd')](_0x5c153a[_0x918c('0xe')]);}}function timeoutHandler(){logger[_0x918c('0x14')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x918c('0x1a')],this[_0x918c('0x1b')],this['callerid'],this[_0x918c('0x1d')],this['uniqueid']));}function hangupHandler(){logger[_0x918c('0x14')](util['format'](_0x918c('0x1f'),this[_0x918c('0x1a')],this[_0x918c('0x1b')],this[_0x918c('0x1c')],this['dnid'],this['uniqueid']));this[_0x918c('0x20')]=!![];}function createSquareReport(_0x1668a3,_0x21659f){rpc[_0x918c('0x21')](_0x1668a3)[_0x918c('0x22')](function(_0x59a78b){if(_0x21659f){_0x21659f(null,_0x59a78b);}})[_0x918c('0x23')](function(_0x3cdb9e){if(_0x21659f){_0x21659f(null,_0x3cdb9e);}});}function setChannelVariables(_0x22525f){for(var _0x4cb8e8 in _0x22525f){if(_0x22525f[_0x918c('0x24')](_0x4cb8e8)){if(_0x4cb8e8['indexOf'](_0x918c('0x25'))===0x0){_0x22525f[_0x4cb8e8[_0x918c('0x26')](0x4)]=_0x22525f[_0x4cb8e8];delete _0x22525f[_0x4cb8e8];}}}}function agiHandler(_0x59f077){logger[_0x918c('0x27')](_0x918c('0x28'),JSON[_0x918c('0x29')](_0x59f077,null,0x2));logger[_0x918c('0x14')](util[_0x918c('0x19')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x59f077[_0x918c('0x1a')],_0x59f077[_0x918c('0x1b')],_0x59f077[_0x918c('0x1c')],_0x59f077[_0x918c('0x1d')],_0x59f077[_0x918c('0x1e')]));_0x59f077['on'](_0x918c('0xd'),errorHandler);_0x59f077['on']('close',closeHandler);_0x59f077['on'](_0x918c('0x2a'),timeoutHandler);_0x59f077[_0x918c('0x20')]=![];_0x59f077['on'](_0x918c('0x2b'),hangupHandler);var _0x2a2735=_[_0x918c('0x2c')](projects,[_0x918c('0x16'),_0x59f077[_0x918c('0x1a')]]);if(!_0x2a2735)return Project['handleNotFound'](_0x59f077);if(!_0x2a2735[_0x918c('0x2d')])return Project[_0x918c('0x2e')](_0x59f077);return Project[_0x918c('0x2f')](_0x2a2735,_0x59f077);}function main(){var _0x5d4542;return utilLicense['getLicense']()[_0x918c('0x22')](function(_0xe9b311){if(!_0xe9b311)return;if(_0xe9b311[_0x918c('0x30')]){if(_0xe9b311[_0x918c('0x31')]&&_0xe9b311[_0x918c('0x31')]>0x0){logger[_0x918c('0x14')](util[_0x918c('0x19')]('[LICENSE]\x20CHANNELS:\x20%s',_0xe9b311[_0x918c('0x31')]));_0x5d4542=_0xe9b311[_0x918c('0x31')];}else{logger[_0x918c('0x14')](_0x918c('0x32'));}}else{logger[_0x918c('0x14')](_0x918c('0x33'));_0x5d4542=-0x1;}})['then'](function(){return Project[_0x918c('0x34')]();})[_0x918c('0x22')](function(_0x3913ea){projects=_0x3913ea;return;})['catch'](function(_0x51fa17){logger[_0x918c('0xd')](_0x918c('0x35'),_0x51fa17['stack']);})['finally'](function(){var _0x59d1d8=require(_0x918c('0x36'))(config[_0x918c('0x5')][_0x918c('0x13')],config[_0x918c('0x5')]['ip'],_0x5d4542);_0x59d1d8['on']('error',errorHandler);_0x59d1d8['on'](_0x918c('0x37'),listeningHandler);_0x59d1d8['on']('connection',connectionHandler);_0x59d1d8['on'](_0x918c('0x38'),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 671f93a..f917f58 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 _0x78c9=['message','result','catch','SendMail','bluebird','http','then','error'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x78c9,0xdc));var _0x978c=function(_0x35359e,_0x3ff854){_0x35359e=_0x35359e-0x0;var _0x4c1942=_0x78c9[_0x35359e];return _0x4c1942;};'use strict';var BPromise=require(_0x978c('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x978c('0x1')]({'port':0x232b});function request(_0x554477,_0x2f3290){return new BPromise(function(_0x559748,_0x1dcac5){return client['request'](_0x554477,_0x2f3290)[_0x978c('0x2')](function(_0xe596c4){if(_0xe596c4[_0x978c('0x3')]){return _0x1dcac5(_0xe596c4[_0x978c('0x3')][_0x978c('0x4')]);}else{return _0x559748(_0xe596c4[_0x978c('0x5')]);}})[_0x978c('0x6')](function(_0x509fab){return _0x1dcac5(_0x509fab);});});}exports['sendMailMessage']=function(_0x531f1f,_0x3dd87c){return request(_0x978c('0x7'),{'account':_0x531f1f,'message':_0x3dd87c});}; \ No newline at end of file +var _0x85ae=['bluebird','jayson/promise','client','then','error','message','result','sendMailMessage','SendMail'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x85ae,0x75));var _0xe85a=function(_0x132613,_0x152bfc){_0x132613=_0x132613-0x0;var _0x5e5119=_0x85ae[_0x132613];return _0x5e5119;};'use strict';var BPromise=require(_0xe85a('0x0'));var jayson=require(_0xe85a('0x1'));var client=jayson[_0xe85a('0x2')]['http']({'port':0x232b});function request(_0x2c1402,_0x5bdd83){return new BPromise(function(_0x86ea95,_0x228577){return client['request'](_0x2c1402,_0x5bdd83)[_0xe85a('0x3')](function(_0xd649bf){if(_0xd649bf[_0xe85a('0x4')]){return _0x228577(_0xd649bf[_0xe85a('0x4')][_0xe85a('0x5')]);}else{return _0x86ea95(_0xd649bf[_0xe85a('0x6')]);}})['catch'](function(_0x1b6a77){return _0x228577(_0x1b6a77);});});}exports[_0xe85a('0x7')]=function(_0x421681,_0x228e80){return request(_0xe85a('0x8'),{'account':_0x421681,'message':_0x228e80});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index c663f86..93b3e70 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3af3=['close','Project\x20%s\x20not\x20found','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','addEdge','value','inspect','start','debug','root','stringify','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','traverseBFS','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','arg_1','callerid','dnid','[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'];(function(_0x2b14da,_0x19b541){var _0xc7e7f=function(_0x4f4de7){while(--_0x4f4de7){_0x2b14da['push'](_0x2b14da['shift']());}};_0xc7e7f(++_0x19b541);}(_0x3af3,0x19f));var _0x33af=function(_0xdbd4f7,_0x4e3bdd){_0xdbd4f7=_0xdbd4f7-0x0;var _0x5c3f9d=_0x3af3[_0xdbd4f7];return _0x5c3f9d;};'use strict';var _=require('lodash');var moment=require(_0x33af('0x0'));var parser=require(_0x33af('0x1'));var util=require(_0x33af('0x2'));var logger=require(_0x33af('0x3'))(_0x33af('0x4'));var rpc=require(_0x33af('0x5'));var mailRpc=require(_0x33af('0x6'));var Graph=require(_0x33af('0x7'));var Vertices=require(_0x33af('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x33af('0x9')]()[_0x33af('0xa')](function(_0x20dd9b){logger[_0x33af('0xb')](_0x33af('0xc'),_0x20dd9b[_0x33af('0xd')]);return[];});}function addVertex(_0x3d2aac,_0x4cc7ad,_0x2761d7){_0x4cc7ad[_0x33af('0xe')]=_0x2761d7;if(_0x4cc7ad[_0x33af('0xf')](_0x33af('0x10'))){_0x4cc7ad[_0x33af('0x11')]=parseInt(_0x4cc7ad[_0x33af('0x10')],0xa);}_0x3d2aac[_0x33af('0x12')](_['omit'](_0x4cc7ad,_0x33af('0x13')));}function initGraph(_0x47b5f0,_0x12629d){var _0x43b176=new Graph();for(var _0x3ee626 in _0x47b5f0){if(_0x47b5f0[_0x33af('0xf')](_0x3ee626)){if(_[_0x33af('0x14')](_0x47b5f0[_0x3ee626])){for(var _0x5d056f=0x0;_0x5d056f<_0x47b5f0[_0x3ee626][_0x33af('0x15')];_0x5d056f+=0x1){addVertex(_0x43b176,_0x47b5f0[_0x3ee626][_0x5d056f],_0x3ee626);}}else{addVertex(_0x43b176,_0x47b5f0[_0x3ee626],_0x3ee626);}}}for(var _0x1ece60=0x0;_0x1ece60<_0x12629d['length'];_0x1ece60+=0x1){if(_0x12629d[_0x1ece60][_0x33af('0x16')]&&_0x12629d[_0x1ece60][_0x33af('0x17')]){_0x43b176[_0x33af('0x18')](_0x12629d[_0x1ece60][_0x33af('0x16')],_0x12629d[_0x1ece60][_0x33af('0x17')],_0x12629d[_0x1ece60][_0x33af('0x19')]);}}return _0x43b176;}function getRoot(_0x4a3b79){return parser['toJson'](_0x4a3b79,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x303542){return util[_0x33af('0x1a')](_0x303542,{'showHidden':![],'depth':null});}function initialize(_0x151913,_0x4cead0){var _0x56bbbd=getRoot(_0x151913['production']);if(!_0x56bbbd||!_0x56bbbd[_0x33af('0x1b')])return;var _0x206a26,_0x404ae7,_0x16c0bf;logger[_0x33af('0x1c')](_0x33af('0x1d'),JSON[_0x33af('0x1e')](_0x56bbbd,null,0x2));_0x4cead0['joinAt']=moment()[_0x33af('0x1f')](_0x33af('0x20'));_0x206a26=initGraph(_['omit'](_0x56bbbd,_0x33af('0x13')),_0x56bbbd[_0x33af('0x13')]);_0x404ae7=new Vertices(_0x4cead0,rpc,mailRpc);logger[_0x33af('0x21')](util['format'](_0x33af('0x22'),_0x4cead0['arg_1'],_0x4cead0[_0x33af('0x23')],_0x4cead0['callerid'],_0x4cead0['dnid'],_0x4cead0[_0x33af('0x24')]));_0x206a26[_0x33af('0x25')](_0x56bbbd[_0x33af('0x1b')]['id'],function(_0x173d13){try{_0x173d13=_0x404ae7[_0x33af('0x26')](_0x173d13);logger[_0x33af('0x1c')](_0x33af('0x27'),JSON[_0x33af('0x1e')](_0x173d13,null,0x2));if(_0x173d13[_0x33af('0xe')]==='gotoc'){logger[_0x33af('0x21')](_0x33af('0x28'));_0x4cead0[_0x33af('0x29')]=_0x173d13[_0x33af('0x29')]||_0x4cead0[_0x33af('0x29')];_0x4cead0[_0x33af('0x2a')]=_0x173d13[_0x33af('0x2a')];_0x4cead0[_0x33af('0x2b')]=_0x173d13[_0x33af('0x2b')]?_0x173d13[_0x33af('0x2b')]-0x1:0x1;return null;}else if(_0x173d13&&_0x404ae7[_0x173d13['agicommand']]){_0x16c0bf=_0x404ae7[_0x173d13[_0x33af('0xe')]](_0x173d13);logger[_0x33af('0x21')](_0x33af('0x2c'),JSON[_0x33af('0x1e')](_0x16c0bf,null,0x2));if(_0x16c0bf&&_0x16c0bf['code']===AGI_CODE_SUCCESS&&_0x16c0bf[_0x33af('0x2d')]!==AGI_RESULT_ERROR&&!_0x4cead0[_0x33af('0x2e')]){logger[_0x33af('0x1c')](_0x33af('0x2c'),inspect(_0x16c0bf));return _[_0x33af('0x2f')](_0x16c0bf['result'])?null:_0x16c0bf[_0x33af('0x2d')][_0x33af('0x30')]();}else{logger['error']('response',inspect(_0x16c0bf));return null;}}else{logger[_0x33af('0xb')](_0x33af('0x31'));return null;}}catch(_0x5a0632){logger[_0x33af('0xb')](_0x5a0632['stack']);return null;}});if(_0x56bbbd[_0x33af('0x32')]){logger['info'](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4cead0[_0x33af('0x33')],_0x4cead0[_0x33af('0x23')],_0x4cead0[_0x33af('0x34')],_0x4cead0[_0x33af('0x35')],_0x4cead0[_0x33af('0x24')]));_0x206a26['traverseBFS'](_0x56bbbd[_0x33af('0x32')]['id'],function(_0x27ab7e){try{_0x27ab7e=_0x404ae7[_0x33af('0x26')](_0x27ab7e);logger[_0x33af('0x1c')](_0x33af('0x27'),JSON[_0x33af('0x1e')](_0x27ab7e,null,0x2));if(_0x27ab7e&&_0x404ae7[_0x27ab7e['agicommand']]){_0x16c0bf=_0x404ae7[_0x27ab7e[_0x33af('0xe')]](_0x27ab7e);if(_0x16c0bf){logger[_0x33af('0x1c')](_0x33af('0x2c'),inspect(_0x16c0bf));return _[_0x33af('0x2f')](_0x16c0bf[_0x33af('0x2d')])?null:_0x16c0bf[_0x33af('0x2d')][_0x33af('0x30')]();}else{logger[_0x33af('0xb')]('response',inspect(_0x16c0bf));return null;}}else{logger[_0x33af('0xb')](_0x33af('0x31'));return null;}}catch(_0x214dc8){logger['error'](_0x214dc8[_0x33af('0xd')]);return null;}});}logger[_0x33af('0x21')](util[_0x33af('0x1f')](_0x33af('0x36'),_0x4cead0['arg_1'],_0x4cead0[_0x33af('0x23')],_0x4cead0[_0x33af('0x34')],_0x4cead0['dnid'],_0x4cead0[_0x33af('0x24')]));logger['info'](util[_0x33af('0x1f')](_0x33af('0x37'),_0x4cead0[_0x33af('0x29')],_0x4cead0[_0x33af('0x2a')],parseInt(_0x4cead0['priority'],0xa)+0x1));_0x4cead0[_0x33af('0x38')](_0x4cead0[_0x33af('0x29')],_0x4cead0['extension'],parseInt(_0x4cead0[_0x33af('0x2b')],0xa)+0x1);_0x4cead0[_0x33af('0x39')]();}function handleNotFound(_0x32cbd3){logger[_0x33af('0xb')](util[_0x33af('0x1f')](_0x33af('0x3a'),_0x32cbd3[_0x33af('0x33')]));_0x32cbd3[_0x33af('0x38')](_0x32cbd3[_0x33af('0x29')],_0x32cbd3[_0x33af('0x2a')],parseInt(_0x32cbd3[_0x33af('0x2b')],0xa)+0x1);_0x32cbd3[_0x33af('0x39')]();}function handleUnpublished(_0x274da5){logger[_0x33af('0xb')](util[_0x33af('0x1f')]('Project\x20%s\x20not\x20published',_0x274da5[_0x33af('0x33')]));_0x274da5['continueAt'](_0x274da5[_0x33af('0x29')],_0x274da5[_0x33af('0x2a')],parseInt(_0x274da5[_0x33af('0x2b')],0xa)+0x1);_0x274da5[_0x33af('0x39')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xfa83=['arg_1','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','context','extension','priority','code','evtHangup','response','isUndefined','result','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','agicommand\x20not\x20found','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','exports','lodash','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','start','debug','stringify','joinAt','format','mxCell','info'];(function(_0x1ece1d,_0x237740){var _0x4fab9a=function(_0x4f7191){while(--_0x4f7191){_0x1ece1d['push'](_0x1ece1d['shift']());}};_0x4fab9a(++_0x237740);}(_0xfa83,0xcf));var _0x3fa8=function(_0x443f17,_0x5b8bb2){_0x443f17=_0x443f17-0x0;var _0x55e267=_0xfa83[_0x443f17];return _0x55e267;};'use strict';var _=require(_0x3fa8('0x0'));var moment=require('moment');var parser=require('xml2json');var util=require('util');var logger=require(_0x3fa8('0x1'))(_0x3fa8('0x2'));var rpc=require(_0x3fa8('0x3'));var mailRpc=require(_0x3fa8('0x4'));var Graph=require(_0x3fa8('0x5'));var Vertices=require(_0x3fa8('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x3fa8('0x7')](function(_0x5dc907){logger[_0x3fa8('0x8')](_0x3fa8('0x9'),_0x5dc907[_0x3fa8('0xa')]);return[];});}function addVertex(_0x32ba39,_0x43af2a,_0x484a2f){_0x43af2a[_0x3fa8('0xb')]=_0x484a2f;if(_0x43af2a[_0x3fa8('0xc')](_0x3fa8('0xd'))){_0x43af2a[_0x3fa8('0xe')]=parseInt(_0x43af2a[_0x3fa8('0xd')],0xa);}_0x32ba39[_0x3fa8('0xf')](_[_0x3fa8('0x10')](_0x43af2a,'mxCell'));}function initGraph(_0x4d2458,_0x44bddf){var _0x6e25d4=new Graph();for(var _0xcc1b2 in _0x4d2458){if(_0x4d2458[_0x3fa8('0xc')](_0xcc1b2)){if(_[_0x3fa8('0x11')](_0x4d2458[_0xcc1b2])){for(var _0x356ead=0x0;_0x356ead<_0x4d2458[_0xcc1b2][_0x3fa8('0x12')];_0x356ead+=0x1){addVertex(_0x6e25d4,_0x4d2458[_0xcc1b2][_0x356ead],_0xcc1b2);}}else{addVertex(_0x6e25d4,_0x4d2458[_0xcc1b2],_0xcc1b2);}}}for(var _0x2c3eb4=0x0;_0x2c3eb4<_0x44bddf[_0x3fa8('0x12')];_0x2c3eb4+=0x1){if(_0x44bddf[_0x2c3eb4][_0x3fa8('0x13')]&&_0x44bddf[_0x2c3eb4][_0x3fa8('0x14')]){_0x6e25d4[_0x3fa8('0x15')](_0x44bddf[_0x2c3eb4][_0x3fa8('0x13')],_0x44bddf[_0x2c3eb4]['target'],_0x44bddf[_0x2c3eb4][_0x3fa8('0x16')]);}}return _0x6e25d4;}function getRoot(_0x3be2a8){return parser[_0x3fa8('0x17')](_0x3be2a8,{'object':!![]})[_0x3fa8('0x18')][_0x3fa8('0x19')];}function inspect(_0xf5ceeb){return util['inspect'](_0xf5ceeb,{'showHidden':![],'depth':null});}function initialize(_0x461288,_0x1b6e96){var _0x1cbc7b=getRoot(_0x461288['production']);if(!_0x1cbc7b||!_0x1cbc7b[_0x3fa8('0x1a')])return;var _0x160e15,_0x431a7a,_0x5f5434;logger[_0x3fa8('0x1b')](_0x3fa8('0x19'),JSON[_0x3fa8('0x1c')](_0x1cbc7b,null,0x2));_0x1b6e96[_0x3fa8('0x1d')]=moment()[_0x3fa8('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');_0x160e15=initGraph(_[_0x3fa8('0x10')](_0x1cbc7b,_0x3fa8('0x1f')),_0x1cbc7b[_0x3fa8('0x1f')]);_0x431a7a=new Vertices(_0x1b6e96,rpc,mailRpc);logger[_0x3fa8('0x20')](util[_0x3fa8('0x1e')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1b6e96[_0x3fa8('0x21')],_0x1b6e96['calleridname'],_0x1b6e96['callerid'],_0x1b6e96[_0x3fa8('0x22')],_0x1b6e96[_0x3fa8('0x23')]));_0x160e15[_0x3fa8('0x24')](_0x1cbc7b['start']['id'],function(_0x50eaea){try{_0x50eaea=_0x431a7a[_0x3fa8('0x25')](_0x50eaea);logger[_0x3fa8('0x1b')](_0x3fa8('0x26'),JSON[_0x3fa8('0x1c')](_0x50eaea,null,0x2));if(_0x50eaea[_0x3fa8('0xb')]===_0x3fa8('0x27')){logger[_0x3fa8('0x20')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x1b6e96['context']=_0x50eaea[_0x3fa8('0x28')]||_0x1b6e96[_0x3fa8('0x28')];_0x1b6e96[_0x3fa8('0x29')]=_0x50eaea[_0x3fa8('0x29')];_0x1b6e96[_0x3fa8('0x2a')]=_0x50eaea[_0x3fa8('0x2a')]?_0x50eaea[_0x3fa8('0x2a')]-0x1:0x1;return null;}else if(_0x50eaea&&_0x431a7a[_0x50eaea[_0x3fa8('0xb')]]){_0x5f5434=_0x431a7a[_0x50eaea[_0x3fa8('0xb')]](_0x50eaea);logger[_0x3fa8('0x20')]('response',JSON['stringify'](_0x5f5434,null,0x2));if(_0x5f5434&&_0x5f5434[_0x3fa8('0x2b')]===AGI_CODE_SUCCESS&&_0x5f5434['result']!==AGI_RESULT_ERROR&&!_0x1b6e96[_0x3fa8('0x2c')]){logger['debug'](_0x3fa8('0x2d'),inspect(_0x5f5434));return _[_0x3fa8('0x2e')](_0x5f5434[_0x3fa8('0x2f')])?null:_0x5f5434[_0x3fa8('0x2f')][_0x3fa8('0x30')]();}else{logger['error'](_0x3fa8('0x2d'),inspect(_0x5f5434));return null;}}else{logger[_0x3fa8('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x3c4ba5){logger['error'](_0x3c4ba5['stack']);return null;}});if(_0x1cbc7b[_0x3fa8('0x31')]){logger['info'](util[_0x3fa8('0x1e')](_0x3fa8('0x32'),_0x1b6e96[_0x3fa8('0x21')],_0x1b6e96[_0x3fa8('0x33')],_0x1b6e96[_0x3fa8('0x34')],_0x1b6e96[_0x3fa8('0x22')],_0x1b6e96[_0x3fa8('0x23')]));_0x160e15['traverseBFS'](_0x1cbc7b[_0x3fa8('0x31')]['id'],function(_0x44dd09){try{_0x44dd09=_0x431a7a['clear'](_0x44dd09);logger[_0x3fa8('0x1b')](_0x3fa8('0x26'),JSON[_0x3fa8('0x1c')](_0x44dd09,null,0x2));if(_0x44dd09&&_0x431a7a[_0x44dd09[_0x3fa8('0xb')]]){_0x5f5434=_0x431a7a[_0x44dd09['agicommand']](_0x44dd09);if(_0x5f5434){logger[_0x3fa8('0x1b')](_0x3fa8('0x2d'),inspect(_0x5f5434));return _[_0x3fa8('0x2e')](_0x5f5434[_0x3fa8('0x2f')])?null:_0x5f5434[_0x3fa8('0x2f')][_0x3fa8('0x30')]();}else{logger['error'](_0x3fa8('0x2d'),inspect(_0x5f5434));return null;}}else{logger[_0x3fa8('0x8')](_0x3fa8('0x35'));return null;}}catch(_0x55de78){logger['error'](_0x55de78[_0x3fa8('0xa')]);return null;}});}logger[_0x3fa8('0x20')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1b6e96[_0x3fa8('0x21')],_0x1b6e96[_0x3fa8('0x33')],_0x1b6e96['callerid'],_0x1b6e96[_0x3fa8('0x22')],_0x1b6e96['uniqueid']));logger[_0x3fa8('0x20')](util[_0x3fa8('0x1e')](_0x3fa8('0x36'),_0x1b6e96['context'],_0x1b6e96[_0x3fa8('0x29')],parseInt(_0x1b6e96['priority'],0xa)+0x1));_0x1b6e96[_0x3fa8('0x37')](_0x1b6e96['context'],_0x1b6e96[_0x3fa8('0x29')],parseInt(_0x1b6e96[_0x3fa8('0x2a')],0xa)+0x1);_0x1b6e96['close']();}function handleNotFound(_0x1b1ebb){logger[_0x3fa8('0x8')](util[_0x3fa8('0x1e')](_0x3fa8('0x38'),_0x1b1ebb[_0x3fa8('0x21')]));_0x1b1ebb[_0x3fa8('0x37')](_0x1b1ebb[_0x3fa8('0x28')],_0x1b1ebb[_0x3fa8('0x29')],parseInt(_0x1b1ebb['priority'],0xa)+0x1);_0x1b1ebb[_0x3fa8('0x39')]();}function handleUnpublished(_0x47af9c){logger[_0x3fa8('0x8')](util[_0x3fa8('0x1e')](_0x3fa8('0x3a'),_0x47af9c[_0x3fa8('0x21')]));_0x47af9c['continueAt'](_0x47af9c[_0x3fa8('0x28')],_0x47af9c[_0x3fa8('0x29')],parseInt(_0x47af9c[_0x3fa8('0x2a')],0xa)+0x1);_0x47af9c[_0x3fa8('0x39')]();}module[_0x3fa8('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 2e442b9..3baf320 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 _0x00ff=['call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','trim','slice','headers','emit','line','exports','util','stream','Transform'];(function(_0x82f96c,_0x2dc04b){var _0x5e5322=function(_0x328df4){while(--_0x328df4){_0x82f96c['push'](_0x82f96c['shift']());}};_0x5e5322(++_0x2dc04b);}(_0x00ff,0x177));var _0xf00f=function(_0x10d857,_0x2f001f){_0x10d857=_0x10d857-0x0;var _0xfdd812=_0x00ff[_0x10d857];return _0xfdd812;};'use strict';var util=require(_0xf00f('0x0'));var Transform=require(_0xf00f('0x1'))[_0xf00f('0x2')];function AGIReply(_0x5a47e1){Transform[_0xf00f('0x3')](this,_0x5a47e1);this[_0xf00f('0x4')]='';this[_0xf00f('0x5')]=![];}util[_0xf00f('0x6')](AGIReply,Transform);AGIReply[_0xf00f('0x7')][_0xf00f('0x8')]=function(_0x1c7e5b,_0x2011b0,_0x25d7c5){var _0x22cc92='\x0a',_0x762446=['\x0a\x0a',_0xf00f('0x9')],_0x56220e=-0x1,_0x11b050=-0x1,_0x55df4d='',_0x1392f9=0x0,_0x4f78f2='',_0x180ca1='';this[_0xf00f('0x4')]+=_0x1c7e5b[_0xf00f('0xa')]();_0x4f78f2=this[_0xf00f('0x4')];if(!this['_inBody']){_0x1392f9=0x0;while(_0x762446[_0x1392f9]){while((_0x11b050=_0x4f78f2[_0xf00f('0xb')](_0x762446[_0x1392f9]))!=-0x1){_0x55df4d=_0x762446[_0x1392f9];_0x180ca1=_0x4f78f2[_0xf00f('0xc')](0x0,_0x11b050);_0x4f78f2=_0x4f78f2['substring'](_0x11b050+_0x55df4d[_0xf00f('0xd')]);var _0x355c5b=_0x180ca1[_0xf00f('0xe')](_0x22cc92),_0x22685f=0x0,_0x336825={},_0x156864='',_0x1e6763='',_0x472fda=-0x1;while(_0x355c5b[_0x22685f]){_0x472fda=_0x355c5b[_0x22685f][_0xf00f('0xb')](':');if(_0x472fda!=-0x1){_0x156864=_0x355c5b[_0x22685f]['slice'](0x0,_0x472fda)[_0xf00f('0xf')]();_0x1e6763=_0x355c5b[_0x22685f][_0xf00f('0x10')](_0x472fda+0x1)[_0xf00f('0xf')]();if(_0x156864['length']>0x0){_0x336825[_0x156864]=_0x1e6763;}}else{}_0x22685f++;}this['emit'](_0xf00f('0x11'),_0x336825);this[_0xf00f('0x5')]=!![];}_0x1392f9++;}this[_0xf00f('0x4')]=_0x4f78f2;}else{while((_0x56220e=_0x4f78f2[_0xf00f('0xb')](_0x22cc92))!=-0x1){_0x180ca1=_0x4f78f2[_0xf00f('0xc')](0x0,_0x56220e);this[_0xf00f('0x12')](_0xf00f('0x13'),_0x180ca1);_0x4f78f2=_0x4f78f2[_0xf00f('0xc')](_0x56220e+_0x22cc92['length']);}this['_localBuffer']=_0x4f78f2;}_0x25d7c5();};module[_0xf00f('0x14')]=AGIReply; \ No newline at end of file +var _0x54af=['slice','trim','emit','headers','line','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split'];(function(_0x30b8b6,_0x547092){var _0x19fe09=function(_0x176b47){while(--_0x176b47){_0x30b8b6['push'](_0x30b8b6['shift']());}};_0x19fe09(++_0x547092);}(_0x54af,0xb9));var _0xf54a=function(_0x2bfacc,_0xb488d7){_0x2bfacc=_0x2bfacc-0x0;var _0x5acca4=_0x54af[_0x2bfacc];return _0x5acca4;};'use strict';var util=require('util');var Transform=require('stream')[_0xf54a('0x0')];function AGIReply(_0x2c63e4){Transform[_0xf54a('0x1')](this,_0x2c63e4);this[_0xf54a('0x2')]='';this[_0xf54a('0x3')]=![];}util[_0xf54a('0x4')](AGIReply,Transform);AGIReply[_0xf54a('0x5')][_0xf54a('0x6')]=function(_0x50e8ff,_0x4c4de6,_0x16ca4b){var _0x452730='\x0a',_0x1df090=['\x0a\x0a',_0xf54a('0x7')],_0x460868=-0x1,_0x3a1ba2=-0x1,_0x3e6255='',_0x32c78b=0x0,_0x5a1ae2='',_0x23adbf='';this[_0xf54a('0x2')]+=_0x50e8ff[_0xf54a('0x8')]();_0x5a1ae2=this[_0xf54a('0x2')];if(!this[_0xf54a('0x3')]){_0x32c78b=0x0;while(_0x1df090[_0x32c78b]){while((_0x3a1ba2=_0x5a1ae2[_0xf54a('0x9')](_0x1df090[_0x32c78b]))!=-0x1){_0x3e6255=_0x1df090[_0x32c78b];_0x23adbf=_0x5a1ae2[_0xf54a('0xa')](0x0,_0x3a1ba2);_0x5a1ae2=_0x5a1ae2[_0xf54a('0xa')](_0x3a1ba2+_0x3e6255[_0xf54a('0xb')]);var _0x170173=_0x23adbf[_0xf54a('0xc')](_0x452730),_0xcf4e9f=0x0,_0x3cac45={},_0x1378f8='',_0x1d0469='',_0x56bbc9=-0x1;while(_0x170173[_0xcf4e9f]){_0x56bbc9=_0x170173[_0xcf4e9f]['indexOf'](':');if(_0x56bbc9!=-0x1){_0x1378f8=_0x170173[_0xcf4e9f][_0xf54a('0xd')](0x0,_0x56bbc9)[_0xf54a('0xe')]();_0x1d0469=_0x170173[_0xcf4e9f][_0xf54a('0xd')](_0x56bbc9+0x1)[_0xf54a('0xe')]();if(_0x1378f8[_0xf54a('0xb')]>0x0){_0x3cac45[_0x1378f8]=_0x1d0469;}}else{}_0xcf4e9f++;}this[_0xf54a('0xf')](_0xf54a('0x10'),_0x3cac45);this[_0xf54a('0x3')]=!![];}_0x32c78b++;}this[_0xf54a('0x2')]=_0x5a1ae2;}else{while((_0x460868=_0x5a1ae2[_0xf54a('0x9')](_0x452730))!=-0x1){_0x23adbf=_0x5a1ae2[_0xf54a('0xa')](0x0,_0x460868);this['emit'](_0xf54a('0x11'),_0x23adbf);_0x5a1ae2=_0x5a1ae2[_0xf54a('0xa')](_0x460868+_0x452730[_0xf54a('0xb')]);}this['_localBuffer']=_0x5a1ae2;}_0x16ca4b();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 93e3e7b..6e46bae 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 _0xf4dd=['getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','then','error','message','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production'];(function(_0x191c44,_0x20a896){var _0x1086cd=function(_0x2e2cac){while(--_0x2e2cac){_0x191c44['push'](_0x191c44['shift']());}};_0x1086cd(++_0x20a896);}(_0xf4dd,0xb4));var _0xdf4d=function(_0x39bc58,_0x27a34e){_0x39bc58=_0x39bc58-0x0;var _0x42b508=_0xf4dd[_0x39bc58];return _0x42b508;};'use strict';var _=require(_0xdf4d('0x0'));var moment=require(_0xdf4d('0x1'));var jayson=require(_0xdf4d('0x2'));var client=jayson[_0xdf4d('0x3')][_0xdf4d('0x4')]({'port':0x2329});function request(_0x3f6a00,_0x309103){return new Promise(function(_0x47d568,_0x1974da){return client['request'](_0x3f6a00,_0x309103)[_0xdf4d('0x5')](function(_0x58fc81){if(_0x58fc81[_0xdf4d('0x6')]){return _0x1974da(_0x58fc81['error'][_0xdf4d('0x7')]);}else{return _0x47d568(_0x58fc81['result']);}})[_0xdf4d('0x8')](function(_0x4a3e29){return _0x1974da(_0x4a3e29);});});}exports[_0xdf4d('0x9')]=function(){return request(_0xdf4d('0xa'),{'options':{'raw':![],'attributes':['id',_0xdf4d('0xb'),'production']}});};exports[_0xdf4d('0xc')]=function(_0x2a36e8){return request(_0xdf4d('0xd'),{'options':{'raw':![],'where':{'name':_0x2a36e8},'attributes':[_0xdf4d('0xe')]}});};exports[_0xdf4d('0xf')]=function(_0x2e2962){return request(_0xdf4d('0x10'),{'options':{'raw':![],'where':{'id':_0x2e2962},'include':[{'model':_0xdf4d('0x11'),'as':_0xdf4d('0x12'),'include':[{'model':'CloudProvider','as':_0xdf4d('0x13')}]}],'attributes':['id',_0xdf4d('0xb'),_0xdf4d('0x14')],'smtp':!![]}});};exports[_0xdf4d('0x15')]=function(_0x150bbf){return request(_0xdf4d('0xd'),{'options':{'where':{'id':_0x150bbf},'attributes':[_0xdf4d('0xb')]}});};exports[_0xdf4d('0x16')]=function(_0x380d5c){return request(_0xdf4d('0x17'),{'options':{'where':{'id':_0x380d5c},'attributes':[_0xdf4d('0xb')]}});};exports[_0xdf4d('0x18')]=function(_0x3925e4){return request(_0xdf4d('0x19'),{'options':{'where':{'id':_0x3925e4},'attributes':[_0xdf4d('0xb')]}});};exports[_0xdf4d('0x1a')]=function(_0x28a8ad){return request(_0xdf4d('0x1b'),{'options':{'where':{'id':_0x28a8ad},'attributes':[_0xdf4d('0x1c')]}});};exports['getUserById']=function(_0x49f737){return request(_0xdf4d('0x1d'),{'options':{'where':{'id':_0x49f737},'attributes':[_0xdf4d('0xb')]}});};exports['getContactByPhone']=function(_0x4e02f8){return request('GetContactByPhone',{'options':{'where':{'phone':_0x4e02f8['phone']},'attributes':['id']}});};exports[_0xdf4d('0x1e')]=function(_0x506cc2){return request(_0xdf4d('0x1f'),{'options':{'where':{'id':_0x506cc2},'attributes':[_0xdf4d('0xb')]}});};exports[_0xdf4d('0x20')]=function(_0x59cd6f){return request(_0xdf4d('0x21'),{'options':{'where':{'id':_0x59cd6f},'attributes':[_0xdf4d('0x22')]}});};exports[_0xdf4d('0x23')]=function(_0x2f44da){return request(_0xdf4d('0x24'),{'options':{'raw':![],'where':{'id':_0x2f44da},'include':[{'model':_0xdf4d('0x25'),'as':_0xdf4d('0x26')}]}});};exports[_0xdf4d('0x27')]=function(_0x176aad){return request(_0xdf4d('0x28'),{'options':{'where':{'id':_0x176aad},'attributes':['id',_0xdf4d('0xb')]}});};exports[_0xdf4d('0x29')]=function(_0x3c67c4){return request(_0xdf4d('0x2a'),{'body':_0x3c67c4});};exports[_0xdf4d('0x2b')]=function(_0x546cc6){return request(_0xdf4d('0x2c'),{'body':_0x546cc6});};exports['createSquareReport']=function(_0x24db8a){return request('CreateSquareReport',{'body':_[_0xdf4d('0x2d')](_0x24db8a,{'project_name':_0x24db8a['arg_1'],'prev_project_name':_0x24db8a['arg_2']||'','is_subproject':_0x24db8a[_0xdf4d('0x2e')]?!![]:![],'leaveAt':moment()[_0xdf4d('0x2f')](_0xdf4d('0x30'))})});};exports[_0xdf4d('0x31')]=function(_0x58edf7){return request(_0xdf4d('0x32'),{'body':_0x58edf7});};exports[_0xdf4d('0x33')]=function(_0x4410e5){return request(_0xdf4d('0x34'),{'body':_0x4410e5});};exports['createCmContact']=function(_0x46d140){return request(_0xdf4d('0x35'),{'options':{'raw':![],'where':{'phone':_0x46d140[_0xdf4d('0x36')],'ListId':_0x46d140[_0xdf4d('0x37')]}}})[_0xdf4d('0x5')](function(_0xccf69d){if(_0xccf69d){return _0xccf69d;}return request('CreateCmContact',{'body':_0x46d140});});};exports[_0xdf4d('0x38')]=function(_0x1cb5f9){return request(_0xdf4d('0x39'),{'options':{'where':{'id':_0x1cb5f9},'attributes':[_0xdf4d('0xb')]}});};exports[_0xdf4d('0x3a')]=function(_0x5ea760,_0x5c6462){return request(_0xdf4d('0x3b'),{'body':{'interface':_0x5c6462},'options':{'where':_0x5ea760}});};exports[_0xdf4d('0x3c')]=function(_0xdb5acc,_0x4560b9,_0x35c0f5){return request('PauseUser',{'body':{'type':_0x4560b9,'uniqueid':_0x35c0f5},'options':{'where':_0xdb5acc}});};exports[_0xdf4d('0x3d')]=function(_0x37d424){return request(_0xdf4d('0x3e'),{'body':{},'options':{'where':_0x37d424}});};exports[_0xdf4d('0x3f')]=function(_0x3e86f2){return request(_0xdf4d('0x40'),{'body':{},'options':{'where':_0x3e86f2}});}; \ No newline at end of file +var _0x6737=['LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','http','request','then','error','getSquareProjects','name','production','ShowSquareProject','ShowMailAccount','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','GetContactByPhone','phone','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','agentLogin'];(function(_0x297e02,_0x16e710){var _0x3cf984=function(_0x4de442){while(--_0x4de442){_0x297e02['push'](_0x297e02['shift']());}};_0x3cf984(++_0x16e710);}(_0x6737,0xe2));var _0x7673=function(_0x1a7ce7,_0x3fbeba){_0x1a7ce7=_0x1a7ce7-0x0;var _0x508515=_0x6737[_0x1a7ce7];return _0x508515;};'use strict';var _=require('lodash');var moment=require(_0x7673('0x0'));var jayson=require(_0x7673('0x1'));var client=jayson['client'][_0x7673('0x2')]({'port':0x2329});function request(_0x2a9cd0,_0x43ee27){return new Promise(function(_0x12efff,_0x54002e){return client[_0x7673('0x3')](_0x2a9cd0,_0x43ee27)[_0x7673('0x4')](function(_0x543b61){if(_0x543b61[_0x7673('0x5')]){return _0x54002e(_0x543b61[_0x7673('0x5')]['message']);}else{return _0x12efff(_0x543b61['result']);}})['catch'](function(_0x5292f7){return _0x54002e(_0x5292f7);});});}exports[_0x7673('0x6')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x7673('0x7'),_0x7673('0x8')]}});};exports['getSquareProject']=function(_0x29fdbc){return request(_0x7673('0x9'),{'options':{'raw':![],'where':{'name':_0x29fdbc},'attributes':[_0x7673('0x8')]}});};exports['getMailAccountById']=function(_0x49fcb2){return request(_0x7673('0xa'),{'options':{'raw':![],'where':{'id':_0x49fcb2},'include':[{'model':'MailServerOut','as':_0x7673('0xb'),'include':[{'model':_0x7673('0xc'),'as':_0x7673('0xc')}]}],'attributes':['id',_0x7673('0x7'),_0x7673('0xd')],'smtp':!![]}});};exports[_0x7673('0xe')]=function(_0x1c57a5){return request(_0x7673('0x9'),{'options':{'where':{'id':_0x1c57a5},'attributes':[_0x7673('0x7')]}});};exports[_0x7673('0xf')]=function(_0x5c8626){return request(_0x7673('0x10'),{'options':{'where':{'id':_0x5c8626},'attributes':[_0x7673('0x7')]}});};exports[_0x7673('0x11')]=function(_0x2c83d){return request(_0x7673('0x12'),{'options':{'where':{'id':_0x2c83d},'attributes':[_0x7673('0x7')]}});};exports[_0x7673('0x13')]=function(_0x4a8ea0){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x4a8ea0},'attributes':[_0x7673('0x14')]}});};exports[_0x7673('0x15')]=function(_0x50f8d9){return request(_0x7673('0x16'),{'options':{'where':{'id':_0x50f8d9},'attributes':[_0x7673('0x7')]}});};exports['getContactByPhone']=function(_0x33ff7d){return request(_0x7673('0x17'),{'options':{'where':{'phone':_0x33ff7d[_0x7673('0x18')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x50f22d){return request(_0x7673('0x19'),{'options':{'where':{'id':_0x50f22d},'attributes':[_0x7673('0x7')]}});};exports['getSoundById']=function(_0x17c564){return request(_0x7673('0x1a'),{'options':{'where':{'id':_0x17c564},'attributes':[_0x7673('0x1b')]}});};exports[_0x7673('0x1c')]=function(_0x4245bf){return request(_0x7673('0x1d'),{'options':{'raw':![],'where':{'id':_0x4245bf},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x7673('0x1e')]=function(_0x21774f){return request(_0x7673('0x1f'),{'options':{'where':{'id':_0x21774f},'attributes':['id',_0x7673('0x7')]}});};exports[_0x7673('0x20')]=function(_0x54f38d){return request(_0x7673('0x21'),{'body':_0x54f38d});};exports[_0x7673('0x22')]=function(_0x714e63){return request(_0x7673('0x23'),{'body':_0x714e63});};exports[_0x7673('0x24')]=function(_0x30c42e){return request('CreateSquareReport',{'body':_[_0x7673('0x25')](_0x30c42e,{'project_name':_0x30c42e[_0x7673('0x26')],'prev_project_name':_0x30c42e[_0x7673('0x27')]||'','is_subproject':_0x30c42e[_0x7673('0x27')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x7673('0x28')]=function(_0x11b42b){return request(_0x7673('0x29'),{'body':_0x11b42b});};exports[_0x7673('0x2a')]=function(_0x119a21){return request(_0x7673('0x2b'),{'body':_0x119a21});};exports[_0x7673('0x2c')]=function(_0x5a59f9){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x5a59f9[_0x7673('0x18')],'ListId':_0x5a59f9[_0x7673('0x2d')]}}})[_0x7673('0x4')](function(_0x335743){if(_0x335743){return _0x335743;}return request(_0x7673('0x2e'),{'body':_0x5a59f9});});};exports[_0x7673('0x2f')]=function(_0x224122){return request('ShowPause',{'options':{'where':{'id':_0x224122},'attributes':['name']}});};exports[_0x7673('0x30')]=function(_0x36c841,_0x268863){return request(_0x7673('0x31'),{'body':{'interface':_0x268863},'options':{'where':_0x36c841}});};exports['agentPause']=function(_0x3aa249,_0x497760,_0x15f6a7){return request(_0x7673('0x32'),{'body':{'type':_0x497760,'uniqueid':_0x15f6a7},'options':{'where':_0x3aa249}});};exports[_0x7673('0x33')]=function(_0x1b924f){return request(_0x7673('0x34'),{'body':{},'options':{'where':_0x1b924f}});};exports[_0x7673('0x35')]=function(_0x2cb973){return request(_0x7673('0x36'),{'body':{},'options':{'where':_0x2cb973}});}; \ 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 11a1d04..9034704 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 _0x6363=['./polly','exports'];(function(_0x27729d,_0x2a42cb){var _0x541360=function(_0xaa25eb){while(--_0xaa25eb){_0x27729d['push'](_0x27729d['shift']());}};_0x541360(++_0x2a42cb);}(_0x6363,0x13a));var _0x3636=function(_0x45ae37,_0x2c2874){_0x45ae37=_0x45ae37-0x0;var _0x59c9f2=_0x6363[_0x45ae37];return _0x59c9f2;};var polly=require(_0x3636('0x0'));var lex=require('./lex');module[_0x3636('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x96f1=['exports','./polly','./lex'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x96f1,0x19c));var _0x196f=function(_0x1d9bf9,_0x453603){_0x1d9bf9=_0x1d9bf9-0x0;var _0x3c3eea=_0x96f1[_0x1d9bf9];return _0x3c3eea;};var polly=require(_0x196f('0x0'));var lex=require(_0x196f('0x1'));module[_0x196f('0x2')]={'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 6c6d4a1..1650c46 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x352a8d,_0x2a91b2,_0x4611be,_0x20aa4b,_0x447096,_0x192d48){return lex(_0x352a8d,_0x2a91b2,_0x4611be,_0x20aa4b,_0x447096,_0x192d48);}; \ No newline at end of file +var _0x41bb=['exports','./lib/api'];(function(_0x47c53d,_0x15951f){var _0x1ddaee=function(_0x5765c0){while(--_0x5765c0){_0x47c53d['push'](_0x47c53d['shift']());}};_0x1ddaee(++_0x15951f);}(_0x41bb,0xc5));var _0xb41b=function(_0x14d8e5,_0x125502){_0x14d8e5=_0x14d8e5-0x0;var _0x4f36d8=_0x41bb[_0x14d8e5];return _0x4f36d8;};'use strict';var lex=require(_0xb41b('0x0'));module[_0xb41b('0x1')]=function(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333){return lex(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333);}; \ 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 7e5989d..ac39031 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(_0x20cc6f,_0x29dd31){var _0x211082=function(_0x3eac7f){while(--_0x3eac7f){_0x20cc6f['push'](_0x20cc6f['shift']());}};_0x211082(++_0x29dd31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x282a5b,_0xafe17e){var _0x3b5809=function(_0x4996f9){while(--_0x4996f9){_0x282a5b['push'](_0x282a5b['shift']());}};_0x3b5809(++_0xafe17e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 a49afe9..caf6e51 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 _0x9302=['exports','./lib/api'];(function(_0x1bede6,_0x569721){var _0x4ef965=function(_0x365a88){while(--_0x365a88){_0x1bede6['push'](_0x1bede6['shift']());}};_0x4ef965(++_0x569721);}(_0x9302,0x145));var _0x2930=function(_0x69cf2c,_0x209feb){_0x69cf2c=_0x69cf2c-0x0;var _0x5a0817=_0x9302[_0x69cf2c];return _0x5a0817;};'use strict';var polly=require(_0x2930('0x0'));module[_0x2930('0x1')]=function(_0x41b4ca,_0x1360c4,_0x547596,_0x3a5148,_0x5248e0,_0x378543,_0x490ca5){return polly(_0x41b4ca,_0x1360c4,_0x547596,_0x3a5148,_0x5248e0,_0x378543,_0x490ca5);}; \ No newline at end of file +var _0x9e23=['./lib/api','exports'];(function(_0x5a727b,_0x39ad5a){var _0x876ec2=function(_0x5b09ea){while(--_0x5b09ea){_0x5a727b['push'](_0x5a727b['shift']());}};_0x876ec2(++_0x39ad5a);}(_0x9e23,0x192));var _0x39e2=function(_0x3273b9,_0x51c831){_0x3273b9=_0x3273b9-0x0;var _0x9a80d9=_0x9e23[_0x3273b9];return _0x9a80d9;};'use strict';var polly=require(_0x39e2('0x0'));module[_0x39e2('0x1')]=function(_0x3649c6,_0x162a8b,_0x108732,_0x247b5c,_0x1d524d,_0x46a8ca,_0x3af074){return polly(_0x3649c6,_0x162a8b,_0x108732,_0x247b5c,_0x1d524d,_0x46a8ca,_0x3af074);}; \ 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 b8d5555..50caaeb 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 _0x892f=['exports','text','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x4f5494,_0x320bb1){var _0x2529d9=function(_0x528b16){while(--_0x528b16){_0x4f5494['push'](_0x4f5494['shift']());}};_0x2529d9(++_0x320bb1);}(_0x892f,0xb3));var _0xf892=function(_0x18a8a6,_0x805f30){_0x18a8a6=_0x18a8a6-0x0;var _0x3574a5=_0x892f[_0x18a8a6];return _0x3574a5;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xf892('0x0'));var rs=require(_0xf892('0x1'));var AWS=require(_0xf892('0x2'));function pollyResult(_0x432571,_0x559de9,_0x580953){return new BPromise(function(_0x398b80,_0x17f813){_0x432571[_0xf892('0x3')](_0x559de9,function(_0x526474,_0x58b872){if(_0x526474){_0x17f813(_0x526474);}else if(_0x58b872){if(_0x58b872[_0xf892('0x4')]instanceof Buffer){fs[_0xf892('0x5')](_0x580953,_0x58b872[_0xf892('0x4')],function(_0x88c1c7){if(_0x88c1c7){_0x17f813(_0x88c1c7);}else{_0x398b80();}});}else{_0x17f813(new Error(_0xf892('0x6')));}}else{_0x17f813(new Error(_0xf892('0x7')));}});});}module[_0xf892('0x8')]=function(_0x2a47ad,_0x38d39b,_0x10321f,_0x36b965,_0x34a874,_0x2eadbb,_0xdf5d0e){var _0x3da17b=new AWS['Polly']({'accessKeyId':_0x2a47ad,'secretAccessKey':_0x38d39b,'region':_0x10321f});var _0x53d631={'Text':_0x34a874,'TextType':_0x2eadbb||_0xf892('0x9'),'OutputFormat':_0xf892('0xa'),'VoiceId':_0x36b965};return pollyResult(_0x3da17b,_0x53d631,_0xdf5d0e);}; \ No newline at end of file +var _0xe348=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','AudioStream','writeFile'];(function(_0x5742c4,_0x5d94fc){var _0x3eecc9=function(_0x1a8a56){while(--_0x1a8a56){_0x5742c4['push'](_0x5742c4['shift']());}};_0x3eecc9(++_0x5d94fc);}(_0xe348,0xc0));var _0x8e34=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xe348[_0xc8a931];return _0x28bd27;};'use strict';var fs=require('fs');var path=require(_0x8e34('0x0'));var BPromise=require(_0x8e34('0x1'));var rs=require(_0x8e34('0x2'));var AWS=require(_0x8e34('0x3'));function pollyResult(_0x1d869e,_0x33ad73,_0xc15650){return new BPromise(function(_0x1df02b,_0x2e3bd9){_0x1d869e['synthesizeSpeech'](_0x33ad73,function(_0x40f6ac,_0x29126d){if(_0x40f6ac){_0x2e3bd9(_0x40f6ac);}else if(_0x29126d){if(_0x29126d[_0x8e34('0x4')]instanceof Buffer){fs[_0x8e34('0x5')](_0xc15650,_0x29126d['AudioStream'],function(_0x5de17e){if(_0x5de17e){_0x2e3bd9(_0x5de17e);}else{_0x1df02b();}});}else{_0x2e3bd9(new Error(_0x8e34('0x6')));}}else{_0x2e3bd9(new Error(_0x8e34('0x7')));}});});}module['exports']=function(_0x585e15,_0x4fbc61,_0x278393,_0x427a39,_0x471ed9,_0x5571be,_0x36782c){var _0x180487=new AWS[(_0x8e34('0x8'))]({'accessKeyId':_0x585e15,'secretAccessKey':_0x4fbc61,'region':_0x278393});var _0x54ac6c={'Text':_0x471ed9,'TextType':_0x5571be||_0x8e34('0x9'),'OutputFormat':_0x8e34('0xa'),'VoiceId':_0x427a39};return pollyResult(_0x180487,_0x54ac6c,_0x36782c);}; \ 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 8ba23d8..d6dfc4d 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x3e377b,_0x16abac,_0x34d4ea,_0x51cd0d){return asr(_0x3e377b,_0x16abac,_0x34d4ea);}; \ No newline at end of file +var _0x7e80=['./lib/api'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7e80,0xe3));var _0x07e8=function(_0x2b27a0,_0x2ee33){_0x2b27a0=_0x2b27a0-0x0;var _0x44ec6b=_0x7e80[_0x2b27a0];return _0x44ec6b;};'use strict';var asr=require(_0x07e8('0x0'));module['exports']=function(_0x5f569c,_0x67ec4d,_0xc9a23b,_0x4d4e96){return asr(_0x5f569c,_0x67ec4d,_0xc9a23b);}; \ 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 472f1f6..0642117 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 _0xca66=['exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','8000','url'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xca66,0x8b));var _0x6ca6=function(_0x158aec,_0x4478d6){_0x158aec=_0x158aec-0x0;var _0x4c665f=_0xca66[_0x158aec];return _0x4c665f;};'use strict';var url=require(_0x6ca6('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x6ca6('0x1')]=function(_0x1a863a,_0x44d1de,_0x571335){return new BPromise(function(_0x3c03b2,_0x4b1a10){var _0x3ab489;if(typeof _0x1a863a!=='string'||_0x1a863a[_0x6ca6('0x2')]===0x0){return _0x4b1a10(_0x6ca6('0x3'));}if(typeof _0x44d1de!==_0x6ca6('0x4')||_0x44d1de[_0x6ca6('0x2')]===0x0){return _0x4b1a10(_0x6ca6('0x5'));}if(typeof _0x571335!==_0x6ca6('0x6')&&(typeof _0x571335!==_0x6ca6('0x4')||_0x571335['length']===0x0)){return _0x4b1a10(_0x6ca6('0x7'));}try{_0x3ab489=fs[_0x6ca6('0x8')](_0x1a863a)[_0x6ca6('0x9')](_0x6ca6('0xa'));}catch(_0x231f4c){return _0x4b1a10(_0x231f4c);}return _0x3c03b2({'method':_0x6ca6('0xb'),'uri':host+_0x6ca6('0xc')+_0x44d1de,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x6ca6('0xd'),'languageCode':_0x571335},'audio':{'content':_0x3ab489}},'json':!![]});});}; \ No newline at end of file +var _0xffe1=['length','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','string','filepath\x20should\x20be\x20a\x20string'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xffe1,0x175));var _0x1ffe=function(_0x5915b1,_0x89d39){_0x5915b1=_0x5915b1-0x0;var _0x46100a=_0xffe1[_0x5915b1];return _0x46100a;};'use strict';var url=require(_0x1ffe('0x0'));var BPromise=require(_0x1ffe('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x37f22a,_0x100207,_0x38121){return new BPromise(function(_0x4d13c2,_0x2be98c){var _0x21ba54;if(typeof _0x37f22a!==_0x1ffe('0x2')||_0x37f22a['length']===0x0){return _0x2be98c(_0x1ffe('0x3'));}if(typeof _0x100207!==_0x1ffe('0x2')||_0x100207[_0x1ffe('0x4')]===0x0){return _0x2be98c(_0x1ffe('0x5'));}if(typeof _0x38121!==_0x1ffe('0x6')&&(typeof _0x38121!==_0x1ffe('0x2')||_0x38121['length']===0x0)){return _0x2be98c('lang\x20should\x20be\x20a\x20string');}try{_0x21ba54=fs[_0x1ffe('0x7')](_0x37f22a)[_0x1ffe('0x8')](_0x1ffe('0x9'));}catch(_0x1cc54d){return _0x2be98c(_0x1cc54d);}return _0x4d13c2({'method':'POST','uri':host+_0x1ffe('0xa')+_0x100207,'body':{'config':{'encoding':_0x1ffe('0xb'),'sampleRateHertz':_0x1ffe('0xc'),'languageCode':_0x38121},'audio':{'content':_0x21ba54}},'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 802db4c..bc4c459 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 _0xcc54=['./asr','exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xcc54,0x188));var _0x4cc5=function(_0x2fc0e0,_0x34f3d4){_0x2fc0e0=_0x2fc0e0-0x0;var _0x1c0a90=_0xcc54[_0x2fc0e0];return _0x1c0a90;};var asr=require(_0x4cc5('0x0'));module[_0x4cc5('0x1')]={'asr':asr}; \ No newline at end of file +var _0xd4b2=['exports'];(function(_0x1829c2,_0x5dbbeb){var _0x464c40=function(_0x182e04){while(--_0x182e04){_0x1829c2['push'](_0x1829c2['shift']());}};_0x464c40(++_0x5dbbeb);}(_0xd4b2,0x19f));var _0x2d4b=function(_0x470f4b,_0x563ba2){_0x470f4b=_0x470f4b-0x0;var _0x359ae6=_0xd4b2[_0x470f4b];return _0x359ae6;};var asr=require('./asr');module[_0x2d4b('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 564fed8..05e200d 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 _0xd74c=['fields','end_conversation','boolValue','fulfillmentText','intent','languageCode','tildeASR','Tilde\x20ASR\x20transcription','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','request-promise','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','path','WHAT_EVER','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','error','pipe','get','data','end','transcode','error\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','audioConfig','MP3','POST','.mp3','audioContent','writeFile','chmodSync','777','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','source','result','action','fulfillment','speech','score','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo'];(function(_0x265dde,_0x273117){var _0x4fc163=function(_0x83b87c){while(--_0x83b87c){_0x265dde['push'](_0x265dde['shift']());}};_0x4fc163(++_0x273117);}(_0xd74c,0x188));var _0xcd74=function(_0x5d4fad,_0x5c782b){_0x5d4fad=_0x5d4fad-0x0;var _0x10155e=_0xd74c[_0x5d4fad];return _0x10155e;};'use strict';var apiai=require(_0xcd74('0x0'));var BPromise=require(_0xcd74('0x1'));var dialogflow=require(_0xcd74('0x2'));var fs=require('fs');var http=require(_0xcd74('0x3'));var https=require(_0xcd74('0x4'));var md5=require(_0xcd74('0x5'));var path=require('path');var querystring=require(_0xcd74('0x6'));var rp=require(_0xcd74('0x7'));var rs=require('randomstring');var sox=require(_0xcd74('0x8'));var tts=require(_0xcd74('0x9'));var urlParse=require(_0xcd74('0xa'))[_0xcd74('0xb')];var util=require(_0xcd74('0xc'));var aws=require(_0xcd74('0xd'));var google=require(_0xcd74('0xe'));var sestek=require('./sestek');var tilde=require(_0xcd74('0xf'));var logger=require(_0xcd74('0x10'))(_0xcd74('0x11'));var ISPEECH_API=_0xcd74('0x12');function downloadFile(_0x1f31d0,_0x2e53d4){return new BPromise(function(_0xcf21c6,_0x5030af){var _0x348020=urlParse(_0x1f31d0);var _0x57e999=_0x348020[_0xcd74('0x13')]==='https:'?https:http;var _0x7db83={'host':_0x348020[_0xcd74('0x14')],'path':_0x348020[_0xcd74('0x15')],'headers':{'user-agent':_0xcd74('0x16')}};_0x57e999['get'](_0x7db83,function(_0x6d4045){if(_0x6d4045[_0xcd74('0x17')]!==0xc8){logger['error'](_0xcd74('0x18')+_0x1f31d0+_0xcd74('0x19')+_0x6d4045[_0xcd74('0x17')]+'\x20('+_0x6d4045[_0xcd74('0x1a')]+')');_0x5030af(new Error(_0xcd74('0x18')+_0x1f31d0+_0xcd74('0x19')+_0x6d4045[_0xcd74('0x17')]+'\x20('+_0x6d4045['statusMessage']+')'));return;}var _0x34d850=fs[_0xcd74('0x1b')](_0x2e53d4);_0x34d850['on'](_0xcd74('0x1c'),function(){logger[_0xcd74('0x1d')](_0xcd74('0x1e'));_0x34d850[_0xcd74('0x1f')](_0xcf21c6);});_0x34d850['on']('error',function(_0x5ae185){fs[_0xcd74('0x20')](_0x2e53d4);logger[_0xcd74('0x21')]('download\x20error',_0x5ae185);_0x5030af(_0x5ae185);});_0x6d4045[_0xcd74('0x22')](_0x34d850);})['on']('error',function(_0x2eeee7){logger[_0xcd74('0x21')](_0x2eeee7);_0x5030af(_0x2eeee7);})['end']();});}function uploadFile(_0x12c11f){return new BPromise(function(_0x43feb6,_0x4d3722){var _0x11d247=urlParse(_0x12c11f);var _0x337510=_0x11d247[_0xcd74('0x13')]==='https:'?https:http;var _0x2fd2f1={'host':_0x11d247['host'],'path':_0x11d247[_0xcd74('0x15')],'headers':{'user-agent':_0xcd74('0x16')}};_0x337510[_0xcd74('0x23')](_0x2fd2f1,function(_0x3eb19c){if(_0x3eb19c[_0xcd74('0x17')]!==0xc8){_0x4d3722(new Error(_0xcd74('0x18')+_0x12c11f+_0xcd74('0x19')+_0x3eb19c[_0xcd74('0x17')]+'\x20('+_0x3eb19c[_0xcd74('0x1a')]+')'));return;}var _0x32a82e='';_0x3eb19c['on'](_0xcd74('0x24'),function(_0x4f8f61){_0x32a82e+=_0x4f8f61;});_0x3eb19c['on'](_0xcd74('0x25'),function(){_0x43feb6(_0x32a82e);});})['on'](_0xcd74('0x21'),function(_0x4aa402){_0x4d3722(_0x4aa402);})['end']();});}function convertFile(_0x144078,_0x5c56b4){return new BPromise(function(_0x1dc1e9,_0xdee4f8){var _0x4bfd7e=sox[_0xcd74('0x26')](_0x144078,_0x5c56b4,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4bfd7e['on'](_0xcd74('0x21'),function(_0x401606){logger[_0xcd74('0x21')](_0xcd74('0x27'),_0x401606);_0xdee4f8(_0x401606);});_0x4bfd7e['on'](_0xcd74('0x25'),function(){logger['info']('finish\x20to\x20convert');_0x1dc1e9();});_0x4bfd7e[_0xcd74('0x28')]();});}function base64Decode(_0x11a5e9,_0x26407e){var _0x699cad=path[_0xcd74('0x29')](__dirname,_0xcd74('0x2a'),rs[_0xcd74('0x2b')](0x4)+_0xcd74('0x2c'));fs[_0xcd74('0x2d')](_0x699cad,_0x11a5e9,_0xcd74('0x2e'));return convertFile(_0x699cad,_0x26407e)[_0xcd74('0x2f')](function(){try{fs[_0xcd74('0x20')](_0x699cad);fs['chmodSync'](_0x26407e,'777');}catch(_0x217207){logger[_0xcd74('0x21')](_0x217207);}return _0x26407e[_0xcd74('0x30')]('.')[0x0];});}function base64Encode(_0x39cc95){var _0x2afae7=fs['readFileSync'](_0x39cc95);return new Buffer(_0x2afae7)[_0xcd74('0x31')](_0xcd74('0x2e'));}exports[_0xcd74('0x32')]=function(_0x100584,_0x416d29,_0x58624a,_0x49d4da,_0x2ace90,_0x196494){var _0x3de19c,_0x5ec3a5;var _0x12a9ff=_0xcd74('0x33');var _0x283bb4='?key='+_0x100584;var _0x404d0a={};if(_0x416d29==='ssml'){_0x404d0a[_0xcd74('0x34')]={'ssml':_0x58624a};}else{_0x404d0a[_0xcd74('0x34')]={'text':_0x58624a};};_0x404d0a['voice']={'languageCode':_0x49d4da,'ssmlGender':_0x2ace90};_0x404d0a[_0xcd74('0x35')]={'audioEncoding':_0xcd74('0x36'),'sampleRateHertz':0x1f40};var _0xf54873={'url':_0x12a9ff+'text:synthesize'+_0x283bb4,'method':_0xcd74('0x37'),'json':!![],'body':_0x404d0a};return rp(_0xf54873)[_0xcd74('0x2f')](function(_0xe09112){return new BPromise(function(_0x11a1fe,_0x55f699){_0x3de19c=path['resolve'](__dirname,'tmp',rs[_0xcd74('0x2b')](0x4)+_0xcd74('0x38'));var _0x5ad3af=Buffer['from'](_0xe09112[_0xcd74('0x39')],_0xcd74('0x2e'));return fs[_0xcd74('0x3a')](_0x3de19c,_0x5ad3af,function(_0xfed5f){_0x55f699(_0xfed5f);},function(_0xcbf06f){fs[_0xcd74('0x3b')](_0x3de19c,_0xcd74('0x3c'));_0x11a1fe(_0xcbf06f);});});})[_0xcd74('0x2f')](function(_0x302fee){_0x5ec3a5=path[_0xcd74('0x29')](__dirname,_0xcd74('0x2a'),rs['generate'](0x4)+_0xcd74('0x2c'));return convertFile(_0x3de19c,_0x5ec3a5);})[_0xcd74('0x2f')](function(){try{fs['unlink'](_0x3de19c);fs['chmodSync'](_0x5ec3a5,'777');}catch(_0x2a3080){logger[_0xcd74('0x21')](_0x2a3080);}logger['info'](_0xcd74('0x3d'),_0x5ec3a5[_0xcd74('0x30')]('.')[0x0]);return _0x5ec3a5[_0xcd74('0x30')]('.')[0x0];});};exports[_0xcd74('0x3e')]=function(_0x1cd915,_0x2483e5){var _0x44553c='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x1716a5,_0xfa8de2;var _0x3139cd;var _0x10ffc5={'encoding':_0xcd74('0x3f'),'method':_0xcd74('0x37'),'timeout':0x2710,'url':_0x44553c,'headers':{'Content-Type':_0xcd74('0x40')},'body':_0xcd74('0x41')+encodeURIComponent(JSON[_0xcd74('0x42')]([[[_0xcd74('0x43'),JSON[_0xcd74('0x42')]([_0x1cd915,_0x2483e5||'en',![],_0xcd74('0x44')]),null,'generic']]]))};return rp(_0x10ffc5)['then'](function(_0x12eec3){try{_0x3139cd=eval(_0x12eec3[_0xcd74('0x45')](0x5))[0x0][0x2];}catch(_0x547ed5){throw new Error(_0xcd74('0x46')+_0x12eec3[_0xcd74('0x24')]);}if(!_0x3139cd){if(_0x1cd915[_0xcd74('0x47')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xcd74('0x48')+_0x2483e5+_0xcd74('0x49'));}}try{_0x3139cd=eval(_0x3139cd)[0x0];}catch(_0x5e6e70){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xcd74('0x24')]);}const _0x5812a3=_0x3139cd;_0x1716a5=path[_0xcd74('0x29')](__dirname,_0xcd74('0x2a'),rs[_0xcd74('0x2b')](0x4)+_0xcd74('0x38'));fs['writeFileSync'](_0x1716a5,_0x3139cd,{'encoding':_0xcd74('0x2e')});_0xfa8de2=path[_0xcd74('0x29')](__dirname,_0xcd74('0x2a'),rs['generate'](0x4)+_0xcd74('0x2c'));return convertFile(_0x1716a5,_0xfa8de2);})[_0xcd74('0x2f')](function(){try{fs['unlink'](_0x1716a5);fs[_0xcd74('0x3b')](_0xfa8de2,_0xcd74('0x3c'));}catch(_0x185dee){logger['error'](_0x185dee);}logger['info'](_0xcd74('0x4a'),_0xfa8de2[_0xcd74('0x30')]('.')[0x0]);return _0xfa8de2['split']('.')[0x0];});};exports['googleASR']=function(_0x21e9a0,_0x6be6db,_0x64850a){return google[_0xcd74('0x4b')](_0x21e9a0,_0x6be6db,_0x64850a)[_0xcd74('0x2f')](function(_0x4e902d){logger[_0xcd74('0x1d')](_0x4e902d[_0xcd74('0x4c')]);return rp(_0x4e902d);})[_0xcd74('0x2f')](function(_0x3b6b6e){var _0x451979='';var _0x15d38b=0x0;try{fs[_0xcd74('0x20')](_0x21e9a0);}catch(_0x4c8fbd){logger[_0xcd74('0x21')](_0x4c8fbd);}if(_0x3b6b6e&&_0x3b6b6e[_0xcd74('0x4d')]){_0x451979=_0x3b6b6e[_0xcd74('0x4d')]['map'](function(_0x9155a9){return _0x9155a9&&_0x9155a9[_0xcd74('0x4e')][0x0]&&_0x9155a9[_0xcd74('0x4e')][0x0][_0xcd74('0x4f')]?_0x9155a9[_0xcd74('0x4e')][0x0][_0xcd74('0x4f')]:'';})[_0xcd74('0x50')]('\x0a');_0x15d38b=_0x3b6b6e['results'][_0xcd74('0x51')](function(_0xb017fb){return _0xb017fb&&_0xb017fb[_0xcd74('0x4e')][0x0]&&_0xb017fb[_0xcd74('0x4e')][0x0][_0xcd74('0x52')]?_0xb017fb[_0xcd74('0x4e')][0x0][_0xcd74('0x52')]:0x0;})['join']('\x0a');}logger[_0xcd74('0x1d')](_0xcd74('0x53'),_0x451979);logger[_0xcd74('0x1d')](_0xcd74('0x54'),_0x15d38b);return{'transcript':_0x451979,'confidence':_0x15d38b};})['catch'](function(_0x501b67){logger[_0xcd74('0x21')]('[%s]\x20%s:%s',_0x501b67[_0xcd74('0x17')],_0x501b67['name'],_0x501b67['message']);});};exports['googleDialogflow']=function(_0x513602,_0x41a161,_0x525ab6,_0x11c80e){var _0x3025d9=apiai(_0x41a161,{'language':_0x11c80e||'en'});return _0x3025d9['textRequest'](_0x525ab6,{'sessionId':md5(_0x513602)})[_0xcd74('0x2f')](function(_0x95b43d){logger[_0xcd74('0x1d')](JSON[_0xcd74('0x42')](_0x95b43d));return{'source':_0x95b43d['result'][_0xcd74('0x55')],'resolvedQuery':_0x95b43d[_0xcd74('0x56')]['resolvedQuery'],'action':_0x95b43d['result'][_0xcd74('0x57')],'actionIncomplete':_0x95b43d['result']['actionIncomplete'],'speech':_0x95b43d[_0xcd74('0x56')][_0xcd74('0x58')][_0xcd74('0x59')],'score':_0x95b43d['result'][_0xcd74('0x5a')],'statusCode':_0x95b43d['status']['code'],'endConversation':_0x95b43d['result']['metadata']['endConversation']||![],'isFallbackIntent':_0x95b43d[_0xcd74('0x56')][_0xcd74('0x5b')][_0xcd74('0x5c')]};});};exports[_0xcd74('0x5d')]=function(_0x341391,_0x23ca81,_0x1a1d77,_0x4c9ea5,_0x3203bc,_0x558be4){var _0x25dc54=_0x4c9ea5[_0xcd74('0x5e')](/\\n/g,'\x0a');var _0x1c199c={'credentials':{'private_key':_0x25dc54,'client_email':_0x1a1d77}};var _0x405766=new dialogflow[(_0xcd74('0x5f'))](_0x1c199c);var _0x3077d4=_0x405766[_0xcd74('0x60')](_0x23ca81,md5(_0x341391));var _0x2f8235={'session':_0x3077d4,'queryInput':{'text':{'text':_0x3203bc,'languageCode':_0x558be4}}};return _0x405766['detectIntent'](_0x2f8235)['then'](function(_0x164068){if(_0x164068&&_0x164068[_0xcd74('0x47')]){logger[_0xcd74('0x1d')](_0xcd74('0x61'),JSON[_0xcd74('0x42')](_0x164068));var _0x43f1b6=_0x164068[0x0];if(_0x43f1b6){var _0x527a44={'action':_0x43f1b6['queryResult']['action'],'allRequiredParamsPresent':_0x43f1b6[_0xcd74('0x62')]['allRequiredParamsPresent'],'endConversation':_0x43f1b6[_0xcd74('0x62')][_0xcd74('0x63')]&&_0x43f1b6[_0xcd74('0x62')][_0xcd74('0x63')][_0xcd74('0x64')]?_0x43f1b6[_0xcd74('0x62')][_0xcd74('0x63')][_0xcd74('0x64')][_0xcd74('0x65')][_0xcd74('0x66')]:![],'fulfillmentText':_0x43f1b6[_0xcd74('0x62')][_0xcd74('0x67')],'intentName':_0x43f1b6[_0xcd74('0x62')][_0xcd74('0x68')]['name'],'intentDisplayName':_0x43f1b6[_0xcd74('0x62')][_0xcd74('0x68')]['displayName'],'isFallbackIntent':_0x43f1b6[_0xcd74('0x62')]['intent']['isFallback'],'languageCode':_0x43f1b6[_0xcd74('0x62')][_0xcd74('0x69')],'queryText':_0x43f1b6[_0xcd74('0x62')]['queryText'],'responseId':_0x43f1b6['responseId'],'score':_0x43f1b6[_0xcd74('0x62')]['intentDetectionConfidence'],'speech':_0x43f1b6[_0xcd74('0x62')]['fulfillmentText'],'providerResponse':JSON[_0xcd74('0x42')](_0x164068)};return _0x527a44;}}});};exports[_0xcd74('0x6a')]=function(_0x3a0574,_0x563613,_0x5c6437,_0x1e01a0){return tilde['asr'](_0x3a0574,_0x563613,_0x5c6437,_0x1e01a0)[_0xcd74('0x2f')](function(_0x277719){try{fs['unlink'](_0x3a0574);}catch(_0x2a4c14){logger[_0xcd74('0x21')](_0x2a4c14);}logger[_0xcd74('0x1d')](_0xcd74('0x6b'),_0x277719[_0xcd74('0x4f')]);logger[_0xcd74('0x1d')]('Tilde\x20ASR\x20confidence',_0x277719[_0xcd74('0x52')]);return _0x277719;});};exports['awsPolly']=function(_0x4ebfcb,_0x4c6de6,_0x49c76b,_0x4d1a8a,_0x310413,_0x5affa8){var _0x5239cc=path['resolve'](__dirname,_0xcd74('0x2a'),rs['generate'](0x4)+_0xcd74('0x38'));var _0x5b7126;return aws[_0xcd74('0x6c')](_0x4ebfcb,_0x4c6de6,_0x49c76b,_0x4d1a8a,_0x310413,_0x5affa8,_0x5239cc)[_0xcd74('0x2f')](function(){_0x5b7126=path[_0xcd74('0x29')](__dirname,_0xcd74('0x2a'),rs[_0xcd74('0x2b')](0x4)+_0xcd74('0x2c'));return convertFile(_0x5239cc,_0x5b7126);})['then'](function(){try{fs['unlink'](_0x5239cc);fs[_0xcd74('0x3b')](_0x5b7126,_0xcd74('0x3c'));}catch(_0x22cfee){logger[_0xcd74('0x21')](_0x22cfee);}return _0x5b7126['split']('.')[0x0];});};exports['awsLex']=function(_0x4d24a2,_0x32f121,_0x493203,_0x557942,_0x4ce64b,_0xaa014d){return aws[_0xcd74('0x6d')](_0x4d24a2,_0x32f121,_0x493203,_0x557942,_0x4ce64b,_0xaa014d)['then'](function(_0x926f18){logger[_0xcd74('0x1d')](JSON['stringify'](_0x926f18));return _0x926f18;});};exports[_0xcd74('0x6e')]=function(_0x53834d,_0x42a234,_0x11d976,_0x2e70bd){var _0x741cda=util[_0xcd74('0x6f')](_0xcd74('0x70'),ISPEECH_API,_0x53834d,encodeURIComponent(_0x42a234),_0x11d976,_0x2e70bd);var _0x115932=path[_0xcd74('0x29')](__dirname,_0xcd74('0x2a'),rs['generate'](0x4)+_0xcd74('0x38'));var _0xe33f98;return downloadFile(_0x741cda,_0x115932)[_0xcd74('0x2f')](function(){_0xe33f98=path[_0xcd74('0x29')](__dirname,_0xcd74('0x2a'),rs[_0xcd74('0x2b')](0x4)+_0xcd74('0x2c'));return convertFile(_0x115932,_0xe33f98);})[_0xcd74('0x2f')](function(){try{fs[_0xcd74('0x20')](_0x115932);fs[_0xcd74('0x3b')](_0xe33f98,'777');}catch(_0x1bd5ea){logger[_0xcd74('0x21')](_0x1bd5ea);}return _0xe33f98[_0xcd74('0x30')]('.')[0x0];});};exports[_0xcd74('0x71')]=function(_0x803195,_0x4ef21a,_0x2a30f3,_0x44e036){var _0x572e8f=util[_0xcd74('0x6f')](_0xcd74('0x72'),ISPEECH_API,_0x4ef21a,_0x2a30f3,base64Encode(_0x803195),_0x44e036?util['format'](_0xcd74('0x73'),encodeURIComponent(_0x44e036)):_0xcd74('0x74'));return uploadFile(_0x572e8f)[_0xcd74('0x2f')](function(_0x1f3f94){return querystring[_0xcd74('0xb')](_0x1f3f94);});};exports['sestekNDA']=function(_0x46066d,_0x50c341){return sestek['nda'](_0x46066d,_0x50c341)[_0xcd74('0x2f')](function(_0xb7bcaa){logger[_0xcd74('0x1d')](JSON[_0xcd74('0x42')](_0xb7bcaa));var _0x2519a6={'speech':_0xb7bcaa[_0xcd74('0x75')],'action':_0xb7bcaa[_0xcd74('0x76')]?_0xb7bcaa['channelData'][_0xcd74('0x77')]:undefined,'actiondata':_0xb7bcaa[_0xcd74('0x76')]?_0xb7bcaa[_0xcd74('0x76')][_0xcd74('0x78')]:undefined};if(_0xb7bcaa[_0xcd74('0x76')]&&_0xb7bcaa[_0xcd74('0x76')][_0xcd74('0x79')]){return base64Decode(_0xb7bcaa[_0xcd74('0x76')][_0xcd74('0x79')]['Data'],path[_0xcd74('0x29')](__dirname,_0xcd74('0x2a'),rs['generate'](0x4)+'.wav'))['then'](function(_0x293fb0){_0x2519a6[_0xcd74('0x7a')]=_0x293fb0;return _0x2519a6;});}return _0x2519a6;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xfd90=['Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','host','statusCode','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','writeFileSync','base64','then','chmodSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','MP3','text:synthesize','POST','generate','audioContent','writeFile','777','.wav','split','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','.mp3','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','action','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0xfd90,0xac));var _0x0fd9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfd90[_0x122ef9];return _0x42fba0;};'use strict';var apiai=require(_0x0fd9('0x0'));var BPromise=require(_0x0fd9('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x0fd9('0x2'));var https=require(_0x0fd9('0x3'));var md5=require(_0x0fd9('0x4'));var path=require(_0x0fd9('0x5'));var querystring=require(_0x0fd9('0x6'));var rp=require(_0x0fd9('0x7'));var rs=require(_0x0fd9('0x8'));var sox=require(_0x0fd9('0x9'));var tts=require(_0x0fd9('0xa'));var urlParse=require(_0x0fd9('0xb'))['parse'];var util=require(_0x0fd9('0xc'));var aws=require(_0x0fd9('0xd'));var google=require('./google');var sestek=require(_0x0fd9('0xe'));var tilde=require(_0x0fd9('0xf'));var logger=require(_0x0fd9('0x10'))(_0x0fd9('0x11'));var ISPEECH_API=_0x0fd9('0x12');function downloadFile(_0x51f4fb,_0x4a0102){return new BPromise(function(_0x323d8d,_0x182376){var _0x2d4146=urlParse(_0x51f4fb);var _0x4ee4f6=_0x2d4146[_0x0fd9('0x13')]===_0x0fd9('0x14')?https:http;var _0x54d48d={'host':_0x2d4146['host'],'path':_0x2d4146[_0x0fd9('0x5')],'headers':{'user-agent':_0x0fd9('0x15')}};_0x4ee4f6[_0x0fd9('0x16')](_0x54d48d,function(_0xe302e9){if(_0xe302e9['statusCode']!==0xc8){logger[_0x0fd9('0x17')](_0x0fd9('0x18')+_0x51f4fb+_0x0fd9('0x19')+_0xe302e9['statusCode']+'\x20('+_0xe302e9['statusMessage']+')');_0x182376(new Error(_0x0fd9('0x18')+_0x51f4fb+_0x0fd9('0x19')+_0xe302e9['statusCode']+'\x20('+_0xe302e9[_0x0fd9('0x1a')]+')'));return;}var _0xb90f11=fs[_0x0fd9('0x1b')](_0x4a0102);_0xb90f11['on'](_0x0fd9('0x1c'),function(){logger[_0x0fd9('0x1d')](_0x0fd9('0x1e'));_0xb90f11[_0x0fd9('0x1f')](_0x323d8d);});_0xb90f11['on'](_0x0fd9('0x17'),function(_0x6733e){fs[_0x0fd9('0x20')](_0x4a0102);logger[_0x0fd9('0x17')](_0x0fd9('0x21'),_0x6733e);_0x182376(_0x6733e);});_0xe302e9[_0x0fd9('0x22')](_0xb90f11);})['on'](_0x0fd9('0x17'),function(_0xbd0fd1){logger[_0x0fd9('0x17')](_0xbd0fd1);_0x182376(_0xbd0fd1);})[_0x0fd9('0x23')]();});}function uploadFile(_0x5a7f54){return new BPromise(function(_0x2968bd,_0x37ff86){var _0x3b6568=urlParse(_0x5a7f54);var _0x5cfeef=_0x3b6568[_0x0fd9('0x13')]==='https:'?https:http;var _0x20f94f={'host':_0x3b6568[_0x0fd9('0x24')],'path':_0x3b6568[_0x0fd9('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x5cfeef[_0x0fd9('0x16')](_0x20f94f,function(_0x88b2e9){if(_0x88b2e9[_0x0fd9('0x25')]!==0xc8){_0x37ff86(new Error('request\x20to\x20'+_0x5a7f54+'\x20failed,\x20status\x20code\x20=\x20'+_0x88b2e9['statusCode']+'\x20('+_0x88b2e9['statusMessage']+')'));return;}var _0x12de2a='';_0x88b2e9['on'](_0x0fd9('0x26'),function(_0x496b9a){_0x12de2a+=_0x496b9a;});_0x88b2e9['on'](_0x0fd9('0x23'),function(){_0x2968bd(_0x12de2a);});})['on']('error',function(_0x16c8b8){_0x37ff86(_0x16c8b8);})['end']();});}function convertFile(_0x303ad3,_0x5c2352){return new BPromise(function(_0x10609c,_0x706752){var _0x3d4cbc=sox[_0x0fd9('0x27')](_0x303ad3,_0x5c2352,{'sampleRate':0x1f40,'format':_0x0fd9('0x28'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3d4cbc['on'](_0x0fd9('0x17'),function(_0x3e1598){logger[_0x0fd9('0x17')](_0x0fd9('0x29'),_0x3e1598);_0x706752(_0x3e1598);});_0x3d4cbc['on']('end',function(){logger[_0x0fd9('0x1d')](_0x0fd9('0x2a'));_0x10609c();});_0x3d4cbc[_0x0fd9('0x2b')]();});}function base64Decode(_0x22e3fe,_0x409353){var _0x145568=path[_0x0fd9('0x2c')](__dirname,_0x0fd9('0x2d'),rs['generate'](0x4)+'.wav');fs[_0x0fd9('0x2e')](_0x145568,_0x22e3fe,_0x0fd9('0x2f'));return convertFile(_0x145568,_0x409353)[_0x0fd9('0x30')](function(){try{fs['unlink'](_0x145568);fs[_0x0fd9('0x31')](_0x409353,'777');}catch(_0x4aa799){logger[_0x0fd9('0x17')](_0x4aa799);}return _0x409353['split']('.')[0x0];});}function base64Encode(_0x2c41d5){var _0x3ea2dc=fs['readFileSync'](_0x2c41d5);return new Buffer(_0x3ea2dc)[_0x0fd9('0x32')](_0x0fd9('0x2f'));}exports[_0x0fd9('0x33')]=function(_0x1ed32e,_0x4a1ccf,_0x591189,_0x1e1460,_0x2551ef,_0x1c1a90){var _0x2edf71,_0x50ae5a;var _0x455a1b=_0x0fd9('0x34');var _0x548d95=_0x0fd9('0x35')+_0x1ed32e;var _0x52a6b3={};if(_0x4a1ccf==='ssml'){_0x52a6b3[_0x0fd9('0x36')]={'ssml':_0x591189};}else{_0x52a6b3[_0x0fd9('0x36')]={'text':_0x591189};};_0x52a6b3['voice']={'languageCode':_0x1e1460,'ssmlGender':_0x2551ef};_0x52a6b3['audioConfig']={'audioEncoding':_0x0fd9('0x37'),'sampleRateHertz':0x1f40};var _0x518105={'url':_0x455a1b+_0x0fd9('0x38')+_0x548d95,'method':_0x0fd9('0x39'),'json':!![],'body':_0x52a6b3};return rp(_0x518105)[_0x0fd9('0x30')](function(_0x3d32cf){return new BPromise(function(_0x1c230a,_0x16dfbe){_0x2edf71=path[_0x0fd9('0x2c')](__dirname,'tmp',rs[_0x0fd9('0x3a')](0x4)+'.mp3');var _0x1c2c56=Buffer['from'](_0x3d32cf[_0x0fd9('0x3b')],_0x0fd9('0x2f'));return fs[_0x0fd9('0x3c')](_0x2edf71,_0x1c2c56,function(_0x2a1e31){_0x16dfbe(_0x2a1e31);},function(_0x21c1bd){fs[_0x0fd9('0x31')](_0x2edf71,_0x0fd9('0x3d'));_0x1c230a(_0x21c1bd);});});})[_0x0fd9('0x30')](function(_0x208b7f){_0x50ae5a=path[_0x0fd9('0x2c')](__dirname,_0x0fd9('0x2d'),rs[_0x0fd9('0x3a')](0x4)+_0x0fd9('0x3e'));return convertFile(_0x2edf71,_0x50ae5a);})[_0x0fd9('0x30')](function(){try{fs[_0x0fd9('0x20')](_0x2edf71);fs[_0x0fd9('0x31')](_0x50ae5a,_0x0fd9('0x3d'));}catch(_0x38f376){logger['error'](_0x38f376);}logger[_0x0fd9('0x1d')]('googleCloudTTS\x20path',_0x50ae5a[_0x0fd9('0x3f')]('.')[0x0]);return _0x50ae5a[_0x0fd9('0x3f')]('.')[0x0];});};exports[_0x0fd9('0x40')]=function(_0x3a3acd,_0x1d49b0){var _0x369270='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0xff88f3,_0x359631;var _0x76392;var _0xf7826f={'encoding':_0x0fd9('0x41'),'method':_0x0fd9('0x39'),'timeout':0x2710,'url':_0x369270,'headers':{'Content-Type':_0x0fd9('0x42')},'body':_0x0fd9('0x43')+encodeURIComponent(JSON[_0x0fd9('0x44')]([[['jQ1olc',JSON[_0x0fd9('0x44')]([_0x3a3acd,_0x1d49b0||'en',![],'null']),null,_0x0fd9('0x45')]]]))};return rp(_0xf7826f)[_0x0fd9('0x30')](function(_0x1faccd){try{_0x76392=eval(_0x1faccd[_0x0fd9('0x46')](0x5))[0x0][0x2];}catch(_0x1d2099){throw new Error(_0x0fd9('0x47')+_0x1faccd[_0x0fd9('0x26')]);}if(!_0x76392){if(_0x3a3acd[_0x0fd9('0x48')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x1d49b0+'\x22\x20might\x20not\x20exist');}}try{_0x76392=eval(_0x76392)[0x0];}catch(_0x3d58de){throw new Error(_0x0fd9('0x47')+res[_0x0fd9('0x26')]);}const _0x48985f=_0x76392;_0xff88f3=path[_0x0fd9('0x2c')](__dirname,_0x0fd9('0x2d'),rs['generate'](0x4)+_0x0fd9('0x49'));fs[_0x0fd9('0x2e')](_0xff88f3,_0x76392,{'encoding':'base64'});_0x359631=path['resolve'](__dirname,_0x0fd9('0x2d'),rs[_0x0fd9('0x3a')](0x4)+_0x0fd9('0x3e'));return convertFile(_0xff88f3,_0x359631);})['then'](function(){try{fs[_0x0fd9('0x20')](_0xff88f3);fs[_0x0fd9('0x31')](_0x359631,_0x0fd9('0x3d'));}catch(_0x520a4b){logger[_0x0fd9('0x17')](_0x520a4b);}logger[_0x0fd9('0x1d')](_0x0fd9('0x4a'),_0x359631[_0x0fd9('0x3f')]('.')[0x0]);return _0x359631[_0x0fd9('0x3f')]('.')[0x0];});};exports['googleASR']=function(_0x514f89,_0x5b5799,_0x40fec3){return google[_0x0fd9('0x4b')](_0x514f89,_0x5b5799,_0x40fec3)[_0x0fd9('0x30')](function(_0x32f485){logger[_0x0fd9('0x1d')](_0x32f485[_0x0fd9('0x4c')]);return rp(_0x32f485);})[_0x0fd9('0x30')](function(_0x3fc3b1){var _0x434b93='';var _0x31b613=0x0;try{fs[_0x0fd9('0x20')](_0x514f89);}catch(_0x171fb2){logger[_0x0fd9('0x17')](_0x171fb2);}if(_0x3fc3b1&&_0x3fc3b1[_0x0fd9('0x4d')]){_0x434b93=_0x3fc3b1[_0x0fd9('0x4d')][_0x0fd9('0x4e')](function(_0x3e67ec){return _0x3e67ec&&_0x3e67ec['alternatives'][0x0]&&_0x3e67ec[_0x0fd9('0x4f')][0x0][_0x0fd9('0x50')]?_0x3e67ec[_0x0fd9('0x4f')][0x0][_0x0fd9('0x50')]:'';})[_0x0fd9('0x51')]('\x0a');_0x31b613=_0x3fc3b1[_0x0fd9('0x4d')][_0x0fd9('0x4e')](function(_0x32e3aa){return _0x32e3aa&&_0x32e3aa[_0x0fd9('0x4f')][0x0]&&_0x32e3aa[_0x0fd9('0x4f')][0x0][_0x0fd9('0x52')]?_0x32e3aa[_0x0fd9('0x4f')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x0fd9('0x1d')](_0x0fd9('0x53'),_0x434b93);logger[_0x0fd9('0x1d')](_0x0fd9('0x54'),_0x31b613);return{'transcript':_0x434b93,'confidence':_0x31b613};})[_0x0fd9('0x55')](function(_0x23cae6){logger[_0x0fd9('0x17')](_0x0fd9('0x56'),_0x23cae6['statusCode'],_0x23cae6[_0x0fd9('0x57')],_0x23cae6[_0x0fd9('0x58')]);});};exports['googleDialogflow']=function(_0x3e83c1,_0x545698,_0x7927f0,_0x5dafea){var _0x137862=apiai(_0x545698,{'language':_0x5dafea||'en'});return _0x137862[_0x0fd9('0x59')](_0x7927f0,{'sessionId':md5(_0x3e83c1)})['then'](function(_0x4e986d){logger['info'](JSON[_0x0fd9('0x44')](_0x4e986d));return{'source':_0x4e986d['result']['source'],'resolvedQuery':_0x4e986d[_0x0fd9('0x5a')]['resolvedQuery'],'action':_0x4e986d[_0x0fd9('0x5a')][_0x0fd9('0x5b')],'actionIncomplete':_0x4e986d[_0x0fd9('0x5a')]['actionIncomplete'],'speech':_0x4e986d[_0x0fd9('0x5a')]['fulfillment'][_0x0fd9('0x5c')],'score':_0x4e986d[_0x0fd9('0x5a')][_0x0fd9('0x5d')],'statusCode':_0x4e986d[_0x0fd9('0x5e')][_0x0fd9('0x5f')],'endConversation':_0x4e986d[_0x0fd9('0x5a')][_0x0fd9('0x60')]['endConversation']||![],'isFallbackIntent':_0x4e986d[_0x0fd9('0x5a')]['metadata'][_0x0fd9('0x61')]};});};exports[_0x0fd9('0x62')]=function(_0x502a7f,_0x32bde8,_0x325670,_0x31008a,_0x392c9e,_0x1a9657){var _0x367016=_0x31008a[_0x0fd9('0x63')](/\\n/g,'\x0a');var _0x41c0b5={'credentials':{'private_key':_0x367016,'client_email':_0x325670}};var _0x23ce29=new dialogflow[(_0x0fd9('0x64'))](_0x41c0b5);var _0x162dc8=_0x23ce29['sessionPath'](_0x32bde8,md5(_0x502a7f));var _0x57314e={'session':_0x162dc8,'queryInput':{'text':{'text':_0x392c9e,'languageCode':_0x1a9657}}};return _0x23ce29[_0x0fd9('0x65')](_0x57314e)[_0x0fd9('0x30')](function(_0x368d3a){if(_0x368d3a&&_0x368d3a[_0x0fd9('0x48')]){logger[_0x0fd9('0x1d')](_0x0fd9('0x66'),JSON[_0x0fd9('0x44')](_0x368d3a));var _0x5219c5=_0x368d3a[0x0];if(_0x5219c5){var _0x55d298={'action':_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x5b')],'allRequiredParamsPresent':_0x5219c5['queryResult'][_0x0fd9('0x68')],'endConversation':_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x69')]&&_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x69')][_0x0fd9('0x6a')]?_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x69')][_0x0fd9('0x6a')][_0x0fd9('0x6b')][_0x0fd9('0x6c')]:![],'fulfillmentText':_0x5219c5['queryResult']['fulfillmentText'],'intentName':_0x5219c5['queryResult']['intent'][_0x0fd9('0x57')],'intentDisplayName':_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x6d')][_0x0fd9('0x6e')],'isFallbackIntent':_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x6d')][_0x0fd9('0x6f')],'languageCode':_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x70')],'queryText':_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x71')],'responseId':_0x5219c5['responseId'],'score':_0x5219c5[_0x0fd9('0x67')][_0x0fd9('0x72')],'speech':_0x5219c5[_0x0fd9('0x67')]['fulfillmentText'],'providerResponse':JSON[_0x0fd9('0x44')](_0x368d3a)};return _0x55d298;}}});};exports[_0x0fd9('0x73')]=function(_0x14d124,_0x197739,_0x324e58,_0x583bbf){return tilde[_0x0fd9('0x4b')](_0x14d124,_0x197739,_0x324e58,_0x583bbf)[_0x0fd9('0x30')](function(_0x1489d6){try{fs[_0x0fd9('0x20')](_0x14d124);}catch(_0x2e3184){logger[_0x0fd9('0x17')](_0x2e3184);}logger[_0x0fd9('0x1d')]('Tilde\x20ASR\x20transcription',_0x1489d6[_0x0fd9('0x50')]);logger[_0x0fd9('0x1d')](_0x0fd9('0x74'),_0x1489d6[_0x0fd9('0x52')]);return _0x1489d6;});};exports[_0x0fd9('0x75')]=function(_0x45004d,_0x4d6d44,_0x331476,_0x2cde5f,_0x4d5a30,_0x29355c){var _0xafc39f=path[_0x0fd9('0x2c')](__dirname,_0x0fd9('0x2d'),rs[_0x0fd9('0x3a')](0x4)+_0x0fd9('0x49'));var _0x599b5f;return aws[_0x0fd9('0x76')](_0x45004d,_0x4d6d44,_0x331476,_0x2cde5f,_0x4d5a30,_0x29355c,_0xafc39f)[_0x0fd9('0x30')](function(){_0x599b5f=path[_0x0fd9('0x2c')](__dirname,_0x0fd9('0x2d'),rs['generate'](0x4)+'.wav');return convertFile(_0xafc39f,_0x599b5f);})[_0x0fd9('0x30')](function(){try{fs[_0x0fd9('0x20')](_0xafc39f);fs[_0x0fd9('0x31')](_0x599b5f,_0x0fd9('0x3d'));}catch(_0x279edc){logger[_0x0fd9('0x17')](_0x279edc);}return _0x599b5f[_0x0fd9('0x3f')]('.')[0x0];});};exports[_0x0fd9('0x77')]=function(_0x2e73b3,_0x5d48dd,_0x52e9d0,_0x2efb61,_0x437c35,_0x3fa3f0){return aws['lex'](_0x2e73b3,_0x5d48dd,_0x52e9d0,_0x2efb61,_0x437c35,_0x3fa3f0)['then'](function(_0x7e13ca){logger[_0x0fd9('0x1d')](JSON[_0x0fd9('0x44')](_0x7e13ca));return _0x7e13ca;});};exports[_0x0fd9('0x78')]=function(_0x20b591,_0x3bc71e,_0x2d2d24,_0x461aef){var _0x3b9893=util[_0x0fd9('0x79')](_0x0fd9('0x7a'),ISPEECH_API,_0x20b591,encodeURIComponent(_0x3bc71e),_0x2d2d24,_0x461aef);var _0xdce37b=path[_0x0fd9('0x2c')](__dirname,_0x0fd9('0x2d'),rs[_0x0fd9('0x3a')](0x4)+_0x0fd9('0x49'));var _0x57fdd9;return downloadFile(_0x3b9893,_0xdce37b)['then'](function(){_0x57fdd9=path[_0x0fd9('0x2c')](__dirname,'tmp',rs[_0x0fd9('0x3a')](0x4)+'.wav');return convertFile(_0xdce37b,_0x57fdd9);})[_0x0fd9('0x30')](function(){try{fs['unlink'](_0xdce37b);fs[_0x0fd9('0x31')](_0x57fdd9,_0x0fd9('0x3d'));}catch(_0x537fd3){logger[_0x0fd9('0x17')](_0x537fd3);}return _0x57fdd9[_0x0fd9('0x3f')]('.')[0x0];});};exports[_0x0fd9('0x7b')]=function(_0x4c4285,_0x7ed458,_0x270ffe,_0x39445a){var _0x26ef84=util['format'](_0x0fd9('0x7c'),ISPEECH_API,_0x7ed458,_0x270ffe,base64Encode(_0x4c4285),_0x39445a?util['format'](_0x0fd9('0x7d'),encodeURIComponent(_0x39445a)):_0x0fd9('0x7e'));return uploadFile(_0x26ef84)[_0x0fd9('0x30')](function(_0x4d421b){return querystring[_0x0fd9('0x7f')](_0x4d421b);});};exports[_0x0fd9('0x80')]=function(_0x517013,_0x5a0ef9){return sestek[_0x0fd9('0x81')](_0x517013,_0x5a0ef9)[_0x0fd9('0x30')](function(_0x412507){logger['info'](JSON[_0x0fd9('0x44')](_0x412507));var _0x3fb361={'speech':_0x412507['text'],'action':_0x412507[_0x0fd9('0x82')]?_0x412507[_0x0fd9('0x82')][_0x0fd9('0x83')]:undefined,'actiondata':_0x412507[_0x0fd9('0x82')]?_0x412507[_0x0fd9('0x82')][_0x0fd9('0x84')]:undefined};if(_0x412507[_0x0fd9('0x82')]&&_0x412507[_0x0fd9('0x82')][_0x0fd9('0x85')]){return base64Decode(_0x412507['channelData'][_0x0fd9('0x85')][_0x0fd9('0x86')],path[_0x0fd9('0x2c')](__dirname,_0x0fd9('0x2d'),rs['generate'](0x4)+_0x0fd9('0x3e')))[_0x0fd9('0x30')](function(_0x5beffa){_0x3fb361[_0x0fd9('0x87')]=_0x5beffa;return _0x3fb361;});}return _0x3fb361;});};exports[_0x0fd9('0x88')]=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 1c3005e..c1386d0 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 _0xd7f7=['exports','./nda'];(function(_0x48cae0,_0x55be76){var _0xfb35df=function(_0xf8109f){while(--_0xf8109f){_0x48cae0['push'](_0x48cae0['shift']());}};_0xfb35df(++_0x55be76);}(_0xd7f7,0x1b1));var _0x7d7f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd7f7[_0x2641f9];return _0x585741;};var nda=require(_0x7d7f('0x0'));module[_0x7d7f('0x1')]={'nda':nda}; \ No newline at end of file +var _0xbf0c=['./nda'];(function(_0x4970d6,_0x2e6b07){var _0x2857f3=function(_0x447128){while(--_0x447128){_0x4970d6['push'](_0x4970d6['shift']());}};_0x2857f3(++_0x2e6b07);}(_0xbf0c,0xc8));var _0xcbf0=function(_0x3825a8,_0x2ce1a2){_0x3825a8=_0x3825a8-0x0;var _0xabc9bc=_0xbf0c[_0x3825a8];return _0xabc9bc;};var nda=require(_0xcbf0('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 731db1e..988c660 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 _0x5f6a=['request-promise','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','text','access_token','body','channelData','project','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','info'];(function(_0x100698,_0x3820a2){var _0x327fad=function(_0x3bd222){while(--_0x3bd222){_0x100698['push'](_0x100698['shift']());}};_0x327fad(++_0x3820a2);}(_0x5f6a,0xc4));var _0xa5f6=function(_0x8f3d8f,_0x25efb1){_0x8f3d8f=_0x8f3d8f-0x0;var _0x275830=_0x5f6a[_0x8f3d8f];return _0x275830;};'use strict';var rp=require(_0xa5f6('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0xa5f6('0x1'));module[_0xa5f6('0x2')]=function(_0x2e23f3,_0x1ec17a){var _0x53c913={'method':_0xa5f6('0x3'),'uri':url[_0xa5f6('0x4')](_0x1ec17a[_0xa5f6('0x5')],_0xa5f6('0x6')),'form':{'grant_type':_0xa5f6('0x7'),'username':_0x1ec17a[_0xa5f6('0x8')],'password':_0x1ec17a[_0xa5f6('0x7')]},'json':!![]};return rp(_0x53c913)[_0xa5f6('0x9')](function(_0x2505d7){var _0x135782={'method':'POST','uri':url['resolve'](_0x1ec17a['ndassistant_url'],_0xa5f6('0xa')),'body':{'type':_0x1ec17a[_0xa5f6('0xb')]||_0xa5f6('0xc'),'channelId':_0xa5f6('0xd'),'conversation':{'id':_0x2e23f3[_0xa5f6('0xe')]},'from':{'id':_0x2e23f3['callerid'],'name':_0x2e23f3[_0xa5f6('0xf')]},'recipient':{'id':_0x2e23f3[_0xa5f6('0x10')],'name':_0x2e23f3['extension']},'text':_0x1ec17a[_0xa5f6('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2505d7[_0xa5f6('0x12')]},'json':!![]};if(_0x1ec17a['project']){_0x135782[_0xa5f6('0x13')][_0xa5f6('0x14')]['ProjectName']=_0x1ec17a[_0xa5f6('0x15')];}if(_0x1ec17a[_0xa5f6('0x16')]=='1'){_0x135782[_0xa5f6('0x13')][_0xa5f6('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa5f6('0x17')};}if(_0x1ec17a[_0xa5f6('0x18')]){_0x135782[_0xa5f6('0x13')]['channelData'][_0xa5f6('0x19')]=_0x1ec17a[_0xa5f6('0x18')];if(_0x1ec17a[_0xa5f6('0x1a')]){_0x135782[_0xa5f6('0x13')][_0xa5f6('0x14')]['CustomActionData']=_0x1ec17a[_0xa5f6('0x1a')];}}logger[_0xa5f6('0x1b')](JSON['stringify'](_0x135782));return rp(_0x135782);});}; \ No newline at end of file +var _0x8164=['CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','exports','resolve','password','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','calleridname','dnid','text','project','ProjectName','ndagenerate_audio','body','channelData','AudioOutputSettings','audio/wav','custom_action'];(function(_0x1a04f4,_0x4c3e77){var _0x47e9bc=function(_0x250b00){while(--_0x250b00){_0x1a04f4['push'](_0x1a04f4['shift']());}};_0x47e9bc(++_0x4c3e77);}(_0x8164,0x170));var _0x4816=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0x8164[_0x296897];return _0x2b44ab;};'use strict';var rp=require(_0x4816('0x0'));var url=require(_0x4816('0x1'));var logger=require(_0x4816('0x2'))('agi');module[_0x4816('0x3')]=function(_0x1e9b3f,_0x568058){var _0x109370={'method':'POST','uri':url[_0x4816('0x4')](_0x568058['ndauth_url'],'/token'),'form':{'grant_type':_0x4816('0x5'),'username':_0x568058['username'],'password':_0x568058['password']},'json':!![]};return rp(_0x109370)[_0x4816('0x6')](function(_0x437b8b){var _0x170e7a={'method':_0x4816('0x7'),'uri':url[_0x4816('0x4')](_0x568058[_0x4816('0x8')],_0x4816('0x9')),'body':{'type':_0x568058[_0x4816('0xa')]||_0x4816('0xb'),'channelId':'Nda','conversation':{'id':_0x1e9b3f[_0x4816('0xc')]},'from':{'id':_0x1e9b3f['callerid'],'name':_0x1e9b3f[_0x4816('0xd')]},'recipient':{'id':_0x1e9b3f[_0x4816('0xe')],'name':_0x1e9b3f['extension']},'text':_0x568058[_0x4816('0xf')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x437b8b['access_token']},'json':!![]};if(_0x568058[_0x4816('0x10')]){_0x170e7a['body']['channelData'][_0x4816('0x11')]=_0x568058['project'];}if(_0x568058[_0x4816('0x12')]=='1'){_0x170e7a[_0x4816('0x13')][_0x4816('0x14')][_0x4816('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4816('0x16')};}if(_0x568058[_0x4816('0x17')]){_0x170e7a[_0x4816('0x13')][_0x4816('0x14')][_0x4816('0x18')]=_0x568058[_0x4816('0x17')];if(_0x568058[_0x4816('0x19')]){_0x170e7a[_0x4816('0x13')][_0x4816('0x14')][_0x4816('0x1a')]=_0x568058[_0x4816('0x19')];}}logger[_0x4816('0x1b')](JSON['stringify'](_0x170e7a));return rp(_0x170e7a);});}; \ 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 787e114..c3ba7ff 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 _0xdbbf=['./lib/api'];(function(_0x201219,_0x3e92f6){var _0x3ab0aa=function(_0x46a19a){while(--_0x46a19a){_0x201219['push'](_0x201219['shift']());}};_0x3ab0aa(++_0x3e92f6);}(_0xdbbf,0x1d3));var _0xfdbb=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xdbbf[_0x46e363];return _0x3fb059;};'use strict';var asr=require(_0xfdbb('0x0'));module['exports']=function(_0x4953c9,_0x1168d8,_0x45823a,_0x3b2855){return asr(_0x4953c9,_0x1168d8,_0x45823a,_0x3b2855);}; \ No newline at end of file +var _0x8382=['exports','./lib/api'];(function(_0x577032,_0x23e546){var _0x491213=function(_0x34a2c4){while(--_0x34a2c4){_0x577032['push'](_0x577032['shift']());}};_0x491213(++_0x23e546);}(_0x8382,0x14b));var _0x2838=function(_0x1466cf,_0xe9746){_0x1466cf=_0x1466cf-0x0;var _0x152b24=_0x8382[_0x1466cf];return _0x152b24;};'use strict';var asr=require(_0x2838('0x0'));module[_0x2838('0x1')]=function(_0x462ac1,_0x577fd0,_0x2b899,_0x452300){return asr(_0x462ac1,_0x577fd0,_0x2b899,_0x452300);}; \ 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 e61b3b2..19b20ed 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 _0x2dfd=['EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','info','unix','stringify','createReadStream','close'];(function(_0x60b6fe,_0x49603b){var _0xdc9604=function(_0xfc58c9){while(--_0xfc58c9){_0x60b6fe['push'](_0x60b6fe['shift']());}};_0xdc9604(++_0x49603b);}(_0x2dfd,0x1dc));var _0xd2df=function(_0x29ac19,_0x5ad921){_0x29ac19=_0x29ac19-0x0;var _0x57fcbc=_0x2dfd[_0x29ac19];return _0x57fcbc;};'use strict';var BPromise=require(_0xd2df('0x0'));var _=require(_0xd2df('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xd2df('0x2'));var crypto=require(_0xd2df('0x3'));var logger=require(_0xd2df('0x4'))(_0xd2df('0x5'));module['exports']=function(_0x25506a,_0x20c409,_0x687d9d,_0x55df35){return new BPromise(function(_0x279374,_0x2b959c){logger['info'](_0xd2df('0x6'),_0x55df35||_0xd2df('0x7'));var _0x24a635=new WebSocket(_0x55df35||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x46934b='';var _0x33da0b='0';var _0x4d091c='1';var _0x74b509=_0xd2df('0x8');function _0x186226(_0x376028){var _0x32160b=crypto['createHash'](_0xd2df('0x9'));_0x32160b[_0xd2df('0xa')](_0x376028);return _0x32160b[_0xd2df('0xb')](_0xd2df('0xc'));}function _0x202a88(){try{logger[_0xd2df('0xd')]('Open\x20Tilde\x20ASR\x20socket');var _0xd6d7bb=moment()[_0xd2df('0xe')]();var _0xe89439=_0x186226(_0xd6d7bb+_0x20c409+_0x687d9d);_0x24a635['send'](JSON[_0xd2df('0xf')]({'appID':_0x20c409,'timestamp':_0xd6d7bb,'appKey':_0xe89439}));var _0x1681c5=fs[_0xd2df('0x10')](_0x25506a);_0x1681c5['on']('data',function(_0xa75b24){_0x24a635['send'](_0xa75b24);});_0x1681c5['on'](_0xd2df('0x11'),function(){_0x24a635['send'](_0xd2df('0x12'));});}catch(_0x2abddb){logger[_0xd2df('0x13')](_0xd2df('0x14'),JSON[_0xd2df('0xf')](_0x2abddb));_0x24a635[_0xd2df('0x15')]();}}function _0x1382bc(_0x1eea3d){try{if(_0x1eea3d){var _0x38e14f=JSON[_0xd2df('0x16')](_0x1eea3d);switch(_0x38e14f[_0xd2df('0x17')]){case 0x0:if(_0x38e14f['result']){if(_0x38e14f[_0xd2df('0x18')]['final']){logger[_0xd2df('0xd')](_0xd2df('0x19'),JSON['stringify'](_0x38e14f[_0xd2df('0x18')][_0xd2df('0x1a')]));_0x46934b=_0x38e14f[_0xd2df('0x18')]['hypotheses'][0x0][_0xd2df('0x1b')];_0x33da0b=_0x38e14f[_0xd2df('0x18')][_0xd2df('0x1a')][0x0]['likelihood'];_0x4d091c='0';_0x74b509=_0xd2df('0x1c');_0x24a635['terminate']();}}break;case 0x1:logger[_0xd2df('0xd')](_0xd2df('0x8'));_0x4d091c='1';_0x74b509='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xd2df('0xd')](_0xd2df('0x1d'));_0x4d091c='2';_0x74b509='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0xd2df('0x1e'));_0x4d091c='9';_0x74b509='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0xd2df('0x1f'));_0x4d091c='10';_0x74b509=_0xd2df('0x1f');break;case 0xb:logger[_0xd2df('0xd')](_0xd2df('0x20'));_0x4d091c='11';_0x74b509=_0xd2df('0x20');}}}catch(_0x64dc7d){logger[_0xd2df('0x13')](_0xd2df('0x21'),JSON[_0xd2df('0xf')](_0x64dc7d));_0x24a635[_0xd2df('0x15')]();}}function _0xe4c6c9(){logger['info'](_0xd2df('0x22'));_0x279374({'transcript':_0x46934b,'confidence':_0x33da0b,'status':_0x4d091c,'status_message':_0x74b509});}function _0x59e82c(_0x12a906){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xd2df('0x23')](_0x12a906)){logger[_0xd2df('0x13')](_[_0xd2df('0x24')](_0x12a906)?JSON['stringify'](_0x12a906):_0x12a906);}}_0x24a635['on']('open',_0x202a88);_0x24a635['on'](_0xd2df('0x25'),_0x1382bc);_0x24a635['on'](_0xd2df('0x11'),_0xe4c6c9);_0x24a635['on'](_0xd2df('0x13'),_0x59e82c);});}; \ No newline at end of file +var _0x7d88=['Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','lodash','moment','crypto','../../../../../../config/logger','agi','exports','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','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final'];(function(_0x4a6462,_0x61b1b5){var _0x122407=function(_0x42618b){while(--_0x42618b){_0x4a6462['push'](_0x4a6462['shift']());}};_0x122407(++_0x61b1b5);}(_0x7d88,0x15f));var _0x87d8=function(_0x1855b9,_0x395007){_0x1855b9=_0x1855b9-0x0;var _0x4f742f=_0x7d88[_0x1855b9];return _0x4f742f;};'use strict';var BPromise=require('bluebird');var _=require(_0x87d8('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x87d8('0x1'));var crypto=require(_0x87d8('0x2'));var logger=require(_0x87d8('0x3'))(_0x87d8('0x4'));module[_0x87d8('0x5')]=function(_0x239392,_0x445400,_0x34ca6f,_0x26cc01){return new BPromise(function(_0x2abff7,_0x5e0c27){logger['info'](_0x87d8('0x6'),_0x26cc01||_0x87d8('0x7'));var _0x421581=new WebSocket(_0x26cc01||_0x87d8('0x7'),{'perMessageDeflate':![]});var _0x31a382='';var _0x366d98='0';var _0x7e4dc='1';var _0x3d85c3=_0x87d8('0x8');function _0x3d3b8f(_0x190eef){var _0x227625=crypto[_0x87d8('0x9')](_0x87d8('0xa'));_0x227625['update'](_0x190eef);return _0x227625[_0x87d8('0xb')](_0x87d8('0xc'));}function _0xc36696(){try{logger[_0x87d8('0xd')](_0x87d8('0xe'));var _0xf5617=moment()[_0x87d8('0xf')]();var _0x26a560=_0x3d3b8f(_0xf5617+_0x445400+_0x34ca6f);_0x421581[_0x87d8('0x10')](JSON[_0x87d8('0x11')]({'appID':_0x445400,'timestamp':_0xf5617,'appKey':_0x26a560}));var _0x66af46=fs[_0x87d8('0x12')](_0x239392);_0x66af46['on'](_0x87d8('0x13'),function(_0x5f51d1){_0x421581[_0x87d8('0x10')](_0x5f51d1);});_0x66af46['on']('close',function(){_0x421581[_0x87d8('0x10')](_0x87d8('0x14'));});}catch(_0x498ce7){logger[_0x87d8('0x15')](_0x87d8('0x16'),JSON[_0x87d8('0x11')](_0x498ce7));_0x421581['terminate']();}}function _0x50a5f6(_0x2b791d){try{if(_0x2b791d){var _0x4b0cb8=JSON[_0x87d8('0x17')](_0x2b791d);switch(_0x4b0cb8[_0x87d8('0x18')]){case 0x0:if(_0x4b0cb8[_0x87d8('0x19')]){if(_0x4b0cb8[_0x87d8('0x19')][_0x87d8('0x1a')]){logger['info'](_0x87d8('0x1b'),JSON[_0x87d8('0x11')](_0x4b0cb8[_0x87d8('0x19')][_0x87d8('0x1c')]));_0x31a382=_0x4b0cb8[_0x87d8('0x19')]['hypotheses'][0x0][_0x87d8('0x1d')];_0x366d98=_0x4b0cb8[_0x87d8('0x19')][_0x87d8('0x1c')][0x0]['likelihood'];_0x7e4dc='0';_0x3d85c3=_0x87d8('0x1e');_0x421581[_0x87d8('0x1f')]();}}break;case 0x1:logger['info'](_0x87d8('0x8'));_0x7e4dc='1';_0x3d85c3=_0x87d8('0x8');break;case 0x2:logger['info'](_0x87d8('0x20'));_0x7e4dc='2';_0x3d85c3='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x87d8('0xd')](_0x87d8('0x21'));_0x7e4dc='9';_0x3d85c3=_0x87d8('0x21');break;case 0xa:logger[_0x87d8('0xd')]('Authentication\x20failed.');_0x7e4dc='10';_0x3d85c3='Authentication\x20failed.';break;case 0xb:logger[_0x87d8('0xd')](_0x87d8('0x22'));_0x7e4dc='11';_0x3d85c3='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x4a50b0){logger[_0x87d8('0x15')](_0x87d8('0x23'),JSON['stringify'](_0x4a50b0));_0x421581[_0x87d8('0x1f')]();}}function _0x4d1f3e(){logger['info'](_0x87d8('0x24'));_0x2abff7({'transcript':_0x31a382,'confidence':_0x366d98,'status':_0x7e4dc,'status_message':_0x3d85c3});}function _0x341326(_0x43d63f){logger[_0x87d8('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x87d8('0x25')](_0x43d63f)){logger[_0x87d8('0x15')](_[_0x87d8('0x26')](_0x43d63f)?JSON[_0x87d8('0x11')](_0x43d63f):_0x43d63f);}}_0x421581['on'](_0x87d8('0x27'),_0xc36696);_0x421581['on'](_0x87d8('0x28'),_0x50a5f6);_0x421581['on'](_0x87d8('0x29'),_0x4d1f3e);_0x421581['on'](_0x87d8('0x15'),_0x341326);});}; \ 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 3c581bf..ad692f8 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 _0x3605=['./asr','exports'];(function(_0x4b5503,_0xb32b2c){var _0x233446=function(_0x16666c){while(--_0x16666c){_0x4b5503['push'](_0x4b5503['shift']());}};_0x233446(++_0xb32b2c);}(_0x3605,0xac));var _0x5360=function(_0x3843ba,_0x1314c4){_0x3843ba=_0x3843ba-0x0;var _0x4ad4de=_0x3605[_0x3843ba];return _0x4ad4de;};var asr=require(_0x5360('0x0'));module[_0x5360('0x1')]={'asr':asr}; \ No newline at end of file +var _0xf468=['exports','./asr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf468,0x1b3));var _0x8f46=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xf468[_0x34bf97];return _0x292719;};var asr=require(_0x8f46('0x0'));module[_0x8f46('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 3af8700..90c0e76 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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 73e8404..a7c6ce4 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 _0xd7ab=['aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','length','replaceAllVariables','saveRestApiResult','%s.%s','isArray','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','isConfigured','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','callback','scheduledAt','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','no\x20text\x20configured','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','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','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','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','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','unlink','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','beep','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechASR','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','agentLogin','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','retry','response','digit','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','opts','queue_id','indexOf','toLowerCase','QUEUE','macro','gosub','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','inspect','%s_STATUS_CODE','200','%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','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','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','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','answer','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','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','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','prototype','rpc','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','name','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','toString','callback_priority','getPauseById','agent','agentPause','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','url','method','timeout','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','speed','ispeech_asr_language','model','awsPolly'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xd7ab,0x14e));var _0xbd7a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd7ab[_0x3947c9];return _0x2e7871;};'use strict';var fs=require('fs');var util=require(_0xbd7a('0x0'));var _=require(_0xbd7a('0x1'));var sh=require(_0xbd7a('0x2'));var odbc=require(_0xbd7a('0x3'))();var rs=require(_0xbd7a('0x4'));var moment=require(_0xbd7a('0x5'));var Mustache=require(_0xbd7a('0x6'));var rp=require('request-promise');var logger=require('../../config/logger')('agi');var config=require(_0xbd7a('0x7'));var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH=_0xbd7a('0x8');var recursiveMapAttributes=[_0xbd7a('0x9'),_0xbd7a('0xa')];var verticesWithRetry=['menu',_0xbd7a('0xb'),_0xbd7a('0xc')];var AGIVertices=function(_0x50e9ce,_0x186c88,_0x5c8abe){this[_0xbd7a('0xd')]=_0x50e9ce;this['rpc']=_0x186c88;this['mailRpc']=_0x5c8abe;};AGIVertices[_0xbd7a('0xe')]['getVariable']=function(_0x559cde,_0x1ad26f){this[_0xbd7a('0xf')][_0xbd7a('0x10')](_0x559cde)[_0xbd7a('0x11')](function(_0x3294cd){_0x1ad26f(null,_0x3294cd?_0x3294cd['name']:![]);})[_0xbd7a('0x12')](function(_0x5393ee){_0x1ad26f(_0x5393ee);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x13')]=function(_0xfcb1ff,_0x354119){this[_0xbd7a('0xf')][_0xbd7a('0x14')](_0xfcb1ff)['then'](function(_0x384a57){_0x354119(null,_0x384a57?_0x384a57['name']:![]);})[_0xbd7a('0x12')](function(_0x520d5a){_0x354119(_0x520d5a);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x15')]=function(_0x2029c1,_0xcc7ad3){this[_0xbd7a('0xf')][_0xbd7a('0x16')](_0x2029c1)[_0xbd7a('0x11')](function(_0x5b063a){_0xcc7ad3(null,_0x5b063a?_0x5b063a['name']:![]);})['catch'](function(_0x32f048){_0xcc7ad3(_0x32f048);});};AGIVertices[_0xbd7a('0xe')]['getSquareOdbc']=function(_0x340229,_0x3869d3){this[_0xbd7a('0xf')][_0xbd7a('0x17')](_0x340229)[_0xbd7a('0x11')](function(_0x2d6e2f){_0x3869d3(null,_0x2d6e2f?_0x2d6e2f[_0xbd7a('0x18')]:![]);})[_0xbd7a('0x12')](function(_0x3fbe95){_0x3869d3(_0x3fbe95);});};AGIVertices['prototype'][_0xbd7a('0x19')]=function(_0x5ad9c6,_0x4b2842){this['rpc']['getUserById'](_0x5ad9c6)[_0xbd7a('0x11')](function(_0x1d53b0){_0x4b2842(null,_0x1d53b0?_0x1d53b0[_0xbd7a('0x1a')]:![]);})[_0xbd7a('0x12')](function(_0x16a97b){_0x4b2842(_0x16a97b);});};AGIVertices[_0xbd7a('0xe')]['getTrunk']=function(_0x1e5ad6,_0x54f251){this[_0xbd7a('0xf')]['getTrunkById'](_0x1e5ad6)[_0xbd7a('0x11')](function(_0x4bb83f){_0x54f251(null,_0x4bb83f?_0x4bb83f[_0xbd7a('0x1a')]:![]);})['catch'](function(_0x43b306){_0x54f251(_0x43b306);});};AGIVertices[_0xbd7a('0xe')]['getSound']=function(_0x2eb44c,_0x8ce570){var _0x77be59=this;this[_0xbd7a('0xf')][_0xbd7a('0x1b')](_0x2eb44c)[_0xbd7a('0x11')](function(_0x350005){_0x8ce570(null,_0x350005?_0x77be59['getSoundPath'](_0x350005[_0xbd7a('0x1c')]):![]);})[_0xbd7a('0x12')](function(_0x4e345e){_0x8ce570(_0x4e345e);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x1d')]=function(_0x269c15,_0x449266){this[_0xbd7a('0xf')][_0xbd7a('0x1e')](_0x269c15)[_0xbd7a('0x11')](function(_0x42bcf9){_0x449266(null,_0x42bcf9?_0x42bcf9:![]);})[_0xbd7a('0x12')](function(_0x46e8bf){_0x449266(_0x46e8bf);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x1f')]=function(_0x34f62f,_0x2a724f,_0x249ba3){this[_0xbd7a('0x20')][_0xbd7a('0x1f')](_0x34f62f,_0x2a724f)['then'](function(){_0x249ba3(null);})[_0xbd7a('0x12')](function(_0x4553b2){_0x249ba3(_0x4553b2);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x21')]=function(_0x23aca2,_0x5d3b4c){this[_0xbd7a('0xf')][_0xbd7a('0x22')](_0x23aca2)[_0xbd7a('0x11')](function(_0x57214d){if(_0x57214d){if(_0x57214d[_0xbd7a('0x23')]){_0x5d3b4c(null,[_0x57214d['interval']]);}else{_0x5d3b4c(null,_[_0xbd7a('0x24')](_0x57214d[_0xbd7a('0x25')],_0xbd7a('0x26')));}}else{_0x5d3b4c(null,![]);}})['catch'](function(_0x4dbc18){_0x5d3b4c(_0x4dbc18);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x27')]=function(_0x1d218e){return util[_0xbd7a('0x28')](_0xbd7a('0x29'),FILES_PATH,_0x1d218e);};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x2a')]=function(_0x211dd8,_0x16e3cc,_0x4bb853){odbc[_0xbd7a('0x2b')](_0x211dd8,function(_0x298896){if(_0x298896){logger[_0xbd7a('0x2c')](_0xbd7a('0x2d'),_0x298896);_0x4bb853(_0x298896);}else{logger[_0xbd7a('0x2e')](_0xbd7a('0x2f'));odbc['query'](_0x16e3cc,function(_0x84b6ab,_0x81c6f2){if(_0x84b6ab){logger[_0xbd7a('0x2e')]('Error\x20executing\x20query\x20%s',_0x16e3cc);_0x4bb853(_0x84b6ab);}else{logger[_0xbd7a('0x2e')](_0xbd7a('0x30'),_0x16e3cc);odbc['close'](function(_0x427850){if(_0x427850){logger[_0xbd7a('0x2c')](_0xbd7a('0x31'),_0x427850);}_0x4bb853(null,_0x81c6f2);});}});}});};AGIVertices['prototype'][_0xbd7a('0x32')]=function(_0x5ee1c4,_0x2576ed){this[_0xbd7a('0xf')][_0xbd7a('0x33')](_0x5ee1c4)[_0xbd7a('0x11')](function(_0x457979){_0x2576ed(null,_0x457979?_0x457979:![]);})['catch'](function(_0x162dd8){_0x2576ed(_0x162dd8);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x34')]=function(_0x574423,_0x500c5d){this['rpc'][_0xbd7a('0x34')](_0x574423)[_0xbd7a('0x11')](function(_0x5b86cd){_0x500c5d(null,_0x5b86cd);})[_0xbd7a('0x12')](function(_0xb248f2){_0x500c5d(_0xb248f2);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x35')]=function(_0x4748d1,_0x4df0a7,_0x183ba9){this[_0xbd7a('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0xbd7a('0xd')][_0xbd7a('0x36')],'node':_0x4748d1[_0xbd7a('0x37')],'application':_0x4748d1[_0xbd7a('0x38')],'data':_0x4df0a7||null,'project_name':this['channel'][_0xbd7a('0x39')],'callerid':this['channel']['callerid']})['then'](function(_0x18920d){if(_0x183ba9){_0x183ba9(null,_0x18920d);}})[_0xbd7a('0x12')](function(_0x504c3a){if(_0x183ba9){_0x183ba9(_0x504c3a);}});};AGIVertices[_0xbd7a('0xe')]['createSquareRecording']=function(_0x1f0deb,_0x2f0d8e,_0x21d780,_0x2a5b67){this[_0xbd7a('0xf')][_0xbd7a('0x3a')]({'uniqueid':this[_0xbd7a('0xd')][_0xbd7a('0x36')],'callerid':this[_0xbd7a('0xd')][_0xbd7a('0x3b')],'calleridname':this['channel'][_0xbd7a('0x3c')],'context':this[_0xbd7a('0xd')]['context'],'extension':this['channel'][_0xbd7a('0x3d')],'priority':this[_0xbd7a('0xd')][_0xbd7a('0x3e')],'accountcode':this[_0xbd7a('0xd')][_0xbd7a('0x3f')],'dnid':this[_0xbd7a('0xd')][_0xbd7a('0x40')],'projectName':this[_0xbd7a('0xd')][_0xbd7a('0x39')],'saveName':_0x2f0d8e,'filename':_0x1f0deb[_0xbd7a('0x41')]||_0x2f0d8e,'savePath':_0x21d780})[_0xbd7a('0x11')](function(_0x526457){_0x2a5b67(null,_0x526457);})['catch'](function(_0x5eb34a){_0x2a5b67(_0x5eb34a);});};AGIVertices[_0xbd7a('0xe')]['createSquareMessage']=function(_0x1b3a57,_0x37a7ec,_0x50d698,_0x240ecb,_0x667096){this['rpc'][_0xbd7a('0x42')]({'uniqueid':this[_0xbd7a('0xd')]['uniqueid'],'body':_0x1b3a57,'direction':_0x37a7ec,'providerName':_0x50d698,'providerResponse':_0x240ecb})['then'](function(_0xc06c21){if(_0x667096){_0x667096(null,_0xc06c21);}})['catch'](function(_0x51aa02){if(_0x667096){_0x667096(_0x51aa02);}});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x43')]=function(_0x1cd754,_0x51b3bc){this['rpc']['createCmContact']({'firstName':_[_0xbd7a('0x44')](_0x1cd754['name'])||_[_0xbd7a('0x45')](_0x1cd754[_0xbd7a('0x1a')])?_0xbd7a('0x46')+Math[_0xbd7a('0x47')]():_0x1cd754[_0xbd7a('0x1a')],'lastName':_[_0xbd7a('0x44')](_0x1cd754[_0xbd7a('0x48')])||_['isNil'](_0x1cd754['lastName'])?null:_0x1cd754['lastName'],'phone':_0x1cd754[_0xbd7a('0x49')],'ListId':_0x1cd754[_0xbd7a('0x4a')],'scheduledat':_0x1cd754['scheduledAt'],'callbackUniqueid':this[_0xbd7a('0xd')]['uniqueid'],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x1cd754['scheduledAt'][_0xbd7a('0x4b')](),'priority':_0x1cd754[_0xbd7a('0x4c')]})[_0xbd7a('0x11')](function(_0x14a6f2){_0x51b3bc(null,_0x14a6f2);})[_0xbd7a('0x12')](function(_0x4ebbdb){_0x51b3bc(_0x4ebbdb);});};AGIVertices[_0xbd7a('0xe')]['getPause']=function(_0x468321,_0x1a5083){this[_0xbd7a('0xf')][_0xbd7a('0x4d')](_0x468321)[_0xbd7a('0x11')](function(_0x3d7fe0){_0x1a5083(null,_0x3d7fe0?_0x3d7fe0['name']:![]);})[_0xbd7a('0x12')](function(_0x2ace6e){_0x1a5083(_0x2ace6e);});};AGIVertices[_0xbd7a('0xe')]['agentPause']=function(_0x11616d,_0x369a22,_0x22fcaa){var _0x5f4b5d={'role':_0xbd7a('0x4e')};_0x5f4b5d[_0x11616d]=this['channel'][_0xbd7a('0x3b')];this[_0xbd7a('0xf')][_0xbd7a('0x4f')](_0x5f4b5d,_0x369a22,this[_0xbd7a('0xd')]['uniqueid'])[_0xbd7a('0x11')](function(_0x4b231c){_0x22fcaa(null,_[_0xbd7a('0x45')](_0x4b231c)?![]:!![]);})['catch'](function(_0x25aa46){logger[_0xbd7a('0x2c')](_0x25aa46);_0x22fcaa(null,![]);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x50')]=function(_0xba33a8,_0x5e8f0a){var _0x39e5d7={'role':'agent'};_0x39e5d7[_0xba33a8]=this[_0xbd7a('0xd')][_0xbd7a('0x3b')];this[_0xbd7a('0xf')][_0xbd7a('0x50')](_0x39e5d7)['then'](function(_0x4cfca9){_0x5e8f0a(null,_[_0xbd7a('0x45')](_0x4cfca9)?![]:!![]);})[_0xbd7a('0x12')](function(_0xab167a){logger[_0xbd7a('0x2c')](_0xab167a);_0x5e8f0a(null,![]);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x51')]=function(_0x2ddd5f,_0x59f833){var _0x4fc0fb={'role':_0xbd7a('0x4e')};_0x4fc0fb[_0x2ddd5f]=this[_0xbd7a('0xd')]['callerid'];this[_0xbd7a('0xf')][_0xbd7a('0x51')](_0x4fc0fb)[_0xbd7a('0x11')](function(_0x4bf063){_0x59f833(null,_[_0xbd7a('0x45')](_0x4bf063)?![]:!![]);})[_0xbd7a('0x12')](function(_0x273b18){logger[_0xbd7a('0x2c')](_0x273b18);_0x59f833(null,![]);});};AGIVertices[_0xbd7a('0xe')]['agentLogin']=function(_0x58707,_0x286bb4){var _0x12f760={'role':'agent'};_0x12f760[_0x58707]=this['channel']['callerid'];var _0x1cf3b4=_0x58707!=_0xbd7a('0x52')?util[_0xbd7a('0x28')](_0xbd7a('0x53'),'LOCAL',this['channel'][_0xbd7a('0x3b')]):undefined;this[_0xbd7a('0xf')]['agentLogin'](_0x12f760,_0x1cf3b4)[_0xbd7a('0x11')](function(_0x4241cb){_0x286bb4(null,_[_0xbd7a('0x45')](_0x4241cb)?![]:!![]);})[_0xbd7a('0x12')](function(_0x38621a){logger[_0xbd7a('0x2c')](_0x38621a);_0x286bb4(null,![]);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x54')]=function(_0x5a0b0f,_0x415d66){sh[_0xbd7a('0x55')](_[_0xbd7a('0x56')](_0x5a0b0f),function(_0x4057b5,_0x21c38b){var _0xae2cd0=_0x21c38b[_0xbd7a('0x57')](/(\r\n|\n|\r)/gm,'');_0x415d66(null,_0xae2cd0);});};AGIVertices[_0xbd7a('0xe')]['googleCloudTTS']=function(_0x4926d4,_0x4f944b){scripts[_0xbd7a('0x58')](_0x4926d4['apiKey'],_0x4926d4[_0xbd7a('0x59')]||_0xbd7a('0x5a'),_0x4926d4[_0xbd7a('0x5a')],_0x4926d4['languageCode']||_0xbd7a('0x5b'),_0x4926d4[_0xbd7a('0x5c')]||_0xbd7a('0x5d'),_0x4926d4[_0xbd7a('0x5e')]||'MP3')['then'](function(_0x3082bd){_0x4f944b(null,_0x3082bd);})[_0xbd7a('0x12')](function(_0x1633db){_0x4f944b(_0x1633db);});};AGIVertices['prototype'][_0xbd7a('0x5f')]=function(_0x38d72f,_0x522fe8){scripts[_0xbd7a('0x5f')](_0x38d72f['text'],_0x38d72f[_0xbd7a('0x60')]||'en',0x1)['then'](function(_0x552a4a){_0x522fe8(null,_0x552a4a);})[_0xbd7a('0x12')](function(_0x3b36c2){_0x522fe8(_0x3b36c2);});};AGIVertices[_0xbd7a('0xe')]['restAPI']=function(_0x42ea6c,_0x20cc98){var _0x44a3a5={'uri':_0x42ea6c[_0xbd7a('0x61')],'method':_0x42ea6c[_0xbd7a('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x42ea6c[_0xbd7a('0x63')])==='number'&&parseInt(_0x42ea6c[_0xbd7a('0x63')])>=0x1?parseInt(_0x42ea6c[_0xbd7a('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xbd7a('0x64'),_0xbd7a('0x65')],_0x44a3a5[_0xbd7a('0x62')][_0xbd7a('0x66')]())){try{_0x44a3a5['body']=_0x42ea6c[_0xbd7a('0xa')]?JSON[_0xbd7a('0x67')](_0x42ea6c[_0xbd7a('0xa')]):{};}catch(_0x51d94d){logger[_0xbd7a('0x2c')](_0xbd7a('0x68'),_0x51d94d);}}try{_0x44a3a5[_0xbd7a('0x69')]=_0x42ea6c[_0xbd7a('0x9')]?JSON[_0xbd7a('0x67')](_0x42ea6c['rawHeaders']):{};}catch(_0x31e39c){logger[_0xbd7a('0x2c')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x31e39c);}if(_0x42ea6c[_0xbd7a('0x6a')]){try{var _0x7dc37d=require(_0x42ea6c[_0xbd7a('0x6a')])[_0xbd7a('0x6b')](this,_0x44a3a5);_0x44a3a5[_0xbd7a('0x6c')]=Mustache[_0xbd7a('0x6d')](_0x42ea6c[_0xbd7a('0x61')],_0x7dc37d,{},['$$','$$']);if(_0x44a3a5[_0xbd7a('0x69')]){_0x44a3a5[_0xbd7a('0x69')]=JSON['parse'](Mustache[_0xbd7a('0x6d')](JSON['stringify'](_0x44a3a5['headers']),_0x7dc37d,{},['$$','$$']));}if(_0x44a3a5[_0xbd7a('0x6e')]){_0x44a3a5[_0xbd7a('0x6e')]=JSON[_0xbd7a('0x67')](Mustache[_0xbd7a('0x6d')](JSON[_0xbd7a('0x6f')](_0x44a3a5[_0xbd7a('0x6e')]),_0x7dc37d,{},['$$','$$']));}}catch(_0xb13c3e){logger['error'](_0xbd7a('0x70'),_0xb13c3e);}}rp(_0x44a3a5)[_0xbd7a('0x11')](function(_0x25e52f){var _0x5ab98a={'statusCode':_0x25e52f['statusCode']||0xc8,'statusMessage':_0x25e52f[_0xbd7a('0x71')]||'OK','headers':_0x25e52f['headers']||{},'body':_0x25e52f[_0xbd7a('0x6e')]||{}};_0x20cc98(null,_0x5ab98a);})['catch'](function(_0x5b4f78){var _0x1dae1a={'statusCode':_0x5b4f78[_0xbd7a('0x72')]||0x1f4,'statusMessage':_0x5b4f78[_0xbd7a('0x73')]||_0xbd7a('0x74'),'headers':_0x5b4f78[_0xbd7a('0x75')][_0xbd7a('0x69')]||{},'body':_0x5b4f78[_0xbd7a('0x75')][_0xbd7a('0x6e')]||{}};_0x20cc98(null,_0x1dae1a);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x76')]=function(_0x14f1e0,_0xe1b35e){scripts['googleDialogflow'](this[_0xbd7a('0xd')][_0xbd7a('0x36')],_0x14f1e0['key'],_0x14f1e0[_0xbd7a('0x5a')],_0x14f1e0[_0xbd7a('0x77')]||'en')[_0xbd7a('0x11')](function(_0x11dbb6){_0xe1b35e(null,_0x11dbb6);})[_0xbd7a('0x12')](function(_0x215351){_0xe1b35e(_0x215351);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x78')]=function(_0x575fd9,_0x3abaa4){scripts['googleDialogflowV2'](this[_0xbd7a('0xd')][_0xbd7a('0x36')],_0x575fd9[_0xbd7a('0x79')],_0x575fd9[_0xbd7a('0x7a')],_0x575fd9[_0xbd7a('0x7b')],_0x575fd9[_0xbd7a('0x5a')],_0x575fd9[_0xbd7a('0x7c')]||'en')[_0xbd7a('0x11')](function(_0xcfad3c){_0x3abaa4(null,_0xcfad3c);})['catch'](function(_0x124653){_0x3abaa4(_0x124653);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x7d')]=function(_0x1292e6,_0x414502){scripts[_0xbd7a('0x7d')](this['channel'],_0x1292e6)[_0xbd7a('0x11')](function(_0x1bf2f4){_0x414502(null,_0x1bf2f4);})[_0xbd7a('0x12')](function(_0x1bca6c){_0x414502(_0x1bca6c);});};AGIVertices[_0xbd7a('0xe')]['ispeechTTS']=function(_0x44b444,_0x5afa1e){scripts[_0xbd7a('0x7e')](_0x44b444[_0xbd7a('0x7f')],_0x44b444['text'],_0x44b444['ispeech_tts_language']||_0xbd7a('0x5b'),_0x44b444[_0xbd7a('0x80')])[_0xbd7a('0x11')](function(_0x249581){_0x5afa1e(null,_0x249581);})['catch'](function(_0xa4f7d8){_0x5afa1e(_0xa4f7d8);});};AGIVertices['prototype']['ispeechASR']=function(_0x16b692,_0x3df965,_0x550591){scripts['ispeechASR'](_0x3df965,_0x16b692[_0xbd7a('0x7f')],_0x16b692[_0xbd7a('0x81')]||_0xbd7a('0x5b'),this['isConfigured'](_0x16b692[_0xbd7a('0x82')])?_0x16b692['model']:undefined)[_0xbd7a('0x11')](function(_0x18c452){_0x550591(null,_0x18c452);})[_0xbd7a('0x12')](function(_0x5f4679){_0x550591(_0x5f4679);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x83')]=function(_0x58d740,_0x302967){scripts[_0xbd7a('0x83')](_0x58d740['aws_access_key_id'],_0x58d740[_0xbd7a('0x84')],_0x58d740['aws_polly_region'],_0x58d740[_0xbd7a('0x85')]||_0xbd7a('0x86'),_0x58d740[_0xbd7a('0x5a')],_0x58d740[_0xbd7a('0x87')]||_0xbd7a('0x5a'))[_0xbd7a('0x11')](function(_0x126855){_0x302967(null,_0x126855);})[_0xbd7a('0x12')](function(_0x1dccc7){_0x302967(_0x1dccc7);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x88')]=function(_0x3a72fb,_0x396e50){scripts['awsLex'](this[_0xbd7a('0xd')][_0xbd7a('0x36')],_0x3a72fb['aws_access_key_id'],_0x3a72fb['aws_secret_access_key'],_0x3a72fb[_0xbd7a('0x89')],_0x3a72fb[_0xbd7a('0x5a')],_0x3a72fb[_0xbd7a('0x8a')])[_0xbd7a('0x11')](function(_0x14abb4){_0x396e50(null,_0x14abb4);})[_0xbd7a('0x12')](function(_0x522ced){_0x396e50(_0x522ced);});};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x8b')]=function(_0x40b862,_0x2383dd,_0x3e0f27){scripts[_0xbd7a('0x8b')](_0x2383dd,_0x40b862['key'],_0x40b862[_0xbd7a('0x8c')]||_0xbd7a('0x5b'))[_0xbd7a('0x11')](function(_0x140167){_0x3e0f27(null,_0x140167);})[_0xbd7a('0x12')](function(_0x157518){_0x3e0f27(_0x157518);});};AGIVertices['prototype'][_0xbd7a('0x8d')]=function(_0x2ca152,_0x3a170c,_0x5cb66d){scripts[_0xbd7a('0x8d')](_0x3a170c,_0x2ca152[_0xbd7a('0x8e')],_0x2ca152['appsecret'],_0x2ca152[_0xbd7a('0x6c')])[_0xbd7a('0x11')](function(_0x1c9859){_0x5cb66d(null,_0x1c9859);})[_0xbd7a('0x12')](function(_0x13275a){_0x5cb66d(_0x13275a);});};AGIVertices['prototype'][_0xbd7a('0x8f')]=function(_0x4b41a2){var _0x3dfc0a=_[_0xbd7a('0x90')](verticesWithRetry,_0x4b41a2[_0xbd7a('0x38')])?_0x4b41a2:_[_0xbd7a('0x91')](_0x4b41a2);for(var _0x41001c in _0x3dfc0a){if(_0x3dfc0a[_0xbd7a('0x92')](_0x41001c)){if(_0x3dfc0a[_0x41001c]&&_[_0xbd7a('0x93')](_0x3dfc0a[_0x41001c])){if(_[_0xbd7a('0x90')](recursiveMapAttributes,_0x41001c)){_0x3dfc0a[_0x41001c]=this[_0xbd7a('0x94')](_0x3dfc0a[_0x41001c]);}else{_0x3dfc0a[_0x41001c]=this['replaceAllVariables'](_0x3dfc0a[_0x41001c]);}}}}return _0x3dfc0a;};AGIVertices['prototype'][_0xbd7a('0x95')]=function(_0x258419){for(var _0x328de1 in _0x258419){if(_0x258419['hasOwnProperty'](_0x328de1)){if(_[_0xbd7a('0x96')](_0x258419[_0x328de1])){this[_0xbd7a('0x95')](_0x258419[_0x328de1]);}else if(_['isArray'](_0x258419[_0x328de1])){for(var _0x540a80=0x0;_0x540a80<_0x258419[_0x328de1][_0xbd7a('0x97')];_0x540a80++){this[_0xbd7a('0x95')](_0x258419[_0x328de1][_0x540a80]);}}else if(_[_0xbd7a('0x93')](_0x258419[_0x328de1])){_0x258419[_0x328de1]=this[_0xbd7a('0x98')](_0x258419[_0x328de1]);}}}};AGIVertices[_0xbd7a('0xe')]['saveRestApiResult']=function(_0x490fc8,_0x167286){for(var _0x3630cf in _0x490fc8){if(_0x490fc8[_0xbd7a('0x92')](_0x3630cf)){if(_[_0xbd7a('0x96')](_0x490fc8[_0x3630cf])){if(!_[_0xbd7a('0x44')](_0x490fc8[_0x3630cf])){this[_0xbd7a('0x99')](_0x490fc8[_0x3630cf],util[_0xbd7a('0x28')](_0xbd7a('0x9a'),_0x167286,_0x3630cf));}}else if(_[_0xbd7a('0x9b')](_0x490fc8[_0x3630cf])){for(var _0x5e7bbc=0x0;_0x5e7bbc<_0x490fc8[_0x3630cf]['length'];_0x5e7bbc++){this[_0xbd7a('0x99')](_0x490fc8[_0x3630cf][_0x5e7bbc],util[_0xbd7a('0x28')](_0xbd7a('0x9a'),_0x167286,_0x3630cf+'['+_0x5e7bbc+']'));}}else{if(!_['isNil'](_0x490fc8[_0x3630cf])){this[_0xbd7a('0xd')][_0xbd7a('0x9c')](util[_0xbd7a('0x28')](_0xbd7a('0x9a'),_0x167286,_0x3630cf),_0x490fc8[_0x3630cf]);}}}}};AGIVertices['prototype'][_0xbd7a('0x94')]=function(_0x55acbd){try{var _0x1cc934=JSON[_0xbd7a('0x67')](_0x55acbd);this['recursiveNodeIndex'](_0x1cc934);return JSON[_0xbd7a('0x6f')](_0x1cc934);}catch(_0x4085ea){return this[_0xbd7a('0x98')](_0x55acbd);}};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x98')]=function(_0x4fbb39){var _0x38e574=_0x4fbb39['split']('{');for(var _0x254a8c=0x1;_0x254a8c<_0x38e574[_0xbd7a('0x97')];_0x254a8c+=0x1){var _0x40e84c=_0x38e574[_0x254a8c][_0xbd7a('0x9d')]('}');if(_0x40e84c[_0xbd7a('0x97')]>0x1){_0x4fbb39=_0x4fbb39[_0xbd7a('0x9e')]('{'+_0x40e84c[0x0]+'}',this[_0xbd7a('0xd')][_0xbd7a('0x9f')](_0x40e84c[0x0])[_0xbd7a('0xa0')]||_0x40e84c[0x0]);}}if(_0x38e574['length']===0x1){return _0x4fbb39[_0xbd7a('0x4b')]();}return this['replaceAllVariables'](_0x4fbb39);};AGIVertices['prototype'][_0xbd7a('0xa1')]=function(_0x487c97,_0x3e00ee){var _0x50d46c=this[_0xbd7a('0xd')][_0xbd7a('0x9f')](_0x487c97);if(_0x50d46c[_0xbd7a('0xa2')]===-0x1){return _0x50d46c;}logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0xa3'),_0x3e00ee,_0x50d46c[_0xbd7a('0xa0')]));return this[_0xbd7a('0xd')][_0xbd7a('0x9c')](_0x3e00ee,_0x50d46c[_0xbd7a('0xa0')]);};AGIVertices[_0xbd7a('0xe')]['isConfigured']=function(_0x47c218){return _0x47c218&&_0x47c218!=='0'&&_0x47c218!=='-1'&&_0x47c218!=='';};AGIVertices['prototype'][_0xbd7a('0xa4')]=function(_0x40bd31){this[_0xbd7a('0x35')]['sync'](this,_0x40bd31,'-');_0x40bd31['retry']=_0x40bd31['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0xa5')]=function(_0x4c1081){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x4c1081[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x4c1081[_0xbd7a('0x5a')])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')]('no\x20text\x20configured');}var _0x456253='\x22'+_0x4c1081[_0xbd7a('0x5a')]+'\x22';if(this[_0xbd7a('0xa6')](_0x4c1081[_0xbd7a('0x75')])){_0x456253+=','+_0x4c1081[_0xbd7a('0x75')];}var _0x27dad6=this[_0xbd7a('0xd')]['exec'](_0xbd7a('0xa8'),_0x456253);if(_0x27dad6[_0xbd7a('0xa2')]===-0x1){return _0x27dad6;}return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0xa9'),_0x456253));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0xaa')]=function(_0x2e3117){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x2e3117['label']));if(!this['isConfigured'](_0x2e3117[_0xbd7a('0xab')])){return this[_0xbd7a('0xd')]['noop'](_0xbd7a('0xac'));}var _0x1fc902=_0x2e3117[_0xbd7a('0xab')];if(this['isConfigured'](_0x2e3117[_0xbd7a('0x75')])){_0x1fc902+=','+_0x2e3117[_0xbd7a('0x75')];}var _0x84a48b=this[_0xbd7a('0xd')][_0xbd7a('0x55')](_0xbd7a('0xad'),_0x1fc902);if(_0x84a48b[_0xbd7a('0xa2')]===-0x1){return _0x84a48b;}var _0x287aa3=this['getAndSetVariable'](_0xbd7a('0xae'),_0xbd7a('0xaf'));if(_0x287aa3[_0xbd7a('0xa2')]===-0x1){return _0x287aa3;}var _0x3dec5a=this['getAndSetVariable'](_0xbd7a('0xb0'),_0xbd7a('0xb1'));if(_0x3dec5a[_0xbd7a('0xa2')]===-0x1){return _0x3dec5a;}var _0x5401ae=this['getAndSetVariable'](_0xbd7a('0xb2'),_0xbd7a('0xb3'));if(_0x5401ae[_0xbd7a('0xa2')]===-0x1){return _0x5401ae;}return this['channel']['noop'](util[_0xbd7a('0x28')](_0xbd7a('0xb4'),_0x1fc902));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0xb5')]=function(_0xcdf28e){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0xb6'),_0xcdf28e[_0xbd7a('0x37')]));return this['channel'][_0xbd7a('0xb5')]([_0xcdf28e['command'],_0xcdf28e['args']]);};AGIVertices[_0xbd7a('0xe')]['answer']=function(_0x372e67){logger[_0xbd7a('0x2e')](util['format'](_0xbd7a('0xb7'),_0x372e67[_0xbd7a('0x37')]));if(this['isConfigured'](_0x372e67[_0xbd7a('0x63')])){logger['info'](util[_0xbd7a('0x28')](_0xbd7a('0xb8'),_0x372e67[_0xbd7a('0x63')]));var _0x358e2f=this[_0xbd7a('0xd')]['wait'](_0x372e67[_0xbd7a('0x63')]);if(_0x358e2f[_0xbd7a('0xa2')]===-0x1){return _0x358e2f;}}return this['channel']['answer']();};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0xb9')]=function(_0x35ad81){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x35ad81[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x35ad81[_0xbd7a('0x4a')])){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x35ad81,'no\x20list\x20selected');}_0x35ad81[_0xbd7a('0xba')]=moment();if(this[_0xbd7a('0xa6')](_0x35ad81[_0xbd7a('0xbb')])){_0x35ad81[_0xbd7a('0xba')]=moment()['add'](_0x35ad81[_0xbd7a('0xbb')],_0xbd7a('0xbc'));}if(!this[_0xbd7a('0xa6')](_0x35ad81[_0xbd7a('0x4c')])){_0x35ad81['callback_priority']=0x2;}this['createCmContact'][_0xbd7a('0x6b')](this,_0x35ad81);return this['channel'][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0xbd'),_0x35ad81[_0xbd7a('0x49')],_0x35ad81[_0xbd7a('0x4a')],_0x35ad81[_0xbd7a('0xba')]));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0xbe')]=function(_0x4b4781){logger[_0xbd7a('0x2e')](util['format'](_0xbd7a('0xbf'),_0x4b4781[_0xbd7a('0x37')]));var _0x53a259=this[_0xbd7a('0xd')][_0xbd7a('0x55')](_0x4b4781['application'],_0x4b4781[_0xbd7a('0x75')]);if(_0x53a259['result']===-0x1){return _0x53a259;}return this['channel']['noop'](util[_0xbd7a('0x28')](_0xbd7a('0xc0'),_0x4b4781[_0xbd7a('0xc1')],_0x4b4781[_0xbd7a('0x75')]));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0xc2')]=function(_0x9295fb){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x9295fb[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x9295fb['text'])){return this[_0xbd7a('0xd')]['noop'](_0xbd7a('0xc3'));}var _0x150aff='\x22'+_0x9295fb[_0xbd7a('0x5a')]+'\x22';if(this[_0xbd7a('0xa6')](_0x9295fb['options'])){_0x150aff+=','+_0x9295fb[_0xbd7a('0x75')];}var _0x10d27b=this[_0xbd7a('0xd')][_0xbd7a('0x55')]('MRCPSynth',_0x150aff);if(_0x10d27b[_0xbd7a('0xa2')]===-0x1){return _0x10d27b;}return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util['format'](_0xbd7a('0xa9'),_0x150aff));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0xc4')]=function(_0x503536){logger[_0xbd7a('0x2e')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x503536['label']));if(!this[_0xbd7a('0xa6')](_0x503536[_0xbd7a('0x5a')])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0xc3'));}var _0x566cf8='\x22'+_0x503536['text']+'\x22';if(this['isConfigured'](_0x503536[_0xbd7a('0x75')])){_0x566cf8+=','+_0x503536[_0xbd7a('0x75')];}var _0x51a857=this[_0xbd7a('0xd')][_0xbd7a('0x55')](_0xbd7a('0xa8'),_0x566cf8);if(_0x51a857[_0xbd7a('0xa2')]===-0x1){return _0x51a857;}return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util['format'](_0xbd7a('0xa9'),_0x566cf8));};AGIVertices['prototype'][_0xbd7a('0xc5')]=function(_0x4e57ee){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0xc6'),_0x4e57ee[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x4e57ee[_0xbd7a('0xab')])){return this[_0xbd7a('0xd')]['noop']('no\x20grammar\x20configured');}var _0x538a3d=_0x4e57ee[_0xbd7a('0xab')];if(this[_0xbd7a('0xa6')](_0x4e57ee[_0xbd7a('0x75')])){_0x538a3d+=','+_0x4e57ee[_0xbd7a('0x75')];}var _0x1aeef3=this[_0xbd7a('0xd')][_0xbd7a('0x55')](_0xbd7a('0xad'),_0x538a3d);if(_0x1aeef3[_0xbd7a('0xa2')]===-0x1){return _0x1aeef3;}var _0x56a349=this[_0xbd7a('0xa1')](_0xbd7a('0xae'),_0xbd7a('0xc7'));if(_0x56a349[_0xbd7a('0xa2')]===-0x1){return _0x56a349;}var _0x4c6bc3=this[_0xbd7a('0xa1')]('RECOG_INPUT()',_0xbd7a('0xc8'));if(_0x4c6bc3['result']===-0x1){return _0x4c6bc3;}var _0x22c0b8=this[_0xbd7a('0xa1')](_0xbd7a('0xb2'),_0xbd7a('0xc9'));if(_0x22c0b8['result']===-0x1){return _0x22c0b8;}return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0xb4'),_0x538a3d));};AGIVertices[_0xbd7a('0xe')]['sestekasr']=function(_0x58665c){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0xca'),_0x58665c[_0xbd7a('0x37')]));if(!this['isConfigured'](_0x58665c[_0xbd7a('0xab')])){return this['channel']['noop'](_0xbd7a('0xac'));}var _0x53bf41=_0x58665c[_0xbd7a('0xab')];if(this[_0xbd7a('0xa6')](_0x58665c[_0xbd7a('0x75')])){_0x53bf41+=','+_0x58665c[_0xbd7a('0x75')];}var _0x4573bd=this[_0xbd7a('0xd')][_0xbd7a('0x55')](_0xbd7a('0xad'),_0x53bf41);if(_0x4573bd['result']===-0x1){return _0x4573bd;}var _0x17301d=this[_0xbd7a('0xa1')](_0xbd7a('0xae'),'SESTEK_ASR_CONFIDENCE');if(_0x17301d[_0xbd7a('0xa2')]===-0x1){return _0x17301d;}var _0x18f099=this[_0xbd7a('0xa1')]('RECOG_INPUT()',_0xbd7a('0xcb'));if(_0x18f099['result']===-0x1){return _0x18f099;}var _0x25ce79=this['getAndSetVariable'](_0xbd7a('0xb2'),_0xbd7a('0xcc'));if(_0x25ce79[_0xbd7a('0xa2')]===-0x1){return _0x25ce79;}return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0xb4'),_0x53bf41));};AGIVertices[_0xbd7a('0xe')]['database']=function(_0x263cc9){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0xcd'),_0x263cc9[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x263cc9[_0xbd7a('0xce')])){return this['channel'][_0xbd7a('0x2c')](_0x263cc9,_0xbd7a('0xcf'));}var _0x37b010=this[_0xbd7a('0xd0')][_0xbd7a('0x6b')](this,_0x263cc9['odbc_id']);if(!_0x37b010){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x263cc9,_0xbd7a('0xd1'));}if(!this['isConfigured'](_0x263cc9[_0xbd7a('0xd2')])){return this[_0xbd7a('0xd')]['error'](_0x263cc9,'no\x20query\x20configured');}var _0x966016=_0x263cc9['query'][_0xbd7a('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xbd7a('0xd')]['noop'](util['format'](_0xbd7a('0xd3'),_0x966016));var _0x54aed9=this[_0xbd7a('0x2a')][_0xbd7a('0x6b')](this,_0x37b010,_0x966016);this[_0xbd7a('0x35')]['sync'](this,_0x263cc9,_0x966016);if(!this[_0xbd7a('0xa6')](_0x263cc9[_0xbd7a('0xd4')])){return this[_0xbd7a('0xd')]['noop'](_0xbd7a('0xd5'));}var _0x120d0e=this[_0xbd7a('0x9f')]['sync'](this,_0x263cc9[_0xbd7a('0xd4')]);if(!_0x120d0e){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x263cc9,_0xbd7a('0xd6'));}var _0x4999bd=this;_0x54aed9[_0xbd7a('0xd7')](function(_0x3e7948,_0x27f536){Object[_0xbd7a('0xd8')](_0x3e7948)[_0xbd7a('0xd7')](function(_0x5bb06f){_0x4999bd['channel']['setVariable'](util['format'](_0xbd7a('0xd9'),_0x120d0e,_0x27f536,_0x5bb06f),_0x3e7948[_0x5bb06f]);});});this['channel'][_0xbd7a('0x9c')](util['format'](_0xbd7a('0xda'),_0x120d0e),_0x54aed9[_0xbd7a('0x97')]);return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util['format'](_0xbd7a('0xdb'),_0x120d0e));};AGIVertices['prototype'][_0xbd7a('0xdc')]=function(_0x2f3a4f){logger[_0xbd7a('0xdd')](util[_0xbd7a('0x28')](_0xbd7a('0xde'),_0x2f3a4f['label']));if(!this['isConfigured'](_0x2f3a4f[_0xbd7a('0xdf')])){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x2f3a4f,_0xbd7a('0xe0'));}var _0x55f8a6=this[_0xbd7a('0x19')][_0xbd7a('0x6b')](this,_0x2f3a4f[_0xbd7a('0xdf')]);if(!_0x55f8a6){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x2f3a4f,_0xbd7a('0xe1'));}var _0x2d02fd=this[_0xbd7a('0xd')][_0xbd7a('0x55')](_0xbd7a('0xe2'),[util[_0xbd7a('0x28')](_0xbd7a('0xe3'),_0x55f8a6),_0x2f3a4f[_0xbd7a('0x63')],_0x2f3a4f['opts'],_0x2f3a4f[_0xbd7a('0x61')]]);if(_0x2d02fd[_0xbd7a('0xa2')]===-0x1){return _0x2d02fd;}return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0xe4'),_0xbd7a('0xe2')));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0xe5')]=function(_0x3f3dea){logger[_0xbd7a('0x2e')](util['format'](_0xbd7a('0xe6'),_0x3f3dea[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x3f3dea[_0xbd7a('0x7f')])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0xe7'));}if(!this[_0xbd7a('0xa6')](_0x3f3dea[_0xbd7a('0x5a')])){return this['channel'][_0xbd7a('0xa7')](_0xbd7a('0xc3'));}this[_0xbd7a('0xd')][_0xbd7a('0xe8')]=!![];this[_0xbd7a('0x35')](_0x3f3dea);this[_0xbd7a('0x42')](_0x3f3dea[_0xbd7a('0x5a')],'in','','');this['channel'][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0xe9'),_0x3f3dea[_0xbd7a('0x5a')]));var _0x3a92d0=this[_0xbd7a('0x76')]['sync'](this,_0x3f3dea);if(_0x3a92d0){for(var _0x494c42 in _0x3a92d0){if(_0x3a92d0[_0xbd7a('0x92')](_0x494c42)){this[_0xbd7a('0xd')][_0xbd7a('0x9c')](util[_0xbd7a('0x28')]('DIALOGFLOW_%s',_0x494c42[_0xbd7a('0x66')]()),_0x3a92d0[_0x494c42]);}}this[_0xbd7a('0x42')](_0x3a92d0[_0xbd7a('0xea')],'out',_0xbd7a('0xe5'),'');return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0xeb'),_0x3a92d0[_0xbd7a('0xea')]));}return this['channel'][_0xbd7a('0x2c')](_0x3f3dea,_0xbd7a('0xec'));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0xed')]=function(_0x1961b4){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x1961b4[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x1961b4['dialogflowV2_project_id'])){return this['channel'][_0xbd7a('0xa7')](_0xbd7a('0xee'));}if(!this['isConfigured'](_0x1961b4[_0xbd7a('0x7a')])){return this['channel'][_0xbd7a('0xa7')](_0xbd7a('0xef'));}if(!this[_0xbd7a('0xa6')](_0x1961b4['private_key'])){return this[_0xbd7a('0xd')]['noop'](_0xbd7a('0xf0'));}if(!this[_0xbd7a('0xa6')](_0x1961b4[_0xbd7a('0x7c')])){return this['channel'][_0xbd7a('0xa7')](_0xbd7a('0xf1'));}if(!this['isConfigured'](_0x1961b4[_0xbd7a('0x5a')])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0xc3'));}this[_0xbd7a('0xd')]['bot']=!![];this[_0xbd7a('0x35')](_0x1961b4);this[_0xbd7a('0x42')](_0x1961b4['text'],'in','','');this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0xf2'),_0x1961b4['text']));var _0x14a6af=this[_0xbd7a('0x78')][_0xbd7a('0x6b')](this,_0x1961b4);if(_0x14a6af){for(var _0x39b759 in _0x14a6af){if(_0x14a6af[_0xbd7a('0x92')](_0x39b759)){if(_0x39b759!==_0xbd7a('0xf3')){this[_0xbd7a('0xd')]['setVariable'](util[_0xbd7a('0x28')](_0xbd7a('0xf4'),_0x39b759[_0xbd7a('0x66')]()),_0x14a6af[_0x39b759]);}}}this[_0xbd7a('0x42')](_0x14a6af[_0xbd7a('0xea')],_0xbd7a('0xf5'),_0xbd7a('0xed'),_0x14a6af[_0xbd7a('0xf3')]);return this[_0xbd7a('0xd')]['noop'](util[_0xbd7a('0x28')](_0xbd7a('0xf6'),_0x14a6af[_0xbd7a('0xea')]));}return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x1961b4,_0xbd7a('0xf7'));};AGIVertices['prototype'][_0xbd7a('0xf8')]=function(_0x584f18){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x584f18[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x584f18[_0xbd7a('0xf9')])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0xfa'));}if(!this[_0xbd7a('0xa6')](_0x584f18[_0xbd7a('0xfb')])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0xfc'));}if(!this[_0xbd7a('0xa6')](_0x584f18['password'])){return this['channel'][_0xbd7a('0xa7')](_0xbd7a('0xfd'));}if(!this['isConfigured'](_0x584f18[_0xbd7a('0xfe')])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0xc3'));}this[_0xbd7a('0xd')][_0xbd7a('0xe8')]=!![];this[_0xbd7a('0x35')](_0x584f18);this['createSquareMessage'](_0x584f18['text'],'in','','');this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0xff'),_0x584f18['text']));var _0x1d0b0a=this[_0xbd7a('0x7d')][_0xbd7a('0x6b')](this,_0x584f18);if(_0x1d0b0a){for(var _0x252fda in _0x1d0b0a){if(_0x1d0b0a['hasOwnProperty'](_0x252fda)){this['channel'][_0xbd7a('0x9c')](util[_0xbd7a('0x28')]('SESTEK_NDA_%s',_0x252fda[_0xbd7a('0x66')]()),_0x1d0b0a[_0x252fda]);}}this[_0xbd7a('0x42')](_0x1d0b0a[_0xbd7a('0xea')],_0xbd7a('0xf5'),_0xbd7a('0xf8'),'');if(_0x1d0b0a[_0xbd7a('0x100')]){this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util['format'](_0xbd7a('0x101'),_0x1d0b0a[_0xbd7a('0x100')]));var _0x417814=this[_0xbd7a('0xd')][_0xbd7a('0x102')](_0x1d0b0a['audiofile']);try{fs['unlink'](_0x1d0b0a[_0xbd7a('0x100')]+_0xbd7a('0x103'));}catch(_0x19accc){logger[_0xbd7a('0x2c')](_0x19accc);}return _0x417814;}else{return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0x104'),_0x1d0b0a[_0xbd7a('0xea')]));}}return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x584f18,_0xbd7a('0x105'));};AGIVertices['prototype'][_0xbd7a('0x106')]=function(_0x2d58bf){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x107'),_0x2d58bf['label']));return this[_0xbd7a('0xd')][_0xbd7a('0xa7')]('end');};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x108')]=function(_0x10e00b){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x109'),_0x10e00b[_0xbd7a('0x37')]));var _0xe5e46a='';if(_0x10e00b[_0xbd7a('0x10a')]){if(!this[_0xbd7a('0xa6')](_0x10e00b[_0xbd7a('0x10a')])){return this[_0xbd7a('0xd')]['error'](_0x10e00b,_0xbd7a('0x10b'));}else{var _0x443e93=parseInt(_0x10e00b[_0xbd7a('0x10a')],0xa);if(isNaN(_0x443e93)){_0xe5e46a=_0x10e00b[_0xbd7a('0x10a')];}else{_0xe5e46a=this[_0xbd7a('0x10c')]['sync'](this,_0x10e00b[_0xbd7a('0x10a')]);if(!_0xe5e46a){return this['channel'][_0xbd7a('0x2c')](_0x10e00b,_0xbd7a('0x10d'));}}}}else if(_0x10e00b[_0xbd7a('0x10e')]){_0xe5e46a=_0x10e00b[_0xbd7a('0x10e')];}else{return this['channel'][_0xbd7a('0x2c')](_0x10e00b,_0xbd7a('0x10b'));}var _0x169779=this[_0xbd7a('0xd')][_0xbd7a('0x55')](_0xbd7a('0xe2'),[util[_0xbd7a('0x28')](_0xbd7a('0x10f'),_0xe5e46a,_0x10e00b[_0xbd7a('0x49')]),_0x10e00b['timeout'],_0x10e00b['opts'],_0x10e00b[_0xbd7a('0x61')]]);if(_0x169779[_0xbd7a('0xa2')]===-0x1){return _0x169779;}return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xbd7a('0xe')]['finally']=function(_0x8c2f36){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x110'),_0x8c2f36['label']));return this[_0xbd7a('0xd')]['noop'](_0xbd7a('0x111'));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0xb')]=function(_0x23a69e){logger['info'](util[_0xbd7a('0x28')](_0xbd7a('0x112'),_0x23a69e[_0xbd7a('0x37')]));if(_0x23a69e['retry']===0x0){return this[_0xbd7a('0xa4')](_0x23a69e);}_0x23a69e['retry']-=0x1;if(!this['isConfigured'](_0x23a69e[_0xbd7a('0x113')])){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x23a69e,_0xbd7a('0x114'));}var _0xba6561=this[_0xbd7a('0x115')][_0xbd7a('0x6b')](this,_0x23a69e[_0xbd7a('0x113')]);if(!_0xba6561){return this['channel'][_0xbd7a('0x2c')](_0x23a69e,_0xbd7a('0x116'));}if(!this[_0xbd7a('0xa6')](_0x23a69e[_0xbd7a('0xd4')])){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0xbd7a('0xd5'));}var _0x425265=this['channel']['getData'](_0xba6561,_0x23a69e['response'],_0x23a69e[_0xbd7a('0x117')]);var _0xa4c9cf=_0x425265[_0xbd7a('0xa2')]?_0x425265['result']['toString']():'';logger['info'](_0xbd7a('0x118'),JSON[_0xbd7a('0x6f')](_0x425265));if(_0x425265[_0xbd7a('0xa2')]===-0x1){this[_0xbd7a('0x35')][_0xbd7a('0x6b')](this,_0x23a69e,_0xa4c9cf);return _0x425265;}else if(_0x425265[_0xbd7a('0xa0')]===_0xbd7a('0x63')){_0x425265[_0xbd7a('0xa2')]=_0xa4c9cf[_0xbd7a('0x97')]>=parseInt(_0x23a69e[_0xbd7a('0x119')])?'x':'i';}else{_0x425265[_0xbd7a('0xa2')]=_0xa4c9cf[_0xbd7a('0x97')]>=parseInt(_0x23a69e['mindigit'])&&_0xa4c9cf['length']<=parseInt(_0x23a69e[_0xbd7a('0x117')])?'x':'i';}var _0x5a3ef4=this['getVariable']['sync'](this,_0x23a69e[_0xbd7a('0xd4')]);if(!_0x5a3ef4){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x23a69e,_0xbd7a('0xd6'));}this[_0xbd7a('0xd')][_0xbd7a('0x9c')](_0x5a3ef4,_0xa4c9cf);if(this[_0xbd7a('0xa6')](_0x23a69e['hiddendigitsnum'])){var _0x12ce85=parseInt(_0x23a69e[_0xbd7a('0x11a')],0xa);var _0x5771c7=rs[_0xbd7a('0x11b')]({'charset':'*','length':_0x12ce85});var _0xbdc8b3=_0xa4c9cf['length'];if(_0xbdc8b3>0x0){if(_0xbdc8b3>_0x12ce85){this['createSquareDetailsReport'][_0xbd7a('0x6b')](this,_0x23a69e,_0x23a69e[_0xbd7a('0x11c')]===_0xbd7a('0x11d')?_0x5771c7+_0xa4c9cf[_0xbd7a('0x11e')](_0x12ce85):_0xa4c9cf['substr'](0x0,_0xbdc8b3-_0x12ce85)+_0x5771c7);}else{this[_0xbd7a('0x35')]['sync'](this,_0x23a69e,rs[_0xbd7a('0x11b')]({'charset':'*','length':_0xbdc8b3}));}}else{this[_0xbd7a('0x35')][_0xbd7a('0x6b')](this,_0x23a69e,'');}}else{this[_0xbd7a('0x35')]['sync'](this,_0x23a69e,_0xa4c9cf);}return _0x425265;};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0xc')]=function(_0x347642){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x11f'),_0x347642[_0xbd7a('0x37')]));return this[_0xbd7a('0xb')](_0x347642);};AGIVertices['prototype'][_0xbd7a('0x120')]=function(_0x316dc3){logger[_0xbd7a('0x2e')](util['format'](_0xbd7a('0x121'),_0x316dc3[_0xbd7a('0x37')]));this[_0xbd7a('0x35')][_0xbd7a('0x6b')](this,_0x316dc3,_0x316dc3[_0xbd7a('0x122')]);return this['channel'][_0xbd7a('0xa7')](util['format']('GOAL\x20%s',_0x316dc3['goalname']));};AGIVertices[_0xbd7a('0xe')]['awspolly']=function(_0x1e2282){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x123'),_0x1e2282['label']));if(!this[_0xbd7a('0xa6')](_0x1e2282['aws_access_key_id'])||!this[_0xbd7a('0xa6')](_0x1e2282['aws_secret_access_key'])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xbd7a('0xa6')](_0x1e2282['text'])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0xc3'));}this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0x124'),_0x1e2282['text']));var _0x3e681d=this[_0xbd7a('0x83')][_0xbd7a('0x6b')](this,_0x1e2282);if(_0x3e681d){this['channel'][_0xbd7a('0xa7')](util[_0xbd7a('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x3e681d));var _0x24a494=this[_0xbd7a('0xd')][_0xbd7a('0x102')](_0x3e681d);try{fs[_0xbd7a('0x125')](_0x3e681d+_0xbd7a('0x103'));}catch(_0xfc168){logger[_0xbd7a('0x2c')](_0xfc168);}return _0x24a494;}return this['channel']['error'](_0x1e2282,_0xbd7a('0x126'));};AGIVertices['prototype']['awslex']=function(_0x4a1f31){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x127'),_0x4a1f31[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x4a1f31[_0xbd7a('0x128')])||!this[_0xbd7a('0xa6')](_0x4a1f31['aws_secret_access_key'])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0x129'));}if(!this[_0xbd7a('0xa6')](_0x4a1f31['aws_bot_name'])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0x12a'));}if(!this[_0xbd7a('0xa6')](_0x4a1f31['text'])){return this['channel']['noop']('no\x20text\x20configured');}this[_0xbd7a('0xd')][_0xbd7a('0xe8')]=!![];this[_0xbd7a('0x35')](_0x4a1f31);this[_0xbd7a('0x42')](_0x4a1f31['text'],'in','','');this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util['format'](_0xbd7a('0x12b'),_0x4a1f31[_0xbd7a('0x5a')]));var _0x29bdcc=this['awsLex']['sync'](this,_0x4a1f31);if(_0x29bdcc){for(var _0x189900 in _0x29bdcc){if(_0x29bdcc['hasOwnProperty'](_0x189900)&&_[_0xbd7a('0x93')](_0x29bdcc[_0x189900])){this[_0xbd7a('0xd')]['setVariable'](util[_0xbd7a('0x28')](_0xbd7a('0x12c'),_0x189900[_0xbd7a('0x66')]()),_0x29bdcc[_0x189900]);}}if(_[_0xbd7a('0x45')](_0x29bdcc[_0xbd7a('0x73')])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0x12d'));}else{this['createSquareMessage'](_0x29bdcc['message'],'out',_0xbd7a('0x12e'),'');return this[_0xbd7a('0xd')]['noop'](util[_0xbd7a('0x28')]('Amazon\x20Lex\x20Result\x20%s',_0x29bdcc['message']));}}return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x4a1f31,_0xbd7a('0x12f'));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x130')]=function(_0x14508b){logger['info'](util[_0xbd7a('0x28')](_0xbd7a('0x131'),_0x14508b[_0xbd7a('0x37')],_0x14508b[_0xbd7a('0x63')]));if(!this['isConfigured'](_0x14508b[_0xbd7a('0x7f')])){return this[_0xbd7a('0xd')]['noop']('no\x20key\x20configured');}var _0x3e00fa=_0xbd7a('0x132');var _0x349536=util['format'](_0xbd7a('0x133'),FILES_PATH,rs[_0xbd7a('0x11b')](0x4));var _0x3f7be4=util['format']('%s.%s',_0x349536,_0x3e00fa);var _0x44be4d=!![];if(_0x14508b['beep']===_0xbd7a('0x134')){_0x44be4d=![];}var _0x298539=this[_0xbd7a('0xd')]['recordFile'](_0x349536,_0x3e00fa,_0x14508b[_0xbd7a('0x135')],_0x14508b[_0xbd7a('0x63')],undefined,_0x44be4d);if(_0x298539['result']!==-0x1){this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util['format']('google\x20%s\x20file\x20created',_0x3f7be4));var _0x5525bf=this[_0xbd7a('0x8b')]['sync'](this,_0x14508b,_0x3f7be4);if(_0x5525bf){for(var _0x26339e in _0x5525bf){if(_0x5525bf['hasOwnProperty'](_0x26339e)){this['channel'][_0xbd7a('0x9c')](util[_0xbd7a('0x28')](_0xbd7a('0x136'),_0x26339e['toUpperCase']()),_0x5525bf[_0x26339e]);}}return this[_0xbd7a('0xd')]['noop'](util[_0xbd7a('0x28')](_0xbd7a('0x137'),JSON[_0xbd7a('0x6f')](_0x5525bf)));}}return _0x298539;};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x138')]=function(_0x493316){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x139'),_0x493316[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x493316[_0xbd7a('0x8e')])){return this['channel'][_0xbd7a('0xa7')](_0xbd7a('0x13a'));}if(!this[_0xbd7a('0xa6')](_0x493316[_0xbd7a('0x13b')])){return this['channel'][_0xbd7a('0xa7')]('no\x20appsecret\x20configured');}var _0x311ac6=_0xbd7a('0x132');var _0x5b1de7=util[_0xbd7a('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0xbd7a('0x11b')](0x4));var _0xae0818=util['format'](_0xbd7a('0x9a'),_0x5b1de7,_0x311ac6);var _0x44e6b6=!![];if(_0x493316[_0xbd7a('0x13c')]===_0xbd7a('0x134')){_0x44e6b6=![];}var _0x531063=this['channel'][_0xbd7a('0x13d')](_0x5b1de7,_0x311ac6,_0x493316[_0xbd7a('0x135')],_0x493316['timeout'],undefined,_0x44e6b6);if(_0x531063[_0xbd7a('0xa2')]!==-0x1){this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0x13e'),_0xae0818));var _0x22bfed=this[_0xbd7a('0x8d')][_0xbd7a('0x6b')](this,_0x493316,_0xae0818);if(_0x22bfed){for(var _0x195dd8 in _0x22bfed){if(_0x22bfed['hasOwnProperty'](_0x195dd8)){this[_0xbd7a('0xd')]['setVariable'](util[_0xbd7a('0x28')](_0xbd7a('0x13f'),_0x195dd8[_0xbd7a('0x66')]()),_0x22bfed[_0x195dd8]);}}return this[_0xbd7a('0xd')]['noop'](util[_0xbd7a('0x28')](_0xbd7a('0x140'),JSON['stringify'](_0x22bfed)));}}return _0x531063;};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x141')]=function(_0x359b38){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x142'),_0x359b38[_0xbd7a('0x37')]));return this['channel'][_0xbd7a('0x143')](_0x359b38[_0xbd7a('0x144')],_0x359b38['extension'],_0x359b38[_0xbd7a('0x3e')]);};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x145')]=function(_0x311637){logger['info'](util[_0xbd7a('0x28')](_0xbd7a('0x146'),_0x311637[_0xbd7a('0x37')]));if(!this['isConfigured'](_0x311637[_0xbd7a('0x147')])){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x311637,_0xbd7a('0x148'));}try{var _0x2cc0d2=eval(_0x311637[_0xbd7a('0x147')])?_0xbd7a('0x149'):'false';this['channel'][_0xbd7a('0xa7')](util[_0xbd7a('0x28')]('EVAL\x20CONDITION\x20%s\x20%s',_0x311637[_0xbd7a('0x147')],_0x2cc0d2));return{'code':0xc8,'result':_0x2cc0d2};}catch(_0x2a2b7e){return{'code':0xc8,'result':_0xbd7a('0x14a')};}};AGIVertices[_0xbd7a('0xe')]['gotoiftime']=function(_0x32e210){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x32e210[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x32e210[_0xbd7a('0x14b')])){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x32e210,_0xbd7a('0x14c'));}var _0x4a63d7=this[_0xbd7a('0x21')][_0xbd7a('0x6b')](this,_0x32e210[_0xbd7a('0x14b')]);if(!_0x4a63d7){return this['channel'][_0xbd7a('0x2c')](_0x32e210,_0xbd7a('0x14d'));}for(var _0x4f067a=0x0;_0x4f067a<_0x4a63d7[_0xbd7a('0x97')];_0x4f067a+=0x1){var _0x28a464=this[_0xbd7a('0xd')][_0xbd7a('0x9f')](util['format'](_0xbd7a('0x14e'),_0x4a63d7[_0x4f067a]));if(_0x28a464[_0xbd7a('0xa2')]===-0x1){return _0x28a464;}logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')]('IFTIME\x20%s\x20%s',_0x4a63d7[_0x4f067a],_0x28a464[_0xbd7a('0xa0')]));if(_0x28a464[_0xbd7a('0xa0')]==='true'){logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x4a63d7[_0x4f067a],'true'));this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0x14f'),_0x4a63d7[_0x4f067a],'true'));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0xbd7a('0x28')]('IFTIME\x20%s\x20%s',_0x4a63d7[_0x4f067a],_0xbd7a('0x14a')));this[_0xbd7a('0xd')]['noop'](util[_0xbd7a('0x28')](_0xbd7a('0x14f'),_0x4a63d7[_0x4f067a],_0xbd7a('0x14a')));}}return{'code':0xc8,'result':_0xbd7a('0x14a')};};AGIVertices['prototype'][_0xbd7a('0x150')]=function(_0x4f3e20){logger['info'](util[_0xbd7a('0x28')](_0xbd7a('0x151'),_0x4f3e20[_0xbd7a('0x37')]));return this[_0xbd7a('0xd')]['hangup']();};AGIVertices['prototype'][_0xbd7a('0x152')]=function(_0x128429){logger['info'](util[_0xbd7a('0x28')](_0xbd7a('0x153'),_0x128429[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x128429[_0xbd7a('0x7f')])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0xe7'));}var _0x17233a=_0xbd7a('0x132');var _0x283c13=util['format'](_0xbd7a('0x133'),FILES_PATH,rs[_0xbd7a('0x11b')](0x4));var _0x55598c=util[_0xbd7a('0x28')](_0xbd7a('0x9a'),_0x283c13,_0x17233a);var _0xb02654=!![];if(_0x128429[_0xbd7a('0x13c')]==='NOBEEP'){_0xb02654=![];}var _0x5e9a85=this[_0xbd7a('0xd')][_0xbd7a('0x13d')](_0x283c13,_0x17233a,_0x128429['intKey'],_0x128429[_0xbd7a('0x63')],undefined,_0xb02654);if(_0x5e9a85[_0xbd7a('0xa2')]!==-0x1){this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0x154'),_0x55598c));var _0x24febe=this[_0xbd7a('0x155')][_0xbd7a('0x6b')](this,_0x128429,_0x55598c);if(_0x24febe){for(var _0x4c8021 in _0x24febe){if(_0x24febe[_0xbd7a('0x92')](_0x4c8021)){this['channel']['setVariable'](util['format']('ISPEECH_ASR_%s',_0x4c8021[_0xbd7a('0x66')]()),_0x24febe[_0x4c8021]);}}return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0x156'),JSON[_0xbd7a('0x6f')](_0x24febe)));}}return _0x5e9a85;};AGIVertices['prototype']['ispeechtts']=function(_0x3b9adb){logger[_0xbd7a('0x2e')](util['format'](_0xbd7a('0x157'),_0x3b9adb[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x3b9adb[_0xbd7a('0x7f')])){return this[_0xbd7a('0xd')]['noop'](_0xbd7a('0xe7'));}if(!this[_0xbd7a('0xa6')](_0x3b9adb[_0xbd7a('0x5a')])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0xc3'));}this[_0xbd7a('0xd')]['noop'](util['format'](_0xbd7a('0x158'),_0x3b9adb['text']));var _0x2ad200=this[_0xbd7a('0x7e')]['sync'](this,_0x3b9adb);if(_0x2ad200){this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')]('ispeech\x20%s\x20file\x20created',_0x2ad200));var _0x26944c=this[_0xbd7a('0xd')][_0xbd7a('0x102')](_0x2ad200,_0x3b9adb[_0xbd7a('0x135')]);try{fs['unlink'](_0x2ad200+_0xbd7a('0x103'));}catch(_0x2f9cb6){logger[_0xbd7a('0x2c')](_0x2f9cb6);}return _0x26944c;}return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x3b9adb,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x159')]=function(_0x25fd7e){logger['info'](util[_0xbd7a('0x28')](_0xbd7a('0x15a'),_0x25fd7e[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x25fd7e[_0xbd7a('0x15b')])){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x25fd7e,_0xbd7a('0x15c'));}logger[_0xbd7a('0x2e')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbd7a('0xd')][_0xbd7a('0x3b')],_0x25fd7e[_0xbd7a('0x15b')]));var _0x2488c3=this[_0xbd7a('0x15d')][_0xbd7a('0x6b')](this,_0x25fd7e['findBy']);if(_0x2488c3){logger[_0xbd7a('0x2e')](util['format'](_0xbd7a('0x15e'),this[_0xbd7a('0xd')][_0xbd7a('0x3b')],_0x25fd7e['findBy']));this[_0xbd7a('0xd')]['noop'](util['format'](_0xbd7a('0x15e'),this['channel']['callerid'],_0x25fd7e[_0xbd7a('0x15b')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xbd7a('0x28')](_0xbd7a('0x15f'),this[_0xbd7a('0xd')][_0xbd7a('0x3b')],_0x25fd7e[_0xbd7a('0x15b')]));this['channel'][_0xbd7a('0xa7')](util[_0xbd7a('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xbd7a('0xd')][_0xbd7a('0x3b')],_0x25fd7e[_0xbd7a('0x15b')]));return{'code':0xc8,'result':_0xbd7a('0x160')};}};AGIVertices[_0xbd7a('0xe')]['logout']=function(_0x5c6952){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x161'),_0x5c6952[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x5c6952[_0xbd7a('0x15b')])){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x5c6952,_0xbd7a('0x15c'));}logger[_0xbd7a('0x2e')](util['format'](_0xbd7a('0x162'),this['channel'][_0xbd7a('0x3b')],_0x5c6952['findBy']));var _0xf205f8=this['agentLogout']['sync'](this,_0x5c6952['findBy']);if(_0xf205f8){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xbd7a('0xd')][_0xbd7a('0x3b')],_0x5c6952[_0xbd7a('0x15b')]));this[_0xbd7a('0xd')]['noop'](util[_0xbd7a('0x28')](_0xbd7a('0x15e'),this['channel']['callerid'],_0x5c6952[_0xbd7a('0x15b')]));return{'code':0xc8,'result':_0xbd7a('0x163')};}else{logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xbd7a('0xd')][_0xbd7a('0x3b')],_0x5c6952[_0xbd7a('0x15b')]));this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0x15f'),this[_0xbd7a('0xd')][_0xbd7a('0x3b')],_0x5c6952[_0xbd7a('0x15b')]));return{'code':0xc8,'result':_0xbd7a('0x160')};}};AGIVertices[_0xbd7a('0xe')]['math']=function(_0x1c7f7c){logger['info'](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x1c7f7c[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x1c7f7c[_0xbd7a('0x164')])){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x1c7f7c,'no\x20operation\x20configured');}this['channel'][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0x165'),_0x1c7f7c[_0xbd7a('0x164')]));var _0x5be5a3=eval(_0x1c7f7c[_0xbd7a('0x164')]);if(!this[_0xbd7a('0xa6')](_0x1c7f7c['variable_id'])){return this['channel'][_0xbd7a('0xa7')](_0xbd7a('0xd5'));}var _0x3c06d2=this[_0xbd7a('0x9f')][_0xbd7a('0x6b')](this,_0x1c7f7c[_0xbd7a('0xd4')]);if(!_0x3c06d2){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x1c7f7c,_0xbd7a('0xd6'));}if(_[_0xbd7a('0x9b')](_0x5be5a3)){var _0x54aa2=this;_0x5be5a3['forEach'](function(_0x4ebac7,_0x28036f){_0x54aa2['channel'][_0xbd7a('0x9c')](util[_0xbd7a('0x28')](_0xbd7a('0x166'),_0x3c06d2,_0x28036f),_0x4ebac7);});return this[_0xbd7a('0xd')]['noop'](util[_0xbd7a('0x28')](_0xbd7a('0x167'),_0x3c06d2));}else{return this['channel'][_0xbd7a('0x9c')](_0x3c06d2,_0x5be5a3);}};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x168')]=function(_0x29abfe){logger['info'](util[_0xbd7a('0x28')](_0xbd7a('0x169'),_0x29abfe[_0xbd7a('0x37')]));if(_0x29abfe[_0xbd7a('0x16a')]===0x0){return this[_0xbd7a('0xa4')](_0x29abfe);}_0x29abfe[_0xbd7a('0x16a')]-=0x1;if(!this['isConfigured'](_0x29abfe[_0xbd7a('0x113')])){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x29abfe,_0xbd7a('0x114'));}var _0x49de87=this['getSound'][_0xbd7a('0x6b')](this,_0x29abfe[_0xbd7a('0x113')]);if(!_0x49de87){return this['channel'][_0xbd7a('0x2c')](_0x29abfe,_0xbd7a('0x116'));}var _0x11fc47=this[_0xbd7a('0xd')]['getData'](_0x49de87,_0x29abfe[_0xbd7a('0x16b')],_0x29abfe[_0xbd7a('0x16c')]);var _0x4ddfea=_0x11fc47['result'];if(_0x11fc47['result']===-0x1){this[_0xbd7a('0x35')]['sync'](this,_0x29abfe,'-1');return _0x11fc47;}else if(_0x11fc47[_0xbd7a('0xa0')]===_0xbd7a('0x63')){_0x11fc47['result']=_0x11fc47['result']['length']>0x0?_0x11fc47['result']:'t';}else if(_[_0xbd7a('0x44')](_0x11fc47[_0xbd7a('0xa2')])){_0x11fc47[_0xbd7a('0xa2')]='#';_0x4ddfea='#';}if(!this[_0xbd7a('0xa6')](_0x29abfe[_0xbd7a('0xd4')])){this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0xd5'));}else{var _0x4739c1=this[_0xbd7a('0x9f')][_0xbd7a('0x6b')](this,_0x29abfe[_0xbd7a('0xd4')]);if(!_0x4739c1){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x29abfe,_0xbd7a('0xd6'));}this[_0xbd7a('0xd')][_0xbd7a('0x9c')](_0x4739c1,_0x4ddfea);}this['createSquareDetailsReport'][_0xbd7a('0x6b')](this,_0x29abfe,_0x4ddfea);return _0x11fc47;};AGIVertices['prototype'][_0xbd7a('0xa7')]=function(_0x342ca8){logger[_0xbd7a('0x2e')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x342ca8[_0xbd7a('0x37')]));return this[_0xbd7a('0xd')]['noop'](_0x342ca8['output']||_0x342ca8['label']);};AGIVertices[_0xbd7a('0xe')]['pause']=function(_0xff2c6a){logger[_0xbd7a('0x2e')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0xff2c6a[_0xbd7a('0x37')]));if(!this['isConfigured'](_0xff2c6a['findBy'])){return this['channel']['error'](_0xff2c6a,_0xbd7a('0x15c'));}logger['info'](util['format'](_0xbd7a('0x162'),this[_0xbd7a('0xd')][_0xbd7a('0x3b')],_0xff2c6a[_0xbd7a('0x15b')]));var _0x39d19c=this[_0xbd7a('0x16d')][_0xbd7a('0x6b')](this,_0xff2c6a[_0xbd7a('0x16e')]);var _0x481e2a=this[_0xbd7a('0x4f')][_0xbd7a('0x6b')](this,_0xff2c6a[_0xbd7a('0x15b')],_0x39d19c);if(_0x481e2a){logger['info'](util[_0xbd7a('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbd7a('0xd')]['callerid'],_0xff2c6a[_0xbd7a('0x15b')]));this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0x15e'),this[_0xbd7a('0xd')][_0xbd7a('0x3b')],_0xff2c6a['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x15f'),this[_0xbd7a('0xd')]['callerid'],_0xff2c6a[_0xbd7a('0x15b')]));this['channel'][_0xbd7a('0xa7')](util['format'](_0xbd7a('0x15e'),this[_0xbd7a('0xd')][_0xbd7a('0x3b')],_0xff2c6a[_0xbd7a('0x15b')]));return{'code':0xc8,'result':_0xbd7a('0x160')};}};AGIVertices['prototype'][_0xbd7a('0x16f')]=function(_0x414ded){logger['info'](util[_0xbd7a('0x28')](_0xbd7a('0x170'),_0x414ded['label']));if(!this[_0xbd7a('0xa6')](_0x414ded[_0xbd7a('0x113')])){return this['channel'][_0xbd7a('0x2c')](_0x414ded,'no\x20file\x20audio\x20selected');}var _0x42f65c=this['getSound'][_0xbd7a('0x6b')](this,_0x414ded[_0xbd7a('0x113')]);if(!_0x42f65c){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x414ded,_0xbd7a('0x116'));}var _0x56fba3=this[_0xbd7a('0xd')][_0xbd7a('0x55')](_0xbd7a('0x171'),[_0x42f65c,_0x414ded[_0xbd7a('0x172')]]);if(_0x56fba3[_0xbd7a('0xa2')]===-0x1){return _0x56fba3;}return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0xc0'),_0xbd7a('0x171'),_0x42f65c));};AGIVertices['prototype']['queue']=function(_0x38d07a){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x38d07a[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x38d07a[_0xbd7a('0x173')])){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x38d07a,'no\x20queue\x20selected');}var _0xe54c9d='';var _0x183a1c=parseInt(_0x38d07a[_0xbd7a('0x173')],0xa);if(isNaN(_0x183a1c)){_0xe54c9d=_0x38d07a[_0xbd7a('0x173')];}else{_0xe54c9d=this['getVoiceQueue'][_0xbd7a('0x6b')](this,_0x38d07a[_0xbd7a('0x173')]);if(!_0xe54c9d){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x38d07a,'no\x20queue\x20found');}}var _0x47ff3f='';if(this[_0xbd7a('0xa6')](_0x38d07a['file_id'])){var _0x1f4a34=this[_0xbd7a('0x115')][_0xbd7a('0x6b')](this,_0x38d07a['file_id']);if(_0x1f4a34){_0x47ff3f=_0x1f4a34;}}this['createSquareDetailsReport']['sync'](this,_0x38d07a,_0xe54c9d);if(_0x38d07a['opts'][_0xbd7a('0x174')]('x')<0x0){_0x38d07a['opts']+='x';}if(_0x38d07a[_0xbd7a('0x172')][_0xbd7a('0x174')]('X')<0x0){_0x38d07a[_0xbd7a('0x172')]+='X';}this[_0xbd7a('0xd')][_0xbd7a('0x9c')]('XMCS-QUEUE',_0xe54c9d?_0xe54c9d[_0xbd7a('0x175')]():'');var _0x42a471=this[_0xbd7a('0xd')][_0xbd7a('0x55')](_0xbd7a('0x176'),[_0xe54c9d,_0x38d07a[_0xbd7a('0x172')],_0x38d07a['url'],_0x47ff3f,_0x38d07a[_0xbd7a('0x63')],_0x38d07a['agi'],_0x38d07a[_0xbd7a('0x177')],_0x38d07a[_0xbd7a('0x178')],'',_0x38d07a['position']]);if(_0x42a471[_0xbd7a('0xa2')]===-0x1){return _0x42a471;}return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0xc0'),_0xbd7a('0x176'),_0xe54c9d));};AGIVertices[_0xbd7a('0xe')]['record']=function(_0xdd0733){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x179'),_0xdd0733[_0xbd7a('0x37')]));var _0x36f0fe=_0xdd0733[_0xbd7a('0x17a')]||'wav';var _0x295228=util[_0xbd7a('0x28')](_0xbd7a('0x17b'),this[_0xbd7a('0xd')]['uniqueid'],rs['generate'](0x5));var _0x62331=util['format'](_0xbd7a('0x17c'),FILES_PATH,_0x295228,_0x36f0fe);var _0x4faeac=util['format']('%s/recordings/%s',FILES_PATH,_0x295228);this[_0xbd7a('0x3a')][_0xbd7a('0x6b')](this,_0xdd0733,_0x295228,_0x62331);this[_0xbd7a('0xd')][_0xbd7a('0x9c')](_0xbd7a('0x17d'),_0x295228);logger[_0xbd7a('0x2e')](_0xbd7a('0x17e'),_0x4faeac,_0x36f0fe,_0xdd0733[_0xbd7a('0x17f')],_0xdd0733[_0xbd7a('0x63')]);return this[_0xbd7a('0xd')][_0xbd7a('0x13d')](_0x4faeac,_0x36f0fe,_0xdd0733[_0xbd7a('0x17f')],_0xdd0733[_0xbd7a('0x63')],undefined,!![]);};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x180')]=function(_0x114998){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x181'),_0x114998[_0xbd7a('0x37')]));if(!this['isConfigured'](_0x114998['url'])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0x182'));}var _0x50fb5c=this[_0xbd7a('0x183')][_0xbd7a('0x6b')](this,_0x114998);logger['info'](util[_0xbd7a('0x28')]('Response:',util[_0xbd7a('0x184')](_0x50fb5c,{'showHidden':![],'depth':null})));if(!this[_0xbd7a('0xa6')](_0x114998['variable_id'])){return this['channel'][_0xbd7a('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x46a69e=this[_0xbd7a('0x9f')]['sync'](this,_0x114998[_0xbd7a('0xd4')]);if(!_0x46a69e){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x114998,_0xbd7a('0xd6'));}this[_0xbd7a('0xd')][_0xbd7a('0x9c')](util[_0xbd7a('0x28')](_0xbd7a('0x185'),_0x46a69e),_0x50fb5c[_0xbd7a('0x72')]?_0x50fb5c[_0xbd7a('0x72')]:_0xbd7a('0x186'));this['channel'][_0xbd7a('0x9c')](util[_0xbd7a('0x28')](_0xbd7a('0x187'),_0x46a69e),_0x50fb5c[_0xbd7a('0x71')]?_0x50fb5c[_0xbd7a('0x71')]:'OK');if(_0x50fb5c[_0xbd7a('0x6e')]){try{this[_0xbd7a('0x99')](_0x50fb5c[_0xbd7a('0x6e')],_0x46a69e);}catch(_0x40b35f){logger[_0xbd7a('0x2c')](util[_0xbd7a('0x28')](_0xbd7a('0x188'),_0x46a69e));}}return this[_0xbd7a('0xd')]['noop'](util[_0xbd7a('0x28')](_0xbd7a('0xdb'),_0x46a69e));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x189')]=function(_0x4f1bf0){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x18a'),_0x4f1bf0['label']));return this[_0xbd7a('0xd')][_0xbd7a('0x18b')](_0x4f1bf0['digits']['replace'](/\s+/g,''),_0x4f1bf0[_0xbd7a('0x17f')]);};AGIVertices['prototype'][_0xbd7a('0x18c')]=function(_0x164dcb){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x18d'),_0x164dcb['label']));return this[_0xbd7a('0xd')][_0xbd7a('0x18e')](_0x164dcb[_0xbd7a('0x18f')][_0xbd7a('0x57')](/\s+/g,''),_0x164dcb[_0xbd7a('0x17f')]);};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x190')]=function(_0x2db6e5){logger['info'](util[_0xbd7a('0x28')](_0xbd7a('0x191'),_0x2db6e5[_0xbd7a('0x37')]));return this[_0xbd7a('0xd')][_0xbd7a('0x192')](_0x2db6e5[_0xbd7a('0x5a')],_0x2db6e5['escape_digits']);};AGIVertices['prototype']['sendMail']=function(_0x5af876){logger[_0xbd7a('0x2e')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x5af876[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x5af876[_0xbd7a('0x193')])){return this['channel'][_0xbd7a('0xa7')]('no\x20mail\x20account\x20configured');}var _0x185e3f=this[_0xbd7a('0x1d')]['sync'](this,_0x5af876[_0xbd7a('0x193')]);if(!_0x185e3f||!_0x185e3f[_0xbd7a('0x194')]){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x5af876,_0xbd7a('0x195'));}var _0x2e42a5={'from':util['format'](_0xbd7a('0x196'),_0x185e3f[_0xbd7a('0x1a')],_0x185e3f['email']||_0x185e3f[_0xbd7a('0x194')][_0xbd7a('0x197')]),'to':_0x5af876['to']||'','cc':_0x5af876['cc']||'','bcc':_0x5af876[_0xbd7a('0x198')]||'','subject':_0x5af876[_0xbd7a('0x199')],'html':_0x5af876[_0xbd7a('0x5a')],'text':_0x5af876[_0xbd7a('0x5a')]};if(this[_0xbd7a('0xa6')](_0x5af876[_0xbd7a('0x19a')])){}logger[_0xbd7a('0xdd')](_0xbd7a('0x19b'),JSON['stringify'](_0x2e42a5));this[_0xbd7a('0x35')][_0xbd7a('0x6b')](this,_0x5af876,_0x5af876[_0xbd7a('0x193')]);this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util['format'](_0xbd7a('0x19c'),_0x185e3f['name']));this['sendMailMessage'][_0xbd7a('0x6b')](this,_0x185e3f[_0xbd7a('0x19d')],_0x2e42a5);return this[_0xbd7a('0xd')][_0xbd7a('0xa7')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x19e')]=function(_0x3f51c8){logger['info'](util[_0xbd7a('0x28')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x3f51c8['label']));return this[_0xbd7a('0xd')]['noop'](_0xbd7a('0x19f'));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x1a0')]=function(_0x2a52ac){logger[_0xbd7a('0x2e')](util['format'](_0xbd7a('0x1a1'),_0x2a52ac[_0xbd7a('0x37')]));if(!this['isConfigured'](_0x2a52ac['sms_account_id'])){return this['channel']['noop'](_0xbd7a('0x1a2'));}var _0x30f49d=this[_0xbd7a('0x32')][_0xbd7a('0x6b')](this,_0x2a52ac[_0xbd7a('0x1a3')]);if(!_0x30f49d){return this['channel'][_0xbd7a('0x2c')](_0x2a52ac,_0xbd7a('0x1a4'));}var _0x3c517d={'body':_0x2a52ac[_0xbd7a('0x1a5')],'phone':_0x2a52ac['to']||'','SmsAccountId':_0x30f49d['id']};logger['debug'](_0xbd7a('0x1a6'),JSON[_0xbd7a('0x6f')](_0x3c517d));this['createSquareDetailsReport']['sync'](this,_0x2a52ac,_0x2a52ac[_0xbd7a('0x1a3')]);this['channel'][_0xbd7a('0xa7')](util['format'](_0xbd7a('0x1a7'),_0x30f49d[_0xbd7a('0x1a')]));this['createSmsMessage'][_0xbd7a('0x6b')](this,_0x3c517d);return this['channel'][_0xbd7a('0xa7')](_0xbd7a('0x1a8'));};AGIVertices['prototype'][_0xbd7a('0x1a9')]=function(_0xac8657){logger[_0xbd7a('0x2e')](util['format'](_0xbd7a('0x1aa'),_0xac8657[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0xac8657[_0xbd7a('0xd4')])){return this[_0xbd7a('0xd')]['error'](_0xac8657,_0xbd7a('0x1ab'));}var _0x3780bd=this[_0xbd7a('0x9f')][_0xbd7a('0x6b')](this,_0xac8657['variable_id']);if(!_0x3780bd){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0xac8657,'no\x20variable\x20found');}return this[_0xbd7a('0xd')]['setVariable'](_0x3780bd,_0xac8657['variable_value']);};AGIVertices[_0xbd7a('0xe')]['start']=function(_0x475f1c){logger['info'](util[_0xbd7a('0x28')](_0xbd7a('0x1ac'),_0x475f1c[_0xbd7a('0x37')]));this[_0xbd7a('0xd')]['noop'](_0xbd7a('0x1ad'));if(_0x475f1c[_0xbd7a('0x1ae')]===_0xbd7a('0x1af')){this[_0xbd7a('0xd')]['noop']('Answer');return this[_0xbd7a('0xd')]['answer']();}return this[_0xbd7a('0xd')][_0xbd7a('0xa7')]('Skipped\x20Answer');};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x1b0')]=function(_0xcbc023){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x1b1'),_0xcbc023[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0xcbc023['project_id'])){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0xcbc023,_0xbd7a('0x1b2'));}var _0x25d2c0=this[_0xbd7a('0x15')][_0xbd7a('0x6b')](this,_0xcbc023[_0xbd7a('0x1b3')]);if(!this[_0xbd7a('0xa6')](_0x25d2c0)){return this['channel']['error'](_0xcbc023,util[_0xbd7a('0x28')](_0xbd7a('0x1b4'),_0xcbc023[_0xbd7a('0x1b3')]));}if(_0x25d2c0===this[_0xbd7a('0xd')][_0xbd7a('0x39')]){return this[_0xbd7a('0xd')]['error'](_0xcbc023,_0xbd7a('0x1b5'));}this[_0xbd7a('0x35')][_0xbd7a('0x6b')](this,_0xcbc023,_0x25d2c0);var _0x4dd5d0=this[_0xbd7a('0xd')]['exec'](_0xbd7a('0x1b6'),util['format'](_0xbd7a('0x1b7'),config['agi'][_0xbd7a('0x1b8')]||_0xbd7a('0x1b9'),_0x25d2c0,this['channel'][_0xbd7a('0x39')]));if(_0x4dd5d0[_0xbd7a('0xa2')]===-0x1){return _0x4dd5d0;}return this['channel'][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0xc0'),'AGI',_0x25d2c0));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x1ba')]=function(_0x1bafcc){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x1bb'),_0x1bafcc[_0xbd7a('0x37')]));var _0x2aeb4f=this['shellCommand'][_0xbd7a('0x6b')](this,_0x1bafcc[_0xbd7a('0x1bc')]);this['createSquareDetailsReport'][_0xbd7a('0x6b')](this,_0x1bafcc,_0x1bafcc['command']);if(this[_0xbd7a('0xa6')](_0x1bafcc[_0xbd7a('0xd4')])){var _0x23dca4=this[_0xbd7a('0x9f')]['sync'](this,_0x1bafcc[_0xbd7a('0xd4')]);if(_0x23dca4){this[_0xbd7a('0xd')][_0xbd7a('0x9c')](_0x23dca4,_0x2aeb4f);return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x1bafcc['command'],_0x23dca4));}}return this['channel'][_0xbd7a('0xa7')](util['format'](_0xbd7a('0x1bd'),_0x1bafcc[_0xbd7a('0x1bc')]));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x1be')]=function(_0x2c2143){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x1bf'),_0x2c2143[_0xbd7a('0x37')]));_0x2c2143[_0xbd7a('0x5a')]=_0x2c2143[_0xbd7a('0x5a')][_0xbd7a('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbd7a('0xa6')](_0x2c2143[_0xbd7a('0x1c0')])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')]('no\x20apiKey\x20configured');}if(!this[_0xbd7a('0xa6')](_0x2c2143[_0xbd7a('0x5a')])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0xc3'));}this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0x1c1'),_0x2c2143[_0xbd7a('0x5a')]));var _0x4080ef=this['googleCloudTTS'][_0xbd7a('0x6b')](this,_0x2c2143);if(_0x4080ef){this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0x1c2'),_0x4080ef));var _0x4bbeef=this[_0xbd7a('0xd')][_0xbd7a('0x102')](_0x4080ef);try{fs[_0xbd7a('0x125')](_0x4080ef+_0xbd7a('0x103'));}catch(_0x5bce49){logger['error'](_0x5bce49);}return _0x4bbeef;}return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x2c2143,_0xbd7a('0x1c3'));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x1c4')]=function(_0x48d918){logger['info'](util[_0xbd7a('0x28')](_0xbd7a('0x1c5'),_0x48d918[_0xbd7a('0x37')]));_0x48d918[_0xbd7a('0x5a')]=_0x48d918[_0xbd7a('0x5a')][_0xbd7a('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbd7a('0xa6')](_0x48d918[_0xbd7a('0x5a')])){return this[_0xbd7a('0xd')][_0xbd7a('0xa7')](_0xbd7a('0xc3'));}this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0x1c6'),_0x48d918[_0xbd7a('0x5a')]));var _0x4fdd4a=this[_0xbd7a('0x5f')][_0xbd7a('0x6b')](this,_0x48d918);if(_0x4fdd4a){this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0x1c7'),_0x4fdd4a));var _0x46b167=this['channel']['streamFile'](_0x4fdd4a);try{fs[_0xbd7a('0x125')](_0x4fdd4a+_0xbd7a('0x103'));}catch(_0x10bdf4){logger[_0xbd7a('0x2c')](_0x10bdf4);}return _0x46b167;}return this['channel']['error'](_0x48d918,_0xbd7a('0x1c8'));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x1c9')]=function(_0x1fe7cd){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x1ca'),_0x1fe7cd[_0xbd7a('0x37')]));if(!this['isConfigured'](_0x1fe7cd[_0xbd7a('0x15b')])){return this[_0xbd7a('0xd')]['error'](_0x1fe7cd,_0xbd7a('0x15c'));}logger['info'](util['format'](_0xbd7a('0x162'),this[_0xbd7a('0xd')][_0xbd7a('0x3b')],_0x1fe7cd[_0xbd7a('0x15b')]));var _0x51a339=this[_0xbd7a('0x50')][_0xbd7a('0x6b')](this,_0x1fe7cd[_0xbd7a('0x15b')]);if(_0x51a339){logger[_0xbd7a('0x2e')](util[_0xbd7a('0x28')](_0xbd7a('0x15e'),this[_0xbd7a('0xd')]['callerid'],_0x1fe7cd[_0xbd7a('0x15b')]));this['channel']['noop'](util[_0xbd7a('0x28')](_0xbd7a('0x15e'),this['channel'][_0xbd7a('0x3b')],_0x1fe7cd['findBy']));return{'code':0xc8,'result':_0xbd7a('0x163')};}else{logger['info'](util[_0xbd7a('0x28')](_0xbd7a('0x15f'),this[_0xbd7a('0xd')][_0xbd7a('0x3b')],_0x1fe7cd[_0xbd7a('0x15b')]));this[_0xbd7a('0xd')][_0xbd7a('0xa7')](util[_0xbd7a('0x28')](_0xbd7a('0x15f'),this['channel'][_0xbd7a('0x3b')],_0x1fe7cd[_0xbd7a('0x15b')]));return{'code':0xc8,'result':_0xbd7a('0x160')};}};AGIVertices['prototype'][_0xbd7a('0x1cb')]=function(_0x1a11e7){logger[_0xbd7a('0x2e')](util['format'](_0xbd7a('0x1cc'),_0x1a11e7['label']));var _0x279e94=this['channel'][_0xbd7a('0x55')](_0xbd7a('0x1cd'),[_0x1a11e7[_0xbd7a('0x1ce')],_0x1a11e7[_0xbd7a('0x75')]]);if(_0x279e94['result']===-0x1){return _0x279e94;}return this['channel'][_0xbd7a('0xa7')](util['format'](_0xbd7a('0xc0'),'VOICEMAIL',_0x1a11e7[_0xbd7a('0x1ce')]));};AGIVertices[_0xbd7a('0xe')][_0xbd7a('0x1cf')]=function(_0x1d313a){logger[_0xbd7a('0x2e')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x1d313a[_0xbd7a('0x37')]));if(!this[_0xbd7a('0xa6')](_0x1d313a['variable_id'])){return this[_0xbd7a('0xd')][_0xbd7a('0x2c')](_0x1d313a,_0xbd7a('0x1ab'));}var _0x3a1cb9=this[_0xbd7a('0x9f')][_0xbd7a('0x6b')](this,_0x1d313a[_0xbd7a('0xd4')]);if(!_0x3a1cb9){return this[_0xbd7a('0xd')]['error'](_0x1d313a,_0xbd7a('0xd6'));}var _0x5c6b44=this[_0xbd7a('0xd')][_0xbd7a('0x9f')](_0x3a1cb9);return{'code':0xc8,'result':_0x5c6b44[_0xbd7a('0xa0')]?_0x5c6b44[_0xbd7a('0xa0')]:'-'};};String[_0xbd7a('0xe')][_0xbd7a('0x9e')]=function(_0x553782,_0x56085c){return this[_0xbd7a('0x9d')](_0x553782)[_0xbd7a('0x1d0')](_0x56085c);};module[_0xbd7a('0x1d1')]=AGIVertices; \ No newline at end of file +var _0x3f72=['generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','%s/recordings/%s','beep','NOBEEP','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','wav','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','context','extension','priority','gotoif','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','.wav','login','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','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','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','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','replaceAll','join','exports','util','lodash','shelljs','moment','mustache','request-promise','../../config/logger','agi','../../config/environment/shared','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','then','name','catch','getVoiceQueue','prototype','getSquareProject','getSquareOdbc','getSquareOdbcById','getUserById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','IntervalId','interval','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','uniqueid','label','arg_1','callerid','createSquareRecording','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','body','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','model','awsPolly','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','google_asr_language','tildeASR','appsecret','agicommand','clone','isString','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','saveRestApiResult','format','%s.%s','setVariable','replaceObjectAllVariables','split','extra','length','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','exec','MRCPRecog','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','Dialogflow\x20Result\x20%s','speech','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20anguage\x20configured','bot','out','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','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','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit'];(function(_0x799107,_0x3ae144){var _0x529fa4=function(_0x2c8784){while(--_0x2c8784){_0x799107['push'](_0x799107['shift']());}};_0x529fa4(++_0x3ae144);}(_0x3f72,0xaf));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var fs=require('fs');var util=require(_0x23f7('0x0'));var _=require(_0x23f7('0x1'));var sh=require(_0x23f7('0x2'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x23f7('0x3'));var Mustache=require(_0x23f7('0x4'));var rp=require(_0x23f7('0x5'));var logger=require(_0x23f7('0x6'))(_0x23f7('0x7'));var config=require('../../config/environment');var shared=require(_0x23f7('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x23f7('0x9');var recursiveMapAttributes=['rawHeaders',_0x23f7('0xa')];var verticesWithRetry=[_0x23f7('0xb'),_0x23f7('0xc'),_0x23f7('0xd')];var AGIVertices=function(_0xccd3c0,_0x1cdd69,_0x3a048c){this[_0x23f7('0xe')]=_0xccd3c0;this[_0x23f7('0xf')]=_0x1cdd69;this[_0x23f7('0x10')]=_0x3a048c;};AGIVertices['prototype'][_0x23f7('0x11')]=function(_0xdaa6e1,_0x4173f1){this['rpc']['getVariableById'](_0xdaa6e1)[_0x23f7('0x12')](function(_0x401ced){_0x4173f1(null,_0x401ced?_0x401ced[_0x23f7('0x13')]:![]);})[_0x23f7('0x14')](function(_0x37510b){_0x4173f1(_0x37510b);});};AGIVertices['prototype'][_0x23f7('0x15')]=function(_0x462af4,_0x2dc34c){this[_0x23f7('0xf')]['getVoiceQueueById'](_0x462af4)[_0x23f7('0x12')](function(_0x434484){_0x2dc34c(null,_0x434484?_0x434484[_0x23f7('0x13')]:![]);})[_0x23f7('0x14')](function(_0x15a35d){_0x2dc34c(_0x15a35d);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x17')]=function(_0x4f7348,_0x2669ab){this[_0x23f7('0xf')]['getSquareProjectById'](_0x4f7348)['then'](function(_0x10d8d2){_0x2669ab(null,_0x10d8d2?_0x10d8d2[_0x23f7('0x13')]:![]);})[_0x23f7('0x14')](function(_0x38bccd){_0x2669ab(_0x38bccd);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x18')]=function(_0x3748bb,_0xaa3b7d){this['rpc'][_0x23f7('0x19')](_0x3748bb)[_0x23f7('0x12')](function(_0x1811bf){_0xaa3b7d(null,_0x1811bf?_0x1811bf['dsn']:![]);})['catch'](function(_0xfc8726){_0xaa3b7d(_0xfc8726);});};AGIVertices['prototype']['getUser']=function(_0x1f82d4,_0x34a5e4){this['rpc'][_0x23f7('0x1a')](_0x1f82d4)[_0x23f7('0x12')](function(_0x59260b){_0x34a5e4(null,_0x59260b?_0x59260b[_0x23f7('0x13')]:![]);})[_0x23f7('0x14')](function(_0x3ebc73){_0x34a5e4(_0x3ebc73);});};AGIVertices['prototype']['getTrunk']=function(_0x2f84c3,_0x12b007){this[_0x23f7('0xf')]['getTrunkById'](_0x2f84c3)[_0x23f7('0x12')](function(_0x52a823){_0x12b007(null,_0x52a823?_0x52a823[_0x23f7('0x13')]:![]);})[_0x23f7('0x14')](function(_0x57d6e6){_0x12b007(_0x57d6e6);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1b')]=function(_0x3a4796,_0x3a980e){var _0xf1fa9f=this;this['rpc'][_0x23f7('0x1c')](_0x3a4796)[_0x23f7('0x12')](function(_0x310fa8){_0x3a980e(null,_0x310fa8?_0xf1fa9f[_0x23f7('0x1d')](_0x310fa8[_0x23f7('0x1e')]):![]);})[_0x23f7('0x14')](function(_0x77d50f){_0x3a980e(_0x77d50f);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1f')]=function(_0x3897b3,_0xf0da88){this[_0x23f7('0xf')]['getMailAccountById'](_0x3897b3)[_0x23f7('0x12')](function(_0x1d4754){_0xf0da88(null,_0x1d4754?_0x1d4754:![]);})[_0x23f7('0x14')](function(_0x519705){_0xf0da88(_0x519705);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x20')]=function(_0x2f8a2c,_0xff5c15,_0x301818){this[_0x23f7('0x10')]['sendMailMessage'](_0x2f8a2c,_0xff5c15)[_0x23f7('0x12')](function(){_0x301818(null);})[_0x23f7('0x14')](function(_0xce1783){_0x301818(_0xce1783);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x21')]=function(_0x61d3e5,_0x3bfb07){this[_0x23f7('0xf')]['getIntervalById'](_0x61d3e5)[_0x23f7('0x12')](function(_0x2a702f){if(_0x2a702f){if(_0x2a702f[_0x23f7('0x22')]){_0x3bfb07(null,[_0x2a702f[_0x23f7('0x23')]]);}else{_0x3bfb07(null,_['map'](_0x2a702f['Intervals'],_0x23f7('0x23')));}}else{_0x3bfb07(null,![]);}})['catch'](function(_0x310cb0){_0x3bfb07(_0x310cb0);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1d')]=function(_0xf1b093){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0xf1b093);};AGIVertices[_0x23f7('0x16')]['getQueryOdbc']=function(_0x5f2924,_0x3cc50a,_0x3bb396){odbc[_0x23f7('0x24')](_0x5f2924,function(_0x123c49){if(_0x123c49){logger[_0x23f7('0x25')](_0x23f7('0x26'),_0x123c49);_0x3bb396(_0x123c49);}else{logger[_0x23f7('0x27')](_0x23f7('0x28'));odbc['query'](_0x3cc50a,function(_0x2cbbac,_0x399a04){if(_0x2cbbac){logger[_0x23f7('0x27')](_0x23f7('0x29'),_0x3cc50a);_0x3bb396(_0x2cbbac);}else{logger[_0x23f7('0x27')](_0x23f7('0x2a'),_0x3cc50a);odbc['close'](function(_0x580fc4){if(_0x580fc4){logger[_0x23f7('0x25')](_0x23f7('0x2b'),_0x580fc4);}_0x3bb396(null,_0x399a04);});}});}});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x2c')]=function(_0x1eeedf,_0xfd3c7){this['rpc'][_0x23f7('0x2d')](_0x1eeedf)[_0x23f7('0x12')](function(_0x38e18c){_0xfd3c7(null,_0x38e18c?_0x38e18c:![]);})[_0x23f7('0x14')](function(_0x3f46be){_0xfd3c7(_0x3f46be);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x2e')]=function(_0x3725d2,_0x5d0e99){this['rpc']['createSmsMessage'](_0x3725d2)[_0x23f7('0x12')](function(_0x9c5615){_0x5d0e99(null,_0x9c5615);})[_0x23f7('0x14')](function(_0x36ce93){_0x5d0e99(_0x36ce93);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x2f')]=function(_0x4092b3,_0x5809c2,_0x192cfb){this[_0x23f7('0xf')][_0x23f7('0x2f')]({'uniqueid':this[_0x23f7('0xe')][_0x23f7('0x30')],'node':_0x4092b3[_0x23f7('0x31')],'application':_0x4092b3['agicommand'],'data':_0x5809c2||null,'project_name':this[_0x23f7('0xe')][_0x23f7('0x32')],'callerid':this['channel'][_0x23f7('0x33')]})[_0x23f7('0x12')](function(_0x22bcd7){if(_0x192cfb){_0x192cfb(null,_0x22bcd7);}})[_0x23f7('0x14')](function(_0x5369d1){if(_0x192cfb){_0x192cfb(_0x5369d1);}});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x34')]=function(_0x4243ce,_0x1828a2,_0x36cec6,_0x4efaa2){this[_0x23f7('0xf')][_0x23f7('0x34')]({'uniqueid':this[_0x23f7('0xe')][_0x23f7('0x30')],'callerid':this['channel'][_0x23f7('0x33')],'calleridname':this[_0x23f7('0xe')]['calleridname'],'context':this[_0x23f7('0xe')]['context'],'extension':this[_0x23f7('0xe')]['extension'],'priority':this[_0x23f7('0xe')]['priority'],'accountcode':this[_0x23f7('0xe')][_0x23f7('0x35')],'dnid':this[_0x23f7('0xe')][_0x23f7('0x36')],'projectName':this[_0x23f7('0xe')]['arg_1'],'saveName':_0x1828a2,'filename':_0x4243ce[_0x23f7('0x37')]||_0x1828a2,'savePath':_0x36cec6})[_0x23f7('0x12')](function(_0x3a73a6){_0x4efaa2(null,_0x3a73a6);})['catch'](function(_0x37ae3b){_0x4efaa2(_0x37ae3b);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x38')]=function(_0x20b2d9,_0x334d61,_0xbb6418,_0x29152c,_0x5907e6){this[_0x23f7('0xf')][_0x23f7('0x38')]({'uniqueid':this[_0x23f7('0xe')]['uniqueid'],'body':_0x20b2d9,'direction':_0x334d61,'providerName':_0xbb6418,'providerResponse':_0x29152c})[_0x23f7('0x12')](function(_0x26578f){if(_0x5907e6){_0x5907e6(null,_0x26578f);}})[_0x23f7('0x14')](function(_0x2216e6){if(_0x5907e6){_0x5907e6(_0x2216e6);}});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x39')]=function(_0x1d888,_0x3c3f7e){this[_0x23f7('0xf')][_0x23f7('0x39')]({'firstName':_[_0x23f7('0x3a')](_0x1d888[_0x23f7('0x13')])||_['isNil'](_0x1d888[_0x23f7('0x13')])?'callback_'+Math['random']():_0x1d888[_0x23f7('0x13')],'lastName':_[_0x23f7('0x3a')](_0x1d888[_0x23f7('0x3b')])||_['isNil'](_0x1d888[_0x23f7('0x3b')])?null:_0x1d888[_0x23f7('0x3b')],'phone':_0x1d888[_0x23f7('0x3c')],'ListId':_0x1d888[_0x23f7('0x3d')],'scheduledat':_0x1d888[_0x23f7('0x3e')],'callbackUniqueid':this['channel'][_0x23f7('0x30')],'tags':_0x23f7('0x3f'),'description':_0x23f7('0x40')+_0x1d888[_0x23f7('0x3e')][_0x23f7('0x41')](),'priority':_0x1d888[_0x23f7('0x42')]})[_0x23f7('0x12')](function(_0xcdbf6){_0x3c3f7e(null,_0xcdbf6);})[_0x23f7('0x14')](function(_0x50a3c6){_0x3c3f7e(_0x50a3c6);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x43')]=function(_0x5e2521,_0x182f9b){this[_0x23f7('0xf')][_0x23f7('0x44')](_0x5e2521)[_0x23f7('0x12')](function(_0x4d0e9f){_0x182f9b(null,_0x4d0e9f?_0x4d0e9f[_0x23f7('0x13')]:![]);})[_0x23f7('0x14')](function(_0x11273b){_0x182f9b(_0x11273b);});};AGIVertices['prototype'][_0x23f7('0x45')]=function(_0x24324b,_0x5b4ab3,_0x219d29){var _0x25ad9={'role':_0x23f7('0x46')};_0x25ad9[_0x24324b]=this[_0x23f7('0xe')][_0x23f7('0x33')];this[_0x23f7('0xf')]['agentPause'](_0x25ad9,_0x5b4ab3,this[_0x23f7('0xe')][_0x23f7('0x30')])[_0x23f7('0x12')](function(_0x169b6b){_0x219d29(null,_[_0x23f7('0x47')](_0x169b6b)?![]:!![]);})[_0x23f7('0x14')](function(_0x171f8e){logger[_0x23f7('0x25')](_0x171f8e);_0x219d29(null,![]);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x48')]=function(_0x51730e,_0x423591){var _0x37887d={'role':_0x23f7('0x46')};_0x37887d[_0x51730e]=this[_0x23f7('0xe')][_0x23f7('0x33')];this[_0x23f7('0xf')][_0x23f7('0x48')](_0x37887d)[_0x23f7('0x12')](function(_0x100b42){_0x423591(null,_[_0x23f7('0x47')](_0x100b42)?![]:!![]);})[_0x23f7('0x14')](function(_0x3b4243){logger[_0x23f7('0x25')](_0x3b4243);_0x423591(null,![]);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x49')]=function(_0x2597ed,_0x32f430){var _0x16ae16={'role':_0x23f7('0x46')};_0x16ae16[_0x2597ed]=this[_0x23f7('0xe')][_0x23f7('0x33')];this[_0x23f7('0xf')][_0x23f7('0x49')](_0x16ae16)[_0x23f7('0x12')](function(_0x4e0d4e){_0x32f430(null,_[_0x23f7('0x47')](_0x4e0d4e)?![]:!![]);})[_0x23f7('0x14')](function(_0x2091f9){logger['error'](_0x2091f9);_0x32f430(null,![]);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x4a')]=function(_0x5b5b3b,_0x41b06d){var _0x5e5a84={'role':_0x23f7('0x46')};_0x5e5a84[_0x5b5b3b]=this[_0x23f7('0xe')][_0x23f7('0x33')];var _0x4e32eb=_0x5b5b3b!='internal'?util['format'](_0x23f7('0x4b'),_0x23f7('0x4c'),this[_0x23f7('0xe')][_0x23f7('0x33')]):undefined;this[_0x23f7('0xf')][_0x23f7('0x4a')](_0x5e5a84,_0x4e32eb)[_0x23f7('0x12')](function(_0x4267ed){_0x41b06d(null,_[_0x23f7('0x47')](_0x4267ed)?![]:!![]);})['catch'](function(_0x20387b){logger[_0x23f7('0x25')](_0x20387b);_0x41b06d(null,![]);});};AGIVertices['prototype'][_0x23f7('0x4d')]=function(_0x4f19cd,_0xa92775){sh['exec'](_[_0x23f7('0x4e')](_0x4f19cd),function(_0x3cd86f,_0x518352){var _0x2c9e98=_0x518352[_0x23f7('0x4f')](/(\r\n|\n|\r)/gm,'');_0xa92775(null,_0x2c9e98);});};AGIVertices[_0x23f7('0x16')]['googleCloudTTS']=function(_0x211d5e,_0x295104){scripts['googleCloudTTS'](_0x211d5e[_0x23f7('0x50')],_0x211d5e['google_cloud_tts_text_type']||_0x23f7('0x51'),_0x211d5e[_0x23f7('0x51')],_0x211d5e[_0x23f7('0x52')]||_0x23f7('0x53'),_0x211d5e[_0x23f7('0x54')]||_0x23f7('0x55'),_0x211d5e[_0x23f7('0x56')]||_0x23f7('0x57'))[_0x23f7('0x12')](function(_0x64b14e){_0x295104(null,_0x64b14e);})['catch'](function(_0x552018){_0x295104(_0x552018);});};AGIVertices[_0x23f7('0x16')]['googleTTS']=function(_0x3b1a18,_0xcab543){scripts[_0x23f7('0x58')](_0x3b1a18[_0x23f7('0x51')],_0x3b1a18[_0x23f7('0x59')]||'en',0x1)[_0x23f7('0x12')](function(_0xe30b31){_0xcab543(null,_0xe30b31);})[_0x23f7('0x14')](function(_0x5ae763){_0xcab543(_0x5ae763);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x5a')]=function(_0x81626e,_0x4bca58){var _0x31fd8d={'uri':_0x81626e[_0x23f7('0x5b')],'method':_0x81626e[_0x23f7('0x5c')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x81626e['timeout'])===_0x23f7('0x5d')&&parseInt(_0x81626e[_0x23f7('0x5e')])>=0x1?parseInt(_0x81626e['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x23f7('0x5f')]([_0x23f7('0x60'),_0x23f7('0x61')],_0x31fd8d['method'][_0x23f7('0x62')]())){try{_0x31fd8d['body']=_0x81626e[_0x23f7('0xa')]?JSON[_0x23f7('0x63')](_0x81626e[_0x23f7('0xa')]):{};}catch(_0x5b2209){logger[_0x23f7('0x25')](_0x23f7('0x64'),_0x5b2209);}}try{_0x31fd8d[_0x23f7('0x65')]=_0x81626e[_0x23f7('0x66')]?JSON[_0x23f7('0x63')](_0x81626e[_0x23f7('0x66')]):{};}catch(_0x1b5d40){logger[_0x23f7('0x25')](_0x23f7('0x67'),_0x1b5d40);}if(_0x81626e[_0x23f7('0x68')]){try{var _0x2535e9=require(_0x81626e[_0x23f7('0x68')])[_0x23f7('0x69')](this,_0x31fd8d);_0x31fd8d['uri']=Mustache['render'](_0x81626e['url'],_0x2535e9,{},['$$','$$']);if(_0x31fd8d[_0x23f7('0x65')]){_0x31fd8d['headers']=JSON[_0x23f7('0x63')](Mustache[_0x23f7('0x6a')](JSON[_0x23f7('0x6b')](_0x31fd8d[_0x23f7('0x65')]),_0x2535e9,{},['$$','$$']));}if(_0x31fd8d[_0x23f7('0x6c')]){_0x31fd8d['body']=JSON[_0x23f7('0x63')](Mustache[_0x23f7('0x6a')](JSON['stringify'](_0x31fd8d[_0x23f7('0x6c')]),_0x2535e9,{},['$$','$$']));}}catch(_0x445a55){logger[_0x23f7('0x25')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x445a55);}}rp(_0x31fd8d)[_0x23f7('0x12')](function(_0xd0fdd1){var _0x52395f={'statusCode':_0xd0fdd1['statusCode']||0xc8,'statusMessage':_0xd0fdd1[_0x23f7('0x6d')]||'OK','headers':_0xd0fdd1[_0x23f7('0x65')]||{},'body':_0xd0fdd1[_0x23f7('0x6c')]||{}};_0x4bca58(null,_0x52395f);})['catch'](function(_0x4eeaf2){var _0x18910d={'statusCode':_0x4eeaf2['statusCode']||0x1f4,'statusMessage':_0x4eeaf2[_0x23f7('0x6e')]||_0x23f7('0x6f'),'headers':_0x4eeaf2[_0x23f7('0x70')][_0x23f7('0x65')]||{},'body':_0x4eeaf2[_0x23f7('0x70')]['body']||{}};_0x4bca58(null,_0x18910d);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x71')]=function(_0x1b4055,_0x6074d9){scripts[_0x23f7('0x71')](this[_0x23f7('0xe')][_0x23f7('0x30')],_0x1b4055[_0x23f7('0x72')],_0x1b4055[_0x23f7('0x51')],_0x1b4055[_0x23f7('0x73')]||'en')[_0x23f7('0x12')](function(_0x55bc4d){_0x6074d9(null,_0x55bc4d);})[_0x23f7('0x14')](function(_0x1f82a0){_0x6074d9(_0x1f82a0);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x74')]=function(_0x321265,_0x504c55){scripts[_0x23f7('0x74')](this['channel'][_0x23f7('0x30')],_0x321265[_0x23f7('0x75')],_0x321265[_0x23f7('0x76')],_0x321265['private_key'],_0x321265[_0x23f7('0x51')],_0x321265[_0x23f7('0x77')]||'en')[_0x23f7('0x12')](function(_0x21a565){_0x504c55(null,_0x21a565);})[_0x23f7('0x14')](function(_0x30625e){_0x504c55(_0x30625e);});};AGIVertices['prototype']['sestekNDA']=function(_0x31eb3e,_0xe5ce11){scripts[_0x23f7('0x78')](this[_0x23f7('0xe')],_0x31eb3e)['then'](function(_0x4bbdc1){_0xe5ce11(null,_0x4bbdc1);})[_0x23f7('0x14')](function(_0x5e3d82){_0xe5ce11(_0x5e3d82);});};AGIVertices['prototype'][_0x23f7('0x79')]=function(_0x4a988b,_0x30c574){scripts[_0x23f7('0x79')](_0x4a988b[_0x23f7('0x72')],_0x4a988b[_0x23f7('0x51')],_0x4a988b[_0x23f7('0x7a')]||_0x23f7('0x53'),_0x4a988b['speed'])[_0x23f7('0x12')](function(_0x36f664){_0x30c574(null,_0x36f664);})[_0x23f7('0x14')](function(_0x4f2d4d){_0x30c574(_0x4f2d4d);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x7b')]=function(_0x29759f,_0x13c224,_0x418c73){scripts[_0x23f7('0x7b')](_0x13c224,_0x29759f['key'],_0x29759f[_0x23f7('0x7c')]||_0x23f7('0x53'),this['isConfigured'](_0x29759f[_0x23f7('0x7d')])?_0x29759f[_0x23f7('0x7d')]:undefined)[_0x23f7('0x12')](function(_0x573a20){_0x418c73(null,_0x573a20);})[_0x23f7('0x14')](function(_0x10ff78){_0x418c73(_0x10ff78);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x7e')]=function(_0x15d8ff,_0x113edf){scripts[_0x23f7('0x7e')](_0x15d8ff[_0x23f7('0x7f')],_0x15d8ff[_0x23f7('0x80')],_0x15d8ff[_0x23f7('0x81')],_0x15d8ff[_0x23f7('0x82')]||_0x23f7('0x83'),_0x15d8ff['text'],_0x15d8ff[_0x23f7('0x84')]||_0x23f7('0x51'))['then'](function(_0x191dbf){_0x113edf(null,_0x191dbf);})['catch'](function(_0x558152){_0x113edf(_0x558152);});};AGIVertices['prototype'][_0x23f7('0x85')]=function(_0xa159da,_0x2eaa0e){scripts[_0x23f7('0x85')](this['channel'][_0x23f7('0x30')],_0xa159da[_0x23f7('0x7f')],_0xa159da['aws_secret_access_key'],_0xa159da[_0x23f7('0x86')],_0xa159da[_0x23f7('0x51')],_0xa159da[_0x23f7('0x87')])[_0x23f7('0x12')](function(_0x3580eb){_0x2eaa0e(null,_0x3580eb);})[_0x23f7('0x14')](function(_0xfc46b5){_0x2eaa0e(_0xfc46b5);});};AGIVertices[_0x23f7('0x16')][_0x23f7('0x88')]=function(_0x40daa7,_0x435ffe,_0x3e8519){scripts[_0x23f7('0x88')](_0x435ffe,_0x40daa7[_0x23f7('0x72')],_0x40daa7[_0x23f7('0x89')]||'en-US')[_0x23f7('0x12')](function(_0x3414fe){_0x3e8519(null,_0x3414fe);})[_0x23f7('0x14')](function(_0x41f0f3){_0x3e8519(_0x41f0f3);});};AGIVertices['prototype'][_0x23f7('0x8a')]=function(_0x4f1426,_0x1422fb,_0x4c5293){scripts[_0x23f7('0x8a')](_0x1422fb,_0x4f1426['appid'],_0x4f1426[_0x23f7('0x8b')],_0x4f1426['uri'])[_0x23f7('0x12')](function(_0x50c57e){_0x4c5293(null,_0x50c57e);})[_0x23f7('0x14')](function(_0x2c4dbc){_0x4c5293(_0x2c4dbc);});};AGIVertices[_0x23f7('0x16')]['clear']=function(_0x4fe53a){var _0x17a505=_['includes'](verticesWithRetry,_0x4fe53a[_0x23f7('0x8c')])?_0x4fe53a:_[_0x23f7('0x8d')](_0x4fe53a);for(var _0x57a2f8 in _0x17a505){if(_0x17a505['hasOwnProperty'](_0x57a2f8)){if(_0x17a505[_0x57a2f8]&&_[_0x23f7('0x8e')](_0x17a505[_0x57a2f8])){if(_[_0x23f7('0x5f')](recursiveMapAttributes,_0x57a2f8)){_0x17a505[_0x57a2f8]=this['replaceObjectAllVariables'](_0x17a505[_0x57a2f8]);}else{_0x17a505[_0x57a2f8]=this[_0x23f7('0x8f')](_0x17a505[_0x57a2f8]);}}}}return _0x17a505;};AGIVertices[_0x23f7('0x16')][_0x23f7('0x90')]=function(_0x1c8952){for(var _0x5f340b in _0x1c8952){if(_0x1c8952[_0x23f7('0x91')](_0x5f340b)){if(_[_0x23f7('0x92')](_0x1c8952[_0x5f340b])){this[_0x23f7('0x90')](_0x1c8952[_0x5f340b]);}else if(_[_0x23f7('0x93')](_0x1c8952[_0x5f340b])){for(var _0xcee4c4=0x0;_0xcee4c4<_0x1c8952[_0x5f340b]['length'];_0xcee4c4++){this[_0x23f7('0x90')](_0x1c8952[_0x5f340b][_0xcee4c4]);}}else if(_['isString'](_0x1c8952[_0x5f340b])){_0x1c8952[_0x5f340b]=this['replaceAllVariables'](_0x1c8952[_0x5f340b]);}}}};AGIVertices[_0x23f7('0x16')][_0x23f7('0x94')]=function(_0xee1b20,_0x2feeac){for(var _0xced0c7 in _0xee1b20){if(_0xee1b20[_0x23f7('0x91')](_0xced0c7)){if(_['isPlainObject'](_0xee1b20[_0xced0c7])){if(!_[_0x23f7('0x3a')](_0xee1b20[_0xced0c7])){this[_0x23f7('0x94')](_0xee1b20[_0xced0c7],util[_0x23f7('0x95')](_0x23f7('0x96'),_0x2feeac,_0xced0c7));}}else if(_['isArray'](_0xee1b20[_0xced0c7])){for(var _0x321e8f=0x0;_0x321e8f<_0xee1b20[_0xced0c7]['length'];_0x321e8f++){this[_0x23f7('0x94')](_0xee1b20[_0xced0c7][_0x321e8f],util[_0x23f7('0x95')](_0x23f7('0x96'),_0x2feeac,_0xced0c7+'['+_0x321e8f+']'));}}else{if(!_['isNil'](_0xee1b20[_0xced0c7])){this[_0x23f7('0xe')][_0x23f7('0x97')](util['format'](_0x23f7('0x96'),_0x2feeac,_0xced0c7),_0xee1b20[_0xced0c7]);}}}}};AGIVertices[_0x23f7('0x16')][_0x23f7('0x98')]=function(_0x38e381){try{var _0x3a03a6=JSON[_0x23f7('0x63')](_0x38e381);this[_0x23f7('0x90')](_0x3a03a6);return JSON[_0x23f7('0x6b')](_0x3a03a6);}catch(_0x2aa896){return this[_0x23f7('0x8f')](_0x38e381);}};AGIVertices['prototype'][_0x23f7('0x8f')]=function(_0xbbc385){var _0x5b1423=_0xbbc385[_0x23f7('0x99')]('{');for(var _0x2e9fda=0x1;_0x2e9fda<_0x5b1423['length'];_0x2e9fda+=0x1){var _0x4b9268=_0x5b1423[_0x2e9fda][_0x23f7('0x99')]('}');if(_0x4b9268['length']>0x1){_0xbbc385=_0xbbc385['replaceAll']('{'+_0x4b9268[0x0]+'}',this[_0x23f7('0xe')][_0x23f7('0x11')](_0x4b9268[0x0])[_0x23f7('0x9a')]||_0x4b9268[0x0]);}}if(_0x5b1423[_0x23f7('0x9b')]===0x1){return _0xbbc385['toString']();}return this[_0x23f7('0x8f')](_0xbbc385);};AGIVertices[_0x23f7('0x16')][_0x23f7('0x9c')]=function(_0x318376,_0x9d50e9){var _0x26a9e0=this['channel'][_0x23f7('0x11')](_0x318376);if(_0x26a9e0[_0x23f7('0x9d')]===-0x1){return _0x26a9e0;}logger['info'](util[_0x23f7('0x95')](_0x23f7('0x9e'),_0x9d50e9,_0x26a9e0[_0x23f7('0x9a')]));return this[_0x23f7('0xe')][_0x23f7('0x97')](_0x9d50e9,_0x26a9e0[_0x23f7('0x9a')]);};AGIVertices[_0x23f7('0x16')][_0x23f7('0x9f')]=function(_0x2376e7){return _0x2376e7&&_0x2376e7!=='0'&&_0x2376e7!=='-1'&&_0x2376e7!=='';};AGIVertices[_0x23f7('0x16')][_0x23f7('0xa0')]=function(_0x1d1263){this[_0x23f7('0x2f')]['sync'](this,_0x1d1263,'-');_0x1d1263[_0x23f7('0xa1')]=_0x1d1263[_0x23f7('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x23f7('0x16')][_0x23f7('0xa2')]=function(_0x204264){logger['info'](util['format'](_0x23f7('0xa3'),_0x204264['label']));if(!this[_0x23f7('0x9f')](_0x204264[_0x23f7('0x51')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xa5'));}var _0x46bad7='\x22'+_0x204264['text']+'\x22';if(this[_0x23f7('0x9f')](_0x204264[_0x23f7('0x70')])){_0x46bad7+=','+_0x204264['options'];}var _0x2229dd=this[_0x23f7('0xe')]['exec'](_0x23f7('0xa6'),_0x46bad7);if(_0x2229dd[_0x23f7('0x9d')]===-0x1){return _0x2229dd;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0xa7'),_0x46bad7));};AGIVertices['prototype'][_0x23f7('0xa8')]=function(_0x3cd140){logger['info'](util[_0x23f7('0x95')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x3cd140[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x3cd140[_0x23f7('0xa9')])){return this[_0x23f7('0xe')]['noop'](_0x23f7('0xaa'));}var _0x1cf6eb=_0x3cd140['grammar'];if(this['isConfigured'](_0x3cd140['options'])){_0x1cf6eb+=','+_0x3cd140[_0x23f7('0x70')];}var _0x588bb5=this[_0x23f7('0xe')][_0x23f7('0xab')](_0x23f7('0xac'),_0x1cf6eb);if(_0x588bb5[_0x23f7('0x9d')]===-0x1){return _0x588bb5;}var _0x42f3ad=this[_0x23f7('0x9c')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x42f3ad['result']===-0x1){return _0x42f3ad;}var _0x308fd6=this[_0x23f7('0x9c')](_0x23f7('0xad'),_0x23f7('0xae'));if(_0x308fd6[_0x23f7('0x9d')]===-0x1){return _0x308fd6;}var _0xbe97ff=this['getAndSetVariable']('RECOG_INSTANCE()',_0x23f7('0xaf'));if(_0xbe97ff[_0x23f7('0x9d')]===-0x1){return _0xbe97ff;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1cf6eb));};AGIVertices[_0x23f7('0x16')]['agi']=function(_0x1e8df7){logger[_0x23f7('0x27')](util['format'](_0x23f7('0xb0'),_0x1e8df7[_0x23f7('0x31')]));return this[_0x23f7('0xe')][_0x23f7('0x7')]([_0x1e8df7[_0x23f7('0xb1')],_0x1e8df7[_0x23f7('0xb2')]]);};AGIVertices[_0x23f7('0x16')][_0x23f7('0xb3')]=function(_0x1db51e){logger['info'](util[_0x23f7('0x95')](_0x23f7('0xb4'),_0x1db51e['label']));if(this[_0x23f7('0x9f')](_0x1db51e[_0x23f7('0x5e')])){logger[_0x23f7('0x27')](util['format'](_0x23f7('0xb5'),_0x1db51e[_0x23f7('0x5e')]));var _0x2a7125=this[_0x23f7('0xe')][_0x23f7('0xb6')](_0x1db51e['timeout']);if(_0x2a7125[_0x23f7('0x9d')]===-0x1){return _0x2a7125;}}return this[_0x23f7('0xe')]['answer']();};AGIVertices[_0x23f7('0x16')][_0x23f7('0x3f')]=function(_0x31d4e0){logger['info'](util[_0x23f7('0x95')](_0x23f7('0xb7'),_0x31d4e0[_0x23f7('0x31')]));if(!this['isConfigured'](_0x31d4e0[_0x23f7('0x3d')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x31d4e0,'no\x20list\x20selected');}_0x31d4e0[_0x23f7('0x3e')]=moment();if(this[_0x23f7('0x9f')](_0x31d4e0[_0x23f7('0xb8')])){_0x31d4e0[_0x23f7('0x3e')]=moment()[_0x23f7('0xb9')](_0x31d4e0[_0x23f7('0xb8')],_0x23f7('0xba'));}if(!this['isConfigured'](_0x31d4e0['callback_priority'])){_0x31d4e0['callback_priority']=0x2;}this['createCmContact'][_0x23f7('0x69')](this,_0x31d4e0);return this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0xbb'),_0x31d4e0['phone'],_0x31d4e0['list_id'],_0x31d4e0['scheduledAt']));};AGIVertices[_0x23f7('0x16')]['custom_app']=function(_0x17dfd3){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0xbc'),_0x17dfd3['label']));var _0x4b8d1b=this[_0x23f7('0xe')][_0x23f7('0xab')](_0x17dfd3['application'],_0x17dfd3[_0x23f7('0x70')]);if(_0x4b8d1b[_0x23f7('0x9d')]===-0x1){return _0x4b8d1b;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xbd'),_0x17dfd3[_0x23f7('0xbe')],_0x17dfd3['options']));};AGIVertices[_0x23f7('0x16')]['lumenvoxtts']=function(_0x120503){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0xbf'),_0x120503[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x120503[_0x23f7('0x51')])){return this['channel'][_0x23f7('0xa4')](_0x23f7('0xa5'));}var _0x1a1f71='\x22'+_0x120503['text']+'\x22';if(this[_0x23f7('0x9f')](_0x120503[_0x23f7('0x70')])){_0x1a1f71+=','+_0x120503['options'];}var _0x5eaeba=this[_0x23f7('0xe')][_0x23f7('0xab')]('MRCPSynth',_0x1a1f71);if(_0x5eaeba[_0x23f7('0x9d')]===-0x1){return _0x5eaeba;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0xa7'),_0x1a1f71));};AGIVertices[_0x23f7('0x16')][_0x23f7('0xc0')]=function(_0x171eeb){logger[_0x23f7('0x27')](util['format'](_0x23f7('0xc1'),_0x171eeb[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x171eeb['text'])){return this[_0x23f7('0xe')][_0x23f7('0xa4')]('no\x20text\x20configured');}var _0x204e86='\x22'+_0x171eeb[_0x23f7('0x51')]+'\x22';if(this['isConfigured'](_0x171eeb[_0x23f7('0x70')])){_0x204e86+=','+_0x171eeb[_0x23f7('0x70')];}var _0x3540fb=this[_0x23f7('0xe')][_0x23f7('0xab')]('MRCPSynth',_0x204e86);if(_0x3540fb[_0x23f7('0x9d')]===-0x1){return _0x3540fb;}return this['channel'][_0x23f7('0xa4')](util['format'](_0x23f7('0xa7'),_0x204e86));};AGIVertices[_0x23f7('0x16')][_0x23f7('0xc2')]=function(_0x412db4){logger['info'](util['format'](_0x23f7('0xc3'),_0x412db4[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x412db4['grammar'])){return this['channel'][_0x23f7('0xa4')](_0x23f7('0xaa'));}var _0x4bcbe6=_0x412db4[_0x23f7('0xa9')];if(this[_0x23f7('0x9f')](_0x412db4['options'])){_0x4bcbe6+=','+_0x412db4[_0x23f7('0x70')];}var _0x12ee47=this[_0x23f7('0xe')][_0x23f7('0xab')](_0x23f7('0xac'),_0x4bcbe6);if(_0x12ee47[_0x23f7('0x9d')]===-0x1){return _0x12ee47;}var _0x5ef076=this[_0x23f7('0x9c')]('RECOG_CONFIDENCE()',_0x23f7('0xc4'));if(_0x5ef076[_0x23f7('0x9d')]===-0x1){return _0x5ef076;}var _0x86fff5=this[_0x23f7('0x9c')](_0x23f7('0xad'),_0x23f7('0xc5'));if(_0x86fff5[_0x23f7('0x9d')]===-0x1){return _0x86fff5;}var _0x2e4b4b=this[_0x23f7('0x9c')]('RECOG_INSTANCE()',_0x23f7('0xc6'));if(_0x2e4b4b['result']===-0x1){return _0x2e4b4b;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xc7'),_0x4bcbe6));};AGIVertices[_0x23f7('0x16')][_0x23f7('0xc8')]=function(_0x58508a){logger[_0x23f7('0x27')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x58508a[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x58508a[_0x23f7('0xa9')])){return this[_0x23f7('0xe')]['noop'](_0x23f7('0xaa'));}var _0x384b1c=_0x58508a[_0x23f7('0xa9')];if(this[_0x23f7('0x9f')](_0x58508a[_0x23f7('0x70')])){_0x384b1c+=','+_0x58508a[_0x23f7('0x70')];}var _0x5ef84a=this[_0x23f7('0xe')][_0x23f7('0xab')](_0x23f7('0xac'),_0x384b1c);if(_0x5ef84a['result']===-0x1){return _0x5ef84a;}var _0x38a4bd=this[_0x23f7('0x9c')](_0x23f7('0xc9'),_0x23f7('0xca'));if(_0x38a4bd['result']===-0x1){return _0x38a4bd;}var _0x207c0a=this[_0x23f7('0x9c')]('RECOG_INPUT()',_0x23f7('0xcb'));if(_0x207c0a[_0x23f7('0x9d')]===-0x1){return _0x207c0a;}var _0x555370=this[_0x23f7('0x9c')](_0x23f7('0xcc'),'SESTEK_ASR_INSTANCE');if(_0x555370[_0x23f7('0x9d')]===-0x1){return _0x555370;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0xc7'),_0x384b1c));};AGIVertices['prototype'][_0x23f7('0xcd')]=function(_0x528390){logger[_0x23f7('0x27')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x528390['label']));if(!this[_0x23f7('0x9f')](_0x528390[_0x23f7('0xce')])){return this['channel']['error'](_0x528390,_0x23f7('0xcf'));}var _0x405b4d=this[_0x23f7('0x18')][_0x23f7('0x69')](this,_0x528390[_0x23f7('0xce')]);if(!_0x405b4d){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x528390,_0x23f7('0xd0'));}if(!this[_0x23f7('0x9f')](_0x528390[_0x23f7('0xd1')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x528390,_0x23f7('0xd2'));}var _0x52141e=_0x528390[_0x23f7('0xd1')][_0x23f7('0x4f')](/(\r\n|\n|\r)/gm,'\x20');this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xd3'),_0x52141e));var _0x52fd32=this[_0x23f7('0xd4')][_0x23f7('0x69')](this,_0x405b4d,_0x52141e);this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0x528390,_0x52141e);if(!this[_0x23f7('0x9f')](_0x528390[_0x23f7('0xd5')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xd6'));}var _0x47d0c7=this[_0x23f7('0x11')]['sync'](this,_0x528390[_0x23f7('0xd5')]);if(!_0x47d0c7){return this[_0x23f7('0xe')]['error'](_0x528390,_0x23f7('0xd7'));}var _0x30445d=this;_0x52fd32[_0x23f7('0xd8')](function(_0xdd1058,_0x590ba3){Object['keys'](_0xdd1058)['forEach'](function(_0x58a15e){_0x30445d[_0x23f7('0xe')][_0x23f7('0x97')](util['format']('%s[%s][%s]',_0x47d0c7,_0x590ba3,_0x58a15e),_0xdd1058[_0x58a15e]);});});this[_0x23f7('0xe')][_0x23f7('0x97')](util[_0x23f7('0x95')](_0x23f7('0xd9'),_0x47d0c7),_0x52fd32[_0x23f7('0x9b')]);return this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')](_0x23f7('0xda'),_0x47d0c7));};AGIVertices[_0x23f7('0x16')]['dial']=function(_0x17d77f){logger[_0x23f7('0xdb')](util[_0x23f7('0x95')](_0x23f7('0xdc'),_0x17d77f[_0x23f7('0x31')]));if(!this['isConfigured'](_0x17d77f[_0x23f7('0xdd')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x17d77f,_0x23f7('0xde'));}var _0x5cdcdf=this[_0x23f7('0xdf')][_0x23f7('0x69')](this,_0x17d77f[_0x23f7('0xdd')]);if(!_0x5cdcdf){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x17d77f,_0x23f7('0xe0'));}var _0x4dca18=this['channel'][_0x23f7('0xab')](_0x23f7('0xe1'),[util[_0x23f7('0x95')](_0x23f7('0xe2'),_0x5cdcdf),_0x17d77f[_0x23f7('0x5e')],_0x17d77f[_0x23f7('0xe3')],_0x17d77f['url']]);if(_0x4dca18[_0x23f7('0x9d')]===-0x1){return _0x4dca18;}return this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')](_0x23f7('0xe4'),_0x23f7('0xe1')));};AGIVertices[_0x23f7('0x16')][_0x23f7('0xe5')]=function(_0xd5604e){logger['info'](util['format'](_0x23f7('0xe6'),_0xd5604e[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0xd5604e[_0x23f7('0x72')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xe7'));}if(!this['isConfigured'](_0xd5604e[_0x23f7('0x51')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xa5'));}this[_0x23f7('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0xd5604e);this[_0x23f7('0x38')](_0xd5604e['text'],'in','','');this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')](_0x23f7('0xe8'),_0xd5604e[_0x23f7('0x51')]));var _0x1f55cd=this[_0x23f7('0x71')]['sync'](this,_0xd5604e);if(_0x1f55cd){for(var _0x49793c in _0x1f55cd){if(_0x1f55cd[_0x23f7('0x91')](_0x49793c)){this[_0x23f7('0xe')][_0x23f7('0x97')](util[_0x23f7('0x95')](_0x23f7('0xe9'),_0x49793c[_0x23f7('0x62')]()),_0x1f55cd[_0x49793c]);}}this[_0x23f7('0x38')](_0x1f55cd['speech'],'out',_0x23f7('0xe5'),'');return this['channel'][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xea'),_0x1f55cd[_0x23f7('0xeb')]));}return this['channel']['error'](_0xd5604e,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x23f7('0x16')][_0x23f7('0xec')]=function(_0x583a86){logger[_0x23f7('0x27')](util['format'](_0x23f7('0xed'),_0x583a86['label']));if(!this[_0x23f7('0x9f')](_0x583a86[_0x23f7('0x75')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xee'));}if(!this['isConfigured'](_0x583a86['client_email'])){return this['channel']['noop'](_0x23f7('0xef'));}if(!this[_0x23f7('0x9f')](_0x583a86[_0x23f7('0xf0')])){return this[_0x23f7('0xe')]['noop']('no\x20private_key\x20configured');}if(!this[_0x23f7('0x9f')](_0x583a86[_0x23f7('0x77')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xf1'));}if(!this[_0x23f7('0x9f')](_0x583a86[_0x23f7('0x51')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xa5'));}this['channel'][_0x23f7('0xf2')]=!![];this[_0x23f7('0x2f')](_0x583a86);this['createSquareMessage'](_0x583a86[_0x23f7('0x51')],'in','','');this[_0x23f7('0xe')]['noop'](util['format']('Trying\x20DialogflowV2:\x20%s',_0x583a86[_0x23f7('0x51')]));var _0x20f838=this[_0x23f7('0x74')][_0x23f7('0x69')](this,_0x583a86);if(_0x20f838){for(var _0x351572 in _0x20f838){if(_0x20f838[_0x23f7('0x91')](_0x351572)){if(_0x351572!=='providerResponse'){this[_0x23f7('0xe')]['setVariable'](util[_0x23f7('0x95')](_0x23f7('0xe9'),_0x351572[_0x23f7('0x62')]()),_0x20f838[_0x351572]);}}}this[_0x23f7('0x38')](_0x20f838[_0x23f7('0xeb')],_0x23f7('0xf3'),_0x23f7('0xec'),_0x20f838[_0x23f7('0xf4')]);return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xf5'),_0x20f838[_0x23f7('0xeb')]));}return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x583a86,_0x23f7('0xf6'));};AGIVertices[_0x23f7('0x16')][_0x23f7('0xf7')]=function(_0x1cd13c){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0xf8'),_0x1cd13c[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x1cd13c[_0x23f7('0xf9')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x23f7('0x9f')](_0x1cd13c[_0x23f7('0xfa')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xfb'));}if(!this[_0x23f7('0x9f')](_0x1cd13c[_0x23f7('0xfc')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xfd'));}if(!this[_0x23f7('0x9f')](_0x1cd13c[_0x23f7('0xfe')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xa5'));}this['channel'][_0x23f7('0xf2')]=!![];this[_0x23f7('0x2f')](_0x1cd13c);this[_0x23f7('0x38')](_0x1cd13c['text'],'in','','');this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0xff'),_0x1cd13c[_0x23f7('0x51')]));var _0x21eb1f=this[_0x23f7('0x78')][_0x23f7('0x69')](this,_0x1cd13c);if(_0x21eb1f){for(var _0x4eff58 in _0x21eb1f){if(_0x21eb1f['hasOwnProperty'](_0x4eff58)){this[_0x23f7('0xe')][_0x23f7('0x97')](util[_0x23f7('0x95')](_0x23f7('0x100'),_0x4eff58[_0x23f7('0x62')]()),_0x21eb1f[_0x4eff58]);}}this[_0x23f7('0x38')](_0x21eb1f[_0x23f7('0xeb')],_0x23f7('0xf3'),_0x23f7('0xf7'),'');if(_0x21eb1f[_0x23f7('0x101')]){this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x102'),_0x21eb1f[_0x23f7('0x101')]));var _0x4d8a4c=this[_0x23f7('0xe')]['streamFile'](_0x21eb1f[_0x23f7('0x101')]);try{fs[_0x23f7('0x103')](_0x21eb1f['audiofile']+'.wav');}catch(_0x4fd273){logger[_0x23f7('0x25')](_0x4fd273);}return _0x4d8a4c;}else{return this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')](_0x23f7('0x104'),_0x21eb1f[_0x23f7('0xeb')]));}}return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x1cd13c,_0x23f7('0x105'));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x106')]=function(_0x3cc58e){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x107'),_0x3cc58e[_0x23f7('0x31')]));return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0x106'));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x108')]=function(_0x51caeb){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x109'),_0x51caeb[_0x23f7('0x31')]));var _0x348b97='';if(_0x51caeb['trunk_id']){if(!this[_0x23f7('0x9f')](_0x51caeb[_0x23f7('0x10a')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x51caeb,'no\x20trunk\x20selected');}else{var _0x580c47=parseInt(_0x51caeb['trunk_id'],0xa);if(isNaN(_0x580c47)){_0x348b97=_0x51caeb['trunk_id'];}else{_0x348b97=this[_0x23f7('0x10b')][_0x23f7('0x69')](this,_0x51caeb[_0x23f7('0x10a')]);if(!_0x348b97){return this['channel']['error'](_0x51caeb,_0x23f7('0x10c'));}}}}else if(_0x51caeb[_0x23f7('0x10d')]){_0x348b97=_0x51caeb[_0x23f7('0x10d')];}else{return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x51caeb,'no\x20trunk\x20selected');}var _0xd64e3f=this[_0x23f7('0xe')][_0x23f7('0xab')](_0x23f7('0xe1'),[util[_0x23f7('0x95')](_0x23f7('0x10e'),_0x348b97,_0x51caeb[_0x23f7('0x3c')]),_0x51caeb['timeout'],_0x51caeb[_0x23f7('0xe3')],_0x51caeb[_0x23f7('0x5b')]]);if(_0xd64e3f[_0x23f7('0x9d')]===-0x1){return _0xd64e3f;}return this['channel'][_0x23f7('0xa4')](util['format'](_0x23f7('0xe4'),_0x23f7('0xe1')));};AGIVertices['prototype'][_0x23f7('0x10f')]=function(_0x1c8fc6){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1c8fc6[_0x23f7('0x31')]));return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0x10f'));};AGIVertices[_0x23f7('0x16')][_0x23f7('0xc')]=function(_0x5f31c6){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x5f31c6['label']));if(_0x5f31c6[_0x23f7('0xa1')]===0x0){return this[_0x23f7('0xa0')](_0x5f31c6);}_0x5f31c6[_0x23f7('0xa1')]-=0x1;if(!this[_0x23f7('0x9f')](_0x5f31c6[_0x23f7('0x110')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x5f31c6,_0x23f7('0x111'));}var _0x5afb33=this['getSound'][_0x23f7('0x69')](this,_0x5f31c6[_0x23f7('0x110')]);if(!_0x5afb33){return this[_0x23f7('0xe')]['error'](_0x5f31c6,_0x23f7('0x112'));}if(!this[_0x23f7('0x9f')](_0x5f31c6['variable_id'])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x23f7('0xd6'));}var _0x264fd7=this[_0x23f7('0xe')]['getData'](_0x5afb33,_0x5f31c6[_0x23f7('0x113')],_0x5f31c6[_0x23f7('0x114')]);var _0x1f2dd1=_0x264fd7[_0x23f7('0x9d')]?_0x264fd7[_0x23f7('0x9d')][_0x23f7('0x41')]():'';logger[_0x23f7('0x27')](_0x23f7('0x115'),JSON[_0x23f7('0x6b')](_0x264fd7));if(_0x264fd7[_0x23f7('0x9d')]===-0x1){this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0x5f31c6,_0x1f2dd1);return _0x264fd7;}else if(_0x264fd7[_0x23f7('0x9a')]===_0x23f7('0x5e')){_0x264fd7[_0x23f7('0x9d')]=_0x1f2dd1[_0x23f7('0x9b')]>=parseInt(_0x5f31c6[_0x23f7('0x116')])?'x':'i';}else{_0x264fd7['result']=_0x1f2dd1[_0x23f7('0x9b')]>=parseInt(_0x5f31c6['mindigit'])&&_0x1f2dd1[_0x23f7('0x9b')]<=parseInt(_0x5f31c6['maxdigit'])?'x':'i';}var _0x3f5160=this[_0x23f7('0x11')][_0x23f7('0x69')](this,_0x5f31c6[_0x23f7('0xd5')]);if(!_0x3f5160){return this['channel'][_0x23f7('0x25')](_0x5f31c6,_0x23f7('0xd7'));}this[_0x23f7('0xe')]['setVariable'](_0x3f5160,_0x1f2dd1);if(this[_0x23f7('0x9f')](_0x5f31c6['hiddendigitsnum'])){var _0x3e3413=parseInt(_0x5f31c6['hiddendigitsnum'],0xa);var _0x4c00f4=rs[_0x23f7('0x117')]({'charset':'*','length':_0x3e3413});var _0x5c6a32=_0x1f2dd1[_0x23f7('0x9b')];if(_0x5c6a32>0x0){if(_0x5c6a32>_0x3e3413){this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0x5f31c6,_0x5f31c6['hiddendigitspos']===_0x23f7('0x118')?_0x4c00f4+_0x1f2dd1['substr'](_0x3e3413):_0x1f2dd1[_0x23f7('0x119')](0x0,_0x5c6a32-_0x3e3413)+_0x4c00f4);}else{this['createSquareDetailsReport']['sync'](this,_0x5f31c6,rs[_0x23f7('0x117')]({'charset':'*','length':_0x5c6a32}));}}else{this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0x5f31c6,'');}}else{this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0x5f31c6,_0x1f2dd1);}return _0x264fd7;};AGIVertices[_0x23f7('0x16')][_0x23f7('0xd')]=function(_0x2362ac){logger['info'](util[_0x23f7('0x95')](_0x23f7('0x11a'),_0x2362ac[_0x23f7('0x31')]));return this[_0x23f7('0xc')](_0x2362ac);};AGIVertices[_0x23f7('0x16')][_0x23f7('0x11b')]=function(_0x4ea1ef){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x11c'),_0x4ea1ef[_0x23f7('0x31')]));this['createSquareDetailsReport'][_0x23f7('0x69')](this,_0x4ea1ef,_0x4ea1ef[_0x23f7('0x11d')]);return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')]('GOAL\x20%s',_0x4ea1ef[_0x23f7('0x11d')]));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x11e')]=function(_0x670e69){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x11f'),_0x670e69[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x670e69['aws_access_key_id'])||!this[_0x23f7('0x9f')](_0x670e69[_0x23f7('0x80')])){return this['channel'][_0x23f7('0xa4')](_0x23f7('0x120'));}if(!this[_0x23f7('0x9f')](_0x670e69['text'])){return this[_0x23f7('0xe')]['noop'](_0x23f7('0xa5'));}this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x121'),_0x670e69[_0x23f7('0x51')]));var _0x3afdf0=this[_0x23f7('0x7e')][_0x23f7('0x69')](this,_0x670e69);if(_0x3afdf0){this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x122'),_0x3afdf0));var _0x2e6507=this['channel'][_0x23f7('0x123')](_0x3afdf0);try{fs[_0x23f7('0x103')](_0x3afdf0+'.wav');}catch(_0x1c0d72){logger[_0x23f7('0x25')](_0x1c0d72);}return _0x2e6507;}return this[_0x23f7('0xe')]['error'](_0x670e69,_0x23f7('0x124'));};AGIVertices['prototype'][_0x23f7('0x125')]=function(_0x5095d5){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5095d5[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x5095d5['aws_access_key_id'])||!this['isConfigured'](_0x5095d5[_0x23f7('0x80')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x5095d5[_0x23f7('0x87')])){return this[_0x23f7('0xe')]['noop'](_0x23f7('0x126'));}if(!this[_0x23f7('0x9f')](_0x5095d5[_0x23f7('0x51')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xa5'));}this['channel'][_0x23f7('0xf2')]=!![];this[_0x23f7('0x2f')](_0x5095d5);this[_0x23f7('0x38')](_0x5095d5[_0x23f7('0x51')],'in','','');this['channel'][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x127'),_0x5095d5['text']));var _0x4dd8bd=this['awsLex'][_0x23f7('0x69')](this,_0x5095d5);if(_0x4dd8bd){for(var _0x258a4 in _0x4dd8bd){if(_0x4dd8bd[_0x23f7('0x91')](_0x258a4)&&_[_0x23f7('0x8e')](_0x4dd8bd[_0x258a4])){this[_0x23f7('0xe')]['setVariable'](util[_0x23f7('0x95')](_0x23f7('0x128'),_0x258a4['toUpperCase']()),_0x4dd8bd[_0x258a4]);}}if(_[_0x23f7('0x47')](_0x4dd8bd[_0x23f7('0x6e')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0x129'));}else{this[_0x23f7('0x38')](_0x4dd8bd[_0x23f7('0x6e')],_0x23f7('0xf3'),_0x23f7('0x12a'),'');return this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0x12b'),_0x4dd8bd[_0x23f7('0x6e')]));}}return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x5095d5,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x23f7('0x16')][_0x23f7('0x12c')]=function(_0x32d321){logger[_0x23f7('0x27')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x32d321[_0x23f7('0x31')],_0x32d321[_0x23f7('0x5e')]));if(!this[_0x23f7('0x9f')](_0x32d321[_0x23f7('0x72')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xe7'));}var _0x1de86a='wav';var _0x207601=util['format'](_0x23f7('0x12d'),FILES_PATH,rs[_0x23f7('0x117')](0x4));var _0x25d0af=util[_0x23f7('0x95')](_0x23f7('0x96'),_0x207601,_0x1de86a);var _0x4a6a0e=!![];if(_0x32d321[_0x23f7('0x12e')]===_0x23f7('0x12f')){_0x4a6a0e=![];}var _0x309ed9=this[_0x23f7('0xe')]['recordFile'](_0x207601,_0x1de86a,_0x32d321[_0x23f7('0x130')],_0x32d321[_0x23f7('0x5e')],undefined,_0x4a6a0e);if(_0x309ed9[_0x23f7('0x9d')]!==-0x1){this['channel'][_0x23f7('0xa4')](util['format']('google\x20%s\x20file\x20created',_0x25d0af));var _0x278af0=this[_0x23f7('0x88')][_0x23f7('0x69')](this,_0x32d321,_0x25d0af);if(_0x278af0){for(var _0x38d4dc in _0x278af0){if(_0x278af0['hasOwnProperty'](_0x38d4dc)){this[_0x23f7('0xe')][_0x23f7('0x97')](util['format'](_0x23f7('0x131'),_0x38d4dc['toUpperCase']()),_0x278af0[_0x38d4dc]);}}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x132'),JSON[_0x23f7('0x6b')](_0x278af0)));}}return _0x309ed9;};AGIVertices['prototype'][_0x23f7('0x133')]=function(_0x17d80c){logger['info'](util['format'](_0x23f7('0x134'),_0x17d80c[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x17d80c[_0x23f7('0x135')])){return this[_0x23f7('0xe')]['noop']('no\x20appid\x20configured');}if(!this['isConfigured'](_0x17d80c[_0x23f7('0x8b')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')]('no\x20appsecret\x20configured');}var _0xbd13d0=_0x23f7('0x136');var _0x2379e5=util['format'](_0x23f7('0x12d'),FILES_PATH,rs[_0x23f7('0x117')](0x4));var _0x2dfcd6=util[_0x23f7('0x95')](_0x23f7('0x96'),_0x2379e5,_0xbd13d0);var _0x341e03=!![];if(_0x17d80c[_0x23f7('0x12e')]===_0x23f7('0x12f')){_0x341e03=![];}var _0x5e8d0d=this[_0x23f7('0xe')][_0x23f7('0x137')](_0x2379e5,_0xbd13d0,_0x17d80c[_0x23f7('0x130')],_0x17d80c['timeout'],undefined,_0x341e03);if(_0x5e8d0d['result']!==-0x1){this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x138'),_0x2dfcd6));var _0x1d0fdc=this[_0x23f7('0x8a')][_0x23f7('0x69')](this,_0x17d80c,_0x2dfcd6);if(_0x1d0fdc){for(var _0x4dfc10 in _0x1d0fdc){if(_0x1d0fdc[_0x23f7('0x91')](_0x4dfc10)){this[_0x23f7('0xe')][_0x23f7('0x97')](util[_0x23f7('0x95')](_0x23f7('0x139'),_0x4dfc10[_0x23f7('0x62')]()),_0x1d0fdc[_0x4dfc10]);}}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x13a'),JSON[_0x23f7('0x6b')](_0x1d0fdc)));}}return _0x5e8d0d;};AGIVertices[_0x23f7('0x16')]['gotoc']=function(_0x2d3d67){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x2d3d67[_0x23f7('0x31')]));return this[_0x23f7('0xe')][_0x23f7('0x13b')](_0x2d3d67[_0x23f7('0x13c')],_0x2d3d67[_0x23f7('0x13d')],_0x2d3d67[_0x23f7('0x13e')]);};AGIVertices['prototype'][_0x23f7('0x13f')]=function(_0x3a03b6){logger[_0x23f7('0x27')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x3a03b6['label']));if(!this[_0x23f7('0x9f')](_0x3a03b6[_0x23f7('0x140')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x3a03b6,_0x23f7('0x141'));}try{var _0x35a3d5=eval(_0x3a03b6[_0x23f7('0x140')])?_0x23f7('0x142'):'false';this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')]('EVAL\x20CONDITION\x20%s\x20%s',_0x3a03b6['condition'],_0x35a3d5));return{'code':0xc8,'result':_0x35a3d5};}catch(_0x354586){return{'code':0xc8,'result':_0x23f7('0x143')};}};AGIVertices[_0x23f7('0x16')][_0x23f7('0x144')]=function(_0x3c7eca){logger['info'](util[_0x23f7('0x95')](_0x23f7('0x145'),_0x3c7eca[_0x23f7('0x31')]));if(!this['isConfigured'](_0x3c7eca['interval_id'])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x3c7eca,_0x23f7('0x146'));}var _0x5c9205=this[_0x23f7('0x21')][_0x23f7('0x69')](this,_0x3c7eca[_0x23f7('0x147')]);if(!_0x5c9205){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x3c7eca,'no\x20intervals\x20found');}for(var _0x10f913=0x0;_0x10f913<_0x5c9205['length'];_0x10f913+=0x1){var _0x52daf9=this[_0x23f7('0xe')][_0x23f7('0x11')](util[_0x23f7('0x95')](_0x23f7('0x148'),_0x5c9205[_0x10f913]));if(_0x52daf9['result']===-0x1){return _0x52daf9;}logger[_0x23f7('0x27')](util['format'](_0x23f7('0x149'),_0x5c9205[_0x10f913],_0x52daf9['extra']));if(_0x52daf9['extra']===_0x23f7('0x142')){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x149'),_0x5c9205[_0x10f913],_0x23f7('0x142')));this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x149'),_0x5c9205[_0x10f913],_0x23f7('0x142')));return{'code':0xc8,'result':_0x23f7('0x142')};}else{logger['info'](util[_0x23f7('0x95')]('IFTIME\x20%s\x20%s',_0x5c9205[_0x10f913],'false'));this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x149'),_0x5c9205[_0x10f913],_0x23f7('0x143')));}}return{'code':0xc8,'result':_0x23f7('0x143')};};AGIVertices[_0x23f7('0x16')][_0x23f7('0x14a')]=function(_0x444409){logger['info'](util[_0x23f7('0x95')](_0x23f7('0x14b'),_0x444409[_0x23f7('0x31')]));return this[_0x23f7('0xe')][_0x23f7('0x14a')]();};AGIVertices[_0x23f7('0x16')][_0x23f7('0x14c')]=function(_0x168af4){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x168af4[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x168af4[_0x23f7('0x72')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xe7'));}var _0x2a77c5=_0x23f7('0x136');var _0x2318bc=util[_0x23f7('0x95')](_0x23f7('0x12d'),FILES_PATH,rs[_0x23f7('0x117')](0x4));var _0x298b58=util['format'](_0x23f7('0x96'),_0x2318bc,_0x2a77c5);var _0x1997ac=!![];if(_0x168af4['beep']==='NOBEEP'){_0x1997ac=![];}var _0x20d558=this[_0x23f7('0xe')]['recordFile'](_0x2318bc,_0x2a77c5,_0x168af4[_0x23f7('0x130')],_0x168af4[_0x23f7('0x5e')],undefined,_0x1997ac);if(_0x20d558['result']!==-0x1){this['channel']['noop'](util[_0x23f7('0x95')](_0x23f7('0x14d'),_0x298b58));var _0x35ec49=this[_0x23f7('0x7b')][_0x23f7('0x69')](this,_0x168af4,_0x298b58);if(_0x35ec49){for(var _0x1e4d24 in _0x35ec49){if(_0x35ec49[_0x23f7('0x91')](_0x1e4d24)){this[_0x23f7('0xe')][_0x23f7('0x97')](util[_0x23f7('0x95')](_0x23f7('0x14e'),_0x1e4d24[_0x23f7('0x62')]()),_0x35ec49[_0x1e4d24]);}}return this['channel'][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x14f'),JSON[_0x23f7('0x6b')](_0x35ec49)));}}return _0x20d558;};AGIVertices['prototype'][_0x23f7('0x150')]=function(_0xec130d){logger['info'](util[_0x23f7('0x95')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0xec130d[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0xec130d['key'])){return this['channel']['noop'](_0x23f7('0xe7'));}if(!this[_0x23f7('0x9f')](_0xec130d[_0x23f7('0x51')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xa5'));}this['channel']['noop'](util[_0x23f7('0x95')](_0x23f7('0x151'),_0xec130d[_0x23f7('0x51')]));var _0x5407a3=this[_0x23f7('0x79')][_0x23f7('0x69')](this,_0xec130d);if(_0x5407a3){this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')](_0x23f7('0x14d'),_0x5407a3));var _0x5ef1ef=this[_0x23f7('0xe')][_0x23f7('0x123')](_0x5407a3,_0xec130d[_0x23f7('0x130')]);try{fs[_0x23f7('0x103')](_0x5407a3+_0x23f7('0x152'));}catch(_0x1abcf8){logger['error'](_0x1abcf8);}return _0x5ef1ef;}return this['channel'][_0x23f7('0x25')](_0xec130d,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x23f7('0x16')][_0x23f7('0x153')]=function(_0x3b5f0a){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x154'),_0x3b5f0a[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x3b5f0a[_0x23f7('0x155')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x3b5f0a,_0x23f7('0x156'));}logger['info'](util[_0x23f7('0x95')](_0x23f7('0x157'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x3b5f0a[_0x23f7('0x155')]));var _0x55f24e=this['agentLogin'][_0x23f7('0x69')](this,_0x3b5f0a[_0x23f7('0x155')]);if(_0x55f24e){logger[_0x23f7('0x27')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x23f7('0xe')][_0x23f7('0x33')],_0x3b5f0a[_0x23f7('0x155')]));this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0x158'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x3b5f0a[_0x23f7('0x155')]));return{'code':0xc8,'result':_0x23f7('0x159')};}else{logger[_0x23f7('0x27')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x23f7('0xe')][_0x23f7('0x33')],_0x3b5f0a[_0x23f7('0x155')]));this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x15a'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x3b5f0a['findBy']));return{'code':0xc8,'result':_0x23f7('0x15b')};}};AGIVertices[_0x23f7('0x16')]['logout']=function(_0x224db9){logger['info'](util[_0x23f7('0x95')](_0x23f7('0x15c'),_0x224db9['label']));if(!this[_0x23f7('0x9f')](_0x224db9[_0x23f7('0x155')])){return this['channel']['error'](_0x224db9,_0x23f7('0x156'));}logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x23f7('0xe')][_0x23f7('0x33')],_0x224db9[_0x23f7('0x155')]));var _0x310675=this[_0x23f7('0x49')]['sync'](this,_0x224db9[_0x23f7('0x155')]);if(_0x310675){logger['info'](util[_0x23f7('0x95')](_0x23f7('0x158'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x224db9[_0x23f7('0x155')]));this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x158'),this['channel'][_0x23f7('0x33')],_0x224db9[_0x23f7('0x155')]));return{'code':0xc8,'result':_0x23f7('0x159')};}else{logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x15a'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x224db9[_0x23f7('0x155')]));this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x23f7('0x33')],_0x224db9[_0x23f7('0x155')]));return{'code':0xc8,'result':_0x23f7('0x15b')};}};AGIVertices['prototype'][_0x23f7('0x15d')]=function(_0x474b69){logger[_0x23f7('0x27')](util['format'](_0x23f7('0x15e'),_0x474b69[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x474b69['operation'])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x474b69,_0x23f7('0x15f'));}this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x160'),_0x474b69['operation']));var _0x473a38=eval(_0x474b69[_0x23f7('0x161')]);if(!this[_0x23f7('0x9f')](_0x474b69[_0x23f7('0xd5')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2b355b=this[_0x23f7('0x11')][_0x23f7('0x69')](this,_0x474b69['variable_id']);if(!_0x2b355b){return this['channel']['error'](_0x474b69,'no\x20variable\x20found');}if(_[_0x23f7('0x93')](_0x473a38)){var _0x66253=this;_0x473a38[_0x23f7('0xd8')](function(_0x57dc65,_0xda87b3){_0x66253[_0x23f7('0xe')][_0x23f7('0x97')](util['format'](_0x23f7('0x162'),_0x2b355b,_0xda87b3),_0x57dc65);});return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')]('variable\x20%s[key]\x20set',_0x2b355b));}else{return this['channel'][_0x23f7('0x97')](_0x2b355b,_0x473a38);}};AGIVertices[_0x23f7('0x16')]['menu']=function(_0x30b758){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x30b758[_0x23f7('0x31')]));if(_0x30b758[_0x23f7('0xa1')]===0x0){return this['maxRetry'](_0x30b758);}_0x30b758[_0x23f7('0xa1')]-=0x1;if(!this['isConfigured'](_0x30b758[_0x23f7('0x110')])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x30b758,_0x23f7('0x111'));}var _0x1b0423=this['getSound'][_0x23f7('0x69')](this,_0x30b758['file_id']);if(!_0x1b0423){return this[_0x23f7('0xe')]['error'](_0x30b758,_0x23f7('0x112'));}var _0x4eac61=this['channel'][_0x23f7('0x163')](_0x1b0423,_0x30b758[_0x23f7('0x113')],_0x30b758[_0x23f7('0x164')]);var _0x2e5d42=_0x4eac61[_0x23f7('0x9d')];if(_0x4eac61[_0x23f7('0x9d')]===-0x1){this['createSquareDetailsReport'][_0x23f7('0x69')](this,_0x30b758,'-1');return _0x4eac61;}else if(_0x4eac61[_0x23f7('0x9a')]===_0x23f7('0x5e')){_0x4eac61['result']=_0x4eac61[_0x23f7('0x9d')][_0x23f7('0x9b')]>0x0?_0x4eac61[_0x23f7('0x9d')]:'t';}else if(_['isEmpty'](_0x4eac61[_0x23f7('0x9d')])){_0x4eac61[_0x23f7('0x9d')]='#';_0x2e5d42='#';}if(!this['isConfigured'](_0x30b758[_0x23f7('0xd5')])){this[_0x23f7('0xe')]['noop'](_0x23f7('0xd6'));}else{var _0x1f3891=this[_0x23f7('0x11')][_0x23f7('0x69')](this,_0x30b758[_0x23f7('0xd5')]);if(!_0x1f3891){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x30b758,_0x23f7('0xd7'));}this[_0x23f7('0xe')][_0x23f7('0x97')](_0x1f3891,_0x2e5d42);}this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0x30b758,_0x2e5d42);return _0x4eac61;};AGIVertices[_0x23f7('0x16')]['noop']=function(_0x56b2d8){logger['info'](util[_0x23f7('0x95')](_0x23f7('0x165'),_0x56b2d8[_0x23f7('0x31')]));return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x56b2d8[_0x23f7('0x166')]||_0x56b2d8[_0x23f7('0x31')]);};AGIVertices['prototype']['pause']=function(_0x5296af){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x167'),_0x5296af[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x5296af['findBy'])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x5296af,_0x23f7('0x156'));}logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x157'),this['channel']['callerid'],_0x5296af['findBy']));var _0x4eb659=this['getPause'][_0x23f7('0x69')](this,_0x5296af[_0x23f7('0x168')]);var _0x347610=this[_0x23f7('0x45')][_0x23f7('0x69')](this,_0x5296af[_0x23f7('0x155')],_0x4eb659);if(_0x347610){logger[_0x23f7('0x27')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x23f7('0x33')],_0x5296af[_0x23f7('0x155')]));this['channel'][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x158'),this[_0x23f7('0xe')]['callerid'],_0x5296af[_0x23f7('0x155')]));return{'code':0xc8,'result':_0x23f7('0x159')};}else{logger['info'](util[_0x23f7('0x95')](_0x23f7('0x15a'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x5296af[_0x23f7('0x155')]));this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x158'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x5296af[_0x23f7('0x155')]));return{'code':0xc8,'result':_0x23f7('0x15b')};}};AGIVertices[_0x23f7('0x16')]['playback']=function(_0x15ec65){logger[_0x23f7('0x27')](util['format'](_0x23f7('0x169'),_0x15ec65[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x15ec65['file_id'])){return this['channel'][_0x23f7('0x25')](_0x15ec65,_0x23f7('0x111'));}var _0x503a59=this[_0x23f7('0x1b')][_0x23f7('0x69')](this,_0x15ec65[_0x23f7('0x110')]);if(!_0x503a59){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x15ec65,'no\x20file\x20audio\x20found');}var _0x102d28=this[_0x23f7('0xe')][_0x23f7('0xab')]('PLAYBACK',[_0x503a59,_0x15ec65[_0x23f7('0xe3')]]);if(_0x102d28[_0x23f7('0x9d')]===-0x1){return _0x102d28;}return this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')]('Executed\x20command\x20%s\x20%s',_0x23f7('0x16a'),_0x503a59));};AGIVertices[_0x23f7('0x16')]['queue']=function(_0x183fa5){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x16b'),_0x183fa5[_0x23f7('0x31')]));if(!this['isConfigured'](_0x183fa5[_0x23f7('0x16c')])){return this[_0x23f7('0xe')]['error'](_0x183fa5,_0x23f7('0x16d'));}var _0x15bbf0='';var _0x35c68d=parseInt(_0x183fa5[_0x23f7('0x16c')],0xa);if(isNaN(_0x35c68d)){_0x15bbf0=_0x183fa5[_0x23f7('0x16c')];}else{_0x15bbf0=this['getVoiceQueue'][_0x23f7('0x69')](this,_0x183fa5[_0x23f7('0x16c')]);if(!_0x15bbf0){return this[_0x23f7('0xe')]['error'](_0x183fa5,_0x23f7('0x16e'));}}var _0x4632e7='';if(this[_0x23f7('0x9f')](_0x183fa5[_0x23f7('0x110')])){var _0x449f53=this[_0x23f7('0x1b')][_0x23f7('0x69')](this,_0x183fa5[_0x23f7('0x110')]);if(_0x449f53){_0x4632e7=_0x449f53;}}this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0x183fa5,_0x15bbf0);if(_0x183fa5['opts'][_0x23f7('0x16f')]('x')<0x0){_0x183fa5['opts']+='x';}if(_0x183fa5[_0x23f7('0xe3')][_0x23f7('0x16f')]('X')<0x0){_0x183fa5[_0x23f7('0xe3')]+='X';}this[_0x23f7('0xe')][_0x23f7('0x97')](_0x23f7('0x170'),_0x15bbf0?_0x15bbf0[_0x23f7('0x171')]():'');var _0x50d543=this[_0x23f7('0xe')][_0x23f7('0xab')](_0x23f7('0x172'),[_0x15bbf0,_0x183fa5['opts'],_0x183fa5[_0x23f7('0x5b')],_0x4632e7,_0x183fa5['timeout'],_0x183fa5[_0x23f7('0x7')],_0x183fa5[_0x23f7('0x173')],_0x183fa5[_0x23f7('0x174')],'',_0x183fa5[_0x23f7('0x175')]]);if(_0x50d543['result']===-0x1){return _0x50d543;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xbd'),_0x23f7('0x172'),_0x15bbf0));};AGIVertices['prototype']['record']=function(_0x101c1e){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x101c1e[_0x23f7('0x31')]));var _0x175675=_0x101c1e[_0x23f7('0x176')]||'wav';var _0x2f92a4=util['format']('%s_%s',this[_0x23f7('0xe')][_0x23f7('0x30')],rs[_0x23f7('0x117')](0x5));var _0x4d66e2=util[_0x23f7('0x95')](_0x23f7('0x177'),FILES_PATH,_0x2f92a4,_0x175675);var _0x141502=util['format'](_0x23f7('0x12d'),FILES_PATH,_0x2f92a4);this[_0x23f7('0x34')][_0x23f7('0x69')](this,_0x101c1e,_0x2f92a4,_0x4d66e2);this['channel'][_0x23f7('0x97')](_0x23f7('0x178'),_0x2f92a4);logger[_0x23f7('0x27')](_0x23f7('0x179'),_0x141502,_0x175675,_0x101c1e[_0x23f7('0x17a')],_0x101c1e[_0x23f7('0x5e')]);return this[_0x23f7('0xe')][_0x23f7('0x137')](_0x141502,_0x175675,_0x101c1e['escape_digits'],_0x101c1e[_0x23f7('0x5e')],undefined,!![]);};AGIVertices[_0x23f7('0x16')]['restapi']=function(_0x470678){logger['info'](util[_0x23f7('0x95')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x470678[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x470678[_0x23f7('0x5b')])){return this['channel'][_0x23f7('0xa4')](_0x23f7('0x17b'));}var _0x6abc6f=this[_0x23f7('0x5a')][_0x23f7('0x69')](this,_0x470678);logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x17c'),util['inspect'](_0x6abc6f,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x470678[_0x23f7('0xd5')])){return this['channel'][_0x23f7('0xa4')](_0x23f7('0x17d'));}var _0x47a568=this[_0x23f7('0x11')]['sync'](this,_0x470678[_0x23f7('0xd5')]);if(!_0x47a568){return this[_0x23f7('0xe')]['error'](_0x470678,_0x23f7('0xd7'));}this[_0x23f7('0xe')][_0x23f7('0x97')](util[_0x23f7('0x95')](_0x23f7('0x17e'),_0x47a568),_0x6abc6f[_0x23f7('0x17f')]?_0x6abc6f[_0x23f7('0x17f')]:'200');this[_0x23f7('0xe')][_0x23f7('0x97')](util[_0x23f7('0x95')]('%s_STATUS_MESSAGE',_0x47a568),_0x6abc6f[_0x23f7('0x6d')]?_0x6abc6f[_0x23f7('0x6d')]:'OK');if(_0x6abc6f[_0x23f7('0x6c')]){try{this[_0x23f7('0x94')](_0x6abc6f[_0x23f7('0x6c')],_0x47a568);}catch(_0x4f52ee){logger[_0x23f7('0x25')](util[_0x23f7('0x95')](_0x23f7('0x180'),_0x47a568));}}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xda'),_0x47a568));};AGIVertices[_0x23f7('0x16')]['saydigits']=function(_0x23c0c6){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x181'),_0x23c0c6['label']));return this[_0x23f7('0xe')][_0x23f7('0x182')](_0x23c0c6['digits'][_0x23f7('0x4f')](/\s+/g,''),_0x23c0c6['escape_digits']);};AGIVertices[_0x23f7('0x16')][_0x23f7('0x183')]=function(_0x4ec599){logger['info'](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4ec599['label']));return this[_0x23f7('0xe')][_0x23f7('0x184')](_0x4ec599['number'][_0x23f7('0x4f')](/\s+/g,''),_0x4ec599[_0x23f7('0x17a')]);};AGIVertices[_0x23f7('0x16')][_0x23f7('0x185')]=function(_0x4675e4){logger[_0x23f7('0x27')](util['format'](_0x23f7('0x186'),_0x4675e4['label']));return this[_0x23f7('0xe')]['sayPhonetic'](_0x4675e4[_0x23f7('0x51')],_0x4675e4['escape_digits']);};AGIVertices['prototype'][_0x23f7('0x187')]=function(_0xf3b0e5){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x188'),_0xf3b0e5['label']));if(!this[_0x23f7('0x9f')](_0xf3b0e5[_0x23f7('0x189')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0x18a'));}var _0x13e927=this[_0x23f7('0x1f')][_0x23f7('0x69')](this,_0xf3b0e5[_0x23f7('0x189')]);if(!_0x13e927||!_0x13e927[_0x23f7('0x18b')]){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0xf3b0e5,_0x23f7('0x18c'));}var _0x3a30cb={'from':util[_0x23f7('0x95')](_0x23f7('0x18d'),_0x13e927[_0x23f7('0x13')],_0x13e927[_0x23f7('0x18e')]||_0x13e927['Smtp'][_0x23f7('0x18f')]),'to':_0xf3b0e5['to']||'','cc':_0xf3b0e5['cc']||'','bcc':_0xf3b0e5[_0x23f7('0x190')]||'','subject':_0xf3b0e5['subject'],'html':_0xf3b0e5[_0x23f7('0x51')],'text':_0xf3b0e5[_0x23f7('0x51')]};if(this[_0x23f7('0x9f')](_0xf3b0e5[_0x23f7('0x191')])){}logger[_0x23f7('0xdb')](_0x23f7('0x192'),JSON[_0x23f7('0x6b')](_0x3a30cb));this[_0x23f7('0x2f')][_0x23f7('0x69')](this,_0xf3b0e5,_0xf3b0e5['account_id']);this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x193'),_0x13e927['name']));this['sendMailMessage'][_0x23f7('0x69')](this,_0x13e927[_0x23f7('0x194')],_0x3a30cb);return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0x195'));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x196')]=function(_0x21ed02){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x197'),_0x21ed02[_0x23f7('0x31')]));return this[_0x23f7('0xe')]['noop'](_0x23f7('0x198'));};AGIVertices['prototype'][_0x23f7('0x199')]=function(_0x184c4d){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x19a'),_0x184c4d['label']));if(!this[_0x23f7('0x9f')](_0x184c4d['sms_account_id'])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0x19b'));}var _0x23ddff=this[_0x23f7('0x2c')][_0x23f7('0x69')](this,_0x184c4d[_0x23f7('0x19c')]);if(!_0x23ddff){return this['channel']['error'](_0x184c4d,_0x23f7('0x19d'));}var _0x12bad9={'body':_0x184c4d[_0x23f7('0x19e')],'phone':_0x184c4d['to']||'','SmsAccountId':_0x23ddff['id']};logger[_0x23f7('0xdb')](_0x23f7('0x19f'),JSON[_0x23f7('0x6b')](_0x12bad9));this['createSquareDetailsReport'][_0x23f7('0x69')](this,_0x184c4d,_0x184c4d[_0x23f7('0x19c')]);this['channel'][_0x23f7('0xa4')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x23ddff[_0x23f7('0x13')]));this[_0x23f7('0x2e')][_0x23f7('0x69')](this,_0x12bad9);return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0x1a0'));};AGIVertices[_0x23f7('0x16')]['set']=function(_0x1a0690){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1a0690[_0x23f7('0x31')]));if(!this['isConfigured'](_0x1a0690[_0x23f7('0xd5')])){return this['channel']['error'](_0x1a0690,_0x23f7('0x1a1'));}var _0x3dffb9=this[_0x23f7('0x11')][_0x23f7('0x69')](this,_0x1a0690[_0x23f7('0xd5')]);if(!_0x3dffb9){return this[_0x23f7('0xe')]['error'](_0x1a0690,_0x23f7('0xd7'));}return this[_0x23f7('0xe')]['setVariable'](_0x3dffb9,_0x1a0690[_0x23f7('0x1a2')]);};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1a3')]=function(_0x48e264){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x1a4'),_0x48e264[_0x23f7('0x31')]));this['channel'][_0x23f7('0xa4')](_0x23f7('0x1a5'));if(_0x48e264['answer']===_0x23f7('0x1a6')){this['channel']['noop']('Answer');return this[_0x23f7('0xe')][_0x23f7('0xb3')]();}return this[_0x23f7('0xe')]['noop']('Skipped\x20Answer');};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1a7')]=function(_0x3a30eb){logger['info'](util[_0x23f7('0x95')](_0x23f7('0x1a8'),_0x3a30eb[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x3a30eb[_0x23f7('0x1a9')])){return this['channel'][_0x23f7('0x25')](_0x3a30eb,_0x23f7('0x1aa'));}var _0x160686=this[_0x23f7('0x17')][_0x23f7('0x69')](this,_0x3a30eb[_0x23f7('0x1a9')]);if(!this[_0x23f7('0x9f')](_0x160686)){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x3a30eb,util[_0x23f7('0x95')](_0x23f7('0x1ab'),_0x3a30eb[_0x23f7('0x1a9')]));}if(_0x160686===this[_0x23f7('0xe')]['arg_1']){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x3a30eb,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x23f7('0x2f')]['sync'](this,_0x3a30eb,_0x160686);var _0x438c30=this['channel']['exec'](_0x23f7('0x1ac'),util[_0x23f7('0x95')](_0x23f7('0x1ad'),config[_0x23f7('0x7')][_0x23f7('0x1ae')]||_0x23f7('0x1af'),_0x160686,this['channel'][_0x23f7('0x32')]));if(_0x438c30['result']===-0x1){return _0x438c30;}return this['channel'][_0x23f7('0xa4')](util['format'](_0x23f7('0xbd'),_0x23f7('0x1ac'),_0x160686));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1b0')]=function(_0x270464){logger[_0x23f7('0x27')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x270464[_0x23f7('0x31')]));var _0x3cf889=this[_0x23f7('0x4d')]['sync'](this,_0x270464[_0x23f7('0xb1')]);this['createSquareDetailsReport']['sync'](this,_0x270464,_0x270464[_0x23f7('0xb1')]);if(this[_0x23f7('0x9f')](_0x270464['variable_id'])){var _0x36383c=this['getVariable']['sync'](this,_0x270464[_0x23f7('0xd5')]);if(_0x36383c){this[_0x23f7('0xe')][_0x23f7('0x97')](_0x36383c,_0x3cf889);return this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')](_0x23f7('0x1b1'),_0x270464[_0x23f7('0xb1')],_0x36383c));}}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0x1b2'),_0x270464[_0x23f7('0xb1')]));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1b3')]=function(_0x549c19){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x1b4'),_0x549c19[_0x23f7('0x31')]));_0x549c19['text']=_0x549c19[_0x23f7('0x51')][_0x23f7('0x4f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x23f7('0x9f')](_0x549c19[_0x23f7('0x50')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')]('no\x20apiKey\x20configured');}if(!this[_0x23f7('0x9f')](_0x549c19[_0x23f7('0x51')])){return this[_0x23f7('0xe')][_0x23f7('0xa4')](_0x23f7('0xa5'));}this['channel'][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x1b5'),_0x549c19['text']));var _0x3b05d6=this[_0x23f7('0x1b6')][_0x23f7('0x69')](this,_0x549c19);if(_0x3b05d6){this[_0x23f7('0xe')]['noop'](util[_0x23f7('0x95')](_0x23f7('0x1b7'),_0x3b05d6));var _0x3c80f0=this[_0x23f7('0xe')][_0x23f7('0x123')](_0x3b05d6);try{fs[_0x23f7('0x103')](_0x3b05d6+'.wav');}catch(_0x33f528){logger[_0x23f7('0x25')](_0x33f528);}return _0x3c80f0;}return this[_0x23f7('0xe')]['error'](_0x549c19,_0x23f7('0x1b8'));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1b9')]=function(_0x30a8e0){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x30a8e0['label']));_0x30a8e0[_0x23f7('0x51')]=_0x30a8e0[_0x23f7('0x51')][_0x23f7('0x4f')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x30a8e0[_0x23f7('0x51')])){return this['channel'][_0x23f7('0xa4')](_0x23f7('0xa5'));}this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0x1ba'),_0x30a8e0[_0x23f7('0x51')]));var _0x3e8f52=this['googleTTS'][_0x23f7('0x69')](this,_0x30a8e0);if(_0x3e8f52){this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0x1bb'),_0x3e8f52));var _0x6a7390=this[_0x23f7('0xe')]['streamFile'](_0x3e8f52);try{fs[_0x23f7('0x103')](_0x3e8f52+'.wav');}catch(_0x186c72){logger[_0x23f7('0x25')](_0x186c72);}return _0x6a7390;}return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x30a8e0,_0x23f7('0x1bc'));};AGIVertices[_0x23f7('0x16')]['unpause']=function(_0x1d51ad){logger[_0x23f7('0x27')](util['format'](_0x23f7('0x1bd'),_0x1d51ad[_0x23f7('0x31')]));if(!this[_0x23f7('0x9f')](_0x1d51ad['findBy'])){return this[_0x23f7('0xe')][_0x23f7('0x25')](_0x1d51ad,_0x23f7('0x156'));}logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x157'),this['channel']['callerid'],_0x1d51ad[_0x23f7('0x155')]));var _0x195178=this[_0x23f7('0x48')][_0x23f7('0x69')](this,_0x1d51ad['findBy']);if(_0x195178){logger[_0x23f7('0x27')](util['format'](_0x23f7('0x158'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x1d51ad[_0x23f7('0x155')]));this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0x158'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x1d51ad['findBy']));return{'code':0xc8,'result':_0x23f7('0x159')};}else{logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x15a'),this['channel'][_0x23f7('0x33')],_0x1d51ad['findBy']));this[_0x23f7('0xe')][_0x23f7('0xa4')](util['format'](_0x23f7('0x15a'),this[_0x23f7('0xe')][_0x23f7('0x33')],_0x1d51ad['findBy']));return{'code':0xc8,'result':_0x23f7('0x15b')};}};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1be')]=function(_0x4eef5f){logger[_0x23f7('0x27')](util[_0x23f7('0x95')](_0x23f7('0x1bf'),_0x4eef5f[_0x23f7('0x31')]));var _0x1282c5=this[_0x23f7('0xe')][_0x23f7('0xab')](_0x23f7('0x1c0'),[_0x4eef5f[_0x23f7('0x1c1')],_0x4eef5f['options']]);if(_0x1282c5[_0x23f7('0x9d')]===-0x1){return _0x1282c5;}return this[_0x23f7('0xe')][_0x23f7('0xa4')](util[_0x23f7('0x95')](_0x23f7('0xbd'),_0x23f7('0x1c0'),_0x4eef5f['mailbox']));};AGIVertices[_0x23f7('0x16')][_0x23f7('0x1c2')]=function(_0x21b3d1){logger[_0x23f7('0x27')](util[_0x23f7('0x95')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x21b3d1[_0x23f7('0x31')]));if(!this['isConfigured'](_0x21b3d1[_0x23f7('0xd5')])){return this['channel'][_0x23f7('0x25')](_0x21b3d1,'no\x20variable\x20selected');}var _0x5561fa=this[_0x23f7('0x11')]['sync'](this,_0x21b3d1[_0x23f7('0xd5')]);if(!_0x5561fa){return this['channel'][_0x23f7('0x25')](_0x21b3d1,_0x23f7('0xd7'));}var _0x10e821=this[_0x23f7('0xe')][_0x23f7('0x11')](_0x5561fa);return{'code':0xc8,'result':_0x10e821['extra']?_0x10e821[_0x23f7('0x9a')]:'-'};};String[_0x23f7('0x16')][_0x23f7('0x1c3')]=function(_0x26f544,_0x1050a1){return this['split'](_0x26f544)[_0x23f7('0x1c4')](_0x1050a1);};module[_0x23f7('0x1c5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 2dec872..1c7279f 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 _0x850d=['voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','uniqueid','[%s][UPDATE][ACWTIME:%s]','error','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','catch','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','message','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','milliseconds','diff','seconds','prototype','interface','channels','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','then'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0x850d,0x8e));var _0xd850=function(_0x5bca54,_0x392756){_0x5bca54=_0x5bca54-0x0;var _0x2f4e9a=_0x850d[_0x5bca54];return _0x2f4e9a;};'use strict';var _=require('lodash');var moment=require(_0xd850('0x0'));var ami=require(_0xd850('0x1'));var logger=require('../../../config/logger')(_0xd850('0x2'));var RpcUser=require(_0xd850('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x498e74){this[_0xd850('0x4')]=_0x498e74[_0xd850('0x4')];this[_0xd850('0x5')]=_0x498e74[_0xd850('0x5')];this[_0xd850('0x6')]=_0x498e74[_0xd850('0x6')];this['channels']={};ami['on'](_0xd850('0x7'),this[_0xd850('0x8')][_0xd850('0x9')](this));ami['on'](_0xd850('0xa'),this[_0xd850('0xb')][_0xd850('0x9')](this));ami['on']('hangup',this[_0xd850('0xc')][_0xd850('0x9')](this));ami['on'](_0xd850('0xd'),this[_0xd850('0xe')][_0xd850('0x9')](this));ami['on'](_0xd850('0xf'),this[_0xd850('0x10')][_0xd850('0x9')](this));ami['on'](_0xd850('0x11'),this[_0xd850('0x12')][_0xd850('0x9')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0xd850('0x9')](this));}function getDiff(_0x388640){var _0x5c87e8=moment()[_0xd850('0x13')](0x0);var _0x4fa919=moment(_0x388640)[_0xd850('0x13')](0x0);return _0x5c87e8[_0xd850('0x14')](_0x4fa919,_0xd850('0x15'));}Acw[_0xd850('0x16')]['startAcw']=function(_0x21f088){try{var _0x5ba7f9=this;var _0x9acaaa=this['channels'][_0x21f088][_0xd850('0x17')];var _0x23bf1a=this[_0xd850('0x18')][_0x21f088][_0xd850('0x19')];var _0x290233=this[_0xd850('0x4')][_0x23bf1a];var _0x42709c=![];var _0x389f4c=_0xd850('0x1a');if(_0x290233['mandatoryDisposition']){if(_0x290233[_0xd850('0x1b')][_0xd850('0x1c')]){_0x42709c=!![];_0x389f4c=_0x290233[_0xd850('0x1b')][_0xd850('0x1c')];}}return ami[_0xd850('0x1d')]({'action':_0xd850('0x1e'),'interface':_0x9acaaa,'paused':!![],'reason':_0x389f4c})['then'](function(){if(_0x5ba7f9['agents'][_0x9acaaa]){return RpcUser['getAgent'](_0x5ba7f9[_0xd850('0x5')][_0x9acaaa]['id'])[_0xd850('0x1f')](function(_0x404cb6){if(_0x404cb6&&!_0x404cb6[_0xd850('0x20')]){logger[_0xd850('0x21')](_0xd850('0x22'),_0x21f088,_0x9acaaa,_0x23bf1a);var _0x3eb041=_0x5ba7f9[_0xd850('0x18')][_0x21f088][_0xd850('0x23')]&&_0x5ba7f9[_0xd850('0x18')][_0x21f088]['destlinkedid']?_0x5ba7f9[_0xd850('0x18')][_0x21f088][_0xd850('0x24')]:_0x21f088;return RpcUser[_0xd850('0x25')](_0x5ba7f9[_0xd850('0x5')][_0x9acaaa],_0x389f4c,_0x3eb041)[_0xd850('0x1f')](function(){if(!_0x42709c){_0x5ba7f9[_0xd850('0x6')][_0x9acaaa]={};logger[_0xd850('0x21')](_0xd850('0x26'),_0x21f088,_0x5ba7f9[_0xd850('0x4')][_0x23bf1a][_0xd850('0x27')],_0x9acaaa,_0x23bf1a);_0x5ba7f9['timers'][_0x9acaaa][_0xd850('0x28')]=setTimeout(_0x5ba7f9[_0xd850('0x29')][_0xd850('0x9')](_0x5ba7f9,_0x9acaaa),_0x5ba7f9[_0xd850('0x4')][_0x23bf1a]['acwTimeout']*0x3e8);_0x5ba7f9[_0xd850('0x6')][_0x9acaaa][_0xd850('0x2a')]=moment()[_0xd850('0x2b')](_0xd850('0x2c'));_0x5ba7f9['timers'][_0x9acaaa]['uniqueid']=_0x21f088;_0x5ba7f9[_0xd850('0x6')][_0x9acaaa][_0xd850('0x19')]=_0x23bf1a;_0x5ba7f9[_0xd850('0x6')][_0x9acaaa][_0xd850('0x2d')]=function(){var _0x15b2c4=getDiff(_0x5ba7f9[_0xd850('0x6')][_0x9acaaa][_0xd850('0x2a')]);clearTimeout(_0x5ba7f9[_0xd850('0x6')][_0x9acaaa]['timer']);_0x5ba7f9[_0xd850('0x6')][_0x9acaaa][_0xd850('0x28')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x15b2c4},_0x5ba7f9['timers'][_0x9acaaa][_0xd850('0x2e')],_0x9acaaa)[_0xd850('0x1f')](function(_0x52d483){logger[_0xd850('0x21')](_0xd850('0x2f'),_0x21f088,_0x15b2c4,_0x52d483);})['catch'](function(_0xc229bc){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x21f088,_0xc229bc);});delete _0x5ba7f9[_0xd850('0x6')][_0x9acaaa];};}});}else{logger[_0xd850('0x21')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x21f088,_0x9acaaa,_0x23bf1a);}});}})['catch'](function(){logger[_0xd850('0x30')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x21f088,_0x5ba7f9[_0xd850('0x4')][_0x23bf1a]['acwTimeout'],_0x9acaaa,_0x23bf1a);})[_0xd850('0x31')](function(){delete _0x5ba7f9[_0xd850('0x18')][_0x21f088];});}catch(_0x5f645){logger[_0xd850('0x30')](_0xd850('0x32'),_0x5f645['message']);}};Acw['prototype'][_0xd850('0x29')]=function(_0x232049){try{var _0x1ae07e=this;if(_0x1ae07e['timers'][_0x232049]){_0x1ae07e['timers'][_0x232049][_0xd850('0x28')]=![];var _0x5c9247=_0x1ae07e[_0xd850('0x6')][_0x232049][_0xd850('0x2e')];var _0x56a400=_0x1ae07e['timers'][_0x232049][_0xd850('0x19')];var _0x2dfce2=_0x1ae07e['voiceQueues'][_0x56a400][_0xd850('0x27')];logger[_0xd850('0x21')](_0xd850('0x33'),_0x5c9247,_0x232049);RpcUser[_0xd850('0x34')](this[_0xd850('0x5')][_0x232049]);RpcVoiceAgentReport[_0xd850('0x35')]({'acwtime':_0x2dfce2,'agentacw':!![]},_0x5c9247,_0x232049)[_0xd850('0x1f')](function(_0x44183e){logger[_0xd850('0x21')](_0xd850('0x2f'),_0x5c9247,_0x2dfce2,_0x44183e);})[_0xd850('0x36')](function(_0x4e421d){logger[_0xd850('0x30')](_0xd850('0x37'),_0x5c9247,_0x4e421d);});}else{logger[_0xd850('0x30')](_0xd850('0x38'),_0x232049);if(_0x1ae07e['timers']){logger[_0xd850('0x21')](_0xd850('0x39'),JSON['stringify'](_0x1ae07e[_0xd850('0x6')]));}}}catch(_0x44dcbd){logger[_0xd850('0x30')](_0xd850('0x3a'),_0x44dcbd[_0xd850('0x3b')]);}};Acw['prototype'][_0xd850('0x8')]=function(_0x152c2a){try{if(this[_0xd850('0x4')][_0x152c2a[_0xd850('0x19')]]&&(this[_0xd850('0x4')][_0x152c2a[_0xd850('0x19')]][_0xd850('0x2')]||this[_0xd850('0x4')][_0x152c2a[_0xd850('0x19')]][_0xd850('0x3c')])){if(this[_0xd850('0x5')][_0x152c2a[_0xd850('0x17')]]){this['channels'][_0x152c2a[_0xd850('0x2e')]]={'queue':_0x152c2a['queue'],'interface':_0x152c2a['interface'],'destlinkedid':_0x152c2a[_0xd850('0x24')]};}}}catch(_0x5362ba){logger[_0xd850('0x30')](_0xd850('0x3d'),_0x5362ba[_0xd850('0x3b')]);}};Acw[_0xd850('0x16')][_0xd850('0x3e')]=function(_0x18f083){try{if(this[_0xd850('0x4')][_0x18f083[_0xd850('0x19')]]&&(this[_0xd850('0x4')][_0x18f083[_0xd850('0x19')]][_0xd850('0x2')]||this[_0xd850('0x4')][_0x18f083[_0xd850('0x19')]]['mandatoryDisposition'])){if(this[_0xd850('0x5')][_0x18f083[_0xd850('0x17')]]){this[_0xd850('0x18')][_0x18f083[_0xd850('0x2e')]]={'queue':_0x18f083[_0xd850('0x19')],'interface':_0x18f083[_0xd850('0x17')]};}}}catch(_0x133e52){logger[_0xd850('0x30')](_0xd850('0x3f'),_0x133e52['message']);}};Acw[_0xd850('0x16')][_0xd850('0xb')]=function(_0x4400f0){try{if(this[_0xd850('0x18')][_0x4400f0['uniqueid']]&&_[_0xd850('0x40')](this[_0xd850('0x18')][_0x4400f0[_0xd850('0x2e')]][_0xd850('0x23')])){logger[_0xd850('0x21')](_0xd850('0x41'),_0x4400f0['uniqueid']);this[_0xd850('0x42')](_0x4400f0['uniqueid']);}else if(this[_0xd850('0x18')][_0x4400f0[_0xd850('0x43')]]&&_[_0xd850('0x40')](this['channels'][_0x4400f0[_0xd850('0x43')]]['attended'])){logger[_0xd850('0x21')](_0xd850('0x44'),_0x4400f0[_0xd850('0x43')]);this[_0xd850('0x42')](_0x4400f0[_0xd850('0x43')]);}}catch(_0x1c291c){logger[_0xd850('0x30')](_0xd850('0x45'),_0x1c291c[_0xd850('0x3b')]);}};Acw[_0xd850('0x16')][_0xd850('0xc')]=function(_0x4342d7){try{if(this[_0xd850('0x18')][_0x4342d7[_0xd850('0x2e')]]&&this['channels'][_0x4342d7['uniqueid']][_0xd850('0x23')]){logger[_0xd850('0x21')](_0xd850('0x46'),_0x4342d7[_0xd850('0x2e')]);this['startAcw'](_0x4342d7[_0xd850('0x2e')]);}else if(this[_0xd850('0x18')][_0x4342d7[_0xd850('0x43')]]&&this['channels'][_0x4342d7[_0xd850('0x43')]]['attended']){logger['info'](_0xd850('0x47'),_0x4342d7['linkedid']);this[_0xd850('0x42')](_0x4342d7[_0xd850('0x43')]);}}catch(_0x35be6b){logger['error']('[ACW][syncHangup]\x20%s',_0x35be6b[_0xd850('0x3b')]);}};Acw[_0xd850('0x16')][_0xd850('0x10')]=function(_0x3a3798){try{if(!_[_0xd850('0x48')](this[_0xd850('0x18')][_0x3a3798[_0xd850('0x49')]])){this['startAcw'](_0x3a3798[_0xd850('0x49')]);if(this['channels'][_0x3a3798[_0xd850('0x4a')]]){this[_0xd850('0x18')][_0x3a3798[_0xd850('0x4a')]][_0xd850('0x23')]=!![];this[_0xd850('0x18')][_0x3a3798[_0xd850('0x4b')]]=this[_0xd850('0x18')][_0x3a3798['secondtransfereruniqueid']];delete this[_0xd850('0x18')][_0x3a3798[_0xd850('0x4a')]];}}else if(!_[_0xd850('0x48')](this[_0xd850('0x18')][_0x3a3798[_0xd850('0x4b')]])){this[_0xd850('0x42')](_0x3a3798[_0xd850('0x4b')]);if(this[_0xd850('0x18')][_0x3a3798[_0xd850('0x4c')]]){this[_0xd850('0x18')][_0x3a3798[_0xd850('0x4c')]][_0xd850('0x23')]=!![];this[_0xd850('0x18')][_0x3a3798[_0xd850('0x49')]]=this[_0xd850('0x18')][_0x3a3798[_0xd850('0x4c')]];delete this[_0xd850('0x18')][_0x3a3798[_0xd850('0x4c')]];}}}catch(_0x3d5ece){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x3d5ece[_0xd850('0x3b')]);}};Acw[_0xd850('0x16')][_0xd850('0x12')]=function(_0x31c31f){try{if(this[_0xd850('0x18')][_0x31c31f[_0xd850('0x4d')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xd850('0x4e')](_0x31c31f['transfereruniqueid']));this[_0xd850('0x42')](_0x31c31f[_0xd850('0x4d')]);}else if(this['channels'][_0x31c31f[_0xd850('0x4f')]]){logger[_0xd850('0x21')](_0xd850('0x50'),JSON[_0xd850('0x4e')](_0x31c31f[_0xd850('0x4f')]));this['startAcw'](_0x31c31f[_0xd850('0x4f')]);}}catch(_0x5551fb){logger['error'](_0xd850('0x51'),_0x5551fb[_0xd850('0x3b')]);}};Acw['prototype'][_0xd850('0xe')]=function(_0x381dc8){try{if(this['voiceQueues'][_0x381dc8['queue']]&&this[_0xd850('0x4')][_0x381dc8[_0xd850('0x19')]][_0xd850('0x52')]===_0xd850('0x53')){if(this['agents'][_0x381dc8[_0xd850('0x17')]]){logger[_0xd850('0x21')](_0xd850('0x54'),_0x381dc8[_0xd850('0x2e')],_0x381dc8[_0xd850('0x17')],_0x381dc8[_0xd850('0x19')]);return RpcUser[_0xd850('0x25')](this['agents'][_0x381dc8[_0xd850('0x17')]],'Auto-Pause',_0x381dc8['uniqueid']);}}}catch(_0x370c29){logger[_0xd850('0x30')](_0xd850('0x55'),_0x370c29[_0xd850('0x3b')]);}};module[_0xd850('0x56')]=Acw; \ No newline at end of file +var _0xe9a8=['Auto-Pause','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','error','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','acw','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause'];(function(_0x5c11cf,_0x1094e9){var _0xd7bc0d=function(_0x5426e2){while(--_0x5426e2){_0x5c11cf['push'](_0x5c11cf['shift']());}};_0xd7bc0d(++_0x1094e9);}(_0xe9a8,0x1b5));var _0x8e9a=function(_0x5d9a79,_0x5e7dbe){_0x5d9a79=_0x5d9a79-0x0;var _0x33b88f=_0xe9a8[_0x5d9a79];return _0x33b88f;};'use strict';var _=require(_0x8e9a('0x0'));var moment=require(_0x8e9a('0x1'));var ami=require(_0x8e9a('0x2'));var logger=require(_0x8e9a('0x3'))('acw');var RpcUser=require(_0x8e9a('0x4'));var RpcVoiceAgentReport=require(_0x8e9a('0x5'));function Acw(_0x54a456){this[_0x8e9a('0x6')]=_0x54a456[_0x8e9a('0x6')];this[_0x8e9a('0x7')]=_0x54a456['agents'];this[_0x8e9a('0x8')]=_0x54a456['timers'];this[_0x8e9a('0x9')]={};ami['on'](_0x8e9a('0xa'),this[_0x8e9a('0xb')]['bind'](this));ami['on'](_0x8e9a('0xc'),this[_0x8e9a('0xd')][_0x8e9a('0xe')](this));ami['on'](_0x8e9a('0xf'),this[_0x8e9a('0x10')]['bind'](this));ami['on']('agentringnoanswer',this[_0x8e9a('0x11')][_0x8e9a('0xe')](this));ami['on']('attendedtransfer',this[_0x8e9a('0x12')][_0x8e9a('0xe')](this));ami['on'](_0x8e9a('0x13'),this[_0x8e9a('0x14')]['bind'](this));ami['on'](_0x8e9a('0x15'),this[_0x8e9a('0x16')]['bind'](this));}function getDiff(_0x5f31b6){var _0x228b32=moment()[_0x8e9a('0x17')](0x0);var _0x3cb8e7=moment(_0x5f31b6)[_0x8e9a('0x17')](0x0);return _0x228b32[_0x8e9a('0x18')](_0x3cb8e7,_0x8e9a('0x19'));}Acw[_0x8e9a('0x1a')][_0x8e9a('0x1b')]=function(_0x508ac6){try{var _0x4392a9=this;var _0x160bd7=this[_0x8e9a('0x9')][_0x508ac6][_0x8e9a('0x1c')];var _0xccc473=this['channels'][_0x508ac6][_0x8e9a('0x1d')];var _0x423ed2=this[_0x8e9a('0x6')][_0xccc473];var _0x165df2=![];var _0x335b3e='ACW';if(_0x423ed2[_0x8e9a('0x1e')]){if(_0x423ed2[_0x8e9a('0x1f')]['name']){_0x165df2=!![];_0x335b3e=_0x423ed2['mandatoryDispositionPause'][_0x8e9a('0x20')];}}return ami[_0x8e9a('0x21')]({'action':_0x8e9a('0x22'),'interface':_0x160bd7,'paused':!![],'reason':_0x335b3e})[_0x8e9a('0x23')](function(){if(_0x4392a9['agents'][_0x160bd7]){return RpcUser[_0x8e9a('0x24')](_0x4392a9[_0x8e9a('0x7')][_0x160bd7]['id'])[_0x8e9a('0x23')](function(_0x39b8e7){if(_0x39b8e7&&!_0x39b8e7['voicePause']){logger[_0x8e9a('0x25')](_0x8e9a('0x26'),_0x508ac6,_0x160bd7,_0xccc473);var _0x2b0b6b=_0x4392a9[_0x8e9a('0x9')][_0x508ac6]['attended']&&_0x4392a9[_0x8e9a('0x9')][_0x508ac6][_0x8e9a('0x27')]?_0x4392a9[_0x8e9a('0x9')][_0x508ac6][_0x8e9a('0x27')]:_0x508ac6;return RpcUser['savePause'](_0x4392a9[_0x8e9a('0x7')][_0x160bd7],_0x335b3e,_0x2b0b6b)[_0x8e9a('0x23')](function(){if(!_0x165df2){_0x4392a9[_0x8e9a('0x8')][_0x160bd7]={};logger[_0x8e9a('0x25')](_0x8e9a('0x28'),_0x508ac6,_0x4392a9['voiceQueues'][_0xccc473][_0x8e9a('0x29')],_0x160bd7,_0xccc473);_0x4392a9['timers'][_0x160bd7]['timer']=setTimeout(_0x4392a9['stopAcw'][_0x8e9a('0xe')](_0x4392a9,_0x160bd7),_0x4392a9[_0x8e9a('0x6')][_0xccc473][_0x8e9a('0x29')]*0x3e8);_0x4392a9['timers'][_0x160bd7][_0x8e9a('0x2a')]=moment()[_0x8e9a('0x2b')](_0x8e9a('0x2c'));_0x4392a9['timers'][_0x160bd7][_0x8e9a('0x2d')]=_0x508ac6;_0x4392a9['timers'][_0x160bd7]['queue']=_0xccc473;_0x4392a9['timers'][_0x160bd7][_0x8e9a('0x2e')]=function(){var _0x2597e0=getDiff(_0x4392a9[_0x8e9a('0x8')][_0x160bd7]['lastPauseAt']);clearTimeout(_0x4392a9['timers'][_0x160bd7][_0x8e9a('0x2f')]);_0x4392a9[_0x8e9a('0x8')][_0x160bd7][_0x8e9a('0x2f')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2597e0},_0x4392a9[_0x8e9a('0x8')][_0x160bd7][_0x8e9a('0x2d')],_0x160bd7)['then'](function(_0x516316){logger['info'](_0x8e9a('0x30'),_0x508ac6,_0x2597e0,_0x516316);})[_0x8e9a('0x31')](function(_0x1ff1ff){logger['error'](_0x8e9a('0x32'),_0x508ac6,_0x1ff1ff);});delete _0x4392a9[_0x8e9a('0x8')][_0x160bd7];};}});}else{logger[_0x8e9a('0x25')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x508ac6,_0x160bd7,_0xccc473);}});}})[_0x8e9a('0x31')](function(){logger[_0x8e9a('0x33')](_0x8e9a('0x28'),_0x508ac6,_0x4392a9['voiceQueues'][_0xccc473][_0x8e9a('0x29')],_0x160bd7,_0xccc473);})[_0x8e9a('0x34')](function(){delete _0x4392a9['channels'][_0x508ac6];});}catch(_0x46a65c){logger[_0x8e9a('0x33')](_0x8e9a('0x35'),_0x46a65c[_0x8e9a('0x36')]);}};Acw[_0x8e9a('0x1a')]['stopAcw']=function(_0x79bd7e){try{var _0x41958e=this;if(_0x41958e['timers'][_0x79bd7e]){_0x41958e[_0x8e9a('0x8')][_0x79bd7e][_0x8e9a('0x2f')]=![];var _0x20963c=_0x41958e[_0x8e9a('0x8')][_0x79bd7e][_0x8e9a('0x2d')];var _0x36481d=_0x41958e[_0x8e9a('0x8')][_0x79bd7e][_0x8e9a('0x1d')];var _0x28a70b=_0x41958e[_0x8e9a('0x6')][_0x36481d]['acwTimeout'];logger['info'](_0x8e9a('0x37'),_0x20963c,_0x79bd7e);RpcUser[_0x8e9a('0x38')](this[_0x8e9a('0x7')][_0x79bd7e]);RpcVoiceAgentReport[_0x8e9a('0x39')]({'acwtime':_0x28a70b,'agentacw':!![]},_0x20963c,_0x79bd7e)[_0x8e9a('0x23')](function(_0x48d712){logger[_0x8e9a('0x25')](_0x8e9a('0x30'),_0x20963c,_0x28a70b,_0x48d712);})['catch'](function(_0x5208bc){logger[_0x8e9a('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x20963c,_0x5208bc);});}else{logger['error'](_0x8e9a('0x3a'),_0x79bd7e);if(_0x41958e[_0x8e9a('0x8')]){logger[_0x8e9a('0x25')](_0x8e9a('0x3b'),JSON[_0x8e9a('0x3c')](_0x41958e[_0x8e9a('0x8')]));}}}catch(_0x38cb5b){logger['error']('[ACW][STOP]\x20%s',_0x38cb5b['message']);}};Acw[_0x8e9a('0x1a')][_0x8e9a('0xb')]=function(_0x4da14e){try{if(this[_0x8e9a('0x6')][_0x4da14e[_0x8e9a('0x1d')]]&&(this[_0x8e9a('0x6')][_0x4da14e[_0x8e9a('0x1d')]][_0x8e9a('0x3d')]||this[_0x8e9a('0x6')][_0x4da14e[_0x8e9a('0x1d')]]['mandatoryDisposition'])){if(this[_0x8e9a('0x7')][_0x4da14e['interface']]){this['channels'][_0x4da14e['uniqueid']]={'queue':_0x4da14e[_0x8e9a('0x1d')],'interface':_0x4da14e[_0x8e9a('0x1c')],'destlinkedid':_0x4da14e[_0x8e9a('0x27')]};}}}catch(_0x3b505a){logger[_0x8e9a('0x33')]('[ACW][syncAgentConnect]\x20%s',_0x3b505a[_0x8e9a('0x36')]);}};Acw[_0x8e9a('0x1a')]['syncAgentConnectPreview']=function(_0x523266){try{if(this['voiceQueues'][_0x523266[_0x8e9a('0x1d')]]&&(this['voiceQueues'][_0x523266['queue']][_0x8e9a('0x3d')]||this['voiceQueues'][_0x523266[_0x8e9a('0x1d')]][_0x8e9a('0x1e')])){if(this['agents'][_0x523266[_0x8e9a('0x1c')]]){this[_0x8e9a('0x9')][_0x523266[_0x8e9a('0x2d')]]={'queue':_0x523266[_0x8e9a('0x1d')],'interface':_0x523266[_0x8e9a('0x1c')]};}}}catch(_0x3af8e4){logger['error'](_0x8e9a('0x3e'),_0x3af8e4['message']);}};Acw[_0x8e9a('0x1a')]['syncHangupRequest']=function(_0x32c072){try{if(this['channels'][_0x32c072[_0x8e9a('0x2d')]]&&_[_0x8e9a('0x3f')](this[_0x8e9a('0x9')][_0x32c072[_0x8e9a('0x2d')]][_0x8e9a('0x40')])){logger['info'](_0x8e9a('0x41'),_0x32c072[_0x8e9a('0x2d')]);this[_0x8e9a('0x1b')](_0x32c072[_0x8e9a('0x2d')]);}else if(this[_0x8e9a('0x9')][_0x32c072[_0x8e9a('0x42')]]&&_[_0x8e9a('0x3f')](this[_0x8e9a('0x9')][_0x32c072[_0x8e9a('0x42')]][_0x8e9a('0x40')])){logger[_0x8e9a('0x25')](_0x8e9a('0x43'),_0x32c072[_0x8e9a('0x42')]);this[_0x8e9a('0x1b')](_0x32c072[_0x8e9a('0x42')]);}}catch(_0x3bdbf1){logger['error'](_0x8e9a('0x44'),_0x3bdbf1['message']);}};Acw['prototype'][_0x8e9a('0x10')]=function(_0x2644a8){try{if(this[_0x8e9a('0x9')][_0x2644a8[_0x8e9a('0x2d')]]&&this['channels'][_0x2644a8[_0x8e9a('0x2d')]][_0x8e9a('0x40')]){logger[_0x8e9a('0x25')](_0x8e9a('0x45'),_0x2644a8[_0x8e9a('0x2d')]);this[_0x8e9a('0x1b')](_0x2644a8[_0x8e9a('0x2d')]);}else if(this[_0x8e9a('0x9')][_0x2644a8['linkedid']]&&this['channels'][_0x2644a8['linkedid']][_0x8e9a('0x40')]){logger[_0x8e9a('0x25')](_0x8e9a('0x46'),_0x2644a8[_0x8e9a('0x42')]);this[_0x8e9a('0x1b')](_0x2644a8['linkedid']);}}catch(_0x273518){logger[_0x8e9a('0x33')](_0x8e9a('0x47'),_0x273518[_0x8e9a('0x36')]);}};Acw[_0x8e9a('0x1a')][_0x8e9a('0x12')]=function(_0x5c3cee){try{if(!_[_0x8e9a('0x48')](this[_0x8e9a('0x9')][_0x5c3cee['transfereeuniqueid']])){this[_0x8e9a('0x1b')](_0x5c3cee[_0x8e9a('0x49')]);if(this['channels'][_0x5c3cee[_0x8e9a('0x4a')]]){this[_0x8e9a('0x9')][_0x5c3cee[_0x8e9a('0x4a')]][_0x8e9a('0x40')]=!![];this[_0x8e9a('0x9')][_0x5c3cee[_0x8e9a('0x4b')]]=this['channels'][_0x5c3cee[_0x8e9a('0x4a')]];delete this[_0x8e9a('0x9')][_0x5c3cee[_0x8e9a('0x4a')]];}}else if(!_[_0x8e9a('0x48')](this[_0x8e9a('0x9')][_0x5c3cee[_0x8e9a('0x4b')]])){this[_0x8e9a('0x1b')](_0x5c3cee[_0x8e9a('0x4b')]);if(this['channels'][_0x5c3cee['origtransfereruniqueid']]){this[_0x8e9a('0x9')][_0x5c3cee[_0x8e9a('0x4c')]]['attended']=!![];this[_0x8e9a('0x9')][_0x5c3cee[_0x8e9a('0x49')]]=this[_0x8e9a('0x9')][_0x5c3cee[_0x8e9a('0x4c')]];delete this['channels'][_0x5c3cee['origtransfereruniqueid']];}}}catch(_0x6bb978){logger[_0x8e9a('0x33')]('[ACW][syncAttendedTransfer]\x20%s',_0x6bb978[_0x8e9a('0x36')]);}};Acw[_0x8e9a('0x1a')][_0x8e9a('0x14')]=function(_0x170859){try{if(this[_0x8e9a('0x9')][_0x170859[_0x8e9a('0x4d')]]){logger['info'](_0x8e9a('0x4e'),JSON['stringify'](_0x170859[_0x8e9a('0x4d')]));this['startAcw'](_0x170859[_0x8e9a('0x4d')]);}else if(this[_0x8e9a('0x9')][_0x170859[_0x8e9a('0x4f')]]){logger[_0x8e9a('0x25')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x8e9a('0x3c')](_0x170859['transfererlinkedid']));this[_0x8e9a('0x1b')](_0x170859[_0x8e9a('0x4f')]);}}catch(_0x2c7b77){logger[_0x8e9a('0x33')](_0x8e9a('0x50'),_0x2c7b77[_0x8e9a('0x36')]);}};Acw[_0x8e9a('0x1a')][_0x8e9a('0x11')]=function(_0x4da365){try{if(this[_0x8e9a('0x6')][_0x4da365[_0x8e9a('0x1d')]]&&this[_0x8e9a('0x6')][_0x4da365[_0x8e9a('0x1d')]][_0x8e9a('0x51')]===_0x8e9a('0x52')){if(this[_0x8e9a('0x7')][_0x4da365[_0x8e9a('0x1c')]]){logger['info'](_0x8e9a('0x53'),_0x4da365[_0x8e9a('0x2d')],_0x4da365[_0x8e9a('0x1c')],_0x4da365[_0x8e9a('0x1d')]);return RpcUser[_0x8e9a('0x54')](this['agents'][_0x4da365[_0x8e9a('0x1c')]],_0x8e9a('0x55'),_0x4da365[_0x8e9a('0x2d')]);}}}catch(_0x1f2daf){logger[_0x8e9a('0x33')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1f2daf['message']);}};module[_0x8e9a('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index d6313d0..66c0738 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 _0xd051=['info','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','close','exports','asterisk-manager','bluebird','util','ami','../../config/environment','asterisk','keepConnected','Action','promisify','action','error','format','port','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xd051,0x1af));var _0x1d05=function(_0x238793,_0x5b0cec){_0x238793=_0x238793-0x0;var _0x99d349=_0xd051[_0x238793];return _0x99d349;};'use strict';var Manager=require(_0x1d05('0x0'));var BPromise=require(_0x1d05('0x1'));var util=require(_0x1d05('0x2'));var logger=require('../../config/logger')(_0x1d05('0x3'));var config=require(_0x1d05('0x4'));var ami=new Manager(config['asterisk']['port'],config['asterisk']['ip'],config[_0x1d05('0x5')]['username'],config[_0x1d05('0x5')]['password'],!![]);ami[_0x1d05('0x6')]();ami[_0x1d05('0x7')]=BPromise[_0x1d05('0x8')](ami[_0x1d05('0x9')]);function error(_0x222667){logger[_0x1d05('0xa')](util[_0x1d05('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x1d05('0x5')]['username'],config[_0x1d05('0x5')]['ip'],config[_0x1d05('0x5')][_0x1d05('0xc')],util[_0x1d05('0xd')](_0x222667,![],null)));}function close(){logger[_0x1d05('0xa')](util[_0x1d05('0xb')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x1d05('0x5')][_0x1d05('0xe')],config[_0x1d05('0x5')]['ip'],config[_0x1d05('0x5')][_0x1d05('0xc')]));}ami[_0x1d05('0xf')]=function(){return function(){return ami[_0x1d05('0x7')]({'action':_0x1d05('0x10')});};};ami[_0x1d05('0x11')]=function(){return function(){return ami['Action']({'action':_0x1d05('0x12')});};};ami[_0x1d05('0x13')]=function(){return function(){return ami[_0x1d05('0x7')]({'action':'sippeerstatus'});};};ami[_0x1d05('0x14')]=function(){return function(){return ami[_0x1d05('0x7')]({'action':_0x1d05('0x15')});};};ami[_0x1d05('0x16')]=function(){return function(){return ami[_0x1d05('0x7')]({'action':_0x1d05('0x17')});};};function connect(){logger[_0x1d05('0x18')](util[_0x1d05('0xb')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x1d05('0x5')][_0x1d05('0xe')],config['asterisk']['ip'],config['asterisk'][_0x1d05('0xc')]));ami[_0x1d05('0x19')](_0x1d05('0xa'),error);ami['once']('close',close);}ami['on'](_0x1d05('0x1a'),connect);ami['on'](_0x1d05('0x1b'),function(_0x5718bf){logger[_0x1d05('0x18')](util['format'](_0x1d05('0x1c'),config[_0x1d05('0x5')][_0x1d05('0xe')],config[_0x1d05('0x5')]['ip'],config[_0x1d05('0x5')][_0x1d05('0xc')],util[_0x1d05('0xd')](_0x5718bf,![],null)));});ami['on'](_0x1d05('0x1d'),function(){logger[_0x1d05('0x18')](util[_0x1d05('0xb')](_0x1d05('0x1e'),config[_0x1d05('0x5')]['username'],config[_0x1d05('0x5')]['ip'],config[_0x1d05('0x5')]['port']));return Promise[_0x1d05('0x1f')]()['then'](ami[_0x1d05('0xf')]())['then'](ami['actionDeviceStateList']())[_0x1d05('0x20')](ami[_0x1d05('0x13')]())['then'](ami[_0x1d05('0x14')]())['then'](ami[_0x1d05('0x16')]())['catch'](function(_0x44890a){logger['error']('[ami.js][fullybooted]',util['inspect'](_0x44890a,{'showHidden':![],'depth':null}));});});ami['once'](_0x1d05('0xa'),error);ami[_0x1d05('0x19')](_0x1d05('0x21'),close);module[_0x1d05('0x22')]=ami; \ No newline at end of file +var _0x0e6b=['resolve','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','port','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s'];(function(_0x31896b,_0x5ed3b9){var _0x35bd00=function(_0x6aa626){while(--_0x6aa626){_0x31896b['push'](_0x31896b['shift']());}};_0x35bd00(++_0x5ed3b9);}(_0x0e6b,0x9c));var _0xb0e6=function(_0x1db481,_0x1627b2){_0x1db481=_0x1db481-0x0;var _0x3db95b=_0x0e6b[_0x1db481];return _0x3db95b;};'use strict';var Manager=require(_0xb0e6('0x0'));var BPromise=require(_0xb0e6('0x1'));var util=require(_0xb0e6('0x2'));var logger=require(_0xb0e6('0x3'))('ami');var config=require(_0xb0e6('0x4'));var ami=new Manager(config[_0xb0e6('0x5')][_0xb0e6('0x6')],config['asterisk']['ip'],config['asterisk']['username'],config[_0xb0e6('0x5')][_0xb0e6('0x7')],!![]);ami[_0xb0e6('0x8')]();ami[_0xb0e6('0x9')]=BPromise['promisify'](ami[_0xb0e6('0xa')]);function error(_0xfd9b55){logger[_0xb0e6('0xb')](util[_0xb0e6('0xc')](_0xb0e6('0xd'),config[_0xb0e6('0x5')]['username'],config['asterisk']['ip'],config[_0xb0e6('0x5')][_0xb0e6('0x6')],util[_0xb0e6('0xe')](_0xfd9b55,![],null)));}function close(){logger[_0xb0e6('0xb')](util[_0xb0e6('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xb0e6('0x5')][_0xb0e6('0xf')],config[_0xb0e6('0x5')]['ip'],config['asterisk'][_0xb0e6('0x6')]));}ami[_0xb0e6('0x10')]=function(){return function(){return ami['Action']({'action':_0xb0e6('0x11')});};};ami[_0xb0e6('0x12')]=function(){return function(){return ami[_0xb0e6('0x9')]({'action':_0xb0e6('0x13')});};};ami[_0xb0e6('0x14')]=function(){return function(){return ami['Action']({'action':_0xb0e6('0x15')});};};ami[_0xb0e6('0x16')]=function(){return function(){return ami[_0xb0e6('0x9')]({'action':_0xb0e6('0x17')});};};ami[_0xb0e6('0x18')]=function(){return function(){return ami['Action']({'action':_0xb0e6('0x19')});};};function connect(){logger[_0xb0e6('0x1a')](util[_0xb0e6('0xc')](_0xb0e6('0x1b'),config['asterisk']['username'],config[_0xb0e6('0x5')]['ip'],config[_0xb0e6('0x5')][_0xb0e6('0x6')]));ami[_0xb0e6('0x1c')](_0xb0e6('0xb'),error);ami['once'](_0xb0e6('0x1d'),close);}ami['on'](_0xb0e6('0x1e'),connect);ami['on'](_0xb0e6('0x1f'),function(_0x6f242){logger[_0xb0e6('0x1a')](util[_0xb0e6('0xc')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xb0e6('0x5')][_0xb0e6('0xf')],config['asterisk']['ip'],config['asterisk'][_0xb0e6('0x6')],util[_0xb0e6('0xe')](_0x6f242,![],null)));});ami['on'](_0xb0e6('0x20'),function(){logger['info'](util[_0xb0e6('0xc')](_0xb0e6('0x21'),config[_0xb0e6('0x5')][_0xb0e6('0xf')],config['asterisk']['ip'],config[_0xb0e6('0x5')][_0xb0e6('0x6')]));return Promise[_0xb0e6('0x22')]()['then'](ami['actionSipShowRegistry']())[_0xb0e6('0x23')](ami[_0xb0e6('0x12')]())[_0xb0e6('0x23')](ami[_0xb0e6('0x14')]())[_0xb0e6('0x23')](ami[_0xb0e6('0x16')]())[_0xb0e6('0x23')](ami[_0xb0e6('0x18')]())['catch'](function(_0x25b248){logger[_0xb0e6('0xb')](_0xb0e6('0x24'),util['inspect'](_0x25b248,{'showHidden':![],'depth':null}));});});ami[_0xb0e6('0x1c')]('error',error);ami[_0xb0e6('0x1c')](_0xb0e6('0x1d'),close);module[_0xb0e6('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 8aa163e..eff3002 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 _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xb7e7[_0x50007c];return _0x5c1ec7;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x243b70,_0x2d58d8){var _0x552730=function(_0x4582db){while(--_0x4582db){_0x243b70['push'](_0x243b70['shift']());}};_0x552730(++_0x2d58d8);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4a9433,_0x5337cb){_0x4a9433=_0x4a9433-0x0;var _0x434947=_0xbdb7[_0x4a9433];return _0x434947;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 0366095..b1d3f71 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 _0x0fd2=['INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','active','SIP/%s','status','reachable','unmonitored','prototype','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','length','Action','iftime\x20%s,%s','interval','then','content','true','catch','push','command','indexOf','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','Global:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueid','type','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','getSeconds','droptime','responsetime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','statedesc','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ListId','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','CALLEREXIT','countabandonedretry','verifyAdditionalPhones','rescheduleContact','dialAbandonedRetryFrequency','ContactId','CampaignId','createHistory','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','locked','stateinterface','pick','idHopper','paused','run','[unlock][syncQueueStatusComplete]','isEmpty','queueBookedRR','_rr','isNil','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','finally','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','stateGlobal','reason\x2019\x20machine....','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Unknow','running','isPreviewCampaign','resolve','statusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','Agent','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','getCaller','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countcongestionretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','object','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','outboundCongestionCallsDay','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','reason\x2020\x20agentreject','outboundUnknownCallsDay','reason','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','avgHandleTime','Predictive\x20after\x20first\x20interval','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','predictiveIntervalPauses','[CatchErlangB]','outboundQueuePauses','check\x20failure','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\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]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','queuecallerabandon','syncQueueCallerAbandon','bind','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','emit','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','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','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','---------------------------','merge','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','endtime','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x0fd2,0x1b5));var _0x20fd=function(_0x5572fd,_0x28464c){_0x5572fd=_0x5572fd-0x0;var _0x13eb70=_0x0fd2[_0x5572fd];return _0x13eb70;};'use strict';var util=require(_0x20fd('0x0'));var _=require(_0x20fd('0x1'));var uuid=require('uuid');var moment=require(_0x20fd('0x2'));var rr=require('rr');var Redis=require(_0x20fd('0x3'));var utils=require(_0x20fd('0x4'));var hopperUtils=require('./utils/hopper');var ut=require(_0x20fd('0x5'));var config=require(_0x20fd('0x6'));var logger=require(_0x20fd('0x7'))(_0x20fd('0x8'));var loggerBooked=require('../../../config/logger')(_0x20fd('0x9'));var loggerPredictive=require(_0x20fd('0x7'))(_0x20fd('0xa'));var loggerPredictiveCalls=require(_0x20fd('0x7'))(_0x20fd('0xb'));var loggerSyncQueueSummary=require(_0x20fd('0x7'))('syncQueueSummary');var ami=require(_0x20fd('0xc'));config['redis']=_[_0x20fd('0xd')](config[_0x20fd('0xe')],{'host':_0x20fd('0xf'),'port':0x18eb});var io=require(_0x20fd('0x10'))(new Redis(config['redis']));var cmHopper=require(_0x20fd('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x20fd('0x12'));var Interval=require(_0x20fd('0x13'));var Action=require(_0x20fd('0x14'));var History=require('./models/history');var Final=require(_0x20fd('0x15'));var AgentComplete=require(_0x20fd('0x16'));var QueueCallerAbandon=require(_0x20fd('0x17'));var Hangup=require(_0x20fd('0x18'));var ipAgi=process['env'][_0x20fd('0x19')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0xaf308c){this['tail']=this[_0x20fd('0x1a')]?this[_0x20fd('0x1a')]['finally'](_0xaf308c):_0xaf308c();};function Dialer(_0x23d50c,_0xbedf7){this[_0x20fd('0x1b')]=new Sequence();this[_0x20fd('0x1c')]=_0xbedf7;this[_0x20fd('0x1d')]=_0x23d50c[_0x20fd('0x1d')];this[_0x20fd('0x1e')]=_0x23d50c['campaigns'];this['agents']=_0x23d50c[_0x20fd('0x1f')];this[_0x20fd('0x20')]=_0x23d50c[_0x20fd('0x20')];this[_0x20fd('0x21')]=config[_0x20fd('0x21')]||0x2;this[_0x20fd('0x22')]={};this[_0x20fd('0x23')]={};this[_0x20fd('0x24')]={};this[_0x20fd('0x25')]={};this[_0x20fd('0x26')]={};this[_0x20fd('0x27')]={};this[_0x20fd('0x28')]={};this[_0x20fd('0x29')]={};this[_0x20fd('0x2a')]={};this['queueBookedRR']={};this[_0x20fd('0x2b')]={};ami['on'](_0x20fd('0x2c'),this['syncAgentConnect']['bind'](this));ami['on'](_0x20fd('0x2d'),this[_0x20fd('0x2e')][_0x20fd('0x2f')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x20fd('0x2f')](this));ami['on'](_0x20fd('0x30'),this[_0x20fd('0x31')]['bind'](this));ami['on'](_0x20fd('0x32'),this[_0x20fd('0x33')][_0x20fd('0x2f')](this));ami['on'](_0x20fd('0x34'),this[_0x20fd('0x35')][_0x20fd('0x2f')](this));ami['on'](_0x20fd('0x36'),this[_0x20fd('0x37')]['bind'](this));ami['on']('newexten',this[_0x20fd('0x38')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0x20fd('0x2f')](this));ami['on'](_0x20fd('0x39'),this[_0x20fd('0x3a')][_0x20fd('0x2f')](this));ami['on']('queuestatuscomplete',this[_0x20fd('0x3b')][_0x20fd('0x2f')](this));this['loopCampaigns']();this[_0x20fd('0x3c')]();RpcSetting['getSettings']()['then'](function(_0x4ca92f){previewRecallmeReminderInterval=_0x4ca92f['previewRecallmeReminderInterval'];});}function isNotNull(_0x72a61d){return _0x72a61d!==null&&!_[_0x20fd('0x3d')](_0x72a61d);}function msgResponse(_0x5a4bc9,_0x22c071,_0x4a0c0a){return{'action':_0x5a4bc9,'response':_0x22c071,'message':_0x4a0c0a,'stack':_0x4a0c0a};}function emit(_0x1c8223,_0x2c2903,_0x11b58a){io['to'](_0x1c8223)[_0x20fd('0x3e')](_0x2c2903,_0x11b58a);}function emitOutboundVoiceQueueSummary(_0x1eec69){if(_0x1eec69['type']==='outbound'){logger[_0x20fd('0x3f')](_0x20fd('0x40'),util[_0x20fd('0x41')](_0x1eec69,{'showHidden':![],'depth':null}));emit(util[_0x20fd('0x42')](_0x20fd('0x43'),_0x1eec69[_0x20fd('0x44')]),'voice_queue:save',_0x1eec69);}}function checkGetDataPredictive(_0x161477){if(isNotNull(_0x161477)&&!_['isEmpty'](_0x161477)){loggerPredictive[_0x20fd('0x45')](_0x20fd('0x46'));loggerPredictive['info'](_0x20fd('0x47'),_0x161477[_0x20fd('0x48')]);loggerPredictive['info'](_0x20fd('0x49'),_0x161477[_0x20fd('0x4a')]);loggerPredictive[_0x20fd('0x45')](_0x20fd('0x4b'),_0x161477[_0x20fd('0x4c')]);loggerPredictive['info'](_0x20fd('0x4d'),_0x161477[_0x20fd('0x4e')]);loggerPredictive[_0x20fd('0x45')](_0x20fd('0x4f'),_0x161477[_0x20fd('0x50')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x161477['predictiveIntervalAvgTalktime']);loggerPredictive[_0x20fd('0x45')]('---------------------------');if(_0x161477['predictiveIntervalTotalCalls']>0x0){if(!_[_0x20fd('0x3d')](_0x161477[_0x20fd('0x51')])&&_0x161477['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0x20fd('0x52'));if(!_['isUndefined'](_0x161477[_0x20fd('0x50')])&&_0x161477['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x20fd('0x45')](_0x20fd('0x53'));}else{loggerPredictive[_0x20fd('0x45')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x20fd('0x45')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0xa765e1){return function(_0x4b6f3e){loggerPredictive[_0x20fd('0x45')](_0x20fd('0x54'));loggerPredictive['info'](_0x20fd('0x55'),_0x4b6f3e[_0x20fd('0x56')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b6f3e[_0x20fd('0x57')]);loggerPredictive['info'](_0x20fd('0x58'),_0x4b6f3e[_0x20fd('0x59')]);loggerPredictive[_0x20fd('0x45')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b6f3e[_0x20fd('0x5a')]);loggerPredictive[_0x20fd('0x45')](_0x20fd('0x58'),_0x4b6f3e[_0x20fd('0x59')]);loggerPredictive[_0x20fd('0x45')](_0x20fd('0x5b'));_[_0x20fd('0x5c')](_0xa765e1,_0x4b6f3e);};}function ifInterval(_0x160dd8,_0x6dd428){if(_[_0x20fd('0x3d')](_0x6dd428)){return![];}return utils['getSeconds'](undefined,_0x6dd428)<_0x160dd8*0x3c;}function clearPredictiveAttributes(_0x24e62a){if(_0x24e62a[_0x20fd('0x28')]){_0x24e62a[_0x20fd('0x28')]=undefined;loggerPredictive[_0x20fd('0x3f')](_0x24e62a[_0x20fd('0x44')],_0x20fd('0x5d'));}if(_0x24e62a[_0x20fd('0x27')]){_0x24e62a['startPredictive']=undefined;loggerPredictive[_0x20fd('0x3f')](_0x24e62a[_0x20fd('0x44')],_0x20fd('0x5e'));}if(_0x24e62a[_0x20fd('0x5f')]){clearInterval(_0x24e62a[_0x20fd('0x5f')]);_0x24e62a[_0x20fd('0x5f')]=undefined;loggerPredictive[_0x20fd('0x3f')](_0x24e62a[_0x20fd('0x44')],_0x20fd('0x60'));}}function loggerCatchPredictive(_0x588e41,_0x4aeb3b){return function(_0x3a0962){loggerPredictive[_0x20fd('0x61')](_0x4aeb3b[_0x20fd('0x44')],_0x588e41);loggerPredictive['error'](_0x3a0962[_0x20fd('0x62')]);clearPredictiveAttributes(_0x4aeb3b);};}function loggerCatch(_0xbca878){return function(_0x5bafc7){logger[_0x20fd('0x61')](_0xbca878,util[_0x20fd('0x41')](_0x5bafc7,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x469d2b,_0x5348ab,_0x309d1c){return function(_0x5d8c13){utils[_0x20fd('0x63')](_0x5348ab,_0x309d1c,0x0);logger[_0x20fd('0x61')](_0x469d2b,util[_0x20fd('0x41')](_0x5d8c13,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xa31812){return function(_0x11aed3){if(isNotNull(_0x11aed3)&&isNotNull(_0x11aed3[0x0])){if(_0x11aed3[0x0][_0x20fd('0x64')]>0x0){_0xa31812[_0x20fd('0x65')]=utils[_0x20fd('0x66')][_0x20fd('0x67')];logger['info'](_0x20fd('0x68')+_0xa31812['name'],_0x11aed3[0x0][_0x20fd('0x64')],'contacts');}else{_0xa31812[_0x20fd('0x65')]=utils['CAMPAIGN_STATUS'][_0x20fd('0x69')];logger[_0x20fd('0x45')]('[getContactDialer2][Empty]'+_0xa31812[_0x20fd('0x44')]);}}};}function createObjHistory(_0x4078df,_0x49f48f,_0x3320a3,_0x17a954,_0xc437f1){_0x4078df[_0x20fd('0x65')]=_0x3320a3;var _0x3db412=new Action(_0x4078df,_0x49f48f);var _0x57a639=new History(_0x3db412);_0x57a639['state']=_0x17a954;_0x57a639['statedesc']=_0xc437f1;_0x57a639[_0x20fd('0x6a')]=_0x3db412[_0x20fd('0x6b')];return _0x57a639;}function unlockQueueStatus(_0xf67f99,_0x1bed16){setTimeout(function(){if(_[_0x20fd('0x3d')](_0xf67f99['queueStatusComplete'])){loggerBooked[_0x20fd('0x61')](_0x20fd('0x6c'),_0x1bed16);}_0xf67f99[_0x20fd('0x6d')]=!![];loggerBooked[_0x20fd('0x45')](_0x20fd('0x6e'),_0x1bed16,JSON[_0x20fd('0x6f')](_['pick'](_0xf67f99,[_0x20fd('0x44'),_0x20fd('0x6d')])));},0x1f3);}function checkInterval(_0x5aa49c){return function(){if(!isNotNull(_0x5aa49c[_0x20fd('0x70')])){_0x5aa49c[_0x20fd('0x65')]=utils[_0x20fd('0x66')][_0x20fd('0x71')];throw _0x5aa49c[_0x20fd('0x44')]+_0x20fd('0x72');}if(!isNotNull(_0x5aa49c[_0x20fd('0x70')][_0x20fd('0x73')])){_0x5aa49c['message']=utils[_0x20fd('0x66')][_0x20fd('0x71')];throw _0x5aa49c[_0x20fd('0x44')]+_0x20fd('0x72');}if(!isNotNull(_['isEmpty'](_0x5aa49c[_0x20fd('0x70')]['Intervals']))){_0x5aa49c['message']=utils[_0x20fd('0x66')]['NULL_INTERVAL'];throw _0x5aa49c[_0x20fd('0x44')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x33e125){return function(){if(!utils['isIVRCampaignActive'](_0x33e125)){_0x33e125[_0x20fd('0x65')]=utils[_0x20fd('0x66')][_0x20fd('0x74')];throw _0x33e125[_0x20fd('0x44')]+_0x20fd('0x75');}};}function emitCampaignSummary(_0x70db1d){if(utils[_0x20fd('0x76')](_0x70db1d)){emit(util['format']('campaign:ivr:%s',_0x70db1d['name']),_0x20fd('0x77'),_0x70db1d);}}function loggerCatchQueueSummary(_0x3c3260,_0x21ab23){return function(_0x41fef4){clearPredictiveAttributes(_0x21ab23);emitCampaignSummary(_0x21ab23);loggerSyncQueueSummary[_0x20fd('0x3f')](_0x3c3260,util[_0x20fd('0x41')](_0x41fef4,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0xe8fd27){if(_0xe8fd27[_0x20fd('0x78')]){if(_0xe8fd27[_0x20fd('0x79')]===0x0){_0xe8fd27[_0x20fd('0x78')]=![];_0xe8fd27[_0x20fd('0x65')]=utils[_0x20fd('0x66')][_0x20fd('0x74')];loggerSyncQueueSummary[_0x20fd('0x3f')](_0x20fd('0x7a'),_0xe8fd27[_0x20fd('0x44')],_0x20fd('0x7b'));}else{_0xe8fd27[_0x20fd('0x65')]=utils['CAMPAIGN_STATUS'][_0x20fd('0x7c')];loggerSyncQueueSummary[_0x20fd('0x3f')](_0x20fd('0x7a'),_0xe8fd27[_0x20fd('0x44')],_0x20fd('0x7d'));}emitCampaignSummary(_0xe8fd27);}}function myreject(_0x242371){return function(_0x2f890f){return _0x242371(msgResponse(_0x20fd('0x7e'),_0x20fd('0x7f'),JSON[_0x20fd('0x6f')](_0x2f890f)));};}Dialer['prototype']['isTrunkReachable']=function(_0x4f50d6){return!_[_0x20fd('0x3d')](_0x4f50d6)&&_0x4f50d6&&!_[_0x20fd('0x3d')](_0x4f50d6[_0x20fd('0x44')])&&!_[_0x20fd('0x3d')](_0x4f50d6['active'])&&_0x4f50d6[_0x20fd('0x80')]&&(this[_0x20fd('0x20')][util[_0x20fd('0x42')](_0x20fd('0x81'),_0x4f50d6[_0x20fd('0x44')])][_0x20fd('0x82')]===_0x20fd('0x83')||this['trunks'][util[_0x20fd('0x42')](_0x20fd('0x81'),_0x4f50d6[_0x20fd('0x44')])][_0x20fd('0x82')]===_0x20fd('0x84'));};Dialer[_0x20fd('0x85')][_0x20fd('0x86')]=function(_0x21c9fa){var _0xeed358=this;return function(){if(!_0xeed358[_0x20fd('0x87')](_0x21c9fa[_0x20fd('0x88')])){if(!_0xeed358[_0x20fd('0x87')](_0x21c9fa[_0x20fd('0x89')])){_0x21c9fa[_0x20fd('0x65')]=utils[_0x20fd('0x66')]['TRUNK_NOT_REACHABLE'];throw _0x21c9fa[_0x20fd('0x44')]+_0x20fd('0x8a');}}};};Dialer['prototype'][_0x20fd('0x8b')]=function(_0x2cf923,_0x16435e,_0x491ae0,_0x307b52){var _0x5da79a=this;return function(){var _0x4d88d3=!![];return _0x5da79a[_0x20fd('0x8c')](_0x2cf923,_0x16435e,_0x491ae0,_0x307b52,_0x4d88d3);};};Dialer[_0x20fd('0x85')][_0x20fd('0x8d')]=function(_0x3640b0,_0x5b385a,_0x36f0ee,_0x225b03){var _0x34dc84=this;return function(){var _0x3e50ae=![];return _0x34dc84[_0x20fd('0x8c')](_0x3640b0['Intervals'],_0x5b385a,_0x36f0ee,_0x225b03,_0x3e50ae);};};Dialer['prototype']['ifTimeIvr']=function(_0x55e89d,_0x3aa028,_0x3a2457,_0x44e5b1,_0x5f129f){var _0x2c6020=[];return new Promise(function(_0xa7c23f,_0x45663e){if(!isNotNull(_0x55e89d)){_0x44e5b1[_0x20fd('0x65')]=utils[_0x20fd('0x66')][_0x20fd('0x71')];return _0x45663e(msgResponse(_0x20fd('0x8e'),_0x20fd('0x8f'),_0x3a2457+_0x20fd('0x90')));}if(_['isEmpty'](_0x55e89d)){_0x44e5b1[_0x20fd('0x65')]=utils[_0x20fd('0x66')][_0x20fd('0x91')];return _0x45663e(msgResponse(_0x20fd('0x8e'),_0x20fd('0x8f'),_0x3a2457+_0x20fd('0x92')));}if(_0x3aa028&&_[_0x20fd('0x3d')](config[_0x20fd('0x93')][_0x3aa028])){_0x44e5b1[_0x20fd('0x65')]=utils[_0x20fd('0x66')]['UNKNOWN_TIMEZONE'];return _0x45663e(msgResponse('ifTime',_0x20fd('0x8f'),_0x3a2457+_0x20fd('0x94')+_0x3aa028));}if(_['isArray'](_0x55e89d)){for(var _0x3bb85a=0x0;_0x3bb85a<_0x55e89d[_0x20fd('0x95')];_0x3bb85a+=0x1){_0x2c6020['push'](ami[_0x20fd('0x96')]({'action':'command','command':util['format'](_0x20fd('0x97'),_0x55e89d[_0x3bb85a][_0x20fd('0x98')],!_['isUndefined'](config[_0x20fd('0x93')][_0x3aa028])?_0x3aa028:'')})[_0x20fd('0x99')](function(_0x13961f){return _0x13961f[_0x20fd('0x9a')]['indexOf'](_0x20fd('0x9b'))>=0x0;})[_0x20fd('0x9c')](myreject(_0x45663e)));}}else{_0x2c6020[_0x20fd('0x9d')](ami['Action']({'action':_0x20fd('0x9e'),'command':util[_0x20fd('0x42')]('iftime\x20%s,%s',_0x55e89d,!_[_0x20fd('0x3d')](config[_0x20fd('0x93')][_0x3aa028])?_0x3aa028:'')})[_0x20fd('0x99')](function(_0x233f32){return _0x233f32['content'][_0x20fd('0x9f')](_0x20fd('0x9b'))>=0x0;})[_0x20fd('0x9c')](myreject(_0x45663e)));}Promise[_0x20fd('0xa0')](_0x2c6020)[_0x20fd('0x99')](function(_0x17bb40){var _0x70febc=_['some'](_0x17bb40);if(_0x70febc){return _0xa7c23f(_0x70febc);}else{_0x44e5b1[_0x20fd('0x65')]=_0x5f129f?utils[_0x20fd('0x66')][_0x20fd('0xa1')]:utils[_0x20fd('0x66')][_0x20fd('0xa2')];return _0x45663e(msgResponse(_0x20fd('0xa3'),_0x20fd('0x8f'),'Global:\x20'+_0x5f129f+'\x20'+_0x3a2457+_0x20fd('0xa4')+util[_0x20fd('0x41')](_0x55e89d,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3aa028));}})[_0x20fd('0x9c')](function(_0x5b19da){return _0x45663e(msgResponse('ifTime','Failure',JSON[_0x20fd('0x6f')](_0x5b19da)));});});};Dialer['prototype'][_0x20fd('0xa5')]=function(){var _0x177774=this;return cmHopper[_0x20fd('0xa6')]({'active':![]},{'where':{'active':!![]}})[_0x20fd('0x99')](function(){setInterval(function(){_0x177774['syncCampaigns']();},0x3e8);});};Dialer['prototype'][_0x20fd('0xa7')]=function(){var _0x186f84=this;var _0x394849;for(var _0x30f905 in this['campaigns']){if(typeof this[_0x20fd('0x1e')][_0x30f905]!==_0x20fd('0xa8')){_0x394849=this[_0x20fd('0x1e')][_0x30f905];if(utils[_0x20fd('0x76')](_0x394849)&&utils[_0x20fd('0xa9')](_0x394849)){_0x394849['sendMessageOneNotActive']=!![];Promise['resolve']()['then'](checkIsIVRCampaignActive(_0x394849))[_0x20fd('0x99')](checkInterval(_0x394849))[_0x20fd('0x99')](_0x186f84['checkIsTrunkReachable'](_0x394849))[_0x20fd('0x99')](_0x186f84[_0x20fd('0x8b')](_0x394849['dialGlobalInterval'],_0x394849[_0x20fd('0xaa')],_0x394849['name'],_0x394849))['then'](_0x186f84[_0x20fd('0x8d')](_0x394849[_0x20fd('0x70')],_0x394849[_0x20fd('0xaa')],_0x394849[_0x20fd('0x44')],_0x394849))[_0x20fd('0x99')](_0x186f84['launchHandleIvr'](_0x394849))['catch'](loggerCatchQueueSummary(_0x20fd('0xab'),_0x394849));}else{notSendMessagesCampaign(_0x394849);}}}};Dialer[_0x20fd('0x85')][_0x20fd('0xac')]=function(_0x50eb63){if(_0x50eb63['dialMethod']!==_0x20fd('0xa')){clearPredictiveAttributes(_0x50eb63);}switch(_0x50eb63[_0x20fd('0xad')]){case _0x20fd('0xae'):this[_0x20fd('0xaf')](_0x50eb63,0x1);break;case _0x20fd('0xb0'):this[_0x20fd('0xaf')](_0x50eb63,_0x50eb63[_0x20fd('0xb1')]);break;case'predictive':this[_0x20fd('0xa')](_0x50eb63);break;case'booked':this[_0x20fd('0xaf')](_0x50eb63,0x1);break;default:logger['error'](_0x20fd('0xb2'),_0x50eb63[_0x20fd('0x44')],_0x20fd('0xb3'));}};Dialer[_0x20fd('0x85')][_0x20fd('0x8e')]=function(_0x225f62,_0x452398){var _0x6938ee=_0x225f62[_0x20fd('0xaa')];var _0x4833e4=_0x452398?_0x225f62[_0x20fd('0xb4')]:_0x225f62[_0x20fd('0x70')][_0x20fd('0x73')];logger['silly'](_0x20fd('0xb5'),_0x4833e4,_0x6938ee,_0x225f62[_0x20fd('0x44')],util['format'](_0x20fd('0xb6'),_0x225f62[_0x20fd('0x44')],_0x225f62['id']));var _0x204c13=null;return Interval['intervalIftime'](_0x4833e4,_0x6938ee)[_0x20fd('0x99')](function(_0x419270){if(_0x419270===!![]){return _0x419270;}else{_0x225f62[_0x20fd('0x65')]=_0x452398?utils[_0x20fd('0x66')][_0x20fd('0xa1')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];_0x204c13=msgResponse('[ifTime][promiseAll]','Failure',_0x20fd('0xb7')+_0x452398+'\x20'+_0x225f62[_0x20fd('0x44')]+_0x20fd('0xa4')+util[_0x20fd('0x41')](_0x4833e4,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x6938ee);}if(_0x204c13!==null){logger[_0x20fd('0xb8')](_0x20fd('0xb9'),_0x204c13);_0x204c13[_0x20fd('0xba')]=_0x452398;throw _0x204c13;}})[_0x20fd('0x9c')](function(_0x332e80){logger[_0x20fd('0x61')](_0x20fd('0xbb'),_0x332e80);throw msgResponse(_0x20fd('0x7e'),'Error',util['inspect'](_0x332e80,{'showHidden':![],'depth':null}));});};Dialer[_0x20fd('0x85')][_0x20fd('0xbc')]=function(_0x4ca0b6){if(this[_0x20fd('0x1d')][_0x4ca0b6[_0x20fd('0xbd')]]){if(this['uniqueId'][_0x4ca0b6[_0x20fd('0xbe')]]&&this[_0x20fd('0x25')][_0x4ca0b6[_0x20fd('0xbe')]][_0x20fd('0xbf')]!==_0x20fd('0xc0')){this[_0x20fd('0xc1')](this[_0x20fd('0x1d')][_0x4ca0b6[_0x20fd('0xbd')]]);this[_0x20fd('0x25')][_0x4ca0b6[_0x20fd('0xbe')]]['answertime']=moment()['format'](_0x20fd('0xc2'));}}};Dialer[_0x20fd('0x85')]['syncAgentComplete']=function(_0x17181f){var _0x2ac1c0=this[_0x20fd('0x25')][_0x17181f[_0x20fd('0xbe')]];if(this['voiceQueues'][_0x17181f[_0x20fd('0xbd')]]){if(_0x2ac1c0&&_0x2ac1c0[_0x20fd('0xbf')]!==_0x20fd('0xc0')){delete this[_0x20fd('0x25')][_0x17181f['uniqueid']];this[_0x20fd('0x1d')][_0x17181f[_0x20fd('0xbd')]][_0x20fd('0xc3')]+=0x1;var _0x1626b8=new AgentComplete(_0x2ac1c0,_0x17181f);if(_0x17181f['reason']===_0x20fd('0xc4')){_0x1626b8[_0x20fd('0xc5')]=this['voiceQueues'][_0x17181f[_0x20fd('0xbd')]][_0x20fd('0xc6')]&&this['voiceQueues'][_0x17181f[_0x20fd('0xbd')]]['dialAgiAfterHangupAgent']?moment()['format'](_0x20fd('0xc2')):undefined;}hopperUtils['createHistory'](_0x1626b8)['catch'](loggerCatch(_0x20fd('0xc7')));hopperUtils[_0x20fd('0xc8')](_0x1626b8)[_0x20fd('0x9c')](loggerCatch(_0x20fd('0xc9')));}}};Dialer[_0x20fd('0x85')][_0x20fd('0x2e')]=function(_0x27cf20){var _0x39ff96=this[_0x20fd('0x25')][_0x27cf20['uniqueid']];var _0xde302d=this;var _0x53800a=![];var _0x1e519e;var _0xba846c;if(this['voiceQueues'][_0x27cf20['queue']]){if(_0x39ff96&&_0x39ff96[_0x20fd('0xbf')]!==_0x20fd('0xc0')){delete this[_0x20fd('0x25')][_0x27cf20['uniqueid']];this[_0x20fd('0xc1')](this['voiceQueues'][_0x27cf20[_0x20fd('0xbd')]]);_0x39ff96['droptime']=moment()[_0x20fd('0x42')](_0x20fd('0xc2'));var _0x4b84f7=new QueueCallerAbandon(_0x39ff96,_0x27cf20);if(utils[_0x20fd('0xca')](_0x39ff96[_0x20fd('0xcb')],_0x39ff96[_0x20fd('0xcc')])>=_0x39ff96['dialQueueTimeout']){this[_0x20fd('0x1d')][_0x27cf20[_0x20fd('0xbd')]][_0x20fd('0x4c')]+=0x1;this[_0x20fd('0x1d')][_0x27cf20[_0x20fd('0xbd')]][_0x20fd('0xcd')]+=0x1;this[_0x20fd('0x1d')][_0x27cf20[_0x20fd('0xbd')]][_0x20fd('0xce')]+=0x1;_0x4b84f7[_0x20fd('0xcf')]=0xa;_0x4b84f7[_0x20fd('0xd0')]=_0x20fd('0xd1');_0x4b84f7[_0x20fd('0xd2')]=_0x20fd('0xd3');_0x4b84f7[_0x20fd('0xc5')]=this[_0x20fd('0x1d')][_0x27cf20['queue']][_0x20fd('0xc6')]?moment()[_0x20fd('0x42')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x4b84f7[_0x20fd('0xd4')]+=0x1;_0x4b84f7[_0x20fd('0xd5')]+=0x1;_0x1e519e=this[_0x20fd('0x1d')][_0x27cf20[_0x20fd('0xbd')]][_0x20fd('0xd6')];_0xba846c=this[_0x20fd('0x1d')][_0x27cf20[_0x20fd('0xbd')]][_0x20fd('0xd7')];hopperUtils['verifyAdditionalPhones'](_0x4b84f7,_0x4b84f7[_0x20fd('0xcf')],_0x39ff96[_0x20fd('0xd8')])['then'](function(_0x538c4b){_0x53800a=_0x538c4b[_0x20fd('0xd9')]==0x1;if(_0x4b84f7['countdropretry']>=_0xde302d['voiceQueues'][_0x27cf20['queue']][_0x20fd('0xda')]){_0xde302d[_0x20fd('0xdb')](_0x4b84f7,_0x538c4b[_0x20fd('0xd9')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4b84f7['countdropretry'],'scheduledat':moment()[_0x20fd('0xdc')](_0xde302d[_0x20fd('0x1d')][_0x27cf20[_0x20fd('0xbd')]][_0x20fd('0xd6')],_0x20fd('0xdd'))[_0x20fd('0x42')](_0x20fd('0xc2')),'ContactId':_0x39ff96['ContactId'],'ListId':_0x39ff96[_0x20fd('0xde')],'VoiceQueueId':_0x39ff96[_0x20fd('0xdf')]||undefined,'CampaignId':_0x39ff96['CampaignId']||undefined})[_0x20fd('0x9c')](loggerCatch(_0x20fd('0xe0')));var _0x4741b6=new History(_0x4b84f7);_0x4741b6[_0x20fd('0xcf')]=0xa;_0x4741b6[_0x20fd('0xd0')]=_0x20fd('0xd1');_0x4741b6[_0x20fd('0x6b')]=moment()[_0x20fd('0x42')](_0x20fd('0xc2'));_0x4741b6['endtime']=_0x4741b6[_0x20fd('0x6b')];_0x4741b6[_0x20fd('0xe1')]=_0x4b84f7[_0x20fd('0xe1')];_0x4741b6[_0x20fd('0xe2')]=_0x4b84f7[_0x20fd('0xe2')];hopperUtils['createHistory'](_0x4741b6)[_0x20fd('0x9c')](loggerCatch(_0x20fd('0xe3')));}})[_0x20fd('0x99')](function(){if(_0x53800a)hopperUtils[_0x20fd('0xe4')](_0x4b84f7,_0x1e519e,_0xba846c)[_0x20fd('0x99')](function(){return 0x1;});});}else{this[_0x20fd('0x1d')][_0x27cf20['queue']][_0x20fd('0x4e')]+=0x1;this[_0x20fd('0x1d')][_0x27cf20['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x4b84f7[_0x20fd('0xcf')]=0xb;_0x4b84f7['statedesc']=_0x20fd('0xe5');_0x4b84f7[_0x20fd('0xd2')]=_0x20fd('0xe6');_0x4b84f7[_0x20fd('0xe7')]+=0x1;_0x4b84f7['countglobal']+=0x1;_0x1e519e=this[_0x20fd('0x1d')][_0x27cf20[_0x20fd('0xbd')]]['dialAbandonedRetryFrequency'];_0xba846c=this[_0x20fd('0x1d')][_0x27cf20[_0x20fd('0xbd')]][_0x20fd('0xd7')];hopperUtils[_0x20fd('0xe8')](_0x4b84f7,_0x4b84f7[_0x20fd('0xcf')],_0x39ff96[_0x20fd('0xd8')])[_0x20fd('0x99')](function(_0x1ebc2c){if(_0x4b84f7[_0x20fd('0xe7')]>=_0xde302d[_0x20fd('0x1d')][_0x27cf20[_0x20fd('0xbd')]]['dialAbandonedMaxRetry']){_0xde302d[_0x20fd('0xdb')](_0x4b84f7,_0x1ebc2c[_0x20fd('0xd9')]);}else{hopperUtils[_0x20fd('0xe9')]({'active':![],'countabandonedretry':_0x4b84f7[_0x20fd('0xe7')],'scheduledat':moment()[_0x20fd('0xdc')](_0xde302d[_0x20fd('0x1d')][_0x27cf20['queue']][_0x20fd('0xea')],_0x20fd('0xdd'))[_0x20fd('0x42')](_0x20fd('0xc2')),'ContactId':_0x39ff96[_0x20fd('0xeb')],'ListId':_0x39ff96[_0x20fd('0xde')],'VoiceQueueId':_0x39ff96[_0x20fd('0xdf')]||undefined,'CampaignId':_0x39ff96[_0x20fd('0xec')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x49504c=new History(_0x4b84f7);_0x49504c[_0x20fd('0xcf')]=0xb;_0x49504c[_0x20fd('0xd0')]=_0x20fd('0xe5');_0x49504c['starttime']=moment()['format'](_0x20fd('0xc2'));_0x49504c[_0x20fd('0x6a')]=_0x49504c['starttime'];_0x49504c['calleridname']=_0x4b84f7[_0x20fd('0xe1')];_0x49504c['calleridnum']=_0x4b84f7[_0x20fd('0xe2')];hopperUtils[_0x20fd('0xed')](_0x49504c)[_0x20fd('0x9c')](loggerCatch(_0x20fd('0xee')));}})[_0x20fd('0x99')](function(){if(_0x53800a)hopperUtils['swapAdditionalPhones'](_0x4b84f7,_0x1e519e,_0xba846c)[_0x20fd('0x99')](function(){return 0x1;});});}}}};Dialer[_0x20fd('0x85')][_0x20fd('0x38')]=function(_0x40cc25){if(this[_0x20fd('0x23')][_0x40cc25[_0x20fd('0xbe')]]){this['actions'][_0x40cc25[_0x20fd('0xbe')]][_0x20fd('0xef')]=_0x40cc25[_0x20fd('0xef')];}if(this[_0x20fd('0x25')][_0x40cc25['uniqueid']]){this[_0x20fd('0x25')][_0x40cc25['uniqueid']][_0x20fd('0xef')]=_0x40cc25[_0x20fd('0xef')];}};Dialer[_0x20fd('0x85')]['syncQueueMember']=function(_0x401965){if(!this[_0x20fd('0x23')][_0x401965[_0x20fd('0xf0')]]){return;}var _0x363e24=this['voiceQueues'][this['actions'][_0x401965[_0x20fd('0xf0')]]['queue']][_0x20fd('0xf1')]||_0x20fd('0xf2');if(_0x363e24===_0x20fd('0xf3')){if(this[_0x20fd('0x23')][_0x401965[_0x20fd('0xf0')]]&&_['isNil'](this['actions'][_0x401965[_0x20fd('0xf0')]][_0x20fd('0xf4')])&&_0x401965[_0x20fd('0x82')]==='1'&&_0x401965['paused']==='0'){if(this[_0x20fd('0x1f')][_0x401965[_0x20fd('0xf5')]]){if(!this[_0x20fd('0x1f')][_0x401965['stateinterface']][_0x20fd('0xf4')]){this[_0x20fd('0x1f')][_0x401965[_0x20fd('0xf5')]][_0x20fd('0xf4')]=!![];this[_0x20fd('0x23')][_0x401965[_0x20fd('0xf0')]][_0x20fd('0xf4')]=!![];this['actions'][_0x401965[_0x20fd('0xf0')]][_0x20fd('0xf5')]=_0x401965[_0x20fd('0xf5')];}}}}else if(_0x363e24===_0x20fd('0xf2')){if(this[_0x20fd('0x23')][_0x401965[_0x20fd('0xf0')]]){if(this[_0x20fd('0x1f')][_0x401965['stateinterface']]){this[_0x20fd('0x23')][_0x401965[_0x20fd('0xf0')]][_0x20fd('0xf5')]=_0x401965[_0x20fd('0xf5')];if(_['isNil'](this[_0x20fd('0x2a')][this[_0x20fd('0x23')][_0x401965['actionid']]['queue']])){this['queueBooked'][this['actions'][_0x401965[_0x20fd('0xf0')]][_0x20fd('0xbd')]]=[];}this[_0x20fd('0x2a')][this[_0x20fd('0x23')][_0x401965['actionid']]['queue']][_0x20fd('0x9d')](_['merge'](_[_0x20fd('0xf6')](this[_0x20fd('0x23')][_0x401965[_0x20fd('0xf0')]],[_0x20fd('0xf7'),'stateinterface']),{'status':_0x401965[_0x20fd('0x82')],'paused':_0x401965[_0x20fd('0xf8')]}));}}}};Dialer[_0x20fd('0x85')][_0x20fd('0x3b')]=function(_0x430421){if(!this[_0x20fd('0x23')][_0x430421[_0x20fd('0xf0')]]){return;}var _0x3a31ce=this;var _0x12feaf=this['voiceQueues'][this[_0x20fd('0x23')][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xbd')]];var _0x404cbc=_0x12feaf['strategy']||_0x20fd('0xf2');if(_0x404cbc===_0x20fd('0xf3')){if(this[_0x20fd('0x23')][_0x430421['actionid']]&&this[_0x20fd('0x23')][_0x430421['actionid']][_0x20fd('0xf5')]){this['preview'][_0x20fd('0xf9')](this[_0x20fd('0x23')][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xf7')],this[_0x20fd('0x23')][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xf5')])['catch'](function(_0x211c7f){logger[_0x20fd('0x61')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x20fd('0x41')](_0x211c7f,{'showHidden':![],'depth':null}));})['finally'](function(){_0x3a31ce['updateOriginated'](_0x3a31ce[_0x20fd('0x1d')][_0x3a31ce[_0x20fd('0x23')][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xbd')]]);_0x3a31ce[_0x20fd('0x1f')][_0x3a31ce[_0x20fd('0x23')][_0x430421[_0x20fd('0xf0')]]['stateinterface']]['locked']=![];delete _0x3a31ce[_0x20fd('0x23')][_0x430421['actionid']];unlockQueueStatus(_0x12feaf);});}else{this[_0x20fd('0xc1')](this[_0x20fd('0x1d')][this[_0x20fd('0x23')][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xbd')]]);hopperUtils[_0x20fd('0xe9')]({'active':![],'ContactId':this[_0x20fd('0x23')][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xeb')],'ListId':this['actions'][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xde')],'VoiceQueueId':this['actions'][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xdf')]||undefined,'CampaignId':this[_0x20fd('0x23')][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xec')]||undefined})['catch'](loggerCatch(_0x20fd('0xfa')));delete this['actions'][_0x430421['actionid']];unlockQueueStatus(_0x12feaf);}}else if(_0x404cbc===_0x20fd('0xf2')){var _0x20f0f6;if(this['actions'][_0x430421[_0x20fd('0xf0')]]&&!_[_0x20fd('0xfb')](this[_0x20fd('0x2a')][this['actions'][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xbd')]])){if(this['queueBookedRR'][_0x3a31ce[_0x20fd('0x23')][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xbd')]]){this[_0x20fd('0xfc')][_0x3a31ce[_0x20fd('0x23')][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xbd')]]=this[_0x20fd('0xfc')][this['actions'][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xbd')]]?this[_0x20fd('0xfc')][this[_0x20fd('0x23')][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xbd')]]:this['queueBooked'][this[_0x20fd('0x23')][_0x430421['actionid']][_0x20fd('0xbd')]]?this['queueBooked'][this['actions'][_0x430421['actionid']][_0x20fd('0xbd')]][_0x20fd('0xfd')]||0x0:0x0;}this[_0x20fd('0x2a')][this[_0x20fd('0x23')][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xbd')]][_0x20fd('0xfd')]=this['queueBookedRR'][this[_0x20fd('0x23')][_0x430421[_0x20fd('0xf0')]][_0x20fd('0xbd')]];for(var _0x48f634=0x0;_0x48f634=_0x1256e2['dialGlobalMaxRetry']){_0x48c6a3['stateGlobal'](_0x5a6393,_0x352a3b,_0x4631da,_0x20fd('0x128'));}else{if(_0x5a6393[_0x20fd('0x122')]>=_0x1256e2[_0x20fd('0x129')]){_0x48c6a3[_0x20fd('0x12a')](_0x5a6393,_0x352a3b,_0x4631da,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x5a6393[_0x20fd('0x122')],'scheduledat':moment()[_0x20fd('0xdc')](_0x1256e2['dialMachineRetryFrequency'],_0x20fd('0xdd'))[_0x20fd('0x42')](_0x20fd('0xc2')),'ContactId':_0x5a6393[_0x20fd('0xeb')],'ListId':_0x5a6393[_0x20fd('0xde')],'VoiceQueueId':_0x5a6393[_0x20fd('0xdf')]||undefined,'CampaignId':_0x5a6393[_0x20fd('0xec')]||undefined})[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x12b')));_0x352a3b({'reschedule':0x1});}}});}if(_0xf6c971[_0x20fd('0xbf')]===_0x20fd('0xc0')&&this[_0x20fd('0x1e')][_0xf6c971['queue']]['dialAMDActive']&&_0x45b160[_0x20fd('0x115')]==='HANGUP'){delete this[_0x20fd('0x25')][_0x45b160['uniqueid']];this[_0x20fd('0xc1')](this['campaigns'][_0xf6c971[_0x20fd('0xbd')]]);_0x1fbfb8=new Hangup(_0xf6c971,_0x45b160);_0x1fbfb8[_0x20fd('0xcf')]=0x12;_0x1fbfb8[_0x20fd('0xd0')]='HangupInAMD';_0x1fbfb8[_0x20fd('0x119')]='AMD';ami[_0x20fd('0x3e')](_0x20fd('0x11b'),ut[_0x20fd('0x11c')](_0x1fbfb8,_0x20fd('0x11d')));this[_0x20fd('0x11e')](_0x1fbfb8,_0x20fd('0x12c'),_0x20fd('0x12d'));}if(_0xf6c971[_0x20fd('0xbf')]===_0x20fd('0xc0')&&this['campaigns'][_0xf6c971[_0x20fd('0xbd')]][_0x20fd('0x114')]&&_0x45b160[_0x20fd('0x115')]==='MACHINE'){return new Promise(function(_0x4a600d,_0x3ed979){delete _0x48c6a3[_0x20fd('0x25')][_0x45b160['uniqueid']];_0x48c6a3[_0x20fd('0xc1')](_0x48c6a3[_0x20fd('0x1e')][_0xf6c971[_0x20fd('0xbd')]]);_0x48c6a3[_0x20fd('0x1e')][_0xf6c971[_0x20fd('0xbd')]][_0x20fd('0xc3')]+=0x1;_0x48c6a3[_0x20fd('0x1e')][_0xf6c971['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x409899=_0x48c6a3['campaigns'][_0xf6c971[_0x20fd('0xbd')]];var _0x2afe0e=new Hangup(_0xf6c971,_0x45b160);_0x2afe0e[_0x20fd('0xcf')]=0x13;_0x2afe0e[_0x20fd('0xd0')]=_0x20fd('0x121');_0x2afe0e[_0x20fd('0x119')]=_0x20fd('0x11a');_0x2afe0e[_0x20fd('0x122')]+=0x1;_0x2afe0e['countglobal']+=0x1;_0x2afe0e[_0x20fd('0x11d')]=!![];ami[_0x20fd('0x3e')](_0x20fd('0x11b'),ut[_0x20fd('0x11c')](_0x2afe0e,_0x20fd('0x11d')));hopperUtils[_0x20fd('0xed')](_0x2afe0e)[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x123')));if(_0x2afe0e['countbusyretry']+_0x2afe0e['countcongestionretry']+_0x2afe0e['countnoanswerretry']+_0x2afe0e[_0x20fd('0x126')]+_0x2afe0e[_0x20fd('0xd4')]+_0x2afe0e[_0x20fd('0xe7')]+_0x2afe0e[_0x20fd('0x122')]+_0x2afe0e[_0x20fd('0x127')]>=_0x409899[_0x20fd('0x12e')]){_0x48c6a3[_0x20fd('0x12f')](_0x2afe0e,_0x4a600d,_0x3ed979,_0x20fd('0x128'));}else{if(_0x2afe0e[_0x20fd('0x122')]>=_0x409899[_0x20fd('0x129')]){_0x48c6a3[_0x20fd('0x12a')](_0x2afe0e,_0x4a600d,_0x3ed979,_0x20fd('0x130'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x2afe0e[_0x20fd('0x122')],'scheduledat':moment()[_0x20fd('0xdc')](_0x409899[_0x20fd('0x131')],_0x20fd('0xdd'))[_0x20fd('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2afe0e[_0x20fd('0xeb')],'ListId':_0x2afe0e['ListId'],'VoiceQueueId':_0x2afe0e[_0x20fd('0xdf')]||undefined,'CampaignId':_0x2afe0e[_0x20fd('0xec')]||undefined})[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x12b')));_0x4a600d({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x20fd('0x37')]=function(_0x31d62b){var _0x440fdd=this['uniqueId'][_0x31d62b[_0x20fd('0xbe')]];var _0x233409;if(_0x440fdd&&_0x440fdd[_0x20fd('0xbf')]===_0x20fd('0xc0')){delete this['uniqueId'][_0x31d62b[_0x20fd('0xbe')]];this['updateOriginated'](this[_0x20fd('0x1e')][_0x440fdd['queue']]);this[_0x20fd('0x1e')][_0x440fdd[_0x20fd('0xbd')]][_0x20fd('0x132')]+=0x1;_0x233409=new Hangup(_0x440fdd,_0x31d62b);hopperUtils[_0x20fd('0xed')](_0x233409)[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x133')));hopperUtils['moveContactManagedDialer'](_0x233409)[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x134')));}if(_0x440fdd&&_0x440fdd[_0x20fd('0xbf')]!==_0x20fd('0xc0')&&isNotNull(this[_0x20fd('0x1d')][_0x440fdd[_0x20fd('0xbd')]][_0x20fd('0x135')])){delete this[_0x20fd('0x25')][_0x31d62b['uniqueid']];this['updateOriginated'](this[_0x20fd('0x1d')][_0x440fdd[_0x20fd('0xbd')]]);this['voiceQueues'][_0x440fdd['queue']]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x440fdd[_0x20fd('0xbd')]][_0x20fd('0x117')]+=0x1;_0x233409=new Hangup(_0x440fdd,_0x31d62b);_0x233409[_0x20fd('0xcf')]=0x10;_0x233409[_0x20fd('0xd0')]=_0x20fd('0x136');_0x233409['membername']='AGI';hopperUtils[_0x20fd('0xed')](_0x233409)['catch'](loggerCatch(_0x20fd('0x133')));hopperUtils[_0x20fd('0xc8')](_0x233409)[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x134')));}if(_0x440fdd&&_0x440fdd[_0x20fd('0xbf')]!==_0x20fd('0xc0')&&!isNotNull(this[_0x20fd('0x1d')][_0x440fdd[_0x20fd('0xbd')]]['dialQueueProject'])){delete this[_0x20fd('0x25')][_0x31d62b[_0x20fd('0xbe')]];this['updateOriginated'](this[_0x20fd('0x1d')][_0x440fdd[_0x20fd('0xbd')]]);this[_0x20fd('0x1d')][_0x440fdd[_0x20fd('0xbd')]]['outboundUnknownCallsDay']+=0x1;_0x233409=new Hangup(_0x440fdd,_0x31d62b);_0x233409['state']=0xc;_0x233409[_0x20fd('0xd0')]=_0x31d62b[_0x20fd('0x137')];_0x233409[_0x20fd('0x119')]=_0x20fd('0x138');hopperUtils[_0x20fd('0xed')](_0x233409)[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x133')));hopperUtils[_0x20fd('0xc8')](_0x233409)['catch'](loggerCatch(_0x20fd('0x134')));}};Dialer[_0x20fd('0x85')][_0x20fd('0x33')]=function(_0x4bb240){var _0x200fa2=this;if(!_0x200fa2[_0x20fd('0x2b')][_0x4bb240[_0x20fd('0x44')]]){_0x200fa2['queuesSummary'][_0x4bb240['name']]={'running':![]};}else if(_0x200fa2['queuesSummary'][_0x4bb240['name']][_0x20fd('0x139')]===!![]){return;}else if(_0x200fa2['queuesSummary'][_0x4bb240[_0x20fd('0x44')]][_0x20fd('0x139')]===![]){_0x200fa2['queuesSummary'][_0x4bb240[_0x20fd('0x44')]][_0x20fd('0x139')]=!![];}var _0x5a2514=_0x200fa2[_0x20fd('0x1d')][_0x4bb240['name']];var _0x29fa07=_0x5a2514['message']!==utils['CAMPAIGN_STATUS'][_0x20fd('0x74')];var _0x166b76=utils[_0x20fd('0x13a')](_0x5a2514);_0x5a2514['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x5a2514,_0x200fa2[_0x20fd('0x20')]);Promise[_0x20fd('0x13b')]()[_0x20fd('0x99')](function(){if(_0x5a2514['statusMessage']===utils[_0x20fd('0x66')][_0x20fd('0x74')]){if(_0x29fa07){clearPredictiveAttributes(_0x5a2514);_0x4bb240[_0x20fd('0x27')]=undefined;_0x4bb240['startProgressive']=undefined;}if(_0x5a2514[_0x20fd('0x13c')]===utils[_0x20fd('0x66')][_0x20fd('0x74')]){_0x4bb240[_0x20fd('0x13d')]=0x0;_0x4bb240[_0x20fd('0xf8')]=0x0;_0x4bb240[_0x20fd('0x13e')]=0x0;_0x4bb240[_0x20fd('0x13f')]=0x0;_0x4bb240[_0x20fd('0x140')]=0x0;}}else if(_0x5a2514[_0x20fd('0x13c')]===utils['CAMPAIGN_STATUS'][_0x20fd('0x141')]&&!_0x166b76){return _0x200fa2[_0x20fd('0x8e')](_0x5a2514,!![])[_0x20fd('0x99')](function(){return _0x200fa2['ifTime'](_0x5a2514,![]);})[_0x20fd('0x99')](function(){return _0x200fa2['checkDialMethod'](_0x5a2514);})[_0x20fd('0x9c')](function(_0x10f978){loggerSyncQueueSummary[_0x20fd('0x3f')](_0x20fd('0x142'),util['inspect'](_0x10f978,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5a2514);});}else{clearPredictiveAttributes(_0x5a2514);}})[_0x20fd('0x99')](function(){var _0xdac653=_0x4bb240[_0x20fd('0x143')](_0x5a2514);if(_0xdac653||_0x5a2514[_0x20fd('0x144')]){_0x5a2514[_0x20fd('0x144')]=![];_0x4bb240[_0x20fd('0x145')](_0x5a2514);Object[_0x20fd('0x146')](_0x5a2514,_0x4bb240);emitOutboundVoiceQueueSummary(_0x4bb240);}_0x200fa2[_0x20fd('0x2b')][_0x5a2514[_0x20fd('0x44')]]['running']=![];})[_0x20fd('0x9c')](function(_0x5c8ab1){logger[_0x20fd('0x61')]('[syncQueueSummary]',util[_0x20fd('0x41')](_0x5c8ab1,{'showHidden':![],'depth':null}));_0x200fa2[_0x20fd('0x2b')][_0x5a2514['name']][_0x20fd('0x139')]=![];});};Dialer[_0x20fd('0x85')][_0x20fd('0x35')]=_['throttle'](function(){var _0x2e6e6d=_[_0x20fd('0x147')](this['voiceQueues'],function(_0x1fbb51){return _0x1fbb51[_0x20fd('0x148')];});var _0x4f30b0=_[_0x20fd('0x147')](this[_0x20fd('0x1f')],function(_0x11b64a){return _0x11b64a['online']&&_0x11b64a[_0x20fd('0x82')]===_0x20fd('0x83');});if(_0x2e6e6d[_0x20fd('0x95')]>0x0&&_0x4f30b0[_0x20fd('0x95')]>0x0){return Promise['resolve']()[_0x20fd('0x99')](cmHopper[_0x20fd('0x149')](_[_0x20fd('0x14a')](_0x2e6e6d,'id'),previewRecallmeReminderInterval,_[_0x20fd('0x14a')](_0x4f30b0,'id')))[_0x20fd('0x99')](function(_0x3124f1){for(var _0x51f832=0x0;_0x51f832<_0x3124f1[_0x20fd('0x95')];_0x51f832++){var _0x2c320c=_0x3124f1[_0x51f832][_0x20fd('0x14b')][_0x20fd('0x44')];if(_0x2c320c)io['to'](util[_0x20fd('0x42')]('user:%s',_0x2c320c))[_0x20fd('0x3e')]('user:dialPreviewRecallReminder',{'hopper':_0x3124f1[_0x51f832]});}})[_0x20fd('0x9c')](function(_0x5eb2a0){logger['error'](_0x20fd('0x14c'),_0x5eb2a0);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x20fd('0x85')][_0x20fd('0x3c')]=function(){var _0x2d7768=this;setInterval(function(){_0x2d7768[_0x20fd('0x14d')](_0x2d7768[_0x20fd('0x25')],_0x20fd('0x14e'));_0x2d7768['clearZombieChannels'](_0x2d7768[_0x20fd('0x23')],_0x20fd('0x14f'));},0x32c8);};Dialer[_0x20fd('0x85')][_0x20fd('0x14d')]=function(_0x5e9e94,_0x4ab681){var _0x5503f0=this;for(var _0xb6c2a5 in _0x5e9e94){if(typeof _0x5e9e94[_0xb6c2a5]!==_0x20fd('0xa8')){this[_0x20fd('0x1b')][_0x20fd('0x150')](function(){if(!_['isNil'](_0x5e9e94[_0xb6c2a5])){return ami['Action']({'action':_0x20fd('0x82'),'channel':_0x5e9e94[_0xb6c2a5]['channel']})[_0x20fd('0x9c')](function(_0x1ee84a){if(_0x1ee84a[_0x20fd('0x65')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5e9e94[_0xb6c2a5]&&_0x5e9e94[_0xb6c2a5][_0x20fd('0xbf')]!==_0x20fd('0xc0')){_0x5503f0[_0x20fd('0xc1')](_0x5503f0[_0x20fd('0x1d')][_0x5e9e94[_0xb6c2a5][_0x20fd('0xbd')]]);logger[_0x20fd('0x61')](_0x20fd('0x151'),_0x4ab681,_0xb6c2a5,_0x5e9e94[_0xb6c2a5]['queue']);delete _0x5e9e94[_0xb6c2a5];}if(_0x5e9e94[_0xb6c2a5]&&_0x5e9e94[_0xb6c2a5][_0x20fd('0xbf')]===_0x20fd('0xc0')){_0x5503f0[_0x20fd('0xc1')](_0x5503f0[_0x20fd('0x1e')][_0x5e9e94[_0xb6c2a5][_0x20fd('0xbd')]]);logger[_0x20fd('0x61')](_0x20fd('0x152'),_0x4ab681,_0xb6c2a5,_0x5e9e94[_0xb6c2a5][_0x20fd('0xbd')]);delete _0x5e9e94[_0xb6c2a5];}},0x2328);}});}});}}};Dialer[_0x20fd('0x85')][_0x20fd('0x153')]=function(_0x465e29){return Promise[_0x20fd('0x13b')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x465e29))[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x154')));};Dialer['prototype'][_0x20fd('0xc1')]=function(_0x39604a){if(!_[_0x20fd('0x3d')](_0x39604a)&&_0x39604a!==null){if(typeof _0x39604a[_0x20fd('0x79')]!==_0x20fd('0xa8')){if(_0x39604a['originated']>0x0){_0x39604a[_0x20fd('0x79')]-=0x1;}else{logger[_0x20fd('0x61')](_0x20fd('0x155'));}}}else{logger['error'](_0x20fd('0x156'));}};Dialer[_0x20fd('0x85')][_0x20fd('0x157')]=function(_0x5c7de2,_0x3ca807){var _0x46a064=this;return function(_0x4e2058){_0x46a064[_0x20fd('0xc1')](_0x3ca807);logger[_0x20fd('0x61')](_0x5c7de2,util['inspect'](_0x4e2058,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x25a814,_0x589555,_0x491e4f){var _0x52df14={'state':0x19,'statedesc':_0x20fd('0x158')};this[_0x20fd('0xc1')](_0x589555);this[_0x20fd('0x11e')](_['merge'](_0x52df14,_['pick'](_0x491e4f,[_0x20fd('0xeb'),_0x20fd('0xde'),_0x20fd('0x159'),_0x20fd('0xdf'),'CampaignId'])),_0x20fd('0x15a'),_0x20fd('0x15b'));logger[_0x20fd('0x61')](_0x25a814);};Dialer[_0x20fd('0x85')][_0x20fd('0x11e')]=function(_0x40bb7c,_0x17bc13,_0x6fdf27){hopperUtils[_0x20fd('0xed')](_0x40bb7c)[_0x20fd('0x9c')](loggerCatch(_0x17bc13));hopperUtils['moveContactManagedDialer'](_0x40bb7c)[_0x20fd('0x9c')](loggerCatch(_0x6fdf27));};Dialer[_0x20fd('0x85')][_0x20fd('0xdb')]=function(_0x2d92b6,_0x502f68){hopperUtils[_0x20fd('0xed')](_0x2d92b6)[_0x20fd('0x9c')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x502f68==0x0){hopperUtils[_0x20fd('0xc8')](_0x2d92b6)[_0x20fd('0x9c')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x20fd('0x85')][_0x20fd('0x14c')]=function(_0x5e8a07){return Promise[_0x20fd('0x13b')]()['then'](cmHopper[_0x20fd('0x149')](_0x5e8a07['id'],previewRecallmeReminderInterval))['then'](function(_0x7f5da9){for(var _0x426252=0x0;_0x426252<_0x7f5da9[_0x20fd('0x95')];_0x426252++){var _0x416e48=_0x7f5da9[_0x426252][_0x20fd('0x14b')][_0x20fd('0x44')];if(_0x416e48)io['to'](util[_0x20fd('0x42')](_0x20fd('0x15c'),_0x416e48))[_0x20fd('0x3e')](_0x20fd('0x15d'),{'hopper':_0x7f5da9[_0x426252]});}})[_0x20fd('0x9c')](function(){});};Dialer[_0x20fd('0x85')][_0x20fd('0x15e')]=function(_0x48582b){var _0x27836b=this;return function(){_0x27836b[_0x20fd('0x15f')](_0x48582b);};};Dialer[_0x20fd('0x85')][_0x20fd('0x160')]=function(_0x37e5f4,_0x3707d5){var _0x149e3f=this;var _0x3e2f1b=uuid['v4']();this[_0x20fd('0x23')][_0x3e2f1b]=new Action(_0x37e5f4,_0x3707d5,_0x3e2f1b);return new Promise(function(_0x78f1dd,_0x4e564d){if(_['isUndefined'](_0x37e5f4)&&typeof _0x37e5f4!=='object'){return _0x4e564d(msgResponse(_0x20fd('0x161'),_0x20fd('0x8f'),_0x20fd('0x162')));}if(_[_0x20fd('0x3d')](_0x3707d5['phone'])||_0x3707d5[_0x20fd('0x163')]===null){return _0x4e564d(msgResponse(_0x20fd('0x161'),'Failure',_0x20fd('0x164')));}var _0x28ba79={'XMD-CALLERID':_0x149e3f[_0x20fd('0x23')][_0x3e2f1b]['getCaller'](),'XMD-AGI':_0x37e5f4[_0x20fd('0x135')]?util[_0x20fd('0x42')]('\x22agi://%s/square,%s\x22',ipAgi,_0x37e5f4['dialQueueProject']):_0x20fd('0x165'),'XMD-AGIAFTER':_0x37e5f4[_0x20fd('0xc6')]?util[_0x20fd('0x42')](_0x20fd('0x166'),ipAgi,_0x37e5f4[_0x20fd('0xc6')]):_0x20fd('0x165'),'XMD-QUEUE':utils[_0x20fd('0x167')](_0x37e5f4)?util[_0x20fd('0x42')](_0x20fd('0x168'),_0x37e5f4[_0x20fd('0x44')],_0x37e5f4[_0x20fd('0x169')]||'',_0x37e5f4[_0x20fd('0x16a')]?'c':'',_0x37e5f4['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x3707d5['ContactId'],'XMD-CDRTYPE':_0x20fd('0x8'),'CALLERID(all)':_0x149e3f[_0x20fd('0x23')][_0x3e2f1b][_0x20fd('0x16b')](),'XMD-AMD':_0x37e5f4[_0x20fd('0x114')]?_0x20fd('0x141'):_0x20fd('0x165'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x37e5f4[_0x20fd('0x114')]){_0x28ba79[_0x20fd('0x16c')]=_0x37e5f4['dialAMDInitialSilence']||0x9c4;_0x28ba79['XMD-AMDGREETING']=_0x37e5f4[_0x20fd('0x16d')]||0x5dc;_0x28ba79[_0x20fd('0x16e')]=_0x37e5f4[_0x20fd('0x16f')]||0x320;_0x28ba79[_0x20fd('0x170')]=_0x37e5f4[_0x20fd('0x171')]||0x1388;_0x28ba79[_0x20fd('0x172')]=_0x37e5f4[_0x20fd('0x173')]||0x64;_0x28ba79[_0x20fd('0x174')]=_0x37e5f4[_0x20fd('0x175')]||0x32;_0x28ba79[_0x20fd('0x176')]=_0x37e5f4['dialAMDMaximumNumberOfWords']||0x3;_0x28ba79[_0x20fd('0x177')]=_0x37e5f4[_0x20fd('0x178')]||0x100;_0x28ba79[_0x20fd('0x179')]=_0x37e5f4[_0x20fd('0x17a')]||0x1388;}if(utils[_0x20fd('0x167')](_0x37e5f4)){_0x28ba79[_0x20fd('0x17b')]=_0x3707d5[_0x20fd('0xdf')];}else{_0x28ba79[_0x20fd('0x17c')]=_0x3707d5['CampaignId'];}var _0x5e183f=utils[_0x20fd('0x17d')](_0x3707d5[_0x20fd('0x17e')]);Object[_0x20fd('0x146')](_0x28ba79,_0x5e183f);var _0x5a29f0=_0x149e3f[_0x20fd('0x87')](_0x37e5f4[_0x20fd('0x88')])?utils[_0x20fd('0x17f')](_0x37e5f4['Trunk'][_0x20fd('0x180')],_0x37e5f4[_0x20fd('0x181')],_0x37e5f4[_0x20fd('0x182')]>0x0?utils[_0x20fd('0x183')](_0x37e5f4[_0x20fd('0x184')],_0x37e5f4['dialRandomLastDigitCallerIdNumber']):_0x37e5f4['dialOriginateCallerIdNumber']):utils['getCallerId'](_[_0x20fd('0xfe')](_0x37e5f4[_0x20fd('0x89')])?_0x37e5f4['Trunk'][_0x20fd('0x180')]:_0x37e5f4['TrunkBackup']['callerid'],_0x37e5f4[_0x20fd('0x181')],_0x37e5f4[_0x20fd('0x182')]>0x0?utils['getCallerIdRandom'](_0x37e5f4[_0x20fd('0x184')],_0x37e5f4[_0x20fd('0x182')]):_0x37e5f4[_0x20fd('0x184')]);if(_0x5a29f0){_0x28ba79[_0x20fd('0x185')]=_0x149e3f['actions'][_0x3e2f1b][_0x20fd('0x186')]=utils[_0x20fd('0x187')](_0x5a29f0);_0x28ba79[_0x20fd('0x188')]=_0x3707d5['phone'];}_0x37e5f4[_0x20fd('0x189')]=_0x28ba79;return ami[_0x20fd('0x96')]({'actionid':_0x3e2f1b,'action':_0x20fd('0x161'),'channel':_0x149e3f[_0x20fd('0x87')](_0x37e5f4[_0x20fd('0x88')])?util['format'](_0x20fd('0x18a'),_0x37e5f4['Trunk']['name'],isNotNull(_0x37e5f4[_0x20fd('0x18b')])?_0x37e5f4[_0x20fd('0x18b')][_0x20fd('0x18c')]()||'':'',_0x37e5f4[_0x20fd('0x18d')]>0x0?_0x3707d5['phone'][_0x20fd('0x18e')](_0x37e5f4[_0x20fd('0x18d')]):_0x3707d5[_0x20fd('0x163')]):util[_0x20fd('0x42')]('SIP/%s/%s%s',_[_0x20fd('0xfe')](_0x37e5f4[_0x20fd('0x89')])?_0x37e5f4[_0x20fd('0x88')][_0x20fd('0x44')]:_0x37e5f4[_0x20fd('0x89')][_0x20fd('0x44')],isNotNull(_0x37e5f4[_0x20fd('0x18b')])?_0x37e5f4['dialPrefix'][_0x20fd('0x18c')]()||'':'',_0x37e5f4[_0x20fd('0x18d')]>0x0?_0x3707d5[_0x20fd('0x163')][_0x20fd('0x18e')](_0x37e5f4[_0x20fd('0x18d')]):_0x3707d5[_0x20fd('0x163')]),'callerid':_0x5a29f0,'Exten':_0x20fd('0x113'),'Context':_0x20fd('0x18f'),'Priority':'1','variable':_0x28ba79,'timeout':(_0x37e5f4[_0x20fd('0x190')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3e2f1b})[_0x20fd('0x99')](function(_0x3af4e3){return _0x78f1dd(_0x3af4e3);})[_0x20fd('0x9c')](function(_0x360312){_0x37e5f4[_0x20fd('0x191')]+=0x1;var _0x3642d9=new History(_0x149e3f[_0x20fd('0x23')][_0x3e2f1b]);logger[_0x20fd('0x61')](util[_0x20fd('0x42')](_0x20fd('0x192'),JSON[_0x20fd('0x6f')](_0x360312)));_0x3642d9[_0x20fd('0xcf')]=0xe;_0x3642d9[_0x20fd('0xd0')]=_0x20fd('0x193');_0x3642d9[_0x20fd('0x6b')]=moment()[_0x20fd('0x42')](_0x20fd('0xc2'));_0x3642d9['endtime']=_0x3642d9['starttime'];hopperUtils['createHistory'](_0x3642d9)['catch'](loggerCatch(_0x20fd('0x194')));_0x149e3f['moveContactManagedDialer'](_0x3642d9)['catch'](loggerCatch('[originate][error]'))[_0x20fd('0x104')](function(){delete _0x149e3f[_0x20fd('0x23')][_0x3e2f1b];return _0x4e564d(msgResponse(_0x20fd('0x161'),_0x20fd('0x7f'),_0x20fd('0x195')));});});});};Dialer['prototype'][_0x20fd('0x196')]=function(_0x5ea1cc,_0x24a861,_0x3db953){var _0x5899a4=new History(_0x24a861);if(_0x5899a4['countbusyretry']+_0x5899a4[_0x20fd('0x197')]+_0x5899a4[_0x20fd('0x125')]+_0x5899a4[_0x20fd('0x126')]+_0x5899a4['countdropretry']+_0x5899a4[_0x20fd('0xe7')]+_0x5899a4[_0x20fd('0x122')]+_0x5899a4[_0x20fd('0x127')]>=_0x3db953[_0x20fd('0x12e')]-0x1){return!![];}switch(_0x5ea1cc){case 0x3:if(_0x5899a4[_0x20fd('0x125')]>=_0x3db953['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x20fd('0xe9')]({'active':![],'countnoanswerretry':_0x5899a4[_0x20fd('0x125')]+=0x1,'scheduledat':moment()[_0x20fd('0xdc')](_0x3db953[_0x20fd('0x198')],'minutes')[_0x20fd('0x42')](_0x20fd('0xc2')),'ContactId':_0x5899a4[_0x20fd('0xeb')],'ListId':_0x5899a4[_0x20fd('0xde')],'VoiceQueueId':_0x5899a4[_0x20fd('0xdf')]||undefined,'CampaignId':_0x5899a4[_0x20fd('0xec')]||undefined})[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x199')));break;case 0x5:if(_0x5899a4[_0x20fd('0x124')]>=_0x3db953['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x5899a4['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x3db953[_0x20fd('0x19a')],_0x20fd('0xdd'))[_0x20fd('0x42')](_0x20fd('0xc2')),'ContactId':_0x5899a4[_0x20fd('0xeb')],'ListId':_0x5899a4['ListId'],'VoiceQueueId':_0x5899a4[_0x20fd('0xdf')]||undefined,'CampaignId':_0x5899a4[_0x20fd('0xec')]||undefined})[_0x20fd('0x9c')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x5899a4[_0x20fd('0x197')]>=_0x3db953[_0x20fd('0x19b')]-0x1){return!![];}hopperUtils[_0x20fd('0xe9')]({'active':![],'countcongestionretry':_0x5899a4[_0x20fd('0x197')]+=0x1,'scheduledat':moment()[_0x20fd('0xdc')](_0x3db953['dialCongestionRetryFrequency'],'minutes')['format'](_0x20fd('0xc2')),'ContactId':_0x5899a4[_0x20fd('0xeb')],'ListId':_0x5899a4[_0x20fd('0xde')],'VoiceQueueId':_0x5899a4['VoiceQueueId']||undefined,'CampaignId':_0x5899a4['CampaignId']||undefined})[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x19c')));break;case 0x0:if(_0x5899a4[_0x20fd('0x126')]>=_0x3db953[_0x20fd('0x19d')]-0x1){return!![];}else{hopperUtils[_0x20fd('0xe9')]({'active':![],'countnosuchnumberretry':_0x5899a4['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x20fd('0xdc')](_0x3db953['dialNoSuchNumberRetryFrequency'],_0x20fd('0xdd'))[_0x20fd('0x42')](_0x20fd('0xc2')),'ContactId':_0x5899a4[_0x20fd('0xeb')],'ListId':_0x5899a4[_0x20fd('0xde')],'VoiceQueueId':_0x5899a4['VoiceQueueId']||undefined,'CampaignId':_0x5899a4[_0x20fd('0xec')]||undefined})['catch'](loggerCatch(_0x20fd('0x19e')));}break;case 0xa:if(_0x5899a4[_0x20fd('0xd4')]>=_0x3db953[_0x20fd('0xda')]-0x1){return!![];}hopperUtils[_0x20fd('0xe9')]({'active':![],'countdropretry':_0x5899a4[_0x20fd('0xd4')]+=0x1,'scheduledat':moment()['add'](_0x3db953[_0x20fd('0xd6')],'minutes')['format'](_0x20fd('0xc2')),'ContactId':_0x5899a4[_0x20fd('0xeb')],'ListId':_0x5899a4[_0x20fd('0xde')],'VoiceQueueId':_0x5899a4['VoiceQueueId']||undefined,'CampaignId':_0x5899a4[_0x20fd('0xec')]||undefined})[_0x20fd('0x9c')](loggerCatch(_0x20fd('0xe0')));break;case 0xb:if(_0x5899a4[_0x20fd('0xe7')]>=_0x3db953[_0x20fd('0x19f')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x5899a4[_0x20fd('0xe7')]+=0x1,'scheduledat':moment()['add'](_0x3db953[_0x20fd('0xea')],_0x20fd('0xdd'))[_0x20fd('0x42')](_0x20fd('0xc2')),'ContactId':_0x5899a4[_0x20fd('0xeb')],'ListId':_0x5899a4['ListId'],'VoiceQueueId':_0x5899a4[_0x20fd('0xdf')]||undefined,'CampaignId':_0x5899a4['CampaignId']||undefined})[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x1a0')));break;case 0x13:if(_0x5899a4[_0x20fd('0x122')]>=_0x3db953['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x20fd('0xe9')]({'active':![],'countmachineretry':_0x5899a4[_0x20fd('0x122')]+=0x1,'scheduledat':moment()[_0x20fd('0xdc')](_0x3db953['dialMachineRetryFrequency'],_0x20fd('0xdd'))[_0x20fd('0x42')](_0x20fd('0xc2')),'ContactId':_0x5899a4[_0x20fd('0xeb')],'ListId':_0x5899a4[_0x20fd('0xde')],'VoiceQueueId':_0x5899a4[_0x20fd('0xdf')]||undefined,'CampaignId':_0x5899a4['CampaignId']||undefined})[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x12b')));break;case 0x14:if(_0x5899a4['countagentrejectretry']>=_0x3db953[_0x20fd('0x1a1')]-0x1){return!![];}hopperUtils[_0x20fd('0xe9')]({'active':![],'countagentrejectretry':_0x5899a4[_0x20fd('0x127')]+=0x1,'scheduledat':moment()['add'](_0x3db953[_0x20fd('0x1a2')],'minutes')[_0x20fd('0x42')](_0x20fd('0xc2')),'ContactId':_0x5899a4[_0x20fd('0xeb')],'ListId':_0x5899a4[_0x20fd('0xde')],'VoiceQueueId':_0x5899a4[_0x20fd('0xdf')]||undefined,'CampaignId':_0x5899a4[_0x20fd('0xec')]||undefined})[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x1a3')));break;default:return!![];}};Dialer[_0x20fd('0x85')][_0x20fd('0x10d')]=function(_0x13f8ef,_0x4f1ef7,_0x34ab88){var _0x5a70fb=this;var _0x3ded3a=new History(_0x13f8ef);var _0x53119f=![];var _0x2f6b69;var _0x582e1a;return new Promise(function(_0x5ac260,_0x15634b){if(_[_0x20fd('0x3d')](_0x4f1ef7)&&typeof _0x4f1ef7!=='object'){return _0x15634b(msgResponse(_0x20fd('0x1a4'),_0x20fd('0x8f'),'entity\x20is\x20undefine'));}if(_[_0x20fd('0x3d')](_0x34ab88)&&typeof _0x34ab88!==_0x20fd('0x1a5')){return _0x15634b(msgResponse(_0x20fd('0x1a4'),'Failure','evt\x20is\x20undefine'));}hopperUtils[_0x20fd('0xe8')](_0x3ded3a,_0x34ab88['reason'],_0x4f1ef7)[_0x20fd('0x99')](function(_0x822b66){if(_0x822b66[_0x20fd('0xd9')]==0x1)_0x53119f=!![];switch(_0x34ab88['reason']){case'0':_0x4f1ef7[_0x20fd('0x1a6')]+=0x1;_0x3ded3a[_0x20fd('0xcf')]=0x0;_0x3ded3a[_0x20fd('0xd0')]=_0x20fd('0x1a7');_0x3ded3a[_0x20fd('0x126')]+=0x1;_0x3ded3a[_0x20fd('0xd5')]+=0x1;ami[_0x20fd('0x3e')](_0x20fd('0x1a8'),ut[_0x20fd('0x11c')](_0x13f8ef,_0x20fd('0x1a9')));_0x2f6b69=_0x4f1ef7[_0x20fd('0x1aa')];_0x582e1a=_0x4f1ef7['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x3ded3a)['catch'](loggerCatch(_0x20fd('0x123')));if(_0x5a70fb[_0x20fd('0x196')](0x0,_0x13f8ef,_0x4f1ef7)&&!_0x53119f){if(_0x3ded3a[_0x20fd('0x126')]>=_0x4f1ef7['dialNoSuchNumberMaxRetry']){_0x5a70fb[_0x20fd('0x12a')](_0x3ded3a,_0x5ac260,_0x15634b,_0x20fd('0x1ab'));}else{_0x5a70fb[_0x20fd('0x12f')](_0x3ded3a,_0x5ac260,_0x15634b,_0x20fd('0x1ab'));}}break;case'3':_0x4f1ef7[_0x20fd('0x1ac')]+=0x1;_0x3ded3a['state']=0x3;_0x3ded3a[_0x20fd('0xd0')]=_0x20fd('0x1ad');_0x3ded3a[_0x20fd('0x125')]+=0x1;_0x3ded3a[_0x20fd('0xd5')]+=0x1;var _0x35682a=ut[_0x20fd('0x1ae')](_0x13f8ef,_0x4f1ef7);ami['emit'](_0x20fd('0x1af'),_0x35682a);_0x2f6b69=_0x4f1ef7[_0x20fd('0x198')];_0x582e1a=_0x4f1ef7[_0x20fd('0xd7')];hopperUtils[_0x20fd('0xed')](_0x3ded3a)['catch'](loggerCatch(_0x20fd('0x1b0')));if(_0x5a70fb[_0x20fd('0x196')](0x3,_0x13f8ef,_0x4f1ef7)&&!_0x53119f){if(_0x3ded3a[_0x20fd('0x125')]>=_0x4f1ef7[_0x20fd('0x1b1')]){_0x5a70fb[_0x20fd('0x12a')](_0x3ded3a,_0x5ac260,_0x15634b,_0x20fd('0x1b2'));}else{_0x5a70fb[_0x20fd('0x12f')](_0x3ded3a,_0x5ac260,_0x15634b,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x4f1ef7['outboundBusyCallsDay']+=0x1;_0x3ded3a[_0x20fd('0xcf')]=0x5;_0x3ded3a[_0x20fd('0xd0')]=_0x20fd('0x1b3');_0x3ded3a[_0x20fd('0x124')]+=0x1;_0x3ded3a[_0x20fd('0xd5')]+=0x1;ami[_0x20fd('0x3e')](_0x20fd('0x1b4'),ut[_0x20fd('0x11c')](_0x13f8ef,_0x20fd('0x1b5')));_0x2f6b69=_0x4f1ef7[_0x20fd('0x19a')];_0x582e1a=_0x4f1ef7[_0x20fd('0xd7')];hopperUtils[_0x20fd('0xed')](_0x3ded3a)[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x1b6')));if(_0x5a70fb['checkRetriveMax'](0x5,_0x13f8ef,_0x4f1ef7)&&!_0x53119f){if(_0x3ded3a[_0x20fd('0x124')]>=_0x4f1ef7['dialBusyMaxRetry']){_0x5a70fb[_0x20fd('0x12a')](_0x3ded3a,_0x5ac260,_0x15634b,'reason\x205\x20busy');}else{_0x5a70fb[_0x20fd('0x12f')](_0x3ded3a,_0x5ac260,_0x15634b,'reason\x205\x20busy');}}break;case'8':_0x4f1ef7[_0x20fd('0x1b7')]+=0x1;_0x3ded3a[_0x20fd('0xcf')]=0x8;_0x3ded3a[_0x20fd('0xd0')]='Congestion';_0x3ded3a['countcongestionretry']+=0x1;_0x3ded3a[_0x20fd('0xd5')]+=0x1;_0x2f6b69=_0x4f1ef7[_0x20fd('0x1b8')];_0x582e1a=_0x4f1ef7[_0x20fd('0xd7')];ami[_0x20fd('0x3e')](_0x20fd('0x1b9'),ut['buildObj'](_0x13f8ef,_0x20fd('0x1ba')));hopperUtils[_0x20fd('0xed')](_0x3ded3a)[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x1bb')));if(_0x5a70fb[_0x20fd('0x196')](0x8,_0x13f8ef,_0x4f1ef7)&&!_0x53119f){if(_0x3ded3a[_0x20fd('0x197')]>=_0x4f1ef7[_0x20fd('0x19b')]){_0x5a70fb[_0x20fd('0x12a')](_0x3ded3a,_0x5ac260,_0x15634b,_0x20fd('0x1bc'));}else{_0x5a70fb[_0x20fd('0x12f')](_0x3ded3a,_0x5ac260,_0x15634b,_0x20fd('0x1bc'));}}break;case'11':_0x4f1ef7[_0x20fd('0x1bd')]+=0x1;_0x3ded3a[_0x20fd('0xcf')]=0xb;_0x3ded3a['statedesc']=_0x20fd('0xe5');_0x3ded3a[_0x20fd('0xe7')]+=0x1;_0x3ded3a[_0x20fd('0xd5')]+=0x1;_0x2f6b69=_0x4f1ef7[_0x20fd('0xea')];_0x582e1a=_0x4f1ef7[_0x20fd('0xd7')];hopperUtils[_0x20fd('0xed')](_0x3ded3a)[_0x20fd('0x9c')](loggerCatch(_0x20fd('0xee')));if(_0x5a70fb[_0x20fd('0x196')](0xb,_0x13f8ef,_0x4f1ef7)&&!_0x53119f){if(_0x3ded3a[_0x20fd('0xe7')]>=_0x4f1ef7['dialAbandonedMaxRetry']){_0x5a70fb[_0x20fd('0x12a')](_0x3ded3a,_0x5ac260,_0x15634b,_0x20fd('0x1be'));}else{_0x5a70fb[_0x20fd('0x12f')](_0x3ded3a,_0x5ac260,_0x15634b,'reason\x2011\x20abandoned');}}break;case'20':_0x4f1ef7[_0x20fd('0x1bf')]+=0x1;_0x3ded3a[_0x20fd('0xcf')]=0x14;_0x3ded3a[_0x20fd('0xd0')]=_0x20fd('0x1c0');_0x3ded3a[_0x20fd('0x127')]+=0x1;_0x3ded3a[_0x20fd('0xd5')]+=0x1;_0x2f6b69=_0x4f1ef7['dialAgentRejectRetryFrequency'];_0x582e1a=_0x4f1ef7['callAdditionalPhoneAfterMin'];ami[_0x20fd('0x3e')]('custom:agentreject',ut[_0x20fd('0x11c')](_0x13f8ef,_0x20fd('0x1c1')));hopperUtils[_0x20fd('0xed')](_0x3ded3a)[_0x20fd('0x9c')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x5a70fb[_0x20fd('0x196')](0x14,_0x13f8ef,_0x4f1ef7)&&!_0x53119f){if(_0x3ded3a[_0x20fd('0x127')]>=_0x4f1ef7[_0x20fd('0x1a1')]){_0x5a70fb[_0x20fd('0x12a')](_0x3ded3a,_0x5ac260,_0x15634b,_0x20fd('0x1c2'));}else{_0x5a70fb[_0x20fd('0x12f')](_0x3ded3a,_0x5ac260,_0x15634b,'reason\x2020\x20agentreject');}}break;default:_0x4f1ef7[_0x20fd('0x1c3')]+=0x1;_0x3ded3a[_0x20fd('0xcf')]=0xc;_0x3ded3a[_0x20fd('0xd0')]=_0x34ab88[_0x20fd('0x1c4')];_0x2f6b69=_0x4f1ef7['dialAgentRejectRetryFrequency'];_0x582e1a=_0x4f1ef7['callAdditionalPhoneAfterMin'];hopperUtils[_0x20fd('0xed')](_0x3ded3a)[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x1c5')));if(_0x5a70fb[_0x20fd('0x196')](_0x34ab88[_0x20fd('0x1c4')],_0x13f8ef,_0x4f1ef7)&&!_0x53119f){if(_0x3ded3a[_0x20fd('0x124')]+_0x3ded3a[_0x20fd('0x197')]+_0x3ded3a['countnoanswerretry']+_0x3ded3a[_0x20fd('0x126')]+_0x3ded3a[_0x20fd('0xd4')]+_0x3ded3a[_0x20fd('0xe7')]+_0x3ded3a[_0x20fd('0x122')]+_0x3ded3a[_0x20fd('0x127')]>=_0x4f1ef7[_0x20fd('0x12e')]){_0x5a70fb[_0x20fd('0x12f')](_0x3ded3a,_0x5ac260,_0x15634b,_0x34ab88['reason']);}else{_0x5a70fb[_0x20fd('0x12a')](_0x3ded3a,_0x5ac260,_0x15634b,_0x34ab88[_0x20fd('0x1c4')]);}}}})['then'](function(){if(_0x53119f){hopperUtils[_0x20fd('0xe4')](_0x3ded3a,_0x2f6b69,_0x582e1a)[_0x20fd('0x99')](function(){return _0x5ac260(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x428bbc,_0x2896d5,_0x5ad4a7,_0x25378a){var _0x50162c=new Final(_0x428bbc);_0x50162c[_0x20fd('0xcf')]=0xf;_0x50162c['statedesc']=_0x20fd('0x1c6');this[_0x20fd('0x12a')](_0x50162c,_0x2896d5,_0x5ad4a7,_0x25378a);};Dialer[_0x20fd('0x85')]['createStateFinal']=function(_0x4f107f,_0xe7fc3a,_0x37e239,_0x24b2f1){hopperUtils['moveContactManagedDialer'](_0x4f107f)[_0x20fd('0x99')](function(){return _0xe7fc3a(msgResponse(_0x20fd('0x1a4'),_0x20fd('0x10c'),_0x24b2f1));})['catch'](function(){return _0x37e239(msgResponse('[moveContactManagedDialer][0]','Failure',_0x20fd('0x1c7')));});};Dialer['prototype'][_0x20fd('0xa')]=function(_0x4d2960){var _0x338577=_0x4d2960[_0x20fd('0x1c8')]/0x64;var _0x32adc6=_0x4d2960[_0x20fd('0xcd')]/(_0x4d2960['outboundDropCallsDayTimeout']+_0x4d2960[_0x20fd('0xc3')]);var _0x50a268=Math[_0x20fd('0x1c9')](_0x4d2960[_0x20fd('0x1ca')]*(_0x4d2960[_0x20fd('0x1cb')]/0x64));var _0x1d889c=Math[_0x20fd('0x1c9')](_0x4d2960[_0x20fd('0x1ca')]*(_0x4d2960[_0x20fd('0x1cc')]/0x64));var _0x36ed84=_0x4d2960[_0x20fd('0x13d')]+_0x4d2960['talking'];var _0x21b905=Math[_0x20fd('0x1cd')](_0x4d2960[_0x20fd('0x56')]*_0x4d2960['erlangAbandonmentRate']*_0x4d2960[_0x20fd('0x1ce')]*_0x4d2960[_0x20fd('0x1cf')]);if(_[_0x20fd('0x3d')](_0x4d2960[_0x20fd('0x28')])){if(!_[_0x20fd('0x3d')](_0x4d2960[_0x20fd('0x27')])){_0x4d2960['startPredictive']=undefined;loggerPredictive[_0x20fd('0x61')](_0x20fd('0x1d0'),_0x20fd('0x1d1'));}if(!_['isUndefined'](_0x4d2960[_0x20fd('0x5f')])){loggerPredictive[_0x20fd('0x61')](_0x20fd('0x1d0'),_0x20fd('0x1d2'));clearInterval(_0x4d2960[_0x20fd('0x5f')]);_0x4d2960[_0x20fd('0x5f')]=undefined;}_0x4d2960[_0x20fd('0x28')]=moment()[_0x20fd('0x42')](_0x20fd('0xc2'));loggerPredictive[_0x20fd('0x45')](_0x4d2960[_0x20fd('0x44')],_0x20fd('0x1d3'),_0x4d2960[_0x20fd('0x28')]);this[_0x20fd('0xaf')](_0x4d2960,0x1);}else if(ifInterval(_0x4d2960[_0x20fd('0x1d4')],_0x4d2960['startProgressive'])){this[_0x20fd('0xaf')](_0x4d2960,0x1);loggerPredictiveCalls['info'](_0x20fd('0x1d5'),_0x4d2960[_0x20fd('0x28')],_0x4d2960[_0x20fd('0x44')]);_0x4d2960['erlangCalls']=0x0;_0x4d2960[_0x20fd('0xce')]=0x0;}else if(_0x338577<_0x32adc6&&_0x4d2960[_0x20fd('0x1d6')]===_0x20fd('0x1d7')){clearPredictiveAttributes(_0x4d2960);loggerPredictive[_0x20fd('0x45')](_0x20fd('0x1d8'),_0x20fd('0x1d9'),_0x32adc6,_0x20fd('0x28'),_0x4d2960[_0x20fd('0x44')]);}else if(_0x21b905<_0x4d2960['predictiveIntervalErlangCallsDroppedCalls']&&_0x4d2960[_0x20fd('0x1d6')]===_0x20fd('0x1d7')){clearPredictiveAttributes(_0x4d2960);loggerPredictive['info'](_0x20fd('0x1da'),_0x20fd('0x1db'),_0x21b905,'Drop\x20in\x20this\x20interval',_0x4d2960[_0x20fd('0xce')],_0x20fd('0x28'),_0x4d2960[_0x20fd('0x44')]);}else if(!ifInterval(_0x4d2960[_0x20fd('0x1d4')],_0x4d2960['startProgressive'])&&_[_0x20fd('0x3d')](_0x4d2960[_0x20fd('0x27')])&&!_['isUndefined'](_0x4d2960['startProgressive'])){_0x4d2960[_0x20fd('0x27')]=moment()[_0x20fd('0x42')](_0x20fd('0xc2'));loggerPredictive[_0x20fd('0x45')](_0x4d2960[_0x20fd('0x44')],'started\x20in\x20predictive\x20at',_0x4d2960[_0x20fd('0x27')]);hopperUtils[_0x20fd('0x1dc')](_0x4d2960[_0x20fd('0x1d4')])[_0x20fd('0x99')](this['getDataPredictive'](_0x4d2960))[_0x20fd('0x99')](mergeDataErlangB(_0x4d2960))[_0x20fd('0x99')](this['startMethodPredictive'](_0x4d2960))[_0x20fd('0x9c')](loggerCatchPredictive(_0x20fd('0x1dd'),_0x4d2960));}else if(!ifInterval(_0x4d2960['dialPredictiveInterval'],_0x4d2960[_0x20fd('0x27')])){_0x4d2960[_0x20fd('0xce')]=0x0;_0x4d2960[_0x20fd('0x27')]=moment()[_0x20fd('0x42')](_0x20fd('0xc2'));loggerPredictive[_0x20fd('0x45')](_0x4d2960[_0x20fd('0x44')],'recalculate\x20predictive\x20at',_0x4d2960['startPredictive']);clearInterval(_0x4d2960[_0x20fd('0x5f')]);_0x4d2960['handlePredictive']=undefined;hopperUtils['avgHandleTime'](_0x4d2960[_0x20fd('0x1d4')])[_0x20fd('0x99')](this['getDataPredictive'](_0x4d2960))[_0x20fd('0x99')](mergeDataErlangB(_0x4d2960))['then'](this[_0x20fd('0x1de')](_0x4d2960))[_0x20fd('0x9c')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x4d2960));}else if(_0x4d2960[_0x20fd('0x1ca')]&&_0x36ed84<_0x4d2960[_0x20fd('0x1ca')]-_0x1d889c){clearPredictiveAttributes(_0x4d2960);loggerPredictive[_0x20fd('0x45')](_0x4d2960['name'],_0x20fd('0x1df'),_0x36ed84,_0x20fd('0x1e0'),_0x4d2960[_0x20fd('0x1ca')],'-',_0x1d889c,'=',_0x4d2960[_0x20fd('0x1ca')]-_0x1d889c,')');}else if(_0x4d2960['predictiveIntervalAvailable']&&_0x36ed84>_0x4d2960['predictiveIntervalAvailable']+_0x50a268){clearPredictiveAttributes(_0x4d2960);loggerPredictive[_0x20fd('0x45')](_0x4d2960[_0x20fd('0x44')],_0x20fd('0x1df'),_0x36ed84,_0x20fd('0x1e1'),_0x4d2960['predictiveIntervalAvailable'],'+',_0x50a268,'=',_0x4d2960[_0x20fd('0x1ca')]+_0x50a268,')');}};Dialer[_0x20fd('0x85')]['getDataPredictive']=function(_0x1ccff4){var _0x474212=this;return function(_0x34e213){return new Promise(function(_0x131d28,_0x4f04e1){_['merge'](_0x1ccff4,_0x34e213[0x0]);if(checkGetDataPredictive(_0x34e213[0x0])){var _0x359608=_0x1ccff4[_0x20fd('0x1ca')]=_0x1ccff4[_0x20fd('0x13f')]+_0x1ccff4[_0x20fd('0x13d')];var _0x112a98=_0x1ccff4[_0x20fd('0x1d4')]*0x3c;var _0x2d0d94=_0x34e213[0x0][_0x20fd('0x51')]+_0x34e213[0x0][_0x20fd('0x50')];var _0x535cf9=(_0x34e213[0x0][_0x20fd('0x4a')]+_0x34e213[0x0][_0x20fd('0x4c')]+_0x34e213[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x34e213[0x0][_0x20fd('0x48')];_0x1ccff4[_0x20fd('0x1ce')]=_0x535cf9>0x0?_0x535cf9:0x1;switch(_0x1ccff4['dialPredictiveOptimization']){case _0x20fd('0x1d7'):var _0x3f76bf=_0x1ccff4[_0x20fd('0x1c8')]/0x64;return _0x474212[_0x20fd('0x1e2')](_0x359608,_0x112a98,_0x2d0d94,_0x535cf9,_0x3f76bf)[_0x20fd('0x99')](function(_0x36b2a8){return _0x131d28(_0x36b2a8);});case _0x20fd('0x1e3'):var _0x4f4072=_0x1ccff4[_0x20fd('0x1c8')]/0x64;return _0x474212[_0x20fd('0x1e4')](_0x359608,_0x112a98,_0x2d0d94,_0x535cf9,_0x4f4072)[_0x20fd('0x99')](function(_0x2e9267){return _0x131d28(_0x2e9267);});default:return _0x4f04e1(msgResponse(_0x20fd('0x1e5'),'Failure',_0x20fd('0x1e6')));}}else{return _0x4f04e1(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer[_0x20fd('0x85')][_0x20fd('0x1e7')]=function(_0x2cba8b){var _0x11f27f=this;return function(_0x329aa2){return new Promise(function(_0x459437,_0x35fa86){_[_0x20fd('0x5c')](_0x2cba8b,_0x329aa2[0x0]);if(checkGetDataPredictive(_0x329aa2[0x0])){loggerPredictive[_0x20fd('0x45')](JSON[_0x20fd('0x6f')](_0x329aa2[0x0]));if(_0x2cba8b[_0x20fd('0x1d6')]===_0x20fd('0x1d7')){return _0x11f27f[_0x20fd('0x153')](_0x2cba8b['id'])[_0x20fd('0x99')](function(_0x5dce10){var _0x410eb1=_0x2cba8b['loggedIn']-_0x5dce10[0x0]['outboundQueuePauses'];var _0x5b7572=_0x2cba8b[_0x20fd('0x1d4')]*0x3c;var _0x1f51ed=_0x329aa2[0x0][_0x20fd('0x51')]+_0x329aa2[0x0][_0x20fd('0x50')];var _0x1313ae=(_0x329aa2[0x0][_0x20fd('0x4a')]+_0x329aa2[0x0][_0x20fd('0x4c')]+_0x329aa2[0x0][_0x20fd('0x4e')])/_0x329aa2[0x0][_0x20fd('0x48')];var _0x30b13a=_0x2cba8b['dialPredictiveOptimizationPercentage']/0x64;_0x2cba8b[_0x20fd('0x1e8')]=_0x5dce10[0x0]['outboundQueuePauses']||0x0;_0x2cba8b['predictiveIntervalHitRate']=_0x1313ae>0x0?_0x1313ae:0x1;return _0x11f27f['abandonmentRate'](_0x410eb1,_0x5b7572,_0x1f51ed,_0x1313ae,_0x30b13a);})['then'](function(_0x3791ba){return _0x459437(_0x3791ba);})[_0x20fd('0x9c')](function(_0x32a10b){return _0x35fa86(msgResponse(_0x20fd('0x1e9'),_0x20fd('0x8f'),JSON[_0x20fd('0x6f')](_0x32a10b)));});}if(_0x2cba8b[_0x20fd('0x1d6')]===_0x20fd('0x1e3')){return _0x11f27f[_0x20fd('0x153')](_0x2cba8b['id'])[_0x20fd('0x99')](function(_0xee6c50){var _0x31ef04=_0x2cba8b['loggedIn']-_0xee6c50[0x0][_0x20fd('0x1ea')];var _0x22d3d5=_0x2cba8b[_0x20fd('0x1d4')]*0x3c;var _0x57fde7=_0x329aa2[0x0]['predictiveIntervalAvgTalktime']+_0x329aa2[0x0]['predictiveIntervalAvgHoldtime'];var _0x294cca=(_0x329aa2[0x0][_0x20fd('0x4a')]+_0x329aa2[0x0][_0x20fd('0x4c')]+_0x329aa2[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x329aa2[0x0][_0x20fd('0x48')];var _0x2ff797=_0x2cba8b['dialPredictiveOptimizationPercentage']/0x64;_0x2cba8b[_0x20fd('0x1e8')]=_0xee6c50[0x0][_0x20fd('0x1ea')]||0x0;_0x2cba8b['predictiveIntervalHitRate']=_0x294cca>0x0?_0x294cca:0x1;return _0x11f27f[_0x20fd('0x1e4')](_0x31ef04,_0x22d3d5,_0x57fde7,_0x294cca,_0x2ff797);})[_0x20fd('0x99')](function(_0x529fef){return _0x459437(_0x529fef);})['catch'](function(_0x5ae2d3){return _0x35fa86(msgResponse(_0x20fd('0x1e9'),_0x20fd('0x8f'),JSON[_0x20fd('0x6f')](_0x5ae2d3)));});}}else{return _0x35fa86(msgResponse(_0x20fd('0x1e5'),_0x20fd('0x8f'),_0x20fd('0x1eb')));}});};};Dialer[_0x20fd('0x85')]['startMethodPredictive']=function(_0x18e80d){var _0x1de0fc=this;return function(){var _0x420b3b=0x0;var _0x2b5565=Math[_0x20fd('0x1cd')](_0x18e80d[_0x20fd('0x57')]*0x3e8);if(_0x2b5565>0x0){_0x2b5565=_0x2b5565<0x64?0x64:_0x2b5565;loggerPredictive[_0x20fd('0x45')](_0x18e80d[_0x20fd('0x44')],_0x20fd('0x1ec'),_0x2b5565,_0x20fd('0x1ed'));_0x18e80d[_0x20fd('0x5f')]=setInterval(function(){_0x1de0fc[_0x20fd('0x5f')](_0x18e80d);loggerPredictiveCalls[_0x20fd('0x45')](_0x20fd('0x1ee'),_0x420b3b+=0x1);},_0x2b5565);}else{loggerPredictive['info'](_0x18e80d[_0x20fd('0x44')],_0x20fd('0x1ef'));}};};Dialer['prototype'][_0x20fd('0x1f0')]=function(_0x4c3209,_0x57f13f){var _0x4dfe0b=this;return function(_0x51b739){if(_[_0x20fd('0xfb')](_0x51b739)){if(_['isNil'](_0x57f13f[_0x20fd('0x159')])||!_0x57f13f[_0x20fd('0x1f1')]){if(_0x4c3209[_0x20fd('0xad')]===_0x20fd('0x9')){_0x4c3209[_0x20fd('0x6d')]=_[_0x20fd('0x3d')](_0x4c3209['queueStatusComplete'])?!![]:_0x4c3209[_0x20fd('0x6d')];var _0x368fbe=uuid['v4']();_0x4dfe0b[_0x20fd('0x23')][_0x368fbe]=new Action(_0x4c3209,_0x57f13f,_0x368fbe);loggerBooked[_0x20fd('0x45')]('[booked][checkContactBlack]',_0x368fbe,_0x20fd('0x1f2'),JSON['stringify'](_0x4c3209[_0x20fd('0x6d')]),'Queue:\x20',_0x4c3209[_0x20fd('0x44')]);if(_0x4c3209[_0x20fd('0x6d')]){_0x4c3209[_0x20fd('0x6d')]=![];_0x4dfe0b[_0x20fd('0x2a')][_0x4dfe0b[_0x20fd('0x23')][_0x368fbe][_0x20fd('0xbd')]]=[];ami[_0x20fd('0x96')]({'actionid':_0x368fbe,'action':_0x20fd('0x1f3'),'queue':_0x4c3209[_0x20fd('0x44')]})[_0x20fd('0x9c')](function(){_0x4dfe0b[_0x20fd('0xc1')](_0x4c3209);hopperUtils[_0x20fd('0xe9')]({'active':![],'ContactId':_0x4dfe0b[_0x20fd('0x23')][_0x368fbe]['ContactId'],'ListId':_0x4dfe0b['actions'][_0x368fbe][_0x20fd('0xde')],'VoiceQueueId':_0x4dfe0b['actions'][_0x368fbe][_0x20fd('0xdf')]||undefined,'CampaignId':_0x4dfe0b['actions'][_0x368fbe][_0x20fd('0xec')]||undefined})[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x1f4')));delete _0x4dfe0b[_0x20fd('0x23')][_0x368fbe];});}else{loggerBooked[_0x20fd('0x45')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x4c3209[_0x20fd('0x6d')]),'Queue:\x20',_0x4c3209[_0x20fd('0x44')]);_0x4dfe0b[_0x20fd('0xc1')](_0x4c3209);hopperUtils[_0x20fd('0xe9')]({'active':![],'ContactId':_0x4dfe0b[_0x20fd('0x23')][_0x368fbe][_0x20fd('0xeb')],'ListId':_0x4dfe0b[_0x20fd('0x23')][_0x368fbe][_0x20fd('0xde')],'VoiceQueueId':_0x4dfe0b[_0x20fd('0x23')][_0x368fbe][_0x20fd('0xdf')]||undefined,'CampaignId':_0x4dfe0b[_0x20fd('0x23')][_0x368fbe][_0x20fd('0xec')]||undefined})[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x1f4')));delete _0x4dfe0b[_0x20fd('0x23')][_0x368fbe];}}else{return _0x4dfe0b[_0x20fd('0x160')](_0x4c3209,_0x57f13f);}}else{if(utils[_0x20fd('0xca')](undefined,_0x57f13f[_0x20fd('0x1f5')])<_0x4c3209['dialRecallMeTimeout']*0x3c){if(_0x57f13f[_0x20fd('0x14b')]&&!_0x57f13f['Agent'][_0x20fd('0x1f6')]){_0x4dfe0b[_0x20fd('0x1c')][_0x20fd('0xf9')](_0x57f13f['id'])['finally'](function(){_0x4dfe0b[_0x20fd('0xc1')](_0x4c3209);});}else{hopperUtils[_0x20fd('0x1f7')]({'active':![]},_0x57f13f['id'],0x1)[_0x20fd('0x104')](function(){_0x4dfe0b[_0x20fd('0xc1')](_0x4c3209);});}}else{_0x4c3209['outboundReCallsDay']+=0x1;_0x4dfe0b[_0x20fd('0xc1')](_0x4c3209);if(_0x4c3209[_0x20fd('0x1f8')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x57f13f['ContactId'],'ListId':_0x57f13f['ListId'],'VoiceQueueId':_0x57f13f[_0x20fd('0xdf')]||undefined,'CampaignId':_0x57f13f[_0x20fd('0xec')]||undefined})[_0x20fd('0x9c')](loggerCatch(_0x20fd('0x1f9')));hopperUtils['createHistory'](createObjHistory(_0x4c3209,_0x57f13f,utils[_0x20fd('0x66')][_0x20fd('0x1fa')],0x17,'RecallInQueue'))['catch'](loggerCatch(_0x20fd('0x1fb')));}else{_0x4dfe0b[_0x20fd('0x11e')](createObjHistory(_0x4c3209,_0x57f13f,utils[_0x20fd('0x66')][_0x20fd('0x1fc')],0x16,'RecallFailedTimeout'),_0x20fd('0x1fd'),'[Originate][HistoryRecallClose]');}}}}else{_0x4c3209['outboundBlacklistCallsDay']+=0x1;_0x4dfe0b['saveInDb'](createObjHistory(_0x4c3209,_0x57f13f,utils[_0x20fd('0x66')][_0x20fd('0x1fe')],0xd,_0x20fd('0x1ff')),_0x20fd('0x200'),_0x20fd('0x201'));throw _0x20fd('0x202');}};};Dialer[_0x20fd('0x85')][_0x20fd('0x15f')]=function(_0x84a470){var _0x2c52f1=this;var _0x2db9b4=_0x84a470[_0x20fd('0x203')]-_0x84a470['originated']-_0x84a470['temp'];emitCampaignSummary(_0x84a470);if(_0x2db9b4>0x0){if(_0x2db9b4>this[_0x20fd('0x21')]){_0x2db9b4=this[_0x20fd('0x21')];}_0x84a470[_0x20fd('0x204')]+=_0x2db9b4;hopperUtils[_0x20fd('0x205')](_0x84a470,_0x2db9b4)[_0x20fd('0x99')](function(_0xd92ef1){_0x84a470['temp']-=_0x2db9b4;_0x84a470['temp']=_0x84a470[_0x20fd('0x204')]>0x0?_0x84a470['temp']:0x0;if(!utils[_0x20fd('0x206')](_0xd92ef1)){_0x84a470[_0x20fd('0x65')]=utils[_0x20fd('0x66')][_0x20fd('0x69')];logger['info'](_0x20fd('0x207')+_0x84a470['name']);}else{_0x84a470[_0x20fd('0x79')]+=_0xd92ef1[_0x20fd('0x95')];_0x84a470['message']=utils[_0x20fd('0x66')][_0x20fd('0x208')];for(var _0x5cbb00=0x0;_0x5cbb00<_0xd92ef1[_0x20fd('0x95')];_0x5cbb00+=0x1){_0x84a470[_0x20fd('0x209')]+=0x1;if(_[_0x20fd('0xfe')](_0xd92ef1[_0x5cbb00])||_[_0x20fd('0xfe')](_0xd92ef1[_0x5cbb00][_0x20fd('0x17e')])||_['isNil'](_0xd92ef1[_0x5cbb00][_0x20fd('0x163')])){_0x2c52f1[_0x20fd('0x20a')](_0x20fd('0x20b'),_0x84a470,_0xd92ef1[_0x5cbb00]);}else{hopperUtils[_0x20fd('0x20c')](_['pick'](_0xd92ef1[_0x5cbb00],[_0x20fd('0xec'),_0x20fd('0x163')]))[_0x20fd('0x99')](_0x2c52f1['checkContactBlack'](_0x84a470,_0xd92ef1[_0x5cbb00]))['catch'](_0x2c52f1[_0x20fd('0x157')](_0x20fd('0x20d'),_0x84a470));}}}})[_0x20fd('0x9c')](loggerGetContactDialer(_0x20fd('0x20e'),_0x84a470,_0x2db9b4));}};Dialer[_0x20fd('0x85')][_0x20fd('0xaf')]=function(_0x303232,_0x346cfb){var _0x29e2a9=this;var _0x2fdc9b=[];if(_0x346cfb<0x1||_0x303232[_0x20fd('0xad')]==='booked'){_0x346cfb=0x1;}var _0x4c6eba=Math[_0x20fd('0x1cd')](_0x303232[_0x20fd('0x13d')]*_0x346cfb)-_0x303232[_0x20fd('0x79')]-_0x303232[_0x20fd('0x204')];if(_0x303232[_0x20fd('0x20f')]>0x0){var _0x433a22=_0x303232['dialLimitQueue']-_0x303232['originated']-_0x303232[_0x20fd('0x13f')]-_0x303232['temp']-_0x303232[_0x20fd('0x140')];if(_0x4c6eba>_0x433a22){_0x4c6eba=_0x433a22;}}if(_0x4c6eba>0x0){if(_0x303232[_0x20fd('0xad')]==='booked'){_0x4c6eba=0x1;}if(_0x4c6eba>this['maxNumberOriginate']){_0x4c6eba=this['maxNumberOriginate'];}_0x303232[_0x20fd('0x204')]+=_0x4c6eba;for(var _0x5e6b73 in this[_0x20fd('0x1f')]){if(typeof this[_0x20fd('0x1f')][_0x5e6b73]!==_0x20fd('0xa8')){if(this['agents'][_0x5e6b73][_0x20fd('0xcf')]===_0x20fd('0x210')&&this['agents'][_0x5e6b73][_0x20fd('0x82')]==='reachable'){_0x2fdc9b['push'](this[_0x20fd('0x1f')][_0x5e6b73]['id']);}}}hopperUtils[_0x20fd('0x211')](_0x303232,_0x2fdc9b,_0x4c6eba)[_0x20fd('0x99')](function(_0x5740c6){_0x303232[_0x20fd('0x204')]-=_0x4c6eba;_0x303232[_0x20fd('0x204')]=_0x303232['temp']>0x0?_0x303232['temp']:0x0;if(!utils['checkContactEmpty'](_0x5740c6)){hopperUtils[_0x20fd('0x212')](_0x303232)[_0x20fd('0x99')](sendMessageReschedule(_0x303232))[_0x20fd('0x9c')](loggerCatch('[countReScheduled]\x20'));}else{_0x303232[_0x20fd('0x79')]+=_0x5740c6[_0x20fd('0x95')];_0x303232[_0x20fd('0x65')]=_0x303232[_0x20fd('0xad')]===_0x20fd('0x9')?utils['CAMPAIGN_STATUS'][_0x20fd('0x141')]:utils[_0x20fd('0x66')][_0x20fd('0x208')];for(var _0x29131e=0x0;_0x29131e<_0x5740c6[_0x20fd('0x95')];_0x29131e+=0x1){if(_[_0x20fd('0xfe')](_0x5740c6[_0x29131e])||_['isNil'](_0x5740c6[_0x29131e][_0x20fd('0x17e')])||_[_0x20fd('0xfe')](_0x5740c6[_0x29131e][_0x20fd('0x163')])){_0x29e2a9[_0x20fd('0x20a')]('[actionOriginate]\x20',_0x303232,_0x5740c6[_0x29131e]);}else{hopperUtils[_0x20fd('0x213')](_[_0x20fd('0xf6')](_0x5740c6[_0x29131e],['VoiceQueueId','phone']))[_0x20fd('0x99')](_0x29e2a9[_0x20fd('0x1f0')](_0x303232,_0x5740c6[_0x29131e]))['catch'](_0x29e2a9[_0x20fd('0x157')](_0x20fd('0x20b'),_0x303232));}}}})['catch'](loggerGetContactDialer(_0x20fd('0x214'),_0x303232,_0x4c6eba));}};Dialer['prototype'][_0x20fd('0x5f')]=function(_0x1df23e){if(_0x1df23e[_0x20fd('0x20f')]>0x0){var _0x27777b=_0x1df23e['dialLimitQueue']-_0x1df23e[_0x20fd('0x79')]-_0x1df23e[_0x20fd('0x13f')];if(_0x27777b>0x0){this[_0x20fd('0x215')](_0x1df23e);}else{loggerPredictiveCalls[_0x20fd('0x45')](_0x20fd('0x216'));}}else{this[_0x20fd('0x215')](_0x1df23e);}};Dialer[_0x20fd('0x85')]['tryOriginatePredictive']=function(_0xae03c0){var _0x5194d3=this;var _0x382fa0=[];_0xae03c0[_0x20fd('0x79')]+=0x1;for(var _0xeb6826 in this['agents']){if(typeof this[_0x20fd('0x1f')][_0xeb6826]!=='undefined'){if(this['agents'][_0xeb6826][_0x20fd('0xcf')]===_0x20fd('0x210')&&this[_0x20fd('0x1f')][_0xeb6826][_0x20fd('0x82')]===_0x20fd('0x83')){_0x382fa0[_0x20fd('0x9d')](this['agents'][_0xeb6826]['id']);}}}return this[_0x20fd('0x211')](_0xae03c0['id'],_0x382fa0,0x1,_0xae03c0[_0x20fd('0x217')],_0xae03c0)[_0x20fd('0x99')](function(_0x1bfc5c){if(!utils['checkContactEmpty'](_0x1bfc5c)){utils[_0x20fd('0x63')](_0xae03c0,0x1,0x0);return hopperUtils[_0x20fd('0x212')](_0xae03c0)[_0x20fd('0x99')](sendMessageReschedule(_0xae03c0))[_0x20fd('0x9c')](loggerCatch('[countReScheduled]\x20'));}else{_0xae03c0['message']=utils['CAMPAIGN_STATUS']['RUNNING'];if(_[_0x20fd('0xfe')](_0x1bfc5c[0x0])||_[_0x20fd('0xfe')](_0x1bfc5c[0x0][_0x20fd('0x17e')])||_['isNil'](_0x1bfc5c[0x0][_0x20fd('0x163')])){_0x5194d3['emptyContact'](_0x20fd('0x20b'),_0xae03c0,_0x1bfc5c[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x20fd('0xf6')](_0x1bfc5c[0x0],[_0x20fd('0xdf'),_0x20fd('0x163')]))['then'](_0x5194d3['checkContactBlack'](_0xae03c0,_0x1bfc5c[0x0]))[_0x20fd('0x9c')](_0x5194d3['loggerHandler'](_0x20fd('0x218'),_0xae03c0));}}})[_0x20fd('0x9c')](loggerGetContactDialer(_0x20fd('0x219'),_0xae03c0,0x1));};Dialer[_0x20fd('0x85')][_0x20fd('0x1e2')]=function(_0x561091,_0x13081f,_0x1571de,_0x376ea6,_0x4bc95b,_0x40411e){loggerPredictive[_0x20fd('0x45')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x20fd('0x45')]('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',_0x561091);loggerPredictive[_0x20fd('0x45')](_0x20fd('0x21a'),_0x13081f);loggerPredictive[_0x20fd('0x45')](_0x20fd('0x21b'),_0x1571de);loggerPredictive[_0x20fd('0x45')]('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',_0x376ea6);loggerPredictive[_0x20fd('0x45')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4bc95b);loggerPredictive[_0x20fd('0x45')](_0x20fd('0x5b'));return new Promise(function(_0x555266,_0x52a43c){if(_0x561091<=0x0||isNaN(_0x561091)){return _0x52a43c(msgResponse(_0x20fd('0x21c'),_0x20fd('0x7f'),_0x20fd('0x21d')+_0x561091));}if(_0x1571de<=0x0||isNaN(_0x1571de)){return _0x52a43c(msgResponse(_0x20fd('0x21c'),'Error','Ts\x20=\x20'+_0x1571de));}if(_0x376ea6<=0x0||isNaN(_0x376ea6)){return _0x52a43c(msgResponse(_0x20fd('0x21c'),_0x20fd('0x7f'),_0x20fd('0x21e')+_0x376ea6));}if(_0x13081f<=0x0||isNaN(_0x13081f)){return _0x52a43c(msgResponse(_0x20fd('0x21c'),'Error',_0x20fd('0x21f')+_0x13081f));}if(_0x4bc95b<=0x0||isNaN(_0x4bc95b)){return _0x52a43c(msgResponse('[abandonmentRate]',_0x20fd('0x7f'),_0x20fd('0x220')+_0x4bc95b));}_0x40411e=_0x40411e||0x0;var _0x103493=0x1/_0x1571de;var _0x3cb51d=0x0;var _0x27ab39=0x0;var _0x1074cf=0x0;var _0x320a75=0x0;for(var _0x1884f6=0x0;_0x1074cf<_0x4bc95b;_0x1884f6+=0x1){_0x27ab39=_0x1884f6/_0x13081f;_0x3cb51d=(_0x376ea6*_0x27ab39+_0x40411e)/_0x103493;_0x1074cf=utils[_0x20fd('0x221')](_0x3cb51d,_0x561091);_0x320a75=_0x3cb51d/_0x561091*(0x1-utils[_0x20fd('0x221')](_0x3cb51d,_0x561091));}return _0x555266({'erlangCalls':_0x1884f6,'erlangCallToSecond':_0x13081f/_0x1884f6,'erlangAbandonmentRate':_0x1074cf,'erlangBusyFactor':_0x320a75});});};Dialer[_0x20fd('0x85')][_0x20fd('0x1e4')]=function(_0x256f6a,_0xf9b0c9,_0x3ef010,_0x2437d7,_0x5ef1ec,_0x5c4854){loggerPredictive[_0x20fd('0x45')](_0x20fd('0x222'));loggerPredictive[_0x20fd('0x45')](_0x20fd('0x223'),_0x256f6a);loggerPredictive[_0x20fd('0x45')](_0x20fd('0x21a'),_0xf9b0c9);loggerPredictive[_0x20fd('0x45')](_0x20fd('0x21b'),_0x3ef010);loggerPredictive[_0x20fd('0x45')](_0x20fd('0x224'),_0x2437d7);loggerPredictive[_0x20fd('0x45')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5ef1ec);loggerPredictive['info'](_0x20fd('0x5b'));return new Promise(function(_0x2c916f,_0x44ec3f){if(_0x256f6a<=0x0||isNaN(_0x256f6a)){return _0x44ec3f(msgResponse(_0x20fd('0x225'),'Error',_0x20fd('0x21d')+_0x256f6a));}if(_0x3ef010<=0x0||isNaN(_0x3ef010)){return _0x44ec3f(msgResponse(_0x20fd('0x225'),_0x20fd('0x7f'),_0x20fd('0x226')+_0x3ef010));}if(_0x2437d7<=0x0||isNaN(_0x2437d7)){return _0x44ec3f(msgResponse(_0x20fd('0x225'),_0x20fd('0x7f'),_0x20fd('0x21e')+_0x2437d7));}if(_0xf9b0c9<=0x0||isNaN(_0xf9b0c9)){return _0x44ec3f(msgResponse(_0x20fd('0x225'),_0x20fd('0x7f'),'interval\x20=\x20'+_0xf9b0c9));}if(_0x5ef1ec<=0x0||isNaN(_0x5ef1ec)){return _0x44ec3f(msgResponse('[busyFactor]','Error',_0x20fd('0x227')+_0x5ef1ec));}_0x5c4854=_0x5c4854||0x0;var _0x257c98=0x1/_0x3ef010;var _0x181c27=0x0;var _0x1a957b=0x0;var _0x25449c=0x0;var _0x2c3898=0x0;for(var _0x5a4bf3=0x0;_0x2c3898<_0x5ef1ec;_0x5a4bf3+=0x1){_0x1a957b=_0x5a4bf3/_0xf9b0c9;_0x181c27=(_0x2437d7*_0x1a957b+_0x5c4854)/_0x257c98;_0x25449c=utils['erlangb'](_0x181c27,_0x256f6a);_0x2c3898=_0x181c27/_0x256f6a*(0x1-utils['erlangb'](_0x181c27,_0x256f6a));}return _0x2c916f({'erlangCalls':_0x5a4bf3,'erlangCallToSecond':_0xf9b0c9/_0x5a4bf3,'erlangAbandonmentRate':_0x25449c,'erlangBusyFactor':_0x2c3898});});};module[_0x20fd('0x228')]=Dialer; \ No newline at end of file +var _0x8fc8=['voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countglobal','verifyAdditionalPhones','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','ListId','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','paused','stateinterface','locked','queueBooked','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','updateOriginated','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','VoiceQueueId','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','Success','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','Machine','membername','countmachineretry','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','MACHINE','countbusyretry','dialGlobalMaxRetry','[syncHangupIvr]','dialQueueProject','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','dialPreviewRecallmeReminder','filter','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','Action','[Dialer][checkChannel]','getVoiceQueueRtPauses','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','handleIvr','object','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','updatedAt','XMD-','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','outboundDropCallsDayTimeout','predictiveIntervalMaxThreshold','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','available','predictiveIntervalHitRate','dialPredictiveOptimizationPercentage','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','loggedIn','busyFactor','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','RUNNING','emptyContact','checkIsBlackList','tryOriginatePredictive','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','emit','type','debug','format','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','handlePredictive','error','stack','inspect','checkContactLowerLimitOriginate','contactsRescheduled','message','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','Error','active','SIP/%s','status','reachable','unmonitored','isTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','push','command','interval','indexOf','true','catch','iftime\x20%s,%s','timezones','then','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','dialTimezone','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','ivr','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin'];(function(_0x1d6721,_0x40406f){var _0x2c7cbd=function(_0x516188){while(--_0x516188){_0x1d6721['push'](_0x1d6721['shift']());}};_0x2c7cbd(++_0x40406f);}(_0x8fc8,0x14b));var _0x88fc=function(_0x1c9231,_0x4aa3fd){_0x1c9231=_0x1c9231-0x0;var _0x488a44=_0x8fc8[_0x1c9231];return _0x488a44;};'use strict';var util=require('util');var _=require(_0x88fc('0x0'));var uuid=require(_0x88fc('0x1'));var moment=require(_0x88fc('0x2'));var rr=require('rr');var Redis=require(_0x88fc('0x3'));var utils=require(_0x88fc('0x4'));var hopperUtils=require(_0x88fc('0x5'));var ut=require(_0x88fc('0x6'));var config=require(_0x88fc('0x7'));var logger=require(_0x88fc('0x8'))(_0x88fc('0x9'));var loggerBooked=require(_0x88fc('0x8'))('booked');var loggerPredictive=require(_0x88fc('0x8'))(_0x88fc('0xa'));var loggerPredictiveCalls=require(_0x88fc('0x8'))(_0x88fc('0xb'));var loggerSyncQueueSummary=require(_0x88fc('0x8'))('syncQueueSummary');var ami=require('../ami');config[_0x88fc('0xc')]=_[_0x88fc('0xd')](config['redis'],{'host':_0x88fc('0xe'),'port':0x18eb});var io=require(_0x88fc('0xf'))(new Redis(config[_0x88fc('0xc')]));var cmHopper=require(_0x88fc('0x10'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x88fc('0x11'));var Interval=require(_0x88fc('0x12'));var Action=require(_0x88fc('0x13'));var History=require(_0x88fc('0x14'));var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x88fc('0x15'));var Hangup=require(_0x88fc('0x16'));var ipAgi=process[_0x88fc('0x17')][_0x88fc('0x18')]||_0x88fc('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x88fc('0x1a')]['enqueue']=function(_0xbccea1){this[_0x88fc('0x1b')]=this[_0x88fc('0x1b')]?this[_0x88fc('0x1b')][_0x88fc('0x1c')](_0xbccea1):_0xbccea1();};function Dialer(_0x1e3e97,_0x5b5736){this[_0x88fc('0x1d')]=new Sequence();this[_0x88fc('0x1e')]=_0x5b5736;this[_0x88fc('0x1f')]=_0x1e3e97[_0x88fc('0x1f')];this[_0x88fc('0x20')]=_0x1e3e97[_0x88fc('0x20')];this['agents']=_0x1e3e97[_0x88fc('0x21')];this[_0x88fc('0x22')]=_0x1e3e97[_0x88fc('0x22')];this[_0x88fc('0x23')]=config[_0x88fc('0x23')]||0x2;this[_0x88fc('0x24')]={};this[_0x88fc('0x25')]={};this[_0x88fc('0x26')]={};this[_0x88fc('0x27')]={};this[_0x88fc('0x28')]={};this[_0x88fc('0x29')]={};this[_0x88fc('0x2a')]={};this[_0x88fc('0x2b')]={};this['queueBooked']={};this[_0x88fc('0x2c')]={};this[_0x88fc('0x2d')]={};ami['on'](_0x88fc('0x2e'),this[_0x88fc('0x2f')][_0x88fc('0x30')](this));ami['on'](_0x88fc('0x31'),this[_0x88fc('0x32')][_0x88fc('0x30')](this));ami['on'](_0x88fc('0x33'),this['syncOriginateResponse'][_0x88fc('0x30')](this));ami['on'](_0x88fc('0x34'),this[_0x88fc('0x35')][_0x88fc('0x30')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x88fc('0x30')](this));ami['on'](_0x88fc('0x36'),this[_0x88fc('0x37')][_0x88fc('0x30')](this));ami['on'](_0x88fc('0x38'),this['syncHangup']['bind'](this));ami['on'](_0x88fc('0x39'),this[_0x88fc('0x3a')]['bind'](this));ami['on'](_0x88fc('0x3b'),this[_0x88fc('0x3c')][_0x88fc('0x30')](this));ami['on']('queuemember',this[_0x88fc('0x3d')][_0x88fc('0x30')](this));ami['on']('queuestatuscomplete',this[_0x88fc('0x3e')][_0x88fc('0x30')](this));this[_0x88fc('0x3f')]();this[_0x88fc('0x40')]();RpcSetting['getSettings']()['then'](function(_0x1f97fc){previewRecallmeReminderInterval=_0x1f97fc['previewRecallmeReminderInterval'];});}function isNotNull(_0x1075ce){return _0x1075ce!==null&&!_[_0x88fc('0x41')](_0x1075ce);}function msgResponse(_0x3dac06,_0x524553,_0x5c858e){return{'action':_0x3dac06,'response':_0x524553,'message':_0x5c858e,'stack':_0x5c858e};}function emit(_0x578de8,_0x51a26f,_0x1cccd5){io['to'](_0x578de8)[_0x88fc('0x42')](_0x51a26f,_0x1cccd5);}function emitOutboundVoiceQueueSummary(_0x5d1eac){if(_0x5d1eac[_0x88fc('0x43')]==='outbound'){logger[_0x88fc('0x44')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0x5d1eac,{'showHidden':![],'depth':null}));emit(util[_0x88fc('0x45')](_0x88fc('0x46'),_0x5d1eac[_0x88fc('0x47')]),_0x88fc('0x48'),_0x5d1eac);}}function checkGetDataPredictive(_0x41c576){if(isNotNull(_0x41c576)&&!_['isEmpty'](_0x41c576)){loggerPredictive[_0x88fc('0x49')](_0x88fc('0x4a'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x41c576[_0x88fc('0x4b')]);loggerPredictive[_0x88fc('0x49')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x41c576[_0x88fc('0x4c')]);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x4d'),_0x41c576['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x4e'),_0x41c576[_0x88fc('0x4f')]);loggerPredictive[_0x88fc('0x49')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x41c576[_0x88fc('0x50')]);loggerPredictive[_0x88fc('0x49')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x41c576['predictiveIntervalAvgTalktime']);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x51'));if(_0x41c576['predictiveIntervalTotalCalls']>0x0){if(!_[_0x88fc('0x41')](_0x41c576[_0x88fc('0x52')])&&_0x41c576[_0x88fc('0x52')]>0x0){return!![];}loggerPredictive[_0x88fc('0x49')](_0x88fc('0x53'));if(!_['isUndefined'](_0x41c576[_0x88fc('0x50')])&&_0x41c576[_0x88fc('0x50')]>0x0){return!![];}loggerPredictive[_0x88fc('0x49')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x88fc('0x49')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x88fc('0x49')](_0x88fc('0x54'));}return![];}function mergeDataErlangB(_0xec252a){return function(_0x1e115c){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x88fc('0x55'),_0x1e115c[_0x88fc('0x56')]);loggerPredictive['info'](_0x88fc('0x57'),_0x1e115c[_0x88fc('0x58')]);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x59'),_0x1e115c[_0x88fc('0x5a')]);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x5b'),_0x1e115c[_0x88fc('0x5c')]);loggerPredictive['info'](_0x88fc('0x59'),_0x1e115c[_0x88fc('0x5a')]);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x51'));_[_0x88fc('0x5d')](_0xec252a,_0x1e115c);};}function ifInterval(_0x61b57d,_0x7c8241){if(_[_0x88fc('0x41')](_0x7c8241)){return![];}return utils[_0x88fc('0x5e')](undefined,_0x7c8241)<_0x61b57d*0x3c;}function clearPredictiveAttributes(_0x3f798f){if(_0x3f798f[_0x88fc('0x2a')]){_0x3f798f[_0x88fc('0x2a')]=undefined;loggerPredictive[_0x88fc('0x44')](_0x3f798f[_0x88fc('0x47')],_0x88fc('0x5f'));}if(_0x3f798f[_0x88fc('0x29')]){_0x3f798f[_0x88fc('0x29')]=undefined;loggerPredictive['debug'](_0x3f798f[_0x88fc('0x47')],'startPredictive\x20value\x20cleared');}if(_0x3f798f['handlePredictive']){clearInterval(_0x3f798f[_0x88fc('0x60')]);_0x3f798f[_0x88fc('0x60')]=undefined;loggerPredictive[_0x88fc('0x44')](_0x3f798f['name'],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x4835a6,_0xab1446){return function(_0x3482c8){loggerPredictive['error'](_0xab1446[_0x88fc('0x47')],_0x4835a6);loggerPredictive[_0x88fc('0x61')](_0x3482c8[_0x88fc('0x62')]);clearPredictiveAttributes(_0xab1446);};}function loggerCatch(_0xfee94a){return function(_0x4a10ad){logger[_0x88fc('0x61')](_0xfee94a,util[_0x88fc('0x63')](_0x4a10ad,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4b9f15,_0x13172c,_0x437531){return function(_0x326ad4){utils[_0x88fc('0x64')](_0x13172c,_0x437531,0x0);logger[_0x88fc('0x61')](_0x4b9f15,util[_0x88fc('0x63')](_0x326ad4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x538d4c){return function(_0x39706b){if(isNotNull(_0x39706b)&&isNotNull(_0x39706b[0x0])){if(_0x39706b[0x0][_0x88fc('0x65')]>0x0){_0x538d4c[_0x88fc('0x66')]=utils['CAMPAIGN_STATUS']['CONTACTS_RESCHEDULED'];logger['info'](_0x88fc('0x67')+_0x538d4c[_0x88fc('0x47')],_0x39706b[0x0][_0x88fc('0x65')],_0x88fc('0x68'));}else{_0x538d4c[_0x88fc('0x66')]=utils[_0x88fc('0x69')]['NO_AVAILABLE_CONTACTS'];logger[_0x88fc('0x49')](_0x88fc('0x6a')+_0x538d4c[_0x88fc('0x47')]);}}};}function createObjHistory(_0x5e929b,_0x24ebe3,_0x3b626e,_0x9baa67,_0x187c3b){_0x5e929b['message']=_0x3b626e;var _0x5905f0=new Action(_0x5e929b,_0x24ebe3);var _0x1059a2=new History(_0x5905f0);_0x1059a2[_0x88fc('0x6b')]=_0x9baa67;_0x1059a2['statedesc']=_0x187c3b;_0x1059a2[_0x88fc('0x6c')]=_0x5905f0[_0x88fc('0x6d')];return _0x1059a2;}function unlockQueueStatus(_0x15cd23,_0x10675e){setTimeout(function(){if(_['isUndefined'](_0x15cd23[_0x88fc('0x6e')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x10675e);}_0x15cd23[_0x88fc('0x6e')]=!![];loggerBooked[_0x88fc('0x49')](_0x88fc('0x6f'),_0x10675e,JSON[_0x88fc('0x70')](_[_0x88fc('0x71')](_0x15cd23,[_0x88fc('0x47'),_0x88fc('0x6e')])));},0x1f3);}function checkInterval(_0x48c579){return function(){if(!isNotNull(_0x48c579[_0x88fc('0x72')])){_0x48c579[_0x88fc('0x66')]=utils['CAMPAIGN_STATUS'][_0x88fc('0x73')];throw _0x48c579['name']+_0x88fc('0x74');}if(!isNotNull(_0x48c579[_0x88fc('0x72')][_0x88fc('0x75')])){_0x48c579[_0x88fc('0x66')]=utils['CAMPAIGN_STATUS'][_0x88fc('0x73')];throw _0x48c579[_0x88fc('0x47')]+_0x88fc('0x74');}if(!isNotNull(_[_0x88fc('0x76')](_0x48c579[_0x88fc('0x72')][_0x88fc('0x75')]))){_0x48c579['message']=utils[_0x88fc('0x69')]['NULL_INTERVAL'];throw _0x48c579['name']+_0x88fc('0x74');}};}function checkIsIVRCampaignActive(_0x15cdd2){return function(){if(!utils[_0x88fc('0x77')](_0x15cdd2)){_0x15cdd2['message']=utils['CAMPAIGN_STATUS'][_0x88fc('0x78')];throw _0x15cdd2[_0x88fc('0x47')]+_0x88fc('0x79');}};}function emitCampaignSummary(_0x38b90a){if(utils[_0x88fc('0x7a')](_0x38b90a)){emit(util['format'](_0x88fc('0x7b'),_0x38b90a[_0x88fc('0x47')]),'campaign:save',_0x38b90a);}}function loggerCatchQueueSummary(_0x27baf7,_0x41fbd3){return function(_0x323342){clearPredictiveAttributes(_0x41fbd3);emitCampaignSummary(_0x41fbd3);loggerSyncQueueSummary[_0x88fc('0x44')](_0x27baf7,util[_0x88fc('0x63')](_0x323342,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5d3520){if(_0x5d3520[_0x88fc('0x7c')]){if(_0x5d3520['originated']===0x0){_0x5d3520[_0x88fc('0x7c')]=![];_0x5d3520[_0x88fc('0x66')]=utils[_0x88fc('0x69')][_0x88fc('0x78')];loggerSyncQueueSummary[_0x88fc('0x44')](_0x88fc('0x7d'),_0x5d3520['name'],_0x88fc('0x7e'));}else{_0x5d3520[_0x88fc('0x66')]=utils[_0x88fc('0x69')][_0x88fc('0x7f')];loggerSyncQueueSummary[_0x88fc('0x44')](_0x88fc('0x7d'),_0x5d3520['name'],'is\x20disactive');}emitCampaignSummary(_0x5d3520);}}function myreject(_0x1e9676){return function(_0x5955c9){return _0x1e9676(msgResponse('[ifTime][Action]',_0x88fc('0x80'),JSON['stringify'](_0x5955c9)));};}Dialer[_0x88fc('0x1a')]['isTrunkReachable']=function(_0x1283b3){return!_[_0x88fc('0x41')](_0x1283b3)&&_0x1283b3&&!_[_0x88fc('0x41')](_0x1283b3[_0x88fc('0x47')])&&!_['isUndefined'](_0x1283b3[_0x88fc('0x81')])&&_0x1283b3[_0x88fc('0x81')]&&(this[_0x88fc('0x22')][util[_0x88fc('0x45')](_0x88fc('0x82'),_0x1283b3[_0x88fc('0x47')])][_0x88fc('0x83')]===_0x88fc('0x84')||this['trunks'][util['format'](_0x88fc('0x82'),_0x1283b3[_0x88fc('0x47')])]['status']===_0x88fc('0x85'));};Dialer['prototype']['checkIsTrunkReachable']=function(_0x39a430){var _0x1ce4f0=this;return function(){if(!_0x1ce4f0[_0x88fc('0x86')](_0x39a430[_0x88fc('0x87')])){if(!_0x1ce4f0[_0x88fc('0x86')](_0x39a430['TrunkBackup'])){_0x39a430[_0x88fc('0x66')]=utils['CAMPAIGN_STATUS'][_0x88fc('0x88')];throw _0x39a430[_0x88fc('0x47')]+_0x88fc('0x89');}}};};Dialer[_0x88fc('0x1a')][_0x88fc('0x8a')]=function(_0x591d03,_0x2ec63d,_0x2f3ecf,_0x18da18){var _0x4d2d47=this;return function(){var _0x3fb3d0=!![];return _0x4d2d47[_0x88fc('0x8b')](_0x591d03,_0x2ec63d,_0x2f3ecf,_0x18da18,_0x3fb3d0);};};Dialer[_0x88fc('0x1a')][_0x88fc('0x8c')]=function(_0x49a7ef,_0x3720f2,_0x31a1e0,_0xdff940){var _0x10587b=this;return function(){var _0x147cc0=![];return _0x10587b[_0x88fc('0x8b')](_0x49a7ef[_0x88fc('0x75')],_0x3720f2,_0x31a1e0,_0xdff940,_0x147cc0);};};Dialer[_0x88fc('0x1a')][_0x88fc('0x8b')]=function(_0x270db9,_0x4580fc,_0x55ea30,_0x465601,_0x10ec77){var _0x6fd5d7=[];return new Promise(function(_0x3e3a77,_0x2bfdd6){if(!isNotNull(_0x270db9)){_0x465601[_0x88fc('0x66')]=utils[_0x88fc('0x69')][_0x88fc('0x73')];return _0x2bfdd6(msgResponse(_0x88fc('0x8d'),_0x88fc('0x8e'),_0x55ea30+_0x88fc('0x8f')));}if(_[_0x88fc('0x76')](_0x270db9)){_0x465601[_0x88fc('0x66')]=utils[_0x88fc('0x69')][_0x88fc('0x90')];return _0x2bfdd6(msgResponse(_0x88fc('0x8d'),_0x88fc('0x8e'),_0x55ea30+_0x88fc('0x91')));}if(_0x4580fc&&_[_0x88fc('0x41')](config['timezones'][_0x4580fc])){_0x465601[_0x88fc('0x66')]=utils[_0x88fc('0x69')][_0x88fc('0x92')];return _0x2bfdd6(msgResponse(_0x88fc('0x8d'),_0x88fc('0x8e'),_0x55ea30+'\x20Timezone\x20unknow\x20'+_0x4580fc));}if(_['isArray'](_0x270db9)){for(var _0x19d71f=0x0;_0x19d71f<_0x270db9['length'];_0x19d71f+=0x1){_0x6fd5d7[_0x88fc('0x93')](ami['Action']({'action':_0x88fc('0x94'),'command':util[_0x88fc('0x45')]('iftime\x20%s,%s',_0x270db9[_0x19d71f][_0x88fc('0x95')],!_['isUndefined'](config['timezones'][_0x4580fc])?_0x4580fc:'')})['then'](function(_0x1e4b32){return _0x1e4b32['content'][_0x88fc('0x96')](_0x88fc('0x97'))>=0x0;})[_0x88fc('0x98')](myreject(_0x2bfdd6)));}}else{_0x6fd5d7[_0x88fc('0x93')](ami['Action']({'action':_0x88fc('0x94'),'command':util[_0x88fc('0x45')](_0x88fc('0x99'),_0x270db9,!_['isUndefined'](config[_0x88fc('0x9a')][_0x4580fc])?_0x4580fc:'')})[_0x88fc('0x9b')](function(_0x3e1b76){return _0x3e1b76['content'][_0x88fc('0x96')](_0x88fc('0x97'))>=0x0;})[_0x88fc('0x98')](myreject(_0x2bfdd6)));}Promise['all'](_0x6fd5d7)['then'](function(_0x5f2be1){var _0x57abdf=_[_0x88fc('0x9c')](_0x5f2be1);if(_0x57abdf){return _0x3e3a77(_0x57abdf);}else{_0x465601[_0x88fc('0x66')]=_0x10ec77?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x88fc('0x69')][_0x88fc('0x9d')];return _0x2bfdd6(msgResponse(_0x88fc('0x9e'),'Failure',_0x88fc('0x9f')+_0x10ec77+'\x20'+_0x55ea30+'\x20Interval\x20is\x20overtime:\x20'+util[_0x88fc('0x63')](_0x270db9,{'showHidden':![],'depth':null})+_0x88fc('0xa0')+_0x4580fc));}})['catch'](function(_0x28e4b8){return _0x2bfdd6(msgResponse(_0x88fc('0x8d'),_0x88fc('0x8e'),JSON[_0x88fc('0x70')](_0x28e4b8)));});});};Dialer[_0x88fc('0x1a')][_0x88fc('0x3f')]=function(){var _0x325666=this;return cmHopper[_0x88fc('0xa1')]({'active':![]},{'where':{'active':!![]}})[_0x88fc('0x9b')](function(){setInterval(function(){_0x325666[_0x88fc('0xa2')]();},0x3e8);});};Dialer[_0x88fc('0x1a')][_0x88fc('0xa2')]=function(){var _0xd75820=this;var _0x3fb34d;for(var _0x20e559 in this[_0x88fc('0x20')]){if(typeof this['campaigns'][_0x20e559]!==_0x88fc('0xa3')){_0x3fb34d=this['campaigns'][_0x20e559];if(utils[_0x88fc('0x7a')](_0x3fb34d)&&utils[_0x88fc('0x77')](_0x3fb34d)){_0x3fb34d[_0x88fc('0x7c')]=!![];Promise[_0x88fc('0xa4')]()[_0x88fc('0x9b')](checkIsIVRCampaignActive(_0x3fb34d))[_0x88fc('0x9b')](checkInterval(_0x3fb34d))[_0x88fc('0x9b')](_0xd75820[_0x88fc('0xa5')](_0x3fb34d))['then'](_0xd75820[_0x88fc('0x8a')](_0x3fb34d[_0x88fc('0xa6')],_0x3fb34d['dialTimezone'],_0x3fb34d[_0x88fc('0x47')],_0x3fb34d))[_0x88fc('0x9b')](_0xd75820[_0x88fc('0x8c')](_0x3fb34d['Interval'],_0x3fb34d['dialTimezone'],_0x3fb34d['name'],_0x3fb34d))[_0x88fc('0x9b')](_0xd75820[_0x88fc('0xa7')](_0x3fb34d))[_0x88fc('0x98')](loggerCatchQueueSummary(_0x88fc('0xa8'),_0x3fb34d));}else{notSendMessagesCampaign(_0x3fb34d);}}}};Dialer[_0x88fc('0x1a')][_0x88fc('0xa9')]=function(_0x3cf9cc){if(_0x3cf9cc[_0x88fc('0xaa')]!==_0x88fc('0xa')){clearPredictiveAttributes(_0x3cf9cc);}switch(_0x3cf9cc[_0x88fc('0xaa')]){case _0x88fc('0xab'):this[_0x88fc('0xac')](_0x3cf9cc,0x1);break;case _0x88fc('0xad'):this[_0x88fc('0xac')](_0x3cf9cc,_0x3cf9cc[_0x88fc('0xae')]);break;case'predictive':this[_0x88fc('0xa')](_0x3cf9cc);break;case _0x88fc('0xaf'):this[_0x88fc('0xac')](_0x3cf9cc,0x1);break;default:logger['error'](_0x88fc('0xb0'),_0x3cf9cc[_0x88fc('0x47')],_0x88fc('0xb1'));}};Dialer[_0x88fc('0x1a')][_0x88fc('0x8d')]=function(_0x6db131,_0x47b54b){var _0x193375=_0x6db131[_0x88fc('0xb2')];var _0x22bf6c=_0x47b54b?_0x6db131[_0x88fc('0xa6')]:_0x6db131[_0x88fc('0x72')][_0x88fc('0x75')];logger[_0x88fc('0xb3')](_0x88fc('0xb4'),_0x22bf6c,_0x193375,_0x6db131[_0x88fc('0x47')],util['format'](_0x88fc('0xb5'),_0x6db131['name'],_0x6db131['id']));var _0x34908f=null;return Interval[_0x88fc('0xb6')](_0x22bf6c,_0x193375)[_0x88fc('0x9b')](function(_0x113592){if(_0x113592===!![]){return _0x113592;}else{_0x6db131[_0x88fc('0x66')]=_0x47b54b?utils[_0x88fc('0x69')][_0x88fc('0xb7')]:utils[_0x88fc('0x69')][_0x88fc('0x9d')];_0x34908f=msgResponse(_0x88fc('0x9e'),_0x88fc('0x8e'),'Global:\x20'+_0x47b54b+'\x20'+_0x6db131[_0x88fc('0x47')]+_0x88fc('0xb8')+util[_0x88fc('0x63')](_0x22bf6c,{'showHidden':![],'depth':null})+_0x88fc('0xa0')+_0x193375);}if(_0x34908f!==null){logger['silly'](_0x88fc('0xb9'),_0x34908f);_0x34908f['isGlobal']=_0x47b54b;throw _0x34908f;}})[_0x88fc('0x98')](function(_0xe56d6e){logger[_0x88fc('0x61')](_0x88fc('0xba'),_0xe56d6e);throw msgResponse(_0x88fc('0xbb'),_0x88fc('0x80'),util[_0x88fc('0x63')](_0xe56d6e,{'showHidden':![],'depth':null}));});};Dialer[_0x88fc('0x1a')]['syncAgentConnect']=function(_0x50ace7){if(this[_0x88fc('0x1f')][_0x50ace7[_0x88fc('0xbc')]]){if(this[_0x88fc('0x27')][_0x50ace7[_0x88fc('0xbd')]]&&this[_0x88fc('0x27')][_0x50ace7[_0x88fc('0xbd')]][_0x88fc('0x43')]!==_0x88fc('0xbe')){this['updateOriginated'](this[_0x88fc('0x1f')][_0x50ace7[_0x88fc('0xbc')]]);this[_0x88fc('0x27')][_0x50ace7['uniqueid']]['answertime']=moment()['format'](_0x88fc('0xbf'));}}};Dialer[_0x88fc('0x1a')][_0x88fc('0x35')]=function(_0x177e01){var _0x426faf=this['uniqueId'][_0x177e01[_0x88fc('0xbd')]];if(this[_0x88fc('0x1f')][_0x177e01[_0x88fc('0xbc')]]){if(_0x426faf&&_0x426faf['type']!==_0x88fc('0xbe')){delete this[_0x88fc('0x27')][_0x177e01[_0x88fc('0xbd')]];this[_0x88fc('0x1f')][_0x177e01[_0x88fc('0xbc')]][_0x88fc('0xc0')]+=0x1;var _0x4166aa=new AgentComplete(_0x426faf,_0x177e01);if(_0x177e01[_0x88fc('0xc1')]===_0x88fc('0xc2')){_0x4166aa[_0x88fc('0xc3')]=this[_0x88fc('0x1f')][_0x177e01[_0x88fc('0xbc')]][_0x88fc('0xc4')]&&this[_0x88fc('0x1f')][_0x177e01[_0x88fc('0xbc')]][_0x88fc('0xc5')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x88fc('0xc6')](_0x4166aa)[_0x88fc('0x98')](loggerCatch(_0x88fc('0xc7')));hopperUtils[_0x88fc('0xc8')](_0x4166aa)[_0x88fc('0x98')](loggerCatch(_0x88fc('0xc9')));}}};Dialer[_0x88fc('0x1a')][_0x88fc('0x32')]=function(_0x382d1d){var _0x9bc9a=this[_0x88fc('0x27')][_0x382d1d[_0x88fc('0xbd')]];var _0x536897=this;var _0x600a02=![];var _0x2604ef;var _0x4db8db;if(this[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]]){if(_0x9bc9a&&_0x9bc9a['type']!==_0x88fc('0xbe')){delete this[_0x88fc('0x27')][_0x382d1d[_0x88fc('0xbd')]];this['updateOriginated'](this[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]]);_0x9bc9a[_0x88fc('0xca')]=moment()[_0x88fc('0x45')](_0x88fc('0xbf'));var _0xc8d85=new QueueCallerAbandon(_0x9bc9a,_0x382d1d);if(utils[_0x88fc('0x5e')](_0x9bc9a['droptime'],_0x9bc9a[_0x88fc('0xcb')])>=_0x9bc9a[_0x88fc('0xcc')]){this[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xcd')]+=0x1;this[_0x88fc('0x1f')][_0x382d1d['queue']]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x382d1d['queue']][_0x88fc('0xce')]+=0x1;_0xc8d85['state']=0xa;_0xc8d85[_0x88fc('0xcf')]=_0x88fc('0xd0');_0xc8d85[_0x88fc('0xd1')]=_0x88fc('0xd2');_0xc8d85[_0x88fc('0xc3')]=this['voiceQueues'][_0x382d1d['queue']][_0x88fc('0xc4')]?moment()[_0x88fc('0x45')](_0x88fc('0xbf')):undefined;_0xc8d85[_0x88fc('0xd3')]+=0x1;_0xc8d85['countglobal']+=0x1;_0x2604ef=this['voiceQueues'][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xd4')];_0x4db8db=this[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xd5')];hopperUtils['verifyAdditionalPhones'](_0xc8d85,_0xc8d85[_0x88fc('0x6b')],_0x9bc9a[_0x88fc('0xd6')])[_0x88fc('0x9b')](function(_0x5e2ff6){_0x600a02=_0x5e2ff6[_0x88fc('0xd7')]==0x1;if(_0xc8d85['countdropretry']>=_0x536897[_0x88fc('0x1f')][_0x382d1d['queue']]['dialDropMaxRetry']){_0x536897[_0x88fc('0xd8')](_0xc8d85,_0x5e2ff6[_0x88fc('0xd7')]);}else{hopperUtils[_0x88fc('0xd9')]({'active':![],'countdropretry':_0xc8d85[_0x88fc('0xd3')],'scheduledat':moment()[_0x88fc('0xda')](_0x536897[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xd4')],_0x88fc('0xdb'))[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0x9bc9a[_0x88fc('0xdc')],'ListId':_0x9bc9a['ListId'],'VoiceQueueId':_0x9bc9a['VoiceQueueId']||undefined,'CampaignId':_0x9bc9a[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0xde')));var _0x2dd782=new History(_0xc8d85);_0x2dd782[_0x88fc('0x6b')]=0xa;_0x2dd782[_0x88fc('0xcf')]=_0x88fc('0xd0');_0x2dd782['starttime']=moment()[_0x88fc('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x2dd782['endtime']=_0x2dd782[_0x88fc('0x6d')];_0x2dd782['calleridname']=_0xc8d85[_0x88fc('0xdf')];_0x2dd782[_0x88fc('0xe0')]=_0xc8d85[_0x88fc('0xe0')];hopperUtils[_0x88fc('0xc6')](_0x2dd782)[_0x88fc('0x98')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x88fc('0x9b')](function(){if(_0x600a02)hopperUtils[_0x88fc('0xe1')](_0xc8d85,_0x2604ef,_0x4db8db)['then'](function(){return 0x1;});});}else{this[_0x88fc('0x1f')][_0x382d1d['queue']][_0x88fc('0x4f')]+=0x1;this['voiceQueues'][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xe2')]+=0x1;_0xc8d85[_0x88fc('0x6b')]=0xb;_0xc8d85[_0x88fc('0xcf')]=_0x88fc('0xe3');_0xc8d85[_0x88fc('0xd1')]=_0x88fc('0xe4');_0xc8d85['countabandonedretry']+=0x1;_0xc8d85[_0x88fc('0xe5')]+=0x1;_0x2604ef=this['voiceQueues'][_0x382d1d[_0x88fc('0xbc')]]['dialAbandonedRetryFrequency'];_0x4db8db=this[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xd5')];hopperUtils[_0x88fc('0xe6')](_0xc8d85,_0xc8d85[_0x88fc('0x6b')],_0x9bc9a[_0x88fc('0xd6')])[_0x88fc('0x9b')](function(_0x5097aa){if(_0xc8d85[_0x88fc('0xe7')]>=_0x536897[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xe8')]){_0x536897[_0x88fc('0xd8')](_0xc8d85,_0x5097aa['additional']);}else{hopperUtils[_0x88fc('0xd9')]({'active':![],'countabandonedretry':_0xc8d85['countabandonedretry'],'scheduledat':moment()[_0x88fc('0xda')](_0x536897[_0x88fc('0x1f')][_0x382d1d[_0x88fc('0xbc')]][_0x88fc('0xe9')],_0x88fc('0xdb'))[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0x9bc9a[_0x88fc('0xdc')],'ListId':_0x9bc9a[_0x88fc('0xea')],'VoiceQueueId':_0x9bc9a['VoiceQueueId']||undefined,'CampaignId':_0x9bc9a[_0x88fc('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4a9e31=new History(_0xc8d85);_0x4a9e31[_0x88fc('0x6b')]=0xb;_0x4a9e31[_0x88fc('0xcf')]='Abandoned';_0x4a9e31[_0x88fc('0x6d')]=moment()['format'](_0x88fc('0xbf'));_0x4a9e31['endtime']=_0x4a9e31[_0x88fc('0x6d')];_0x4a9e31[_0x88fc('0xdf')]=_0xc8d85[_0x88fc('0xdf')];_0x4a9e31[_0x88fc('0xe0')]=_0xc8d85['calleridnum'];hopperUtils[_0x88fc('0xc6')](_0x4a9e31)[_0x88fc('0x98')](loggerCatch(_0x88fc('0xeb')));}})[_0x88fc('0x9b')](function(){if(_0x600a02)hopperUtils[_0x88fc('0xe1')](_0xc8d85,_0x2604ef,_0x4db8db)[_0x88fc('0x9b')](function(){return 0x1;});});}}}};Dialer[_0x88fc('0x1a')]['syncNewExten']=function(_0x3c653e){if(this[_0x88fc('0x25')][_0x3c653e['uniqueid']]){this[_0x88fc('0x25')][_0x3c653e[_0x88fc('0xbd')]][_0x88fc('0xec')]=_0x3c653e[_0x88fc('0xec')];}if(this[_0x88fc('0x27')][_0x3c653e['uniqueid']]){this['uniqueId'][_0x3c653e[_0x88fc('0xbd')]][_0x88fc('0xec')]=_0x3c653e[_0x88fc('0xec')];}};Dialer[_0x88fc('0x1a')][_0x88fc('0x3d')]=function(_0x369c3a){if(!this[_0x88fc('0x25')][_0x369c3a['actionid']]){return;}var _0x58e100=this['voiceQueues'][this[_0x88fc('0x25')][_0x369c3a[_0x88fc('0xed')]][_0x88fc('0xbc')]][_0x88fc('0xee')]||_0x88fc('0xef');if(_0x58e100===_0x88fc('0xf0')){if(this[_0x88fc('0x25')][_0x369c3a['actionid']]&&_[_0x88fc('0xf1')](this[_0x88fc('0x25')][_0x369c3a['actionid']]['locked'])&&_0x369c3a[_0x88fc('0x83')]==='1'&&_0x369c3a[_0x88fc('0xf2')]==='0'){if(this[_0x88fc('0x21')][_0x369c3a[_0x88fc('0xf3')]]){if(!this['agents'][_0x369c3a[_0x88fc('0xf3')]]['locked']){this[_0x88fc('0x21')][_0x369c3a[_0x88fc('0xf3')]][_0x88fc('0xf4')]=!![];this[_0x88fc('0x25')][_0x369c3a[_0x88fc('0xed')]][_0x88fc('0xf4')]=!![];this[_0x88fc('0x25')][_0x369c3a[_0x88fc('0xed')]][_0x88fc('0xf3')]=_0x369c3a[_0x88fc('0xf3')];}}}}else if(_0x58e100===_0x88fc('0xef')){if(this['actions'][_0x369c3a[_0x88fc('0xed')]]){if(this['agents'][_0x369c3a[_0x88fc('0xf3')]]){this[_0x88fc('0x25')][_0x369c3a['actionid']][_0x88fc('0xf3')]=_0x369c3a['stateinterface'];if(_[_0x88fc('0xf1')](this[_0x88fc('0xf5')][this['actions'][_0x369c3a[_0x88fc('0xed')]][_0x88fc('0xbc')]])){this[_0x88fc('0xf5')][this[_0x88fc('0x25')][_0x369c3a[_0x88fc('0xed')]][_0x88fc('0xbc')]]=[];}this[_0x88fc('0xf5')][this[_0x88fc('0x25')][_0x369c3a['actionid']][_0x88fc('0xbc')]][_0x88fc('0x93')](_['merge'](_[_0x88fc('0x71')](this[_0x88fc('0x25')][_0x369c3a[_0x88fc('0xed')]],[_0x88fc('0xf6'),'stateinterface']),{'status':_0x369c3a[_0x88fc('0x83')],'paused':_0x369c3a[_0x88fc('0xf2')]}));}}}};Dialer[_0x88fc('0x1a')][_0x88fc('0x3e')]=function(_0x2c1f50){if(!this[_0x88fc('0x25')][_0x2c1f50['actionid']]){return;}var _0x3c75c7=this;var _0x333d99=this[_0x88fc('0x1f')][this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xbc')]];var _0x3f60e4=_0x333d99[_0x88fc('0xee')]||_0x88fc('0xef');if(_0x3f60e4===_0x88fc('0xf0')){if(this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]]&&this['actions'][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xf3')]){this['preview'][_0x88fc('0xf7')](this[_0x88fc('0x25')][_0x2c1f50['actionid']][_0x88fc('0xf6')],this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xf3')])['catch'](function(_0x14997b){logger[_0x88fc('0x61')](_0x88fc('0xf8'),util['inspect'](_0x14997b,{'showHidden':![],'depth':null}));})['finally'](function(){_0x3c75c7[_0x88fc('0xf9')](_0x3c75c7[_0x88fc('0x1f')][_0x3c75c7['actions'][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xbc')]]);_0x3c75c7['agents'][_0x3c75c7[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xf3')]]['locked']=![];delete _0x3c75c7[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]];unlockQueueStatus(_0x333d99);});}else{this['updateOriginated'](this['voiceQueues'][this['actions'][_0x2c1f50[_0x88fc('0xed')]]['queue']]);hopperUtils[_0x88fc('0xd9')]({'active':![],'ContactId':this['actions'][_0x2c1f50['actionid']][_0x88fc('0xdc')],'ListId':this['actions'][_0x2c1f50[_0x88fc('0xed')]]['ListId'],'VoiceQueueId':this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0xfa')));delete this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]];unlockQueueStatus(_0x333d99);}}else if(_0x3f60e4===_0x88fc('0xef')){var _0x22b9d8;if(this['actions'][_0x2c1f50['actionid']]&&!_[_0x88fc('0x76')](this[_0x88fc('0xf5')][this[_0x88fc('0x25')][_0x2c1f50['actionid']]['queue']])){if(this['queueBookedRR'][_0x3c75c7['actions'][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xbc')]]){this[_0x88fc('0x2c')][_0x3c75c7[_0x88fc('0x25')][_0x2c1f50['actionid']][_0x88fc('0xbc')]]=this[_0x88fc('0x2c')][this[_0x88fc('0x25')][_0x2c1f50['actionid']][_0x88fc('0xbc')]]?this[_0x88fc('0x2c')][this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xbc')]]:this['queueBooked'][this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]]['queue']]?this[_0x88fc('0xf5')][this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xbc')]][_0x88fc('0xfb')]||0x0:0x0;}this[_0x88fc('0xf5')][this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]]['queue']][_0x88fc('0xfb')]=this[_0x88fc('0x2c')][this[_0x88fc('0x25')][_0x2c1f50[_0x88fc('0xed')]][_0x88fc('0xbc')]];for(var _0x265788=0x0;_0x265788=_0x5e9872['dialGlobalMaxRetry']){_0x313418[_0x88fc('0x11f')](_0x58f67f,_0x2c19b2,_0x34ada3,_0x88fc('0x120'));}else{if(_0x58f67f[_0x88fc('0x119')]>=_0x5e9872[_0x88fc('0x121')]){_0x313418[_0x88fc('0x122')](_0x58f67f,_0x2c19b2,_0x34ada3,_0x88fc('0x123'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x58f67f[_0x88fc('0x119')],'scheduledat':moment()['add'](_0x5e9872[_0x88fc('0x124')],_0x88fc('0xdb'))[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0x58f67f[_0x88fc('0xdc')],'ListId':_0x58f67f['ListId'],'VoiceQueueId':_0x58f67f['VoiceQueueId']||undefined,'CampaignId':_0x58f67f[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x125')));_0x2c19b2({'reschedule':0x1});}}});}if(_0x3b64b1[_0x88fc('0x43')]==='ivr'&&this[_0x88fc('0x20')][_0x3b64b1[_0x88fc('0xbc')]][_0x88fc('0x116')]&&_0x33eb01[_0x88fc('0x10c')]===_0x88fc('0x10d')){delete this[_0x88fc('0x27')][_0x33eb01['uniqueid']];this[_0x88fc('0xf9')](this['campaigns'][_0x3b64b1[_0x88fc('0xbc')]]);_0x2b6587=new Hangup(_0x3b64b1,_0x33eb01);_0x2b6587['state']=0x12;_0x2b6587[_0x88fc('0xcf')]='HangupInAMD';_0x2b6587[_0x88fc('0x118')]=_0x88fc('0x10f');ami[_0x88fc('0x42')](_0x88fc('0x110'),ut[_0x88fc('0x111')](_0x2b6587,'amd'));this[_0x88fc('0x113')](_0x2b6587,_0x88fc('0x126'),'[syncHangupInAMDIvr]');}if(_0x3b64b1[_0x88fc('0x43')]===_0x88fc('0xbe')&&this[_0x88fc('0x20')][_0x3b64b1[_0x88fc('0xbc')]]['dialAMDActive']&&_0x33eb01[_0x88fc('0x10c')]===_0x88fc('0x127')){return new Promise(function(_0x213a26,_0x4d51c7){delete _0x313418[_0x88fc('0x27')][_0x33eb01[_0x88fc('0xbd')]];_0x313418[_0x88fc('0xf9')](_0x313418[_0x88fc('0x20')][_0x3b64b1[_0x88fc('0xbc')]]);_0x313418[_0x88fc('0x20')][_0x3b64b1[_0x88fc('0xbc')]][_0x88fc('0xc0')]+=0x1;_0x313418[_0x88fc('0x20')][_0x3b64b1[_0x88fc('0xbc')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x5a29dd=_0x313418['campaigns'][_0x3b64b1[_0x88fc('0xbc')]];var _0xea91a6=new Hangup(_0x3b64b1,_0x33eb01);_0xea91a6[_0x88fc('0x6b')]=0x13;_0xea91a6['statedesc']=_0x88fc('0x117');_0xea91a6[_0x88fc('0x118')]=_0x88fc('0x10f');_0xea91a6[_0x88fc('0x119')]+=0x1;_0xea91a6['countglobal']+=0x1;_0xea91a6[_0x88fc('0x112')]=!![];ami[_0x88fc('0x42')](_0x88fc('0x110'),ut[_0x88fc('0x111')](_0xea91a6,_0x88fc('0x112')));hopperUtils['createHistory'](_0xea91a6)['catch'](loggerCatch(_0x88fc('0x11a')));if(_0xea91a6[_0x88fc('0x128')]+_0xea91a6[_0x88fc('0x11b')]+_0xea91a6['countnoanswerretry']+_0xea91a6['countnosuchnumberretry']+_0xea91a6['countdropretry']+_0xea91a6[_0x88fc('0xe7')]+_0xea91a6[_0x88fc('0x119')]+_0xea91a6['countagentrejectretry']>=_0x5a29dd[_0x88fc('0x129')]){_0x313418[_0x88fc('0x11f')](_0xea91a6,_0x213a26,_0x4d51c7,'reason19\x20machine....');}else{if(_0xea91a6[_0x88fc('0x119')]>=_0x5a29dd['dialMachineMaxRetry']){_0x313418[_0x88fc('0x122')](_0xea91a6,_0x213a26,_0x4d51c7,_0x88fc('0x123'));}else{hopperUtils[_0x88fc('0xd9')]({'active':![],'countmachineretry':_0xea91a6['countmachineretry'],'scheduledat':moment()[_0x88fc('0xda')](_0x5a29dd[_0x88fc('0x124')],_0x88fc('0xdb'))[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0xea91a6[_0x88fc('0xdc')],'ListId':_0xea91a6['ListId'],'VoiceQueueId':_0xea91a6['VoiceQueueId']||undefined,'CampaignId':_0xea91a6[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x125')));_0x213a26({'reschedule':0x1});}}});}}};Dialer[_0x88fc('0x1a')]['syncHangup']=function(_0xbc7225){var _0x7d3112=this['uniqueId'][_0xbc7225['uniqueid']];var _0x432c1b;if(_0x7d3112&&_0x7d3112[_0x88fc('0x43')]===_0x88fc('0xbe')){delete this['uniqueId'][_0xbc7225[_0x88fc('0xbd')]];this['updateOriginated'](this['campaigns'][_0x7d3112[_0x88fc('0xbc')]]);this[_0x88fc('0x20')][_0x7d3112[_0x88fc('0xbc')]]['ivrAnswerCallsDay']+=0x1;_0x432c1b=new Hangup(_0x7d3112,_0xbc7225);hopperUtils['createHistory'](_0x432c1b)[_0x88fc('0x98')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x88fc('0xc8')](_0x432c1b)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x12a')));}if(_0x7d3112&&_0x7d3112['type']!=='ivr'&&isNotNull(this[_0x88fc('0x1f')][_0x7d3112['queue']][_0x88fc('0x12b')])){delete this[_0x88fc('0x27')][_0xbc7225['uniqueid']];this['updateOriginated'](this[_0x88fc('0x1f')][_0x7d3112['queue']]);this['voiceQueues'][_0x7d3112[_0x88fc('0xbc')]][_0x88fc('0xc0')]+=0x1;this['voiceQueues'][_0x7d3112[_0x88fc('0xbc')]][_0x88fc('0x10e')]+=0x1;_0x432c1b=new Hangup(_0x7d3112,_0xbc7225);_0x432c1b[_0x88fc('0x6b')]=0x10;_0x432c1b['statedesc']='AnswerAGI';_0x432c1b[_0x88fc('0x118')]=_0x88fc('0x12c');hopperUtils[_0x88fc('0xc6')](_0x432c1b)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x12d')));hopperUtils[_0x88fc('0xc8')](_0x432c1b)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x12a')));}if(_0x7d3112&&_0x7d3112[_0x88fc('0x43')]!==_0x88fc('0xbe')&&!isNotNull(this[_0x88fc('0x1f')][_0x7d3112[_0x88fc('0xbc')]][_0x88fc('0x12b')])){delete this[_0x88fc('0x27')][_0xbc7225[_0x88fc('0xbd')]];this['updateOriginated'](this[_0x88fc('0x1f')][_0x7d3112[_0x88fc('0xbc')]]);this[_0x88fc('0x1f')][_0x7d3112[_0x88fc('0xbc')]][_0x88fc('0x12e')]+=0x1;_0x432c1b=new Hangup(_0x7d3112,_0xbc7225);_0x432c1b['state']=0xc;_0x432c1b[_0x88fc('0xcf')]=_0xbc7225[_0x88fc('0x12f')];_0x432c1b[_0x88fc('0x118')]=_0x88fc('0x130');hopperUtils[_0x88fc('0xc6')](_0x432c1b)['catch'](loggerCatch(_0x88fc('0x12d')));hopperUtils['moveContactManagedDialer'](_0x432c1b)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x12a')));}};Dialer[_0x88fc('0x1a')]['syncQueueSummary']=function(_0x449f98){var _0xad0c18=this;if(!_0xad0c18['queuesSummary'][_0x449f98[_0x88fc('0x47')]]){_0xad0c18[_0x88fc('0x2d')][_0x449f98[_0x88fc('0x47')]]={'running':![]};}else if(_0xad0c18['queuesSummary'][_0x449f98[_0x88fc('0x47')]][_0x88fc('0x131')]===!![]){return;}else if(_0xad0c18['queuesSummary'][_0x449f98[_0x88fc('0x47')]][_0x88fc('0x131')]===![]){_0xad0c18[_0x88fc('0x2d')][_0x449f98['name']][_0x88fc('0x131')]=!![];}var _0x4c53c8=_0xad0c18[_0x88fc('0x1f')][_0x449f98[_0x88fc('0x47')]];var _0x4bc594=_0x4c53c8[_0x88fc('0x66')]!==utils[_0x88fc('0x69')][_0x88fc('0x78')];var _0x5373df=utils[_0x88fc('0x132')](_0x4c53c8);_0x4c53c8[_0x88fc('0x133')]=utils[_0x88fc('0x134')](_0x4c53c8,_0xad0c18[_0x88fc('0x22')]);Promise[_0x88fc('0xa4')]()[_0x88fc('0x9b')](function(){if(_0x4c53c8[_0x88fc('0x133')]===utils[_0x88fc('0x69')][_0x88fc('0x78')]){if(_0x4bc594){clearPredictiveAttributes(_0x4c53c8);_0x449f98[_0x88fc('0x29')]=undefined;_0x449f98[_0x88fc('0x2a')]=undefined;}if(_0x4c53c8[_0x88fc('0x133')]===utils['CAMPAIGN_STATUS'][_0x88fc('0x78')]){_0x449f98['available']=0x0;_0x449f98[_0x88fc('0xf2')]=0x0;_0x449f98['inUse']=0x0;_0x449f98[_0x88fc('0x135')]=0x0;_0x449f98[_0x88fc('0x136')]=0x0;}}else if(_0x4c53c8[_0x88fc('0x133')]===utils[_0x88fc('0x69')]['ACTIVE']&&!_0x5373df){return _0xad0c18[_0x88fc('0x8d')](_0x4c53c8,!![])[_0x88fc('0x9b')](function(){return _0xad0c18[_0x88fc('0x8d')](_0x4c53c8,![]);})[_0x88fc('0x9b')](function(){return _0xad0c18[_0x88fc('0xa9')](_0x4c53c8);})['catch'](function(_0x40afb7){loggerSyncQueueSummary[_0x88fc('0x44')](_0x88fc('0x137'),util['inspect'](_0x40afb7,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4c53c8);});}else{clearPredictiveAttributes(_0x4c53c8);}})[_0x88fc('0x9b')](function(){var _0x37b5c9=_0x449f98[_0x88fc('0x138')](_0x4c53c8);if(_0x37b5c9||_0x4c53c8['queueSummaryCountersUpdated']){_0x4c53c8[_0x88fc('0x139')]=![];_0x449f98[_0x88fc('0x13a')](_0x4c53c8);Object[_0x88fc('0x13b')](_0x4c53c8,_0x449f98);emitOutboundVoiceQueueSummary(_0x449f98);}_0xad0c18['queuesSummary'][_0x4c53c8[_0x88fc('0x47')]][_0x88fc('0x131')]=![];})['catch'](function(_0x423464){logger[_0x88fc('0x61')](_0x88fc('0x137'),util['inspect'](_0x423464,{'showHidden':![],'depth':null}));_0xad0c18[_0x88fc('0x2d')][_0x4c53c8[_0x88fc('0x47')]][_0x88fc('0x131')]=![];});};Dialer['prototype'][_0x88fc('0x37')]=_['throttle'](function(){var _0x2a901c=_['filter'](this[_0x88fc('0x1f')],function(_0xab2637){return _0xab2637[_0x88fc('0x13c')];});var _0x293d1e=_[_0x88fc('0x13d')](this['agents'],function(_0x4929c4){return _0x4929c4[_0x88fc('0x13e')]&&_0x4929c4[_0x88fc('0x83')]===_0x88fc('0x84');});if(_0x2a901c[_0x88fc('0xfc')]>0x0&&_0x293d1e[_0x88fc('0xfc')]>0x0){return Promise[_0x88fc('0xa4')]()[_0x88fc('0x9b')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x2a901c,'id'),previewRecallmeReminderInterval,_[_0x88fc('0x13f')](_0x293d1e,'id')))['then'](function(_0x3e3ffb){for(var _0x38b02c=0x0;_0x38b02c<_0x3e3ffb[_0x88fc('0xfc')];_0x38b02c++){var _0x1b313e=_0x3e3ffb[_0x38b02c][_0x88fc('0x140')][_0x88fc('0x47')];if(_0x1b313e)io['to'](util['format'](_0x88fc('0x141'),_0x1b313e))[_0x88fc('0x42')](_0x88fc('0x142'),{'hopper':_0x3e3ffb[_0x38b02c]});}})[_0x88fc('0x98')](function(_0xed87be){logger[_0x88fc('0x61')](_0x88fc('0x143'),_0xed87be);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x16e955=this;setInterval(function(){_0x16e955[_0x88fc('0x144')](_0x16e955[_0x88fc('0x27')],_0x88fc('0x145'));_0x16e955[_0x88fc('0x144')](_0x16e955['actions'],_0x88fc('0x146'));},0x32c8);};Dialer[_0x88fc('0x1a')]['clearZombieChannels']=function(_0x29df9d,_0x444402){var _0x572fde=this;for(var _0x4789b7 in _0x29df9d){if(typeof _0x29df9d[_0x4789b7]!==_0x88fc('0xa3')){this[_0x88fc('0x1d')][_0x88fc('0x147')](function(){if(!_[_0x88fc('0xf1')](_0x29df9d[_0x4789b7])){return ami[_0x88fc('0x148')]({'action':'status','channel':_0x29df9d[_0x4789b7][_0x88fc('0xec')]})['catch'](function(_0x52423e){if(_0x52423e[_0x88fc('0x66')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x29df9d[_0x4789b7]&&_0x29df9d[_0x4789b7][_0x88fc('0x43')]!==_0x88fc('0xbe')){_0x572fde[_0x88fc('0xf9')](_0x572fde[_0x88fc('0x1f')][_0x29df9d[_0x4789b7][_0x88fc('0xbc')]]);logger[_0x88fc('0x61')](_0x88fc('0x149'),_0x444402,_0x4789b7,_0x29df9d[_0x4789b7][_0x88fc('0xbc')]);delete _0x29df9d[_0x4789b7];}if(_0x29df9d[_0x4789b7]&&_0x29df9d[_0x4789b7]['type']===_0x88fc('0xbe')){_0x572fde[_0x88fc('0xf9')](_0x572fde[_0x88fc('0x20')][_0x29df9d[_0x4789b7]['queue']]);logger[_0x88fc('0x61')]('[Dialer][checkChannel][ivr]',_0x444402,_0x4789b7,_0x29df9d[_0x4789b7]['queue']);delete _0x29df9d[_0x4789b7];}},0x2328);}});}});}}};Dialer[_0x88fc('0x1a')][_0x88fc('0x14a')]=function(_0x73dcf){return Promise[_0x88fc('0xa4')]()['then'](voiceQueueRt[_0x88fc('0x14a')](_0x73dcf))[_0x88fc('0x98')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x88fc('0x1a')][_0x88fc('0xf9')]=function(_0x149509){if(!_[_0x88fc('0x41')](_0x149509)&&_0x149509!==null){if(typeof _0x149509[_0x88fc('0x14b')]!==_0x88fc('0xa3')){if(_0x149509['originated']>0x0){_0x149509['originated']-=0x1;}else{logger['error'](_0x88fc('0x14c'));}}}else{logger[_0x88fc('0x61')](_0x88fc('0x14d'));}};Dialer['prototype'][_0x88fc('0x14e')]=function(_0xe63ca9,_0x24a3d2){var _0x332a9d=this;return function(_0x21c558){_0x332a9d[_0x88fc('0xf9')](_0x24a3d2);logger[_0x88fc('0x61')](_0xe63ca9,util[_0x88fc('0x63')](_0x21c558,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x298241,_0x79a50e,_0x3aeba9){var _0x540cc7={'state':0x19,'statedesc':_0x88fc('0x14f')};this[_0x88fc('0xf9')](_0x79a50e);this[_0x88fc('0x113')](_[_0x88fc('0x5d')](_0x540cc7,_[_0x88fc('0x71')](_0x3aeba9,['ContactId',_0x88fc('0xea'),'UserId',_0x88fc('0x101'),_0x88fc('0xdd')])),_0x88fc('0x150'),_0x88fc('0x151'));logger['error'](_0x298241);};Dialer['prototype'][_0x88fc('0x113')]=function(_0x39ad0d,_0x2f6cc9,_0x59d0f3){hopperUtils[_0x88fc('0xc6')](_0x39ad0d)[_0x88fc('0x98')](loggerCatch(_0x2f6cc9));hopperUtils[_0x88fc('0xc8')](_0x39ad0d)[_0x88fc('0x98')](loggerCatch(_0x59d0f3));};Dialer[_0x88fc('0x1a')]['queueCallerAbandonCreateState']=function(_0x27d54e,_0x3ecb08){hopperUtils[_0x88fc('0xc6')](_0x27d54e)[_0x88fc('0x98')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x3ecb08==0x0){hopperUtils[_0x88fc('0xc8')](_0x27d54e)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x152')));}};Dialer[_0x88fc('0x1a')][_0x88fc('0x143')]=function(_0xd6b300){return Promise[_0x88fc('0xa4')]()[_0x88fc('0x9b')](cmHopper[_0x88fc('0x153')](_0xd6b300['id'],previewRecallmeReminderInterval))[_0x88fc('0x9b')](function(_0x453ea5){for(var _0x21796c=0x0;_0x21796c<_0x453ea5['length'];_0x21796c++){var _0xd87eeb=_0x453ea5[_0x21796c]['Agent'][_0x88fc('0x47')];if(_0xd87eeb)io['to'](util['format'](_0x88fc('0x141'),_0xd87eeb))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x453ea5[_0x21796c]});}})[_0x88fc('0x98')](function(){});};Dialer[_0x88fc('0x1a')][_0x88fc('0xa7')]=function(_0x966865){var _0x12805b=this;return function(){_0x12805b[_0x88fc('0x154')](_0x966865);};};Dialer['prototype']['actionOriginate']=function(_0x7237de,_0x4dad40){var _0x5de31f=this;var _0x517240=uuid['v4']();this[_0x88fc('0x25')][_0x517240]=new Action(_0x7237de,_0x4dad40,_0x517240);return new Promise(function(_0x138038,_0x36dbbe){if(_[_0x88fc('0x41')](_0x7237de)&&typeof _0x7237de!==_0x88fc('0x155')){return _0x36dbbe(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x88fc('0x41')](_0x4dad40[_0x88fc('0x156')])||_0x4dad40[_0x88fc('0x156')]===null){return _0x36dbbe(msgResponse(_0x88fc('0x157'),_0x88fc('0x8e'),'contact\x20is\x20undefine'));}var _0x36273a={'XMD-CALLERID':_0x5de31f[_0x88fc('0x25')][_0x517240][_0x88fc('0x158')](),'XMD-AGI':_0x7237de['dialQueueProject']?util[_0x88fc('0x45')](_0x88fc('0x159'),ipAgi,_0x7237de[_0x88fc('0x12b')]):_0x88fc('0x15a'),'XMD-AGIAFTER':_0x7237de['dialQueueProject2']?util['format'](_0x88fc('0x159'),ipAgi,_0x7237de[_0x88fc('0xc4')]):_0x88fc('0x15a'),'XMD-QUEUE':utils['isOutboundQueue'](_0x7237de)?util[_0x88fc('0x45')]('\x22%s,%s%s,,,%s\x22',_0x7237de[_0x88fc('0x47')],_0x7237de['dialQueueOptions']||'',_0x7237de['dialAgiAfterHangupAgent']?'c':'',_0x7237de['dialQueueTimeout']||0x3):_0x88fc('0x15a'),'XMD-CONTACTID':_0x4dad40[_0x88fc('0xdc')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5de31f[_0x88fc('0x25')][_0x517240]['getCaller'](),'XMD-AMD':_0x7237de[_0x88fc('0x116')]?_0x88fc('0x15b'):_0x88fc('0x15a'),'XMD-DESTINATION':_0x88fc('0x10b')};if(_0x7237de[_0x88fc('0x116')]){_0x36273a[_0x88fc('0x15c')]=_0x7237de[_0x88fc('0x15d')]||0x9c4;_0x36273a[_0x88fc('0x15e')]=_0x7237de[_0x88fc('0x15f')]||0x5dc;_0x36273a[_0x88fc('0x160')]=_0x7237de[_0x88fc('0x161')]||0x320;_0x36273a['XMD-AMDTOTALANALYSISTIME']=_0x7237de['dialAMDTotalAnalysisTime']||0x1388;_0x36273a[_0x88fc('0x162')]=_0x7237de[_0x88fc('0x163')]||0x64;_0x36273a[_0x88fc('0x164')]=_0x7237de['dialAMDBetweenWordsSilence']||0x32;_0x36273a[_0x88fc('0x165')]=_0x7237de[_0x88fc('0x166')]||0x3;_0x36273a[_0x88fc('0x167')]=_0x7237de[_0x88fc('0x168')]||0x100;_0x36273a[_0x88fc('0x169')]=_0x7237de[_0x88fc('0x16a')]||0x1388;}if(utils['isOutboundQueue'](_0x7237de)){_0x36273a[_0x88fc('0x16b')]=_0x4dad40[_0x88fc('0x101')];}else{_0x36273a[_0x88fc('0x16c')]=_0x4dad40[_0x88fc('0xdd')];}for(var _0x587d7d in _0x4dad40['Contact']){if(typeof _0x4dad40[_0x88fc('0x16d')][_0x587d7d]!==_0x88fc('0xa3')){if(isNotNull(_0x4dad40[_0x88fc('0x16d')][_0x587d7d])&&_0x587d7d!=='id'&&_0x587d7d!==_0x88fc('0x16e')&&_0x587d7d!=='createdAt'&&_0x587d7d!==_0x88fc('0x16f')){_0x36273a[util[_0x88fc('0x45')]('%s%s',_0x88fc('0x170'),_['toUpper'](_0x587d7d))]=_0x4dad40[_0x88fc('0x16d')][_0x587d7d];}}}var _0xd7b091=_0x5de31f[_0x88fc('0x86')](_0x7237de[_0x88fc('0x87')])?utils[_0x88fc('0x171')](_0x7237de[_0x88fc('0x87')][_0x88fc('0x172')],_0x7237de[_0x88fc('0x173')],_0x7237de[_0x88fc('0x174')]>0x0?utils[_0x88fc('0x175')](_0x7237de[_0x88fc('0x176')],_0x7237de['dialRandomLastDigitCallerIdNumber']):_0x7237de['dialOriginateCallerIdNumber']):utils['getCallerId'](_[_0x88fc('0xf1')](_0x7237de[_0x88fc('0x177')])?_0x7237de['Trunk'][_0x88fc('0x172')]:_0x7237de[_0x88fc('0x177')][_0x88fc('0x172')],_0x7237de[_0x88fc('0x173')],_0x7237de[_0x88fc('0x174')]>0x0?utils[_0x88fc('0x175')](_0x7237de['dialOriginateCallerIdNumber'],_0x7237de['dialRandomLastDigitCallerIdNumber']):_0x7237de[_0x88fc('0x176')]);if(_0xd7b091){_0x36273a[_0x88fc('0x178')]=_0x5de31f[_0x88fc('0x25')][_0x517240]['originatecalleridname']=utils[_0x88fc('0x179')](_0xd7b091);_0x36273a[_0x88fc('0x17a')]=_0x4dad40[_0x88fc('0x156')];}_0x7237de[_0x88fc('0x17b')]=_0x36273a;return ami[_0x88fc('0x148')]({'actionid':_0x517240,'action':_0x88fc('0x157'),'channel':_0x5de31f['isTrunkReachable'](_0x7237de['Trunk'])?util[_0x88fc('0x45')](_0x88fc('0x17c'),_0x7237de[_0x88fc('0x87')][_0x88fc('0x47')],isNotNull(_0x7237de[_0x88fc('0x17d')])?_0x7237de[_0x88fc('0x17d')][_0x88fc('0x17e')]()||'':'',_0x7237de[_0x88fc('0x17f')]>0x0?_0x4dad40[_0x88fc('0x156')]['substring'](_0x7237de['dialCutDigit']):_0x4dad40[_0x88fc('0x156')]):util[_0x88fc('0x45')](_0x88fc('0x17c'),_[_0x88fc('0xf1')](_0x7237de[_0x88fc('0x177')])?_0x7237de[_0x88fc('0x87')][_0x88fc('0x47')]:_0x7237de[_0x88fc('0x177')][_0x88fc('0x47')],isNotNull(_0x7237de['dialPrefix'])?_0x7237de[_0x88fc('0x17d')][_0x88fc('0x17e')]()||'':'',_0x7237de[_0x88fc('0x17f')]>0x0?_0x4dad40[_0x88fc('0x156')][_0x88fc('0x180')](_0x7237de[_0x88fc('0x17f')]):_0x4dad40['phone']),'callerid':_0xd7b091,'Exten':_0x88fc('0x10b'),'Context':_0x88fc('0x181'),'Priority':'1','variable':_0x36273a,'timeout':(_0x7237de[_0x88fc('0x182')]||0x1e)*0x3e8,'async':!![],'channelid':_0x517240})[_0x88fc('0x9b')](function(_0x4ac65d){return _0x138038(_0x4ac65d);})[_0x88fc('0x98')](function(_0x367866){_0x7237de['outboundOriginateFailureCallsDay']+=0x1;var _0x37237d=new History(_0x5de31f[_0x88fc('0x25')][_0x517240]);logger[_0x88fc('0x61')](util[_0x88fc('0x45')](_0x88fc('0x183'),JSON[_0x88fc('0x70')](_0x367866)));_0x37237d[_0x88fc('0x6b')]=0xe;_0x37237d[_0x88fc('0xcf')]='OriginateError';_0x37237d[_0x88fc('0x6d')]=moment()[_0x88fc('0x45')](_0x88fc('0xbf'));_0x37237d['endtime']=_0x37237d[_0x88fc('0x6d')];hopperUtils[_0x88fc('0xc6')](_0x37237d)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x184')));_0x5de31f[_0x88fc('0xc8')](_0x37237d)[_0x88fc('0x98')](loggerCatch('[originate][error]'))[_0x88fc('0x1c')](function(){delete _0x5de31f[_0x88fc('0x25')][_0x517240];return _0x36dbbe(msgResponse('originate','Error',_0x88fc('0x185')));});});});};Dialer[_0x88fc('0x1a')][_0x88fc('0x186')]=function(_0x3c1cf4,_0x4b7b0e,_0x2efcbf){var _0x43a4e0=new History(_0x4b7b0e);if(_0x43a4e0[_0x88fc('0x128')]+_0x43a4e0[_0x88fc('0x11b')]+_0x43a4e0[_0x88fc('0x11c')]+_0x43a4e0['countnosuchnumberretry']+_0x43a4e0[_0x88fc('0xd3')]+_0x43a4e0[_0x88fc('0xe7')]+_0x43a4e0[_0x88fc('0x119')]+_0x43a4e0[_0x88fc('0x11e')]>=_0x2efcbf[_0x88fc('0x129')]-0x1){return!![];}switch(_0x3c1cf4){case 0x3:if(_0x43a4e0[_0x88fc('0x11c')]>=_0x2efcbf[_0x88fc('0x187')]-0x1){return!![];}hopperUtils[_0x88fc('0xd9')]({'active':![],'countnoanswerretry':_0x43a4e0[_0x88fc('0x11c')]+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf['dialNoAnswerRetryFrequency'],'minutes')['format'](_0x88fc('0xbf')),'ContactId':_0x43a4e0['ContactId'],'ListId':_0x43a4e0[_0x88fc('0xea')],'VoiceQueueId':_0x43a4e0[_0x88fc('0x101')]||undefined,'CampaignId':_0x43a4e0[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x188')));break;case 0x5:if(_0x43a4e0[_0x88fc('0x128')]>=_0x2efcbf['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x88fc('0xd9')]({'active':![],'countbusyretry':_0x43a4e0[_0x88fc('0x128')]+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf[_0x88fc('0x189')],_0x88fc('0xdb'))['format'](_0x88fc('0xbf')),'ContactId':_0x43a4e0[_0x88fc('0xdc')],'ListId':_0x43a4e0[_0x88fc('0xea')],'VoiceQueueId':_0x43a4e0[_0x88fc('0x101')]||undefined,'CampaignId':_0x43a4e0['CampaignId']||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x18a')));break;case 0x8:if(_0x43a4e0[_0x88fc('0x11b')]>=_0x2efcbf[_0x88fc('0x18b')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x43a4e0[_0x88fc('0x11b')]+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf[_0x88fc('0x18c')],_0x88fc('0xdb'))[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0x43a4e0['ContactId'],'ListId':_0x43a4e0[_0x88fc('0xea')],'VoiceQueueId':_0x43a4e0[_0x88fc('0x101')]||undefined,'CampaignId':_0x43a4e0[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x18d')));break;case 0x0:if(_0x43a4e0[_0x88fc('0x11d')]>=_0x2efcbf[_0x88fc('0x18e')]-0x1){return!![];}else{hopperUtils[_0x88fc('0xd9')]({'active':![],'countnosuchnumberretry':_0x43a4e0[_0x88fc('0x11d')]+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf['dialNoSuchNumberRetryFrequency'],'minutes')[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0x43a4e0[_0x88fc('0xdc')],'ListId':_0x43a4e0[_0x88fc('0xea')],'VoiceQueueId':_0x43a4e0['VoiceQueueId']||undefined,'CampaignId':_0x43a4e0[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x18f')));}break;case 0xa:if(_0x43a4e0['countdropretry']>=_0x2efcbf[_0x88fc('0x190')]-0x1){return!![];}hopperUtils[_0x88fc('0xd9')]({'active':![],'countdropretry':_0x43a4e0[_0x88fc('0xd3')]+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf[_0x88fc('0xd4')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x43a4e0['ContactId'],'ListId':_0x43a4e0['ListId'],'VoiceQueueId':_0x43a4e0[_0x88fc('0x101')]||undefined,'CampaignId':_0x43a4e0[_0x88fc('0xdd')]||undefined})['catch'](loggerCatch(_0x88fc('0xde')));break;case 0xb:if(_0x43a4e0[_0x88fc('0xe7')]>=_0x2efcbf[_0x88fc('0xe8')]-0x1){return!![];}hopperUtils[_0x88fc('0xd9')]({'active':![],'countabandonedretry':_0x43a4e0[_0x88fc('0xe7')]+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf[_0x88fc('0xe9')],_0x88fc('0xdb'))[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0x43a4e0['ContactId'],'ListId':_0x43a4e0[_0x88fc('0xea')],'VoiceQueueId':_0x43a4e0[_0x88fc('0x101')]||undefined,'CampaignId':_0x43a4e0[_0x88fc('0xdd')]||undefined})['catch'](loggerCatch(_0x88fc('0x191')));break;case 0x13:if(_0x43a4e0['countmachineretry']>=_0x2efcbf[_0x88fc('0x121')]-0x1){return!![];}hopperUtils[_0x88fc('0xd9')]({'active':![],'countmachineretry':_0x43a4e0[_0x88fc('0x119')]+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf[_0x88fc('0x124')],'minutes')[_0x88fc('0x45')](_0x88fc('0xbf')),'ContactId':_0x43a4e0[_0x88fc('0xdc')],'ListId':_0x43a4e0['ListId'],'VoiceQueueId':_0x43a4e0[_0x88fc('0x101')]||undefined,'CampaignId':_0x43a4e0['CampaignId']||undefined})['catch'](loggerCatch(_0x88fc('0x125')));break;case 0x14:if(_0x43a4e0[_0x88fc('0x11e')]>=_0x2efcbf[_0x88fc('0x192')]-0x1){return!![];}hopperUtils[_0x88fc('0xd9')]({'active':![],'countagentrejectretry':_0x43a4e0['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x88fc('0xda')](_0x2efcbf['dialAgentRejectRetryFrequency'],_0x88fc('0xdb'))[_0x88fc('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x43a4e0[_0x88fc('0xdc')],'ListId':_0x43a4e0['ListId'],'VoiceQueueId':_0x43a4e0[_0x88fc('0x101')]||undefined,'CampaignId':_0x43a4e0[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x193')));break;default:return!![];}};Dialer[_0x88fc('0x1a')][_0x88fc('0x194')]=function(_0x37a3de,_0x7744f7,_0x729d24){var _0x334192=this;var _0x5d6839=new History(_0x37a3de);var _0x492831=![];var _0x49897f;var _0x5a47bb;return new Promise(function(_0x201939,_0xb2dc18){if(_[_0x88fc('0x41')](_0x7744f7)&&typeof _0x7744f7!==_0x88fc('0x155')){return _0xb2dc18(msgResponse(_0x88fc('0x195'),_0x88fc('0x8e'),_0x88fc('0x196')));}if(_[_0x88fc('0x41')](_0x729d24)&&typeof _0x729d24!==_0x88fc('0x155')){return _0xb2dc18(msgResponse('[callProgressDetecting]',_0x88fc('0x8e'),'evt\x20is\x20undefine'));}hopperUtils[_0x88fc('0xe6')](_0x5d6839,_0x729d24[_0x88fc('0xc1')],_0x7744f7)[_0x88fc('0x9b')](function(_0x51a074){if(_0x51a074['additional']==0x1)_0x492831=!![];switch(_0x729d24[_0x88fc('0xc1')]){case'0':_0x7744f7[_0x88fc('0x197')]+=0x1;_0x5d6839[_0x88fc('0x6b')]=0x0;_0x5d6839[_0x88fc('0xcf')]='NoSuchNumber';_0x5d6839['countnosuchnumberretry']+=0x1;_0x5d6839[_0x88fc('0xe5')]+=0x1;ami['emit'](_0x88fc('0x198'),ut[_0x88fc('0x111')](_0x37a3de,_0x88fc('0x199')));_0x49897f=_0x7744f7['dialNoSuchNumberRetryFrequency'];_0x5a47bb=_0x7744f7[_0x88fc('0xd5')];hopperUtils[_0x88fc('0xc6')](_0x5d6839)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x11a')));if(_0x334192['checkRetriveMax'](0x0,_0x37a3de,_0x7744f7)&&!_0x492831){if(_0x5d6839['countnosuchnumberretry']>=_0x7744f7[_0x88fc('0x18e')]){_0x334192['createStateFinal'](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x19a'));}else{_0x334192[_0x88fc('0x11f')](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x19a'));}}break;case'3':_0x7744f7[_0x88fc('0x19b')]+=0x1;_0x5d6839[_0x88fc('0x6b')]=0x3;_0x5d6839[_0x88fc('0xcf')]=_0x88fc('0x19c');_0x5d6839['countnoanswerretry']+=0x1;_0x5d6839[_0x88fc('0xe5')]+=0x1;var _0x3cbc07=ut['buildNoAnswerEventPayload'](_0x37a3de,_0x7744f7);ami[_0x88fc('0x42')](_0x88fc('0x19d'),_0x3cbc07);_0x49897f=_0x7744f7[_0x88fc('0x19e')];_0x5a47bb=_0x7744f7[_0x88fc('0xd5')];hopperUtils['createHistory'](_0x5d6839)['catch'](loggerCatch(_0x88fc('0x19f')));if(_0x334192['checkRetriveMax'](0x3,_0x37a3de,_0x7744f7)&&!_0x492831){if(_0x5d6839[_0x88fc('0x11c')]>=_0x7744f7[_0x88fc('0x187')]){_0x334192['createStateFinal'](_0x5d6839,_0x201939,_0xb2dc18,'reason\x203\x20ringing\x20no\x20answer');}else{_0x334192[_0x88fc('0x11f')](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1a0'));}}break;case'5':_0x7744f7[_0x88fc('0x1a1')]+=0x1;_0x5d6839[_0x88fc('0x6b')]=0x5;_0x5d6839[_0x88fc('0xcf')]=_0x88fc('0x1a2');_0x5d6839[_0x88fc('0x128')]+=0x1;_0x5d6839[_0x88fc('0xe5')]+=0x1;ami[_0x88fc('0x42')](_0x88fc('0x1a3'),ut['buildObj'](_0x37a3de,_0x88fc('0x1a4')));_0x49897f=_0x7744f7['dialBusyRetryFrequency'];_0x5a47bb=_0x7744f7['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x5d6839)[_0x88fc('0x98')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x334192[_0x88fc('0x186')](0x5,_0x37a3de,_0x7744f7)&&!_0x492831){if(_0x5d6839[_0x88fc('0x128')]>=_0x7744f7[_0x88fc('0x1a5')]){_0x334192[_0x88fc('0x122')](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1a6'));}else{_0x334192[_0x88fc('0x11f')](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1a6'));}}break;case'8':_0x7744f7[_0x88fc('0x1a7')]+=0x1;_0x5d6839['state']=0x8;_0x5d6839[_0x88fc('0xcf')]=_0x88fc('0x1a8');_0x5d6839[_0x88fc('0x11b')]+=0x1;_0x5d6839[_0x88fc('0xe5')]+=0x1;_0x49897f=_0x7744f7[_0x88fc('0x18c')];_0x5a47bb=_0x7744f7['callAdditionalPhoneAfterMin'];ami[_0x88fc('0x42')](_0x88fc('0x1a9'),ut[_0x88fc('0x111')](_0x37a3de,_0x88fc('0x1aa')));hopperUtils[_0x88fc('0xc6')](_0x5d6839)['catch'](loggerCatch(_0x88fc('0x1ab')));if(_0x334192[_0x88fc('0x186')](0x8,_0x37a3de,_0x7744f7)&&!_0x492831){if(_0x5d6839[_0x88fc('0x11b')]>=_0x7744f7[_0x88fc('0x18b')]){_0x334192[_0x88fc('0x122')](_0x5d6839,_0x201939,_0xb2dc18,'reason\x208\x20congestion');}else{_0x334192['stateGlobal'](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1ac'));}}break;case'11':_0x7744f7[_0x88fc('0x1ad')]+=0x1;_0x5d6839[_0x88fc('0x6b')]=0xb;_0x5d6839[_0x88fc('0xcf')]=_0x88fc('0xe3');_0x5d6839[_0x88fc('0xe7')]+=0x1;_0x5d6839[_0x88fc('0xe5')]+=0x1;_0x49897f=_0x7744f7[_0x88fc('0xe9')];_0x5a47bb=_0x7744f7[_0x88fc('0xd5')];hopperUtils[_0x88fc('0xc6')](_0x5d6839)['catch'](loggerCatch(_0x88fc('0xeb')));if(_0x334192[_0x88fc('0x186')](0xb,_0x37a3de,_0x7744f7)&&!_0x492831){if(_0x5d6839[_0x88fc('0xe7')]>=_0x7744f7[_0x88fc('0xe8')]){_0x334192['createStateFinal'](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1ae'));}else{_0x334192[_0x88fc('0x11f')](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1ae'));}}break;case'20':_0x7744f7[_0x88fc('0x1af')]+=0x1;_0x5d6839[_0x88fc('0x6b')]=0x14;_0x5d6839['statedesc']=_0x88fc('0x1b0');_0x5d6839[_0x88fc('0x11e')]+=0x1;_0x5d6839[_0x88fc('0xe5')]+=0x1;_0x49897f=_0x7744f7[_0x88fc('0x1b1')];_0x5a47bb=_0x7744f7['callAdditionalPhoneAfterMin'];ami[_0x88fc('0x42')](_0x88fc('0x1b2'),ut[_0x88fc('0x111')](_0x37a3de,_0x88fc('0x1b3')));hopperUtils['createHistory'](_0x5d6839)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x1b4')));if(_0x334192['checkRetriveMax'](0x14,_0x37a3de,_0x7744f7)&&!_0x492831){if(_0x5d6839[_0x88fc('0x11e')]>=_0x7744f7[_0x88fc('0x192')]){_0x334192[_0x88fc('0x122')](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1b5'));}else{_0x334192[_0x88fc('0x11f')](_0x5d6839,_0x201939,_0xb2dc18,_0x88fc('0x1b5'));}}break;default:_0x7744f7['outboundUnknownCallsDay']+=0x1;_0x5d6839['state']=0xc;_0x5d6839[_0x88fc('0xcf')]=_0x729d24[_0x88fc('0xc1')];_0x49897f=_0x7744f7[_0x88fc('0x1b1')];_0x5a47bb=_0x7744f7['callAdditionalPhoneAfterMin'];hopperUtils[_0x88fc('0xc6')](_0x5d6839)[_0x88fc('0x98')](loggerCatch(_0x88fc('0x1b6')));if(_0x334192[_0x88fc('0x186')](_0x729d24[_0x88fc('0xc1')],_0x37a3de,_0x7744f7)&&!_0x492831){if(_0x5d6839[_0x88fc('0x128')]+_0x5d6839[_0x88fc('0x11b')]+_0x5d6839[_0x88fc('0x11c')]+_0x5d6839['countnosuchnumberretry']+_0x5d6839[_0x88fc('0xd3')]+_0x5d6839[_0x88fc('0xe7')]+_0x5d6839[_0x88fc('0x119')]+_0x5d6839[_0x88fc('0x11e')]>=_0x7744f7[_0x88fc('0x129')]){_0x334192[_0x88fc('0x11f')](_0x5d6839,_0x201939,_0xb2dc18,_0x729d24[_0x88fc('0xc1')]);}else{_0x334192[_0x88fc('0x122')](_0x5d6839,_0x201939,_0xb2dc18,_0x729d24[_0x88fc('0xc1')]);}}}})['then'](function(){if(_0x492831){hopperUtils[_0x88fc('0xe1')](_0x5d6839,_0x49897f,_0x5a47bb)['then'](function(){return _0x201939(0x1);});}});});};Dialer[_0x88fc('0x1a')][_0x88fc('0x11f')]=function(_0x23e6e3,_0xbbea6c,_0x44c1af,_0x8bd824){var _0x25f032=new Final(_0x23e6e3);_0x25f032[_0x88fc('0x6b')]=0xf;_0x25f032[_0x88fc('0xcf')]=_0x88fc('0x1b7');this[_0x88fc('0x122')](_0x25f032,_0xbbea6c,_0x44c1af,_0x8bd824);};Dialer['prototype']['createStateFinal']=function(_0x2c36cc,_0x50282c,_0x4d5f88,_0x2340f2){hopperUtils['moveContactManagedDialer'](_0x2c36cc)[_0x88fc('0x9b')](function(){return _0x50282c(msgResponse(_0x88fc('0x195'),_0x88fc('0x106'),_0x2340f2));})[_0x88fc('0x98')](function(){return _0x4d5f88(msgResponse(_0x88fc('0x1b8'),_0x88fc('0x8e'),'contact\x20not\x20moved'));});};Dialer[_0x88fc('0x1a')]['predictive']=function(_0x54d691){var _0x2893f3=_0x54d691['dialPredictiveOptimizationPercentage']/0x64;var _0x510ec1=_0x54d691[_0x88fc('0x1b9')]/(_0x54d691[_0x88fc('0x1b9')]+_0x54d691['outboundAnswerCallsDay']);var _0x301414=Math['round'](_0x54d691['predictiveIntervalAvailable']*(_0x54d691[_0x88fc('0x1ba')]/0x64));var _0x20996f=Math[_0x88fc('0x1bb')](_0x54d691[_0x88fc('0x1bc')]*(_0x54d691[_0x88fc('0x1bd')]/0x64));var _0x3011b3=_0x54d691['available']+_0x54d691[_0x88fc('0x135')];var _0x3d26db=Math['floor'](_0x54d691['erlangCalls']*_0x54d691[_0x88fc('0x5a')]*_0x54d691['predictiveIntervalHitRate']*_0x54d691[_0x88fc('0x1be')]);if(_[_0x88fc('0x41')](_0x54d691['startProgressive'])){if(!_[_0x88fc('0x41')](_0x54d691['startPredictive'])){_0x54d691['startPredictive']=undefined;loggerPredictive[_0x88fc('0x61')](_0x88fc('0x1bf'),_0x88fc('0x1c0'));}if(!_[_0x88fc('0x41')](_0x54d691['handlePredictive'])){loggerPredictive['error'](_0x88fc('0x1bf'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x54d691[_0x88fc('0x60')]);_0x54d691[_0x88fc('0x60')]=undefined;}_0x54d691['startProgressive']=moment()[_0x88fc('0x45')](_0x88fc('0xbf'));loggerPredictive[_0x88fc('0x49')](_0x54d691[_0x88fc('0x47')],_0x88fc('0x1c1'),_0x54d691['startProgressive']);this['handlePower'](_0x54d691,0x1);}else if(ifInterval(_0x54d691[_0x88fc('0x1c2')],_0x54d691[_0x88fc('0x2a')])){this[_0x88fc('0xac')](_0x54d691,0x1);loggerPredictiveCalls[_0x88fc('0x49')](_0x88fc('0x1c3'),_0x54d691[_0x88fc('0x2a')],_0x54d691['name']);_0x54d691[_0x88fc('0x56')]=0x0;_0x54d691[_0x88fc('0xce')]=0x0;}else if(_0x2893f3<_0x510ec1&&_0x54d691[_0x88fc('0x1c4')]===_0x88fc('0x1c5')){clearPredictiveAttributes(_0x54d691);loggerPredictive[_0x88fc('0x49')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x88fc('0x1c6'),_0x510ec1,'startProgressive',_0x54d691[_0x88fc('0x47')]);}else if(_0x3d26db<_0x54d691[_0x88fc('0xce')]&&_0x54d691[_0x88fc('0x1c4')]===_0x88fc('0x1c5')){clearPredictiveAttributes(_0x54d691);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x1c7'),_0x88fc('0x1c8'),_0x3d26db,'Drop\x20in\x20this\x20interval',_0x54d691[_0x88fc('0xce')],_0x88fc('0x2a'),_0x54d691[_0x88fc('0x47')]);}else if(!ifInterval(_0x54d691[_0x88fc('0x1c2')],_0x54d691[_0x88fc('0x2a')])&&_['isUndefined'](_0x54d691['startPredictive'])&&!_[_0x88fc('0x41')](_0x54d691[_0x88fc('0x2a')])){_0x54d691[_0x88fc('0x29')]=moment()[_0x88fc('0x45')](_0x88fc('0xbf'));loggerPredictive[_0x88fc('0x49')](_0x54d691[_0x88fc('0x47')],_0x88fc('0x1c9'),_0x54d691['startPredictive']);hopperUtils[_0x88fc('0x1ca')](_0x54d691[_0x88fc('0x1c2')])[_0x88fc('0x9b')](this[_0x88fc('0x1cb')](_0x54d691))[_0x88fc('0x9b')](mergeDataErlangB(_0x54d691))['then'](this[_0x88fc('0x1cc')](_0x54d691))[_0x88fc('0x98')](loggerCatchPredictive(_0x88fc('0x1cd'),_0x54d691));}else if(!ifInterval(_0x54d691[_0x88fc('0x1c2')],_0x54d691[_0x88fc('0x29')])){_0x54d691['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x54d691[_0x88fc('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x54d691[_0x88fc('0x47')],'recalculate\x20predictive\x20at',_0x54d691[_0x88fc('0x29')]);clearInterval(_0x54d691['handlePredictive']);_0x54d691[_0x88fc('0x60')]=undefined;hopperUtils[_0x88fc('0x1ca')](_0x54d691[_0x88fc('0x1c2')])[_0x88fc('0x9b')](this[_0x88fc('0x1cb')](_0x54d691))[_0x88fc('0x9b')](mergeDataErlangB(_0x54d691))[_0x88fc('0x9b')](this[_0x88fc('0x1cc')](_0x54d691))[_0x88fc('0x98')](loggerCatchPredictive(_0x88fc('0x1ce'),_0x54d691));}else if(_0x54d691['predictiveIntervalAvailable']&&_0x3011b3<_0x54d691[_0x88fc('0x1bc')]-_0x20996f){clearPredictiveAttributes(_0x54d691);loggerPredictive[_0x88fc('0x49')](_0x54d691[_0x88fc('0x47')],_0x88fc('0x1cf'),_0x3011b3,_0x88fc('0x1d0'),_0x54d691['predictiveIntervalAvailable'],'-',_0x20996f,'=',_0x54d691[_0x88fc('0x1bc')]-_0x20996f,')');}else if(_0x54d691[_0x88fc('0x1bc')]&&_0x3011b3>_0x54d691[_0x88fc('0x1bc')]+_0x301414){clearPredictiveAttributes(_0x54d691);loggerPredictive[_0x88fc('0x49')](_0x54d691[_0x88fc('0x47')],_0x88fc('0x1cf'),_0x3011b3,_0x88fc('0x1d1'),_0x54d691['predictiveIntervalAvailable'],'+',_0x301414,'=',_0x54d691['predictiveIntervalAvailable']+_0x301414,')');}};Dialer[_0x88fc('0x1a')][_0x88fc('0x1cb')]=function(_0x2c772b){var _0x2d25d0=this;return function(_0x33c9ac){return new Promise(function(_0x59c79e,_0x9c05d1){_[_0x88fc('0x5d')](_0x2c772b,_0x33c9ac[0x0]);if(checkGetDataPredictive(_0x33c9ac[0x0])){var _0x2a29be=_0x2c772b[_0x88fc('0x1bc')]=_0x2c772b[_0x88fc('0x135')]+_0x2c772b[_0x88fc('0x1d2')];var _0x58691d=_0x2c772b[_0x88fc('0x1c2')]*0x3c;var _0xe7c2b2=_0x33c9ac[0x0][_0x88fc('0x52')]+_0x33c9ac[0x0][_0x88fc('0x50')];var _0x5aa2cb=(_0x33c9ac[0x0][_0x88fc('0x4c')]+_0x33c9ac[0x0][_0x88fc('0xcd')]+_0x33c9ac[0x0][_0x88fc('0x4f')])/_0x33c9ac[0x0][_0x88fc('0x4b')];_0x2c772b[_0x88fc('0x1d3')]=_0x5aa2cb>0x0?_0x5aa2cb:0x1;switch(_0x2c772b[_0x88fc('0x1c4')]){case _0x88fc('0x1c5'):var _0x2d1dae=_0x2c772b[_0x88fc('0x1d4')]/0x64;return _0x2d25d0['abandonmentRate'](_0x2a29be,_0x58691d,_0xe7c2b2,_0x5aa2cb,_0x2d1dae)[_0x88fc('0x9b')](function(_0x1c1a82){return _0x59c79e(_0x1c1a82);});case _0x88fc('0x1d5'):var _0x57b8c7=_0x2c772b[_0x88fc('0x1d4')]/0x64;return _0x2d25d0['busyFactor'](_0x2a29be,_0x58691d,_0xe7c2b2,_0x5aa2cb,_0x57b8c7)[_0x88fc('0x9b')](function(_0x521c05){return _0x59c79e(_0x521c05);});default:return _0x9c05d1(msgResponse(_0x88fc('0x1d6'),_0x88fc('0x8e'),_0x88fc('0x1d7')));}}else{return _0x9c05d1(msgResponse(_0x88fc('0x1d6'),_0x88fc('0x8e'),_0x88fc('0x1d8')));}});};};Dialer[_0x88fc('0x1a')][_0x88fc('0x1d9')]=function(_0x10d18b){var _0xb910aa=this;return function(_0x3fa538){return new Promise(function(_0x659337,_0x564d92){_[_0x88fc('0x5d')](_0x10d18b,_0x3fa538[0x0]);if(checkGetDataPredictive(_0x3fa538[0x0])){loggerPredictive['info'](JSON[_0x88fc('0x70')](_0x3fa538[0x0]));if(_0x10d18b[_0x88fc('0x1c4')]===_0x88fc('0x1c5')){return _0xb910aa[_0x88fc('0x14a')](_0x10d18b['id'])[_0x88fc('0x9b')](function(_0x4f3936){var _0x14a1fc=_0x10d18b['loggedIn']-_0x4f3936[0x0][_0x88fc('0x1da')];var _0x151dbd=_0x10d18b[_0x88fc('0x1c2')]*0x3c;var _0x58fbc8=_0x3fa538[0x0]['predictiveIntervalAvgTalktime']+_0x3fa538[0x0][_0x88fc('0x50')];var _0x5ff586=(_0x3fa538[0x0][_0x88fc('0x4c')]+_0x3fa538[0x0][_0x88fc('0xcd')]+_0x3fa538[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3fa538[0x0]['predictiveIntervalTotalCalls'];var _0x1737f8=_0x10d18b['dialPredictiveOptimizationPercentage']/0x64;_0x10d18b[_0x88fc('0x1db')]=_0x4f3936[0x0][_0x88fc('0x1da')]||0x0;_0x10d18b[_0x88fc('0x1d3')]=_0x5ff586>0x0?_0x5ff586:0x1;return _0xb910aa[_0x88fc('0x1dc')](_0x14a1fc,_0x151dbd,_0x58fbc8,_0x5ff586,_0x1737f8);})['then'](function(_0xf1da1d){return _0x659337(_0xf1da1d);})[_0x88fc('0x98')](function(_0x23acdd){return _0x564d92(msgResponse('[CatchErlangB]',_0x88fc('0x8e'),JSON[_0x88fc('0x70')](_0x23acdd)));});}if(_0x10d18b['dialPredictiveOptimization']===_0x88fc('0x1d5')){return _0xb910aa[_0x88fc('0x14a')](_0x10d18b['id'])[_0x88fc('0x9b')](function(_0x4d2615){var _0x37c420=_0x10d18b[_0x88fc('0x1dd')]-_0x4d2615[0x0][_0x88fc('0x1da')];var _0x23836e=_0x10d18b[_0x88fc('0x1c2')]*0x3c;var _0x6bff86=_0x3fa538[0x0][_0x88fc('0x52')]+_0x3fa538[0x0][_0x88fc('0x50')];var _0x14b792=(_0x3fa538[0x0]['predictiveIntervalAnsweredCalls']+_0x3fa538[0x0][_0x88fc('0xcd')]+_0x3fa538[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3fa538[0x0]['predictiveIntervalTotalCalls'];var _0x39315b=_0x10d18b['dialPredictiveOptimizationPercentage']/0x64;_0x10d18b[_0x88fc('0x1db')]=_0x4d2615[0x0][_0x88fc('0x1da')]||0x0;_0x10d18b[_0x88fc('0x1d3')]=_0x14b792>0x0?_0x14b792:0x1;return _0xb910aa[_0x88fc('0x1de')](_0x37c420,_0x23836e,_0x6bff86,_0x14b792,_0x39315b);})[_0x88fc('0x9b')](function(_0x3cf8c4){return _0x659337(_0x3cf8c4);})[_0x88fc('0x98')](function(_0x5f54fa){return _0x564d92(msgResponse('[CatchErlangB]',_0x88fc('0x8e'),JSON[_0x88fc('0x70')](_0x5f54fa)));});}}else{return _0x564d92(msgResponse(_0x88fc('0x1d6'),'Failure',_0x88fc('0x1d8')));}});};};Dialer[_0x88fc('0x1a')][_0x88fc('0x1cc')]=function(_0x326da0){var _0x4c1b64=this;return function(){var _0x3951db=0x0;var _0xe4307c=Math[_0x88fc('0x1df')](_0x326da0[_0x88fc('0x58')]*0x3e8);if(_0xe4307c>0x0){_0xe4307c=_0xe4307c<0x64?0x64:_0xe4307c;loggerPredictive[_0x88fc('0x49')](_0x326da0[_0x88fc('0x47')],_0x88fc('0x1e0'),_0xe4307c,_0x88fc('0x1e1'));_0x326da0[_0x88fc('0x60')]=setInterval(function(){_0x4c1b64['handlePredictive'](_0x326da0);loggerPredictiveCalls[_0x88fc('0x49')](_0x88fc('0x1e2'),_0x3951db+=0x1);},_0xe4307c);}else{loggerPredictive[_0x88fc('0x49')](_0x326da0['name'],_0x88fc('0x1e3'));}};};Dialer['prototype'][_0x88fc('0x1e4')]=function(_0x189907,_0x530c90){var _0xae0cde=this;return function(_0x85a01c){if(_[_0x88fc('0x76')](_0x85a01c)){if(_[_0x88fc('0xf1')](_0x530c90['UserId'])||!_0x530c90[_0x88fc('0x1e5')]){if(_0x189907[_0x88fc('0xaa')]===_0x88fc('0xaf')){_0x189907[_0x88fc('0x6e')]=_[_0x88fc('0x41')](_0x189907['queueStatusComplete'])?!![]:_0x189907['queueStatusComplete'];var _0x37109c=uuid['v4']();_0xae0cde[_0x88fc('0x25')][_0x37109c]=new Action(_0x189907,_0x530c90,_0x37109c);loggerBooked[_0x88fc('0x49')](_0x88fc('0x1e6'),_0x37109c,'queueStatusComplete:\x20',JSON['stringify'](_0x189907['queueStatusComplete']),_0x88fc('0x1e7'),_0x189907['name']);if(_0x189907[_0x88fc('0x6e')]){_0x189907[_0x88fc('0x6e')]=![];_0xae0cde[_0x88fc('0xf5')][_0xae0cde['actions'][_0x37109c][_0x88fc('0xbc')]]=[];ami[_0x88fc('0x148')]({'actionid':_0x37109c,'action':_0x88fc('0x1e8'),'queue':_0x189907['name']})['catch'](function(){_0xae0cde[_0x88fc('0xf9')](_0x189907);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0xae0cde['actions'][_0x37109c]['ContactId'],'ListId':_0xae0cde[_0x88fc('0x25')][_0x37109c][_0x88fc('0xea')],'VoiceQueueId':_0xae0cde['actions'][_0x37109c]['VoiceQueueId']||undefined,'CampaignId':_0xae0cde[_0x88fc('0x25')][_0x37109c][_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0xae0cde['actions'][_0x37109c];});}else{loggerBooked[_0x88fc('0x49')]('[booked][checkContactBlack][else]',JSON[_0x88fc('0x70')](_0x189907[_0x88fc('0x6e')]),_0x88fc('0x1e7'),_0x189907['name']);_0xae0cde[_0x88fc('0xf9')](_0x189907);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0xae0cde[_0x88fc('0x25')][_0x37109c][_0x88fc('0xdc')],'ListId':_0xae0cde[_0x88fc('0x25')][_0x37109c][_0x88fc('0xea')],'VoiceQueueId':_0xae0cde[_0x88fc('0x25')][_0x37109c][_0x88fc('0x101')]||undefined,'CampaignId':_0xae0cde['actions'][_0x37109c][_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x1e9')));delete _0xae0cde[_0x88fc('0x25')][_0x37109c];}}else{return _0xae0cde[_0x88fc('0x1ea')](_0x189907,_0x530c90);}}else{if(utils[_0x88fc('0x5e')](undefined,_0x530c90[_0x88fc('0x1eb')])<_0x189907[_0x88fc('0x1ec')]*0x3c){if(_0x530c90[_0x88fc('0x140')]&&!_0x530c90['Agent']['voicePause']){_0xae0cde[_0x88fc('0x1e')][_0x88fc('0xf7')](_0x530c90['id'])[_0x88fc('0x1c')](function(){_0xae0cde['updateOriginated'](_0x189907);});}else{hopperUtils[_0x88fc('0x1ed')]({'active':![]},_0x530c90['id'],0x1)['finally'](function(){_0xae0cde[_0x88fc('0xf9')](_0x189907);});}}else{_0x189907[_0x88fc('0x1ee')]+=0x1;_0xae0cde['updateOriginated'](_0x189907);if(_0x189907[_0x88fc('0x1ef')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x530c90[_0x88fc('0xdc')],'ListId':_0x530c90['ListId'],'VoiceQueueId':_0x530c90['VoiceQueueId']||undefined,'CampaignId':_0x530c90[_0x88fc('0xdd')]||undefined})[_0x88fc('0x98')](loggerCatch(_0x88fc('0x1f0')));hopperUtils[_0x88fc('0xc6')](createObjHistory(_0x189907,_0x530c90,utils[_0x88fc('0x69')][_0x88fc('0x1f1')],0x17,_0x88fc('0x1f2')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0xae0cde[_0x88fc('0x113')](createObjHistory(_0x189907,_0x530c90,utils[_0x88fc('0x69')][_0x88fc('0x1f3')],0x16,_0x88fc('0x1f4')),_0x88fc('0x1f5'),_0x88fc('0x1f6'));}}}}else{_0x189907[_0x88fc('0x1f7')]+=0x1;_0xae0cde[_0x88fc('0x113')](createObjHistory(_0x189907,_0x530c90,utils[_0x88fc('0x69')][_0x88fc('0x1f8')],0xd,'Blacklist'),_0x88fc('0x1f9'),'[Originate][MoveBlacklist]');throw _0x88fc('0x1fa');}};};Dialer['prototype'][_0x88fc('0x154')]=function(_0x538add){var _0x128d0f=this;var _0x5dff69=_0x538add[_0x88fc('0x1fb')]-_0x538add[_0x88fc('0x14b')]-_0x538add['temp'];emitCampaignSummary(_0x538add);if(_0x5dff69>0x0){if(_0x5dff69>this[_0x88fc('0x23')]){_0x5dff69=this[_0x88fc('0x23')];}_0x538add[_0x88fc('0x1fc')]+=_0x5dff69;hopperUtils[_0x88fc('0x1fd')](_0x538add,_0x5dff69)[_0x88fc('0x9b')](function(_0x1997d7){_0x538add[_0x88fc('0x1fc')]-=_0x5dff69;_0x538add[_0x88fc('0x1fc')]=_0x538add[_0x88fc('0x1fc')]>0x0?_0x538add[_0x88fc('0x1fc')]:0x0;if(!utils[_0x88fc('0x1fe')](_0x1997d7)){_0x538add[_0x88fc('0x66')]=utils[_0x88fc('0x69')][_0x88fc('0x1ff')];logger[_0x88fc('0x49')](_0x88fc('0x200')+_0x538add['name']);}else{_0x538add[_0x88fc('0x14b')]+=_0x1997d7[_0x88fc('0xfc')];_0x538add[_0x88fc('0x66')]=utils[_0x88fc('0x69')]['RUNNING'];for(var _0x185bf9=0x0;_0x185bf9<_0x1997d7[_0x88fc('0xfc')];_0x185bf9+=0x1){_0x538add[_0x88fc('0x201')]+=0x1;if(_[_0x88fc('0xf1')](_0x1997d7[_0x185bf9])||_[_0x88fc('0xf1')](_0x1997d7[_0x185bf9][_0x88fc('0x16d')])||_[_0x88fc('0xf1')](_0x1997d7[_0x185bf9]['phone'])){_0x128d0f['emptyContact'](_0x88fc('0x202'),_0x538add,_0x1997d7[_0x185bf9]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x88fc('0x71')](_0x1997d7[_0x185bf9],[_0x88fc('0xdd'),_0x88fc('0x156')]))[_0x88fc('0x9b')](_0x128d0f[_0x88fc('0x1e4')](_0x538add,_0x1997d7[_0x185bf9]))['catch'](_0x128d0f[_0x88fc('0x14e')]('[actionOriginateIvr]\x20',_0x538add));}}}})[_0x88fc('0x98')](loggerGetContactDialer(_0x88fc('0x203'),_0x538add,_0x5dff69));}};Dialer['prototype'][_0x88fc('0xac')]=function(_0x26ac93,_0x378e5f){var _0x185866=this;var _0x1be643=[];if(_0x378e5f<0x1||_0x26ac93['dialMethod']===_0x88fc('0xaf')){_0x378e5f=0x1;}var _0x1bcd71=Math[_0x88fc('0x1df')](_0x26ac93[_0x88fc('0x1d2')]*_0x378e5f)-_0x26ac93[_0x88fc('0x14b')]-_0x26ac93['temp'];if(_0x26ac93['dialLimitQueue']>0x0){var _0x46100a=_0x26ac93[_0x88fc('0x204')]-_0x26ac93[_0x88fc('0x14b')]-_0x26ac93[_0x88fc('0x135')]-_0x26ac93[_0x88fc('0x1fc')]-_0x26ac93['pTalking'];if(_0x1bcd71>_0x46100a){_0x1bcd71=_0x46100a;}}if(_0x1bcd71>0x0){if(_0x26ac93[_0x88fc('0xaa')]===_0x88fc('0xaf')){_0x1bcd71=0x1;}if(_0x1bcd71>this[_0x88fc('0x23')]){_0x1bcd71=this[_0x88fc('0x23')];}_0x26ac93[_0x88fc('0x1fc')]+=_0x1bcd71;for(var _0xcf437e in this[_0x88fc('0x21')]){if(typeof this[_0x88fc('0x21')][_0xcf437e]!==_0x88fc('0xa3')){if(this[_0x88fc('0x21')][_0xcf437e][_0x88fc('0x6b')]===_0x88fc('0x205')&&this['agents'][_0xcf437e][_0x88fc('0x83')]==='reachable'){_0x1be643['push'](this[_0x88fc('0x21')][_0xcf437e]['id']);}}}hopperUtils[_0x88fc('0x206')](_0x26ac93,_0x1be643,_0x1bcd71)[_0x88fc('0x9b')](function(_0x2abc0e){_0x26ac93[_0x88fc('0x1fc')]-=_0x1bcd71;_0x26ac93[_0x88fc('0x1fc')]=_0x26ac93[_0x88fc('0x1fc')]>0x0?_0x26ac93[_0x88fc('0x1fc')]:0x0;if(!utils[_0x88fc('0x1fe')](_0x2abc0e)){hopperUtils[_0x88fc('0x207')](_0x26ac93)[_0x88fc('0x9b')](sendMessageReschedule(_0x26ac93))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x26ac93['originated']+=_0x2abc0e[_0x88fc('0xfc')];_0x26ac93[_0x88fc('0x66')]=_0x26ac93[_0x88fc('0xaa')]==='booked'?utils[_0x88fc('0x69')]['ACTIVE']:utils[_0x88fc('0x69')][_0x88fc('0x208')];for(var _0x33d715=0x0;_0x33d715<_0x2abc0e['length'];_0x33d715+=0x1){if(_[_0x88fc('0xf1')](_0x2abc0e[_0x33d715])||_['isNil'](_0x2abc0e[_0x33d715][_0x88fc('0x16d')])||_[_0x88fc('0xf1')](_0x2abc0e[_0x33d715][_0x88fc('0x156')])){_0x185866[_0x88fc('0x209')](_0x88fc('0x202'),_0x26ac93,_0x2abc0e[_0x33d715]);}else{hopperUtils[_0x88fc('0x20a')](_[_0x88fc('0x71')](_0x2abc0e[_0x33d715],[_0x88fc('0x101'),_0x88fc('0x156')]))[_0x88fc('0x9b')](_0x185866[_0x88fc('0x1e4')](_0x26ac93,_0x2abc0e[_0x33d715]))['catch'](_0x185866[_0x88fc('0x14e')](_0x88fc('0x202'),_0x26ac93));}}}})[_0x88fc('0x98')](loggerGetContactDialer('[getContactDialer2]',_0x26ac93,_0x1bcd71));}};Dialer[_0x88fc('0x1a')][_0x88fc('0x60')]=function(_0x77c128){if(_0x77c128[_0x88fc('0x204')]>0x0){var _0x18be4d=_0x77c128['dialLimitQueue']-_0x77c128[_0x88fc('0x14b')]-_0x77c128[_0x88fc('0x135')];if(_0x18be4d>0x0){this['tryOriginatePredictive'](_0x77c128);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x88fc('0x20b')](_0x77c128);}};Dialer['prototype'][_0x88fc('0x20b')]=function(_0x4a806c){var _0x4fea91=this;var _0x4ff2c6=[];_0x4a806c[_0x88fc('0x14b')]+=0x1;for(var _0x106153 in this[_0x88fc('0x21')]){if(typeof this[_0x88fc('0x21')][_0x106153]!==_0x88fc('0xa3')){if(this[_0x88fc('0x21')][_0x106153][_0x88fc('0x6b')]===_0x88fc('0x205')&&this[_0x88fc('0x21')][_0x106153][_0x88fc('0x83')]===_0x88fc('0x84')){_0x4ff2c6[_0x88fc('0x93')](this['agents'][_0x106153]['id']);}}}return this['getContactDialer'](_0x4a806c['id'],_0x4ff2c6,0x1,_0x4a806c[_0x88fc('0x20c')],_0x4a806c)['then'](function(_0x131101){if(!utils[_0x88fc('0x1fe')](_0x131101)){utils['checkContactLowerLimitOriginate'](_0x4a806c,0x1,0x0);return hopperUtils[_0x88fc('0x207')](_0x4a806c)['then'](sendMessageReschedule(_0x4a806c))['catch'](loggerCatch(_0x88fc('0x20d')));}else{_0x4a806c[_0x88fc('0x66')]=utils[_0x88fc('0x69')][_0x88fc('0x208')];if(_[_0x88fc('0xf1')](_0x131101[0x0])||_[_0x88fc('0xf1')](_0x131101[0x0][_0x88fc('0x16d')])||_['isNil'](_0x131101[0x0][_0x88fc('0x156')])){_0x4fea91[_0x88fc('0x209')](_0x88fc('0x202'),_0x4a806c,_0x131101[0x0]);}else{return hopperUtils[_0x88fc('0x20a')](_[_0x88fc('0x71')](_0x131101[0x0],[_0x88fc('0x101'),'phone']))[_0x88fc('0x9b')](_0x4fea91[_0x88fc('0x1e4')](_0x4a806c,_0x131101[0x0]))['catch'](_0x4fea91['loggerHandler'](_0x88fc('0x20e'),_0x4a806c));}}})['catch'](loggerGetContactDialer(_0x88fc('0x20f'),_0x4a806c,0x1));};Dialer[_0x88fc('0x1a')][_0x88fc('0x1dc')]=function(_0x5a5b4b,_0x356ef3,_0xd034dc,_0x3dd225,_0x403eee,_0x2364ea){loggerPredictive['info'](_0x88fc('0x210'));loggerPredictive[_0x88fc('0x49')](_0x88fc('0x211'),_0x5a5b4b);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x356ef3);loggerPredictive['info'](_0x88fc('0x212'),_0xd034dc);loggerPredictive['info'](_0x88fc('0x213'),_0x3dd225);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x403eee);loggerPredictive['info'](_0x88fc('0x51'));return new Promise(function(_0x370b0b,_0x138762){if(_0x5a5b4b<=0x0||isNaN(_0x5a5b4b)){return _0x138762(msgResponse('[abandonmentRate]',_0x88fc('0x80'),_0x88fc('0x214')+_0x5a5b4b));}if(_0xd034dc<=0x0||isNaN(_0xd034dc)){return _0x138762(msgResponse(_0x88fc('0x215'),_0x88fc('0x80'),_0x88fc('0x216')+_0xd034dc));}if(_0x3dd225<=0x0||isNaN(_0x3dd225)){return _0x138762(msgResponse(_0x88fc('0x215'),_0x88fc('0x80'),'p\x20=\x20'+_0x3dd225));}if(_0x356ef3<=0x0||isNaN(_0x356ef3)){return _0x138762(msgResponse('[abandonmentRate]','Error',_0x88fc('0x217')+_0x356ef3));}if(_0x403eee<=0x0||isNaN(_0x403eee)){return _0x138762(msgResponse(_0x88fc('0x215'),_0x88fc('0x80'),_0x88fc('0x218')+_0x403eee));}_0x2364ea=_0x2364ea||0x0;var _0x49fdfd=0x1/_0xd034dc;var _0x5a2f9a=0x0;var _0x5ec7f0=0x0;var _0x23cf19=0x0;var _0x3ebea3=0x0;for(var _0x36ac9e=0x0;_0x23cf19<_0x403eee;_0x36ac9e+=0x1){_0x5ec7f0=_0x36ac9e/_0x356ef3;_0x5a2f9a=(_0x3dd225*_0x5ec7f0+_0x2364ea)/_0x49fdfd;_0x23cf19=utils[_0x88fc('0x219')](_0x5a2f9a,_0x5a5b4b);_0x3ebea3=_0x5a2f9a/_0x5a5b4b*(0x1-utils[_0x88fc('0x219')](_0x5a2f9a,_0x5a5b4b));}return _0x370b0b({'erlangCalls':_0x36ac9e,'erlangCallToSecond':_0x356ef3/_0x36ac9e,'erlangAbandonmentRate':_0x23cf19,'erlangBusyFactor':_0x3ebea3});});};Dialer[_0x88fc('0x1a')]['busyFactor']=function(_0x2b3048,_0x2e6738,_0x578179,_0x51314b,_0x4e13f9,_0x471a80){loggerPredictive['info'](_0x88fc('0x21a'));loggerPredictive[_0x88fc('0x49')](_0x88fc('0x211'),_0x2b3048);loggerPredictive['info'](_0x88fc('0x21b'),_0x2e6738);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x212'),_0x578179);loggerPredictive[_0x88fc('0x49')]('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',_0x51314b);loggerPredictive[_0x88fc('0x49')](_0x88fc('0x21c'),_0x4e13f9);loggerPredictive['info'](_0x88fc('0x51'));return new Promise(function(_0x1351a4,_0x3aeda8){if(_0x2b3048<=0x0||isNaN(_0x2b3048)){return _0x3aeda8(msgResponse('[busyFactor]',_0x88fc('0x80'),_0x88fc('0x214')+_0x2b3048));}if(_0x578179<=0x0||isNaN(_0x578179)){return _0x3aeda8(msgResponse(_0x88fc('0x21d'),_0x88fc('0x80'),_0x88fc('0x216')+_0x578179));}if(_0x51314b<=0x0||isNaN(_0x51314b)){return _0x3aeda8(msgResponse(_0x88fc('0x21d'),_0x88fc('0x80'),_0x88fc('0x21e')+_0x51314b));}if(_0x2e6738<=0x0||isNaN(_0x2e6738)){return _0x3aeda8(msgResponse('[busyFactor]','Error','interval\x20=\x20'+_0x2e6738));}if(_0x4e13f9<=0x0||isNaN(_0x4e13f9)){return _0x3aeda8(msgResponse(_0x88fc('0x21d'),'Error',_0x88fc('0x21f')+_0x4e13f9));}_0x471a80=_0x471a80||0x0;var _0x32ca49=0x1/_0x578179;var _0x3b2963=0x0;var _0x2b21ff=0x0;var _0xd07738=0x0;var _0x230ddb=0x0;for(var _0x55f505=0x0;_0x230ddb<_0x4e13f9;_0x55f505+=0x1){_0x2b21ff=_0x55f505/_0x2e6738;_0x3b2963=(_0x51314b*_0x2b21ff+_0x471a80)/_0x32ca49;_0xd07738=utils['erlangb'](_0x3b2963,_0x2b3048);_0x230ddb=_0x3b2963/_0x2b3048*(0x1-utils[_0x88fc('0x219')](_0x3b2963,_0x2b3048));}return _0x1351a4({'erlangCalls':_0x55f505,'erlangCallToSecond':_0x2e6738/_0x55f505,'erlangAbandonmentRate':_0xd07738,'erlangBusyFactor':_0x230ddb});});};module[_0x88fc('0x220')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index cbb2787..daebd27 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2076=['prototype','format','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','moment','isNil','string','voiceQueue','name','phone','Contact','firstName','lastName','number','queue','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridname'];(function(_0x271191,_0x3486bf){var _0x2765db=function(_0x355f1b){while(--_0x355f1b){_0x271191['push'](_0x271191['shift']());}};_0x2765db(++_0x3486bf);}(_0x2076,0x9e));var _0x6207=function(_0x4e3e1f,_0x272e74){_0x4e3e1f=_0x4e3e1f-0x0;var _0x539eff=_0x2076[_0x4e3e1f];return _0x539eff;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x6207('0x0'));function checkNameSurname(_0x584bc6,_0xd930b,_0x5856ee){var _0x555fc2='';if(!_[_0x6207('0x1')](_0xd930b)&&'string'===typeof _0xd930b){_0x555fc2+=_0xd930b;}if(!_[_0x6207('0x1')](_0x5856ee)&&_0x6207('0x2')===typeof _0x5856ee){_0x555fc2+='\x20'+_0x5856ee;}if(_0x555fc2!==''){return _0x555fc2;}return _0x584bc6;}function Action(_0x273d46,_0x493a0a,_0x197b1f){this[_0x6207('0x3')]=_0x273d46;this['uniqueid']=_0x197b1f||undefined;this[_0x6207('0x4')]=checkNameSurname(_0x493a0a['Contact'][_0x6207('0x5')],_0x493a0a[_0x6207('0x6')][_0x6207('0x7')],_0x493a0a[_0x6207('0x6')][_0x6207('0x8')]);this[_0x6207('0x9')]=_0x493a0a['phone'];this[_0x6207('0xa')]=_0x273d46[_0x6207('0x4')];this['active']=_0x493a0a[_0x6207('0xb')]||![];this['type']=_0x273d46[_0x6207('0xc')];this['dialQueueTimeout']=_0x273d46[_0x6207('0xd')]||0x3;this['scheduledat']=_0x493a0a['scheduledat'];this[_0x6207('0xe')]=_0x493a0a['countbusyretry'];this[_0x6207('0xf')]=_0x493a0a['countcongestionretry'];this[_0x6207('0x10')]=_0x493a0a[_0x6207('0x10')];this[_0x6207('0x11')]=_0x493a0a[_0x6207('0x11')];this[_0x6207('0x12')]=_0x493a0a[_0x6207('0x12')];this['countabandonedretry']=_0x493a0a['countabandonedretry'];this['countmachineretry']=_0x493a0a[_0x6207('0x13')];this['countagentrejectretry']=_0x493a0a['countagentrejectretry'];this[_0x6207('0x14')]=_0x493a0a[_0x6207('0x14')];this[_0x6207('0x15')]=_0x493a0a[_0x6207('0x15')];this[_0x6207('0x16')]=_0x493a0a[_0x6207('0x16')];this[_0x6207('0x17')]=_0x493a0a['VoiceQueueId'];this[_0x6207('0x18')]=_0x493a0a[_0x6207('0x18')];this[_0x6207('0x19')]=_0x493a0a['id'];this['ContactFirstName']=_0x493a0a[_0x6207('0x6')][_0x6207('0x7')]||'';this[_0x6207('0x1a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x6207('0x1b')]=_0x493a0a[_0x6207('0x1b')];this[_0x6207('0x1c')]=_0x493a0a[_0x6207('0x1c')];this['callbackat']=_0x493a0a[_0x6207('0x1d')];this[_0x6207('0x1e')]=_0x493a0a[_0x6207('0x1e')];this['originatecalleridnum']='';this[_0x6207('0x1f')]='';}Action[_0x6207('0x20')]['getCaller']=function(){return util[_0x6207('0x21')](_0x6207('0x22'),this[_0x6207('0x4')],this[_0x6207('0x3')][_0x6207('0x23')]>0x0?this[_0x6207('0x9')]['substring'](this[_0x6207('0x3')]['dialCutDigit']):this['number']);};Action[_0x6207('0x20')][_0x6207('0x24')]=function(){return this[_0x6207('0xa')];};module[_0x6207('0x25')]=Action; \ No newline at end of file +var _0xf020=['util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','queue','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','voiceQueue','dialCutDigit','substring','getQueue','exports'];(function(_0x3f6d49,_0x19a4fa){var _0x30263d=function(_0x1b0df9){while(--_0x1b0df9){_0x3f6d49['push'](_0x3f6d49['shift']());}};_0x30263d(++_0x19a4fa);}(_0xf020,0x170));var _0x0f02=function(_0x395ab3,_0x1f969c){_0x395ab3=_0x395ab3-0x0;var _0x7b20cf=_0xf020[_0x395ab3];return _0x7b20cf;};'use strict';var util=require(_0x0f02('0x0'));var _=require(_0x0f02('0x1'));var moment=require(_0x0f02('0x2'));function checkNameSurname(_0x54e78a,_0xef76e0,_0x2c7612){var _0x513836='';if(!_[_0x0f02('0x3')](_0xef76e0)&&_0x0f02('0x4')===typeof _0xef76e0){_0x513836+=_0xef76e0;}if(!_[_0x0f02('0x3')](_0x2c7612)&&'string'===typeof _0x2c7612){_0x513836+='\x20'+_0x2c7612;}if(_0x513836!==''){return _0x513836;}return _0x54e78a;}function Action(_0x434ce2,_0x5891b4,_0x298ff6){this['voiceQueue']=_0x434ce2;this[_0x0f02('0x5')]=_0x298ff6||undefined;this[_0x0f02('0x6')]=checkNameSurname(_0x5891b4[_0x0f02('0x7')][_0x0f02('0x8')],_0x5891b4[_0x0f02('0x7')][_0x0f02('0x9')],_0x5891b4[_0x0f02('0x7')][_0x0f02('0xa')]);this[_0x0f02('0xb')]=_0x5891b4[_0x0f02('0x8')];this[_0x0f02('0xc')]=_0x434ce2[_0x0f02('0x6')];this['active']=_0x5891b4['active']||![];this[_0x0f02('0xd')]=_0x434ce2['type'];this[_0x0f02('0xe')]=_0x434ce2[_0x0f02('0xe')]||0x3;this[_0x0f02('0xf')]=_0x5891b4[_0x0f02('0xf')];this['countbusyretry']=_0x5891b4[_0x0f02('0x10')];this[_0x0f02('0x11')]=_0x5891b4['countcongestionretry'];this[_0x0f02('0x12')]=_0x5891b4[_0x0f02('0x12')];this['countnosuchnumberretry']=_0x5891b4[_0x0f02('0x13')];this['countdropretry']=_0x5891b4[_0x0f02('0x14')];this['countabandonedretry']=_0x5891b4[_0x0f02('0x15')];this[_0x0f02('0x16')]=_0x5891b4[_0x0f02('0x16')];this['countagentrejectretry']=_0x5891b4[_0x0f02('0x17')];this['ContactId']=_0x5891b4[_0x0f02('0x18')];this[_0x0f02('0x19')]=_0x5891b4[_0x0f02('0x19')];this[_0x0f02('0x1a')]=_0x5891b4[_0x0f02('0x1a')];this[_0x0f02('0x1b')]=_0x5891b4[_0x0f02('0x1b')];this[_0x0f02('0x1c')]=_0x5891b4['CampaignId'];this[_0x0f02('0x1d')]=_0x5891b4['id'];this[_0x0f02('0x1e')]=_0x5891b4[_0x0f02('0x7')][_0x0f02('0x9')]||'';this[_0x0f02('0x1f')]=moment()[_0x0f02('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0f02('0x21')]=_0x5891b4[_0x0f02('0x21')];this[_0x0f02('0x22')]=_0x5891b4[_0x0f02('0x22')];this[_0x0f02('0x23')]=_0x5891b4[_0x0f02('0x23')];this[_0x0f02('0x24')]=_0x5891b4['recallme'];this[_0x0f02('0x25')]='';this[_0x0f02('0x26')]='';}Action[_0x0f02('0x27')][_0x0f02('0x28')]=function(){return util[_0x0f02('0x20')]('\x22%s\x22\x20<%s>',this[_0x0f02('0x6')],this[_0x0f02('0x29')][_0x0f02('0x2a')]>0x0?this[_0x0f02('0xb')][_0x0f02('0x2b')](this[_0x0f02('0x29')][_0x0f02('0x2a')]):this[_0x0f02('0xb')]);};Action['prototype'][_0x0f02('0x2c')]=function(){return this[_0x0f02('0xc')];};module[_0x0f02('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 455fc14..e1113bf 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacf2=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme'];(function(_0x42e25e,_0x46cfd1){var _0x1ed3a6=function(_0x3558e8){while(--_0x3558e8){_0x42e25e['push'](_0x42e25e['shift']());}};_0x1ed3a6(++_0x46cfd1);}(_0xacf2,0x96));var _0x2acf=function(_0x1f5887,_0x2fa1f1){_0x1f5887=_0x1f5887-0x0;var _0x21774b=_0xacf2[_0x1f5887];return _0x21774b;};'use strict';var moment=require(_0x2acf('0x0'));var utils=require(_0x2acf('0x1'));function AgentComplete(_0x5441ac,_0x5bc1a0){this[_0x2acf('0x2')]=0x4;this[_0x2acf('0x3')]=_0x2acf('0x4');this[_0x2acf('0x5')]=_0x5441ac['scheduledat'];this[_0x2acf('0x6')]=_0x5441ac[_0x2acf('0x6')];this[_0x2acf('0x7')]=_0x5441ac[_0x2acf('0x6')]==='outbound'?_0x2acf('0x8'):_0x5441ac['type'];this[_0x2acf('0x9')]=_0x5441ac[_0x2acf('0x9')];this[_0x2acf('0xa')]=_0x5441ac[_0x2acf('0xa')];this[_0x2acf('0xb')]=_0x5441ac['countnoanswerretry'];this[_0x2acf('0xc')]=_0x5441ac[_0x2acf('0x9')]+_0x5441ac[_0x2acf('0xa')]+_0x5441ac[_0x2acf('0xb')]+_0x5441ac[_0x2acf('0xd')]+_0x5441ac[_0x2acf('0xe')]+_0x5441ac[_0x2acf('0xf')]+_0x5441ac[_0x2acf('0x10')]+_0x5441ac[_0x2acf('0x11')];this['countnosuchnumberretry']=_0x5441ac[_0x2acf('0xd')];this[_0x2acf('0xe')]=_0x5441ac[_0x2acf('0xe')];this['countabandonedretry']=_0x5441ac[_0x2acf('0xf')];this[_0x2acf('0x10')]=_0x5441ac[_0x2acf('0x10')];this['countagentrejectretry']=_0x5441ac[_0x2acf('0x11')];this[_0x2acf('0x12')]=_0x5bc1a0[_0x2acf('0x12')];this[_0x2acf('0x13')]=_0x5441ac[_0x2acf('0x14')];this[_0x2acf('0x15')]=_0x5441ac[_0x2acf('0x16')];this['starttime']=_0x5441ac[_0x2acf('0x17')];this[_0x2acf('0x18')]=_0x5441ac[_0x2acf('0x18')];this[_0x2acf('0x19')]=_0x5441ac['answertime'];this[_0x2acf('0x1a')]=moment()[_0x2acf('0x1b')](_0x2acf('0x1c'));this[_0x2acf('0x1d')]=utils[_0x2acf('0x1e')](_0x5441ac[_0x2acf('0x18')],_0x5441ac[_0x2acf('0x17')]);this[_0x2acf('0x1f')]=utils[_0x2acf('0x1e')](_0x5441ac[_0x2acf('0x19')],_0x5441ac[_0x2acf('0x18')]);this['talktime']=utils[_0x2acf('0x1e')](this[_0x2acf('0x1a')],_0x5441ac[_0x2acf('0x19')]);this[_0x2acf('0x8')]=_0x5bc1a0[_0x2acf('0x8')];this['membername']=_0x5bc1a0[_0x2acf('0x20')];this['reason']=_0x5bc1a0[_0x2acf('0x21')];this[_0x2acf('0x22')]=_0x5441ac['callback'];this[_0x2acf('0x23')]=_0x5441ac[_0x2acf('0x23')];this[_0x2acf('0x24')]=_0x5441ac[_0x2acf('0x24')];this[_0x2acf('0x25')]=_0x5441ac[_0x2acf('0x25')];this['ContactId']=_0x5441ac[_0x2acf('0x26')];this['ListId']=_0x5441ac[_0x2acf('0x27')];this[_0x2acf('0x28')]=_0x5441ac['UserId'];this[_0x2acf('0x29')]=_0x5441ac[_0x2acf('0x29')];this[_0x2acf('0x2a')]=_0x5441ac[_0x2acf('0x2a')];this['originatecalleridnum']=_0x5441ac[_0x2acf('0x2b')]||'';this[_0x2acf('0x2c')]=_0x5441ac[_0x2acf('0x2c')]||'';this[_0x2acf('0x2d')]=_0x5441ac[_0x2acf('0x2d')];}module[_0x2acf('0x2e')]=AgentComplete; \ No newline at end of file +var _0x47f4=['YYYY-MM-DD\x20HH:mm:ss','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format'];(function(_0x102cff,_0x2b129e){var _0xccbb1e=function(_0x1cfbe7){while(--_0x1cfbe7){_0x102cff['push'](_0x102cff['shift']());}};_0xccbb1e(++_0x2b129e);}(_0x47f4,0x130));var _0x447f=function(_0x1beb39,_0x5bea88){_0x1beb39=_0x1beb39-0x0;var _0x3b7477=_0x47f4[_0x1beb39];return _0x3b7477;};'use strict';var moment=require(_0x447f('0x0'));var utils=require('../utils');function AgentComplete(_0xb7c97b,_0xfaf2e0){this['state']=0x4;this[_0x447f('0x1')]='Answer';this['scheduledat']=_0xb7c97b[_0x447f('0x2')];this[_0x447f('0x3')]=_0xb7c97b[_0x447f('0x3')];this['campaigntype']=_0xb7c97b[_0x447f('0x3')]===_0x447f('0x4')?_0x447f('0x5'):_0xb7c97b[_0x447f('0x3')];this[_0x447f('0x6')]=_0xb7c97b['countbusyretry'];this['countcongestionretry']=_0xb7c97b[_0x447f('0x7')];this[_0x447f('0x8')]=_0xb7c97b[_0x447f('0x8')];this[_0x447f('0x9')]=_0xb7c97b[_0x447f('0x6')]+_0xb7c97b[_0x447f('0x7')]+_0xb7c97b[_0x447f('0x8')]+_0xb7c97b[_0x447f('0xa')]+_0xb7c97b[_0x447f('0xb')]+_0xb7c97b['countabandonedretry']+_0xb7c97b[_0x447f('0xc')]+_0xb7c97b[_0x447f('0xd')];this[_0x447f('0xa')]=_0xb7c97b[_0x447f('0xa')];this['countdropretry']=_0xb7c97b['countdropretry'];this['countabandonedretry']=_0xb7c97b[_0x447f('0xe')];this[_0x447f('0xc')]=_0xb7c97b['countmachineretry'];this[_0x447f('0xd')]=_0xb7c97b[_0x447f('0xd')];this[_0x447f('0xf')]=_0xfaf2e0['uniqueid'];this[_0x447f('0x10')]=_0xb7c97b[_0x447f('0x11')];this['calleridnum']=_0xb7c97b[_0x447f('0x12')];this[_0x447f('0x13')]=_0xb7c97b['starttime'];this['responsetime']=_0xb7c97b[_0x447f('0x14')];this[_0x447f('0x15')]=_0xb7c97b['answertime'];this[_0x447f('0x16')]=moment()[_0x447f('0x17')](_0x447f('0x18'));this['ringtime']=utils[_0x447f('0x19')](_0xb7c97b[_0x447f('0x14')],_0xb7c97b[_0x447f('0x13')]);this['holdtime']=utils[_0x447f('0x19')](_0xb7c97b[_0x447f('0x15')],_0xb7c97b[_0x447f('0x14')]);this[_0x447f('0x1a')]=utils['getSeconds'](this[_0x447f('0x16')],_0xb7c97b[_0x447f('0x15')]);this['queue']=_0xfaf2e0['queue'];this[_0x447f('0x1b')]=_0xfaf2e0['membername'];this[_0x447f('0x1c')]=_0xfaf2e0[_0x447f('0x1c')];this[_0x447f('0x1d')]=_0xb7c97b[_0x447f('0x1d')];this[_0x447f('0x1e')]=_0xb7c97b[_0x447f('0x1e')];this[_0x447f('0x1f')]=_0xb7c97b[_0x447f('0x1f')];this[_0x447f('0x20')]=_0xb7c97b[_0x447f('0x20')];this[_0x447f('0x21')]=_0xb7c97b[_0x447f('0x21')];this[_0x447f('0x22')]=_0xb7c97b[_0x447f('0x22')];this[_0x447f('0x23')]=_0xb7c97b[_0x447f('0x23')];this['VoiceQueueId']=_0xb7c97b[_0x447f('0x24')];this[_0x447f('0x25')]=_0xb7c97b[_0x447f('0x25')];this[_0x447f('0x26')]=_0xb7c97b[_0x447f('0x26')]||'';this[_0x447f('0x27')]=_0xb7c97b[_0x447f('0x27')]||'';this['agiafterat']=_0xb7c97b['agiafterat'];}module[_0x447f('0x28')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index f6c1b3a..7831d61 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26ba=['countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x41fe65,_0x10e99d){var _0x2c55cd=function(_0x1d6a7a){while(--_0x1d6a7a){_0x41fe65['push'](_0x41fe65['shift']());}};_0x2c55cd(++_0x10e99d);}(_0x26ba,0xfe));var _0xa26b=function(_0x3a8b9b,_0x4b1728){_0x3a8b9b=_0x3a8b9b-0x0;var _0x1a3bba=_0x26ba[_0x3a8b9b];return _0x1a3bba;};'use strict';function Final(_0x383f19){this[_0xa26b('0x0')]=_0x383f19[_0xa26b('0x0')];this[_0xa26b('0x1')]=_0x383f19[_0xa26b('0x1')];this[_0xa26b('0x2')]=_0x383f19[_0xa26b('0x2')];this['campaigntype']=_0x383f19[_0xa26b('0x2')]===_0xa26b('0x3')?_0xa26b('0x4'):_0x383f19[_0xa26b('0x2')];this[_0xa26b('0x5')]=_0x383f19['countbusyretry'];this['countcongestionretry']=_0x383f19[_0xa26b('0x6')];this[_0xa26b('0x7')]=_0x383f19[_0xa26b('0x7')];this[_0xa26b('0x8')]=_0x383f19['countbusyretry']+_0x383f19[_0xa26b('0x6')]+_0x383f19['countnoanswerretry']+_0x383f19[_0xa26b('0x9')]+_0x383f19[_0xa26b('0xa')]+_0x383f19['countabandonedretry']+_0x383f19[_0xa26b('0xb')]+_0x383f19['countagentrejectretry'];this[_0xa26b('0x9')]=_0x383f19[_0xa26b('0x9')];this[_0xa26b('0xa')]=_0x383f19[_0xa26b('0xa')];this[_0xa26b('0xc')]=_0x383f19[_0xa26b('0xc')];this[_0xa26b('0xb')]=_0x383f19['countmachineretry'];this[_0xa26b('0xd')]=_0x383f19[_0xa26b('0xd')];this[_0xa26b('0x4')]=_0x383f19[_0xa26b('0x4')];this[_0xa26b('0xe')]=_0x383f19[_0xa26b('0xe')];this[_0xa26b('0xf')]=_0x383f19[_0xa26b('0xf')];this['starttime']=_0x383f19[_0xa26b('0x10')];this['responsetime']=_0x383f19['responsetime'];this[_0xa26b('0x11')]=_0x383f19[_0xa26b('0x12')];this['ringtime']=_0x383f19[_0xa26b('0x13')]||0x0;this['holdtime']=_0x383f19[_0xa26b('0x14')]||0x0;this[_0xa26b('0x15')]=_0x383f19[_0xa26b('0x15')]||0x0;this[_0xa26b('0x16')]=_0x383f19[_0xa26b('0x16')];this[_0xa26b('0x17')]=_0x383f19['callbackuniqueid'];this['callbackat']=_0x383f19['callbackat'];this[_0xa26b('0x18')]=_0x383f19[_0xa26b('0x18')];this[_0xa26b('0x19')]=_0x383f19['ContactId'];this[_0xa26b('0x1a')]=_0x383f19[_0xa26b('0x1a')];this[_0xa26b('0x1b')]=_0x383f19[_0xa26b('0x1b')];this['VoiceQueueId']=_0x383f19['VoiceQueueId'];this['CampaignId']=_0x383f19[_0xa26b('0x1c')];this['originatecalleridnum']=_0x383f19[_0xa26b('0x1d')]||'';this[_0xa26b('0x1e')]=_0x383f19[_0xa26b('0x1e')]||'';this[_0xa26b('0x1f')]=_0x383f19[_0xa26b('0x1f')];this['statedesc']=_0x383f19[_0xa26b('0x20')];}module['exports']=Final; \ No newline at end of file +var _0xa13d=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x1a06d4,_0x7dc182){var _0x24ddbb=function(_0x489500){while(--_0x489500){_0x1a06d4['push'](_0x1a06d4['shift']());}};_0x24ddbb(++_0x7dc182);}(_0xa13d,0xb6));var _0xda13=function(_0x3f6a32,_0x3321c3){_0x3f6a32=_0x3f6a32-0x0;var _0x514588=_0xa13d[_0x3f6a32];return _0x514588;};'use strict';function Final(_0x4d2719){this[_0xda13('0x0')]=_0x4d2719[_0xda13('0x0')];this['scheduledat']=_0x4d2719[_0xda13('0x1')];this[_0xda13('0x2')]=_0x4d2719[_0xda13('0x2')];this[_0xda13('0x3')]=_0x4d2719[_0xda13('0x2')]===_0xda13('0x4')?_0xda13('0x5'):_0x4d2719[_0xda13('0x2')];this['countbusyretry']=_0x4d2719[_0xda13('0x6')];this['countcongestionretry']=_0x4d2719[_0xda13('0x7')];this['countnoanswerretry']=_0x4d2719[_0xda13('0x8')];this['countglobal']=_0x4d2719['countbusyretry']+_0x4d2719[_0xda13('0x7')]+_0x4d2719[_0xda13('0x8')]+_0x4d2719[_0xda13('0x9')]+_0x4d2719[_0xda13('0xa')]+_0x4d2719[_0xda13('0xb')]+_0x4d2719[_0xda13('0xc')]+_0x4d2719[_0xda13('0xd')];this[_0xda13('0x9')]=_0x4d2719[_0xda13('0x9')];this[_0xda13('0xa')]=_0x4d2719[_0xda13('0xa')];this[_0xda13('0xb')]=_0x4d2719[_0xda13('0xb')];this[_0xda13('0xc')]=_0x4d2719[_0xda13('0xc')];this['countagentrejectretry']=_0x4d2719[_0xda13('0xd')];this[_0xda13('0x5')]=_0x4d2719['queue'];this[_0xda13('0xe')]=_0x4d2719[_0xda13('0xe')];this[_0xda13('0xf')]=_0x4d2719[_0xda13('0xf')];this[_0xda13('0x10')]=_0x4d2719[_0xda13('0x10')];this[_0xda13('0x11')]=_0x4d2719['responsetime'];this[_0xda13('0x12')]=_0x4d2719['responsetime'];this[_0xda13('0x13')]=_0x4d2719['ringtime']||0x0;this[_0xda13('0x14')]=_0x4d2719[_0xda13('0x14')]||0x0;this[_0xda13('0x15')]=_0x4d2719['talktime']||0x0;this[_0xda13('0x16')]=_0x4d2719[_0xda13('0x16')];this[_0xda13('0x17')]=_0x4d2719[_0xda13('0x17')];this[_0xda13('0x18')]=_0x4d2719[_0xda13('0x18')];this[_0xda13('0x19')]=_0x4d2719[_0xda13('0x19')];this[_0xda13('0x1a')]=_0x4d2719['ContactId'];this[_0xda13('0x1b')]=_0x4d2719[_0xda13('0x1b')];this[_0xda13('0x1c')]=_0x4d2719[_0xda13('0x1c')];this['VoiceQueueId']=_0x4d2719[_0xda13('0x1d')];this['CampaignId']=_0x4d2719[_0xda13('0x1e')];this[_0xda13('0x1f')]=_0x4d2719[_0xda13('0x1f')]||'';this[_0xda13('0x20')]=_0x4d2719[_0xda13('0x20')]||'';this['state']=_0x4d2719[_0xda13('0x21')];this[_0xda13('0x22')]=_0x4d2719[_0xda13('0x22')];}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 1c9e90e..c170103 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90d8=['calleridnum','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime','holdtime','talktime','membername','IVR','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name'];(function(_0x3c12a9,_0x4fb41c){var _0x533641=function(_0x317133){while(--_0x317133){_0x3c12a9['push'](_0x3c12a9['shift']());}};_0x533641(++_0x4fb41c);}(_0x90d8,0x9b));var _0x890d=function(_0x38b643,_0x14dc0d){_0x38b643=_0x38b643-0x0;var _0x23cf24=_0x90d8[_0x38b643];return _0x23cf24;};'use strict';var moment=require(_0x890d('0x0'));var utils=require('../utils');function Hangup(_0x597f18,_0x16ce77){this['state']=0x4;this[_0x890d('0x1')]=_0x890d('0x2');this['scheduledat']=_0x597f18[_0x890d('0x3')];this[_0x890d('0x4')]=_0x597f18[_0x890d('0x4')];this[_0x890d('0x5')]=_0x597f18[_0x890d('0x4')]===_0x890d('0x6')?_0x890d('0x7'):_0x597f18[_0x890d('0x4')];this[_0x890d('0x8')]=_0x597f18[_0x890d('0x8')]||![];this[_0x890d('0x9')]=_0x597f18[_0x890d('0x9')];this[_0x890d('0xa')]=_0x597f18[_0x890d('0xa')];this[_0x890d('0xb')]=_0x597f18[_0x890d('0xb')];this[_0x890d('0xc')]=_0x597f18[_0x890d('0x9')]+_0x597f18[_0x890d('0xa')]+_0x597f18[_0x890d('0xb')]+_0x597f18[_0x890d('0xd')]+_0x597f18[_0x890d('0xe')]+_0x597f18[_0x890d('0xf')]+_0x597f18['countmachineretry']+_0x597f18[_0x890d('0x10')];this['countnosuchnumberretry']=_0x597f18[_0x890d('0xd')];this[_0x890d('0xe')]=_0x597f18[_0x890d('0xe')];this[_0x890d('0xf')]=_0x597f18[_0x890d('0xf')];this['countmachineretry']=_0x597f18[_0x890d('0x11')];this['countagentrejectretry']=_0x597f18[_0x890d('0x10')];this[_0x890d('0x12')]=_0x16ce77[_0x890d('0x12')];this[_0x890d('0x13')]=_0x597f18[_0x890d('0x14')];this[_0x890d('0x15')]=_0x597f18[_0x890d('0x16')];this[_0x890d('0x17')]=_0x597f18[_0x890d('0x17')];this['responsetime']=_0x597f18['responsetime'];this[_0x890d('0x18')]=moment()[_0x890d('0x19')](_0x890d('0x1a'));this[_0x890d('0x1b')]=utils[_0x890d('0x1c')](_0x597f18[_0x890d('0x1d')],_0x597f18[_0x890d('0x17')]);this[_0x890d('0x1e')]=0x0;this[_0x890d('0x1f')]=utils['getSeconds'](this[_0x890d('0x18')],_0x597f18[_0x890d('0x1d')]);this[_0x890d('0x7')]=_0x597f18[_0x890d('0x7')];this[_0x890d('0x20')]=_0x890d('0x21');this['reason']=_0x16ce77['cause-txt'];this['callback']=_0x597f18[_0x890d('0x22')];this[_0x890d('0x23')]=_0x597f18[_0x890d('0x23')];this[_0x890d('0x24')]=_0x597f18['callbackat'];this[_0x890d('0x25')]=_0x597f18['recallme'];this[_0x890d('0x26')]=_0x597f18[_0x890d('0x26')];this[_0x890d('0x27')]=_0x597f18[_0x890d('0x27')];this[_0x890d('0x28')]=_0x597f18[_0x890d('0x28')];this[_0x890d('0x29')]=_0x597f18[_0x890d('0x29')];this[_0x890d('0x2a')]=_0x597f18[_0x890d('0x2a')];}module[_0x890d('0x2b')]=Hangup; \ No newline at end of file +var _0x3d92=['amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','type','campaigntype','outbound','queue'];(function(_0x476bcd,_0x2f6582){var _0x47b60f=function(_0x406a6e){while(--_0x406a6e){_0x476bcd['push'](_0x476bcd['shift']());}};_0x47b60f(++_0x2f6582);}(_0x3d92,0x117));var _0x23d9=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x3d92[_0x58ae8a];return _0x2f0b6b;};'use strict';var moment=require(_0x23d9('0x0'));var utils=require(_0x23d9('0x1'));function Hangup(_0x33cf25,_0x9b8cba){this[_0x23d9('0x2')]=0x4;this[_0x23d9('0x3')]='Answer';this['scheduledat']=_0x33cf25['scheduledat'];this[_0x23d9('0x4')]=_0x33cf25[_0x23d9('0x4')];this[_0x23d9('0x5')]=_0x33cf25['type']===_0x23d9('0x6')?_0x23d9('0x7'):_0x33cf25[_0x23d9('0x4')];this[_0x23d9('0x8')]=_0x33cf25[_0x23d9('0x8')]||![];this[_0x23d9('0x9')]=_0x33cf25['countbusyretry'];this[_0x23d9('0xa')]=_0x33cf25[_0x23d9('0xa')];this[_0x23d9('0xb')]=_0x33cf25[_0x23d9('0xb')];this[_0x23d9('0xc')]=_0x33cf25['countbusyretry']+_0x33cf25[_0x23d9('0xa')]+_0x33cf25[_0x23d9('0xb')]+_0x33cf25[_0x23d9('0xd')]+_0x33cf25[_0x23d9('0xe')]+_0x33cf25[_0x23d9('0xf')]+_0x33cf25[_0x23d9('0x10')]+_0x33cf25[_0x23d9('0x11')];this[_0x23d9('0xd')]=_0x33cf25[_0x23d9('0xd')];this['countdropretry']=_0x33cf25['countdropretry'];this[_0x23d9('0xf')]=_0x33cf25[_0x23d9('0xf')];this[_0x23d9('0x10')]=_0x33cf25['countmachineretry'];this[_0x23d9('0x11')]=_0x33cf25[_0x23d9('0x11')];this['uniqueid']=_0x9b8cba[_0x23d9('0x12')];this[_0x23d9('0x13')]=_0x33cf25['name'];this[_0x23d9('0x14')]=_0x33cf25[_0x23d9('0x15')];this[_0x23d9('0x16')]=_0x33cf25['starttime'];this[_0x23d9('0x17')]=_0x33cf25['responsetime'];this[_0x23d9('0x18')]=moment()[_0x23d9('0x19')](_0x23d9('0x1a'));this['ringtime']=utils[_0x23d9('0x1b')](_0x33cf25['responsetime'],_0x33cf25['starttime']);this[_0x23d9('0x1c')]=0x0;this[_0x23d9('0x1d')]=utils['getSeconds'](this[_0x23d9('0x18')],_0x33cf25['responsetime']);this[_0x23d9('0x7')]=_0x33cf25[_0x23d9('0x7')];this[_0x23d9('0x1e')]=_0x23d9('0x1f');this['reason']=_0x9b8cba[_0x23d9('0x20')];this['callback']=_0x33cf25[_0x23d9('0x21')];this[_0x23d9('0x22')]=_0x33cf25['callbackuniqueid'];this[_0x23d9('0x23')]=_0x33cf25[_0x23d9('0x23')];this[_0x23d9('0x24')]=_0x33cf25[_0x23d9('0x24')];this['ContactId']=_0x33cf25['ContactId'];this[_0x23d9('0x25')]=_0x33cf25[_0x23d9('0x25')];this['UserId']=_0x33cf25['UserId'];this['VoiceQueueId']=_0x33cf25[_0x23d9('0x26')];this[_0x23d9('0x27')]=_0x33cf25[_0x23d9('0x27')];}module[_0x23d9('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 1ac38fd..557d709 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf023=['originatecalleridname','state','statedesc','exports','../utils','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x2e2d19,_0x336146){var _0x1b05d7=function(_0x1ab18c){while(--_0x1ab18c){_0x2e2d19['push'](_0x2e2d19['shift']());}};_0x1b05d7(++_0x336146);}(_0xf023,0x1a8));var _0x3f02=function(_0x567923,_0x199d35){_0x567923=_0x567923-0x0;var _0x5741a6=_0xf023[_0x567923];return _0x5741a6;};'use strict';var utils=require(_0x3f02('0x0'));function History(_0x520800){this['uniqueid']=_0x520800['uniqueid'];this[_0x3f02('0x1')]=_0x520800['scheduledat']||undefined;this[_0x3f02('0x2')]=_0x520800['type'];this['campaigntype']=_0x520800['type']==='outbound'?'queue':_0x520800['type'];this[_0x3f02('0x3')]=_0x520800[_0x3f02('0x3')];this['countcongestionretry']=_0x520800[_0x3f02('0x4')];this['countnoanswerretry']=_0x520800[_0x3f02('0x5')];this[_0x3f02('0x6')]=_0x520800['countbusyretry']+_0x520800[_0x3f02('0x4')]+_0x520800[_0x3f02('0x5')]+_0x520800['countnosuchnumberretry']+_0x520800['countdropretry']+_0x520800[_0x3f02('0x7')]+_0x520800[_0x3f02('0x8')]+_0x520800['countagentrejectretry'];this['countnosuchnumberretry']=_0x520800[_0x3f02('0x9')];this[_0x3f02('0xa')]=_0x520800[_0x3f02('0xa')];this[_0x3f02('0x7')]=_0x520800[_0x3f02('0x7')];this[_0x3f02('0x8')]=_0x520800[_0x3f02('0x8')];this[_0x3f02('0xb')]=_0x520800[_0x3f02('0xb')];this['queue']=_0x520800['queue'];this[_0x3f02('0xc')]=_0x520800['name'];this[_0x3f02('0xd')]=_0x520800[_0x3f02('0xe')];this[_0x3f02('0xf')]=_0x520800[_0x3f02('0xf')];this[_0x3f02('0x10')]=_0x520800[_0x3f02('0x10')];this['endtime']=_0x520800[_0x3f02('0x10')];this['ringtime']=utils['getSeconds'](_0x520800[_0x3f02('0x10')],_0x520800[_0x3f02('0xf')]);this[_0x3f02('0x11')]=0x0;this[_0x3f02('0x12')]=0x0;this['callback']=_0x520800['callback'];this[_0x3f02('0x13')]=_0x520800[_0x3f02('0x13')];this[_0x3f02('0x14')]=_0x520800[_0x3f02('0x14')];this[_0x3f02('0x15')]=_0x520800[_0x3f02('0x15')];this['ContactId']=_0x520800[_0x3f02('0x16')];this['ListId']=_0x520800['ListId'];this['UserId']=_0x520800['UserId'];this['VoiceQueueId']=_0x520800[_0x3f02('0x17')];this[_0x3f02('0x18')]=_0x520800[_0x3f02('0x18')];this[_0x3f02('0x19')]=_0x520800[_0x3f02('0x19')]||'';this[_0x3f02('0x1a')]=_0x520800['originatecalleridname']||'';this[_0x3f02('0x1b')]=_0x520800[_0x3f02('0x1b')];this['statedesc']=_0x520800[_0x3f02('0x1c')];}module[_0x3f02('0x1d')]=History; \ No newline at end of file +var _0x7b98=['scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','name','calleridnum','number','starttime','responsetime','endtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid'];(function(_0x2919e2,_0x2eeea2){var _0x459272=function(_0x21d78c){while(--_0x21d78c){_0x2919e2['push'](_0x2919e2['shift']());}};_0x459272(++_0x2eeea2);}(_0x7b98,0x154));var _0x87b9=function(_0x58999b,_0xea4695){_0x58999b=_0x58999b-0x0;var _0x5efc3a=_0x7b98[_0x58999b];return _0x5efc3a;};'use strict';var utils=require(_0x87b9('0x0'));function History(_0x35dfcb){this['uniqueid']=_0x35dfcb[_0x87b9('0x1')];this['scheduledat']=_0x35dfcb[_0x87b9('0x2')]||undefined;this['type']=_0x35dfcb[_0x87b9('0x3')];this[_0x87b9('0x4')]=_0x35dfcb[_0x87b9('0x3')]===_0x87b9('0x5')?'queue':_0x35dfcb[_0x87b9('0x3')];this[_0x87b9('0x6')]=_0x35dfcb[_0x87b9('0x6')];this[_0x87b9('0x7')]=_0x35dfcb[_0x87b9('0x7')];this[_0x87b9('0x8')]=_0x35dfcb[_0x87b9('0x8')];this['countglobal']=_0x35dfcb[_0x87b9('0x6')]+_0x35dfcb[_0x87b9('0x7')]+_0x35dfcb[_0x87b9('0x8')]+_0x35dfcb[_0x87b9('0x9')]+_0x35dfcb[_0x87b9('0xa')]+_0x35dfcb[_0x87b9('0xb')]+_0x35dfcb[_0x87b9('0xc')]+_0x35dfcb[_0x87b9('0xd')];this[_0x87b9('0x9')]=_0x35dfcb['countnosuchnumberretry'];this['countdropretry']=_0x35dfcb['countdropretry'];this['countabandonedretry']=_0x35dfcb[_0x87b9('0xb')];this['countmachineretry']=_0x35dfcb['countmachineretry'];this['countagentrejectretry']=_0x35dfcb[_0x87b9('0xd')];this[_0x87b9('0xe')]=_0x35dfcb['queue'];this['calleridname']=_0x35dfcb[_0x87b9('0xf')];this[_0x87b9('0x10')]=_0x35dfcb[_0x87b9('0x11')];this['starttime']=_0x35dfcb[_0x87b9('0x12')];this[_0x87b9('0x13')]=_0x35dfcb[_0x87b9('0x13')];this[_0x87b9('0x14')]=_0x35dfcb[_0x87b9('0x13')];this['ringtime']=utils[_0x87b9('0x15')](_0x35dfcb[_0x87b9('0x13')],_0x35dfcb[_0x87b9('0x12')]);this[_0x87b9('0x16')]=0x0;this[_0x87b9('0x17')]=0x0;this['callback']=_0x35dfcb[_0x87b9('0x18')];this[_0x87b9('0x19')]=_0x35dfcb['callbackuniqueid'];this['callbackat']=_0x35dfcb[_0x87b9('0x1a')];this[_0x87b9('0x1b')]=_0x35dfcb[_0x87b9('0x1b')];this[_0x87b9('0x1c')]=_0x35dfcb[_0x87b9('0x1c')];this[_0x87b9('0x1d')]=_0x35dfcb[_0x87b9('0x1d')];this[_0x87b9('0x1e')]=_0x35dfcb[_0x87b9('0x1e')];this['VoiceQueueId']=_0x35dfcb[_0x87b9('0x1f')];this['CampaignId']=_0x35dfcb[_0x87b9('0x20')];this[_0x87b9('0x21')]=_0x35dfcb[_0x87b9('0x21')]||'';this['originatecalleridname']=_0x35dfcb[_0x87b9('0x22')]||'';this[_0x87b9('0x23')]=_0x35dfcb['state'];this[_0x87b9('0x24')]=_0x35dfcb[_0x87b9('0x24')];}module[_0x87b9('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index f0af134..b613837 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7d8=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','campaigntype','outbound','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','queue','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x4d399f,_0xdba7e7){var _0x4034d3=function(_0x44e88f){while(--_0x44e88f){_0x4d399f['push'](_0x4d399f['shift']());}};_0x4034d3(++_0xdba7e7);}(_0xa7d8,0xe0));var _0x8a7d=function(_0x782bc0,_0x2247f8){_0x782bc0=_0x782bc0-0x0;var _0x500efc=_0xa7d8[_0x782bc0];return _0x500efc;};'use strict';var utils=require(_0x8a7d('0x0'));function QueueCallerAbandon(_0x2e05c7,_0x41490a){this[_0x8a7d('0x1')]=_0x2e05c7[_0x8a7d('0x1')];this['type']=_0x2e05c7['type'];this[_0x8a7d('0x2')]=_0x2e05c7['type']===_0x8a7d('0x3')?'queue':_0x2e05c7[_0x8a7d('0x4')];this['countbusyretry']=_0x2e05c7[_0x8a7d('0x5')];this[_0x8a7d('0x6')]=_0x2e05c7[_0x8a7d('0x6')];this['countnoanswerretry']=_0x2e05c7[_0x8a7d('0x7')];this[_0x8a7d('0x8')]=_0x2e05c7[_0x8a7d('0x5')]+_0x2e05c7[_0x8a7d('0x6')]+_0x2e05c7[_0x8a7d('0x7')]+_0x2e05c7[_0x8a7d('0x9')]+_0x2e05c7[_0x8a7d('0xa')]+_0x2e05c7[_0x8a7d('0xb')]+_0x2e05c7['countmachineretry']+_0x2e05c7[_0x8a7d('0xc')];this['countnosuchnumberretry']=_0x2e05c7[_0x8a7d('0x9')];this[_0x8a7d('0xa')]=_0x2e05c7[_0x8a7d('0xa')];this[_0x8a7d('0xb')]=_0x2e05c7[_0x8a7d('0xb')];this['countmachineretry']=_0x2e05c7[_0x8a7d('0xd')];this['countagentrejectretry']=_0x2e05c7['countagentrejectretry'];this[_0x8a7d('0xe')]=_0x41490a[_0x8a7d('0xe')];this[_0x8a7d('0xf')]=_0x2e05c7[_0x8a7d('0x10')];this[_0x8a7d('0x11')]=_0x2e05c7[_0x8a7d('0x12')];this[_0x8a7d('0x13')]=_0x2e05c7[_0x8a7d('0x13')];this['responsetime']=_0x2e05c7[_0x8a7d('0x14')];this[_0x8a7d('0x15')]=_0x2e05c7['droptime'];this[_0x8a7d('0x16')]=_0x2e05c7[_0x8a7d('0x16')];this[_0x8a7d('0x17')]=this[_0x8a7d('0x15')];this['ringtime']=utils[_0x8a7d('0x18')](_0x2e05c7[_0x8a7d('0x14')],_0x2e05c7[_0x8a7d('0x13')]);this[_0x8a7d('0x19')]=utils[_0x8a7d('0x18')](this[_0x8a7d('0x15')],_0x2e05c7[_0x8a7d('0x14')]);this['talktime']=0x0;this[_0x8a7d('0x1a')]=_0x41490a[_0x8a7d('0x1a')];this[_0x8a7d('0x1b')]=_0x41490a[_0x8a7d('0x1c')];this[_0x8a7d('0x1d')]=_0x41490a[_0x8a7d('0x1d')];this['callback']=_0x2e05c7['callback'];this[_0x8a7d('0x1e')]=_0x2e05c7[_0x8a7d('0x1e')];this[_0x8a7d('0x1f')]=_0x2e05c7[_0x8a7d('0x1f')];this[_0x8a7d('0x20')]=_0x2e05c7[_0x8a7d('0x20')];this[_0x8a7d('0x21')]=_0x2e05c7[_0x8a7d('0x21')];this[_0x8a7d('0x22')]=_0x2e05c7[_0x8a7d('0x22')];this[_0x8a7d('0x23')]=_0x2e05c7[_0x8a7d('0x23')];this[_0x8a7d('0x24')]=_0x2e05c7['VoiceQueueId'];this[_0x8a7d('0x25')]=_0x2e05c7[_0x8a7d('0x25')];this[_0x8a7d('0x26')]=_0x2e05c7['originatecalleridnum']||'';this[_0x8a7d('0x27')]=_0x2e05c7[_0x8a7d('0x27')]||'';this['agiafterat']=_0x2e05c7[_0x8a7d('0x28')];this[_0x8a7d('0x29')]=_0x2e05c7[_0x8a7d('0x29')];this[_0x8a7d('0x2a')]=_0x2e05c7['statedesc'];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xf7d2=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','statedesc','exports','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','calleridnum','starttime','responsetime','dropreason','droptime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x79e13f,_0x1acca2){var _0x456d26=function(_0xfee51f){while(--_0xfee51f){_0x79e13f['push'](_0x79e13f['shift']());}};_0x456d26(++_0x1acca2);}(_0xf7d2,0x149));var _0x2f7d=function(_0x3439ea,_0x3c68ba){_0x3439ea=_0x3439ea-0x0;var _0x3900a3=_0xf7d2[_0x3439ea];return _0x3900a3;};'use strict';var utils=require(_0x2f7d('0x0'));function QueueCallerAbandon(_0x643d1,_0x2de744){this['scheduledat']=_0x643d1[_0x2f7d('0x1')];this[_0x2f7d('0x2')]=_0x643d1['type'];this['campaigntype']=_0x643d1['type']===_0x2f7d('0x3')?_0x2f7d('0x4'):_0x643d1[_0x2f7d('0x2')];this[_0x2f7d('0x5')]=_0x643d1['countbusyretry'];this[_0x2f7d('0x6')]=_0x643d1[_0x2f7d('0x6')];this[_0x2f7d('0x7')]=_0x643d1[_0x2f7d('0x7')];this[_0x2f7d('0x8')]=_0x643d1['countbusyretry']+_0x643d1['countcongestionretry']+_0x643d1[_0x2f7d('0x7')]+_0x643d1[_0x2f7d('0x9')]+_0x643d1[_0x2f7d('0xa')]+_0x643d1['countabandonedretry']+_0x643d1[_0x2f7d('0xb')]+_0x643d1[_0x2f7d('0xc')];this[_0x2f7d('0x9')]=_0x643d1[_0x2f7d('0x9')];this[_0x2f7d('0xa')]=_0x643d1['countdropretry'];this['countabandonedretry']=_0x643d1[_0x2f7d('0xd')];this[_0x2f7d('0xb')]=_0x643d1[_0x2f7d('0xb')];this['countagentrejectretry']=_0x643d1['countagentrejectretry'];this[_0x2f7d('0xe')]=_0x2de744[_0x2f7d('0xe')];this[_0x2f7d('0xf')]=_0x643d1['name'];this[_0x2f7d('0x10')]=_0x643d1['number'];this[_0x2f7d('0x11')]=_0x643d1[_0x2f7d('0x11')];this[_0x2f7d('0x12')]=_0x643d1[_0x2f7d('0x12')];this['droptime']=_0x643d1['droptime'];this[_0x2f7d('0x13')]=_0x643d1[_0x2f7d('0x13')];this['endtime']=this[_0x2f7d('0x14')];this['ringtime']=utils[_0x2f7d('0x15')](_0x643d1['responsetime'],_0x643d1['starttime']);this['holdtime']=utils[_0x2f7d('0x15')](this[_0x2f7d('0x14')],_0x643d1['responsetime']);this[_0x2f7d('0x16')]=0x0;this[_0x2f7d('0x4')]=_0x2de744[_0x2f7d('0x4')];this[_0x2f7d('0x17')]=_0x2de744[_0x2f7d('0x18')];this[_0x2f7d('0x19')]=_0x2de744[_0x2f7d('0x19')];this[_0x2f7d('0x1a')]=_0x643d1[_0x2f7d('0x1a')];this['callbackuniqueid']=_0x643d1[_0x2f7d('0x1b')];this[_0x2f7d('0x1c')]=_0x643d1[_0x2f7d('0x1c')];this[_0x2f7d('0x1d')]=_0x643d1[_0x2f7d('0x1d')];this['ContactId']=_0x643d1[_0x2f7d('0x1e')];this[_0x2f7d('0x1f')]=_0x643d1[_0x2f7d('0x1f')];this[_0x2f7d('0x20')]=_0x643d1[_0x2f7d('0x20')];this[_0x2f7d('0x21')]=_0x643d1[_0x2f7d('0x21')];this['CampaignId']=_0x643d1[_0x2f7d('0x22')];this[_0x2f7d('0x23')]=_0x643d1[_0x2f7d('0x23')]||'';this[_0x2f7d('0x24')]=_0x643d1['originatecalleridname']||'';this[_0x2f7d('0x25')]=_0x643d1[_0x2f7d('0x25')];this['state']=_0x643d1['state'];this['statedesc']=_0x643d1[_0x2f7d('0x26')];}module[_0x2f7d('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index dfe48de..f2a9958 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','temp','getContactDialer','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperBlack','inspect','dialOrderByScheduledAt'];(function(_0x10e485,_0x4ee577){var _0x540f38=function(_0x5c57bd){while(--_0x5c57bd){_0x10e485['push'](_0x10e485['shift']());}};_0x540f38(++_0x4ee577);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var util=require(_0x0a9e('0x0'));var logger=require(_0x0a9e('0x1'))(_0x0a9e('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0a9e('0x3'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x333808){return util[_0x0a9e('0x4')](_0x333808,{'showHidden':![],'depth':null});}function getContactDialer(_0x2ab90b,_0x991246,_0x981158){return cmHopper['getContactDialer'](_0x2ab90b['id'],_0x991246,_0x981158,_0x2ab90b[_0x0a9e('0x5')])[_0x0a9e('0x6')](function(_0x2cc193){_0x2ab90b['temp']-=_0x981158;if(_0x2ab90b['temp']<0x0){_0x2ab90b[_0x0a9e('0x7')]=0x0;}logger['error']('[getContactDialer]',inspectError(_0x2cc193));});}exports[_0x0a9e('0x8')]=getContactDialer;function getContactDialerIvr(_0xf81284,_0x307b3e){return cmHopper[_0x0a9e('0x9')](_0xf81284['id'],_0x307b3e,_0xf81284[_0x0a9e('0x5')])[_0x0a9e('0x6')](function(_0x4a4c56){_0xf81284['temp']-=_0x307b3e;if(_0xf81284['temp']<0x0){_0xf81284['temp']=0x0;}logger[_0x0a9e('0xa')](_0x0a9e('0xb'),inspectError(_0x4a4c56));});}exports[_0x0a9e('0x9')]=getContactDialerIvr;function countReScheduled(_0x26d672){return cmHopper[_0x0a9e('0xc')](_0x26d672)[_0x0a9e('0x6')](function(_0x5db4b0){logger[_0x0a9e('0xa')](_0x0a9e('0xd'),inspectError(_0x5db4b0));});}exports[_0x0a9e('0xc')]=countReScheduled;function rescheduleContact(_0x281129){return cmHopper[_0x0a9e('0xe')](_0x281129)[_0x0a9e('0x6')](function(_0x52a03d){logger[_0x0a9e('0xa')]('[rescheduleContact]',inspectError(_0x52a03d));});}exports[_0x0a9e('0xe')]=rescheduleContact;function unlockContact(_0x519dfd,_0x16033c,_0x12066b){return cmHopper['unlockContact'](_0x519dfd,_0x16033c,_0x12066b)[_0x0a9e('0x6')](function(_0x5a0a06){logger[_0x0a9e('0xa')](_0x0a9e('0xf'),inspectError(_0x5a0a06));});}exports[_0x0a9e('0x10')]=unlockContact;function moveContactManagedDialer(_0x205fd6){return cmHopper[_0x0a9e('0x11')](_0x205fd6)[_0x0a9e('0x6')](function(_0x530eb7){logger[_0x0a9e('0xa')](_0x0a9e('0x12'),inspectError(_0x530eb7));});}exports[_0x0a9e('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x1c696a){return cmHopperBlack[_0x0a9e('0x13')](_0x1c696a)['catch'](function(_0x2c3407){logger[_0x0a9e('0xa')]('[checkIsBlackList]',inspectError(_0x2c3407));});}exports[_0x0a9e('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x5a09ef){return cmHopperBlack['checkIsBlackListIvr'](_0x5a09ef)[_0x0a9e('0x6')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x14'),inspectError(_0x432e56));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return cmHopperAdditionalPhone[_0x0a9e('0x15')](_0xfb6e48,_0x2fb0e4,_0x3b45bc)[_0x0a9e('0x6')](function(_0x42ac8f){logger[_0x0a9e('0xa')]('[verifyAdditionalPhone]',inspectError(_0x42ac8f));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x197ec0,_0x3a8e58,_0x40c424){return cmHopperAdditionalPhone[_0x0a9e('0x16')](_0x197ec0,_0x3a8e58,_0x40c424)['catch'](function(_0x384319){logger['error'](_0x0a9e('0x17'),inspectError(_0x384319));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x1dc186){return cmHopperHistory[_0x0a9e('0x18')](_0x1dc186)[_0x0a9e('0x6')](function(_0x14433c){logger[_0x0a9e('0xa')](_0x0a9e('0x19'),inspectError(_0x14433c));});}exports[_0x0a9e('0x18')]=avgHandleTime;function createHistory(_0x14de77){return cmHopperHistory['createHistory'](_0x14de77)[_0x0a9e('0x6')](function(_0x468813){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),inspectError(_0x468813));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x26713c,_0x3e8fd2){var _0x141352=function(_0x4a21ac){while(--_0x4a21ac){_0x26713c['push'](_0x26713c['shift']());}};_0x141352(++_0x3e8fd2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 177ccab..6cd6282 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ac5=['replace','toString','getCallerIdRandom','error','decrementOriginate','length','checkContactEmpty','erlangb','createdAt','description','updatedAt','undefined','%s%s','toUpperCase','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','ivr','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow'];(function(_0xe41dc4,_0x2d2540){var _0x115076=function(_0x5b895d){while(--_0x5b895d){_0xe41dc4['push'](_0xe41dc4['shift']());}};_0x115076(++_0x2d2540);}(_0x1ac5,0x1a8));var _0x51ac=function(_0x365150,_0x107153){_0x365150=_0x365150-0x0;var _0x4e5998=_0x1ac5[_0x365150];return _0x4e5998;};'use strict';var _=require('lodash');var moment=require(_0x51ac('0x0'));var util=require(_0x51ac('0x1'));var logger=require(_0x51ac('0x2'))(_0x51ac('0x3'));var timezones=require(_0x51ac('0x4'))[_0x51ac('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x51ac('0x6'),'BLACKLIST':_0x51ac('0x7'),'CONTACTS_RESCHEDULED':_0x51ac('0x8'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x51ac('0x9'),'EMPTY_INTERVAL':_0x51ac('0xa'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x51ac('0xb'),'OVERTIME_INTERVAL':_0x51ac('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0x51ac('0xd'),'QUEUE_RECALL':_0x51ac('0xe'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x51ac('0xf'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x51ac('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x4eadb9){return _0x4eadb9[_0x51ac('0x11')]==='preview';}exports[_0x51ac('0x12')]=isPreviewCampaign;function isIVRCampaign(_0xd9f283){return _0xd9f283['type']===_0x51ac('0x13');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x4ca553){return _0x4ca553[_0x51ac('0x14')]===_0x51ac('0x15');}exports[_0x51ac('0x16')]=isOutboundQueue;function isQueueCampaignActive(_0x522ea7){return _0x522ea7[_0x51ac('0x17')];}exports[_0x51ac('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x14b1b4){return _0x14b1b4[_0x51ac('0x19')];}exports[_0x51ac('0x1a')]=isIVRCampaignActive;function getSeconds(_0x45c914,_0x390080){var _0x40197b=moment(_0x45c914)[_0x51ac('0x1b')](0x0);var _0x35d7e6=moment(_0x390080)[_0x51ac('0x1b')](0x0);return _0x40197b[_0x51ac('0x1c')](_0x35d7e6,_0x51ac('0x1d'));}exports[_0x51ac('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x2df49c,_0x404591){var _0x56d580=![];var _0x4a6a7b=_0x2df49c[_0x51ac('0x11')]!==_0x404591['dialMethod']||_0x2df49c[_0x51ac('0x17')]!==_0x404591[_0x51ac('0x17')]||_0x2df49c['message']!==_0x404591[_0x51ac('0x1f')];var _0x3a6f35=_0x2df49c[_0x51ac('0x20')]!==_0x404591[_0x51ac('0x20')]||_0x2df49c['loggedIn']!==_0x404591[_0x51ac('0x21')]||_0x2df49c[_0x51ac('0x22')]!==_0x404591['loggedInDb']||_0x2df49c[_0x51ac('0x23')]!==_0x404591[_0x51ac('0x23')]||_0x2df49c[_0x51ac('0x24')]!==_0x404591[_0x51ac('0x24')]||_0x2df49c[_0x51ac('0x25')]!==_0x404591['pTalking']||_0x2df49c['waiting']!==_0x404591[_0x51ac('0x26')]||_0x2df49c[_0x51ac('0x27')]!==_0x404591[_0x51ac('0x27')]||_0x2df49c[_0x51ac('0x28')]!==_0x404591[_0x51ac('0x28')];if(_0x2df49c['Trunk']&&_0x404591[_0x51ac('0x29')]){_0x56d580=_0x2df49c[_0x51ac('0x29')][_0x51ac('0x2a')]!==_0x404591[_0x51ac('0x29')][_0x51ac('0x2a')]||_0x2df49c['Trunk'][_0x51ac('0x19')]!==_0x404591[_0x51ac('0x29')][_0x51ac('0x19')];}return _0x4a6a7b||_0x3a6f35||_0x56d580;}exports[_0x51ac('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x4405ea){var _0x31d8f2=null;var _0x59f0c9=_0x4405ea[_0x51ac('0x2c')];if(_[_0x51ac('0x2d')](_0x4405ea[_0x51ac('0x2e')])||_[_0x51ac('0x2d')](_0x4405ea[_0x51ac('0x2f')])||_[_0x51ac('0x2d')](_0x4405ea['Interval'][_0x51ac('0x30')])){_0x31d8f2=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x51ac('0x31')](_0x4405ea[_0x51ac('0x2e')])||_['isEmpty'](_0x4405ea[_0x51ac('0x2f')]['Intervals'])){_0x31d8f2=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x59f0c9&&!timezones[_0x59f0c9]){_0x31d8f2=CAMPAIGN_STATUS[_0x51ac('0x32')];}return _0x31d8f2;}function checkAnyValidTrunk(_0x1f6678,_0x526ecd){var _0x2ea407=null;var _0x5aa5e1=_0x51ac('0x33');var _0x4e92a7=[_0x51ac('0x34'),_0x51ac('0x35')];var _0x4b94cd=!![];if(_0x1f6678['Trunk']&&_0x1f6678[_0x51ac('0x29')][_0x51ac('0x19')]){_0x5aa5e1+=_0x1f6678[_0x51ac('0x29')][_0x51ac('0x2a')];_0x2ea407=_0x526ecd[_0x5aa5e1];_0x4b94cd=_0x4e92a7[_0x51ac('0x36')](_0x2ea407[_0x51ac('0x37')]);}else if(_0x1f6678['TrunkBackup']&&_0x1f6678['TrunkBackup']['active']){_0x5aa5e1+=_0x1f6678['TrunkBackup'][_0x51ac('0x2a')];_0x2ea407=_0x526ecd[_0x5aa5e1];_0x4b94cd=_0x4e92a7[_0x51ac('0x36')](_0x2ea407[_0x51ac('0x37')]);}return _0x4b94cd;}function getQueueCampaignStatusMessage(_0x323cbd,_0x4c15dd){var _0x30c173=CAMPAIGN_STATUS[_0x51ac('0x6')];var _0x36dbbc=isPreviewCampaign(_0x323cbd);if(!isQueueCampaignActive(_0x323cbd)){if(_0x36dbbc){_0x30c173=CAMPAIGN_STATUS[_0x51ac('0x38')];}else{if(_0x323cbd[_0x51ac('0x28')]===0x0&&_0x323cbd['talking']===0x0&&_0x323cbd[_0x51ac('0x26')]===0x0&&(_0x323cbd[_0x51ac('0x25')]||0x0)===0x0){_0x30c173=CAMPAIGN_STATUS[_0x51ac('0x38')];}else{_0x30c173=CAMPAIGN_STATUS[_0x51ac('0x39')];}}}else if(_0x323cbd[_0x51ac('0x21')]===0x0){_0x30c173=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x323cbd,_0x4c15dd)){_0x30c173=CAMPAIGN_STATUS[_0x51ac('0x3a')];}else if(!isPreviewCampaign(_0x323cbd)){var _0x383a8f=checkAnyValidQueueCampaignInterval(_0x323cbd);if(_0x383a8f){_0x30c173=_0x383a8f;}}return _0x30c173;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x259857){var _0x39e5d6=CAMPAIGN_STATUS[_0x51ac('0x39')];if(_0x259857['originated']===0x0&&_0x259857[_0x51ac('0x24')]===0x0&&_0x259857[_0x51ac('0x26')]===0x0&&(_0x259857[_0x51ac('0x25')]||0x0)===0x0){_0x39e5d6=CAMPAIGN_STATUS[_0x51ac('0x38')];}return _0x39e5d6;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x109bf3){var _0x24500f=_0x109bf3['match'](/"(.*?)"/);return _0x24500f?_0x24500f[0x1]:_0x109bf3;}exports[_0x51ac('0x3b')]=extractCalleridName;function getCallerId(_0x592cc4,_0x11792e,_0x2300be){if(!_[_0x51ac('0x3c')](_0x2300be)&&typeof _0x2300be===_0x51ac('0x3d')&&!_[_0x51ac('0x31')](_0x2300be)){if(!_[_0x51ac('0x3c')](_0x11792e)&&typeof _0x11792e===_0x51ac('0x3d')&&!_[_0x51ac('0x31')](_0x11792e)){return util[_0x51ac('0x3e')]('\x22%s\x22\x20<%s>',_0x11792e,_0x2300be);}return util['format'](_0x51ac('0x3f'),_0x2300be,_0x2300be);}if(!_['isUndefined'](_0x592cc4)&&typeof _0x592cc4===_0x51ac('0x3d')&&!_[_0x51ac('0x31')](_0x592cc4)){return _0x592cc4;}return _0x51ac('0x40');}exports[_0x51ac('0x41')]=getCallerId;function getCallerIdRandom(_0x192ef1,_0x1b357c){var _0x3e3ff1;var _0x310c56;var _0x275cc0;if(_0x1b357c<=0x0){_0x1b357c=0x1;}_0x3e3ff1=new RegExp(_0x51ac('0x42')+_0x1b357c+'}$');_0x310c56=Math[_0x51ac('0x43')](0xa,_0x1b357c-0x1);_0x275cc0=Math[_0x51ac('0x43')](0xa,_0x1b357c)-0x1;return util[_0x51ac('0x3e')]('%s',_[_0x51ac('0x44')](_0x192ef1,_0x3e3ff1,_['random'](_0x310c56,_0x275cc0)[_0x51ac('0x45')]()));}exports[_0x51ac('0x46')]=getCallerIdRandom;function decrementOriginate(_0x162876){if(_0x162876[_0x51ac('0x28')]&&_0x162876[_0x51ac('0x28')]>0x0){_0x162876[_0x51ac('0x28')]-=0x1;}else{logger[_0x51ac('0x47')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0x51ac('0x48')]=decrementOriginate;function checkContactEmpty(_0x2f3b39){return _0x2f3b39&&_0x2f3b39[_0x51ac('0x49')]>0x0;}exports[_0x51ac('0x4a')]=checkContactEmpty;function erlangb(_0x363c02,_0x935588){if(_0x935588===0x0){return 0x0;}var _0x43cf9e=0x1;for(var _0x242e9d=0x1;_0x242e9d<=_0x935588;_0x242e9d+=0x1){_0x43cf9e=0x1+_0x43cf9e*_0x242e9d/_0x363c02;}return 0x1/_0x43cf9e;}exports[_0x51ac('0x4b')]=erlangb;function checkContactLowerLimitOriginate(_0x4147a6,_0x3ca23f,_0x4e5934){if(_0x3ca23f>_0x4e5934){for(var _0xddc2e2=0x0;_0xddc2e2<_0x3ca23f-_0x4e5934;_0xddc2e2+=0x1){decrementOriginate(_0x4147a6);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x179679){var _0x5604dd={};var _0x33dedd=['id',_0x51ac('0x4c'),_0x51ac('0x4d'),'tags',_0x51ac('0x4e')];if(_0x179679){for(var _0x48d870 in _0x179679){if(typeof _0x179679[_0x48d870]!==_0x51ac('0x4f')){if(!_[_0x51ac('0x2d')](_0x179679[_0x48d870])&&!_0x33dedd[_0x51ac('0x36')](_0x48d870)){_0x5604dd[util[_0x51ac('0x3e')](_0x51ac('0x50'),'XMD-',_0x48d870[_0x51ac('0x51')]())]=_0x179679[_0x48d870];}}}}return _0x5604dd;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0xefe4=['format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','match','extractCalleridName','string','isUndefined'];(function(_0x114d1f,_0x55548e){var _0x5b91d4=function(_0x358415){while(--_0x358415){_0x114d1f['push'](_0x114d1f['shift']());}};_0x5b91d4(++_0x55548e);}(_0xefe4,0x199));var _0x4efe=function(_0x228340,_0x1ac61c){_0x228340=_0x228340-0x0;var _0x59ba3e=_0xefe4[_0x228340];return _0x59ba3e;};'use strict';var _=require(_0x4efe('0x0'));var moment=require(_0x4efe('0x1'));var util=require(_0x4efe('0x2'));var logger=require(_0x4efe('0x3'))('dialer');var timezones=require(_0x4efe('0x4'))[_0x4efe('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x4efe('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x4efe('0x7'),'EMPTY_INTERVAL':_0x4efe('0x8'),'INACTIVE':_0x4efe('0x9'),'NO_AGENTS_LOGGED':_0x4efe('0xa'),'NO_AVAILABLE_CONTACTS':_0x4efe('0xb'),'NULL_INTERVAL':_0x4efe('0xc'),'OVERTIME_INTERVAL':_0x4efe('0xd'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x4efe('0xe'),'RECALL_TIMEOUT':_0x4efe('0xf'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x4efe('0x10'),'UNREACHABLE_TRUNK':_0x4efe('0x11')};exports[_0x4efe('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2f5949){return _0x2f5949[_0x4efe('0x13')]===_0x4efe('0x14');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x110bff){return _0x110bff[_0x4efe('0x15')]===_0x4efe('0x16');}exports[_0x4efe('0x17')]=isIVRCampaign;function isOutboundQueue(_0x5eda79){return _0x5eda79[_0x4efe('0x15')]===_0x4efe('0x18');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x5a08f8){return _0x5a08f8[_0x4efe('0x19')];}exports[_0x4efe('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0xc32623){return _0xc32623[_0x4efe('0x1b')];}exports[_0x4efe('0x1c')]=isIVRCampaignActive;function getSeconds(_0x1dba96,_0x58227d){var _0x5ec1fc=moment(_0x1dba96)[_0x4efe('0x1d')](0x0);var _0x367c8e=moment(_0x58227d)[_0x4efe('0x1d')](0x0);return _0x5ec1fc[_0x4efe('0x1e')](_0x367c8e,_0x4efe('0x1f'));}exports[_0x4efe('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x167a6e,_0x510f3a){var _0x200d65=![];var _0x21cfcb=_0x167a6e['dialMethod']!==_0x510f3a[_0x4efe('0x13')]||_0x167a6e['dialActive']!==_0x510f3a['dialActive']||_0x167a6e[_0x4efe('0x21')]!==_0x510f3a[_0x4efe('0x21')];var _0xfb39e=_0x167a6e['available']!==_0x510f3a['available']||_0x167a6e[_0x4efe('0x22')]!==_0x510f3a[_0x4efe('0x22')]||_0x167a6e['loggedInDb']!==_0x510f3a[_0x4efe('0x23')]||_0x167a6e[_0x4efe('0x24')]!==_0x510f3a[_0x4efe('0x24')]||_0x167a6e[_0x4efe('0x25')]!==_0x510f3a[_0x4efe('0x25')]||_0x167a6e[_0x4efe('0x26')]!==_0x510f3a[_0x4efe('0x26')]||_0x167a6e[_0x4efe('0x27')]!==_0x510f3a[_0x4efe('0x27')]||_0x167a6e[_0x4efe('0x28')]!==_0x510f3a[_0x4efe('0x28')]||_0x167a6e[_0x4efe('0x29')]!==_0x510f3a['originated'];if(_0x167a6e[_0x4efe('0x2a')]&&_0x510f3a[_0x4efe('0x2a')]){_0x200d65=_0x167a6e[_0x4efe('0x2a')][_0x4efe('0x2b')]!==_0x510f3a['Trunk']['name']||_0x167a6e['Trunk'][_0x4efe('0x1b')]!==_0x510f3a['Trunk'][_0x4efe('0x1b')];}return _0x21cfcb||_0xfb39e||_0x200d65;}exports[_0x4efe('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x552bff){var _0x16afc5=null;var _0x327f49=_0x552bff[_0x4efe('0x2d')];if(_['isNil'](_0x552bff[_0x4efe('0x2e')])||_[_0x4efe('0x2f')](_0x552bff[_0x4efe('0x30')])||_[_0x4efe('0x2f')](_0x552bff['Interval'][_0x4efe('0x31')])){_0x16afc5=CAMPAIGN_STATUS[_0x4efe('0x32')];}else if(_[_0x4efe('0x33')](_0x552bff[_0x4efe('0x2e')])||_[_0x4efe('0x33')](_0x552bff['Interval']['Intervals'])){_0x16afc5=CAMPAIGN_STATUS[_0x4efe('0x34')];}else if(_0x327f49&&!timezones[_0x327f49]){_0x16afc5=CAMPAIGN_STATUS[_0x4efe('0x35')];}return _0x16afc5;}function checkAnyValidTrunk(_0xa1898f,_0x839a5a){var _0x2479aa=null;var _0x286a7c=_0x4efe('0x36');var _0x7518a5=['reachable','unmonitored'];var _0x26bb0c=!![];if(_0xa1898f['Trunk']&&_0xa1898f['Trunk'][_0x4efe('0x1b')]){_0x286a7c+=_0xa1898f[_0x4efe('0x2a')][_0x4efe('0x2b')];_0x2479aa=_0x839a5a[_0x286a7c];_0x26bb0c=_0x7518a5[_0x4efe('0x37')](_0x2479aa[_0x4efe('0x38')]);}else if(_0xa1898f[_0x4efe('0x39')]&&_0xa1898f[_0x4efe('0x39')][_0x4efe('0x1b')]){_0x286a7c+=_0xa1898f[_0x4efe('0x39')][_0x4efe('0x2b')];_0x2479aa=_0x839a5a[_0x286a7c];_0x26bb0c=_0x7518a5[_0x4efe('0x37')](_0x2479aa[_0x4efe('0x38')]);}return _0x26bb0c;}function getQueueCampaignStatusMessage(_0x40b63c,_0x1112a9){var _0x51a785=CAMPAIGN_STATUS[_0x4efe('0x6')];var _0x924c1=isPreviewCampaign(_0x40b63c);if(!isQueueCampaignActive(_0x40b63c)){if(_0x924c1){_0x51a785=CAMPAIGN_STATUS[_0x4efe('0x3a')];}else{if(_0x40b63c[_0x4efe('0x29')]===0x0&&_0x40b63c['talking']===0x0&&_0x40b63c['waiting']===0x0&&(_0x40b63c[_0x4efe('0x26')]||0x0)===0x0){_0x51a785=CAMPAIGN_STATUS[_0x4efe('0x3a')];}else{_0x51a785=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x40b63c[_0x4efe('0x22')]===0x0){_0x51a785=CAMPAIGN_STATUS[_0x4efe('0x3b')];}else if(!checkAnyValidTrunk(_0x40b63c,_0x1112a9)){_0x51a785=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x40b63c)){var _0x33f0db=checkAnyValidQueueCampaignInterval(_0x40b63c);if(_0x33f0db){_0x51a785=_0x33f0db;}}return _0x51a785;}exports[_0x4efe('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2eeaf5){var _0x4e8e30=CAMPAIGN_STATUS['DISACTIVED'];if(_0x2eeaf5[_0x4efe('0x29')]===0x0&&_0x2eeaf5[_0x4efe('0x25')]===0x0&&_0x2eeaf5[_0x4efe('0x27')]===0x0&&(_0x2eeaf5[_0x4efe('0x26')]||0x0)===0x0){_0x4e8e30=CAMPAIGN_STATUS[_0x4efe('0x3a')];}return _0x4e8e30;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x579ad5){var _0x1c267b=_0x579ad5[_0x4efe('0x3d')](/"(.*?)"/);return _0x1c267b?_0x1c267b[0x1]:_0x579ad5;}exports[_0x4efe('0x3e')]=extractCalleridName;function getCallerId(_0x4ab29d,_0x559343,_0x20dec7){if(!_['isUndefined'](_0x20dec7)&&typeof _0x20dec7===_0x4efe('0x3f')&&!_[_0x4efe('0x33')](_0x20dec7)){if(!_[_0x4efe('0x40')](_0x559343)&&typeof _0x559343===_0x4efe('0x3f')&&!_[_0x4efe('0x33')](_0x559343)){return util[_0x4efe('0x41')](_0x4efe('0x42'),_0x559343,_0x20dec7);}return util['format'](_0x4efe('0x42'),_0x20dec7,_0x20dec7);}if(!_[_0x4efe('0x40')](_0x4ab29d)&&typeof _0x4ab29d==='string'&&!_[_0x4efe('0x33')](_0x4ab29d)){return _0x4ab29d;}return _0x4efe('0x43');}exports[_0x4efe('0x44')]=getCallerId;function getCallerIdRandom(_0x5d7098,_0x448ca8){var _0x377206;var _0xcae6a4;var _0x552b0a;if(_0x448ca8<=0x0){_0x448ca8=0x1;}_0x377206=new RegExp(_0x4efe('0x45')+_0x448ca8+'}$');_0xcae6a4=Math[_0x4efe('0x46')](0xa,_0x448ca8-0x1);_0x552b0a=Math['pow'](0xa,_0x448ca8)-0x1;return util[_0x4efe('0x41')]('%s',_[_0x4efe('0x47')](_0x5d7098,_0x377206,_[_0x4efe('0x48')](_0xcae6a4,_0x552b0a)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x57dd21){if(_0x57dd21[_0x4efe('0x29')]&&_0x57dd21[_0x4efe('0x29')]>0x0){_0x57dd21['originated']-=0x1;}else{logger[_0x4efe('0x49')](_0x4efe('0x4a'));}}exports[_0x4efe('0x4b')]=decrementOriginate;function checkContactEmpty(_0x30b872){return _0x30b872&&_0x30b872['length']>0x0;}exports[_0x4efe('0x4c')]=checkContactEmpty;function erlangb(_0x1e3e55,_0x11686c){if(_0x11686c===0x0){return 0x0;}var _0xc4fbdb=0x1;for(var _0x3a7c2d=0x1;_0x3a7c2d<=_0x11686c;_0x3a7c2d+=0x1){_0xc4fbdb=0x1+_0xc4fbdb*_0x3a7c2d/_0x1e3e55;}return 0x1/_0xc4fbdb;}exports[_0x4efe('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x4afa7b,_0x504588,_0x4c9147){if(_0x504588>_0x4c9147){for(var _0x463295=0x0;_0x463295<_0x504588-_0x4c9147;_0x463295+=0x1){decrementOriginate(_0x4afa7b);}}}exports[_0x4efe('0x4e')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 25cb43f..20a94e2 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(_0x1e93d2,_0x1e627c){var _0x16f365=function(_0x3678c4){while(--_0x3678c4){_0x1e93d2['push'](_0x1e93d2['shift']());}};_0x16f365(++_0x1e627c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x2bfe36,_0x5a2522){var _0x31d3e8=function(_0x3e68a1){while(--_0x3e68a1){_0x2bfe36['push'](_0x2bfe36['shift']());}};_0x31d3e8(++_0x5a2522);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 25fcd49..883d847 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 _0xc2df=['[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','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','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./channel','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','exten','localstationid','channel','uniqueid','name','\x20syncNewchannel\x20','syncVarSet','value','channelstate','channelstatedesc','variable','hasOwnProperty','operation','status','filename','info','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','response','AttachmentId','SENDING\x20FAILED\x20','logger'];(function(_0x53cf97,_0x328162){var _0x110bad=function(_0x461d3e){while(--_0x461d3e){_0x53cf97['push'](_0x53cf97['shift']());}};_0x110bad(++_0x328162);}(_0xc2df,0x197));var _0xfc2d=function(_0x36cb4b,_0x1f8150){_0x36cb4b=_0x36cb4b-0x0;var _0x37a01f=_0xc2df[_0x36cb4b];return _0x37a01f;};'use strict';var util=require(_0xfc2d('0x0'));var _=require(_0xfc2d('0x1'));var BPromise=require('bluebird');var uuid=require(_0xfc2d('0x2'));var moment=require(_0xfc2d('0x3'));var path=require(_0xfc2d('0x4'));var tiff2pdf=require(_0xfc2d('0x5'));var gs=require('./util/gs');var logger=require(_0xfc2d('0x6'))(_0xfc2d('0x7'));var ami=require(_0xfc2d('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0xfc2d('0x9'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0xfc2d('0xa'));var attachment=require(_0xfc2d('0xb'));var faxMessage=require(_0xfc2d('0xc'));function Fax(_0x271798){this[_0xfc2d('0xd')]={};this[_0xfc2d('0xe')]=_0x271798['faxAccounts'];this[_0xfc2d('0xf')]=_0x271798['trunks'];this[_0xfc2d('0x10')]={};ami['on'](_0xfc2d('0x11'),this[_0xfc2d('0x12')][_0xfc2d('0x13')](this));ami['on'](_0xfc2d('0x14'),this['syncVarSet']['bind'](this));ami['on'](_0xfc2d('0x15'),this[_0xfc2d('0x16')][_0xfc2d('0x13')](this));ami['on'](_0xfc2d('0x17'),this['syncNewExten'][_0xfc2d('0x13')](this));ami['on'](_0xfc2d('0x18'),this[_0xfc2d('0x19')]['bind'](this));ami['on'](_0xfc2d('0x1a'),this[_0xfc2d('0x1b')][_0xfc2d('0x13')](this));ami['on'](_0xfc2d('0x1c'),this[_0xfc2d('0x1d')][_0xfc2d('0x13')](this));ami['on']('originateresponse',this[_0xfc2d('0x1e')]['bind'](this));}Fax[_0xfc2d('0x1f')]['syncNewchannel']=function(_0x298e4e){if(_0x298e4e[_0xfc2d('0x20')]==='from-voip-provider'){for(var _0x40c0c9 in this[_0xfc2d('0xe')]){if(this[_0xfc2d('0xe')]['hasOwnProperty'](_0x40c0c9)){if(_0x298e4e[_0xfc2d('0x21')]===this['faxAccounts'][_0x40c0c9][_0xfc2d('0x22')]){this[_0xfc2d('0xd')][_0x298e4e['uniqueid']]={};this[_0xfc2d('0xd')][_0x298e4e['uniqueid']][_0xfc2d('0x23')]=_0x298e4e[_0xfc2d('0x23')];this[_0xfc2d('0xd')][_0x298e4e[_0xfc2d('0x24')]]['id']=this[_0xfc2d('0xe')][_0x40c0c9]['id'];this[_0xfc2d('0xd')][_0x298e4e[_0xfc2d('0x24')]]['name']=this[_0xfc2d('0xe')][_0x40c0c9][_0xfc2d('0x25')];logger['info'](_0x298e4e[_0xfc2d('0x24')],_0xfc2d('0x26'));}}}}if(this[_0xfc2d('0x10')][_0x298e4e[_0xfc2d('0x24')]]){this[_0xfc2d('0xd')][_0x298e4e[_0xfc2d('0x24')]]={};this[_0xfc2d('0xd')][_0x298e4e[_0xfc2d('0x24')]][_0xfc2d('0x23')]=_0x298e4e[_0xfc2d('0x23')];logger['info'](_0x298e4e['uniqueid'],_0xfc2d('0x26'));}};Fax[_0xfc2d('0x1f')][_0xfc2d('0x27')]=function(_0x36ffb7){if(this[_0xfc2d('0xd')][_0x36ffb7[_0xfc2d('0x24')]]){for(var _0x155aad in _0x36ffb7['variable']){if(_0x36ffb7['variable']['hasOwnProperty'](_0x155aad)){this[_0xfc2d('0xd')][_0x36ffb7[_0xfc2d('0x24')]][_0x155aad]=_0x36ffb7[_0xfc2d('0x28')];}}}};Fax[_0xfc2d('0x1f')][_0xfc2d('0x16')]=function(_0x17dda4){if(this[_0xfc2d('0xd')][_0x17dda4[_0xfc2d('0x24')]]){this[_0xfc2d('0xd')][_0x17dda4[_0xfc2d('0x24')]]['channelstate']=_0x17dda4[_0xfc2d('0x29')];this[_0xfc2d('0xd')][_0x17dda4[_0xfc2d('0x24')]][_0xfc2d('0x2a')]=_0x17dda4[_0xfc2d('0x2a')];}};Fax[_0xfc2d('0x1f')]['syncNewExten']=function(_0x4f91db){if(this[_0xfc2d('0xd')][_0x4f91db[_0xfc2d('0x24')]]){for(var _0x2626e0 in _0x4f91db[_0xfc2d('0x2b')]){if(_0x4f91db[_0xfc2d('0x2b')][_0xfc2d('0x2c')](_0x2626e0)){this[_0xfc2d('0xd')][_0x4f91db[_0xfc2d('0x24')]][_0x2626e0]=_0x4f91db['value'];}}}};Fax[_0xfc2d('0x1f')][_0xfc2d('0x19')]=function(_0x41f187){if(this[_0xfc2d('0xd')][_0x41f187[_0xfc2d('0x24')]]){this[_0xfc2d('0xd')][_0x41f187['uniqueid']]['operation']=_0x41f187[_0xfc2d('0x2d')];this[_0xfc2d('0xd')][_0x41f187[_0xfc2d('0x24')]]['status']=_0x41f187[_0xfc2d('0x2e')];this[_0xfc2d('0xd')][_0x41f187[_0xfc2d('0x24')]][_0xfc2d('0x22')]=_0x41f187[_0xfc2d('0x22')];this['channels'][_0x41f187['uniqueid']][_0xfc2d('0x2f')]=_0x41f187['filename'];logger[_0xfc2d('0x30')](_0x41f187['uniqueid'],_0xfc2d('0x31'));}};Fax[_0xfc2d('0x1f')][_0xfc2d('0x1b')]=function(_0x4a2f76){var _0x587053=this;if(this['channels'][_0x4a2f76['uniqueid']]){var _0x3a2fc5=this[_0xfc2d('0xd')][_0x4a2f76['uniqueid']]['id'];this[_0xfc2d('0xd')][_0x4a2f76[_0xfc2d('0x24')]][_0xfc2d('0x32')]=_0x4a2f76['remotestationid'];this['channels'][_0x4a2f76[_0xfc2d('0x24')]][_0xfc2d('0x33')]=_0x4a2f76[_0xfc2d('0x33')];this[_0xfc2d('0xd')][_0x4a2f76[_0xfc2d('0x24')]]['localstationid']=_0x4a2f76[_0xfc2d('0x22')];this['channels'][_0x4a2f76['uniqueid']]['resolution']=_0x4a2f76[_0xfc2d('0x34')];this[_0xfc2d('0xd')][_0x4a2f76[_0xfc2d('0x24')]][_0xfc2d('0x35')]=_0x4a2f76['transferrate'];this['channels'][_0x4a2f76['uniqueid']]['filename']=_0x4a2f76[_0xfc2d('0x2f')];this[_0xfc2d('0xd')][_0x4a2f76[_0xfc2d('0x24')]][_0xfc2d('0x36')]=_0x4a2f76[_0xfc2d('0x36')];if(this[_0xfc2d('0xd')][_0x4a2f76[_0xfc2d('0x24')]][_0xfc2d('0x33')]>0x0){tiff2pdf(_0x4a2f76[_0xfc2d('0x2f')],_0xfc2d('0x37'),function(_0x3076c2){logger[_0xfc2d('0x30')](_0x4a2f76[_0xfc2d('0x24')],_0xfc2d('0x38'),_0x3076c2['message']);attachment[_0xfc2d('0x39')]({'name':path[_0xfc2d('0x3a')](_0x4a2f76[_0xfc2d('0x2f')])[_0xfc2d('0x25')],'basename':path[_0xfc2d('0x3a')](_0x4a2f76[_0xfc2d('0x2f')])[_0xfc2d('0x25')]+_0xfc2d('0x3b'),'type':_0xfc2d('0x3c')})[_0xfc2d('0x3d')](function(_0x4a79f2){faxAccount[_0xfc2d('0x3e')](_0x3a2fc5,{'from':_0x4a2f76[_0xfc2d('0x36')],'mapKey':_0xfc2d('0x7'),'body':path['parse'](_0x4a2f76['filename'])[_0xfc2d('0x25')]+'.pdf','AttachmentId':_0x4a79f2['id']})[_0xfc2d('0x3f')](function(_0x328897){logger[_0xfc2d('0x40')](_0x4a2f76['uniqueid'],_0xfc2d('0x41'),JSON['stringify'](_0x328897));});})[_0xfc2d('0x3f')](function(_0x5ede01){logger[_0xfc2d('0x40')](_0x4a2f76[_0xfc2d('0x24')],_0xfc2d('0x42'),JSON[_0xfc2d('0x43')](_0x5ede01));});});}logger[_0xfc2d('0x30')](_0x4a2f76[_0xfc2d('0x24')],_0xfc2d('0x42'));}};Fax[_0xfc2d('0x1f')][_0xfc2d('0x1e')]=function(_0x456715){if(this[_0xfc2d('0x10')][_0x456715['uniqueid']]){_[_0xfc2d('0x44')](this['channels'][_0x456715[_0xfc2d('0x24')]],_['pick'](_0x456715,[_0xfc2d('0x45'),'reason']));}};function updateStatus(_0x41c617){if(_0x41c617[_0xfc2d('0x46')]){faxMessage['update'](_0x41c617[_0xfc2d('0x46')],{'failMessage':_0xfc2d('0x47')})[_0xfc2d('0x3d')](function(_0x319a14){ut['logger']('[Fax][Message][Error][Updated]',_0x319a14);})[_0xfc2d('0x3f')](function(_0xee2056){ut[_0xfc2d('0x48')](_0xfc2d('0x49'),_0xee2056);});}else{ut[_0xfc2d('0x48')](_0xfc2d('0x4a'));}}Fax[_0xfc2d('0x1f')][_0xfc2d('0x4b')]=function(_0x5c6ec5,_0x57913d,_0x597e8f){var _0x36f82d=this;var _0x1f2906={};if(_0x57913d){_0x1f2906={'read':_0x57913d};}else{_0x1f2906={'failMessage':_0x597e8f};}if(this[_0xfc2d('0x10')][_0x5c6ec5][_0xfc2d('0x46')]){faxMessage[_0xfc2d('0x4c')](this[_0xfc2d('0x10')][_0x5c6ec5][_0xfc2d('0x46')],_0x1f2906)['then'](function(_0x1b22a5){ut[_0xfc2d('0x48')]('[Fax][Message][Updated]',_0x1b22a5);})['catch'](function(_0xdb33e8){ut[_0xfc2d('0x48')](_0xfc2d('0x4d'),_0xdb33e8);})[_0xfc2d('0x4e')](function(){delete _0x36f82d[_0xfc2d('0xd')][_0x5c6ec5];delete _0x36f82d[_0xfc2d('0x10')][_0x5c6ec5];});}else{ut[_0xfc2d('0x48')](_0xfc2d('0x4f'));delete this[_0xfc2d('0xd')][_0x5c6ec5];delete this[_0xfc2d('0x10')][_0x5c6ec5];}};Fax['prototype'][_0xfc2d('0x1d')]=function(_0x279297){var _0x5c48f0=this;if(this[_0xfc2d('0xd')][_0x279297['uniqueid']]){if(this[_0xfc2d('0x10')][_0x279297[_0xfc2d('0x24')]]){this[_0xfc2d('0xd')][_0x279297[_0xfc2d('0x24')]]['id']=this[_0xfc2d('0x10')][_0x279297[_0xfc2d('0x24')]]['id'];this[_0xfc2d('0xd')][_0x279297['uniqueid']][_0xfc2d('0x25')]=this['actions'][_0x279297[_0xfc2d('0x24')]][_0xfc2d('0x25')];}logger[_0xfc2d('0x30')](_0x279297['uniqueid'],this[_0xfc2d('0x10')][_0x279297['uniqueid']]?_0xfc2d('0x50'):_0xfc2d('0x51'),JSON[_0xfc2d('0x43')](this[_0xfc2d('0xd')][_0x279297['uniqueid']]));if(this[_0xfc2d('0x10')][_0x279297[_0xfc2d('0x24')]]){if(this[_0xfc2d('0xd')][_0x279297[_0xfc2d('0x24')]]['faxpages']>0x0&&this[_0xfc2d('0xd')][_0x279297[_0xfc2d('0x24')]][_0xfc2d('0x18')]===_0xfc2d('0x52')){this[_0xfc2d('0x4b')](_0x279297[_0xfc2d('0x24')],!![]);}else{this['updateStatus'](_0x279297['uniqueid'],![],this[_0xfc2d('0xd')][_0x279297[_0xfc2d('0x24')]]['faxstatusstring']?_0xfc2d('0x53')+this[_0xfc2d('0xd')][_0x279297['uniqueid']]['faxstatusstring']:_0xfc2d('0x54'));}}}};Fax[_0xfc2d('0x1f')][_0xfc2d('0x55')]=function(_0x1da4d9){var _0x3134bc=this;return new BPromise(function(_0x8f480f,_0x12b7c3){_0x3134bc['execOriginate'](_0x1da4d9,_0x3134bc[_0xfc2d('0xe')][_0x1da4d9[_0xfc2d('0x56')]])[_0xfc2d('0x3d')](function(_0x7d5d75){ut[_0xfc2d('0x48')]('[Fax][execOriginate][success]',_0x7d5d75);_0x8f480f(ut[_0xfc2d('0x57')](_0xfc2d('0x58')));})[_0xfc2d('0x3f')](function(_0x23492b){ut[_0xfc2d('0x48')](_0xfc2d('0x59'),_0x23492b);updateStatus(_0x1da4d9);_0x12b7c3(ut[_0xfc2d('0x57')](_0xfc2d('0x5a')));});});};Fax[_0xfc2d('0x1f')][_0xfc2d('0x5b')]=function(_0x3f2acd){var _0x467f71=this;return new BPromise(function(_0x2253d5,_0x209257){var _0x39fc08=_0x467f71[_0xfc2d('0x5c')](_0x467f71['faxAccounts'][_0x3f2acd[_0xfc2d('0x56')]][_0xfc2d('0x5d')],_0x3f2acd);if(_0x39fc08[_0xfc2d('0x5e')]){_0x2253d5(ut[_0xfc2d('0x57')](_0xfc2d('0x5f')));}else{_0x209257(ut['message'](_0x39fc08[_0xfc2d('0x57')]));}});};function originate(_0xef222c,_0x5a04ef,_0x2b5cc9){return new BPromise(function(_0x144977,_0x588298){if(_0x2b5cc9){var _0x50921d=util['format'](_0xfc2d('0x60'),path[_0xfc2d('0x3a')](_0xef222c['path'])['name'],_0xef222c[_0xfc2d('0x4')]);gs[_0xfc2d('0x61')](_0x50921d)[_0xfc2d('0x3d')](function(){_0xef222c[_0xfc2d('0x4')]=util[_0xfc2d('0x62')](_0xfc2d('0x63'),path['parse'](_0xef222c[_0xfc2d('0x4')])['dir'],path['parse'](_0xef222c[_0xfc2d('0x4')])[_0xfc2d('0x25')]);_0x5a04ef[_0xfc2d('0x64')]=_0xef222c[_0xfc2d('0x4')];ut[_0xfc2d('0x48')](_0xfc2d('0x65'),'');ami[_0xfc2d('0x66')](ut[_0xfc2d('0x67')](_0xef222c,_0x5a04ef))[_0xfc2d('0x3d')](function(_0x22dbed){_0x144977(_0x22dbed);})[_0xfc2d('0x3f')](function(_0xe4b62e){_0x588298(_0xe4b62e);});})['catch'](function(_0x17a13f){_0x588298(_0x17a13f);});}else{ami[_0xfc2d('0x66')](ut[_0xfc2d('0x67')](_0xef222c,_0x5a04ef))[_0xfc2d('0x3d')](function(_0x37edb1){_0x144977(_0x37edb1);})[_0xfc2d('0x3f')](function(_0x422ed6){_0x588298(_0x422ed6);});}});}Fax[_0xfc2d('0x1f')][_0xfc2d('0x68')]=function(_0x8561e7,_0x1190fa){var _0x2ec264=this;return new BPromise(function(_0x55b48b,_0x268835){var _0xecf541=uuid['v4']();var _0x551f28=ut[_0xfc2d('0x69')](_0x8561e7,_0x1190fa);_0x2ec264[_0xfc2d('0x10')][_0xecf541]=new Action(_0xecf541,_0x1190fa,_0x8561e7);var _0x554cf9=_0x2ec264[_0xfc2d('0x10')][_0xecf541];if(path[_0xfc2d('0x3a')](_0x8561e7[_0xfc2d('0x4')])['ext']==='.pdf'){originate(_0x554cf9,_0x551f28,!![])[_0xfc2d('0x3d')](function(_0x154652){_0x55b48b(_0x154652);})[_0xfc2d('0x3f')](function(_0x2cee21){_0x268835(_0x2cee21);});}else{originate(_0x554cf9,_0x551f28,![])[_0xfc2d('0x3d')](function(_0x52881b){_0x55b48b(_0x52881b);})[_0xfc2d('0x3f')](function(_0x4993a7){_0x268835(_0x4993a7);});}});};Fax[_0xfc2d('0x1f')][_0xfc2d('0x6a')]=function(_0x1eae1f){return!_[_0xfc2d('0x6b')](_0x1eae1f)&&!_[_0xfc2d('0x6b')](_0x1eae1f[_0xfc2d('0x25')])&&!_['isNil'](_0x1eae1f[_0xfc2d('0x6c')])&&_0x1eae1f['active']&&!_[_0xfc2d('0x6b')](this[_0xfc2d('0xf')][util['format'](_0xfc2d('0x6d'),_0x1eae1f[_0xfc2d('0x25')])])&&!_[_0xfc2d('0x6b')](this[_0xfc2d('0xf')][util[_0xfc2d('0x62')](_0xfc2d('0x6d'),_0x1eae1f['name'])][_0xfc2d('0x2e')])&&(this[_0xfc2d('0xf')][util[_0xfc2d('0x62')]('SIP/%s',_0x1eae1f[_0xfc2d('0x25')])][_0xfc2d('0x2e')]===_0xfc2d('0x6e')||this[_0xfc2d('0xf')][util[_0xfc2d('0x62')](_0xfc2d('0x6d'),_0x1eae1f[_0xfc2d('0x25')])][_0xfc2d('0x2e')]===_0xfc2d('0x6f'));};Fax[_0xfc2d('0x1f')]['checkTrunk']=function(_0x1991e2,_0x5c418f){if(!this[_0xfc2d('0x6a')](_0x1991e2)){ut[_0xfc2d('0x48')](_0xfc2d('0x70'),_[_0xfc2d('0x6b')](_0x1991e2)?'':_0x1991e2[_0xfc2d('0x25')]+_0xfc2d('0x71'));return{'isValid':![],'message':_0xfc2d('0x72')};}if(_[_0xfc2d('0x6b')](_0x5c418f[_0xfc2d('0x7')])){ut['logger'](_0xfc2d('0x73'),JSON[_0xfc2d('0x43')](_0x5c418f));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x5c418f['path'])){ut[_0xfc2d('0x48')](_0xfc2d('0x74'),JSON[_0xfc2d('0x43')](_0x5c418f));return{'isValid':![],'message':_0xfc2d('0x75')};}return{'isValid':!![],'message':_0xfc2d('0x76')};};module[_0xfc2d('0x77')]=Fax; \ No newline at end of file +var _0x09ab=['[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','FaxAccountId','Trunk','isValid','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','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newexten','syncNewExten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','application/pdf','then','notify','fax','.pdf','\x20notify\x20','stringify','error','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','catch','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','faxpages','faxstatus','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','[Fax][execOriginate][success]'];(function(_0x245208,_0x5ed2c6){var _0x5187dc=function(_0x3aa563){while(--_0x3aa563){_0x245208['push'](_0x245208['shift']());}};_0x5187dc(++_0x5ed2c6);}(_0x09ab,0x182));var _0xb09a=function(_0x5e1ca7,_0xfbbac8){_0x5e1ca7=_0x5e1ca7-0x0;var _0x3a50cb=_0x09ab[_0x5e1ca7];return _0x3a50cb;};'use strict';var util=require(_0xb09a('0x0'));var _=require('lodash');var BPromise=require(_0xb09a('0x1'));var uuid=require(_0xb09a('0x2'));var moment=require(_0xb09a('0x3'));var path=require(_0xb09a('0x4'));var tiff2pdf=require(_0xb09a('0x5'));var gs=require(_0xb09a('0x6'));var logger=require(_0xb09a('0x7'))('fax');var ami=require(_0xb09a('0x8'));var rpcDb=require(_0xb09a('0x9'));var Channel=require(_0xb09a('0xa'));var ut=require(_0xb09a('0xb'));var Action=require(_0xb09a('0xc'));var faxAccount=require(_0xb09a('0xd'));var attachment=require(_0xb09a('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0xd100eb){this[_0xb09a('0xf')]={};this[_0xb09a('0x10')]=_0xd100eb[_0xb09a('0x10')];this[_0xb09a('0x11')]=_0xd100eb[_0xb09a('0x11')];this[_0xb09a('0x12')]={};ami['on'](_0xb09a('0x13'),this[_0xb09a('0x14')][_0xb09a('0x15')](this));ami['on'](_0xb09a('0x16'),this[_0xb09a('0x17')][_0xb09a('0x15')](this));ami['on']('newstate',this['syncNewState'][_0xb09a('0x15')](this));ami['on'](_0xb09a('0x18'),this[_0xb09a('0x19')][_0xb09a('0x15')](this));ami['on']('faxstatus',this[_0xb09a('0x1a')][_0xb09a('0x15')](this));ami['on']('receivefax',this[_0xb09a('0x1b')][_0xb09a('0x15')](this));ami['on'](_0xb09a('0x1c'),this[_0xb09a('0x1d')][_0xb09a('0x15')](this));ami['on']('originateresponse',this[_0xb09a('0x1e')][_0xb09a('0x15')](this));}Fax[_0xb09a('0x1f')][_0xb09a('0x14')]=function(_0x3bbaa4){if(_0x3bbaa4[_0xb09a('0x20')]===_0xb09a('0x21')){for(var _0x441341 in this[_0xb09a('0x10')]){if(this['faxAccounts'][_0xb09a('0x22')](_0x441341)){if(_0x3bbaa4[_0xb09a('0x23')]===this[_0xb09a('0x10')][_0x441341][_0xb09a('0x24')]){this[_0xb09a('0xf')][_0x3bbaa4['uniqueid']]={};this[_0xb09a('0xf')][_0x3bbaa4[_0xb09a('0x25')]][_0xb09a('0x26')]=_0x3bbaa4[_0xb09a('0x26')];this['channels'][_0x3bbaa4[_0xb09a('0x25')]]['id']=this[_0xb09a('0x10')][_0x441341]['id'];this[_0xb09a('0xf')][_0x3bbaa4[_0xb09a('0x25')]][_0xb09a('0x27')]=this[_0xb09a('0x10')][_0x441341]['name'];logger[_0xb09a('0x28')](_0x3bbaa4['uniqueid'],_0xb09a('0x29'));}}}}if(this[_0xb09a('0x12')][_0x3bbaa4[_0xb09a('0x25')]]){this[_0xb09a('0xf')][_0x3bbaa4[_0xb09a('0x25')]]={};this['channels'][_0x3bbaa4['uniqueid']][_0xb09a('0x26')]=_0x3bbaa4[_0xb09a('0x26')];logger[_0xb09a('0x28')](_0x3bbaa4['uniqueid'],_0xb09a('0x29'));}};Fax[_0xb09a('0x1f')]['syncVarSet']=function(_0x5121f4){if(this['channels'][_0x5121f4[_0xb09a('0x25')]]){for(var _0x40cd68 in _0x5121f4[_0xb09a('0x2a')]){if(_0x5121f4[_0xb09a('0x2a')][_0xb09a('0x22')](_0x40cd68)){this['channels'][_0x5121f4['uniqueid']][_0x40cd68]=_0x5121f4[_0xb09a('0x2b')];}}}};Fax['prototype'][_0xb09a('0x2c')]=function(_0xe3aa12){if(this[_0xb09a('0xf')][_0xe3aa12['uniqueid']]){this[_0xb09a('0xf')][_0xe3aa12[_0xb09a('0x25')]][_0xb09a('0x2d')]=_0xe3aa12[_0xb09a('0x2d')];this[_0xb09a('0xf')][_0xe3aa12[_0xb09a('0x25')]]['channelstatedesc']=_0xe3aa12['channelstatedesc'];}};Fax[_0xb09a('0x1f')][_0xb09a('0x19')]=function(_0x32880e){if(this['channels'][_0x32880e[_0xb09a('0x25')]]){for(var _0x531143 in _0x32880e['variable']){if(_0x32880e[_0xb09a('0x2a')][_0xb09a('0x22')](_0x531143)){this[_0xb09a('0xf')][_0x32880e[_0xb09a('0x25')]][_0x531143]=_0x32880e[_0xb09a('0x2b')];}}}};Fax[_0xb09a('0x1f')][_0xb09a('0x1a')]=function(_0x109f0e){if(this['channels'][_0x109f0e[_0xb09a('0x25')]]){this[_0xb09a('0xf')][_0x109f0e[_0xb09a('0x25')]]['operation']=_0x109f0e['operation'];this[_0xb09a('0xf')][_0x109f0e['uniqueid']][_0xb09a('0x2e')]=_0x109f0e[_0xb09a('0x2e')];this[_0xb09a('0xf')][_0x109f0e['uniqueid']][_0xb09a('0x24')]=_0x109f0e['localstationid'];this[_0xb09a('0xf')][_0x109f0e['uniqueid']][_0xb09a('0x2f')]=_0x109f0e[_0xb09a('0x2f')];logger['info'](_0x109f0e['uniqueid'],_0xb09a('0x30'));}};Fax['prototype'][_0xb09a('0x1b')]=function(_0xc8b8f9){var _0x57aaa6=this;if(this[_0xb09a('0xf')][_0xc8b8f9[_0xb09a('0x25')]]){var _0x2ba528=this[_0xb09a('0xf')][_0xc8b8f9[_0xb09a('0x25')]]['id'];this[_0xb09a('0xf')][_0xc8b8f9[_0xb09a('0x25')]][_0xb09a('0x31')]=_0xc8b8f9[_0xb09a('0x31')];this[_0xb09a('0xf')][_0xc8b8f9[_0xb09a('0x25')]][_0xb09a('0x32')]=_0xc8b8f9[_0xb09a('0x32')];this['channels'][_0xc8b8f9[_0xb09a('0x25')]][_0xb09a('0x24')]=_0xc8b8f9[_0xb09a('0x24')];this[_0xb09a('0xf')][_0xc8b8f9['uniqueid']][_0xb09a('0x33')]=_0xc8b8f9[_0xb09a('0x33')];this[_0xb09a('0xf')][_0xc8b8f9['uniqueid']][_0xb09a('0x34')]=_0xc8b8f9[_0xb09a('0x34')];this[_0xb09a('0xf')][_0xc8b8f9[_0xb09a('0x25')]]['filename']=_0xc8b8f9[_0xb09a('0x2f')];this[_0xb09a('0xf')][_0xc8b8f9['uniqueid']][_0xb09a('0x35')]=_0xc8b8f9['calleridnum'];if(this[_0xb09a('0xf')][_0xc8b8f9[_0xb09a('0x25')]][_0xb09a('0x32')]>0x0){tiff2pdf(_0xc8b8f9[_0xb09a('0x2f')],_0xb09a('0x36'),function(_0x4fdb72){logger['info'](_0xc8b8f9['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x4fdb72[_0xb09a('0x37')]);attachment[_0xb09a('0x38')]({'name':path[_0xb09a('0x39')](_0xc8b8f9['filename'])[_0xb09a('0x27')],'basename':path[_0xb09a('0x39')](_0xc8b8f9[_0xb09a('0x2f')])[_0xb09a('0x27')]+'.pdf','type':_0xb09a('0x3a')})[_0xb09a('0x3b')](function(_0x4380b7){faxAccount[_0xb09a('0x3c')](_0x2ba528,{'from':_0xc8b8f9[_0xb09a('0x35')],'mapKey':_0xb09a('0x3d'),'body':path[_0xb09a('0x39')](_0xc8b8f9[_0xb09a('0x2f')])[_0xb09a('0x27')]+_0xb09a('0x3e'),'AttachmentId':_0x4380b7['id']})['catch'](function(_0x1ad826){logger['error'](_0xc8b8f9[_0xb09a('0x25')],_0xb09a('0x3f'),JSON[_0xb09a('0x40')](_0x1ad826));});})['catch'](function(_0x308e37){logger[_0xb09a('0x41')](_0xc8b8f9[_0xb09a('0x25')],'\x20receiveFax\x20',JSON[_0xb09a('0x40')](_0x308e37));});});}logger[_0xb09a('0x28')](_0xc8b8f9[_0xb09a('0x25')],'\x20receiveFax\x20');}};Fax['prototype'][_0xb09a('0x1e')]=function(_0x2c59fa){if(this[_0xb09a('0x12')][_0x2c59fa[_0xb09a('0x25')]]){_[_0xb09a('0x42')](this[_0xb09a('0xf')][_0x2c59fa['uniqueid']],_[_0xb09a('0x43')](_0x2c59fa,[_0xb09a('0x44'),_0xb09a('0x45')]));}};function updateStatus(_0x2c039b){if(_0x2c039b[_0xb09a('0x46')]){faxMessage[_0xb09a('0x47')](_0x2c039b[_0xb09a('0x46')],{'failMessage':_0xb09a('0x48')})[_0xb09a('0x3b')](function(_0x315851){ut[_0xb09a('0x49')](_0xb09a('0x4a'),_0x315851);})['catch'](function(_0x104879){ut[_0xb09a('0x49')](_0xb09a('0x4b'),_0x104879);});}else{ut[_0xb09a('0x49')](_0xb09a('0x4c'));}}Fax[_0xb09a('0x1f')][_0xb09a('0x4d')]=function(_0x540fc3,_0x3f14c0,_0x1b55ea){var _0x2c38fb=this;var _0x1aa88e={};if(_0x3f14c0){_0x1aa88e={'read':_0x3f14c0};}else{_0x1aa88e={'failMessage':_0x1b55ea};}if(this[_0xb09a('0x12')][_0x540fc3][_0xb09a('0x46')]){faxMessage[_0xb09a('0x47')](this[_0xb09a('0x12')][_0x540fc3]['AttachmentId'],_0x1aa88e)['then'](function(_0x59747f){ut[_0xb09a('0x49')](_0xb09a('0x4e'),_0x59747f);})[_0xb09a('0x4f')](function(_0x2b3ebe){ut['logger'](_0xb09a('0x50'),_0x2b3ebe);})[_0xb09a('0x51')](function(){delete _0x2c38fb[_0xb09a('0xf')][_0x540fc3];delete _0x2c38fb[_0xb09a('0x12')][_0x540fc3];});}else{ut[_0xb09a('0x49')]('[Fax][Message][NoUpdate2]');delete this[_0xb09a('0xf')][_0x540fc3];delete this[_0xb09a('0x12')][_0x540fc3];}};Fax['prototype'][_0xb09a('0x1d')]=function(_0x34a8c8){var _0x32a52f=this;if(this[_0xb09a('0xf')][_0x34a8c8[_0xb09a('0x25')]]){if(this['actions'][_0x34a8c8[_0xb09a('0x25')]]){this[_0xb09a('0xf')][_0x34a8c8[_0xb09a('0x25')]]['id']=this['actions'][_0x34a8c8[_0xb09a('0x25')]]['id'];this[_0xb09a('0xf')][_0x34a8c8[_0xb09a('0x25')]]['name']=this[_0xb09a('0x12')][_0x34a8c8[_0xb09a('0x25')]][_0xb09a('0x27')];}logger[_0xb09a('0x28')](_0x34a8c8[_0xb09a('0x25')],this[_0xb09a('0x12')][_0x34a8c8['uniqueid']]?_0xb09a('0x52'):'\x20hangup\x20faxRiceive\x20',JSON[_0xb09a('0x40')](this[_0xb09a('0xf')][_0x34a8c8[_0xb09a('0x25')]]));if(this[_0xb09a('0x12')][_0x34a8c8[_0xb09a('0x25')]]){if(this['channels'][_0x34a8c8['uniqueid']][_0xb09a('0x53')]>0x0&&this[_0xb09a('0xf')][_0x34a8c8[_0xb09a('0x25')]][_0xb09a('0x54')]==='SUCCESS'){this[_0xb09a('0x4d')](_0x34a8c8[_0xb09a('0x25')],!![]);}else{this['updateStatus'](_0x34a8c8['uniqueid'],![],this[_0xb09a('0xf')][_0x34a8c8[_0xb09a('0x25')]]['faxstatusstring']?_0xb09a('0x55')+this[_0xb09a('0xf')][_0x34a8c8[_0xb09a('0x25')]][_0xb09a('0x56')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0xb09a('0x57')]=function(_0x3440b1){var _0x9c59e8=this;return new BPromise(function(_0x242d57,_0x23e923){_0x9c59e8[_0xb09a('0x58')](_0x3440b1,_0x9c59e8[_0xb09a('0x10')][_0x3440b1['FaxAccountId']])[_0xb09a('0x3b')](function(_0x5208cc){ut['logger'](_0xb09a('0x59'),_0x5208cc);_0x242d57(ut[_0xb09a('0x37')]('Fax\x20received'));})[_0xb09a('0x4f')](function(_0x1306cc){ut[_0xb09a('0x49')](_0xb09a('0x5a'),_0x1306cc);updateStatus(_0x3440b1);_0x23e923(ut[_0xb09a('0x37')](_0xb09a('0x5b')));});});};Fax[_0xb09a('0x1f')][_0xb09a('0x5c')]=function(_0x19f7e6){var _0xc1be38=this;return new BPromise(function(_0x3f4a37,_0x1a6178){var _0x27b575=_0xc1be38['checkTrunk'](_0xc1be38[_0xb09a('0x10')][_0x19f7e6[_0xb09a('0x5d')]][_0xb09a('0x5e')],_0x19f7e6);if(_0x27b575[_0xb09a('0x5f')]){_0x3f4a37(ut[_0xb09a('0x37')]('Trunk\x20Reachable'));}else{_0x1a6178(ut[_0xb09a('0x37')](_0x27b575['message']));}});};function originate(_0x231fb7,_0x24e03d,_0x3b6881){return new BPromise(function(_0x5d9bbe,_0x5ef564){if(_0x3b6881){var _0x57e156=util[_0xb09a('0x60')](_0xb09a('0x61'),path[_0xb09a('0x39')](_0x231fb7[_0xb09a('0x4')])['name'],_0x231fb7[_0xb09a('0x4')]);gs[_0xb09a('0x62')](_0x57e156)[_0xb09a('0x3b')](function(){_0x231fb7[_0xb09a('0x4')]=util['format'](_0xb09a('0x63'),path[_0xb09a('0x39')](_0x231fb7[_0xb09a('0x4')])[_0xb09a('0x64')],path[_0xb09a('0x39')](_0x231fb7[_0xb09a('0x4')])[_0xb09a('0x27')]);_0x24e03d[_0xb09a('0x65')]=_0x231fb7[_0xb09a('0x4')];ut[_0xb09a('0x49')](_0xb09a('0x66'),'');ami['Action'](ut[_0xb09a('0x67')](_0x231fb7,_0x24e03d))[_0xb09a('0x3b')](function(_0x3c6842){_0x5d9bbe(_0x3c6842);})[_0xb09a('0x4f')](function(_0x54f380){_0x5ef564(_0x54f380);});})[_0xb09a('0x4f')](function(_0x2bc56d){_0x5ef564(_0x2bc56d);});}else{ami[_0xb09a('0x68')](ut[_0xb09a('0x67')](_0x231fb7,_0x24e03d))[_0xb09a('0x3b')](function(_0x301242){_0x5d9bbe(_0x301242);})[_0xb09a('0x4f')](function(_0x1d9590){_0x5ef564(_0x1d9590);});}});}Fax[_0xb09a('0x1f')]['execOriginate']=function(_0x15b0d6,_0x4b1741){var _0x2bae4b=this;return new BPromise(function(_0x45f454,_0xe4b48c){var _0x2cdbea=uuid['v4']();var _0x57e67e=ut['addVariables'](_0x15b0d6,_0x4b1741);_0x2bae4b[_0xb09a('0x12')][_0x2cdbea]=new Action(_0x2cdbea,_0x4b1741,_0x15b0d6);var _0x1b0072=_0x2bae4b[_0xb09a('0x12')][_0x2cdbea];if(path[_0xb09a('0x39')](_0x15b0d6['path'])[_0xb09a('0x69')]===_0xb09a('0x3e')){originate(_0x1b0072,_0x57e67e,!![])[_0xb09a('0x3b')](function(_0x2d9dc6){_0x45f454(_0x2d9dc6);})['catch'](function(_0x52df3e){_0xe4b48c(_0x52df3e);});}else{originate(_0x1b0072,_0x57e67e,![])[_0xb09a('0x3b')](function(_0x9944be){_0x45f454(_0x9944be);})[_0xb09a('0x4f')](function(_0x265970){_0xe4b48c(_0x265970);});}});};Fax[_0xb09a('0x1f')][_0xb09a('0x6a')]=function(_0x5f4ae4){return!_[_0xb09a('0x6b')](_0x5f4ae4)&&!_[_0xb09a('0x6b')](_0x5f4ae4[_0xb09a('0x27')])&&!_[_0xb09a('0x6b')](_0x5f4ae4[_0xb09a('0x6c')])&&_0x5f4ae4[_0xb09a('0x6c')]&&!_[_0xb09a('0x6b')](this[_0xb09a('0x11')][util[_0xb09a('0x60')]('SIP/%s',_0x5f4ae4[_0xb09a('0x27')])])&&!_[_0xb09a('0x6b')](this['trunks'][util[_0xb09a('0x60')]('SIP/%s',_0x5f4ae4['name'])][_0xb09a('0x2e')])&&(this[_0xb09a('0x11')][util[_0xb09a('0x60')](_0xb09a('0x6d'),_0x5f4ae4[_0xb09a('0x27')])]['status']===_0xb09a('0x6e')||this['trunks'][util['format'](_0xb09a('0x6d'),_0x5f4ae4[_0xb09a('0x27')])][_0xb09a('0x2e')]==='unmonitored');};Fax[_0xb09a('0x1f')][_0xb09a('0x6f')]=function(_0x3c6a8a,_0x43635f){if(!this['isTrunkReachable'](_0x3c6a8a)){ut[_0xb09a('0x49')](_0xb09a('0x70'),_[_0xb09a('0x6b')](_0x3c6a8a)?'':_0x3c6a8a[_0xb09a('0x27')]+_0xb09a('0x71'));return{'isValid':![],'message':_0xb09a('0x72')};}if(_[_0xb09a('0x6b')](_0x43635f[_0xb09a('0x3d')])){ut[_0xb09a('0x49')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xb09a('0x40')](_0x43635f));return{'isValid':![],'message':_0xb09a('0x73')};}if(_[_0xb09a('0x6b')](_0x43635f[_0xb09a('0x4')])){ut[_0xb09a('0x49')](_0xb09a('0x74'),JSON[_0xb09a('0x40')](_0x43635f));return{'isValid':![],'message':_0xb09a('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xb09a('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index eb244ab..a3c25e6 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 _0x1836=['inspect','notify','then','[Notify]\x20','util','bluebird','preview','lodash','../rpc/faxAccount'];(function(_0x72b44d,_0x1ca2d6){var _0x15854b=function(_0x36be61){while(--_0x36be61){_0x72b44d['push'](_0x72b44d['shift']());}};_0x15854b(++_0x1ca2d6);}(_0x1836,0xa6));var _0x6183=function(_0x5da0cc,_0x3e4aa1){_0x5da0cc=_0x5da0cc-0x0;var _0x479c01=_0x1836[_0x5da0cc];return _0x479c01;};'use strict';var util=require(_0x6183('0x0'));var BPromise=require(_0x6183('0x1'));var logger=require('../../../config/logger')(_0x6183('0x2'));var _=require(_0x6183('0x3'));var faxAccount=require(_0x6183('0x4'));function loggerCatch(_0x3dd5a6){return function(_0x8a6eef){logger['error'](_0x3dd5a6,util[_0x6183('0x5')](_0x8a6eef,{'showHidden':![],'depth':null}));};}exports[_0x6183('0x6')]=function(_0x405051,_0x5b5b1e){return BPromise['resolve']()[_0x6183('0x7')](faxAccount['notify'](_0x405051,_0x5b5b1e))['catch'](loggerCatch(_0x6183('0x8')));}; \ No newline at end of file +var _0x60a5=['then','[Notify]\x20','bluebird','lodash','../rpc/faxAccount','error','inspect','notify'];(function(_0x23c43d,_0x448b6e){var _0x597309=function(_0x3b789b){while(--_0x3b789b){_0x23c43d['push'](_0x23c43d['shift']());}};_0x597309(++_0x448b6e);}(_0x60a5,0x142));var _0x560a=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x60a5[_0x56482c];return _0x5aae7a;};'use strict';var util=require('util');var BPromise=require(_0x560a('0x0'));var logger=require('../../../config/logger')('preview');var _=require(_0x560a('0x1'));var faxAccount=require(_0x560a('0x2'));function loggerCatch(_0x2fd8bb){return function(_0x52be55){logger[_0x560a('0x3')](_0x2fd8bb,util[_0x560a('0x4')](_0x52be55,{'showHidden':![],'depth':null}));};}exports[_0x560a('0x5')]=function(_0x27e463,_0xabb583){return BPromise['resolve']()[_0x560a('0x6')](faxAccount[_0x560a('0x5')](_0x27e463,_0xabb583))['catch'](loggerCatch(_0x560a('0x7')));}; \ 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 5acbcf9..6d0231b 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 _0x769d=['inspect','util','../../../../config/logger','fax','bluebird','exec','execute','Exec\x20gs','info','\x20Error\x20:'];(function(_0x34234d,_0x1b8805){var _0x11e4aa=function(_0x177791){while(--_0x177791){_0x34234d['push'](_0x34234d['shift']());}};_0x11e4aa(++_0x1b8805);}(_0x769d,0x1a5));var _0xd769=function(_0x146105,_0x8089e7){_0x146105=_0x146105-0x0;var _0x3be58b=_0x769d[_0x146105];return _0x3be58b;};'use strict';var util=require(_0xd769('0x0'));var logger=require(_0xd769('0x1'))(_0xd769('0x2'));var BPromise=require(_0xd769('0x3'));var exec=require('child_process')[_0xd769('0x4')];exports[_0xd769('0x5')]=function(_0x28ee28){return new BPromise(function(_0x5bdd08,_0x2e04b0){exec(_0x28ee28,function(_0x1195e9,_0x210042,_0x45d737){logger['info'](_0xd769('0x6'),_0x210042);if(_0x1195e9){logger[_0xd769('0x7')](_0xd769('0x6'),_0xd769('0x8'),util[_0xd769('0x9')](_0x1195e9,{'showHidden':![],'depth':null}),_0x210042,_0x45d737);_0x2e04b0(_0x1195e9);}_0x5bdd08(_0x210042);});});}; \ No newline at end of file +var _0x4a40=['Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','child_process','exec','execute','info'];(function(_0x11c69f,_0x116175){var _0xba70ab=function(_0x187fe2){while(--_0x187fe2){_0x11c69f['push'](_0x11c69f['shift']());}};_0xba70ab(++_0x116175);}(_0x4a40,0x161));var _0x04a4=function(_0x345b70,_0x4dc245){_0x345b70=_0x345b70-0x0;var _0x23068c=_0x4a40[_0x345b70];return _0x23068c;};'use strict';var util=require(_0x04a4('0x0'));var logger=require(_0x04a4('0x1'))(_0x04a4('0x2'));var BPromise=require('bluebird');var exec=require(_0x04a4('0x3'))[_0x04a4('0x4')];exports[_0x04a4('0x5')]=function(_0x82afb0){return new BPromise(function(_0xd87529,_0x204f11){exec(_0x82afb0,function(_0x3e360c,_0x4bf2bc,_0x1400a8){logger[_0x04a4('0x6')](_0x04a4('0x7'),_0x4bf2bc);if(_0x3e360c){logger[_0x04a4('0x6')]('Exec\x20gs',_0x04a4('0x8'),util[_0x04a4('0x9')](_0x3e360c,{'showHidden':![],'depth':null}),_0x4bf2bc,_0x1400a8);_0x204f11(_0x3e360c);}_0xd87529(_0x4bf2bc);});});}; \ 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 4b353ea..86abc14 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 _0x472a=['localstationid','path','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','logger','info','inspect','addVariables','ecm','headerinfo','minrate','\x22%s\x22','modem','faxdetect','t38timeout'];(function(_0x12c24a,_0x3b91ba){var _0x9f9e63=function(_0x48845c){while(--_0x48845c){_0x12c24a['push'](_0x12c24a['shift']());}};_0x9f9e63(++_0x3b91ba);}(_0x472a,0x1d5));var _0xa472=function(_0x362000,_0x463b23){_0x362000=_0x362000-0x0;var _0x38510d=_0x472a[_0x362000];return _0x38510d;};'use strict';var util=require(_0xa472('0x0'));var _=require(_0xa472('0x1'));var moment=require('moment');var logger=require(_0xa472('0x2'))('fax');exports['message']=function(_0x3cad4c){return{'message':_0x3cad4c};};exports[_0xa472('0x3')]=function(_0x500fb2,_0x3871d4){logger[_0xa472('0x4')](_0x500fb2,util[_0xa472('0x5')](_0x3871d4,{'showHidden':![],'depth':null}));};exports[_0xa472('0x6')]=function(_0x3251ab,_0x4d83af){var _0xe7468c={'XMF-ECM':_0x4d83af[_0xa472('0x7')],'XMF-HEADERINFO':_0x4d83af[_0xa472('0x8')],'XMF-MINRATE':_0x4d83af[_0xa472('0x9')],'XMF-MAXRATE':_0x4d83af['maxrate'],'XMF-MODEM':util['format'](_0xa472('0xa'),_0x4d83af[_0xa472('0xb')]),'XMF-GATEWAY':_0x4d83af['gateway'],'XMF-FAXDETECT':_0x4d83af[_0xa472('0xc')],'XMF-T38TIMEOUT':_0x4d83af[_0xa472('0xd')],'XMF-LOCALSTATIONID':_0x4d83af[_0xa472('0xe')],'XMF-PATH':_0x3251ab[_0xa472('0xf')]};return _0xe7468c;};exports[_0xa472('0x10')]=function(_0x2d9e83,_0x22817e){return{'actionid':_0x2d9e83[_0xa472('0x11')],'action':'originate','channel':_0x2d9e83[_0xa472('0x12')],'Exten':_0xa472('0x13'),'Context':_0xa472('0x14'),'Priority':'1','callerid':util[_0xa472('0x15')](_0xa472('0x16'),_0x2d9e83[_0xa472('0x8')]?_0x2d9e83['headerinfo']:'',_0x2d9e83[_0xa472('0xe')]),'variable':_0x22817e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2d9e83[_0xa472('0x11')]};}; \ No newline at end of file +var _0x746b=['../../../../config/logger','fax','message','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','localstationid','util','lodash','moment'];(function(_0x56cd6b,_0x5d10ed){var _0x6d92d6=function(_0x5b40d0){while(--_0x5b40d0){_0x56cd6b['push'](_0x56cd6b['shift']());}};_0x6d92d6(++_0x5d10ed);}(_0x746b,0x1bf));var _0xb746=function(_0x471e97,_0x46b959){_0x471e97=_0x471e97-0x0;var _0x40ba92=_0x746b[_0x471e97];return _0x40ba92;};'use strict';var util=require(_0xb746('0x0'));var _=require(_0xb746('0x1'));var moment=require(_0xb746('0x2'));var logger=require(_0xb746('0x3'))(_0xb746('0x4'));exports[_0xb746('0x5')]=function(_0x516fb6){return{'message':_0x516fb6};};exports['logger']=function(_0x1dd3bd,_0x3ee03d){logger['info'](_0x1dd3bd,util['inspect'](_0x3ee03d,{'showHidden':![],'depth':null}));};exports[_0xb746('0x6')]=function(_0x8aa000,_0x4b8b13){var _0x961a5d={'XMF-ECM':_0x4b8b13[_0xb746('0x7')],'XMF-HEADERINFO':_0x4b8b13['headerinfo'],'XMF-MINRATE':_0x4b8b13[_0xb746('0x8')],'XMF-MAXRATE':_0x4b8b13[_0xb746('0x9')],'XMF-MODEM':util[_0xb746('0xa')](_0xb746('0xb'),_0x4b8b13[_0xb746('0xc')]),'XMF-GATEWAY':_0x4b8b13[_0xb746('0xd')],'XMF-FAXDETECT':_0x4b8b13[_0xb746('0xe')],'XMF-T38TIMEOUT':_0x4b8b13[_0xb746('0xf')],'XMF-LOCALSTATIONID':_0x4b8b13['localstationid'],'XMF-PATH':_0x8aa000[_0xb746('0x10')]};return _0x961a5d;};exports[_0xb746('0x11')]=function(_0x25f435,_0x22f374){return{'actionid':_0x25f435[_0xb746('0x12')],'action':_0xb746('0x13'),'channel':_0x25f435[_0xb746('0x14')],'Exten':_0xb746('0x15'),'Context':'from-sip','Priority':'1','callerid':util[_0xb746('0xa')](_0xb746('0x16'),_0x25f435[_0xb746('0x17')]?_0x25f435['headerinfo']:'',_0x25f435[_0xb746('0x18')]),'variable':_0x22f374,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x25f435[_0xb746('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 3c36445..0297aa2 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 _0xd3d0=['./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','ami','get','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','[index.js][initParams]','inspect','listen','sync','error','[index.js][main]','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceCallReport'];(function(_0x5de28c,_0x139f05){var _0xc34eac=function(_0x41b88f){while(--_0x41b88f){_0x5de28c['push'](_0x5de28c['shift']());}};_0xc34eac(++_0x139f05);}(_0xd3d0,0x159));var _0x0d3d=function(_0x41e8e8,_0x1a8f06){_0x41e8e8=_0x41e8e8-0x0;var _0x18a259=_0xd3d0[_0x41e8e8];return _0x18a259;};'use strict';var util=require('util');var moment=require(_0x0d3d('0x0'));var server=require(_0x0d3d('0x1'));var Realtime=require(_0x0d3d('0x2'));var Report=require(_0x0d3d('0x3'));var Acw=require('./acw');var Trigger=require(_0x0d3d('0x4'));var Dialer=require(_0x0d3d('0x5'));var Preview=require(_0x0d3d('0x6'));var Fax=require(_0x0d3d('0x7'));var user=require(_0x0d3d('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x0d3d('0x9'));var trunk=require(_0x0d3d('0xa'));var trigger=require(_0x0d3d('0xb'));var template=require(_0x0d3d('0xc'));var cmHopperHistory=require(_0x0d3d('0xd'));var campaign=require(_0x0d3d('0xe'));var voiceExtension=require(_0x0d3d('0xf'));var faxAccount=require(_0x0d3d('0x10'));var zendesk=require(_0x0d3d('0x11'));var salesforce=require(_0x0d3d('0x12'));var sugarcrm=require(_0x0d3d('0x13'));var freshdesk=require(_0x0d3d('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x0d3d('0x15'));var vtiger=require(_0x0d3d('0x16'));var freshsales=require(_0x0d3d('0x17'));var servicenow=require(_0x0d3d('0x18'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x0d3d('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0d3d('0x1a')](_0x0d3d('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x0d3d('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x0d3d('0x1c')]()[_0x0d3d('0x1d')](user[_0x0d3d('0x1e')]())[_0x0d3d('0x1d')](realtime['initAgents']())[_0x0d3d('0x1d')](user[_0x0d3d('0x1f')]())[_0x0d3d('0x1d')](realtime[_0x0d3d('0x20')]())[_0x0d3d('0x1d')](trunk[_0x0d3d('0x21')]())[_0x0d3d('0x1d')](realtime[_0x0d3d('0x22')]())['then'](voiceQueue[_0x0d3d('0x23')]())[_0x0d3d('0x1d')](realtime['initVoiceQueues']())[_0x0d3d('0x1d')](trigger[_0x0d3d('0x24')]())[_0x0d3d('0x1d')](realtime['initTriggers']())[_0x0d3d('0x1d')](template[_0x0d3d('0x25')]())[_0x0d3d('0x1d')](realtime[_0x0d3d('0x26')]())[_0x0d3d('0x1d')](zendesk[_0x0d3d('0x27')]())[_0x0d3d('0x1d')](realtime[_0x0d3d('0x28')]())[_0x0d3d('0x1d')](salesforce[_0x0d3d('0x29')]())[_0x0d3d('0x1d')](realtime[_0x0d3d('0x2a')]())['then'](sugarcrm[_0x0d3d('0x2b')]())[_0x0d3d('0x1d')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x0d3d('0x2c')]())[_0x0d3d('0x1d')](realtime[_0x0d3d('0x2d')]())[_0x0d3d('0x1d')](desk['getDeskAccounts']())[_0x0d3d('0x1d')](realtime[_0x0d3d('0x2e')]())[_0x0d3d('0x1d')](zoho['getZohoAccounts']())[_0x0d3d('0x1d')](realtime[_0x0d3d('0x2f')]())[_0x0d3d('0x1d')](vtiger[_0x0d3d('0x30')]())[_0x0d3d('0x1d')](realtime[_0x0d3d('0x31')]())['then'](freshsales[_0x0d3d('0x32')]())[_0x0d3d('0x1d')](realtime[_0x0d3d('0x33')]())[_0x0d3d('0x1d')](servicenow[_0x0d3d('0x34')]())[_0x0d3d('0x1d')](realtime['initServicenowAccounts']())[_0x0d3d('0x1d')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x0d3d('0x35')]())[_0x0d3d('0x1d')](campaign[_0x0d3d('0x36')]())['then'](realtime[_0x0d3d('0x37')]())[_0x0d3d('0x1d')](voiceExtension['getVoiceExtensions']())[_0x0d3d('0x1d')](realtime[_0x0d3d('0x38')]())[_0x0d3d('0x1d')](faxAccount[_0x0d3d('0x39')]())[_0x0d3d('0x1d')](realtime['initFaxAccounts']())[_0x0d3d('0x1d')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x0d3d('0x1d')](voiceQueueReport[_0x0d3d('0x3a')]())[_0x0d3d('0x1d')](realtime[_0x0d3d('0x3b')]())[_0x0d3d('0x1d')](cmHopperHistory[_0x0d3d('0x3c')]())[_0x0d3d('0x1d')](realtime['initVoiceQueueHopperHistory']())[_0x0d3d('0x1d')](cmHopperHistory[_0x0d3d('0x3d')]())[_0x0d3d('0x1d')](realtime[_0x0d3d('0x3e')]())[_0x0d3d('0x1d')](voiceCallReport[_0x0d3d('0x3f')]())[_0x0d3d('0x1d')](realtime[_0x0d3d('0x40')]())['catch'](function(_0x55430e){logger['error'](_0x0d3d('0x41'),util[_0x0d3d('0x42')](_0x55430e,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0d3d('0x43')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x0d3d('0x1d')](function(){return initParams();})[_0x0d3d('0x1d')](function(){report[_0x0d3d('0x44')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x250b69){logger[_0x0d3d('0x45')](_0x0d3d('0x46'),util[_0x0d3d('0x42')](_0x250b69,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x01b6=['getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','util','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getTelephones','initTelephones','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','getFreshdeskAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01b6,0x1ee));var _0x601b=function(_0x19a11f,_0x6d8be7){_0x19a11f=_0x19a11f-0x0;var _0x51485f=_0x01b6[_0x19a11f];return _0x51485f;};'use strict';var util=require(_0x601b('0x0'));var moment=require('moment');var server=require(_0x601b('0x1'));var Realtime=require(_0x601b('0x2'));var Report=require(_0x601b('0x3'));var Acw=require(_0x601b('0x4'));var Trigger=require(_0x601b('0x5'));var Dialer=require('./dialer');var Preview=require(_0x601b('0x6'));var Fax=require(_0x601b('0x7'));var user=require(_0x601b('0x8'));var voiceQueue=require(_0x601b('0x9'));var voiceQueueReport=require(_0x601b('0xa'));var voiceCallReport=require(_0x601b('0xb'));var trunk=require(_0x601b('0xc'));var trigger=require(_0x601b('0xd'));var template=require('./rpc/template');var cmHopperHistory=require(_0x601b('0xe'));var campaign=require(_0x601b('0xf'));var voiceExtension=require(_0x601b('0x10'));var faxAccount=require(_0x601b('0x11'));var zendesk=require(_0x601b('0x12'));var salesforce=require(_0x601b('0x13'));var sugarcrm=require(_0x601b('0x14'));var freshdesk=require(_0x601b('0x15'));var desk=require(_0x601b('0x16'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x601b('0x17'));var freshsales=require(_0x601b('0x18'));var servicenow=require(_0x601b('0x19'));var dynamics365=require(_0x601b('0x1a'));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 logger=require(_0x601b('0x1b'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x601b('0x1c')](_0x601b('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x601b('0x1c')](_0x601b('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x601b('0x1e')]()[_0x601b('0x1f')](user['getAgents']())['then'](realtime['initAgents']())[_0x601b('0x1f')](user[_0x601b('0x20')]())['then'](realtime[_0x601b('0x21')]())['then'](trunk['getTrunks']())['then'](realtime['initTrunks']())[_0x601b('0x1f')](voiceQueue['getVoiceQueues']())[_0x601b('0x1f')](realtime[_0x601b('0x22')]())['then'](trigger[_0x601b('0x23')]())[_0x601b('0x1f')](realtime[_0x601b('0x24')]())['then'](template[_0x601b('0x25')]())[_0x601b('0x1f')](realtime['initTemplates']())['then'](zendesk[_0x601b('0x26')]())['then'](realtime[_0x601b('0x27')]())[_0x601b('0x1f')](salesforce['getSalesforceAccounts']())[_0x601b('0x1f')](realtime['initSalesforceAccounts']())[_0x601b('0x1f')](sugarcrm[_0x601b('0x28')]())[_0x601b('0x1f')](realtime['initSugarcrmAccounts']())[_0x601b('0x1f')](freshdesk[_0x601b('0x29')]())[_0x601b('0x1f')](realtime['initFreshdeskAccounts']())['then'](desk[_0x601b('0x2a')]())['then'](realtime['initDeskAccounts']())[_0x601b('0x1f')](zoho[_0x601b('0x2b')]())[_0x601b('0x1f')](realtime[_0x601b('0x2c')]())[_0x601b('0x1f')](vtiger[_0x601b('0x2d')]())[_0x601b('0x1f')](realtime[_0x601b('0x2e')]())[_0x601b('0x1f')](freshsales[_0x601b('0x2f')]())[_0x601b('0x1f')](realtime['initFreshsalesAccounts']())[_0x601b('0x1f')](servicenow[_0x601b('0x30')]())[_0x601b('0x1f')](realtime[_0x601b('0x31')]())[_0x601b('0x1f')](dynamics365[_0x601b('0x32')]())[_0x601b('0x1f')](realtime['initDynamics365Accounts']())[_0x601b('0x1f')](campaign[_0x601b('0x33')]())[_0x601b('0x1f')](realtime['initCampaigns']())[_0x601b('0x1f')](voiceExtension[_0x601b('0x34')]())['then'](realtime[_0x601b('0x35')]())[_0x601b('0x1f')](faxAccount[_0x601b('0x36')]())[_0x601b('0x1f')](realtime[_0x601b('0x37')]())[_0x601b('0x1f')](function(){return realtime;});}function initParams(){return Promise[_0x601b('0x1e')]()[_0x601b('0x1f')](voiceQueueReport['getVoiceQueueReports']())[_0x601b('0x1f')](realtime[_0x601b('0x38')]())['then'](cmHopperHistory[_0x601b('0x39')]())[_0x601b('0x1f')](realtime[_0x601b('0x3a')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x601b('0x1f')](realtime[_0x601b('0x3b')]())[_0x601b('0x1f')](voiceCallReport[_0x601b('0x3c')]())['then'](realtime[_0x601b('0x3d')]())[_0x601b('0x3e')](function(_0x393aec){logger[_0x601b('0x3f')]('[index.js][initParams]',util[_0x601b('0x40')](_0x393aec,{'showHidden':![],'depth':null}));});}function main(){return server[_0x601b('0x41')](realtime,preview,fax)[_0x601b('0x1f')](function(){return initRealtime();})[_0x601b('0x1f')](function(){return initParams();})[_0x601b('0x1f')](function(){report[_0x601b('0x42')]();setInterval(initRealtime,0x1388);})[_0x601b('0x3e')](function(_0x35804d){logger['error']('[index.js][main]',util[_0x601b('0x40')](_0x35804d,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index b5c7e9a..a8ffc0e 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 _0x56da=['onhold','local','prototype','updateStatusRealtime','toLowerCase','inuse','statePause','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','localhost','name','email','accountcode','fullname','state','stateTime','status','unknown','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber'];(function(_0x4a874d,_0x58f618){var _0xdb42a7=function(_0x2b4522){while(--_0x2b4522){_0x4a874d['push'](_0x4a874d['shift']());}};_0xdb42a7(++_0x58f618);}(_0x56da,0x1d8));var _0xa56d=function(_0xea6018,_0x4cf082){_0xea6018=_0xea6018-0x0;var _0x57b54d=_0x56da[_0xea6018];return _0x57b54d;};'use strict';var _=require(_0xa56d('0x0'));var util=require(_0xa56d('0x1'));var moment=require(_0xa56d('0x2'));var md5=require(_0xa56d('0x3'));var Redis=require(_0xa56d('0x4'));var config=require(_0xa56d('0x5'));config[_0xa56d('0x6')]=_['defaults'](config[_0xa56d('0x6')],{'host':_0xa56d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa56d('0x6')]));function Agent(_0x6aed8d){this['id']=_0x6aed8d['id']||0x0;this[_0xa56d('0x8')]=_0x6aed8d[_0xa56d('0x8')]||'';this[_0xa56d('0x9')]=_0x6aed8d[_0xa56d('0x9')]||'';this[_0xa56d('0xa')]=_0x6aed8d['accountcode']||'';this[_0xa56d('0xb')]=_0x6aed8d[_0xa56d('0xb')]||'';this[_0xa56d('0xc')]='unknown';this[_0xa56d('0xd')]=0x0;this[_0xa56d('0xe')]=_0xa56d('0xf');this[_0xa56d('0x10')]='';this['phone']='';this[_0xa56d('0x11')]='';this[_0xa56d('0x12')]='';this[_0xa56d('0x13')]=_0x6aed8d[_0xa56d('0x13')]||![];this[_0xa56d('0x14')]=_0xa56d('0xf');this['voiceStatusTime']=0x0;this[_0xa56d('0x15')]='';this['voiceStatusQueue']='';this[_0xa56d('0x16')]=![];this[_0xa56d('0x17')]=![];this[_0xa56d('0x3')]='';}Agent[_0xa56d('0x18')][_0xa56d('0x19')]=function(_0x56d4cb){var _0x22f43;if(_0x56d4cb&&_0x56d4cb[_0xa56d('0xc')]){_0x22f43=_0x56d4cb[_0xa56d('0xc')][_0xa56d('0x1a')]();switch(_0x22f43){case'not_inuse':_0x22f43='idle';break;case _0xa56d('0x1b'):_0x22f43='talking';break;}}if(_0x22f43&&this[_0xa56d('0x14')]!==_0x22f43||_0x56d4cb[_0xa56d('0x1c')]){this[_0xa56d('0x1d')]=_[_0xa56d('0x1e')](moment()[_0xa56d('0x1f')]('x'));}if(_0x22f43){this[_0xa56d('0x14')]=_0x22f43;}var _0x81c2b3={'id':this['id'],'name':this[_0xa56d('0x8')],'email':this[_0xa56d('0x9')],'accountcode':this['accountcode'],'fullname':this[_0xa56d('0xb')],'state':this['state'],'stateTime':this[_0xa56d('0xd')],'status':this['status'],'address':this['address'],'online':this[_0xa56d('0x13')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xa56d('0x1d')],'voiceStatusCallerIdNumber':this[_0xa56d('0x15')],'voiceStatusQueue':this[_0xa56d('0x20')],'interface':this[_0xa56d('0x12')],'onhold':this['onhold']};var _0x176f4e=md5(JSON[_0xa56d('0x21')](_0x81c2b3));if(this[_0xa56d('0x3')]!==_0x176f4e){this[_0xa56d('0x3')]=_0x176f4e;io['to'](util[_0xa56d('0x1f')](_0xa56d('0x22'),_0x81c2b3[_0xa56d('0x8')]))[_0xa56d('0x23')](_0xa56d('0x24'),_0x81c2b3);io[_0xa56d('0x23')]('user:presence',_0x81c2b3);}};module[_0xa56d('0x25')]=Agent; \ No newline at end of file +var _0x7759=['voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','statePause','format','email','address','interface','stringify','user:%s','emit','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','accountcode','fullname','state','unknown','stateTime','status','mobile','online','voiceStatus','voiceStatusTime'];(function(_0x4d089e,_0x33fb0e){var _0x14115d=function(_0x1c7638){while(--_0x1c7638){_0x4d089e['push'](_0x4d089e['shift']());}};_0x14115d(++_0x33fb0e);}(_0x7759,0x143));var _0x9775=function(_0x90bd5d,_0x14551a){_0x90bd5d=_0x90bd5d-0x0;var _0x325766=_0x7759[_0x90bd5d];return _0x325766;};'use strict';var _=require(_0x9775('0x0'));var util=require('util');var moment=require(_0x9775('0x1'));var md5=require(_0x9775('0x2'));var Redis=require(_0x9775('0x3'));var config=require(_0x9775('0x4'));config[_0x9775('0x5')]=_[_0x9775('0x6')](config[_0x9775('0x5')],{'host':_0x9775('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x2543f1){this['id']=_0x2543f1['id']||0x0;this['name']=_0x2543f1[_0x9775('0x8')]||'';this['email']=_0x2543f1['email']||'';this[_0x9775('0x9')]=_0x2543f1[_0x9775('0x9')]||'';this[_0x9775('0xa')]=_0x2543f1['fullname']||'';this[_0x9775('0xb')]=_0x9775('0xc');this[_0x9775('0xd')]=0x0;this[_0x9775('0xe')]=_0x9775('0xc');this['address']='';this['phone']='';this[_0x9775('0xf')]='';this['interface']='';this[_0x9775('0x10')]=_0x2543f1[_0x9775('0x10')]||![];this[_0x9775('0x11')]=_0x9775('0xc');this[_0x9775('0x12')]=0x0;this[_0x9775('0x13')]='';this[_0x9775('0x14')]='';this[_0x9775('0x15')]=![];this[_0x9775('0x16')]=![];this[_0x9775('0x2')]='';}Agent[_0x9775('0x17')][_0x9775('0x18')]=function(_0x116e4f){var _0x443a8d;if(_0x116e4f&&_0x116e4f[_0x9775('0xb')]){_0x443a8d=_0x116e4f[_0x9775('0xb')][_0x9775('0x19')]();switch(_0x443a8d){case _0x9775('0x1a'):_0x443a8d=_0x9775('0x1b');break;case _0x9775('0x1c'):_0x443a8d='talking';break;}}if(_0x443a8d&&this[_0x9775('0x11')]!==_0x443a8d||_0x116e4f[_0x9775('0x1d')]){this[_0x9775('0x12')]=_['toNumber'](moment()[_0x9775('0x1e')]('x'));}if(_0x443a8d){this[_0x9775('0x11')]=_0x443a8d;}var _0xe79ca7={'id':this['id'],'name':this[_0x9775('0x8')],'email':this[_0x9775('0x1f')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0x9775('0xd')],'status':this[_0x9775('0xe')],'address':this[_0x9775('0x20')],'online':this[_0x9775('0x10')],'voiceStatus':this[_0x9775('0x11')],'voiceStatusTime':this[_0x9775('0x12')],'voiceStatusCallerIdNumber':this[_0x9775('0x13')],'voiceStatusQueue':this[_0x9775('0x14')],'interface':this[_0x9775('0x21')],'onhold':this[_0x9775('0x15')]};var _0x1f28b4=md5(JSON[_0x9775('0x22')](_0xe79ca7));if(this[_0x9775('0x2')]!==_0x1f28b4){this['md5']=_0x1f28b4;io['to'](util[_0x9775('0x1e')](_0x9775('0x23'),_0xe79ca7['name']))['emit']('user:save',_0xe79ca7);io[_0x9775('0x24')]('user:presence',_0xe79ca7);}};module[_0x9775('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 5e7ef51..a196113 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 _0xc43d=['ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp'];(function(_0x3e43c8,_0x52eff7){var _0x234298=function(_0x168bd9){while(--_0x168bd9){_0x3e43c8['push'](_0x3e43c8['shift']());}};_0x234298(++_0x52eff7);}(_0xc43d,0x1d2));var _0xdc43=function(_0x289842,_0x2d9db4){_0x289842=_0x289842-0x0;var _0x16155a=_0xc43d[_0x289842];return _0x16155a;};'use strict';function Campaign(_0x31ffdf){this['id']=_0x31ffdf['id']||0x0;this[_0xdc43('0x0')]=_0x31ffdf['name']||'';this[_0xdc43('0x1')]=_0x31ffdf[_0xdc43('0x1')]||'campaign';this[_0xdc43('0x2')]=0x0;this[_0xdc43('0x3')]=0x0;this[_0xdc43('0x4')]=0x0;this[_0xdc43('0x5')]=0x0;this['message']='';this[_0xdc43('0x6')]=!![];this[_0xdc43('0x7')]=_0x31ffdf[_0xdc43('0x7')];this['limitCalls']=_0x31ffdf['limitCalls'];this[_0xdc43('0x8')]=_0x31ffdf['dialTimezone']||null;this[_0xdc43('0x9')]=_0x31ffdf['dialGlobalInterval']?_0x31ffdf['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x31ffdf[_0xdc43('0xa')];this['dialOriginateCallerIdNumber']=_0x31ffdf['dialOriginateCallerIdNumber'];this[_0xdc43('0xb')]=_0x31ffdf[_0xdc43('0xb')]||0x1e;this['dialCongestionMaxRetry']=_0x31ffdf['dialCongestionMaxRetry'];this[_0xdc43('0xc')]=_0x31ffdf[_0xdc43('0xc')];this[_0xdc43('0xd')]=_0x31ffdf[_0xdc43('0xd')];this['dialBusyRetryFrequency']=_0x31ffdf[_0xdc43('0xe')];this['dialNoAnswerMaxRetry']=_0x31ffdf[_0xdc43('0xf')];this[_0xdc43('0x10')]=_0x31ffdf[_0xdc43('0x10')];this[_0xdc43('0x11')]=_0x31ffdf[_0xdc43('0x11')];this[_0xdc43('0x12')]=_0x31ffdf[_0xdc43('0x12')]||0x3;this[_0xdc43('0x13')]=_0x31ffdf[_0xdc43('0x13')]||0x96;this[_0xdc43('0x14')]=_0x31ffdf['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x31ffdf[_0xdc43('0x15')]||0x96;this[_0xdc43('0x16')]=_0x31ffdf[_0xdc43('0x16')]||0x3;this[_0xdc43('0x17')]=_0x31ffdf[_0xdc43('0x17')]||0x96;this[_0xdc43('0x18')]=_0x31ffdf[_0xdc43('0x18')]||0x3;this[_0xdc43('0x19')]=_0x31ffdf[_0xdc43('0x19')]||0x96;this[_0xdc43('0x1a')]=_0x31ffdf[_0xdc43('0x1a')]||0x3;this[_0xdc43('0x1b')]=_0x31ffdf[_0xdc43('0x1b')]||0x96;this[_0xdc43('0x1c')]=_0x31ffdf[_0xdc43('0x1c')]||'DESC';this[_0xdc43('0x1d')]=_0x31ffdf[_0xdc43('0x1d')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x31ffdf[_0xdc43('0x1e')]||undefined;this[_0xdc43('0x1f')]=_0x31ffdf[_0xdc43('0x1f')]||undefined;this[_0xdc43('0x20')]=_0x31ffdf[_0xdc43('0x20')]?_0x31ffdf[_0xdc43('0x20')]:undefined;this['Trunk']=_0x31ffdf[_0xdc43('0x21')]?_0x31ffdf[_0xdc43('0x21')]:undefined;this[_0xdc43('0x22')]=_0x31ffdf[_0xdc43('0x22')]?_0x31ffdf[_0xdc43('0x22')]:undefined;this['SquareProject']=_0x31ffdf[_0xdc43('0x23')]?_0x31ffdf['SquareProject']:undefined;this['dialQueueProject']=_0x31ffdf['SquareProject']?_0x31ffdf[_0xdc43('0x23')][_0xdc43('0x0')]:undefined;this[_0xdc43('0x24')]=_0x31ffdf[_0xdc43('0x24')]||![];this['dialAMDInitialSilence']=_0x31ffdf[_0xdc43('0x25')];this['dialAMDGreeting']=_0x31ffdf[_0xdc43('0x26')];this['dialAMDAfterGreetingSilence']=_0x31ffdf[_0xdc43('0x27')];this[_0xdc43('0x28')]=_0x31ffdf[_0xdc43('0x28')];this[_0xdc43('0x29')]=_0x31ffdf['dialAMDMinWordLength'];this[_0xdc43('0x2a')]=_0x31ffdf[_0xdc43('0x2a')];this[_0xdc43('0x2b')]=_0x31ffdf[_0xdc43('0x2b')];this[_0xdc43('0x2c')]=_0x31ffdf[_0xdc43('0x2c')];this['dialAMDMaximumWordLength']=_0x31ffdf[_0xdc43('0x2d')];}module[_0xdc43('0x2e')]=Campaign; \ No newline at end of file +var _0xcef4=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xcef4,0x1b6));var _0x4cef=function(_0x1b92a6,_0x14444b){_0x1b92a6=_0x1b92a6-0x0;var _0x24be5b=_0xcef4[_0x1b92a6];return _0x24be5b;};'use strict';function Campaign(_0x31e222){this['id']=_0x31e222['id']||0x0;this[_0x4cef('0x0')]=_0x31e222[_0x4cef('0x0')]||'';this[_0x4cef('0x1')]=_0x31e222[_0x4cef('0x1')]||_0x4cef('0x2');this[_0x4cef('0x3')]=0x0;this[_0x4cef('0x4')]=0x0;this[_0x4cef('0x5')]=0x0;this[_0x4cef('0x6')]=0x0;this[_0x4cef('0x7')]='';this[_0x4cef('0x8')]=!![];this[_0x4cef('0x9')]=_0x31e222['active'];this[_0x4cef('0xa')]=_0x31e222[_0x4cef('0xa')];this[_0x4cef('0xb')]=_0x31e222[_0x4cef('0xb')]||null;this[_0x4cef('0xc')]=_0x31e222[_0x4cef('0xc')]?_0x31e222[_0x4cef('0xc')]:null;this[_0x4cef('0xd')]=_0x31e222[_0x4cef('0xd')];this[_0x4cef('0xe')]=_0x31e222[_0x4cef('0xe')];this['dialOriginateTimeout']=_0x31e222[_0x4cef('0xf')]||0x1e;this[_0x4cef('0x10')]=_0x31e222[_0x4cef('0x10')];this[_0x4cef('0x11')]=_0x31e222[_0x4cef('0x11')];this[_0x4cef('0x12')]=_0x31e222['dialBusyMaxRetry'];this[_0x4cef('0x13')]=_0x31e222[_0x4cef('0x13')];this[_0x4cef('0x14')]=_0x31e222[_0x4cef('0x14')];this[_0x4cef('0x15')]=_0x31e222[_0x4cef('0x15')];this[_0x4cef('0x16')]=_0x31e222[_0x4cef('0x16')];this[_0x4cef('0x17')]=_0x31e222['dialNoSuchNumberMaxRetry']||0x3;this[_0x4cef('0x18')]=_0x31e222[_0x4cef('0x18')]||0x96;this[_0x4cef('0x19')]=_0x31e222[_0x4cef('0x19')]||0x3;this[_0x4cef('0x1a')]=_0x31e222[_0x4cef('0x1a')]||0x96;this['dialAbandonedMaxRetry']=_0x31e222['dialAbandonedMaxRetry']||0x3;this[_0x4cef('0x1b')]=_0x31e222['dialAbandonedRetryFrequency']||0x96;this[_0x4cef('0x1c')]=_0x31e222[_0x4cef('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0x31e222[_0x4cef('0x1d')]||0x96;this[_0x4cef('0x1e')]=_0x31e222[_0x4cef('0x1e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x31e222[_0x4cef('0x1f')]||0x96;this[_0x4cef('0x20')]=_0x31e222[_0x4cef('0x20')]||'DESC';this[_0x4cef('0x21')]=_0x31e222[_0x4cef('0x21')]||undefined;this[_0x4cef('0x22')]=_0x31e222[_0x4cef('0x22')]||undefined;this[_0x4cef('0x23')]=_0x31e222[_0x4cef('0x23')]||undefined;this[_0x4cef('0x24')]=_0x31e222['TrunkBackup']?_0x31e222[_0x4cef('0x24')]:undefined;this[_0x4cef('0x25')]=_0x31e222[_0x4cef('0x25')]?_0x31e222['Trunk']:undefined;this[_0x4cef('0x26')]=_0x31e222['Interval']?_0x31e222['Interval']:undefined;this[_0x4cef('0x27')]=_0x31e222[_0x4cef('0x27')]?_0x31e222[_0x4cef('0x27')]:undefined;this[_0x4cef('0x28')]=_0x31e222[_0x4cef('0x27')]?_0x31e222[_0x4cef('0x27')][_0x4cef('0x0')]:undefined;this[_0x4cef('0x29')]=_0x31e222[_0x4cef('0x29')]||![];this['dialAMDInitialSilence']=_0x31e222[_0x4cef('0x2a')];this['dialAMDGreeting']=_0x31e222[_0x4cef('0x2b')];this['dialAMDAfterGreetingSilence']=_0x31e222[_0x4cef('0x2c')];this['dialAMDTotalAnalysisTime']=_0x31e222[_0x4cef('0x2d')];this[_0x4cef('0x2e')]=_0x31e222['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x31e222['dialAMDBetweenWordsSilence'];this[_0x4cef('0x2f')]=_0x31e222[_0x4cef('0x2f')];this[_0x4cef('0x30')]=_0x31e222['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x31e222['dialAMDMaximumWordLength'];}module[_0x4cef('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 10ca679..7df9926 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 _0x2106=['connectedlinename','accountcode','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','tag','disposition','queue','monitors','transfercalleridnum','transferType','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum'];(function(_0x3dd1b3,_0x57344f){var _0x3be09e=function(_0xb3fffd){while(--_0xb3fffd){_0x3dd1b3['push'](_0x3dd1b3['shift']());}};_0x3be09e(++_0x57344f);}(_0x2106,0x133));var _0x6210=function(_0x3257b4,_0x3506b1){_0x3257b4=_0x3257b4-0x0;var _0x361b25=_0x2106[_0x3257b4];return _0x361b25;};'use strict';function Channel(){this['starttime']=null;this[_0x6210('0x0')]='';this[_0x6210('0x1')]='';this[_0x6210('0x2')]=0x0;this[_0x6210('0x3')]='';this[_0x6210('0x4')]=undefined;this[_0x6210('0x5')]=undefined;this[_0x6210('0x6')]=0x0;this['context']='';this[_0x6210('0x7')]=0x0;this[_0x6210('0x8')]=0x0;this['exten']=0x0;this[_0x6210('0x9')]=![];this[_0x6210('0xa')]=null;this[_0x6210('0xb')]=null;this[_0x6210('0xc')]=![];this[_0x6210('0xd')]=![];this[_0x6210('0xe')]='';this[_0x6210('0xf')]='';this[_0x6210('0x10')]=0x0;this[_0x6210('0x11')]=0x0;this['holdtime']=0x0;this['type']=null;this[_0x6210('0x12')]=null;this[_0x6210('0x13')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0x6210('0x14')]=null;this[_0x6210('0x15')]=[];this[_0x6210('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x6210('0x17')]=undefined;this[_0x6210('0x18')]=0x0;}module[_0x6210('0x19')]=Channel; \ No newline at end of file +var _0xcdd2=['monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answertime','endtime','unmanaged','abandoned','billableseconds','type','tag','disposition','monitor'];(function(_0x27ba11,_0x55c24f){var _0x2a8afb=function(_0x5d1e58){while(--_0x5d1e58){_0x27ba11['push'](_0x27ba11['shift']());}};_0x2a8afb(++_0x55c24f);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';function Channel(){this[_0x2cdd('0x0')]=null;this[_0x2cdd('0x1')]='';this[_0x2cdd('0x2')]='';this[_0x2cdd('0x3')]=0x0;this['calleridname']='';this[_0x2cdd('0x4')]=undefined;this[_0x2cdd('0x5')]=undefined;this[_0x2cdd('0x6')]=0x0;this[_0x2cdd('0x7')]='';this['uniqueid']=0x0;this[_0x2cdd('0x8')]=0x0;this[_0x2cdd('0x9')]=0x0;this['answered']=![];this[_0x2cdd('0xa')]=null;this[_0x2cdd('0xb')]=null;this[_0x2cdd('0xc')]=![];this[_0x2cdd('0xd')]=![];this['lastapplication']='';this['lastdata']='';this['duration']=0x0;this[_0x2cdd('0xe')]=0x0;this['holdtime']=0x0;this[_0x2cdd('0xf')]=null;this[_0x2cdd('0x10')]=null;this[_0x2cdd('0x11')]=null;this[_0x2cdd('0x12')]=![];this[_0x2cdd('0x13')]=null;this[_0x2cdd('0x14')]=null;this[_0x2cdd('0x15')]=[];this[_0x2cdd('0x16')]=undefined;this[_0x2cdd('0x17')]=undefined;this[_0x2cdd('0x18')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index ec99bd8..0162947 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 _0x990f=['remoteUri','authType','password','consumerKey','consumerSecret','token','type','serverUrl','Configurations','exports','name','username'];(function(_0x368f08,_0x3566d6){var _0x4df05b=function(_0x19c659){while(--_0x19c659){_0x368f08['push'](_0x368f08['shift']());}};_0x4df05b(++_0x3566d6);}(_0x990f,0x1d2));var _0xf990=function(_0x3eb471,_0x55cede){_0x3eb471=_0x3eb471-0x0;var _0x5c7cee=_0x990f[_0x3eb471];return _0x5c7cee;};'use strict';function DeskAccount(_0x7ba321){this['id']=_0x7ba321['id']||0x0;this['name']=_0x7ba321[_0xf990('0x0')]||'';this[_0xf990('0x1')]=_0x7ba321[_0xf990('0x1')]||'';this[_0xf990('0x2')]=_0x7ba321[_0xf990('0x2')]||'';this['authType']=_0x7ba321[_0xf990('0x3')]||'';this[_0xf990('0x4')]=_0x7ba321[_0xf990('0x4')]||'';this[_0xf990('0x5')]=_0x7ba321['consumerKey']||'';this[_0xf990('0x6')]=_0x7ba321[_0xf990('0x6')]||'';this[_0xf990('0x7')]=_0x7ba321[_0xf990('0x7')]||'';this['tokenSecret']=_0x7ba321['tokenSecret']||'';this[_0xf990('0x8')]=_0x7ba321[_0xf990('0x8')]||'';this[_0xf990('0x9')]=_0x7ba321[_0xf990('0x9')]||'';this[_0xf990('0xa')]=_0x7ba321[_0xf990('0xa')]||{};}module[_0xf990('0xb')]=DeskAccount; \ No newline at end of file +var _0x3f1b=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x447254,_0x5746e2){var _0xcbd654=function(_0x4d92db){while(--_0x4d92db){_0x447254['push'](_0x447254['shift']());}};_0xcbd654(++_0x5746e2);}(_0x3f1b,0x1f1));var _0xb3f1=function(_0x227118,_0x4be2ed){_0x227118=_0x227118-0x0;var _0x7345fb=_0x3f1b[_0x227118];return _0x7345fb;};'use strict';function DeskAccount(_0x47bc39){this['id']=_0x47bc39['id']||0x0;this[_0xb3f1('0x0')]=_0x47bc39[_0xb3f1('0x0')]||'';this['username']=_0x47bc39[_0xb3f1('0x1')]||'';this[_0xb3f1('0x2')]=_0x47bc39['remoteUri']||'';this[_0xb3f1('0x3')]=_0x47bc39['authType']||'';this[_0xb3f1('0x4')]=_0x47bc39['password']||'';this[_0xb3f1('0x5')]=_0x47bc39['consumerKey']||'';this[_0xb3f1('0x6')]=_0x47bc39[_0xb3f1('0x6')]||'';this[_0xb3f1('0x7')]=_0x47bc39[_0xb3f1('0x7')]||'';this[_0xb3f1('0x8')]=_0x47bc39['tokenSecret']||'';this[_0xb3f1('0x9')]=_0x47bc39[_0xb3f1('0x9')]||'';this[_0xb3f1('0xa')]=_0x47bc39['serverUrl']||'';this[_0xb3f1('0xb')]=_0x47bc39[_0xb3f1('0xb')]||{};}module[_0xb3f1('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index ab8d0f8..7d1f776 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 _0xd60b=['username','password','remoteUri','tenantId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xd60b,0xa4));var _0xbd60=function(_0x342875,_0x9779af){_0x342875=_0x342875-0x0;var _0xc7233f=_0xd60b[_0x342875];return _0xc7233f;};'use strict';function Dynamics365Account(_0x56a46c){this['id']=_0x56a46c['id']||0x0;this[_0xbd60('0x0')]=_0x56a46c['name']||'';this[_0xbd60('0x1')]=_0x56a46c['username']||'';this[_0xbd60('0x2')]=_0x56a46c[_0xbd60('0x2')]||'';this[_0xbd60('0x3')]=_0x56a46c[_0xbd60('0x3')]||'';this['tenantId']=_0x56a46c[_0xbd60('0x4')]||'';this['clientId']=_0x56a46c['clientId']||'';this[_0xbd60('0x5')]=_0x56a46c[_0xbd60('0x5')]||{};this[_0xbd60('0x6')]=_0x56a46c[_0xbd60('0x6')]||'';this['modernAuthentication']=_0x56a46c[_0xbd60('0x7')]||![];this[_0xbd60('0x8')]=_0x56a46c[_0xbd60('0x8')]||{};this[_0xbd60('0x9')]=_0x56a46c[_0xbd60('0x9')]||{};}module[_0xbd60('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x8ee7=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x452a9c,_0x246fa6){var _0x204bf1=function(_0x39750e){while(--_0x39750e){_0x452a9c['push'](_0x452a9c['shift']());}};_0x204bf1(++_0x246fa6);}(_0x8ee7,0x14e));var _0x78ee=function(_0x1407e2,_0x38db9e){_0x1407e2=_0x1407e2-0x0;var _0x1f1a3a=_0x8ee7[_0x1407e2];return _0x1f1a3a;};'use strict';function Dynamics365Account(_0x54826a){this['id']=_0x54826a['id']||0x0;this[_0x78ee('0x0')]=_0x54826a[_0x78ee('0x0')]||'';this['username']=_0x54826a[_0x78ee('0x1')]||'';this['password']=_0x54826a[_0x78ee('0x2')]||'';this[_0x78ee('0x3')]=_0x54826a['remoteUri']||'';this[_0x78ee('0x4')]=_0x54826a[_0x78ee('0x4')]||'';this[_0x78ee('0x5')]=_0x54826a[_0x78ee('0x5')]||'';this[_0x78ee('0x6')]=_0x54826a['clientSecret']||{};this[_0x78ee('0x7')]=_0x54826a[_0x78ee('0x7')]||'';this[_0x78ee('0x8')]=_0x54826a['modernAuthentication']||![];this[_0x78ee('0x9')]=_0x54826a['Configurations']||{};this['CloudProvider']=_0x54826a[_0x78ee('0xa')]||{};}module[_0x78ee('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 0c1f785..3456db6 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 _0x1544=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x38806b,_0x2ec75a){var _0xb54dab=function(_0x1aef72){while(--_0x1aef72){_0x38806b['push'](_0x38806b['shift']());}};_0xb54dab(++_0x2ec75a);}(_0x1544,0x6a));var _0x4154=function(_0x311c35,_0x54a2b0){_0x311c35=_0x311c35-0x0;var _0x31ff65=_0x1544[_0x311c35];return _0x31ff65;};'use strict';function FaxAccount(_0x1a2af2){this['id']=_0x1a2af2['id']||0x0;this['name']=_0x1a2af2['name']||'';this[_0x4154('0x0')]=_0x1a2af2[_0x4154('0x0')];this[_0x4154('0x1')]=_0x1a2af2[_0x4154('0x1')];this[_0x4154('0x2')]=_0x1a2af2[_0x4154('0x2')];this[_0x4154('0x3')]=_0x1a2af2['localstationid'];this[_0x4154('0x4')]=_0x1a2af2[_0x4154('0x4')]||0x960;this[_0x4154('0x5')]=_0x1a2af2['maxrate']||0x3840;this[_0x4154('0x6')]=_0x1a2af2[_0x4154('0x6')]||_0x4154('0x7');this['gateway']=_0x1a2af2[_0x4154('0x8')]||'no';this[_0x4154('0x9')]=_0x1a2af2['faxdetect']||'no';this[_0x4154('0xa')]=_0x1a2af2[_0x4154('0xa')]||0x1388;this[_0x4154('0xb')]=_0x1a2af2[_0x4154('0xb')]||_0x4154('0xc');this['Trunk']=_0x1a2af2['Trunk']?_0x1a2af2[_0x4154('0xd')]:undefined;this[_0x4154('0xe')]=_0x1a2af2[_0x4154('0xe')];this[_0x4154('0xf')]=_0x1a2af2[_0x4154('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x4394=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','description'];(function(_0x17e7e0,_0x4248ee){var _0x886e37=function(_0x1c53d5){while(--_0x1c53d5){_0x17e7e0['push'](_0x17e7e0['shift']());}};_0x886e37(++_0x4248ee);}(_0x4394,0xdf));var _0x4439=function(_0x2e2104,_0x11287d){_0x2e2104=_0x2e2104-0x0;var _0x1280c5=_0x4394[_0x2e2104];return _0x1280c5;};'use strict';function FaxAccount(_0x1e6900){this['id']=_0x1e6900['id']||0x0;this['name']=_0x1e6900['name']||'';this[_0x4439('0x0')]=_0x1e6900[_0x4439('0x0')];this['ecm']=_0x1e6900[_0x4439('0x1')];this['headerinfo']=_0x1e6900[_0x4439('0x2')];this[_0x4439('0x3')]=_0x1e6900['localstationid'];this[_0x4439('0x4')]=_0x1e6900['minrate']||0x960;this['maxrate']=_0x1e6900[_0x4439('0x5')]||0x3840;this[_0x4439('0x6')]=_0x1e6900[_0x4439('0x6')]||_0x4439('0x7');this[_0x4439('0x8')]=_0x1e6900['gateway']||'no';this[_0x4439('0x9')]=_0x1e6900['faxdetect']||'no';this[_0x4439('0xa')]=_0x1e6900[_0x4439('0xa')]||0x1388;this[_0x4439('0xb')]=_0x1e6900['tech']||'SIP';this[_0x4439('0xc')]=_0x1e6900[_0x4439('0xc')]?_0x1e6900[_0x4439('0xc')]:undefined;this[_0x4439('0xd')]=_0x1e6900[_0x4439('0xd')];this[_0x4439('0xe')]=_0x1e6900['key'];}module[_0x4439('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index b85f01c..da4ecff 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 _0x6521=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3a026c,_0x28b94a){var _0x3d5874=function(_0x1b8741){while(--_0x1b8741){_0x3a026c['push'](_0x3a026c['shift']());}};_0x3d5874(++_0x28b94a);}(_0x6521,0x148));var _0x1652=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x6521[_0x368fb9];return _0x4892fb;};'use strict';function FreshdeskAccount(_0x453481){this['id']=_0x453481['id']||0x0;this['name']=_0x453481[_0x1652('0x0')]||'';this['username']=_0x453481['username']||'';this[_0x1652('0x1')]=_0x453481[_0x1652('0x2')]||'';this['remoteUri']=_0x453481[_0x1652('0x3')]||'';this[_0x1652('0x4')]=_0x453481[_0x1652('0x4')]||'';this[_0x1652('0x5')]=_0x453481[_0x1652('0x5')]||{};}module[_0x1652('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x2a4c=['Configurations','name','username','remoteUri','serverUrl'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2a4c,0x128));var _0xc2a4=function(_0x1a0475,_0x3e392a){_0x1a0475=_0x1a0475-0x0;var _0x449846=_0x2a4c[_0x1a0475];return _0x449846;};'use strict';function FreshdeskAccount(_0x15beeb){this['id']=_0x15beeb['id']||0x0;this[_0xc2a4('0x0')]=_0x15beeb[_0xc2a4('0x0')]||'';this[_0xc2a4('0x1')]=_0x15beeb[_0xc2a4('0x1')]||'';this['apiKey']=_0x15beeb['token']||'';this['remoteUri']=_0x15beeb[_0xc2a4('0x2')]||'';this[_0xc2a4('0x3')]=_0x15beeb['serverUrl']||'';this['Configurations']=_0x15beeb[_0xc2a4('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 28eb757..820314c 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 _0x34aa=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x300222,_0xe550ca){var _0x9eb6b8=function(_0x7a1f5f){while(--_0x7a1f5f){_0x300222['push'](_0x300222['shift']());}};_0x9eb6b8(++_0xe550ca);}(_0x34aa,0x171));var _0xa34a=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x34aa[_0x476bf4];return _0x788ffe;};'use strict';function FreshsalesAccount(_0x44376a){this['id']=_0x44376a['id']||0x0;this['name']=_0x44376a[_0xa34a('0x0')]||'';this[_0xa34a('0x1')]=_0x44376a[_0xa34a('0x1')]||'';this[_0xa34a('0x2')]=_0x44376a['token']||'';this[_0xa34a('0x3')]=_0x44376a[_0xa34a('0x3')]||'';this[_0xa34a('0x4')]=_0x44376a[_0xa34a('0x4')]||'';this[_0xa34a('0x5')]=_0x44376a[_0xa34a('0x5')]||{};}module[_0xa34a('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xd67b=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1ac674,_0x46c8f1){var _0x8d4afb=function(_0xc11334){while(--_0xc11334){_0x1ac674['push'](_0x1ac674['shift']());}};_0x8d4afb(++_0x46c8f1);}(_0xd67b,0x133));var _0xbd67=function(_0x2413ba,_0xc7e7a4){_0x2413ba=_0x2413ba-0x0;var _0x880f47=_0xd67b[_0x2413ba];return _0x880f47;};'use strict';function FreshsalesAccount(_0x1b2dbf){this['id']=_0x1b2dbf['id']||0x0;this[_0xbd67('0x0')]=_0x1b2dbf['name']||'';this[_0xbd67('0x1')]=_0x1b2dbf[_0xbd67('0x1')]||'';this[_0xbd67('0x2')]=_0x1b2dbf['token']||'';this[_0xbd67('0x3')]=_0x1b2dbf['remoteUri']||'';this[_0xbd67('0x4')]=_0x1b2dbf['serverUrl']||'';this[_0xbd67('0x5')]=_0x1b2dbf[_0xbd67('0x5')]||{};}module[_0xbd67('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 81d5dc2..ae28ab3 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 _0x5ec5=['queuecallerexit','queuecallerexitAt','connectedlinename','accountcode','exten','priority','holdtime','assigned','voice','routealias','mohtime','variables','exports','inbound','uniqueid','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x58fcd2,_0x5a0d4b){var _0x54e18c=function(_0x3a9010){while(--_0x3a9010){_0x58fcd2['push'](_0x58fcd2['shift']());}};_0x54e18c(++_0x5a0d4b);}(_0x5ec5,0x145));var _0x55ec=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5ec5[_0x53ccf2];return _0x5a2964;};'use strict';function QueueReport(){this['type']=_0x55ec('0x0');this[_0x55ec('0x1')]='';this['calleridnum']='';this[_0x55ec('0x2')]='';this[_0x55ec('0x3')]='';this['queuecallerjoinAt']=null;this[_0x55ec('0x4')]=null;this[_0x55ec('0x5')]=0x1;this[_0x55ec('0x6')]=0x1;this[_0x55ec('0x7')]=![];this[_0x55ec('0x8')]=null;this[_0x55ec('0x9')]=![];this[_0x55ec('0xa')]=null;this[_0x55ec('0xb')]=![];this[_0x55ec('0xc')]=null;this['originalposition']=0x1;this['channel']='';this['connectedlinenum']='';this[_0x55ec('0xd')]='';this[_0x55ec('0xe')]='';this['context']='';this[_0x55ec('0xf')]='';this[_0x55ec('0x10')]='';this[_0x55ec('0x11')]=0x0;this[_0x55ec('0x12')]=![];this['lastAssignedTo']='';this['motionChannel']=_0x55ec('0x13');this[_0x55ec('0x14')]=null;this[_0x55ec('0x15')]=0x0;this[_0x55ec('0x16')]={};}module[_0x55ec('0x17')]=QueueReport; \ No newline at end of file +var _0x864d=['originalposition','connectedlinenum','connectedlinename','accountcode','exten','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','exports','type','inbound','uniqueid','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt'];(function(_0x3f8776,_0x1e8140){var _0x3abaa4=function(_0x59c15f){while(--_0x59c15f){_0x3f8776['push'](_0x3f8776['shift']());}};_0x3abaa4(++_0x1e8140);}(_0x864d,0x120));var _0xd864=function(_0x362480,_0x73fcd1){_0x362480=_0x362480-0x0;var _0x1dd0ba=_0x864d[_0x362480];return _0x1dd0ba;};'use strict';function QueueReport(){this[_0xd864('0x0')]=_0xd864('0x1');this[_0xd864('0x2')]='';this['calleridnum']='';this[_0xd864('0x3')]='';this['queue']='';this[_0xd864('0x4')]=null;this[_0xd864('0x5')]=null;this[_0xd864('0x6')]=0x1;this[_0xd864('0x7')]=0x1;this[_0xd864('0x8')]=![];this[_0xd864('0x9')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0xd864('0xa')]=null;this[_0xd864('0xb')]=0x1;this['channel']='';this[_0xd864('0xc')]='';this[_0xd864('0xd')]='';this[_0xd864('0xe')]='';this['context']='';this[_0xd864('0xf')]='';this['priority']='';this[_0xd864('0x10')]=0x0;this[_0xd864('0x11')]=![];this[_0xd864('0x12')]='';this[_0xd864('0x13')]=_0xd864('0x14');this[_0xd864('0x15')]=null;this['mohtime']=0x0;this['variables']={};}module[_0xd864('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 8b3bcfb..fb8a5ab 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 _0x5a2f=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations'];(function(_0xff9be1,_0x30d47b){var _0x39f69f=function(_0x26585b){while(--_0x26585b){_0xff9be1['push'](_0xff9be1['shift']());}};_0x39f69f(++_0x30d47b);}(_0x5a2f,0x9b));var _0xf5a2=function(_0x51aac4,_0xd08103){_0x51aac4=_0x51aac4-0x0;var _0x55c110=_0x5a2f[_0x51aac4];return _0x55c110;};'use strict';function SalesforceAccount(_0x10cf16){this['id']=_0x10cf16['id']||0x0;this[_0xf5a2('0x0')]=_0x10cf16['name']||'';this[_0xf5a2('0x1')]=_0x10cf16[_0xf5a2('0x1')]||'';this['remoteUri']=_0x10cf16[_0xf5a2('0x2')]||'';this['password']=_0x10cf16[_0xf5a2('0x3')]||'';this['clientId']=_0x10cf16[_0xf5a2('0x4')]||'';this['clientSecret']=_0x10cf16[_0xf5a2('0x5')]||'';this[_0xf5a2('0x6')]=_0x10cf16[_0xf5a2('0x6')]||'';this['type']=_0x10cf16[_0xf5a2('0x7')]||'integrationTab';this['serverUrl']=_0x10cf16[_0xf5a2('0x8')]||'';this[_0xf5a2('0x9')]=_0x10cf16[_0xf5a2('0x9')]||{};}module[_0xf5a2('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x72e4=['securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x3d0184,_0x5d4bab){var _0x530ef0=function(_0x29fed7){while(--_0x29fed7){_0x3d0184['push'](_0x3d0184['shift']());}};_0x530ef0(++_0x5d4bab);}(_0x72e4,0xae));var _0x472e=function(_0x3abe74,_0x57faaa){_0x3abe74=_0x3abe74-0x0;var _0xb0deee=_0x72e4[_0x3abe74];return _0xb0deee;};'use strict';function SalesforceAccount(_0x4991f8){this['id']=_0x4991f8['id']||0x0;this[_0x472e('0x0')]=_0x4991f8[_0x472e('0x0')]||'';this[_0x472e('0x1')]=_0x4991f8['username']||'';this[_0x472e('0x2')]=_0x4991f8['remoteUri']||'';this['password']=_0x4991f8[_0x472e('0x3')]||'';this['clientId']=_0x4991f8[_0x472e('0x4')]||'';this[_0x472e('0x5')]=_0x4991f8[_0x472e('0x5')]||'';this['securityToken']=_0x4991f8[_0x472e('0x6')]||'';this[_0x472e('0x7')]=_0x4991f8['type']||_0x472e('0x8');this[_0x472e('0x9')]=_0x4991f8[_0x472e('0x9')]||'';this['Configurations']=_0x4991f8[_0x472e('0xa')]||{};}module[_0x472e('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 3981dc0..bc1edc9 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 _0xa4d2=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xa4d2,0x1dd));var _0x2a4d=function(_0x394014,_0x668229){_0x394014=_0x394014-0x0;var _0x94efd9=_0xa4d2[_0x394014];return _0x94efd9;};'use strict';function ServicenowAccount(_0x366915){this['id']=_0x366915['id']||0x0;this['name']=_0x366915[_0x2a4d('0x0')]||'';this[_0x2a4d('0x1')]=_0x366915[_0x2a4d('0x1')]||'';this[_0x2a4d('0x2')]=_0x366915[_0x2a4d('0x2')]||'';this[_0x2a4d('0x3')]=_0x366915['remoteUri']||'';this[_0x2a4d('0x4')]=_0x366915[_0x2a4d('0x4')]||'';this[_0x2a4d('0x5')]=_0x366915['Configurations']||{};}module[_0x2a4d('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xc7bc=['password','remoteUri','serverUrl','name','username'];(function(_0x47666d,_0x2f374a){var _0x584e96=function(_0x535c5e){while(--_0x535c5e){_0x47666d['push'](_0x47666d['shift']());}};_0x584e96(++_0x2f374a);}(_0xc7bc,0x116));var _0xcc7b=function(_0x52b408,_0x22fe7e){_0x52b408=_0x52b408-0x0;var _0x403deb=_0xc7bc[_0x52b408];return _0x403deb;};'use strict';function ServicenowAccount(_0x3603db){this['id']=_0x3603db['id']||0x0;this[_0xcc7b('0x0')]=_0x3603db[_0xcc7b('0x0')]||'';this[_0xcc7b('0x1')]=_0x3603db[_0xcc7b('0x1')]||'';this[_0xcc7b('0x2')]=_0x3603db[_0xcc7b('0x2')]||'';this['remoteUri']=_0x3603db[_0xcc7b('0x3')]||'';this['serverUrl']=_0x3603db[_0xcc7b('0x4')]||'';this['Configurations']=_0x3603db['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 12cd0be..fcd824a 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 _0x50e6=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x50e6,0x1a8));var _0x650e=function(_0x4daf5e,_0x5ce9a3){_0x4daf5e=_0x4daf5e-0x0;var _0x1a02fd=_0x50e6[_0x4daf5e];return _0x1a02fd;};'use strict';function SugarcrmAccount(_0x50e239){this['id']=_0x50e239['id']||0x0;this['name']=_0x50e239[_0x650e('0x0')]||'';this[_0x650e('0x1')]=_0x50e239[_0x650e('0x1')]||'';this[_0x650e('0x2')]=_0x50e239['password']||'';this[_0x650e('0x3')]=_0x50e239[_0x650e('0x3')]||'';this[_0x650e('0x4')]=_0x50e239['serverUrl']||'';this[_0x650e('0x5')]=_0x50e239[_0x650e('0x5')]||{};}module[_0x650e('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xf46d=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x386812,_0x27c823){var _0x4704d2=function(_0x513971){while(--_0x513971){_0x386812['push'](_0x386812['shift']());}};_0x4704d2(++_0x27c823);}(_0xf46d,0x1c3));var _0xdf46=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xf46d[_0x3e6d5d];return _0x238923;};'use strict';function SugarcrmAccount(_0x2c93cb){this['id']=_0x2c93cb['id']||0x0;this[_0xdf46('0x0')]=_0x2c93cb['name']||'';this[_0xdf46('0x1')]=_0x2c93cb[_0xdf46('0x1')]||'';this['password']=_0x2c93cb['password']||'';this[_0xdf46('0x2')]=_0x2c93cb[_0xdf46('0x2')]||'';this['serverUrl']=_0x2c93cb[_0xdf46('0x3')]||'';this[_0xdf46('0x4')]=_0x2c93cb[_0xdf46('0x4')]||{};}module[_0xdf46('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index c687fe3..8364b77 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 _0xfbb4=['state','unknown','stateTime','address','exports','name','accountcode'];(function(_0x5ea00e,_0x3ad1df){var _0x3a747b=function(_0x4a65e8){while(--_0x4a65e8){_0x5ea00e['push'](_0x5ea00e['shift']());}};_0x3a747b(++_0x3ad1df);}(_0xfbb4,0x186));var _0x4fbb=function(_0x3a79bf,_0x220241){_0x3a79bf=_0x3a79bf-0x0;var _0x22c467=_0xfbb4[_0x3a79bf];return _0x22c467;};'use strict';function Telephone(_0x1e68a7){this['id']=_0x1e68a7['id']||0x0;this[_0x4fbb('0x0')]=_0x1e68a7[_0x4fbb('0x0')]||'';this[_0x4fbb('0x1')]=_0x1e68a7[_0x4fbb('0x1')]||'';this[_0x4fbb('0x2')]=_0x4fbb('0x3');this[_0x4fbb('0x4')]=0x0;this['status']='unknown';this[_0x4fbb('0x5')]='';}module[_0x4fbb('0x6')]=Telephone; \ No newline at end of file +var _0xf630=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf630,0xf0));var _0x0f63=function(_0x545d44,_0x405d26){_0x545d44=_0x545d44-0x0;var _0x2492d8=_0xf630[_0x545d44];return _0x2492d8;};'use strict';function Telephone(_0xe0b951){this['id']=_0xe0b951['id']||0x0;this[_0x0f63('0x0')]=_0xe0b951[_0x0f63('0x0')]||'';this[_0x0f63('0x1')]=_0xe0b951[_0x0f63('0x1')]||'';this[_0x0f63('0x2')]=_0x0f63('0x3');this[_0x0f63('0x4')]=0x0;this[_0x0f63('0x5')]=_0x0f63('0x3');this[_0x0f63('0x6')]='';}module[_0x0f63('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 859a8bf..df5a372 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 _0xa9e0=['exports','name'];(function(_0x28d8da,_0x498365){var _0x5ed934=function(_0x2a25c8){while(--_0x2a25c8){_0x28d8da['push'](_0x28d8da['shift']());}};_0x5ed934(++_0x498365);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 +var _0xb10b=['name','html'];(function(_0x1b77c0,_0xad4ba){var _0x499179=function(_0x4227f2){while(--_0x4227f2){_0x1b77c0['push'](_0x1b77c0['shift']());}};_0x499179(++_0xad4ba);}(_0xb10b,0x12a));var _0xbb10=function(_0xb4fe2c,_0x3d2be6){_0xb4fe2c=_0xb4fe2c-0x0;var _0x460a1a=_0xb10b[_0xb4fe2c];return _0x460a1a;};'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 diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 92d8354..e6da2ae 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 _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x366783,_0x339fd8){var _0x3562b7=function(_0x29b013){while(--_0x29b013){_0x366783['push'](_0x366783['shift']());}};_0x3562b7(++_0x339fd8);}(_0x4fc2,0x111));var _0x24fc=function(_0x369a70,_0x47e279){_0x369a70=_0x369a70-0x0;var _0x571fe2=_0x4fc2[_0x369a70];return _0x571fe2;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x588a05,_0x3755ad){var _0x4c126e=function(_0x5cdcd2){while(--_0x5cdcd2){_0x588a05['push'](_0x588a05['shift']());}};_0x4c126e(++_0x3755ad);}(_0xda3f,0xec));var _0xfda3=function(_0x35cd0c,_0x37fc61){_0x35cd0c=_0x35cd0c-0x0;var _0xef69bb=_0xda3f[_0x35cd0c];return _0xef69bb;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['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 57a8e41..9aee069 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 _0xee2f=['registry','indexOf','split','port','domainport','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','stateTime','status','unknown'];(function(_0x29dda5,_0x3d7378){var _0x22c118=function(_0x29a430){while(--_0x29a430){_0x29dda5['push'](_0x29dda5['shift']());}};_0x22c118(++_0x3d7378);}(_0xee2f,0x1ba));var _0xfee2=function(_0x399d17,_0x1cdf27){_0x399d17=_0x399d17-0x0;var _0x4f4213=_0xee2f[_0x399d17];return _0x4f4213;};'use strict';function Trunk(_0x47f354){this['id']=_0x47f354['id']||0x0;this[_0xfee2('0x0')]=_0x47f354[_0xfee2('0x0')]||![];this[_0xfee2('0x1')]=_0x47f354[_0xfee2('0x1')]||'';this[_0xfee2('0x2')]='unknown';this[_0xfee2('0x3')]=0x0;this[_0xfee2('0x4')]=_0xfee2('0x5');this[_0xfee2('0x6')]=_0x47f354[_0xfee2('0x6')]&&_0x47f354['registry'][_0xfee2('0x7')](':')?_0x47f354[_0xfee2('0x6')][_0xfee2('0x8')](':')[0x0]:'';this['host']='';this[_0xfee2('0x9')]='';this['domain']='';this[_0xfee2('0xa')]='';this['refresh']='';this[_0xfee2('0xb')]='unknown';this[_0xfee2('0xc')]='';this[_0xfee2('0xd')]='';this[_0xfee2('0xe')]=_0x47f354[_0xfee2('0xe')]||'';}module[_0xfee2('0xf')]=Trunk; \ No newline at end of file +var _0xffc5=['address','defaultuser','exports','active','name','unknown','stateTime','status','registry','port','domain','stateRegistry','registrationtime'];(function(_0x16e73a,_0x146629){var _0x187aa1=function(_0x26eb2f){while(--_0x26eb2f){_0x16e73a['push'](_0x16e73a['shift']());}};_0x187aa1(++_0x146629);}(_0xffc5,0x196));var _0x5ffc=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xffc5[_0x117f4c];return _0x2b24e9;};'use strict';function Trunk(_0xde4352){this['id']=_0xde4352['id']||0x0;this[_0x5ffc('0x0')]=_0xde4352[_0x5ffc('0x0')]||![];this[_0x5ffc('0x1')]=_0xde4352[_0x5ffc('0x1')]||'';this['state']=_0x5ffc('0x2');this[_0x5ffc('0x3')]=0x0;this[_0x5ffc('0x4')]='unknown';this[_0x5ffc('0x5')]=_0xde4352[_0x5ffc('0x5')]&&_0xde4352[_0x5ffc('0x5')]['indexOf'](':')?_0xde4352[_0x5ffc('0x5')]['split'](':')[0x0]:'';this['host']='';this[_0x5ffc('0x6')]='';this[_0x5ffc('0x7')]='';this['domainport']='';this['refresh']='';this[_0x5ffc('0x8')]=_0x5ffc('0x2');this[_0x5ffc('0x9')]='';this[_0x5ffc('0xa')]='';this[_0x5ffc('0xb')]=_0xde4352[_0x5ffc('0xb')]||'';}module[_0x5ffc('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 4370548..804eb33 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 _0x6d7f=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x4914a1,_0x359dd8){var _0x3d5c6f=function(_0x33ed14){while(--_0x33ed14){_0x4914a1['push'](_0x4914a1['shift']());}};_0x3d5c6f(++_0x359dd8);}(_0x6d7f,0xda));var _0xf6d7=function(_0x2d3f6e,_0xaba274){_0x2d3f6e=_0x2d3f6e-0x0;var _0x313aa0=_0x6d7f[_0x2d3f6e];return _0x313aa0;};'use strict';function voiceExtension(_0x1637bb){this['id']=_0x1637bb['id']||0x0;this[_0xf6d7('0x0')]=_0x1637bb[_0xf6d7('0x0')]||'';this[_0xf6d7('0x1')]=_0x1637bb[_0xf6d7('0x1')]||_0xf6d7('0x2');this[_0xf6d7('0x3')]=_0x1637bb['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x7ff6=['recordingFormat','mandatoryDisposition','exten'];(function(_0x494f4d,_0x2807fa){var _0x3e7dfc=function(_0x14f2d2){while(--_0x14f2d2){_0x494f4d['push'](_0x494f4d['shift']());}};_0x3e7dfc(++_0x2807fa);}(_0x7ff6,0x11f));var _0x67ff=function(_0x3e38d0,_0x5d4616){_0x3e38d0=_0x3e38d0-0x0;var _0x317cd5=_0x7ff6[_0x3e38d0];return _0x317cd5;};'use strict';function voiceExtension(_0x247fdd){this['id']=_0x247fdd['id']||0x0;this['exten']=_0x247fdd[_0x67ff('0x0')]||'';this[_0x67ff('0x1')]=_0x247fdd[_0x67ff('0x1')]||'none';this[_0x67ff('0x2')]=_0x247fdd[_0x67ff('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 961cea4..8a0a28c 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 _0x3c74=['predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','random','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','notInUse','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3c74,0x9f));var _0x43c7=function(_0x40f29b,_0x363d95){_0x40f29b=_0x40f29b-0x0;var _0x3afd9d=_0x3c74[_0x40f29b];return _0x3afd9d;};'use strict';var monitorFormat={'wav':_0x43c7('0x0'),'wav49':_0x43c7('0x1'),'gsm':_0x43c7('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':'leastrecent','linear':'linear','random':_0x43c7('0x3'),'ringall':'ringall','rr':_0x43c7('0x4'),'rrmemory':_0x43c7('0x5'),'rrordered':_0x43c7('0x6'),'wrandom':_0x43c7('0x7')};function VoiceQueue(_0x535413){this['id']=_0x535413['id']||0x0;this[_0x43c7('0x8')]=_0x535413['name']||'';this[_0x43c7('0x9')]=_0x535413[_0x43c7('0x9')]||'';this[_0x43c7('0xa')]=_0x535413[_0x43c7('0xa')]||_0x43c7('0xb');this[_0x43c7('0xc')]=0x0;this[_0x43c7('0xd')]=0x0;this[_0x43c7('0xe')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x43c7('0xf')]=0x0;this[_0x43c7('0x10')]=0x0;this[_0x43c7('0x11')]=0x0;this[_0x43c7('0x12')]=0x0;this[_0x43c7('0x13')]=0x0;this[_0x43c7('0x14')]=0x0;this['invalid']=0x0;this[_0x43c7('0x15')]=0x0;this[_0x43c7('0x16')]=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0x43c7('0x17')]=0x0;this[_0x43c7('0x18')]=0x0;this[_0x43c7('0x19')]=0x0;this[_0x43c7('0x1a')]=0x0;this[_0x43c7('0x1b')]=0x0;this['acw']=_0x535413[_0x43c7('0x1c')]||![];this[_0x43c7('0x1d')]=_0x535413[_0x43c7('0x1d')]||0xa;this['autopause']=_0x535413[_0x43c7('0x1e')]||'no';this[_0x43c7('0x1f')]=!![];this[_0x43c7('0x20')]='';this[_0x43c7('0x21')]='';this[_0x43c7('0x22')]=0x0;this[_0x43c7('0x23')]=0x0;this[_0x43c7('0x24')]=_0x535413[_0x43c7('0x24')]||null;this[_0x43c7('0x25')]=_0x535413[_0x43c7('0x25')]?_0x535413[_0x43c7('0x25')]:null;this['dialActive']=_0x535413[_0x43c7('0x26')];this[_0x43c7('0x27')]=_0x535413[_0x43c7('0x27')]||_0x43c7('0x28');this[_0x43c7('0x29')]=_0x535413[_0x43c7('0x29')]||0x0;this[_0x43c7('0x2a')]=_0x535413[_0x43c7('0x2a')]||0x0;this['dialPowerLevel']=_0x535413[_0x43c7('0x2b')]||0x1;this['dialPredictiveOptimization']=_0x535413[_0x43c7('0x2c')]||_0x43c7('0x2d');this[_0x43c7('0x2e')]=_0x535413[_0x43c7('0x2e')]||0.03;this['dialPredictiveInterval']=_0x535413[_0x43c7('0x2f')]||0x258;this[_0x43c7('0x30')]=_0x535413[_0x43c7('0x30')]||_0x43c7('0x31');this[_0x43c7('0x32')]=_0x535413[_0x43c7('0x32')]||_0x43c7('0x31');this[_0x43c7('0x33')]=_0x535413[_0x43c7('0x33')]||0x1e;this['dialQueueOptions']=_0x535413[_0x43c7('0x34')]||'tTxX';this[_0x43c7('0x35')]=_0x535413[_0x43c7('0x35')]||0x3;this[_0x43c7('0x36')]=_0x535413[_0x43c7('0x36')]||undefined;this['dialCongestionMaxRetry']=_0x535413[_0x43c7('0x37')]||0x3;this[_0x43c7('0x38')]=_0x535413[_0x43c7('0x38')]||0x96;this[_0x43c7('0x39')]=_0x535413[_0x43c7('0x39')]||0x3;this[_0x43c7('0x3a')]=_0x535413[_0x43c7('0x3a')]||0x96;this[_0x43c7('0x3b')]=_0x535413[_0x43c7('0x3b')]||0x3;this[_0x43c7('0x3c')]=_0x535413['dialNoAnswerRetryFrequency']||0x96;this[_0x43c7('0x3d')]=_0x535413[_0x43c7('0x3d')]||0x3;this[_0x43c7('0x3e')]=_0x535413['dialNoSuchNumberRetryFrequency']||0x96;this[_0x43c7('0x3f')]=_0x535413[_0x43c7('0x3f')]||0x3;this[_0x43c7('0x40')]=_0x535413[_0x43c7('0x40')]||0x96;this[_0x43c7('0x41')]=_0x535413[_0x43c7('0x41')]||0x3;this[_0x43c7('0x42')]=_0x535413[_0x43c7('0x42')]||0x96;this['dialMachineMaxRetry']=_0x535413[_0x43c7('0x43')]||0x3;this[_0x43c7('0x44')]=_0x535413[_0x43c7('0x44')]||0x96;this[_0x43c7('0x45')]=_0x535413[_0x43c7('0x45')]||0x3;this[_0x43c7('0x46')]=_0x535413[_0x43c7('0x46')]||0x96;this[_0x43c7('0x47')]=_0x535413['callAdditionalPhoneAfterMin']||0x3;this[_0x43c7('0x48')]=_0x535413['dialGlobalMaxRetry']||0x4;this[_0x43c7('0x49')]=_0x535413[_0x43c7('0x49')]?_0x535413[_0x43c7('0x49')]:undefined;this[_0x43c7('0x4a')]=_0x535413[_0x43c7('0x4a')]?_0x535413[_0x43c7('0x4a')]:undefined;this[_0x43c7('0x4b')]=_0x535413[_0x43c7('0x4b')]||undefined;this['Interval']=_0x535413[_0x43c7('0x4c')]?_0x535413['Interval']:undefined;this[_0x43c7('0x4d')]=_0x535413[_0x43c7('0x4d')]||_0x43c7('0x4e');this[_0x43c7('0x4f')]=_0x535413[_0x43c7('0x4f')]||undefined;this[_0x43c7('0x50')]=_0x535413['dialCutDigit']||undefined;this['strategy']=strategy[_0x535413[_0x43c7('0x51')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x535413['dialAMDActive']||![];this[_0x43c7('0x52')]=_0x535413[_0x43c7('0x52')];this[_0x43c7('0x53')]=_0x535413[_0x43c7('0x53')];this[_0x43c7('0x54')]=_0x535413[_0x43c7('0x54')];this['dialAMDTotalAnalysisTime']=_0x535413[_0x43c7('0x55')];this[_0x43c7('0x56')]=_0x535413[_0x43c7('0x56')];this[_0x43c7('0x57')]=_0x535413[_0x43c7('0x57')];this[_0x43c7('0x58')]=_0x535413['dialAMDMaximumNumberOfWords'];this[_0x43c7('0x59')]=_0x535413[_0x43c7('0x59')];this['dialAMDMaximumWordLength']=_0x535413[_0x43c7('0x5a')];this[_0x43c7('0x5b')]=0x0;this['pTalking']=0x0;this[_0x43c7('0x5c')]=_0x535413['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x43c7('0x5d')]=0x0;this[_0x43c7('0x5e')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x43c7('0x5f')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x43c7('0x60')]=0x0;this[_0x43c7('0x61')]=0x0;this[_0x43c7('0x62')]=0x0;this[_0x43c7('0x63')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x43c7('0x64')]=0x0;this[_0x43c7('0x65')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x43c7('0x66')]=undefined;this['startPredictive']=undefined;this[_0x43c7('0x67')]=undefined;this[_0x43c7('0x68')]=1.05;this[_0x43c7('0x69')]=0x0;this[_0x43c7('0x6a')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x43c7('0x6b')]=0x0;this[_0x43c7('0x6c')]=0x0;this[_0x43c7('0x6d')]=0x0;this[_0x43c7('0x6e')]=0x0;this[_0x43c7('0x6f')]=0x0;this[_0x43c7('0x70')]=_0x535413[_0x43c7('0x71')]||0x14;this[_0x43c7('0x72')]=_0x535413[_0x43c7('0x71')]||0xa;this[_0x43c7('0x73')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x43c7('0x74')]=0x1;this[_0x43c7('0x75')]=0x0;this[_0x43c7('0x76')]=0x0;this[_0x43c7('0x77')]=0x0;this[_0x43c7('0x78')]=0x0;this['dialRecallMeTimeout']=_0x535413[_0x43c7('0x79')]||0x1e;this[_0x43c7('0x7a')]=_0x535413[_0x43c7('0x7a')]||![];this[_0x43c7('0x7b')]=!!_0x535413[_0x43c7('0x7b')]||![];this[_0x43c7('0x7c')]=!!_0x535413[_0x43c7('0x7c')]||![];this[_0x43c7('0x7d')]=_0x535413['dialQueueProject2']||undefined;this[_0x43c7('0x7e')]=_0x535413[_0x43c7('0x7e')]||![];this['dialAgiAfterHangupAgent']=_0x535413[_0x43c7('0x7f')]||![];this['monitor_format']=monitorFormat[_0x535413[_0x43c7('0x9')]]?monitorFormat[_0x535413['monitor_format']]:undefined;this[_0x43c7('0x80')]=_0x535413[_0x43c7('0x80')]||![];this[_0x43c7('0x81')]=_0x535413['mandatoryDispositionPause']?_0x535413[_0x43c7('0x81')]:undefined;this[_0x43c7('0x82')]=![];}module[_0x43c7('0x83')]=VoiceQueue; \ No newline at end of file +var _0x2bfb=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','wav','gsm','fewestcalls','leastrecent','linear','random','ringall','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','unmanaged','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay'];(function(_0x37ac2d,_0x34bfa8){var _0x2ab66f=function(_0x328327){while(--_0x328327){_0x37ac2d['push'](_0x37ac2d['shift']());}};_0x2ab66f(++_0x34bfa8);}(_0x2bfb,0x109));var _0xb2bf=function(_0x2b29a0,_0x1d2efd){_0x2b29a0=_0x2b29a0-0x0;var _0x79cee4=_0x2bfb[_0x2b29a0];return _0x79cee4;};'use strict';var monitorFormat={'wav':_0xb2bf('0x0'),'wav49':'wav49','gsm':_0xb2bf('0x1')};var strategy={'fewestcalls':_0xb2bf('0x2'),'leastrecent':_0xb2bf('0x3'),'linear':_0xb2bf('0x4'),'random':_0xb2bf('0x5'),'ringall':_0xb2bf('0x6'),'rr':'roundrobin','rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0xb2bf('0x7')};function VoiceQueue(_0x3033a8){this['id']=_0x3033a8['id']||0x0;this[_0xb2bf('0x8')]=_0x3033a8[_0xb2bf('0x8')]||'';this[_0xb2bf('0x9')]=_0x3033a8['monitor_format']||'';this[_0xb2bf('0xa')]=_0x3033a8['type']||_0xb2bf('0xb');this[_0xb2bf('0xc')]=0x0;this[_0xb2bf('0xd')]=0x0;this[_0xb2bf('0xe')]=0x0;this[_0xb2bf('0xf')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0xb2bf('0x10')]=0x0;this['abandoned']=0x0;this['available']=0x0;this[_0xb2bf('0x11')]=0x0;this[_0xb2bf('0x12')]=0x0;this[_0xb2bf('0x13')]=0x0;this[_0xb2bf('0x14')]=0x0;this[_0xb2bf('0x15')]=0x0;this[_0xb2bf('0x16')]=0x0;this[_0xb2bf('0x17')]=0x0;this[_0xb2bf('0x18')]=0x0;this[_0xb2bf('0x19')]=0x0;this[_0xb2bf('0x1a')]=0x0;this[_0xb2bf('0x1b')]=0x0;this[_0xb2bf('0x1c')]=0x0;this[_0xb2bf('0x1d')]=_0x3033a8[_0xb2bf('0x1d')]||![];this[_0xb2bf('0x1e')]=_0x3033a8[_0xb2bf('0x1e')]||0xa;this[_0xb2bf('0x1f')]=_0x3033a8[_0xb2bf('0x1f')]||'no';this[_0xb2bf('0x20')]=!![];this[_0xb2bf('0x21')]='';this[_0xb2bf('0x22')]='';this[_0xb2bf('0x23')]=0x0;this[_0xb2bf('0x24')]=0x0;this[_0xb2bf('0x25')]=_0x3033a8[_0xb2bf('0x25')]||null;this[_0xb2bf('0x26')]=_0x3033a8['dialGlobalInterval']?_0x3033a8[_0xb2bf('0x26')]:null;this[_0xb2bf('0x27')]=_0x3033a8[_0xb2bf('0x27')];this[_0xb2bf('0x28')]=_0x3033a8['dialMethod']||_0xb2bf('0x29');this[_0xb2bf('0x2a')]=_0x3033a8[_0xb2bf('0x2a')]||0x0;this['dialLimitQueue']=_0x3033a8[_0xb2bf('0x2b')]||0x0;this[_0xb2bf('0x2c')]=_0x3033a8[_0xb2bf('0x2c')]||0x1;this['dialPredictiveOptimization']=_0x3033a8[_0xb2bf('0x2d')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x3033a8[_0xb2bf('0x2e')]||0.03;this[_0xb2bf('0x2f')]=_0x3033a8[_0xb2bf('0x2f')]||0x258;this[_0xb2bf('0x30')]=_0x3033a8[_0xb2bf('0x30')]||_0xb2bf('0x31');this['dialOriginateCallerIdNumber']=_0x3033a8[_0xb2bf('0x32')]||'anonymous';this['dialOriginateTimeout']=_0x3033a8[_0xb2bf('0x33')]||0x1e;this[_0xb2bf('0x34')]=_0x3033a8['dialQueueOptions']||_0xb2bf('0x35');this[_0xb2bf('0x36')]=_0x3033a8['dialQueueTimeout']||0x3;this[_0xb2bf('0x37')]=_0x3033a8[_0xb2bf('0x37')]||undefined;this['dialCongestionMaxRetry']=_0x3033a8[_0xb2bf('0x38')]||0x3;this[_0xb2bf('0x39')]=_0x3033a8[_0xb2bf('0x39')]||0x96;this[_0xb2bf('0x3a')]=_0x3033a8['dialBusyMaxRetry']||0x3;this[_0xb2bf('0x3b')]=_0x3033a8['dialBusyRetryFrequency']||0x96;this[_0xb2bf('0x3c')]=_0x3033a8['dialNoAnswerMaxRetry']||0x3;this[_0xb2bf('0x3d')]=_0x3033a8[_0xb2bf('0x3d')]||0x96;this[_0xb2bf('0x3e')]=_0x3033a8['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3033a8[_0xb2bf('0x3f')]||0x96;this['dialDropMaxRetry']=_0x3033a8[_0xb2bf('0x40')]||0x3;this[_0xb2bf('0x41')]=_0x3033a8[_0xb2bf('0x41')]||0x96;this[_0xb2bf('0x42')]=_0x3033a8['dialAbandonedMaxRetry']||0x3;this[_0xb2bf('0x43')]=_0x3033a8[_0xb2bf('0x43')]||0x96;this[_0xb2bf('0x44')]=_0x3033a8[_0xb2bf('0x44')]||0x3;this[_0xb2bf('0x45')]=_0x3033a8[_0xb2bf('0x45')]||0x96;this[_0xb2bf('0x46')]=_0x3033a8[_0xb2bf('0x46')]||0x3;this[_0xb2bf('0x47')]=_0x3033a8[_0xb2bf('0x47')]||0x96;this[_0xb2bf('0x48')]=_0x3033a8['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x3033a8[_0xb2bf('0x49')]||0x4;this[_0xb2bf('0x4a')]=_0x3033a8[_0xb2bf('0x4a')]?_0x3033a8['Trunk']:undefined;this[_0xb2bf('0x4b')]=_0x3033a8[_0xb2bf('0x4b')]?_0x3033a8[_0xb2bf('0x4b')]:undefined;this[_0xb2bf('0x4c')]=_0x3033a8[_0xb2bf('0x4c')]||undefined;this[_0xb2bf('0x4d')]=_0x3033a8[_0xb2bf('0x4d')]?_0x3033a8[_0xb2bf('0x4d')]:undefined;this[_0xb2bf('0x4e')]=_0x3033a8[_0xb2bf('0x4e')]||_0xb2bf('0x4f');this[_0xb2bf('0x50')]=_0x3033a8[_0xb2bf('0x50')]||undefined;this['dialCutDigit']=_0x3033a8['dialCutDigit']||undefined;this[_0xb2bf('0x51')]=strategy[_0x3033a8[_0xb2bf('0x51')]];this[_0xb2bf('0x52')]=!![];this['dialAMDActive']=_0x3033a8['dialAMDActive']||![];this[_0xb2bf('0x53')]=_0x3033a8[_0xb2bf('0x53')];this[_0xb2bf('0x54')]=_0x3033a8[_0xb2bf('0x54')];this[_0xb2bf('0x55')]=_0x3033a8[_0xb2bf('0x55')];this[_0xb2bf('0x56')]=_0x3033a8[_0xb2bf('0x56')];this['dialAMDMinWordLength']=_0x3033a8[_0xb2bf('0x57')];this[_0xb2bf('0x58')]=_0x3033a8[_0xb2bf('0x58')];this[_0xb2bf('0x59')]=_0x3033a8[_0xb2bf('0x59')];this[_0xb2bf('0x5a')]=_0x3033a8[_0xb2bf('0x5a')];this[_0xb2bf('0x5b')]=_0x3033a8['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this['timeout']=_0x3033a8[_0xb2bf('0x5c')];this['outboundAnswerCallsDay']=0x0;this[_0xb2bf('0x5d')]=0x0;this[_0xb2bf('0x5e')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xb2bf('0x5f')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xb2bf('0x60')]=0x0;this[_0xb2bf('0x61')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xb2bf('0x62')]=0x0;this[_0xb2bf('0x63')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xb2bf('0x64')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0xb2bf('0x65')]=undefined;this[_0xb2bf('0x66')]=undefined;this[_0xb2bf('0x67')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xb2bf('0x68')]=0x0;this[_0xb2bf('0x69')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xb2bf('0x6a')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xb2bf('0x6b')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xb2bf('0x6c')]=_0x3033a8['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xb2bf('0x6d')]=_0x3033a8['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xb2bf('0x6e')]=0x0;this[_0xb2bf('0x6f')]=0x0;this[_0xb2bf('0x70')]=0x0;this['erlangBusyFactor']=0x0;this[_0xb2bf('0x71')]=_0x3033a8['dialRecallMeTimeout']||0x1e;this[_0xb2bf('0x72')]=_0x3033a8[_0xb2bf('0x72')]||![];this['dialPreviewAutoRecallMe']=!!_0x3033a8['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x3033a8[_0xb2bf('0x73')]||![];this['dialQueueProject2']=_0x3033a8[_0xb2bf('0x74')]||undefined;this['dialAgiAfterHangupClient']=_0x3033a8[_0xb2bf('0x75')]||![];this[_0xb2bf('0x76')]=_0x3033a8[_0xb2bf('0x76')]||![];this[_0xb2bf('0x9')]=monitorFormat[_0x3033a8['monitor_format']]?monitorFormat[_0x3033a8[_0xb2bf('0x9')]]:undefined;this['mandatoryDisposition']=_0x3033a8[_0xb2bf('0x77')]||![];this['mandatoryDispositionPause']=_0x3033a8[_0xb2bf('0x78')]?_0x3033a8[_0xb2bf('0x78')]:undefined;this['queueSummaryCountersUpdated']=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 7aa2d11..7fc72bb 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1939=['prototype','createReport','loggedin','callers','SIP/','incall','includes','status','dialMethod','booked','keys','length','queue','dialer','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','outboundAbandonedCallsDay','preview','available','loggedInDb','paused','ringing','waiting','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','total','name','strategy','abandoned','busy','invalid','loggedIn','onHold','notInUse','ringInUse','sumBillable','sumDuration','sumHoldTime','talking','type','unavailable','unknown','unmanaged','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid'];(function(_0x3056cf,_0x5ba4bf){var _0x505963=function(_0xf8933c){while(--_0xf8933c){_0x3056cf['push'](_0x3056cf['shift']());}};_0x505963(++_0x5ba4bf);}(_0x1939,0x1d1));var _0x9193=function(_0x338442,_0x1974d1){_0x338442=_0x338442-0x0;var _0x11179b=_0x1939[_0x338442];return _0x11179b;};'use strict';var INBOUND_COUNTERS=[_0x9193('0x0'),'loggedIn',_0x9193('0x1'),_0x9193('0x2'),_0x9193('0x3'),'talking',_0x9193('0x4')];var OUTBOUND_COUNTERS=[_0x9193('0x0'),_0x9193('0x5'),_0x9193('0x6'),'loggedIn',_0x9193('0x1'),_0x9193('0x7'),'outboundAbandonedCallsDay',_0x9193('0x8'),_0x9193('0x9'),_0x9193('0xa'),_0x9193('0xb'),_0x9193('0xc'),'outboundNoSuchCallsDay',_0x9193('0xd'),_0x9193('0xe'),_0x9193('0xf'),_0x9193('0x2'),_0x9193('0x10'),'talking','sumBillable','sumDuration',_0x9193('0x11'),'waiting'];function VoiceQueueSummary(_0x276552){this['id']=_0x276552['id'];this[_0x9193('0x12')]=_0x276552['name'];this[_0x9193('0x13')]=_0x276552[_0x9193('0x13')];this[_0x9193('0x14')]=_0x276552[_0x9193('0x14')]||0x0;this[_0x9193('0x5')]=_0x276552[_0x9193('0x5')]||0x0;this[_0x9193('0x0')]=_0x276552[_0x9193('0x0')]||0x0;this[_0x9193('0x15')]=_0x276552['busy']||0x0;this[_0x9193('0x6')]=_0x276552[_0x9193('0x6')]||0x0;this[_0x9193('0x16')]=_0x276552[_0x9193('0x16')]||0x0;this[_0x9193('0x17')]=_0x276552['loggedIn']||0x0;this[_0x9193('0x1')]=_0x276552[_0x9193('0x1')]||0x0;this[_0x9193('0x18')]=_0x276552[_0x9193('0x18')]||0x0;this[_0x9193('0x19')]=_0x276552[_0x9193('0x19')]||0x0;this[_0x9193('0x2')]=_0x276552['paused']||0x0;this[_0x9193('0x3')]=_0x276552[_0x9193('0x3')]||0x0;this[_0x9193('0x1a')]=_0x276552['ringInUse'];this[_0x9193('0x1b')]=_0x276552[_0x9193('0x1b')];this[_0x9193('0x1c')]=_0x276552['sumDuration'];this[_0x9193('0x1d')]=_0x276552[_0x9193('0x1d')]||0x0;this[_0x9193('0x1e')]=_0x276552[_0x9193('0x1e')]||0x0;this[_0x9193('0x11')]=_0x276552['total']||0x0;this[_0x9193('0x1f')]=_0x276552[_0x9193('0x1f')];this[_0x9193('0x20')]=_0x276552[_0x9193('0x20')]||0x0;this[_0x9193('0x21')]=_0x276552['unknown']||0x0;this[_0x9193('0x22')]=_0x276552[_0x9193('0x22')]||0x0;this[_0x9193('0x4')]=_0x276552[_0x9193('0x4')]||0x0;if(_0x276552[_0x9193('0x1f')]==='outbound'){this[_0x9193('0x10')]=_0x276552[_0x9193('0x10')]||0x0;this[_0x9193('0x23')]=_0x276552[_0x9193('0x23')];this['dialMethod']=_0x276552['dialMethod'];this[_0x9193('0x24')]=_0x276552[_0x9193('0x24')];this[_0x9193('0x25')]=_0x276552[_0x9193('0x25')];this[_0x9193('0x26')]=_0x276552['dialOriginateTimeout'];this[_0x9193('0x27')]=_0x276552[_0x9193('0x27')];this[_0x9193('0x28')]=_0x276552['temp'];this[_0x9193('0x29')]=_0x276552[_0x9193('0x29')];this[_0x9193('0x8')]=_0x276552[_0x9193('0x8')];this[_0x9193('0x9')]=_0x276552['outboundBlacklistCallsDay'];this[_0x9193('0xa')]=_0x276552[_0x9193('0xa')];this['outboundCongestionCallsDay']=_0x276552[_0x9193('0xb')];this[_0x9193('0x2a')]=_0x276552[_0x9193('0x2a')];this[_0x9193('0x2b')]=_0x276552[_0x9193('0x2b')];this[_0x9193('0x2c')]=_0x276552['outboundDropCallsDayTimeout'];this[_0x9193('0xc')]=_0x276552[_0x9193('0xc')];this[_0x9193('0x2d')]=_0x276552[_0x9193('0x2d')];this[_0x9193('0x2e')]=_0x276552[_0x9193('0x2e')];this['outboundReCallsDay']=_0x276552[_0x9193('0xd')];this[_0x9193('0xe')]=_0x276552[_0x9193('0xe')];this['outboundUnknownCallsDay']=_0x276552[_0x9193('0xf')];this[_0x9193('0x2f')]=_0x276552[_0x9193('0x2f')];this['predictiveIntervalAvgHoldtime']=_0x276552[_0x9193('0x30')];this[_0x9193('0x31')]=_0x276552[_0x9193('0x31')];this['predictiveIntervalDroppedCallsCallersExit']=_0x276552['predictiveIntervalDroppedCallsCallersExit'];this[_0x9193('0x32')]=_0x276552['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x276552[_0x9193('0x33')];this[_0x9193('0x34')]=_0x276552[_0x9193('0x34')];this[_0x9193('0x35')]=_0x276552['predictiveIntervalHitRate'];this['predictiveIntervalMultiplicativeFactor']=_0x276552[_0x9193('0x36')];this[_0x9193('0x37')]=_0x276552[_0x9193('0x37')];this[_0x9193('0x38')]=_0x276552[_0x9193('0x38')];this[_0x9193('0x39')]=_0x276552[_0x9193('0x39')];this[_0x9193('0x7')]=_0x276552['originated'];this[_0x9193('0x3a')]=_0x276552['erlangCalls'];this[_0x9193('0x3b')]=_0x276552[_0x9193('0x3b')];this[_0x9193('0x3c')]=_0x276552['erlangAbandonmentRate'];this[_0x9193('0x3d')]=_0x276552[_0x9193('0x3d')];this['startPredictive']=_0x276552[_0x9193('0x3e')];this[_0x9193('0x3f')]=_0x276552[_0x9193('0x3f')];this[_0x9193('0x40')]=_0x276552[_0x9193('0x40')];this[_0x9193('0x41')]=_0x276552[_0x9193('0x41')];}if(_0x276552['Trunk']){this[_0x9193('0x42')]={'id':_0x276552[_0x9193('0x42')]['id'],'name':_0x276552[_0x9193('0x42')][_0x9193('0x12')],'active':_0x276552['Trunk'][_0x9193('0x43')],'callerid':_0x276552[_0x9193('0x42')][_0x9193('0x44')]};}}VoiceQueueSummary[_0x9193('0x45')][_0x9193('0x46')]=function(_0x146d78,_0x1f78a2,_0x2986ae,_0x4041ca){this[_0x9193('0x1')]=0x0;this[_0x9193('0x1e')]=0x0;this[_0x9193('0x2')]=0x0;this[_0x9193('0x21')]=0x0;this[_0x9193('0x19')]=0x0;this[_0x9193('0x6')]=0x0;this['busy']=0x0;this[_0x9193('0x16')]=0x0;this['unavailable']=0x0;this[_0x9193('0x3')]=0x0;this['ringInUse']=0x0;this[_0x9193('0x18')]=0x0;if(_0x2986ae){if(_0x2986ae['available']){this[_0x9193('0x0')]=Number(_0x2986ae[_0x9193('0x0')]);}if(_0x2986ae[_0x9193('0x47')]){this[_0x9193('0x17')]=Number(_0x2986ae[_0x9193('0x47')]);}if(_0x2986ae['callers']){this['waiting']=Number(_0x2986ae[_0x9193('0x48')]);}}for(var _0x2652ef=0x0;_0x2652ef<_0x146d78['length'];_0x2652ef++){var _0x5edc8a=_0x1f78a2[_0x9193('0x49')+_0x146d78[_0x2652ef][_0x9193('0x12')]];if(_0x5edc8a&&_0x5edc8a['online']){this[_0x9193('0x1')]+=0x1;}if(_0x146d78[_0x2652ef][_0x9193('0x4a')]==='1'){this[_0x9193('0x1e')]+=0x1;}if(_0x146d78[_0x2652ef][_0x9193('0x2')]==='1'&&!['2','7','8'][_0x9193('0x4b')](_0x146d78[_0x2652ef][_0x9193('0x4c')])){this['paused']+=0x1;}switch(_0x146d78[_0x2652ef][_0x9193('0x4c')]){case'0':this['unknown']+=0x1;break;case'1':this[_0x9193('0x19')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x9193('0x15')]+=0x1;break;case'4':this[_0x9193('0x16')]+=0x1;break;case'5':this[_0x9193('0x20')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x9193('0x1a')]+=0x1;break;case'8':this[_0x9193('0x18')]+=0x1;break;}}if(this[_0x9193('0x4d')]===_0x9193('0x4e')){var _0x24cf2e=Object[_0x9193('0x4f')](_0x4041ca);for(var _0x4d6f7b=0x0;_0x4d6f7b<_0x24cf2e[_0x9193('0x50')];_0x4d6f7b++){var _0x3620e6=_0x24cf2e[_0x4d6f7b];var _0x50457f=_0x4041ca[_0x3620e6];if(_0x50457f[_0x9193('0x51')]===this['name']&&_0x50457f[_0x9193('0x1f')]===_0x9193('0x52')&&_0x50457f['exten']===_0x9193('0x53')){this[_0x9193('0x1e')]+=0x1;}}if(this[_0x9193('0x1e')]>this[_0x9193('0x6')]){this[_0x9193('0x1e')]=this[_0x9193('0x6')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x9193('0x45')][_0x9193('0x54')]=function(_0x246be9){var _0x305487=![];if(_0x246be9){_0x305487=INBOUND_COUNTERS[_0x9193('0x55')](function(_0x1e685b){return this[_0x1e685b]!==_0x246be9[_0x1e685b];},this);}return _0x305487;};VoiceQueueSummary[_0x9193('0x45')][_0x9193('0x56')]=function(_0x2d3e53){var _0xc1580=![];var _0x1da94f=![];var _0xe4734c=![];if(_0x2d3e53){_0xc1580=this[_0x9193('0x4d')]!==_0x2d3e53[_0x9193('0x4d')]||this[_0x9193('0x23')]!==_0x2d3e53[_0x9193('0x23')]||this['message']!==_0x2d3e53[_0x9193('0x40')]||this[_0x9193('0x41')]!==_0x2d3e53['statusMessage'];_0x1da94f=OUTBOUND_COUNTERS[_0x9193('0x55')](function(_0x2a8c1d){return this[_0x2a8c1d]!==_0x2d3e53[_0x2a8c1d];},this);if(this['Trunk']&&_0x2d3e53[_0x9193('0x42')]){_0xe4734c=this[_0x9193('0x42')][_0x9193('0x12')]!==_0x2d3e53['Trunk'][_0x9193('0x12')]||this[_0x9193('0x42')]['active']!==_0x2d3e53[_0x9193('0x42')][_0x9193('0x43')];}}return _0xc1580||_0x1da94f||_0xe4734c;};VoiceQueueSummary['prototype']['updateReportFromOutboundQueue']=function(_0x5d0ee6){this[_0x9193('0x5')]=_0x5d0ee6[_0x9193('0x5')];this['message']=_0x5d0ee6[_0x9193('0x40')];this[_0x9193('0x41')]=_0x5d0ee6['statusMessage'];this[_0x9193('0x7')]=_0x5d0ee6[_0x9193('0x7')];this[_0x9193('0x57')]=_0x5d0ee6['outboundAbandonedCallsDay'];this[_0x9193('0x8')]=_0x5d0ee6[_0x9193('0x8')];this[_0x9193('0x9')]=_0x5d0ee6[_0x9193('0x9')];this['outboundBusyCallsDay']=_0x5d0ee6[_0x9193('0xa')];this[_0x9193('0xb')]=_0x5d0ee6['outboundCongestionCallsDay'];this[_0x9193('0xc')]=_0x5d0ee6[_0x9193('0xc')];this['outboundNoSuchCallsDay']=_0x5d0ee6[_0x9193('0x2d')];this[_0x9193('0xd')]=_0x5d0ee6[_0x9193('0xd')];this[_0x9193('0xe')]=_0x5d0ee6[_0x9193('0xe')];this[_0x9193('0xf')]=_0x5d0ee6['outboundUnknownCallsDay'];this[_0x9193('0x1b')]=_0x5d0ee6[_0x9193('0x1b')];this[_0x9193('0x1c')]=_0x5d0ee6[_0x9193('0x1c')];this['total']=_0x5d0ee6[_0x9193('0x11')];if(this[_0x9193('0x4d')]===_0x9193('0x58')){this['pTalking']=_0x5d0ee6[_0x9193('0x10')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x7c1f=['outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','length','online','incall','includes','status','booked','xcally-motion-preview','compareToInboundQueue','compareToOutboundQueue','dialActive','some','active','preview','exports','available','loggedIn','loggedInDb','paused','ringing','waiting','answered','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','talking','sumBillable','total','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumDuration','sumHoldTime','unavailable','unknown','unmanaged','type'];(function(_0xd0f17d,_0x4ae565){var _0xd44ca=function(_0x3ce2c7){while(--_0x3ce2c7){_0xd0f17d['push'](_0xd0f17d['shift']());}};_0xd44ca(++_0x4ae565);}(_0x7c1f,0x194));var _0xf7c1=function(_0x59d452,_0x23e51d){_0x59d452=_0x59d452-0x0;var _0x139d2e=_0x7c1f[_0x59d452];return _0x139d2e;};'use strict';var INBOUND_COUNTERS=[_0xf7c1('0x0'),_0xf7c1('0x1'),_0xf7c1('0x2'),_0xf7c1('0x3'),_0xf7c1('0x4'),'talking',_0xf7c1('0x5')];var OUTBOUND_COUNTERS=[_0xf7c1('0x0'),_0xf7c1('0x6'),'inUse',_0xf7c1('0x1'),_0xf7c1('0x2'),_0xf7c1('0x7'),_0xf7c1('0x8'),'outboundAnswerCallsDay',_0xf7c1('0x9'),_0xf7c1('0xa'),_0xf7c1('0xb'),_0xf7c1('0xc'),_0xf7c1('0xd'),_0xf7c1('0xe'),_0xf7c1('0xf'),_0xf7c1('0x10'),_0xf7c1('0x3'),_0xf7c1('0x11'),_0xf7c1('0x12'),_0xf7c1('0x13'),'sumDuration',_0xf7c1('0x14'),_0xf7c1('0x5')];function VoiceQueueSummary(_0x1f2f86){this['id']=_0x1f2f86['id'];this[_0xf7c1('0x15')]=_0x1f2f86[_0xf7c1('0x15')];this[_0xf7c1('0x16')]=_0x1f2f86['strategy'];this['abandoned']=_0x1f2f86[_0xf7c1('0x17')]||0x0;this['answered']=_0x1f2f86[_0xf7c1('0x6')]||0x0;this[_0xf7c1('0x0')]=_0x1f2f86['available']||0x0;this[_0xf7c1('0x18')]=_0x1f2f86['busy']||0x0;this[_0xf7c1('0x19')]=_0x1f2f86[_0xf7c1('0x19')]||0x0;this[_0xf7c1('0x1a')]=_0x1f2f86[_0xf7c1('0x1a')]||0x0;this[_0xf7c1('0x1')]=_0x1f2f86['loggedIn']||0x0;this[_0xf7c1('0x2')]=_0x1f2f86['loggedInDb']||0x0;this[_0xf7c1('0x1b')]=_0x1f2f86['onHold']||0x0;this[_0xf7c1('0x1c')]=_0x1f2f86[_0xf7c1('0x1c')]||0x0;this[_0xf7c1('0x3')]=_0x1f2f86[_0xf7c1('0x3')]||0x0;this[_0xf7c1('0x4')]=_0x1f2f86[_0xf7c1('0x4')]||0x0;this[_0xf7c1('0x1d')]=_0x1f2f86[_0xf7c1('0x1d')];this['sumBillable']=_0x1f2f86['sumBillable'];this[_0xf7c1('0x1e')]=_0x1f2f86[_0xf7c1('0x1e')];this['sumHoldTime']=_0x1f2f86[_0xf7c1('0x1f')]||0x0;this[_0xf7c1('0x12')]=_0x1f2f86['talking']||0x0;this[_0xf7c1('0x14')]=_0x1f2f86['total']||0x0;this['type']=_0x1f2f86['type'];this[_0xf7c1('0x20')]=_0x1f2f86[_0xf7c1('0x20')]||0x0;this['unknown']=_0x1f2f86[_0xf7c1('0x21')]||0x0;this[_0xf7c1('0x22')]=_0x1f2f86[_0xf7c1('0x22')]||0x0;this[_0xf7c1('0x5')]=_0x1f2f86[_0xf7c1('0x5')]||0x0;if(_0x1f2f86[_0xf7c1('0x23')]===_0xf7c1('0x24')){this[_0xf7c1('0x11')]=_0x1f2f86['pTalking']||0x0;this['dialActive']=_0x1f2f86['dialActive'];this[_0xf7c1('0x25')]=_0x1f2f86[_0xf7c1('0x25')];this[_0xf7c1('0x26')]=_0x1f2f86[_0xf7c1('0x26')];this[_0xf7c1('0x27')]=_0x1f2f86[_0xf7c1('0x27')];this[_0xf7c1('0x28')]=_0x1f2f86[_0xf7c1('0x28')];this[_0xf7c1('0x29')]=_0x1f2f86['dialPrefix'];this[_0xf7c1('0x2a')]=_0x1f2f86[_0xf7c1('0x2a')];this['outboundAnswerAgiCallsDay']=_0x1f2f86[_0xf7c1('0x2b')];this[_0xf7c1('0x2c')]=_0x1f2f86[_0xf7c1('0x2c')];this[_0xf7c1('0x9')]=_0x1f2f86[_0xf7c1('0x9')];this['outboundBusyCallsDay']=_0x1f2f86[_0xf7c1('0xa')];this['outboundCongestionCallsDay']=_0x1f2f86[_0xf7c1('0xb')];this[_0xf7c1('0x2d')]=_0x1f2f86[_0xf7c1('0x2d')];this['outboundDropCallsDayCallersExit']=_0x1f2f86[_0xf7c1('0x2e')];this[_0xf7c1('0x2f')]=_0x1f2f86['outboundDropCallsDayTimeout'];this['outboundNoAnswerCallsDay']=_0x1f2f86[_0xf7c1('0xc')];this[_0xf7c1('0xd')]=_0x1f2f86[_0xf7c1('0xd')];this[_0xf7c1('0x30')]=_0x1f2f86[_0xf7c1('0x30')];this['outboundReCallsDay']=_0x1f2f86[_0xf7c1('0xe')];this[_0xf7c1('0xf')]=_0x1f2f86[_0xf7c1('0xf')];this[_0xf7c1('0x10')]=_0x1f2f86[_0xf7c1('0x10')];this['predictiveIntervalAnsweredCalls']=_0x1f2f86['predictiveIntervalAnsweredCalls'];this[_0xf7c1('0x31')]=_0x1f2f86[_0xf7c1('0x31')];this[_0xf7c1('0x32')]=_0x1f2f86[_0xf7c1('0x32')];this[_0xf7c1('0x33')]=_0x1f2f86['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x1f2f86[_0xf7c1('0x34')];this[_0xf7c1('0x35')]=_0x1f2f86[_0xf7c1('0x35')];this[_0xf7c1('0x36')]=_0x1f2f86['predictiveIntervalErlangCallsDroppedCalls'];this[_0xf7c1('0x37')]=_0x1f2f86['predictiveIntervalHitRate'];this[_0xf7c1('0x38')]=_0x1f2f86[_0xf7c1('0x38')];this[_0xf7c1('0x39')]=_0x1f2f86[_0xf7c1('0x39')];this[_0xf7c1('0x3a')]=_0x1f2f86[_0xf7c1('0x3a')];this[_0xf7c1('0x3b')]=_0x1f2f86['predictiveIntervalTotalCalls'];this['originated']=_0x1f2f86[_0xf7c1('0x7')];this['erlangCalls']=_0x1f2f86[_0xf7c1('0x3c')];this[_0xf7c1('0x3d')]=_0x1f2f86['erlangCallToSecond'];this[_0xf7c1('0x3e')]=_0x1f2f86['erlangAbandonmentRate'];this['erlangBusyFactor']=_0x1f2f86[_0xf7c1('0x3f')];this[_0xf7c1('0x40')]=_0x1f2f86[_0xf7c1('0x40')];this[_0xf7c1('0x41')]=_0x1f2f86['startProgressive'];this['message']=_0x1f2f86[_0xf7c1('0x42')];this[_0xf7c1('0x43')]=_0x1f2f86[_0xf7c1('0x43')];}if(_0x1f2f86[_0xf7c1('0x44')]){this[_0xf7c1('0x44')]={'id':_0x1f2f86[_0xf7c1('0x44')]['id'],'name':_0x1f2f86['Trunk'][_0xf7c1('0x15')],'active':_0x1f2f86[_0xf7c1('0x44')]['active'],'callerid':_0x1f2f86['Trunk'][_0xf7c1('0x45')]};}}VoiceQueueSummary[_0xf7c1('0x46')][_0xf7c1('0x47')]=function(_0x1b7f4e,_0x2ddf10,_0x5f011e,_0x50597a){this['loggedInDb']=0x0;this[_0xf7c1('0x12')]=0x0;this['paused']=0x0;this[_0xf7c1('0x21')]=0x0;this[_0xf7c1('0x1c')]=0x0;this[_0xf7c1('0x19')]=0x0;this[_0xf7c1('0x18')]=0x0;this[_0xf7c1('0x1a')]=0x0;this['unavailable']=0x0;this[_0xf7c1('0x4')]=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x5f011e){if(_0x5f011e[_0xf7c1('0x0')]){this['available']=Number(_0x5f011e['available']);}if(_0x5f011e[_0xf7c1('0x48')]){this[_0xf7c1('0x1')]=Number(_0x5f011e[_0xf7c1('0x48')]);}if(_0x5f011e[_0xf7c1('0x49')]){this[_0xf7c1('0x5')]=Number(_0x5f011e['callers']);}}for(var _0x2d928d=0x0;_0x2d928d<_0x1b7f4e[_0xf7c1('0x4a')];_0x2d928d++){var _0x2af2d2=_0x2ddf10['SIP/'+_0x1b7f4e[_0x2d928d][_0xf7c1('0x15')]];if(_0x2af2d2&&_0x2af2d2[_0xf7c1('0x4b')]){this[_0xf7c1('0x2')]+=0x1;}if(_0x1b7f4e[_0x2d928d][_0xf7c1('0x4c')]==='1'){this[_0xf7c1('0x12')]+=0x1;}if(_0x1b7f4e[_0x2d928d]['paused']==='1'&&!['2','7','8'][_0xf7c1('0x4d')](_0x1b7f4e[_0x2d928d][_0xf7c1('0x4e')])){this[_0xf7c1('0x3')]+=0x1;}switch(_0x1b7f4e[_0x2d928d][_0xf7c1('0x4e')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xf7c1('0x1c')]+=0x1;break;case'2':this[_0xf7c1('0x19')]+=0x1;break;case'3':this[_0xf7c1('0x18')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xf7c1('0x20')]+=0x1;break;case'6':this[_0xf7c1('0x4')]+=0x1;break;case'7':this[_0xf7c1('0x1d')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xf7c1('0x25')]===_0xf7c1('0x4f')){var _0x3d2ec5=Object['keys'](_0x50597a);for(var _0xd08daa=0x0;_0xd08daa<_0x3d2ec5['length'];_0xd08daa++){var _0x20b58d=_0x3d2ec5[_0xd08daa];var _0x2150f2=_0x50597a[_0x20b58d];if(_0x2150f2['queue']===this['name']&&_0x2150f2[_0xf7c1('0x23')]==='dialer'&&_0x2150f2['exten']===_0xf7c1('0x50')){this['talking']+=0x1;}}if(this[_0xf7c1('0x12')]>this[_0xf7c1('0x19')]){this[_0xf7c1('0x12')]=this[_0xf7c1('0x19')];}this[_0xf7c1('0x11')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0xf7c1('0x51')]=function(_0x5ed695){var _0x72f433=![];if(_0x5ed695){_0x72f433=INBOUND_COUNTERS['some'](function(_0x1d8e3c){return this[_0x1d8e3c]!==_0x5ed695[_0x1d8e3c];},this);}return _0x72f433;};VoiceQueueSummary[_0xf7c1('0x46')][_0xf7c1('0x52')]=function(_0x1b9b4f){var _0x71b246=![];var _0x4ca2da=![];var _0x489546=![];if(_0x1b9b4f){_0x71b246=this[_0xf7c1('0x25')]!==_0x1b9b4f[_0xf7c1('0x25')]||this[_0xf7c1('0x53')]!==_0x1b9b4f[_0xf7c1('0x53')]||this[_0xf7c1('0x42')]!==_0x1b9b4f[_0xf7c1('0x42')]||this[_0xf7c1('0x43')]!==_0x1b9b4f[_0xf7c1('0x43')];_0x4ca2da=OUTBOUND_COUNTERS[_0xf7c1('0x54')](function(_0x233f32){return this[_0x233f32]!==_0x1b9b4f[_0x233f32];},this);if(this[_0xf7c1('0x44')]&&_0x1b9b4f[_0xf7c1('0x44')]){_0x489546=this[_0xf7c1('0x44')]['name']!==_0x1b9b4f[_0xf7c1('0x44')][_0xf7c1('0x15')]||this[_0xf7c1('0x44')][_0xf7c1('0x55')]!==_0x1b9b4f[_0xf7c1('0x44')]['active'];}}return _0x71b246||_0x4ca2da||_0x489546;};VoiceQueueSummary[_0xf7c1('0x46')]['updateReportFromOutboundQueue']=function(_0x1f0209){this[_0xf7c1('0x6')]=_0x1f0209['answered'];this[_0xf7c1('0x42')]=_0x1f0209[_0xf7c1('0x42')];this[_0xf7c1('0x43')]=_0x1f0209[_0xf7c1('0x43')];this[_0xf7c1('0x7')]=_0x1f0209[_0xf7c1('0x7')];this[_0xf7c1('0x8')]=_0x1f0209[_0xf7c1('0x8')];this[_0xf7c1('0x2c')]=_0x1f0209[_0xf7c1('0x2c')];this[_0xf7c1('0x9')]=_0x1f0209[_0xf7c1('0x9')];this[_0xf7c1('0xa')]=_0x1f0209[_0xf7c1('0xa')];this[_0xf7c1('0xb')]=_0x1f0209[_0xf7c1('0xb')];this[_0xf7c1('0xc')]=_0x1f0209['outboundNoAnswerCallsDay'];this[_0xf7c1('0xd')]=_0x1f0209[_0xf7c1('0xd')];this[_0xf7c1('0xe')]=_0x1f0209[_0xf7c1('0xe')];this[_0xf7c1('0xf')]=_0x1f0209[_0xf7c1('0xf')];this[_0xf7c1('0x10')]=_0x1f0209['outboundUnknownCallsDay'];this[_0xf7c1('0x13')]=_0x1f0209[_0xf7c1('0x13')];this['sumDuration']=_0x1f0209[_0xf7c1('0x1e')];this[_0xf7c1('0x14')]=_0x1f0209[_0xf7c1('0x14')];if(this[_0xf7c1('0x25')]===_0xf7c1('0x56')){this[_0xf7c1('0x11')]=_0x1f0209[_0xf7c1('0x11')];}};module[_0xf7c1('0x57')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index a28396f..14b687d 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 _0xaafb=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0xcf2b34,_0x2c3df7){var _0x191292=function(_0x58b04b){while(--_0x58b04b){_0xcf2b34['push'](_0xcf2b34['shift']());}};_0x191292(++_0x2c3df7);}(_0xaafb,0x1ba));var _0xbaaf=function(_0x30366e,_0xc1472a){_0x30366e=_0x30366e-0x0;var _0x159cf3=_0xaafb[_0x30366e];return _0x159cf3;};'use strict';function VtigerAccount(_0x453f62){this['id']=_0x453f62['id']||0x0;this[_0xbaaf('0x0')]=_0x453f62[_0xbaaf('0x0')]||'';this['username']=_0x453f62[_0xbaaf('0x1')]||'';this[_0xbaaf('0x2')]=_0x453f62[_0xbaaf('0x2')]||'';this[_0xbaaf('0x3')]=_0x453f62[_0xbaaf('0x3')]||'';this['serverUrl']=_0x453f62[_0xbaaf('0x4')]||'';this[_0xbaaf('0x5')]=_0x453f62[_0xbaaf('0x5')]||{};}module[_0xbaaf('0x6')]=VtigerAccount; \ No newline at end of file +var _0xa5d0=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x22685c,_0x478276){var _0x429490=function(_0x553fd2){while(--_0x553fd2){_0x22685c['push'](_0x22685c['shift']());}};_0x429490(++_0x478276);}(_0xa5d0,0x95));var _0x0a5d=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xa5d0[_0x3ff085];return _0x2b68c3;};'use strict';function VtigerAccount(_0x5a6130){this['id']=_0x5a6130['id']||0x0;this[_0x0a5d('0x0')]=_0x5a6130['name']||'';this[_0x0a5d('0x1')]=_0x5a6130[_0x0a5d('0x1')]||'';this[_0x0a5d('0x2')]=_0x5a6130['accessKey']||'';this[_0x0a5d('0x3')]=_0x5a6130['remoteUri']||'';this[_0x0a5d('0x4')]=_0x5a6130[_0x0a5d('0x4')]||'';this[_0x0a5d('0x5')]=_0x5a6130[_0x0a5d('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e1b90df..6dee958 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 _0x22e5=['username','password','token','remoteUri','authType','serverUrl','Configurations','name'];(function(_0x138aeb,_0x2ae31a){var _0x2241fe=function(_0x16b92f){while(--_0x16b92f){_0x138aeb['push'](_0x138aeb['shift']());}};_0x2241fe(++_0x2ae31a);}(_0x22e5,0x14f));var _0x522e=function(_0x48ea9b,_0xc0071){_0x48ea9b=_0x48ea9b-0x0;var _0x48fb21=_0x22e5[_0x48ea9b];return _0x48fb21;};'use strict';function ZendeskAccount(_0x36d4a5){this['id']=_0x36d4a5['id']||0x0;this[_0x522e('0x0')]=_0x36d4a5[_0x522e('0x0')]||'';this[_0x522e('0x1')]=_0x36d4a5[_0x522e('0x1')]||'';this[_0x522e('0x2')]=_0x36d4a5[_0x522e('0x2')]||'';this[_0x522e('0x3')]=_0x36d4a5[_0x522e('0x3')]||'';this[_0x522e('0x4')]=_0x36d4a5[_0x522e('0x4')]||'';this[_0x522e('0x5')]=_0x36d4a5[_0x522e('0x5')]||'';this['type']=_0x36d4a5['type']||'integrationTab';this[_0x522e('0x6')]=_0x36d4a5[_0x522e('0x6')]||'';this[_0x522e('0x7')]=_0x36d4a5[_0x522e('0x7')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x8af3=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x2389bc,_0x167cd2){var _0x170548=function(_0x2da7f2){while(--_0x2da7f2){_0x2389bc['push'](_0x2389bc['shift']());}};_0x170548(++_0x167cd2);}(_0x8af3,0x160));var _0x38af=function(_0x38218f,_0x791c41){_0x38218f=_0x38218f-0x0;var _0xb1450=_0x8af3[_0x38218f];return _0xb1450;};'use strict';function ZendeskAccount(_0x3ba8b1){this['id']=_0x3ba8b1['id']||0x0;this['name']=_0x3ba8b1[_0x38af('0x0')]||'';this[_0x38af('0x1')]=_0x3ba8b1[_0x38af('0x1')]||'';this[_0x38af('0x2')]=_0x3ba8b1[_0x38af('0x2')]||'';this[_0x38af('0x3')]=_0x3ba8b1['token']||'';this['remoteUri']=_0x3ba8b1[_0x38af('0x4')]||'';this[_0x38af('0x5')]=_0x3ba8b1[_0x38af('0x5')]||'';this[_0x38af('0x6')]=_0x3ba8b1['type']||_0x38af('0x7');this[_0x38af('0x8')]=_0x3ba8b1[_0x38af('0x8')]||'';this['Configurations']=_0x3ba8b1[_0x38af('0x9')]||{};}module[_0x38af('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c4f5d62..9660e67 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 _0xcd01=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xcd01,0x17f));var _0x1cd0=function(_0x1903a3,_0x4cf240){_0x1903a3=_0x1903a3-0x0;var _0x282409=_0xcd01[_0x1903a3];return _0x282409;};'use strict';function ZohoAccount(_0x2b9f3a){this['id']=_0x2b9f3a['id']||0x0;this['name']=_0x2b9f3a[_0x1cd0('0x0')]||'';this[_0x1cd0('0x1')]=_0x2b9f3a['description']||'';this[_0x1cd0('0x2')]=_0x2b9f3a[_0x1cd0('0x2')]||'';this[_0x1cd0('0x3')]=_0x2b9f3a[_0x1cd0('0x3')]||'';this[_0x1cd0('0x4')]=_0x2b9f3a['clientId']||'';this[_0x1cd0('0x5')]=_0x2b9f3a[_0x1cd0('0x5')]||'';this[_0x1cd0('0x6')]=_0x2b9f3a[_0x1cd0('0x6')]||'';this[_0x1cd0('0x7')]=_0x2b9f3a[_0x1cd0('0x7')]||'';this['refreshToken']=_0x2b9f3a[_0x1cd0('0x8')]||'';this['Configurations']=_0x2b9f3a[_0x1cd0('0x9')]||{};}module[_0x1cd0('0xa')]=ZohoAccount; \ No newline at end of file +var _0xe995=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name'];(function(_0x3944ac,_0x296dee){var _0x373caf=function(_0x320c39){while(--_0x320c39){_0x3944ac['push'](_0x3944ac['shift']());}};_0x373caf(++_0x296dee);}(_0xe995,0x167));var _0x5e99=function(_0x1d84b1,_0x1d88d0){_0x1d84b1=_0x1d84b1-0x0;var _0x4a9e19=_0xe995[_0x1d84b1];return _0x4a9e19;};'use strict';function ZohoAccount(_0x58e0e0){this['id']=_0x58e0e0['id']||0x0;this[_0x5e99('0x0')]=_0x58e0e0[_0x5e99('0x0')]||'';this[_0x5e99('0x1')]=_0x58e0e0[_0x5e99('0x1')]||'';this[_0x5e99('0x2')]=_0x58e0e0[_0x5e99('0x2')]||'';this[_0x5e99('0x3')]=_0x58e0e0[_0x5e99('0x3')]||'';this['clientId']=_0x58e0e0[_0x5e99('0x4')]||'';this[_0x5e99('0x5')]=_0x58e0e0[_0x5e99('0x5')]||'';this[_0x5e99('0x6')]=_0x58e0e0[_0x5e99('0x6')]||'';this[_0x5e99('0x7')]=_0x58e0e0['code']||'';this[_0x5e99('0x8')]=_0x58e0e0['refreshToken']||'';this[_0x5e99('0x9')]=_0x58e0e0[_0x5e99('0x9')]||{};}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 51eb5fe..731047b 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 _0x68b3=['Agent','format','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','dialAnswer','membername'];(function(_0x596481,_0x14b4a1){var _0x1abe27=function(_0x244d0e){while(--_0x244d0e){_0x596481['push'](_0x596481['shift']());}};_0x1abe27(++_0x14b4a1);}(_0x68b3,0x1d8));var _0x368b=function(_0x4449a2,_0x8b5a18){_0x4449a2=_0x4449a2-0x0;var _0x5cb7e3=_0x68b3[_0x4449a2];return _0x5cb7e3;};'use strict';var util=require(_0x368b('0x0'));var _=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));function checkNameSurname(_0xa371c,_0x2d2762,_0x4a9da6){var _0x208c48='';if(!_[_0x368b('0x3')](_0x2d2762)&&_0x368b('0x4')===typeof _0x2d2762){_0x208c48+=_0x2d2762;}if(!_[_0x368b('0x3')](_0x4a9da6)&&'string'===typeof _0x4a9da6){_0x208c48+='\x20'+_0x4a9da6;}if(_0x208c48!==''){return _0x208c48;}return _0xa371c;}function Action(_0x12eb8f,_0x41b15b,_0x104dad,_0x23584a,_0x4406c8){this[_0x368b('0x5')]=_0x104dad||undefined;this[_0x368b('0x6')]=_0x12eb8f['id'];this[_0x368b('0x7')]=_0x41b15b[_0x368b('0x8')];this[_0x368b('0x9')]=_0x41b15b[_0x368b('0x9')];this['campaigntype']=_0x368b('0x7');this[_0x368b('0xa')]=![];this[_0x368b('0xb')]=_['isNil'](_0x12eb8f[_0x368b('0xc')])?undefined:_0x12eb8f[_0x368b('0xc')][_0x368b('0x8')];this['channelAgent']=this[_0x368b('0xb')]?util[_0x368b('0xd')]('SIP/%s',this[_0x368b('0xb')]):_0x23584a||undefined;this[_0x368b('0xe')]=checkNameSurname(_0x12eb8f[_0x368b('0xf')][_0x368b('0x10')],_0x12eb8f[_0x368b('0xf')]['firstName'],_0x12eb8f[_0x368b('0xf')][_0x368b('0x11')]);this['active']=_0x12eb8f[_0x368b('0x12')]||![];this[_0x368b('0x13')]=_0x12eb8f[_0x368b('0x10')];this['scheduledat']=_0x12eb8f[_0x368b('0x14')];this[_0x368b('0x15')]=_0x12eb8f[_0x368b('0x15')]||0x0;this['countcongestionretry']=_0x12eb8f[_0x368b('0x16')]||0x0;this[_0x368b('0x17')]=_0x12eb8f[_0x368b('0x17')]||0x0;this['countglobal']=(_0x12eb8f['countbusyretry']||0x0)+(_0x12eb8f[_0x368b('0x16')]||0x0)+(_0x12eb8f[_0x368b('0x17')]||0x0)+(_0x12eb8f[_0x368b('0x18')]||0x0)+(_0x12eb8f[_0x368b('0x19')]||0x0)+(_0x12eb8f[_0x368b('0x1a')]||0x0)+(_0x12eb8f['countmachineretry']||0x0)+(_0x12eb8f[_0x368b('0x1b')]||0x0);this[_0x368b('0x18')]=_0x12eb8f[_0x368b('0x18')]||0x0;this[_0x368b('0x19')]=_0x12eb8f[_0x368b('0x19')]||0x0;this[_0x368b('0x1a')]=_0x12eb8f[_0x368b('0x1a')]||0x0;this[_0x368b('0x1c')]=_0x12eb8f['countmachineretry']||0x0;this[_0x368b('0x1b')]=_0x12eb8f[_0x368b('0x1b')]||0x0;this[_0x368b('0x1d')]=_0x12eb8f[_0x368b('0x1d')];this[_0x368b('0x1e')]=_0x12eb8f['callbackuniqueid'];this[_0x368b('0x1f')]=_0x12eb8f[_0x368b('0x1f')];this[_0x368b('0x20')]=_0x12eb8f[_0x368b('0x20')];this[_0x368b('0x21')]=_0x12eb8f[_0x368b('0x21')];this[_0x368b('0x22')]=_0x12eb8f[_0x368b('0x22')];this[_0x368b('0x23')]=_[_0x368b('0x3')](_0x12eb8f[_0x368b('0xc')])?_0x12eb8f[_0x368b('0x23')]:_0x12eb8f[_0x368b('0xc')]['id'];this[_0x368b('0x24')]=_0x12eb8f[_0x368b('0x24')];this[_0x368b('0x25')]='';this[_0x368b('0x26')]='';}Action[_0x368b('0x27')][_0x368b('0x28')]=function(){return util[_0x368b('0xd')](_0x368b('0x29'),this[_0x368b('0xe')],this[_0x368b('0x2a')]);};module[_0x368b('0x2b')]=Action; \ No newline at end of file +var _0xfcbb=['name','format','SIP/%s','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x183b8a,_0x209523){_0x183b8a=_0x183b8a-0x0;var _0x1271c0=_0xfcbb[_0x183b8a];return _0x1271c0;};'use strict';var util=require(_0xbfcb('0x0'));var _=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));function checkNameSurname(_0x5a1002,_0x5747a4,_0x462349){var _0x280329='';if(!_[_0xbfcb('0x3')](_0x5747a4)&&_0xbfcb('0x4')===typeof _0x5747a4){_0x280329+=_0x5747a4;}if(!_[_0xbfcb('0x3')](_0x462349)&&'string'===typeof _0x462349){_0x280329+='\x20'+_0x462349;}if(_0x280329!==''){return _0x280329;}return _0x5a1002;}function Action(_0x5201d3,_0x32c2aa,_0x4990c,_0x8d4e6a,_0x2df839){this[_0xbfcb('0x5')]=_0x4990c||undefined;this[_0xbfcb('0x6')]=_0x5201d3['id'];this[_0xbfcb('0x7')]=_0x32c2aa['name'];this[_0xbfcb('0x8')]=_0x32c2aa[_0xbfcb('0x8')];this[_0xbfcb('0x9')]='queue';this[_0xbfcb('0xa')]=![];this[_0xbfcb('0xb')]=_[_0xbfcb('0x3')](_0x5201d3[_0xbfcb('0xc')])?undefined:_0x5201d3[_0xbfcb('0xc')][_0xbfcb('0xd')];this['channelAgent']=this[_0xbfcb('0xb')]?util[_0xbfcb('0xe')](_0xbfcb('0xf'),this[_0xbfcb('0xb')]):_0x8d4e6a||undefined;this['calleridname']=checkNameSurname(_0x5201d3[_0xbfcb('0x10')]['phone'],_0x5201d3[_0xbfcb('0x10')][_0xbfcb('0x11')],_0x5201d3[_0xbfcb('0x10')][_0xbfcb('0x12')]);this[_0xbfcb('0x13')]=_0x5201d3[_0xbfcb('0x13')]||![];this[_0xbfcb('0x14')]=_0x5201d3[_0xbfcb('0x15')];this[_0xbfcb('0x16')]=_0x5201d3[_0xbfcb('0x16')];this[_0xbfcb('0x17')]=_0x5201d3[_0xbfcb('0x17')]||0x0;this[_0xbfcb('0x18')]=_0x5201d3[_0xbfcb('0x18')]||0x0;this[_0xbfcb('0x19')]=_0x5201d3[_0xbfcb('0x19')]||0x0;this[_0xbfcb('0x1a')]=(_0x5201d3[_0xbfcb('0x17')]||0x0)+(_0x5201d3[_0xbfcb('0x18')]||0x0)+(_0x5201d3[_0xbfcb('0x19')]||0x0)+(_0x5201d3[_0xbfcb('0x1b')]||0x0)+(_0x5201d3[_0xbfcb('0x1c')]||0x0)+(_0x5201d3['countabandonedretry']||0x0)+(_0x5201d3[_0xbfcb('0x1d')]||0x0)+(_0x5201d3[_0xbfcb('0x1e')]||0x0);this['countnosuchnumberretry']=_0x5201d3[_0xbfcb('0x1b')]||0x0;this[_0xbfcb('0x1c')]=_0x5201d3['countdropretry']||0x0;this['countabandonedretry']=_0x5201d3[_0xbfcb('0x1f')]||0x0;this[_0xbfcb('0x1d')]=_0x5201d3[_0xbfcb('0x1d')]||0x0;this[_0xbfcb('0x1e')]=_0x5201d3[_0xbfcb('0x1e')]||0x0;this['callback']=_0x5201d3[_0xbfcb('0x20')];this[_0xbfcb('0x21')]=_0x5201d3[_0xbfcb('0x21')];this[_0xbfcb('0x22')]=_0x5201d3[_0xbfcb('0x22')];this[_0xbfcb('0x23')]=_0x5201d3[_0xbfcb('0x23')];this[_0xbfcb('0x24')]=_0x5201d3[_0xbfcb('0x24')];this[_0xbfcb('0x25')]=_0x5201d3[_0xbfcb('0x25')];this[_0xbfcb('0x26')]=_[_0xbfcb('0x3')](_0x5201d3[_0xbfcb('0xc')])?_0x5201d3[_0xbfcb('0x26')]:_0x5201d3[_0xbfcb('0xc')]['id'];this['VoiceQueueId']=_0x5201d3[_0xbfcb('0x27')];this[_0xbfcb('0x28')]='';this['originatecalleridname']='';}Action[_0xbfcb('0x29')][_0xbfcb('0x2a')]=function(){return util[_0xbfcb('0xe')](_0xbfcb('0x2b'),this[_0xbfcb('0x2c')],this[_0xbfcb('0x2d')]);};module[_0xbfcb('0x2e')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index d0ecd44..447ea1a 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 _0x5a45=['../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','hanguprequest','syncHangupRequest','bind','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','originated','pTalking','sendMessageOneNotActive','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','dialMethod','preview','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','enqueue','isNil','actions','info','Queue','queue','pTalking:\x20','contactId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','logCustomer','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','countnosuchnumberretry','unlockAgent','activeContact','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','dialAnswer','custom:agentconnect','connect','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','[syncHangup][talking][decrement]','uniqueid','\x20Queue','linkedid','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','additional','cloneAction','dialBusyMaxRetry','NOANSWER','countnoanswerretry','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','NoAnswer','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','reason','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','active','SIP/%s','reachable','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][getContactPreview]','Call\x20unsuccessful','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','dialOriginateCallerIdName','originatecalleridname','originatecalleridnum','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','[originateFailure][logOriginateFailure]','actionid','logLookAgent','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','[syncHangup][talking][cause]','cause','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','lodash','ioredis'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5a45,0x143));var _0x55a4=function(_0x51069d,_0x51ce9d){_0x51069d=_0x51069d-0x0;var _0x3d9440=_0x5a45[_0x51069d];return _0x3d9440;};'use strict';var util=require('util');var _=require(_0x55a4('0x0'));var uuid=require('uuid');var moment=require('moment');var Redis=require(_0x55a4('0x1'));var config=require(_0x55a4('0x2'));var logger=require(_0x55a4('0x3'))('preview');var loggerAction=require(_0x55a4('0x3'))(_0x55a4('0x4'));var ami=require(_0x55a4('0x5'));var rpcDb=require(_0x55a4('0x6'));var cmHopperAdditionalPhone=require(_0x55a4('0x7'));var Action=require(_0x55a4('0x8'));var ut=require('./util/util');var utils=require(_0x55a4('0x9'));config[_0x55a4('0xa')]=_[_0x55a4('0xb')](config[_0x55a4('0xa')],{'host':_0x55a4('0xc'),'port':0x18eb});var io=require(_0x55a4('0xd'))(new Redis(config[_0x55a4('0xa')]));var Sequence=function(){};Sequence[_0x55a4('0xe')]['enqueue']=function(_0x2520a6){this[_0x55a4('0xf')]=this[_0x55a4('0xf')]?this[_0x55a4('0xf')][_0x55a4('0x10')](_0x2520a6):_0x2520a6();};function Preview(_0x299b7d){this[_0x55a4('0x11')]=new Sequence();this[_0x55a4('0x12')]=_0x299b7d[_0x55a4('0x13')];this[_0x55a4('0x14')]=_0x299b7d[_0x55a4('0x14')];this['actions']={};this[_0x55a4('0x15')]=_0x299b7d[_0x55a4('0x15')];this[_0x55a4('0x16')]=0x0;ami['on'](_0x55a4('0x17'),this[_0x55a4('0x18')]['bind'](this));ami['on'](_0x55a4('0x19'),this[_0x55a4('0x1a')]['bind'](this));ami['on'](_0x55a4('0x1b'),this[_0x55a4('0x1c')][_0x55a4('0x1d')](this));ami['on'](_0x55a4('0x1e'),this[_0x55a4('0x1f')][_0x55a4('0x1d')](this));ami['on'](_0x55a4('0x20'),this[_0x55a4('0x21')][_0x55a4('0x1d')](this));ami['on'](_0x55a4('0x22'),this[_0x55a4('0x23')][_0x55a4('0x1d')](this));ami['on'](_0x55a4('0x24'),this['syncAttendedTransfer'][_0x55a4('0x1d')](this));ami['on'](_0x55a4('0x25'),this[_0x55a4('0x26')][_0x55a4('0x1d')](this));this[_0x55a4('0x27')](this[_0x55a4('0x12')]);}function emit(_0x3999e7,_0x333916,_0x36a3fc){io['to'](_0x3999e7)[_0x55a4('0x28')](_0x333916,_0x36a3fc);}function emitVoiceQueueChannelRemove(_0x547531){logger['info'](_0x55a4('0x29'),JSON[_0x55a4('0x2a')](_0x547531));emit(util[_0x55a4('0x2b')](_0x55a4('0x2c'),_0x547531['name']),_0x55a4('0x2d'),_0x547531);io[_0x55a4('0x28')](_0x55a4('0x2e'),_0x547531);}function notSendMessagesQueue(_0x2fa4b0){if(_0x2fa4b0['sendMessageOneNotActive']){if(_0x2fa4b0[_0x55a4('0x2f')]===0x0&&_0x2fa4b0[_0x55a4('0x30')]===0x0){_0x2fa4b0[_0x55a4('0x31')]=![];_0x2fa4b0['available']=0x0;_0x2fa4b0[_0x55a4('0x32')]=0x0;_0x2fa4b0[_0x55a4('0x33')]=utils[_0x55a4('0x34')][_0x55a4('0x35')];ut[_0x55a4('0x36')](_0x55a4('0x37'),_0x2fa4b0[_0x55a4('0x38')]+_0x55a4('0x39'));}else{_0x2fa4b0['message']=utils[_0x55a4('0x34')][_0x55a4('0x3a')];ut[_0x55a4('0x36')](_0x55a4('0x37'),_0x2fa4b0[_0x55a4('0x38')]+_0x55a4('0x3b'));}}}Preview[_0x55a4('0xe')][_0x55a4('0x27')]=function(){var _0x411d86=this;setInterval(function(){_0x411d86[_0x55a4('0x3c')]();},0x7cf);};Preview[_0x55a4('0xe')]['syncCampaigns']=function(){var _0x529849=this[_0x55a4('0x12')];this[_0x55a4('0x16')]+=0x1;for(var _0x3e785b in _0x529849){if(_0x529849['hasOwnProperty'](_0x3e785b)&&(_0x529849[_0x3e785b][_0x55a4('0x3d')]===_0x55a4('0x3e')||_0x529849[_0x3e785b][_0x55a4('0x3d')]===_0x55a4('0x3f'))&&_0x529849[_0x3e785b][_0x55a4('0x40')]===_0x55a4('0x41')){if(this[_0x55a4('0x16')]>0x7){this[_0x55a4('0x16')]=0x0;this[_0x55a4('0x42')]();}}if(_0x529849[_0x55a4('0x43')](_0x3e785b)&&_0x529849[_0x3e785b][_0x55a4('0x3d')]===_0x55a4('0x3e')&&_0x529849[_0x3e785b]['type']===_0x55a4('0x41')){if(_0x529849[_0x3e785b][_0x55a4('0x44')]){this[_0x55a4('0x45')](_0x529849[_0x3e785b]);if(_0x529849[_0x3e785b][_0x55a4('0x46')])this['recallMe'](_0x529849[_0x3e785b]);}else{notSendMessagesQueue(_0x529849[_0x3e785b]);}}}};Preview[_0x55a4('0xe')][_0x55a4('0x47')]=function(_0x58b306){var _0x29f4d0=this;this[_0x55a4('0x11')][_0x55a4('0x48')](function(){if(!_[_0x55a4('0x49')](_0x29f4d0[_0x55a4('0x4a')][_0x58b306])){loggerAction[_0x55a4('0x4b')]('[clearZombieChannels][talking]',_0x58b306,_0x55a4('0x4c'),_0x29f4d0[_0x55a4('0x4a')][_0x58b306][_0x55a4('0x4d')],'originated:\x20',JSON[_0x55a4('0x2a')](_0x29f4d0['campaignsPreview'][_0x29f4d0[_0x55a4('0x4a')][_0x58b306][_0x55a4('0x4d')]][_0x55a4('0x2f')]),_0x55a4('0x4e'),JSON[_0x55a4('0x2a')](_0x29f4d0[_0x55a4('0x12')][_0x29f4d0['actions'][_0x58b306]['queue']][_0x55a4('0x30')]),JSON[_0x55a4('0x2a')](_0x29f4d0[_0x55a4('0x4a')][_0x58b306]['dialAnswer']),JSON[_0x55a4('0x2a')](_['pick'](_0x29f4d0[_0x55a4('0x4a')][_0x58b306],[_0x55a4('0x4f'),'UserId',_0x55a4('0x50'),_0x55a4('0x51')])));return ami[_0x55a4('0x52')]({'action':_0x55a4('0x53'),'channel':_0x29f4d0[_0x55a4('0x4a')][_0x58b306][_0x55a4('0x54')]})[_0x55a4('0x55')](function(_0x45457e){if(_0x45457e[_0x55a4('0x33')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x29f4d0[_0x55a4('0x4a')][_0x58b306]){ut[_0x55a4('0x56')](_0x29f4d0[_0x55a4('0x12')][_0x29f4d0['actions'][_0x58b306][_0x55a4('0x4d')]],_0x55a4('0x57'));if(_0x29f4d0[_0x55a4('0x4a')][_0x58b306]['dialAnswer']===!![]){ut[_0x55a4('0x58')](_0x29f4d0[_0x55a4('0x12')][_0x29f4d0[_0x55a4('0x4a')][_0x58b306]['queue']],_0x55a4('0x57'));ut[_0x55a4('0x59')](_0x55a4('0x5a')+_0x58b306,_0x29f4d0[_0x55a4('0x4a')][_0x58b306][_0x55a4('0x4d')]);}ut[_0x55a4('0x59')](_0x55a4('0x5b')+_0x58b306,_0x29f4d0[_0x55a4('0x4a')][_0x58b306][_0x55a4('0x4d')]);delete _0x29f4d0[_0x55a4('0x4a')][_0x58b306];}},0x2328);}});}});};Preview[_0x55a4('0xe')][_0x55a4('0x42')]=function(){var _0x2c1919=this;loggerAction['info'](_0x55a4('0x5c'),_[_0x55a4('0x5d')](this[_0x55a4('0x4a')]));for(var _0x5f0037 in this[_0x55a4('0x4a')]){if(_0x2c1919[_0x55a4('0x4a')][_0x55a4('0x43')](_0x5f0037)){_0x2c1919[_0x55a4('0x47')](_0x5f0037);}}};Preview[_0x55a4('0xe')][_0x55a4('0x5e')]=function(_0x12da54){var _0x50f558=this;rpcDb[_0x55a4('0x5f')](_0x12da54['id'],ut[_0x55a4('0x60')](this[_0x55a4('0x15')]))[_0x55a4('0x61')](function(_0x17be81){if(!_[_0x55a4('0x49')](_0x17be81)){for(var _0x42c377=0x0;_0x42c377<_0x17be81[_0x55a4('0x62')];_0x42c377+=0x1){if(ut[_0x55a4('0x63')](_0x17be81[_0x42c377][_0x55a4('0x64')])<_0x12da54['dialRecallMeTimeout']*0x3c){if(_0x17be81[_0x42c377][_0x55a4('0x65')]&&!_0x17be81[_0x42c377][_0x55a4('0x65')][_0x55a4('0x66')]){_0x50f558[_0x55a4('0x67')](_0x17be81[_0x42c377]['id'])[_0x55a4('0x61')](ut[_0x55a4('0x68')](_0x55a4('0x69')))[_0x55a4('0x55')](ut[_0x55a4('0x68')](_0x55a4('0x69')));}else{rpcDb[_0x55a4('0x6a')](_0x17be81[_0x42c377]['id']);}}else{var _0x31654b=new Action(_0x17be81[_0x42c377],_0x12da54);_0x31654b[_0x55a4('0x6b')]=moment()['format'](_0x55a4('0x6c'));_0x12da54['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x31654b,0x17,_0x55a4('0x6d'));if(_0x12da54[_0x55a4('0x6e')]){rpcDb[_0x55a4('0x6f')](ut[_0x55a4('0x70')](_0x17be81[_0x42c377]));rpcDb[_0x55a4('0x71')](_0x31654b,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x55a4('0x72')](_0x31654b,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x31654b,_0x55a4('0x73'));rpcDb[_0x55a4('0x74')](_0x31654b,_0x55a4('0x73'));}}}}})[_0x55a4('0x55')](ut[_0x55a4('0x68')]('[getContactRecallMe]'));};Preview['prototype']['setMessage']=function(_0x8ed5df){_0x8ed5df[_0x55a4('0x31')]=!![];if(ut[_0x55a4('0x75')](_0x8ed5df[_0x55a4('0x76')])){_0x8ed5df[_0x55a4('0x33')]=utils[_0x55a4('0x34')][_0x55a4('0x77')];}else if(!ut[_0x55a4('0x78')](_0x8ed5df[_0x55a4('0x44')])){_0x8ed5df[_0x55a4('0x33')]=utils['CAMPAIGN_STATUS'][_0x55a4('0x35')];}else if(!this[_0x55a4('0x79')](_0x8ed5df['Trunk'])){if(!this[_0x55a4('0x79')](_0x8ed5df[_0x55a4('0x7a')])){_0x8ed5df['message']=utils['CAMPAIGN_STATUS'][_0x55a4('0x7b')];}else{_0x8ed5df[_0x55a4('0x33')]=utils[_0x55a4('0x34')][_0x55a4('0x7c')];}}else{_0x8ed5df['message']=utils[_0x55a4('0x34')][_0x55a4('0x7c')];}};Preview[_0x55a4('0xe')][_0x55a4('0x7d')]=function(_0x3cf9cf,_0x400891,_0x4afbcd){var _0x156e9e=this;var _0x281ff6=this['actions'][_0x400891];var _0x2d6c29=this[_0x55a4('0x12')][_0x281ff6[_0x55a4('0x4d')]];var _0x5d2bf8;var _0x18700e=![];var _0x4d7930=0x2;var _0x4cf9c7=0x3;if(_0x2d6c29){switch(_0x4afbcd){case'1':_0x2d6c29[_0x55a4('0x7e')]+=0x1;_0x281ff6['countnosuchnumberretry']+=0x1;_0x281ff6[_0x55a4('0x7f')]=ut[_0x55a4('0x80')](_0x281ff6);ut['logCustomer'](_0x281ff6,0x0,_0x55a4('0x81'));ami[_0x55a4('0x28')](_0x55a4('0x82'),ut[_0x55a4('0x83')](_0x281ff6,'nosuchnumber'));rpcDb[_0x55a4('0x71')](_0x281ff6,_0x55a4('0x84'));_0x156e9e['verifyAdditionalPhones'](_0x281ff6,'0',_0x2d6c29)['then'](function(_0xb3e9c8){_0x18700e=_0xb3e9c8['additional']==0x1;_0x4d7930=_0x2d6c29[_0x55a4('0x85')];_0x4cf9c7=_0x2d6c29[_0x55a4('0x86')];if(!_0x18700e){if(ut['totalGlobal'](_0x281ff6)>=_0x2d6c29[_0x55a4('0x87')]){_0x5d2bf8=ut['cloneAction'](_0x281ff6,0xf,_0x55a4('0x88'));rpcDb[_0x55a4('0x74')](_0x5d2bf8,_0x55a4('0x89'));}else{if(_0x281ff6['countnosuchnumberretry']>=_0x2d6c29[_0x55a4('0x8a')]){rpcDb[_0x55a4('0x74')](_0x281ff6,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x55a4('0x8b')](ut[_0x55a4('0x8c')](_0x281ff6,_0x55a4('0x8d'),_0x2d6c29[_0x55a4('0x85')]),_0x281ff6[_0x55a4('0x8e')],_0x281ff6[_0x55a4('0x8f')]);}}delete this[_0x55a4('0x4a')][_0x3cf9cf['linkedid']];}else{_0x281ff6[_0x55a4('0x8d')]++;logger[_0x55a4('0x4b')](_0x55a4('0x90'),_0x281ff6['countnosuchnumberretry']);logger[_0x55a4('0x4b')]('id',_0x281ff6[_0x55a4('0x91')]);_0x156e9e[_0x55a4('0x92')]({'id':_0x281ff6[_0x55a4('0x91')],'field':{'countnosuchnumberretry':_0x281ff6['countnosuchnumberretry']}})[_0x55a4('0x61')](function(){_0x156e9e[_0x55a4('0x93')](_0x281ff6,_0x4d7930,_0x4cf9c7)[_0x55a4('0x61')](function(){});});}});break;case _0x55a4('0x94'):var _0x160ac6=moment()[_0x55a4('0x2b')](_0x55a4('0x6c'));_0x281ff6[_0x55a4('0x95')]=_0x160ac6;_0x281ff6[_0x55a4('0x96')]=_0x160ac6;_0x281ff6[_0x55a4('0x97')]=!![];_0x2d6c29[_0x55a4('0x30')]+=0x1;logger[_0x55a4('0x4b')]('[syncHangup][talking][increment]',_0x281ff6['uniqueid'],'\x20Queue',_0x2d6c29['name'],'pTalking:\x20',_0x2d6c29['pTalking']);ami[_0x55a4('0x28')](_0x55a4('0x98'),ut['buildObj'](_0x281ff6,_0x55a4('0x99'),this[_0x55a4('0x12')][_0x281ff6[_0x55a4('0x4d')]]));if(_0x2d6c29['acw']){ami[_0x55a4('0x28')](_0x55a4('0x9a'),ut['buildAcw'](_0x281ff6));}break;case'16':ami[_0x55a4('0x28')](_0x55a4('0x9b'),ut['buildObj'](_0x281ff6,_0x55a4('0x9c'),this['campaignsPreview'][_0x281ff6[_0x55a4('0x4d')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x281ff6,_0x55a4('0x9c')));_0x2d6c29[_0x55a4('0x9d')]+=0x1;_0x2d6c29[_0x55a4('0x9e')]+=0x1;_0x2d6c29['answered']+=0x1;ut[_0x55a4('0x58')](_0x2d6c29,_0x55a4('0x9f'));_0x281ff6[_0x55a4('0x7f')]=ut[_0x55a4('0x80')](_0x281ff6);ut[_0x55a4('0x72')](_0x281ff6,0x4,'Answer');rpcDb[_0x55a4('0x71')](_0x281ff6,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x55a4('0x74')](_0x281ff6,_0x55a4('0xa0'));rpcDb['crateCustomerReportQueue'](_0x281ff6);_0x2d6c29[_0x55a4('0xa1')]+=_0x281ff6[_0x55a4('0xa2')];_0x2d6c29['sumBillable']+=_0x281ff6[_0x55a4('0xa2')];logger['info'](_0x55a4('0xa3'),_0x281ff6[_0x55a4('0xa4')],_0x55a4('0xa5'),_0x2d6c29['name'],_0x55a4('0x4e'),_0x2d6c29[_0x55a4('0x30')]);delete this[_0x55a4('0x4a')][_0x3cf9cf[_0x55a4('0xa6')]];break;case _0x55a4('0xa7'):_0x2d6c29['outboundBusyCallsDay']+=0x1;_0x281ff6[_0x55a4('0xa8')]+=0x1;_0x281ff6['countglobal']=ut[_0x55a4('0x80')](_0x281ff6);ut[_0x55a4('0x72')](_0x281ff6,0x5,_0x55a4('0xa9'));_0x4d7930=_0x2d6c29[_0x55a4('0xaa')];_0x4cf9c7=_0x2d6c29[_0x55a4('0x86')];ami[_0x55a4('0x28')](_0x55a4('0xab'),ut[_0x55a4('0x83')](_0x281ff6,'busy'));rpcDb['createCustomerHistory'](_0x281ff6,_0x55a4('0xac'));_0x156e9e[_0x55a4('0xad')](_0x281ff6,'5',_0x2d6c29)['then'](function(_0x359b11){_0x18700e=_0x359b11[_0x55a4('0xae')]==0x1;if(!_0x18700e){if(ut[_0x55a4('0x80')](_0x281ff6)>=_0x2d6c29[_0x55a4('0x87')]){_0x5d2bf8=ut[_0x55a4('0xaf')](_0x281ff6,0xf,'Global');rpcDb[_0x55a4('0x74')](_0x5d2bf8,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x281ff6[_0x55a4('0xa8')]>=_0x2d6c29[_0x55a4('0xb0')]){rpcDb[_0x55a4('0x74')](_0x281ff6,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x55a4('0x8b')](ut[_0x55a4('0x8c')](_0x281ff6,_0x55a4('0xa8'),_0x2d6c29[_0x55a4('0xaa')]),_0x281ff6[_0x55a4('0x8e')],_0x281ff6['activeContact']);}}}else{_0x281ff6[_0x55a4('0xa8')]++;_0x156e9e[_0x55a4('0x92')]({'id':_0x281ff6[_0x55a4('0x91')],'field':{'countbusyretry':_0x281ff6[_0x55a4('0xa8')]}})[_0x55a4('0x61')](function(){_0x156e9e[_0x55a4('0x93')](_0x281ff6,_0x4d7930,_0x4cf9c7)[_0x55a4('0x61')](function(){});});}});break;case _0x55a4('0xb1'):_0x2d6c29['outboundNoAnswerCallsDay']+=0x1;_0x281ff6[_0x55a4('0xb2')]+=0x1;_0x281ff6[_0x55a4('0x7f')]=ut[_0x55a4('0x80')](_0x281ff6);ut[_0x55a4('0x72')](_0x281ff6,0x3,'NoAnswer');_0x4d7930=_0x2d6c29['dialNoAnswerRetryFrequency'];_0x4cf9c7=_0x2d6c29[_0x55a4('0x86')];var _0x3d887f=ut[_0x55a4('0xb3')](_0x281ff6,_0x2d6c29);ami['emit']('custom:agentnoanswer',_0x3d887f);rpcDb[_0x55a4('0x71')](_0x281ff6,'[callProgressDetectingCustomer][logNoAnswer]');_0x156e9e[_0x55a4('0xad')](_0x281ff6,'3',_0x2d6c29)[_0x55a4('0x61')](function(_0x562901){_0x18700e=_0x562901[_0x55a4('0xae')]==0x1;if(!_0x18700e){if(ut[_0x55a4('0x80')](_0x281ff6)>=_0x2d6c29[_0x55a4('0x87')]){_0x5d2bf8=ut['cloneAction'](_0x281ff6,0xf,'Global');rpcDb[_0x55a4('0x74')](_0x5d2bf8,_0x55a4('0xb4'));}else{if(_0x281ff6[_0x55a4('0xb2')]>=_0x2d6c29[_0x55a4('0xb5')]){rpcDb[_0x55a4('0x74')](_0x281ff6,_0x55a4('0xb6'));}else{rpcDb[_0x55a4('0x8b')](ut[_0x55a4('0x8c')](_0x281ff6,_0x55a4('0xb2'),_0x2d6c29[_0x55a4('0xb7')]),_0x281ff6[_0x55a4('0x8e')],_0x281ff6['activeContact']);}}}else{_0x281ff6[_0x55a4('0xb2')]++;_0x156e9e[_0x55a4('0x92')]({'id':_0x281ff6[_0x55a4('0x91')],'field':{'countnoanswerretry':_0x281ff6['countnoanswerretry']}})[_0x55a4('0x61')](function(){_0x156e9e[_0x55a4('0x93')](_0x281ff6,_0x4d7930,_0x4cf9c7)['then'](function(){});});}});break;case _0x55a4('0xb8'):_0x2d6c29[_0x55a4('0xb9')]+=0x1;_0x281ff6['countcongestionretry']+=0x1;_0x281ff6[_0x55a4('0x7f')]=ut[_0x55a4('0x80')](_0x281ff6);ut[_0x55a4('0x72')](_0x281ff6,0x8,_0x55a4('0xba'));_0x4d7930=_0x2d6c29[_0x55a4('0xbb')];_0x4cf9c7=_0x2d6c29[_0x55a4('0x86')];ami[_0x55a4('0x28')](_0x55a4('0xbc'),ut['buildObj'](_0x281ff6,_0x55a4('0xbd')));rpcDb['createCustomerHistory'](_0x281ff6,_0x55a4('0xbe'));_0x156e9e['verifyAdditionalPhones'](_0x281ff6,'8',_0x2d6c29)[_0x55a4('0x61')](function(_0x4e4fb5){_0x18700e=_0x4e4fb5['additional']==0x1;if(!_0x18700e){if(ut[_0x55a4('0x80')](_0x281ff6)>=_0x2d6c29[_0x55a4('0x87')]){_0x5d2bf8=ut['cloneAction'](_0x281ff6,0xf,'Global');rpcDb[_0x55a4('0x74')](_0x5d2bf8,_0x55a4('0xbf'));}else{if(_0x281ff6[_0x55a4('0xc0')]>=_0x2d6c29[_0x55a4('0xc1')]){rpcDb[_0x55a4('0x74')](_0x281ff6,_0x55a4('0xbe'));}else{rpcDb['rescheduleContact'](ut[_0x55a4('0x8c')](_0x281ff6,'countcongestionretry',_0x2d6c29[_0x55a4('0xaa')]),_0x281ff6[_0x55a4('0x8e')],_0x281ff6[_0x55a4('0x8f')]);}}}else{_0x281ff6[_0x55a4('0xc0')]++;_0x156e9e['incrementPreviewCounters']({'id':_0x281ff6[_0x55a4('0x91')],'field':{'countcongestionretry':_0x281ff6[_0x55a4('0xc0')]}})[_0x55a4('0x61')](function(){_0x156e9e[_0x55a4('0x93')](_0x281ff6,_0x4d7930,_0x4cf9c7)[_0x55a4('0x61')](function(){});});}});break;case'CANCEL':_0x2d6c29[_0x55a4('0xc2')]+=0x1;_0x281ff6[_0x55a4('0xc3')]+=0x1;_0x281ff6[_0x55a4('0x7f')]=ut[_0x55a4('0x80')](_0x281ff6);ut[_0x55a4('0x72')](_0x281ff6,0x14,_0x55a4('0xc4'));_0x4d7930=_0x2d6c29[_0x55a4('0xc5')];_0x4cf9c7=_0x2d6c29[_0x55a4('0x86')];ami[_0x55a4('0x28')](_0x55a4('0xc6'),ut['buildObj'](_0x281ff6,_0x55a4('0xc7')));rpcDb['createCustomerHistory'](_0x281ff6,_0x55a4('0xc8'));_0x156e9e[_0x55a4('0xad')](_0x281ff6,'20',_0x2d6c29)[_0x55a4('0x61')](function(_0x526291){_0x18700e=_0x526291[_0x55a4('0xae')]==0x1;if(!_0x18700e){if(ut[_0x55a4('0x80')](_0x281ff6)>=_0x2d6c29[_0x55a4('0x87')]){_0x5d2bf8=ut[_0x55a4('0xaf')](_0x281ff6,0x14,'AgentReject');rpcDb[_0x55a4('0x74')](_0x5d2bf8,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x281ff6[_0x55a4('0xc3')]>=_0x2d6c29[_0x55a4('0xc9')]){rpcDb['createCustomerFinal'](_0x281ff6,_0x55a4('0xca'));}else{rpcDb[_0x55a4('0x8b')](ut[_0x55a4('0x8c')](_0x281ff6,_0x55a4('0xc3'),_0x2d6c29[_0x55a4('0xc5')]),_0x281ff6[_0x55a4('0x8e')],_0x281ff6[_0x55a4('0x8f')]);}}}else{_0x281ff6[_0x55a4('0xb2')]++;_0x156e9e[_0x55a4('0x92')]({'id':_0x281ff6[_0x55a4('0x91')],'field':{'countnoanswerretry':_0x281ff6['countnoanswerretry']}})[_0x55a4('0x61')](function(){_0x156e9e[_0x55a4('0x93')](_0x281ff6,_0x4d7930,_0x4cf9c7)['then'](function(){});});}});break;case _0x55a4('0xcb'):_0x2d6c29[_0x55a4('0xcc')]+=0x1;_0x281ff6[_0x55a4('0xcd')]+=0x1;_0x281ff6[_0x55a4('0x7f')]=ut[_0x55a4('0x80')](_0x281ff6);ut[_0x55a4('0x72')](_0x281ff6,0xb,_0x55a4('0xce'));rpcDb[_0x55a4('0x71')](_0x281ff6,_0x55a4('0xcf'));_0x156e9e[_0x55a4('0xad')](_0x281ff6,'11',_0x2d6c29)[_0x55a4('0x61')](function(_0x5d1162){_0x18700e=_0x5d1162[_0x55a4('0xae')]==0x1;if(!_0x18700e){if(ut[_0x55a4('0x80')](_0x281ff6)>=_0x2d6c29[_0x55a4('0x87')]){_0x5d2bf8=ut['cloneAction'](_0x281ff6,0xf,_0x55a4('0x88'));rpcDb[_0x55a4('0x74')](_0x5d2bf8,_0x55a4('0xcf'));}else{if(_0x281ff6['countabandonedetry']>=_0x2d6c29['dialAbandonedMaxRety']){rpcDb[_0x55a4('0x74')](_0x281ff6,_0x55a4('0xcf'));}else{rpcDb[_0x55a4('0x8b')](ut['scheduledAt'](_0x281ff6,_0x55a4('0xcd'),_0x2d6c29[_0x55a4('0xd0')]),_0x281ff6[_0x55a4('0x8e')],_0x281ff6['activeContact']);}}}else{_0x281ff6['countnoanswerretry']++;_0x156e9e['incrementPreviewCounters']({'id':_0x281ff6[_0x55a4('0x91')],'field':{'countnoanswerretry':_0x281ff6[_0x55a4('0xb2')]}})[_0x55a4('0x61')](function(){_0x156e9e['swapAdditionalPhones'](_0x281ff6,_0x4d7930,_0x4cf9c7)['then'](function(){});});}});break;case'18':_0x2d6c29[_0x55a4('0xd1')]+=0x1;_0x281ff6[_0x55a4('0xd2')]+=0x1;_0x281ff6[_0x55a4('0x7f')]=ut[_0x55a4('0x80')](_0x281ff6);ut[_0x55a4('0x72')](_0x281ff6,0x12,_0x3cf9cf[_0x55a4('0xd3')]||_0x3cf9cf[_0x55a4('0xd4')]);ami[_0x55a4('0x28')](_0x55a4('0xd5'),ut[_0x55a4('0x83')](_0x281ff6,_0x55a4('0xd6')));rpcDb[_0x55a4('0x71')](_0x281ff6,_0x55a4('0xd7'));_0x156e9e['verifyAdditionalPhones'](_0x281ff6,'18',_0x2d6c29)[_0x55a4('0x61')](function(_0xf6619d){_0x18700e=_0xf6619d[_0x55a4('0xae')]==0x1;if(!_0x18700e){if(ut[_0x55a4('0x80')](_0x281ff6)>=_0x2d6c29[_0x55a4('0x87')]){_0x5d2bf8=ut[_0x55a4('0xaf')](_0x281ff6,0x12,_0x55a4('0x88'));rpcDb[_0x55a4('0x74')](_0x5d2bf8,_0x55a4('0xd7'));}else{rpcDb[_0x55a4('0x74')](_0x281ff6,_0x55a4('0xd7'));}}else{_0x281ff6[_0x55a4('0xb2')]++;_0x156e9e[_0x55a4('0x92')]({'id':_0x281ff6[_0x55a4('0x91')],'field':{'countnoanswerretry':_0x281ff6['countnoanswerretry']}})[_0x55a4('0x61')](function(){_0x156e9e[_0x55a4('0x93')](_0x281ff6,_0x4d7930,_0x4cf9c7)[_0x55a4('0x61')](function(){});});}});delete this[_0x55a4('0x4a')][_0x3cf9cf[_0x55a4('0xa6')]];break;case'19':_0x2d6c29[_0x55a4('0xd1')]+=0x1;_0x281ff6['countglobal']=ut['totalGlobal'](_0x281ff6);ut[_0x55a4('0x72')](_0x281ff6,0x13,_0x3cf9cf[_0x55a4('0xd3')]||_0x3cf9cf[_0x55a4('0xd4')]);ami[_0x55a4('0x28')](_0x55a4('0xd5'),ut[_0x55a4('0x83')](_0x281ff6,'amd'));rpcDb[_0x55a4('0x71')](_0x281ff6,_0x55a4('0xd8'));_0x156e9e[_0x55a4('0xad')](_0x281ff6,'18',_0x2d6c29)[_0x55a4('0x61')](function(_0x2e3ac6){_0x18700e=_0x2e3ac6[_0x55a4('0xae')]==0x1;if(!_0x18700e){if(ut[_0x55a4('0x80')](_0x281ff6)>=_0x2d6c29['dialGlobalMaxRetry']){_0x5d2bf8=ut[_0x55a4('0xaf')](_0x281ff6,0xf,'Global');rpcDb['createCustomerFinal'](_0x5d2bf8,_0x55a4('0xd8'));}else{rpcDb[_0x55a4('0x74')](_0x281ff6,_0x55a4('0xd8'));}}else{_0x281ff6[_0x55a4('0xb2')]++;_0x156e9e[_0x55a4('0x92')]({'id':_0x281ff6['idContact'],'field':{'countnoanswerretry':_0x281ff6[_0x55a4('0xb2')]}})[_0x55a4('0x61')](function(){_0x156e9e[_0x55a4('0x93')](_0x281ff6,_0x4d7930,_0x4cf9c7)['then'](function(){});});}});delete this[_0x55a4('0x4a')][_0x3cf9cf[_0x55a4('0xa6')]];break;default:if(_0x281ff6[_0x55a4('0x97')]){ut[_0x55a4('0x58')](_0x2d6c29,_0x55a4('0xd9'));ut[_0x55a4('0x59')](_0x55a4('0xda')+_0x2d6c29['name'],_0x3cf9cf);}_0x2d6c29['outboundUnknownCallsDay']+=0x1;_0x281ff6['countglobal']=ut[_0x55a4('0x80')](_0x281ff6);ut[_0x55a4('0x72')](_0x281ff6,0xc,_0x3cf9cf['cause-txt']||_0x3cf9cf['dialstatus']);_0x4d7930=_0x2d6c29['dialAgentRejectRetryFrequency'];_0x4cf9c7=_0x2d6c29['callAdditionalPhoneAfterMin'];rpcDb[_0x55a4('0x71')](_0x281ff6,_0x55a4('0xdb'));_0x156e9e[_0x55a4('0xad')](_0x281ff6,'20',_0x2d6c29)[_0x55a4('0x61')](function(_0x5f1905){_0x18700e=_0x5f1905[_0x55a4('0xae')]==0x1;if(!_0x18700e){if(ut[_0x55a4('0x80')](_0x281ff6)>=_0x2d6c29['dialGlobalMaxRetry']){_0x5d2bf8=ut[_0x55a4('0xaf')](_0x281ff6,0xf,_0x55a4('0x88'));rpcDb[_0x55a4('0x74')](_0x5d2bf8,_0x55a4('0xdc'));}else{rpcDb[_0x55a4('0x74')](_0x281ff6,_0x55a4('0xdc'));}delete this['actions'][_0x3cf9cf['linkedid']];}else{_0x156e9e[_0x55a4('0x93')](_0x281ff6,_0x4d7930,_0x4cf9c7)['then'](function(){});}});}if(!(_0x281ff6[_0x55a4('0x97')]&&_0x4afbcd==='16')){ut[_0x55a4('0x56')](_0x2d6c29,'[callProgressDetectingCustomer]');logger[_0x55a4('0x4b')](_0x55a4('0xdd'),_0x281ff6['uniqueid'],_0x55a4('0xa5'),_0x2d6c29[_0x55a4('0x38')],_0x55a4('0xde'),_0x2d6c29[_0x55a4('0x2f')]);}if(_0x4afbcd!=='ANSWER'){delete this[_0x55a4('0x4a')][_0x3cf9cf[_0x55a4('0xa6')]];delete this[_0x55a4('0x4a')][_0x3cf9cf[_0x55a4('0xdf')]];}_0x2d6c29[_0x55a4('0xe0')]=!![];}};Preview[_0x55a4('0xe')][_0x55a4('0xe1')]=function(_0x719211,_0x3cc76c,_0x214bc9){if(_[_0x55a4('0xe2')](_0x3cc76c)&&'object'!==typeof _0x3cc76c){return;}if(_['isUndefined'](_0x214bc9)&&_0x55a4('0xe3')!==typeof _0x214bc9){return;}switch(_0x214bc9['reason']){case'0':ut['logAgent'](_0x719211,0x0,_0x55a4('0x81'));rpcDb[_0x55a4('0xe4')](_0x719211,_0x55a4('0xe5'));break;case'3':ut[_0x55a4('0xe6')](_0x719211,0x3,_0x55a4('0xe7'));rpcDb[_0x55a4('0xe4')](_0x719211,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x719211,0x5,_0x55a4('0xa9'));rpcDb['createAgentHistory'](_0x719211,_0x55a4('0xe8'));break;case'8':ut[_0x55a4('0xe6')](_0x719211,0x8,_0x55a4('0xba'));rpcDb[_0x55a4('0xe4')](_0x719211,_0x55a4('0xe9'));break;case'22':ut[_0x55a4('0xe6')](_0x719211,0x16,'AnswerAGI');rpcDb[_0x55a4('0xe4')](_0x719211,_0x55a4('0xea'));break;default:ut[_0x55a4('0xe6')](_0x719211,0xc,_0x214bc9[_0x55a4('0xeb')]);rpcDb[_0x55a4('0xe4')](_0x719211,_0x55a4('0xe9'));}ut['updateOriginated'](_0x3cc76c,'[callProgressDetectingAgent]');logger[_0x55a4('0x4b')](_0x55a4('0xec'),_0x719211[_0x55a4('0xa4')],'\x20Queue',_0x3cc76c['name'],_0x55a4('0xde'),_0x3cc76c[_0x55a4('0x2f')]);delete this['actions'][_0x719211['uniqueid']];};Preview[_0x55a4('0xe')][_0x55a4('0xad')]=function(_0x4c01b7,_0x436304,_0x53867c){return cmHopperAdditionalPhone[_0x55a4('0xad')](_0x4c01b7,_0x436304,_0x53867c)[_0x55a4('0x55')](logger[_0x55a4('0x4b')](_0x55a4('0xed')));};Preview['prototype'][_0x55a4('0x93')]=function(_0x271219,_0x226faa,_0x1935f9){return cmHopperAdditionalPhone[_0x55a4('0x93')](_0x271219,_0x226faa,_0x1935f9)[_0x55a4('0x55')](logger[_0x55a4('0x4b')](_0x55a4('0xee')));};Preview[_0x55a4('0xe')][_0x55a4('0x92')]=function(_0x418b76){return Promise[_0x55a4('0xef')]()[_0x55a4('0x61')](cmHopperAdditionalPhone[_0x55a4('0x92')](_0x418b76))[_0x55a4('0x55')](logger[_0x55a4('0x4b')](_0x55a4('0xf0')));};Preview[_0x55a4('0xe')][_0x55a4('0xf1')]=function(_0x5f4b37,_0x25ffda,_0x3d4d50,_0x2368ac,_0x53cdda){var _0xcb388=this;return new Promise(function(_0x1884cc,_0x2c4abb){if(_[_0x55a4('0x49')](_0x25ffda)||_[_0x55a4('0x49')](_0x25ffda[_0x55a4('0xf2')])||_[_0x55a4('0x49')](_0x25ffda[_0x55a4('0xf3')])||_[_0x55a4('0x49')](_0x25ffda[_0x55a4('0x50')])){_0x2c4abb(ut[_0x55a4('0x33')]('Contact\x20is\x20undefined',_0x2368ac,_0x53cdda));return;}var _0x34c9d0=uuid['v4']();var _0x227317=_0xcb388[_0x55a4('0x12')][_0x25ffda[_0x55a4('0x4c')][_0x55a4('0x38')]];var _0x26520e=_0x3d4d50?_0xcb388['agents'][_0x3d4d50]['id']:undefined;_0xcb388[_0x55a4('0x4a')][_0x34c9d0]=new Action(_0x25ffda,_0x227317,_0x34c9d0,_0x3d4d50,_0x26520e);var _0x55dd5e=_0xcb388['actions'][_0x34c9d0];_0x55dd5e[_0x55a4('0x8e')]=_0x2368ac;_0x55dd5e[_0x55a4('0x8f')]=_0x53cdda;_0x55dd5e[_0x55a4('0xf4')]=_0x3d4d50;if(_[_0x55a4('0xf5')](_0x5f4b37)){_0xcb388[_0x55a4('0xf6')](_0x55dd5e,_0x227317,_0x25ffda,_0x3d4d50)['then'](function(_0x3933e1){logger['info'](_0x55a4('0xf7'),_0x55a4('0xf8')+_0x55dd5e[_0x55a4('0x4d')]+_0x55a4('0xf9')+_0x55dd5e[_0x55a4('0x91')],JSON[_0x55a4('0x2a')](_0x3933e1));ami[_0x55a4('0x28')](_0x55a4('0xfa'),ut[_0x55a4('0x83')](_0x55dd5e,_0x55a4('0xfb'),_0xcb388[_0x55a4('0x12')][_0x55dd5e[_0x55a4('0x4d')]]));_0x1884cc(ut[_0x55a4('0x33')]('Calling'));})[_0x55a4('0x55')](function(_0x4ee1c6){ut['logger'](_0x55a4('0xfc'),_0x4ee1c6);_0x2c4abb(ut[_0x55a4('0x33')](_0x55a4('0xfd'),_0x2368ac,_0x53cdda));});}else{_0x227317['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x55dd5e);rpcDb[_0x55a4('0xfe')](_0x55dd5e,_0x55a4('0xff'));delete _0xcb388[_0x55a4('0x4a')][_0x34c9d0];_0x2c4abb(ut['message']('Contact\x20in\x20black\x20List',_0x2368ac,_0x53cdda));}});};Preview['prototype'][_0x55a4('0x79')]=function(_0x355b47){return!_[_0x55a4('0x49')](_0x355b47)&&!_[_0x55a4('0x49')](_0x355b47[_0x55a4('0x38')])&&!_['isNil'](_0x355b47[_0x55a4('0x100')])&&_0x355b47[_0x55a4('0x100')]&&!_[_0x55a4('0x49')](this[_0x55a4('0x14')][util[_0x55a4('0x2b')](_0x55a4('0x101'),_0x355b47[_0x55a4('0x38')])])&&!_[_0x55a4('0x49')](this[_0x55a4('0x14')][util[_0x55a4('0x2b')](_0x55a4('0x101'),_0x355b47[_0x55a4('0x38')])][_0x55a4('0x53')])&&(this['trunks'][util['format'](_0x55a4('0x101'),_0x355b47[_0x55a4('0x38')])][_0x55a4('0x53')]===_0x55a4('0x102')||this[_0x55a4('0x14')][util[_0x55a4('0x2b')](_0x55a4('0x101'),_0x355b47[_0x55a4('0x38')])][_0x55a4('0x53')]==='unmonitored');};Preview[_0x55a4('0xe')][_0x55a4('0x67')]=function(_0x2d3442,_0x49edf8){return this['execRun'](_0x2d3442,_0x49edf8)['then'](function(_0xa6362b){return _[_0x55a4('0x103')](_0xa6362b,[_0x55a4('0x33')]);})['catch'](function(_0x4d219c){if(_0x4d219c[_0x55a4('0x104')]){rpcDb[_0x55a4('0x105')](_0x2d3442);}if(_0x4d219c[_0x55a4('0x100')]){rpcDb[_0x55a4('0x6a')](_0x2d3442);}throw _[_0x55a4('0x103')](_0x4d219c,[_0x55a4('0x33')]);});};Preview[_0x55a4('0xe')]['execRun']=function(_0x2307cb,_0x10a4f4){var _0x43ed98=this;var _0x558e95,_0xde80b7;return rpcDb[_0x55a4('0x106')](_0x2307cb)[_0x55a4('0x61')](function(_0x1b4a33){if(!_[_0x55a4('0x49')](_0x1b4a33[0x0])){_0xde80b7=_0x1b4a33[0x0][_0x55a4('0x107')]?![]:!![];_0x558e95=_0x1b4a33[0x0][_0x55a4('0x107')]?!![]:![];_0x558e95=_0x10a4f4?!![]:_0x558e95;}var _0x5e19bc=_0x43ed98[_0x55a4('0x108')](_0x1b4a33);if(_0x5e19bc[_0x55a4('0x109')]){rpcDb[_0x55a4('0x10a')](_[_0x55a4('0x103')](_0x1b4a33[0x0],[_0x55a4('0x50'),_0x55a4('0xf3')]))['then'](function(_0x29d01b){_0x43ed98['checkInBlack'](_0x29d01b,_0x1b4a33[0x0],_0x10a4f4,_0xde80b7,_0x558e95)[_0x55a4('0x61')](function(_0x4f1c8f){return _0x4f1c8f;})['catch'](function(_0x3383bc){throw _0x3383bc;});})[_0x55a4('0x55')](function(_0x434f28){ut[_0x55a4('0x36')]('[Preview][checkIsBlackList]',_0x434f28);throw ut['message']('Call\x20unsuccessful',_0xde80b7,_0x558e95);});}else{throw ut[_0x55a4('0x33')](_0x5e19bc['message'],_0xde80b7,_0x558e95);}})['catch'](function(_0x8786d8){ut[_0x55a4('0x36')](_0x55a4('0x10b'),_0x8786d8);throw ut[_0x55a4('0x33')](_0x55a4('0x10c'),![],!![]);});};Preview['prototype'][_0x55a4('0x108')]=function(_0x132242){if(_[_0x55a4('0x49')](_0x132242)||_[_0x55a4('0xf5')](_0x132242)||!_[_0x55a4('0x49')](_0x132242[0x0][_0x55a4('0x65')])&&_[_0x55a4('0x49')](_0x132242[0x0]['Agent']['name'])){ut[_0x55a4('0x36')]('[Preview][validateContact][Empty\x20Contact]',_0x132242);return{'isValid':![],'message':'Empty\x20Contact'};}var _0xb67adc=this[_0x55a4('0x12')][_0x132242[0x0][_0x55a4('0x4c')][_0x55a4('0x38')]];_0xb67adc['message']=utils[_0x55a4('0x34')]['ACTIVE'];if(_[_0x55a4('0x49')](_0xb67adc)){ut[_0x55a4('0x36')]('[Preview][validateContact][Empty\x20Campaign]',_0xb67adc);return{'isValid':![],'message':_0x55a4('0x10d')};}if(!this[_0x55a4('0x79')](_0xb67adc[_0x55a4('0x10e')])){ut['logger'](_0x55a4('0x10f'),_0x55a4('0x110')+_0xb67adc[_0x55a4('0x38')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x55a4('0x79')](_0xb67adc[_0x55a4('0x7a')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xb67adc[_0x55a4('0x38')]+_0x55a4('0x111'));return{'isValid':![],'message':_0x55a4('0x112')};}}if(!ut['isActive'](_0xb67adc[_0x55a4('0x44')])){ut['logger'](_0x55a4('0x113'),_0xb67adc[_0x55a4('0x38')]+_0x55a4('0x114'));return{'isValid':![],'message':_0x55a4('0x110')+_0xb67adc[_0x55a4('0x38')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x55a4('0xe')][_0x55a4('0xf6')]=function(_0x5657bc,_0x33c5e9,_0x4fe6e8,_0x31e33f){var _0x4562e7=this;return new Promise(function(_0x2a6eea,_0x48d0d3){var _0x301cf4=_0x5657bc[_0x55a4('0xa4')];var _0x2f973b=_0x4562e7[_0x55a4('0x79')](_0x33c5e9[_0x55a4('0x10e')])?util[_0x55a4('0x2b')](_0x55a4('0x115'),_0x33c5e9[_0x55a4('0x10e')][_0x55a4('0x38')],_[_0x55a4('0x49')](_0x33c5e9[_0x55a4('0x116')])?'':_0x33c5e9[_0x55a4('0x116')][_0x55a4('0x117')]()||'',_0x33c5e9[_0x55a4('0x118')]>0x0?_0x4fe6e8[_0x55a4('0xf3')][_0x55a4('0x119')](_0x33c5e9[_0x55a4('0x118')]):_0x4fe6e8[_0x55a4('0xf3')]):util[_0x55a4('0x2b')](_0x55a4('0x115'),_[_0x55a4('0x49')](_0x33c5e9[_0x55a4('0x7a')])?_0x33c5e9['Trunk'][_0x55a4('0x38')]:_0x33c5e9[_0x55a4('0x7a')][_0x55a4('0x38')],_[_0x55a4('0x49')](_0x33c5e9['dialPrefix'])?'':_0x33c5e9[_0x55a4('0x116')]['trim']()||'',_0x33c5e9[_0x55a4('0x118')]>0x0?_0x4fe6e8[_0x55a4('0xf3')][_0x55a4('0x119')](_0x33c5e9['dialCutDigit']):_0x4fe6e8[_0x55a4('0xf3')]);var _0x27be65=_0x4562e7[_0x55a4('0x79')](_0x33c5e9[_0x55a4('0x10e')])?ut[_0x55a4('0x11a')](_0x33c5e9[_0x55a4('0x10e')]['callerid'],_0x33c5e9['dialOriginateCallerIdName'],_0x33c5e9[_0x55a4('0x11b')]>0x0?ut[_0x55a4('0x11c')](_0x33c5e9[_0x55a4('0x11d')],_0x33c5e9['dialRandomLastDigitCallerIdNumber']):_0x33c5e9[_0x55a4('0x11d')]):ut[_0x55a4('0x11a')](_[_0x55a4('0x49')](_0x33c5e9['TrunkBackup'])?_0x33c5e9[_0x55a4('0x10e')][_0x55a4('0x11e')]:_0x33c5e9[_0x55a4('0x7a')][_0x55a4('0x11e')],_0x33c5e9[_0x55a4('0x11f')],_0x33c5e9[_0x55a4('0x11b')]>0x0?ut['getCallerIdRandom'](_0x33c5e9[_0x55a4('0x11d')],_0x33c5e9[_0x55a4('0x11b')]):_0x33c5e9[_0x55a4('0x11d')]);if(_0x27be65){_0x5657bc[_0x55a4('0x120')]=ut['extractCalleridName'](_0x27be65);_0x5657bc[_0x55a4('0x121')]=ut['extractCalleridNumber'](_0x27be65);}var _0x21a85f=ut[_0x55a4('0x122')](_0x33c5e9,_0x4fe6e8,_0x2f973b,_0x27be65,_0x301cf4,_0x5657bc);var _0x561321=utils[_0x55a4('0x123')](_0x4fe6e8[_0x55a4('0xf2')]);Object[_0x55a4('0x124')](_0x21a85f,_0x561321);_[_0x55a4('0x125')](_0x5657bc,ut[_0x55a4('0x126')](_0x21a85f));_0x5657bc[_0x55a4('0x6b')]=moment()['format'](_0x55a4('0x6c'));_0x33c5e9['variables']=_0x21a85f;var _0xe60af1=ut['variablesAction'](_0x5657bc,_0x33c5e9,_0x21a85f,_0x5657bc[_0x55a4('0x8f')],_0x31e33f);return ami[_0x55a4('0x52')](_0xe60af1)[_0x55a4('0x61')](function(_0x304284){_0x33c5e9[_0x55a4('0x2f')]+=0x1;logger[_0x55a4('0x4b')]('[originated][increment]',_0x301cf4,_0x55a4('0xa5'),_0x33c5e9[_0x55a4('0x38')],_0x55a4('0xde'),_0x33c5e9['originated']);_0x2a6eea(_0x304284);})[_0x55a4('0x55')](function(_0x3c0c2c){ut['logAgent'](_0x5657bc,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x5657bc,_0x55a4('0x127'));_0x48d0d3(_0x3c0c2c);});});};Preview[_0x55a4('0xe')][_0x55a4('0x21')]=function(_0x411d9d){if(this[_0x55a4('0x4a')][_0x411d9d[_0x55a4('0xa6')]]){this[_0x55a4('0x4a')][_0x411d9d['linkedid']][_0x55a4('0x54')]=_0x411d9d[_0x55a4('0x54')];}};Preview['prototype'][_0x55a4('0x18')]=function(_0x57cd35){var _0x103cd0=this;var _0x29f993=this[_0x55a4('0x4a')][_0x57cd35[_0x55a4('0x128')]];if(_0x29f993){if(_0x29f993[_0x55a4('0xf4')]&&this['agents'][_0x29f993['lookAgent']]){ut[_0x55a4('0x129')](_0x29f993,this[_0x55a4('0x15')][_0x29f993[_0x55a4('0xf4')]][_0x55a4('0x38')],this[_0x55a4('0x15')][_0x29f993[_0x55a4('0xf4')]]['id']);}var _0x407025=_['clone'](_0x29f993);_0x407025[_0x55a4('0x95')]=moment()[_0x55a4('0x2b')](_0x55a4('0x6c'));var _0x29cd4b=_0x103cd0[_0x55a4('0x12')][_0x29f993[_0x55a4('0x4d')]];if(ut[_0x55a4('0x12a')](_0x57cd35[_0x55a4('0x12b')])){if(_0x29f993[_0x55a4('0x8e')]){rpcDb[_0x55a4('0x105')](_0x29f993[_0x55a4('0x91')]);}if(_0x29f993['activeContact']){rpcDb[_0x55a4('0x6a')](_0x29f993[_0x55a4('0x91')]);}ami['emit'](_0x55a4('0x12c'),ut[_0x55a4('0x83')](_0x29f993,_0x55a4('0x12d'),this[_0x55a4('0x12')][_0x29f993[_0x55a4('0x4d')]]));this[_0x55a4('0xe1')](_0x407025,_0x29cd4b,_0x57cd35);}else{_0x29f993[_0x55a4('0x6b')]=moment()[_0x55a4('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x55a4('0xe6')](_0x407025,0x4,_0x55a4('0x12e'));rpcDb['createAgentHistory'](_0x407025,_0x55a4('0x12f'));}}};Preview['prototype']['syncHangup']=function(_0xbede56){var _0x3bc0c0=this['actions'][_0xbede56[_0x55a4('0xa6')]];var _0x1710e9;if(_0x3bc0c0){_0x1710e9=this['campaignsPreview'][_0x3bc0c0[_0x55a4('0x4d')]];logger['info'](_0x55a4('0x130'),_0xbede56[_0x55a4('0xa6')],_0x55a4('0xa5'),_0x1710e9[_0x55a4('0x38')],'pTalking:\x20',_0x1710e9['pTalking']);}if(this[_0x55a4('0x4a')][_0xbede56[_0x55a4('0xa6')]]&&_0xbede56[_0x55a4('0xa6')]!==_0xbede56[_0x55a4('0xa4')]){if(_0xbede56['cause']==='16'&&this['actions'][_0xbede56[_0x55a4('0xa6')]][_0x55a4('0x97')]){this['callProgressDetectingCustomer'](_0xbede56,_0xbede56['linkedid'],_0xbede56['cause']);}else if(this[_0x55a4('0x4a')][_0xbede56[_0x55a4('0xa6')]][_0x55a4('0x97')]){logger[_0x55a4('0x4b')](_0x55a4('0x131'),_0xbede56[_0x55a4('0xa6')],_0xbede56['cause'],_0x55a4('0xa5'),_0x1710e9['name'],'pTalking:\x20',_0x1710e9['pTalking']);this[_0x55a4('0x7d')](_0xbede56,_0xbede56[_0x55a4('0xa6')],_0xbede56[_0x55a4('0x132')]);}}else if(_0x3bc0c0&&_[_0x55a4('0x49')](_0x3bc0c0[_0x55a4('0x133')])&&_0x1710e9[_0x55a4('0x134')]&&_0xbede56[_0x55a4('0xa6')]===_0xbede56[_0x55a4('0xa4')]&&_['isNil'](_0xbede56[_0x55a4('0xeb')])&&_0xbede56['cause']==='16'&&_0xbede56[_0x55a4('0x135')]==='6'&&_['isUndefined'](_0x3bc0c0['transfer'])){if(_0x3bc0c0['unlockAgent']){rpcDb[_0x55a4('0x105')](_0x3bc0c0[_0x55a4('0x91')]);}if(_0x3bc0c0[_0x55a4('0x8f')]){rpcDb[_0x55a4('0x6a')](_0x3bc0c0[_0x55a4('0x91')]);}_0xbede56['reason']='22';this[_0x55a4('0xe1')](_0x3bc0c0,_0x1710e9,_0xbede56);}else if(_0x3bc0c0&&_0x3bc0c0[_0x55a4('0x136')]){if(_0xbede56[_0x55a4('0x132')]==='16'&&this['actions'][_0xbede56['linkedid']]['dialAnswer']){logger[_0x55a4('0x4b')]('[syncHangup][talking][transfer]',_0xbede56[_0x55a4('0xa6')],_0xbede56[_0x55a4('0x132')],'\x20Queue',_0x1710e9[_0x55a4('0x38')],_0x55a4('0x4e'),_0x1710e9[_0x55a4('0x30')]);this[_0x55a4('0x7d')](_0xbede56,_0xbede56['linkedid'],_0xbede56[_0x55a4('0x132')]);}else if(this['actions'][_0xbede56[_0x55a4('0xa6')]][_0x55a4('0x97')]){logger['info'](_0x55a4('0x131'),_0xbede56[_0x55a4('0xa6')],_0xbede56[_0x55a4('0x132')],_0x55a4('0xa5'),_0x1710e9[_0x55a4('0x38')],_0x55a4('0x4e'),_0x1710e9['pTalking']);this[_0x55a4('0x7d')](_0xbede56,_0xbede56[_0x55a4('0xa6')],_0xbede56['cause']);}}};Preview[_0x55a4('0xe')][_0x55a4('0x1f')]=function(_0x465c90){if(this[_0x55a4('0x4a')][_0x465c90['destlinkedid']]&&_0x465c90['destlinkedid']!==_0x465c90[_0x55a4('0x137')]){this[_0x55a4('0x7d')](_0x465c90,_0x465c90['destlinkedid'],_0x465c90[_0x55a4('0xd4')]);}};Preview[_0x55a4('0xe')][_0x55a4('0x1c')]=function(_0x47164d){if(this[_0x55a4('0x4a')][_0x47164d['linkedid']]&&_0x47164d['linkedid']!==_0x47164d['uniqueid']&&!this[_0x55a4('0x4a')][_0x47164d[_0x55a4('0xa6')]][_0x55a4('0x97')]){if(_0x47164d[_0x55a4('0x132')]==='1'){this[_0x55a4('0x7d')](_0x47164d,_0x47164d[_0x55a4('0xa6')],_0x47164d[_0x55a4('0x132')]);}}};Preview[_0x55a4('0xe')][_0x55a4('0x138')]=function(_0x54fbb2,_0x28c9b7,_0x1e05fc){if(this['actions'][_0x54fbb2]){if(_[_0x55a4('0x49')](this[_0x55a4('0x4a')][_0x54fbb2][_0x55a4('0x139')])){this[_0x55a4('0x4a')][_0x54fbb2][_0x55a4('0x139')]={};}this[_0x55a4('0x4a')][_0x54fbb2][_0x55a4('0x139')][_0x28c9b7]=_0x1e05fc;}};Preview['prototype'][_0x55a4('0x23')]=function(_0x13de90){try{if(!_[_0x55a4('0x49')](_0x13de90)){if(ut[_0x55a4('0x13a')](_[_0x55a4('0x13b')](_0x13de90[_0x55a4('0x13c')])[0x0])){this[_0x55a4('0x138')](_0x13de90[_0x55a4('0xa4')],_['keys'](_0x13de90[_0x55a4('0x13c')])[0x0],_0x13de90[_0x55a4('0x13d')]);}}}catch(_0x35f0f6){logger[_0x55a4('0x13e')](_0x55a4('0x13f'),util[_0x55a4('0x140')](_0x35f0f6,{'showHidden':![],'depth':null}));}};Preview[_0x55a4('0xe')][_0x55a4('0x141')]=function(_0x32a6ac){if(_0x32a6ac){if(this[_0x55a4('0x4a')][_0x32a6ac[_0x55a4('0x142')]]){this[_0x55a4('0x4a')][_0x32a6ac[_0x55a4('0x142')]][_0x55a4('0x136')]=!![];}}};Preview[_0x55a4('0xe')][_0x55a4('0x26')]=function(_0x44c448){if(_0x44c448){if(this['actions'][_0x44c448[_0x55a4('0x143')]]){this[_0x55a4('0x4a')][_0x44c448[_0x55a4('0x143')]][_0x55a4('0x136')]=!![];}}};module[_0x55a4('0x144')]=Preview; \ No newline at end of file +var _0x55ca=['syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','originated','sendMessageOneNotActive','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','type','outbound','clockClearZombieChannels','clearZombieChannels','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','originated:\x20','queue','pTalking:\x20','pick','UserId','ListId','Action','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','getContactRecallMe','agents','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','catch','starttime','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','dialActive','Trunk','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','countnosuchnumberretry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','pTalking','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','VoiceQueueId','Queue','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','Calling','[Preview][execCall][failure]','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','trunks','SIP/%s','status','reachable','unmonitored','run','unlock','disableContact','getContactPreview','recallme','validateContact','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','unlockContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','actions','originateresponse','syncOriginateResponse','bind','hangup','syncHangup'];(function(_0xaa6625,_0x5a7df8){var _0x5dd2b4=function(_0x2fbf37){while(--_0x2fbf37){_0xaa6625['push'](_0xaa6625['shift']());}};_0x5dd2b4(++_0x5a7df8);}(_0x55ca,0x126));var _0xa55c=function(_0x4bc428,_0xf56dd9){_0x4bc428=_0x4bc428-0x0;var _0x3ca37f=_0x55ca[_0x4bc428];return _0x3ca37f;};'use strict';var util=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var uuid=require('uuid');var moment=require('moment');var Redis=require('ioredis');var config=require(_0xa55c('0x2'));var logger=require(_0xa55c('0x3'))('preview');var loggerAction=require(_0xa55c('0x3'))(_0xa55c('0x4'));var ami=require(_0xa55c('0x5'));var rpcDb=require(_0xa55c('0x6'));var cmHopperAdditionalPhone=require(_0xa55c('0x7'));var Action=require(_0xa55c('0x8'));var ut=require(_0xa55c('0x9'));var utils=require('../dialer/utils');config[_0xa55c('0xa')]=_[_0xa55c('0xb')](config['redis'],{'host':_0xa55c('0xc'),'port':0x18eb});var io=require(_0xa55c('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0xa55c('0xe')]=function(_0x20c76a){this[_0xa55c('0xf')]=this[_0xa55c('0xf')]?this[_0xa55c('0xf')][_0xa55c('0x10')](_0x20c76a):_0x20c76a();};function Preview(_0x508342){this[_0xa55c('0x11')]=new Sequence();this[_0xa55c('0x12')]=_0x508342[_0xa55c('0x13')];this['trunks']=_0x508342['trunks'];this[_0xa55c('0x14')]={};this['agents']=_0x508342['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0xa55c('0x15'),this[_0xa55c('0x16')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x18'),this[_0xa55c('0x19')][_0xa55c('0x17')](this));ami['on']('hanguprequest',this[_0xa55c('0x1a')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1b'),this[_0xa55c('0x1c')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1d'),this[_0xa55c('0x1e')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1f'),this['syncVarSet'][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x20'),this[_0xa55c('0x21')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x22'),this[_0xa55c('0x23')]['bind'](this));this['loopCampaigns'](this[_0xa55c('0x12')]);}function emit(_0x3776ac,_0xade4c4,_0x4cfe10){io['to'](_0x3776ac)[_0xa55c('0x24')](_0xade4c4,_0x4cfe10);}function emitVoiceQueueChannelRemove(_0x2fcb90){logger['info'](_0xa55c('0x25'),JSON[_0xa55c('0x26')](_0x2fcb90));emit(util[_0xa55c('0x27')](_0xa55c('0x28'),_0x2fcb90[_0xa55c('0x29')]),'voice_queue_channel:remove',_0x2fcb90);io[_0xa55c('0x24')]('voice_queue_presence:remove',_0x2fcb90);}function notSendMessagesQueue(_0x5ba836){if(_0x5ba836['sendMessageOneNotActive']){if(_0x5ba836[_0xa55c('0x2a')]===0x0&&_0x5ba836['pTalking']===0x0){_0x5ba836[_0xa55c('0x2b')]=![];_0x5ba836[_0xa55c('0x2c')]=0x0;_0x5ba836[_0xa55c('0x2d')]=0x0;_0x5ba836[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x30')];ut[_0xa55c('0x31')](_0xa55c('0x32'),_0x5ba836[_0xa55c('0x29')]+_0xa55c('0x33'));}else{_0x5ba836[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS'][_0xa55c('0x34')];ut[_0xa55c('0x31')](_0xa55c('0x32'),_0x5ba836[_0xa55c('0x29')]+'\x20is\x20deactivated');}}}Preview[_0xa55c('0x35')][_0xa55c('0x36')]=function(){var _0x1b8388=this;setInterval(function(){_0x1b8388[_0xa55c('0x37')]();},0x7cf);};Preview[_0xa55c('0x35')][_0xa55c('0x37')]=function(){var _0x52d37f=this[_0xa55c('0x12')];this['clockClearZombieChannels']+=0x1;for(var _0x35c9c2 in _0x52d37f){if(_0x52d37f[_0xa55c('0x38')](_0x35c9c2)&&(_0x52d37f[_0x35c9c2][_0xa55c('0x39')]===_0xa55c('0x3a')||_0x52d37f[_0x35c9c2]['dialMethod']===_0xa55c('0x3b'))&&_0x52d37f[_0x35c9c2][_0xa55c('0x3c')]===_0xa55c('0x3d')){if(this[_0xa55c('0x3e')]>0x7){this[_0xa55c('0x3e')]=0x0;this[_0xa55c('0x3f')]();}}if(_0x52d37f[_0xa55c('0x38')](_0x35c9c2)&&_0x52d37f[_0x35c9c2][_0xa55c('0x39')]===_0xa55c('0x3a')&&_0x52d37f[_0x35c9c2][_0xa55c('0x3c')]===_0xa55c('0x3d')){if(_0x52d37f[_0x35c9c2]['dialActive']){this['setMessage'](_0x52d37f[_0x35c9c2]);if(_0x52d37f[_0x35c9c2][_0xa55c('0x40')])this[_0xa55c('0x41')](_0x52d37f[_0x35c9c2]);}else{notSendMessagesQueue(_0x52d37f[_0x35c9c2]);}}}};Preview['prototype'][_0xa55c('0x42')]=function(_0x2f0110){var _0x2e9623=this;this[_0xa55c('0x11')][_0xa55c('0xe')](function(){if(!_[_0xa55c('0x43')](_0x2e9623[_0xa55c('0x14')][_0x2f0110])){loggerAction[_0xa55c('0x44')](_0xa55c('0x45'),_0x2f0110,'Queue',_0x2e9623['actions'][_0x2f0110]['queue'],_0xa55c('0x46'),JSON[_0xa55c('0x26')](_0x2e9623[_0xa55c('0x12')][_0x2e9623['actions'][_0x2f0110][_0xa55c('0x47')]]['originated']),_0xa55c('0x48'),JSON['stringify'](_0x2e9623[_0xa55c('0x12')][_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]]['pTalking']),JSON[_0xa55c('0x26')](_0x2e9623[_0xa55c('0x14')][_0x2f0110]['dialAnswer']),JSON[_0xa55c('0x26')](_[_0xa55c('0x49')](_0x2e9623['actions'][_0x2f0110],['contactId',_0xa55c('0x4a'),'VoiceQueueId',_0xa55c('0x4b')])));return ami[_0xa55c('0x4c')]({'action':'status','channel':_0x2e9623['actions'][_0x2f0110]['channel']})['catch'](function(_0x3b3308){if(_0x3b3308[_0xa55c('0x2e')]===_0xa55c('0x4d')){setTimeout(function(){if(_0x2e9623[_0xa55c('0x14')][_0x2f0110]){ut[_0xa55c('0x4e')](_0x2e9623['campaignsPreview'][_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]],_0xa55c('0x4f'));if(_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x50')]===!![]){ut[_0xa55c('0x51')](_0x2e9623['campaignsPreview'][_0x2e9623[_0xa55c('0x14')][_0x2f0110]['queue']],'[clearZombieChannel]');ut[_0xa55c('0x52')](_0xa55c('0x53')+_0x2f0110,_0x2e9623['actions'][_0x2f0110][_0xa55c('0x47')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x2f0110,_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]);delete _0x2e9623[_0xa55c('0x14')][_0x2f0110];}},0x2328);}});}});};Preview['prototype'][_0xa55c('0x3f')]=function(){var _0xd5a006=this;loggerAction['info'](_0xa55c('0x54'),_['size'](this[_0xa55c('0x14')]));for(var _0x43a42d in this['actions']){if(_0xd5a006[_0xa55c('0x14')][_0xa55c('0x38')](_0x43a42d)){_0xd5a006['clearZombieChannel'](_0x43a42d);}}};Preview[_0xa55c('0x35')][_0xa55c('0x41')]=function(_0x204767){var _0x59a6c8=this;rpcDb[_0xa55c('0x55')](_0x204767['id'],ut['agentReadyId'](this[_0xa55c('0x56')]))[_0xa55c('0x57')](function(_0x451269){if(!_['isNil'](_0x451269)){for(var _0x41eab1=0x0;_0x41eab1<_0x451269[_0xa55c('0x58')];_0x41eab1+=0x1){if(ut['getDiff'](_0x451269[_0x41eab1][_0xa55c('0x59')])<_0x204767[_0xa55c('0x5a')]*0x3c){if(_0x451269[_0x41eab1]['Agent']&&!_0x451269[_0x41eab1][_0xa55c('0x5b')][_0xa55c('0x5c')]){_0x59a6c8['run'](_0x451269[_0x41eab1]['id'])[_0xa55c('0x57')](ut[_0xa55c('0x5d')](_0xa55c('0x5e')))[_0xa55c('0x5f')](ut['logger2'](_0xa55c('0x5e')));}else{rpcDb['disableContact'](_0x451269[_0x41eab1]['id']);}}else{var _0x2157d6=new Action(_0x451269[_0x41eab1],_0x204767);_0x2157d6[_0xa55c('0x60')]=moment()[_0xa55c('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x204767[_0xa55c('0x61')]+=0x1;ut[_0xa55c('0x62')](_0x2157d6,0x17,'RecallInQueue');if(_0x204767[_0xa55c('0x63')]){rpcDb[_0xa55c('0x64')](ut[_0xa55c('0x65')](_0x451269[_0x41eab1]));rpcDb[_0xa55c('0x66')](_0x2157d6,_0xa55c('0x67'));}else{ut[_0xa55c('0x62')](_0x2157d6,0x16,_0xa55c('0x68'));rpcDb[_0xa55c('0x66')](_0x2157d6,_0xa55c('0x69'));rpcDb[_0xa55c('0x6a')](_0x2157d6,'[HistoryRecallClose]');}}}}})[_0xa55c('0x5f')](ut[_0xa55c('0x5d')](_0xa55c('0x6b')));};Preview['prototype'][_0xa55c('0x6c')]=function(_0x35bf0a){_0x35bf0a['sendMessageOneNotActive']=!![];if(ut[_0xa55c('0x6d')](_0x35bf0a['loggedIn'])){_0x35bf0a[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x6e')];}else if(!ut[_0xa55c('0x6f')](_0x35bf0a[_0xa55c('0x70')])){_0x35bf0a['message']=utils[_0xa55c('0x2f')][_0xa55c('0x30')];}else if(!this['isTrunkReachable'](_0x35bf0a[_0xa55c('0x71')])){if(!this[_0xa55c('0x72')](_0x35bf0a[_0xa55c('0x73')])){_0x35bf0a[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x35bf0a[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x74')];}}else{_0x35bf0a[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS'][_0xa55c('0x74')];}};Preview['prototype'][_0xa55c('0x75')]=function(_0x437ced,_0x20593d,_0x2ccfb1){var _0xec640=this;var _0x53b2f7=this[_0xa55c('0x14')][_0x20593d];var _0x54f776=this[_0xa55c('0x12')][_0x53b2f7[_0xa55c('0x47')]];var _0x2cfe08;var _0x1e1c5b=![];var _0x19aaf5=0x2;var _0x138c9e=0x3;if(_0x54f776){switch(_0x2ccfb1){case'1':_0x54f776[_0xa55c('0x76')]+=0x1;_0x53b2f7['countnosuchnumberretry']+=0x1;_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x0,_0xa55c('0x79'));ami[_0xa55c('0x24')]('custom:agentnosuchnumber',ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x7b')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0x7c'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'0',_0x54f776)['then'](function(_0xdd92c1){_0x1e1c5b=_0xdd92c1[_0xa55c('0x7e')]==0x1;_0x19aaf5=_0x54f776[_0xa55c('0x7f')];_0x138c9e=_0x54f776[_0xa55c('0x80')];if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,'Global');rpcDb[_0xa55c('0x6a')](_0x2cfe08,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x53b2f7[_0xa55c('0x82')]>=_0x54f776['dialNoSuchNumberMaxRetry']){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0x83'));}else{rpcDb[_0xa55c('0x84')](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0x82'),_0x54f776[_0xa55c('0x7f')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];}else{_0x53b2f7['countnosuchnumberretry']++;logger[_0xa55c('0x44')](_0xa55c('0x89'),_0x53b2f7['countnosuchnumberretry']);logger[_0xa55c('0x44')]('id',_0x53b2f7[_0xa55c('0x8a')]);_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnosuchnumberretry':_0x53b2f7[_0xa55c('0x82')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'ANSWER':var _0x1dfaf7=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));_0x53b2f7[_0xa55c('0x8e')]=_0x1dfaf7;_0x53b2f7[_0xa55c('0x8f')]=_0x1dfaf7;_0x53b2f7[_0xa55c('0x50')]=!![];_0x54f776[_0xa55c('0x90')]+=0x1;logger[_0xa55c('0x44')](_0xa55c('0x91'),_0x53b2f7['uniqueid'],_0xa55c('0x92'),_0x54f776[_0xa55c('0x29')],_0xa55c('0x48'),_0x54f776[_0xa55c('0x90')]);ami[_0xa55c('0x24')](_0xa55c('0x93'),ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x94'),this[_0xa55c('0x12')][_0x53b2f7[_0xa55c('0x47')]]));if(_0x54f776[_0xa55c('0x95')]){ami['emit'](_0xa55c('0x96'),ut['buildAcw'](_0x53b2f7));}break;case'16':ami[_0xa55c('0x24')](_0xa55c('0x97'),ut[_0xa55c('0x7a')](_0x53b2f7,'complete',this['campaignsPreview'][_0x53b2f7[_0xa55c('0x47')]]));emitVoiceQueueChannelRemove(ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x98')));_0x54f776[_0xa55c('0x99')]+=0x1;_0x54f776['total']+=0x1;_0x54f776[_0xa55c('0x9a')]+=0x1;ut[_0xa55c('0x51')](_0x54f776,_0xa55c('0x9b'));_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x4,'Answer');rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0x9c'));rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0x9d'));rpcDb[_0xa55c('0x9e')](_0x53b2f7);_0x54f776['sumDuration']+=_0x53b2f7[_0xa55c('0x9f')];_0x54f776[_0xa55c('0xa0')]+=_0x53b2f7['talktime'];logger[_0xa55c('0x44')](_0xa55c('0xa1'),_0x53b2f7[_0xa55c('0xa2')],'\x20Queue',_0x54f776[_0xa55c('0x29')],_0xa55c('0x48'),_0x54f776[_0xa55c('0x90')]);delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];break;case'BUSY':_0x54f776[_0xa55c('0xa3')]+=0x1;_0x53b2f7[_0xa55c('0xa4')]+=0x1;_0x53b2f7['countglobal']=ut['totalGlobal'](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x5,'Busy');_0x19aaf5=_0x54f776[_0xa55c('0xa5')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')](_0xa55c('0xa6'),ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0xa7')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xa8'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'5',_0x54f776)['then'](function(_0x463195){_0x1e1c5b=_0x463195[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xab'));}else{if(_0x53b2f7[_0xa55c('0xa4')]>=_0x54f776['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x53b2f7,_0xa55c('0xa8'));}else{rpcDb[_0xa55c('0x84')](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0xa4'),_0x54f776['dialBusyRetryFrequency']),_0x53b2f7['unlockAgent'],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xa4')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countbusyretry':_0x53b2f7[_0xa55c('0xa4')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)['then'](function(){});});}});break;case _0xa55c('0xac'):_0x54f776['outboundNoAnswerCallsDay']+=0x1;_0x53b2f7[_0xa55c('0xad')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x3,_0xa55c('0xae'));_0x19aaf5=_0x54f776[_0xa55c('0xaf')];_0x138c9e=_0x54f776[_0xa55c('0x80')];var _0x402f02=ut[_0xa55c('0xb0')](_0x53b2f7,_0x54f776);ami[_0xa55c('0x24')]('custom:agentnoanswer',_0x402f02);rpcDb['createCustomerHistory'](_0x53b2f7,_0xa55c('0xb1'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'3',_0x54f776)[_0xa55c('0x57')](function(_0x256db0){_0x1e1c5b=_0x256db0[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xb2'));}else{if(_0x53b2f7[_0xa55c('0xad')]>=_0x54f776[_0xa55c('0xb3')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xb1'));}else{rpcDb['rescheduleContact'](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0xad'),_0x54f776[_0xa55c('0xaf')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7['countnoanswerretry']++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7['countnoanswerretry']}})['then'](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'CONGESTION':_0x54f776['outboundCongestionCallsDay']+=0x1;_0x53b2f7['countcongestionretry']+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x8,_0xa55c('0xb4'));_0x19aaf5=_0x54f776[_0xa55c('0xb5')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')]('custom:agentcongestion',ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0xb6')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xb7'));_0xec640['verifyAdditionalPhones'](_0x53b2f7,'8',_0x54f776)[_0xa55c('0x57')](function(_0x25e4e0){_0x1e1c5b=_0x25e4e0[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,'Global');rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xb8'));}else{if(_0x53b2f7[_0xa55c('0xb9')]>=_0x54f776[_0xa55c('0xba')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xb7'));}else{rpcDb[_0xa55c('0x84')](ut['scheduledAt'](_0x53b2f7,'countcongestionretry',_0x54f776[_0xa55c('0xa5')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xb9')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countcongestionretry':_0x53b2f7[_0xa55c('0xb9')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'CANCEL':_0x54f776[_0xa55c('0xbb')]+=0x1;_0x53b2f7[_0xa55c('0xbc')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x14,_0xa55c('0xbd'));_0x19aaf5=_0x54f776[_0xa55c('0xbe')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')](_0xa55c('0xbf'),ut['buildObj'](_0x53b2f7,_0xa55c('0xc0')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xc1'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'20',_0x54f776)[_0xa55c('0x57')](function(_0x31287c){_0x1e1c5b=_0x31287c[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0x14,_0xa55c('0xbd'));rpcDb['createCustomerFinal'](_0x2cfe08,_0xa55c('0xc2'));}else{if(_0x53b2f7[_0xa55c('0xbc')]>=_0x54f776[_0xa55c('0xc3')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0xa55c('0x85')](_0x53b2f7,'countagentrejectretry',_0x54f776[_0xa55c('0xbe')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640['incrementPreviewCounters']({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case _0xa55c('0xc4'):_0x54f776[_0xa55c('0xc5')]+=0x1;_0x53b2f7[_0xa55c('0xc6')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0xb,_0xa55c('0xc7'));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xc8'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'11',_0x54f776)['then'](function(_0x46124b){_0x1e1c5b=_0x46124b['additional']==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x53b2f7[_0xa55c('0xc9')]>=_0x54f776[_0xa55c('0xca')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xa55c('0x84')](ut['scheduledAt'](_0x53b2f7,_0xa55c('0xc6'),_0x54f776[_0xa55c('0xcb')]),_0x53b2f7['unlockAgent'],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7['countnoanswerretry']++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7['countnoanswerretry']}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)['then'](function(){});});}});break;case'18':_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7[_0xa55c('0xcd')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x12,_0x437ced['cause-txt']||_0x437ced[_0xa55c('0xce')]);ami[_0xa55c('0x24')](_0xa55c('0xcf'),ut[_0xa55c('0x7a')](_0x53b2f7,'amd'));rpcDb[_0xa55c('0x66')](_0x53b2f7,'[callProgressDetectingCustomer][hangupInAMD]');_0xec640[_0xa55c('0x7d')](_0x53b2f7,'18',_0x54f776)['then'](function(_0x4ab9f1){_0x1e1c5b=_0x4ab9f1['additional']==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0x12,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd0'));}else{rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xd0'));}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});delete this[_0xa55c('0x14')][_0x437ced['linkedid']];break;case'19':_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7['countglobal']=ut['totalGlobal'](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x13,_0x437ced[_0xa55c('0xd1')]||_0x437ced['dialstatus']);ami[_0xa55c('0x24')]('custom:amd',ut[_0xa55c('0x7a')](_0x53b2f7,'amd'));rpcDb['createCustomerHistory'](_0x53b2f7,_0xa55c('0xd2'));_0xec640['verifyAdditionalPhones'](_0x53b2f7,'18',_0x54f776)['then'](function(_0x2961b6){_0x1e1c5b=_0x2961b6[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd2'));}else{rpcDb['createCustomerFinal'](_0x53b2f7,'[callProgressDetectingCustomer][machine]');}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});delete this[_0xa55c('0x14')][_0x437ced['linkedid']];break;default:if(_0x53b2f7[_0xa55c('0x50')]){ut[_0xa55c('0x51')](_0x54f776,_0xa55c('0xd3'));ut[_0xa55c('0x52')](_0xa55c('0xd4')+_0x54f776[_0xa55c('0x29')],_0x437ced);}_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0xc,_0x437ced[_0xa55c('0xd1')]||_0x437ced[_0xa55c('0xce')]);_0x19aaf5=_0x54f776[_0xa55c('0xbe')];_0x138c9e=_0x54f776['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x53b2f7,'[callProgressDetectingCustomer][logUnknown]');_0xec640[_0xa55c('0x7d')](_0x53b2f7,'20',_0x54f776)['then'](function(_0x1ba04f){_0x1e1c5b=_0x1ba04f[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd5'));}else{rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xd5'));}delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];}else{_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});}});}if(!(_0x53b2f7[_0xa55c('0x50')]&&_0x2ccfb1==='16')){ut[_0xa55c('0x4e')](_0x54f776,_0xa55c('0xd6'));logger[_0xa55c('0x44')](_0xa55c('0xd7'),_0x53b2f7[_0xa55c('0xa2')],_0xa55c('0x92'),_0x54f776[_0xa55c('0x29')],_0xa55c('0x46'),_0x54f776[_0xa55c('0x2a')]);}if(_0x2ccfb1!=='ANSWER'){delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];delete this['actions'][_0x437ced[_0xa55c('0xd8')]];}_0x54f776[_0xa55c('0xd9')]=!![];}};Preview[_0xa55c('0x35')][_0xa55c('0xda')]=function(_0x31767b,_0x4d9b66,_0x456dd4){if(_['isUndefined'](_0x4d9b66)&&'object'!==typeof _0x4d9b66){return;}if(_[_0xa55c('0xdb')](_0x456dd4)&&_0xa55c('0xdc')!==typeof _0x456dd4){return;}switch(_0x456dd4[_0xa55c('0xdd')]){case'0':ut[_0xa55c('0xde')](_0x31767b,0x0,_0xa55c('0x79'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe0'));break;case'3':ut[_0xa55c('0xde')](_0x31767b,0x3,_0xa55c('0xae'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe1'));break;case'5':ut[_0xa55c('0xde')](_0x31767b,0x5,_0xa55c('0xe2'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe3'));break;case'8':ut[_0xa55c('0xde')](_0x31767b,0x8,_0xa55c('0xb4'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe4'));break;case'22':ut['logAgent'](_0x31767b,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x31767b,_0xa55c('0xe5'));break;default:ut[_0xa55c('0xde')](_0x31767b,0xc,_0x456dd4['reason']);rpcDb[_0xa55c('0xdf')](_0x31767b,'[callProgressDetectingAgent][logCongestion]');}ut[_0xa55c('0x4e')](_0x4d9b66,'[callProgressDetectingAgent]');logger[_0xa55c('0x44')](_0xa55c('0xe6'),_0x31767b[_0xa55c('0xa2')],_0xa55c('0x92'),_0x4d9b66[_0xa55c('0x29')],_0xa55c('0x46'),_0x4d9b66[_0xa55c('0x2a')]);delete this[_0xa55c('0x14')][_0x31767b[_0xa55c('0xa2')]];};Preview[_0xa55c('0x35')][_0xa55c('0x7d')]=function(_0x53f209,_0x59f3a4,_0xde7bd){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x53f209,_0x59f3a4,_0xde7bd)[_0xa55c('0x5f')](logger['info'](_0xa55c('0xe7')));};Preview[_0xa55c('0x35')][_0xa55c('0x8c')]=function(_0x5b20c5,_0x3b8f15,_0x18584c){return cmHopperAdditionalPhone[_0xa55c('0x8c')](_0x5b20c5,_0x3b8f15,_0x18584c)['catch'](logger[_0xa55c('0x44')]('[swapAdditionalPhone]\x20'));};Preview[_0xa55c('0x35')]['incrementPreviewCounters']=function(_0x4e8433){return Promise[_0xa55c('0xe8')]()[_0xa55c('0x57')](cmHopperAdditionalPhone[_0xa55c('0x8b')](_0x4e8433))['catch'](logger[_0xa55c('0x44')](_0xa55c('0xe9')));};Preview[_0xa55c('0x35')][_0xa55c('0xea')]=function(_0x4399bd,_0x3e9384,_0x2e76ad,_0x24db74,_0x4b1762){var _0x402298=this;return new Promise(function(_0x1b8b05,_0x80befe){if(_[_0xa55c('0x43')](_0x3e9384)||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xeb')])||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xec')])||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xed')])){_0x80befe(ut[_0xa55c('0x2e')]('Contact\x20is\x20undefined',_0x24db74,_0x4b1762));return;}var _0x263d16=uuid['v4']();var _0x48127c=_0x402298['campaignsPreview'][_0x3e9384[_0xa55c('0xee')]['name']];var _0x427e3b=_0x2e76ad?_0x402298['agents'][_0x2e76ad]['id']:undefined;_0x402298[_0xa55c('0x14')][_0x263d16]=new Action(_0x3e9384,_0x48127c,_0x263d16,_0x2e76ad,_0x427e3b);var _0x231499=_0x402298[_0xa55c('0x14')][_0x263d16];_0x231499[_0xa55c('0x86')]=_0x24db74;_0x231499[_0xa55c('0x87')]=_0x4b1762;_0x231499[_0xa55c('0xef')]=_0x2e76ad;if(_[_0xa55c('0xf0')](_0x4399bd)){_0x402298['execCall'](_0x231499,_0x48127c,_0x3e9384,_0x2e76ad)[_0xa55c('0x57')](function(_0x590c0c){logger['info'](_0xa55c('0xf1'),_0xa55c('0xf2')+_0x231499['queue']+_0xa55c('0xf3')+_0x231499[_0xa55c('0x8a')],JSON[_0xa55c('0x26')](_0x590c0c));ami['emit']('custom:agentcalled',ut['buildObj'](_0x231499,'called',_0x402298[_0xa55c('0x12')][_0x231499[_0xa55c('0x47')]]));_0x1b8b05(ut['message'](_0xa55c('0xf4')));})[_0xa55c('0x5f')](function(_0x3b3be0){ut['logger'](_0xa55c('0xf5'),_0x3b3be0);_0x80befe(ut['message']('Call\x20failed',_0x24db74,_0x4b1762));});}else{_0x48127c['outboundBlacklistCallsDay']+=0x1;ut[_0xa55c('0xf6')](_0x231499);rpcDb['createHistory'](_0x231499,_0xa55c('0xf7'));delete _0x402298['actions'][_0x263d16];_0x80befe(ut[_0xa55c('0x2e')](_0xa55c('0xf8'),_0x24db74,_0x4b1762));}});};Preview[_0xa55c('0x35')]['isTrunkReachable']=function(_0x1c016d){return!_[_0xa55c('0x43')](_0x1c016d)&&!_[_0xa55c('0x43')](_0x1c016d[_0xa55c('0x29')])&&!_[_0xa55c('0x43')](_0x1c016d[_0xa55c('0xf9')])&&_0x1c016d[_0xa55c('0xf9')]&&!_[_0xa55c('0x43')](this[_0xa55c('0xfa')][util['format'](_0xa55c('0xfb'),_0x1c016d[_0xa55c('0x29')])])&&!_[_0xa55c('0x43')](this[_0xa55c('0xfa')][util[_0xa55c('0x27')](_0xa55c('0xfb'),_0x1c016d['name'])][_0xa55c('0xfc')])&&(this['trunks'][util[_0xa55c('0x27')](_0xa55c('0xfb'),_0x1c016d['name'])][_0xa55c('0xfc')]===_0xa55c('0xfd')||this['trunks'][util['format'](_0xa55c('0xfb'),_0x1c016d[_0xa55c('0x29')])][_0xa55c('0xfc')]===_0xa55c('0xfe'));};Preview[_0xa55c('0x35')][_0xa55c('0xff')]=function(_0x31b866,_0x37ed47){return this['execRun'](_0x31b866,_0x37ed47)[_0xa55c('0x57')](function(_0x331595){return _[_0xa55c('0x49')](_0x331595,[_0xa55c('0x2e')]);})[_0xa55c('0x5f')](function(_0x59a69d){if(_0x59a69d[_0xa55c('0x100')]){rpcDb['unlockContact'](_0x31b866);}if(_0x59a69d['active']){rpcDb[_0xa55c('0x101')](_0x31b866);}throw _[_0xa55c('0x49')](_0x59a69d,[_0xa55c('0x2e')]);});};Preview[_0xa55c('0x35')]['execRun']=function(_0x125812,_0x155c6e){var _0xa22273=this;var _0x1c7506,_0x3b76df;return rpcDb[_0xa55c('0x102')](_0x125812)[_0xa55c('0x57')](function(_0x239b2e){if(!_['isNil'](_0x239b2e[0x0])){_0x3b76df=_0x239b2e[0x0][_0xa55c('0x103')]?![]:!![];_0x1c7506=_0x239b2e[0x0][_0xa55c('0x103')]?!![]:![];_0x1c7506=_0x155c6e?!![]:_0x1c7506;}var _0x2639cc=_0xa22273[_0xa55c('0x104')](_0x239b2e);if(_0x2639cc['isValid']){rpcDb[_0xa55c('0x105')](_[_0xa55c('0x49')](_0x239b2e[0x0],[_0xa55c('0xed'),'phone']))[_0xa55c('0x57')](function(_0x3a67fb){_0xa22273[_0xa55c('0xea')](_0x3a67fb,_0x239b2e[0x0],_0x155c6e,_0x3b76df,_0x1c7506)[_0xa55c('0x57')](function(_0x19e506){return _0x19e506;})[_0xa55c('0x5f')](function(_0x127c2f){throw _0x127c2f;});})['catch'](function(_0xcd4f3a){ut[_0xa55c('0x31')]('[Preview][checkIsBlackList]',_0xcd4f3a);throw ut[_0xa55c('0x2e')](_0xa55c('0x106'),_0x3b76df,_0x1c7506);});}else{throw ut[_0xa55c('0x2e')](_0x2639cc['message'],_0x3b76df,_0x1c7506);}})['catch'](function(_0x4dba17){ut[_0xa55c('0x31')](_0xa55c('0x107'),_0x4dba17);throw ut['message']('Call\x20unsuccessful',![],!![]);});};Preview[_0xa55c('0x35')][_0xa55c('0x104')]=function(_0x591ee3){if(_['isNil'](_0x591ee3)||_[_0xa55c('0xf0')](_0x591ee3)||!_[_0xa55c('0x43')](_0x591ee3[0x0][_0xa55c('0x5b')])&&_['isNil'](_0x591ee3[0x0]['Agent'][_0xa55c('0x29')])){ut['logger'](_0xa55c('0x108'),_0x591ee3);return{'isValid':![],'message':_0xa55c('0x109')};}var _0x5a4e69=this[_0xa55c('0x12')][_0x591ee3[0x0]['Queue']['name']];_0x5a4e69['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0xa55c('0x43')](_0x5a4e69)){ut['logger'](_0xa55c('0x10a'),_0x5a4e69);return{'isValid':![],'message':_0xa55c('0x10b')};}if(!this[_0xa55c('0x72')](_0x5a4e69['Trunk'])){ut[_0xa55c('0x31')](_0xa55c('0x10c'),_0xa55c('0x10d')+_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x10e'));if(!this[_0xa55c('0x72')](_0x5a4e69[_0xa55c('0x73')])){ut[_0xa55c('0x31')](_0xa55c('0x10c'),_0x5a4e69[_0xa55c('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xa55c('0x10f')};}}if(!ut[_0xa55c('0x6f')](_0x5a4e69['dialActive'])){ut[_0xa55c('0x31')](_0xa55c('0x110'),_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x111'));return{'isValid':![],'message':_0xa55c('0x10d')+_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x111')};}return{'isValid':!![],'message':_0xa55c('0x112')};};Preview[_0xa55c('0x35')][_0xa55c('0x113')]=function(_0x131288,_0x197953,_0x262d72,_0x228d12){var _0x16e229=this;return new Promise(function(_0x5c8713,_0x2d03b2){var _0x4b2e75=_0x131288[_0xa55c('0xa2')];var _0x3d0c6d=_0x16e229[_0xa55c('0x72')](_0x197953[_0xa55c('0x71')])?util['format'](_0xa55c('0x114'),_0x197953[_0xa55c('0x71')][_0xa55c('0x29')],_['isNil'](_0x197953[_0xa55c('0x115')])?'':_0x197953[_0xa55c('0x115')][_0xa55c('0x116')]()||'',_0x197953['dialCutDigit']>0x0?_0x262d72[_0xa55c('0xec')][_0xa55c('0x117')](_0x197953[_0xa55c('0x118')]):_0x262d72['phone']):util[_0xa55c('0x27')]('SIP/%s/%s%s',_[_0xa55c('0x43')](_0x197953[_0xa55c('0x73')])?_0x197953[_0xa55c('0x71')][_0xa55c('0x29')]:_0x197953[_0xa55c('0x73')]['name'],_[_0xa55c('0x43')](_0x197953[_0xa55c('0x115')])?'':_0x197953[_0xa55c('0x115')]['trim']()||'',_0x197953[_0xa55c('0x118')]>0x0?_0x262d72[_0xa55c('0xec')][_0xa55c('0x117')](_0x197953['dialCutDigit']):_0x262d72[_0xa55c('0xec')]);var _0x2becbd=_0x16e229[_0xa55c('0x72')](_0x197953[_0xa55c('0x71')])?ut[_0xa55c('0x119')](_0x197953[_0xa55c('0x71')][_0xa55c('0x11a')],_0x197953['dialOriginateCallerIdName'],_0x197953[_0xa55c('0x11b')]>0x0?ut[_0xa55c('0x11c')](_0x197953[_0xa55c('0x11d')],_0x197953[_0xa55c('0x11b')]):_0x197953['dialOriginateCallerIdNumber']):ut[_0xa55c('0x119')](_[_0xa55c('0x43')](_0x197953[_0xa55c('0x73')])?_0x197953[_0xa55c('0x71')][_0xa55c('0x11a')]:_0x197953[_0xa55c('0x73')][_0xa55c('0x11a')],_0x197953['dialOriginateCallerIdName'],_0x197953[_0xa55c('0x11b')]>0x0?ut[_0xa55c('0x11c')](_0x197953[_0xa55c('0x11d')],_0x197953[_0xa55c('0x11b')]):_0x197953[_0xa55c('0x11d')]);if(_0x2becbd){_0x131288['originatecalleridname']=ut['extractCalleridName'](_0x2becbd);_0x131288['originatecalleridnum']=ut[_0xa55c('0x11e')](_0x2becbd);}var _0x124873=ut[_0xa55c('0x11f')](_0x197953,_0x262d72,_0x3d0c6d,_0x2becbd,_0x4b2e75,_0x131288);_[_0xa55c('0x120')](_0x131288,ut[_0xa55c('0x121')](_0x124873));_0x131288[_0xa55c('0x60')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));_0x197953['variables']=_0x124873;var _0x35c42c=ut[_0xa55c('0x122')](_0x131288,_0x197953,_0x124873,_0x131288[_0xa55c('0x87')],_0x228d12);return ami[_0xa55c('0x4c')](_0x35c42c)[_0xa55c('0x57')](function(_0xd511c0){_0x197953['originated']+=0x1;logger[_0xa55c('0x44')]('[originated][increment]',_0x4b2e75,'\x20Queue',_0x197953['name'],'originated:\x20',_0x197953[_0xa55c('0x2a')]);_0x5c8713(_0xd511c0);})[_0xa55c('0x5f')](function(_0x4732b4){ut[_0xa55c('0xde')](_0x131288,0xe,_0xa55c('0x123'));rpcDb[_0xa55c('0xdf')](_0x131288,_0xa55c('0x124'));_0x2d03b2(_0x4732b4);});});};Preview[_0xa55c('0x35')][_0xa55c('0x1e')]=function(_0x9c98af){if(this[_0xa55c('0x14')][_0x9c98af['linkedid']]){this['actions'][_0x9c98af[_0xa55c('0x88')]]['channel']=_0x9c98af[_0xa55c('0x125')];}};Preview[_0xa55c('0x35')][_0xa55c('0x16')]=function(_0x340570){var _0x2ef96f=this;var _0x582b22=this[_0xa55c('0x14')][_0x340570[_0xa55c('0x126')]];if(_0x582b22){if(_0x582b22[_0xa55c('0xef')]&&this['agents'][_0x582b22[_0xa55c('0xef')]]){ut[_0xa55c('0x127')](_0x582b22,this['agents'][_0x582b22['lookAgent']][_0xa55c('0x29')],this[_0xa55c('0x56')][_0x582b22[_0xa55c('0xef')]]['id']);}var _0x4f2883=_[_0xa55c('0x128')](_0x582b22);_0x4f2883[_0xa55c('0x8e')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));var _0x5a37d6=_0x2ef96f['campaignsPreview'][_0x582b22[_0xa55c('0x47')]];if(ut['isFailure'](_0x340570['response'])){if(_0x582b22[_0xa55c('0x86')]){rpcDb[_0xa55c('0x129')](_0x582b22[_0xa55c('0x8a')]);}if(_0x582b22[_0xa55c('0x87')]){rpcDb['disableContact'](_0x582b22[_0xa55c('0x8a')]);}ami[_0xa55c('0x24')](_0xa55c('0x12a'),ut[_0xa55c('0x7a')](_0x582b22,_0xa55c('0x12b'),this['campaignsPreview'][_0x582b22[_0xa55c('0x47')]]));this[_0xa55c('0xda')](_0x4f2883,_0x5a37d6,_0x340570);}else{_0x582b22[_0xa55c('0x60')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));ut[_0xa55c('0xde')](_0x4f2883,0x4,_0xa55c('0x12c'));rpcDb['createAgentHistory'](_0x4f2883,_0xa55c('0x12d'));}}};Preview['prototype'][_0xa55c('0x19')]=function(_0x26946f){var _0x3755a7=this['actions'][_0x26946f['linkedid']];var _0x307b39;if(_0x3755a7){_0x307b39=this[_0xa55c('0x12')][_0x3755a7['queue']];logger['info'](_0xa55c('0x12e'),_0x26946f[_0xa55c('0x88')],'\x20Queue',_0x307b39[_0xa55c('0x29')],'pTalking:\x20',_0x307b39[_0xa55c('0x90')]);}if(this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]&&_0x26946f[_0xa55c('0x88')]!==_0x26946f['uniqueid']){if(_0x26946f[_0xa55c('0x12f')]==='16'&&this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x26946f,_0x26946f[_0xa55c('0x88')],_0x26946f['cause']);}else if(this['actions'][_0x26946f[_0xa55c('0x88')]][_0xa55c('0x50')]){logger[_0xa55c('0x44')](_0xa55c('0x130'),_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')],_0xa55c('0x92'),_0x307b39[_0xa55c('0x29')],_0xa55c('0x48'),_0x307b39[_0xa55c('0x90')]);this['callProgressDetectingCustomer'](_0x26946f,_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')]);}}else if(_0x3755a7&&_[_0xa55c('0x43')](_0x3755a7[_0xa55c('0x131')])&&_0x307b39[_0xa55c('0x132')]&&_0x26946f['linkedid']===_0x26946f[_0xa55c('0xa2')]&&_[_0xa55c('0x43')](_0x26946f[_0xa55c('0xdd')])&&_0x26946f[_0xa55c('0x12f')]==='16'&&_0x26946f['channelstate']==='6'&&_[_0xa55c('0xdb')](_0x3755a7['transfer'])){if(_0x3755a7['unlockAgent']){rpcDb['unlockContact'](_0x3755a7['idContact']);}if(_0x3755a7[_0xa55c('0x87')]){rpcDb[_0xa55c('0x101')](_0x3755a7['idContact']);}_0x26946f[_0xa55c('0xdd')]='22';this[_0xa55c('0xda')](_0x3755a7,_0x307b39,_0x26946f);}else if(_0x3755a7&&_0x3755a7[_0xa55c('0x133')]){if(_0x26946f[_0xa55c('0x12f')]==='16'&&this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]['dialAnswer']){logger[_0xa55c('0x44')](_0xa55c('0x134'),_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')],'\x20Queue',_0x307b39['name'],'pTalking:\x20',_0x307b39[_0xa55c('0x90')]);this[_0xa55c('0x75')](_0x26946f,_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')]);}else if(this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]][_0xa55c('0x50')]){logger[_0xa55c('0x44')]('[syncHangup][talking][cause]',_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')],_0xa55c('0x92'),_0x307b39['name'],_0xa55c('0x48'),_0x307b39[_0xa55c('0x90')]);this['callProgressDetectingCustomer'](_0x26946f,_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')]);}}};Preview[_0xa55c('0x35')][_0xa55c('0x1c')]=function(_0x236015){if(this['actions'][_0x236015['destlinkedid']]&&_0x236015[_0xa55c('0xd8')]!==_0x236015[_0xa55c('0x135')]){this[_0xa55c('0x75')](_0x236015,_0x236015[_0xa55c('0xd8')],_0x236015[_0xa55c('0xce')]);}};Preview[_0xa55c('0x35')][_0xa55c('0x1a')]=function(_0x2511fe){if(this[_0xa55c('0x14')][_0x2511fe[_0xa55c('0x88')]]&&_0x2511fe['linkedid']!==_0x2511fe[_0xa55c('0xa2')]&&!this['actions'][_0x2511fe[_0xa55c('0x88')]][_0xa55c('0x50')]){if(_0x2511fe[_0xa55c('0x12f')]==='1'){this[_0xa55c('0x75')](_0x2511fe,_0x2511fe[_0xa55c('0x88')],_0x2511fe[_0xa55c('0x12f')]);}}};Preview[_0xa55c('0x35')][_0xa55c('0x136')]=function(_0x1e8760,_0x329808,_0x35ad66){if(this[_0xa55c('0x14')][_0x1e8760]){if(_[_0xa55c('0x43')](this['actions'][_0x1e8760][_0xa55c('0x137')])){this[_0xa55c('0x14')][_0x1e8760]['variables']={};}this[_0xa55c('0x14')][_0x1e8760][_0xa55c('0x137')][_0x329808]=_0x35ad66;}};Preview[_0xa55c('0x35')]['syncVarSet']=function(_0x238a43){try{if(!_[_0xa55c('0x43')](_0x238a43)){if(ut['filterKey'](_[_0xa55c('0x138')](_0x238a43[_0xa55c('0x139')])[0x0])){this['addVariable'](_0x238a43[_0xa55c('0xa2')],_['keys'](_0x238a43[_0xa55c('0x139')])[0x0],_0x238a43[_0xa55c('0x13a')]);}}}catch(_0x2a6c2d){logger[_0xa55c('0x13b')](_0xa55c('0x13c'),util[_0xa55c('0x13d')](_0x2a6c2d,{'showHidden':![],'depth':null}));}};Preview[_0xa55c('0x35')][_0xa55c('0x21')]=function(_0x9b5e3a){if(_0x9b5e3a){if(this[_0xa55c('0x14')][_0x9b5e3a[_0xa55c('0x13e')]]){this[_0xa55c('0x14')][_0x9b5e3a[_0xa55c('0x13e')]][_0xa55c('0x133')]=!![];}}};Preview[_0xa55c('0x35')][_0xa55c('0x23')]=function(_0x5ac4fa){if(_0x5ac4fa){if(this[_0xa55c('0x14')][_0x5ac4fa['transfererlinkedid']]){this[_0xa55c('0x14')][_0x5ac4fa[_0xa55c('0x13f')]][_0xa55c('0x133')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 748c767..b87c10c 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 _0xe453=['calleridname','queue','answertime','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/agentReportPreview','createHistory','catch','[createHistory]\x20','resolve','then','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum'];(function(_0x2c5231,_0x51913c){var _0x569090=function(_0x3a3db9){while(--_0x3a3db9){_0x2c5231['push'](_0x2c5231['shift']());}};_0x569090(++_0x51913c);}(_0xe453,0x133));var _0x3e45=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe453[_0x59ee6f];return _0x4c0979;};'use strict';var util=require(_0x3e45('0x0'));var BPromise=require('bluebird');var logger=require(_0x3e45('0x1'))(_0x3e45('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x3e45('0x3'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x3e45('0x4'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x39eaf4){return function(_0x5571c1){logger['error'](_0x39eaf4,util['inspect'](_0x5571c1,{'showHidden':![],'depth':null}));};}function create(_0x43301f){return cmHopperHistory[_0x3e45('0x5')](_0x43301f)[_0x3e45('0x6')](loggerCatch(_0x3e45('0x7')));}function createAgent(_0x5ab5ee){return BPromise[_0x3e45('0x8')]()[_0x3e45('0x9')](agentReportPreview['createHistory'](_0x5ab5ee))[_0x3e45('0x6')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3609a4){return cmHopper['moveContactManagedDialer'](_0x3609a4,!![])[_0x3e45('0x6')](loggerCatch(_0x3e45('0xa')));}exports[_0x3e45('0xb')]=function(_0x59643b){return cmHopperBlack['checkIsBlackList'](_0x59643b)[_0x3e45('0x6')](loggerCatch(_0x3e45('0xc')));};exports[_0x3e45('0xd')]=function(_0xe6c91e){return BPromise[_0x3e45('0x8')]()[_0x3e45('0x9')](cmHopper['getContactPreview'](_0xe6c91e))['catch'](loggerCatch(_0x3e45('0xe')));};exports[_0x3e45('0x5')]=function(_0xad3102,_0x447d37){create(_0xad3102)[_0x3e45('0x6')](loggerCatch(_0x447d37));moveContact(_0xad3102)[_0x3e45('0x6')](loggerCatch(_0x447d37));};exports[_0x3e45('0xf')]=function(_0x1ee97c,_0x483acd){createAgent(_0x1ee97c)['catch'](loggerCatch(_0x483acd));};exports[_0x3e45('0x10')]=function(_0x5b0462,_0x2b2cb9){create(_0x5b0462)[_0x3e45('0x6')](loggerCatch(_0x2b2cb9));};exports['createCustomerFinal']=function(_0x31c33d,_0xddb350){moveContact(_0x31c33d)['catch'](loggerCatch(_0xddb350));};exports[_0x3e45('0x11')]=function(_0x5c7265,_0x4ca38c,_0x48eac1){if(_0x4ca38c){_0x5c7265['UserId']=null;}if(_0x48eac1){_0x5c7265[_0x3e45('0x12')]=![];}return cmHopper['rescheduleContact'](_0x5c7265)['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0x3e45('0x13')]=function(_0x45a4be){return cmHopper[_0x3e45('0x13')](_0x45a4be)[_0x3e45('0x6')](loggerCatch(_0x3e45('0x14')));};exports[_0x3e45('0x15')]=function(_0xfc716d){return cmHopper['unlockContact']({'UserId':null},_0xfc716d,0x1)['catch'](loggerCatch(_0x3e45('0x16')));};exports[_0x3e45('0x17')]=function(_0x562370){return cmHopper['unlockContact']({'active':![]},_0x562370,0x1)[_0x3e45('0x6')](loggerCatch(_0x3e45('0x18')));};exports[_0x3e45('0x19')]=function(_0x59d732){var _0xcb3bf7={};_0xcb3bf7[_0x3e45('0x1a')]=_0x59d732['type'];_0xcb3bf7[_0x3e45('0x1b')]=_0x59d732[_0x3e45('0x1b')];_0xcb3bf7['calleridnum']=_0x59d732[_0x3e45('0x1c')];_0xcb3bf7[_0x3e45('0x1d')]=_0x59d732['calleridname'];_0xcb3bf7[_0x3e45('0x1e')]=_0x59d732['queue'];_0xcb3bf7['queuecallerjoinAt']=_0x59d732[_0x3e45('0x1f')];_0xcb3bf7['queuecallerleaveAt']=_0x59d732[_0x3e45('0x1f')];_0xcb3bf7[_0x3e45('0x20')]=0x1;_0xcb3bf7['queuecallercompleteAt']=_0x59d732[_0x3e45('0x21')];_0xcb3bf7[_0x3e45('0x22')]=_0x59d732[_0x3e45('0x23')];_0xcb3bf7[_0x3e45('0x24')]=_0x3e45('0x25');_0xcb3bf7[_0x3e45('0x26')]=_0x3e45('0x27');_0xcb3bf7[_0x3e45('0x28')]=0x0;_0xcb3bf7['assigned']=0x1;_0xcb3bf7[_0x3e45('0x29')]=_0x59d732[_0x3e45('0x23')];_0xcb3bf7['queuecallerexitreason']=_0x3e45('0x2a');return BPromise[_0x3e45('0x8')]()[_0x3e45('0x9')](voiceQueueReport[_0x3e45('0x2b')](_0xcb3bf7))[_0x3e45('0x6')](loggerCatch(_0x3e45('0x2c')));};exports[_0x3e45('0x2d')]=function(_0x2943a4,_0x38fc1f){return BPromise['resolve']()[_0x3e45('0x9')](cmHopper[_0x3e45('0x2d')](_0x2943a4,_0x38fc1f))[_0x3e45('0x6')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x3e45('0x2e')]=function(_0x16000c){return cmHopper[_0x3e45('0x11')](_0x16000c,!![],!![])[_0x3e45('0x6')](loggerCatch(_0x3e45('0x2f')));}; \ No newline at end of file +var _0xd5b3=['lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','then','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','from-sip','holdtime','assigned'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xd5b3,0x1ca));var _0x3d5b=function(_0x2b64e4,_0x2ffa7f){_0x2b64e4=_0x2b64e4-0x0;var _0x3b9320=_0xd5b3[_0x2b64e4];return _0x3b9320;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x3d5b('0x0'))(_0x3d5b('0x1'));var cmHopper=require(_0x3d5b('0x2'));var cmHopperHistory=require(_0x3d5b('0x3'));var cmHopperBlack=require(_0x3d5b('0x4'));var agentReportPreview=require(_0x3d5b('0x5'));var voiceQueueReport=require(_0x3d5b('0x6'));function loggerCatch(_0x404ce9){return function(_0xc840cc){logger[_0x3d5b('0x7')](_0x404ce9,util[_0x3d5b('0x8')](_0xc840cc,{'showHidden':![],'depth':null}));};}function create(_0x5bca57){return cmHopperHistory[_0x3d5b('0x9')](_0x5bca57)[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0xb')));}function createAgent(_0xe08043){return BPromise['resolve']()[_0x3d5b('0xc')](agentReportPreview[_0x3d5b('0x9')](_0xe08043))[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0xb')));}function moveContact(_0x18d5c3){return cmHopper['moveContactManagedDialer'](_0x18d5c3,!![])['catch'](loggerCatch(_0x3d5b('0xd')));}exports[_0x3d5b('0xe')]=function(_0x29e998){return cmHopperBlack[_0x3d5b('0xe')](_0x29e998)[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0xf')));};exports[_0x3d5b('0x10')]=function(_0x1c41b7){return BPromise[_0x3d5b('0x11')]()[_0x3d5b('0xc')](cmHopper[_0x3d5b('0x10')](_0x1c41b7))[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0x12')));};exports[_0x3d5b('0x9')]=function(_0xbefbb7,_0x37dfa5){create(_0xbefbb7)[_0x3d5b('0xa')](loggerCatch(_0x37dfa5));moveContact(_0xbefbb7)[_0x3d5b('0xa')](loggerCatch(_0x37dfa5));};exports[_0x3d5b('0x13')]=function(_0x465773,_0x4cd561){createAgent(_0x465773)[_0x3d5b('0xa')](loggerCatch(_0x4cd561));};exports[_0x3d5b('0x14')]=function(_0x2fc080,_0x5b0b5d){create(_0x2fc080)[_0x3d5b('0xa')](loggerCatch(_0x5b0b5d));};exports['createCustomerFinal']=function(_0x1eb810,_0x2cbb73){moveContact(_0x1eb810)[_0x3d5b('0xa')](loggerCatch(_0x2cbb73));};exports['rescheduleContact']=function(_0x2d5cab,_0x28cd67,_0x446a94){if(_0x28cd67){_0x2d5cab['UserId']=null;}if(_0x446a94){_0x2d5cab['active']=![];}return cmHopper[_0x3d5b('0x15')](_0x2d5cab)[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0x16')));};exports[_0x3d5b('0x17')]=function(_0x287cdb){return cmHopper[_0x3d5b('0x17')](_0x287cdb)[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0x18')));};exports[_0x3d5b('0x19')]=function(_0x4dc618){return cmHopper[_0x3d5b('0x19')]({'UserId':null},_0x4dc618,0x1)[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0x1a')));};exports[_0x3d5b('0x1b')]=function(_0x851351){return cmHopper[_0x3d5b('0x19')]({'active':![]},_0x851351,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x3d5b('0x1c')]=function(_0x63f984){var _0x2518e9={};_0x2518e9[_0x3d5b('0x1d')]=_0x63f984[_0x3d5b('0x1d')];_0x2518e9[_0x3d5b('0x1e')]=_0x63f984[_0x3d5b('0x1e')];_0x2518e9['calleridnum']=_0x63f984[_0x3d5b('0x1f')];_0x2518e9[_0x3d5b('0x20')]=_0x63f984[_0x3d5b('0x20')];_0x2518e9[_0x3d5b('0x21')]=_0x63f984['queue'];_0x2518e9['queuecallerjoinAt']=_0x63f984[_0x3d5b('0x22')];_0x2518e9['queuecallerleaveAt']=_0x63f984['answertime'];_0x2518e9[_0x3d5b('0x23')]=0x1;_0x2518e9[_0x3d5b('0x24')]=_0x63f984['endtime'];_0x2518e9[_0x3d5b('0x25')]=_0x63f984[_0x3d5b('0x26')];_0x2518e9['context']=_0x3d5b('0x27');_0x2518e9['exten']='xcally-motion-preview';_0x2518e9[_0x3d5b('0x28')]=0x0;_0x2518e9[_0x3d5b('0x29')]=0x1;_0x2518e9[_0x3d5b('0x2a')]=_0x63f984[_0x3d5b('0x26')];_0x2518e9[_0x3d5b('0x2b')]=_0x3d5b('0x2c');return BPromise[_0x3d5b('0x11')]()['then'](voiceQueueReport['create'](_0x2518e9))[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0x2d')));};exports[_0x3d5b('0x2e')]=function(_0x2bfe7b,_0x1fbb00){return BPromise[_0x3d5b('0x11')]()[_0x3d5b('0xc')](cmHopper['getContactRecallMe'](_0x2bfe7b,_0x1fbb00))['catch'](loggerCatch(_0x3d5b('0x2f')));};exports[_0x3d5b('0x30')]=function(_0x2b776a){return cmHopper['rescheduleContact'](_0x2b776a,!![],!![])[_0x3d5b('0xa')](loggerCatch(_0x3d5b('0x31')));}; \ 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 7a7134e..2377c7d 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 _0xae3e=['logger','info','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','format','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','hasOwnProperty','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','logLookAgent','membername','UserId','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','originate','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','channelAgent','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','reachable','getDiff','milliseconds','diff','createBody','filterKey','idContact','type','campaigntype','countnoanswerretry','countglobal','callback','callbackat','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','extractCalleridName','match','extractCalleridNumber','variables','keys','forEach','toLowerCase','util','lodash','../../../../config/logger','preview','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xae3e,0x10b));var _0xeae3=function(_0x24a6bc,_0x4074a6){_0x24a6bc=_0x24a6bc-0x0;var _0xb06138=_0xae3e[_0x24a6bc];return _0xb06138;};'use strict';var util=require(_0xeae3('0x0'));var _=require(_0xeae3('0x1'));var moment=require('moment');var logger=require(_0xeae3('0x2'))(_0xeae3('0x3'));var ipAgi=process['env'][_0xeae3('0x4')]||'127.0.0.1';var utils=require(_0xeae3('0x5'));exports[_0xeae3('0x6')]=function(_0x14df8d){return function(_0x2c2f1a){logger[_0xeae3('0x7')](_0x14df8d,util[_0xeae3('0x8')](_0x2c2f1a,{'showHidden':![],'depth':null}));};};exports[_0xeae3('0x9')]=function(_0x325f75,_0x3dac6b){logger[_0xeae3('0xa')](_0x325f75,util[_0xeae3('0x8')](_0x3dac6b,{'showHidden':![],'depth':null}));};exports[_0xeae3('0xb')]=function(_0x3be8a1,_0x2f34c9){logger['error'](_0x3be8a1,util['inspect'](_0x2f34c9,{'showHidden':![],'depth':null}));};exports[_0xeae3('0xc')]=function(_0x468ab8){return function(_0x3c1a36){logger['info'](_0x468ab8,util[_0xeae3('0x8')](_0x3c1a36,{'showHidden':![],'depth':null}));};};exports[_0xeae3('0xd')]=function(_0x196f17,_0x1da8f6,_0x2020b5){return{'message':_0x196f17,'unlock':_0x1da8f6,'active':_0x2020b5};};exports[_0xeae3('0xe')]=function(_0x33172a,_0x33b8c9,_0x3904c9){if(!_[_0xeae3('0xf')](_0x3904c9)&&'string'===typeof _0x3904c9&&!_[_0xeae3('0x10')](_0x3904c9)){if(!_[_0xeae3('0xf')](_0x33b8c9)&&_0xeae3('0x11')===typeof _0x33b8c9&&!_[_0xeae3('0x10')](_0x33b8c9)){return util['format'](_0xeae3('0x12'),_0x33b8c9,_0x3904c9);}return util['format'](_0xeae3('0x12'),_0x3904c9,_0x3904c9);}if(!_[_0xeae3('0xf')](_0x33172a)&&_0xeae3('0x11')===typeof _0x33172a&&!_[_0xeae3('0x10')](_0x33172a)){return _0x33172a;}return _0xeae3('0x13');};exports[_0xeae3('0x14')]=function(_0x5b3380){if(_[_0xeae3('0x15')](_0x5b3380)){return![];}return _0x5b3380;};exports['addVariables']=function(_0x334b10,_0x46ffbd,_0x1b6691,_0x51db59,_0x57f0d6,_0x3e09d5){var _0x49931a={'XMD-QUEUE':_0x46ffbd[_0xeae3('0x16')]?_0x46ffbd[_0xeae3('0x16')][_0xeae3('0x17')]:'','XMD-CALLERID':_0x51db59,'XMD-CALLERID-PREVIEW':_0x3e09d5?util['format'](_0xeae3('0x12'),_0x3e09d5[_0xeae3('0x18')],_0x3e09d5[_0xeae3('0x19')]):_0x51db59,'XMD-DIALID':_0x57f0d6,'XMD-CONTACTID':_0x46ffbd['ContactId'],'XMD-CDRTYPE':_0xeae3('0x1a'),'CALLERID(all)':_0x51db59,'XMD-VOICEQUEUEID':_0x46ffbd[_0xeae3('0x1b')],'XMD-DIALCHANNEL':_0x1b6691,'XMD-DIALTIMEOUT':_0x334b10[_0xeae3('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xeae3('0x1d')]('\x22rtTxX%s%s\x22',_0x334b10[_0xeae3('0x1e')]?'g':'',_[_0xeae3('0x10')](_0x334b10[_0xeae3('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x334b10['dialPreviewUrl']||'','XMD-AGI':_0x334b10[_0xeae3('0x20')]?util[_0xeae3('0x1d')](_0xeae3('0x21'),ipAgi,_0x334b10['dialQueueProject']):_0xeae3('0x22'),'XMD-AGIAFTER':_0x334b10[_0xeae3('0x1e')]?util[_0xeae3('0x1d')](_0xeae3('0x21'),ipAgi,_0x334b10[_0xeae3('0x1e')]):_0xeae3('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x3e09d5?_0x3e09d5[_0xeae3('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x3e09d5?_0x3e09d5[_0xeae3('0x24')]:'','XMD-DESTINATION':_0xeae3('0x25'),'SIPADDHEADER':_0xeae3('0x26')};if(!_[_0xeae3('0x10')](_0x334b10[_0xeae3('0x1f')])){_0x49931a[util[_0xeae3('0x1d')]('%s',_0xeae3('0x27'))]=_0x334b10[_0xeae3('0x1f')];_0x49931a[util[_0xeae3('0x1d')]('%s',_0xeae3('0x28'))]=_0x57f0d6;}return _0x49931a;};exports[_0xeae3('0x29')]=function(_0x1ec9b5){var _0x26bc12={};for(var _0x36f5de in _0x1ec9b5){if(_0x1ec9b5['hasOwnProperty'](_0x36f5de)){_0x26bc12[util[_0xeae3('0x1d')]('%s',_[_0xeae3('0x2a')](_0x36f5de))]=_0x1ec9b5[_0x36f5de];}}return{'variables':_0x26bc12};};exports['updateOriginated']=function(_0x18a1a2,_0xd31bfe){if(!_[_0xeae3('0x15')](_0x18a1a2)){if(_0x18a1a2[_0xeae3('0x2b')](_0xeae3('0x2c'))){if(_0x18a1a2[_0xeae3('0x2c')]>0x0){_0x18a1a2['originated']-=0x1;}else{logger[_0xeae3('0x7')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0xd31bfe);}}}else{logger['error'](_0xeae3('0x2d'),_0xd31bfe);}};exports[_0xeae3('0x2e')]=function(_0x3b8f99){var _0x13d36d=moment()[_0xeae3('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b8f99[_0xeae3('0x2f')]=0xd;_0x3b8f99[_0xeae3('0x30')]='Blacklist';_0x3b8f99[_0xeae3('0x31')]=_0x13d36d;_0x3b8f99[_0xeae3('0x32')]=_0x13d36d;_0x3b8f99[_0xeae3('0x33')]=_0x13d36d;};exports[_0xeae3('0x34')]=function(_0x1982b3,_0x4f4457,_0x447598){var _0x272861=moment()[_0xeae3('0x1d')](_0xeae3('0x35'));_0x1982b3[_0xeae3('0x2f')]=_0x4f4457;_0x1982b3['statedesc']=_0x447598;_0x1982b3['responsetime']=_0x272861;_0x1982b3[_0xeae3('0x36')]=utils[_0xeae3('0x37')](_0x1982b3[_0xeae3('0x32')],_0x1982b3[_0xeae3('0x31')]);};exports[_0xeae3('0x38')]=function(_0x12a557,_0x5fda37,_0x1b9c81){_0x12a557[_0xeae3('0x39')]=_0x5fda37;_0x12a557[_0xeae3('0x3a')]=_0x1b9c81;};exports['logCustomer']=function(_0x430b03,_0x1f8c19,_0x1836fe){var _0x465de6=moment()[_0xeae3('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');_0x430b03[_0xeae3('0x2f')]=_0x1f8c19;_0x430b03[_0xeae3('0x30')]=_0x1836fe;_0x430b03[_0xeae3('0x32')]=_0x430b03[_0xeae3('0x32')]?_0x430b03[_0xeae3('0x32')]:_0x465de6;_0x430b03['endtime']=_0x430b03[_0xeae3('0x33')]?_0x430b03[_0xeae3('0x33')]:_0x465de6;_0x430b03['ringtime']=utils['getSeconds'](_0x430b03[_0xeae3('0x32')]||0x0,_0x430b03[_0xeae3('0x31')]||0x0);_0x430b03[_0xeae3('0x3b')]=_0x430b03[_0xeae3('0x3c')]?utils[_0xeae3('0x37')](_0x430b03[_0xeae3('0x33')],_0x430b03[_0xeae3('0x3c')]):0x0;};exports[_0xeae3('0x3d')]=function(_0x11969a){return _0x11969a===_0xeae3('0x3e');};exports[_0xeae3('0x3f')]=function(_0x2fb50c,_0x1a6d2b,_0x4fe9b9,_0x3c38da,_0x347e79){var _0x3cee17=_0x3c38da?_0xeae3('0x40'):_0x2fb50c[_0xeae3('0x18')];_0x3cee17=_0x347e79?_0xeae3('0x41'):_0x3cee17;return{'actionid':_0x2fb50c['uniqueid'],'action':_0xeae3('0x42'),'channel':_0x2fb50c['channelAgent'],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x3cee17,_0x2fb50c['calleridnum']),'Exten':_0xeae3('0x25'),'Context':_0xeae3('0x43'),'Priority':'1','variable':_0x4fe9b9,'timeout':(_0x1a6d2b[_0xeae3('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2fb50c[_0xeae3('0x45')]};};exports[_0xeae3('0x46')]=function(_0x5bf6a5){return _0x5bf6a5[_0xeae3('0x47')]+_0x5bf6a5[_0xeae3('0x48')]+_0x5bf6a5['countnoanswerretry']+_0x5bf6a5[_0xeae3('0x49')]+_0x5bf6a5[_0xeae3('0x4a')];};exports['cloneAction']=function(_0x32fad3){var _0x850ba0=_[_0xeae3('0x4b')](_0x32fad3);_0x850ba0[_0xeae3('0x2f')]=0xf;_0x850ba0['statedesc']=_0xeae3('0x4c');return _0x850ba0;};exports[_0xeae3('0x4d')]=function(_0x4acbd8,_0x465cfb,_0x3f4a06){var _0x18b42d={};_0x18b42d[_0x465cfb]=_0x4acbd8[_0x465cfb];_0x18b42d[_0xeae3('0x4e')]=![];_0x18b42d[_0xeae3('0x4f')]=moment()[_0xeae3('0x50')](_0x3f4a06,_0xeae3('0x51'))[_0xeae3('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');_0x18b42d[_0xeae3('0x52')]=_0x4acbd8['ContactId'];_0x18b42d[_0xeae3('0x53')]=_0x4acbd8[_0xeae3('0x53')];_0x18b42d[_0xeae3('0x1b')]=_0x4acbd8[_0xeae3('0x1b')]||undefined;return _0x18b42d;};exports['decrementTalkink']=function(_0x5cc958,_0x226d8e){if(!_['isNil'](_0x5cc958)){if(_0x5cc958[_0xeae3('0x54')]>0x0){_0x5cc958[_0xeae3('0x54')]-=0x1;}else{logger['error'](_0x226d8e,_0xeae3('0x55'));}}else{logger[_0xeae3('0x7')](_0x226d8e,_0xeae3('0x56'));}};exports[_0xeae3('0x57')]=function(_0x3cfd18){if(_0x3cfd18<=0x0){return!![];}return![];};function buildObj(_0x3f229b,_0x1c6d43,_0x4ca689){_0x3f229b['lastevent']=_0x1c6d43;_0x3f229b[_0xeae3('0x17')]=_0x3f229b[_0xeae3('0x58')];_0x3f229b[_0xeae3('0x59')]=_0x3f229b[_0xeae3('0x5a')];_0x3f229b['motionChannel']=_0xeae3('0x5b');if(_0x4ca689){_0x3f229b[_0xeae3('0x5c')]=_0x4ca689['mandatoryDisposition'];}return _0x3f229b;}exports[_0xeae3('0x5d')]=buildObj;exports['buildAcw']=function(_0x34c6f4){var _0x4e09b4={};_0x4e09b4['queue']=_0x34c6f4[_0xeae3('0x58')];_0x4e09b4[_0xeae3('0x59')]=_0x34c6f4[_0xeae3('0x5a')];_0x4e09b4[_0xeae3('0x45')]=_0x34c6f4['uniqueid'];return _0x4e09b4;};exports[_0xeae3('0x5e')]=function(_0x35d22b){var _0x5a256d=[];for(var _0x5b926d in _0x35d22b){if(_0x35d22b[_0xeae3('0x2b')](_0x5b926d)){if(!_['isNil'](_0x35d22b[_0x5b926d])&&_0x35d22b[_0x5b926d][_0xeae3('0x2f')]===_0xeae3('0x5f')&&_0x35d22b[_0x5b926d]['status']===_0xeae3('0x60')){_0x5a256d['push'](_0x35d22b[_0x5b926d]['id']);}}}return _0x5a256d;};exports[_0xeae3('0x61')]=function(_0x312fde){var _0x16643d=moment()['milliseconds'](0x0);var _0x58d6c1=moment(_0x312fde)[_0xeae3('0x62')](0x0);return _0x16643d[_0xeae3('0x63')](_0x58d6c1,'seconds');};exports[_0xeae3('0x64')]=function(_0x5a73df){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5a73df[_0xeae3('0x52')],'ListId':_0x5a73df['ListId'],'VoiceQueueId':_0x5a73df[_0xeae3('0x1b')]||undefined,'CampaignId':_0x5a73df['CampaignId']||undefined};};exports[_0xeae3('0x65')]=function(_0x5b3d23){if(_0x5b3d23===_0xeae3('0x45')||_0x5b3d23===_0xeae3('0x66')||_0x5b3d23==='queue'||_0x5b3d23===_0xeae3('0x67')||_0x5b3d23===_0xeae3('0x68')||_0x5b3d23==='dialAnswer'||_0x5b3d23===_0xeae3('0x39')||_0x5b3d23===_0xeae3('0x5a')||_0x5b3d23===_0xeae3('0x18')||_0x5b3d23==='active'||_0x5b3d23===_0xeae3('0x19')||_0x5b3d23===_0xeae3('0x4f')||_0x5b3d23==='countbusyretry'||_0x5b3d23===_0xeae3('0x48')||_0x5b3d23===_0xeae3('0x69')||_0x5b3d23===_0xeae3('0x6a')||_0x5b3d23===_0xeae3('0x6b')||_0x5b3d23==='callbackuniqueid'||_0x5b3d23===_0xeae3('0x6c')||_0x5b3d23==='recallme'||_0x5b3d23===_0xeae3('0x52')||_0x5b3d23==='ListId'||_0x5b3d23===_0xeae3('0x3a')||_0x5b3d23==='VoiceQueueId'||_0x5b3d23==='sipcallid'||_0x5b3d23==='xmd-voicequeueid'||_0x5b3d23===_0xeae3('0x6d')||_0x5b3d23===_0xeae3('0x6e')||_0x5b3d23===_0xeae3('0x6f')||_0x5b3d23===_0xeae3('0x70')||_0x5b3d23===_0xeae3('0x71')||_0x5b3d23===_0xeae3('0x72')||_0x5b3d23===_0xeae3('0x73')||_0x5b3d23==='xmd-dialchannel'||_0x5b3d23===_0xeae3('0x74')||_0x5b3d23===_0xeae3('0x75')||_0x5b3d23===_0xeae3('0x76')||_0x5b3d23==='xmd-agiafter'||_0x5b3d23===_0xeae3('0x77')||_0x5b3d23===_0xeae3('0x78')||_0x5b3d23===_0xeae3('0x79')||_0x5b3d23===_0xeae3('0x7a')||_0x5b3d23===_0xeae3('0x7b')||_0x5b3d23==='rtpaudioqosloss'||_0x5b3d23===_0xeae3('0x7c')||_0x5b3d23==='rtpaudioqosrtt'||_0x5b3d23===_0xeae3('0x7d')||_0x5b3d23===_0xeae3('0x78')||_0x5b3d23===_0xeae3('0x79')||_0x5b3d23===_0xeae3('0x7a')||_0x5b3d23==='rtpaudioqosjitterbridged'||_0x5b3d23==='rtpaudioqosloss'||_0x5b3d23===_0xeae3('0x7c')||_0x5b3d23===_0xeae3('0x7e')||_0x5b3d23===_0xeae3('0x7d')||_0x5b3d23===_0xeae3('0x7f')||_0x5b3d23==='bridgepvtcallid'||_0x5b3d23===_0xeae3('0x2f')||_0x5b3d23===_0xeae3('0x30')){return![];}return!![];};exports[_0xeae3('0x80')]=function(_0x173bd9,_0x458f70){var _0xe5bc6e,_0x2d46ee,_0xeac546;if(_0x458f70<=0x0){_0x458f70=0x1;}_0xe5bc6e=new RegExp(_0xeae3('0x81')+_0x458f70+'}$');_0x2d46ee=Math[_0xeae3('0x82')](0xa,_0x458f70-0x1);_0xeac546=Math[_0xeae3('0x82')](0xa,_0x458f70)-0x1;return util[_0xeae3('0x1d')]('%s',_['replace'](_0x173bd9,_0xe5bc6e,_['random'](_0x2d46ee,_0xeac546)));};exports[_0xeae3('0x83')]=function(_0x12cec1){var _0xcd403e=_0x12cec1[_0xeae3('0x84')](/"(.*?)"/);return _0xcd403e?_0xcd403e[0x1]:_0x12cec1;};exports[_0xeae3('0x85')]=function(_0x3fef5c){var _0x534535=_0x3fef5c[_0xeae3('0x84')](/<(.*?)>/);return _0x534535?_0x534535[0x1]:_0x3fef5c;};function buildNoAnswerEventPayload(_0x4f793e,_0x3ad6d7){var _0x210023=buildObj(_0x4f793e,'noanswer');if(!_[_0xeae3('0x10')](_0x3ad6d7[_0xeae3('0x86')])){Object[_0xeae3('0x87')](_0x3ad6d7[_0xeae3('0x86')])[_0xeae3('0x88')](function(_0x2b2323){_0x210023[_0x2b2323[_0xeae3('0x89')]()]=_0x3ad6d7['variables'][_0x2b2323];});}return _0x210023;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x42c9=['scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','mandatoryDisposition','buildAcw','hasOwnProperty','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','dialAnswer','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-agi','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridName','noanswer','keys','forEach','toLowerCase','variables','util','lodash','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','info','loggerError','logger2','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','logAgent','responsetime','getSeconds','logLookAgent','membername','UserId','logCustomer','endtime','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','originate','channelAgent','from-sip','timeout','uniqueid','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global'];(function(_0x49c810,_0x2eed6e){var _0x1e1391=function(_0x596bd2){while(--_0x596bd2){_0x49c810['push'](_0x49c810['shift']());}};_0x1e1391(++_0x2eed6e);}(_0x42c9,0xc8));var _0x942c=function(_0x4f4c2a,_0x5f5a28){_0x4f4c2a=_0x4f4c2a-0x0;var _0xd15be6=_0x42c9[_0x4f4c2a];return _0xd15be6;};'use strict';var util=require(_0x942c('0x0'));var _=require(_0x942c('0x1'));var moment=require('moment');var logger=require(_0x942c('0x2'))('preview');var ipAgi=process[_0x942c('0x3')][_0x942c('0x4')]||_0x942c('0x5');var utils=require(_0x942c('0x6'));exports[_0x942c('0x7')]=function(_0x1a4f5d){return function(_0x361179){logger['error'](_0x1a4f5d,util[_0x942c('0x8')](_0x361179,{'showHidden':![],'depth':null}));};};exports[_0x942c('0x9')]=function(_0x1c1513,_0x1a171a){logger[_0x942c('0xa')](_0x1c1513,util[_0x942c('0x8')](_0x1a171a,{'showHidden':![],'depth':null}));};exports[_0x942c('0xb')]=function(_0x2edb60,_0x2c2a65){logger['error'](_0x2edb60,util[_0x942c('0x8')](_0x2c2a65,{'showHidden':![],'depth':null}));};exports[_0x942c('0xc')]=function(_0x4c3574){return function(_0x421fbd){logger[_0x942c('0xa')](_0x4c3574,util[_0x942c('0x8')](_0x421fbd,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x228aa4,_0x464dd8,_0x16015d){return{'message':_0x228aa4,'unlock':_0x464dd8,'active':_0x16015d};};exports['getCallerId']=function(_0x2605a7,_0x38b165,_0x355daf){if(!_[_0x942c('0xd')](_0x355daf)&&_0x942c('0xe')===typeof _0x355daf&&!_[_0x942c('0xf')](_0x355daf)){if(!_[_0x942c('0xd')](_0x38b165)&&_0x942c('0xe')===typeof _0x38b165&&!_[_0x942c('0xf')](_0x38b165)){return util[_0x942c('0x10')](_0x942c('0x11'),_0x38b165,_0x355daf);}return util[_0x942c('0x10')](_0x942c('0x11'),_0x355daf,_0x355daf);}if(!_[_0x942c('0xd')](_0x2605a7)&&_0x942c('0xe')===typeof _0x2605a7&&!_[_0x942c('0xf')](_0x2605a7)){return _0x2605a7;}return _0x942c('0x12');};exports[_0x942c('0x13')]=function(_0x519d91){if(_[_0x942c('0x14')](_0x519d91)){return![];}return _0x519d91;};exports[_0x942c('0x15')]=function(_0x3255dd,_0x1a9e23,_0x32a8c7,_0x42eac0,_0x18e2ac,_0x47ff62){var _0x330fdb={'XMD-QUEUE':_0x1a9e23[_0x942c('0x16')]?_0x1a9e23[_0x942c('0x16')][_0x942c('0x17')]:'','XMD-CALLERID':_0x42eac0,'XMD-CALLERID-PREVIEW':_0x47ff62?util[_0x942c('0x10')](_0x942c('0x11'),_0x47ff62[_0x942c('0x18')],_0x47ff62[_0x942c('0x19')]):_0x42eac0,'XMD-DIALID':_0x18e2ac,'XMD-CONTACTID':_0x1a9e23[_0x942c('0x1a')],'XMD-CDRTYPE':_0x942c('0x1b'),'CALLERID(all)':_0x42eac0,'XMD-VOICEQUEUEID':_0x1a9e23[_0x942c('0x1c')],'XMD-DIALCHANNEL':_0x32a8c7,'XMD-DIALTIMEOUT':_0x3255dd['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x942c('0x10')](_0x942c('0x1d'),_0x3255dd['dialQueueProject2']?'g':'',_[_0x942c('0xf')](_0x3255dd['monitor_format'])?'':_0x942c('0x1e')),'XMD-DIALURL':_0x3255dd['dialPreviewUrl']||'','XMD-AGI':_0x3255dd[_0x942c('0x1f')]?util[_0x942c('0x10')](_0x942c('0x20'),ipAgi,_0x3255dd[_0x942c('0x1f')]):_0x942c('0x21'),'XMD-AGIAFTER':_0x3255dd['dialQueueProject2']?util[_0x942c('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3255dd['dialQueueProject2']):_0x942c('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x47ff62?_0x47ff62[_0x942c('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x47ff62?_0x47ff62[_0x942c('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x942c('0x24')};if(!_[_0x942c('0xf')](_0x3255dd[_0x942c('0x25')])){_0x330fdb[util[_0x942c('0x10')]('%s',_0x942c('0x26'))]=_0x3255dd[_0x942c('0x25')];_0x330fdb[util['format']('%s',_0x942c('0x27'))]=_0x18e2ac;}if(_0x1a9e23&&_0x1a9e23[_0x942c('0x28')]){for(var _0xcbe842 in _0x1a9e23['Contact']){if(_0x1a9e23[_0x942c('0x28')]['hasOwnProperty'](_0xcbe842)){if(!_[_0x942c('0x14')](_0x1a9e23[_0x942c('0x28')][_0xcbe842])&&_0xcbe842!=='id'&&_0xcbe842!==_0x942c('0x29')&&_0xcbe842!=='createdAt'&&_0xcbe842!==_0x942c('0x2a')){_0x330fdb[util[_0x942c('0x10')](_0x942c('0x2b'),_0x942c('0x2c'),_['toUpper'](_0xcbe842))]=_0x1a9e23['Contact'][_0xcbe842];}}}}return _0x330fdb;};exports[_0x942c('0x2d')]=function(_0x139cbe){var _0x4f9edb={};for(var _0x76b80d in _0x139cbe){if(_0x139cbe['hasOwnProperty'](_0x76b80d)){_0x4f9edb[util[_0x942c('0x10')]('%s',_[_0x942c('0x2e')](_0x76b80d))]=_0x139cbe[_0x76b80d];}}return{'variables':_0x4f9edb};};exports[_0x942c('0x2f')]=function(_0x5512ac,_0x4528f8){if(!_[_0x942c('0x14')](_0x5512ac)){if(_0x5512ac['hasOwnProperty'](_0x942c('0x30'))){if(_0x5512ac[_0x942c('0x30')]>0x0){_0x5512ac['originated']-=0x1;}else{logger[_0x942c('0x31')](_0x942c('0x32'),_0x4528f8);}}}else{logger['error'](_0x942c('0x33'),_0x4528f8);}};exports['logBlacklist']=function(_0x40135f){var _0xe92ce7=moment()[_0x942c('0x10')](_0x942c('0x34'));_0x40135f[_0x942c('0x35')]=0xd;_0x40135f[_0x942c('0x36')]=_0x942c('0x37');_0x40135f[_0x942c('0x38')]=_0xe92ce7;_0x40135f['responsetime']=_0xe92ce7;_0x40135f['endtime']=_0xe92ce7;};exports[_0x942c('0x39')]=function(_0x592565,_0x29e313,_0x411bc0){var _0x43ab9f=moment()['format'](_0x942c('0x34'));_0x592565[_0x942c('0x35')]=_0x29e313;_0x592565['statedesc']=_0x411bc0;_0x592565[_0x942c('0x3a')]=_0x43ab9f;_0x592565['ringtime']=utils[_0x942c('0x3b')](_0x592565[_0x942c('0x3a')],_0x592565[_0x942c('0x38')]);};exports[_0x942c('0x3c')]=function(_0x185a3b,_0x4fe76a,_0x478de3){_0x185a3b[_0x942c('0x3d')]=_0x4fe76a;_0x185a3b[_0x942c('0x3e')]=_0x478de3;};exports[_0x942c('0x3f')]=function(_0x5abb09,_0x11d085,_0x2e6963){var _0x4badc0=moment()['format'](_0x942c('0x34'));_0x5abb09[_0x942c('0x35')]=_0x11d085;_0x5abb09[_0x942c('0x36')]=_0x2e6963;_0x5abb09[_0x942c('0x3a')]=_0x5abb09[_0x942c('0x3a')]?_0x5abb09[_0x942c('0x3a')]:_0x4badc0;_0x5abb09[_0x942c('0x40')]=_0x5abb09['endtime']?_0x5abb09[_0x942c('0x40')]:_0x4badc0;_0x5abb09[_0x942c('0x41')]=utils['getSeconds'](_0x5abb09[_0x942c('0x3a')]||0x0,_0x5abb09[_0x942c('0x38')]||0x0);_0x5abb09[_0x942c('0x42')]=_0x5abb09[_0x942c('0x43')]?utils[_0x942c('0x3b')](_0x5abb09[_0x942c('0x40')],_0x5abb09[_0x942c('0x43')]):0x0;};exports[_0x942c('0x44')]=function(_0x5a6d4a){return _0x5a6d4a===_0x942c('0x45');};exports[_0x942c('0x46')]=function(_0x1b6f80,_0x473ba7,_0x44eedf,_0x44542c,_0x2dfe90){var _0x5a7030=_0x44542c?_0x942c('0x47'):_0x1b6f80['calleridname'];_0x5a7030=_0x2dfe90?'BOOKED':_0x5a7030;return{'actionid':_0x1b6f80['uniqueid'],'action':_0x942c('0x48'),'channel':_0x1b6f80[_0x942c('0x49')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x5a7030,_0x1b6f80[_0x942c('0x19')]),'Exten':'xcally-motion-preview','Context':_0x942c('0x4a'),'Priority':'1','variable':_0x44eedf,'timeout':(_0x473ba7[_0x942c('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1b6f80[_0x942c('0x4c')]};};exports['totalGlobal']=function(_0x37ca51){return _0x37ca51[_0x942c('0x4d')]+_0x37ca51[_0x942c('0x4e')]+_0x37ca51[_0x942c('0x4f')]+_0x37ca51[_0x942c('0x50')]+_0x37ca51[_0x942c('0x51')];};exports[_0x942c('0x52')]=function(_0x446789){var _0x53b608=_['clone'](_0x446789);_0x53b608[_0x942c('0x35')]=0xf;_0x53b608[_0x942c('0x36')]=_0x942c('0x53');return _0x53b608;};exports[_0x942c('0x54')]=function(_0x39e61f,_0xf18678,_0x1a8740){var _0x2ab101={};_0x2ab101[_0xf18678]=_0x39e61f[_0xf18678];_0x2ab101[_0x942c('0x55')]=![];_0x2ab101[_0x942c('0x56')]=moment()[_0x942c('0x57')](_0x1a8740,_0x942c('0x58'))[_0x942c('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x2ab101[_0x942c('0x1a')]=_0x39e61f['ContactId'];_0x2ab101['ListId']=_0x39e61f[_0x942c('0x59')];_0x2ab101[_0x942c('0x1c')]=_0x39e61f[_0x942c('0x1c')]||undefined;return _0x2ab101;};exports[_0x942c('0x5a')]=function(_0x1ce9b2,_0x2865e6){if(!_[_0x942c('0x14')](_0x1ce9b2)){if(_0x1ce9b2[_0x942c('0x5b')]>0x0){_0x1ce9b2[_0x942c('0x5b')]-=0x1;}else{logger[_0x942c('0x31')](_0x2865e6,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x942c('0x31')](_0x2865e6,_0x942c('0x5c'));}};exports[_0x942c('0x5d')]=function(_0x43e5d0){if(_0x43e5d0<=0x0){return!![];}return![];};function buildObj(_0x416b51,_0x2fc9e0,_0x3ba34e){_0x416b51[_0x942c('0x5e')]=_0x2fc9e0;_0x416b51['name']=_0x416b51[_0x942c('0x5f')];_0x416b51[_0x942c('0x60')]=_0x416b51[_0x942c('0x49')];_0x416b51['motionChannel']='voice';if(_0x3ba34e){_0x416b51[_0x942c('0x61')]=_0x3ba34e[_0x942c('0x61')];}return _0x416b51;}exports['buildObj']=buildObj;exports[_0x942c('0x62')]=function(_0x1b7928){var _0x132a69={};_0x132a69[_0x942c('0x5f')]=_0x1b7928[_0x942c('0x5f')];_0x132a69[_0x942c('0x60')]=_0x1b7928['channelAgent'];_0x132a69[_0x942c('0x4c')]=_0x1b7928[_0x942c('0x4c')];return _0x132a69;};exports['agentReadyId']=function(_0x59f43a){var _0x393dc8=[];for(var _0x3c6e2e in _0x59f43a){if(_0x59f43a[_0x942c('0x63')](_0x3c6e2e)){if(!_[_0x942c('0x14')](_0x59f43a[_0x3c6e2e])&&_0x59f43a[_0x3c6e2e]['state']===_0x942c('0x64')&&_0x59f43a[_0x3c6e2e][_0x942c('0x65')]===_0x942c('0x66')){_0x393dc8[_0x942c('0x67')](_0x59f43a[_0x3c6e2e]['id']);}}}return _0x393dc8;};exports[_0x942c('0x68')]=function(_0x5aceb7){var _0x4e79f2=moment()[_0x942c('0x69')](0x0);var _0x26b413=moment(_0x5aceb7)['milliseconds'](0x0);return _0x4e79f2[_0x942c('0x6a')](_0x26b413,_0x942c('0x6b'));};exports[_0x942c('0x6c')]=function(_0x3ed48f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ed48f['ContactId'],'ListId':_0x3ed48f[_0x942c('0x59')],'VoiceQueueId':_0x3ed48f[_0x942c('0x1c')]||undefined,'CampaignId':_0x3ed48f[_0x942c('0x6d')]||undefined};};exports[_0x942c('0x6e')]=function(_0x1c0341){if(_0x1c0341==='uniqueid'||_0x1c0341===_0x942c('0x6f')||_0x1c0341==='queue'||_0x1c0341===_0x942c('0x70')||_0x1c0341==='campaigntype'||_0x1c0341===_0x942c('0x71')||_0x1c0341===_0x942c('0x3d')||_0x1c0341==='channelAgent'||_0x1c0341===_0x942c('0x18')||_0x1c0341===_0x942c('0x55')||_0x1c0341==='calleridnum'||_0x1c0341===_0x942c('0x56')||_0x1c0341===_0x942c('0x4d')||_0x1c0341===_0x942c('0x4e')||_0x1c0341===_0x942c('0x4f')||_0x1c0341==='countglobal'||_0x1c0341===_0x942c('0x72')||_0x1c0341===_0x942c('0x73')||_0x1c0341===_0x942c('0x74')||_0x1c0341==='recallme'||_0x1c0341==='ContactId'||_0x1c0341===_0x942c('0x59')||_0x1c0341===_0x942c('0x3e')||_0x1c0341===_0x942c('0x1c')||_0x1c0341===_0x942c('0x75')||_0x1c0341==='xmd-voicequeueid'||_0x1c0341===_0x942c('0x76')||_0x1c0341===_0x942c('0x77')||_0x1c0341==='xmd-listid'||_0x1c0341==='xmd-dialurl'||_0x1c0341===_0x942c('0x78')||_0x1c0341==='xmd-dialoptions'||_0x1c0341==='xmd-dialid'||_0x1c0341===_0x942c('0x79')||_0x1c0341===_0x942c('0x7a')||_0x1c0341==='xmd-cdrtype'||_0x1c0341==='xmd-callerid'||_0x1c0341==='xmd-agiafter'||_0x1c0341===_0x942c('0x7b')||_0x1c0341==='rtpaudioqos'||_0x1c0341==='rtpaudioqosbridged'||_0x1c0341===_0x942c('0x7c')||_0x1c0341==='rtpaudioqosjitterbridged'||_0x1c0341===_0x942c('0x7d')||_0x1c0341===_0x942c('0x7e')||_0x1c0341===_0x942c('0x7f')||_0x1c0341==='rtpaudioqosrttbridged'||_0x1c0341===_0x942c('0x80')||_0x1c0341===_0x942c('0x81')||_0x1c0341===_0x942c('0x7c')||_0x1c0341===_0x942c('0x82')||_0x1c0341==='rtpaudioqosloss'||_0x1c0341===_0x942c('0x7e')||_0x1c0341==='rtpaudioqosrtt'||_0x1c0341==='rtpaudioqosrttbridged'||_0x1c0341===_0x942c('0x83')||_0x1c0341==='bridgepvtcallid'||_0x1c0341===_0x942c('0x35')||_0x1c0341===_0x942c('0x36')){return![];}return!![];};exports[_0x942c('0x84')]=function(_0x2a148b,_0x490ccc){var _0x4a85e6,_0x445e44,_0x27fff2;if(_0x490ccc<=0x0){_0x490ccc=0x1;}_0x4a85e6=new RegExp('\x5cw{0,'+_0x490ccc+'}$');_0x445e44=Math[_0x942c('0x85')](0xa,_0x490ccc-0x1);_0x27fff2=Math[_0x942c('0x85')](0xa,_0x490ccc)-0x1;return util[_0x942c('0x10')]('%s',_[_0x942c('0x86')](_0x2a148b,_0x4a85e6,_[_0x942c('0x87')](_0x445e44,_0x27fff2)));};exports[_0x942c('0x88')]=function(_0xa36a59){var _0x35ad69=_0xa36a59['match'](/"(.*?)"/);return _0x35ad69?_0x35ad69[0x1]:_0xa36a59;};exports['extractCalleridNumber']=function(_0x7f737d){var _0x4ffe05=_0x7f737d['match'](/<(.*?)>/);return _0x4ffe05?_0x4ffe05[0x1]:_0x7f737d;};function buildNoAnswerEventPayload(_0x1bf85f,_0x1134fb){var _0x1db758=buildObj(_0x1bf85f,_0x942c('0x89'));if(!_[_0x942c('0xf')](_0x1134fb['variables'])){Object[_0x942c('0x8a')](_0x1134fb['variables'])[_0x942c('0x8b')](function(_0x14fd59){_0x1db758[_0x14fd59[_0x942c('0x8c')]()]=_0x1134fb[_0x942c('0x8d')][_0x14fd59];});}return _0x1db758;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 884ee91..24b2ba0 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 _0x41ca=['queueadd','string','number','boolean','queueremove','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x20e205,_0x5d1e06){var _0x168b52=function(_0x1e429a){while(--_0x1e429a){_0x20e205['push'](_0x20e205['shift']());}};_0x168b52(++_0x5d1e06);}(_0x41ca,0x90));var _0xa41c=function(_0x331df1,_0x279a91){_0x331df1=_0x331df1-0x0;var _0x592ffe=_0x41ca[_0x331df1];return _0x592ffe;};'use strict';exports[_0xa41c('0x0')]={'queue':{'type':_0xa41c('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xa41c('0x1'),'required':!![]},'penalty':{'type':_0xa41c('0x2'),'required':![]},'paused':{'type':_0xa41c('0x3'),'required':![]}};exports[_0xa41c('0x4')]={'queue':{'type':_0xa41c('0x1'),'required':!![]},'interface':{'type':_0xa41c('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xa41c('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xa41c('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xa41c('0x1'),'required':![]}};exports[_0xa41c('0x5')]={'uniqueid':{'type':_0xa41c('0x1'),'required':!![]}};exports[_0xa41c('0x6')]={'uniqueid':{'type':_0xa41c('0x1'),'required':!![]},'filename':{'type':_0xa41c('0x1')},'format':{'type':_0xa41c('0x1')},'mixmonitorid':{'type':_0xa41c('0x1')}};exports[_0xa41c('0x7')]={'uniqueid':{'type':_0xa41c('0x1'),'required':!![]}};exports[_0xa41c('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xebe6=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queuepause','reload','voicequeuechannel'];(function(_0x44138f,_0x4c5a10){var _0x1da9fb=function(_0x424306){while(--_0x424306){_0x44138f['push'](_0x44138f['shift']());}};_0x1da9fb(++_0x4c5a10);}(_0xebe6,0x17f));var _0x6ebe=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0xebe6[_0x1f1a97];return _0x29fc6a;};'use strict';exports[_0x6ebe('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x6ebe('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x6ebe('0x2'),'required':![]},'paused':{'type':_0x6ebe('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x6ebe('0x4')]={'interface':{'type':_0x6ebe('0x1'),'required':!![]},'paused':{'type':_0x6ebe('0x3')},'reason':{'type':'string','required':![]}};exports[_0x6ebe('0x5')]={'module':{'type':_0x6ebe('0x1'),'required':![]}};exports[_0x6ebe('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x6ebe('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x6ebe('0x1')},'format':{'type':_0x6ebe('0x1')},'mixmonitorid':{'type':_0x6ebe('0x1')}};exports[_0x6ebe('0x8')]={'uniqueid':{'type':_0x6ebe('0x1'),'required':!![]}};exports[_0x6ebe('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 95fe064..a0cbb84 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 _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x48b718,_0x306ca3){var _0x1678c6=function(_0x103cc7){while(--_0x103cc7){_0x48b718['push'](_0x48b718['shift']());}};_0x1678c6(++_0x306ca3);}(_0xb10b,0x12a));var _0xbb10=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0xb10b[_0x184759];return _0xf26d5f;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x471401,_0x2100c4){var _0x50db1c=function(_0x36eec8){while(--_0x36eec8){_0x471401['push'](_0x471401['shift']());}};_0x50db1c(++_0x2100c4);}(_0xdb28,0x106));var _0x8db2=function(_0x470271,_0x130801){_0x470271=_0x470271-0x0;var _0x25ceab=_0xdb28[_0x470271];return _0x25ceab;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 8885386..2606def 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42ce=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x42ce,0xbc));var _0xe42c=function(_0x4283c8,_0x10f507){_0x4283c8=_0x4283c8-0x0;var _0x5baece=_0x42ce[_0x4283c8];return _0x5baece;};'use strict';function mergeDBDataToRealtime(_0x53d220,_0x4a700c){var _0x2572d4=Object[_0xe42c('0x0')]({},_0x53d220);for(var _0x32a67a in _0x4a700c){if(_0x2572d4[_0xe42c('0x1')](_0x32a67a)){_0x2572d4[_0x32a67a]=_0x4a700c[_0x32a67a];}}return _0x2572d4;}exports[_0xe42c('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x49c0=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x2769e9,_0x1b3f30){var _0x38dc96=function(_0x245354){while(--_0x245354){_0x2769e9['push'](_0x2769e9['shift']());}};_0x38dc96(++_0x1b3f30);}(_0x49c0,0x1ce));var _0x049c=function(_0x481ce9,_0x21d1ec){_0x481ce9=_0x481ce9-0x0;var _0x3c984e=_0x49c0[_0x481ce9];return _0x3c984e;};'use strict';function mergeDBDataToRealtime(_0x30b5df,_0x35692b){var _0x329a39=Object[_0x049c('0x0')]({},_0x30b5df);for(var _0x14f519 in _0x35692b){if(_0x329a39[_0x049c('0x1')](_0x14f519)){_0x329a39[_0x14f519]=_0x35692b[_0x14f519];}}return _0x329a39;}exports[_0x049c('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 0014771..0d274c4 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 _0x5a50=['./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','findAgent','accountcode','name','isNil','find','format','length','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','keys','getCallType','channel','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','UserId','split','create','monitor','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','indexOf','mobile','phone','lastIndexOf','membername','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceCallReport'];(function(_0x4ea661,_0x5d59a0){var _0x40a9f1=function(_0xc56f31){while(--_0xc56f31){_0x4ea661['push'](_0x4ea661['shift']());}};_0x40a9f1(++_0x5d59a0);}(_0x5a50,0x1cb));var _0x05a5=function(_0x127bc2,_0x42535b){_0x127bc2=_0x127bc2-0x0;var _0x191871=_0x5a50[_0x127bc2];return _0x191871;};'use strict';var _=require(_0x05a5('0x0'));var moment=require(_0x05a5('0x1'));var util=require(_0x05a5('0x2'));var config=require(_0x05a5('0x3'));var ami=require(_0x05a5('0x4'));var RpcVoiceAgentReport=require(_0x05a5('0x5'));var RpcVoiceCallReport=require(_0x05a5('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x05a5('0x7'));var RpcVoiceQueueReport=require(_0x05a5('0x8'));var RpcVoiceRecording=require(_0x05a5('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x05a5('0xa'));var VoiceAgentReport=require(_0x05a5('0xb'));var VoiceDialReport=require(_0x05a5('0xc'));var UserReport=require(_0x05a5('0xd'));function Report(_0x487c57){this[_0x05a5('0xe')]=_0x487c57;this['agents']=_0x487c57[_0x05a5('0xf')];this['telephones']=_0x487c57[_0x05a5('0x10')];}Report[_0x05a5('0x11')][_0x05a5('0x12')]=function(_0x494328){var _0x27a18b=new VoiceQueueReport(this[_0x05a5('0xe')]);var _0x37c8dc=new VoiceAgentReport(this[_0x05a5('0xe')]);var _0xe989d7=new VoiceDialReport(this[_0x05a5('0xe')]);var _0x4cf1da=new VoiceCallReport(this[_0x05a5('0xe')]);var _0x3e388e=new UserReport(this[_0x05a5('0xe')]);if(config['xdr']&&config[_0x05a5('0x13')]['disabled']){ami['on'](_0x05a5('0x14'),this[_0x05a5('0x15')][_0x05a5('0x16')](this));ami['on'](_0x05a5('0x17'),this[_0x05a5('0x18')]['bind'](this));ami['on'](_0x05a5('0x19'),this[_0x05a5('0x1a')][_0x05a5('0x16')](this));ami['on'](_0x05a5('0x1b'),this[_0x05a5('0x1c')][_0x05a5('0x16')](this));ami['on']('blindtransfer',this[_0x05a5('0x1d')][_0x05a5('0x16')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x05a5('0x16')](this));}};Report[_0x05a5('0x11')][_0x05a5('0x1e')]=function(_0x4784a2){var _0x1c51eb;_0x1c51eb=_['find'](this[_0x05a5('0xf')],function(_0x177733){return _0x177733[_0x05a5('0x1f')]==_0x4784a2||_0x177733[_0x05a5('0x20')]==_0x4784a2;});if(_[_0x05a5('0x21')](_0x1c51eb)){var _0x500a5b=_[_0x05a5('0x22')](this[_0x05a5('0x10')],function(_0x55479d){return _0x55479d[_0x05a5('0x1f')]==_0x4784a2||_0x55479d[_0x05a5('0x20')]==_0x4784a2;});if(_0x500a5b){_0x1c51eb=_[_0x05a5('0x22')](this['agents'],function(_0x3f96fa){return _0x3f96fa['interface']==util[_0x05a5('0x23')]('SIP/%s',_0x500a5b[_0x05a5('0x20')]);});}}return _0x1c51eb;};Report[_0x05a5('0x11')][_0x05a5('0x15')]=function(_0x1c7943){for(var _0x5b6c4b=0x0;_0x5b6c4b<_0x1c7943[_0x05a5('0x24')];_0x5b6c4b+=0x1){var _0x4ef4b2=this[_0x05a5('0x1e')](_0x1c7943[_0x5b6c4b]['connectedlinenum']);if(_0x4ef4b2){_0x1c7943[_0x5b6c4b][_0x05a5('0x1f')]=_0x4ef4b2[_0x05a5('0x1f')];_0x1c7943[_0x5b6c4b][_0x05a5('0x25')]=!![];_0x1c7943[_0x5b6c4b][_0x05a5('0x26')]=_0x4ef4b2[_0x05a5('0x20')];_0x1c7943[_0x5b6c4b][_0x05a5('0x27')]=_[_0x05a5('0x21')](_0x4ef4b2[_0x05a5('0x27')])?util[_0x05a5('0x23')]('SIP/%s',_0x4ef4b2[_0x05a5('0x20')]):_0x4ef4b2[_0x05a5('0x27')];if(_0x1c7943[_0x5b6c4b][_0x05a5('0x28')]){_0x1c7943[_0x5b6c4b][_0x05a5('0x29')]=moment()[_0x05a5('0x23')](_0x05a5('0x2a'));}if(_0x1c7943[_0x5b6c4b][_0x05a5('0x2b')]){_0x1c7943[_0x5b6c4b][_0x05a5('0x2c')]=moment()['format'](_0x05a5('0x2a'));}RpcMemberReport[_0x05a5('0x15')](_0x1c7943[_0x5b6c4b]);}RpcVoiceQueueReport['create'](_0x1c7943[_0x5b6c4b]);}};function extractCalleridNumber(_0x3ab543){var _0x465815=_0x3ab543[_0x05a5('0x2d')](/<(.*?)>/);return _0x465815?_0x465815[0x1]:_0x3ab543;}Report[_0x05a5('0x11')][_0x05a5('0x2e')]=function(_0x9efedd){for(var _0x3cfc31=0x0;_0x3cfc31/);return _0x490de1?_0x490de1[0x1]:_0x4dbf0b;}Report[_0x4c3c('0xf')][_0x4c3c('0x2e')]=function(_0x4554f1){for(var _0x1315b6=0x0;_0x1315b6',_0x43fcad[_0x4c3c('0x42')],_0x43fcad[_0x4c3c('0x3e')]);}if(RpcVoiceTransferReport['transfers'][_0x43fcad[_0x4c3c('0x43')]]){var _0x54e331=RpcVoiceTransferReport[_0x4c3c('0x44')][_0x43fcad[_0x4c3c('0x43')]];_0x54e331[_0x4c3c('0x45')]=_0x43fcad[_0x4c3c('0x46')];RpcVoiceTransferReport[_0x4c3c('0x19')](_0x54e331);delete RpcVoiceTransferReport[_0x4c3c('0x44')][_0x43fcad[_0x4c3c('0x43')]];}if(_[_0x4c3c('0x20')](_0x43fcad[_0x4c3c('0x47')])){_0x43fcad[_0x4c3c('0x47')]=this['getCallType'](_0x43fcad);}if(_[_0x4c3c('0x20')](_0x43fcad[_0x4c3c('0x48')])){var _0x3ba966=_0x43fcad[_0x4c3c('0x31')][_0x4c3c('0x32')]('-')[0x0];var _0x5f3e39=this['agents'][_0x3ba966];if(!_0x5f3e39)_0x5f3e39=this[_0x4c3c('0x2e')](_0x43fcad['accountcode']);if(_0x5f3e39){_0x43fcad[_0x4c3c('0x48')]=_0x5f3e39['id'];_0x43fcad['membername']=_0x5f3e39['name'];}}RpcVoiceCallReport[_0x4c3c('0x2c')](_0x43fcad);if(_0x43fcad[_0x4c3c('0x49')]){for(var _0x45371a=0x0;_0x45371a<_0x43fcad[_0x4c3c('0x4a')][_0x4c3c('0x30')];_0x45371a+=0x1){_0x43fcad[_0x4c3c('0x4b')]=_0x43fcad[_0x4c3c('0x4a')][_0x45371a][_0x4c3c('0x4c')];_0x43fcad['createdAt']=_0x43fcad[_0x4c3c('0x4a')][_0x45371a]['createdAt'];if(_0x43fcad['exten']=='xcally-motion-preview'){_0x43fcad[_0x4c3c('0x3e')]=_0x43fcad[_0x4c3c('0x23')];_0x43fcad['calleridname']=_0x43fcad[_0x4c3c('0x4d')];_0x43fcad[_0x4c3c('0x23')]=_0x43fcad[_0x4c3c('0x1e')];_0x43fcad['connectedlinename']=_0x43fcad[_0x4c3c('0x4e')];_0x43fcad[_0x4c3c('0x37')]=_0x43fcad[_0x4c3c('0x4f')];}else if(_0x43fcad[_0x4c3c('0x37')]=='xcally-motion-dialer'){_0x43fcad[_0x4c3c('0x3e')]=_0x43fcad[_0x4c3c('0x36')];_0x43fcad['exten']=_0x43fcad[_0x4c3c('0x4f')];}RpcVoiceRecording[_0x4c3c('0x2c')](_0x43fcad);}}};Report[_0x4c3c('0xf')][_0x4c3c('0x16')]=function(_0x3ad65d){if(_[_0x4c3c('0x50')](_0x3ad65d)){_0x3ad65d[_0x4c3c('0x51')](function(_0x21a966){RpcVoiceAgentReport[_0x4c3c('0x2c')](_0x21a966);});}else{RpcVoiceAgentReport[_0x4c3c('0x2c')](_0x3ad65d);}};Report[_0x4c3c('0xf')]['voiceDialReport']=function(_0x5316c8){RpcVoiceDialReport[_0x4c3c('0x2c')](_0x5316c8);var _0xb1996b;var _0x31285f;var _0x11df9d=_0x5316c8[_0x4c3c('0x31')];if(_[_0x4c3c('0x52')](_0x11df9d,_0x4c3c('0x53'))){_0x31285f=_0x11df9d[_0x4c3c('0x54')](_0x11df9d['indexOf']('/')+0x1,_0x11df9d[_0x4c3c('0x55')]('@'));_0xb1996b=_[_0x4c3c('0x1d')](this[_0x4c3c('0xd')],function(_0x52eced){return _0x52eced[_0x4c3c('0x56')]==_0x31285f||_0x52eced['phone']==_0x31285f||_0x52eced['accountcode']==_0x31285f;});}else{_0x31285f=_0x11df9d[_0x4c3c('0x54')](_0x11df9d[_0x4c3c('0x55')]('/')+0x1,_0x11df9d[_0x4c3c('0x57')]('-'));_0xb1996b=this['findAgent'](_0x31285f);}if(_0xb1996b){_0x5316c8[_0x4c3c('0x21')]=_[_0x4c3c('0x20')](_0xb1996b[_0x4c3c('0x21')])?util[_0x4c3c('0x26')](_0x4c3c('0x22'),_0xb1996b['name']):_0xb1996b[_0x4c3c('0x21')];_0x5316c8['membername']=_0xb1996b[_0x4c3c('0x1f')];_0x5316c8[_0x4c3c('0x1e')]=_0xb1996b['accountcode'];RpcMemberReport[_0x4c3c('0x58')](_0x5316c8);}};Report['prototype'][_0x4c3c('0x19')]=function(_0x494200){RpcVoiceTransferReport[_0x4c3c('0x44')][_0x494200['transfererlinkedid']]=_0x494200;};Report[_0x4c3c('0xf')][_0x4c3c('0x1b')]=function(_0x47d1c2){RpcVoiceTransferReport[_0x4c3c('0x1b')](_0x47d1c2);};module[_0x4c3c('0x59')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 2cd9e22..caf8bd7 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 _0xe013=['device','[userReport][devicestatechange]','local','toLowerCase','inuse','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','stateTime','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','startsWith','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','registry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','resolve','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','error','[userReport][sippeerstatus]','isNotNull','isUndefined','prototype','emit','info','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s'];(function(_0x17ceec,_0x1a6066){var _0x3277df=function(_0x14ce5b){while(--_0x14ce5b){_0x17ceec['push'](_0x17ceec['shift']());}};_0x3277df(++_0x1a6066);}(_0xe013,0x6f));var _0x3e01=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xe013[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x3e01('0x0'));var moment=require(_0x3e01('0x1'));var util=require(_0x3e01('0x2'));var Redis=require(_0x3e01('0x3'));var BPromise=require('bluebird');var config=require(_0x3e01('0x4'));var logger=require(_0x3e01('0x5'))(_0x3e01('0x6'));var ami=require('../ami');config[_0x3e01('0x7')]=_[_0x3e01('0x8')](config[_0x3e01('0x7')],{'host':_0x3e01('0x9'),'port':0x18eb});var io=require(_0x3e01('0xa'))(new Redis(config['redis']));function UserReport(_0x2e346e){this[_0x3e01('0xb')]=_0x2e346e['trunks'];this['agents']=_0x2e346e[_0x3e01('0xc')];this[_0x3e01('0xd')]=_0x2e346e[_0x3e01('0xd')];ami['on'](_0x3e01('0xe'),this[_0x3e01('0xf')]['bind'](this));ami['on'](_0x3e01('0x10'),this[_0x3e01('0xf')][_0x3e01('0x11')](this));ami['on'](_0x3e01('0x12'),this[_0x3e01('0x13')][_0x3e01('0x11')](this));ami['on'](_0x3e01('0x14'),this[_0x3e01('0x15')]['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()[_0x3e01('0x16')](ami[_0x3e01('0x17')]())[_0x3e01('0x18')](function(_0xb7c332){logger['error'](_0x3e01('0x19'),util[_0x3e01('0x1a')](_0xb7c332,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x3e01('0x1b')]()[_0x3e01('0x16')](ami[_0x3e01('0x1c')]())[_0x3e01('0x18')](function(_0x38fd28){logger['error'](_0x3e01('0x1d'),util['inspect'](_0x38fd28,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x3e01('0x1b')]()[_0x3e01('0x16')](ami[_0x3e01('0x1e')]())['catch'](function(_0x3190a1){logger[_0x3e01('0x1f')](_0x3e01('0x20'),util[_0x3e01('0x1a')](_0x3190a1,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x3e01('0x1b')]()['then'](showSipRegistrations())[_0x3e01('0x16')](listDeviceStates())[_0x3e01('0x16')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x3e01('0x21')]=function(_0x26ae85){return _0x26ae85!==null&&!_[_0x3e01('0x22')](_0x26ae85);};UserReport[_0x3e01('0x23')][_0x3e01('0x24')]=function(_0x40c242,_0x54e1e9,_0x338b94){io['to'](_0x40c242)[_0x3e01('0x24')](_0x54e1e9,_0x338b94);};UserReport['prototype']['syncRegistry']=function(_0xf917eb){try{if(this[_0x3e01('0x21')](_0xf917eb)){logger[_0x3e01('0x25')]('[userReport][registry]\x20registry:%s\x20state:%s',_0xf917eb[_0x3e01('0x26')],_0xf917eb[_0x3e01('0x27')]);logger[_0x3e01('0x28')](_0x3e01('0x29'),util[_0x3e01('0x1a')](_0xf917eb,{'showHidden':![],'depth':null}));var _0x2534e5=_[_0x3e01('0x2a')](this[_0x3e01('0xb')],{'defaultuser':_0xf917eb[_0x3e01('0x26')]});if(_0x2534e5){_0xf917eb[_0x3e01('0x2b')]=_0xf917eb[_0x3e01('0x27')];_[_0x3e01('0x2c')](_0x2534e5,_[_0x3e01('0x2d')](_0xf917eb,[_0x3e01('0x2e'),_0x3e01('0x2f'),_0x3e01('0x26'),_0x3e01('0x27')]));logger[_0x3e01('0x28')](_0x3e01('0x30'),util[_0x3e01('0x1a')](_0x2534e5,{'showHidden':![],'depth':null}));this[_0x3e01('0x24')](util[_0x3e01('0x31')]('trunk:%s',_0x2534e5[_0x3e01('0x32')]),_0x3e01('0x33'),_0x2534e5);}}}catch(_0x3873fb){logger[_0x3e01('0x1f')](_0x3e01('0x29'),util[_0x3e01('0x1a')](_0x3873fb,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x3e01('0x13')]=function(_0x2d82c3){try{if(this[_0x3e01('0x21')](_0x2d82c3)){logger[_0x3e01('0x25')](_0x3e01('0x34'),_0x2d82c3[_0x3e01('0x35')],_0x2d82c3[_0x3e01('0x27')]);logger[_0x3e01('0x28')](_0x3e01('0x36'),util[_0x3e01('0x1a')](_0x2d82c3,{'showHidden':![],'depth':null}));if(this[_0x3e01('0xc')][_0x2d82c3['device']]){if(!this['agents'][_0x2d82c3[_0x3e01('0x35')]][_0x3e01('0x37')]||_0x2d82c3['state'][_0x3e01('0x38')]()==_0x3e01('0x39')){this['agents'][_0x2d82c3[_0x3e01('0x35')]]['local']=![];if(this['agents'][_0x2d82c3[_0x3e01('0x35')]][_0x3e01('0x27')]!==_0x2d82c3[_0x3e01('0x27')]['toLowerCase']()){this['agents'][_0x2d82c3['device']]['stateTime']=_[_0x3e01('0x3a')](moment()[_0x3e01('0x31')]('x'));}this[_0x3e01('0xc')][_0x2d82c3['device']][_0x3e01('0x27')]=_0x2d82c3[_0x3e01('0x27')][_0x3e01('0x38')]();this[_0x3e01('0xc')][_0x2d82c3[_0x3e01('0x35')]]['updateStatusRealtime'](_0x2d82c3);}}else if(this['telephones'][_0x2d82c3['device']]){if(this[_0x3e01('0xd')][_0x2d82c3[_0x3e01('0x35')]][_0x3e01('0x27')]!==_0x2d82c3[_0x3e01('0x27')][_0x3e01('0x38')]()){this[_0x3e01('0xd')][_0x2d82c3[_0x3e01('0x35')]]['stateTime']=_[_0x3e01('0x3a')](moment()[_0x3e01('0x31')]('x'));}this['telephones'][_0x2d82c3[_0x3e01('0x35')]][_0x3e01('0x27')]=_0x2d82c3[_0x3e01('0x27')][_0x3e01('0x38')]();logger[_0x3e01('0x28')](_0x3e01('0x3b'),util['inspect'](this[_0x3e01('0xd')][_0x2d82c3[_0x3e01('0x35')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x3e01('0x3c'),this[_0x3e01('0xd')][_0x2d82c3['device']][_0x3e01('0x32')]),_0x3e01('0x3d'),this['telephones'][_0x2d82c3[_0x3e01('0x35')]]);}else if(this[_0x3e01('0xb')][_0x2d82c3[_0x3e01('0x35')]]){if(this['trunks'][_0x2d82c3[_0x3e01('0x35')]]['state']!==_0x2d82c3[_0x3e01('0x27')]['toLowerCase']()){this['trunks'][_0x2d82c3['device']][_0x3e01('0x3e')]=_[_0x3e01('0x3a')](moment()[_0x3e01('0x31')]('x'));}this['trunks'][_0x2d82c3['device']]['state']=_0x2d82c3['state'][_0x3e01('0x38')]();logger[_0x3e01('0x28')](_0x3e01('0x3f'),util['inspect'](this[_0x3e01('0xb')][_0x2d82c3[_0x3e01('0x35')]],{'showHidden':![],'depth':null}));this[_0x3e01('0x24')](util['format'](_0x3e01('0x40'),this[_0x3e01('0xb')][_0x2d82c3['device']][_0x3e01('0x32')]),_0x3e01('0x33'),this[_0x3e01('0xb')][_0x2d82c3[_0x3e01('0x35')]]);}else if(_[_0x3e01('0x41')](_0x2d82c3[_0x3e01('0x35')],_0x3e01('0x42'))){var _0x1c113c=_0x2d82c3[_0x3e01('0x35')];var _0x3a9d72=_0x1c113c[_0x3e01('0x43')](_0x1c113c['indexOf']('/')+0x1,_0x1c113c[_0x3e01('0x44')]('@'));var _0xe4af34=_[_0x3e01('0x2a')](this[_0x3e01('0xc')],function(_0x45a77a){return _0x45a77a[_0x3e01('0x45')]==_0x3a9d72||_0x45a77a[_0x3e01('0x46')]==_0x3a9d72||_0x45a77a[_0x3e01('0x47')]==_0x3a9d72;});if(_0xe4af34){if(_0xe4af34[_0x3e01('0x27')]!==_0x2d82c3[_0x3e01('0x27')][_0x3e01('0x38')]()){_0xe4af34[_0x3e01('0x3e')]=_[_0x3e01('0x3a')](moment()[_0x3e01('0x31')]('x'));}_0xe4af34[_0x3e01('0x27')]=_0x2d82c3[_0x3e01('0x27')][_0x3e01('0x38')]();_0xe4af34[_0x3e01('0x37')]=!![];_0xe4af34[_0x3e01('0x48')](_0x2d82c3);}}}}catch(_0x2b20e3){logger[_0x3e01('0x1f')]('[userReport][devicestatechange]',util[_0x3e01('0x1a')](_0x2b20e3,{'showHidden':![],'depth':null}));}};UserReport[_0x3e01('0x23')]['syncPeerStatus']=function(_0x55d935){try{if(this[_0x3e01('0x21')](_0x55d935)&&this[_0x3e01('0x21')](_0x55d935[_0x3e01('0x14')])){logger['info'](_0x3e01('0x49'),_0x55d935[_0x3e01('0x4a')],_0x55d935[_0x3e01('0x4b')],_0x55d935[_0x3e01('0x14')]);logger['debug'](_0x3e01('0x4c'),util[_0x3e01('0x1a')](_0x55d935,{'showHidden':![],'depth':null}));if(this[_0x3e01('0xc')][_0x55d935['peer']]){if(!this['agents'][_0x55d935['peer']][_0x3e01('0x37')]||_0x55d935[_0x3e01('0x14')][_0x3e01('0x38')]()==_0x3e01('0x4d')){this['agents'][_0x55d935[_0x3e01('0x4a')]][_0x3e01('0x37')]=![];this[_0x3e01('0xc')][_0x55d935['peer']][_0x3e01('0x4e')]=_0x55d935[_0x3e01('0x14')][_0x3e01('0x38')]();this[_0x3e01('0xc')][_0x55d935[_0x3e01('0x4a')]][_0x3e01('0x4b')]=_0x55d935[_0x3e01('0x4b')];this['agents'][_0x55d935[_0x3e01('0x4a')]]['updateStatusRealtime'](_0x55d935);}}else if(this[_0x3e01('0xd')][_0x55d935[_0x3e01('0x4a')]]){this[_0x3e01('0xd')][_0x55d935['peer']][_0x3e01('0x4e')]=_0x55d935['peerstatus'][_0x3e01('0x38')]();this['telephones'][_0x55d935[_0x3e01('0x4a')]][_0x3e01('0x4b')]=_0x55d935[_0x3e01('0x4b')];logger[_0x3e01('0x28')](_0x3e01('0x4f'),util[_0x3e01('0x1a')](this[_0x3e01('0xd')][_0x55d935['peer']],{'showHidden':![],'depth':null}));this[_0x3e01('0x24')](util[_0x3e01('0x31')](_0x3e01('0x3c'),this[_0x3e01('0xd')][_0x55d935[_0x3e01('0x4a')]]['name']),_0x3e01('0x3d'),this[_0x3e01('0xd')][_0x55d935[_0x3e01('0x4a')]]);}else if(this['trunks'][_0x55d935[_0x3e01('0x4a')]]){this[_0x3e01('0xb')][_0x55d935[_0x3e01('0x4a')]]['status']=_0x55d935['peerstatus'][_0x3e01('0x38')]();this[_0x3e01('0xb')][_0x55d935[_0x3e01('0x4a')]][_0x3e01('0x4b')]=_0x55d935['address'];logger[_0x3e01('0x28')](_0x3e01('0x50'),util[_0x3e01('0x1a')](this['trunks'][_0x55d935[_0x3e01('0x4a')]],{'showHidden':![],'depth':null}));this[_0x3e01('0x24')](util[_0x3e01('0x31')]('trunk:%s',this[_0x3e01('0xb')][_0x55d935['peer']][_0x3e01('0x32')]),'trunk:save',this[_0x3e01('0xb')][_0x55d935[_0x3e01('0x4a')]]);}}}catch(_0x579037){logger[_0x3e01('0x1f')](_0x3e01('0x4c'),util[_0x3e01('0x1a')](_0x579037,{'showHidden':![],'depth':null}));}};module[_0x3e01('0x51')]=UserReport; \ No newline at end of file +var _0xedd1=['trunks','stateRegistry','merge','omit','event','trunk:save','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','toNumber','format','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','name','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','Local','substring','indexOf','find','mobile','phone','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','socket.io-emitter','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','peerstatus','syncPeerStatus','resolve','then','catch','error','actionDeviceStateList','[userReport][devicestatelist]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]'];(function(_0x2735cb,_0x2642fc){var _0x1fdad6=function(_0x1ce994){while(--_0x1ce994){_0x2735cb['push'](_0x2735cb['shift']());}};_0x1fdad6(++_0x2642fc);}(_0xedd1,0x1e0));var _0x1edd=function(_0x413f2a,_0x1006e4){_0x413f2a=_0x413f2a-0x0;var _0x1932ec=_0xedd1[_0x413f2a];return _0x1932ec;};'use strict';var _=require(_0x1edd('0x0'));var moment=require(_0x1edd('0x1'));var util=require(_0x1edd('0x2'));var Redis=require(_0x1edd('0x3'));var BPromise=require('bluebird');var config=require(_0x1edd('0x4'));var logger=require(_0x1edd('0x5'))(_0x1edd('0x6'));var ami=require('../ami');config[_0x1edd('0x7')]=_[_0x1edd('0x8')](config[_0x1edd('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x1edd('0x9'))(new Redis(config[_0x1edd('0x7')]));function UserReport(_0x3927ed){this['trunks']=_0x3927ed['trunks'];this[_0x1edd('0xa')]=_0x3927ed[_0x1edd('0xa')];this[_0x1edd('0xb')]=_0x3927ed['telephones'];ami['on'](_0x1edd('0xc'),this[_0x1edd('0xd')][_0x1edd('0xe')](this));ami['on'](_0x1edd('0xf'),this['syncRegistry'][_0x1edd('0xe')](this));ami['on'](_0x1edd('0x10'),this['syncDeviceState'][_0x1edd('0xe')](this));ami['on'](_0x1edd('0x11'),this[_0x1edd('0x12')][_0x1edd('0xe')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x1edd('0x13')]()[_0x1edd('0x14')](ami['actionSipShowRegistry']())[_0x1edd('0x15')](function(_0x4db0af){logger[_0x1edd('0x16')]('[userReport][sipshowregistry]',util['inspect'](_0x4db0af,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x1edd('0x13')]()[_0x1edd('0x14')](ami[_0x1edd('0x17')]())['catch'](function(_0x4c73ed){logger[_0x1edd('0x16')](_0x1edd('0x18'),util[_0x1edd('0x19')](_0x4c73ed,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x1edd('0x13')]()[_0x1edd('0x14')](ami[_0x1edd('0x1a')]())[_0x1edd('0x15')](function(_0x31849e){logger['error'](_0x1edd('0x1b'),util['inspect'](_0x31849e,{'showHidden':![],'depth':null}));});}UserReport[_0x1edd('0x1c')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x1edd('0x13')]()[_0x1edd('0x14')](showSipRegistrations())[_0x1edd('0x14')](listDeviceStates())[_0x1edd('0x14')](showPeersStatus());},0x32c8);};UserReport[_0x1edd('0x1c')][_0x1edd('0x1d')]=function(_0x244067){return _0x244067!==null&&!_[_0x1edd('0x1e')](_0x244067);};UserReport[_0x1edd('0x1c')][_0x1edd('0x1f')]=function(_0x54805e,_0x54ca8f,_0x13a801){io['to'](_0x54805e)[_0x1edd('0x1f')](_0x54ca8f,_0x13a801);};UserReport['prototype']['syncRegistry']=function(_0x214bdf){try{if(this[_0x1edd('0x1d')](_0x214bdf)){logger[_0x1edd('0x20')](_0x1edd('0x21'),_0x214bdf[_0x1edd('0x22')],_0x214bdf[_0x1edd('0x23')]);logger[_0x1edd('0x24')](_0x1edd('0x25'),util['inspect'](_0x214bdf,{'showHidden':![],'depth':null}));var _0x4306ab=_['find'](this[_0x1edd('0x26')],{'defaultuser':_0x214bdf[_0x1edd('0x22')]});if(_0x4306ab){_0x214bdf[_0x1edd('0x27')]=_0x214bdf['state'];_[_0x1edd('0x28')](_0x4306ab,_[_0x1edd('0x29')](_0x214bdf,[_0x1edd('0x2a'),'actionid',_0x1edd('0x22'),_0x1edd('0x23')]));logger[_0x1edd('0x24')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x1edd('0x19')](_0x4306ab,{'showHidden':![],'depth':null}));this[_0x1edd('0x1f')](util['format']('trunk:%s',_0x4306ab['name']),_0x1edd('0x2b'),_0x4306ab);}}}catch(_0x3af5e7){logger[_0x1edd('0x16')](_0x1edd('0x25'),util[_0x1edd('0x19')](_0x3af5e7,{'showHidden':![],'depth':null}));}};UserReport[_0x1edd('0x1c')][_0x1edd('0x2c')]=function(_0x4a279f){try{if(this[_0x1edd('0x1d')](_0x4a279f)){logger[_0x1edd('0x20')](_0x1edd('0x2d'),_0x4a279f[_0x1edd('0x2e')],_0x4a279f[_0x1edd('0x23')]);logger[_0x1edd('0x24')]('[userReport][devicestatechange]',util[_0x1edd('0x19')](_0x4a279f,{'showHidden':![],'depth':null}));if(this[_0x1edd('0xa')][_0x4a279f[_0x1edd('0x2e')]]){if(!this[_0x1edd('0xa')][_0x4a279f['device']][_0x1edd('0x2f')]||_0x4a279f[_0x1edd('0x23')][_0x1edd('0x30')]()==_0x1edd('0x31')){this[_0x1edd('0xa')][_0x4a279f[_0x1edd('0x2e')]][_0x1edd('0x2f')]=![];if(this['agents'][_0x4a279f[_0x1edd('0x2e')]][_0x1edd('0x23')]!==_0x4a279f[_0x1edd('0x23')][_0x1edd('0x30')]()){this['agents'][_0x4a279f[_0x1edd('0x2e')]]['stateTime']=_[_0x1edd('0x32')](moment()[_0x1edd('0x33')]('x'));}this['agents'][_0x4a279f[_0x1edd('0x2e')]]['state']=_0x4a279f[_0x1edd('0x23')][_0x1edd('0x30')]();this['agents'][_0x4a279f[_0x1edd('0x2e')]][_0x1edd('0x34')](_0x4a279f);}}else if(this[_0x1edd('0xb')][_0x4a279f[_0x1edd('0x2e')]]){if(this[_0x1edd('0xb')][_0x4a279f[_0x1edd('0x2e')]][_0x1edd('0x23')]!==_0x4a279f['state'][_0x1edd('0x30')]()){this[_0x1edd('0xb')][_0x4a279f[_0x1edd('0x2e')]]['stateTime']=_[_0x1edd('0x32')](moment()[_0x1edd('0x33')]('x'));}this[_0x1edd('0xb')][_0x4a279f[_0x1edd('0x2e')]][_0x1edd('0x23')]=_0x4a279f[_0x1edd('0x23')][_0x1edd('0x30')]();logger[_0x1edd('0x24')](_0x1edd('0x35'),util['inspect'](this['telephones'][_0x4a279f[_0x1edd('0x2e')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x1edd('0x33')]('telephone:%s',this[_0x1edd('0xb')][_0x4a279f[_0x1edd('0x2e')]][_0x1edd('0x36')]),_0x1edd('0x37'),this[_0x1edd('0xb')][_0x4a279f[_0x1edd('0x2e')]]);}else if(this[_0x1edd('0x26')][_0x4a279f['device']]){if(this[_0x1edd('0x26')][_0x4a279f['device']][_0x1edd('0x23')]!==_0x4a279f[_0x1edd('0x23')][_0x1edd('0x30')]()){this[_0x1edd('0x26')][_0x4a279f[_0x1edd('0x2e')]]['stateTime']=_[_0x1edd('0x32')](moment()[_0x1edd('0x33')]('x'));}this['trunks'][_0x4a279f[_0x1edd('0x2e')]][_0x1edd('0x23')]=_0x4a279f['state'][_0x1edd('0x30')]();logger['debug'](_0x1edd('0x38'),util[_0x1edd('0x19')](this[_0x1edd('0x26')][_0x4a279f[_0x1edd('0x2e')]],{'showHidden':![],'depth':null}));this[_0x1edd('0x1f')](util['format'](_0x1edd('0x39'),this[_0x1edd('0x26')][_0x4a279f[_0x1edd('0x2e')]][_0x1edd('0x36')]),_0x1edd('0x2b'),this['trunks'][_0x4a279f[_0x1edd('0x2e')]]);}else if(_['startsWith'](_0x4a279f[_0x1edd('0x2e')],_0x1edd('0x3a'))){var _0x3ad9b4=_0x4a279f[_0x1edd('0x2e')];var _0x4dbe0e=_0x3ad9b4[_0x1edd('0x3b')](_0x3ad9b4[_0x1edd('0x3c')]('/')+0x1,_0x3ad9b4[_0x1edd('0x3c')]('@'));var _0x4fce30=_[_0x1edd('0x3d')](this['agents'],function(_0x14c8c7){return _0x14c8c7[_0x1edd('0x3e')]==_0x4dbe0e||_0x14c8c7[_0x1edd('0x3f')]==_0x4dbe0e||_0x14c8c7['accountcode']==_0x4dbe0e;});if(_0x4fce30){if(_0x4fce30[_0x1edd('0x23')]!==_0x4a279f[_0x1edd('0x23')][_0x1edd('0x30')]()){_0x4fce30['stateTime']=_[_0x1edd('0x32')](moment()[_0x1edd('0x33')]('x'));}_0x4fce30[_0x1edd('0x23')]=_0x4a279f[_0x1edd('0x23')][_0x1edd('0x30')]();_0x4fce30[_0x1edd('0x2f')]=!![];_0x4fce30[_0x1edd('0x34')](_0x4a279f);}}}}catch(_0x1cf11a){logger['error'](_0x1edd('0x40'),util[_0x1edd('0x19')](_0x1cf11a,{'showHidden':![],'depth':null}));}};UserReport[_0x1edd('0x1c')]['syncPeerStatus']=function(_0x3e4adf){try{if(this[_0x1edd('0x1d')](_0x3e4adf)&&this[_0x1edd('0x1d')](_0x3e4adf[_0x1edd('0x11')])){logger['info'](_0x1edd('0x41'),_0x3e4adf[_0x1edd('0x42')],_0x3e4adf[_0x1edd('0x43')],_0x3e4adf[_0x1edd('0x11')]);logger[_0x1edd('0x24')]('[userReport][peerstatus]',util[_0x1edd('0x19')](_0x3e4adf,{'showHidden':![],'depth':null}));if(this[_0x1edd('0xa')][_0x3e4adf['peer']]){if(!this[_0x1edd('0xa')][_0x3e4adf[_0x1edd('0x42')]][_0x1edd('0x2f')]||_0x3e4adf['peerstatus'][_0x1edd('0x30')]()==_0x1edd('0x44')){this[_0x1edd('0xa')][_0x3e4adf[_0x1edd('0x42')]]['local']=![];this[_0x1edd('0xa')][_0x3e4adf[_0x1edd('0x42')]][_0x1edd('0x45')]=_0x3e4adf[_0x1edd('0x11')][_0x1edd('0x30')]();this['agents'][_0x3e4adf['peer']]['address']=_0x3e4adf[_0x1edd('0x43')];this[_0x1edd('0xa')][_0x3e4adf[_0x1edd('0x42')]][_0x1edd('0x34')](_0x3e4adf);}}else if(this['telephones'][_0x3e4adf[_0x1edd('0x42')]]){this['telephones'][_0x3e4adf['peer']][_0x1edd('0x45')]=_0x3e4adf[_0x1edd('0x11')][_0x1edd('0x30')]();this[_0x1edd('0xb')][_0x3e4adf[_0x1edd('0x42')]]['address']=_0x3e4adf[_0x1edd('0x43')];logger['debug'](_0x1edd('0x46'),util[_0x1edd('0x19')](this['telephones'][_0x3e4adf[_0x1edd('0x42')]],{'showHidden':![],'depth':null}));this[_0x1edd('0x1f')](util['format']('telephone:%s',this[_0x1edd('0xb')][_0x3e4adf[_0x1edd('0x42')]]['name']),_0x1edd('0x37'),this[_0x1edd('0xb')][_0x3e4adf[_0x1edd('0x42')]]);}else if(this[_0x1edd('0x26')][_0x3e4adf['peer']]){this['trunks'][_0x3e4adf[_0x1edd('0x42')]][_0x1edd('0x45')]=_0x3e4adf[_0x1edd('0x11')]['toLowerCase']();this['trunks'][_0x3e4adf[_0x1edd('0x42')]][_0x1edd('0x43')]=_0x3e4adf[_0x1edd('0x43')];logger[_0x1edd('0x24')](_0x1edd('0x47'),util[_0x1edd('0x19')](this[_0x1edd('0x26')][_0x3e4adf[_0x1edd('0x42')]],{'showHidden':![],'depth':null}));this[_0x1edd('0x1f')](util[_0x1edd('0x33')](_0x1edd('0x39'),this[_0x1edd('0x26')][_0x3e4adf[_0x1edd('0x42')]][_0x1edd('0x36')]),'trunk:save',this[_0x1edd('0x26')][_0x3e4adf[_0x1edd('0x42')]]);}}}catch(_0x1d3a7e){logger[_0x1edd('0x16')](_0x1edd('0x48'),util[_0x1edd('0x19')](_0x1d3a7e,{'showHidden':![],'depth':null}));}};module[_0x1edd('0x49')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index b361616..0f8aeb9 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 _0x535c=['variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','voiceChannels','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','isNotNull','isUndefined','prototype','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','queue','format','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','inbound','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','inspect','user:%s','user:called','error','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','pick','destconnectedlinenum','interface','accountcode','exten','custom:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','name','user:agentringnoanswer','assign','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','lastevent','complete','reason','agent','talktime','acw','acwtime','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][agentcomplete]','addVariable'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x535c,0x170));var _0xc535=function(_0x37a858,_0x370bc4){_0x37a858=_0x37a858-0x0;var _0x55ae33=_0x535c[_0x37a858];return _0x55ae33;};'use strict';var _=require(_0xc535('0x0'));var moment=require('moment');var util=require(_0xc535('0x1'));var Redis=require(_0xc535('0x2'));var config=require(_0xc535('0x3'));var logger=require(_0xc535('0x4'))(_0xc535('0x5'));var ami=require(_0xc535('0x6'));config['redis']=_[_0xc535('0x7')](config[_0xc535('0x8')],{'host':_0xc535('0x9'),'port':0x18eb});var io=require(_0xc535('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0xe8f9a0){this['channels']={};this[_0xc535('0xb')]=_0xe8f9a0[_0xc535('0xc')];this[_0xc535('0xd')]=_0xe8f9a0['voiceQueues'];this[_0xc535('0xe')]=_0xe8f9a0['agents'];this[_0xc535('0xf')]={};ami['on'](_0xc535('0x10'),this[_0xc535('0x11')]['bind'](this));ami['on']('agentconnect',this[_0xc535('0x12')][_0xc535('0x13')](this));ami['on'](_0xc535('0x14'),this[_0xc535('0x15')][_0xc535('0x13')](this));ami['on'](_0xc535('0x16'),this[_0xc535('0x17')][_0xc535('0x13')](this));ami['on'](_0xc535('0x18'),this[_0xc535('0x19')][_0xc535('0x13')](this));ami['on'](_0xc535('0x1a'),this['syncVarSet'][_0xc535('0x13')](this));ami['on'](_0xc535('0x1b'),this[_0xc535('0x1c')][_0xc535('0x13')](this));ami['on'](_0xc535('0x1d'),this[_0xc535('0x1e')][_0xc535('0x13')](this));ami['on']('musiconholdstop',this[_0xc535('0x1f')][_0xc535('0x13')](this));ami['on'](_0xc535('0x20'),this[_0xc535('0x21')][_0xc535('0x13')](this));ami['on']('blindtransfer',this[_0xc535('0x22')][_0xc535('0x13')](this));}VoiceAgentReport['prototype'][_0xc535('0x23')]=function(_0x45dc77,_0x1ec14e,_0x97ab59){io['to'](_0x45dc77)[_0xc535('0x23')](_0x1ec14e,_0x97ab59);};VoiceAgentReport['prototype'][_0xc535('0x24')]=function(_0x4378f4){return _0x4378f4!==null&&!_[_0xc535('0x25')](_0x4378f4);};VoiceAgentReport[_0xc535('0x26')][_0xc535('0x11')]=function(_0xe75fb5){try{if(this[_0xc535('0x24')](_0xe75fb5)){logger[_0xc535('0x27')](_0xc535('0x28'),_0xe75fb5[_0xc535('0x29')],_0xe75fb5[_0xc535('0x2a')],_0xe75fb5[_0xc535('0x2b')]);logger[_0xc535('0x2c')](_0xc535('0x2d'),_0xe75fb5[_0xc535('0x29')],util['inspect'](_0xe75fb5,{'showHidden':![],'depth':null}));if(_[_0xc535('0x25')](this[_0xc535('0xc')][_0xe75fb5[_0xc535('0x29')]])){this[_0xc535('0xc')][_0xe75fb5[_0xc535('0x29')]]={};}var _0x17857d=this[_0xc535('0xe')][_0xe75fb5['interface']];var _0x1c1b19=this[_0xc535('0xc')][_0xe75fb5[_0xc535('0x29')]][_0xe75fb5[_0xc535('0x2b')]];var _0x8245b6=this[_0xc535('0xd')][_0xe75fb5[_0xc535('0x2e')]];var _0x4f024=this[_0xc535('0xf')][_0xe75fb5[_0xc535('0x29')]];if(_[_0xc535('0x25')](_0x1c1b19)){_0x1c1b19={'agentcalledAt':moment()[_0xc535('0x2f')](_0xc535('0x30')),'lastevent':'called','mandatoryDisposition':_0x8245b6&&_0x8245b6[_0xc535('0x31')]?_0x8245b6[_0xc535('0x31')]:![],'type':_0x8245b6&&_0x8245b6[_0xc535('0x32')]?_0x8245b6['type']:_0xc535('0x33'),'variables':_0x4f024,'motionChannel':'voice'};}Object['assign'](_0x1c1b19,_[_0xc535('0x34')](_0xe75fb5,[_0xc535('0x35'),_0xc535('0x36')]));this[_0xc535('0xc')][_0xe75fb5[_0xc535('0x29')]][_0xe75fb5[_0xc535('0x2b')]]=_0x1c1b19;logger[_0xc535('0x2c')](_0xc535('0x37'),_0xe75fb5[_0xc535('0x29')],util['inspect'](_0x1c1b19,{'showHidden':![],'depth':null}));ami['emit'](_0xc535('0x38'),_0x1c1b19);var _0x4ef78f={'id':_0x17857d['id'],'calleridnum':_0x1c1b19[_0xc535('0x39')],'queue':_0x1c1b19[_0xc535('0x2e')],'variables':_0x1c1b19[_0xc535('0xf')],'uniqueid':_0xe75fb5[_0xc535('0x29')]};logger[_0xc535('0x2c')](_0xc535('0x3a'),_0xe75fb5[_0xc535('0x29')],util[_0xc535('0x3b')](_0x4ef78f,{'showHidden':![],'depth':null}));this[_0xc535('0x23')](util[_0xc535('0x2f')](_0xc535('0x3c'),_0xe75fb5[_0xc535('0x2a')]),_0xc535('0x3d'),_0x4ef78f);}}catch(_0x11b9d0){logger[_0xc535('0x3e')]('[%s][voiceAgentReport][agentcalled]',_0xe75fb5['uniqueid'],util[_0xc535('0x3b')](_0x11b9d0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xc535('0x12')]=function(_0x4d492c){try{if(this[_0xc535('0x24')](_0x4d492c)){if(this[_0xc535('0xc')][_0x4d492c['uniqueid']]){for(var _0x51acf7 in this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]]){if(this[_0xc535('0xc')][_0x4d492c['uniqueid']][_0xc535('0x3f')](_0x51acf7)){if(_0x4d492c[_0xc535('0x2b')]===_0x51acf7){logger[_0xc535('0x27')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4d492c[_0xc535('0x29')],_0x4d492c['membername'],_0x4d492c[_0xc535('0x2b')]);this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x51acf7][_0xc535('0x40')]=moment()[_0xc535('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc535('0xc')][_0x4d492c['uniqueid']][_0x51acf7][_0xc535('0x41')]=_0x4d492c[_0xc535('0x41')];this['channels'][_0x4d492c['uniqueid']][_0x51acf7][_0xc535('0x42')]=_0x4d492c['connectedlinenum'];this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x51acf7]['destchannelstate']=_0x4d492c[_0xc535('0x43')];this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x51acf7][_0xc535('0x44')]=_0x4d492c[_0xc535('0x44')];this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x51acf7][_0xc535('0x45')]=_0x4d492c['holdtime'];this[_0xc535('0xc')][_0x4d492c['uniqueid']][_0x51acf7]['lastevent']=_0xc535('0x46');if(this[_0xc535('0xb')][this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x51acf7][_0xc535('0x29')]]){var _0x14768d=this[_0xc535('0xb')][this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x51acf7][_0xc535('0x29')]]['routealias'];this[_0xc535('0xc')][_0x4d492c['uniqueid']][_0x51acf7][_0xc535('0x47')]=_0x14768d;_0x4d492c[_0xc535('0x47')]=_0x14768d;}_['merge'](this[_0xc535('0xe')][_0x4d492c['interface']],_[_0xc535('0x48')](_0x4d492c,[_0xc535('0x2e'),_0xc535('0x49'),'routealias']));var _0x156f34=this['agents'][_0x4d492c[_0xc535('0x4a')]];var _0x39b151={'id':_0x156f34['id'],'name':_0x156f34['name'],'agentconnected':!![],'destaccountcode':_0x156f34[_0xc535('0x4b')],'destconnectedlinenum':this['channels'][_0x4d492c[_0xc535('0x29')]][_0x4d492c[_0xc535('0x2b')]][_0xc535('0x4c')],'queue':this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x4d492c[_0xc535('0x2b')]][_0xc535('0x2e')],'routealias':this['channels'][_0x4d492c[_0xc535('0x29')]][_0x4d492c[_0xc535('0x2b')]][_0xc535('0x47')],'uniqueid':this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x4d492c[_0xc535('0x2b')]][_0xc535('0x29')]};ami[_0xc535('0x23')](_0xc535('0x4d'),this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x4d492c[_0xc535('0x2b')]]);this[_0xc535('0x23')](util[_0xc535('0x2f')](_0xc535('0x3c'),_0x4d492c[_0xc535('0x2a')]),'user:agentconnect',_0x39b151);}else if(!this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x51acf7][_0xc535('0x14')]&&!this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x51acf7]['agentcomplete']){logger['info'](_0xc535('0x4e'),_0x4d492c[_0xc535('0x29')],this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x51acf7][_0xc535('0x2a')],_0x51acf7);this['channels'][_0x4d492c['uniqueid']][_0x51acf7][_0xc535('0x14')]=!![];this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x51acf7][_0xc535('0x4f')]=moment()[_0xc535('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x4d492c['uniqueid']][_0x51acf7][_0xc535('0x50')]=_0x4d492c['destuniqueid'];this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x51acf7]['answeredelsewheremembername']=_0x4d492c[_0xc535('0x2a')];this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x51acf7]['lastevent']=_0xc535('0x51');this[_0xc535('0xc')][_0x4d492c['uniqueid']][_0x51acf7]['reason']=_0xc535('0x51');logger[_0xc535('0x2c')](_0xc535('0x52'),_0x4d492c[_0xc535('0x29')],util[_0xc535('0x3b')](this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x51acf7],{'showHidden':![],'depth':null}));ami[_0xc535('0x23')](_0xc535('0x53'),this[_0xc535('0xc')][_0x4d492c[_0xc535('0x29')]][_0x51acf7]);}else{logger[_0xc535('0x2c')]('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x4d492c[_0xc535('0x29')]);}}}}}}catch(_0x4cd737){logger['error'](_0xc535('0x54'),_0x4d492c['uniqueid'],util[_0xc535('0x3b')](_0x4cd737,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc535('0x26')]['syncAgentRingNoAnswer']=function(_0x19342a){try{if(this['isNotNull'](_0x19342a)){logger['debug'](_0xc535('0x55'),_0x19342a['uniqueid'],util[_0xc535('0x3b')](_0x19342a,{'showHidden':![],'depth':null}));if(this[_0xc535('0xc')][_0x19342a['uniqueid']]&&this[_0xc535('0xc')][_0x19342a[_0xc535('0x29')]][_0x19342a[_0xc535('0x2b')]]){logger[_0xc535('0x27')](_0xc535('0x56'),_0x19342a['uniqueid'],_0x19342a['membername'],_0x19342a[_0xc535('0x2b')]);var _0x37f802=this[_0xc535('0xe')][_0x19342a[_0xc535('0x4a')]];var _0x158614=this[_0xc535('0xc')][_0x19342a[_0xc535('0x29')]][_0x19342a[_0xc535('0x2b')]];_0x158614[_0xc535('0x14')]=!![];_0x158614[_0xc535('0x4f')]=moment()[_0xc535('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');_0x158614['lastevent']=_0xc535('0x57');_0x158614['reason']=_0xc535('0x57');var _0x31341f={'id':_0x37f802['id'],'name':_0x37f802[_0xc535('0x58')],'queue':_0x158614[_0xc535('0x2e')],'uniqueid':_0x158614['uniqueid']};logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x19342a[_0xc535('0x29')],util[_0xc535('0x3b')](_0x31341f,{'showHidden':![],'depth':null}));this[_0xc535('0x23')](util[_0xc535('0x2f')]('user:%s',_0x37f802[_0xc535('0x58')]),_0xc535('0x59'),_0x31341f);ami['emit']('custom:agentringnoanswer',_0x158614);this['channels'][_0x19342a[_0xc535('0x29')]][_0x19342a[_0xc535('0x2b')]]=Object[_0xc535('0x5a')]({},_0x158614);}}}catch(_0x27f5f3){logger[_0xc535('0x3e')]('[%s][voiceAgentReport][agentringnoanswer]',_0x19342a[_0xc535('0x29')],util['inspect'](_0x27f5f3,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xc535('0x17')]=function(_0x37fc22){try{if(this['isNotNull'](_0x37fc22)){logger[_0xc535('0x2c')](_0xc535('0x5b'),_0x37fc22['uniqueid'],util[_0xc535('0x3b')](_0x37fc22,{'showHidden':![],'depth':null}));if(this[_0xc535('0xc')][_0x37fc22['uniqueid']]){for(var _0x2f1d3e in this[_0xc535('0xc')][_0x37fc22[_0xc535('0x29')]]){if(this[_0xc535('0xc')][_0x37fc22[_0xc535('0x29')]][_0xc535('0x3f')](_0x2f1d3e)&&!this['channels'][_0x37fc22[_0xc535('0x29')]][_0x2f1d3e]['agentringnoanswer']&&!this[_0xc535('0xc')][_0x37fc22[_0xc535('0x29')]][_0x2f1d3e][_0xc535('0x18')]){logger[_0xc535('0x27')](_0xc535('0x5c'),_0x37fc22[_0xc535('0x29')],this[_0xc535('0xc')][_0x37fc22[_0xc535('0x29')]][_0x2f1d3e][_0xc535('0x2a')],_0x2f1d3e);this[_0xc535('0xc')][_0x37fc22[_0xc535('0x29')]][_0x2f1d3e][_0xc535('0x14')]=!![];this[_0xc535('0xc')][_0x37fc22['uniqueid']][_0x2f1d3e][_0xc535('0x4f')]=moment()[_0xc535('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc535('0xc')][_0x37fc22[_0xc535('0x29')]][_0x2f1d3e]['lastevent']=_0xc535('0x5d');this['channels'][_0x37fc22[_0xc535('0x29')]][_0x2f1d3e]['reason']=_0xc535('0x5d');logger['debug'](_0xc535('0x5e'),_0x37fc22[_0xc535('0x29')],util[_0xc535('0x3b')](this[_0xc535('0xc')][_0x37fc22[_0xc535('0x29')]][_0x2f1d3e],{'showHidden':![],'depth':null}));ami[_0xc535('0x23')](_0xc535('0x5f'),this[_0xc535('0xc')][_0x37fc22[_0xc535('0x29')]][_0x2f1d3e]);}}}}}catch(_0x416df8){logger['error'](_0xc535('0x60'),_0x37fc22['uniqueid'],util['inspect'](_0x416df8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc535('0x26')][_0xc535('0x19')]=function(_0xe4dd71){try{if(this[_0xc535('0x24')](_0xe4dd71)){logger[_0xc535('0x2c')](_0xc535('0x61'),_0xe4dd71[_0xc535('0x29')],util['inspect'](_0xe4dd71,{'showHidden':![],'depth':null}));if(this['channels'][_0xe4dd71['uniqueid']]){for(var _0x2da6bf in this['channels'][_0xe4dd71[_0xc535('0x29')]]){if(this['channels'][_0xe4dd71['uniqueid']]['hasOwnProperty'](_0x2da6bf)){if(this['channels'][_0xe4dd71[_0xc535('0x29')]][_0x2da6bf][_0xc535('0x40')]&&!this['channels'][_0xe4dd71['uniqueid']][_0x2da6bf][_0xc535('0x18')]){logger[_0xc535('0x27')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xe4dd71['uniqueid'],this['channels'][_0xe4dd71[_0xc535('0x29')]][_0x2da6bf][_0xc535('0x2a')],_0x2da6bf);this['channels'][_0xe4dd71[_0xc535('0x29')]][_0x2da6bf]['agentcomplete']=!![];this[_0xc535('0xc')][_0xe4dd71[_0xc535('0x29')]][_0x2da6bf][_0xc535('0x62')]=moment()[_0xc535('0x2f')](_0xc535('0x30'));this['channels'][_0xe4dd71[_0xc535('0x29')]][_0x2da6bf][_0xc535('0x63')]=_0xc535('0x64');this['channels'][_0xe4dd71[_0xc535('0x29')]][_0x2da6bf][_0xc535('0x65')]=_0xe4dd71[_0xc535('0x65')]=='transfer'?_0xc535('0x66'):_0xe4dd71[_0xc535('0x65')];this[_0xc535('0xc')][_0xe4dd71[_0xc535('0x29')]][_0x2da6bf][_0xc535('0x67')]=_0xe4dd71[_0xc535('0x67')];if(this[_0xc535('0xd')][_0xe4dd71[_0xc535('0x2e')]]&&this[_0xc535('0xd')][_0xe4dd71[_0xc535('0x2e')]][_0xc535('0x68')]){this[_0xc535('0xc')][_0xe4dd71[_0xc535('0x29')]][_0x2da6bf][_0xc535('0x69')]=this[_0xc535('0xd')][_0xe4dd71[_0xc535('0x2e')]]['acwTimeout'];this[_0xc535('0xc')][_0xe4dd71[_0xc535('0x29')]][_0x2da6bf]['agentacw']=!![];}this[_0xc535('0xe')][_0xe4dd71['interface']]=_[_0xc535('0x34')](this[_0xc535('0xe')][_0xe4dd71[_0xc535('0x4a')]],[_0xc535('0x2e'),'destconnectedlinenum']);logger['debug'](_0xc535('0x6a'),_0xe4dd71[_0xc535('0x29')],util[_0xc535('0x3b')](this[_0xc535('0xc')][_0xe4dd71[_0xc535('0x29')]][_0x2da6bf],{'showHidden':![],'depth':null}));ami[_0xc535('0x23')](_0xc535('0x6b'),this[_0xc535('0xc')][_0xe4dd71[_0xc535('0x29')]][_0x2da6bf]);logger[_0xc535('0x2c')](_0xc535('0x6c'),_0xe4dd71[_0xc535('0x29')],util[_0xc535('0x3b')]({'id':this[_0xc535('0xe')][_0xe4dd71[_0xc535('0x4a')]]['id'],'destaccountcode':_0xe4dd71[_0xc535('0x6d')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xc535('0x2f')](_0xc535('0x3c'),_0xe4dd71[_0xc535('0x2a')]),'user:agentcomplete',{'id':this[_0xc535('0xe')][_0xe4dd71[_0xc535('0x4a')]]['id'],'destaccountcode':Number(_0xe4dd71['destaccountcode'])});}}}}}}catch(_0xd7b92){logger[_0xc535('0x3e')](_0xc535('0x6e'),_0xe4dd71['uniqueid'],util[_0xc535('0x3b')](_0xd7b92,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc535('0x26')]['syncVarSet']=function(_0x362dc1){try{if(this[_0xc535('0x24')](_0x362dc1)){logger[_0xc535('0x2c')]('[%s][voiceAgentReport][varset]\x20event:',_0x362dc1[_0xc535('0x29')],util['inspect'](_0x362dc1,{'showHidden':![],'depth':null}));this[_0xc535('0x6f')](_0x362dc1[_0xc535('0x29')],_['keys'](_0x362dc1[_0xc535('0x70')])[0x0],_0x362dc1[_0xc535('0x71')]);if(this[_0xc535('0xc')][_0x362dc1[_0xc535('0x29')]]){for(var _0x2362d1 in this[_0xc535('0xc')][_0x362dc1[_0xc535('0x29')]]){if(this['channels'][_0x362dc1['uniqueid']]['hasOwnProperty'](_0x2362d1)){logger[_0xc535('0x27')](_0xc535('0x72'),_0x362dc1[_0xc535('0x29')],_0x2362d1,_[_0xc535('0x73')](_0x362dc1['variable'])[0x0],_0x362dc1['value']);if(_['isUndefined'](this[_0xc535('0xc')][_0x362dc1['uniqueid']][_0x2362d1][_0xc535('0xf')])){this['channels'][_0x362dc1[_0xc535('0x29')]][_0x2362d1]['variables']={};}this[_0xc535('0xc')][_0x362dc1['uniqueid']][_0x2362d1][_0xc535('0xf')]=this[_0xc535('0xf')][_0x362dc1['uniqueid']];}}}}}catch(_0x1b2876){logger['error'](_0xc535('0x74'),_0x362dc1[_0xc535('0x29')],util['inspect'](_0x1b2876,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc535('0x26')]['addVariable']=function(_0x2f110c,_0x25021d,_0x25b065){var _0x25baaf=[_0xc535('0x75'),'rtpaudioqosbridged','rtpaudioqosjitter',_0xc535('0x76'),_0xc535('0x77'),_0xc535('0x78'),_0xc535('0x79'),'rtpaudioqosrttbridged',_0xc535('0x7a'),_0xc535('0x7b'),_0xc535('0x7c'),_0xc535('0x7d'),_0xc535('0x7e'),_0xc535('0x7f'),_0xc535('0x80'),_0xc535('0x81'),'membername',_0xc535('0x82'),_0xc535('0x83')];if(!_[_0xc535('0x84')](_0x25021d)&&!_[_0xc535('0x85')](_0x25baaf,_0x25021d)){if(_[_0xc535('0x25')](this['variables'][_0x2f110c])){this[_0xc535('0xf')][_0x2f110c]={};}this['variables'][_0x2f110c][_0x25021d]=_0x25b065;}};VoiceAgentReport['prototype'][_0xc535('0x1c')]=function(_0x234d60){try{if(this['isNotNull'](_0x234d60)){logger[_0xc535('0x2c')](_0xc535('0x86'),_0x234d60[_0xc535('0x29')],util[_0xc535('0x3b')](_0x234d60,{'showHidden':![],'depth':null}));if(this[_0xc535('0xc')][_0x234d60[_0xc535('0x29')]]){for(var _0x568d34 in this['channels'][_0x234d60['uniqueid']]){if(this[_0xc535('0xc')][_0x234d60[_0xc535('0x29')]][_0xc535('0x3f')](_0x568d34)){if(this[_0xc535('0xc')][_0x234d60[_0xc535('0x29')]][_0x568d34][_0xc535('0x65')]==_0xc535('0x87')&&this[_0xc535('0xc')][_0x234d60[_0xc535('0x29')]][_0x568d34][_0xc535('0x18')]){logger[_0xc535('0x27')](_0xc535('0x88'),_0x234d60[_0xc535('0x29')],_0x568d34);this[_0xc535('0xc')][_0x234d60[_0xc535('0x29')]][_0x568d34][_0xc535('0x62')]=moment()[_0xc535('0x2f')](_0xc535('0x30'));}}}logger[_0xc535('0x2c')](_0xc535('0x89'),_0x234d60[_0xc535('0x29')],util[_0xc535('0x3b')](_[_0xc535('0x8a')](this['channels'][_0x234d60[_0xc535('0x29')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xc535('0x8b'),_[_0xc535('0x8a')](this['channels'][_0x234d60['uniqueid']]));delete this[_0xc535('0xc')][_0x234d60[_0xc535('0x29')]];}if(this[_0xc535('0xf')][_0x234d60[_0xc535('0x29')]]){delete this[_0xc535('0xf')][_0x234d60[_0xc535('0x29')]];}}}catch(_0x466546){logger['error'](_0xc535('0x8c'),_0x234d60['uniqueid'],util['inspect'](_0x466546,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc535('0x26')][_0xc535('0x21')]=function(_0x21dfa6){try{if(this[_0xc535('0x24')](_0x21dfa6)){logger[_0xc535('0x2c')](_0xc535('0x8d'),_0x21dfa6['uniqueid'],util[_0xc535('0x3b')](_0x21dfa6,{'showHidden':![],'depth':null}));if(this[_0xc535('0xc')][_0x21dfa6['transfereeuniqueid']]){for(var _0x2a2376 in this['channels'][_0x21dfa6[_0xc535('0x8e')]]){if(this[_0xc535('0xc')][_0x21dfa6[_0xc535('0x8e')]][_0xc535('0x3f')](_0x2a2376)){if(_0x21dfa6['origtransfereruniqueid']===_0x2a2376){logger[_0xc535('0x27')](_0xc535('0x8f'),_0x21dfa6['uniqueid'],this[_0xc535('0xc')][_0x21dfa6[_0xc535('0x8e')]][_0x2a2376][_0xc535('0x2a')],_0x2a2376);var _0x1089d6=moment();this[_0xc535('0xc')][_0x21dfa6[_0xc535('0x8e')]][_0x2a2376][_0xc535('0x18')]=!![];this[_0xc535('0xc')][_0x21dfa6[_0xc535('0x8e')]][_0x2a2376][_0xc535('0x62')]=moment()['format'](_0xc535('0x30'));this['channels'][_0x21dfa6['transfereeuniqueid']][_0x2a2376][_0xc535('0x63')]=_0xc535('0x64');this['channels'][_0x21dfa6[_0xc535('0x8e')]][_0x2a2376][_0xc535('0x65')]=_0xc535('0x87');this[_0xc535('0xc')][_0x21dfa6[_0xc535('0x8e')]][_0x2a2376][_0xc535('0x67')]=_0x1089d6[_0xc535('0x90')](this['channels'][_0x21dfa6[_0xc535('0x8e')]][_0x2a2376][_0xc535('0x40')],'seconds');}}}}if(this[_0xc535('0xc')][_0x21dfa6[_0xc535('0x91')]]){var _0x21a684=this[_0xc535('0xc')][_0x21dfa6['secondtransfereruniqueid']];this['channels'][_0x21dfa6[_0xc535('0x91')]]=this[_0xc535('0xc')][_0x21dfa6[_0xc535('0x8e')]];this[_0xc535('0xc')][_0x21dfa6[_0xc535('0x8e')]]=_0x21a684;}}}catch(_0x4c173b){logger[_0xc535('0x3e')]('[%s][voiceAgentReport][attendedtransfer]',_0x21dfa6[_0xc535('0x29')],util[_0xc535('0x3b')](_0x4c173b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xc535('0x22')]=function(_0x2aed0){try{if(this[_0xc535('0x24')](_0x2aed0)){logger[_0xc535('0x2c')](_0xc535('0x92'),_0x2aed0[_0xc535('0x29')],util['inspect'](_0x2aed0,{'showHidden':![],'depth':null}));if(this[_0xc535('0xc')][_0x2aed0[_0xc535('0x8e')]]){for(var _0x26786c in this[_0xc535('0xc')][_0x2aed0[_0xc535('0x8e')]]){if(this[_0xc535('0xc')][_0x2aed0['transfereeuniqueid']]['hasOwnProperty'](_0x26786c)){if(_0x2aed0['transfereruniqueid']===_0x26786c){logger[_0xc535('0x27')](_0xc535('0x93'),_0x2aed0[_0xc535('0x29')],this[_0xc535('0xc')][_0x2aed0['transfereeuniqueid']][_0x26786c]['membername'],_0x26786c);var _0x478df3=moment();this[_0xc535('0xc')][_0x2aed0[_0xc535('0x8e')]][_0x26786c][_0xc535('0x18')]=!![];this[_0xc535('0xc')][_0x2aed0[_0xc535('0x8e')]][_0x26786c][_0xc535('0x62')]=_0x478df3;this[_0xc535('0xc')][_0x2aed0['transfereeuniqueid']][_0x26786c][_0xc535('0x63')]='complete';this[_0xc535('0xc')][_0x2aed0[_0xc535('0x8e')]][_0x26786c][_0xc535('0x65')]=_0xc535('0x87');this[_0xc535('0xc')][_0x2aed0['transfereeuniqueid']][_0x26786c][_0xc535('0x67')]=_0x478df3[_0xc535('0x90')](this[_0xc535('0xc')][_0x2aed0[_0xc535('0x8e')]][_0x26786c][_0xc535('0x40')],_0xc535('0x94'));}}}}}}catch(_0x5754f3){logger[_0xc535('0x3e')](_0xc535('0x95'),_0x2aed0['uniqueid'],util[_0xc535('0x3b')](_0x5754f3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc535('0x26')][_0xc535('0x1e')]=function(_0x48aed2){var _0x478490='';try{if(this[_0xc535('0x24')](_0x48aed2)){logger[_0xc535('0x2c')](_0xc535('0x96'),_0x48aed2[_0xc535('0x29')],util['inspect'](_0x48aed2,{'showHidden':![],'depth':null}));if(_0x48aed2[_0xc535('0x97')]){_0x478490=_0x48aed2[_0xc535('0x97')]['substring'](0x0,_0x48aed2[_0xc535('0x97')][_0xc535('0x98')]('-'));if(this['agents'][_0x478490]){logger[_0xc535('0x27')](_0xc535('0x99'),_0x48aed2[_0xc535('0x29')],_0x478490);this[_0xc535('0xe')][_0x478490][_0xc535('0x9a')]=!![];}}}}catch(_0x97d056){logger[_0xc535('0x3e')](_0xc535('0x9b'),_0x48aed2[_0xc535('0x29')],util['inspect'](_0x97d056,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc535('0x26')][_0xc535('0x1f')]=function(_0x33c26d){var _0x187f0f='';try{if(this['isNotNull'](_0x33c26d)){logger['debug'](_0xc535('0x9c'),_0x33c26d[_0xc535('0x29')],util[_0xc535('0x3b')](_0x33c26d,{'showHidden':![],'depth':null}));if(_0x33c26d[_0xc535('0x97')]){_0x187f0f=_0x33c26d[_0xc535('0x97')][_0xc535('0x9d')](0x0,_0x33c26d[_0xc535('0x97')][_0xc535('0x98')]('-'));if(this['agents'][_0x187f0f]){logger[_0xc535('0x27')](_0xc535('0x9e'),_0x33c26d[_0xc535('0x29')],_0x187f0f);this[_0xc535('0xe')][_0x187f0f][_0xc535('0x9a')]=![];}}}}catch(_0x45efdd){logger[_0xc535('0x3e')](_0xc535('0x9f'),_0x33c26d[_0xc535('0x29')],util[_0xc535('0x3b')](_0x45efdd,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x7912=['agentcomplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','type','inbound','voice','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','variables','user:%s','membername','user:called','error','syncAgentConnect','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','interface','destconnectedlinenum','accountcode','exten','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','name','user:agentringnoanswer','custom:agentringnoanswer','assign','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon'];(function(_0x5d9ce1,_0x4a1556){var _0x1fd84e=function(_0x419f6e){while(--_0x419f6e){_0x5d9ce1['push'](_0x5d9ce1['shift']());}};_0x1fd84e(++_0x4a1556);}(_0x7912,0x8e));var _0x2791=function(_0x532112,_0x37d94b){_0x532112=_0x532112-0x0;var _0x23e5fb=_0x7912[_0x532112];return _0x23e5fb;};'use strict';var _=require(_0x2791('0x0'));var moment=require(_0x2791('0x1'));var util=require(_0x2791('0x2'));var Redis=require(_0x2791('0x3'));var config=require('../../../config/environment');var logger=require(_0x2791('0x4'))(_0x2791('0x5'));var ami=require(_0x2791('0x6'));config[_0x2791('0x7')]=_[_0x2791('0x8')](config[_0x2791('0x7')],{'host':_0x2791('0x9'),'port':0x18eb});var io=require(_0x2791('0xa'))(new Redis(config[_0x2791('0x7')]));function VoiceAgentReport(_0x4ff8a7){this[_0x2791('0xb')]={};this[_0x2791('0xc')]=_0x4ff8a7['channels'];this[_0x2791('0xd')]=_0x4ff8a7[_0x2791('0xd')];this['agents']=_0x4ff8a7[_0x2791('0xe')];this['variables']={};ami['on'](_0x2791('0xf'),this[_0x2791('0x10')][_0x2791('0x11')](this));ami['on'](_0x2791('0x12'),this['syncAgentConnect']['bind'](this));ami['on'](_0x2791('0x13'),this[_0x2791('0x14')][_0x2791('0x11')](this));ami['on'](_0x2791('0x15'),this[_0x2791('0x16')][_0x2791('0x11')](this));ami['on'](_0x2791('0x17'),this['syncAgentComplete'][_0x2791('0x11')](this));ami['on'](_0x2791('0x18'),this[_0x2791('0x19')][_0x2791('0x11')](this));ami['on'](_0x2791('0x1a'),this[_0x2791('0x1b')][_0x2791('0x11')](this));ami['on'](_0x2791('0x1c'),this[_0x2791('0x1d')][_0x2791('0x11')](this));ami['on']('musiconholdstop',this[_0x2791('0x1e')][_0x2791('0x11')](this));ami['on'](_0x2791('0x1f'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x2791('0x20'),this[_0x2791('0x21')][_0x2791('0x11')](this));}VoiceAgentReport[_0x2791('0x22')][_0x2791('0x23')]=function(_0x37c8a5,_0x106a0e,_0x49c060){io['to'](_0x37c8a5)[_0x2791('0x23')](_0x106a0e,_0x49c060);};VoiceAgentReport['prototype'][_0x2791('0x24')]=function(_0x588cae){return _0x588cae!==null&&!_[_0x2791('0x25')](_0x588cae);};VoiceAgentReport['prototype'][_0x2791('0x10')]=function(_0x50d4af){try{if(this[_0x2791('0x24')](_0x50d4af)){logger[_0x2791('0x26')](_0x2791('0x27'),_0x50d4af[_0x2791('0x28')],_0x50d4af['membername'],_0x50d4af[_0x2791('0x29')]);logger[_0x2791('0x2a')](_0x2791('0x2b'),_0x50d4af[_0x2791('0x28')],util[_0x2791('0x2c')](_0x50d4af,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0x50d4af[_0x2791('0x28')]])){this[_0x2791('0xb')][_0x50d4af[_0x2791('0x28')]]={};}var _0x12d5aa=this[_0x2791('0xe')][_0x50d4af['interface']];var _0x507d8f=this['channels'][_0x50d4af[_0x2791('0x28')]][_0x50d4af['destuniqueid']];var _0xf4e48d=this['voiceQueues'][_0x50d4af[_0x2791('0x2d')]];var _0xf6dbe6=this['variables'][_0x50d4af[_0x2791('0x28')]];if(_[_0x2791('0x25')](_0x507d8f)){_0x507d8f={'agentcalledAt':moment()[_0x2791('0x2e')](_0x2791('0x2f')),'lastevent':_0x2791('0x30'),'mandatoryDisposition':_0xf4e48d&&_0xf4e48d['mandatoryDisposition']?_0xf4e48d['mandatoryDisposition']:![],'type':_0xf4e48d&&_0xf4e48d[_0x2791('0x31')]?_0xf4e48d[_0x2791('0x31')]:_0x2791('0x32'),'variables':_0xf6dbe6,'motionChannel':_0x2791('0x33')};}Object['assign'](_0x507d8f,_[_0x2791('0x34')](_0x50d4af,['event',_0x2791('0x35')]));this[_0x2791('0xb')][_0x50d4af[_0x2791('0x28')]][_0x50d4af[_0x2791('0x29')]]=_0x507d8f;logger[_0x2791('0x2a')](_0x2791('0x36'),_0x50d4af[_0x2791('0x28')],util[_0x2791('0x2c')](_0x507d8f,{'showHidden':![],'depth':null}));ami['emit'](_0x2791('0x37'),_0x507d8f);var _0x59b9ab={'id':_0x12d5aa['id'],'calleridnum':_0x507d8f[_0x2791('0x38')],'queue':_0x507d8f[_0x2791('0x2d')],'variables':_0x507d8f[_0x2791('0x39')],'uniqueid':_0x50d4af[_0x2791('0x28')]};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x50d4af['uniqueid'],util['inspect'](_0x59b9ab,{'showHidden':![],'depth':null}));this['emit'](util[_0x2791('0x2e')](_0x2791('0x3a'),_0x50d4af[_0x2791('0x3b')]),_0x2791('0x3c'),_0x59b9ab);}}catch(_0x3a5162){logger[_0x2791('0x3d')]('[%s][voiceAgentReport][agentcalled]',_0x50d4af['uniqueid'],util[_0x2791('0x2c')](_0x3a5162,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2791('0x3e')]=function(_0x56c14f){try{if(this['isNotNull'](_0x56c14f)){if(this[_0x2791('0xb')][_0x56c14f['uniqueid']]){for(var _0x524ea1 in this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]]){if(this['channels'][_0x56c14f['uniqueid']]['hasOwnProperty'](_0x524ea1)){if(_0x56c14f['destuniqueid']===_0x524ea1){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x56c14f['uniqueid'],_0x56c14f[_0x2791('0x3b')],_0x56c14f[_0x2791('0x29')]);this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x524ea1]['agentconnectAt']=moment()['format'](_0x2791('0x2f'));this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x524ea1][_0x2791('0x3f')]=_0x56c14f[_0x2791('0x3f')];this['channels'][_0x56c14f[_0x2791('0x28')]][_0x524ea1][_0x2791('0x40')]=_0x56c14f[_0x2791('0x40')];this['channels'][_0x56c14f['uniqueid']][_0x524ea1]['destchannelstate']=_0x56c14f[_0x2791('0x41')];this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x524ea1][_0x2791('0x42')]=_0x56c14f['destchannelstatedesc'];this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x524ea1][_0x2791('0x43')]=_0x56c14f['holdtime'];this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x524ea1][_0x2791('0x44')]=_0x2791('0x45');if(this[_0x2791('0xc')][this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x524ea1][_0x2791('0x28')]]){var _0x3e2aea=this[_0x2791('0xc')][this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x524ea1]['uniqueid']][_0x2791('0x46')];this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x524ea1]['routealias']=_0x3e2aea;_0x56c14f['routealias']=_0x3e2aea;}_['merge'](this[_0x2791('0xe')][_0x56c14f[_0x2791('0x47')]],_['pick'](_0x56c14f,[_0x2791('0x2d'),_0x2791('0x48'),'routealias']));var _0x5389db=this[_0x2791('0xe')][_0x56c14f[_0x2791('0x47')]];var _0x23857c={'id':_0x5389db['id'],'name':_0x5389db['name'],'agentconnected':!![],'destaccountcode':_0x5389db[_0x2791('0x49')],'destconnectedlinenum':this[_0x2791('0xb')][_0x56c14f['uniqueid']][_0x56c14f[_0x2791('0x29')]][_0x2791('0x4a')],'queue':this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x56c14f[_0x2791('0x29')]]['queue'],'routealias':this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x56c14f['destuniqueid']]['routealias'],'uniqueid':this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x56c14f['destuniqueid']][_0x2791('0x28')]};ami[_0x2791('0x23')]('custom:agentconnect',this[_0x2791('0xb')][_0x56c14f['uniqueid']][_0x56c14f['destuniqueid']]);this[_0x2791('0x23')](util[_0x2791('0x2e')](_0x2791('0x3a'),_0x56c14f[_0x2791('0x3b')]),_0x2791('0x4b'),_0x23857c);}else if(!this['channels'][_0x56c14f[_0x2791('0x28')]][_0x524ea1][_0x2791('0x13')]&&!this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x524ea1][_0x2791('0x17')]){logger['info'](_0x2791('0x4c'),_0x56c14f[_0x2791('0x28')],this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x524ea1][_0x2791('0x3b')],_0x524ea1);this['channels'][_0x56c14f['uniqueid']][_0x524ea1]['agentringnoanswer']=!![];this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x524ea1][_0x2791('0x4d')]=moment()['format'](_0x2791('0x2f'));this[_0x2791('0xb')][_0x56c14f['uniqueid']][_0x524ea1][_0x2791('0x4e')]=_0x56c14f['destuniqueid'];this['channels'][_0x56c14f[_0x2791('0x28')]][_0x524ea1][_0x2791('0x4f')]=_0x56c14f[_0x2791('0x3b')];this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x524ea1][_0x2791('0x44')]='answered_elsewhere';this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x524ea1][_0x2791('0x50')]='answered_elsewhere';logger[_0x2791('0x2a')](_0x2791('0x51'),_0x56c14f['uniqueid'],util[_0x2791('0x2c')](this[_0x2791('0xb')][_0x56c14f[_0x2791('0x28')]][_0x524ea1],{'showHidden':![],'depth':null}));ami[_0x2791('0x23')](_0x2791('0x52'),this['channels'][_0x56c14f[_0x2791('0x28')]][_0x524ea1]);}else{logger[_0x2791('0x2a')](_0x2791('0x53'),_0x56c14f['uniqueid']);}}}}}}catch(_0x4686d4){logger[_0x2791('0x3d')](_0x2791('0x54'),_0x56c14f[_0x2791('0x28')],util[_0x2791('0x2c')](_0x4686d4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2791('0x22')][_0x2791('0x14')]=function(_0x3c8d9d){try{if(this['isNotNull'](_0x3c8d9d)){logger[_0x2791('0x2a')](_0x2791('0x55'),_0x3c8d9d[_0x2791('0x28')],util[_0x2791('0x2c')](_0x3c8d9d,{'showHidden':![],'depth':null}));if(this[_0x2791('0xb')][_0x3c8d9d[_0x2791('0x28')]]&&this[_0x2791('0xb')][_0x3c8d9d['uniqueid']][_0x3c8d9d[_0x2791('0x29')]]){logger[_0x2791('0x26')](_0x2791('0x56'),_0x3c8d9d['uniqueid'],_0x3c8d9d['membername'],_0x3c8d9d[_0x2791('0x29')]);var _0x440c93=this[_0x2791('0xe')][_0x3c8d9d['interface']];var _0x2a0364=this[_0x2791('0xb')][_0x3c8d9d[_0x2791('0x28')]][_0x3c8d9d[_0x2791('0x29')]];_0x2a0364[_0x2791('0x13')]=!![];_0x2a0364[_0x2791('0x4d')]=moment()[_0x2791('0x2e')](_0x2791('0x2f'));_0x2a0364[_0x2791('0x44')]=_0x2791('0x57');_0x2a0364['reason']=_0x2791('0x57');var _0x2b2ed2={'id':_0x440c93['id'],'name':_0x440c93[_0x2791('0x58')],'queue':_0x2a0364[_0x2791('0x2d')],'uniqueid':_0x2a0364[_0x2791('0x28')]};logger[_0x2791('0x2a')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x3c8d9d[_0x2791('0x28')],util[_0x2791('0x2c')](_0x2b2ed2,{'showHidden':![],'depth':null}));this[_0x2791('0x23')](util[_0x2791('0x2e')](_0x2791('0x3a'),_0x440c93['name']),_0x2791('0x59'),_0x2b2ed2);ami['emit'](_0x2791('0x5a'),_0x2a0364);this[_0x2791('0xb')][_0x3c8d9d[_0x2791('0x28')]][_0x3c8d9d[_0x2791('0x29')]]=Object[_0x2791('0x5b')]({},_0x2a0364);}}}catch(_0x6b6a16){logger[_0x2791('0x3d')](_0x2791('0x5c'),_0x3c8d9d[_0x2791('0x28')],util[_0x2791('0x2c')](_0x6b6a16,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2791('0x16')]=function(_0x45f9e0){try{if(this['isNotNull'](_0x45f9e0)){logger['debug'](_0x2791('0x5d'),_0x45f9e0[_0x2791('0x28')],util[_0x2791('0x2c')](_0x45f9e0,{'showHidden':![],'depth':null}));if(this[_0x2791('0xb')][_0x45f9e0[_0x2791('0x28')]]){for(var _0x3f20dd in this['channels'][_0x45f9e0[_0x2791('0x28')]]){if(this[_0x2791('0xb')][_0x45f9e0[_0x2791('0x28')]][_0x2791('0x5e')](_0x3f20dd)&&!this[_0x2791('0xb')][_0x45f9e0[_0x2791('0x28')]][_0x3f20dd][_0x2791('0x13')]&&!this['channels'][_0x45f9e0['uniqueid']][_0x3f20dd][_0x2791('0x17')]){logger[_0x2791('0x26')](_0x2791('0x5f'),_0x45f9e0['uniqueid'],this[_0x2791('0xb')][_0x45f9e0[_0x2791('0x28')]][_0x3f20dd][_0x2791('0x3b')],_0x3f20dd);this[_0x2791('0xb')][_0x45f9e0[_0x2791('0x28')]][_0x3f20dd][_0x2791('0x13')]=!![];this['channels'][_0x45f9e0[_0x2791('0x28')]][_0x3f20dd][_0x2791('0x4d')]=moment()[_0x2791('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x45f9e0['uniqueid']][_0x3f20dd][_0x2791('0x44')]=_0x2791('0x60');this[_0x2791('0xb')][_0x45f9e0[_0x2791('0x28')]][_0x3f20dd]['reason']=_0x2791('0x60');logger['debug'](_0x2791('0x61'),_0x45f9e0[_0x2791('0x28')],util['inspect'](this[_0x2791('0xb')][_0x45f9e0['uniqueid']][_0x3f20dd],{'showHidden':![],'depth':null}));ami['emit']('custom:agentqueuecallerabandon',this[_0x2791('0xb')][_0x45f9e0['uniqueid']][_0x3f20dd]);}}}}}catch(_0xf0e870){logger[_0x2791('0x3d')](_0x2791('0x62'),_0x45f9e0[_0x2791('0x28')],util[_0x2791('0x2c')](_0xf0e870,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2791('0x22')][_0x2791('0x63')]=function(_0x3133cc){try{if(this[_0x2791('0x24')](_0x3133cc)){logger[_0x2791('0x2a')](_0x2791('0x64'),_0x3133cc[_0x2791('0x28')],util['inspect'](_0x3133cc,{'showHidden':![],'depth':null}));if(this['channels'][_0x3133cc[_0x2791('0x28')]]){for(var _0x54f4a4 in this[_0x2791('0xb')][_0x3133cc['uniqueid']]){if(this[_0x2791('0xb')][_0x3133cc[_0x2791('0x28')]][_0x2791('0x5e')](_0x54f4a4)){if(this['channels'][_0x3133cc[_0x2791('0x28')]][_0x54f4a4][_0x2791('0x65')]&&!this[_0x2791('0xb')][_0x3133cc[_0x2791('0x28')]][_0x54f4a4]['agentcomplete']){logger[_0x2791('0x26')](_0x2791('0x66'),_0x3133cc['uniqueid'],this[_0x2791('0xb')][_0x3133cc[_0x2791('0x28')]][_0x54f4a4][_0x2791('0x3b')],_0x54f4a4);this[_0x2791('0xb')][_0x3133cc[_0x2791('0x28')]][_0x54f4a4][_0x2791('0x17')]=!![];this['channels'][_0x3133cc[_0x2791('0x28')]][_0x54f4a4][_0x2791('0x67')]=moment()[_0x2791('0x2e')](_0x2791('0x2f'));this['channels'][_0x3133cc[_0x2791('0x28')]][_0x54f4a4][_0x2791('0x44')]=_0x2791('0x68');this[_0x2791('0xb')][_0x3133cc[_0x2791('0x28')]][_0x54f4a4][_0x2791('0x50')]=_0x3133cc[_0x2791('0x50')]==_0x2791('0x69')?_0x2791('0x6a'):_0x3133cc['reason'];this[_0x2791('0xb')][_0x3133cc[_0x2791('0x28')]][_0x54f4a4][_0x2791('0x6b')]=_0x3133cc['talktime'];if(this['voiceQueues'][_0x3133cc['queue']]&&this['voiceQueues'][_0x3133cc[_0x2791('0x2d')]][_0x2791('0x6c')]){this[_0x2791('0xb')][_0x3133cc[_0x2791('0x28')]][_0x54f4a4][_0x2791('0x6d')]=this[_0x2791('0xd')][_0x3133cc['queue']][_0x2791('0x6e')];this[_0x2791('0xb')][_0x3133cc['uniqueid']][_0x54f4a4][_0x2791('0x6f')]=!![];}this[_0x2791('0xe')][_0x3133cc['interface']]=_['omit'](this['agents'][_0x3133cc['interface']],['queue',_0x2791('0x48')]);logger[_0x2791('0x2a')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x3133cc[_0x2791('0x28')],util[_0x2791('0x2c')](this[_0x2791('0xb')][_0x3133cc[_0x2791('0x28')]][_0x54f4a4],{'showHidden':![],'depth':null}));ami[_0x2791('0x23')](_0x2791('0x70'),this[_0x2791('0xb')][_0x3133cc[_0x2791('0x28')]][_0x54f4a4]);logger[_0x2791('0x2a')](_0x2791('0x71'),_0x3133cc[_0x2791('0x28')],util[_0x2791('0x2c')]({'id':this[_0x2791('0xe')][_0x3133cc[_0x2791('0x47')]]['id'],'destaccountcode':_0x3133cc[_0x2791('0x72')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x2791('0x3a'),_0x3133cc[_0x2791('0x3b')]),_0x2791('0x73'),{'id':this[_0x2791('0xe')][_0x3133cc[_0x2791('0x47')]]['id'],'destaccountcode':Number(_0x3133cc[_0x2791('0x72')])});}}}}}}catch(_0x4171b0){logger[_0x2791('0x3d')](_0x2791('0x74'),_0x3133cc['uniqueid'],util[_0x2791('0x2c')](_0x4171b0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2791('0x22')][_0x2791('0x19')]=function(_0x364e4){try{if(this[_0x2791('0x24')](_0x364e4)){logger[_0x2791('0x2a')](_0x2791('0x75'),_0x364e4[_0x2791('0x28')],util[_0x2791('0x2c')](_0x364e4,{'showHidden':![],'depth':null}));this[_0x2791('0x76')](_0x364e4['uniqueid'],_[_0x2791('0x77')](_0x364e4['variable'])[0x0],_0x364e4[_0x2791('0x78')]);if(this[_0x2791('0xb')][_0x364e4['uniqueid']]){for(var _0x2e8d8c in this[_0x2791('0xb')][_0x364e4[_0x2791('0x28')]]){if(this[_0x2791('0xb')][_0x364e4[_0x2791('0x28')]][_0x2791('0x5e')](_0x2e8d8c)){logger[_0x2791('0x26')](_0x2791('0x79'),_0x364e4['uniqueid'],_0x2e8d8c,_[_0x2791('0x77')](_0x364e4[_0x2791('0x7a')])[0x0],_0x364e4[_0x2791('0x78')]);if(_[_0x2791('0x25')](this[_0x2791('0xb')][_0x364e4[_0x2791('0x28')]][_0x2e8d8c][_0x2791('0x39')])){this[_0x2791('0xb')][_0x364e4[_0x2791('0x28')]][_0x2e8d8c]['variables']={};}this[_0x2791('0xb')][_0x364e4[_0x2791('0x28')]][_0x2e8d8c][_0x2791('0x39')]=this[_0x2791('0x39')][_0x364e4[_0x2791('0x28')]];}}}}}catch(_0x2c9cf2){logger[_0x2791('0x3d')](_0x2791('0x7b'),_0x364e4[_0x2791('0x28')],util[_0x2791('0x2c')](_0x2c9cf2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2791('0x22')][_0x2791('0x76')]=function(_0x5bd1f3,_0x1fc857,_0x2d73e2){var _0x4ab0d1=['rtpaudioqos',_0x2791('0x7c'),'rtpaudioqosjitter',_0x2791('0x7d'),_0x2791('0x7e'),_0x2791('0x7f'),'rtpaudioqosrtt',_0x2791('0x80'),_0x2791('0x81'),'sipuri',_0x2791('0x82'),_0x2791('0x83'),_0x2791('0x84'),_0x2791('0x85'),_0x2791('0x86'),_0x2791('0x87'),'membername',_0x2791('0x88'),_0x2791('0x89')];if(!_[_0x2791('0x8a')](_0x1fc857)&&!_[_0x2791('0x8b')](_0x4ab0d1,_0x1fc857)){if(_[_0x2791('0x25')](this[_0x2791('0x39')][_0x5bd1f3])){this[_0x2791('0x39')][_0x5bd1f3]={};}this[_0x2791('0x39')][_0x5bd1f3][_0x1fc857]=_0x2d73e2;}};VoiceAgentReport[_0x2791('0x22')][_0x2791('0x1b')]=function(_0x204291){try{if(this[_0x2791('0x24')](_0x204291)){logger[_0x2791('0x2a')](_0x2791('0x8c'),_0x204291[_0x2791('0x28')],util[_0x2791('0x2c')](_0x204291,{'showHidden':![],'depth':null}));if(this[_0x2791('0xb')][_0x204291['uniqueid']]){for(var _0x130105 in this[_0x2791('0xb')][_0x204291['uniqueid']]){if(this['channels'][_0x204291['uniqueid']][_0x2791('0x5e')](_0x130105)){if(this[_0x2791('0xb')][_0x204291[_0x2791('0x28')]][_0x130105][_0x2791('0x50')]==_0x2791('0x69')&&this[_0x2791('0xb')][_0x204291[_0x2791('0x28')]][_0x130105][_0x2791('0x17')]){logger[_0x2791('0x26')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x204291[_0x2791('0x28')],_0x130105);this[_0x2791('0xb')][_0x204291[_0x2791('0x28')]][_0x130105]['agentcompleteAt']=moment()[_0x2791('0x2e')](_0x2791('0x2f'));}}}logger[_0x2791('0x2a')](_0x2791('0x8d'),_0x204291[_0x2791('0x28')],util[_0x2791('0x2c')](_[_0x2791('0x8e')](this['channels'][_0x204291[_0x2791('0x28')]]),{'showHidden':![],'depth':null}));ami[_0x2791('0x23')](_0x2791('0x8f'),_[_0x2791('0x8e')](this[_0x2791('0xb')][_0x204291[_0x2791('0x28')]]));delete this[_0x2791('0xb')][_0x204291['uniqueid']];}if(this[_0x2791('0x39')][_0x204291[_0x2791('0x28')]]){delete this[_0x2791('0x39')][_0x204291[_0x2791('0x28')]];}}}catch(_0x2bb26f){logger['error'](_0x2791('0x90'),_0x204291['uniqueid'],util[_0x2791('0x2c')](_0x2bb26f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2791('0x22')][_0x2791('0x91')]=function(_0x13b35b){try{if(this[_0x2791('0x24')](_0x13b35b)){logger[_0x2791('0x2a')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x13b35b['uniqueid'],util[_0x2791('0x2c')](_0x13b35b,{'showHidden':![],'depth':null}));if(this[_0x2791('0xb')][_0x13b35b[_0x2791('0x92')]]){for(var _0x384890 in this[_0x2791('0xb')][_0x13b35b['transfereeuniqueid']]){if(this['channels'][_0x13b35b[_0x2791('0x92')]][_0x2791('0x5e')](_0x384890)){if(_0x13b35b[_0x2791('0x93')]===_0x384890){logger['info'](_0x2791('0x94'),_0x13b35b[_0x2791('0x28')],this[_0x2791('0xb')][_0x13b35b[_0x2791('0x92')]][_0x384890]['membername'],_0x384890);var _0x5b34b0=moment();this[_0x2791('0xb')][_0x13b35b['transfereeuniqueid']][_0x384890][_0x2791('0x17')]=!![];this[_0x2791('0xb')][_0x13b35b[_0x2791('0x92')]][_0x384890][_0x2791('0x67')]=moment()[_0x2791('0x2e')](_0x2791('0x2f'));this[_0x2791('0xb')][_0x13b35b[_0x2791('0x92')]][_0x384890][_0x2791('0x44')]=_0x2791('0x68');this['channels'][_0x13b35b[_0x2791('0x92')]][_0x384890][_0x2791('0x50')]=_0x2791('0x69');this['channels'][_0x13b35b[_0x2791('0x92')]][_0x384890][_0x2791('0x6b')]=_0x5b34b0['diff'](this[_0x2791('0xb')][_0x13b35b[_0x2791('0x92')]][_0x384890]['agentconnectAt'],_0x2791('0x95'));}}}}if(this[_0x2791('0xb')][_0x13b35b['secondtransfereruniqueid']]){var _0x4b9222=this[_0x2791('0xb')][_0x13b35b[_0x2791('0x96')]];this[_0x2791('0xb')][_0x13b35b[_0x2791('0x96')]]=this['channels'][_0x13b35b[_0x2791('0x92')]];this[_0x2791('0xb')][_0x13b35b[_0x2791('0x92')]]=_0x4b9222;}}}catch(_0x6ef8e5){logger[_0x2791('0x3d')](_0x2791('0x97'),_0x13b35b[_0x2791('0x28')],util['inspect'](_0x6ef8e5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2791('0x22')][_0x2791('0x21')]=function(_0x5b07a1){try{if(this[_0x2791('0x24')](_0x5b07a1)){logger[_0x2791('0x2a')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x5b07a1[_0x2791('0x28')],util[_0x2791('0x2c')](_0x5b07a1,{'showHidden':![],'depth':null}));if(this[_0x2791('0xb')][_0x5b07a1[_0x2791('0x92')]]){for(var _0x4e24dd in this[_0x2791('0xb')][_0x5b07a1[_0x2791('0x92')]]){if(this[_0x2791('0xb')][_0x5b07a1[_0x2791('0x92')]][_0x2791('0x5e')](_0x4e24dd)){if(_0x5b07a1[_0x2791('0x98')]===_0x4e24dd){logger[_0x2791('0x26')](_0x2791('0x99'),_0x5b07a1[_0x2791('0x28')],this[_0x2791('0xb')][_0x5b07a1[_0x2791('0x92')]][_0x4e24dd][_0x2791('0x3b')],_0x4e24dd);var _0x1e3577=moment();this['channels'][_0x5b07a1[_0x2791('0x92')]][_0x4e24dd][_0x2791('0x17')]=!![];this['channels'][_0x5b07a1[_0x2791('0x92')]][_0x4e24dd]['agentcompleteAt']=_0x1e3577;this[_0x2791('0xb')][_0x5b07a1['transfereeuniqueid']][_0x4e24dd]['lastevent']='complete';this[_0x2791('0xb')][_0x5b07a1[_0x2791('0x92')]][_0x4e24dd][_0x2791('0x50')]=_0x2791('0x69');this[_0x2791('0xb')][_0x5b07a1[_0x2791('0x92')]][_0x4e24dd]['talktime']=_0x1e3577[_0x2791('0x9a')](this['channels'][_0x5b07a1['transfereeuniqueid']][_0x4e24dd][_0x2791('0x65')],_0x2791('0x95'));}}}}}}catch(_0x350bd9){logger[_0x2791('0x3d')](_0x2791('0x9b'),_0x5b07a1[_0x2791('0x28')],util[_0x2791('0x2c')](_0x350bd9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2791('0x22')]['syncMusicOnHoldStart']=function(_0x2f8fea){var _0x233dc8='';try{if(this[_0x2791('0x24')](_0x2f8fea)){logger[_0x2791('0x2a')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x2f8fea['uniqueid'],util[_0x2791('0x2c')](_0x2f8fea,{'showHidden':![],'depth':null}));if(_0x2f8fea[_0x2791('0x9c')]){_0x233dc8=_0x2f8fea[_0x2791('0x9c')][_0x2791('0x9d')](0x0,_0x2f8fea[_0x2791('0x9c')][_0x2791('0x9e')]('-'));if(this[_0x2791('0xe')][_0x233dc8]){logger[_0x2791('0x26')](_0x2791('0x9f'),_0x2f8fea[_0x2791('0x28')],_0x233dc8);this[_0x2791('0xe')][_0x233dc8][_0x2791('0xa0')]=!![];}}}}catch(_0x25e180){logger[_0x2791('0x3d')](_0x2791('0xa1'),_0x2f8fea[_0x2791('0x28')],util[_0x2791('0x2c')](_0x25e180,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2791('0x22')][_0x2791('0x1e')]=function(_0x30a859){var _0x283dcb='';try{if(this[_0x2791('0x24')](_0x30a859)){logger[_0x2791('0x2a')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x30a859[_0x2791('0x28')],util[_0x2791('0x2c')](_0x30a859,{'showHidden':![],'depth':null}));if(_0x30a859[_0x2791('0x9c')]){_0x283dcb=_0x30a859[_0x2791('0x9c')][_0x2791('0x9d')](0x0,_0x30a859[_0x2791('0x9c')][_0x2791('0x9e')]('-'));if(this['agents'][_0x283dcb]){logger[_0x2791('0x26')](_0x2791('0xa2'),_0x30a859[_0x2791('0x28')],_0x283dcb);this['agents'][_0x283dcb]['onhold']=![];}}}}catch(_0x5c85a7){logger[_0x2791('0x3d')](_0x2791('0xa3'),_0x30a859[_0x2791('0x28')],util[_0x2791('0x2c')](_0x5c85a7,{'showHidden':![],'depth':null}));}};module[_0x2791('0xa4')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index fd6d3bc..19944ab 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 _0xd717=['includes','lastapplication','lastdata','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','channelstate','answertime','holdtime','diff','xcally-motion-preview','connectedlinename','UserId','membername','answered','destinationchannel','routealias','[%s][voiceCallReport][newstate]','monitor','endsWith','replace','.wav49','.WAV','monitorFilename','find','monitors','push','rec','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','xmcs-queue','sipcalluniqueid','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','length','transferType','resolve','undefined','isEmpty','then','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','BlindTransfer','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','lodash','util','path','ioredis','../../../config/environment','ami','../ami','../model/channel','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','inspect','linkedid','merge','pick','keys','split','exten','channel','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','toNumber','from-sip','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','disposition'];(function(_0x4c40f6,_0x432c5f){var _0x132f49=function(_0x163df1){while(--_0x163df1){_0x4c40f6['push'](_0x4c40f6['shift']());}};_0x132f49(++_0x432c5f);}(_0xd717,0x12e));var _0x7d71=function(_0x53f029,_0x1619c1){_0x53f029=_0x53f029-0x0;var _0x6cf484=_0xd717[_0x53f029];return _0x6cf484;};'use strict';var _=require(_0x7d71('0x0'));var moment=require('moment');var util=require(_0x7d71('0x1'));var path=require(_0x7d71('0x2'));var Redis=require(_0x7d71('0x3'));var config=require(_0x7d71('0x4'));var logger=require('../../../config/logger')(_0x7d71('0x5'));var ami=require(_0x7d71('0x6'));var Channel=require(_0x7d71('0x7'));var RpcSetting=require('../rpc/setting');var applications=[_0x7d71('0x8'),_0x7d71('0x9'),_0x7d71('0xa'),_0x7d71('0xb'),_0x7d71('0xc'),_0x7d71('0xd')];var dispositions=[_0x7d71('0xe'),'FAILED',_0x7d71('0xf'),_0x7d71('0xe'),_0x7d71('0xe'),_0x7d71('0xe'),_0x7d71('0x10'),_0x7d71('0x11'),_0x7d71('0xf'),_0x7d71('0xf'),_0x7d71('0xf')];config[_0x7d71('0x12')]=_[_0x7d71('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7d71('0x14'))(new Redis(config[_0x7d71('0x12')]));function VoiceCallReport(_0x378d0c){this['channels']=_0x378d0c[_0x7d71('0x15')];this[_0x7d71('0x16')]=_0x378d0c[_0x7d71('0x16')];this[_0x7d71('0x17')]={};ami['on']('coreshowchannel',this[_0x7d71('0x18')]['bind'](this));ami['on'](_0x7d71('0x19'),this[_0x7d71('0x18')][_0x7d71('0x1a')](this));ami['on'](_0x7d71('0x1b'),this[_0x7d71('0x1c')][_0x7d71('0x1a')](this));ami['on'](_0x7d71('0x1d'),this[_0x7d71('0x1e')][_0x7d71('0x1a')](this));ami['on'](_0x7d71('0x1f'),this['syncVarSet'][_0x7d71('0x1a')](this));ami['on'](_0x7d71('0x20'),this[_0x7d71('0x21')][_0x7d71('0x1a')](this));ami['on']('newcallerid',this[_0x7d71('0x22')][_0x7d71('0x1a')](this));ami['on'](_0x7d71('0x23'),this[_0x7d71('0x24')][_0x7d71('0x1a')](this));ami['on']('blindtransfer',this[_0x7d71('0x25')][_0x7d71('0x1a')](this));ami['on'](_0x7d71('0x26'),this[_0x7d71('0x27')]['bind'](this));ami['on'](_0x7d71('0x28'),this[_0x7d71('0x29')][_0x7d71('0x1a')](this));try{logger[_0x7d71('0x2a')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x7d71('0x2b')]();}catch(_0x555491){logger[_0x7d71('0x2c')](_0x7d71('0x2d'),util['inspect'](_0x555491,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x7d71('0x2e')]['isNotNull']=function(_0x4e481a){return _0x4e481a!==null&&!_[_0x7d71('0x2f')](_0x4e481a);};VoiceCallReport[_0x7d71('0x2e')][_0x7d71('0x30')]=function(_0x102d9e,_0x3518d0,_0x414fd9){io['to'](_0x102d9e)[_0x7d71('0x30')](_0x3518d0,_0x414fd9);};VoiceCallReport[_0x7d71('0x2e')][_0x7d71('0x22')]=function(_0x5c2cc1){try{if(this[_0x7d71('0x31')](_0x5c2cc1)){logger[_0x7d71('0x2a')](_0x7d71('0x32'),_0x5c2cc1['uniqueid'],_0x5c2cc1['calleridname'],_0x5c2cc1[_0x7d71('0x33')]);logger[_0x7d71('0x34')](_0x7d71('0x35'),_0x5c2cc1[_0x7d71('0x36')],util[_0x7d71('0x37')](_0x5c2cc1,{'showHidden':![],'depth':null}));if(_0x5c2cc1[_0x7d71('0x36')]===_0x5c2cc1[_0x7d71('0x38')]){if(!_[_0x7d71('0x2f')](this[_0x7d71('0x15')][_0x5c2cc1[_0x7d71('0x36')]])){_[_0x7d71('0x39')](this['channels'][_0x5c2cc1[_0x7d71('0x36')]],_[_0x7d71('0x3a')](_0x5c2cc1,_[_0x7d71('0x3b')](this[_0x7d71('0x15')][_0x5c2cc1[_0x7d71('0x36')]])));}}if(_0x5c2cc1['context']==='from-sip'){if(this[_0x7d71('0x16')][_0x5c2cc1['channel'][_0x7d71('0x3c')]('-')[0x0]]){if(_0x5c2cc1[_0x7d71('0x3d')]=='xcally-motion-preview'){this[_0x7d71('0x16')][_0x5c2cc1[_0x7d71('0x3e')][_0x7d71('0x3c')]('-')[0x0]][_0x7d71('0x3f')]=_0x5c2cc1[_0x7d71('0x40')];this[_0x7d71('0x30')](util[_0x7d71('0x41')](_0x7d71('0x42'),this[_0x7d71('0x16')][_0x5c2cc1[_0x7d71('0x3e')]['split']('-')[0x0]][_0x7d71('0x43')]),_0x7d71('0x44'),{'destaccountcode':this[_0x7d71('0x16')][_0x5c2cc1[_0x7d71('0x3e')][_0x7d71('0x3c')]('-')[0x0]][_0x7d71('0x45')],'destconnectedlinenum':_0x5c2cc1['connectedlinenum']});}}}}}catch(_0x3bbe2f){logger[_0x7d71('0x2c')](_0x7d71('0x46'),_0x5c2cc1[_0x7d71('0x36')],util[_0x7d71('0x37')](_0x3bbe2f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7d71('0x1c')]=function(_0x1c1f41){try{if(this['isNotNull'](_0x1c1f41)){logger[_0x7d71('0x34')](_0x7d71('0x47'),_0x1c1f41[_0x7d71('0x36')],util[_0x7d71('0x37')](_0x1c1f41,{'showHidden':![],'depth':null}));if(this[_0x7d71('0x15')][_0x1c1f41[_0x7d71('0x36')]]){return;}if(_0x1c1f41[_0x7d71('0x3e')]===_0x7d71('0x48')){return;}if(_0x1c1f41[_0x7d71('0x36')]!==_0x1c1f41[_0x7d71('0x38')]&&!this['blindTransfers'][_0x1c1f41['linkedid']]){return;}logger[_0x7d71('0x2a')](_0x7d71('0x49'),_0x1c1f41[_0x7d71('0x36')],_0x1c1f41[_0x7d71('0x4a')],_0x1c1f41[_0x7d71('0x3d')]);this[_0x7d71('0x15')][_0x1c1f41[_0x7d71('0x36')]]=new Channel();this[_0x7d71('0x15')][_0x1c1f41[_0x7d71('0x36')]][_0x7d71('0x4b')]=moment()[_0x7d71('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7d71('0x15')][_0x1c1f41['uniqueid']]['disposition']=dispositions[_[_0x7d71('0x4c')](_0x1c1f41['channelstate'])];_[_0x7d71('0x39')](this[_0x7d71('0x15')][_0x1c1f41[_0x7d71('0x36')]],_[_0x7d71('0x3a')](_0x1c1f41,_['keys'](this[_0x7d71('0x15')][_0x1c1f41[_0x7d71('0x36')]])));if(_0x1c1f41[_0x7d71('0x4a')]===_0x7d71('0x4d')){var _0x38bff0=this[_0x7d71('0x16')][_0x1c1f41['channel'][_0x7d71('0x3c')]('-')[0x0]];if(_0x38bff0&&typeof _0x38bff0[_0x7d71('0x3f')]==='undefined'){_0x38bff0[_0x7d71('0x3f')]=_0x1c1f41['exten'];logger[_0x7d71('0x34')](_0x7d71('0x4e'),_0x1c1f41['uniqueid'],util[_0x7d71('0x37')]({'id':_0x38bff0['id'],'destaccountcode':_0x38bff0[_0x7d71('0x45')],'destconnectedlinenum':_0x1c1f41[_0x7d71('0x3d')]},{'showHidden':![],'depth':null}));this[_0x7d71('0x30')](util['format'](_0x7d71('0x42'),_0x38bff0['name']),_0x7d71('0x44'),{'id':_0x38bff0['id'],'destaccountcode':_0x38bff0[_0x7d71('0x45')],'destconnectedlinenum':_0x1c1f41[_0x7d71('0x3d')]});}}}}catch(_0x4b7fe0){logger['error']('[%s][voiceCallReport][newchannel]',_0x1c1f41['uniqueid'],util[_0x7d71('0x37')](_0x4b7fe0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7d71('0x2e')][_0x7d71('0x18')]=function(_0x4e003f){try{if(this[_0x7d71('0x31')](_0x4e003f)){logger['debug'](_0x7d71('0x4f'),_0x4e003f[_0x7d71('0x36')],util[_0x7d71('0x37')](_0x4e003f,{'showHidden':![],'depth':null}));if(_0x4e003f[_0x7d71('0x3e')]===_0x7d71('0x48')||_0x4e003f['exten']==='h')return;if(_0x4e003f[_0x7d71('0x36')]===_0x4e003f[_0x7d71('0x38')]||this[_0x7d71('0x17')][_0x4e003f['linkedid']]){_0x4e003f['application']=_0x4e003f['application']?_0x4e003f[_0x7d71('0x50')]['toLowerCase']():undefined;_0x4e003f[_0x7d71('0x51')]=_0x4e003f[_0x7d71('0x52')]||_0x4e003f['applicationdata'];if(_0x4e003f[_0x7d71('0x52')]&&!_0x4e003f[_0x7d71('0x52')]['startsWith']('CDR(routeAlias)')&&_0x4e003f[_0x7d71('0x50')]!=='queue'){_0x4e003f[_0x7d71('0x51')]=_0x4e003f[_0x7d71('0x51')][_0x7d71('0x53')]();}logger[_0x7d71('0x2a')](_0x7d71('0x54'),_0x4e003f[_0x7d71('0x36')],_0x4e003f['application'],_0x4e003f['applicationdata']);if(_[_0x7d71('0x2f')](this[_0x7d71('0x15')][_0x4e003f[_0x7d71('0x36')]])){this[_0x7d71('0x15')][_0x4e003f[_0x7d71('0x36')]]=new Channel();this[_0x7d71('0x15')][_0x4e003f[_0x7d71('0x36')]][_0x7d71('0x4b')]=_0x4e003f[_0x7d71('0x55')]?moment()[_0x7d71('0x56')](moment['duration'](_0x4e003f[_0x7d71('0x55')])[_0x7d71('0x57')](),_0x7d71('0x57'))[_0x7d71('0x41')](_0x7d71('0x58')):moment()[_0x7d71('0x41')](_0x7d71('0x58'));this[_0x7d71('0x15')][_0x4e003f['uniqueid']][_0x7d71('0x59')]=_0x7d71('0xe');}_[_0x7d71('0x39')](this[_0x7d71('0x15')][_0x4e003f[_0x7d71('0x36')]],_[_0x7d71('0x3a')](_0x4e003f,_[_0x7d71('0x3b')](this[_0x7d71('0x15')][_0x4e003f[_0x7d71('0x36')]])));if(_[_0x7d71('0x5a')](applications,_0x4e003f[_0x7d71('0x50')])){this[_0x7d71('0x15')][_0x4e003f[_0x7d71('0x36')]][_0x7d71('0x5b')]=_0x4e003f['application'];this[_0x7d71('0x15')][_0x4e003f[_0x7d71('0x36')]][_0x7d71('0x5c')]=_0x4e003f['applicationdata'];if(_0x4e003f[_0x7d71('0x50')]===_0x7d71('0x8')&&_[_0x7d71('0x5d')](_0x4e003f['applicationdata']['toLowerCase'](),_0x7d71('0x5e'))){var _0x3f1e13=_0x4e003f['applicationdata'][_0x7d71('0x3c')]('=');var _0x3a82b6=_0x3f1e13[0x0][_0x7d71('0x53')]()[_0x7d71('0x5f')](/cdr\((.*)\)/);if(_0x3a82b6){if(_0x3a82b6[0x1]===_0x7d71('0x60')&&!_[_0x7d71('0x61')](this[_0x7d71('0x15')][_0x4e003f[_0x7d71('0x36')]][_0x3a82b6[0x1]]))return;this[_0x7d71('0x15')][_0x4e003f[_0x7d71('0x36')]][_0x3a82b6[0x1]]=_0x3f1e13[0x1];}}else if(_0x4e003f[_0x7d71('0x50')]===_0x7d71('0x9')){this['channels'][_0x4e003f[_0x7d71('0x36')]]['queue']=_0x4e003f[_0x7d71('0x51')]['split'](',')[0x0];}}}}}catch(_0x1b646a){logger[_0x7d71('0x2c')](_0x7d71('0x62'),_0x4e003f[_0x7d71('0x36')],util[_0x7d71('0x37')](_0x1b646a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7d71('0x2e')][_0x7d71('0x1e')]=function(_0x5a86cd){try{if(this[_0x7d71('0x31')](_0x5a86cd)){logger[_0x7d71('0x2a')](_0x7d71('0x63'),_0x5a86cd[_0x7d71('0x36')],_0x5a86cd['linkedid'],_0x5a86cd[_0x7d71('0x64')],_0x5a86cd['calleridnum']);logger['debug'](_0x7d71('0x65'),_0x5a86cd[_0x7d71('0x36')],util[_0x7d71('0x37')](_0x5a86cd,{'showHidden':![],'depth':null}));if(_0x5a86cd[_0x7d71('0x66')]!=='6')return;var _0x52deb8=this['agents'][_0x5a86cd['channel']['split']('-')[0x0]];if(_0x5a86cd[_0x7d71('0x36')]!==_0x5a86cd[_0x7d71('0x38')]){var _0x33629a=moment();if(this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x38')]]){if(!this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x38')]]['answered']){this[_0x7d71('0x15')][_0x5a86cd['linkedid']]['answered']=!![];this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x38')]][_0x7d71('0x67')]=_0x33629a['format'](_0x7d71('0x58'));if(this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x38')]][_0x7d71('0x4b')]){this['channels'][_0x5a86cd[_0x7d71('0x38')]][_0x7d71('0x68')]=_0x33629a[_0x7d71('0x69')](this['channels'][_0x5a86cd[_0x7d71('0x38')]]['starttime'],_0x7d71('0x57'));}}this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x38')]][_0x7d71('0x38')]=_0x5a86cd[_0x7d71('0x36')];if(_0x5a86cd['calleridnum']!==_0x7d71('0x6a')){this['channels'][_0x5a86cd[_0x7d71('0x38')]][_0x7d71('0x40')]=_0x5a86cd[_0x7d71('0x33')];}this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x38')]][_0x7d71('0x6b')]=_0x5a86cd[_0x7d71('0x64')];this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x38')]]['destinationchannel']=_0x5a86cd[_0x7d71('0x3e')];this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x38')]][_0x7d71('0x59')]=dispositions[_['toNumber'](_0x5a86cd[_0x7d71('0x66')])];if(_0x52deb8){this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x38')]][_0x7d71('0x6c')]=_0x52deb8['id'];this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x38')]][_0x7d71('0x6d')]=_0x52deb8[_0x7d71('0x43')];}}if(this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x36')]]){if(!this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x36')]]['answered']){this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x36')]][_0x7d71('0x6e')]=!![];this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x36')]]['answertime']=_0x33629a[_0x7d71('0x41')](_0x7d71('0x58'));if(this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x36')]][_0x7d71('0x4b')]){this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x36')]][_0x7d71('0x68')]=_0x33629a['diff'](this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x36')]][_0x7d71('0x4b')],_0x7d71('0x57'));}}if(_0x5a86cd[_0x7d71('0x33')]!==_0x7d71('0x6a')){this['channels'][_0x5a86cd[_0x7d71('0x36')]]['connectedlinenum']=_0x5a86cd['calleridnum'];}this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x36')]]['connectedlinename']=_0x5a86cd[_0x7d71('0x64')];this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x36')]][_0x7d71('0x6f')]=_0x5a86cd[_0x7d71('0x3e')];this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x36')]][_0x7d71('0x59')]=dispositions[_[_0x7d71('0x4c')](_0x5a86cd['channelstate'])];}}else{if(this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x36')]]){if(_0x52deb8){this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x36')]][_0x7d71('0x6c')]=_0x52deb8['id'];this[_0x7d71('0x15')][_0x5a86cd['uniqueid']]['membername']=_0x52deb8[_0x7d71('0x43')];}}}if(_0x5a86cd['context']===_0x7d71('0x4d')){if(_0x52deb8){_0x52deb8['destconnectedlinenum']=_0x5a86cd[_0x7d71('0x3d')];var _0x31fd14,_0x4bf114;if(this['channels'][_0x5a86cd[_0x7d71('0x36')]]){_0x31fd14=this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x36')]][_0x7d71('0x70')];_0x4bf114=this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x36')]][_0x7d71('0x9')];}else if(this['channels'][_0x5a86cd['linkedid']]){_0x31fd14=this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x38')]][_0x7d71('0x70')];_0x4bf114=this[_0x7d71('0x15')][_0x5a86cd[_0x7d71('0x38')]][_0x7d71('0x9')];}_0x52deb8[_0x7d71('0x9')]=_0x4bf114;_0x52deb8[_0x7d71('0x70')]=_0x31fd14;var _0x5555cc={'id':_0x52deb8['id'],'name':_0x52deb8[_0x7d71('0x43')],'agentconnected':!![],'destaccountcode':_0x52deb8[_0x7d71('0x45')],'destconnectedlinenum':_0x5a86cd['exten'],'queue':_0x4bf114||undefined,'routealias':_0x31fd14,'uniqueid':_0x5a86cd[_0x7d71('0x38')]};logger[_0x7d71('0x34')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x5a86cd[_0x7d71('0x36')],util['inspect'](_0x5555cc,{'showHidden':![],'depth':null}));this[_0x7d71('0x30')](util[_0x7d71('0x41')](_0x7d71('0x42'),_0x52deb8[_0x7d71('0x43')]),_0x7d71('0x44'),_0x5555cc);}}}}catch(_0x5209ef){logger[_0x7d71('0x2c')](_0x7d71('0x71'),_0x5a86cd[_0x7d71('0x36')],util[_0x7d71('0x37')](_0x5209ef,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0x5aef71,_0x205195){try{if(this[_0x7d71('0x15')][_0x5aef71]){logger['info']('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x5aef71,_0x205195);this[_0x7d71('0x15')][_0x5aef71][_0x7d71('0x72')]=!![];if(_[_0x7d71('0x73')](_0x205195,'.wav49')){_0x205195=_0x205195[_0x7d71('0x74')](_0x7d71('0x75'),_0x7d71('0x76'));}this[_0x7d71('0x15')][_0x5aef71][_0x7d71('0x77')]=_0x205195;var _0x124075=_[_0x7d71('0x78')](this[_0x7d71('0x15')][_0x5aef71][_0x7d71('0x79')],{'filename':_0x205195});if(_[_0x7d71('0x61')](_0x124075)){this[_0x7d71('0x15')][_0x5aef71][_0x7d71('0x79')][_0x7d71('0x7a')]({'filename':_0x205195,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x7d71('0x7b')});}}}catch(_0x503ad0){logger[_0x7d71('0x2c')]('[%s][voiceCallReport][mixMonitorFilename]',_0x5aef71,util[_0x7d71('0x37')](_0x503ad0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7d71('0x2e')]['syncVarSet']=function(_0x3b921a){try{if(this['isNotNull'](_0x3b921a)){logger[_0x7d71('0x34')]('[%s][voiceCallReport][varset]\x20event:',_0x3b921a[_0x7d71('0x36')],util[_0x7d71('0x37')](_0x3b921a,{'showHidden':![],'depth':null}));if(this[_0x7d71('0x15')][_0x3b921a[_0x7d71('0x36')]]&&_0x3b921a[_0x7d71('0x3e')]!=_0x7d71('0x48')){if(this[_0x7d71('0x31')](_0x3b921a['variable'])){if(this[_0x7d71('0x31')](_0x3b921a[_0x7d71('0x7c')][_0x7d71('0x7d')])){logger[_0x7d71('0x2a')](_0x7d71('0x7e'),_0x3b921a[_0x7d71('0x36')],_0x3b921a[_0x7d71('0x7f')]);this[_0x7d71('0x80')](_0x3b921a[_0x7d71('0x36')],_0x3b921a[_0x7d71('0x7f')]);}else if(this[_0x7d71('0x31')](_0x3b921a[_0x7d71('0x7c')][_0x7d71('0x81')])){logger[_0x7d71('0x2a')](_0x7d71('0x82'),_0x3b921a[_0x7d71('0x36')],_0x3b921a[_0x7d71('0x7f')]);this[_0x7d71('0x15')][_0x3b921a[_0x7d71('0x36')]]['calleridnum']=_0x3b921a[_0x7d71('0x7f')];}else if(this['isNotNull'](_0x3b921a[_0x7d71('0x7c')]['xmd-callerid'])){logger[_0x7d71('0x2a')](_0x7d71('0x83'),_0x3b921a[_0x7d71('0x36')],_0x3b921a[_0x7d71('0x7f')]);this['channels'][_0x3b921a[_0x7d71('0x36')]][_0x7d71('0x84')]=_0x3b921a[_0x7d71('0x7f')];}else if(this['isNotNull'](_0x3b921a[_0x7d71('0x7c')][_0x7d71('0x85')])){logger[_0x7d71('0x2a')](_0x7d71('0x86'),_0x3b921a[_0x7d71('0x36')],_0x3b921a[_0x7d71('0x7f')]);this[_0x7d71('0x15')][_0x3b921a[_0x7d71('0x36')]][_0x7d71('0x60')]=_0x3b921a['value'];}else if(this[_0x7d71('0x31')](_0x3b921a[_0x7d71('0x7c')][_0x7d71('0x87')])){logger[_0x7d71('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x3b921a['uniqueid'],_0x3b921a[_0x7d71('0x7f')][_0x7d71('0x3c')](',')[0x0]);this[_0x7d71('0x15')][_0x3b921a[_0x7d71('0x36')]][_0x7d71('0x9')]=_0x3b921a['value'][_0x7d71('0x3c')](',')[0x0];}else if(this[_0x7d71('0x31')](_0x3b921a[_0x7d71('0x7c')][_0x7d71('0x88')])){logger[_0x7d71('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x3b921a[_0x7d71('0x36')],_0x3b921a[_0x7d71('0x7f')]);this[_0x7d71('0x15')][_0x3b921a[_0x7d71('0x36')]][_0x7d71('0x89')]=_0x3b921a[_0x7d71('0x7f')];}else if(this[_0x7d71('0x31')](_0x3b921a[_0x7d71('0x7c')][_0x7d71('0x8a')])){logger[_0x7d71('0x2a')](_0x7d71('0x8b'),_0x3b921a[_0x7d71('0x36')],_0x3b921a[_0x7d71('0x7f')]);this[_0x7d71('0x15')][_0x3b921a[_0x7d71('0x36')]][_0x7d71('0x8c')]=_0x3b921a[_0x7d71('0x7f')];}else if(this[_0x7d71('0x31')](_0x3b921a['variable'][_0x7d71('0x8d')])){logger[_0x7d71('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x3b921a[_0x7d71('0x36')],_0x3b921a[_0x7d71('0x7f')]);this[_0x7d71('0x15')][_0x3b921a[_0x7d71('0x36')]]['calleridpreview']=_0x3b921a[_0x7d71('0x7f')];}else if(this[_0x7d71('0x31')](_0x3b921a[_0x7d71('0x7c')][_0x7d71('0x8e')])){logger[_0x7d71('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x3b921a[_0x7d71('0x36')],_0x3b921a[_0x7d71('0x7f')]);this[_0x7d71('0x15')][_0x3b921a['uniqueid']]['queue']=_0x3b921a[_0x7d71('0x7f')];}else if(this['isNotNull'](_0x3b921a[_0x7d71('0x7c')]['sipcallid'])){logger[_0x7d71('0x2a')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x3b921a['uniqueid'],_0x3b921a['value']);this[_0x7d71('0x15')][_0x3b921a[_0x7d71('0x36')]][_0x7d71('0x8f')]=_0x3b921a[_0x7d71('0x7f')];}}}else if(this['isNotNull'](_0x3b921a[_0x7d71('0x7c')][_0x7d71('0x7d')])){if(_0x3b921a[_0x7d71('0x7f')]){var _0x2e078b=path['parse'](_0x3b921a[_0x7d71('0x7f')])[_0x7d71('0x43')];logger[_0x7d71('0x2a')](_0x7d71('0x7e'),_0x2e078b,_0x3b921a[_0x7d71('0x7f')]);this[_0x7d71('0x80')](_0x2e078b,_0x3b921a['value']);}}else if(this[_0x7d71('0x15')][_0x3b921a[_0x7d71('0x38')]]){if(this[_0x7d71('0x31')](_0x3b921a[_0x7d71('0x7c')])){if(this['isNotNull'](_0x3b921a['variable'][_0x7d71('0x90')])){logger[_0x7d71('0x2a')](_0x7d71('0x91'),_0x3b921a[_0x7d71('0x38')],_0x3b921a['value']);this[_0x7d71('0x15')][_0x3b921a[_0x7d71('0x38')]][_0x7d71('0x92')]=_0x3b921a[_0x7d71('0x7f')];}}}}}catch(_0x4a443d){logger[_0x7d71('0x2c')](_0x7d71('0x93'),_0x3b921a[_0x7d71('0x36')],util[_0x7d71('0x37')](_0x4a443d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7d71('0x2e')][_0x7d71('0x21')]=function(_0x27dfa3){try{if(this['isNotNull'](_0x27dfa3)){logger[_0x7d71('0x34')](_0x7d71('0x94'),_0x27dfa3['uniqueid'],util[_0x7d71('0x37')](_0x27dfa3,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x27dfa3[_0x7d71('0x38')]]){if(this['channels'][this['blindTransfers'][_0x27dfa3[_0x7d71('0x38')]]['linkedid']]){this[_0x7d71('0x15')][this[_0x7d71('0x17')][_0x27dfa3[_0x7d71('0x38')]][_0x7d71('0x38')]][_0x7d71('0x36')]=_0x27dfa3[_0x7d71('0x36')];this['channels'][this[_0x7d71('0x17')][_0x27dfa3[_0x7d71('0x38')]]['linkedid']]['answered']=this[_0x7d71('0x15')][_0x27dfa3[_0x7d71('0x36')]][_0x7d71('0x6e')];this[_0x7d71('0x15')][this[_0x7d71('0x17')][_0x27dfa3[_0x7d71('0x38')]][_0x7d71('0x38')]]['answertime']=this[_0x7d71('0x15')][_0x27dfa3['uniqueid']][_0x7d71('0x67')];this[_0x7d71('0x15')][this[_0x7d71('0x17')][_0x27dfa3[_0x7d71('0x38')]][_0x7d71('0x38')]][_0x7d71('0x6f')]=this[_0x7d71('0x15')][this[_0x7d71('0x17')][_0x27dfa3[_0x7d71('0x38')]][_0x7d71('0x38')]][_0x7d71('0x3e')];this[_0x7d71('0x15')][this[_0x7d71('0x17')][_0x27dfa3['linkedid']][_0x7d71('0x38')]][_0x7d71('0x59')]=this[_0x7d71('0x15')][_0x27dfa3[_0x7d71('0x36')]]['disposition'];this[_0x7d71('0x15')][_0x27dfa3[_0x7d71('0x36')]]=this[_0x7d71('0x15')][this['blindTransfers'][_0x27dfa3[_0x7d71('0x38')]][_0x7d71('0x38')]];delete this[_0x7d71('0x15')][this[_0x7d71('0x17')][_0x27dfa3[_0x7d71('0x38')]][_0x7d71('0x38')]];}else if(this['channels'][this[_0x7d71('0x17')][_0x27dfa3['linkedid']][_0x7d71('0x36')]]){this[_0x7d71('0x15')][this['blindTransfers'][_0x27dfa3[_0x7d71('0x38')]]['uniqueid']][_0x7d71('0x36')]=[this['channels'][this['blindTransfers'][_0x27dfa3[_0x7d71('0x38')]][_0x7d71('0x36')]][_0x7d71('0x38')],this[_0x7d71('0x15')][this[_0x7d71('0x17')][_0x27dfa3[_0x7d71('0x38')]]['uniqueid']][_0x7d71('0x38')]=this[_0x7d71('0x15')][this[_0x7d71('0x17')][_0x27dfa3[_0x7d71('0x38')]][_0x7d71('0x36')]][_0x7d71('0x36')]][0x0];this[_0x7d71('0x15')][this[_0x7d71('0x17')][_0x27dfa3[_0x7d71('0x38')]][_0x7d71('0x36')]][_0x7d71('0x6e')]=this[_0x7d71('0x15')][_0x27dfa3[_0x7d71('0x36')]][_0x7d71('0x6e')];this['channels'][this[_0x7d71('0x17')][_0x27dfa3[_0x7d71('0x38')]][_0x7d71('0x36')]][_0x7d71('0x67')]=this[_0x7d71('0x15')][_0x27dfa3['uniqueid']][_0x7d71('0x67')];this[_0x7d71('0x15')][this['blindTransfers'][_0x27dfa3[_0x7d71('0x38')]]['uniqueid']]['destinationchannel']=this['channels'][this[_0x7d71('0x17')][_0x27dfa3['linkedid']][_0x7d71('0x36')]][_0x7d71('0x3e')];this[_0x7d71('0x15')][this[_0x7d71('0x17')][_0x27dfa3['linkedid']][_0x7d71('0x36')]]['disposition']=this[_0x7d71('0x15')][_0x27dfa3[_0x7d71('0x36')]]['disposition'];this['channels'][_0x27dfa3[_0x7d71('0x36')]]=this['channels'][this['blindTransfers'][_0x27dfa3[_0x7d71('0x38')]]['uniqueid']];delete this[_0x7d71('0x15')][this[_0x7d71('0x17')][_0x27dfa3['linkedid']]['uniqueid']];}}if(this[_0x7d71('0x15')][_0x27dfa3[_0x7d71('0x36')]]){logger[_0x7d71('0x2a')](_0x7d71('0x95'),_0x27dfa3[_0x7d71('0x36')],_0x27dfa3[_0x7d71('0x96')]);var _0x593891=moment();this['channels'][_0x27dfa3['uniqueid']][_0x7d71('0x97')]=_0x593891[_0x7d71('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7d71('0x15')][_0x27dfa3[_0x7d71('0x36')]]['duration']=_0x593891[_0x7d71('0x69')](this[_0x7d71('0x15')][_0x27dfa3[_0x7d71('0x36')]]['starttime'],'seconds');if(this[_0x7d71('0x15')][_0x27dfa3[_0x7d71('0x36')]][_0x7d71('0x6e')]){this[_0x7d71('0x15')][_0x27dfa3[_0x7d71('0x36')]][_0x7d71('0x98')]=_0x593891['diff'](this[_0x7d71('0x15')][_0x27dfa3[_0x7d71('0x36')]][_0x7d71('0x67')],_0x7d71('0x57'));this[_0x7d71('0x15')][_0x27dfa3[_0x7d71('0x36')]][_0x7d71('0x68')]=this['channels'][_0x27dfa3['uniqueid']]['duration']-this[_0x7d71('0x15')][_0x27dfa3[_0x7d71('0x36')]][_0x7d71('0x98')];}if(_0x27dfa3['context']==='from-sip'){if(this[_0x7d71('0x16')][_0x27dfa3['channel'][_0x7d71('0x3c')]('-')[0x0]]){this[_0x7d71('0x16')][_0x27dfa3['channel']['split']('-')[0x0]]=_[_0x7d71('0x99')](this[_0x7d71('0x16')][_0x27dfa3[_0x7d71('0x3e')][_0x7d71('0x3c')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0x7d71('0x9a'),_0x27dfa3[_0x7d71('0x36')],util[_0x7d71('0x37')]({'id':this[_0x7d71('0x16')][_0x27dfa3[_0x7d71('0x3e')][_0x7d71('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0x7d71('0x16')][_0x27dfa3['channel'][_0x7d71('0x3c')]('-')[0x0]][_0x7d71('0x45')]},{'showHidden':![],'depth':null}));this[_0x7d71('0x30')](util['format'](_0x7d71('0x42'),this[_0x7d71('0x16')][_0x27dfa3[_0x7d71('0x3e')][_0x7d71('0x3c')]('-')[0x0]][_0x7d71('0x43')]),'user:agentcomplete',{'id':this[_0x7d71('0x16')][_0x27dfa3[_0x7d71('0x3e')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x7d71('0x16')][_0x27dfa3[_0x7d71('0x3e')][_0x7d71('0x3c')]('-')[0x0]][_0x7d71('0x45')]});for(var _0x4cb1db=0x0;_0x4cb1db0x0?!![]:![];if(!_0x5d60e1){return this['syncQueueSummaryComplete'](this[_0xf9b7('0x15')][_0xf9b7('0x6c')]);}};VoiceQueueReport[_0xf9b7('0x45')][_0xf9b7('0x1b')]=function(_0xc6a46a){var _0x2b7511=this[_0xf9b7('0x15')]['id'];if(this[_0xf9b7('0x15')]['queuestatus'][_0x2b7511]&&this[_0xf9b7('0x15')][_0xf9b7('0x68')][_0x2b7511][_0xc6a46a[_0xf9b7('0x62')]]){this[_0xf9b7('0x15')][_0xf9b7('0x68')][_0x2b7511][_0xc6a46a[_0xf9b7('0x62')]]['agents'][_0xf9b7('0x6d')](_0xc6a46a);}};VoiceQueueReport[_0xf9b7('0x45')][_0xf9b7('0x16')]=function(_0x29e8c1){var _0xe7c467=this;try{if(this['isNotNull'](_0x29e8c1)&&this[_0xf9b7('0x5c')](_0x29e8c1['queue'])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0xf9b7('0x43')](_0x29e8c1,{'showHidden':![],'depth':null}));var _0x13589c=this['voiceQueues'][_0x29e8c1[_0xf9b7('0x4f')]];if(_0x13589c){logger['debug'](_0xf9b7('0x6e'),_0x13589c[_0xf9b7('0x5a')]);this['summary']['queues'][_0x13589c[_0xf9b7('0x5a')]]={'summaryEvent':_0x29e8c1};this[_0xf9b7('0x15')]['statusRequests']+=0x1;return ami['Action']({'action':_0xf9b7('0x68'),'queue':_0x13589c['name']})['then'](function(_0x2f6d56){if(!_0xe7c467['summary'][_0xf9b7('0x68')][_0x29e8c1[_0xf9b7('0x62')]]){_0xe7c467[_0xf9b7('0x15')]['queuestatus'][_0x29e8c1[_0xf9b7('0x62')]]={};}_0xe7c467[_0xf9b7('0x15')]['queuestatus'][_0x29e8c1[_0xf9b7('0x62')]][_0x2f6d56[_0xf9b7('0x62')]]={'queue':_0x13589c[_0xf9b7('0x5a')],'agents':[]};})[_0xf9b7('0x3e')](function(_0x32dfd5){throw _0x32dfd5;});}}}catch(_0x2360a0){logger[_0xf9b7('0x41')](_0xf9b7('0x6f'),util['inspect'](_0x2360a0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x149ca3){if(this[_0xf9b7('0x15')][_0xf9b7('0x6b')]>0x0){this['summary'][_0xf9b7('0x6c')]=_0x149ca3;return;}logger[_0xf9b7('0x4c')](_0xf9b7('0x70'),util[_0xf9b7('0x43')](_0x149ca3,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xf9b7('0x4a')](_0xf9b7('0x71'),{});};VoiceQueueReport[_0xf9b7('0x45')]['syncQueueCallerJoin']=function(_0x59027c){try{if(this[_0xf9b7('0x5c')](_0x59027c)){logger[_0xf9b7('0x4c')](_0xf9b7('0x72'),_0x59027c[_0xf9b7('0x53')],util[_0xf9b7('0x43')](_0x59027c,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xf9b7('0xf')][_0x59027c[_0xf9b7('0x53')]])){this[_0xf9b7('0xf')][_0x59027c[_0xf9b7('0x53')]]=[];}if(_[_0xf9b7('0x73')](this['channels'][_0x59027c[_0xf9b7('0x53')]])){this[_0xf9b7('0x3b')][_0x59027c['uniqueid']]={};}var _0x1da7c9=new QueueReport();_0x1da7c9[_0xf9b7('0x4f')]=_0x59027c['queue'];_0x1da7c9[_0xf9b7('0x58')]=this[_0xf9b7('0x13')][_0x1da7c9[_0xf9b7('0x4f')]]&&this[_0xf9b7('0x13')][_0x1da7c9[_0xf9b7('0x4f')]][_0xf9b7('0x58')]?this['voiceQueues'][_0x1da7c9[_0xf9b7('0x4f')]]['type']||'inbound':_0xf9b7('0x59');_0x1da7c9[_0xf9b7('0x74')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1da7c9[_0xf9b7('0x75')]=_0x59027c[_0xf9b7('0x75')];_0x1da7c9[_0xf9b7('0x76')]=_0x59027c[_0xf9b7('0x76')];_0x1da7c9[_0xf9b7('0x53')]=_0x59027c[_0xf9b7('0x53')];_0x1da7c9['routealias']=this['channels'][_0x59027c[_0xf9b7('0x53')]][_0xf9b7('0x77')];logger[_0xf9b7('0x78')](_0xf9b7('0x79'),_0x1da7c9['queue'],_0x1da7c9[_0xf9b7('0x58')]);Object['assign'](_0x1da7c9,_[_0xf9b7('0x7a')](_0x59027c,_['keys'](_0x1da7c9)));this['queueReports'][_0x59027c[_0xf9b7('0x53')]]['push'](_0x1da7c9);this[_0xf9b7('0x3b')][_0x59027c[_0xf9b7('0x53')]]=_0x1da7c9;this[_0xf9b7('0x4b')](_0x1da7c9,_0xf9b7('0x1e'));}}catch(_0x3f31e2){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x59027c[_0xf9b7('0x53')],util[_0xf9b7('0x43')](_0x3f31e2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9b7('0x45')][_0xf9b7('0x21')]=function(_0x41e20d){try{if(this[_0xf9b7('0x5c')](_0x41e20d)){logger[_0xf9b7('0x4c')](_0xf9b7('0x7b'),_0x41e20d[_0xf9b7('0x53')],util[_0xf9b7('0x43')](_0x41e20d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x41e20d[_0xf9b7('0x53')]]){var _0x27cf52=_[_0xf9b7('0x7c')](this[_0xf9b7('0xf')][_0x41e20d[_0xf9b7('0x53')]]);_0x27cf52[_0xf9b7('0x3a')]=![];_0x27cf52['queuecallercompleteAt']=null;_0x27cf52['holdtime']=_0x41e20d['holdtime'];_0x27cf52['originalposition']=_0x41e20d['originalposition'];_0x27cf52[_0xf9b7('0x20')]=!![];_0x27cf52[_0xf9b7('0x7d')]=moment()['format'](_0xf9b7('0x7e'));_0x27cf52['queuecallerexitreason']=_0xf9b7('0x7f');_0x27cf52[_0xf9b7('0x80')]=null;logger[_0xf9b7('0x78')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x27cf52[_0xf9b7('0x4f')],_0x27cf52[_0xf9b7('0x58')]);this[_0xf9b7('0x3b')][_0x41e20d[_0xf9b7('0x53')]]=_0x27cf52;this[_0xf9b7('0x48')](_0x27cf52,_0xf9b7('0x20'));}}}catch(_0x5586a2){logger['error'](_0xf9b7('0x7b'),_0x41e20d[_0xf9b7('0x53')],util[_0xf9b7('0x43')](_0x5586a2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x529b1d){try{if(this[_0xf9b7('0x5c')](_0x529b1d)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x529b1d['uniqueid'],util['inspect'](_0x529b1d,{'showHidden':![],'depth':null}));if(this[_0xf9b7('0xf')][_0x529b1d[_0xf9b7('0x53')]]){var _0x7c884f=_[_0xf9b7('0x7c')](this[_0xf9b7('0xf')][_0x529b1d[_0xf9b7('0x53')]]);_0x7c884f['queuecallerleaveAt']=moment()[_0xf9b7('0x54')](_0xf9b7('0x7e'));_0x7c884f[_0xf9b7('0x81')]=_0x529b1d[_0xf9b7('0x81')];_0x7c884f[_0xf9b7('0x82')]=_0x529b1d['connectedlinename'];logger['info'](_0xf9b7('0x83'),_0x7c884f['queue'],_0x7c884f[_0xf9b7('0x58')],_0x529b1d[_0xf9b7('0x81')],_0x529b1d[_0xf9b7('0x82')]);this[_0xf9b7('0x3b')][_0x529b1d['uniqueid']]=_0x7c884f;this['emitVoiceQueueChannelSave'](_0x7c884f,'queuecallerleave');}}}catch(_0x17c2a6){logger[_0xf9b7('0x41')](_0xf9b7('0x84'),_0x529b1d[_0xf9b7('0x53')],util[_0xf9b7('0x43')](_0x17c2a6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9b7('0x45')][_0xf9b7('0x24')]=function(_0x2917a9){try{if(this['isNotNull'](_0x2917a9)){logger[_0xf9b7('0x4c')](_0xf9b7('0x85'),_0x2917a9[_0xf9b7('0x53')],util[_0xf9b7('0x43')](_0x2917a9,{'showHidden':![],'depth':null}));if(this[_0xf9b7('0xf')][_0x2917a9['uniqueid']]){var _0x336987=_[_0xf9b7('0x7c')](this[_0xf9b7('0xf')][_0x2917a9['uniqueid']]);_0x336987[_0xf9b7('0x3a')]=!![];_0x336987[_0xf9b7('0x86')]=_0xf9b7('0x87');logger[_0xf9b7('0x78')](_0xf9b7('0x88'),_0x336987[_0xf9b7('0x4f')],_0x336987[_0xf9b7('0x58')]);}}}catch(_0x35cd1b){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x2917a9['uniqueid'],util[_0xf9b7('0x43')](_0x35cd1b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9b7('0x45')]['syncAgentComplete']=function(_0x4c99b7){try{if(this[_0xf9b7('0x5c')](_0x4c99b7)){logger[_0xf9b7('0x4c')]('[%s][voiceQueueReport][agentcomplete]',_0x4c99b7['uniqueid'],util[_0xf9b7('0x43')](_0x4c99b7,{'showHidden':![],'depth':null}));if(this[_0xf9b7('0xf')][_0x4c99b7[_0xf9b7('0x53')]]){var _0x125531=_[_0xf9b7('0x7c')](this['queueReports'][_0x4c99b7[_0xf9b7('0x53')]]);_0x125531['queuecallerabandon']=![];_0x125531[_0xf9b7('0x7d')]=null;_0x125531[_0xf9b7('0x89')]=!![];_0x125531[_0xf9b7('0x80')]=_0x4c99b7[_0xf9b7('0x8a')];_0x125531['holdtime']=_0x4c99b7['holdtime'];_0x125531[_0xf9b7('0x3a')]=!![];_0x125531[_0xf9b7('0x8b')]=![];_0x125531[_0xf9b7('0x8c')]=null;if(!_0x125531[_0xf9b7('0x8d')]){if(_0x4c99b7[_0xf9b7('0x8e')]==_0xf9b7('0x8d')){_0x125531[_0xf9b7('0x86')]='COMPLETED';logger[_0xf9b7('0x78')](_0xf9b7('0x8f'),_0x125531[_0xf9b7('0x4f')],_0x125531[_0xf9b7('0x58')]);}else{if(_[_0xf9b7('0x90')](_0x4c99b7['channel'][_0xf9b7('0x91')](),_0xf9b7('0x92'))){if(this[_0xf9b7('0xf')][_0x4c99b7[_0xf9b7('0x93')]]){var _0x574993=_[_0xf9b7('0x7c')](this[_0xf9b7('0xf')][_0x4c99b7[_0xf9b7('0x93')]]);_0x574993[_0xf9b7('0x3a')]=![];_0x574993['queuecallerexit']=!![];_0x574993['queuecallerexitAt']=moment(_0x125531[_0xf9b7('0x74')])['add'](_0x4c99b7['holdtime'],_0xf9b7('0x94'))[_0xf9b7('0x54')](_0xf9b7('0x7e'));_0x574993[_0xf9b7('0x86')]=_0xf9b7('0x95');_0x574993['transfer']=!![];_0x574993[_0xf9b7('0x96')]='FORWARD';_0x574993[_0xf9b7('0x97')]=_0x4c99b7[_0xf9b7('0x98')];_0x574993['transferuniqueid']=_0x4c99b7[_0xf9b7('0x53')];logger[_0xf9b7('0x78')](_0xf9b7('0x99'),_0x574993['queue'],_0x574993[_0xf9b7('0x58')]);var _0x4cbcff=this[_0xf9b7('0xf')][_0x4c99b7[_0xf9b7('0x93')]];this[_0xf9b7('0xf')][_0x4c99b7[_0xf9b7('0x93')]]=this[_0xf9b7('0xf')][_0x4c99b7['uniqueid']];this['queueReports'][_0x4c99b7['uniqueid']]=_0x4cbcff;}}else{_0x125531['queuecallerexitreason']='COMPLETEDBY'+_0x4c99b7[_0xf9b7('0x8e')][_0xf9b7('0x9a')]();logger[_0xf9b7('0x78')](_0xf9b7('0x9b'),_0x125531[_0xf9b7('0x4f')],_0x125531[_0xf9b7('0x58')],_0x125531[_0xf9b7('0x86')]);}}}this[_0xf9b7('0x3b')][_0x4c99b7['uniqueid']]=_0x125531;}}}catch(_0x1c58eb){logger['error'](_0xf9b7('0x9c'),_0x4c99b7[_0xf9b7('0x53')],util[_0xf9b7('0x43')](_0x1c58eb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9b7('0x45')][_0xf9b7('0x9d')]=function(_0x501885){try{if(this['isNotNull'](_0x501885)){logger[_0xf9b7('0x4c')](_0xf9b7('0x9e'),_0x501885['uniqueid'],util[_0xf9b7('0x43')](_0x501885,{'showHidden':![],'depth':null}));this[_0xf9b7('0x9f')](_0x501885[_0xf9b7('0x53')],_['keys'](_0x501885['variable'])[0x0],_0x501885[_0xf9b7('0xa0')]);if(this[_0xf9b7('0xf')][_0x501885[_0xf9b7('0x53')]]){var _0x536e37=_['last'](this[_0xf9b7('0xf')][_0x501885['uniqueid']]);if(_0x536e37){if(this[_0xf9b7('0x5c')](_0x501885['variable'])&&this['isNotNull'](_0x501885[_0xf9b7('0xa1')][_0xf9b7('0x68')])){switch(_0x501885[_0xf9b7('0xa0')]){case _0xf9b7('0xa2'):_0x536e37[_0xf9b7('0x8b')]=![];_0x536e37[_0xf9b7('0x8c')]=null;break;case _0xf9b7('0xa3'):_0x536e37[_0xf9b7('0xa4')]='timeout';_0x536e37['queuecallerexit']=!![];_0x536e37['queuecallerexitAt']=moment()[_0xf9b7('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x536e37[_0xf9b7('0xa5')]=moment()['format'](_0xf9b7('0x7e'));logger[_0xf9b7('0x4c')](_0xf9b7('0xa6'),_0x501885[_0xf9b7('0x53')],util[_0xf9b7('0x43')](_0x536e37,{'showHidden':![],'depth':null}));ami[_0xf9b7('0x4a')]('custom:timeout',_0x536e37);break;default:_0x536e37['queuecallerexit']=!![];_0x536e37[_0xf9b7('0x8c')]=moment()[_0xf9b7('0x54')](_0xf9b7('0x7e'));_0x536e37[_0xf9b7('0xa5')]=moment()[_0xf9b7('0x54')](_0xf9b7('0x7e'));}_0x536e37[_0xf9b7('0x20')]=![];_0x536e37['queuecallerabandonAt']=null;_0x536e37[_0xf9b7('0x86')]=_0x501885['value'];this[_0xf9b7('0x3b')][_0x501885['uniqueid']]=_0x536e37;this[_0xf9b7('0x48')](_0x536e37,'varset');}else if(this[_0xf9b7('0x5c')](_0x501885[_0xf9b7('0xa1')])&&this[_0xf9b7('0x5c')](_0x501885[_0xf9b7('0xa1')]['queueposition'])){if(!_0x536e37[_0xf9b7('0x20')]){_0x536e37['queuecallerexit']=!![];_0x536e37[_0xf9b7('0x8c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x536e37[_0xf9b7('0x86')]=_0xf9b7('0xa7');_0x536e37[_0xf9b7('0xa5')]=moment()[_0xf9b7('0x54')](_0xf9b7('0x7e'));this[_0xf9b7('0x3b')][_0x501885[_0xf9b7('0x53')]]=_0x536e37;}}logger['info'](_0xf9b7('0xa8'),_0x501885['uniqueid'],_0x536e37[_0xf9b7('0x4f')],_0x536e37['type'],_[_0xf9b7('0xa9')](_0x501885[_0xf9b7('0xa1')])[0x0],_0x501885[_0xf9b7('0xa0')]);_0x536e37[_0xf9b7('0x44')]=this[_0xf9b7('0x44')][_0x501885[_0xf9b7('0x53')]];}}}}catch(_0x4fca9e){logger[_0xf9b7('0x41')](_0xf9b7('0x9e'),_0x501885['uniqueid'],util['inspect'](_0x4fca9e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf9b7('0x45')][_0xf9b7('0x9f')]=function(_0x581bd3,_0x4f81cb,_0xd64df3){var _0x361ec1=[_0xf9b7('0xaa'),_0xf9b7('0xab'),_0xf9b7('0xac'),_0xf9b7('0xad'),_0xf9b7('0xae'),_0xf9b7('0xaf'),'rtpaudioqosrtt',_0xf9b7('0xb0'),_0xf9b7('0xb1'),_0xf9b7('0xb2'),_0xf9b7('0xb3'),_0xf9b7('0xb4'),_0xf9b7('0xb5'),_0xf9b7('0xb6'),'memberinterface',_0xf9b7('0xb7'),'membername',_0xf9b7('0xb8'),_0xf9b7('0xb9')];if(!_[_0xf9b7('0xba')](_0x4f81cb)&&!_[_0xf9b7('0xbb')](_0x361ec1,_0x4f81cb)){if(_[_0xf9b7('0x73')](this[_0xf9b7('0x44')][_0x581bd3])){this['variables'][_0x581bd3]={};}this[_0xf9b7('0x44')][_0x581bd3][_0x4f81cb]=_0xd64df3;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x5f199e,_0x5f12b1,_0x2959d8){var _0x30a5fe={};for(var _0x1dee2a=0x0;_0x1dee2a0x0?!![]:![];if(!_0x343ccc){return this[_0x84e8('0x1a')](this['summary'][_0x84e8('0x6d')]);}};VoiceQueueReport[_0x84e8('0xb')][_0x84e8('0x1b')]=function(_0x2a90a4){var _0x39d8b3=this['summary']['id'];if(this['summary'][_0x84e8('0x62')][_0x39d8b3]&&this[_0x84e8('0x14')][_0x84e8('0x62')][_0x39d8b3][_0x2a90a4[_0x84e8('0x60')]]){this[_0x84e8('0x14')][_0x84e8('0x62')][_0x39d8b3][_0x2a90a4['actionid']][_0x84e8('0xf')][_0x84e8('0x6e')](_0x2a90a4);}};VoiceQueueReport[_0x84e8('0xb')][_0x84e8('0x17')]=function(_0x5f1f1f){var _0x1d8d77=this;try{if(this[_0x84e8('0x5c')](_0x5f1f1f)&&this[_0x84e8('0x5c')](_0x5f1f1f[_0x84e8('0x51')])){logger[_0x84e8('0x54')](_0x84e8('0x6f'),util[_0x84e8('0x45')](_0x5f1f1f,{'showHidden':![],'depth':null}));var _0x53de5e=this[_0x84e8('0x12')][_0x5f1f1f['queue']];if(_0x53de5e){logger[_0x84e8('0x54')](_0x84e8('0x70'),_0x53de5e['name']);this[_0x84e8('0x14')][_0x84e8('0x5d')][_0x53de5e[_0x84e8('0x5a')]]={'summaryEvent':_0x5f1f1f};this[_0x84e8('0x14')]['statusRequests']+=0x1;return ami['Action']({'action':'queuestatus','queue':_0x53de5e[_0x84e8('0x5a')]})['then'](function(_0x162388){if(!_0x1d8d77[_0x84e8('0x14')][_0x84e8('0x62')][_0x5f1f1f[_0x84e8('0x60')]]){_0x1d8d77[_0x84e8('0x14')][_0x84e8('0x62')][_0x5f1f1f[_0x84e8('0x60')]]={};}_0x1d8d77[_0x84e8('0x14')][_0x84e8('0x62')][_0x5f1f1f[_0x84e8('0x60')]][_0x162388['actionid']]={'queue':_0x53de5e[_0x84e8('0x5a')],'agents':[]};})[_0x84e8('0x40')](function(_0x5ad166){throw _0x5ad166;});}}}catch(_0x57c0df){logger[_0x84e8('0x43')](_0x84e8('0x71'),util[_0x84e8('0x45')](_0x57c0df,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x84e8('0xb')][_0x84e8('0x1a')]=function(_0xac430c){if(this[_0x84e8('0x14')][_0x84e8('0x6c')]>0x0){this[_0x84e8('0x14')][_0x84e8('0x6d')]=_0xac430c;return;}logger['debug'](_0x84e8('0x72'),util[_0x84e8('0x45')](_0xac430c,{'showHidden':![],'depth':null}));this[_0x84e8('0x14')]=initializeSummary();ami[_0x84e8('0x4b')](_0x84e8('0x73'),{});};VoiceQueueReport[_0x84e8('0xb')][_0x84e8('0x1f')]=function(_0x17f488){try{if(this['isNotNull'](_0x17f488)){logger[_0x84e8('0x54')]('[%s][voiceQueueReport][queuecallerjoin]',_0x17f488[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x17f488,{'showHidden':![],'depth':null}));if(_[_0x84e8('0x74')](this[_0x84e8('0x46')][_0x17f488['uniqueid']])){this[_0x84e8('0x46')][_0x17f488[_0x84e8('0x4e')]]=[];}if(_['isUndefined'](this[_0x84e8('0x10')][_0x17f488['uniqueid']])){this['channels'][_0x17f488[_0x84e8('0x4e')]]={};}var _0xd8429c=new QueueReport();_0xd8429c[_0x84e8('0x51')]=_0x17f488[_0x84e8('0x51')];_0xd8429c[_0x84e8('0x6a')]=this['voiceQueues'][_0xd8429c[_0x84e8('0x51')]]&&this[_0x84e8('0x12')][_0xd8429c[_0x84e8('0x51')]]['type']?this[_0x84e8('0x12')][_0xd8429c[_0x84e8('0x51')]]['type']||_0x84e8('0x59'):_0x84e8('0x59');_0xd8429c[_0x84e8('0x75')]=moment()[_0x84e8('0x4f')](_0x84e8('0x76'));_0xd8429c['position']=_0x17f488[_0x84e8('0x77')];_0xd8429c[_0x84e8('0x78')]=_0x17f488[_0x84e8('0x78')];_0xd8429c[_0x84e8('0x4e')]=_0x17f488[_0x84e8('0x4e')];_0xd8429c[_0x84e8('0x79')]=this[_0x84e8('0x10')][_0x17f488[_0x84e8('0x4e')]][_0x84e8('0x79')];logger[_0x84e8('0x7a')](_0x84e8('0x7b'),_0xd8429c[_0x84e8('0x51')],_0xd8429c[_0x84e8('0x6a')]);Object[_0x84e8('0x69')](_0xd8429c,_[_0x84e8('0x7c')](_0x17f488,_[_0x84e8('0x7d')](_0xd8429c)));this[_0x84e8('0x46')][_0x17f488[_0x84e8('0x4e')]][_0x84e8('0x6e')](_0xd8429c);this[_0x84e8('0x10')][_0x17f488[_0x84e8('0x4e')]]=_0xd8429c;this['emitVoiceQueueChannelSave'](_0xd8429c,_0x84e8('0x1e'));}}catch(_0x1f030f){logger[_0x84e8('0x43')](_0x84e8('0x7e'),_0x17f488[_0x84e8('0x4e')],util['inspect'](_0x1f030f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x84e8('0xb')][_0x84e8('0x21')]=function(_0x2c14be){try{if(this[_0x84e8('0x5c')](_0x2c14be)){logger[_0x84e8('0x54')](_0x84e8('0x7f'),_0x2c14be[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x2c14be,{'showHidden':![],'depth':null}));if(this[_0x84e8('0x46')][_0x2c14be[_0x84e8('0x4e')]]){var _0x568726=_[_0x84e8('0x80')](this['queueReports'][_0x2c14be[_0x84e8('0x4e')]]);_0x568726[_0x84e8('0x39')]=![];_0x568726[_0x84e8('0x81')]=null;_0x568726[_0x84e8('0x82')]=_0x2c14be[_0x84e8('0x82')];_0x568726[_0x84e8('0x83')]=_0x2c14be[_0x84e8('0x83')];_0x568726[_0x84e8('0x20')]=!![];_0x568726[_0x84e8('0x84')]=moment()[_0x84e8('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x568726[_0x84e8('0x56')]=_0x84e8('0x85');_0x568726[_0x84e8('0x86')]=null;logger[_0x84e8('0x7a')](_0x84e8('0x87'),_0x568726[_0x84e8('0x51')],_0x568726[_0x84e8('0x6a')]);this[_0x84e8('0x10')][_0x2c14be[_0x84e8('0x4e')]]=_0x568726;this[_0x84e8('0x49')](_0x568726,_0x84e8('0x20'));}}}catch(_0x4cde98){logger['error'](_0x84e8('0x7f'),_0x2c14be['uniqueid'],util['inspect'](_0x4cde98,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x84e8('0x23')]=function(_0x38d5d8){try{if(this[_0x84e8('0x5c')](_0x38d5d8)){logger[_0x84e8('0x54')]('[%s][voiceQueueReport][queuecallerleave]',_0x38d5d8[_0x84e8('0x4e')],util['inspect'](_0x38d5d8,{'showHidden':![],'depth':null}));if(this[_0x84e8('0x46')][_0x38d5d8['uniqueid']]){var _0x1d75c3=_['last'](this[_0x84e8('0x46')][_0x38d5d8[_0x84e8('0x4e')]]);_0x1d75c3[_0x84e8('0x88')]=moment()[_0x84e8('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d75c3['connectedlinenum']=_0x38d5d8[_0x84e8('0x89')];_0x1d75c3[_0x84e8('0x8a')]=_0x38d5d8[_0x84e8('0x8a')];logger[_0x84e8('0x7a')](_0x84e8('0x8b'),_0x1d75c3[_0x84e8('0x51')],_0x1d75c3['type'],_0x38d5d8[_0x84e8('0x89')],_0x38d5d8['connectedlinename']);this['channels'][_0x38d5d8['uniqueid']]=_0x1d75c3;this['emitVoiceQueueChannelSave'](_0x1d75c3,_0x84e8('0x22'));}}}catch(_0x384f51){logger[_0x84e8('0x43')](_0x84e8('0x8c'),_0x38d5d8[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x384f51,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x84e8('0x8d')]=function(_0x33dbbb){try{if(this[_0x84e8('0x5c')](_0x33dbbb)){logger[_0x84e8('0x54')]('[%s][voiceQueueReport][agentconnect]',_0x33dbbb['uniqueid'],util[_0x84e8('0x45')](_0x33dbbb,{'showHidden':![],'depth':null}));if(this[_0x84e8('0x46')][_0x33dbbb[_0x84e8('0x4e')]]){var _0x1ac939=_[_0x84e8('0x80')](this[_0x84e8('0x46')][_0x33dbbb[_0x84e8('0x4e')]]);_0x1ac939[_0x84e8('0x39')]=!![];_0x1ac939[_0x84e8('0x56')]=_0x84e8('0x8e');logger[_0x84e8('0x7a')](_0x84e8('0x8f'),_0x1ac939[_0x84e8('0x51')],_0x1ac939[_0x84e8('0x6a')]);}}}catch(_0x227801){logger[_0x84e8('0x43')]('[%s][voiceQueueReport][agentconnect]',_0x33dbbb['uniqueid'],util[_0x84e8('0x45')](_0x227801,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x84e8('0xb')][_0x84e8('0x24')]=function(_0x509442){try{if(this['isNotNull'](_0x509442)){logger['debug'](_0x84e8('0x90'),_0x509442[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x509442,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x509442[_0x84e8('0x4e')]]){var _0x36dddf=_['last'](this[_0x84e8('0x46')][_0x509442[_0x84e8('0x4e')]]);_0x36dddf[_0x84e8('0x20')]=![];_0x36dddf['queuecallerabandonAt']=null;_0x36dddf[_0x84e8('0x91')]=!![];_0x36dddf[_0x84e8('0x86')]=_0x509442['membername'];_0x36dddf[_0x84e8('0x82')]=_0x509442[_0x84e8('0x82')];_0x36dddf[_0x84e8('0x39')]=!![];_0x36dddf['queuecallerexit']=![];_0x36dddf[_0x84e8('0x92')]=null;if(!_0x36dddf[_0x84e8('0x93')]){if(_0x509442[_0x84e8('0x94')]=='transfer'){_0x36dddf[_0x84e8('0x56')]=_0x84e8('0x95');logger[_0x84e8('0x7a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x36dddf[_0x84e8('0x51')],_0x36dddf[_0x84e8('0x6a')]);}else{if(_[_0x84e8('0x96')](_0x509442[_0x84e8('0x3f')][_0x84e8('0x97')](),_0x84e8('0x98'))){if(this[_0x84e8('0x46')][_0x509442[_0x84e8('0x99')]]){var _0x362bb8=_['last'](this['queueReports'][_0x509442['linkedid']]);_0x362bb8['queuecallercomplete']=![];_0x362bb8['queuecallerexit']=!![];_0x362bb8[_0x84e8('0x92')]=moment(_0x36dddf[_0x84e8('0x75')])['add'](_0x509442[_0x84e8('0x82')],'seconds')[_0x84e8('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x362bb8['queuecallerexitreason']='FORWARDTRANSFER';_0x362bb8['transfer']=!![];_0x362bb8[_0x84e8('0x9a')]=_0x84e8('0x9b');_0x362bb8[_0x84e8('0x9c')]=_0x509442['destexten'];_0x362bb8['transferuniqueid']=_0x509442['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x362bb8[_0x84e8('0x51')],_0x362bb8['type']);var _0x4c9d01=this[_0x84e8('0x46')][_0x509442[_0x84e8('0x99')]];this[_0x84e8('0x46')][_0x509442['linkedid']]=this[_0x84e8('0x46')][_0x509442[_0x84e8('0x4e')]];this['queueReports'][_0x509442[_0x84e8('0x4e')]]=_0x4c9d01;}}else{_0x36dddf['queuecallerexitreason']='COMPLETEDBY'+_0x509442[_0x84e8('0x94')][_0x84e8('0x9d')]();logger['info'](_0x84e8('0x9e'),_0x36dddf[_0x84e8('0x51')],_0x36dddf[_0x84e8('0x6a')],_0x36dddf['queuecallerexitreason']);}}}this[_0x84e8('0x10')][_0x509442[_0x84e8('0x4e')]]=_0x36dddf;}}}catch(_0x207578){logger[_0x84e8('0x43')](_0x84e8('0x90'),_0x509442[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x207578,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x84e8('0xb')][_0x84e8('0x27')]=function(_0x4cf8a2){try{if(this[_0x84e8('0x5c')](_0x4cf8a2)){logger['debug'](_0x84e8('0x9f'),_0x4cf8a2[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x4cf8a2,{'showHidden':![],'depth':null}));this['addVariable'](_0x4cf8a2[_0x84e8('0x4e')],_[_0x84e8('0x7d')](_0x4cf8a2[_0x84e8('0xa0')])[0x0],_0x4cf8a2[_0x84e8('0xa1')]);if(this['queueReports'][_0x4cf8a2[_0x84e8('0x4e')]]){var _0x2dc783=_[_0x84e8('0x80')](this['queueReports'][_0x4cf8a2[_0x84e8('0x4e')]]);if(_0x2dc783){if(this[_0x84e8('0x5c')](_0x4cf8a2[_0x84e8('0xa0')])&&this[_0x84e8('0x5c')](_0x4cf8a2[_0x84e8('0xa0')][_0x84e8('0x62')])){switch(_0x4cf8a2[_0x84e8('0xa1')]){case _0x84e8('0xa2'):_0x2dc783[_0x84e8('0x38')]=![];_0x2dc783['queuecallerexitAt']=null;break;case'TIMEOUT':_0x2dc783['lastevent']=_0x84e8('0xa3');_0x2dc783[_0x84e8('0x38')]=!![];_0x2dc783[_0x84e8('0x92')]=moment()[_0x84e8('0x4f')](_0x84e8('0x76'));_0x2dc783['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x84e8('0x54')](_0x84e8('0xa4'),_0x4cf8a2[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x2dc783,{'showHidden':![],'depth':null}));ami[_0x84e8('0x4b')](_0x84e8('0xa5'),_0x2dc783);break;default:_0x2dc783[_0x84e8('0x38')]=!![];_0x2dc783[_0x84e8('0x92')]=moment()[_0x84e8('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2dc783[_0x84e8('0x88')]=moment()[_0x84e8('0x4f')](_0x84e8('0x76'));}_0x2dc783[_0x84e8('0x20')]=![];_0x2dc783[_0x84e8('0x84')]=null;_0x2dc783['queuecallerexitreason']=_0x4cf8a2[_0x84e8('0xa1')];this['channels'][_0x4cf8a2['uniqueid']]=_0x2dc783;this[_0x84e8('0x49')](_0x2dc783,_0x84e8('0x26'));}else if(this[_0x84e8('0x5c')](_0x4cf8a2['variable'])&&this[_0x84e8('0x5c')](_0x4cf8a2[_0x84e8('0xa0')][_0x84e8('0xa6')])){if(!_0x2dc783['queuecallerabandon']){_0x2dc783[_0x84e8('0x38')]=!![];_0x2dc783[_0x84e8('0x92')]=moment()[_0x84e8('0x4f')](_0x84e8('0x76'));_0x2dc783[_0x84e8('0x56')]=_0x84e8('0xa7');_0x2dc783[_0x84e8('0x88')]=moment()[_0x84e8('0x4f')](_0x84e8('0x76'));this[_0x84e8('0x10')][_0x4cf8a2[_0x84e8('0x4e')]]=_0x2dc783;}}logger['info'](_0x84e8('0xa8'),_0x4cf8a2[_0x84e8('0x4e')],_0x2dc783['queue'],_0x2dc783['type'],_[_0x84e8('0x7d')](_0x4cf8a2[_0x84e8('0xa0')])[0x0],_0x4cf8a2['value']);_0x2dc783['variables']=this[_0x84e8('0x15')][_0x4cf8a2['uniqueid']];}}}}catch(_0x1ac699){logger[_0x84e8('0x43')]('[%s][voiceQueueReport][varset]',_0x4cf8a2[_0x84e8('0x4e')],util[_0x84e8('0x45')](_0x1ac699,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x84e8('0xa9')]=function(_0x1255ac,_0x44775f,_0x3d690f){var _0x2f2d2a=['rtpaudioqos',_0x84e8('0xaa'),_0x84e8('0xab'),_0x84e8('0xac'),_0x84e8('0xad'),_0x84e8('0xae'),_0x84e8('0xaf'),_0x84e8('0xb0'),'sipcallid','sipuri',_0x84e8('0xb1'),'bridgepvtcallid',_0x84e8('0xb2'),_0x84e8('0xb3'),'memberinterface','memberlastcall',_0x84e8('0xb4'),_0x84e8('0xb5'),'memberrealtime'];if(!_[_0x84e8('0x3c')](_0x44775f)&&!_[_0x84e8('0xb6')](_0x2f2d2a,_0x44775f)){if(_[_0x84e8('0x74')](this[_0x84e8('0x15')][_0x1255ac])){this[_0x84e8('0x15')][_0x1255ac]={};}this[_0x84e8('0x15')][_0x1255ac][_0x44775f]=_0x3d690f;}};VoiceQueueReport[_0x84e8('0xb')]['handleHangup']=function(_0x575d9f,_0x161cd2,_0x214da7){var _0xe37c26={};for(var _0x592a61=0x0;_0x592a61=0x0?moment(_0x534189[_0xf4b3('0x18')])[_0xf4b3('0xc')](_0x534189[_0xf4b3('0x17')],'seconds'):null,'data1':_0xf4b3('0x19'),'data2':_0x534189[_0xf4b3('0x12')],'data3':_0x534189[_0xf4b3('0xf')],'data4':_0x534189[_0xf4b3('0x1a')]||null,'role':'agent','internal':_0x534189[_0xf4b3('0x12')]?_[_0xf4b3('0x13')](_0x534189['accountcode']):undefined,'uniqueid':_0x534189['uniqueid']},'log':_0xf4b3('0x5')});}; \ No newline at end of file +var _0x7cf5=['seconds','outbound','exten','dialstring','agent','uniqueid','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','CreateMemberReport','voice','isNil','interface','SIP/%s','lastAssignedTo','queuecallerleaveAt','diff','queue','accountcode','toNumber','Request','membername','TALKING','starttime','endtime'];(function(_0x8b7d35,_0x2b94ee){var _0x3f2f86=function(_0x534fce){while(--_0x534fce){_0x8b7d35['push'](_0x8b7d35['shift']());}};_0x3f2f86(++_0x2b94ee);}(_0x7cf5,0x180));var _0x57cf=function(_0xcb9913,_0x57b73d){_0xcb9913=_0xcb9913-0x0;var _0x743ea5=_0x7cf5[_0xcb9913];return _0x743ea5;};'use strict';var moment=require(_0x57cf('0x0'));var _=require(_0x57cf('0x1'));var util=require(_0x57cf('0x2'));var client=require('../client');exports[_0x57cf('0x3')]=function(_0x4c42af){var _0x330c0a=_0x4c42af[_0x57cf('0x4')]||_0x4c42af['queuecallerexitAt'];return client['Request'](_0x57cf('0x5'),{'body':{'channel':_0x57cf('0x6'),'membername':_0x4c42af['lastAssignedTo'],'interface':_[_0x57cf('0x7')](_0x4c42af[_0x57cf('0x8')])?util['format'](_0x57cf('0x9'),_0x4c42af[_0x57cf('0xa')]):_0x4c42af['interface'],'type':'TALKING','enterAt':_0x4c42af[_0x57cf('0xb')],'exitAt':_0x330c0a,'duration':moment(_0x330c0a)[_0x57cf('0xc')](_0x4c42af['queuecallerleaveAt'],'seconds'),'data1':'inbound','data2':_0x4c42af['calleridnum'],'data3':_0x4c42af['exten'],'data4':null,'data5':_0x4c42af[_0x57cf('0xd')],'role':'agent','internal':_0x4c42af[_0x57cf('0xe')]?_[_0x57cf('0xf')](_0x4c42af[_0x57cf('0xe')]):undefined,'uniqueid':_0x4c42af['uniqueid']},'log':_0x57cf('0x5')});};exports['voiceDialReport']=function(_0x4de954){return client[_0x57cf('0x10')](_0x57cf('0x5'),{'body':{'channel':_0x57cf('0x6'),'membername':_0x4de954[_0x57cf('0x11')],'interface':_0x4de954['interface'],'type':_0x57cf('0x12'),'enterAt':_0x4de954[_0x57cf('0x13')],'exitAt':_0x4de954['endtime'],'duration':moment(_0x4de954[_0x57cf('0x14')])[_0x57cf('0xc')](_0x4de954[_0x57cf('0x13')],_0x57cf('0x15'))>=0x0?moment(_0x4de954[_0x57cf('0x14')])[_0x57cf('0xc')](_0x4de954[_0x57cf('0x13')],_0x57cf('0x15')):null,'data1':_0x57cf('0x16'),'data2':_0x4de954['accountcode'],'data3':_0x4de954[_0x57cf('0x17')],'data4':_0x4de954[_0x57cf('0x18')]||null,'role':_0x57cf('0x19'),'internal':_0x4de954['accountcode']?_[_0x57cf('0xf')](_0x4de954[_0x57cf('0xe')]):undefined,'uniqueid':_0x4de954[_0x57cf('0x1a')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 156b6ac..78178db 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 _0x7fee=['stopRecordingOnTransfer','previewRecallmeReminderInterval','../client','getSettings','Request','ShowSetting'];(function(_0x203fb9,_0x3060cc){var _0xb7edbb=function(_0x4dc1c1){while(--_0x4dc1c1){_0x203fb9['push'](_0x203fb9['shift']());}};_0xb7edbb(++_0x3060cc);}(_0x7fee,0x1a6));var _0xe7fe=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x7fee[_0x5f0089];return _0x193892;};'use strict';var client=require(_0xe7fe('0x0'));exports[_0xe7fe('0x1')]=function(){return client[_0xe7fe('0x2')](_0xe7fe('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe7fe('0x4'),_0xe7fe('0x5')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x9f95=['GetSettings','../client','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x4d3964,_0x101871){var _0x114207=function(_0x3f7145){while(--_0x3f7145){_0x4d3964['push'](_0x4d3964['shift']());}};_0x114207(++_0x101871);}(_0x9f95,0x97));var _0x59f9=function(_0x1dfb4f,_0x550be0){_0x1dfb4f=_0x1dfb4f-0x0;var _0x547b48=_0x9f95[_0x1dfb4f];return _0x547b48;};'use strict';var client=require(_0x59f9('0x0'));exports['getSettings']=function(){return client[_0x59f9('0x1')](_0x59f9('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x59f9('0x3'),_0x59f9('0x4')]},'log':_0x59f9('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 93e71b0..f859c96 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 _0xf9fd=['Request','html','GetTemplate','getTemplates'];(function(_0x212e9e,_0x4fd979){var _0x1f9b14=function(_0x2074e9){while(--_0x2074e9){_0x212e9e['push'](_0x212e9e['shift']());}};_0x1f9b14(++_0x4fd979);}(_0xf9fd,0x14f));var _0xdf9f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf9fd[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0xdf9f('0x0')]=function(_0x3e0a46){return function(_0x3ddfcf){return client[_0xdf9f('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0xdf9f('0x2')]},'log':_0xdf9f('0x3')});};}; \ No newline at end of file +var _0x5867=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x1e8f43,_0x326be9){var _0x267aaa=function(_0x9d95b6){while(--_0x9d95b6){_0x1e8f43['push'](_0x1e8f43['shift']());}};_0x267aaa(++_0x326be9);}(_0x5867,0x1e2));var _0x7586=function(_0x3f116e,_0x1e0387){_0x3f116e=_0x3f116e-0x0;var _0x15c8cb=_0x5867[_0x3f116e];return _0x15c8cb;};'use strict';var client=require(_0x7586('0x0'));exports[_0x7586('0x1')]=function(_0x183971){return function(_0x16e94b){return client[_0x7586('0x2')](_0x7586('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7586('0x4'),_0x7586('0x5')]},'log':_0x7586('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 7da488e..9175ee5 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 _0xb124=['AnyConditions','operator','Action','Actions','action','data1','data2','data5','data6','GetTrigger','../client','Request','name','channel','status','Condition','AllConditions','field','value'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xb124,0x13a));var _0x4b12=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xb124[_0x4e9628];return _0x27bc8c;};'use strict';var client=require(_0x4b12('0x0'));exports['getTriggers']=function(_0x274e4c){return function(_0x243a4b){return client[_0x4b12('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x4b12('0x2'),_0x4b12('0x3'),_0x4b12('0x4')],'include':[{'model':_0x4b12('0x5'),'as':_0x4b12('0x6'),'attributes':['id',_0x4b12('0x7'),'operator',_0x4b12('0x8')]},{'model':_0x4b12('0x5'),'as':_0x4b12('0x9'),'attributes':['id',_0x4b12('0x7'),_0x4b12('0xa'),_0x4b12('0x8')]},{'model':_0x4b12('0xb'),'as':_0x4b12('0xc'),'attributes':['id',_0x4b12('0xd'),_0x4b12('0xe'),_0x4b12('0xf'),'data3','data4',_0x4b12('0x10'),_0x4b12('0x11'),'data7']}]},'log':_0x4b12('0x12')});};}; \ No newline at end of file +var _0x7dfb=['name','channel','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','data1','data2','data3','data6','../client','Request'];(function(_0x461b1c,_0x36df75){var _0x15bef1=function(_0x2d702d){while(--_0x2d702d){_0x461b1c['push'](_0x461b1c['shift']());}};_0x15bef1(++_0x36df75);}(_0x7dfb,0xce));var _0xb7df=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x7dfb[_0x2b7764];return _0x848dcb;};'use strict';var client=require(_0xb7df('0x0'));exports['getTriggers']=function(_0x55f217){return function(_0x13d910){return client[_0xb7df('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xb7df('0x2'),_0xb7df('0x3'),'status'],'include':[{'model':_0xb7df('0x4'),'as':_0xb7df('0x5'),'attributes':['id',_0xb7df('0x6'),_0xb7df('0x7'),_0xb7df('0x8')]},{'model':'Condition','as':_0xb7df('0x9'),'attributes':['id',_0xb7df('0x6'),_0xb7df('0x7'),_0xb7df('0x8')]},{'model':_0xb7df('0xa'),'as':_0xb7df('0xb'),'attributes':['id','action',_0xb7df('0xc'),_0xb7df('0xd'),_0xb7df('0xe'),'data4','data5',_0xb7df('0xf'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index ec91fc8..e6c0c1f 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 _0x368a=['GetTrunk','name','registry','defaultuser','../client','getTrunks'];(function(_0x3187ef,_0x2c5c93){var _0x2d7073=function(_0x4af076){while(--_0x4af076){_0x3187ef['push'](_0x3187ef['shift']());}};_0x2d7073(++_0x2c5c93);}(_0x368a,0x1b4));var _0xa368=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x368a[_0x2be8c2];return _0x97f531;};'use strict';var client=require(_0xa368('0x0'));exports[_0xa368('0x1')]=function(_0x578c76){return function(_0x3281eb){return client['Request'](_0xa368('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa368('0x3'),_0xa368('0x4'),_0xa368('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x23ea=['getTrunks','Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x41e25d,_0x13330d){var _0x504a53=function(_0x453db3){while(--_0x453db3){_0x41e25d['push'](_0x41e25d['shift']());}};_0x504a53(++_0x13330d);}(_0x23ea,0xc3));var _0xa23e=function(_0x230e39,_0x5341){_0x230e39=_0x230e39-0x0;var _0xa804e=_0x23ea[_0x230e39];return _0xa804e;};'use strict';var client=require(_0xa23e('0x0'));exports[_0xa23e('0x1')]=function(_0xe039e){return function(_0x5ce01b){return client[_0xa23e('0x2')](_0xa23e('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa23e('0x4'),_0xa23e('0x5'),_0xa23e('0x6')]},'log':_0xa23e('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index c41ec19..0f09002 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x18ca47,_0x2f265b){var _0x388a3e=function(_0xb42259){while(--_0xb42259){_0x18ca47['push'](_0x18ca47['shift']());}};_0x388a3e(++_0x2f265b);}(_0xedd9,0xfc));var _0x9edd=function(_0x5628b8,_0x145582){_0x5628b8=_0x5628b8-0x0;var _0x3ce423=_0xedd9[_0x5628b8];return _0x3ce423;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x3c350a,_0x248c57){var _0x27b834=function(_0x584de4){while(--_0x584de4){_0x3c350a['push'](_0x3c350a['shift']());}};_0x27b834(++_0x248c57);}(_0xedd9,0xfc));var _0x9edd=function(_0x4fafd8,_0x2b2696){_0x4fafd8=_0x4fafd8-0x0;var _0x57fe38=_0xedd9[_0x4fafd8];return _0x57fe38;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 1574de5..5c896a4 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 _0x9529=['create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x5649fc,_0x49ce8c){var _0x5299b1=function(_0x14583b){while(--_0x14583b){_0x5649fc['push'](_0x5649fc['shift']());}};_0x5299b1(++_0x49ce8c);}(_0x9529,0x167));var _0x9952=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9529[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x9952('0x0'));exports[_0x9952('0x1')]=function(_0x3ab19a){return client[_0x9952('0x2')](_0x9952('0x3'),{'body':_0x3ab19a,'log':_0x9952('0x3')});};exports['update']=function(_0x42482f,_0xe99022,_0x409eb9){return client[_0x9952('0x2')](_0x9952('0x4'),{'body':_0x42482f,'options':{'where':{'uniqueid':_0xe99022,'interface':_0x409eb9,'agentcomplete':!![]}},'log':_0x9952('0x4')});}; \ No newline at end of file +var _0xdaba=['UpdateVoiceAgentReport','../client','create','Request'];(function(_0x496bf7,_0xf6f25e){var _0x51f31d=function(_0x3ac735){while(--_0x3ac735){_0x496bf7['push'](_0x496bf7['shift']());}};_0x51f31d(++_0xf6f25e);}(_0xdaba,0x19d));var _0xadab=function(_0x49f48f,_0x5a1fcf){_0x49f48f=_0x49f48f-0x0;var _0x2a738f=_0xdaba[_0x49f48f];return _0x2a738f;};'use strict';var client=require(_0xadab('0x0'));exports[_0xadab('0x1')]=function(_0x10cd89){return client[_0xadab('0x2')]('CreateVoiceAgentReport',{'body':_0x10cd89,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x5873b8,_0x306eff,_0x26133a){return client[_0xadab('0x2')]('UpdateVoiceAgentReport',{'body':_0x5873b8,'options':{'where':{'uniqueid':_0x306eff,'interface':_0x26133a,'agentcomplete':!![]}},'log':_0xadab('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 501fa21..b9a6818 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 _0x658d=['calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','moment','util','../client','create','CreateVoiceCallReport','merge'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x658d,0xb7));var _0xd658=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x658d[_0x3ab51d];return _0x29a04e;};'use strict';var moment=require(_0xd658('0x0'));var util=require(_0xd658('0x1'));var _=require('lodash');var client=require(_0xd658('0x2'));exports[_0xd658('0x3')]=function(_0x43d16e){return client['Request'](_0xd658('0x4'),{'body':_[_0xd658('0x5')](_0x43d16e,{'source':_0x43d16e[_0xd658('0x6')],'destinationcontext':_0x43d16e[_0xd658('0x7')],'callerid':_0x43d16e[_0xd658('0x8')],'amaflags':_0xd658('0x9')}),'log':_0xd658('0x4')});};exports[_0xd658('0xa')]=function(){return function(){return client[_0xd658('0xb')](_0xd658('0xc'),{'options':{'where':{'type':[_0xd658('0xd')],'createdAt':{'$between':[moment()['startOf'](_0xd658('0xe'))[_0xd658('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xd658('0x10')](_0xd658('0xe'))['format'](_0xd658('0x11'))]}},'attributes':[_0xd658('0x12'),_0xd658('0x13'),_0xd658('0x14'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xf8bb=['CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','startOf','format','day','YYYY-MM-DD\x20HH:mm:ss','disposition','GetVoiceCallReports','moment','util','lodash','../client','create','Request'];(function(_0x394ab3,_0xd303d3){var _0x41ae0c=function(_0x3de1ba){while(--_0x3de1ba){_0x394ab3['push'](_0x394ab3['shift']());}};_0x41ae0c(++_0xd303d3);}(_0xf8bb,0x117));var _0xbf8b=function(_0x178f90,_0x459475){_0x178f90=_0x178f90-0x0;var _0x7c4ed4=_0xf8bb[_0x178f90];return _0x7c4ed4;};'use strict';var moment=require(_0xbf8b('0x0'));var util=require(_0xbf8b('0x1'));var _=require(_0xbf8b('0x2'));var client=require(_0xbf8b('0x3'));exports[_0xbf8b('0x4')]=function(_0xbd7322){return client[_0xbf8b('0x5')](_0xbf8b('0x6'),{'body':_[_0xbf8b('0x7')](_0xbd7322,{'source':_0xbd7322[_0xbf8b('0x8')],'destinationcontext':_0xbd7322[_0xbf8b('0x9')],'callerid':_0xbd7322[_0xbf8b('0xa')],'amaflags':'DOCUMENTATION'}),'log':_0xbf8b('0x6')});};exports[_0xbf8b('0xb')]=function(){return function(){return client[_0xbf8b('0x5')](_0xbf8b('0xc'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xbf8b('0xd')]('day')[_0xbf8b('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xbf8b('0xf'))[_0xbf8b('0xe')](_0xbf8b('0x10'))]}},'attributes':['type',_0xbf8b('0x11'),'duration','billableseconds']},'log':_0xbf8b('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8893987..d6b9051 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 _0x7b77=['CreateVoiceDialReport','../client','create','Request'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x7b77,0x69));var _0x77b7=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0x7b77[_0x429948];return _0x35d5d1;};'use strict';var client=require(_0x77b7('0x0'));exports[_0x77b7('0x1')]=function(_0xef1faf){return client[_0x77b7('0x2')](_0x77b7('0x3'),{'body':_0xef1faf,'log':_0x77b7('0x3')});}; \ No newline at end of file +var _0x87c7=['../client','Request','CreateVoiceDialReport'];(function(_0x18d225,_0x57831e){var _0xade03c=function(_0x4b7eae){while(--_0x4b7eae){_0x18d225['push'](_0x18d225['shift']());}};_0xade03c(++_0x57831e);}(_0x87c7,0x162));var _0x787c=function(_0x18dd30,_0x32adf0){_0x18dd30=_0x18dd30-0x0;var _0x978d59=_0x87c7[_0x18dd30];return _0x978d59;};'use strict';var client=require(_0x787c('0x0'));exports['create']=function(_0x3e57ba){return client[_0x787c('0x1')](_0x787c('0x2'),{'body':_0x3e57ba,'log':_0x787c('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ae651c7..4f71bfc 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 _0xdace=['exten','getVoiceExtensions','../client','Request','GetVoiceExtension'];(function(_0x48e49a,_0x37a906){var _0x5f4dcd=function(_0x5d14c6){while(--_0x5d14c6){_0x48e49a['push'](_0x48e49a['shift']());}};_0x5f4dcd(++_0x37a906);}(_0xdace,0xc5));var _0xedac=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xdace[_0xaa0309];return _0x5de7ce;};'use strict';var client=require(_0xedac('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xedac('0x1')](_0xedac('0x2'),{'options':{'raw':!![],'attributes':['id',_0xedac('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xedac('0x4')});};}; \ No newline at end of file +var _0x153f=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x50c42c,_0x141ffe){var _0x1608f4=function(_0x4104c7){while(--_0x4104c7){_0x50c42c['push'](_0x50c42c['shift']());}};_0x1608f4(++_0x141ffe);}(_0x153f,0x15b));var _0xf153=function(_0x3466b8,_0x269581){_0x3466b8=_0x3466b8-0x0;var _0x4f80c9=_0x153f[_0x3466b8];return _0x4f80c9;};'use strict';var client=require(_0xf153('0x0'));exports[_0xf153('0x1')]=function(){return function(){return client[_0xf153('0x2')](_0xf153('0x3'),{'options':{'raw':!![],'attributes':['id',_0xf153('0x4'),_0xf153('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xf153('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 42cf727..d0aa6c3 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 _0x9a8b=['autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout'];(function(_0xb83c08,_0x3bdcf6){var _0x2f064a=function(_0x3c7b34){while(--_0x3c7b34){_0xb83c08['push'](_0xb83c08['shift']());}};_0x2f064a(++_0x3bdcf6);}(_0x9a8b,0xb7));var _0xb9a8=function(_0x26de0d,_0xd38717){_0x26de0d=_0x26de0d-0x0;var _0x496a21=_0x9a8b[_0x26de0d];return _0x496a21;};'use strict';var client=require(_0xb9a8('0x0'));exports[_0xb9a8('0x1')]=function(){return function(){return client[_0xb9a8('0x2')](_0xb9a8('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xb9a8('0x4'),_0xb9a8('0x5'),_0xb9a8('0x6'),_0xb9a8('0x7'),_0xb9a8('0x8'),_0xb9a8('0x9'),_0xb9a8('0xa'),'dialLimitChannel',_0xb9a8('0xb'),_0xb9a8('0xc'),_0xb9a8('0xd'),_0xb9a8('0xe'),_0xb9a8('0xf'),_0xb9a8('0x10'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0xb9a8('0x11'),'dialQueueTimeout',_0xb9a8('0x12'),_0xb9a8('0x13'),'dialCongestionRetryFrequency',_0xb9a8('0x14'),_0xb9a8('0x15'),_0xb9a8('0x16'),_0xb9a8('0x17'),'dialGlobalMaxRetry',_0xb9a8('0x18'),'dialGlobalInterval',_0xb9a8('0x19'),_0xb9a8('0x1a'),_0xb9a8('0x1b'),_0xb9a8('0x1c'),_0xb9a8('0x1d'),_0xb9a8('0x1e'),_0xb9a8('0x1f'),'dialAMDMinWordLength',_0xb9a8('0x20'),'dialAMDMaximumNumberOfWords',_0xb9a8('0x21'),_0xb9a8('0x22'),'timeout',_0xb9a8('0x23'),_0xb9a8('0x24'),_0xb9a8('0x25'),_0xb9a8('0x26'),_0xb9a8('0x27'),'dialQueueProject2',_0xb9a8('0x7'),_0xb9a8('0x28'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0xb9a8('0x29'),_0xb9a8('0x2a'),_0xb9a8('0x2b'),_0xb9a8('0x2c'),_0xb9a8('0x2d'),_0xb9a8('0x2e'),'dialMachineMaxRetry',_0xb9a8('0x2f'),_0xb9a8('0x30'),_0xb9a8('0x31'),_0xb9a8('0x32'),_0xb9a8('0x33'),_0xb9a8('0x34'),_0xb9a8('0x35'),_0xb9a8('0x36')],'include':[{'model':_0xb9a8('0x37'),'as':_0xb9a8('0x37'),'attributes':['id',_0xb9a8('0x38'),'callerid',_0xb9a8('0x39')]},{'model':_0xb9a8('0x3a'),'as':_0xb9a8('0x3b'),'attributes':['id','name']},{'model':_0xb9a8('0x37'),'as':_0xb9a8('0x3c'),'attributes':['id','name','callerid','active']},{'model':'Interval','as':_0xb9a8('0x3d'),'attributes':['id','name'],'include':[{'model':_0xb9a8('0x3d'),'as':_0xb9a8('0x3e'),'attributes':['id',_0xb9a8('0x38'),'interval']}]}]},'log':_0xb9a8('0x1')});};}; \ No newline at end of file +var _0x91a2=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry'];(function(_0x4fd045,_0x15e4a5){var _0x5f5aa6=function(_0x5ac61b){while(--_0x5ac61b){_0x4fd045['push'](_0x4fd045['shift']());}};_0x5f5aa6(++_0x15e4a5);}(_0x91a2,0x1b4));var _0x291a=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x91a2[_0x10004e];return _0x5af990;};'use strict';var client=require(_0x291a('0x0'));exports[_0x291a('0x1')]=function(){return function(){return client[_0x291a('0x2')](_0x291a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x291a('0x4'),_0x291a('0x5'),_0x291a('0x6'),_0x291a('0x7'),_0x291a('0x8'),'dialActive',_0x291a('0x9'),_0x291a('0xa'),_0x291a('0xb'),_0x291a('0xc'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x291a('0xd'),_0x291a('0xe'),_0x291a('0xf'),_0x291a('0x10'),_0x291a('0x11'),'dialQueueProject',_0x291a('0x12'),'dialCongestionRetryFrequency',_0x291a('0x13'),_0x291a('0x14'),_0x291a('0x15'),_0x291a('0x16'),_0x291a('0x17'),_0x291a('0x18'),_0x291a('0x19'),_0x291a('0x1a'),'dialCheckDuplicateType',_0x291a('0x1b'),_0x291a('0x1c'),_0x291a('0x1d'),_0x291a('0x1e'),_0x291a('0x1f'),_0x291a('0x20'),_0x291a('0x21'),_0x291a('0x22'),_0x291a('0x23'),'dialAMDMaximumWordLength','timeout',_0x291a('0x24'),_0x291a('0x25'),_0x291a('0x26'),_0x291a('0x27'),_0x291a('0x28'),_0x291a('0x29'),_0x291a('0x7'),'strategy',_0x291a('0x2a'),_0x291a('0x2b'),_0x291a('0x2c'),'dialNoSuchNumberRetryFrequency',_0x291a('0x2d'),_0x291a('0x2e'),_0x291a('0x2f'),_0x291a('0x30'),_0x291a('0x31'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x291a('0x32'),_0x291a('0x33'),_0x291a('0x34'),_0x291a('0x35'),_0x291a('0x36')],'include':[{'model':_0x291a('0x37'),'as':'Trunk','attributes':['id',_0x291a('0x38'),_0x291a('0x39'),_0x291a('0x3a')]},{'model':_0x291a('0x3b'),'as':_0x291a('0x3c'),'attributes':['id',_0x291a('0x38')]},{'model':_0x291a('0x37'),'as':_0x291a('0x3d'),'attributes':['id',_0x291a('0x38'),'callerid',_0x291a('0x3a')]},{'model':_0x291a('0x3e'),'as':'Interval','attributes':['id',_0x291a('0x38')],'include':[{'model':_0x291a('0x3e'),'as':_0x291a('0x3f'),'attributes':['id',_0x291a('0x38'),_0x291a('0x40')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d29efd5..898482b 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(_0x221332,_0x26bc38){var _0x2476f8=function(_0x42c302){while(--_0x42c302){_0x221332['push'](_0x221332['shift']());}};_0x2476f8(++_0x26bc38);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x4177d6,_0x153f3a){var _0x11b9b6=function(_0x31733c){while(--_0x31733c){_0x4177d6['push'](_0x4177d6['shift']());}};_0x11b9b6(++_0x153f3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 00db145..0a4615c 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 _0xb636=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x448291,_0x5aec82){var _0x2eb294=function(_0x24a5d6){while(--_0x24a5d6){_0x448291['push'](_0x448291['shift']());}};_0x2eb294(++_0x5aec82);}(_0xb636,0x14b));var _0x6b63=function(_0x25fda2,_0x3ea365){_0x25fda2=_0x25fda2-0x0;var _0x56e62c=_0xb636[_0x25fda2];return _0x56e62c;};'use strict';var client=require(_0x6b63('0x0'));exports[_0x6b63('0x1')]=function(_0x1f8be7){return function(){return client[_0x6b63('0x2')](_0x6b63('0x3'),{'options':{'where':{'VoiceQueueId':_0x1f8be7,'paused':!![]},'raw':!![]},'log':_0x6b63('0x1')});};}; \ No newline at end of file +var _0x7289=['GetVoiceQueueRtPauses','Request'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7289,0x147));var _0x9728=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7289[_0x1ac595];return _0x455fff;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x8b7d78){return function(){return client[_0x9728('0x0')](_0x9728('0x1'),{'options':{'where':{'VoiceQueueId':_0x8b7d78,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 147d2b3..b592ff5 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(_0x50a255,_0x47e73f){var _0x2bea17=function(_0x1ed033){while(--_0x1ed033){_0x50a255['push'](_0x50a255['shift']());}};_0x2bea17(++_0x47e73f);}(_0x7a54,0x106));var _0x47a5=function(_0x1b016b,_0x9d0111){_0x1b016b=_0x1b016b-0x0;var _0x54854e=_0x7a54[_0x1b016b];return _0x54854e;};'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(_0x5632a7,_0x38cc10){var _0x2e2ff0=function(_0x11ffd5){while(--_0x11ffd5){_0x5632a7['push'](_0x5632a7['shift']());}};_0x2e2ff0(++_0x38cc10);}(_0x7a54,0x106));var _0x47a5=function(_0x21efe0,_0x489823){_0x21efe0=_0x21efe0-0x0;var _0x5db7d8=_0x7a54[_0x21efe0];return _0x5db7d8;};'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 7179582..e1a660f 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 _0xfd4b=['CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','../client','transfers','blindTransfer','Request'];(function(_0x195050,_0x17a3a2){var _0x54406d=function(_0x2dc9a2){while(--_0x2dc9a2){_0x195050['push'](_0x195050['shift']());}};_0x54406d(++_0x17a3a2);}(_0xfd4b,0xf2));var _0xbfd4=function(_0x2e0f34,_0x108ee8){_0x2e0f34=_0x2e0f34-0x0;var _0x4be12e=_0xfd4b[_0x2e0f34];return _0x4be12e;};'use strict';var client=require(_0xbfd4('0x0'));exports[_0xbfd4('0x1')]={};exports[_0xbfd4('0x2')]=function(_0xe79c6f){return client[_0xbfd4('0x3')](_0xbfd4('0x4'),{'body':{'result':_0xe79c6f[_0xbfd4('0x5')],'transfererchannel':_0xe79c6f[_0xbfd4('0x6')],'transferercalleridnum':_0xe79c6f[_0xbfd4('0x7')],'transferercalleridname':_0xe79c6f[_0xbfd4('0x8')],'transfererconnectedlinenum':_0xe79c6f[_0xbfd4('0x9')],'transfererconnectedlinename':_0xe79c6f[_0xbfd4('0xa')],'transfereraccountcode':_0xe79c6f['transfereraccountcode'],'transferercontext':_0xe79c6f[_0xbfd4('0xb')],'transfererexten':_0xe79c6f[_0xbfd4('0xc')],'transfererlinkedid':_0xe79c6f[_0xbfd4('0xd')],'transfereechannel':_0xe79c6f['transfereechannel'],'transfereecalleridnum':_0xe79c6f[_0xbfd4('0xe')],'transfereecalleridname':_0xe79c6f[_0xbfd4('0xf')],'transfereeconnectedlinenum':_0xe79c6f[_0xbfd4('0x10')],'transfereeconnectedlinename':_0xe79c6f[_0xbfd4('0x11')],'transfereeaccountcode':_0xe79c6f['transfereeaccountcode'],'transfereecontext':_0xe79c6f[_0xbfd4('0x12')],'transfereeexten':_0xe79c6f[_0xbfd4('0x13')],'transfereelinkedid':_0xe79c6f[_0xbfd4('0x14')],'isexternal':_0xe79c6f[_0xbfd4('0x15')],'context':_0xe79c6f[_0xbfd4('0x16')],'extension':_0xe79c6f[_0xbfd4('0x17')],'type':_0xbfd4('0x18')},'log':_0xbfd4('0x4')});};exports[_0xbfd4('0x19')]=function(_0x2f690f){return client[_0xbfd4('0x3')](_0xbfd4('0x4'),{'body':{'result':_0x2f690f[_0xbfd4('0x5')],'transfererchannel':_0x2f690f[_0xbfd4('0x1a')],'transferercalleridnum':_0x2f690f[_0xbfd4('0x1b')],'transferercalleridname':_0x2f690f[_0xbfd4('0x1c')],'transfererconnectedlinenum':_0x2f690f[_0xbfd4('0x1d')],'transfererconnectedlinename':_0x2f690f['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2f690f[_0xbfd4('0x1e')],'transferercontext':_0x2f690f[_0xbfd4('0x1f')],'transfererexten':_0x2f690f[_0xbfd4('0x20')],'transfererlinkedid':_0x2f690f[_0xbfd4('0x21')],'transfereechannel':_0x2f690f[_0xbfd4('0x22')],'transfereecalleridnum':_0x2f690f[_0xbfd4('0x23')],'transfereecalleridname':_0x2f690f[_0xbfd4('0x24')],'transfereeconnectedlinenum':_0x2f690f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2f690f[_0xbfd4('0x25')],'transfereeaccountcode':_0x2f690f[_0xbfd4('0x26')],'transfereecontext':_0x2f690f[_0xbfd4('0x27')],'transfereeexten':_0x2f690f[_0xbfd4('0x28')],'transfereelinkedid':_0x2f690f['transfertargetlinkedid'],'isexternal':_0x2f690f['isexternal'],'context':_0x2f690f['origtransferercontext'],'extension':_0x2f690f['origtransfererexten'],'type':'attended'},'log':_0xbfd4('0x4')});}; \ No newline at end of file +var _0x8f70=['transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','attended','../client','blindTransfer','Request','result','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename'];(function(_0x548205,_0x5b811b){var _0x292d1e=function(_0x16c94b){while(--_0x16c94b){_0x548205['push'](_0x548205['shift']());}};_0x292d1e(++_0x5b811b);}(_0x8f70,0xb2));var _0x08f7=function(_0x581227,_0x3a1055){_0x581227=_0x581227-0x0;var _0xd2932d=_0x8f70[_0x581227];return _0xd2932d;};'use strict';var client=require(_0x08f7('0x0'));exports['transfers']={};exports[_0x08f7('0x1')]=function(_0x82b1fe){return client[_0x08f7('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x82b1fe[_0x08f7('0x3')],'transfererchannel':_0x82b1fe['transfererchannel'],'transferercalleridnum':_0x82b1fe[_0x08f7('0x4')],'transferercalleridname':_0x82b1fe['transferercalleridname'],'transfererconnectedlinenum':_0x82b1fe[_0x08f7('0x5')],'transfererconnectedlinename':_0x82b1fe[_0x08f7('0x6')],'transfereraccountcode':_0x82b1fe[_0x08f7('0x7')],'transferercontext':_0x82b1fe[_0x08f7('0x8')],'transfererexten':_0x82b1fe[_0x08f7('0x9')],'transfererlinkedid':_0x82b1fe[_0x08f7('0xa')],'transfereechannel':_0x82b1fe[_0x08f7('0xb')],'transfereecalleridnum':_0x82b1fe[_0x08f7('0xc')],'transfereecalleridname':_0x82b1fe[_0x08f7('0xd')],'transfereeconnectedlinenum':_0x82b1fe[_0x08f7('0xe')],'transfereeconnectedlinename':_0x82b1fe[_0x08f7('0xf')],'transfereeaccountcode':_0x82b1fe[_0x08f7('0x10')],'transfereecontext':_0x82b1fe[_0x08f7('0x11')],'transfereeexten':_0x82b1fe['transfereeexten'],'transfereelinkedid':_0x82b1fe['transfereelinkedid'],'isexternal':_0x82b1fe['isexternal'],'context':_0x82b1fe[_0x08f7('0x12')],'extension':_0x82b1fe[_0x08f7('0x13')],'type':_0x08f7('0x14')},'log':_0x08f7('0x15')});};exports[_0x08f7('0x16')]=function(_0x3bf559){return client[_0x08f7('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x3bf559[_0x08f7('0x3')],'transfererchannel':_0x3bf559[_0x08f7('0x17')],'transferercalleridnum':_0x3bf559[_0x08f7('0x18')],'transferercalleridname':_0x3bf559[_0x08f7('0x19')],'transfererconnectedlinenum':_0x3bf559[_0x08f7('0x1a')],'transfererconnectedlinename':_0x3bf559[_0x08f7('0x1b')],'transfereraccountcode':_0x3bf559[_0x08f7('0x1c')],'transferercontext':_0x3bf559['secondtransferercontext'],'transfererexten':_0x3bf559['secondtransfererexten'],'transfererlinkedid':_0x3bf559[_0x08f7('0x1d')],'transfereechannel':_0x3bf559[_0x08f7('0x1e')],'transfereecalleridnum':_0x3bf559['transfertargetcalleridnum'],'transfereecalleridname':_0x3bf559['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3bf559['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3bf559['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3bf559[_0x08f7('0x1f')],'transfereecontext':_0x3bf559[_0x08f7('0x20')],'transfereeexten':_0x3bf559['transfertargetexten'],'transfereelinkedid':_0x3bf559[_0x08f7('0x21')],'isexternal':_0x3bf559[_0x08f7('0x22')],'context':_0x3bf559[_0x08f7('0x23')],'extension':_0x3bf559['origtransfererexten'],'type':_0x08f7('0x24')},'log':_0x08f7('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index ec8da24..817a04b 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 _0x9957=['content','error','voiceQueues','hasOwnProperty','push','find','undefined','channels','length','voicechannel','uniqueid','format','%s.%s','MixMonitor','channel','monitors','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','destinationchannel','stop','/var/spool/asterisk/monitor/','values','queueChannels','inbound','includes','type','count','rows','voicequeuechannel','Hangup','voicequeuechannelredirect','exten','context','telephones','outboundChannels','outbound','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','ami\x20disconnected','join','pick','keys','reload','action','Action','then','message','catch','isConnected','command','Command'];(function(_0x509bf4,_0x2131f9){var _0x2c6c4d=function(_0x45678f){while(--_0x45678f){_0x509bf4['push'](_0x509bf4['shift']());}};_0x2c6c4d(++_0x2131f9);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var jayson=require(_0x7995('0x2'));var schema=require(_0x7995('0x3'));var moment=require('moment');var config=require(_0x7995('0x4'));var properties=require(_0x7995('0x5'));var ami=require(_0x7995('0x6'));var VoiceQueueSummary=require(_0x7995('0x7'));exports['listen']=function(_0x744bea,_0x1a36d8,_0x137b6b){return new Promise(function(_0x219534,_0xbda126){var _0x326741={'QueuePause':function(_0x4996ca){return new Promise(function(_0x465276){var _0x1cad37=util['format'](_0x7995('0x8'),_0x7995('0x9'),_0x4996ca[_0x7995('0xa')]);if(_0x744bea[_0x7995('0xb')]&&_0x744bea[_0x7995('0xb')][_0x1cad37]&&_0x744bea[_0x7995('0xb')][_0x1cad37][_0x7995('0xc')]){_0x744bea['timers'][_0x1cad37][_0x7995('0xd')]();}if(_0x744bea[_0x7995('0xe')][_0x1cad37]){_0x744bea['agents'][_0x1cad37][_0x7995('0xf')]({'statePause':_0x4996ca[_0x7995('0x10')]?!![]:![]});}_0x465276({'code':0xc8,'message':_0x7995('0x11')});});},'Reload':function(_0x385f00){var _0x281576=this;return new Promise(function(_0x23999f,_0x2bbe7a){if(ami['isConnected']()==![]){return _0x2bbe7a(_0x281576['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config[_0x7995('0x12')][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}_0x385f00=_[_0x7995('0x16')](_0x385f00,_[_0x7995('0x17')](properties[_0x7995('0x18')]['module']));_0x385f00[_0x7995('0x19')]='Reload';return ami[_0x7995('0x1a')](_0x385f00)[_0x7995('0x1b')](function(_0x43d4b8){_0x23999f({'code':0xc8,'message':_0x43d4b8[_0x7995('0x1c')]});})[_0x7995('0x1d')](function(_0x37a7d4){_0x2bbe7a(_0x281576['error'](0x1f5,_0x37a7d4['message']));});});},'Command':function(_0x2536c8){var _0x5e6f90=this;return new Promise(function(_0x555f74,_0x3ec178){if(ami[_0x7995('0x1e')]()==![]){return _0x3ec178(_0x5e6f90['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config['asterisk']['username'],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}_0x2536c8=_[_0x7995('0x16')](_0x2536c8,_0x7995('0x1f'));_0x2536c8[_0x7995('0x19')]=_0x7995('0x20');return ami['Action'](_0x2536c8)[_0x7995('0x1b')](function(_0x46ee4b){_0x555f74({'code':0xc8,'message':_0x46ee4b[_0x7995('0x21')]});})[_0x7995('0x1d')](function(_0x563799){_0x3ec178(_0x5e6f90[_0x7995('0x22')](0x1f5,_0x563799[_0x7995('0x1c')]));});});},'VoiceQueues':function(){return new Promise(function(_0x472195){var _0x59405a=[];for(var _0x39df42 in _0x744bea[_0x7995('0x23')]){if(_0x744bea[_0x7995('0x23')][_0x7995('0x24')](_0x39df42)){var _0x3a3fcf=_0x744bea[_0x7995('0x23')][_0x39df42];var _0x56691a=new VoiceQueueSummary(_0x3a3fcf);_0x59405a[_0x7995('0x25')](_0x56691a);}}_0x472195({'count':_0x59405a['length'],'rows':_0x59405a});});},'UpdateVoiceQueue':function(_0x229742){return new Promise(function(_0x49bc7e,_0xf16cc2){var _0x132a42=_[_0x7995('0x26')](_0x744bea['voiceQueues'],{'id':parseInt(_0x229742['id'])});var _0x9b2a15=_['omit'](_0x229742,['id']);if(_0x132a42){for(var _0x456a28 in _0x9b2a15){if(typeof _0x9b2a15[_0x456a28]!==_0x7995('0x27')&&typeof _0x132a42[_0x456a28]!==_0x7995('0x27')){_0x132a42[_0x456a28]=_0x9b2a15[_0x456a28];}}_0x49bc7e(_0x132a42);}else{_0xf16cc2();}});},'VoiceChannels':function(){return new Promise(function(_0x574574){var _0x530611=_['values'](_0x744bea[_0x7995('0x28')]);_0x574574({'count':_0x530611[_0x7995('0x29')],'rows':_0x530611});});},'VoiceChannelMixMonitor':function(_0x327a81){var _0x2b874d=this;return new Promise(function(_0x2e3493,_0x1ca460){if(ami['isConnected']()==![]){return _0x1ca460(_0x2b874d['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config['asterisk'][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}var _0x1e9fa4=schema(properties[_0x7995('0x2a')])['validate'](_0x327a81);if(_0x1e9fa4[_0x7995('0x29')]>0x0){return _0x1ca460(_0x2b874d[_0x7995('0x22')](0x1f4,_['map'](_0x1e9fa4,'message')['join'](',\x20')));}var _0x45bc5e=_[_0x7995('0x26')](_0x744bea['channels'],{'uniqueid':_0x327a81[_0x7995('0x2b')]});if(_0x45bc5e&&_0x45bc5e['channel']){var _0x37917b=util[_0x7995('0x2c')](_0x7995('0x2d'),_0x327a81['filename']||_0x327a81['uniqueid'],_0x327a81[_0x7995('0x2c')]||'wav');return ami['Action']({'action':_0x7995('0x2e'),'channel':_0x45bc5e[_0x7995('0x2f')],'file':_0x37917b,'options':'ai(mixmonitorid)'})[_0x7995('0x1b')](function(_0x1922b4){var _0x2b772f=_[_0x7995('0x26')](_0x45bc5e[_0x7995('0x30')],{'filename':'/var/spool/asterisk/monitor/'+_0x37917b[_0x7995('0x31')]()});if(_[_0x7995('0x32')](_0x2b772f)){_0x45bc5e[_0x7995('0x30')][_0x7995('0x25')]({'filename':'/var/spool/asterisk/monitor/'+_0x37917b[_0x7995('0x31')](),'createdAt':moment()[_0x7995('0x2c')](_0x7995('0x33')),'mixmonitorid':_0x1922b4[_0x7995('0x34')],'status':_0x7995('0x35')});}else{_0x2b772f[_0x7995('0x34')]=_0x1922b4['mixmonitorid'];_0x2b772f[_0x7995('0x36')]=_0x7995('0x35');}_0x2e3493({'code':0xc8,'message':[_0x327a81[_0x7995('0x2b')],_0x7995('0x37'),_0x1922b4[_0x7995('0x34')]][_0x7995('0x15')]('\x20'),'mixmonitorid':_0x1922b4[_0x7995('0x34')]});})[_0x7995('0x1d')](function(_0x1234e1){_0x1ca460(_0x2b874d[_0x7995('0x22')](0x1f5,[_0x327a81[_0x7995('0x2b')],_0x1234e1[_0x7995('0x1c')][_0x7995('0x31')]()]['join']('\x20')));});}else{return _0x1ca460(_0x2b874d['error'](0x1f5,_0x7995('0x38')));}});},'VoiceChannelStopMixMonitor':function(_0x7325e8){var _0x58523e=this;return new Promise(function(_0x4b0855,_0x3f8522){if(ami['isConnected']()==![]){return _0x3f8522(_0x58523e['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config[_0x7995('0x12')][_0x7995('0x13')],'ami\x20disconnected'][_0x7995('0x15')]('\x20')));}var _0x5e85b9=schema(properties[_0x7995('0x2a')])['validate'](_0x7325e8);if(_0x5e85b9['length']>0x0){return _0x3f8522(_0x58523e[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x5e85b9,_0x7995('0x1c'))[_0x7995('0x15')](',\x20')));}var _0x599ecb=_[_0x7995('0x26')](_0x744bea[_0x7995('0x28')],{'uniqueid':_0x7325e8[_0x7995('0x2b')]});if(_0x599ecb){return Promise[_0x7995('0x3a')]()['then'](function(){if(_0x599ecb['channel']){return ami[_0x7995('0x1a')]({'action':'StopMixMonitor','channel':_0x599ecb[_0x7995('0x2f')],'mixmonitorid':_0x7325e8['mixmonitorid']})[_0x7995('0x1d')](function(){});}})['then'](function(){if(_0x599ecb[_0x7995('0x3b')]){return ami[_0x7995('0x1a')]({'action':'StopMixMonitor','channel':_0x599ecb[_0x7995('0x3b')],'mixmonitorid':_0x7325e8[_0x7995('0x34')]})[_0x7995('0x1d')](function(){});}})[_0x7995('0x1b')](function(){var _0x4c6837=_[_0x7995('0x26')](_0x599ecb[_0x7995('0x30')],{'mixmonitorid':_0x7325e8[_0x7995('0x34')]});if(_0x4c6837){_0x4c6837['status']=_0x7995('0x3c');}})[_0x7995('0x1b')](function(){var _0x511567=util[_0x7995('0x2c')](_0x7995('0x2d'),_0x7325e8['filename']||_0x7325e8[_0x7995('0x2b')],_0x7325e8[_0x7995('0x2c')]||'wav');var _0x3d1dbb=_['find'](_0x599ecb[_0x7995('0x30')],{'filename':_0x7995('0x3d')+_0x511567[_0x7995('0x31')]()});if(_0x3d1dbb){_0x3d1dbb[_0x7995('0x36')]=_0x7995('0x3c');}})[_0x7995('0x1b')](function(){_0x4b0855({'code':0xc8,'message':[_0x7325e8[_0x7995('0x2b')],'StopMixMonitor\x20Success'][_0x7995('0x15')]('\x20')});})[_0x7995('0x1d')](function(_0x418eb9){_0x3f8522(_0x58523e['error'](0x1f5,[_0x7325e8[_0x7995('0x2b')],_0x418eb9[_0x7995('0x1c')][_0x7995('0x31')]()]['join']('\x20')));});}else{return _0x3f8522(_0x58523e['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0xb70620){var _0x1fd1ca=this;return new Promise(function(_0x4cf5db){var _0x1cd85=_[_0x7995('0x3e')](_0x744bea[_0x7995('0x3f')]);var _0x1a9bd7={'count':_0x1cd85[_0x7995('0x29')],'rows':_0x1cd85};if(_0xb70620&&_0xb70620['type']){if(![_0x7995('0x40'),'outbound'][_0x7995('0x41')](_0xb70620[_0x7995('0x42')])){return _0xbda126(_0x1fd1ca[_0x7995('0x22')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x5e1f34=_['filter'](_0x1cd85,function(_0x563f8e){return _0x563f8e[_0x7995('0x42')]===_0xb70620[_0x7995('0x42')];});_0x1a9bd7[_0x7995('0x43')]=_0x5e1f34[_0x7995('0x29')];_0x1a9bd7[_0x7995('0x44')]=_0x5e1f34;}_0x4cf5db(_0x1a9bd7);});},'VoiceQueuesChannel':function(_0x357e60){var _0x1f4270=this;return new Promise(function(_0xda6ce8,_0x328671){var _0x17ecd3=schema(properties[_0x7995('0x45')])[_0x7995('0x3')](_0x357e60);if(_0x17ecd3[_0x7995('0x29')]>0x0){return _0x328671(_0x1f4270[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x17ecd3,_0x7995('0x1c'))[_0x7995('0x15')](',\x20')));}var _0x223e08=_[_0x7995('0x26')](_0x744bea['queueChannels'],{'uniqueid':_0x357e60[_0x7995('0x2b')]});if(_0x223e08){_0xda6ce8(_0x223e08);}else{return _0x328671(_0x1f4270[_0x7995('0x22')](0x1f5,_0x7995('0x38')));}});},'VoiceQueuesChannelHangup':function(_0x32c0d3){var _0x5d160d=this;return new Promise(function(_0x53125a,_0x402fa0){if(ami[_0x7995('0x1e')]()==![]){return _0x402fa0(_0x5d160d[_0x7995('0x22')](0x1f4,[config[_0x7995('0x12')]['ip'],config['asterisk'][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}var _0x33c49c=schema(properties['voicequeuechannelhangup'])['validate'](_0x32c0d3);if(_0x33c49c[_0x7995('0x29')]>0x0){return _0x402fa0(_0x5d160d[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x33c49c,_0x7995('0x1c'))[_0x7995('0x15')](',\x20')));}var _0x27c5cd=_[_0x7995('0x26')](_0x744bea[_0x7995('0x3f')],{'uniqueid':_0x32c0d3[_0x7995('0x2b')]});if(_0x27c5cd&&_0x27c5cd['channel']){return ami[_0x7995('0x1a')]({'action':_0x7995('0x46'),'channel':_0x27c5cd[_0x7995('0x2f')]})[_0x7995('0x1b')](function(_0x59c5aa){_0x53125a({'code':0xc8,'message':[_0x32c0d3['uniqueid'],_0x59c5aa[_0x7995('0x1c')][_0x7995('0x31')]()]['join']('\x20')});})[_0x7995('0x1d')](function(_0x375fc9){_0x402fa0(_0x5d160d[_0x7995('0x22')](0x1f5,[_0x32c0d3[_0x7995('0x2b')],_0x375fc9[_0x7995('0x1c')]['toLowerCase']()][_0x7995('0x15')]('\x20')));});}else{return _0x402fa0(_0x5d160d['error'](0x1f5,_0x7995('0x38')));}});},'VoiceQueuesChannelRedirect':function(_0xe31dcb){var _0x1722e2=this;return new Promise(function(_0x25b534,_0x4388c1){if(ami[_0x7995('0x1e')]()==![]){return _0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f4,[config[_0x7995('0x12')]['ip'],config[_0x7995('0x12')][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}var _0x56eb85=schema(properties[_0x7995('0x47')])[_0x7995('0x3')](_0xe31dcb);if(_0x56eb85[_0x7995('0x29')]>0x0){return _0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x56eb85,'message')['join'](',\x20')));}var _0x268fde=_[_0x7995('0x26')](_0x744bea[_0x7995('0x3f')],{'uniqueid':_0xe31dcb[_0x7995('0x2b')]});if(_0x268fde&&_0x268fde['channel']){return ami[_0x7995('0x1a')]({'action':'Redirect','channel':_0x268fde['channel'],'exten':_0xe31dcb[_0x7995('0x48')],'context':_0xe31dcb[_0x7995('0x49')]||_0x268fde[_0x7995('0x49')],'priority':0x1})[_0x7995('0x1b')](function(_0x290eae){_0x25b534({'code':0xc8,'message':[_0xe31dcb[_0x7995('0x2b')],_0x290eae[_0x7995('0x1c')][_0x7995('0x31')]()][_0x7995('0x15')]('\x20')});})[_0x7995('0x1d')](function(_0x560b0a){_0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f5,[_0xe31dcb[_0x7995('0x2b')],_0x560b0a[_0x7995('0x1c')]['toLowerCase']()][_0x7995('0x15')]('\x20')));});}else{return _0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f5,_0x7995('0x38')));}});},'Agents':function(_0x3a7d9d){return new Promise(function(_0x3b0d30){var _0x51ab1e=_[_0x7995('0x3e')](_0x744bea[_0x7995('0xe')]);if(_0x3a7d9d&&_0x3a7d9d['id']){var _0x2f94c4=_[_0x7995('0x26')](_0x51ab1e,function(_0x435a1b){return _0x435a1b['id']===_0x3a7d9d['id'];});_0x3b0d30(_0x2f94c4);}else{_0x3b0d30({'count':_0x51ab1e['length'],'rows':_0x51ab1e});}});},'Telephones':function(){return new Promise(function(_0x5e8b4c){var _0xd07c1c=_[_0x7995('0x3e')](_0x744bea[_0x7995('0x4a')]);_0x5e8b4c({'count':_0xd07c1c[_0x7995('0x29')],'rows':_0xd07c1c});});},'Trunks':function(){return new Promise(function(_0x4dbab8){var _0x3b45e8=_[_0x7995('0x3e')](_0x744bea['trunks']);_0x4dbab8({'count':_0x3b45e8['length'],'rows':_0x3b45e8});});},'OutboundChannels':function(){return new Promise(function(_0x3253b5){var _0x305b5a=_['values'](_0x744bea[_0x7995('0x4b')]);_0x3253b5({'count':_0x305b5a['length'],'rows':_0x305b5a});});},'Outbound':function(){return new Promise(function(_0x3758f9){_0x3758f9(_0x744bea[_0x7995('0x4c')]);});},'Campaigns':function(){return new Promise(function(_0x4ff9ff){var _0x5d9d33=_[_0x7995('0x3e')](_0x744bea['campaigns']);_0x4ff9ff({'count':_0x5d9d33[_0x7995('0x29')],'rows':_0x5d9d33});});},'VoiceQueuesPreview':function(_0xa41fff){var _0x3dd197=this;return new Promise(function(_0x45bd8a,_0x1a1873){_0x1a36d8[_0x7995('0x4d')](_0xa41fff['id'])[_0x7995('0x1b')](function(_0x14cb17){_0x45bd8a({'code':0xc8,'message':_0x14cb17[_0x7995('0x1c')]});})[_0x7995('0x1d')](function(_0x1ab590){_0x1a1873(_0x3dd197[_0x7995('0x22')](0x1f4,_0x1ab590[_0x7995('0x1c')]));});});},'EventManager':function(_0x1ff436){var _0x36e3a7=this;return new Promise(function(_0x3773de,_0x6ad274){if(!_0x1ff436[_0x7995('0x4e')]){return _0x6ad274(_0x36e3a7[_0x7995('0x22')](0x1f4,_0x7995('0x4f')));}ami[_0x7995('0x50')](_0x7995('0x51')+_0x1ff436[_0x7995('0x4e')],_0x1ff436[_0x7995('0x1c')]);_0x3773de({'code':0xc8,'message':_0x1ff436});});},'FaxAccounts':function(){return new Promise(function(_0x260ef1){var _0x33479a=_[_0x7995('0x3e')](_0x744bea[_0x7995('0x52')]);_0x260ef1({'count':_0x33479a['length'],'rows':_0x33479a});});},'SendFax':function(_0x3fdb4b){var _0x10f4ca=this;return new Promise(function(_0x5683b2,_0x4c85cb){_0x137b6b[_0x7995('0x53')](_0x3fdb4b)[_0x7995('0x1b')](function(_0x2d45d5){_0x5683b2({'code':0xc8,'message':_0x2d45d5[_0x7995('0x1c')]});})[_0x7995('0x1d')](function(_0x2491fe){_0x4c85cb(_0x10f4ca['error'](0x1f4,_0x2491fe[_0x7995('0x1c')]));});});},'CheckAfterSend':function(_0xb68962){var _0x3fea6a=this;return new Promise(function(_0x77b03f,_0x7d9c6e){_0x137b6b[_0x7995('0x54')](_0xb68962)[_0x7995('0x1b')](function(_0xc93dcb){_0x77b03f({'code':0xc8,'message':_0xc93dcb['message']});})[_0x7995('0x1d')](function(_0x2b8217){_0x7d9c6e(_0x3fea6a['error'](0x1f4,_0x2b8217['message']));});});}};var _0xd24c64=jayson[_0x7995('0x55')](_0x326741)[_0x7995('0x56')]();_0xd24c64['on'](_0x7995('0x22'),function(_0xe42797){return _0xbda126(_0xe42797);});_0xd24c64['listen'](0x232a,_0x7995('0x57'),function(){console[_0x7995('0x58')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x219534(_0x7995('0x59')+0x232a);});});}; \ No newline at end of file +var _0x7217=['channels','uniqueid','channel','%s.%s','filename','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','values','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','validate','moment','../../../config/environment','../properties','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','reload','module','action','Reload','then','message','join','pick','Action','content','catch','voiceQueues','hasOwnProperty','length','find','omit','undefined','voicechannel','map'];(function(_0x5be94d,_0x5ded24){var _0x35fbe2=function(_0x12b9b7){while(--_0x12b9b7){_0x5be94d['push'](_0x5be94d['shift']());}};_0x35fbe2(++_0x5ded24);}(_0x7217,0x19e));var _0x7721=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7217[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var jayson=require(_0x7721('0x1'));var schema=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var config=require(_0x7721('0x4'));var properties=require(_0x7721('0x5'));var ami=require('../ami');var VoiceQueueSummary=require('../model/voiceQueueSummary');exports[_0x7721('0x6')]=function(_0xce17f9,_0x46415c,_0x3fe47c){return new Promise(function(_0xb239e0,_0xf7ff37){var _0x18ab6b={'QueuePause':function(_0x21f680){return new Promise(function(_0x225610){var _0x2f99ed=util[_0x7721('0x7')](_0x7721('0x8'),_0x7721('0x9'),_0x21f680[_0x7721('0xa')]);if(_0xce17f9[_0x7721('0xb')]&&_0xce17f9['timers'][_0x2f99ed]&&_0xce17f9[_0x7721('0xb')][_0x2f99ed][_0x7721('0xc')]){_0xce17f9[_0x7721('0xb')][_0x2f99ed][_0x7721('0xd')]();}if(_0xce17f9[_0x7721('0xe')][_0x2f99ed]){_0xce17f9[_0x7721('0xe')][_0x2f99ed][_0x7721('0xf')]({'statePause':_0x21f680[_0x7721('0x10')]?!![]:![]});}_0x225610({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x2911ec){var _0x199930=this;return new Promise(function(_0x57ff6d,_0x109900){if(ami[_0x7721('0x11')]()==![]){return _0x109900(_0x199930[_0x7721('0x12')](0x1f4,[config[_0x7721('0x13')]['ip'],config['asterisk'][_0x7721('0x14')],_0x7721('0x15')]['join']('\x20')));}_0x2911ec=_['pick'](_0x2911ec,_['keys'](properties[_0x7721('0x16')][_0x7721('0x17')]));_0x2911ec[_0x7721('0x18')]=_0x7721('0x19');return ami['Action'](_0x2911ec)[_0x7721('0x1a')](function(_0x54a838){_0x57ff6d({'code':0xc8,'message':_0x54a838[_0x7721('0x1b')]});})['catch'](function(_0xfec626){_0x109900(_0x199930[_0x7721('0x12')](0x1f5,_0xfec626[_0x7721('0x1b')]));});});},'Command':function(_0x3e140d){var _0x2286e5=this;return new Promise(function(_0x40af90,_0x402820){if(ami[_0x7721('0x11')]()==![]){return _0x402820(_0x2286e5[_0x7721('0x12')](0x1f4,[config[_0x7721('0x13')]['ip'],config['asterisk'][_0x7721('0x14')],_0x7721('0x15')][_0x7721('0x1c')]('\x20')));}_0x3e140d=_[_0x7721('0x1d')](_0x3e140d,'command');_0x3e140d[_0x7721('0x18')]='Command';return ami[_0x7721('0x1e')](_0x3e140d)[_0x7721('0x1a')](function(_0x3e8a4e){_0x40af90({'code':0xc8,'message':_0x3e8a4e[_0x7721('0x1f')]});})[_0x7721('0x20')](function(_0x395b15){_0x402820(_0x2286e5[_0x7721('0x12')](0x1f5,_0x395b15['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x216f20){var _0x1abedb=[];for(var _0x125564 in _0xce17f9[_0x7721('0x21')]){if(_0xce17f9[_0x7721('0x21')][_0x7721('0x22')](_0x125564)){var _0x424e05=_0xce17f9[_0x7721('0x21')][_0x125564];var _0x40f367=new VoiceQueueSummary(_0x424e05);_0x1abedb['push'](_0x40f367);}}_0x216f20({'count':_0x1abedb[_0x7721('0x23')],'rows':_0x1abedb});});},'UpdateVoiceQueue':function(_0x5b0551){return new Promise(function(_0x499b87,_0x315202){var _0x343c19=_[_0x7721('0x24')](_0xce17f9[_0x7721('0x21')],{'id':parseInt(_0x5b0551['id'])});var _0x1ea4d=_[_0x7721('0x25')](_0x5b0551,['id']);if(_0x343c19){for(var _0xd7d703 in _0x1ea4d){if(typeof _0x1ea4d[_0xd7d703]!==_0x7721('0x26')&&typeof _0x343c19[_0xd7d703]!=='undefined'){_0x343c19[_0xd7d703]=_0x1ea4d[_0xd7d703];}}_0x499b87(_0x343c19);}else{_0x315202();}});},'VoiceChannels':function(){return new Promise(function(_0x471651){var _0x2871c5=_['values'](_0xce17f9['channels']);_0x471651({'count':_0x2871c5[_0x7721('0x23')],'rows':_0x2871c5});});},'VoiceChannelMixMonitor':function(_0x220bbf){var _0x48f329=this;return new Promise(function(_0x46f772,_0x4651b5){if(ami[_0x7721('0x11')]()==![]){return _0x4651b5(_0x48f329['error'](0x1f4,[config[_0x7721('0x13')]['ip'],config[_0x7721('0x13')][_0x7721('0x14')],_0x7721('0x15')][_0x7721('0x1c')]('\x20')));}var _0x508202=schema(properties[_0x7721('0x27')])[_0x7721('0x2')](_0x220bbf);if(_0x508202[_0x7721('0x23')]>0x0){return _0x4651b5(_0x48f329['error'](0x1f4,_[_0x7721('0x28')](_0x508202,_0x7721('0x1b'))['join'](',\x20')));}var _0x217592=_['find'](_0xce17f9[_0x7721('0x29')],{'uniqueid':_0x220bbf[_0x7721('0x2a')]});if(_0x217592&&_0x217592[_0x7721('0x2b')]){var _0x1d894b=util[_0x7721('0x7')](_0x7721('0x2c'),_0x220bbf[_0x7721('0x2d')]||_0x220bbf[_0x7721('0x2a')],_0x220bbf[_0x7721('0x7')]||_0x7721('0x2e'));return ami[_0x7721('0x1e')]({'action':'MixMonitor','channel':_0x217592[_0x7721('0x2b')],'file':_0x1d894b,'options':'ai(mixmonitorid)'})[_0x7721('0x1a')](function(_0x35614c){var _0x7942f7=_[_0x7721('0x24')](_0x217592[_0x7721('0x2f')],{'filename':_0x7721('0x30')+_0x1d894b['toLowerCase']()});if(_['isNil'](_0x7942f7)){_0x217592['monitors']['push']({'filename':_0x7721('0x30')+_0x1d894b[_0x7721('0x31')](),'createdAt':moment()[_0x7721('0x7')](_0x7721('0x32')),'mixmonitorid':_0x35614c['mixmonitorid'],'status':_0x7721('0x33')});}else{_0x7942f7['mixmonitorid']=_0x35614c[_0x7721('0x34')];_0x7942f7[_0x7721('0x35')]='rec';}_0x46f772({'code':0xc8,'message':[_0x220bbf[_0x7721('0x2a')],_0x7721('0x36'),_0x35614c['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x35614c[_0x7721('0x34')]});})[_0x7721('0x20')](function(_0xf3b5ca){_0x4651b5(_0x48f329[_0x7721('0x12')](0x1f5,[_0x220bbf['uniqueid'],_0xf3b5ca[_0x7721('0x1b')][_0x7721('0x31')]()][_0x7721('0x1c')]('\x20')));});}else{return _0x4651b5(_0x48f329[_0x7721('0x12')](0x1f5,_0x7721('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x52ab67){var _0x490d4=this;return new Promise(function(_0x4a2c28,_0xaa3216){if(ami['isConnected']()==![]){return _0xaa3216(_0x490d4[_0x7721('0x12')](0x1f4,[config[_0x7721('0x13')]['ip'],config[_0x7721('0x13')]['username'],_0x7721('0x15')][_0x7721('0x1c')]('\x20')));}var _0x1ad315=schema(properties['voicechannel'])[_0x7721('0x2')](_0x52ab67);if(_0x1ad315[_0x7721('0x23')]>0x0){return _0xaa3216(_0x490d4[_0x7721('0x12')](0x1f4,_[_0x7721('0x28')](_0x1ad315,_0x7721('0x1b'))[_0x7721('0x1c')](',\x20')));}var _0x463ccc=_['find'](_0xce17f9['channels'],{'uniqueid':_0x52ab67[_0x7721('0x2a')]});if(_0x463ccc){return Promise[_0x7721('0x38')]()[_0x7721('0x1a')](function(){if(_0x463ccc[_0x7721('0x2b')]){return ami[_0x7721('0x1e')]({'action':_0x7721('0x39'),'channel':_0x463ccc[_0x7721('0x2b')],'mixmonitorid':_0x52ab67[_0x7721('0x34')]})[_0x7721('0x20')](function(){});}})[_0x7721('0x1a')](function(){if(_0x463ccc['destinationchannel']){return ami['Action']({'action':_0x7721('0x39'),'channel':_0x463ccc[_0x7721('0x3a')],'mixmonitorid':_0x52ab67[_0x7721('0x34')]})[_0x7721('0x20')](function(){});}})['then'](function(){var _0x30107e=_[_0x7721('0x24')](_0x463ccc['monitors'],{'mixmonitorid':_0x52ab67[_0x7721('0x34')]});if(_0x30107e){_0x30107e['status']=_0x7721('0x3b');}})['then'](function(){var _0x334f23=util[_0x7721('0x7')](_0x7721('0x2c'),_0x52ab67['filename']||_0x52ab67[_0x7721('0x2a')],_0x52ab67[_0x7721('0x7')]||'wav');var _0x223d93=_[_0x7721('0x24')](_0x463ccc[_0x7721('0x2f')],{'filename':'/var/spool/asterisk/monitor/'+_0x334f23[_0x7721('0x31')]()});if(_0x223d93){_0x223d93['status']=_0x7721('0x3b');}})[_0x7721('0x1a')](function(){_0x4a2c28({'code':0xc8,'message':[_0x52ab67[_0x7721('0x2a')],_0x7721('0x3c')][_0x7721('0x1c')]('\x20')});})[_0x7721('0x20')](function(_0x163a23){_0xaa3216(_0x490d4[_0x7721('0x12')](0x1f5,[_0x52ab67[_0x7721('0x2a')],_0x163a23[_0x7721('0x1b')][_0x7721('0x31')]()][_0x7721('0x1c')]('\x20')));});}else{return _0xaa3216(_0x490d4[_0x7721('0x12')](0x1f5,_0x7721('0x37')));}});},'VoiceQueuesChannels':function(_0x2cd678){var _0x5b741d=this;return new Promise(function(_0x474f32){var _0x2f6f30=_[_0x7721('0x3d')](_0xce17f9[_0x7721('0x3e')]);var _0x1f1ac7={'count':_0x2f6f30[_0x7721('0x23')],'rows':_0x2f6f30};if(_0x2cd678&&_0x2cd678[_0x7721('0x3f')]){if(!['inbound',_0x7721('0x40')][_0x7721('0x41')](_0x2cd678[_0x7721('0x3f')])){return _0xf7ff37(_0x5b741d[_0x7721('0x12')](0x190,_0x7721('0x42')));}var _0x9c0d4=_[_0x7721('0x43')](_0x2f6f30,function(_0x33287d){return _0x33287d[_0x7721('0x3f')]===_0x2cd678[_0x7721('0x3f')];});_0x1f1ac7[_0x7721('0x44')]=_0x9c0d4['length'];_0x1f1ac7[_0x7721('0x45')]=_0x9c0d4;}_0x474f32(_0x1f1ac7);});},'VoiceQueuesChannel':function(_0xadb365){var _0x1234bc=this;return new Promise(function(_0x2ee3c0,_0x15ed3b){var _0x3e7918=schema(properties[_0x7721('0x46')])[_0x7721('0x2')](_0xadb365);if(_0x3e7918[_0x7721('0x23')]>0x0){return _0x15ed3b(_0x1234bc[_0x7721('0x12')](0x1f4,_[_0x7721('0x28')](_0x3e7918,_0x7721('0x1b'))[_0x7721('0x1c')](',\x20')));}var _0x18f7f6=_[_0x7721('0x24')](_0xce17f9['queueChannels'],{'uniqueid':_0xadb365['uniqueid']});if(_0x18f7f6){_0x2ee3c0(_0x18f7f6);}else{return _0x15ed3b(_0x1234bc['error'](0x1f5,_0x7721('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x4f2fe6){var _0x4a46db=this;return new Promise(function(_0x57348c,_0x5d7036){if(ami[_0x7721('0x11')]()==![]){return _0x5d7036(_0x4a46db[_0x7721('0x12')](0x1f4,[config[_0x7721('0x13')]['ip'],config['asterisk'][_0x7721('0x14')],'ami\x20disconnected']['join']('\x20')));}var _0x484b8e=schema(properties[_0x7721('0x47')])['validate'](_0x4f2fe6);if(_0x484b8e['length']>0x0){return _0x5d7036(_0x4a46db['error'](0x1f4,_[_0x7721('0x28')](_0x484b8e,_0x7721('0x1b'))[_0x7721('0x1c')](',\x20')));}var _0x4a94c8=_[_0x7721('0x24')](_0xce17f9[_0x7721('0x3e')],{'uniqueid':_0x4f2fe6[_0x7721('0x2a')]});if(_0x4a94c8&&_0x4a94c8[_0x7721('0x2b')]){return ami[_0x7721('0x1e')]({'action':_0x7721('0x48'),'channel':_0x4a94c8[_0x7721('0x2b')]})[_0x7721('0x1a')](function(_0x127f46){_0x57348c({'code':0xc8,'message':[_0x4f2fe6[_0x7721('0x2a')],_0x127f46[_0x7721('0x1b')][_0x7721('0x31')]()][_0x7721('0x1c')]('\x20')});})[_0x7721('0x20')](function(_0x44de7a){_0x5d7036(_0x4a46db['error'](0x1f5,[_0x4f2fe6[_0x7721('0x2a')],_0x44de7a[_0x7721('0x1b')][_0x7721('0x31')]()][_0x7721('0x1c')]('\x20')));});}else{return _0x5d7036(_0x4a46db['error'](0x1f5,_0x7721('0x37')));}});},'VoiceQueuesChannelRedirect':function(_0x104f05){var _0x4c8284=this;return new Promise(function(_0x3e7df3,_0x5d37ad){if(ami[_0x7721('0x11')]()==![]){return _0x5d37ad(_0x4c8284[_0x7721('0x12')](0x1f4,[config[_0x7721('0x13')]['ip'],config[_0x7721('0x13')][_0x7721('0x14')],_0x7721('0x15')][_0x7721('0x1c')]('\x20')));}var _0x167ce7=schema(properties[_0x7721('0x49')])['validate'](_0x104f05);if(_0x167ce7[_0x7721('0x23')]>0x0){return _0x5d37ad(_0x4c8284[_0x7721('0x12')](0x1f4,_[_0x7721('0x28')](_0x167ce7,_0x7721('0x1b'))[_0x7721('0x1c')](',\x20')));}var _0x3ed425=_[_0x7721('0x24')](_0xce17f9['queueChannels'],{'uniqueid':_0x104f05[_0x7721('0x2a')]});if(_0x3ed425&&_0x3ed425[_0x7721('0x2b')]){return ami['Action']({'action':_0x7721('0x4a'),'channel':_0x3ed425['channel'],'exten':_0x104f05[_0x7721('0x4b')],'context':_0x104f05[_0x7721('0x4c')]||_0x3ed425[_0x7721('0x4c')],'priority':0x1})[_0x7721('0x1a')](function(_0x1e2436){_0x3e7df3({'code':0xc8,'message':[_0x104f05[_0x7721('0x2a')],_0x1e2436[_0x7721('0x1b')]['toLowerCase']()][_0x7721('0x1c')]('\x20')});})[_0x7721('0x20')](function(_0x280b1d){_0x5d37ad(_0x4c8284['error'](0x1f5,[_0x104f05['uniqueid'],_0x280b1d['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x5d37ad(_0x4c8284[_0x7721('0x12')](0x1f5,_0x7721('0x37')));}});},'Agents':function(_0x580473){return new Promise(function(_0x2d4b3a){var _0x42f6e9=_[_0x7721('0x3d')](_0xce17f9[_0x7721('0xe')]);if(_0x580473&&_0x580473['id']){var _0x53ebb1=_[_0x7721('0x24')](_0x42f6e9,function(_0xfe9fb8){return _0xfe9fb8['id']===_0x580473['id'];});_0x2d4b3a(_0x53ebb1);}else{_0x2d4b3a({'count':_0x42f6e9[_0x7721('0x23')],'rows':_0x42f6e9});}});},'Telephones':function(){return new Promise(function(_0x1bea13){var _0x3cf3fd=_['values'](_0xce17f9[_0x7721('0x4d')]);_0x1bea13({'count':_0x3cf3fd[_0x7721('0x23')],'rows':_0x3cf3fd});});},'Trunks':function(){return new Promise(function(_0x180419){var _0x5f515e=_['values'](_0xce17f9[_0x7721('0x4e')]);_0x180419({'count':_0x5f515e[_0x7721('0x23')],'rows':_0x5f515e});});},'OutboundChannels':function(){return new Promise(function(_0x423040){var _0x42ca24=_[_0x7721('0x3d')](_0xce17f9['outboundChannels']);_0x423040({'count':_0x42ca24['length'],'rows':_0x42ca24});});},'Outbound':function(){return new Promise(function(_0x263070){_0x263070(_0xce17f9[_0x7721('0x40')]);});},'Campaigns':function(){return new Promise(function(_0x68de4){var _0x3c66b3=_[_0x7721('0x3d')](_0xce17f9[_0x7721('0x4f')]);_0x68de4({'count':_0x3c66b3[_0x7721('0x23')],'rows':_0x3c66b3});});},'VoiceQueuesPreview':function(_0x58f944){var _0xdfae41=this;return new Promise(function(_0x413185,_0x27d7f1){_0x46415c['run'](_0x58f944['id'])[_0x7721('0x1a')](function(_0x1a53d6){_0x413185({'code':0xc8,'message':_0x1a53d6[_0x7721('0x1b')]});})[_0x7721('0x20')](function(_0x56af64){_0x27d7f1(_0xdfae41['error'](0x1f4,_0x56af64[_0x7721('0x1b')]));});});},'EventManager':function(_0x2cac50){var _0x177fe3=this;return new Promise(function(_0x42c849,_0x3605cb){if(!_0x2cac50[_0x7721('0x50')]){return _0x3605cb(_0x177fe3['error'](0x1f4,_0x7721('0x51')));}ami[_0x7721('0x52')](_0x7721('0x53')+_0x2cac50['event'],_0x2cac50[_0x7721('0x1b')]);_0x42c849({'code':0xc8,'message':_0x2cac50});});},'FaxAccounts':function(){return new Promise(function(_0x3b16f3){var _0xbad8c4=_[_0x7721('0x3d')](_0xce17f9[_0x7721('0x54')]);_0x3b16f3({'count':_0xbad8c4['length'],'rows':_0xbad8c4});});},'SendFax':function(_0x9c05e4){var _0x59a91d=this;return new Promise(function(_0x12a3f7,_0x47764b){_0x3fe47c[_0x7721('0x55')](_0x9c05e4)[_0x7721('0x1a')](function(_0x963dbe){_0x12a3f7({'code':0xc8,'message':_0x963dbe[_0x7721('0x1b')]});})[_0x7721('0x20')](function(_0x123049){_0x47764b(_0x59a91d[_0x7721('0x12')](0x1f4,_0x123049[_0x7721('0x1b')]));});});},'CheckAfterSend':function(_0x2c74d8){var _0x55d209=this;return new Promise(function(_0x19fad6,_0x19f451){_0x3fe47c[_0x7721('0x56')](_0x2c74d8)['then'](function(_0x94af20){_0x19fad6({'code':0xc8,'message':_0x94af20[_0x7721('0x1b')]});})[_0x7721('0x20')](function(_0xc9761e){_0x19f451(_0x55d209[_0x7721('0x12')](0x1f4,_0xc9761e['message']));});});}};var _0x1276ce=jayson[_0x7721('0x57')](_0x18ab6b)[_0x7721('0x58')]();_0x1276ce['on'](_0x7721('0x12'),function(_0x30326d){return _0xf7ff37(_0x30326d);});_0x1276ce[_0x7721('0x6')](0x232a,'127.0.0.1',function(){console[_0x7721('0x59')](_0x7721('0x5a'),0x232a);return _0xb239e0('RPC\x20listening\x20on\x20port:'+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 c35a436..f6792d1 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 _0xb5ae=['data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','mobile','createdAt','scheduledAt','union','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridname','Unknown','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','destcalleridname','format','user:%s','trigger:%s','action','merge','lodash','bluebird','ioredis','../../../../config/logger','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','data5','xmd-contactid','ListId'];(function(_0x3b49a1,_0x517fd3){var _0x2ed28f=function(_0x482823){while(--_0x482823){_0x3b49a1['push'](_0x3b49a1['shift']());}};_0x2ed28f(++_0x517fd3);}(_0xb5ae,0x84));var _0xeb5a=function(_0x51ac8e,_0x42375c){_0x51ac8e=_0x51ac8e-0x0;var _0x55403d=_0xb5ae[_0x51ac8e];return _0x55403d;};'use strict';var _=require(_0xeb5a('0x0'));var BPromise=require(_0xeb5a('0x1'));var Redis=require(_0xeb5a('0x2'));var util=require('util');var config=require('../../../../config/environment');var logger=require(_0xeb5a('0x3'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0xeb5a('0x4')]=_['defaults'](config[_0xeb5a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xeb5a('0x5'))(new Redis(config[_0xeb5a('0x4')]));function emit(_0x3fccfd,_0x47a804,_0x4bbdc9,_0xa36a1,_0x406178){logger[_0xeb5a('0x6')](_0xeb5a('0x7'),_0x3fccfd,_0x47a804['id'],_0x4bbdc9,_0xa36a1,JSON[_0xeb5a('0x8')](_0x406178));io['to'](_0x4bbdc9)['emit'](_0xa36a1,_0x406178);}exports[_0xeb5a('0x9')]=function(_0x34af8a,_0x51ba29,_0x178137,_0x25566c){var _0x4a7303,_0x5d9167;var _0x3ee1f5={};var _0x40ec4d;var _0x461348=Number(_0x178137[_0xeb5a('0xa')]);var _0x2738c0=_0x178137[_0xeb5a('0xb')]?Boolean(Number(_0x178137[_0xeb5a('0xb')])):![];var _0x7af357;var _0x1a8706=![];if(!_['isNil'](_0x178137[_0xeb5a('0xc')])){if(_0x178137[_0xeb5a('0xc')]=='1')_0x1a8706=!![];}if(!_0x1a8706){if(_0x25566c[_0xeb5a('0xd')]){_0x3ee1f5['id']=_0x25566c[_0xeb5a('0xd')];}}if(!_0x3ee1f5['id']){_0x3ee1f5[_0xeb5a('0xe')]=_0x461348;_0x7af357=_0x178137['data3']&&_0x178137[_0xeb5a('0xf')]!=='0'?_0x178137['data3'][_0xeb5a('0x10')](','):[_0xeb5a('0x11')];_0x3ee1f5[_0xeb5a('0x12')]=_['map'](_0x7af357,function(_0x4808f8){var _0x49e9d2={};_0x49e9d2[_0x4808f8]=_0x25566c[_0xeb5a('0x13')]?_0x25566c[_0xeb5a('0x14')]:_0x25566c[_0xeb5a('0x15')];return _0x49e9d2;});_0x40ec4d=_0x25566c[_0xeb5a('0x13')]?_0x25566c[_0xeb5a('0x14')]:_0x25566c[_0xeb5a('0x15')];}var _0x5c7722=['id',_0xeb5a('0x16'),'lastName',_0xeb5a('0x11'),_0xeb5a('0x17'),'fax',_0xeb5a('0xe'),_0xeb5a('0x18'),_0xeb5a('0x19'),'updatedAt'];var _0x40cf12=_[_0xeb5a('0x1a')](_0x5c7722,_0x7af357);BPromise[_0xeb5a('0x1b')]()[_0xeb5a('0x1c')](cmContactRpc[_0xeb5a('0x1d')]({'attributes':_0x40cf12,'where':_0x3ee1f5,'phone':_0x40ec4d}))['then'](function(_0x2a641e){_0x5d9167=_0x2a641e;if(!_['isEmpty'](_0x5d9167)){if(_0x5d9167[_0xeb5a('0x1e')]===0x1){_0x4a7303=_0x5d9167[0x0];logger[_0xeb5a('0x6')](_0xeb5a('0x1f'),_0x25566c[_0xeb5a('0x20')],_0x51ba29['id'],_0x4a7303['id']);}else{logger[_0xeb5a('0x6')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x25566c[_0xeb5a('0x20')],_0x51ba29['id'],_[_0xeb5a('0x21')](_0x5d9167,'id')['join'](','));}return;}else{logger[_0xeb5a('0x6')](_0xeb5a('0x22'),_0x25566c[_0xeb5a('0x20')],_0x51ba29['id']);var _0x1ce63e={'ListId':_0x461348};var _0x94da35=_0x178137['data4']&&_0x178137[_0xeb5a('0x23')]!=='0'?_0x178137[_0xeb5a('0x23')]:_0xeb5a('0x11');if(_0x2738c0){logger[_0xeb5a('0x6')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x25566c[_0xeb5a('0x20')],_0x51ba29['id']);_0x1ce63e[_0x94da35]=_[_0xeb5a('0x24')](_0x25566c['routeId'])?_0x25566c[_0xeb5a('0x15')]:_0x25566c[_0xeb5a('0x14')];if(_['isNil'](_0x25566c['routeId'])){_0x1ce63e[_0xeb5a('0x16')]=_0x25566c[_0xeb5a('0x25')]&&_0x25566c[_0xeb5a('0x25')]!==''?_0x25566c[_0xeb5a('0x25')]:_0xeb5a('0x26');}else{_0x1ce63e[_0xeb5a('0x16')]=_0x25566c['destcalleridname']&&_0x25566c['destcalleridname']!==_0xeb5a('0x27')?_0x25566c['destcalleridname']:_0xeb5a('0x26');}return BPromise['resolve']()[_0xeb5a('0x1c')](cmContactRpc[_0xeb5a('0x28')](_0x1ce63e))['then'](function(_0x9699a3){_0x4a7303=_0x9699a3;_0x5d9167[_0xeb5a('0x29')](_0x9699a3);if(_0x4a7303){logger[_0xeb5a('0x6')](_0xeb5a('0x2a'),_0x25566c[_0xeb5a('0x20')],_0x51ba29['id'],_0x4a7303['id']);}return;});}else{logger[_0xeb5a('0x6')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x25566c['uniqueid'],_0x51ba29['id']);_0x1ce63e[_0x94da35]=_[_0xeb5a('0x24')](_0x25566c[_0xeb5a('0x13')])?_0x25566c[_0xeb5a('0x15')]:_0x25566c[_0xeb5a('0x14')];if(_[_0xeb5a('0x24')](_0x25566c[_0xeb5a('0x13')])){_0x1ce63e[_0xeb5a('0x16')]=_0x25566c['calleridname']&&_0x25566c[_0xeb5a('0x25')]!==_0xeb5a('0x27')?_0x25566c['calleridname']:_0xeb5a('0x26');}else{_0x1ce63e[_0xeb5a('0x16')]=_0x25566c['destcalleridname']&&_0x25566c[_0xeb5a('0x2b')]!==''?_0x25566c[_0xeb5a('0x2b')]:_0xeb5a('0x26');}_0x4a7303=_0x1ce63e;_0x5d9167[_0xeb5a('0x29')](_0x1ce63e);return;}}})[_0xeb5a('0x1c')](function(){if(_0x34af8a){emit(_0x25566c[_0xeb5a('0x20')],_0x51ba29,util[_0xeb5a('0x2c')](_0xeb5a('0x2d'),_0x34af8a['name']),util[_0xeb5a('0x2c')](_0xeb5a('0x2e'),_0x178137[_0xeb5a('0x2f')]['toLowerCase']()),{'evt':_[_0xeb5a('0x30')](_0x25566c,{'autoCreate':_0x2738c0}),'contact':_0x4a7303===undefined?{}:_0x4a7303,'contacts':_0x5d9167['length']===0x0?undefined:_0x5d9167});}});}; \ No newline at end of file +var _0x51e1=['Unknown','createContact','push','format','user:%s','trigger:%s','toLowerCase','merge','lodash','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','data5','ListId','data3','phone','$or','routeId','destcalleridnum','calleridnum','firstName','mobile','createdAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','destcalleridname'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x51e1,0x70));var _0x151e=function(_0x5f25b3,_0x35481a){_0x5f25b3=_0x5f25b3-0x0;var _0x4ab9bf=_0x51e1[_0x5f25b3];return _0x4ab9bf;};'use strict';var _=require(_0x151e('0x0'));var BPromise=require('bluebird');var Redis=require(_0x151e('0x1'));var util=require(_0x151e('0x2'));var config=require('../../../../config/environment');var logger=require(_0x151e('0x3'))(_0x151e('0x4'));var cmContactRpc=require(_0x151e('0x5'));config[_0x151e('0x6')]=_[_0x151e('0x7')](config[_0x151e('0x6')],{'host':_0x151e('0x8'),'port':0x18eb});var io=require(_0x151e('0x9'))(new Redis(config[_0x151e('0x6')]));function emit(_0x34ccf1,_0x1e29d2,_0x3b2599,_0x3cd66c,_0x202b6d){logger[_0x151e('0xa')](_0x151e('0xb'),_0x34ccf1,_0x1e29d2['id'],_0x3b2599,_0x3cd66c,JSON[_0x151e('0xc')](_0x202b6d));io['to'](_0x3b2599)[_0x151e('0xd')](_0x3cd66c,_0x202b6d);}exports[_0x151e('0xe')]=function(_0x525aa7,_0x182c09,_0x26da98,_0x32a4c1){var _0xf38a9f,_0x205e57;var _0x350c43={};var _0x2994e7;var _0x7d5cc0=Number(_0x26da98[_0x151e('0xf')]);var _0x3b325a=_0x26da98[_0x151e('0x10')]?Boolean(Number(_0x26da98[_0x151e('0x10')])):![];var _0x2029a9;var _0xcd7c51=![];if(!_['isNil'](_0x26da98[_0x151e('0x11')])){if(_0x26da98['data5']=='1')_0xcd7c51=!![];}if(!_0xcd7c51){if(_0x32a4c1['xmd-contactid']){_0x350c43['id']=_0x32a4c1['xmd-contactid'];}}if(!_0x350c43['id']){_0x350c43[_0x151e('0x12')]=_0x7d5cc0;_0x2029a9=_0x26da98[_0x151e('0x13')]&&_0x26da98[_0x151e('0x13')]!=='0'?_0x26da98[_0x151e('0x13')]['split'](','):[_0x151e('0x14')];_0x350c43[_0x151e('0x15')]=_['map'](_0x2029a9,function(_0x1f288d){var _0x24ba11={};_0x24ba11[_0x1f288d]=_0x32a4c1[_0x151e('0x16')]?_0x32a4c1['destcalleridnum']:_0x32a4c1['calleridnum'];return _0x24ba11;});_0x2994e7=_0x32a4c1[_0x151e('0x16')]?_0x32a4c1[_0x151e('0x17')]:_0x32a4c1[_0x151e('0x18')];}var _0x362aee=['id',_0x151e('0x19'),'lastName','phone',_0x151e('0x1a'),'fax','ListId',_0x151e('0x1b'),'scheduledAt','updatedAt'];var _0xc6cd43=_['union'](_0x362aee,_0x2029a9);BPromise[_0x151e('0x1c')]()[_0x151e('0x1d')](cmContactRpc[_0x151e('0x1e')]({'attributes':_0xc6cd43,'where':_0x350c43,'phone':_0x2994e7}))[_0x151e('0x1d')](function(_0x2e4db8){_0x205e57=_0x2e4db8;if(!_[_0x151e('0x1f')](_0x205e57)){if(_0x205e57[_0x151e('0x20')]===0x1){_0xf38a9f=_0x205e57[0x0];logger[_0x151e('0xa')](_0x151e('0x21'),_0x32a4c1[_0x151e('0x22')],_0x182c09['id'],_0xf38a9f['id']);}else{logger[_0x151e('0xa')](_0x151e('0x23'),_0x32a4c1['uniqueid'],_0x182c09['id'],_[_0x151e('0x24')](_0x205e57,'id')[_0x151e('0x25')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x32a4c1['uniqueid'],_0x182c09['id']);var _0xd8928a={'ListId':_0x7d5cc0};var _0x3bae2d=_0x26da98[_0x151e('0x26')]&&_0x26da98['data4']!=='0'?_0x26da98['data4']:_0x151e('0x14');if(_0x3b325a){logger[_0x151e('0xa')](_0x151e('0x27'),_0x32a4c1[_0x151e('0x22')],_0x182c09['id']);_0xd8928a[_0x3bae2d]=_['isNil'](_0x32a4c1[_0x151e('0x16')])?_0x32a4c1['calleridnum']:_0x32a4c1[_0x151e('0x17')];if(_[_0x151e('0x28')](_0x32a4c1[_0x151e('0x16')])){_0xd8928a[_0x151e('0x19')]=_0x32a4c1[_0x151e('0x29')]&&_0x32a4c1[_0x151e('0x29')]!==_0x151e('0x2a')?_0x32a4c1[_0x151e('0x29')]:'Unknown';}else{_0xd8928a[_0x151e('0x19')]=_0x32a4c1['destcalleridname']&&_0x32a4c1[_0x151e('0x2b')]!==''?_0x32a4c1[_0x151e('0x2b')]:_0x151e('0x2c');}return BPromise[_0x151e('0x1c')]()[_0x151e('0x1d')](cmContactRpc[_0x151e('0x2d')](_0xd8928a))[_0x151e('0x1d')](function(_0x54b6c4){_0xf38a9f=_0x54b6c4;_0x205e57[_0x151e('0x2e')](_0x54b6c4);if(_0xf38a9f){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x32a4c1[_0x151e('0x22')],_0x182c09['id'],_0xf38a9f['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x32a4c1[_0x151e('0x22')],_0x182c09['id']);_0xd8928a[_0x3bae2d]=_[_0x151e('0x28')](_0x32a4c1['routeId'])?_0x32a4c1[_0x151e('0x18')]:_0x32a4c1['destcalleridnum'];if(_[_0x151e('0x28')](_0x32a4c1[_0x151e('0x16')])){_0xd8928a[_0x151e('0x19')]=_0x32a4c1[_0x151e('0x29')]&&_0x32a4c1[_0x151e('0x29')]!==_0x151e('0x2a')?_0x32a4c1[_0x151e('0x29')]:_0x151e('0x2c');}else{_0xd8928a[_0x151e('0x19')]=_0x32a4c1[_0x151e('0x2b')]&&_0x32a4c1[_0x151e('0x2b')]!==_0x151e('0x2a')?_0x32a4c1[_0x151e('0x2b')]:_0x151e('0x2c');}_0xf38a9f=_0xd8928a;_0x205e57[_0x151e('0x2e')](_0xd8928a);return;}}})['then'](function(){if(_0x525aa7){emit(_0x32a4c1[_0x151e('0x22')],_0x182c09,util[_0x151e('0x2f')](_0x151e('0x30'),_0x525aa7['name']),util['format'](_0x151e('0x31'),_0x26da98['action'][_0x151e('0x32')]()),{'evt':_[_0x151e('0x33')](_0x32a4c1,{'autoCreate':_0x3b325a}),'contact':_0xf38a9f===undefined?{}:_0xf38a9f,'contacts':_0x205e57[_0x151e('0x20')]===0x0?undefined:_0x205e57});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index ab20e18..c96b9cd 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 _0xbb00=['sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','deskAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','emit','info','motionChannel','voice','debug','inspect','checkTriggers','interface','status','merge','Actions','length','action','toLowerCase','contactmanager','browser','TemplateId','data2','html','render','template\x20not\x20found','url','uri','buildUri','isNil','data3','data4','location','windowWidth','data5','800','windowHeight','data6','winapp','winApplication','winArguments','format','user:%s','trigger:%s:%s','data1','jscripty','name','trigger:%s','exec','integration','queue','routeId','urlforward','script','checkTrigger','channel','AllConditions','checkConditions','AnyConditions','checkTrigger:\x20trigger','chat','operator','value','ChatWebsiteId','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','mailSubstatus','undefined','offlineMessage','created','equals','util','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','redis','defaults','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts'];(function(_0x42a584,_0x2d9ee3){var _0x56be59=function(_0x5809dd){while(--_0x5809dd){_0x42a584['push'](_0x42a584['shift']());}};_0x56be59(++_0x2d9ee3);}(_0xbb00,0x1dd));var _0x0bb0=function(_0x5b1956,_0x49603f){_0x5b1956=_0x5b1956-0x0;var _0xacd2b0=_0xbb00[_0x5b1956];return _0xacd2b0;};'use strict';var util=require(_0x0bb0('0x0'));var _=require(_0x0bb0('0x1'));var url=require('url');var Mustache=require(_0x0bb0('0x2'));var Redis=require(_0x0bb0('0x3'));var urlforward=require(_0x0bb0('0x4'));var integration=require(_0x0bb0('0x5'));var cmContact=require(_0x0bb0('0x6'));var script=require(_0x0bb0('0x7'));var config=require(_0x0bb0('0x8'));var logger=require(_0x0bb0('0x9'))(_0x0bb0('0xa'));var ami=require('../ami');config[_0x0bb0('0xb')]=_[_0x0bb0('0xc')](config[_0x0bb0('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x0bb0('0xd'))(new Redis(config[_0x0bb0('0xb')]));var operators={'equals':function(_0x159e77,_0x2ec2da){return _0x159e77==_0x2ec2da;},'not_equals':function(_0x1ade12,_0x332f24){return _0x1ade12!=_0x332f24;}};var barAndWebActions=[_0x0bb0('0xe'),'url','winapp'];function Trigger(_0x21479a){this[_0x0bb0('0xf')]=_0x21479a['triggers'];this[_0x0bb0('0x10')]=_0x21479a[_0x0bb0('0x10')];this[_0x0bb0('0x11')]=_0x21479a[_0x0bb0('0x11')];this[_0x0bb0('0x12')]=_0x21479a[_0x0bb0('0x12')];this['voiceExtensions']=_0x21479a[_0x0bb0('0x13')];this['zendeskAccounts']=_0x21479a[_0x0bb0('0x14')];this[_0x0bb0('0x15')]=_0x21479a['freshdeskAccounts'];this['salesforceAccounts']=_0x21479a[_0x0bb0('0x16')];this[_0x0bb0('0x17')]=_0x21479a[_0x0bb0('0x17')];this[_0x0bb0('0x18')]=_0x21479a[_0x0bb0('0x18')];this['deskAccounts']=_0x21479a['deskAccounts'];this[_0x0bb0('0x19')]=_0x21479a[_0x0bb0('0x19')];this[_0x0bb0('0x1a')]=_0x21479a['servicenowAccounts'];this[_0x0bb0('0x1b')]=_0x21479a['dynamics365Accounts'];this[_0x0bb0('0x1c')]=_0x21479a['freshsalesAccounts'];this[_0x0bb0('0x1d')]={'zendesk':this[_0x0bb0('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x0bb0('0x15')],'sugarcrm':this[_0x0bb0('0x17')],'zoho':this[_0x0bb0('0x18')],'desk':this[_0x0bb0('0x1e')],'vtiger':this[_0x0bb0('0x19')],'dynamics365':this[_0x0bb0('0x1b')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x0bb0('0x1a')]};ami['on'](_0x0bb0('0x1f'),this[_0x0bb0('0x20')][_0x0bb0('0x21')](this));ami['on']('custom:agentconnect',this[_0x0bb0('0x20')][_0x0bb0('0x21')](this));ami['on'](_0x0bb0('0x22'),this[_0x0bb0('0x20')][_0x0bb0('0x21')](this));ami['on'](_0x0bb0('0x23'),this[_0x0bb0('0x20')]['bind'](this));ami['on'](_0x0bb0('0x24'),this[_0x0bb0('0x20')][_0x0bb0('0x21')](this));ami['on'](_0x0bb0('0x25'),this['syncCustomEvent']['bind'](this));ami['on'](_0x0bb0('0x26'),this[_0x0bb0('0x20')]['bind'](this));ami['on'](_0x0bb0('0x27'),this['syncCustomEvent']['bind'](this));ami['on'](_0x0bb0('0x28'),this[_0x0bb0('0x20')][_0x0bb0('0x21')](this));ami['on']('custom:amd',this[_0x0bb0('0x20')]['bind'](this));ami['on'](_0x0bb0('0x29'),this['syncCustomEvent']['bind'](this));ami['on']('custom:timeout',this[_0x0bb0('0x20')]['bind'](this));ami['on'](_0x0bb0('0x2a'),this[_0x0bb0('0x2b')][_0x0bb0('0x21')](this));ami['on'](_0x0bb0('0x2c'),this[_0x0bb0('0x2b')]['bind'](this));ami['on'](_0x0bb0('0x2d'),this[_0x0bb0('0x2b')]['bind'](this));ami['on'](_0x0bb0('0x2e'),this[_0x0bb0('0x20')][_0x0bb0('0x21')](this));ami['on'](_0x0bb0('0x2f'),this['syncCustomEvent']['bind'](this));ami['on'](_0x0bb0('0x30'),this[_0x0bb0('0x20')][_0x0bb0('0x21')](this));ami['on']('custom:incomingmessage',this[_0x0bb0('0x20')]['bind'](this));ami['on'](_0x0bb0('0x31'),this['syncCustomEvent'][_0x0bb0('0x21')](this));ami['on'](_0x0bb0('0x32'),this[_0x0bb0('0x20')][_0x0bb0('0x21')](this));ami['on']('custom:rejectmessage',this[_0x0bb0('0x20')]['bind'](this));ami['on'](_0x0bb0('0x33'),this[_0x0bb0('0x20')][_0x0bb0('0x21')](this));}Trigger[_0x0bb0('0x34')][_0x0bb0('0x35')]=function(_0x1105ae,_0x435b89,_0x444363){logger[_0x0bb0('0x36')](_0x1105ae,_0x435b89,JSON['stringify'](_0x444363));io['to'](_0x1105ae)[_0x0bb0('0x35')](_0x435b89,_0x444363);};Trigger[_0x0bb0('0x34')][_0x0bb0('0x20')]=function(_0x22dd6d){var _0x538a00=_['clone'](_0x22dd6d);if(typeof _0x538a00[_0x0bb0('0x37')]==='undefined'){_0x538a00[_0x0bb0('0x37')]=_0x0bb0('0x38');}logger[_0x0bb0('0x39')]('syncCustomEvent',util[_0x0bb0('0x3a')](_0x538a00,{'showHidden':!![],'depth':null}));this[_0x0bb0('0x3b')](_0x538a00);};Trigger[_0x0bb0('0x34')][_0x0bb0('0x2b')]=function(_0x332250){if(this['agents'][_0x332250[_0x0bb0('0x3c')]]){this[_0x0bb0('0x20')](_0x332250);}};Trigger[_0x0bb0('0x34')][_0x0bb0('0x3b')]=function(_0x744edc){var _0xb473f8;for(var _0x5384df in this[_0x0bb0('0xf')]){if(this['triggers']['hasOwnProperty'](_0x5384df)){if(this[_0x0bb0('0xf')][_0x5384df][_0x0bb0('0x3d')]){_0xb473f8=this['checkTrigger'](this[_0x0bb0('0xf')][_0x5384df],_0x744edc);if(_0xb473f8){_[_0x0bb0('0x3e')](_0x744edc,_0x744edc['variables']);for(var _0x31c436=0x0,_0x330343,_0x12a4ba,_0x2e44d2;_0x31c4360x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe14b,0x93));var _0xbe14=function(_0x564219,_0x45396c){_0x564219=_0x564219-0x0;var _0x3988c2=_0xe14b[_0x564219];return _0x3988c2;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ 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 7a51a8d..fda198d 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 _0xb5b5=['https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','resolve','POST','clientId','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','username','userId','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','4.0','body','headers','odata-entityid','substring','enduserId','toLowerCase','contacts?$select=','\x20eq\x20\x27','replace','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','idField','indexOf','ticketType','incident','incidents','assign','getString','Subjects','/contacts(','callDirection','queue','phonecalls','Descriptions','Fields','lastIndexOf','ticketId','format','user:%s','emit','trigger:browser:url','data7','stripTrailingSlash','serverUrl','unmanaged','outbound','%s/api/data/v9.0/'];(function(_0x4bacb6,_0x2b299d){var _0x58c029=function(_0x2faaf5){while(--_0x2faaf5){_0x4bacb6['push'](_0x4bacb6['shift']());}};_0x58c029(++_0x2b299d);}(_0xb5b5,0xf4));var _0x5b5b=function(_0x5a4b42,_0x2b9c18){_0x5a4b42=_0x5a4b42-0x0;var _0x5e81d6=_0xb5b5[_0x5a4b42];return _0x5e81d6;};'use strict';var _=require(_0x5b5b('0x0'));var rp=require('request-promise');var util=require(_0x5b5b('0x1'));var intUtil=require(_0x5b5b('0x2'));var md5=require(_0x5b5b('0x3'));var Redis=require(_0x5b5b('0x4'));var logger=require(_0x5b5b('0x5'))(_0x5b5b('0x6'));var config=require(_0x5b5b('0x7'));config[_0x5b5b('0x8')]=_[_0x5b5b('0x9')](config[_0x5b5b('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x5b5b('0xa'))(new Redis(config[_0x5b5b('0x8')]));function getAuthToken(_0xa76d2c,_0x3a1ee5,_0x2e983c){if(_0xa76d2c[_0x5b5b('0xb')]){_0xa76d2c[_0x5b5b('0xc')]=_0xa76d2c[_0x5b5b('0xd')]['data7'];_0xa76d2c[_0x5b5b('0xe')]=_0xa76d2c[_0x5b5b('0xd')]['data2'];return Promise[_0x5b5b('0xf')](_0xa76d2c[_0x5b5b('0xd')]['data5']);}var _0x119da2={'method':_0x5b5b('0x10'),'uri':_0x3a1ee5,'form':{'client_id':_0xa76d2c[_0x5b5b('0x11')],'resource':_0xa76d2c[_0x5b5b('0xc')],'username':_0xa76d2c['username'],'password':_0xa76d2c[_0x5b5b('0x12')],'grant_type':'password','client_secret':_0xa76d2c[_0x5b5b('0x13')]},'json':!![]};return rp(_0x119da2)[_0x5b5b('0x14')](function(_0x593de8){return _0x593de8[_0x5b5b('0x15')];})[_0x5b5b('0x16')](function(_0x2c6b7d){logger[_0x5b5b('0x17')]('['+[_0x2e983c[_0x5b5b('0x18')]()]+_0x5b5b('0x19'));return _0x2c6b7d[_0x5b5b('0x1a')];});}function getUser(_0x103323,_0x1226ee,_0x24c1c2,_0x572017,_0xa54151,_0x25e340){return new Promise(function(_0x63387b,_0x37b064){return getAuthToken(_0x1226ee,_0x572017,_0x25e340)[_0x5b5b('0x14')](function(_0x288d15){var _0x1c6920={'method':_0x5b5b('0x1b'),'uri':_0xa54151+_0x5b5b('0x1c'),'headers':{'Authorization':'Bearer\x20'+_0x288d15,'OData-Version':'4.0'},'json':!![]};return rp(_0x1c6920);})[_0x5b5b('0x14')](function(_0x29ca86){var _0x4b4cc5=_0x29ca86[_0x5b5b('0x1d')];var _0x1646e5=![];var _0x104ba5=null;if(!_[_0x5b5b('0x1e')](_0x24c1c2)){if(intUtil[_0x5b5b('0x1f')](_0x24c1c2[_0x5b5b('0x20')])){_0x103323[_0x5b5b('0x21')]=_0x24c1c2[_0x5b5b('0x20')];for(_0x104ba5=0x0;_0x104ba5<_0x4b4cc5[_0x5b5b('0x22')];_0x104ba5++){if(_0x4b4cc5[_0x104ba5]['internalemailaddress']===_0x24c1c2[_0x5b5b('0x20')]&&!_0x4b4cc5[_0x104ba5][_0x5b5b('0x23')]){_0x1646e5=!![];logger[_0x5b5b('0x24')]('['+[_0x25e340['toUpperCase']()]+_0x5b5b('0x25')+_0x4b4cc5[_0x104ba5][_0x5b5b('0x26')]+'!');_0x103323['userId']=_0x4b4cc5[_0x104ba5][_0x5b5b('0x26')];}}}}if(!_0x1646e5){logger['info']('['+[_0x25e340[_0x5b5b('0x18')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x103323[_0x5b5b('0x21')]=_0x1226ee[_0x5b5b('0x27')];for(_0x104ba5=0x0;_0x104ba5<_0x4b4cc5['length'];_0x104ba5++){if(_0x4b4cc5[_0x104ba5]['internalemailaddress']===_0x1226ee['username']){_0x103323[_0x5b5b('0x28')]=_0x4b4cc5[_0x104ba5][_0x5b5b('0x26')];}}}_0x63387b(_0x103323);})[_0x5b5b('0x16')](function(_0x9c928b){_0x37b064(_0x9c928b[_0x5b5b('0x1a')]);});});}function createEndUser(_0x38f0cf,_0x11f50,_0x39490a,_0x418dda,_0x68a43e,_0x1308cb,_0x58f781){return new Promise(function(_0x547e78,_0x18f3fb){return getAuthToken(_0x11f50,_0x39490a,_0x1308cb)[_0x5b5b('0x14')](function(_0x487a5d){var _0xe02423=_0x1308cb['toLowerCase']()==='outbound'?_0x68a43e[_0x5b5b('0x29')]:_0x68a43e[_0x5b5b('0x2a')];var _0x3f7fad={'method':_0x5b5b('0x10'),'uri':_0x418dda+_0x5b5b('0x2b'),'body':{'fullname':_0xe02423,'firstname':_0xe02423,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5b5b('0x2c')+_0x38f0cf[_0x5b5b('0x28')]+')'},'headers':{'Authorization':_0x5b5b('0x2d')+_0x487a5d,'OData-Version':_0x5b5b('0x2e')},'json':!![],'resolveWithFullResponse':!![]};_0x3f7fad[_0x5b5b('0x2f')][_0x58f781]=_0xe02423;return rp(_0x3f7fad);})[_0x5b5b('0x14')](function(_0x2fe7d1){var _0x2932c8=_0x2fe7d1[_0x5b5b('0x30')][_0x5b5b('0x31')];var _0x278a32=_0x2932c8[_0x5b5b('0x32')](_0x2932c8['lastIndexOf']('(')+0x1,_0x2932c8['lastIndexOf'](')'));_0x38f0cf[_0x5b5b('0x33')]=_0x278a32;_0x547e78(_0x38f0cf);})['catch'](function(_0x5cec99){_0x18f3fb(_0x5cec99['message']);});});}function getEndUser(_0x202697,_0x3b13ac,_0x21c354,_0xf2560d,_0x5e28d4,_0x4b2d75,_0x2bec86,_0xa08bb){var _0x49a76e=_0x4b2d75[_0x5b5b('0x34')]()==='outbound'?_0x5e28d4[_0x5b5b('0x29')]:_0x5e28d4[_0x5b5b('0x2a')];return getAuthToken(_0x3b13ac,_0x21c354,_0x4b2d75)[_0x5b5b('0x14')](function(_0x3512e8){_0xa08bb=_0xa08bb?_0xa08bb:'telephone1';var _0x1b3481={'method':_0x5b5b('0x1b'),'uri':_0xf2560d+_0x5b5b('0x35')+_0xa08bb+'&$filter='+_0xa08bb+_0x5b5b('0x36')+_0x49a76e[_0x5b5b('0x37')]('+',_0x5b5b('0x38'))+'\x27','headers':{'Authorization':_0x5b5b('0x2d')+_0x3512e8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1b3481);})[_0x5b5b('0x14')](function(_0x144a4c){var _0x2ea062=![];if(!_0x144a4c)return _0x2ea062;var _0x2bb301=_0x144a4c[_0x5b5b('0x1d')];for(var _0x48b92a=0x0;_0x48b92a<_0x2bb301[_0x5b5b('0x22')];_0x48b92a++){if(_0x2bb301[_0x48b92a][_0xa08bb]===_0x49a76e){_0x2ea062=!![];_0x202697[_0x5b5b('0x33')]=_0x2bb301[_0x48b92a]['contactid'];}}return _0x2ea062;})['then'](function(_0x45fd05){if(_0x45fd05)return _0x202697;if(_0x2bec86===_0x5b5b('0x39')){logger[_0x5b5b('0x24')]('['+[_0x4b2d75['toUpperCase']()]+_0x5b5b('0x3a'));return _0x202697;}return createEndUser(_0x202697,_0x3b13ac,_0x21c354,_0xf2560d,_0x5e28d4,_0x4b2d75,_0xa08bb)[_0x5b5b('0x14')](function(_0x58dd38){logger[_0x5b5b('0x24')]('['+[_0x4b2d75['toUpperCase']()]+_0x5b5b('0x3b'),_0x58dd38[_0x5b5b('0x33')]);return _0x58dd38;});});}function getCustomFields(_0x2b05b7,_0x27b12d,_0x249182){var _0x44c39c={};if(_0x2b05b7[_0x5b5b('0x22')]>0x0){_[_0x5b5b('0x3c')](_0x2b05b7,function(_0x1dfe97){if(_[_0x5b5b('0x3d')](['string',_0x5b5b('0x3e')],_0x1dfe97[_0x5b5b('0x3f')])&&_0x1dfe97[_0x5b5b('0x40')]&&!_0x1dfe97[_0x5b5b('0x41')]){var _0x721bf1=_0x1dfe97[_0x5b5b('0x42')][_0x5b5b('0x34')]();var _0x41efac=_0x721bf1[_0x5b5b('0x32')](0x0,_0x721bf1[_0x5b5b('0x43')]('_'));var _0x3d1fdc=_0x721bf1[_0x5b5b('0x32')](_0x721bf1[_0x5b5b('0x43')]('_')+0x1);if(_0x41efac===_0x249182){_0x44c39c[_0x3d1fdc]=_0x1dfe97['content'];}}});}return _0x44c39c;}function getTicket(_0x2a4411,_0x56e0cb,_0x261ebc,_0xe5cd17,_0x13903c,_0x1a6e37,_0x8db0d9){return new Promise(function(_0x241315,_0x36c8c5){var _0x10da75;return getAuthToken(_0x56e0cb,_0x261ebc,_0x8db0d9)[_0x5b5b('0x14')](function(_0x4395e5){if(_0x1a6e37[_0x5b5b('0x44')]===_0x5b5b('0x45')){_0x10da75={'method':_0x5b5b('0x10'),'uri':_0xe5cd17+_0x5b5b('0x46'),'body':Object[_0x5b5b('0x47')]({},{'title':intUtil[_0x5b5b('0x48')](_0x1a6e37[_0x5b5b('0x49')],_0x13903c,'\x20'),'description':intUtil[_0x5b5b('0x48')](_0x1a6e37['Descriptions'],_0x13903c,'\x0a'),'customerid_contact@odata.bind':_0x2a4411[_0x5b5b('0x33')]?'/contacts('+_0x2a4411[_0x5b5b('0x33')]+')':undefined,'ownerid@odata.bind':_0x5b5b('0x2c')+_0x2a4411[_0x5b5b('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x1a6e37['Fields'],_0x13903c,_0x1a6e37[_0x5b5b('0x44')])),'headers':{'Authorization':'Bearer\x20'+_0x4395e5,'OData-Version':_0x5b5b('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1a6e37[_0x5b5b('0x44')]==='phonecall'){var _0x342c7d=_0x2a4411[_0x5b5b('0x33')]?[{'partyid_systemuser@odata.bind':_0x5b5b('0x2c')+_0x2a4411[_0x5b5b('0x28')]+')','participationtypemask':_0x2a4411['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x5b5b('0x4a')+_0x2a4411[_0x5b5b('0x33')]+')','participationtypemask':_0x2a4411[_0x5b5b('0x4b')]===_0x5b5b('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2a4411[_0x5b5b('0x28')]+')','participationtypemask':_0x2a4411[_0x5b5b('0x4b')]==='queue'?0x2:0x1}];_0x10da75={'method':_0x5b5b('0x10'),'uri':_0xe5cd17+_0x5b5b('0x4d'),'body':Object[_0x5b5b('0x47')]({},{'subject':intUtil[_0x5b5b('0x48')](_0x1a6e37['Subjects'],_0x13903c,'\x20'),'phonenumber':String(_0x13903c['calleridnum']),'description':intUtil[_0x5b5b('0x48')](_0x1a6e37[_0x5b5b('0x4e')],_0x13903c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2a4411[_0x5b5b('0x33')]?_0x5b5b('0x4a')+_0x2a4411[_0x5b5b('0x33')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2a4411[_0x5b5b('0x28')]+')','directioncode':_0x2a4411[_0x5b5b('0x4b')]===_0x5b5b('0x4c')?![]:!![],'phonecall_activity_parties':_0x342c7d},getCustomFields(_0x1a6e37[_0x5b5b('0x4f')],_0x13903c,_0x1a6e37['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x4395e5,'OData-Version':_0x5b5b('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x10da75);})['then'](function(_0x521b4e){var _0x36e83c=_0x521b4e[_0x5b5b('0x30')][_0x5b5b('0x31')];var _0x29952e=_0x36e83c['substring'](_0x36e83c[_0x5b5b('0x50')]('(')+0x1,_0x36e83c[_0x5b5b('0x50')](')'));_0x2a4411[_0x5b5b('0x51')]=_0x29952e;_0x241315(_0x2a4411);})[_0x5b5b('0x16')](function(_0x24795b){_0x36c8c5(_0x24795b[_0x5b5b('0x1a')]);});});}function emit(_0x4150e6,_0x36b286,_0x1ee37d,_0x49c042){var _0x168da9={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x4150e6,_0x1ee37d,_0x49c042)};io['to'](util[_0x5b5b('0x52')](_0x5b5b('0x53'),_0x36b286))[_0x5b5b('0x54')](_0x5b5b('0x55'),_0x168da9);}exports['cs']=function(_0x35d0f2,_0x4c558f,_0xe29698,_0x4397e3,_0x759fe5,_0x293496,_0x408230,_0x4a6558){var _0x4771aa={};_0x293496['remoteUri']=_0x293496[_0x5b5b('0xb')]?intUtil['stripTrailingSlash'](_0x293496[_0x5b5b('0xd')][_0x5b5b('0x56')]):intUtil[_0x5b5b('0x57')](_0x293496[_0x5b5b('0xc')]);_0x293496[_0x5b5b('0x58')]=intUtil[_0x5b5b('0x57')](_0x293496[_0x5b5b('0x58')]);_0x4771aa['callDirection']=_0x4a6558===_0x5b5b('0x4c')||_0x4a6558===_0x5b5b('0x59')?_0x5b5b('0x4c'):_0x5b5b('0x5a');var _0x5e842a=_0x293496[_0x5b5b('0xb')]?util[_0x5b5b('0x52')](_0x5b5b('0x5b'),_0x293496[_0x5b5b('0xd')][_0x5b5b('0x56')]):util[_0x5b5b('0x52')](_0x5b5b('0x5b'),_0x293496[_0x5b5b('0xc')]);var _0x3889fd=util[_0x5b5b('0x52')](_0x5b5b('0x5c'),_0x293496['tenantId']);var _0x232752=util[_0x5b5b('0x52')](_0x5b5b('0x5d'),_0x293496[_0x5b5b('0x58')],_0x4c558f[_0x5b5b('0x5e')],md5(_0x4c558f[_0x5b5b('0x5e')]));if(_0x759fe5&&_0x759fe5['monitor_format']){logger[_0x5b5b('0x24')](_0x5b5b('0x5f'),_0x5b5b('0x60'));_0x4c558f[_0x5b5b('0x61')]=_0x232752;}else if(_0x408230&&_0x408230[_0x5b5b('0x62')]&&_0x408230['recordingFormat']!==_0x5b5b('0x63')){logger[_0x5b5b('0x24')](_0x5b5b('0x64'),'Recording\x20is\x20enabled!');_0x4c558f[_0x5b5b('0x61')]=_0x232752;}else{_0x4c558f[_0x5b5b('0x61')]='';}return getUser(_0x4771aa,_0x293496,_0x4397e3,_0x3889fd,_0x5e842a,_0x4a6558)[_0x5b5b('0x14')](function(_0x461910){logger[_0x5b5b('0x24')]('['+_0x4a6558[_0x5b5b('0x18')]()+_0x5b5b('0x65'),_0x461910[_0x5b5b('0x28')]);logger[_0x5b5b('0x24')]('['+_0x4a6558['toUpperCase']()+_0x5b5b('0x66'),_0x461910[_0x5b5b('0x21')]);return getEndUser(_0x461910,_0x293496,_0x3889fd,_0x5e842a,_0x4c558f,_0x4a6558,_0xe29698[_0x5b5b('0x67')],_0xe29698['additionalSearchContact']);})[_0x5b5b('0x14')](function(_0x262a73){logger['info']('['+_0x4a6558[_0x5b5b('0x18')]()+_0x5b5b('0x68'),_0x262a73['enduserId']);logger['info']('['+_0x4a6558[_0x5b5b('0x18')]()+_0x5b5b('0x69'),_0x4c558f['calleridnum']);return getTicket(_0x262a73,_0x293496,_0x3889fd,_0x5e842a,_0x4c558f,_0xe29698,_0x4a6558);})[_0x5b5b('0x14')](function(_0x46f554){logger[_0x5b5b('0x24')](util[_0x5b5b('0x52')]('['+_0x4a6558[_0x5b5b('0x18')]()+_0x5b5b('0x6a'),_0xe29698[_0x5b5b('0x44')],_0x46f554[_0x5b5b('0x51')]));logger[_0x5b5b('0x24')](util[_0x5b5b('0x52')]('['+_0x4a6558[_0x5b5b('0x18')]()+_0x5b5b('0x6b'),_0x4a6558));if(_0x4a6558!=='unmanaged'&&_0xe29698['openNewTab']){logger[_0x5b5b('0x24')]('['+_0x4a6558[_0x5b5b('0x18')]()+']',_0x5b5b('0x6c'));emit(_0x293496[_0x5b5b('0xc')],_0x4397e3[_0x5b5b('0x6d')],_0xe29698[_0x5b5b('0x44')],_0x46f554['ticketId']);}})[_0x5b5b('0x16')](function(_0xd34c61){logger[_0x5b5b('0x17')]('['+_0x4a6558[_0x5b5b('0x18')]()+_0x5b5b('0x6e'),_0xd34c61[_0x5b5b('0x1a')]);console['error'](_0x5b5b('0x6f'),_0xd34c61);});}; \ No newline at end of file +var _0x1941=['odata-entityid','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','stripTrailingSlash','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data5','username','password','clientSecret','then','access_token','catch','error','message','GET','Bearer\x20','4.0','validateEmail','email','length','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','userEmail','internalemailaddress','outbound','destcalleridnum','POST','contacts','body','headers','substring','lastIndexOf','enduserId','toLowerCase','calleridnum','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','value','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','nameField','customField','indexOf','content','incident','incidents','assign','getString','Descriptions','/systemusers(','Fields','ticketType','phonecall','callDirection','queue','/contacts(','phonecalls','Subjects'];(function(_0x2c4db6,_0x58bad4){var _0xad0dcf=function(_0x3cd52a){while(--_0x3cd52a){_0x2c4db6['push'](_0x2c4db6['shift']());}};_0xad0dcf(++_0x58bad4);}(_0x1941,0x1d3));var _0x1194=function(_0x55f264,_0x3640bf){_0x55f264=_0x55f264-0x0;var _0x3e8be8=_0x1941[_0x55f264];return _0x3e8be8;};'use strict';var _=require(_0x1194('0x0'));var rp=require(_0x1194('0x1'));var util=require(_0x1194('0x2'));var intUtil=require('./util');var md5=require(_0x1194('0x3'));var Redis=require(_0x1194('0x4'));var logger=require(_0x1194('0x5'))(_0x1194('0x6'));var config=require(_0x1194('0x7'));config[_0x1194('0x8')]=_['defaults'](config['redis'],{'host':_0x1194('0x9'),'port':0x18eb});var io=require(_0x1194('0xa'))(new Redis(config[_0x1194('0x8')]));function getAuthToken(_0x4fdfdb,_0x20ad0d,_0x476633){if(_0x4fdfdb[_0x1194('0xb')]){_0x4fdfdb[_0x1194('0xc')]=_0x4fdfdb[_0x1194('0xd')][_0x1194('0xe')];_0x4fdfdb[_0x1194('0xf')]=_0x4fdfdb[_0x1194('0xd')]['data2'];return Promise['resolve'](_0x4fdfdb['CloudProvider'][_0x1194('0x10')]);}var _0x1c7316={'method':'POST','uri':_0x20ad0d,'form':{'client_id':_0x4fdfdb['clientId'],'resource':_0x4fdfdb[_0x1194('0xc')],'username':_0x4fdfdb[_0x1194('0x11')],'password':_0x4fdfdb['password'],'grant_type':_0x1194('0x12'),'client_secret':_0x4fdfdb[_0x1194('0x13')]},'json':!![]};return rp(_0x1c7316)[_0x1194('0x14')](function(_0x582267){return _0x582267[_0x1194('0x15')];})[_0x1194('0x16')](function(_0x1c69f1){logger[_0x1194('0x17')]('['+[_0x476633['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x1c69f1[_0x1194('0x18')];});}function getUser(_0xbb91a8,_0x5b938e,_0x11f576,_0x347598,_0x120a67,_0x25a580){return new Promise(function(_0x2ee5ad,_0x483117){return getAuthToken(_0x5b938e,_0x347598,_0x25a580)['then'](function(_0x45d6ba){var _0x181504={'method':_0x1194('0x19'),'uri':_0x120a67+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x1194('0x1a')+_0x45d6ba,'OData-Version':_0x1194('0x1b')},'json':!![]};return rp(_0x181504);})[_0x1194('0x14')](function(_0x55494e){var _0x21bacd=_0x55494e['value'];var _0x4429f3=![];var _0x895b7d=null;if(!_['isNil'](_0x11f576)){if(intUtil[_0x1194('0x1c')](_0x11f576['email'])){_0xbb91a8['userEmail']=_0x11f576[_0x1194('0x1d')];for(_0x895b7d=0x0;_0x895b7d<_0x21bacd[_0x1194('0x1e')];_0x895b7d++){if(_0x21bacd[_0x895b7d]['internalemailaddress']===_0x11f576[_0x1194('0x1d')]&&!_0x21bacd[_0x895b7d][_0x1194('0x1f')]){_0x4429f3=!![];logger[_0x1194('0x20')]('['+[_0x25a580[_0x1194('0x21')]()]+_0x1194('0x22')+_0x21bacd[_0x895b7d][_0x1194('0x23')]+'!');_0xbb91a8[_0x1194('0x24')]=_0x21bacd[_0x895b7d][_0x1194('0x23')];}}}}if(!_0x4429f3){logger[_0x1194('0x20')]('['+[_0x25a580[_0x1194('0x21')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0xbb91a8[_0x1194('0x25')]=_0x5b938e[_0x1194('0x11')];for(_0x895b7d=0x0;_0x895b7d<_0x21bacd['length'];_0x895b7d++){if(_0x21bacd[_0x895b7d][_0x1194('0x26')]===_0x5b938e[_0x1194('0x11')]){_0xbb91a8[_0x1194('0x24')]=_0x21bacd[_0x895b7d]['systemuserid'];}}}_0x2ee5ad(_0xbb91a8);})[_0x1194('0x16')](function(_0x217729){_0x483117(_0x217729[_0x1194('0x18')]);});});}function createEndUser(_0x180cf7,_0x5a131f,_0x2a35ef,_0x290664,_0x59b91f,_0x128ebf,_0x1d8ae3){return new Promise(function(_0xeee708,_0x373720){return getAuthToken(_0x5a131f,_0x2a35ef,_0x128ebf)[_0x1194('0x14')](function(_0x5c1a79){var _0x2f8bd9=_0x128ebf['toLowerCase']()===_0x1194('0x27')?_0x59b91f[_0x1194('0x28')]:_0x59b91f['calleridnum'];var _0x4e3747={'method':_0x1194('0x29'),'uri':_0x290664+_0x1194('0x2a'),'body':{'fullname':_0x2f8bd9,'firstname':_0x2f8bd9,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x180cf7['userId']+')'},'headers':{'Authorization':_0x1194('0x1a')+_0x5c1a79,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x4e3747[_0x1194('0x2b')][_0x1d8ae3]=_0x2f8bd9;return rp(_0x4e3747);})['then'](function(_0x29137e){var _0x3847f3=_0x29137e[_0x1194('0x2c')]['odata-entityid'];var _0x17c8a3=_0x3847f3[_0x1194('0x2d')](_0x3847f3[_0x1194('0x2e')]('(')+0x1,_0x3847f3[_0x1194('0x2e')](')'));_0x180cf7[_0x1194('0x2f')]=_0x17c8a3;_0xeee708(_0x180cf7);})[_0x1194('0x16')](function(_0x1b2b85){_0x373720(_0x1b2b85[_0x1194('0x18')]);});});}function getEndUser(_0x2f1a5e,_0x3272b6,_0x1bbe88,_0x20d004,_0xdf4fd3,_0x105582,_0x4f8b17,_0x5c11b4){var _0xa3fa57=_0x105582[_0x1194('0x30')]()===_0x1194('0x27')?_0xdf4fd3[_0x1194('0x28')]:_0xdf4fd3[_0x1194('0x31')];return getAuthToken(_0x3272b6,_0x1bbe88,_0x105582)[_0x1194('0x14')](function(_0x8bd8cb){_0x5c11b4=_0x5c11b4?_0x5c11b4:_0x1194('0x32');var _0x1d5c8f={'method':'GET','uri':_0x20d004+_0x1194('0x33')+_0x5c11b4+_0x1194('0x34')+_0x5c11b4+_0x1194('0x35')+_0xa3fa57[_0x1194('0x36')]('+',_0x1194('0x37'))+'\x27','headers':{'Authorization':_0x1194('0x1a')+_0x8bd8cb,'If-None-Match':null,'OData-Version':_0x1194('0x1b')},'json':!![]};return rp(_0x1d5c8f);})[_0x1194('0x14')](function(_0x50cb7a){var _0x561b5e=![];if(!_0x50cb7a)return _0x561b5e;var _0x24050f=_0x50cb7a[_0x1194('0x38')];for(var _0x9f430b=0x0;_0x9f430b<_0x24050f[_0x1194('0x1e')];_0x9f430b++){if(_0x24050f[_0x9f430b][_0x5c11b4]===_0xa3fa57){_0x561b5e=!![];_0x2f1a5e[_0x1194('0x2f')]=_0x24050f[_0x9f430b][_0x1194('0x39')];}}return _0x561b5e;})[_0x1194('0x14')](function(_0x2f3096){if(_0x2f3096)return _0x2f1a5e;if(_0x4f8b17===_0x1194('0x3a')){logger[_0x1194('0x20')]('['+[_0x105582[_0x1194('0x21')]()]+_0x1194('0x3b'));return _0x2f1a5e;}return createEndUser(_0x2f1a5e,_0x3272b6,_0x1bbe88,_0x20d004,_0xdf4fd3,_0x105582,_0x5c11b4)[_0x1194('0x14')](function(_0x8d14cf){logger[_0x1194('0x20')]('['+[_0x105582[_0x1194('0x21')]()]+_0x1194('0x3c'),_0x8d14cf['enduserId']);return _0x8d14cf;});});}function getCustomFields(_0x245177,_0x521a4e,_0x5958f5){var _0x4483b9={};if(_0x245177[_0x1194('0x1e')]>0x0){_[_0x1194('0x3d')](_0x245177,function(_0x4ab16b){if(_['includes']([_0x1194('0x3e'),_0x1194('0x3f')],_0x4ab16b[_0x1194('0x40')])&&_0x4ab16b[_0x1194('0x41')]&&!_0x4ab16b[_0x1194('0x42')]){var _0x65c1ef=_0x4ab16b['idField'][_0x1194('0x30')]();var _0x3abb28=_0x65c1ef[_0x1194('0x2d')](0x0,_0x65c1ef[_0x1194('0x43')]('_'));var _0x3b476a=_0x65c1ef[_0x1194('0x2d')](_0x65c1ef['indexOf']('_')+0x1);if(_0x3abb28===_0x5958f5){_0x4483b9[_0x3b476a]=_0x4ab16b[_0x1194('0x44')];}}});}return _0x4483b9;}function getTicket(_0x16d96d,_0x153f5d,_0x4ff075,_0x10059f,_0x14dfc7,_0x55cea8,_0x5f558c){return new Promise(function(_0x14eee8,_0x2d1037){var _0x39c951;return getAuthToken(_0x153f5d,_0x4ff075,_0x5f558c)[_0x1194('0x14')](function(_0x19f16e){if(_0x55cea8['ticketType']===_0x1194('0x45')){_0x39c951={'method':'POST','uri':_0x10059f+_0x1194('0x46'),'body':Object[_0x1194('0x47')]({},{'title':intUtil[_0x1194('0x48')](_0x55cea8['Subjects'],_0x14dfc7,'\x20'),'description':intUtil[_0x1194('0x48')](_0x55cea8[_0x1194('0x49')],_0x14dfc7,'\x0a'),'customerid_contact@odata.bind':_0x16d96d[_0x1194('0x2f')]?'/contacts('+_0x16d96d['enduserId']+')':undefined,'ownerid@odata.bind':_0x1194('0x4a')+_0x16d96d[_0x1194('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x55cea8[_0x1194('0x4b')],_0x14dfc7,_0x55cea8[_0x1194('0x4c')])),'headers':{'Authorization':_0x1194('0x1a')+_0x19f16e,'OData-Version':_0x1194('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x55cea8[_0x1194('0x4c')]===_0x1194('0x4d')){var _0x59fa63=_0x16d96d['enduserId']?[{'partyid_systemuser@odata.bind':_0x1194('0x4a')+_0x16d96d[_0x1194('0x24')]+')','participationtypemask':_0x16d96d[_0x1194('0x4e')]===_0x1194('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x1194('0x50')+_0x16d96d[_0x1194('0x2f')]+')','participationtypemask':_0x16d96d[_0x1194('0x4e')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x1194('0x4a')+_0x16d96d[_0x1194('0x24')]+')','participationtypemask':_0x16d96d[_0x1194('0x4e')]==='queue'?0x2:0x1}];_0x39c951={'method':'POST','uri':_0x10059f+_0x1194('0x51'),'body':Object[_0x1194('0x47')]({},{'subject':intUtil['getString'](_0x55cea8[_0x1194('0x52')],_0x14dfc7,'\x20'),'phonenumber':String(_0x14dfc7['calleridnum']),'description':intUtil[_0x1194('0x48')](_0x55cea8[_0x1194('0x49')],_0x14dfc7,'\x0a'),'regardingobjectid_contact@odata.bind':_0x16d96d[_0x1194('0x2f')]?_0x1194('0x50')+_0x16d96d['enduserId']+')':undefined,'ownerid@odata.bind':_0x1194('0x4a')+_0x16d96d[_0x1194('0x24')]+')','directioncode':_0x16d96d[_0x1194('0x4e')]===_0x1194('0x4f')?![]:!![],'phonecall_activity_parties':_0x59fa63},getCustomFields(_0x55cea8[_0x1194('0x4b')],_0x14dfc7,_0x55cea8[_0x1194('0x4c')])),'headers':{'Authorization':_0x1194('0x1a')+_0x19f16e,'OData-Version':_0x1194('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x39c951);})[_0x1194('0x14')](function(_0xc0588e){var _0x4bc681=_0xc0588e['headers'][_0x1194('0x53')];var _0x367d7b=_0x4bc681['substring'](_0x4bc681[_0x1194('0x2e')]('(')+0x1,_0x4bc681[_0x1194('0x2e')](')'));_0x16d96d['ticketId']=_0x367d7b;_0x14eee8(_0x16d96d);})[_0x1194('0x16')](function(_0x16ce18){_0x2d1037(_0x16ce18[_0x1194('0x18')]);});});}function emit(_0x27e01a,_0x24130c,_0xdb366b,_0x2678e1){var _0x97ba17={'uri':util['format'](_0x1194('0x54'),_0x27e01a,_0xdb366b,_0x2678e1)};io['to'](util[_0x1194('0x55')](_0x1194('0x56'),_0x24130c))[_0x1194('0x57')]('trigger:browser:url',_0x97ba17);}exports['cs']=function(_0xd4289,_0x24b3b,_0x5e4321,_0x477631,_0x44fc38,_0x42ffa1,_0xf73d70,_0x515f1e){var _0x473ddc={};_0x42ffa1[_0x1194('0xc')]=_0x42ffa1[_0x1194('0xb')]?intUtil[_0x1194('0x58')](_0x42ffa1[_0x1194('0xd')][_0x1194('0xe')]):intUtil[_0x1194('0x58')](_0x42ffa1['remoteUri']);_0x42ffa1['serverUrl']=intUtil['stripTrailingSlash'](_0x42ffa1['serverUrl']);_0x473ddc[_0x1194('0x4e')]=_0x515f1e===_0x1194('0x4f')||_0x515f1e==='unmanaged'?_0x1194('0x4f'):_0x1194('0x27');var _0x12119=_0x42ffa1[_0x1194('0xb')]?util[_0x1194('0x55')](_0x1194('0x59'),_0x42ffa1[_0x1194('0xd')][_0x1194('0xe')]):util[_0x1194('0x55')](_0x1194('0x59'),_0x42ffa1[_0x1194('0xc')]);var _0x548c74=util[_0x1194('0x55')](_0x1194('0x5a'),_0x42ffa1[_0x1194('0xf')]);var _0x2f81a3=util[_0x1194('0x55')](_0x1194('0x5b'),_0x42ffa1['serverUrl'],_0x24b3b[_0x1194('0x5c')],md5(_0x24b3b[_0x1194('0x5c')]));if(_0x44fc38&&_0x44fc38[_0x1194('0x5d')]){logger['info'](_0x1194('0x5e'),'Recording\x20is\x20enabled!');_0x24b3b['recordingURL']=_0x2f81a3;}else if(_0xf73d70&&_0xf73d70['recordingFormat']&&_0xf73d70[_0x1194('0x5f')]!==_0x1194('0x60')){logger['info'](_0x1194('0x61'),_0x1194('0x62'));_0x24b3b[_0x1194('0x63')]=_0x2f81a3;}else{_0x24b3b[_0x1194('0x63')]='';}return getUser(_0x473ddc,_0x42ffa1,_0x477631,_0x548c74,_0x12119,_0x515f1e)[_0x1194('0x14')](function(_0x21f253){logger['info']('['+_0x515f1e[_0x1194('0x21')]()+']\x20The\x20User\x20ID\x20is:',_0x21f253['userId']);logger[_0x1194('0x20')]('['+_0x515f1e[_0x1194('0x21')]()+_0x1194('0x64'),_0x21f253['userEmail']);return getEndUser(_0x21f253,_0x42ffa1,_0x548c74,_0x12119,_0x24b3b,_0x515f1e,_0x5e4321[_0x1194('0x65')],_0x5e4321['additionalSearchContact']);})['then'](function(_0x3db27f){logger[_0x1194('0x20')]('['+_0x515f1e[_0x1194('0x21')]()+_0x1194('0x66'),_0x3db27f[_0x1194('0x2f')]);logger[_0x1194('0x20')]('['+_0x515f1e['toUpperCase']()+_0x1194('0x67'),_0x24b3b[_0x1194('0x31')]);return getTicket(_0x3db27f,_0x42ffa1,_0x548c74,_0x12119,_0x24b3b,_0x5e4321,_0x515f1e);})[_0x1194('0x14')](function(_0x286288){logger[_0x1194('0x20')](util['format']('['+_0x515f1e[_0x1194('0x21')]()+_0x1194('0x68'),_0x5e4321[_0x1194('0x4c')],_0x286288[_0x1194('0x69')]));logger[_0x1194('0x20')](util[_0x1194('0x55')]('['+_0x515f1e['toUpperCase']()+_0x1194('0x6a'),_0x515f1e));if(_0x515f1e!==_0x1194('0x6b')&&_0x5e4321['openNewTab']){logger['info']('['+_0x515f1e[_0x1194('0x21')]()+']',_0x1194('0x6c'));emit(_0x42ffa1['remoteUri'],_0x477631[_0x1194('0x6d')],_0x5e4321[_0x1194('0x4c')],_0x286288['ticketId']);}})['catch'](function(_0x57d536){logger['error']('['+_0x515f1e['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x57d536[_0x1194('0x18')]);console[_0x1194('0x17')]('Error\x20running\x20Dynamics365\x20integration',_0x57d536);});}; \ 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 89745f1..a3970a4 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 _0xf876=['%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','toString','debug','[HTTP]','map','forEach','picklist','customField','toLowerCase','content','includes','string','idField','push','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','user:%s','monitor_format','lastevent','Recording\x20is\x20enabled!','toUpperCase','lodash','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','email'];(function(_0x2ab1c1,_0x39b0b6){var _0x527164=function(_0x467967){while(--_0x467967){_0x2ab1c1['push'](_0x2ab1c1['shift']());}};_0x527164(++_0x39b0b6);}(_0xf876,0x1ee));var _0x6f87=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf876[_0x432682];return _0x463d05;};'use strict';var _=require(_0x6f87('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x6f87('0x1'));var Redis=require('ioredis');var intUtil=require(_0x6f87('0x2'));var config=require(_0x6f87('0x3'));var logger=require(_0x6f87('0x4'))(_0x6f87('0x5'));config[_0x6f87('0x6')]=_[_0x6f87('0x7')](config[_0x6f87('0x6')],{'host':_0x6f87('0x8'),'port':0x18eb});var io=require(_0x6f87('0x9'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x6f87('0xa')};function emit(_0x2980e6,_0x4371f7,_0x3eec05){io['to'](_0x2980e6)['emit'](_0x4371f7,_0x3eec05);}function getTicket(_0x24edb9,_0x1624de,_0x3ad618,_0x41ca71,_0xfe36b3){logger[_0x6f87('0xb')](_0x6f87('0xc'));var _0x48d731=_[_0x6f87('0xd')]({'responder_id':_0x1624de['id'],'requester_id':_0x3ad618['id'],'name':util['format'](_0x6f87('0xe'),_0xfe36b3[_0x6f87('0xf')]),'phone':_0xfe36b3[_0x6f87('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6f87('0x11')](_0x41ca71[_0x6f87('0x12')],_0xfe36b3,'\x20'),'description':intUtil['getString'](_0x41ca71[_0x6f87('0x13')],_0xfe36b3,'
'),'tags':getTags(_0x41ca71[_0x6f87('0x14')],_0x6f87('0x15'))},getCustomFields(_0x41ca71[_0x6f87('0x16')],_0xfe36b3));_0x48d731['custom_fields']=_[_0x6f87('0x17')](_[_0x6f87('0x18')](_0x48d731[_0x6f87('0x19')],'id'),_0x6f87('0x1a'));return request({'uri':util['format'](_0x6f87('0x1b'),_0x24edb9['remoteUri']),'method':_0x6f87('0x1c'),'body':_0x48d731})[_0x6f87('0x1d')](function(_0x37be68){logger[_0x6f87('0xb')](_0x6f87('0x1e'));return _0x37be68;});}function getUser(_0x7614cf,_0x312505){if(intUtil[_0x6f87('0x1f')](_0x312505)){return request({'uri':util[_0x6f87('0x20')](_0x6f87('0x21'),_0x7614cf[_0x6f87('0x22')]),'qs':{'email':_0x312505}})['then'](function(_0x410154){if(_0x410154[_0x6f87('0x23')]){logger['info'](_0x6f87('0x24'));return _[_0x6f87('0x25')](_0x410154,function(_0x5379de){return _0x5379de[_0x6f87('0x26')][_0x6f87('0x27')]===_0x312505;});}else{logger[_0x6f87('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x6f87('0x20')](_0x6f87('0x28'),_0x7614cf['remoteUri'])})[_0x6f87('0x1d')](function(_0x44a9e0){logger['info'](_0x6f87('0x29'));return _0x44a9e0;});}});}else{logger[_0x6f87('0xb')](_0x6f87('0x2a'));return request({'uri':util[_0x6f87('0x20')](_0x6f87('0x28'),_0x7614cf[_0x6f87('0x22')])})[_0x6f87('0x1d')](function(_0x3ea56b){logger[_0x6f87('0xb')](_0x6f87('0x29'));return _0x3ea56b;});}}function getEndUser(_0x3d9791,_0x19dc2b,_0x1d530b){logger[_0x6f87('0xb')]('Searching\x20enduser\x20with\x20phone',_0x1d530b);return request({'uri':util['format'](_0x6f87('0x2b'),_0x3d9791[_0x6f87('0x22')]),'qs':{'phone':_0x1d530b}})[_0x6f87('0x1d')](function(_0x29e745){if(_0x29e745[_0x6f87('0x23')]){logger[_0x6f87('0xb')]('Enduser\x20found!');return _[_0x6f87('0x25')](_0x29e745,{'phone':_0x1d530b});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x6f87('0x2b'),_0x3d9791[_0x6f87('0x22')]),'method':_0x6f87('0x1c'),'body':{'name':_0x19dc2b,'phone':_0x1d530b}})['then'](function(_0x31dacc){logger[_0x6f87('0xb')](_0x6f87('0x2c'));return _0x31dacc;});}});}function getAuth(_0x578c85){return util[_0x6f87('0x20')](_0x6f87('0x2d'),new Buffer(_0x578c85['apiKey']+':X')[_0x6f87('0x2e')]('base64'));}function request(_0x319a3a){logger[_0x6f87('0x2f')](_0x6f87('0x30'),JSON['stringify'](_0x319a3a));return rp(_[_0x6f87('0x7')](_0x319a3a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x37c51d,_0x3f64b7){var _0x20e239=[];if(_0x37c51d&&_0x37c51d['length']>0x0){_0x20e239=_[_0x6f87('0x31')](_0x37c51d,_0x3f64b7);}return _0x20e239;}function getCustomFields(_0x513579,_0x2b5f68){var _0x3f12f8=[];var _0x25eb1b={'custom_fields':[]};if(_0x513579['length']>0x0){_[_0x6f87('0x32')](_0x513579,function(_0x444527){if(_['includes'](['string',_0x6f87('0x33')],_0x444527['type'])&&_0x444527['nameField']&&!_0x444527[_0x6f87('0x34')]){_0x25eb1b[_0x444527['nameField'][_0x6f87('0x35')]()]=_0x444527[_0x6f87('0x36')][_0x6f87('0x2e')]();}else if(_[_0x6f87('0x37')]([_0x6f87('0x38'),_0x6f87('0x33')],_0x444527['type'])&&_0x444527[_0x6f87('0x39')]&&_0x444527[_0x6f87('0x34')]){_0x25eb1b[_0x6f87('0x19')][_0x6f87('0x3a')]({'id':_0x444527['idField'],'value':_0x444527[_0x6f87('0x36')][_0x6f87('0x2e')]()});}else if(_0x444527['type']===_0x6f87('0x3b')&&_0x444527['variableName']&&_0x444527['idField']&&_0x444527[_0x6f87('0x34')]){_0x2b5f68[_0x444527[_0x6f87('0x3c')]]&&_0x25eb1b[_0x6f87('0x19')]['push']({'id':_0x444527[_0x6f87('0x39')],'value':_0x2b5f68[_0x444527[_0x6f87('0x3c')]][_0x6f87('0x2e')]()});}else if(_0x444527['type']===_0x6f87('0x3d')&&_0x444527[_0x6f87('0x3e')]&&_0x444527[_0x6f87('0x3e')][_0x6f87('0x15')]&&_0x444527['idField']&&_0x444527[_0x6f87('0x34')]){_0x2b5f68[_0x444527[_0x6f87('0x3e')][_0x6f87('0x15')][_0x6f87('0x35')]()]&&_0x25eb1b[_0x6f87('0x19')][_0x6f87('0x3a')]({'id':_0x444527[_0x6f87('0x39')],'value':_0x2b5f68[_0x444527[_0x6f87('0x3e')][_0x6f87('0x15')][_0x6f87('0x35')]()]['toString']()});}});}return _0x25eb1b;}exports['queue']=function(_0x472b96,_0x4f90de,_0x126c0a,_0xa8fcf9,_0x391806,_0x21f222){var _0x8b5672,_0x55f629;_0x21f222[_0x6f87('0x22')]=intUtil[_0x6f87('0x3f')](_0x21f222[_0x6f87('0x22')]);_0x21f222['serverUrl']=intUtil[_0x6f87('0x3f')](_0x21f222[_0x6f87('0x40')]);if(_0x391806&&_0x391806['monitor_format']){logger[_0x6f87('0xb')](_0x6f87('0x41'),'Recording\x20is\x20enabled!');_0x4f90de['recordingURL']=util['format'](_0x6f87('0x42'),_0x21f222[_0x6f87('0x40')],_0x4f90de[_0x6f87('0x43')],md5(_0x4f90de['uniqueid']));}else{_0x4f90de[_0x6f87('0x44')]='';}headers[_0x6f87('0x45')]=getAuth(_0x21f222);return getUser(_0x21f222,_0xa8fcf9[_0x6f87('0x27')])[_0x6f87('0x1d')](function(_0x1f222c){_0x8b5672=_0x1f222c;logger[_0x6f87('0xb')](_0x6f87('0x46'),_0x8b5672['id']);return getEndUser(_0x21f222,_0x4f90de[_0x6f87('0xf')],_0x4f90de[_0x6f87('0x10')]);})['then'](function(_0x226460){_0x55f629=_0x226460;logger[_0x6f87('0xb')](_0x6f87('0x47'),_0x55f629['id']);return getTicket(_0x21f222,_0x8b5672,_0x55f629,_0x126c0a,_0x4f90de);})[_0x6f87('0x1d')](function(_0x1595ba){if(_0x1595ba&&_0x1595ba['id']){logger['info'](_0x6f87('0x1e'));logger['info'](_0x6f87('0x48'),_0x1595ba['id']);logger[_0x6f87('0xb')](_0x6f87('0x41'),_0x6f87('0x49'));emit(util[_0x6f87('0x20')]('user:%s',_0xa8fcf9['name']),_0x6f87('0x4a'),{'uri':util[_0x6f87('0x20')](_0x6f87('0x4b'),_0x21f222[_0x6f87('0x22')],_0x1595ba['id'])});}})[_0x6f87('0x4c')](function(_0x40eb78){logger[_0x6f87('0x4d')](_0x6f87('0x41'),JSON[_0x6f87('0x4e')](_0x40eb78));});};exports[_0x6f87('0x4f')]=function(_0x1b61c6,_0x172934,_0x57ea5e,_0x31bd34,_0x758b2a,_0x38e5dc,_0x4a89f8){var _0x2b6301,_0x138318;_0x38e5dc[_0x6f87('0x22')]=intUtil[_0x6f87('0x3f')](_0x38e5dc[_0x6f87('0x22')]);_0x38e5dc[_0x6f87('0x40')]=intUtil['stripTrailingSlash'](_0x38e5dc[_0x6f87('0x40')]);if(_0x4a89f8&&_0x4a89f8['recordingFormat']&&_0x4a89f8[_0x6f87('0x50')]!=='none'){logger['info'](_0x6f87('0x51'),'Recording\x20is\x20enabled!');_0x172934['recordingURL']=util[_0x6f87('0x20')](_0x6f87('0x42'),_0x38e5dc[_0x6f87('0x40')],_0x172934[_0x6f87('0x43')],md5(_0x172934['uniqueid']));}headers[_0x6f87('0x45')]=getAuth(_0x38e5dc);return getUser(_0x38e5dc,_0x31bd34['email'])[_0x6f87('0x1d')](function(_0x9021ea){_0x2b6301=_0x9021ea;logger['info']('The\x20User\x20ID\x20is:',_0x2b6301['id']);return getEndUser(_0x38e5dc,_0x172934[_0x6f87('0x52')],_0x172934[_0x6f87('0x53')]);})[_0x6f87('0x1d')](function(_0x2dcb4e){_0x138318=_0x2dcb4e;logger[_0x6f87('0xb')]('The\x20Enduser\x20ID\x20is:',_0x138318['id']);return getTicket(_0x38e5dc,_0x2b6301,_0x138318,_0x57ea5e,_0x172934);})[_0x6f87('0x1d')](function(_0x3d1c01){if(_0x3d1c01&&_0x3d1c01['id']){logger['info'](_0x6f87('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x3d1c01['id']);logger[_0x6f87('0xb')](_0x6f87('0x51'),_0x6f87('0x49'));emit(util[_0x6f87('0x20')](_0x6f87('0x54'),_0x31bd34[_0x6f87('0x15')]),_0x6f87('0x4a'),{'uri':util[_0x6f87('0x20')]('%s/helpdesk/tickets/%d',_0x38e5dc[_0x6f87('0x22')],_0x3d1c01['id'])});}})[_0x6f87('0x4c')](function(_0x4cbb32){logger[_0x6f87('0x4d')](_0x6f87('0x51'),JSON[_0x6f87('0x4e')](_0x4cbb32));});};exports['unmanaged']=function(_0x1b4b83,_0x15abb4,_0x6112c1,_0x5ceded,_0x51c1bd,_0x17aaab){var _0x545673,_0x532778;_0x17aaab[_0x6f87('0x22')]=intUtil[_0x6f87('0x3f')](_0x17aaab[_0x6f87('0x22')]);_0x17aaab[_0x6f87('0x40')]=intUtil[_0x6f87('0x3f')](_0x17aaab[_0x6f87('0x40')]);if(_0x51c1bd&&_0x51c1bd[_0x6f87('0x55')]){logger[_0x6f87('0xb')]('['+_0x15abb4[_0x6f87('0x56')]['toUpperCase']()+']',_0x6f87('0x57'));_0x15abb4[_0x6f87('0x44')]=util[_0x6f87('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x17aaab[_0x6f87('0x40')],_0x15abb4[_0x6f87('0x43')],md5(_0x15abb4[_0x6f87('0x43')]));}else{_0x15abb4[_0x6f87('0x44')]='';}headers[_0x6f87('0x45')]=getAuth(_0x17aaab);return getUser(_0x17aaab,'')[_0x6f87('0x1d')](function(_0x54eaed){_0x545673=_0x54eaed;logger[_0x6f87('0xb')]('The\x20User\x20ID\x20is:',_0x545673['id']);return getEndUser(_0x17aaab,_0x15abb4[_0x6f87('0xf')],_0x15abb4[_0x6f87('0x10')]);})[_0x6f87('0x1d')](function(_0x29278f){_0x532778=_0x29278f;logger[_0x6f87('0xb')](_0x6f87('0x47'),_0x532778['id']);return getTicket(_0x17aaab,_0x545673,_0x532778,_0x6112c1,_0x15abb4);})[_0x6f87('0x1d')](function(_0x17f48f){if(_0x17f48f){logger['info'](_0x6f87('0x1e'));logger[_0x6f87('0xb')](_0x6f87('0x48'),_0x17f48f['id']);}})[_0x6f87('0x4c')](function(_0x3758b1){logger[_0x6f87('0x4d')]('['+_0x15abb4[_0x6f87('0x56')][_0x6f87('0x58')]()+']',JSON[_0x6f87('0x4e')](_0x3758b1));});}; \ No newline at end of file +var _0x40c7=['destcalleridname','The\x20Enduser\x20ID\x20is:','trigger:browser:url','catch','error','unmanaged','lastevent','toUpperCase','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','Ticket\x20created!','validateEmail','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','nameField','customField','toLowerCase','type','idField','content','variable','variableName','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x228b33,_0x52a6d6){var _0x258f73=function(_0x539ba2){while(--_0x539ba2){_0x228b33['push'](_0x228b33['shift']());}};_0x258f73(++_0x52a6d6);}(_0x40c7,0x1cf));var _0x740c=function(_0x218479,_0x4fb190){_0x218479=_0x218479-0x0;var _0x3b67a0=_0x40c7[_0x218479];return _0x3b67a0;};'use strict';var _=require('lodash');var rp=require(_0x740c('0x0'));var md5=require('md5');var util=require(_0x740c('0x1'));var Redis=require(_0x740c('0x2'));var intUtil=require('./util');var config=require(_0x740c('0x3'));var logger=require(_0x740c('0x4'))('freshdesk');config[_0x740c('0x5')]=_[_0x740c('0x6')](config[_0x740c('0x5')],{'host':_0x740c('0x7'),'port':0x18eb});var io=require(_0x740c('0x8'))(new Redis(config[_0x740c('0x5')]));var headers={'Content-Type':'application/json','Accept':_0x740c('0x9')};function emit(_0x19e8f8,_0x3b84c3,_0x78e3e0){io['to'](_0x19e8f8)[_0x740c('0xa')](_0x3b84c3,_0x78e3e0);}function getTicket(_0x1d08b3,_0x279712,_0x7561,_0x20c644,_0x63765d){logger[_0x740c('0xb')]('Creating\x20new\x20ticket...');var _0x461535=_[_0x740c('0xc')]({'responder_id':_0x279712['id'],'requester_id':_0x7561['id'],'name':util[_0x740c('0xd')](_0x740c('0xe'),_0x63765d[_0x740c('0xf')]),'phone':_0x63765d[_0x740c('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x740c('0x11')](_0x20c644[_0x740c('0x12')],_0x63765d,'\x20'),'description':intUtil['getString'](_0x20c644['Descriptions'],_0x63765d,'
'),'tags':getTags(_0x20c644['Tags'],'name')},getCustomFields(_0x20c644[_0x740c('0x13')],_0x63765d));_0x461535[_0x740c('0x14')]=_[_0x740c('0x15')](_[_0x740c('0x16')](_0x461535[_0x740c('0x14')],'id'),_0x740c('0x17'));return request({'uri':util[_0x740c('0xd')]('%s/api/v2/tickets',_0x1d08b3[_0x740c('0x18')]),'method':_0x740c('0x19'),'body':_0x461535})['then'](function(_0x578052){logger[_0x740c('0xb')](_0x740c('0x1a'));return _0x578052;});}function getUser(_0x66113e,_0x163619){if(intUtil[_0x740c('0x1b')](_0x163619)){return request({'uri':util['format']('%s/api/v2/agents',_0x66113e[_0x740c('0x18')]),'qs':{'email':_0x163619}})['then'](function(_0xd6997f){if(_0xd6997f[_0x740c('0x1c')]){logger['info'](_0x740c('0x1d'));return _['find'](_0xd6997f,function(_0x1a07c3){return _0x1a07c3[_0x740c('0x1e')][_0x740c('0x1f')]===_0x163619;});}else{logger[_0x740c('0xb')](_0x740c('0x20'));return request({'uri':util[_0x740c('0xd')](_0x740c('0x21'),_0x66113e['remoteUri'])})[_0x740c('0x22')](function(_0x569e89){logger[_0x740c('0xb')]('Admin\x20account\x20selected.');return _0x569e89;});}});}else{logger['info'](_0x740c('0x23'));return request({'uri':util['format'](_0x740c('0x21'),_0x66113e['remoteUri'])})[_0x740c('0x22')](function(_0x486370){logger[_0x740c('0xb')](_0x740c('0x24'));return _0x486370;});}}function getEndUser(_0x12eb41,_0x2cacac,_0x87713c){logger[_0x740c('0xb')]('Searching\x20enduser\x20with\x20phone',_0x87713c);return request({'uri':util[_0x740c('0xd')](_0x740c('0x25'),_0x12eb41['remoteUri']),'qs':{'phone':_0x87713c}})['then'](function(_0x597e34){if(_0x597e34[_0x740c('0x1c')]){logger['info'](_0x740c('0x26'));return _[_0x740c('0x27')](_0x597e34,{'phone':_0x87713c});}else{logger[_0x740c('0xb')](_0x740c('0x28'));return request({'uri':util[_0x740c('0xd')]('%s/api/v2/contacts',_0x12eb41[_0x740c('0x18')]),'method':_0x740c('0x19'),'body':{'name':_0x2cacac,'phone':_0x87713c}})[_0x740c('0x22')](function(_0x483041){logger['info'](_0x740c('0x29'));return _0x483041;});}});}function getAuth(_0x3359ea){return util[_0x740c('0xd')](_0x740c('0x2a'),new Buffer(_0x3359ea['apiKey']+':X')[_0x740c('0x2b')](_0x740c('0x2c')));}function request(_0x4a7678){logger[_0x740c('0x2d')](_0x740c('0x2e'),JSON[_0x740c('0x2f')](_0x4a7678));return rp(_['defaults'](_0x4a7678,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x26fcac,_0x14e8ec){var _0x300eb3=[];if(_0x26fcac&&_0x26fcac[_0x740c('0x1c')]>0x0){_0x300eb3=_[_0x740c('0x30')](_0x26fcac,_0x14e8ec);}return _0x300eb3;}function getCustomFields(_0xbc0393,_0x1c99cc){var _0x4699a6=[];var _0xaeae95={'custom_fields':[]};if(_0xbc0393[_0x740c('0x1c')]>0x0){_[_0x740c('0x31')](_0xbc0393,function(_0x31d34e){if(_[_0x740c('0x32')]([_0x740c('0x33'),_0x740c('0x34')],_0x31d34e['type'])&&_0x31d34e[_0x740c('0x35')]&&!_0x31d34e[_0x740c('0x36')]){_0xaeae95[_0x31d34e[_0x740c('0x35')][_0x740c('0x37')]()]=_0x31d34e['content'][_0x740c('0x2b')]();}else if(_['includes']([_0x740c('0x33'),_0x740c('0x34')],_0x31d34e[_0x740c('0x38')])&&_0x31d34e[_0x740c('0x39')]&&_0x31d34e[_0x740c('0x36')]){_0xaeae95[_0x740c('0x14')]['push']({'id':_0x31d34e[_0x740c('0x39')],'value':_0x31d34e[_0x740c('0x3a')]['toString']()});}else if(_0x31d34e[_0x740c('0x38')]===_0x740c('0x3b')&&_0x31d34e[_0x740c('0x3c')]&&_0x31d34e['idField']&&_0x31d34e['customField']){_0x1c99cc[_0x31d34e[_0x740c('0x3c')]]&&_0xaeae95[_0x740c('0x14')][_0x740c('0x3d')]({'id':_0x31d34e[_0x740c('0x39')],'value':_0x1c99cc[_0x31d34e[_0x740c('0x3c')]][_0x740c('0x2b')]()});}else if(_0x31d34e['type']===_0x740c('0x3e')&&_0x31d34e[_0x740c('0x3f')]&&_0x31d34e[_0x740c('0x3f')][_0x740c('0x40')]&&_0x31d34e[_0x740c('0x39')]&&_0x31d34e[_0x740c('0x36')]){_0x1c99cc[_0x31d34e[_0x740c('0x3f')]['name']['toLowerCase']()]&&_0xaeae95[_0x740c('0x14')][_0x740c('0x3d')]({'id':_0x31d34e[_0x740c('0x39')],'value':_0x1c99cc[_0x31d34e[_0x740c('0x3f')][_0x740c('0x40')][_0x740c('0x37')]()]['toString']()});}});}return _0xaeae95;}exports[_0x740c('0x41')]=function(_0x55e735,_0x543aea,_0x331d15,_0x2c74ea,_0x3ffac4,_0x5636cf){var _0x5799da,_0x2f84e6;_0x5636cf[_0x740c('0x18')]=intUtil[_0x740c('0x42')](_0x5636cf[_0x740c('0x18')]);_0x5636cf[_0x740c('0x43')]=intUtil[_0x740c('0x42')](_0x5636cf[_0x740c('0x43')]);if(_0x3ffac4&&_0x3ffac4[_0x740c('0x44')]){logger[_0x740c('0xb')](_0x740c('0x45'),_0x740c('0x46'));_0x543aea[_0x740c('0x47')]=util[_0x740c('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5636cf['serverUrl'],_0x543aea['uniqueid'],md5(_0x543aea[_0x740c('0x48')]));}else{_0x543aea[_0x740c('0x47')]='';}headers[_0x740c('0x49')]=getAuth(_0x5636cf);return getUser(_0x5636cf,_0x2c74ea[_0x740c('0x1f')])[_0x740c('0x22')](function(_0x21cdbf){_0x5799da=_0x21cdbf;logger[_0x740c('0xb')](_0x740c('0x4a'),_0x5799da['id']);return getEndUser(_0x5636cf,_0x543aea[_0x740c('0xf')],_0x543aea['calleridnum']);})[_0x740c('0x22')](function(_0xe98cbe){_0x2f84e6=_0xe98cbe;logger[_0x740c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x2f84e6['id']);return getTicket(_0x5636cf,_0x5799da,_0x2f84e6,_0x331d15,_0x543aea);})[_0x740c('0x22')](function(_0x2991ea){if(_0x2991ea&&_0x2991ea['id']){logger[_0x740c('0xb')](_0x740c('0x1a'));logger[_0x740c('0xb')](_0x740c('0x4b'),_0x2991ea['id']);logger['info'](_0x740c('0x45'),_0x740c('0x4c'));emit(util['format'](_0x740c('0x4d'),_0x2c74ea['name']),'trigger:browser:url',{'uri':util['format'](_0x740c('0x4e'),_0x5636cf['remoteUri'],_0x2991ea['id'])});}})['catch'](function(_0x4e9f50){logger['error'](_0x740c('0x45'),JSON[_0x740c('0x2f')](_0x4e9f50));});};exports['outbound']=function(_0x245235,_0x234957,_0x4be7e3,_0x4507de,_0x39de8d,_0xad0ee0,_0x56d476){var _0x5788aa,_0x1a65bd;_0xad0ee0[_0x740c('0x18')]=intUtil[_0x740c('0x42')](_0xad0ee0[_0x740c('0x18')]);_0xad0ee0[_0x740c('0x43')]=intUtil[_0x740c('0x42')](_0xad0ee0[_0x740c('0x43')]);if(_0x56d476&&_0x56d476[_0x740c('0x4f')]&&_0x56d476[_0x740c('0x4f')]!==_0x740c('0x50')){logger[_0x740c('0xb')](_0x740c('0x51'),_0x740c('0x46'));_0x234957[_0x740c('0x47')]=util[_0x740c('0xd')](_0x740c('0x52'),_0xad0ee0[_0x740c('0x43')],_0x234957['uniqueid'],md5(_0x234957[_0x740c('0x48')]));}headers[_0x740c('0x49')]=getAuth(_0xad0ee0);return getUser(_0xad0ee0,_0x4507de['email'])[_0x740c('0x22')](function(_0x3f5f03){_0x5788aa=_0x3f5f03;logger[_0x740c('0xb')](_0x740c('0x4a'),_0x5788aa['id']);return getEndUser(_0xad0ee0,_0x234957[_0x740c('0x53')],_0x234957['destcalleridnum']);})['then'](function(_0xc925cb){_0x1a65bd=_0xc925cb;logger[_0x740c('0xb')](_0x740c('0x54'),_0x1a65bd['id']);return getTicket(_0xad0ee0,_0x5788aa,_0x1a65bd,_0x4be7e3,_0x234957);})[_0x740c('0x22')](function(_0x5f2700){if(_0x5f2700&&_0x5f2700['id']){logger[_0x740c('0xb')](_0x740c('0x1a'));logger[_0x740c('0xb')](_0x740c('0x4b'),_0x5f2700['id']);logger['info'](_0x740c('0x51'),_0x740c('0x4c'));emit(util[_0x740c('0xd')]('user:%s',_0x4507de[_0x740c('0x40')]),_0x740c('0x55'),{'uri':util[_0x740c('0xd')](_0x740c('0x4e'),_0xad0ee0[_0x740c('0x18')],_0x5f2700['id'])});}})[_0x740c('0x56')](function(_0x48ea46){logger[_0x740c('0x57')](_0x740c('0x51'),JSON[_0x740c('0x2f')](_0x48ea46));});};exports[_0x740c('0x58')]=function(_0x4b9dfa,_0x4656b0,_0x46493f,_0x26c0bf,_0x1c9745,_0x141145){var _0x1f6c40,_0x1fe0ef;_0x141145[_0x740c('0x18')]=intUtil[_0x740c('0x42')](_0x141145[_0x740c('0x18')]);_0x141145[_0x740c('0x43')]=intUtil[_0x740c('0x42')](_0x141145[_0x740c('0x43')]);if(_0x1c9745&&_0x1c9745[_0x740c('0x44')]){logger[_0x740c('0xb')]('['+_0x4656b0[_0x740c('0x59')]['toUpperCase']()+']',_0x740c('0x46'));_0x4656b0[_0x740c('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x141145['serverUrl'],_0x4656b0['uniqueid'],md5(_0x4656b0[_0x740c('0x48')]));}else{_0x4656b0[_0x740c('0x47')]='';}headers[_0x740c('0x49')]=getAuth(_0x141145);return getUser(_0x141145,'')[_0x740c('0x22')](function(_0x1a473b){_0x1f6c40=_0x1a473b;logger[_0x740c('0xb')](_0x740c('0x4a'),_0x1f6c40['id']);return getEndUser(_0x141145,_0x4656b0[_0x740c('0xf')],_0x4656b0[_0x740c('0x10')]);})[_0x740c('0x22')](function(_0x2ae491){_0x1fe0ef=_0x2ae491;logger[_0x740c('0xb')](_0x740c('0x54'),_0x1fe0ef['id']);return getTicket(_0x141145,_0x1f6c40,_0x1fe0ef,_0x46493f,_0x4656b0);})['then'](function(_0x4f62cb){if(_0x4f62cb){logger[_0x740c('0xb')]('Ticket\x20created!');logger[_0x740c('0xb')](_0x740c('0x4b'),_0x4f62cb['id']);}})[_0x740c('0x56')](function(_0x27c6a4){logger[_0x740c('0x57')]('['+_0x4656b0[_0x740c('0x59')][_0x740c('0x5a')]()+']',JSON[_0x740c('0x2f')](_0x27c6a4));});}; \ 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 589a04a..745c833 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 _0x7d7b=['request-promise','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','toUpperCase','info','users','agentEmail','userId','User\x20found:','Admin\x20selected','catch','error','/api/lookup?q=','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','Contact\x20found\x20mobile_number:','contactNumber','Contact\x20found\x20work_number:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','message','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash'];(function(_0x25719a,_0x2ec5ac){var _0x394203=function(_0xb565ab){while(--_0xb565ab){_0x25719a['push'](_0x25719a['shift']());}};_0x394203(++_0x2ec5ac);}(_0x7d7b,0x12f));var _0xb7d7=function(_0x31077f,_0x3a726c){_0x31077f=_0x31077f-0x0;var _0xc690eb=_0x7d7b[_0x31077f];return _0xc690eb;};'use strict';var _=require(_0xb7d7('0x0'));var rp=require(_0xb7d7('0x1'));var md5=require('md5');var util=require(_0xb7d7('0x2'));var moment=require(_0xb7d7('0x3'));var Promise=require('bluebird');var Redis=require(_0xb7d7('0x4'));var intUtil=require(_0xb7d7('0x5'));var config=require(_0xb7d7('0x6'));var logger=require(_0xb7d7('0x7'))(_0xb7d7('0x8'));config[_0xb7d7('0x9')]=_[_0xb7d7('0xa')](config[_0xb7d7('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb7d7('0x9')]));function getAdminId(_0x1cb4ac,_0xf06ecd,_0x13b267,_0x5f595a){return new Promise(function(_0x477e2d,_0x2f024a){var _0x333d8a=![];var _0x50dc7d={'method':_0xb7d7('0xb'),'uri':_0x5f595a+_0xb7d7('0xc'),'json':!![]};_0x50dc7d[_0xb7d7('0xd')]=_0x13b267;logger['info'](_0xb7d7('0xe'));return rp(_0x50dc7d)[_0xb7d7('0xf')](function(_0x46f3ea){if(_0x46f3ea){var _0x5d757f=_0x46f3ea['users'];var _0x28e2e4=null;for(_0x28e2e4=0x0;_0x28e2e4<_0x5d757f[_0xb7d7('0x10')];_0x28e2e4++){if(_0x5d757f[_0x28e2e4][_0xb7d7('0x11')]===_0x1cb4ac[_0xb7d7('0x12')]){_0x1cb4ac['adminId']=_0x5d757f[_0x28e2e4]['id'];_0x333d8a=!![];}}if(_0x333d8a){logger['info'](_0xb7d7('0x13'),_0x1cb4ac[_0xb7d7('0x14')]);_0x477e2d(_0x1cb4ac);}else{_0x2f024a({'statusCode':0x194,'message':_0xb7d7('0x15')});}}else{_0x2f024a({'statusCode':0x194,'message':_0xb7d7('0x15')});}})['catch'](function(_0x261d14){logger['error']('['+[_0xf06ecd[_0xb7d7('0x16')]()]+']',_0x261d14['message']);_0x2f024a(_0x261d14);});});}function getUser(_0x24eda0,_0x3e95dd,_0x117c85){return function(_0x1c2e07){return new Promise(function(_0x1dea1b,_0x46dbe9){var _0x3b331a={'method':'GET','uri':_0x117c85+_0xb7d7('0xc'),'json':!![]};_0x3b331a[_0xb7d7('0xd')]=_0x3e95dd;logger[_0xb7d7('0x17')]('Getting\x20user\x20list');return rp(_0x3b331a)['then'](function(_0x395672){if(_0x395672){var _0x253650=_0x395672[_0xb7d7('0x18')];var _0x32b991=![];var _0x571ab3=null;if(_0x1c2e07[_0xb7d7('0x19')]!==null){logger[_0xb7d7('0x17')]('Getting\x20user\x20with\x20email',_0x1c2e07['agentEmail']);_0x1c2e07['userEmail']=_0x1c2e07['agentEmail'];for(_0x571ab3=0x0;_0x571ab3<_0x253650['length'];_0x571ab3++){if(_0x253650[_0x571ab3]['email']===_0x1c2e07['agentEmail']){_0x32b991=!![];_0x1c2e07[_0xb7d7('0x1a')]=_0x253650[_0x571ab3]['id'];logger[_0xb7d7('0x17')](_0xb7d7('0x1b'),_0x1c2e07[_0xb7d7('0x1a')]);}}}if(!_0x32b991){logger[_0xb7d7('0x17')](_0xb7d7('0x1c'));_0x1c2e07['userEmail']=_0x1c2e07[_0xb7d7('0x12')];_0x1c2e07['userId']=_0x1c2e07[_0xb7d7('0x14')];_0x32b991=!![];}if(_0x32b991){_0x1dea1b(_0x1c2e07);}else{_0x46dbe9({'statusCode':0x194,'message':_0xb7d7('0x15')});}}else{_0x46dbe9({'statusCode':0x194,'message':_0xb7d7('0x15')});}})[_0xb7d7('0x1d')](function(_0x3a8805){logger[_0xb7d7('0x1e')]('['+[_0x24eda0[_0xb7d7('0x16')]()]+']',_0x3a8805['message']);_0x46dbe9(_0x3a8805);});});};}function searchContact(_0x2b62d6,_0x352c00,_0x10293c,_0x5dadff){return new Promise(function(_0x34957b,_0x4091fb){var _0x83e00={'method':_0xb7d7('0xb'),'headers':_0x352c00,'uri':_0x2b62d6+_0xb7d7('0x1f')+_0x5dadff+'&f='+_0x10293c+'&entities=contact','json':!![]};rp(_0x83e00)[_0xb7d7('0xf')](function(_0x42e8de){var _0x49cde9=_['find'](_0x42e8de[_0xb7d7('0x20')][_0xb7d7('0x20')],[_0x10293c,_0x5dadff]);_0x34957b(_0x49cde9);})[_0xb7d7('0x1d')](function(_0x3662de){_0x4091fb(_0x3662de);});});}function getEndUser(_0x5b2421,_0x8c6a0d,_0x1cc586){return function(_0x5c4bce){return new Promise(function(_0x42b15b,_0xa7f3a6){logger['info'](util[_0xb7d7('0x21')](_0xb7d7('0x22'),_0x5c4bce['contactNumber']));searchContact(_0x1cc586,_0x8c6a0d,_0xb7d7('0x23'),_0x5c4bce['contactNumber'])[_0xb7d7('0xf')](function(_0x1d10f6){if(_0x1d10f6){_0x5c4bce[_0xb7d7('0x24')]=_0x1d10f6['id'];logger[_0xb7d7('0x17')](_0xb7d7('0x25'),_0x5c4bce[_0xb7d7('0x24')]);return _0x42b15b(_0x5c4bce);}searchContact(_0x1cc586,_0x8c6a0d,'work_number',_0x5c4bce[_0xb7d7('0x26')])['then'](function(_0x46d9cb){if(_0x46d9cb){_0x5c4bce[_0xb7d7('0x24')]=_0x46d9cb['id'];logger['info'](_0xb7d7('0x27'),_0x5c4bce[_0xb7d7('0x24')]);return _0x42b15b(_0x5c4bce);}createEndUser(_0x5c4bce,_0x5b2421,_0x8c6a0d,_0x1cc586)[_0xb7d7('0xf')](function(_0x2d6923){logger[_0xb7d7('0x17')]('Contact\x20created:',_0x2d6923[_0xb7d7('0x24')]);return _0x42b15b(_0x2d6923);});});})[_0xb7d7('0x1d')](function(_0x5abc49){_0xa7f3a6(_0x5abc49);});});};}function createEndUser(_0x525ac6,_0x3f8271,_0x36bc4a,_0x334913){return new Promise(function(_0x29a3c1,_0x56c3c6){var _0x370cd9=moment();var _0x37aa82={'method':_0xb7d7('0x28'),'uri':_0x334913+_0xb7d7('0x29'),'body':{'contact':{'last_name':_0x525ac6[_0xb7d7('0x26')],'work_number':_0x525ac6['contactNumber'],'mobile_number':_0x525ac6[_0xb7d7('0x26')],'owner_id':_0x525ac6[_0xb7d7('0x1a')],'created_at':_0x370cd9[_0xb7d7('0x21')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x37aa82['headers']=_0x36bc4a;logger['info'](_0xb7d7('0x2a'));return rp(_0x37aa82)['then'](function(_0x4cf41a){_0x525ac6['endUserId']=_0x4cf41a[_0xb7d7('0x2b')]['id'];_0x29a3c1(_0x525ac6);})[_0xb7d7('0x1d')](function(_0x546aa5){logger[_0xb7d7('0x1e')]('['+[_0x3f8271[_0xb7d7('0x16')]()]+']',_0x546aa5['message']);_0x56c3c6(_0x546aa5[_0xb7d7('0x2c')]);});});}function getTicket(_0x2deed8,_0x51d345,_0x43a9a9,_0x482719,_0x4487d0){return function(_0x96bfbb){logger[_0xb7d7('0x17')]('Creating\x20new\x20task');return new Promise(function(_0x48e8cc,_0x2f6ea4){var _0x2e08db=moment();var _0x5f339d={'method':'POST','uri':_0x43a9a9+'/api/tasks','body':{'title':intUtil[_0xb7d7('0x2d')](_0x482719['Subjects'],_0x4487d0,'\x20'),'description':intUtil[_0xb7d7('0x2d')](_0x482719[_0xb7d7('0x2e')],_0x4487d0,'\x0a'),'owner_id':_0x96bfbb[_0xb7d7('0x1a')],'creater_id':_0x96bfbb['adminId'],'targetable_id':_0x96bfbb[_0xb7d7('0x24')],'targetable_type':_0xb7d7('0x2f'),'created_at':_0x2e08db[_0xb7d7('0x21')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x2e08db['add'](0x1e,'m')[_0xb7d7('0x21')](_0xb7d7('0x30'))},'json':!![]};_0x5f339d[_0xb7d7('0xd')]=_0x51d345;return rp(_0x5f339d)[_0xb7d7('0xf')](function(_0x315964){_0x96bfbb['ticketId']=_0x315964['task']['id'];logger[_0xb7d7('0x17')](_0xb7d7('0x31'),_0x96bfbb[_0xb7d7('0x32')]);_0x48e8cc(_0x96bfbb);})[_0xb7d7('0x1d')](function(_0x555f9e){logger['error']('['+[_0x2deed8[_0xb7d7('0x16')]()]+']',_0x555f9e[_0xb7d7('0x2c')]);_0x2f6ea4(_0x555f9e[_0xb7d7('0x2c')]);});});};}function emit(_0x45f64e,_0xe5d7b2,_0x2fa4f2){var _0x4e50ac={'uri':_0x45f64e+_0xb7d7('0x33')+_0x2fa4f2};io['to'](util[_0xb7d7('0x21')](_0xb7d7('0x34'),_0xe5d7b2))[_0xb7d7('0x35')](_0xb7d7('0x36'),_0x4e50ac);}exports['cs']=function(_0x130c7a,_0x13d81e,_0x45e89c,_0x310b29,_0x49f9c4,_0x333788,_0x5051cb,_0x568307){var _0x1732d0={};var _0x234be8={'Authorization':_0xb7d7('0x37')+_0x333788['apiKey']};_0x333788[_0xb7d7('0x38')]=intUtil[_0xb7d7('0x39')](_0x333788[_0xb7d7('0x38')]);_0x333788['serverUrl']=intUtil[_0xb7d7('0x39')](_0x333788['serverUrl']);var _0x174754=_0x333788[_0xb7d7('0x38')];_0x1732d0[_0xb7d7('0x12')]=_0x333788[_0xb7d7('0x3a')];_0x1732d0[_0xb7d7('0x26')]=_0x568307[_0xb7d7('0x3b')]()==='outbound'?_0x13d81e[_0xb7d7('0x3c')]:_0x13d81e[_0xb7d7('0x3d')];_0x1732d0[_0xb7d7('0x3e')]=_0x568307===_0xb7d7('0x3f')||_0x568307===_0xb7d7('0x40')?_0xb7d7('0x3f'):_0xb7d7('0x41');if(_0x310b29){_0x1732d0['agentEmail']=_0x310b29[_0xb7d7('0x11')];}var _0x2ee565=util[_0xb7d7('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x333788['serverUrl'],_0x13d81e[_0xb7d7('0x42')],md5(_0x13d81e[_0xb7d7('0x42')]));if(_0x49f9c4&&_0x49f9c4[_0xb7d7('0x43')]){logger['info']('[QUEUE]',_0xb7d7('0x44'));_0x13d81e['recordingURL']=_0x2ee565;}else if(_0x5051cb&&_0x5051cb['recordingFormat']&&_0x5051cb[_0xb7d7('0x45')]!==_0xb7d7('0x46')){logger[_0xb7d7('0x17')](_0xb7d7('0x47'),_0xb7d7('0x44'));_0x13d81e[_0xb7d7('0x48')]=_0x2ee565;}else{_0x13d81e[_0xb7d7('0x48')]='';}return getAdminId(_0x1732d0,_0x568307,_0x234be8,_0x174754)['then'](getUser(_0x568307,_0x234be8,_0x174754))[_0xb7d7('0xf')](getEndUser(_0x568307,_0x234be8,_0x174754))[_0xb7d7('0xf')](getTicket(_0x568307,_0x234be8,_0x174754,_0x45e89c,_0x13d81e))[_0xb7d7('0xf')](function(_0x554435){logger['info'](util[_0xb7d7('0x21')](_0xb7d7('0x49'),_0x554435[_0xb7d7('0x32')]));if(_0x568307!==_0xb7d7('0x40')){logger['info']('['+[_0x568307[_0xb7d7('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x174754,_0x310b29['name'],_0x554435['endUserId']);}})[_0xb7d7('0x1d')](function(_0x308195){logger[_0xb7d7('0x1e')]('['+[_0x568307['toUpperCase']()]+_0xb7d7('0x4a'),util[_0xb7d7('0x4b')](_0x308195,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0c89=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','md5','util','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','Subjects','getString','Contact','add','ticketId','Task\x20created:','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','remoteUri','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x42c9fb,_0x4d7748){var _0x1bac27=function(_0x90c9b8){while(--_0x90c9b8){_0x42c9fb['push'](_0x42c9fb['shift']());}};_0x1bac27(++_0x4d7748);}(_0x0c89,0x15b));var _0x90c8=function(_0x3dc0ed,_0x368f6b){_0x3dc0ed=_0x3dc0ed-0x0;var _0x4b8388=_0x0c89[_0x3dc0ed];return _0x4b8388;};'use strict';var _=require(_0x90c8('0x0'));var rp=require('request-promise');var md5=require(_0x90c8('0x1'));var util=require(_0x90c8('0x2'));var moment=require('moment');var Promise=require(_0x90c8('0x3'));var Redis=require(_0x90c8('0x4'));var intUtil=require('./util');var config=require(_0x90c8('0x5'));var logger=require(_0x90c8('0x6'))(_0x90c8('0x7'));config[_0x90c8('0x8')]=_[_0x90c8('0x9')](config[_0x90c8('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x90c8('0xa'))(new Redis(config[_0x90c8('0x8')]));function getAdminId(_0x249391,_0x2e10d7,_0x41bbb8,_0x173950){return new Promise(function(_0x438ca7,_0x4cbc3c){var _0x560146=![];var _0x5b05ba={'method':_0x90c8('0xb'),'uri':_0x173950+_0x90c8('0xc'),'json':!![]};_0x5b05ba[_0x90c8('0xd')]=_0x41bbb8;logger[_0x90c8('0xe')](_0x90c8('0xf'));return rp(_0x5b05ba)[_0x90c8('0x10')](function(_0x2c4390){if(_0x2c4390){var _0x3b0447=_0x2c4390[_0x90c8('0x11')];var _0x45de6c=null;for(_0x45de6c=0x0;_0x45de6c<_0x3b0447[_0x90c8('0x12')];_0x45de6c++){if(_0x3b0447[_0x45de6c][_0x90c8('0x13')]===_0x249391[_0x90c8('0x14')]){_0x249391[_0x90c8('0x15')]=_0x3b0447[_0x45de6c]['id'];_0x560146=!![];}}if(_0x560146){logger['info'](_0x90c8('0x16'),_0x249391[_0x90c8('0x15')]);_0x438ca7(_0x249391);}else{_0x4cbc3c({'statusCode':0x194,'message':_0x90c8('0x17')});}}else{_0x4cbc3c({'statusCode':0x194,'message':_0x90c8('0x17')});}})[_0x90c8('0x18')](function(_0x358618){logger[_0x90c8('0x19')]('['+[_0x2e10d7[_0x90c8('0x1a')]()]+']',_0x358618[_0x90c8('0x1b')]);_0x4cbc3c(_0x358618);});});}function getUser(_0xec22a2,_0x110f69,_0x2726a1){return function(_0x45cd34){return new Promise(function(_0x333bde,_0x128d8c){var _0x43d28e={'method':'GET','uri':_0x2726a1+'/api/selector/owners','json':!![]};_0x43d28e['headers']=_0x110f69;logger[_0x90c8('0xe')](_0x90c8('0x1c'));return rp(_0x43d28e)[_0x90c8('0x10')](function(_0x59dfc1){if(_0x59dfc1){var _0x2963b5=_0x59dfc1[_0x90c8('0x11')];var _0x2c2878=![];var _0x388dbe=null;if(_0x45cd34[_0x90c8('0x1d')]!==null){logger['info'](_0x90c8('0x1e'),_0x45cd34[_0x90c8('0x1d')]);_0x45cd34['userEmail']=_0x45cd34['agentEmail'];for(_0x388dbe=0x0;_0x388dbe<_0x2963b5[_0x90c8('0x12')];_0x388dbe++){if(_0x2963b5[_0x388dbe][_0x90c8('0x13')]===_0x45cd34['agentEmail']){_0x2c2878=!![];_0x45cd34[_0x90c8('0x1f')]=_0x2963b5[_0x388dbe]['id'];logger['info'](_0x90c8('0x20'),_0x45cd34[_0x90c8('0x1f')]);}}}if(!_0x2c2878){logger[_0x90c8('0xe')](_0x90c8('0x21'));_0x45cd34[_0x90c8('0x22')]=_0x45cd34[_0x90c8('0x14')];_0x45cd34[_0x90c8('0x1f')]=_0x45cd34[_0x90c8('0x15')];_0x2c2878=!![];}if(_0x2c2878){_0x333bde(_0x45cd34);}else{_0x128d8c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x128d8c({'statusCode':0x194,'message':_0x90c8('0x17')});}})[_0x90c8('0x18')](function(_0x5c3366){logger[_0x90c8('0x19')]('['+[_0xec22a2[_0x90c8('0x1a')]()]+']',_0x5c3366[_0x90c8('0x1b')]);_0x128d8c(_0x5c3366);});});};}function searchContact(_0x372f13,_0x5d5387,_0x1b106c,_0x382b0b){return new Promise(function(_0x40e6f4,_0x492314){var _0x52556c={'method':_0x90c8('0xb'),'headers':_0x5d5387,'uri':_0x372f13+'/api/lookup?q='+_0x382b0b+_0x90c8('0x23')+_0x1b106c+_0x90c8('0x24'),'json':!![]};rp(_0x52556c)[_0x90c8('0x10')](function(_0x6a299){var _0xbc3055=_[_0x90c8('0x25')](_0x6a299[_0x90c8('0x26')][_0x90c8('0x26')],[_0x1b106c,_0x382b0b]);_0x40e6f4(_0xbc3055);})[_0x90c8('0x18')](function(_0x21cc1b){_0x492314(_0x21cc1b);});});}function getEndUser(_0x13e9f2,_0x4bd606,_0x5aad55){return function(_0x36fdb7){return new Promise(function(_0x3ca245,_0x29d987){logger[_0x90c8('0xe')](util[_0x90c8('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x36fdb7[_0x90c8('0x28')]));searchContact(_0x5aad55,_0x4bd606,_0x90c8('0x29'),_0x36fdb7[_0x90c8('0x28')])[_0x90c8('0x10')](function(_0x3930d4){if(_0x3930d4){_0x36fdb7[_0x90c8('0x2a')]=_0x3930d4['id'];logger[_0x90c8('0xe')](_0x90c8('0x2b'),_0x36fdb7['endUserId']);return _0x3ca245(_0x36fdb7);}searchContact(_0x5aad55,_0x4bd606,_0x90c8('0x2c'),_0x36fdb7[_0x90c8('0x28')])['then'](function(_0x3c695b){if(_0x3c695b){_0x36fdb7['endUserId']=_0x3c695b['id'];logger[_0x90c8('0xe')]('Contact\x20found\x20work_number:',_0x36fdb7[_0x90c8('0x2a')]);return _0x3ca245(_0x36fdb7);}createEndUser(_0x36fdb7,_0x13e9f2,_0x4bd606,_0x5aad55)[_0x90c8('0x10')](function(_0xe600c5){logger['info'](_0x90c8('0x2d'),_0xe600c5[_0x90c8('0x2a')]);return _0x3ca245(_0xe600c5);});});})['catch'](function(_0x557d24){_0x29d987(_0x557d24);});});};}function createEndUser(_0x5f3907,_0x144166,_0x1ff1fa,_0x45a857){return new Promise(function(_0x49b0d7,_0x170782){var _0x122601=moment();var _0x4dcf9f={'method':_0x90c8('0x2e'),'uri':_0x45a857+'/api/contacts','body':{'contact':{'last_name':_0x5f3907[_0x90c8('0x28')],'work_number':_0x5f3907[_0x90c8('0x28')],'mobile_number':_0x5f3907['contactNumber'],'owner_id':_0x5f3907[_0x90c8('0x1f')],'created_at':_0x122601[_0x90c8('0x27')](_0x90c8('0x2f'))}},'json':!![]};_0x4dcf9f['headers']=_0x1ff1fa;logger[_0x90c8('0xe')](_0x90c8('0x30'));return rp(_0x4dcf9f)['then'](function(_0x4013f4){_0x5f3907[_0x90c8('0x2a')]=_0x4013f4[_0x90c8('0x31')]['id'];_0x49b0d7(_0x5f3907);})[_0x90c8('0x18')](function(_0x44f9da){logger['error']('['+[_0x144166[_0x90c8('0x1a')]()]+']',_0x44f9da[_0x90c8('0x1b')]);_0x170782(_0x44f9da['message']);});});}function getTicket(_0x133f59,_0x48ff43,_0x2d2e70,_0x4fdaa9,_0xa41987){return function(_0x56d8d2){logger[_0x90c8('0xe')](_0x90c8('0x32'));return new Promise(function(_0x46dcf0,_0x5ce5a3){var _0x368d62=moment();var _0x3c81e0={'method':'POST','uri':_0x2d2e70+'/api/tasks','body':{'title':intUtil['getString'](_0x4fdaa9[_0x90c8('0x33')],_0xa41987,'\x20'),'description':intUtil[_0x90c8('0x34')](_0x4fdaa9['Descriptions'],_0xa41987,'\x0a'),'owner_id':_0x56d8d2[_0x90c8('0x1f')],'creater_id':_0x56d8d2['adminId'],'targetable_id':_0x56d8d2[_0x90c8('0x2a')],'targetable_type':_0x90c8('0x35'),'created_at':_0x368d62['format'](_0x90c8('0x2f')),'due_date':_0x368d62[_0x90c8('0x36')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3c81e0['headers']=_0x48ff43;return rp(_0x3c81e0)['then'](function(_0x52699a){_0x56d8d2[_0x90c8('0x37')]=_0x52699a['task']['id'];logger[_0x90c8('0xe')](_0x90c8('0x38'),_0x56d8d2[_0x90c8('0x37')]);_0x46dcf0(_0x56d8d2);})[_0x90c8('0x18')](function(_0xe200bc){logger[_0x90c8('0x19')]('['+[_0x133f59[_0x90c8('0x1a')]()]+']',_0xe200bc[_0x90c8('0x1b')]);_0x5ce5a3(_0xe200bc[_0x90c8('0x1b')]);});});};}function emit(_0x2f6666,_0x19a5b5,_0x2abf20){var _0x14925b={'uri':_0x2f6666+'/contacts/'+_0x2abf20};io['to'](util[_0x90c8('0x27')]('user:%s',_0x19a5b5))[_0x90c8('0x39')](_0x90c8('0x3a'),_0x14925b);}exports['cs']=function(_0x834016,_0x51b403,_0xb10d0,_0x52ce79,_0x431e28,_0x433333,_0x2c325b,_0xadd1f){var _0x1652e8={};var _0x1cbc38={'Authorization':_0x90c8('0x3b')+_0x433333[_0x90c8('0x3c')]};_0x433333['remoteUri']=intUtil[_0x90c8('0x3d')](_0x433333['remoteUri']);_0x433333['serverUrl']=intUtil[_0x90c8('0x3d')](_0x433333[_0x90c8('0x3e')]);var _0xc5170f=_0x433333[_0x90c8('0x3f')];_0x1652e8[_0x90c8('0x14')]=_0x433333[_0x90c8('0x40')];_0x1652e8[_0x90c8('0x28')]=_0xadd1f[_0x90c8('0x41')]()===_0x90c8('0x42')?_0x51b403['destcalleridnum']:_0x51b403[_0x90c8('0x43')];_0x1652e8[_0x90c8('0x44')]=_0xadd1f===_0x90c8('0x45')||_0xadd1f===_0x90c8('0x46')?_0x90c8('0x45'):_0x90c8('0x42');if(_0x52ce79){_0x1652e8[_0x90c8('0x1d')]=_0x52ce79[_0x90c8('0x13')];}var _0x13af04=util[_0x90c8('0x27')](_0x90c8('0x47'),_0x433333[_0x90c8('0x3e')],_0x51b403['uniqueid'],md5(_0x51b403[_0x90c8('0x48')]));if(_0x431e28&&_0x431e28[_0x90c8('0x49')]){logger[_0x90c8('0xe')](_0x90c8('0x4a'),_0x90c8('0x4b'));_0x51b403[_0x90c8('0x4c')]=_0x13af04;}else if(_0x2c325b&&_0x2c325b[_0x90c8('0x4d')]&&_0x2c325b[_0x90c8('0x4d')]!==_0x90c8('0x4e')){logger[_0x90c8('0xe')](_0x90c8('0x4f'),_0x90c8('0x4b'));_0x51b403[_0x90c8('0x4c')]=_0x13af04;}else{_0x51b403[_0x90c8('0x4c')]='';}return getAdminId(_0x1652e8,_0xadd1f,_0x1cbc38,_0xc5170f)[_0x90c8('0x10')](getUser(_0xadd1f,_0x1cbc38,_0xc5170f))[_0x90c8('0x10')](getEndUser(_0xadd1f,_0x1cbc38,_0xc5170f))['then'](getTicket(_0xadd1f,_0x1cbc38,_0xc5170f,_0xb10d0,_0x51b403))[_0x90c8('0x10')](function(_0x1f6d1d){logger[_0x90c8('0xe')](util[_0x90c8('0x27')](_0x90c8('0x50'),_0x1f6d1d[_0x90c8('0x37')]));if(_0xadd1f!=='unmanaged'){logger[_0x90c8('0xe')]('['+[_0xadd1f[_0x90c8('0x1a')]()]+']',_0x90c8('0x51'));emit(_0xc5170f,_0x52ce79[_0x90c8('0x52')],_0x1f6d1d[_0x90c8('0x2a')]);}})[_0x90c8('0x18')](function(_0x594ef6){logger[_0x90c8('0x19')]('['+[_0xadd1f['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x90c8('0x53')](_0x594ef6,{'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 6249664..d23c52e 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 _0x4a55=['zoho','unknown\x20integration','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','error','lodash','./zendesk','./salesforce','./sugarcrm','./zoho','./vtiger','./servicenow','./freshsales','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk'];(function(_0x2301f2,_0x43723a){var _0x1a47e5=function(_0x2238ab){while(--_0x2238ab){_0x2301f2['push'](_0x2301f2['shift']());}};_0x1a47e5(++_0x43723a);}(_0x4a55,0x113));var _0x54a5=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x4a55[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x54a5('0x0'));var util=require('util');var zendesk=require(_0x54a5('0x1'));var salesforce=require(_0x54a5('0x2'));var sugarcrm=require(_0x54a5('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x54a5('0x4'));var desk=require('./desk');var vtiger=require(_0x54a5('0x5'));var servicenow=require(_0x54a5('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0x54a5('0x7'));var integrations=['zendesk',_0x54a5('0x8'),_0x54a5('0x9'),_0x54a5('0xa'),'zoho',_0x54a5('0xb'),_0x54a5('0xc'),_0x54a5('0xd'),_0x54a5('0xe'),_0x54a5('0xf')];exports[_0x54a5('0x10')]=function(_0x1fca58,_0x303a49,_0x12d3a3,_0x288103,_0x49cc03,_0x3343c1){if(_0x12d3a3){if(_[_0x54a5('0x11')](integrations,_0x1fca58['data1']['toLowerCase']())){try{var _0x336f8c=null;var _0x331608='';var _0x4c2a92=_0x12d3a3[_0x1fca58[_0x54a5('0x12')][_0x54a5('0x13')]()];if(_0x4c2a92){var _0x4a49d8=_0x4c2a92[_0x1fca58[_0x54a5('0x14')]];if(_0x4a49d8){var _0x40f224=_[_0x54a5('0x15')](_0x4a49d8['Configurations'],{'id':parseInt(_0x1fca58['data3'],0xa)});if(_0x40f224){if(_0x288103){if(_0x49cc03&&_0x303a49[_0x54a5('0x16')]){_0x331608=_0x54a5('0x16');}else if(_0x303a49[_0x54a5('0x17')]){_0x331608=_0x54a5('0x18');}else{console[_0x54a5('0x19')](_0x54a5('0x1a'),_0x303a49);}}else{_0x331608=_0x54a5('0x1b');}switch(_0x1fca58[_0x54a5('0x12')]['toLowerCase']()){case _0x54a5('0x1c'):zendesk[_0x331608](_0x1fca58,_0x303a49,_0x40f224,_0x288103,_0x49cc03,_0x4a49d8,_0x3343c1);break;case _0x54a5('0x8'):salesforce[_0x331608](_0x1fca58,_0x303a49,_0x40f224,_0x288103,_0x49cc03,_0x4a49d8,_0x3343c1);break;case _0x54a5('0x9'):sugarcrm[_0x331608](_0x1fca58,_0x303a49,_0x40f224,_0x288103,_0x49cc03,_0x4a49d8,_0x3343c1);break;case _0x54a5('0xa'):freshdesk[_0x331608](_0x1fca58,_0x303a49,_0x40f224,_0x288103,_0x49cc03,_0x4a49d8,_0x3343c1);break;case _0x54a5('0x1d'):zoho[_0x331608](_0x1fca58,_0x303a49,_0x40f224,_0x288103,_0x49cc03,_0x4a49d8,_0x3343c1);break;case _0x54a5('0xb'):desk[_0x331608](_0x1fca58,_0x303a49,_0x40f224,_0x288103,_0x49cc03,_0x4a49d8,_0x3343c1);break;case _0x54a5('0xc'):vtiger[_0x331608](_0x1fca58,_0x303a49,_0x40f224,_0x288103,_0x49cc03,_0x4a49d8,_0x3343c1);break;case _0x54a5('0xe'):freshsales['cs'](_0x1fca58,_0x303a49,_0x40f224,_0x288103,_0x49cc03,_0x4a49d8,_0x3343c1,_0x331608);break;case'servicenow':servicenow['cs'](_0x1fca58,_0x303a49,_0x40f224,_0x288103,_0x49cc03,_0x4a49d8,_0x3343c1,_0x331608);break;case _0x54a5('0xd'):dynamics365['cs'](_0x1fca58,_0x303a49,_0x40f224,_0x288103,_0x49cc03,_0x4a49d8,_0x3343c1,_0x331608);break;default:console[_0x54a5('0x19')](_0x54a5('0x1e'));}}else{_0x336f8c=require('../../../../config/logger')(_0x1fca58[_0x54a5('0x12')][_0x54a5('0x13')]());_0x336f8c['error'](_0x54a5('0x1f'),util[_0x54a5('0x20')](_0x54a5('0x21'),_0x1fca58[_0x54a5('0x12')]['toLowerCase'](),_0x1fca58[_0x54a5('0x22')]));}}else{_0x336f8c=require(_0x54a5('0x23'))(_0x1fca58['data1'][_0x54a5('0x13')]());_0x336f8c['error']('[EXEC]',util[_0x54a5('0x20')](_0x54a5('0x24'),_0x1fca58[_0x54a5('0x12')][_0x54a5('0x13')](),_0x1fca58[_0x54a5('0x14')]));}}else{}}catch(_0x5b9a9){console[_0x54a5('0x25')](_0x5b9a9);}}}}; \ No newline at end of file +var _0x5170=['zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','unmanaged','unknown\x20integration','error','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','./freshsales'];(function(_0x5b8c83,_0x2b4181){var _0x366cb7=function(_0x2320c9){while(--_0x2320c9){_0x5b8c83['push'](_0x5b8c83['shift']());}};_0x366cb7(++_0x2b4181);}(_0x5170,0x82));var _0x0517=function(_0x399029,_0x2c9603){_0x399029=_0x399029-0x0;var _0x29855f=_0x5170[_0x399029];return _0x29855f;};'use strict';var _=require(_0x0517('0x0'));var util=require(_0x0517('0x1'));var zendesk=require(_0x0517('0x2'));var salesforce=require(_0x0517('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0517('0x4'));var zoho=require(_0x0517('0x5'));var desk=require(_0x0517('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0x0517('0x7'));var dynamics365=require(_0x0517('0x8'));var freshsales=require(_0x0517('0x9'));var integrations=[_0x0517('0xa'),_0x0517('0xb'),_0x0517('0xc'),_0x0517('0xd'),_0x0517('0xe'),_0x0517('0xf'),_0x0517('0x10'),'dynamics365',_0x0517('0x11'),_0x0517('0x12')];exports['exec']=function(_0x54bada,_0x4b97bd,_0x8f9e38,_0x2cbb74,_0x2822b8,_0x5d324b){if(_0x8f9e38){if(_[_0x0517('0x13')](integrations,_0x54bada[_0x0517('0x14')][_0x0517('0x15')]())){try{var _0x5bf673=null;var _0x5d8b79='';var _0x1cd4e5=_0x8f9e38[_0x54bada[_0x0517('0x14')][_0x0517('0x15')]()];if(_0x1cd4e5){var _0x47afbb=_0x1cd4e5[_0x54bada[_0x0517('0x16')]];if(_0x47afbb){var _0x56457d=_[_0x0517('0x17')](_0x47afbb[_0x0517('0x18')],{'id':parseInt(_0x54bada[_0x0517('0x19')],0xa)});if(_0x56457d){if(_0x2cbb74){if(_0x2822b8&&_0x4b97bd['queue']){_0x5d8b79=_0x0517('0x1a');}else if(_0x4b97bd[_0x0517('0x1b')]){_0x5d8b79=_0x0517('0x1c');}else{console[_0x0517('0x1d')]('EVENT\x20UNKNOWN',_0x4b97bd);}}else{_0x5d8b79=_0x0517('0x1e');}switch(_0x54bada[_0x0517('0x14')][_0x0517('0x15')]()){case _0x0517('0xa'):zendesk[_0x5d8b79](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b);break;case'salesforce':salesforce[_0x5d8b79](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b);break;case _0x0517('0xc'):sugarcrm[_0x5d8b79](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b);break;case _0x0517('0xd'):freshdesk[_0x5d8b79](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b);break;case'zoho':zoho[_0x5d8b79](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b);break;case _0x0517('0xf'):desk[_0x5d8b79](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b);break;case _0x0517('0x10'):vtiger[_0x5d8b79](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b);break;case _0x0517('0x11'):freshsales['cs'](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b,_0x5d8b79);break;case _0x0517('0x12'):servicenow['cs'](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b,_0x5d8b79);break;case'dynamics365':dynamics365['cs'](_0x54bada,_0x4b97bd,_0x56457d,_0x2cbb74,_0x2822b8,_0x47afbb,_0x5d324b,_0x5d8b79);break;default:console['log'](_0x0517('0x1f'));}}else{_0x5bf673=require('../../../../config/logger')(_0x54bada[_0x0517('0x14')][_0x0517('0x15')]());_0x5bf673[_0x0517('0x20')]('[EXEC]',util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x54bada[_0x0517('0x14')][_0x0517('0x15')](),_0x54bada[_0x0517('0x19')]));}}else{_0x5bf673=require('../../../../config/logger')(_0x54bada[_0x0517('0x14')][_0x0517('0x15')]());_0x5bf673[_0x0517('0x20')](_0x0517('0x21'),util['format'](_0x0517('0x22'),_0x54bada['data1'][_0x0517('0x15')](),_0x54bada[_0x0517('0x16')]));}}else{}}catch(_0x57ba82){console[_0x0517('0x20')](_0x57ba82);}}}}; \ 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 5385207..dd1bbae 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 _0x3926=['$or','cloneDeep','additionalSearchLead','merge','account_contact_lead','additionalSearchAccount','Account','Contact','Lead','account','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','defaults','redis','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhatId','Case','ContactId','AccountId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','execute','then','length','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','additionalSearchContact'];(function(_0xee213e,_0xb33561){var _0x3542f1=function(_0x30fb2f){while(--_0x30fb2f){_0xee213e['push'](_0xee213e['shift']());}};_0x3542f1(++_0xb33561);}(_0x3926,0x150));var _0x6392=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x3926[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x6392('0x0'));var rp=require(_0x6392('0x1'));var moment=require(_0x6392('0x2'));var BPromise=require(_0x6392('0x3'));var md5=require(_0x6392('0x4'));var jsforce=require(_0x6392('0x5'));var util=require(_0x6392('0x6'));var Redis=require(_0x6392('0x7'));var intUtil=require(_0x6392('0x8'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('salesforce');config['redis']=_[_0x6392('0x9')](config[_0x6392('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x6392('0xb'))(new Redis(config[_0x6392('0xa')]));function emit(_0x17965b,_0x419197,_0x3c7a23){io['to'](_0x17965b)[_0x6392('0xc')](_0x419197,_0x3c7a23);}function getTicket(_0x3cc3cf,_0x5d9e59,_0x43caeb,_0xcf9cc2,_0x54b774,_0x2796a0,_0x3eb24d,_0x4a9263){var _0x5dc320=Object[_0x6392('0xd')]({},{'OwnerId':_0x5d9e59['id'],'Subject':intUtil[_0x6392('0xe')](_0xcf9cc2[_0x6392('0xf')],_0x54b774,'\x20'),'Description':intUtil['getString'](_0xcf9cc2[_0x6392('0x10')],_0x54b774,'\x0a')},getCustomFields(_0x2796a0,_0x54b774));if(_0x43caeb){if(_0xcf9cc2[_0x6392('0x11')]===_0x6392('0x12')){_0x5dc320['ActivityDate']=moment[_0x6392('0x13')]();_0x5dc320[_0x6392('0x14')]=![];_0x5dc320[_0x6392('0x15')]=![];if(_0x43caeb[_0x6392('0x16')]===_0x6392('0x17')||_0x43caeb[_0x6392('0x16')]===_0x6392('0x18')){_0x5dc320['WhoId']=_0x43caeb['id'];}else if(_0x43caeb[_0x6392('0x16')]==='account'){_0x5dc320[_0x6392('0x19')]=_0x43caeb['id'];}}else if(_0xcf9cc2[_0x6392('0x11')]===_0x6392('0x1a')){if(_0x43caeb['endUserType']===_0x6392('0x17')){_0x5dc320[_0x6392('0x1b')]=_0x43caeb['id'];}else if(_0x43caeb['endUserType']==='account'){_0x5dc320[_0x6392('0x1c')]=_0x43caeb['id'];}else if(_0x43caeb[_0x6392('0x16')]===_0x6392('0x18')&&_0xcf9cc2['leadId']){_0x5dc320[_0xcf9cc2['leadId']]=_0x43caeb['id'];}else{logger[_0x6392('0x1d')](_0x6392('0x1e'));}}}return _0x3eb24d[_0x6392('0x1f')](_0xcf9cc2[_0x6392('0x11')])[_0x6392('0x20')](_0x5dc320);}function getUser(_0x3af797,_0x4040db,_0x5b35aa){if(!_[_0x6392('0x21')](_0x4040db)&&intUtil['validateEmail'](_0x4040db)){var _0x3faba2={'Email':_0x4040db};var _0x46fec3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5b35aa[_0x6392('0x1f')](_0x6392('0x22'))[_0x6392('0x23')](_0x3faba2,_0x46fec3)[_0x6392('0x24')]()[_0x6392('0x25')](function(_0x1f9ed1){if(_0x1f9ed1[_0x6392('0x26')]){var _0x462113=_[_0x6392('0x23')](_0x1f9ed1,function(_0xab6f8a){return _0xab6f8a['Email']===_0x4040db;});if(_0x462113){logger[_0x6392('0x1d')](_0x6392('0x27'),_0x4040db);return BPromise['resolve']({'id':_0x462113['Id'],'name':_0x462113[_0x6392('0x28')]});}}else{logger[_0x6392('0x1d')](_0x6392('0x29'),_0x4040db);return _0x5b35aa['identity']()[_0x6392('0x25')](function(_0x3b2b57){return BPromise[_0x6392('0x2a')]({'id':_0x3b2b57[_0x6392('0x2b')],'name':_0x3b2b57[_0x6392('0x2c')]});});}});}else{logger[_0x6392('0x1d')](_0x6392('0x29'),_0x4040db);return _0x5b35aa[_0x6392('0x2d')]()[_0x6392('0x25')](function(_0x47eed9){return BPromise[_0x6392('0x2a')]({'id':_0x47eed9[_0x6392('0x2b')],'name':_0x47eed9[_0x6392('0x2c')]});});}}function getEndUser(_0x5849dd,_0x4a19e6,_0x1d0a8a,_0xfc3305,_0x441035){var _0x596aed={'$or':{'Phone':_0xfc3305}};var _0x21bb8a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x6392('0x2a')]()[_0x6392('0x25')](function(){logger['info'](_0x6392('0x2e'),_0xfc3305,_0x4a19e6['moduleSearch']);switch(_0x4a19e6['moduleSearch']){case'contact_lead':var _0x5840ed=_['cloneDeep'](_0x596aed);if(_0x4a19e6[_0x6392('0x2f')]){var _0x30ce90={};_0x30ce90[_0x4a19e6[_0x6392('0x2f')]]=_0xfc3305;_['merge'](_0x5840ed[_0x6392('0x30')],_0x30ce90);}return _0x441035[_0x6392('0x1f')]('Contact')['find'](_0x5840ed,_0x21bb8a)['execute']()[_0x6392('0x25')](function(_0xc46548){if(_0xc46548&&_0xc46548['length']){return _0xc46548;}else{var _0x2e7ae9=_[_0x6392('0x31')](_0x596aed);if(_0x4a19e6[_0x6392('0x32')]){var _0xeed004={};_0xeed004[_0x4a19e6[_0x6392('0x32')]]=_0xfc3305;_[_0x6392('0x33')](_0x2e7ae9[_0x6392('0x30')],_0xeed004);}return _0x441035[_0x6392('0x1f')]('Lead')['find'](_0x2e7ae9,_0x21bb8a);}});case _0x6392('0x34'):var _0x6e6b9f=_[_0x6392('0x31')](_0x596aed);if(_0x4a19e6[_0x6392('0x35')]){var _0x30ce90={};_0x30ce90[_0x4a19e6[_0x6392('0x35')]]=_0xfc3305;_[_0x6392('0x33')](_0x6e6b9f[_0x6392('0x30')],_0x30ce90);}return _0x441035[_0x6392('0x1f')](_0x6392('0x36'))['find'](_0x6e6b9f,_0x21bb8a)[_0x6392('0x24')]()[_0x6392('0x25')](function(_0x420598){if(_0x420598&&_0x420598[_0x6392('0x26')]){return _0x420598;}else{var _0x46d0d1=_[_0x6392('0x31')](_0x596aed);if(_0x4a19e6[_0x6392('0x2f')]){var _0x2a5884={};_0x2a5884[_0x4a19e6['additionalSearchContact']]=_0xfc3305;_[_0x6392('0x33')](_0x46d0d1['$or'],_0x2a5884);}return _0x441035[_0x6392('0x1f')](_0x6392('0x37'))['find'](_0x46d0d1,_0x21bb8a)['then'](function(_0x5cb36d){if(_0x5cb36d&&_0x5cb36d[_0x6392('0x26')]){return _0x5cb36d;}else{var _0x26b201=_[_0x6392('0x31')](_0x596aed);if(_0x4a19e6[_0x6392('0x32')]){var _0x1b007a={};_0x1b007a[_0x4a19e6[_0x6392('0x32')]]=_0xfc3305;_[_0x6392('0x33')](_0x26b201[_0x6392('0x30')],_0x1b007a);}return _0x441035[_0x6392('0x1f')]('Lead')[_0x6392('0x23')](_0x26b201,_0x21bb8a);}});}});case _0x6392('0x17'):var _0x5840ed=_[_0x6392('0x31')](_0x596aed);if(_0x4a19e6[_0x6392('0x2f')]){var _0x30ce90={};_0x30ce90[_0x4a19e6[_0x6392('0x2f')]]=_0xfc3305;_['merge'](_0x5840ed[_0x6392('0x30')],_0x30ce90);}return _0x441035[_0x6392('0x1f')](_0x6392('0x37'))[_0x6392('0x23')](_0x5840ed,_0x21bb8a)[_0x6392('0x24')]();case _0x6392('0x18'):var _0x43250a=_[_0x6392('0x31')](_0x596aed);if(_0x4a19e6['additionalSearchLead']){var _0x30ce90={};_0x30ce90[_0x4a19e6['additionalSearchLead']]=_0xfc3305;_['merge'](_0x43250a['$or'],_0x30ce90);}return _0x441035[_0x6392('0x1f')](_0x6392('0x38'))['find'](_0x43250a,_0x21bb8a);case _0x6392('0x39'):var _0x6e6b9f=_[_0x6392('0x31')](_0x596aed);if(_0x4a19e6['additionalSearchAccount']){var _0x30ce90={};_0x30ce90[_0x4a19e6[_0x6392('0x35')]]=_0xfc3305;_[_0x6392('0x33')](_0x6e6b9f['$or'],_0x30ce90);}return _0x441035[_0x6392('0x1f')](_0x6392('0x36'))[_0x6392('0x23')](_0x6e6b9f,_0x21bb8a);default:return null;}})['then'](function(_0x1c3161){if(_0x1c3161&&_0x1c3161[_0x6392('0x26')]){var _0x58ce40=_['first'](_0x1c3161);if(_0x58ce40){return BPromise[_0x6392('0x2a')]({'id':_0x58ce40['Id'],'name':_0x58ce40['Name'],'phone':_0x58ce40['Phone'],'endUserType':_0x58ce40['attributes'][_0x6392('0x3a')]['toLowerCase']()});}}})[_0x6392('0x25')](function(_0x4255c8){if(_0x4255c8){logger[_0x6392('0x1d')](_0x6392('0x3b'),_0x4255c8['endUserType'],_0xfc3305);return BPromise[_0x6392('0x2a')](_0x4255c8);}else{logger[_0x6392('0x1d')](_0x6392('0x3c'),_0xfc3305);var _0x2ffeed={'Phone':_0xfc3305};if(_0x4a19e6['moduleCreate']){if(_0x4a19e6['moduleCreate']===_0x6392('0x17')){logger[_0x6392('0x1d')](_0x6392('0x3d'),_0xfc3305,_0x4a19e6[_0x6392('0x3e')]);_0x2ffeed[_0x6392('0x3f')]=_0x1d0a8a!==_0x6392('0x40')?_0x1d0a8a:util[_0x6392('0x41')](_0x6392('0x42'),_0xfc3305);}else if(_0x4a19e6[_0x6392('0x3e')]===_0x6392('0x18')){logger['info'](_0x6392('0x3d'),_0xfc3305,_0x4a19e6[_0x6392('0x3e')]);_0x2ffeed[_0x6392('0x3f')]=_0x1d0a8a!==_0x6392('0x40')?_0x1d0a8a:util[_0x6392('0x41')](_0x6392('0x42'),_0xfc3305);_0x2ffeed[_0x6392('0x43')]=_0x6392('0x44');}else if(_0x4a19e6[_0x6392('0x3e')]==='account'){logger[_0x6392('0x1d')](_0x6392('0x3d'),_0xfc3305,_0x4a19e6[_0x6392('0x3e')]);_0x2ffeed[_0x6392('0x28')]=_0x1d0a8a!==_0x6392('0x40')?_0x1d0a8a:util['format'](_0x6392('0x42'),_0xfc3305);}else{return null;}}return _0x441035['sobject'](_[_0x6392('0x45')](_0x4a19e6[_0x6392('0x3e')]))[_0x6392('0x20')](_0x2ffeed)[_0x6392('0x25')](function(_0x43908a){return BPromise[_0x6392('0x2a')]({'id':_0x43908a['id'],'endUserType':_0x4a19e6[_0x6392('0x3e')]});});}});}function getCustomFields(_0x578f80,_0x19bfd7){var _0x3d07c5={};if(_0x578f80[_0x6392('0x26')]>0x0){_[_0x6392('0x46')](_0x578f80,function(_0x330254){if(_[_0x6392('0x47')]([_0x6392('0x48'),'picklist'],_0x330254[_0x6392('0x3a')])&&_0x330254[_0x6392('0x49')]){_0x3d07c5[_0x330254[_0x6392('0x49')]]=_0x330254[_0x6392('0x4a')][_0x6392('0x4b')]();}else if(_0x330254['type']===_0x6392('0x4c')&&_0x330254['variableName']&&_0x330254[_0x6392('0x49')]){_0x19bfd7[_0x330254['variableName']]&&(_0x3d07c5[_0x330254[_0x6392('0x49')]]=_0x19bfd7[_0x330254[_0x6392('0x4d')]][_0x6392('0x4b')]());}else if(_0x330254[_0x6392('0x3a')]===_0x6392('0x4e')&&_0x330254[_0x6392('0x4f')]&&_0x330254['Variable']['name']&&_0x330254[_0x6392('0x49')]){_0x19bfd7[_0x330254[_0x6392('0x4f')]['name']['toLowerCase']()]&&(_0x3d07c5[_0x330254[_0x6392('0x49')]]=_0x19bfd7[_0x330254[_0x6392('0x4f')][_0x6392('0x50')][_0x6392('0x51')]()][_0x6392('0x4b')]());}});}return _0x3d07c5;}function getConnection(_0x75b3e8){var _0x123004=_0x75b3e8[_0x6392('0x52')][_0x6392('0x53')](_0x75b3e8[_0x6392('0x54')]);var _0x1b7055=new jsforce[(_0x6392('0x55'))]({'oauth2':{'loginUrl':_0x75b3e8[_0x6392('0x56')]||_0x6392('0x57'),'clientId':_0x75b3e8[_0x6392('0x58')],'clientSecret':_0x75b3e8['clientSecret']}});return _0x1b7055['login'](_0x75b3e8[_0x6392('0x59')],_0x123004)[_0x6392('0x25')](function(){logger[_0x6392('0x1d')](_0x6392('0x5a'));return _0x1b7055;});}exports[_0x6392('0x5b')]=function(_0x2d2244,_0x1b572c,_0x3f8ac9,_0xacc703,_0x2ea1e4,_0x1270a0){var _0x2b4b4e,_0x19e8de,_0x146edb,_0x575600;_0x1270a0[_0x6392('0x5c')]=intUtil['stripTrailingSlash'](_0x1270a0[_0x6392('0x5c')]);_0x1270a0[_0x6392('0x56')]=intUtil[_0x6392('0x5d')](_0x1270a0[_0x6392('0x56')]);if(_0x2ea1e4&&_0x2ea1e4[_0x6392('0x5e')]){logger[_0x6392('0x1d')](_0x6392('0x5f'),_0x6392('0x60'));_0x1b572c[_0x6392('0x61')]=util[_0x6392('0x41')](_0x6392('0x62'),_0x1270a0[_0x6392('0x5c')],_0x1b572c[_0x6392('0x63')],md5(_0x1b572c['uniqueid']));}else{_0x1b572c[_0x6392('0x61')]='';}return getConnection(_0x1270a0)['then'](function(_0x4ca46f){_0x575600=_0x4ca46f;return getUser(_0x1270a0,_0xacc703[_0x6392('0x64')],_0x575600);})[_0x6392('0x25')](function(_0x2c4c91){_0x2b4b4e=_0x2c4c91;return getEndUser(_0x1270a0,_0x3f8ac9,_0x1b572c[_0x6392('0x65')],_0x1b572c['calleridnum'],_0x575600);})[_0x6392('0x25')](function(_0x52e855){_0x19e8de=_0x52e855;return getTicket(_0x1270a0,_0x2b4b4e,_0x19e8de,_0x3f8ac9,_0x1b572c,_0x3f8ac9[_0x6392('0x66')],_0x575600,_0x6392('0x5b'));})[_0x6392('0x25')](function(_0x266150){_0x146edb=_0x266150;logger[_0x6392('0x1d')](_0x6392('0x67'),_0x146edb['id']);logger[_0x6392('0x1d')](_0x6392('0x68'),_0x146edb['id'],_0xacc703[_0x6392('0x50')],_0x1270a0[_0x6392('0x3a')]);switch(_0x1270a0['type']){case _0x6392('0x69'):emit(util['format'](_0x6392('0x6a'),_0xacc703[_0x6392('0x50')]),'trigger:salesforce:display',{'recordId':_0x146edb['id']});break;case _0x6392('0x6b'):emit(util['format'](_0x6392('0x6a'),_0xacc703['name']),_0x6392('0x6c'),{'uri':util[_0x6392('0x41')](_0x6392('0x6d'),_0x575600['instanceUrl'],_0x146edb['id'])});break;default:logger[_0x6392('0x6e')](_0x6392('0x6f'));}})[_0x6392('0x70')](function(_0xdc373f){logger[_0x6392('0x6e')](_0x6392('0x5f'),_0xdc373f);});};exports[_0x6392('0x71')]=function(_0x27a4df,_0x4e7181,_0x5256d7,_0x5955d9,_0x233c07,_0x21c6cb,_0x511517){var _0x2eeaef,_0x1c3d30,_0xb0d8c4,_0x5abf99;_0x21c6cb[_0x6392('0x5c')]=intUtil['stripTrailingSlash'](_0x21c6cb[_0x6392('0x5c')]);_0x21c6cb[_0x6392('0x56')]=intUtil[_0x6392('0x5d')](_0x21c6cb[_0x6392('0x56')]);if(_0x511517&&_0x511517[_0x6392('0x72')]&&_0x511517[_0x6392('0x72')]!==_0x6392('0x73')){logger['info'](_0x6392('0x74'),_0x6392('0x60'));_0x4e7181['recordingURL']=util[_0x6392('0x41')](_0x6392('0x62'),_0x21c6cb[_0x6392('0x5c')],_0x4e7181[_0x6392('0x63')],md5(_0x4e7181[_0x6392('0x63')]));}return getConnection(_0x21c6cb)[_0x6392('0x25')](function(_0x284095){_0x5abf99=_0x284095;return getUser(_0x21c6cb,_0x5955d9[_0x6392('0x64')],_0x5abf99);})[_0x6392('0x25')](function(_0x3624e7){_0x2eeaef=_0x3624e7;return getEndUser(_0x21c6cb,_0x5256d7,_0x4e7181['destcalleridname'],_0x4e7181[_0x6392('0x75')],_0x5abf99);})[_0x6392('0x25')](function(_0x5e54d3){_0x1c3d30=_0x5e54d3;return getTicket(_0x21c6cb,_0x2eeaef,_0x1c3d30,_0x5256d7,_0x4e7181,_0x5256d7[_0x6392('0x66')],_0x5abf99,_0x6392('0x71'));})[_0x6392('0x25')](function(_0x1b144f){_0xb0d8c4=_0x1b144f;logger[_0x6392('0x1d')](_0x6392('0x76'),_0xb0d8c4['id']);logger['info'](_0x6392('0x77'),_0xb0d8c4['id'],_0x5955d9[_0x6392('0x50')],_0x21c6cb[_0x6392('0x3a')]);switch(_0x21c6cb['type']){case _0x6392('0x69'):emit(util['format']('user:%s',_0x5955d9[_0x6392('0x50')]),_0x6392('0x78'),{'recordId':_0xb0d8c4['id']});break;case _0x6392('0x6b'):emit(util['format'](_0x6392('0x6a'),_0x5955d9[_0x6392('0x50')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x5abf99['instanceUrl'],_0xb0d8c4['id'])});break;default:logger[_0x6392('0x6e')](_0x6392('0x74'),_0x6392('0x79'));}})['catch'](function(_0xe5e309){logger[_0x6392('0x6e')](_0x6392('0x74'),_0xe5e309);});};exports[_0x6392('0x7a')]=function(_0x26995e,_0x4be3df,_0x158d58,_0x4bc96a,_0x42b1db,_0x1219f6){var _0x50635a,_0x396be0,_0xef35b,_0x408319;_0x1219f6[_0x6392('0x5c')]=intUtil[_0x6392('0x5d')](_0x1219f6[_0x6392('0x5c')]);_0x1219f6['remoteUri']=intUtil['stripTrailingSlash'](_0x1219f6['remoteUri']);if(_0x42b1db&&_0x42b1db['monitor_format']){logger[_0x6392('0x1d')]('['+_0x4be3df[_0x6392('0x7b')][_0x6392('0x7c')]()+']',_0x6392('0x60'));_0x4be3df['recordingURL']=util[_0x6392('0x41')](_0x6392('0x62'),_0x1219f6[_0x6392('0x5c')],_0x4be3df['uniqueid'],md5(_0x4be3df[_0x6392('0x63')]));}else{_0x4be3df[_0x6392('0x61')]='';}return getConnection(_0x1219f6)[_0x6392('0x25')](function(_0xb8b76e){_0x408319=_0xb8b76e;if(!_[_0x6392('0x21')](_0x4bc96a)){return getUser(_0x1219f6,_0x4bc96a['name'],_0x408319);}else{return getUser(_0x1219f6,null,_0x408319);}})['then'](function(_0x478ffa){_0x50635a=_0x478ffa;return getEndUser(_0x1219f6,_0x158d58,_0x4be3df['calleridname'],_0x4be3df[_0x6392('0x7d')],_0x408319);})[_0x6392('0x25')](function(_0x3dcce6){_0x396be0=_0x3dcce6;return getTicket(_0x1219f6,_0x50635a,_0x396be0,_0x158d58,_0x4be3df,_0x158d58[_0x6392('0x66')],_0x408319);})[_0x6392('0x25')](function(_0x4ede95){_0xef35b=_0x4ede95;logger[_0x6392('0x1d')]('['+_0x4be3df[_0x6392('0x7b')][_0x6392('0x7c')]()+_0x6392('0x7e'),_0xef35b['id']);logger[_0x6392('0x1d')]('['+_0x4be3df[_0x6392('0x7b')][_0x6392('0x7c')]()+_0x6392('0x7f'),_0x1219f6['type']);})[_0x6392('0x70')](function(_0x27a9e3){logger['error']('['+_0x4be3df[_0x6392('0x7b')]['toUpperCase']()+']',_0x27a9e3);});}; \ No newline at end of file +var _0x10d5=['recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','find','execute','length','Email','info','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','then','resolve','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','additionalSearchAccount','Lead','first','Phone','type','toLowerCase','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','create','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','queue','serverUrl','stripTrailingSlash','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound'];(function(_0x1cdabe,_0x286194){var _0x3dcc9c=function(_0x5aa9c7){while(--_0x5aa9c7){_0x1cdabe['push'](_0x1cdabe['shift']());}};_0x3dcc9c(++_0x286194);}(_0x10d5,0xfe));var _0x510d=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0x10d5[_0x4843f9];return _0x193c6a;};'use strict';var _=require(_0x510d('0x0'));var rp=require(_0x510d('0x1'));var moment=require(_0x510d('0x2'));var BPromise=require('bluebird');var md5=require(_0x510d('0x3'));var jsforce=require(_0x510d('0x4'));var util=require(_0x510d('0x5'));var Redis=require(_0x510d('0x6'));var intUtil=require('./util');var config=require(_0x510d('0x7'));var logger=require('../../../../config/logger')(_0x510d('0x8'));config[_0x510d('0x9')]=_[_0x510d('0xa')](config[_0x510d('0x9')],{'host':_0x510d('0xb'),'port':0x18eb});var io=require(_0x510d('0xc'))(new Redis(config['redis']));function emit(_0x2bbb1b,_0x2a6b43,_0x4592f2){io['to'](_0x2bbb1b)[_0x510d('0xd')](_0x2a6b43,_0x4592f2);}function getTicket(_0x4f00c3,_0x5a6b62,_0x2ca24e,_0x2a019e,_0x367742,_0x68c183,_0x3277f7,_0x5322f8){var _0x20326=Object[_0x510d('0xe')]({},{'OwnerId':_0x5a6b62['id'],'Subject':intUtil[_0x510d('0xf')](_0x2a019e[_0x510d('0x10')],_0x367742,'\x20'),'Description':intUtil[_0x510d('0xf')](_0x2a019e[_0x510d('0x11')],_0x367742,'\x0a')},getCustomFields(_0x68c183,_0x367742));if(_0x2ca24e){if(_0x2a019e[_0x510d('0x12')]===_0x510d('0x13')){_0x20326[_0x510d('0x14')]=moment[_0x510d('0x15')]();_0x20326['IsReminderSet']=![];_0x20326[_0x510d('0x16')]=![];if(_0x2ca24e[_0x510d('0x17')]===_0x510d('0x18')||_0x2ca24e['endUserType']===_0x510d('0x19')){_0x20326[_0x510d('0x1a')]=_0x2ca24e['id'];}else if(_0x2ca24e[_0x510d('0x17')]===_0x510d('0x1b')){_0x20326[_0x510d('0x1c')]=_0x2ca24e['id'];}}else if(_0x2a019e[_0x510d('0x12')]==='Case'){if(_0x2ca24e[_0x510d('0x17')]===_0x510d('0x18')){_0x20326[_0x510d('0x1d')]=_0x2ca24e['id'];}else if(_0x2ca24e[_0x510d('0x17')]==='account'){_0x20326[_0x510d('0x1e')]=_0x2ca24e['id'];}else if(_0x2ca24e['endUserType']===_0x510d('0x19')&&_0x2a019e[_0x510d('0x1f')]){_0x20326[_0x2a019e[_0x510d('0x1f')]]=_0x2ca24e['id'];}else{logger['info'](_0x510d('0x20'));}}}return _0x3277f7[_0x510d('0x21')](_0x2a019e[_0x510d('0x12')])['create'](_0x20326);}function getUser(_0x724668,_0x22c12e,_0x29a8ac){if(!_[_0x510d('0x22')](_0x22c12e)&&intUtil['validateEmail'](_0x22c12e)){var _0x45314f={'Email':_0x22c12e};var _0x37cbc2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x29a8ac['sobject']('User')[_0x510d('0x23')](_0x45314f,_0x37cbc2)[_0x510d('0x24')]()['then'](function(_0x8bc2d7){if(_0x8bc2d7[_0x510d('0x25')]){var _0x48611a=_['find'](_0x8bc2d7,function(_0x5699ed){return _0x5699ed[_0x510d('0x26')]===_0x22c12e;});if(_0x48611a){logger[_0x510d('0x27')](_0x510d('0x28'),_0x22c12e);return BPromise['resolve']({'id':_0x48611a['Id'],'name':_0x48611a[_0x510d('0x29')]});}}else{logger[_0x510d('0x27')](_0x510d('0x2a'),_0x22c12e);return _0x29a8ac['identity']()['then'](function(_0x2f89a8){return BPromise['resolve']({'id':_0x2f89a8[_0x510d('0x2b')],'name':_0x2f89a8[_0x510d('0x2c')]});});}});}else{logger['info'](_0x510d('0x2a'),_0x22c12e);return _0x29a8ac[_0x510d('0x2d')]()[_0x510d('0x2e')](function(_0x48d905){return BPromise[_0x510d('0x2f')]({'id':_0x48d905['user_id'],'name':_0x48d905[_0x510d('0x2c')]});});}}function getEndUser(_0x137738,_0x4b363c,_0x15d39f,_0x168834,_0x40329c){var _0x35ea8d={'$or':{'Phone':_0x168834}};var _0x321807={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x510d('0x2f')]()[_0x510d('0x2e')](function(){logger[_0x510d('0x27')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x168834,_0x4b363c[_0x510d('0x30')]);switch(_0x4b363c['moduleSearch']){case _0x510d('0x31'):var _0x203b67=_[_0x510d('0x32')](_0x35ea8d);if(_0x4b363c[_0x510d('0x33')]){var _0x4c8053={};_0x4c8053[_0x4b363c[_0x510d('0x33')]]=_0x168834;_[_0x510d('0x34')](_0x203b67[_0x510d('0x35')],_0x4c8053);}return _0x40329c[_0x510d('0x21')](_0x510d('0x36'))['find'](_0x203b67,_0x321807)[_0x510d('0x24')]()[_0x510d('0x2e')](function(_0x76791a){if(_0x76791a&&_0x76791a[_0x510d('0x25')]){return _0x76791a;}else{var _0x3ec2b7=_[_0x510d('0x32')](_0x35ea8d);if(_0x4b363c[_0x510d('0x37')]){var _0xfc3c4b={};_0xfc3c4b[_0x4b363c[_0x510d('0x37')]]=_0x168834;_[_0x510d('0x34')](_0x3ec2b7['$or'],_0xfc3c4b);}return _0x40329c[_0x510d('0x21')]('Lead')[_0x510d('0x23')](_0x3ec2b7,_0x321807);}});case'account_contact_lead':var _0x4fde9b=_['cloneDeep'](_0x35ea8d);if(_0x4b363c[_0x510d('0x38')]){var _0x4c8053={};_0x4c8053[_0x4b363c[_0x510d('0x38')]]=_0x168834;_['merge'](_0x4fde9b['$or'],_0x4c8053);}return _0x40329c['sobject']('Account')[_0x510d('0x23')](_0x4fde9b,_0x321807)[_0x510d('0x24')]()[_0x510d('0x2e')](function(_0xec9e60){if(_0xec9e60&&_0xec9e60['length']){return _0xec9e60;}else{var _0x55c74f=_[_0x510d('0x32')](_0x35ea8d);if(_0x4b363c['additionalSearchContact']){var _0x4de575={};_0x4de575[_0x4b363c['additionalSearchContact']]=_0x168834;_[_0x510d('0x34')](_0x55c74f[_0x510d('0x35')],_0x4de575);}return _0x40329c[_0x510d('0x21')](_0x510d('0x36'))[_0x510d('0x23')](_0x55c74f,_0x321807)[_0x510d('0x2e')](function(_0x4e4566){if(_0x4e4566&&_0x4e4566[_0x510d('0x25')]){return _0x4e4566;}else{var _0x3ba8c7=_['cloneDeep'](_0x35ea8d);if(_0x4b363c['additionalSearchLead']){var _0x20697b={};_0x20697b[_0x4b363c[_0x510d('0x37')]]=_0x168834;_[_0x510d('0x34')](_0x3ba8c7[_0x510d('0x35')],_0x20697b);}return _0x40329c['sobject'](_0x510d('0x39'))['find'](_0x3ba8c7,_0x321807);}});}});case _0x510d('0x18'):var _0x203b67=_[_0x510d('0x32')](_0x35ea8d);if(_0x4b363c['additionalSearchContact']){var _0x4c8053={};_0x4c8053[_0x4b363c['additionalSearchContact']]=_0x168834;_[_0x510d('0x34')](_0x203b67['$or'],_0x4c8053);}return _0x40329c[_0x510d('0x21')](_0x510d('0x36'))[_0x510d('0x23')](_0x203b67,_0x321807)[_0x510d('0x24')]();case _0x510d('0x19'):var _0xf5b64c=_[_0x510d('0x32')](_0x35ea8d);if(_0x4b363c['additionalSearchLead']){var _0x4c8053={};_0x4c8053[_0x4b363c[_0x510d('0x37')]]=_0x168834;_[_0x510d('0x34')](_0xf5b64c[_0x510d('0x35')],_0x4c8053);}return _0x40329c[_0x510d('0x21')](_0x510d('0x39'))['find'](_0xf5b64c,_0x321807);case _0x510d('0x1b'):var _0x4fde9b=_[_0x510d('0x32')](_0x35ea8d);if(_0x4b363c[_0x510d('0x38')]){var _0x4c8053={};_0x4c8053[_0x4b363c[_0x510d('0x38')]]=_0x168834;_[_0x510d('0x34')](_0x4fde9b[_0x510d('0x35')],_0x4c8053);}return _0x40329c[_0x510d('0x21')]('Account')[_0x510d('0x23')](_0x4fde9b,_0x321807);default:return null;}})['then'](function(_0x535deb){if(_0x535deb&&_0x535deb[_0x510d('0x25')]){var _0x30956e=_[_0x510d('0x3a')](_0x535deb);if(_0x30956e){return BPromise[_0x510d('0x2f')]({'id':_0x30956e['Id'],'name':_0x30956e[_0x510d('0x29')],'phone':_0x30956e[_0x510d('0x3b')],'endUserType':_0x30956e['attributes'][_0x510d('0x3c')][_0x510d('0x3d')]()});}}})['then'](function(_0x29e45d){if(_0x29e45d){logger[_0x510d('0x27')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x29e45d[_0x510d('0x17')],_0x168834);return BPromise['resolve'](_0x29e45d);}else{logger[_0x510d('0x27')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x168834);var _0xaac4a3={'Phone':_0x168834};if(_0x4b363c['moduleCreate']){if(_0x4b363c[_0x510d('0x3e')]==='contact'){logger[_0x510d('0x27')](_0x510d('0x3f'),_0x168834,_0x4b363c[_0x510d('0x3e')]);_0xaac4a3[_0x510d('0x40')]=_0x15d39f!==_0x510d('0x41')?_0x15d39f:util[_0x510d('0x42')](_0x510d('0x43'),_0x168834);}else if(_0x4b363c[_0x510d('0x3e')]==='lead'){logger[_0x510d('0x27')](_0x510d('0x3f'),_0x168834,_0x4b363c['moduleCreate']);_0xaac4a3[_0x510d('0x40')]=_0x15d39f!==''?_0x15d39f:util[_0x510d('0x42')](_0x510d('0x43'),_0x168834);_0xaac4a3['Company']=_0x510d('0x44');}else if(_0x4b363c['moduleCreate']===_0x510d('0x1b')){logger[_0x510d('0x27')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x168834,_0x4b363c['moduleCreate']);_0xaac4a3[_0x510d('0x29')]=_0x15d39f!==''?_0x15d39f:util[_0x510d('0x42')](_0x510d('0x43'),_0x168834);}else{return null;}}return _0x40329c['sobject'](_['upperFirst'](_0x4b363c['moduleCreate']))[_0x510d('0x45')](_0xaac4a3)[_0x510d('0x2e')](function(_0x5d675e){return BPromise['resolve']({'id':_0x5d675e['id'],'endUserType':_0x4b363c[_0x510d('0x3e')]});});}});}function getCustomFields(_0x41b1f1,_0x19b746){var _0x3bbaa1={};if(_0x41b1f1[_0x510d('0x25')]>0x0){_['forEach'](_0x41b1f1,function(_0x2bc2eb){if(_[_0x510d('0x46')]([_0x510d('0x47'),'picklist'],_0x2bc2eb[_0x510d('0x3c')])&&_0x2bc2eb['idField']){_0x3bbaa1[_0x2bc2eb[_0x510d('0x48')]]=_0x2bc2eb[_0x510d('0x49')][_0x510d('0x4a')]();}else if(_0x2bc2eb['type']===_0x510d('0x4b')&&_0x2bc2eb[_0x510d('0x4c')]&&_0x2bc2eb[_0x510d('0x48')]){_0x19b746[_0x2bc2eb[_0x510d('0x4c')]]&&(_0x3bbaa1[_0x2bc2eb[_0x510d('0x48')]]=_0x19b746[_0x2bc2eb[_0x510d('0x4c')]][_0x510d('0x4a')]());}else if(_0x2bc2eb[_0x510d('0x3c')]===_0x510d('0x4d')&&_0x2bc2eb[_0x510d('0x4e')]&&_0x2bc2eb[_0x510d('0x4e')]['name']&&_0x2bc2eb[_0x510d('0x48')]){_0x19b746[_0x2bc2eb['Variable'][_0x510d('0x4f')][_0x510d('0x3d')]()]&&(_0x3bbaa1[_0x2bc2eb[_0x510d('0x48')]]=_0x19b746[_0x2bc2eb[_0x510d('0x4e')][_0x510d('0x4f')][_0x510d('0x3d')]()]['toString']());}});}return _0x3bbaa1;}function getConnection(_0x25aa55){var _0x58b9e4=_0x25aa55['password'][_0x510d('0x50')](_0x25aa55[_0x510d('0x51')]);var _0x19d537=new jsforce[(_0x510d('0x52'))]({'oauth2':{'loginUrl':_0x25aa55['remoteUri']||_0x510d('0x53'),'clientId':_0x25aa55[_0x510d('0x54')],'clientSecret':_0x25aa55[_0x510d('0x55')]}});return _0x19d537[_0x510d('0x56')](_0x25aa55['username'],_0x58b9e4)['then'](function(){logger[_0x510d('0x27')]('Connection\x20established.');return _0x19d537;});}exports[_0x510d('0x57')]=function(_0x559b15,_0x4f6a52,_0x1a5136,_0x4680ff,_0x3db154,_0x2f8897){var _0x80cd61,_0x43c89e,_0x231125,_0x974b14;_0x2f8897[_0x510d('0x58')]=intUtil[_0x510d('0x59')](_0x2f8897[_0x510d('0x58')]);_0x2f8897[_0x510d('0x5a')]=intUtil[_0x510d('0x59')](_0x2f8897['remoteUri']);if(_0x3db154&&_0x3db154['monitor_format']){logger[_0x510d('0x27')](_0x510d('0x5b'),_0x510d('0x5c'));_0x4f6a52['recordingURL']=util[_0x510d('0x42')](_0x510d('0x5d'),_0x2f8897[_0x510d('0x58')],_0x4f6a52['uniqueid'],md5(_0x4f6a52[_0x510d('0x5e')]));}else{_0x4f6a52[_0x510d('0x5f')]='';}return getConnection(_0x2f8897)[_0x510d('0x2e')](function(_0x1d6869){_0x974b14=_0x1d6869;return getUser(_0x2f8897,_0x4680ff[_0x510d('0x60')],_0x974b14);})[_0x510d('0x2e')](function(_0x5451c0){_0x80cd61=_0x5451c0;return getEndUser(_0x2f8897,_0x1a5136,_0x4f6a52[_0x510d('0x61')],_0x4f6a52[_0x510d('0x62')],_0x974b14);})[_0x510d('0x2e')](function(_0x2a8247){_0x43c89e=_0x2a8247;return getTicket(_0x2f8897,_0x80cd61,_0x43c89e,_0x1a5136,_0x4f6a52,_0x1a5136['Fields'],_0x974b14,_0x510d('0x57'));})['then'](function(_0x3e18d6){_0x231125=_0x3e18d6;logger[_0x510d('0x27')](_0x510d('0x63'),_0x231125['id']);logger[_0x510d('0x27')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x231125['id'],_0x4680ff[_0x510d('0x4f')],_0x2f8897[_0x510d('0x3c')]);switch(_0x2f8897['type']){case _0x510d('0x64'):emit(util[_0x510d('0x42')](_0x510d('0x65'),_0x4680ff[_0x510d('0x4f')]),_0x510d('0x66'),{'recordId':_0x231125['id']});break;case'newTab':emit(util[_0x510d('0x42')](_0x510d('0x65'),_0x4680ff[_0x510d('0x4f')]),_0x510d('0x67'),{'uri':util[_0x510d('0x42')](_0x510d('0x68'),_0x974b14[_0x510d('0x69')],_0x231125['id'])});break;default:logger[_0x510d('0x6a')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x510d('0x6b')](function(_0x395679){logger[_0x510d('0x6a')](_0x510d('0x5b'),_0x395679);});};exports[_0x510d('0x6c')]=function(_0x39e5da,_0x1ae994,_0x115804,_0x289eb0,_0x43cd6d,_0x4b9321,_0x405b23){var _0x113b2d,_0x4f83cc,_0x3c3ac6,_0xb1af00;_0x4b9321[_0x510d('0x58')]=intUtil[_0x510d('0x59')](_0x4b9321[_0x510d('0x58')]);_0x4b9321['remoteUri']=intUtil[_0x510d('0x59')](_0x4b9321[_0x510d('0x5a')]);if(_0x405b23&&_0x405b23[_0x510d('0x6d')]&&_0x405b23[_0x510d('0x6d')]!==_0x510d('0x6e')){logger[_0x510d('0x27')](_0x510d('0x6f'),_0x510d('0x5c'));_0x1ae994['recordingURL']=util[_0x510d('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b9321[_0x510d('0x58')],_0x1ae994[_0x510d('0x5e')],md5(_0x1ae994['uniqueid']));}return getConnection(_0x4b9321)[_0x510d('0x2e')](function(_0x4a2860){_0xb1af00=_0x4a2860;return getUser(_0x4b9321,_0x289eb0[_0x510d('0x60')],_0xb1af00);})['then'](function(_0x3b44ec){_0x113b2d=_0x3b44ec;return getEndUser(_0x4b9321,_0x115804,_0x1ae994[_0x510d('0x70')],_0x1ae994[_0x510d('0x71')],_0xb1af00);})['then'](function(_0x265019){_0x4f83cc=_0x265019;return getTicket(_0x4b9321,_0x113b2d,_0x4f83cc,_0x115804,_0x1ae994,_0x115804[_0x510d('0x72')],_0xb1af00,_0x510d('0x6c'));})[_0x510d('0x2e')](function(_0x350e3c){_0x3c3ac6=_0x350e3c;logger[_0x510d('0x27')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x3c3ac6['id']);logger['info'](_0x510d('0x73'),_0x3c3ac6['id'],_0x289eb0[_0x510d('0x4f')],_0x4b9321[_0x510d('0x3c')]);switch(_0x4b9321['type']){case _0x510d('0x64'):emit(util[_0x510d('0x42')](_0x510d('0x65'),_0x289eb0['name']),_0x510d('0x66'),{'recordId':_0x3c3ac6['id']});break;case _0x510d('0x74'):emit(util['format'](_0x510d('0x65'),_0x289eb0['name']),'trigger:browser:url',{'uri':util[_0x510d('0x42')](_0x510d('0x68'),_0xb1af00[_0x510d('0x69')],_0x3c3ac6['id'])});break;default:logger['error'](_0x510d('0x6f'),_0x510d('0x75'));}})[_0x510d('0x6b')](function(_0x2eeea4){logger[_0x510d('0x6a')](_0x510d('0x6f'),_0x2eeea4);});};exports['unmanaged']=function(_0x3913d2,_0x3e7ff6,_0x2ac17e,_0x41c05a,_0x5ec4fb,_0x5732b9){var _0x611d2f,_0x43e823,_0x336f65,_0x14b54a;_0x5732b9[_0x510d('0x58')]=intUtil[_0x510d('0x59')](_0x5732b9[_0x510d('0x58')]);_0x5732b9[_0x510d('0x5a')]=intUtil[_0x510d('0x59')](_0x5732b9['remoteUri']);if(_0x5ec4fb&&_0x5ec4fb['monitor_format']){logger[_0x510d('0x27')]('['+_0x3e7ff6[_0x510d('0x76')][_0x510d('0x77')]()+']','Recording\x20is\x20enabled!');_0x3e7ff6[_0x510d('0x5f')]=util[_0x510d('0x42')](_0x510d('0x5d'),_0x5732b9[_0x510d('0x58')],_0x3e7ff6[_0x510d('0x5e')],md5(_0x3e7ff6[_0x510d('0x5e')]));}else{_0x3e7ff6['recordingURL']='';}return getConnection(_0x5732b9)[_0x510d('0x2e')](function(_0x32c6b3){_0x14b54a=_0x32c6b3;if(!_[_0x510d('0x22')](_0x41c05a)){return getUser(_0x5732b9,_0x41c05a[_0x510d('0x4f')],_0x14b54a);}else{return getUser(_0x5732b9,null,_0x14b54a);}})[_0x510d('0x2e')](function(_0x4cf24d){_0x611d2f=_0x4cf24d;return getEndUser(_0x5732b9,_0x2ac17e,_0x3e7ff6[_0x510d('0x61')],_0x3e7ff6[_0x510d('0x62')],_0x14b54a);})[_0x510d('0x2e')](function(_0x184dd3){_0x43e823=_0x184dd3;return getTicket(_0x5732b9,_0x611d2f,_0x43e823,_0x2ac17e,_0x3e7ff6,_0x2ac17e['Fields'],_0x14b54a);})[_0x510d('0x2e')](function(_0x16a844){_0x336f65=_0x16a844;logger[_0x510d('0x27')]('['+_0x3e7ff6[_0x510d('0x76')][_0x510d('0x77')]()+']\x20Ticket\x20%s\x20created.',_0x336f65['id']);logger[_0x510d('0x27')]('['+_0x3e7ff6[_0x510d('0x76')]['toUpperCase']()+_0x510d('0x78'),_0x5732b9[_0x510d('0x3c')]);})[_0x510d('0x6b')](function(_0x2b0471){logger[_0x510d('0x6a')]('['+_0x3e7ff6['lastevent'][_0x510d('0x77')]()+']',_0x2b0471);});}; \ 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 1bcf8c6..737fde0 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 _0x0855=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','info','toUpperCase','catch','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','adminId','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','userId','adminEmail','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','variable','idField','customVariable','Variable','name','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','forEach','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','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','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','format'];(function(_0x1e8bda,_0x6dd280){var _0x59a4d9=function(_0xf7660e){while(--_0xf7660e){_0x1e8bda['push'](_0x1e8bda['shift']());}};_0x59a4d9(++_0x6dd280);}(_0x0855,0x7a));var _0x5085=function(_0xcd49bd,_0x2a12a3){_0xcd49bd=_0xcd49bd-0x0;var _0xb6ee44=_0x0855[_0xcd49bd];return _0xb6ee44;};'use strict';var _=require(_0x5085('0x0'));var Promise=require(_0x5085('0x1'));var rp=require(_0x5085('0x2'));var util=require(_0x5085('0x3'));var md5=require(_0x5085('0x4'));var Redis=require(_0x5085('0x5'));var intUtil=require(_0x5085('0x6'));var config=require(_0x5085('0x7'));var logger=require(_0x5085('0x8'))(_0x5085('0x9'));config[_0x5085('0xa')]=_['defaults'](config['redis'],{'host':_0x5085('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5085('0xa')]));function getAdminUser(_0x50723c,_0x57595f,_0x3bf670,_0x7b1f79,_0x3cd6d6,_0x591c2d){return new Promise(function(_0x1366ee,_0x31a1b6){var _0x24e790={'method':_0x5085('0xc'),'uri':_0x7b1f79+_0x5085('0xd')+'&'+_0x3cd6d6+'&'+_0x591c2d,'auth':_0x57595f,'json':!![]};return rp(_0x24e790)[_0x5085('0xe')](function(_0x3dd440){if(_0x3dd440[_0x5085('0xf')][_0x5085('0x10')]>0x0){_0x3bf670['adminId']=_0x3dd440[_0x5085('0xf')][0x0][_0x5085('0x11')];}logger[_0x5085('0x12')]('['+[_0x50723c[_0x5085('0x13')]()]+'],\x20getAdminUser\x20crm',_0x3bf670);_0x1366ee(_0x3bf670);})[_0x5085('0x14')](function(_0x3a4edd){logger['error']('['+[_0x50723c[_0x5085('0x13')]()]+']',_0x3a4edd['message']);_0x31a1b6(_0x3a4edd[_0x5085('0x15')]);});});}function getUser(_0x5c35c2,_0x5641f3,_0x1e0b8c,_0x38db42,_0x42ba8c){return function(_0x424f98){logger['info']('['+[_0x5c35c2[_0x5085('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x424f98);return new Promise(function(_0x1da37c,_0x580252){if(intUtil['validateEmail'](_0x424f98[_0x5085('0x16')])){var _0x38df85={'method':_0x5085('0xc'),'uri':_0x1e0b8c+_0x5085('0x17')+_0x424f98[_0x5085('0x16')]+'&'+_0x38db42+'&'+_0x42ba8c,'auth':_0x5641f3,'json':!![]};logger[_0x5085('0x12')]('['+[_0x5c35c2[_0x5085('0x13')]()]+_0x5085('0x18'),_0x38df85);return rp(_0x38df85)['then'](function(_0x2e3bf4){logger[_0x5085('0x12')]('['+[_0x5c35c2[_0x5085('0x13')]()]+_0x5085('0x19'),_0x2e3bf4);if(_0x2e3bf4[_0x5085('0xf')][_0x5085('0x10')]>0x0&&String(_0x2e3bf4[_0x5085('0xf')][0x0]['active'])===_0x5085('0x1a')){_0x424f98['userId']=_0x2e3bf4[_0x5085('0xf')][0x0][_0x5085('0x11')];}else{_0x424f98['userId']=_0x424f98[_0x5085('0x1b')];_0x424f98['userEmail']=_0x424f98['adminEmail'];}logger[_0x5085('0x12')]('['+[_0x5c35c2[_0x5085('0x13')]()]+_0x5085('0x1c'),_0x424f98);_0x1da37c(_0x424f98);})[_0x5085('0x14')](function(_0x29981e){logger[_0x5085('0x1d')]('['+[_0x5c35c2['toUpperCase']()]+']',_0x29981e[_0x5085('0x15')]);_0x580252(_0x29981e[_0x5085('0x15')]);});}else{logger[_0x5085('0x12')]('['+[_0x5c35c2[_0x5085('0x13')]()]+_0x5085('0x1e'));_0x424f98[_0x5085('0x1f')]=_0x424f98['adminId'];_0x424f98[_0x5085('0x16')]=_0x424f98[_0x5085('0x20')];_0x1da37c(_0x424f98);}});};}function createEndUser(_0x18c6ff,_0x37eee3,_0x3897b6,_0xc524ac,_0x3d2c31){logger[_0x5085('0x12')]('['+[_0x18c6ff[_0x5085('0x13')]()]+'],\x20createEndUser\x20input\x20crm',_0x3897b6);return new Promise(function(_0x2a6599,_0x45655a){var _0x25a8fb={'method':_0x5085('0x21'),'uri':_0xc524ac+_0x5085('0x22')+_0x3d2c31,'body':{'user_name':_0x3897b6[_0x5085('0x23')],'roles':_0x5085('0x24'),'first_name':_0x3897b6[_0x5085('0x23')],'active':_0x5085('0x1a'),'date_format':_0x5085('0x25'),'phone':_0x3897b6['endUserNumber']},'auth':_0x37eee3,'json':!![]};return rp(_0x25a8fb)[_0x5085('0xe')](function(_0x116bfc){logger[_0x5085('0x12')]('['+[_0x18c6ff[_0x5085('0x13')]()]+_0x5085('0x26'),_0x116bfc['result']);_0x3897b6['endUserId']=_0x116bfc[_0x5085('0xf')][_0x5085('0x11')];_0x2a6599(_0x3897b6);})[_0x5085('0x14')](function(_0x9df5c0){logger[_0x5085('0x1d')]('['+[_0x18c6ff[_0x5085('0x13')]()]+']',_0x9df5c0['message']);_0x45655a(_0x9df5c0[_0x5085('0x15')]);});});}function getEndUser(_0x448c06,_0x124026,_0x30c69f,_0x4e8aaa,_0x4b0066){return function(_0x9c99d){logger[_0x5085('0x12')]('['+[_0x448c06['toUpperCase']()]+_0x5085('0x27'),_0x9c99d);return new Promise(function(_0x4f72bc,_0x24a4fa){var _0x396384={'method':_0x5085('0xc'),'uri':_0x30c69f+_0x5085('0x28')+_0x9c99d['endUserNumber']+'&'+_0x4e8aaa+'&'+_0x4b0066,'auth':_0x124026,'json':!![]};return rp(_0x396384)[_0x5085('0xe')](function(_0x2a34ef){if(_0x2a34ef[_0x5085('0xf')][_0x5085('0x10')]>0x0){_0x9c99d[_0x5085('0x29')]=_0x2a34ef[_0x5085('0xf')][0x0][_0x5085('0x11')];logger[_0x5085('0x12')]('['+[_0x448c06['toUpperCase']()]+_0x5085('0x2a'),_0x9c99d);_0x4f72bc(_0x9c99d);}else{return createEndUser(_0x448c06,_0x124026,_0x9c99d,_0x30c69f,_0x4e8aaa)['then'](function(_0x31ebc5){logger['info']('['+[_0x448c06[_0x5085('0x13')]()]+_0x5085('0x2b'),_0x31ebc5);_0x4f72bc(_0x31ebc5);});}})['catch'](function(_0x39c442){logger[_0x5085('0x1d')]('['+[_0x448c06[_0x5085('0x13')]()]+']',_0x39c442['message']);_0x24a4fa(_0x39c442['message']);});});};}function getCustomFields(_0x2947b4,_0x472207){var _0x391470={};if(_0x2947b4['length']>0x0){_['forEach'](_0x2947b4,function(_0x4fe941){if(_[_0x5085('0x2c')]([_0x5085('0x2d'),_0x5085('0x2e')],_0x4fe941[_0x5085('0x2f')])&&_0x4fe941[_0x5085('0x30')]&&!_0x4fe941[_0x5085('0x31')]){_0x391470[_0x4fe941['nameField'][_0x5085('0x32')]()]=_0x4fe941[_0x5085('0x33')][_0x5085('0x34')]();}else if(_[_0x5085('0x2c')]([_0x5085('0x2d'),_0x5085('0x2e')],_0x4fe941[_0x5085('0x2f')])&&_0x4fe941['idField']&&_0x4fe941['customField']){_0x391470[_0x4fe941['idField']['toLowerCase']()]=_0x4fe941[_0x5085('0x33')]['toString']();}else if(_0x4fe941[_0x5085('0x2f')]===_0x5085('0x35')&&_0x4fe941['variableName']&&_0x4fe941[_0x5085('0x36')]&&_0x4fe941['customField']){_0x391470[_0x4fe941['idField'][_0x5085('0x32')]()]=_0x472207[_0x4fe941['variableName']][_0x5085('0x34')]();}else if(_0x4fe941['type']===_0x5085('0x37')&&_0x4fe941[_0x5085('0x38')]&&_0x4fe941[_0x5085('0x38')][_0x5085('0x39')]&&_0x4fe941[_0x5085('0x36')]&&_0x4fe941[_0x5085('0x31')]){_0x391470[_0x4fe941[_0x5085('0x36')][_0x5085('0x32')]()]=_0x472207[_0x4fe941['Variable'][_0x5085('0x39')][_0x5085('0x32')]()]['toString']();}});}return _0x391470;}function getTicket(_0x43a48b,_0x1a7bea,_0x429e52,_0x4bfe12,_0x17e2a8,_0x31b7f4){return function(_0x52ae4c){logger[_0x5085('0x12')]('['+[_0x43a48b['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x52ae4c);return new Promise(function(_0x2f505e,_0x3da6d4){var _0x2de023=_0x43a48b['toLowerCase']()===_0x5085('0x3a')?_0x52ae4c[_0x5085('0x1f')]:_0x52ae4c['endUserId'];var _0x2f9a83={'method':'POST','uri':_0x429e52+_0x5085('0x3b')+'?'+_0x31b7f4,'body':Object[_0x5085('0x3c')]({},{'active':_0x5085('0x1a'),'caller_id':_0x2de023,'assigned_to':_0x52ae4c['userId'],'short_description':intUtil[_0x5085('0x3d')](_0x4bfe12['Subjects'],_0x17e2a8,'\x20'),'description':intUtil[_0x5085('0x3d')](_0x4bfe12[_0x5085('0x3e')],_0x17e2a8,'\x0a')},getCustomFields(_0x4bfe12[_0x5085('0x3f')],_0x17e2a8)),'auth':_0x1a7bea,'json':!![]};return rp(_0x2f9a83)[_0x5085('0xe')](function(_0xddfa83){logger[_0x5085('0x12')]('['+[_0x43a48b['toUpperCase']()]+_0x5085('0x40'),_0xddfa83[_0x5085('0xf')]);_0x52ae4c['ticketId']=_0xddfa83[_0x5085('0xf')][_0x5085('0x11')];_0x52ae4c[_0x5085('0x41')]=_0xddfa83[_0x5085('0xf')]['number'];logger['info']('['+[_0x43a48b[_0x5085('0x13')]()]+']\x20getTicket\x20crm',_0x52ae4c);_0x2f505e(_0x52ae4c);})[_0x5085('0x14')](function(_0x235e4c){logger[_0x5085('0x1d')]('['+[_0x43a48b[_0x5085('0x13')]()]+']',_0x235e4c[_0x5085('0x15')]);_0x3da6d4(_0x235e4c[_0x5085('0x15')]);});});};}function createRemoteTag(_0x116081,_0x5b266b,_0x527cee,_0x460af9){return new Promise(function(_0x143311,_0x555d21){var _0xb8daf4={'method':'POST','uri':_0x527cee+_0x5085('0x42')+'?'+_0x460af9,'body':{'short_description':_0x116081,'global':!![],'active':!![],'name':_0x116081},'auth':_0x5b266b,'json':!![]};return rp(_0xb8daf4)['then'](function(_0x3f4d16){var _0x49f718=_0x3f4d16[_0x5085('0xf')][_0x5085('0x11')];_0x143311(_0x49f718);});});}function getRemoteTag(_0x4a7cfc,_0x46a282,_0xa3ba80,_0x143ce5,_0x43a768){return new Promise(function(_0x5deeff,_0x25b90f){var _0x4cdac3={'method':_0x5085('0xc'),'uri':_0xa3ba80+_0x5085('0x42')+_0x5085('0x43')+_0x4a7cfc+'&'+_0x143ce5,'auth':_0x46a282,'json':!![]};return rp(_0x4cdac3)[_0x5085('0xe')](function(_0x469731){if(_0x469731[_0x5085('0xf')]['length']>0x0){var _0x583c35=_0x469731[_0x5085('0xf')][0x0][_0x5085('0x11')];_0x5deeff(_0x583c35);}else{return createRemoteTag(_0x4a7cfc,_0x46a282,_0xa3ba80,_0x143ce5)[_0x5085('0xe')](function(_0x360417){_0x5deeff(_0x360417);});}});});}function assignTagToIncident(_0x267639,_0x16f068,_0x4619ec,_0x155429,_0x5f11ab){return new Promise(function(_0x363cb4,_0x2d778c){var _0x5515e3={'method':'POST','uri':_0x4619ec+_0x5085('0x44')+'?'+_0x5f11ab,'body':{'label':_0x267639,'table':_0x5085('0x3b'),'id_type':_0x5085('0x45'),'table_key':_0x155429[_0x5085('0x46')],'title':_0x5085('0x47')+_0x155429['ticketNumber'],'id_display':_0x155429[_0x5085('0x41')]},'auth':_0x16f068,'json':!![]};return rp(_0x5515e3)[_0x5085('0xe')](function(_0x53923f){_0x363cb4();})[_0x5085('0x14')](function(){_0x363cb4();});});}function manageTags(_0x1736c9,_0x46e720,_0x25442d,_0x46368d,_0x1f1534,_0x138bd7,_0x91cb04){return new Promise(function(_0x599131,_0x3a496e){var _0x195bce=[];_0x46e720[_0x5085('0x48')](function(_0x445c07){_0x195bce['push'](getRemoteTag(_0x445c07,_0x25442d,_0x46368d,_0x138bd7,_0x91cb04));});return Promise[_0x5085('0x49')](_0x195bce)['then'](function(_0x51a8e6){if(_0x51a8e6[_0x5085('0x10')]){logger[_0x5085('0x12')]('['+[_0x1736c9['toUpperCase']()]+_0x5085('0x4a'),_0x51a8e6);var _0x513341=[];_0x51a8e6[_0x5085('0x48')](function(_0x4c0891){_0x513341[_0x5085('0x4b')](assignTagToIncident(_0x4c0891,_0x25442d,_0x46368d,_0x1f1534,_0x138bd7));});return Promise[_0x5085('0x49')](_0x513341)[_0x5085('0xe')](function(){_0x599131();})['catch'](function(){_0x599131();});}else{_0x599131();}});});}function getTags(_0x2aae31,_0x1a0fc5,_0x4fdbb3,_0x38f85a,_0x3e4938,_0x36cc5a){return function(_0x4c3b18){return new Promise(function(_0x4106fe,_0x4f9128){var _0x3ba3a0=[];var _0x229b6d=_0x38f85a[_0x5085('0x4c')];if(_0x229b6d&&_0x229b6d['length']>0x0){_0x3ba3a0=_['map'](_0x229b6d,_0x5085('0x39'));}if(_0x3ba3a0[_0x5085('0x10')]>0x0){return manageTags(_0x2aae31,_0x3ba3a0,_0x1a0fc5,_0x4fdbb3,_0x4c3b18,_0x3e4938,_0x36cc5a)[_0x5085('0xe')](function(){_0x4106fe(_0x4c3b18);});}else{_0x4106fe(_0x4c3b18);}});};}function emit(_0x455dcb,_0x6fa468,_0x3d5c46){var _0x20622f=_0x5085('0x4d')+_0x5085('0x4e')+_0x5085('0x4f')+_0x5085('0x50');var _0x1124d4={'uri':_0x455dcb+_0x5085('0x51')+_0x3d5c46+_0x20622f};io['to'](util['format'](_0x5085('0x52'),_0x6fa468))[_0x5085('0x53')](_0x5085('0x54'),_0x1124d4);}exports['cs']=function(_0x1e719c,_0x1b439d,_0x59a115,_0x43b048,_0x5e3016,_0x5afce0,_0x34b431,_0x5118e9){var _0x1bb374={};var _0x31d99c={'user':_0x5afce0[_0x5085('0x55')],'pass':_0x5afce0['password']};var _0x4f4421=_0x5085('0x56');var _0x43a119=_0x5085('0x57');_0x5afce0['remoteUri']=intUtil[_0x5085('0x58')](_0x5afce0[_0x5085('0x59')]);_0x5afce0[_0x5085('0x5a')]=intUtil['stripTrailingSlash'](_0x5afce0[_0x5085('0x5a')]);var _0x1c2723=util['format']('%s/api/now/table/',_0x5afce0[_0x5085('0x59')]);_0x1bb374[_0x5085('0x16')]=!_[_0x5085('0x5b')](_0x43b048)?_0x43b048[_0x5085('0x5c')]:null;_0x1bb374[_0x5085('0x20')]=_0x5afce0['email'];_0x1bb374[_0x5085('0x23')]=_0x5118e9['toLowerCase']()===_0x5085('0x3a')?_0x1b439d[_0x5085('0x5d')]:_0x1b439d[_0x5085('0x5e')];_0x1bb374[_0x5085('0x5f')]=_0x5118e9===_0x5085('0x60')||_0x5118e9==='unmanaged'?_0x5085('0x60'):_0x5085('0x3a');var _0x35af03=util[_0x5085('0x61')](_0x5085('0x62'),_0x5afce0[_0x5085('0x5a')],_0x1b439d['uniqueid'],md5(_0x1b439d['uniqueid']));if(_0x5e3016&&_0x5e3016[_0x5085('0x63')]){logger[_0x5085('0x12')](_0x5085('0x64'),_0x5085('0x65'));_0x1b439d['recordingURL']=_0x35af03;}else if(_0x34b431&&_0x34b431['recordingFormat']&&_0x34b431[_0x5085('0x66')]!==_0x5085('0x67')){logger['info'](_0x5085('0x68'),'Recording\x20is\x20enabled!');_0x1b439d[_0x5085('0x69')]=_0x35af03;}else{_0x1b439d[_0x5085('0x69')]='';}return getAdminUser(_0x5118e9,_0x31d99c,_0x1bb374,_0x1c2723,_0x43a119,_0x4f4421)[_0x5085('0xe')](getUser(_0x5118e9,_0x31d99c,_0x1c2723,_0x43a119,_0x4f4421))[_0x5085('0xe')](getEndUser(_0x5118e9,_0x31d99c,_0x1c2723,_0x43a119,_0x4f4421))[_0x5085('0xe')](getTicket(_0x5118e9,_0x31d99c,_0x1c2723,_0x59a115,_0x1b439d,_0x43a119))['then'](function(_0x335a4d){logger[_0x5085('0x12')](util['format'](_0x5085('0x6a'),_0x335a4d['ticketId']));logger[_0x5085('0x12')](util[_0x5085('0x61')](_0x5085('0x6b'),_0x5118e9));if(_0x5118e9!==_0x5085('0x6c')){logger['info']('['+[_0x5118e9[_0x5085('0x13')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5afce0[_0x5085('0x59')],_0x43b048['name'],_0x335a4d[_0x5085('0x46')]);}})[_0x5085('0x14')](function(_0x4d4cb5){logger[_0x5085('0x1d')]('['+[_0x5118e9[_0x5085('0x13')]()]+_0x5085('0x6d'),util['inspect'](_0x4d4cb5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf62c=['endUserNumber','System','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','toLowerCase','content','toString','idField','variable','variableName','Variable','name','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','ticketId','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminId','adminEmail','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST'];(function(_0x52631f,_0x319db8){var _0x5accd2=function(_0x5ec169){while(--_0x5ec169){_0x52631f['push'](_0x52631f['shift']());}};_0x5accd2(++_0x319db8);}(_0xf62c,0xb3));var _0xcf62=function(_0x2f4de8,_0x313395){_0x2f4de8=_0x2f4de8-0x0;var _0x4569cb=_0xf62c[_0x2f4de8];return _0x4569cb;};'use strict';var _=require(_0xcf62('0x0'));var Promise=require(_0xcf62('0x1'));var rp=require(_0xcf62('0x2'));var util=require(_0xcf62('0x3'));var md5=require(_0xcf62('0x4'));var Redis=require(_0xcf62('0x5'));var intUtil=require(_0xcf62('0x6'));var config=require(_0xcf62('0x7'));var logger=require(_0xcf62('0x8'))(_0xcf62('0x9'));config[_0xcf62('0xa')]=_[_0xcf62('0xb')](config[_0xcf62('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x1239ec,_0x18e32b,_0x1d4c17,_0x4a1a7d,_0x23657a,_0x427775){return new Promise(function(_0x3c9f67,_0x488f0f){var _0x564ade={'method':_0xcf62('0xc'),'uri':_0x4a1a7d+_0xcf62('0xd')+'&'+_0x23657a+'&'+_0x427775,'auth':_0x18e32b,'json':!![]};return rp(_0x564ade)[_0xcf62('0xe')](function(_0x3e0d9c){if(_0x3e0d9c['result'][_0xcf62('0xf')]>0x0){_0x1d4c17['adminId']=_0x3e0d9c[_0xcf62('0x10')][0x0][_0xcf62('0x11')];}logger[_0xcf62('0x12')]('['+[_0x1239ec[_0xcf62('0x13')]()]+_0xcf62('0x14'),_0x1d4c17);_0x3c9f67(_0x1d4c17);})['catch'](function(_0x5048e4){logger[_0xcf62('0x15')]('['+[_0x1239ec[_0xcf62('0x13')]()]+']',_0x5048e4[_0xcf62('0x16')]);_0x488f0f(_0x5048e4['message']);});});}function getUser(_0x2b499e,_0x1971a0,_0x59bf2b,_0x5a001d,_0x539643){return function(_0x23f619){logger[_0xcf62('0x12')]('['+[_0x2b499e[_0xcf62('0x13')]()]+_0xcf62('0x17'),_0x23f619);return new Promise(function(_0x23858a,_0x5db4f4){if(intUtil[_0xcf62('0x18')](_0x23f619[_0xcf62('0x19')])){var _0x2843ea={'method':_0xcf62('0xc'),'uri':_0x59bf2b+_0xcf62('0x1a')+_0x23f619[_0xcf62('0x19')]+'&'+_0x5a001d+'&'+_0x539643,'auth':_0x1971a0,'json':!![]};logger[_0xcf62('0x12')]('['+[_0x2b499e['toUpperCase']()]+_0xcf62('0x1b'),_0x2843ea);return rp(_0x2843ea)['then'](function(_0x2367f3){logger['info']('['+[_0x2b499e[_0xcf62('0x13')]()]+_0xcf62('0x1c'),_0x2367f3);if(_0x2367f3[_0xcf62('0x10')][_0xcf62('0xf')]>0x0&&String(_0x2367f3[_0xcf62('0x10')][0x0]['active'])===_0xcf62('0x1d')){_0x23f619[_0xcf62('0x1e')]=_0x2367f3[_0xcf62('0x10')][0x0][_0xcf62('0x11')];}else{_0x23f619['userId']=_0x23f619[_0xcf62('0x1f')];_0x23f619[_0xcf62('0x19')]=_0x23f619[_0xcf62('0x20')];}logger[_0xcf62('0x12')]('['+[_0x2b499e[_0xcf62('0x13')]()]+'],\x20getUser\x20crm',_0x23f619);_0x23858a(_0x23f619);})[_0xcf62('0x21')](function(_0x45d7c4){logger[_0xcf62('0x15')]('['+[_0x2b499e[_0xcf62('0x13')]()]+']',_0x45d7c4['message']);_0x5db4f4(_0x45d7c4[_0xcf62('0x16')]);});}else{logger['info']('['+[_0x2b499e['toUpperCase']()]+_0xcf62('0x22'));_0x23f619[_0xcf62('0x1e')]=_0x23f619[_0xcf62('0x1f')];_0x23f619[_0xcf62('0x19')]=_0x23f619['adminEmail'];_0x23858a(_0x23f619);}});};}function createEndUser(_0x53f0a6,_0x49ba0a,_0x2ff906,_0x2fe3ec,_0x44565b){logger[_0xcf62('0x12')]('['+[_0x53f0a6[_0xcf62('0x13')]()]+_0xcf62('0x23'),_0x2ff906);return new Promise(function(_0x250ba9,_0x203c11){var _0x309f60={'method':_0xcf62('0x24'),'uri':_0x2fe3ec+'sys_user?'+_0x44565b,'body':{'user_name':_0x2ff906[_0xcf62('0x25')],'roles':'user','first_name':_0x2ff906[_0xcf62('0x25')],'active':_0xcf62('0x1d'),'date_format':_0xcf62('0x26'),'phone':_0x2ff906[_0xcf62('0x25')]},'auth':_0x49ba0a,'json':!![]};return rp(_0x309f60)['then'](function(_0x4d9eb7){logger[_0xcf62('0x12')]('['+[_0x53f0a6[_0xcf62('0x13')]()]+'],\x20EndUser\x20schema',_0x4d9eb7[_0xcf62('0x10')]);_0x2ff906[_0xcf62('0x27')]=_0x4d9eb7[_0xcf62('0x10')][_0xcf62('0x11')];_0x250ba9(_0x2ff906);})[_0xcf62('0x21')](function(_0x402113){logger[_0xcf62('0x15')]('['+[_0x53f0a6['toUpperCase']()]+']',_0x402113['message']);_0x203c11(_0x402113[_0xcf62('0x16')]);});});}function getEndUser(_0x326f4d,_0x3fcef4,_0x21c551,_0x1c8acb,_0x490d0c){return function(_0x260e72){logger[_0xcf62('0x12')]('['+[_0x326f4d[_0xcf62('0x13')]()]+_0xcf62('0x28'),_0x260e72);return new Promise(function(_0x159099,_0x34a478){var _0x497538={'method':_0xcf62('0xc'),'uri':_0x21c551+'sys_user?sysparm_query=phone%3D'+_0x260e72[_0xcf62('0x25')]+'&'+_0x1c8acb+'&'+_0x490d0c,'auth':_0x3fcef4,'json':!![]};return rp(_0x497538)[_0xcf62('0xe')](function(_0x5c4a2c){if(_0x5c4a2c['result']['length']>0x0){_0x260e72[_0xcf62('0x27')]=_0x5c4a2c[_0xcf62('0x10')][0x0]['sys_id'];logger[_0xcf62('0x12')]('['+[_0x326f4d[_0xcf62('0x13')]()]+_0xcf62('0x29'),_0x260e72);_0x159099(_0x260e72);}else{return createEndUser(_0x326f4d,_0x3fcef4,_0x260e72,_0x21c551,_0x1c8acb)[_0xcf62('0xe')](function(_0x15a623){logger['info']('['+[_0x326f4d['toUpperCase']()]+_0xcf62('0x2a'),_0x15a623);_0x159099(_0x15a623);});}})[_0xcf62('0x21')](function(_0x3738ad){logger[_0xcf62('0x15')]('['+[_0x326f4d[_0xcf62('0x13')]()]+']',_0x3738ad[_0xcf62('0x16')]);_0x34a478(_0x3738ad['message']);});});};}function getCustomFields(_0x26b297,_0x42db51){var _0x493c9d={};if(_0x26b297['length']>0x0){_[_0xcf62('0x2b')](_0x26b297,function(_0x2b29a4){if(_[_0xcf62('0x2c')]([_0xcf62('0x2d'),_0xcf62('0x2e')],_0x2b29a4[_0xcf62('0x2f')])&&_0x2b29a4['nameField']&&!_0x2b29a4[_0xcf62('0x30')]){_0x493c9d[_0x2b29a4['nameField'][_0xcf62('0x31')]()]=_0x2b29a4[_0xcf62('0x32')][_0xcf62('0x33')]();}else if(_[_0xcf62('0x2c')]([_0xcf62('0x2d'),_0xcf62('0x2e')],_0x2b29a4[_0xcf62('0x2f')])&&_0x2b29a4['idField']&&_0x2b29a4['customField']){_0x493c9d[_0x2b29a4[_0xcf62('0x34')][_0xcf62('0x31')]()]=_0x2b29a4[_0xcf62('0x32')][_0xcf62('0x33')]();}else if(_0x2b29a4['type']===_0xcf62('0x35')&&_0x2b29a4[_0xcf62('0x36')]&&_0x2b29a4[_0xcf62('0x34')]&&_0x2b29a4[_0xcf62('0x30')]){_0x493c9d[_0x2b29a4['idField'][_0xcf62('0x31')]()]=_0x42db51[_0x2b29a4['variableName']]['toString']();}else if(_0x2b29a4['type']==='customVariable'&&_0x2b29a4[_0xcf62('0x37')]&&_0x2b29a4['Variable'][_0xcf62('0x38')]&&_0x2b29a4[_0xcf62('0x34')]&&_0x2b29a4[_0xcf62('0x30')]){_0x493c9d[_0x2b29a4[_0xcf62('0x34')][_0xcf62('0x31')]()]=_0x42db51[_0x2b29a4[_0xcf62('0x37')][_0xcf62('0x38')]['toLowerCase']()]['toString']();}});}return _0x493c9d;}function getTicket(_0x194b54,_0x53fcd1,_0x3bc2c0,_0x161d4,_0x3da37d,_0x17c99a){return function(_0x214181){logger[_0xcf62('0x12')]('['+[_0x194b54[_0xcf62('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x214181);return new Promise(function(_0x10b700,_0x33fca7){var _0x59c153=_0x194b54[_0xcf62('0x31')]()===_0xcf62('0x39')?_0x214181['userId']:_0x214181[_0xcf62('0x27')];var _0x3c3b20={'method':_0xcf62('0x24'),'uri':_0x3bc2c0+_0xcf62('0x3a')+'?'+_0x17c99a,'body':Object[_0xcf62('0x3b')]({},{'active':_0xcf62('0x1d'),'caller_id':_0x59c153,'assigned_to':_0x214181[_0xcf62('0x1e')],'short_description':intUtil[_0xcf62('0x3c')](_0x161d4['Subjects'],_0x3da37d,'\x20'),'description':intUtil[_0xcf62('0x3c')](_0x161d4[_0xcf62('0x3d')],_0x3da37d,'\x0a')},getCustomFields(_0x161d4[_0xcf62('0x3e')],_0x3da37d)),'auth':_0x53fcd1,'json':!![]};return rp(_0x3c3b20)[_0xcf62('0xe')](function(_0xabd3e3){logger['info']('['+[_0x194b54['toUpperCase']()]+_0xcf62('0x3f'),_0xabd3e3[_0xcf62('0x10')]);_0x214181['ticketId']=_0xabd3e3[_0xcf62('0x10')]['sys_id'];_0x214181[_0xcf62('0x40')]=_0xabd3e3[_0xcf62('0x10')][_0xcf62('0x41')];logger[_0xcf62('0x12')]('['+[_0x194b54[_0xcf62('0x13')]()]+_0xcf62('0x42'),_0x214181);_0x10b700(_0x214181);})[_0xcf62('0x21')](function(_0x4cfb77){logger[_0xcf62('0x15')]('['+[_0x194b54['toUpperCase']()]+']',_0x4cfb77[_0xcf62('0x16')]);_0x33fca7(_0x4cfb77[_0xcf62('0x16')]);});});};}function createRemoteTag(_0x6020e4,_0x1f399a,_0x38238b,_0x395e60){return new Promise(function(_0x53ae70,_0x541d3c){var _0x10f19d={'method':'POST','uri':_0x38238b+_0xcf62('0x43')+'?'+_0x395e60,'body':{'short_description':_0x6020e4,'global':!![],'active':!![],'name':_0x6020e4},'auth':_0x1f399a,'json':!![]};return rp(_0x10f19d)[_0xcf62('0xe')](function(_0x256e9a){var _0x158101=_0x256e9a[_0xcf62('0x10')][_0xcf62('0x11')];_0x53ae70(_0x158101);});});}function getRemoteTag(_0x529ba3,_0x111feb,_0x23c3f5,_0x2e2fd4,_0x5c3e4e){return new Promise(function(_0x55ba12,_0x1ff1e3){var _0x12409e={'method':_0xcf62('0xc'),'uri':_0x23c3f5+_0xcf62('0x43')+_0xcf62('0x44')+_0x529ba3+'&'+_0x2e2fd4,'auth':_0x111feb,'json':!![]};return rp(_0x12409e)['then'](function(_0x8b8816){if(_0x8b8816[_0xcf62('0x10')][_0xcf62('0xf')]>0x0){var _0x169b5c=_0x8b8816[_0xcf62('0x10')][0x0]['sys_id'];_0x55ba12(_0x169b5c);}else{return createRemoteTag(_0x529ba3,_0x111feb,_0x23c3f5,_0x2e2fd4)['then'](function(_0x536ede){_0x55ba12(_0x536ede);});}});});}function assignTagToIncident(_0x3737a5,_0x4af025,_0x403f93,_0x2b4c91,_0x22ede7){return new Promise(function(_0x348878,_0x1d6f7e){var _0x1c65b2={'method':_0xcf62('0x24'),'uri':_0x403f93+_0xcf62('0x45')+'?'+_0x22ede7,'body':{'label':_0x3737a5,'table':_0xcf62('0x3a'),'id_type':'Incident','table_key':_0x2b4c91['ticketId'],'title':'Incident\x20-\x20'+_0x2b4c91[_0xcf62('0x40')],'id_display':_0x2b4c91['ticketNumber']},'auth':_0x4af025,'json':!![]};return rp(_0x1c65b2)[_0xcf62('0xe')](function(_0x397087){_0x348878();})['catch'](function(){_0x348878();});});}function manageTags(_0x2e787a,_0x1da7cc,_0x101134,_0x46c491,_0xa77add,_0x188085,_0x5b1b94){return new Promise(function(_0x48c38b,_0x1aa469){var _0x1b4c8f=[];_0x1da7cc['forEach'](function(_0x55f93e){_0x1b4c8f[_0xcf62('0x46')](getRemoteTag(_0x55f93e,_0x101134,_0x46c491,_0x188085,_0x5b1b94));});return Promise[_0xcf62('0x47')](_0x1b4c8f)[_0xcf62('0xe')](function(_0x510869){if(_0x510869[_0xcf62('0xf')]){logger[_0xcf62('0x12')]('['+[_0x2e787a[_0xcf62('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x510869);var _0x5756c6=[];_0x510869[_0xcf62('0x2b')](function(_0x202307){_0x5756c6[_0xcf62('0x46')](assignTagToIncident(_0x202307,_0x101134,_0x46c491,_0xa77add,_0x188085));});return Promise[_0xcf62('0x47')](_0x5756c6)[_0xcf62('0xe')](function(){_0x48c38b();})[_0xcf62('0x21')](function(){_0x48c38b();});}else{_0x48c38b();}});});}function getTags(_0x2323d9,_0xa59678,_0x4b26dd,_0x4cfbc4,_0x4a9101,_0x50205d){return function(_0x3bd541){return new Promise(function(_0x5d6321,_0x3da7e2){var _0x55e5ac=[];var _0x513755=_0x4cfbc4[_0xcf62('0x48')];if(_0x513755&&_0x513755['length']>0x0){_0x55e5ac=_[_0xcf62('0x49')](_0x513755,_0xcf62('0x38'));}if(_0x55e5ac['length']>0x0){return manageTags(_0x2323d9,_0x55e5ac,_0xa59678,_0x4b26dd,_0x3bd541,_0x4a9101,_0x50205d)[_0xcf62('0xe')](function(){_0x5d6321(_0x3bd541);});}else{_0x5d6321(_0x3bd541);}});};}function emit(_0x15e2eb,_0x57d8a2,_0x56ab92){var _0x2004dd=_0xcf62('0x4a')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xcf62('0x4b')+_0xcf62('0x4c');var _0x56b45b={'uri':_0x15e2eb+_0xcf62('0x4d')+_0x56ab92+_0x2004dd};io['to'](util[_0xcf62('0x4e')](_0xcf62('0x4f'),_0x57d8a2))[_0xcf62('0x50')](_0xcf62('0x51'),_0x56b45b);}exports['cs']=function(_0x4f91cb,_0x54a061,_0x3c9ad9,_0x125126,_0x56a1fb,_0x2bccaf,_0x284ab6,_0x3fcf42){var _0x5b533a={};var _0x56268c={'user':_0x2bccaf[_0xcf62('0x52')],'pass':_0x2bccaf['password']};var _0x4c923a=_0xcf62('0x53');var _0x58f997='sysparm_display_value=true';_0x2bccaf[_0xcf62('0x54')]=intUtil[_0xcf62('0x55')](_0x2bccaf['remoteUri']);_0x2bccaf[_0xcf62('0x56')]=intUtil[_0xcf62('0x55')](_0x2bccaf[_0xcf62('0x56')]);var _0x3ef765=util[_0xcf62('0x4e')](_0xcf62('0x57'),_0x2bccaf[_0xcf62('0x54')]);_0x5b533a[_0xcf62('0x19')]=!_[_0xcf62('0x58')](_0x125126)?_0x125126[_0xcf62('0x59')]:null;_0x5b533a['adminEmail']=_0x2bccaf['email'];_0x5b533a[_0xcf62('0x25')]=_0x3fcf42[_0xcf62('0x31')]()==='outbound'?_0x54a061[_0xcf62('0x5a')]:_0x54a061['calleridnum'];_0x5b533a[_0xcf62('0x5b')]=_0x3fcf42===_0xcf62('0x5c')||_0x3fcf42===_0xcf62('0x5d')?'queue':_0xcf62('0x39');var _0x17ef15=util[_0xcf62('0x4e')](_0xcf62('0x5e'),_0x2bccaf[_0xcf62('0x56')],_0x54a061[_0xcf62('0x5f')],md5(_0x54a061[_0xcf62('0x5f')]));if(_0x56a1fb&&_0x56a1fb[_0xcf62('0x60')]){logger['info'](_0xcf62('0x61'),_0xcf62('0x62'));_0x54a061[_0xcf62('0x63')]=_0x17ef15;}else if(_0x284ab6&&_0x284ab6[_0xcf62('0x64')]&&_0x284ab6[_0xcf62('0x64')]!==_0xcf62('0x65')){logger[_0xcf62('0x12')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x54a061[_0xcf62('0x63')]=_0x17ef15;}else{_0x54a061[_0xcf62('0x63')]='';}return getAdminUser(_0x3fcf42,_0x56268c,_0x5b533a,_0x3ef765,_0x58f997,_0x4c923a)[_0xcf62('0xe')](getUser(_0x3fcf42,_0x56268c,_0x3ef765,_0x58f997,_0x4c923a))[_0xcf62('0xe')](getEndUser(_0x3fcf42,_0x56268c,_0x3ef765,_0x58f997,_0x4c923a))['then'](getTicket(_0x3fcf42,_0x56268c,_0x3ef765,_0x3c9ad9,_0x54a061,_0x58f997))['then'](function(_0x57ac3f){logger[_0xcf62('0x12')](util['format'](_0xcf62('0x66'),_0x57ac3f[_0xcf62('0x67')]));logger['info'](util[_0xcf62('0x4e')](_0xcf62('0x68'),_0x3fcf42));if(_0x3fcf42!==_0xcf62('0x5d')){logger['info']('['+[_0x3fcf42['toUpperCase']()]+']',_0xcf62('0x69'));emit(_0x2bccaf[_0xcf62('0x54')],_0x125126[_0xcf62('0x38')],_0x57ac3f[_0xcf62('0x67')]);}})['catch'](function(_0x5031c0){logger['error']('['+[_0x3fcf42['toUpperCase']()]+_0xcf62('0x6a'),util[_0xcf62('0x6b')](_0x5031c0,{'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 74b6f40..eff508e 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 _0xd0dd=['../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','length','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','toString','base64','get_server_info','stringify','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_name','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','customVariable','Variable','POST','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','Fields','Inbound','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','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Outbound','Ticket\x20created!','catch','uri','monitor_format','lastevent','calleridname','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util'];(function(_0x2d24fb,_0x53a2e5){var _0x4e68cb=function(_0x4e806a){while(--_0x4e806a){_0x2d24fb['push'](_0x2d24fb['shift']());}};_0x4e68cb(++_0x53a2e5);}(_0xd0dd,0x76));var _0xdd0d=function(_0x42350d,_0x40edd9){_0x42350d=_0x42350d-0x0;var _0xe5624e=_0xd0dd[_0x42350d];return _0xe5624e;};'use strict';var _=require(_0xdd0d('0x0'));var rp=require(_0xdd0d('0x1'));var BPromise=require(_0xdd0d('0x2'));var md5=require(_0xdd0d('0x3'));var util=require('util');var Redis=require(_0xdd0d('0x4'));var intUtil=require(_0xdd0d('0x5'));var config=require(_0xdd0d('0x6'));var logger=require(_0xdd0d('0x7'))(_0xdd0d('0x8'));config[_0xdd0d('0x9')]=_[_0xdd0d('0xa')](config[_0xdd0d('0x9')],{'host':_0xdd0d('0xb'),'port':0x18eb});var io=require(_0xdd0d('0xc'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x3f4971,_0x3cc970,_0x22cc50){io['to'](_0x3f4971)[_0xdd0d('0xd')](_0x3cc970,_0x22cc50);}function getTicket(_0x15162a,_0x3a72b1,_0x1f8373,_0x51f82e,_0x20a69a,_0x4ef79d,_0x3a2359,_0x3d6f19){logger['info'](_0xdd0d('0xe'));var _0xe5ee9f=new Date();var _0x53b20d=[{'name':_0xdd0d('0xf'),'value':intUtil[_0xdd0d('0x10')](_0x51f82e[_0xdd0d('0x11')],_0x20a69a,'\x20')},{'name':_0xdd0d('0x12'),'value':_0x3a72b1['id']},{'name':_0xdd0d('0x13'),'value':_0x3a72b1['id']},{'name':_0xdd0d('0x14'),'value':intUtil[_0xdd0d('0x10')](_0x51f82e[_0xdd0d('0x15')],_0x20a69a,'\x0a')},{'name':'date_start','value':_0xe5ee9f[_0xdd0d('0x16')]()[_0xdd0d('0x17')](0x0,0x13)[_0xdd0d('0x18')]('T','\x20')},{'name':_0xdd0d('0x19'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xdd0d('0x1a'),'value':_0x1f8373['id']},{'name':_0xdd0d('0x1b'),'value':_0xdd0d('0x1c')},{'name':_0xdd0d('0x1d'),'value':_0x1f8373[_0xdd0d('0xf')]},{'name':'direction','value':_0x3d6f19}];if(_0x4ef79d[_0xdd0d('0x1e')]){_[_0xdd0d('0x1f')](_0x4ef79d,function(_0x5f46a8){if(_0x20a69a[_0x5f46a8[_0xdd0d('0x20')]]){_0x53b20d[_0xdd0d('0x21')]({'name':_0x5f46a8[_0xdd0d('0x22')],'value':_0x20a69a[_0x5f46a8[_0xdd0d('0x20')]]});}});}return request({'form':{'method':_0xdd0d('0x23'),'input_type':_0xdd0d('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3a2359['id'],'module_name':_0xdd0d('0x25'),'name_value_list':_0x53b20d})}});}function getAuth(_0x2f4a16){return util[_0xdd0d('0x26')](_0xdd0d('0x27'),new Buffer(_0x2f4a16['apiKey']+':X')[_0xdd0d('0x28')](_0xdd0d('0x29')));}function getServerInfo(_0x588e88){return request({'form':{'method':_0xdd0d('0x2a'),'input_type':'JSON','response_type':_0xdd0d('0x24'),'rest_data':JSON[_0xdd0d('0x2b')]({'session':_0x588e88['id']})}});}function getUser(_0x34f3ea,_0x979282,_0x340383){if(!_[_0xdd0d('0x2c')](_0x979282)){logger[_0xdd0d('0x2d')](_0xdd0d('0x2e'),_0x979282);return request({'form':{'method':_0xdd0d('0x2f'),'input_type':_0xdd0d('0x24'),'response_type':_0xdd0d('0x24'),'rest_data':JSON[_0xdd0d('0x2b')]({'session':_0x340383['id'],'module_name':_0xdd0d('0x30'),'query':util[_0xdd0d('0x26')](_0xdd0d('0x31'),_0x979282),'order_by':'','offset':'0','select_fields':['id',_0xdd0d('0xf'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdd0d('0x32')](function(_0x528c36){if(_0x528c36[_0xdd0d('0x33')][_0xdd0d('0x1e')]){var _0x3b26ed=_[_0xdd0d('0x34')](_0x528c36[_0xdd0d('0x33')],function(_0x36ba4c){return _0x36ba4c[_0xdd0d('0x35')]['user_name'][_0xdd0d('0x36')]===_0x979282;});if(_0x3b26ed){logger[_0xdd0d('0x2d')](_0xdd0d('0x37'));return BPromise[_0xdd0d('0x38')]({'id':_0x3b26ed[_0xdd0d('0x35')]['id'][_0xdd0d('0x36')],'name':_0x3b26ed['name_value_list'][_0xdd0d('0xf')][_0xdd0d('0x36')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xdd0d('0x38')]({'id':_0x340383[_0xdd0d('0x35')][_0xdd0d('0x39')]['value'],'name':_0x340383[_0xdd0d('0x35')]['user_name'][_0xdd0d('0x36')]});});}else{logger[_0xdd0d('0x2d')](_0xdd0d('0x3a'));return BPromise[_0xdd0d('0x38')]({'id':_0x340383[_0xdd0d('0x35')][_0xdd0d('0x39')][_0xdd0d('0x36')],'name':_0x340383[_0xdd0d('0x35')][_0xdd0d('0x3b')][_0xdd0d('0x36')]});}}function getEndUser(_0x5589a1,_0x47b37f,_0x1ce01c,_0x44bcd0){logger[_0xdd0d('0x2d')](_0xdd0d('0x3c'),_0x1ce01c);return request({'form':{'method':_0xdd0d('0x2f'),'input_type':_0xdd0d('0x24'),'response_type':_0xdd0d('0x24'),'rest_data':JSON[_0xdd0d('0x2b')]({'session':_0x44bcd0['id'],'module_name':'Contacts','query':util[_0xdd0d('0x26')](_0xdd0d('0x3d'),_0x1ce01c),'order_by':'','offset':'0','select_fields':['id',_0xdd0d('0xf'),_0xdd0d('0x3e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x525871){if(_0x525871[_0xdd0d('0x33')][_0xdd0d('0x1e')]){var _0x23fc51=_[_0xdd0d('0x34')](_0x525871['entry_list'],function(_0x365936){return _0x365936[_0xdd0d('0x35')]['phone_home']['value']===_0x1ce01c;});if(_0x23fc51){logger[_0xdd0d('0x2d')](_0xdd0d('0x3f'));return BPromise['resolve']({'id':_0x23fc51[_0xdd0d('0x35')]['id'][_0xdd0d('0x36')],'name':_0x23fc51[_0xdd0d('0x35')][_0xdd0d('0xf')][_0xdd0d('0x36')],'phone':_0x23fc51[_0xdd0d('0x35')]['phone_home']['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xdd0d('0x23'),'input_type':'JSON','response_type':_0xdd0d('0x24'),'rest_data':JSON[_0xdd0d('0x2b')]({'session':_0x44bcd0['id'],'module_name':_0xdd0d('0x1c'),'name_value_list':[{'name':_0xdd0d('0x40'),'value':_0x47b37f!==''?_0x47b37f:util['format']('Caller\x20-\x20%s',_0x1ce01c)},{'name':'phone_home','value':_0x1ce01c}]})}})[_0xdd0d('0x32')](function(_0x20a508){logger[_0xdd0d('0x2d')](_0xdd0d('0x41'));return BPromise[_0xdd0d('0x38')]({'id':_0x20a508['id'],'name':_0x20a508[_0xdd0d('0x33')]['first_name'][_0xdd0d('0x36')],'phone':_0x20a508[_0xdd0d('0x33')][_0xdd0d('0x3e')]['value']});});}});}function request(_0x9be566){logger[_0xdd0d('0x42')](_0xdd0d('0x43'),JSON['stringify'](_0x9be566));return rp(_[_0xdd0d('0x44')](def,_0x9be566));}function getTags(_0x3caab8,_0x30cdc0){var _0x385664=[];if(_0x3caab8&&_0x3caab8[_0xdd0d('0x1e')]>0x0){_0x385664=_[_0xdd0d('0x45')](_0x3caab8,_0x30cdc0);}return _0x385664;}function getCustomFields(_0x6bffbf,_0x4d9e05){var _0x5f5c34=[];var _0x272466={'custom_fields':[]};if(_0x6bffbf[_0xdd0d('0x1e')]>0x0){_['forEach'](_0x6bffbf,function(_0x38cb56){if(_0x38cb56[_0xdd0d('0x46')]===_0xdd0d('0x47')&&_0x38cb56[_0xdd0d('0x48')]&&!_0x38cb56[_0xdd0d('0x49')]){_0x272466[_0x38cb56['nameField'][_0xdd0d('0x4a')]()]=_0x38cb56[_0xdd0d('0x4b')][_0xdd0d('0x28')]();}else if(_0x38cb56[_0xdd0d('0x46')]==='string'&&_0x38cb56[_0xdd0d('0x22')]&&_0x38cb56[_0xdd0d('0x49')]){_0x272466[_0xdd0d('0x4c')][_0xdd0d('0x21')]({'id':_0x38cb56['idField'],'value':_0x38cb56[_0xdd0d('0x4b')][_0xdd0d('0x28')]()});}else if(_0x38cb56[_0xdd0d('0x46')]==='variable'&&_0x38cb56[_0xdd0d('0x20')]&&_0x38cb56['idField']&&_0x38cb56[_0xdd0d('0x49')]){_0x4d9e05[_0x38cb56[_0xdd0d('0x20')]]&&_0x272466['custom_fields']['push']({'id':_0x38cb56[_0xdd0d('0x22')],'value':_0x4d9e05[_0x38cb56[_0xdd0d('0x20')]][_0xdd0d('0x28')]()});}else if(_0x38cb56[_0xdd0d('0x46')]===_0xdd0d('0x4d')&&_0x38cb56[_0xdd0d('0x4e')]&&_0x38cb56[_0xdd0d('0x4e')][_0xdd0d('0xf')]&&_0x38cb56['idField']&&_0x38cb56[_0xdd0d('0x49')]){_0x4d9e05[_0x38cb56[_0xdd0d('0x4e')][_0xdd0d('0xf')]['toLowerCase']()]&&_0x272466[_0xdd0d('0x4c')][_0xdd0d('0x21')]({'id':_0x38cb56[_0xdd0d('0x22')],'value':_0x4d9e05[_0x38cb56[_0xdd0d('0x4e')][_0xdd0d('0xf')][_0xdd0d('0x4a')]()]['toString']()});}});}return _0x272466;}function getConnection(_0x252bd6){return request({'method':_0xdd0d('0x4f'),'form':{'method':_0xdd0d('0x50'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x252bd6['username'],'password':_0x252bd6[_0xdd0d('0x51')],'encryption':_0xdd0d('0x52')},'application':_0xdd0d('0x53')})}})[_0xdd0d('0x32')](function(_0x5b80db){var _0x546d6c=_0x5b80db;if(_0x546d6c['id']){def[_0xdd0d('0x54')]=_0x546d6c['id'];return BPromise['resolve'](_0x546d6c);}else{throw new Error(util[_0xdd0d('0x26')](_0xdd0d('0x55'),_0x252bd6['id']));}});}function setRelationship(_0x46035b,_0x2ed11a,_0x47d2ad,_0x279705){return request({'form':{'method':'set_relationship','input_type':_0xdd0d('0x24'),'response_type':_0xdd0d('0x24'),'rest_data':JSON['stringify']({'session':_0x46035b['id'],'module_name':'Calls','module_id':_0x47d2ad['id'],'link_field_name':_0x279705,'related_ids':[_0x2ed11a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xdd0d('0x56')]=function(_0xc1e85a,_0x40c53b,_0x8c9d2c,_0x1f3b65,_0x58a2e9,_0x228d00){var _0x49daed,_0x5b7f25,_0x348642,_0x43f0a4;_0x228d00[_0xdd0d('0x57')]=intUtil[_0xdd0d('0x58')](_0x228d00['remoteUri']);_0x228d00['serverUrl']=intUtil[_0xdd0d('0x58')](_0x228d00[_0xdd0d('0x59')]);def['uri']=util['format'](_0xdd0d('0x5a'),_0x228d00['remoteUri']);if(_0x58a2e9&&_0x58a2e9['monitor_format']){logger[_0xdd0d('0x2d')](_0xdd0d('0x5b'),_0xdd0d('0x5c'));_0x40c53b[_0xdd0d('0x5d')]=util[_0xdd0d('0x26')](_0xdd0d('0x5e'),_0x228d00[_0xdd0d('0x59')],_0x40c53b[_0xdd0d('0x5f')],md5(_0x40c53b[_0xdd0d('0x5f')]));}else{_0x40c53b[_0xdd0d('0x5d')]='';}return getConnection(_0x228d00)[_0xdd0d('0x32')](function(_0x39831b){_0x43f0a4=_0x39831b;return getUser(_0x228d00,_0x1f3b65[_0xdd0d('0xf')],_0x43f0a4);})[_0xdd0d('0x32')](function(_0x3066f7){_0x49daed=_0x3066f7;logger[_0xdd0d('0x2d')]('The\x20User\x20ID\x20is:',_0x49daed['id']);return getEndUser(_0x228d00,_0x40c53b['calleridname'],_0x40c53b[_0xdd0d('0x60')],_0x43f0a4);})[_0xdd0d('0x32')](function(_0x231d94){_0x5b7f25=_0x231d94;logger[_0xdd0d('0x2d')]('The\x20Enduser\x20ID\x20is:',_0x5b7f25['id']);return getTicket(_0x228d00,_0x49daed,_0x5b7f25,_0x8c9d2c,_0x40c53b,_0x8c9d2c[_0xdd0d('0x61')],_0x43f0a4,_0xdd0d('0x62'));})[_0xdd0d('0x32')](function(_0x3d5264){_0x348642=_0x3d5264;logger[_0xdd0d('0x2d')]('Ticket\x20created!');logger['info'](_0xdd0d('0x63'),_0x348642['id']);return setRelationship(_0x43f0a4,_0x49daed,_0x348642,_0xdd0d('0x64'));})['then'](function(){return setRelationship(_0x43f0a4,_0x5b7f25,_0x348642,_0xdd0d('0x65'));})[_0xdd0d('0x32')](function(){return getServerInfo(_0x43f0a4);})[_0xdd0d('0x32')](function(_0xcd7179){var _0x59faf3=parseInt(_0xcd7179[_0xdd0d('0x66')][_0xdd0d('0x67')](0x0));var _0x4f47d4=util[_0xdd0d('0x26')](_0xdd0d('0x68'),_0x228d00[_0xdd0d('0x57')],_0x348642['id']);if(_0x59faf3>0x6){_0x4f47d4=util[_0xdd0d('0x26')](_0xdd0d('0x69'),_0x228d00[_0xdd0d('0x57')],_0x348642['id']);}logger[_0xdd0d('0x2d')](_0xdd0d('0x5b'),_0xdd0d('0x6a'));emit(util[_0xdd0d('0x26')](_0xdd0d('0x6b'),_0x1f3b65[_0xdd0d('0xf')]),_0xdd0d('0x6c'),{'uri':_0x4f47d4});})['catch'](function(_0x39cfe6){logger[_0xdd0d('0x6d')](_0xdd0d('0x5b'),JSON[_0xdd0d('0x2b')](_0x39cfe6));});};exports[_0xdd0d('0x6e')]=function(_0x5e6d86,_0x349d5d,_0x456285,_0x5e8fad,_0xcccd50,_0xf7f6a2,_0xe42677){var _0x49ab15,_0x2d434a,_0xf91bd6,_0x3b4d37;_0xf7f6a2[_0xdd0d('0x57')]=intUtil[_0xdd0d('0x58')](_0xf7f6a2[_0xdd0d('0x57')]);_0xf7f6a2[_0xdd0d('0x59')]=intUtil[_0xdd0d('0x58')](_0xf7f6a2['serverUrl']);def['uri']=util[_0xdd0d('0x26')](_0xdd0d('0x5a'),_0xf7f6a2[_0xdd0d('0x57')]);if(_0xe42677&&_0xe42677[_0xdd0d('0x6f')]&&_0xe42677[_0xdd0d('0x6f')]!==_0xdd0d('0x70')){logger[_0xdd0d('0x2d')](_0xdd0d('0x71'),'Recording\x20is\x20enabled!');_0x349d5d[_0xdd0d('0x5d')]=util[_0xdd0d('0x26')](_0xdd0d('0x5e'),_0xf7f6a2[_0xdd0d('0x59')],_0x349d5d[_0xdd0d('0x5f')],md5(_0x349d5d[_0xdd0d('0x5f')]));}return getConnection(_0xf7f6a2)['then'](function(_0x541623){_0x3b4d37=_0x541623;return getUser(_0xf7f6a2,_0x5e8fad[_0xdd0d('0xf')],_0x3b4d37);})[_0xdd0d('0x32')](function(_0x41c406){_0x49ab15=_0x41c406;logger[_0xdd0d('0x2d')](_0xdd0d('0x72'),_0x49ab15['id']);return getEndUser(_0xf7f6a2,_0x349d5d['destcalleridname'],_0x349d5d['destcalleridnum'],_0x3b4d37);})[_0xdd0d('0x32')](function(_0x5bba5f){_0x2d434a=_0x5bba5f;logger[_0xdd0d('0x2d')](_0xdd0d('0x73'),_0x2d434a['id']);return getTicket(_0xf7f6a2,_0x49ab15,_0x2d434a,_0x456285,_0x349d5d,_0x456285[_0xdd0d('0x61')],_0x3b4d37,_0xdd0d('0x74'));})[_0xdd0d('0x32')](function(_0x509c62){_0xf91bd6=_0x509c62;logger[_0xdd0d('0x2d')](_0xdd0d('0x75'));logger[_0xdd0d('0x2d')](_0xdd0d('0x63'),_0xf91bd6['id']);return setRelationship(_0x3b4d37,_0x49ab15,_0xf91bd6,_0xdd0d('0x64'));})[_0xdd0d('0x32')](function(){return setRelationship(_0x3b4d37,_0x2d434a,_0xf91bd6,_0xdd0d('0x65'));})['then'](function(){return getServerInfo(_0x3b4d37);})[_0xdd0d('0x32')](function(_0x4cf2ca){var _0x14b718=parseInt(_0x4cf2ca[_0xdd0d('0x66')]['charAt'](0x0));var _0x180b02=util[_0xdd0d('0x26')](_0xdd0d('0x68'),_0xf7f6a2[_0xdd0d('0x57')],_0xf91bd6['id']);if(_0x14b718>0x6){_0x180b02=util[_0xdd0d('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xf7f6a2[_0xdd0d('0x57')],_0xf91bd6['id']);}logger[_0xdd0d('0x2d')](_0xdd0d('0x71'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdd0d('0x26')](_0xdd0d('0x6b'),_0x5e8fad[_0xdd0d('0xf')]),_0xdd0d('0x6c'),{'uri':_0x180b02});})[_0xdd0d('0x76')](function(_0x4913ca){logger[_0xdd0d('0x6d')]('[OUTBOUND]',JSON[_0xdd0d('0x2b')](_0x4913ca));});};exports['unmanaged']=function(_0x38ed99,_0x30554f,_0x46393c,_0x55bff8,_0x589489,_0x9299da){var _0x2faea1,_0x84a865,_0x29b74c,_0x1df747;_0x9299da['remoteUri']=intUtil[_0xdd0d('0x58')](_0x9299da['remoteUri']);_0x9299da['serverUrl']=intUtil[_0xdd0d('0x58')](_0x9299da[_0xdd0d('0x59')]);def[_0xdd0d('0x77')]=util[_0xdd0d('0x26')](_0xdd0d('0x5a'),_0x9299da[_0xdd0d('0x57')]);if(_0x589489&&_0x589489[_0xdd0d('0x78')]){logger['info']('['+_0x30554f[_0xdd0d('0x79')]['toUpperCase']()+']',_0xdd0d('0x5c'));_0x30554f[_0xdd0d('0x5d')]=util[_0xdd0d('0x26')](_0xdd0d('0x5e'),_0x9299da[_0xdd0d('0x59')],_0x30554f[_0xdd0d('0x5f')],md5(_0x30554f[_0xdd0d('0x5f')]));}else{_0x30554f[_0xdd0d('0x5d')]='';}return getConnection(_0x9299da)[_0xdd0d('0x32')](function(_0x1328a2){_0x1df747=_0x1328a2;if(!_['isNil'](_0x55bff8)){return getUser(_0x9299da,_0x55bff8[_0xdd0d('0xf')],_0x1df747);}else{return getUser(_0x9299da,null,_0x1df747);}})[_0xdd0d('0x32')](function(_0x9537c2){_0x2faea1=_0x9537c2;logger[_0xdd0d('0x2d')]('The\x20User\x20ID\x20is:',_0x2faea1['id']);return getEndUser(_0x9299da,_0x30554f[_0xdd0d('0x7a')],_0x30554f[_0xdd0d('0x60')],_0x1df747);})[_0xdd0d('0x32')](function(_0x5ab2a0){_0x84a865=_0x5ab2a0;logger['info'](_0xdd0d('0x73'),_0x84a865['id']);return getTicket(_0x9299da,_0x2faea1,_0x84a865,_0x46393c,_0x30554f,_0x46393c[_0xdd0d('0x61')],_0x1df747,_0xdd0d('0x62'));})['then'](function(_0x568e49){_0x29b74c=_0x568e49;logger[_0xdd0d('0x2d')]('Ticket\x20created!');logger[_0xdd0d('0x2d')](_0xdd0d('0x63'),_0x29b74c['id']);return setRelationship(_0x1df747,_0x2faea1,_0x29b74c,_0xdd0d('0x64'));})['then'](function(){return setRelationship(_0x1df747,_0x84a865,_0x29b74c,_0xdd0d('0x65'));})[_0xdd0d('0x32')](function(){return getServerInfo(_0x1df747);})[_0xdd0d('0x76')](function(_0x1f94f9){logger[_0xdd0d('0x6d')]('['+_0x30554f[_0xdd0d('0x79')][_0xdd0d('0x7b')]()+']',JSON[_0xdd0d('0x2b')](_0x1f94f9));});}; \ No newline at end of file +var _0x6a7f=['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','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','The\x20Ticket\x20ID\x20is:','trigger:browser:url','unmanaged','toUpperCase','isNil','users','error','lastevent','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','getString','assigned_user_id','created_by','description','Descriptions','date_start','slice','replace','duration_minutes','parent_id','parent_type','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','format','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','Contacts','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','merge','length','type','string','nameField','toLowerCase','content','customField','custom_fields','Variable','login','username','PLAIN','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!'];(function(_0x1c7338,_0x4459fb){var _0xccfb39=function(_0x1017ca){while(--_0x1017ca){_0x1c7338['push'](_0x1c7338['shift']());}};_0xccfb39(++_0x4459fb);}(_0x6a7f,0x1ec));var _0xf6a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a7f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0xf6a7('0x0'));var BPromise=require(_0xf6a7('0x1'));var md5=require(_0xf6a7('0x2'));var util=require(_0xf6a7('0x3'));var Redis=require('ioredis');var intUtil=require(_0xf6a7('0x4'));var config=require(_0xf6a7('0x5'));var logger=require(_0xf6a7('0x6'))('sugarcrm');config[_0xf6a7('0x7')]=_[_0xf6a7('0x8')](config[_0xf6a7('0x7')],{'host':_0xf6a7('0x9'),'port':0x18eb});var io=require(_0xf6a7('0xa'))(new Redis(config['redis']));var def={'method':_0xf6a7('0xb'),'json':!![]};function emit(_0x34ccb2,_0x1694a8,_0xdef8bd){io['to'](_0x34ccb2)[_0xf6a7('0xc')](_0x1694a8,_0xdef8bd);}function getTicket(_0xe2b998,_0x3ae799,_0x197d7b,_0x2e1025,_0x1f3abe,_0x53860f,_0x175032,_0x4c722e){logger[_0xf6a7('0xd')]('Creating\x20new\x20ticket...');var _0x3e09f0=new Date();var _0x58e286=[{'name':_0xf6a7('0xe'),'value':intUtil[_0xf6a7('0xf')](_0x2e1025['Subjects'],_0x1f3abe,'\x20')},{'name':_0xf6a7('0x10'),'value':_0x3ae799['id']},{'name':_0xf6a7('0x11'),'value':_0x3ae799['id']},{'name':_0xf6a7('0x12'),'value':intUtil['getString'](_0x2e1025[_0xf6a7('0x13')],_0x1f3abe,'\x0a')},{'name':_0xf6a7('0x14'),'value':_0x3e09f0['toISOString']()[_0xf6a7('0x15')](0x0,0x13)[_0xf6a7('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xf6a7('0x17'),'value':'15'},{'name':_0xf6a7('0x18'),'value':_0x197d7b['id']},{'name':_0xf6a7('0x19'),'value':'Contacts'},{'name':_0xf6a7('0x1a'),'value':_0x197d7b[_0xf6a7('0xe')]},{'name':_0xf6a7('0x1b'),'value':_0x4c722e}];if(_0x53860f['length']){_[_0xf6a7('0x1c')](_0x53860f,function(_0x2b9564){if(_0x1f3abe[_0x2b9564[_0xf6a7('0x1d')]]){_0x58e286[_0xf6a7('0x1e')]({'name':_0x2b9564[_0xf6a7('0x1f')],'value':_0x1f3abe[_0x2b9564[_0xf6a7('0x1d')]]});}});}return request({'form':{'method':_0xf6a7('0x20'),'input_type':_0xf6a7('0x21'),'response_type':_0xf6a7('0x21'),'rest_data':JSON[_0xf6a7('0x22')]({'session':_0x175032['id'],'module_name':'Calls','name_value_list':_0x58e286})}});}function getAuth(_0x9f0e92){return util[_0xf6a7('0x23')]('Basic\x20%s',new Buffer(_0x9f0e92['apiKey']+':X')[_0xf6a7('0x24')](_0xf6a7('0x25')));}function getServerInfo(_0x17c43c){return request({'form':{'method':_0xf6a7('0x26'),'input_type':_0xf6a7('0x21'),'response_type':_0xf6a7('0x21'),'rest_data':JSON['stringify']({'session':_0x17c43c['id']})}});}function getUser(_0x313d7c,_0x36fe44,_0x4dd770){if(!_['isNil'](_0x36fe44)){logger[_0xf6a7('0xd')](_0xf6a7('0x27'),_0x36fe44);return request({'form':{'method':_0xf6a7('0x28'),'input_type':_0xf6a7('0x21'),'response_type':_0xf6a7('0x21'),'rest_data':JSON[_0xf6a7('0x22')]({'session':_0x4dd770['id'],'module_name':_0xf6a7('0x29'),'query':util[_0xf6a7('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x36fe44),'order_by':'','offset':'0','select_fields':['id',_0xf6a7('0xe'),_0xf6a7('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf6a7('0x2b')](function(_0x55821d){if(_0x55821d[_0xf6a7('0x2c')]['length']){var _0x25e5da=_[_0xf6a7('0x2d')](_0x55821d[_0xf6a7('0x2c')],function(_0x23fe52){return _0x23fe52['name_value_list'][_0xf6a7('0x2a')][_0xf6a7('0x2e')]===_0x36fe44;});if(_0x25e5da){logger[_0xf6a7('0xd')](_0xf6a7('0x2f'));return BPromise[_0xf6a7('0x30')]({'id':_0x25e5da[_0xf6a7('0x31')]['id'][_0xf6a7('0x2e')],'name':_0x25e5da[_0xf6a7('0x31')]['name'][_0xf6a7('0x2e')]});}}logger[_0xf6a7('0xd')](_0xf6a7('0x32'));return BPromise[_0xf6a7('0x30')]({'id':_0x4dd770[_0xf6a7('0x31')][_0xf6a7('0x33')][_0xf6a7('0x2e')],'name':_0x4dd770['name_value_list'][_0xf6a7('0x2a')][_0xf6a7('0x2e')]});});}else{logger[_0xf6a7('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x4dd770[_0xf6a7('0x31')][_0xf6a7('0x33')][_0xf6a7('0x2e')],'name':_0x4dd770[_0xf6a7('0x31')][_0xf6a7('0x2a')][_0xf6a7('0x2e')]});}}function getEndUser(_0x6d581f,_0x411c3a,_0x519b81,_0x3403a4){logger['info'](_0xf6a7('0x34'),_0x519b81);return request({'form':{'method':_0xf6a7('0x28'),'input_type':_0xf6a7('0x21'),'response_type':_0xf6a7('0x21'),'rest_data':JSON[_0xf6a7('0x22')]({'session':_0x3403a4['id'],'module_name':_0xf6a7('0x35'),'query':util[_0xf6a7('0x23')](_0xf6a7('0x36'),_0x519b81),'order_by':'','offset':'0','select_fields':['id',_0xf6a7('0xe'),_0xf6a7('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1f8d50){if(_0x1f8d50[_0xf6a7('0x2c')]['length']){var _0x5969ce=_[_0xf6a7('0x2d')](_0x1f8d50[_0xf6a7('0x2c')],function(_0x5b30bd){return _0x5b30bd[_0xf6a7('0x31')]['phone_home']['value']===_0x519b81;});if(_0x5969ce){logger[_0xf6a7('0xd')](_0xf6a7('0x38'));return BPromise['resolve']({'id':_0x5969ce['name_value_list']['id'][_0xf6a7('0x2e')],'name':_0x5969ce[_0xf6a7('0x31')][_0xf6a7('0xe')]['value'],'phone':_0x5969ce[_0xf6a7('0x31')][_0xf6a7('0x37')][_0xf6a7('0x2e')]});}}else{logger['info'](_0xf6a7('0x39'));return request({'form':{'method':_0xf6a7('0x20'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf6a7('0x22')]({'session':_0x3403a4['id'],'module_name':_0xf6a7('0x35'),'name_value_list':[{'name':_0xf6a7('0x3a'),'value':_0x411c3a!==_0xf6a7('0x3b')?_0x411c3a:util[_0xf6a7('0x23')](_0xf6a7('0x3c'),_0x519b81)},{'name':_0xf6a7('0x37'),'value':_0x519b81}]})}})[_0xf6a7('0x2b')](function(_0x28fe41){logger[_0xf6a7('0xd')]('Enduser\x20created.');return BPromise[_0xf6a7('0x30')]({'id':_0x28fe41['id'],'name':_0x28fe41['entry_list'][_0xf6a7('0x3a')][_0xf6a7('0x2e')],'phone':_0x28fe41['entry_list']['phone_home'][_0xf6a7('0x2e')]});});}});}function request(_0x163707){logger['debug']('[HTTP]',JSON[_0xf6a7('0x22')](_0x163707));return rp(_[_0xf6a7('0x3d')](def,_0x163707));}function getTags(_0x460797,_0x2c2e87){var _0x2844c3=[];if(_0x460797&&_0x460797[_0xf6a7('0x3e')]>0x0){_0x2844c3=_['map'](_0x460797,_0x2c2e87);}return _0x2844c3;}function getCustomFields(_0x4e5907,_0x2590c9){var _0x130777=[];var _0x2f6dae={'custom_fields':[]};if(_0x4e5907[_0xf6a7('0x3e')]>0x0){_[_0xf6a7('0x1c')](_0x4e5907,function(_0x7302c3){if(_0x7302c3[_0xf6a7('0x3f')]===_0xf6a7('0x40')&&_0x7302c3[_0xf6a7('0x41')]&&!_0x7302c3['customField']){_0x2f6dae[_0x7302c3['nameField'][_0xf6a7('0x42')]()]=_0x7302c3[_0xf6a7('0x43')][_0xf6a7('0x24')]();}else if(_0x7302c3[_0xf6a7('0x3f')]===_0xf6a7('0x40')&&_0x7302c3['idField']&&_0x7302c3[_0xf6a7('0x44')]){_0x2f6dae[_0xf6a7('0x45')][_0xf6a7('0x1e')]({'id':_0x7302c3[_0xf6a7('0x1f')],'value':_0x7302c3['content'][_0xf6a7('0x24')]()});}else if(_0x7302c3[_0xf6a7('0x3f')]==='variable'&&_0x7302c3[_0xf6a7('0x1d')]&&_0x7302c3[_0xf6a7('0x1f')]&&_0x7302c3['customField']){_0x2590c9[_0x7302c3['variableName']]&&_0x2f6dae[_0xf6a7('0x45')][_0xf6a7('0x1e')]({'id':_0x7302c3[_0xf6a7('0x1f')],'value':_0x2590c9[_0x7302c3[_0xf6a7('0x1d')]][_0xf6a7('0x24')]()});}else if(_0x7302c3[_0xf6a7('0x3f')]==='customVariable'&&_0x7302c3[_0xf6a7('0x46')]&&_0x7302c3['Variable'][_0xf6a7('0xe')]&&_0x7302c3[_0xf6a7('0x1f')]&&_0x7302c3[_0xf6a7('0x44')]){_0x2590c9[_0x7302c3[_0xf6a7('0x46')]['name'][_0xf6a7('0x42')]()]&&_0x2f6dae[_0xf6a7('0x45')][_0xf6a7('0x1e')]({'id':_0x7302c3[_0xf6a7('0x1f')],'value':_0x2590c9[_0x7302c3['Variable']['name'][_0xf6a7('0x42')]()][_0xf6a7('0x24')]()});}});}return _0x2f6dae;}function getConnection(_0x612b3a){return request({'method':_0xf6a7('0xb'),'form':{'method':_0xf6a7('0x47'),'input_type':_0xf6a7('0x21'),'response_type':_0xf6a7('0x21'),'rest_data':JSON[_0xf6a7('0x22')]({'user_auth':{'user_name':_0x612b3a[_0xf6a7('0x48')],'password':_0x612b3a['password'],'encryption':_0xf6a7('0x49')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x279449){var _0x455886=_0x279449;if(_0x455886['id']){def['sessionID']=_0x455886['id'];return BPromise[_0xf6a7('0x30')](_0x455886);}else{throw new Error(util[_0xf6a7('0x23')](_0xf6a7('0x4a'),_0x612b3a['id']));}});}function setRelationship(_0x524401,_0x345ab2,_0x5a5a6d,_0x1efb4b){return request({'form':{'method':_0xf6a7('0x4b'),'input_type':_0xf6a7('0x21'),'response_type':_0xf6a7('0x21'),'rest_data':JSON[_0xf6a7('0x22')]({'session':_0x524401['id'],'module_name':_0xf6a7('0x4c'),'module_id':_0x5a5a6d['id'],'link_field_name':_0x1efb4b,'related_ids':[_0x345ab2['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf6a7('0x4d')]=function(_0x3ad477,_0x4de817,_0x256b88,_0x4630ef,_0x3d1209,_0x29d9e5){var _0x5cd6de,_0x1f39b6,_0x12350b,_0x390c3b;_0x29d9e5[_0xf6a7('0x4e')]=intUtil[_0xf6a7('0x4f')](_0x29d9e5[_0xf6a7('0x4e')]);_0x29d9e5[_0xf6a7('0x50')]=intUtil[_0xf6a7('0x4f')](_0x29d9e5[_0xf6a7('0x50')]);def[_0xf6a7('0x51')]=util[_0xf6a7('0x23')](_0xf6a7('0x52'),_0x29d9e5['remoteUri']);if(_0x3d1209&&_0x3d1209[_0xf6a7('0x53')]){logger[_0xf6a7('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x4de817[_0xf6a7('0x54')]=util[_0xf6a7('0x23')](_0xf6a7('0x55'),_0x29d9e5[_0xf6a7('0x50')],_0x4de817[_0xf6a7('0x56')],md5(_0x4de817['uniqueid']));}else{_0x4de817['recordingURL']='';}return getConnection(_0x29d9e5)[_0xf6a7('0x2b')](function(_0x20fd8a){_0x390c3b=_0x20fd8a;return getUser(_0x29d9e5,_0x4630ef[_0xf6a7('0xe')],_0x390c3b);})['then'](function(_0x567685){_0x5cd6de=_0x567685;logger[_0xf6a7('0xd')]('The\x20User\x20ID\x20is:',_0x5cd6de['id']);return getEndUser(_0x29d9e5,_0x4de817[_0xf6a7('0x57')],_0x4de817[_0xf6a7('0x58')],_0x390c3b);})[_0xf6a7('0x2b')](function(_0x2371e1){_0x1f39b6=_0x2371e1;logger[_0xf6a7('0xd')](_0xf6a7('0x59'),_0x1f39b6['id']);return getTicket(_0x29d9e5,_0x5cd6de,_0x1f39b6,_0x256b88,_0x4de817,_0x256b88[_0xf6a7('0x5a')],_0x390c3b,_0xf6a7('0x5b'));})[_0xf6a7('0x2b')](function(_0x21c1a2){_0x12350b=_0x21c1a2;logger[_0xf6a7('0xd')](_0xf6a7('0x5c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x12350b['id']);return setRelationship(_0x390c3b,_0x5cd6de,_0x12350b,'users');})[_0xf6a7('0x2b')](function(){return setRelationship(_0x390c3b,_0x1f39b6,_0x12350b,_0xf6a7('0x5d'));})[_0xf6a7('0x2b')](function(){return getServerInfo(_0x390c3b);})[_0xf6a7('0x2b')](function(_0x5d6cc9){var _0x19e6a4=parseInt(_0x5d6cc9[_0xf6a7('0x5e')][_0xf6a7('0x5f')](0x0));var _0x5e0710=util[_0xf6a7('0x23')](_0xf6a7('0x60'),_0x29d9e5['remoteUri'],_0x12350b['id']);if(_0x19e6a4>0x6){_0x5e0710=util[_0xf6a7('0x23')](_0xf6a7('0x61'),_0x29d9e5[_0xf6a7('0x4e')],_0x12350b['id']);}logger[_0xf6a7('0xd')](_0xf6a7('0x62'),_0xf6a7('0x63'));emit(util[_0xf6a7('0x23')](_0xf6a7('0x64'),_0x4630ef['name']),'trigger:browser:url',{'uri':_0x5e0710});})[_0xf6a7('0x65')](function(_0x4b196d){logger['error'](_0xf6a7('0x62'),JSON['stringify'](_0x4b196d));});};exports[_0xf6a7('0x66')]=function(_0x1c2f1b,_0x13ab09,_0x45c12c,_0x143d1e,_0x14d224,_0x39d0a,_0x5483e0){var _0x495c0e,_0x10896f,_0x1db411,_0x1cc290;_0x39d0a['remoteUri']=intUtil[_0xf6a7('0x4f')](_0x39d0a[_0xf6a7('0x4e')]);_0x39d0a['serverUrl']=intUtil[_0xf6a7('0x4f')](_0x39d0a[_0xf6a7('0x50')]);def[_0xf6a7('0x51')]=util[_0xf6a7('0x23')](_0xf6a7('0x52'),_0x39d0a['remoteUri']);if(_0x5483e0&&_0x5483e0[_0xf6a7('0x67')]&&_0x5483e0['recordingFormat']!==_0xf6a7('0x68')){logger[_0xf6a7('0xd')](_0xf6a7('0x69'),_0xf6a7('0x6a'));_0x13ab09[_0xf6a7('0x54')]=util[_0xf6a7('0x23')](_0xf6a7('0x55'),_0x39d0a[_0xf6a7('0x50')],_0x13ab09[_0xf6a7('0x56')],md5(_0x13ab09[_0xf6a7('0x56')]));}return getConnection(_0x39d0a)[_0xf6a7('0x2b')](function(_0x15cede){_0x1cc290=_0x15cede;return getUser(_0x39d0a,_0x143d1e[_0xf6a7('0xe')],_0x1cc290);})[_0xf6a7('0x2b')](function(_0x835517){_0x495c0e=_0x835517;logger[_0xf6a7('0xd')](_0xf6a7('0x6b'),_0x495c0e['id']);return getEndUser(_0x39d0a,_0x13ab09[_0xf6a7('0x6c')],_0x13ab09['destcalleridnum'],_0x1cc290);})[_0xf6a7('0x2b')](function(_0x372095){_0x10896f=_0x372095;logger[_0xf6a7('0xd')](_0xf6a7('0x59'),_0x10896f['id']);return getTicket(_0x39d0a,_0x495c0e,_0x10896f,_0x45c12c,_0x13ab09,_0x45c12c['Fields'],_0x1cc290,'Outbound');})[_0xf6a7('0x2b')](function(_0x5a943b){_0x1db411=_0x5a943b;logger[_0xf6a7('0xd')](_0xf6a7('0x5c'));logger['info'](_0xf6a7('0x6d'),_0x1db411['id']);return setRelationship(_0x1cc290,_0x495c0e,_0x1db411,'users');})[_0xf6a7('0x2b')](function(){return setRelationship(_0x1cc290,_0x10896f,_0x1db411,_0xf6a7('0x5d'));})[_0xf6a7('0x2b')](function(){return getServerInfo(_0x1cc290);})[_0xf6a7('0x2b')](function(_0x1c97c4){var _0x3e5b6a=parseInt(_0x1c97c4[_0xf6a7('0x5e')]['charAt'](0x0));var _0x595973=util['format'](_0xf6a7('0x60'),_0x39d0a[_0xf6a7('0x4e')],_0x1db411['id']);if(_0x3e5b6a>0x6){_0x595973=util[_0xf6a7('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x39d0a[_0xf6a7('0x4e')],_0x1db411['id']);}logger['info'](_0xf6a7('0x69'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf6a7('0x23')]('user:%s',_0x143d1e[_0xf6a7('0xe')]),_0xf6a7('0x6e'),{'uri':_0x595973});})['catch'](function(_0x168bc5){logger['error'](_0xf6a7('0x69'),JSON[_0xf6a7('0x22')](_0x168bc5));});};exports[_0xf6a7('0x6f')]=function(_0x50c9f1,_0x4e4e8d,_0x5ad9c3,_0x47648d,_0x139b3d,_0x346a07){var _0x467d68,_0x39a917,_0x11b68d,_0x5457b6;_0x346a07[_0xf6a7('0x4e')]=intUtil[_0xf6a7('0x4f')](_0x346a07[_0xf6a7('0x4e')]);_0x346a07[_0xf6a7('0x50')]=intUtil[_0xf6a7('0x4f')](_0x346a07[_0xf6a7('0x50')]);def[_0xf6a7('0x51')]=util[_0xf6a7('0x23')](_0xf6a7('0x52'),_0x346a07[_0xf6a7('0x4e')]);if(_0x139b3d&&_0x139b3d[_0xf6a7('0x53')]){logger[_0xf6a7('0xd')]('['+_0x4e4e8d['lastevent'][_0xf6a7('0x70')]()+']',_0xf6a7('0x6a'));_0x4e4e8d[_0xf6a7('0x54')]=util[_0xf6a7('0x23')](_0xf6a7('0x55'),_0x346a07[_0xf6a7('0x50')],_0x4e4e8d[_0xf6a7('0x56')],md5(_0x4e4e8d['uniqueid']));}else{_0x4e4e8d[_0xf6a7('0x54')]='';}return getConnection(_0x346a07)['then'](function(_0x290554){_0x5457b6=_0x290554;if(!_[_0xf6a7('0x71')](_0x47648d)){return getUser(_0x346a07,_0x47648d[_0xf6a7('0xe')],_0x5457b6);}else{return getUser(_0x346a07,null,_0x5457b6);}})['then'](function(_0x3be386){_0x467d68=_0x3be386;logger['info'](_0xf6a7('0x6b'),_0x467d68['id']);return getEndUser(_0x346a07,_0x4e4e8d['calleridname'],_0x4e4e8d[_0xf6a7('0x58')],_0x5457b6);})[_0xf6a7('0x2b')](function(_0x58ad48){_0x39a917=_0x58ad48;logger[_0xf6a7('0xd')]('The\x20Enduser\x20ID\x20is:',_0x39a917['id']);return getTicket(_0x346a07,_0x467d68,_0x39a917,_0x5ad9c3,_0x4e4e8d,_0x5ad9c3[_0xf6a7('0x5a')],_0x5457b6,_0xf6a7('0x5b'));})[_0xf6a7('0x2b')](function(_0x171023){_0x11b68d=_0x171023;logger[_0xf6a7('0xd')](_0xf6a7('0x5c'));logger[_0xf6a7('0xd')](_0xf6a7('0x6d'),_0x11b68d['id']);return setRelationship(_0x5457b6,_0x467d68,_0x11b68d,_0xf6a7('0x72'));})[_0xf6a7('0x2b')](function(){return setRelationship(_0x5457b6,_0x39a917,_0x11b68d,_0xf6a7('0x5d'));})[_0xf6a7('0x2b')](function(){return getServerInfo(_0x5457b6);})[_0xf6a7('0x65')](function(_0xfdb9d4){logger[_0xf6a7('0x73')]('['+_0x4e4e8d[_0xf6a7('0x74')][_0xf6a7('0x70')]()+']',JSON[_0xf6a7('0x22')](_0xfdb9d4));});}; \ 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 0c1c3ba..60733da 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 _0xdf44=['keyContent','format','%s:\x20%s','customVariable','join','stripTrailingSlash','lastIndexOf','validateEmail','isNil','test','util','getString','sortBy','type','content','variable','variableName','push','toString','Variable','name','toLowerCase','keyValue','keyType','string','key'];(function(_0x4c4749,_0x1f776d){var _0x138d91=function(_0x37a29c){while(--_0x37a29c){_0x4c4749['push'](_0x4c4749['shift']());}};_0x138d91(++_0x1f776d);}(_0xdf44,0x8c));var _0x4df4=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xdf44[_0x4b2863];return _0x567d67;};'use strict';var _=require('lodash');var util=require(_0x4df4('0x0'));exports[_0x4df4('0x1')]=function(_0x25df68,_0x5bd2ac,_0x1e86d6){var _0xcd97fd=[];if(_0x25df68['length']>0x0){var _0x3caa02=_[_0x4df4('0x2')](_0x25df68,['id']);for(var _0x263bb5=0x0;_0x263bb5<_0x3caa02['length'];_0x263bb5++){var _0x2d2696=_0x3caa02[_0x263bb5];if(_0x2d2696[_0x4df4('0x3')]==='string'){_0xcd97fd['push'](_0x2d2696[_0x4df4('0x4')]);}else if(_0x2d2696[_0x4df4('0x3')]===_0x4df4('0x5')&&_0x2d2696[_0x4df4('0x6')]){_0x5bd2ac[_0x2d2696[_0x4df4('0x6')]]&&_0xcd97fd[_0x4df4('0x7')](_0x5bd2ac[_0x2d2696['variableName']][_0x4df4('0x8')]());}else if(_0x2d2696['type']==='customVariable'&&_0x2d2696['Variable']&&_0x2d2696[_0x4df4('0x9')][_0x4df4('0xa')]){_0x5bd2ac[_0x2d2696[_0x4df4('0x9')][_0x4df4('0xa')]['toLowerCase']()]&&_0xcd97fd[_0x4df4('0x7')](_0x5bd2ac[_0x2d2696['Variable'][_0x4df4('0xa')][_0x4df4('0xb')]()]['toString']());}else if(_0x2d2696[_0x4df4('0x3')]===_0x4df4('0xc')){if(_0x2d2696[_0x4df4('0xd')]===_0x4df4('0xe')&&_0x2d2696[_0x4df4('0xf')]){_0xcd97fd[_0x4df4('0x7')](util['format']('%s:\x20%s',_0x2d2696['key'],_0x2d2696[_0x4df4('0x10')]));}else if(_0x2d2696[_0x4df4('0xd')]===_0x4df4('0x5')&&_0x2d2696[_0x4df4('0x6')]&&_0x2d2696['key']){_0x5bd2ac[_0x2d2696[_0x4df4('0x6')]]&&_0xcd97fd[_0x4df4('0x7')](util[_0x4df4('0x11')](_0x4df4('0x12'),_0x2d2696[_0x4df4('0xf')],_0x5bd2ac[_0x2d2696['variableName']]));}else if(_0x2d2696[_0x4df4('0xd')]===_0x4df4('0x13')&&_0x2d2696['Variable']&&_0x2d2696[_0x4df4('0x9')][_0x4df4('0xa')]&&_0x2d2696[_0x4df4('0xf')]){_0x5bd2ac[_0x2d2696['Variable'][_0x4df4('0xa')][_0x4df4('0xb')]()]&&_0xcd97fd[_0x4df4('0x7')](util['format']('%s:\x20%s',_0x2d2696[_0x4df4('0xf')],_0x5bd2ac[_0x2d2696[_0x4df4('0x9')][_0x4df4('0xa')][_0x4df4('0xb')]()]));}}}}return _0xcd97fd[_0x4df4('0x14')](_0x1e86d6);};exports[_0x4df4('0x15')]=function(_0x203c5a){var _0x5cb32c=_0x203c5a['slice'](-0x1);if(_0x5cb32c==='/'){_0x203c5a=_0x203c5a['substring'](0x0,_0x203c5a[_0x4df4('0x16')](_0x5cb32c));}return _0x203c5a;};exports[_0x4df4('0x17')]=function(_0x40434a){if(!_[_0x4df4('0x18')](_0x40434a)&&_0x40434a!==''){var _0xcaf9bf=/^(([^<>()\[\]\\.,;:\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 _0xcaf9bf[_0x4df4('0x19')](String(_0x40434a)[_0x4df4('0xb')]());}else{return![];}}; \ No newline at end of file +var _0xea1c=['string','push','variable','variableName','toString','customVariable','Variable','toLowerCase','name','keyValue','keyType','%s:\x20%s','keyContent','key','format','stripTrailingSlash','slice','lastIndexOf','isNil','test','lodash','util','length','type'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xea1c,0x194));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcea1('0x0'));var util=require(_0xcea1('0x1'));exports['getString']=function(_0x53bc37,_0x539549,_0x3fea35){var _0x7a96dc=[];if(_0x53bc37[_0xcea1('0x2')]>0x0){var _0x232026=_['sortBy'](_0x53bc37,['id']);for(var _0x2c2898=0x0;_0x2c2898<_0x232026['length'];_0x2c2898++){var _0x3292d6=_0x232026[_0x2c2898];if(_0x3292d6[_0xcea1('0x3')]===_0xcea1('0x4')){_0x7a96dc[_0xcea1('0x5')](_0x3292d6['content']);}else if(_0x3292d6[_0xcea1('0x3')]===_0xcea1('0x6')&&_0x3292d6[_0xcea1('0x7')]){_0x539549[_0x3292d6[_0xcea1('0x7')]]&&_0x7a96dc[_0xcea1('0x5')](_0x539549[_0x3292d6[_0xcea1('0x7')]][_0xcea1('0x8')]());}else if(_0x3292d6[_0xcea1('0x3')]===_0xcea1('0x9')&&_0x3292d6['Variable']&&_0x3292d6[_0xcea1('0xa')]['name']){_0x539549[_0x3292d6[_0xcea1('0xa')]['name'][_0xcea1('0xb')]()]&&_0x7a96dc[_0xcea1('0x5')](_0x539549[_0x3292d6[_0xcea1('0xa')][_0xcea1('0xc')][_0xcea1('0xb')]()][_0xcea1('0x8')]());}else if(_0x3292d6['type']===_0xcea1('0xd')){if(_0x3292d6[_0xcea1('0xe')]===_0xcea1('0x4')&&_0x3292d6['key']){_0x7a96dc[_0xcea1('0x5')](util['format'](_0xcea1('0xf'),_0x3292d6['key'],_0x3292d6[_0xcea1('0x10')]));}else if(_0x3292d6[_0xcea1('0xe')]==='variable'&&_0x3292d6['variableName']&&_0x3292d6[_0xcea1('0x11')]){_0x539549[_0x3292d6['variableName']]&&_0x7a96dc['push'](util[_0xcea1('0x12')](_0xcea1('0xf'),_0x3292d6['key'],_0x539549[_0x3292d6[_0xcea1('0x7')]]));}else if(_0x3292d6[_0xcea1('0xe')]===_0xcea1('0x9')&&_0x3292d6[_0xcea1('0xa')]&&_0x3292d6[_0xcea1('0xa')]['name']&&_0x3292d6[_0xcea1('0x11')]){_0x539549[_0x3292d6['Variable'][_0xcea1('0xc')]['toLowerCase']()]&&_0x7a96dc[_0xcea1('0x5')](util[_0xcea1('0x12')](_0xcea1('0xf'),_0x3292d6[_0xcea1('0x11')],_0x539549[_0x3292d6[_0xcea1('0xa')]['name'][_0xcea1('0xb')]()]));}}}}return _0x7a96dc['join'](_0x3fea35);};exports[_0xcea1('0x13')]=function(_0x503fbd){var _0x2db1e9=_0x503fbd[_0xcea1('0x14')](-0x1);if(_0x2db1e9==='/'){_0x503fbd=_0x503fbd['substring'](0x0,_0x503fbd[_0xcea1('0x15')](_0x2db1e9));}return _0x503fbd;};exports['validateEmail']=function(_0x59d644){if(!_[_0xcea1('0x16')](_0x59d644)&&_0x59d644!==''){var _0x433116=/^(([^<>()\[\]\\.,;:\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 _0x433116[_0xcea1('0x17')](String(_0x59d644)[_0xcea1('0xb')]());}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 36b89c9..048691f 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(_0x41d318,_0x28ae70){var _0xe769b6=function(_0x1f7f5d){while(--_0x1f7f5d){_0x41d318['push'](_0x41d318['shift']());}};_0xe769b6(++_0x28ae70);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'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 _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','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','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ 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 6e6026f..0946f36 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 _0x5e83=['The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','POST','newTab','[QUEUE]','user:%s','trigger:browser:url','replace','/api/v2','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','email','destcalleridname','destcalleridnum','integrationTab','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','redis','defaults','localhost','application/json','info','format','merge','Tags','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','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','filter','end-user','Enduser\x20found!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s/token:%s','username','toString','debug','[HTTP]','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','custom_fields','idField','variable','variableName','push','Variable','name','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:'];(function(_0x471320,_0x476396){var _0x176b4f=function(_0x10c907){while(--_0x10c907){_0x471320['push'](_0x471320['shift']());}};_0x176b4f(++_0x476396);}(_0x5e83,0x154));var _0x35e8=function(_0x4d2ed7,_0x1999e5){_0x4d2ed7=_0x4d2ed7-0x0;var _0x12af27=_0x5e83[_0x4d2ed7];return _0x12af27;};'use strict';var _=require(_0x35e8('0x0'));var rp=require(_0x35e8('0x1'));var md5=require(_0x35e8('0x2'));var util=require('util');var Redis=require(_0x35e8('0x3'));var intUtil=require(_0x35e8('0x4'));var config=require('../../../../config/environment');var logger=require(_0x35e8('0x5'))('zendesk');config[_0x35e8('0x6')]=_[_0x35e8('0x7')](config[_0x35e8('0x6')],{'host':_0x35e8('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35e8('0x6')]));function emit(_0x28b6f7,_0x33dce9,_0x2d66fb){io['to'](_0x28b6f7)['emit'](_0x33dce9,_0x2d66fb);}var headers={'Content-Type':_0x35e8('0x9'),'Accept':_0x35e8('0x9')};function getTicket(_0x2cf6da,_0x165748,_0x1a94bb,_0x28fcac,_0x3d1270){logger[_0x35e8('0xa')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x35e8('0xb')]('%s/tickets.json',_0x2cf6da['remoteUri']),'method':'POST','body':{'ticket':_[_0x35e8('0xc')]({'requester_id':_0x1a94bb['id'],'submitter_id':_0x165748?_0x165748['id']:undefined,'assignee_id':_0x165748?_0x165748['id']:undefined,'tags':getTags(_0x28fcac[_0x35e8('0xd')],'name'),'subject':intUtil[_0x35e8('0xe')](_0x28fcac[_0x35e8('0xf')],_0x3d1270,'\x20'),'description':intUtil[_0x35e8('0xe')](_0x28fcac[_0x35e8('0x10')],_0x3d1270,'\x0a'),'comment':{'public':![],'body':intUtil[_0x35e8('0xe')](_0x28fcac[_0x35e8('0x10')],_0x3d1270,'\x0a')}},getCustomFields(_0x28fcac[_0x35e8('0x11')],_0x3d1270))}})[_0x35e8('0x12')](function(_0x4cd35a){logger[_0x35e8('0xa')]('Ticket\x20created!');return _0x4cd35a[_0x35e8('0x13')];});}function getUser(_0x5ed288,_0x42dc17){if(intUtil[_0x35e8('0x14')](_0x42dc17)){logger['info'](_0x35e8('0x15'),_0x42dc17);return request({'uri':util['format'](_0x35e8('0x16'),_0x5ed288[_0x35e8('0x17')]),'qs':{'query':util[_0x35e8('0xb')](_0x35e8('0x18'),_0x42dc17)}})[_0x35e8('0x12')](function(_0x1c5ff2){if(_0x1c5ff2[_0x35e8('0x19')]){logger[_0x35e8('0xa')](_0x35e8('0x1a'));return _[_0x35e8('0x1b')](_0x1c5ff2[_0x35e8('0x1c')],{'email':_0x42dc17,'role':'agent'});}else{logger[_0x35e8('0xa')](_0x35e8('0x1d'));return request({'uri':util[_0x35e8('0xb')](_0x35e8('0x1e'),_0x5ed288[_0x35e8('0x17')])})[_0x35e8('0x12')](function(_0x13569c){logger[_0x35e8('0xa')](_0x35e8('0x1f'));return _0x13569c[_0x35e8('0x20')];});}});}else{logger[_0x35e8('0xa')](_0x35e8('0x1d'));return request({'uri':util['format'](_0x35e8('0x1e'),_0x5ed288[_0x35e8('0x17')])})['then'](function(_0x1ee674){logger[_0x35e8('0xa')](_0x35e8('0x1f'));return _0x1ee674[_0x35e8('0x20')];});}}function getEndUser(_0x1be79d,_0x565959,_0x1617cd){logger[_0x35e8('0xa')](_0x35e8('0x21'),_0x1617cd);return request({'uri':util[_0x35e8('0xb')]('%s/search.json',_0x1be79d[_0x35e8('0x17')]),'qs':{'query':util[_0x35e8('0xb')](_0x35e8('0x22'),_0x1617cd)}})[_0x35e8('0x12')](function(_0x12a570){var _0x30d90a;if(_0x12a570[_0x35e8('0x1c')][_0x35e8('0x23')]){_0x12a570['results']=_[_0x35e8('0x24')](_0x12a570[_0x35e8('0x1c')],{'suspended':![],'role':_0x35e8('0x25')});if(_0x12a570[_0x35e8('0x1c')][_0x35e8('0x23')]){_0x30d90a=_['first'](_0x12a570['results']);}}if(_0x30d90a){logger[_0x35e8('0xa')](_0x35e8('0x26'));return _0x30d90a;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x35e8('0xb')]('%s/users.json',_0x1be79d[_0x35e8('0x17')]),'method':'POST','body':{'user':{'role':_0x35e8('0x25'),'name':util[_0x35e8('0xb')](_0x35e8('0x27'),_0x565959||_0x1617cd),'phone':_0x1617cd}}})[_0x35e8('0x12')](function(_0x3aeed2){logger[_0x35e8('0xa')](_0x35e8('0x28'));return _0x3aeed2['user'];});}});}function getAuth(_0x33ac59){var _0x246812;if(_0x33ac59[_0x35e8('0x29')]===_0x35e8('0x2a')){_0x246812=util['format']('%s:%s',_0x33ac59['username'],_0x33ac59['password']);}else if(_0x33ac59[_0x35e8('0x29')]==='token'){_0x246812=util[_0x35e8('0xb')](_0x35e8('0x2b'),_0x33ac59[_0x35e8('0x2c')],_0x33ac59['token']);}return util[_0x35e8('0xb')]('Basic\x20%s',new Buffer(_0x246812)[_0x35e8('0x2d')]('base64'));}function request(_0x4b4cc4){logger[_0x35e8('0x2e')](_0x35e8('0x2f'),JSON['stringify'](_0x4b4cc4));return rp(_['defaults'](_0x4b4cc4,{'method':_0x35e8('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x10719e,_0x4db9e7){var _0x5ea6bc=[];if(_0x10719e&&_0x10719e[_0x35e8('0x23')]>0x0){_0x5ea6bc=_[_0x35e8('0x31')](_0x10719e,_0x4db9e7);}return _0x5ea6bc;}function getCustomFields(_0x1e0f32,_0x31e9c5){var _0x31d825=[];var _0x9c30ff={'custom_fields':[]};if(_0x1e0f32[_0x35e8('0x23')]>0x0){_['forEach'](_0x1e0f32,function(_0x5ad720){if(_[_0x35e8('0x32')]([_0x35e8('0x33'),_0x35e8('0x34')],_0x5ad720[_0x35e8('0x35')])&&_0x5ad720[_0x35e8('0x36')]&&!_0x5ad720[_0x35e8('0x37')]){_0x9c30ff[_0x5ad720[_0x35e8('0x36')][_0x35e8('0x38')]()]=_0x5ad720[_0x35e8('0x39')]['toString']();}else if(_[_0x35e8('0x32')]([_0x35e8('0x33'),_0x35e8('0x34')],_0x5ad720[_0x35e8('0x35')])&&_0x5ad720['idField']&&_0x5ad720[_0x35e8('0x37')]){_0x9c30ff[_0x35e8('0x3a')]['push']({'id':_0x5ad720[_0x35e8('0x3b')],'value':_0x5ad720['content']['toString']()});}else if(_0x5ad720[_0x35e8('0x35')]===_0x35e8('0x3c')&&_0x5ad720[_0x35e8('0x3d')]&&_0x5ad720[_0x35e8('0x3b')]&&_0x5ad720['customField']){_0x31e9c5[_0x5ad720[_0x35e8('0x3d')]]&&_0x9c30ff[_0x35e8('0x3a')][_0x35e8('0x3e')]({'id':_0x5ad720[_0x35e8('0x3b')],'value':_0x31e9c5[_0x5ad720[_0x35e8('0x3d')]][_0x35e8('0x2d')]()});}else if(_0x5ad720['type']==='customVariable'&&_0x5ad720[_0x35e8('0x3f')]&&_0x5ad720[_0x35e8('0x3f')][_0x35e8('0x40')]&&_0x5ad720[_0x35e8('0x3b')]&&_0x5ad720[_0x35e8('0x37')]){_0x31e9c5[_0x5ad720[_0x35e8('0x3f')][_0x35e8('0x40')]['toLowerCase']()]&&_0x9c30ff[_0x35e8('0x3a')]['push']({'id':_0x5ad720[_0x35e8('0x3b')],'value':_0x31e9c5[_0x5ad720[_0x35e8('0x3f')]['name'][_0x35e8('0x38')]()][_0x35e8('0x2d')]()});}});}return _0x9c30ff;}exports['queue']=function(_0x2dc82e,_0x5cdf76,_0x464a38,_0x29ac02,_0x366d21,_0x4d02e4){var _0x4edd3a,_0x3206fe;_0x4d02e4['remoteUri']=intUtil[_0x35e8('0x41')](_0x4d02e4['remoteUri']);_0x4d02e4[_0x35e8('0x42')]=intUtil[_0x35e8('0x41')](_0x4d02e4[_0x35e8('0x42')]);if(_0x366d21&&_0x366d21[_0x35e8('0x43')]){logger['info']('[QUEUE]',_0x35e8('0x44'));_0x5cdf76['recordingURL']=util[_0x35e8('0xb')](_0x35e8('0x45'),_0x4d02e4[_0x35e8('0x42')],_0x5cdf76[_0x35e8('0x46')],md5(_0x5cdf76['uniqueid']));}else{_0x5cdf76[_0x35e8('0x47')]='';}headers[_0x35e8('0x48')]=getAuth(_0x4d02e4);return getUser(_0x4d02e4,_0x29ac02['email'])[_0x35e8('0x12')](function(_0x924343){_0x4edd3a=_0x924343;logger[_0x35e8('0xa')](_0x35e8('0x49'),_0x4edd3a['id']);return getEndUser(_0x4d02e4,_0x5cdf76[_0x35e8('0x4a')],_0x5cdf76['calleridnum']);})[_0x35e8('0x12')](function(_0x30a72a){_0x3206fe=_0x30a72a;logger[_0x35e8('0xa')](_0x35e8('0x4b'),_0x3206fe['id']);return getTicket(_0x4d02e4,_0x4edd3a,_0x3206fe,_0x464a38,_0x5cdf76);})[_0x35e8('0x12')](function(_0x53ccc6){if(_0x53ccc6){logger[_0x35e8('0xa')](_0x35e8('0x4c'),_0x53ccc6['id']);switch(_0x4d02e4['type']){case'integrationTab':logger['info']('[QUEUE]',_0x35e8('0x4d'));return request({'uri':util[_0x35e8('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x4d02e4[_0x35e8('0x17')],_0x4edd3a['id'],_0x53ccc6['id']),'method':_0x35e8('0x4e')});case _0x35e8('0x4f'):logger[_0x35e8('0xa')](_0x35e8('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x35e8('0xb')](_0x35e8('0x51'),_0x29ac02[_0x35e8('0x40')]),_0x35e8('0x52'),{'uri':util[_0x35e8('0xb')]('%s/agent/tickets/%s',_0x4d02e4['remoteUri'][_0x35e8('0x53')](_0x35e8('0x54'),''),_0x53ccc6['id'])});break;default:logger[_0x35e8('0x55')](_0x35e8('0x50'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x21ef7b){logger[_0x35e8('0x55')](_0x35e8('0x56'),util[_0x35e8('0x57')](_0x21ef7b,{'showHidden':!![],'depth':null}));});};exports[_0x35e8('0x58')]=function(_0x5cf78e,_0x36ac69,_0x446b6f,_0x214f46,_0x110675,_0x5e95d7,_0xac0a75){var _0x472f78,_0x529d49;_0x5e95d7[_0x35e8('0x17')]=intUtil[_0x35e8('0x41')](_0x5e95d7[_0x35e8('0x17')]);_0x5e95d7['serverUrl']=intUtil[_0x35e8('0x41')](_0x5e95d7[_0x35e8('0x42')]);if(_0xac0a75&&_0xac0a75[_0x35e8('0x59')]&&_0xac0a75[_0x35e8('0x59')]!=='none'){logger[_0x35e8('0xa')]('[OUTBOUND]',_0x35e8('0x44'));_0x36ac69['recordingURL']=util['format'](_0x35e8('0x45'),_0x5e95d7[_0x35e8('0x42')],_0x36ac69[_0x35e8('0x46')],md5(_0x36ac69[_0x35e8('0x46')]));}headers[_0x35e8('0x48')]=getAuth(_0x5e95d7);return getUser(_0x5e95d7,_0x214f46[_0x35e8('0x5a')])[_0x35e8('0x12')](function(_0x1edaea){_0x472f78=_0x1edaea;logger[_0x35e8('0xa')](_0x35e8('0x49'),_0x472f78['id']);return getEndUser(_0x5e95d7,_0x36ac69[_0x35e8('0x5b')],_0x36ac69[_0x35e8('0x5c')]);})['then'](function(_0x2fba2e){_0x529d49=_0x2fba2e;logger[_0x35e8('0xa')](_0x35e8('0x4b'),_0x529d49['id']);return getTicket(_0x5e95d7,_0x472f78,_0x529d49,_0x446b6f,_0x36ac69);})['then'](function(_0xfdc248){if(_0xfdc248){logger[_0x35e8('0xa')]('The\x20Ticket\x20ID\x20is:',_0xfdc248['id']);switch(_0x5e95d7[_0x35e8('0x35')]){case _0x35e8('0x5d'):logger[_0x35e8('0xa')](_0x35e8('0x5e'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x35e8('0xb')](_0x35e8('0x5f'),_0x5e95d7[_0x35e8('0x17')],_0x472f78['id'],_0xfdc248['id']),'method':_0x35e8('0x4e')});case _0x35e8('0x4f'):logger[_0x35e8('0xa')](_0x35e8('0x5e'),_0x35e8('0x60'));emit(util[_0x35e8('0xb')](_0x35e8('0x51'),_0x214f46[_0x35e8('0x40')]),'trigger:browser:url',{'uri':util[_0x35e8('0xb')]('%s/agent/tickets/%s',_0x5e95d7[_0x35e8('0x17')]['replace'](_0x35e8('0x54'),''),_0xfdc248['id'])});break;default:logger[_0x35e8('0x55')]('[OUTBOUND]',_0x35e8('0x61'));}}})[_0x35e8('0x62')](function(_0x546410){logger[_0x35e8('0x55')](_0x35e8('0x63'),util[_0x35e8('0x57')](_0x546410,{'showHidden':!![],'depth':null}));});};exports[_0x35e8('0x64')]=function(_0x572210,_0x326b61,_0x2fabc3,_0x3aa8be,_0xf216c1,_0xadfd04){var _0x544adf,_0x2ccb50;_0xadfd04['remoteUri']=intUtil[_0x35e8('0x41')](_0xadfd04['remoteUri']);_0xadfd04[_0x35e8('0x42')]=intUtil[_0x35e8('0x41')](_0xadfd04[_0x35e8('0x42')]);if(_0xf216c1&&_0xf216c1[_0x35e8('0x43')]){logger[_0x35e8('0xa')]('['+_0x326b61[_0x35e8('0x65')][_0x35e8('0x66')]()+']',_0x35e8('0x44'));_0x326b61['recordingURL']=util['format'](_0x35e8('0x45'),_0xadfd04[_0x35e8('0x42')],_0x326b61[_0x35e8('0x46')],md5(_0x326b61[_0x35e8('0x46')]));}else{_0x326b61[_0x35e8('0x47')]='';}headers['Authorization']=getAuth(_0xadfd04);return getUser(_0xadfd04)[_0x35e8('0x12')](function(_0x2ec50b){_0x544adf=_0x2ec50b;logger['info']('The\x20User\x20ID\x20is:',_0x544adf['id']);return getEndUser(_0xadfd04,_0x326b61[_0x35e8('0x4a')],_0x326b61['calleridnum']);})[_0x35e8('0x12')](function(_0x4ffee0){_0x2ccb50=_0x4ffee0;logger['info'](_0x35e8('0x4b'),_0x2ccb50['id']);return getTicket(_0xadfd04,_0x544adf,_0x2ccb50,_0x2fabc3,_0x326b61);})[_0x35e8('0x12')](function(_0xa16090){if(_0xa16090){logger[_0x35e8('0xa')](_0x35e8('0x4c'),_0xa16090['id']);}})[_0x35e8('0x62')](function(_0x2673f7){logger['error']('['+_0x326b61['lastevent'][_0x35e8('0x66')]()+']'+_0x35e8('0x67'),util[_0x35e8('0x57')](_0x2673f7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc522=['filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','debug','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','custom_fields','push','variable','idField','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','unmanaged','lastevent','toUpperCase','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','format','type:user\x20role:end-user\x20phone:%s','length'];(function(_0x3b9909,_0x39cbd5){var _0x4419cd=function(_0x4458bf){while(--_0x4458bf){_0x3b9909['push'](_0x3b9909['shift']());}};_0x4419cd(++_0x39cbd5);}(_0xc522,0x12a));var _0x2c52=function(_0x3b7a85,_0x3d87ca){_0x3b7a85=_0x3b7a85-0x0;var _0xaf8140=_0xc522[_0x3b7a85];return _0xaf8140;};'use strict';var _=require(_0x2c52('0x0'));var rp=require(_0x2c52('0x1'));var md5=require(_0x2c52('0x2'));var util=require(_0x2c52('0x3'));var Redis=require('ioredis');var intUtil=require(_0x2c52('0x4'));var config=require(_0x2c52('0x5'));var logger=require(_0x2c52('0x6'))('zendesk');config[_0x2c52('0x7')]=_[_0x2c52('0x8')](config['redis'],{'host':_0x2c52('0x9'),'port':0x18eb});var io=require(_0x2c52('0xa'))(new Redis(config['redis']));function emit(_0x3a4d7e,_0x4e675e,_0x27f484){io['to'](_0x3a4d7e)['emit'](_0x4e675e,_0x27f484);}var headers={'Content-Type':_0x2c52('0xb'),'Accept':_0x2c52('0xb')};function getTicket(_0x5e8404,_0xff4af9,_0x325c7e,_0x2c0fcd,_0x13411d){logger[_0x2c52('0xc')](_0x2c52('0xd'));return request({'uri':util['format'](_0x2c52('0xe'),_0x5e8404[_0x2c52('0xf')]),'method':_0x2c52('0x10'),'body':{'ticket':_[_0x2c52('0x11')]({'requester_id':_0x325c7e['id'],'submitter_id':_0xff4af9?_0xff4af9['id']:undefined,'assignee_id':_0xff4af9?_0xff4af9['id']:undefined,'tags':getTags(_0x2c0fcd[_0x2c52('0x12')],_0x2c52('0x13')),'subject':intUtil[_0x2c52('0x14')](_0x2c0fcd['Subjects'],_0x13411d,'\x20'),'description':intUtil['getString'](_0x2c0fcd[_0x2c52('0x15')],_0x13411d,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2c52('0x14')](_0x2c0fcd[_0x2c52('0x15')],_0x13411d,'\x0a')}},getCustomFields(_0x2c0fcd['Fields'],_0x13411d))}})[_0x2c52('0x16')](function(_0x1b75dd){logger[_0x2c52('0xc')](_0x2c52('0x17'));return _0x1b75dd[_0x2c52('0x18')];});}function getUser(_0x498e4e,_0x3c4379){if(intUtil[_0x2c52('0x19')](_0x3c4379)){logger[_0x2c52('0xc')](_0x2c52('0x1a'),_0x3c4379);return request({'uri':util['format'](_0x2c52('0x1b'),_0x498e4e['remoteUri']),'qs':{'query':util['format'](_0x2c52('0x1c'),_0x3c4379)}})[_0x2c52('0x16')](function(_0x5f3db9){if(_0x5f3db9[_0x2c52('0x1d')]){logger[_0x2c52('0xc')](_0x2c52('0x1e'));return _[_0x2c52('0x1f')](_0x5f3db9[_0x2c52('0x20')],{'email':_0x3c4379,'role':_0x2c52('0x21')});}else{logger[_0x2c52('0xc')](_0x2c52('0x22'));return request({'uri':util['format'](_0x2c52('0x23'),_0x498e4e[_0x2c52('0xf')])})['then'](function(_0x2a353f){logger['info'](_0x2c52('0x24'));return _0x2a353f[_0x2c52('0x25')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x498e4e[_0x2c52('0xf')])})[_0x2c52('0x16')](function(_0x5c44e9){logger['info'](_0x2c52('0x24'));return _0x5c44e9[_0x2c52('0x25')];});}}function getEndUser(_0x586471,_0x39c312,_0x577630){logger[_0x2c52('0xc')]('Searching\x20enduser\x20with\x20phone',_0x577630);return request({'uri':util[_0x2c52('0x26')](_0x2c52('0x1b'),_0x586471[_0x2c52('0xf')]),'qs':{'query':util[_0x2c52('0x26')](_0x2c52('0x27'),_0x577630)}})[_0x2c52('0x16')](function(_0x500f08){var _0x235977;if(_0x500f08['results'][_0x2c52('0x28')]){_0x500f08[_0x2c52('0x20')]=_[_0x2c52('0x29')](_0x500f08['results'],{'suspended':![],'role':_0x2c52('0x2a')});if(_0x500f08[_0x2c52('0x20')][_0x2c52('0x28')]){_0x235977=_[_0x2c52('0x2b')](_0x500f08['results']);}}if(_0x235977){logger['info']('Enduser\x20found!');return _0x235977;}else{logger['info'](_0x2c52('0x2c'));return request({'uri':util['format'](_0x2c52('0x2d'),_0x586471[_0x2c52('0xf')]),'method':_0x2c52('0x10'),'body':{'user':{'role':_0x2c52('0x2a'),'name':util['format'](_0x2c52('0x2e'),_0x39c312||_0x577630),'phone':_0x577630}}})[_0x2c52('0x16')](function(_0x379c3d){logger[_0x2c52('0xc')](_0x2c52('0x2f'));return _0x379c3d[_0x2c52('0x25')];});}});}function getAuth(_0x173246){var _0x208e1d;if(_0x173246[_0x2c52('0x30')]===_0x2c52('0x31')){_0x208e1d=util[_0x2c52('0x26')](_0x2c52('0x32'),_0x173246['username'],_0x173246[_0x2c52('0x31')]);}else if(_0x173246[_0x2c52('0x30')]===_0x2c52('0x33')){_0x208e1d=util[_0x2c52('0x26')](_0x2c52('0x34'),_0x173246[_0x2c52('0x35')],_0x173246[_0x2c52('0x33')]);}return util[_0x2c52('0x26')](_0x2c52('0x36'),new Buffer(_0x208e1d)[_0x2c52('0x37')]('base64'));}function request(_0x5d4c6d){logger[_0x2c52('0x38')]('[HTTP]',JSON['stringify'](_0x5d4c6d));return rp(_['defaults'](_0x5d4c6d,{'method':_0x2c52('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x2c2aa5,_0x340e98){var _0x42b6e7=[];if(_0x2c2aa5&&_0x2c2aa5[_0x2c52('0x28')]>0x0){_0x42b6e7=_[_0x2c52('0x3a')](_0x2c2aa5,_0x340e98);}return _0x42b6e7;}function getCustomFields(_0x5825eb,_0x22cd9f){var _0xdda480=[];var _0x820ab5={'custom_fields':[]};if(_0x5825eb[_0x2c52('0x28')]>0x0){_['forEach'](_0x5825eb,function(_0x3377c2){if(_[_0x2c52('0x3b')]([_0x2c52('0x3c'),_0x2c52('0x3d')],_0x3377c2[_0x2c52('0x3e')])&&_0x3377c2[_0x2c52('0x3f')]&&!_0x3377c2[_0x2c52('0x40')]){_0x820ab5[_0x3377c2[_0x2c52('0x3f')][_0x2c52('0x41')]()]=_0x3377c2[_0x2c52('0x42')][_0x2c52('0x37')]();}else if(_['includes'](['string','picklist'],_0x3377c2[_0x2c52('0x3e')])&&_0x3377c2['idField']&&_0x3377c2[_0x2c52('0x40')]){_0x820ab5[_0x2c52('0x43')][_0x2c52('0x44')]({'id':_0x3377c2['idField'],'value':_0x3377c2[_0x2c52('0x42')][_0x2c52('0x37')]()});}else if(_0x3377c2[_0x2c52('0x3e')]===_0x2c52('0x45')&&_0x3377c2['variableName']&&_0x3377c2[_0x2c52('0x46')]&&_0x3377c2[_0x2c52('0x40')]){_0x22cd9f[_0x3377c2[_0x2c52('0x47')]]&&_0x820ab5[_0x2c52('0x43')][_0x2c52('0x44')]({'id':_0x3377c2[_0x2c52('0x46')],'value':_0x22cd9f[_0x3377c2[_0x2c52('0x47')]][_0x2c52('0x37')]()});}else if(_0x3377c2[_0x2c52('0x3e')]==='customVariable'&&_0x3377c2['Variable']&&_0x3377c2[_0x2c52('0x48')][_0x2c52('0x13')]&&_0x3377c2[_0x2c52('0x46')]&&_0x3377c2[_0x2c52('0x40')]){_0x22cd9f[_0x3377c2[_0x2c52('0x48')]['name'][_0x2c52('0x41')]()]&&_0x820ab5['custom_fields'][_0x2c52('0x44')]({'id':_0x3377c2[_0x2c52('0x46')],'value':_0x22cd9f[_0x3377c2[_0x2c52('0x48')][_0x2c52('0x13')][_0x2c52('0x41')]()][_0x2c52('0x37')]()});}});}return _0x820ab5;}exports[_0x2c52('0x49')]=function(_0x1d40cc,_0x1b6599,_0x5ea1e6,_0x1e8008,_0x3aa8f4,_0x1dca65){var _0x1c590c,_0xc0b3d6;_0x1dca65[_0x2c52('0xf')]=intUtil[_0x2c52('0x4a')](_0x1dca65[_0x2c52('0xf')]);_0x1dca65[_0x2c52('0x4b')]=intUtil['stripTrailingSlash'](_0x1dca65['serverUrl']);if(_0x3aa8f4&&_0x3aa8f4[_0x2c52('0x4c')]){logger[_0x2c52('0xc')](_0x2c52('0x4d'),_0x2c52('0x4e'));_0x1b6599[_0x2c52('0x4f')]=util['format'](_0x2c52('0x50'),_0x1dca65[_0x2c52('0x4b')],_0x1b6599[_0x2c52('0x51')],md5(_0x1b6599[_0x2c52('0x51')]));}else{_0x1b6599[_0x2c52('0x4f')]='';}headers[_0x2c52('0x52')]=getAuth(_0x1dca65);return getUser(_0x1dca65,_0x1e8008[_0x2c52('0x53')])[_0x2c52('0x16')](function(_0x4ca0c7){_0x1c590c=_0x4ca0c7;logger['info'](_0x2c52('0x54'),_0x1c590c['id']);return getEndUser(_0x1dca65,_0x1b6599[_0x2c52('0x55')],_0x1b6599[_0x2c52('0x56')]);})[_0x2c52('0x16')](function(_0x43a82d){_0xc0b3d6=_0x43a82d;logger['info'](_0x2c52('0x57'),_0xc0b3d6['id']);return getTicket(_0x1dca65,_0x1c590c,_0xc0b3d6,_0x5ea1e6,_0x1b6599);})[_0x2c52('0x16')](function(_0x30d377){if(_0x30d377){logger[_0x2c52('0xc')]('The\x20Ticket\x20ID\x20is:',_0x30d377['id']);switch(_0x1dca65[_0x2c52('0x3e')]){case _0x2c52('0x58'):logger['info']('[QUEUE]',_0x2c52('0x59'));return request({'uri':util[_0x2c52('0x26')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1dca65[_0x2c52('0xf')],_0x1c590c['id'],_0x30d377['id']),'method':_0x2c52('0x10')});case _0x2c52('0x5a'):logger[_0x2c52('0xc')](_0x2c52('0x4d'),_0x2c52('0x5b'));emit(util[_0x2c52('0x26')]('user:%s',_0x1e8008[_0x2c52('0x13')]),'trigger:browser:url',{'uri':util[_0x2c52('0x26')](_0x2c52('0x5c'),_0x1dca65['remoteUri'][_0x2c52('0x5d')](_0x2c52('0x5e'),''),_0x30d377['id'])});break;default:logger[_0x2c52('0x5f')](_0x2c52('0x4d'),_0x2c52('0x60'));}}})['catch'](function(_0x376c05){logger[_0x2c52('0x5f')](_0x2c52('0x61'),util[_0x2c52('0x62')](_0x376c05,{'showHidden':!![],'depth':null}));});};exports[_0x2c52('0x63')]=function(_0x3bb64f,_0x4f5add,_0x3b8710,_0x665a4c,_0x5d9500,_0x3fc001,_0x5c2b1d){var _0x19b221,_0x15d9e5;_0x3fc001['remoteUri']=intUtil[_0x2c52('0x4a')](_0x3fc001['remoteUri']);_0x3fc001[_0x2c52('0x4b')]=intUtil['stripTrailingSlash'](_0x3fc001['serverUrl']);if(_0x5c2b1d&&_0x5c2b1d[_0x2c52('0x64')]&&_0x5c2b1d[_0x2c52('0x64')]!==_0x2c52('0x65')){logger['info'](_0x2c52('0x66'),_0x2c52('0x4e'));_0x4f5add['recordingURL']=util[_0x2c52('0x26')](_0x2c52('0x50'),_0x3fc001[_0x2c52('0x4b')],_0x4f5add[_0x2c52('0x51')],md5(_0x4f5add[_0x2c52('0x51')]));}headers['Authorization']=getAuth(_0x3fc001);return getUser(_0x3fc001,_0x665a4c[_0x2c52('0x53')])[_0x2c52('0x16')](function(_0x57de88){_0x19b221=_0x57de88;logger[_0x2c52('0xc')](_0x2c52('0x54'),_0x19b221['id']);return getEndUser(_0x3fc001,_0x4f5add[_0x2c52('0x67')],_0x4f5add[_0x2c52('0x68')]);})['then'](function(_0x3e3ed6){_0x15d9e5=_0x3e3ed6;logger[_0x2c52('0xc')]('The\x20Enduser\x20ID\x20is:',_0x15d9e5['id']);return getTicket(_0x3fc001,_0x19b221,_0x15d9e5,_0x3b8710,_0x4f5add);})[_0x2c52('0x16')](function(_0x1aa62f){if(_0x1aa62f){logger[_0x2c52('0xc')](_0x2c52('0x69'),_0x1aa62f['id']);switch(_0x3fc001[_0x2c52('0x3e')]){case _0x2c52('0x58'):logger[_0x2c52('0xc')](_0x2c52('0x66'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x2c52('0x26')](_0x2c52('0x6a'),_0x3fc001['remoteUri'],_0x19b221['id'],_0x1aa62f['id']),'method':_0x2c52('0x10')});case _0x2c52('0x5a'):logger[_0x2c52('0xc')](_0x2c52('0x66'),_0x2c52('0x5b'));emit(util[_0x2c52('0x26')](_0x2c52('0x6b'),_0x665a4c['name']),'trigger:browser:url',{'uri':util[_0x2c52('0x26')](_0x2c52('0x5c'),_0x3fc001[_0x2c52('0xf')][_0x2c52('0x5d')](_0x2c52('0x5e'),''),_0x1aa62f['id'])});break;default:logger[_0x2c52('0x5f')]('[OUTBOUND]',_0x2c52('0x60'));}}})['catch'](function(_0x4852d9){logger[_0x2c52('0x5f')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x2c52('0x62')](_0x4852d9,{'showHidden':!![],'depth':null}));});};exports[_0x2c52('0x6c')]=function(_0x219a25,_0x1eb9dd,_0x6b653d,_0x56b010,_0xafbacd,_0x453677){var _0x34a869,_0xe109b1;_0x453677[_0x2c52('0xf')]=intUtil[_0x2c52('0x4a')](_0x453677[_0x2c52('0xf')]);_0x453677[_0x2c52('0x4b')]=intUtil[_0x2c52('0x4a')](_0x453677[_0x2c52('0x4b')]);if(_0xafbacd&&_0xafbacd[_0x2c52('0x4c')]){logger[_0x2c52('0xc')]('['+_0x1eb9dd[_0x2c52('0x6d')][_0x2c52('0x6e')]()+']',_0x2c52('0x4e'));_0x1eb9dd['recordingURL']=util[_0x2c52('0x26')](_0x2c52('0x50'),_0x453677[_0x2c52('0x4b')],_0x1eb9dd[_0x2c52('0x51')],md5(_0x1eb9dd['uniqueid']));}else{_0x1eb9dd[_0x2c52('0x4f')]='';}headers[_0x2c52('0x52')]=getAuth(_0x453677);return getUser(_0x453677)[_0x2c52('0x16')](function(_0x1438af){_0x34a869=_0x1438af;logger[_0x2c52('0xc')](_0x2c52('0x54'),_0x34a869['id']);return getEndUser(_0x453677,_0x1eb9dd[_0x2c52('0x55')],_0x1eb9dd[_0x2c52('0x56')]);})[_0x2c52('0x16')](function(_0x41a1ab){_0xe109b1=_0x41a1ab;logger['info'](_0x2c52('0x57'),_0xe109b1['id']);return getTicket(_0x453677,_0x34a869,_0xe109b1,_0x6b653d,_0x1eb9dd);})[_0x2c52('0x16')](function(_0x2b0e9d){if(_0x2b0e9d){logger[_0x2c52('0xc')](_0x2c52('0x69'),_0x2b0e9d['id']);}})[_0x2c52('0x6f')](function(_0x3a154c){logger['error']('['+_0x1eb9dd['lastevent'][_0x2c52('0x6e')]()+']'+_0x2c52('0x70'),util[_0x2c52('0x62')](_0x3a154c,{'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 72894a1..d7a255d 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 _0xd909=['defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','string','picklist','type','idField','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','POST','clientId','refresh_token','add','seconds','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','then','isArrayLikeObject','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','moduleCreate','role','first_name','code','SUCCESS','details','startCase','The\x20failing\x20result\x20is','Error:\x20','catch','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','nothing','lead','Leads','Creating\x20new\x20call...','administrator','last_name','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','Call_Result','Called','connect','Answered','rejected','Rejected','abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','merge','/crm/v2/Calls','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','Recording\x20is\x20enabled!','Inbound','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis'];(function(_0x5174be,_0x1f6351){var _0x466369=function(_0x52f728){while(--_0x52f728){_0x5174be['push'](_0x5174be['shift']());}};_0x466369(++_0x1f6351);}(_0xd909,0x1c1));var _0x9d90=function(_0x2397fe,_0x4ab950){_0x2397fe=_0x2397fe-0x0;var _0x5deeb8=_0xd909[_0x2397fe];return _0x5deeb8;};'use strict';var _=require('lodash');var rp=require(_0x9d90('0x0'));var md5=require(_0x9d90('0x1'));var util=require(_0x9d90('0x2'));var intUtil=require(_0x9d90('0x3'));var moment=require('moment');var Redis=require(_0x9d90('0x4'));var BPromise=require(_0x9d90('0x5'));var config=require(_0x9d90('0x6'));var logger=require(_0x9d90('0x7'))(_0x9d90('0x8'));config[_0x9d90('0x9')]=_[_0x9d90('0xa')](config['redis'],{'host':_0x9d90('0xb'),'port':0x18eb});var io=require(_0x9d90('0xc'))(new Redis(config[_0x9d90('0x9')]));function emit(_0x19d78a,_0x3a815b,_0x1a2b7b){io['to'](_0x19d78a)[_0x9d90('0xd')](_0x3a815b,_0x1a2b7b);}function request(_0x115e66){logger[_0x9d90('0xe')](_0x9d90('0xf'),JSON[_0x9d90('0x10')](_0x115e66));return rp(_0x115e66);}function getCustomFields(_0x5765ef,_0x3d60f4){var _0x1bf788={};if(_0x5765ef['length']>0x0){_[_0x9d90('0x11')](_0x5765ef,function(_0x5327f4){if(_['includes']([_0x9d90('0x12'),_0x9d90('0x13')],_0x5327f4[_0x9d90('0x14')])&&_0x5327f4[_0x9d90('0x15')]){_0x1bf788[_0x5327f4[_0x9d90('0x15')]]=_0x5327f4['content']['toString']();}else if(_0x5327f4[_0x9d90('0x14')]===_0x9d90('0x16')&&_0x5327f4[_0x9d90('0x17')]&&_0x5327f4[_0x9d90('0x15')]&&_0x3d60f4[_0x5327f4[_0x9d90('0x17')]]){_0x1bf788[_0x5327f4['idField']]=_0x3d60f4[_0x5327f4[_0x9d90('0x17')]][_0x9d90('0x18')]();}else if(_0x5327f4[_0x9d90('0x14')]===_0x9d90('0x19')&&_0x5327f4[_0x9d90('0x1a')]&&_0x5327f4[_0x9d90('0x1a')][_0x9d90('0x1b')]&&_0x5327f4[_0x9d90('0x15')]&&_0x3d60f4[_0x5327f4[_0x9d90('0x1a')][_0x9d90('0x1b')][_0x9d90('0x1c')]()]){_0x1bf788[_0x5327f4[_0x9d90('0x15')]]=_0x3d60f4[_0x5327f4[_0x9d90('0x1a')][_0x9d90('0x1b')][_0x9d90('0x1c')]()][_0x9d90('0x18')]();}});}return _0x1bf788;}function getName(_0x278cc0){if(_0x278cc0[_0x9d90('0x1d')]('\x20')>0x0){var _0xa35c25=_0x278cc0[_0x9d90('0x1e')](/ (.+)/);if(_0xa35c25[0x1]){return _0xa35c25;}}return[_0x278cc0,_0x278cc0];}var accountsTokens={};function getAccessToken(_0x5e5916){return new Promise(function(_0x3d4be2,_0xaf64d2){if(!_[_0x9d90('0x1f')](accountsTokens[_0x5e5916['id']])&&!_[_0x9d90('0x1f')](accountsTokens[_0x5e5916['id']][_0x9d90('0x20')])){if(moment()[_0x9d90('0x21')](accountsTokens[_0x5e5916['id']][_0x9d90('0x22')])){_0x3d4be2(accountsTokens[_0x5e5916['id']][_0x9d90('0x20')]);}}var _0x5a7e34;switch(_0x5e5916['zone']){case'US':_0x5a7e34=_0x9d90('0x23');break;case'AU':_0x5a7e34='https://accounts.zoho.com.au';break;case'EU':_0x5a7e34='https://accounts.zoho.eu';break;case'IN':_0x5a7e34=_0x9d90('0x24');break;case'CN':_0x5a7e34='https://accounts.zoho.com.cn';break;default:_0x5a7e34=_0x9d90('0x25');break;}var _0x245327={'method':_0x9d90('0x26'),'uri':_0x5a7e34+'/oauth/v2/token','qs':{'refresh_token':_0x5e5916['refreshToken'],'client_id':_0x5e5916[_0x9d90('0x27')],'client_secret':_0x5e5916['clientSecret'],'grant_type':_0x9d90('0x28')},'json':!![]};return rp(_0x245327)['then'](function(_0x3f5391){accountsTokens[_0x5e5916['id']]={'access_token':_0x3f5391[_0x9d90('0x20')],'expires_in':moment()[_0x9d90('0x29')](_0x3f5391[_0x9d90('0x22')],_0x9d90('0x2a'))};_0x3d4be2(_0x3f5391['access_token']);})['catch'](function(_0x2142ca){logger['error']('Failing\x20creating\x20the\x20access_token',_0x2142ca[_0x9d90('0x2b')]);_0xaf64d2(_0x2142ca);});});}function getUser(_0x573d51,_0xed4cdf,_0x88b3af,_0x26e682){logger[_0x9d90('0x2c')](_0x9d90('0x2d'));return request({'method':'GET','uri':util['format'](_0x9d90('0x2e'),_0xed4cdf),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x9d90('0x2f')+_0x573d51},'json':!![]})[_0x9d90('0x30')](function(_0x356908){if(_0x356908['users']){var _0x3a1bdf=-0x1;if(_[_0x9d90('0x31')](_0x356908[_0x9d90('0x32')])){if(!_[_0x9d90('0x1f')](_0x26e682)){_0x3a1bdf=_[_0x9d90('0x33')](_0x356908['users'],function(_0x426f06){return _0x426f06['email']===_0x26e682;});}if(_0x3a1bdf>=0x0){logger[_0x9d90('0x2c')](_0x9d90('0x34'));}else{logger[_0x9d90('0x2c')](_0x9d90('0x35'));_0x3a1bdf=_[_0x9d90('0x33')](_0x356908[_0x9d90('0x32')],function(_0x608981){return _0x608981[_0x9d90('0x36')][_0x9d90('0x1b')]===_0x9d90('0x37');});}return _0x356908[_0x9d90('0x32')][_0x3a1bdf];}else{if(_0x356908[_0x9d90('0x38')][_0x9d90('0x36')][_0x9d90('0x1b')]===_0x9d90('0x37')){logger[_0x9d90('0x2c')](_0x9d90('0x35'));user=_0x356908[_0x9d90('0x38')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x9d90('0x10')](_0x356908));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x9d90('0x10')](_0x356908));}}}else{logger[_0x9d90('0x39')]('The\x20failing\x20result\x20is',JSON[_0x9d90('0x10')](_0x356908));throw new Error(_0x9d90('0x3a')+JSON[_0x9d90('0x10')](_0x356908));}})['catch'](function(_0x43f6ae){console[_0x9d90('0x39')](_0x43f6ae);});}function getZohoUser(_0x15ff53,_0x18ae76){return new BPromise(function(_0x5cc574,_0x16a717){request(_0x15ff53)[_0x9d90('0x30')](function(_0x38159a){var _0x59282e=null;if(_0x38159a){_0x59282e=_0x38159a[_0x9d90('0x3b')][0x0];_0x59282e[_0x9d90('0x3c')]=_0x18ae76;}_0x5cc574(_0x59282e);})['catch'](function(_0x4d9dff){_0x16a717(_0x4d9dff);});});}function createEndUser(_0x4fea09,_0xb5754b,_0x2b2b11,_0x371538,_0x95d49a,_0x24c4c5){var _0x2b2b11=getName(_0x2b2b11);return request({'method':_0x9d90('0x26'),'uri':'https://www.zohoapis.'+_0xb5754b+_0x9d90('0x3d')+_['startCase'](_0x24c4c5[_0x9d90('0x3e')])+'s','body':{'data':[{'Last_Name':_0x2b2b11[0x1],'First_Name':_0x2b2b11[0x0],'Phone':_0x371538,'Owner':{'name':!_[_0x9d90('0x1f')](_0x95d49a[_0x9d90('0x3f')][_0x9d90('0x1b')])?_0x95d49a[_0x9d90('0x3f')][_0x9d90('0x1b')]:!_['isNil'](_0x95d49a['first_name'])?_0x95d49a[_0x9d90('0x40')]+'\x20'+_0x95d49a['last_name']:_0x95d49a['last_name'],'id':_0x95d49a['id']}}]},'headers':{'Authorization':_0x9d90('0x2f')+_0x4fea09},'json':!![]})['then'](function(_0x2b5558){if(_0x2b5558&&_0x2b5558[_0x9d90('0x3b')][0x0][_0x9d90('0x41')]===_0x9d90('0x42')){var _0x44a3fd=_0x2b5558[_0x9d90('0x3b')][0x0][_0x9d90('0x43')];_0x44a3fd[_0x9d90('0x3c')]=_[_0x9d90('0x44')](_0x24c4c5['moduleCreate'])+'s';return _0x44a3fd;}logger['error'](_0x9d90('0x45'),JSON[_0x9d90('0x10')](data));throw new Error(_0x9d90('0x46')+JSON['stringify'](data));})[_0x9d90('0x47')](function(_0x102e29){console[_0x9d90('0x48')](_0x9d90('0x49'),_0x102e29);});}function getEndUser(_0xcb8d71,_0x6c091e,_0x41160e,_0x5404c9,_0x27e9c8,_0x5430d3,_0x2a7778){var _0x2dc8fc={'method':'GET','uri':'','headers':{'Authorization':_0x9d90('0x2f')+_0xcb8d71},'json':!![]};switch(_0x2a7778[_0x9d90('0x4a')]){case _0x9d90('0x4b'):_0x2dc8fc[_0x9d90('0x4c')]=_0x9d90('0x4d')+_0x6c091e+_0x9d90('0x4e')+_0x27e9c8+'))';return getZohoUser(_0x2dc8fc,_0x9d90('0x4f'))[_0x9d90('0x30')](function(_0x32aad5){if(_0x32aad5)return _0x32aad5;_0x2dc8fc[_0x9d90('0x4c')]='https://www.zohoapis.'+_0x6c091e+_0x9d90('0x50')+_0x27e9c8+'))';return getZohoUser(_0x2dc8fc,'Leads')['then'](function(_0x580b10){if(_0x580b10)return _0x580b10;if(_0x2a7778[_0x9d90('0x3e')]!='nothing'){return createEndUser(_0xcb8d71,_0x6c091e,_0x5404c9,_0x27e9c8,_0x5430d3,_0x2a7778);}else{return{};}});});break;case _0x9d90('0x51'):_0x2dc8fc[_0x9d90('0x4c')]='https://www.zohoapis.'+_0x6c091e+_0x9d90('0x4e')+_0x27e9c8+'))';return getZohoUser(_0x2dc8fc,_0x9d90('0x4f'))['then'](function(_0x16a405){if(_0x16a405)return _0x16a405;if(_0x2a7778['moduleCreate']!=_0x9d90('0x52')){return createEndUser(_0xcb8d71,_0x6c091e,_0x5404c9,_0x27e9c8,_0x5430d3,_0x2a7778);}else{return{};}});break;case _0x9d90('0x53'):_0x2dc8fc[_0x9d90('0x4c')]=_0x9d90('0x4d')+_0x6c091e+_0x9d90('0x50')+_0x27e9c8+'))';return getZohoUser(_0x2dc8fc,_0x9d90('0x54'))[_0x9d90('0x30')](function(_0x53c5b1){if(_0x53c5b1)return _0x53c5b1;if(_0x2a7778[_0x9d90('0x3e')]!='nothing'){return createEndUser(_0xcb8d71,_0x6c091e,_0x5404c9,_0x27e9c8,_0x5430d3,_0x2a7778);}else{return{};}});break;}}function getCall(_0x18f832,_0xc88be8,_0x48b6ba,_0xd2e6d9,_0x27919b,_0x450d3c,_0x648b5a,_0x4e47f3){logger[_0x9d90('0x2c')](_0x9d90('0x55'));var _0x17f326={};_0x17f326['Owner']={'name':!_[_0x9d90('0x1f')](_0xd2e6d9[_0x9d90('0x3f')][_0x9d90('0x1b')])&&!_[_0x9d90('0x1f')](_0xd2e6d9[_0x9d90('0x36')][_0x9d90('0x1b')])&&_0xd2e6d9[_0x9d90('0x36')][_0x9d90('0x1b')]===_0x9d90('0x56')?_0xd2e6d9[_0x9d90('0x3f')][_0x9d90('0x1b')]:!_[_0x9d90('0x1f')](_0xd2e6d9[_0x9d90('0x40')])?_0xd2e6d9['first_name']+'\x20'+_0xd2e6d9[_0x9d90('0x57')]:_0xd2e6d9[_0x9d90('0x57')],'id':_0xd2e6d9['id']};_0x17f326[_0x9d90('0x58')]=intUtil[_0x9d90('0x59')](_0x450d3c[_0x9d90('0x5a')],_0x648b5a,'\x20');_0x17f326[_0x9d90('0x5b')]=intUtil[_0x9d90('0x59')](_0x450d3c['Descriptions'],_0x648b5a,'\x0a');if(_0x27919b[_0x9d90('0x3c')]==='Contacts'){_0x17f326[_0x9d90('0x5c')]={'name':!_[_0x9d90('0x1f')](_0x27919b[_0x9d90('0x5d')])?_0x27919b[_0x9d90('0x5d')]:!_['isNil'](_0x27919b[_0x9d90('0x5e')])?_0x27919b['First_Name']+'\x20'+_0x27919b[_0x9d90('0x5f')]:_0x27919b[_0x9d90('0x5f')],'id':_0x27919b['id']};}if(_0x27919b[_0x9d90('0x3c')]===_0x9d90('0x54')){_0x17f326[_0x9d90('0x60')]={'name':!_[_0x9d90('0x1f')](_0x27919b[_0x9d90('0x5d')])?_0x27919b[_0x9d90('0x5d')]:!_['isNil'](_0x27919b[_0x9d90('0x5e')])?_0x27919b['First_Name']+'\x20'+_0x27919b[_0x9d90('0x5f')]:_0x27919b[_0x9d90('0x5f')],'id':_0x27919b['id']};_0x17f326[_0x9d90('0x61')]=_[_0x9d90('0x44')](_0x27919b[_0x9d90('0x3c')]);}if(_0x648b5a['talktime']){_0x17f326[_0x9d90('0x62')]=moment[_0x9d90('0x63')](parseInt(_0x648b5a[_0x9d90('0x64')])*0x3e8)['format'](_0x9d90('0x65'));}else if(_0x648b5a['answertime']&&_0x648b5a['endtime']){_0x17f326[_0x9d90('0x62')]=moment[_0x9d90('0x63')](moment(_0x648b5a['endtime'],_0x9d90('0x66'))[_0x9d90('0x67')](moment(_0x648b5a[_0x9d90('0x68')],_0x9d90('0x66'))))[_0x9d90('0x69')](_0x9d90('0x65'));}switch(_0x648b5a['lastevent']){case'called':_0x17f326[_0x9d90('0x6a')]=_0x9d90('0x6b');break;case'complete':case _0x9d90('0x6c'):_0x17f326[_0x9d90('0x6a')]=_0x9d90('0x6d');break;case _0x9d90('0x6e'):_0x17f326[_0x9d90('0x6a')]=_0x9d90('0x6f');break;case _0x9d90('0x70'):_0x17f326[_0x9d90('0x6a')]='Abandoned';break;case _0x9d90('0x71'):_0x17f326[_0x9d90('0x6a')]=_0x9d90('0x72');default:}_0x17f326['Call_Start_Time']=(_0x4e47f3===_0x9d90('0x73')?moment(_0x648b5a[_0x9d90('0x68')])[_0x9d90('0x69')](_0x9d90('0x66')):moment(_0x648b5a[_0x9d90('0x74')])[_0x9d90('0x69')](_0x9d90('0x66')))||moment()[_0x9d90('0x69')](_0x9d90('0x66'));_0x17f326[_0x9d90('0x75')]=_0x4e47f3||'Inbound';_0x17f326=_[_0x9d90('0x76')](_0x17f326,getCustomFields(_0x450d3c['Fields'],_0x648b5a));return request({'method':_0x9d90('0x26'),'uri':_0x9d90('0x4d')+_0xc88be8+_0x9d90('0x77'),'headers':{'Authorization':_0x9d90('0x2f')+_0x18f832},'body':{'data':[_0x17f326]},'json':!![]})['then'](function(_0x5717a9){if(_0x5717a9&&_0x5717a9[_0x9d90('0x3b')][0x0][_0x9d90('0x41')]==='SUCCESS'){logger[_0x9d90('0x2c')]('Call\x20created!');return{'id':_0x5717a9[_0x9d90('0x3b')][0x0][_0x9d90('0x43')]['id']};}})[_0x9d90('0x47')](function(_0x5dfa33){logger[_0x9d90('0x2c')](_0x9d90('0x78'),_0x5dfa33[_0x9d90('0x2b')]);console[_0x9d90('0x48')]('err',_0x5dfa33);});}exports[_0x9d90('0x79')]=function(_0x58e208,_0x80a6f0,_0x5c2012,_0x5468c9,_0x584438,_0xf9a29){var _0x62fa77,_0x3f2838,_0x4a6494;_0xf9a29[_0x9d90('0x7a')]=intUtil[_0x9d90('0x7b')](_0xf9a29[_0x9d90('0x7a')]);_0xf9a29[_0x9d90('0x7c')]=intUtil[_0x9d90('0x7b')](_0xf9a29['serverUrl']);if(_0x584438&&_0x584438[_0x9d90('0x7d')]){logger[_0x9d90('0x2c')](_0x9d90('0x7e'),'Recording\x20is\x20enabled!');_0x80a6f0[_0x9d90('0x7f')]=_0xf9a29[_0x9d90('0x7c')]+_0x9d90('0x80')+_0x80a6f0[_0x9d90('0x81')]+_0x9d90('0x82')+md5(_0x80a6f0[_0x9d90('0x81')]);}else{_0x80a6f0['recordingURL']='';}var _0xca8408=_0xf9a29[_0x9d90('0x7a')]===_0x9d90('0x83')?'eu':_0x9d90('0x84');return getAccessToken(_0xf9a29)[_0x9d90('0x30')](function(_0x4a7102){_0x4a6494=_0x4a7102;return getUser(_0x4a6494,_0xca8408,_0xf9a29,_0x5468c9[_0x9d90('0x85')]);})[_0x9d90('0x30')](function(_0x369c2a){_0x62fa77=_0x369c2a;logger[_0x9d90('0x2c')](_0x9d90('0x86'),_0x62fa77['id']);return getEndUser(_0x4a6494,_0xca8408,_0xf9a29,_0x80a6f0[_0x9d90('0x87')],_0x80a6f0[_0x9d90('0x88')],_0x62fa77,_0x5c2012);})[_0x9d90('0x30')](function(_0x2b3f87){_0x3f2838=_0x2b3f87;return getCall(_0x4a6494,_0xca8408,_0xf9a29,_0x62fa77,_0x3f2838,_0x5c2012,_0x80a6f0,'Inbound');})[_0x9d90('0x30')](function(_0x2d80fb){if(_0x2d80fb){logger['info']('The\x20Call\x20ID\x20is:',_0x2d80fb['id']);logger[_0x9d90('0x2c')](_0x9d90('0x7e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9d90('0x69')](_0x9d90('0x89'),_0x5468c9[_0x9d90('0x1b')]),_0x9d90('0x8a'),{'uri':_0x9d90('0x8b')+_0xf9a29[_0x9d90('0x7a')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2d80fb['id']});}})[_0x9d90('0x47')](function(_0x877a52){logger[_0x9d90('0x39')]('[QUEUE]',JSON[_0x9d90('0x10')](_0x877a52));});};exports[_0x9d90('0x73')]=function(_0x122354,_0xca530f,_0x152a61,_0x2374ed,_0x1db000,_0x5a032d,_0x5759a9){var _0x70e47e,_0x4dc48a,_0x58b7bf;_0x5a032d[_0x9d90('0x7a')]=intUtil[_0x9d90('0x7b')](_0x5a032d[_0x9d90('0x7a')]);_0x5a032d['serverUrl']=intUtil[_0x9d90('0x7b')](_0x5a032d[_0x9d90('0x7c')]);if(_0x5759a9&&_0x5759a9[_0x9d90('0x8c')]&&_0x5759a9[_0x9d90('0x8c')]!==_0x9d90('0x8d')){logger[_0x9d90('0x2c')](_0x9d90('0x8e'),'Recording\x20is\x20enabled!');_0xca530f[_0x9d90('0x7f')]=_0x5a032d[_0x9d90('0x7c')]+'/api/voice/recordings/'+_0xca530f[_0x9d90('0x81')]+_0x9d90('0x82')+md5(_0xca530f['uniqueid']);}var _0x36910d=_0x5a032d[_0x9d90('0x7a')]==='zoho.eu'?'eu':_0x9d90('0x84');return getAccessToken(_0x5a032d)['then'](function(_0x553b2e){_0x58b7bf=_0x553b2e;return getUser(_0x58b7bf,_0x36910d,_0x5a032d,_0x2374ed[_0x9d90('0x85')]);})['then'](function(_0x465d8d){_0x70e47e=_0x465d8d;logger[_0x9d90('0x2c')](_0x9d90('0x86'),_0x70e47e['id']);return getEndUser(_0x58b7bf,_0x36910d,_0x5a032d,_0xca530f[_0x9d90('0x8f')],_0xca530f[_0x9d90('0x90')],_0x70e47e,_0x152a61);})[_0x9d90('0x30')](function(_0x91f304){_0x4dc48a=_0x91f304;return getCall(_0x58b7bf,_0x36910d,_0x5a032d,_0x70e47e,_0x4dc48a,_0x152a61,_0xca530f,_0x9d90('0x91'));})['then'](function(_0x4e0c1a){if(_0x4e0c1a){logger[_0x9d90('0x2c')](_0x9d90('0x92'),_0x4e0c1a['id']);logger[_0x9d90('0x2c')](_0x9d90('0x8e'),_0x9d90('0x93'));emit(util[_0x9d90('0x69')](_0x9d90('0x89'),_0x2374ed[_0x9d90('0x1b')]),_0x9d90('0x8a'),{'uri':_0x9d90('0x8b')+_0x5a032d[_0x9d90('0x7a')]+_0x9d90('0x94')+_0x4e0c1a['id']});}})[_0x9d90('0x47')](function(_0x268b01){logger[_0x9d90('0x39')]('[OUTBOUND]',JSON['stringify'](_0x268b01));});};exports[_0x9d90('0x95')]=function(_0x24ac09,_0x1b6fc5,_0x248d8f,_0x3adb28,_0x47c9a1,_0x14aca1){var _0x275f0e,_0x38b128,_0x5df62f;_0x14aca1[_0x9d90('0x7a')]=intUtil[_0x9d90('0x7b')](_0x14aca1[_0x9d90('0x7a')]);_0x14aca1[_0x9d90('0x7c')]=intUtil[_0x9d90('0x7b')](_0x14aca1[_0x9d90('0x7c')]);if(_0x47c9a1&&_0x47c9a1[_0x9d90('0x7d')]){logger[_0x9d90('0x2c')]('['+_0x1b6fc5[_0x9d90('0x96')]['toUpperCase']()+']',_0x9d90('0x97'));_0x1b6fc5[_0x9d90('0x7f')]=_0x14aca1[_0x9d90('0x7c')]+_0x9d90('0x80')+_0x1b6fc5['uniqueid']+_0x9d90('0x82')+md5(_0x1b6fc5[_0x9d90('0x81')]);}else{_0x1b6fc5[_0x9d90('0x7f')]='';}var _0x5916a8=_0x14aca1['host']===_0x9d90('0x83')?'eu':_0x9d90('0x84');return getAccessToken(_0x14aca1)['then'](function(_0x2710d1){_0x5df62f=_0x2710d1;return getUser(_0x5df62f,_0x5916a8,_0x14aca1);})['then'](function(_0x4ce566){_0x275f0e=_0x4ce566;logger[_0x9d90('0x2c')](_0x9d90('0x86'),_0x275f0e['id']);return getEndUser(_0x5df62f,_0x5916a8,_0x14aca1,_0x1b6fc5[_0x9d90('0x87')],_0x1b6fc5[_0x9d90('0x88')],_0x275f0e,_0x248d8f);})[_0x9d90('0x30')](function(_0x4bf5d2){_0x38b128=_0x4bf5d2;return getCall(_0x5df62f,_0x5916a8,_0x14aca1,_0x275f0e,_0x38b128,_0x248d8f,_0x1b6fc5,_0x9d90('0x98'));})[_0x9d90('0x30')](function(_0x537fc5){if(_0x537fc5){logger['info'](_0x9d90('0x92'),_0x537fc5['id']);}})[_0x9d90('0x47')](function(_0x14f1ae){logger['error']('['+_0x1b6fc5[_0x9d90('0x96')]['toUpperCase']()+']',JSON['stringify'](_0x14f1ae));});}; \ No newline at end of file +var _0x5aba=['add','seconds','catch','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Leads','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','connect','Answered','rejected','abandoned','Abandoned','Timeout','Call_Start_Time','agentcalledAt','/crm/v2/Calls','SUCCESS','Call\x20created!','details','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','outbound','recordingFormat','[OUTBOUND]','/api/voice/recordings/','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','lodash','util','moment','bluebird','../../../../config/environment','../../../../config/logger','localhost','redis','stringify','length','forEach','includes','picklist','type','idField','content','toString','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then'];(function(_0x500743,_0x132d06){var _0x4d2fd8=function(_0x1805c1){while(--_0x1805c1){_0x500743['push'](_0x500743['shift']());}};_0x4d2fd8(++_0x132d06);}(_0x5aba,0x69));var _0xa5ab=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x5aba[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0xa5ab('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xa5ab('0x1'));var intUtil=require('./util');var moment=require(_0xa5ab('0x2'));var Redis=require('ioredis');var BPromise=require(_0xa5ab('0x3'));var config=require(_0xa5ab('0x4'));var logger=require(_0xa5ab('0x5'))('zoho');config['redis']=_['defaults'](config['redis'],{'host':_0xa5ab('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa5ab('0x7')]));function emit(_0x38f46e,_0xa6631c,_0x5c7f87){io['to'](_0x38f46e)['emit'](_0xa6631c,_0x5c7f87);}function request(_0x5658fb){logger['debug']('[HTTP]',JSON[_0xa5ab('0x8')](_0x5658fb));return rp(_0x5658fb);}function getCustomFields(_0x5b6e86,_0x305a11){var _0x57b58c={};if(_0x5b6e86[_0xa5ab('0x9')]>0x0){_[_0xa5ab('0xa')](_0x5b6e86,function(_0x393756){if(_[_0xa5ab('0xb')](['string',_0xa5ab('0xc')],_0x393756[_0xa5ab('0xd')])&&_0x393756[_0xa5ab('0xe')]){_0x57b58c[_0x393756[_0xa5ab('0xe')]]=_0x393756[_0xa5ab('0xf')][_0xa5ab('0x10')]();}else if(_0x393756[_0xa5ab('0xd')]==='variable'&&_0x393756['variableName']&&_0x393756[_0xa5ab('0xe')]&&_0x305a11[_0x393756[_0xa5ab('0x11')]]){_0x57b58c[_0x393756['idField']]=_0x305a11[_0x393756[_0xa5ab('0x11')]][_0xa5ab('0x10')]();}else if(_0x393756['type']==='customVariable'&&_0x393756[_0xa5ab('0x12')]&&_0x393756['Variable'][_0xa5ab('0x13')]&&_0x393756[_0xa5ab('0xe')]&&_0x305a11[_0x393756[_0xa5ab('0x12')][_0xa5ab('0x13')]['toLowerCase']()]){_0x57b58c[_0x393756[_0xa5ab('0xe')]]=_0x305a11[_0x393756['Variable'][_0xa5ab('0x13')][_0xa5ab('0x14')]()][_0xa5ab('0x10')]();}});}return _0x57b58c;}function getName(_0x3363e6){if(_0x3363e6[_0xa5ab('0x15')]('\x20')>0x0){var _0x540c15=_0x3363e6[_0xa5ab('0x16')](/ (.+)/);if(_0x540c15[0x1]){return _0x540c15;}}return[_0x3363e6,_0x3363e6];}var accountsTokens={};function getAccessToken(_0x1cf54e){return new Promise(function(_0x504475,_0x2b8604){if(!_[_0xa5ab('0x17')](accountsTokens[_0x1cf54e['id']])&&!_['isNil'](accountsTokens[_0x1cf54e['id']][_0xa5ab('0x18')])){if(moment()[_0xa5ab('0x19')](accountsTokens[_0x1cf54e['id']][_0xa5ab('0x1a')])){_0x504475(accountsTokens[_0x1cf54e['id']][_0xa5ab('0x18')]);}}var _0x5bbad2;switch(_0x1cf54e['zone']){case'US':_0x5bbad2=_0xa5ab('0x1b');break;case'AU':_0x5bbad2=_0xa5ab('0x1c');break;case'EU':_0x5bbad2='https://accounts.zoho.eu';break;case'IN':_0x5bbad2=_0xa5ab('0x1d');break;case'CN':_0x5bbad2=_0xa5ab('0x1e');break;default:_0x5bbad2='https://accounts.zoho.eu';break;}var _0x5a9e05={'method':_0xa5ab('0x1f'),'uri':_0x5bbad2+_0xa5ab('0x20'),'qs':{'refresh_token':_0x1cf54e[_0xa5ab('0x21')],'client_id':_0x1cf54e[_0xa5ab('0x22')],'client_secret':_0x1cf54e['clientSecret'],'grant_type':_0xa5ab('0x23')},'json':!![]};return rp(_0x5a9e05)[_0xa5ab('0x24')](function(_0x41e334){accountsTokens[_0x1cf54e['id']]={'access_token':_0x41e334[_0xa5ab('0x18')],'expires_in':moment()[_0xa5ab('0x25')](_0x41e334[_0xa5ab('0x1a')],_0xa5ab('0x26'))};_0x504475(_0x41e334[_0xa5ab('0x18')]);})[_0xa5ab('0x27')](function(_0x50f43b){logger['error']('Failing\x20creating\x20the\x20access_token',_0x50f43b['stack']);_0x2b8604(_0x50f43b);});});}function getUser(_0xe65097,_0x2a979d,_0x6096d1,_0x7a7496){logger[_0xa5ab('0x28')](_0xa5ab('0x29'));return request({'method':_0xa5ab('0x2a'),'uri':util[_0xa5ab('0x2b')](_0xa5ab('0x2c'),_0x2a979d),'qs':{'type':_0xa5ab('0x2d')},'headers':{'Authorization':_0xa5ab('0x2e')+_0xe65097},'json':!![]})[_0xa5ab('0x24')](function(_0x373fa0){if(_0x373fa0['users']){var _0x4b8250=-0x1;if(_['isArrayLikeObject'](_0x373fa0[_0xa5ab('0x2f')])){if(!_[_0xa5ab('0x17')](_0x7a7496)){_0x4b8250=_[_0xa5ab('0x30')](_0x373fa0[_0xa5ab('0x2f')],function(_0x45ab8f){return _0x45ab8f[_0xa5ab('0x31')]===_0x7a7496;});}if(_0x4b8250>=0x0){logger[_0xa5ab('0x28')]('Agent\x20found!');}else{logger[_0xa5ab('0x28')](_0xa5ab('0x32'));_0x4b8250=_[_0xa5ab('0x30')](_0x373fa0[_0xa5ab('0x2f')],function(_0x492d48){return _0x492d48[_0xa5ab('0x33')][_0xa5ab('0x13')]===_0xa5ab('0x34');});}return _0x373fa0[_0xa5ab('0x2f')][_0x4b8250];}else{if(_0x373fa0[_0xa5ab('0x35')][_0xa5ab('0x33')][_0xa5ab('0x13')]==='Administrator'){logger[_0xa5ab('0x28')](_0xa5ab('0x32'));user=_0x373fa0['user'];return user;}else{logger['error'](_0xa5ab('0x36'),JSON[_0xa5ab('0x8')](_0x373fa0));throw new Error(_0xa5ab('0x37')+JSON[_0xa5ab('0x8')](_0x373fa0));}}}else{logger[_0xa5ab('0x38')](_0xa5ab('0x36'),JSON[_0xa5ab('0x8')](_0x373fa0));throw new Error(_0xa5ab('0x37')+JSON['stringify'](_0x373fa0));}})[_0xa5ab('0x27')](function(_0x443a44){console[_0xa5ab('0x38')](_0x443a44);});}function getZohoUser(_0x4d4d60,_0x23bef1){return new BPromise(function(_0x430cdd,_0x43126b){request(_0x4d4d60)['then'](function(_0x3cc747){var _0x5ee32e=null;if(_0x3cc747){_0x5ee32e=_0x3cc747[_0xa5ab('0x39')][0x0];_0x5ee32e[_0xa5ab('0x3a')]=_0x23bef1;}_0x430cdd(_0x5ee32e);})[_0xa5ab('0x27')](function(_0x551727){_0x43126b(_0x551727);});});}function createEndUser(_0x5ae461,_0x1f9ad0,_0x5a1143,_0x4781e7,_0x4b925c,_0x1e6765){var _0x5a1143=getName(_0x5a1143);return request({'method':_0xa5ab('0x1f'),'uri':_0xa5ab('0x3b')+_0x1f9ad0+_0xa5ab('0x3c')+_[_0xa5ab('0x3d')](_0x1e6765[_0xa5ab('0x3e')])+'s','body':{'data':[{'Last_Name':_0x5a1143[0x1],'First_Name':_0x5a1143[0x0],'Phone':_0x4781e7,'Owner':{'name':!_[_0xa5ab('0x17')](_0x4b925c['role'][_0xa5ab('0x13')])?_0x4b925c[_0xa5ab('0x3f')][_0xa5ab('0x13')]:!_[_0xa5ab('0x17')](_0x4b925c[_0xa5ab('0x40')])?_0x4b925c[_0xa5ab('0x40')]+'\x20'+_0x4b925c['last_name']:_0x4b925c[_0xa5ab('0x41')],'id':_0x4b925c['id']}}]},'headers':{'Authorization':_0xa5ab('0x2e')+_0x5ae461},'json':!![]})[_0xa5ab('0x24')](function(_0x3b68cd){if(_0x3b68cd&&_0x3b68cd['data'][0x0][_0xa5ab('0x42')]==='SUCCESS'){var _0x463cc8=_0x3b68cd[_0xa5ab('0x39')][0x0]['details'];_0x463cc8['enduserType']=_[_0xa5ab('0x3d')](_0x1e6765[_0xa5ab('0x3e')])+'s';return _0x463cc8;}logger[_0xa5ab('0x38')](_0xa5ab('0x36'),JSON['stringify'](data));throw new Error(_0xa5ab('0x43')+JSON[_0xa5ab('0x8')](data));})['catch'](function(_0xa4a21){console[_0xa5ab('0x44')]('CREATE\x20ERROR',_0xa4a21);});}function getEndUser(_0x5994e1,_0xedb01,_0x274e28,_0x25782b,_0x57fdb8,_0x4c4aad,_0x36a4a1){var _0x4a3221={'method':_0xa5ab('0x2a'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5994e1},'json':!![]};switch(_0x36a4a1[_0xa5ab('0x45')]){case _0xa5ab('0x46'):_0x4a3221[_0xa5ab('0x47')]=_0xa5ab('0x3b')+_0xedb01+_0xa5ab('0x48')+_0x57fdb8+'))';return getZohoUser(_0x4a3221,_0xa5ab('0x49'))[_0xa5ab('0x24')](function(_0x37061f){if(_0x37061f)return _0x37061f;_0x4a3221['uri']=_0xa5ab('0x3b')+_0xedb01+_0xa5ab('0x4a')+_0x57fdb8+'))';return getZohoUser(_0x4a3221,'Leads')['then'](function(_0x1ca497){if(_0x1ca497)return _0x1ca497;if(_0x36a4a1[_0xa5ab('0x3e')]!=_0xa5ab('0x4b')){return createEndUser(_0x5994e1,_0xedb01,_0x25782b,_0x57fdb8,_0x4c4aad,_0x36a4a1);}else{return{};}});});break;case'contact':_0x4a3221[_0xa5ab('0x47')]='https://www.zohoapis.'+_0xedb01+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x57fdb8+'))';return getZohoUser(_0x4a3221,_0xa5ab('0x49'))[_0xa5ab('0x24')](function(_0x1e4b24){if(_0x1e4b24)return _0x1e4b24;if(_0x36a4a1[_0xa5ab('0x3e')]!='nothing'){return createEndUser(_0x5994e1,_0xedb01,_0x25782b,_0x57fdb8,_0x4c4aad,_0x36a4a1);}else{return{};}});break;case'lead':_0x4a3221[_0xa5ab('0x47')]=_0xa5ab('0x3b')+_0xedb01+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x57fdb8+'))';return getZohoUser(_0x4a3221,'Leads')[_0xa5ab('0x24')](function(_0x3d62d8){if(_0x3d62d8)return _0x3d62d8;if(_0x36a4a1[_0xa5ab('0x3e')]!=_0xa5ab('0x4b')){return createEndUser(_0x5994e1,_0xedb01,_0x25782b,_0x57fdb8,_0x4c4aad,_0x36a4a1);}else{return{};}});break;}}function getCall(_0x211a0f,_0x31b366,_0x1ce5a9,_0x281a91,_0x3d0e91,_0x247480,_0x325806,_0x391b56){logger[_0xa5ab('0x28')](_0xa5ab('0x4c'));var _0x4db439={};_0x4db439[_0xa5ab('0x4d')]={'name':!_['isNil'](_0x281a91['role'][_0xa5ab('0x13')])&&!_[_0xa5ab('0x17')](_0x281a91[_0xa5ab('0x33')][_0xa5ab('0x13')])&&_0x281a91['profile'][_0xa5ab('0x13')]===_0xa5ab('0x4e')?_0x281a91[_0xa5ab('0x3f')]['name']:!_[_0xa5ab('0x17')](_0x281a91[_0xa5ab('0x40')])?_0x281a91['first_name']+'\x20'+_0x281a91[_0xa5ab('0x41')]:_0x281a91[_0xa5ab('0x41')],'id':_0x281a91['id']};_0x4db439[_0xa5ab('0x4f')]=intUtil['getString'](_0x247480['Subjects'],_0x325806,'\x20');_0x4db439[_0xa5ab('0x50')]=intUtil['getString'](_0x247480[_0xa5ab('0x51')],_0x325806,'\x0a');if(_0x3d0e91[_0xa5ab('0x3a')]===_0xa5ab('0x49')){_0x4db439[_0xa5ab('0x52')]={'name':!_[_0xa5ab('0x17')](_0x3d0e91['Full_Name'])?_0x3d0e91[_0xa5ab('0x53')]:!_['isNil'](_0x3d0e91[_0xa5ab('0x54')])?_0x3d0e91[_0xa5ab('0x54')]+'\x20'+_0x3d0e91[_0xa5ab('0x55')]:_0x3d0e91['Last_Name'],'id':_0x3d0e91['id']};}if(_0x3d0e91[_0xa5ab('0x3a')]===_0xa5ab('0x56')){_0x4db439[_0xa5ab('0x57')]={'name':!_[_0xa5ab('0x17')](_0x3d0e91[_0xa5ab('0x53')])?_0x3d0e91[_0xa5ab('0x53')]:!_[_0xa5ab('0x17')](_0x3d0e91[_0xa5ab('0x54')])?_0x3d0e91[_0xa5ab('0x54')]+'\x20'+_0x3d0e91[_0xa5ab('0x55')]:_0x3d0e91[_0xa5ab('0x55')],'id':_0x3d0e91['id']};_0x4db439[_0xa5ab('0x58')]=_['startCase'](_0x3d0e91[_0xa5ab('0x3a')]);}if(_0x325806[_0xa5ab('0x59')]){_0x4db439[_0xa5ab('0x5a')]=moment[_0xa5ab('0x5b')](parseInt(_0x325806[_0xa5ab('0x59')])*0x3e8)[_0xa5ab('0x2b')]('mm:ss');}else if(_0x325806[_0xa5ab('0x5c')]&&_0x325806['endtime']){_0x4db439[_0xa5ab('0x5a')]=moment['utc'](moment(_0x325806[_0xa5ab('0x5d')],_0xa5ab('0x5e'))[_0xa5ab('0x5f')](moment(_0x325806[_0xa5ab('0x60')],_0xa5ab('0x5e'))))[_0xa5ab('0x2b')](_0xa5ab('0x61'));}switch(_0x325806[_0xa5ab('0x62')]){case _0xa5ab('0x63'):_0x4db439[_0xa5ab('0x64')]='Called';break;case'complete':case _0xa5ab('0x65'):_0x4db439['Call_Result']=_0xa5ab('0x66');break;case _0xa5ab('0x67'):_0x4db439[_0xa5ab('0x64')]='Rejected';break;case _0xa5ab('0x68'):_0x4db439[_0xa5ab('0x64')]=_0xa5ab('0x69');break;case'timeout':_0x4db439[_0xa5ab('0x64')]=_0xa5ab('0x6a');default:}_0x4db439[_0xa5ab('0x6b')]=(_0x391b56==='outbound'?moment(_0x325806[_0xa5ab('0x60')])['format'](_0xa5ab('0x5e')):moment(_0x325806[_0xa5ab('0x6c')])['format'](_0xa5ab('0x5e')))||moment()[_0xa5ab('0x2b')](_0xa5ab('0x5e'));_0x4db439['Call_Type']=_0x391b56||'Inbound';_0x4db439=_['merge'](_0x4db439,getCustomFields(_0x247480['Fields'],_0x325806));return request({'method':_0xa5ab('0x1f'),'uri':_0xa5ab('0x3b')+_0x31b366+_0xa5ab('0x6d'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x211a0f},'body':{'data':[_0x4db439]},'json':!![]})[_0xa5ab('0x24')](function(_0x531090){if(_0x531090&&_0x531090[_0xa5ab('0x39')][0x0]['code']===_0xa5ab('0x6e')){logger[_0xa5ab('0x28')](_0xa5ab('0x6f'));return{'id':_0x531090['data'][0x0][_0xa5ab('0x70')]['id']};}})[_0xa5ab('0x27')](function(_0x49fcbb){logger['info'](_0xa5ab('0x71'),_0x49fcbb['stack']);console[_0xa5ab('0x44')](_0xa5ab('0x71'),_0x49fcbb);});}exports['queue']=function(_0x4e0d02,_0x132ba5,_0x34d34c,_0x321882,_0x21a73b,_0xfa1fea){var _0x2326e1,_0x4ff731,_0x1b76c1;_0xfa1fea[_0xa5ab('0x72')]=intUtil[_0xa5ab('0x73')](_0xfa1fea[_0xa5ab('0x72')]);_0xfa1fea[_0xa5ab('0x74')]=intUtil[_0xa5ab('0x73')](_0xfa1fea['serverUrl']);if(_0x21a73b&&_0x21a73b[_0xa5ab('0x75')]){logger[_0xa5ab('0x28')](_0xa5ab('0x76'),_0xa5ab('0x77'));_0x132ba5[_0xa5ab('0x78')]=_0xfa1fea[_0xa5ab('0x74')]+'/api/voice/recordings/'+_0x132ba5[_0xa5ab('0x79')]+_0xa5ab('0x7a')+md5(_0x132ba5['uniqueid']);}else{_0x132ba5[_0xa5ab('0x78')]='';}var _0x2b5ec1=_0xfa1fea[_0xa5ab('0x72')]===_0xa5ab('0x7b')?'eu':_0xa5ab('0x7c');return getAccessToken(_0xfa1fea)[_0xa5ab('0x24')](function(_0x4b896c){_0x1b76c1=_0x4b896c;return getUser(_0x1b76c1,_0x2b5ec1,_0xfa1fea,_0x321882[_0xa5ab('0x31')]);})['then'](function(_0xbfc1e2){_0x2326e1=_0xbfc1e2;logger[_0xa5ab('0x28')](_0xa5ab('0x7d'),_0x2326e1['id']);return getEndUser(_0x1b76c1,_0x2b5ec1,_0xfa1fea,_0x132ba5[_0xa5ab('0x7e')],_0x132ba5[_0xa5ab('0x7f')],_0x2326e1,_0x34d34c);})['then'](function(_0x125d20){_0x4ff731=_0x125d20;return getCall(_0x1b76c1,_0x2b5ec1,_0xfa1fea,_0x2326e1,_0x4ff731,_0x34d34c,_0x132ba5,_0xa5ab('0x80'));})[_0xa5ab('0x24')](function(_0x16c819){if(_0x16c819){logger['info'](_0xa5ab('0x81'),_0x16c819['id']);logger[_0xa5ab('0x28')](_0xa5ab('0x76'),_0xa5ab('0x82'));emit(util['format']('user:%s',_0x321882[_0xa5ab('0x13')]),_0xa5ab('0x83'),{'uri':_0xa5ab('0x84')+_0xfa1fea[_0xa5ab('0x72')]+'/crm/EntityInfo.do?module=Calls&id='+_0x16c819['id']});}})[_0xa5ab('0x27')](function(_0x259c74){logger['error'](_0xa5ab('0x76'),JSON[_0xa5ab('0x8')](_0x259c74));});};exports[_0xa5ab('0x85')]=function(_0xa529a8,_0x1249f8,_0x455a3f,_0x314f40,_0x34e73f,_0x3d5a77,_0x486a7a){var _0x4f86e9,_0x432628,_0x2ab7c5;_0x3d5a77[_0xa5ab('0x72')]=intUtil[_0xa5ab('0x73')](_0x3d5a77['host']);_0x3d5a77[_0xa5ab('0x74')]=intUtil[_0xa5ab('0x73')](_0x3d5a77[_0xa5ab('0x74')]);if(_0x486a7a&&_0x486a7a[_0xa5ab('0x86')]&&_0x486a7a['recordingFormat']!=='none'){logger[_0xa5ab('0x28')](_0xa5ab('0x87'),'Recording\x20is\x20enabled!');_0x1249f8['recordingURL']=_0x3d5a77[_0xa5ab('0x74')]+_0xa5ab('0x88')+_0x1249f8['uniqueid']+_0xa5ab('0x7a')+md5(_0x1249f8[_0xa5ab('0x79')]);}var _0x1ec018=_0x3d5a77[_0xa5ab('0x72')]===_0xa5ab('0x7b')?'eu':_0xa5ab('0x7c');return getAccessToken(_0x3d5a77)[_0xa5ab('0x24')](function(_0x194f1c){_0x2ab7c5=_0x194f1c;return getUser(_0x2ab7c5,_0x1ec018,_0x3d5a77,_0x314f40[_0xa5ab('0x31')]);})[_0xa5ab('0x24')](function(_0x59f2f5){_0x4f86e9=_0x59f2f5;logger[_0xa5ab('0x28')]('The\x20User\x20ID\x20is:',_0x4f86e9['id']);return getEndUser(_0x2ab7c5,_0x1ec018,_0x3d5a77,_0x1249f8[_0xa5ab('0x89')],_0x1249f8[_0xa5ab('0x8a')],_0x4f86e9,_0x455a3f);})[_0xa5ab('0x24')](function(_0x48ece5){_0x432628=_0x48ece5;return getCall(_0x2ab7c5,_0x1ec018,_0x3d5a77,_0x4f86e9,_0x432628,_0x455a3f,_0x1249f8,_0xa5ab('0x8b'));})[_0xa5ab('0x24')](function(_0x5d8a80){if(_0x5d8a80){logger[_0xa5ab('0x28')](_0xa5ab('0x81'),_0x5d8a80['id']);logger['info']('[OUTBOUND]',_0xa5ab('0x82'));emit(util[_0xa5ab('0x2b')]('user:%s',_0x314f40[_0xa5ab('0x13')]),_0xa5ab('0x83'),{'uri':_0xa5ab('0x84')+_0x3d5a77[_0xa5ab('0x72')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5d8a80['id']});}})[_0xa5ab('0x27')](function(_0x374321){logger[_0xa5ab('0x38')](_0xa5ab('0x87'),JSON[_0xa5ab('0x8')](_0x374321));});};exports[_0xa5ab('0x8c')]=function(_0x3c4e10,_0x35d74f,_0x97176a,_0x5b19f8,_0x564931,_0x4b126d){var _0x3c94c9,_0x31ede7,_0x120c8d;_0x4b126d[_0xa5ab('0x72')]=intUtil[_0xa5ab('0x73')](_0x4b126d[_0xa5ab('0x72')]);_0x4b126d[_0xa5ab('0x74')]=intUtil[_0xa5ab('0x73')](_0x4b126d['serverUrl']);if(_0x564931&&_0x564931[_0xa5ab('0x75')]){logger[_0xa5ab('0x28')]('['+_0x35d74f[_0xa5ab('0x62')]['toUpperCase']()+']',_0xa5ab('0x77'));_0x35d74f['recordingURL']=_0x4b126d['serverUrl']+_0xa5ab('0x88')+_0x35d74f['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x35d74f['uniqueid']);}else{_0x35d74f[_0xa5ab('0x78')]='';}var _0x8c1086=_0x4b126d[_0xa5ab('0x72')]===_0xa5ab('0x7b')?'eu':_0xa5ab('0x7c');return getAccessToken(_0x4b126d)['then'](function(_0x41fa41){_0x120c8d=_0x41fa41;return getUser(_0x120c8d,_0x8c1086,_0x4b126d);})['then'](function(_0x1b67e3){_0x3c94c9=_0x1b67e3;logger[_0xa5ab('0x28')](_0xa5ab('0x7d'),_0x3c94c9['id']);return getEndUser(_0x120c8d,_0x8c1086,_0x4b126d,_0x35d74f[_0xa5ab('0x7e')],_0x35d74f['calleridnum'],_0x3c94c9,_0x97176a);})[_0xa5ab('0x24')](function(_0x15d408){_0x31ede7=_0x15d408;return getCall(_0x120c8d,_0x8c1086,_0x4b126d,_0x3c94c9,_0x31ede7,_0x97176a,_0x35d74f,_0xa5ab('0x80'));})[_0xa5ab('0x24')](function(_0x324678){if(_0x324678){logger[_0xa5ab('0x28')](_0xa5ab('0x81'),_0x324678['id']);}})[_0xa5ab('0x27')](function(_0x567920){logger[_0xa5ab('0x38')]('['+_0x35d74f[_0xa5ab('0x62')][_0xa5ab('0x8d')]()+']',JSON[_0xa5ab('0x8')](_0x567920));});}; \ 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 1c6898b..0a1711a 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 _0x32e0=['data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger','trigger','exec','data2','Script'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32e0,0x165));var _0x032e=function(_0x2637ac,_0x377857){_0x2637ac=_0x2637ac-0x0;var _0x4a5758=_0x32e0[_0x2637ac];return _0x4a5758;};'use strict';var util=require(_0x032e('0x0'));var sh=require('shelljs');var Mustache=require(_0x032e('0x1'));var logger=require(_0x032e('0x2'))(_0x032e('0x3'));exports[_0x032e('0x4')]=function(_0x4c431e,_0x13cb9f){var _0x37acac=_0x4c431e[_0x032e('0x5')]?_0x4c431e['data2']:_0x032e('0x6');var _0x296d50=_0x4c431e[_0x032e('0x7')]?Mustache[_0x032e('0x8')](_0x4c431e[_0x032e('0x7')],_0x13cb9f):_0x13cb9f;sh[_0x032e('0x4')](_0x296d50,function(_0x43172b,_0x23f0a8,_0x212fd5){if(_0x43172b!==0x0){logger[_0x032e('0x9')](util[_0x032e('0xa')](_0x032e('0xb'),_0x37acac,_0x296d50,_0x43172b,_0x212fd5));}else{logger[_0x032e('0xc')](util[_0x032e('0xa')](_0x032e('0xd'),_0x37acac,_0x296d50,_0x23f0a8));}});}; \ No newline at end of file +var _0x4181=['error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render'];(function(_0x4f11cb,_0x14e174){var _0x491488=function(_0x2904a9){while(--_0x2904a9){_0x4f11cb['push'](_0x4f11cb['shift']());}};_0x491488(++_0x14e174);}(_0x4181,0x16b));var _0x1418=function(_0x5d7d56,_0xe36793){_0x5d7d56=_0x5d7d56-0x0;var _0x1c3e39=_0x4181[_0x5d7d56];return _0x1c3e39;};'use strict';var util=require(_0x1418('0x0'));var sh=require('shelljs');var Mustache=require(_0x1418('0x1'));var logger=require(_0x1418('0x2'))(_0x1418('0x3'));exports[_0x1418('0x4')]=function(_0x3e0b2f,_0x3fb8e9){var _0x3bfa0b=_0x3e0b2f[_0x1418('0x5')]?_0x3e0b2f[_0x1418('0x5')]:_0x1418('0x6');var _0x5b3dae=_0x3e0b2f[_0x1418('0x7')]?Mustache[_0x1418('0x8')](_0x3e0b2f[_0x1418('0x7')],_0x3fb8e9):_0x3fb8e9;sh['exec'](_0x5b3dae,function(_0x478aad,_0x2db78c,_0x3f37be){if(_0x478aad!==0x0){logger[_0x1418('0x9')](util['format'](_0x1418('0xa'),_0x3bfa0b,_0x5b3dae,_0x478aad,_0x3f37be));}else{logger[_0x1418('0xb')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x3bfa0b,_0x5b3dae,_0x2db78c));}});}; \ 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 858a2f3..d63cd7b 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 _0x223c=['trigger','exec','data1','render','data2','data5','data6','parse','error','stack','GET','DELETE','POST','PUT','data7','body','stringify','then','isNil','object','info','format','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','util','lodash'];(function(_0x5f38a0,_0x2087e){var _0x1bedf0=function(_0xfeb89){while(--_0xfeb89){_0x5f38a0['push'](_0x5f38a0['shift']());}};_0x1bedf0(++_0x2087e);}(_0x223c,0x116));var _0xc223=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x223c[_0x14add3];return _0x4a174f;};'use strict';var rp=require('request-promise');var util=require(_0xc223('0x0'));var _=require(_0xc223('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0xc223('0x2'));exports[_0xc223('0x3')]=function(_0x3f52c6,_0x36175c){var _0x1d7cd5,_0x3cb5ec;var _0xbf6908={'method':_0x3f52c6[_0xc223('0x4')]['toUpperCase'](),'uri':Mustache[_0xc223('0x5')](_0x3f52c6[_0xc223('0x6')],_0x36175c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3f52c6[_0xc223('0x7')])==='number'&&parseInt(_0x3f52c6[_0xc223('0x7')])>=0x1&&parseInt(_0x3f52c6[_0xc223('0x7')])<=0xa?parseInt(_0x3f52c6['data5'])*0x3e8:0x5*0x3e8};try{_0xbf6908['headers']=_0x3f52c6[_0xc223('0x8')]?JSON[_0xc223('0x9')](Mustache['render'](_0x3f52c6[_0xc223('0x8')],_0x36175c)):{};}catch(_0x50f314){logger[_0xc223('0xa')](_0x50f314[_0xc223('0xb')]);}switch(_0x3f52c6[_0xc223('0x4')]['toUpperCase']()){case _0xc223('0xc'):case _0xc223('0xd'):_0x1d7cd5=null;_0xbf6908['qs']=_0x36175c;break;case _0xc223('0xe'):case _0xc223('0xf'):if(_0x3f52c6[_0xc223('0x10')]){try{_0x1d7cd5=JSON[_0xc223('0x9')](Mustache[_0xc223('0x5')](_0x3f52c6['data7'],_0x36175c));_0xbf6908[_0xc223('0x11')]=_0x1d7cd5;}catch(_0x296134){logger['error'](_0x296134[_0xc223('0xb')]);logger[_0xc223('0xa')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x1d7cd5=_0x36175c;_0xbf6908[_0xc223('0x11')]=_0x1d7cd5;}break;}logger['info'](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x3f52c6[_0xc223('0x4')],_0x3f52c6[_0xc223('0x6')],JSON[_0xc223('0x12')](_0xbf6908)));rp(_0xbf6908)[_0xc223('0x13')](function(_0x4d1786){_0x1d7cd5=!_[_0xc223('0x14')](_0x1d7cd5)?',\x20request\x20body:\x20'+_0x1d7cd5:'';_0x3cb5ec=typeof _0x4d1786[_0xc223('0x11')]===_0xc223('0x15')?JSON[_0xc223('0x12')](_0x4d1786['body']):_0x4d1786[_0xc223('0x11')];logger[_0xc223('0x16')](util[_0xc223('0x17')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x3f52c6[_0xc223('0x4')],_0x3f52c6[_0xc223('0x6')],_0x4d1786[_0xc223('0x18')],_0x3cb5ec));})[_0xc223('0x19')](function(_0x3cd493){logger[_0xc223('0xa')](util[_0xc223('0x17')](_0xc223('0x1a'),_0x3f52c6[_0xc223('0x4')],_0x3f52c6['data2'],_0x3cd493[_0xc223('0x18')],_0x3cd493[_0xc223('0x1b')],_0x3cd493['message']));});}; \ No newline at end of file +var _0x1618=['trigger','exec','data1','toUpperCase','render','data2','data5','headers','data6','parse','GET','DELETE','data7','stack','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','object','info','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x1618,0x171));var _0x8161=function(_0x4789d9,_0x3ed897){_0x4789d9=_0x4789d9-0x0;var _0x12162d=_0x1618[_0x4789d9];return _0x12162d;};'use strict';var rp=require(_0x8161('0x0'));var util=require(_0x8161('0x1'));var _=require(_0x8161('0x2'));var Mustache=require(_0x8161('0x3'));var logger=require(_0x8161('0x4'))(_0x8161('0x5'));exports[_0x8161('0x6')]=function(_0x2c5d4b,_0xb3a0cd){var _0x1dd4b0,_0x214d17;var _0x5b5678={'method':_0x2c5d4b[_0x8161('0x7')][_0x8161('0x8')](),'uri':Mustache[_0x8161('0x9')](_0x2c5d4b[_0x8161('0xa')],_0xb3a0cd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2c5d4b[_0x8161('0xb')])==='number'&&parseInt(_0x2c5d4b[_0x8161('0xb')])>=0x1&&parseInt(_0x2c5d4b[_0x8161('0xb')])<=0xa?parseInt(_0x2c5d4b['data5'])*0x3e8:0x5*0x3e8};try{_0x5b5678[_0x8161('0xc')]=_0x2c5d4b[_0x8161('0xd')]?JSON[_0x8161('0xe')](Mustache[_0x8161('0x9')](_0x2c5d4b[_0x8161('0xd')],_0xb3a0cd)):{};}catch(_0x2874ed){logger['error'](_0x2874ed['stack']);}switch(_0x2c5d4b[_0x8161('0x7')][_0x8161('0x8')]()){case _0x8161('0xf'):case _0x8161('0x10'):_0x1dd4b0=null;_0x5b5678['qs']=_0xb3a0cd;break;case'POST':case'PUT':if(_0x2c5d4b[_0x8161('0x11')]){try{_0x1dd4b0=JSON[_0x8161('0xe')](Mustache[_0x8161('0x9')](_0x2c5d4b[_0x8161('0x11')],_0xb3a0cd));_0x5b5678['body']=_0x1dd4b0;}catch(_0x3b70d4){logger['error'](_0x3b70d4[_0x8161('0x12')]);logger[_0x8161('0x13')](_0x8161('0x14'));}}else{_0x1dd4b0=_0xb3a0cd;_0x5b5678[_0x8161('0x15')]=_0x1dd4b0;}break;}logger['info'](util['format'](_0x8161('0x16'),_0x2c5d4b[_0x8161('0x7')],_0x2c5d4b[_0x8161('0xa')],JSON[_0x8161('0x17')](_0x5b5678)));rp(_0x5b5678)[_0x8161('0x18')](function(_0x3f3aa0){_0x1dd4b0=!_['isNil'](_0x1dd4b0)?',\x20request\x20body:\x20'+_0x1dd4b0:'';_0x214d17=typeof _0x3f3aa0[_0x8161('0x15')]===_0x8161('0x19')?JSON[_0x8161('0x17')](_0x3f3aa0[_0x8161('0x15')]):_0x3f3aa0[_0x8161('0x15')];logger[_0x8161('0x1a')](util[_0x8161('0x1b')](_0x8161('0x1c'),_0x2c5d4b[_0x8161('0x7')],_0x2c5d4b[_0x8161('0xa')],_0x3f3aa0[_0x8161('0x1d')],_0x214d17));})[_0x8161('0x1e')](function(_0x8bf7af){logger[_0x8161('0x13')](util[_0x8161('0x1b')](_0x8161('0x1f'),_0x2c5d4b[_0x8161('0x7')],_0x2c5d4b['data2'],_0x8bf7af[_0x8161('0x1d')],_0x8bf7af[_0x8161('0x20')],_0x8bf7af[_0x8161('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index f56f10d..6052460 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 _0xe3d8=['catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','then','debug','rpc','error','message','result'];(function(_0x2cc530,_0x48f543){var _0x323043=function(_0x263ea3){while(--_0x263ea3){_0x2cc530['push'](_0x2cc530['shift']());}};_0x323043(++_0x48f543);}(_0xe3d8,0x1ec));var _0x8e3d=function(_0x4c73ff,_0x1340f1){_0x4c73ff=_0x4c73ff-0x0;var _0x2ed007=_0xe3d8[_0x4c73ff];return _0x2ed007;};'use strict';var jayson=require(_0x8e3d('0x0'));var BPromise=require(_0x8e3d('0x1'));var logger=require(_0x8e3d('0x2'))(_0x8e3d('0x3'));var client=jayson[_0x8e3d('0x4')][_0x8e3d('0x5')]({'port':0x2329});client['Request']=function(_0x24462b,_0x105758){return new BPromise(function(_0x4d370f,_0x92c3a6){return client['request'](_0x24462b,_0x105758)[_0x8e3d('0x6')](function(_0x30fc28){logger[_0x8e3d('0x7')](_0x8e3d('0x8'),_0x8e3d('0x3'),_0x24462b,_0x105758,_0x30fc28);if(_0x30fc28[_0x8e3d('0x9')]){logger['error'](_0x8e3d('0x8'),_0x8e3d('0x3'),_0x24462b,_0x30fc28[_0x8e3d('0x9')][_0x8e3d('0xa')],_0x105758);return _0x92c3a6(_0x30fc28['error'][_0x8e3d('0xa')]);}else{return _0x4d370f(_0x30fc28[_0x8e3d('0xb')]);}})[_0x8e3d('0xc')](function(_0x256675){logger[_0x8e3d('0x9')](_0x8e3d('0x8'),_0x8e3d('0x3'),_0x24462b,_0x256675,_0x105758);return _0x92c3a6(_0x256675);});});};module[_0x8e3d('0xd')]=client; \ No newline at end of file +var _0x618e=['catch','jayson/promise','../../config/logger','routing','http','Request','request','debug','rpc','error','message','result'];(function(_0x40aea6,_0x3f5c1a){var _0x1aed83=function(_0x363547){while(--_0x363547){_0x40aea6['push'](_0x40aea6['shift']());}};_0x1aed83(++_0x3f5c1a);}(_0x618e,0xfd));var _0xe618=function(_0x834637,_0x1b0ce9){_0x834637=_0x834637-0x0;var _0x44d3a0=_0x618e[_0x834637];return _0x44d3a0;};'use strict';var jayson=require(_0xe618('0x0'));var BPromise=require('bluebird');var logger=require(_0xe618('0x1'))(_0xe618('0x2'));var client=jayson['client'][_0xe618('0x3')]({'port':0x2329});client[_0xe618('0x4')]=function(_0x48b695,_0x37f73e){return new BPromise(function(_0x945935,_0x4f2241){return client[_0xe618('0x5')](_0x48b695,_0x37f73e)['then'](function(_0x26dfd5){logger[_0xe618('0x6')](_0xe618('0x7'),_0xe618('0x2'),_0x48b695,_0x37f73e,_0x26dfd5);if(_0x26dfd5['error']){logger[_0xe618('0x8')](_0xe618('0x7'),'routing',_0x48b695,_0x26dfd5[_0xe618('0x8')][_0xe618('0x9')],_0x37f73e);return _0x4f2241(_0x26dfd5[_0xe618('0x8')][_0xe618('0x9')]);}else{return _0x945935(_0x26dfd5[_0xe618('0xa')]);}})[_0xe618('0xb')](function(_0x3f6d43){logger[_0xe618('0x8')]('rpc',_0xe618('0x2'),_0x48b695,_0x3f6d43,_0x37f73e);return _0x4f2241(_0x3f6d43);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index a5d68ec..ec7cfb4 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 _0x3905=['getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','error','./server','./lib/email','./rpc/mailAccount','email','resolve','then'];(function(_0x2f4a63,_0x450ff0){var _0x29c3e9=function(_0x5b25e1){while(--_0x5b25e1){_0x2f4a63['push'](_0x2f4a63['shift']());}};_0x29c3e9(++_0x450ff0);}(_0x3905,0x162));var _0x5390=function(_0x5af59e,_0x3771c1){_0x5af59e=_0x5af59e-0x0;var _0x4240df=_0x3905[_0x5af59e];return _0x4240df;};'use strict';var server=require(_0x5390('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x5390('0x1'));var mailAccount=require(_0x5390('0x2'));var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0x5390('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x5390('0x4')]()[_0x5390('0x5')](mailAccount[_0x5390('0x6')]())[_0x5390('0x5')](realtime[_0x5390('0x7')]())[_0x5390('0x5')](function(){email[_0x5390('0x8')](realtime[_0x5390('0x9')]);return realtime;});}function main(){return server[_0x5390('0xa')](realtime,email)[_0x5390('0x5')](function(){return initRealtime();})[_0x5390('0x5')](function(){return setting['getSettings']();})['then'](function(_0x1cc3a7){return setInterval(initRealtime,_0x1cc3a7['loginMailFrequency']*0x3e8);})['catch'](function(_0x2abcd9){logger[_0x5390('0xb')]('Email\x20service\x20initialization',_0x2abcd9);});}main(); \ No newline at end of file +var _0x45b9=['getMailAccounts','refresh','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve','then'];(function(_0x57236f,_0x10d604){var _0x2397b5=function(_0x1784ed){while(--_0x1784ed){_0x57236f['push'](_0x57236f['shift']());}};_0x2397b5(++_0x10d604);}(_0x45b9,0x78));var _0x945b=function(_0x925812,_0x2ee730){_0x925812=_0x925812-0x0;var _0x375ae9=_0x45b9[_0x925812];return _0x375ae9;};'use strict';var server=require(_0x945b('0x0'));var Realtime=require(_0x945b('0x1'));var EmailChannel=require(_0x945b('0x2'));var mailAccount=require(_0x945b('0x3'));var setting=require(_0x945b('0x4'));var logger=require('../../config/logger')(_0x945b('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x945b('0x6')]()[_0x945b('0x7')](mailAccount[_0x945b('0x8')]())['then'](realtime['initMailAccounts']())[_0x945b('0x7')](function(){email[_0x945b('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x945b('0xa')](realtime,email)[_0x945b('0x7')](function(){return initRealtime();})[_0x945b('0x7')](function(){return setting[_0x945b('0xb')]();})[_0x945b('0x7')](function(_0x2ef3a4){return setInterval(initRealtime,_0x2ef3a4[_0x945b('0xc')]*0x3e8);})[_0x945b('0xd')](function(_0xd3fdb1){logger[_0x945b('0xe')](_0x945b('0xf'),_0xd3fdb1);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index d859f56..86b3a73 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 _0xf9bd=['email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','key','messageStatus','total','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','Imap','active','service','provider','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','isNil','status','disabled','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','send','Smtp','verify','exports','moment','md5','ioredis','../../../config/environment'];(function(_0x2cbd58,_0x278e75){var _0x42ef2a=function(_0x4d2ceb){while(--_0x4d2ceb){_0x2cbd58['push'](_0x2cbd58['shift']());}};_0x42ef2a(++_0x278e75);}(_0xf9bd,0x17d));var _0xdf9b=function(_0x4ee976,_0xbad0d4){_0x4ee976=_0x4ee976-0x0;var _0x2de7ef=_0xf9bd[_0x4ee976];return _0x2de7ef;};'use strict';var _=require('lodash');var moment=require(_0xdf9b('0x0'));var BPromise=require('bluebird');var md5=require(_0xdf9b('0x1'));var Redis=require(_0xdf9b('0x2'));var config=require(_0xdf9b('0x3'));var logger=require('../../../config/logger')(_0xdf9b('0x4'));config[_0xdf9b('0x5')]=_[_0xdf9b('0x6')](config['redis'],{'host':_0xdf9b('0x7'),'port':0x18eb});var io=require(_0xdf9b('0x8'))(new Redis(config['redis']));var EmailImap=require(_0xdf9b('0x9'));var EmailSmtp=require(_0xdf9b('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x56334a){logger[_0xdf9b('0xb')](_0xdf9b('0xc'));this[_0xdf9b('0xd')]=_0x56334a[_0xdf9b('0xd')];this[_0xdf9b('0xe')]={};this[_0xdf9b('0xf')]=new EmailSmtp();}EmailChannel['prototype'][_0xdf9b('0x10')]=function(_0x2fe479){var _0x3df4cd=this[_0xdf9b('0xd')][_0x2fe479];var _0x54d62b={'id':_0x3df4cd['id'],'name':_0x3df4cd['name'],'key':_0x3df4cd[_0xdf9b('0x11')],'active':_0x3df4cd['active'],'Imap':{'status':_0x3df4cd['Imap']['status'],'messageStatus':_0x3df4cd['Imap'][_0xdf9b('0x12')],'total':_0x3df4cd['Imap'][_0xdf9b('0x13')]}};if(_['isNil'](md5Accounts[_0x2fe479])){md5Accounts[_0x2fe479]={};}var _0x1c62a8=md5(JSON[_0xdf9b('0x14')](_0x54d62b));if(md5Accounts[_0x2fe479][_0xdf9b('0x1')]!==_0x1c62a8){md5Accounts[_0x2fe479][_0xdf9b('0x1')]=_0x1c62a8;io[_0xdf9b('0x10')](_0xdf9b('0x15'),_0x54d62b);}};EmailChannel[_0xdf9b('0x16')][_0xdf9b('0x17')]=function(_0xcf423b){for(var _0x33045c in _0xcf423b){if(_0xcf423b[_0xdf9b('0x18')](_0x33045c)){if(_0xcf423b[_0x33045c][_0xdf9b('0x19')]&&_0xcf423b[_0x33045c][_0xdf9b('0x1a')]){var _0x5aef86=_0xcf423b[_0x33045c]['Imap'];if(!_0x5aef86[_0xdf9b('0x1b')]&&_0xcf423b[_0x33045c]['provider']!=='custom')_0x5aef86[_0xdf9b('0x1b')]=_0xcf423b[_0x33045c][_0xdf9b('0x1c')];if(!this[_0xdf9b('0xe')][_0xdf9b('0x18')](_0x5aef86['id'])){this[_0xdf9b('0xe')][_0x5aef86['id']]=new EmailImap(_0x5aef86,_0xcf423b[_0x33045c][_0xdf9b('0x4')]);this[_0xdf9b('0xe')][_0x5aef86['id']]['on'](_0xdf9b('0x1d'),this[_0xdf9b('0x1e')][_0xdf9b('0x1f')](this,_0x33045c));this['imapAccounts'][_0x5aef86['id']]['on'](_0xdf9b('0x4'),this[_0xdf9b('0x20')][_0xdf9b('0x1f')](this,_0x33045c));this[_0xdf9b('0xe')][_0x5aef86['id']]['on'](_0xdf9b('0x21'),this[_0xdf9b('0x22')][_0xdf9b('0x1f')](this,_0x33045c));this['imapAccounts'][_0x5aef86['id']]['on'](_0xdf9b('0x23'),this['handleImapError'][_0xdf9b('0x1f')](this,_0x33045c));}}else{if(_[_0xdf9b('0x24')](this[_0xdf9b('0xd')][_0x33045c]['Imap'])){this[_0xdf9b('0xd')][_0x33045c]['Imap']={};}this['mailAccounts'][_0x33045c][_0xdf9b('0x19')][_0xdf9b('0x25')]=_0xdf9b('0x26');this[_0xdf9b('0xd')][_0x33045c][_0xdf9b('0x19')]['messageStatus']='';this['emit'](_0x33045c);}}}};EmailChannel['prototype'][_0xdf9b('0x1e')]=function(_0x80e654,_0xd53bf1){if(this[_0xdf9b('0xd')][_0x80e654]){this[_0xdf9b('0xd')][_0x80e654][_0xdf9b('0x19')][_0xdf9b('0x25')]='connected';this[_0xdf9b('0xd')][_0x80e654][_0xdf9b('0x19')][_0xdf9b('0x12')]=_0xd53bf1[_0xdf9b('0x27')];if(_0xd53bf1[_0xdf9b('0x28')]){this[_0xdf9b('0xd')][_0x80e654][_0xdf9b('0x19')]['total']=_0xd53bf1[_0xdf9b('0x28')][_0xdf9b('0x13')];}return this['emit'](_0x80e654);}};EmailChannel[_0xdf9b('0x16')][_0xdf9b('0x20')]=function(_0x2fc97b,_0x26b8d3){logger[_0xdf9b('0xb')](_0xdf9b('0x29'),_0x26b8d3[_0xdf9b('0x2a')],_0x26b8d3['lastName'],_0x26b8d3[_0xdf9b('0x2b')],_0x2fc97b);if(this['mailAccounts'][_0x2fc97b]){return mailAccount[_0xdf9b('0x2c')](_0x2fc97b,_0x26b8d3)[_0xdf9b('0x2d')](function(_0x46e5db){if(_0x46e5db){logger[_0xdf9b('0xb')](_0xdf9b('0x2e'));}})['catch'](function(_0x1316a4){logger[_0xdf9b('0x23')](_0xdf9b('0x2f'),JSON[_0xdf9b('0x14')](_0x1316a4));});}};EmailChannel[_0xdf9b('0x16')][_0xdf9b('0x22')]=function(_0x33c91a){if(this[_0xdf9b('0xd')][_0x33c91a]&&this['mailAccounts'][_0x33c91a][_0xdf9b('0x19')]){if(this[_0xdf9b('0xe')][this[_0xdf9b('0xd')][_0x33c91a][_0xdf9b('0x19')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x33c91a][_0xdf9b('0x19')]['id']];}this[_0xdf9b('0xd')][_0x33c91a][_0xdf9b('0x19')][_0xdf9b('0x30')]=moment();this[_0xdf9b('0x10')](_0x33c91a);}};EmailChannel[_0xdf9b('0x16')][_0xdf9b('0x31')]=function(_0xd6a90,_0x593445){if(this[_0xdf9b('0xd')][_0xd6a90]){this[_0xdf9b('0xd')][_0xd6a90][_0xdf9b('0x19')]['status']=_0xdf9b('0x23');this[_0xdf9b('0xd')][_0xd6a90][_0xdf9b('0x19')][_0xdf9b('0x12')]=_0x593445;return this[_0xdf9b('0x10')](_0xd6a90);}};EmailChannel[_0xdf9b('0x16')][_0xdf9b('0x32')]=function(_0x17adff,_0xe33061){return this[_0xdf9b('0xf')][_0xdf9b('0x33')](_0x17adff,_0xe33061);};EmailChannel['prototype']['verifySmtp']=function(_0xca661c){var _0x30cacd=this;if(this[_0xdf9b('0xd')][_0xca661c['id']]){if(_['isNil'](this[_0xdf9b('0xd')][_0xca661c['id']]['Smtp'])){this[_0xdf9b('0xd')][_0xca661c['id']][_0xdf9b('0x34')]={};}this[_0xdf9b('0xd')][_0xca661c['id']][_0xdf9b('0x34')][_0xdf9b('0x30')]=moment();return new BPromise(function(_0x105ade,_0x133090){return _0x30cacd[_0xdf9b('0xf')][_0xdf9b('0x35')](_0xca661c)[_0xdf9b('0x2d')](function(_0x5d0f91){_0x30cacd['mailAccounts'][_0xca661c['id']]['Smtp']['status']='verified';_0x30cacd[_0xdf9b('0xd')][_0xca661c['id']][_0xdf9b('0x34')][_0xdf9b('0x12')]='';_0x30cacd['emit'](_0xca661c['id']);_0x105ade(_0x5d0f91);})['catch'](function(_0x3519db){_0x30cacd['mailAccounts'][_0xca661c['id']][_0xdf9b('0x34')]['status']=_0xdf9b('0x23');_0x30cacd[_0xdf9b('0xd')][_0xca661c['id']]['Smtp'][_0xdf9b('0x12')]=_0x3519db;_0x30cacd[_0xdf9b('0x10')](_0xca661c['id']);_0x133090(_0x3519db);});});}return this['smtp'][_0xdf9b('0x35')](_0xca661c);};module[_0xdf9b('0x36')]=EmailChannel; \ No newline at end of file +var _0x6b62=['./imap','../rpc/mailAccount','start\x20email\x20channel','smtp','prototype','emit','mailAccounts','name','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','provider','custom','service','hasOwnProperty','imapAccounts','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','info','lastName','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter'];(function(_0x4effce,_0x3c20f1){var _0x5d97aa=function(_0x24921a){while(--_0x24921a){_0x4effce['push'](_0x4effce['shift']());}};_0x5d97aa(++_0x3c20f1);}(_0x6b62,0x171));var _0x26b6=function(_0x9f7328,_0x166793){_0x9f7328=_0x9f7328-0x0;var _0x54d2cb=_0x6b62[_0x9f7328];return _0x54d2cb;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x26b6('0x0'));var Redis=require(_0x26b6('0x1'));var config=require(_0x26b6('0x2'));var logger=require(_0x26b6('0x3'))(_0x26b6('0x4'));config[_0x26b6('0x5')]=_[_0x26b6('0x6')](config[_0x26b6('0x5')],{'host':_0x26b6('0x7'),'port':0x18eb});var io=require(_0x26b6('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x26b6('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x26b6('0xa'));var md5Accounts={};function EmailChannel(_0x173255){logger['info'](_0x26b6('0xb'));this['mailAccounts']=_0x173255['mailAccounts'];this['imapAccounts']={};this[_0x26b6('0xc')]=new EmailSmtp();}EmailChannel[_0x26b6('0xd')][_0x26b6('0xe')]=function(_0x33ef74){var _0x41d343=this[_0x26b6('0xf')][_0x33ef74];var _0x5d1ef3={'id':_0x41d343['id'],'name':_0x41d343[_0x26b6('0x10')],'key':_0x41d343['key'],'active':_0x41d343[_0x26b6('0x11')],'Imap':{'status':_0x41d343['Imap'][_0x26b6('0x12')],'messageStatus':_0x41d343[_0x26b6('0x13')][_0x26b6('0x14')],'total':_0x41d343[_0x26b6('0x13')][_0x26b6('0x15')]}};if(_[_0x26b6('0x16')](md5Accounts[_0x33ef74])){md5Accounts[_0x33ef74]={};}var _0x1e8f05=md5(JSON[_0x26b6('0x17')](_0x5d1ef3));if(md5Accounts[_0x33ef74]['md5']!==_0x1e8f05){md5Accounts[_0x33ef74]['md5']=_0x1e8f05;io[_0x26b6('0xe')](_0x26b6('0x18'),_0x5d1ef3);}};EmailChannel['prototype'][_0x26b6('0x19')]=function(_0x3a694d){for(var _0x3825ab in _0x3a694d){if(_0x3a694d['hasOwnProperty'](_0x3825ab)){if(_0x3a694d[_0x3825ab][_0x26b6('0x13')]&&_0x3a694d[_0x3825ab]['active']){var _0x3ddd5d=_0x3a694d[_0x3825ab][_0x26b6('0x13')];if(!_0x3ddd5d['service']&&_0x3a694d[_0x3825ab][_0x26b6('0x1a')]!==_0x26b6('0x1b'))_0x3ddd5d[_0x26b6('0x1c')]=_0x3a694d[_0x3825ab][_0x26b6('0x1a')];if(!this['imapAccounts'][_0x26b6('0x1d')](_0x3ddd5d['id'])){this[_0x26b6('0x1e')][_0x3ddd5d['id']]=new EmailImap(_0x3ddd5d,_0x3a694d[_0x3825ab][_0x26b6('0x4')]);this[_0x26b6('0x1e')][_0x3ddd5d['id']]['on']('box',this[_0x26b6('0x1f')][_0x26b6('0x20')](this,_0x3825ab));this[_0x26b6('0x1e')][_0x3ddd5d['id']]['on'](_0x26b6('0x4'),this[_0x26b6('0x21')][_0x26b6('0x20')](this,_0x3825ab));this[_0x26b6('0x1e')][_0x3ddd5d['id']]['on'](_0x26b6('0x22'),this[_0x26b6('0x23')]['bind'](this,_0x3825ab));this['imapAccounts'][_0x3ddd5d['id']]['on'](_0x26b6('0x24'),this[_0x26b6('0x25')][_0x26b6('0x20')](this,_0x3825ab));}}else{if(_[_0x26b6('0x16')](this[_0x26b6('0xf')][_0x3825ab][_0x26b6('0x13')])){this[_0x26b6('0xf')][_0x3825ab][_0x26b6('0x13')]={};}this[_0x26b6('0xf')][_0x3825ab]['Imap'][_0x26b6('0x12')]=_0x26b6('0x26');this[_0x26b6('0xf')][_0x3825ab][_0x26b6('0x13')][_0x26b6('0x14')]='';this['emit'](_0x3825ab);}}}};EmailChannel[_0x26b6('0xd')][_0x26b6('0x1f')]=function(_0x1992c4,_0xe53f){if(this[_0x26b6('0xf')][_0x1992c4]){this[_0x26b6('0xf')][_0x1992c4][_0x26b6('0x13')][_0x26b6('0x12')]=_0x26b6('0x27');this[_0x26b6('0xf')][_0x1992c4]['Imap'][_0x26b6('0x14')]=_0xe53f[_0x26b6('0x10')];if(_0xe53f[_0x26b6('0x28')]){this[_0x26b6('0xf')][_0x1992c4][_0x26b6('0x13')][_0x26b6('0x15')]=_0xe53f[_0x26b6('0x28')][_0x26b6('0x15')];}return this[_0x26b6('0xe')](_0x1992c4);}};EmailChannel[_0x26b6('0xd')]['handleImapEmail']=function(_0x57f56b,_0x160ef3){logger[_0x26b6('0x29')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x160ef3['firstName'],_0x160ef3[_0x26b6('0x2a')],_0x160ef3['from'],_0x57f56b);if(this[_0x26b6('0xf')][_0x57f56b]){return mailAccount[_0x26b6('0x2b')](_0x57f56b,_0x160ef3)[_0x26b6('0x2c')](function(_0x535d2f){if(_0x535d2f){logger[_0x26b6('0x29')]('Mail\x20accepted\x20from\x20routing');}})[_0x26b6('0x2d')](function(_0x1998c6){logger[_0x26b6('0x24')](_0x26b6('0x2e'),JSON[_0x26b6('0x17')](_0x1998c6));});}};EmailChannel['prototype'][_0x26b6('0x23')]=function(_0x2393ed){if(this[_0x26b6('0xf')][_0x2393ed]&&this[_0x26b6('0xf')][_0x2393ed][_0x26b6('0x13')]){if(this[_0x26b6('0x1e')][this['mailAccounts'][_0x2393ed][_0x26b6('0x13')]['id']]){delete this['imapAccounts'][this[_0x26b6('0xf')][_0x2393ed]['Imap']['id']];}this[_0x26b6('0xf')][_0x2393ed][_0x26b6('0x13')][_0x26b6('0x2f')]=moment();this['emit'](_0x2393ed);}};EmailChannel[_0x26b6('0xd')][_0x26b6('0x25')]=function(_0x548daa,_0x129dae){if(this['mailAccounts'][_0x548daa]){this[_0x26b6('0xf')][_0x548daa]['Imap']['status']=_0x26b6('0x24');this[_0x26b6('0xf')][_0x548daa][_0x26b6('0x13')][_0x26b6('0x14')]=_0x129dae;return this[_0x26b6('0xe')](_0x548daa);}};EmailChannel['prototype'][_0x26b6('0x30')]=function(_0x328f5f,_0x40dd05){return this['smtp'][_0x26b6('0x31')](_0x328f5f,_0x40dd05);};EmailChannel['prototype'][_0x26b6('0x32')]=function(_0x44de45){var _0x37b33c=this;if(this[_0x26b6('0xf')][_0x44de45['id']]){if(_[_0x26b6('0x16')](this['mailAccounts'][_0x44de45['id']][_0x26b6('0x33')])){this['mailAccounts'][_0x44de45['id']][_0x26b6('0x33')]={};}this['mailAccounts'][_0x44de45['id']][_0x26b6('0x33')]['lastSync']=moment();return new BPromise(function(_0x387680,_0x4cbc8c){return _0x37b33c[_0x26b6('0xc')][_0x26b6('0x34')](_0x44de45)[_0x26b6('0x2c')](function(_0x270ddf){_0x37b33c[_0x26b6('0xf')][_0x44de45['id']][_0x26b6('0x33')][_0x26b6('0x12')]=_0x26b6('0x35');_0x37b33c[_0x26b6('0xf')][_0x44de45['id']]['Smtp'][_0x26b6('0x14')]='';_0x37b33c['emit'](_0x44de45['id']);_0x387680(_0x270ddf);})[_0x26b6('0x2d')](function(_0x1cf6bf){_0x37b33c[_0x26b6('0xf')][_0x44de45['id']][_0x26b6('0x33')][_0x26b6('0x12')]='error';_0x37b33c['mailAccounts'][_0x44de45['id']][_0x26b6('0x33')][_0x26b6('0x14')]=_0x1cf6bf;_0x37b33c[_0x26b6('0xe')](_0x44de45['id']);_0x4cbc8c(_0x1cf6bf);});});}return this['smtp']['verify'](_0x44de45);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 346f69c..0abd55b 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 _0x2ad4=['service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','email','anonymous@xcally.com','host','tls','autotls','handleOpenBox','emit','readUnseen','end','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','mailbox','getAccount','account','once','ready','handleReady','bind','handleEnd','error','handleError','connect','prototype','connTimeout','authTimeout'];(function(_0x54332a,_0x1c65f9){var _0x1ba465=function(_0x433ef5){while(--_0x433ef5){_0x54332a['push'](_0x54332a['shift']());}};_0x1ba465(++_0x1c65f9);}(_0x2ad4,0xa2));var _0x42ad=function(_0x3c3e72,_0x3e1858){_0x3c3e72=_0x3c3e72-0x0;var _0x48a7e5=_0x2ad4[_0x3c3e72];return _0x48a7e5;};'use strict';var _=require(_0x42ad('0x0'));var util=require(_0x42ad('0x1'));var Imap=require(_0x42ad('0x2'));var simpleParser=require(_0x42ad('0x3'))[_0x42ad('0x4')];var Iconv=require(_0x42ad('0x5'))[_0x42ad('0x6')];var EventEmitter=require(_0x42ad('0x7'))[_0x42ad('0x8')];var utils=require(_0x42ad('0x9'));var logger=require('../../../config/logger')('email');function EmailImap(_0x124c14,_0x9cfb62){this[_0x42ad('0xa')]=_0x124c14[_0x42ad('0xa')];this['account']=this[_0x42ad('0xb')](_0x124c14,_0x9cfb62);this['imap']=new Imap(this[_0x42ad('0xc')]);this['imap'][_0x42ad('0xd')](_0x42ad('0xe'),this[_0x42ad('0xf')][_0x42ad('0x10')](this));this[_0x42ad('0x2')][_0x42ad('0xd')]('end',this[_0x42ad('0x11')][_0x42ad('0x10')](this));this['imap']['on'](_0x42ad('0x12'),this[_0x42ad('0x13')][_0x42ad('0x10')](this));this[_0x42ad('0x2')][_0x42ad('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x42ad('0x15')][_0x42ad('0xb')]=function(_0x20be04,_0x38517b){var _0x17bf6e={'connTimeout':_0x20be04['connTimeout']?_0x20be04[_0x42ad('0x16')]*0x3e8:0x2710,'authTimeout':_0x20be04[_0x42ad('0x17')]?_0x20be04[_0x42ad('0x17')]*0x3e8:0x1388};if(_0x20be04[_0x42ad('0x18')]){_0x17bf6e[_0x42ad('0x19')]=_0x20be04[_0x42ad('0x19')];if(_0x20be04[_0x42ad('0x1a')]){_0x17bf6e[_0x42ad('0x1b')]=utils[_0x42ad('0x1c')](_0x20be04[_0x42ad('0x1d')]['data5'],_0x20be04[_0x42ad('0x19')]);}else{_0x17bf6e[_0x42ad('0x1e')]=_0x20be04[_0x42ad('0x1e')];}}else{if(_0x20be04['authentication']){_0x17bf6e[_0x42ad('0x19')]=_0x20be04['user'];_0x17bf6e['password']=_0x20be04['password'];}}_0x17bf6e[_0x42ad('0x1f')]=_0x38517b||_0x20be04[_0x42ad('0x19')]||_0x42ad('0x20');_0x17bf6e[_0x42ad('0x21')]=_0x20be04[_0x42ad('0x21')];_0x17bf6e['port']=_0x20be04['port']||0x3e1;if(_0x20be04[_0x42ad('0x22')]){_0x17bf6e[_0x42ad('0x22')]=!![];}else{_0x17bf6e[_0x42ad('0x22')]=![];_0x17bf6e[_0x42ad('0x23')]='required';}return _0x17bf6e;};EmailImap[_0x42ad('0x15')][_0x42ad('0xf')]=function(){this[_0x42ad('0x2')]['openBox'](this[_0x42ad('0xa')],![],this['handleOpenBox'][_0x42ad('0x10')](this));};EmailImap[_0x42ad('0x15')][_0x42ad('0x24')]=function(_0x17524c,_0x4e3f36){if(_0x17524c){this[_0x42ad('0x13')](_0x17524c,!![]);}else{this[_0x42ad('0x25')]('box',_0x4e3f36);this[_0x42ad('0x26')]();}};EmailImap[_0x42ad('0x15')]['handleCloseBox']=function(_0x4d8c82){if(_0x4d8c82){this['handleError'](_0x4d8c82,!![]);}else{this[_0x42ad('0x2')][_0x42ad('0x27')]();}};EmailImap[_0x42ad('0x15')]['readUnseen']=function(){this[_0x42ad('0x2')]['search']([_0x42ad('0x28')],this[_0x42ad('0x29')][_0x42ad('0x10')](this));};EmailImap[_0x42ad('0x15')]['handleReadUnseen']=function(_0x33d117,_0x360745){if(_0x33d117){this[_0x42ad('0x13')](_0x33d117,!![]);}else{if(_0x360745[_0x42ad('0x2a')]){try{var _0x2ea960=this['imap'][_0x42ad('0x2b')](_0x360745,{'bodies':'','markSeen':!![]});_0x2ea960['on'](_0x42ad('0x2c'),this[_0x42ad('0x2d')]['bind'](this));_0x2ea960[_0x42ad('0xd')](_0x42ad('0x12'),this[_0x42ad('0x2e')][_0x42ad('0x10')](this));_0x2ea960[_0x42ad('0xd')]('end',this[_0x42ad('0x2f')][_0x42ad('0x10')](this));}catch(_0x420693){logger[_0x42ad('0x12')](_0x420693);}}else{this[_0x42ad('0x2')][_0x42ad('0x30')](!![],this[_0x42ad('0x31')][_0x42ad('0x10')](this));}}};EmailImap[_0x42ad('0x15')][_0x42ad('0x2d')]=function(_0xbe2480){_0xbe2480['on'](_0x42ad('0x32'),this[_0x42ad('0x33')][_0x42ad('0x10')](this));_0xbe2480[_0x42ad('0xd')](_0x42ad('0x34'),this['handleMessageAttributes']['bind'](this));_0xbe2480[_0x42ad('0xd')](_0x42ad('0x27'),this[_0x42ad('0x35')][_0x42ad('0x10')](this));};EmailImap['prototype'][_0x42ad('0x33')]=function(_0x47d948){simpleParser(_0x47d948,{'Iconv':Iconv},this[_0x42ad('0x36')][_0x42ad('0x10')](this));};EmailImap[_0x42ad('0x15')][_0x42ad('0x37')]=function(){};EmailImap['prototype'][_0x42ad('0x35')]=function(){};EmailImap[_0x42ad('0x15')][_0x42ad('0x36')]=function(_0xa328ae,_0x45b837){if(_0xa328ae){logger[_0x42ad('0x12')](_0xa328ae);}else{var _0x16356e=this;utils[_0x42ad('0x38')](this[_0x42ad('0xc')],_0x45b837,function(_0x20fe71){_0x16356e[_0x42ad('0x25')](_0x42ad('0x1f'),_0x20fe71);});}};EmailImap[_0x42ad('0x15')]['handleFetchEnd']=function(){this[_0x42ad('0x2')][_0x42ad('0x30')](!![],this[_0x42ad('0x31')][_0x42ad('0x10')](this));};EmailImap[_0x42ad('0x15')][_0x42ad('0x2e')]=function(_0x24737c){this[_0x42ad('0x13')](_0x24737c);this[_0x42ad('0x2')][_0x42ad('0x30')](!![],this['handleCloseBox'][_0x42ad('0x10')](this));};EmailImap[_0x42ad('0x15')][_0x42ad('0x11')]=function(){this['emit'](_0x42ad('0x27'));};EmailImap[_0x42ad('0x15')][_0x42ad('0x13')]=function(_0x37702c,_0x38d74e){logger[_0x42ad('0x12')](_0x42ad('0x13'),this[_0x42ad('0xc')]['email'],JSON[_0x42ad('0x39')](_0x37702c));var _0x29c6da='';if(_0x37702c){if(_0x37702c[_0x42ad('0x3a')]){_0x29c6da=_0x37702c[_0x42ad('0x3a')];}else{for(var _0x19b0f6 in _0x37702c){if(_0x37702c[_0x42ad('0x3b')](_0x19b0f6)){_0x29c6da+=_[_0x42ad('0x3c')](_0x19b0f6)+':\x20'+_0x37702c[_0x19b0f6]+'\x0a';}}}}if(_0x38d74e){this[_0x42ad('0x2')][_0x42ad('0x27')]();}else{this[_0x42ad('0x25')]('error',_0x29c6da);this['emit'](_0x42ad('0x27'));}};module[_0x42ad('0x3d')]=EmailImap; \ No newline at end of file +var _0x7693=['mailparser','simpleParser','../../../config/logger','email','mailbox','account','getAccount','once','ready','bind','end','handleEnd','error','handleError','connect','inherits','connTimeout','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','prototype','openBox','handleOpenBox','emit','readUnseen','search','UNSEEN','handleReadUnseen','length','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','stringify','hasOwnProperty','upperFirst','exports','lodash','util','imap'];(function(_0x36bf4a,_0x13cf2f){var _0x3588c6=function(_0x459d5c){while(--_0x459d5c){_0x36bf4a['push'](_0x36bf4a['shift']());}};_0x3588c6(++_0x13cf2f);}(_0x7693,0xe1));var _0x3769=function(_0x198543,_0x365209){_0x198543=_0x198543-0x0;var _0x369029=_0x7693[_0x198543];return _0x369029;};'use strict';var _=require(_0x3769('0x0'));var util=require(_0x3769('0x1'));var Imap=require(_0x3769('0x2'));var simpleParser=require(_0x3769('0x3'))[_0x3769('0x4')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require('events')['EventEmitter'];var utils=require('./utils');var logger=require(_0x3769('0x5'))(_0x3769('0x6'));function EmailImap(_0x9b07fe,_0x393be2){this['mailbox']=_0x9b07fe[_0x3769('0x7')];this[_0x3769('0x8')]=this[_0x3769('0x9')](_0x9b07fe,_0x393be2);this[_0x3769('0x2')]=new Imap(this['account']);this[_0x3769('0x2')][_0x3769('0xa')](_0x3769('0xb'),this['handleReady'][_0x3769('0xc')](this));this['imap']['once'](_0x3769('0xd'),this[_0x3769('0xe')][_0x3769('0xc')](this));this[_0x3769('0x2')]['on'](_0x3769('0xf'),this[_0x3769('0x10')][_0x3769('0xc')](this));this[_0x3769('0x2')][_0x3769('0x11')]();}util[_0x3769('0x12')](EmailImap,EventEmitter);EmailImap['prototype'][_0x3769('0x9')]=function(_0x16de34,_0x403b5c){var _0x49a891={'connTimeout':_0x16de34[_0x3769('0x13')]?_0x16de34['connTimeout']*0x3e8:0x2710,'authTimeout':_0x16de34['authTimeout']?_0x16de34[_0x3769('0x14')]*0x3e8:0x1388};if(_0x16de34[_0x3769('0x15')]){_0x49a891[_0x3769('0x16')]=_0x16de34['user'];if(_0x16de34[_0x3769('0x17')]){_0x49a891['xoauth2']=utils[_0x3769('0x18')](_0x16de34['CloudProvider'][_0x3769('0x19')],_0x16de34[_0x3769('0x16')]);}else{_0x49a891[_0x3769('0x1a')]=_0x16de34[_0x3769('0x1a')];}}else{if(_0x16de34[_0x3769('0x1b')]){_0x49a891['user']=_0x16de34['user'];_0x49a891['password']=_0x16de34[_0x3769('0x1a')];}}_0x49a891[_0x3769('0x6')]=_0x403b5c||_0x16de34[_0x3769('0x16')]||_0x3769('0x1c');_0x49a891[_0x3769('0x1d')]=_0x16de34[_0x3769('0x1d')];_0x49a891[_0x3769('0x1e')]=_0x16de34[_0x3769('0x1e')]||0x3e1;if(_0x16de34[_0x3769('0x1f')]){_0x49a891[_0x3769('0x1f')]=!![];}else{_0x49a891[_0x3769('0x1f')]=![];_0x49a891[_0x3769('0x20')]='required';}return _0x49a891;};EmailImap[_0x3769('0x21')]['handleReady']=function(){this[_0x3769('0x2')][_0x3769('0x22')](this[_0x3769('0x7')],![],this['handleOpenBox'][_0x3769('0xc')](this));};EmailImap['prototype'][_0x3769('0x23')]=function(_0x30d80b,_0x8722de){if(_0x30d80b){this[_0x3769('0x10')](_0x30d80b,!![]);}else{this[_0x3769('0x24')]('box',_0x8722de);this['readUnseen']();}};EmailImap[_0x3769('0x21')]['handleCloseBox']=function(_0x20abc8){if(_0x20abc8){this['handleError'](_0x20abc8,!![]);}else{this['imap'][_0x3769('0xd')]();}};EmailImap[_0x3769('0x21')][_0x3769('0x25')]=function(){this['imap'][_0x3769('0x26')]([_0x3769('0x27')],this[_0x3769('0x28')][_0x3769('0xc')](this));};EmailImap[_0x3769('0x21')][_0x3769('0x28')]=function(_0x612c15,_0x423dbe){if(_0x612c15){this[_0x3769('0x10')](_0x612c15,!![]);}else{if(_0x423dbe[_0x3769('0x29')]){try{var _0x1e8c41=this[_0x3769('0x2')]['fetch'](_0x423dbe,{'bodies':'','markSeen':!![]});_0x1e8c41['on']('message',this[_0x3769('0x2a')][_0x3769('0xc')](this));_0x1e8c41[_0x3769('0xa')]('error',this[_0x3769('0x2b')][_0x3769('0xc')](this));_0x1e8c41['once'](_0x3769('0xd'),this[_0x3769('0x2c')]['bind'](this));}catch(_0x1e0bb5){logger[_0x3769('0xf')](_0x1e0bb5);}}else{this[_0x3769('0x2')][_0x3769('0x2d')](!![],this[_0x3769('0x2e')][_0x3769('0xc')](this));}}};EmailImap[_0x3769('0x21')][_0x3769('0x2a')]=function(_0x36e7d6){_0x36e7d6['on'](_0x3769('0x2f'),this[_0x3769('0x30')]['bind'](this));_0x36e7d6[_0x3769('0xa')](_0x3769('0x31'),this[_0x3769('0x32')][_0x3769('0xc')](this));_0x36e7d6[_0x3769('0xa')](_0x3769('0xd'),this[_0x3769('0x33')]['bind'](this));};EmailImap[_0x3769('0x21')]['handleMessageBody']=function(_0x1ecb89){simpleParser(_0x1ecb89,{'Iconv':Iconv},this[_0x3769('0x34')][_0x3769('0xc')](this));};EmailImap[_0x3769('0x21')][_0x3769('0x32')]=function(){};EmailImap[_0x3769('0x21')][_0x3769('0x33')]=function(){};EmailImap[_0x3769('0x21')][_0x3769('0x34')]=function(_0x4d95ab,_0x2e5a76){if(_0x4d95ab){logger[_0x3769('0xf')](_0x4d95ab);}else{var _0x5c9902=this;utils['parser'](this['account'],_0x2e5a76,function(_0x42b0b8){_0x5c9902[_0x3769('0x24')](_0x3769('0x6'),_0x42b0b8);});}};EmailImap[_0x3769('0x21')][_0x3769('0x2c')]=function(){this[_0x3769('0x2')][_0x3769('0x2d')](!![],this[_0x3769('0x2e')][_0x3769('0xc')](this));};EmailImap[_0x3769('0x21')]['handleFetchError']=function(_0x21e29b){this[_0x3769('0x10')](_0x21e29b);this[_0x3769('0x2')][_0x3769('0x2d')](!![],this[_0x3769('0x2e')][_0x3769('0xc')](this));};EmailImap[_0x3769('0x21')][_0x3769('0xe')]=function(){this['emit']('end');};EmailImap['prototype'][_0x3769('0x10')]=function(_0x28d467,_0xd50dfb){logger['error'](_0x3769('0x10'),this[_0x3769('0x8')][_0x3769('0x6')],JSON[_0x3769('0x35')](_0x28d467));var _0x15387d='';if(_0x28d467){if(_0x28d467['textCode']){_0x15387d=_0x28d467['textCode'];}else{for(var _0x1f4a9c in _0x28d467){if(_0x28d467[_0x3769('0x36')](_0x1f4a9c)){_0x15387d+=_[_0x3769('0x37')](_0x1f4a9c)+':\x20'+_0x28d467[_0x1f4a9c]+'\x0a';}}}}if(_0xd50dfb){this[_0x3769('0x2')]['end']();}else{this[_0x3769('0x24')](_0x3769('0xf'),_0x15387d);this[_0x3769('0x24')]('end');}};module[_0x3769('0x38')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index bad4d32..dce58b9 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 _0xead9=['compile','sendMail','toString','createTransport','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype','use'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xead9,0x1e2));var _0x9ead=function(_0x48129b,_0x142a01){_0x48129b=_0x48129b-0x0;var _0x9df5c2=_0xead9[_0x48129b];return _0x9df5c2;};'use strict';var nodemailer=require(_0x9ead('0x0'));var inlineBase64=require(_0x9ead('0x1'));function EmailSmtp(){}EmailSmtp[_0x9ead('0x2')]['send']=function(_0x5dac1f,_0x5d1b44){return new Promise(function(_0x1ae683,_0x28df2d){var _0x3cbc4b=nodemailer['createTransport'](_0x5dac1f);_0x3cbc4b[_0x9ead('0x3')](_0x9ead('0x4'),inlineBase64());_0x3cbc4b[_0x9ead('0x5')](_0x5d1b44,function(_0x535de5,_0x212e81){if(_0x535de5){_0x28df2d(_0x535de5[_0x9ead('0x6')]());}else{_0x1ae683(_0x212e81);}});});};EmailSmtp[_0x9ead('0x2')]['verify']=function(_0x2199e2){return new Promise(function(_0x423719,_0x25aecf){var _0xcdafc8=nodemailer[_0x9ead('0x7')](_0x2199e2);_0xcdafc8['verify'](function(_0x366ec4,_0x1fdd58){if(_0x366ec4){_0x25aecf(_0x366ec4[_0x9ead('0x6')]());}else{if(_0x1fdd58){_0x423719(_0x1fdd58);}else{_0x25aecf(_0x9ead('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x3089=['exports','nodemailer','nodemailer-plugin-inline-base64','send','use','compile','sendMail','toString','prototype','createTransport','verify','Not\x20verifired'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x3089,0x1c9));var _0x9308=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x3089[_0x43d11d];return _0x38cd08;};'use strict';var nodemailer=require(_0x9308('0x0'));var inlineBase64=require(_0x9308('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x9308('0x2')]=function(_0x40c5b0,_0x33ec60){return new Promise(function(_0x143f74,_0x5d561f){var _0xc424bc=nodemailer['createTransport'](_0x40c5b0);_0xc424bc[_0x9308('0x3')](_0x9308('0x4'),inlineBase64());_0xc424bc[_0x9308('0x5')](_0x33ec60,function(_0x2a6dc1,_0x2cc7c0){if(_0x2a6dc1){_0x5d561f(_0x2a6dc1[_0x9308('0x6')]());}else{_0x143f74(_0x2cc7c0);}});});};EmailSmtp[_0x9308('0x7')]['verify']=function(_0x469766){return new Promise(function(_0x50c985,_0x251def){var _0x1fcb74=nodemailer[_0x9308('0x8')](_0x469766);_0x1fcb74[_0x9308('0x9')](function(_0x287dd3,_0x548e52){if(_0x287dd3){_0x251def(_0x287dd3[_0x9308('0x6')]());}else{if(_0x548e52){_0x50c985(_0x548e52);}else{_0x251def(_0x9308('0xa'));}}});});};module[_0x9308('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 999b2f4..bb42e3a 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 _0x21bb=['randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','address','anonymous','generate','name','indexOf','split','length','join','Anonymous','value','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','moment'];(function(_0x267be3,_0x18ef5f){var _0x57fe29=function(_0x5bb754){while(--_0x5bb754){_0x267be3['push'](_0x267be3['shift']());}};_0x57fe29(++_0x18ef5f);}(_0x21bb,0x12e));var _0xb21b=function(_0x2c1171,_0x3572d2){_0x2c1171=_0x2c1171-0x0;var _0x13f475=_0x21bb[_0x2c1171];return _0x13f475;};'use strict';var _=require(_0xb21b('0x0'));var moment=require(_0xb21b('0x1'));var random=require(_0xb21b('0x2'));var fs=require('fs');var path=require(_0xb21b('0x3'));var util=require(_0xb21b('0x4'));var tnef=require(_0xb21b('0x5'));var logger=require(_0xb21b('0x6'))('email');var config=require(_0xb21b('0x7'));function getAddress(_0x215fc4){var _0x5e9ef9=_[_0xb21b('0x8')](_0x215fc4['value']);return _0x5e9ef9&&_0x5e9ef9['address']?_0x5e9ef9[_0xb21b('0x9')]:_0xb21b('0xa')+random[_0xb21b('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x4c6265){var _0x127f82=_['head'](_0x4c6265['value']);if(_0x127f82&&_0x127f82[_0xb21b('0xc')]){if(_0x127f82['name']==_0x127f82[_0xb21b('0x9')]){return _0x127f82[_0xb21b('0xc')]['substring'](0x0,_0x127f82['name'][_0xb21b('0xd')]('@'));}var _0x43491c=_0x127f82[_0xb21b('0xc')][_0xb21b('0xe')](/\s+/);return _0x43491c[_0xb21b('0xf')]>0x1?_0x43491c['slice'](0x0,-0x1)[_0xb21b('0x10')]('\x20'):_0x127f82['name'];}return _0xb21b('0x11');}function getLastName(_0x374395){var _0x1ad41b=_[_0xb21b('0x8')](_0x374395[_0xb21b('0x12')]);if(_0x1ad41b&&_0x1ad41b[_0xb21b('0xc')]){var _0x1aec9c=_0x1ad41b[_0xb21b('0xc')][_0xb21b('0xe')](/\s+/);return _0x1aec9c['length']>0x1?_0x1aec9c[_0xb21b('0x13')]():'';}return'';}function getMails(_0x48c418,_0x57d52a){var _0x5ab638='';for(var _0x4a3556=0x0;_0x4a3556<_0x57d52a['value'][_0xb21b('0xf')];_0x4a3556+=0x1){if(_0x57d52a[_0xb21b('0x12')][_0x4a3556][_0xb21b('0x9')]!==_0x48c418){if(!_[_0xb21b('0x14')](_0x5ab638)){_0x5ab638+=',';}_0x5ab638+=_0x57d52a[_0xb21b('0x12')][_0x4a3556][_0xb21b('0xc')]||_0x57d52a['value'][_0x4a3556][_0xb21b('0x9')]||'';_0x5ab638+='\x20<';_0x5ab638+=_0x57d52a[_0xb21b('0x12')][_0x4a3556]['address']?_0x57d52a['value'][_0x4a3556]['address']:_0xb21b('0xa')+random[_0xb21b('0xb')](0x6)+'@xcally.com';_0x5ab638+='>';}}return _0x5ab638;}function parseEmail(_0x299bdf,_0x2c8d5e,_0x2e7463){if(_0x2c8d5e[_0xb21b('0x15')]){var _0x7e0f13=/)<[^<]*)*<\/script>/gi;while(_0x7e0f13[_0xb21b('0x16')](_0x2c8d5e[_0xb21b('0x15')])){_0x2c8d5e[_0xb21b('0x15')]=_0x2c8d5e[_0xb21b('0x15')][_0xb21b('0x17')](_0x7e0f13,'');}if(_0x2c8d5e[_0xb21b('0x15')][_0xb21b('0x18')](_0xb21b('0x19'))){var _0x4a719f=[];_0x2c8d5e[_0xb21b('0x1a')]['forEach'](_0x3e9b26=>{_0x4a719f[_0xb21b('0x1b')](_0x3e9b26[_0xb21b('0x1c')]);});var _0x27c8c2=/]+>/g;var _0x4d6f57=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x53a3f9=_0x2c8d5e[_0xb21b('0x15')][_0xb21b('0x17')](_0x4d6f57,_0xb21b('0x1d'));var _0x376441=_0x53a3f9[_0xb21b('0x17')](_0x27c8c2,_0xb21b('0x1e'));for(let _0x584252=0x0;_0x584252<_0x4a719f[_0xb21b('0xf')];_0x584252++){var _0x4f191b=_0x376441['replace'](_0xb21b('0x1e'),_0xb21b('0x1f')+_0x4a719f[_0x584252]+'\x20]');_0x376441=_0x4f191b;}_0x2c8d5e[_0xb21b('0x15')]=_0x376441;}_0x2e7463[_0xb21b('0x20')]=_0x2c8d5e[_0xb21b('0x15')];}else{_0x2e7463[_0xb21b('0x20')]=_0x2c8d5e[_0xb21b('0x21')];}if(_0x2e7463[_0xb21b('0x20')]){_0x2e7463[_0xb21b('0x20')]=_0x2e7463[_0xb21b('0x20')][_0xb21b('0x17')](/0x0){var _0x4fae7f=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0xb21b('0x34')];for(var _0xa5f031=0x0;_0xa5f031<_0x2c8d5e[_0xb21b('0x33')][_0xb21b('0xf')];_0xa5f031++){var _0x2d2c5a=_[_0xb21b('0xd')](_0x4fae7f,_0x2c8d5e['headerLines'][_0xa5f031][_0xb21b('0x35')]);if(_0x2d2c5a>=0x0){_0x2e7463['isAutoreply']=!![];}}}return _0x2e7463;}exports[_0xb21b('0x36')]=function(_0x942e10,_0x100aa0,_0x3f43e4){var _0x15bba7={'from':getAddress(_0x100aa0[_0xb21b('0x37')]),'firstName':getFirstName(_0x100aa0['from']),'lastName':getLastName(_0x100aa0[_0xb21b('0x37')]),'mapKey':_0xb21b('0x23'),'message':{'from':getMails(_0x942e10[_0xb21b('0x23')],_0x100aa0['from']),'to':_0x942e10[_0xb21b('0x23')],'cc':'','subject':_0x100aa0[_0xb21b('0x38')]||'','messageId':_0x100aa0[_0xb21b('0x39')],'inReplyTo':_0x100aa0[_0xb21b('0x3a')],'sentAt':moment(_0x100aa0[_0xb21b('0x3b')])['format'](_0xb21b('0x3c')),'attach':![],'attachments':[]}};if(!_0x100aa0[_0xb21b('0x15')]&&!_0x100aa0[_0xb21b('0x21')]){var _0x53e87f=_[_0xb21b('0x3d')](_0x100aa0[_0xb21b('0x1a')],{'contentType':_0xb21b('0x3e')});if(_0x53e87f['length']){logger[_0xb21b('0x3f')](util[_0xb21b('0x2b')](_0xb21b('0x40'),_0x100aa0['messageId']));tnef['parseBuffer'](_[_0xb21b('0x41')](_0x53e87f)[_0xb21b('0x31')],function(_0x1fbdd5,_0x330282){if(_0x330282){_0x100aa0[_0xb21b('0x15')]=_0x330282[_0xb21b('0x42')]||_0xb21b('0x43');if(_0x330282[_0xb21b('0x44')]){for(var _0x3058a1=0x0;_0x3058a1<_0x330282[_0xb21b('0x44')]['length'];_0x3058a1++){var _0x50b8f0=_0x330282[_0xb21b('0x44')][_0x3058a1];_0x15bba7[_0xb21b('0x24')][_0xb21b('0x1a')][_0xb21b('0x1b')]({'filename':_0x50b8f0[_0xb21b('0x45')],'content':Buffer[_0xb21b('0x37')](_0x50b8f0[_0xb21b('0x46')])});}}}_0x3f43e4(parseEmail(_0x942e10,_0x100aa0,_0x15bba7));});}else{_0x100aa0['html']='

Empty\x20message

';_0x3f43e4(parseEmail(_0x942e10,_0x100aa0,_0x15bba7));}}else{_0x3f43e4(parseEmail(_0x942e10,_0x100aa0,_0x15bba7));}};exports[_0xb21b('0x47')]=function(_0xb90771,_0x3105d9){var _0x551c58=[_0xb21b('0x48')+(_0x3105d9||''),_0xb21b('0x49')+_0xb90771,'',''];return Buffer['from'](_0x551c58[_0xb21b('0x10')](''),'utf-8')[_0xb21b('0x4a')](_0xb21b('0x4b'));}; \ No newline at end of file +var _0x38f6=['format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','parseBuffer','first','

Empty\x20message

','Attachments','Title','Data','user=','base64','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','name','substring','length','slice','join','Anonymous','split','pop','isEmpty','@xcally.com','test','replace','html','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x1d3d53[_0x638f('0xf')](0x0,-0x1)[_0x638f('0x10')]('\x20'):_0x194761[_0x638f('0xc')];}return _0x638f('0x11');}function getLastName(_0x1a44f){var _0x1801ad=_[_0x638f('0x7')](_0x1a44f[_0x638f('0x8')]);if(_0x1801ad&&_0x1801ad['name']){var _0x23d52b=_0x1801ad[_0x638f('0xc')][_0x638f('0x12')](/\s+/);return _0x23d52b[_0x638f('0xe')]>0x1?_0x23d52b[_0x638f('0x13')]():'';}return'';}function getMails(_0x2c1658,_0x53b320){var _0x1985f0='';for(var _0x3331ea=0x0;_0x3331ea<_0x53b320[_0x638f('0x8')][_0x638f('0xe')];_0x3331ea+=0x1){if(_0x53b320[_0x638f('0x8')][_0x3331ea]['address']!==_0x2c1658){if(!_[_0x638f('0x14')](_0x1985f0)){_0x1985f0+=',';}_0x1985f0+=_0x53b320['value'][_0x3331ea][_0x638f('0xc')]||_0x53b320['value'][_0x3331ea][_0x638f('0x9')]||'';_0x1985f0+='\x20<';_0x1985f0+=_0x53b320[_0x638f('0x8')][_0x3331ea][_0x638f('0x9')]?_0x53b320[_0x638f('0x8')][_0x3331ea]['address']:_0x638f('0xa')+random['generate'](0x6)+_0x638f('0x15');_0x1985f0+='>';}}return _0x1985f0;}function parseEmail(_0x56c5b9,_0x43d85d,_0x2b3b28){if(_0x43d85d['html']){var _0x5a29dc=/)<[^<]*)*<\/script>/gi;while(_0x5a29dc[_0x638f('0x16')](_0x43d85d['html'])){_0x43d85d['html']=_0x43d85d['html'][_0x638f('0x17')](_0x5a29dc,'');}if(_0x43d85d[_0x638f('0x18')][_0x638f('0x19')](_0x638f('0x1a'))){var _0x182581=[];_0x43d85d[_0x638f('0x1b')][_0x638f('0x1c')](_0x34aaab=>{_0x182581['push'](_0x34aaab[_0x638f('0x1d')]);});var _0x3fde53=/]+>/g;var _0x395116=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1653b4=_0x43d85d[_0x638f('0x18')][_0x638f('0x17')](_0x395116,_0x638f('0x1e'));var _0x32ad23=_0x1653b4[_0x638f('0x17')](_0x3fde53,_0x638f('0x1f'));for(let _0x3d0bad=0x0;_0x3d0bad<_0x182581[_0x638f('0xe')];_0x3d0bad++){var _0x9656d9=_0x32ad23[_0x638f('0x17')](_0x638f('0x1f'),_0x638f('0x20')+_0x182581[_0x3d0bad]+_0x638f('0x21'));_0x32ad23=_0x9656d9;}_0x43d85d['html']=_0x32ad23;}_0x2b3b28['body']=_0x43d85d[_0x638f('0x18')];}else{_0x2b3b28[_0x638f('0x22')]=_0x43d85d[_0x638f('0x23')];}if(_0x2b3b28[_0x638f('0x22')]){_0x2b3b28[_0x638f('0x22')]=_0x2b3b28[_0x638f('0x22')][_0x638f('0x17')](/0x0){var _0x21bc4a=[_0x638f('0x34'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0xff9c9b=0x0;_0xff9c9b<_0x43d85d[_0x638f('0x33')]['length'];_0xff9c9b++){var _0x29058d=_[_0x638f('0x35')](_0x21bc4a,_0x43d85d[_0x638f('0x33')][_0xff9c9b]['line']);if(_0x29058d>=0x0){_0x2b3b28[_0x638f('0x36')]=!![];}}}return _0x2b3b28;}exports[_0x638f('0x37')]=function(_0x1ef059,_0x3a49ee,_0x3ffde5){var _0x43c3df={'from':getAddress(_0x3a49ee[_0x638f('0x38')]),'firstName':getFirstName(_0x3a49ee['from']),'lastName':getLastName(_0x3a49ee[_0x638f('0x38')]),'mapKey':'email','message':{'from':getMails(_0x1ef059[_0x638f('0x6')],_0x3a49ee[_0x638f('0x38')]),'to':_0x1ef059['email'],'cc':'','subject':_0x3a49ee[_0x638f('0x39')]||'','messageId':_0x3a49ee[_0x638f('0x3a')],'inReplyTo':_0x3a49ee[_0x638f('0x3b')],'sentAt':moment(_0x3a49ee[_0x638f('0x3c')])[_0x638f('0x3d')](_0x638f('0x3e')),'attach':![],'attachments':[]}};if(!_0x3a49ee[_0x638f('0x18')]&&!_0x3a49ee[_0x638f('0x23')]){var _0x18087e=_[_0x638f('0x3f')](_0x3a49ee[_0x638f('0x1b')],{'contentType':_0x638f('0x40')});if(_0x18087e[_0x638f('0xe')]){logger['info'](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x3a49ee[_0x638f('0x3a')]));tnef[_0x638f('0x41')](_[_0x638f('0x42')](_0x18087e)['content'],function(_0x2c3085,_0x5425af){if(_0x5425af){_0x3a49ee['html']=_0x5425af['BodyHTML']||_0x638f('0x43');if(_0x5425af[_0x638f('0x44')]){for(var _0x13a653=0x0;_0x13a653<_0x5425af['Attachments']['length'];_0x13a653++){var _0x27e520=_0x5425af[_0x638f('0x44')][_0x13a653];_0x43c3df[_0x638f('0x26')]['attachments'][_0x638f('0x31')]({'filename':_0x27e520[_0x638f('0x45')],'content':Buffer[_0x638f('0x38')](_0x27e520[_0x638f('0x46')])});}}}_0x3ffde5(parseEmail(_0x1ef059,_0x3a49ee,_0x43c3df));});}else{_0x3a49ee['html']=_0x638f('0x43');_0x3ffde5(parseEmail(_0x1ef059,_0x3a49ee,_0x43c3df));}}else{_0x3ffde5(parseEmail(_0x1ef059,_0x3a49ee,_0x43c3df));}};exports['generateXOAuth2Token']=function(_0x9b2e43,_0x42b2f3){var _0x24fca6=[_0x638f('0x47')+(_0x42b2f3||''),'auth=Bearer\x20'+_0x9b2e43,'',''];return Buffer[_0x638f('0x38')](_0x24fca6[_0x638f('0x10')](''),'utf-8')['toString'](_0x638f('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 5237089..daebb0c 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 _0xa78e=['Smtp','lodash','name','Service','key','SERV','active','Imap'];(function(_0x17175f,_0x1b897a){var _0x3b5a70=function(_0x4ed57f){while(--_0x4ed57f){_0x17175f['push'](_0x17175f['shift']());}};_0x3b5a70(++_0x1b897a);}(_0xa78e,0x1b9));var _0xea78=function(_0x5f1941,_0x26138c){_0x5f1941=_0x5f1941-0x0;var _0x239b52=_0xa78e[_0x5f1941];return _0x239b52;};'use strict';var _=require(_0xea78('0x0'));function MailAccount(_0x1fbf5f){this['id']=_0x1fbf5f['id']||0x0;this['name']=_0x1fbf5f[_0xea78('0x1')]||_0xea78('0x2');this[_0xea78('0x3')]=_0x1fbf5f[_0xea78('0x3')]||_0xea78('0x4');this[_0xea78('0x5')]=_0x1fbf5f['active']||![];this[_0xea78('0x6')]=_0x1fbf5f[_0xea78('0x6')]||[];this[_0xea78('0x7')]=_0x1fbf5f['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x8edb=['name','Service','key','SERV','active','Imap','Smtp','exports','lodash'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x8edb,0x10d));var _0xb8ed=function(_0x38a241,_0x43d9e0){_0x38a241=_0x38a241-0x0;var _0x46bf97=_0x8edb[_0x38a241];return _0x46bf97;};'use strict';var _=require(_0xb8ed('0x0'));function MailAccount(_0x45b696){this['id']=_0x45b696['id']||0x0;this[_0xb8ed('0x1')]=_0x45b696['name']||_0xb8ed('0x2');this[_0xb8ed('0x3')]=_0x45b696[_0xb8ed('0x3')]||_0xb8ed('0x4');this[_0xb8ed('0x5')]=_0x45b696['active']||![];this[_0xb8ed('0x6')]=_0x45b696['Imap']||[];this[_0xb8ed('0x7')]=_0x45b696['Smtp']||[];}module[_0xb8ed('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 a07bd2b..92e40fe 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 _0xb6fa=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6fa,0x83));var _0xab6f=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0xb6fa[_0x163040];return _0x364667;};'use strict';var _=require(_0xab6f('0x0'));var MailAccount=require(_0xab6f('0x1'));var Realtime=function(){this[_0xab6f('0x2')]={};};function freeIsNotKey(_0xc3559c,_0x4498c9,_0xaba21d){var _0x480bec=_[_0xab6f('0x3')](_0xc3559c,function(_0x2f4570,_0xfa5e7e){return _0x2f4570[_0xaba21d];});for(var _0x21825a in _0x4498c9){if(_0x4498c9[_0xab6f('0x4')](_0x21825a)){if(!_0x480bec[_0x21825a]){delete _0x4498c9[_0x21825a];}}}}Realtime[_0xab6f('0x5')][_0xab6f('0x6')]=function(_0x4ef891,_0x202297){for(var _0x293c62 in _0x202297){if(_0x4ef891[_0xab6f('0x4')](_0x293c62)){_0x4ef891[_0x293c62]=_0x202297[_0x293c62];}}};Realtime[_0xab6f('0x5')]['initMailAccounts']=function(){var _0x4509f3=this;return function(_0x355396){if(_0x355396){freeIsNotKey(_0x355396,_0x4509f3['mailAccounts'],'id');for(var _0x552894=0x0,_0x42d238={},_0x351da0={};_0x552894<_0x355396[_0xab6f('0x7')];_0x552894+=0x1){_0x42d238=_0x355396[_0x552894];if(_[_0xab6f('0x8')](_0x4509f3[_0xab6f('0x2')][_0x42d238['id']])){_0x4509f3[_0xab6f('0x2')][_0x42d238['id']]=new MailAccount(_0x42d238);}else{_['merge'](_0x4509f3[_0xab6f('0x2')][_0x42d238['id']],_0x42d238);}}}return _0x4509f3[_0xab6f('0x2')];};};module[_0xab6f('0x9')]=Realtime; \ No newline at end of file +var _0x4e53=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x3f889a,_0x4f6dbb){var _0x5593db=function(_0x4ee959){while(--_0x4ee959){_0x3f889a['push'](_0x3f889a['shift']());}};_0x5593db(++_0x4f6dbb);}(_0x4e53,0x1aa));var _0x34e5=function(_0x16afae,_0x56e1eb){_0x16afae=_0x16afae-0x0;var _0x231601=_0x4e53[_0x16afae];return _0x231601;};'use strict';var _=require(_0x34e5('0x0'));var MailAccount=require(_0x34e5('0x1'));var Realtime=function(){this[_0x34e5('0x2')]={};};function freeIsNotKey(_0x3c3b68,_0x2daa78,_0x4b3fe1){var _0x2482df=_[_0x34e5('0x3')](_0x3c3b68,function(_0x544dcb,_0x501c07){return _0x544dcb[_0x4b3fe1];});for(var _0x48156a in _0x2daa78){if(_0x2daa78[_0x34e5('0x4')](_0x48156a)){if(!_0x2482df[_0x48156a]){delete _0x2daa78[_0x48156a];}}}}Realtime[_0x34e5('0x5')][_0x34e5('0x6')]=function(_0x142cd9,_0x4f99e7){for(var _0x90026d in _0x4f99e7){if(_0x142cd9[_0x34e5('0x4')](_0x90026d)){_0x142cd9[_0x90026d]=_0x4f99e7[_0x90026d];}}};Realtime[_0x34e5('0x5')][_0x34e5('0x7')]=function(){var _0x51e3ca=this;return function(_0x25a149){if(_0x25a149){freeIsNotKey(_0x25a149,_0x51e3ca[_0x34e5('0x2')],'id');for(var _0x5e2672=0x0,_0x325add={},_0x1979c8={};_0x5e2672<_0x25a149['length'];_0x5e2672+=0x1){_0x325add=_0x25a149[_0x5e2672];if(_[_0x34e5('0x8')](_0x51e3ca[_0x34e5('0x2')][_0x325add['id']])){_0x51e3ca[_0x34e5('0x2')][_0x325add['id']]=new MailAccount(_0x325add);}else{_[_0x34e5('0x9')](_0x51e3ca[_0x34e5('0x2')][_0x325add['id']],_0x325add);}}}return _0x51e3ca['mailAccounts'];};};module[_0x34e5('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 3b2db35..41183d3 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 _0x1267=['NotifyMailAccount','../client','getMailAccounts','name','provider','service','email','active','key','ListId','MailServerIn','Imap','CloudProvider','type','Smtp','getMailAccount','notify','Request'];(function(_0x50f1ba,_0x530106){var _0x3c73ce=function(_0x37341c){while(--_0x37341c){_0x50f1ba['push'](_0x50f1ba['shift']());}};_0x3c73ce(++_0x530106);}(_0x1267,0xb5));var _0x7126=function(_0x38e85f,_0x424b88){_0x38e85f=_0x38e85f-0x0;var _0x5de9cf=_0x1267[_0x38e85f];return _0x5de9cf;};'use strict';var client=require(_0x7126('0x0'));exports[_0x7126('0x1')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x7126('0x2'),_0x7126('0x3'),_0x7126('0x4'),_0x7126('0x5'),_0x7126('0x6'),_0x7126('0x7'),_0x7126('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0x7126('0x9'),'as':_0x7126('0xa'),'include':[{'model':_0x7126('0xb'),'attributes':['id',_0x7126('0x2'),'service',_0x7126('0xc'),'data5'],'as':_0x7126('0xb')}]},{'model':'MailServerOut','as':_0x7126('0xd'),'include':[{'model':_0x7126('0xb'),'attributes':['id',_0x7126('0x2'),_0x7126('0x4'),_0x7126('0xc'),'data5'],'as':'CloudProvider'}]}]},'log':_0x7126('0xe')});};};exports[_0x7126('0xf')]=function(_0x34d819,_0x433b90){return client[_0x7126('0x10')](_0x7126('0x11'),{'account':{'id':_0x34d819},'body':_0x433b90,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x53fa=['Imap','CloudProvider','service','type','data5','MailServerOut','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','key','ListId'];(function(_0x5eca45,_0x321d2a){var _0x3ba8b5=function(_0x35e9f1){while(--_0x35e9f1){_0x5eca45['push'](_0x5eca45['shift']());}};_0x3ba8b5(++_0x321d2a);}(_0x53fa,0x1ac));var _0xa53f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53fa[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa53f('0x0'));exports[_0xa53f('0x1')]=function(){return function(){return client['Request'](_0xa53f('0x2'),{'options':{'attributes':['id',_0xa53f('0x3'),'provider','service','email','active',_0xa53f('0x4'),_0xa53f('0x5'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0xa53f('0x6'),'include':[{'model':_0xa53f('0x7'),'attributes':['id','name',_0xa53f('0x8'),_0xa53f('0x9'),_0xa53f('0xa')],'as':_0xa53f('0x7')}]},{'model':_0xa53f('0xb'),'as':'Smtp','include':[{'model':_0xa53f('0x7'),'attributes':['id',_0xa53f('0x3'),'service',_0xa53f('0x9'),'data5'],'as':_0xa53f('0x7')}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x5526c5,_0x4860ed){return client[_0xa53f('0xc')](_0xa53f('0xd'),{'account':{'id':_0x5526c5},'body':_0x4860ed,'log':_0xa53f('0xd')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 1a62a16..95feee4 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 _0x5b06=['loginMailFrequency','GetSettings','../client','ShowSetting'];(function(_0x3d4a59,_0x13c369){var _0x2a3815=function(_0x57a27d){while(--_0x57a27d){_0x3d4a59['push'](_0x3d4a59['shift']());}};_0x2a3815(++_0x13c369);}(_0x5b06,0xa2));var _0x65b0=function(_0x1dafff,_0x3c359f){_0x1dafff=_0x1dafff-0x0;var _0x252b4a=_0x5b06[_0x1dafff];return _0x252b4a;};'use strict';var client=require(_0x65b0('0x0'));exports['getSettings']=function(){return client['Request'](_0x65b0('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x65b0('0x2')]},'log':_0x65b0('0x3')});}; \ No newline at end of file +var _0x2a6e=['../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x5a0714,_0x69fab5){var _0x1a16e2=function(_0x6ee137){while(--_0x6ee137){_0x5a0714['push'](_0x5a0714['shift']());}};_0x1a16e2(++_0x69fab5);}(_0x2a6e,0xcd));var _0xe2a6=function(_0x3bfd04,_0x4872bc){_0x3bfd04=_0x3bfd04-0x0;var _0x2d4a74=_0x2a6e[_0x3bfd04];return _0x2d4a74;};'use strict';var client=require(_0xe2a6('0x0'));exports[_0xe2a6('0x1')]=function(){return client[_0xe2a6('0x2')](_0xe2a6('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe2a6('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index ba9bb7f..9b8f77a 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 ac3b426..c93a56b 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 _0x4d62=['default','../../config/socketio','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','adapter'];(function(_0x121d20,_0x2246fb){var _0x5ef5a8=function(_0x410951){while(--_0x410951){_0x121d20['push'](_0x121d20['shift']());}};_0x5ef5a8(++_0x2246fb);}(_0x4d62,0x170));var _0x24d6=function(_0x366901,_0x368a5c){_0x366901=_0x366901-0x0;var _0x175090=_0x4d62[_0x366901];return _0x175090;};'use strict';var _=require(_0x24d6('0x0'));var http=require('http');var express=require(_0x24d6('0x1'));var sticky=require(_0x24d6('0x2'));var Redis=require(_0x24d6('0x3'));var config=require(_0x24d6('0x4'));var app=express();var server=http[_0x24d6('0x5')](app);server[_0x24d6('0x6')]=0xdbba0;if(sticky[_0x24d6('0x7')](server,config[_0x24d6('0x8')])){var socketio=require(_0x24d6('0x9'))(server,{'transports':[_0x24d6('0xa'),_0x24d6('0xb')]});config[_0x24d6('0xc')]=_[_0x24d6('0xd')](config['redis'],{'host':_0x24d6('0xe'),'port':0x18eb});socketio[_0x24d6('0xf')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x24d6('0xc')])}));require('../../config/triggers')[_0x24d6('0x10')]();require(_0x24d6('0x11'))[_0x24d6('0x10')](socketio);require(_0x24d6('0x12'))[_0x24d6('0x10')](app);require(_0x24d6('0x13'))['default'](app);}else{server[_0x24d6('0x14')]('listening',function(){console[_0x24d6('0x15')](_0x24d6('0x16'),config[_0x24d6('0x8')]);});}exports=module[_0x24d6('0x17')]=app; \ No newline at end of file +var _0xd6f8=['once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','sticky-session','../../config/environment','createServer','timeout','port','socket.io','websocket','polling','defaults','redis','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes'];(function(_0x1a9ba5,_0x3cf983){var _0x116696=function(_0x51f895){while(--_0x51f895){_0x1a9ba5['push'](_0x1a9ba5['shift']());}};_0x116696(++_0x3cf983);}(_0xd6f8,0x139));var _0x8d6f=function(_0x163807,_0x558cfa){_0x163807=_0x163807-0x0;var _0x535b97=_0xd6f8[_0x163807];return _0x535b97;};'use strict';var _=require(_0x8d6f('0x0'));var http=require('http');var express=require('express');var sticky=require(_0x8d6f('0x1'));var Redis=require('ioredis');var config=require(_0x8d6f('0x2'));var app=express();var server=http[_0x8d6f('0x3')](app);server[_0x8d6f('0x4')]=0xdbba0;if(sticky['listen'](server,config[_0x8d6f('0x5')])){var socketio=require(_0x8d6f('0x6'))(server,{'transports':[_0x8d6f('0x7'),_0x8d6f('0x8')]});config['redis']=_[_0x8d6f('0x9')](config[_0x8d6f('0xa')],{'host':_0x8d6f('0xb'),'port':0x18eb});socketio['adapter'](require(_0x8d6f('0xc'))({'pubClient':new Redis(config[_0x8d6f('0xa')]),'subClient':new Redis(config[_0x8d6f('0xa')])}));require(_0x8d6f('0xd'))[_0x8d6f('0xe')]();require(_0x8d6f('0xf'))[_0x8d6f('0xe')](socketio);require('../../config/express')['default'](app);require(_0x8d6f('0x10'))[_0x8d6f('0xe')](app);}else{server[_0x8d6f('0x11')](_0x8d6f('0x12'),function(){console[_0x8d6f('0x13')](_0x8d6f('0x14'),config['port']);});}exports=module[_0x8d6f('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 7346710..4c04951 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 _0xcbfb=['result','catch','rpc','exports','bluebird','../../config/logger','routing','client','http','request','then','error','message'];(function(_0x58ad27,_0x365bf3){var _0x474aa0=function(_0x5f03e9){while(--_0x5f03e9){_0x58ad27['push'](_0x58ad27['shift']());}};_0x474aa0(++_0x365bf3);}(_0xcbfb,0xee));var _0xbcbf=function(_0x486d39,_0x5d0a15){_0x486d39=_0x486d39-0x0;var _0x53b5c4=_0xcbfb[_0x486d39];return _0x53b5c4;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xbcbf('0x0'));var logger=require(_0xbcbf('0x1'))(_0xbcbf('0x2'));var client=jayson[_0xbcbf('0x3')][_0xbcbf('0x4')]({'port':0x2329});client['Request']=function(_0x5cb875,_0x1852c3){return new BPromise(function(_0x2b5741,_0x16e0cc){return client[_0xbcbf('0x5')](_0x5cb875,_0x1852c3)[_0xbcbf('0x6')](function(_0x267f7b){logger['debug']('rpc',_0xbcbf('0x2'),_0x5cb875,_0x1852c3,_0x267f7b);if(_0x267f7b['error']){logger[_0xbcbf('0x7')]('rpc',_0xbcbf('0x2'),_0x5cb875,_0x267f7b[_0xbcbf('0x7')][_0xbcbf('0x8')],_0x1852c3);return _0x16e0cc(_0x267f7b[_0xbcbf('0x7')][_0xbcbf('0x8')]);}else{return _0x2b5741(_0x267f7b[_0xbcbf('0x9')]);}})[_0xbcbf('0xa')](function(_0x29d70){logger[_0xbcbf('0x7')](_0xbcbf('0xb'),_0xbcbf('0x2'),_0x5cb875,_0x29d70,_0x1852c3);return _0x16e0cc(_0x29d70);});});};module[_0xbcbf('0xc')]=client; \ No newline at end of file +var _0xb260=['jayson/promise','../../config/logger','routing','client','Request','request','debug','error','result','rpc','exports'];(function(_0x14f458,_0x5dd219){var _0x4ff2da=function(_0x473b86){while(--_0x473b86){_0x14f458['push'](_0x14f458['shift']());}};_0x4ff2da(++_0x5dd219);}(_0xb260,0x1ef));var _0x0b26=function(_0xf342c1,_0x527191){_0xf342c1=_0xf342c1-0x0;var _0x1ea8d8=_0xb260[_0xf342c1];return _0x1ea8d8;};'use strict';var jayson=require(_0x0b26('0x0'));var BPromise=require('bluebird');var logger=require(_0x0b26('0x1'))(_0x0b26('0x2'));var client=jayson[_0x0b26('0x3')]['http']({'port':0x2329});client[_0x0b26('0x4')]=function(_0x29f45c,_0x5243cc){return new BPromise(function(_0xa97581,_0x533b34){return client[_0x0b26('0x5')](_0x29f45c,_0x5243cc)['then'](function(_0x35d7b3){logger[_0x0b26('0x6')]('rpc',_0x0b26('0x2'),_0x29f45c,_0x5243cc,_0x35d7b3);if(_0x35d7b3[_0x0b26('0x7')]){logger[_0x0b26('0x7')]('rpc',_0x0b26('0x2'),_0x29f45c,_0x35d7b3[_0x0b26('0x7')]['message'],_0x5243cc);return _0x533b34(_0x35d7b3[_0x0b26('0x7')]['message']);}else{return _0xa97581(_0x35d7b3[_0x0b26('0x8')]);}})['catch'](function(_0x3e8817){logger[_0x0b26('0x7')](_0x0b26('0x9'),_0x0b26('0x2'),_0x29f45c,_0x3e8817,_0x5243cc);return _0x533b34(_0x3e8817);});});};module[_0x0b26('0xa')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index fd89549..c8dd432 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 _0x05a8=['getMailQueues','initMailQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues'];(function(_0x6a21e4,_0x197004){var _0x2cf1dd=function(_0x44c4b4){while(--_0x44c4b4){_0x6a21e4['push'](_0x6a21e4['shift']());}};_0x2cf1dd(++_0x197004);}(_0x05a8,0x119));var _0x805a=function(_0x5c2c9a,_0x334e3e){_0x5c2c9a=_0x5c2c9a-0x0;var _0x49445a=_0x05a8[_0x5c2c9a];return _0x49445a;};'use strict';var BPromise=require(_0x805a('0x0'));var server=require(_0x805a('0x1'));var Realtime=require(_0x805a('0x2'));var user=require(_0x805a('0x3'));var interval=require(_0x805a('0x4'));var openchannelQueue=require(_0x805a('0x5'));var chatQueue=require(_0x805a('0x6'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x805a('0x7'));var faxQueue=require(_0x805a('0x8'));var whatsappQueue=require(_0x805a('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x805a('0xa')]()[_0x805a('0xb')](user[_0x805a('0xc')]())[_0x805a('0xb')](realtime['initAgents']())[_0x805a('0xb')](interval[_0x805a('0xd')]())[_0x805a('0xb')](realtime['initIntervals']())[_0x805a('0xb')](openchannelQueue[_0x805a('0xe')]())[_0x805a('0xb')](realtime[_0x805a('0xf')]())[_0x805a('0xb')](chatQueue[_0x805a('0x10')]())[_0x805a('0xb')](realtime[_0x805a('0x11')]())[_0x805a('0xb')](smsQueue['getSmsQueues']())[_0x805a('0xb')](realtime[_0x805a('0x12')]())[_0x805a('0xb')](mailQueue[_0x805a('0x13')]())['then'](realtime[_0x805a('0x14')]())[_0x805a('0xb')](faxQueue['getFaxQueues']())['then'](realtime['initFaxQueues']())[_0x805a('0xb')](whatsappQueue[_0x805a('0x15')]())['then'](realtime[_0x805a('0x16')]())['then'](function(){return realtime;});}function main(){return server[_0x805a('0x17')](realtime)['then'](function(_0x216aed){return initRealtime();})[_0x805a('0xb')](function(_0x28a3ee){return setInterval(initRealtime,0x1388);})[_0x805a('0x18')](function(_0x257b1d){console['log'](_0x257b1d);});}main(); \ No newline at end of file +var _0xd4ef=['initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues'];(function(_0x43fcb1,_0x57c618){var _0x3ac394=function(_0x33789e){while(--_0x33789e){_0x43fcb1['push'](_0x43fcb1['shift']());}};_0x3ac394(++_0x57c618);}(_0xd4ef,0x14c));var _0xfd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ef[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var server=require(_0xfd4e('0x0'));var Realtime=require(_0xfd4e('0x1'));var user=require(_0xfd4e('0x2'));var interval=require(_0xfd4e('0x3'));var openchannelQueue=require(_0xfd4e('0x4'));var chatQueue=require(_0xfd4e('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xfd4e('0x6'));var faxQueue=require(_0xfd4e('0x7'));var whatsappQueue=require(_0xfd4e('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xfd4e('0x9')]()[_0xfd4e('0xa')](user[_0xfd4e('0xb')]())[_0xfd4e('0xa')](realtime[_0xfd4e('0xc')]())[_0xfd4e('0xa')](interval[_0xfd4e('0xd')]())[_0xfd4e('0xa')](realtime[_0xfd4e('0xe')]())[_0xfd4e('0xa')](openchannelQueue['getOpenchannelQueues']())[_0xfd4e('0xa')](realtime[_0xfd4e('0xf')]())[_0xfd4e('0xa')](chatQueue[_0xfd4e('0x10')]())[_0xfd4e('0xa')](realtime[_0xfd4e('0x11')]())[_0xfd4e('0xa')](smsQueue[_0xfd4e('0x12')]())['then'](realtime[_0xfd4e('0x13')]())[_0xfd4e('0xa')](mailQueue[_0xfd4e('0x14')]())[_0xfd4e('0xa')](realtime['initMailQueues']())[_0xfd4e('0xa')](faxQueue[_0xfd4e('0x15')]())['then'](realtime[_0xfd4e('0x16')]())[_0xfd4e('0xa')](whatsappQueue[_0xfd4e('0x17')]())['then'](realtime[_0xfd4e('0x18')]())[_0xfd4e('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xfd4e('0xa')](function(_0x4ca467){return initRealtime();})[_0xfd4e('0xa')](function(_0x16fd74){return setInterval(initRealtime,0x1388);})[_0xfd4e('0x19')](function(_0x2013c3){console[_0xfd4e('0x1a')](_0x2013c3);});}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 0c36a9e..766a917 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 _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x278933,_0x134464){var _0x3ba076=function(_0x1a1770){while(--_0x1a1770){_0x278933['push'](_0x278933['shift']());}};_0x3ba076(++_0x134464);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x5fc3[_0x4226d6];return _0x19655b;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x3a9349,_0xdb8806){var _0x2c924b=function(_0x2cbfd8){while(--_0x2cbfd8){_0x3a9349['push'](_0x3a9349['shift']());}};_0x2c924b(++_0xdb8806);}(_0x814b,0x1a2));var _0xb814=function(_0x2d2e85,_0x22faa9){_0x2d2e85=_0x2d2e85-0x0;var _0x3e9f5e=_0x814b[_0x2d2e85];return _0x3e9f5e;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 20aa46a..388c857 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 _0x7947=['jayson/promise','client','http','request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x5c58e4,_0x1c1210){var _0x56cb51=function(_0x2ea8fc){while(--_0x2ea8fc){_0x5c58e4['push'](_0x5c58e4['shift']());}};_0x56cb51(++_0x1c1210);}(_0x7947,0x17f));var _0x7794=function(_0xe021ca,_0xde1bcf){_0xe021ca=_0xe021ca-0x0;var _0x4e8f4=_0x7947[_0xe021ca];return _0x4e8f4;};'use strict';var BPromise=require(_0x7794('0x0'));var jayson=require(_0x7794('0x1'));var client=jayson[_0x7794('0x2')][_0x7794('0x3')]({'port':0x232b});function request(_0x4ff3fe,_0x1c1847){return new BPromise(function(_0x3f68cb,_0x1e6dec){return client[_0x7794('0x4')](_0x4ff3fe,_0x1c1847)[_0x7794('0x5')](function(_0x28e3de){if(_0x28e3de[_0x7794('0x6')]){return _0x1e6dec(_0x28e3de[_0x7794('0x6')][_0x7794('0x7')]);}else{return _0x3f68cb(_0x28e3de[_0x7794('0x8')]);}})[_0x7794('0x9')](function(_0x3e711f){return _0x1e6dec(_0x3e711f);});});}exports[_0x7794('0xa')]=function(_0x99e2bb,_0x3e7842){return request(_0x7794('0xb'),{'account':_0x99e2bb,'message':_0x3e7842});}; \ No newline at end of file +var _0xf696=['SendMail','bluebird','jayson/promise','client','request','error','catch','sendMailMessage'];(function(_0x10f705,_0x41770d){var _0x2dcf50=function(_0x5b219e){while(--_0x5b219e){_0x10f705['push'](_0x10f705['shift']());}};_0x2dcf50(++_0x41770d);}(_0xf696,0x1d1));var _0x6f69=function(_0x3d4c7f,_0x225345){_0x3d4c7f=_0x3d4c7f-0x0;var _0x3bfa82=_0xf696[_0x3d4c7f];return _0x3bfa82;};'use strict';var BPromise=require(_0x6f69('0x0'));var jayson=require(_0x6f69('0x1'));var client=jayson[_0x6f69('0x2')]['http']({'port':0x232b});function request(_0x5c0958,_0x18e472){return new BPromise(function(_0x1490fb,_0x25ebdb){return client[_0x6f69('0x3')](_0x5c0958,_0x18e472)['then'](function(_0x2fae35){if(_0x2fae35[_0x6f69('0x4')]){return _0x25ebdb(_0x2fae35[_0x6f69('0x4')]['message']);}else{return _0x1490fb(_0x2fae35['result']);}})[_0x6f69('0x5')](function(_0x1df490){return _0x25ebdb(_0x1df490);});});}exports[_0x6f69('0x6')]=function(_0x2b9f63,_0x252e35){return request(_0x6f69('0x7'),{'account':_0x2b9f63,'message':_0x252e35});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 779db7e..929259e 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 _0xcf03=['toNumber','format','smsStatus','whatsappStatusTime','faxWaitingInteractions','stringify','md5','emit','user:save','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','mail','chat','openchannel','sms','Status'];(function(_0x3e7b86,_0x3a4c16){var _0x56ef5d=function(_0x29c0f0){while(--_0x29c0f0){_0x3e7b86['push'](_0x3e7b86['shift']());}};_0x56ef5d(++_0x3a4c16);}(_0xcf03,0xc0));var _0x3cf0=function(_0x41aaa5,_0x5cd2b3){_0x41aaa5=_0x41aaa5-0x0;var _0x7bbfec=_0xcf03[_0x41aaa5];return _0x7bbfec;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require('md5');var Redis=require(_0x3cf0('0x0'));var config=require(_0x3cf0('0x1'));config[_0x3cf0('0x2')]=_['defaults'](config[_0x3cf0('0x2')],{'host':_0x3cf0('0x3'),'port':0x18eb});var io=require(_0x3cf0('0x4'))(new Redis(config['redis']));function Agent(_0x3d65ad){this['id']=_0x3d65ad['id']||0x0;this[_0x3cf0('0x5')]=_0x3d65ad['name']||'';this[_0x3cf0('0x6')]=_0x3d65ad[_0x3cf0('0x6')]||!![];this[_0x3cf0('0x7')]=_0x3d65ad['voicePause']||![];this[_0x3cf0('0x8')]=_0x3d65ad[_0x3cf0('0x8')]||![];this[_0x3cf0('0x9')]=_0x3d65ad['mailPause']||![];this[_0x3cf0('0xa')]=_0x3d65ad[_0x3cf0('0xa')]||![];this[_0x3cf0('0xb')]=_0x3d65ad[_0x3cf0('0xb')]||![];this[_0x3cf0('0xc')]=_0x3d65ad[_0x3cf0('0xc')]||![];this[_0x3cf0('0xd')]='unknown';this[_0x3cf0('0xe')]=0x0;this[_0x3cf0('0xf')]=_0x3d65ad[_0x3cf0('0xf')]||0x0;this[_0x3cf0('0x10')]=0x0;this[_0x3cf0('0x11')]=_0x3cf0('0x12');this[_0x3cf0('0x13')]=0x0;this[_0x3cf0('0x14')]=_0x3d65ad[_0x3cf0('0x14')]||0x0;this[_0x3cf0('0x15')]=0x0;this[_0x3cf0('0x16')]='unknown';this[_0x3cf0('0x17')]=0x0;this[_0x3cf0('0x18')]=_0x3d65ad[_0x3cf0('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0x3cf0('0x12');this[_0x3cf0('0x19')]=0x0;this[_0x3cf0('0x1a')]=_0x3d65ad[_0x3cf0('0x1a')]||0x0;this[_0x3cf0('0x1b')]=0x0;this[_0x3cf0('0x1c')]='unknown';this['whatsappStatusTime']=0x0;this[_0x3cf0('0x1d')]=_0x3d65ad[_0x3cf0('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x3cf0('0x12');this[_0x3cf0('0x1e')]=0x0;this[_0x3cf0('0x1f')]=_0x3d65ad[_0x3cf0('0x1f')]||0x0;this[_0x3cf0('0x20')]=0x0;this[_0x3cf0('0x21')]=![];this[_0x3cf0('0x22')]=undefined;this['md5']='';this[_0x3cf0('0x23')]={};this['faxWaitingInteractions']={};this[_0x3cf0('0x24')]={};this[_0x3cf0('0x25')]={};this[_0x3cf0('0x26')]={};this[_0x3cf0('0x27')]={};this[_0x3cf0('0x28')]();}Agent[_0x3cf0('0x29')][_0x3cf0('0x2a')]=function(_0x692f23){if(this[_0x692f23+'CurrentCapacity']>0x0){if(this[_0x692f23+_0x3cf0('0x2b')]>0x0&&this[_0x692f23+_0x3cf0('0x2c')]>=this[_0x692f23+_0x3cf0('0x2b')]){return _0x3cf0('0x2d');}else{return _0x3cf0('0x2e');}}else{return'idle';}};Agent[_0x3cf0('0x29')][_0x3cf0('0x28')]=function(){var _0x4ab41b=[_0x3cf0('0x2f'),_0x3cf0('0x30'),_0x3cf0('0x31'),'fax',_0x3cf0('0x32'),'whatsapp'];for(var _0xb83939=0x0;_0xb83939<_0x4ab41b['length'];_0xb83939+=0x1){var _0x494f64=this[_0x3cf0('0x2a')](_0x4ab41b[_0xb83939]);if(this[_0x4ab41b[_0xb83939]+_0x3cf0('0x33')]!==_0x494f64){this[_0x4ab41b[_0xb83939]+'StatusTime']=_[_0x3cf0('0x34')](moment()[_0x3cf0('0x35')]('x'));}this[_0x4ab41b[_0xb83939]+_0x3cf0('0x33')]=_0x494f64;}var _0x2e66e6={'id':this['id'],'name':this['name'],'online':this[_0x3cf0('0x6')],'voicePause':this[_0x3cf0('0x7')],'chatPause':this['chatPause'],'mailPause':this[_0x3cf0('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0x3cf0('0xa')],'openchannelPause':this[_0x3cf0('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x3cf0('0xf')],'chatCurrentCapacity':this[_0x3cf0('0x10')],'mailStatus':this[_0x3cf0('0x11')],'mailStatusTime':this[_0x3cf0('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x3cf0('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x3cf0('0x17')],'faxCapacity':this[_0x3cf0('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x3cf0('0x36')],'smsStatusTime':this[_0x3cf0('0x19')],'smsCapacity':this[_0x3cf0('0x1a')],'smsCurrentCapacity':this[_0x3cf0('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x3cf0('0x37')],'whatsappCapacity':this[_0x3cf0('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x3cf0('0x20')],'busy':this['busy'],'busyQueue':this[_0x3cf0('0x22')],'chatWaitingInteractions':this[_0x3cf0('0x23')],'faxWaitingInteractions':this[_0x3cf0('0x38')],'mailWaitingInteractions':this[_0x3cf0('0x24')],'openchannelWaitingInteractions':this[_0x3cf0('0x25')],'smsWaitingInteractions':this[_0x3cf0('0x26')],'whatsappWaitingInteractions':this[_0x3cf0('0x27')]};var _0x2217cc=md5(JSON[_0x3cf0('0x39')](_0x2e66e6));if(this[_0x3cf0('0x3a')]!==_0x2217cc){this[_0x3cf0('0x3a')]=_0x2217cc;io[_0x3cf0('0x3b')](_0x3cf0('0x3c'),_0x2e66e6);}};module['exports']=Agent; \ No newline at end of file +var _0x6ce8=['StatusTime','toNumber','format','mailStatusTime','faxStatus','whatsappStatusTime','busyQueue','emit','user:save','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','prototype','getChannelStatus','Capacity','maxcapacity','updateRealtime','mail','chat','openchannel','whatsapp','Status'];(function(_0x2c7762,_0x1245d0){var _0x468e75=function(_0xfaff5){while(--_0xfaff5){_0x2c7762['push'](_0x2c7762['shift']());}};_0x468e75(++_0x1245d0);}(_0x6ce8,0x1b4));var _0x86ce=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x6ce8[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x86ce('0x0'));var moment=require(_0x86ce('0x1'));var md5=require(_0x86ce('0x2'));var Redis=require(_0x86ce('0x3'));var config=require(_0x86ce('0x4'));config[_0x86ce('0x5')]=_[_0x86ce('0x6')](config[_0x86ce('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x86ce('0x7'))(new Redis(config[_0x86ce('0x5')]));function Agent(_0xd147d0){this['id']=_0xd147d0['id']||0x0;this[_0x86ce('0x8')]=_0xd147d0[_0x86ce('0x8')]||'';this[_0x86ce('0x9')]=_0xd147d0[_0x86ce('0x9')]||!![];this[_0x86ce('0xa')]=_0xd147d0['voicePause']||![];this['chatPause']=_0xd147d0[_0x86ce('0xb')]||![];this[_0x86ce('0xc')]=_0xd147d0[_0x86ce('0xc')]||![];this[_0x86ce('0xd')]=_0xd147d0['faxPause']||![];this[_0x86ce('0xe')]=_0xd147d0['smsPause']||![];this[_0x86ce('0xf')]=_0xd147d0[_0x86ce('0xf')]||![];this[_0x86ce('0x10')]=_0x86ce('0x11');this[_0x86ce('0x12')]=0x0;this[_0x86ce('0x13')]=_0xd147d0['chatCapacity']||0x0;this[_0x86ce('0x14')]=0x0;this[_0x86ce('0x15')]=_0x86ce('0x11');this['mailStatusTime']=0x0;this[_0x86ce('0x16')]=_0xd147d0['mailCapacity']||0x0;this[_0x86ce('0x17')]=0x0;this['faxStatus']=_0x86ce('0x11');this[_0x86ce('0x18')]=0x0;this[_0x86ce('0x19')]=_0xd147d0[_0x86ce('0x19')]||0x0;this[_0x86ce('0x1a')]=0x0;this[_0x86ce('0x1b')]=_0x86ce('0x11');this[_0x86ce('0x1c')]=0x0;this[_0x86ce('0x1d')]=_0xd147d0['smsCapacity']||0x0;this[_0x86ce('0x1e')]=0x0;this['whatsappStatus']=_0x86ce('0x11');this['whatsappStatusTime']=0x0;this[_0x86ce('0x1f')]=_0xd147d0['whatsappCapacity']||0x0;this[_0x86ce('0x20')]=0x0;this[_0x86ce('0x21')]=_0x86ce('0x11');this[_0x86ce('0x22')]=0x0;this['openchannelCapacity']=_0xd147d0[_0x86ce('0x23')]||0x0;this[_0x86ce('0x24')]=0x0;this['busy']=![];this['busyQueue']=undefined;this['md5']='';this[_0x86ce('0x25')]={};this[_0x86ce('0x26')]={};this[_0x86ce('0x27')]={};this[_0x86ce('0x28')]={};this[_0x86ce('0x29')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0x86ce('0x2a')][_0x86ce('0x2b')]=function(_0x5d3fa7){if(this[_0x5d3fa7+'CurrentCapacity']>0x0){if(this[_0x5d3fa7+_0x86ce('0x2c')]>0x0&&this[_0x5d3fa7+'CurrentCapacity']>=this[_0x5d3fa7+_0x86ce('0x2c')]){return _0x86ce('0x2d');}else{return'working';}}else{return'idle';}};Agent[_0x86ce('0x2a')][_0x86ce('0x2e')]=function(){var _0x22d1bb=[_0x86ce('0x2f'),_0x86ce('0x30'),_0x86ce('0x31'),'fax','sms',_0x86ce('0x32')];for(var _0x41f799=0x0;_0x41f799<_0x22d1bb['length'];_0x41f799+=0x1){var _0x517eb2=this[_0x86ce('0x2b')](_0x22d1bb[_0x41f799]);if(this[_0x22d1bb[_0x41f799]+_0x86ce('0x33')]!==_0x517eb2){this[_0x22d1bb[_0x41f799]+_0x86ce('0x34')]=_[_0x86ce('0x35')](moment()[_0x86ce('0x36')]('x'));}this[_0x22d1bb[_0x41f799]+_0x86ce('0x33')]=_0x517eb2;}var _0x200175={'id':this['id'],'name':this[_0x86ce('0x8')],'online':this[_0x86ce('0x9')],'voicePause':this[_0x86ce('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0x86ce('0xc')],'smsPause':this[_0x86ce('0xe')],'faxPause':this[_0x86ce('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x86ce('0x12')],'chatCapacity':this[_0x86ce('0x13')],'chatCurrentCapacity':this[_0x86ce('0x14')],'mailStatus':this[_0x86ce('0x15')],'mailStatusTime':this[_0x86ce('0x37')],'mailCapacity':this[_0x86ce('0x16')],'mailCurrentCapacity':this[_0x86ce('0x17')],'faxStatus':this[_0x86ce('0x38')],'faxStatusTime':this[_0x86ce('0x18')],'faxCapacity':this[_0x86ce('0x19')],'faxCurrentCapacity':this[_0x86ce('0x1a')],'smsStatus':this[_0x86ce('0x1b')],'smsStatusTime':this[_0x86ce('0x1c')],'smsCapacity':this[_0x86ce('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x86ce('0x39')],'whatsappCapacity':this[_0x86ce('0x1f')],'whatsappCurrentCapacity':this[_0x86ce('0x20')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x86ce('0x22')],'openchannelCapacity':this[_0x86ce('0x23')],'openchannelCurrentCapacity':this[_0x86ce('0x24')],'busy':this['busy'],'busyQueue':this[_0x86ce('0x3a')],'chatWaitingInteractions':this[_0x86ce('0x25')],'faxWaitingInteractions':this[_0x86ce('0x26')],'mailWaitingInteractions':this[_0x86ce('0x27')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x86ce('0x29')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x162837=md5(JSON['stringify'](_0x200175));if(this[_0x86ce('0x2')]!==_0x162837){this[_0x86ce('0x2')]=_0x162837;io[_0x86ce('0x3b')](_0x86ce('0x3c'),_0x200175);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index c559d6e..1c726b1 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 _0xc6a5=['available','waiting','format','chat:queue:%s','emit','chat_queue:save','md5','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','prototype','mapAgentsId','_rr','map','loggedIn','paused','online','chatPause'];(function(_0x72e4d9,_0x1b50dc){var _0x298322=function(_0x496b1b){while(--_0x496b1b){_0x72e4d9['push'](_0x72e4d9['shift']());}};_0x298322(++_0x1b50dc);}(_0xc6a5,0x164));var _0x5c6a=function(_0x1b6e3e,_0x489214){_0x1b6e3e=_0x1b6e3e-0x0;var _0x119608=_0xc6a5[_0x1b6e3e];return _0x119608;};'use strict';var _=require('lodash');var md5=require(_0x5c6a('0x0'));var util=require('util');var Redis=require(_0x5c6a('0x1'));var config=require('../../../config/environment');config[_0x5c6a('0x2')]=_['defaults'](config[_0x5c6a('0x2')],{'host':_0x5c6a('0x3'),'port':0x18eb});var io=require(_0x5c6a('0x4'))(new Redis(config[_0x5c6a('0x2')]));function ChatQueue(_0x4b922b){this['id']=_0x4b922b['id']||0x0;this[_0x5c6a('0x5')]=_0x4b922b[_0x5c6a('0x5')]||'';this[_0x5c6a('0x6')]=_0x4b922b['timeout']||0xa;this[_0x5c6a('0x7')]=_0x4b922b[_0x5c6a('0x7')]||_0x5c6a('0x8');this[_0x5c6a('0x9')]=_0x4b922b[_0x5c6a('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x5c6a('0x0')]='';this[_0x5c6a('0xa')]();this['updateRealtime']();}ChatQueue[_0x5c6a('0xb')][_0x5c6a('0xa')]=function(){var _0x4d9f4b=this[_0x5c6a('0xc')][_0x5c6a('0xd')];this['mapAgentsId']=_[_0x5c6a('0xe')](this[_0x5c6a('0x9')],'id');this[_0x5c6a('0xc')]['_rr']=_0x4d9f4b;};ChatQueue[_0x5c6a('0xb')]['updateRealtime']=function(){this[_0x5c6a('0xf')]=0x0;this[_0x5c6a('0x10')]=0x0;for(var _0x2064a9=0x0;_0x2064a9=0x0?this[_0x5c6a('0x13')]:0x0;var _0x156da6={'id':this['id'],'available':this[_0x5c6a('0x13')],'loggedIn':this[_0x5c6a('0xf')],'name':this[_0x5c6a('0x5')],'paused':this[_0x5c6a('0x10')],'waiting':this[_0x5c6a('0x14')]};var _0x1acbe4=md5(JSON['stringify'](_0x156da6));if(this[_0x5c6a('0x0')]!==_0x1acbe4){this[_0x5c6a('0x0')]=_0x1acbe4;io['to'](util[_0x5c6a('0x15')](_0x5c6a('0x16'),_0x156da6[_0x5c6a('0x5')]))[_0x5c6a('0x17')](_0x5c6a('0x18'),_0x156da6);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x8404=['available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','prototype','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x8404,0x93));var _0x4840=function(_0x3eefcf,_0x4766c2){_0x3eefcf=_0x3eefcf-0x0;var _0x394552=_0x8404[_0x3eefcf];return _0x394552;};'use strict';var _=require(_0x4840('0x0'));var md5=require('md5');var util=require(_0x4840('0x1'));var Redis=require(_0x4840('0x2'));var config=require('../../../config/environment');config[_0x4840('0x3')]=_[_0x4840('0x4')](config[_0x4840('0x3')],{'host':_0x4840('0x5'),'port':0x18eb});var io=require(_0x4840('0x6'))(new Redis(config[_0x4840('0x3')]));function ChatQueue(_0xa931be){this['id']=_0xa931be['id']||0x0;this[_0x4840('0x7')]=_0xa931be['name']||'';this[_0x4840('0x8')]=_0xa931be['timeout']||0xa;this[_0x4840('0x9')]=_0xa931be[_0x4840('0x9')]||'beepall';this[_0x4840('0xa')]=_0xa931be[_0x4840('0xa')];this[_0x4840('0xb')]={};this[_0x4840('0xc')]=0x0;this[_0x4840('0xd')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x4840('0xe')]['updateRouting']=function(){var _0x901c9d=this[_0x4840('0xb')][_0x4840('0xf')];this[_0x4840('0xb')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x4840('0xf')]=_0x901c9d;};ChatQueue[_0x4840('0xe')][_0x4840('0x10')]=function(){this[_0x4840('0x11')]=0x0;this[_0x4840('0x12')]=0x0;for(var _0x1645b0=0x0;_0x1645b0=0x0?this[_0x4840('0x15')]:0x0;var _0x29f014={'id':this['id'],'available':this[_0x4840('0x15')],'loggedIn':this[_0x4840('0x11')],'name':this[_0x4840('0x7')],'paused':this[_0x4840('0x12')],'waiting':this['waiting']};var _0x34e810=md5(JSON[_0x4840('0x16')](_0x29f014));if(this[_0x4840('0xd')]!==_0x34e810){this[_0x4840('0xd')]=_0x34e810;io['to'](util[_0x4840('0x17')](_0x4840('0x18'),_0x29f014[_0x4840('0x7')]))[_0x4840('0x19')](_0x4840('0x1a'),_0x29f014);}};module[_0x4840('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 5ec8701..013d6e1 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 _0xb167=['available','stringify','format','fax_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','loggedIn','paused','length','online','faxPause'];(function(_0x2f99c1,_0x1ffa3c){var _0x133f23=function(_0x40dea5){while(--_0x40dea5){_0x2f99c1['push'](_0x2f99c1['shift']());}};_0x133f23(++_0x1ffa3c);}(_0xb167,0xf7));var _0x7b16=function(_0x21d635,_0x354e98){_0x21d635=_0x21d635-0x0;var _0x2e0852=_0xb167[_0x21d635];return _0x2e0852;};'use strict';var _=require(_0x7b16('0x0'));var md5=require(_0x7b16('0x1'));var util=require(_0x7b16('0x2'));var Redis=require(_0x7b16('0x3'));var config=require(_0x7b16('0x4'));config[_0x7b16('0x5')]=_['defaults'](config['redis'],{'host':_0x7b16('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7b16('0x5')]));function FaxQueue(_0x5f3532){this['id']=_0x5f3532['id']||0x0;this[_0x7b16('0x7')]=_0x5f3532[_0x7b16('0x7')]||'';this[_0x7b16('0x8')]=_0x5f3532['timeout']||0xa;this[_0x7b16('0x9')]=_0x5f3532[_0x7b16('0x9')]||_0x7b16('0xa');this['Agents']=_0x5f3532[_0x7b16('0xb')];this[_0x7b16('0xc')]={};this[_0x7b16('0xd')]=0x0;this[_0x7b16('0x1')]='';this[_0x7b16('0xe')]();this['updateRealtime']();}FaxQueue[_0x7b16('0xf')][_0x7b16('0xe')]=function(){var _0x166404=this[_0x7b16('0xc')][_0x7b16('0x10')];this[_0x7b16('0xc')]=_[_0x7b16('0x11')](this[_0x7b16('0xb')],'id');this[_0x7b16('0xc')]['_rr']=_0x166404;};FaxQueue[_0x7b16('0xf')]['updateRealtime']=function(){this[_0x7b16('0x12')]=0x0;this[_0x7b16('0x13')]=0x0;for(var _0x3c819e=0x0;_0x3c819e=0x0?this['available']:0x0;var _0x56a52e={'id':this['id'],'available':this[_0x7b16('0x17')],'loggedIn':this[_0x7b16('0x12')],'name':this['name'],'paused':this[_0x7b16('0x13')],'waiting':this[_0x7b16('0xd')]};var _0x4cafeb=md5(JSON[_0x7b16('0x18')](_0x56a52e));if(this[_0x7b16('0x1')]!==_0x4cafeb){this[_0x7b16('0x1')]=_0x4cafeb;io['to'](util[_0x7b16('0x19')]('fax:queue:%s',_0x56a52e[_0x7b16('0x7')]))['emit'](_0x7b16('0x1a'),_0x56a52e);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x4133=['Agents','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','available','waiting','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4133,0x1ca));var _0x3413=function(_0x3009b1,_0x1ed650){_0x3009b1=_0x3009b1-0x0;var _0x433c7e=_0x4133[_0x3009b1];return _0x433c7e;};'use strict';var _=require(_0x3413('0x0'));var md5=require(_0x3413('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x3413('0x2'));config[_0x3413('0x3')]=_[_0x3413('0x4')](config[_0x3413('0x3')],{'host':_0x3413('0x5'),'port':0x18eb});var io=require(_0x3413('0x6'))(new Redis(config['redis']));function FaxQueue(_0x85ead){this['id']=_0x85ead['id']||0x0;this[_0x3413('0x7')]=_0x85ead['name']||'';this[_0x3413('0x8')]=_0x85ead[_0x3413('0x8')]||0xa;this[_0x3413('0x9')]=_0x85ead[_0x3413('0x9')]||'beepall';this[_0x3413('0xa')]=_0x85ead[_0x3413('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x3413('0x1')]='';this[_0x3413('0xb')]();this['updateRealtime']();}FaxQueue[_0x3413('0xc')][_0x3413('0xb')]=function(){var _0x2a6954=this[_0x3413('0xd')][_0x3413('0xe')];this[_0x3413('0xd')]=_[_0x3413('0xf')](this[_0x3413('0xa')],'id');this['mapAgentsId'][_0x3413('0xe')]=_0x2a6954;};FaxQueue[_0x3413('0xc')][_0x3413('0x10')]=function(){this[_0x3413('0x11')]=0x0;this[_0x3413('0x12')]=0x0;for(var _0x1f0b50=0x0;_0x1f0b50=0x0?this[_0x3413('0x13')]:0x0;var _0x5e9e05={'id':this['id'],'available':this[_0x3413('0x13')],'loggedIn':this[_0x3413('0x11')],'name':this[_0x3413('0x7')],'paused':this['paused'],'waiting':this[_0x3413('0x14')]};var _0x202418=md5(JSON['stringify'](_0x5e9e05));if(this[_0x3413('0x1')]!==_0x202418){this[_0x3413('0x1')]=_0x202418;io['to'](util[_0x3413('0x15')](_0x3413('0x16'),_0x5e9e05['name']))[_0x3413('0x17')](_0x3413('0x18'),_0x5e9e05);}};module[_0x3413('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 4143b58..39e5c61 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 _0x1a63=['exports','name','Intervals'];(function(_0x4b8ecc,_0x4cd01c){var _0x48c1b9=function(_0x308aa3){while(--_0x308aa3){_0x4b8ecc['push'](_0x4b8ecc['shift']());}};_0x48c1b9(++_0x4cd01c);}(_0x1a63,0x14b));var _0x31a6=function(_0x2d142b,_0x1afb4b){_0x2d142b=_0x2d142b-0x0;var _0x32a654=_0x1a63[_0x2d142b];return _0x32a654;};'use strict';function Interval(_0x1ec457){this['id']=_0x1ec457['id']||0x0;this[_0x31a6('0x0')]=_0x1ec457[_0x31a6('0x0')]||'';this[_0x31a6('0x1')]=_0x1ec457[_0x31a6('0x1')]||{};}module[_0x31a6('0x2')]=Interval; \ No newline at end of file +var _0xbad0=['exports','name','Intervals'];(function(_0xe26a5d,_0x256095){var _0x2976a3=function(_0x41c347){while(--_0x41c347){_0xe26a5d['push'](_0xe26a5d['shift']());}};_0x2976a3(++_0x256095);}(_0xbad0,0x1b7));var _0x0bad=function(_0x134dec,_0x40677b){_0x134dec=_0x134dec-0x0;var _0x2ff36a=_0xbad0[_0x134dec];return _0x2ff36a;};'use strict';function Interval(_0x1cccae){this['id']=_0x1cccae['id']||0x0;this[_0x0bad('0x0')]=_0x1cccae[_0x0bad('0x0')]||'';this[_0x0bad('0x1')]=_0x1cccae[_0x0bad('0x1')]||{};}module[_0x0bad('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 609f465..a76c2bf 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 _0xa718=['mapAgentsId','map','length','online','loggedIn','mailPause','paused','format','emit','lodash','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa718,0x1b2));var _0x8a71=function(_0x419d54,_0x562a88){_0x419d54=_0x419d54-0x0;var _0x571f1b=_0xa718[_0x419d54];return _0x571f1b;};'use strict';var _=require(_0x8a71('0x0'));var md5=require('md5');var util=require(_0x8a71('0x1'));var Redis=require('ioredis');var config=require(_0x8a71('0x2'));config[_0x8a71('0x3')]=_[_0x8a71('0x4')](config[_0x8a71('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x8a71('0x5'))(new Redis(config[_0x8a71('0x3')]));function MailQueue(_0x44980c){this['id']=_0x44980c['id']||0x0;this[_0x8a71('0x6')]=_0x44980c[_0x8a71('0x6')]||'';this[_0x8a71('0x7')]=_0x44980c[_0x8a71('0x7')]||0xa;this[_0x8a71('0x8')]=_0x44980c[_0x8a71('0x8')]||_0x8a71('0x9');this[_0x8a71('0xa')]=_0x44980c['Agents'];this['mapAgentsId']={};this[_0x8a71('0xb')]=0x0;this[_0x8a71('0xc')]='';this[_0x8a71('0xd')]();this[_0x8a71('0xe')]();}MailQueue[_0x8a71('0xf')][_0x8a71('0xd')]=function(){var _0x3e03ba=this[_0x8a71('0x10')]['_rr'];this[_0x8a71('0x10')]=_[_0x8a71('0x11')](this['Agents'],'id');this[_0x8a71('0x10')]['_rr']=_0x3e03ba;};MailQueue['prototype'][_0x8a71('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3530c4=0x0;_0x3530c4=0x0?this['available']:0x0;var _0x45caee={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8a71('0x14')],'name':this[_0x8a71('0x6')],'paused':this[_0x8a71('0x16')],'waiting':this[_0x8a71('0xb')]};var _0x4457d7=md5(JSON['stringify'](_0x45caee));if(this[_0x8a71('0xc')]!==_0x4457d7){this[_0x8a71('0xc')]=_0x4457d7;io['to'](util[_0x8a71('0x17')]('mail:queue:%s',_0x45caee['name']))[_0x8a71('0x18')]('mail_queue:save',_0x45caee);}};module['exports']=MailQueue; \ No newline at end of file +var _0x6caf=['mail:queue:%s','mail_queue:save','util','ioredis','../../../config/environment','redis','defaults','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','map','_rr','prototype','length','online','mailPause','paused','available','loggedIn','name','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6caf,0x154));var _0xf6ca=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x6caf[_0x1fc122];return _0xa2cb13;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xf6ca('0x0'));var Redis=require(_0xf6ca('0x1'));var config=require(_0xf6ca('0x2'));config[_0xf6ca('0x3')]=_[_0xf6ca('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf6ca('0x3')]));function MailQueue(_0x173711){this['id']=_0x173711['id']||0x0;this['name']=_0x173711['name']||'';this[_0xf6ca('0x5')]=_0x173711['timeout']||0xa;this['strategy']=_0x173711[_0xf6ca('0x6')]||_0xf6ca('0x7');this[_0xf6ca('0x8')]=_0x173711['Agents'];this[_0xf6ca('0x9')]={};this[_0xf6ca('0xa')]=0x0;this[_0xf6ca('0xb')]='';this['updateRouting']();this[_0xf6ca('0xc')]();}MailQueue['prototype']['updateRouting']=function(){var _0x437070=this['mapAgentsId']['_rr'];this[_0xf6ca('0x9')]=_[_0xf6ca('0xd')](this[_0xf6ca('0x8')],'id');this[_0xf6ca('0x9')][_0xf6ca('0xe')]=_0x437070;};MailQueue[_0xf6ca('0xf')][_0xf6ca('0xc')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x243ad8=0x0;_0x243ad8=0x0?this[_0xf6ca('0x14')]:0x0;var _0x1f7606={'id':this['id'],'available':this[_0xf6ca('0x14')],'loggedIn':this[_0xf6ca('0x15')],'name':this[_0xf6ca('0x16')],'paused':this[_0xf6ca('0x13')],'waiting':this[_0xf6ca('0xa')]};var _0x19092a=md5(JSON['stringify'](_0x1f7606));if(this[_0xf6ca('0xb')]!==_0x19092a){this[_0xf6ca('0xb')]=_0x19092a;io['to'](util[_0xf6ca('0x17')](_0xf6ca('0x18'),_0x1f7606['name']))['emit'](_0xf6ca('0x19'),_0x1f7606);}};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 64ef1c2..9c02840 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(_0x42b3d0,_0x1578a4){var _0x2dc411=function(_0x4c6f57){while(--_0x4c6f57){_0x42b3d0['push'](_0x42b3d0['shift']());}};_0x2dc411(++_0x1578a4);}(_0x5fc3,0xa8));var _0x35fc=function(_0x41bdd4,_0x3d5c76){_0x41bdd4=_0x41bdd4-0x0;var _0x5c03a6=_0x5fc3[_0x41bdd4];return _0x5c03a6;};'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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x276953,_0x59a3ea){var _0x6ecce5=function(_0x38eecf){while(--_0x38eecf){_0x276953['push'](_0x276953['shift']());}};_0x6ecce5(++_0x59a3ea);}(_0x814b,0x1a2));var _0xb814=function(_0x5ca644,_0x3d2165){_0x5ca644=_0x5ca644-0x0;var _0x5c87a2=_0x814b[_0x5ca644];return _0x5c87a2;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 4210baa..012494d 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 _0x04de=['available','name','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','smsPause'];(function(_0x5c7cbb,_0x5ee078){var _0x44ec04=function(_0x23d735){while(--_0x23d735){_0x5c7cbb['push'](_0x5c7cbb['shift']());}};_0x44ec04(++_0x5ee078);}(_0x04de,0x107));var _0xe04d=function(_0x2f58a8,_0x5f5dba){_0x2f58a8=_0x2f58a8-0x0;var _0x484a49=_0x04de[_0x2f58a8];return _0x484a49;};'use strict';var _=require(_0xe04d('0x0'));var md5=require(_0xe04d('0x1'));var util=require(_0xe04d('0x2'));var Redis=require(_0xe04d('0x3'));var config=require(_0xe04d('0x4'));config[_0xe04d('0x5')]=_[_0xe04d('0x6')](config[_0xe04d('0x5')],{'host':_0xe04d('0x7'),'port':0x18eb});var io=require(_0xe04d('0x8'))(new Redis(config[_0xe04d('0x5')]));function SmsQueue(_0x4804c8){this['id']=_0x4804c8['id']||0x0;this['name']=_0x4804c8['name']||'';this['timeout']=_0x4804c8[_0xe04d('0x9')]||0xa;this[_0xe04d('0xa')]=_0x4804c8[_0xe04d('0xa')]||_0xe04d('0xb');this[_0xe04d('0xc')]=_0x4804c8[_0xe04d('0xc')];this[_0xe04d('0xd')]={};this[_0xe04d('0xe')]=0x0;this['md5']='';this[_0xe04d('0xf')]();this[_0xe04d('0x10')]();}SmsQueue[_0xe04d('0x11')][_0xe04d('0xf')]=function(){var _0xad5c34=this[_0xe04d('0xd')][_0xe04d('0x12')];this[_0xe04d('0xd')]=_[_0xe04d('0x13')](this['Agents'],'id');this[_0xe04d('0xd')][_0xe04d('0x12')]=_0xad5c34;};SmsQueue[_0xe04d('0x11')][_0xe04d('0x10')]=function(){this[_0xe04d('0x14')]=0x0;this[_0xe04d('0x15')]=0x0;for(var _0xf205f5=0x0;_0xf205f5=0x0?this[_0xe04d('0x19')]:0x0;var _0x4090e0={'id':this['id'],'available':this[_0xe04d('0x19')],'loggedIn':this[_0xe04d('0x14')],'name':this[_0xe04d('0x1a')],'paused':this[_0xe04d('0x15')],'waiting':this['waiting']};var _0x47047c=md5(JSON[_0xe04d('0x1b')](_0x4090e0));if(this[_0xe04d('0x1')]!==_0x47047c){this[_0xe04d('0x1')]=_0x47047c;io['to'](util[_0xe04d('0x1c')](_0xe04d('0x1d'),_0x4090e0['name']))[_0xe04d('0x1e')](_0xe04d('0x1f'),_0x4090e0);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x702d=['name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','smsPause','available','stringify','emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x702d,0x147));var _0xd702=function(_0x3c3beb,_0x239cf9){_0x3c3beb=_0x3c3beb-0x0;var _0x3c2b50=_0x702d[_0x3c3beb];return _0x3c2b50;};'use strict';var _=require(_0xd702('0x0'));var md5=require(_0xd702('0x1'));var util=require(_0xd702('0x2'));var Redis=require(_0xd702('0x3'));var config=require(_0xd702('0x4'));config['redis']=_[_0xd702('0x5')](config[_0xd702('0x6')],{'host':_0xd702('0x7'),'port':0x18eb});var io=require(_0xd702('0x8'))(new Redis(config['redis']));function SmsQueue(_0x432e01){this['id']=_0x432e01['id']||0x0;this['name']=_0x432e01[_0xd702('0x9')]||'';this[_0xd702('0xa')]=_0x432e01[_0xd702('0xa')]||0xa;this['strategy']=_0x432e01[_0xd702('0xb')]||'beepall';this[_0xd702('0xc')]=_0x432e01[_0xd702('0xc')];this[_0xd702('0xd')]={};this[_0xd702('0xe')]=0x0;this[_0xd702('0x1')]='';this[_0xd702('0xf')]();this[_0xd702('0x10')]();}SmsQueue[_0xd702('0x11')][_0xd702('0xf')]=function(){var _0x15a632=this['mapAgentsId']['_rr'];this[_0xd702('0xd')]=_[_0xd702('0x12')](this[_0xd702('0xc')],'id');this['mapAgentsId'][_0xd702('0x13')]=_0x15a632;};SmsQueue[_0xd702('0x11')][_0xd702('0x10')]=function(){this[_0xd702('0x14')]=0x0;this[_0xd702('0x15')]=0x0;for(var _0x181ff2=0x0;_0x181ff2=0x0?this['available']:0x0;var _0x2205de={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd702('0x14')],'name':this[_0xd702('0x9')],'paused':this[_0xd702('0x15')],'waiting':this[_0xd702('0xe')]};var _0x4cf326=md5(JSON[_0xd702('0x19')](_0x2205de));if(this[_0xd702('0x1')]!==_0x4cf326){this['md5']=_0x4cf326;io['to'](util['format']('sms:queue:%s',_0x2205de[_0xd702('0x9')]))[_0xd702('0x1a')]('sms_queue:save',_0x2205de);}};module[_0xd702('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 224d0c1..4b555c4 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 _0xaae8=['stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','prototype','length','online','paused','available','loggedIn'];(function(_0x297c47,_0x47ee8c){var _0x3754ca=function(_0x36bc04){while(--_0x36bc04){_0x297c47['push'](_0x297c47['shift']());}};_0x3754ca(++_0x47ee8c);}(_0xaae8,0x96));var _0x8aae=function(_0x3d1db6,_0x47248d){_0x3d1db6=_0x3d1db6-0x0;var _0x32d091=_0xaae8[_0x3d1db6];return _0x32d091;};'use strict';var _=require(_0x8aae('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x8aae('0x1'));var config=require(_0x8aae('0x2'));config[_0x8aae('0x3')]=_[_0x8aae('0x4')](config[_0x8aae('0x3')],{'host':_0x8aae('0x5'),'port':0x18eb});var io=require(_0x8aae('0x6'))(new Redis(config[_0x8aae('0x3')]));function WhatsappQueue(_0xef8081){this['id']=_0xef8081['id']||0x0;this[_0x8aae('0x7')]=_0xef8081[_0x8aae('0x7')]||'';this[_0x8aae('0x8')]=_0xef8081['timeout']||0xa;this[_0x8aae('0x9')]=_0xef8081[_0x8aae('0x9')]||_0x8aae('0xa');this[_0x8aae('0xb')]=_0xef8081[_0x8aae('0xb')];this[_0x8aae('0xc')]={};this[_0x8aae('0xd')]=0x0;this[_0x8aae('0xe')]='';this[_0x8aae('0xf')]();this[_0x8aae('0x10')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x3194fc=this[_0x8aae('0xc')][_0x8aae('0x11')];this['mapAgentsId']=_['map'](this[_0x8aae('0xb')],'id');this[_0x8aae('0xc')][_0x8aae('0x11')]=_0x3194fc;};WhatsappQueue[_0x8aae('0x12')][_0x8aae('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x5be9d8=0x0;_0x5be9d8=0x0?this[_0x8aae('0x16')]:0x0;var _0x8a140={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8aae('0x17')],'name':this[_0x8aae('0x7')],'paused':this[_0x8aae('0x15')],'waiting':this[_0x8aae('0xd')]};var _0x15c26b=md5(JSON[_0x8aae('0x18')](_0x8a140));if(this[_0x8aae('0xe')]!==_0x15c26b){this[_0x8aae('0xe')]=_0x15c26b;io['to'](util['format'](_0x8aae('0x19'),_0x8a140['name']))[_0x8aae('0x1a')](_0x8aae('0x1b'),_0x8a140);}};module[_0x8aae('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0xcc38=['emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRealtime','updateRouting','mapAgentsId','_rr','map','paused','length','online','available','loggedIn','waiting','stringify','format','whatsapp:queue:%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcc38,0xeb));var _0x8cc3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xcc38[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x8cc3('0x0'));var md5=require(_0x8cc3('0x1'));var util=require(_0x8cc3('0x2'));var Redis=require(_0x8cc3('0x3'));var config=require('../../../config/environment');config[_0x8cc3('0x4')]=_[_0x8cc3('0x5')](config[_0x8cc3('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x8cc3('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x1fb533){this['id']=_0x1fb533['id']||0x0;this[_0x8cc3('0x7')]=_0x1fb533[_0x8cc3('0x7')]||'';this[_0x8cc3('0x8')]=_0x1fb533[_0x8cc3('0x8')]||0xa;this['strategy']=_0x1fb533[_0x8cc3('0x9')]||_0x8cc3('0xa');this[_0x8cc3('0xb')]=_0x1fb533[_0x8cc3('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x8cc3('0x1')]='';this['updateRouting']();this[_0x8cc3('0xc')]();}WhatsappQueue['prototype'][_0x8cc3('0xd')]=function(){var _0xd9713a=this[_0x8cc3('0xe')][_0x8cc3('0xf')];this[_0x8cc3('0xe')]=_[_0x8cc3('0x10')](this[_0x8cc3('0xb')],'id');this[_0x8cc3('0xe')]['_rr']=_0xd9713a;};WhatsappQueue['prototype'][_0x8cc3('0xc')]=function(){this['loggedIn']=0x0;this[_0x8cc3('0x11')]=0x0;for(var _0x2e8ba1=0x0;_0x2e8ba1=0x0?this[_0x8cc3('0x14')]:0x0;var _0x2108d7={'id':this['id'],'available':this[_0x8cc3('0x14')],'loggedIn':this[_0x8cc3('0x15')],'name':this[_0x8cc3('0x7')],'paused':this['paused'],'waiting':this[_0x8cc3('0x16')]};var _0x27502e=md5(JSON[_0x8cc3('0x17')](_0x2108d7));if(this[_0x8cc3('0x1')]!==_0x27502e){this[_0x8cc3('0x1')]=_0x27502e;io['to'](util[_0x8cc3('0x18')](_0x8cc3('0x19'),_0x2108d7['name']))[_0x8cc3('0x1a')](_0x8cc3('0x1b'),_0x2108d7);}};module[_0x8cc3('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 2117ee3..b5c47be 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 _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(_0x1259a6,_0x1e1a7a){var _0x3cfb06=function(_0x151744){while(--_0x151744){_0x1259a6['push'](_0x1259a6['shift']());}};_0x3cfb06(++_0x1e1a7a);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f5dd9,_0x30b8c5){_0x4f5dd9=_0x4f5dd9-0x0;var _0x3c8624=_0xb10b[_0x4f5dd9];return _0x3c8624;};'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 +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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 4031130..7a08fe5 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 _0xc2bb=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction'];(function(_0x4922bc,_0x7f21b5){var _0x5544e9=function(_0x466708){while(--_0x466708){_0x4922bc['push'](_0x4922bc['shift']());}};_0x5544e9(++_0x7f21b5);}(_0xc2bb,0x1bd));var _0xbc2b=function(_0x3a13fc,_0xe18194){_0x3a13fc=_0x3a13fc-0x0;var _0x84ea87=_0xc2bb[_0x3a13fc];return _0x84ea87;};'use strict';var client=require(_0xbc2b('0x0'));exports['update']=function(_0x4088d5,_0x178fed){return client[_0xbc2b('0x1')](_0xbc2b('0x2'),{'body':_0x178fed,'options':{'where':{'id':_0x4088d5}},'log':_0xbc2b('0x3')});};exports[_0xbc2b('0x4')]=function(_0x56df03,_0x1c4345){return client[_0xbc2b('0x1')](_0xbc2b('0x5'),{'body':_0x1c4345,'options':{'where':{'id':_0x56df03}},'log':_0xbc2b('0x6')});}; \ No newline at end of file +var _0x9b38=['addTagsToChatInteraction','../client','update','UpdateChatInteraction','addTags','Request','AddTagsToChatInteraction'];(function(_0xa63da5,_0x548bb5){var _0x5e5034=function(_0x1c71fa){while(--_0x1c71fa){_0xa63da5['push'](_0xa63da5['shift']());}};_0x5e5034(++_0x548bb5);}(_0x9b38,0x7f));var _0x89b3=function(_0x280707,_0x301938){_0x280707=_0x280707-0x0;var _0x2b88b7=_0x9b38[_0x280707];return _0x2b88b7;};'use strict';var client=require(_0x89b3('0x0'));exports[_0x89b3('0x1')]=function(_0x4e2392,_0x3220fe){return client['Request'](_0x89b3('0x2'),{'body':_0x3220fe,'options':{'where':{'id':_0x4e2392}},'log':'updateChatInteraction'});};exports[_0x89b3('0x3')]=function(_0x4b5c60,_0x31fd73){return client[_0x89b3('0x4')](_0x89b3('0x5'),{'body':_0x31fd73,'options':{'where':{'id':_0x4b5c60}},'log':_0x89b3('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 20d6c24..20d70d0 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 _0x645d=['createChatMessage','create','Request'];(function(_0x3f2d66,_0x3a29c2){var _0x1eb5e8=function(_0x9f707c){while(--_0x9f707c){_0x3f2d66['push'](_0x3f2d66['shift']());}};_0x1eb5e8(++_0x3a29c2);}(_0x645d,0x13c));var _0xd645=function(_0xd580e2,_0x109182){_0xd580e2=_0xd580e2-0x0;var _0x4d955f=_0x645d[_0xd580e2];return _0x4d955f;};'use strict';var client=require('../client');exports[_0xd645('0x0')]=function(_0x46004d){return client[_0xd645('0x1')]('CreateChatMessage',{'body':_0x46004d,'log':_0xd645('0x2')});}; \ No newline at end of file +var _0x154b=['Request','CreateChatMessage','../client','create'];(function(_0x399a25,_0x33b1fa){var _0x3f4dca=function(_0x3be0e8){while(--_0x3be0e8){_0x399a25['push'](_0x399a25['shift']());}};_0x3f4dca(++_0x33b1fa);}(_0x154b,0xc2));var _0xb154=function(_0x86972e,_0xb0955b){_0x86972e=_0x86972e-0x0;var _0x1aa424=_0x154b[_0x86972e];return _0x1aa424;};'use strict';var client=require(_0xb154('0x0'));exports[_0xb154('0x1')]=function(_0x4feb57){return client[_0xb154('0x2')](_0xb154('0x3'),{'body':_0x4feb57,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ec1b6eb..62ce410 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 _0x7a59=['name','timeout','strategy','User','online','chatPause','../client','GetChatQueue'];(function(_0x45adba,_0x3064c4){var _0x3f405e=function(_0x32e66a){while(--_0x32e66a){_0x45adba['push'](_0x45adba['shift']());}};_0x3f405e(++_0x3064c4);}(_0x7a59,0x16e));var _0x97a5=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x7a59[_0x2aea9e];return _0x430b92;};'use strict';var client=require(_0x97a5('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0x97a5('0x1'),{'options':{'raw':![],'attributes':['id',_0x97a5('0x2'),_0x97a5('0x3'),_0x97a5('0x4')],'include':[{'model':_0x97a5('0x5'),'as':'Agents','attributes':['id',_0x97a5('0x2'),_0x97a5('0x6'),_0x97a5('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x8403=['Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8403,0x1a5));var _0x3840=function(_0x43acf9,_0xdab1a5){_0x43acf9=_0x43acf9-0x0;var _0x1534df=_0x8403[_0x43acf9];return _0x1534df;};'use strict';var client=require(_0x3840('0x0'));exports[_0x3840('0x1')]=function(){return function(){return client[_0x3840('0x2')](_0x3840('0x3'),{'options':{'raw':![],'attributes':['id',_0x3840('0x4'),_0x3840('0x5'),_0x3840('0x6')],'include':[{'model':_0x3840('0x7'),'as':_0x3840('0x8'),'attributes':['id','name',_0x3840('0x9'),_0x3840('0xa')]}]},'log':_0x3840('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index d0e853f..d1d8861 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 _0xe739=['DESC','../client','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x2a0dc9,_0x3802f4){var _0x198be1=function(_0x154add){while(--_0x154add){_0x2a0dc9['push'](_0x2a0dc9['shift']());}};_0x198be1(++_0x3802f4);}(_0xe739,0x105));var _0x9e73=function(_0x4ca96b,_0x31ae94){_0x4ca96b=_0x4ca96b-0x0;var _0x456c69=_0xe739[_0x4ca96b];return _0x456c69;};'use strict';var client=require(_0x9e73('0x0'));exports['create']=function(_0x43bd09){return client[_0x9e73('0x1')](_0x9e73('0x2'),{'body':_0x43bd09,'log':'CreateChatQueueReport'});};exports['update']=function(_0x594f94,_0x3bbc00){return client[_0x9e73('0x1')](_0x9e73('0x3'),{'body':_0x3bbc00,'options':{'where':{'uniqueid':_0x594f94},'order':[['id',_0x9e73('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xaf80=['../client','create','Request','UpdateChatQueueReport','DESC'];(function(_0x46640c,_0x4d27c5){var _0x32fb77=function(_0x2384b6){while(--_0x2384b6){_0x46640c['push'](_0x46640c['shift']());}};_0x32fb77(++_0x4d27c5);}(_0xaf80,0x1ef));var _0x0af8=function(_0x198e0d,_0x52797e){_0x198e0d=_0x198e0d-0x0;var _0x132b6b=_0xaf80[_0x198e0d];return _0x132b6b;};'use strict';var client=require(_0x0af8('0x0'));exports[_0x0af8('0x1')]=function(_0x440a0e){return client[_0x0af8('0x2')]('CreateChatQueueReport',{'body':_0x440a0e,'log':'CreateChatQueueReport'});};exports['update']=function(_0x431bc8,_0x3fba3b){return client[_0x0af8('0x2')](_0x0af8('0x3'),{'body':_0x3fba3b,'options':{'where':{'uniqueid':_0x431bc8},'order':[['id',_0x0af8('0x4')]],'limit':0x1},'log':_0x0af8('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 2478fe7..c41e5d0 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(_0x244e46,_0x5a2dd3){var _0x1bacd5=function(_0x3dfb3f){while(--_0x3dfb3f){_0x244e46['push'](_0x244e46['shift']());}};_0x1bacd5(++_0x5a2dd3);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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(_0xe27948,_0x5bfa16){var _0x44e57b=function(_0x34654a){while(--_0x34654a){_0xe27948['push'](_0xe27948['shift']());}};_0x44e57b(++_0x5bfa16);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 056c4a9..36bc4eb 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 _0x758c=['create','Request','CreateFaxMessage','../client'];(function(_0x510e8c,_0x3989ec){var _0x2e9339=function(_0x316e3f){while(--_0x316e3f){_0x510e8c['push'](_0x510e8c['shift']());}};_0x2e9339(++_0x3989ec);}(_0x758c,0x1b3));var _0xc758=function(_0xb88eb3,_0x4eec43){_0xb88eb3=_0xb88eb3-0x0;var _0x2f0a91=_0x758c[_0xb88eb3];return _0x2f0a91;};'use strict';var client=require(_0xc758('0x0'));exports[_0xc758('0x1')]=function(_0x5c1efe){return client[_0xc758('0x2')](_0xc758('0x3'),{'body':_0x5c1efe,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x4fea=['createFaxMessage','../client','create','Request'];(function(_0x4db42e,_0x1bef76){var _0x12ae06=function(_0x3e1617){while(--_0x3e1617){_0x4db42e['push'](_0x4db42e['shift']());}};_0x12ae06(++_0x1bef76);}(_0x4fea,0x91));var _0xa4fe=function(_0x4f9483,_0x13b7b6){_0x4f9483=_0x4f9483-0x0;var _0x49de02=_0x4fea[_0x4f9483];return _0x49de02;};'use strict';var client=require(_0xa4fe('0x0'));exports[_0xa4fe('0x1')]=function(_0x55eedd){return client[_0xa4fe('0x2')]('CreateFaxMessage',{'body':_0x55eedd,'log':_0xa4fe('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index ed4d7f3..8240e00 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 _0x182e=['timeout','strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name'];(function(_0x3b5bff,_0x37e78f){var _0x46b1fa=function(_0x13c6e9){while(--_0x13c6e9){_0x3b5bff['push'](_0x3b5bff['shift']());}};_0x46b1fa(++_0x37e78f);}(_0x182e,0x74));var _0xe182=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0x182e[_0x5a60ce];return _0x393e5e;};'use strict';var client=require(_0xe182('0x0'));exports[_0xe182('0x1')]=function(){return function(){return client[_0xe182('0x2')](_0xe182('0x3'),{'options':{'raw':![],'attributes':['id',_0xe182('0x4'),_0xe182('0x5'),_0xe182('0x6')],'include':[{'model':_0xe182('0x7'),'as':_0xe182('0x8'),'attributes':['id',_0xe182('0x4'),_0xe182('0x9'),_0xe182('0xa')]}]},'log':_0xe182('0x1')});};}; \ No newline at end of file +var _0x95f1=['Agents','online','faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User'];(function(_0x57cdc2,_0x82646a){var _0x55f940=function(_0x20c3f6){while(--_0x20c3f6){_0x57cdc2['push'](_0x57cdc2['shift']());}};_0x55f940(++_0x82646a);}(_0x95f1,0x1bb));var _0x195f=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x95f1[_0x710815];return _0x5b3b89;};'use strict';var client=require('../client');exports[_0x195f('0x0')]=function(){return function(){return client[_0x195f('0x1')](_0x195f('0x2'),{'options':{'raw':![],'attributes':['id',_0x195f('0x3'),_0x195f('0x4'),_0x195f('0x5')],'include':[{'model':_0x195f('0x6'),'as':_0x195f('0x7'),'attributes':['id',_0x195f('0x3'),_0x195f('0x8'),_0x195f('0x9')]}]},'log':_0x195f('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 52d75c2..dc2b271 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 _0xd02c=['Request','UpdateFaxQueueReport','../client','create'];(function(_0x40b425,_0x4cd318){var _0xfc97a1=function(_0x5af7c5){while(--_0x5af7c5){_0x40b425['push'](_0x40b425['shift']());}};_0xfc97a1(++_0x4cd318);}(_0xd02c,0x1ba));var _0xcd02=function(_0x10ba6f,_0x1ea99b){_0x10ba6f=_0x10ba6f-0x0;var _0x387531=_0xd02c[_0x10ba6f];return _0x387531;};'use strict';var client=require(_0xcd02('0x0'));exports[_0xcd02('0x1')]=function(_0x43a6f8){return client[_0xcd02('0x2')]('CreateFaxQueueReport',{'body':_0x43a6f8,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x17845d,_0x1f8854){return client[_0xcd02('0x2')](_0xcd02('0x3'),{'body':_0x1f8854,'options':{'where':{'uniqueid':_0x17845d},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x5256=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x2d03e2,_0x1f9224){var _0x9af5b1=function(_0x39e8e5){while(--_0x39e8e5){_0x2d03e2['push'](_0x2d03e2['shift']());}};_0x9af5b1(++_0x1f9224);}(_0x5256,0x13d));var _0x6525=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x5256[_0x45d55e];return _0x29812a;};'use strict';var client=require(_0x6525('0x0'));exports[_0x6525('0x1')]=function(_0x5b6f76){return client[_0x6525('0x2')](_0x6525('0x3'),{'body':_0x5b6f76,'log':'CreateFaxQueueReport'});};exports[_0x6525('0x4')]=function(_0x27a83e,_0x618f58){return client['Request'](_0x6525('0x5'),{'body':_0x618f58,'options':{'where':{'uniqueid':_0x27a83e},'order':[['id',_0x6525('0x6')]],'limit':0x1},'log':_0x6525('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index ebc5d2d..5431406 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 _0x9826=['Interval','Intervals','interval','../client','getIntervals','Request','name'];(function(_0x227e24,_0x573dd6){var _0x2ccc99=function(_0x177963){while(--_0x177963){_0x227e24['push'](_0x227e24['shift']());}};_0x2ccc99(++_0x573dd6);}(_0x9826,0x15a));var _0x6982=function(_0x472816,_0x17e01d){_0x472816=_0x472816-0x0;var _0x125821=_0x9826[_0x472816];return _0x125821;};'use strict';var client=require(_0x6982('0x0'));exports[_0x6982('0x1')]=function(){return function(){return client[_0x6982('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6982('0x3')],'include':[{'model':_0x6982('0x4'),'as':_0x6982('0x5'),'attributes':['id','name',_0x6982('0x6')]}]},'log':_0x6982('0x1')});};}; \ No newline at end of file +var _0x98d1=['interval','../client','getIntervals','name','Intervals'];(function(_0x2c961d,_0x106e3a){var _0xb29a42=function(_0xc899d8){while(--_0xc899d8){_0x2c961d['push'](_0x2c961d['shift']());}};_0xb29a42(++_0x106e3a);}(_0x98d1,0x88));var _0x198d=function(_0x341a83,_0x10f65c){_0x341a83=_0x341a83-0x0;var _0x3c41e3=_0x98d1[_0x341a83];return _0x3c41e3;};'use strict';var client=require(_0x198d('0x0'));exports[_0x198d('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x198d('0x2')],'include':[{'model':'Interval','as':_0x198d('0x3'),'attributes':['id','name',_0x198d('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 8a190f8..717794f 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 _0xbbbc=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0xbbbc,0xf6));var _0xcbbb=function(_0xb6a4f,_0x1c0ca2){_0xb6a4f=_0xb6a4f-0x0;var _0x4d7ff6=_0xbbbc[_0xb6a4f];return _0x4d7ff6;};'use strict';var client=require(_0xcbbb('0x0'));exports[_0xcbbb('0x1')]=function(_0x4314a8,_0x4538f9){return client[_0xcbbb('0x2')](_0xcbbb('0x3'),{'body':_0x4538f9,'options':{'where':{'id':_0x4314a8}},'log':_0xcbbb('0x4')});};exports['addTags']=function(_0xb1ad23,_0x938376){return client[_0xcbbb('0x2')](_0xcbbb('0x5'),{'body':_0x938376,'options':{'where':{'id':_0xb1ad23}},'log':_0xcbbb('0x6')});}; \ No newline at end of file +var _0x5c3c=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0xe47cf,_0x2683e2){var _0x5714c4=function(_0xdd0ef2){while(--_0xdd0ef2){_0xe47cf['push'](_0xe47cf['shift']());}};_0x5714c4(++_0x2683e2);}(_0x5c3c,0x132));var _0xc5c3=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x5c3c[_0x42f009];return _0x22a1e0;};'use strict';var client=require(_0xc5c3('0x0'));exports[_0xc5c3('0x1')]=function(_0x11705d,_0x32103c){return client['Request'](_0xc5c3('0x2'),{'body':_0x32103c,'options':{'where':{'id':_0x11705d}},'log':_0xc5c3('0x3')});};exports[_0xc5c3('0x4')]=function(_0x2a3649,_0x2535e0){return client[_0xc5c3('0x5')](_0xc5c3('0x6'),{'body':_0x2535e0,'options':{'where':{'id':_0x2a3649}},'log':_0xc5c3('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 6a75c54..18e4fae 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 _0x9b39=['CreateMailMessage','createMailMessage','Request'];(function(_0x2e90e5,_0x25117c){var _0x1271b1=function(_0x4bad5c){while(--_0x4bad5c){_0x2e90e5['push'](_0x2e90e5['shift']());}};_0x1271b1(++_0x25117c);}(_0x9b39,0x71));var _0x99b3=function(_0x22f4e1,_0x18c57c){_0x22f4e1=_0x22f4e1-0x0;var _0x49498f=_0x9b39[_0x22f4e1];return _0x49498f;};'use strict';var client=require('../client');exports['create']=function(_0x490bb1){return client[_0x99b3('0x0')](_0x99b3('0x1'),{'body':_0x490bb1,'log':_0x99b3('0x2')});}; \ No newline at end of file +var _0x44ca=['createMailMessage','../client','Request'];(function(_0xc1ca45,_0xdd1ce2){var _0x4e7a23=function(_0x3cb1f2){while(--_0x3cb1f2){_0xc1ca45['push'](_0xc1ca45['shift']());}};_0x4e7a23(++_0xdd1ce2);}(_0x44ca,0x1ba));var _0xa44c=function(_0x4f4c2a,_0x5f5a28){_0x4f4c2a=_0x4f4c2a-0x0;var _0xd15be6=_0x44ca[_0x4f4c2a];return _0xd15be6;};'use strict';var client=require(_0xa44c('0x0'));exports['create']=function(_0x2e6d74){return client[_0xa44c('0x1')]('CreateMailMessage',{'body':_0x2e6d74,'log':_0xa44c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 0ddcc03..3edafdc 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 _0x3de9=['getMailQueues','../client','Request','GetMailQueue','timeout','strategy','User','Agents','name','online','mailPause'];(function(_0x150d81,_0x1eb41b){var _0x375d51=function(_0x4dda68){while(--_0x4dda68){_0x150d81['push'](_0x150d81['shift']());}};_0x375d51(++_0x1eb41b);}(_0x3de9,0x1b9));var _0x93de=function(_0x19b5c0,_0x18ca6d){_0x19b5c0=_0x19b5c0-0x0;var _0x2fb804=_0x3de9[_0x19b5c0];return _0x2fb804;};'use strict';var client=require(_0x93de('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x93de('0x1')](_0x93de('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x93de('0x3'),_0x93de('0x4')],'include':[{'model':_0x93de('0x5'),'as':_0x93de('0x6'),'attributes':['id',_0x93de('0x7'),_0x93de('0x8'),_0x93de('0x9')]}]},'log':_0x93de('0xa')});};}; \ No newline at end of file +var _0x340e=['mailPause','getMailQueues','GetMailQueue','name','User','online'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x340e,0x1c3));var _0xe340=function(_0x2b95ed,_0x2bb471){_0x2b95ed=_0x2b95ed-0x0;var _0x232b9b=_0x340e[_0x2b95ed];return _0x232b9b;};'use strict';var client=require('../client');exports[_0xe340('0x0')]=function(){return function(){return client['Request'](_0xe340('0x1'),{'options':{'raw':![],'attributes':['id',_0xe340('0x2'),'timeout','strategy'],'include':[{'model':_0xe340('0x3'),'as':'Agents','attributes':['id',_0xe340('0x2'),_0xe340('0x4'),_0xe340('0x5')]}]},'log':_0xe340('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 9e90f35..b8c4c1b 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 _0x79de=['DESC','../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x496590,_0x3426e9){var _0x585ebc=function(_0x5a3f53){while(--_0x5a3f53){_0x496590['push'](_0x496590['shift']());}};_0x585ebc(++_0x3426e9);}(_0x79de,0x197));var _0xe79d=function(_0x49636d,_0x3ca584){_0x49636d=_0x49636d-0x0;var _0x91c368=_0x79de[_0x49636d];return _0x91c368;};'use strict';var client=require(_0xe79d('0x0'));exports[_0xe79d('0x1')]=function(_0x1457b8){return client[_0xe79d('0x2')](_0xe79d('0x3'),{'body':_0x1457b8,'log':_0xe79d('0x3')});};exports[_0xe79d('0x4')]=function(_0x430e77,_0x2dc2b1){return client[_0xe79d('0x2')](_0xe79d('0x5'),{'body':_0x2dc2b1,'options':{'where':{'uniqueid':_0x430e77},'order':[['id',_0xe79d('0x6')]],'limit':0x1},'log':_0xe79d('0x5')});}; \ No newline at end of file +var _0x666d=['Request','CreateMailQueueReport','UpdateMailQueueReport','DESC'];(function(_0x543628,_0x17a06){var _0x1475f9=function(_0x4c399b){while(--_0x4c399b){_0x543628['push'](_0x543628['shift']());}};_0x1475f9(++_0x17a06);}(_0x666d,0x134));var _0xd666=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x666d[_0x5f0089];return _0x193892;};'use strict';var client=require('../client');exports['create']=function(_0x189992){return client[_0xd666('0x0')](_0xd666('0x1'),{'body':_0x189992,'log':_0xd666('0x1')});};exports['update']=function(_0x4fb105,_0xb78191){return client['Request'](_0xd666('0x2'),{'body':_0xb78191,'options':{'where':{'uniqueid':_0x4fb105},'order':[['id',_0xd666('0x3')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 7adb20b..594145a 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 _0x421e=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','updateOpenchannelInteraction'];(function(_0x306b0c,_0x126f22){var _0x210bda=function(_0x472da7){while(--_0x472da7){_0x306b0c['push'](_0x306b0c['shift']());}};_0x210bda(++_0x126f22);}(_0x421e,0x66));var _0xe421=function(_0x673ea4,_0x449076){_0x673ea4=_0x673ea4-0x0;var _0x3e5938=_0x421e[_0x673ea4];return _0x3e5938;};'use strict';var client=require(_0xe421('0x0'));exports['update']=function(_0x3a574a,_0x5524ed){return client[_0xe421('0x1')]('UpdateOpenchannelInteraction',{'body':_0x5524ed,'options':{'where':{'id':_0x3a574a}},'log':_0xe421('0x2')});};exports['addTags']=function(_0x35f8b8,_0x30e77f){return client[_0xe421('0x1')](_0xe421('0x3'),{'body':_0x30e77f,'options':{'where':{'id':_0x35f8b8}},'log':_0xe421('0x4')});}; \ No newline at end of file +var _0x7efa=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x138468,_0x57141a){var _0x255801=function(_0x48922a){while(--_0x48922a){_0x138468['push'](_0x138468['shift']());}};_0x255801(++_0x57141a);}(_0x7efa,0x160));var _0xa7ef=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0x7efa[_0x4f2c3a];return _0x17d91c;};'use strict';var client=require(_0xa7ef('0x0'));exports[_0xa7ef('0x1')]=function(_0x235e1e,_0x7acec0){return client[_0xa7ef('0x2')](_0xa7ef('0x3'),{'body':_0x7acec0,'options':{'where':{'id':_0x235e1e}},'log':_0xa7ef('0x4')});};exports['addTags']=function(_0x2b1611,_0x34a7ed){return client[_0xa7ef('0x2')](_0xa7ef('0x5'),{'body':_0x34a7ed,'options':{'where':{'id':_0x2b1611}},'log':_0xa7ef('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index e67c85b..0ebc7b1 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 _0x0850=['CreateOpenchannelMessage','../client'];(function(_0x5a3c27,_0x524bd1){var _0x4e812d=function(_0x3080f1){while(--_0x3080f1){_0x5a3c27['push'](_0x5a3c27['shift']());}};_0x4e812d(++_0x524bd1);}(_0x0850,0x1f3));var _0x0085=function(_0x3a0d7c,_0x185979){_0x3a0d7c=_0x3a0d7c-0x0;var _0x122ec4=_0x0850[_0x3a0d7c];return _0x122ec4;};'use strict';var client=require(_0x0085('0x0'));exports['create']=function(_0x2b1645){return client['Request'](_0x0085('0x1'),{'body':_0x2b1645,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xbdfe=['createOpenchannelMessage','../client','Request','CreateOpenchannelMessage'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbdfe,0x175));var _0xebdf=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xbdfe[_0x42bc91];return _0x3f5507;};'use strict';var client=require(_0xebdf('0x0'));exports['create']=function(_0x13c98d){return client[_0xebdf('0x1')](_0xebdf('0x2'),{'body':_0x13c98d,'log':_0xebdf('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index f434767..03aecc8 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 _0xd892=['timeout','strategy','User','Agents','name','online','openchannelPause','getOpenchannelQueues','Request'];(function(_0x99cacc,_0x36a046){var _0x1f55cf=function(_0x1beb3c){while(--_0x1beb3c){_0x99cacc['push'](_0x99cacc['shift']());}};_0x1f55cf(++_0x36a046);}(_0xd892,0x193));var _0x2d89=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xd892[_0x580576];return _0x3f55a0;};'use strict';var client=require('../client');exports[_0x2d89('0x0')]=function(){return function(){return client[_0x2d89('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x2d89('0x2'),_0x2d89('0x3')],'include':[{'model':_0x2d89('0x4'),'as':_0x2d89('0x5'),'attributes':['id',_0x2d89('0x6'),_0x2d89('0x7'),_0x2d89('0x8')]}]},'log':_0x2d89('0x0')});};}; \ No newline at end of file +var _0x65b1=['../client','getOpenchannelQueues','name','timeout','strategy','User','online','openchannelPause'];(function(_0x5a7ca8,_0xd70f1c){var _0x2cd56b=function(_0xce8dbe){while(--_0xce8dbe){_0x5a7ca8['push'](_0x5a7ca8['shift']());}};_0x2cd56b(++_0xd70f1c);}(_0x65b1,0xf0));var _0x165b=function(_0x30b44a,_0x57bca9){_0x30b44a=_0x30b44a-0x0;var _0x268f85=_0x65b1[_0x30b44a];return _0x268f85;};'use strict';var client=require(_0x165b('0x0'));exports[_0x165b('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x165b('0x2'),_0x165b('0x3'),_0x165b('0x4')],'include':[{'model':_0x165b('0x5'),'as':'Agents','attributes':['id',_0x165b('0x2'),_0x165b('0x6'),_0x165b('0x7')]}]},'log':_0x165b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index adc5c91..58e65ab 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 _0xf22c=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','Request'];(function(_0x3e5c8b,_0x35e45c){var _0x90698d=function(_0x3d7133){while(--_0x3d7133){_0x3e5c8b['push'](_0x3e5c8b['shift']());}};_0x90698d(++_0x35e45c);}(_0xf22c,0x11c));var _0xcf22=function(_0x1969f3,_0x33b95e){_0x1969f3=_0x1969f3-0x0;var _0x115fac=_0xf22c[_0x1969f3];return _0x115fac;};'use strict';var client=require('../client');exports['create']=function(_0x1197a2){return client[_0xcf22('0x0')](_0xcf22('0x1'),{'body':_0x1197a2,'log':'CreateOpenchannelQueueReport'});};exports[_0xcf22('0x2')]=function(_0x17f874,_0x478be0){return client['Request'](_0xcf22('0x3'),{'body':_0x478be0,'options':{'where':{'uniqueid':_0x17f874},'order':[['id',_0xcf22('0x4')]],'limit':0x1},'log':_0xcf22('0x3')});}; \ No newline at end of file +var _0x2cc9=['CreateOpenchannelQueueReport','DESC','create','Request'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x2cc9,0x1f2));var _0x92cc=function(_0x4605a4,_0x5a1a06){_0x4605a4=_0x4605a4-0x0;var _0xd0b9f6=_0x2cc9[_0x4605a4];return _0xd0b9f6;};'use strict';var client=require('../client');exports[_0x92cc('0x0')]=function(_0x35ebd9){return client[_0x92cc('0x1')](_0x92cc('0x2'),{'body':_0x35ebd9,'log':_0x92cc('0x2')});};exports['update']=function(_0x433557,_0x4770c0){return client[_0x92cc('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x4770c0,'options':{'where':{'uniqueid':_0x433557},'order':[['id',_0x92cc('0x3')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index bbfa587..a17a049 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 _0x7da7=['update','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x7da7,0x10d));var _0x77da=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x7da7[_0x5de532];return _0x4e9192;};'use strict';var client=require(_0x77da('0x0'));exports[_0x77da('0x1')]=function(_0x16ad6e,_0x571213){return client['Request'](_0x77da('0x2'),{'body':_0x571213,'options':{'where':{'id':_0x16ad6e}},'log':_0x77da('0x3')});};exports['addTags']=function(_0x3a9fa6,_0x37b3d9){return client['Request'](_0x77da('0x4'),{'body':_0x37b3d9,'options':{'where':{'id':_0x3a9fa6}},'log':_0x77da('0x5')});}; \ No newline at end of file +var _0x5ad3=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction','addTags','Request'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x5ad3[_0x21f931];return _0x3f083c;};'use strict';var client=require(_0x35ad('0x0'));exports[_0x35ad('0x1')]=function(_0x15b630,_0x2a45b7){return client['Request'](_0x35ad('0x2'),{'body':_0x2a45b7,'options':{'where':{'id':_0x15b630}},'log':_0x35ad('0x3')});};exports[_0x35ad('0x4')]=function(_0x69a0b3,_0x450f55){return client[_0x35ad('0x5')](_0x35ad('0x6'),{'body':_0x450f55,'options':{'where':{'id':_0x69a0b3}},'log':_0x35ad('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index a22bce2..b455389 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 _0x90a3=['Request','CreateSmsMessage','../client','create'];(function(_0x2b32d3,_0x10e41a){var _0x1eacb2=function(_0x3dee0e){while(--_0x3dee0e){_0x2b32d3['push'](_0x2b32d3['shift']());}};_0x1eacb2(++_0x10e41a);}(_0x90a3,0x92));var _0x390a=function(_0x1fcafc,_0x3b1977){_0x1fcafc=_0x1fcafc-0x0;var _0x47ef45=_0x90a3[_0x1fcafc];return _0x47ef45;};'use strict';var client=require(_0x390a('0x0'));exports[_0x390a('0x1')]=function(_0xf680c3){return client[_0x390a('0x2')](_0x390a('0x3'),{'body':_0xf680c3,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xc347=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x3b7afc,_0x591c4b){var _0x4c7bb2=function(_0xe73053){while(--_0xe73053){_0x3b7afc['push'](_0x3b7afc['shift']());}};_0x4c7bb2(++_0x591c4b);}(_0xc347,0x101));var _0x7c34=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xc347[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x7c34('0x0'));exports[_0x7c34('0x1')]=function(_0x6ae516){return client[_0x7c34('0x2')](_0x7c34('0x3'),{'body':_0x6ae516,'log':_0x7c34('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 7bc859b..a684cfe 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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x2c7a47,_0x187f82){var _0x2da930=function(_0x82defa){while(--_0x82defa){_0x2c7a47['push'](_0x2c7a47['shift']());}};_0x2da930(++_0x187f82);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xcb91[_0x125ff8];return _0x2d9ef;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x46828f,_0x181b24){var _0x381d27=function(_0x24236d){while(--_0x24236d){_0x46828f['push'](_0x46828f['shift']());}};_0x381d27(++_0x181b24);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xb7e7[_0x9cd4c3];return _0x4c9025;};'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 e2aeedd..971154a 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 _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x521f75,_0x2b5f6d){var _0x797e92=function(_0x35b44c){while(--_0x35b44c){_0x521f75['push'](_0x521f75['shift']());}};_0x797e92(++_0x2b5f6d);}(_0x3e74,0x175));var _0x43e7=function(_0x2beaa4,_0x1b629d){_0x2beaa4=_0x2beaa4-0x0;var _0x54f571=_0x3e74[_0x2beaa4];return _0x54f571;};'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 +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x008c,0x188));var _0xc008=function(_0x190417,_0x54dc0d){_0x190417=_0x190417-0x0;var _0x110e9c=_0x008c[_0x190417];return _0x110e9c;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 945b32f..a3dcef1 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(_0x338775,_0x18d242){var _0x41394d=function(_0x348bca){while(--_0x348bca){_0x338775['push'](_0x338775['shift']());}};_0x41394d(++_0x18d242);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x42da23,_0x27dba6){var _0x2c023c=function(_0x39b743){while(--_0x39b743){_0x42da23['push'](_0x42da23['shift']());}};_0x2c023c(++_0x27dba6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 d9e9f7a..99f9c3b 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 _0xa6ce=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','updateWhatsappInteraction','Request'];(function(_0x1f1e73,_0x4d77ae){var _0x5608df=function(_0x27ae0e){while(--_0x27ae0e){_0x1f1e73['push'](_0x1f1e73['shift']());}};_0x5608df(++_0x4d77ae);}(_0xa6ce,0x15e));var _0xea6c=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0xa6ce[_0xf51c06];return _0x1d5420;};'use strict';var client=require(_0xea6c('0x0'));exports['update']=function(_0x325367,_0x37bf44){return client['Request'](_0xea6c('0x1'),{'body':_0x37bf44,'options':{'where':{'id':_0x325367}},'log':_0xea6c('0x2')});};exports['addTags']=function(_0x5620a1,_0x2ac723){return client[_0xea6c('0x3')](_0xea6c('0x4'),{'body':_0x2ac723,'options':{'where':{'id':_0x5620a1}},'log':_0xea6c('0x5')});}; \ No newline at end of file +var _0xb145=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x5c407a,_0x4474c8){var _0x29c26b=function(_0x35aa6a){while(--_0x35aa6a){_0x5c407a['push'](_0x5c407a['shift']());}};_0x29c26b(++_0x4474c8);}(_0xb145,0xa3));var _0x5b14=function(_0x4e3ba2,_0x11b4ab){_0x4e3ba2=_0x4e3ba2-0x0;var _0x3b019e=_0xb145[_0x4e3ba2];return _0x3b019e;};'use strict';var client=require('../client');exports[_0x5b14('0x0')]=function(_0xc54593,_0x935de1){return client[_0x5b14('0x1')](_0x5b14('0x2'),{'body':_0x935de1,'options':{'where':{'id':_0xc54593}},'log':_0x5b14('0x3')});};exports[_0x5b14('0x4')]=function(_0x34b4cd,_0x5111cd){return client[_0x5b14('0x1')](_0x5b14('0x5'),{'body':_0x5111cd,'options':{'where':{'id':_0x34b4cd}},'log':_0x5b14('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 805525b..57ceae4 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 _0x1d3f=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x4b03c9,_0x17ce03){var _0x161ba2=function(_0xb952db){while(--_0xb952db){_0x4b03c9['push'](_0x4b03c9['shift']());}};_0x161ba2(++_0x17ce03);}(_0x1d3f,0x82));var _0xf1d3=function(_0xf706c7,_0x6c9079){_0xf706c7=_0xf706c7-0x0;var _0x23894f=_0x1d3f[_0xf706c7];return _0x23894f;};'use strict';var client=require(_0xf1d3('0x0'));exports[_0xf1d3('0x1')]=function(_0x1b9d06){return client[_0xf1d3('0x2')](_0xf1d3('0x3'),{'body':_0x1b9d06,'log':_0xf1d3('0x4')});}; \ No newline at end of file +var _0x5d00=['Request','CreateWhatsappMessage'];(function(_0x4c7dce,_0x2ba397){var _0x42245b=function(_0x249213){while(--_0x249213){_0x4c7dce['push'](_0x4c7dce['shift']());}};_0x42245b(++_0x2ba397);}(_0x5d00,0x10c));var _0x05d0=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x5d00[_0x46efd7];return _0x5637e4;};'use strict';var client=require('../client');exports['create']=function(_0x811990){return client[_0x05d0('0x0')](_0x05d0('0x1'),{'body':_0x811990,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b755b45..6dfba66 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 _0x120a=['User','Agents','online','whatsappPause','GetWhatsappQueue','name','timeout','strategy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x120a,0xa4));var _0xa120=function(_0x5e6c43,_0x132a12){_0x5e6c43=_0x5e6c43-0x0;var _0x23d90e=_0x120a[_0x5e6c43];return _0x23d90e;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xa120('0x0'),{'options':{'raw':![],'attributes':['id',_0xa120('0x1'),_0xa120('0x2'),_0xa120('0x3')],'include':[{'model':_0xa120('0x4'),'as':_0xa120('0x5'),'attributes':['id','name',_0xa120('0x6'),_0xa120('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xf871=['Request','name','timeout','strategy','User','online','whatsappPause','getWhatsappQueues'];(function(_0x3484c3,_0x14e9e8){var _0x524f80=function(_0x5d10bf){while(--_0x5d10bf){_0x3484c3['push'](_0x3484c3['shift']());}};_0x524f80(++_0x14e9e8);}(_0xf871,0xef));var _0x1f87=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0xf871[_0x277fa3];return _0x2e4520;};'use strict';var client=require('../client');exports[_0x1f87('0x0')]=function(){return function(){return client[_0x1f87('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x1f87('0x2'),_0x1f87('0x3'),_0x1f87('0x4')],'include':[{'model':_0x1f87('0x5'),'as':'Agents','attributes':['id',_0x1f87('0x2'),_0x1f87('0x6'),_0x1f87('0x7')]}]},'log':_0x1f87('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index f63156d..568195c 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 _0x2987=['../client','create','CreateWhatsappQueueReport','update','DESC'];(function(_0x1bdf56,_0x5bc1d3){var _0x390e4d=function(_0x49e6ea){while(--_0x49e6ea){_0x1bdf56['push'](_0x1bdf56['shift']());}};_0x390e4d(++_0x5bc1d3);}(_0x2987,0x7d));var _0x7298=function(_0x41caac,_0x50c421){_0x41caac=_0x41caac-0x0;var _0x28d2ba=_0x2987[_0x41caac];return _0x28d2ba;};'use strict';var client=require(_0x7298('0x0'));exports[_0x7298('0x1')]=function(_0x248375){return client['Request'](_0x7298('0x2'),{'body':_0x248375,'log':_0x7298('0x2')});};exports[_0x7298('0x3')]=function(_0x30249f,_0x578d2b){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x578d2b,'options':{'where':{'uniqueid':_0x30249f},'order':[['id',_0x7298('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xef84=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xef84,0xf1));var _0x4ef8=function(_0x21faef,_0x291124){_0x21faef=_0x21faef-0x0;var _0x4c4ae4=_0xef84[_0x21faef];return _0x4c4ae4;};'use strict';var client=require(_0x4ef8('0x0'));exports[_0x4ef8('0x1')]=function(_0x431296){return client[_0x4ef8('0x2')](_0x4ef8('0x3'),{'body':_0x431296,'log':_0x4ef8('0x3')});};exports[_0x4ef8('0x4')]=function(_0x1269c9,_0x451426){return client[_0x4ef8('0x2')](_0x4ef8('0x5'),{'body':_0x451426,'options':{'where':{'uniqueid':_0x1269c9},'order':[['id',_0x4ef8('0x6')]],'limit':0x1},'log':_0x4ef8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index e289250..110ed58 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 _0x8e98=['info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','stop','log','stack','validate','lodash','seq-queue','../../../../config/logger','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','length','map','message','find','agents','atimeout','channel','rules'];(function(_0x3d8c38,_0x11d8ed){var _0xd1a2ac=function(_0x2c56d2){while(--_0x2c56d2){_0x3d8c38['push'](_0x3d8c38['shift']());}};_0xd1a2ac(++_0x11d8ed);}(_0x8e98,0xce));var _0x88e9=function(_0x1f9065,_0x1bacbf){_0x1f9065=_0x1f9065-0x0;var _0x316b6d=_0x8e98[_0x1f9065];return _0x316b6d;};'use strict';var schema=require(_0x88e9('0x0'));var _=require(_0x88e9('0x1'));var util=require('util');var seqqueue=require(_0x88e9('0x2'));var logger=require(_0x88e9('0x3'))('routing');var strategy=require(_0x88e9('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x88e9('0x5')},'timeout':{'type':'number','message':_0x88e9('0x6')}});function writeLog(_0x57697e,_0xeea2c8,_0x5ab57f){return logger['info'](util['format'](_0x88e9('0x7'),_0x57697e,_0xeea2c8['name'],_0x5ab57f));}function handleFindAgent(_0x5f41bc){return function(_0x2b7c56){return _0x2b7c56[_0x88e9('0x8')]['toLowerCase']()===_0x5f41bc['toLowerCase']();};}exports[_0x88e9('0x9')]=function(_0x3283f3,_0x313599,_0x4f1e60,_0x1126ba){return function(_0x56c3ef){try{var _0xa742da={'name':_0x313599[0x0],'timeout':_0x313599[0x1]};var _0x3bc188=queue[_0x88e9('0x0')](_0xa742da,{'typecast':!![]});if(_0x3bc188[_0x88e9('0xa')]){logger['error']('[%s][AGENT]\x20%s',_0x3283f3,_[_0x88e9('0xb')](_0x3bc188,_0x88e9('0xc'))['join'](',\x20'));_0x56c3ef['stop']();}else{var _0x3ed3c5=_[_0x88e9('0xd')](_0x4f1e60[_0x88e9('0xe')],handleFindAgent(_0xa742da[_0x88e9('0x8')]));if(_0x3ed3c5){var _0x48a356=(_0xa742da['timeout']||0xa)*0x3e8;var _0x4252df,_0x95c7fd;var _0xaf2e6=seqqueue['createQueue'](_0x48a356);_0xaf2e6['id']=_0x3283f3;_0xaf2e6[_0x88e9('0xf')]=_0x48a356;_0xaf2e6[_0x88e9('0x10')]=_0x1126ba['channel'];writeLog(_0x3283f3,_0x3ed3c5,util['format']('START:%s',_0x48a356));_0x4f1e60[_0x88e9('0x11')][_0x3283f3]['on']('end',function(){logger[_0x88e9('0x12')](_0x88e9('0x13'),_0x3283f3);clearTimeout(_0x95c7fd);_0x95c7fd=undefined;_0xaf2e6[_0x88e9('0x14')]();if(_0x4f1e60[_0x88e9('0x11')][_0x3283f3]){delete _0x4f1e60[_0x88e9('0x11')][_0x3283f3];}_0x56c3ef['stop']();});_0x4f1e60[_0x88e9('0x11')][_0x3283f3]['on']('complete',function(){if(_0x4f1e60['rules'][_0x3283f3]){delete _0x4f1e60[_0x88e9('0x11')][_0x3283f3];}});_0x95c7fd=setTimeout(function(){logger[_0x88e9('0x12')](_0x88e9('0x15'),_0x3283f3);clearTimeout(_0x95c7fd);_0xaf2e6[_0x88e9('0x14')]();_0x56c3ef[_0x88e9('0x16')]();},_0x48a356);strategy[_0x88e9('0x17')](_0xaf2e6,_0x3ed3c5,_0x4f1e60,_0x1126ba);}else{logger[_0x88e9('0x18')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3283f3,_0xa742da['name']);_0x56c3ef[_0x88e9('0x19')]();}}}catch(_0x352b62){console[_0x88e9('0x1a')](_0x352b62);logger[_0x88e9('0x18')]('[%s][QUEUE]\x20%s',_0x3283f3,_0x352b62[_0x88e9('0x1b')]);_0x56c3ef['stop']();}};}; \ No newline at end of file +var _0x274b=['message','join','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop','[%s][QUEUE]\x20%s','lodash','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x274b,0x72));var _0xb274=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x274b[_0x618414];return _0x21c19a;};'use strict';var schema=require('validate');var _=require(_0xb274('0x0'));var util=require('util');var seqqueue=require(_0xb274('0x1'));var logger=require(_0xb274('0x2'))(_0xb274('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0xb274('0x4')},'timeout':{'type':_0xb274('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x4eb2c0,_0x591c50,_0x24c47d){return logger['info'](util[_0xb274('0x6')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x4eb2c0,_0x591c50['name'],_0x24c47d));}function handleFindAgent(_0x434c6b){return function(_0x2752ab){return _0x2752ab[_0xb274('0x7')][_0xb274('0x8')]()===_0x434c6b['toLowerCase']();};}exports[_0xb274('0x9')]=function(_0x17070e,_0x1b2033,_0x599a66,_0x5963b5){return function(_0x47c7cb){try{var _0x4e0460={'name':_0x1b2033[0x0],'timeout':_0x1b2033[0x1]};var _0x13b02c=queue['validate'](_0x4e0460,{'typecast':!![]});if(_0x13b02c[_0xb274('0xa')]){logger[_0xb274('0xb')](_0xb274('0xc'),_0x17070e,_[_0xb274('0xd')](_0x13b02c,_0xb274('0xe'))[_0xb274('0xf')](',\x20'));_0x47c7cb['stop']();}else{var _0x563b3f=_[_0xb274('0x10')](_0x599a66[_0xb274('0x11')],handleFindAgent(_0x4e0460['name']));if(_0x563b3f){var _0x27b985=(_0x4e0460[_0xb274('0x12')]||0xa)*0x3e8;var _0x333a5f,_0x4ebf8;var _0x5ca487=seqqueue[_0xb274('0x13')](_0x27b985);_0x5ca487['id']=_0x17070e;_0x5ca487[_0xb274('0x14')]=_0x27b985;_0x5ca487[_0xb274('0x15')]=_0x5963b5[_0xb274('0x15')];writeLog(_0x17070e,_0x563b3f,util['format'](_0xb274('0x16'),_0x27b985));_0x599a66[_0xb274('0x17')][_0x17070e]['on']('end',function(){logger[_0xb274('0x18')](_0xb274('0x19'),_0x17070e);clearTimeout(_0x4ebf8);_0x4ebf8=undefined;_0x5ca487[_0xb274('0x1a')]();if(_0x599a66[_0xb274('0x17')][_0x17070e]){delete _0x599a66[_0xb274('0x17')][_0x17070e];}_0x47c7cb['stop']();});_0x599a66[_0xb274('0x17')][_0x17070e]['on']('complete',function(){if(_0x599a66[_0xb274('0x17')][_0x17070e]){delete _0x599a66[_0xb274('0x17')][_0x17070e];}});_0x4ebf8=setTimeout(function(){logger['info'](_0xb274('0x1b'),_0x17070e);clearTimeout(_0x4ebf8);_0x5ca487[_0xb274('0x1a')]();_0x47c7cb['next']();},_0x27b985);strategy[_0xb274('0x1c')](_0x5ca487,_0x563b3f,_0x599a66,_0x5963b5);}else{logger[_0xb274('0xb')](_0xb274('0x1d'),_0x17070e,_0x4e0460[_0xb274('0x7')]);_0x47c7cb[_0xb274('0x1e')]();}}}catch(_0x40c23a){console['log'](_0x40c23a);logger[_0xb274('0xb')](_0xb274('0x1f'),_0x17070e,_0x40c23a['stack']);_0x47c7cb[_0xb274('0x1e')]();}};}; \ 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 49c5b60..b48d758 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 _0xf4c9=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','interaction','info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account','upperFirst','AccountId','created','body','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText','error','providerName','providerResponse','dialogState','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x3676a7,_0x324f8c){var _0x55cb49=function(_0x2edaee){while(--_0x2edaee){_0x3676a7['push'](_0x3676a7['shift']());}};_0x55cb49(++_0x324f8c);}(_0xf4c9,0xdb));var _0x9f4c=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xf4c9[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x9f4c('0x0'));var moment=require('moment');var AWS=require(_0x9f4c('0x1'));var utils=require(_0x9f4c('0x2'));var logger=require(_0x9f4c('0x3'))(_0x9f4c('0x4'));var rpc={'chatMessage':require(_0x9f4c('0x5')),'openchannelMessage':require(_0x9f4c('0x6')),'mailMessage':require(_0x9f4c('0x7')),'smsMessage':require(_0x9f4c('0x8')),'faxMessage':require(_0x9f4c('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0xe00317,_0x4ed45d){return function(_0x31ecf1){try{if(!_['isNil'](this[_0x9f4c('0xa')]['UserId'])){logger[_0x9f4c('0xb')]('[%s][AMAZONLEX]\x20%s',_0xe00317,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x31ecf1[_0x9f4c('0xc')]();}var _0x5d62d9={'ContactId':this[_0x9f4c('0xd')]['id'],'sentAt':moment()[_0x9f4c('0xe')](_0x9f4c('0xf')),'direction':_0x9f4c('0x10')};if(this[_0x9f4c('0x11')]===_0x9f4c('0x12')||this['channel']==='whatsapp'){_0x5d62d9[_0x9f4c('0x13')]=this['interaction'][_0x9f4c('0x13')];}var _0x424c56=this['channel'];if(_0x424c56==='chat'){_0x5d62d9[_0x9f4c('0x14')]=this[_0x9f4c('0x15')]['id'];}else{_0x5d62d9[_[_0x9f4c('0x16')](_0x424c56)+_0x9f4c('0x17')]=this[_0x9f4c('0x15')]['id'];}_0x5d62d9[_['upperFirst'](_0x424c56)+'InteractionId']=this[_0x9f4c('0xa')]['id'];if(this[_0x9f4c('0xa')][_0x9f4c('0x18')]){var _0x253dd5=_0x4ed45d[0x4];if(!_['isEmpty'](_0x253dd5)){_0x5d62d9[_0x9f4c('0x19')]=utils['getMustacheRender'](_0x253dd5,this);return rpc[_0x424c56+_0x9f4c('0x1a')][_0x9f4c('0x1b')](_0x5d62d9)[_0x9f4c('0x1c')](function(_0x1a5b4a){logger[_0x9f4c('0xb')](_0x9f4c('0x1d'),_0xe00317,_0x5d62d9['body']);})[_0x9f4c('0x1e')](function(_0x1b4199){logger['error'](_0x9f4c('0x1d'),_0xe00317,JSON[_0x9f4c('0x1f')](_0x1b4199));})[_0x9f4c('0x20')](function(){logger[_0x9f4c('0xb')](_0x9f4c('0x21'),_0xe00317);_0x31ecf1[_0x9f4c('0x22')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xe00317);_0x31ecf1['stop']();}}else{var _0x3fbc76=this;var _0x31fe11=new AWS[(_0x9f4c('0x23'))]({'accessKeyId':_0x4ed45d[0x0],'secretAccessKey':_0x4ed45d[0x1],'region':_0x4ed45d[0x2]});var _0x26727e={'botAlias':_0x9f4c('0x24'),'botName':_0x4ed45d[0x3],'inputText':this[_0x9f4c('0x25')]['body'],'userId':this[_0x9f4c('0x11')]+':'+this['interaction']['id'][_0x9f4c('0x26')]()};_0x31fe11[_0x9f4c('0x27')](_0x26727e,function(_0x351536,_0x229b72){if(_0x351536){logger[_0x9f4c('0x28')](_0x9f4c('0x1d'),_0xe00317,_0x351536[_0x9f4c('0x25')]);_0x31ecf1['next']();}else if(_0x229b72&&_0x229b72['message']){_0x3fbc76[_0x9f4c('0x19')]['amazonlex']=_0x229b72;_0x5d62d9[_0x9f4c('0x19')]=_0x229b72['message'];_0x5d62d9[_0x9f4c('0x29')]='amazonlex';_0x5d62d9[_0x9f4c('0x2a')]=JSON['stringify'](_0x229b72);return rpc[_0x424c56+'Message'][_0x9f4c('0x1b')](_0x5d62d9)['then'](function(_0x43d2a0){logger[_0x9f4c('0xb')](_0x9f4c('0x1d'),_0xe00317,_0x5d62d9['body']);if(_0x229b72[_0x9f4c('0x2b')]==_0x9f4c('0x2c')){_0x31ecf1['next']();}else{_0x31ecf1[_0x9f4c('0x22')]();}})[_0x9f4c('0x1e')](function(_0x38a4fd){logger['error'](_0x9f4c('0x1d'),_0xe00317,JSON['stringify'](_0x38a4fd));_0x31ecf1[_0x9f4c('0xc')]();});}else{_0x31ecf1['next']();}});}}catch(_0x108cb8){logger[_0x9f4c('0x28')](_0x9f4c('0x1d'),_0xe00317,JSON[_0x9f4c('0x1f')](_0x108cb8));_0x31ecf1['stop']();}};}; \ No newline at end of file +var _0xb0c7=['providerResponse','create','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','amazonlex','providerName'];(function(_0x2432ad,_0x59883b){var _0x2e35c4=function(_0x1f81ac){while(--_0x1f81ac){_0x2432ad['push'](_0x2432ad['shift']());}};_0x2e35c4(++_0x59883b);}(_0xb0c7,0x153));var _0x7b0c=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0xb0c7[_0x49052b];return _0x48c045;};'use strict';var _=require(_0x7b0c('0x0'));var moment=require(_0x7b0c('0x1'));var AWS=require(_0x7b0c('0x2'));var utils=require(_0x7b0c('0x3'));var logger=require(_0x7b0c('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7b0c('0x5')),'mailMessage':require(_0x7b0c('0x6')),'smsMessage':require(_0x7b0c('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x7b0c('0x8'))};exports[_0x7b0c('0x9')]=function(_0x5d2fa3,_0x409bd1){return function(_0x1526d3){try{if(!_[_0x7b0c('0xa')](this[_0x7b0c('0xb')]['UserId'])){logger[_0x7b0c('0xc')](_0x7b0c('0xd'),_0x5d2fa3,_0x7b0c('0xe'));return _0x1526d3[_0x7b0c('0xf')]();}var _0x55608e={'ContactId':this['contact']['id'],'sentAt':moment()[_0x7b0c('0x10')](_0x7b0c('0x11')),'direction':_0x7b0c('0x12')};if(this[_0x7b0c('0x13')]==='sms'||this[_0x7b0c('0x13')]===_0x7b0c('0x14')){_0x55608e[_0x7b0c('0x15')]=this['interaction'][_0x7b0c('0x15')];}var _0xafed86=this[_0x7b0c('0x13')];if(_0xafed86===_0x7b0c('0x16')){_0x55608e['ChatWebsiteId']=this[_0x7b0c('0x17')]['id'];}else{_0x55608e[_[_0x7b0c('0x18')](_0xafed86)+_0x7b0c('0x19')]=this['account']['id'];}_0x55608e[_[_0x7b0c('0x18')](_0xafed86)+_0x7b0c('0x1a')]=this['interaction']['id'];if(this[_0x7b0c('0xb')][_0x7b0c('0x1b')]){var _0x55546e=_0x409bd1[0x4];if(!_[_0x7b0c('0x1c')](_0x55546e)){_0x55608e[_0x7b0c('0x1d')]=utils[_0x7b0c('0x1e')](_0x55546e,this);return rpc[_0xafed86+_0x7b0c('0x1f')]['create'](_0x55608e)[_0x7b0c('0x20')](function(_0x51cfff){logger[_0x7b0c('0xc')](_0x7b0c('0xd'),_0x5d2fa3,_0x55608e[_0x7b0c('0x1d')]);})['catch'](function(_0x50990b){logger[_0x7b0c('0x21')](_0x7b0c('0xd'),_0x5d2fa3,JSON[_0x7b0c('0x22')](_0x50990b));})[_0x7b0c('0x23')](function(){logger[_0x7b0c('0xc')](_0x7b0c('0x24'),_0x5d2fa3);_0x1526d3[_0x7b0c('0x25')]();});}else{logger[_0x7b0c('0xc')](_0x7b0c('0x26'),_0x5d2fa3);_0x1526d3[_0x7b0c('0x25')]();}}else{var _0x41010e=this;var _0xd556d3=new AWS[(_0x7b0c('0x27'))]({'accessKeyId':_0x409bd1[0x0],'secretAccessKey':_0x409bd1[0x1],'region':_0x409bd1[0x2]});var _0x2949ca={'botAlias':_0x7b0c('0x28'),'botName':_0x409bd1[0x3],'inputText':this[_0x7b0c('0x29')][_0x7b0c('0x1d')],'userId':this[_0x7b0c('0x13')]+':'+this['interaction']['id']['toString']()};_0xd556d3[_0x7b0c('0x2a')](_0x2949ca,function(_0x3c7eea,_0x4c4837){if(_0x3c7eea){logger[_0x7b0c('0x21')](_0x7b0c('0xd'),_0x5d2fa3,_0x3c7eea[_0x7b0c('0x29')]);_0x1526d3['next']();}else if(_0x4c4837&&_0x4c4837['message']){_0x41010e[_0x7b0c('0x1d')][_0x7b0c('0x2b')]=_0x4c4837;_0x55608e['body']=_0x4c4837[_0x7b0c('0x29')];_0x55608e[_0x7b0c('0x2c')]=_0x7b0c('0x2b');_0x55608e[_0x7b0c('0x2d')]=JSON[_0x7b0c('0x22')](_0x4c4837);return rpc[_0xafed86+_0x7b0c('0x1f')][_0x7b0c('0x2e')](_0x55608e)[_0x7b0c('0x20')](function(_0x1c5d76){logger[_0x7b0c('0xc')](_0x7b0c('0xd'),_0x5d2fa3,_0x55608e['body']);if(_0x4c4837['dialogState']=='Failed'){_0x1526d3[_0x7b0c('0xf')]();}else{_0x1526d3[_0x7b0c('0x25')]();}})[_0x7b0c('0x2f')](function(_0x38d967){logger[_0x7b0c('0x21')](_0x7b0c('0xd'),_0x5d2fa3,JSON['stringify'](_0x38d967));_0x1526d3[_0x7b0c('0xf')]();});}else{_0x1526d3[_0x7b0c('0xf')]();}});}}catch(_0x47bfed){logger['error'](_0x7b0c('0xd'),_0x5d2fa3,JSON[_0x7b0c('0x22')](_0x47bfed));_0x1526d3[_0x7b0c('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index d5d44d5..41c9937 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 _0xabc5=['autoreplyExecuted','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','info','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0x5da9e8,_0x4c423b){var _0x299ecc=function(_0x281a2d){while(--_0x281a2d){_0x5da9e8['push'](_0x5da9e8['shift']());}};_0x299ecc(++_0x4c423b);}(_0xabc5,0x11e));var _0x5abc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xabc5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5abc('0x0'));var moment=require('moment');var utils=require(_0x5abc('0x1'));var logger=require('../../../../config/logger')(_0x5abc('0x2'));var rpc={'chatMessage':require(_0x5abc('0x3')),'openchannelMessage':require(_0x5abc('0x4')),'mailMessage':require(_0x5abc('0x5')),'smsMessage':require(_0x5abc('0x6')),'faxMessage':require(_0x5abc('0x7')),'whatsappMessage':require(_0x5abc('0x8')),'chatInteraction':require(_0x5abc('0x9')),'openchannelInteraction':require(_0x5abc('0xa')),'mailInteraction':require(_0x5abc('0xb')),'smsInteraction':require(_0x5abc('0xc')),'faxInteraction':require(_0x5abc('0xd')),'whatsappInteraction':require(_0x5abc('0xe'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x3816c2,_0x496357,_0x14e27e,_0x424a6e){return function(_0x4e8eac){try{var _0x5686fb=this['channel'];if(_0x5686fb===_0x5abc('0xf')&&_0x424a6e[_0x5abc('0x10')][_0x5abc('0x11')]){logger['info'](_0x5abc('0x12'),_0x3816c2,_0x5abc('0x13'));return _0x4e8eac[_0x5abc('0x14')]();}if(_0x496357[0x0]==='1'&&(_[_0x5abc('0x15')](this[_0x5abc('0x16')][_0x5abc('0x17')])||!this[_0x5abc('0x16')][_0x5abc('0x17')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x3816c2,_0x5abc('0x18'));return _0x4e8eac['next']();}if(_0x496357[0x0]==='2'&&this[_0x5abc('0x16')]['autoreplyExecuted']){logger[_0x5abc('0x19')](_0x5abc('0x1a'),_0x3816c2,'One\x20Time\x20already\x20sent');return _0x4e8eac['next']();}var _0x5d5a0f={'ContactId':this[_0x5abc('0x1b')]['id'],'sentAt':moment()['format'](_0x5abc('0x1c')),'direction':_0x5abc('0x1d')};if(this[_0x5abc('0x1e')]===_0x5abc('0xf')){_0x5d5a0f[_0x5abc('0x10')]=utils[_0x5abc('0x1f')](_0x496357[0x2],this);}else{_0x5d5a0f[_0x5abc('0x10')]=utils[_0x5abc('0x1f')](_0x496357[0x1],this);}if(this[_0x5abc('0x20')]){_0x5d5a0f['to']=this[_0x5abc('0x20')]['from']||'';if(this[_0x5abc('0x1e')]===_0x5abc('0xf')&&_0x496357[0x1]==='1'){_0x5d5a0f['cc']=this['message']['cc']||'';}_0x5d5a0f[_0x5abc('0x21')]=this[_0x5abc('0x20')]['to']||'';_0x5d5a0f['phone']=this['message'][_0x5abc('0x22')]||'';_0x5d5a0f[_0x5abc('0x23')]=!![];if(this['message']['subject']){_0x5d5a0f[_0x5abc('0x24')]='';_0x5d5a0f[_0x5abc('0x24')]+=_[_0x5abc('0x25')](this[_0x5abc('0x20')][_0x5abc('0x24')],'Re:')?'':_0x5abc('0x26');_0x5d5a0f[_0x5abc('0x24')]+=this[_0x5abc('0x20')][_0x5abc('0x24')];}}if(this[_0x5abc('0x1e')]===_0x5abc('0x27')){_0x5d5a0f[_0x5abc('0x28')]=this[_0x5abc('0x29')]['id'];}else{_0x5d5a0f[_[_0x5abc('0x2a')](this['channel'])+_0x5abc('0x2b')]=this[_0x5abc('0x29')]['id'];}_0x5d5a0f[_[_0x5abc('0x2a')](this['channel'])+'InteractionId']=this[_0x5abc('0x16')]['id'];var _0x51952c=this[_0x5abc('0x16')];if(rpc[this[_0x5abc('0x1e')]+_0x5abc('0x2c')]){if(this[_0x5abc('0x1e')]===_0x5abc('0xf')){_0x5d5a0f[_0x5abc('0x2d')]=this[_0x5abc('0x20')][_0x5abc('0x2e')];_0x5d5a0f[_0x5abc('0x2f')]=_0x5abc('0x30')+_[_0x5abc('0x31')](_0x5d5a0f[_0x5abc('0x10')],_0x5abc('0x32'),_0x5abc('0x33'))+_0x5abc('0x34');_0x5d5a0f[_0x5abc('0x35')]={'Auto-Submitted':_0x5abc('0x36'),'X-Auto-Response-Suppress':_0x5abc('0x37'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x5abc('0x29')][_0x5abc('0x38')],_0x5d5a0f)[_0x5abc('0x39')](function(_0x339549){logger[_0x5abc('0x19')](_0x5abc('0x3a'),_0x3816c2);_0x5d5a0f['messageId']=_0x339549[_0x5abc('0x20')][_0x5abc('0x2e')];return rpc[_0x5686fb+_0x5abc('0x2c')][_0x5abc('0x3b')](_0x5d5a0f);})[_0x5abc('0x39')](function(_0x48f81e){logger[_0x5abc('0x19')](_0x5abc('0x12'),_0x3816c2,JSON['stringify'](_0x48f81e));})[_0x5abc('0x3c')](function(_0x2cbb9d){logger[_0x5abc('0x3d')](_0x5abc('0x3e'),_0x3816c2,JSON[_0x5abc('0x3f')](_0x2cbb9d));})[_0x5abc('0x40')](function(){Promise[_0x5abc('0x41')]()['then'](function(){if(_0x496357[0x0]!=='2'||_0x51952c['autoreplyExecuted'])return;return rpc[_0x5686fb+_0x5abc('0x42')][_0x5abc('0x43')](_0x51952c['id'],{'autoreplyExecuted':!![]})['then'](function(_0x3708fd){logger[_0x5abc('0x19')](_0x5abc('0x1a'),_0x3816c2,JSON[_0x5abc('0x3f')](_0x3708fd));})[_0x5abc('0x3c')](function(_0x55d6c3){logger['error'](_0x5abc('0x44'),_0x3816c2,JSON[_0x5abc('0x3f')](_0x55d6c3));});})['then'](function(){_0x4e8eac[_0x5abc('0x14')]();});});}else{return rpc[this[_0x5abc('0x1e')]+_0x5abc('0x2c')][_0x5abc('0x3b')](_0x5d5a0f)[_0x5abc('0x39')](function(){logger[_0x5abc('0x19')]('[%s][AUTOREPLY]\x20%s',_0x3816c2,_0x5d5a0f[_0x5abc('0x10')]);})[_0x5abc('0x3c')](function(_0x3604e5){logger[_0x5abc('0x3d')]('[%s][AUTOREPLY]\x20%s',_0x3816c2,JSON['stringify'](_0x3604e5));})['finally'](function(){Promise[_0x5abc('0x41')]()[_0x5abc('0x39')](function(){if(_0x496357[0x0]!=='2'||_0x51952c[_0x5abc('0x45')])return;return rpc[_0x5686fb+_0x5abc('0x42')][_0x5abc('0x43')](_0x51952c['id'],{'autoreplyExecuted':!![]})[_0x5abc('0x39')](function(_0x378f7b){logger['info'](_0x5abc('0x1a'),_0x3816c2,JSON[_0x5abc('0x3f')](_0x378f7b));})[_0x5abc('0x3c')](function(_0x195842){logger[_0x5abc('0x3d')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3816c2,JSON[_0x5abc('0x3f')](_0x195842));});})[_0x5abc('0x39')](function(){_0x4e8eac[_0x5abc('0x14')]();});});}}}catch(_0x2ea918){logger[_0x5abc('0x3d')](_0x5abc('0x12'),_0x3816c2,JSON[_0x5abc('0x3f')](_0x2ea918));_0x4e8eac[_0x5abc('0x46')]();}};}; \ No newline at end of file +var _0x8107=['created','Autoreply\x20already\x20sent','next','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','channel','mail','phone','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','interaction','Message','','headers','auto-replied','All','sendMailMessage','smtpOptions','messageId','create','then','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil'];(function(_0x57e51,_0x27de3a){var _0x17c798=function(_0xf60782){while(--_0xf60782){_0x57e51['push'](_0x57e51['shift']());}};_0x17c798(++_0x27de3a);}(_0x8107,0xb2));var _0x7810=function(_0x1c67a2,_0x599648){_0x1c67a2=_0x1c67a2-0x0;var _0x4fbd8e=_0x8107[_0x1c67a2];return _0x4fbd8e;};'use strict';var _=require(_0x7810('0x0'));var moment=require(_0x7810('0x1'));var utils=require(_0x7810('0x2'));var logger=require(_0x7810('0x3'))(_0x7810('0x4'));var rpc={'chatMessage':require(_0x7810('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7810('0x6')),'faxMessage':require(_0x7810('0x7')),'whatsappMessage':require(_0x7810('0x8')),'chatInteraction':require(_0x7810('0x9')),'openchannelInteraction':require(_0x7810('0xa')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x7810('0xb')),'faxInteraction':require(_0x7810('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x7810('0xd'));exports[_0x7810('0xe')]=function(_0x32c0ec,_0x46d74b,_0x48c628,_0x584c87){return function(_0x4c05ad){try{var _0x7df63f=this['channel'];if(_0x7df63f==='mail'&&_0x584c87[_0x7810('0xf')]['isAutoreply']){logger[_0x7810('0x10')](_0x7810('0x11'),_0x32c0ec,_0x7810('0x12'));return _0x4c05ad['next']();}if(_0x46d74b[0x0]==='1'&&(_[_0x7810('0x13')](this['interaction'][_0x7810('0x14')])||!this['interaction'][_0x7810('0x14')])){logger['info'](_0x7810('0x11'),_0x32c0ec,_0x7810('0x15'));return _0x4c05ad[_0x7810('0x16')]();}if(_0x46d74b[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger[_0x7810('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x32c0ec,_0x7810('0x17'));return _0x4c05ad['next']();}var _0x48b8e6={'ContactId':this[_0x7810('0x18')]['id'],'sentAt':moment()['format'](_0x7810('0x19')),'direction':_0x7810('0x1a')};if(this['channel']==='mail'){_0x48b8e6[_0x7810('0xf')]=utils[_0x7810('0x1b')](_0x46d74b[0x2],this);}else{_0x48b8e6[_0x7810('0xf')]=utils[_0x7810('0x1b')](_0x46d74b[0x1],this);}if(this[_0x7810('0x1c')]){_0x48b8e6['to']=this[_0x7810('0x1c')][_0x7810('0x1d')]||'';if(this[_0x7810('0x1e')]===_0x7810('0x1f')&&_0x46d74b[0x1]==='1'){_0x48b8e6['cc']=this[_0x7810('0x1c')]['cc']||'';}_0x48b8e6[_0x7810('0x1d')]=this[_0x7810('0x1c')]['to']||'';_0x48b8e6[_0x7810('0x20')]=this[_0x7810('0x1c')][_0x7810('0x20')]||'';_0x48b8e6['read']=!![];if(this[_0x7810('0x1c')][_0x7810('0x21')]){_0x48b8e6['subject']='';_0x48b8e6[_0x7810('0x21')]+=_[_0x7810('0x22')](this[_0x7810('0x1c')]['subject'],_0x7810('0x23'))?'':_0x7810('0x24');_0x48b8e6[_0x7810('0x21')]+=this[_0x7810('0x1c')][_0x7810('0x21')];}}if(this[_0x7810('0x1e')]===_0x7810('0x25')){_0x48b8e6['ChatWebsiteId']=this[_0x7810('0x26')]['id'];}else{_0x48b8e6[_[_0x7810('0x27')](this[_0x7810('0x1e')])+_0x7810('0x28')]=this['account']['id'];}_0x48b8e6[_['upperFirst'](this[_0x7810('0x1e')])+_0x7810('0x29')]=this[_0x7810('0x2a')]['id'];var _0x203e70=this[_0x7810('0x2a')];if(rpc[this[_0x7810('0x1e')]+_0x7810('0x2b')]){if(this[_0x7810('0x1e')]==='mail'){_0x48b8e6['inReplyTo']=this[_0x7810('0x1c')]['messageId'];_0x48b8e6['html']=''+_['replace'](_0x48b8e6['body'],_0x7810('0x2c'),_0x7810('0x2d'))+_0x7810('0x2e');_0x48b8e6[_0x7810('0x2f')]={'Auto-Submitted':_0x7810('0x30'),'X-Auto-Response-Suppress':_0x7810('0x31'),'Precedence':'auto_reply'};return mailRpc[_0x7810('0x32')](this[_0x7810('0x26')][_0x7810('0x33')],_0x48b8e6)['then'](function(_0x51c675){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x32c0ec);_0x48b8e6['messageId']=_0x51c675['message'][_0x7810('0x34')];return rpc[_0x7df63f+_0x7810('0x2b')][_0x7810('0x35')](_0x48b8e6);})[_0x7810('0x36')](function(_0x29873d){logger['info'](_0x7810('0x11'),_0x32c0ec,JSON[_0x7810('0x37')](_0x29873d));})['catch'](function(_0x56d420){logger[_0x7810('0x38')](_0x7810('0x39'),_0x32c0ec,JSON['stringify'](_0x56d420));})[_0x7810('0x3a')](function(){Promise[_0x7810('0x3b')]()['then'](function(){if(_0x46d74b[0x0]!=='2'||_0x203e70[_0x7810('0x3c')])return;return rpc[_0x7df63f+_0x7810('0x3d')][_0x7810('0x3e')](_0x203e70['id'],{'autoreplyExecuted':!![]})[_0x7810('0x36')](function(_0x127f58){logger[_0x7810('0x10')](_0x7810('0x3f'),_0x32c0ec,JSON[_0x7810('0x37')](_0x127f58));})[_0x7810('0x40')](function(_0x101197){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x32c0ec,JSON['stringify'](_0x101197));});})['then'](function(){_0x4c05ad[_0x7810('0x16')]();});});}else{return rpc[this[_0x7810('0x1e')]+_0x7810('0x2b')][_0x7810('0x35')](_0x48b8e6)[_0x7810('0x36')](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x32c0ec,_0x48b8e6[_0x7810('0xf')]);})['catch'](function(_0x10dfed){logger[_0x7810('0x38')](_0x7810('0x11'),_0x32c0ec,JSON[_0x7810('0x37')](_0x10dfed));})[_0x7810('0x3a')](function(){Promise[_0x7810('0x3b')]()[_0x7810('0x36')](function(){if(_0x46d74b[0x0]!=='2'||_0x203e70[_0x7810('0x3c')])return;return rpc[_0x7df63f+_0x7810('0x3d')][_0x7810('0x3e')](_0x203e70['id'],{'autoreplyExecuted':!![]})[_0x7810('0x36')](function(_0x56441b){logger[_0x7810('0x10')](_0x7810('0x3f'),_0x32c0ec,JSON[_0x7810('0x37')](_0x56441b));})[_0x7810('0x40')](function(_0xb5dab7){logger[_0x7810('0x38')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x32c0ec,JSON['stringify'](_0xb5dab7));});})['then'](function(){_0x4c05ad['next']();});});}}}catch(_0x26cc6e){logger[_0x7810('0x38')](_0x7810('0x11'),_0x32c0ec,JSON['stringify'](_0x26cc6e));_0x4c05ad[_0x7810('0x41')]();}};}; \ 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 112cd21..f3fac28 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 _0x8857=['consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x8857,0x175));var _0x7885=function(_0x6387ca,_0x35c9a6){_0x6387ca=_0x6387ca-0x0;var _0xa00485=_0x8857[_0x6387ca];return _0xa00485;};'use strict';var moment=require(_0x7885('0x0'));var logger=require('../../../../config/logger')(_0x7885('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x7885('0x2')),'smsInteraction':require(_0x7885('0x3')),'mailInteraction':require(_0x7885('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x7885('0x5')]=function(_0x1e6a41,_0x1c88cb,_0x38d401,_0x12db6c){return function(_0x3b9a30){try{logger[_0x7885('0x6')](_0x7885('0x7'),_0x1e6a41,_0x1c88cb[0x0]);var _0x57b8ae={'closed':0x1,'closedAt':moment()[_0x7885('0x8')](_0x7885('0x9')),'closeReason':_0x7885('0xa'),'disposition':_0x1c88cb[0x0]};if(rpc[_0x12db6c[_0x7885('0xb')]+_0x7885('0xc')]){rpc[_0x12db6c['channel']+_0x7885('0xc')]['update'](_0x12db6c[_0x7885('0xd')]['id'],_0x57b8ae)[_0x7885('0xe')](function(_0x5748d5){logger[_0x7885('0x6')](_0x7885('0xf'),_0x1e6a41,_0x12db6c[_0x7885('0xd')]['id']);})[_0x7885('0x10')](function(_0x1a99f8){logger['error'](_0x7885('0x11'),_0x1e6a41,JSON[_0x7885('0x12')](_0x1a99f8));})[_0x7885('0x13')](function(){_0x3b9a30[_0x7885('0x14')]();});}}catch(_0x28cd33){logger['error'](_0x7885('0x11'),_0x1e6a41,JSON[_0x7885('0x12')](_0x28cd33));_0x3b9a30[_0x7885('0x14')]();}};}; \ No newline at end of file +var _0xd818=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','system','channel','Interaction','update','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','[%s][CLOSE]\x20%s','stringify','finally','error','../../../../config/logger','routing','../../rpc/chatInteraction'];(function(_0x1a25a7,_0x4c2252){var _0x382c41=function(_0x47d7a8){while(--_0x47d7a8){_0x1a25a7['push'](_0x1a25a7['shift']());}};_0x382c41(++_0x4c2252);}(_0xd818,0x179));var _0x8d81=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0xd818[_0x1a0daa];return _0x1dbe15;};'use strict';var moment=require('moment');var logger=require(_0x8d81('0x0'))(_0x8d81('0x1'));var rpc={'chatInteraction':require(_0x8d81('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x8d81('0x3')),'mailInteraction':require(_0x8d81('0x4')),'faxInteraction':require(_0x8d81('0x5')),'whatsappInteraction':require(_0x8d81('0x6'))};exports[_0x8d81('0x7')]=function(_0xb85fdc,_0x2ae265,_0x519ba9,_0x4bbd8a){return function(_0x24dd74){try{logger['info'](_0x8d81('0x8'),_0xb85fdc,_0x2ae265[0x0]);var _0x2f4846={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x8d81('0x9'),'disposition':_0x2ae265[0x0]};if(rpc[_0x4bbd8a[_0x8d81('0xa')]+'Interaction']){rpc[_0x4bbd8a[_0x8d81('0xa')]+_0x8d81('0xb')][_0x8d81('0xc')](_0x4bbd8a['interaction']['id'],_0x2f4846)['then'](function(_0x389aa1){logger['info'](_0x8d81('0xd'),_0xb85fdc,_0x4bbd8a[_0x8d81('0xe')]['id']);})['catch'](function(_0x4115af){logger['error'](_0x8d81('0xf'),_0xb85fdc,JSON[_0x8d81('0x10')](_0x4115af));})[_0x8d81('0x11')](function(){_0x24dd74['stop']();});}}catch(_0x1f3ded){logger[_0x8d81('0x12')](_0x8d81('0xf'),_0xb85fdc,JSON['stringify'](_0x1f3ded));_0x24dd74['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 0ff685e..78cbd39 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 _0xfd20=['AccountId','body','Message','create','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','then','dialogflow','result','providerName','metadata','endConversation','next','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst'];(function(_0x371b6b,_0x4b0729){var _0x4797fb=function(_0xcea18){while(--_0xcea18){_0x371b6b['push'](_0x371b6b['shift']());}};_0x4797fb(++_0x4b0729);}(_0xfd20,0x66));var _0x0fd2=function(_0xe9e6cf,_0x395f6d){_0xe9e6cf=_0xe9e6cf-0x0;var _0x2b8851=_0xfd20[_0xe9e6cf];return _0x2b8851;};'use strict';var _=require('lodash');var moment=require(_0x0fd2('0x0'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x0fd2('0x1'));var logger=require(_0x0fd2('0x2'))('routing');var rpc={'chatMessage':require(_0x0fd2('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0fd2('0x4')),'smsMessage':require(_0x0fd2('0x5')),'faxMessage':require(_0x0fd2('0x6')),'whatsappMessage':require(_0x0fd2('0x7'))};exports[_0x0fd2('0x8')]=function(_0x4d114c,_0x55467b){return function(_0x32d460){try{if(!_[_0x0fd2('0x9')](this[_0x0fd2('0xa')][_0x0fd2('0xb')])){logger[_0x0fd2('0xc')](_0x0fd2('0xd'),_0x4d114c,_0x0fd2('0xe'));return _0x32d460['next']();}var _0x39b9a7={'ContactId':this[_0x0fd2('0xf')]['id'],'sentAt':moment()['format'](_0x0fd2('0x10')),'direction':'out'};if(this[_0x0fd2('0x11')]===_0x0fd2('0x12')||this[_0x0fd2('0x11')]===_0x0fd2('0x13')){_0x39b9a7[_0x0fd2('0x14')]=this[_0x0fd2('0xa')][_0x0fd2('0x14')];}var _0x7b05c3=this['channel'];if(_0x7b05c3==='chat'){_0x39b9a7[_0x0fd2('0x15')]=this[_0x0fd2('0x16')]['id'];}else{_0x39b9a7[_[_0x0fd2('0x17')](_0x7b05c3)+_0x0fd2('0x18')]=this['account']['id'];}_0x39b9a7[_[_0x0fd2('0x17')](_0x7b05c3)+'InteractionId']=this['interaction']['id'];if(this[_0x0fd2('0xa')]['created']){var _0x42f44c=_0x55467b[0x2];if(!_['isEmpty'](_0x42f44c)){_0x39b9a7[_0x0fd2('0x19')]=utils['getMustacheRender'](_0x42f44c,this);return rpc[_0x7b05c3+_0x0fd2('0x1a')][_0x0fd2('0x1b')](_0x39b9a7)['then'](function(_0x2b25d2){logger['info'](_0x0fd2('0xd'),_0x4d114c,_0x39b9a7[_0x0fd2('0x19')]);})[_0x0fd2('0x1c')](function(_0x11b423){logger[_0x0fd2('0x1d')](_0x0fd2('0xd'),_0x4d114c,JSON[_0x0fd2('0x1e')](_0x11b423));})[_0x0fd2('0x1f')](function(){logger[_0x0fd2('0xc')](_0x0fd2('0x20'),_0x4d114c);_0x32d460['stop']();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4d114c);_0x32d460[_0x0fd2('0x21')]();}}else{var _0x36072a=this;var _0x53ab17=apiai(_0x55467b[0x0],{'language':_0x55467b[0x1]||'en'});return _0x53ab17['textRequest'](this[_0x0fd2('0x22')][_0x0fd2('0x19')],{'sessionId':md5(this[_0x0fd2('0xa')]['id'])})[_0x0fd2('0x23')](function(_0x25cdd2){_0x36072a['body'][_0x0fd2('0x24')]=_0x25cdd2;_0x39b9a7[_0x0fd2('0x19')]=_0x25cdd2[_0x0fd2('0x25')]['fulfillment']['speech'];_0x39b9a7[_0x0fd2('0x26')]=_0x0fd2('0x24');_0x39b9a7['providerResponse']=JSON[_0x0fd2('0x1e')](_0x25cdd2);return rpc[_0x7b05c3+_0x0fd2('0x1a')][_0x0fd2('0x1b')](_0x39b9a7)[_0x0fd2('0x23')](function(_0x1d1c40){logger[_0x0fd2('0xc')](_0x0fd2('0xd'),_0x4d114c,_0x39b9a7[_0x0fd2('0x19')]);if(_0x25cdd2['result'][_0x0fd2('0x27')][_0x0fd2('0x28')]){_0x32d460[_0x0fd2('0x29')]();}else{_0x32d460[_0x0fd2('0x21')]();}})[_0x0fd2('0x1c')](function(_0x564419){logger[_0x0fd2('0x1d')](_0x0fd2('0xd'),_0x4d114c,JSON[_0x0fd2('0x1e')](_0x564419));_0x32d460[_0x0fd2('0x29')]();});})[_0x0fd2('0x1c')](function(_0x3b135a){logger[_0x0fd2('0x1d')](_0x0fd2('0xd'),_0x4d114c,_0x3b135a['message']);_0x32d460[_0x0fd2('0x29')]();});}}catch(_0x48c373){logger['error'](_0x0fd2('0xd'),_0x4d114c,JSON['stringify'](_0x48c373));_0x32d460[_0x0fd2('0x21')]();}};}; \ No newline at end of file +var _0xc1dc=['[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','ChatWebsiteId','AccountId','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','catch','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','result','fulfillment','speech','providerName','providerResponse','metadata','lodash','moment','apiai-promise','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info'];(function(_0x188e18,_0x573161){var _0x220701=function(_0xf2ef49){while(--_0xf2ef49){_0x188e18['push'](_0x188e18['shift']());}};_0x220701(++_0x573161);}(_0xc1dc,0x84));var _0xcc1d=function(_0x5f71a9,_0x30d620){_0x5f71a9=_0x5f71a9-0x0;var _0x5b5b4e=_0xc1dc[_0x5f71a9];return _0x5b5b4e;};'use strict';var _=require(_0xcc1d('0x0'));var moment=require(_0xcc1d('0x1'));var apiai=require(_0xcc1d('0x2'));var md5=require('md5');var utils=require(_0xcc1d('0x3'));var logger=require('../../../../config/logger')(_0xcc1d('0x4'));var rpc={'chatMessage':require(_0xcc1d('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xcc1d('0x6')),'smsMessage':require(_0xcc1d('0x7')),'faxMessage':require(_0xcc1d('0x8')),'whatsappMessage':require(_0xcc1d('0x9'))};exports[_0xcc1d('0xa')]=function(_0x597eb8,_0x4dc8ee){return function(_0x23e085){try{if(!_[_0xcc1d('0xb')](this[_0xcc1d('0xc')][_0xcc1d('0xd')])){logger[_0xcc1d('0xe')](_0xcc1d('0xf'),_0x597eb8,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x23e085[_0xcc1d('0x10')]();}var _0x27e81c={'ContactId':this[_0xcc1d('0x11')]['id'],'sentAt':moment()[_0xcc1d('0x12')](_0xcc1d('0x13')),'direction':_0xcc1d('0x14')};if(this['channel']===_0xcc1d('0x15')||this[_0xcc1d('0x16')]==='whatsapp'){_0x27e81c[_0xcc1d('0x17')]=this[_0xcc1d('0xc')][_0xcc1d('0x17')];}var _0x45b520=this[_0xcc1d('0x16')];if(_0x45b520===_0xcc1d('0x18')){_0x27e81c[_0xcc1d('0x19')]=this['account']['id'];}else{_0x27e81c[_['upperFirst'](_0x45b520)+_0xcc1d('0x1a')]=this['account']['id'];}_0x27e81c[_[_0xcc1d('0x1b')](_0x45b520)+_0xcc1d('0x1c')]=this[_0xcc1d('0xc')]['id'];if(this[_0xcc1d('0xc')][_0xcc1d('0x1d')]){var _0x2bf07a=_0x4dc8ee[0x2];if(!_[_0xcc1d('0x1e')](_0x2bf07a)){_0x27e81c[_0xcc1d('0x1f')]=utils[_0xcc1d('0x20')](_0x2bf07a,this);return rpc[_0x45b520+_0xcc1d('0x21')]['create'](_0x27e81c)['then'](function(_0x2ee388){logger['info'](_0xcc1d('0xf'),_0x597eb8,_0x27e81c[_0xcc1d('0x1f')]);})[_0xcc1d('0x22')](function(_0x104c54){logger[_0xcc1d('0x23')](_0xcc1d('0xf'),_0x597eb8,JSON[_0xcc1d('0x24')](_0x104c54));})[_0xcc1d('0x25')](function(){logger[_0xcc1d('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x597eb8);_0x23e085[_0xcc1d('0x26')]();});}else{logger['info'](_0xcc1d('0x27'),_0x597eb8);_0x23e085[_0xcc1d('0x26')]();}}else{var _0x167b9f=this;var _0x5a2df6=apiai(_0x4dc8ee[0x0],{'language':_0x4dc8ee[0x1]||'en'});return _0x5a2df6[_0xcc1d('0x28')](this[_0xcc1d('0x29')][_0xcc1d('0x1f')],{'sessionId':md5(this[_0xcc1d('0xc')]['id'])})[_0xcc1d('0x2a')](function(_0x5e2f74){_0x167b9f[_0xcc1d('0x1f')]['dialogflow']=_0x5e2f74;_0x27e81c[_0xcc1d('0x1f')]=_0x5e2f74[_0xcc1d('0x2b')][_0xcc1d('0x2c')][_0xcc1d('0x2d')];_0x27e81c[_0xcc1d('0x2e')]='dialogflow';_0x27e81c[_0xcc1d('0x2f')]=JSON[_0xcc1d('0x24')](_0x5e2f74);return rpc[_0x45b520+_0xcc1d('0x21')]['create'](_0x27e81c)[_0xcc1d('0x2a')](function(_0x491edb){logger[_0xcc1d('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x597eb8,_0x27e81c[_0xcc1d('0x1f')]);if(_0x5e2f74[_0xcc1d('0x2b')][_0xcc1d('0x30')]['endConversation']){_0x23e085[_0xcc1d('0x10')]();}else{_0x23e085[_0xcc1d('0x26')]();}})[_0xcc1d('0x22')](function(_0x4a406f){logger[_0xcc1d('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x597eb8,JSON[_0xcc1d('0x24')](_0x4a406f));_0x23e085[_0xcc1d('0x10')]();});})[_0xcc1d('0x22')](function(_0x380bd2){logger[_0xcc1d('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x597eb8,_0x380bd2[_0xcc1d('0x29')]);_0x23e085[_0xcc1d('0x10')]();});}}catch(_0x4cbe87){logger[_0xcc1d('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x597eb8,JSON[_0xcc1d('0x24')](_0x4cbe87));_0x23e085['stop']();}};}; \ 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 d6f04a5..9185d00 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 _0x4e17=['YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','InteractionId','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','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','fulfillmentText','all','stack','lodash','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format'];(function(_0x5f2005,_0x3d0771){var _0x43797d=function(_0x336e89){while(--_0x336e89){_0x5f2005['push'](_0x5f2005['shift']());}};_0x43797d(++_0x3d0771);}(_0x4e17,0xf2));var _0x74e1=function(_0xbd8469,_0x36cd55){_0xbd8469=_0xbd8469-0x0;var _0x27136d=_0x4e17[_0xbd8469];return _0x27136d;};'use strict';var _=require(_0x74e1('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x74e1('0x1'));var moment=require(_0x74e1('0x2'));var Promise=require(_0x74e1('0x3'));var logger=require(_0x74e1('0x4'))(_0x74e1('0x5'));var utils=require(_0x74e1('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x74e1('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x74e1('0x8'))};function createMessage(_0x21b3d4,_0xfa2999,_0x3ac138,_0x1672cd){return new Promise(function(_0x2756a9,_0x275ad8){var _0x390aa9=_[_0x74e1('0x9')](_0x3ac138);_0x390aa9[_0x74e1('0xa')]=_0x1672cd;return rpc[_0xfa2999+_0x74e1('0xb')][_0x74e1('0xc')](_0x390aa9)[_0x74e1('0xd')](function(){logger[_0x74e1('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x21b3d4,_0x390aa9['body']);_0x2756a9();})[_0x74e1('0xf')](function(_0x148080){logger[_0x74e1('0x10')](_0x74e1('0x11'),_0x21b3d4,JSON[_0x74e1('0x12')](_0x148080));_0x275ad8(_0x148080);});});}exports[_0x74e1('0x13')]=function(_0x3dc3e7,_0x382158){return function(_0x32579a){try{if(!_[_0x74e1('0x14')](this[_0x74e1('0x15')]['UserId'])){logger[_0x74e1('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x3dc3e7,_0x74e1('0x16'));return _0x32579a[_0x74e1('0x17')]();}var _0x41d895={'ContactId':this[_0x74e1('0x18')]['id'],'sentAt':moment()[_0x74e1('0x19')](_0x74e1('0x1a')),'direction':_0x74e1('0x1b')};if(this['channel']===_0x74e1('0x1c')||this[_0x74e1('0x1d')]===_0x74e1('0x1e')){_0x41d895[_0x74e1('0x1f')]=this[_0x74e1('0x15')]['phone'];}var _0x4c916d=this[_0x74e1('0x1d')];if(_0x4c916d==='chat'){_0x41d895[_0x74e1('0x20')]=this[_0x74e1('0x21')]['id'];}else{_0x41d895[_['upperFirst'](_0x4c916d)+'AccountId']=this[_0x74e1('0x21')]['id'];}_0x41d895[_[_0x74e1('0x22')](_0x4c916d)+_0x74e1('0x23')]=this['interaction']['id'];if(this['interaction']['created']){var _0x1e9dbe=_0x382158[0x4];if(!_['isEmpty'](_0x1e9dbe)){_0x41d895[_0x74e1('0xa')]=utils[_0x74e1('0x24')](_0x1e9dbe,this);return rpc[_0x4c916d+_0x74e1('0xb')][_0x74e1('0xc')](_0x41d895)[_0x74e1('0xd')](function(_0x311d14){logger['info'](_0x74e1('0x11'),_0x3dc3e7,_0x41d895[_0x74e1('0xa')]);})['catch'](function(_0x4bc81c){logger['error'](_0x74e1('0x11'),_0x3dc3e7,JSON['stringify'](_0x4bc81c));})[_0x74e1('0x25')](function(){logger[_0x74e1('0xe')](_0x74e1('0x26'),_0x3dc3e7);_0x32579a[_0x74e1('0x27')]();});}else{logger[_0x74e1('0xe')](_0x74e1('0x28'),_0x3dc3e7);_0x32579a[_0x74e1('0x27')]();}}else{var _0x42117c=this;var _0x41023a=_0x382158[0x2][_0x74e1('0x29')](/\\n/g,'\x0a');var _0x5b1a5a={'credentials':{'private_key':_0x41023a,'client_email':_0x382158[0x1]}};var _0x3759d7=new dialogflow[(_0x74e1('0x2a'))](_0x5b1a5a);var _0x20133f=_0x3759d7['sessionPath'](_0x382158[0x0],md5(_0x42117c[_0x74e1('0x15')]['id']));var _0x2ad45c={'session':_0x20133f,'queryInput':{'text':{'text':_0x42117c['message'][_0x74e1('0xa')],'languageCode':_0x382158[0x3]||'en'}}};return _0x3759d7[_0x74e1('0x2b')](_0x2ad45c)[_0x74e1('0xd')](function(_0x2e5c7c){if(_0x2e5c7c&&_0x2e5c7c[_0x74e1('0x2c')]){_0x42117c[_0x74e1('0xa')][_0x74e1('0x2d')]=_0x2e5c7c;var _0x425269=_0x2e5c7c[0x0];var _0x2bf682=_0x425269['queryResult'][_0x74e1('0x2e')]&&_0x425269[_0x74e1('0x2f')][_0x74e1('0x2e')][_0x74e1('0x30')]?_0x425269[_0x74e1('0x2f')][_0x74e1('0x2e')]['fields'][_0x74e1('0x31')][_0x74e1('0x32')]:![];_0x42117c[_0x74e1('0xa')][_0x74e1('0x33')]=_0x425269[_0x74e1('0x2f')][_0x74e1('0x34')];_0x42117c['body'][_0x74e1('0x35')]=_0x425269[_0x74e1('0x2f')]['allRequiredParamsPresent'];_0x42117c[_0x74e1('0xa')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x425269[_0x74e1('0x2f')][_0x74e1('0x2e')]&&_0x425269[_0x74e1('0x2f')]['diagnosticInfo'][_0x74e1('0x30')]?_0x425269['queryResult'][_0x74e1('0x2e')]['fields'][_0x74e1('0x31')][_0x74e1('0x32')]:![];_0x42117c[_0x74e1('0xa')][_0x74e1('0x36')]=_0x425269[_0x74e1('0x2f')][_0x74e1('0x37')][_0x74e1('0x38')];_0x42117c[_0x74e1('0xa')][_0x74e1('0x39')]=_0x425269['queryResult'][_0x74e1('0x37')][_0x74e1('0x3a')];_0x42117c[_0x74e1('0xa')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x425269[_0x74e1('0x2f')]['intent']['isFallback'];_0x42117c[_0x74e1('0xa')][_0x74e1('0x3b')]=_0x425269['queryResult']['languageCode'];_0x42117c[_0x74e1('0xa')][_0x74e1('0x3c')]=_0x425269[_0x74e1('0x2f')][_0x74e1('0x3d')];_0x42117c['body'][_0x74e1('0x3e')]=_0x425269[_0x74e1('0x2f')][_0x74e1('0x3f')];_0x41d895['providerName']=_0x74e1('0x2d');_0x41d895['providerResponse']=JSON['stringify'](_0x2e5c7c);var _0x487fcc=[];for(var _0x347891=0x0;_0x347891<_0x2e5c7c[_0x74e1('0x2c')];_0x347891++){var _0x232469=_0x2e5c7c[_0x347891];if(_0x232469&&_0x232469['queryResult']&&_0x232469[_0x74e1('0x2f')][_0x74e1('0x40')]){_0x487fcc['push'](createMessage(_0x3dc3e7,_0x4c916d,_0x41d895,_0x232469['queryResult']['fulfillmentText']));}}return Promise[_0x74e1('0x41')](_0x487fcc)[_0x74e1('0xd')](function(){if(_0x2bf682){_0x32579a['next']();}else{_0x32579a['stop']();}})[_0x74e1('0xf')](function(_0x2f4379){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x3dc3e7,JSON[_0x74e1('0x12')](_0x2f4379));_0x32579a['next']();});}})[_0x74e1('0xf')](function(_0x21b311){logger[_0x74e1('0x10')](_0x74e1('0x11'),_0x3dc3e7,_0x21b311['message'],_0x21b311[_0x74e1('0x42')]);_0x32579a[_0x74e1('0x17')]();});}}catch(_0x1a0e98){logger[_0x74e1('0x10')](_0x74e1('0x11'),_0x3dc3e7,JSON[_0x74e1('0x12')](_0x1a0e98));_0x32579a['stop']();}};}; \ No newline at end of file +var _0xd765=['finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','replace','SessionsClient','message','detectIntent','length','dialogflowV2','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','queryResult','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','stop','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','then'];(function(_0x1afc70,_0x3c3620){var _0x313b62=function(_0x5a1c79){while(--_0x5a1c79){_0x1afc70['push'](_0x1afc70['shift']());}};_0x313b62(++_0x3c3620);}(_0xd765,0xb5));var _0x5d76=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xd765[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x5d76('0x0'));var dialogflow=require(_0x5d76('0x1'));var md5=require(_0x5d76('0x2'));var moment=require('moment');var Promise=require(_0x5d76('0x3'));var logger=require(_0x5d76('0x4'))(_0x5d76('0x5'));var utils=require('./utils');var rpc={'chatMessage':require(_0x5d76('0x6')),'openchannelMessage':require(_0x5d76('0x7')),'mailMessage':require(_0x5d76('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x5d76('0x9')),'whatsappMessage':require(_0x5d76('0xa'))};function createMessage(_0x576a1b,_0x49aaf5,_0x1e6065,_0x4ed531){return new Promise(function(_0x3c4f63,_0x1b472f){var _0x4f6668=_['clone'](_0x1e6065);_0x4f6668[_0x5d76('0xb')]=_0x4ed531;return rpc[_0x49aaf5+_0x5d76('0xc')][_0x5d76('0xd')](_0x4f6668)['then'](function(){logger[_0x5d76('0xe')](_0x5d76('0xf'),_0x576a1b,_0x4f6668['body']);_0x3c4f63();})[_0x5d76('0x10')](function(_0x50e31f){logger[_0x5d76('0x11')](_0x5d76('0xf'),_0x576a1b,JSON[_0x5d76('0x12')](_0x50e31f));_0x1b472f(_0x50e31f);});});}exports[_0x5d76('0x13')]=function(_0x15f76c,_0x573503){return function(_0x165d51){try{if(!_[_0x5d76('0x14')](this[_0x5d76('0x15')][_0x5d76('0x16')])){logger[_0x5d76('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x15f76c,_0x5d76('0x17'));return _0x165d51[_0x5d76('0x18')]();}var _0x34e729={'ContactId':this[_0x5d76('0x19')]['id'],'sentAt':moment()[_0x5d76('0x1a')](_0x5d76('0x1b')),'direction':_0x5d76('0x1c')};if(this[_0x5d76('0x1d')]===_0x5d76('0x1e')||this[_0x5d76('0x1d')]===_0x5d76('0x1f')){_0x34e729['phone']=this[_0x5d76('0x15')]['phone'];}var _0x31c6d2=this['channel'];if(_0x31c6d2==='chat'){_0x34e729[_0x5d76('0x20')]=this[_0x5d76('0x21')]['id'];}else{_0x34e729[_[_0x5d76('0x22')](_0x31c6d2)+_0x5d76('0x23')]=this[_0x5d76('0x21')]['id'];}_0x34e729[_['upperFirst'](_0x31c6d2)+_0x5d76('0x24')]=this[_0x5d76('0x15')]['id'];if(this[_0x5d76('0x15')][_0x5d76('0x25')]){var _0x2149d8=_0x573503[0x4];if(!_[_0x5d76('0x26')](_0x2149d8)){_0x34e729[_0x5d76('0xb')]=utils[_0x5d76('0x27')](_0x2149d8,this);return rpc[_0x31c6d2+_0x5d76('0xc')][_0x5d76('0xd')](_0x34e729)[_0x5d76('0x28')](function(_0xf278b0){logger['info'](_0x5d76('0xf'),_0x15f76c,_0x34e729[_0x5d76('0xb')]);})['catch'](function(_0x2c02a0){logger[_0x5d76('0x11')](_0x5d76('0xf'),_0x15f76c,JSON[_0x5d76('0x12')](_0x2c02a0));})[_0x5d76('0x29')](function(){logger[_0x5d76('0xe')](_0x5d76('0x2a'),_0x15f76c);_0x165d51['stop']();});}else{logger[_0x5d76('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x15f76c);_0x165d51['stop']();}}else{var _0x5d3a87=this;var _0x2af44c=_0x573503[0x2][_0x5d76('0x2b')](/\\n/g,'\x0a');var _0x43b5a2={'credentials':{'private_key':_0x2af44c,'client_email':_0x573503[0x1]}};var _0x2ac469=new dialogflow[(_0x5d76('0x2c'))](_0x43b5a2);var _0x35662d=_0x2ac469['sessionPath'](_0x573503[0x0],md5(_0x5d3a87[_0x5d76('0x15')]['id']));var _0x13ce69={'session':_0x35662d,'queryInput':{'text':{'text':_0x5d3a87[_0x5d76('0x2d')][_0x5d76('0xb')],'languageCode':_0x573503[0x3]||'en'}}};return _0x2ac469[_0x5d76('0x2e')](_0x13ce69)[_0x5d76('0x28')](function(_0x1cf38c){if(_0x1cf38c&&_0x1cf38c[_0x5d76('0x2f')]){_0x5d3a87[_0x5d76('0xb')][_0x5d76('0x30')]=_0x1cf38c;var _0x558aa0=_0x1cf38c[0x0];var _0x43648c=_0x558aa0['queryResult'][_0x5d76('0x31')]&&_0x558aa0['queryResult'][_0x5d76('0x31')][_0x5d76('0x32')]?_0x558aa0['queryResult'][_0x5d76('0x31')][_0x5d76('0x32')][_0x5d76('0x33')][_0x5d76('0x34')]:![];_0x5d3a87[_0x5d76('0xb')][_0x5d76('0x35')]=_0x558aa0['queryResult'][_0x5d76('0x36')];_0x5d3a87[_0x5d76('0xb')][_0x5d76('0x37')]=_0x558aa0[_0x5d76('0x38')][_0x5d76('0x39')];_0x5d3a87[_0x5d76('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x558aa0['queryResult'][_0x5d76('0x31')]&&_0x558aa0[_0x5d76('0x38')]['diagnosticInfo'][_0x5d76('0x32')]?_0x558aa0[_0x5d76('0x38')][_0x5d76('0x31')][_0x5d76('0x32')]['end_conversation'][_0x5d76('0x34')]:![];_0x5d3a87[_0x5d76('0xb')][_0x5d76('0x3a')]=_0x558aa0['queryResult']['intent']['name'];_0x5d3a87['body'][_0x5d76('0x3b')]=_0x558aa0[_0x5d76('0x38')][_0x5d76('0x3c')][_0x5d76('0x3d')];_0x5d3a87[_0x5d76('0xb')][_0x5d76('0x3e')]=_0x558aa0[_0x5d76('0x38')]['intent'][_0x5d76('0x3f')];_0x5d3a87['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x558aa0['queryResult'][_0x5d76('0x40')];_0x5d3a87[_0x5d76('0xb')][_0x5d76('0x41')]=_0x558aa0[_0x5d76('0x38')][_0x5d76('0x42')];_0x5d3a87[_0x5d76('0xb')]['DIALOGFLOWV2_SCORE']=_0x558aa0['queryResult'][_0x5d76('0x43')];_0x34e729[_0x5d76('0x44')]=_0x5d76('0x30');_0x34e729[_0x5d76('0x45')]=JSON[_0x5d76('0x12')](_0x1cf38c);var _0x3d245=[];for(var _0x56b1c0=0x0;_0x56b1c0<_0x1cf38c[_0x5d76('0x2f')];_0x56b1c0++){var _0x5e6d94=_0x1cf38c[_0x56b1c0];if(_0x5e6d94&&_0x5e6d94[_0x5d76('0x38')]&&_0x5e6d94['queryResult']['fulfillmentText']){_0x3d245[_0x5d76('0x46')](createMessage(_0x15f76c,_0x31c6d2,_0x34e729,_0x5e6d94[_0x5d76('0x38')][_0x5d76('0x47')]));}}return Promise[_0x5d76('0x48')](_0x3d245)[_0x5d76('0x28')](function(){if(_0x43648c){_0x165d51[_0x5d76('0x18')]();}else{_0x165d51[_0x5d76('0x49')]();}})[_0x5d76('0x10')](function(_0x481526){logger[_0x5d76('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x15f76c,JSON[_0x5d76('0x12')](_0x481526));_0x165d51[_0x5d76('0x18')]();});}})[_0x5d76('0x10')](function(_0x8a8223){logger['error'](_0x5d76('0xf'),_0x15f76c,_0x8a8223[_0x5d76('0x2d')],_0x8a8223['stack']);_0x165d51[_0x5d76('0x18')]();});}}catch(_0x96cdba){logger[_0x5d76('0x11')](_0x5d76('0xf'),_0x15f76c,JSON[_0x5d76('0x12')](_0x96cdba));_0x165d51[_0x5d76('0x49')]();}};}; \ 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 5e8f918..aaa2d7a 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 _0x4e6e=['stop','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','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','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','message','join'];(function(_0x196e25,_0x16ff57){var _0x498ebd=function(_0x270ba4){while(--_0x270ba4){_0x196e25['push'](_0x196e25['shift']());}};_0x498ebd(++_0x16ff57);}(_0x4e6e,0x169));var _0xe4e6=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x4e6e[_0x50007c];return _0x5c1ec7;};'use strict';var schema=require(_0xe4e6('0x0'));var _=require(_0xe4e6('0x1'));var htmlToText=require(_0xe4e6('0x2'));var utils=require('./utils');var logger=require(_0xe4e6('0x3'))(_0xe4e6('0x4'));var gotoif=schema({'condition':{'type':_0xe4e6('0x5'),'required':!![],'message':_0xe4e6('0x6')},'priorityTrue':{'type':_0xe4e6('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':_0xe4e6('0x8')}});exports['consequence']=function(_0x135062,_0x20f3ea){return function(_0x1fa3fa){try{var _0x2366a4={'condition':htmlToText[_0xe4e6('0x9')](utils[_0xe4e6('0xa')](_0x20f3ea[0x0],this),{'wordwrap':![]})[_0xe4e6('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x20f3ea[0x1],'priorityFalse':_0x20f3ea[0x2]};var _0x232bdc=gotoif[_0xe4e6('0x0')](_0x2366a4,{'typecast':!![]});if(_0x232bdc[_0xe4e6('0xc')]){logger[_0xe4e6('0xd')]('[%s][GOTOIF]\x20%s',_0x135062,_['map'](_0x232bdc,_0xe4e6('0xe'))[_0xe4e6('0xf')](',\x20'));_0x1fa3fa[_0xe4e6('0x10')]();}else{try{var _0x57c9c9=eval('('+_0x2366a4['condition']+')');var _0x20187b=_0x57c9c9?_0x2366a4[_0xe4e6('0x11')]:_0x2366a4['priorityFalse'];logger[_0xe4e6('0x12')](_0xe4e6('0x13'),_0x135062,_0x2366a4[_0xe4e6('0x14')],_0x57c9c9,_0x20187b||_0xe4e6('0x15'));if(_0x20187b){var _0x32c5d9=_[_0xe4e6('0x16')](_0x1fa3fa[_0xe4e6('0x17')](),{'p':_0x20187b});if(_0x32c5d9>=0x0){logger[_0xe4e6('0x12')](_0xe4e6('0x18'),_0x135062,_0x20187b||'next',_0x32c5d9);_0x1fa3fa[_0xe4e6('0x15')](_0x32c5d9);}else{logger[_0xe4e6('0x12')](_0xe4e6('0x19'),_0x135062,_0x20187b||_0xe4e6('0x15'));_0x1fa3fa[_0xe4e6('0x10')]();}}else{_0x1fa3fa[_0xe4e6('0x15')]();}}catch(_0x4f3490){logger[_0xe4e6('0xd')](_0xe4e6('0x1a'),_0x135062,_0x4f3490[_0xe4e6('0xe')]);_0x1fa3fa[_0xe4e6('0x10')]();}}}catch(_0xb107e3){logger['error'](_0xe4e6('0x1b'),_0x135062,JSON[_0xe4e6('0x1c')](_0xb107e3));_0x1fa3fa['stop']();}};}; \ No newline at end of file +var _0x9e54=['routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','error','stringify','validate','lodash','./utils'];(function(_0x1758c6,_0x126d79){var _0x5da38e=function(_0xb2b125){while(--_0xb2b125){_0x1758c6['push'](_0x1758c6['shift']());}};_0x5da38e(++_0x126d79);}(_0x9e54,0x165));var _0x49e5=function(_0xb1a4df,_0xad7f78){_0xb1a4df=_0xb1a4df-0x0;var _0x4fbd06=_0x9e54[_0xb1a4df];return _0x4fbd06;};'use strict';var schema=require(_0x49e5('0x0'));var _=require(_0x49e5('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x49e5('0x2'));var logger=require('../../../../config/logger')(_0x49e5('0x3'));var gotoif=schema({'condition':{'type':_0x49e5('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x49e5('0x5'),'message':_0x49e5('0x6')},'priorityFalse':{'type':_0x49e5('0x5'),'message':_0x49e5('0x7')}});exports[_0x49e5('0x8')]=function(_0x12e180,_0x1a7df6){return function(_0x43eb49){try{var _0x1240e2={'condition':htmlToText[_0x49e5('0x9')](utils[_0x49e5('0xa')](_0x1a7df6[0x0],this),{'wordwrap':![]})[_0x49e5('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1a7df6[0x1],'priorityFalse':_0x1a7df6[0x2]};var _0x10c497=gotoif['validate'](_0x1240e2,{'typecast':!![]});if(_0x10c497[_0x49e5('0xc')]){logger['error'](_0x49e5('0xd'),_0x12e180,_[_0x49e5('0xe')](_0x10c497,_0x49e5('0xf'))[_0x49e5('0x10')](',\x20'));_0x43eb49[_0x49e5('0x11')]();}else{try{var _0x25d56a=eval('('+_0x1240e2[_0x49e5('0x12')]+')');var _0x3f3c95=_0x25d56a?_0x1240e2[_0x49e5('0x13')]:_0x1240e2['priorityFalse'];logger[_0x49e5('0x14')](_0x49e5('0x15'),_0x12e180,_0x1240e2['condition'],_0x25d56a,_0x3f3c95||'next');if(_0x3f3c95){var _0x45a108=_[_0x49e5('0x16')](_0x43eb49[_0x49e5('0x17')](),{'p':_0x3f3c95});if(_0x45a108>=0x0){logger[_0x49e5('0x14')](_0x49e5('0x18'),_0x12e180,_0x3f3c95||_0x49e5('0x19'),_0x45a108);_0x43eb49[_0x49e5('0x19')](_0x45a108);}else{logger[_0x49e5('0x14')](_0x49e5('0x1a'),_0x12e180,_0x3f3c95||_0x49e5('0x19'));_0x43eb49[_0x49e5('0x11')]();}}else{_0x43eb49[_0x49e5('0x19')]();}}catch(_0x4c53cd){logger['error'](_0x49e5('0x1b'),_0x12e180,_0x4c53cd[_0x49e5('0xf')]);_0x43eb49['stop']();}}}catch(_0x414bcf){logger[_0x49e5('0x1c')](_0x49e5('0xd'),_0x12e180,JSON[_0x49e5('0x1d')](_0x414bcf));_0x43eb49[_0x49e5('0x11')]();}};}; \ 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 e859208..905f38c 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 _0x809c=['consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x48a5b2,_0xad976c){var _0x5c99b0=function(_0x2f1373){while(--_0x2f1373){_0x48a5b2['push'](_0x48a5b2['shift']());}};_0x5c99b0(++_0xad976c);}(_0x809c,0xd4));var _0xc809=function(_0x14bc0d,_0x330207){_0x14bc0d=_0x14bc0d-0x0;var _0x29575a=_0x809c[_0x14bc0d];return _0x29575a;};'use strict';var schema=require(_0xc809('0x0'));var _=require(_0xc809('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0xc809('0x2'),'required':!![],'message':_0xc809('0x3')}});exports[_0xc809('0x4')]=function(_0x5b0dbe,_0x19dc97){return function(_0x128c9b){try{var _0x1a9132={'priority':_0x19dc97[0x0]};var _0x2af786=gotop[_0xc809('0x0')](_0x1a9132,{'typecast':!![]});if(_0x2af786[_0xc809('0x5')]){logger[_0xc809('0x6')](_0xc809('0x7'),_0x5b0dbe,_[_0xc809('0x8')](_0x2af786,_0xc809('0x9'))[_0xc809('0xa')](',\x20'));_0x128c9b[_0xc809('0xb')]();}else{logger[_0xc809('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x5b0dbe,_0x1a9132[_0xc809('0xd')]);if(_0x1a9132[_0xc809('0xd')]){var _0x517314=_[_0xc809('0xe')](_0x128c9b['rules'](),{'p':_0x1a9132[_0xc809('0xd')]});if(_0x517314>=0x0){logger['info'](_0xc809('0xf'),_0x5b0dbe,_0x1a9132[_0xc809('0xd')]||_0xc809('0x10'),_0x517314);_0x128c9b[_0xc809('0x10')](_0x517314);}else{logger['info'](_0xc809('0x11'),_0x5b0dbe,_0x1a9132[_0xc809('0xd')]||_0xc809('0x10'));_0x128c9b['stop']();}}else{_0x128c9b[_0xc809('0x10')]();}}}catch(_0x3bb3f7){logger[_0xc809('0x6')](_0xc809('0x7'),_0x5b0dbe,JSON['stringify'](_0x3bb3f7));_0x128c9b['stop']();}};}; \ No newline at end of file +var _0x9bc7=['stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][GOTOP]\x20%s','map','message'];(function(_0x57c16e,_0x38659b){var _0x196819=function(_0x1f005a){while(--_0x1f005a){_0x57c16e['push'](_0x57c16e['shift']());}};_0x196819(++_0x38659b);}(_0x9bc7,0xa1));var _0x79bc=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9bc7[_0x4b369d];return _0x571a98;};'use strict';var schema=require('validate');var _=require(_0x79bc('0x0'));var logger=require('../../../../config/logger')(_0x79bc('0x1'));var gotop=schema({'priority':{'type':_0x79bc('0x2'),'required':!![],'message':_0x79bc('0x3')}});exports[_0x79bc('0x4')]=function(_0x3b4e90,_0x5d23e3){return function(_0x5c8917){try{var _0x3fb4ad={'priority':_0x5d23e3[0x0]};var _0x209e0b=gotop[_0x79bc('0x5')](_0x3fb4ad,{'typecast':!![]});if(_0x209e0b[_0x79bc('0x6')]){logger['error'](_0x79bc('0x7'),_0x3b4e90,_[_0x79bc('0x8')](_0x209e0b,_0x79bc('0x9'))['join'](',\x20'));_0x5c8917[_0x79bc('0xa')]();}else{logger[_0x79bc('0xb')](_0x79bc('0xc'),_0x3b4e90,_0x3fb4ad[_0x79bc('0xd')]);if(_0x3fb4ad[_0x79bc('0xd')]){var _0x4d6028=_[_0x79bc('0xe')](_0x5c8917['rules'](),{'p':_0x3fb4ad[_0x79bc('0xd')]});if(_0x4d6028>=0x0){logger[_0x79bc('0xb')](_0x79bc('0xf'),_0x3b4e90,_0x3fb4ad[_0x79bc('0xd')]||_0x79bc('0x10'),_0x4d6028);_0x5c8917[_0x79bc('0x10')](_0x4d6028);}else{logger[_0x79bc('0xb')](_0x79bc('0x11'),_0x3b4e90,_0x3fb4ad[_0x79bc('0xd')]||_0x79bc('0x10'));_0x5c8917[_0x79bc('0xa')]();}}else{_0x5c8917['next']();}}}catch(_0x4cb76f){logger[_0x79bc('0x12')](_0x79bc('0x7'),_0x3b4e90,JSON['stringify'](_0x4cb76f));_0x5c8917[_0x79bc('0xa')]();}};}; \ 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 cb175b1..22a7ae4 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 _0x1364=['../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','account','InteractionId','interaction','Message','then','info','body','next','catch','[%s][MESSAGE]\x20%s','stringify','stop','error','lodash','../../../../config/logger','routing'];(function(_0x15797a,_0x16274f){var _0x3e2618=function(_0x2b6e99){while(--_0x2b6e99){_0x15797a['push'](_0x15797a['shift']());}};_0x3e2618(++_0x16274f);}(_0x1364,0x1eb));var _0x4136=function(_0x3db952,_0x536ec2){_0x3db952=_0x3db952-0x0;var _0xcd2e7d=_0x1364[_0x3db952];return _0xcd2e7d;};'use strict';var _=require(_0x4136('0x0'));var utils=require('./utils');var logger=require(_0x4136('0x1'))(_0x4136('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4136('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x4136('0x4')),'faxMessage':require(_0x4136('0x5')),'whatsappMessage':require(_0x4136('0x6'))};exports['consequence']=function(_0x47d8f8,_0x19ac5e){return function(_0x5bf035){try{var _0x38f45a={'body':utils[_0x4136('0x7')](_0x19ac5e[0x0],this),'ContactId':this[_0x4136('0x8')]['id']};if(this[_0x4136('0x9')]===_0x4136('0xa')){_0x38f45a[_0x4136('0xb')]=this['account']['id'];}else{_0x38f45a[_[_0x4136('0xc')](this[_0x4136('0x9')])+'AccountId']=this[_0x4136('0xd')]['id'];}_0x38f45a[_[_0x4136('0xc')](this[_0x4136('0x9')])+_0x4136('0xe')]=this[_0x4136('0xf')]['id'];if(rpc[this['channel']+_0x4136('0x10')]){return rpc[this[_0x4136('0x9')]+'Message']['create'](_0x38f45a)[_0x4136('0x11')](function(_0x2d7db8){logger[_0x4136('0x12')]('[%s][MESSAGE]\x20%s',_0x47d8f8,_0x38f45a[_0x4136('0x13')]);_0x5bf035[_0x4136('0x14')]();})[_0x4136('0x15')](function(_0x1ef62d){logger['error'](_0x4136('0x16'),_0x47d8f8,JSON[_0x4136('0x17')](_0x1ef62d));_0x5bf035[_0x4136('0x18')]();});}}catch(_0x2b0d5c){logger[_0x4136('0x19')]('[%s][MESSAGE]\x20%s',_0x47d8f8,JSON[_0x4136('0x17')](_0x2b0d5c));_0x5bf035['stop']();}};}; \ No newline at end of file +var _0x2697=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','account','interaction','Message','then','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop'];(function(_0x3f766c,_0x1fef7c){var _0x36a7db=function(_0x3d221d){while(--_0x3d221d){_0x3f766c['push'](_0x3f766c['shift']());}};_0x36a7db(++_0x1fef7c);}(_0x2697,0x120));var _0x7269=function(_0x15bbf1,_0x40ef96){_0x15bbf1=_0x15bbf1-0x0;var _0x5c4b47=_0x2697[_0x15bbf1];return _0x5c4b47;};'use strict';var _=require('lodash');var utils=require(_0x7269('0x0'));var logger=require(_0x7269('0x1'))(_0x7269('0x2'));var rpc={'chatMessage':require(_0x7269('0x3')),'openchannelMessage':require(_0x7269('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7269('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x7269('0x6'))};exports[_0x7269('0x7')]=function(_0x350aeb,_0x320ed5){return function(_0x438f7c){try{var _0x1e47e3={'body':utils[_0x7269('0x8')](_0x320ed5[0x0],this),'ContactId':this[_0x7269('0x9')]['id']};if(this[_0x7269('0xa')]===_0x7269('0xb')){_0x1e47e3[_0x7269('0xc')]=this['account']['id'];}else{_0x1e47e3[_[_0x7269('0xd')](this[_0x7269('0xa')])+'AccountId']=this[_0x7269('0xe')]['id'];}_0x1e47e3[_['upperFirst'](this[_0x7269('0xa')])+'InteractionId']=this[_0x7269('0xf')]['id'];if(rpc[this['channel']+_0x7269('0x10')]){return rpc[this[_0x7269('0xa')]+_0x7269('0x10')]['create'](_0x1e47e3)[_0x7269('0x11')](function(_0x2c5957){logger['info'](_0x7269('0x12'),_0x350aeb,_0x1e47e3[_0x7269('0x13')]);_0x438f7c[_0x7269('0x14')]();})['catch'](function(_0x2ba8ec){logger[_0x7269('0x15')](_0x7269('0x12'),_0x350aeb,JSON[_0x7269('0x16')](_0x2ba8ec));_0x438f7c[_0x7269('0x17')]();});}}catch(_0x44e266){logger[_0x7269('0x15')](_0x7269('0x12'),_0x350aeb,JSON['stringify'](_0x44e266));_0x438f7c[_0x7269('0x17')]();}};}; \ 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 9c26a93..265571e 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 _0xead1=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','../../../../config/logger','routing'];(function(_0x1655d6,_0x169796){var _0x526b45=function(_0x88e657){while(--_0x88e657){_0x1655d6['push'](_0x1655d6['shift']());}};_0x526b45(++_0x169796);}(_0xead1,0x1e6));var _0x1ead=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xead1[_0x494d1f];return _0x457b6e;};'use strict';var utils=require('./utils');var logger=require(_0x1ead('0x0'))(_0x1ead('0x1'));exports['consequence']=function(_0x4fe2d9,_0x5f16b3){return function(_0x1f36fd){try{logger['info'](_0x1ead('0x2'),_0x4fe2d9,utils[_0x1ead('0x3')](_0x5f16b3[0x0],this));_0x1f36fd[_0x1ead('0x4')]();}catch(_0x48491b){logger[_0x1ead('0x5')](_0x1ead('0x2'),_0x4fe2d9,JSON[_0x1ead('0x6')](_0x48491b));_0x1f36fd[_0x1ead('0x7')]();}};}; \ No newline at end of file +var _0xd3d5=['error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xd3d5,0xdf));var _0x5d3d=function(_0x175c6e,_0x6385e8){_0x175c6e=_0x175c6e-0x0;var _0x423b4f=_0xd3d5[_0x175c6e];return _0x423b4f;};'use strict';var utils=require(_0x5d3d('0x0'));var logger=require(_0x5d3d('0x1'))(_0x5d3d('0x2'));exports[_0x5d3d('0x3')]=function(_0x4cebf5,_0x3cf64f){return function(_0x22a0bf){try{logger[_0x5d3d('0x4')](_0x5d3d('0x5'),_0x4cebf5,utils[_0x5d3d('0x6')](_0x3cf64f[0x0],this));_0x22a0bf['next']();}catch(_0x122194){logger[_0x5d3d('0x7')]('[%s][NOOP]\x20%s',_0x4cebf5,JSON[_0x5d3d('0x8')](_0x122194));_0x22a0bf[_0x5d3d('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 5c51cb0..1def4cc 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 _0xfc3e=['waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','stop','find','Queues','timeout','createQueue','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','log','stack','validate','lodash','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','joinAt','emit','queue','push','capitalize','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number'];(function(_0x26164c,_0x1a489c){var _0x33358d=function(_0x14e04e){while(--_0x14e04e){_0x26164c['push'](_0x26164c['shift']());}};_0x33358d(++_0x1a489c);}(_0xfc3e,0x120));var _0xefc3=function(_0x199c9d,_0x19475d){_0x199c9d=_0x199c9d-0x0;var _0x19e280=_0xfc3e[_0x199c9d];return _0x19e280;};'use strict';var schema=require(_0xefc3('0x0'));var _=require(_0xefc3('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0xefc3('0x2'));var Redis=require(_0xefc3('0x3'));var config=require(_0xefc3('0x4'));var logger=require('../../../../config/logger')(_0xefc3('0x5'));var strategy=require(_0xefc3('0x6'));config[_0xefc3('0x7')]=_[_0xefc3('0x8')](config[_0xefc3('0x7')],{'host':_0xefc3('0x9'),'port':0x18eb});var io=require(_0xefc3('0xa'))(new Redis(config['redis']));var attributes=['id',_0xefc3('0xb'),_0xefc3('0xc'),'queue','from',_0xefc3('0xd')];function emit(_0x51e29a,_0x18d083,_0x59f345){io['to'](_0x51e29a)[_0xefc3('0xe')](_0x18d083,_0x59f345);}function emitChannelQueueInteraction(_0x45675c,_0x37b786,_0x13f68a,_0x36ff7e,_0x9168f5,_0x55512f,_0xbaf8ef,_0x2b7109){var _0x48b1d0=_['clone'](_0x13f68a);_0x48b1d0[_0xefc3('0xb')]=_0x2b7109;_0x48b1d0[_0xefc3('0xf')]=_0x37b786;_0x48b1d0['account']=_0x36ff7e;_0x48b1d0['id']=_0x9168f5;if(_0x55512f){attributes[_0xefc3('0x10')](_[_0xefc3('0x11')](_0x45675c)+'InteractionId');_0xbaf8ef[util[_0xefc3('0x12')](_0xefc3('0x13'),_0x45675c)][_0x9168f5]=_[_0xefc3('0x14')](_0x48b1d0,attributes);}else{delete _0xbaf8ef[util['format'](_0xefc3('0x13'),_0x45675c)][_0x9168f5];}emit(util[_0xefc3('0x12')](_0xefc3('0x15'),_0x45675c,_0x37b786),util[_0xefc3('0x12')]('%s_queue_waiting_interaction:%s',_0x45675c,_0x55512f?'save':_0xefc3('0x16')),_['pick'](_0x48b1d0,attributes));}var rpc={'openchannelQueueReport':require(_0xefc3('0x17')),'mailQueueReport':require(_0xefc3('0x18')),'chatQueueReport':require(_0xefc3('0x19')),'smsQueueReport':require(_0xefc3('0x1a')),'faxQueueReport':require(_0xefc3('0x1b')),'whatsappQueueReport':require(_0xefc3('0x1c'))};var queue=schema({'name':{'type':_0xefc3('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xefc3('0x1e'),'message':_0xefc3('0x1f')}});function startRouting(_0x33f0a1,_0x3128e7,_0xdca18c,_0x4fd7b9){if(_0x33f0a1&&_0x3128e7&&_0xdca18c){_0x3128e7[_0xefc3('0x20')]+=0x1;var _0x5871b2={'uniqueid':_0x33f0a1,'from':_0xdca18c[_0xefc3('0x21')]?_0xdca18c[_0xefc3('0x21')][_0xefc3('0x22')]:'','joinAt':moment()['format'](_0xefc3('0x23')),'ContactId':_0xdca18c[_0xefc3('0x24')]?_0xdca18c['contact']['id']:null,'ListId':_0xdca18c[_0xefc3('0x25')]?_0xdca18c[_0xefc3('0x25')]['id']:null};_0x5871b2[_['upperFirst'](_0xdca18c[_0xefc3('0x26')])+_0xefc3('0x27')]=_0x3128e7['id']||null;_0x5871b2[_[_0xefc3('0x28')](_0xdca18c['channel'])+_0xefc3('0x29')]=_0xdca18c['interaction']?_0xdca18c[_0xefc3('0x2a')]['id']:null;_0x5871b2[_[_0xefc3('0x28')](_0xdca18c[_0xefc3('0x26')])+_0xefc3('0x2b')]=_0xdca18c[_0xefc3('0x2c')]?_0xdca18c[_0xefc3('0x2c')]['id']:null;_0x5871b2[_[_0xefc3('0x28')](_0xdca18c['channel'])+(_0xdca18c[_0xefc3('0x26')]!==_0xefc3('0x2d')?_0xefc3('0x2e'):_0xefc3('0x2f'))]=_0xdca18c[_0xefc3('0xc')]?_0xdca18c[_0xefc3('0xc')]['id']:null;logger[_0xefc3('0x30')](util[_0xefc3('0x12')]('[%s][START:QUEUE][NAME:%s]',_0x33f0a1,_0x3128e7[_0xefc3('0x31')]));emitChannelQueueInteraction(_0xdca18c[_0xefc3('0x26')],_0x3128e7[_0xefc3('0x31')],_0x5871b2,_0xdca18c[_0xefc3('0xc')][_0xefc3('0x31')],_0xdca18c['message']['id'],!![],_0x4fd7b9,_0x3128e7['id']);if(rpc[_0xdca18c[_0xefc3('0x26')]+'QueueReport']){return rpc[_0xdca18c['channel']+_0xefc3('0x32')][_0xefc3('0x33')](_0x5871b2)[_0xefc3('0x34')](function(_0x2bbc8c){logger[_0xefc3('0x35')](_0xefc3('0x36'));});}}}function stopRouting(_0x50c492,_0x52956d,_0x3cd956,_0x54424f){if(_0x50c492&&_0x52956d){_0x52956d['waiting']-=0x1;var _0x550cf1={'leaveAt':moment()['format'](_0xefc3('0x23')),'acceptAt':moment()['format'](_0xefc3('0x23')),'reason':_0xefc3('0x37')};logger[_0xefc3('0x30')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x50c492,_0x52956d[_0xefc3('0x31')]));emitChannelQueueInteraction(_0x3cd956[_0xefc3('0x26')],_0x52956d[_0xefc3('0x31')],_0x3cd956[_0xefc3('0x21')],_0x3cd956[_0xefc3('0xc')][_0xefc3('0x31')],_0x3cd956[_0xefc3('0x2c')]['id'],![],_0x54424f,_0x52956d['id']);if(rpc[_0x3cd956[_0xefc3('0x26')]+_0xefc3('0x32')]){return rpc[_0x3cd956[_0xefc3('0x26')]+_0xefc3('0x32')][_0xefc3('0x38')](_0x50c492,_0x550cf1)[_0xefc3('0x34')](function(_0x4074f8){logger[_0xefc3('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x9d510a,_0x282307,_0x40c171,_0x4e97d1){if(_0x9d510a&&_0x282307){_0x282307[_0xefc3('0x20')]-=0x1;var _0x42dc2c={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xefc3('0x12')](_0xefc3('0x23')),'reason':'timeout'};logger[_0xefc3('0x30')](util[_0xefc3('0x12')](_0xefc3('0x39'),_0x9d510a,_0x282307[_0xefc3('0x31')]));emitChannelQueueInteraction(_0x40c171[_0xefc3('0x26')],_0x282307[_0xefc3('0x31')],_0x40c171[_0xefc3('0x21')],_0x40c171['account']['name'],_0x40c171[_0xefc3('0x2c')]['id'],![],_0x4e97d1);if(rpc[_0x40c171[_0xefc3('0x26')]+_0xefc3('0x32')]){return rpc[_0x40c171[_0xefc3('0x26')]+_0xefc3('0x32')]['update'](_0x9d510a,_0x42dc2c)[_0xefc3('0x34')](function(_0x3da307){logger[_0xefc3('0x35')](_0xefc3('0x3a'));});}}}function handleFindQueue(_0x540d10){return function(_0x4f2476){return _0x4f2476[_0xefc3('0x31')][_0xefc3('0x3b')]()===_0x540d10['toLowerCase']();};}exports[_0xefc3('0x3c')]=function(_0x5011d9,_0x6905c8,_0x2988b2,_0x3d6d81){return function(_0x15ff14){try{var _0xc049bb={'name':_0x6905c8[0x0],'timeout':_0x6905c8[0x1]};var _0x5a108d=queue['validate'](_0xc049bb,{'typecast':!![]});if(_0x5a108d['length']){logger[_0xefc3('0x35')](_0xefc3('0x3d'),_0x5011d9,_[_0xefc3('0x3e')](_0x5a108d,'message')['join'](',\x20'));_0x15ff14[_0xefc3('0x3f')]();}else{var _0x504a73=_[_0xefc3('0x40')](_0x2988b2[_0x3d6d81[_0xefc3('0x26')]+_0xefc3('0x41')],handleFindQueue(_0xc049bb[_0xefc3('0x31')]));if(_0x504a73){startRouting(_0x5011d9,_0x504a73,_0x3d6d81,_0x2988b2);var _0x4c7d46=(_0x504a73[_0xefc3('0x42')]||0xa)*0x3e8;var _0x381e6a=(_0xc049bb['timeout']||0x14)*0x3e8;var _0x707466;if(_0x4c7d46>_0x381e6a){_0x381e6a=_0x4c7d46;}var _0x120813=seqqueue[_0xefc3('0x43')](_0x4c7d46);_0x120813['id']=_0x5011d9;_0x120813['atimeout']=_0x4c7d46;_0x120813['qtimeout']=_0x381e6a;_0x120813[_0xefc3('0x26')]=_0x3d6d81[_0xefc3('0x26')];_0x2988b2['rules'][_0x5011d9]['on'](_0xefc3('0x44'),function(){logger[_0xefc3('0x30')](_0xefc3('0x45'),_0x5011d9);stopRouting(_0x5011d9,_0x504a73,_0x3d6d81,_0x2988b2);clearTimeout(_0x707466);_0x707466=undefined;_0x120813[_0xefc3('0x46')](!![]);if(_0x2988b2[_0xefc3('0x47')][_0x5011d9]){delete _0x2988b2[_0xefc3('0x47')][_0x5011d9];}_0x15ff14[_0xefc3('0x3f')]();});_0x2988b2[_0xefc3('0x47')][_0x5011d9]['on'](_0xefc3('0x48'),function(){if(_0x2988b2['rules'][_0x5011d9]){delete _0x2988b2[_0xefc3('0x47')][_0x5011d9];}});_0x707466=setTimeout(function(){logger['info'](_0xefc3('0x49'),_0x5011d9);endRouting(_0x5011d9,_0x504a73,_0x3d6d81,_0x2988b2);clearTimeout(_0x707466);_0x120813[_0xefc3('0x46')](!![]);_0x15ff14[_0xefc3('0x4a')]();},_0x381e6a);switch(_0x504a73[_0xefc3('0x4b')]){case _0xefc3('0x4c'):strategy[_0xefc3('0x4c')](_0x120813,_0x504a73,_0x2988b2,_0x3d6d81);break;default:strategy[_0xefc3('0x4d')](_0x120813,_0x504a73,_0x2988b2,_0x3d6d81);}}else{logger[_0xefc3('0x35')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x5011d9,_0xc049bb[_0xefc3('0x31')]);_0x15ff14[_0xefc3('0x3f')]();}}}catch(_0x3b39dd){console[_0xefc3('0x4e')](_0x3b39dd);logger['error'](_0xefc3('0x3d'),_0x5011d9,_0x3b39dd[_0xefc3('0x4f')]);_0x15ff14[_0xefc3('0x3f')]();}};}; \ No newline at end of file +var _0xe566=['redis','defaults','localhost','socket.io-emitter','account','queue','from','joinAt','emit','clone','queue_id','push','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','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','interaction','MessageId','message','chat','AccountId','WebsiteId','name','QueueReport','create','catch','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','error','toLowerCase','consequence','length','map','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','./strategy'];(function(_0x306462,_0x87e538){var _0x25c09a=function(_0x51e7c3){while(--_0x51e7c3){_0x306462['push'](_0x306462['shift']());}};_0x25c09a(++_0x87e538);}(_0xe566,0xa0));var _0x6e56=function(_0x1bee00,_0x5b22ec){_0x1bee00=_0x1bee00-0x0;var _0x95f29e=_0xe566[_0x1bee00];return _0x95f29e;};'use strict';var schema=require(_0x6e56('0x0'));var _=require(_0x6e56('0x1'));var util=require(_0x6e56('0x2'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x6e56('0x3'))(_0x6e56('0x4'));var strategy=require(_0x6e56('0x5'));config[_0x6e56('0x6')]=_[_0x6e56('0x7')](config[_0x6e56('0x6')],{'host':_0x6e56('0x8'),'port':0x18eb});var io=require(_0x6e56('0x9'))(new Redis(config[_0x6e56('0x6')]));var attributes=['id','queue_id',_0x6e56('0xa'),_0x6e56('0xb'),_0x6e56('0xc'),_0x6e56('0xd')];function emit(_0x1d833d,_0x101f4c,_0x5b62df){io['to'](_0x1d833d)[_0x6e56('0xe')](_0x101f4c,_0x5b62df);}function emitChannelQueueInteraction(_0x4c97a6,_0x3ac42b,_0x4cc083,_0x2982fc,_0x1eba8b,_0x3e3406,_0x17fc90,_0x26dfc7){var _0x789a48=_[_0x6e56('0xf')](_0x4cc083);_0x789a48[_0x6e56('0x10')]=_0x26dfc7;_0x789a48['queue']=_0x3ac42b;_0x789a48[_0x6e56('0xa')]=_0x2982fc;_0x789a48['id']=_0x1eba8b;if(_0x3e3406){attributes[_0x6e56('0x11')](_[_0x6e56('0x12')](_0x4c97a6)+_0x6e56('0x13'));_0x17fc90[util[_0x6e56('0x14')]('%sQueuesWaitingInteractions',_0x4c97a6)][_0x1eba8b]=_[_0x6e56('0x15')](_0x789a48,attributes);}else{delete _0x17fc90[util[_0x6e56('0x14')](_0x6e56('0x16'),_0x4c97a6)][_0x1eba8b];}emit(util[_0x6e56('0x14')](_0x6e56('0x17'),_0x4c97a6,_0x3ac42b),util[_0x6e56('0x14')]('%s_queue_waiting_interaction:%s',_0x4c97a6,_0x3e3406?_0x6e56('0x18'):_0x6e56('0x19')),_[_0x6e56('0x15')](_0x789a48,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6e56('0x1a')),'chatQueueReport':require(_0x6e56('0x1b')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x6e56('0x1c')),'whatsappQueueReport':require(_0x6e56('0x1d'))};var queue=schema({'name':{'type':_0x6e56('0x1e'),'required':!![],'message':_0x6e56('0x1f')},'timeout':{'type':_0x6e56('0x20'),'message':_0x6e56('0x21')}});function startRouting(_0x4a1ec7,_0x3fe598,_0x2d9fd7,_0x398fc8){if(_0x4a1ec7&&_0x3fe598&&_0x2d9fd7){_0x3fe598[_0x6e56('0x22')]+=0x1;var _0x49eb24={'uniqueid':_0x4a1ec7,'from':_0x2d9fd7['body']?_0x2d9fd7[_0x6e56('0x23')][_0x6e56('0xc')]:'','joinAt':moment()[_0x6e56('0x14')](_0x6e56('0x24')),'ContactId':_0x2d9fd7[_0x6e56('0x25')]?_0x2d9fd7[_0x6e56('0x25')]['id']:null,'ListId':_0x2d9fd7['list']?_0x2d9fd7[_0x6e56('0x26')]['id']:null};_0x49eb24[_[_0x6e56('0x27')](_0x2d9fd7[_0x6e56('0x28')])+_0x6e56('0x29')]=_0x3fe598['id']||null;_0x49eb24[_[_0x6e56('0x27')](_0x2d9fd7['channel'])+_0x6e56('0x13')]=_0x2d9fd7[_0x6e56('0x2a')]?_0x2d9fd7[_0x6e56('0x2a')]['id']:null;_0x49eb24[_['upperFirst'](_0x2d9fd7[_0x6e56('0x28')])+_0x6e56('0x2b')]=_0x2d9fd7[_0x6e56('0x2c')]?_0x2d9fd7[_0x6e56('0x2c')]['id']:null;_0x49eb24[_['upperFirst'](_0x2d9fd7[_0x6e56('0x28')])+(_0x2d9fd7[_0x6e56('0x28')]!==_0x6e56('0x2d')?_0x6e56('0x2e'):_0x6e56('0x2f'))]=_0x2d9fd7['account']?_0x2d9fd7[_0x6e56('0xa')]['id']:null;logger['info'](util[_0x6e56('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4a1ec7,_0x3fe598[_0x6e56('0x30')]));emitChannelQueueInteraction(_0x2d9fd7['channel'],_0x3fe598['name'],_0x49eb24,_0x2d9fd7[_0x6e56('0xa')][_0x6e56('0x30')],_0x2d9fd7[_0x6e56('0x2c')]['id'],!![],_0x398fc8,_0x3fe598['id']);if(rpc[_0x2d9fd7[_0x6e56('0x28')]+_0x6e56('0x31')]){return rpc[_0x2d9fd7['channel']+'QueueReport'][_0x6e56('0x32')](_0x49eb24)[_0x6e56('0x33')](function(_0x334ed4){logger['error'](_0x6e56('0x34'));});}}}function stopRouting(_0xde0d07,_0x340b9c,_0x47b596,_0x170dff){if(_0xde0d07&&_0x340b9c){_0x340b9c[_0x6e56('0x22')]-=0x1;var _0x41683b={'leaveAt':moment()[_0x6e56('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x6e56('0x14')](_0x6e56('0x24')),'reason':_0x6e56('0x35')};logger[_0x6e56('0x36')](util['format'](_0x6e56('0x37'),_0xde0d07,_0x340b9c['name']));emitChannelQueueInteraction(_0x47b596[_0x6e56('0x28')],_0x340b9c[_0x6e56('0x30')],_0x47b596[_0x6e56('0x23')],_0x47b596[_0x6e56('0xa')]['name'],_0x47b596['message']['id'],![],_0x170dff,_0x340b9c['id']);if(rpc[_0x47b596[_0x6e56('0x28')]+_0x6e56('0x31')]){return rpc[_0x47b596[_0x6e56('0x28')]+_0x6e56('0x31')][_0x6e56('0x38')](_0xde0d07,_0x41683b)[_0x6e56('0x33')](function(_0x9107f2){logger['error'](_0x6e56('0x39'));});}}}function endRouting(_0x2181b0,_0x4d0f94,_0x6b7fc,_0x1432c7){if(_0x2181b0&&_0x4d0f94){_0x4d0f94[_0x6e56('0x22')]-=0x1;var _0x3e24c8={'leaveAt':moment()[_0x6e56('0x14')](_0x6e56('0x24')),'exitAt':moment()[_0x6e56('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x6e56('0x3a')};logger[_0x6e56('0x36')](util[_0x6e56('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x2181b0,_0x4d0f94[_0x6e56('0x30')]));emitChannelQueueInteraction(_0x6b7fc[_0x6e56('0x28')],_0x4d0f94[_0x6e56('0x30')],_0x6b7fc['body'],_0x6b7fc[_0x6e56('0xa')][_0x6e56('0x30')],_0x6b7fc['message']['id'],![],_0x1432c7);if(rpc[_0x6b7fc[_0x6e56('0x28')]+_0x6e56('0x31')]){return rpc[_0x6b7fc['channel']+_0x6e56('0x31')]['update'](_0x2181b0,_0x3e24c8)[_0x6e56('0x33')](function(_0x1ff679){logger[_0x6e56('0x3b')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x58a7d3){return function(_0x327c78){return _0x327c78[_0x6e56('0x30')][_0x6e56('0x3c')]()===_0x58a7d3['toLowerCase']();};}exports[_0x6e56('0x3d')]=function(_0x12962d,_0x17a965,_0x459ae7,_0x26aff0){return function(_0x458e19){try{var _0x349210={'name':_0x17a965[0x0],'timeout':_0x17a965[0x1]};var _0x16ed69=queue[_0x6e56('0x0')](_0x349210,{'typecast':!![]});if(_0x16ed69[_0x6e56('0x3e')]){logger[_0x6e56('0x3b')]('[%s][QUEUE]\x20%s',_0x12962d,_[_0x6e56('0x3f')](_0x16ed69,_0x6e56('0x2c'))['join'](',\x20'));_0x458e19[_0x6e56('0x40')]();}else{var _0x24c368=_[_0x6e56('0x41')](_0x459ae7[_0x26aff0[_0x6e56('0x28')]+_0x6e56('0x42')],handleFindQueue(_0x349210['name']));if(_0x24c368){startRouting(_0x12962d,_0x24c368,_0x26aff0,_0x459ae7);var _0x5790c0=(_0x24c368[_0x6e56('0x3a')]||0xa)*0x3e8;var _0x819ecb=(_0x349210[_0x6e56('0x3a')]||0x14)*0x3e8;var _0x3216a1;if(_0x5790c0>_0x819ecb){_0x819ecb=_0x5790c0;}var _0x1e9f28=seqqueue[_0x6e56('0x43')](_0x5790c0);_0x1e9f28['id']=_0x12962d;_0x1e9f28[_0x6e56('0x44')]=_0x5790c0;_0x1e9f28[_0x6e56('0x45')]=_0x819ecb;_0x1e9f28[_0x6e56('0x28')]=_0x26aff0['channel'];_0x459ae7[_0x6e56('0x46')][_0x12962d]['on'](_0x6e56('0x47'),function(){logger[_0x6e56('0x36')](_0x6e56('0x48'),_0x12962d);stopRouting(_0x12962d,_0x24c368,_0x26aff0,_0x459ae7);clearTimeout(_0x3216a1);_0x3216a1=undefined;_0x1e9f28[_0x6e56('0x49')](!![]);if(_0x459ae7['rules'][_0x12962d]){delete _0x459ae7[_0x6e56('0x46')][_0x12962d];}_0x458e19['stop']();});_0x459ae7[_0x6e56('0x46')][_0x12962d]['on']('complete',function(){if(_0x459ae7[_0x6e56('0x46')][_0x12962d]){delete _0x459ae7[_0x6e56('0x46')][_0x12962d];}});_0x3216a1=setTimeout(function(){logger[_0x6e56('0x36')](_0x6e56('0x4a'),_0x12962d);endRouting(_0x12962d,_0x24c368,_0x26aff0,_0x459ae7);clearTimeout(_0x3216a1);_0x1e9f28[_0x6e56('0x49')](!![]);_0x458e19[_0x6e56('0x4b')]();},_0x819ecb);switch(_0x24c368[_0x6e56('0x4c')]){case'rrmemory':strategy[_0x6e56('0x4d')](_0x1e9f28,_0x24c368,_0x459ae7,_0x26aff0);break;default:strategy[_0x6e56('0x4e')](_0x1e9f28,_0x24c368,_0x459ae7,_0x26aff0);}}else{logger['error'](_0x6e56('0x4f'),_0x12962d,_0x349210['name']);_0x458e19['stop']();}}}catch(_0xcf243b){console[_0x6e56('0x50')](_0xcf243b);logger['error'](_0x6e56('0x51'),_0x12962d,_0xcf243b[_0x6e56('0x52')]);_0x458e19['stop']();}};}; \ 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 f3223d7..8ad23dd 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 _0xedd9=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','bind','handleTimeout','drained','prototype','handleRun','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','busy','busyQueue','saveWaitingNotification','channel','showNotification','notificationId','agents','writeLog','RINGING'];(function(_0x178523,_0x1713aa){var _0x29ca73=function(_0x50697d){while(--_0x50697d){_0x178523['push'](_0x178523['shift']());}};_0x29ca73(++_0x1713aa);}(_0xedd9,0xfc));var _0x9edd=function(_0x2478cd,_0x4f4841){_0x2478cd=_0x2478cd-0x0;var _0x1e10cc=_0xedd9[_0x2478cd];return _0x1e10cc;};'use strict';var _=require('lodash');var uuid=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var logger=require(_0x9edd('0x2'))(_0x9edd('0x3'));var Agent=function(_0x3b51bc,_0x127cbe,_0x3e6d3a,_0x36b53f){this['notificationId']=uuid['v4']();this[_0x9edd('0x4')]=_0x3b51bc;this[_0x9edd('0x5')]=_0x127cbe;this[_0x9edd('0x6')]=_0x3e6d3a;this[_0x9edd('0x3')]=_0x36b53f;this['squeue'][_0x9edd('0x7')](this['handleRun'][_0x9edd('0x8')](this),this[_0x9edd('0x9')][_0x9edd('0x8')](this));this[_0x9edd('0x4')]['on']('timeout',this[_0x9edd('0x9')]['bind'](this));this[_0x9edd('0x4')]['on'](_0x9edd('0xa'),this['handleDrained'][_0x9edd('0x8')](this));};Agent[_0x9edd('0xb')]['push']=function(){this[_0x9edd('0x4')][_0x9edd('0x7')](this[_0x9edd('0xc')][_0x9edd('0x8')](this),this[_0x9edd('0x9')][_0x9edd('0x8')](this));};Agent[_0x9edd('0xb')][_0x9edd('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0x9edd('0xb')][_0x9edd('0xc')]=function(){logger[_0x9edd('0xe')](_0x9edd('0xf'),this[_0x9edd('0x4')]['id'],this[_0x9edd('0x5')]['id']);if(_[_0x9edd('0x10')](this[_0x9edd('0x6')]['agents'][this[_0x9edd('0x5')]['id']])){logger[_0x9edd('0xe')](_0x9edd('0x11'),this['squeue']['id'],this[_0x9edd('0x5')]['id']);setTimeout(this[_0x9edd('0x7')][_0x9edd('0x8')](this),0x3e8);}else{if(this['routing'][_0x9edd('0x12')]||util['isAgentAvailable'](this[_0x9edd('0x4')]['id'],this[_0x9edd('0x6')]['agents'][this['agent']['id']],this[_0x9edd('0x4')]['channel'],![])){this[_0x9edd('0x6')]['agents'][this['agent']['id']][_0x9edd('0x13')]=!![];this[_0x9edd('0x6')]['agents'][this['agent']['id']][_0x9edd('0x14')]=undefined;util[_0x9edd('0x15')](this[_0x9edd('0x6')],this['routing'],this[_0x9edd('0x5')],this[_0x9edd('0x4')][_0x9edd('0x16')]);util[_0x9edd('0x17')](this[_0x9edd('0x18')],this['squeue']['id'],this[_0x9edd('0x6')][_0x9edd('0x19')][this[_0x9edd('0x5')]['id']],null,this[_0x9edd('0x3')]);util[_0x9edd('0x1a')](this['squeue']['id'],this['realtime'][_0x9edd('0x19')][this[_0x9edd('0x5')]['id']],_0x9edd('0x1b')+(this[_0x9edd('0x3')][_0x9edd('0x12')]?':FORCED':''));}else{logger['debug'](_0x9edd('0x1c'),this[_0x9edd('0x4')]['id'],this[_0x9edd('0x5')]['id']);setTimeout(this['push'][_0x9edd('0x8')](this),0x3e8);}}};Agent[_0x9edd('0xb')][_0x9edd('0x9')]=function(_0x41af53){if(_['isNil'](this[_0x9edd('0x6')][_0x9edd('0x19')][this[_0x9edd('0x5')]['id']])){return logger[_0x9edd('0xe')](_0x9edd('0x11'),this[_0x9edd('0x4')]['id'],this[_0x9edd('0x5')]['id']);}else{logger[_0x9edd('0xe')](_0x9edd('0x1d'),this[_0x9edd('0x4')]['id'],this[_0x9edd('0x5')]['id']);util[_0x9edd('0x1e')](this[_0x9edd('0x18')],this[_0x9edd('0x4')]['id'],this[_0x9edd('0x6')]['agents'][this[_0x9edd('0x5')]['id']],null,this[_0x9edd('0x3')]);this[_0x9edd('0x6')]['agents'][this[_0x9edd('0x5')]['id']][_0x9edd('0x13')]=![];this[_0x9edd('0x6')][_0x9edd('0x19')][this[_0x9edd('0x5')]['id']][_0x9edd('0x14')]=undefined;util[_0x9edd('0x1f')](this[_0x9edd('0x6')],this[_0x9edd('0x3')],this[_0x9edd('0x5')],this[_0x9edd('0x4')][_0x9edd('0x16')]);util[_0x9edd('0x1a')](this[_0x9edd('0x4')]['id'],this['realtime'][_0x9edd('0x19')][this['agent']['id']],_0x41af53?_0x9edd('0x20'):_0x9edd('0x21'));}if(!_0x41af53){setTimeout(this[_0x9edd('0x7')][_0x9edd('0x8')](this),0x3e8);}};function agent(_0x16770e,_0x4fa5ab,_0x6de835,_0x44dbfc){return new Agent(_0x16770e,_0x4fa5ab,_0x6de835,_0x44dbfc);}module[_0x9edd('0x22')]=agent; \ No newline at end of file +var _0x9b67=['drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','busy','busyQueue','channel','showNotification',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout'];(function(_0x3b8774,_0x301a46){var _0x5bcfcc=function(_0x5d9d2f){while(--_0x5d9d2f){_0x3b8774['push'](_0x3b8774['shift']());}};_0x5bcfcc(++_0x301a46);}(_0x9b67,0xf6));var _0x79b6=function(_0x400577,_0x2141ed){_0x400577=_0x400577-0x0;var _0x5395bd=_0x9b67[_0x400577];return _0x5395bd;};'use strict';var _=require(_0x79b6('0x0'));var uuid=require(_0x79b6('0x1'));var util=require(_0x79b6('0x2'));var logger=require(_0x79b6('0x3'))(_0x79b6('0x4'));var Agent=function(_0x5523a1,_0x3ba25a,_0x1aeb24,_0x5297d0){this['notificationId']=uuid['v4']();this[_0x79b6('0x5')]=_0x5523a1;this[_0x79b6('0x6')]=_0x3ba25a;this[_0x79b6('0x7')]=_0x1aeb24;this[_0x79b6('0x4')]=_0x5297d0;this[_0x79b6('0x5')][_0x79b6('0x8')](this[_0x79b6('0x9')]['bind'](this),this[_0x79b6('0xa')][_0x79b6('0xb')](this));this[_0x79b6('0x5')]['on'](_0x79b6('0xc'),this[_0x79b6('0xa')]['bind'](this));this[_0x79b6('0x5')]['on'](_0x79b6('0xd'),this[_0x79b6('0xe')][_0x79b6('0xb')](this));};Agent['prototype']['push']=function(){this[_0x79b6('0x5')][_0x79b6('0x8')](this[_0x79b6('0x9')]['bind'](this),this[_0x79b6('0xa')][_0x79b6('0xb')](this));};Agent[_0x79b6('0xf')][_0x79b6('0xe')]=function(){this[_0x79b6('0xa')](!![]);};Agent[_0x79b6('0xf')][_0x79b6('0x9')]=function(){logger[_0x79b6('0x10')](_0x79b6('0x11'),this[_0x79b6('0x5')]['id'],this[_0x79b6('0x6')]['id']);if(_[_0x79b6('0x12')](this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']])){logger[_0x79b6('0x10')](_0x79b6('0x13'),this[_0x79b6('0x5')]['id'],this[_0x79b6('0x6')]['id']);setTimeout(this[_0x79b6('0x8')][_0x79b6('0xb')](this),0x3e8);}else{if(this[_0x79b6('0x4')][_0x79b6('0x14')]||util[_0x79b6('0x15')](this[_0x79b6('0x5')]['id'],this[_0x79b6('0x7')][_0x79b6('0x16')][this['agent']['id']],this[_0x79b6('0x5')]['channel'],![])){this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']][_0x79b6('0x17')]=!![];this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']][_0x79b6('0x18')]=undefined;util['saveWaitingNotification'](this['realtime'],this[_0x79b6('0x4')],this[_0x79b6('0x6')],this[_0x79b6('0x5')][_0x79b6('0x19')]);util[_0x79b6('0x1a')](this['notificationId'],this[_0x79b6('0x5')]['id'],this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']],null,this['routing']);util['writeLog'](this[_0x79b6('0x5')]['id'],this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']],'RINGING'+(this[_0x79b6('0x4')]['forcedOwnership']?_0x79b6('0x1b'):''));}else{logger[_0x79b6('0x10')](_0x79b6('0x1c'),this[_0x79b6('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x79b6('0x8')][_0x79b6('0xb')](this),0x3e8);}}};Agent['prototype'][_0x79b6('0xa')]=function(_0x2d219c){if(_[_0x79b6('0x12')](this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']])){return logger['debug'](_0x79b6('0x13'),this[_0x79b6('0x5')]['id'],this[_0x79b6('0x6')]['id']);}else{logger[_0x79b6('0x10')](_0x79b6('0x1d'),this[_0x79b6('0x5')]['id'],this['agent']['id']);util[_0x79b6('0x1e')](this[_0x79b6('0x1f')],this[_0x79b6('0x5')]['id'],this['realtime']['agents'][this[_0x79b6('0x6')]['id']],null,this[_0x79b6('0x4')]);this[_0x79b6('0x7')][_0x79b6('0x16')][this[_0x79b6('0x6')]['id']][_0x79b6('0x17')]=![];this['realtime']['agents'][this[_0x79b6('0x6')]['id']]['busyQueue']=undefined;util[_0x79b6('0x20')](this['realtime'],this[_0x79b6('0x4')],this[_0x79b6('0x6')],this['squeue'][_0x79b6('0x19')]);util[_0x79b6('0x21')](this['squeue']['id'],this[_0x79b6('0x7')]['agents'][this[_0x79b6('0x6')]['id']],_0x2d219c?_0x79b6('0x22'):_0x79b6('0x23'));}if(!_0x2d219c){setTimeout(this[_0x79b6('0x8')][_0x79b6('0xb')](this),0x3e8);}};function agent(_0x732849,_0x4189f2,_0x276eb5,_0x1ba43c){return new Agent(_0x732849,_0x4189f2,_0x276eb5,_0x1ba43c);}module[_0x79b6('0x24')]=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 a1586f1..1e156ff 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 _0x2546=['bind','timeout','handleTimeout','drained','handleDrained','prototype','handleRun','isNil','Agents','length','agents','debug','channel','RINGING','busy','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','writeLog','STOP','busyQueue','removeWaitingNotification','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push'];(function(_0x506e06,_0x4a40f4){var _0x33664d=function(_0x155e05){while(--_0x155e05){_0x506e06['push'](_0x506e06['shift']());}};_0x33664d(++_0x4a40f4);}(_0x2546,0xc8));var _0x6254=function(_0x3681bb,_0x5cf80b){_0x3681bb=_0x3681bb-0x0;var _0x5b43d3=_0x2546[_0x3681bb];return _0x5b43d3;};'use strict';var _=require(_0x6254('0x0'));var uuid=require(_0x6254('0x1'));var util=require(_0x6254('0x2'));var logger=require(_0x6254('0x3'))(_0x6254('0x4'));var Beepall=function(_0x4b593a,_0x194abe,_0xc11c4d,_0x57bb69){this[_0x6254('0x5')]=uuid['v4']();this[_0x6254('0x6')]=_0x4b593a;this[_0x6254('0x7')]=_0x194abe;this[_0x6254('0x8')]=_0xc11c4d;this[_0x6254('0x4')]=_0x57bb69;this[_0x6254('0x6')][_0x6254('0x9')](this['handleRun']['bind'](this),this['handleTimeout'][_0x6254('0xa')](this));this[_0x6254('0x6')]['on'](_0x6254('0xb'),this[_0x6254('0xc')][_0x6254('0xa')](this));this[_0x6254('0x6')]['on'](_0x6254('0xd'),this[_0x6254('0xe')][_0x6254('0xa')](this));};Beepall[_0x6254('0xf')]['push']=function(){this['squeue'][_0x6254('0x9')](this[_0x6254('0x10')][_0x6254('0xa')](this),this[_0x6254('0xc')][_0x6254('0xa')](this));};Beepall[_0x6254('0xf')][_0x6254('0xe')]=function(){this[_0x6254('0xc')](!![]);};Beepall[_0x6254('0xf')][_0x6254('0x10')]=function(){var _0x2d7690=!![];if(!_[_0x6254('0x11')](this[_0x6254('0x7')])&&!_['isNil'](this['queue'][_0x6254('0x12')])&&this[_0x6254('0x7')][_0x6254('0x12')][_0x6254('0x13')]>0x0){for(var _0x5816a5=0x0,_0x9623a3;_0x5816a50x0){for(var _0x4d53db=0x0,_0x5ca5fd;_0x4d53db0x0&&_0x46a378[_0x4d3a24+'CurrentCapacity']>=_0x46a378[_0x4d3a24+'Capacity']){writeLog(_0x47152b,_0x46a378,_0x4d3a24['toUpperCase']()+_0xfbbf('0x28'));return![];}}return!![];};exports['showNotification']=function(_0x4b8643,_0x55172a,_0x589af5,_0x4cc08e,_0x21cfee){return sendNotification(!![],_0x4b8643,_0x55172a,_0x589af5,_0x4cc08e,_0x21cfee);};exports['hideNotification']=function(_0xaf4c13,_0x2a7770,_0x5aacb7,_0x46dea5,_0xf1eb2c){return sendNotification(![],_0xaf4c13,_0x2a7770,_0x5aacb7,_0x46dea5,_0xf1eb2c);};exports[_0xfbbf('0x29')]=function(_0x157fd8,_0x2f868c,_0x30534f){var _0x1af0f6=_0x2f868c['interaction'][_0xfbbf('0x2a')];if(!_0x1af0f6&&_0x30534f){_0x1af0f6=_0x30534f['id'];}var _0x1d8ab0=_['some'](_0x157fd8[_0x2f868c[_0xfbbf('0x2b')]+_0xfbbf('0x2c')],function(_0xa53486){var _0x5a0cca=_['capitalize'](_0x2f868c[_0xfbbf('0x2b')])+_0xfbbf('0x2d');return _0xa53486[_0x5a0cca]===_0x2f868c[_0xfbbf('0x2e')]['id'];});if(!_0x1d8ab0&&_0x1af0f6){_0x1d8ab0=_[_0xfbbf('0x2f')](_0x157fd8[_0xfbbf('0x30')][_0x1af0f6][_0x2f868c['channel']+'WaitingInteractions'],function(_0x32ae46){return _0x32ae46['id']===_0x2f868c[_0xfbbf('0x2e')]['id'];});}return _0x1d8ab0;};exports['saveWaitingNotification']=function(_0x42d7a9,_0xa7f9fd,_0x566022,_0x5d737e){_0x42d7a9[_0xfbbf('0x30')][_0x566022['id']][_0x5d737e+_0xfbbf('0x31')][_0xa7f9fd['message']['id']]={'id':_0xa7f9fd[_0xfbbf('0x2e')]['id']};};exports[_0xfbbf('0x32')]=function(_0x2b2f2f,_0x2811f1,_0x55a3f0,_0x395349){delete _0x2b2f2f[_0xfbbf('0x30')][_0x55a3f0['id']][_0x395349+'WaitingInteractions'][_0x2811f1[_0xfbbf('0x33')]['id']];};exports['writeLog']=writeLog; \ No newline at end of file +var _0x97d5=['body','queue','getMustacheRender','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','save','debug','isAgentAvailable','busy','PAUSE','hasOwnProperty','Capacity','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','QueuesWaitingInteractions','capitalize','channel','InteractionId','some','saveWaitingNotification','agents','removeWaitingNotification','writeLog','lodash','util','../utils','../../../../../config/environment','routing','redis','defaults','localhost','format','name','emit','user:save','split','\x20interaction','account','notificationSound'];(function(_0x25484e,_0x46f0c9){var _0x46051d=function(_0x92d55){while(--_0x92d55){_0x25484e['push'](_0x25484e['shift']());}};_0x46051d(++_0x46f0c9);}(_0x97d5,0x139));var _0x597d=function(_0x141e3d,_0x50d93b){_0x141e3d=_0x141e3d-0x0;var _0x253d4d=_0x97d5[_0x141e3d];return _0x253d4d;};'use strict';var _=require(_0x597d('0x0'));var util=require(_0x597d('0x1'));var utils=require(_0x597d('0x2'));var Redis=require('ioredis');var config=require(_0x597d('0x3'));var logger=require('../../../../../config/logger')(_0x597d('0x4'));config[_0x597d('0x5')]=_[_0x597d('0x6')](config[_0x597d('0x5')],{'host':_0x597d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x597d('0x5')]));function sendNotification(_0x589764,_0x391554,_0x3835bc,_0x4c2f1b,_0x1f341d,_0xe5b0c8){io['to'](util[_0x597d('0x8')]('user:%s',_0x4c2f1b[_0x597d('0x9')]))[_0x597d('0xa')](_0x597d('0xb'),_0x4c2f1b);var _0x379477=_0xe5b0c8||{};var _0x4124e0=_0x3835bc[_0x597d('0xc')]('.');var _0x97e364={'uniqueid':_0x391554,'channel':_0x4124e0[0x0],'id':_0x4124e0[0x1],'title':_0x4124e0[0x0]+_0x597d('0xd'),'interactionId':_0x4124e0[0x2],'queue':_0x1f341d?_0x1f341d[_0x597d('0x9')]:null,'sound':_0x379477[_0x597d('0xe')][_0x597d('0xf')],'shake':_0x379477[_0x597d('0xe')]['notificationShake']};try{if(!_0x379477['body']){_0x379477[_0x597d('0x10')]={};}if(_0x1f341d){_0x379477['body'][_0x597d('0x11')]=_0x1f341d;}else if(_0x379477[_0x597d('0x10')][_0x597d('0x11')]){delete _0x379477['body'][_0x597d('0x11')];}_0x97e364['msg']=utils[_0x597d('0x12')](_0x379477[_0x597d('0xe')]['notificationTemplate'],_0x379477);}catch(_0xa987c5){_0x97e364[_0x597d('0x13')]=_0x597d('0x14');logger[_0x597d('0x15')](util[_0x597d('0x8')](_0x597d('0x16'),_0x391554,_0xa987c5[_0x597d('0x17')]));}io['to'](util[_0x597d('0x8')](_0x597d('0x18'),_0x4c2f1b['name']))[_0x597d('0xa')](util[_0x597d('0x8')](_0x597d('0x19'),_0x589764?_0x597d('0x1a'):'remove'),_0x97e364);}function writeLog(_0x26958d,_0x5a6bc2,_0x29d4b2){return logger[_0x597d('0x1b')](util[_0x597d('0x8')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x26958d,_0x5a6bc2[_0x597d('0x9')],_0x29d4b2));}exports[_0x597d('0x1c')]=function(_0x15c1e6,_0x6cbb1d,_0x26169f,_0x1ae7ab){if(_0x6cbb1d[_0x597d('0x1d')]){writeLog(_0x15c1e6,_0x6cbb1d,'BUSY');return![];}if(!_0x6cbb1d['online']){writeLog(_0x15c1e6,_0x6cbb1d,'OFFLINE');return![];}if(_0x6cbb1d[_0x26169f+'Pause']){writeLog(_0x15c1e6,_0x6cbb1d,_0x597d('0x1e'));return![];}if(_0x1ae7ab&&_0x6cbb1d[_0x597d('0x1f')](_0x26169f+'Capacity')&&_0x6cbb1d['hasOwnProperty'](_0x26169f+'CurrentCapacity')){if(_0x6cbb1d[_0x26169f+_0x597d('0x20')]>0x0&&_0x6cbb1d[_0x26169f+'CurrentCapacity']>=_0x6cbb1d[_0x26169f+_0x597d('0x20')]){writeLog(_0x15c1e6,_0x6cbb1d,_0x26169f['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x597d('0x21')]=function(_0x5332b6,_0x35877c,_0x2cee5d,_0x54f7a8,_0x6373c){return sendNotification(!![],_0x5332b6,_0x35877c,_0x2cee5d,_0x54f7a8,_0x6373c);};exports[_0x597d('0x22')]=function(_0x3d940e,_0xd527b6,_0x2266c9,_0x1718e8,_0xef023f){return sendNotification(![],_0x3d940e,_0xd527b6,_0x2266c9,_0x1718e8,_0xef023f);};exports[_0x597d('0x23')]=function(_0x5783a3,_0x5c09ed,_0x5eb2fd){var _0xeb9c92=_0x5c09ed[_0x597d('0x24')][_0x597d('0x25')];if(!_0xeb9c92&&_0x5eb2fd){_0xeb9c92=_0x5eb2fd['id'];}var _0x37238d=_['some'](_0x5783a3[_0x5c09ed['channel']+_0x597d('0x26')],function(_0x5468be){var _0x3420d8=_[_0x597d('0x27')](_0x5c09ed[_0x597d('0x28')])+_0x597d('0x29');return _0x5468be[_0x3420d8]===_0x5c09ed['interaction']['id'];});if(!_0x37238d&&_0xeb9c92){_0x37238d=_[_0x597d('0x2a')](_0x5783a3['agents'][_0xeb9c92][_0x5c09ed[_0x597d('0x28')]+'WaitingInteractions'],function(_0x563a82){return _0x563a82['id']===_0x5c09ed['interaction']['id'];});}return _0x37238d;};exports[_0x597d('0x2b')]=function(_0x54dccb,_0x438aec,_0x4779d6,_0x503bd4){_0x54dccb[_0x597d('0x2c')][_0x4779d6['id']][_0x503bd4+'WaitingInteractions'][_0x438aec['message']['id']]={'id':_0x438aec[_0x597d('0x24')]['id']};};exports[_0x597d('0x2d')]=function(_0x523e65,_0x4375a8,_0x7290d6,_0x261e4b){delete _0x523e65[_0x597d('0x2c')][_0x7290d6['id']][_0x261e4b+'WaitingInteractions'][_0x4375a8['message']['id']];};exports[_0x597d('0x2e')]=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 a995890..8f9676a 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 _0xa8ca=['lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20%s','stringify','validate'];(function(_0x1997c7,_0x3234a5){var _0x47f2be=function(_0x51d9fb){while(--_0x51d9fb){_0x1997c7['push'](_0x1997c7['shift']());}};_0x47f2be(++_0x3234a5);}(_0xa8ca,0x12b));var _0xaa8c=function(_0x249890,_0x19f6ce){_0x249890=_0x249890-0x0;var _0x4e9b1d=_0xa8ca[_0x249890];return _0x4e9b1d;};'use strict';var schema=require(_0xaa8c('0x0'));var sh=require('shelljs');var _=require(_0xaa8c('0x1'));var utils=require('./utils');var logger=require(_0xaa8c('0x2'))(_0xaa8c('0x3'));var system=schema({'command':{'type':_0xaa8c('0x4'),'required':!![],'message':_0xaa8c('0x5')}});exports[_0xaa8c('0x6')]=function(_0x3b6002,_0x4a0298){return function(_0x36fdef){try{var _0x25dfbc={'command':_0x4a0298[0x0]};var _0x57a316=system['validate'](_0x25dfbc,{'typecast':!![]});if(_0x57a316[_0xaa8c('0x7')]){logger[_0xaa8c('0x8')]('[%s][SYSTEM]\x20%s',_0x3b6002,_['map'](_0x57a316,'message')[_0xaa8c('0x9')](',\x20'));logger[_0xaa8c('0xa')](_0xaa8c('0xb'),_0x3b6002);_0x36fdef[_0xaa8c('0xc')]();}else{var _0x2de467=this;var _0x12faba=utils[_0xaa8c('0xd')](_0x4a0298[0x0],this);logger[_0xaa8c('0xa')](_0xaa8c('0xe'),_0x3b6002,_0x12faba);sh[_0xaa8c('0xf')](_[_0xaa8c('0x10')](_0x12faba),function(_0x33ce7b,_0x1b1b12){logger['info'](_0xaa8c('0x11'),_0x3b6002,_0x33ce7b);if(_0x33ce7b==0x0){var _0x4c75e7=_0x1b1b12[_0xaa8c('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xaa8c('0x13')](_0x4a0298[0x1])||_[_0xaa8c('0x14')](_0x4a0298[0x1])){logger['info'](_0xaa8c('0x15'),_0x3b6002);_0x2de467[_0xaa8c('0x16')][_0x4a0298[0x1]]=_0x4c75e7;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x3b6002,_0x4a0298[0x1],_0x4c75e7);_0x2de467[_0xaa8c('0x16')][_0x4a0298[0x1]]=_0x4c75e7;}}_0x36fdef[_0xaa8c('0xc')]();});}}catch(_0xf49636){logger[_0xaa8c('0x8')](_0xaa8c('0x17'),_0x3b6002,_['isObject'](_0xf49636)?JSON[_0xaa8c('0x18')](_0xf49636):_0xf49636);logger[_0xaa8c('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3b6002);_0x36fdef['next']();}};}; \ No newline at end of file +var _0xa631=['getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','stringify','shelljs','lodash','./utils','routing','consequence','length','error','[%s][SYSTEM]\x20%s','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next'];(function(_0x4eb5a3,_0x4c8543){var _0x20434c=function(_0x32a57c){while(--_0x32a57c){_0x4eb5a3['push'](_0x4eb5a3['shift']());}};_0x20434c(++_0x4c8543);}(_0xa631,0xe4));var _0x1a63=function(_0x5cd771,_0xeaab3f){_0x5cd771=_0x5cd771-0x0;var _0x5a3463=_0xa631[_0x5cd771];return _0x5a3463;};'use strict';var schema=require('validate');var sh=require(_0x1a63('0x0'));var _=require(_0x1a63('0x1'));var utils=require(_0x1a63('0x2'));var logger=require('../../../../config/logger')(_0x1a63('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x1a63('0x4')]=function(_0x1def2e,_0x24bd2a){return function(_0x4eed61){try{var _0x51ff47={'command':_0x24bd2a[0x0]};var _0x5a2067=system['validate'](_0x51ff47,{'typecast':!![]});if(_0x5a2067[_0x1a63('0x5')]){logger[_0x1a63('0x6')](_0x1a63('0x7'),_0x1def2e,_['map'](_0x5a2067,'message')[_0x1a63('0x8')](',\x20'));logger[_0x1a63('0x9')](_0x1a63('0xa'),_0x1def2e);_0x4eed61[_0x1a63('0xb')]();}else{var _0x38b2be=this;var _0x58dd88=utils[_0x1a63('0xc')](_0x24bd2a[0x0],this);logger[_0x1a63('0x9')](_0x1a63('0xd'),_0x1def2e,_0x58dd88);sh[_0x1a63('0xe')](_['trim'](_0x58dd88),function(_0x1c7e4f,_0x199c92){logger[_0x1a63('0x9')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x1def2e,_0x1c7e4f);if(_0x1c7e4f==0x0){var _0xd7e70c=_0x199c92['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x1a63('0xf')](_0x24bd2a[0x1])||_[_0x1a63('0x10')](_0x24bd2a[0x1])){logger[_0x1a63('0x9')]('[%s][SYSTEM]\x20no\x20variable',_0x1def2e);_0x38b2be['body'][_0x24bd2a[0x1]]=_0xd7e70c;}else{logger[_0x1a63('0x9')](_0x1a63('0x11'),_0x1def2e,_0x24bd2a[0x1],_0xd7e70c);_0x38b2be[_0x1a63('0x12')][_0x24bd2a[0x1]]=_0xd7e70c;}}_0x4eed61[_0x1a63('0xb')]();});}}catch(_0x1c1e8c){logger['error'](_0x1a63('0x7'),_0x1def2e,_['isObject'](_0x1c1e8c)?JSON[_0x1a63('0x13')](_0x1c1e8c):_0x1c1e8c);logger[_0x1a63('0x9')](_0x1a63('0xa'),_0x1def2e);_0x4eed61[_0x1a63('0xb')]();}};}; \ 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 41008dd..319c086 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 _0x68eb=['../../../../config/logger','routing','number','length','error','[%s][TAG]\x20%s','map','message','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','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x6c00b2,_0x2769d4){var _0x255585=function(_0x4e6067){while(--_0x4e6067){_0x6c00b2['push'](_0x6c00b2['shift']());}};_0x255585(++_0x2769d4);}(_0x68eb,0xa5));var _0xb68e=function(_0x453e2b,_0x4f1258){_0x453e2b=_0x453e2b-0x0;var _0x50f306=_0x68eb[_0x453e2b];return _0x50f306;};'use strict';var schema=require(_0xb68e('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xb68e('0x1')),'openchannelInteraction':require(_0xb68e('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xb68e('0x3'))(_0xb68e('0x4'));var tag=schema({'tag':{'type':_0xb68e('0x5'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x56812b,_0x313989,_0x2b614f,_0x525942){return function(_0x5933d0){try{var _0x46f520={'tag':_0x313989[0x0]};var _0x3f2dc5=tag['validate'](_0x46f520,{'typecast':!![]});if(_0x3f2dc5[_0xb68e('0x6')]){logger[_0xb68e('0x7')](_0xb68e('0x8'),_0x56812b,_[_0xb68e('0x9')](_0x3f2dc5,_0xb68e('0xa'))['join'](',\x20'));logger[_0xb68e('0xb')](_0xb68e('0xc'),_0x56812b);_0x5933d0[_0xb68e('0xd')]();}else{var _0x434c33={'ids':[_0x313989[0x0]]};if(rpc[_0x525942[_0xb68e('0xe')]+'Interaction']){rpc[_0x525942[_0xb68e('0xe')]+_0xb68e('0xf')][_0xb68e('0x10')](_0x525942[_0xb68e('0x11')]['id'],_0x434c33)[_0xb68e('0x12')](function(_0x4a4e44){logger['info'](_0xb68e('0x13'),_0x56812b,_0x313989[0x1],_0x525942['channel'],_0x525942['interaction']['id']);})[_0xb68e('0x14')](function(_0xccc3c3){logger[_0xb68e('0x7')](_0xb68e('0x8'),_0x56812b,JSON['stringify'](_0xccc3c3));logger['info'](_0xb68e('0xc'),_0x56812b);})['finally'](function(){_0x5933d0[_0xb68e('0xd')]();});}}}catch(_0x458b4f){logger[_0xb68e('0x7')](_0xb68e('0x8'),_0x56812b,_['isObject'](_0x458b4f)?JSON['stringify'](_0x458b4f):_0x458b4f);logger[_0xb68e('0xb')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x56812b);_0x5933d0['next']();}};}; \ No newline at end of file +var _0x129f=['lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','consequence','validate','length','error','map','join','next','Interaction','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','catch','[%s][TAG]\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally'];(function(_0x91d1e3,_0x299619){var _0x13d9c9=function(_0xac6f58){while(--_0xac6f58){_0x91d1e3['push'](_0x91d1e3['shift']());}};_0x13d9c9(++_0x299619);}(_0x129f,0xe1));var _0xf129=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x129f[_0x5f1391];return _0x50ebe3;};'use strict';var schema=require('validate');var _=require(_0xf129('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xf129('0x1')),'smsInteraction':require(_0xf129('0x2')),'mailInteraction':require(_0xf129('0x3')),'faxInteraction':require(_0xf129('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0xf129('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xf129('0x6')]=function(_0x468c31,_0x143874,_0xa094ea,_0x21edcb){return function(_0x492119){try{var _0x1e023c={'tag':_0x143874[0x0]};var _0x497e03=tag[_0xf129('0x7')](_0x1e023c,{'typecast':!![]});if(_0x497e03[_0xf129('0x8')]){logger[_0xf129('0x9')]('[%s][TAG]\x20%s',_0x468c31,_[_0xf129('0xa')](_0x497e03,'message')[_0xf129('0xb')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x468c31);_0x492119[_0xf129('0xc')]();}else{var _0x21cb67={'ids':[_0x143874[0x0]]};if(rpc[_0x21edcb['channel']+_0xf129('0xd')]){rpc[_0x21edcb['channel']+_0xf129('0xd')][_0xf129('0xe')](_0x21edcb[_0xf129('0xf')]['id'],_0x21cb67)[_0xf129('0x10')](function(_0x271c5a){logger[_0xf129('0x11')](_0xf129('0x12'),_0x468c31,_0x143874[0x1],_0x21edcb[_0xf129('0x13')],_0x21edcb[_0xf129('0xf')]['id']);})[_0xf129('0x14')](function(_0x421511){logger[_0xf129('0x9')](_0xf129('0x15'),_0x468c31,JSON[_0xf129('0x16')](_0x421511));logger['info'](_0xf129('0x17'),_0x468c31);})[_0xf129('0x18')](function(){_0x492119[_0xf129('0xc')]();});}}}catch(_0x4f78a2){logger[_0xf129('0x9')](_0xf129('0x15'),_0x468c31,_['isObject'](_0x4f78a2)?JSON[_0xf129('0x16')](_0x4f78a2):_0x4f78a2);logger[_0xf129('0x11')](_0xf129('0x17'),_0x468c31);_0x492119[_0xf129('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 098ada6..bc92883 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x913c=['next','request-promise','lodash','consequence','\x20-\x20','replace','includes','push','?params=','urlOnRing','title','jsonrpc','2.0','method','login','params','stringify','POST','application/json-rpc','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next'];(function(_0x2925a6,_0x3545dc){var _0x1e2826=function(_0x4e11bf){while(--_0x4e11bf){_0x2925a6['push'](_0x2925a6['shift']());}};_0x1e2826(++_0x3545dc);}(_0x913c,0x133));var _0xc913=function(_0x148d5a,_0x57c605){_0x148d5a=_0x148d5a-0x0;var _0x2f7e1b=_0x913c[_0x148d5a];return _0x2f7e1b;};'use strict';var rp=require(_0xc913('0x0'));var logger=require('../../../../config/logger')('routing');var _=require(_0xc913('0x1'));var arr=[];exports[_0xc913('0x2')]=function(_0x5bc8f0,_0x1a1baf){return function(_0x3e05d9){var _0x402239=_0x1a1baf[0xa];var _0x59b339=_0x1a1baf[0xb];var _0x17afe0=_0x1a1baf[0xc];var _0x112aaf=_0x1a1baf[0xd];var _0x3cabde=_0x1a1baf[0xe];var _0x20a47d=_0x1a1baf[0xf]['replace'](/\n/g,_0xc913('0x3'));var _0x5e84c8=_0x1a1baf[0x10][_0xc913('0x4')](/\n/g,'\x20');if(!arr[_0xc913('0x5')](_0x59b339)){arr[_0xc913('0x6')](_0x59b339);var _0x293a04=_0x1a1baf[0x3];var _0x45493d=_0x1a1baf[0x4];var _0x5e4642=_0x1a1baf[0x1];var _0x29aeba=_0x1a1baf[0x0];var _0x232add={};_0x232add['urlOnAnswer']=_0x1a1baf[0x8]+_0xc913('0x7')+_0x17afe0+'|'+_0x402239+'|'+_0x112aaf+'|'+_0x59b339+'|'+_0x3cabde;_0x232add[_0xc913('0x8')]=_0x1a1baf[0x7]+_0xc913('0x7')+_0x17afe0+'|'+_0x402239+'|'+_0x112aaf+'|'+_0x59b339+'|'+_0x3cabde+'|'+_0x20a47d+'|'+_0x5e84c8;_0x232add[_0xc913('0x9')]=_0x1a1baf[0x9];var _0x3b9ac9={};_0x3b9ac9[_0xc913('0xa')]=_0xc913('0xb');_0x3b9ac9[_0xc913('0xc')]=_0xc913('0xd');var _0x40c628=[];_0x40c628[_0xc913('0x6')](_0x1a1baf[0x2]);_0x40c628[_0xc913('0x6')](_0x1a1baf[0x5]);_0x40c628[_0xc913('0x6')](_0x1a1baf[0x6]);_0x3b9ac9[_0xc913('0xe')]=_0x40c628;_0x3b9ac9['id']=0x1;var _0x21912c=JSON[_0xc913('0xf')](_0x3b9ac9);var _0x56be84={'encoding':'utf8','method':_0xc913('0x10'),'timeout':0x2710,'url':_0x293a04,'headers':{'Content-Type':_0xc913('0x11')},'body':_0x21912c};return rp(_0x56be84)['then'](function(_0x5101ac){const _0x1062c9=JSON[_0xc913('0x12')](_0x5101ac);if(!_0x1062c9[_0xc913('0x13')]['logged']){throw new Error(_0xc913('0x14'));}var _0x2fa92a=_0x59b339;var _0x6f2f12=_0xc913('0x15')+_0x5e4642+_0xc913('0x16')+_0x29aeba+_0xc913('0x17')+_0x2fa92a+'&data='+JSON['stringify'](_0x232add);var _0x397abe=_0x45493d+'?'+_0x6f2f12;return rp(_0x397abe);})[_0xc913('0x18')](function(_0x4165c8){logger[_0xc913('0x19')](_0xc913('0x1a'),_0x5bc8f0,_0x4165c8);_0x3e05d9[_0xc913('0x1b')]();})[_0xc913('0x1c')](function(_0x396f52){logger[_0xc913('0x1d')](_0xc913('0x1e'),_0x5bc8f0,_[_0xc913('0x1f')](_0x396f52)?JSON[_0xc913('0xf')](_0x396f52):_0x396f52);_0x3e05d9['stop']();});}else{logger[_0xc913('0x19')](_0xc913('0x20'),_0x5bc8f0);_0x3e05d9[_0xc913('0x21')]();}};}; \ No newline at end of file +var _0x91e9=['?params=','jsonrpc','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','then','info','stop','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','urlOnRing'];(function(_0x1f6feb,_0x49d07f){var _0x5c2053=function(_0x99e452){while(--_0x99e452){_0x1f6feb['push'](_0x1f6feb['shift']());}};_0x5c2053(++_0x49d07f);}(_0x91e9,0x81));var _0x991e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x91e9[_0x59ee6f];return _0x4c0979;};'use strict';var rp=require(_0x991e('0x0'));var logger=require(_0x991e('0x1'))(_0x991e('0x2'));var _=require(_0x991e('0x3'));var arr=[];exports[_0x991e('0x4')]=function(_0x24bfe8,_0x5ea954){return function(_0x4edfa4){var _0x1a48e2=_0x5ea954[0xa];var _0x28b422=_0x5ea954[0xb];var _0x48980c=_0x5ea954[0xc];var _0x833f66=_0x5ea954[0xd];var _0x5eb2e9=_0x5ea954[0xe];var _0xdf0eb1=_0x5ea954[0xf][_0x991e('0x5')](/\n/g,_0x991e('0x6'));var _0x208aa8=_0x5ea954[0x10][_0x991e('0x5')](/\n/g,'\x20');if(!arr[_0x991e('0x7')](_0x28b422)){arr[_0x991e('0x8')](_0x28b422);var _0x38e829=_0x5ea954[0x3];var _0x806073=_0x5ea954[0x4];var _0x4aa57c=_0x5ea954[0x1];var _0x32658a=_0x5ea954[0x0];var _0xe2679b={};_0xe2679b[_0x991e('0x9')]=_0x5ea954[0x8]+'?params='+_0x48980c+'|'+_0x1a48e2+'|'+_0x833f66+'|'+_0x28b422+'|'+_0x5eb2e9;_0xe2679b[_0x991e('0xa')]=_0x5ea954[0x7]+_0x991e('0xb')+_0x48980c+'|'+_0x1a48e2+'|'+_0x833f66+'|'+_0x28b422+'|'+_0x5eb2e9+'|'+_0xdf0eb1+'|'+_0x208aa8;_0xe2679b['title']=_0x5ea954[0x9];var _0x2d688f={};_0x2d688f[_0x991e('0xc')]=_0x991e('0xd');_0x2d688f[_0x991e('0xe')]=_0x991e('0xf');var _0x54b6f6=[];_0x54b6f6['push'](_0x5ea954[0x2]);_0x54b6f6[_0x991e('0x8')](_0x5ea954[0x5]);_0x54b6f6[_0x991e('0x8')](_0x5ea954[0x6]);_0x2d688f[_0x991e('0x10')]=_0x54b6f6;_0x2d688f['id']=0x1;var _0x452ec8=JSON[_0x991e('0x11')](_0x2d688f);var _0x5c2bb5={'encoding':_0x991e('0x12'),'method':_0x991e('0x13'),'timeout':0x2710,'url':_0x38e829,'headers':{'Content-Type':_0x991e('0x14')},'body':_0x452ec8};return rp(_0x5c2bb5)['then'](function(_0xe78794){const _0x665ba0=JSON[_0x991e('0x15')](_0xe78794);if(!_0x665ba0[_0x991e('0x16')][_0x991e('0x17')]){throw new Error(_0x991e('0x18'));}var _0x343521=_0x28b422;var _0x46e69c=_0x991e('0x19')+_0x4aa57c+'&serviceId='+_0x32658a+_0x991e('0x1a')+_0x343521+_0x991e('0x1b')+JSON[_0x991e('0x11')](_0xe2679b);var _0x3c71f8=_0x806073+'?'+_0x46e69c;return rp(_0x3c71f8);})[_0x991e('0x1c')](function(_0x15b6eb){logger[_0x991e('0x1d')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x24bfe8,_0x15b6eb);_0x4edfa4[_0x991e('0x1e')]();})['catch'](function(_0x46a911){logger[_0x991e('0x1f')]('[%s][TVOX]\x20%s',_0x24bfe8,_[_0x991e('0x20')](_0x46a911)?JSON['stringify'](_0x46a911):_0x46a911);_0x4edfa4[_0x991e('0x1e')]();});}else{logger[_0x991e('0x1d')](_0x991e('0x21'),_0x24bfe8);_0x4edfa4[_0x991e('0x22')]();}};}; \ 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 fd121a7..90353e8 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0xaea39a,_0x2ac0c9){var _0x4322aa=function(_0x5a4ce0){while(--_0x5a4ce0){_0xaea39a['push'](_0xaea39a['shift']());}};_0x4322aa(++_0x2ac0c9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x423ca4,_0x43f09e){var _0x2a5ae1=function(_0x3d83d4){while(--_0x3d83d4){_0x423ca4['push'](_0x423ca4['shift']());}};_0x2a5ae1(++_0x43f09e);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index f2ef136..a8c175b 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 _0x0aad=['checkWaitingNotifications','applications','isArray','length','existsSync','app','.js','autoreply','appdata','split','mail','push','slice','join','dialogflow','dialogflowv2','TagId','tvox','getMustacheRender','account','notificationTemplate','interaction','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','info','Applications\x20executed','stringify','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','emit','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','jayson/promise','bluebird','./applications/utils','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','map','interval','channel','message'];(function(_0x1cf6dd,_0x5bd0c4){var _0x566408=function(_0x4dd0f0){while(--_0x4dd0f0){_0x1cf6dd['push'](_0x1cf6dd['shift']());}};_0x566408(++_0x5bd0c4);}(_0x0aad,0xb6));var _0xd0aa=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0aad[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd0aa('0x0'));var util=require('util');var path=require(_0xd0aa('0x1'));var fs=require('fs');var jayson=require(_0xd0aa('0x2'));var BPromise=require(_0xd0aa('0x3'));var utils=require(_0xd0aa('0x4'));var sUtils=require('./applications/strategy/util');var logger=require('../../../config/logger')(_0xd0aa('0x5'));var rpc={'openchannelQueueReport':require(_0xd0aa('0x6')),'mailQueueReport':require(_0xd0aa('0x7')),'chatQueueReport':require(_0xd0aa('0x8')),'smsQueueReport':require(_0xd0aa('0x9')),'faxQueueReport':require(_0xd0aa('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xd0aa('0xb'));function getId(_0x167306,_0x2fb8c5,_0xaf34a3){return util[_0xd0aa('0xc')](_0xd0aa('0xd'),_0x167306,_0x2fb8c5||0x0,_0xaf34a3||0x0);}function getIntervals(_0xd6fa67,_0x386fb4){var _0x160ccf=[];if(!_['isNil'](_0x386fb4[_0xd0aa('0xe')])&&!_['isNil'](_0xd6fa67[_0x386fb4['IntervalId']])&&!_[_0xd0aa('0xf')](_0xd6fa67[_0x386fb4['IntervalId']]['Intervals'])){_0x160ccf=_[_0xd0aa('0x10')](_0xd6fa67[_0x386fb4[_0xd0aa('0xe')]]['Intervals'],_0xd0aa('0x11'));}else if(!_[_0xd0aa('0xf')](_0x386fb4['interval'])){_0x160ccf=[_0x386fb4[_0xd0aa('0x11')]];}return _0x160ccf;}exports['listen']=function(_0x78538c){_0x78538c['rules']={};return new BPromise(function(_0x266528,_0x56593c){var _0x2f2a6b={'Start':function(_0x52b733){var _0x2deb60=this;return new Promise(function(_0x1a3767,_0x21c7e1){if(_0x52b733){try{var _0x536345=[];var _0x2e72a5=getId(_0x52b733[_0xd0aa('0x12')],_0x52b733[_0xd0aa('0x13')]?_0x52b733[_0xd0aa('0x13')]['id']:0x0,_0x52b733['interaction']?_0x52b733['interaction']['id']:0x0);var _0x1b605e=sUtils[_0xd0aa('0x14')](_0x78538c,_0x52b733);if(!_0x1b605e&&_0x52b733[_0xd0aa('0x15')]&&_[_0xd0aa('0x16')](_0x52b733[_0xd0aa('0x15')])&&_0x52b733['applications'][_0xd0aa('0x17')]){for(var _0x594f7a=0x0;_0x594f7a<_0x52b733[_0xd0aa('0x15')]['length'];_0x594f7a+=0x1){var _0x4ebdf0=_0x52b733[_0xd0aa('0x15')][_0x594f7a];if(fs[_0xd0aa('0x18')](path['join'](__dirname,_0xd0aa('0x15'),_0x4ebdf0[_0xd0aa('0x19')]+_0xd0aa('0x1a')))){var _0x188ee2=[];switch(_0x4ebdf0[_0xd0aa('0x19')]['toLowerCase']()){case _0xd0aa('0x1b'):var _0x8d85f1=_0x4ebdf0[_0xd0aa('0x1c')][_0xd0aa('0x1d')](',');if(_0x52b733[_0xd0aa('0x12')]===_0xd0aa('0x1e')){_0x188ee2[_0xd0aa('0x1f')](_0x8d85f1[0x0]);_0x188ee2[_0xd0aa('0x1f')](_0x8d85f1[0x1]);_0x188ee2[_0xd0aa('0x1f')](_0x8d85f1[_0xd0aa('0x20')](0x2,_0x8d85f1[_0xd0aa('0x17')])[_0xd0aa('0x21')](','));}else{_0x188ee2[_0xd0aa('0x1f')](_0x8d85f1[0x0]);_0x188ee2[_0xd0aa('0x1f')](_0x8d85f1['slice'](0x1,_0x8d85f1[_0xd0aa('0x17')])[_0xd0aa('0x21')](','));}break;case _0xd0aa('0x22'):var _0x5c0f02=_0x4ebdf0[_0xd0aa('0x1c')][_0xd0aa('0x1d')](',');_0x188ee2[_0xd0aa('0x1f')](_0x5c0f02[0x0]);_0x188ee2['push'](_0x5c0f02[0x1]);_0x188ee2[_0xd0aa('0x1f')](_0x5c0f02[_0xd0aa('0x20')](0x2,_0x5c0f02['length'])[_0xd0aa('0x21')](','));break;case _0xd0aa('0x23'):var _0x3c7e5e=_0x4ebdf0[_0xd0aa('0x1c')][_0xd0aa('0x1d')](',');_0x188ee2[_0xd0aa('0x1f')](_0x3c7e5e[0x0]);_0x188ee2[_0xd0aa('0x1f')](_0x3c7e5e[0x1]);_0x188ee2[_0xd0aa('0x1f')](_0x3c7e5e[0x2]);_0x188ee2[_0xd0aa('0x1f')](_0x3c7e5e[0x3]);_0x188ee2[_0xd0aa('0x1f')](_0x3c7e5e[_0xd0aa('0x20')](0x4,_0x3c7e5e['length'])[_0xd0aa('0x21')](','));break;case'amazonlex':var _0x1969da=_0x4ebdf0[_0xd0aa('0x1c')]['split'](',');_0x188ee2[_0xd0aa('0x1f')](_0x1969da[0x0]);_0x188ee2[_0xd0aa('0x1f')](_0x1969da[0x1]);_0x188ee2[_0xd0aa('0x1f')](_0x1969da[0x2]);_0x188ee2[_0xd0aa('0x1f')](_0x1969da[0x3]);_0x188ee2[_0xd0aa('0x1f')](_0x1969da[_0xd0aa('0x20')](0x4,_0x1969da[_0xd0aa('0x17')])[_0xd0aa('0x21')](','));break;case _0xd0aa('0x13'):_0x188ee2[_0xd0aa('0x1f')](_0x4ebdf0[_0xd0aa('0x1c')]);break;case'tag':_0x188ee2[_0xd0aa('0x1f')](_0x4ebdf0[_0xd0aa('0x24')]);_0x188ee2['push'](_0x4ebdf0[_0xd0aa('0x1c')]);break;case _0xd0aa('0x25'):var _0x22236f=utils[_0xd0aa('0x26')](_0x52b733[_0xd0aa('0x27')][_0xd0aa('0x28')],_0x52b733);var _0x4cece4=_0x4ebdf0[_0xd0aa('0x1c')][_0xd0aa('0x1d')](',');_0x188ee2[_0xd0aa('0x1f')](_0x4cece4[0x0]);_0x188ee2[_0xd0aa('0x1f')](_0x4cece4[0x1]);_0x188ee2[_0xd0aa('0x1f')](_0x4cece4[0x2]);_0x188ee2[_0xd0aa('0x1f')](_0x4cece4[0x3]);_0x188ee2['push'](_0x4cece4[0x4]);_0x188ee2[_0xd0aa('0x1f')](_0x4cece4[0x5]);_0x188ee2[_0xd0aa('0x1f')](_0x4cece4[0x6]);_0x188ee2[_0xd0aa('0x1f')](_0x4cece4[0x7]);_0x188ee2['push'](_0x4cece4[0x8]);_0x188ee2[_0xd0aa('0x1f')](_0x4cece4[0x9]);_0x188ee2[_0xd0aa('0x1f')](_0x4cece4[0xa]);_0x188ee2[_0xd0aa('0x1f')](_0x52b733[_0xd0aa('0x29')]['id']);_0x188ee2[_0xd0aa('0x1f')](_0x52b733[_0xd0aa('0x13')]['id']);_0x188ee2[_0xd0aa('0x1f')](_0x4ebdf0[_0xd0aa('0x2a')]);_0x188ee2[_0xd0aa('0x1f')](_0x52b733[_0xd0aa('0x29')][_0xd0aa('0x2b')]);_0x188ee2['push'](_0x52b733['body'][_0xd0aa('0x2c')]);_0x188ee2['push'](_0x22236f);break;default:_0x188ee2=_['isNil'](_0x4ebdf0['appdata'])?[]:_0x4ebdf0[_0xd0aa('0x1c')][_0xd0aa('0x1d')](',');}var _0x4d4b96={'id':util['format'](_0xd0aa('0x2d'),_0x2e72a5,_0x4ebdf0['id'],_0x4ebdf0[_0xd0aa('0x19')]),'condition':require(_0xd0aa('0x2e'))[_0xd0aa('0x2f')](_0x2e72a5,getIntervals(_0x78538c[_0xd0aa('0x30')],_0x4ebdf0),_0x78538c),'consequence':require(_0xd0aa('0x31')+_0x4ebdf0[_0xd0aa('0x19')])[_0xd0aa('0x32')](_0x2e72a5,_0x188ee2,_0x78538c,_0x52b733),'p':_0x4ebdf0[_0xd0aa('0x33')]||0x0};logger['info'](_0xd0aa('0x34'),_0x4d4b96['id'],_0xd0aa('0x35'),getIntervals(_0x78538c[_0xd0aa('0x30')],_0x4ebdf0)[_0xd0aa('0x21')](_0xd0aa('0x36')));_0x536345['push'](_0x4d4b96);}else{logger[_0xd0aa('0x37')](_0xd0aa('0x38'),path[_0xd0aa('0x21')](__dirname,_0xd0aa('0x15'),_0x4ebdf0['app']+'.js'));}}_0x78538c[_0xd0aa('0x39')][_0x2e72a5]=new RuleEngine(_0x536345);_0x78538c[_0xd0aa('0x39')][_0x2e72a5][_0xd0aa('0x3a')](_0x52b733,function(_0x433386){logger[_0xd0aa('0x3b')](_0xd0aa('0x3c'),JSON[_0xd0aa('0x3d')](_0x433386['matchPath']));if(_0x78538c[_0xd0aa('0x39')][_0x2e72a5]){_0x78538c[_0xd0aa('0x39')][_0x2e72a5]['emit']('complete');}});return _0x1a3767({'code':0xc8,'message':_0x52b733});}else{if(_0x1b605e){logger[_0xd0aa('0x3b')](util[_0xd0aa('0xc')](_0xd0aa('0x3e'),_0x2e72a5));}else{logger[_0xd0aa('0x3b')]('No\x20applications\x20to\x20execute');}return _0x1a3767({'code':0xc8,'message':_0x52b733});}}catch(_0x329be8){logger[_0xd0aa('0x37')](_0x329be8[_0xd0aa('0x3f')]);return _0x21c7e1(_0x2deb60[_0xd0aa('0x37')](0x1f4,_0x329be8));}}return _0x21c7e1(_0xd0aa('0x40'));});},'AcceptMessage':function(_0x4832c1){var _0x14222f=this;return new Promise(function(_0x2936d1,_0x2c529b){if(_0x4832c1['agent']&&_0x4832c1[_0xd0aa('0x41')]['id']){if(_0x78538c[_0xd0aa('0x42')][_0x4832c1[_0xd0aa('0x41')]['id']]){_0x78538c['agents'][_0x4832c1['agent']['id']][_0xd0aa('0x43')]=![];_0x78538c[_0xd0aa('0x42')][_0x4832c1['agent']['id']][_0xd0aa('0x44')]=undefined;}}if(_0x4832c1[_0xd0aa('0x13')]&&_0x4832c1['message']['id']){try{var _0x387fa6=getId(_0x4832c1['channel'],_0x4832c1[_0xd0aa('0x13')]?_0x4832c1[_0xd0aa('0x13')]['id']:0x0,_0x4832c1['interaction']?_0x4832c1[_0xd0aa('0x29')]['id']:0x0);if(_0x78538c[_0xd0aa('0x39')][_0x387fa6]){_0x78538c['rules'][_0x387fa6]['emit'](_0xd0aa('0x45'));if(rpc[_0x4832c1[_0xd0aa('0x12')]+_0xd0aa('0x46')]){rpc[_0x4832c1['channel']+'QueueReport'][_0xd0aa('0x47')](_0x387fa6,{'UserId':_0x4832c1[_0xd0aa('0x13')][_0xd0aa('0x48')]})['catch'](function(){logger[_0xd0aa('0x37')](_0xd0aa('0x49'));});}}return _0x2936d1({'code':0xc8,'message':_0x4832c1});}catch(_0x4fadcf){logger[_0xd0aa('0x37')](_0x4fadcf['stack']);return _0x2c529b(_0x14222f[_0xd0aa('0x37')](0x1f4,_0x4fadcf));}}logger[_0xd0aa('0x37')]('message\x20is\x20empty');return _0x2c529b(_0x14222f['error'](0x1f4,_0xd0aa('0x4a')));});},'RejectMessage':function(_0x782ac6){var _0x4ed95e=this;return new Promise(function(_0x5acb24,_0x6be8fb){if(_0x782ac6[_0xd0aa('0x41')]&&_0x782ac6['agent']['id']){try{if(_0x78538c[_0xd0aa('0x42')][_0x782ac6[_0xd0aa('0x41')]['id']]){_0x78538c[_0xd0aa('0x42')][_0x782ac6[_0xd0aa('0x41')]['id']]['busy']=![];_0x78538c[_0xd0aa('0x42')][_0x782ac6[_0xd0aa('0x41')]['id']][_0xd0aa('0x44')]=undefined;}return _0x5acb24({'code':0xc8,'message':_0x782ac6});}catch(_0x12fe04){logger['error'](_0x12fe04[_0xd0aa('0x3f')]);return _0x6be8fb(_0x4ed95e[_0xd0aa('0x37')](0x1f4,_0x12fe04));}}logger[_0xd0aa('0x37')](_0xd0aa('0x4a'));return _0x6be8fb(_0x4ed95e[_0xd0aa('0x37')](0x1f4,_0xd0aa('0x4a')));});},'AbandonInteraction':function(_0x4fada4){var _0x131d21=this;return new Promise(function(_0x187957,_0xfc3024){if(_0x4fada4[_0xd0aa('0x12')]&&_0x4fada4['interaction']&&_0x4fada4[_0xd0aa('0x29')]['id']){try{var _0x500825=getId(_0x4fada4[_0xd0aa('0x12')],_0x4fada4[_0xd0aa('0x13')]?_0x4fada4[_0xd0aa('0x13')]['id']:0x0,_0x4fada4[_0xd0aa('0x29')]?_0x4fada4['interaction']['id']:0x0);if(_0x78538c[_0xd0aa('0x39')][_0x500825]){_0x78538c[_0xd0aa('0x39')][_0x500825][_0xd0aa('0x4b')](_0xd0aa('0x45'));}return _0x187957({'code':0xc8,'message':_0x4fada4});}catch(_0x35bec1){logger[_0xd0aa('0x37')](_0x35bec1[_0xd0aa('0x3f')]);return _0xfc3024(_0x131d21[_0xd0aa('0x37')](0x1f4,_0x35bec1));}}logger[_0xd0aa('0x37')]('message\x20is\x20empty');return _0xfc3024(_0x131d21[_0xd0aa('0x37')](0x1f4,_0xd0aa('0x4a')));});},'AgentCapacity':function(_0x3f632c){var _0xdc27e4=this;return new Promise(function(_0xdb4cc6,_0x165339){if(_0x78538c['agents']['hasOwnProperty'](_0x3f632c['id'])){for(var _0xe1746b in _0x3f632c['capacity']){if(_0x3f632c[_0xd0aa('0x4c')][_0xd0aa('0x4d')](_0xe1746b)){if(_0x78538c[_0xd0aa('0x42')][_0x3f632c['id']]['hasOwnProperty'](_0xe1746b+_0xd0aa('0x4e'))){_0x78538c['agents'][_0x3f632c['id']][_0xe1746b+_0xd0aa('0x4e')]=parseInt(_0x3f632c[_0xd0aa('0x4c')][_0xe1746b],0xa);}}}_0x78538c[_0xd0aa('0x42')][_0x3f632c['id']][_0xd0aa('0x4f')]();return _0xdb4cc6({'code':0xc8,'message':_0x78538c[_0xd0aa('0x42')][_0x3f632c['id']]});}else{return _0x165339(_0xdc27e4[_0xd0aa('0x37')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x42c3de){return new Promise(function(_0x270fc4){var _0x493f51=_['values'](_0x78538c['agents']);if(_0x42c3de&&_0x42c3de['id']){var _0x32bd1f=_[_0xd0aa('0x50')](_0x493f51,function(_0x2f416c){return _0x2f416c['id']===_0x42c3de['id'];});_0x270fc4(_0x32bd1f);}else{_0x270fc4({'count':_0x493f51[_0xd0aa('0x17')],'rows':_0x493f51});}});},'ChatQueues':function(){return new Promise(function(_0x3b27df){var _0x434b5a=[];for(var _0x1502f6 in _0x78538c[_0xd0aa('0x51')]){if(_0x78538c['chatQueues'][_0xd0aa('0x4d')](_0x1502f6)){var _0x31e89f=_0x78538c[_0xd0aa('0x51')][_0x1502f6];var _0x140cfe={'id':_0x31e89f['id'],'available':_0x31e89f[_0xd0aa('0x52')],'loggedIn':_0x31e89f[_0xd0aa('0x53')],'name':_0x31e89f[_0xd0aa('0x54')],'paused':_0x31e89f[_0xd0aa('0x55')],'waiting':_0x31e89f[_0xd0aa('0x56')]};_0x434b5a[_0xd0aa('0x1f')](_0x140cfe);}}_0x3b27df({'count':_0x434b5a[_0xd0aa('0x17')],'rows':_0x434b5a});});},'MailQueues':function(){return new Promise(function(_0x1ac355){var _0x50c7ed=[];for(var _0x2145d0 in _0x78538c[_0xd0aa('0x57')]){if(_0x78538c[_0xd0aa('0x57')][_0xd0aa('0x4d')](_0x2145d0)){var _0x3c3cce=_0x78538c['mailQueues'][_0x2145d0];var _0x5d755b={'id':_0x3c3cce['id'],'available':_0x3c3cce[_0xd0aa('0x52')],'loggedIn':_0x3c3cce['loggedIn'],'name':_0x3c3cce[_0xd0aa('0x54')],'paused':_0x3c3cce['paused'],'waiting':_0x3c3cce['waiting']};_0x50c7ed[_0xd0aa('0x1f')](_0x5d755b);}}_0x1ac355({'count':_0x50c7ed[_0xd0aa('0x17')],'rows':_0x50c7ed});});},'OpenchannelQueues':function(){return new Promise(function(_0x48ac21){var _0x5c1c3a=[];for(var _0xc5bcb0 in _0x78538c[_0xd0aa('0x58')]){if(_0x78538c[_0xd0aa('0x58')]['hasOwnProperty'](_0xc5bcb0)){var _0x17e51a=_0x78538c[_0xd0aa('0x58')][_0xc5bcb0];var _0x2304be={'id':_0x17e51a['id'],'available':_0x17e51a[_0xd0aa('0x52')],'loggedIn':_0x17e51a[_0xd0aa('0x53')],'name':_0x17e51a[_0xd0aa('0x54')],'paused':_0x17e51a[_0xd0aa('0x55')],'waiting':_0x17e51a[_0xd0aa('0x56')]};_0x5c1c3a['push'](_0x2304be);}}_0x48ac21({'count':_0x5c1c3a['length'],'rows':_0x5c1c3a});});},'SmsQueues':function(){return new Promise(function(_0x39fa82){var _0x2eb3dd=[];for(var _0x5e9e8d in _0x78538c[_0xd0aa('0x59')]){if(_0x78538c[_0xd0aa('0x59')][_0xd0aa('0x4d')](_0x5e9e8d)){var _0x5a1bed=_0x78538c[_0xd0aa('0x59')][_0x5e9e8d];var _0x3fcbe3={'id':_0x5a1bed['id'],'available':_0x5a1bed[_0xd0aa('0x52')],'loggedIn':_0x5a1bed[_0xd0aa('0x53')],'name':_0x5a1bed[_0xd0aa('0x54')],'paused':_0x5a1bed[_0xd0aa('0x55')],'waiting':_0x5a1bed[_0xd0aa('0x56')]};_0x2eb3dd[_0xd0aa('0x1f')](_0x3fcbe3);}}_0x39fa82({'count':_0x2eb3dd['length'],'rows':_0x2eb3dd});});},'FaxQueues':function(){return new Promise(function(_0x27706c){var _0x4e812c=[];for(var _0x242c24 in _0x78538c['faxQueues']){if(_0x78538c[_0xd0aa('0x5a')][_0xd0aa('0x4d')](_0x242c24)){var _0x4b9d64=_0x78538c['faxQueues'][_0x242c24];var _0x9a37bd={'id':_0x4b9d64['id'],'available':_0x4b9d64['available'],'loggedIn':_0x4b9d64[_0xd0aa('0x53')],'name':_0x4b9d64['name'],'paused':_0x4b9d64['paused'],'waiting':_0x4b9d64[_0xd0aa('0x56')]};_0x4e812c[_0xd0aa('0x1f')](_0x9a37bd);}}_0x27706c({'count':_0x4e812c[_0xd0aa('0x17')],'rows':_0x4e812c});});},'WhatsappQueues':function(){return new Promise(function(_0x5f29af){var _0x44573b=[];for(var _0x551b9e in _0x78538c['whatsappQueues']){if(_0x78538c[_0xd0aa('0x5b')][_0xd0aa('0x4d')](_0x551b9e)){var _0x3f00f3=_0x78538c[_0xd0aa('0x5b')][_0x551b9e];var _0xa4a1e={'id':_0x3f00f3['id'],'available':_0x3f00f3['available'],'loggedIn':_0x3f00f3[_0xd0aa('0x53')],'name':_0x3f00f3[_0xd0aa('0x54')],'paused':_0x3f00f3[_0xd0aa('0x55')],'waiting':_0x3f00f3[_0xd0aa('0x56')]};_0x44573b[_0xd0aa('0x1f')](_0xa4a1e);}}_0x5f29af({'count':_0x44573b[_0xd0aa('0x17')],'rows':_0x44573b});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x549f7f){var _0xf0165a=_[_0xd0aa('0x5c')](_0x78538c[_0xd0aa('0x5d')]);_0x549f7f({'count':_0xf0165a['length'],'rows':_0xf0165a});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2834f6){var _0x253841=_[_0xd0aa('0x5c')](_0x78538c[_0xd0aa('0x5e')]);_0x2834f6({'count':_0x253841['length'],'rows':_0x253841});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2c26c3){var _0x2c27d9=_[_0xd0aa('0x5c')](_0x78538c['openchannelQueuesWaitingInteractions']);_0x2c26c3({'count':_0x2c27d9[_0xd0aa('0x17')],'rows':_0x2c27d9});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x237b6d){var _0x4b8904=_[_0xd0aa('0x5c')](_0x78538c['smsQueuesWaitingInteractions']);_0x237b6d({'count':_0x4b8904['length'],'rows':_0x4b8904});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x47703e){var _0x4227a8=_[_0xd0aa('0x5c')](_0x78538c[_0xd0aa('0x5f')]);_0x47703e({'count':_0x4227a8[_0xd0aa('0x17')],'rows':_0x4227a8});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xcad3fb){var _0x354e44=_[_0xd0aa('0x5c')](_0x78538c[_0xd0aa('0x60')]);_0xcad3fb({'count':_0x354e44[_0xd0aa('0x17')],'rows':_0x354e44});});}};var _0x19d982=jayson[_0xd0aa('0x61')](_0x2f2a6b)[_0xd0aa('0x62')]();_0x19d982['on'](_0xd0aa('0x37'),function(_0x41e7e4){logger[_0xd0aa('0x37')](JSON['stringify'](_0x41e7e4));return _0x56593c(_0x41e7e4);});_0x19d982['listen'](0x232c,'127.0.0.1',function(){console[_0xd0aa('0x63')](_0xd0aa('0x64'),0x232c);return _0x266528('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x7ba8=['matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','app','.js','autoreply','split','mail','push','slice','join','dialogflow','appdata','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify'];(function(_0x245c4f,_0x34b70f){var _0x3157a1=function(_0x18bfc7){while(--_0x18bfc7){_0x245c4f['push'](_0x245c4f['shift']());}};_0x3157a1(++_0x34b70f);}(_0x7ba8,0x9b));var _0x87ba=function(_0x15daa6,_0x598792){_0x15daa6=_0x15daa6-0x0;var _0x5d86c0=_0x7ba8[_0x15daa6];return _0x5d86c0;};'use strict';var _=require(_0x87ba('0x0'));var util=require(_0x87ba('0x1'));var path=require(_0x87ba('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require(_0x87ba('0x3'));var sUtils=require(_0x87ba('0x4'));var logger=require(_0x87ba('0x5'))(_0x87ba('0x6'));var rpc={'openchannelQueueReport':require(_0x87ba('0x7')),'mailQueueReport':require(_0x87ba('0x8')),'chatQueueReport':require(_0x87ba('0x9')),'smsQueueReport':require(_0x87ba('0xa')),'faxQueueReport':require(_0x87ba('0xb')),'whatsappQueueReport':require(_0x87ba('0xc'))};var RuleEngine=require(_0x87ba('0xd'));function getId(_0x26adbd,_0x3f90e5,_0x1239ab){return util[_0x87ba('0xe')]('%s.%s.%s',_0x26adbd,_0x3f90e5||0x0,_0x1239ab||0x0);}function getIntervals(_0x4a5ab3,_0x9d7d7c){var _0x25bc5b=[];if(!_[_0x87ba('0xf')](_0x9d7d7c[_0x87ba('0x10')])&&!_['isNil'](_0x4a5ab3[_0x9d7d7c['IntervalId']])&&!_[_0x87ba('0xf')](_0x4a5ab3[_0x9d7d7c[_0x87ba('0x10')]][_0x87ba('0x11')])){_0x25bc5b=_[_0x87ba('0x12')](_0x4a5ab3[_0x9d7d7c[_0x87ba('0x10')]]['Intervals'],_0x87ba('0x13'));}else if(!_['isNil'](_0x9d7d7c['interval'])){_0x25bc5b=[_0x9d7d7c['interval']];}return _0x25bc5b;}exports[_0x87ba('0x14')]=function(_0x570501){_0x570501[_0x87ba('0x15')]={};return new BPromise(function(_0x1d93cf,_0x44f3a1){var _0x4c9e79={'Start':function(_0xf23a2e){var _0x3f5352=this;return new Promise(function(_0xec3a15,_0x308ce2){if(_0xf23a2e){try{var _0x55eba3=[];var _0x34defb=getId(_0xf23a2e[_0x87ba('0x16')],_0xf23a2e['message']?_0xf23a2e[_0x87ba('0x17')]['id']:0x0,_0xf23a2e[_0x87ba('0x18')]?_0xf23a2e[_0x87ba('0x18')]['id']:0x0);var _0x47b8ad=sUtils[_0x87ba('0x19')](_0x570501,_0xf23a2e);if(!_0x47b8ad&&_0xf23a2e[_0x87ba('0x1a')]&&_[_0x87ba('0x1b')](_0xf23a2e[_0x87ba('0x1a')])&&_0xf23a2e[_0x87ba('0x1a')][_0x87ba('0x1c')]){for(var _0x38c74d=0x0;_0x38c74d<_0xf23a2e[_0x87ba('0x1a')][_0x87ba('0x1c')];_0x38c74d+=0x1){var _0x59eea3=_0xf23a2e[_0x87ba('0x1a')][_0x38c74d];if(fs[_0x87ba('0x1d')](path['join'](__dirname,'applications',_0x59eea3[_0x87ba('0x1e')]+_0x87ba('0x1f')))){var _0x1f2175=[];switch(_0x59eea3[_0x87ba('0x1e')]['toLowerCase']()){case _0x87ba('0x20'):var _0x32b6c6=_0x59eea3['appdata'][_0x87ba('0x21')](',');if(_0xf23a2e[_0x87ba('0x16')]===_0x87ba('0x22')){_0x1f2175[_0x87ba('0x23')](_0x32b6c6[0x0]);_0x1f2175[_0x87ba('0x23')](_0x32b6c6[0x1]);_0x1f2175['push'](_0x32b6c6[_0x87ba('0x24')](0x2,_0x32b6c6[_0x87ba('0x1c')])[_0x87ba('0x25')](','));}else{_0x1f2175['push'](_0x32b6c6[0x0]);_0x1f2175[_0x87ba('0x23')](_0x32b6c6['slice'](0x1,_0x32b6c6[_0x87ba('0x1c')])[_0x87ba('0x25')](','));}break;case _0x87ba('0x26'):var _0x7ac5c6=_0x59eea3[_0x87ba('0x27')][_0x87ba('0x21')](',');_0x1f2175[_0x87ba('0x23')](_0x7ac5c6[0x0]);_0x1f2175['push'](_0x7ac5c6[0x1]);_0x1f2175[_0x87ba('0x23')](_0x7ac5c6[_0x87ba('0x24')](0x2,_0x7ac5c6[_0x87ba('0x1c')])[_0x87ba('0x25')](','));break;case'dialogflowv2':var _0x2a01b1=_0x59eea3[_0x87ba('0x27')]['split'](',');_0x1f2175[_0x87ba('0x23')](_0x2a01b1[0x0]);_0x1f2175[_0x87ba('0x23')](_0x2a01b1[0x1]);_0x1f2175[_0x87ba('0x23')](_0x2a01b1[0x2]);_0x1f2175[_0x87ba('0x23')](_0x2a01b1[0x3]);_0x1f2175[_0x87ba('0x23')](_0x2a01b1[_0x87ba('0x24')](0x4,_0x2a01b1['length'])[_0x87ba('0x25')](','));break;case _0x87ba('0x28'):var _0x527442=_0x59eea3[_0x87ba('0x27')][_0x87ba('0x21')](',');_0x1f2175['push'](_0x527442[0x0]);_0x1f2175[_0x87ba('0x23')](_0x527442[0x1]);_0x1f2175[_0x87ba('0x23')](_0x527442[0x2]);_0x1f2175['push'](_0x527442[0x3]);_0x1f2175[_0x87ba('0x23')](_0x527442[_0x87ba('0x24')](0x4,_0x527442[_0x87ba('0x1c')])[_0x87ba('0x25')](','));break;case _0x87ba('0x17'):_0x1f2175[_0x87ba('0x23')](_0x59eea3[_0x87ba('0x27')]);break;case'tag':_0x1f2175[_0x87ba('0x23')](_0x59eea3[_0x87ba('0x29')]);_0x1f2175[_0x87ba('0x23')](_0x59eea3[_0x87ba('0x27')]);break;case _0x87ba('0x2a'):var _0x43abcd=utils[_0x87ba('0x2b')](_0xf23a2e[_0x87ba('0x2c')][_0x87ba('0x2d')],_0xf23a2e);var _0x2138b2=_0x59eea3[_0x87ba('0x27')][_0x87ba('0x21')](',');_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x0]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x1]);_0x1f2175['push'](_0x2138b2[0x2]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x3]);_0x1f2175['push'](_0x2138b2[0x4]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x5]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x6]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x7]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x8]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0x9]);_0x1f2175[_0x87ba('0x23')](_0x2138b2[0xa]);_0x1f2175[_0x87ba('0x23')](_0xf23a2e[_0x87ba('0x18')]['id']);_0x1f2175[_0x87ba('0x23')](_0xf23a2e[_0x87ba('0x17')]['id']);_0x1f2175[_0x87ba('0x23')](_0x59eea3[_0x87ba('0x2e')]);_0x1f2175[_0x87ba('0x23')](_0xf23a2e['interaction'][_0x87ba('0x2f')]);_0x1f2175[_0x87ba('0x23')](_0xf23a2e[_0x87ba('0x30')][_0x87ba('0x30')]);_0x1f2175[_0x87ba('0x23')](_0x43abcd);break;default:_0x1f2175=_[_0x87ba('0xf')](_0x59eea3['appdata'])?[]:_0x59eea3[_0x87ba('0x27')][_0x87ba('0x21')](',');}var _0x5c6c5b={'id':util[_0x87ba('0xe')](_0x87ba('0x31'),_0x34defb,_0x59eea3['id'],_0x59eea3[_0x87ba('0x1e')]),'condition':require(_0x87ba('0x32'))[_0x87ba('0x33')](_0x34defb,getIntervals(_0x570501[_0x87ba('0x34')],_0x59eea3),_0x570501),'consequence':require(_0x87ba('0x35')+_0x59eea3['app'])[_0x87ba('0x36')](_0x34defb,_0x1f2175,_0x570501,_0xf23a2e),'p':_0x59eea3[_0x87ba('0x37')]||0x0};logger[_0x87ba('0x38')](_0x87ba('0x39'),_0x5c6c5b['id'],_0x87ba('0x3a'),getIntervals(_0x570501[_0x87ba('0x34')],_0x59eea3)['join'](_0x87ba('0x3b')));_0x55eba3[_0x87ba('0x23')](_0x5c6c5b);}else{logger[_0x87ba('0x3c')](_0x87ba('0x3d'),path[_0x87ba('0x25')](__dirname,_0x87ba('0x1a'),_0x59eea3['app']+_0x87ba('0x1f')));}}_0x570501[_0x87ba('0x15')][_0x34defb]=new RuleEngine(_0x55eba3);_0x570501[_0x87ba('0x15')][_0x34defb][_0x87ba('0x3e')](_0xf23a2e,function(_0xf03810){logger[_0x87ba('0x38')](_0x87ba('0x3f'),JSON[_0x87ba('0x40')](_0xf03810[_0x87ba('0x41')]));if(_0x570501[_0x87ba('0x15')][_0x34defb]){_0x570501[_0x87ba('0x15')][_0x34defb][_0x87ba('0x42')](_0x87ba('0x43'));}});return _0xec3a15({'code':0xc8,'message':_0xf23a2e});}else{if(_0x47b8ad){logger[_0x87ba('0x38')](util['format'](_0x87ba('0x44'),_0x34defb));}else{logger[_0x87ba('0x38')](_0x87ba('0x45'));}return _0xec3a15({'code':0xc8,'message':_0xf23a2e});}}catch(_0x4bc252){logger['error'](_0x4bc252[_0x87ba('0x46')]);return _0x308ce2(_0x3f5352[_0x87ba('0x3c')](0x1f4,_0x4bc252));}}return _0x308ce2(_0x87ba('0x47'));});},'AcceptMessage':function(_0x1fce05){var _0x4a13aa=this;return new Promise(function(_0x21cf54,_0x465895){if(_0x1fce05[_0x87ba('0x48')]&&_0x1fce05['agent']['id']){if(_0x570501[_0x87ba('0x49')][_0x1fce05['agent']['id']]){_0x570501[_0x87ba('0x49')][_0x1fce05[_0x87ba('0x48')]['id']][_0x87ba('0x4a')]=![];_0x570501[_0x87ba('0x49')][_0x1fce05[_0x87ba('0x48')]['id']][_0x87ba('0x4b')]=undefined;}}if(_0x1fce05[_0x87ba('0x17')]&&_0x1fce05[_0x87ba('0x17')]['id']){try{var _0xa8ed6e=getId(_0x1fce05[_0x87ba('0x16')],_0x1fce05[_0x87ba('0x17')]?_0x1fce05[_0x87ba('0x17')]['id']:0x0,_0x1fce05['interaction']?_0x1fce05[_0x87ba('0x18')]['id']:0x0);if(_0x570501[_0x87ba('0x15')][_0xa8ed6e]){_0x570501[_0x87ba('0x15')][_0xa8ed6e][_0x87ba('0x42')]('end');if(rpc[_0x1fce05[_0x87ba('0x16')]+_0x87ba('0x4c')]){rpc[_0x1fce05[_0x87ba('0x16')]+_0x87ba('0x4c')][_0x87ba('0x4d')](_0xa8ed6e,{'UserId':_0x1fce05[_0x87ba('0x17')][_0x87ba('0x4e')]})[_0x87ba('0x4f')](function(){logger[_0x87ba('0x3c')](_0x87ba('0x50'));});}}return _0x21cf54({'code':0xc8,'message':_0x1fce05});}catch(_0x554b2e){logger['error'](_0x554b2e['stack']);return _0x465895(_0x4a13aa['error'](0x1f4,_0x554b2e));}}logger[_0x87ba('0x3c')](_0x87ba('0x51'));return _0x465895(_0x4a13aa[_0x87ba('0x3c')](0x1f4,_0x87ba('0x51')));});},'RejectMessage':function(_0x41c934){var _0x1666d4=this;return new Promise(function(_0x2ff719,_0x315bc0){if(_0x41c934[_0x87ba('0x48')]&&_0x41c934['agent']['id']){try{if(_0x570501[_0x87ba('0x49')][_0x41c934[_0x87ba('0x48')]['id']]){_0x570501[_0x87ba('0x49')][_0x41c934[_0x87ba('0x48')]['id']][_0x87ba('0x4a')]=![];_0x570501[_0x87ba('0x49')][_0x41c934[_0x87ba('0x48')]['id']][_0x87ba('0x4b')]=undefined;}return _0x2ff719({'code':0xc8,'message':_0x41c934});}catch(_0x206a66){logger[_0x87ba('0x3c')](_0x206a66[_0x87ba('0x46')]);return _0x315bc0(_0x1666d4[_0x87ba('0x3c')](0x1f4,_0x206a66));}}logger[_0x87ba('0x3c')](_0x87ba('0x51'));return _0x315bc0(_0x1666d4[_0x87ba('0x3c')](0x1f4,_0x87ba('0x51')));});},'AbandonInteraction':function(_0x24bc6f){var _0x7c516e=this;return new Promise(function(_0x273bcd,_0x3f638f){if(_0x24bc6f[_0x87ba('0x16')]&&_0x24bc6f[_0x87ba('0x18')]&&_0x24bc6f[_0x87ba('0x18')]['id']){try{var _0x14205b=getId(_0x24bc6f[_0x87ba('0x16')],_0x24bc6f[_0x87ba('0x17')]?_0x24bc6f[_0x87ba('0x17')]['id']:0x0,_0x24bc6f['interaction']?_0x24bc6f[_0x87ba('0x18')]['id']:0x0);if(_0x570501[_0x87ba('0x15')][_0x14205b]){_0x570501[_0x87ba('0x15')][_0x14205b][_0x87ba('0x42')](_0x87ba('0x52'));}return _0x273bcd({'code':0xc8,'message':_0x24bc6f});}catch(_0x3c90db){logger['error'](_0x3c90db['stack']);return _0x3f638f(_0x7c516e[_0x87ba('0x3c')](0x1f4,_0x3c90db));}}logger['error'](_0x87ba('0x51'));return _0x3f638f(_0x7c516e[_0x87ba('0x3c')](0x1f4,_0x87ba('0x51')));});},'AgentCapacity':function(_0x3fe2d7){var _0x1f64b5=this;return new Promise(function(_0x4dbf55,_0x4689f0){if(_0x570501['agents'][_0x87ba('0x53')](_0x3fe2d7['id'])){for(var _0x2ffb94 in _0x3fe2d7[_0x87ba('0x54')]){if(_0x3fe2d7[_0x87ba('0x54')][_0x87ba('0x53')](_0x2ffb94)){if(_0x570501['agents'][_0x3fe2d7['id']][_0x87ba('0x53')](_0x2ffb94+_0x87ba('0x55'))){_0x570501[_0x87ba('0x49')][_0x3fe2d7['id']][_0x2ffb94+_0x87ba('0x55')]=parseInt(_0x3fe2d7[_0x87ba('0x54')][_0x2ffb94],0xa);}}}_0x570501['agents'][_0x3fe2d7['id']][_0x87ba('0x56')]();return _0x4dbf55({'code':0xc8,'message':_0x570501['agents'][_0x3fe2d7['id']]});}else{return _0x4689f0(_0x1f64b5['error'](0x1f4,_0x87ba('0x57')));}});},'Agents':function(_0x255fd7){return new Promise(function(_0xc8035e){var _0x12f847=_[_0x87ba('0x58')](_0x570501['agents']);if(_0x255fd7&&_0x255fd7['id']){var _0x39e040=_[_0x87ba('0x59')](_0x12f847,function(_0x4a4d6f){return _0x4a4d6f['id']===_0x255fd7['id'];});_0xc8035e(_0x39e040);}else{_0xc8035e({'count':_0x12f847[_0x87ba('0x1c')],'rows':_0x12f847});}});},'ChatQueues':function(){return new Promise(function(_0x5badc1){var _0x2f8310=[];for(var _0x34d78c in _0x570501[_0x87ba('0x5a')]){if(_0x570501[_0x87ba('0x5a')][_0x87ba('0x53')](_0x34d78c)){var _0x3cb048=_0x570501[_0x87ba('0x5a')][_0x34d78c];var _0x184aee={'id':_0x3cb048['id'],'available':_0x3cb048['available'],'loggedIn':_0x3cb048[_0x87ba('0x5b')],'name':_0x3cb048[_0x87ba('0x5c')],'paused':_0x3cb048[_0x87ba('0x5d')],'waiting':_0x3cb048[_0x87ba('0x5e')]};_0x2f8310['push'](_0x184aee);}}_0x5badc1({'count':_0x2f8310[_0x87ba('0x1c')],'rows':_0x2f8310});});},'MailQueues':function(){return new Promise(function(_0x184b16){var _0x5262cf=[];for(var _0x4fe45a in _0x570501[_0x87ba('0x5f')]){if(_0x570501['mailQueues'][_0x87ba('0x53')](_0x4fe45a)){var _0x354ad3=_0x570501[_0x87ba('0x5f')][_0x4fe45a];var _0x155aa6={'id':_0x354ad3['id'],'available':_0x354ad3[_0x87ba('0x60')],'loggedIn':_0x354ad3[_0x87ba('0x5b')],'name':_0x354ad3['name'],'paused':_0x354ad3[_0x87ba('0x5d')],'waiting':_0x354ad3[_0x87ba('0x5e')]};_0x5262cf[_0x87ba('0x23')](_0x155aa6);}}_0x184b16({'count':_0x5262cf[_0x87ba('0x1c')],'rows':_0x5262cf});});},'OpenchannelQueues':function(){return new Promise(function(_0x555b44){var _0x2a3f43=[];for(var _0x28f325 in _0x570501[_0x87ba('0x61')]){if(_0x570501[_0x87ba('0x61')][_0x87ba('0x53')](_0x28f325)){var _0x9837ca=_0x570501[_0x87ba('0x61')][_0x28f325];var _0x432f69={'id':_0x9837ca['id'],'available':_0x9837ca[_0x87ba('0x60')],'loggedIn':_0x9837ca['loggedIn'],'name':_0x9837ca[_0x87ba('0x5c')],'paused':_0x9837ca['paused'],'waiting':_0x9837ca[_0x87ba('0x5e')]};_0x2a3f43[_0x87ba('0x23')](_0x432f69);}}_0x555b44({'count':_0x2a3f43['length'],'rows':_0x2a3f43});});},'SmsQueues':function(){return new Promise(function(_0x417dd6){var _0x2eee9d=[];for(var _0x591490 in _0x570501[_0x87ba('0x62')]){if(_0x570501[_0x87ba('0x62')][_0x87ba('0x53')](_0x591490)){var _0x2e36bb=_0x570501['smsQueues'][_0x591490];var _0x6b967d={'id':_0x2e36bb['id'],'available':_0x2e36bb[_0x87ba('0x60')],'loggedIn':_0x2e36bb[_0x87ba('0x5b')],'name':_0x2e36bb[_0x87ba('0x5c')],'paused':_0x2e36bb[_0x87ba('0x5d')],'waiting':_0x2e36bb[_0x87ba('0x5e')]};_0x2eee9d['push'](_0x6b967d);}}_0x417dd6({'count':_0x2eee9d[_0x87ba('0x1c')],'rows':_0x2eee9d});});},'FaxQueues':function(){return new Promise(function(_0x3c4165){var _0x442372=[];for(var _0x4ff2ed in _0x570501['faxQueues']){if(_0x570501['faxQueues']['hasOwnProperty'](_0x4ff2ed)){var _0x5c3ac8=_0x570501[_0x87ba('0x63')][_0x4ff2ed];var _0x566d0a={'id':_0x5c3ac8['id'],'available':_0x5c3ac8['available'],'loggedIn':_0x5c3ac8[_0x87ba('0x5b')],'name':_0x5c3ac8[_0x87ba('0x5c')],'paused':_0x5c3ac8[_0x87ba('0x5d')],'waiting':_0x5c3ac8['waiting']};_0x442372[_0x87ba('0x23')](_0x566d0a);}}_0x3c4165({'count':_0x442372['length'],'rows':_0x442372});});},'WhatsappQueues':function(){return new Promise(function(_0x4ab200){var _0x542309=[];for(var _0x430537 in _0x570501[_0x87ba('0x64')]){if(_0x570501[_0x87ba('0x64')][_0x87ba('0x53')](_0x430537)){var _0x275cb2=_0x570501[_0x87ba('0x64')][_0x430537];var _0x4e450d={'id':_0x275cb2['id'],'available':_0x275cb2['available'],'loggedIn':_0x275cb2['loggedIn'],'name':_0x275cb2[_0x87ba('0x5c')],'paused':_0x275cb2[_0x87ba('0x5d')],'waiting':_0x275cb2[_0x87ba('0x5e')]};_0x542309[_0x87ba('0x23')](_0x4e450d);}}_0x4ab200({'count':_0x542309['length'],'rows':_0x542309});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1fcf68){var _0x14c822=_[_0x87ba('0x58')](_0x570501['chatQueuesWaitingInteractions']);_0x1fcf68({'count':_0x14c822[_0x87ba('0x1c')],'rows':_0x14c822});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3d0a3d){var _0x1c961e=_[_0x87ba('0x58')](_0x570501['mailQueuesWaitingInteractions']);_0x3d0a3d({'count':_0x1c961e['length'],'rows':_0x1c961e});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1f2702){var _0x321c64=_[_0x87ba('0x58')](_0x570501['openchannelQueuesWaitingInteractions']);_0x1f2702({'count':_0x321c64[_0x87ba('0x1c')],'rows':_0x321c64});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2e64a5){var _0x29185e=_[_0x87ba('0x58')](_0x570501[_0x87ba('0x65')]);_0x2e64a5({'count':_0x29185e[_0x87ba('0x1c')],'rows':_0x29185e});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4c4c8c){var _0xe2dfc5=_['values'](_0x570501[_0x87ba('0x66')]);_0x4c4c8c({'count':_0xe2dfc5['length'],'rows':_0xe2dfc5});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4f754b){var _0x1fc4e0=_[_0x87ba('0x58')](_0x570501[_0x87ba('0x67')]);_0x4f754b({'count':_0x1fc4e0['length'],'rows':_0x1fc4e0});});}};var _0x2909e5=jayson[_0x87ba('0x68')](_0x4c9e79)[_0x87ba('0x69')]();_0x2909e5['on'](_0x87ba('0x3c'),function(_0x3d0a24){logger[_0x87ba('0x3c')](JSON['stringify'](_0x3d0a24));return _0x44f3a1(_0x3d0a24);});_0x2909e5[_0x87ba('0x14')](0x232c,_0x87ba('0x6a'),function(){console[_0x87ba('0x6b')](_0x87ba('0x6c'),0x232c);return _0x1d93cf(_0x87ba('0x6d')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index d7e6add..adac215 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 _0x04df=['[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','log','join','stack','stop','util','bluebird','lodash','../../../config/logger','client','request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','message','true','all','some'];(function(_0x1ae395,_0x24e929){var _0x16c2ed=function(_0x3cacf0){while(--_0x3cacf0){_0x1ae395['push'](_0x1ae395['shift']());}};_0x16c2ed(++_0x24e929);}(_0x04df,0xe6));var _0xf04d=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x04df[_0x2555d0];return _0x3bb486;};'use strict';var util=require(_0xf04d('0x0'));var BPromise=require(_0xf04d('0x1'));var jayson=require('jayson/promise');var _=require(_0xf04d('0x2'));var logger=require(_0xf04d('0x3'))('routing');var client=jayson[_0xf04d('0x4')]['http']({'port':0x232a});function request(_0x101c44,_0x2d5eef){return new BPromise(function(_0x2e0d39,_0x9eed0a){return client[_0xf04d('0x5')](_0x101c44,_0x2d5eef)[_0xf04d('0x6')](function(_0x41b641){if(_0x41b641[_0xf04d('0x7')]){return _0x9eed0a(_0x41b641[_0xf04d('0x7')]['message']);}else{return _0x2e0d39(_0x41b641[_0xf04d('0x8')]);}})[_0xf04d('0x9')](function(_0x4a0340){return _0x9eed0a(_0x4a0340);});});}exports[_0xf04d('0xa')]=function(_0x150c92,_0x3d6947,_0x5a9cba){return function(_0x1b850a){if(_0x5a9cba[_0xf04d('0xb')]&&!_0x5a9cba[_0xf04d('0xb')][_0x150c92]){logger[_0xf04d('0xc')](_0xf04d('0xd'),_0x150c92);return _0x1b850a['stop']();}var _0x30fb9d=[];for(var _0x49e6fe=0x0;_0x49e6fe<_0x3d6947[_0xf04d('0xe')];_0x49e6fe+=0x1){_0x30fb9d[_0xf04d('0xf')](request(_0xf04d('0x10'),{'command':util[_0xf04d('0x11')]('iftime\x20%s',_0x3d6947[_0x49e6fe])})[_0xf04d('0x6')](function(_0x1c5bf8){return _0x1c5bf8&&_0x1c5bf8[_0xf04d('0x12')]&&_0x1c5bf8['message']['indexOf'](_0xf04d('0x13'))>=0x0?!![]:![];})['catch'](function(_0x545f5b){logger['error']('[%s][INTERVAL]\x20%s',_0x150c92,_0x3d6947[_0x49e6fe]);}));}BPromise[_0xf04d('0x14')](_0x30fb9d)['then'](function(_0x28fb2a){var _0x1b99a0=_[_0xf04d('0x15')](_0x28fb2a);logger[_0xf04d('0xc')](_0xf04d('0x16'),_0x150c92,_0x3d6947['join'](_0xf04d('0x17')),_0x1b99a0);_0x1b850a['when'](_0x1b99a0);})['catch'](function(_0x157a67){console[_0xf04d('0x18')](_0x157a67);logger[_0xf04d('0x7')](_0xf04d('0x16'),_0x150c92,_0x3d6947[_0xf04d('0x19')](_0xf04d('0x17')),_0x157a67[_0xf04d('0x1a')]);_0x1b850a[_0xf04d('0x1b')]();});};}; \ No newline at end of file +var _0x451b=['result','catch','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','util','bluebird','jayson/promise','lodash','routing','client','http','then','error','message'];(function(_0x59dd21,_0x3a9799){var _0xa03031=function(_0xdb9a34){while(--_0xdb9a34){_0x59dd21['push'](_0x59dd21['shift']());}};_0xa03031(++_0x3a9799);}(_0x451b,0x17c));var _0xb451=function(_0x32735f,_0x1d7924){_0x32735f=_0x32735f-0x0;var _0x23b083=_0x451b[_0x32735f];return _0x23b083;};'use strict';var util=require(_0xb451('0x0'));var BPromise=require(_0xb451('0x1'));var jayson=require(_0xb451('0x2'));var _=require(_0xb451('0x3'));var logger=require('../../../config/logger')(_0xb451('0x4'));var client=jayson[_0xb451('0x5')][_0xb451('0x6')]({'port':0x232a});function request(_0x7cfbd7,_0x3d4b19){return new BPromise(function(_0x6d67c2,_0x1ff7ac){return client['request'](_0x7cfbd7,_0x3d4b19)[_0xb451('0x7')](function(_0xc7cae5){if(_0xc7cae5[_0xb451('0x8')]){return _0x1ff7ac(_0xc7cae5[_0xb451('0x8')][_0xb451('0x9')]);}else{return _0x6d67c2(_0xc7cae5[_0xb451('0xa')]);}})[_0xb451('0xb')](function(_0x9d053a){return _0x1ff7ac(_0x9d053a);});});}exports['condition']=function(_0x105d95,_0x22162e,_0x2a21ef){return function(_0x18b41f){if(_0x2a21ef['rules']&&!_0x2a21ef[_0xb451('0xc')][_0x105d95]){logger['info'](_0xb451('0xd'),_0x105d95);return _0x18b41f[_0xb451('0xe')]();}var _0x2235af=[];for(var _0x17d923=0x0;_0x17d923<_0x22162e['length'];_0x17d923+=0x1){_0x2235af[_0xb451('0xf')](request(_0xb451('0x10'),{'command':util[_0xb451('0x11')](_0xb451('0x12'),_0x22162e[_0x17d923])})[_0xb451('0x7')](function(_0x473ca8){return _0x473ca8&&_0x473ca8[_0xb451('0x9')]&&_0x473ca8[_0xb451('0x9')][_0xb451('0x13')](_0xb451('0x14'))>=0x0?!![]:![];})[_0xb451('0xb')](function(_0x210617){logger[_0xb451('0x8')](_0xb451('0x15'),_0x105d95,_0x22162e[_0x17d923]);}));}BPromise[_0xb451('0x16')](_0x2235af)[_0xb451('0x7')](function(_0x5d0d1f){var _0x31c2b5=_[_0xb451('0x17')](_0x5d0d1f);logger[_0xb451('0x18')](_0xb451('0x19'),_0x105d95,_0x22162e[_0xb451('0x1a')](_0xb451('0x1b')),_0x31c2b5);_0x18b41f['when'](_0x31c2b5);})[_0xb451('0xb')](function(_0x4d6990){console[_0xb451('0x1c')](_0x4d6990);logger[_0xb451('0x8')](_0xb451('0x19'),_0x105d95,_0x22162e[_0xb451('0x1a')](_0xb451('0x1b')),_0x4d6990[_0xb451('0x1d')]);_0x18b41f['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index ff069ff..3f90a4e 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 _0x76dc=['origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','agent','complete','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','info','format','uniqueid','membername','interface','calleridnum','queue','getVoiceQueueByName','type','agentcomplete','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','now','lastevent','called','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','talktime','queuecallerabandon','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','ringtime','connect','answered_elsewhere','answeredelsewheremembername','isNil','agentcompleteAt','diffTime','agentconnectAt','[%s][agents][agentcomplete]','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','[%s][agents][attendedtransfer]','origtransfereruniqueid'];(function(_0x2a0ab3,_0xcdddf1){var _0x73f2ad=function(_0x23a364){while(--_0x23a364){_0x2a0ab3['push'](_0x2a0ab3['shift']());}};_0x73f2ad(++_0xcdddf1);}(_0x76dc,0x1f2));var _0xc76d=function(_0x2b4912,_0x147d1c){_0x2b4912=_0x2b4912-0x0;var _0x5a773a=_0x76dc[_0x2b4912];return _0x5a773a;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var utils=require(_0xc76d('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x26e85e,_0x49c651){utils[_0xc76d('0x3')](util[_0xc76d('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x26e85e[_0xc76d('0x5')],_0x26e85e['channel'],_0x26e85e['queue'],_0x26e85e[_0xc76d('0x6')],_0x26e85e[_0xc76d('0x7')],_0x26e85e[_0xc76d('0x8')],_0x26e85e['connectedlinenum'],_0x26e85e['lastevent']));if(_0x26e85e[_0xc76d('0x9')]){utils[_0xc76d('0xa')](_0x26e85e[_0xc76d('0x9')])['then'](function(_0x570197){if(_0x570197){_0x26e85e[_0xc76d('0xb')]=_0x570197[_0xc76d('0xb')];_0x26e85e['agentacw']=_0x26e85e[_0xc76d('0xc')]?_0x570197['acw']:![];_0x26e85e[_0xc76d('0xd')]=_0x26e85e[_0xc76d('0xe')]?_0x570197[_0xc76d('0xf')]:0x0;}utils[_0xc76d('0x10')](_0xc76d('0x11'),_0x26e85e);});}else{utils[_0xc76d('0x10')](_0xc76d('0x11'),_0x26e85e);}if(_0x49c651){delete transfers[_0x26e85e[_0xc76d('0x5')]];}else{delete agents[_0x26e85e[_0xc76d('0x12')]];}}exports[_0xc76d('0x13')]=function(_0x1a7b47){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x15'),_0x1a7b47['uniqueid']),_0x1a7b47);agents[_0x1a7b47[_0xc76d('0x12')]]=_0x1a7b47;agents[_0x1a7b47[_0xc76d('0x12')]]['agentcalledAt']=utils[_0xc76d('0x16')]();agents[_0x1a7b47[_0xc76d('0x12')]][_0xc76d('0x17')]=_0xc76d('0x18');agents[_0x1a7b47['destuniqueid']][_0xc76d('0x19')]=null;agents[_0x1a7b47['destuniqueid']]['connectedlinename']=null;utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x1a'),_0x1a7b47[_0xc76d('0x5')],agents[_0x1a7b47[_0xc76d('0x12')]]['membername'],_0x1a7b47[_0xc76d('0x12')]));}catch(_0x361f42){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x15'),_0x1a7b47['uniqueid']),_0x361f42);}};exports[_0xc76d('0x1c')]=function(_0x324db7){try{if(!_['isNil'](agents[_0x324db7[_0xc76d('0x12')]])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x1d'),_0x324db7[_0xc76d('0x5')]),_0x324db7);utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x1e'),_0x324db7[_0xc76d('0x5')],agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x6')],_0x324db7['destuniqueid']));agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x1c')]=!![];agents[_0x324db7['destuniqueid']][_0xc76d('0x1f')]=utils[_0xc76d('0x16')]();agents[_0x324db7['destuniqueid']][_0xc76d('0x17')]=_0xc76d('0x20');agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x21')]=_0xc76d('0x20');agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x22')]=_0x324db7['ringtime']?parseInt(_0x324db7['ringtime'])/0x3e8:0x0;agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x23')]=0x0;unanswered['push'](_0x324db7[_0xc76d('0x12')]);}}catch(_0x52a79a){utils[_0xc76d('0x1b')](util['format'](_0xc76d('0x1d'),_0x324db7['uniqueid']),_0x52a79a);}};exports[_0xc76d('0x24')]=function(_0x18a7fa){try{_['forIn'](agents,function(_0x3d4076,_0x1c68f3){if(_0x3d4076[_0xc76d('0x5')]==_0x18a7fa[_0xc76d('0x5')]&&!_['includes'](unanswered,_0x3d4076[_0xc76d('0x12')])){utils['debug'](util[_0xc76d('0x4')]('[%s][agents][queuecallerabandon]',_0x18a7fa[_0xc76d('0x5')]),_0x18a7fa);utils[_0xc76d('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x18a7fa['uniqueid'],_0x3d4076['membername'],_0x3d4076[_0xc76d('0x12')]));_0x3d4076[_0xc76d('0x1c')]=!![];_0x3d4076[_0xc76d('0x1f')]=utils[_0xc76d('0x16')]();_0x3d4076[_0xc76d('0x17')]='abandoned';_0x3d4076[_0xc76d('0x21')]='abandoned';_0x3d4076[_0xc76d('0x22')]=_0x18a7fa['holdtime'];_0x3d4076[_0xc76d('0x23')]=0x0;writeDB(_0x3d4076);}});}catch(_0x2332f5){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x25'),_0x18a7fa['uniqueid']),_0x2332f5);}};exports[_0xc76d('0x26')]=function(_0x371306){try{if(agents[_0x371306[_0xc76d('0x12')]]){utils['debug'](util[_0xc76d('0x4')](_0xc76d('0x27'),_0x371306[_0xc76d('0x5')]),_0x371306);utils['info'](util[_0xc76d('0x4')](_0xc76d('0x28'),_0x371306[_0xc76d('0x5')],agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x6')],_0x371306[_0xc76d('0x12')]));agents[_0x371306['destuniqueid']]['agentconnectAt']=utils[_0xc76d('0x16')]();agents[_0x371306['destuniqueid']][_0xc76d('0x19')]=_0x371306[_0xc76d('0x19')];agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x29')]=_0x371306['connectedlinename'];agents[_0x371306['destuniqueid']][_0xc76d('0x22')]=_0x371306[_0xc76d('0x2a')];agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x17')]=_0xc76d('0x2b');_['forIn'](agents,function(_0x42404c,_0xb264b0){if(_0x42404c[_0xc76d('0x12')]!=_0x371306[_0xc76d('0x12')]&&_0x42404c[_0xc76d('0x5')]==_0x371306[_0xc76d('0x5')]){_0x42404c[_0xc76d('0x23')]=0x0;_0x42404c[_0xc76d('0x22')]=_0x371306[_0xc76d('0x2a')];_0x42404c[_0xc76d('0x1c')]=!![];_0x42404c['agentringnoanswerAt']=utils['now']();_0x42404c[_0xc76d('0x17')]=_0xc76d('0x2c');_0x42404c[_0xc76d('0x21')]=_0xc76d('0x2c');_0x42404c['answeredelsewheredestinationuniqueid']=_0x371306['destuniqueid'];_0x42404c[_0xc76d('0x2d')]=_0x371306[_0xc76d('0x6')];writeDB(_0x42404c);}});}}catch(_0x3e471e){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x27'),_0x371306[_0xc76d('0x5')]),_0x3e471e);}};exports[_0xc76d('0xc')]=function(_0x50e922){try{if(!_[_0xc76d('0x2e')](agents[_0x50e922[_0xc76d('0x12')]])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')]('[%s][agents][agentcomplete]',_0x50e922['uniqueid']),_0x50e922);utils['info'](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x50e922['uniqueid'],agents[_0x50e922['destuniqueid']][_0xc76d('0x6')],_0x50e922[_0xc76d('0x12')]));agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0xc')]=!![];agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();agents[_0x50e922[_0xc76d('0x12')]]['talktime']=utils[_0xc76d('0x30')](agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x2f')],agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x31')]);agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x21')]=_0x50e922[_0xc76d('0x21')];agents[_0x50e922[_0xc76d('0x12')]]['lastevent']='complete';writeDB(agents[_0x50e922[_0xc76d('0x12')]]);}}catch(_0x170f47){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x32'),_0x50e922['uniqueid']),_0x170f47);}};exports[_0xc76d('0x33')]=function(_0x1ede13){try{if(!_['isNil'](agents[_0x1ede13['transfereruniqueid']])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')]('[%s][agents][blindtransfer]',_0x1ede13[_0xc76d('0x5')]),_0x1ede13);utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x34'),_0x1ede13[_0xc76d('0x5')],agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x6')],agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x5')]));agents[_0x1ede13[_0xc76d('0x35')]]['transfer']=!![];agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x36')]=_0xc76d('0x37');agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x38')]=_0x1ede13[_0xc76d('0x39')];agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x3a')]=agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x5')];}}catch(_0x12c972){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x3b'),_0x1ede13['uniqueid']),_0x12c972);}};exports['attendedtransfer']=function(_0x5bec6c){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x3c'),_0x5bec6c[_0xc76d('0x3d')]),_0x5bec6c);if(_0x5bec6c[_0xc76d('0x3d')]==_0x5bec6c[_0xc76d('0x3e')]){if(!_['isNil'](agents[_0x5bec6c[_0xc76d('0x3f')]])){utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x40'),_0x5bec6c[_0xc76d('0x3d')],agents[_0x5bec6c['secondtransfereruniqueid']][_0xc76d('0x6')]));agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x41')]=!![];agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x36')]=_0xc76d('0x42');agents[_0x5bec6c['secondtransfereruniqueid']][_0xc76d('0x38')]=_0x5bec6c[_0xc76d('0x43')];agents[_0x5bec6c['secondtransfereruniqueid']]['transferuniqueid']=_0x5bec6c[_0xc76d('0x3d')];}if(_0x5bec6c['transfereeuniqueid']&&agents[_0x5bec6c[_0xc76d('0x44')]]){agents[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x45')]=0x1;transfers[_0x5bec6c[_0xc76d('0x44')]]=_[_0xc76d('0x46')](agents[_0x5bec6c[_0xc76d('0x44')]]);transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x8')]=agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x8')];transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x47')]=agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x47')];transfers[_0x5bec6c['transfereeuniqueid']][_0xc76d('0x48')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x31')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c['transfereeuniqueid']][_0xc76d('0x22')]=0x0;transfers[_0x5bec6c[_0xc76d('0x44')]]['agententerreason']=0x2;}}else if(_0x5bec6c['secondtransfereruniqueid']==_0x5bec6c['secondtransfererlinkedid']){if(!_[_0xc76d('0x2e')](agents[_0x5bec6c[_0xc76d('0x3d')]])){utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x40'),_0x5bec6c[_0xc76d('0x3d')],agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x6')]));agents[_0x5bec6c['origtransfereruniqueid']][_0xc76d('0x41')]=!![];agents[_0x5bec6c['origtransfereruniqueid']]['transfertype']=_0xc76d('0x42');agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x38')]=_0x5bec6c['secondtransfererexten'];agents[_0x5bec6c[_0xc76d('0x3d')]]['transferuniqueid']=_0x5bec6c['secondtransfereruniqueid'];}if(_0x5bec6c['transfertargetuniqueid']&&agents[_0x5bec6c[_0xc76d('0x49')]]){agents[_0x5bec6c[_0xc76d('0x49')]]['agententerreason']=0x1;transfers[_0x5bec6c[_0xc76d('0x49')]]=_[_0xc76d('0x46')](agents[_0x5bec6c[_0xc76d('0x49')]]);transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x8')]=agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x8')];transfers[_0x5bec6c['transfertargetuniqueid']]['calleridname']=agents[_0x5bec6c['origtransfereruniqueid']][_0xc76d('0x47')];transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x48')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x49')]]['agentconnectAt']=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x22')]=0x0;transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x45')]=0x2;}}}catch(_0x2af760){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')]('[%s][agents][attendedtransfer]',_0x5bec6c[_0xc76d('0x3d')]),_0x2af760);}};exports['hangup']=function(_0xa9f2e8){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x4a'),_0xa9f2e8['uniqueid']),_0xa9f2e8);if(agents[_0xa9f2e8[_0xc76d('0x5')]]&&agents[_0xa9f2e8['uniqueid']]['reason']===_0xc76d('0x20')){if(_0xa9f2e8[_0xc76d('0x4b')]==='21'){agents[_0xa9f2e8['uniqueid']][_0xc76d('0x21')]=_0xc76d('0x4c');agents[_0xa9f2e8['uniqueid']][_0xc76d('0x17')]=_0xc76d('0x4c');}utils['info'](util[_0xc76d('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xa9f2e8[_0xc76d('0x5')],agents[_0xa9f2e8[_0xc76d('0x5')]]['membername'],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],agents[_0xa9f2e8['uniqueid']][_0xc76d('0x17')]));writeDB(agents[_0xa9f2e8[_0xc76d('0x5')]]);var _0x277382=unanswered['indexOf'](_0xa9f2e8[_0xc76d('0x5')]);if(_0x277382>-0x1){unanswered['splice'](_0x277382,0x1);}}if(transfers[_0xa9f2e8['uniqueid']]){transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0xc')]=!![];transfers[_0xa9f2e8['uniqueid']][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x23')]=utils[_0xc76d('0x30')](transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]);transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')]=_0xc76d('0x4d');transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x17')]=_0xc76d('0x4e');utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x4f'),_0xa9f2e8[_0xc76d('0x5')],transfers[_0xa9f2e8[_0xc76d('0x5')]]['membername'],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x17')]));writeDB(transfers[_0xa9f2e8[_0xc76d('0x5')]],!![]);}if(agents[_0xa9f2e8[_0xc76d('0x5')]]&&agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]){agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0xc')]=!![];agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x23')]=utils[_0xc76d('0x30')](agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]);agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')]=agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x41')]?'transfer':_0xc76d('0x4d');agents[_0xa9f2e8[_0xc76d('0x5')]]['lastevent']=_0xc76d('0x4e');utils[_0xc76d('0x3')](util['format'](_0xc76d('0x4f'),_0xa9f2e8[_0xc76d('0x5')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x6')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],agents[_0xa9f2e8[_0xc76d('0x5')]]['lastevent']));writeDB(agents[_0xa9f2e8['uniqueid']]);}}catch(_0xe6a1dc){utils[_0xc76d('0x1b')](util['format'](_0xc76d('0x4a'),_0xa9f2e8[_0xc76d('0x5')]),_0xe6a1dc);}}; \ No newline at end of file +var _0x04b8=['ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','[%s][agents][hangup]','util','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','agentcalled','debug','destuniqueid','agentcalledAt','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','reason','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','now','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x04b8,0x159));var _0x804b=function(_0x153eb6,_0x5a291f){_0x153eb6=_0x153eb6-0x0;var _0x3855a7=_0x04b8[_0x153eb6];return _0x3855a7;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x241a4f,_0xa6a605){utils['info'](util[_0x804b('0x1')](_0x804b('0x2'),_0x241a4f['uniqueid'],_0x241a4f[_0x804b('0x3')],_0x241a4f[_0x804b('0x4')],_0x241a4f[_0x804b('0x5')],_0x241a4f['interface'],_0x241a4f[_0x804b('0x6')],_0x241a4f[_0x804b('0x7')],_0x241a4f[_0x804b('0x8')]));if(_0x241a4f['queue']){utils[_0x804b('0x9')](_0x241a4f[_0x804b('0x4')])['then'](function(_0x2a5a68){if(_0x2a5a68){_0x241a4f[_0x804b('0xa')]=_0x2a5a68[_0x804b('0xa')];_0x241a4f[_0x804b('0xb')]=_0x241a4f[_0x804b('0xc')]?_0x2a5a68['acw']:![];_0x241a4f[_0x804b('0xd')]=_0x241a4f[_0x804b('0xb')]?_0x2a5a68[_0x804b('0xe')]:0x0;}utils[_0x804b('0xf')](_0x804b('0x10'),_0x241a4f);});}else{utils[_0x804b('0xf')]('CreateVoiceAgentReport',_0x241a4f);}if(_0xa6a605){delete transfers[_0x241a4f[_0x804b('0x11')]];}else{delete agents[_0x241a4f['destuniqueid']];}}exports[_0x804b('0x12')]=function(_0x3a2702){try{utils[_0x804b('0x13')](util[_0x804b('0x1')]('[%s][agents][agentcalled]',_0x3a2702[_0x804b('0x11')]),_0x3a2702);agents[_0x3a2702[_0x804b('0x14')]]=_0x3a2702;agents[_0x3a2702[_0x804b('0x14')]][_0x804b('0x15')]=utils['now']();agents[_0x3a2702[_0x804b('0x14')]][_0x804b('0x8')]='called';agents[_0x3a2702[_0x804b('0x14')]]['connectedlinenum']=null;agents[_0x3a2702[_0x804b('0x14')]][_0x804b('0x16')]=null;utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x18'),_0x3a2702['uniqueid'],agents[_0x3a2702[_0x804b('0x14')]]['membername'],_0x3a2702[_0x804b('0x14')]));}catch(_0x95e719){utils[_0x804b('0x19')](util[_0x804b('0x1')]('[%s][agents][agentcalled]',_0x3a2702[_0x804b('0x11')]),_0x95e719);}};exports[_0x804b('0x1a')]=function(_0x427166){try{if(!_[_0x804b('0x1b')](agents[_0x427166[_0x804b('0x14')]])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x1c'),_0x427166[_0x804b('0x11')]),_0x427166);utils[_0x804b('0x17')](util[_0x804b('0x1')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x427166[_0x804b('0x11')],agents[_0x427166[_0x804b('0x14')]]['membername'],_0x427166[_0x804b('0x14')]));agents[_0x427166[_0x804b('0x14')]][_0x804b('0x1a')]=!![];agents[_0x427166[_0x804b('0x14')]][_0x804b('0x1d')]=utils['now']();agents[_0x427166[_0x804b('0x14')]][_0x804b('0x8')]='timeout';agents[_0x427166[_0x804b('0x14')]][_0x804b('0x1e')]=_0x804b('0x1f');agents[_0x427166[_0x804b('0x14')]][_0x804b('0x20')]=_0x427166['ringtime']?parseInt(_0x427166[_0x804b('0x21')])/0x3e8:0x0;agents[_0x427166[_0x804b('0x14')]][_0x804b('0x22')]=0x0;unanswered[_0x804b('0x23')](_0x427166[_0x804b('0x14')]);}}catch(_0x4a6079){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x1c'),_0x427166['uniqueid']),_0x4a6079);}};exports[_0x804b('0x24')]=function(_0x407357){try{_[_0x804b('0x25')](agents,function(_0x57b8da,_0x408857){if(_0x57b8da[_0x804b('0x11')]==_0x407357['uniqueid']&&!_[_0x804b('0x26')](unanswered,_0x57b8da[_0x804b('0x14')])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x27'),_0x407357[_0x804b('0x11')]),_0x407357);utils['info'](util[_0x804b('0x1')](_0x804b('0x28'),_0x407357[_0x804b('0x11')],_0x57b8da[_0x804b('0x5')],_0x57b8da[_0x804b('0x14')]));_0x57b8da[_0x804b('0x1a')]=!![];_0x57b8da[_0x804b('0x1d')]=utils[_0x804b('0x29')]();_0x57b8da[_0x804b('0x8')]=_0x804b('0x2a');_0x57b8da[_0x804b('0x1e')]=_0x804b('0x2a');_0x57b8da[_0x804b('0x20')]=_0x407357[_0x804b('0x20')];_0x57b8da[_0x804b('0x22')]=0x0;writeDB(_0x57b8da);}});}catch(_0x384c44){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x27'),_0x407357[_0x804b('0x11')]),_0x384c44);}};exports[_0x804b('0x2b')]=function(_0x350387){try{if(agents[_0x350387[_0x804b('0x14')]]){utils[_0x804b('0x13')](util[_0x804b('0x1')]('[%s][agents][agentconnect]',_0x350387['uniqueid']),_0x350387);utils['info'](util[_0x804b('0x1')](_0x804b('0x2c'),_0x350387[_0x804b('0x11')],agents[_0x350387['destuniqueid']]['membername'],_0x350387['destuniqueid']));agents[_0x350387[_0x804b('0x14')]][_0x804b('0x2d')]=utils[_0x804b('0x29')]();agents[_0x350387[_0x804b('0x14')]][_0x804b('0x7')]=_0x350387[_0x804b('0x7')];agents[_0x350387[_0x804b('0x14')]][_0x804b('0x16')]=_0x350387[_0x804b('0x16')];agents[_0x350387[_0x804b('0x14')]][_0x804b('0x20')]=_0x350387[_0x804b('0x21')];agents[_0x350387[_0x804b('0x14')]]['lastevent']=_0x804b('0x2e');_[_0x804b('0x25')](agents,function(_0xb877d6,_0x3d6d8a){if(_0xb877d6[_0x804b('0x14')]!=_0x350387['destuniqueid']&&_0xb877d6['uniqueid']==_0x350387[_0x804b('0x11')]){_0xb877d6[_0x804b('0x22')]=0x0;_0xb877d6[_0x804b('0x20')]=_0x350387['ringtime'];_0xb877d6[_0x804b('0x1a')]=!![];_0xb877d6['agentringnoanswerAt']=utils[_0x804b('0x29')]();_0xb877d6[_0x804b('0x8')]=_0x804b('0x2f');_0xb877d6[_0x804b('0x1e')]=_0x804b('0x2f');_0xb877d6[_0x804b('0x30')]=_0x350387[_0x804b('0x14')];_0xb877d6['answeredelsewheremembername']=_0x350387[_0x804b('0x5')];writeDB(_0xb877d6);}});}}catch(_0x1c0363){utils[_0x804b('0x19')](util[_0x804b('0x1')]('[%s][agents][agentconnect]',_0x350387[_0x804b('0x11')]),_0x1c0363);}};exports[_0x804b('0xc')]=function(_0x1df519){try{if(!_[_0x804b('0x1b')](agents[_0x1df519[_0x804b('0x14')]])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x31'),_0x1df519['uniqueid']),_0x1df519);utils[_0x804b('0x17')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1df519['uniqueid'],agents[_0x1df519[_0x804b('0x14')]]['membername'],_0x1df519[_0x804b('0x14')]));agents[_0x1df519[_0x804b('0x14')]][_0x804b('0xc')]=!![];agents[_0x1df519[_0x804b('0x14')]]['agentcompleteAt']=utils[_0x804b('0x29')]();agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x22')]=utils['diffTime'](agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x32')],agents[_0x1df519[_0x804b('0x14')]]['agentconnectAt']);agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x1e')]=_0x1df519[_0x804b('0x1e')];agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x8')]=_0x804b('0x33');writeDB(agents[_0x1df519[_0x804b('0x14')]]);}}catch(_0x2a2a08){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x31'),_0x1df519[_0x804b('0x11')]),_0x2a2a08);}};exports[_0x804b('0x34')]=function(_0x2c1796){try{if(!_['isNil'](agents[_0x2c1796['transfereruniqueid']])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x35'),_0x2c1796[_0x804b('0x11')]),_0x2c1796);utils[_0x804b('0x17')](util['format'](_0x804b('0x36'),_0x2c1796[_0x804b('0x11')],agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x5')],agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x11')]));agents[_0x2c1796['transfereruniqueid']]['transfer']=!![];agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x38')]='blind';agents[_0x2c1796['transfereruniqueid']][_0x804b('0x39')]=_0x2c1796[_0x804b('0x3a')];agents[_0x2c1796[_0x804b('0x37')]]['transferuniqueid']=agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x11')];}}catch(_0x54cc99){utils[_0x804b('0x19')](util['format'](_0x804b('0x35'),_0x2c1796['uniqueid']),_0x54cc99);}};exports[_0x804b('0x3b')]=function(_0x183e72){try{utils['debug'](util[_0x804b('0x1')]('[%s][agents][attendedtransfer]',_0x183e72[_0x804b('0x3c')]),_0x183e72);if(_0x183e72[_0x804b('0x3c')]==_0x183e72[_0x804b('0x3d')]){if(!_[_0x804b('0x1b')](agents[_0x183e72[_0x804b('0x3e')]])){utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x3f'),_0x183e72[_0x804b('0x3c')],agents[_0x183e72[_0x804b('0x3e')]]['membername']));agents[_0x183e72['secondtransfereruniqueid']][_0x804b('0x40')]=!![];agents[_0x183e72['secondtransfereruniqueid']]['transfertype']=_0x804b('0x41');agents[_0x183e72[_0x804b('0x3e')]][_0x804b('0x39')]=_0x183e72[_0x804b('0x42')];agents[_0x183e72['secondtransfereruniqueid']]['transferuniqueid']=_0x183e72[_0x804b('0x3c')];}if(_0x183e72[_0x804b('0x43')]&&agents[_0x183e72[_0x804b('0x43')]]){agents[_0x183e72[_0x804b('0x43')]][_0x804b('0x44')]=0x1;transfers[_0x183e72[_0x804b('0x43')]]=_[_0x804b('0x45')](agents[_0x183e72[_0x804b('0x43')]]);transfers[_0x183e72[_0x804b('0x43')]][_0x804b('0x6')]=agents[_0x183e72[_0x804b('0x3e')]][_0x804b('0x6')];transfers[_0x183e72[_0x804b('0x43')]][_0x804b('0x46')]=agents[_0x183e72[_0x804b('0x3e')]][_0x804b('0x46')];transfers[_0x183e72['transfereeuniqueid']][_0x804b('0x15')]=utils[_0x804b('0x29')]();transfers[_0x183e72['transfereeuniqueid']][_0x804b('0x2d')]=utils[_0x804b('0x29')]();transfers[_0x183e72[_0x804b('0x43')]][_0x804b('0x20')]=0x0;transfers[_0x183e72['transfereeuniqueid']][_0x804b('0x44')]=0x2;}}else if(_0x183e72[_0x804b('0x3e')]==_0x183e72['secondtransfererlinkedid']){if(!_[_0x804b('0x1b')](agents[_0x183e72[_0x804b('0x3c')]])){utils[_0x804b('0x17')](util['format'](_0x804b('0x3f'),_0x183e72[_0x804b('0x3c')],agents[_0x183e72[_0x804b('0x3c')]][_0x804b('0x5')]));agents[_0x183e72[_0x804b('0x3c')]]['transfer']=!![];agents[_0x183e72[_0x804b('0x3c')]][_0x804b('0x38')]=_0x804b('0x41');agents[_0x183e72[_0x804b('0x3c')]]['transferexten']=_0x183e72['secondtransfererexten'];agents[_0x183e72[_0x804b('0x3c')]]['transferuniqueid']=_0x183e72[_0x804b('0x3e')];}if(_0x183e72[_0x804b('0x47')]&&agents[_0x183e72[_0x804b('0x47')]]){agents[_0x183e72[_0x804b('0x47')]][_0x804b('0x44')]=0x1;transfers[_0x183e72['transfertargetuniqueid']]=_[_0x804b('0x45')](agents[_0x183e72[_0x804b('0x47')]]);transfers[_0x183e72[_0x804b('0x47')]]['calleridnum']=agents[_0x183e72[_0x804b('0x3c')]][_0x804b('0x6')];transfers[_0x183e72['transfertargetuniqueid']][_0x804b('0x46')]=agents[_0x183e72['origtransfereruniqueid']][_0x804b('0x46')];transfers[_0x183e72[_0x804b('0x47')]]['agentcalledAt']=utils[_0x804b('0x29')]();transfers[_0x183e72[_0x804b('0x47')]][_0x804b('0x2d')]=utils['now']();transfers[_0x183e72[_0x804b('0x47')]]['holdtime']=0x0;transfers[_0x183e72[_0x804b('0x47')]][_0x804b('0x44')]=0x2;}}}catch(_0x43f3ec){utils[_0x804b('0x19')](util['format'](_0x804b('0x48'),_0x183e72[_0x804b('0x3c')]),_0x43f3ec);}};exports[_0x804b('0x49')]=function(_0xa1da42){try{utils[_0x804b('0x13')](util[_0x804b('0x1')]('[%s][agents][hangup]',_0xa1da42[_0x804b('0x11')]),_0xa1da42);if(agents[_0xa1da42[_0x804b('0x11')]]&&agents[_0xa1da42['uniqueid']][_0x804b('0x1e')]===_0x804b('0x1f')){if(_0xa1da42[_0x804b('0x4a')]==='21'){agents[_0xa1da42[_0x804b('0x11')]]['reason']=_0x804b('0x4b');agents[_0xa1da42[_0x804b('0x11')]]['lastevent']=_0x804b('0x4b');}utils[_0x804b('0x17')](util['format'](_0x804b('0x4c'),_0xa1da42['uniqueid'],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x5')],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x1e')],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x8')]));writeDB(agents[_0xa1da42[_0x804b('0x11')]]);var _0x5efc95=unanswered[_0x804b('0x4d')](_0xa1da42['uniqueid']);if(_0x5efc95>-0x1){unanswered[_0x804b('0x4e')](_0x5efc95,0x1);}}if(transfers[_0xa1da42[_0x804b('0x11')]]){transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0xc')]=!![];transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x32')]=utils[_0x804b('0x29')]();transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x22')]=utils[_0x804b('0x4f')](transfers[_0xa1da42[_0x804b('0x11')]]['agentcompleteAt'],transfers[_0xa1da42['uniqueid']][_0x804b('0x2d')]);transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x1e')]=_0x804b('0x50');transfers[_0xa1da42['uniqueid']][_0x804b('0x8')]=_0x804b('0x33');utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x4c'),_0xa1da42[_0x804b('0x11')],transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x5')],transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x1e')],transfers[_0xa1da42['uniqueid']]['lastevent']));writeDB(transfers[_0xa1da42[_0x804b('0x11')]],!![]);}if(agents[_0xa1da42[_0x804b('0x11')]]&&agents[_0xa1da42['uniqueid']][_0x804b('0x2d')]){agents[_0xa1da42[_0x804b('0x11')]]['agentcomplete']=!![];agents[_0xa1da42[_0x804b('0x11')]]['agentcompleteAt']=utils['now']();agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x22')]=utils['diffTime'](agents[_0xa1da42['uniqueid']][_0x804b('0x32')],agents[_0xa1da42[_0x804b('0x11')]]['agentconnectAt']);agents[_0xa1da42[_0x804b('0x11')]]['reason']=agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x40')]?_0x804b('0x40'):'agent';agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x8')]=_0x804b('0x33');utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x4c'),_0xa1da42[_0x804b('0x11')],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x5')],agents[_0xa1da42[_0x804b('0x11')]]['reason'],agents[_0xa1da42['uniqueid']][_0x804b('0x8')]));writeDB(agents[_0xa1da42[_0x804b('0x11')]]);}}catch(_0x3dd61f){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x51'),_0xa1da42[_0x804b('0x11')]),_0x3dd61f);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9b2c41a..16da950 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 _0xef17=['FAILED','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','debug','[%s][calls][newchannel]','channel','context','calleridnum','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','transfer','destinationchannel','linkedid','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','cause-txt','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','musiconholdstartAt','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%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','appdata','set','startsWith','toLowerCase','cdr','substring','lastIndexOf','includes','hangup','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER'];(function(_0x3c1f74,_0x318bf4){var _0x4471a8=function(_0x12487f){while(--_0x12487f){_0x3c1f74['push'](_0x3c1f74['shift']());}};_0x4471a8(++_0x318bf4);}(_0xef17,0x136));var _0x7ef1=function(_0xb4f241,_0x26f66b){_0xb4f241=_0xb4f241-0x0;var _0x25c064=_0xef17[_0xb4f241];return _0x25c064;};'use strict';var _=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var utils=require(_0x7ef1('0x2'));var transfers=require(_0x7ef1('0x3'));var dispositions=[_0x7ef1('0x4'),_0x7ef1('0x5'),_0x7ef1('0x5'),_0x7ef1('0x4'),_0x7ef1('0x4'),'NO\x20ANSWER',_0x7ef1('0x6'),'BUSY',_0x7ef1('0x5'),'FAILED',_0x7ef1('0x5')];var channels={};function writeDB(_0x4ba2f0){var _0x5aec63;if(transfers[_0x7ef1('0x7')][_0x4ba2f0[_0x7ef1('0x8')]]){_0x5aec63=_0x4ba2f0['uniqueid'];_0x4ba2f0[_0x7ef1('0x8')]=transfers[_0x7ef1('0x7')][_0x4ba2f0[_0x7ef1('0x8')]][_0x7ef1('0x9')];}utils[_0x7ef1('0xa')](util[_0x7ef1('0xb')](_0x7ef1('0xc'),_0x4ba2f0['uniqueid'],_0x4ba2f0['channel'],_0x4ba2f0[_0x7ef1('0xd')],_0x4ba2f0['membername'],_0x4ba2f0['interface'],_0x4ba2f0['calleridnum'],_0x4ba2f0[_0x7ef1('0xe')],_0x4ba2f0['lastevent']));if(_0x4ba2f0[_0x7ef1('0xf')]){utils[_0x7ef1('0x10')](_0x4ba2f0[_0x7ef1('0xf')])[_0x7ef1('0x11')](function(_0x39ea9c){if(_0x39ea9c){_0x4ba2f0[_0x7ef1('0x12')]=_0x39ea9c['id'];}utils[_0x7ef1('0x13')](_0x7ef1('0x14'),_0x4ba2f0);});}else{utils['request']('CreateVoiceCallReport',_0x4ba2f0);}if(channels[_0x4ba2f0[_0x7ef1('0x8')]]){delete channels[_0x4ba2f0['uniqueid']];}else if(_0x5aec63&&channels[_0x5aec63]){if(!transfers[_0x7ef1('0x7')][_0x5aec63][_0x7ef1('0x15')])delete transfers['blinds'][_0x5aec63];delete channels[_0x5aec63];}}exports['newchannel']=function(_0x5d269a){try{utils[_0x7ef1('0x16')](util['format'](_0x7ef1('0x17'),_0x5d269a['uniqueid']),_0x5d269a);if(_0x5d269a['uniqueid']==_0x5d269a['linkedid']&&_0x5d269a[_0x7ef1('0x18')]!='OutgoingSpoolFailed'){utils[_0x7ef1('0xa')](util[_0x7ef1('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x5d269a['uniqueid'],_0x5d269a[_0x7ef1('0x19')],_0x5d269a['exten']));channels[_0x5d269a[_0x7ef1('0x8')]]={'uniqueid':_0x5d269a[_0x7ef1('0x8')],'accountcode':_0x5d269a[_0x7ef1('0xf')],'source':_0x5d269a[_0x7ef1('0x1a')],'destination':_0x5d269a[_0x7ef1('0x1b')],'destinationcontext':_0x5d269a[_0x7ef1('0x19')],'channel':_0x5d269a[_0x7ef1('0x18')],'starttime':utils[_0x7ef1('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x7ef1('0x1d')};}}catch(_0x3b118f){utils[_0x7ef1('0x1e')](util[_0x7ef1('0xb')](_0x7ef1('0x17'),_0x5d269a[_0x7ef1('0x8')]),_0x3b118f);}};exports[_0x7ef1('0x1f')]=function(_0x144e74){try{utils['debug'](util['format'](_0x7ef1('0x20'),_0x144e74[_0x7ef1('0x8')]),_0x144e74);if(!_[_0x7ef1('0x21')](channels[_0x144e74[_0x7ef1('0x8')]])&&_0x144e74[_0x7ef1('0x22')]==0x6){utils['info'](util[_0x7ef1('0xb')](_0x7ef1('0x23'),_0x144e74[_0x7ef1('0x8')],_0x144e74[_0x7ef1('0x19')],_0x144e74[_0x7ef1('0x18')]));if(_[_0x7ef1('0x21')](channels[_0x144e74[_0x7ef1('0x8')]]['systemanswertime'])){channels[_0x144e74[_0x7ef1('0x8')]]['systemanswertime']=utils[_0x7ef1('0x1c')]();}}else if(!_[_0x7ef1('0x21')](channels[_0x144e74['linkedid']])&&_0x144e74['channelstate']==0x6&&_0x144e74[_0x7ef1('0x19')]!=_0x7ef1('0x24')){utils['info'](util[_0x7ef1('0xb')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x144e74[_0x7ef1('0x8')],_0x144e74['linkedid'],_0x144e74[_0x7ef1('0x19')],_0x144e74[_0x7ef1('0x18')]));channels[_0x144e74['linkedid']]['accountcode']=_0x144e74['accountcode'];channels[_0x144e74['linkedid']][_0x7ef1('0x25')]=_0x144e74[_0x7ef1('0x18')];if(_['isNil'](channels[_0x144e74[_0x7ef1('0x26')]]['answertime'])){channels[_0x144e74['linkedid']][_0x7ef1('0x27')]=utils['now']();}channels[_0x144e74[_0x7ef1('0x26')]][_0x7ef1('0x28')]=dispositions[_[_0x7ef1('0x29')](_0x144e74[_0x7ef1('0x22')])]||'ANSWERED';}}catch(_0x191575){utils[_0x7ef1('0x1e')](util['format']('[%s][calls][newstate]',_0x144e74['uniqueid']),_0x191575);}};exports['hangup']=function(_0x389f9e){try{if(!_['isNil'](channels[_0x389f9e[_0x7ef1('0x8')]])){utils[_0x7ef1('0x16')](util[_0x7ef1('0xb')](_0x7ef1('0x2a'),_0x389f9e[_0x7ef1('0x8')]),_0x389f9e);if(_[_0x7ef1('0x21')](channels[_0x389f9e[_0x7ef1('0x8')]][_0x7ef1('0x2b')])){channels[_0x389f9e[_0x7ef1('0x8')]][_0x7ef1('0x2b')]=_0x389f9e[_0x7ef1('0x2c')]+'\x20<'+_0x389f9e['calleridnum']+'>';}utils[_0x7ef1('0xa')](util[_0x7ef1('0xb')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x389f9e[_0x7ef1('0x8')],channels[_0x389f9e[_0x7ef1('0x8')]][_0x7ef1('0x2b')],_0x389f9e[_0x7ef1('0x2d')]));channels[_0x389f9e[_0x7ef1('0x8')]]['endtime']=utils[_0x7ef1('0x1c')]();channels[_0x389f9e[_0x7ef1('0x8')]][_0x7ef1('0x2e')]=utils[_0x7ef1('0x2f')](channels[_0x389f9e[_0x7ef1('0x8')]][_0x7ef1('0x30')],channels[_0x389f9e[_0x7ef1('0x8')]][_0x7ef1('0x31')]);channels[_0x389f9e[_0x7ef1('0x8')]][_0x7ef1('0x32')]=channels[_0x389f9e[_0x7ef1('0x8')]][_0x7ef1('0x27')]?utils[_0x7ef1('0x2f')](channels[_0x389f9e[_0x7ef1('0x8')]][_0x7ef1('0x30')],channels[_0x389f9e['uniqueid']][_0x7ef1('0x27')]):0x0;writeDB(channels[_0x389f9e[_0x7ef1('0x8')]]);}}catch(_0x302212){utils[_0x7ef1('0x1e')](util[_0x7ef1('0xb')](_0x7ef1('0x2a'),_0x389f9e[_0x7ef1('0x8')]),_0x302212);}};exports[_0x7ef1('0x33')]=function(_0xf76a03){try{if(!_[_0x7ef1('0x21')](channels[_0xf76a03[_0x7ef1('0x34')]])){utils[_0x7ef1('0x16')](util[_0x7ef1('0xb')]('[%s][calls][attendedtransfer]',_0xf76a03[_0x7ef1('0x35')]),_0xf76a03);if(channels[_0xf76a03[_0x7ef1('0x34')]][_0x7ef1('0x18')]==_0xf76a03[_0x7ef1('0x36')]){utils[_0x7ef1('0xa')](util[_0x7ef1('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xf76a03[_0x7ef1('0x35')],_0xf76a03[_0x7ef1('0x34')],_0xf76a03[_0x7ef1('0x37')]));channels[_0xf76a03[_0x7ef1('0x34')]][_0x7ef1('0x25')]=_0xf76a03[_0x7ef1('0x37')];channels[_0xf76a03['localtwolinkedid']][_0x7ef1('0x38')]=_0x7ef1('0x39');}else if(channels[_0xf76a03[_0x7ef1('0x34')]][_0x7ef1('0x18')]=_0xf76a03['transfertargetchannel']){utils[_0x7ef1('0xa')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xf76a03[_0x7ef1('0x35')],_0xf76a03['localtwolinkedid'],_0xf76a03[_0x7ef1('0x3a')]));channels[_0xf76a03['localtwolinkedid']][_0x7ef1('0x25')]=_0xf76a03[_0x7ef1('0x3a')];channels[_0xf76a03[_0x7ef1('0x34')]][_0x7ef1('0x38')]=_0x7ef1('0x39');}}}catch(_0x2cd383){utils[_0x7ef1('0x1e')](util[_0x7ef1('0xb')]('[%s][calls][attendedtransfer]',_0xf76a03['origtransfereruniqueid']),_0x2cd383);}};exports[_0x7ef1('0x3b')]=function(_0x2d4398){try{if(!_['isNil'](channels[_0x2d4398[_0x7ef1('0x8')]])){utils[_0x7ef1('0x16')](util[_0x7ef1('0xb')]('[%s][calls][musiconholdstart]',_0x2d4398['uniqueid']),_0x2d4398);channels[_0x2d4398[_0x7ef1('0x8')]]['musiconholdstartAt']=utils['now']();utils[_0x7ef1('0xa')](util[_0x7ef1('0xb')](_0x7ef1('0x3c'),_0x2d4398[_0x7ef1('0x8')],channels[_0x2d4398[_0x7ef1('0x8')]]['musiconholdstartAt']));}}catch(_0xd4a407){utils['error'](util[_0x7ef1('0xb')]('[%s][calls][musiconholdstart]',_0x2d4398[_0x7ef1('0x8')]),_0xd4a407);}};exports['musiconholdstop']=function(_0x4f4030){try{if(!_[_0x7ef1('0x21')](channels[_0x4f4030['uniqueid']])){utils[_0x7ef1('0x16')](util[_0x7ef1('0xb')]('[%s][calls][musiconholdstop]',_0x4f4030[_0x7ef1('0x8')]),_0x4f4030);if(!_[_0x7ef1('0x21')](channels[_0x4f4030[_0x7ef1('0x8')]]['musiconholdstartAt'])){channels[_0x4f4030[_0x7ef1('0x8')]][_0x7ef1('0x3d')]+=utils['diffTime'](utils[_0x7ef1('0x1c')](),channels[_0x4f4030[_0x7ef1('0x8')]][_0x7ef1('0x3e')]);utils[_0x7ef1('0xa')](util[_0x7ef1('0xb')](_0x7ef1('0x3f'),_0x4f4030[_0x7ef1('0x8')],channels[_0x4f4030['uniqueid']]['mohtime']));delete channels[_0x4f4030[_0x7ef1('0x8')]][_0x7ef1('0x3e')];}}}catch(_0x25bcc6){utils[_0x7ef1('0x1e')](util[_0x7ef1('0xb')](_0x7ef1('0x40'),_0x4f4030[_0x7ef1('0x8')]),_0x25bcc6);}};exports[_0x7ef1('0x41')]=function(_0x86407f){try{if(!_[_0x7ef1('0x21')](channels[_0x86407f[_0x7ef1('0x8')]])){utils['debug'](util[_0x7ef1('0xb')](_0x7ef1('0x42'),_0x86407f[_0x7ef1('0x8')]),_0x86407f);if(!_[_0x7ef1('0x21')](_0x86407f[_0x7ef1('0x43')]['xmd-originatecalleridnum'])){utils[_0x7ef1('0xa')](util[_0x7ef1('0xb')](_0x7ef1('0x44'),_0x86407f['uniqueid'],_0x86407f[_0x7ef1('0x45')]));channels[_0x86407f[_0x7ef1('0x8')]]['source']=_0x86407f[_0x7ef1('0x45')];}if(!_[_0x7ef1('0x21')](_0x86407f[_0x7ef1('0x43')][_0x7ef1('0x46')])){utils[_0x7ef1('0xa')](util[_0x7ef1('0xb')](_0x7ef1('0x47'),_0x86407f[_0x7ef1('0x8')],_0x86407f[_0x7ef1('0x45')]));channels[_0x86407f[_0x7ef1('0x8')]][_0x7ef1('0x48')]=_0x86407f['value'];channels[_0x86407f[_0x7ef1('0x8')]][_0x7ef1('0x2b')]='\x22'+_0x86407f['value']+_0x7ef1('0x49')+_0x86407f[_0x7ef1('0x45')]+'>';}if(!_[_0x7ef1('0x21')](_0x86407f['variable'][_0x7ef1('0x4a')])||!_[_0x7ef1('0x21')](_0x86407f['variable'][_0x7ef1('0x4b')])){utils[_0x7ef1('0xa')](util[_0x7ef1('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x86407f[_0x7ef1('0x8')],!_[_0x7ef1('0x21')](_0x86407f[_0x7ef1('0x43')]['xmd-callerid-preview'])?_0x7ef1('0x4a'):_0x7ef1('0x4b'),_0x86407f[_0x7ef1('0x45')]));channels[_0x86407f['uniqueid']][_0x7ef1('0x2b')]=_0x86407f[_0x7ef1('0x45')];}if(!_['isNil'](_0x86407f[_0x7ef1('0x43')][_0x7ef1('0x4c')])||!_[_0x7ef1('0x21')](_0x86407f[_0x7ef1('0x43')][_0x7ef1('0x4d')])){utils[_0x7ef1('0xa')](util[_0x7ef1('0xb')](_0x7ef1('0x4e'),_0x86407f[_0x7ef1('0x8')],!_['isNil'](_0x86407f[_0x7ef1('0x43')]['xmd-queue'])?_0x7ef1('0x4c'):'xmcs-queue',_0x86407f[_0x7ef1('0x45')]));channels[_0x86407f[_0x7ef1('0x8')]][_0x7ef1('0x4f')]=_0x7ef1('0x50');channels[_0x86407f['uniqueid']][_0x7ef1('0x51')]=_0x86407f[_0x7ef1('0x45')];channels[_0x86407f[_0x7ef1('0x8')]][_0x7ef1('0xd')]=!![];}if(!_[_0x7ef1('0x21')](_0x86407f['variable'][_0x7ef1('0x52')])){utils['info'](util['format'](_0x7ef1('0x53'),_0x86407f[_0x7ef1('0x8')],_0x86407f[_0x7ef1('0x45')]));channels[_0x86407f[_0x7ef1('0x8')]][_0x7ef1('0x54')]=_0x86407f['value'];}if(!_[_0x7ef1('0x21')](_0x86407f[_0x7ef1('0x43')]['xmd-cdrtype'])){utils[_0x7ef1('0xa')](util[_0x7ef1('0xb')](_0x7ef1('0x55'),_0x86407f[_0x7ef1('0x8')],_0x86407f['value']));channels[_0x86407f[_0x7ef1('0x8')]][_0x7ef1('0x56')]=_0x86407f[_0x7ef1('0x45')];}if(!_[_0x7ef1('0x21')](_0x86407f['variable']['outboundrouteid'])){utils[_0x7ef1('0xa')](util[_0x7ef1('0xb')](_0x7ef1('0x57'),_0x86407f[_0x7ef1('0x8')],_0x86407f[_0x7ef1('0x45')]));channels[_0x86407f[_0x7ef1('0x8')]]['routeid']=_0x86407f['value'];}if(!_['isNil'](_0x86407f[_0x7ef1('0x43')]['sipcallid'])){utils['info'](util[_0x7ef1('0xb')](_0x7ef1('0x58'),_0x86407f['uniqueid'],_0x86407f[_0x7ef1('0x45')]));channels[_0x86407f[_0x7ef1('0x8')]][_0x7ef1('0x59')]=_0x86407f[_0x7ef1('0x45')];}}}catch(_0x12c7c1){utils[_0x7ef1('0x1e')](util[_0x7ef1('0xb')](_0x7ef1('0x42'),_0x86407f[_0x7ef1('0x8')]),_0x12c7c1);}};exports[_0x7ef1('0x5a')]=function(_0x17bd86){try{if(!_[_0x7ef1('0x21')](channels[_0x17bd86['uniqueid']])){utils[_0x7ef1('0x16')](util['format'](_0x7ef1('0x5b'),_0x17bd86['uniqueid']),_0x17bd86);utils['info'](util[_0x7ef1('0xb')](_0x7ef1('0x5c'),_0x17bd86[_0x7ef1('0x8')],_0x17bd86[_0x7ef1('0x5d')],_0x17bd86[_0x7ef1('0x5e')]));if(_0x17bd86[_0x7ef1('0x5d')]['toLowerCase']()==_0x7ef1('0x5f')&&_[_0x7ef1('0x60')](_0x17bd86[_0x7ef1('0x5e')][_0x7ef1('0x61')](),_0x7ef1('0x62'))){var _0x166a3d=_0x17bd86[_0x7ef1('0x5e')]['split']('=');var _0x5d30bc=_0x166a3d[0x0][_0x7ef1('0x63')](_0x166a3d[0x0][_0x7ef1('0x64')]('(')+0x1,_0x166a3d[0x0][_0x7ef1('0x64')](')'));var _0x162e8d=_0x166a3d[0x1];channels[_0x17bd86[_0x7ef1('0x8')]][_0x5d30bc]=_0x162e8d;}if(!_[_0x7ef1('0x65')]([_0x7ef1('0x66'),'noop',_0x7ef1('0x67'),_0x7ef1('0x5f'),_0x7ef1('0x68')],_0x17bd86['application']['toLowerCase']())){channels[_0x17bd86[_0x7ef1('0x8')]][_0x7ef1('0x4f')]=_0x17bd86[_0x7ef1('0x5d')];channels[_0x17bd86[_0x7ef1('0x8')]]['lastdata']=_0x17bd86[_0x7ef1('0x5e')];}}}catch(_0x246dea){utils[_0x7ef1('0x1e')](util['format']('[%s][calls][newexten]',_0x17bd86['uniqueid']),_0x246dea);}}; \ No newline at end of file +var _0x553f=['appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','ANSWERED','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','format','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','info','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','error','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x34950f,_0x345c88){var _0xaab5f7=function(_0x44b324){while(--_0x44b324){_0x34950f['push'](_0x34950f['shift']());}};_0xaab5f7(++_0x345c88);}(_0x553f,0x1c0));var _0xf553=function(_0x503877,_0x36edd4){_0x503877=_0x503877-0x0;var _0x561fc5=_0x553f[_0x503877];return _0x561fc5;};'use strict';var _=require(_0xf553('0x0'));var util=require(_0xf553('0x1'));var utils=require(_0xf553('0x2'));var transfers=require(_0xf553('0x3'));var dispositions=[_0xf553('0x4'),'FAILED','FAILED',_0xf553('0x4'),'NO\x20ANSWER',_0xf553('0x4'),_0xf553('0x5'),_0xf553('0x6'),'FAILED',_0xf553('0x7'),_0xf553('0x7')];var channels={};function writeDB(_0x38573a){var _0x54a907;if(transfers[_0xf553('0x8')][_0x38573a[_0xf553('0x9')]]){_0x54a907=_0x38573a['uniqueid'];_0x38573a['uniqueid']=transfers['blinds'][_0x38573a[_0xf553('0x9')]][_0xf553('0xa')];}utils['info'](util[_0xf553('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x38573a[_0xf553('0x9')],_0x38573a[_0xf553('0xc')],_0x38573a['queue'],_0x38573a[_0xf553('0xd')],_0x38573a[_0xf553('0xe')],_0x38573a[_0xf553('0xf')],_0x38573a[_0xf553('0x10')],_0x38573a[_0xf553('0x11')]));if(_0x38573a[_0xf553('0x12')]){utils[_0xf553('0x13')](_0x38573a[_0xf553('0x12')])[_0xf553('0x14')](function(_0x154752){if(_0x154752){_0x38573a['UserId']=_0x154752['id'];}utils[_0xf553('0x15')](_0xf553('0x16'),_0x38573a);});}else{utils['request'](_0xf553('0x16'),_0x38573a);}if(channels[_0x38573a[_0xf553('0x9')]]){delete channels[_0x38573a[_0xf553('0x9')]];}else if(_0x54a907&&channels[_0x54a907]){if(!transfers[_0xf553('0x8')][_0x54a907][_0xf553('0x17')])delete transfers[_0xf553('0x8')][_0x54a907];delete channels[_0x54a907];}}exports['newchannel']=function(_0x450bb3){try{utils[_0xf553('0x18')](util[_0xf553('0xb')](_0xf553('0x19'),_0x450bb3[_0xf553('0x9')]),_0x450bb3);if(_0x450bb3['uniqueid']==_0x450bb3[_0xf553('0x1a')]&&_0x450bb3[_0xf553('0xc')]!='OutgoingSpoolFailed'){utils['info'](util[_0xf553('0xb')](_0xf553('0x1b'),_0x450bb3['uniqueid'],_0x450bb3['context'],_0x450bb3[_0xf553('0x1c')]));channels[_0x450bb3['uniqueid']]={'uniqueid':_0x450bb3[_0xf553('0x9')],'accountcode':_0x450bb3[_0xf553('0x12')],'source':_0x450bb3[_0xf553('0xf')],'destination':_0x450bb3[_0xf553('0x1c')],'destinationcontext':_0x450bb3[_0xf553('0x1d')],'channel':_0x450bb3[_0xf553('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xf553('0x1e')};}}catch(_0x12e0d1){utils['error'](util[_0xf553('0xb')]('[%s][calls][newchannel]',_0x450bb3[_0xf553('0x9')]),_0x12e0d1);}};exports[_0xf553('0x1f')]=function(_0x3a0aa7){try{utils['debug'](util[_0xf553('0xb')]('[%s][calls][newstate]',_0x3a0aa7[_0xf553('0x9')]),_0x3a0aa7);if(!_[_0xf553('0x20')](channels[_0x3a0aa7['uniqueid']])&&_0x3a0aa7[_0xf553('0x21')]==0x6){utils['info'](util[_0xf553('0xb')](_0xf553('0x22'),_0x3a0aa7['uniqueid'],_0x3a0aa7[_0xf553('0x1d')],_0x3a0aa7[_0xf553('0xc')]));if(_[_0xf553('0x20')](channels[_0x3a0aa7['uniqueid']][_0xf553('0x23')])){channels[_0x3a0aa7[_0xf553('0x9')]][_0xf553('0x23')]=utils[_0xf553('0x24')]();}}else if(!_['isNil'](channels[_0x3a0aa7[_0xf553('0x1a')]])&&_0x3a0aa7[_0xf553('0x21')]==0x6&&_0x3a0aa7[_0xf553('0x1d')]!=_0xf553('0x25')){utils[_0xf553('0x26')](util[_0xf553('0xb')](_0xf553('0x27'),_0x3a0aa7[_0xf553('0x9')],_0x3a0aa7['linkedid'],_0x3a0aa7[_0xf553('0x1d')],_0x3a0aa7[_0xf553('0xc')]));channels[_0x3a0aa7['linkedid']][_0xf553('0x12')]=_0x3a0aa7[_0xf553('0x12')];channels[_0x3a0aa7[_0xf553('0x1a')]][_0xf553('0x28')]=_0x3a0aa7[_0xf553('0xc')];if(_['isNil'](channels[_0x3a0aa7[_0xf553('0x1a')]][_0xf553('0x29')])){channels[_0x3a0aa7[_0xf553('0x1a')]][_0xf553('0x29')]=utils[_0xf553('0x24')]();}channels[_0x3a0aa7[_0xf553('0x1a')]][_0xf553('0x2a')]=dispositions[_[_0xf553('0x2b')](_0x3a0aa7[_0xf553('0x21')])]||_0xf553('0x5');}}catch(_0x2808cc){utils['error'](util[_0xf553('0xb')](_0xf553('0x2c'),_0x3a0aa7[_0xf553('0x9')]),_0x2808cc);}};exports[_0xf553('0x2d')]=function(_0x21125b){try{if(!_[_0xf553('0x20')](channels[_0x21125b[_0xf553('0x9')]])){utils[_0xf553('0x18')](util[_0xf553('0xb')]('[%s][calls][hangup]',_0x21125b[_0xf553('0x9')]),_0x21125b);if(_[_0xf553('0x20')](channels[_0x21125b[_0xf553('0x9')]][_0xf553('0x2e')])){channels[_0x21125b['uniqueid']][_0xf553('0x2e')]=_0x21125b[_0xf553('0x2f')]+'\x20<'+_0x21125b[_0xf553('0xf')]+'>';}utils[_0xf553('0x26')](util[_0xf553('0xb')](_0xf553('0x30'),_0x21125b[_0xf553('0x9')],channels[_0x21125b[_0xf553('0x9')]][_0xf553('0x2e')],_0x21125b[_0xf553('0x31')]));channels[_0x21125b['uniqueid']][_0xf553('0x32')]=utils[_0xf553('0x24')]();channels[_0x21125b[_0xf553('0x9')]]['duration']=utils[_0xf553('0x33')](channels[_0x21125b['uniqueid']][_0xf553('0x32')],channels[_0x21125b[_0xf553('0x9')]][_0xf553('0x34')]);channels[_0x21125b[_0xf553('0x9')]]['billableseconds']=channels[_0x21125b[_0xf553('0x9')]][_0xf553('0x29')]?utils[_0xf553('0x33')](channels[_0x21125b[_0xf553('0x9')]][_0xf553('0x32')],channels[_0x21125b[_0xf553('0x9')]]['answertime']):0x0;writeDB(channels[_0x21125b[_0xf553('0x9')]]);}}catch(_0x1e2f30){utils[_0xf553('0x35')](util[_0xf553('0xb')](_0xf553('0x36'),_0x21125b[_0xf553('0x9')]),_0x1e2f30);}};exports[_0xf553('0x37')]=function(_0x18540f){try{if(!_['isNil'](channels[_0x18540f[_0xf553('0x38')]])){utils[_0xf553('0x18')](util[_0xf553('0xb')](_0xf553('0x39'),_0x18540f[_0xf553('0x3a')]),_0x18540f);if(channels[_0x18540f[_0xf553('0x38')]][_0xf553('0xc')]==_0x18540f['transfereechannel']){utils[_0xf553('0x26')](util[_0xf553('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x18540f[_0xf553('0x3a')],_0x18540f['localtwolinkedid'],_0x18540f[_0xf553('0x3b')]));channels[_0x18540f[_0xf553('0x38')]][_0xf553('0x28')]=_0x18540f[_0xf553('0x3b')];channels[_0x18540f[_0xf553('0x38')]][_0xf553('0x3c')]=_0xf553('0x3d');}else if(channels[_0x18540f[_0xf553('0x38')]][_0xf553('0xc')]=_0x18540f[_0xf553('0x3e')]){utils[_0xf553('0x26')](util[_0xf553('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x18540f[_0xf553('0x3a')],_0x18540f[_0xf553('0x38')],_0x18540f[_0xf553('0x3f')]));channels[_0x18540f[_0xf553('0x38')]]['destinationchannel']=_0x18540f[_0xf553('0x3f')];channels[_0x18540f['localtwolinkedid']][_0xf553('0x3c')]=_0xf553('0x3d');}}}catch(_0x4fb22e){utils[_0xf553('0x35')](util['format']('[%s][calls][attendedtransfer]',_0x18540f[_0xf553('0x3a')]),_0x4fb22e);}};exports[_0xf553('0x40')]=function(_0x473c38){try{if(!_[_0xf553('0x20')](channels[_0x473c38['uniqueid']])){utils[_0xf553('0x18')](util[_0xf553('0xb')](_0xf553('0x41'),_0x473c38[_0xf553('0x9')]),_0x473c38);channels[_0x473c38['uniqueid']][_0xf553('0x42')]=utils['now']();utils[_0xf553('0x26')](util[_0xf553('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x473c38['uniqueid'],channels[_0x473c38['uniqueid']][_0xf553('0x42')]));}}catch(_0x35e9c8){utils[_0xf553('0x35')](util[_0xf553('0xb')](_0xf553('0x41'),_0x473c38[_0xf553('0x9')]),_0x35e9c8);}};exports['musiconholdstop']=function(_0x4bef32){try{if(!_[_0xf553('0x20')](channels[_0x4bef32['uniqueid']])){utils[_0xf553('0x18')](util['format'](_0xf553('0x43'),_0x4bef32[_0xf553('0x9')]),_0x4bef32);if(!_[_0xf553('0x20')](channels[_0x4bef32[_0xf553('0x9')]]['musiconholdstartAt'])){channels[_0x4bef32[_0xf553('0x9')]][_0xf553('0x44')]+=utils['diffTime'](utils[_0xf553('0x24')](),channels[_0x4bef32['uniqueid']][_0xf553('0x42')]);utils[_0xf553('0x26')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x4bef32[_0xf553('0x9')],channels[_0x4bef32[_0xf553('0x9')]][_0xf553('0x44')]));delete channels[_0x4bef32[_0xf553('0x9')]][_0xf553('0x42')];}}}catch(_0x37ef35){utils[_0xf553('0x35')](util[_0xf553('0xb')](_0xf553('0x43'),_0x4bef32[_0xf553('0x9')]),_0x37ef35);}};exports[_0xf553('0x45')]=function(_0x349edc){try{if(!_['isNil'](channels[_0x349edc[_0xf553('0x9')]])){utils[_0xf553('0x18')](util['format'](_0xf553('0x46'),_0x349edc[_0xf553('0x9')]),_0x349edc);if(!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')]['xmd-originatecalleridnum'])){utils['info'](util[_0xf553('0xb')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x349edc[_0xf553('0x9')],_0x349edc['value']));channels[_0x349edc['uniqueid']][_0xf553('0x48')]=_0x349edc[_0xf553('0x49')];}if(!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')][_0xf553('0x4a')])){utils['info'](util[_0xf553('0xb')](_0xf553('0x4b'),_0x349edc[_0xf553('0x9')],_0x349edc[_0xf553('0x49')]));channels[_0x349edc[_0xf553('0x9')]]['destination']=_0x349edc[_0xf553('0x49')];channels[_0x349edc['uniqueid']][_0xf553('0x2e')]='\x22'+_0x349edc[_0xf553('0x49')]+'\x22\x20<'+_0x349edc[_0xf553('0x49')]+'>';}if(!_['isNil'](_0x349edc[_0xf553('0x47')]['xmd-callerid-preview'])||!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')]['xmd-callerid'])){utils[_0xf553('0x26')](util[_0xf553('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x349edc[_0xf553('0x9')],!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')]['xmd-callerid-preview'])?_0xf553('0x4c'):_0xf553('0x4d'),_0x349edc[_0xf553('0x49')]));channels[_0x349edc[_0xf553('0x9')]][_0xf553('0x2e')]=_0x349edc[_0xf553('0x49')];}if(!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')]['xmd-queue'])||!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')]['xmcs-queue'])){utils['info'](util[_0xf553('0xb')](_0xf553('0x4e'),_0x349edc[_0xf553('0x9')],!_[_0xf553('0x20')](_0x349edc['variable'][_0xf553('0x4f')])?'xmd-queue':_0xf553('0x50'),_0x349edc[_0xf553('0x49')]));channels[_0x349edc[_0xf553('0x9')]][_0xf553('0x51')]=_0xf553('0x52');channels[_0x349edc[_0xf553('0x9')]][_0xf553('0x53')]=_0x349edc['value'];channels[_0x349edc[_0xf553('0x9')]][_0xf553('0x54')]=!![];}if(!_[_0xf553('0x20')](_0x349edc['variable'][_0xf553('0x55')])){utils[_0xf553('0x26')](util['format'](_0xf553('0x56'),_0x349edc[_0xf553('0x9')],_0x349edc[_0xf553('0x49')]));channels[_0x349edc[_0xf553('0x9')]][_0xf553('0x57')]=_0x349edc[_0xf553('0x49')];}if(!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')][_0xf553('0x58')])){utils[_0xf553('0x26')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x349edc[_0xf553('0x9')],_0x349edc['value']));channels[_0x349edc['uniqueid']]['type']=_0x349edc[_0xf553('0x49')];}if(!_['isNil'](_0x349edc[_0xf553('0x47')][_0xf553('0x59')])){utils[_0xf553('0x26')](util[_0xf553('0xb')](_0xf553('0x5a'),_0x349edc[_0xf553('0x9')],_0x349edc['value']));channels[_0x349edc[_0xf553('0x9')]]['routeid']=_0x349edc[_0xf553('0x49')];}if(!_[_0xf553('0x20')](_0x349edc[_0xf553('0x47')][_0xf553('0x5b')])){utils[_0xf553('0x26')](util[_0xf553('0xb')](_0xf553('0x5c'),_0x349edc[_0xf553('0x9')],_0x349edc[_0xf553('0x49')]));channels[_0x349edc[_0xf553('0x9')]][_0xf553('0x5b')]=_0x349edc['value'];}}}catch(_0xab8b84){utils[_0xf553('0x35')](util[_0xf553('0xb')](_0xf553('0x46'),_0x349edc[_0xf553('0x9')]),_0xab8b84);}};exports[_0xf553('0x5d')]=function(_0x4c6dda){try{if(!_[_0xf553('0x20')](channels[_0x4c6dda[_0xf553('0x9')]])){utils['debug'](util[_0xf553('0xb')](_0xf553('0x5e'),_0x4c6dda[_0xf553('0x9')]),_0x4c6dda);utils[_0xf553('0x26')](util[_0xf553('0xb')](_0xf553('0x5f'),_0x4c6dda['uniqueid'],_0x4c6dda[_0xf553('0x60')],_0x4c6dda[_0xf553('0x61')]));if(_0x4c6dda[_0xf553('0x60')][_0xf553('0x62')]()==_0xf553('0x63')&&_[_0xf553('0x64')](_0x4c6dda[_0xf553('0x61')][_0xf553('0x62')](),_0xf553('0x65'))){var _0x424607=_0x4c6dda[_0xf553('0x61')][_0xf553('0x66')]('=');var _0x274d1f=_0x424607[0x0][_0xf553('0x67')](_0x424607[0x0][_0xf553('0x68')]('(')+0x1,_0x424607[0x0][_0xf553('0x68')](')'));var _0x2cb39d=_0x424607[0x1];channels[_0x4c6dda[_0xf553('0x9')]][_0x274d1f]=_0x2cb39d;}if(!_[_0xf553('0x69')]([_0xf553('0x2d'),_0xf553('0x6a'),_0xf553('0x6b'),_0xf553('0x63'),_0xf553('0x6c')],_0x4c6dda[_0xf553('0x60')][_0xf553('0x62')]())){channels[_0x4c6dda[_0xf553('0x9')]][_0xf553('0x51')]=_0x4c6dda[_0xf553('0x60')];channels[_0x4c6dda['uniqueid']]['lastdata']=_0x4c6dda[_0xf553('0x61')];}}}catch(_0x358c8c){utils[_0xf553('0x35')](util[_0xf553('0xb')]('[%s][calls][newexten]',_0x4c6dda[_0xf553('0x9')]),_0x358c8c);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 9e797f9..b15106d 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 _0xed20=['info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils','connect'];(function(_0x3e79c4,_0x2a856f){var _0x3e3d13=function(_0x2078c5){while(--_0x2078c5){_0x3e79c4['push'](_0x3e79c4['shift']());}};_0x3e3d13(++_0x2a856f);}(_0xed20,0xd6));var _0x0ed2=function(_0x2f714a,_0x25714a){_0x2f714a=_0x2f714a-0x0;var _0x4ab381=_0xed20[_0x2f714a];return _0x4ab381;};'use strict';var utils=require(_0x0ed2('0x0'));exports[_0x0ed2('0x1')]=function(){utils[_0x0ed2('0x2')](_0x0ed2('0x3'));};exports[_0x0ed2('0x4')]=function(){utils[_0x0ed2('0x2')](_0x0ed2('0x5'));};exports[_0x0ed2('0x6')]=function(){utils[_0x0ed2('0x2')](_0x0ed2('0x7'));};exports[_0x0ed2('0x8')]=function(_0x341e0f){utils[_0x0ed2('0x8')](_0x0ed2('0x9'),_0x341e0f);};exports['close']=function(){utils[_0x0ed2('0x2')](_0x0ed2('0xa'));};exports[_0x0ed2('0xb')]=function(_0xe9cbb0){}; \ No newline at end of file +var _0x0dd9=['./utils','connect','shutdown','info','[core]\x20shutdown','error','[core]\x20error','close','[core]\x20close','managerevent'];(function(_0x441933,_0x1bf8e2){var _0xb7e63=function(_0x1b0ae2){while(--_0x1b0ae2){_0x441933['push'](_0x441933['shift']());}};_0xb7e63(++_0x1bf8e2);}(_0x0dd9,0x78));var _0x90dd=function(_0x1eedee,_0x415620){_0x1eedee=_0x1eedee-0x0;var _0x7c8be0=_0x0dd9[_0x1eedee];return _0x7c8be0;};'use strict';var utils=require(_0x90dd('0x0'));exports[_0x90dd('0x1')]=function(){utils['info']('[core]\x20connected');};exports[_0x90dd('0x2')]=function(){utils[_0x90dd('0x3')](_0x90dd('0x4'));};exports['fullybooted']=function(){utils[_0x90dd('0x3')]('[core]\x20fullybooted');};exports[_0x90dd('0x5')]=function(_0x452506){utils[_0x90dd('0x5')](_0x90dd('0x6'),_0x452506);};exports[_0x90dd('0x7')]=function(){utils['info'](_0x90dd('0x8'));};exports[_0x90dd('0x9')]=function(_0x423bc9){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 2b25a1e..2fd3614 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 _0x88d8=['error','[%s][dials][newexten]','varset','debug','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','assign','starttime','now','lastevent','[%s][dials][dialend]','dialstatus','ANSWER','connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','billableseconds','endtime','lodash','util','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','split'];(function(_0x5364c7,_0x9b8e1d){var _0x4fba7d=function(_0x2d2802){while(--_0x2d2802){_0x5364c7['push'](_0x5364c7['shift']());}};_0x4fba7d(++_0x9b8e1d);}(_0x88d8,0x107));var _0x888d=function(_0x2de508,_0x4c3681){_0x2de508=_0x2de508-0x0;var _0xcc5f46=_0x88d8[_0x2de508];return _0xcc5f46;};'use strict';var _=require(_0x888d('0x0'));var util=require(_0x888d('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x2a9713){utils['info'](util[_0x888d('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2a9713[_0x888d('0x3')],_0x2a9713[_0x888d('0x4')],_0x2a9713[_0x888d('0x5')],_0x2a9713[_0x888d('0x6')],_0x2a9713[_0x888d('0x7')],_0x2a9713['dialstatus']));utils[_0x888d('0x8')](_0x888d('0x9'),_0x2a9713);delete dials[_0x2a9713[_0x888d('0x3')]];}exports[_0x888d('0xa')]=function(_0x454868){try{utils['debug'](util[_0x888d('0x2')]('[%s][dials][newexten]',_0x454868[_0x888d('0x3')]),_0x454868);utils[_0x888d('0xb')](util[_0x888d('0x2')](_0x888d('0xc'),_0x454868[_0x888d('0x3')],_0x454868[_0x888d('0xd')],_0x454868[_0x888d('0xe')]));if(_0x454868[_0x888d('0xd')][_0x888d('0xf')]()==_0x888d('0x10')&&_['startsWith'](_0x454868[_0x888d('0xe')][_0x888d('0xf')](),_0x888d('0x11'))){var _0xd438c0=_0x454868['appdata'][_0x888d('0x12')]('=');dials[_0x454868[_0x888d('0x3')]]={'routeId':_0xd438c0[0x1]};}}catch(_0x1f015a){utils[_0x888d('0x13')](util['format'](_0x888d('0x14'),_0x454868[_0x888d('0x3')]),_0x1f015a);}};exports[_0x888d('0x15')]=function(_0x2846ad){try{utils[_0x888d('0x16')](util[_0x888d('0x2')](_0x888d('0x17'),_0x2846ad[_0x888d('0x3')]),_0x2846ad);if(!_['isNil'](_0x2846ad[_0x888d('0x18')][_0x888d('0x19')])){utils[_0x888d('0xb')](util['format'](_0x888d('0x1a'),_0x2846ad['uniqueid'],_0x2846ad[_0x888d('0x1b')]));dials[_0x2846ad[_0x888d('0x3')]]={'routeId':_0x2846ad[_0x888d('0x1b')]};}}catch(_0x3e86fd){utils[_0x888d('0x13')](util[_0x888d('0x2')](_0x888d('0x17'),_0x2846ad['uniqueid']),_0x3e86fd);}};exports['dialbegin']=function(_0x3a1d28){try{if(!_[_0x888d('0x1c')](dials[_0x3a1d28['uniqueid']])){utils[_0x888d('0x16')](util[_0x888d('0x2')]('[%s][dials][dialbegin]',_0x3a1d28['uniqueid']),_0x3a1d28);dials[_0x3a1d28[_0x888d('0x3')]]=_[_0x888d('0x1d')](dials[_0x3a1d28[_0x888d('0x3')]],_0x3a1d28);dials[_0x3a1d28[_0x888d('0x3')]][_0x888d('0x1e')]=utils[_0x888d('0x1f')]();dials[_0x3a1d28['uniqueid']][_0x888d('0x20')]='called';utils[_0x888d('0xb')](util[_0x888d('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x3a1d28[_0x888d('0x3')],dials[_0x3a1d28[_0x888d('0x3')]][_0x888d('0x1e')]));}}catch(_0x3b0781){utils[_0x888d('0x13')](util[_0x888d('0x2')]('[%s][dials][dialbegin]',_0x3a1d28['uniqueid']),_0x3b0781);}};exports['dialend']=function(_0x1ca3b2){try{if(!_[_0x888d('0x1c')](dials[_0x1ca3b2[_0x888d('0x3')]])){utils[_0x888d('0x16')](util[_0x888d('0x2')](_0x888d('0x21'),_0x1ca3b2[_0x888d('0x3')]),_0x1ca3b2);dials[_0x1ca3b2[_0x888d('0x3')]][_0x888d('0x22')]=_0x1ca3b2['dialstatus'];if(_0x1ca3b2['dialstatus']==_0x888d('0x23')){dials[_0x1ca3b2[_0x888d('0x3')]]=_['assign'](dials[_0x1ca3b2[_0x888d('0x3')]],_0x1ca3b2);dials[_0x1ca3b2[_0x888d('0x3')]]['answertime']=utils['now']();dials[_0x1ca3b2[_0x888d('0x3')]][_0x888d('0x20')]=_0x888d('0x24');utils['info'](util[_0x888d('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x1ca3b2[_0x888d('0x3')],_0x1ca3b2[_0x888d('0x22')],dials[_0x1ca3b2[_0x888d('0x3')]][_0x888d('0x25')]));}else{utils['info'](util[_0x888d('0x2')](_0x888d('0x26'),_0x1ca3b2[_0x888d('0x3')],_0x1ca3b2[_0x888d('0x22')]));}}}catch(_0x3a2d43){utils[_0x888d('0x13')](util['format']('[%s][dials][dialend]',_0x1ca3b2[_0x888d('0x3')]),_0x3a2d43);}};exports['hangup']=function(_0x431499){try{if(!_[_0x888d('0x1c')](dials[_0x431499[_0x888d('0x3')]])){utils[_0x888d('0x16')](util[_0x888d('0x2')](_0x888d('0x27'),_0x431499[_0x888d('0x3')]),_0x431499);utils[_0x888d('0xb')](util[_0x888d('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x431499[_0x888d('0x3')],_0x431499[_0x888d('0x6')],_0x431499[_0x888d('0x28')],_0x431499[_0x888d('0x29')]));dials[_0x431499[_0x888d('0x3')]]=_[_0x888d('0x1d')](dials[_0x431499[_0x888d('0x3')]],{'endtime':utils['now'](),'lastevent':_0x888d('0x2a')});dials[_0x431499[_0x888d('0x3')]][_0x888d('0x2b')]=utils[_0x888d('0x2c')](dials[_0x431499['uniqueid']]['endtime'],dials[_0x431499['uniqueid']][_0x888d('0x1e')]);dials[_0x431499[_0x888d('0x3')]]['holdtime']=utils[_0x888d('0x2c')](dials[_0x431499['uniqueid']][_0x888d('0x25')]||dials[_0x431499[_0x888d('0x3')]]['endtime'],dials[_0x431499[_0x888d('0x3')]][_0x888d('0x1e')]);dials[_0x431499[_0x888d('0x3')]][_0x888d('0x2d')]=dials[_0x431499['uniqueid']]['answertime']?utils[_0x888d('0x2c')](dials[_0x431499[_0x888d('0x3')]][_0x888d('0x2e')],dials[_0x431499[_0x888d('0x3')]][_0x888d('0x25')]):0x0;writeDB(dials[_0x431499[_0x888d('0x3')]]);}}catch(_0x2cbde3){utils[_0x888d('0x13')](util[_0x888d('0x2')](_0x888d('0x27'),_0x431499[_0x888d('0x3')]),_0x2cbde3);}}; \ No newline at end of file +var _0x55fc=['calleridname','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s'];(function(_0x5bbb86,_0x31386a){var _0x41f61d=function(_0x4a29d4){while(--_0x4a29d4){_0x5bbb86['push'](_0x5bbb86['shift']());}};_0x41f61d(++_0x31386a);}(_0x55fc,0x1c8));var _0xc55f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x55fc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc55f('0x0'));var util=require(_0xc55f('0x1'));var utils=require(_0xc55f('0x2'));var dials={};function writeDB(_0x3698de){utils[_0xc55f('0x3')](util['format'](_0xc55f('0x4'),_0x3698de[_0xc55f('0x5')],_0x3698de[_0xc55f('0x6')],_0x3698de['dialstring'],_0x3698de[_0xc55f('0x7')],_0x3698de['connectedlinenum'],_0x3698de[_0xc55f('0x8')]));utils[_0xc55f('0x9')](_0xc55f('0xa'),_0x3698de);delete dials[_0x3698de[_0xc55f('0x5')]];}exports['newexten']=function(_0x44d2d3){try{utils[_0xc55f('0xb')](util['format'](_0xc55f('0xc'),_0x44d2d3['uniqueid']),_0x44d2d3);utils['info'](util[_0xc55f('0xd')](_0xc55f('0xe'),_0x44d2d3[_0xc55f('0x5')],_0x44d2d3[_0xc55f('0xf')],_0x44d2d3[_0xc55f('0x10')]));if(_0x44d2d3['application'][_0xc55f('0x11')]()==_0xc55f('0x12')&&_[_0xc55f('0x13')](_0x44d2d3[_0xc55f('0x10')]['toLowerCase'](),'cdr(routeid)')){var _0x5052fe=_0x44d2d3[_0xc55f('0x10')][_0xc55f('0x14')]('=');dials[_0x44d2d3[_0xc55f('0x5')]]={'routeId':_0x5052fe[0x1]};}}catch(_0x1bc810){utils[_0xc55f('0x15')](util[_0xc55f('0xd')](_0xc55f('0xc'),_0x44d2d3['uniqueid']),_0x1bc810);}};exports[_0xc55f('0x16')]=function(_0x39a414){try{utils[_0xc55f('0xb')](util[_0xc55f('0xd')](_0xc55f('0x17'),_0x39a414[_0xc55f('0x5')]),_0x39a414);if(!_[_0xc55f('0x18')](_0x39a414[_0xc55f('0x19')][_0xc55f('0x1a')])){utils[_0xc55f('0x3')](util[_0xc55f('0xd')](_0xc55f('0x1b'),_0x39a414[_0xc55f('0x5')],_0x39a414[_0xc55f('0x1c')]));dials[_0x39a414[_0xc55f('0x5')]]={'routeId':_0x39a414[_0xc55f('0x1c')]};}}catch(_0x32af79){utils[_0xc55f('0x15')](util[_0xc55f('0xd')](_0xc55f('0x17'),_0x39a414['uniqueid']),_0x32af79);}};exports[_0xc55f('0x1d')]=function(_0x14de25){try{if(!_[_0xc55f('0x18')](dials[_0x14de25[_0xc55f('0x5')]])){utils['debug'](util[_0xc55f('0xd')]('[%s][dials][dialbegin]',_0x14de25[_0xc55f('0x5')]),_0x14de25);dials[_0x14de25[_0xc55f('0x5')]]=_[_0xc55f('0x1e')](dials[_0x14de25[_0xc55f('0x5')]],_0x14de25);dials[_0x14de25[_0xc55f('0x5')]][_0xc55f('0x1f')]=utils[_0xc55f('0x20')]();dials[_0x14de25[_0xc55f('0x5')]][_0xc55f('0x21')]=_0xc55f('0x22');utils['info'](util['format'](_0xc55f('0x23'),_0x14de25['uniqueid'],dials[_0x14de25[_0xc55f('0x5')]][_0xc55f('0x1f')]));}}catch(_0x420afa){utils[_0xc55f('0x15')](util['format']('[%s][dials][dialbegin]',_0x14de25[_0xc55f('0x5')]),_0x420afa);}};exports[_0xc55f('0x24')]=function(_0x39089a){try{if(!_[_0xc55f('0x18')](dials[_0x39089a[_0xc55f('0x5')]])){utils['debug'](util[_0xc55f('0xd')](_0xc55f('0x25'),_0x39089a[_0xc55f('0x5')]),_0x39089a);dials[_0x39089a[_0xc55f('0x5')]][_0xc55f('0x8')]=_0x39089a['dialstatus'];if(_0x39089a[_0xc55f('0x8')]=='ANSWER'){dials[_0x39089a[_0xc55f('0x5')]]=_[_0xc55f('0x1e')](dials[_0x39089a['uniqueid']],_0x39089a);dials[_0x39089a['uniqueid']][_0xc55f('0x26')]=utils[_0xc55f('0x20')]();dials[_0x39089a[_0xc55f('0x5')]][_0xc55f('0x21')]=_0xc55f('0x27');utils['info'](util[_0xc55f('0xd')](_0xc55f('0x28'),_0x39089a[_0xc55f('0x5')],_0x39089a['dialstatus'],dials[_0x39089a[_0xc55f('0x5')]]['answertime']));}else{utils['info'](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x39089a['uniqueid'],_0x39089a[_0xc55f('0x8')]));}}}catch(_0x1227c6){utils['error'](util[_0xc55f('0xd')](_0xc55f('0x25'),_0x39089a[_0xc55f('0x5')]),_0x1227c6);}};exports[_0xc55f('0x29')]=function(_0x3d55e4){try{if(!_[_0xc55f('0x18')](dials[_0x3d55e4[_0xc55f('0x5')]])){utils[_0xc55f('0xb')](util[_0xc55f('0xd')](_0xc55f('0x2a'),_0x3d55e4[_0xc55f('0x5')]),_0x3d55e4);utils[_0xc55f('0x3')](util[_0xc55f('0xd')](_0xc55f('0x2b'),_0x3d55e4['uniqueid'],_0x3d55e4['calleridnum'],_0x3d55e4[_0xc55f('0x2c')],_0x3d55e4['cause-txt']));dials[_0x3d55e4[_0xc55f('0x5')]]=_[_0xc55f('0x1e')](dials[_0x3d55e4[_0xc55f('0x5')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x3d55e4[_0xc55f('0x5')]][_0xc55f('0x2d')]=utils[_0xc55f('0x2e')](dials[_0x3d55e4[_0xc55f('0x5')]][_0xc55f('0x2f')],dials[_0x3d55e4['uniqueid']]['starttime']);dials[_0x3d55e4[_0xc55f('0x5')]][_0xc55f('0x30')]=utils[_0xc55f('0x2e')](dials[_0x3d55e4[_0xc55f('0x5')]]['answertime']||dials[_0x3d55e4[_0xc55f('0x5')]][_0xc55f('0x2f')],dials[_0x3d55e4['uniqueid']][_0xc55f('0x1f')]);dials[_0x3d55e4['uniqueid']][_0xc55f('0x31')]=dials[_0x3d55e4['uniqueid']][_0xc55f('0x26')]?utils[_0xc55f('0x2e')](dials[_0x3d55e4[_0xc55f('0x5')]]['endtime'],dials[_0x3d55e4[_0xc55f('0x5')]][_0xc55f('0x26')]):0x0;writeDB(dials[_0x3d55e4[_0xc55f('0x5')]]);}}catch(_0x27e9da){utils[_0xc55f('0x15')](util['format'](_0xc55f('0x2a'),_0x3d55e4[_0xc55f('0x5')]),_0x27e9da);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 63e0faa..7894e73 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 _0xdc73=['util','xdr','disabled','env','production','local','asterisk','username','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','[%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]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','[%s][index][newexten]','newexten','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils'];(function(_0x308ab7,_0x3bc8e7){var _0x39badd=function(_0x5a46b2){while(--_0x5a46b2){_0x308ab7['push'](_0x308ab7['shift']());}};_0x39badd(++_0x3bc8e7);}(_0xdc73,0x157));var _0x3dc7=function(_0x4af24a,_0x4de8e4){_0x4af24a=_0x4af24a-0x0;var _0x10ea5c=_0xdc73[_0x4af24a];return _0x10ea5c;};var AsteriskManager=require(_0x3dc7('0x0'));var config=require('../../config/environment');var utils=require(_0x3dc7('0x1'));var util=require(_0x3dc7('0x2'));var isXDREnabled=config[_0x3dc7('0x3')]&&config[_0x3dc7('0x3')]['disabled']?!config['xdr'][_0x3dc7('0x4')]:!![];var isProduction=config[_0x3dc7('0x5')]===_0x3dc7('0x6')||![];var isLocalAsterisk=config[_0x3dc7('0x3')]&&config['xdr'][_0x3dc7('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x3dc7('0x8')]['port'],config[_0x3dc7('0x8')]['ip'],config['asterisk'][_0x3dc7('0x9')],config['asterisk'][_0x3dc7('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x3dc7('0xb')](_0x3dc7('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x3dc7('0xd'));}else{var agents=require('./agents.controller');var calls=require(_0x3dc7('0xe'));var queues=require(_0x3dc7('0xf'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x3dc7('0x10'));var transfers=require(_0x3dc7('0x11'));var core=require(_0x3dc7('0x12'));ami['on'](_0x3dc7('0x13'),core['connect']);ami['on']('shutdown',core[_0x3dc7('0x14')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x3dc7('0x15'),core[_0x3dc7('0x15')]);ami['on'](_0x3dc7('0x16'),core['close']);ami['on'](_0x3dc7('0x17'),core[_0x3dc7('0x17')]);ami['on'](_0x3dc7('0x18'),function(_0x1288f7){try{utils[_0x3dc7('0x19')](util['format'](_0x3dc7('0x1a'),_0x1288f7[_0x3dc7('0x1b')]),_0x1288f7);members[_0x3dc7('0x18')](_0x1288f7);}catch(_0x46ae4a){utils['error'](util[_0x3dc7('0x1c')](_0x3dc7('0x1a'),_0x1288f7[_0x3dc7('0x1b')]),_0x46ae4a);}});ami['on']('agentcalled',function(_0x8b347b){try{utils[_0x3dc7('0x19')](util[_0x3dc7('0x1c')](_0x3dc7('0x1d'),_0x8b347b[_0x3dc7('0x1e')]),_0x8b347b);agents['agentcalled'](_0x8b347b);}catch(_0x402b5e){utils[_0x3dc7('0x15')](util['format']('[%s][index][agentcalled]',_0x8b347b[_0x3dc7('0x1e')]),_0x402b5e);}});ami['on'](_0x3dc7('0x1f'),function(_0x358944){try{utils['debug'](util['format'](_0x3dc7('0x20'),_0x358944[_0x3dc7('0x1e')]),_0x358944);agents[_0x3dc7('0x1f')](_0x358944);}catch(_0x4ecc34){utils[_0x3dc7('0x15')](util[_0x3dc7('0x1c')](_0x3dc7('0x20'),_0x358944[_0x3dc7('0x1e')]),_0x4ecc34);}});ami['on'](_0x3dc7('0x21'),function(_0x32f047){try{utils[_0x3dc7('0x19')](util[_0x3dc7('0x1c')](_0x3dc7('0x22'),_0x32f047[_0x3dc7('0x1e')]),_0x32f047);agents[_0x3dc7('0x21')](_0x32f047);queues[_0x3dc7('0x21')](_0x32f047);}catch(_0x18c7d5){utils[_0x3dc7('0x15')](util['format'](_0x3dc7('0x22'),_0x32f047[_0x3dc7('0x1e')]),_0x18c7d5);}});ami['on'](_0x3dc7('0x23'),function(_0x3a1df9){try{utils[_0x3dc7('0x19')](util['format'](_0x3dc7('0x24'),_0x3a1df9['uniqueid']),_0x3a1df9);agents[_0x3dc7('0x23')](_0x3a1df9);queues[_0x3dc7('0x23')](_0x3a1df9);members[_0x3dc7('0x23')](_0x3a1df9);}catch(_0x248504){utils['error'](util[_0x3dc7('0x1c')](_0x3dc7('0x24'),_0x3a1df9['uniqueid']),_0x248504);}});ami['on'](_0x3dc7('0x25'),function(_0x183046){try{utils[_0x3dc7('0x19')](util[_0x3dc7('0x1c')](_0x3dc7('0x26'),_0x183046[_0x3dc7('0x1e')]),_0x183046);agents[_0x3dc7('0x25')](_0x183046);queues['queuecallerabandon'](_0x183046);}catch(_0x1e6878){utils[_0x3dc7('0x15')](util['format'](_0x3dc7('0x26'),_0x183046[_0x3dc7('0x1e')]),_0x1e6878);}});ami['on']('queuecallerjoin',function(_0x6f487f){try{utils['debug'](util[_0x3dc7('0x1c')](_0x3dc7('0x27'),_0x6f487f[_0x3dc7('0x1e')]),_0x6f487f);queues['queuecallerjoin'](_0x6f487f);recordings[_0x3dc7('0x28')](_0x6f487f);}catch(_0x1d0a0c){utils[_0x3dc7('0x15')](util[_0x3dc7('0x1c')](_0x3dc7('0x27'),_0x6f487f[_0x3dc7('0x1e')]),_0x1d0a0c);}});ami['on'](_0x3dc7('0x29'),function(_0x149a2f){try{utils[_0x3dc7('0x19')](util['format'](_0x3dc7('0x2a'),_0x149a2f[_0x3dc7('0x1e')]),_0x149a2f);queues[_0x3dc7('0x29')](_0x149a2f);}catch(_0x1d68c5){utils[_0x3dc7('0x15')](util[_0x3dc7('0x1c')](_0x3dc7('0x2a'),_0x149a2f[_0x3dc7('0x1e')]),_0x1d68c5);}});ami['on'](_0x3dc7('0x2b'),function(_0x476957){try{utils[_0x3dc7('0x19')](util[_0x3dc7('0x1c')]('[%s][index][musiconholdstart]',_0x476957[_0x3dc7('0x1e')]),_0x476957);queues[_0x3dc7('0x2b')](_0x476957);calls[_0x3dc7('0x2b')](_0x476957);}catch(_0x49362c){utils[_0x3dc7('0x15')](util[_0x3dc7('0x1c')](_0x3dc7('0x2c'),_0x476957[_0x3dc7('0x1e')]),_0x49362c);}});ami['on'](_0x3dc7('0x2d'),function(_0x6c4125){try{utils[_0x3dc7('0x19')](util[_0x3dc7('0x1c')](_0x3dc7('0x2e'),_0x6c4125[_0x3dc7('0x1e')]),_0x6c4125);queues[_0x3dc7('0x2d')](_0x6c4125);calls[_0x3dc7('0x2d')](_0x6c4125);}catch(_0x788718){utils['error'](util[_0x3dc7('0x1c')](_0x3dc7('0x2e'),_0x6c4125[_0x3dc7('0x1e')]),_0x788718);}});ami['on']('newstate',function(_0x2575c9){try{utils[_0x3dc7('0x19')](util[_0x3dc7('0x1c')](_0x3dc7('0x2f'),_0x2575c9['uniqueid']),_0x2575c9);calls[_0x3dc7('0x30')](_0x2575c9);recordings[_0x3dc7('0x30')](_0x2575c9);}catch(_0x2d4bfb){utils[_0x3dc7('0x15')](util[_0x3dc7('0x1c')](_0x3dc7('0x2f'),_0x2575c9[_0x3dc7('0x1e')]),_0x2d4bfb);}});ami['on']('hangup',function(_0x5aeecb){try{utils['debug'](util[_0x3dc7('0x1c')](_0x3dc7('0x31'),_0x5aeecb[_0x3dc7('0x1e')]),_0x5aeecb);calls[_0x3dc7('0x32')](_0x5aeecb);recordings[_0x3dc7('0x32')](_0x5aeecb);dials[_0x3dc7('0x32')](_0x5aeecb);agents[_0x3dc7('0x32')](_0x5aeecb);queues['hangup'](_0x5aeecb);}catch(_0x41040f){utils[_0x3dc7('0x15')](util[_0x3dc7('0x1c')](_0x3dc7('0x31'),_0x5aeecb[_0x3dc7('0x1e')]),_0x41040f);}});ami['on'](_0x3dc7('0x33'),function(_0x563551){try{utils[_0x3dc7('0x19')](util[_0x3dc7('0x1c')](_0x3dc7('0x34'),_0x563551[_0x3dc7('0x1e')]),_0x563551);members[_0x3dc7('0x33')](_0x563551);}catch(_0x4e182c){utils[_0x3dc7('0x15')](util[_0x3dc7('0x1c')](_0x3dc7('0x34'),_0x563551[_0x3dc7('0x1e')]),_0x4e182c);}});ami['on']('blindtransfer',function(_0x82497e){try{utils[_0x3dc7('0x19')](util[_0x3dc7('0x1c')](_0x3dc7('0x35'),_0x82497e['uniqueid']),_0x82497e);queues['blindtransfer'](_0x82497e);agents['blindtransfer'](_0x82497e);transfers[_0x3dc7('0x36')](_0x82497e);recordings['blindtransfer'](_0x82497e);}catch(_0x461e13){utils['error'](util[_0x3dc7('0x1c')]('[%s][index][blindtransfer]',_0x82497e[_0x3dc7('0x1e')]),_0x461e13);}});ami['on'](_0x3dc7('0x37'),function(_0x5b36ab){try{utils['debug'](util['format']('[%s][index][attendedtransfer]',_0x5b36ab[_0x3dc7('0x38')]),_0x5b36ab);queues[_0x3dc7('0x37')](_0x5b36ab);transfers[_0x3dc7('0x37')](_0x5b36ab);agents[_0x3dc7('0x37')](_0x5b36ab);calls['attendedtransfer'](_0x5b36ab);}catch(_0x45b67d){utils['error'](util['format'](_0x3dc7('0x39'),_0x5b36ab[_0x3dc7('0x38')]),_0x45b67d);}});ami['on'](_0x3dc7('0x3a'),function(_0x2fc9f5){try{utils[_0x3dc7('0x19')](util[_0x3dc7('0x1c')](_0x3dc7('0x3b'),_0x2fc9f5['uniqueid']),_0x2fc9f5);queues[_0x3dc7('0x3a')](_0x2fc9f5);recordings['varset'](_0x2fc9f5);calls['varset'](_0x2fc9f5);dials[_0x3dc7('0x3a')](_0x2fc9f5);}catch(_0x215ac0){utils[_0x3dc7('0x15')](util['format'](_0x3dc7('0x3b'),_0x2fc9f5['uniqueid']),_0x215ac0);}});ami['on']('newexten',function(_0x88b884){try{utils['debug'](util['format'](_0x3dc7('0x3c'),_0x88b884[_0x3dc7('0x1e')]),_0x88b884);calls[_0x3dc7('0x3d')](_0x88b884);recordings[_0x3dc7('0x3d')](_0x88b884);dials['newexten'](_0x88b884);}catch(_0x53ade4){utils[_0x3dc7('0x15')](util['format']('[%s][index][newexten]',_0x88b884[_0x3dc7('0x1e')]),_0x53ade4);}});ami['on']('newchannel',function(_0x24410d){try{utils[_0x3dc7('0x19')](util[_0x3dc7('0x1c')](_0x3dc7('0x3e'),_0x24410d[_0x3dc7('0x1e')]),_0x24410d);calls[_0x3dc7('0x3f')](_0x24410d);recordings[_0x3dc7('0x3f')](_0x24410d);}catch(_0x48fc3f){utils['error'](util['format'](_0x3dc7('0x3e'),_0x24410d[_0x3dc7('0x1e')]),_0x48fc3f);}});ami['on'](_0x3dc7('0x40'),function(_0x16d0b9){try{utils[_0x3dc7('0x19')](util[_0x3dc7('0x1c')](_0x3dc7('0x41'),_0x16d0b9[_0x3dc7('0x1e')]),_0x16d0b9);dials['dialbegin'](_0x16d0b9);}catch(_0xd4ebab){utils[_0x3dc7('0x15')](util[_0x3dc7('0x1c')](_0x3dc7('0x42'),_0x16d0b9[_0x3dc7('0x1e')]),_0xd4ebab);}});ami['on'](_0x3dc7('0x43'),function(_0x546fd5){try{utils[_0x3dc7('0x19')](util[_0x3dc7('0x1c')]('[%s][index][dialend]',_0x546fd5[_0x3dc7('0x1e')]),_0x546fd5);dials['dialend'](_0x546fd5);}catch(_0x1bf781){utils['error'](util[_0x3dc7('0x1c')](_0x3dc7('0x44'),_0x546fd5[_0x3dc7('0x1e')]),_0x1bf781);}});} \ No newline at end of file +var _0x75e8=['[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','port','asterisk','username','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','format','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][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'];(function(_0x5999ba,_0x97b26a){var _0x2140b5=function(_0x23b3fb){while(--_0x23b3fb){_0x5999ba['push'](_0x5999ba['shift']());}};_0x2140b5(++_0x97b26a);}(_0x75e8,0x114));var _0x875e=function(_0x1459fe,_0x1a65eb){_0x1459fe=_0x1459fe-0x0;var _0x4aa93a=_0x75e8[_0x1459fe];return _0x4aa93a;};var AsteriskManager=require(_0x875e('0x0'));var config=require(_0x875e('0x1'));var utils=require('./utils');var util=require(_0x875e('0x2'));var isXDREnabled=config['xdr']&&config[_0x875e('0x3')][_0x875e('0x4')]?!config[_0x875e('0x3')][_0x875e('0x4')]:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config[_0x875e('0x3')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x875e('0x5')],config[_0x875e('0x6')]['ip'],config[_0x875e('0x6')][_0x875e('0x7')],config['asterisk']['password'],!![]);ami[_0x875e('0x8')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x875e('0x9')](_0x875e('0xa'));}else{var agents=require('./agents.controller');var calls=require(_0x875e('0xb'));var queues=require(_0x875e('0xc'));var recordings=require(_0x875e('0xd'));var members=require(_0x875e('0xe'));var dials=require(_0x875e('0xf'));var transfers=require(_0x875e('0x10'));var core=require('./core.controller');ami['on'](_0x875e('0x11'),core[_0x875e('0x11')]);ami['on'](_0x875e('0x12'),core[_0x875e('0x12')]);ami['on'](_0x875e('0x13'),core[_0x875e('0x13')]);ami['on'](_0x875e('0x14'),core[_0x875e('0x14')]);ami['on'](_0x875e('0x15'),core[_0x875e('0x15')]);ami['on'](_0x875e('0x16'),core[_0x875e('0x16')]);ami['on']('devicestatechange',function(_0x57d6d3){try{utils['debug'](util[_0x875e('0x17')]('[%s][index][devicestatechange]',_0x57d6d3['device']),_0x57d6d3);members[_0x875e('0x18')](_0x57d6d3);}catch(_0x4a17eb){utils[_0x875e('0x14')](util[_0x875e('0x17')](_0x875e('0x19'),_0x57d6d3[_0x875e('0x1a')]),_0x4a17eb);}});ami['on'](_0x875e('0x1b'),function(_0x1c5f26){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')](_0x875e('0x1d'),_0x1c5f26[_0x875e('0x1e')]),_0x1c5f26);agents[_0x875e('0x1b')](_0x1c5f26);}catch(_0x5fee88){utils['error'](util['format'](_0x875e('0x1d'),_0x1c5f26['uniqueid']),_0x5fee88);}});ami['on']('agentringnoanswer',function(_0xc087ac){try{utils['debug'](util[_0x875e('0x17')](_0x875e('0x1f'),_0xc087ac[_0x875e('0x1e')]),_0xc087ac);agents['agentringnoanswer'](_0xc087ac);}catch(_0x17a8c0){utils['error'](util[_0x875e('0x17')](_0x875e('0x1f'),_0xc087ac[_0x875e('0x1e')]),_0x17a8c0);}});ami['on']('agentconnect',function(_0x403509){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')](_0x875e('0x20'),_0x403509['uniqueid']),_0x403509);agents[_0x875e('0x21')](_0x403509);queues[_0x875e('0x21')](_0x403509);}catch(_0x19b385){utils[_0x875e('0x14')](util[_0x875e('0x17')]('[%s][index][agentconnect]',_0x403509['uniqueid']),_0x19b385);}});ami['on'](_0x875e('0x22'),function(_0x543580){try{utils['debug'](util[_0x875e('0x17')](_0x875e('0x23'),_0x543580['uniqueid']),_0x543580);agents[_0x875e('0x22')](_0x543580);queues[_0x875e('0x22')](_0x543580);members[_0x875e('0x22')](_0x543580);}catch(_0x2e4884){utils[_0x875e('0x14')](util[_0x875e('0x17')](_0x875e('0x23'),_0x543580[_0x875e('0x1e')]),_0x2e4884);}});ami['on'](_0x875e('0x24'),function(_0x19dab8){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')]('[%s][index][queuecallerabandon]',_0x19dab8[_0x875e('0x1e')]),_0x19dab8);agents[_0x875e('0x24')](_0x19dab8);queues[_0x875e('0x24')](_0x19dab8);}catch(_0x3dd844){utils[_0x875e('0x14')](util[_0x875e('0x17')](_0x875e('0x25'),_0x19dab8[_0x875e('0x1e')]),_0x3dd844);}});ami['on'](_0x875e('0x26'),function(_0x19a92c){try{utils['debug'](util[_0x875e('0x17')](_0x875e('0x27'),_0x19a92c['uniqueid']),_0x19a92c);queues[_0x875e('0x26')](_0x19a92c);recordings[_0x875e('0x26')](_0x19a92c);}catch(_0x318aac){utils[_0x875e('0x14')](util[_0x875e('0x17')](_0x875e('0x27'),_0x19a92c[_0x875e('0x1e')]),_0x318aac);}});ami['on']('queuecallerleave',function(_0x2cd844){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')](_0x875e('0x28'),_0x2cd844[_0x875e('0x1e')]),_0x2cd844);queues[_0x875e('0x29')](_0x2cd844);}catch(_0x35863e){utils['error'](util[_0x875e('0x17')]('[%s][index][queuecallerleave]',_0x2cd844['uniqueid']),_0x35863e);}});ami['on'](_0x875e('0x2a'),function(_0x29e2f9){try{utils['debug'](util[_0x875e('0x17')](_0x875e('0x2b'),_0x29e2f9[_0x875e('0x1e')]),_0x29e2f9);queues[_0x875e('0x2a')](_0x29e2f9);calls['musiconholdstart'](_0x29e2f9);}catch(_0x1ba063){utils[_0x875e('0x14')](util['format'](_0x875e('0x2b'),_0x29e2f9[_0x875e('0x1e')]),_0x1ba063);}});ami['on'](_0x875e('0x2c'),function(_0x281aeb){try{utils[_0x875e('0x1c')](util['format'](_0x875e('0x2d'),_0x281aeb[_0x875e('0x1e')]),_0x281aeb);queues[_0x875e('0x2c')](_0x281aeb);calls['musiconholdstop'](_0x281aeb);}catch(_0x4b513b){utils[_0x875e('0x14')](util['format'](_0x875e('0x2d'),_0x281aeb[_0x875e('0x1e')]),_0x4b513b);}});ami['on'](_0x875e('0x2e'),function(_0x220f8f){try{utils[_0x875e('0x1c')](util['format'](_0x875e('0x2f'),_0x220f8f[_0x875e('0x1e')]),_0x220f8f);calls[_0x875e('0x2e')](_0x220f8f);recordings[_0x875e('0x2e')](_0x220f8f);}catch(_0x287acc){utils[_0x875e('0x14')](util[_0x875e('0x17')](_0x875e('0x2f'),_0x220f8f[_0x875e('0x1e')]),_0x287acc);}});ami['on'](_0x875e('0x30'),function(_0x2c96f9){try{utils['debug'](util['format'](_0x875e('0x31'),_0x2c96f9[_0x875e('0x1e')]),_0x2c96f9);calls[_0x875e('0x30')](_0x2c96f9);recordings[_0x875e('0x30')](_0x2c96f9);dials['hangup'](_0x2c96f9);agents[_0x875e('0x30')](_0x2c96f9);queues['hangup'](_0x2c96f9);}catch(_0x16a112){utils[_0x875e('0x14')](util['format']('[%s][index][hangup]',_0x2c96f9[_0x875e('0x1e')]),_0x16a112);}});ami['on'](_0x875e('0x32'),function(_0x28b36d){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')](_0x875e('0x33'),_0x28b36d['uniqueid']),_0x28b36d);members[_0x875e('0x32')](_0x28b36d);}catch(_0x2a27d5){utils['error'](util[_0x875e('0x17')](_0x875e('0x33'),_0x28b36d[_0x875e('0x1e')]),_0x2a27d5);}});ami['on'](_0x875e('0x34'),function(_0x3ad47d){try{utils[_0x875e('0x1c')](util['format'](_0x875e('0x35'),_0x3ad47d['uniqueid']),_0x3ad47d);queues[_0x875e('0x34')](_0x3ad47d);agents['blindtransfer'](_0x3ad47d);transfers['blindtransfer'](_0x3ad47d);recordings[_0x875e('0x34')](_0x3ad47d);}catch(_0x23fecc){utils[_0x875e('0x14')](util[_0x875e('0x17')](_0x875e('0x35'),_0x3ad47d['uniqueid']),_0x23fecc);}});ami['on'](_0x875e('0x36'),function(_0x521fbe){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')](_0x875e('0x37'),_0x521fbe[_0x875e('0x38')]),_0x521fbe);queues['attendedtransfer'](_0x521fbe);transfers['attendedtransfer'](_0x521fbe);agents[_0x875e('0x36')](_0x521fbe);calls[_0x875e('0x36')](_0x521fbe);}catch(_0x26bd3a){utils[_0x875e('0x14')](util[_0x875e('0x17')]('[%s][index][attendedtransfer]',_0x521fbe[_0x875e('0x38')]),_0x26bd3a);}});ami['on']('varset',function(_0x5082c4){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')](_0x875e('0x39'),_0x5082c4['uniqueid']),_0x5082c4);queues[_0x875e('0x3a')](_0x5082c4);recordings[_0x875e('0x3a')](_0x5082c4);calls['varset'](_0x5082c4);dials[_0x875e('0x3a')](_0x5082c4);}catch(_0x358acf){utils['error'](util[_0x875e('0x17')](_0x875e('0x39'),_0x5082c4[_0x875e('0x1e')]),_0x358acf);}});ami['on'](_0x875e('0x3b'),function(_0x85a307){try{utils['debug'](util['format'](_0x875e('0x3c'),_0x85a307[_0x875e('0x1e')]),_0x85a307);calls[_0x875e('0x3b')](_0x85a307);recordings[_0x875e('0x3b')](_0x85a307);dials['newexten'](_0x85a307);}catch(_0x4eefe1){utils[_0x875e('0x14')](util[_0x875e('0x17')]('[%s][index][newexten]',_0x85a307['uniqueid']),_0x4eefe1);}});ami['on'](_0x875e('0x3d'),function(_0x2a41f4){try{utils[_0x875e('0x1c')](util['format'](_0x875e('0x3e'),_0x2a41f4[_0x875e('0x1e')]),_0x2a41f4);calls[_0x875e('0x3d')](_0x2a41f4);recordings[_0x875e('0x3d')](_0x2a41f4);}catch(_0x142b6d){utils['error'](util['format']('[%s][index][newchannel]',_0x2a41f4[_0x875e('0x1e')]),_0x142b6d);}});ami['on'](_0x875e('0x3f'),function(_0x1b248a){try{utils[_0x875e('0x1c')](util[_0x875e('0x17')](_0x875e('0x40'),_0x1b248a[_0x875e('0x1e')]),_0x1b248a);dials['dialbegin'](_0x1b248a);}catch(_0x35534e){utils[_0x875e('0x14')](util[_0x875e('0x17')](_0x875e('0x41'),_0x1b248a[_0x875e('0x1e')]),_0x35534e);}});ami['on'](_0x875e('0x42'),function(_0x1af449){try{utils['debug'](util[_0x875e('0x17')](_0x875e('0x43'),_0x1af449[_0x875e('0x1e')]),_0x1af449);dials['dialend'](_0x1af449);}catch(_0x34b71a){utils[_0x875e('0x14')](util['format'](_0x875e('0x43'),_0x1af449['uniqueid']),_0x34b71a);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 4db5991..27fb2fd 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 _0xa2cf=['some','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','now','agent','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data1','data2','data3','destination','destinationchannel','lodash','util','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','then','name','internal','CreateMemberReport','split','catch','error','[%s][members][writeDB]'];(function(_0x526302,_0x450200){var _0xd505be=function(_0x164870){while(--_0x164870){_0x526302['push'](_0x526302['shift']());}};_0xd505be(++_0x450200);}(_0xa2cf,0x15c));var _0xfa2c=function(_0x149a2a,_0x55fac4){_0x149a2a=_0x149a2a-0x0;var _0x2c7399=_0xa2cf[_0x149a2a];return _0x2c7399;};'use strict';var _=require(_0xfa2c('0x0'));var util=require(_0xfa2c('0x1'));var utils=require(_0xfa2c('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xfa2c('0x3')];function writeDB(_0x176cbb){utils[_0xfa2c('0x4')](util[_0xfa2c('0x5')](_0xfa2c('0x6'),_0x176cbb[_0xfa2c('0x7')],_0x176cbb[_0xfa2c('0x8')],_0x176cbb[_0xfa2c('0x9')],_0x176cbb['data2'],_0x176cbb[_0xfa2c('0xa')],_0x176cbb[_0xfa2c('0xb')]));if(_0x176cbb['interface']){utils['getUserByInterface'](_0x176cbb[_0xfa2c('0x8')])[_0xfa2c('0xc')](function(_0x24fb2a){if(_0x24fb2a){_0x176cbb[_0xfa2c('0xa')]=_0x24fb2a[_0xfa2c('0xd')];_0x176cbb['internal']=_0x24fb2a[_0xfa2c('0xe')];utils['request'](_0xfa2c('0xf'),_0x176cbb);}else{utils['getUserByName'](_0x176cbb[_0xfa2c('0x8')][_0xfa2c('0x10')]('/')[0x1])[_0xfa2c('0xc')](function(_0x7c62f){if(_0x7c62f){_0x176cbb[_0xfa2c('0xa')]=_0x7c62f['name'];_0x176cbb['internal']=_0x7c62f[_0xfa2c('0xe')];utils['request'](_0xfa2c('0xf'),_0x176cbb);}});}})[_0xfa2c('0x11')](function(_0x105582){utils[_0xfa2c('0x12')](util[_0xfa2c('0x5')](_0xfa2c('0x13'),_0x176cbb[_0xfa2c('0x7')]),_0x105582);});}delete members[_0x176cbb[_0xfa2c('0x8')]];}function startsWith(_0x5218de,_0x443fdd){return _[_0xfa2c('0x14')](_0x5218de,function(_0x15e119){return _[_0xfa2c('0x15')](_0x443fdd,_0x15e119);});}exports['devicestatechange']=function(_0x267a96){try{utils[_0xfa2c('0x16')](util['format']('[%s][members][devicestatechange]',members[_0x267a96[_0xfa2c('0x17')]]?members[_0x267a96[_0xfa2c('0x17')]][_0xfa2c('0x7')]:_0x267a96[_0xfa2c('0x17')]),_0x267a96);utils[_0xfa2c('0x4')](util[_0xfa2c('0x5')](_0xfa2c('0x18'),members[_0x267a96['device']]?members[_0x267a96[_0xfa2c('0x17')]][_0xfa2c('0x7')]:_0x267a96[_0xfa2c('0x17')],_0x267a96[_0xfa2c('0x19')],_0x267a96['device']));switch(_0x267a96[_0xfa2c('0x19')]){case _0xfa2c('0x1a'):case _0xfa2c('0x1b'):if(!startsWith(exclude,_0x267a96[_0xfa2c('0x17')])){members[_0x267a96[_0xfa2c('0x17')]]={'channel':'voice','interface':_0x267a96[_0xfa2c('0x17')],'type':'TALKING','enterAt':utils[_0xfa2c('0x1c')](),'role':_0xfa2c('0x1d')};}break;case'NOT_INUSE':if(!_[_0xfa2c('0x1e')](members[_0x267a96[_0xfa2c('0x17')]])){members[_0x267a96[_0xfa2c('0x17')]][_0xfa2c('0x1f')]=utils[_0xfa2c('0x1c')]();members[_0x267a96[_0xfa2c('0x17')]][_0xfa2c('0x20')]=utils[_0xfa2c('0x21')](members[_0x267a96['device']][_0xfa2c('0x1f')],members[_0x267a96[_0xfa2c('0x17')]][_0xfa2c('0x22')]);if(members[_0x267a96[_0xfa2c('0x17')]][_0xfa2c('0x7')]){writeDB(members[_0x267a96['device']]);}}break;default:break;}}catch(_0x991e14){utils['error'](util[_0xfa2c('0x5')](_0xfa2c('0x23'),members[_0x267a96[_0xfa2c('0x17')]]?members[_0x267a96[_0xfa2c('0x17')]][_0xfa2c('0x7')]:_0x267a96[_0xfa2c('0x17')]),_0x991e14);}};exports['agentcomplete']=function(_0x218acc){try{if(!_[_0xfa2c('0x1e')](members[_0x218acc[_0xfa2c('0x8')]])){utils['debug'](util[_0xfa2c('0x5')]('[%s][members][agentcomplete]',_0x218acc[_0xfa2c('0x7')]),_0x218acc);utils[_0xfa2c('0x4')](util[_0xfa2c('0x5')](_0xfa2c('0x24'),_0x218acc['uniqueid'],_0x218acc['interface'],_0x218acc['queue']));members[_0x218acc['interface']]=_[_0xfa2c('0x25')](members[_0x218acc[_0xfa2c('0x8')]],{'data4':_0x218acc[_0xfa2c('0x26')],'uniqueid':_0x218acc[_0xfa2c('0x7')]});}}catch(_0x1a6372){utils[_0xfa2c('0x12')](util['format']('[%s][members][agentcomplete]',_0x218acc[_0xfa2c('0x7')]),_0x1a6372);}};exports[_0xfa2c('0x27')]=function(_0x25cf02){try{utils['debug'](util[_0xfa2c('0x5')](_0xfa2c('0x28'),_0x25cf02[_0xfa2c('0x7')]),_0x25cf02);if(_0x25cf02[_0xfa2c('0x9')]){var _0x33ff49=_0x25cf02[_0xfa2c('0x9')]['split']('-')[0x0];if(!_['isNil'](members[_0x33ff49])){members[_0x33ff49]=_[_0xfa2c('0x25')](members[_0x33ff49],{'data1':members[_0x33ff49][_0xfa2c('0x29')]||_0x25cf02['type'],'data2':members[_0x33ff49][_0xfa2c('0x2a')]||_0x25cf02['source'],'data3':members[_0x33ff49][_0xfa2c('0x2b')]||_0x25cf02[_0xfa2c('0x2c')],'uniqueid':members[_0x33ff49]['uniqueid']||_0x25cf02['uniqueid']});utils[_0xfa2c('0x4')](util[_0xfa2c('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x25cf02[_0xfa2c('0x7')],members[_0x33ff49][_0xfa2c('0x29')],members[_0x33ff49]['data2'],members[_0x33ff49]['data3']));if(members[_0x33ff49][_0xfa2c('0x1f')]){writeDB(members[_0x33ff49]);}}}if(_0x25cf02[_0xfa2c('0x2d')]){var _0x418dd8=_0x25cf02[_0xfa2c('0x2d')][_0xfa2c('0x10')]('-')[0x0];if(!_[_0xfa2c('0x1e')](members[_0x418dd8])){members[_0x418dd8]=_[_0xfa2c('0x25')](members[_0x418dd8],{'data1':members[_0x418dd8][_0xfa2c('0x29')]||_0x25cf02[_0xfa2c('0xb')],'data2':members[_0x418dd8][_0xfa2c('0x2a')]||_0x25cf02['source'],'data3':members[_0x418dd8][_0xfa2c('0x2b')]||_0x25cf02[_0xfa2c('0x2c')],'uniqueid':members[_0x418dd8][_0xfa2c('0x7')]||_0x25cf02[_0xfa2c('0x7')]});utils[_0xfa2c('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x25cf02['uniqueid'],members[_0x418dd8][_0xfa2c('0x29')],members[_0x418dd8][_0xfa2c('0x2a')],members[_0x418dd8][_0xfa2c('0x2b')]));if(members[_0x418dd8][_0xfa2c('0x1f')]){writeDB(members[_0x418dd8]);}}}}catch(_0x33dd5d){utils[_0xfa2c('0x12')](util[_0xfa2c('0x5')](_0xfa2c('0x28'),_0x25cf02[_0xfa2c('0x7')]),_0x33dd5d);}}; \ No newline at end of file +var _0x5c54=['enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','channel','data1','source','destination','data3','assign','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','[%s][members][cdr]','lodash','util','./utils','info','format','uniqueid','interface','data2','membername','type','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0x5c54,0x71));var _0x45c5=function(_0x2c660e,_0x25702c){_0x2c660e=_0x2c660e-0x0;var _0x5eeb77=_0x5c54[_0x2c660e];return _0x5eeb77;};'use strict';var _=require(_0x45c5('0x0'));var util=require(_0x45c5('0x1'));var utils=require(_0x45c5('0x2'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x404886){utils[_0x45c5('0x3')](util[_0x45c5('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x404886[_0x45c5('0x5')],_0x404886[_0x45c5('0x6')],_0x404886['channel'],_0x404886[_0x45c5('0x7')],_0x404886[_0x45c5('0x8')],_0x404886[_0x45c5('0x9')]));if(_0x404886['interface']){utils['getUserByInterface'](_0x404886[_0x45c5('0x6')])[_0x45c5('0xa')](function(_0x41b3a4){if(_0x41b3a4){_0x404886[_0x45c5('0x8')]=_0x41b3a4[_0x45c5('0xb')];_0x404886[_0x45c5('0xc')]=_0x41b3a4[_0x45c5('0xc')];utils[_0x45c5('0xd')](_0x45c5('0xe'),_0x404886);}else{utils[_0x45c5('0xf')](_0x404886[_0x45c5('0x6')][_0x45c5('0x10')]('/')[0x1])[_0x45c5('0xa')](function(_0x329044){if(_0x329044){_0x404886[_0x45c5('0x8')]=_0x329044['name'];_0x404886[_0x45c5('0xc')]=_0x329044[_0x45c5('0xc')];utils[_0x45c5('0xd')](_0x45c5('0xe'),_0x404886);}});}})[_0x45c5('0x11')](function(_0x2854a8){utils[_0x45c5('0x12')](util[_0x45c5('0x4')](_0x45c5('0x13'),_0x404886[_0x45c5('0x5')]),_0x2854a8);});}delete members[_0x404886[_0x45c5('0x6')]];}function startsWith(_0x1945de,_0x1e09ff){return _[_0x45c5('0x14')](_0x1945de,function(_0x4605fb){return _['startsWith'](_0x1e09ff,_0x4605fb);});}exports['devicestatechange']=function(_0x4b7b1a){try{utils[_0x45c5('0x15')](util['format'](_0x45c5('0x16'),members[_0x4b7b1a[_0x45c5('0x17')]]?members[_0x4b7b1a[_0x45c5('0x17')]][_0x45c5('0x5')]:_0x4b7b1a[_0x45c5('0x17')]),_0x4b7b1a);utils[_0x45c5('0x3')](util[_0x45c5('0x4')](_0x45c5('0x18'),members[_0x4b7b1a[_0x45c5('0x17')]]?members[_0x4b7b1a['device']][_0x45c5('0x5')]:_0x4b7b1a['device'],_0x4b7b1a[_0x45c5('0x19')],_0x4b7b1a[_0x45c5('0x17')]));switch(_0x4b7b1a[_0x45c5('0x19')]){case _0x45c5('0x1a'):case _0x45c5('0x1b'):if(!startsWith(exclude,_0x4b7b1a['device'])){members[_0x4b7b1a[_0x45c5('0x17')]]={'channel':_0x45c5('0x1c'),'interface':_0x4b7b1a['device'],'type':_0x45c5('0x1d'),'enterAt':utils[_0x45c5('0x1e')](),'role':_0x45c5('0x1f')};}break;case _0x45c5('0x20'):if(!_[_0x45c5('0x21')](members[_0x4b7b1a[_0x45c5('0x17')]])){members[_0x4b7b1a['device']][_0x45c5('0x22')]=utils[_0x45c5('0x1e')]();members[_0x4b7b1a[_0x45c5('0x17')]][_0x45c5('0x23')]=utils[_0x45c5('0x24')](members[_0x4b7b1a[_0x45c5('0x17')]][_0x45c5('0x22')],members[_0x4b7b1a[_0x45c5('0x17')]][_0x45c5('0x25')]);if(members[_0x4b7b1a[_0x45c5('0x17')]]['uniqueid']){writeDB(members[_0x4b7b1a['device']]);}}break;default:break;}}catch(_0x249478){utils[_0x45c5('0x12')](util[_0x45c5('0x4')](_0x45c5('0x16'),members[_0x4b7b1a[_0x45c5('0x17')]]?members[_0x4b7b1a[_0x45c5('0x17')]][_0x45c5('0x5')]:_0x4b7b1a[_0x45c5('0x17')]),_0x249478);}};exports[_0x45c5('0x26')]=function(_0x175917){try{if(!_[_0x45c5('0x21')](members[_0x175917[_0x45c5('0x6')]])){utils[_0x45c5('0x15')](util[_0x45c5('0x4')]('[%s][members][agentcomplete]',_0x175917['uniqueid']),_0x175917);utils[_0x45c5('0x3')](util[_0x45c5('0x4')](_0x45c5('0x27'),_0x175917[_0x45c5('0x5')],_0x175917[_0x45c5('0x6')],_0x175917['queue']));members[_0x175917['interface']]=_['assign'](members[_0x175917['interface']],{'data4':_0x175917[_0x45c5('0x28')],'uniqueid':_0x175917['uniqueid']});}}catch(_0x5b8b55){utils[_0x45c5('0x12')](util[_0x45c5('0x4')](_0x45c5('0x29'),_0x175917[_0x45c5('0x5')]),_0x5b8b55);}};exports['cdr']=function(_0x531260){try{utils[_0x45c5('0x15')](util[_0x45c5('0x4')]('[%s][members][cdr]',_0x531260[_0x45c5('0x5')]),_0x531260);if(_0x531260[_0x45c5('0x2a')]){var _0x24a684=_0x531260[_0x45c5('0x2a')][_0x45c5('0x10')]('-')[0x0];if(!_['isNil'](members[_0x24a684])){members[_0x24a684]=_['assign'](members[_0x24a684],{'data1':members[_0x24a684][_0x45c5('0x2b')]||_0x531260[_0x45c5('0x9')],'data2':members[_0x24a684][_0x45c5('0x7')]||_0x531260[_0x45c5('0x2c')],'data3':members[_0x24a684]['data3']||_0x531260[_0x45c5('0x2d')],'uniqueid':members[_0x24a684][_0x45c5('0x5')]||_0x531260[_0x45c5('0x5')]});utils[_0x45c5('0x3')](util[_0x45c5('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x531260['uniqueid'],members[_0x24a684][_0x45c5('0x2b')],members[_0x24a684][_0x45c5('0x7')],members[_0x24a684][_0x45c5('0x2e')]));if(members[_0x24a684][_0x45c5('0x22')]){writeDB(members[_0x24a684]);}}}if(_0x531260['destinationchannel']){var _0x5f0688=_0x531260['destinationchannel'][_0x45c5('0x10')]('-')[0x0];if(!_['isNil'](members[_0x5f0688])){members[_0x5f0688]=_[_0x45c5('0x2f')](members[_0x5f0688],{'data1':members[_0x5f0688][_0x45c5('0x2b')]||_0x531260[_0x45c5('0x9')],'data2':members[_0x5f0688][_0x45c5('0x7')]||_0x531260['source'],'data3':members[_0x5f0688][_0x45c5('0x2e')]||_0x531260[_0x45c5('0x2d')],'uniqueid':members[_0x5f0688][_0x45c5('0x5')]||_0x531260['uniqueid']});utils['info'](util[_0x45c5('0x4')](_0x45c5('0x30'),_0x531260[_0x45c5('0x5')],members[_0x5f0688][_0x45c5('0x2b')],members[_0x5f0688]['data2'],members[_0x5f0688][_0x45c5('0x2e')]));if(members[_0x5f0688]['exitAt']){writeDB(members[_0x5f0688]);}}}}catch(_0x2d2172){utils[_0x45c5('0x12')](util[_0x45c5('0x4')](_0x45c5('0x31'),_0x531260[_0x45c5('0x5')]),_0x2d2172);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index d6b8607..ff04a88 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 _0x2557=['lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','format','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','isNil','variable','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','name','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','diffTime','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','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','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel'];(function(_0x377f9e,_0x532617){var _0x202c71=function(_0x37ee2e){while(--_0x37ee2e){_0x377f9e['push'](_0x377f9e['shift']());}};_0x202c71(++_0x532617);}(_0x2557,0x19b));var _0x7255=function(_0x523b92,_0x25d6b8){_0x523b92=_0x523b92-0x0;var _0x1a5e3b=_0x2557[_0x523b92];return _0x1a5e3b;};'use strict';var _=require('lodash');var util=require(_0x7255('0x0'));var utils=require(_0x7255('0x1'));var queues={};function writeDB(_0x183f31){utils['info'](util['format'](_0x7255('0x2'),_0x183f31[_0x7255('0x3')],_0x183f31[_0x7255('0x4')],_0x183f31['queue'],_0x183f31[_0x7255('0x5')],_0x183f31[_0x7255('0x6')],_0x183f31[_0x7255('0x7')],_0x183f31[_0x7255('0x8')]));if(_0x183f31[_0x7255('0x9')]){utils[_0x7255('0xa')](_0x183f31[_0x7255('0x9')])[_0x7255('0xb')](function(_0x1aa626){if(_0x1aa626){_0x183f31[_0x7255('0xc')]=_0x1aa626[_0x7255('0xc')];}utils['request'](_0x7255('0xd'),_0x183f31);});}else{utils[_0x7255('0xe')](_0x7255('0xd'),_0x183f31);}if(_0x183f31[_0x7255('0xf')]){delete queues[_0x183f31[_0x7255('0xf')]];}else{delete queues[_0x183f31['uniqueid']];}}exports[_0x7255('0x10')]=function(_0x16c713){try{utils[_0x7255('0x11')](util[_0x7255('0x12')]('[%s][queues][queuecallerjoin]',_0x16c713['uniqueid']),_0x16c713);utils[_0x7255('0x13')](util[_0x7255('0x12')](_0x7255('0x14'),_0x16c713[_0x7255('0x3')],_0x16c713[_0x7255('0x9')],_0x16c713[_0x7255('0x15')]));queues[_0x16c713[_0x7255('0x3')]]=_[_0x7255('0x16')](_0x16c713,{'originalposition':_0x16c713[_0x7255('0x15')],'queuecallerjoinAt':utils[_0x7255('0x17')](),'mohtime':0x0});}catch(_0x4f9b81){utils[_0x7255('0x18')](util['format'](_0x7255('0x19'),_0x16c713[_0x7255('0x3')]),_0x4f9b81);}};exports['hangup']=function(_0x5d39c0){try{if(!_['isNil'](queues[_0x5d39c0[_0x7255('0x3')]])){utils['debug'](util[_0x7255('0x12')]('[%s][queues][hangup]',_0x5d39c0[_0x7255('0x3')]),_0x5d39c0);if(queues[_0x5d39c0['uniqueid']][_0x7255('0x1a')]){if(!queues[_0x5d39c0['uniqueid']][_0x7255('0x1b')]&&!queues[_0x5d39c0[_0x7255('0x3')]][_0x7255('0x1c')]){queues[_0x5d39c0['uniqueid']]['queuecallercomplete']=!![];queues[_0x5d39c0[_0x7255('0x3')]][_0x7255('0x1d')]=utils['now']();queues[_0x5d39c0[_0x7255('0x3')]][_0x7255('0x8')]=_0x7255('0x1e');}utils[_0x7255('0x13')](util[_0x7255('0x12')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x5d39c0[_0x7255('0x3')],queues[_0x5d39c0['uniqueid']]['name'],queues[_0x5d39c0[_0x7255('0x3')]][_0x7255('0x8')]));writeDB(queues[_0x5d39c0[_0x7255('0x3')]]);}else if(queues[_0x5d39c0[_0x7255('0x3')]][_0x7255('0xf')]){utils[_0x7255('0x13')](util[_0x7255('0x12')](_0x7255('0x1f'),_0x5d39c0[_0x7255('0x3')],queues[_0x5d39c0[_0x7255('0x3')]]['name'],queues[_0x5d39c0[_0x7255('0x3')]]['transfereduniqueid']));queues[queues[_0x5d39c0[_0x7255('0x3')]][_0x7255('0xf')]]=queues[_0x5d39c0['uniqueid']];queues[queues[_0x5d39c0[_0x7255('0x3')]][_0x7255('0xf')]][_0x7255('0x20')]=0x2;delete queues[_0x5d39c0[_0x7255('0x3')]];}}}catch(_0x48501b){utils[_0x7255('0x18')](util[_0x7255('0x12')](_0x7255('0x21'),_0x5d39c0[_0x7255('0x3')]),_0x48501b);}};exports[_0x7255('0x22')]=function(_0x51e653){try{utils['debug'](util['format'](_0x7255('0x23'),_0x51e653['uniqueid']),_0x51e653);if(!_[_0x7255('0x24')](_0x51e653[_0x7255('0x25')]['queuestatus'])&&_0x51e653[_0x7255('0x26')]['toUpperCase']()!==_0x7255('0x27')){if(!_[_0x7255('0x24')](queues[_0x51e653[_0x7255('0x3')]])){queues[_0x51e653[_0x7255('0x3')]][_0x7255('0x1b')]=![];queues[_0x51e653['uniqueid']][_0x7255('0x28')]=null;queues[_0x51e653[_0x7255('0x3')]][_0x7255('0x1c')]=!![];queues[_0x51e653[_0x7255('0x3')]][_0x7255('0x29')]=utils[_0x7255('0x17')]();queues[_0x51e653[_0x7255('0x3')]][_0x7255('0x8')]=_0x51e653['value'][_0x7255('0x2a')]();utils[_0x7255('0x13')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x51e653[_0x7255('0x3')],queues[_0x51e653[_0x7255('0x3')]][_0x7255('0x2b')],_0x51e653[_0x7255('0x26')],queues[_0x51e653[_0x7255('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x51e653[_0x7255('0x3')]]);}}else if(!_[_0x7255('0x24')](_0x51e653[_0x7255('0x25')][_0x7255('0x2c')])){if(!_[_0x7255('0x24')](queues[_0x51e653[_0x7255('0x3')]])&&!queues[_0x51e653[_0x7255('0x3')]]['queuecallerabandon']){queues[_0x51e653[_0x7255('0x3')]][_0x7255('0x1b')]=![];queues[_0x51e653[_0x7255('0x3')]][_0x7255('0x28')]=null;queues[_0x51e653[_0x7255('0x3')]][_0x7255('0x1c')]=!![];queues[_0x51e653[_0x7255('0x3')]]['queuecallerexitAt']=utils[_0x7255('0x17')]();queues[_0x51e653[_0x7255('0x3')]]['queuecallerexitreason']=_0x7255('0x2d');utils['info'](util[_0x7255('0x12')](_0x7255('0x2e'),_0x51e653[_0x7255('0x3')],queues[_0x51e653[_0x7255('0x3')]][_0x7255('0x2b')],_0x51e653['value'],queues[_0x51e653[_0x7255('0x3')]]['queuecallerexitreason']));}}}catch(_0x547a49){utils[_0x7255('0x18')](util[_0x7255('0x12')](_0x7255('0x23'),_0x51e653['uniqueid']),_0x547a49);}};exports[_0x7255('0x1b')]=function(_0x3478ab){try{if(!_['isNil'](queues[_0x3478ab[_0x7255('0x3')]])){utils[_0x7255('0x11')](util[_0x7255('0x12')](_0x7255('0x2f'),_0x3478ab['uniqueid']),_0x3478ab);queues[_0x3478ab['uniqueid']][_0x7255('0x1c')]=![];queues[_0x3478ab['uniqueid']][_0x7255('0x29')]=null;queues[_0x3478ab[_0x7255('0x3')]][_0x7255('0x1b')]=!![];queues[_0x3478ab[_0x7255('0x3')]][_0x7255('0x28')]=utils[_0x7255('0x17')]();queues[_0x3478ab[_0x7255('0x3')]]['queuecallerexitreason']=_0x7255('0x30');utils['info'](util[_0x7255('0x12')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x3478ab[_0x7255('0x3')],queues[_0x3478ab[_0x7255('0x3')]][_0x7255('0x2b')],queues[_0x3478ab[_0x7255('0x3')]][_0x7255('0x8')]));}}catch(_0x42de82){utils[_0x7255('0x18')](util['format'](_0x7255('0x2f'),_0x3478ab[_0x7255('0x3')]),_0x42de82);}};exports['queuecallerleave']=function(_0x32b0c8){try{if(!_['isNil'](queues[_0x32b0c8[_0x7255('0x3')]])){utils[_0x7255('0x11')](util[_0x7255('0x12')]('[%s][queues][queuecallerleave]',_0x32b0c8['uniqueid']),_0x32b0c8);utils[_0x7255('0x13')](util[_0x7255('0x12')](_0x7255('0x31'),_0x32b0c8[_0x7255('0x3')],queues[_0x32b0c8['uniqueid']]['name'],_0x32b0c8[_0x7255('0x32')],_0x32b0c8[_0x7255('0x33')]));queues[_0x32b0c8['uniqueid']][_0x7255('0x34')]=!![];queues[_0x32b0c8[_0x7255('0x3')]][_0x7255('0x1a')]=utils['now']();queues[_0x32b0c8[_0x7255('0x3')]]['holdtime']=utils[_0x7255('0x35')](queues[_0x32b0c8['uniqueid']][_0x7255('0x1a')],queues[_0x32b0c8[_0x7255('0x3')]]['queuecallerjoinAt']);queues[_0x32b0c8[_0x7255('0x3')]][_0x7255('0x15')]=_0x32b0c8['position'];queues[_0x32b0c8[_0x7255('0x3')]][_0x7255('0x36')]=_0x32b0c8[_0x7255('0x36')];queues[_0x32b0c8[_0x7255('0x3')]][_0x7255('0x32')]=_0x32b0c8[_0x7255('0x32')];queues[_0x32b0c8[_0x7255('0x3')]]['connectedlinename']=_0x32b0c8[_0x7255('0x33')];}}catch(_0x896985){utils[_0x7255('0x18')](util[_0x7255('0x12')](_0x7255('0x37'),_0x32b0c8[_0x7255('0x3')]),_0x896985);}};exports[_0x7255('0x38')]=function(_0x569ccf){try{if(!_[_0x7255('0x24')](queues[_0x569ccf[_0x7255('0x3')]])){utils['debug'](util[_0x7255('0x12')]('[%s][queues][agentconnect]',_0x569ccf[_0x7255('0x3')]),_0x569ccf);utils[_0x7255('0x13')](util[_0x7255('0x12')](_0x7255('0x39'),_0x569ccf[_0x7255('0x3')],queues[_0x569ccf[_0x7255('0x3')]][_0x7255('0x2b')],_0x569ccf[_0x7255('0x3a')],_0x569ccf[_0x7255('0x3b')]));queues[_0x569ccf[_0x7255('0x3')]]['queuecallerabandon']=![];queues[_0x569ccf[_0x7255('0x3')]][_0x7255('0x1b')]=![];queues[_0x569ccf[_0x7255('0x3')]]['queuecallerabandonAt']=null;queues[_0x569ccf[_0x7255('0x3')]][_0x7255('0x1c')]=![];queues[_0x569ccf[_0x7255('0x3')]][_0x7255('0x8')]=null;queues[_0x569ccf[_0x7255('0x3')]][_0x7255('0x29')]=null;queues[_0x569ccf['uniqueid']][_0x7255('0x3c')]=!![];queues[_0x569ccf['uniqueid']][_0x7255('0x7')]=_0x569ccf[_0x7255('0x3b')];queues[_0x569ccf[_0x7255('0x3')]]['lastAssignedTo']=_0x569ccf[_0x7255('0x3a')];}}catch(_0x2cec68){utils[_0x7255('0x18')](util[_0x7255('0x12')](_0x7255('0x3d'),_0x569ccf[_0x7255('0x3')]),_0x2cec68);}};exports[_0x7255('0x3e')]=function(_0x26e28b){try{if(!_['isNil'](queues[_0x26e28b[_0x7255('0x3')]])){if(queues[_0x26e28b[_0x7255('0x3')]][_0x7255('0x1a')]){utils['debug'](util[_0x7255('0x12')](_0x7255('0x3f'),_0x26e28b[_0x7255('0x3')]),_0x26e28b);queues[_0x26e28b[_0x7255('0x3')]][_0x7255('0x1b')]=![];queues[_0x26e28b[_0x7255('0x3')]][_0x7255('0x1b')]=![];queues[_0x26e28b[_0x7255('0x3')]][_0x7255('0x28')]=null;queues[_0x26e28b[_0x7255('0x3')]][_0x7255('0x1c')]=![];queues[_0x26e28b['uniqueid']][_0x7255('0x29')]=null;queues[_0x26e28b['uniqueid']][_0x7255('0x3c')]=!![];queues[_0x26e28b[_0x7255('0x3')]]['lastAssignedTo']=_0x26e28b[_0x7255('0x3a')];queues[_0x26e28b[_0x7255('0x3')]]['queuecallercomplete']=!![];queues[_0x26e28b['uniqueid']]['queuecallercompleteAt']=utils[_0x7255('0x17')]();if(_0x26e28b['reason']==_0x7255('0x40')){if(!queues[_0x26e28b[_0x7255('0x3')]][_0x7255('0x40')]){queues[_0x26e28b[_0x7255('0x3')]][_0x7255('0x8')]=_0x7255('0x41');}}else{queues[_0x26e28b['uniqueid']][_0x7255('0x8')]=_0x7255('0x42')+_0x26e28b[_0x7255('0x43')]['toUpperCase']();}utils[_0x7255('0x13')](util[_0x7255('0x12')](_0x7255('0x44'),_0x26e28b['uniqueid'],queues[_0x26e28b[_0x7255('0x3')]][_0x7255('0x2b')],_0x26e28b[_0x7255('0x3a')],queues[_0x26e28b['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x26e28b[_0x7255('0x3')]]);}}}catch(_0x560d5f){utils[_0x7255('0x18')](util[_0x7255('0x12')](_0x7255('0x3f'),_0x26e28b['uniqueid']),_0x560d5f);}};exports['blindtransfer']=function(_0x1e3634){try{if(!_[_0x7255('0x24')](queues[_0x1e3634[_0x7255('0x45')]])){utils[_0x7255('0x11')](util['format'](_0x7255('0x46'),_0x1e3634[_0x7255('0x3')]),_0x1e3634);queues[_0x1e3634[_0x7255('0x45')]][_0x7255('0x40')]=!![];queues[_0x1e3634['transfereeuniqueid']][_0x7255('0x47')]=_0x7255('0x48');queues[_0x1e3634[_0x7255('0x45')]][_0x7255('0x49')]=_0x1e3634['extension'];queues[_0x1e3634['transfereeuniqueid']][_0x7255('0x4a')]=_0x1e3634['transfereeuniqueid'];queues[_0x1e3634[_0x7255('0x45')]][_0x7255('0x8')]='BLINDTRANSFER';utils[_0x7255('0x13')](util[_0x7255('0x12')](_0x7255('0x4b'),_0x1e3634[_0x7255('0x3')],queues[_0x1e3634['transfereeuniqueid']][_0x7255('0x2b')],_0x1e3634[_0x7255('0x45')],_0x1e3634['extension']));}}catch(_0x6fdf7b){utils[_0x7255('0x18')](util[_0x7255('0x12')](_0x7255('0x46'),_0x1e3634['uniqueid']),_0x6fdf7b);}};exports[_0x7255('0x4c')]=function(_0x324d9b){try{utils[_0x7255('0x11')](util['format'](_0x7255('0x4d'),_0x324d9b['origtransfereruniqueid']),_0x324d9b);if(_0x324d9b[_0x7255('0x4e')]==_0x324d9b[_0x7255('0x4f')]){if(!_[_0x7255('0x24')](queues[_0x324d9b[_0x7255('0x50')]])){utils[_0x7255('0x13')](util[_0x7255('0x12')](_0x7255('0x51'),_0x324d9b[_0x7255('0x4e')],queues[_0x324d9b[_0x7255('0x50')]][_0x7255('0x2b')],_0x324d9b[_0x7255('0x52')]));queues[_0x324d9b[_0x7255('0x50')]][_0x7255('0x40')]=!![];queues[_0x324d9b['secondtransfererlinkedid']][_0x7255('0x47')]=_0x7255('0x53');queues[_0x324d9b[_0x7255('0x50')]][_0x7255('0x49')]=_0x324d9b[_0x7255('0x52')];queues[_0x324d9b[_0x7255('0x50')]][_0x7255('0x4a')]=_0x324d9b[_0x7255('0x4e')];queues[_0x324d9b[_0x7255('0x50')]][_0x7255('0x8')]=_0x7255('0x54');}if(!_[_0x7255('0x24')](queues[_0x324d9b[_0x7255('0x4f')]])){if(_0x324d9b[_0x7255('0x55')]&&queues[_0x324d9b[_0x7255('0x55')]]){queues[_0x324d9b['transfereelinkedid']][_0x7255('0x20')]=0x1;queues[_0x324d9b[_0x7255('0x45')]]=_[_0x7255('0x56')](queues[_0x324d9b[_0x7255('0x55')]]);queues[_0x324d9b[_0x7255('0x45')]]['transfereduniqueid']=_0x324d9b[_0x7255('0x57')];queues[_0x324d9b[_0x7255('0x45')]]['queuecallerenterreason']=0x2;queues[_0x324d9b[_0x7255('0x45')]]['calleridnum']=queues[_0x324d9b['secondtransfererlinkedid']][_0x7255('0x6')];queues[_0x324d9b[_0x7255('0x45')]][_0x7255('0x58')]=queues[_0x324d9b[_0x7255('0x50')]]['calleridname'];queues[_0x324d9b[_0x7255('0x45')]]['queuecallerjoinAt']=utils['now']();queues[_0x324d9b['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x7255('0x17')]();queues[_0x324d9b[_0x7255('0x45')]][_0x7255('0x59')]=0x0;queues[_0x324d9b['transfereeuniqueid']][_0x7255('0x5a')]=0x0;utils[_0x7255('0x13')](util[_0x7255('0x12')](_0x7255('0x5b'),_0x324d9b['origtransfereruniqueid'],queues[_0x324d9b['transfereeuniqueid']][_0x7255('0x2b')],queues[_0x324d9b[_0x7255('0x45')]][_0x7255('0x6')],queues[_0x324d9b[_0x7255('0x45')]][_0x7255('0x58')]));}else{utils[_0x7255('0x13')](util[_0x7255('0x12')](_0x7255('0x5c'),_0x324d9b[_0x7255('0x4e')],queues[_0x324d9b[_0x7255('0x4f')]][_0x7255('0x2b')],_0x324d9b[_0x7255('0x50')]));queues[_0x324d9b[_0x7255('0x4f')]][_0x7255('0xf')]=_0x324d9b[_0x7255('0x50')];}}}else if(_0x324d9b[_0x7255('0x5d')]==_0x324d9b[_0x7255('0x50')]){if(!_[_0x7255('0x24')](queues[_0x324d9b['origtransfererlinkedid']])){utils[_0x7255('0x13')](util[_0x7255('0x12')](_0x7255('0x5e'),_0x324d9b[_0x7255('0x4e')],queues[_0x324d9b[_0x7255('0x4f')]][_0x7255('0x2b')],_0x324d9b[_0x7255('0x5d')],_0x324d9b[_0x7255('0x5f')]));queues[_0x324d9b[_0x7255('0x4f')]]['transfer']=!![];queues[_0x324d9b[_0x7255('0x4f')]][_0x7255('0x47')]=_0x7255('0x53');queues[_0x324d9b['origtransfererlinkedid']][_0x7255('0x49')]=_0x324d9b['secondtransfererexten'];queues[_0x324d9b['origtransfererlinkedid']][_0x7255('0x4a')]=_0x324d9b[_0x7255('0x5d')];queues[_0x324d9b[_0x7255('0x4f')]][_0x7255('0x8')]=_0x7255('0x54');}if(!_['isNil'](queues[_0x324d9b[_0x7255('0x50')]])){if(_0x324d9b['transfertargetlinkedid']&&queues[_0x324d9b[_0x7255('0x60')]]){queues[_0x324d9b[_0x7255('0x60')]][_0x7255('0x20')]=0x1;queues[_0x324d9b[_0x7255('0x57')]]=_[_0x7255('0x56')](queues[_0x324d9b['transfertargetlinkedid']]);queues[_0x324d9b['transfertargetuniqueid']][_0x7255('0xf')]=_0x324d9b['transfertargetuniqueid'];queues[_0x324d9b[_0x7255('0x57')]][_0x7255('0x20')]=0x2;queues[_0x324d9b[_0x7255('0x57')]][_0x7255('0x6')]=queues[_0x324d9b[_0x7255('0x4f')]][_0x7255('0x6')];queues[_0x324d9b[_0x7255('0x57')]][_0x7255('0x58')]=queues[_0x324d9b['origtransfererlinkedid']][_0x7255('0x58')];queues[_0x324d9b[_0x7255('0x57')]]['queuecallerjoinAt']=utils[_0x7255('0x17')]();queues[_0x324d9b[_0x7255('0x57')]]['queuecallerleaveAt']=utils[_0x7255('0x17')]();queues[_0x324d9b[_0x7255('0x57')]][_0x7255('0x59')]=0x0;queues[_0x324d9b[_0x7255('0x57')]][_0x7255('0x5a')]=0x0;utils['info'](util[_0x7255('0x12')](_0x7255('0x61'),_0x324d9b['origtransfereruniqueid'],queues[_0x324d9b[_0x7255('0x57')]][_0x7255('0x2b')],queues[_0x324d9b[_0x7255('0x57')]][_0x7255('0xf')],queues[_0x324d9b[_0x7255('0x57')]][_0x7255('0x6')],queues[_0x324d9b[_0x7255('0x57')]][_0x7255('0x58')]));}else{utils[_0x7255('0x13')](util[_0x7255('0x12')](_0x7255('0x5c'),_0x324d9b[_0x7255('0x4e')],queues[_0x324d9b[_0x7255('0x50')]]['name'],_0x324d9b['origtransfererlinkedid']));queues[_0x324d9b['secondtransfererlinkedid']][_0x7255('0xf')]=_0x324d9b[_0x7255('0x4f')];}}}}catch(_0x42a118){utils[_0x7255('0x18')](util['format'](_0x7255('0x4d'),_0x324d9b[_0x7255('0x4e')]),_0x42a118);}};exports['musiconholdstart']=function(_0x39fefe){try{if(!_[_0x7255('0x24')](queues[_0x39fefe[_0x7255('0x3')]])){utils[_0x7255('0x11')](util[_0x7255('0x12')](_0x7255('0x62'),_0x39fefe[_0x7255('0x3')]),_0x39fefe);queues[_0x39fefe[_0x7255('0x3')]][_0x7255('0x63')]=utils[_0x7255('0x17')]();utils[_0x7255('0x13')](util[_0x7255('0x12')](_0x7255('0x64'),_0x39fefe[_0x7255('0x3')],queues[_0x39fefe['uniqueid']][_0x7255('0x2b')],queues[_0x39fefe['uniqueid']][_0x7255('0x63')]));}}catch(_0x386f36){utils[_0x7255('0x18')](util[_0x7255('0x12')](_0x7255('0x62'),_0x39fefe[_0x7255('0x3')]),_0x386f36);}};exports[_0x7255('0x65')]=function(_0x8e9f37){try{if(!_[_0x7255('0x24')](queues[_0x8e9f37['uniqueid']])){if(!_['isNil'](queues[_0x8e9f37[_0x7255('0x3')]]['musiconholdstartAt'])){utils['debug'](util['format'](_0x7255('0x66'),_0x8e9f37[_0x7255('0x3')]),_0x8e9f37);queues[_0x8e9f37[_0x7255('0x3')]]['mohtime']+=utils[_0x7255('0x35')](utils[_0x7255('0x17')](),queues[_0x8e9f37[_0x7255('0x3')]][_0x7255('0x63')]);utils[_0x7255('0x13')](util['format'](_0x7255('0x67'),_0x8e9f37[_0x7255('0x3')],queues[_0x8e9f37[_0x7255('0x3')]]['name'],queues[_0x8e9f37[_0x7255('0x3')]][_0x7255('0x5a')]));delete queues[_0x8e9f37[_0x7255('0x3')]][_0x7255('0x63')];}}}catch(_0x1eb86c){utils['error'](util[_0x7255('0x12')]('[%s][queues][musiconholdstop]',_0x8e9f37[_0x7255('0x3')]),_0x1eb86c);}}; \ No newline at end of file +var _0xf540=['[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','now','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','isNil','variable','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','holdtime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','./utils','info','format'];(function(_0x431f11,_0x2e0001){var _0x51391f=function(_0x11d3b5){while(--_0x11d3b5){_0x431f11['push'](_0x431f11['shift']());}};_0x51391f(++_0x2e0001);}(_0xf540,0x1f1));var _0x0f54=function(_0x481c8b,_0x41e7be){_0x481c8b=_0x481c8b-0x0;var _0x4790ab=_0xf540[_0x481c8b];return _0x4790ab;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x0f54('0x0'));var queues={};function writeDB(_0x4d77da){utils[_0x0f54('0x1')](util[_0x0f54('0x2')](_0x0f54('0x3'),_0x4d77da[_0x0f54('0x4')],_0x4d77da[_0x0f54('0x5')],_0x4d77da[_0x0f54('0x6')],_0x4d77da[_0x0f54('0x7')],_0x4d77da[_0x0f54('0x8')],_0x4d77da[_0x0f54('0x9')],_0x4d77da[_0x0f54('0xa')]));if(_0x4d77da[_0x0f54('0x6')]){utils[_0x0f54('0xb')](_0x4d77da[_0x0f54('0x6')])[_0x0f54('0xc')](function(_0x5119df){if(_0x5119df){_0x4d77da[_0x0f54('0xd')]=_0x5119df[_0x0f54('0xd')];}utils[_0x0f54('0xe')]('CreateVoiceQueueReport',_0x4d77da);});}else{utils[_0x0f54('0xe')](_0x0f54('0xf'),_0x4d77da);}if(_0x4d77da[_0x0f54('0x10')]){delete queues[_0x4d77da[_0x0f54('0x10')]];}else{delete queues[_0x4d77da[_0x0f54('0x4')]];}}exports[_0x0f54('0x11')]=function(_0x18495b){try{utils[_0x0f54('0x12')](util[_0x0f54('0x2')](_0x0f54('0x13'),_0x18495b[_0x0f54('0x4')]),_0x18495b);utils[_0x0f54('0x1')](util['format'](_0x0f54('0x14'),_0x18495b[_0x0f54('0x4')],_0x18495b[_0x0f54('0x6')],_0x18495b[_0x0f54('0x15')]));queues[_0x18495b['uniqueid']]=_[_0x0f54('0x16')](_0x18495b,{'originalposition':_0x18495b[_0x0f54('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x3204a5){utils[_0x0f54('0x17')](util[_0x0f54('0x2')](_0x0f54('0x13'),_0x18495b[_0x0f54('0x4')]),_0x3204a5);}};exports[_0x0f54('0x18')]=function(_0x249eab){try{if(!_['isNil'](queues[_0x249eab[_0x0f54('0x4')]])){utils[_0x0f54('0x12')](util['format'](_0x0f54('0x19'),_0x249eab[_0x0f54('0x4')]),_0x249eab);if(queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0x1a')]){if(!queues[_0x249eab['uniqueid']][_0x0f54('0x1b')]&&!queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0x1c')]){queues[_0x249eab['uniqueid']][_0x0f54('0x1d')]=!![];queues[_0x249eab['uniqueid']]['queuecallercompleteAt']=utils[_0x0f54('0x1e')]();queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0xa')]=_0x0f54('0x1f');}utils[_0x0f54('0x1')](util[_0x0f54('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x249eab[_0x0f54('0x4')],queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0x20')],queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0xa')]));writeDB(queues[_0x249eab[_0x0f54('0x4')]]);}else if(queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0x10')]){utils[_0x0f54('0x1')](util[_0x0f54('0x2')](_0x0f54('0x21'),_0x249eab[_0x0f54('0x4')],queues[_0x249eab[_0x0f54('0x4')]]['name'],queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0x10')]));queues[queues[_0x249eab['uniqueid']]['transfereduniqueid']]=queues[_0x249eab[_0x0f54('0x4')]];queues[queues[_0x249eab[_0x0f54('0x4')]][_0x0f54('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x249eab['uniqueid']];}}}catch(_0x1e775a){utils['error'](util[_0x0f54('0x2')](_0x0f54('0x19'),_0x249eab[_0x0f54('0x4')]),_0x1e775a);}};exports[_0x0f54('0x22')]=function(_0xb0c491){try{utils[_0x0f54('0x12')](util[_0x0f54('0x2')](_0x0f54('0x23'),_0xb0c491[_0x0f54('0x4')]),_0xb0c491);if(!_[_0x0f54('0x24')](_0xb0c491[_0x0f54('0x25')]['queuestatus'])&&_0xb0c491[_0x0f54('0x26')][_0x0f54('0x27')]()!=='CONTINUE'){if(!_[_0x0f54('0x24')](queues[_0xb0c491[_0x0f54('0x4')]])){queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x1b')]=![];queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x28')]=null;queues[_0xb0c491['uniqueid']][_0x0f54('0x1c')]=!![];queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x29')]=utils[_0x0f54('0x1e')]();queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0xa')]=_0xb0c491[_0x0f54('0x26')][_0x0f54('0x27')]();utils[_0x0f54('0x1')](util[_0x0f54('0x2')](_0x0f54('0x2a'),_0xb0c491['uniqueid'],queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x20')],_0xb0c491[_0x0f54('0x26')],queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0xa')]));writeDB(queues[_0xb0c491[_0x0f54('0x4')]]);}}else if(!_[_0x0f54('0x24')](_0xb0c491[_0x0f54('0x25')][_0x0f54('0x2b')])){if(!_['isNil'](queues[_0xb0c491[_0x0f54('0x4')]])&&!queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x1b')]){queues[_0xb0c491[_0x0f54('0x4')]]['queuecallerabandon']=![];queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x28')]=null;queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x1c')]=!![];queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0x29')]=utils[_0x0f54('0x1e')]();queues[_0xb0c491[_0x0f54('0x4')]][_0x0f54('0xa')]=_0x0f54('0x2c');utils[_0x0f54('0x1')](util[_0x0f54('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0xb0c491[_0x0f54('0x4')],queues[_0xb0c491['uniqueid']][_0x0f54('0x20')],_0xb0c491[_0x0f54('0x26')],queues[_0xb0c491[_0x0f54('0x4')]]['queuecallerexitreason']));}}}catch(_0xdbe74c){utils[_0x0f54('0x17')](util[_0x0f54('0x2')](_0x0f54('0x23'),_0xb0c491['uniqueid']),_0xdbe74c);}};exports[_0x0f54('0x1b')]=function(_0x3f3c29){try{if(!_[_0x0f54('0x24')](queues[_0x3f3c29[_0x0f54('0x4')]])){utils['debug'](util[_0x0f54('0x2')]('[%s][queues][queuecallerabandon]',_0x3f3c29[_0x0f54('0x4')]),_0x3f3c29);queues[_0x3f3c29[_0x0f54('0x4')]][_0x0f54('0x1c')]=![];queues[_0x3f3c29[_0x0f54('0x4')]]['queuecallerexitAt']=null;queues[_0x3f3c29[_0x0f54('0x4')]][_0x0f54('0x1b')]=!![];queues[_0x3f3c29[_0x0f54('0x4')]][_0x0f54('0x28')]=utils['now']();queues[_0x3f3c29[_0x0f54('0x4')]][_0x0f54('0xa')]='ABANDONED';utils[_0x0f54('0x1')](util[_0x0f54('0x2')](_0x0f54('0x2d'),_0x3f3c29['uniqueid'],queues[_0x3f3c29['uniqueid']][_0x0f54('0x20')],queues[_0x3f3c29['uniqueid']][_0x0f54('0xa')]));}}catch(_0xbebccc){utils[_0x0f54('0x17')](util[_0x0f54('0x2')](_0x0f54('0x2e'),_0x3f3c29['uniqueid']),_0xbebccc);}};exports[_0x0f54('0x2f')]=function(_0x451465){try{if(!_[_0x0f54('0x24')](queues[_0x451465['uniqueid']])){utils[_0x0f54('0x12')](util['format'](_0x0f54('0x30'),_0x451465[_0x0f54('0x4')]),_0x451465);utils[_0x0f54('0x1')](util[_0x0f54('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x451465['uniqueid'],queues[_0x451465[_0x0f54('0x4')]][_0x0f54('0x20')],_0x451465[_0x0f54('0x31')],_0x451465['connectedlinename']));queues[_0x451465[_0x0f54('0x4')]][_0x0f54('0x2f')]=!![];queues[_0x451465[_0x0f54('0x4')]][_0x0f54('0x1a')]=utils['now']();queues[_0x451465[_0x0f54('0x4')]][_0x0f54('0x32')]=utils['diffTime'](queues[_0x451465[_0x0f54('0x4')]][_0x0f54('0x1a')],queues[_0x451465[_0x0f54('0x4')]][_0x0f54('0x33')]);queues[_0x451465['uniqueid']][_0x0f54('0x15')]=_0x451465[_0x0f54('0x15')];queues[_0x451465['uniqueid']][_0x0f54('0x34')]=_0x451465[_0x0f54('0x34')];queues[_0x451465[_0x0f54('0x4')]][_0x0f54('0x31')]=_0x451465[_0x0f54('0x31')];queues[_0x451465['uniqueid']][_0x0f54('0x35')]=_0x451465[_0x0f54('0x35')];}}catch(_0x13cb85){utils[_0x0f54('0x17')](util[_0x0f54('0x2')](_0x0f54('0x30'),_0x451465[_0x0f54('0x4')]),_0x13cb85);}};exports[_0x0f54('0x36')]=function(_0x1e9952){try{if(!_[_0x0f54('0x24')](queues[_0x1e9952[_0x0f54('0x4')]])){utils[_0x0f54('0x12')](util[_0x0f54('0x2')]('[%s][queues][agentconnect]',_0x1e9952[_0x0f54('0x4')]),_0x1e9952);utils['info'](util[_0x0f54('0x2')](_0x0f54('0x37'),_0x1e9952[_0x0f54('0x4')],queues[_0x1e9952[_0x0f54('0x4')]]['name'],_0x1e9952[_0x0f54('0x38')],_0x1e9952['destaccountcode']));queues[_0x1e9952['uniqueid']][_0x0f54('0x1b')]=![];queues[_0x1e9952[_0x0f54('0x4')]]['queuecallerabandon']=![];queues[_0x1e9952[_0x0f54('0x4')]][_0x0f54('0x28')]=null;queues[_0x1e9952[_0x0f54('0x4')]][_0x0f54('0x1c')]=![];queues[_0x1e9952[_0x0f54('0x4')]]['queuecallerexitreason']=null;queues[_0x1e9952['uniqueid']][_0x0f54('0x29')]=null;queues[_0x1e9952[_0x0f54('0x4')]]['assigned']=!![];queues[_0x1e9952[_0x0f54('0x4')]][_0x0f54('0x9')]=_0x1e9952[_0x0f54('0x39')];queues[_0x1e9952[_0x0f54('0x4')]][_0x0f54('0x7')]=_0x1e9952[_0x0f54('0x38')];}}catch(_0xcc2161){utils[_0x0f54('0x17')](util['format'](_0x0f54('0x3a'),_0x1e9952[_0x0f54('0x4')]),_0xcc2161);}};exports[_0x0f54('0x3b')]=function(_0x40b172){try{if(!_[_0x0f54('0x24')](queues[_0x40b172[_0x0f54('0x4')]])){if(queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0x1a')]){utils[_0x0f54('0x12')](util[_0x0f54('0x2')](_0x0f54('0x3c'),_0x40b172[_0x0f54('0x4')]),_0x40b172);queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0x1b')]=![];queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0x1b')]=![];queues[_0x40b172['uniqueid']][_0x0f54('0x28')]=null;queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0x1c')]=![];queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0x29')]=null;queues[_0x40b172[_0x0f54('0x4')]]['assigned']=!![];queues[_0x40b172[_0x0f54('0x4')]]['lastAssignedTo']=_0x40b172['membername'];queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0x1d')]=!![];queues[_0x40b172[_0x0f54('0x4')]]['queuecallercompleteAt']=utils[_0x0f54('0x1e')]();if(_0x40b172[_0x0f54('0x3d')]==_0x0f54('0x3e')){if(!queues[_0x40b172['uniqueid']][_0x0f54('0x3e')]){queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0xa')]=_0x0f54('0x3f');}}else{queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0xa')]=_0x0f54('0x40')+_0x40b172[_0x0f54('0x3d')][_0x0f54('0x27')]();}utils[_0x0f54('0x1')](util['format'](_0x0f54('0x41'),_0x40b172[_0x0f54('0x4')],queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0x20')],_0x40b172['membername'],queues[_0x40b172[_0x0f54('0x4')]][_0x0f54('0xa')]));writeDB(queues[_0x40b172[_0x0f54('0x4')]]);}}}catch(_0x3709c4){utils['error'](util[_0x0f54('0x2')](_0x0f54('0x3c'),_0x40b172[_0x0f54('0x4')]),_0x3709c4);}};exports[_0x0f54('0x42')]=function(_0x304a6d){try{if(!_[_0x0f54('0x24')](queues[_0x304a6d[_0x0f54('0x43')]])){utils[_0x0f54('0x12')](util['format'](_0x0f54('0x44'),_0x304a6d['uniqueid']),_0x304a6d);queues[_0x304a6d['transfereeuniqueid']][_0x0f54('0x3e')]=!![];queues[_0x304a6d[_0x0f54('0x43')]][_0x0f54('0x45')]=_0x0f54('0x46');queues[_0x304a6d['transfereeuniqueid']][_0x0f54('0x47')]=_0x304a6d[_0x0f54('0x48')];queues[_0x304a6d['transfereeuniqueid']][_0x0f54('0x49')]=_0x304a6d[_0x0f54('0x43')];queues[_0x304a6d[_0x0f54('0x43')]][_0x0f54('0xa')]='BLINDTRANSFER';utils[_0x0f54('0x1')](util[_0x0f54('0x2')](_0x0f54('0x4a'),_0x304a6d[_0x0f54('0x4')],queues[_0x304a6d[_0x0f54('0x43')]][_0x0f54('0x20')],_0x304a6d[_0x0f54('0x43')],_0x304a6d['extension']));}}catch(_0x54d789){utils[_0x0f54('0x17')](util[_0x0f54('0x2')]('[%s][queues][blindtransfer]',_0x304a6d[_0x0f54('0x4')]),_0x54d789);}};exports[_0x0f54('0x4b')]=function(_0x1b4a0e){try{utils[_0x0f54('0x12')](util[_0x0f54('0x2')]('[%s][queues][attendedtransfer]',_0x1b4a0e[_0x0f54('0x4c')]),_0x1b4a0e);if(_0x1b4a0e[_0x0f54('0x4c')]==_0x1b4a0e[_0x0f54('0x4d')]){if(!_[_0x0f54('0x24')](queues[_0x1b4a0e[_0x0f54('0x4e')]])){utils[_0x0f54('0x1')](util[_0x0f54('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1b4a0e[_0x0f54('0x4c')],queues[_0x1b4a0e[_0x0f54('0x4e')]][_0x0f54('0x20')],_0x1b4a0e[_0x0f54('0x4f')]));queues[_0x1b4a0e[_0x0f54('0x4e')]]['transfer']=!![];queues[_0x1b4a0e[_0x0f54('0x4e')]]['transfertype']=_0x0f54('0x50');queues[_0x1b4a0e['secondtransfererlinkedid']][_0x0f54('0x47')]=_0x1b4a0e[_0x0f54('0x4f')];queues[_0x1b4a0e['secondtransfererlinkedid']]['transferuniqueid']=_0x1b4a0e[_0x0f54('0x4c')];queues[_0x1b4a0e[_0x0f54('0x4e')]][_0x0f54('0xa')]=_0x0f54('0x51');}if(!_[_0x0f54('0x24')](queues[_0x1b4a0e[_0x0f54('0x4d')]])){if(_0x1b4a0e[_0x0f54('0x52')]&&queues[_0x1b4a0e[_0x0f54('0x52')]]){queues[_0x1b4a0e[_0x0f54('0x52')]][_0x0f54('0x53')]=0x1;queues[_0x1b4a0e['transfereeuniqueid']]=_[_0x0f54('0x54')](queues[_0x1b4a0e['transfereelinkedid']]);queues[_0x1b4a0e[_0x0f54('0x43')]]['transfereduniqueid']=_0x1b4a0e['transfertargetuniqueid'];queues[_0x1b4a0e[_0x0f54('0x43')]]['queuecallerenterreason']=0x2;queues[_0x1b4a0e[_0x0f54('0x43')]]['calleridnum']=queues[_0x1b4a0e[_0x0f54('0x4e')]][_0x0f54('0x8')];queues[_0x1b4a0e['transfereeuniqueid']][_0x0f54('0x55')]=queues[_0x1b4a0e[_0x0f54('0x4e')]][_0x0f54('0x55')];queues[_0x1b4a0e[_0x0f54('0x43')]][_0x0f54('0x33')]=utils[_0x0f54('0x1e')]();queues[_0x1b4a0e[_0x0f54('0x43')]][_0x0f54('0x1a')]=utils['now']();queues[_0x1b4a0e[_0x0f54('0x43')]][_0x0f54('0x32')]=0x0;queues[_0x1b4a0e[_0x0f54('0x43')]][_0x0f54('0x56')]=0x0;utils['info'](util[_0x0f54('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x1b4a0e[_0x0f54('0x4c')],queues[_0x1b4a0e[_0x0f54('0x43')]][_0x0f54('0x20')],queues[_0x1b4a0e[_0x0f54('0x43')]][_0x0f54('0x8')],queues[_0x1b4a0e[_0x0f54('0x43')]][_0x0f54('0x55')]));}else{utils[_0x0f54('0x1')](util[_0x0f54('0x2')](_0x0f54('0x57'),_0x1b4a0e[_0x0f54('0x4c')],queues[_0x1b4a0e['origtransfererlinkedid']][_0x0f54('0x20')],_0x1b4a0e[_0x0f54('0x4e')]));queues[_0x1b4a0e[_0x0f54('0x4d')]][_0x0f54('0x10')]=_0x1b4a0e[_0x0f54('0x4e')];}}}else if(_0x1b4a0e[_0x0f54('0x58')]==_0x1b4a0e[_0x0f54('0x4e')]){if(!_['isNil'](queues[_0x1b4a0e[_0x0f54('0x4d')]])){utils[_0x0f54('0x1')](util['format'](_0x0f54('0x59'),_0x1b4a0e[_0x0f54('0x4c')],queues[_0x1b4a0e[_0x0f54('0x4d')]][_0x0f54('0x20')],_0x1b4a0e[_0x0f54('0x58')],_0x1b4a0e['secondtransfererexten']));queues[_0x1b4a0e['origtransfererlinkedid']][_0x0f54('0x3e')]=!![];queues[_0x1b4a0e[_0x0f54('0x4d')]][_0x0f54('0x45')]=_0x0f54('0x50');queues[_0x1b4a0e[_0x0f54('0x4d')]]['transferexten']=_0x1b4a0e[_0x0f54('0x5a')];queues[_0x1b4a0e['origtransfererlinkedid']][_0x0f54('0x49')]=_0x1b4a0e[_0x0f54('0x58')];queues[_0x1b4a0e[_0x0f54('0x4d')]][_0x0f54('0xa')]=_0x0f54('0x51');}if(!_[_0x0f54('0x24')](queues[_0x1b4a0e[_0x0f54('0x4e')]])){if(_0x1b4a0e[_0x0f54('0x5b')]&&queues[_0x1b4a0e[_0x0f54('0x5b')]]){queues[_0x1b4a0e[_0x0f54('0x5b')]][_0x0f54('0x53')]=0x1;queues[_0x1b4a0e[_0x0f54('0x5c')]]=_['clone'](queues[_0x1b4a0e[_0x0f54('0x5b')]]);queues[_0x1b4a0e[_0x0f54('0x5c')]][_0x0f54('0x10')]=_0x1b4a0e[_0x0f54('0x5c')];queues[_0x1b4a0e['transfertargetuniqueid']][_0x0f54('0x53')]=0x2;queues[_0x1b4a0e[_0x0f54('0x5c')]]['calleridnum']=queues[_0x1b4a0e[_0x0f54('0x4d')]][_0x0f54('0x8')];queues[_0x1b4a0e['transfertargetuniqueid']][_0x0f54('0x55')]=queues[_0x1b4a0e[_0x0f54('0x4d')]][_0x0f54('0x55')];queues[_0x1b4a0e['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x0f54('0x1e')]();queues[_0x1b4a0e[_0x0f54('0x5c')]][_0x0f54('0x1a')]=utils[_0x0f54('0x1e')]();queues[_0x1b4a0e[_0x0f54('0x5c')]]['holdtime']=0x0;queues[_0x1b4a0e['transfertargetuniqueid']][_0x0f54('0x56')]=0x0;utils[_0x0f54('0x1')](util[_0x0f54('0x2')](_0x0f54('0x5d'),_0x1b4a0e[_0x0f54('0x4c')],queues[_0x1b4a0e[_0x0f54('0x5c')]][_0x0f54('0x20')],queues[_0x1b4a0e['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x1b4a0e[_0x0f54('0x5c')]]['calleridnum'],queues[_0x1b4a0e['transfertargetuniqueid']][_0x0f54('0x55')]));}else{utils[_0x0f54('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1b4a0e[_0x0f54('0x4c')],queues[_0x1b4a0e[_0x0f54('0x4e')]][_0x0f54('0x20')],_0x1b4a0e[_0x0f54('0x4d')]));queues[_0x1b4a0e['secondtransfererlinkedid']][_0x0f54('0x10')]=_0x1b4a0e[_0x0f54('0x4d')];}}}}catch(_0x1d211b){utils[_0x0f54('0x17')](util['format'](_0x0f54('0x5e'),_0x1b4a0e[_0x0f54('0x4c')]),_0x1d211b);}};exports[_0x0f54('0x5f')]=function(_0x27e4c1){try{if(!_[_0x0f54('0x24')](queues[_0x27e4c1[_0x0f54('0x4')]])){utils[_0x0f54('0x12')](util[_0x0f54('0x2')]('[%s][queues][musiconholdstart]',_0x27e4c1[_0x0f54('0x4')]),_0x27e4c1);queues[_0x27e4c1[_0x0f54('0x4')]]['musiconholdstartAt']=utils[_0x0f54('0x1e')]();utils[_0x0f54('0x1')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x27e4c1['uniqueid'],queues[_0x27e4c1[_0x0f54('0x4')]][_0x0f54('0x20')],queues[_0x27e4c1[_0x0f54('0x4')]][_0x0f54('0x60')]));}}catch(_0x30428e){utils[_0x0f54('0x17')](util[_0x0f54('0x2')](_0x0f54('0x61'),_0x27e4c1['uniqueid']),_0x30428e);}};exports[_0x0f54('0x62')]=function(_0x2217c4){try{if(!_[_0x0f54('0x24')](queues[_0x2217c4[_0x0f54('0x4')]])){if(!_['isNil'](queues[_0x2217c4[_0x0f54('0x4')]][_0x0f54('0x60')])){utils[_0x0f54('0x12')](util[_0x0f54('0x2')]('[%s][queues][musiconholdstop]',_0x2217c4[_0x0f54('0x4')]),_0x2217c4);queues[_0x2217c4[_0x0f54('0x4')]][_0x0f54('0x56')]+=utils['diffTime'](utils['now'](),queues[_0x2217c4['uniqueid']]['musiconholdstartAt']);utils[_0x0f54('0x1')](util['format'](_0x0f54('0x63'),_0x2217c4[_0x0f54('0x4')],queues[_0x2217c4['uniqueid']][_0x0f54('0x20')],queues[_0x2217c4[_0x0f54('0x4')]]['mohtime']));delete queues[_0x2217c4[_0x0f54('0x4')]][_0x0f54('0x60')];}}}catch(_0x25b1b8){utils[_0x0f54('0x17')](util['format']('[%s][queues][musiconholdstop]',_0x2217c4[_0x0f54('0x4')]),_0x25b1b8);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index cb826e0..03705f2 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 _0x4e9b=['mixmonitor_filename','[%s][recordings][varset]','value','replace','.wav49','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','./utils','./transfers.controller','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','format','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable'];(function(_0x26a334,_0xe38d23){var _0x264202=function(_0x40fa4e){while(--_0x40fa4e){_0x26a334['push'](_0x26a334['shift']());}};_0x264202(++_0xe38d23);}(_0x4e9b,0x6d));var _0xb4e9=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x4e9b[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xb4e9('0x0'));var util=require('util');var utils=require(_0xb4e9('0x1'));var transfers=require(_0xb4e9('0x2'));var recordings={};function writeDB(_0x2d2c5b){var _0x13b340;utils['info'](util['format'](_0xb4e9('0x3'),_0x2d2c5b[_0xb4e9('0x4')]));if(transfers[_0xb4e9('0x5')][_0x2d2c5b[_0xb4e9('0x4')]]){_0x13b340=_0x2d2c5b['uniqueid'];_0x2d2c5b[_0xb4e9('0x4')]=transfers['blinds'][_0x2d2c5b[_0xb4e9('0x4')]][_0xb4e9('0x6')];}if(_0x2d2c5b['accountcode']){utils[_0xb4e9('0x7')](_0x2d2c5b[_0xb4e9('0x8')])[_0xb4e9('0x9')](function(_0x37681c){if(_0x37681c){_0x2d2c5b[_0xb4e9('0xa')]=_0x37681c[_0xb4e9('0xb')];_0x2d2c5b[_0xb4e9('0xc')]=_0x37681c['id'];}utils[_0xb4e9('0xd')](_0xb4e9('0xe'),_0x2d2c5b);});}else{utils['request'](_0xb4e9('0xe'),_0x2d2c5b);}if(_0x13b340)delete transfers[_0xb4e9('0x5')][_0x13b340];}exports[_0xb4e9('0xf')]=function(_0x192cd1){try{utils[_0xb4e9('0x10')](util['format'](_0xb4e9('0x11'),_0x192cd1[_0xb4e9('0x4')]),_0x192cd1);if(_0x192cd1['uniqueid']==_0x192cd1[_0xb4e9('0x12')]){utils[_0xb4e9('0x13')](util[_0xb4e9('0x14')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x192cd1['uniqueid'],_0x192cd1[_0xb4e9('0x15')],_0x192cd1[_0xb4e9('0x16')]));recordings[_0x192cd1[_0xb4e9('0x4')]]={'uniqueid':_0x192cd1[_0xb4e9('0x4')],'accountcode':_0x192cd1[_0xb4e9('0x8')],'exten':_0x192cd1[_0xb4e9('0x16')],'context':_0x192cd1[_0xb4e9('0x15')],'channel':_0x192cd1[_0xb4e9('0x17')],'monitors':[]};}}catch(_0xc297b6){utils['error'](util[_0xb4e9('0x14')](_0xb4e9('0x11'),_0x192cd1[_0xb4e9('0x4')]),_0xc297b6);}};exports[_0xb4e9('0x18')]=function(_0x181af4){try{utils[_0xb4e9('0x10')](util[_0xb4e9('0x14')](_0xb4e9('0x19'),_0x181af4[_0xb4e9('0x4')]),_0x181af4);if(!_[_0xb4e9('0x1a')](recordings[_0x181af4['uniqueid']])&&_0x181af4[_0xb4e9('0x1b')]==0x6){utils['info'](util[_0xb4e9('0x14')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x181af4[_0xb4e9('0x4')],_0x181af4[_0xb4e9('0x15')],_0x181af4[_0xb4e9('0x17')]));}else if(!_[_0xb4e9('0x1a')](recordings[_0x181af4[_0xb4e9('0x12')]])&&_0x181af4[_0xb4e9('0x1b')]==0x6&&_0x181af4[_0xb4e9('0x15')]!=_0xb4e9('0x1c')){utils[_0xb4e9('0x13')](util[_0xb4e9('0x14')](_0xb4e9('0x1d'),_0x181af4[_0xb4e9('0x4')],_0x181af4[_0xb4e9('0x12')],_0x181af4[_0xb4e9('0x15')],_0x181af4['channel']));recordings[_0x181af4[_0xb4e9('0x12')]][_0xb4e9('0x8')]=_0x181af4[_0xb4e9('0x8')];}}catch(_0x45f2db){utils[_0xb4e9('0x1e')](util[_0xb4e9('0x14')]('[%s][recordings][newstate]',_0x181af4[_0xb4e9('0x4')]),_0x45f2db);}};exports[_0xb4e9('0x1f')]=function(_0x445dd5){try{if(!_[_0xb4e9('0x1a')](_0x445dd5['variable'])&&!_['isNil'](_0x445dd5[_0xb4e9('0x20')][_0xb4e9('0x21')])){utils[_0xb4e9('0x10')](util[_0xb4e9('0x14')](_0xb4e9('0x22'),_0x445dd5[_0xb4e9('0x4')]),_0x445dd5);utils[_0xb4e9('0x13')](util[_0xb4e9('0x14')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x445dd5[_0xb4e9('0x4')],_0x445dd5['variable'],_0x445dd5['value']));if(_['endsWith'](_0x445dd5['value'],'.wav49')){_0x445dd5[_0xb4e9('0x23')]=_0x445dd5[_0xb4e9('0x23')][_0xb4e9('0x24')](_0xb4e9('0x25'),'.WAV');}if(recordings[_0x445dd5[_0xb4e9('0x12')]]){var _0x1bd041=_[_0xb4e9('0x26')](recordings[_0x445dd5['linkedid']][_0xb4e9('0x27')],{'value':_0x445dd5[_0xb4e9('0x23')]});if(_[_0xb4e9('0x1a')](_0x1bd041)){recordings[_0x445dd5[_0xb4e9('0x12')]][_0xb4e9('0x27')][_0xb4e9('0x28')]({'value':_0x445dd5['value']});}}}}catch(_0x4b9507){utils['error'](util['format'](_0xb4e9('0x22'),_0x445dd5[_0xb4e9('0x4')]),_0x4b9507);}};exports[_0xb4e9('0x29')]=function(_0x52f03c){try{if(!_[_0xb4e9('0x1a')](recordings[_0x52f03c[_0xb4e9('0x4')]])){utils[_0xb4e9('0x10')](util[_0xb4e9('0x14')](_0xb4e9('0x2a'),_0x52f03c['uniqueid']),_0x52f03c);utils['info'](util[_0xb4e9('0x14')](_0xb4e9('0x2b'),_0x52f03c[_0xb4e9('0x4')],_0x52f03c[_0xb4e9('0x2c')],_0x52f03c['calleridname'],_0x52f03c[_0xb4e9('0x2d')]));recordings[_0x52f03c[_0xb4e9('0x4')]][_0xb4e9('0x2c')]=_0x52f03c['calleridnum'];recordings[_0x52f03c[_0xb4e9('0x4')]][_0xb4e9('0x2e')]=_0x52f03c[_0xb4e9('0x2e')];recordings[_0x52f03c[_0xb4e9('0x4')]][_0xb4e9('0x2f')]=_0x52f03c[_0xb4e9('0x2f')];recordings[_0x52f03c[_0xb4e9('0x4')]]['connectedlinename']=_0x52f03c[_0xb4e9('0x30')];if(recordings[_0x52f03c[_0xb4e9('0x4')]]['type']=='outbound'&&recordings[_0x52f03c[_0xb4e9('0x4')]]['accountcode']){recordings[_0x52f03c[_0xb4e9('0x4')]][_0xb4e9('0x2f')]=recordings[_0x52f03c[_0xb4e9('0x4')]][_0xb4e9('0x8')];recordings[_0x52f03c[_0xb4e9('0x4')]][_0xb4e9('0x30')]='';}recordings[_0x52f03c[_0xb4e9('0x4')]][_0xb4e9('0x27')][_0xb4e9('0x31')](function(_0x1faf7c){var _0x25c4d9=_[_0xb4e9('0x32')](recordings[_0x52f03c[_0xb4e9('0x4')]]);_0x25c4d9[_0xb4e9('0x23')]=_0x1faf7c[_0xb4e9('0x23')];writeDB(_0x25c4d9);});delete recordings[_0x52f03c[_0xb4e9('0x4')]];}}catch(_0x131b96){utils[_0xb4e9('0x1e')](util['format'](_0xb4e9('0x2a'),_0x52f03c[_0xb4e9('0x4')]),_0x131b96);}};exports[_0xb4e9('0x33')]=function(_0xec8fdc){try{if(!_[_0xb4e9('0x1a')](recordings[_0xec8fdc[_0xb4e9('0x4')]])){utils['debug'](util[_0xb4e9('0x14')]('[%s][recordings][newexten]',_0xec8fdc[_0xb4e9('0x4')]),_0xec8fdc);utils['info'](util['format'](_0xb4e9('0x34'),_0xec8fdc[_0xb4e9('0x4')],_0xec8fdc[_0xb4e9('0x35')],_0xec8fdc[_0xb4e9('0x36')]));if(_0xec8fdc[_0xb4e9('0x35')]['toLowerCase']()==_0xb4e9('0x37')&&_['startsWith'](_0xec8fdc[_0xb4e9('0x36')][_0xb4e9('0x38')](),'cdr')){var _0x4d513c=_0xec8fdc[_0xb4e9('0x36')]['split']('=');var _0x2b7389=_0x4d513c[0x0][_0xb4e9('0x39')](_0x4d513c[0x0][_0xb4e9('0x3a')]('(')+0x1,_0x4d513c[0x0][_0xb4e9('0x3a')](')'));var _0x24cc8e=_0x4d513c[0x1];recordings[_0xec8fdc[_0xb4e9('0x4')]][_0x2b7389]=_0x24cc8e;}}}catch(_0x243aab){utils['error'](util[_0xb4e9('0x14')](_0xb4e9('0x3b'),_0xec8fdc['uniqueid']),_0x243aab);}};exports[_0xb4e9('0x3c')]=function(_0x4af65f){try{if(!_[_0xb4e9('0x1a')](recordings[_0x4af65f[_0xb4e9('0x4')]])){utils['debug'](util[_0xb4e9('0x14')](_0xb4e9('0x3d'),_0x4af65f[_0xb4e9('0x4')]),_0x4af65f);utils[_0xb4e9('0x13')](util[_0xb4e9('0x14')](_0xb4e9('0x3e'),_0x4af65f[_0xb4e9('0x4')],_0x4af65f[_0xb4e9('0x3f')]));recordings[_0x4af65f[_0xb4e9('0x4')]][_0xb4e9('0x3f')]=_0x4af65f['queue'];}}catch(_0x2b6fcb){utils['error'](util[_0xb4e9('0x14')](_0xb4e9('0x3d'),_0x4af65f[_0xb4e9('0x4')]),_0x2b6fcb);}};exports['blindtransfer']=function(_0x5aad37){try{utils[_0xb4e9('0x10')](util['format'](_0xb4e9('0x40'),_0x5aad37['uniqueid']),_0x5aad37);utils[_0xb4e9('0x13')](util['format'](_0xb4e9('0x41'),_0x5aad37[_0xb4e9('0x4')],_0x5aad37['transferercalleridnum'],_0x5aad37[_0xb4e9('0x42')],_0x5aad37[_0xb4e9('0x43')],_0x5aad37[_0xb4e9('0x44')]));if(recordings[_0x5aad37['transfereruniqueid']]&&transfers[_0xb4e9('0x5')][_0x5aad37['transfereruniqueid']]){transfers[_0xb4e9('0x5')][_0x5aad37[_0xb4e9('0x45')]][_0xb4e9('0x46')]=!![];}}catch(_0x36f3ae){utils[_0xb4e9('0x1e')](util[_0xb4e9('0x14')](_0xb4e9('0x40'),_0x5aad37[_0xb4e9('0x4')]),_0x36f3ae);}}; \ No newline at end of file +var _0x803d=['varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','name','UserId','request','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error'];(function(_0x562dcd,_0x34a73c){var _0x110dab=function(_0x14dbde){while(--_0x14dbde){_0x562dcd['push'](_0x562dcd['shift']());}};_0x110dab(++_0x34a73c);}(_0x803d,0x10e));var _0xd803=function(_0x53e323,_0x3a9748){_0x53e323=_0x53e323-0x0;var _0x48b657=_0x803d[_0x53e323];return _0x48b657;};'use strict';var _=require(_0xd803('0x0'));var util=require(_0xd803('0x1'));var utils=require(_0xd803('0x2'));var transfers=require(_0xd803('0x3'));var recordings={};function writeDB(_0x5495c9){var _0x4d7171;utils[_0xd803('0x4')](util[_0xd803('0x5')](_0xd803('0x6'),_0x5495c9[_0xd803('0x7')]));if(transfers[_0xd803('0x8')][_0x5495c9[_0xd803('0x7')]]){_0x4d7171=_0x5495c9[_0xd803('0x7')];_0x5495c9[_0xd803('0x7')]=transfers[_0xd803('0x8')][_0x5495c9['uniqueid']][_0xd803('0x9')];}if(_0x5495c9[_0xd803('0xa')]){utils[_0xd803('0xb')](_0x5495c9[_0xd803('0xa')])[_0xd803('0xc')](function(_0x1ef1c7){if(_0x1ef1c7){_0x5495c9['membername']=_0x1ef1c7[_0xd803('0xd')];_0x5495c9[_0xd803('0xe')]=_0x1ef1c7['id'];}utils[_0xd803('0xf')]('CreateVoiceRecording',_0x5495c9);});}else{utils['request']('CreateVoiceRecording',_0x5495c9);}if(_0x4d7171)delete transfers[_0xd803('0x8')][_0x4d7171];}exports['newchannel']=function(_0x1afec9){try{utils['debug'](util[_0xd803('0x5')](_0xd803('0x10'),_0x1afec9[_0xd803('0x7')]),_0x1afec9);if(_0x1afec9[_0xd803('0x7')]==_0x1afec9[_0xd803('0x11')]){utils[_0xd803('0x4')](util[_0xd803('0x5')](_0xd803('0x12'),_0x1afec9[_0xd803('0x7')],_0x1afec9[_0xd803('0x13')],_0x1afec9[_0xd803('0x14')]));recordings[_0x1afec9['uniqueid']]={'uniqueid':_0x1afec9[_0xd803('0x7')],'accountcode':_0x1afec9[_0xd803('0xa')],'exten':_0x1afec9[_0xd803('0x14')],'context':_0x1afec9[_0xd803('0x13')],'channel':_0x1afec9[_0xd803('0x15')],'monitors':[]};}}catch(_0x2eeafb){utils['error'](util[_0xd803('0x5')](_0xd803('0x10'),_0x1afec9[_0xd803('0x7')]),_0x2eeafb);}};exports['newstate']=function(_0x48d063){try{utils[_0xd803('0x16')](util[_0xd803('0x5')](_0xd803('0x17'),_0x48d063[_0xd803('0x7')]),_0x48d063);if(!_[_0xd803('0x18')](recordings[_0x48d063[_0xd803('0x7')]])&&_0x48d063[_0xd803('0x19')]==0x6){utils[_0xd803('0x4')](util[_0xd803('0x5')](_0xd803('0x1a'),_0x48d063[_0xd803('0x7')],_0x48d063[_0xd803('0x13')],_0x48d063[_0xd803('0x15')]));}else if(!_[_0xd803('0x18')](recordings[_0x48d063[_0xd803('0x11')]])&&_0x48d063[_0xd803('0x19')]==0x6&&_0x48d063['context']!=_0xd803('0x1b')){utils[_0xd803('0x4')](util[_0xd803('0x5')](_0xd803('0x1c'),_0x48d063[_0xd803('0x7')],_0x48d063[_0xd803('0x11')],_0x48d063[_0xd803('0x13')],_0x48d063[_0xd803('0x15')]));recordings[_0x48d063[_0xd803('0x11')]][_0xd803('0xa')]=_0x48d063[_0xd803('0xa')];}}catch(_0x1109be){utils[_0xd803('0x1d')](util[_0xd803('0x5')]('[%s][recordings][newstate]',_0x48d063[_0xd803('0x7')]),_0x1109be);}};exports[_0xd803('0x1e')]=function(_0x584f82){try{if(!_[_0xd803('0x18')](_0x584f82[_0xd803('0x1f')])&&!_[_0xd803('0x18')](_0x584f82[_0xd803('0x1f')][_0xd803('0x20')])){utils['debug'](util[_0xd803('0x5')]('[%s][recordings][varset]',_0x584f82[_0xd803('0x7')]),_0x584f82);utils['info'](util[_0xd803('0x5')](_0xd803('0x21'),_0x584f82[_0xd803('0x7')],_0x584f82[_0xd803('0x1f')],_0x584f82[_0xd803('0x22')]));if(_[_0xd803('0x23')](_0x584f82[_0xd803('0x22')],_0xd803('0x24'))){_0x584f82['value']=_0x584f82[_0xd803('0x22')][_0xd803('0x25')]('.wav49','.WAV');}if(recordings[_0x584f82[_0xd803('0x11')]]){var _0x11f424=_[_0xd803('0x26')](recordings[_0x584f82[_0xd803('0x11')]][_0xd803('0x27')],{'value':_0x584f82[_0xd803('0x22')]});if(_[_0xd803('0x18')](_0x11f424)){recordings[_0x584f82['linkedid']][_0xd803('0x27')][_0xd803('0x28')]({'value':_0x584f82[_0xd803('0x22')]});}}}}catch(_0x4d2ef0){utils['error'](util['format'](_0xd803('0x29'),_0x584f82[_0xd803('0x7')]),_0x4d2ef0);}};exports[_0xd803('0x2a')]=function(_0x4363d2){try{if(!_['isNil'](recordings[_0x4363d2[_0xd803('0x7')]])){utils[_0xd803('0x16')](util[_0xd803('0x5')](_0xd803('0x2b'),_0x4363d2[_0xd803('0x7')]),_0x4363d2);utils['info'](util['format'](_0xd803('0x2c'),_0x4363d2[_0xd803('0x7')],_0x4363d2[_0xd803('0x2d')],_0x4363d2[_0xd803('0x2e')],_0x4363d2[_0xd803('0x2f')]));recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0x2d')]=_0x4363d2[_0xd803('0x2d')];recordings[_0x4363d2['uniqueid']][_0xd803('0x2e')]=_0x4363d2[_0xd803('0x2e')];recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0x30')]=_0x4363d2[_0xd803('0x30')];recordings[_0x4363d2['uniqueid']][_0xd803('0x31')]=_0x4363d2[_0xd803('0x31')];if(recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0x32')]==_0xd803('0x33')&&recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0xa')]){recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0x30')]=recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0xa')];recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0x31')]='';}recordings[_0x4363d2[_0xd803('0x7')]][_0xd803('0x27')]['forEach'](function(_0x38a576){var _0x2692be=_[_0xd803('0x34')](recordings[_0x4363d2[_0xd803('0x7')]]);_0x2692be[_0xd803('0x22')]=_0x38a576[_0xd803('0x22')];writeDB(_0x2692be);});delete recordings[_0x4363d2[_0xd803('0x7')]];}}catch(_0x1f962c){utils[_0xd803('0x1d')](util[_0xd803('0x5')]('[%s][recordings][hangup]',_0x4363d2[_0xd803('0x7')]),_0x1f962c);}};exports[_0xd803('0x35')]=function(_0x3603ca){try{if(!_['isNil'](recordings[_0x3603ca['uniqueid']])){utils[_0xd803('0x16')](util[_0xd803('0x5')](_0xd803('0x36'),_0x3603ca['uniqueid']),_0x3603ca);utils[_0xd803('0x4')](util[_0xd803('0x5')](_0xd803('0x37'),_0x3603ca[_0xd803('0x7')],_0x3603ca[_0xd803('0x38')],_0x3603ca['appdata']));if(_0x3603ca[_0xd803('0x38')][_0xd803('0x39')]()==_0xd803('0x3a')&&_[_0xd803('0x3b')](_0x3603ca[_0xd803('0x3c')][_0xd803('0x39')](),_0xd803('0x3d'))){var _0x567571=_0x3603ca[_0xd803('0x3c')][_0xd803('0x3e')]('=');var _0x2ba8b9=_0x567571[0x0][_0xd803('0x3f')](_0x567571[0x0]['lastIndexOf']('(')+0x1,_0x567571[0x0][_0xd803('0x40')](')'));var _0x5353b6=_0x567571[0x1];recordings[_0x3603ca[_0xd803('0x7')]][_0x2ba8b9]=_0x5353b6;}}}catch(_0x2ecf98){utils[_0xd803('0x1d')](util[_0xd803('0x5')](_0xd803('0x36'),_0x3603ca[_0xd803('0x7')]),_0x2ecf98);}};exports[_0xd803('0x41')]=function(_0x44f37d){try{if(!_[_0xd803('0x18')](recordings[_0x44f37d[_0xd803('0x7')]])){utils[_0xd803('0x16')](util[_0xd803('0x5')](_0xd803('0x42'),_0x44f37d[_0xd803('0x7')]),_0x44f37d);utils[_0xd803('0x4')](util[_0xd803('0x5')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x44f37d[_0xd803('0x7')],_0x44f37d[_0xd803('0x43')]));recordings[_0x44f37d[_0xd803('0x7')]][_0xd803('0x43')]=_0x44f37d[_0xd803('0x43')];}}catch(_0x119679){utils[_0xd803('0x1d')](util['format'](_0xd803('0x42'),_0x44f37d[_0xd803('0x7')]),_0x119679);}};exports[_0xd803('0x44')]=function(_0x51546e){try{utils['debug'](util[_0xd803('0x5')](_0xd803('0x45'),_0x51546e[_0xd803('0x7')]),_0x51546e);utils[_0xd803('0x4')](util[_0xd803('0x5')](_0xd803('0x46'),_0x51546e[_0xd803('0x7')],_0x51546e[_0xd803('0x47')],_0x51546e['transferercalleridname'],_0x51546e[_0xd803('0x48')],_0x51546e[_0xd803('0x49')]));if(recordings[_0x51546e[_0xd803('0x4a')]]&&transfers[_0xd803('0x8')][_0x51546e['transfereruniqueid']]){transfers['blinds'][_0x51546e[_0xd803('0x4a')]]['recording']=!![];}}catch(_0x1fc51b){utils[_0xd803('0x1d')](util[_0xd803('0x5')](_0xd803('0x45'),_0x51546e[_0xd803('0x7')]),_0x1fc51b);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 8820a8f..a039cc2 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 _0xac1e=['origtransfereruniqueid','blinds','blindtransfer','format','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','origtransferercalleridnum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended'];(function(_0x37369f,_0x28fd5e){var _0x11c223=function(_0x411055){while(--_0x411055){_0x37369f['push'](_0x37369f['shift']());}};_0x11c223(++_0x28fd5e);}(_0xac1e,0xe9));var _0xeac1=function(_0x25050a,_0x46c10a){_0x25050a=_0x25050a-0x0;var _0x407556=_0xac1e[_0x25050a];return _0x407556;};'use strict';var _=require(_0xeac1('0x0'));var util=require(_0xeac1('0x1'));var utils=require(_0xeac1('0x2'));function writeDB(_0x3dd1ec){utils[_0xeac1('0x3')](util['format'](_0xeac1('0x4'),_0x3dd1ec[_0xeac1('0x5')]===_0xeac1('0x6')?_0x3dd1ec[_0xeac1('0x7')]:_0x3dd1ec['uniqueid'],_0x3dd1ec[_0xeac1('0x5')]));utils['request']('CreateVoiceTransferReport',_0x3dd1ec);}exports[_0xeac1('0x8')]={};exports[_0xeac1('0x9')]=function(_0xfe4ebe){try{utils['debug'](util[_0xeac1('0xa')](_0xeac1('0xb'),_0xfe4ebe[_0xeac1('0xc')]),_0xfe4ebe);utils[_0xeac1('0x3')](util[_0xeac1('0xa')](_0xeac1('0xd'),_0xfe4ebe['uniqueid'],_0xfe4ebe[_0xeac1('0xe')],_0xfe4ebe[_0xeac1('0xf')],_0xfe4ebe[_0xeac1('0x10')],_0xfe4ebe[_0xeac1('0x11')]));_0xfe4ebe[_0xeac1('0x5')]=_0xeac1('0x12');exports[_0xeac1('0x8')][_0xfe4ebe[_0xeac1('0x13')]]=_0xfe4ebe;writeDB(_0xfe4ebe);}catch(_0x495f60){utils[_0xeac1('0x14')](util['format']('[%s][transfers][blindtransfer]',_0xfe4ebe[_0xeac1('0xc')]),_0x495f60);}};exports[_0xeac1('0x15')]=function(_0x57c86f){try{utils[_0xeac1('0x16')](util[_0xeac1('0xa')]('[%s][transfers][attendedtransfer]',_0x57c86f[_0xeac1('0x7')]),_0x57c86f);utils['info'](util[_0xeac1('0xa')](_0xeac1('0x17'),_0x57c86f[_0xeac1('0x7')],_0x57c86f['origtransferercalleridnum'],_0x57c86f[_0xeac1('0x18')],_0x57c86f[_0xeac1('0x19')],_0x57c86f['transfertargetcalleridname']));_0x57c86f=_['assign'](_0x57c86f,{'transfererchannel':_0x57c86f[_0xeac1('0x1a')],'transferercalleridnum':_0x57c86f[_0xeac1('0x1b')],'transferercalleridname':_0x57c86f[_0xeac1('0x18')],'transfererconnectedlinenum':_0x57c86f['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x57c86f['secondtransfererconnectedlinename'],'transfereraccountcode':_0x57c86f[_0xeac1('0x1c')],'transferercontext':_0x57c86f[_0xeac1('0x1d')],'transfererexten':_0x57c86f[_0xeac1('0x1e')],'transfererlinkedid':_0x57c86f[_0xeac1('0x1f')],'context':_0x57c86f[_0xeac1('0x20')],'extension':_0x57c86f['origtransfererexten'],'type':'attended'});if(_[_0xeac1('0x21')](_0x57c86f['transfereechannel'])){_0x57c86f=_['assign'](_0x57c86f,{'transfereechannel':_0x57c86f['transfertargetchannel'],'transfereecalleridnum':_0x57c86f[_0xeac1('0x19')],'transfereecalleridname':_0x57c86f[_0xeac1('0x22')],'transfereeconnectedlinenum':_0x57c86f[_0xeac1('0x23')],'transfereeconnectedlinename':_0x57c86f[_0xeac1('0x24')],'transfereeaccountcode':_0x57c86f['transfertargetaccountcode'],'transfereecontext':_0x57c86f[_0xeac1('0x25')],'transfereeexten':_0x57c86f[_0xeac1('0x26')],'transfereelinkedid':_0x57c86f[_0xeac1('0x27')]});}writeDB(_0x57c86f);}catch(_0x37caa4){utils[_0xeac1('0x14')](util[_0xeac1('0xa')]('[%s][transfers][attendedtransfer]',_0x57c86f[_0xeac1('0x7')]),_0x37caa4);}}; \ No newline at end of file +var _0x1924=['debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blinds','error','attendedtransfer','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','[%s][transfers][attendedtransfer]','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer'];(function(_0x476e65,_0x46d610){var _0x412269=function(_0x13ac56){while(--_0x13ac56){_0x476e65['push'](_0x476e65['shift']());}};_0x412269(++_0x46d610);}(_0x1924,0x17b));var _0x4192=function(_0x48304d,_0x27d4a8){_0x48304d=_0x48304d-0x0;var _0x48660f=_0x1924[_0x48304d];return _0x48660f;};'use strict';var _=require(_0x4192('0x0'));var util=require(_0x4192('0x1'));var utils=require(_0x4192('0x2'));function writeDB(_0x3a4e67){utils['info'](util[_0x4192('0x3')](_0x4192('0x4'),_0x3a4e67[_0x4192('0x5')]==='attended'?_0x3a4e67[_0x4192('0x6')]:_0x3a4e67[_0x4192('0x7')],_0x3a4e67[_0x4192('0x5')]));utils[_0x4192('0x8')](_0x4192('0x9'),_0x3a4e67);}exports['blinds']={};exports[_0x4192('0xa')]=function(_0x5f3431){try{utils[_0x4192('0xb')](util[_0x4192('0x3')](_0x4192('0xc'),_0x5f3431[_0x4192('0x7')]),_0x5f3431);utils['info'](util['format'](_0x4192('0xd'),_0x5f3431['uniqueid'],_0x5f3431[_0x4192('0xe')],_0x5f3431[_0x4192('0xf')],_0x5f3431[_0x4192('0x10')],_0x5f3431['transfereecalleridname']));_0x5f3431[_0x4192('0x5')]='blind';exports[_0x4192('0x11')][_0x5f3431['transfereruniqueid']]=_0x5f3431;writeDB(_0x5f3431);}catch(_0x2c0f8a){utils[_0x4192('0x12')](util[_0x4192('0x3')]('[%s][transfers][blindtransfer]',_0x5f3431[_0x4192('0x7')]),_0x2c0f8a);}};exports[_0x4192('0x13')]=function(_0x39ab28){try{utils[_0x4192('0xb')](util['format']('[%s][transfers][attendedtransfer]',_0x39ab28[_0x4192('0x6')]),_0x39ab28);utils[_0x4192('0x14')](util['format'](_0x4192('0x15'),_0x39ab28[_0x4192('0x6')],_0x39ab28['origtransferercalleridnum'],_0x39ab28[_0x4192('0x16')],_0x39ab28[_0x4192('0x17')],_0x39ab28[_0x4192('0x18')]));_0x39ab28=_['assign'](_0x39ab28,{'transfererchannel':_0x39ab28['origtransfererchannel'],'transferercalleridnum':_0x39ab28[_0x4192('0x19')],'transferercalleridname':_0x39ab28[_0x4192('0x16')],'transfererconnectedlinenum':_0x39ab28[_0x4192('0x1a')],'transfererconnectedlinename':_0x39ab28['secondtransfererconnectedlinename'],'transfereraccountcode':_0x39ab28[_0x4192('0x1b')],'transferercontext':_0x39ab28['secondtransferercontext'],'transfererexten':_0x39ab28[_0x4192('0x1c')],'transfererlinkedid':_0x39ab28[_0x4192('0x1d')],'context':_0x39ab28[_0x4192('0x1e')],'extension':_0x39ab28[_0x4192('0x1f')],'type':_0x4192('0x20')});if(_[_0x4192('0x21')](_0x39ab28['transfereechannel'])){_0x39ab28=_['assign'](_0x39ab28,{'transfereechannel':_0x39ab28[_0x4192('0x22')],'transfereecalleridnum':_0x39ab28[_0x4192('0x17')],'transfereecalleridname':_0x39ab28['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x39ab28[_0x4192('0x23')],'transfereeconnectedlinename':_0x39ab28['transfertargetconnectedlinename'],'transfereeaccountcode':_0x39ab28[_0x4192('0x24')],'transfereecontext':_0x39ab28['transfertargetcontext'],'transfereeexten':_0x39ab28[_0x4192('0x25')],'transfereelinkedid':_0x39ab28['transfertargetlinkedid']});}writeDB(_0x39ab28);}catch(_0xc5e7a5){utils[_0x4192('0x12')](util[_0x4192('0x3')](_0x4192('0x26'),_0x39ab28[_0x4192('0x6')]),_0xc5e7a5);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index a9e2821..a0bd330 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 _0x6ce3=['[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','now','isAfter','isBefore','client','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal'];(function(_0x5e4204,_0x38b833){var _0x58601a=function(_0x2170d3){while(--_0x2170d3){_0x5e4204['push'](_0x5e4204['shift']());}};_0x58601a(++_0x38b833);}(_0x6ce3,0xc1));var _0x36ce=function(_0x5e2bfc,_0x4a6922){_0x5e2bfc=_0x5e2bfc-0x0;var _0x16b5e6=_0x6ce3[_0x5e2bfc];return _0x16b5e6;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require('moment');var util=require('util');var client=jayson[_0x36ce('0x0')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0x36ce('0x1'));exports[_0x36ce('0x2')]=function(_0x4a5450,_0x488b42){logger[_0x36ce('0x2')](_0x4a5450,_0x488b42?util['inspect'](_0x488b42,{'showHidden':![],'depth':null}):'');};exports[_0x36ce('0x3')]=function(_0x1d34a2,_0xd9e8f6){logger[_0x36ce('0x3')](_0x1d34a2,_0xd9e8f6?util[_0x36ce('0x4')](_0xd9e8f6,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x3a1b22,_0xef17de){logger[_0x36ce('0x5')](_0x3a1b22,_0xef17de?util[_0x36ce('0x4')](_0xef17de,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x2e1abf,_0x5f1960){return client[_0x36ce('0x6')](_0x2e1abf,{'body':_0x5f1960})[_0x36ce('0x7')](function(_0x5b8deb){logger[_0x36ce('0x3')](_0x36ce('0x8'),_0x2e1abf,_0x5b8deb?util[_0x36ce('0x4')](_0x5b8deb,{'showHidden':![],'depth':null}):'');})[_0x36ce('0x9')](function(_0x2a2bf2){logger[_0x36ce('0x5')](_0x36ce('0x8'),_0x2e1abf,_0x2a2bf2?util[_0x36ce('0x4')](_0x2a2bf2,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1fb3ac){return client[_0x36ce('0x6')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x36ce('0xa'),_0x36ce('0xb'),_0x36ce('0xc')],'where':_0x1fb3ac,'limit':0x1}})[_0x36ce('0x7')](function(_0x5812ac){logger[_0x36ce('0x3')](_0x36ce('0xd'),JSON['stringify'](_0x1fb3ac),_0x5812ac?util[_0x36ce('0x4')](_0x5812ac,{'showHidden':![],'depth':null}):'');return _0x5812ac[_0x36ce('0xe')][_0x36ce('0xf')]?_0x5812ac[_0x36ce('0xe')][0x0]:null;});}exports[_0x36ce('0x10')]=function(_0x5c640a){return new BPromise(function(_0x541e89,_0x13ce5b){if(_0x5c640a){return getUser({'internal':_0x5c640a})['then'](function(_0x3d6087){logger[_0x36ce('0x2')](_0x36ce('0x11'),_0x5c640a,_0x3d6087?_0x36ce('0x12'):_0x36ce('0x13'));return _0x541e89(_0x3d6087);})['catch'](function(_0x131b3c){logger[_0x36ce('0x5')](_0x36ce('0x14'),_0x131b3c?util[_0x36ce('0x4')](_0x131b3c,{'showHidden':![],'depth':null}):'');return _0x541e89(null);});}return _0x541e89(null);});};exports[_0x36ce('0x15')]=function(_0x4860c6){return new BPromise(function(_0x10e339,_0x43272f){if(_0x4860c6){return getUser({'interface':_0x4860c6})['then'](function(_0x3623a5){logger['info'](_0x36ce('0x16'),_0x4860c6,_0x3623a5?'found':'notfound');return _0x10e339(_0x3623a5);})[_0x36ce('0x9')](function(_0xbf7952){logger[_0x36ce('0x5')](_0x36ce('0x17'),_0xbf7952?util[_0x36ce('0x4')](_0xbf7952,{'showHidden':![],'depth':null}):'');return _0x10e339(null);});}return _0x10e339(null);});};exports[_0x36ce('0x18')]=function(_0x471c45){return new BPromise(function(_0x624c4f,_0x15949d){if(_0x471c45){return getUser({'name':_0x471c45})[_0x36ce('0x7')](function(_0x314dcb){logger['info'](_0x36ce('0x19'),_0x471c45,_0x314dcb?'found':_0x36ce('0x13'));return _0x624c4f(_0x314dcb);})[_0x36ce('0x9')](function(_0x5a9b51){logger[_0x36ce('0x5')](_0x36ce('0x1a'),_0x5a9b51?util[_0x36ce('0x4')](_0x5a9b51,{'showHidden':![],'depth':null}):'');return _0x624c4f(null);});}return _0x624c4f(null);});};exports['getVoiceQueueByName']=function(_0x50f245){return new BPromise(function(_0x186d6a,_0x351f0c){if(_0x50f245){return client[_0x36ce('0x6')](_0x36ce('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x36ce('0xb'),_0x36ce('0x1c'),_0x36ce('0x1d'),'acwTimeout'],'where':{'name':_0x50f245},'limit':0x1}})[_0x36ce('0x7')](function(_0x4aedb8){logger['debug'](_0x36ce('0x1e'),_0x50f245,_0x4aedb8?util['inspect'](_0x4aedb8,{'showHidden':![],'depth':null}):'');logger[_0x36ce('0x2')](_0x36ce('0x1f'),_0x50f245,_0x4aedb8?_0x36ce('0x12'):'notfound');return _0x186d6a(_0x4aedb8[_0x36ce('0xe')][_0x36ce('0xf')]?_0x4aedb8['result'][0x0]:null);})[_0x36ce('0x9')](function(_0xf93426){logger[_0x36ce('0x5')]('[utils][getVoiceQueueByName]',_0xf93426?util[_0x36ce('0x4')](_0xf93426,{'showHidden':![],'depth':null}):'');return _0x186d6a(null);});}return _0x186d6a(null);});};exports[_0x36ce('0x20')]=function(_0x36be4f,_0x46458b){return moment(_0x36be4f)['add'](_0x46458b,_0x36ce('0x21'))[_0x36ce('0x22')](_0x36ce('0x23'));};exports[_0x36ce('0x24')]=function(_0x23a00b,_0x1d74ae){return moment(_0x23a00b)[_0x36ce('0x25')](_0x1d74ae,_0x36ce('0x21'))[_0x36ce('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x2341fd,_0xc38a52){return moment(_0x2341fd)[_0x36ce('0x26')](moment(_0xc38a52),_0x36ce('0x21'));};exports['sumTime']=function(_0x4ccbf6,_0x578bbb){return parseInt(_0x4ccbf6,0xa)+parseInt(_0x578bbb,0xa);};exports[_0x36ce('0x27')]=function(){return moment()[_0x36ce('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x36ce('0x28')]=function(_0x14438c,_0x3d0406){if(_0x3d0406){return moment(_0x14438c)[_0x36ce('0x28')](_0x3d0406);}return!![];};exports[_0x36ce('0x29')]=function(_0x596d74,_0x3ad7e0){if(_0x3ad7e0){return moment(_0x596d74)[_0x36ce('0x29')](_0x3ad7e0);}else if(_0x596d74){return!![];}return![];}; \ No newline at end of file +var _0x8e34=['acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','now','isAfter','isBefore','bluebird','moment','client','http','../../config/logger','info','inspect','debug','error','request','then','catch','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw'];(function(_0x3187ec,_0x3abc3b){var _0x44ccb5=function(_0x425b60){while(--_0x425b60){_0x3187ec['push'](_0x3187ec['shift']());}};_0x44ccb5(++_0x3abc3b);}(_0x8e34,0x1bf));var _0x48e3=function(_0x3110f6,_0x30de52){_0x3110f6=_0x3110f6-0x0;var _0x5ecdb0=_0x8e34[_0x3110f6];return _0x5ecdb0;};'use strict';var BPromise=require(_0x48e3('0x0'));var jayson=require('jayson/promise');var moment=require(_0x48e3('0x1'));var util=require('util');var client=jayson[_0x48e3('0x2')][_0x48e3('0x3')]({'port':0x2329});var logger=require(_0x48e3('0x4'))('xdr');exports[_0x48e3('0x5')]=function(_0x55fdc9,_0x4c7548){logger[_0x48e3('0x5')](_0x55fdc9,_0x4c7548?util[_0x48e3('0x6')](_0x4c7548,{'showHidden':![],'depth':null}):'');};exports[_0x48e3('0x7')]=function(_0x2e57b8,_0x30d3bd){logger['debug'](_0x2e57b8,_0x30d3bd?util[_0x48e3('0x6')](_0x30d3bd,{'showHidden':![],'depth':null}):'');};exports[_0x48e3('0x8')]=function(_0x5078fb,_0x243b19){logger['error'](_0x5078fb,_0x243b19?util['inspect'](_0x243b19,{'showHidden':![],'depth':null}):'');};exports[_0x48e3('0x9')]=function(_0x36a5fd,_0x17b2b0){return client[_0x48e3('0x9')](_0x36a5fd,{'body':_0x17b2b0})[_0x48e3('0xa')](function(_0x2d0717){logger[_0x48e3('0x7')]('[utils][request]\x20name:%s',_0x36a5fd,_0x2d0717?util[_0x48e3('0x6')](_0x2d0717,{'showHidden':![],'depth':null}):'');})[_0x48e3('0xb')](function(_0x5c899c){logger[_0x48e3('0x8')]('[utils][request]\x20name:%s',_0x36a5fd,_0x5c899c?util[_0x48e3('0x6')](_0x5c899c,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2e9cac){return client[_0x48e3('0x9')](_0x48e3('0xc'),{'options':{'raw':!![],'attributes':['id',_0x48e3('0xd'),_0x48e3('0xe'),'interface'],'where':_0x2e9cac,'limit':0x1}})[_0x48e3('0xa')](function(_0x4214c9){logger[_0x48e3('0x7')](_0x48e3('0xf'),JSON[_0x48e3('0x10')](_0x2e9cac),_0x4214c9?util[_0x48e3('0x6')](_0x4214c9,{'showHidden':![],'depth':null}):'');return _0x4214c9[_0x48e3('0x11')][_0x48e3('0x12')]?_0x4214c9['result'][0x0]:null;});}exports[_0x48e3('0x13')]=function(_0x245238){return new BPromise(function(_0x592cb4,_0x366426){if(_0x245238){return getUser({'internal':_0x245238})[_0x48e3('0xa')](function(_0x201d8c){logger[_0x48e3('0x5')](_0x48e3('0x14'),_0x245238,_0x201d8c?_0x48e3('0x15'):_0x48e3('0x16'));return _0x592cb4(_0x201d8c);})[_0x48e3('0xb')](function(_0x368efd){logger[_0x48e3('0x8')](_0x48e3('0x17'),_0x368efd?util[_0x48e3('0x6')](_0x368efd,{'showHidden':![],'depth':null}):'');return _0x592cb4(null);});}return _0x592cb4(null);});};exports[_0x48e3('0x18')]=function(_0x158d32){return new BPromise(function(_0x18caa3,_0x28b583){if(_0x158d32){return getUser({'interface':_0x158d32})['then'](function(_0x894072){logger[_0x48e3('0x5')](_0x48e3('0x19'),_0x158d32,_0x894072?_0x48e3('0x15'):'notfound');return _0x18caa3(_0x894072);})['catch'](function(_0x366dcb){logger[_0x48e3('0x8')](_0x48e3('0x1a'),_0x366dcb?util[_0x48e3('0x6')](_0x366dcb,{'showHidden':![],'depth':null}):'');return _0x18caa3(null);});}return _0x18caa3(null);});};exports[_0x48e3('0x1b')]=function(_0x47595e){return new BPromise(function(_0x3a341f,_0x4001c3){if(_0x47595e){return getUser({'name':_0x47595e})[_0x48e3('0xa')](function(_0x4167b7){logger[_0x48e3('0x5')](_0x48e3('0x1c'),_0x47595e,_0x4167b7?_0x48e3('0x15'):_0x48e3('0x16'));return _0x3a341f(_0x4167b7);})['catch'](function(_0x43fae8){logger[_0x48e3('0x8')]('[utils][getUserByName]',_0x43fae8?util[_0x48e3('0x6')](_0x43fae8,{'showHidden':![],'depth':null}):'');return _0x3a341f(null);});}return _0x3a341f(null);});};exports[_0x48e3('0x1d')]=function(_0x3fa2c9){return new BPromise(function(_0xffdf2c,_0x1aac2c){if(_0x3fa2c9){return client[_0x48e3('0x9')](_0x48e3('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x48e3('0xe'),_0x48e3('0x1f'),_0x48e3('0x20'),_0x48e3('0x21')],'where':{'name':_0x3fa2c9},'limit':0x1}})[_0x48e3('0xa')](function(_0x306338){logger[_0x48e3('0x7')](_0x48e3('0x22'),_0x3fa2c9,_0x306338?util[_0x48e3('0x6')](_0x306338,{'showHidden':![],'depth':null}):'');logger[_0x48e3('0x5')](_0x48e3('0x23'),_0x3fa2c9,_0x306338?'found':_0x48e3('0x16'));return _0xffdf2c(_0x306338[_0x48e3('0x11')][_0x48e3('0x12')]?_0x306338[_0x48e3('0x11')][0x0]:null);})[_0x48e3('0xb')](function(_0x3697ca){logger[_0x48e3('0x8')](_0x48e3('0x24'),_0x3697ca?util[_0x48e3('0x6')](_0x3697ca,{'showHidden':![],'depth':null}):'');return _0xffdf2c(null);});}return _0xffdf2c(null);});};exports[_0x48e3('0x25')]=function(_0x3281c6,_0x42301a){return moment(_0x3281c6)[_0x48e3('0x26')](_0x42301a,_0x48e3('0x27'))[_0x48e3('0x28')](_0x48e3('0x29'));};exports[_0x48e3('0x2a')]=function(_0x321b48,_0x14a838){return moment(_0x321b48)[_0x48e3('0x2b')](_0x14a838,_0x48e3('0x27'))[_0x48e3('0x28')](_0x48e3('0x29'));};exports['diffTime']=function(_0x54c836,_0x40d7b5){return moment(_0x54c836)[_0x48e3('0x2c')](moment(_0x40d7b5),_0x48e3('0x27'));};exports['sumTime']=function(_0x23c8e7,_0x437497){return parseInt(_0x23c8e7,0xa)+parseInt(_0x437497,0xa);};exports[_0x48e3('0x2d')]=function(){return moment()[_0x48e3('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x48e3('0x2e')]=function(_0x5d05e9,_0x1f3e73){if(_0x1f3e73){return moment(_0x5d05e9)[_0x48e3('0x2e')](_0x1f3e73);}return!![];};exports[_0x48e3('0x2f')]=function(_0x1b3494,_0x2c955b){if(_0x2c955b){return moment(_0x1b3494)[_0x48e3('0x2f')](_0x2c955b);}else if(_0x1b3494){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 8d1bef0..4c315c6 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd2b=['%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)','other','agent_name','test','setupLoggers','lodash','path','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','xcally','client','name','ensureDir','then','catch','log','user','data','timestamp','api','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','role','inspect','logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdd2b,0x1a6));var _0xbdd2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xdd2b[_0x57b54c];return _0x59cc19;};var fs=require('fs-extra');var _=require(_0xbdd2('0x0'));var ewinston=require('express-winston');var path=require(_0xbdd2('0x1'));var util=require('util');var fileLogger=require('./loggers')[_0xbdd2('0x2')];var safeTemplate=require(_0xbdd2('0x3'))[_0xbdd2('0x4')];var maskSensitiveData=require(_0xbdd2('0x5'))['maskSensitiveData'];function ClientSideLogger(){function _0x59617b(_0x420314){var _0x32eb70=path[_0xbdd2('0x6')](_0xbdd2('0x7'),'log',_0xbdd2('0x8'));var _0x40fcc7=path[_0xbdd2('0x6')](_0xbdd2('0x9'),_0x420314['role']+'-'+_0x420314[_0xbdd2('0xa')]);return fs[_0xbdd2('0xb')](path['join'](_0x32eb70,_0x40fcc7))[_0xbdd2('0xc')](function(){var _0x33fe79=fileLogger(_0xbdd2('0x9'),path[_0xbdd2('0x6')](_0x32eb70,_0x40fcc7));return _0x33fe79;})[_0xbdd2('0xd')](function(_0x3c6648){throw _0x3c6648;});}this[_0xbdd2('0xe')]=function(_0x117786,_0x2f33ba,_0x25e361,_0x434c78){return _0x59617b(_0x117786['user'])[_0xbdd2('0xc')](function(_0x2689c8){var _0x4e8f39=_0x2689c8[_0x2f33ba];return _0x4e8f39;})[_0xbdd2('0xc')](function(_0x31885e){var _0x28949a=_0x117786[_0xbdd2('0xf')]?_0x117786[_0xbdd2('0xf')]['id']:'no-user';var _0x3f2ff8=_0x434c78[_0xbdd2('0x10')];var _0x17f8e1=_0x434c78[_0xbdd2('0x11')];var _0x90d84a=new Date(Number(_0x17f8e1));return _0x31885e(_0x28949a,_0x90d84a,_0x25e361,_0x3f2ff8);})[_0xbdd2('0xd')](function(_0x7a94f){fileLogger('client')['error'](_0x7a94f);});};}function setupLoggers(_0x5d841b){return new Promise(function(_0x1b8824){var _0x2b7123=new ClientSideLogger();var _0x3cd930=fileLogger(_0xbdd2('0x12'));var _0x1d5613=fileLogger(_0xbdd2('0x13'));_0x5d841b[_0xbdd2('0x14')](_0xbdd2('0x15'),_0x2b7123);_0x5d841b[_0xbdd2('0x16')](ewinston['logger']({'winstonInstance':_0x3cd930,'meta':![],'statusLevels':!![],'msg':function(_0x435a49,_0xb60ccd){var _0x4e97e8=_0xbdd2('0x17');if(!_[_0xbdd2('0x18')](_0x435a49[_0xbdd2('0x19')])){_0x4e97e8+=_0xbdd2('0x1a');var _0x3ad1e3=_0x435a49[_0xbdd2('0x19')];maskSensitiveData(_0x3ad1e3);}return safeTemplate(util[_0xbdd2('0x1b')](_0x4e97e8,_0x435a49['method'],_0x435a49['headers'][_0xbdd2('0x1c')]?_0x435a49[_0xbdd2('0x1d')][_0xbdd2('0x1c')]:_0x435a49[_0xbdd2('0x1e')][_0xbdd2('0x1f')]||_0x435a49['ip'],_0x435a49[_0xbdd2('0x20')],_0xb60ccd[_0xbdd2('0x21')],_0xb60ccd[_0xbdd2('0x22')],_0x435a49['user']?_0x435a49[_0xbdd2('0xf')]['id']:null,_0x435a49[_0xbdd2('0xf')]?_0x435a49['user'][_0xbdd2('0xa')]:null,_0x435a49[_0xbdd2('0xf')]?_0x435a49[_0xbdd2('0xf')][_0xbdd2('0x23')]:null,_0x3ad1e3?util[_0xbdd2('0x24')](_0x3ad1e3,![],null):''));}}));_0x5d841b['use'](ewinston[_0xbdd2('0x25')]({'winstonInstance':_0x1d5613,'meta':![],'statusLevels':!![],'msg':function(_0x222edf,_0x25a4d3){var _0x47819e=_0xbdd2('0x26');if(_0x222edf[_0xbdd2('0x19')]&&_0x222edf['body'][_0xbdd2('0x27')]&&_0x222edf['body'][_0xbdd2('0x28')]){_0x47819e=_0xbdd2('0x29');}return util[_0xbdd2('0x1b')](_0x47819e,_0x222edf['method'],_0x222edf[_0xbdd2('0x1d')]['x-forwarded-for']?_0x222edf[_0xbdd2('0x1d')]['x-forwarded-for']:_0x222edf[_0xbdd2('0x1e')]['remoteAddress']||_0x222edf['ip'],_0x222edf['url'],_0x25a4d3['statusCode'],_0x25a4d3[_0xbdd2('0x22')],_0x222edf[_0xbdd2('0xf')]?_0x222edf['user']['id']:null,_0x222edf['user']?_0x222edf[_0xbdd2('0xf')][_0xbdd2('0xa')]:null,_0x222edf[_0xbdd2('0xf')]?_0x222edf[_0xbdd2('0xf')][_0xbdd2('0x23')]:null,_0x222edf[_0xbdd2('0x19')]&&_0x222edf[_0xbdd2('0x19')]['device']?_0x222edf[_0xbdd2('0x19')][_0xbdd2('0x27')]:_0xbdd2('0x2a'),_0x222edf['body']&&_0x222edf[_0xbdd2('0x19')][_0xbdd2('0x28')]?_0x222edf[_0xbdd2('0x19')]['agent_id']:'',_0x222edf['body']&&_0x222edf['body'][_0xbdd2('0x2b')]?_0x222edf[_0xbdd2('0x19')][_0xbdd2('0x2b')]:'');},'ignoreRoute':function(_0x234897){var _0x3d4a93=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3d4a93[_0xbdd2('0x2c')](_0x234897[_0xbdd2('0x20')]);}}));return _0x1b8824();});}exports[_0xbdd2('0x2d')]=setupLoggers; \ No newline at end of file +var _0xe3ea=['join','/var','log','xcally','client','role','name','ensureDir','catch','user','then','data','timestamp','error','api','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','x-forwarded-for','headers','connection','remoteAddress','url','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','statusCode','device','other','agent_id','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData'];(function(_0x4a6102,_0xedf422){var _0x416650=function(_0x4be9ec){while(--_0x4be9ec){_0x4a6102['push'](_0x4a6102['shift']());}};_0x416650(++_0xedf422);}(_0xe3ea,0x1cd));var _0xae3e=function(_0x556cc0,_0x286631){_0x556cc0=_0x556cc0-0x0;var _0x465ff5=_0xe3ea[_0x556cc0];return _0x465ff5;};var fs=require(_0xae3e('0x0'));var _=require(_0xae3e('0x1'));var ewinston=require(_0xae3e('0x2'));var path=require(_0xae3e('0x3'));var util=require('util');var fileLogger=require(_0xae3e('0x4'))[_0xae3e('0x5')];var safeTemplate=require(_0xae3e('0x6'))[_0xae3e('0x7')];var maskSensitiveData=require('./mask-sensitive-data')[_0xae3e('0x8')];function ClientSideLogger(){function _0xa6e659(_0x27dca6){var _0x41aecd=path[_0xae3e('0x9')](_0xae3e('0xa'),_0xae3e('0xb'),_0xae3e('0xc'));var _0xf2e452=path['join'](_0xae3e('0xd'),_0x27dca6[_0xae3e('0xe')]+'-'+_0x27dca6[_0xae3e('0xf')]);return fs[_0xae3e('0x10')](path[_0xae3e('0x9')](_0x41aecd,_0xf2e452))['then'](function(){var _0x524aa7=fileLogger(_0xae3e('0xd'),path['join'](_0x41aecd,_0xf2e452));return _0x524aa7;})[_0xae3e('0x11')](function(_0x544762){throw _0x544762;});}this[_0xae3e('0xb')]=function(_0x147aa7,_0x5103f8,_0x1bb097,_0x22162e){return _0xa6e659(_0x147aa7[_0xae3e('0x12')])[_0xae3e('0x13')](function(_0x53a010){var _0x30e5e9=_0x53a010[_0x5103f8];return _0x30e5e9;})[_0xae3e('0x13')](function(_0x30ffa2){var _0x5af6b8=_0x147aa7[_0xae3e('0x12')]?_0x147aa7[_0xae3e('0x12')]['id']:'no-user';var _0x1d1c57=_0x22162e[_0xae3e('0x14')];var _0x39cfc7=_0x22162e[_0xae3e('0x15')];var _0x4275e5=new Date(Number(_0x39cfc7));return _0x30ffa2(_0x5af6b8,_0x4275e5,_0x1bb097,_0x1d1c57);})[_0xae3e('0x11')](function(_0x49f8ae){fileLogger(_0xae3e('0xd'))[_0xae3e('0x16')](_0x49f8ae);});};}function setupLoggers(_0x3b6ad5){return new Promise(function(_0x28c980){var _0x5cd708=new ClientSideLogger();var _0x27935d=fileLogger(_0xae3e('0x17'));var _0x181fa6=fileLogger(_0xae3e('0x18'));_0x3b6ad5[_0xae3e('0x19')](_0xae3e('0x1a'),_0x5cd708);_0x3b6ad5[_0xae3e('0x1b')](ewinston['logger']({'winstonInstance':_0x27935d,'meta':![],'statusLevels':!![],'msg':function(_0x266ebf,_0x1f1cca){var _0x63d8ed=_0xae3e('0x1c');if(!_[_0xae3e('0x1d')](_0x266ebf[_0xae3e('0x1e')])){_0x63d8ed+='\x20body=%s';var _0x4c1103=_0x266ebf[_0xae3e('0x1e')];maskSensitiveData(_0x4c1103);}return safeTemplate(util[_0xae3e('0x1f')](_0x63d8ed,_0x266ebf['method'],_0x266ebf['headers'][_0xae3e('0x20')]?_0x266ebf[_0xae3e('0x21')][_0xae3e('0x20')]:_0x266ebf[_0xae3e('0x22')][_0xae3e('0x23')]||_0x266ebf['ip'],_0x266ebf[_0xae3e('0x24')],_0x1f1cca['statusCode'],_0x1f1cca['responseTime'],_0x266ebf[_0xae3e('0x12')]?_0x266ebf[_0xae3e('0x12')]['id']:null,_0x266ebf[_0xae3e('0x12')]?_0x266ebf[_0xae3e('0x12')][_0xae3e('0xf')]:null,_0x266ebf[_0xae3e('0x12')]?_0x266ebf['user']['role']:null,_0x4c1103?util[_0xae3e('0x25')](_0x4c1103,![],null):''));}}));_0x3b6ad5['use'](ewinston[_0xae3e('0x26')]({'winstonInstance':_0x181fa6,'meta':![],'statusLevels':!![],'msg':function(_0x433112,_0x10a7f0){var _0x1aad26='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x433112[_0xae3e('0x1e')]&&_0x433112[_0xae3e('0x1e')]['device']&&_0x433112[_0xae3e('0x1e')]['agent_id']){_0x1aad26=_0xae3e('0x27');}return util[_0xae3e('0x1f')](_0x1aad26,_0x433112[_0xae3e('0x28')],_0x433112[_0xae3e('0x21')][_0xae3e('0x20')]?_0x433112['headers'][_0xae3e('0x20')]:_0x433112[_0xae3e('0x22')][_0xae3e('0x23')]||_0x433112['ip'],_0x433112['url'],_0x10a7f0[_0xae3e('0x29')],_0x10a7f0['responseTime'],_0x433112[_0xae3e('0x12')]?_0x433112[_0xae3e('0x12')]['id']:null,_0x433112[_0xae3e('0x12')]?_0x433112['user'][_0xae3e('0xf')]:null,_0x433112[_0xae3e('0x12')]?_0x433112[_0xae3e('0x12')][_0xae3e('0xe')]:null,_0x433112[_0xae3e('0x1e')]&&_0x433112[_0xae3e('0x1e')][_0xae3e('0x2a')]?_0x433112[_0xae3e('0x1e')][_0xae3e('0x2a')]:_0xae3e('0x2b'),_0x433112[_0xae3e('0x1e')]&&_0x433112[_0xae3e('0x1e')][_0xae3e('0x2c')]?_0x433112[_0xae3e('0x1e')][_0xae3e('0x2c')]:'',_0x433112[_0xae3e('0x1e')]&&_0x433112[_0xae3e('0x1e')]['agent_name']?_0x433112[_0xae3e('0x1e')][_0xae3e('0x2d')]:'');},'ignoreRoute':function(_0x43b048){var _0x3896a1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3896a1['test'](_0x43b048['url']);}}));return _0x28c980();});}exports[_0xae3e('0x2e')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index b9eb72f..15169f7 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0397=['map','locale','weekdaysShort','indexOf','slice','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','dowCompare','date','max','min','domCompare','format','MMM','includes','monthCompare','guess','test','padStart','length','iftime','lodash','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split'];(function(_0x2181be,_0x4e82ac){var _0x3c364f=function(_0x591949){while(--_0x591949){_0x2181be['push'](_0x2181be['shift']());}};_0x3c364f(++_0x4e82ac);}(_0x0397,0x1db));var _0x7039=function(_0x36db65,_0x2b4af1){_0x36db65=_0x36db65-0x0;var _0x5bea6a=_0x0397[_0x36db65];return _0x5bea6a;};var _=require(_0x7039('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x61093d){return _0x61093d[_0x7039('0x1')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x7039('0x2');var EINVALID_DATE=_0x7039('0x3');function throwIfDateNotValid(_0x3f6f5c){if(!_0x3f6f5c[_0x7039('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x532f39){var _0x187e55=_0x532f39[_0x7039('0x5')](':')[_0x7039('0x6')](function(_0xf88402){return parseInt(_0xf88402,0xa);});var _0x28286f=_0x187e55[0x0];var _0x5a3474=_0x187e55[0x1];if(_0x28286f<0x0||_0x28286f>0x17||_0x5a3474<0x0||_0x5a3474>0x3b){throw new Error(EINVALID_DATE);}return[_0x28286f,_0x5a3474];}function circularDoWInterval(_0x40895d,_0x4b1e83){if(_0x40895d===_0x4b1e83){return[_0x40895d];}else{var _0xe55882=moment['locale']();moment[_0x7039('0x7')]('en');var _0xe933f4=moment[_0x7039('0x8')]()[_0x7039('0x6')](function(_0x3d77a7){return _0x3d77a7['toLowerCase']();});moment[_0x7039('0x7')](_0xe55882);var _0xd5bed1=_0xe933f4[_0x7039('0x9')](_0x40895d);var _0x228905=_0xe933f4[_0x7039('0x9')](_0x4b1e83);if(_0x228905>_0xd5bed1){return _0xe933f4[_0x7039('0xa')](_0xd5bed1,_0x228905+0x1);}else{var _0x4603cb=_0xe933f4[_0x7039('0xa')](0x0,_0x228905+0x1);var _0x3b4c80=_0xe933f4[_0x7039('0xa')](_0xd5bed1);return _0x3b4c80['concat'](_0x4603cb);}}}module[_0x7039('0xb')][_0x7039('0xc')]=circularDoWInterval;function circularMonthInterval(_0x2638e3,_0x4e9f1e){if(_0x2638e3===_0x4e9f1e){return[_0x2638e3];}else{var _0x48b787=moment[_0x7039('0x7')]();moment[_0x7039('0x7')]('en');var _0x1dac21=moment[_0x7039('0xd')]()[_0x7039('0x6')](function(_0x143138){return _0x143138['toLowerCase']();});moment[_0x7039('0x7')](_0x48b787);var _0x12ae56=_0x1dac21['indexOf'](_0x2638e3);var _0x15e344=_0x1dac21[_0x7039('0x9')](_0x4e9f1e);if(_0x15e344>_0x12ae56){return _0x1dac21['slice'](_0x12ae56,_0x15e344+0x1);}else{var _0xe856e1=_0x1dac21[_0x7039('0xa')](0x0,_0x15e344+0x1);var _0xdf87bc=_0x1dac21[_0x7039('0xa')](_0x12ae56);return _0xdf87bc['concat'](_0xe856e1);}}}module[_0x7039('0xb')][_0x7039('0xe')]=circularMonthInterval;function parseDom(_0x2dbbed){var _0x585e87=parseInt(_0x2dbbed,0xa);if(_0x585e87<0x1||_0x585e87>0x1f){throw new Error(EINVALID_DATE);}return _0x585e87;}function timeCompare(_0xddf29b,_0x46c7c4,_0x675772){var _0x36fc2e=_0xddf29b[_0x7039('0xf')]();var _0x5c056f=extractTime(_0x46c7c4);var _0x4ecfdb=_0x5c056f[0x0];var _0x94b1af=_0x5c056f[0x1];var _0x1c0dea=_0xddf29b[_0x7039('0xf')]()[_0x7039('0x10')](_0x4ecfdb)[_0x7039('0x11')](_0x94b1af);throwIfDateNotValid(_0x1c0dea);var _0x301e24=extractTime(_0x675772);var _0x31ceb7=_0x301e24[0x0];var _0x570ecc=_0x301e24[0x1];var _0x44e969=_0xddf29b[_0x7039('0xf')]()[_0x7039('0x10')](_0x31ceb7)[_0x7039('0x11')](_0x570ecc);throwIfDateNotValid(_0x44e969);if(_0x44e969[_0x7039('0x12')](_0x1c0dea)){var _0x56ea49=_0x36fc2e[_0x7039('0xf')]()[_0x7039('0x13')](_0x7039('0x14'));var _0x2b9890=_0x36fc2e['clone']()['endOf'](_0x7039('0x14'));return _0x36fc2e[_0x7039('0x15')](_0x1c0dea,_0x2b9890,undefined,'[]')||_0x36fc2e[_0x7039('0x15')](_0x56ea49,_0x44e969,undefined,'[]');}else{return _0x36fc2e[_0x7039('0x15')](_0x1c0dea,_0x44e969,undefined,'[]');}}module[_0x7039('0xb')][_0x7039('0x16')]=timeCompare;function dowCompare(_0x5c0192,_0x488d4f,_0x1664a5){var _0x2478fd=_0x5c0192[_0x7039('0x7')]('en')['format']('ddd')['toLowerCase']();return circularDoWInterval(_0x488d4f,_0x1664a5)['includes'](_0x2478fd);}module[_0x7039('0xb')][_0x7039('0x17')]=dowCompare;function domCompare(_0x3cc87d,_0x2da9f3,_0x1aeb89){var _0x546bda=_0x3cc87d[_0x7039('0x18')]();if(_0x2da9f3===_0x1aeb89){return _0x546bda===_0x2da9f3;}else{var _0x44b8d6=_0x3cc87d['daysInMonth']();var _0x18a8fa=_0x2da9f3<_0x1aeb89;let _0x2828df=![];var _0x47f5f5=0x0;var _0x17fc12=0x0;if(_0x18a8fa){_0x47f5f5=Math[_0x7039('0x19')](0x1,_0x2da9f3);_0x17fc12=Math[_0x7039('0x1a')](_0x1aeb89,_0x44b8d6);_0x2828df=_0x546bda>=_0x47f5f5&&_0x546bda<=_0x17fc12;}else{_0x47f5f5=Math[_0x7039('0x1a')](_0x2da9f3,_0x44b8d6);_0x17fc12=Math[_0x7039('0x19')](0x1,_0x1aeb89);_0x2828df=_0x546bda>=_0x47f5f5||_0x546bda<=_0x17fc12;}return _0x2828df;}}module[_0x7039('0xb')][_0x7039('0x1b')]=domCompare;function monthCompare(_0x5b123a,_0x31fc36,_0x2e9f70){var _0x22fe0c=_0x5b123a['locale']('en')[_0x7039('0x1c')](_0x7039('0x1d'))['toLowerCase']();return circularMonthInterval(_0x31fc36,_0x2e9f70)[_0x7039('0x1e')](_0x22fe0c);}module['exports'][_0x7039('0x1f')]=monthCompare;function iftime(_0x54161c,_0x3e9825=moment['tz'][_0x7039('0x20')](),_0x232127=moment()){if(!validateRx[_0x7039('0x21')](_0x54161c)){throw new Error(EINVALID_STRING);}else{var _0x31ad36=(moment['isMoment'](_0x232127)?_0x232127['clone']():moment(_0x232127))['tz'](_0x3e9825)[_0x7039('0x7')]('en');throwIfDateNotValid(_0x31ad36);var _0x50caa1=_0x54161c['split'](',');var _0x331e13=_0x50caa1[0x0];var _0x3a1777=_0x50caa1[0x1];var _0xd7d94f=_0x50caa1[0x2];var _0x149160=_0x50caa1[0x3];let _0x537a49=!![];if(_0x331e13!=='*'){var _0x46496d=_0x331e13['split']('-');var _0x23d9a7=_[_0x7039('0x22')](_0x46496d[0x0],0x5,'0');var _0x2c973c=_0x46496d[_0x7039('0x23')]===0x2?_[_0x7039('0x22')](_0x46496d[0x1],0x5,'0'):_0x23d9a7;_0x537a49=timeCompare(_0x31ad36,_0x23d9a7,_0x2c973c);}let _0x10724a=!![];if(_0x3a1777!=='*'){var _0xd79c14=_0x3a1777[_0x7039('0x5')]('-');var _0x1dcbb6=_0xd79c14[0x0];var _0x4b9498=_0xd79c14[_0x7039('0x23')]===0x2?_0xd79c14[0x1]:_0x1dcbb6;_0x10724a=dowCompare(_0x31ad36,_0x1dcbb6,_0x4b9498);}let _0x1de3d9=!![];if(_0xd7d94f!=='*'){var _0x397d19=_0xd7d94f[_0x7039('0x5')]('-');var _0x28e7d4=parseDom(_0x397d19[0x0]);var _0x3de8df=_0x397d19[_0x7039('0x23')]===0x2?parseDom(_0x397d19[0x1]):_0x28e7d4;_0x1de3d9=domCompare(_0x31ad36,_0x28e7d4,_0x3de8df);}let _0x4a1a00=!![];if(_0x149160!=='*'){var _0x1febbd=_0x149160[_0x7039('0x5')]('-');var _0x542f84=_0x1febbd[0x0];var _0x58ea92=_0x1febbd[_0x7039('0x23')]===0x2?_0x1febbd[0x1]:_0x1febbd[0x0];_0x4a1a00=monthCompare(_0x31ad36,_0x542f84,_0x58ea92);}return _0x537a49&&_0x10724a&&_0x1de3d9&&_0x4a1a00;}}module['exports'][_0x7039('0x24')]=iftime; \ No newline at end of file +var _0x8ad5=['lodash','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','weekdaysShort','indexOf','slice','concat','exports','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','day','endOf','isBetween','timeCompare','format','ddd','dowCompare','daysInMonth','max','min','domCompare','MMM','monthCompare','test','isMoment','padStart','length','iftime'];(function(_0x356102,_0xdb5cc8){var _0x4faa04=function(_0x36113d){while(--_0x36113d){_0x356102['push'](_0x356102['shift']());}};_0x4faa04(++_0xdb5cc8);}(_0x8ad5,0xde));var _0x58ad=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x8ad5[_0x134c2e];return _0x2825db;};var _=require(_0x58ad('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x58ad('0x1')](function(_0x2bd0a6){return _0x2bd0a6[_0x58ad('0x2')];})[_0x58ad('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x58ad('0x4');var EINVALID_DATE=_0x58ad('0x5');function throwIfDateNotValid(_0x2b60aa){if(!_0x2b60aa['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x45057e){var _0x41b84b=_0x45057e[_0x58ad('0x6')](':')[_0x58ad('0x1')](function(_0x37317a){return parseInt(_0x37317a,0xa);});var _0x4ea062=_0x41b84b[0x0];var _0x4856bb=_0x41b84b[0x1];if(_0x4ea062<0x0||_0x4ea062>0x17||_0x4856bb<0x0||_0x4856bb>0x3b){throw new Error(EINVALID_DATE);}return[_0x4ea062,_0x4856bb];}function circularDoWInterval(_0x278ba8,_0x55a39e){if(_0x278ba8===_0x55a39e){return[_0x278ba8];}else{var _0x250bf2=moment[_0x58ad('0x7')]();moment[_0x58ad('0x7')]('en');var _0xc4edab=moment[_0x58ad('0x8')]()[_0x58ad('0x1')](function(_0x4e2349){return _0x4e2349['toLowerCase']();});moment[_0x58ad('0x7')](_0x250bf2);var _0x2d13ec=_0xc4edab[_0x58ad('0x9')](_0x278ba8);var _0x1ab8d4=_0xc4edab[_0x58ad('0x9')](_0x55a39e);if(_0x1ab8d4>_0x2d13ec){return _0xc4edab[_0x58ad('0xa')](_0x2d13ec,_0x1ab8d4+0x1);}else{var _0x3eaeff=_0xc4edab[_0x58ad('0xa')](0x0,_0x1ab8d4+0x1);var _0x1afc05=_0xc4edab[_0x58ad('0xa')](_0x2d13ec);return _0x1afc05[_0x58ad('0xb')](_0x3eaeff);}}}module[_0x58ad('0xc')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x5e87e7,_0x43d0bd){if(_0x5e87e7===_0x43d0bd){return[_0x5e87e7];}else{var _0x4cc636=moment[_0x58ad('0x7')]();moment[_0x58ad('0x7')]('en');var _0x3cee92=moment[_0x58ad('0xd')]()['map'](function(_0x8941ed){return _0x8941ed[_0x58ad('0xe')]();});moment[_0x58ad('0x7')](_0x4cc636);var _0x1bea05=_0x3cee92[_0x58ad('0x9')](_0x5e87e7);var _0x26cef4=_0x3cee92[_0x58ad('0x9')](_0x43d0bd);if(_0x26cef4>_0x1bea05){return _0x3cee92['slice'](_0x1bea05,_0x26cef4+0x1);}else{var _0x445920=_0x3cee92[_0x58ad('0xa')](0x0,_0x26cef4+0x1);var _0x8ebc2=_0x3cee92['slice'](_0x1bea05);return _0x8ebc2[_0x58ad('0xb')](_0x445920);}}}module['exports'][_0x58ad('0xf')]=circularMonthInterval;function parseDom(_0x4cf275){var _0x17a3c8=parseInt(_0x4cf275,0xa);if(_0x17a3c8<0x1||_0x17a3c8>0x1f){throw new Error(EINVALID_DATE);}return _0x17a3c8;}function timeCompare(_0x120da1,_0x25aa21,_0x18432d){var _0x318824=_0x120da1[_0x58ad('0x10')]();var _0x4e597e=extractTime(_0x25aa21);var _0x17bb00=_0x4e597e[0x0];var _0x24a820=_0x4e597e[0x1];var _0x500a1b=_0x120da1[_0x58ad('0x10')]()[_0x58ad('0x11')](_0x17bb00)[_0x58ad('0x12')](_0x24a820);throwIfDateNotValid(_0x500a1b);var _0x10cc76=extractTime(_0x18432d);var _0x1723c7=_0x10cc76[0x0];var _0xecbf80=_0x10cc76[0x1];var _0x5911c0=_0x120da1[_0x58ad('0x10')]()[_0x58ad('0x11')](_0x1723c7)[_0x58ad('0x12')](_0xecbf80);throwIfDateNotValid(_0x5911c0);if(_0x5911c0['isBefore'](_0x500a1b)){var _0x5aa6bf=_0x318824['clone']()['startOf'](_0x58ad('0x13'));var _0x30d6c4=_0x318824[_0x58ad('0x10')]()[_0x58ad('0x14')]('day');return _0x318824[_0x58ad('0x15')](_0x500a1b,_0x30d6c4,undefined,'[]')||_0x318824['isBetween'](_0x5aa6bf,_0x5911c0,undefined,'[]');}else{return _0x318824[_0x58ad('0x15')](_0x500a1b,_0x5911c0,undefined,'[]');}}module['exports'][_0x58ad('0x16')]=timeCompare;function dowCompare(_0x8f431f,_0x192f8a,_0x42eb88){var _0x4199e0=_0x8f431f[_0x58ad('0x7')]('en')[_0x58ad('0x17')](_0x58ad('0x18'))[_0x58ad('0xe')]();return circularDoWInterval(_0x192f8a,_0x42eb88)['includes'](_0x4199e0);}module[_0x58ad('0xc')][_0x58ad('0x19')]=dowCompare;function domCompare(_0x37c985,_0x1bd972,_0x34b345){var _0x5a289e=_0x37c985['date']();if(_0x1bd972===_0x34b345){return _0x5a289e===_0x1bd972;}else{var _0x3a4f84=_0x37c985[_0x58ad('0x1a')]();var _0x13b9d9=_0x1bd972<_0x34b345;let _0x2f14e6=![];var _0x1014ee=0x0;var _0x305174=0x0;if(_0x13b9d9){_0x1014ee=Math[_0x58ad('0x1b')](0x1,_0x1bd972);_0x305174=Math[_0x58ad('0x1c')](_0x34b345,_0x3a4f84);_0x2f14e6=_0x5a289e>=_0x1014ee&&_0x5a289e<=_0x305174;}else{_0x1014ee=Math[_0x58ad('0x1c')](_0x1bd972,_0x3a4f84);_0x305174=Math['max'](0x1,_0x34b345);_0x2f14e6=_0x5a289e>=_0x1014ee||_0x5a289e<=_0x305174;}return _0x2f14e6;}}module[_0x58ad('0xc')][_0x58ad('0x1d')]=domCompare;function monthCompare(_0xaea2f4,_0x3963b2,_0x126622){var _0x656f74=_0xaea2f4[_0x58ad('0x7')]('en')[_0x58ad('0x17')](_0x58ad('0x1e'))[_0x58ad('0xe')]();return circularMonthInterval(_0x3963b2,_0x126622)['includes'](_0x656f74);}module['exports'][_0x58ad('0x1f')]=monthCompare;function iftime(_0x240c4c,_0x15e4b7=moment['tz']['guess'](),_0x3e852b=moment()){if(!validateRx[_0x58ad('0x20')](_0x240c4c)){throw new Error(EINVALID_STRING);}else{var _0x64f8ac=(moment[_0x58ad('0x21')](_0x3e852b)?_0x3e852b['clone']():moment(_0x3e852b))['tz'](_0x15e4b7)[_0x58ad('0x7')]('en');throwIfDateNotValid(_0x64f8ac);var _0xc8bb89=_0x240c4c['split'](',');var _0x36a272=_0xc8bb89[0x0];var _0x52d4c1=_0xc8bb89[0x1];var _0x1689cb=_0xc8bb89[0x2];var _0x2645ff=_0xc8bb89[0x3];let _0x2e77ee=!![];if(_0x36a272!=='*'){var _0x54bf55=_0x36a272[_0x58ad('0x6')]('-');var _0x314922=_[_0x58ad('0x22')](_0x54bf55[0x0],0x5,'0');var _0x549fd0=_0x54bf55[_0x58ad('0x23')]===0x2?_[_0x58ad('0x22')](_0x54bf55[0x1],0x5,'0'):_0x314922;_0x2e77ee=timeCompare(_0x64f8ac,_0x314922,_0x549fd0);}let _0x3ad788=!![];if(_0x52d4c1!=='*'){var _0x2c79b7=_0x52d4c1[_0x58ad('0x6')]('-');var _0x1ee220=_0x2c79b7[0x0];var _0x5df2f5=_0x2c79b7[_0x58ad('0x23')]===0x2?_0x2c79b7[0x1]:_0x1ee220;_0x3ad788=dowCompare(_0x64f8ac,_0x1ee220,_0x5df2f5);}let _0x9c7bfc=!![];if(_0x1689cb!=='*'){var _0x358d77=_0x1689cb[_0x58ad('0x6')]('-');var _0x5717c5=parseDom(_0x358d77[0x0]);var _0x19c57e=_0x358d77[_0x58ad('0x23')]===0x2?parseDom(_0x358d77[0x1]):_0x5717c5;_0x9c7bfc=domCompare(_0x64f8ac,_0x5717c5,_0x19c57e);}let _0xdf4612=!![];if(_0x2645ff!=='*'){var _0x33dfe6=_0x2645ff[_0x58ad('0x6')]('-');var _0x24f6d8=_0x33dfe6[0x0];var _0x173dd1=_0x33dfe6[_0x58ad('0x23')]===0x2?_0x33dfe6[0x1]:_0x33dfe6[0x0];_0xdf4612=monthCompare(_0x64f8ac,_0x24f6d8,_0x173dd1);}return _0x2e77ee&&_0x3ad788&&_0x9c7bfc&&_0xdf4612;}}module['exports'][_0x58ad('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 0238f2e..147dfe2 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83b8=['consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','%s-%s.log','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','message','meta','length','stringify','level','Logger','transports','Console','warn','File','%s-%s','error'];(function(_0x42cd83,_0x5d4e6b){var _0x52df20=function(_0x249973){while(--_0x249973){_0x42cd83['push'](_0x42cd83['shift']());}};_0x52df20(++_0x5d4e6b);}(_0x83b8,0x9e));var _0x883b=function(_0x28ad73,_0xae98cf){_0x28ad73=_0x28ad73-0x0;var _0x363f16=_0x83b8[_0x28ad73];return _0x363f16;};'use strict';var path=require(_0x883b('0x0'));var util=require(_0x883b('0x1'));var moment=require(_0x883b('0x2'));var winston=require(_0x883b('0x3'));var config=require(_0x883b('0x4'));var debugLevel=config[_0x883b('0x5')]?config[_0x883b('0x5')][_0x883b('0x6')]():_0x883b('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x883b('0x8'),'error':_0x883b('0x9'),'warn':_0x883b('0xa'),'info':'white','print':'bold\x20white','success':_0x883b('0xb'),'http':'gray','verbose':_0x883b('0xc'),'debug':_0x883b('0xd'),'silly':_0x883b('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x377aee,_0x4de382,_0x57920d){var _0x231d4a=_0x377aee||_0x883b('0xf');return path[_0x883b('0x10')](_0x231d4a,util['format'](_0x883b('0x11'),_0x4de382,_0x57920d));}function formatter(_0x6e61d8,_0x9e1e3b){_0x9e1e3b['message']=_0x9e1e3b['message'][_0x883b('0x12')](/@@{/g,_0x883b('0x13'))[_0x883b('0x12')](/}@@/g,_0x883b('0x14'))[_0x883b('0x12')](/@{/g,'{{')[_0x883b('0x12')](/}@/g,'}}');return util[_0x883b('0x15')](_0x883b('0x16'),moment()[_0x883b('0x15')](_0x883b('0x17')),_0x9e1e3b['level'][_0x883b('0x18')](),_0x6e61d8,_0x9e1e3b['message']);}function fileFormat(_0x48f75c,_0xb0d33e){_0xb0d33e[_0x883b('0x19')]=_0xb0d33e[_0x883b('0x19')]['replace'](/@@{/g,'{{{')[_0x883b('0x12')](/}@@/g,'}}}')[_0x883b('0x12')](/@{/g,'{{')[_0x883b('0x12')](/}@/g,'}}');var _0x46c2e9=_0xb0d33e[_0x883b('0x1a')]&&Object['keys'](_0xb0d33e['meta'])[_0x883b('0x1b')]?'\x0a\x09'+JSON[_0x883b('0x1c')](_0xb0d33e[_0x883b('0x1a')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0xb0d33e[_0x883b('0x1d')]['toUpperCase'](),_0x48f75c,_0xb0d33e['message'],_0x46c2e9);}function consoleLogger(){var _0x5cc382=new winston[(_0x883b('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x883b('0x1f'))][(_0x883b('0x20'))]({'level':_0x883b('0x21'),'json':![],'formatter':function(_0x3b270f){return formatter('',_0x3b270f);}})]});return _0x5cc382;}function fileLogger(_0xe89dc4,_0xce6ac7){var _0x111054=new winston[(_0x883b('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x883b('0x1f'))][(_0x883b('0x22'))]({'name':util[_0x883b('0x15')](_0x883b('0x23'),_0xe89dc4,_0x883b('0x24')),'filename':getLogFileName(_0xce6ac7,_0xe89dc4,_0x883b('0x24')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1791b4){return fileFormat(_0xe89dc4,_0x1791b4);}}),new winston[(_0x883b('0x1f'))][(_0x883b('0x22'))]({'name':util[_0x883b('0x15')](_0x883b('0x23'),_0xe89dc4,debugLevel),'filename':getLogFileName(_0xce6ac7,_0xe89dc4,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2ba862){return fileFormat(_0xe89dc4,_0x2ba862);}}),new winston[(_0x883b('0x1f'))][(_0x883b('0x20'))]({'level':_0x883b('0x21'),'json':![],'formatter':function(_0x495e54){return fileFormat(_0xe89dc4,_0x495e54);}})]});return _0x111054;}exports[_0x883b('0x25')]=consoleLogger;exports[_0x883b('0x26')]=fileLogger; \ No newline at end of file +var _0x8313=['meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','Console','warn','transports','File','%s-%s','error','fileLogger','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','addColors','join','%s-%s.log','message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase','{{{'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8313,0x1bb));var _0x3831=function(_0x3d0630,_0x476fe6){_0x3d0630=_0x3d0630-0x0;var _0x382f56=_0x8313[_0x3d0630];return _0x382f56;};'use strict';var path=require('path');var util=require(_0x3831('0x0'));var moment=require(_0x3831('0x1'));var winston=require(_0x3831('0x2'));var config=require(_0x3831('0x3'));var debugLevel=config[_0x3831('0x4')]?config[_0x3831('0x4')][_0x3831('0x5')]():_0x3831('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x3831('0x7'),'error':_0x3831('0x8'),'warn':_0x3831('0x9'),'info':_0x3831('0xa'),'print':_0x3831('0xb'),'success':_0x3831('0xc'),'http':'gray','verbose':_0x3831('0xd'),'debug':_0x3831('0xe'),'silly':'bold\x20cyan'};winston[_0x3831('0xf')](XC_LOG_COLORS);function getLogFileName(_0x19a6ac,_0xde28ea,_0x3b5ecc){var _0x416b03=_0x19a6ac||'/var/log/xcally';return path[_0x3831('0x10')](_0x416b03,util['format'](_0x3831('0x11'),_0xde28ea,_0x3b5ecc));}function formatter(_0x387f6c,_0x5d6e45){_0x5d6e45['message']=_0x5d6e45[_0x3831('0x12')][_0x3831('0x13')](/@@{/g,'{{{')[_0x3831('0x13')](/}@@/g,_0x3831('0x14'))[_0x3831('0x13')](/@{/g,'{{')[_0x3831('0x13')](/}@/g,'}}');return util[_0x3831('0x15')](_0x3831('0x16'),moment()[_0x3831('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),_0x5d6e45['level'][_0x3831('0x17')](),_0x387f6c,_0x5d6e45['message']);}function fileFormat(_0x11596c,_0x38f035){_0x38f035[_0x3831('0x12')]=_0x38f035[_0x3831('0x12')]['replace'](/@@{/g,_0x3831('0x18'))[_0x3831('0x13')](/}@@/g,'}}}')[_0x3831('0x13')](/@{/g,'{{')[_0x3831('0x13')](/}@/g,'}}');var _0x1499b2=_0x38f035[_0x3831('0x19')]&&Object[_0x3831('0x1a')](_0x38f035[_0x3831('0x19')])[_0x3831('0x1b')]?'\x0a\x09'+JSON[_0x3831('0x1c')](_0x38f035['meta']):'';return util[_0x3831('0x15')](_0x3831('0x1d'),moment()[_0x3831('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),_0x38f035[_0x3831('0x1e')][_0x3831('0x17')](),_0x11596c,_0x38f035['message'],_0x1499b2);}function consoleLogger(){var _0x1d02c8=new winston[(_0x3831('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x3831('0x20'))]({'level':_0x3831('0x21'),'json':![],'formatter':function(_0x2cf003){return formatter('',_0x2cf003);}})]});return _0x1d02c8;}function fileLogger(_0x3083fe,_0x31e7d2){var _0xe053f2=new winston[(_0x3831('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3831('0x22'))][(_0x3831('0x23'))]({'name':util[_0x3831('0x15')](_0x3831('0x24'),_0x3083fe,_0x3831('0x25')),'filename':getLogFileName(_0x31e7d2,_0x3083fe,_0x3831('0x25')),'level':_0x3831('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1c87d1){return fileFormat(_0x3083fe,_0x1c87d1);}}),new winston[(_0x3831('0x22'))][(_0x3831('0x23'))]({'name':util[_0x3831('0x15')](_0x3831('0x24'),_0x3083fe,debugLevel),'filename':getLogFileName(_0x31e7d2,_0x3083fe,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xa3da38){return fileFormat(_0x3083fe,_0xa3da38);}}),new winston['transports']['Console']({'level':_0x3831('0x21'),'json':![],'formatter':function(_0x4c6e40){return fileFormat(_0x3083fe,_0x4c6e40);}})]});return _0xe053f2;}exports['consoleLogger']=consoleLogger;exports[_0x3831('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 804be95..d6f721b 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['fax','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','consumerSecret','calleridname','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','oldPassword','length','isPlainObject','replace','@@{','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile'];(function(_0x526360,_0x2d33bd){var _0x15d868=function(_0x1b258c){while(--_0x1b258c){_0x526360['push'](_0x526360['shift']());}};_0x15d868(++_0x2d33bd);}(_0x1261,0x144));var _0x1126=function(_0x471448,_0x1c0e9e){_0x471448=_0x471448-0x0;var _0x38190b=_0x1261[_0x471448];return _0x38190b;};var _=require('lodash');var sensitiveFields=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2'),_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'email','clientId',_0x1126('0xa'),_0x1126('0xb'),'code',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'accessTokenSecret',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'membername',_0x1126('0x14'),'calleridnum','exten',_0x1126('0x15'),'clientEmail',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'secret','registry',_0x1126('0x1f')];function maskSensitiveData(_0x154e20){const _0x279455=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x154e20)){for(const _0x45149c in _0x154e20){if(_['isArray'](_0x154e20[_0x45149c])){for(let _0x35fe9f=0x0;_0x35fe9f<_0x154e20[_0x45149c][_0x1126('0x20')];_0x35fe9f++){maskSensitiveData(_0x154e20[_0x45149c][_0x35fe9f]);}}else if(_[_0x1126('0x21')](_0x154e20[_0x45149c])){maskSensitiveData(_0x154e20[_0x45149c]);}else if(_['isString'](_0x154e20[_0x45149c])){_0x154e20[_0x45149c]=_0x154e20[_0x45149c][_0x1126('0x22')](/{{{/g,_0x1126('0x23'))['replace'](/}}}/g,'}@@')[_0x1126('0x22')](/{{/g,'@{')[_0x1126('0x22')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x45149c)){_0x154e20[_0x45149c]=_0x154e20[_0x45149c]['replace'](_0x279455,'*');}}}}}module[_0x1126('0x24')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x1acfa5,_0x56ebd9){var _0x9c20c8=function(_0x5394da){while(--_0x5394da){_0x1acfa5['push'](_0x1acfa5['shift']());}};_0x9c20c8(++_0x56ebd9);}(_0xadb5,0xad));var _0x5adb=function(_0x487a20,_0x607d52){_0x487a20=_0x487a20-0x0;var _0x3fd40c=_0xadb5[_0x487a20];return _0x3fd40c;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 5917050..f7f1d73 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef0f=['lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','isPlainObject','keys','reduce','safeTemplate'];(function(_0x1e0961,_0x4512f5){var _0x1e1764=function(_0x56499c){while(--_0x56499c){_0x1e0961['push'](_0x1e0961['shift']());}};_0x1e1764(++_0x4512f5);}(_0xef0f,0x168));var _0xfef0=function(_0x559e5b,_0x394773){_0x559e5b=_0x559e5b-0x0;var _0x3ff569=_0xef0f[_0x559e5b];return _0x3ff569;};var _=require(_0xfef0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x581303){return _0x581303==='{{'?_0xfef0('0x1'):_0xfef0('0x2');}function safeTemplate(_0x19f865){var _0x4d29e5=_0x19f865;if(typeof _0x19f865===_0xfef0('0x3')){_0x4d29e5=_0x19f865[_0xfef0('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfef0('0x5')](_0x19f865)){_0x4d29e5=_0x19f865['map'](function(_0x2a6fcf){return safeTemplate(_0x2a6fcf);});}else if(_[_0xfef0('0x6')](_0x19f865)){_0x4d29e5=Object[_0xfef0('0x7')](_0x19f865)[_0xfef0('0x8')](function(_0xad43e,_0x11dfd7){_0xad43e[_0x11dfd7]=safeTemplate(_0x19f865[_0x11dfd7]);return _0xad43e;},{});}return _0x4d29e5;}module['exports'][_0xfef0('0x9')]=safeTemplate; \ No newline at end of file +var _0x4024=['exports','lodash','\x20}\x20}','string','isArray','map','keys','reduce'];(function(_0x280a18,_0x269e99){var _0x21f648=function(_0x5699fb){while(--_0x5699fb){_0x280a18['push'](_0x280a18['shift']());}};_0x21f648(++_0x269e99);}(_0x4024,0x89));var _0x4402=function(_0x3513ed,_0x1a671e){_0x3513ed=_0x3513ed-0x0;var _0x4a70aa=_0x4024[_0x3513ed];return _0x4a70aa;};var _=require(_0x4402('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x10e0ef){return _0x10e0ef==='{{'?'{\x20{\x20':_0x4402('0x1');}function safeTemplate(_0x2b36c7){var _0x49a2e2=_0x2b36c7;if(typeof _0x2b36c7===_0x4402('0x2')){_0x49a2e2=_0x2b36c7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x4402('0x3')](_0x2b36c7)){_0x49a2e2=_0x2b36c7[_0x4402('0x4')](function(_0x5bdb3f){return safeTemplate(_0x5bdb3f);});}else if(_['isPlainObject'](_0x2b36c7)){_0x49a2e2=Object[_0x4402('0x5')](_0x2b36c7)[_0x4402('0x6')](function(_0x168acd,_0x4ed77d){_0x168acd[_0x4ed77d]=safeTemplate(_0x2b36c7[_0x4ed77d]);return _0x168acd;},{});}return _0x49a2e2;}module[_0x4402('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index d1e31b1..588977f 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fd2=['info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','resolve','server/app.json','legacy-libs','isArray','apps','env','NODE_PATH','string','pathExists','then'];(function(_0x24430a,_0x5eaba6){var _0x5a23f7=function(_0x221871){while(--_0x221871){_0x24430a['push'](_0x24430a['shift']());}};_0x5a23f7(++_0x5eaba6);}(_0x3fd2,0x1be));var _0x23fd=function(_0x208897,_0x1cfafc){_0x208897=_0x208897-0x0;var _0x1fed9e=_0x3fd2[_0x208897];return _0x1fed9e;};var fs=require(_0x23fd('0x0'));var path=require(_0x23fd('0x1'));var config=require(_0x23fd('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0x23fd('0x3')](root,_0x23fd('0x4'));var NODEPATH=path[_0x23fd('0x3')](root,_0x23fd('0x5'));function setLegacyLibsNodeEnvPath(_0x19934e){let _0x3b8e7d=![];if(Array[_0x23fd('0x6')](_0x19934e[_0x23fd('0x7')])){var _0x4c1fb5=_0x19934e[_0x23fd('0x7')]['findIndex'](function(_0x599f17){return _0x599f17['name']==='motion2';});if(_0x4c1fb5>-0x1){var _0x4b1286=_0x19934e[_0x23fd('0x7')][_0x4c1fb5];if(typeof _0x4b1286[_0x23fd('0x8')][_0x23fd('0x9')]!==_0x23fd('0xa')){_0x4b1286[_0x23fd('0x8')][_0x23fd('0x9')]=NODEPATH;_0x3b8e7d=!![];}}return{'appConfig':_0x19934e,'updated':_0x3b8e7d};}}function updateAppConfig(_0x49f7e6){return fs[_0x23fd('0xb')](APP_JSON_PATH)[_0x23fd('0xc')](function(_0x5313c0){if(_0x5313c0){return fs['readJSON'](APP_JSON_PATH)[_0x23fd('0xc')](function(_0x458388){var _0x155f38=setLegacyLibsNodeEnvPath(_0x458388);if(_0x155f38['updated']){_0x49f7e6[_0x23fd('0xd')](_0x23fd('0xe'));return fs[_0x23fd('0xf')](APP_JSON_PATH,_0x458388,{'spaces':0x2});}else{return Promise[_0x23fd('0x3')]();}});}else{return Promise[_0x23fd('0x3')]();}});}module[_0x23fd('0x10')]=updateAppConfig; \ No newline at end of file +var _0x1f16=['resolve','legacy-libs','isArray','apps','findIndex','motion2','env','NODE_PATH','string','pathExists','readJSON','then','writeJSON','exports','fs-extra','path','../config/environment','root'];(function(_0x15732b,_0x191cac){var _0x251f3e=function(_0x47cae6){while(--_0x47cae6){_0x15732b['push'](_0x15732b['shift']());}};_0x251f3e(++_0x191cac);}(_0x1f16,0x1f4));var _0x61f1=function(_0x1f6154,_0x91c64e){_0x1f6154=_0x1f6154-0x0;var _0x8326c6=_0x1f16[_0x1f6154];return _0x8326c6;};var fs=require(_0x61f1('0x0'));var path=require(_0x61f1('0x1'));var config=require(_0x61f1('0x2'));var root=config[_0x61f1('0x3')];var APP_JSON_PATH=path[_0x61f1('0x4')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0x61f1('0x5'));function setLegacyLibsNodeEnvPath(_0x312cd3){let _0x4b550a=![];if(Array[_0x61f1('0x6')](_0x312cd3[_0x61f1('0x7')])){var _0x4de99b=_0x312cd3[_0x61f1('0x7')][_0x61f1('0x8')](function(_0x55032c){return _0x55032c['name']===_0x61f1('0x9');});if(_0x4de99b>-0x1){var _0x1a5f63=_0x312cd3[_0x61f1('0x7')][_0x4de99b];if(typeof _0x1a5f63[_0x61f1('0xa')][_0x61f1('0xb')]!==_0x61f1('0xc')){_0x1a5f63[_0x61f1('0xa')][_0x61f1('0xb')]=NODEPATH;_0x4b550a=!![];}}return{'appConfig':_0x312cd3,'updated':_0x4b550a};}}function updateAppConfig(_0x2979fa){return fs[_0x61f1('0xd')](APP_JSON_PATH)['then'](function(_0x3e1e24){if(_0x3e1e24){return fs[_0x61f1('0xe')](APP_JSON_PATH)[_0x61f1('0xf')](function(_0x206bce){var _0x6baee8=setLegacyLibsNodeEnvPath(_0x206bce);if(_0x6baee8['updated']){_0x2979fa['info']('Updating\x20app.json');return fs[_0x61f1('0x10')](APP_JSON_PATH,_0x206bce,{'spaces':0x2});}else{return Promise[_0x61f1('0x4')]();}});}else{return Promise[_0x61f1('0x4')]();}});}module[_0x61f1('0x11')]=updateAppConfig; \ No newline at end of file